Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
commitefbc9d9043ff8ff92716ddd00a5f61412d535593 (patch)
tree8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/filters
parentdf6b139a6d9027156f614b68687e039e3a5854db (diff)
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters')
-rw-r--r--src/filters/BaseClasses/amextra.cpp12
-rw-r--r--src/filters/BaseClasses/amextra.h2
-rw-r--r--src/filters/BaseClasses/amfilter.cpp2053
-rw-r--r--src/filters/BaseClasses/amfilter.h229
-rw-r--r--src/filters/BaseClasses/amvideo.cpp117
-rw-r--r--src/filters/BaseClasses/arithutil.cpp167
-rw-r--r--src/filters/BaseClasses/cache.h10
-rw-r--r--src/filters/BaseClasses/checkbmi.h164
-rw-r--r--src/filters/BaseClasses/combase.cpp88
-rw-r--r--src/filters/BaseClasses/combase.h37
-rw-r--r--src/filters/BaseClasses/cprop.cpp167
-rw-r--r--src/filters/BaseClasses/cprop.h46
-rw-r--r--src/filters/BaseClasses/ctlutil.cpp1712
-rw-r--r--src/filters/BaseClasses/ctlutil.h366
-rw-r--r--src/filters/BaseClasses/ddmm.cpp175
-rw-r--r--src/filters/BaseClasses/ddmm.h10
-rw-r--r--src/filters/BaseClasses/dllentry.cpp211
-rw-r--r--src/filters/BaseClasses/dllsetup.cpp957
-rw-r--r--src/filters/BaseClasses/dllsetup.h10
-rw-r--r--src/filters/BaseClasses/dxmperf.h24
-rw-r--r--src/filters/BaseClasses/fourcc.h8
-rw-r--r--src/filters/BaseClasses/measure.h26
-rw-r--r--src/filters/BaseClasses/msgthrd.h55
-rw-r--r--src/filters/BaseClasses/mtype.cpp193
-rw-r--r--src/filters/BaseClasses/mtype.h38
-rw-r--r--src/filters/BaseClasses/outputq.cpp406
-rw-r--r--src/filters/BaseClasses/outputq.h29
-rw-r--r--src/filters/BaseClasses/perflog.cpp182
-rw-r--r--src/filters/BaseClasses/perflog.h23
-rw-r--r--src/filters/BaseClasses/perfstruct.h76
-rw-r--r--src/filters/BaseClasses/pstream.cpp72
-rw-r--r--src/filters/BaseClasses/pstream.h89
-rw-r--r--src/filters/BaseClasses/pullpin.cpp569
-rw-r--r--src/filters/BaseClasses/pullpin.h50
-rw-r--r--src/filters/BaseClasses/refclock.cpp153
-rw-r--r--src/filters/BaseClasses/refclock.h22
-rw-r--r--src/filters/BaseClasses/renbase.cpp963
-rw-r--r--src/filters/BaseClasses/renbase.h100
-rw-r--r--src/filters/BaseClasses/schedule.cpp138
-rw-r--r--src/filters/BaseClasses/schedule.h29
-rw-r--r--src/filters/BaseClasses/seekpt.cpp65
-rw-r--r--src/filters/BaseClasses/source.cpp326
-rw-r--r--src/filters/BaseClasses/source.h70
-rw-r--r--src/filters/BaseClasses/streams.h68
-rw-r--r--src/filters/BaseClasses/strmctl.cpp327
-rw-r--r--src/filters/BaseClasses/strmctl.h71
-rw-r--r--src/filters/BaseClasses/sysclock.cpp17
-rw-r--r--src/filters/BaseClasses/transfrm.cpp386
-rw-r--r--src/filters/BaseClasses/transfrm.h42
-rw-r--r--src/filters/BaseClasses/transip.cpp405
-rw-r--r--src/filters/BaseClasses/transip.h34
-rw-r--r--src/filters/BaseClasses/videoctl.cpp261
-rw-r--r--src/filters/BaseClasses/videoctl.h72
-rw-r--r--src/filters/BaseClasses/vtrans.cpp270
-rw-r--r--src/filters/BaseClasses/vtrans.h13
-rw-r--r--src/filters/BaseClasses/winctrl.cpp825
-rw-r--r--src/filters/BaseClasses/winctrl.h67
-rw-r--r--src/filters/BaseClasses/winutil.cpp716
-rw-r--r--src/filters/BaseClasses/winutil.h47
-rw-r--r--src/filters/BaseClasses/wxdebug.cpp979
-rw-r--r--src/filters/BaseClasses/wxdebug.h265
-rw-r--r--src/filters/BaseClasses/wxlist.cpp168
-rw-r--r--src/filters/BaseClasses/wxlist.h228
-rw-r--r--src/filters/BaseClasses/wxutil.cpp401
-rw-r--r--src/filters/BaseClasses/wxutil.h219
-rw-r--r--src/filters/FilterApp.cpp28
-rw-r--r--src/filters/FilterApp.h16
-rw-r--r--src/filters/InternalPropertyPage.cpp298
-rw-r--r--src/filters/InternalPropertyPage.h123
-rw-r--r--src/filters/PinInfoWnd.cpp272
-rw-r--r--src/filters/PinInfoWnd.h56
-rw-r--r--src/filters/misc/SyncClock/Interfaces.h11
-rw-r--r--src/filters/misc/SyncClock/SyncClock.cpp71
-rw-r--r--src/filters/misc/SyncClock/SyncClock.h34
-rw-r--r--src/filters/misc/SyncClock/resource.h2
-rw-r--r--src/filters/misc/SyncClock/stdafx.cpp8
-rw-r--r--src/filters/misc/SyncClock/stdafx.h8
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxer.cpp662
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxer.h137
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp324
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h104
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp793
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h42
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp14
-rw-r--r--src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h27
-rw-r--r--src/filters/muxer/BaseMuxer/BitStream.cpp156
-rw-r--r--src/filters/muxer/BaseMuxer/BitStream.h51
-rw-r--r--src/filters/muxer/BaseMuxer/stdafx.cpp8
-rw-r--r--src/filters/muxer/BaseMuxer/stdafx.h8
-rw-r--r--src/filters/muxer/DSMMuxer/DSMMuxer.cpp671
-rw-r--r--src/filters/muxer/DSMMuxer/DSMMuxer.h52
-rw-r--r--src/filters/muxer/DSMMuxer/resource.h2
-rw-r--r--src/filters/muxer/DSMMuxer/stdafx.cpp8
-rw-r--r--src/filters/muxer/DSMMuxer/stdafx.h8
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp1056
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaFile.h731
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp2188
-rw-r--r--src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h148
-rw-r--r--src/filters/muxer/MatroskaMuxer/resource.h2
-rw-r--r--src/filters/muxer/MatroskaMuxer/stdafx.cpp8
-rw-r--r--src/filters/muxer/MatroskaMuxer/stdafx.h8
-rw-r--r--src/filters/muxer/WavDest/WavDest.cpp97
-rw-r--r--src/filters/muxer/WavDest/WavDest.h10
-rw-r--r--src/filters/muxer/WavDest/stdafx.cpp8
-rw-r--r--src/filters/muxer/WavDest/stdafx.h8
-rw-r--r--src/filters/parser/AviSplitter/AviFile.cpp1051
-rw-r--r--src/filters/parser/AviSplitter/AviFile.h90
-rw-r--r--src/filters/parser/AviSplitter/AviReportWnd.cpp558
-rw-r--r--src/filters/parser/AviSplitter/AviReportWnd.h45
-rw-r--r--src/filters/parser/AviSplitter/AviSplitter.cpp1296
-rw-r--r--src/filters/parser/AviSplitter/AviSplitter.h62
-rw-r--r--src/filters/parser/AviSplitter/resource.h2
-rw-r--r--src/filters/parser/AviSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/AviSplitter/stdafx.h8
-rw-r--r--src/filters/parser/BaseSplitter/AsyncReader.cpp276
-rw-r--r--src/filters/parser/BaseSplitter/AsyncReader.h130
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitter.cpp1722
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitter.h559
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFile.cpp319
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFile.h67
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp2894
-rw-r--r--src/filters/parser/BaseSplitter/BaseSplitterFileEx.h699
-rw-r--r--src/filters/parser/BaseSplitter/MultiFiles.cpp251
-rw-r--r--src/filters/parser/BaseSplitter/MultiFiles.h102
-rw-r--r--src/filters/parser/BaseSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/BaseSplitter/stdafx.h8
-rw-r--r--src/filters/parser/DSMSplitter/DSMSplitter.cpp294
-rw-r--r--src/filters/parser/DSMSplitter/DSMSplitter.h30
-rw-r--r--src/filters/parser/DSMSplitter/DSMSplitterFile.cpp677
-rw-r--r--src/filters/parser/DSMSplitter/DSMSplitterFile.h52
-rw-r--r--src/filters/parser/DSMSplitter/resource.h2
-rw-r--r--src/filters/parser/DSMSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/DSMSplitter/stdafx.h8
-rw-r--r--src/filters/parser/DiracSplitter/DiracSplitter.cpp127
-rw-r--r--src/filters/parser/DiracSplitter/DiracSplitter.h56
-rw-r--r--src/filters/parser/DiracSplitter/DiracSplitterFile.cpp38
-rw-r--r--src/filters/parser/DiracSplitter/DiracSplitterFile.h26
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.cpp88
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.h243
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.cpp110
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.h687
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.cpp34
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.h150
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.cpp16
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.h130
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.cpp22
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.h125
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.cpp54
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.h194
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.cpp210
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.h284
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.cpp12
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.h96
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.cpp154
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.h439
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.cpp10
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.h132
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.cpp58
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.h114
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.cpp64
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.h395
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.cpp92
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.h314
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.cpp42
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.h114
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.cpp50
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.h172
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.cpp226
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.h661
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/arrays.h885
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.cpp30
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.h324
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec_template.h354
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.cpp16
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.h156
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.cpp176
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.h848
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.cpp16
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.h72
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.cpp400
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.h3005
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/common_types.h263
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.cpp14
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.h4
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.cpp16
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.h65
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_types.h244
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.cpp764
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.h468
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.cpp432
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.h14
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.cpp624
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.h661
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.cpp532
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.h434
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.cpp305
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.h844
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.cpp226
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.h170
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.cpp128
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.h277
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.cpp70
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.h78
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.cpp40
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.h94
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.cpp1209
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.h1140
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils_mmx.cpp1432
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.cpp88
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.h144
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/decoder_types.h21
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp116
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.h248
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.cpp578
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.h164
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.cpp300
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.h200
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.cpp68
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.h264
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.cpp76
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.h112
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.cpp794
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.h627
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.cpp309
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.h77
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.cpp145
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.h328
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.cpp600
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.h286
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.cpp847
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.h10
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.cpp146
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.h108
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.cpp252
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.h123
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.cpp280
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.h243
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.cpp681
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.h570
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.cpp386
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.h289
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.cpp144
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.h77
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert_mmx.cpp148
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.cpp390
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.h178
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.cpp62
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.h100
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.cpp1723
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.h1000
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.cpp1913
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.h44
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.cpp152
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.h113
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.cpp208
-rw-r--r--src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.h142
-rw-r--r--src/filters/parser/DiracSplitter/resource.h2
-rw-r--r--src/filters/parser/DiracSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/DiracSplitter/stdafx.h36
-rw-r--r--src/filters/parser/FLVSplitter/FLVSplitter.cpp1278
-rw-r--r--src/filters/parser/FLVSplitter/FLVSplitter.h110
-rw-r--r--src/filters/parser/FLVSplitter/resource.h2
-rw-r--r--src/filters/parser/FLVSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/FLVSplitter/stdafx.h8
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.cpp172
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.h24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.cpp266
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.h24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.cpp216
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h177
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.cpp183
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.h19
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4.h74
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.cpp28
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.h29
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Array.h93
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.cpp374
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.h476
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.cpp625
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.h27
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp264
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.h14
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.cpp140
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.h46
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.cpp312
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.h94
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.cpp42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.h24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.cpp42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.h27
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.cpp50
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.h14
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.cpp2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.h15
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.cpp31
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.h6
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.cpp75
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.h23
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.cpp56
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.h18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.cpp57
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.h30
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.cpp14
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.h22
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Debug.cpp2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp39
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h39
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h9
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.cpp8
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.h38
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp63
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.h6
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.cpp27
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.h2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.cpp47
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.h19
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.cpp108
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.h42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.cpp24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.h11
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.cpp42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.h38
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.cpp48
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.h77
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileByteStream.h56
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.cpp7
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.h3
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.cpp74
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.h14
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.cpp199
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.h37
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.cpp4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.h12
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.cpp28
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.h50
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.cpp26
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.h24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.cpp22
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.h32
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.cpp49
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.h34
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.cpp128
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.h21
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.cpp18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.h4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.cpp42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.h17
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Interfaces.h2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.cpp22
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.h11
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.cpp97
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.h83
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.cpp26
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.h2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.cpp24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.h17
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.cpp7
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.h10
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.cpp244
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.h38
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.cpp143
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.h50
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4List.h203
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.cpp747
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.h61
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.cpp71
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.h29
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.cpp27
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.h16
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.cpp10
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.h14
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.cpp18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.h13
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.cpp192
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.h13
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.cpp89
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.h22
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.cpp88
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.h19
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.cpp545
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.h59
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.cpp65
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.h24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.cpp8
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.h4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.cpp204
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.h102
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.cpp18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.h17
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.cpp42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.h18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.cpp21
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.h19
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.cpp59
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.h50
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.cpp716
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.h62
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.cpp837
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.h116
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.cpp305
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.h101
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.cpp890
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.h106
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Results.cpp75
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.cpp17
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.h10
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.cpp212
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.h140
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.cpp12
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.h100
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.cpp505
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.h211
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.cpp669
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.h205
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.cpp24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.h24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.cpp97
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.h13
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.cpp88
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.h23
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.cpp17
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.h7
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.cpp14
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.h4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.cpp57
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.h16
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.cpp60
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.h30
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.cpp119
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.h25
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.cpp52
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.h2
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.cpp42
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.h13
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.cpp79
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.h16
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.cpp86
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.h28
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp123
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h41
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.cpp89
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.h66
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.cpp350
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.h16
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.cpp4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.h10
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.cpp70
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.h51
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.cpp199
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.h58
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.cpp166
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.h22
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp24
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.h18
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.cpp10
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.h41
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.cpp132
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.h28
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Types.h29
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.cpp41
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.h4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.cpp177
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.h61
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.cpp82
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.h21
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.cpp16
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.h4
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp614
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h22
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.cpp296
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.h9
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.cpp78
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.h6
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp232
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.h49
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp1021
-rw-r--r--src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.h337
-rw-r--r--src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp64
-rw-r--r--src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.h22
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.cpp2806
-rw-r--r--src/filters/parser/MP4Splitter/MP4Splitter.h60
-rw-r--r--src/filters/parser/MP4Splitter/MP4SplitterFile.cpp32
-rw-r--r--src/filters/parser/MP4Splitter/MP4SplitterFile.h10
-rw-r--r--src/filters/parser/MP4Splitter/resource.h2
-rw-r--r--src/filters/parser/MP4Splitter/stdafx.cpp8
-rw-r--r--src/filters/parser/MP4Splitter/stdafx.h8
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaFile.cpp1959
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaFile.h1013
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp2296
-rw-r--r--src/filters/parser/MatroskaSplitter/MatroskaSplitter.h116
-rw-r--r--src/filters/parser/MatroskaSplitter/resource.h2
-rw-r--r--src/filters/parser/MatroskaSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/MatroskaSplitter/stdafx.h8
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitter.cpp172
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitter.h28
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitterFile.cpp598
-rw-r--r--src/filters/parser/MpaSplitter/MpaSplitterFile.h56
-rw-r--r--src/filters/parser/MpaSplitter/resource.h2
-rw-r--r--src/filters/parser/MpaSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/MpaSplitter/stdafx.h8
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.cpp2790
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.h78
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.cpp1400
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitterFile.h215
-rw-r--r--src/filters/parser/MpegSplitter/resource.h2
-rw-r--r--src/filters/parser/MpegSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/MpegSplitter/stdafx.h8
-rw-r--r--src/filters/parser/NutSplitter/NutFile.cpp266
-rw-r--r--src/filters/parser/NutSplitter/NutFile.h210
-rw-r--r--src/filters/parser/NutSplitter/NutSplitter.cpp486
-rw-r--r--src/filters/parser/NutSplitter/NutSplitter.h30
-rw-r--r--src/filters/parser/NutSplitter/resource.h2
-rw-r--r--src/filters/parser/NutSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/NutSplitter/stdafx.h8
-rw-r--r--src/filters/parser/OggSplitter/OggFile.cpp97
-rw-r--r--src/filters/parser/OggSplitter/OggFile.h80
-rw-r--r--src/filters/parser/OggSplitter/OggSplitter.cpp1960
-rw-r--r--src/filters/parser/OggSplitter/OggSplitter.h179
-rw-r--r--src/filters/parser/OggSplitter/resource.h2
-rw-r--r--src/filters/parser/OggSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/OggSplitter/stdafx.h8
-rw-r--r--src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp3980
-rw-r--r--src/filters/parser/RealMediaSplitter/RealMediaSplitter.h452
-rw-r--r--src/filters/parser/RealMediaSplitter/resource.h2
-rw-r--r--src/filters/parser/RealMediaSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/RealMediaSplitter/stdafx.h8
-rw-r--r--src/filters/parser/RoQSplitter/RoQSplitter.cpp1546
-rw-r--r--src/filters/parser/RoQSplitter/RoQSplitter.h122
-rw-r--r--src/filters/parser/RoQSplitter/resource.h2
-rw-r--r--src/filters/parser/RoQSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/RoQSplitter/stdafx.h8
-rw-r--r--src/filters/parser/SSFSplitter/SSFSplitter.cpp316
-rw-r--r--src/filters/parser/SSFSplitter/SSFSplitter.h34
-rw-r--r--src/filters/parser/SSFSplitter/resource.h2
-rw-r--r--src/filters/parser/SSFSplitter/stdafx.cpp8
-rw-r--r--src/filters/parser/SSFSplitter/stdafx.h8
-rw-r--r--src/filters/parser/StreamDriveThru/StreamDriveThru.cpp534
-rw-r--r--src/filters/parser/StreamDriveThru/StreamDriveThru.h108
-rw-r--r--src/filters/parser/StreamDriveThru/resource.h2
-rw-r--r--src/filters/parser/StreamDriveThru/stdafx.cpp8
-rw-r--r--src/filters/parser/StreamDriveThru/stdafx.h8
-rw-r--r--src/filters/reader/CDDAReader/CDDAReader.cpp619
-rw-r--r--src/filters/reader/CDDAReader/CDDAReader.h94
-rw-r--r--src/filters/reader/CDDAReader/resource.h2
-rw-r--r--src/filters/reader/CDDAReader/stdafx.cpp8
-rw-r--r--src/filters/reader/CDDAReader/stdafx.h8
-rw-r--r--src/filters/reader/CDXAReader/CDXAReader.cpp754
-rw-r--r--src/filters/reader/CDXAReader/CDXAReader.h68
-rw-r--r--src/filters/reader/CDXAReader/resource.h2
-rw-r--r--src/filters/reader/CDXAReader/stdafx.cpp8
-rw-r--r--src/filters/reader/CDXAReader/stdafx.h8
-rw-r--r--src/filters/reader/UDPReader/UDPReader.cpp578
-rw-r--r--src/filters/reader/UDPReader/UDPReader.h80
-rw-r--r--src/filters/reader/UDPReader/resource.h2
-rw-r--r--src/filters/reader/UDPReader/stdafx.cpp8
-rw-r--r--src/filters/reader/UDPReader/stdafx.h8
-rw-r--r--src/filters/reader/VTSReader/VTSReader.cpp144
-rw-r--r--src/filters/reader/VTSReader/VTSReader.h38
-rw-r--r--src/filters/reader/VTSReader/resource.h2
-rw-r--r--src/filters/reader/VTSReader/stdafx.cpp8
-rw-r--r--src/filters/reader/VTSReader/stdafx.h8
-rw-r--r--src/filters/reader/asyncreader/asyncio.cpp294
-rw-r--r--src/filters/reader/asyncreader/asyncio.h103
-rw-r--r--src/filters/reader/asyncreader/asyncrdr.cpp219
-rw-r--r--src/filters/reader/asyncreader/asyncrdr.h53
-rw-r--r--src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp1603
-rw-r--r--src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h126
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/BPMDetect.h30
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSampleBuffer.h64
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSamplePipe.h52
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/STTypes.h160
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/SoundTouch.h68
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/3dnow_win.cpp66
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.cpp26
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.h20
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/BPMDetect.cpp58
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIFOSampleBuffer.cpp54
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp68
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.h106
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.cpp50
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.h20
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp170
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.h60
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/SoundTouch.cpp192
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp302
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.h102
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/cpu_detect.h4
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp36
-rw-r--r--src/filters/renderer/MpcAudioRenderer/SoundTouch/source/sse_optimized.cpp98
-rw-r--r--src/filters/renderer/MpcAudioRenderer/resource.h2
-rw-r--r--src/filters/renderer/MpcAudioRenderer/stdafx.cpp2
-rw-r--r--src/filters/renderer/MpcAudioRenderer/stdafx.h2
-rw-r--r--src/filters/source/BaseSource/BaseSource.cpp130
-rw-r--r--src/filters/source/BaseSource/BaseSource.h135
-rw-r--r--src/filters/source/BaseSource/stdafx.cpp8
-rw-r--r--src/filters/source/BaseSource/stdafx.h8
-rw-r--r--src/filters/source/D2VSource/D2VSource.cpp264
-rw-r--r--src/filters/source/D2VSource/D2VSource.h22
-rw-r--r--src/filters/source/D2VSource/MPEG2Dec.h418
-rw-r--r--src/filters/source/D2VSource/idctfpu.cpp714
-rw-r--r--src/filters/source/D2VSource/idctref.cpp618
-rw-r--r--src/filters/source/D2VSource/resource.h2
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.cpp624
-rw-r--r--src/filters/source/DTSAC3Source/DTSAC3Source.h36
-rw-r--r--src/filters/source/DTSAC3Source/resource.h2
-rw-r--r--src/filters/source/DTSAC3Source/stdafx.cpp8
-rw-r--r--src/filters/source/DTSAC3Source/stdafx.h8
-rw-r--r--src/filters/source/FLICSource/FLICSource.cpp975
-rw-r--r--src/filters/source/FLICSource/FLICSource.h157
-rw-r--r--src/filters/source/FLICSource/resource.h2
-rw-r--r--src/filters/source/FLICSource/stdafx.cpp8
-rw-r--r--src/filters/source/FLICSource/stdafx.h8
-rw-r--r--src/filters/source/FlacSource/FlacSource.cpp325
-rw-r--r--src/filters/source/FlacSource/FlacSource.h47
-rw-r--r--src/filters/source/FlacSource/resource.h2
-rw-r--r--src/filters/source/FlacSource/stdafx.cpp8
-rw-r--r--src/filters/source/FlacSource/stdafx.h8
-rw-r--r--src/filters/source/ShoutcastSource/ShoutcastSource.cpp850
-rw-r--r--src/filters/source/ShoutcastSource/ShoutcastSource.h240
-rw-r--r--src/filters/source/ShoutcastSource/resource.h2
-rw-r--r--src/filters/source/ShoutcastSource/stdafx.cpp8
-rw-r--r--src/filters/source/ShoutcastSource/stdafx.h8
-rw-r--r--src/filters/source/SubtitleSource/SubtitleSource.cpp865
-rw-r--r--src/filters/source/SubtitleSource/SubtitleSource.h95
-rw-r--r--src/filters/source/SubtitleSource/resource.h2
-rw-r--r--src/filters/source/SubtitleSource/stdafx.cpp8
-rw-r--r--src/filters/source/SubtitleSource/stdafx.h8
-rw-r--r--src/filters/stdafx.cpp8
-rw-r--r--src/filters/stdafx.h8
-rw-r--r--src/filters/switcher/AudioSwitcher/Audio.cpp447
-rw-r--r--src/filters/switcher/AudioSwitcher/Audio.h44
-rw-r--r--src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp873
-rw-r--r--src/filters/switcher/AudioSwitcher/AudioSwitcher.h84
-rw-r--r--src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp1368
-rw-r--r--src/filters/switcher/AudioSwitcher/StreamSwitcher.h254
-rw-r--r--src/filters/switcher/AudioSwitcher/stdafx.cpp8
-rw-r--r--src/filters/switcher/AudioSwitcher/stdafx.h8
-rw-r--r--src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp798
-rw-r--r--src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h30
-rw-r--r--src/filters/transform/AVI2AC3Filter/resource.h2
-rw-r--r--src/filters/transform/AVI2AC3Filter/stdafx.cpp8
-rw-r--r--src/filters/transform/AVI2AC3Filter/stdafx.h8
-rw-r--r--src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp1123
-rw-r--r--src/filters/transform/BaseVideoFilter/BaseVideoFilter.h81
-rw-r--r--src/filters/transform/BaseVideoFilter/stdafx.cpp8
-rw-r--r--src/filters/transform/BaseVideoFilter/stdafx.h8
-rw-r--r--src/filters/transform/BufferFilter/BufferFilter.cpp342
-rw-r--r--src/filters/transform/BufferFilter/BufferFilter.h95
-rw-r--r--src/filters/transform/BufferFilter/stdafx.cpp8
-rw-r--r--src/filters/transform/BufferFilter/stdafx.h8
-rw-r--r--src/filters/transform/DeCSSFilter/DeCSSFilter.cpp227
-rw-r--r--src/filters/transform/DeCSSFilter/DeCSSFilter.h14
-rw-r--r--src/filters/transform/DeCSSFilter/stdafx.cpp8
-rw-r--r--src/filters/transform/DeCSSFilter/stdafx.h8
-rw-r--r--src/filters/transform/MPCVideoDec/CpuId.cpp308
-rw-r--r--src/filters/transform/MPCVideoDec/CpuId.h62
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoder.cpp1142
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoder.h209
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp576
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderH264.h52
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.cpp280
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.h38
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp462
-rw-r--r--src/filters/transform/MPCVideoDec/DXVADecoderVC1.h150
-rw-r--r--src/filters/transform/MPCVideoDec/FfmpegContext.c1183
-rw-r--r--src/filters/transform/MPCVideoDec/FfmpegContext.h28
-rw-r--r--src/filters/transform/MPCVideoDec/H264QuantizationMatrix.h580
-rw-r--r--src/filters/transform/MPCVideoDec/IMPCVideoDecFilter.h69
-rw-r--r--src/filters/transform/MPCVideoDec/MPCAudioDecFilter.cpp465
-rw-r--r--src/filters/transform/MPCVideoDec/MPCAudioDecFilter.h48
-rw-r--r--src/filters/transform/MPCVideoDec/MPCFfmpegDec.cpp14
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp3136
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h428
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp424
-rw-r--r--src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.h134
-rw-r--r--src/filters/transform/MPCVideoDec/TlibavcodecExt.cpp36
-rw-r--r--src/filters/transform/MPCVideoDec/TlibavcodecExt.h34
-rw-r--r--src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.cpp167
-rw-r--r--src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.h43
-rw-r--r--src/filters/transform/MPCVideoDec/VideoDecOutputPin.cpp170
-rw-r--r--src/filters/transform/MPCVideoDec/VideoDecOutputPin.h30
-rw-r--r--src/filters/transform/MPCVideoDec/ffImgfmt.cpp1745
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h95
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h77
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/char_t.h307
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/compiler.h72
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/config.h58
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/cpudetect.h27
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h562
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h261
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/CompilatorVersion.c40
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.c57
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.h8
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.c121
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.h15
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c62
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.c914
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.h5
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c9
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c270
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h17
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/adpcm.c418
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c106
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.c1186
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.h12
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_enc.h12
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_rom.h3319
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/rom_dec.h25860
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.c8809
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.h14
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_enc.h10
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/audioconvert.h2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h228
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c136
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bytestream.h14
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.c194
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.h218
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cook.c744
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cookdata.h658
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/corepng.c132
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cscd.c227
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cyuv.c40
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c2630
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.h163
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h2503
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec.c359
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec_data.c2013
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/error_resilience.c1178
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eval.h12
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faandct.c156
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faanidct.c163
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/fft.c123
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/flvdec.c42
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/get_bits.h274
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.c265
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.h809
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.c13
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.h5
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261_parser.c52
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261data.h124
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261dec.c357
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.c268
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.h176
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263_parser.c45
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263data.h372
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263dec.c605
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c2741
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.h1020
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cabac.c1311
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cavlc.c1245
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_direct.c403
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_dxva.c969
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_loopfilter.c764
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_mvpred.h196
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_parser.c191
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_ps.c493
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_refs.c594
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_sei.c112
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264data.h374
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264idct.c202
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c1604
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h5
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.c28
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.h3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c771
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c44
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.c860
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.h3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8dsp.c553
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8huf.h140
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ituh263dec.c942
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.c57
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.h48
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpeglsdec.c142
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jrevdct.c1832
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/libamr.c99
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mathops.h41
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct.c70
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.c19
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.h19
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.c100
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.h3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.c937
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.h7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegenc.h3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.c17
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.h8
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp_parser.c97
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdec.c446
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdsp.c9
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpc_helper.c99
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c2001
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h17
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12data.c316
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12decdata.h55
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4data.h566
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.c158
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.h69
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video_parser.c45
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c2637
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c1785
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.h114
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo_common.h918
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4.c1661
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.c3623
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.h3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoser.c162
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoserdec.c117
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/options.c105
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.c187
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.h8
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h161
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rangecoder.h91
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ratecontrol.h15
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rectangle.h155
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rl.h7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv10.c744
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30.c103
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30data.h16
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30dsp.c7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.c718
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.h18
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34data.h128
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34vlc.h7966
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40.c302
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40data.h53
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40dsp.c18
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40vlc2.h1300
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/simple_idct.c620
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5x.h343
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5xdec.c72
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.c7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.h7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_cb.h1576
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_vlc.h97
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1dec.c1110
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq3.c968
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/tableprint.h11
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c520
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.c478
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.h61
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1_dxva.c65
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1acdata.h1096
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1data.c952
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dec.c1673
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dsp.c151
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3.c1371
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3data.h5601
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3dsp.c151
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c140
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c541
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h59
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.c41
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.h328
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5data.h277
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c417
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6data.h451
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6dsp.c28
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/w32thread.c85
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.c128
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.h5
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c419
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/cpuid.c62
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_mmx.c75
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_ssse3.c36
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c1394
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_avg_template.c123
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_qns_template.c56
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_rnd_template.c129
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fdct_mmx.c227
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft.c17
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_3dn2.c25
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_sse.c43
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_i386.h20
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264dsp_mmx.c446
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx.c556
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx_xvid.c238
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_sse2_xvid.c129
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mathops.h2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mlpdsp.c42
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx.c755
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx_template.c369
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/rv40dsp_mmx.c27
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vc1dsp_mmx.c68
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_mmx.c18
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_sse2.c16
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.c48
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.h2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.c78
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.h2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/xiph.c24
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h19
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h25
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.c100
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.h5
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc_data.h3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/internal.h17
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/intreadwrite.h15
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.c31
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.h15
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.c117
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.h5
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.c24
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h17
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lzo.c124
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.c78
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.h13
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/md5.c67
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.c59
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.h24
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.c71
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.h13
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/bswap.h4
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/intreadwrite.h14
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/timer.h2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/config.h76
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/isP4HT.c33
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/libswscalew32thread.c73
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.c1059
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.h49
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_internal.h89
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_template.c6003
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.c685
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.h74
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb_template.c4126
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.c4377
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.h148
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale_internal.h232
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_mmx.c62
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_template.c420
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb.c597
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb_template.c808
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib.c34
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib_template.c378
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libvo/fastmemcpy.h45
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libvo/libvoinit.c22
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/mp_msg.h206
-rw-r--r--src/filters/transform/MPCVideoDec/intrin_fixed.h2066
-rw-r--r--src/filters/transform/MPCVideoDec/resource.h2
-rw-r--r--src/filters/transform/MPCVideoDec/stdafx.cpp30
-rw-r--r--src/filters/transform/MPCVideoDec/stdafx.h6
-rw-r--r--src/filters/transform/MpaDecFilter/IMpaDecFilter.h47
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecFilter.cpp3881
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecFilter.h243
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp282
-rw-r--r--src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.h110
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/include/a52.h26
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/a52_internal.h41
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/bit_allocate.c314
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.c44
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.h46
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/downmix.c1057
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/imdct.c368
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/parse.c1398
-rw-r--r--src/filters/transform/MpaDecFilter/a52dec/liba52/tables.h155
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/include/faad.h8
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/include/neaacdec.h264
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/analysis.h10
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/bits.c76
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/bits.h647
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.c417
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.h30
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/cfft_tab.h3530
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb.h154
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_1.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_10.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_11.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_2.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_3.h11
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_4.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_5.h11
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_6.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_7.h11
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_8.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_9.h11
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_sf.h11
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/common.c597
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/common.h252
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.c505
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.h84
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/drc.c54
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/drc.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.c444
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.h76
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/error.c13
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/error.h10
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.c184
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.h36
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/fixed.h307
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/hcr.c299
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.c223
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.c98
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.h410
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/iq_table.h32790
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/is.c29
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/is.h44
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/kbd_win.h4495
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.c66
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.h40
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.c80
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.h16
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/mdct_tab.h7160
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.c115
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.h24
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ms.c26
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ms.h12
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/output.c198
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/output.h20
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/pns.c126
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/pns.h28
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.c704
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.h210
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ps_syntax.c144
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ps_tables.h972
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.c14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.h10
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.c164
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.h24
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.c113
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.h22
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.c282
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.h326
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.c184
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.h16
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.c297
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.h30
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.c712
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.h26
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.c340
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.h16
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.c156
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.h12
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_noise.h1039
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.c302
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.h28
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf_c.h653
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.c394
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.h12
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.c68
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.h12
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/sine_win.h8488
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.c510
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.h18
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.c70
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.h30
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.c116
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.h28
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.c58
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.h14
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_win.h1180
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/structs.h663
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.c1246
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.h42
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/tns.c94
-rw-r--r--src/filters/transform/MpaDecFilter/faad2/libfaad/tns.h18
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/include/dca.h40
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.c53
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.h15
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/dca_internal.h17
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/downmix.c1098
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/parse.c1007
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/tables_adpcm.h8192
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/tables_fir.h4096
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/tables_huffman.h1540
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/tables_quantization.h72
-rw-r--r--src/filters/transform/MpaDecFilter/libdca/libdca/tables_vq.h6144
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/FLAC/callback.h189
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/FLAC/export.h4
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/FLAC/format.h1892
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/FLAC/metadata.h4098
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_decoder.h2987
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_encoder.h3405
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/alloc.h181
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/getopt.h216
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/cuesheet.h8
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/file.h30
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/picture.h22
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/replaygain.h48
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/seektable.h2
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_analysis.h14
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_synthesis.h32
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/bitwise.c1555
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/framing.c3177
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitmath.c112
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitreader.c2267
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitwriter.c1315
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/cpu.c462
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/crc.c156
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/fixed.c656
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/float.c481
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/format.c743
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/bitreader.h2
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/cpu.h59
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/md5.h13
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h50
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h25
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_decoder.h19
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_encoder.h110
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/lpc.c2652
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/md5.c700
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/memory.c299
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_iterators.c4827
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_object.c2670
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_decoder_aspect.c359
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_encoder_aspect.c276
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_helper.c307
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_decoder.c5752
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder.c7257
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder_framing.c1021
-rw-r--r--src/filters/transform/MpaDecFilter/libflac/src/libFLAC/window.c222
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/bit.c248
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/bit.h11
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/decoder.c763
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/decoder.h89
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/fixed.c59
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/fixed.h55
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/frame.c647
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/frame.h101
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/huffman.c5966
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/huffman.h71
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/hufftab.c5966
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/hufftab.h71
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/layer12.c778
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/layer3.c4174
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/mad.h779
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/minimad.c157
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h779
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/stream.c162
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/stream.h103
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/synth.c1114
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/synth.h41
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/timer.c611
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/timer.h78
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/version.c40
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/backends.h163
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.c418
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.h40
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/bitwise.c1555
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/block.c1756
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/codebook.c1051
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/codebook.h153
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/codec_internal.h187
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/envelope.c612
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/envelope.h61
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/floor0.c307
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/floor1.c2025
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/framing.c3177
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/highlevel.h58
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/info.c1039
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lookup.c81
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lookup.h2
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lookup_data.h273
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lpc.c174
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lpc.h6
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lsp.c699
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/lsp.h8
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/mapping0.c1386
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/masking.h1711
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/mdct.c971
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/mdct.h15
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/misc.h12
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/os.h82
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/psy.c2053
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/psy.h138
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/registry.c21
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/res0.c1581
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/scales.h43
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/sharedbook.c1258
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/smallft.c2374
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/smallft.h15
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/synthesis.c273
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/vorbis/codec.h391
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/window.c4177
-rw-r--r--src/filters/transform/MpaDecFilter/libvorbisidec/window.h4
-rw-r--r--src/filters/transform/MpaDecFilter/resource.h2
-rw-r--r--src/filters/transform/MpaDecFilter/stdafx.cpp8
-rw-r--r--src/filters/transform/MpaDecFilter/stdafx.h8
-rw-r--r--src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h61
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp3144
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h402
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp286
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.h104
-rw-r--r--src/filters/transform/Mpeg2DecFilter/attributes.h8
-rw-r--r--src/filters/transform/Mpeg2DecFilter/idct_sse2.cpp382
-rw-r--r--src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp4113
-rw-r--r--src/filters/transform/Mpeg2DecFilter/libmpeg2.h222
-rw-r--r--src/filters/transform/Mpeg2DecFilter/mc_sse2.cpp782
-rw-r--r--src/filters/transform/Mpeg2DecFilter/resource.h2
-rw-r--r--src/filters/transform/Mpeg2DecFilter/stdafx.cpp8
-rw-r--r--src/filters/transform/Mpeg2DecFilter/stdafx.h8
-rw-r--r--src/filters/transform/vsfilter/Copy.cpp1066
-rw-r--r--src/filters/transform/vsfilter/DirectVobSub.cpp638
-rw-r--r--src/filters/transform/vsfilter/DirectVobSub.h126
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubFilter.cpp2623
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubFilter.h182
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubPropPage.cpp1731
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubPropPage.h153
-rw-r--r--src/filters/transform/vsfilter/IDirectVobSub.h518
-rw-r--r--src/filters/transform/vsfilter/StyleEditorDialog.cpp362
-rw-r--r--src/filters/transform/vsfilter/StyleEditorDialog.h129
-rw-r--r--src/filters/transform/vsfilter/Systray.cpp656
-rw-r--r--src/filters/transform/vsfilter/Systray.h8
-rw-r--r--src/filters/transform/vsfilter/TextInputPin.cpp18
-rw-r--r--src/filters/transform/vsfilter/TextInputPin.h14
-rw-r--r--src/filters/transform/vsfilter/VSFilter.cpp119
-rw-r--r--src/filters/transform/vsfilter/VSFilter.h20
-rw-r--r--src/filters/transform/vsfilter/csri.h555
-rw-r--r--src/filters/transform/vsfilter/csriapi.cpp308
-rw-r--r--src/filters/transform/vsfilter/plugins.cpp2033
-rw-r--r--src/filters/transform/vsfilter/resource.h2
-rw-r--r--src/filters/transform/vsfilter/stdafx.cpp8
-rw-r--r--src/filters/transform/vsfilter/stdafx.h8
-rw-r--r--src/filters/transform/vsfilter/valami.cpp408
-rw-r--r--src/filters/transform/vsfilter/vfr.cpp277
-rw-r--r--src/filters/transform/vsfilter/vfr.h5
1220 files changed, 251656 insertions, 280804 deletions
diff --git a/src/filters/BaseClasses/amextra.cpp b/src/filters/BaseClasses/amextra.cpp
index d0bbcd429..af0de96d1 100644
--- a/src/filters/BaseClasses/amextra.cpp
+++ b/src/filters/BaseClasses/amextra.cpp
@@ -49,13 +49,11 @@ STDMETHODIMP CRenderedInputPin::EndOfStream()
HRESULT hr = CheckStreaming();
// Do EC_COMPLETE handling for rendered pins
- if(S_OK == hr && !m_bAtEndOfStream)
- {
+ if (S_OK == hr && !m_bAtEndOfStream) {
m_bAtEndOfStream = TRUE;
FILTER_STATE fs;
EXECUTE_ASSERT(SUCCEEDED(m_pFilter->GetState(0, &fs)));
- if(fs == State_Running)
- {
+ if (fs == State_Running) {
DoCompleteHandling();
}
}
@@ -83,8 +81,7 @@ HRESULT CRenderedInputPin::Run(REFERENCE_TIME tStart)
{
UNREFERENCED_PARAMETER(tStart);
m_bCompleteNotified = FALSE;
- if(m_bAtEndOfStream)
- {
+ if (m_bAtEndOfStream) {
DoCompleteHandling();
}
return S_OK;
@@ -106,8 +103,7 @@ HRESULT CRenderedInputPin::Active()
void CRenderedInputPin::DoCompleteHandling()
{
ASSERT(m_bAtEndOfStream);
- if(!m_bCompleteNotified)
- {
+ if (!m_bCompleteNotified) {
m_bCompleteNotified = TRUE;
m_pFilter->NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)m_pFilter);
}
diff --git a/src/filters/BaseClasses/amextra.h b/src/filters/BaseClasses/amextra.h
index 07bf71789..5a861bf12 100644
--- a/src/filters/BaseClasses/amextra.h
+++ b/src/filters/BaseClasses/amextra.h
@@ -34,7 +34,7 @@ public:
__inout HRESULT *phr,
__in_opt LPCWSTR pName);
#endif
-
+
// Override methods to track end of stream state
STDMETHODIMP EndOfStream();
STDMETHODIMP EndFlush();
diff --git a/src/filters/BaseClasses/amfilter.cpp b/src/filters/BaseClasses/amfilter.cpp
index e0df540c5..e3c7fa658 100644
--- a/src/filters/BaseClasses/amfilter.cpp
+++ b/src/filters/BaseClasses/amfilter.cpp
@@ -64,22 +64,19 @@ STDAPI CreatePosPassThru(
IID_IUnknown,
(void **)&pUnkSeek
);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
ISeekingPassThru *pPassThru;
hr = pUnkSeek->QueryInterface(IID_ISeekingPassThru, (void**)&pPassThru);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
pUnkSeek->Release();
return hr;
}
hr = pPassThru->Init(bRenderer, pPin);
pPassThru->Release();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
pUnkSeek->Release();
return hr;
}
@@ -101,9 +98,9 @@ STDAPI CreatePosPassThru(
/* Constructor */
CBaseMediaFilter::CBaseMediaFilter(__in_opt LPCTSTR pName,
- __inout_opt LPUNKNOWN pUnk,
- __in CCritSec *pLock,
- REFCLSID clsid) :
+ __inout_opt LPUNKNOWN pUnk,
+ __in CCritSec *pLock,
+ REFCLSID clsid) :
CUnknown(pName, pUnk),
m_pLock(pLock),
m_clsid(clsid),
@@ -122,8 +119,7 @@ CBaseMediaFilter::~CBaseMediaFilter()
/* Release any clock we were using */
- if(m_pClock)
- {
+ if (m_pClock) {
m_pClock->Release();
m_pClock = NULL;
}
@@ -137,16 +133,11 @@ CBaseMediaFilter::NonDelegatingQueryInterface(
REFIID riid,
__deref_out void ** ppv)
{
- if(riid == IID_IMediaFilter)
- {
+ if (riid == IID_IMediaFilter) {
return GetInterface((IMediaFilter *) this, ppv);
- }
- else if(riid == IID_IPersist)
- {
+ } else if (riid == IID_IPersist) {
return GetInterface((IPersist *) this, ppv);
- }
- else
- {
+ } else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -155,8 +146,8 @@ CBaseMediaFilter::NonDelegatingQueryInterface(
STDMETHODIMP
CBaseMediaFilter::GetClassID(__out CLSID *pClsID)
{
- CheckPointer(pClsID, E_POINTER);
- ValidateReadWritePtr(pClsID, sizeof(CLSID));
+ CheckPointer(pClsID,E_POINTER);
+ ValidateReadWritePtr(pClsID,sizeof(CLSID));
*pClsID = m_clsid;
return NOERROR;
}
@@ -167,8 +158,8 @@ STDMETHODIMP
CBaseMediaFilter::GetState(DWORD dwMSecs, __out FILTER_STATE *State)
{
UNREFERENCED_PARAMETER(dwMSecs);
- CheckPointer(State, E_POINTER);
- ValidateReadWritePtr(State, sizeof(FILTER_STATE));
+ CheckPointer(State,E_POINTER);
+ ValidateReadWritePtr(State,sizeof(FILTER_STATE));
*State = m_State;
return S_OK;
@@ -183,14 +174,12 @@ CBaseMediaFilter::SetSyncSource(__inout_opt IReferenceClock *pClock)
CAutoLock cObjectLock(m_pLock);
// Ensure the new one does not go away - even if the same as the old
- if(pClock)
- {
+ if (pClock) {
pClock->AddRef();
}
// if we have a clock, release it
- if(m_pClock)
- {
+ if (m_pClock) {
m_pClock->Release();
}
@@ -205,12 +194,11 @@ CBaseMediaFilter::SetSyncSource(__inout_opt IReferenceClock *pClock)
STDMETHODIMP
CBaseMediaFilter::GetSyncSource(__deref_out_opt IReferenceClock **pClock)
{
- CheckPointer(pClock, E_POINTER);
- ValidateReadWritePtr(pClock, sizeof(IReferenceClock *));
+ CheckPointer(pClock,E_POINTER);
+ ValidateReadWritePtr(pClock,sizeof(IReferenceClock *));
CAutoLock cObjectLock(m_pLock);
- if(m_pClock)
- {
+ if (m_pClock) {
// returning an interface... addref it...
m_pClock->AddRef();
}
@@ -260,12 +248,10 @@ CBaseMediaFilter::Run(REFERENCE_TIME tStart)
// remember the stream time offset
m_tStart = tStart;
- if(m_State == State_Stopped)
- {
+ if (m_State == State_Stopped){
HRESULT hr = Pause();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -284,15 +270,13 @@ CBaseMediaFilter::StreamTime(CRefTime& rtStream)
// We can't grab the filter lock because we want to be able to call
// this from worker threads without deadlocking
- if(m_pClock == NULL)
- {
+ if (m_pClock == NULL) {
return VFW_E_NO_CLOCK;
}
// get the current reference time
HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -313,28 +297,19 @@ CBaseMediaFilter::StreamTime(CRefTime& rtStream)
/* Override this to say what interfaces we support and where */
STDMETHODIMP CBaseFilter::NonDelegatingQueryInterface(REFIID riid,
- __deref_out void **ppv)
+ __deref_out void **ppv)
{
/* Do we have this interface */
- if(riid == IID_IBaseFilter)
- {
+ if (riid == IID_IBaseFilter) {
return GetInterface((IBaseFilter *) this, ppv);
- }
- else if(riid == IID_IMediaFilter)
- {
+ } else if (riid == IID_IMediaFilter) {
return GetInterface((IMediaFilter *) this, ppv);
- }
- else if(riid == IID_IPersist)
- {
+ } else if (riid == IID_IPersist) {
return GetInterface((IPersist *) this, ppv);
- }
- else if(riid == IID_IAMovieSetup)
- {
+ } else if (riid == IID_IAMovieSetup) {
return GetInterface((IAMovieSetup *) this, ppv);
- }
- else
- {
+ } else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -342,8 +317,7 @@ STDMETHODIMP CBaseFilter::NonDelegatingQueryInterface(REFIID riid,
#ifdef _DEBUG
STDMETHODIMP_(ULONG) CBaseFilter::NonDelegatingRelease()
{
- if(m_cRef == 1)
- {
+ if (m_cRef == 1) {
KASSERT(m_pGraph == NULL);
}
return CUnknown::NonDelegatingRelease();
@@ -354,10 +328,10 @@ STDMETHODIMP_(ULONG) CBaseFilter::NonDelegatingRelease()
/* Constructor */
CBaseFilter::CBaseFilter(__in_opt LPCTSTR pName,
- __inout_opt LPUNKNOWN pUnk,
- __in CCritSec *pLock,
- REFCLSID clsid) :
- CUnknown(pName, pUnk),
+ __inout_opt LPUNKNOWN pUnk,
+ __in CCritSec *pLock,
+ REFCLSID clsid) :
+ CUnknown( pName, pUnk ),
m_pLock(pLock),
m_clsid(clsid),
m_State(State_Stopped),
@@ -368,7 +342,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCTSTR pName,
m_PinVersion(1)
{
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CBaseFilter", (IBaseFilter *) this);
+ PERFLOG_CTOR( pName ? pName : L"CBaseFilter", (IBaseFilter *) this );
#endif // DXMPERF
ASSERT(pLock != NULL);
@@ -381,7 +355,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCTSTR pName,
__in CCritSec *pLock,
REFCLSID clsid,
__inout HRESULT *phr) :
- CUnknown(pName, pUnk),
+ CUnknown( pName, pUnk ),
m_pLock(pLock),
m_clsid(clsid),
m_State(State_Stopped),
@@ -392,7 +366,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCTSTR pName,
m_PinVersion(1)
{
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CBaseFilter", (IBaseFilter *) this);
+ PERFLOG_CTOR( pName ? pName : L"CBaseFilter", (IBaseFilter *) this );
#endif // DXMPERF
ASSERT(pLock != NULL);
@@ -401,10 +375,10 @@ CBaseFilter::CBaseFilter(__in_opt LPCTSTR pName,
#ifdef UNICODE
CBaseFilter::CBaseFilter(__in_opt LPCSTR pName,
- __in_opt LPUNKNOWN pUnk,
- __in CCritSec *pLock,
- REFCLSID clsid) :
- CUnknown(pName, pUnk),
+ __in_opt LPUNKNOWN pUnk,
+ __in CCritSec *pLock,
+ REFCLSID clsid) :
+ CUnknown( pName, pUnk ),
m_pLock(pLock),
m_clsid(clsid),
m_State(State_Stopped),
@@ -415,7 +389,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCSTR pName,
m_PinVersion(1)
{
#ifdef DXMPERF
- PERFLOG_CTOR(L"CBaseFilter", (IBaseFilter *) this);
+ PERFLOG_CTOR( L"CBaseFilter", (IBaseFilter *) this );
#endif // DXMPERF
ASSERT(pLock != NULL);
@@ -425,7 +399,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCSTR pName,
__in CCritSec *pLock,
REFCLSID clsid,
__inout HRESULT *phr) :
- CUnknown(pName, pUnk),
+ CUnknown( pName, pUnk ),
m_pLock(pLock),
m_clsid(clsid),
m_State(State_Stopped),
@@ -436,7 +410,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCSTR pName,
m_PinVersion(1)
{
#ifdef DXMPERF
- PERFLOG_CTOR(L"CBaseFilter", (IBaseFilter *) this);
+ PERFLOG_CTOR( L"CBaseFilter", (IBaseFilter *) this );
#endif // DXMPERF
ASSERT(pLock != NULL);
@@ -449,7 +423,7 @@ CBaseFilter::CBaseFilter(__in_opt LPCSTR pName,
CBaseFilter::~CBaseFilter()
{
#ifdef DXMPERF
- PERFLOG_DTOR(L"CBaseFilter", (IBaseFilter *) this);
+ PERFLOG_DTOR( L"CBaseFilter", (IBaseFilter *) this );
#endif // DXMPERF
// NOTE we do NOT hold references on the filtergraph for m_pGraph or m_pSink
@@ -461,8 +435,7 @@ CBaseFilter::~CBaseFilter()
// our critsec has been destroyed.
/* Release any clock we were using */
- if(m_pClock)
- {
+ if (m_pClock) {
m_pClock->Release();
m_pClock = NULL;
}
@@ -472,8 +445,8 @@ CBaseFilter::~CBaseFilter()
STDMETHODIMP
CBaseFilter::GetClassID(__out CLSID *pClsID)
{
- CheckPointer(pClsID, E_POINTER);
- ValidateReadWritePtr(pClsID, sizeof(CLSID));
+ CheckPointer(pClsID,E_POINTER);
+ ValidateReadWritePtr(pClsID,sizeof(CLSID));
*pClsID = m_clsid;
return NOERROR;
}
@@ -483,8 +456,8 @@ STDMETHODIMP
CBaseFilter::GetState(DWORD dwMSecs, __out FILTER_STATE *State)
{
UNREFERENCED_PARAMETER(dwMSecs);
- CheckPointer(State, E_POINTER);
- ValidateReadWritePtr(State, sizeof(FILTER_STATE));
+ CheckPointer(State,E_POINTER);
+ ValidateReadWritePtr(State,sizeof(FILTER_STATE));
*State = m_State;
return S_OK;
@@ -499,14 +472,12 @@ CBaseFilter::SetSyncSource(__in_opt IReferenceClock *pClock)
CAutoLock cObjectLock(m_pLock);
// Ensure the new one does not go away - even if the same as the old
- if(pClock)
- {
+ if (pClock) {
pClock->AddRef();
}
// if we have a clock, release it
- if(m_pClock)
- {
+ if (m_pClock) {
m_pClock->Release();
}
@@ -521,12 +492,11 @@ CBaseFilter::SetSyncSource(__in_opt IReferenceClock *pClock)
STDMETHODIMP
CBaseFilter::GetSyncSource(__deref_out_opt IReferenceClock **pClock)
{
- CheckPointer(pClock, E_POINTER);
- ValidateReadWritePtr(pClock, sizeof(IReferenceClock *));
+ CheckPointer(pClock,E_POINTER);
+ ValidateReadWritePtr(pClock,sizeof(IReferenceClock *));
CAutoLock cObjectLock(m_pLock);
- if(m_pClock)
- {
+ if (m_pClock) {
// returning an interface... addref it...
m_pClock->AddRef();
}
@@ -545,15 +515,12 @@ CBaseFilter::Stop()
HRESULT hr = NOERROR;
// notify all pins of the state change
- if(m_State != State_Stopped)
- {
+ if (m_State != State_Stopped) {
int cPins = GetPinCount();
- for(int c = 0; c < cPins; c++)
- {
+ for (int c = 0; c < cPins; c++) {
CBasePin *pPin = GetPin(c);
- if(NULL == pPin)
- {
+ if (NULL == pPin) {
break;
}
@@ -563,11 +530,9 @@ CBaseFilter::Stop()
// class can return an error if it has no allocator but Stop can
// be used to resync the graph state after something has gone bad
- if(pPin->IsConnected())
- {
+ if (pPin->IsConnected()) {
HRESULT hrTmp = pPin->Inactive();
- if(FAILED(hrTmp) && SUCCEEDED(hr))
- {
+ if (FAILED(hrTmp) && SUCCEEDED(hr)) {
hr = hrTmp;
}
}
@@ -575,7 +540,7 @@ CBaseFilter::Stop()
}
#ifdef DXMPERF
- PERFLOG_STOP(m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, m_State);
+ PERFLOG_STOP( m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, m_State );
#endif // DXMPERF
m_State = State_Stopped;
@@ -592,26 +557,21 @@ CBaseFilter::Pause()
CAutoLock cObjectLock(m_pLock);
// notify all pins of the change to active state
- if(m_State == State_Stopped)
- {
+ if (m_State == State_Stopped) {
int cPins = GetPinCount();
- for(int c = 0; c < cPins; c++)
- {
+ for (int c = 0; c < cPins; c++) {
CBasePin *pPin = GetPin(c);
- if(NULL == pPin)
- {
+ if (NULL == pPin) {
break;
}
// Disconnected pins are not activated - this saves pins
// worrying about this state themselves
- if(pPin->IsConnected())
- {
+ if (pPin->IsConnected()) {
HRESULT hr = pPin->Active();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -620,7 +580,7 @@ CBaseFilter::Pause()
#ifdef DXMPERF
- PERFLOG_PAUSE(m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, m_State);
+ PERFLOG_PAUSE( m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, m_State );
#endif // DXMPERF
m_State = State_Paused;
@@ -644,36 +604,29 @@ CBaseFilter::Run(REFERENCE_TIME tStart)
// remember the stream time offset
m_tStart = tStart;
- if(m_State == State_Stopped)
- {
- HRESULT hr = Pause();
+ if (m_State == State_Stopped){
+ HRESULT hr = Pause();
- if(FAILED(hr))
- {
- return hr;
- }
+ if (FAILED(hr)) {
+ return hr;
+ }
}
// notify all pins of the change to active state
- if(m_State != State_Running)
- {
+ if (m_State != State_Running) {
int cPins = GetPinCount();
- for(int c = 0; c < cPins; c++)
- {
+ for (int c = 0; c < cPins; c++) {
CBasePin *pPin = GetPin(c);
- if(NULL == pPin)
- {
+ if (NULL == pPin) {
break;
}
// Disconnected pins are not activated - this saves pins
// worrying about this state themselves
- if(pPin->IsConnected())
- {
+ if (pPin->IsConnected()) {
HRESULT hr = pPin->Run(tStart);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -681,7 +634,7 @@ CBaseFilter::Run(REFERENCE_TIME tStart)
}
#ifdef DXMPERF
- PERFLOG_RUN(m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, tStart, m_State);
+ PERFLOG_RUN( m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, tStart, m_State );
#endif // DXMPERF
m_State = State_Running;
@@ -698,15 +651,13 @@ CBaseFilter::StreamTime(CRefTime& rtStream)
// We can't grab the filter lock because we want to be able to call
// this from worker threads without deadlocking
- if(m_pClock == NULL)
- {
+ if (m_pClock == NULL) {
return VFW_E_NO_CLOCK;
}
// get the current reference time
HRESULT hr = m_pClock->GetTime((REFERENCE_TIME*)&rtStream);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -722,13 +673,13 @@ CBaseFilter::StreamTime(CRefTime& rtStream)
STDMETHODIMP
CBaseFilter::EnumPins(__deref_out IEnumPins **ppEnum)
{
- CheckPointer(ppEnum, E_POINTER);
- ValidateReadWritePtr(ppEnum, sizeof(IEnumPins *));
+ CheckPointer(ppEnum,E_POINTER);
+ ValidateReadWritePtr(ppEnum,sizeof(IEnumPins *));
/* Create a new ref counted enumerator */
*ppEnum = new CEnumPins(this,
- NULL);
+ NULL);
return *ppEnum == NULL ? E_OUTOFMEMORY : NOERROR;
}
@@ -742,22 +693,19 @@ CBaseFilter::FindPin(
__deref_out IPin ** ppPin
)
{
- CheckPointer(ppPin, E_POINTER);
- ValidateReadWritePtr(ppPin, sizeof(IPin *));
+ CheckPointer(ppPin,E_POINTER);
+ ValidateReadWritePtr(ppPin,sizeof(IPin *));
// We're going to search the pin list so maintain integrity
CAutoLock lck(m_pLock);
int iCount = GetPinCount();
- for(int i = 0; i < iCount; i++)
- {
+ for (int i = 0; i < iCount; i++) {
CBasePin *pPin = GetPin(i);
- if(NULL == pPin)
- {
+ if (NULL == pPin) {
break;
}
- if(0 == lstrcmpW(pPin->Name(), Id))
- {
+ if (0 == lstrcmpW(pPin->Name(), Id)) {
// Found one that matches
//
// AddRef() and return it
@@ -775,19 +723,16 @@ CBaseFilter::FindPin(
STDMETHODIMP
CBaseFilter::QueryFilterInfo(__out FILTER_INFO * pInfo)
{
- CheckPointer(pInfo, E_POINTER);
- ValidateReadWritePtr(pInfo, sizeof(FILTER_INFO));
+ CheckPointer(pInfo,E_POINTER);
+ ValidateReadWritePtr(pInfo,sizeof(FILTER_INFO));
- if(m_pName)
- {
+ if (m_pName) {
(void)StringCchCopyW(pInfo->achName, NUMELMS(pInfo->achName), m_pName);
- }
- else
- {
+ } else {
pInfo->achName[0] = L'\0';
}
pInfo->pGraph = m_pGraph;
- if(m_pGraph)
+ if (m_pGraph)
m_pGraph->AddRef();
return NOERROR;
}
@@ -805,18 +750,14 @@ CBaseFilter::JoinFilterGraph(
// NOTE: we no longer hold references on the graph (m_pGraph, m_pSink)
m_pGraph = pGraph;
- if(m_pGraph)
- {
+ if (m_pGraph) {
HRESULT hr = m_pGraph->QueryInterface(IID_IMediaEventSink,
- (void**) &m_pSink);
- if(FAILED(hr))
- {
+ (void**) &m_pSink);
+ if (FAILED(hr)) {
ASSERT(m_pSink == NULL);
}
else m_pSink->Release(); // we do NOT keep a reference on it.
- }
- else
- {
+ } else {
// if graph pointer is null, then we should
// also release the IMediaEventSink on the same object - we don't
// refcount it, so just set it to null
@@ -824,33 +765,27 @@ CBaseFilter::JoinFilterGraph(
}
- if(m_pName)
- {
+ if (m_pName) {
delete[] m_pName;
m_pName = NULL;
}
- if(pName)
- {
+ if (pName) {
size_t namelen;
HRESULT hr = StringCchLengthW(pName, STRSAFE_MAX_CCH, &namelen);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
m_pName = new WCHAR[namelen + 1];
- if(m_pName)
- {
+ if (m_pName) {
(void)StringCchCopyW(m_pName, namelen + 1, pName);
- }
- else
- {
+ } else {
return E_OUTOFMEMORY;
}
}
#ifdef DXMPERF
- PERFLOG_JOINGRAPH(m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *) this, pGraph);
+ PERFLOG_JOINGRAPH( m_pName ? m_pName : L"CBaseFilter",(IBaseFilter *) this, pGraph );
#endif // DXMPERF
return NOERROR;
@@ -880,17 +815,13 @@ CBaseFilter::NotifyEvent(
{
// Snapshot so we don't have to lock up
IMediaEventSink *pSink = m_pSink;
- if(pSink)
- {
- if(EC_COMPLETE == EventCode)
- {
+ if (pSink) {
+ if (EC_COMPLETE == EventCode) {
EventParam2 = (LONG_PTR)(IBaseFilter*)this;
}
return pSink->Notify(EventCode, EventParam1, EventParam2);
- }
- else
- {
+ } else {
return E_NOTIMPL;
}
}
@@ -906,22 +837,16 @@ CBaseFilter::ReconnectPin(
)
{
IFilterGraph2 *pGraph2;
- if(m_pGraph != NULL)
- {
+ if (m_pGraph != NULL) {
HRESULT hr = m_pGraph->QueryInterface(IID_IFilterGraph2, (void **)&pGraph2);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = pGraph2->ReconnectEx(pPin, pmt);
pGraph2->Release();
return hr;
- }
- else
- {
+ } else {
return m_pGraph->Reconnect(pPin);
}
- }
- else
- {
+ } else {
return E_NOINTERFACE;
}
}
@@ -956,25 +881,25 @@ STDMETHODIMP CBaseFilter::Register()
// check we've got data
//
- if(NULL == psetupdata) return S_FALSE;
+ if( NULL == psetupdata ) return S_FALSE;
// init is ref counted so call just in case
// we're being called cold.
//
- HRESULT hr = CoInitialize((LPVOID)NULL);
- ASSERT(SUCCEEDED(hr));
+ HRESULT hr = CoInitialize( (LPVOID)NULL );
+ ASSERT( SUCCEEDED(hr) );
// get hold of IFilterMapper
//
IFilterMapper *pIFM;
- hr = CoCreateInstance(CLSID_FilterMapper
- , NULL
- , CLSCTX_INPROC_SERVER
- , IID_IFilterMapper
- , (void **)&pIFM);
- if(SUCCEEDED(hr))
- {
- hr = AMovieSetupRegisterFilter(psetupdata, pIFM, TRUE);
+ hr = CoCreateInstance( CLSID_FilterMapper
+ , NULL
+ , CLSCTX_INPROC_SERVER
+ , IID_IFilterMapper
+ , (void **)&pIFM );
+ if( SUCCEEDED(hr) )
+ {
+ hr = AMovieSetupRegisterFilter( psetupdata, pIFM, TRUE );
pIFM->Release();
}
@@ -997,25 +922,25 @@ STDMETHODIMP CBaseFilter::Unregister()
// check we've got data
//
- if(NULL == psetupdata) return S_FALSE;
+ if( NULL == psetupdata ) return S_FALSE;
// OLE init is ref counted so call
// just in case we're being called cold.
//
- HRESULT hr = CoInitialize((LPVOID)NULL);
- ASSERT(SUCCEEDED(hr));
+ HRESULT hr = CoInitialize( (LPVOID)NULL );
+ ASSERT( SUCCEEDED(hr) );
// get hold of IFilterMapper
//
IFilterMapper *pIFM;
- hr = CoCreateInstance(CLSID_FilterMapper
- , NULL
- , CLSCTX_INPROC_SERVER
- , IID_IFilterMapper
- , (void **)&pIFM);
- if(SUCCEEDED(hr))
+ hr = CoCreateInstance( CLSID_FilterMapper
+ , NULL
+ , CLSCTX_INPROC_SERVER
+ , IID_IFilterMapper
+ , (void **)&pIFM );
+ if( SUCCEEDED(hr) )
{
- hr = AMovieSetupRegisterFilter(psetupdata, pIFM, FALSE);
+ hr = AMovieSetupRegisterFilter( psetupdata, pIFM, FALSE );
// release interface
//
@@ -1032,10 +957,10 @@ STDMETHODIMP CBaseFilter::Unregister()
// (couldn't find a suitable #define'd
// name for the error!)
//
- if(0x80070002 == hr)
- return NOERROR;
+ if( 0x80070002 == hr)
+ return NOERROR;
else
- return hr;
+ return hr;
}
@@ -1068,13 +993,10 @@ CEnumPins::CEnumPins(__in CBaseFilter *pFilter,
/* Are we creating a new enumerator */
- if(pEnumPins == NULL)
- {
+ if (pEnumPins == NULL) {
m_Version = m_pFilter->GetPinVersion();
m_PinCount = m_pFilter->GetPinCount();
- }
- else
- {
+ } else {
ASSERT(m_Position <= m_PinCount);
m_Position = pEnumPins->m_Position;
m_PinCount = pEnumPins->m_PinCount;
@@ -1108,12 +1030,9 @@ CEnumPins::QueryInterface(REFIID riid, __deref_out void **ppv)
/* Do we have this interface */
- if(riid == IID_IEnumPins || riid == IID_IUnknown)
- {
+ if (riid == IID_IEnumPins || riid == IID_IUnknown) {
return GetInterface((IEnumPins *) this, ppv);
- }
- else
- {
+ } else {
*ppv = NULL;
return E_NOINTERFACE;
}
@@ -1129,8 +1048,7 @@ STDMETHODIMP_(ULONG)
CEnumPins::Release()
{
ULONG cRef = InterlockedDecrement(&m_cRef);
- if(cRef == 0)
- {
+ if (cRef == 0) {
delete this;
}
return cRef;
@@ -1140,25 +1058,21 @@ CEnumPins::Release()
interface that initially has the same state. Since we are taking a snapshot
of an object (current position and all) we must lock access at the start */
-STDMETHODIMP
+STDMETHODIMP
CEnumPins::Clone(__deref_out IEnumPins **ppEnum)
{
- CheckPointer(ppEnum, E_POINTER);
- ValidateReadWritePtr(ppEnum, sizeof(IEnumPins *));
+ CheckPointer(ppEnum,E_POINTER);
+ ValidateReadWritePtr(ppEnum,sizeof(IEnumPins *));
HRESULT hr = NOERROR;
/* Check we are still in sync with the filter */
- if(AreWeOutOfSync() == TRUE)
- {
+ if (AreWeOutOfSync() == TRUE) {
*ppEnum = NULL;
hr = VFW_E_ENUM_OUT_OF_SYNC;
- }
- else
- {
- *ppEnum = new CEnumPins(m_pFilter,
+ } else {
+ *ppEnum = new CEnumPins(m_pFilter,
this);
- if(*ppEnum == NULL)
- {
+ if (*ppEnum == NULL) {
hr = E_OUTOFMEMORY;
}
}
@@ -1170,29 +1084,26 @@ CEnumPins::Clone(__deref_out IEnumPins **ppEnum)
STDMETHODIMP
CEnumPins::Next(ULONG cPins, // place this many pins...
- __out_ecount(cPins) IPin **ppPins, // ...in this array
- __out_opt ULONG *pcFetched) // actual count passed returned here
+ __out_ecount(cPins) IPin **ppPins, // ...in this array
+ __out_opt ULONG *pcFetched) // actual count passed returned here
{
- CheckPointer(ppPins, E_POINTER);
- ValidateReadWritePtr(ppPins, cPins * sizeof(IPin *));
+ CheckPointer(ppPins,E_POINTER);
+ ValidateReadWritePtr(ppPins,cPins * sizeof(IPin *));
ASSERT(ppPins);
- if(pcFetched != NULL)
- {
+ if (pcFetched!=NULL) {
ValidateWritePtr(pcFetched, sizeof(ULONG));
*pcFetched = 0; // default unless we succeed
}
// now check that the parameter is valid
- else if(cPins > 1) // pcFetched == NULL
- {
+ else if (cPins>1) { // pcFetched == NULL
return E_INVALIDARG;
}
ULONG cFetched = 0; // increment as we get each one.
/* Check we are still in sync with the filter */
- if(AreWeOutOfSync() == TRUE)
- {
+ if (AreWeOutOfSync() == TRUE) {
// If we are out of sync, we should refresh the enumerator.
// This will reset the position and update the other members, but
// will not clear cache of pins we have already returned.
@@ -1206,23 +1117,21 @@ CEnumPins::Next(ULONG cPins, // place this many pins...
(for example someone has deleted a pin) so we
return VFW_E_ENUM_OUT_OF_SYNC */
- while(cFetched < cPins && m_PinCount > m_Position)
- {
+ while (cFetched < cPins && m_PinCount > m_Position) {
/* Get the next pin object from the filter */
CBasePin *pPin = m_pFilter->GetPin(m_Position++);
- if(pPin == NULL)
- {
+ if (pPin == NULL) {
// If this happend, and it's not the first time through, then we've got a problem,
// since we should really go back and release the iPins, which we have previously
// AddRef'ed.
- ASSERT(cFetched == 0);
+ ASSERT( cFetched==0 );
return VFW_E_ENUM_OUT_OF_SYNC;
}
/* We only want to return this pin, if it is not in our cache */
- if(0 == m_PinCache.Find(pPin))
+ if (0 == m_PinCache.Find(pPin))
{
/* From the object get an IPin interface */
@@ -1236,12 +1145,11 @@ CEnumPins::Next(ULONG cPins, // place this many pins...
}
}
- if(pcFetched != NULL)
- {
+ if (pcFetched!=NULL) {
*pcFetched = cFetched;
}
- return (cPins == cFetched ? NOERROR : S_FALSE);
+ return (cPins==cFetched ? NOERROR : S_FALSE);
}
@@ -1251,8 +1159,7 @@ STDMETHODIMP
CEnumPins::Skip(ULONG cPins)
{
/* Check we are still in sync with the filter */
- if(AreWeOutOfSync() == TRUE)
- {
+ if (AreWeOutOfSync() == TRUE) {
return VFW_E_ENUM_OUT_OF_SYNC;
}
@@ -1261,8 +1168,7 @@ CEnumPins::Skip(ULONG cPins)
/* ..which would match the base implementation for CEnumMediaTypes::Skip */
ULONG PinsLeft = m_PinCount - m_Position;
- if(cPins > PinsLeft)
- {
+ if (cPins > PinsLeft) {
return S_FALSE;
}
m_Position += cPins;
@@ -1340,8 +1246,7 @@ CEnumMediaTypes::CEnumMediaTypes(__in CBasePin *pPin,
/* Are we creating a new enumerator */
- if(pEnumMediaTypes == NULL)
- {
+ if (pEnumMediaTypes == NULL) {
m_Version = m_pPin->GetMediaTypeVersion();
return;
}
@@ -1374,12 +1279,9 @@ CEnumMediaTypes::QueryInterface(REFIID riid, __deref_out void **ppv)
/* Do we have this interface */
- if(riid == IID_IEnumMediaTypes || riid == IID_IUnknown)
- {
+ if (riid == IID_IEnumMediaTypes || riid == IID_IUnknown) {
return GetInterface((IEnumMediaTypes *) this, ppv);
- }
- else
- {
+ } else {
*ppv = NULL;
return E_NOINTERFACE;
}
@@ -1395,8 +1297,7 @@ STDMETHODIMP_(ULONG)
CEnumMediaTypes::Release()
{
ULONG cRef = InterlockedDecrement(&m_cRef);
- if(cRef == 0)
- {
+ if (cRef == 0) {
delete this;
}
return cRef;
@@ -1409,24 +1310,20 @@ CEnumMediaTypes::Release()
STDMETHODIMP
CEnumMediaTypes::Clone(__deref_out IEnumMediaTypes **ppEnum)
{
- CheckPointer(ppEnum, E_POINTER);
- ValidateReadWritePtr(ppEnum, sizeof(IEnumMediaTypes *));
+ CheckPointer(ppEnum,E_POINTER);
+ ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *));
HRESULT hr = NOERROR;
/* Check we are still in sync with the pin */
- if(AreWeOutOfSync() == TRUE)
- {
+ if (AreWeOutOfSync() == TRUE) {
*ppEnum = NULL;
hr = VFW_E_ENUM_OUT_OF_SYNC;
- }
- else
- {
+ } else {
*ppEnum = new CEnumMediaTypes(m_pPin,
this);
- if(*ppEnum == NULL)
- {
+ if (*ppEnum == NULL) {
hr = E_OUTOFMEMORY;
}
}
@@ -1449,22 +1346,19 @@ CEnumMediaTypes::Next(ULONG cMediaTypes, // place this many types...
__out_ecount(cMediaTypes) AM_MEDIA_TYPE **ppMediaTypes, // ...in this array
__out ULONG *pcFetched) // actual count passed
{
- CheckPointer(ppMediaTypes, E_POINTER);
- ValidateReadWritePtr(ppMediaTypes, cMediaTypes * sizeof(AM_MEDIA_TYPE *));
+ CheckPointer(ppMediaTypes,E_POINTER);
+ ValidateReadWritePtr(ppMediaTypes,cMediaTypes * sizeof(AM_MEDIA_TYPE *));
/* Check we are still in sync with the pin */
- if(AreWeOutOfSync() == TRUE)
- {
+ if (AreWeOutOfSync() == TRUE) {
return VFW_E_ENUM_OUT_OF_SYNC;
}
- if(pcFetched != NULL)
- {
+ if (pcFetched!=NULL) {
ValidateWritePtr(pcFetched, sizeof(ULONG));
*pcFetched = 0; // default unless we succeed
}
// now check that the parameter is valid
- else if(cMediaTypes > 1) // pcFetched == NULL
- {
+ else if (cMediaTypes>1) { // pcFetched == NULL
return E_INVALIDARG;
}
ULONG cFetched = 0; // increment as we get each one.
@@ -1475,14 +1369,12 @@ CEnumMediaTypes::Next(ULONG cMediaTypes, // place this many types...
(for example the window size changing) so we return
VFW_E_ENUM_OUT_OF_SYNC */
- while(cMediaTypes)
- {
+ while (cMediaTypes) {
CMediaType cmt;
HRESULT hr = m_pPin->GetMediaType(m_Position++, &cmt);
- if(S_OK != hr)
- {
+ if (S_OK != hr) {
break;
}
@@ -1496,8 +1388,7 @@ CEnumMediaTypes::Next(ULONG cMediaTypes, // place this many types...
and free on the format block and generally go faster */
*ppMediaTypes = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
- if(*ppMediaTypes == NULL)
- {
+ if (*ppMediaTypes == NULL) {
break;
}
@@ -1515,12 +1406,11 @@ CEnumMediaTypes::Next(ULONG cMediaTypes, // place this many types...
cMediaTypes--;
}
- if(pcFetched != NULL)
- {
+ if (pcFetched!=NULL) {
*pcFetched = cFetched;
}
- return (cMediaTypes == 0 ? NOERROR : S_FALSE);
+ return ( cMediaTypes==0 ? NOERROR : S_FALSE );
}
@@ -1531,14 +1421,12 @@ CEnumMediaTypes::Skip(ULONG cMediaTypes)
{
// If we're skipping 0 elements we're guaranteed to skip the
// correct number of elements
- if(cMediaTypes == 0)
- {
+ if (cMediaTypes == 0) {
return S_OK;
}
/* Check we are still in sync with the pin */
- if(AreWeOutOfSync() == TRUE)
- {
+ if (AreWeOutOfSync() == TRUE) {
return VFW_E_ENUM_OUT_OF_SYNC;
}
@@ -1591,12 +1479,12 @@ CEnumMediaTypes::Reset()
/* Constructor */
CBasePin::CBasePin(__in_opt LPCTSTR pObjectName,
- __in CBaseFilter *pFilter,
- __in CCritSec *pLock,
- __inout HRESULT *phr,
- __in_opt LPCWSTR pName,
- PIN_DIRECTION dir) :
- CUnknown(pObjectName, NULL),
+ __in CBaseFilter *pFilter,
+ __in CCritSec *pLock,
+ __inout HRESULT *phr,
+ __in_opt LPCWSTR pName,
+ PIN_DIRECTION dir) :
+ CUnknown( pObjectName, NULL ),
m_pFilter(pFilter),
m_pLock(pLock),
m_pName(NULL),
@@ -1619,21 +1507,18 @@ CBasePin::CBasePin(__in_opt LPCTSTR pObjectName,
called
*/
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CBasePin", (IPin *) this);
+ PERFLOG_CTOR( pName ? pName : L"CBasePin", (IPin *) this );
#endif // DXMPERF
ASSERT(pFilter != NULL);
ASSERT(pLock != NULL);
- if(pName)
- {
+ if (pName) {
size_t cchName;
HRESULT hr = StringCchLengthW(pName, STRSAFE_MAX_CCH, &cchName);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
m_pName = new WCHAR[cchName + 1];
- if(m_pName)
- {
+ if (m_pName) {
(void)StringCchCopyW(m_pName, cchName + 1, pName);
}
}
@@ -1646,12 +1531,12 @@ CBasePin::CBasePin(__in_opt LPCTSTR pObjectName,
#ifdef UNICODE
CBasePin::CBasePin(__in_opt LPCSTR pObjectName,
- __in CBaseFilter *pFilter,
- __in CCritSec *pLock,
- __inout HRESULT *phr,
- __in_opt LPCWSTR pName,
- PIN_DIRECTION dir) :
- CUnknown(pObjectName, NULL),
+ __in CBaseFilter *pFilter,
+ __in CCritSec *pLock,
+ __inout HRESULT *phr,
+ __in_opt LPCWSTR pName,
+ PIN_DIRECTION dir) :
+ CUnknown( pObjectName, NULL ),
m_pFilter(pFilter),
m_pLock(pLock),
m_pName(NULL),
@@ -1674,21 +1559,18 @@ CBasePin::CBasePin(__in_opt LPCSTR pObjectName,
called
*/
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CBasePin", (IPin *) this);
+ PERFLOG_CTOR( pName ? pName : L"CBasePin", (IPin *) this );
#endif // DXMPERF
ASSERT(pFilter != NULL);
ASSERT(pLock != NULL);
- if(pName)
- {
+ if (pName) {
size_t cchName;
HRESULT hr = StringCchLengthW(pName, STRSAFE_MAX_CCH, &cchName);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
m_pName = new WCHAR[cchName + 1];
- if(m_pName)
- {
+ if (m_pName) {
(void)StringCchCopyW(m_pName, cchName + 1, pName);
}
}
@@ -1707,7 +1589,7 @@ CBasePin::CBasePin(__in_opt LPCSTR pObjectName,
CBasePin::~CBasePin()
{
#ifdef DXMPERF
- PERFLOG_DTOR(m_pName ? m_pName : L"CBasePin", (IPin *) this);
+ PERFLOG_DTOR( m_pName ? m_pName : L"CBasePin", (IPin *) this );
#endif // DXMPERF
// We don't call disconnect because if the filter is going away
@@ -1729,16 +1611,11 @@ CBasePin::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
{
/* Do we have this interface */
- if(riid == IID_IPin)
- {
+ if (riid == IID_IPin) {
return GetInterface((IPin *) this, ppv);
- }
- else if(riid == IID_IQualityControl)
- {
+ } else if (riid == IID_IQualityControl) {
return GetInterface((IQualityControl *) this, ppv);
- }
- else
- {
+ } else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -1771,26 +1648,19 @@ void
CBasePin::DisplayPinInfo(IPin *pReceivePin)
{
- if(DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL))
- {
+ if (DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL)) {
PIN_INFO ConnectPinInfo;
PIN_INFO ReceivePinInfo;
- if(FAILED(QueryPinInfo(&ConnectPinInfo)))
- {
- StringCchCopyW(ConnectPinInfo.achName, sizeof(ConnectPinInfo.achName) / sizeof(WCHAR), L"Bad Pin");
- }
- else
- {
+ if (FAILED(QueryPinInfo(&ConnectPinInfo))) {
+ StringCchCopyW(ConnectPinInfo.achName, sizeof(ConnectPinInfo.achName)/sizeof(WCHAR), L"Bad Pin");
+ } else {
QueryPinInfoReleaseFilter(ConnectPinInfo);
}
- if(FAILED(pReceivePin->QueryPinInfo(&ReceivePinInfo)))
- {
- StringCchCopyW(ReceivePinInfo.achName, sizeof(ReceivePinInfo.achName) / sizeof(WCHAR), L"Bad Pin");
- }
- else
- {
+ if (FAILED(pReceivePin->QueryPinInfo(&ReceivePinInfo))) {
+ StringCchCopyW(ReceivePinInfo.achName, sizeof(ReceivePinInfo.achName)/sizeof(WCHAR), L"Bad Pin");
+ } else {
QueryPinInfoReleaseFilter(ReceivePinInfo);
}
@@ -1808,13 +1678,12 @@ CBasePin::DisplayPinInfo(IPin *pReceivePin)
void CBasePin::DisplayTypeInfo(IPin *pPin, const CMediaType *pmt)
{
UNREFERENCED_PARAMETER(pPin);
- if(DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL))
- {
+ if (DbgCheckModuleLevel(LOG_TRACE, CONNECT_TRACE_LEVEL)) {
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Trying media type:")));
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" major type: %hs"),
- GuidNames[*pmt->Type()]));
+ GuidNames[*pmt->Type()]));
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT(" sub type : %hs"),
- GuidNames[*pmt->Subtype()]));
+ GuidNames[*pmt->Subtype()]));
}
}
#endif
@@ -1831,22 +1700,20 @@ CBasePin::Connect(
__in_opt const AM_MEDIA_TYPE *pmt // optional media type
)
{
- CheckPointer(pReceivePin, E_POINTER);
- ValidateReadPtr(pReceivePin, sizeof(IPin));
+ CheckPointer(pReceivePin,E_POINTER);
+ ValidateReadPtr(pReceivePin,sizeof(IPin));
CAutoLock cObjectLock(m_pLock);
DisplayPinInfo(pReceivePin);
/* See if we are already connected */
- if(m_Connected)
- {
+ if (m_Connected) {
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Already connected")));
return VFW_E_ALREADY_CONNECTED;
}
/* See if the filter is active */
- if(!IsStopped() && !m_bCanReconnectWhenActive)
- {
+ if (!IsStopped() && !m_bCanReconnectWhenActive) {
return VFW_E_NOT_STOPPED;
}
@@ -1859,16 +1726,15 @@ CBasePin::Connect(
const CMediaType * ptype = (CMediaType*)pmt;
HRESULT hr = AgreeMediaType(pReceivePin, ptype);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Failed to agree type")));
// Since the procedure is already returning an error code, there
// is nothing else this function can do to report the error.
- EXECUTE_ASSERT(SUCCEEDED(BreakConnect()));
+ EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) );
#ifdef DXMPERF
- PERFLOG_CONNECT((IPin *) this, pReceivePin, hr, pmt);
+ PERFLOG_CONNECT( (IPin *) this, pReceivePin, hr, pmt );
#endif // DXMPERF
return hr;
@@ -1877,7 +1743,7 @@ CBasePin::Connect(
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("Connection succeeded")));
#ifdef DXMPERF
- PERFLOG_CONNECT((IPin *) this, pReceivePin, NOERROR, pmt);
+ PERFLOG_CONNECT( (IPin *) this, pReceivePin, NOERROR, pmt );
#endif // DXMPERF
return NOERROR;
@@ -1900,13 +1766,12 @@ CBasePin::AttemptConnection(
// Check that the connection is valid -- need to do this for every
// connect attempt since BreakConnect will undo it.
HRESULT hr = CheckConnect(pReceivePin);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_TRACE, CONNECT_TRACE_LEVEL, TEXT("CheckConnect failed")));
// Since the procedure is already returning an error code, there
// is nothing else this function can do to report the error.
- EXECUTE_ASSERT(SUCCEEDED(BreakConnect()));
+ EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) );
return hr;
}
@@ -1916,8 +1781,7 @@ CBasePin::AttemptConnection(
/* Check we will accept this media type */
hr = CheckMediaType(pmt);
- if(hr == NOERROR)
- {
+ if (hr == NOERROR) {
/* Make ourselves look connected otherwise ReceiveConnection
may not be able to complete the connection
@@ -1925,22 +1789,17 @@ CBasePin::AttemptConnection(
m_Connected = pReceivePin;
m_Connected->AddRef();
hr = SetMediaType(pmt);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
/* See if the other pin will accept this type */
hr = pReceivePin->ReceiveConnection((IPin *)this, pmt);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
/* Complete the connection */
hr = CompleteConnect(pReceivePin);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
return hr;
- }
- else
- {
+ } else {
DbgLog((LOG_TRACE,
CONNECT_TRACE_LEVEL,
TEXT("Failed to complete connection")));
@@ -1948,18 +1807,15 @@ CBasePin::AttemptConnection(
}
}
}
- }
- else
- {
+ } else {
// we cannot use this media type
// return a specific media type error if there is one
// or map a general failure code to something more helpful
// (in particular S_FALSE gets changed to an error code)
- if(SUCCEEDED(hr) ||
- (hr == E_FAIL) ||
- (hr == E_INVALIDARG))
- {
+ if (SUCCEEDED(hr) ||
+ (hr == E_FAIL) ||
+ (hr == E_INVALIDARG)) {
hr = VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -1970,11 +1826,10 @@ CBasePin::AttemptConnection(
// Since the procedure is already returning an error code, there
// is nothing else this function can do to report the error.
- EXECUTE_ASSERT(SUCCEEDED(BreakConnect()));
+ EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) );
/* If failed then undo our state */
- if(m_Connected)
- {
+ if (m_Connected) {
m_Connected->Release();
m_Connected = NULL;
}
@@ -1997,8 +1852,7 @@ HRESULT CBasePin::TryMediaTypes(
/* Reset the current enumerator position */
HRESULT hr = pEnum->Reset();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -2008,19 +1862,16 @@ HRESULT CBasePin::TryMediaTypes(
// attempt to remember a specific error code if there is one
HRESULT hrFailure = S_OK;
- for(;;)
- {
+ for (;;) {
/* Retrieve the next media type NOTE each time round the loop the
enumerator interface will allocate another AM_MEDIA_TYPE structure
If we are successful then we copy it into our output object, if
not then we must delete the memory allocated before returning */
- hr = pEnum->Next(1, (AM_MEDIA_TYPE**)&pMediaType, &ulMediaCount);
- if(hr != S_OK)
- {
- if(S_OK == hrFailure)
- {
+ hr = pEnum->Next(1, (AM_MEDIA_TYPE**)&pMediaType,&ulMediaCount);
+ if (hr != S_OK) {
+ if (S_OK == hrFailure) {
hrFailure = VFW_E_NO_ACCEPTABLE_TYPES;
}
return hrFailure;
@@ -2032,36 +1883,30 @@ HRESULT CBasePin::TryMediaTypes(
// check that this matches the partial type (if any)
- if(pMediaType &&
- ((pmt == NULL) ||
- pMediaType->MatchesPartial(pmt)))
- {
+ if (pMediaType &&
+ ((pmt == NULL) ||
+ pMediaType->MatchesPartial(pmt))) {
hr = AttemptConnection(pReceivePin, pMediaType);
// attempt to remember a specific error code
- if(FAILED(hr) &&
- SUCCEEDED(hrFailure) &&
- (hr != E_FAIL) &&
- (hr != E_INVALIDARG) &&
- (hr != VFW_E_TYPE_NOT_ACCEPTED))
- {
+ if (FAILED(hr) &&
+ SUCCEEDED(hrFailure) &&
+ (hr != E_FAIL) &&
+ (hr != E_INVALIDARG) &&
+ (hr != VFW_E_TYPE_NOT_ACCEPTED)) {
hrFailure = hr;
}
- }
- else
- {
+ } else {
hr = VFW_E_NO_ACCEPTABLE_TYPES;
}
- if(pMediaType)
- {
+ if(pMediaType) {
DeleteMediaType(pMediaType);
pMediaType = NULL;
}
- if(S_OK == hr)
- {
+ if (S_OK == hr) {
return hr;
}
}
@@ -2085,8 +1930,7 @@ HRESULT CBasePin::AgreeMediaType(
IEnumMediaTypes *pEnumMediaTypes = NULL;
// if the media type is fully specified then use that
- if((pmt != NULL) && (!pmt->IsPartiallySpecified()))
- {
+ if ( (pmt != NULL) && (!pmt->IsPartiallySpecified())) {
// if this media type fails, then we must fail the connection
// since if pmt is nonnull we are only allowed to connect
@@ -2100,33 +1944,24 @@ HRESULT CBasePin::AgreeMediaType(
HRESULT hrFailure = VFW_E_NO_ACCEPTABLE_TYPES;
- for(int i = 0; i < 2; i++)
- {
+ for (int i = 0; i < 2; i++) {
HRESULT hr;
- if(i == (int)m_bTryMyTypesFirst)
- {
+ if (i == (int)m_bTryMyTypesFirst) {
hr = pReceivePin->EnumMediaTypes(&pEnumMediaTypes);
- }
- else
- {
+ } else {
hr = EnumMediaTypes(&pEnumMediaTypes);
}
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
ASSERT(pEnumMediaTypes);
- hr = TryMediaTypes(pReceivePin, pmt, pEnumMediaTypes);
+ hr = TryMediaTypes(pReceivePin,pmt,pEnumMediaTypes);
pEnumMediaTypes->Release();
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
return NOERROR;
- }
- else
- {
+ } else {
// try to remember specific error codes if there are any
- if((hr != E_FAIL) &&
- (hr != E_INVALIDARG) &&
- (hr != VFW_E_TYPE_NOT_ACCEPTED))
- {
+ if ((hr != E_FAIL) &&
+ (hr != E_INVALIDARG) &&
+ (hr != VFW_E_TYPE_NOT_ACCEPTED)) {
hrFailure = hr;
}
}
@@ -2156,8 +1991,7 @@ HRESULT
CBasePin::SetMediaType(const CMediaType *pmt)
{
HRESULT hr = m_mt.Set(*pmt);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -2181,8 +2015,7 @@ CBasePin::CheckConnect(IPin * pPin)
ASSERT((m_dir == PINDIR_OUTPUT) || (m_dir == PINDIR_INPUT));
// we should allow for non-input and non-output connections?
- if(pd == m_dir)
- {
+ if (pd == m_dir) {
return VFW_E_INVALID_DIRECTION;
}
return NOERROR;
@@ -2209,33 +2042,30 @@ CBasePin::ReceiveConnection(
const AM_MEDIA_TYPE *pmt // this is the media type we will exchange
)
{
- CheckPointer(pConnector, E_POINTER);
- CheckPointer(pmt, E_POINTER);
- ValidateReadPtr(pConnector, sizeof(IPin));
- ValidateReadPtr(pmt, sizeof(AM_MEDIA_TYPE));
+ CheckPointer(pConnector,E_POINTER);
+ CheckPointer(pmt,E_POINTER);
+ ValidateReadPtr(pConnector,sizeof(IPin));
+ ValidateReadPtr(pmt,sizeof(AM_MEDIA_TYPE));
CAutoLock cObjectLock(m_pLock);
/* Are we already connected */
- if(m_Connected)
- {
+ if (m_Connected) {
return VFW_E_ALREADY_CONNECTED;
}
/* See if the filter is active */
- if(!IsStopped() && !m_bCanReconnectWhenActive)
- {
+ if (!IsStopped() && !m_bCanReconnectWhenActive) {
return VFW_E_NOT_STOPPED;
}
HRESULT hr = CheckConnect(pConnector);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
// Since the procedure is already returning an error code, there
// is nothing else this function can do to report the error.
- EXECUTE_ASSERT(SUCCEEDED(BreakConnect()));
+ EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) );
#ifdef DXMPERF
- PERFLOG_RXCONNECT(pConnector, (IPin *) this, hr, pmt);
+ PERFLOG_RXCONNECT( pConnector, (IPin *) this, hr, pmt );
#endif // DXMPERF
return hr;
@@ -2245,26 +2075,24 @@ CBasePin::ReceiveConnection(
CMediaType * pcmt = (CMediaType*) pmt;
hr = CheckMediaType(pcmt);
- if(hr != NOERROR)
- {
+ if (hr != NOERROR) {
// no -we don't support this media type
// Since the procedure is already returning an error code, there
// is nothing else this function can do to report the error.
- EXECUTE_ASSERT(SUCCEEDED(BreakConnect()));
+ EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) );
// return a specific media type error if there is one
// or map a general failure code to something more helpful
// (in particular S_FALSE gets changed to an error code)
- if(SUCCEEDED(hr) ||
- (hr == E_FAIL) ||
- (hr == E_INVALIDARG))
- {
+ if (SUCCEEDED(hr) ||
+ (hr == E_FAIL) ||
+ (hr == E_INVALIDARG)) {
hr = VFW_E_TYPE_NOT_ACCEPTED;
}
#ifdef DXMPERF
- PERFLOG_RXCONNECT(pConnector, (IPin *) this, hr, pmt);
+ PERFLOG_RXCONNECT( pConnector, (IPin *) this, hr, pmt );
#endif // DXMPERF
return hr;
@@ -2275,14 +2103,12 @@ CBasePin::ReceiveConnection(
m_Connected = pConnector;
m_Connected->AddRef();
hr = SetMediaType(pcmt);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = CompleteConnect(pConnector);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
#ifdef DXMPERF
- PERFLOG_RXCONNECT(pConnector, (IPin *) this, NOERROR, pmt);
+ PERFLOG_RXCONNECT( pConnector, (IPin *) this, NOERROR, pmt );
#endif // DXMPERF
return NOERROR;
@@ -2295,10 +2121,10 @@ CBasePin::ReceiveConnection(
// Since the procedure is already returning an error code, there
// is nothing else this function can do to report the error.
- EXECUTE_ASSERT(SUCCEEDED(BreakConnect()));
+ EXECUTE_ASSERT( SUCCEEDED( BreakConnect() ) );
#ifdef DXMPERF
- PERFLOG_RXCONNECT(pConnector, (IPin *) this, hr, pmt);
+ PERFLOG_RXCONNECT( pConnector, (IPin *) this, hr, pmt );
#endif // DXMPERF
return hr;
@@ -2313,8 +2139,7 @@ CBasePin::Disconnect()
CAutoLock cObjectLock(m_pLock);
/* See if the filter is active */
- if(!IsStopped())
- {
+ if (!IsStopped()) {
return VFW_E_NOT_STOPPED;
}
@@ -2326,18 +2151,16 @@ CBasePin::DisconnectInternal()
{
ASSERT(CritCheckIn(m_pLock));
- if(m_Connected)
- {
+ if (m_Connected) {
HRESULT hr = BreakConnect();
- if(FAILED(hr))
- {
+ if( FAILED( hr ) ) {
#ifdef DXMPERF
- PERFLOG_DISCONNECT((IPin *) this, m_Connected, hr);
+ PERFLOG_DISCONNECT( (IPin *) this, m_Connected, hr );
#endif // DXMPERF
// There is usually a bug in the program if BreakConnect() fails.
- DbgBreak("WARNING: BreakConnect() failed in CBasePin::Disconnect().");
+ DbgBreak( "WARNING: BreakConnect() failed in CBasePin::Disconnect()." );
return hr;
}
@@ -2345,17 +2168,15 @@ CBasePin::DisconnectInternal()
m_Connected = NULL;
#ifdef DXMPERF
- PERFLOG_DISCONNECT((IPin *) this, m_Connected, S_OK);
+ PERFLOG_DISCONNECT( (IPin *) this, m_Connected, S_OK );
#endif // DXMPERF
return S_OK;
- }
- else
- {
+ } else {
// no connection - not an error
#ifdef DXMPERF
- PERFLOG_DISCONNECT((IPin *) this, m_Connected, S_FALSE);
+ PERFLOG_DISCONNECT( (IPin *) this, m_Connected, S_FALSE );
#endif // DXMPERF
return S_FALSE;
@@ -2369,8 +2190,8 @@ CBasePin::ConnectedTo(
__deref_out IPin **ppPin
)
{
- CheckPointer(ppPin, E_POINTER);
- ValidateReadWritePtr(ppPin, sizeof(IPin *));
+ CheckPointer(ppPin,E_POINTER);
+ ValidateReadWritePtr(ppPin,sizeof(IPin *));
//
// It's pointless to lock here.
// The caller should ensure integrity.
@@ -2378,13 +2199,10 @@ CBasePin::ConnectedTo(
IPin *pPin = m_Connected;
*ppPin = pPin;
- if(pPin != NULL)
- {
+ if (pPin != NULL) {
pPin->AddRef();
return S_OK;
- }
- else
- {
+ } else {
ASSERT(*ppPin == NULL);
return VFW_E_NOT_CONNECTED;
}
@@ -2396,18 +2214,15 @@ CBasePin::ConnectionMediaType(
__out AM_MEDIA_TYPE *pmt
)
{
- CheckPointer(pmt, E_POINTER);
- ValidateReadWritePtr(pmt, sizeof(AM_MEDIA_TYPE));
+ CheckPointer(pmt,E_POINTER);
+ ValidateReadWritePtr(pmt,sizeof(AM_MEDIA_TYPE));
CAutoLock cObjectLock(m_pLock);
/* Copy constructor of m_mt allocates the memory */
- if(IsConnected())
- {
- CopyMediaType(pmt, &m_mt);
+ if (IsConnected()) {
+ CopyMediaType( pmt, &m_mt );
return S_OK;
- }
- else
- {
+ } else {
((CMediaType *)pmt)->InitMediaType();
return VFW_E_NOT_CONNECTED;
}
@@ -2420,21 +2235,17 @@ CBasePin::QueryPinInfo(
__out PIN_INFO * pInfo
)
{
- CheckPointer(pInfo, E_POINTER);
- ValidateReadWritePtr(pInfo, sizeof(PIN_INFO));
+ CheckPointer(pInfo,E_POINTER);
+ ValidateReadWritePtr(pInfo,sizeof(PIN_INFO));
pInfo->pFilter = m_pFilter;
- if(m_pFilter)
- {
+ if (m_pFilter) {
m_pFilter->AddRef();
}
- if(m_pName)
- {
+ if (m_pName) {
(void)StringCchCopyW(pInfo->achName, NUMELMS(pInfo->achName), m_pName);
- }
- else
- {
+ } else {
pInfo->achName[0] = L'\0';
}
@@ -2448,8 +2259,8 @@ CBasePin::QueryDirection(
__out PIN_DIRECTION * pPinDir
)
{
- CheckPointer(pPinDir, E_POINTER);
- ValidateReadWritePtr(pPinDir, sizeof(PIN_DIRECTION));
+ CheckPointer(pPinDir,E_POINTER);
+ ValidateReadWritePtr(pPinDir,sizeof(PIN_DIRECTION));
*pPinDir = m_dir;
return NOERROR;
@@ -2477,16 +2288,15 @@ CBasePin::QueryAccept(
const AM_MEDIA_TYPE *pmt
)
{
- CheckPointer(pmt, E_POINTER);
- ValidateReadPtr(pmt, sizeof(AM_MEDIA_TYPE));
+ CheckPointer(pmt,E_POINTER);
+ ValidateReadPtr(pmt,sizeof(AM_MEDIA_TYPE));
/* The CheckMediaType method is valid to return error codes if the media
type is horrible, an example might be E_INVALIDARG. What we do here
is map all the error codes into either S_OK or S_FALSE regardless */
HRESULT hr = CheckMediaType((CMediaType*)pmt);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return S_FALSE;
}
// note that the only defined success codes should be S_OK and S_FALSE...
@@ -2506,16 +2316,15 @@ CBasePin::EnumMediaTypes(
__deref_out IEnumMediaTypes **ppEnum
)
{
- CheckPointer(ppEnum, E_POINTER);
- ValidateReadWritePtr(ppEnum, sizeof(IEnumMediaTypes *));
+ CheckPointer(ppEnum,E_POINTER);
+ ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *));
/* Create a new ref counted enumerator */
*ppEnum = new CEnumMediaTypes(this,
- NULL);
+ NULL);
- if(*ppEnum == NULL)
- {
+ if (*ppEnum == NULL) {
return E_OUTOFMEMORY;
}
@@ -2604,7 +2413,7 @@ STDMETHODIMP
CBasePin::SetSink(IQualityControl * piqc)
{
CAutoLock cObjectLock(m_pLock);
- if(piqc) ValidateReadPtr(piqc, sizeof(IQualityControl));
+ if (piqc) ValidateReadPtr(piqc,sizeof(IQualityControl));
m_pQSink = piqc;
return NOERROR;
} // SetSink
@@ -2626,9 +2435,9 @@ CBasePin::Notify(IBaseFilter * pSender, Quality q)
// Override this to pass downstream.
STDMETHODIMP
CBasePin::NewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate)
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop,
+ double dRate)
{
m_tStart = tStart;
m_tStop = tStop;
@@ -2646,10 +2455,10 @@ CBasePin::NewSegment(
CBaseOutputPin::CBaseOutputPin(__in_opt LPCTSTR pObjectName,
- __in CBaseFilter *pFilter,
- __in CCritSec *pLock,
- __inout HRESULT *phr,
- __in_opt LPCWSTR pName) :
+ __in CBaseFilter *pFilter,
+ __in CCritSec *pLock,
+ __inout HRESULT *phr,
+ __in_opt LPCWSTR pName) :
CBasePin(pObjectName, pFilter, pLock, phr, pName, PINDIR_OUTPUT),
m_pAllocator(NULL),
m_pInputPin(NULL)
@@ -2659,10 +2468,10 @@ CBaseOutputPin::CBaseOutputPin(__in_opt LPCTSTR pObjectName,
#ifdef UNICODE
CBaseOutputPin::CBaseOutputPin(__in_opt LPCSTR pObjectName,
- __in CBaseFilter *pFilter,
- __in CCritSec *pLock,
- __inout HRESULT *phr,
- __in_opt LPCWSTR pName) :
+ __in CBaseFilter *pFilter,
+ __in CCritSec *pLock,
+ __inout HRESULT *phr,
+ __in_opt LPCWSTR pName) :
CBasePin(pObjectName, pFilter, pLock, phr, pName, PINDIR_OUTPUT),
m_pAllocator(NULL),
m_pInputPin(NULL)
@@ -2697,15 +2506,13 @@ HRESULT
CBaseOutputPin::CheckConnect(IPin * pPin)
{
HRESULT hr = CBasePin::CheckConnect(pPin);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
// get an input pin and an allocator interface
hr = pPin->QueryInterface(IID_IMemInputPin, (void **) &m_pInputPin);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return NOERROR;
@@ -2719,14 +2526,12 @@ CBaseOutputPin::BreakConnect()
{
/* Release any allocator we hold */
- if(m_pAllocator)
- {
+ if (m_pAllocator) {
// Always decommit the allocator because a downstream filter may or
// may not decommit the connection's allocator. A memory leak could
// occur if the allocator is not decommited when a connection is broken.
HRESULT hr = m_pAllocator->Decommit();
- if(FAILED(hr))
- {
+ if( FAILED( hr ) ) {
return hr;
}
@@ -2736,8 +2541,7 @@ CBaseOutputPin::BreakConnect()
/* Release any input pin interface we hold */
- if(m_pInputPin)
- {
+ if (m_pInputPin) {
m_pInputPin->Release();
m_pInputPin = NULL;
}
@@ -2785,23 +2589,19 @@ CBaseOutputPin::DecideAllocator(IMemInputPin *pPin, __deref_out IMemAllocator **
pPin->GetAllocatorRequirements(&prop);
// if he doesn't care about alignment, then set it to 1
- if(prop.cbAlign == 0)
- {
+ if (prop.cbAlign == 0) {
prop.cbAlign = 1;
}
/* Try the allocator provided by the input pin */
hr = pPin->GetAllocator(ppAlloc);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = DecideBufferSize(*ppAlloc, &prop);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = pPin->NotifyAllocator(*ppAlloc, FALSE);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
return NOERROR;
}
}
@@ -2809,8 +2609,7 @@ CBaseOutputPin::DecideAllocator(IMemInputPin *pPin, __deref_out IMemAllocator **
/* If the GetAllocator failed we may not have an interface */
- if(*ppAlloc)
- {
+ if (*ppAlloc) {
(*ppAlloc)->Release();
*ppAlloc = NULL;
}
@@ -2818,18 +2617,15 @@ CBaseOutputPin::DecideAllocator(IMemInputPin *pPin, __deref_out IMemAllocator **
/* Try the output pin's allocator by the same method */
hr = InitAllocator(ppAlloc);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
// note - the properties passed here are in the same
// structure as above and may have been modified by
// the previous call to DecideBufferSize
hr = DecideBufferSize(*ppAlloc, &prop);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = pPin->NotifyAllocator(*ppAlloc, FALSE);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
return NOERROR;
}
}
@@ -2837,8 +2633,7 @@ CBaseOutputPin::DecideAllocator(IMemInputPin *pPin, __deref_out IMemAllocator **
/* Likewise we may not have an interface to release */
- if(*ppAlloc)
- {
+ if (*ppAlloc) {
(*ppAlloc)->Release();
*ppAlloc = NULL;
}
@@ -2855,12 +2650,9 @@ CBaseOutputPin::GetDeliveryBuffer(__deref_out IMediaSample ** ppSample,
__in_opt REFERENCE_TIME * pEndTime,
DWORD dwFlags)
{
- if(m_pAllocator != NULL)
- {
- return m_pAllocator->GetBuffer(ppSample, pStartTime, pEndTime, dwFlags);
- }
- else
- {
+ if (m_pAllocator != NULL) {
+ return m_pAllocator->GetBuffer(ppSample,pStartTime,pEndTime,dwFlags);
+ } else {
return E_NOINTERFACE;
}
}
@@ -2892,13 +2684,12 @@ CBaseOutputPin::GetDeliveryBuffer(__deref_out IMediaSample ** ppSample,
HRESULT
CBaseOutputPin::Deliver(IMediaSample * pSample)
{
- if(m_pInputPin == NULL)
- {
+ if (m_pInputPin == NULL) {
return VFW_E_NOT_CONNECTED;
}
#ifdef DXMPERF
- PERFLOG_DELIVER(m_pName ? m_pName : L"CBaseOutputPin", (IPin *) this, (IPin *) m_pInputPin, pSample, &m_mt);
+ PERFLOG_DELIVER( m_pName ? m_pName : L"CBaseOutputPin", (IPin *) this, (IPin *) m_pInputPin, pSample, &m_mt );
#endif // DXMPERF
return m_pInputPin->Receive(pSample);
@@ -2911,8 +2702,7 @@ HRESULT
CBaseOutputPin::DeliverEndOfStream(void)
{
// remember this is on IPin not IMemInputPin
- if(m_Connected == NULL)
- {
+ if (m_Connected == NULL) {
return VFW_E_NOT_CONNECTED;
}
return m_Connected->EndOfStream();
@@ -2925,8 +2715,7 @@ CBaseOutputPin::DeliverEndOfStream(void)
HRESULT
CBaseOutputPin::Active(void)
{
- if(m_pAllocator == NULL)
- {
+ if (m_pAllocator == NULL) {
return VFW_E_NO_ALLOCATOR;
}
return m_pAllocator->Commit();
@@ -2940,8 +2729,7 @@ HRESULT
CBaseOutputPin::Inactive(void)
{
m_bRunTimeError = FALSE;
- if(m_pAllocator == NULL)
- {
+ if (m_pAllocator == NULL) {
return VFW_E_NO_ALLOCATOR;
}
return m_pAllocator->Decommit();
@@ -2975,8 +2763,7 @@ HRESULT
CBaseOutputPin::DeliverBeginFlush(void)
{
// remember this is on IPin not IMemInputPin
- if(m_Connected == NULL)
- {
+ if (m_Connected == NULL) {
return VFW_E_NOT_CONNECTED;
}
return m_Connected->BeginFlush();
@@ -2987,8 +2774,7 @@ HRESULT
CBaseOutputPin::DeliverEndFlush(void)
{
// remember this is on IPin not IMemInputPin
- if(m_Connected == NULL)
- {
+ if (m_Connected == NULL) {
return VFW_E_NOT_CONNECTED;
}
return m_Connected->EndFlush();
@@ -3000,8 +2786,7 @@ CBaseOutputPin::DeliverNewSegment(
REFERENCE_TIME tStop,
double dRate)
{
- if(m_Connected == NULL)
- {
+ if (m_Connected == NULL) {
return VFW_E_NOT_CONNECTED;
}
return m_Connected->NewSegment(tStart, tStop, dRate);
@@ -3018,10 +2803,10 @@ CBaseOutputPin::DeliverNewSegment(
/* Constructor creates a default allocator object */
CBaseInputPin::CBaseInputPin(__in_opt LPCTSTR pObjectName,
- __in CBaseFilter *pFilter,
- __in CCritSec *pLock,
- __inout HRESULT *phr,
- __in_opt LPCWSTR pPinName) :
+ __in CBaseFilter *pFilter,
+ __in CCritSec *pLock,
+ __inout HRESULT *phr,
+ __in_opt LPCWSTR pPinName) :
CBasePin(pObjectName, pFilter, pLock, phr, pPinName, PINDIR_INPUT),
m_pAllocator(NULL),
m_bReadOnly(FALSE),
@@ -3032,10 +2817,10 @@ CBaseInputPin::CBaseInputPin(__in_opt LPCTSTR pObjectName,
#ifdef UNICODE
CBaseInputPin::CBaseInputPin(__in LPCSTR pObjectName,
- __in CBaseFilter *pFilter,
- __in CCritSec *pLock,
- __inout HRESULT *phr,
- __in_opt LPCWSTR pPinName) :
+ __in CBaseFilter *pFilter,
+ __in CCritSec *pLock,
+ __inout HRESULT *phr,
+ __in_opt LPCWSTR pPinName) :
CBasePin(pObjectName, pFilter, pLock, phr, pPinName, PINDIR_INPUT),
m_pAllocator(NULL),
m_bReadOnly(FALSE),
@@ -3049,10 +2834,9 @@ CBaseInputPin::CBaseInputPin(__in LPCSTR pObjectName,
CBaseInputPin::~CBaseInputPin()
{
- if(m_pAllocator != NULL)
- {
- m_pAllocator->Release();
- m_pAllocator = NULL;
+ if (m_pAllocator != NULL) {
+ m_pAllocator->Release();
+ m_pAllocator = NULL;
}
}
@@ -3063,12 +2847,9 @@ CBaseInputPin::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
/* Do we know about this interface */
- if(riid == IID_IMemInputPin)
- {
+ if (riid == IID_IMemInputPin) {
return GetInterface((IMemInputPin *) this, ppv);
- }
- else
- {
+ } else {
return CBasePin::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -3089,15 +2870,13 @@ STDMETHODIMP
CBaseInputPin::GetAllocator(
__deref_out IMemAllocator **ppAllocator)
{
- CheckPointer(ppAllocator, E_POINTER);
- ValidateReadWritePtr(ppAllocator, sizeof(IMemAllocator *));
+ CheckPointer(ppAllocator,E_POINTER);
+ ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *));
CAutoLock cObjectLock(m_pLock);
- if(m_pAllocator == NULL)
- {
+ if (m_pAllocator == NULL) {
HRESULT hr = CreateMemoryAllocator(&m_pAllocator);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
}
@@ -3118,16 +2897,15 @@ CBaseInputPin::NotifyAllocator(
IMemAllocator * pAllocator,
BOOL bReadOnly)
{
- CheckPointer(pAllocator, E_POINTER);
- ValidateReadPtr(pAllocator, sizeof(IMemAllocator));
+ CheckPointer(pAllocator,E_POINTER);
+ ValidateReadPtr(pAllocator,sizeof(IMemAllocator));
CAutoLock cObjectLock(m_pLock);
IMemAllocator *pOldAllocator = m_pAllocator;
pAllocator->AddRef();
m_pAllocator = pAllocator;
- if(pOldAllocator != NULL)
- {
+ if (pOldAllocator != NULL) {
pOldAllocator->Release();
}
@@ -3143,14 +2921,12 @@ HRESULT
CBaseInputPin::BreakConnect()
{
/* We don't need our allocator any more */
- if(m_pAllocator)
- {
+ if (m_pAllocator) {
// Always decommit the allocator because a downstream filter may or
// may not decommit the connection's allocator. A memory leak could
// occur if the allocator is not decommited when a pin is disconnected.
HRESULT hr = m_pAllocator->Decommit();
- if(FAILED(hr))
- {
+ if( FAILED( hr ) ) {
return hr;
}
@@ -3175,59 +2951,49 @@ CBaseInputPin::BreakConnect()
STDMETHODIMP
CBaseInputPin::Receive(IMediaSample *pSample)
{
- CheckPointer(pSample, E_POINTER);
- ValidateReadPtr(pSample, sizeof(IMediaSample));
+ CheckPointer(pSample,E_POINTER);
+ ValidateReadPtr(pSample,sizeof(IMediaSample));
ASSERT(pSample);
HRESULT hr = CheckStreaming();
- if(S_OK != hr)
- {
+ if (S_OK != hr) {
return hr;
}
#ifdef DXMPERF
- PERFLOG_RECEIVE(m_pName ? m_pName : L"CBaseInputPin", (IPin *) m_Connected, (IPin *) this, pSample, &m_mt);
+ PERFLOG_RECEIVE( m_pName ? m_pName : L"CBaseInputPin", (IPin *) m_Connected, (IPin *) this, pSample, &m_mt );
#endif // DXMPERF
/* Check for IMediaSample2 */
IMediaSample2 *pSample2;
- if(SUCCEEDED(pSample->QueryInterface(IID_IMediaSample2, (void **)&pSample2)))
- {
+ if (SUCCEEDED(pSample->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) {
hr = pSample2->GetProperties(sizeof(m_SampleProps), (PBYTE)&m_SampleProps);
pSample2->Release();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
- }
- else
- {
+ } else {
/* Get the properties the hard way */
m_SampleProps.cbData = sizeof(m_SampleProps);
m_SampleProps.dwTypeSpecificFlags = 0;
m_SampleProps.dwStreamId = AM_STREAM_MEDIA;
m_SampleProps.dwSampleFlags = 0;
- if(S_OK == pSample->IsDiscontinuity())
- {
+ if (S_OK == pSample->IsDiscontinuity()) {
m_SampleProps.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
}
- if(S_OK == pSample->IsPreroll())
- {
+ if (S_OK == pSample->IsPreroll()) {
m_SampleProps.dwSampleFlags |= AM_SAMPLE_PREROLL;
}
- if(S_OK == pSample->IsSyncPoint())
- {
+ if (S_OK == pSample->IsSyncPoint()) {
m_SampleProps.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
}
- if(SUCCEEDED(pSample->GetTime(&m_SampleProps.tStart,
- &m_SampleProps.tStop)))
- {
+ if (SUCCEEDED(pSample->GetTime(&m_SampleProps.tStart,
+ &m_SampleProps.tStop))) {
m_SampleProps.dwSampleFlags |= AM_SAMPLE_TIMEVALID |
AM_SAMPLE_STOPVALID;
}
- if(S_OK == pSample->GetMediaType(&m_SampleProps.pMediaType))
- {
+ if (S_OK == pSample->GetMediaType(&m_SampleProps.pMediaType)) {
m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED;
}
pSample->GetPointer(&m_SampleProps.pbBuffer);
@@ -3237,8 +3003,7 @@ CBaseInputPin::Receive(IMediaSample *pSample)
/* Has the format changed in this sample */
- if(!(m_SampleProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED))
- {
+ if (!(m_SampleProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED)) {
return NOERROR;
}
@@ -3247,8 +3012,7 @@ CBaseInputPin::Receive(IMediaSample *pSample)
hr = CheckMediaType((CMediaType *)m_SampleProps.pMediaType);
- if(hr == NOERROR)
- {
+ if (hr == NOERROR) {
return NOERROR;
}
@@ -3256,33 +3020,31 @@ CBaseInputPin::Receive(IMediaSample *pSample)
m_bRunTimeError = TRUE;
EndOfStream();
- m_pFilter->NotifyEvent(EC_ERRORABORT, VFW_E_TYPE_NOT_ACCEPTED, 0);
+ m_pFilter->NotifyEvent(EC_ERRORABORT,VFW_E_TYPE_NOT_ACCEPTED,0);
return VFW_E_INVALIDMEDIATYPE;
}
/* Receive multiple samples */
STDMETHODIMP
-CBaseInputPin::ReceiveMultiple(
+CBaseInputPin::ReceiveMultiple (
__in_ecount(nSamples) IMediaSample **pSamples,
long nSamples,
__out long *nSamplesProcessed)
{
- CheckPointer(pSamples, E_POINTER);
- ValidateReadPtr(pSamples, nSamples * sizeof(IMediaSample *));
+ CheckPointer(pSamples,E_POINTER);
+ ValidateReadPtr(pSamples,nSamples * sizeof(IMediaSample *));
HRESULT hr = S_OK;
*nSamplesProcessed = 0;
- while(nSamples-- > 0)
- {
- hr = Receive(pSamples[*nSamplesProcessed]);
+ while (nSamples-- > 0) {
+ hr = Receive(pSamples[*nSamplesProcessed]);
- /* S_FALSE means don't send any more */
- if(hr != S_OK)
- {
- break;
- }
- (*nSamplesProcessed)++;
+ /* S_FALSE means don't send any more */
+ if (hr != S_OK) {
+ break;
+ }
+ (*nSamplesProcessed)++;
}
return hr;
}
@@ -3296,45 +3058,36 @@ CBaseInputPin::ReceiveCanBlock()
*/
int cPins = m_pFilter->GetPinCount();
int cOutputPins = 0;
- for(int c = 0; c < cPins; c++)
- {
+ for (int c = 0; c < cPins; c++) {
CBasePin *pPin = m_pFilter->GetPin(c);
- if(NULL == pPin)
- {
+ if (NULL == pPin) {
break;
}
PIN_DIRECTION pd;
HRESULT hr = pPin->QueryDirection(&pd);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
- if(pd == PINDIR_OUTPUT)
- {
+ if (pd == PINDIR_OUTPUT) {
IPin *pConnected;
hr = pPin->ConnectedTo(&pConnected);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
ASSERT(pConnected != NULL);
cOutputPins++;
IMemInputPin *pInputPin;
hr = pConnected->QueryInterface(
- IID_IMemInputPin,
- (void **)&pInputPin);
+ IID_IMemInputPin,
+ (void **)&pInputPin);
pConnected->Release();
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = pInputPin->ReceiveCanBlock();
pInputPin->Release();
- if(hr != S_FALSE)
- {
+ if (hr != S_FALSE) {
return S_OK;
}
- }
- else
- {
+ } else {
/* There's a transport we don't understand here */
return S_OK;
}
@@ -3400,8 +3153,8 @@ STDMETHODIMP
CBaseInputPin::Notify(IBaseFilter * pSender, Quality q)
{
UNREFERENCED_PARAMETER(q);
- CheckPointer(pSender, E_POINTER);
- ValidateReadPtr(pSender, sizeof(IBaseFilter));
+ CheckPointer(pSender,E_POINTER);
+ ValidateReadPtr(pSender,sizeof(IBaseFilter));
DbgBreak("IQuality::Notify called on an input pin");
return NOERROR;
} // Notify
@@ -3413,8 +3166,7 @@ HRESULT
CBaseInputPin::Inactive(void)
{
m_bRunTimeError = FALSE;
- if(m_pAllocator == NULL)
- {
+ if (m_pAllocator == NULL) {
return VFW_E_NO_ALLOCATOR;
}
@@ -3442,16 +3194,13 @@ CBaseInputPin::CheckStreaming()
ASSERT(IsConnected());
// Don't process stuff in Stopped state
- if(IsStopped())
- {
+ if (IsStopped()) {
return VFW_E_WRONG_STATE;
}
- if(m_bFlushing)
- {
+ if (m_bFlushing) {
return S_FALSE;
}
- if(m_bRunTimeError)
- {
+ if (m_bRunTimeError) {
return VFW_E_RUNTIME_ERROR;
}
return S_OK;
@@ -3467,24 +3216,19 @@ CBaseInputPin::PassNotify(Quality& q)
// We pass the message on, which means that we find the quality sink
// for our input pin and send it there
- DbgLog((LOG_TRACE, 3, TEXT("Passing Quality notification through transform")));
- if(m_pQSink != NULL)
- {
+ DbgLog((LOG_TRACE,3,TEXT("Passing Quality notification through transform")));
+ if (m_pQSink!=NULL) {
return m_pQSink->Notify(m_pFilter, q);
- }
- else
- {
+ } else {
// no sink set, so pass it upstream
HRESULT hr;
IQualityControl * pIQC;
hr = VFW_E_NOT_FOUND; // default
- if(m_Connected)
- {
+ if (m_Connected) {
m_Connected->QueryInterface(IID_IQualityControl, (void**)&pIQC);
- if(pIQC != NULL)
- {
+ if (pIQC!=NULL) {
hr = pIQC->Notify(m_pFilter, q);
pIQC->Release();
}
@@ -3513,10 +3257,10 @@ CBaseInputPin::PassNotify(Quality& q)
/* The last two parameters have default values of NULL and zero */
CMediaSample::CMediaSample(__in_opt LPCTSTR pName,
- __in_opt CBaseAllocator *pAllocator,
- __inout_opt HRESULT *phr,
- __in_bcount_opt(length) LPBYTE pBuffer,
- LONG length) :
+ __in_opt CBaseAllocator *pAllocator,
+ __inout_opt HRESULT *phr,
+ __in_bcount_opt(length) LPBYTE pBuffer,
+ LONG length) :
m_pBuffer(pBuffer), // Initialise the buffer
m_cbBuffer(length), // And it's length
m_lActual(length), // By default, actual = length
@@ -3528,7 +3272,7 @@ CMediaSample::CMediaSample(__in_opt LPCTSTR pName,
m_pAllocator(pAllocator) // Allocator
{
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CMediaSample", (IMediaSample *) this);
+ PERFLOG_CTOR( pName ? pName : L"CMediaSample", (IMediaSample *) this );
#endif // DXMPERF
/* We must have an owner and it must also be derived from class
@@ -3536,8 +3280,7 @@ CMediaSample::CMediaSample(__in_opt LPCTSTR pName,
ASSERT(pAllocator);
- if(length < 0)
- {
+ if (length < 0) {
*phr = VFW_E_BUFFER_OVERFLOW;
m_cbBuffer = 0;
}
@@ -3545,10 +3288,10 @@ CMediaSample::CMediaSample(__in_opt LPCTSTR pName,
#ifdef UNICODE
CMediaSample::CMediaSample(__in_opt LPCSTR pName,
- __in_opt CBaseAllocator *pAllocator,
- __inout_opt HRESULT *phr,
- __in_bcount_opt(length) LPBYTE pBuffer,
- LONG length) :
+ __in_opt CBaseAllocator *pAllocator,
+ __inout_opt HRESULT *phr,
+ __in_bcount_opt(length) LPBYTE pBuffer,
+ LONG length) :
m_pBuffer(pBuffer), // Initialise the buffer
m_cbBuffer(length), // And it's length
m_lActual(length), // By default, actual = length
@@ -3560,7 +3303,7 @@ CMediaSample::CMediaSample(__in_opt LPCSTR pName,
m_pAllocator(pAllocator) // Allocator
{
#ifdef DXMPERF
- PERFLOG_CTOR(L"CMediaSample", (IMediaSample *) this);
+ PERFLOG_CTOR( L"CMediaSample", (IMediaSample *) this );
#endif // DXMPERF
/* We must have an owner and it must also be derived from class
@@ -3575,12 +3318,11 @@ CMediaSample::CMediaSample(__in_opt LPCSTR pName,
CMediaSample::~CMediaSample()
{
#ifdef DXMPERF
- PERFLOG_DTOR(L"CMediaSample", (IMediaSample *) this);
+ PERFLOG_DTOR( L"CMediaSample", (IMediaSample *) this );
#endif // DXMPERF
- if(m_pMediaType)
- {
- DeleteMediaType(m_pMediaType);
+ if (m_pMediaType) {
+ DeleteMediaType(m_pMediaType);
}
}
@@ -3589,14 +3331,11 @@ CMediaSample::~CMediaSample()
STDMETHODIMP
CMediaSample::QueryInterface(REFIID riid, __deref_out void **ppv)
{
- if(riid == IID_IMediaSample ||
- riid == IID_IMediaSample2 ||
- riid == IID_IUnknown)
- {
+ if (riid == IID_IMediaSample ||
+ riid == IID_IMediaSample2 ||
+ riid == IID_IUnknown) {
return GetInterface((IMediaSample *) this, ppv);
- }
- else
- {
+ } else {
*ppv = NULL;
return E_NOINTERFACE;
}
@@ -3631,26 +3370,21 @@ CMediaSample::Release()
{
/* Decrement our own private reference count */
LONG lRef;
- if(m_cRef == 1)
- {
+ if (m_cRef == 1) {
lRef = 0;
m_cRef = 0;
- }
- else
- {
+ } else {
lRef = InterlockedDecrement(&m_cRef);
}
ASSERT(lRef >= 0);
- DbgLog((LOG_MEMORY, 3, TEXT(" Unknown %X ref-- = %d"),
- this, m_cRef));
+ DbgLog((LOG_MEMORY,3,TEXT(" Unknown %X ref-- = %d"),
+ this, m_cRef));
/* Did we release our final reference count */
- if(lRef == 0)
- {
+ if (lRef == 0) {
/* Free all resources */
- if(m_dwFlags & Sample_TypeChanged)
- {
+ if (m_dwFlags & Sample_TypeChanged) {
SetMediaType(NULL);
}
ASSERT(m_pMediaType == NULL);
@@ -3673,8 +3407,7 @@ CMediaSample::Release()
HRESULT
CMediaSample::SetPointer(__in_bcount(cBytes) BYTE * ptr, LONG cBytes)
{
- if(cBytes < 0)
- {
+ if (cBytes < 0) {
return VFW_E_BUFFER_OVERFLOW;
}
m_pBuffer = ptr; // new buffer area (could be null)
@@ -3690,7 +3423,7 @@ CMediaSample::SetPointer(__in_bcount(cBytes) BYTE * ptr, LONG cBytes)
STDMETHODIMP
CMediaSample::GetPointer(__deref_out BYTE ** ppBuffer)
{
- ValidateReadWritePtr(ppBuffer, sizeof(BYTE *));
+ ValidateReadWritePtr(ppBuffer,sizeof(BYTE *));
// creator must have set pointer either during
// constructor or by SetPointer
@@ -3716,17 +3449,13 @@ CMediaSample::GetTime(
__out REFERENCE_TIME * pTimeEnd
)
{
- ValidateReadWritePtr(pTimeStart, sizeof(REFERENCE_TIME));
- ValidateReadWritePtr(pTimeEnd, sizeof(REFERENCE_TIME));
+ ValidateReadWritePtr(pTimeStart,sizeof(REFERENCE_TIME));
+ ValidateReadWritePtr(pTimeEnd,sizeof(REFERENCE_TIME));
- if(!(m_dwFlags & Sample_StopValid))
- {
- if(!(m_dwFlags & Sample_TimeValid))
- {
+ if (!(m_dwFlags & Sample_StopValid)) {
+ if (!(m_dwFlags & Sample_TimeValid)) {
return VFW_E_SAMPLE_TIME_NOT_SET;
- }
- else
- {
+ } else {
*pTimeStart = m_Start;
// Make sure old stuff works
@@ -3749,23 +3478,17 @@ CMediaSample::SetTime(
__in_opt REFERENCE_TIME * pTimeEnd
)
{
- if(pTimeStart == NULL)
- {
+ if (pTimeStart == NULL) {
ASSERT(pTimeEnd == NULL);
m_dwFlags &= ~(Sample_TimeValid | Sample_StopValid);
- }
- else
- {
- if(pTimeEnd == NULL)
- {
+ } else {
+ if (pTimeEnd == NULL) {
m_Start = *pTimeStart;
m_dwFlags |= Sample_TimeValid;
m_dwFlags &= ~Sample_StopValid;
- }
- else
- {
- ValidateReadPtr(pTimeStart, sizeof(REFERENCE_TIME));
- ValidateReadPtr(pTimeEnd, sizeof(REFERENCE_TIME));
+ } else {
+ ValidateReadPtr(pTimeStart,sizeof(REFERENCE_TIME));
+ ValidateReadPtr(pTimeEnd,sizeof(REFERENCE_TIME));
ASSERT(*pTimeEnd >= *pTimeStart);
m_Start = *pTimeStart;
@@ -3784,11 +3507,10 @@ CMediaSample::GetMediaTime(
__out LONGLONG * pTimeEnd
)
{
- ValidateReadWritePtr(pTimeStart, sizeof(LONGLONG));
- ValidateReadWritePtr(pTimeEnd, sizeof(LONGLONG));
+ ValidateReadWritePtr(pTimeStart,sizeof(LONGLONG));
+ ValidateReadWritePtr(pTimeEnd,sizeof(LONGLONG));
- if(!(m_dwFlags & Sample_MediaTimeValid))
- {
+ if (!(m_dwFlags & Sample_MediaTimeValid)) {
return VFW_E_MEDIA_TIME_NOT_SET;
}
@@ -3805,19 +3527,15 @@ CMediaSample::SetMediaTime(
__in_opt LONGLONG * pTimeEnd
)
{
- if(pTimeStart == NULL)
- {
+ if (pTimeStart == NULL) {
ASSERT(pTimeEnd == NULL);
m_dwFlags &= ~Sample_MediaTimeValid;
- }
- else
- {
- if(NULL == pTimeEnd)
- {
+ } else {
+ if (NULL == pTimeEnd) {
return E_POINTER;
}
- ValidateReadPtr(pTimeStart, sizeof(LONGLONG));
- ValidateReadPtr(pTimeEnd, sizeof(LONGLONG));
+ ValidateReadPtr(pTimeStart,sizeof(LONGLONG));
+ ValidateReadPtr(pTimeEnd,sizeof(LONGLONG));
ASSERT(*pTimeEnd >= *pTimeStart);
m_MediaStart = *pTimeStart;
@@ -3831,12 +3549,9 @@ CMediaSample::SetMediaTime(
STDMETHODIMP
CMediaSample::IsSyncPoint(void)
{
- if(m_dwFlags & Sample_SyncPoint)
- {
+ if (m_dwFlags & Sample_SyncPoint) {
return S_OK;
- }
- else
- {
+ } else {
return S_FALSE;
}
}
@@ -3845,12 +3560,9 @@ CMediaSample::IsSyncPoint(void)
STDMETHODIMP
CMediaSample::SetSyncPoint(BOOL bIsSyncPoint)
{
- if(bIsSyncPoint)
- {
+ if (bIsSyncPoint) {
m_dwFlags |= Sample_SyncPoint;
- }
- else
- {
+ } else {
m_dwFlags &= ~Sample_SyncPoint;
}
return NOERROR;
@@ -3862,12 +3574,9 @@ CMediaSample::SetSyncPoint(BOOL bIsSyncPoint)
STDMETHODIMP
CMediaSample::IsDiscontinuity(void)
{
- if(m_dwFlags & Sample_Discontinuity)
- {
+ if (m_dwFlags & Sample_Discontinuity) {
return S_OK;
- }
- else
- {
+ } else {
return S_FALSE;
}
}
@@ -3878,12 +3587,9 @@ STDMETHODIMP
CMediaSample::SetDiscontinuity(BOOL bDiscont)
{
// should be TRUE or FALSE
- if(bDiscont)
- {
+ if (bDiscont) {
m_dwFlags |= Sample_Discontinuity;
- }
- else
- {
+ } else {
m_dwFlags &= ~Sample_Discontinuity;
}
return S_OK;
@@ -3892,12 +3598,9 @@ CMediaSample::SetDiscontinuity(BOOL bDiscont)
STDMETHODIMP
CMediaSample::IsPreroll(void)
{
- if(m_dwFlags & Sample_Preroll)
- {
+ if (m_dwFlags & Sample_Preroll) {
return S_OK;
- }
- else
- {
+ } else {
return S_FALSE;
}
}
@@ -3906,12 +3609,9 @@ CMediaSample::IsPreroll(void)
STDMETHODIMP
CMediaSample::SetPreroll(BOOL bIsPreroll)
{
- if(bIsPreroll)
- {
+ if (bIsPreroll) {
m_dwFlags |= Sample_Preroll;
- }
- else
- {
+ } else {
m_dwFlags &= ~Sample_Preroll;
}
return NOERROR;
@@ -3927,8 +3627,7 @@ CMediaSample::GetActualDataLength(void)
STDMETHODIMP
CMediaSample::SetActualDataLength(LONG lActual)
{
- if(lActual > m_cbBuffer || lActual < 0)
- {
+ if (lActual > m_cbBuffer || lActual < 0) {
ASSERT(lActual <= GetSize());
return VFW_E_BUFFER_OVERFLOW;
}
@@ -3942,13 +3641,12 @@ CMediaSample::SetActualDataLength(LONG lActual)
STDMETHODIMP
CMediaSample::GetMediaType(__deref_out AM_MEDIA_TYPE **ppMediaType)
{
- ValidateReadWritePtr(ppMediaType, sizeof(AM_MEDIA_TYPE *));
+ ValidateReadWritePtr(ppMediaType,sizeof(AM_MEDIA_TYPE *));
ASSERT(ppMediaType);
/* Do we have a new media type for them */
- if(!(m_dwFlags & Sample_TypeChanged))
- {
+ if (!(m_dwFlags & Sample_TypeChanged)) {
ASSERT(m_pMediaType == NULL);
*ppMediaType = NULL;
return S_FALSE;
@@ -3959,8 +3657,7 @@ CMediaSample::GetMediaType(__deref_out AM_MEDIA_TYPE **ppMediaType)
/* Create a copy of our media type */
*ppMediaType = CreateMediaType(m_pMediaType);
- if(*ppMediaType == NULL)
- {
+ if (*ppMediaType == NULL) {
return E_OUTOFMEMORY;
}
return NOERROR;
@@ -3974,28 +3671,25 @@ CMediaSample::SetMediaType(__in_opt AM_MEDIA_TYPE *pMediaType)
{
/* Delete the current media type */
- if(m_pMediaType)
- {
+ if (m_pMediaType) {
DeleteMediaType(m_pMediaType);
m_pMediaType = NULL;
}
/* Mechanism for resetting the format type */
- if(pMediaType == NULL)
- {
+ if (pMediaType == NULL) {
m_dwFlags &= ~Sample_TypeChanged;
return NOERROR;
}
ASSERT(pMediaType);
- ValidateReadPtr(pMediaType, sizeof(AM_MEDIA_TYPE));
+ ValidateReadPtr(pMediaType,sizeof(AM_MEDIA_TYPE));
/* Take a copy of the media type */
m_pMediaType = CreateMediaType(pMediaType);
- if(m_pMediaType == NULL)
- {
+ if (m_pMediaType == NULL) {
m_dwFlags &= ~Sample_TypeChanged;
return E_OUTOFMEMORY;
}
@@ -4010,8 +3704,7 @@ STDMETHODIMP CMediaSample::GetProperties(
__out_bcount(cbProperties) BYTE * pbProperties
)
{
- if(0 != cbProperties)
- {
+ if (0 != cbProperties) {
CheckPointer(pbProperties, E_POINTER);
// Return generic stuff up to the length
AM_SAMPLE2_PROPERTIES Props;
@@ -4024,12 +3717,9 @@ STDMETHODIMP CMediaSample::GetProperties(
Props.tStart = m_Start;
Props.tStop = m_End;
Props.dwStreamId = m_dwStreamId;
- if(m_dwFlags & AM_SAMPLE_TYPECHANGED)
- {
+ if (m_dwFlags & AM_SAMPLE_TYPECHANGED) {
Props.pMediaType = m_pMediaType;
- }
- else
- {
+ } else {
Props.pMediaType = NULL;
}
CopyMemory(pbProperties, &Props, Props.cbData);
@@ -4049,133 +3739,107 @@ HRESULT CMediaSample::SetProperties(
/* Generic properties */
AM_MEDIA_TYPE *pMediaType = NULL;
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbData, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbData, cbProperties)) {
CheckPointer(pbProperties, E_POINTER);
AM_SAMPLE2_PROPERTIES *pProps =
(AM_SAMPLE2_PROPERTIES *)pbProperties;
/* Don't use more data than is actually there */
- if(pProps->cbData < cbProperties)
- {
+ if (pProps->cbData < cbProperties) {
cbProperties = pProps->cbData;
}
/* We only handle IMediaSample2 */
- if(cbProperties > sizeof(*pProps) ||
- pProps->cbData > sizeof(*pProps))
- {
+ if (cbProperties > sizeof(*pProps) ||
+ pProps->cbData > sizeof(*pProps)) {
return E_INVALIDARG;
}
/* Do checks first, the assignments (for backout) */
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties)) {
/* Check the flags */
- if(pProps->dwSampleFlags &
- (~Sample_ValidFlags | Sample_MediaTimeValid))
- {
+ if (pProps->dwSampleFlags &
+ (~Sample_ValidFlags | Sample_MediaTimeValid)) {
return E_INVALIDARG;
}
/* Check a flag isn't being set for a property
not being provided
*/
- if((pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) &&
- !(m_dwFlags & AM_SAMPLE_TIMEVALID) &&
- !CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties))
- {
- return E_INVALIDARG;
+ if ((pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) &&
+ !(m_dwFlags & AM_SAMPLE_TIMEVALID) &&
+ !CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties)) {
+ return E_INVALIDARG;
}
}
/* NB - can't SET the pointer or size */
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pbBuffer, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pbBuffer, cbProperties)) {
/* Check pbBuffer */
- if(pProps->pbBuffer != 0 && pProps->pbBuffer != m_pBuffer)
- {
+ if (pProps->pbBuffer != 0 && pProps->pbBuffer != m_pBuffer) {
return E_INVALIDARG;
}
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties)) {
/* Check cbBuffer */
- if(pProps->cbBuffer != 0 && pProps->cbBuffer != m_cbBuffer)
- {
+ if (pProps->cbBuffer != 0 && pProps->cbBuffer != m_cbBuffer) {
return E_INVALIDARG;
}
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties) &&
- CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, cbBuffer, cbProperties) &&
+ CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties)) {
/* Check lActual */
- if(pProps->cbBuffer < pProps->lActual)
- {
+ if (pProps->cbBuffer < pProps->lActual) {
return E_INVALIDARG;
}
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties)) {
/* Check pMediaType */
- if(pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED)
- {
+ if (pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED) {
CheckPointer(pProps->pMediaType, E_POINTER);
pMediaType = CreateMediaType(pProps->pMediaType);
- if(pMediaType == NULL)
- {
+ if (pMediaType == NULL) {
return E_OUTOFMEMORY;
}
}
}
/* Now do the assignments */
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwStreamId, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwStreamId, cbProperties)) {
m_dwStreamId = pProps->dwStreamId;
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwSampleFlags, cbProperties)) {
/* Set the flags */
m_dwFlags = pProps->dwSampleFlags |
- (m_dwFlags & Sample_MediaTimeValid);
+ (m_dwFlags & Sample_MediaTimeValid);
m_dwTypeSpecificFlags = pProps->dwTypeSpecificFlags;
- }
- else
- {
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwTypeSpecificFlags, cbProperties))
- {
+ } else {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, dwTypeSpecificFlags, cbProperties)) {
m_dwTypeSpecificFlags = pProps->dwTypeSpecificFlags;
}
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, lActual, cbProperties)) {
/* Set lActual */
m_lActual = pProps->lActual;
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStop, cbProperties)) {
/* Set the times */
m_End = pProps->tStop;
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStart, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, tStart, cbProperties)) {
/* Set the times */
m_Start = pProps->tStart;
}
- if(CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties))
- {
+ if (CONTAINS_FIELD(AM_SAMPLE2_PROPERTIES, pMediaType, cbProperties)) {
/* Set pMediaType */
- if(pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED)
- {
- if(m_pMediaType != NULL)
- {
+ if (pProps->dwSampleFlags & AM_SAMPLE_TYPECHANGED) {
+ if (m_pMediaType != NULL) {
DeleteMediaType(m_pMediaType);
}
m_pMediaType = pMediaType;
@@ -4187,12 +3851,9 @@ HRESULT CMediaSample::SetProperties(
output does then if we don't do this we'd lose the
output media type.
*/
- if(m_pMediaType)
- {
+ if (m_pMediaType) {
m_dwFlags |= Sample_TypeChanged;
- }
- else
- {
+ } else {
m_dwFlags &= ~Sample_TypeChanged;
}
}
@@ -4228,19 +3889,18 @@ CDynamicOutputPin::CDynamicOutputPin(
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName) :
- CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName),
- m_hStopEvent(NULL),
- m_pGraphConfig(NULL),
- m_bPinUsesReadOnlyAllocator(FALSE),
- m_BlockState(NOT_BLOCKED),
- m_hUnblockOutputPinEvent(NULL),
- m_hNotifyCallerPinBlockedEvent(NULL),
- m_dwBlockCallerThreadID(0),
- m_dwNumOutstandingOutputPinUsers(0)
+ CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName),
+ m_hStopEvent(NULL),
+ m_pGraphConfig(NULL),
+ m_bPinUsesReadOnlyAllocator(FALSE),
+ m_BlockState(NOT_BLOCKED),
+ m_hUnblockOutputPinEvent(NULL),
+ m_hNotifyCallerPinBlockedEvent(NULL),
+ m_dwBlockCallerThreadID(0),
+ m_dwNumOutstandingOutputPinUsers(0)
{
HRESULT hr = Initialize();
- if(FAILED(hr))
- {
+ if( FAILED( hr ) ) {
*phr = hr;
return;
}
@@ -4253,19 +3913,18 @@ CDynamicOutputPin::CDynamicOutputPin(
__in CCritSec *pLock,
__inout HRESULT *phr,
__in_opt LPCWSTR pName) :
- CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName),
- m_hStopEvent(NULL),
- m_pGraphConfig(NULL),
- m_bPinUsesReadOnlyAllocator(FALSE),
- m_BlockState(NOT_BLOCKED),
- m_hUnblockOutputPinEvent(NULL),
- m_hNotifyCallerPinBlockedEvent(NULL),
- m_dwBlockCallerThreadID(0),
- m_dwNumOutstandingOutputPinUsers(0)
+ CBaseOutputPin(pObjectName, pFilter, pLock, phr, pName),
+ m_hStopEvent(NULL),
+ m_pGraphConfig(NULL),
+ m_bPinUsesReadOnlyAllocator(FALSE),
+ m_BlockState(NOT_BLOCKED),
+ m_hUnblockOutputPinEvent(NULL),
+ m_hNotifyCallerPinBlockedEvent(NULL),
+ m_dwBlockCallerThreadID(0),
+ m_dwNumOutstandingOutputPinUsers(0)
{
HRESULT hr = Initialize();
- if(FAILED(hr))
- {
+ if( FAILED( hr ) ) {
*phr = hr;
return;
}
@@ -4274,15 +3933,13 @@ CDynamicOutputPin::CDynamicOutputPin(
CDynamicOutputPin::~CDynamicOutputPin()
{
- if(NULL != m_hUnblockOutputPinEvent)
- {
+ if(NULL != m_hUnblockOutputPinEvent) {
// This call should not fail because we have access to m_hUnblockOutputPinEvent
// and m_hUnblockOutputPinEvent is a valid event.
EXECUTE_ASSERT(::CloseHandle(m_hUnblockOutputPinEvent));
}
- if(NULL != m_hNotifyCallerPinBlockedEvent)
- {
+ if(NULL != m_hNotifyCallerPinBlockedEvent) {
// This call should not fail because we have access to m_hNotifyCallerPinBlockedEvent
// and m_hNotifyCallerPinBlockedEvent is a valid event.
EXECUTE_ASSERT(::CloseHandle(m_hNotifyCallerPinBlockedEvent));
@@ -4291,14 +3948,13 @@ CDynamicOutputPin::~CDynamicOutputPin()
HRESULT CDynamicOutputPin::Initialize(void)
{
- m_hUnblockOutputPinEvent = ::CreateEvent(NULL, // The event will have the default security descriptor.
- TRUE, // This is a manual reset event.
- TRUE, // The event is initially signaled.
- NULL); // The event is not named.
+ m_hUnblockOutputPinEvent = ::CreateEvent( NULL, // The event will have the default security descriptor.
+ TRUE, // This is a manual reset event.
+ TRUE, // The event is initially signaled.
+ NULL ); // The event is not named.
// CreateEvent() returns NULL if an error occurs.
- if(NULL == m_hUnblockOutputPinEvent)
- {
+ if(NULL == m_hUnblockOutputPinEvent) {
return AmGetLastErrorToHResult();
}
@@ -4310,12 +3966,9 @@ HRESULT CDynamicOutputPin::Initialize(void)
STDMETHODIMP CDynamicOutputPin::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- if(riid == IID_IPinFlowControl)
- {
+ if(riid == IID_IPinFlowControl) {
return GetInterface(static_cast<IPinFlowControl*>(this), ppv);
- }
- else
- {
+ } else {
return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -4331,62 +3984,50 @@ STDMETHODIMP CDynamicOutputPin::Block(DWORD dwBlockFlags, HANDLE hEvent)
const DWORD VALID_FLAGS = AM_PIN_FLOW_CONTROL_BLOCK;
// Check for illegal flags.
- if(dwBlockFlags & ~VALID_FLAGS)
- {
+ if(dwBlockFlags & ~VALID_FLAGS) {
return E_INVALIDARG;
}
// Make sure the event is unsignaled.
- if((dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) && (NULL != hEvent))
- {
- if(!::ResetEvent(hEvent))
- {
+ if((dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) && (NULL != hEvent)) {
+ if( !::ResetEvent( hEvent ) ) {
return AmGetLastErrorToHResult();
}
}
// No flags are set if we are unblocking the output pin.
- if(0 == dwBlockFlags)
- {
+ if(0 == dwBlockFlags) {
// This parameter should be NULL because unblock operations are always synchronous.
// There is no need to notify the caller when the event is done.
- if(NULL != hEvent)
- {
+ if(NULL != hEvent) {
return E_INVALIDARG;
}
}
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
HRESULT hr;
- if(dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK)
- {
+ if(dwBlockFlags & AM_PIN_FLOW_CONTROL_BLOCK) {
// IPinFlowControl::Block()'s hEvent parameter is NULL if the block is synchronous.
// If hEvent is not NULL, the block is asynchronous.
- if(NULL == hEvent)
- {
+ if(NULL == hEvent) {
hr = SynchronousBlockOutputPin();
- }
- else
- {
+ } else {
hr = AsynchronousBlockOutputPin(hEvent);
}
- }
- else
- {
+ } else {
hr = UnblockOutputPin();
}
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
@@ -4395,20 +4036,18 @@ STDMETHODIMP CDynamicOutputPin::Block(DWORD dwBlockFlags, HANDLE hEvent)
HRESULT CDynamicOutputPin::SynchronousBlockOutputPin(void)
{
- HANDLE hNotifyCallerPinBlockedEvent = :: CreateEvent(NULL, // The event will have the default security attributes.
- FALSE, // This is an automatic reset event.
- FALSE, // The event is initially unsignaled.
- NULL); // The event is not named.
+ HANDLE hNotifyCallerPinBlockedEvent = :: CreateEvent( NULL, // The event will have the default security attributes.
+ FALSE, // This is an automatic reset event.
+ FALSE, // The event is initially unsignaled.
+ NULL ); // The event is not named.
// CreateEvent() returns NULL if an error occurs.
- if(NULL == hNotifyCallerPinBlockedEvent)
- {
+ if(NULL == hNotifyCallerPinBlockedEvent) {
return AmGetLastErrorToHResult();
}
HRESULT hr = AsynchronousBlockOutputPin(hNotifyCallerPinBlockedEvent);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
// This call should not fail because we have access to hNotifyCallerPinBlockedEvent
// and hNotifyCallerPinBlockedEvent is a valid event.
EXECUTE_ASSERT(::CloseHandle(hNotifyCallerPinBlockedEvent));
@@ -4422,8 +4061,7 @@ HRESULT CDynamicOutputPin::SynchronousBlockOutputPin(void)
// and hNotifyCallerPinBlockedEvent is a valid event.
EXECUTE_ASSERT(::CloseHandle(hNotifyCallerPinBlockedEvent));
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
@@ -4437,27 +4075,22 @@ HRESULT CDynamicOutputPin::AsynchronousBlockOutputPin(HANDLE hNotifyCallerPinBlo
// m_hNotifyCallerPinBlockedEvent.
CAutoLock alBlockStateLock(&m_BlockStateLock);
- if(NOT_BLOCKED != m_BlockState)
- {
- if(m_dwBlockCallerThreadID == ::GetCurrentThreadId())
- {
+ if(NOT_BLOCKED != m_BlockState) {
+ if(m_dwBlockCallerThreadID == ::GetCurrentThreadId()) {
return VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD;
- }
- else
- {
+ } else {
return VFW_E_PIN_ALREADY_BLOCKED;
}
}
- BOOL fSuccess = ::DuplicateHandle(::GetCurrentProcess(),
- hNotifyCallerPinBlockedEvent,
- ::GetCurrentProcess(),
- &m_hNotifyCallerPinBlockedEvent,
- EVENT_MODIFY_STATE,
- FALSE,
- 0);
- if(!fSuccess)
- {
+ BOOL fSuccess = ::DuplicateHandle( ::GetCurrentProcess(),
+ hNotifyCallerPinBlockedEvent,
+ ::GetCurrentProcess(),
+ &m_hNotifyCallerPinBlockedEvent,
+ EVENT_MODIFY_STATE,
+ FALSE,
+ 0 );
+ if( !fSuccess ) {
return AmGetLastErrorToHResult();
}
@@ -4469,8 +4102,7 @@ HRESULT CDynamicOutputPin::AsynchronousBlockOutputPin(HANDLE hNotifyCallerPinBlo
// or IMemInputPin::ReceiveMultiple() on the connected input pin. Also, it
// cannot be blocked if the streaming thread is calling DynamicReconnect(),
// ChangeMediaType() or ChangeOutputFormat().
- if(!StreamingThreadUsingOutputPin())
- {
+ if(!StreamingThreadUsingOutputPin()) {
// The output pin can be immediately blocked.
BlockOutputPin();
@@ -4509,8 +4141,7 @@ HRESULT CDynamicOutputPin::UnblockOutputPin(void)
// m_hNotifyCallerPinBlockedEvent.
CAutoLock alBlockStateLock(&m_BlockStateLock);
- if(NOT_BLOCKED == m_BlockState)
- {
+ if(NOT_BLOCKED == m_BlockState) {
return S_FALSE;
}
@@ -4519,8 +4150,7 @@ HRESULT CDynamicOutputPin::UnblockOutputPin(void)
EXECUTE_ASSERT(::SetEvent(m_hUnblockOutputPinEvent));
// Cancel the block operation if it's still pending.
- if(NULL != m_hNotifyCallerPinBlockedEvent)
- {
+ if(NULL != m_hNotifyCallerPinBlockedEvent) {
// This event should not fail because AsynchronousBlockOutputPin() successfully
// duplicated this handle and we have the appropriate security permissions.
EXECUTE_ASSERT(::SetEvent(m_hNotifyCallerPinBlockedEvent));
@@ -4542,18 +4172,17 @@ HRESULT CDynamicOutputPin::StartUsingOutputPin(void)
CAutoLock alBlockStateLock(&m_BlockStateLock);
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
// Are we in the middle of a block operation?
- while(BLOCKED == m_BlockState)
- {
+ while(BLOCKED == m_BlockState) {
m_BlockStateLock.Unlock();
// If this ASSERT fires, a deadlock could occur. The caller should make sure
// that this thread never acquires the Block State lock more than once.
- ASSERT(CritCheckOut(&m_BlockStateLock));
+ ASSERT(CritCheckOut( &m_BlockStateLock ));
// WaitForMultipleObjects() returns WAIT_OBJECT_0 if the unblock event
// is fired. It returns WAIT_OBJECT_0 + 1 if the stop event if fired.
@@ -4563,18 +4192,17 @@ HRESULT CDynamicOutputPin::StartUsingOutputPin(void)
const DWORD STOP = WAIT_OBJECT_0 + 1;
HANDLE ahWaitEvents[] = { m_hUnblockOutputPinEvent, m_hStopEvent };
- DWORD dwNumWaitEvents = sizeof(ahWaitEvents) / sizeof(HANDLE);
+ DWORD dwNumWaitEvents = sizeof(ahWaitEvents)/sizeof(HANDLE);
- DWORD dwReturnValue = ::WaitForMultipleObjects(dwNumWaitEvents, ahWaitEvents, FALSE, INFINITE);
+ DWORD dwReturnValue = ::WaitForMultipleObjects( dwNumWaitEvents, ahWaitEvents, FALSE, INFINITE );
m_BlockStateLock.Lock();
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
- switch(dwReturnValue)
- {
+ switch( dwReturnValue ) {
case UNBLOCK:
break;
@@ -4585,16 +4213,16 @@ HRESULT CDynamicOutputPin::StartUsingOutputPin(void)
return AmGetLastErrorToHResult();
default:
- DbgBreak("An Unexpected case occured in CDynamicOutputPin::StartUsingOutputPin().");
+ DbgBreak( "An Unexpected case occured in CDynamicOutputPin::StartUsingOutputPin()." );
return E_UNEXPECTED;
}
}
m_dwNumOutstandingOutputPinUsers++;
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
return S_OK;
}
@@ -4603,20 +4231,19 @@ void CDynamicOutputPin::StopUsingOutputPin(void)
{
CAutoLock alBlockStateLock(&m_BlockStateLock);
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
m_dwNumOutstandingOutputPinUsers--;
- if((m_dwNumOutstandingOutputPinUsers == 0) && (NOT_BLOCKED != m_BlockState))
- {
+ if((m_dwNumOutstandingOutputPinUsers == 0) && (NOT_BLOCKED != m_BlockState)) {
BlockOutputPin();
}
-#ifdef _DEBUG
+ #ifdef _DEBUG
AssertValid();
-#endif // DEBUG
+ #endif // DEBUG
}
bool CDynamicOutputPin::StreamingThreadUsingOutputPin(void)
@@ -4639,9 +4266,8 @@ void CDynamicOutputPin::SetConfigInfo(IGraphConfig *pGraphConfig, HANDLE hStopEv
HRESULT CDynamicOutputPin::Active(void)
{
// Make sure the user initialized the object by calling SetConfigInfo().
- if((NULL == m_hStopEvent) || (NULL == m_pGraphConfig))
- {
-DbgBreak(ERROR: CDynamicOutputPin::Active() failed because m_pGraphConfig and m_hStopEvent were not initialized. Call SetConfigInfo() to initialize them.);
+ if((NULL == m_hStopEvent) || (NULL == m_pGraphConfig)) {
+ DbgBreak( ERROR: CDynamicOutputPin::Active() failed because m_pGraphConfig and m_hStopEvent were not initialized. Call SetConfigInfo() to initialize them. );
return E_FAIL;
}
@@ -4691,12 +4317,12 @@ HRESULT CDynamicOutputPin::DeliverEndFlush(void)
// ChangeOutputFormat() either dynamicly changes the connection's format type or it dynamicly
// reconnects the output pin.
HRESULT CDynamicOutputPin::ChangeOutputFormat
-(
+ (
const AM_MEDIA_TYPE *pmt,
REFERENCE_TIME tSegmentStart,
REFERENCE_TIME tSegmentStop,
double dSegmentRate
-)
+ )
{
// The caller should call StartUsingOutputPin() before calling this
// method.
@@ -4707,14 +4333,12 @@ HRESULT CDynamicOutputPin::ChangeOutputFormat
CMediaType cmt(*pmt);
HRESULT hr = ChangeMediaType(&cmt);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
hr = DeliverNewSegment(tSegmentStart, tSegmentStop, dSegmentRate);
- if(FAILED(hr))
- {
+ if( FAILED( hr ) ) {
return hr;
}
@@ -4730,8 +4354,7 @@ HRESULT CDynamicOutputPin::ChangeMediaType(const CMediaType *pmt)
// This function assumes the filter graph is running.
ASSERT(!IsStopped());
- if(!IsConnected())
- {
+ if(!IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
@@ -4741,15 +4364,12 @@ HRESULT CDynamicOutputPin::ChangeMediaType(const CMediaType *pmt)
QzCComPtr<IPinConnection> pConnection;
m_Connected->QueryInterface(IID_IPinConnection, (void **)&pConnection);
- if(pConnection != NULL)
- {
+ if(pConnection != NULL) {
- if(S_OK == pConnection->DynamicQueryAccept(pmt))
- {
+ if(S_OK == pConnection->DynamicQueryAccept(pmt)) {
HRESULT hr = ChangeMediaTypeHelper(pmt);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
@@ -4768,20 +4388,17 @@ HRESULT CDynamicOutputPin::ChangeMediaTypeHelper(const CMediaType *pmt)
ASSERT(StreamingThreadUsingOutputPin());
HRESULT hr = m_Connected->ReceiveConnection(this, pmt);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
hr = SetMediaType(pmt);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
// Does this pin use the local memory transport?
- if(NULL != m_pInputPin)
- {
+ if(NULL != m_pInputPin) {
// This function assumes that m_pInputPin and m_Connected are
// two different interfaces to the same object.
ASSERT(::IsEqualObject(m_Connected, m_pInputPin));
@@ -4795,32 +4412,27 @@ HRESULT CDynamicOutputPin::ChangeMediaTypeHelper(const CMediaType *pmt)
m_pInputPin->GetAllocatorRequirements(&apInputPinRequirements);
// A zero allignment does not make any sense.
- if(0 == apInputPinRequirements.cbAlign)
- {
+ if(0 == apInputPinRequirements.cbAlign) {
apInputPinRequirements.cbAlign = 1;
}
hr = m_pAllocator->Decommit();
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
hr = DecideBufferSize(m_pAllocator, &apInputPinRequirements);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
hr = m_pAllocator->Commit();
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
hr = m_pInputPin->NotifyAllocator(m_pAllocator, m_bPinUsesReadOnlyAllocator);
- if(FAILED(hr))
- {
+ if(FAILED(hr)) {
return hr;
}
}
@@ -4833,24 +4445,23 @@ HRESULT CDynamicOutputPin::ChangeMediaTypeHelper(const CMediaType *pmt)
// has no outstand samples because they cannot be delivered after a
// reconnect
//
-HRESULT CDynamicOutputPin::DynamicReconnect(const CMediaType* pmt)
+HRESULT CDynamicOutputPin::DynamicReconnect( const CMediaType* pmt )
{
// The caller should call StartUsingOutputPin() before calling this
// method.
ASSERT(StreamingThreadUsingOutputPin());
- if((m_pGraphConfig == NULL) || (NULL == m_hStopEvent))
- {
+ if((m_pGraphConfig == NULL) || (NULL == m_hStopEvent)) {
return E_FAIL;
}
HRESULT hr = m_pGraphConfig->Reconnect(
- this,
- NULL,
- pmt,
- NULL,
- m_hStopEvent,
- AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS);
+ this,
+ NULL,
+ pmt,
+ NULL,
+ m_hStopEvent,
+ AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS );
return hr;
}
@@ -4858,10 +4469,8 @@ HRESULT CDynamicOutputPin::DynamicReconnect(const CMediaType* pmt)
HRESULT CDynamicOutputPin::CompleteConnect(IPin *pReceivePin)
{
HRESULT hr = CBaseOutputPin::CompleteConnect(pReceivePin);
- if(SUCCEEDED(hr))
- {
- if(!IsStopped() && m_pAllocator)
- {
+ if(SUCCEEDED(hr)) {
+ if(!IsStopped() && m_pAllocator) {
hr = m_pAllocator->Commit();
ASSERT(hr != VFW_E_ALREADY_COMMITTED);
}
@@ -4894,7 +4503,7 @@ void CDynamicOutputPin::AssertValid(void)
// m_hNotifyCallerPinBlockedEvent is only needed when a block operation cannot complete
// immediately.
ASSERT(((NULL == m_hNotifyCallerPinBlockedEvent) && (PENDING != m_BlockState)) ||
- ((NULL != m_hNotifyCallerPinBlockedEvent) && (PENDING == m_BlockState)));
+ ((NULL != m_hNotifyCallerPinBlockedEvent) && (PENDING == m_BlockState)) );
// m_dwBlockCallerThreadID should always be 0 if the pin is not blocked and
// the user is not trying to block the pin.
@@ -4904,7 +4513,7 @@ void CDynamicOutputPin::AssertValid(void)
// output pin is blocked.
ASSERT(((0 != m_dwNumOutstandingOutputPinUsers) && (BLOCKED != m_BlockState)) ||
((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED != m_BlockState)) ||
- ((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED == m_BlockState)));
+ ((0 == m_dwNumOutstandingOutputPinUsers) && (NOT_BLOCKED == m_BlockState)) );
}
#endif // DEBUG
@@ -4914,8 +4523,7 @@ HRESULT CDynamicOutputPin::WaitEvent(HANDLE hEvent)
DWORD dwReturnValue = ::WaitForSingleObject(hEvent, INFINITE);
- switch(dwReturnValue)
- {
+ switch( dwReturnValue ) {
case EVENT_SIGNALED:
return S_OK;
@@ -4923,7 +4531,7 @@ HRESULT CDynamicOutputPin::WaitEvent(HANDLE hEvent)
return AmGetLastErrorToHResult();
default:
- DbgBreak("An Unexpected case occured in CDynamicOutputPin::WaitEvent().");
+ DbgBreak( "An Unexpected case occured in CDynamicOutputPin::WaitEvent()." );
return E_UNEXPECTED;
}
}
@@ -4946,7 +4554,7 @@ CBaseAllocator::CBaseAllocator(__in_opt LPCTSTR pName,
__inout HRESULT *phr,
BOOL bEvent,
BOOL fEnableReleaseCallback
- ) :
+ ) :
CUnknown(pName, pUnk),
m_lAllocated(0),
m_bChanged(FALSE),
@@ -4962,14 +4570,12 @@ CBaseAllocator::CBaseAllocator(__in_opt LPCTSTR pName,
m_pNotify(NULL)
{
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CBaseAllocator", (IMemAllocator *) this);
+ PERFLOG_CTOR( pName ? pName : L"CBaseAllocator", (IMemAllocator *) this );
#endif // DXMPERF
- if(bEvent)
- {
+ if (bEvent) {
m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL);
- if(m_hSem == NULL)
- {
+ if (m_hSem == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
@@ -4997,14 +4603,12 @@ CBaseAllocator::CBaseAllocator(__in_opt LPCSTR pName,
m_pNotify(NULL)
{
#ifdef DXMPERF
- PERFLOG_CTOR(L"CBaseAllocator", (IMemAllocator *) this);
+ PERFLOG_CTOR( L"CBaseAllocator", (IMemAllocator *) this );
#endif // DXMPERF
- if(bEvent)
- {
+ if (bEvent) {
m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL);
- if(m_hSem == NULL)
- {
+ if (m_hSem == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
@@ -5021,16 +4625,14 @@ CBaseAllocator::~CBaseAllocator()
// We must assume that the derived class has gone into decommit state in
// its destructor.
#ifdef DXMPERF
- PERFLOG_DTOR(L"CBaseAllocator", (IMemAllocator *) this);
+ PERFLOG_DTOR( L"CBaseAllocator", (IMemAllocator *) this );
#endif // DXMPERF
ASSERT(!m_bCommitted);
- if(m_hSem != NULL)
- {
+ if (m_hSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hSem));
}
- if(m_pNotify)
- {
+ if (m_pNotify) {
m_pNotify->Release();
}
}
@@ -5043,13 +4645,10 @@ CBaseAllocator::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
/* Do we know about this interface */
- if(riid == IID_IMemAllocator ||
- riid == IID_IMemAllocatorCallbackTemp && m_fEnableReleaseCallback)
- {
+ if (riid == IID_IMemAllocator ||
+ riid == IID_IMemAllocatorCallbackTemp && m_fEnableReleaseCallback) {
return GetInterface((IMemAllocatorCallbackTemp *) this, ppv);
- }
- else
- {
+ } else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -5062,8 +4661,8 @@ CBaseAllocator::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
STDMETHODIMP
CBaseAllocator::SetProperties(
- __in ALLOCATOR_PROPERTIES* pRequest,
- __out ALLOCATOR_PROPERTIES* pActual)
+ __in ALLOCATOR_PROPERTIES* pRequest,
+ __out ALLOCATOR_PROPERTIES* pActual)
{
CheckPointer(pRequest, E_POINTER);
CheckPointer(pActual, E_POINTER);
@@ -5075,10 +4674,9 @@ CBaseAllocator::SetProperties(
ASSERT(pRequest->cbBuffer > 0);
/* Check the alignment requested */
- if(pRequest->cbAlign != 1)
- {
+ if (pRequest->cbAlign != 1) {
DbgLog((LOG_ERROR, 2, TEXT("Alignment requested was 0x%x, not 1"),
- pRequest->cbAlign));
+ pRequest->cbAlign));
return VFW_E_BADALIGN;
}
@@ -5088,15 +4686,13 @@ CBaseAllocator::SetProperties(
person who is holding the samples. Therefore it is not unreasonable
for them to free all their samples before changing the requirements */
- if(m_bCommitted)
- {
+ if (m_bCommitted) {
return VFW_E_ALREADY_COMMITTED;
}
/* Must be no outstanding buffers */
- if(m_lAllocated != m_lFree.GetCount())
- {
+ if (m_lAllocated != m_lFree.GetCount()) {
return VFW_E_BUFFERS_OUTSTANDING;
}
@@ -5116,8 +4712,8 @@ STDMETHODIMP
CBaseAllocator::GetProperties(
__out ALLOCATOR_PROPERTIES * pActual)
{
- CheckPointer(pActual, E_POINTER);
- ValidateReadWritePtr(pActual, sizeof(ALLOCATOR_PROPERTIES));
+ CheckPointer(pActual,E_POINTER);
+ ValidateReadWritePtr(pActual,sizeof(ALLOCATOR_PROPERTIES));
CAutoLock cObjectLock(this);
pActual->cbBuffer = m_lSize;
@@ -5136,7 +4732,7 @@ HRESULT CBaseAllocator::GetBuffer(__deref_out IMediaSample **ppBuffer,
__in_opt REFERENCE_TIME *pStartTime,
__in_opt REFERENCE_TIME *pEndTime,
DWORD dwFlags
- )
+ )
{
UNREFERENCED_PARAMETER(pStartTime);
UNREFERENCED_PARAMETER(pEndTime);
@@ -5144,32 +4740,27 @@ HRESULT CBaseAllocator::GetBuffer(__deref_out IMediaSample **ppBuffer,
CMediaSample *pSample;
*ppBuffer = NULL;
- for(;;)
+ for (;;)
{
- {
- // scope for lock
+ { // scope for lock
CAutoLock cObjectLock(this);
/* Check we are committed */
- if(!m_bCommitted)
- {
+ if (!m_bCommitted) {
return VFW_E_NOT_COMMITTED;
}
pSample = (CMediaSample *) m_lFree.RemoveHead();
- if(pSample == NULL)
- {
+ if (pSample == NULL) {
SetWaiting();
}
}
/* If we didn't get a sample then wait for the list to signal */
- if(pSample)
- {
+ if (pSample) {
break;
}
- if(dwFlags & AM_GBF_NOWAIT)
- {
+ if (dwFlags & AM_GBF_NOWAIT) {
return VFW_E_TIMEOUT;
}
ASSERT(m_hSem != NULL);
@@ -5187,7 +4778,7 @@ HRESULT CBaseAllocator::GetBuffer(__deref_out IMediaSample **ppBuffer,
*ppBuffer = pSample;
#ifdef DXMPERF
- PERFLOG_GETBUFFER((IMemAllocator *) this, pSample);
+ PERFLOG_GETBUFFER( (IMemAllocator *) this, pSample );
#endif // DXMPERF
return NOERROR;
@@ -5199,11 +4790,11 @@ HRESULT CBaseAllocator::GetBuffer(__deref_out IMediaSample **ppBuffer,
STDMETHODIMP
CBaseAllocator::ReleaseBuffer(IMediaSample * pSample)
{
- CheckPointer(pSample, E_POINTER);
- ValidateReadPtr(pSample, sizeof(IMediaSample));
+ CheckPointer(pSample,E_POINTER);
+ ValidateReadPtr(pSample,sizeof(IMediaSample));
#ifdef DXMPERF
- PERFLOG_RELBUFFER((IMemAllocator *) this, pSample);
+ PERFLOG_RELBUFFER( (IMemAllocator *) this, pSample );
#endif // DXMPERF
@@ -5214,8 +4805,7 @@ CBaseAllocator::ReleaseBuffer(IMediaSample * pSample)
/* Put back on the free list */
m_lFree.Add((CMediaSample *)pSample);
- if(m_lWaiting != 0)
- {
+ if (m_lWaiting != 0) {
NotifySample();
}
@@ -5223,16 +4813,14 @@ CBaseAllocator::ReleaseBuffer(IMediaSample * pSample)
// calling Free() when the last buffer is placed on the free list
LONG l1 = m_lFree.GetCount();
- if(m_bDecommitInProgress && (l1 == m_lAllocated))
- {
+ if (m_bDecommitInProgress && (l1 == m_lAllocated)) {
Free();
m_bDecommitInProgress = FALSE;
bRelease = TRUE;
}
}
- if(m_pNotify)
- {
+ if (m_pNotify) {
ASSERT(m_fEnableReleaseCallback);
@@ -5246,8 +4834,7 @@ CBaseAllocator::ReleaseBuffer(IMediaSample * pSample)
/* For each buffer there is one AddRef, made in GetBuffer and released
here. This may cause the allocator and all samples to be deleted */
- if(bRelease)
- {
+ if (bRelease) {
Release();
}
return NOERROR;
@@ -5256,16 +4843,14 @@ CBaseAllocator::ReleaseBuffer(IMediaSample * pSample)
STDMETHODIMP
CBaseAllocator::SetNotify(
IMemAllocatorNotifyCallbackTemp* pNotify
-)
+ )
{
ASSERT(m_fEnableReleaseCallback);
CAutoLock lck(this);
- if(pNotify)
- {
+ if (pNotify) {
pNotify->AddRef();
}
- if(m_pNotify)
- {
+ if (m_pNotify) {
m_pNotify->Release();
}
m_pNotify = pNotify;
@@ -5275,7 +4860,7 @@ CBaseAllocator::SetNotify(
STDMETHODIMP
CBaseAllocator::GetFreeCount(
__out LONG* plBuffersFree
-)
+ )
{
ASSERT(m_fEnableReleaseCallback);
CAutoLock cObjectLock(this);
@@ -5286,8 +4871,7 @@ CBaseAllocator::GetFreeCount(
void
CBaseAllocator::NotifySample()
{
- if(m_lWaiting != 0)
- {
+ if (m_lWaiting != 0) {
ASSERT(m_hSem != NULL);
ReleaseSemaphore(m_hSem, m_lWaiting, 0);
m_lWaiting = 0;
@@ -5301,8 +4885,7 @@ CBaseAllocator::Commit()
CAutoLock cObjectLock(this);
// cannot need to alloc or re-alloc if we are committed
- if(m_bCommitted)
- {
+ if (m_bCommitted) {
return NOERROR;
}
@@ -5311,8 +4894,7 @@ CBaseAllocator::Commit()
m_bCommitted = TRUE;
// is there a pending decommit ? if so, just cancel it
- if(m_bDecommitInProgress)
- {
+ if (m_bDecommitInProgress) {
m_bDecommitInProgress = FALSE;
// don't call Alloc at this point. He cannot allow SetProperties
@@ -5326,8 +4908,7 @@ CBaseAllocator::Commit()
// actually need to allocate the samples
HRESULT hr = Alloc();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
m_bCommitted = FALSE;
return hr;
}
@@ -5343,10 +4924,8 @@ CBaseAllocator::Decommit()
{
/* Check we are not already decommitted */
CAutoLock cObjectLock(this);
- if(m_bCommitted == FALSE)
- {
- if(m_bDecommitInProgress == FALSE)
- {
+ if (m_bCommitted == FALSE) {
+ if (m_bDecommitInProgress == FALSE) {
return NOERROR;
}
}
@@ -5355,13 +4934,10 @@ CBaseAllocator::Decommit()
m_bCommitted = FALSE;
// are any buffers outstanding?
- if(m_lFree.GetCount() < m_lAllocated)
- {
+ if (m_lFree.GetCount() < m_lAllocated) {
// please complete the decommit when last buffer is freed
m_bDecommitInProgress = TRUE;
- }
- else
- {
+ } else {
m_bDecommitInProgress = FALSE;
// need to complete the decommit here as there are no
@@ -5383,8 +4959,7 @@ CBaseAllocator::Decommit()
#pragma warning(pop)
}
- if(bRelease)
- {
+ if (bRelease) {
Release();
}
return NOERROR;
@@ -5398,8 +4973,7 @@ HRESULT
CBaseAllocator::Alloc(void)
{
/* Error if he hasn't set the size yet */
- if(m_lCount <= 0 || m_lSize <= 0 || m_lAlignment <= 0)
- {
+ if (m_lCount <= 0 || m_lSize <= 0 || m_lAlignment <= 0) {
return VFW_E_SIZENOTSET;
}
@@ -5407,8 +4981,7 @@ CBaseAllocator::Alloc(void)
ASSERT(m_lFree.GetCount() == m_lAllocated);
/* If the requirements haven't changed then don't reallocate */
- if(m_bChanged == FALSE)
- {
+ if (m_bChanged == FALSE) {
return S_FALSE;
}
@@ -5422,17 +4995,15 @@ void
CBaseAllocator::CSampleList::Remove(__inout CMediaSample * pSample)
{
CMediaSample **pSearch;
- for(pSearch = &m_List;
- *pSearch != NULL;
- pSearch = &(CBaseAllocator::NextSample(*pSearch)))
- {
- if(*pSearch == pSample)
- {
- *pSearch = CBaseAllocator::NextSample(pSample);
- CBaseAllocator::NextSample(pSample) = NULL;
- m_nOnList--;
- return;
- }
+ for (pSearch = &m_List;
+ *pSearch != NULL;
+ pSearch = &(CBaseAllocator::NextSample(*pSearch))) {
+ if (*pSearch == pSample) {
+ *pSearch = CBaseAllocator::NextSample(pSample);
+ CBaseAllocator::NextSample(pSample) = NULL;
+ m_nOnList--;
+ return;
+ }
}
DbgBreak("Couldn't find sample in list");
}
@@ -5456,7 +5027,7 @@ CMemAllocator::CMemAllocator(
__inout_opt LPUNKNOWN pUnk,
__inout HRESULT *phr)
: CBaseAllocator(pName, pUnk, phr, TRUE, TRUE),
- m_pBuffer(NULL)
+ m_pBuffer(NULL)
{
}
@@ -5466,7 +5037,7 @@ CMemAllocator::CMemAllocator(
__inout_opt LPUNKNOWN pUnk,
__inout HRESULT *phr)
: CBaseAllocator(pName, pUnk, phr, TRUE, TRUE),
- m_pBuffer(NULL)
+ m_pBuffer(NULL)
{
}
#endif
@@ -5477,11 +5048,11 @@ CMemAllocator::CMemAllocator(
to change the buffering, the memory will be released in Commit() */
STDMETHODIMP
CMemAllocator::SetProperties(
- __in ALLOCATOR_PROPERTIES* pRequest,
- __out ALLOCATOR_PROPERTIES* pActual)
+ __in ALLOCATOR_PROPERTIES* pRequest,
+ __out ALLOCATOR_PROPERTIES* pActual)
{
- CheckPointer(pActual, E_POINTER);
- ValidateReadWritePtr(pActual, sizeof(ALLOCATOR_PROPERTIES));
+ CheckPointer(pActual,E_POINTER);
+ ValidateReadWritePtr(pActual,sizeof(ALLOCATOR_PROPERTIES));
CAutoLock cObjectLock(this);
ZeroMemory(pActual, sizeof(ALLOCATOR_PROPERTIES));
@@ -5492,17 +5063,15 @@ CMemAllocator::SetProperties(
GetSystemInfo(&SysInfo);
/* Check the alignment request is a power of 2 */
- if((-pRequest->cbAlign & pRequest->cbAlign) != pRequest->cbAlign)
- {
+ if ((-pRequest->cbAlign & pRequest->cbAlign) != pRequest->cbAlign) {
DbgLog((LOG_ERROR, 1, TEXT("Alignment requested 0x%x not a power of 2!"),
- pRequest->cbAlign));
+ pRequest->cbAlign));
}
/* Check the alignment requested */
- if(pRequest->cbAlign == 0 ||
- (SysInfo.dwAllocationGranularity & (pRequest->cbAlign - 1)) != 0)
- {
+ if (pRequest->cbAlign == 0 ||
+ (SysInfo.dwAllocationGranularity & (pRequest->cbAlign - 1)) != 0) {
DbgLog((LOG_ERROR, 1, TEXT("Invalid alignment 0x%x requested - granularity = 0x%x"),
- pRequest->cbAlign, SysInfo.dwAllocationGranularity));
+ pRequest->cbAlign, SysInfo.dwAllocationGranularity));
return VFW_E_BADALIGN;
}
@@ -5512,15 +5081,13 @@ CMemAllocator::SetProperties(
person who is holding the samples. Therefore it is not unreasonable
for them to free all their samples before changing the requirements */
- if(m_bCommitted == TRUE)
- {
+ if (m_bCommitted == TRUE) {
return VFW_E_ALREADY_COMMITTED;
}
/* Must be no outstanding buffers */
- if(m_lFree.GetCount() < m_lAllocated)
- {
+ if (m_lFree.GetCount() < m_lAllocated) {
return VFW_E_BUFFERS_OUTSTANDING;
}
@@ -5531,8 +5098,7 @@ CMemAllocator::SetProperties(
// the alignment
LONG lSize = pRequest->cbBuffer + pRequest->cbPrefix;
LONG lRemainder = lSize % pRequest->cbAlign;
- if(lRemainder != 0)
- {
+ if (lRemainder != 0) {
lSize = lSize - lRemainder + pRequest->cbAlign;
}
pActual->cbBuffer = m_lSize = (lSize - pRequest->cbPrefix);
@@ -5559,28 +5125,24 @@ CMemAllocator::Alloc(void)
/* Check he has called SetProperties */
HRESULT hr = CBaseAllocator::Alloc();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
/* If the requirements haven't changed then don't reallocate */
- if(hr == S_FALSE)
- {
+ if (hr == S_FALSE) {
ASSERT(m_pBuffer);
return NOERROR;
}
ASSERT(hr == S_OK); // we use this fact in the loop below
/* Free the old resources */
- if(m_pBuffer)
- {
+ if (m_pBuffer) {
ReallyFree();
}
/* Make sure we've got reasonable values */
- if(m_lSize < 0 || m_lPrefix < 0 || m_lCount < 0)
- {
+ if ( m_lSize < 0 || m_lPrefix < 0 || m_lCount < 0 ) {
return E_OUTOFMEMORY;
}
@@ -5588,19 +5150,15 @@ CMemAllocator::Alloc(void)
LONG lAlignedSize = m_lSize + m_lPrefix;
/* Check overflow */
- if(lAlignedSize < m_lSize)
- {
+ if (lAlignedSize < m_lSize) {
return E_OUTOFMEMORY;
}
- if(m_lAlignment > 1)
- {
+ if (m_lAlignment > 1) {
LONG lRemainder = lAlignedSize % m_lAlignment;
- if(lRemainder != 0)
- {
+ if (lRemainder != 0) {
LONG lNewSize = lAlignedSize + m_lAlignment - lRemainder;
- if(lNewSize < lAlignedSize)
- {
+ if (lNewSize < lAlignedSize) {
return E_OUTOFMEMORY;
}
lAlignedSize = lNewSize;
@@ -5615,18 +5173,16 @@ CMemAllocator::Alloc(void)
LONGLONG lToAllocate = m_lCount * (LONGLONG)lAlignedSize;
/* Check overflow */
- if(lToAllocate > MAXLONG)
- {
+ if (lToAllocate > MAXLONG) {
return E_OUTOFMEMORY;
}
m_pBuffer = (PBYTE)VirtualAlloc(NULL,
- (LONG)lToAllocate,
- MEM_COMMIT,
- PAGE_READWRITE);
+ (LONG)lToAllocate,
+ MEM_COMMIT,
+ PAGE_READWRITE);
- if(m_pBuffer == NULL)
- {
+ if (m_pBuffer == NULL) {
return E_OUTOFMEMORY;
}
@@ -5639,20 +5195,18 @@ CMemAllocator::Alloc(void)
// plus m_lPrefix bytes per sample as a prefix. We set the pointer to
// the memory after the prefix - so that GetPointer() will return a pointer
// to m_lSize bytes.
- for(; m_lAllocated < m_lCount; m_lAllocated++, pNext += lAlignedSize)
- {
+ for (; m_lAllocated < m_lCount; m_lAllocated++, pNext += lAlignedSize) {
pSample = new CMediaSample(
- NAME("Default memory media sample"),
- this,
- &hr,
- pNext + m_lPrefix, // GetPointer() value
- m_lSize); // not including prefix
-
- ASSERT(SUCCEEDED(hr));
- if(pSample == NULL)
- {
+ NAME("Default memory media sample"),
+ this,
+ &hr,
+ pNext + m_lPrefix, // GetPointer() value
+ m_lSize); // not including prefix
+
+ ASSERT(SUCCEEDED(hr));
+ if (pSample == NULL) {
return E_OUTOFMEMORY;
}
@@ -5693,15 +5247,11 @@ CMemAllocator::ReallyFree(void)
/* Free up all the CMediaSamples */
CMediaSample *pSample;
- for(;;)
- {
+ for (;;) {
pSample = m_lFree.RemoveHead();
- if(pSample != NULL)
- {
+ if (pSample != NULL) {
delete pSample;
- }
- else
- {
+ } else {
break;
}
}
@@ -5709,8 +5259,7 @@ CMemAllocator::ReallyFree(void)
m_lAllocated = 0;
// free the block of buffer memory
- if(m_pBuffer)
- {
+ if (m_pBuffer) {
EXECUTE_ASSERT(VirtualFree(m_pBuffer, 0, MEM_RELEASE));
m_pBuffer = NULL;
}
@@ -5730,78 +5279,78 @@ CMemAllocator::~CMemAllocator()
// not found (Quartz 1.0 install)
STDAPI
-AMovieSetupRegisterFilter(const AMOVIESETUP_FILTER * const psetupdata
- , IFilterMapper * pIFM
- , BOOL bRegister)
+AMovieSetupRegisterFilter( const AMOVIESETUP_FILTER * const psetupdata
+ , IFilterMapper * pIFM
+ , BOOL bRegister )
{
- DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter")));
+ DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter")));
- // check we've got data
- //
- if(NULL == psetupdata) return S_FALSE;
+ // check we've got data
+ //
+ if( NULL == psetupdata ) return S_FALSE;
- // unregister filter
- // (as pins are subkeys of filter's CLSID key
- // they do not need to be removed separately).
- //
- DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter")));
- HRESULT hr = pIFM->UnregisterFilter(*(psetupdata->clsID));
+ // unregister filter
+ // (as pins are subkeys of filter's CLSID key
+ // they do not need to be removed separately).
+ //
+ DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter")));
+ HRESULT hr = pIFM->UnregisterFilter( *(psetupdata->clsID) );
- if(bRegister)
- {
- // register filter
- //
- DbgLog((LOG_TRACE, 3, TEXT("= = register filter")));
- hr = pIFM->RegisterFilter(*(psetupdata->clsID)
- , psetupdata->strName
- , psetupdata->dwMerit);
- if(SUCCEEDED(hr))
+ if( bRegister )
+ {
+ // register filter
+ //
+ DbgLog((LOG_TRACE, 3, TEXT("= = register filter")));
+ hr = pIFM->RegisterFilter( *(psetupdata->clsID)
+ , psetupdata->strName
+ , psetupdata->dwMerit );
+ if( SUCCEEDED(hr) )
+ {
+ // all its pins
+ //
+ DbgLog((LOG_TRACE, 3, TEXT("= = register filter pins")));
+ for( UINT m1=0; m1 < psetupdata->nPins; m1++ )
+ {
+ hr = pIFM->RegisterPin( *(psetupdata->clsID)
+ , psetupdata->lpPin[m1].strName
+ , psetupdata->lpPin[m1].bRendered
+ , psetupdata->lpPin[m1].bOutput
+ , psetupdata->lpPin[m1].bZero
+ , psetupdata->lpPin[m1].bMany
+ , *(psetupdata->lpPin[m1].clsConnectsToFilter)
+ , psetupdata->lpPin[m1].strConnectsToPin );
+
+ if( SUCCEEDED(hr) )
{
- // all its pins
- //
- DbgLog((LOG_TRACE, 3, TEXT("= = register filter pins")));
- for(UINT m1 = 0; m1 < psetupdata->nPins; m1++)
- {
- hr = pIFM->RegisterPin(*(psetupdata->clsID)
- , psetupdata->lpPin[m1].strName
- , psetupdata->lpPin[m1].bRendered
- , psetupdata->lpPin[m1].bOutput
- , psetupdata->lpPin[m1].bZero
- , psetupdata->lpPin[m1].bMany
- , *(psetupdata->lpPin[m1].clsConnectsToFilter)
- , psetupdata->lpPin[m1].strConnectsToPin);
-
- if(SUCCEEDED(hr))
- {
- // and each pin's media types
- //
- DbgLog((LOG_TRACE, 3, TEXT("= = register filter pin types")));
- for(UINT m2 = 0; m2 < psetupdata->lpPin[m1].nMediaTypes; m2++)
- {
- hr = pIFM->RegisterPinType(*(psetupdata->clsID)
- , psetupdata->lpPin[m1].strName
- , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMajorType)
- , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMinorType));
- if(FAILED(hr)) break;
- }
- if(FAILED(hr)) break;
- }
- if(FAILED(hr)) break;
- }
+ // and each pin's media types
+ //
+ DbgLog((LOG_TRACE, 3, TEXT("= = register filter pin types")));
+ for( UINT m2=0; m2 < psetupdata->lpPin[m1].nMediaTypes; m2++ )
+ {
+ hr = pIFM->RegisterPinType( *(psetupdata->clsID)
+ , psetupdata->lpPin[m1].strName
+ , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMajorType)
+ , *(psetupdata->lpPin[m1].lpMediaType[m2].clsMinorType) );
+ if( FAILED(hr) ) break;
+ }
+ if( FAILED(hr) ) break;
}
+ if( FAILED(hr) ) break;
+ }
}
+ }
- // handle one acceptable "error" - that
- // of filter not being registered!
- // (couldn't find a suitable #define'd
- // name for the error!)
- //
- if(0x80070002 == hr)
- return NOERROR;
- else
- return hr;
+ // handle one acceptable "error" - that
+ // of filter not being registered!
+ // (couldn't find a suitable #define'd
+ // name for the error!)
+ //
+ if( 0x80070002 == hr)
+ return NOERROR;
+ else
+ return hr;
}
// Remove warnings about unreferenced inline functions
diff --git a/src/filters/BaseClasses/amfilter.h b/src/filters/BaseClasses/amfilter.h
index 4005f1698..82e0268f4 100644
--- a/src/filters/BaseClasses/amfilter.h
+++ b/src/filters/BaseClasses/amfilter.h
@@ -54,7 +54,7 @@ class CMemAllocator; // Implements memory buffer allocation
//=====================================================================
class AM_NOVTABLE CBaseMediaFilter : public CUnknown,
- public IMediaFilter
+ public IMediaFilter
{
protected:
@@ -67,7 +67,7 @@ protected:
CRefTime m_tStart;
CLSID m_clsid; // This filters clsid
- // used for serialization
+ // used for serialization
CCritSec *m_pLock; // Object we use for locking
public:
@@ -76,7 +76,7 @@ public:
__in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
__in CCritSec *pLock,
- REFCLSID clsid);
+ REFCLSID clsid);
virtual ~CBaseMediaFilter();
@@ -120,8 +120,7 @@ public:
virtual HRESULT StreamTime(CRefTime& rtStream);
// Is the filter currently active? (running or paused)
- BOOL IsActive()
- {
+ BOOL IsActive() {
CAutoLock cObjectLock(m_pLock);
return ((m_State == State_Paused) || (m_State == State_Running));
};
@@ -147,18 +146,18 @@ public:
class AM_NOVTABLE CBaseFilter : public CUnknown, // Handles an IUnknown
- public IBaseFilter, // The Filter Interface
- public IAMovieSetup // For un/registration
+ public IBaseFilter, // The Filter Interface
+ public IAMovieSetup // For un/registration
{
- friend class CBasePin;
+friend class CBasePin;
protected:
FILTER_STATE m_State; // current state: running, paused
IReferenceClock *m_pClock; // this graph's ref clock
CRefTime m_tStart; // offset from stream time to reference time
CLSID m_clsid; // This filters clsid
- // used for serialization
+ // used for serialization
CCritSec *m_pLock; // Object we use for locking
WCHAR *m_pName; // Full filter name
@@ -172,26 +171,26 @@ public:
__in_opt LPCTSTR pName, // Object description
__inout_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
- REFCLSID clsid); // The clsid to be used to serialize this filter
+ REFCLSID clsid); // The clsid to be used to serialize this filter
CBaseFilter(
__in_opt LPCTSTR pName, // Object description
__in_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
- REFCLSID clsid, // The clsid to be used to serialize this filter
+ REFCLSID clsid, // The clsid to be used to serialize this filter
__inout HRESULT *phr); // General OLE return code
#ifdef UNICODE
CBaseFilter(
__in_opt LPCSTR pName, // Object description
__in_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
- REFCLSID clsid); // The clsid to be used to serialize this filter
+ REFCLSID clsid); // The clsid to be used to serialize this filter
CBaseFilter(
__in_opt LPCSTR pName, // Object description
__in_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
- REFCLSID clsid, // The clsid to be used to serialize this filter
+ REFCLSID clsid, // The clsid to be used to serialize this filter
__inout HRESULT *phr); // General OLE return code
#endif
~CBaseFilter();
@@ -238,15 +237,13 @@ public:
virtual HRESULT StreamTime(CRefTime& rtStream);
// Is the filter currently active?
- BOOL IsActive()
- {
+ BOOL IsActive() {
CAutoLock cObjectLock(m_pLock);
return ((m_State == State_Paused) || (m_State == State_Running));
};
// Is this filter stopped (without locking)
- BOOL IsStopped()
- {
+ BOOL IsStopped() {
return (m_State == State_Stopped);
};
@@ -256,7 +253,7 @@ public:
// pin enumerator
STDMETHODIMP EnumPins(
- __deref_out IEnumPins ** ppEnum);
+ __deref_out IEnumPins ** ppEnum);
// default behaviour of FindPin assumes pin ids are their names
@@ -266,18 +263,18 @@ public:
);
STDMETHODIMP QueryFilterInfo(
- __out FILTER_INFO * pInfo);
+ __out FILTER_INFO * pInfo);
STDMETHODIMP JoinFilterGraph(
- __inout_opt IFilterGraph * pGraph,
- __in_opt LPCWSTR pName);
+ __inout_opt IFilterGraph * pGraph,
+ __in_opt LPCWSTR pName);
// return a Vendor information string. Optional - may return E_NOTIMPL.
// memory returned should be freed using CoTaskMemFree
// default implementation returns E_NOTIMPL
STDMETHODIMP QueryVendorInfo(
- __deref_out LPWSTR* pVendorInfo
- );
+ __deref_out LPWSTR* pVendorInfo
+ );
// --- helper methods ---
@@ -290,8 +287,7 @@ public:
LONG_PTR EventParam2);
// return the filter graph we belong to
- __out_opt IFilterGraph *GetFilterGraph()
- {
+ __out_opt IFilterGraph *GetFilterGraph() {
return m_pGraph;
}
@@ -318,10 +314,7 @@ public:
// --- setup helper methods ---
// (override to return filters setup data)
- virtual __out_opt LPAMOVIESETUP_FILTER GetSetupData()
- {
- return NULL;
- }
+ virtual __out_opt LPAMOVIESETUP_FILTER GetSetupData(){ return NULL; }
};
@@ -346,7 +339,7 @@ protected:
bool m_bRunTimeError; // Run time error generated
bool m_bCanReconnectWhenActive; // OK to reconnect when active
bool m_bTryMyTypesFirst; // When connecting enumerate
- // this pin's types first
+ // this pin's types first
CBaseFilter *m_pFilter; // Filter we were created by
IQualityControl *m_pQSink; // Target for Quality messages
LONG m_TypeVersion; // Holds current type version
@@ -383,17 +376,17 @@ protected:
// try all the media types in this enumerator - for each that
// we accept, try to connect using ReceiveConnection.
HRESULT TryMediaTypes(
- IPin *pReceivePin, // connect to this pin
- __in_opt const CMediaType *pmt, // proposed type from Connect
- IEnumMediaTypes *pEnum); // try this enumerator
+ IPin *pReceivePin, // connect to this pin
+ __in_opt const CMediaType *pmt, // proposed type from Connect
+ IEnumMediaTypes *pEnum); // try this enumerator
// establish a connection with a suitable mediatype. Needs to
// propose a media type if the pmt pointer is null or partially
// specified - use TryMediaTypes on both our and then the other pin's
// enumerator until we find one that works.
HRESULT AgreeMediaType(
- IPin *pReceivePin, // connect to this pin
- const CMediaType *pmt); // proposed type from Connect
+ IPin *pReceivePin, // connect to this pin
+ const CMediaType *pmt); // proposed type from Connect
public:
@@ -448,7 +441,7 @@ public:
);
STDMETHODIMP QueryDirection(
- __out PIN_DIRECTION * pPinDir
+ __out PIN_DIRECTION * pPinDir
);
STDMETHODIMP QueryId(
@@ -473,13 +466,10 @@ public:
// all visible output pins and vice versa.
// apPin can be NULL if nPin==0 (not otherwise).
STDMETHODIMP QueryInternalConnections(
- __out_ecount_part(*nPin, *nPin) IPin* *apPin, // array of IPin*
+ __out_ecount_part(*nPin,*nPin) IPin* *apPin, // array of IPin*
__inout ULONG *nPin // on input, the number of slots
- // on output the number of pins
- )
- {
- return E_NOTIMPL;
- }
+ // on output the number of pins
+ ) { return E_NOTIMPL; }
// Called when no more data will be sent
STDMETHODIMP EndOfStream(void);
@@ -491,9 +481,9 @@ public:
// returns S_OK.
// Override this to pass downstream.
STDMETHODIMP NewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate);
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop,
+ double dRate);
//================================================================================
// IQualityControl methods
@@ -506,19 +496,12 @@ public:
// --- helper methods ---
// Returns true if the pin is connected. false otherwise.
- BOOL IsConnected(void)
- {
- return (m_Connected != NULL);
- };
+ BOOL IsConnected(void) {return (m_Connected != NULL); };
// Return the pin this is connected to (if any)
- IPin * GetConnected()
- {
- return m_Connected;
- };
+ IPin * GetConnected() { return m_Connected; };
// Check if our filter is currently stopped
- BOOL IsStopped()
- {
+ BOOL IsStopped() {
return (m_pFilter->m_State == State_Stopped);
};
@@ -554,24 +537,18 @@ public:
virtual HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType);
// access to NewSegment values
- REFERENCE_TIME CurrentStopTime()
- {
+ REFERENCE_TIME CurrentStopTime() {
return m_tStop;
}
- REFERENCE_TIME CurrentStartTime()
- {
+ REFERENCE_TIME CurrentStartTime() {
return m_tStart;
}
- double CurrentRate()
- {
+ double CurrentRate() {
return m_dRate;
}
// Access name
- LPWSTR Name()
- {
- return m_pName;
- };
+ LPWSTR Name() { return m_pName; };
// Can reconnectwhen active?
void SetReconnectWhenActive(bool bCanReconnect)
@@ -613,8 +590,8 @@ class CEnumPins : public IEnumPins // The interface we support
typedef CGenericList<CBasePin> CPinList;
CPinList m_PinCache; // These pointers have not been AddRef'ed and
- // so they should not be dereferenced. They are
- // merely kept to ID which pins have been enumerated.
+ // so they should not be dereferenced. They are
+ // merely kept to ID which pins have been enumerated.
#ifdef _DEBUG
DWORD m_dwCookie;
@@ -627,8 +604,7 @@ class CEnumPins : public IEnumPins // The interface we support
filter what it's current version number is. If the filter has not
overriden the GetPinVersion method then this will always match */
- BOOL AreWeOutOfSync()
- {
+ BOOL AreWeOutOfSync() {
return (m_pFilter->GetPinVersion() == m_Version ? FALSE : TRUE);
};
@@ -689,8 +665,7 @@ class CEnumMediaTypes : public IEnumMediaTypes // The interface we support
Reset method is called after the state changes all further calls to
the enumerator (except Reset) will return E_UNEXPECTED error code */
- BOOL AreWeOutOfSync()
- {
+ BOOL AreWeOutOfSync() {
return (m_pPin->GetMediaTypeVersion() == m_Version ? FALSE : TRUE);
};
@@ -741,7 +716,7 @@ protected:
IMemAllocator *m_pAllocator;
IMemInputPin *m_pInputPin; // interface on the downstreaminput pin
- // set up in CheckConnect when we connect.
+ // set up in CheckConnect when we connect.
public:
@@ -816,9 +791,9 @@ public:
// deliver NewSegment to connected pin - you will need to
// override this if you queue any data in your output pin.
virtual HRESULT DeliverNewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate);
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop,
+ double dRate);
//================================================================================
// IQualityControl methods
@@ -842,7 +817,7 @@ public:
//=====================================================================
class AM_NOVTABLE CBaseInputPin : public CBasePin,
- public IMemInputPin
+ public IMemInputPin
{
protected:
@@ -891,14 +866,14 @@ public:
// tell the input pin which allocator the output pin is actually
// going to use.
STDMETHODIMP NotifyAllocator(
- IMemAllocator * pAllocator,
- BOOL bReadOnly);
+ IMemAllocator * pAllocator,
+ BOOL bReadOnly);
// do something with this media sample
STDMETHODIMP Receive(IMediaSample *pSample);
// do something with these media samples
- STDMETHODIMP ReceiveMultiple(
+ STDMETHODIMP ReceiveMultiple (
__in_ecount(nSamples) IMediaSample **pSamples,
long nSamples,
__out long *nSamplesProcessed);
@@ -929,14 +904,12 @@ public:
HRESULT BreakConnect();
// helper method to check the read-only flag
- BOOL IsReadOnly()
- {
+ BOOL IsReadOnly() {
return m_bReadOnly;
};
// helper method to see if we are flushing
- BOOL IsFlushing()
- {
+ BOOL IsFlushing() {
return m_bFlushing;
};
@@ -962,8 +935,7 @@ public:
virtual HRESULT Inactive(void);
// Return sample properties pointer
- AM_SAMPLE2_PROPERTIES * SampleProps()
- {
+ AM_SAMPLE2_PROPERTIES * SampleProps() {
ASSERT(m_SampleProps.cbData != 0);
return &m_SampleProps;
}
@@ -975,7 +947,7 @@ public:
//
class CDynamicOutputPin : public CBaseOutputPin,
- public IPinFlowControl
+ public IPinFlowControl
{
public:
#ifdef UNICODE
@@ -1009,11 +981,11 @@ public:
// Set graph config info
void SetConfigInfo(IGraphConfig *pGraphConfig, HANDLE hStopEvent);
-#ifdef _DEBUG
+ #ifdef _DEBUG
virtual HRESULT Deliver(IMediaSample *pSample);
virtual HRESULT DeliverEndOfStream(void);
virtual HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
-#endif // DEBUG
+ #endif // DEBUG
HRESULT DeliverBeginFlush(void);
HRESULT DeliverEndFlush(void);
@@ -1027,12 +999,12 @@ public:
virtual bool StreamingThreadUsingOutputPin(void);
HRESULT ChangeOutputFormat
- (
+ (
const AM_MEDIA_TYPE *pmt,
REFERENCE_TIME tSegmentStart,
REFERENCE_TIME tSegmentStop,
double dSegmentRate
- );
+ );
HRESULT ChangeMediaType(const CMediaType *pmt);
HRESULT DynamicReconnect(const CMediaType *pmt);
@@ -1103,33 +1075,33 @@ private:
HRESULT Initialize(void);
HRESULT ChangeMediaTypeHelper(const CMediaType *pmt);
-#ifdef _DEBUG
+ #ifdef _DEBUG
void AssertValid(void);
-#endif // DEBUG
+ #endif // DEBUG
};
class CAutoUsingOutputPin
{
public:
- CAutoUsingOutputPin(__in CDynamicOutputPin* pOutputPin, __inout HRESULT* phr);
+ CAutoUsingOutputPin( __in CDynamicOutputPin* pOutputPin, __inout HRESULT* phr );
~CAutoUsingOutputPin();
private:
CDynamicOutputPin* m_pOutputPin;
};
-inline CAutoUsingOutputPin::CAutoUsingOutputPin(__in CDynamicOutputPin* pOutputPin, __inout HRESULT* phr) :
+inline CAutoUsingOutputPin::CAutoUsingOutputPin( __in CDynamicOutputPin* pOutputPin, __inout HRESULT* phr ) :
m_pOutputPin(NULL)
{
// The caller should always pass in valid pointers.
- ASSERT(NULL != pOutputPin);
- ASSERT(NULL != phr);
+ ASSERT( NULL != pOutputPin );
+ ASSERT( NULL != phr );
// Make sure the user initialized phr.
- ASSERT(S_OK == *phr);
+ ASSERT( S_OK == *phr );
HRESULT hr = pOutputPin->StartUsingOutputPin();
- if(FAILED(hr))
+ if( FAILED( hr ) )
{
*phr = hr;
return;
@@ -1140,7 +1112,7 @@ inline CAutoUsingOutputPin::CAutoUsingOutputPin(__in CDynamicOutputPin* pOutputP
inline CAutoUsingOutputPin::~CAutoUsingOutputPin()
{
- if(NULL != m_pOutputPin)
+ if( NULL != m_pOutputPin )
{
m_pOutputPin->StopUsingOutputPin();
}
@@ -1161,7 +1133,7 @@ inline HRESULT CDynamicOutputPin::DeliverEndOfStream(void)
{
// The caller should call StartUsingOutputPin() before calling this
// method.
- ASSERT(StreamingThreadUsingOutputPin());
+ ASSERT( StreamingThreadUsingOutputPin() );
return CBaseOutputPin::DeliverEndOfStream();
}
@@ -1237,9 +1209,9 @@ protected:
we do no internal processing on it we leave it as a pointer */
DWORD m_dwFlags; /* Flags for this sample */
- /* Type specific flags are packed
- into the top word
- */
+ /* Type specific flags are packed
+ into the top word
+ */
DWORD m_dwTypeSpecificFlags; /* Media type specific flags */
__field_ecount_opt(m_cbBuffer) LPBYTE m_pBuffer; /* Pointer to the complete buffer */
LONG m_lActual; /* Length of data in this sample */
@@ -1326,14 +1298,14 @@ public:
// get the media times for this sample
STDMETHODIMP GetMediaTime(
- __out LONGLONG * pTimeStart,
- __out LONGLONG * pTimeEnd
+ __out LONGLONG * pTimeStart,
+ __out LONGLONG * pTimeEnd
);
// Set the media times for this sample
STDMETHODIMP SetMediaTime(
- __in_opt LONGLONG * pTimeStart,
- __in_opt LONGLONG * pTimeEnd
+ __in_opt LONGLONG * pTimeStart,
+ __in_opt LONGLONG * pTimeEnd
);
// Set and get properties (IMediaSample2)
@@ -1365,8 +1337,8 @@ public:
//=====================================================================
class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown
- public IMemAllocatorCallbackTemp, // The interface we support
- public CCritSec // Provides object locking
+ public IMemAllocatorCallbackTemp, // The interface we support
+ public CCritSec // Provides object locking
{
class CSampleList;
friend class CSampleList;
@@ -1388,18 +1360,9 @@ class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown
ASSERT(m_nOnList == 0);
};
#endif
- CMediaSample *Head() const
- {
- return m_List;
- };
- CMediaSample *Next(__in CMediaSample *pSample) const
- {
- return CBaseAllocator::NextSample(pSample);
- };
- int GetCount() const
- {
- return m_nOnList;
- };
+ CMediaSample *Head() const { return m_List; };
+ CMediaSample *Next(__in CMediaSample *pSample) const { return CBaseAllocator::NextSample(pSample); };
+ int GetCount() const { return m_nOnList; };
void Add(__inout CMediaSample *pSample)
{
ASSERT(pSample != NULL);
@@ -1410,8 +1373,7 @@ class AM_NOVTABLE CBaseAllocator : public CUnknown,// A non delegating IUnknown
CMediaSample *RemoveHead()
{
CMediaSample *pSample = m_List;
- if(pSample != NULL)
- {
+ if (pSample != NULL) {
m_List = CBaseAllocator::NextSample(m_List);
m_nOnList--;
}
@@ -1508,12 +1470,12 @@ public:
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP SetProperties(
- __in ALLOCATOR_PROPERTIES* pRequest,
- __out ALLOCATOR_PROPERTIES* pActual);
+ __in ALLOCATOR_PROPERTIES* pRequest,
+ __out ALLOCATOR_PROPERTIES* pActual);
// return the properties actually being used on this allocator
STDMETHODIMP GetProperties(
- __out ALLOCATOR_PROPERTIES* pProps);
+ __out ALLOCATOR_PROPERTIES* pProps);
// override Commit to allocate memory. We handle the GetBuffer
//state changes
@@ -1549,10 +1511,7 @@ public:
void NotifySample();
// Notify that we're waiting for a sample
- void SetWaiting()
- {
- m_lWaiting++;
- };
+ void SetWaiting() { m_lWaiting++; };
};
@@ -1598,8 +1557,8 @@ public:
static CUnknown *CreateInstance(__inout_opt LPUNKNOWN, __inout HRESULT *);
STDMETHODIMP SetProperties(
- __in ALLOCATOR_PROPERTIES* pRequest,
- __out ALLOCATOR_PROPERTIES* pActual);
+ __in ALLOCATOR_PROPERTIES* pRequest,
+ __out ALLOCATOR_PROPERTIES* pActual);
CMemAllocator(__in_opt LPCTSTR , __inout_opt LPUNKNOWN, __inout HRESULT *);
#ifdef UNICODE
@@ -1610,9 +1569,9 @@ public:
// helper used by IAMovieSetup implementation
STDAPI
-AMovieSetupRegisterFilter(const AMOVIESETUP_FILTER * const psetupdata
- , IFilterMapper * pIFM
- , BOOL bRegister);
+AMovieSetupRegisterFilter( const AMOVIESETUP_FILTER * const psetupdata
+ , IFilterMapper * pIFM
+ , BOOL bRegister );
///////////////////////////////////////////////////////////////////////////
diff --git a/src/filters/BaseClasses/amvideo.cpp b/src/filters/BaseClasses/amvideo.cpp
index 75c3d8e83..42fe446de 100644
--- a/src/filters/BaseClasses/amvideo.cpp
+++ b/src/filters/BaseClasses/amvideo.cpp
@@ -13,30 +13,29 @@
// These are bit field masks for true colour devices
-const DWORD bits555[] = {0x007C00, 0x0003E0, 0x00001F};
-const DWORD bits565[] = {0x00F800, 0x0007E0, 0x00001F};
-const DWORD bits888[] = {0xFF0000, 0x00FF00, 0x0000FF};
+const DWORD bits555[] = {0x007C00,0x0003E0,0x00001F};
+const DWORD bits565[] = {0x00F800,0x0007E0,0x00001F};
+const DWORD bits888[] = {0xFF0000,0x00FF00,0x0000FF};
// This maps bitmap subtypes into a bits per pixel value and also a
// name. unicode and ansi versions are stored because we have to
// return a pointer to a static string.
-const struct
-{
+const struct {
const GUID *pSubtype;
WORD BitCount;
CHAR *pName;
WCHAR *wszName;
-} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome",
- &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA",
- &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8",
- &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)",
- &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)",
- &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24",
+} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome",
+ &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA",
+ &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8",
+ &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)",
+ &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)",
+ &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24",
&MEDIASUBTYPE_RGB32, 32, "RGB 32", L"RGB 32",
&MEDIASUBTYPE_ARGB32, 32, "ARGB 32", L"ARGB 32",
- &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay",
- &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN"
- };
+ &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay",
+ &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN"
+};
// Return the size of the bitmap as defined by this header
@@ -56,20 +55,16 @@ STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader)
// If its BI_RGB then it's RGB 555 by default
- if(pbmiHeader->biCompression == BI_RGB)
- {
+ if (pbmiHeader->biCompression == BI_RGB) {
return MEDIASUBTYPE_RGB555;
}
// Compare the bit fields with RGB 555
DWORD *pMask = (DWORD *) pbmInfo->bmiColors;
- if(pMask[0] == bits555[0])
- {
- if(pMask[1] == bits555[1])
- {
- if(pMask[2] == bits555[2])
- {
+ if (pMask[0] == bits555[0]) {
+ if (pMask[1] == bits555[1]) {
+ if (pMask[2] == bits555[2]) {
return MEDIASUBTYPE_RGB555;
}
}
@@ -78,12 +73,9 @@ STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader)
// Compare the bit fields with RGB 565
pMask = (DWORD *) pbmInfo->bmiColors;
- if(pMask[0] == bits565[0])
- {
- if(pMask[1] == bits565[1])
- {
- if(pMask[2] == bits565[2])
- {
+ if (pMask[0] == bits565[0]) {
+ if (pMask[1] == bits565[1]) {
+ if (pMask[2] == bits565[2]) {
return MEDIASUBTYPE_RGB565;
}
}
@@ -104,10 +96,8 @@ STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader)
// If it's not RGB then create a GUID from the compression type
- if(pbmiHeader->biCompression != BI_RGB)
- {
- if(pbmiHeader->biCompression != BI_BITFIELDS)
- {
+ if (pbmiHeader->biCompression != BI_RGB) {
+ if (pbmiHeader->biCompression != BI_BITFIELDS) {
FOURCCMap FourCCMap(pbmiHeader->biCompression);
return (const GUID) FourCCMap;
}
@@ -115,20 +105,13 @@ STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader)
// Map the RGB DIB bit depth to a image GUID
- switch(pbmiHeader->biBitCount)
- {
- case 1 :
- return MEDIASUBTYPE_RGB1;
- case 4 :
- return MEDIASUBTYPE_RGB4;
- case 8 :
- return MEDIASUBTYPE_RGB8;
- case 16 :
- return GetTrueColorType(pbmiHeader);
- case 24 :
- return MEDIASUBTYPE_RGB24;
- case 32 :
- return MEDIASUBTYPE_RGB32;
+ switch(pbmiHeader->biBitCount) {
+ case 1 : return MEDIASUBTYPE_RGB1;
+ case 4 : return MEDIASUBTYPE_RGB4;
+ case 8 : return MEDIASUBTYPE_RGB8;
+ case 16 : return GetTrueColorType(pbmiHeader);
+ case 24 : return MEDIASUBTYPE_RGB24;
+ case 32 : return MEDIASUBTYPE_RGB32;
}
return GUID_NULL;
}
@@ -147,15 +130,12 @@ STDAPI_(WORD) GetBitCount(const GUID *pSubtype)
// Scan the mapping list seeing if the source GUID matches any known
// bitmap subtypes, the list is terminated by a GUID_NULL entry
- while(TRUE)
- {
+ while (TRUE) {
pMediaSubtype = BitCountMap[iPosition].pSubtype;
- if(IsEqualGUID(*pMediaSubtype, GUID_NULL))
- {
+ if (IsEqualGUID(*pMediaSubtype,GUID_NULL)) {
return USHRT_MAX;
}
- if(IsEqualGUID(*pMediaSubtype, *pSubtype))
- {
+ if (IsEqualGUID(*pMediaSubtype,*pSubtype)) {
return BitCountMap[iPosition].BitCount;
}
iPosition++;
@@ -176,16 +156,15 @@ int LocateSubtype(const GUID *pSubtype)
// Scan the mapping list seeing if the source GUID matches any known
// bitmap subtypes, the list is terminated by a GUID_NULL entry
- while(TRUE)
- {
+ while (TRUE) {
pMediaSubtype = BitCountMap[iPosition].pSubtype;
- if(IsEqualGUID(*pMediaSubtype, *pSubtype) ||
- IsEqualGUID(*pMediaSubtype, GUID_NULL)
- )
+ if (IsEqualGUID(*pMediaSubtype,*pSubtype) ||
+ IsEqualGUID(*pMediaSubtype,GUID_NULL)
+ )
{
break;
}
-
+
iPosition++;
}
@@ -233,11 +212,11 @@ STDAPI_(CHAR *) GetSubtypeName(const GUID *pSubtype)
STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader)
{
- // Everyone has this to start with this
+ // Everyone has this to start with this
LONG Size = SIZE_PREHEADER + pHeader->biSize;
ASSERT(pHeader->biSize >= sizeof(BITMAPINFOHEADER));
-
+
// Does this format use a palette, if the number of colours actually used
// is zero then it is set to the maximum that are allowed for that colour
// depth (an example is 256 for eight bits). Truecolour formats may also
@@ -246,11 +225,9 @@ STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader)
// This would scare me.
ASSERT(pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed == 0);
- if(pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed)
- {
+ if (pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed) {
LONG Entries = (DWORD) 1 << pHeader->biBitCount;
- if(pHeader->biClrUsed)
- {
+ if (pHeader->biClrUsed) {
Entries = pHeader->biClrUsed;
}
Size += Entries * sizeof(RGBQUAD);
@@ -260,8 +237,7 @@ STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader)
// type which means that room for three DWORDs should be allocated that
// specify where in each pixel the RGB colour components may be found
- if(pHeader->biCompression == BI_BITFIELDS)
- {
+ if (pHeader->biCompression == BI_BITFIELDS) {
Size += SIZE_MASKS;
}
@@ -279,10 +255,8 @@ STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader)
STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo)
{
- if(PALETTISED(pVideoInfo) == FALSE)
- {
- if(pVideoInfo->bmiHeader.biClrUsed == 0)
- {
+ if (PALETTISED(pVideoInfo) == FALSE) {
+ if (pVideoInfo->bmiHeader.biClrUsed == 0) {
return FALSE;
}
}
@@ -294,8 +268,7 @@ STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo)
STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo)
{
- if(pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS)
- {
+ if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) {
return TRUECOLOR(pVideoInfo)->bmiColors;
}
return COLORS(pVideoInfo);
diff --git a/src/filters/BaseClasses/arithutil.cpp b/src/filters/BaseClasses/arithutil.cpp
index c1592e566..cd0d1271f 100644
--- a/src/filters/BaseClasses/arithutil.cpp
+++ b/src/filters/BaseClasses/arithutil.cpp
@@ -24,40 +24,39 @@
__inline
ULONG
WINAPI
-EnlargedUnsignedDivide(
+EnlargedUnsignedDivide (
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN PULONG Remainder
-)
+ )
{
- // return remainder if necessary
- if(Remainder != NULL)
- *Remainder = (ULONG)(LLtoU64(Dividend) % Divisor);
- return (ULONG)(LLtoU64(Dividend) / Divisor);
+ // return remainder if necessary
+ if (Remainder != NULL)
+ *Remainder = (ULONG)(LLtoU64(Dividend) % Divisor);
+ return (ULONG)(LLtoU64(Dividend) / Divisor);
}
#else
__inline
ULONG
WINAPI
-EnlargedUnsignedDivide(
+EnlargedUnsignedDivide (
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN PULONG Remainder
-)
+ )
{
ULONG ulResult;
- _asm
- {
- mov eax, Dividend.LowPart
- mov edx, Dividend.HighPart
- mov ecx, Remainder
+ _asm {
+ mov eax,Dividend.LowPart
+ mov edx,Dividend.HighPart
+ mov ecx,Remainder
div Divisor
- or ecx, ecx
+ or ecx,ecx
jz short label
- mov [ecx], edx
- label:
- mov ulResult, eax
+ mov [ecx],edx
+label:
+ mov ulResult,eax
}
return ulResult;
}
@@ -84,7 +83,7 @@ LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a);
ub.QuadPart = (DWORDLONG)(b >= 0 ? b : -b);
uc = (DWORDLONG)(c >= 0 ? c : -c);
- BOOL bSign = (a < 0) ^(b < 0);
+ BOOL bSign = (a < 0) ^ (b < 0);
/* Do long multiplication */
ULARGE_INTEGER p[2];
@@ -108,31 +107,21 @@ LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
p[0].HighPart = x.LowPart;
p[1].QuadPart = UInt32x32To64(ua.HighPart, ub.HighPart) + x.HighPart;
- if(d != 0)
- {
+ if (d != 0) {
ULARGE_INTEGER ud[2];
- if(bSign)
- {
+ if (bSign) {
ud[0].QuadPart = (DWORDLONG)(-d);
- if(d > 0)
- {
+ if (d > 0) {
/* -d < 0 */
- ud[1].QuadPart = (DWORDLONG)(LONGLONG) - 1;
- }
- else
- {
+ ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1;
+ } else {
ud[1].QuadPart = (DWORDLONG)0;
}
- }
- else
- {
+ } else {
ud[0].QuadPart = (DWORDLONG)d;
- if(d < 0)
- {
- ud[1].QuadPart = (DWORDLONG)(LONGLONG) - 1;
- }
- else
- {
+ if (d < 0) {
+ ud[1].QuadPart = (DWORDLONG)(LONGLONG)-1;
+ } else {
ud[1].QuadPart = (DWORDLONG)0;
}
}
@@ -159,8 +148,7 @@ LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
p[1].QuadPart += ud[1].QuadPart + uliTotal.QuadPart;
/* Now see if we got a sign change from the addition */
- if((LONG)p[1].HighPart < 0)
- {
+ if ((LONG)p[1].HighPart < 0) {
bSign = !bSign;
/* Negate the current value (ugh!) */
@@ -172,25 +160,22 @@ LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
}
/* Now for the division */
- if(c < 0)
- {
+ if (c < 0) {
bSign = !bSign;
}
/* This will catch c == 0 and overflow */
- if(uc <= p[1].QuadPart)
- {
+ if (uc <= p[1].QuadPart) {
return bSign ? (LONGLONG)0x8000000000000000 :
- (LONGLONG)0x7FFFFFFFFFFFFFFF;
+ (LONGLONG)0x7FFFFFFFFFFFFFFF;
}
DWORDLONG ullResult;
/* Do the division */
/* If the dividend is a DWORD_LONG use the compiler */
- if(p[1].QuadPart == 0)
- {
+ if (p[1].QuadPart == 0) {
ullResult = p[0].QuadPart / uc;
return bSign ? -(LONGLONG)ullResult : (LONGLONG)ullResult;
}
@@ -198,8 +183,7 @@ LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
/* If the divisor is a DWORD then its simpler */
ULARGE_INTEGER ulic;
ulic.QuadPart = uc;
- if(ulic.HighPart == 0)
- {
+ if (ulic.HighPart == 0) {
ULARGE_INTEGER uliDividend;
ULARGE_INTEGER uliResult;
DWORD dwDivisor = (DWORD)uc;
@@ -215,45 +199,39 @@ LONGLONG WINAPI llMulDiv(LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d)
/* NOTE - this routine will take exceptions if
the result does not fit in a DWORD
*/
- if(uliDividend.QuadPart >= (DWORDLONG)dwDivisor)
- {
+ if (uliDividend.QuadPart >= (DWORDLONG)dwDivisor) {
uliResult.HighPart = EnlargedUnsignedDivide(
uliDividend,
dwDivisor,
&p[0].HighPart);
- }
- else
- {
+ } else {
uliResult.HighPart = 0;
}
uliResult.LowPart = EnlargedUnsignedDivide(
- p[0],
- dwDivisor,
- NULL);
+ p[0],
+ dwDivisor,
+ NULL);
#endif
return bSign ? -(LONGLONG)uliResult.QuadPart :
- (LONGLONG)uliResult.QuadPart;
+ (LONGLONG)uliResult.QuadPart;
}
ullResult = 0;
/* OK - do long division */
- for(int i = 0; i < 64; i++)
- {
+ for (int i = 0; i < 64; i++) {
ullResult <<= 1;
/* Shift 128 bit p left 1 */
p[1].QuadPart <<= 1;
- if((p[0].HighPart & 0x80000000) != 0)
- {
+ if ((p[0].HighPart & 0x80000000) != 0) {
p[1].LowPart++;
}
p[0].QuadPart <<= 1;
/* Compare */
- if(uc <= p[1].QuadPart)
- {
+ if (uc <= p[1].QuadPart) {
p[1].QuadPart -= uc;
ullResult += 1;
}
@@ -272,56 +250,43 @@ LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d)
ua.QuadPart = (DWORDLONG)(a >= 0 ? a : -a);
ub = (DWORD)(b >= 0 ? b : -b);
uc = (DWORD)(c >= 0 ? c : -c);
- BOOL bSign = (a < 0) ^(b < 0);
+ BOOL bSign = (a < 0) ^ (b < 0);
/* Do long multiplication */
ULARGE_INTEGER p0;
DWORD p1;
p0.QuadPart = UInt32x32To64(ua.LowPart, ub);
- if(ua.HighPart != 0)
- {
+ if (ua.HighPart != 0) {
ULARGE_INTEGER x;
x.QuadPart = UInt32x32To64(ua.HighPart, ub) + p0.HighPart;
p0.HighPart = x.LowPart;
p1 = x.HighPart;
- }
- else
- {
+ } else {
p1 = 0;
}
- if(d != 0)
- {
+ if (d != 0) {
ULARGE_INTEGER ud0;
DWORD ud1;
- if(bSign)
- {
+ if (bSign) {
//
// Cast d to LONGLONG first otherwise -0x80000000 sign extends
// incorrectly
//
ud0.QuadPart = (DWORDLONG)(-(LONGLONG)d);
- if(d > 0)
- {
+ if (d > 0) {
/* -d < 0 */
- ud1 = (DWORD) - 1;
- }
- else
- {
+ ud1 = (DWORD)-1;
+ } else {
ud1 = (DWORD)0;
}
- }
- else
- {
+ } else {
ud0.QuadPart = (DWORDLONG)d;
- if(d < 0)
- {
- ud1 = (DWORD) - 1;
- }
- else
- {
+ if (d < 0) {
+ ud1 = (DWORD)-1;
+ } else {
ud1 = (DWORD)0;
}
}
@@ -344,8 +309,7 @@ LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d)
p1 += ud1 + uliTotal.HighPart;
/* Now see if we got a sign change from the addition */
- if((LONG)p1 < 0)
- {
+ if ((LONG)p1 < 0) {
bSign = !bSign;
/* Negate the current value (ugh!) */
@@ -357,17 +321,15 @@ LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d)
}
/* Now for the division */
- if(c < 0)
- {
+ if (c < 0) {
bSign = !bSign;
}
/* This will catch c == 0 and overflow */
- if(uc <= p1)
- {
+ if (uc <= p1) {
return bSign ? (LONGLONG)0x8000000000000000 :
- (LONGLONG)0x7FFFFFFFFFFFFFFF;
+ (LONGLONG)0x7FFFFFFFFFFFFFFF;
}
/* Do the division */
@@ -381,21 +343,18 @@ LONGLONG WINAPI Int64x32Div32(LONGLONG a, LONG b, LONG c, LONG d)
/* NOTE - this routine will take exceptions if
the result does not fit in a DWORD
*/
- if(uliDividend.QuadPart >= (DWORDLONG)dwDivisor)
- {
+ if (uliDividend.QuadPart >= (DWORDLONG)dwDivisor) {
uliResult.HighPart = EnlargedUnsignedDivide(
uliDividend,
dwDivisor,
&p0.HighPart);
- }
- else
- {
+ } else {
uliResult.HighPart = 0;
}
uliResult.LowPart = EnlargedUnsignedDivide(
- p0,
- dwDivisor,
- NULL);
+ p0,
+ dwDivisor,
+ NULL);
return bSign ? -(LONGLONG)uliResult.QuadPart :
- (LONGLONG)uliResult.QuadPart;
+ (LONGLONG)uliResult.QuadPart;
}
diff --git a/src/filters/BaseClasses/cache.h b/src/filters/BaseClasses/cache.h
index e8f488fb7..0a807c27e 100644
--- a/src/filters/BaseClasses/cache.h
+++ b/src/filters/BaseClasses/cache.h
@@ -31,8 +31,7 @@
#define __CACHE__
-class CCache : CBaseObject
-{
+class CCache : CBaseObject {
/* Make copy constructor and assignment operator inaccessible */
@@ -55,7 +54,7 @@ private:
public:
- CCache(__in_opt LPCTSTR pName, INT iItems);
+ CCache(__in_opt LPCTSTR pName,INT iItems);
virtual ~CCache();
/* Add an item to the cache */
@@ -68,10 +67,7 @@ public:
void RemoveAll(void);
/* Return the cache size which is set during construction */
- INT GetCacheSize(void) const
- {
- return m_iCacheSize;
- };
+ INT GetCacheSize(void) const {return m_iCacheSize;};
};
#endif /* __CACHE__ */
diff --git a/src/filters/BaseClasses/checkbmi.h b/src/filters/BaseClasses/checkbmi.h
index 24fda7c7a..72879679c 100644
--- a/src/filters/BaseClasses/checkbmi.h
+++ b/src/filters/BaseClasses/checkbmi.h
@@ -8,15 +8,13 @@ extern "C" {
#endif
// Helper
- __inline BOOL MultiplyCheckOverflow(DWORD a, DWORD b, __deref_out_range( == , a * b) DWORD *pab)
- {
- *pab = a * b;
- if((a == 0) || (((*pab) / a) == b))
- {
- return TRUE;
- }
- return FALSE;
+__inline BOOL MultiplyCheckOverflow(DWORD a, DWORD b, __deref_out_range(==, a * b) DWORD *pab) {
+ *pab = a * b;
+ if ((a == 0) || (((*pab) / a) == b)) {
+ return TRUE;
}
+ return FALSE;
+}
// Checks if the fields in a BITMAPINFOHEADER won't generate
@@ -31,103 +29,89 @@ extern "C" {
// 5. Total structure size exceeding know size of data
//
- __success(return != 0) __inline BOOL ValidateBitmapInfoHeader(
- const BITMAPINFOHEADER *pbmi, // pointer to structure to check
- __out_range( >= , sizeof(BITMAPINFOHEADER)) DWORD cbSize // size of memory block containing structure
- )
- {
- DWORD dwWidthInBytes;
- DWORD dwBpp;
- DWORD dwWidthInBits;
- DWORD dwHeight;
- DWORD dwSizeImage;
- DWORD dwClrUsed;
-
- // Reject bad parameters - do the size check first to avoid reading bad memory
- if(cbSize < sizeof(BITMAPINFOHEADER) ||
- pbmi->biSize < sizeof(BITMAPINFOHEADER) ||
- pbmi->biSize > 4096)
- {
- return FALSE;
- }
+__success(return != 0) __inline BOOL ValidateBitmapInfoHeader(
+ const BITMAPINFOHEADER *pbmi, // pointer to structure to check
+ __out_range(>=, sizeof(BITMAPINFOHEADER)) DWORD cbSize // size of memory block containing structure
+)
+{
+ DWORD dwWidthInBytes;
+ DWORD dwBpp;
+ DWORD dwWidthInBits;
+ DWORD dwHeight;
+ DWORD dwSizeImage;
+ DWORD dwClrUsed;
+
+ // Reject bad parameters - do the size check first to avoid reading bad memory
+ if (cbSize < sizeof(BITMAPINFOHEADER) ||
+ pbmi->biSize < sizeof(BITMAPINFOHEADER) ||
+ pbmi->biSize > 4096) {
+ return FALSE;
+ }
- // Reject 0 size
- if(pbmi->biWidth == 0 || pbmi->biHeight == 0)
- {
- return FALSE;
- }
+ // Reject 0 size
+ if (pbmi->biWidth == 0 || pbmi->biHeight == 0) {
+ return FALSE;
+ }
- // Use bpp of 200 for validating against further overflows if not set for compressed format
- dwBpp = 200;
+ // Use bpp of 200 for validating against further overflows if not set for compressed format
+ dwBpp = 200;
- if(pbmi->biBitCount > dwBpp)
- {
- return FALSE;
- }
+ if (pbmi->biBitCount > dwBpp) {
+ return FALSE;
+ }
- // Strictly speaking abs can overflow so cast explicitly to DWORD
- dwHeight = (DWORD)abs(pbmi->biHeight);
+ // Strictly speaking abs can overflow so cast explicitly to DWORD
+ dwHeight = (DWORD)abs(pbmi->biHeight);
- if(!MultiplyCheckOverflow(dwBpp, (DWORD)pbmi->biWidth, &dwWidthInBits))
- {
- return FALSE;
- }
+ if (!MultiplyCheckOverflow(dwBpp, (DWORD)pbmi->biWidth, &dwWidthInBits)) {
+ return FALSE;
+ }
- // Compute correct width in bytes - rounding up to 4 bytes
- dwWidthInBytes = (dwWidthInBits / 8 + 3) & ~3;
+ // Compute correct width in bytes - rounding up to 4 bytes
+ dwWidthInBytes = (dwWidthInBits / 8 + 3) & ~3;
- if(!MultiplyCheckOverflow(dwWidthInBytes, dwHeight, &dwSizeImage))
- {
- return FALSE;
- }
+ if (!MultiplyCheckOverflow(dwWidthInBytes, dwHeight, &dwSizeImage)) {
+ return FALSE;
+ }
- // Fail if total size is 0 - this catches indivual quantities being 0
- // Also don't allow huge values > 1GB which might cause arithmetic
- // errors for users
- if(dwSizeImage > 0x40000000 ||
- pbmi->biSizeImage > 0x40000000)
- {
- return FALSE;
- }
+ // Fail if total size is 0 - this catches indivual quantities being 0
+ // Also don't allow huge values > 1GB which might cause arithmetic
+ // errors for users
+ if (dwSizeImage > 0x40000000 ||
+ pbmi->biSizeImage > 0x40000000) {
+ return FALSE;
+ }
- // Fail if biClrUsed looks bad
- if(pbmi->biClrUsed > 256)
- {
- return FALSE;
- }
+ // Fail if biClrUsed looks bad
+ if (pbmi->biClrUsed > 256) {
+ return FALSE;
+ }
- if(pbmi->biClrUsed == 0 && pbmi->biBitCount <= 8 && pbmi->biBitCount > 0)
- {
- dwClrUsed = (1 << pbmi->biBitCount);
- }
- else
- {
- dwClrUsed = pbmi->biClrUsed;
- }
+ if (pbmi->biClrUsed == 0 && pbmi->biBitCount <= 8 && pbmi->biBitCount > 0) {
+ dwClrUsed = (1 << pbmi->biBitCount);
+ } else {
+ dwClrUsed = pbmi->biClrUsed;
+ }
- // Check total size
- if(cbSize < pbmi->biSize + dwClrUsed * sizeof(RGBQUAD) +
- (pbmi->biCompression == BI_BITFIELDS ? 3 * sizeof(DWORD) : 0))
- {
- return FALSE;
- }
+ // Check total size
+ if (cbSize < pbmi->biSize + dwClrUsed * sizeof(RGBQUAD) +
+ (pbmi->biCompression == BI_BITFIELDS ? 3 * sizeof(DWORD) : 0)) {
+ return FALSE;
+ }
- // If it is RGB validate biSizeImage - lots of code assumes the size is correct
- if(pbmi->biCompression == BI_RGB || pbmi->biCompression == BI_BITFIELDS)
- {
- if(pbmi->biSizeImage != 0)
- {
- DWORD dwBits = (DWORD)pbmi->biWidth * (DWORD)pbmi->biBitCount;
- DWORD dwWidthInBytes = ((DWORD)((dwBits + 31) & (~31)) / 8);
- DWORD dwTotalSize = (DWORD)abs(pbmi->biHeight) * dwWidthInBytes;
- if(dwTotalSize > pbmi->biSizeImage)
- {
- return FALSE;
- }
+ // If it is RGB validate biSizeImage - lots of code assumes the size is correct
+ if (pbmi->biCompression == BI_RGB || pbmi->biCompression == BI_BITFIELDS) {
+ if (pbmi->biSizeImage != 0) {
+ DWORD dwBits = (DWORD)pbmi->biWidth * (DWORD)pbmi->biBitCount;
+ DWORD dwWidthInBytes = ((DWORD)((dwBits+31) & (~31)) / 8);
+ DWORD dwTotalSize = (DWORD)abs(pbmi->biHeight) * dwWidthInBytes;
+ if (dwTotalSize > pbmi->biSizeImage) {
+ return FALSE;
}
}
- return TRUE;
}
+ return TRUE;
+}
#ifdef __cplusplus
}
diff --git a/src/filters/BaseClasses/combase.cpp b/src/filters/BaseClasses/combase.cpp
index 1bff6b761..25ed0c65d 100644
--- a/src/filters/BaseClasses/combase.cpp
+++ b/src/filters/BaseClasses/combase.cpp
@@ -54,14 +54,12 @@ HINSTANCE hlibOLEAut32;
CBaseObject::~CBaseObject()
{
/* Decrement the number of objects active */
- if(InterlockedDecrement(&m_cObjects) == 0)
- {
- if(hlibOLEAut32)
- {
- FreeLibrary(hlibOLEAut32);
-
- hlibOLEAut32 = 0;
- }
+ if (InterlockedDecrement(&m_cObjects) == 0) {
+ if (hlibOLEAut32) {
+ FreeLibrary(hlibOLEAut32);
+
+ hlibOLEAut32 = 0;
+ }
};
@@ -74,10 +72,9 @@ static const TCHAR szOle32Aut[] = TEXT("OleAut32.dll");
HINSTANCE LoadOLEAut32()
{
- if(hlibOLEAut32 == 0)
- {
+ if (hlibOLEAut32 == 0) {
- hlibOLEAut32 = LoadLibrary(szOle32Aut);
+ hlibOLEAut32 = LoadLibrary(szOle32Aut);
}
return hlibOLEAut32;
@@ -89,21 +86,21 @@ HINSTANCE LoadOLEAut32()
// We know we use "this" in the initialization list, we also know we don't modify *phr.
#pragma warning( disable : 4355 4100 )
CUnknown::CUnknown(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pUnk)
- : CBaseObject(pName)
+: CBaseObject(pName)
/* Start the object with a reference count of zero - when the */
/* object is queried for it's first interface this may be */
/* incremented depending on whether or not this object is */
/* currently being aggregated upon */
- , m_cRef(0)
+, m_cRef(0)
/* Set our pointer to our IUnknown interface. */
/* If we have an outer, use its, otherwise use ours. */
/* This pointer effectivly points to the owner of */
/* this object and can be accessed by the GetOwner() method. */
- , m_pUnknown(pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>(static_cast<PNDUNKNOWN>(this)))
-/* Why the double cast? Well, the inner cast is a type-safe cast */
-/* to pointer to a type from which we inherit. The second is */
-/* type-unsafe but works because INonDelegatingUnknown "behaves */
-/* like" IUnknown. (Only the names on the methods change.) */
+, m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
+ /* Why the double cast? Well, the inner cast is a type-safe cast */
+ /* to pointer to a type from which we inherit. The second is */
+ /* type-unsafe but works because INonDelegatingUnknown "behaves */
+ /* like" IUnknown. (Only the names on the methods change.) */
{
// Everything we need to do has been done in the initializer list
}
@@ -113,19 +110,19 @@ CUnknown::CUnknown(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pUnk)
CUnknown::CUnknown(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) :
CBaseObject(pName),
m_cRef(0),
- m_pUnknown(pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>(static_cast<PNDUNKNOWN>(this)))
+ m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
{
}
#ifdef UNICODE
CUnknown::CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk)
- : CBaseObject(pName), m_cRef(0),
- m_pUnknown(pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>(static_cast<PNDUNKNOWN>(this)))
+: CBaseObject(pName), m_cRef(0),
+ m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
{ }
CUnknown::CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) :
CBaseObject(pName), m_cRef(0),
- m_pUnknown(pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>(static_cast<PNDUNKNOWN>(this)))
+ m_pUnknown( pUnk != 0 ? pUnk : reinterpret_cast<LPUNKNOWN>( static_cast<PNDUNKNOWN>(this) ) )
{ }
#endif
@@ -137,18 +134,15 @@ CUnknown::CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk, __inout_opt H
STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
{
- CheckPointer(ppv, E_POINTER);
- ValidateReadWritePtr(ppv, sizeof(PVOID));
+ CheckPointer(ppv,E_POINTER);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
/* We know only about IUnknown */
- if(riid == IID_IUnknown)
- {
- GetInterface((LPUNKNOWN)(PNDUNKNOWN) this, ppv);
+ if (riid == IID_IUnknown) {
+ GetInterface((LPUNKNOWN) (PNDUNKNOWN) this, ppv);
return NOERROR;
- }
- else
- {
+ } else {
*ppv = NULL;
return E_NOINTERFACE;
}
@@ -159,7 +153,7 @@ STDMETHODIMP CUnknown::NonDelegatingQueryInterface(REFIID riid, __deref_out void
/* about concurrency, we can't afford to access the m_cRef twice since we can't */
/* afford to run the risk that its value having changed between accesses. */
-template<class T> inline static T ourmax(const T & a, const T & b)
+template<class T> inline static T ourmax( const T & a, const T & b )
{
return a > b ? a : b;
}
@@ -168,10 +162,10 @@ template<class T> inline static T ourmax(const T & a, const T & b)
STDMETHODIMP_(ULONG) CUnknown::NonDelegatingAddRef()
{
- LONG lRef = InterlockedIncrement(&m_cRef);
+ LONG lRef = InterlockedIncrement( &m_cRef );
ASSERT(lRef > 0);
- DbgLog((LOG_MEMORY, 3, TEXT(" Obj %d ref++ = %d"),
- m_dwCookie, m_cRef));
+ DbgLog((LOG_MEMORY,3,TEXT(" Obj %d ref++ = %d"),
+ m_dwCookie, m_cRef));
return ourmax(ULONG(m_cRef), 1ul);
}
@@ -182,13 +176,12 @@ STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease()
{
/* If the reference count drops to zero delete ourselves */
- LONG lRef = InterlockedDecrement(&m_cRef);
+ LONG lRef = InterlockedDecrement( &m_cRef );
ASSERT(lRef >= 0);
- DbgLog((LOG_MEMORY, 3, TEXT(" Object %d ref-- = %d"),
- m_dwCookie, m_cRef));
- if(lRef == 0)
- {
+ DbgLog((LOG_MEMORY,3,TEXT(" Object %d ref-- = %d"),
+ m_dwCookie, m_cRef));
+ if (lRef == 0) {
// COM rules say we must protect against re-entrancy.
// If we are an aggregator and we hold our own interfaces
@@ -206,9 +199,7 @@ STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease()
delete this;
return ULONG(0);
- }
- else
- {
+ } else {
// Don't touch m_cRef again even in this leg as the object
// may have just been released on another thread too
return ourmax(ULONG(lRef), 1ul);
@@ -235,8 +226,7 @@ BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond)
/* Different objects can't have the same interface pointer for
any interface
*/
- if(pFirst == pSecond)
- {
+ if (pFirst == pSecond) {
return TRUE;
}
/* OK - do it the hard way - check if they have the same
@@ -251,9 +241,8 @@ BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond)
/* See if the IUnknown pointers match */
- hr = pFirst->QueryInterface(IID_IUnknown, (void **) &pUnknown1);
- if(FAILED(hr))
- {
+ hr = pFirst->QueryInterface(IID_IUnknown,(void **) &pUnknown1);
+ if (FAILED(hr)) {
return FALSE;
}
ASSERT(pUnknown1);
@@ -262,9 +251,8 @@ BOOL WINAPI IsEqualObject(IUnknown *pFirst, IUnknown *pSecond)
pUnknown1->Release();
- hr = pSecond->QueryInterface(IID_IUnknown, (void **) &pUnknown2);
- if(FAILED(hr))
- {
+ hr = pSecond->QueryInterface(IID_IUnknown,(void **) &pUnknown2);
+ if (FAILED(hr)) {
return FALSE;
}
ASSERT(pUnknown2);
diff --git a/src/filters/BaseClasses/combase.h b/src/filters/BaseClasses/combase.h
index 32ac70305..7b0d1edae 100644
--- a/src/filters/BaseClasses/combase.h
+++ b/src/filters/BaseClasses/combase.h
@@ -115,12 +115,12 @@ AMOVIESETUP_PIN, * PAMOVIESETUP_PIN, * FAR LPAMOVIESETUP_PIN;
typedef struct _AMOVIESETUP_FILTER
{
- const CLSID * clsID;
- const WCHAR * strName;
- DWORD dwMerit;
- UINT nPins;
- const AMOVIESETUP_PIN * lpPin;
- const CLSID filterCategory;
+ const CLSID * clsID;
+ const WCHAR * strName;
+ DWORD dwMerit;
+ UINT nPins;
+ const AMOVIESETUP_PIN * lpPin;
+ const CLSID filterCategory;
}
AMOVIESETUP_FILTER, * PAMOVIESETUP_FILTER, * FAR LPAMOVIESETUP_FILTER;
@@ -139,7 +139,7 @@ extern OSVERSIONINFO g_osInfo; // Filled in by GetVersionEx
#ifndef INONDELEGATINGUNKNOWN_DEFINED
DECLARE_INTERFACE(INonDelegatingUnknown)
{
- STDMETHOD(NonDelegatingQueryInterface)(THIS_ REFIID, LPVOID *) PURE;
+ STDMETHOD(NonDelegatingQueryInterface) (THIS_ REFIID, LPVOID *) PURE;
STDMETHOD_(ULONG, NonDelegatingAddRef)(THIS) PURE;
STDMETHOD_(ULONG, NonDelegatingRelease)(THIS) PURE;
};
@@ -188,8 +188,7 @@ public:
/* Call this to find if there are any CUnknown derived objects active */
- static LONG ObjectsActive()
- {
+ static LONG ObjectsActive() {
return m_cObjects;
};
};
@@ -200,7 +199,7 @@ public:
support, and an implementation of the core non delegating IUnknown */
class AM_NOVTABLE CUnknown : public INonDelegatingUnknown,
- public CBaseObject
+ public CBaseObject
{
private:
const LPUNKNOWN m_pUnknown; /* Owner of this object */
@@ -218,13 +217,12 @@ public:
CUnknown(__in_opt LPCTSTR Name, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr);
#ifdef UNICODE
CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk);
- CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr);
+ CUnknown(__in_opt LPCSTR pName, __in_opt LPUNKNOWN pUnk,__inout_opt HRESULT *phr);
#endif
/* Return the owner of this object */
- LPUNKNOWN GetOwner() const
- {
+ LPUNKNOWN GetOwner() const {
return m_pUnknown;
};
@@ -260,8 +258,7 @@ typedef void (CALLBACK *LPFNInitRoutine)(BOOL bLoading, const CLSID *rclsid);
/* Create one of these per object class in an array so that
the default class factory code can create new instances */
-class CFactoryTemplate
-{
+class CFactoryTemplate {
public:
@@ -271,14 +268,12 @@ public:
LPFNInitRoutine m_lpfnInit;
const AMOVIESETUP_FILTER * m_pAMovieSetup_Filter;
- BOOL IsClassID(REFCLSID rclsid) const
- {
- return (IsEqualCLSID(*m_ClsID, rclsid));
+ BOOL IsClassID(REFCLSID rclsid) const {
+ return (IsEqualCLSID(*m_ClsID,rclsid));
};
- CUnknown *CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) const
- {
- CheckPointer(phr, NULL);
+ CUnknown *CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout_opt HRESULT *phr) const {
+ CheckPointer(phr,NULL);
return m_lpfnNew(pUnk, phr);
};
};
diff --git a/src/filters/BaseClasses/cprop.cpp b/src/filters/BaseClasses/cprop.cpp
index 41c40e0a9..7bd76b4e3 100644
--- a/src/filters/BaseClasses/cprop.cpp
+++ b/src/filters/BaseClasses/cprop.cpp
@@ -20,7 +20,7 @@ CBasePropertyPage::CBasePropertyPage(__in_opt LPCTSTR pName, // Debug only nam
__inout_opt LPUNKNOWN pUnk, // COM Delegator
int DialogId, // Resource ID
int TitleId) : // To get tital
- CUnknown(pName, pUnk),
+ CUnknown(pName,pUnk),
m_DialogId(DialogId),
m_TitleId(TitleId),
m_hwnd(NULL),
@@ -36,7 +36,7 @@ CBasePropertyPage::CBasePropertyPage(__in_opt LPCSTR pName, // Debug only na
__inout_opt LPUNKNOWN pUnk, // COM Delegator
int DialogId, // Resource ID
int TitleId) : // To get tital
- CUnknown(pName, pUnk),
+ CUnknown(pName,pUnk),
m_DialogId(DialogId),
m_TitleId(TitleId),
m_hwnd(NULL),
@@ -54,7 +54,7 @@ STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingAddRef()
{
LONG lRef = InterlockedIncrement(&m_cRef);
ASSERT(lRef > 0);
- return max(ULONG(m_cRef), 1ul);
+ return max(ULONG(m_cRef),1ul);
}
@@ -65,18 +65,15 @@ STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingRelease()
// If the reference count drops to zero delete ourselves
LONG lRef = InterlockedDecrement(&m_cRef);
- if(lRef == 0)
- {
+ if (lRef == 0) {
m_cRef++;
SetPageSite(NULL);
- SetObjects(0, NULL);
+ SetObjects(0,NULL);
delete this;
return ULONG(0);
- }
- else
- {
+ } else {
// Don't touch m_cRef again here!
- return max(ULONG(lRef), 1ul);
+ return max(ULONG(lRef),1ul);
}
}
@@ -84,15 +81,12 @@ STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingRelease()
// Expose our IPropertyPage interface
STDMETHODIMP
-CBasePropertyPage::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
+CBasePropertyPage::NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv)
{
- if(riid == IID_IPropertyPage)
- {
- return GetInterface((IPropertyPage *)this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ if (riid == IID_IPropertyPage) {
+ return GetInterface((IPropertyPage *)this,ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid,ppv);
}
}
@@ -101,16 +95,15 @@ CBasePropertyPage::NonDelegatingQueryInterface(REFIID riid, __deref_out void **p
STDMETHODIMP CBasePropertyPage::GetPageInfo(__out LPPROPPAGEINFO pPageInfo)
{
- CheckPointer(pPageInfo, E_POINTER);
+ CheckPointer(pPageInfo,E_POINTER);
WCHAR wszTitle[STR_MAX_LENGTH];
- WideStringFromResource(wszTitle, m_TitleId);
+ WideStringFromResource(wszTitle,m_TitleId);
// Allocate dynamic memory for the property page title
LPOLESTR pszTitle;
HRESULT hr = AMGetWideString(wszTitle, &pszTitle);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
NOTE("No caption memory");
return hr;
}
@@ -125,7 +118,7 @@ STDMETHODIMP CBasePropertyPage::GetPageInfo(__out LPPROPPAGEINFO pPageInfo)
pPageInfo->size.cx = 340;
pPageInfo->size.cy = 150;
- GetDialogSize(m_DialogId, DialogProc, 0L, &pPageInfo->size);
+ GetDialogSize(m_DialogId, DialogProc,0L,&pPageInfo->size);
return NOERROR;
}
@@ -133,49 +126,44 @@ STDMETHODIMP CBasePropertyPage::GetPageInfo(__out LPPROPPAGEINFO pPageInfo)
// Handles the messages for our property window
INT_PTR CALLBACK CBasePropertyPage::DialogProc(HWND hwnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
CBasePropertyPage *pPropertyPage;
- switch(uMsg)
- {
+ switch (uMsg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
- _SetWindowLongPtr(hwnd, DWLP_USER, lParam);
+ _SetWindowLongPtr(hwnd, DWLP_USER, lParam);
- // This pointer may be NULL when calculating size
+ // This pointer may be NULL when calculating size
- pPropertyPage = (CBasePropertyPage *) lParam;
- if(pPropertyPage == NULL)
- {
- return (LRESULT) 1;
- }
- pPropertyPage->m_Dlg = hwnd;
+ pPropertyPage = (CBasePropertyPage *) lParam;
+ if (pPropertyPage == NULL) {
+ return (LRESULT) 1;
+ }
+ pPropertyPage->m_Dlg = hwnd;
}
// This pointer may be NULL when calculating size
pPropertyPage = _GetWindowLongPtr<CBasePropertyPage*>(hwnd, DWLP_USER);
- if(pPropertyPage == NULL)
- {
+ if (pPropertyPage == NULL) {
return (LRESULT) 1;
}
- return pPropertyPage->OnReceiveMessage(hwnd, uMsg, wParam, lParam);
+ return pPropertyPage->OnReceiveMessage(hwnd,uMsg,wParam,lParam);
}
// Tells us the object that should be informed of the property changes
-STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects, __in_ecount_opt(cObjects) LPUNKNOWN *ppUnk)
+STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects,__in_ecount_opt(cObjects) LPUNKNOWN *ppUnk)
{
- if(cObjects == 1)
- {
+ if (cObjects == 1) {
- if((ppUnk == NULL) || (*ppUnk == NULL))
- {
+ if ((ppUnk == NULL) || (*ppUnk == NULL)) {
return E_POINTER;
}
@@ -183,9 +171,7 @@ STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects, __in_ecount_opt(cObje
m_bObjectSet = TRUE ;
return OnConnect(*ppUnk);
- }
- else if(cObjects == 0)
- {
+ } else if (cObjects == 0) {
// Set a flag to say that we have not set the Object for the page
m_bObjectSet = FALSE ;
@@ -200,19 +186,17 @@ STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects, __in_ecount_opt(cObje
// Create the window we will use to edit properties
STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent,
- LPCRECT pRect,
- BOOL fModal)
+ LPCRECT pRect,
+ BOOL fModal)
{
- CheckPointer(pRect, E_POINTER);
+ CheckPointer(pRect,E_POINTER);
// Return failure if SetObject has not been called.
- if(m_bObjectSet == FALSE)
- {
+ if (m_bObjectSet == FALSE) {
return E_UNEXPECTED;
}
- if(m_hwnd)
- {
+ if (m_hwnd) {
return E_UNEXPECTED;
}
@@ -221,8 +205,7 @@ STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent,
hwndParent,
DialogProc,
(LPARAM) this);
- if(m_hwnd == NULL)
- {
+ if (m_hwnd == NULL) {
return E_OUTOFMEMORY;
}
@@ -236,10 +219,9 @@ STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent,
STDMETHODIMP CBasePropertyPage::Move(LPCRECT pRect)
{
- CheckPointer(pRect, E_POINTER);
+ CheckPointer(pRect,E_POINTER);
- if(m_hwnd == NULL)
- {
+ if (m_hwnd == NULL) {
return E_UNEXPECTED;
}
@@ -258,22 +240,20 @@ STDMETHODIMP CBasePropertyPage::Move(LPCRECT pRect)
STDMETHODIMP CBasePropertyPage::Show(UINT nCmdShow)
{
- // Have we been activated yet
+ // Have we been activated yet
- if(m_hwnd == NULL)
- {
+ if (m_hwnd == NULL) {
return E_UNEXPECTED;
}
// Ignore wrong show flags
- if((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE))
- {
+ if ((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE)) {
return E_INVALIDARG;
}
- ShowWindow(m_hwnd, nCmdShow);
- InvalidateRect(m_hwnd, NULL, TRUE);
+ ShowWindow(m_hwnd,nCmdShow);
+ InvalidateRect(m_hwnd,NULL,TRUE);
return NOERROR;
}
@@ -282,8 +262,7 @@ STDMETHODIMP CBasePropertyPage::Show(UINT nCmdShow)
STDMETHODIMP CBasePropertyPage::Deactivate(void)
{
- if(m_hwnd == NULL)
- {
+ if (m_hwnd == NULL) {
return E_UNEXPECTED;
}
@@ -314,23 +293,18 @@ STDMETHODIMP CBasePropertyPage::Deactivate(void)
STDMETHODIMP CBasePropertyPage::SetPageSite(__in_opt LPPROPERTYPAGESITE pPageSite)
{
- if(pPageSite)
- {
+ if (pPageSite) {
- if(m_pPageSite)
- {
+ if (m_pPageSite) {
return E_UNEXPECTED;
}
m_pPageSite = pPageSite;
m_pPageSite->AddRef();
- }
- else
- {
+ } else {
- if(m_pPageSite == NULL)
- {
+ if (m_pPageSite == NULL) {
return E_UNEXPECTED;
}
@@ -351,30 +325,26 @@ STDMETHODIMP CBasePropertyPage::Apply()
// see if we have been activated (ie., m_hWnd != NULL), but instead
// make sure that m_bObjectSet is TRUE (ie., SetObject has been called).
- if(m_bObjectSet == FALSE)
- {
+ if (m_bObjectSet == FALSE) {
return E_UNEXPECTED;
}
// Must have had a site set
- if(m_pPageSite == NULL)
- {
+ if (m_pPageSite == NULL) {
return E_UNEXPECTED;
}
// Has anything changed
- if(m_bDirty == FALSE)
- {
+ if (m_bDirty == FALSE) {
return NOERROR;
}
// Commit derived class changes
HRESULT hr = OnApplyChanges();
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
m_bDirty = FALSE;
}
return hr;
@@ -383,7 +353,7 @@ STDMETHODIMP CBasePropertyPage::Apply()
// Base class definition for message handling
-INT_PTR CBasePropertyPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CBasePropertyPage::OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
// we would like the TAB key to move around the tab stops in our property
// page, but for some reason OleCreatePropertyFrame clears the CONTROLPARENT
@@ -395,22 +365,19 @@ INT_PTR CBasePropertyPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam,
{
pPropertyPage = _GetWindowLongPtr<CBasePropertyPage*>(hwnd, DWLP_USER);
- if(pPropertyPage->m_hwnd == NULL)
- {
+ if (pPropertyPage->m_hwnd == NULL) {
return 0;
}
- switch(uMsg)
- {
- case WM_STYLECHANGING:
- if(wParam == GWL_EXSTYLE)
- {
- LPSTYLESTRUCT lpss = (LPSTYLESTRUCT)lParam;
- lpss->styleNew |= WS_EX_CONTROLPARENT;
- return 0;
- }
+ switch (uMsg) {
+ case WM_STYLECHANGING:
+ if (wParam == GWL_EXSTYLE) {
+ LPSTYLESTRUCT lpss = (LPSTYLESTRUCT)lParam;
+ lpss->styleNew |= WS_EX_CONTROLPARENT;
+ return 0;
+ }
}
}
-
- return DefWindowProc(hwnd, uMsg, wParam, lParam);
+
+ return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
diff --git a/src/filters/BaseClasses/cprop.h b/src/filters/BaseClasses/cprop.h
index af217aff0..db4494067 100644
--- a/src/filters/BaseClasses/cprop.h
+++ b/src/filters/BaseClasses/cprop.h
@@ -58,7 +58,7 @@ public:
#ifdef UNICODE
CBasePropertyPage(__in_opt LPCSTR pName,
__inout_opt LPUNKNOWN pUnk,
- int DialogId,
+ int DialogId,
int TitleId);
#endif
virtual ~CBasePropertyPage() { };
@@ -66,27 +66,12 @@ public:
// Override these virtual methods
- virtual HRESULT OnConnect(IUnknown *pUnknown)
- {
- return NOERROR;
- };
- virtual HRESULT OnDisconnect()
- {
- return NOERROR;
- };
- virtual HRESULT OnActivate()
- {
- return NOERROR;
- };
- virtual HRESULT OnDeactivate()
- {
- return NOERROR;
- };
- virtual HRESULT OnApplyChanges()
- {
- return NOERROR;
- };
- virtual INT_PTR OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual HRESULT OnConnect(IUnknown *pUnknown) { return NOERROR; };
+ virtual HRESULT OnDisconnect() { return NOERROR; };
+ virtual HRESULT OnActivate() { return NOERROR; };
+ virtual HRESULT OnDeactivate() { return NOERROR; };
+ virtual HRESULT OnApplyChanges() { return NOERROR; };
+ virtual INT_PTR OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
// These implement an IPropertyPage interface
@@ -94,25 +79,16 @@ public:
STDMETHODIMP_(ULONG) NonDelegatingRelease();
STDMETHODIMP_(ULONG) NonDelegatingAddRef();
STDMETHODIMP SetPageSite(__in_opt LPPROPERTYPAGESITE pPageSite);
- STDMETHODIMP Activate(HWND hwndParent, LPCRECT prect, BOOL fModal);
+ STDMETHODIMP Activate(HWND hwndParent, LPCRECT prect,BOOL fModal);
STDMETHODIMP Deactivate(void);
STDMETHODIMP GetPageInfo(__out LPPROPPAGEINFO pPageInfo);
STDMETHODIMP SetObjects(ULONG cObjects, __in_ecount_opt(cObjects) LPUNKNOWN *ppUnk);
STDMETHODIMP Show(UINT nCmdShow);
STDMETHODIMP Move(LPCRECT prect);
- STDMETHODIMP IsPageDirty(void)
- {
- return m_bDirty ? S_OK : S_FALSE;
- }
+ STDMETHODIMP IsPageDirty(void) { return m_bDirty ? S_OK : S_FALSE; }
STDMETHODIMP Apply(void);
- STDMETHODIMP Help(LPCWSTR lpszHelpDir)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP TranslateAccelerator(__inout LPMSG lpMsg)
- {
- return E_NOTIMPL;
- }
+ STDMETHODIMP Help(LPCWSTR lpszHelpDir) { return E_NOTIMPL; }
+ STDMETHODIMP TranslateAccelerator(__inout LPMSG lpMsg) { return E_NOTIMPL; }
};
#endif // __CPROP__
diff --git a/src/filters/BaseClasses/ctlutil.cpp b/src/filters/BaseClasses/ctlutil.cpp
index b9adb300a..8ccb9dc3c 100644
--- a/src/filters/BaseClasses/ctlutil.cpp
+++ b/src/filters/BaseClasses/ctlutil.cpp
@@ -24,9 +24,8 @@
// --- CBaseDispatch implementation ----------
CBaseDispatch::~CBaseDispatch()
{
- if(m_pti)
- {
- m_pti->Release();
+ if (m_pti) {
+ m_pti->Release();
}
}
@@ -36,113 +35,104 @@ CBaseDispatch::~CBaseDispatch()
STDMETHODIMP
CBaseDispatch::GetTypeInfoCount(__out UINT * pctinfo)
{
- CheckPointer(pctinfo, E_POINTER);
- ValidateReadWritePtr(pctinfo, sizeof(UINT *));
+ CheckPointer(pctinfo,E_POINTER);
+ ValidateReadWritePtr(pctinfo,sizeof(UINT *));
*pctinfo = 1;
return S_OK;
}
-typedef HRESULT(STDAPICALLTYPE *LPLOADTYPELIB)(
- const OLECHAR FAR *szFile,
- __deref_out ITypeLib FAR* FAR* pptlib);
+typedef HRESULT (STDAPICALLTYPE *LPLOADTYPELIB)(
+ const OLECHAR FAR *szFile,
+ __deref_out ITypeLib FAR* FAR* pptlib);
-typedef HRESULT(STDAPICALLTYPE *LPLOADREGTYPELIB)(REFGUID rguid,
- WORD wVerMajor,
- WORD wVerMinor,
- LCID lcid,
- __deref_out ITypeLib FAR* FAR* pptlib);
+typedef HRESULT (STDAPICALLTYPE *LPLOADREGTYPELIB)(REFGUID rguid,
+ WORD wVerMajor,
+ WORD wVerMinor,
+ LCID lcid,
+ __deref_out ITypeLib FAR* FAR* pptlib);
// attempt to find our type library
STDMETHODIMP
CBaseDispatch::GetTypeInfo(
- REFIID riid,
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ REFIID riid,
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
- CheckPointer(pptinfo, E_POINTER);
- ValidateReadWritePtr(pptinfo, sizeof(ITypeInfo *));
+ CheckPointer(pptinfo,E_POINTER);
+ ValidateReadWritePtr(pptinfo,sizeof(ITypeInfo *));
HRESULT hr;
*pptinfo = NULL;
// we only support one type element
- if(0 != itinfo)
- {
- return TYPE_E_ELEMENTNOTFOUND;
+ if (0 != itinfo) {
+ return TYPE_E_ELEMENTNOTFOUND;
}
- if(NULL == pptinfo)
- {
- return E_POINTER;
+ if (NULL == pptinfo) {
+ return E_POINTER;
}
// always look for neutral
- if(NULL == m_pti)
- {
+ if (NULL == m_pti) {
- LPLOADTYPELIB lpfnLoadTypeLib;
- LPLOADREGTYPELIB lpfnLoadRegTypeLib;
- ITypeLib *ptlib;
- HINSTANCE hInst;
+ LPLOADTYPELIB lpfnLoadTypeLib;
+ LPLOADREGTYPELIB lpfnLoadRegTypeLib;
+ ITypeLib *ptlib;
+ HINSTANCE hInst;
- static const char szTypeLib[] = "LoadTypeLib";
- static const char szRegTypeLib[] = "LoadRegTypeLib";
- static const WCHAR szControl[] = L"control.tlb";
+ static const char szTypeLib[] = "LoadTypeLib";
+ static const char szRegTypeLib[] = "LoadRegTypeLib";
+ static const WCHAR szControl[] = L"control.tlb";
- //
- // Try to get the Ole32Aut.dll module handle.
- //
+ //
+ // Try to get the Ole32Aut.dll module handle.
+ //
- hInst = LoadOLEAut32();
- if(hInst == NULL)
- {
- DWORD dwError = GetLastError();
- return AmHresultFromWin32(dwError);
- }
- lpfnLoadRegTypeLib = (LPLOADREGTYPELIB)GetProcAddress(hInst,
- szRegTypeLib);
- if(lpfnLoadRegTypeLib == NULL)
- {
- DWORD dwError = GetLastError();
- return AmHresultFromWin32(dwError);
- }
+ hInst = LoadOLEAut32();
+ if (hInst == NULL) {
+ DWORD dwError = GetLastError();
+ return AmHresultFromWin32(dwError);
+ }
+ lpfnLoadRegTypeLib = (LPLOADREGTYPELIB)GetProcAddress(hInst,
+ szRegTypeLib);
+ if (lpfnLoadRegTypeLib == NULL) {
+ DWORD dwError = GetLastError();
+ return AmHresultFromWin32(dwError);
+ }
- hr = (*lpfnLoadRegTypeLib)(LIBID_QuartzTypeLib, 1, 0, // version 1.0
- lcid, &ptlib);
+ hr = (*lpfnLoadRegTypeLib)(LIBID_QuartzTypeLib, 1, 0, // version 1.0
+ lcid, &ptlib);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
- // attempt to load directly - this will fill the
- // registry in if it finds it
+ // attempt to load directly - this will fill the
+ // registry in if it finds it
- lpfnLoadTypeLib = (LPLOADTYPELIB)GetProcAddress(hInst, szTypeLib);
- if(lpfnLoadTypeLib == NULL)
- {
- DWORD dwError = GetLastError();
- return AmHresultFromWin32(dwError);
- }
+ lpfnLoadTypeLib = (LPLOADTYPELIB)GetProcAddress(hInst, szTypeLib);
+ if (lpfnLoadTypeLib == NULL) {
+ DWORD dwError = GetLastError();
+ return AmHresultFromWin32(dwError);
+ }
- hr = (*lpfnLoadTypeLib)(szControl, &ptlib);
- if(FAILED(hr))
- {
- return hr;
- }
- }
+ hr = (*lpfnLoadTypeLib)(szControl, &ptlib);
+ if (FAILED(hr)) {
+ return hr;
+ }
+ }
- hr = ptlib->GetTypeInfoOfGuid(
- riid,
- &m_pti);
+ hr = ptlib->GetTypeInfoOfGuid(
+ riid,
+ &m_pti);
- ptlib->Release();
+ ptlib->Release();
- if(FAILED(hr))
- {
- return hr;
- }
+ if (FAILED(hr)) {
+ return hr;
+ }
}
*pptinfo = m_pti;
@@ -153,11 +143,11 @@ CBaseDispatch::GetTypeInfo(
STDMETHODIMP
CBaseDispatch::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
// although the IDispatch riid is dead, we use this to pass from
// the interface implementation class to us the iid we are talking about.
@@ -165,11 +155,10 @@ CBaseDispatch::GetIDsOfNames(
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(riid, 0, lcid, &pti);
- if(SUCCEEDED(hr))
- {
- hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid);
+ if (SUCCEEDED(hr)) {
+ hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid);
- pti->Release();
+ pti->Release();
}
return hr;
}
@@ -177,7 +166,7 @@ CBaseDispatch::GetIDsOfNames(
// --- CMediaControl implementation ---------
-CMediaControl::CMediaControl(const TCHAR * name, LPUNKNOWN pUnk) :
+CMediaControl::CMediaControl(const TCHAR * name,LPUNKNOWN pUnk) :
CUnknown(name, pUnk)
{
}
@@ -187,14 +176,11 @@ CMediaControl::CMediaControl(const TCHAR * name, LPUNKNOWN pUnk) :
STDMETHODIMP
CMediaControl::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IMediaControl)
- {
- return GetInterface((IMediaControl *) this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IMediaControl) {
+ return GetInterface( (IMediaControl *) this, ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -212,68 +198,66 @@ CMediaControl::GetTypeInfoCount(__out UINT * pctinfo)
STDMETHODIMP
CMediaControl::GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
return m_basedisp.GetTypeInfo(
- IID_IMediaControl,
- itinfo,
- lcid,
- pptinfo);
+ IID_IMediaControl,
+ itinfo,
+ lcid,
+ pptinfo);
}
STDMETHODIMP
CMediaControl::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
return m_basedisp.GetIDsOfNames(
- IID_IMediaControl,
- rgszNames,
- cNames,
- lcid,
- rgdispid);
+ IID_IMediaControl,
+ rgszNames,
+ cNames,
+ lcid,
+ rgdispid);
}
STDMETHODIMP
CMediaControl::Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr)
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr)
{
// this parameter is a dead leftover from an earlier interface
- if(IID_NULL != riid)
- {
- return DISP_E_UNKNOWNINTERFACE;
+ if (IID_NULL != riid) {
+ return DISP_E_UNKNOWNINTERFACE;
}
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(0, lcid, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pti->Invoke(
- (IMediaControl *)this,
- dispidMember,
- wFlags,
- pdispparams,
- pvarResult,
- pexcepinfo,
- puArgErr);
+ (IMediaControl *)this,
+ dispidMember,
+ wFlags,
+ pdispparams,
+ pvarResult,
+ pexcepinfo,
+ puArgErr);
pti->Release();
return hr;
@@ -283,7 +267,7 @@ CMediaControl::Invoke(
// --- CMediaEvent implementation ----------
-CMediaEvent::CMediaEvent(__in_opt LPCTSTR name, __in_opt LPUNKNOWN pUnk) :
+CMediaEvent::CMediaEvent(__in_opt LPCTSTR name,__in_opt LPUNKNOWN pUnk) :
CUnknown(name, pUnk)
{
}
@@ -294,14 +278,11 @@ CMediaEvent::CMediaEvent(__in_opt LPCTSTR name, __in_opt LPUNKNOWN pUnk) :
STDMETHODIMP
CMediaEvent::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IMediaEvent || riid == IID_IMediaEventEx)
- {
- return GetInterface((IMediaEventEx *) this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IMediaEvent || riid == IID_IMediaEventEx) {
+ return GetInterface( (IMediaEventEx *) this, ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -319,68 +300,66 @@ CMediaEvent::GetTypeInfoCount(__out UINT * pctinfo)
STDMETHODIMP
CMediaEvent::GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
return m_basedisp.GetTypeInfo(
- IID_IMediaEvent,
- itinfo,
- lcid,
- pptinfo);
+ IID_IMediaEvent,
+ itinfo,
+ lcid,
+ pptinfo);
}
STDMETHODIMP
CMediaEvent::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
return m_basedisp.GetIDsOfNames(
- IID_IMediaEvent,
- rgszNames,
- cNames,
- lcid,
- rgdispid);
+ IID_IMediaEvent,
+ rgszNames,
+ cNames,
+ lcid,
+ rgdispid);
}
STDMETHODIMP
CMediaEvent::Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr)
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr)
{
// this parameter is a dead leftover from an earlier interface
- if(IID_NULL != riid)
- {
- return DISP_E_UNKNOWNINTERFACE;
+ if (IID_NULL != riid) {
+ return DISP_E_UNKNOWNINTERFACE;
}
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(0, lcid, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pti->Invoke(
- (IMediaEvent *)this,
- dispidMember,
- wFlags,
- pdispparams,
- pvarResult,
- pexcepinfo,
- puArgErr);
+ (IMediaEvent *)this,
+ dispidMember,
+ wFlags,
+ pdispparams,
+ pvarResult,
+ pexcepinfo,
+ puArgErr);
pti->Release();
return hr;
@@ -390,7 +369,7 @@ CMediaEvent::Invoke(
// --- CMediaPosition implementation ----------
-CMediaPosition::CMediaPosition(__in_opt LPCTSTR name, __in_opt LPUNKNOWN pUnk) :
+CMediaPosition::CMediaPosition(__in_opt LPCTSTR name,__in_opt LPUNKNOWN pUnk) :
CUnknown(name, pUnk)
{
}
@@ -409,14 +388,11 @@ CMediaPosition::CMediaPosition(__in_opt LPCTSTR name,
STDMETHODIMP
CMediaPosition::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IMediaPosition)
- {
- return GetInterface((IMediaPosition *) this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IMediaPosition) {
+ return GetInterface( (IMediaPosition *) this, ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -434,68 +410,66 @@ CMediaPosition::GetTypeInfoCount(__out UINT * pctinfo)
STDMETHODIMP
CMediaPosition::GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
return m_basedisp.GetTypeInfo(
- IID_IMediaPosition,
- itinfo,
- lcid,
- pptinfo);
+ IID_IMediaPosition,
+ itinfo,
+ lcid,
+ pptinfo);
}
STDMETHODIMP
CMediaPosition::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
return m_basedisp.GetIDsOfNames(
- IID_IMediaPosition,
- rgszNames,
- cNames,
- lcid,
- rgdispid);
+ IID_IMediaPosition,
+ rgszNames,
+ cNames,
+ lcid,
+ rgdispid);
}
STDMETHODIMP
CMediaPosition::Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr)
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr)
{
// this parameter is a dead leftover from an earlier interface
- if(IID_NULL != riid)
- {
- return DISP_E_UNKNOWNINTERFACE;
+ if (IID_NULL != riid) {
+ return DISP_E_UNKNOWNINTERFACE;
}
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(0, lcid, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pti->Invoke(
- (IMediaPosition *)this,
- dispidMember,
- wFlags,
- pdispparams,
- pvarResult,
- pexcepinfo,
- puArgErr);
+ (IMediaPosition *)this,
+ dispidMember,
+ wFlags,
+ pdispparams,
+ pvarResult,
+ pexcepinfo,
+ puArgErr);
pti->Release();
return hr;
@@ -506,16 +480,15 @@ CMediaPosition::Invoke(
CPosPassThru::CPosPassThru(__in_opt LPCTSTR pName,
- __in_opt LPUNKNOWN pUnk,
- __inout HRESULT *phr,
- IPin *pPin) :
- CMediaPosition(pName, pUnk),
+ __in_opt LPUNKNOWN pUnk,
+ __inout HRESULT *phr,
+ IPin *pPin) :
+ CMediaPosition(pName,pUnk),
m_pPin(pPin)
{
- if(pPin == NULL)
- {
- *phr = E_POINTER;
- return;
+ if (pPin == NULL) {
+ *phr = E_POINTER;
+ return;
}
}
@@ -523,16 +496,15 @@ CPosPassThru::CPosPassThru(__in_opt LPCTSTR pName,
// Expose our IMediaSeeking and IMediaPosition interfaces
STDMETHODIMP
-CPosPassThru::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
+CPosPassThru::NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv,E_POINTER);
*ppv = NULL;
- if(riid == IID_IMediaSeeking)
- {
- return GetInterface(static_cast<IMediaSeeking *>(this), ppv);
+ if (riid == IID_IMediaSeeking) {
+ return GetInterface( static_cast<IMediaSeeking *>(this), ppv);
}
- return CMediaPosition::NonDelegatingQueryInterface(riid, ppv);
+ return CMediaPosition::NonDelegatingQueryInterface(riid,ppv);
}
@@ -545,16 +517,14 @@ CPosPassThru::GetPeer(IMediaPosition ** ppMP)
IPin *pConnected;
HRESULT hr = m_pPin->ConnectedTo(&pConnected);
- if(FAILED(hr))
- {
- return E_NOTIMPL;
+ if (FAILED(hr)) {
+ return E_NOTIMPL;
}
IMediaPosition * pMP;
hr = pConnected->QueryInterface(IID_IMediaPosition, (void **) &pMP);
pConnected->Release();
- if(FAILED(hr))
- {
- return E_NOTIMPL;
+ if (FAILED(hr)) {
+ return E_NOTIMPL;
}
*ppMP = pMP;
@@ -571,16 +541,14 @@ CPosPassThru::GetPeerSeeking(__deref_out IMediaSeeking ** ppMS)
IPin *pConnected;
HRESULT hr = m_pPin->ConnectedTo(&pConnected);
- if(FAILED(hr))
- {
- return E_NOTIMPL;
+ if (FAILED(hr)) {
+ return E_NOTIMPL;
}
IMediaSeeking * pMS;
hr = pConnected->QueryInterface(IID_IMediaSeeking, (void **) &pMS);
pConnected->Release();
- if(FAILED(hr))
- {
- return E_NOTIMPL;
+ if (FAILED(hr)) {
+ return E_NOTIMPL;
}
*ppMS = pMS;
@@ -596,9 +564,8 @@ CPosPassThru::GetCapabilities(__out DWORD * pCaps)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->GetCapabilities(pCaps);
@@ -611,9 +578,8 @@ CPosPassThru::CheckCapabilities(__inout DWORD * pCaps)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->CheckCapabilities(pCaps);
@@ -626,9 +592,8 @@ CPosPassThru::IsFormatSupported(const GUID * pFormat)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->IsFormatSupported(pFormat);
@@ -642,9 +607,8 @@ CPosPassThru::QueryPreferredFormat(__out GUID *pFormat)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->QueryPreferredFormat(pFormat);
@@ -658,9 +622,8 @@ CPosPassThru::SetTimeFormat(const GUID * pFormat)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->SetTimeFormat(pFormat);
@@ -674,9 +637,8 @@ CPosPassThru::GetTimeFormat(__out GUID *pFormat)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->GetTimeFormat(pFormat);
@@ -690,9 +652,8 @@ CPosPassThru::IsUsingTimeFormat(const GUID * pFormat)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->IsUsingTimeFormat(pFormat);
@@ -702,38 +663,36 @@ CPosPassThru::IsUsingTimeFormat(const GUID * pFormat)
STDMETHODIMP
-CPosPassThru::ConvertTimeFormat(__out LONGLONG * pTarget,
+CPosPassThru::ConvertTimeFormat(__out LONGLONG * pTarget,
__in_opt const GUID * pTargetFormat,
- LONGLONG Source,
- __in_opt const GUID * pSourceFormat)
+ LONGLONG Source,
+ __in_opt const GUID * pSourceFormat )
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
- hr = pMS->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat);
+ hr = pMS->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat );
pMS->Release();
return hr;
}
STDMETHODIMP
-CPosPassThru::SetPositions(__inout_opt LONGLONG * pCurrent,
- DWORD CurrentFlags,
- __inout_opt LONGLONG * pStop,
- DWORD StopFlags)
+CPosPassThru::SetPositions( __inout_opt LONGLONG * pCurrent,
+ DWORD CurrentFlags,
+ __inout_opt LONGLONG * pStop,
+ DWORD StopFlags )
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
- hr = pMS->SetPositions(pCurrent, CurrentFlags, pStop, StopFlags);
+ hr = pMS->SetPositions(pCurrent, CurrentFlags, pStop, StopFlags );
pMS->Release();
return hr;
}
@@ -743,28 +702,27 @@ CPosPassThru::GetPositions(__out_opt LONGLONG *pCurrent, __out_opt LONGLONG * pS
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
- hr = pMS->GetPositions(pCurrent, pStop);
+ hr = pMS->GetPositions(pCurrent,pStop);
pMS->Release();
return hr;
}
HRESULT
CPosPassThru::GetSeekingLongLong
-(HRESULT(__stdcall IMediaSeeking::*pMethod)(__out LONGLONG *)
- , LONGLONG * pll
+( HRESULT (__stdcall IMediaSeeking::*pMethod)( __out LONGLONG * )
+, LONGLONG * pll
)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
- hr = (pMS->*pMethod)(pll);
- pMS->Release();
+ hr = (pMS->*pMethod)(pll);
+ pMS->Release();
}
return hr;
}
@@ -775,9 +733,9 @@ STDMETHODIMP
CPosPassThru::GetCurrentPosition(__out LONGLONG *pCurrent)
{
// Can we report the current position
- HRESULT hr = GetMediaTime(pCurrent, NULL);
- if(SUCCEEDED(hr)) hr = NOERROR;
- else hr = GetSeekingLongLong(&IMediaSeeking::GetCurrentPosition, pCurrent);
+ HRESULT hr = GetMediaTime(pCurrent,NULL);
+ if (SUCCEEDED(hr)) hr = NOERROR;
+ else hr = GetSeekingLongLong( &IMediaSeeking::GetCurrentPosition, pCurrent );
return hr;
}
@@ -785,34 +743,33 @@ CPosPassThru::GetCurrentPosition(__out LONGLONG *pCurrent)
STDMETHODIMP
CPosPassThru::GetStopPosition(__out LONGLONG *pStop)
{
- return GetSeekingLongLong(&IMediaSeeking::GetStopPosition, pStop);;
+ return GetSeekingLongLong( &IMediaSeeking::GetStopPosition, pStop );;
}
STDMETHODIMP
CPosPassThru::GetDuration(__out LONGLONG *pDuration)
{
- return GetSeekingLongLong(&IMediaSeeking::GetDuration, pDuration);;
+ return GetSeekingLongLong( &IMediaSeeking::GetDuration, pDuration );;
}
STDMETHODIMP
CPosPassThru::GetPreroll(__out LONGLONG *pllPreroll)
{
- return GetSeekingLongLong(&IMediaSeeking::GetPreroll, pllPreroll);;
+ return GetSeekingLongLong( &IMediaSeeking::GetPreroll, pllPreroll );;
}
STDMETHODIMP
-CPosPassThru::GetAvailable(__out_opt LONGLONG *pEarliest, __out_opt LONGLONG *pLatest)
+CPosPassThru::GetAvailable( __out_opt LONGLONG *pEarliest, __out_opt LONGLONG *pLatest )
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
- hr = pMS->GetAvailable(pEarliest, pLatest);
+ hr = pMS->GetAvailable( pEarliest, pLatest );
pMS->Release();
return hr;
}
@@ -823,9 +780,8 @@ CPosPassThru::GetRate(__out double * pdRate)
{
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->GetRate(pdRate);
pMS->Release();
@@ -836,16 +792,14 @@ CPosPassThru::GetRate(__out double * pdRate)
STDMETHODIMP
CPosPassThru::SetRate(double dRate)
{
- if(0.0 == dRate)
- {
- return E_INVALIDARG;
+ if (0.0 == dRate) {
+ return E_INVALIDARG;
}
IMediaSeeking* pMS;
HRESULT hr = GetPeerSeeking(&pMS);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMS->SetRate(dRate);
pMS->Release();
@@ -863,9 +817,8 @@ CPosPassThru::get_Duration(__out REFTIME * plength)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->get_Duration(plength);
@@ -879,9 +832,8 @@ CPosPassThru::get_CurrentPosition(__out REFTIME * pllTime)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->get_CurrentPosition(pllTime);
pMP->Release();
@@ -894,9 +846,8 @@ CPosPassThru::put_CurrentPosition(REFTIME llTime)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->put_CurrentPosition(llTime);
pMP->Release();
@@ -909,9 +860,8 @@ CPosPassThru::get_StopTime(__out REFTIME * pllTime)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->get_StopTime(pllTime);
pMP->Release();
@@ -924,9 +874,8 @@ CPosPassThru::put_StopTime(REFTIME llTime)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->put_StopTime(llTime);
pMP->Release();
@@ -939,9 +888,8 @@ CPosPassThru::get_PrerollTime(__out REFTIME * pllTime)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->get_PrerollTime(pllTime);
pMP->Release();
@@ -954,9 +902,8 @@ CPosPassThru::put_PrerollTime(REFTIME llTime)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->put_PrerollTime(llTime);
pMP->Release();
@@ -969,9 +916,8 @@ CPosPassThru::get_Rate(__out double * pdRate)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->get_Rate(pdRate);
pMP->Release();
@@ -982,16 +928,14 @@ CPosPassThru::get_Rate(__out double * pdRate)
STDMETHODIMP
CPosPassThru::put_Rate(double dRate)
{
- if(0.0 == dRate)
- {
- return E_INVALIDARG;
+ if (0.0 == dRate) {
+ return E_INVALIDARG;
}
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->put_Rate(dRate);
pMP->Release();
@@ -1004,9 +948,8 @@ CPosPassThru::CanSeekForward(__out LONG *pCanSeekForward)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->CanSeekForward(pCanSeekForward);
pMP->Release();
@@ -1019,9 +962,8 @@ CPosPassThru::CanSeekBackward(__out LONG *pCanSeekBackward)
{
IMediaPosition* pMP;
HRESULT hr = GetPeer(&pMP);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pMP->CanSeekBackward(pCanSeekBackward);
pMP->Release();
@@ -1039,10 +981,10 @@ CPosPassThru::CanSeekBackward(__out LONG *pCanSeekBackward)
// store the media times internally and return them in GetCurrentPosition.
CRendererPosPassThru::CRendererPosPassThru(__in_opt LPCTSTR pName,
- __in_opt LPUNKNOWN pUnk,
- __inout HRESULT *phr,
- IPin *pPin) :
- CPosPassThru(pName, pUnk, phr, pPin),
+ __in_opt LPUNKNOWN pUnk,
+ __inout HRESULT *phr,
+ IPin *pPin) :
+ CPosPassThru(pName,pUnk,phr,pPin),
m_StartMedia(0),
m_EndMedia(0),
m_bReset(TRUE)
@@ -1063,11 +1005,11 @@ CRendererPosPassThru::RegisterMediaTime(IMediaSample *pMediaSample)
// Get the media times from the sample
- HRESULT hr = pMediaSample->GetTime(&StartMedia, &EndMedia);
- if(FAILED(hr))
+ HRESULT hr = pMediaSample->GetTime(&StartMedia,&EndMedia);
+ if (FAILED(hr))
{
- ASSERT(hr == VFW_E_SAMPLE_TIME_NOT_SET);
- return hr;
+ ASSERT(hr == VFW_E_SAMPLE_TIME_NOT_SET);
+ return hr;
}
m_StartMedia = StartMedia;
@@ -1080,7 +1022,7 @@ CRendererPosPassThru::RegisterMediaTime(IMediaSample *pMediaSample)
// Sets the media times the object should report
HRESULT
-CRendererPosPassThru::RegisterMediaTime(LONGLONG StartTime, LONGLONG EndTime)
+CRendererPosPassThru::RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime)
{
CAutoLock cAutoLock(&m_PositionLock);
m_StartMedia = StartTime;
@@ -1098,17 +1040,15 @@ CRendererPosPassThru::GetMediaTime(__out LONGLONG *pStartTime, __out_opt LONGLON
ASSERT(pStartTime);
CAutoLock cAutoLock(&m_PositionLock);
- if(m_bReset == TRUE)
- {
- return E_FAIL;
+ if (m_bReset == TRUE) {
+ return E_FAIL;
}
// We don't have to return the end time
- HRESULT hr = ConvertTimeFormat(pStartTime, 0, m_StartMedia, &TIME_FORMAT_MEDIA_TIME);
- if(pEndTime && SUCCEEDED(hr))
- {
- hr = ConvertTimeFormat(pEndTime, 0, m_EndMedia, &TIME_FORMAT_MEDIA_TIME);
+ HRESULT hr = ConvertTimeFormat( pStartTime, 0, m_StartMedia, &TIME_FORMAT_MEDIA_TIME );
+ if (pEndTime && SUCCEEDED(hr)) {
+ hr = ConvertTimeFormat( pEndTime, 0, m_EndMedia, &TIME_FORMAT_MEDIA_TIME );
}
return hr;
}
@@ -1134,16 +1074,16 @@ CRendererPosPassThru::EOS()
{
HRESULT hr;
- if(m_bReset == TRUE) hr = E_FAIL;
+ if ( m_bReset == TRUE ) hr = E_FAIL;
else
{
- LONGLONG llStop;
- if SUCCEEDED(hr = GetStopPosition(&llStop))
- {
- CAutoLock cAutoLock(&m_PositionLock);
- m_StartMedia =
- m_EndMedia = llStop;
- }
+ LONGLONG llStop;
+ if SUCCEEDED(hr=GetStopPosition(&llStop))
+ {
+ CAutoLock cAutoLock(&m_PositionLock);
+ m_StartMedia =
+ m_EndMedia = llStop;
+ }
}
return hr;
}
@@ -1155,30 +1095,28 @@ CSourceSeeking::CSourceSeeking(
__in_opt LPUNKNOWN pUnk,
__inout HRESULT* phr,
__in CCritSec * pLock) :
- CUnknown(pName, pUnk),
- m_pLock(pLock),
- m_rtStart((long)0)
+ CUnknown(pName, pUnk),
+ m_pLock(pLock),
+ m_rtStart((long)0)
{
m_rtStop = _I64_MAX / 2;
m_rtDuration = m_rtStop;
m_dRateSeeking = 1.0;
m_dwSeekingCaps = AM_SEEKING_CanSeekForwards
- | AM_SEEKING_CanSeekBackwards
- | AM_SEEKING_CanSeekAbsolute
- | AM_SEEKING_CanGetStopPos
- | AM_SEEKING_CanGetDuration;
+ | AM_SEEKING_CanSeekBackwards
+ | AM_SEEKING_CanSeekAbsolute
+ | AM_SEEKING_CanGetStopPos
+ | AM_SEEKING_CanGetDuration;
}
HRESULT CSourceSeeking::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- if(riid == IID_IMediaSeeking)
- {
+ if(riid == IID_IMediaSeeking) {
CheckPointer(ppv, E_POINTER);
return GetInterface(static_cast<IMediaSeeking *>(this), ppv);
}
- else
- {
+ else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -1242,14 +1180,14 @@ HRESULT CSourceSeeking::GetCurrentPosition(__out LONGLONG *pCurrent)
return E_NOTIMPL;
}
-HRESULT CSourceSeeking::GetCapabilities(__out DWORD * pCapabilities)
+HRESULT CSourceSeeking::GetCapabilities( __out DWORD * pCapabilities )
{
CheckPointer(pCapabilities, E_POINTER);
*pCapabilities = m_dwSeekingCaps;
return S_OK;
}
-HRESULT CSourceSeeking::CheckCapabilities(__inout DWORD * pCapabilities)
+HRESULT CSourceSeeking::CheckCapabilities( __inout DWORD * pCapabilities )
{
CheckPointer(pCapabilities, E_POINTER);
@@ -1257,10 +1195,10 @@ HRESULT CSourceSeeking::CheckCapabilities(__inout DWORD * pCapabilities)
return (~m_dwSeekingCaps & *pCapabilities) ? S_FALSE : S_OK;
}
-HRESULT CSourceSeeking::ConvertTimeFormat(__out LONGLONG * pTarget,
- __in_opt const GUID * pTargetFormat,
- LONGLONG Source,
- __in_opt const GUID * pSourceFormat)
+HRESULT CSourceSeeking::ConvertTimeFormat( __out LONGLONG * pTarget,
+ __in_opt const GUID * pTargetFormat,
+ LONGLONG Source,
+ __in_opt const GUID * pSourceFormat )
{
CheckPointer(pTarget, E_POINTER);
// format guids can be null to indicate current format
@@ -1280,31 +1218,27 @@ HRESULT CSourceSeeking::ConvertTimeFormat(__out LONGLONG * pTarget,
}
-HRESULT CSourceSeeking::SetPositions(__inout_opt LONGLONG * pCurrent,
- DWORD CurrentFlags,
- __inout_opt LONGLONG * pStop,
- DWORD StopFlags)
+HRESULT CSourceSeeking::SetPositions( __inout_opt LONGLONG * pCurrent,
+ DWORD CurrentFlags,
+ __inout_opt LONGLONG * pStop,
+ DWORD StopFlags )
{
DWORD StopPosBits = StopFlags & AM_SEEKING_PositioningBitsMask;
DWORD StartPosBits = CurrentFlags & AM_SEEKING_PositioningBitsMask;
- if(StopFlags)
- {
+ if(StopFlags) {
CheckPointer(pStop, E_POINTER);
// accept only relative, incremental, or absolute positioning
- if(StopPosBits != StopFlags)
- {
+ if(StopPosBits != StopFlags) {
return E_INVALIDARG;
}
}
- if(CurrentFlags)
- {
+ if(CurrentFlags) {
CheckPointer(pCurrent, E_POINTER);
if(StartPosBits != AM_SEEKING_AbsolutePositioning &&
- StartPosBits != AM_SEEKING_RelativePositioning)
- {
+ StartPosBits != AM_SEEKING_RelativePositioning) {
return E_INVALIDARG;
}
}
@@ -1341,12 +1275,10 @@ HRESULT CSourceSeeking::SetPositions(__inout_opt LONGLONG * pCurrent,
HRESULT hr = S_OK;
- if(SUCCEEDED(hr) && StopPosBits)
- {
+ if(SUCCEEDED(hr) && StopPosBits) {
hr = ChangeStop();
}
- if(StartPosBits)
- {
+ if(StartPosBits) {
hr = ChangeStart();
}
@@ -1354,14 +1286,12 @@ HRESULT CSourceSeeking::SetPositions(__inout_opt LONGLONG * pCurrent,
}
-HRESULT CSourceSeeking::GetPositions(__out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop)
+HRESULT CSourceSeeking::GetPositions( __out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop )
{
- if(pCurrent)
- {
+ if(pCurrent) {
*pCurrent = m_rtStart;
}
- if(pStop)
- {
+ if(pStop) {
*pStop = m_rtStop;
}
@@ -1369,21 +1299,19 @@ HRESULT CSourceSeeking::GetPositions(__out_opt LONGLONG * pCurrent, __out_opt LO
}
-HRESULT CSourceSeeking::GetAvailable(__out_opt LONGLONG * pEarliest, __out_opt LONGLONG * pLatest)
+HRESULT CSourceSeeking::GetAvailable( __out_opt LONGLONG * pEarliest, __out_opt LONGLONG * pLatest )
{
- if(pEarliest)
- {
+ if(pEarliest) {
*pEarliest = 0;
}
- if(pLatest)
- {
+ if(pLatest) {
CAutoLock lock(m_pLock);
*pLatest = m_rtDuration;
}
return S_OK;
}
-HRESULT CSourceSeeking::SetRate(double dRate)
+HRESULT CSourceSeeking::SetRate( double dRate)
{
{
CAutoLock lock(m_pLock);
@@ -1392,7 +1320,7 @@ HRESULT CSourceSeeking::SetRate(double dRate)
return ChangeRate();
}
-HRESULT CSourceSeeking::GetRate(__out double * pdRate)
+HRESULT CSourceSeeking::GetRate( __out double * pdRate)
{
CheckPointer(pdRate, E_POINTER);
CAutoLock lock(m_pLock);
@@ -1415,9 +1343,9 @@ HRESULT CSourceSeeking::GetPreroll(__out LONGLONG *pPreroll)
CSourcePosition::CSourcePosition(__in_opt LPCTSTR pName,
- __in_opt LPUNKNOWN pUnk,
- __inout HRESULT* phr,
- __in CCritSec * pLock) :
+ __in_opt LPUNKNOWN pUnk,
+ __inout HRESULT* phr,
+ __in CCritSec * pLock) :
CMediaPosition(pName, pUnk),
m_pLock(pLock),
m_Start(CRefTime((LONGLONG)0))
@@ -1430,8 +1358,8 @@ CSourcePosition::CSourcePosition(__in_opt LPCTSTR pName,
STDMETHODIMP
CSourcePosition::get_Duration(__out REFTIME * plength)
{
- CheckPointer(plength, E_POINTER);
- ValidateReadWritePtr(plength, sizeof(REFTIME));
+ CheckPointer(plength,E_POINTER);
+ ValidateReadWritePtr(plength,sizeof(REFTIME));
CAutoLock lock(m_pLock);
*plength = m_Duration;
@@ -1453,8 +1381,8 @@ CSourcePosition::put_CurrentPosition(REFTIME llTime)
STDMETHODIMP
CSourcePosition::get_StopTime(__out REFTIME * pllTime)
{
- CheckPointer(pllTime, E_POINTER);
- ValidateReadWritePtr(pllTime, sizeof(REFTIME));
+ CheckPointer(pllTime,E_POINTER);
+ ValidateReadWritePtr(pllTime,sizeof(REFTIME));
CAutoLock lock(m_pLock);
*pllTime = m_Stop;
@@ -1476,8 +1404,8 @@ CSourcePosition::put_StopTime(REFTIME llTime)
STDMETHODIMP
CSourcePosition::get_PrerollTime(__out REFTIME * pllTime)
{
- CheckPointer(pllTime, E_POINTER);
- ValidateReadWritePtr(pllTime, sizeof(REFTIME));
+ CheckPointer(pllTime,E_POINTER);
+ ValidateReadWritePtr(pllTime,sizeof(REFTIME));
return E_NOTIMPL;
}
@@ -1492,8 +1420,8 @@ CSourcePosition::put_PrerollTime(REFTIME llTime)
STDMETHODIMP
CSourcePosition::get_Rate(__out double * pdRate)
{
- CheckPointer(pdRate, E_POINTER);
- ValidateReadWritePtr(pdRate, sizeof(double));
+ CheckPointer(pdRate,E_POINTER);
+ ValidateReadWritePtr(pdRate,sizeof(double));
CAutoLock lock(m_pLock);
*pdRate = m_Rate;
@@ -1517,7 +1445,7 @@ CSourcePosition::put_Rate(double dRate)
STDMETHODIMP
CSourcePosition::CanSeekForward(__out LONG *pCanSeekForward)
{
- CheckPointer(pCanSeekForward, E_POINTER);
+ CheckPointer(pCanSeekForward,E_POINTER);
*pCanSeekForward = OATRUE;
return S_OK;
}
@@ -1528,7 +1456,7 @@ CSourcePosition::CanSeekForward(__out LONG *pCanSeekForward)
STDMETHODIMP
CSourcePosition::CanSeekBackward(__out LONG *pCanSeekBackward)
{
- CheckPointer(pCanSeekBackward, E_POINTER);
+ CheckPointer(pCanSeekBackward,E_POINTER);
*pCanSeekBackward = OATRUE;
return S_OK;
}
@@ -1537,7 +1465,7 @@ CSourcePosition::CanSeekBackward(__out LONG *pCanSeekBackward)
// --- Implementation of CBasicAudio class ----------
-CBasicAudio::CBasicAudio(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN punk) :
+CBasicAudio::CBasicAudio(__in_opt LPCTSTR pName,__in_opt LPUNKNOWN punk) :
CUnknown(pName, punk)
{
}
@@ -1547,14 +1475,11 @@ CBasicAudio::CBasicAudio(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN punk) :
STDMETHODIMP
CBasicAudio::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IBasicAudio)
- {
- return GetInterface((IBasicAudio *) this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IBasicAudio) {
+ return GetInterface( (IBasicAudio *) this, ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -1568,68 +1493,66 @@ CBasicAudio::GetTypeInfoCount(__out UINT * pctinfo)
STDMETHODIMP
CBasicAudio::GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
return m_basedisp.GetTypeInfo(
- IID_IBasicAudio,
- itinfo,
- lcid,
- pptinfo);
+ IID_IBasicAudio,
+ itinfo,
+ lcid,
+ pptinfo);
}
STDMETHODIMP
CBasicAudio::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
return m_basedisp.GetIDsOfNames(
- IID_IBasicAudio,
- rgszNames,
- cNames,
- lcid,
- rgdispid);
+ IID_IBasicAudio,
+ rgszNames,
+ cNames,
+ lcid,
+ rgdispid);
}
STDMETHODIMP
CBasicAudio::Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr)
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr)
{
// this parameter is a dead leftover from an earlier interface
- if(IID_NULL != riid)
- {
- return DISP_E_UNKNOWNINTERFACE;
+ if (IID_NULL != riid) {
+ return DISP_E_UNKNOWNINTERFACE;
}
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(0, lcid, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pti->Invoke(
- (IBasicAudio *)this,
- dispidMember,
- wFlags,
- pdispparams,
- pvarResult,
- pexcepinfo,
- puArgErr);
+ (IBasicAudio *)this,
+ dispidMember,
+ wFlags,
+ pdispparams,
+ pvarResult,
+ pexcepinfo,
+ puArgErr);
pti->Release();
return hr;
@@ -1638,7 +1561,7 @@ CBasicAudio::Invoke(
// --- IVideoWindow implementation ----------
-CBaseVideoWindow::CBaseVideoWindow(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN punk) :
+CBaseVideoWindow::CBaseVideoWindow(__in_opt LPCTSTR pName,__in_opt LPUNKNOWN punk) :
CUnknown(pName, punk)
{
}
@@ -1649,14 +1572,11 @@ CBaseVideoWindow::CBaseVideoWindow(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN pu
STDMETHODIMP
CBaseVideoWindow::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IVideoWindow)
- {
- return GetInterface((IVideoWindow *) this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IVideoWindow) {
+ return GetInterface( (IVideoWindow *) this, ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -1670,68 +1590,66 @@ CBaseVideoWindow::GetTypeInfoCount(__out UINT * pctinfo)
STDMETHODIMP
CBaseVideoWindow::GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
return m_basedisp.GetTypeInfo(
- IID_IVideoWindow,
- itinfo,
- lcid,
- pptinfo);
+ IID_IVideoWindow,
+ itinfo,
+ lcid,
+ pptinfo);
}
STDMETHODIMP
CBaseVideoWindow::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
return m_basedisp.GetIDsOfNames(
- IID_IVideoWindow,
- rgszNames,
- cNames,
- lcid,
- rgdispid);
+ IID_IVideoWindow,
+ rgszNames,
+ cNames,
+ lcid,
+ rgdispid);
}
STDMETHODIMP
CBaseVideoWindow::Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr)
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr)
{
// this parameter is a dead leftover from an earlier interface
- if(IID_NULL != riid)
- {
- return DISP_E_UNKNOWNINTERFACE;
+ if (IID_NULL != riid) {
+ return DISP_E_UNKNOWNINTERFACE;
}
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(0, lcid, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pti->Invoke(
- (IVideoWindow *)this,
- dispidMember,
- wFlags,
- pdispparams,
- pvarResult,
- pexcepinfo,
- puArgErr);
+ (IVideoWindow *)this,
+ dispidMember,
+ wFlags,
+ pdispparams,
+ pvarResult,
+ pexcepinfo,
+ puArgErr);
pti->Release();
return hr;
@@ -1741,7 +1659,7 @@ CBaseVideoWindow::Invoke(
// --- IBasicVideo implementation ----------
-CBaseBasicVideo::CBaseBasicVideo(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN punk) :
+CBaseBasicVideo::CBaseBasicVideo(__in_opt LPCTSTR pName,__in_opt LPUNKNOWN punk) :
CUnknown(pName, punk)
{
}
@@ -1752,14 +1670,11 @@ CBaseBasicVideo::CBaseBasicVideo(__in_opt LPCTSTR pName, __in_opt LPUNKNOWN punk
STDMETHODIMP
CBaseBasicVideo::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IBasicVideo || riid == IID_IBasicVideo2)
- {
- return GetInterface(static_cast<IBasicVideo2 *>(this), ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IBasicVideo || riid == IID_IBasicVideo2) {
+ return GetInterface( static_cast<IBasicVideo2 *>(this), ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -1773,68 +1688,66 @@ CBaseBasicVideo::GetTypeInfoCount(__out UINT * pctinfo)
STDMETHODIMP
CBaseBasicVideo::GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo)
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo)
{
return m_basedisp.GetTypeInfo(
- IID_IBasicVideo,
- itinfo,
- lcid,
- pptinfo);
+ IID_IBasicVideo,
+ itinfo,
+ lcid,
+ pptinfo);
}
STDMETHODIMP
CBaseBasicVideo::GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid)
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid)
{
return m_basedisp.GetIDsOfNames(
- IID_IBasicVideo,
- rgszNames,
- cNames,
- lcid,
- rgdispid);
+ IID_IBasicVideo,
+ rgszNames,
+ cNames,
+ lcid,
+ rgdispid);
}
STDMETHODIMP
CBaseBasicVideo::Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr)
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr)
{
// this parameter is a dead leftover from an earlier interface
- if(IID_NULL != riid)
- {
- return DISP_E_UNKNOWNINTERFACE;
+ if (IID_NULL != riid) {
+ return DISP_E_UNKNOWNINTERFACE;
}
ITypeInfo * pti;
HRESULT hr = GetTypeInfo(0, lcid, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
hr = pti->Invoke(
- (IBasicVideo *)this,
- dispidMember,
- wFlags,
- pdispparams,
- pvarResult,
- pexcepinfo,
- puArgErr);
+ (IBasicVideo *)this,
+ dispidMember,
+ wFlags,
+ pdispparams,
+ pvarResult,
+ pexcepinfo,
+ puArgErr);
pti->Release();
return hr;
@@ -1846,123 +1759,109 @@ CBaseBasicVideo::Invoke(
CDispParams::CDispParams(UINT nArgs, __in_ecount(nArgs) VARIANT* pArgs, __inout_opt HRESULT *phr)
{
- cNamedArgs = 0;
- rgdispidNamedArgs = NULL;
- cArgs = nArgs;
+ cNamedArgs = 0;
+ rgdispidNamedArgs = NULL;
+ cArgs = nArgs;
- if(cArgs)
- {
- rgvarg = new VARIANT[cArgs];
- if(NULL == rgvarg)
- {
+ if (cArgs) {
+ rgvarg = new VARIANT[cArgs];
+ if (NULL == rgvarg) {
cArgs = 0;
- if(phr)
- {
+ if (phr) {
*phr = E_OUTOFMEMORY;
}
return;
}
- for(UINT i = 0; i < cArgs; i++)
- {
+ for (UINT i = 0; i < cArgs; i++) {
// Why aren't we using VariantCopy?
- VARIANT * pDest = &rgvarg[i];
- VARIANT * pSrc = &pArgs[i];
+ VARIANT * pDest = &rgvarg[i];
+ VARIANT * pSrc = &pArgs[i];
- pDest->vt = pSrc->vt;
- switch(pDest->vt)
- {
+ pDest->vt = pSrc->vt;
+ switch(pDest->vt) {
- case VT_I4:
- pDest->lVal = pSrc->lVal;
- break;
+ case VT_I4:
+ pDest->lVal = pSrc->lVal;
+ break;
- case VT_UI1:
- pDest->bVal = pSrc->bVal;
- break;
+ case VT_UI1:
+ pDest->bVal = pSrc->bVal;
+ break;
- case VT_I2:
- pDest->iVal = pSrc->iVal;
- break;
+ case VT_I2:
+ pDest->iVal = pSrc->iVal;
+ break;
- case VT_R4:
- pDest->fltVal = pSrc->fltVal;
- break;
+ case VT_R4:
+ pDest->fltVal = pSrc->fltVal;
+ break;
- case VT_R8:
- pDest->dblVal = pSrc->dblVal;
- break;
+ case VT_R8:
+ pDest->dblVal = pSrc->dblVal;
+ break;
- case VT_BOOL:
- pDest->boolVal = pSrc->boolVal;
- break;
+ case VT_BOOL:
+ pDest->boolVal = pSrc->boolVal;
+ break;
- case VT_ERROR:
- pDest->scode = pSrc->scode;
- break;
+ case VT_ERROR:
+ pDest->scode = pSrc->scode;
+ break;
- case VT_CY:
- pDest->cyVal = pSrc->cyVal;
- break;
+ case VT_CY:
+ pDest->cyVal = pSrc->cyVal;
+ break;
- case VT_DATE:
- pDest->date = pSrc->date;
- break;
+ case VT_DATE:
+ pDest->date = pSrc->date;
+ break;
- case VT_BSTR:
- if((PVOID)pSrc->bstrVal == NULL)
- {
- pDest->bstrVal = NULL;
- }
- else
- {
-
- // a BSTR is a WORD followed by a UNICODE string.
- // the pointer points just after the WORD
-
- WORD len = * (WORD*)(pSrc->bstrVal - (sizeof(WORD) / sizeof(OLECHAR)));
- OLECHAR* pch = new OLECHAR[len + (sizeof(WORD)/sizeof(OLECHAR))];
- if(pch)
- {
- WORD *pui = (WORD*)pch;
- *pui = len;
- pDest->bstrVal = pch + (sizeof(WORD) / sizeof(OLECHAR));
- CopyMemory(pDest->bstrVal, pSrc->bstrVal, len * sizeof(OLECHAR));
- }
- else
- {
+ case VT_BSTR:
+ if ((PVOID)pSrc->bstrVal == NULL) {
+ pDest->bstrVal = NULL;
+ } else {
+
+ // a BSTR is a WORD followed by a UNICODE string.
+ // the pointer points just after the WORD
+
+ WORD len = * (WORD*) (pSrc->bstrVal - (sizeof(WORD) / sizeof(OLECHAR)));
+ OLECHAR* pch = new OLECHAR[len + (sizeof(WORD)/sizeof(OLECHAR))];
+ if (pch) {
+ WORD *pui = (WORD*)pch;
+ *pui = len;
+ pDest->bstrVal = pch + (sizeof(WORD)/sizeof(OLECHAR));
+ CopyMemory(pDest->bstrVal, pSrc->bstrVal, len*sizeof(OLECHAR));
+ } else {
cArgs = i;
- if(phr)
- {
+ if (phr) {
*phr = E_OUTOFMEMORY;
}
}
- }
- break;
-
- case VT_UNKNOWN:
- pDest->punkVal = pSrc->punkVal;
- pDest->punkVal->AddRef();
- break;
-
- case VT_DISPATCH:
- pDest->pdispVal = pSrc->pdispVal;
- pDest->pdispVal->AddRef();
- break;
-
- default:
- // a type we haven't got round to adding yet!
- ASSERT(0);
- break;
- }
- }
+ }
+ break;
- }
- else
- {
- rgvarg = NULL;
+ case VT_UNKNOWN:
+ pDest->punkVal = pSrc->punkVal;
+ pDest->punkVal->AddRef();
+ break;
+
+ case VT_DISPATCH:
+ pDest->pdispVal = pSrc->pdispVal;
+ pDest->pdispVal->AddRef();
+ break;
+
+ default:
+ // a type we haven't got round to adding yet!
+ ASSERT(0);
+ break;
+ }
+ }
+
+ } else {
+ rgvarg = NULL;
}
}
@@ -1970,27 +1869,24 @@ CDispParams::CDispParams(UINT nArgs, __in_ecount(nArgs) VARIANT* pArgs, __inout_
CDispParams::~CDispParams()
{
- for(UINT i = 0; i < cArgs; i++)
- {
- switch(rgvarg[i].vt)
- {
+ for (UINT i = 0; i < cArgs; i++) {
+ switch(rgvarg[i].vt) {
case VT_BSTR:
// Explicitly cast BSTR to PVOID to tell code scanning tools we really mean to test the pointer
- if((PVOID)rgvarg[i].bstrVal != NULL)
- {
- OLECHAR * pch = rgvarg[i].bstrVal - (sizeof(WORD) / sizeof(OLECHAR));
- delete pch;
- }
- break;
+ if ((PVOID)rgvarg[i].bstrVal != NULL) {
+ OLECHAR * pch = rgvarg[i].bstrVal - (sizeof(WORD)/sizeof(OLECHAR));
+ delete pch;
+ }
+ break;
- case VT_UNKNOWN:
- rgvarg[i].punkVal->Release();
- break;
+ case VT_UNKNOWN:
+ rgvarg[i].punkVal->Release();
+ break;
- case VT_DISPATCH:
- rgvarg[i].pdispVal->Release();
- break;
- }
+ case VT_DISPATCH:
+ rgvarg[i].pdispVal->Release();
+ break;
+ }
}
delete[] rgvarg;
}
@@ -2012,17 +1908,17 @@ CDeferredCommand::CDeferredCommand(
__out VARIANT* pvarResult,
__out short* puArgErr,
BOOL bStream
-) :
- CUnknown(NAME("DeferredCommand"), pUnk),
- m_pQueue(pQ),
- m_pUnk(pUnkExecutor),
- m_iid(iid),
- m_dispidMethod(dispidMethod),
- m_wFlags(wFlags),
- m_DispParams(nArgs, pDispParams, phr),
- m_pvarResult(pvarResult),
- m_bStream(bStream),
- m_hrResult(E_ABORT)
+ ) :
+ CUnknown(NAME("DeferredCommand"), pUnk),
+ m_pQueue(pQ),
+ m_pUnk(pUnkExecutor),
+ m_iid(iid),
+ m_dispidMethod(dispidMethod),
+ m_wFlags(wFlags),
+ m_DispParams(nArgs, pDispParams, phr),
+ m_pvarResult(pvarResult),
+ m_bStream(bStream),
+ m_hrResult(E_ABORT)
{
// convert REFTIME to REFERENCE_TIME
@@ -2035,10 +1931,9 @@ CDeferredCommand::CDeferredCommand(
// check iid is supportable on pUnk by QueryInterface for it
IUnknown * pInterface;
HRESULT hr = m_pUnk->QueryInterface(GetIID(), (void**) &pInterface);
- if(FAILED(hr))
- {
- *phr = hr;
- return;
+ if (FAILED(hr)) {
+ *phr = hr;
+ return;
}
pInterface->Release();
@@ -2046,18 +1941,16 @@ CDeferredCommand::CDeferredCommand(
// !!! check dispidMethod and param/return types using typelib
ITypeInfo *pti;
hr = m_Dispatch.GetTypeInfo(*iid, 0, 0, &pti);
- if(FAILED(hr))
- {
- *phr = hr;
- return;
+ if (FAILED(hr)) {
+ *phr = hr;
+ return;
}
// !!! some sort of ITypeInfo validity check here
pti->Release();
// Fix up the dispid for put and get
- if(wFlags == DISPATCH_PROPERTYPUT)
- {
+ if (wFlags == DISPATCH_PROPERTYPUT) {
m_DispParams.cNamedArgs = 1;
m_DispId = DISPID_PROPERTYPUT;
m_DispParams.rgdispidNamedArgs = &m_DispId;
@@ -2065,9 +1958,8 @@ CDeferredCommand::CDeferredCommand(
// all checks ok - add to queue
hr = pQ->Insert(this);
- if(FAILED(hr))
- {
- *phr = hr;
+ if (FAILED(hr)) {
+ *phr = hr;
}
}
@@ -2101,14 +1993,11 @@ CDeferredCommand::~CDeferredCommand()
STDMETHODIMP
CDeferredCommand::NonDelegatingQueryInterface(REFIID riid, __out void **ppv)
{
- ValidateReadWritePtr(ppv, sizeof(PVOID));
- if(riid == IID_IDeferredCommand)
- {
- return GetInterface((IDeferredCommand *) this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+ if (riid == IID_IDeferredCommand) {
+ return GetInterface( (IDeferredCommand *) this, ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -2120,15 +2009,13 @@ CDeferredCommand::NonDelegatingQueryInterface(REFIID riid, __out void **ppv)
STDMETHODIMP
CDeferredCommand::Cancel()
{
- if(m_pQueue == NULL)
- {
- return VFW_E_ALREADY_CANCELLED;
+ if (m_pQueue == NULL) {
+ return VFW_E_ALREADY_CANCELLED;
}
HRESULT hr = m_pQueue->Remove(this);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
m_pQueue = NULL;
@@ -2146,12 +2033,11 @@ CDeferredCommand::Confidence(__out LONG* pConfidence)
STDMETHODIMP
CDeferredCommand::GetHResult(__out HRESULT * phrResult)
{
- CheckPointer(phrResult, E_POINTER);
- ValidateReadWritePtr(phrResult, sizeof(HRESULT));
+ CheckPointer(phrResult,E_POINTER);
+ ValidateReadWritePtr(phrResult,sizeof(HRESULT));
- if(m_pQueue != NULL)
- {
- return E_ABORT;
+ if (m_pQueue != NULL) {
+ return E_ABORT;
}
*phrResult = m_hrResult;
return S_OK;
@@ -2170,16 +2056,14 @@ CDeferredCommand::Postpone(REFTIME newtime)
COARefTime convertor(newtime);
// check that the time has not passed
- if(m_pQueue->CheckTime(convertor, IsStreamTime()))
- {
- return VFW_E_TIME_ALREADY_PASSED;
+ if (m_pQueue->CheckTime(convertor, IsStreamTime())) {
+ return VFW_E_TIME_ALREADY_PASSED;
}
// extract from list
HRESULT hr = m_pQueue->Remove(this);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
// change time
@@ -2196,17 +2080,15 @@ HRESULT
CDeferredCommand::Invoke()
{
// check that we are still outstanding
- if(m_pQueue == NULL)
- {
- return VFW_E_ALREADY_CANCELLED;
+ if (m_pQueue == NULL) {
+ return VFW_E_ALREADY_CANCELLED;
}
// get the type info
ITypeInfo* pti;
HRESULT hr = m_Dispatch.GetTypeInfo(GetIID(), 0, 0, &pti);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
// qi for the expected interface and then invoke it. Note that we have to
@@ -2214,22 +2096,21 @@ CDeferredCommand::Invoke()
IUnknown* pInterface;
hr = m_pUnk->QueryInterface(GetIID(), (void**) &pInterface);
- if(FAILED(hr))
- {
- pti->Release();
- return hr;
+ if (FAILED(hr)) {
+ pti->Release();
+ return hr;
}
EXCEPINFO expinfo;
UINT uArgErr;
m_hrResult = pti->Invoke(
- pInterface,
- GetMethod(),
- GetFlags(),
- GetParams(),
- GetResult(),
- &expinfo,
- &uArgErr);
+ pInterface,
+ GetMethod(),
+ GetFlags(),
+ GetParams(),
+ GetResult(),
+ &expinfo,
+ &uArgErr);
// release the interface we QI'd for
pInterface->Release();
@@ -2267,30 +2148,26 @@ CCmdQueue::~CCmdQueue()
// entry then RemoveAll to empty the list
POSITION pos = m_listPresentation.GetHeadPosition();
- while(pos)
- {
- CDeferredCommand* pCmd = m_listPresentation.GetNext(pos);
- pCmd->Release();
+ while(pos) {
+ CDeferredCommand* pCmd = m_listPresentation.GetNext(pos);
+ pCmd->Release();
}
m_listPresentation.RemoveAll();
pos = m_listStream.GetHeadPosition();
- while(pos)
- {
- CDeferredCommand* pCmd = m_listStream.GetNext(pos);
- pCmd->Release();
+ while(pos) {
+ CDeferredCommand* pCmd = m_listStream.GetNext(pos);
+ pCmd->Release();
}
m_listStream.RemoveAll();
- if(m_pClock)
- {
- if(m_dwAdvise)
- {
- m_pClock->Unadvise(m_dwAdvise);
- m_dwAdvise = 0;
- }
- m_pClock->Release();
+ if (m_pClock) {
+ if (m_dwAdvise) {
+ m_pClock->Unadvise(m_dwAdvise);
+ m_dwAdvise = 0;
+ }
+ m_pClock->Release();
}
}
@@ -2322,27 +2199,24 @@ CCmdQueue::New(
CDeferredCommand* pCmd;
pCmd = new CDeferredCommand(
- this,
- NULL, // not aggregated
- &hr,
- pUnk, // this guy will execute
- time,
- iid,
- dispidMethod,
- wFlags,
- cArgs,
- pDispParams,
- pvarResult,
- puArgErr,
- bStream);
-
- if(pCmd == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- else
- {
- *ppCmd = pCmd;
+ this,
+ NULL, // not aggregated
+ &hr,
+ pUnk, // this guy will execute
+ time,
+ iid,
+ dispidMethod,
+ wFlags,
+ cArgs,
+ pDispParams,
+ pvarResult,
+ puArgErr,
+ bStream);
+
+ if (pCmd == NULL) {
+ hr = E_OUTOFMEMORY;
+ } else {
+ *ppCmd = pCmd;
}
return hr;
}
@@ -2357,32 +2231,25 @@ CCmdQueue::Insert(__in CDeferredCommand* pCmd)
pCmd->AddRef();
CGenericList<CDeferredCommand> * pList;
- if(pCmd->IsStreamTime())
- {
- pList = &m_listStream;
- }
- else
- {
- pList = &m_listPresentation;
+ if (pCmd->IsStreamTime()) {
+ pList = &m_listStream;
+ } else {
+ pList = &m_listPresentation;
}
POSITION pos = pList->GetHeadPosition();
// seek past all items that are before us
- while(pos &&
- (pList->GetValid(pos)->GetTime() <= pCmd->GetTime()))
- {
+ while (pos &&
+ (pList->GetValid(pos)->GetTime() <= pCmd->GetTime())) {
- pList->GetNext(pos);
+ pList->GetNext(pos);
}
// now at end of list or in front of items that come later
- if(!pos)
- {
- pList->AddTail(pCmd);
- }
- else
- {
- pList->AddBefore(pos, pCmd);
+ if (!pos) {
+ pList->AddTail(pCmd);
+ } else {
+ pList->AddBefore(pos, pCmd);
}
SetTimeAdvise();
@@ -2397,38 +2264,31 @@ CCmdQueue::Remove(__in CDeferredCommand* pCmd)
HRESULT hr = S_OK;
CGenericList<CDeferredCommand> * pList;
- if(pCmd->IsStreamTime())
- {
- pList = &m_listStream;
- }
- else
- {
- pList = &m_listPresentation;
+ if (pCmd->IsStreamTime()) {
+ pList = &m_listStream;
+ } else {
+ pList = &m_listPresentation;
}
POSITION pos = pList->GetHeadPosition();
// traverse the list
- while(pos && (pList->GetValid(pos) != pCmd))
- {
- pList->GetNext(pos);
+ while (pos && (pList->GetValid(pos) != pCmd)) {
+ pList->GetNext(pos);
}
// did we drop off the end?
- if(!pos)
- {
- hr = VFW_E_NOT_FOUND;
- }
- else
- {
+ if (!pos) {
+ hr = VFW_E_NOT_FOUND;
+ } else {
- // found it - now take off list
- pList->Remove(pos);
+ // found it - now take off list
+ pList->Remove(pos);
- // Insert did an AddRef, so release it
- pCmd->Release();
+ // Insert did an AddRef, so release it
+ pCmd->Release();
- // check that timer request is still for earliest time
- SetTimeAdvise();
+ // check that timer request is still for earliest time
+ SetTimeAdvise();
}
return hr;
}
@@ -2442,20 +2302,17 @@ CCmdQueue::SetSyncSource(__in_opt IReferenceClock* pClock)
CAutoLock lock(&m_Lock);
// addref the new clock first in case they are the same
- if(pClock)
- {
- pClock->AddRef();
+ if (pClock) {
+ pClock->AddRef();
}
// kill any advise on the old clock
- if(m_pClock)
- {
- if(m_dwAdvise)
- {
- m_pClock->Unadvise(m_dwAdvise);
- m_dwAdvise = 0;
- }
- m_pClock->Release();
+ if (m_pClock) {
+ if (m_dwAdvise) {
+ m_pClock->Unadvise(m_dwAdvise);
+ m_dwAdvise = 0;
+ }
+ m_pClock->Release();
}
m_pClock = pClock;
@@ -2471,9 +2328,8 @@ void
CCmdQueue::SetTimeAdvise(void)
{
// make sure we have a clock to use
- if(!m_pClock)
- {
- return;
+ if (!m_pClock) {
+ return;
}
// reset the event whenever we are requesting a new signal
@@ -2484,53 +2340,47 @@ CCmdQueue::SetTimeAdvise(void)
// find the earliest presentation time
POSITION pos = m_listPresentation.GetHeadPosition();
- if(pos != NULL)
- {
- current = m_listPresentation.GetValid(pos)->GetTime();
+ if (pos != NULL) {
+ current = m_listPresentation.GetValid(pos)->GetTime();
}
// if we're running, check the stream times too
- if(m_bRunning)
- {
+ if (m_bRunning) {
- CRefTime t;
+ CRefTime t;
pos = m_listStream.GetHeadPosition();
- if(NULL != pos)
- {
- t = m_listStream.GetValid(pos)->GetTime();
+ if (NULL != pos) {
+ t = m_listStream.GetValid(pos)->GetTime();
- // add on stream time offset to get presentation time
- t += m_StreamTimeOffset;
+ // add on stream time offset to get presentation time
+ t += m_StreamTimeOffset;
- // is this earlier?
- if((current == TimeZero) || (t < current))
- {
- current = t;
- }
- }
+ // is this earlier?
+ if ((current == TimeZero) || (t < current)) {
+ current = t;
+ }
+ }
}
// need to change?
- if((current > TimeZero) && (current != m_tCurrentAdvise))
- {
- if(m_dwAdvise)
- {
- m_pClock->Unadvise(m_dwAdvise);
- // reset the event whenever we are requesting a new signal
- m_evDue.Reset();
- }
+ if ((current > TimeZero) && (current != m_tCurrentAdvise)) {
+ if (m_dwAdvise) {
+ m_pClock->Unadvise(m_dwAdvise);
+ // reset the event whenever we are requesting a new signal
+ m_evDue.Reset();
+ }
- // ask for time advice - the first two params are either
- // stream time offset and stream time or
- // presentation time and 0. we always use the latter
- HRESULT hr = m_pClock->AdviseTime(
- (REFERENCE_TIME)current,
- TimeZero,
- (HEVENT) HANDLE(m_evDue),
- &m_dwAdvise);
+ // ask for time advice - the first two params are either
+ // stream time offset and stream time or
+ // presentation time and 0. we always use the latter
+ HRESULT hr = m_pClock->AdviseTime(
+ (REFERENCE_TIME)current,
+ TimeZero,
+ (HEVENT) HANDLE(m_evDue),
+ &m_dwAdvise);
- ASSERT(SUCCEEDED(hr));
- m_tCurrentAdvise = current;
+ ASSERT(SUCCEEDED(hr));
+ m_tCurrentAdvise = current;
}
}
@@ -2578,60 +2428,52 @@ HRESULT
CCmdQueue::GetDueCommand(__out CDeferredCommand ** ppCmd, long msTimeout)
{
// loop until we timeout or find a due command
- for(;;)
- {
+ for (;;) {
- {
- CAutoLock lock(&m_Lock);
+ {
+ CAutoLock lock(&m_Lock);
- // find the earliest command
- CDeferredCommand * pCmd = NULL;
+ // find the earliest command
+ CDeferredCommand * pCmd = NULL;
- // check the presentation time and the
- // stream time list to find the earliest
+ // check the presentation time and the
+ // stream time list to find the earliest
POSITION pos = m_listPresentation.GetHeadPosition();
- if(NULL != pos)
- {
- pCmd = m_listPresentation.GetValid(pos);
- }
+ if (NULL != pos) {
+ pCmd = m_listPresentation.GetValid(pos);
+ }
- if(m_bRunning)
- {
- pos = m_listStream.GetHeadPosition();
- if(NULL != pos)
- {
+ if (m_bRunning) {
+ pos = m_listStream.GetHeadPosition();
+ if (NULL != pos) {
CDeferredCommand* pStrm = m_listStream.GetValid(pos);
CRefTime t = pStrm->GetTime() + m_StreamTimeOffset;
- if(!pCmd || (t < pCmd->GetTime()))
- {
+ if (!pCmd || (t < pCmd->GetTime())) {
pCmd = pStrm;
}
}
}
- // if we have found one, is it due?
- if(pCmd)
- {
- if(CheckTime(pCmd->GetTime(), pCmd->IsStreamTime()))
- {
+ // if we have found one, is it due?
+ if (pCmd) {
+ if (CheckTime(pCmd->GetTime(), pCmd->IsStreamTime())) {
- // yes it's due - addref it
- pCmd->AddRef();
- *ppCmd = pCmd;
- return S_OK;
- }
- }
- }
+ // yes it's due - addref it
+ pCmd->AddRef();
+ *ppCmd = pCmd;
+ return S_OK;
+ }
+ }
+ }
- // block until the advise is signalled
- if(WaitForSingleObject(m_evDue, msTimeout) != WAIT_OBJECT_0)
- {
- return E_ABORT;
- }
+ // block until the advise is signalled
+ if (WaitForSingleObject(m_evDue, msTimeout) != WAIT_OBJECT_0) {
+ return E_ABORT;
+ }
}
}
@@ -2655,48 +2497,42 @@ CCmdQueue::GetCommandDueFor(REFERENCE_TIME rtStream, __out CDeferredCommand**ppC
// find the earliest stream and presentation time commands
CDeferredCommand* pStream = NULL;
POSITION pos = m_listStream.GetHeadPosition();
- if(NULL != pos)
- {
- pStream = m_listStream.GetValid(pos);
+ if (NULL != pos) {
+ pStream = m_listStream.GetValid(pos);
}
CDeferredCommand* pPresent = NULL;
pos = m_listPresentation.GetHeadPosition();
- if(NULL != pos)
- {
- pPresent = m_listPresentation.GetValid(pos);
+ if (NULL != pos) {
+ pPresent = m_listPresentation.GetValid(pos);
}
// is there a presentation time that has passed already
- if(pPresent && CheckTime(pPresent->GetTime(), FALSE))
- {
- pPresent->AddRef();
- *ppCmd = pPresent;
- return S_OK;
+ if (pPresent && CheckTime(pPresent->GetTime(), FALSE)) {
+ pPresent->AddRef();
+ *ppCmd = pPresent;
+ return S_OK;
}
// is there a stream time command due before this stream time
- if(pStream && (pStream->GetTime() <= tStream))
- {
- pStream->AddRef();
- *ppCmd = pStream;
- return S_OK;
+ if (pStream && (pStream->GetTime() <= tStream)) {
+ pStream->AddRef();
+ *ppCmd = pStream;
+ return S_OK;
}
// if we are running, we can map presentation times to
// stream time. In this case, is there a presentation time command
// that will be due before this stream time is presented?
- if(m_bRunning && pPresent)
- {
+ if (m_bRunning && pPresent) {
- // this stream time will appear at...
- tStream += m_StreamTimeOffset;
+ // this stream time will appear at...
+ tStream += m_StreamTimeOffset;
- // due before that?
- if(pPresent->GetTime() <= tStream)
- {
- *ppCmd = pPresent;
- return S_OK;
- }
+ // due before that?
+ if (pPresent->GetTime() <= tStream) {
+ *ppCmd = pPresent;
+ return S_OK;
+ }
}
// no commands due yet
diff --git a/src/filters/BaseClasses/ctlutil.h b/src/filters/BaseClasses/ctlutil.h
index a335183f3..7e4719ce3 100644
--- a/src/filters/BaseClasses/ctlutil.h
+++ b/src/filters/BaseClasses/ctlutil.h
@@ -36,17 +36,17 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- REFIID riid,
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ REFIID riid,
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
};
@@ -69,26 +69,26 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr);
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr);
};
@@ -111,26 +111,26 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr);
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr);
};
@@ -155,26 +155,26 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr);
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr);
};
@@ -183,12 +183,10 @@ public:
// and REFERENCE_TIME (essentially a LONGLONG) within filters.
// this class converts between the two
-class COARefTime : public CRefTime
-{
+class COARefTime : public CRefTime {
public:
- COARefTime()
- {
+ COARefTime() {
};
COARefTime(CRefTime t)
@@ -201,29 +199,24 @@ public:
{
};
- COARefTime(double d)
- {
- m_time = (LONGLONG)(d * 10000000);
+ COARefTime(double d) {
+ m_time = (LONGLONG) (d * 10000000);
};
- operator double()
- {
+ operator double() {
return double(m_time) / 10000000;
};
- operator REFERENCE_TIME()
- {
+ operator REFERENCE_TIME() {
return m_time;
};
- COARefTime& operator=(const double& rd)
- {
- m_time = (LONGLONG)(rd * 10000000);
+ COARefTime& operator=(const double& rd) {
+ m_time = (LONGLONG) (rd * 10000000);
return *this;
}
- COARefTime& operator=(const REFERENCE_TIME& rt)
- {
+ COARefTime& operator=(const REFERENCE_TIME& rt) {
m_time = rt;
return *this;
}
@@ -315,42 +308,40 @@ public:
CPosPassThru(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT*, IPin *);
DECLARE_IUNKNOWN
- HRESULT ForceRefresh()
- {
+ HRESULT ForceRefresh() {
return S_OK;
};
// override to return an accurate current position
- virtual HRESULT GetMediaTime(__out LONGLONG *pStartTime, __out_opt LONGLONG *pEndTime)
- {
+ virtual HRESULT GetMediaTime(__out LONGLONG *pStartTime, __out_opt LONGLONG *pEndTime) {
return E_FAIL;
}
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv);
// IMediaSeeking methods
- STDMETHODIMP GetCapabilities(__out DWORD * pCapabilities);
- STDMETHODIMP CheckCapabilities(__inout DWORD * pCapabilities);
+ STDMETHODIMP GetCapabilities( __out DWORD * pCapabilities );
+ STDMETHODIMP CheckCapabilities( __inout DWORD * pCapabilities );
STDMETHODIMP SetTimeFormat(const GUID * pFormat);
STDMETHODIMP GetTimeFormat(__out GUID *pFormat);
STDMETHODIMP IsUsingTimeFormat(const GUID * pFormat);
- STDMETHODIMP IsFormatSupported(const GUID * pFormat);
- STDMETHODIMP QueryPreferredFormat(__out GUID *pFormat);
- STDMETHODIMP ConvertTimeFormat(__out LONGLONG * pTarget,
+ STDMETHODIMP IsFormatSupported( const GUID * pFormat);
+ STDMETHODIMP QueryPreferredFormat( __out GUID *pFormat);
+ STDMETHODIMP ConvertTimeFormat(__out LONGLONG * pTarget,
__in_opt const GUID * pTargetFormat,
- LONGLONG Source,
- __in_opt const GUID * pSourceFormat);
- STDMETHODIMP SetPositions(__inout_opt LONGLONG * pCurrent, DWORD CurrentFlags
- , __inout_opt LONGLONG * pStop, DWORD StopFlags);
-
- STDMETHODIMP GetPositions(__out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop);
- STDMETHODIMP GetCurrentPosition(__out LONGLONG * pCurrent);
- STDMETHODIMP GetStopPosition(__out LONGLONG * pStop);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(__out double * pdRate);
- STDMETHODIMP GetDuration(__out LONGLONG *pDuration);
- STDMETHODIMP GetAvailable(__out_opt LONGLONG *pEarliest, __out_opt LONGLONG *pLatest);
- STDMETHODIMP GetPreroll(__out LONGLONG *pllPreroll);
+ LONGLONG Source,
+ __in_opt const GUID * pSourceFormat );
+ STDMETHODIMP SetPositions( __inout_opt LONGLONG * pCurrent, DWORD CurrentFlags
+ , __inout_opt LONGLONG * pStop, DWORD StopFlags );
+
+ STDMETHODIMP GetPositions( __out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop );
+ STDMETHODIMP GetCurrentPosition( __out LONGLONG * pCurrent );
+ STDMETHODIMP GetStopPosition( __out LONGLONG * pStop );
+ STDMETHODIMP SetRate( double dRate);
+ STDMETHODIMP GetRate( __out double * pdRate);
+ STDMETHODIMP GetDuration( __out LONGLONG *pDuration);
+ STDMETHODIMP GetAvailable( __out_opt LONGLONG *pEarliest, __out_opt LONGLONG *pLatest );
+ STDMETHODIMP GetPreroll( __out LONGLONG *pllPreroll );
// IMediaPosition properties
STDMETHODIMP get_Duration(__out REFTIME * plength);
@@ -366,8 +357,8 @@ public:
STDMETHODIMP CanSeekBackward(__out LONG *pCanSeekBackward);
private:
- HRESULT GetSeekingLongLong(HRESULT(__stdcall IMediaSeeking::*pMethod)(LONGLONG *),
- __out LONGLONG * pll);
+ HRESULT GetSeekingLongLong( HRESULT (__stdcall IMediaSeeking::*pMethod)( LONGLONG * ),
+ __out LONGLONG * pll );
};
@@ -386,8 +377,8 @@ public:
CRendererPosPassThru(__in_opt LPCTSTR, __in_opt LPUNKNOWN, __inout HRESULT*, IPin *);
HRESULT RegisterMediaTime(IMediaSample *pMediaSample);
- HRESULT RegisterMediaTime(LONGLONG StartTime, LONGLONG EndTime);
- HRESULT GetMediaTime(__out LONGLONG *pStartTime, __out_opt LONGLONG *pEndTime);
+ HRESULT RegisterMediaTime(LONGLONG StartTime,LONGLONG EndTime);
+ HRESULT GetMediaTime(__out LONGLONG *pStartTime,__out_opt LONGLONG *pEndTime);
HRESULT ResetMediaTime();
HRESULT EOS();
};
@@ -419,26 +410,26 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr);
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr);
};
@@ -462,30 +453,30 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr);
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr);
STDMETHODIMP GetPreferredAspectRatio(
- __out long *plAspectX,
- __out long *plAspectY)
+ __out long *plAspectX,
+ __out long *plAspectY)
{
return E_NOTIMPL;
}
@@ -512,26 +503,26 @@ public:
STDMETHODIMP GetTypeInfoCount(__out UINT * pctinfo);
STDMETHODIMP GetTypeInfo(
- UINT itinfo,
- LCID lcid,
- __deref_out ITypeInfo ** pptinfo);
+ UINT itinfo,
+ LCID lcid,
+ __deref_out ITypeInfo ** pptinfo);
STDMETHODIMP GetIDsOfNames(
- REFIID riid,
- __in_ecount(cNames) LPOLESTR * rgszNames,
- UINT cNames,
- LCID lcid,
- __out_ecount(cNames) DISPID * rgdispid);
+ REFIID riid,
+ __in_ecount(cNames) LPOLESTR * rgszNames,
+ UINT cNames,
+ LCID lcid,
+ __out_ecount(cNames) DISPID * rgdispid);
STDMETHODIMP Invoke(
- DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
- __in DISPPARAMS * pdispparams,
- __out_opt VARIANT * pvarResult,
- __out_opt EXCEPINFO * pexcepinfo,
- __out_opt UINT * puArgErr);
+ DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ __in DISPPARAMS * pdispparams,
+ __out_opt VARIANT * pvarResult,
+ __out_opt EXCEPINFO * pexcepinfo,
+ __out_opt UINT * puArgErr);
};
@@ -559,8 +550,7 @@ public:
STDMETHODIMP CanSeekBackward(__out LONG *pCanSeekBackward);
// override if you can return the data you are actually working on
- STDMETHODIMP get_CurrentPosition(__out REFTIME * pllTime)
- {
+ STDMETHODIMP get_CurrentPosition(__out REFTIME * pllTime) {
return E_NOTIMPL;
};
@@ -599,21 +589,21 @@ public:
STDMETHODIMP GetDuration(__out LONGLONG *pDuration);
STDMETHODIMP GetStopPosition(__out LONGLONG *pStop);
STDMETHODIMP GetCurrentPosition(__out LONGLONG *pCurrent);
- STDMETHODIMP GetCapabilities(__out DWORD * pCapabilities);
- STDMETHODIMP CheckCapabilities(__inout DWORD * pCapabilities);
- STDMETHODIMP ConvertTimeFormat(__out LONGLONG * pTarget,
- __in_opt const GUID * pTargetFormat,
- LONGLONG Source,
- __in_opt const GUID * pSourceFormat);
+ STDMETHODIMP GetCapabilities( __out DWORD * pCapabilities );
+ STDMETHODIMP CheckCapabilities( __inout DWORD * pCapabilities );
+ STDMETHODIMP ConvertTimeFormat( __out LONGLONG * pTarget,
+ __in_opt const GUID * pTargetFormat,
+ LONGLONG Source,
+ __in_opt const GUID * pSourceFormat );
- STDMETHODIMP SetPositions(__inout_opt LONGLONG * pCurrent, DWORD CurrentFlags
- , __inout_opt LONGLONG * pStop, DWORD StopFlags);
+ STDMETHODIMP SetPositions( __inout_opt LONGLONG * pCurrent, DWORD CurrentFlags
+ , __inout_opt LONGLONG * pStop, DWORD StopFlags );
- STDMETHODIMP GetPositions(__out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop);
+ STDMETHODIMP GetPositions( __out_opt LONGLONG * pCurrent, __out_opt LONGLONG * pStop );
- STDMETHODIMP GetAvailable(__out_opt LONGLONG * pEarliest, __out_opt LONGLONG * pLatest);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(__out double * pdRate);
+ STDMETHODIMP GetAvailable( __out_opt LONGLONG * pEarliest, __out_opt LONGLONG * pLatest );
+ STDMETHODIMP SetRate( double dRate);
+ STDMETHODIMP GetRate( __out double * pdRate);
STDMETHODIMP GetPreroll(__out LONGLONG *pPreroll);
@@ -677,7 +667,7 @@ public:
class CDeferredCommand
: public CUnknown,
- public IDeferredCommand
+ public IDeferredCommand
{
public:
@@ -695,7 +685,7 @@ public:
__out VARIANT* pvarResult,
__out short* puArgErr,
BOOL bStream
- );
+ );
DECLARE_IUNKNOWN
@@ -705,11 +695,11 @@ public:
// IDeferredCommand methods
STDMETHODIMP Cancel();
STDMETHODIMP Confidence(
- __out LONG* pConfidence);
+ __out LONG* pConfidence);
STDMETHODIMP Postpone(
- REFTIME newtime);
+ REFTIME newtime);
STDMETHODIMP GetHResult(
- __out HRESULT* phrResult);
+ __out HRESULT* phrResult);
// other public methods
@@ -718,38 +708,31 @@ public:
// access methods
// returns TRUE if streamtime, FALSE if presentation time
- BOOL IsStreamTime()
- {
- return m_bStream;
+ BOOL IsStreamTime() {
+ return m_bStream;
};
- CRefTime GetTime()
- {
+ CRefTime GetTime() {
return m_time;
};
- REFIID GetIID()
- {
+ REFIID GetIID() {
return *m_iid;
};
- long GetMethod()
- {
+ long GetMethod() {
return m_dispidMethod;
};
- short GetFlags()
- {
+ short GetFlags() {
return m_wFlags;
};
- DISPPARAMS* GetParams()
- {
+ DISPPARAMS* GetParams() {
return &m_DispParams;
};
- VARIANT* GetResult()
- {
+ VARIANT* GetResult() {
return m_pvarResult;
};
@@ -867,8 +850,7 @@ public:
// return the event handle that will be signalled whenever
// there are deferred commands due for execution (when GetDueCommand
// will not block).
- HANDLE GetDueHandle()
- {
+ HANDLE GetDueHandle() {
return HANDLE(m_evDue);
};
@@ -882,22 +864,18 @@ public:
virtual HRESULT GetCommandDueFor(REFERENCE_TIME tStream, __out CDeferredCommand**ppCmd);
// check if a given time is due (TRUE if it is due yet)
- BOOL CheckTime(CRefTime time, BOOL bStream)
- {
+ BOOL CheckTime(CRefTime time, BOOL bStream) {
// if no clock, nothing is due!
- if(!m_pClock)
- {
+ if (!m_pClock) {
return FALSE;
}
// stream time
- if(bStream)
- {
+ if (bStream) {
// not valid if not running
- if(!m_bRunning)
- {
+ if (!m_bRunning) {
return FALSE;
}
// add on known stream time offset to get presentation time
diff --git a/src/filters/BaseClasses/ddmm.cpp b/src/filters/BaseClasses/ddmm.cpp
index 3165fb6f6..bfa700cb8 100644
--- a/src/filters/BaseClasses/ddmm.cpp
+++ b/src/filters/BaseClasses/ddmm.cpp
@@ -15,55 +15,46 @@
/*
* FindDeviceCallback
*/
-typedef struct
-{
- LPSTR szDevice;
- GUID* lpGUID;
- GUID GUID;
- BOOL fFound;
+typedef struct {
+ LPSTR szDevice;
+ GUID* lpGUID;
+ GUID GUID;
+ BOOL fFound;
} FindDeviceData;
BOOL CALLBACK FindDeviceCallback(__in_opt GUID* lpGUID, __in LPSTR szName, __in LPSTR szDevice, __in LPVOID lParam)
{
- FindDeviceData *p = (FindDeviceData*)lParam;
-
- if(lstrcmpiA(p->szDevice, szDevice) == 0)
- {
- if(lpGUID)
- {
- p->GUID = *lpGUID;
- p->lpGUID = &p->GUID;
- }
- else
- {
- p->lpGUID = NULL;
- }
- p->fFound = TRUE;
- return FALSE;
- }
- return TRUE;
+ FindDeviceData *p = (FindDeviceData*)lParam;
+
+ if (lstrcmpiA(p->szDevice, szDevice) == 0) {
+ if (lpGUID) {
+ p->GUID = *lpGUID;
+ p->lpGUID = &p->GUID;
+ } else {
+ p->lpGUID = NULL;
+ }
+ p->fFound = TRUE;
+ return FALSE;
+ }
+ return TRUE;
}
BOOL CALLBACK FindDeviceCallbackEx(__in_opt GUID* lpGUID, __in LPSTR szName, __in LPSTR szDevice, __in LPVOID lParam, HMONITOR hMonitor)
{
- FindDeviceData *p = (FindDeviceData*)lParam;
-
- if(lstrcmpiA(p->szDevice, szDevice) == 0)
- {
- if(lpGUID)
- {
- p->GUID = *lpGUID;
- p->lpGUID = &p->GUID;
- }
- else
- {
- p->lpGUID = NULL;
- }
- p->fFound = TRUE;
- return FALSE;
- }
- return TRUE;
+ FindDeviceData *p = (FindDeviceData*)lParam;
+
+ if (lstrcmpiA(p->szDevice, szDevice) == 0) {
+ if (lpGUID) {
+ p->GUID = *lpGUID;
+ p->lpGUID = &p->GUID;
+ } else {
+ p->lpGUID = NULL;
+ }
+ p->fFound = TRUE;
+ return FALSE;
+ }
+ return TRUE;
}
@@ -74,32 +65,31 @@ BOOL CALLBACK FindDeviceCallbackEx(__in_opt GUID* lpGUID, __in LPSTR szName, __i
*/
IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP)
{
- IDirectDraw* pdd = NULL;
- FindDeviceData find;
-
- if(szDevice == NULL)
- {
- DirectDrawCreateP(NULL, &pdd, NULL);
- return pdd;
- }
-
- find.szDevice = szDevice;
- find.fFound = FALSE;
- DirectDrawEnumerateP(FindDeviceCallback, (LPVOID)&find);
-
- if(find.fFound)
- {
- //
- // In 4bpp mode the following DDraw call causes a message box to be popped
- // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we
- // make sure it doesn't happen.
- //
- UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
- DirectDrawCreateP(find.lpGUID, &pdd, NULL);
- SetErrorMode(ErrorMode);
- }
-
- return pdd;
+ IDirectDraw* pdd = NULL;
+ FindDeviceData find;
+
+ if (szDevice == NULL) {
+ DirectDrawCreateP(NULL, &pdd, NULL);
+ return pdd;
+ }
+
+ find.szDevice = szDevice;
+ find.fFound = FALSE;
+ DirectDrawEnumerateP(FindDeviceCallback, (LPVOID)&find);
+
+ if (find.fFound)
+ {
+ //
+ // In 4bpp mode the following DDraw call causes a message box to be popped
+ // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we
+ // make sure it doesn't happen.
+ //
+ UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
+ DirectDrawCreateP(find.lpGUID, &pdd, NULL);
+ SetErrorMode(ErrorMode);
+ }
+
+ return pdd;
}
@@ -110,31 +100,30 @@ IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR szDevice, PDRAWCREATE Di
*/
IDirectDraw * DirectDrawCreateFromDeviceEx(__in_opt LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP)
{
- IDirectDraw* pdd = NULL;
- FindDeviceData find;
-
- if(szDevice == NULL)
- {
- DirectDrawCreateP(NULL, &pdd, NULL);
- return pdd;
- }
-
- find.szDevice = szDevice;
- find.fFound = FALSE;
- DirectDrawEnumerateExP(FindDeviceCallbackEx, (LPVOID)&find,
- DDENUM_ATTACHEDSECONDARYDEVICES);
-
- if(find.fFound)
- {
- //
- // In 4bpp mode the following DDraw call causes a message box to be popped
- // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we
- // make sure it doesn't happen.
- //
- UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
- DirectDrawCreateP(find.lpGUID, &pdd, NULL);
- SetErrorMode(ErrorMode);
- }
-
- return pdd;
+ IDirectDraw* pdd = NULL;
+ FindDeviceData find;
+
+ if (szDevice == NULL) {
+ DirectDrawCreateP(NULL, &pdd, NULL);
+ return pdd;
+ }
+
+ find.szDevice = szDevice;
+ find.fFound = FALSE;
+ DirectDrawEnumerateExP(FindDeviceCallbackEx, (LPVOID)&find,
+ DDENUM_ATTACHEDSECONDARYDEVICES);
+
+ if (find.fFound)
+ {
+ //
+ // In 4bpp mode the following DDraw call causes a message box to be popped
+ // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we
+ // make sure it doesn't happen.
+ //
+ UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
+ DirectDrawCreateP(find.lpGUID, &pdd, NULL);
+ SetErrorMode(ErrorMode);
+ }
+
+ return pdd;
}
diff --git a/src/filters/BaseClasses/ddmm.h b/src/filters/BaseClasses/ddmm.h
index 67cb3ea7b..7b311bc10 100644
--- a/src/filters/BaseClasses/ddmm.h
+++ b/src/filters/BaseClasses/ddmm.h
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// File: DDMM.h
//
-// Desc: DirectShow base classes - efines routines for using DirectDraw
+// Desc: DirectShow base classes - efines routines for using DirectDraw
// on a multimonitor system.
//
// Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved.
@@ -17,11 +17,11 @@ extern "C" { /* Assume C declarations for C++ */
#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001L
#endif
- typedef HRESULT(*PDRAWCREATE)(IID *, LPDIRECTDRAW *, LPUNKNOWN);
- typedef HRESULT(*PDRAWENUM)(LPDDENUMCALLBACKA, LPVOID);
+typedef HRESULT (*PDRAWCREATE)(IID *,LPDIRECTDRAW *,LPUNKNOWN);
+typedef HRESULT (*PDRAWENUM)(LPDDENUMCALLBACKA, LPVOID);
- IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR, PDRAWCREATE, PDRAWENUM);
- IDirectDraw * DirectDrawCreateFromDeviceEx(__in_opt LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA);
+IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR, PDRAWCREATE, PDRAWENUM);
+IDirectDraw * DirectDrawCreateFromDeviceEx(__in_opt LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA);
#ifdef __cplusplus
}
diff --git a/src/filters/BaseClasses/dllentry.cpp b/src/filters/BaseClasses/dllentry.cpp
index 3b3eeb09e..81a8673a9 100644
--- a/src/filters/BaseClasses/dllentry.cpp
+++ b/src/filters/BaseClasses/dllentry.cpp
@@ -56,8 +56,7 @@ public:
STDMETHODIMP LockServer(BOOL fLock);
// allow DLLGetClassObject to know about global server lock status
- static BOOL IsLocked()
- {
+ static BOOL IsLocked() {
return (m_cLocked > 0);
};
};
@@ -66,25 +65,24 @@ public:
int CClassFactory::m_cLocked = 0;
CClassFactory::CClassFactory(const CFactoryTemplate *pTemplate)
- : CBaseObject(NAME("Class Factory"))
- , m_cRef(0)
- , m_pTemplate(pTemplate)
+: CBaseObject(NAME("Class Factory"))
+, m_cRef(0)
+, m_pTemplate(pTemplate)
{
}
STDMETHODIMP
-CClassFactory::QueryInterface(REFIID riid, __deref_out void **ppv)
+CClassFactory::QueryInterface(REFIID riid,__deref_out void **ppv)
{
- CheckPointer(ppv, E_POINTER)
- ValidateReadWritePtr(ppv, sizeof(PVOID));
+ CheckPointer(ppv,E_POINTER)
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
*ppv = NULL;
// any interface on this object is the object pointer.
- if((riid == IID_IUnknown) || (riid == IID_IClassFactory))
- {
+ if ((riid == IID_IUnknown) || (riid == IID_IClassFactory)) {
*ppv = (LPVOID) this;
- // AddRef returned interface pointer
+ // AddRef returned interface pointer
((LPUNKNOWN) *ppv)->AddRef();
return NOERROR;
}
@@ -103,13 +101,10 @@ STDMETHODIMP_(ULONG)
CClassFactory::Release()
{
LONG lRef = InterlockedDecrement((volatile LONG *)&m_cRef);
- if(lRef == 0)
- {
+ if (lRef == 0) {
delete this;
return 0;
- }
- else
- {
+ } else {
return lRef;
}
}
@@ -120,16 +115,14 @@ CClassFactory::CreateInstance(
REFIID riid,
__deref_out void **pv)
{
- CheckPointer(pv, E_POINTER)
- ValidateReadWritePtr(pv, sizeof(void *));
+ CheckPointer(pv,E_POINTER)
+ ValidateReadWritePtr(pv,sizeof(void *));
*pv = NULL;
/* Enforce the normal OLE rules regarding interfaces and delegation */
- if(pUnkOuter != NULL)
- {
- if(IsEqualIID(riid, IID_IUnknown) == FALSE)
- {
+ if (pUnkOuter != NULL) {
+ if (IsEqualIID(riid,IID_IUnknown) == FALSE) {
*pv = NULL;
return ResultFromScode(E_NOINTERFACE);
}
@@ -140,20 +133,17 @@ CClassFactory::CreateInstance(
HRESULT hr = NOERROR;
CUnknown *pObj = m_pTemplate->CreateInstance(pUnkOuter, &hr);
- if(pObj == NULL)
- {
+ if (pObj == NULL) {
*pv = NULL;
- if(SUCCEEDED(hr))
- {
- hr = E_OUTOFMEMORY;
- }
- return hr;
+ if (SUCCEEDED(hr)) {
+ hr = E_OUTOFMEMORY;
+ }
+ return hr;
}
/* Delete the object if we got a construction error */
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
delete pObj;
*pv = NULL;
return hr;
@@ -174,8 +164,7 @@ CClassFactory::CreateInstance(
/* destruct". Hence we don't need additional tidy-up code */
/* to cope with NonDelegatingQueryInterface failing. */
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
ASSERT(*pv);
}
@@ -185,12 +174,9 @@ CClassFactory::CreateInstance(
STDMETHODIMP
CClassFactory::LockServer(BOOL fLock)
{
- if(fLock)
- {
+ if (fLock) {
m_cLocked++;
- }
- else
- {
+ } else {
m_cLocked--;
}
return NOERROR;
@@ -207,25 +193,21 @@ DllGetClassObject(
__deref_out void **pv)
{
*pv = NULL;
- if(!(riid == IID_IUnknown) && !(riid == IID_IClassFactory))
- {
- return E_NOINTERFACE;
+ if (!(riid == IID_IUnknown) && !(riid == IID_IClassFactory)) {
+ return E_NOINTERFACE;
}
// traverse the array of templates looking for one with this
// class id
- for(int i = 0; i < g_cTemplates; i++)
- {
+ for (int i = 0; i < g_cTemplates; i++) {
const CFactoryTemplate * pT = &g_Templates[i];
- if(pT->IsClassID(rClsID))
- {
+ if (pT->IsClassID(rClsID)) {
// found a template - make a class factory based on this
// template
- *pv = (LPVOID)(LPUNKNOWN) new CClassFactory(pT);
- if(*pv == NULL)
- {
+ *pv = (LPVOID) (LPUNKNOWN) new CClassFactory(pT);
+ if (*pv == NULL) {
return E_OUTOFMEMORY;
}
((LPUNKNOWN)*pv)->AddRef();
@@ -245,11 +227,9 @@ DllInitClasses(BOOL bLoading)
// traverse the array of templates calling the init routine
// if they have one
- for(i = 0; i < g_cTemplates; i++)
- {
+ for (i = 0; i < g_cTemplates; i++) {
const CFactoryTemplate * pT = &g_Templates[i];
- if(pT->m_lpfnInit != NULL)
- {
+ if (pT->m_lpfnInit != NULL) {
(*pT->m_lpfnInit)(bLoading, pT->m_ClsID);
}
}
@@ -266,46 +246,41 @@ DllInitClasses(BOOL bLoading)
STDAPI
DllCanUnloadNow()
{
- DbgLog((LOG_MEMORY, 2, TEXT("DLLCanUnloadNow called - IsLocked = %d, Active objects = %d"),
- CClassFactory::IsLocked(),
- CBaseObject::ObjectsActive()));
+ DbgLog((LOG_MEMORY,2,TEXT("DLLCanUnloadNow called - IsLocked = %d, Active objects = %d"),
+ CClassFactory::IsLocked(),
+ CBaseObject::ObjectsActive()));
- if(CClassFactory::IsLocked() || CBaseObject::ObjectsActive())
- {
- return S_FALSE;
- }
- else
- {
+ if (CClassFactory::IsLocked() || CBaseObject::ObjectsActive()) {
+ return S_FALSE;
+ } else {
return S_OK;
}
}
// --- standard WIN32 entrypoints --------------------------------------
-BOOL SetHeapOptions()
-{
- HMODULE hLib = LoadLibrary(L"kernel32.dll");
- if(hLib == NULL) return FALSE;
-
- typedef BOOL (WINAPI * HSI)
- (HANDLE, HEAP_INFORMATION_CLASS , PVOID, SIZE_T);
- HSI pHsi = (HSI)GetProcAddress(hLib, "HeapSetInformation");
- if(!pHsi)
- {
- FreeLibrary(hLib);
- return FALSE;
- }
+BOOL SetHeapOptions() {
+ HMODULE hLib = LoadLibrary(L"kernel32.dll");
+ if (hLib == NULL) return FALSE;
+
+ typedef BOOL (WINAPI *HSI)
+ (HANDLE, HEAP_INFORMATION_CLASS ,PVOID, SIZE_T);
+ HSI pHsi = (HSI)GetProcAddress(hLib,"HeapSetInformation");
+ if (!pHsi) {
+ FreeLibrary(hLib);
+ return FALSE;
+ }
#ifndef HeapEnableTerminationOnCorruption
# define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1
#endif
- BOOL fRet = (pHsi)(NULL, HeapEnableTerminationOnCorruption, NULL, 0)
- ? TRUE
- : FALSE;
- if(hLib) FreeLibrary(hLib);
+ BOOL fRet = (pHsi)(NULL,HeapEnableTerminationOnCorruption,NULL,0)
+ ? TRUE
+ : FALSE;
+ if (hLib) FreeLibrary(hLib);
- return fRet;
+ return fRet;
}
extern "C" void __cdecl __security_init_cookie(void);
@@ -314,16 +289,15 @@ extern "C" BOOL WINAPI _DllEntryPoint(HINSTANCE, ULONG, __inout_opt LPVOID);
extern "C"
DECLSPEC_NOINLINE
-BOOL
+BOOL
WINAPI
DllEntryPoint(
- HINSTANCE hInstance,
- ULONG ulReason,
+ HINSTANCE hInstance,
+ ULONG ulReason,
__inout_opt LPVOID pv
-)
+ )
{
- if(ulReason == DLL_PROCESS_ATTACH)
- {
+ if ( ulReason == DLL_PROCESS_ATTACH ) {
// Must happen before any other code is executed. Thankfully - it's re-entrant
__security_init_cookie();
}
@@ -332,43 +306,40 @@ DllEntryPoint(
DECLSPEC_NOINLINE
-BOOL
+BOOL
WINAPI
_DllEntryPoint(
- HINSTANCE hInstance,
- ULONG ulReason,
+ HINSTANCE hInstance,
+ ULONG ulReason,
__inout_opt LPVOID pv
-)
+ )
{
#ifdef _DEBUG
extern bool g_fDbgInDllEntryPoint;
g_fDbgInDllEntryPoint = true;
#endif
- switch(ulReason)
+ switch (ulReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstance);
DbgInitialise(hInstance);
- {
- SetHeapOptions();
- // The platform identifier is used to work out whether
- // full unicode support is available or not. Hence the
- // default will be the lowest common denominator - i.e. N/A
- g_amPlatform = VER_PLATFORM_WIN32_WINDOWS; // win95 assumed in case GetVersionEx fails
-
- g_osInfo.dwOSVersionInfoSize = sizeof(g_osInfo);
- if(GetVersionEx(&g_osInfo))
- {
- g_amPlatform = g_osInfo.dwPlatformId;
- }
- else
- {
- DbgLog((LOG_ERROR, 1, TEXT("Failed to get the OS platform, assuming Win95")));
- }
- }
+ {
+ SetHeapOptions();
+ // The platform identifier is used to work out whether
+ // full unicode support is available or not. Hence the
+ // default will be the lowest common denominator - i.e. N/A
+ g_amPlatform = VER_PLATFORM_WIN32_WINDOWS; // win95 assumed in case GetVersionEx fails
+
+ g_osInfo.dwOSVersionInfoSize = sizeof(g_osInfo);
+ if (GetVersionEx(&g_osInfo)) {
+ g_amPlatform = g_osInfo.dwPlatformId;
+ } else {
+ DbgLog((LOG_ERROR, 1, TEXT("Failed to get the OS platform, assuming Win95")));
+ }
+ }
g_hInst = hInstance;
DllInitClasses(TRUE);
@@ -378,8 +349,7 @@ _DllEntryPoint(
DllInitClasses(FALSE);
#ifdef _DEBUG
- if(CBaseObject::ObjectsActive())
- {
+ if (CBaseObject::ObjectsActive()) {
DbgSetModuleLevel(LOG_MEMORY, 2);
TCHAR szInfo[512];
extern TCHAR m_ModuleName[]; // Cut down module name
@@ -387,26 +357,23 @@ _DllEntryPoint(
TCHAR FullName[_MAX_PATH]; // Load the full path and module name
TCHAR *pName; // Searches from the end for a backslash
- GetModuleFileName(NULL, FullName, _MAX_PATH);
- pName = _tcsrchr(FullName, '\\');
- if(pName == NULL)
- {
+ GetModuleFileName(NULL,FullName,_MAX_PATH);
+ pName = _tcsrchr(FullName,'\\');
+ if (pName == NULL) {
pName = FullName;
- }
- else
- {
+ } else {
pName++;
}
(void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("Executable: %s Pid %x Tid %x. "),
- pName, GetCurrentProcessId(), GetCurrentThreadId());
+ pName, GetCurrentProcessId(), GetCurrentThreadId());
- (void)StringCchPrintf(szInfo + lstrlen(szInfo), NUMELMS(szInfo) - lstrlen(szInfo), TEXT("Module %s, %d objects left active!"),
- m_ModuleName, CBaseObject::ObjectsActive());
- DbgAssert(szInfo, TEXT(__FILE__), __LINE__);
+ (void)StringCchPrintf(szInfo+lstrlen(szInfo), NUMELMS(szInfo) - lstrlen(szInfo), TEXT("Module %s, %d objects left active!"),
+ m_ModuleName, CBaseObject::ObjectsActive());
+ DbgAssert(szInfo, TEXT(__FILE__),__LINE__);
- // If running remotely wait for the Assert to be acknowledged
- // before dumping out the object register
+ // If running remotely wait for the Assert to be acknowledged
+ // before dumping out the object register
DbgDumpObjectRegister();
}
DbgTerminate();
diff --git a/src/filters/BaseClasses/dllsetup.cpp b/src/filters/BaseClasses/dllsetup.cpp
index 9b610df4b..c14c2f8e1 100644
--- a/src/filters/BaseClasses/dllsetup.cpp
+++ b/src/filters/BaseClasses/dllsetup.cpp
@@ -37,63 +37,62 @@ extern CFactoryTemplate g_Templates[];
//---------------------------------------------------------------------------
STDAPI
-EliminateSubKey(HKEY hkey, LPCTSTR strSubKey)
+EliminateSubKey( HKEY hkey, LPCTSTR strSubKey )
{
- HKEY hk;
- if(0 == lstrlen(strSubKey))
+ HKEY hk;
+ if (0 == lstrlen(strSubKey) ) {
+ // defensive approach
+ return E_FAIL;
+ }
+
+ LONG lreturn = RegOpenKeyEx( hkey
+ , strSubKey
+ , 0
+ , MAXIMUM_ALLOWED
+ , &hk );
+
+ ASSERT( lreturn == ERROR_SUCCESS
+ || lreturn == ERROR_FILE_NOT_FOUND
+ || lreturn == ERROR_INVALID_HANDLE );
+
+ if( ERROR_SUCCESS == lreturn )
+ {
+ // Keep on enumerating the first (zero-th)
+ // key and deleting that
+
+ for( ; ; )
{
- // defensive approach
- return E_FAIL;
+ TCHAR Buffer[MAX_KEY_LEN];
+ DWORD dw = MAX_KEY_LEN;
+ FILETIME ft;
+
+ lreturn = RegEnumKeyEx( hk
+ , 0
+ , Buffer
+ , &dw
+ , NULL
+ , NULL
+ , NULL
+ , &ft);
+
+ ASSERT( lreturn == ERROR_SUCCESS
+ || lreturn == ERROR_NO_MORE_ITEMS );
+
+ if( ERROR_SUCCESS == lreturn )
+ {
+ EliminateSubKey(hk, Buffer);
+ }
+ else
+ {
+ break;
+ }
}
- LONG lreturn = RegOpenKeyEx(hkey
- , strSubKey
- , 0
- , MAXIMUM_ALLOWED
- , &hk);
+ RegCloseKey(hk);
+ RegDeleteKey(hkey, strSubKey);
+ }
- ASSERT(lreturn == ERROR_SUCCESS
- || lreturn == ERROR_FILE_NOT_FOUND
- || lreturn == ERROR_INVALID_HANDLE);
-
- if(ERROR_SUCCESS == lreturn)
- {
- // Keep on enumerating the first (zero-th)
- // key and deleting that
-
- for(; ;)
- {
- TCHAR Buffer[MAX_KEY_LEN];
- DWORD dw = MAX_KEY_LEN;
- FILETIME ft;
-
- lreturn = RegEnumKeyEx(hk
- , 0
- , Buffer
- , &dw
- , NULL
- , NULL
- , NULL
- , &ft);
-
- ASSERT(lreturn == ERROR_SUCCESS
- || lreturn == ERROR_NO_MORE_ITEMS);
-
- if(ERROR_SUCCESS == lreturn)
- {
- EliminateSubKey(hk, Buffer);
- }
- else
- {
- break;
- }
- }
-
- RegCloseKey(hk);
- RegDeleteKey(hkey, strSubKey);
- }
-
- return NOERROR;
+ return NOERROR;
}
@@ -109,99 +108,99 @@ EliminateSubKey(HKEY hkey, LPCTSTR strSubKey)
//---------------------------------------------------------------------------
STDAPI
-AMovieSetupRegisterServer(CLSID clsServer
- , LPCWSTR szDescription
- , LPCWSTR szFileName
- , LPCWSTR szThreadingModel = L"Both"
- , LPCWSTR szServerType = L"InprocServer32")
+AMovieSetupRegisterServer( CLSID clsServer
+ , LPCWSTR szDescription
+ , LPCWSTR szFileName
+ , LPCWSTR szThreadingModel = L"Both"
+ , LPCWSTR szServerType = L"InprocServer32" )
{
- // temp buffer
- //
- TCHAR achTemp[_MAX_PATH];
-
- // convert CLSID uuid to string and write
- // out subkey as string - CLSID\{}
- //
- OLECHAR szCLSID[CHARS_IN_GUID];
- HRESULT hr = StringFromGUID2(clsServer
- , szCLSID
- , CHARS_IN_GUID);
- ASSERT(SUCCEEDED(hr));
-
- // create key
- //
- HKEY hkey;
- (void)StringCchPrintf(achTemp, NUMELMS(achTemp), TEXT("CLSID\\%ls"), szCLSID);
- LONG lreturn = RegCreateKey(HKEY_CLASSES_ROOT
- , (LPCTSTR)achTemp
- , &hkey);
- if(ERROR_SUCCESS != lreturn)
- {
- return AmHresultFromWin32(lreturn);
- }
-
- // set description string
- //
-
- (void)StringCchPrintf(achTemp, NUMELMS(achTemp), TEXT("%ls"), szDescription);
- lreturn = RegSetValue(hkey
- , (LPCTSTR)NULL
- , REG_SZ
- , achTemp
- , sizeof(achTemp));
- if(ERROR_SUCCESS != lreturn)
- {
- RegCloseKey(hkey);
- return AmHresultFromWin32(lreturn);
- }
-
- // create CLSID\\{"CLSID"}\\"ServerType" key,
- // using key to CLSID\\{"CLSID"} passed back by
- // last call to RegCreateKey().
- //
- HKEY hsubkey;
-
- (void)StringCchPrintf(achTemp, NUMELMS(achTemp), TEXT("%ls"), szServerType);
- lreturn = RegCreateKey(hkey
- , achTemp
- , &hsubkey);
- if(ERROR_SUCCESS != lreturn)
- {
- RegCloseKey(hkey);
- return AmHresultFromWin32(lreturn);
- }
-
- // set Server string
- //
- (void)StringCchPrintf(achTemp, NUMELMS(achTemp), TEXT("%ls"), szFileName);
- lreturn = RegSetValue(hsubkey
- , (LPCTSTR)NULL
- , REG_SZ
- , (LPCTSTR)achTemp
- , sizeof(TCHAR) * (lstrlen(achTemp) + 1));
- if(ERROR_SUCCESS != lreturn)
- {
- RegCloseKey(hkey);
- RegCloseKey(hsubkey);
- return AmHresultFromWin32(lreturn);
- }
-
- (void)StringCchPrintf(achTemp, NUMELMS(achTemp), TEXT("%ls"), szThreadingModel);
- lreturn = RegSetValueEx(hsubkey
- , TEXT("ThreadingModel")
- , 0L
- , REG_SZ
- , (CONST BYTE *)achTemp
- , sizeof(TCHAR) * (lstrlen(achTemp) + 1));
-
- // close hkeys
- //
- RegCloseKey(hkey);
- RegCloseKey(hsubkey);
-
- // and return
- //
- return HRESULT_FROM_WIN32(lreturn);
+ // temp buffer
+ //
+ TCHAR achTemp[_MAX_PATH];
+
+ // convert CLSID uuid to string and write
+ // out subkey as string - CLSID\{}
+ //
+ OLECHAR szCLSID[CHARS_IN_GUID];
+ HRESULT hr = StringFromGUID2( clsServer
+ , szCLSID
+ , CHARS_IN_GUID );
+ ASSERT( SUCCEEDED(hr) );
+
+ // create key
+ //
+ HKEY hkey;
+ (void)StringCchPrintf( achTemp, NUMELMS(achTemp), TEXT("CLSID\\%ls"), szCLSID );
+ LONG lreturn = RegCreateKey( HKEY_CLASSES_ROOT
+ , (LPCTSTR)achTemp
+ , &hkey );
+ if( ERROR_SUCCESS != lreturn )
+ {
+ return AmHresultFromWin32(lreturn);
+ }
+
+ // set description string
+ //
+
+ (void)StringCchPrintf( achTemp, NUMELMS(achTemp), TEXT("%ls"), szDescription );
+ lreturn = RegSetValue( hkey
+ , (LPCTSTR)NULL
+ , REG_SZ
+ , achTemp
+ , sizeof(achTemp) );
+ if( ERROR_SUCCESS != lreturn )
+ {
+ RegCloseKey( hkey );
+ return AmHresultFromWin32(lreturn);
+ }
+
+ // create CLSID\\{"CLSID"}\\"ServerType" key,
+ // using key to CLSID\\{"CLSID"} passed back by
+ // last call to RegCreateKey().
+ //
+ HKEY hsubkey;
+
+ (void)StringCchPrintf( achTemp, NUMELMS(achTemp), TEXT("%ls"), szServerType );
+ lreturn = RegCreateKey( hkey
+ , achTemp
+ , &hsubkey );
+ if( ERROR_SUCCESS != lreturn )
+ {
+ RegCloseKey( hkey );
+ return AmHresultFromWin32(lreturn);
+ }
+
+ // set Server string
+ //
+ (void)StringCchPrintf( achTemp, NUMELMS(achTemp), TEXT("%ls"), szFileName );
+ lreturn = RegSetValue( hsubkey
+ , (LPCTSTR)NULL
+ , REG_SZ
+ , (LPCTSTR)achTemp
+ , sizeof(TCHAR) * (lstrlen(achTemp)+1) );
+ if( ERROR_SUCCESS != lreturn )
+ {
+ RegCloseKey( hkey );
+ RegCloseKey( hsubkey );
+ return AmHresultFromWin32(lreturn);
+ }
+
+ (void)StringCchPrintf( achTemp, NUMELMS(achTemp), TEXT("%ls"), szThreadingModel );
+ lreturn = RegSetValueEx( hsubkey
+ , TEXT("ThreadingModel")
+ , 0L
+ , REG_SZ
+ , (CONST BYTE *)achTemp
+ , sizeof(TCHAR) * (lstrlen(achTemp)+1) );
+
+ // close hkeys
+ //
+ RegCloseKey( hkey );
+ RegCloseKey( hsubkey );
+
+ // and return
+ //
+ return HRESULT_FROM_WIN32(lreturn);
}
@@ -217,29 +216,29 @@ AMovieSetupRegisterServer(CLSID clsServer
//---------------------------------------------------------------------------
STDAPI
-AMovieSetupUnregisterServer(CLSID clsServer)
+AMovieSetupUnregisterServer( CLSID clsServer )
{
- // convert CLSID uuid to string and write
- // out subkey CLSID\{}
- //
- OLECHAR szCLSID[CHARS_IN_GUID];
- HRESULT hr = StringFromGUID2(clsServer
- , szCLSID
- , CHARS_IN_GUID);
- ASSERT(SUCCEEDED(hr));
-
- TCHAR achBuffer[MAX_KEY_LEN];
- (void)StringCchPrintf(achBuffer, NUMELMS(achBuffer), TEXT("CLSID\\%ls"), szCLSID);
-
- // delete subkey
- //
-
- hr = EliminateSubKey(HKEY_CLASSES_ROOT, achBuffer);
- ASSERT(SUCCEEDED(hr));
-
- // return
- //
- return NOERROR;
+ // convert CLSID uuid to string and write
+ // out subkey CLSID\{}
+ //
+ OLECHAR szCLSID[CHARS_IN_GUID];
+ HRESULT hr = StringFromGUID2( clsServer
+ , szCLSID
+ , CHARS_IN_GUID );
+ ASSERT( SUCCEEDED(hr) );
+
+ TCHAR achBuffer[MAX_KEY_LEN];
+ (void)StringCchPrintf( achBuffer, NUMELMS(achBuffer), TEXT("CLSID\\%ls"), szCLSID );
+
+ // delete subkey
+ //
+
+ hr = EliminateSubKey( HKEY_CLASSES_ROOT, achBuffer );
+ ASSERT( SUCCEEDED(hr) );
+
+ // return
+ //
+ return NOERROR;
}
@@ -250,58 +249,58 @@ AMovieSetupUnregisterServer(CLSID clsServer)
//---------------------------------------------------------------------------
STDAPI
-AMovieSetupRegisterFilter2(const AMOVIESETUP_FILTER * const psetupdata
- , IFilterMapper2 * pIFM2
- , BOOL bRegister)
+AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata
+ , IFilterMapper2 * pIFM2
+ , BOOL bRegister )
{
- DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter")));
-
- // check we've got data
+ DbgLog((LOG_TRACE, 3, TEXT("= AMovieSetupRegisterFilter")));
+
+ // check we've got data
+ //
+ if( NULL == psetupdata ) return S_FALSE;
+
+
+ // unregister filter
+ // (as pins are subkeys of filter's CLSID key
+ // they do not need to be removed separately).
+ //
+ DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter")));
+ HRESULT hr = pIFM2->UnregisterFilter(
+ 0, // default category
+ 0, // default instance name
+ *psetupdata->clsID );
+
+
+ if( bRegister )
+ {
+ REGFILTER2 rf2;
+ rf2.dwVersion = 1;
+ rf2.dwMerit = psetupdata->dwMerit;
+ rf2.cPins = psetupdata->nPins;
+ rf2.rgPins = psetupdata->lpPin;
+
+ const CLSID *filterCategory=&psetupdata->filterCategory;
+
+ // register filter
//
- if(NULL == psetupdata) return S_FALSE;
-
-
- // unregister filter
- // (as pins are subkeys of filter's CLSID key
- // they do not need to be removed separately).
- //
- DbgLog((LOG_TRACE, 3, TEXT("= = unregister filter")));
- HRESULT hr = pIFM2->UnregisterFilter(
- 0, // default category
- 0, // default instance name
- *psetupdata->clsID);
-
-
- if(bRegister)
- {
- REGFILTER2 rf2;
- rf2.dwVersion = 1;
- rf2.dwMerit = psetupdata->dwMerit;
- rf2.cPins = psetupdata->nPins;
- rf2.rgPins = psetupdata->lpPin;
-
- const CLSID *filterCategory = &psetupdata->filterCategory;
-
- // register filter
- //
- DbgLog((LOG_TRACE, 3, TEXT("= = register filter")));
- hr = pIFM2->RegisterFilter(*psetupdata->clsID
- , psetupdata->strName
- , 0 // moniker
- , filterCategory // category
- , NULL // instance
- , &rf2);
- }
-
- // handle one acceptable "error" - that
- // of filter not being registered!
- // (couldn't find a suitable #define'd
- // name for the error!)
- //
- if(0x80070002 == hr)
- return NOERROR;
- else
- return hr;
+ DbgLog((LOG_TRACE, 3, TEXT("= = register filter")));
+ hr = pIFM2->RegisterFilter(*psetupdata->clsID
+ , psetupdata->strName
+ , 0 // moniker
+ ,filterCategory // category
+ , NULL // instance
+ , &rf2);
+ }
+
+ // handle one acceptable "error" - that
+ // of filter not being registered!
+ // (couldn't find a suitable #define'd
+ // name for the error!)
+ //
+ if( 0x80070002 == hr)
+ return NOERROR;
+ else
+ return hr;
}
@@ -312,40 +311,40 @@ AMovieSetupRegisterFilter2(const AMOVIESETUP_FILTER * const psetupdata
//---------------------------------------------------------------------------
STDAPI
-RegisterAllServers(LPCWSTR szFileName, BOOL bRegister)
+RegisterAllServers( LPCWSTR szFileName, BOOL bRegister )
{
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
- for(int i = 0; i < g_cTemplates; i++)
- {
- // get i'th template
- //
- const CFactoryTemplate *pT = &g_Templates[i];
+ for( int i = 0; i < g_cTemplates; i++ )
+ {
+ // get i'th template
+ //
+ const CFactoryTemplate *pT = &g_Templates[i];
- DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"),
- (LPCWSTR)pT->m_Name));
+ DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"),
+ (LPCWSTR)pT->m_Name ));
- // register CLSID and InprocServer32
- //
- if(bRegister)
- {
- hr = AMovieSetupRegisterServer(*(pT->m_ClsID)
- , (LPCWSTR)pT->m_Name
- , szFileName);
- }
- else
- {
- hr = AMovieSetupUnregisterServer(*(pT->m_ClsID));
- }
-
- // check final error for this pass
- // and break loop if we failed
- //
- if(FAILED(hr))
- break;
+ // register CLSID and InprocServer32
+ //
+ if( bRegister )
+ {
+ hr = AMovieSetupRegisterServer( *(pT->m_ClsID)
+ , (LPCWSTR)pT->m_Name
+ , szFileName );
+ }
+ else
+ {
+ hr = AMovieSetupUnregisterServer( *(pT->m_ClsID) );
}
- return hr;
+ // check final error for this pass
+ // and break loop if we failed
+ //
+ if( FAILED(hr) )
+ break;
+ }
+
+ return hr;
}
@@ -368,147 +367,147 @@ RegisterAllServers(LPCWSTR szFileName, BOOL bRegister)
//---------------------------------------------------------------------------
STDAPI
-AMovieDllRegisterServer2(BOOL bRegister)
+AMovieDllRegisterServer2( BOOL bRegister )
{
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
- DbgLog((LOG_TRACE, 2, TEXT("AMovieDllRegisterServer2()")));
+ DbgLog((LOG_TRACE, 2, TEXT("AMovieDllRegisterServer2()")));
- // get file name (where g_hInst is the
- // instance handle of the filter dll)
- //
- WCHAR achFileName[_MAX_PATH];
+ // get file name (where g_hInst is the
+ // instance handle of the filter dll)
+ //
+ WCHAR achFileName[_MAX_PATH];
- // WIN95 doesn't support GetModuleFileNameW
- //
- {
- char achTemp[_MAX_PATH];
+ // WIN95 doesn't support GetModuleFileNameW
+ //
+ {
+ char achTemp[_MAX_PATH];
- DbgLog((LOG_TRACE, 2, TEXT("- get module file name")));
+ DbgLog((LOG_TRACE, 2, TEXT("- get module file name")));
- // g_hInst handle is set in our dll entry point. Make sure
- // DllEntryPoint in dllentry.cpp is called
- ASSERT(g_hInst != 0);
+ // g_hInst handle is set in our dll entry point. Make sure
+ // DllEntryPoint in dllentry.cpp is called
+ ASSERT(g_hInst != 0);
- if(0 == GetModuleFileNameA(g_hInst
- , achTemp
- , sizeof(achTemp)))
- {
- // we've failed!
- DWORD dwerr = GetLastError();
- return AmHresultFromWin32(dwerr);
- }
-
- MultiByteToWideChar(CP_ACP
- , 0L
- , achTemp
- , lstrlenA(achTemp) + 1
- , achFileName
- , NUMELMS(achFileName));
+ if( 0 == GetModuleFileNameA( g_hInst
+ , achTemp
+ , sizeof(achTemp) ) )
+ {
+ // we've failed!
+ DWORD dwerr = GetLastError();
+ return AmHresultFromWin32(dwerr);
}
+ MultiByteToWideChar( CP_ACP
+ , 0L
+ , achTemp
+ , lstrlenA(achTemp) + 1
+ , achFileName
+ , NUMELMS(achFileName) );
+ }
+
+ //
+ // first registering, register all OLE servers
+ //
+ if( bRegister )
+ {
+ DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers")));
+ hr = RegisterAllServers( achFileName, TRUE );
+ }
+
+ //
+ // next, register/unregister all filters
+ //
+
+ if( SUCCEEDED(hr) )
+ {
+ // init is ref counted so call just in case
+ // we're being called cold.
//
- // first registering, register all OLE servers
+ DbgLog((LOG_TRACE, 2, TEXT("- CoInitialize")));
+ hr = CoInitialize( (LPVOID)NULL );
+ ASSERT( SUCCEEDED(hr) );
+
+ // get hold of IFilterMapper2
//
- if(bRegister)
+ DbgLog((LOG_TRACE, 2, TEXT("- obtain IFilterMapper2")));
+ IFilterMapper2 *pIFM2 = 0;
+ IFilterMapper *pIFM = 0;
+ hr = CoCreateInstance( CLSID_FilterMapper2
+ , NULL
+ , CLSCTX_INPROC_SERVER
+ , IID_IFilterMapper2
+ , (void **)&pIFM2 );
+ if(FAILED(hr))
{
- DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers")));
- hr = RegisterAllServers(achFileName, TRUE);
+ DbgLog((LOG_TRACE, 2, TEXT("- trying IFilterMapper instead")));
+
+ hr = CoCreateInstance(
+ CLSID_FilterMapper,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_IFilterMapper,
+ (void **)&pIFM);
}
-
- //
- // next, register/unregister all filters
- //
-
- if(SUCCEEDED(hr))
+ if( SUCCEEDED(hr) )
{
- // init is ref counted so call just in case
- // we're being called cold.
+ // scan through array of CFactoryTemplates
+ // registering servers and filters.
+ //
+ DbgLog((LOG_TRACE, 2, TEXT("- register Filters")));
+ for( int i = 0; i < g_cTemplates; i++ )
+ {
+ // get i'th template
//
- DbgLog((LOG_TRACE, 2, TEXT("- CoInitialize")));
- hr = CoInitialize((LPVOID)NULL);
- ASSERT(SUCCEEDED(hr));
+ const CFactoryTemplate *pT = &g_Templates[i];
- // get hold of IFilterMapper2
- //
- DbgLog((LOG_TRACE, 2, TEXT("- obtain IFilterMapper2")));
- IFilterMapper2 *pIFM2 = 0;
- IFilterMapper *pIFM = 0;
- hr = CoCreateInstance(CLSID_FilterMapper2
- , NULL
- , CLSCTX_INPROC_SERVER
- , IID_IFilterMapper2
- , (void **)&pIFM2);
- if(FAILED(hr))
+ if( NULL != pT->m_pAMovieSetup_Filter )
{
- DbgLog((LOG_TRACE, 2, TEXT("- trying IFilterMapper instead")));
-
- hr = CoCreateInstance(
- CLSID_FilterMapper,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_IFilterMapper,
- (void **)&pIFM);
+ DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"), (LPCWSTR)pT->m_Name ));
+
+ if(pIFM2)
+ {
+ hr = AMovieSetupRegisterFilter2( pT->m_pAMovieSetup_Filter, pIFM2, bRegister );
+ }
+ else
+ {
+ hr = AMovieSetupRegisterFilter( pT->m_pAMovieSetup_Filter, pIFM, bRegister );
+ }
}
- if(SUCCEEDED(hr))
- {
- // scan through array of CFactoryTemplates
- // registering servers and filters.
- //
- DbgLog((LOG_TRACE, 2, TEXT("- register Filters")));
- for(int i = 0; i < g_cTemplates; i++)
- {
- // get i'th template
- //
- const CFactoryTemplate *pT = &g_Templates[i];
-
- if(NULL != pT->m_pAMovieSetup_Filter)
- {
- DbgLog((LOG_TRACE, 2, TEXT("- - register %ls"), (LPCWSTR)pT->m_Name));
-
- if(pIFM2)
- {
- hr = AMovieSetupRegisterFilter2(pT->m_pAMovieSetup_Filter, pIFM2, bRegister);
- }
- else
- {
- hr = AMovieSetupRegisterFilter(pT->m_pAMovieSetup_Filter, pIFM, bRegister);
- }
- }
-
- // check final error for this pass
- // and break loop if we failed
- //
- if(FAILED(hr))
- break;
- }
-
- // release interface
- //
- if(pIFM2)
- pIFM2->Release();
- else
- pIFM->Release();
- }
-
- // and clear up
+ // check final error for this pass
+ // and break loop if we failed
//
- CoFreeUnusedLibraries();
- CoUninitialize();
- }
+ if( FAILED(hr) )
+ break;
+ }
+
+ // release interface
+ //
+ if(pIFM2)
+ pIFM2->Release();
+ else
+ pIFM->Release();
- //
- // if unregistering, unregister all OLE servers
- //
- if(SUCCEEDED(hr) && !bRegister)
- {
- DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers")));
- hr = RegisterAllServers(achFileName, FALSE);
}
- DbgLog((LOG_TRACE, 2, TEXT("- return %0x"), hr));
- return hr;
+ // and clear up
+ //
+ CoFreeUnusedLibraries();
+ CoUninitialize();
+ }
+
+ //
+ // if unregistering, unregister all OLE servers
+ //
+ if( SUCCEEDED(hr) && !bRegister )
+ {
+ DbgLog((LOG_TRACE, 2, TEXT("- register OLE Servers")));
+ hr = RegisterAllServers( achFileName, FALSE );
+ }
+
+ DbgLog((LOG_TRACE, 2, TEXT("- return %0x"), hr));
+ return hr;
}
@@ -532,90 +531,90 @@ AMovieDllRegisterServer2(BOOL bRegister)
STDAPI
-AMovieDllRegisterServer(void)
+AMovieDllRegisterServer( void )
{
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
- // get file name (where g_hInst is the
- // instance handle of the filter dll)
+ // get file name (where g_hInst is the
+ // instance handle of the filter dll)
+ //
+ WCHAR achFileName[_MAX_PATH];
+
+ {
+ // WIN95 doesn't support GetModuleFileNameW
//
- WCHAR achFileName[_MAX_PATH];
+ char achTemp[_MAX_PATH];
+ if( 0 == GetModuleFileNameA( g_hInst
+ , achTemp
+ , sizeof(achTemp) ) )
{
- // WIN95 doesn't support GetModuleFileNameW
- //
- char achTemp[_MAX_PATH];
-
- if(0 == GetModuleFileNameA(g_hInst
- , achTemp
- , sizeof(achTemp)))
- {
- // we've failed!
- DWORD dwerr = GetLastError();
- return AmHresultFromWin32(dwerr);
- }
-
- MultiByteToWideChar(CP_ACP
- , 0L
- , achTemp
- , lstrlenA(achTemp) + 1
- , achFileName
- , NUMELMS(achFileName));
+ // we've failed!
+ DWORD dwerr = GetLastError();
+ return AmHresultFromWin32(dwerr);
}
- // scan through array of CFactoryTemplates
- // registering servers and filters.
+ MultiByteToWideChar( CP_ACP
+ , 0L
+ , achTemp
+ , lstrlenA(achTemp) + 1
+ , achFileName
+ , NUMELMS(achFileName) );
+ }
+
+ // scan through array of CFactoryTemplates
+ // registering servers and filters.
+ //
+ for( int i = 0; i < g_cTemplates; i++ )
+ {
+ // get i'th template
//
- for(int i = 0; i < g_cTemplates; i++)
- {
- // get i'th template
- //
- const CFactoryTemplate *pT = &g_Templates[i];
+ const CFactoryTemplate *pT = &g_Templates[i];
- // register CLSID and InprocServer32
- //
- hr = AMovieSetupRegisterServer(*(pT->m_ClsID)
- , (LPCWSTR)pT->m_Name
- , achFileName);
+ // register CLSID and InprocServer32
+ //
+ hr = AMovieSetupRegisterServer( *(pT->m_ClsID)
+ , (LPCWSTR)pT->m_Name
+ , achFileName );
- // instantiate all servers and get hold of
- // IAMovieSetup, if implemented, and call
- // IAMovieSetup.Register() method
- //
- if(SUCCEEDED(hr) && (NULL != pT->m_lpfnNew))
- {
- // instantiate object
- //
- PAMOVIESETUP psetup;
- hr = CoCreateInstance(*(pT->m_ClsID)
- , 0
- , CLSCTX_INPROC_SERVER
- , IID_IAMovieSetup
- , reinterpret_cast<void**>(&psetup));
- if(SUCCEEDED(hr))
- {
- hr = psetup->Unregister();
- if(SUCCEEDED(hr))
- hr = psetup->Register();
- psetup->Release();
- }
- else
- {
- if((E_NOINTERFACE == hr)
- || (VFW_E_NEED_OWNER == hr))
- hr = NOERROR;
- }
- }
+ // instantiate all servers and get hold of
+ // IAMovieSetup, if implemented, and call
+ // IAMovieSetup.Register() method
+ //
+ if( SUCCEEDED(hr) && (NULL != pT->m_lpfnNew) )
+ {
+ // instantiate object
+ //
+ PAMOVIESETUP psetup;
+ hr = CoCreateInstance( *(pT->m_ClsID)
+ , 0
+ , CLSCTX_INPROC_SERVER
+ , IID_IAMovieSetup
+ , reinterpret_cast<void**>(&psetup) );
+ if( SUCCEEDED(hr) )
+ {
+ hr = psetup->Unregister();
+ if( SUCCEEDED(hr) )
+ hr = psetup->Register();
+ psetup->Release();
+ }
+ else
+ {
+ if( (E_NOINTERFACE == hr )
+ || (VFW_E_NEED_OWNER == hr ) )
+ hr = NOERROR;
+ }
+ }
- // check final error for this pass
- // and break loop if we failed
- //
- if(FAILED(hr))
- break;
+ // check final error for this pass
+ // and break loop if we failed
+ //
+ if( FAILED(hr) )
+ break;
- } // end-for
+ } // end-for
- return hr;
+ return hr;
}
@@ -640,57 +639,57 @@ AMovieDllRegisterServer(void)
STDAPI
AMovieDllUnregisterServer()
{
- // initialize return code
+ // initialize return code
+ //
+ HRESULT hr = NOERROR;
+
+ // scan through CFactory template and unregister
+ // all OLE servers and filters.
+ //
+ for( int i = g_cTemplates; i--; )
+ {
+ // get i'th template
//
- HRESULT hr = NOERROR;
+ const CFactoryTemplate *pT = &g_Templates[i];
- // scan through CFactory template and unregister
- // all OLE servers and filters.
+ // check method exists
//
- for(int i = g_cTemplates; i--;)
+ if( NULL != pT->m_lpfnNew )
{
- // get i'th template
- //
- const CFactoryTemplate *pT = &g_Templates[i];
-
- // check method exists
- //
- if(NULL != pT->m_lpfnNew)
- {
- // instantiate object
- //
- PAMOVIESETUP psetup;
- hr = CoCreateInstance(*(pT->m_ClsID)
- , 0
- , CLSCTX_INPROC_SERVER
- , IID_IAMovieSetup
- , reinterpret_cast<void**>(&psetup));
- if(SUCCEEDED(hr))
- {
- hr = psetup->Unregister();
- psetup->Release();
- }
- else
- {
- if((E_NOINTERFACE == hr)
- || (VFW_E_NEED_OWNER == hr))
- hr = NOERROR;
- }
- }
-
- // unregister CLSID and InprocServer32
- //
- if(SUCCEEDED(hr))
- {
- hr = AMovieSetupUnregisterServer(*(pT->m_ClsID));
- }
+ // instantiate object
+ //
+ PAMOVIESETUP psetup;
+ hr = CoCreateInstance( *(pT->m_ClsID)
+ , 0
+ , CLSCTX_INPROC_SERVER
+ , IID_IAMovieSetup
+ , reinterpret_cast<void**>(&psetup) );
+ if( SUCCEEDED(hr) )
+ {
+ hr = psetup->Unregister();
+ psetup->Release();
+ }
+ else
+ {
+ if( (E_NOINTERFACE == hr )
+ || (VFW_E_NEED_OWNER == hr ) )
+ hr = NOERROR;
+ }
+ }
- // check final error for this pass
- // and break loop if we failed
- //
- if(FAILED(hr))
- break;
+ // unregister CLSID and InprocServer32
+ //
+ if( SUCCEEDED(hr) )
+ {
+ hr = AMovieSetupUnregisterServer( *(pT->m_ClsID) );
}
- return hr;
+ // check final error for this pass
+ // and break loop if we failed
+ //
+ if( FAILED(hr) )
+ break;
+ }
+
+ return hr;
}
diff --git a/src/filters/BaseClasses/dllsetup.h b/src/filters/BaseClasses/dllsetup.h
index f532fa857..e363b8b6a 100644
--- a/src/filters/BaseClasses/dllsetup.h
+++ b/src/filters/BaseClasses/dllsetup.h
@@ -31,16 +31,16 @@
// AMovieDllRegisterServer calls IAMovieSetup.Register(), and
// AMovieDllUnregisterServer calls IAMovieSetup.Unregister().
-STDAPI AMovieDllRegisterServer2(BOOL);
+STDAPI AMovieDllRegisterServer2( BOOL );
STDAPI AMovieDllRegisterServer();
STDAPI AMovieDllUnregisterServer();
// helper functions
-STDAPI EliminateSubKey(HKEY, LPCTSTR);
+STDAPI EliminateSubKey( HKEY, LPCTSTR );
STDAPI
-AMovieSetupRegisterFilter2(const AMOVIESETUP_FILTER * const psetupdata
- , IFilterMapper2 * pIFM2
- , BOOL bRegister);
+AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata
+ , IFilterMapper2 * pIFM2
+ , BOOL bRegister );
diff --git a/src/filters/BaseClasses/dxmperf.h b/src/filters/BaseClasses/dxmperf.h
index f496a2f9e..54a21203b 100644
--- a/src/filters/BaseClasses/dxmperf.h
+++ b/src/filters/BaseClasses/dxmperf.h
@@ -14,21 +14,19 @@
#include "perflog.h"
#ifdef _IA64_
-extern "C" unsigned __int64 __getReg(int whichReg);
+extern "C" unsigned __int64 __getReg( int whichReg );
#pragma intrinsic(__getReg)
#endif // _IA64_
-inline ULONGLONG _RDTSC(void)
-{
+inline ULONGLONG _RDTSC( void ) {
#ifdef _X86_
LARGE_INTEGER li;
- __asm
- {
+ __asm {
_emit 0x0F
_emit 0x31
- mov li.LowPart, eax
- mov li.HighPart, edx
+ mov li.LowPart,eax
+ mov li.HighPart,edx
}
return li.QuadPart;
@@ -37,7 +35,7 @@ inline ULONGLONG _RDTSC(void)
#elif defined (_IA64_)
#define INL_REGID_APITC 3116
- return __getReg(INL_REGID_APITC);
+ return __getReg( INL_REGID_APITC );
#endif // 0
@@ -218,7 +216,7 @@ inline ULONGLONG _RDTSC(void)
perfData.data.sampleDuration = (msecs); \
PerflogTraceEvent ((PEVENT_TRACE_HEADER) &perfData); \
} \
-
+
inline
VOID PERFLOG_STREAMTRACE(
@@ -229,13 +227,13 @@ VOID PERFLOG_STREAMTRACE(
ULONGLONG Data2,
ULONGLONG Data3,
ULONGLONG Data4
-)
+ )
{
- if(Level <= PerflogModuleLevel)
+ if (Level <= PerflogModuleLevel)
{
PERFINFO_WMI_STREAMTRACE perfData;
- memset(&perfData, 0, sizeof(perfData));
- perfData.header.Size = sizeof(perfData);
+ memset( &perfData, 0, sizeof( perfData ) );
+ perfData.header.Size = sizeof( perfData );
perfData.header.Flags = WNODE_FLAG_TRACED_GUID;
perfData.header.Guid = GUID_STREAMTRACE;
perfData.data.dshowClock = DShowClock;
diff --git a/src/filters/BaseClasses/fourcc.h b/src/filters/BaseClasses/fourcc.h
index 34e828c21..19c0fcdbc 100644
--- a/src/filters/BaseClasses/fourcc.h
+++ b/src/filters/BaseClasses/fourcc.h
@@ -51,8 +51,7 @@ private:
#define GUID_Data4_2 0x719b3800
inline void
-FOURCCMap::InitGUID()
-{
+FOURCCMap::InitGUID() {
Data2 = GUID_Data2;
Data3 = GUID_Data3;
((DWORD *)Data4)[0] = GUID_Data4_1;
@@ -60,10 +59,9 @@ FOURCCMap::InitGUID()
}
inline
-FOURCCMap::FOURCCMap()
-{
+FOURCCMap::FOURCCMap() {
InitGUID();
- SetFOURCC(DWORD(0));
+ SetFOURCC( DWORD(0));
}
inline
diff --git a/src/filters/BaseClasses/measure.h b/src/filters/BaseClasses/measure.h
index dd4d588eb..a71a07532 100644
--- a/src/filters/BaseClasses/measure.h
+++ b/src/filters/BaseClasses/measure.h
@@ -148,23 +148,23 @@ extern "C" {
// This must be called first - (called by the DllEntry)
- void WINAPI Msr_Init(void);
+void WINAPI Msr_Init(void);
// Call this last to clean up (or just let it fall off the end - who cares?)
- void WINAPI Msr_Terminate(void);
+void WINAPI Msr_Terminate(void);
// Call this to get an Id for an "incident" that you can pass to Start, Stop or Note
// everything that's logged is called an "incident".
- int WINAPI Msr_Register(__in LPTSTR Incident);
+int WINAPI Msr_Register(__in LPTSTR Incident);
// Reset the statistical counts for an incident
- void WINAPI Msr_Reset(int Id);
+void WINAPI Msr_Reset(int Id);
// Reset all the counts for all incidents
@@ -172,26 +172,26 @@ extern "C" {
#define MSR_PAUSE 1
#define MSR_RUN 2
- void WINAPI Msr_Control(int iAction);
+void WINAPI Msr_Control(int iAction);
// log the start of an operation
- void WINAPI Msr_Start(int Id);
+void WINAPI Msr_Start(int Id);
// log the end of an operation
- void WINAPI Msr_Stop(int Id);
+void WINAPI Msr_Stop(int Id);
// log a one-off or repetitive operation
- void WINAPI Msr_Note(int Id);
+void WINAPI Msr_Note(int Id);
// log an integer (on which we can see statistics later)
- void WINAPI Msr_Integer(int Id, int n);
+void WINAPI Msr_Integer(int Id, int n);
// print out all the vaialable log (it may have wrapped) and then the statistics.
@@ -199,20 +199,20 @@ extern "C" {
// hFIle==NULL => use DbgLog
// otherwise hFile must have come from CreateFile or OpenFile.
- void WINAPI Msr_Dump(HANDLE hFile);
+void WINAPI Msr_Dump(HANDLE hFile);
// just dump the statistics - never mind the log
- void WINAPI Msr_DumpStats(HANDLE hFile);
+void WINAPI Msr_DumpStats(HANDLE hFile);
// Type definitions in case you want to declare a pointer to the dump functions
// (makes it a trifle easier to do dynamic linking
// i.e. LoadModule, GetProcAddress and call that)
// Typedefs so can declare MSR_DUMPPROC *MsrDumpStats; or whatever
- typedef void WINAPI MSR_DUMPPROC(HANDLE hFile);
- typedef void WINAPI MSR_CONTROLPROC(int iAction);
+typedef void WINAPI MSR_DUMPPROC(HANDLE hFile);
+typedef void WINAPI MSR_CONTROLPROC(int iAction);
#ifdef __cplusplus
diff --git a/src/filters/BaseClasses/msgthrd.h b/src/filters/BaseClasses/msgthrd.h
index b91797441..45adc01cf 100644
--- a/src/filters/BaseClasses/msgthrd.h
+++ b/src/filters/BaseClasses/msgthrd.h
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// File: MsgThrd.h
//
-// Desc: DirectShow base classes - provides support for a worker thread
+// Desc: DirectShow base classes - provides support for a worker thread
// class to which one can asynchronously post messages.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -10,8 +10,7 @@
// Message class - really just a structure.
//
-class CMsg
-{
+class CMsg {
public:
UINT uMsg;
DWORD dwFlags;
@@ -30,8 +29,7 @@ public:
// that it is prompted to perform particaular tasks by responding to messages
// posted to its message queue.
//
-class AM_NOVTABLE CMsgThread
-{
+class AM_NOVTABLE CMsgThread {
private:
static DWORD WINAPI DefaultThreadProc(__inout LPVOID lpParam);
DWORD m_ThreadId;
@@ -49,13 +47,13 @@ protected:
public:
CMsgThread()
: m_ThreadId(0),
- m_hThread(NULL),
- m_lWaiting(0),
- m_hSem(NULL),
- // make a list with a cache of 5 items
- m_ThreadQueue(NAME("MsgThread list"), 5)
- {
- }
+ m_hThread(NULL),
+ m_lWaiting(0),
+ m_hSem(NULL),
+ // make a list with a cache of 5 items
+ m_ThreadQueue(NAME("MsgThread list"), 5)
+ {
+ }
~CMsgThread();
// override this if you want to block on other things as well
@@ -63,61 +61,50 @@ public:
void virtual GetThreadMsg(__out CMsg *msg);
// override this if you want to do something on thread startup
- virtual void OnThreadInit()
- {
+ virtual void OnThreadInit() {
};
BOOL CreateThread();
- BOOL WaitForThreadExit(__out LPDWORD lpdwExitCode)
- {
- if(m_hThread != NULL)
- {
+ BOOL WaitForThreadExit(__out LPDWORD lpdwExitCode) {
+ if (m_hThread != NULL) {
WaitForSingleObject(m_hThread, INFINITE);
return GetExitCodeThread(m_hThread, lpdwExitCode);
}
return FALSE;
}
- DWORD ResumeThread()
- {
+ DWORD ResumeThread() {
return ::ResumeThread(m_hThread);
}
- DWORD SuspendThread()
- {
+ DWORD SuspendThread() {
return ::SuspendThread(m_hThread);
}
- int GetThreadPriority()
- {
+ int GetThreadPriority() {
return ::GetThreadPriority(m_hThread);
}
- BOOL SetThreadPriority(int nPriority)
- {
+ BOOL SetThreadPriority(int nPriority) {
return ::SetThreadPriority(m_hThread, nPriority);
}
- HANDLE GetThreadHandle()
- {
+ HANDLE GetThreadHandle() {
return m_hThread;
}
- DWORD GetThreadId()
- {
+ DWORD GetThreadId() {
return m_ThreadId;
}
void PutThreadMsg(UINT uMsg, DWORD dwMsgFlags,
- __in_opt LPVOID lpMsgParam, __in_opt CAMEvent *pEvent = NULL)
- {
+ __in_opt LPVOID lpMsgParam, __in_opt CAMEvent *pEvent = NULL) {
CAutoLock lck(&m_Lock);
CMsg* pMsg = new CMsg(uMsg, dwMsgFlags, lpMsgParam, pEvent);
m_ThreadQueue.AddTail(pMsg);
- if(m_lWaiting != 0)
- {
+ if (m_lWaiting != 0) {
ReleaseSemaphore(m_hSem, m_lWaiting, 0);
m_lWaiting = 0;
}
diff --git a/src/filters/BaseClasses/mtype.cpp b/src/filters/BaseClasses/mtype.cpp
index 9feb3e0f8..fffbcf797 100644
--- a/src/filters/BaseClasses/mtype.cpp
+++ b/src/filters/BaseClasses/mtype.cpp
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// File: MType.cpp
//
-// Desc: DirectShow base classes - implements a class that holds and
+// Desc: DirectShow base classes - implements a class that holds and
// manages media type information.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -15,8 +15,7 @@
#include <streams.h>
#include <mmreg.h>
-CMediaType::~CMediaType()
-{
+CMediaType::~CMediaType(){
FreeMediaType(*this);
}
@@ -39,8 +38,7 @@ CMediaType::CMediaType(const GUID * type)
CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, __out_opt HRESULT* phr)
{
HRESULT hr = CopyMediaType(this, &rt);
- if(FAILED(hr) && (NULL != phr))
- {
+ if (FAILED(hr) && (NULL != phr)) {
*phr = hr;
}
}
@@ -49,8 +47,7 @@ CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, __out_opt HRESULT* phr)
CMediaType::CMediaType(const CMediaType& rt, __out_opt HRESULT* phr)
{
HRESULT hr = CopyMediaType(this, &rt);
- if(FAILED(hr) && (NULL != phr))
- {
+ if (FAILED(hr) && (NULL != phr)) {
*phr = hr;
}
}
@@ -85,13 +82,13 @@ CMediaType::operator == (const CMediaType& rt) const
// the particular format representation can still see them, but
// they should duplicate information in the format block.
- return ((IsEqualGUID(majortype, rt.majortype) == TRUE) &&
- (IsEqualGUID(subtype, rt.subtype) == TRUE) &&
- (IsEqualGUID(formattype, rt.formattype) == TRUE) &&
- (cbFormat == rt.cbFormat) &&
- ((cbFormat == 0) ||
- pbFormat != NULL && rt.pbFormat != NULL &&
- (memcmp(pbFormat, rt.pbFormat, cbFormat) == 0)));
+ return ((IsEqualGUID(majortype,rt.majortype) == TRUE) &&
+ (IsEqualGUID(subtype,rt.subtype) == TRUE) &&
+ (IsEqualGUID(formattype,rt.formattype) == TRUE) &&
+ (cbFormat == rt.cbFormat) &&
+ ( (cbFormat == 0) ||
+ pbFormat != NULL && rt.pbFormat != NULL &&
+ (memcmp(pbFormat, rt.pbFormat, cbFormat) == 0)));
}
@@ -100,8 +97,7 @@ CMediaType::operator != (const CMediaType& rt) const
{
/* Check to see if they are equal */
- if(*this == rt)
- {
+ if (*this == rt) {
return FALSE;
}
return TRUE;
@@ -118,24 +114,22 @@ CMediaType::Set(const CMediaType& rt)
HRESULT
CMediaType::Set(const AM_MEDIA_TYPE& rt)
{
- if(&rt != this)
- {
+ if (&rt != this) {
FreeMediaType(*this);
HRESULT hr = CopyMediaType(this, &rt);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return E_OUTOFMEMORY;
}
}
- return S_OK;
+ return S_OK;
}
BOOL
CMediaType::IsValid() const
{
- return (!IsEqualGUID(majortype, GUID_NULL));
+ return (!IsEqualGUID(majortype,GUID_NULL));
}
@@ -154,28 +148,20 @@ CMediaType::SetSubtype(const GUID* ptype)
ULONG
-CMediaType::GetSampleSize() const
-{
- if(IsFixedSize())
- {
+CMediaType::GetSampleSize() const {
+ if (IsFixedSize()) {
return lSampleSize;
- }
- else
- {
+ } else {
return 0;
}
}
void
-CMediaType::SetSampleSize(ULONG sz)
-{
- if(sz == 0)
- {
+CMediaType::SetSampleSize(ULONG sz) {
+ if (sz == 0) {
SetVariableSize();
- }
- else
- {
+ } else {
bFixedSizeSamples = TRUE;
lSampleSize = sz;
}
@@ -183,23 +169,21 @@ CMediaType::SetSampleSize(ULONG sz)
void
-CMediaType::SetVariableSize()
-{
+CMediaType::SetVariableSize() {
bFixedSizeSamples = FALSE;
}
void
-CMediaType::SetTemporalCompression(BOOL bCompressed)
-{
+CMediaType::SetTemporalCompression(BOOL bCompressed) {
bTemporalCompression = bCompressed;
}
BOOL
CMediaType::SetFormat(__in_bcount(cb) BYTE * pformat, ULONG cb)
{
- if(NULL == AllocFormatBuffer(cb))
- return(FALSE);
+ if (NULL == AllocFormatBuffer(cb))
+ return(FALSE);
ASSERT(pbFormat);
memcpy(pbFormat, pformat, cb);
@@ -223,8 +207,7 @@ CMediaType::SetFormatType(const GUID *pformattype)
void CMediaType::ResetFormatBuffer()
{
- if(cbFormat)
- {
+ if (cbFormat) {
CoTaskMemFree((PVOID)pbFormat);
}
cbFormat = 0;
@@ -243,24 +226,21 @@ CMediaType::AllocFormatBuffer(ULONG length)
// do the types have the same buffer size
- if(cbFormat == length)
- {
+ if (cbFormat == length) {
return pbFormat;
}
// allocate the new format buffer
BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length);
- if(pNewFormat == NULL)
- {
- if(length <= cbFormat) return pbFormat; //reuse the old block anyway.
+ if (pNewFormat == NULL) {
+ if (length <= cbFormat) return pbFormat; //reuse the old block anyway.
return NULL;
}
// delete the old format
- if(cbFormat != 0)
- {
+ if (cbFormat != 0) {
ASSERT(pbFormat);
CoTaskMemFree((PVOID)pbFormat);
}
@@ -283,27 +263,24 @@ CMediaType::ReallocFormatBuffer(ULONG length)
// do the types have the same buffer size
- if(cbFormat == length)
- {
+ if (cbFormat == length) {
return pbFormat;
}
// allocate the new format buffer
BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length);
- if(pNewFormat == NULL)
- {
- if(length <= cbFormat) return pbFormat; //reuse the old block anyway.
+ if (pNewFormat == NULL) {
+ if (length <= cbFormat) return pbFormat; //reuse the old block anyway.
return NULL;
}
// copy any previous format (or part of if new is smaller)
// delete the old format and replace with the new one
- if(cbFormat != 0)
- {
+ if (cbFormat != 0) {
ASSERT(pbFormat);
- memcpy(pNewFormat, pbFormat, min(length, cbFormat));
+ memcpy(pNewFormat,pbFormat,min(length,cbFormat));
CoTaskMemFree((PVOID)pbFormat);
}
@@ -328,13 +305,10 @@ void CMediaType::InitMediaType()
BOOL
CMediaType::IsPartiallySpecified(void) const
{
- if((majortype == GUID_NULL) ||
- (formattype == GUID_NULL))
- {
- return TRUE;
- }
- else
- {
+ if ((majortype == GUID_NULL) ||
+ (formattype == GUID_NULL)) {
+ return TRUE;
+ } else {
return FALSE;
}
}
@@ -342,32 +316,26 @@ CMediaType::IsPartiallySpecified(void) const
BOOL
CMediaType::MatchesPartial(const CMediaType* ppartial) const
{
- if((ppartial->majortype != GUID_NULL) &&
- (majortype != ppartial->majortype))
- {
- return FALSE;
+ if ((ppartial->majortype != GUID_NULL) &&
+ (majortype != ppartial->majortype)) {
+ return FALSE;
}
- if((ppartial->subtype != GUID_NULL) &&
- (subtype != ppartial->subtype))
- {
- return FALSE;
+ if ((ppartial->subtype != GUID_NULL) &&
+ (subtype != ppartial->subtype)) {
+ return FALSE;
}
- if(ppartial->formattype != GUID_NULL)
- {
+ if (ppartial->formattype != GUID_NULL) {
// if the format block is specified then it must match exactly
- if(formattype != ppartial->formattype)
- {
+ if (formattype != ppartial->formattype) {
return FALSE;
}
- if(cbFormat != ppartial->cbFormat)
- {
+ if (cbFormat != ppartial->cbFormat) {
return FALSE;
}
- if((cbFormat != 0) &&
- (memcmp(pbFormat, ppartial->pbFormat, cbFormat) != 0))
- {
- return FALSE;
+ if ((cbFormat != 0) &&
+ (memcmp(pbFormat, ppartial->pbFormat, cbFormat) != 0)) {
+ return FALSE;
}
}
@@ -386,8 +354,7 @@ void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt)
{
// allow NULL pointers for coding simplicity
- if(pmt == NULL)
- {
+ if (pmt == NULL) {
return;
}
@@ -410,15 +377,13 @@ AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc)
AM_MEDIA_TYPE *pMediaType =
(AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
- if(pMediaType == NULL)
- {
+ if (pMediaType == NULL) {
return NULL;
}
// Copy the variable length format block
- HRESULT hr = CopyMediaType(pMediaType, pSrc);
- if(FAILED(hr))
- {
+ HRESULT hr = CopyMediaType(pMediaType,pSrc);
+ if (FAILED(hr)) {
CoTaskMemFree((PVOID)pMediaType);
return NULL;
}
@@ -435,23 +400,18 @@ HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE
// case we can check like that - copying to itself.
ASSERT(pmtSource != pmtTarget);
*pmtTarget = *pmtSource;
- if(pmtSource->cbFormat != 0)
- {
+ if (pmtSource->cbFormat != 0) {
ASSERT(pmtSource->pbFormat != NULL);
pmtTarget->pbFormat = (PBYTE)CoTaskMemAlloc(pmtSource->cbFormat);
- if(pmtTarget->pbFormat == NULL)
- {
+ if (pmtTarget->pbFormat == NULL) {
pmtTarget->cbFormat = 0;
return E_OUTOFMEMORY;
- }
- else
- {
+ } else {
CopyMemory((PVOID)pmtTarget->pbFormat, (PVOID)pmtSource->pbFormat,
pmtTarget->cbFormat);
}
}
- if(pmtTarget->pUnk != NULL)
- {
+ if (pmtTarget->pUnk != NULL) {
pmtTarget->pUnk->AddRef();
}
@@ -462,16 +422,14 @@ HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE
void WINAPI FreeMediaType(__inout AM_MEDIA_TYPE& mt)
{
- if(mt.cbFormat != 0)
- {
+ if (mt.cbFormat != 0) {
CoTaskMemFree((PVOID)mt.pbFormat);
// Strictly unnecessary but tidier
mt.cbFormat = 0;
mt.pbFormat = NULL;
}
- if(mt.pUnk != NULL)
- {
+ if (mt.pUnk != NULL) {
mt.pUnk->Release();
mt.pUnk = NULL;
}
@@ -486,12 +444,9 @@ STDAPI CreateAudioMediaType(
)
{
pmt->majortype = MEDIATYPE_Audio;
- if(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
- {
+ if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
pmt->subtype = ((PWAVEFORMATEXTENSIBLE)pwfx)->SubFormat;
- }
- else
- {
+ } else {
pmt->subtype = FOURCCMap(pwfx->wFormatTag);
}
pmt->formattype = FORMAT_WaveFormatEx;
@@ -499,28 +454,20 @@ STDAPI CreateAudioMediaType(
pmt->bTemporalCompression = FALSE;
pmt->lSampleSize = pwfx->nBlockAlign;
pmt->pUnk = NULL;
- if(bSetFormat)
- {
- if(pwfx->wFormatTag == WAVE_FORMAT_PCM)
- {
+ if (bSetFormat) {
+ if (pwfx->wFormatTag == WAVE_FORMAT_PCM) {
pmt->cbFormat = sizeof(WAVEFORMATEX);
- }
- else
- {
+ } else {
pmt->cbFormat = sizeof(WAVEFORMATEX) + pwfx->cbSize;
}
pmt->pbFormat = (PBYTE)CoTaskMemAlloc(pmt->cbFormat);
- if(pmt->pbFormat == NULL)
- {
+ if (pmt->pbFormat == NULL) {
return E_OUTOFMEMORY;
}
- if(pwfx->wFormatTag == WAVE_FORMAT_PCM)
- {
+ if (pwfx->wFormatTag == WAVE_FORMAT_PCM) {
CopyMemory(pmt->pbFormat, pwfx, sizeof(PCMWAVEFORMAT));
((WAVEFORMATEX *)pmt->pbFormat)->cbSize = 0;
- }
- else
- {
+ } else {
CopyMemory(pmt->pbFormat, pwfx, pmt->cbFormat);
}
}
diff --git a/src/filters/BaseClasses/mtype.h b/src/filters/BaseClasses/mtype.h
index 0b79f089d..fc2fe53ee 100644
--- a/src/filters/BaseClasses/mtype.h
+++ b/src/filters/BaseClasses/mtype.h
@@ -15,8 +15,7 @@
types etc. Has same data members as the struct AM_MEDIA_TYPE defined
in the streams IDL file, but also has (non-virtual) functions */
-class CMediaType : public _AMMediaType
-{
+class CMediaType : public _AMMediaType {
public:
@@ -37,25 +36,13 @@ public:
BOOL IsValid() const;
- const GUID *Type() const
- {
- return &majortype;
- } ;
+ const GUID *Type() const { return &majortype;} ;
void SetType(const GUID *);
- const GUID *Subtype() const
- {
- return &subtype;
- } ;
+ const GUID *Subtype() const { return &subtype;} ;
void SetSubtype(const GUID *);
- BOOL IsFixedSize() const
- {
- return bFixedSizeSamples;
- };
- BOOL IsTemporalCompressed() const
- {
- return bTemporalCompression;
- };
+ BOOL IsFixedSize() const {return bFixedSizeSamples; };
+ BOOL IsTemporalCompressed() const {return bTemporalCompression; };
ULONG GetSampleSize() const;
void SetSampleSize(ULONG sz);
@@ -65,20 +52,11 @@ public:
// read/write pointer to format - can't change length without
// calling SetFormat, AllocFormatBuffer or ReallocFormatBuffer
- BYTE* Format() const
- {
- return pbFormat;
- };
- ULONG FormatLength() const
- {
- return cbFormat;
- };
+ BYTE* Format() const {return pbFormat; };
+ ULONG FormatLength() const { return cbFormat; };
void SetFormatType(const GUID *);
- const GUID *FormatType() const
- {
- return &formattype;
- };
+ const GUID *FormatType() const {return &formattype; };
BOOL SetFormat(__in_bcount(length) BYTE *pFormat, ULONG length);
void ResetFormatBuffer();
BYTE* AllocFormatBuffer(ULONG length);
diff --git a/src/filters/BaseClasses/outputq.cpp b/src/filters/BaseClasses/outputq.cpp
index d60319e64..d3ab6175e 100644
--- a/src/filters/BaseClasses/outputq.cpp
+++ b/src/filters/BaseClasses/outputq.cpp
@@ -41,57 +41,53 @@
// dwPriority - If we create a thread set its priority to this
//
COutputQueue::COutputQueue(
- IPin *pInputPin, // Pin to send stuff to
- __inout HRESULT *phr, // 'Return code'
- BOOL bAuto, // Ask pin if queue or not
- BOOL bQueue, // Send through queue
- LONG lBatchSize, // Batch
- BOOL bBatchExact, // Batch exactly to BatchSize
- LONG lListSize,
- DWORD dwPriority,
- bool bFlushingOpt // flushing optimization
-) : m_lBatchSize(lBatchSize),
- m_bBatchExact(bBatchExact && (lBatchSize > 1)),
- m_hThread(NULL),
- m_hSem(NULL),
- m_List(NULL),
- m_pPin(pInputPin),
- m_ppSamples(NULL),
- m_lWaiting(0),
- m_evFlushComplete(FALSE, phr),
- m_pInputPin(NULL),
- m_bSendAnyway(FALSE),
- m_nBatched(0),
- m_bFlushing(FALSE),
- m_bFlushed(TRUE),
- m_bFlushingOpt(bFlushingOpt),
- m_bTerminate(FALSE),
- m_hEventPop(NULL),
- m_hr(S_OK)
+ IPin *pInputPin, // Pin to send stuff to
+ __inout HRESULT *phr, // 'Return code'
+ BOOL bAuto, // Ask pin if queue or not
+ BOOL bQueue, // Send through queue
+ LONG lBatchSize, // Batch
+ BOOL bBatchExact, // Batch exactly to BatchSize
+ LONG lListSize,
+ DWORD dwPriority,
+ bool bFlushingOpt // flushing optimization
+ ) : m_lBatchSize(lBatchSize),
+ m_bBatchExact(bBatchExact && (lBatchSize > 1)),
+ m_hThread(NULL),
+ m_hSem(NULL),
+ m_List(NULL),
+ m_pPin(pInputPin),
+ m_ppSamples(NULL),
+ m_lWaiting(0),
+ m_evFlushComplete(FALSE, phr),
+ m_pInputPin(NULL),
+ m_bSendAnyway(FALSE),
+ m_nBatched(0),
+ m_bFlushing(FALSE),
+ m_bFlushed(TRUE),
+ m_bFlushingOpt(bFlushingOpt),
+ m_bTerminate(FALSE),
+ m_hEventPop(NULL),
+ m_hr(S_OK)
{
ASSERT(m_lBatchSize > 0);
- if(FAILED(*phr))
- {
+ if (FAILED(*phr)) {
return;
}
// Check the input pin is OK and cache its IMemInputPin interface
*phr = pInputPin->QueryInterface(IID_IMemInputPin, (void **)&m_pInputPin);
- if(FAILED(*phr))
- {
+ if (FAILED(*phr)) {
return;
}
// See if we should ask the downstream pin
- if(bAuto)
- {
+ if (bAuto) {
HRESULT hr = m_pInputPin->ReceiveCanBlock();
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
bQueue = hr == S_OK;
}
}
@@ -99,20 +95,17 @@ COutputQueue::COutputQueue(
// Create our sample batch
m_ppSamples = new PMEDIASAMPLE[m_lBatchSize];
- if(m_ppSamples == NULL)
- {
+ if (m_ppSamples == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
// If we're queueing allocate resources
- if(bQueue)
- {
+ if (bQueue) {
DbgLog((LOG_TRACE, 2, TEXT("Creating thread for output pin")));
m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL);
- if(m_hSem == NULL)
- {
+ if (m_hSem == NULL) {
DWORD dwError = GetLastError();
*phr = AmHresultFromWin32(dwError);
return;
@@ -121,8 +114,7 @@ COutputQueue::COutputQueue(
lListSize,
FALSE // No lock
);
- if(m_List == NULL)
- {
+ if (m_List == NULL) {
*phr = E_OUTOFMEMORY;
return;
}
@@ -135,16 +127,13 @@ COutputQueue::COutputQueue(
(LPVOID)this,
0,
&dwThreadId);
- if(m_hThread == NULL)
- {
+ if (m_hThread == NULL) {
DWORD dwError = GetLastError();
*phr = AmHresultFromWin32(dwError);
return;
}
SetThreadPriority(m_hThread, dwPriority);
- }
- else
- {
+ } else {
DbgLog((LOG_TRACE, 2, TEXT("Calling input pin directly - no thread")));
}
}
@@ -161,12 +150,10 @@ COutputQueue::~COutputQueue()
{
DbgLog((LOG_TRACE, 3, TEXT("COutputQueue::~COutputQueue")));
/* Free our pointer */
- if(m_pInputPin != NULL)
- {
+ if (m_pInputPin != NULL) {
m_pInputPin->Release();
}
- if(m_hThread != NULL)
- {
+ if (m_hThread != NULL) {
{
CAutoLock lck(this);
m_bTerminate = TRUE;
@@ -180,13 +167,10 @@ COutputQueue::~COutputQueue()
ASSERT(m_List->GetCount() == 0);
delete m_List;
- }
- else
- {
+ } else {
FreeSamples();
}
- if(m_hSem != NULL)
- {
+ if (m_hSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hSem));
}
delete [] m_ppSamples;
@@ -198,15 +182,14 @@ COutputQueue::~COutputQueue()
DWORD WINAPI COutputQueue::InitialThreadProc(__in LPVOID pv)
{
HRESULT hrCoInit = CAMThread::CoInitializeHelper();
-
+
COutputQueue *pSampleQueue = (COutputQueue *)pv;
DWORD dwReturn = pSampleQueue->ThreadProc();
- if(hrCoInit == S_OK)
- {
+ if(hrCoInit == S_OK) {
CoUninitialize();
}
-
+
return dwReturn;
}
@@ -219,8 +202,7 @@ DWORD WINAPI COutputQueue::InitialThreadProc(__in LPVOID pv)
//
DWORD COutputQueue::ThreadProc()
{
- while(TRUE)
- {
+ while (TRUE) {
BOOL bWait = FALSE;
IMediaSample *pSample;
LONG lNumberToSend; // Local copy
@@ -233,16 +215,13 @@ DWORD COutputQueue::ThreadProc()
//
{
CAutoLock lck(this);
- while(TRUE)
- {
+ while (TRUE) {
- if(m_bTerminate)
- {
+ if (m_bTerminate) {
FreeSamples();
return 0;
}
- if(m_bFlushing)
- {
+ if (m_bFlushing) {
FreeSamples();
SetEvent(m_evFlushComplete);
}
@@ -250,36 +229,30 @@ DWORD COutputQueue::ThreadProc()
// Get a sample off the list
pSample = m_List->RemoveHead();
- // inform derived class we took something off the queue
- if(m_hEventPop)
- {
+ // inform derived class we took something off the queue
+ if (m_hEventPop) {
//DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT")));
- SetEvent(m_hEventPop);
- }
+ SetEvent(m_hEventPop);
+ }
- if(pSample != NULL &&
- !IsSpecialSample(pSample))
- {
+ if (pSample != NULL &&
+ !IsSpecialSample(pSample)) {
// If its just a regular sample just add it to the batch
// and exit the loop if the batch is full
m_ppSamples[m_nBatched++] = pSample;
- if(m_nBatched == m_lBatchSize)
- {
+ if (m_nBatched == m_lBatchSize) {
break;
}
- }
- else
- {
+ } else {
// If there was nothing in the queue and there's nothing
// to send (either because there's nothing or the batch
// isn't full) then prepare to wait
- if(pSample == NULL &&
- (m_bBatchExact || m_nBatched == 0))
- {
+ if (pSample == NULL &&
+ (m_bBatchExact || m_nBatched == 0)) {
// Tell other thread to set the event when there's
// something do to
@@ -287,29 +260,24 @@ DWORD COutputQueue::ThreadProc()
ASSERT(m_lWaiting == 0);
m_lWaiting++;
bWait = TRUE;
- }
- else
- {
+ } else {
// We break out of the loop on SEND_PACKET unless
// there's nothing to send
- if(pSample == SEND_PACKET && m_nBatched == 0)
- {
+ if (pSample == SEND_PACKET && m_nBatched == 0) {
continue;
}
- if(pSample == NEW_SEGMENT)
- {
+ if (pSample == NEW_SEGMENT) {
// now we need the parameters - we are
// guaranteed that the next packet contains them
ppacket = (NewSegmentPacket *) m_List->RemoveHead();
- // we took something off the queue
- if(m_hEventPop)
- {
- //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT")));
- SetEvent(m_hEventPop);
- }
+ // we took something off the queue
+ if (m_hEventPop) {
+ //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT")));
+ SetEvent(m_hEventPop);
+ }
ASSERT(ppacket);
}
@@ -319,8 +287,7 @@ DWORD COutputQueue::ThreadProc()
break;
}
}
- if(!bWait)
- {
+ if (!bWait) {
// We look at m_nBatched from the client side so keep
// it up to date inside the critical section
lNumberToSend = m_nBatched; // Local copy
@@ -330,8 +297,7 @@ DWORD COutputQueue::ThreadProc()
// Wait for some more data
- if(bWait)
- {
+ if (bWait) {
DbgWaitForSingleObject(m_hSem);
continue;
}
@@ -344,42 +310,36 @@ DWORD COutputQueue::ThreadProc()
// SEND_PACKET or EOS_PACKET - both of which imply we should
// flush our batch
- if(lNumberToSend != 0)
- {
+ if (lNumberToSend != 0) {
long nProcessed;
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
ASSERT(!m_bFlushed);
HRESULT hr = m_pInputPin->ReceiveMultiple(m_ppSamples,
- lNumberToSend,
- &nProcessed);
+ lNumberToSend,
+ &nProcessed);
/* Don't overwrite a flushing state HRESULT */
CAutoLock lck(this);
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
m_hr = hr;
}
ASSERT(!m_bFlushed);
}
- while(lNumberToSend != 0)
- {
+ while (lNumberToSend != 0) {
m_ppSamples[--lNumberToSend]->Release();
}
- if(m_hr != S_OK)
- {
+ if (m_hr != S_OK) {
// In any case wait for more data - S_OK just
// means there wasn't an error
DbgLog((LOG_ERROR, 2, TEXT("ReceiveMultiple returned %8.8X"),
- m_hr));
+ m_hr));
}
}
// Check for end of stream
- if(pSample == EOS_PACKET)
- {
+ if (pSample == EOS_PACKET) {
// We don't send even end of stream on if we've previously
// returned something other than S_OK
@@ -387,12 +347,10 @@ DWORD COutputQueue::ThreadProc()
// something other than S_OK should have either sent
// EndOfStream() or notified the filter graph
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()")));
HRESULT hr = m_pPin->EndOfStream();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()")));
}
}
@@ -400,14 +358,12 @@ DWORD COutputQueue::ThreadProc()
// Data from a new source
- if(pSample == RESET_PACKET)
- {
+ if (pSample == RESET_PACKET) {
m_hr = S_OK;
SetEvent(m_evFlushComplete);
}
- if(pSample == NEW_SEGMENT)
- {
+ if (pSample == NEW_SEGMENT) {
m_pPin->NewSegment(ppacket->tStart, ppacket->tStop, ppacket->dRate);
delete ppacket;
}
@@ -417,8 +373,7 @@ DWORD COutputQueue::ThreadProc()
// Send batched stuff anyway
void COutputQueue::SendAnyway()
{
- if(!IsQueued())
- {
+ if (!IsQueued()) {
// m_bSendAnyway is a private parameter checked in ReceiveMultiple
@@ -427,9 +382,7 @@ void COutputQueue::SendAnyway()
ReceiveMultiple(NULL, 0, &nProcessed);
m_bSendAnyway = FALSE;
- }
- else
- {
+ } else {
CAutoLock lck(this);
QueueSample(SEND_PACKET);
NotifyThread();
@@ -442,21 +395,15 @@ COutputQueue::NewSegment(
REFERENCE_TIME tStop,
double dRate)
{
- if(!IsQueued())
- {
- if(S_OK == m_hr)
- {
- if(m_bBatchExact)
- {
+ if (!IsQueued()) {
+ if (S_OK == m_hr) {
+ if (m_bBatchExact) {
SendAnyway();
}
m_pPin->NewSegment(tStart, tStop, dRate);
}
- }
- else
- {
- if(m_hr == S_OK)
- {
+ } else {
+ if (m_hr == S_OK) {
//
// we need to queue the new segment to appear in order in the
// data, but we need to pass parameters to it. Rather than
@@ -467,8 +414,7 @@ COutputQueue::NewSegment(
// NEW_SEGMENT value is a NewSegmentPacket containing the
// parameters.
NewSegmentPacket * ppack = new NewSegmentPacket;
- if(ppack == NULL)
- {
+ if (ppack == NULL) {
return;
}
ppack->tStart = tStart;
@@ -477,7 +423,7 @@ COutputQueue::NewSegment(
CAutoLock lck(this);
QueueSample(NEW_SEGMENT);
- QueueSample((IMediaSample*) ppack);
+ QueueSample( (IMediaSample*) ppack);
NotifyThread();
}
}
@@ -490,27 +436,20 @@ COutputQueue::NewSegment(
void COutputQueue::EOS()
{
CAutoLock lck(this);
- if(!IsQueued())
- {
- if(m_bBatchExact)
- {
+ if (!IsQueued()) {
+ if (m_bBatchExact) {
SendAnyway();
}
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()")));
m_bFlushed = FALSE;
HRESULT hr = m_pPin->EndOfStream();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()")));
}
}
- }
- else
- {
- if(m_hr == S_OK)
- {
+ } else {
+ if (m_hr == S_OK) {
m_bFlushed = FALSE;
QueueSample(EOS_PACKET);
NotifyThread();
@@ -523,8 +462,7 @@ void COutputQueue::EOS()
//
void COutputQueue::BeginFlush()
{
- if(IsQueued())
- {
+ if (IsQueued()) {
{
CAutoLock lck(this);
@@ -537,15 +475,13 @@ void COutputQueue::BeginFlush()
// Make sure we discard all samples from now on
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
m_hr = S_FALSE;
}
// Optimize so we don't keep calling downstream all the time
- if(m_bFlushed && m_bFlushingOpt)
- {
+ if (m_bFlushed && m_bFlushingOpt) {
return;
}
@@ -558,9 +494,7 @@ void COutputQueue::BeginFlush()
// pass this downstream
m_pPin->BeginFlush();
- }
- else
- {
+ } else {
// pass downstream first to avoid deadlocks
m_pPin->BeginFlush();
CAutoLock lck(this);
@@ -570,8 +504,7 @@ void COutputQueue::BeginFlush()
// Make sure we discard all samples from now on
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
m_hr = S_FALSE;
}
}
@@ -585,8 +518,7 @@ void COutputQueue::EndFlush()
{
CAutoLock lck(this);
ASSERT(m_bFlushing);
- if(m_bFlushingOpt && m_bFlushed && IsQueued())
- {
+ if (m_bFlushingOpt && m_bFlushed && IsQueued()) {
m_bFlushing = FALSE;
m_hr = S_OK;
return;
@@ -599,12 +531,9 @@ void COutputQueue::EndFlush()
// Because we are synching here there is no need to hold the critical
// section (in fact we'd deadlock if we did!)
- if(IsQueued())
- {
+ if (IsQueued()) {
m_evFlushComplete.Wait();
- }
- else
- {
+ } else {
FreeSamples();
}
@@ -628,10 +557,8 @@ void COutputQueue::EndFlush()
void COutputQueue::QueueSample(IMediaSample *pSample)
{
- if(NULL == m_List->AddTail(pSample))
- {
- if(!IsSpecialSample(pSample))
- {
+ if (NULL == m_List->AddTail(pSample)) {
+ if (!IsSpecialSample(pSample)) {
pSample->Release();
}
}
@@ -664,26 +591,23 @@ HRESULT COutputQueue::Receive(IMediaSample *pSample)
// On return all samples will have been Release()'d
//
-HRESULT COutputQueue::ReceiveMultiple(
+HRESULT COutputQueue::ReceiveMultiple (
__in_ecount(nSamples) IMediaSample **ppSamples,
long nSamples,
__out long *nSamplesProcessed)
{
- if(nSamples < 0)
- {
+ if (nSamples < 0) {
return E_INVALIDARG;
}
-
+
CAutoLock lck(this);
// Either call directly or queue up the samples
- if(!IsQueued())
- {
+ if (!IsQueued()) {
// If we already had a bad return code then just return
- if(S_OK != m_hr)
- {
+ if (S_OK != m_hr) {
// If we've never received anything since the last Flush()
// and the sticky return code is not S_OK we must be
@@ -693,8 +617,7 @@ HRESULT COutputQueue::ReceiveMultiple(
// We're supposed to Release() them anyway!
*nSamplesProcessed = 0;
- for(int i = 0; i < nSamples; i++)
- {
+ for (int i = 0; i < nSamples; i++) {
DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (direct) : Discarding %d samples code 0x%8.8X"),
nSamples, m_hr));
ppSamples[i]->Release();
@@ -715,73 +638,59 @@ HRESULT COutputQueue::ReceiveMultiple(
LONG iLost = 0;
long iDone = 0;
- for(iDone = 0;
- iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);
- )
- {
+ for (iDone = 0;
+ iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);
+ ) {
//pragma message (REMIND("Implement threshold scheme"))
ASSERT(m_nBatched < m_lBatchSize);
- if(iDone < nSamples)
- {
+ if (iDone < nSamples) {
m_ppSamples[m_nBatched++] = ppSamples[iDone++];
}
- if(m_nBatched == m_lBatchSize ||
- nSamples == 0 && (m_bSendAnyway || !m_bBatchExact))
- {
+ if (m_nBatched == m_lBatchSize ||
+ nSamples == 0 && (m_bSendAnyway || !m_bBatchExact)) {
LONG nDone;
DbgLog((LOG_TRACE, 4, TEXT("Batching %d samples"),
- m_nBatched));
+ m_nBatched));
- if(m_hr == S_OK)
- {
+ if (m_hr == S_OK) {
m_hr = m_pInputPin->ReceiveMultiple(m_ppSamples,
m_nBatched,
&nDone);
- }
- else
- {
+ } else {
nDone = 0;
}
iLost += m_nBatched - nDone;
- for(LONG i = 0; i < m_nBatched; i++)
- {
+ for (LONG i = 0; i < m_nBatched; i++) {
m_ppSamples[i]->Release();
}
m_nBatched = 0;
}
}
*nSamplesProcessed = iDone - iLost;
- if(*nSamplesProcessed < 0)
- {
+ if (*nSamplesProcessed < 0) {
*nSamplesProcessed = 0;
}
return m_hr;
- }
- else
- {
+ } else {
/* We're sending to our thread */
- if(m_hr != S_OK)
- {
+ if (m_hr != S_OK) {
*nSamplesProcessed = 0;
DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (queued) : Discarding %d samples code 0x%8.8X"),
nSamples, m_hr));
- for(int i = 0; i < nSamples; i++)
- {
+ for (int i = 0; i < nSamples; i++) {
ppSamples[i]->Release();
}
return m_hr;
}
m_bFlushed = FALSE;
- for(long i = 0; i < nSamples; i++)
- {
+ for (long i = 0; i < nSamples; i++) {
QueueSample(ppSamples[i]);
}
*nSamplesProcessed = nSamples;
- if(!m_bBatchExact ||
- m_nBatched + m_List->GetCount() >= m_lBatchSize)
- {
+ if (!m_bBatchExact ||
+ m_nBatched + m_List->GetCount() >= m_lBatchSize) {
NotifyThread();
}
return S_OK;
@@ -791,12 +700,9 @@ HRESULT COutputQueue::ReceiveMultiple(
// Get ready for new data - cancels sticky m_hr
void COutputQueue::Reset()
{
- if(!IsQueued())
- {
+ if (!IsQueued()) {
m_hr = S_OK;
- }
- else
- {
+ } else {
{
CAutoLock lck(this);
QueueSample(RESET_PACKET);
@@ -810,39 +716,30 @@ void COutputQueue::Reset()
void COutputQueue::FreeSamples()
{
CAutoLock lck(this);
- if(IsQueued())
- {
- while(TRUE)
- {
+ if (IsQueued()) {
+ while (TRUE) {
IMediaSample *pSample = m_List->RemoveHead();
- // inform derived class we took something off the queue
- if(m_hEventPop)
- {
+ // inform derived class we took something off the queue
+ if (m_hEventPop) {
//DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT")));
- SetEvent(m_hEventPop);
- }
+ SetEvent(m_hEventPop);
+ }
- if(pSample == NULL)
- {
+ if (pSample == NULL) {
break;
}
- if(!IsSpecialSample(pSample))
- {
+ if (!IsSpecialSample(pSample)) {
pSample->Release();
- }
- else
- {
- if(pSample == NEW_SEGMENT)
- {
+ } else {
+ if (pSample == NEW_SEGMENT) {
// Free NEW_SEGMENT packet
NewSegmentPacket *ppacket =
(NewSegmentPacket *) m_List->RemoveHead();
- // inform derived class we took something off the queue
- if(m_hEventPop)
- {
+ // inform derived class we took something off the queue
+ if (m_hEventPop) {
//DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered SET EVENT")));
- SetEvent(m_hEventPop);
- }
+ SetEvent(m_hEventPop);
+ }
ASSERT(ppacket != NULL);
delete ppacket;
@@ -850,8 +747,7 @@ void COutputQueue::FreeSamples()
}
}
}
- for(int i = 0; i < m_nBatched; i++)
- {
+ for (int i = 0; i < m_nBatched; i++) {
m_ppSamples[i]->Release();
}
m_nBatched = 0;
@@ -864,8 +760,7 @@ void COutputQueue::NotifyThread()
{
// Optimize - no need to signal if it's not waiting
ASSERT(IsQueued());
- if(m_lWaiting)
- {
+ if (m_lWaiting) {
ReleaseSemaphore(m_hSem, m_lWaiting, NULL);
m_lWaiting = 0;
}
@@ -887,12 +782,9 @@ BOOL COutputQueue::IsIdle()
// AND
// there's nothing in the current batch (m_nBatched == 0)
- if(IsQueued() && m_lWaiting == 0 || m_nBatched != 0)
- {
+ if (IsQueued() && m_lWaiting == 0 || m_nBatched != 0) {
return FALSE;
- }
- else
- {
+ } else {
// If we're idle it shouldn't be possible for there
// to be anything on the work queue
diff --git a/src/filters/BaseClasses/outputq.h b/src/filters/BaseClasses/outputq.h
index 4d870762c..db3d42433 100644
--- a/src/filters/BaseClasses/outputq.h
+++ b/src/filters/BaseClasses/outputq.h
@@ -2,7 +2,7 @@
// File: OutputQ.h
//
// Desc: DirectShow base classes - defines the COutputQueue class, which
-// makes a queue of samples and sends them to an output pin. The
+// makes a queue of samples and sends them to an output pin. The
// class will optionally send the samples to the pin directly.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -19,13 +19,13 @@ public:
__inout HRESULT *phr, // 'Return code'
BOOL bAuto = TRUE, // Ask pin if blocks
BOOL bQueue = TRUE, // Send through queue (ignored if
- // bAuto set)
+ // bAuto set)
LONG lBatchSize = 1, // Batch
BOOL bBatchExact = FALSE,// Batch exactly to BatchSize
LONG lListSize = // Likely number in the list
- DEFAULTCACHE,
+ DEFAULTCACHE,
DWORD dwPriority = // Priority of thread to create
- THREAD_PRIORITY_NORMAL,
+ THREAD_PRIORITY_NORMAL,
bool bFlushingOpt = false // flushing optimization
);
~COutputQueue();
@@ -35,21 +35,21 @@ public:
// re-enable receives (pass this downstream)
void EndFlush(); // Complete flush of samples - downstream
- // pin guaranteed not to block at this stage
+ // pin guaranteed not to block at this stage
void EOS(); // Call this on End of stream
void SendAnyway(); // Send batched samples anyway (if bBatchExact set)
void NewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate);
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop,
+ double dRate);
HRESULT Receive(IMediaSample *pSample);
// do something with these media samples
- HRESULT ReceiveMultiple(
+ HRESULT ReceiveMultiple (
__in_ecount(nSamples) IMediaSample **pSamples,
long nSamples,
__out long *nSamplesProcessed);
@@ -87,14 +87,13 @@ protected:
protected:
// Queue 'messages'
-#define SEND_PACKET ((IMediaSample *)(LONG_PTR)(-2)) // Send batch
-#define EOS_PACKET ((IMediaSample *)(LONG_PTR)(-3)) // End of stream
-#define RESET_PACKET ((IMediaSample *)(LONG_PTR)(-4)) // Reset m_hr
-#define NEW_SEGMENT ((IMediaSample *)(LONG_PTR)(-5)) // send NewSegment
+ #define SEND_PACKET ((IMediaSample *)(LONG_PTR)(-2)) // Send batch
+ #define EOS_PACKET ((IMediaSample *)(LONG_PTR)(-3)) // End of stream
+ #define RESET_PACKET ((IMediaSample *)(LONG_PTR)(-4)) // Reset m_hr
+ #define NEW_SEGMENT ((IMediaSample *)(LONG_PTR)(-5)) // send NewSegment
// new segment packet is always followed by one of these
- struct NewSegmentPacket
- {
+ struct NewSegmentPacket {
REFERENCE_TIME tStart;
REFERENCE_TIME tStop;
double dRate;
diff --git a/src/filters/BaseClasses/perflog.cpp b/src/filters/BaseClasses/perflog.cpp
index 60e40e47a..e64253870 100644
--- a/src/filters/BaseClasses/perflog.cpp
+++ b/src/filters/BaseClasses/perflog.cpp
@@ -23,12 +23,12 @@
ULONG
WINAPI
-PerflogCallback(
+PerflogCallback (
WMIDPREQUESTCODE RequestCode,
__in PVOID Context,
__out ULONG* BufferSize,
__in PVOID Buffer
-);
+ );
//
// Event tracing function pointers.
@@ -38,7 +38,7 @@ PerflogCallback(
#ifdef UNICODE
ULONG
-(__stdcall * _RegisterTraceGuids)(
+(__stdcall * _RegisterTraceGuids) (
__in IN WMIDPREQUEST RequestAddress,
__in IN PVOID RequestContext,
IN LPCGUID ControlGuid,
@@ -47,14 +47,14 @@ ULONG
IN LPCWSTR MofImagePath,
IN LPCWSTR MofResourceName,
OUT PTRACEHANDLE RegistrationHandle
-);
+ );
#define REGISTERTRACEGUIDS_NAME "RegisterTraceGuidsW"
#else
ULONG
-(__stdcall * _RegisterTraceGuids)(
+(__stdcall * _RegisterTraceGuids) (
__in IN WMIDPREQUEST RequestAddress,
__in IN PVOID RequestContext,
IN LPCGUID ControlGuid,
@@ -63,37 +63,37 @@ ULONG
IN LPCSTR MofImagePath,
IN LPCSTR MofResourceName,
__out OUT PTRACEHANDLE RegistrationHandle
-);
+ );
#define REGISTERTRACEGUIDS_NAME "RegisterTraceGuidsA"
#endif
ULONG
-(__stdcall * _UnregisterTraceGuids)(
+(__stdcall * _UnregisterTraceGuids) (
TRACEHANDLE RegistrationHandle
-);
+ );
TRACEHANDLE
-(__stdcall * _GetTraceLoggerHandle)(
+(__stdcall * _GetTraceLoggerHandle) (
__in PVOID Buffer
-);
+ );
UCHAR
-(__stdcall * _GetTraceEnableLevel)(
+(__stdcall * _GetTraceEnableLevel) (
TRACEHANDLE TraceHandle
-);
+ );
ULONG
-(__stdcall * _GetTraceEnableFlags)(
+(__stdcall * _GetTraceEnableFlags) (
TRACEHANDLE TraceHandle
-);
+ );
ULONG
-(__stdcall * _TraceEvent)(
+(__stdcall * _TraceEvent) (
TRACEHANDLE TraceHandle,
__in PEVENT_TRACE_HEADER EventTrace
-);
+ );
HINSTANCE _Advapi32;
@@ -101,12 +101,12 @@ HINSTANCE _Advapi32;
// Global variables.
//
-BOOL EventTracingAvailable = FALSE;
+BOOL EventTracingAvailable=FALSE;
ULONG PerflogEnableFlags;
UCHAR PerflogEnableLevel;
ULONG PerflogModuleLevel = 0;
void (*OnStateChanged)(void);
-TRACEHANDLE PerflogTraceHandle = NULL;
+TRACEHANDLE PerflogTraceHandle=NULL;
TRACEHANDLE PerflogRegHandle;
// The Win32 wsprintf() function writes a maximum of 1024 characters to it's output buffer.
@@ -122,7 +122,7 @@ const INT iDEBUGINFO = 1024; // Used to format strings
VOID
PerflogReadModuleLevel(
HINSTANCE hInstance
-)
+ )
{
LONG lReturn; // Create key return value
TCHAR szInfo[iDEBUGINFO]; // Constructs key names
@@ -132,27 +132,23 @@ PerflogReadModuleLevel(
DWORD dwKeySize, dwKeyType, dwKeyValue;
DWORD dwSize = GetModuleFileName(
- (hInstance ? hInstance : GetModuleHandle(NULL)),
- szFullName,
- iDEBUGINFO);
+ (hInstance ? hInstance : GetModuleHandle( NULL )),
+ szFullName,
+ iDEBUGINFO );
- if(0 == dwSize || iDEBUGINFO == dwSize)
- {
+ if (0 == dwSize || iDEBUGINFO == dwSize) {
return;
}
- pName = _tcsrchr(szFullName, '\\');
- if(pName == NULL)
- {
+ pName = _tcsrchr(szFullName,'\\');
+ if (pName == NULL) {
pName = szFullName;
- }
- else
- {
+ } else {
pName++;
}
/* Construct the base key name */
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("SOFTWARE\\Debug\\%s"), pName);
+ (void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("SOFTWARE\\Debug\\%s"),pName);
/* Open the key for this module */
lReturn =
@@ -161,23 +157,22 @@ PerflogReadModuleLevel(
szInfo, // Address of subkey name
(DWORD) 0, // Reserved value
KEY_QUERY_VALUE, // Desired security access
- &hModuleKey); // Opened handle buffer
+ &hModuleKey ); // Opened handle buffer
- if(lReturn != ERROR_SUCCESS)
- {
+ if (lReturn != ERROR_SUCCESS) {
return;
}
dwKeySize = sizeof(DWORD);
lReturn = RegQueryValueEx(
- hModuleKey, // Handle to an open key
- TEXT("PERFLOG"),
- NULL, // Reserved field
- &dwKeyType, // Returns the field type
- (LPBYTE) &dwKeyValue, // Returns the field's value
- &dwKeySize); // Number of bytes transferred
-
- if((lReturn == ERROR_SUCCESS) && (dwKeyType == REG_DWORD))
+ hModuleKey, // Handle to an open key
+ TEXT("PERFLOG"),
+ NULL, // Reserved field
+ &dwKeyType, // Returns the field type
+ (LPBYTE) &dwKeyValue, // Returns the field's value
+ &dwKeySize ); // Number of bytes transferred
+
+ if ((lReturn == ERROR_SUCCESS) && (dwKeyType == REG_DWORD))
{
PerflogModuleLevel = dwKeyValue;
}
@@ -188,12 +183,12 @@ PerflogReadModuleLevel(
BOOL PerflogInitIfEnabled(
IN HINSTANCE hInstance,
__in IN PPERFLOG_LOGGING_PARAMS LogParams
-)
+ )
{
- PerflogReadModuleLevel(hInstance);
- if(PerflogModuleLevel)
+ PerflogReadModuleLevel( hInstance );
+ if (PerflogModuleLevel)
{
- return PerflogInitialize(LogParams);
+ return PerflogInitialize( LogParams );
}
else
{
@@ -202,9 +197,9 @@ BOOL PerflogInitIfEnabled(
}
BOOL
-PerflogInitialize(
+PerflogInitialize (
__in IN PPERFLOG_LOGGING_PARAMS LogParams
-)
+ )
{
ULONG status;
@@ -213,25 +208,23 @@ PerflogInitialize(
// pointers to the event tracing routines.
//
- _Advapi32 = GetModuleHandle(_T("ADVAPI32.DLL"));
- if(_Advapi32 == NULL)
- {
+ _Advapi32 = GetModuleHandle (_T("ADVAPI32.DLL"));
+ if (_Advapi32 == NULL) {
return FALSE;
}
- *((FARPROC*) &_RegisterTraceGuids) = GetProcAddress(_Advapi32, REGISTERTRACEGUIDS_NAME);
- *((FARPROC*) &_UnregisterTraceGuids) = GetProcAddress(_Advapi32, "UnregisterTraceGuids");
- *((FARPROC*) &_GetTraceLoggerHandle) = GetProcAddress(_Advapi32, "GetTraceLoggerHandle");
- *((FARPROC*) &_GetTraceEnableLevel) = GetProcAddress(_Advapi32, "GetTraceEnableLevel");
- *((FARPROC*) &_GetTraceEnableFlags) = GetProcAddress(_Advapi32, "GetTraceEnableFlags");
- *((FARPROC*) &_TraceEvent) = GetProcAddress(_Advapi32, "TraceEvent");
-
- if(_RegisterTraceGuids == NULL ||
- _UnregisterTraceGuids == NULL ||
- _GetTraceEnableLevel == NULL ||
- _GetTraceEnableFlags == NULL ||
- _TraceEvent == NULL)
- {
+ *((FARPROC*) &_RegisterTraceGuids) = GetProcAddress (_Advapi32, REGISTERTRACEGUIDS_NAME);
+ *((FARPROC*) &_UnregisterTraceGuids) = GetProcAddress (_Advapi32, "UnregisterTraceGuids");
+ *((FARPROC*) &_GetTraceLoggerHandle) = GetProcAddress (_Advapi32, "GetTraceLoggerHandle");
+ *((FARPROC*) &_GetTraceEnableLevel) = GetProcAddress (_Advapi32, "GetTraceEnableLevel");
+ *((FARPROC*) &_GetTraceEnableFlags) = GetProcAddress (_Advapi32, "GetTraceEnableFlags");
+ *((FARPROC*) &_TraceEvent) = GetProcAddress (_Advapi32, "TraceEvent");
+
+ if (_RegisterTraceGuids == NULL ||
+ _UnregisterTraceGuids == NULL ||
+ _GetTraceEnableLevel == NULL ||
+ _GetTraceEnableFlags == NULL ||
+ _TraceEvent == NULL) {
return FALSE;
}
@@ -244,14 +237,14 @@ PerflogInitialize(
// Register our GUIDs.
//
- status = _RegisterTraceGuids(PerflogCallback,
- LogParams,
- &LogParams->ControlGuid,
- LogParams->NumberOfTraceGuids,
- LogParams->TraceGuids,
- NULL,
- NULL,
- &PerflogRegHandle);
+ status = _RegisterTraceGuids (PerflogCallback,
+ LogParams,
+ &LogParams->ControlGuid,
+ LogParams->NumberOfTraceGuids,
+ LogParams->TraceGuids,
+ NULL,
+ NULL,
+ &PerflogRegHandle);
return (status == ERROR_SUCCESS);
}
@@ -261,16 +254,15 @@ PerflogInitialize(
//
VOID
-PerflogShutdown(
+PerflogShutdown (
VOID
-)
+ )
{
- if(!EventTracingAvailable)
- {
+ if (!EventTracingAvailable) {
return;
}
- _UnregisterTraceGuids(PerflogRegHandle);
+ _UnregisterTraceGuids (PerflogRegHandle);
PerflogRegHandle = NULL;
PerflogTraceHandle = NULL;
}
@@ -282,28 +274,27 @@ PerflogShutdown(
ULONG
WINAPI
-PerflogCallback(
+PerflogCallback (
WMIDPREQUESTCODE RequestCode,
__in PVOID Context,
__out ULONG* BufferSize,
__in PVOID Buffer
-)
+ )
{
ULONG status;
- UNREFERENCED_PARAMETER(Context);
+ UNREFERENCED_PARAMETER (Context);
- ASSERT(EventTracingAvailable);
+ ASSERT (EventTracingAvailable);
status = ERROR_SUCCESS;
- switch(RequestCode)
- {
+ switch (RequestCode) {
case WMI_ENABLE_EVENTS:
- PerflogTraceHandle = _GetTraceLoggerHandle(Buffer);
- PerflogEnableFlags = _GetTraceEnableFlags(PerflogTraceHandle);
- PerflogEnableLevel = _GetTraceEnableLevel(PerflogTraceHandle);
+ PerflogTraceHandle = _GetTraceLoggerHandle (Buffer);
+ PerflogEnableFlags = _GetTraceEnableFlags (PerflogTraceHandle);
+ PerflogEnableLevel = _GetTraceEnableLevel (PerflogTraceHandle);
break;
case WMI_DISABLE_EVENTS:
@@ -316,8 +307,7 @@ PerflogCallback(
status = ERROR_INVALID_PARAMETER;
}
- if(OnStateChanged != NULL)
- {
+ if (OnStateChanged != NULL) {
OnStateChanged();
}
@@ -330,30 +320,28 @@ PerflogCallback(
//
VOID
-PerflogTraceEvent(
+PerflogTraceEvent (
__in PEVENT_TRACE_HEADER Event
-)
+ )
{
- if(!EventTracingAvailable)
- {
+ if (!EventTracingAvailable) {
return;
}
- _TraceEvent(PerflogTraceHandle, Event);
+ _TraceEvent (PerflogTraceHandle, Event);
}
VOID
PerflogTraceEventLevel(
ULONG Level,
__in PEVENT_TRACE_HEADER Event
-)
+ )
{
- if((!EventTracingAvailable) || (Level <= PerflogModuleLevel))
- {
+ if ((!EventTracingAvailable) || (Level <= PerflogModuleLevel)) {
return;
}
- _TraceEvent(PerflogTraceHandle, Event);
+ _TraceEvent (PerflogTraceHandle, Event);
}
diff --git a/src/filters/BaseClasses/perflog.h b/src/filters/BaseClasses/perflog.h
index 988b1eee7..503a1304f 100644
--- a/src/filters/BaseClasses/perflog.h
+++ b/src/filters/BaseClasses/perflog.h
@@ -6,8 +6,7 @@
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
-typedef struct _PERFLOG_LOGGING_PARAMS
-{
+typedef struct _PERFLOG_LOGGING_PARAMS {
GUID ControlGuid;
void (*OnStateChanged)(void);
ULONG NumberOfTraceGuids;
@@ -18,22 +17,22 @@ BOOL
PerflogInitIfEnabled(
IN HINSTANCE hInstance,
__in PPERFLOG_LOGGING_PARAMS LogParams
-);
+ );
BOOL
-PerflogInitialize(
+PerflogInitialize (
__in PPERFLOG_LOGGING_PARAMS LogParams
-);
+ );
VOID
-PerflogShutdown(
+PerflogShutdown (
VOID
-);
+ );
VOID
-PerflogTraceEvent(
+PerflogTraceEvent (
__in PEVENT_TRACE_HEADER Event
-);
+ );
extern ULONG PerflogEnableFlags;
extern UCHAR PerflogEnableLevel;
@@ -49,9 +48,9 @@ VOID
PerflogTraceEventLevel(
ULONG Level,
__in PEVENT_TRACE_HEADER Event
-);
+ );
VOID
-PerflogTraceEvent(
+PerflogTraceEvent (
__in PEVENT_TRACE_HEADER Event
-);
+ );
diff --git a/src/filters/BaseClasses/perfstruct.h b/src/filters/BaseClasses/perfstruct.h
index cb14edd75..9c67b738d 100644
--- a/src/filters/BaseClasses/perfstruct.h
+++ b/src/filters/BaseClasses/perfstruct.h
@@ -15,55 +15,54 @@
// {28CF047A-2437-4b24-B653-B9446A419A69}
DEFINE_GUID(GUID_DSHOW_CTL,
- 0x28cf047a, 0x2437, 0x4b24, 0xb6, 0x53, 0xb9, 0x44, 0x6a, 0x41, 0x9a, 0x69);
+0x28cf047a, 0x2437, 0x4b24, 0xb6, 0x53, 0xb9, 0x44, 0x6a, 0x41, 0x9a, 0x69);
// {D0DA7AD6-AE80-4de5-AAFC-C126711E7593}
DEFINE_GUID(GUID_VIDEOREND,
- 0xd0da7ad6, 0xae80, 0x4de5, 0xaa, 0xfc, 0xc1, 0x26, 0x71, 0x1e, 0x75, 0x93);
+0xd0da7ad6, 0xae80, 0x4de5, 0xaa, 0xfc, 0xc1, 0x26, 0x71, 0x1e, 0x75, 0x93);
// {DC70AC3E-93E5-48db-88AB-E42064EC276A}
DEFINE_GUID(GUID_DSOUNDGLITCH,
- 0xdc70ac3e, 0x93e5, 0x48db, 0x88, 0xab, 0xe4, 0x20, 0x64, 0xec, 0x27, 0x6a);
+0xdc70ac3e, 0x93e5, 0x48db, 0x88, 0xab, 0xe4, 0x20, 0x64, 0xec, 0x27, 0x6a);
// {3d7e7d93-2fc8-4a07-a719-e0922ff2899}
DEFINE_GUID(GUID_STREAMTRACE,
- 0x3d7e7d93, 0x2fc8, 0x4a07, 0xa7, 0x19, 0xe0, 0x92, 0x2f, 0xf2, 0x89, 0x9e);
+0x3d7e7d93, 0x2fc8, 0x4a07, 0xa7, 0x19, 0xe0, 0x92, 0x2f, 0xf2, 0x89, 0x9e);
// AZFIX: the following GUIDs aren't useful right now.
// {3C33F7F5-EE54-493c-BA25-1656539C05AC}
DEFINE_GUID(GUID_GETTIME,
- 0x3c33f7f5, 0xee54, 0x493c, 0xba, 0x25, 0x16, 0x56, 0x53, 0x9c, 0x5, 0xac);
+0x3c33f7f5, 0xee54, 0x493c, 0xba, 0x25, 0x16, 0x56, 0x53, 0x9c, 0x5, 0xac);
// {CC44B44D-8169-4952-9E4A-A4E13295E492}
DEFINE_GUID(GUID_AUDIOREND,
- 0xcc44b44d, 0x8169, 0x4952, 0x9e, 0x4a, 0xa4, 0xe1, 0x32, 0x95, 0xe4, 0x92);
+0xcc44b44d, 0x8169, 0x4952, 0x9e, 0x4a, 0xa4, 0xe1, 0x32, 0x95, 0xe4, 0x92);
// {775D19BF-4D8B-4de6-8DC9-66BAC7B310A2}
DEFINE_GUID(GUID_FRAMEDROP,
- 0x775d19bf, 0x4d8b, 0x4de6, 0x8d, 0xc9, 0x66, 0xba, 0xc7, 0xb3, 0x10, 0xa2);
+0x775d19bf, 0x4d8b, 0x4de6, 0x8d, 0xc9, 0x66, 0xba, 0xc7, 0xb3, 0x10, 0xa2);
// {56D29065-EFBE-42dc-8C29-E325DC9C27D5}
DEFINE_GUID(GUID_AUDIOBREAK,
- 0x56d29065, 0xefbe, 0x42dc, 0x8c, 0x29, 0xe3, 0x25, 0xdc, 0x9c, 0x27, 0xd5);
+0x56d29065, 0xefbe, 0x42dc, 0x8c, 0x29, 0xe3, 0x25, 0xdc, 0x9c, 0x27, 0xd5);
// {E1E6EA87-95A8-497e-BFBA-0295AEBCC707}
DEFINE_GUID(GUID_AUDIORECV,
- 0xe1e6ea87, 0x95a8, 0x497e, 0xbf, 0xba, 0x2, 0x95, 0xae, 0xbc, 0xc7, 0x7);
+0xe1e6ea87, 0x95a8, 0x497e, 0xbf, 0xba, 0x2, 0x95, 0xae, 0xbc, 0xc7, 0x7);
// {10F7768A-B1E7-4242-AD90-A2D44683D9F0}
DEFINE_GUID(GUID_AUDIOSLAVE,
- 0x10f7768a, 0xb1e7, 0x4242, 0xad, 0x90, 0xa2, 0xd4, 0x46, 0x83, 0xd9, 0xf0);
+0x10f7768a, 0xb1e7, 0x4242, 0xad, 0x90, 0xa2, 0xd4, 0x46, 0x83, 0xd9, 0xf0);
// {8983803D-691A-49bc-8FF6-962A39C0198F}
DEFINE_GUID(GUID_AUDIOADDBREAK,
- 0x8983803d, 0x691a, 0x49bc, 0x8f, 0xf6, 0x96, 0x2a, 0x39, 0xc0, 0x19, 0x8f);
+0x8983803d, 0x691a, 0x49bc, 0x8f, 0xf6, 0x96, 0x2a, 0x39, 0xc0, 0x19, 0x8f);
#define GLITCHTYPE_DSOUNDFIRSTGOOD 0
#define GLITCHTYPE_DSOUNDFIRSTBAD 1
-typedef struct PERFINFO_DSHOW_AUDIOGLITCH
-{
+typedef struct PERFINFO_DSHOW_AUDIOGLITCH {
ULONGLONG cycleCounter;
DWORD glitchType;
LONGLONG sampleTime;
@@ -71,60 +70,51 @@ typedef struct PERFINFO_DSHOW_AUDIOGLITCH
ULONG_PTR instanceId;
} PERFINFO_DSHOW_AUDIOGLITCH, *PPERFINFO_DSHOW_AUDIOGLITCH;
-typedef struct PERFINFO_WMI_AUDIOGLITCH
-{
+typedef struct PERFINFO_WMI_AUDIOGLITCH {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_AUDIOGLITCH data;
} PERFINFO_WMI_AUDIO_GLITCH, *PPERFINFO_WMI_AUDIOGLITCH;
-typedef struct PERFINFO_DSHOW_GETTIME
-{
+typedef struct PERFINFO_DSHOW_GETTIME {
ULONGLONG cycleCounter;
ULONGLONG dshowClock;
} PERFINFO_DSHOW_GETTIME, *PPERFINFO_DSHOW_GETTIME;
-typedef struct PERFINFO_WMI_GETTIME
-{
+typedef struct PERFINFO_WMI_GETTIME {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_GETTIME data;
} PERFINFO_WMI_GETTIME, *PPERFINFO_WMI_GETTIME;
-typedef struct PERFINFO_DSHOW_AVREND
-{
+typedef struct PERFINFO_DSHOW_AVREND {
ULONGLONG cycleCounter;
ULONGLONG dshowClock;
ULONGLONG sampleTime;
} PERFINFO_DSHOW_AVREND, *PPERFINFO_DSHOW_AVREND;
-typedef struct PERFINFO_WMI_AVREND
-{
+typedef struct PERFINFO_WMI_AVREND {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_AVREND data;
} PERFINFO_WMI_AVREND, *PPERFINFO_WMI_AVREND;
-typedef struct PERFINFO_DSHOW_AUDIOBREAK
-{
+typedef struct PERFINFO_DSHOW_AUDIOBREAK {
ULONGLONG cycleCounter;
ULONGLONG dshowClock;
ULONGLONG sampleTime;
ULONGLONG sampleDuration;
} PERFINFO_DSHOW_AUDIOBREAK, *PPERFINFO_DSHOW_AUDIOBREAK;
-typedef struct PERFINFO_WMI_AUDIOBREAK
-{
+typedef struct PERFINFO_WMI_AUDIOBREAK {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_AUDIOBREAK data;
} PERFINFO_WMI_AUDIOBREAK, *PPERFINFO_WMI_AUDIOBREAK;
-typedef struct PERFINFO_DSHOW_FRAMEDROP
-{
+typedef struct PERFINFO_DSHOW_FRAMEDROP {
ULONGLONG cycleCounter;
ULONGLONG dshowClock;
ULONGLONG frameTime;
} PERFINFO_DSHOW_FRAMEDROP, *PPERFINFO_DSHOW_FRAMEDROP;
-typedef struct PERFINFO_WMI_FRAMEDROP
-{
+typedef struct PERFINFO_WMI_FRAMEDROP {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_FRAMEDROP data;
} PERFINFO_WMI_FRAMEDROP, *PPERFINFO_WMI_FRAMEDROP;
@@ -150,23 +140,20 @@ typedef struct PERFINFO_WMI_FRAMEDROP
#define PERFINFO_STREAMTRACE_SBE_DVROUTPUTPIN_RECEIVE 19
#define PERFINFO_STREAMTRACE_VMR_RENDER_TIME 20
-typedef struct _PERFINFO_DSHOW_STREAMTRACE
-{
+typedef struct _PERFINFO_DSHOW_STREAMTRACE {
ULONG id;
ULONG reserved;
ULONGLONG dshowClock;
ULONGLONG data[ 4 ];
} PERFINFO_DSHOW_STREAMTRACE, *PPERFINFO_DSHOW_STREAMTRACE;
-typedef struct _PERFINFO_WMI_STREAMTRACE
-{
+typedef struct _PERFINFO_WMI_STREAMTRACE {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_STREAMTRACE data;
} PERFINFO_WMI_STREAMTRACE, *PPERFINFO_WMI_STREAMTRACE;
-typedef struct PERFINFO_DSHOW_AUDIORECV
-{
+typedef struct PERFINFO_DSHOW_AUDIORECV {
LONGLONG streamTime ;
LONGLONG sampleStart ;
LONGLONG sampleStop ;
@@ -174,14 +161,12 @@ typedef struct PERFINFO_DSHOW_AUDIORECV
BOOL discontinuity ;
} PERFINFO_DSHOW_AUDIORECV, *PPERFINFO_DSHOW_AUDIORECV;
-typedef struct PERFINFO_WMI_AUDIORECV
-{
+typedef struct PERFINFO_WMI_AUDIORECV {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_AUDIORECV data;
} PERFINFO_WMI_AUDIORECV, *PPERFINFO_WMI_AUDIORECV;
-typedef struct PERFINFO_DSHOW_AUDIOSLAVE
-{
+typedef struct PERFINFO_DSHOW_AUDIOSLAVE {
LONGLONG masterClock ;
LONGLONG slaveClock ;
LONGLONG errorAccum ;
@@ -189,22 +174,19 @@ typedef struct PERFINFO_DSHOW_AUDIOSLAVE
LONGLONG lastLowErrorSeen ;
} PERFINFO_DSHOW_AUDIOSLAVE, *PPERFINFO_DSHOW_AUDIOSLAVE;
-typedef struct PERFINFO_WMI_AUDIOSLAVE
-{
+typedef struct PERFINFO_WMI_AUDIOSLAVE {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_AUDIOSLAVE data;
} PERFINFO_WMI_AUDIOSLAVE, *PPERFINFO_WMI_AUDIOSLAVE;
-typedef struct PERFINFO_DSHOW_AUDIOADDBREAK
-{
+typedef struct PERFINFO_DSHOW_AUDIOADDBREAK {
DWORD iterNextWrite ;
DWORD offsetNextWrite ;
DWORD iterWrite ;
DWORD offsetWrite ;
} PERFINFO_DSHOW_AUDIOADDBREAK, *PPERFINFO_DSHOW_AUDIOADDBREAK;
-typedef struct PERFINFO_WMI_AUDIOADDBREAK
-{
+typedef struct PERFINFO_WMI_AUDIOADDBREAK {
EVENT_TRACE_HEADER header;
PERFINFO_DSHOW_AUDIOADDBREAK data;
} PERFINFO_WMI_AUDIOADDBREAK, *PPERFINFO_WMI_AUDIOADDBREAK;
diff --git a/src/filters/BaseClasses/pstream.cpp b/src/filters/BaseClasses/pstream.cpp
index 7555c3059..d20171f5c 100644
--- a/src/filters/BaseClasses/pstream.cpp
+++ b/src/filters/BaseClasses/pstream.cpp
@@ -28,8 +28,7 @@ CPersistStream::CPersistStream(IUnknown *punk, __inout HRESULT *phr)
//
// Destructor
//
-CPersistStream::~CPersistStream()
-{
+CPersistStream::~CPersistStream() {
// Nothing to do
}
@@ -42,16 +41,13 @@ SAMPLE CODE TO COPY - not active at the moment
// This object supports IPersist & IPersistStream
STDMETHODIMP CPersistStream::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- if(riid == IID_IPersist)
- {
+ if (riid == IID_IPersist) {
return GetInterface((IPersist *) this, ppv); // ???
}
- else if(riid == IID_IPersistStream)
- {
+ else if (riid == IID_IPersistStream) {
return GetInterface((IPersistStream *) this, ppv);
}
- else
- {
+ else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -90,8 +86,7 @@ STDMETHODIMP CPersistStream::Load(LPSTREAM pStm)
HRESULT hr;
// Load the version number then the data
mPS_dwFileVersion = ReadInt(pStm, hr);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -108,14 +103,12 @@ STDMETHODIMP CPersistStream::Save(LPSTREAM pStm, BOOL fClearDirty)
{
HRESULT hr = WriteInt(pStm, GetSoftwareVersion());
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
hr = WriteToStream(pStm);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -136,8 +129,8 @@ STDMETHODIMP CPersistStream::Save(LPSTREAM pStm, BOOL fClearDirty)
STDAPI WriteInt(IStream *pIStream, int n)
{
WCHAR Buff[13]; // Allows for trailing null that we don't write
- (void)StringCchPrintfW(Buff, NUMELMS(Buff), L"%011d ", n);
- return pIStream->Write(&(Buff[0]), 12 * sizeof(WCHAR), NULL);
+ (void)StringCchPrintfW(Buff, NUMELMS(Buff),L"%011d ",n);
+ return pIStream->Write(&(Buff[0]), 12*sizeof(WCHAR), NULL);
} // WriteInt
@@ -155,52 +148,41 @@ STDAPI_(int) ReadInt(IStream *pIStream, __out HRESULT &hr)
unsigned int n = 0; // result wil be n*Sign
WCHAR wch;
- hr = pIStream->Read(&wch, sizeof(wch), NULL);
- if(FAILED(hr))
- {
+ hr = pIStream->Read( &wch, sizeof(wch), NULL);
+ if (FAILED(hr)) {
return 0;
}
- if(wch == L'-')
- {
+ if (wch==L'-'){
Sign = -1;
- hr = pIStream->Read(&wch, sizeof(wch), NULL);
- if(FAILED(hr))
- {
+ hr = pIStream->Read( &wch, sizeof(wch), NULL);
+ if (FAILED(hr)) {
return 0;
}
}
- for(; ;)
- {
- if(wch >= L'0' && wch <= L'9')
- {
- n = 10 * n + (int)(wch - L'0');
- }
- else if(wch == L' '
- || wch == L'\t'
- || wch == L'\r'
- || wch == L'\n'
- || wch == L'\0'
- )
- {
+ for( ; ; ) {
+ if (wch>=L'0' && wch<=L'9') {
+ n = 10*n+(int)(wch-L'0');
+ } else if ( wch == L' '
+ || wch == L'\t'
+ || wch == L'\r'
+ || wch == L'\n'
+ || wch == L'\0'
+ ) {
break;
- }
- else
- {
+ } else {
hr = VFW_E_INVALID_FILE_FORMAT;
return 0;
}
- hr = pIStream->Read(&wch, sizeof(wch), NULL);
- if(FAILED(hr))
- {
+ hr = pIStream->Read( &wch, sizeof(wch), NULL);
+ if (FAILED(hr)) {
return 0;
}
}
- if(n == 0x80000000 && Sign == -1)
- {
+ if (n==0x80000000 && Sign==-1) {
// This is the negative number that has no positive version!
return (int)n;
}
diff --git a/src/filters/BaseClasses/pstream.h b/src/filters/BaseClasses/pstream.h
index 5fca1b88d..04b6af624 100644
--- a/src/filters/BaseClasses/pstream.h
+++ b/src/filters/BaseClasses/pstream.h
@@ -44,75 +44,60 @@
// Implements IPersistStream.
// See 'OLE Programmers Reference (Vol 1):Structured Storage Overview' for
// more implementation information.
-class CPersistStream : public IPersistStream
-{
-private:
+class CPersistStream : public IPersistStream {
+ private:
- // Internal state:
+ // Internal state:
-protected:
- DWORD mPS_dwFileVersion; // version number of file (being read)
- BOOL mPS_fDirty;
+ protected:
+ DWORD mPS_dwFileVersion; // version number of file (being read)
+ BOOL mPS_fDirty;
-public:
+ public:
- // IPersistStream methods
+ // IPersistStream methods
- STDMETHODIMP IsDirty()
- {
- return (mPS_fDirty ? S_OK : S_FALSE); // note FALSE means clean
- }
- STDMETHODIMP Load(LPSTREAM pStm);
- STDMETHODIMP Save(LPSTREAM pStm, BOOL fClearDirty);
- STDMETHODIMP GetSizeMax(__out ULARGE_INTEGER * pcbSize)
- // Allow 24 bytes for version.
- {
- pcbSize->QuadPart = 12 * sizeof(WCHAR) + SizeMax();
- return NOERROR;
- }
+ STDMETHODIMP IsDirty()
+ {return (mPS_fDirty ? S_OK : S_FALSE);} // note FALSE means clean
+ STDMETHODIMP Load(LPSTREAM pStm);
+ STDMETHODIMP Save(LPSTREAM pStm, BOOL fClearDirty);
+ STDMETHODIMP GetSizeMax(__out ULARGE_INTEGER * pcbSize)
+ // Allow 24 bytes for version.
+ { pcbSize->QuadPart = 12*sizeof(WCHAR)+SizeMax(); return NOERROR; }
- // implementation
+ // implementation
- CPersistStream(IUnknown *punk, __inout HRESULT *phr);
- ~CPersistStream();
+ CPersistStream(IUnknown *punk, __inout HRESULT *phr);
+ ~CPersistStream();
- HRESULT SetDirty(BOOL fDirty)
- {
- mPS_fDirty = fDirty;
- return NOERROR;
- }
+ HRESULT SetDirty(BOOL fDirty)
+ { mPS_fDirty = fDirty; return NOERROR;}
- // override to reveal IPersist & IPersistStream
- // STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
+ // override to reveal IPersist & IPersistStream
+ // STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
- // --- IPersist ---
+ // --- IPersist ---
- // You must override this to provide your own class id
- STDMETHODIMP GetClassID(__out CLSID *pClsid) PURE;
+ // You must override this to provide your own class id
+ STDMETHODIMP GetClassID(__out CLSID *pClsid) PURE;
- // overrideable if you want
- // file version number. Override it if you ever change format
- virtual DWORD GetSoftwareVersion(void)
- {
- return 0;
- }
+ // overrideable if you want
+ // file version number. Override it if you ever change format
+ virtual DWORD GetSoftwareVersion(void) { return 0; }
- //=========================================================================
- // OVERRIDE THESE to read and write your data
- // OVERRIDE THESE to read and write your data
- // OVERRIDE THESE to read and write your data
+ //=========================================================================
+ // OVERRIDE THESE to read and write your data
+ // OVERRIDE THESE to read and write your data
+ // OVERRIDE THESE to read and write your data
- virtual int SizeMax()
- {
- return 0;
- }
- virtual HRESULT WriteToStream(IStream *pStream);
- virtual HRESULT ReadFromStream(IStream *pStream);
- //=========================================================================
+ virtual int SizeMax() {return 0;}
+ virtual HRESULT WriteToStream(IStream *pStream);
+ virtual HRESULT ReadFromStream(IStream *pStream);
+ //=========================================================================
-private:
+ private:
};
diff --git a/src/filters/BaseClasses/pullpin.cpp b/src/filters/BaseClasses/pullpin.cpp
index 988747cb8..a197ba58a 100644
--- a/src/filters/BaseClasses/pullpin.cpp
+++ b/src/filters/BaseClasses/pullpin.cpp
@@ -17,12 +17,12 @@
CPullPin::CPullPin()
- : m_pReader(NULL),
- m_pAlloc(NULL),
- m_State(TM_Exit)
+ : m_pReader(NULL),
+ m_pAlloc(NULL),
+ m_State(TM_Exit)
{
#ifdef DXMPERF
- PERFLOG_CTOR(L"CPullPin", this);
+ PERFLOG_CTOR( L"CPullPin", this );
#endif // DXMPERF
}
@@ -32,7 +32,7 @@ CPullPin::~CPullPin()
Disconnect();
#ifdef DXMPERF
- PERFLOG_DTOR(L"CPullPin", this);
+ PERFLOG_DTOR( L"CPullPin", this );
#endif // DXMPERF
}
@@ -46,54 +46,50 @@ CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync)
{
CAutoLock lock(&m_AccessLock);
- if(m_pReader)
- {
- return VFW_E_ALREADY_CONNECTED;
+ if (m_pReader) {
+ return VFW_E_ALREADY_CONNECTED;
}
HRESULT hr = pUnk->QueryInterface(IID_IAsyncReader, (void**)&m_pReader);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
#ifdef DXMPERF
- {
- AM_MEDIA_TYPE * pmt = NULL;
- PERFLOG_CONNECT(this, pUnk, hr, pmt);
- }
+ {
+ AM_MEDIA_TYPE * pmt = NULL;
+ PERFLOG_CONNECT( this, pUnk, hr, pmt );
+ }
#endif // DXMPERF
- return(hr);
+ return(hr);
}
hr = DecideAllocator(pAlloc, NULL);
- if(FAILED(hr))
- {
- Disconnect();
+ if (FAILED(hr)) {
+ Disconnect();
#ifdef DXMPERF
- {
- AM_MEDIA_TYPE * pmt = NULL;
- PERFLOG_CONNECT(this, pUnk, hr, pmt);
- }
+ {
+ AM_MEDIA_TYPE * pmt = NULL;
+ PERFLOG_CONNECT( this, pUnk, hr, pmt );
+ }
#endif // DXMPERF
- return hr;
+ return hr;
}
LONGLONG llTotal, llAvail;
hr = m_pReader->Length(&llTotal, &llAvail);
- if(FAILED(hr))
- {
- Disconnect();
+ if (FAILED(hr)) {
+ Disconnect();
#ifdef DXMPERF
- {
- AM_MEDIA_TYPE * pmt = NULL;
- PERFLOG_CONNECT(this, pUnk, hr, pmt);
- }
+ {
+ AM_MEDIA_TYPE * pmt = NULL;
+ PERFLOG_CONNECT( this, pUnk, hr, pmt );
+ }
#endif
- return hr;
+ return hr;
}
// convert from file position to reference time
@@ -104,10 +100,10 @@ CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync)
m_bSync = bSync;
#ifdef DXMPERF
- {
- AM_MEDIA_TYPE * pmt = NULL;
- PERFLOG_CONNECT(this, pUnk, S_OK, pmt);
- }
+ {
+ AM_MEDIA_TYPE * pmt = NULL;
+ PERFLOG_CONNECT( this, pUnk, S_OK, pmt );
+ }
#endif // DXMPERF
@@ -124,20 +120,18 @@ CPullPin::Disconnect()
#ifdef DXMPERF
- PERFLOG_DISCONNECT(this, m_pReader, S_OK);
+ PERFLOG_DISCONNECT( this, m_pReader, S_OK );
#endif // DXMPERF
- if(m_pReader)
- {
- m_pReader->Release();
- m_pReader = NULL;
+ if (m_pReader) {
+ m_pReader->Release();
+ m_pReader = NULL;
}
- if(m_pAlloc)
- {
- m_pAlloc->Release();
- m_pAlloc = NULL;
+ if (m_pAlloc) {
+ m_pAlloc->Release();
+ m_pAlloc = NULL;
}
return S_OK;
@@ -155,22 +149,19 @@ CPullPin::DecideAllocator(
{
ALLOCATOR_PROPERTIES *pRequest;
ALLOCATOR_PROPERTIES Request;
- if(pProps == NULL)
- {
- Request.cBuffers = 3;
- Request.cbBuffer = 64 * 1024;
- Request.cbAlign = 0;
- Request.cbPrefix = 0;
- pRequest = &Request;
- }
- else
- {
- pRequest = pProps;
+ if (pProps == NULL) {
+ Request.cBuffers = 3;
+ Request.cbBuffer = 64*1024;
+ Request.cbAlign = 0;
+ Request.cbPrefix = 0;
+ pRequest = &Request;
+ } else {
+ pRequest = pProps;
}
HRESULT hr = m_pReader->RequestAllocator(
- pAlloc,
- pRequest,
- &m_pAlloc);
+ pAlloc,
+ pRequest,
+ &m_pAlloc);
return hr;
}
@@ -198,20 +189,18 @@ CPullPin::Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop)
ThreadMsg AtStart = m_State;
- if(AtStart == TM_Start)
- {
- BeginFlush();
- PauseThread();
- EndFlush();
+ if (AtStart == TM_Start) {
+ BeginFlush();
+ PauseThread();
+ EndFlush();
}
m_tStart = tStart;
m_tStop = tStop;
HRESULT hr = S_OK;
- if(AtStart == TM_Start)
- {
- hr = StartThread();
+ if (AtStart == TM_Start) {
+ hr = StartThread();
}
return hr;
@@ -230,27 +219,23 @@ CPullPin::StartThread()
{
CAutoLock lock(&m_AccessLock);
- if(!m_pAlloc || !m_pReader)
- {
- return E_UNEXPECTED;
+ if (!m_pAlloc || !m_pReader) {
+ return E_UNEXPECTED;
}
HRESULT hr;
- if(!ThreadExists())
- {
+ if (!ThreadExists()) {
- // commit allocator
- hr = m_pAlloc->Commit();
- if(FAILED(hr))
- {
- return hr;
- }
+ // commit allocator
+ hr = m_pAlloc->Commit();
+ if (FAILED(hr)) {
+ return hr;
+ }
- // start thread
- if(!Create())
- {
- return E_FAIL;
- }
+ // start thread
+ if (!Create()) {
+ return E_FAIL;
+ }
}
m_State = TM_Start;
@@ -263,17 +248,15 @@ CPullPin::PauseThread()
{
CAutoLock lock(&m_AccessLock);
- if(!ThreadExists())
- {
- return E_UNEXPECTED;
+ if (!ThreadExists()) {
+ return E_UNEXPECTED;
}
// need to flush to ensure the thread is not blocked
// in WaitForNext
HRESULT hr = m_pReader->BeginFlush();
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
m_State = TM_Pause;
@@ -288,17 +271,15 @@ CPullPin::StopThread()
{
CAutoLock lock(&m_AccessLock);
- if(!ThreadExists())
- {
- return S_FALSE;
+ if (!ThreadExists()) {
+ return S_FALSE;
}
// need to flush to ensure the thread is not blocked
// in WaitForNext
HRESULT hr = m_pReader->BeginFlush();
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
m_State = TM_Exit;
@@ -310,9 +291,8 @@ CPullPin::StopThread()
Close();
// decommit allocator
- if(m_pAlloc)
- {
- m_pAlloc->Decommit();
+ if (m_pAlloc) {
+ m_pAlloc->Decommit();
}
return S_OK;
@@ -322,35 +302,33 @@ CPullPin::StopThread()
DWORD
CPullPin::ThreadProc(void)
{
- while(1)
- {
- DWORD cmd = GetRequest();
- switch(cmd)
- {
- case TM_Exit:
- Reply(S_OK);
- return 0;
-
- case TM_Pause:
- // we are paused already
- Reply(S_OK);
- break;
-
- case TM_Start:
- Reply(S_OK);
- Process();
- break;
- }
-
- // at this point, there should be no outstanding requests on the
- // upstream filter.
- // We should force begin/endflush to ensure that this is true.
- // !!!Note that we may currently be inside a BeginFlush/EndFlush pair
- // on another thread, but the premature EndFlush will do no harm now
- // that we are idle.
- m_pReader->BeginFlush();
- CleanupCancelled();
- m_pReader->EndFlush();
+ while(1) {
+ DWORD cmd = GetRequest();
+ switch(cmd) {
+ case TM_Exit:
+ Reply(S_OK);
+ return 0;
+
+ case TM_Pause:
+ // we are paused already
+ Reply(S_OK);
+ break;
+
+ case TM_Start:
+ Reply(S_OK);
+ Process();
+ break;
+ }
+
+ // at this point, there should be no outstanding requests on the
+ // upstream filter.
+ // We should force begin/endflush to ensure that this is true.
+ // !!!Note that we may currently be inside a BeginFlush/EndFlush pair
+ // on another thread, but the premature EndFlush will do no harm now
+ // that we are idle.
+ m_pReader->BeginFlush();
+ CleanupCancelled();
+ m_pReader->EndFlush();
}
}
@@ -359,20 +337,18 @@ CPullPin::QueueSample(
__inout REFERENCE_TIME& tCurrent,
REFERENCE_TIME tAlignStop,
BOOL bDiscontinuity
-)
+ )
{
IMediaSample* pSample;
HRESULT hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS);
- if(tStopThis > tAlignStop)
- {
- tStopThis = tAlignStop;
+ if (tStopThis > tAlignStop) {
+ tStopThis = tAlignStop;
}
pSample->SetTime(&tCurrent, &tStopThis);
tCurrent = tStopThis;
@@ -380,14 +356,13 @@ CPullPin::QueueSample(
pSample->SetDiscontinuity(bDiscontinuity);
hr = m_pReader->Request(
- pSample,
- 0);
- if(FAILED(hr))
- {
- pSample->Release();
-
- CleanupCancelled();
- OnError(hr);
+ pSample,
+ 0);
+ if (FAILED(hr)) {
+ pSample->Release();
+
+ CleanupCancelled();
+ OnError(hr);
}
return hr;
}
@@ -400,24 +375,19 @@ CPullPin::CollectAndDeliver(
IMediaSample* pSample = NULL; // better be sure pSample is set
DWORD_PTR dwUnused;
HRESULT hr = m_pReader->WaitForNext(
- INFINITE,
- &pSample,
- &dwUnused);
- if(FAILED(hr))
- {
- if(pSample)
- {
- pSample->Release();
- }
- }
- else
- {
- hr = DeliverSample(pSample, tStart, tStop);
- }
- if(FAILED(hr))
- {
- CleanupCancelled();
- OnError(hr);
+ INFINITE,
+ &pSample,
+ &dwUnused);
+ if (FAILED(hr)) {
+ if (pSample) {
+ pSample->Release();
+ }
+ } else {
+ hr = DeliverSample(pSample, tStart, tStop);
+ }
+ if (FAILED(hr)) {
+ CleanupCancelled();
+ OnError(hr);
}
return hr;
@@ -428,14 +398,12 @@ CPullPin::DeliverSample(
IMediaSample* pSample,
REFERENCE_TIME tStart,
REFERENCE_TIME tStop
-)
+ )
{
// fix up sample if past actual stop (for sector alignment)
REFERENCE_TIME t1, t2;
- if(S_OK == pSample->GetTime(&t1, &t2))
- {
- if(t2 > tStop)
- {
+ if (S_OK == pSample->GetTime(&t1, &t2)) {
+ if (t2 > tStop) {
t2 = tStop;
}
@@ -443,18 +411,17 @@ CPullPin::DeliverSample(
t1 -= tStart;
t2 -= tStart;
HRESULT hr = pSample->SetTime(&t1, &t2);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
}
#ifdef DXMPERF
- {
- AM_MEDIA_TYPE * pmt = NULL;
- pSample->GetMediaType(&pmt);
- PERFLOG_RECEIVE(L"CPullPin", m_pReader, this, pSample, pmt);
- }
+ {
+ AM_MEDIA_TYPE * pmt = NULL;
+ pSample->GetMediaType( &pmt );
+ PERFLOG_RECEIVE( L"CPullPin", m_pReader, this, pSample, pmt );
+ }
#endif
HRESULT hr = Receive(pSample);
@@ -466,10 +433,9 @@ void
CPullPin::Process(void)
{
// is there anything to do?
- if(m_tStop <= m_tStart)
- {
- EndOfStream();
- return;
+ if (m_tStop <= m_tStart) {
+ EndOfStream();
+ return;
}
BOOL bDiscontinuity = TRUE;
@@ -485,9 +451,8 @@ CPullPin::Process(void)
REFERENCE_TIME tCurrent = tStart;
REFERENCE_TIME tStop = m_tStop;
- if(tStop > m_tDuration)
- {
- tStop = m_tDuration;
+ if (tStop > m_tDuration) {
+ tStop = m_tDuration;
}
// align the stop position - may be past stop, but that
@@ -497,124 +462,104 @@ CPullPin::Process(void)
DWORD dwRequest;
- if(!m_bSync)
- {
-
- // Break out of the loop either if we get to the end or we're asked
- // to do something else
- while(tCurrent < tAlignStop)
- {
-
- // Break out without calling EndOfStream if we're asked to
- // do something different
- if(CheckRequest(&dwRequest))
- {
- return;
- }
-
- // queue a first sample
- if(Actual.cBuffers > 1)
- {
-
- hr = QueueSample(tCurrent, tAlignStop, TRUE);
- bDiscontinuity = FALSE;
-
- if(FAILED(hr))
- {
- return;
- }
- }
-
-
-
- // loop queueing second and waiting for first..
- while(tCurrent < tAlignStop)
- {
-
- hr = QueueSample(tCurrent, tAlignStop, bDiscontinuity);
- bDiscontinuity = FALSE;
-
- if(FAILED(hr))
- {
- return;
- }
-
- hr = CollectAndDeliver(tStart, tStop);
- if(S_OK != hr)
- {
-
- // stop if error, or if downstream filter said
- // to stop.
- return;
- }
- }
-
- if(Actual.cBuffers > 1)
- {
- hr = CollectAndDeliver(tStart, tStop);
- if(FAILED(hr))
- {
- return;
- }
- }
- }
- }
- else
- {
-
- // sync version of above loop
- while(tCurrent < tAlignStop)
- {
-
- // Break out without calling EndOfStream if we're asked to
- // do something different
- if(CheckRequest(&dwRequest))
- {
- return;
- }
-
- IMediaSample* pSample;
-
- hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0);
- if(FAILED(hr))
- {
- OnError(hr);
- return;
- }
-
- LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS);
- if(tStopThis > tAlignStop)
- {
- tStopThis = tAlignStop;
- }
- pSample->SetTime(&tCurrent, &tStopThis);
- tCurrent = tStopThis;
-
- if(bDiscontinuity)
- {
- pSample->SetDiscontinuity(TRUE);
- bDiscontinuity = FALSE;
- }
-
- hr = m_pReader->SyncReadAligned(pSample);
-
- if(FAILED(hr))
- {
- pSample->Release();
- OnError(hr);
- return;
- }
-
- hr = DeliverSample(pSample, tStart, tStop);
- if(hr != S_OK)
- {
- if(FAILED(hr))
- {
- OnError(hr);
- }
- return;
- }
- }
+ if (!m_bSync) {
+
+ // Break out of the loop either if we get to the end or we're asked
+ // to do something else
+ while (tCurrent < tAlignStop) {
+
+ // Break out without calling EndOfStream if we're asked to
+ // do something different
+ if (CheckRequest(&dwRequest)) {
+ return;
+ }
+
+ // queue a first sample
+ if (Actual.cBuffers > 1) {
+
+ hr = QueueSample(tCurrent, tAlignStop, TRUE);
+ bDiscontinuity = FALSE;
+
+ if (FAILED(hr)) {
+ return;
+ }
+ }
+
+
+
+ // loop queueing second and waiting for first..
+ while (tCurrent < tAlignStop) {
+
+ hr = QueueSample(tCurrent, tAlignStop, bDiscontinuity);
+ bDiscontinuity = FALSE;
+
+ if (FAILED(hr)) {
+ return;
+ }
+
+ hr = CollectAndDeliver(tStart, tStop);
+ if (S_OK != hr) {
+
+ // stop if error, or if downstream filter said
+ // to stop.
+ return;
+ }
+ }
+
+ if (Actual.cBuffers > 1) {
+ hr = CollectAndDeliver(tStart, tStop);
+ if (FAILED(hr)) {
+ return;
+ }
+ }
+ }
+ } else {
+
+ // sync version of above loop
+ while (tCurrent < tAlignStop) {
+
+ // Break out without calling EndOfStream if we're asked to
+ // do something different
+ if (CheckRequest(&dwRequest)) {
+ return;
+ }
+
+ IMediaSample* pSample;
+
+ hr = m_pAlloc->GetBuffer(&pSample, NULL, NULL, 0);
+ if (FAILED(hr)) {
+ OnError(hr);
+ return;
+ }
+
+ LONGLONG tStopThis = tCurrent + (pSample->GetSize() * UNITS);
+ if (tStopThis > tAlignStop) {
+ tStopThis = tAlignStop;
+ }
+ pSample->SetTime(&tCurrent, &tStopThis);
+ tCurrent = tStopThis;
+
+ if (bDiscontinuity) {
+ pSample->SetDiscontinuity(TRUE);
+ bDiscontinuity = FALSE;
+ }
+
+ hr = m_pReader->SyncReadAligned(pSample);
+
+ if (FAILED(hr)) {
+ pSample->Release();
+ OnError(hr);
+ return;
+ }
+
+ hr = DeliverSample(pSample, tStart, tStop);
+ if (hr != S_OK) {
+ if (FAILED(hr)) {
+ OnError(hr);
+ }
+ return;
+ }
+ }
}
EndOfStream();
@@ -625,23 +570,19 @@ CPullPin::Process(void)
void
CPullPin::CleanupCancelled(void)
{
- while(1)
- {
- IMediaSample * pSample;
- DWORD_PTR dwUnused;
-
- HRESULT hr = m_pReader->WaitForNext(
- 0, // no wait
- &pSample,
- &dwUnused);
- if(pSample)
- {
- pSample->Release();
- }
- else
- {
- // no more samples
- return;
- }
+ while (1) {
+ IMediaSample * pSample;
+ DWORD_PTR dwUnused;
+
+ HRESULT hr = m_pReader->WaitForNext(
+ 0, // no wait
+ &pSample,
+ &dwUnused);
+ if(pSample) {
+ pSample->Release();
+ } else {
+ // no more samples
+ return;
+ }
}
}
diff --git a/src/filters/BaseClasses/pullpin.h b/src/filters/BaseClasses/pullpin.h
index 502f01e55..03ad40ec9 100644
--- a/src/filters/BaseClasses/pullpin.h
+++ b/src/filters/BaseClasses/pullpin.h
@@ -29,11 +29,10 @@ class CPullPin : public CAMThread
REFERENCE_TIME m_tDuration;
BOOL m_bSync;
- enum ThreadMsg
- {
- TM_Pause, // stop pulling and wait for next message
- TM_Start, // start pulling
- TM_Exit, // stop and exit
+ enum ThreadMsg {
+ TM_Pause, // stop pulling and wait for next message
+ TM_Start, // start pulling
+ TM_Exit, // stop and exit
};
ThreadMsg m_State;
@@ -58,18 +57,18 @@ class CPullPin : public CAMThread
// called from ProcessAsync to queue and collect requests
HRESULT QueueSample(
- __inout REFERENCE_TIME& tCurrent,
- REFERENCE_TIME tAlignStop,
- BOOL bDiscontinuity);
+ __inout REFERENCE_TIME& tCurrent,
+ REFERENCE_TIME tAlignStop,
+ BOOL bDiscontinuity);
HRESULT CollectAndDeliver(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop);
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop);
HRESULT DeliverSample(
- IMediaSample* pSample,
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop);
+ IMediaSample* pSample,
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop);
protected:
IMemAllocator * m_pAlloc;
@@ -95,8 +94,8 @@ public:
// optional IMemAllocator interface is offered as a preferred allocator
// but no error occurs if it can't be met.
virtual HRESULT DecideAllocator(
- IMemAllocator* pAlloc,
- __inout_opt ALLOCATOR_PROPERTIES * pProps);
+ IMemAllocator* pAlloc,
+ __inout_opt ALLOCATOR_PROPERTIES * pProps);
// set start and stop position. if active, will start immediately at
// the new position. Default is 0 to duration
@@ -112,24 +111,21 @@ public:
HRESULT Inactive(void);
// helper functions
- LONGLONG AlignDown(LONGLONG ll, LONG lAlign)
- {
- // aligning downwards is just truncation
- return ll & ~(lAlign - 1);
+ LONGLONG AlignDown(LONGLONG ll, LONG lAlign) {
+ // aligning downwards is just truncation
+ return ll & ~(lAlign-1);
};
- LONGLONG AlignUp(LONGLONG ll, LONG lAlign)
- {
- // align up: round up to next boundary
- return (ll + (lAlign - 1)) & ~(lAlign - 1);
+ LONGLONG AlignUp(LONGLONG ll, LONG lAlign) {
+ // align up: round up to next boundary
+ return (ll + (lAlign -1)) & ~(lAlign -1);
};
// GetReader returns the (addrefed) IAsyncReader interface
// for SyncRead etc
- IAsyncReader* GetReader()
- {
- m_pReader->AddRef();
- return m_pReader;
+ IAsyncReader* GetReader() {
+ m_pReader->AddRef();
+ return m_pReader;
};
// -- pure --
diff --git a/src/filters/BaseClasses/refclock.cpp b/src/filters/BaseClasses/refclock.cpp
index 9a647fb72..814a60f8a 100644
--- a/src/filters/BaseClasses/refclock.cpp
+++ b/src/filters/BaseClasses/refclock.cpp
@@ -25,11 +25,11 @@ STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface(
{
HRESULT hr;
- if(riid == IID_IReferenceClock)
+ if (riid == IID_IReferenceClock)
{
hr = GetInterface((IReferenceClock *) this, ppv);
}
- else if(riid == IID_IReferenceClockTimerControl)
+ else if (riid == IID_IReferenceClockTimerControl)
{
hr = GetInterface((IReferenceClockTimerControl *) this, ppv);
}
@@ -43,49 +43,49 @@ STDMETHODIMP CBaseReferenceClock::NonDelegatingQueryInterface(
CBaseReferenceClock::~CBaseReferenceClock()
{
#ifdef DXMPERF
- PERFLOG_DTOR(L"CBaseReferenceClock", (IReferenceClock *) this);
+ PERFLOG_DTOR( L"CBaseReferenceClock", (IReferenceClock *) this );
#endif // DXMPERF
- if(m_TimerResolution) timeEndPeriod(m_TimerResolution);
+ if (m_TimerResolution) timeEndPeriod(m_TimerResolution);
- if(m_pSchedule)
+ if (m_pSchedule)
{
m_pSchedule->DumpLinkedList();
}
- if(m_hThread)
+ if (m_hThread)
{
m_bAbort = TRUE;
TriggerThread();
- WaitForSingleObject(m_hThread, INFINITE);
- EXECUTE_ASSERT(CloseHandle(m_hThread));
+ WaitForSingleObject( m_hThread, INFINITE );
+ EXECUTE_ASSERT( CloseHandle(m_hThread) );
m_hThread = 0;
- EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent()));
- delete m_pSchedule;
+ EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
+ delete m_pSchedule;
}
}
// A derived class may supply a hThreadEvent if it has its own thread that will take care
// of calling the schedulers Advise method. (Refere to CBaseReferenceClock::AdviseThread()
// to see what such a thread has to do.)
-CBaseReferenceClock::CBaseReferenceClock(__in_opt LPCTSTR pName,
- __inout_opt LPUNKNOWN pUnk,
- __inout HRESULT *phr,
- __inout_opt CAMSchedule * pShed)
- : CUnknown(pName, pUnk)
- , m_rtLastGotTime(0)
- , m_TimerResolution(0)
- , m_bAbort(FALSE)
- , m_pSchedule(pShed ? pShed : new CAMSchedule(CreateEvent(NULL, FALSE, FALSE, NULL)))
- , m_hThread(0)
+CBaseReferenceClock::CBaseReferenceClock( __in_opt LPCTSTR pName,
+ __inout_opt LPUNKNOWN pUnk,
+ __inout HRESULT *phr,
+ __inout_opt CAMSchedule * pShed )
+: CUnknown( pName, pUnk )
+, m_rtLastGotTime(0)
+, m_TimerResolution(0)
+, m_bAbort( FALSE )
+, m_pSchedule( pShed ? pShed : new CAMSchedule(CreateEvent(NULL, FALSE, FALSE, NULL)) )
+, m_hThread(0)
{
#ifdef DXMPERF
- PERFLOG_CTOR(pName ? pName : L"CBaseReferenceClock", (IReferenceClock *) this);
+ PERFLOG_CTOR( pName ? pName : L"CBaseReferenceClock", (IReferenceClock *) this );
#endif // DXMPERF
ASSERT(m_pSchedule);
- if(!m_pSchedule)
+ if (!m_pSchedule)
{
*phr = E_OUTOFMEMORY;
}
@@ -103,11 +103,11 @@ CBaseReferenceClock::CBaseReferenceClock(__in_opt LPCTSTR pName,
m_dwPrevSystemTime = timeGetTime();
m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime;
-#ifdef PERF
- m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime"));
-#endif
+ #ifdef PERF
+ m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime"));
+ #endif
- if(!pShed)
+ if ( !pShed )
{
DWORD ThreadID;
m_hThread = ::CreateThread(NULL, // Security attributes
@@ -117,14 +117,14 @@ CBaseReferenceClock::CBaseReferenceClock(__in_opt LPCTSTR pName,
(DWORD) 0, // Creation flags
&ThreadID); // Thread identifier
- if(m_hThread)
+ if (m_hThread)
{
- SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL);
+ SetThreadPriority( m_hThread, THREAD_PRIORITY_TIME_CRITICAL );
}
else
{
*phr = E_FAIL;
- EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent()));
+ EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
delete m_pSchedule;
m_pSchedule = NULL;
}
@@ -132,7 +132,7 @@ CBaseReferenceClock::CBaseReferenceClock(__in_opt LPCTSTR pName,
}
}
-void CBaseReferenceClock::Restart(IN REFERENCE_TIME rtMinTime)
+void CBaseReferenceClock::Restart (IN REFERENCE_TIME rtMinTime)
{
Lock();
m_rtLastGotTime = rtMinTime ;
@@ -142,12 +142,12 @@ void CBaseReferenceClock::Restart(IN REFERENCE_TIME rtMinTime)
STDMETHODIMP CBaseReferenceClock::GetTime(__out REFERENCE_TIME *pTime)
{
HRESULT hr;
- if(pTime)
+ if (pTime)
{
REFERENCE_TIME rtNow;
Lock();
rtNow = GetPrivateTime();
- if(rtNow > m_rtLastGotTime)
+ if (rtNow > m_rtLastGotTime)
{
m_rtLastGotTime = rtNow;
hr = S_OK;
@@ -158,10 +158,10 @@ STDMETHODIMP CBaseReferenceClock::GetTime(__out REFERENCE_TIME *pTime)
}
*pTime = m_rtLastGotTime;
Unlock();
- MSR_INTEGER(m_idGetSystemTime, LONG((*pTime) / (UNITS / MILLISECONDS)));
+ MSR_INTEGER(m_idGetSystemTime, LONG((*pTime) / (UNITS/MILLISECONDS)) );
#ifdef DXMPERF
- PERFLOG_GETTIME((IReferenceClock *) this, *pTime);
+ PERFLOG_GETTIME( (IReferenceClock *) this, *pTime );
#endif // DXMPERF
}
@@ -182,18 +182,18 @@ STDMETHODIMP CBaseReferenceClock::AdviseTime(
*pdwAdviseCookie = 0;
// Check that the event is not already set
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject(HANDLE(hEvent), 0));
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject(HANDLE(hEvent),0));
HRESULT hr;
const REFERENCE_TIME lRefTime = baseTime + streamTime;
- if(lRefTime <= 0 || lRefTime == MAX_TIME)
+ if ( lRefTime <= 0 || lRefTime == MAX_TIME )
{
hr = E_INVALIDARG;
}
else
{
- *pdwAdviseCookie = m_pSchedule->AddAdvisePacket(lRefTime, 0, HANDLE(hEvent), FALSE);
+ *pdwAdviseCookie = m_pSchedule->AddAdvisePacket( lRefTime, 0, HANDLE(hEvent), FALSE );
hr = *pdwAdviseCookie ? NOERROR : E_OUTOFMEMORY;
}
return hr;
@@ -212,9 +212,9 @@ STDMETHODIMP CBaseReferenceClock::AdvisePeriodic(
*pdwAdviseCookie = 0;
HRESULT hr;
- if(StartTime > 0 && PeriodTime > 0 && StartTime != MAX_TIME)
+ if (StartTime > 0 && PeriodTime > 0 && StartTime != MAX_TIME )
{
- *pdwAdviseCookie = m_pSchedule->AddAdvisePacket(StartTime, PeriodTime, HANDLE(hSemaphore), TRUE);
+ *pdwAdviseCookie = m_pSchedule->AddAdvisePacket( StartTime, PeriodTime, HANDLE(hSemaphore), TRUE );
hr = *pdwAdviseCookie ? NOERROR : E_OUTOFMEMORY;
}
else hr = E_INVALIDARG;
@@ -267,8 +267,7 @@ STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta)
// Just break if passed an improper time delta value
LONGLONG llDelta = TimeDelta > 0 ? TimeDelta : -TimeDelta;
- if(llDelta > UNITS * 1000)
- {
+ if (llDelta > UNITS * 1000) {
DbgLog((LOG_TRACE, 0, TEXT("Bad Time Delta")));
//DebugBreak();
}
@@ -276,12 +275,12 @@ STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta)
// We're going to calculate a "severity" for the time change. Max -1
// min 8. We'll then use this as the debug logging level for a
// debug log message.
- const LONG usDelta = LONG(TimeDelta / 10); // Delta in micro-secs
+ const LONG usDelta = LONG(TimeDelta/10); // Delta in micro-secs
DWORD delta = abs(usDelta); // varying delta
// Severity == 8 - ceil(log<base 8>(abs( micro-secs delta)))
int Severity = 8;
- while(delta > 0)
+ while ( delta > 0 )
{
delta >>= 3; // div 8
Severity--;
@@ -289,16 +288,16 @@ STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta)
// Sev == 0 => > 2 second delta!
DbgLog((LOG_TIMING, Severity < 0 ? 0 : Severity,
- TEXT("Sev %2i: CSystemClock::SetTimeDelta(%8ld us) %lu -> %lu ms."),
- Severity, usDelta, DWORD(ConvertToMilliseconds(m_rtPrivateTime)),
- DWORD(ConvertToMilliseconds(TimeDelta + m_rtPrivateTime))));
+ TEXT("Sev %2i: CSystemClock::SetTimeDelta(%8ld us) %lu -> %lu ms."),
+ Severity, usDelta, DWORD(ConvertToMilliseconds(m_rtPrivateTime)),
+ DWORD(ConvertToMilliseconds(TimeDelta+m_rtPrivateTime)) ));
// Don't want the DbgBreak to fire when running stress on debug-builds.
-#ifdef BREAK_ON_SEVERE_TIME_DELTA
- if(Severity < 0)
- DbgBreakPoint(TEXT("SetTimeDelta > 16 seconds!"),
- TEXT(__FILE__), __LINE__);
-#endif
+ #ifdef BREAK_ON_SEVERE_TIME_DELTA
+ if (Severity < 0)
+ DbgBreakPoint(TEXT("SetTimeDelta > 16 seconds!"),
+ TEXT(__FILE__),__LINE__);
+ #endif
#endif
@@ -311,7 +310,7 @@ STDMETHODIMP CBaseReferenceClock::SetTimeDelta(const REFERENCE_TIME & TimeDelta)
// 0.5 millisecond. If the time goes backwards, the thread will
// wake up "early" (relativly speaking) and will re-evaluate at
// that time.
- if(TimeDelta > 5000 && m_pSchedule->GetAdviseCount() > 0) TriggerThread();
+ if ( TimeDelta > 5000 && m_pSchedule->GetAdviseCount() > 0 ) TriggerThread();
return NOERROR;
}
@@ -332,12 +331,12 @@ HRESULT CBaseReferenceClock::AdviseThread()
// routine and the derived class may not yet be constructed. (This
// thread is created in the base class constructor.)
- while(!m_bAbort)
+ while ( !m_bAbort )
{
// Wait for an interesting event to happen
- DbgLog((LOG_TIMING, 3, TEXT("CBaseRefClock::AdviseThread() Delay: %lu ms"), dwWait));
+ DbgLog((LOG_TIMING, 3, TEXT("CBaseRefClock::AdviseThread() Delay: %lu ms"), dwWait ));
WaitForSingleObject(m_pSchedule->GetEvent(), dwWait);
- if(m_bAbort) break;
+ if (m_bAbort) break;
// There are several reasons why we need to work from the internal
// time, mainly to do with what happens when time goes backwards.
@@ -347,16 +346,16 @@ HRESULT CBaseReferenceClock::AdviseThread()
const REFERENCE_TIME rtNow = GetPrivateTime();
DbgLog((LOG_TIMING, 3,
- TEXT("CBaseRefClock::AdviseThread() Woke at = %lu ms"),
- ConvertToMilliseconds(rtNow)));
+ TEXT("CBaseRefClock::AdviseThread() Woke at = %lu ms"),
+ ConvertToMilliseconds(rtNow) ));
// We must add in a millisecond, since this is the resolution of our
// WaitForSingleObject timer. Failure to do so will cause us to loop
// franticly for (approx) 1 a millisecond.
- m_rtNextAdvise = m_pSchedule->Advise(10000 + rtNow);
+ m_rtNextAdvise = m_pSchedule->Advise( 10000 + rtNow );
LONGLONG llWait = m_rtNextAdvise - rtNow;
- ASSERT(llWait > 0);
+ ASSERT( llWait > 0 );
llWait = ConvertToMilliseconds(llWait);
// DON'T replace this with a max!! (The type's of these things is VERY important)
@@ -366,41 +365,35 @@ HRESULT CBaseReferenceClock::AdviseThread()
}
HRESULT CBaseReferenceClock::SetDefaultTimerResolution(
- REFERENCE_TIME timerResolution // in 100ns
-)
+ REFERENCE_TIME timerResolution // in 100ns
+ )
{
CAutoLock cObjectLock(this);
- if(0 == timerResolution)
- {
- if(m_TimerResolution)
- {
- timeEndPeriod(m_TimerResolution);
- m_TimerResolution = 0;
+ if( 0 == timerResolution ) {
+ if( m_TimerResolution ) {
+ timeEndPeriod( m_TimerResolution );
+ m_TimerResolution = 0;
}
- }
- else
- {
+ } else {
TIMECAPS tc;
DWORD dwMinResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)))
- ? tc.wPeriodMin
- : 1;
- DWORD dwResolution = max(dwMinResolution, DWORD(timerResolution / 10000));
- if(dwResolution != m_TimerResolution)
- {
+ ? tc.wPeriodMin
+ : 1;
+ DWORD dwResolution = max( dwMinResolution, DWORD(timerResolution / 10000) );
+ if( dwResolution != m_TimerResolution ) {
timeEndPeriod(m_TimerResolution);
m_TimerResolution = dwResolution;
- timeBeginPeriod(m_TimerResolution);
+ timeBeginPeriod( m_TimerResolution );
}
}
return S_OK;
}
HRESULT CBaseReferenceClock::GetDefaultTimerResolution(
- __out REFERENCE_TIME* pTimerResolution // in 100ns
-)
+ __out REFERENCE_TIME* pTimerResolution // in 100ns
+ )
{
- if(!pTimerResolution)
- {
+ if( !pTimerResolution ) {
return E_POINTER;
}
CAutoLock cObjectLock(this);
diff --git a/src/filters/BaseClasses/refclock.h b/src/filters/BaseClasses/refclock.h
index 429e96496..bf685fba0 100644
--- a/src/filters/BaseClasses/refclock.h
+++ b/src/filters/BaseClasses/refclock.h
@@ -75,15 +75,15 @@ inline LONGLONG WINAPI ConvertToMilliseconds(const REFERENCE_TIME& RT)
*/
class CBaseReferenceClock
- : public CUnknown, public IReferenceClock, public CCritSec, public IReferenceClockTimerControl
+: public CUnknown, public IReferenceClock, public CCritSec, public IReferenceClockTimerControl
{
protected:
virtual ~CBaseReferenceClock(); // Don't let me be created on the stack!
public:
- CBaseReferenceClock(__in_opt LPCTSTR pName,
- __inout_opt LPUNKNOWN pUnk,
- __inout HRESULT *phr,
- __inout_opt CAMSchedule * pSched = 0);
+ CBaseReferenceClock(__in_opt LPCTSTR pName,
+ __inout_opt LPUNKNOWN pUnk,
+ __inout HRESULT *phr,
+ __inout_opt CAMSchedule * pSched = 0 );
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv);
@@ -137,12 +137,9 @@ public:
virtual REFERENCE_TIME GetPrivateTime();
/* Provide a method for correcting drift */
- STDMETHODIMP SetTimeDelta(const REFERENCE_TIME& TimeDelta);
+ STDMETHODIMP SetTimeDelta( const REFERENCE_TIME& TimeDelta );
- CAMSchedule * GetSchedule() const
- {
- return m_pSchedule;
- }
+ CAMSchedule * GetSchedule() const { return m_pSchedule; }
// IReferenceClockTimerControl methods
//
@@ -168,8 +165,7 @@ private:
// Thread stuff
public:
void TriggerThread() // Wakes thread up. Need to do this if
- {
- // time to next advise needs reevaluating.
+ { // time to next advise needs reevaluating.
EXECUTE_ASSERT(SetEvent(m_pSchedule->GetEvent()));
}
@@ -184,7 +180,7 @@ private:
protected:
CAMSchedule * m_pSchedule;
- void Restart(IN REFERENCE_TIME rtMinTime = 0I64) ;
+ void Restart (IN REFERENCE_TIME rtMinTime = 0I64) ;
};
#endif
diff --git a/src/filters/BaseClasses/renbase.cpp b/src/filters/BaseClasses/renbase.cpp
index 4f4d2505a..c9766baf1 100644
--- a/src/filters/BaseClasses/renbase.cpp
+++ b/src/filters/BaseClasses/renbase.cpp
@@ -17,15 +17,12 @@
// Helper function for clamping time differences
int inline TimeDiff(REFERENCE_TIME rt)
{
- if(rt < - (50 * UNITS))
- {
+ if (rt < - (50 * UNITS)) {
return -(50 * UNITS);
- }
- else if(rt > 50 * UNITS)
- {
+ } else
+ if (rt > 50 * UNITS) {
return 50 * UNITS;
- }
- else return (int)rt;
+ } else return (int)rt;
}
// Implements the CBaseRenderer class
@@ -35,7 +32,7 @@ CBaseRenderer::CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer
__inout_opt LPUNKNOWN pUnk, // Aggregated owner object
__inout HRESULT *phr) : // General OLE return code
- CBaseFilter(pName, pUnk, &m_InterfaceLock, RenderClass),
+ CBaseFilter(pName,pUnk,&m_InterfaceLock,RenderClass),
m_evComplete(TRUE, phr),
m_RenderEvent(FALSE, phr),
m_bAbort(FALSE),
@@ -53,8 +50,7 @@ CBaseRenderer::CBaseRenderer(REFCLSID RenderClass, // CLSID for this renderer
m_bInReceive(FALSE),
m_EndOfStreamTimer(0)
{
- if(SUCCEEDED(*phr))
- {
+ if (SUCCEEDED(*phr)) {
Ready();
#ifdef PERF
m_idBaseStamp = MSR_REGISTER(TEXT("BaseRenderer: sample time stamp"));
@@ -80,16 +76,14 @@ CBaseRenderer::~CBaseRenderer()
// Delete any IMediaPosition implementation
- if(m_pPosition)
- {
+ if (m_pPosition) {
delete m_pPosition;
m_pPosition = NULL;
}
// Delete any input pin created
- if(m_pInputPin)
- {
+ if (m_pInputPin) {
delete m_pInputPin;
m_pInputPin = NULL;
}
@@ -105,14 +99,12 @@ CBaseRenderer::~CBaseRenderer()
HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid, __deref_out void **ppv)
{
CAutoLock cObjectCreationLock(&m_ObjectCreationLock);
- if(m_pPosition)
- {
- return m_pPosition->NonDelegatingQueryInterface(riid, ppv);
+ if (m_pPosition) {
+ return m_pPosition->NonDelegatingQueryInterface(riid,ppv);
}
CBasePin *pPin = GetPin(0);
- if(NULL == pPin)
- {
+ if (NULL == pPin) {
return E_OUTOFMEMORY;
}
@@ -127,18 +119,16 @@ HRESULT CBaseRenderer::GetMediaPositionInterface(REFIID riid, __deref_out void *
CBaseFilter::GetOwner(),
(HRESULT *) &hr,
pPin);
- if(m_pPosition == NULL)
- {
+ if (m_pPosition == NULL) {
return E_OUTOFMEMORY;
}
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
delete m_pPosition;
m_pPosition = NULL;
return E_NOINTERFACE;
}
- return GetMediaPositionInterface(riid, ppv);
+ return GetMediaPositionInterface(riid,ppv);
}
@@ -148,13 +138,10 @@ STDMETHODIMP CBaseRenderer::NonDelegatingQueryInterface(REFIID riid, __deref_out
{
// Do we have this interface
- if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking)
- {
- return GetMediaPositionInterface(riid, ppv);
- }
- else
- {
- return CBaseFilter::NonDelegatingQueryInterface(riid, ppv);
+ if (riid == IID_IMediaPosition || riid == IID_IMediaSeeking) {
+ return GetMediaPositionInterface(riid,ppv);
+ } else {
+ return CBaseFilter::NonDelegatingQueryInterface(riid,ppv);
}
}
@@ -167,12 +154,9 @@ STDMETHODIMP CBaseRenderer::NonDelegatingQueryInterface(REFIID riid, __deref_out
HRESULT CBaseRenderer::SourceThreadCanWait(BOOL bCanWait)
{
- if(bCanWait == TRUE)
- {
+ if (bCanWait == TRUE) {
m_ThreadSignal.Reset();
- }
- else
- {
+ } else {
m_ThreadSignal.Set();
}
return NOERROR;
@@ -193,68 +177,68 @@ void CBaseRenderer::DisplayRendererState()
// No way should this be signalled at this point
BOOL bSignalled = m_ThreadSignal.Check();
- DbgLog((LOG_TIMING, 1, TEXT("Signal sanity check %d"), bSignalled));
+ DbgLog((LOG_TIMING, 1, TEXT("Signal sanity check %d"),bSignalled));
// Now output the current renderer state variables
- DbgLog((LOG_TIMING, 1, TEXT("Filter state %d"), m_State));
+ DbgLog((LOG_TIMING, 1, TEXT("Filter state %d"),m_State));
- DbgLog((LOG_TIMING, 1, TEXT("Abort flag %d"), m_bAbort));
+ DbgLog((LOG_TIMING, 1, TEXT("Abort flag %d"),m_bAbort));
- DbgLog((LOG_TIMING, 1, TEXT("Streaming flag %d"), m_bStreaming));
+ DbgLog((LOG_TIMING, 1, TEXT("Streaming flag %d"),m_bStreaming));
- DbgLog((LOG_TIMING, 1, TEXT("Clock advise link %d"), m_dwAdvise));
+ DbgLog((LOG_TIMING, 1, TEXT("Clock advise link %d"),m_dwAdvise));
- DbgLog((LOG_TIMING, 1, TEXT("Current media sample %x"), m_pMediaSample));
+ DbgLog((LOG_TIMING, 1, TEXT("Current media sample %x"),m_pMediaSample));
- DbgLog((LOG_TIMING, 1, TEXT("EOS signalled %d"), m_bEOS));
+ DbgLog((LOG_TIMING, 1, TEXT("EOS signalled %d"),m_bEOS));
- DbgLog((LOG_TIMING, 1, TEXT("EOS delivered %d"), m_bEOSDelivered));
+ DbgLog((LOG_TIMING, 1, TEXT("EOS delivered %d"),m_bEOSDelivered));
- DbgLog((LOG_TIMING, 1, TEXT("Repaint status %d"), m_bRepaintStatus));
+ DbgLog((LOG_TIMING, 1, TEXT("Repaint status %d"),m_bRepaintStatus));
// Output the delayed end of stream timer information
- DbgLog((LOG_TIMING, 1, TEXT("End of stream timer %x"), m_EndOfStreamTimer));
+ DbgLog((LOG_TIMING, 1, TEXT("End of stream timer %x"),m_EndOfStreamTimer));
- DbgLog((LOG_TIMING, 1, TEXT("Deliver time %s"), CDisp((LONGLONG)m_SignalTime)));
+ DbgLog((LOG_TIMING, 1, TEXT("Deliver time %s"),CDisp((LONGLONG)m_SignalTime)));
// Should never timeout during a flushing state
BOOL bFlushing = m_pInputPin->IsFlushing();
- DbgLog((LOG_TIMING, 1, TEXT("Flushing sanity check %d"), bFlushing));
+ DbgLog((LOG_TIMING, 1, TEXT("Flushing sanity check %d"),bFlushing));
// Display the time we were told to start at
- DbgLog((LOG_TIMING, 1, TEXT("Last run time %s"), CDisp((LONGLONG)m_tStart.m_time)));
+ DbgLog((LOG_TIMING, 1, TEXT("Last run time %s"),CDisp((LONGLONG)m_tStart.m_time)));
// Have we got a reference clock
- if(m_pClock == NULL) return;
+ if (m_pClock == NULL) return;
// Get the current time from the wall clock
- CRefTime CurrentTime, StartTime, EndTime;
+ CRefTime CurrentTime,StartTime,EndTime;
m_pClock->GetTime((REFERENCE_TIME*) &CurrentTime);
CRefTime Offset = CurrentTime - m_tStart;
// Display the current time from the clock
- DbgLog((LOG_TIMING, 1, TEXT("Clock time %s"), CDisp((LONGLONG)CurrentTime.m_time)));
+ DbgLog((LOG_TIMING, 1, TEXT("Clock time %s"),CDisp((LONGLONG)CurrentTime.m_time)));
- DbgLog((LOG_TIMING, 1, TEXT("Time difference %dms"), Offset.Millisecs()));
+ DbgLog((LOG_TIMING, 1, TEXT("Time difference %dms"),Offset.Millisecs()));
// Do we have a sample ready to render
- if(m_pMediaSample == NULL) return;
+ if (m_pMediaSample == NULL) return;
m_pMediaSample->GetTime((REFERENCE_TIME*)&StartTime, (REFERENCE_TIME*)&EndTime);
DbgLog((LOG_TIMING, 1, TEXT("Next sample stream times (Start %d End %d ms)"),
- StartTime.Millisecs(), EndTime.Millisecs()));
+ StartTime.Millisecs(),EndTime.Millisecs()));
// Calculate how long it is until it is due for rendering
CRefTime Wait = (m_tStart + StartTime) - CurrentTime;
- DbgLog((LOG_TIMING, 1, TEXT("Wait required %d ms"), Wait.Millisecs()));
+ DbgLog((LOG_TIMING, 1, TEXT("Wait required %d ms"),Wait.Millisecs()));
}
#endif
@@ -275,12 +259,11 @@ HRESULT CBaseRenderer::WaitForRenderTime()
// Wait for either the time to arrive or for us to be stopped
OnWaitStart();
- while(Result == WAIT_TIMEOUT)
- {
- Result = WaitForMultipleObjects(2, WaitObjects, FALSE, RENDER_TIMEOUT);
+ while (Result == WAIT_TIMEOUT) {
+ Result = WaitForMultipleObjects(2,WaitObjects,FALSE,RENDER_TIMEOUT);
#ifdef _DEBUG
- if(Result == WAIT_TIMEOUT) DisplayRendererState();
+ if (Result == WAIT_TIMEOUT) DisplayRendererState();
#endif
}
@@ -288,8 +271,7 @@ HRESULT CBaseRenderer::WaitForRenderTime()
// We may have been awoken without the timer firing
- if(Result == WAIT_OBJECT_0)
- {
+ if (Result == WAIT_OBJECT_0) {
return VFW_E_STATE_CHANGED;
}
@@ -307,10 +289,8 @@ HRESULT CBaseRenderer::WaitForRenderTime()
// the renderer's Receive processing
void CBaseRenderer::WaitForReceiveToComplete()
{
- for(;;)
- {
- if(!m_bInReceive)
- {
+ for (;;) {
+ if (!m_bInReceive) {
break;
}
@@ -325,8 +305,7 @@ void CBaseRenderer::WaitForReceiveToComplete()
// above just cleared the changebit which will cause some messaging
// calls to block (waitMessage, MsgWaitFor...) now.
// Post a dummy message to set the QS_POSTMESSAGE bit again
- if(HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE)
- {
+ if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE) {
// Send dummy message
PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0);
}
@@ -349,8 +328,7 @@ void CBaseRenderer::WaitForReceiveToComplete()
// Simple internal way of getting the real state
-FILTER_STATE CBaseRenderer::GetRealState()
-{
+FILTER_STATE CBaseRenderer::GetRealState() {
return m_State;
}
@@ -359,12 +337,11 @@ FILTER_STATE CBaseRenderer::GetRealState()
// it has got one media sample to render. If you ask it for its state while
// it's waiting it will return the state along with VFW_S_STATE_INTERMEDIATE
-STDMETHODIMP CBaseRenderer::GetState(DWORD dwMSecs, FILTER_STATE *State)
+STDMETHODIMP CBaseRenderer::GetState(DWORD dwMSecs,FILTER_STATE *State)
{
- CheckPointer(State, E_POINTER);
+ CheckPointer(State,E_POINTER);
- if(WaitDispatchingMessages(m_evComplete, dwMSecs) == WAIT_TIMEOUT)
- {
+ if (WaitDispatchingMessages(m_evComplete, dwMSecs) == WAIT_TIMEOUT) {
*State = m_State;
return VFW_S_STATE_INTERMEDIATE;
}
@@ -384,26 +361,22 @@ HRESULT CBaseRenderer::CompleteStateChange(FILTER_STATE OldState)
{
// Allow us to be paused when disconnected
- if(m_pInputPin->IsConnected() == FALSE)
- {
+ if (m_pInputPin->IsConnected() == FALSE) {
Ready();
return S_OK;
}
// Have we run off the end of stream
- if(IsEndOfStream() == TRUE)
- {
+ if (IsEndOfStream() == TRUE) {
Ready();
return S_OK;
}
// Make sure we get fresh data after being stopped
- if(HaveCurrentSample() == TRUE)
- {
- if(OldState != State_Stopped)
- {
+ if (HaveCurrentSample() == TRUE) {
+ if (OldState != State_Stopped) {
Ready();
return S_OK;
}
@@ -427,15 +400,13 @@ STDMETHODIMP CBaseRenderer::Stop()
// Make sure there really is a state change
- if(m_State == State_Stopped)
- {
+ if (m_State == State_Stopped) {
return NOERROR;
}
// Is our input pin connected
- if(m_pInputPin->IsConnected() == FALSE)
- {
+ if (m_pInputPin->IsConnected() == FALSE) {
NOTE("Input pin is not connected");
m_State = State_Stopped;
return NOERROR;
@@ -447,8 +418,7 @@ STDMETHODIMP CBaseRenderer::Stop()
// allocator we are using it so that any source filter waiting in the
// GetBuffer can be released and unlock themselves for a state change
- if(m_pInputPin->Allocator())
- {
+ if (m_pInputPin->Allocator()) {
m_pInputPin->Allocator()->Decommit();
}
@@ -462,7 +432,7 @@ STDMETHODIMP CBaseRenderer::Stop()
// There should be no outstanding clock advise
ASSERT(CancelNotification() == S_FALSE);
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent, 0));
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0));
ASSERT(m_EndOfStreamTimer == 0);
Ready();
@@ -489,15 +459,13 @@ STDMETHODIMP CBaseRenderer::Pause()
// Make sure there really is a state change
- if(m_State == State_Paused)
- {
+ if (m_State == State_Paused) {
return CompleteStateChange(State_Paused);
}
// Has our input pin been connected
- if(m_pInputPin->IsConnected() == FALSE)
- {
+ if (m_pInputPin->IsConnected() == FALSE) {
NOTE("Input pin is not connected");
m_State = State_Paused;
return CompleteStateChange(State_Paused);
@@ -506,8 +474,7 @@ STDMETHODIMP CBaseRenderer::Pause()
// Pause the base filter class
HRESULT hr = CBaseFilter::Pause();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
NOTE("Pause failed");
return hr;
}
@@ -524,14 +491,13 @@ STDMETHODIMP CBaseRenderer::Pause()
// allocator we are using it so that any source filter can call the
// GetBuffer and expect to get a buffer without returning an error
- if(m_pInputPin->Allocator())
- {
+ if (m_pInputPin->Allocator()) {
m_pInputPin->Allocator()->Commit();
}
// There should be no outstanding advise
ASSERT(CancelNotification() == S_FALSE);
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent, 0));
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0));
ASSERT(m_EndOfStreamTimer == 0);
ASSERT(m_pInputPin->IsFlushing() == FALSE);
@@ -541,8 +507,7 @@ STDMETHODIMP CBaseRenderer::Pause()
// Paused or running after being stopped causes the current position to
// be reset so we're not interested in passing end of stream signals
- if(OldState == State_Stopped)
- {
+ if (OldState == State_Stopped) {
m_bAbort = FALSE;
ClearPendingSample();
}
@@ -566,16 +531,14 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
// Make sure there really is a state change
- if(m_State == State_Running)
- {
+ if (m_State == State_Running) {
return NOERROR;
}
// Send EC_COMPLETE if we're not connected
- if(m_pInputPin->IsConnected() == FALSE)
- {
- NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)this);
+ if (m_pInputPin->IsConnected() == FALSE) {
+ NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this);
m_State = State_Running;
return NOERROR;
}
@@ -585,8 +548,7 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
// Pause the base filter class
HRESULT hr = CBaseFilter::Run(StartTime);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
NOTE("Run failed");
return hr;
}
@@ -598,7 +560,7 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
// There should be no outstanding advise
ASSERT(CancelNotification() == S_FALSE);
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent, 0));
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0));
ASSERT(m_EndOfStreamTimer == 0);
ASSERT(m_pInputPin->IsFlushing() == FALSE);
@@ -606,8 +568,7 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
// allocator we are using it so that any source filter can call the
// GetBuffer and expect to get a buffer without returning an error
- if(m_pInputPin->Allocator())
- {
+ if (m_pInputPin->Allocator()) {
m_pInputPin->Allocator()->Commit();
}
@@ -617,8 +578,7 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
// Paused or running after being stopped causes the current position to
// be reset so we're not interested in passing end of stream signals
- if(OldState == State_Stopped)
- {
+ if (OldState == State_Stopped) {
m_bAbort = FALSE;
ClearPendingSample();
}
@@ -630,8 +590,7 @@ STDMETHODIMP CBaseRenderer::Run(REFERENCE_TIME StartTime)
int CBaseRenderer::GetPinCount()
{
- if(m_pInputPin == NULL)
- {
+ if (m_pInputPin == NULL) {
// Try to create it
(void)GetPin(0);
}
@@ -648,29 +607,25 @@ CBasePin *CBaseRenderer::GetPin(int n)
// Should only ever be called with zero
ASSERT(n == 0);
- if(n != 0)
- {
+ if (n != 0) {
return NULL;
}
// Create the input pin if not already done so
- if(m_pInputPin == NULL)
- {
+ if (m_pInputPin == NULL) {
// hr must be initialized to NOERROR because
// CRendererInputPin's constructor only changes
// hr's value if an error occurs.
HRESULT hr = NOERROR;
- m_pInputPin = new CRendererInputPin(this, &hr, L"In");
- if(NULL == m_pInputPin)
- {
+ m_pInputPin = new CRendererInputPin(this,&hr,L"In");
+ if (NULL == m_pInputPin) {
return NULL;
}
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
delete m_pInputPin;
m_pInputPin = NULL;
return NULL;
@@ -684,22 +639,16 @@ CBasePin *CBaseRenderer::GetPin(int n)
STDMETHODIMP CBaseRenderer::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
{
- CheckPointer(ppPin, E_POINTER);
+ CheckPointer(ppPin,E_POINTER);
- if(0 == lstrcmpW(Id, L"In"))
- {
+ if (0==lstrcmpW(Id,L"In")) {
*ppPin = GetPin(0);
- if(*ppPin)
- {
+ if (*ppPin) {
(*ppPin)->AddRef();
- }
- else
- {
+ } else {
return E_OUTOFMEMORY;
}
- }
- else
- {
+ } else {
*ppPin = NULL;
return VFW_E_NOT_FOUND;
}
@@ -716,16 +665,14 @@ HRESULT CBaseRenderer::EndOfStream()
{
// Ignore these calls if we are stopped
- if(m_State == State_Stopped)
- {
+ if (m_State == State_Stopped) {
return NOERROR;
}
// If we have a sample then wait for it to be rendered
m_bEOS = TRUE;
- if(m_pMediaSample)
- {
+ if (m_pMediaSample) {
return NOERROR;
}
@@ -739,8 +686,7 @@ HRESULT CBaseRenderer::EndOfStream()
// we do run in StartStreaming. This is used when we seek because a seek
// causes a pause where early notification of completion is misleading
- if(m_bStreaming)
- {
+ if (m_bStreaming) {
SendEndOfStream();
}
return NOERROR;
@@ -753,8 +699,7 @@ HRESULT CBaseRenderer::BeginFlush()
{
// If paused then report state intermediate until we get some data
- if(m_State == State_Paused)
- {
+ if (m_State == State_Paused) {
NotReady();
}
@@ -773,7 +718,7 @@ HRESULT CBaseRenderer::BeginFlush()
HRESULT CBaseRenderer::EndFlush()
{
// Reset the current sample media time
- if(m_pPosition) m_pPosition->ResetMediaTime();
+ if (m_pPosition) m_pPosition->ResetMediaTime();
// There should be no outstanding advise
@@ -793,18 +738,14 @@ HRESULT CBaseRenderer::CompleteConnect(IPin *pReceivePin)
m_bAbort = FALSE;
- if(State_Running == GetRealState())
- {
+ if (State_Running == GetRealState()) {
HRESULT hr = StartStreaming();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
SetRepaintStatus(FALSE);
- }
- else
- {
+ } else {
SetRepaintStatus(TRUE);
}
@@ -824,8 +765,7 @@ HRESULT CBaseRenderer::Active()
HRESULT CBaseRenderer::Inactive()
{
- if(m_pPosition)
- {
+ if (m_pPosition) {
m_pPosition->ResetMediaTime();
}
// People who derive from this may want to override this behaviour
@@ -854,22 +794,19 @@ HRESULT CBaseRenderer::BreakConnect()
{
// Do we have a quality management sink
- if(m_pQSink)
- {
+ if (m_pQSink) {
m_pQSink->Release();
m_pQSink = NULL;
}
// Check we have a valid connection
- if(m_pInputPin->IsConnected() == FALSE)
- {
+ if (m_pInputPin->IsConnected() == FALSE) {
return S_FALSE;
}
// Check we are stopped before disconnecting
- if(m_State != State_Stopped && !m_pInputPin->CanReconnectWhenActive())
- {
+ if (m_State != State_Stopped && !m_pInputPin->CanReconnectWhenActive()) {
return VFW_E_NOT_STOPPED;
}
@@ -878,8 +815,7 @@ HRESULT CBaseRenderer::BreakConnect()
ClearPendingSample();
m_bAbort = FALSE;
- if(State_Running == m_State)
- {
+ if (State_Running == m_State) {
StopStreaming();
}
@@ -903,15 +839,11 @@ HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample,
// then just ignore it (release it) and schedule the next one in line
// Source filters should always fill in the start and end times properly!
- if(SUCCEEDED(pMediaSample->GetTime(pStartTime, pEndTime)))
- {
- if(*pEndTime < *pStartTime)
- {
+ if (SUCCEEDED(pMediaSample->GetTime(pStartTime, pEndTime))) {
+ if (*pEndTime < *pStartTime) {
return VFW_E_START_TIME_AFTER_END;
}
- }
- else
- {
+ } else {
// no time set in the sample... draw it now?
return S_OK;
}
@@ -920,11 +852,10 @@ HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample,
// caller that the sample should be rendered immediately without going
// through the overhead of setting a timer advise link with the clock
- if(m_pClock == NULL)
- {
+ if (m_pClock == NULL) {
return S_OK;
}
- return ShouldDrawSampleNow(pMediaSample, pStartTime, pEndTime);
+ return ShouldDrawSampleNow(pMediaSample,pStartTime,pEndTime);
}
@@ -933,8 +864,8 @@ HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample,
// by the derived video renderer class in its quality management.
HRESULT CBaseRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
- __out REFERENCE_TIME *ptrStart,
- __out REFERENCE_TIME *ptrEnd)
+ __out REFERENCE_TIME *ptrStart,
+ __out REFERENCE_TIME *ptrEnd)
{
return S_FALSE;
}
@@ -965,8 +896,7 @@ HRESULT CBaseRenderer::CancelNotification()
// Have we a live advise link
- if(m_dwAdvise)
- {
+ if (m_dwAdvise) {
m_pClock->Unadvise(m_dwAdvise);
SignalTimerFired();
ASSERT(m_dwAdvise == 0);
@@ -990,8 +920,7 @@ BOOL CBaseRenderer::ScheduleSample(IMediaSample *pMediaSample)
// Is someone pulling our leg
- if(pMediaSample == NULL)
- {
+ if (pMediaSample == NULL) {
return FALSE;
}
@@ -1001,8 +930,7 @@ BOOL CBaseRenderer::ScheduleSample(IMediaSample *pMediaSample)
// it returns S_OK other if it's to be done when due it returns S_FALSE
HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return FALSE;
}
@@ -1010,15 +938,14 @@ BOOL CBaseRenderer::ScheduleSample(IMediaSample *pMediaSample)
// time so we simply set the event indicating an image to render. This
// will cause us to run flat out without any timing or synchronisation
- if(hr == S_OK)
- {
+ if (hr == S_OK) {
EXECUTE_ASSERT(SetEvent((HANDLE) m_RenderEvent));
return TRUE;
}
ASSERT(m_dwAdvise == 0);
ASSERT(m_pClock);
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent, 0));
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0));
// We do have a valid reference clock interface so we can ask it to
// set an event when the image comes due for rendering. We pass in
@@ -1026,13 +953,12 @@ BOOL CBaseRenderer::ScheduleSample(IMediaSample *pMediaSample)
// stream time which is the offset from the start reference time
hr = m_pClock->AdviseTime(
- (REFERENCE_TIME) m_tStart, // Start run time
- StartSample, // Stream time
- (HEVENT)(HANDLE) m_RenderEvent, // Render notification
- &m_dwAdvise); // Advise cookie
+ (REFERENCE_TIME) m_tStart, // Start run time
+ StartSample, // Stream time
+ (HEVENT)(HANDLE) m_RenderEvent, // Render notification
+ &m_dwAdvise); // Advise cookie
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
return TRUE;
}
@@ -1056,8 +982,7 @@ HRESULT CBaseRenderer::Render(IMediaSample *pMediaSample)
// clock that another sample is ready but in the mean time someone has
// stopped us streaming which causes the next sample to be released
- if(pMediaSample == NULL)
- {
+ if (pMediaSample == NULL) {
return S_FALSE;
}
@@ -1065,8 +990,7 @@ HRESULT CBaseRenderer::Render(IMediaSample *pMediaSample)
// thread that got in and locked us and then reset this flag does not
// clear the pending sample as we can use it to refresh any output device
- if(m_bStreaming == FALSE)
- {
+ if (m_bStreaming == FALSE) {
return S_FALSE;
}
@@ -1097,8 +1021,7 @@ BOOL CBaseRenderer::HaveCurrentSample()
IMediaSample *CBaseRenderer::GetCurrentSample()
{
CAutoLock cRendererLock(&m_RendererLock);
- if(m_pMediaSample)
- {
+ if (m_pMediaSample) {
m_pMediaSample->AddRef();
}
return m_pMediaSample;
@@ -1120,13 +1043,12 @@ HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample)
// Check our flushing and filter state
- // This function must hold the interface lock because it calls
+ // This function must hold the interface lock because it calls
// CBaseInputPin::Receive() and CBaseInputPin::Receive() uses
// CBasePin::m_bRunTimeError.
HRESULT hr = m_pInputPin->CBaseInputPin::Receive(pMediaSample);
- if(hr != NOERROR)
- {
+ if (hr != NOERROR) {
m_bInReceive = FALSE;
return E_FAIL;
}
@@ -1137,12 +1059,10 @@ HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample)
// have Receive called we can go ahead and change the format
// Since the format change can cause a SendMessage we just don't
// lock
- if(m_pInputPin->SampleProps()->pMediaType)
- {
+ if (m_pInputPin->SampleProps()->pMediaType) {
hr = m_pInputPin->SetMediaType(
- (CMediaType *)m_pInputPin->SampleProps()->pMediaType);
- if(FAILED(hr))
- {
+ (CMediaType *)m_pInputPin->SampleProps()->pMediaType);
+ if (FAILED(hr)) {
m_bInReceive = FALSE;
return hr;
}
@@ -1160,21 +1080,19 @@ HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample)
// source pins must serialise the Receive calls - we also check that
// no data is being sent after the source signalled an end of stream
- if(m_pMediaSample || m_bEOS || m_bAbort)
- {
+ if (m_pMediaSample || m_bEOS || m_bAbort) {
Ready();
m_bInReceive = FALSE;
return E_UNEXPECTED;
}
// Store the media times from this sample
- if(m_pPosition) m_pPosition->RegisterMediaTime(pMediaSample);
+ if (m_pPosition) m_pPosition->RegisterMediaTime(pMediaSample);
// Schedule the next sample if we are streaming
- if((m_bStreaming == TRUE) && (ScheduleSample(pMediaSample) == FALSE))
- {
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent, 0));
+ if ((m_bStreaming == TRUE) && (ScheduleSample(pMediaSample) == FALSE)) {
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0));
ASSERT(CancelNotification() == S_FALSE);
m_bInReceive = FALSE;
return VFW_E_SAMPLE_REJECTED;
@@ -1192,8 +1110,7 @@ HRESULT CBaseRenderer::PrepareReceive(IMediaSample *pMediaSample)
m_pMediaSample = pMediaSample;
m_pMediaSample->AddRef();
- if(m_bStreaming == FALSE)
- {
+ if (m_bStreaming == FALSE) {
SetRepaintStatus(TRUE);
}
return NOERROR;
@@ -1214,10 +1131,8 @@ HRESULT CBaseRenderer::Receive(IMediaSample *pSample)
HRESULT hr = PrepareReceive(pSample);
ASSERT(m_bInReceive == SUCCEEDED(hr));
- if(FAILED(hr))
- {
- if(hr == VFW_E_SAMPLE_REJECTED)
- {
+ if (FAILED(hr)) {
+ if (hr == VFW_E_SAMPLE_REJECTED) {
return NOERROR;
}
return hr;
@@ -1225,15 +1140,14 @@ HRESULT CBaseRenderer::Receive(IMediaSample *pSample)
// We realize the palette in "PrepareRender()" so we have to give away the
// filter lock here.
- if(m_State == State_Paused)
- {
+ if (m_State == State_Paused) {
PrepareRender();
// no need to use InterlockedExchange
m_bInReceive = FALSE;
{
// We must hold both these locks
CAutoLock cRendererLock(&m_InterfaceLock);
- if(m_State == State_Stopped)
+ if (m_State == State_Stopped)
return NOERROR;
m_bInReceive = TRUE;
@@ -1247,8 +1161,7 @@ HRESULT CBaseRenderer::Receive(IMediaSample *pSample)
// will lock the critical section and check we can still render the data
hr = WaitForRenderTime();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
m_bInReceive = FALSE;
return NOERROR;
}
@@ -1266,7 +1179,7 @@ HRESULT CBaseRenderer::Receive(IMediaSample *pSample)
// since we gave away the filter wide lock, the sate of the filter could
// have chnaged to Stopped
- if(m_State == State_Stopped)
+ if (m_State == State_Stopped)
return NOERROR;
CAutoLock cSampleLock(&m_RendererLock);
@@ -1290,8 +1203,7 @@ HRESULT CBaseRenderer::Receive(IMediaSample *pSample)
HRESULT CBaseRenderer::ClearPendingSample()
{
CAutoLock cRendererLock(&m_RendererLock);
- if(m_pMediaSample)
- {
+ if (m_pMediaSample) {
m_pMediaSample->Release();
m_pMediaSample = NULL;
}
@@ -1308,7 +1220,7 @@ void CALLBACK EndOfStreamTimer(UINT uID, // Timer identifier
DWORD_PTR dw2) // is also reserved
{
CBaseRenderer *pRenderer = (CBaseRenderer *) dwUser;
- NOTE1("EndOfStreamTimer called (%d)", uID);
+ NOTE1("EndOfStreamTimer called (%d)",uID);
pRenderer->TimerCallback();
}
@@ -1321,8 +1233,7 @@ void CBaseRenderer::TimerCallback()
// See if we should signal end of stream now
- if(m_EndOfStreamTimer)
- {
+ if (m_EndOfStreamTimer) {
m_EndOfStreamTimer = 0;
SendEndOfStream();
}
@@ -1341,14 +1252,12 @@ void CBaseRenderer::TimerCallback()
HRESULT CBaseRenderer::SendEndOfStream()
{
ASSERT(CritCheckIn(&m_RendererLock));
- if(m_bEOS == FALSE || m_bEOSDelivered || m_EndOfStreamTimer)
- {
+ if (m_bEOS == FALSE || m_bEOSDelivered || m_EndOfStreamTimer) {
return NOERROR;
}
// If there is no clock then signal immediately
- if(m_pClock == NULL)
- {
+ if (m_pClock == NULL) {
return NotifyEndOfStream();
}
@@ -1361,26 +1270,24 @@ HRESULT CBaseRenderer::SendEndOfStream()
// Dump the timing information to the debugger
- NOTE1("Delay until end of stream delivery %d", Delay);
- NOTE1("Current %s", (LPCTSTR)CDisp((LONGLONG)CurrentTime));
- NOTE1("Signal %s", (LPCTSTR)CDisp((LONGLONG)Signal));
+ NOTE1("Delay until end of stream delivery %d",Delay);
+ NOTE1("Current %s",(LPCTSTR)CDisp((LONGLONG)CurrentTime));
+ NOTE1("Signal %s",(LPCTSTR)CDisp((LONGLONG)Signal));
// Wait for the delivery time to arrive
- if(Delay < TIMEOUT_DELIVERYWAIT)
- {
+ if (Delay < TIMEOUT_DELIVERYWAIT) {
return NotifyEndOfStream();
}
// Signal a timer callback on another worker thread
m_EndOfStreamTimer = CompatibleTimeSetEvent((UINT) Delay, // Period of timer
- TIMEOUT_RESOLUTION, // Timer resolution
- EndOfStreamTimer, // Callback function
- DWORD_PTR(this), // Used information
- TIME_ONESHOT); // Type of callback
- if(m_EndOfStreamTimer == 0)
- {
+ TIMEOUT_RESOLUTION, // Timer resolution
+ EndOfStreamTimer, // Callback function
+ DWORD_PTR(this), // Used information
+ TIME_ONESHOT); // Type of callback
+ if (m_EndOfStreamTimer == 0) {
return NotifyEndOfStream();
}
return NOERROR;
@@ -1397,8 +1304,7 @@ HRESULT CBaseRenderer::NotifyEndOfStream()
// Has the filter changed state
- if(m_bStreaming == FALSE)
- {
+ if (m_bStreaming == FALSE) {
ASSERT(m_EndOfStreamTimer == 0);
return NOERROR;
}
@@ -1411,10 +1317,10 @@ HRESULT CBaseRenderer::NotifyEndOfStream()
// that we actually get to the end, even if the MPEG guestimate has
// been bad or if the quality management dropped the last few frames
- if(m_pPosition) m_pPosition->EOS();
+ if (m_pPosition) m_pPosition->EOS();
m_bEOSDelivered = TRUE;
NOTE("Sending EC_COMPLETE...");
- return NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)this);
+ return NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this);
}
@@ -1444,8 +1350,7 @@ HRESULT CBaseRenderer::ResetEndOfStream()
void CBaseRenderer::ResetEndOfStreamTimer()
{
ASSERT(CritCheckOut(&m_RendererLock));
- if(m_EndOfStreamTimer)
- {
+ if (m_EndOfStreamTimer) {
timeKillEvent(m_EndOfStreamTimer);
m_EndOfStreamTimer = 0;
}
@@ -1461,8 +1366,7 @@ void CBaseRenderer::ResetEndOfStreamTimer()
HRESULT CBaseRenderer::StartStreaming()
{
CAutoLock cRendererLock(&m_RendererLock);
- if(m_bStreaming == TRUE)
- {
+ if (m_bStreaming == TRUE) {
return NOERROR;
}
@@ -1474,20 +1378,19 @@ HRESULT CBaseRenderer::StartStreaming()
OnStartStreaming();
// There should be no outstanding advise
- ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent, 0));
+ ASSERT(WAIT_TIMEOUT == WaitForSingleObject((HANDLE)m_RenderEvent,0));
ASSERT(CancelNotification() == S_FALSE);
// If we have an EOS and no data then deliver it now
- if(m_pMediaSample == NULL)
- {
+ if (m_pMediaSample == NULL) {
return SendEndOfStream();
}
// Have the data rendered
ASSERT(m_pMediaSample);
- if(!ScheduleSample(m_pMediaSample))
+ if (!ScheduleSample(m_pMediaSample))
m_RenderEvent.Set();
return NOERROR;
@@ -1504,8 +1407,7 @@ HRESULT CBaseRenderer::StopStreaming()
CAutoLock cRendererLock(&m_RendererLock);
m_bEOSDelivered = FALSE;
- if(m_bStreaming == TRUE)
- {
+ if (m_bStreaming == TRUE) {
m_bStreaming = FALSE;
OnStopStreaming();
timeEndPeriod(1);
@@ -1531,18 +1433,17 @@ void CBaseRenderer::SetRepaintStatus(BOOL bRepaint)
// Pass the window handle to the upstream filter
-void CBaseRenderer::SendNotifyWindow(IPin *pPin, HWND hwnd)
+void CBaseRenderer::SendNotifyWindow(IPin *pPin,HWND hwnd)
{
IMediaEventSink *pSink;
// Does the pin support IMediaEventSink
- HRESULT hr = pPin->QueryInterface(IID_IMediaEventSink, (void **)&pSink);
- if(SUCCEEDED(hr))
- {
- pSink->Notify(EC_NOTIFY_WINDOW, LONG_PTR(hwnd), 0);
+ HRESULT hr = pPin->QueryInterface(IID_IMediaEventSink,(void **)&pSink);
+ if (SUCCEEDED(hr)) {
+ pSink->Notify(EC_NOTIFY_WINDOW,LONG_PTR(hwnd),0);
pSink->Release();
}
- NotifyEvent(EC_NOTIFY_WINDOW, LONG_PTR(hwnd), 0);
+ NotifyEvent(EC_NOTIFY_WINDOW,LONG_PTR(hwnd),0);
}
@@ -1567,18 +1468,13 @@ void CBaseRenderer::SendRepaint()
// - We have aborted a video playback
// - There is a repaint already sent
- if(m_bAbort == FALSE)
- {
- if(m_pInputPin->IsConnected() == TRUE)
- {
- if(m_pInputPin->IsFlushing() == FALSE)
- {
- if(IsEndOfStream() == FALSE)
- {
- if(m_bRepaintStatus == TRUE)
- {
+ if (m_bAbort == FALSE) {
+ if (m_pInputPin->IsConnected() == TRUE) {
+ if (m_pInputPin->IsFlushing() == FALSE) {
+ if (IsEndOfStream() == FALSE) {
+ if (m_bRepaintStatus == TRUE) {
IPin *pPin = (IPin *) m_pInputPin;
- NotifyEvent(EC_REPAINT, (LONG_PTR) pPin, 0);
+ NotifyEvent(EC_REPAINT,(LONG_PTR) pPin,0);
SetRepaintStatus(FALSE);
RLOG("Sending repaint");
}
@@ -1600,8 +1496,7 @@ BOOL CBaseRenderer::OnDisplayChange()
// Ignore if we are not connected yet
CAutoLock cSampleLock(&m_RendererLock);
- if(m_pInputPin->IsConnected() == FALSE)
- {
+ if (m_pInputPin->IsConnected() == FALSE) {
return FALSE;
}
@@ -1611,7 +1506,7 @@ BOOL CBaseRenderer::OnDisplayChange()
IPin *pPin = (IPin *) m_pInputPin;
m_pInputPin->AddRef();
- NotifyEvent(EC_DISPLAY_CHANGED, (LONG_PTR) pPin, 0);
+ NotifyEvent(EC_DISPLAY_CHANGED,(LONG_PTR) pPin,0);
SetAbortSignal(TRUE);
ClearPendingSample();
m_pInputPin->Release();
@@ -1635,11 +1530,11 @@ void CBaseRenderer::OnRenderStart(IMediaSample *pMediaSample)
m_pClock->GetTime(&m_trRenderStart);
MSR_INTEGER(0, (int)m_trRenderStart);
REFERENCE_TIME trStream;
- trStream = m_trRenderStart - m_tStart; // convert reftime to stream time
- MSR_INTEGER(0, (int)trStream);
+ trStream = m_trRenderStart-m_tStart; // convert reftime to stream time
+ MSR_INTEGER(0,(int)trStream);
const int trLate = (int)(trStream - trStart);
- MSR_INTEGER(m_idBaseAccuracy, trLate / 10000); // dump in mSec
+ MSR_INTEGER(m_idBaseAccuracy, trLate/10000); // dump in mSec
#endif
} // OnRenderStart
@@ -1653,8 +1548,8 @@ void CBaseRenderer::OnRenderEnd(IMediaSample *pMediaSample)
#ifdef PERF
REFERENCE_TIME trNow;
m_pClock->GetTime(&trNow);
- MSR_INTEGER(0, (int)trNow);
- int t = (int)((trNow - m_trRenderStart) / 10000); // convert UNITS->msec
+ MSR_INTEGER(0,(int)trNow);
+ int t = (int)((trNow - m_trRenderStart)/10000); // convert UNITS->msec
MSR_INTEGER(m_idBaseRenderTime, t);
#endif
} // OnRenderEnd
@@ -1688,16 +1583,14 @@ STDMETHODIMP CRendererInputPin::EndOfStream()
// Make sure we're streaming ok
HRESULT hr = CheckStreaming();
- if(hr != NOERROR)
- {
+ if (hr != NOERROR) {
return hr;
}
// Pass it onto the renderer
hr = m_pRenderer->EndOfStream();
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = CBaseInputPin::EndOfStream();
}
return hr;
@@ -1730,8 +1623,7 @@ STDMETHODIMP CRendererInputPin::EndFlush()
CAutoLock cSampleLock(&m_pRenderer->m_RendererLock);
HRESULT hr = m_pRenderer->EndFlush();
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = CBaseInputPin::EndFlush();
}
return hr;
@@ -1743,8 +1635,7 @@ STDMETHODIMP CRendererInputPin::EndFlush()
STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample)
{
HRESULT hr = m_pRenderer->Receive(pSample);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
// A deadlock could occur if the caller holds the renderer lock and
// attempts to acquire the interface lock.
@@ -1757,25 +1648,23 @@ STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample)
CAutoLock cRendererLock(&m_pRenderer->m_InterfaceLock);
// We do not report errors which occur while the filter is stopping,
- // flushing or if the m_bAbort flag is set . Errors are expected to
- // occur during these operations and the streaming thread correctly
- // handles the errors.
- if(!IsStopped() && !IsFlushing() && !m_pRenderer->m_bAbort && !m_bRunTimeError)
- {
+ // flushing or if the m_bAbort flag is set . Errors are expected to
+ // occur during these operations and the streaming thread correctly
+ // handles the errors.
+ if (!IsStopped() && !IsFlushing() && !m_pRenderer->m_bAbort && !m_bRunTimeError) {
// EC_ERRORABORT's first parameter is the error which caused
// the event and its' last parameter is 0. See the Direct
// Show SDK documentation for more information.
- m_pRenderer->NotifyEvent(EC_ERRORABORT, hr, 0);
+ m_pRenderer->NotifyEvent(EC_ERRORABORT,hr,0);
{
CAutoLock alRendererLock(&m_pRenderer->m_RendererLock);
- if(m_pRenderer->IsStreaming() && !m_pRenderer->IsEndOfStreamDelivered())
- {
+ if (m_pRenderer->IsStreaming() && !m_pRenderer->IsEndOfStreamDelivered()) {
m_pRenderer->NotifyEndOfStream();
}
}
-
+
m_bRunTimeError = TRUE;
}
}
@@ -1790,8 +1679,7 @@ STDMETHODIMP CRendererInputPin::Receive(IMediaSample *pSample)
HRESULT CRendererInputPin::BreakConnect()
{
HRESULT hr = m_pRenderer->BreakConnect();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return CBaseInputPin::BreakConnect();
@@ -1803,8 +1691,7 @@ HRESULT CRendererInputPin::BreakConnect()
HRESULT CRendererInputPin::CompleteConnect(IPin *pReceivePin)
{
HRESULT hr = m_pRenderer->CompleteConnect(pReceivePin);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return CBaseInputPin::CompleteConnect(pReceivePin);
@@ -1815,13 +1702,12 @@ HRESULT CRendererInputPin::CompleteConnect(IPin *pReceivePin)
STDMETHODIMP CRendererInputPin::QueryId(__deref_out LPWSTR *Id)
{
- CheckPointer(Id, E_POINTER);
+ CheckPointer(Id,E_POINTER);
const WCHAR szIn[] = L"In";
*Id = (LPWSTR)CoTaskMemAlloc(sizeof(szIn));
- if(*Id == NULL)
- {
+ if (*Id == NULL) {
return E_OUTOFMEMORY;
}
CopyMemory(*Id, szIn, sizeof(szIn));
@@ -1849,7 +1735,7 @@ HRESULT CRendererInputPin::Active()
HRESULT CRendererInputPin::Inactive()
{
- // The caller must hold the interface lock because
+ // The caller must hold the interface lock because
// this function uses m_bRunTimeError.
ASSERT(CritCheckIn(&m_pRenderer->m_InterfaceLock));
@@ -1864,8 +1750,7 @@ HRESULT CRendererInputPin::Inactive()
HRESULT CRendererInputPin::SetMediaType(const CMediaType *pmt)
{
HRESULT hr = CBaseInputPin::SetMediaType(pmt);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return m_pRenderer->SetMediaType(pmt);
@@ -1883,12 +1768,12 @@ const TCHAR AMQUALITY[] = TEXT("ActiveMovie");
const TCHAR DRAWLATEFRAMES[] = TEXT("DrawLateFrames");
CBaseVideoRenderer::CBaseVideoRenderer(
- REFCLSID RenderClass, // CLSID for this renderer
- __in_opt LPCTSTR pName, // Debug ONLY description
- __inout_opt LPUNKNOWN pUnk, // Aggregated owner object
- __inout HRESULT *phr) : // General OLE return code
+ REFCLSID RenderClass, // CLSID for this renderer
+ __in_opt LPCTSTR pName, // Debug ONLY description
+ __inout_opt LPUNKNOWN pUnk, // Aggregated owner object
+ __inout HRESULT *phr) : // General OLE return code
- CBaseRenderer(RenderClass, pName, pUnk, phr),
+ CBaseRenderer(RenderClass,pName,pUnk,phr),
m_cFramesDropped(0),
m_cFramesDrawn(0),
m_bSupplierHandlingQuality(FALSE)
@@ -1999,7 +1884,7 @@ HRESULT CBaseVideoRenderer::OnStartStreaming()
HRESULT CBaseVideoRenderer::OnStopStreaming()
{
- m_tStreamingStart = timeGetTime() - m_tStreamingStart;
+ m_tStreamingStart = timeGetTime()-m_tStreamingStart;
return NOERROR;
} // OnStopStreaming
@@ -2034,21 +1919,18 @@ void CBaseVideoRenderer::OnWaitEnd()
// We will be discarding overflows like mad here!
// This is wrong really because timeGetTime() can wrap but it's
// only for PERF
- REFERENCE_TIME tr = timeGetTime() * 10000;
+ REFERENCE_TIME tr = timeGetTime()*10000;
trRealStream = tr + m_llTimeOffset;
#endif
trRealStream -= m_tStart; // convert to stream time (this is a reftime)
- if(m_trRememberStampForPerf == 0)
- {
+ if (m_trRememberStampForPerf==0) {
// This is probably the poster frame at the start, and it is not scheduled
// in the usual way at all. Just count it. The rememberstamp gets set
// in ShouldDrawSampleNow, so this does invalid frame recording until we
// actually start playing.
PreparePerformanceData(0, 0);
- }
- else
- {
+ } else {
int trLate = (int)(trRealStream - m_trRememberStampForPerf);
int trFrame = (int)(tr - m_trRememberFrameForPerf);
PreparePerformanceData(trLate, trFrame);
@@ -2083,52 +1965,44 @@ void CBaseVideoRenderer::PreparePerformanceData(int trLate, int trFrame)
void CBaseVideoRenderer::RecordFrameLateness(int trLate, int trFrame)
{
// Record how timely we are.
- int tLate = trLate / 10000;
+ int tLate = trLate/10000;
// Best estimate of moment of appearing on the screen is average of
// start and end draw times. Here we have only the end time. This may
// tend to show us as spuriously late by up to 1/2 frame rate achieved.
// Decoder probably monitors draw time. We don't bother.
- MSR_INTEGER(m_idFrameAccuracy, tLate);
+ MSR_INTEGER( m_idFrameAccuracy, tLate );
// This is a kludge - we can get frames that are very late
// especially (at start-up) and they invalidate the statistics.
// So ignore things that are more than 1 sec off.
- if(tLate > 1000 || tLate < -1000)
- {
- if(m_cFramesDrawn <= 1)
- {
+ if (tLate>1000 || tLate<-1000) {
+ if (m_cFramesDrawn<=1) {
tLate = 0;
- }
- else if(tLate > 0)
- {
+ } else if (tLate>0) {
tLate = 1000;
- }
- else
- {
+ } else {
tLate = -1000;
}
}
// The very first frame often has a invalid time, so don't
// count it into the statistics. (???)
- if(m_cFramesDrawn > 1)
- {
+ if (m_cFramesDrawn>1) {
m_iTotAcc += tLate;
- m_iSumSqAcc += (tLate * tLate);
+ m_iSumSqAcc += (tLate*tLate);
}
// calculate inter-frame time. Doesn't make sense for first frame
// second frame suffers from invalid first frame stamp.
- if(m_cFramesDrawn > 2)
- {
- int tFrame = trFrame / 10000; // convert to mSec else it overflows
+ if (m_cFramesDrawn>2) {
+ int tFrame = trFrame/10000; // convert to mSec else it overflows
// This is a kludge. It can overflow anyway (a pause can cause
// a very long inter-frame time) and it overflows at 2**31/10**7
// or about 215 seconds i.e. 3min 35sec
- if(tFrame > 1000 || tFrame < 0) tFrame = 1000;
- m_iSumSqFrameTime += tFrame * tFrame;
- ASSERT(m_iSumSqFrameTime >= 0);
+ if (tFrame>1000||tFrame<0) tFrame = 1000;
+ m_iSumSqFrameTime += tFrame*tFrame;
+ ASSERT(m_iSumSqFrameTime>=0);
m_iSumFrameTime += tFrame;
}
++m_cFramesDrawn;
@@ -2138,15 +2012,12 @@ void CBaseVideoRenderer::RecordFrameLateness(int trLate, int trFrame)
void CBaseVideoRenderer::ThrottleWait()
{
- if(m_trThrottle > 0)
- {
- int iThrottle = m_trThrottle / 10000; // convert to mSec
- MSR_INTEGER(m_idThrottle, iThrottle);
+ if (m_trThrottle>0) {
+ int iThrottle = m_trThrottle/10000; // convert to mSec
+ MSR_INTEGER( m_idThrottle, iThrottle);
DbgLog((LOG_TRACE, 0, TEXT("Throttle %d ms"), iThrottle));
Sleep(iThrottle);
- }
- else
- {
+ } else {
Sleep(0);
}
} // ThrottleWait
@@ -2163,8 +2034,8 @@ void CBaseVideoRenderer::OnDirectRender(IMediaSample *pMediaSample)
{
m_trRenderAvg = 0;
m_trRenderLast = 5000000; // If we mode switch, we do NOT want this
- // to inhibit the new average getting going!
- // so we set it to half a second
+ // to inhibit the new average getting going!
+ // so we set it to half a second
// MSR_INTEGER(m_idRenderAvg, m_trRenderAvg/10000);
RecordFrameLateness(m_trLate, m_trFrame);
ThrottleWait();
@@ -2194,18 +2065,17 @@ void CBaseVideoRenderer::OnRenderEnd(IMediaSample *pMediaSample)
// some smoothing to help get more sensible figures out but even that is
// not enough as figures can go 9,10,9,9,83,9 and we must disregard 83
- int tr = (timeGetTime() - m_tRenderStart) * 10000; // convert mSec->UNITS
- if(tr < m_trRenderAvg * 2 || tr < 2 * m_trRenderLast)
- {
+ int tr = (timeGetTime() - m_tRenderStart)*10000; // convert mSec->UNITS
+ if (tr < m_trRenderAvg*2 || tr < 2 * m_trRenderLast) {
// DO_MOVING_AVG(m_trRenderAvg, tr);
- m_trRenderAvg = (tr + (AVGPERIOD - 1) * m_trRenderAvg) / AVGPERIOD;
+ m_trRenderAvg = (tr + (AVGPERIOD-1)*m_trRenderAvg)/AVGPERIOD;
}
m_trRenderLast = tr;
ThrottleWait();
} // OnRenderEnd
-STDMETHODIMP CBaseVideoRenderer::SetSink(IQualityControl * piqc)
+STDMETHODIMP CBaseVideoRenderer::SetSink( IQualityControl * piqc)
{
m_pQSink = piqc;
@@ -2214,7 +2084,7 @@ STDMETHODIMP CBaseVideoRenderer::SetSink(IQualityControl * piqc)
} // SetSink
-STDMETHODIMP CBaseVideoRenderer::Notify(IBaseFilter * pSelf, Quality q)
+STDMETHODIMP CBaseVideoRenderer::Notify( IBaseFilter * pSelf, Quality q)
{
// NOTE: We are NOT getting any locks here. We could be called
// asynchronously and possibly even on a time critical thread of
@@ -2251,15 +2121,11 @@ STDMETHODIMP CBaseVideoRenderer::Notify(IBaseFilter * pSelf, Quality q)
// P60-ish machine). The easy way to get these coefficients is to use
// Renbase.xls follow the instructions therein using excel solver.
- if(q.Proportion >= 1000)
- {
- m_trThrottle = 0;
- }
- else
- {
+ if (q.Proportion>=1000) { m_trThrottle = 0; }
+ else {
// The DWORD is to make quite sure I get unsigned arithmetic
// as the constant is between 2**31 and 2**32
- m_trThrottle = -330000 + (388880000 / (q.Proportion + 167));
+ m_trThrottle = -330000 + (388880000/(q.Proportion+167));
}
return NOERROR;
} // Notify
@@ -2321,64 +2187,47 @@ HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate,
q.TimeStamp = (REFERENCE_TIME)trRealStream;
- if(m_trFrameAvg < 0)
- {
+ if (m_trFrameAvg<0) {
q.Type = Famine; // guess
}
// Is the greater part of the time taken bltting or something else
- else if(m_trFrameAvg > 2 * m_trRenderAvg)
- {
+ else if (m_trFrameAvg > 2*m_trRenderAvg) {
q.Type = Famine; // mainly other
- }
- else
- {
+ } else {
q.Type = Flood; // mainly bltting
}
q.Proportion = 1000; // default
- if(m_trFrameAvg < 0)
- {
+ if (m_trFrameAvg<0) {
// leave it alone - we don't know enough
}
- else if(trLate > 0)
- {
+ else if ( trLate> 0 ) {
// try to catch up over the next second
// We could be Really, REALLY late, but rendering all the frames
// anyway, just because it's so cheap.
- q.Proportion = 1000 - (int)((trLate) / (UNITS / 1000));
- if(q.Proportion < 500)
- {
- q.Proportion = 500; // don't go daft. (could've been negative!)
- }
- else
- {
+ q.Proportion = 1000 - (int)((trLate)/(UNITS/1000));
+ if (q.Proportion<500) {
+ q.Proportion = 500; // don't go daft. (could've been negative!)
+ } else {
}
- }
- else if(m_trWaitAvg > 20000
- && trLate < -20000
- )
- {
+ } else if ( m_trWaitAvg>20000
+ && trLate<-20000
+ ){
// Go cautiously faster - aim at 2mSec wait.
- if(m_trWaitAvg >= m_trFrameAvg)
- {
+ if (m_trWaitAvg>=m_trFrameAvg) {
// This can happen because of some fudges.
// The waitAvg is how long we originally planned to wait
// The frameAvg is more honest.
// It means that we are spending a LOT of time waiting
q.Proportion = 2000; // double.
- }
- else
- {
- if(m_trFrameAvg + 20000 > m_trWaitAvg)
- {
+ } else {
+ if (m_trFrameAvg+20000 > m_trWaitAvg) {
q.Proportion
- = 1000 * (m_trFrameAvg / (m_trFrameAvg + 20000 - m_trWaitAvg));
- }
- else
- {
+ = 1000 * (m_trFrameAvg / (m_trFrameAvg + 20000 - m_trWaitAvg));
+ } else {
// We're apparently spending more than the whole frame time waiting.
// Assume that the averages are slightly out of kilter, but that we
// are indeed doing a lot of waiting. (This leg probably never
@@ -2387,8 +2236,7 @@ HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate,
}
}
- if(q.Proportion > 2000)
- {
+ if (q.Proportion>2000) {
q.Proportion = 2000; // don't go crazy.
}
}
@@ -2406,16 +2254,15 @@ HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate,
// to be the same. We don't, we expect the average to be a better shot.
// In direct draw mode the RenderAvg will be zero.
- q.Late = trLate + m_trRenderAvg / 2;
+ q.Late = trLate + m_trRenderAvg/2;
// log what we're doing
MSR_INTEGER(m_idQualityRate, q.Proportion);
- MSR_INTEGER(m_idQualityTime, (int)q.Late / 10000);
+ MSR_INTEGER( m_idQualityTime, (int)q.Late / 10000 );
// A specific sink interface may be set through IPin
- if(m_pQSink == NULL)
- {
+ if (m_pQSink==NULL) {
// Get our input pin's peer. We send quality management messages
// to any nominated receiver of these things (set in the IPin
// interface), or else to our source filter.
@@ -2426,15 +2273,13 @@ HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate,
// And get an AddRef'd quality control interface
- hr = pOutputPin->QueryInterface(IID_IQualityControl, (void**) &pQC);
- if(SUCCEEDED(hr))
- {
+ hr = pOutputPin->QueryInterface(IID_IQualityControl,(void**) &pQC);
+ if (SUCCEEDED(hr)) {
m_pQSink = pQC;
}
}
- if(m_pQSink)
- {
- return m_pQSink->Notify(this, q);
+ if (m_pQSink) {
+ return m_pQSink->Notify(this,q);
}
return S_FALSE;
@@ -2453,14 +2298,14 @@ HRESULT CBaseVideoRenderer::SendQuality(REFERENCE_TIME trLate,
// to make the decision
HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
- __inout REFERENCE_TIME *ptrStart,
- __inout REFERENCE_TIME *ptrEnd)
+ __inout REFERENCE_TIME *ptrStart,
+ __inout REFERENCE_TIME *ptrEnd)
{
// Don't call us unless there's a clock interface to synchronise with
ASSERT(m_pClock);
- MSR_INTEGER(m_idTimeStamp, (int)((*ptrStart) >> 32)); // high order 32 bits
+ MSR_INTEGER(m_idTimeStamp, (int)((*ptrStart)>>32)); // high order 32 bits
MSR_INTEGER(m_idTimeStamp, (int)(*ptrStart)); // low order 32 bits
// We lose a bit of time depending on the monitor type waiting for the next
@@ -2468,8 +2313,7 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// later than we think when the picture appears. To compensate a bit
// we bias the media samples by -8mSec i.e. 80000 UNITs.
// We don't ever make a stream time negative (call it paranoia)
- if(*ptrStart >= 80000)
- {
+ if (*ptrStart>=80000) {
*ptrStart -= 80000;
*ptrEnd -= 80000; // bias stop to to retain valid frame duration
}
@@ -2486,7 +2330,7 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// Remember the offset from timeGetTime and use that.
// This overflows all over the place, but when we subtract to get
// differences the overflows all cancel out.
- m_llTimeOffset = trRealStream - timeGetTime() * 10000;
+ m_llTimeOffset = trRealStream-timeGetTime()*10000;
#endif
trRealStream -= m_tStart; // convert to stream time (this is a reftime)
@@ -2500,12 +2344,12 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
const int trTrueLate = TimeDiff(trRealStream - *ptrStart);
const int trLate = trTrueLate;
- MSR_INTEGER(m_idSchLateTime, trTrueLate / 10000);
+ MSR_INTEGER(m_idSchLateTime, trTrueLate/10000);
// Send quality control messages upstream, measured against target
HRESULT hr = SendQuality(trLate, trRealStream);
// Note: the filter upstream is allowed to this FAIL meaning "you do it".
- m_bSupplierHandlingQuality = (hr == S_OK);
+ m_bSupplierHandlingQuality = (hr==S_OK);
// Decision time! Do we drop, draw when ready or draw immediately?
@@ -2516,11 +2360,10 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// frame rate inefficent. Hang on a moment though. I've seen files
// where the frames vary between 33 and 34 mSec so as to average
// 30fps. A minor variation like that won't hurt us.
- int t = m_trDuration / 32;
- if(trDuration > m_trDuration + t
- || trDuration < m_trDuration - t
- )
- {
+ int t = m_trDuration/32;
+ if ( trDuration > m_trDuration+t
+ || trDuration < m_trDuration-t
+ ) {
// There's a major variation. Reset the average frame rate to
// exactly the current rate to disable decision 9002 for this frame,
// and remember the new rate.
@@ -2529,15 +2372,14 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
}
}
- MSR_INTEGER(m_idEarliness, m_trEarliness / 10000);
- MSR_INTEGER(m_idRenderAvg, m_trRenderAvg / 10000);
- MSR_INTEGER(m_idFrameAvg, m_trFrameAvg / 10000);
- MSR_INTEGER(m_idWaitAvg, m_trWaitAvg / 10000);
- MSR_INTEGER(m_idDuration, trDuration / 10000);
+ MSR_INTEGER(m_idEarliness, m_trEarliness/10000);
+ MSR_INTEGER(m_idRenderAvg, m_trRenderAvg/10000);
+ MSR_INTEGER(m_idFrameAvg, m_trFrameAvg/10000);
+ MSR_INTEGER(m_idWaitAvg, m_trWaitAvg/10000);
+ MSR_INTEGER(m_idDuration, trDuration/10000);
#ifdef PERF
- if(S_OK == pMediaSample->IsDiscontinuity())
- {
+ if (S_OK==pMediaSample->IsDiscontinuity()) {
MSR_INTEGER(m_idDecision, 9000);
}
#endif
@@ -2548,26 +2390,21 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// otherwise do the standard slide (reduce by about 12% per frame).
// Note: earliness is normally NEGATIVE
BOOL bJustDroppedFrame
- = (m_bSupplierHandlingQuality
- // Can't use the pin sample properties because we might
- // not be in Receive when we call this
- && (S_OK == pMediaSample->IsDiscontinuity()) // he just dropped one
- )
- || (m_nNormal == -1); // we just dropped one
+ = ( m_bSupplierHandlingQuality
+ // Can't use the pin sample properties because we might
+ // not be in Receive when we call this
+ && (S_OK == pMediaSample->IsDiscontinuity()) // he just dropped one
+ )
+ || (m_nNormal==-1); // we just dropped one
// Set m_trEarliness (slide back from slow to fast machine mode)
- if(trLate > 0)
- {
+ if (trLate>0) {
m_trEarliness = 0; // we are no longer in fast machine mode at all!
- }
- else if((trLate >= m_trEarliness) || bJustDroppedFrame)
- {
+ } else if ( (trLate>=m_trEarliness) || bJustDroppedFrame) {
m_trEarliness = trLate; // Things have slipped of their own accord
- }
- else
- {
- m_trEarliness = m_trEarliness - m_trEarliness / 8; // graceful slide
+ } else {
+ m_trEarliness = m_trEarliness - m_trEarliness/8; // graceful slide
}
// prepare the new wait average - but don't pollute the old one until
@@ -2576,46 +2413,44 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
{
// We never mix in a negative wait. This causes us to believe in fast machines
// slightly more.
- int trL = trLate < 0 ? -trLate : 0;
- trWaitAvg = (trL + m_trWaitAvg * (AVGPERIOD - 1)) / AVGPERIOD;
+ int trL = trLate<0 ? -trLate : 0;
+ trWaitAvg = (trL + m_trWaitAvg*(AVGPERIOD-1))/AVGPERIOD;
}
int trFrame;
{
REFERENCE_TIME tr = trRealStream - m_trLastDraw; // Cd be large - 4 min pause!
- if(tr > 10000000)
- {
+ if (tr>10000000) {
tr = 10000000; // 1 second - arbitrarily.
}
trFrame = int(tr);
}
// We will DRAW this frame IF...
- if(
- // ...the time we are spending drawing is a small fraction of the total
- // observed inter-frame time so that dropping it won't help much.
- (3 * m_trRenderAvg <= m_trFrameAvg)
-
- // ...or our supplier is NOT handling things and the next frame would
- // be less timely than this one or our supplier CLAIMS to be handling
- // things, and is now less than a full FOUR frames late.
- || (m_bSupplierHandlingQuality
- ? (trLate <= trDuration * 4)
- : (trLate + trLate < trDuration)
- )
-
- // ...or we are on average waiting for over eight milliseconds then
- // this may be just a glitch. Draw it and we'll hope to catch up.
- || (m_trWaitAvg > 80000)
-
- // ...or we haven't drawn an image for over a second. We will update
- // the display, which stops the video looking hung.
- // Do this regardless of how late this media sample is.
- || ((trRealStream - m_trLastDraw) > UNITS)
-
- )
- {
+ if (
+ // ...the time we are spending drawing is a small fraction of the total
+ // observed inter-frame time so that dropping it won't help much.
+ (3*m_trRenderAvg <= m_trFrameAvg)
+
+ // ...or our supplier is NOT handling things and the next frame would
+ // be less timely than this one or our supplier CLAIMS to be handling
+ // things, and is now less than a full FOUR frames late.
+ || ( m_bSupplierHandlingQuality
+ ? (trLate <= trDuration*4)
+ : (trLate+trLate < trDuration)
+ )
+
+ // ...or we are on average waiting for over eight milliseconds then
+ // this may be just a glitch. Draw it and we'll hope to catch up.
+ || (m_trWaitAvg > 80000)
+
+ // ...or we haven't drawn an image for over a second. We will update
+ // the display, which stops the video looking hung.
+ // Do this regardless of how late this media sample is.
+ || ((trRealStream - m_trLastDraw) > UNITS)
+
+ ) {
HRESULT Result;
// We are going to play this frame. We may want to play it early.
@@ -2628,33 +2463,30 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// we will play it AT ONCE (slow machine mode) if...
- // ...we are playing catch-up
- if(bJustDroppedFrame)
- {
+ // ...we are playing catch-up
+ if ( bJustDroppedFrame) {
bPlayASAP = TRUE;
MSR_INTEGER(m_idDecision, 9001);
}
- // ...or if we are running below the true frame rate
- // exact comparisons are glitchy, for these measurements,
- // so add an extra 5% or so
- else if((m_trFrameAvg > trDuration + trDuration / 16)
+ // ...or if we are running below the true frame rate
+ // exact comparisons are glitchy, for these measurements,
+ // so add an extra 5% or so
+ else if ( (m_trFrameAvg > trDuration + trDuration/16)
- // It's possible to get into a state where we are losing ground, but
- // are a very long way ahead. To avoid this or recover from it
- // we refuse to play early by more than 10 frames.
- && (trLate > - trDuration * 10)
- )
- {
+ // It's possible to get into a state where we are losing ground, but
+ // are a very long way ahead. To avoid this or recover from it
+ // we refuse to play early by more than 10 frames.
+ && (trLate > - trDuration*10)
+ ){
bPlayASAP = TRUE;
MSR_INTEGER(m_idDecision, 9002);
}
#if 0
- // ...or if we have been late and are less than one frame early
- else if((trLate + trDuration > 0)
- && (m_trWaitAvg <= 20000)
- )
- {
+ // ...or if we have been late and are less than one frame early
+ else if ( (trLate + trDuration > 0)
+ && (m_trWaitAvg<=20000)
+ ) {
bPlayASAP = TRUE;
MSR_INTEGER(m_idDecision, 9003);
}
@@ -2663,13 +2495,11 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// rate movies - e.g. clock.avi - it is not a good idea to leap ahead just
// because we got starved (for instance by the net) and dropped one frame
// some time or other. If we are more than 900mSec early, then wait.
- if(trLate < -9000000)
- {
+ if (trLate<-9000000) {
bPlayASAP = FALSE;
}
- if(bPlayASAP)
- {
+ if (bPlayASAP) {
m_nNormal = 0;
MSR_INTEGER(m_idDecision, 0);
@@ -2678,10 +2508,10 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
// dropping frames to keep sync. We should not let that mislead
// us into thinking that we have as much as zero spare time!
// We just update with a zero wait.
- m_trWaitAvg = (m_trWaitAvg * (AVGPERIOD - 1)) / AVGPERIOD;
+ m_trWaitAvg = (m_trWaitAvg*(AVGPERIOD-1))/AVGPERIOD;
// Assume that we draw it immediately. Update inter-frame stats
- m_trFrameAvg = (trFrame + m_trFrameAvg * (AVGPERIOD - 1)) / AVGPERIOD;
+ m_trFrameAvg = (trFrame + m_trFrameAvg*(AVGPERIOD-1))/AVGPERIOD;
#ifndef PERF
// If this is NOT a perf build, then report what we know so far
// without looking at the clock any more. This assumes that we
@@ -2692,15 +2522,12 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
PreparePerformanceData(trTrueLate, trFrame);
#endif
m_trLastDraw = trRealStream;
- if(m_trEarliness > trLate)
- {
+ if (m_trEarliness > trLate) {
m_trEarliness = trLate; // if we are actually early, this is neg
}
Result = S_OK; // Draw it now
- }
- else
- {
+ } else {
++m_nNormal;
// Set the average frame rate to EXACTLY the ideal rate.
// If we are exiting slow-machine mode then we will have caught up
@@ -2715,39 +2542,32 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
{
int trE = m_trEarliness;
- if(trE < -m_trFrameAvg)
- {
+ if (trE < -m_trFrameAvg) {
trE = -m_trFrameAvg;
}
*ptrStart += trE; // N.B. earliness is negative
}
int Delay = -trTrueLate;
- Result = Delay <= 0 ? S_OK : S_FALSE; // OK = draw now, FALSE = wait
+ Result = Delay<=0 ? S_OK : S_FALSE; // OK = draw now, FALSE = wait
m_trWaitAvg = trWaitAvg;
// Predict when it will actually be drawn and update frame stats
- if(Result == S_FALSE) // We are going to wait
- {
- trFrame = TimeDiff(*ptrStart - m_trLastDraw);
+ if (Result==S_FALSE) { // We are going to wait
+ trFrame = TimeDiff(*ptrStart-m_trLastDraw);
m_trLastDraw = *ptrStart;
- }
- else
- {
+ } else {
// trFrame is already = trRealStream-m_trLastDraw;
m_trLastDraw = trRealStream;
}
#ifndef PERF
int iAccuracy;
- if(Delay > 0)
- {
+ if (Delay>0) {
// Report lateness based on when we intend to play it
- iAccuracy = TimeDiff(*ptrStart - m_trRememberStampForPerf);
- }
- else
- {
+ iAccuracy = TimeDiff(*ptrStart-m_trRememberStampForPerf);
+ } else {
// Report lateness based on playing it *now*.
iAccuracy = trTrueLate; // trRealStream-RememberStampForPerf;
}
@@ -2765,9 +2585,8 @@ HRESULT CBaseVideoRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample,
#ifdef PERF
// Respect registry setting - debug only!
- if(m_bDrawLateFrames)
- {
- return S_OK; // draw it when it's ready
+ if (m_bDrawLateFrames) {
+ return S_OK; // draw it when it's ready
} // even though it's late.
#endif
@@ -2795,10 +2614,9 @@ BOOL CBaseVideoRenderer::ScheduleSample(IMediaSample *pMediaSample)
// We override ShouldDrawSampleNow to add quality management
BOOL bDrawImage = CBaseRenderer::ScheduleSample(pMediaSample);
- if(bDrawImage == FALSE)
- {
- ++m_cFramesDropped;
- return FALSE;
+ if (bDrawImage == FALSE) {
+ ++m_cFramesDropped;
+ return FALSE;
}
// m_cFramesDrawn must NOT be updated here. It has to be updated
@@ -2818,7 +2636,7 @@ BOOL CBaseVideoRenderer::ScheduleSample(IMediaSample *pMediaSample)
STDMETHODIMP CBaseVideoRenderer::get_FramesDroppedInRenderer(__out int *pcFramesDropped)
{
- CheckPointer(pcFramesDropped, E_POINTER);
+ CheckPointer(pcFramesDropped,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
*pcFramesDropped = m_cFramesDropped;
return NOERROR;
@@ -2828,9 +2646,9 @@ STDMETHODIMP CBaseVideoRenderer::get_FramesDroppedInRenderer(__out int *pcFrames
// Set *pcFramesDrawn to the number of frames drawn since
// streaming started.
-STDMETHODIMP CBaseVideoRenderer::get_FramesDrawn(int *pcFramesDrawn)
+STDMETHODIMP CBaseVideoRenderer::get_FramesDrawn( int *pcFramesDrawn)
{
- CheckPointer(pcFramesDrawn, E_POINTER);
+ CheckPointer(pcFramesDrawn,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
*pcFramesDrawn = m_cFramesDrawn;
return NOERROR;
@@ -2840,28 +2658,22 @@ STDMETHODIMP CBaseVideoRenderer::get_FramesDrawn(int *pcFramesDrawn)
// Set iAvgFrameRate to the frames per hundred secs since
// streaming started. 0 otherwise.
-STDMETHODIMP CBaseVideoRenderer::get_AvgFrameRate(int *piAvgFrameRate)
+STDMETHODIMP CBaseVideoRenderer::get_AvgFrameRate( int *piAvgFrameRate)
{
- CheckPointer(piAvgFrameRate, E_POINTER);
+ CheckPointer(piAvgFrameRate,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
int t;
- if(m_bStreaming)
- {
- t = timeGetTime() - m_tStreamingStart;
- }
- else
- {
+ if (m_bStreaming) {
+ t = timeGetTime()-m_tStreamingStart;
+ } else {
t = m_tStreamingStart;
}
- if(t <= 0)
- {
+ if (t<=0) {
*piAvgFrameRate = 0;
ASSERT(m_cFramesDrawn == 0);
- }
- else
- {
+ } else {
// i is frames per hundred seconds
*piAvgFrameRate = MulDiv(100000, m_cFramesDrawn, t);
}
@@ -2875,24 +2687,20 @@ STDMETHODIMP CBaseVideoRenderer::get_AvgFrameRate(int *piAvgFrameRate)
STDMETHODIMP CBaseVideoRenderer::get_AvgSyncOffset(__out int *piAvg)
{
- CheckPointer(piAvg, E_POINTER);
+ CheckPointer(piAvg,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
- if(NULL == m_pClock)
- {
+ if (NULL==m_pClock) {
*piAvg = 0;
return NOERROR;
}
// Note that we didn't gather the stats on the first frame
// so we use m_cFramesDrawn-1 here
- if(m_cFramesDrawn <= 1)
- {
+ if (m_cFramesDrawn<=1) {
*piAvg = 0;
- }
- else
- {
- *piAvg = (int)(m_iTotAcc / (m_cFramesDrawn - 1));
+ } else {
+ *piAvg = (int)(m_iTotAcc / (m_cFramesDrawn-1));
}
return NOERROR;
} // get_AvgSyncOffset
@@ -2920,27 +2728,20 @@ int isqrt(int x)
{
int s = 1;
// Make s an initial guess for sqrt(x)
- if(x > 0x40000000)
- {
- s = 0x8000; // prevent any conceivable closed loop
- }
- else
- {
- while(s * s < x) // loop cannot possible go more than 31 times
- {
- s = 2 * s; // normally it goes about 6 times
+ if (x > 0x40000000) {
+ s = 0x8000; // prevent any conceivable closed loop
+ } else {
+ while (s*s<x) { // loop cannot possible go more than 31 times
+ s = 2*s; // normally it goes about 6 times
}
// Three NR iterations.
- if(x == 0)
- {
- s = 0; // Wouldn't it be tragic to divide by zero whenever our
- // accuracy was perfect!
- }
- else
- {
- s = (s * s + x) / (2 * s);
- if(s >= 0) s = (s * s + x) / (2 * s);
- if(s >= 0) s = (s * s + x) / (2 * s);
+ if (x==0) {
+ s= 0; // Wouldn't it be tragic to divide by zero whenever our
+ // accuracy was perfect!
+ } else {
+ s = (s*s+x)/(2*s);
+ if (s>=0) s = (s*s+x)/(2*s);
+ if (s>=0) s = (s*s+x)/(2*s);
}
}
return s;
@@ -2957,11 +2758,10 @@ HRESULT CBaseVideoRenderer::GetStdDev(
LONGLONG iTot
)
{
- CheckPointer(piResult, E_POINTER);
+ CheckPointer(piResult,E_POINTER);
CAutoLock cVideoLock(&m_InterfaceLock);
- if(NULL == m_pClock)
- {
+ if (NULL==m_pClock) {
*piResult = 0;
return NOERROR;
}
@@ -2971,20 +2771,17 @@ HRESULT CBaseVideoRenderer::GetStdDev(
// N observations, then an estimate of the standard deviation is
// sqrt( (S - T**2/N) / (N-1) )
- if(nSamples <= 1)
- {
+ if (nSamples<=1) {
*piResult = 0;
- }
- else
- {
+ } else {
LONGLONG x;
// First frames have invalid stamps, so we get no stats for them
// So we need 2 frames to get 1 datum, so N is cFramesDrawn-1
// so we use m_cFramesDrawn-1 here
x = llSumSq - llMulDiv(iTot, iTot, nSamples, 0);
- x = x / (nSamples - 1);
- ASSERT(x >= 0);
+ x = x / (nSamples-1);
+ ASSERT(x>=0);
*piResult = isqrt((LONG)x);
}
return NOERROR;
@@ -3022,19 +2819,16 @@ STDMETHODIMP CBaseVideoRenderer::get_Jitter(__out int *piJitter)
// Overidden to return our IQualProp interface
STDMETHODIMP
-CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid, __deref_out VOID **ppv)
+CBaseVideoRenderer::NonDelegatingQueryInterface(REFIID riid,__deref_out VOID **ppv)
{
// We return IQualProp and delegate everything else
- if(riid == IID_IQualProp)
- {
- return GetInterface((IQualProp *)this, ppv);
+ if (riid == IID_IQualProp) {
+ return GetInterface( (IQualProp *)this, ppv);
+ } else if (riid == IID_IQualityControl) {
+ return GetInterface( (IQualityControl *)this, ppv);
}
- else if(riid == IID_IQualityControl)
- {
- return GetInterface((IQualityControl *)this, ppv);
- }
- return CBaseRenderer::NonDelegatingQueryInterface(riid, ppv);
+ return CBaseRenderer::NonDelegatingQueryInterface(riid,ppv);
}
@@ -3047,8 +2841,7 @@ CBaseVideoRenderer::JoinFilterGraph(__inout_opt IFilterGraph *pGraph, __in_opt L
// Since we send EC_ACTIVATE, we also need to ensure
// we send EC_WINDOW_DESTROYED or the resource manager may be
// holding us as a focus object
- if(!pGraph && m_pGraph)
- {
+ if (!pGraph && m_pGraph) {
// We were in a graph and now we're not
// Do this properly in case we are aggregated
diff --git a/src/filters/BaseClasses/renbase.h b/src/filters/BaseClasses/renbase.h
index a5eb8a21b..695f07837 100644
--- a/src/filters/BaseClasses/renbase.h
+++ b/src/filters/BaseClasses/renbase.h
@@ -86,13 +86,13 @@ protected:
BOOL m_bRepaintStatus; // Can we signal an EC_REPAINT
// Avoid some deadlocks by tracking filter during stop
volatile BOOL m_bInReceive; // Inside Receive between PrepareReceive
- // And actually processing the sample
+ // And actually processing the sample
REFERENCE_TIME m_SignalTime; // Time when we signal EC_COMPLETE
UINT m_EndOfStreamTimer; // Used to signal end of stream
CCritSec m_ObjectCreationLock; // This lock protects the creation and
- // of m_pPosition and m_pInputPin. It
- // ensures that two threads cannot create
- // either object simultaneously.
+ // of m_pPosition and m_pInputPin. It
+ // ensures that two threads cannot create
+ // either object simultaneously.
public:
@@ -119,48 +119,24 @@ public:
// Return internal information about this filter
- BOOL IsEndOfStream()
- {
- return m_bEOS;
- };
- BOOL IsEndOfStreamDelivered()
- {
- return m_bEOSDelivered;
- };
- BOOL IsStreaming()
- {
- return m_bStreaming;
- };
- void SetAbortSignal(BOOL bAbort)
- {
- m_bAbort = bAbort;
- };
+ BOOL IsEndOfStream() { return m_bEOS; };
+ BOOL IsEndOfStreamDelivered() { return m_bEOSDelivered; };
+ BOOL IsStreaming() { return m_bStreaming; };
+ void SetAbortSignal(BOOL bAbort) { m_bAbort = bAbort; };
virtual void OnReceiveFirstSample(IMediaSample *pMediaSample) { };
- CAMEvent *GetRenderEvent()
- {
- return &m_RenderEvent;
- };
+ CAMEvent *GetRenderEvent() { return &m_RenderEvent; };
// Permit access to the transition state
- void Ready()
- {
- m_evComplete.Set();
- };
- void NotReady()
- {
- m_evComplete.Reset();
- };
- BOOL CheckReady()
- {
- return m_evComplete.Check();
- };
+ void Ready() { m_evComplete.Set(); };
+ void NotReady() { m_evComplete.Reset(); };
+ BOOL CheckReady() { return m_evComplete.Check(); };
virtual int GetPinCount();
virtual CBasePin *GetPin(int n);
FILTER_STATE GetRealState();
void SendRepaint();
- void SendNotifyWindow(IPin *pPin, HWND hwnd);
+ void SendNotifyWindow(IPin *pPin,HWND hwnd);
BOOL OnDisplayChange();
void SetRepaintStatus(BOOL bRepaint);
@@ -176,21 +152,15 @@ public:
virtual void OnRenderStart(IMediaSample *pMediaSample);
virtual void OnRenderEnd(IMediaSample *pMediaSample);
- virtual HRESULT OnStartStreaming()
- {
- return NOERROR;
- };
- virtual HRESULT OnStopStreaming()
- {
- return NOERROR;
- };
+ virtual HRESULT OnStartStreaming() { return NOERROR; };
+ virtual HRESULT OnStopStreaming() { return NOERROR; };
virtual void OnWaitStart() { };
virtual void OnWaitEnd() { };
virtual void PrepareRender() { };
#ifdef PERF
REFERENCE_TIME m_trRenderStart; // Just before we started drawing
- // Set in OnRenderStart, Used in OnRenderEnd
+ // Set in OnRenderStart, Used in OnRenderEnd
int m_idBaseStamp; // MSR_id for frame time stamp
int m_idBaseRenderTime; // MSR_id for true wait time
int m_idBaseAccuracy; // MSR_id for time frame is late (int)
@@ -278,8 +248,8 @@ public:
// Spot the bug in this macro - I can't. but it doesn't work!
class CBaseVideoRenderer : public CBaseRenderer, // Base renderer class
- public IQualProp, // Property page guff
- public IQualityControl // Allow throttling
+ public IQualProp, // Property page guff
+ public IQualityControl // Allow throttling
{
protected:
@@ -301,19 +271,19 @@ protected:
// We therefore need to know whether we are playing frames early or not.
int m_nNormal; // The number of consecutive frames
- // drawn at their normal time (not early)
- // -1 means we just dropped a frame.
+ // drawn at their normal time (not early)
+ // -1 means we just dropped a frame.
#ifdef PERF
BOOL m_bDrawLateFrames; // Don't drop any frames (debug and I'm
- // not keen on people using it!)
+ // not keen on people using it!)
#endif
BOOL m_bSupplierHandlingQuality;// The response to Quality messages says
- // our supplier is handling things.
- // We will allow things to go extra late
- // before dropping frames. We will play
- // very early after he has dropped one.
+ // our supplier is handling things.
+ // We will allow things to go extra late
+ // before dropping frames. We will play
+ // very early after he has dropped one.
// Control of scheduling, frame dropping etc.
// We need to know where the time is being spent so as to tell whether
@@ -343,7 +313,7 @@ protected:
int m_trRenderAvg; // Time frames are taking to blt
int m_trRenderLast; // Time for last frame blt
int m_tRenderStart; // Just before we started drawing (mSec)
- // derived from timeGetTime.
+ // derived from timeGetTime.
// When frames are dropped we will play the next frame as early as we can.
// If it was a false alarm and the machine is fast we slide gently back to
@@ -365,8 +335,8 @@ protected:
// controls whether we bother to drop a frame or whether we reckon that
// we're doing well enough that we can stand a one-frame glitch.
int m_trWaitAvg; // Average of last few wait times
- // (actually we just average how early
- // we were). Negative here means LATE.
+ // (actually we just average how early
+ // we were). Negative here means LATE.
// The average inter-frame time.
// This is used to calculate the proportion of the time used by the
@@ -393,7 +363,7 @@ protected:
//int m_idSendQuality; // MSR_id for timing the notifications per se
#endif // PERF
REFERENCE_TIME m_trRememberStampForPerf; // original time stamp of frame
- // with no earliness fudges etc.
+ // with no earliness fudges etc.
#ifdef PERF
REFERENCE_TIME m_trRememberFrameForPerf; // time when previous frame rendered
@@ -408,7 +378,7 @@ protected:
int m_cFramesDropped; // cumulative frames dropped IN THE RENDERER
int m_cFramesDrawn; // Frames since streaming started seen BY THE
- // RENDERER (some may be dropped upstream)
+ // RENDERER (some may be dropped upstream)
// Next two support average sync offset and standard deviation of sync offset.
LONGLONG m_iTotAcc; // Sum of accuracies in mSec
@@ -428,8 +398,8 @@ protected:
int m_trFrame; // hold onto inter-frame time
int m_tStreamingStart; // if streaming then time streaming started
- // else time of last streaming session
- // used for property page statistics
+ // else time of last streaming session
+ // used for property page statistics
#ifdef PERF
LONGLONG m_llTimeOffset; // timeGetTime()*10000+m_llTimeOffset==ref time
#endif
@@ -446,8 +416,8 @@ public:
// IQualityControl methods - Notify allows audio-video throttling
- STDMETHODIMP SetSink(IQualityControl * piqc);
- STDMETHODIMP Notify(IBaseFilter * pSelf, Quality q);
+ STDMETHODIMP SetSink( IQualityControl * piqc);
+ STDMETHODIMP Notify( IBaseFilter * pSelf, Quality q);
// These provide a full video quality management implementation
@@ -501,7 +471,7 @@ public:
// Implement an IUnknown interface and expose IQualProp
DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out VOID **ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out VOID **ppv);
};
#endif // __RENBASE__
diff --git a/src/filters/BaseClasses/schedule.cpp b/src/filters/BaseClasses/schedule.cpp
index 519f72b24..1b4a38190 100644
--- a/src/filters/BaseClasses/schedule.cpp
+++ b/src/filters/BaseClasses/schedule.cpp
@@ -17,12 +17,12 @@
/* Construct & destructors */
-CAMSchedule::CAMSchedule(HANDLE ev)
- : CBaseObject(TEXT("CAMSchedule"))
- , head(&z, 0), z(0, MAX_TIME)
- , m_dwNextCookie(0), m_dwAdviseCount(0)
- , m_pAdviseCache(0), m_dwCacheCount(0)
- , m_ev(ev)
+CAMSchedule::CAMSchedule( HANDLE ev )
+: CBaseObject(TEXT("CAMSchedule"))
+, head(&z, 0), z(0, MAX_TIME)
+, m_dwNextCookie(0), m_dwAdviseCount(0)
+, m_pAdviseCache(0), m_dwCacheCount(0)
+, m_ev( ev )
{
head.m_dwAdviseCookie = z.m_dwAdviseCookie = 0;
}
@@ -33,19 +33,19 @@ CAMSchedule::~CAMSchedule()
// Delete cache
CAdvisePacket * p = m_pAdviseCache;
- while(p)
+ while (p)
{
CAdvisePacket *const p_next = p->m_next;
delete p;
p = p_next;
}
- ASSERT(m_dwAdviseCount == 0);
+ ASSERT( m_dwAdviseCount == 0 );
// Better to be safe than sorry
- if(m_dwAdviseCount > 0)
+ if ( m_dwAdviseCount > 0 )
{
DumpLinkedList();
- while(!head.m_next->IsZ())
+ while ( !head.m_next->IsZ() )
{
head.DeleteNext();
--m_dwAdviseCount;
@@ -55,7 +55,7 @@ CAMSchedule::~CAMSchedule()
// If, in the debug version, we assert twice, it means, not only
// did we have left over advises, but we have also let m_dwAdviseCount
// get out of sync. with the number of advises actually on the list.
- ASSERT(m_dwAdviseCount == 0);
+ ASSERT( m_dwAdviseCount == 0 );
m_Serialize.Unlock();
}
@@ -75,20 +75,20 @@ REFERENCE_TIME CAMSchedule::GetNextAdviseTime()
}
DWORD_PTR CAMSchedule::AddAdvisePacket
-(const REFERENCE_TIME & time1
- , const REFERENCE_TIME & time2
- , HANDLE h, BOOL periodic
+( const REFERENCE_TIME & time1
+, const REFERENCE_TIME & time2
+, HANDLE h, BOOL periodic
)
{
// Since we use MAX_TIME as a sentry, we can't afford to
// schedule a notification at MAX_TIME
- ASSERT(time1 < MAX_TIME);
+ ASSERT( time1 < MAX_TIME );
DWORD_PTR Result;
CAdvisePacket * p;
m_Serialize.Lock();
- if(m_pAdviseCache)
+ if (m_pAdviseCache)
{
p = m_pAdviseCache;
m_pAdviseCache = p->m_next;
@@ -98,13 +98,11 @@ DWORD_PTR CAMSchedule::AddAdvisePacket
{
p = new CAdvisePacket();
}
- if(p)
+ if (p)
{
- p->m_rtEventTime = time1;
- p->m_rtPeriod = time2;
- p->m_hNotify = h;
- p->m_bPeriodic = periodic;
- Result = AddAdvisePacket(p);
+ p->m_rtEventTime = time1; p->m_rtPeriod = time2;
+ p->m_hNotify = h; p->m_bPeriodic = periodic;
+ Result = AddAdvisePacket( p );
}
else Result = 0;
@@ -119,21 +117,21 @@ HRESULT CAMSchedule::Unadvise(DWORD_PTR dwAdviseCookie)
CAdvisePacket * p_prev = &head;
CAdvisePacket * p_n;
m_Serialize.Lock();
- while(p_n = p_prev->Next()) // The Next() method returns NULL when it hits z
+ while ( p_n = p_prev->Next() ) // The Next() method returns NULL when it hits z
{
- if(p_n->m_dwAdviseCookie == dwAdviseCookie)
+ if ( p_n->m_dwAdviseCookie == dwAdviseCookie )
{
- Delete(p_prev->RemoveNext());
+ Delete( p_prev->RemoveNext() );
--m_dwAdviseCount;
hr = S_OK;
- // Having found one cookie that matches, there should be no more
-#ifdef _DEBUG
- while(p_n = p_prev->Next())
- {
- ASSERT(p_n->m_dwAdviseCookie != dwAdviseCookie);
- p_prev = p_n;
- }
-#endif
+ // Having found one cookie that matches, there should be no more
+ #ifdef _DEBUG
+ while (p_n = p_prev->Next())
+ {
+ ASSERT(p_n->m_dwAdviseCookie != dwAdviseCookie);
+ p_prev = p_n;
+ }
+ #endif
break;
}
p_prev = p_n;
@@ -142,54 +140,54 @@ HRESULT CAMSchedule::Unadvise(DWORD_PTR dwAdviseCookie)
return hr;
}
-REFERENCE_TIME CAMSchedule::Advise(const REFERENCE_TIME & rtTime)
+REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime )
{
REFERENCE_TIME rtNextTime;
CAdvisePacket * pAdvise;
DbgLog((LOG_TIMING, 2,
- TEXT("CAMSchedule::Advise( %lu ms )"), ULONG(rtTime / (UNITS / MILLISECONDS))));
+ TEXT("CAMSchedule::Advise( %lu ms )"), ULONG(rtTime / (UNITS / MILLISECONDS))));
CAutoLock lck(&m_Serialize);
-#ifdef _DEBUG
- if(DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList();
-#endif
+ #ifdef _DEBUG
+ if (DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList();
+ #endif
- // Note - DON'T cache the difference, it might overflow
- while(rtTime >= (rtNextTime = (pAdvise = head.m_next)->m_rtEventTime) &&
- !pAdvise->IsZ())
+ // Note - DON'T cache the difference, it might overflow
+ while ( rtTime >= (rtNextTime = (pAdvise=head.m_next)->m_rtEventTime) &&
+ !pAdvise->IsZ() )
{
ASSERT(pAdvise->m_dwAdviseCookie); // If this is zero, its the head or the tail!!
ASSERT(pAdvise->m_hNotify != INVALID_HANDLE_VALUE);
- if(pAdvise->m_bPeriodic == TRUE)
+ if (pAdvise->m_bPeriodic == TRUE)
{
- ReleaseSemaphore(pAdvise->m_hNotify, 1, NULL);
+ ReleaseSemaphore(pAdvise->m_hNotify,1,NULL);
pAdvise->m_rtEventTime += pAdvise->m_rtPeriod;
ShuntHead();
}
else
{
- ASSERT(pAdvise->m_bPeriodic == FALSE);
+ ASSERT( pAdvise->m_bPeriodic == FALSE );
EXECUTE_ASSERT(SetEvent(pAdvise->m_hNotify));
--m_dwAdviseCount;
- Delete(head.RemoveNext());
+ Delete( head.RemoveNext() );
}
}
DbgLog((LOG_TIMING, 3,
TEXT("CAMSchedule::Advise() Next time stamp: %lu ms, for advise %lu."),
- DWORD(rtNextTime / (UNITS / MILLISECONDS)), pAdvise->m_dwAdviseCookie));
+ DWORD(rtNextTime / (UNITS / MILLISECONDS)), pAdvise->m_dwAdviseCookie ));
return rtNextTime;
}
/* Private methods */
-DWORD_PTR CAMSchedule::AddAdvisePacket(__inout CAdvisePacket * pPacket)
+DWORD_PTR CAMSchedule::AddAdvisePacket( __inout CAdvisePacket * pPacket )
{
ASSERT(pPacket->m_rtEventTime >= 0 && pPacket->m_rtEventTime < MAX_TIME);
ASSERT(CritCheckIn(&m_Serialize));
@@ -199,26 +197,26 @@ DWORD_PTR CAMSchedule::AddAdvisePacket(__inout CAdvisePacket * pPacket)
const DWORD_PTR Result = pPacket->m_dwAdviseCookie = ++m_dwNextCookie;
// This relies on the fact that z is a sentry with a maximal m_rtEventTime
- for(;; p_prev = p_n)
+ for(;;p_prev = p_n)
{
p_n = p_prev->m_next;
- if(p_n->m_rtEventTime >= pPacket->m_rtEventTime) break;
+ if ( p_n->m_rtEventTime >= pPacket->m_rtEventTime ) break;
}
- p_prev->InsertAfter(pPacket);
+ p_prev->InsertAfter( pPacket );
++m_dwAdviseCount;
DbgLog((LOG_TIMING, 2, TEXT("Added advise %lu, for thread 0x%02X, scheduled at %lu"),
- pPacket->m_dwAdviseCookie, GetCurrentThreadId(), (pPacket->m_rtEventTime / (UNITS / MILLISECONDS))));
+ pPacket->m_dwAdviseCookie, GetCurrentThreadId(), (pPacket->m_rtEventTime / (UNITS / MILLISECONDS)) ));
// If packet added at the head, then clock needs to re-evaluate wait time.
- if(p_prev == &head) SetEvent(m_ev);
+ if ( p_prev == &head ) SetEvent( m_ev );
return Result;
}
-void CAMSchedule::Delete(__inout CAdvisePacket * pPacket)
+void CAMSchedule::Delete( __inout CAdvisePacket * pPacket )
{
- if(m_dwCacheCount >= dwCacheMax) delete pPacket;
+ if ( m_dwCacheCount >= dwCacheMax ) delete pPacket;
else
{
m_Serialize.Lock();
@@ -242,24 +240,24 @@ void CAMSchedule::ShuntHead()
// This will catch both an empty list,
// and if somehow a MAX_TIME time gets into the list
// (which would also break this method).
- ASSERT(pPacket->m_rtEventTime < MAX_TIME);
+ ASSERT( pPacket->m_rtEventTime < MAX_TIME );
// This relies on the fact that z is a sentry with a maximal m_rtEventTime
- for(;; p_prev = p_n)
+ for(;;p_prev = p_n)
{
p_n = p_prev->m_next;
- if(p_n->m_rtEventTime > pPacket->m_rtEventTime) break;
+ if ( p_n->m_rtEventTime > pPacket->m_rtEventTime ) break;
}
// If p_prev == pPacket then we're already in the right place
- if(p_prev != pPacket)
+ if (p_prev != pPacket)
{
head.m_next = pPacket->m_next;
(p_prev->m_next = pPacket)->m_next = p_n;
}
-#ifdef _DEBUG
- DbgLog((LOG_TIMING, 2, TEXT("Periodic advise %lu, shunted to %lu"),
- pPacket->m_dwAdviseCookie, (pPacket->m_rtEventTime / (UNITS / MILLISECONDS))));
-#endif
+ #ifdef _DEBUG
+ DbgLog((LOG_TIMING, 2, TEXT("Periodic advise %lu, shunted to %lu"),
+ pPacket->m_dwAdviseCookie, (pPacket->m_rtEventTime / (UNITS / MILLISECONDS)) ));
+ #endif
m_Serialize.Unlock();
}
@@ -268,18 +266,18 @@ void CAMSchedule::ShuntHead()
void CAMSchedule::DumpLinkedList()
{
m_Serialize.Lock();
- int i = 0;
+ int i=0;
DbgLog((LOG_TIMING, 1, TEXT("CAMSchedule::DumpLinkedList() this = 0x%p"), this));
- for(CAdvisePacket * p = &head
- ; p
+ for ( CAdvisePacket * p = &head
+ ; p
; p = p->m_next , i++
- )
+ )
{
DbgLog((LOG_TIMING, 1, TEXT("Advise List # %lu, Cookie %d, RefTime %lu"),
- i,
- p->m_dwAdviseCookie,
- p->m_rtEventTime / (UNITS / MILLISECONDS)
- ));
+ i,
+ p->m_dwAdviseCookie,
+ p->m_rtEventTime / (UNITS / MILLISECONDS)
+ ));
}
m_Serialize.Unlock();
}
diff --git a/src/filters/BaseClasses/schedule.h b/src/filters/BaseClasses/schedule.h
index 216859efa..058d76442 100644
--- a/src/filters/BaseClasses/schedule.h
+++ b/src/filters/BaseClasses/schedule.h
@@ -15,26 +15,23 @@ class CAMSchedule : private CBaseObject
public:
virtual ~CAMSchedule();
// ev is the event we should fire if the advise time needs re-evaluating
- CAMSchedule(HANDLE ev);
+ CAMSchedule( HANDLE ev );
DWORD GetAdviseCount();
REFERENCE_TIME GetNextAdviseTime();
// We need a method for derived classes to add advise packets, we return the cookie
- DWORD_PTR AddAdvisePacket(const REFERENCE_TIME & time1, const REFERENCE_TIME & time2, HANDLE h, BOOL periodic);
+ DWORD_PTR AddAdvisePacket( const REFERENCE_TIME & time1, const REFERENCE_TIME & time2, HANDLE h, BOOL periodic );
// And a way to cancel
HRESULT Unadvise(DWORD_PTR dwAdviseCookie);
// Tell us the time please, and we'll dispatch the expired events. We return the time of the next event.
// NB: The time returned will be "useless" if you start adding extra Advises. But that's the problem of
// whoever is using this helper class (typically a clock).
- REFERENCE_TIME Advise(const REFERENCE_TIME & rtTime);
+ REFERENCE_TIME Advise( const REFERENCE_TIME & rtTime );
// Get the event handle which will be set if advise time requires re-evaluation.
- HANDLE GetEvent() const
- {
- return m_ev;
- }
+ HANDLE GetEvent() const { return m_ev; }
private:
// We define the nodes that will be used in our singly linked list
@@ -53,19 +50,17 @@ private:
HANDLE m_hNotify; // Handle to event or semephore
BOOL m_bPeriodic; // TRUE => Periodic event
- CAdvisePacket(__inout_opt CAdvisePacket * next, LONGLONG time) : m_next(next), m_rtEventTime(time)
+ CAdvisePacket( __inout_opt CAdvisePacket * next, LONGLONG time ) : m_next(next), m_rtEventTime(time)
{}
- void InsertAfter(__inout CAdvisePacket * p)
+ void InsertAfter( __inout CAdvisePacket * p )
{
p->m_next = m_next;
m_next = p;
}
int IsZ() const // That is, is it the node that represents the end of the list
- {
- return m_next == 0;
- }
+ { return m_next == 0; }
CAdvisePacket * RemoveNext()
{
@@ -83,14 +78,12 @@ private:
CAdvisePacket * Next() const
{
CAdvisePacket * result = m_next;
- if(result->IsZ()) result = 0;
+ if (result->IsZ()) result = 0;
return result;
}
DWORD_PTR Cookie() const
- {
- return m_dwAdviseCookie;
- }
+ { return m_dwAdviseCookie; }
};
// Structure is:
@@ -106,7 +99,7 @@ private:
CCritSec m_Serialize;
// AddAdvisePacket: adds the packet, returns the cookie (0 if failed)
- DWORD_PTR AddAdvisePacket(__inout CAdvisePacket * pPacket);
+ DWORD_PTR AddAdvisePacket( __inout CAdvisePacket * pPacket );
// Event that we should set if the packed added above will be the next to fire.
const HANDLE m_ev;
@@ -120,7 +113,7 @@ private:
DWORD m_dwCacheCount;
enum { dwCacheMax = 5 }; // Don't bother caching more than five
- void Delete(__inout CAdvisePacket * pLink); // This "Delete" will cache the Link
+ void Delete( __inout CAdvisePacket * pLink );// This "Delete" will cache the Link
// Attributes and methods for debugging
public:
diff --git a/src/filters/BaseClasses/seekpt.cpp b/src/filters/BaseClasses/seekpt.cpp
index 856259d1e..bb13d6f0a 100644
--- a/src/filters/BaseClasses/seekpt.cpp
+++ b/src/filters/BaseClasses/seekpt.cpp
@@ -19,35 +19,29 @@
CUnknown * CSeekingPassThru::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
{
- return new CSeekingPassThru(NAME("Seeking PassThru"), pUnk, phr);
+ return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
}
STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
{
- if(riid == IID_ISeekingPassThru)
- {
+ if (riid == IID_ISeekingPassThru) {
return GetInterface((ISeekingPassThru *) this, ppv);
- }
- else
- {
- if(m_pPosPassThru &&
- (riid == IID_IMediaSeeking ||
- riid == IID_IMediaPosition))
- {
- return m_pPosPassThru->NonDelegatingQueryInterface(riid, ppv);
- }
- else
- {
+ } else {
+ if (m_pPosPassThru &&
+ (riid == IID_IMediaSeeking ||
+ riid == IID_IMediaPosition)) {
+ return m_pPosPassThru->NonDelegatingQueryInterface(riid,ppv);
+ } else {
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
}
}
-CSeekingPassThru::CSeekingPassThru(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
- : CUnknown(pName, pUnk, phr),
- m_pPosPassThru(NULL)
+CSeekingPassThru::CSeekingPassThru( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr )
+ : CUnknown(pName, pUnk, phr),
+ m_pPosPassThru(NULL)
{
}
@@ -60,32 +54,25 @@ CSeekingPassThru::~CSeekingPassThru()
STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin)
{
HRESULT hr = NOERROR;
- if(m_pPosPassThru)
- {
+ if (m_pPosPassThru) {
hr = E_FAIL;
- }
- else
- {
+ } else {
m_pPosPassThru =
bRendererSeeking ?
- new CRendererPosPassThru(
- NAME("Render Seeking COM object"),
- (IUnknown *)this,
- &hr,
- pPin) :
- new CPosPassThru(
- NAME("Render Seeking COM object"),
- (IUnknown *)this,
- &hr,
- pPin);
- if(!m_pPosPassThru)
- {
+ new CRendererPosPassThru(
+ NAME("Render Seeking COM object"),
+ (IUnknown *)this,
+ &hr,
+ pPin) :
+ new CPosPassThru(
+ NAME("Render Seeking COM object"),
+ (IUnknown *)this,
+ &hr,
+ pPin);
+ if (!m_pPosPassThru) {
hr = E_OUTOFMEMORY;
- }
- else
- {
- if(FAILED(hr))
- {
+ } else {
+ if (FAILED(hr)) {
delete m_pPosPassThru;
m_pPosPassThru = NULL;
}
diff --git a/src/filters/BaseClasses/source.cpp b/src/filters/BaseClasses/source.cpp
index 0df928bf1..ef7795c42 100644
--- a/src/filters/BaseClasses/source.cpp
+++ b/src/filters/BaseClasses/source.cpp
@@ -64,10 +64,9 @@ CSource::CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid
CSource::~CSource()
{
/* Free our pins and pin array */
- while(m_iPins != 0)
- {
- // deleting the pins causes them to be removed from the array...
- delete m_paStreams[m_iPins - 1];
+ while (m_iPins != 0) {
+ // deleting the pins causes them to be removed from the array...
+ delete m_paStreams[m_iPins - 1];
}
ASSERT(m_paStreams == NULL);
@@ -83,12 +82,10 @@ HRESULT CSource::AddPin(__in CSourceStream *pStream)
/* Allocate space for this pin and the old ones */
CSourceStream **paStreams = new CSourceStream *[m_iPins + 1];
- if(paStreams == NULL)
- {
+ if (paStreams == NULL) {
return E_OUTOFMEMORY;
}
- if(m_paStreams != NULL)
- {
+ if (m_paStreams != NULL) {
CopyMemory((PVOID)paStreams, (PVOID)m_paStreams,
m_iPins * sizeof(m_paStreams[0]));
paStreams[m_iPins] = pStream;
@@ -106,20 +103,15 @@ HRESULT CSource::AddPin(__in CSourceStream *pStream)
HRESULT CSource::RemovePin(__in CSourceStream *pStream)
{
int i;
- for(i = 0; i < m_iPins; i++)
- {
- if(m_paStreams[i] == pStream)
- {
- if(m_iPins == 1)
- {
+ for (i = 0; i < m_iPins; i++) {
+ if (m_paStreams[i] == pStream) {
+ if (m_iPins == 1) {
delete [] m_paStreams;
m_paStreams = NULL;
- }
- else
- {
+ } else {
/* no need to reallocate */
- while(++i < m_iPins)
- m_paStreams[i - 1] = m_paStreams[i];
+ while (++i < m_iPins)
+ m_paStreams[i - 1] = m_paStreams[i];
}
m_iPins--;
return S_OK;
@@ -135,19 +127,16 @@ HRESULT CSource::RemovePin(__in CSourceStream *pStream)
// or to NULL if the Id cannot be matched.
STDMETHODIMP CSource::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
{
- CheckPointer(ppPin, E_POINTER);
- ValidateReadWritePtr(ppPin, sizeof(IPin *));
+ CheckPointer(ppPin,E_POINTER);
+ ValidateReadWritePtr(ppPin,sizeof(IPin *));
// The -1 undoes the +1 in QueryId and ensures that totally invalid
// strings (for which WstrToInt delivers 0) give a deliver a NULL pin.
- int i = WstrToInt(Id) - 1;
+ int i = WstrToInt(Id) -1;
*ppPin = GetPin(i);
- if(*ppPin != NULL)
- {
+ if (*ppPin!=NULL){
(*ppPin)->AddRef();
return NOERROR;
- }
- else
- {
+ } else {
return VFW_E_NOT_FOUND;
}
}
@@ -156,13 +145,10 @@ STDMETHODIMP CSource::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
// FindPinNumber
//
// return the number of the pin with this IPin* or -1 if none
-int CSource::FindPinNumber(__in IPin *iPin)
-{
+int CSource::FindPinNumber(__in IPin *iPin) {
int i;
- for(i = 0; i < m_iPins; ++i)
- {
- if((IPin *)(m_paStreams[i]) == iPin)
- {
+ for (i=0; i<m_iPins; ++i) {
+ if ((IPin *)(m_paStreams[i])==iPin) {
return i;
}
}
@@ -173,8 +159,7 @@ int CSource::FindPinNumber(__in IPin *iPin)
// GetPinCount
//
// Returns the number of pins this filter has
-int CSource::GetPinCount(void)
-{
+int CSource::GetPinCount(void) {
CAutoLock lock(&m_cStateLock);
return m_iPins;
@@ -186,19 +171,17 @@ int CSource::GetPinCount(void)
//
// Return a non-addref'd pointer to pin n
// needed by CBaseFilter
-CBasePin *CSource::GetPin(int n)
-{
+CBasePin *CSource::GetPin(int n) {
CAutoLock lock(&m_cStateLock);
// n must be in the range 0..m_iPins-1
// if m_iPins>n && n>=0 it follows that m_iPins>0
// which is what used to be checked (i.e. checking that we have a pin)
- if((n >= 0) && (n < m_iPins))
- {
+ if ((n >= 0) && (n < m_iPins)) {
ASSERT(m_paStreams[n]);
- return m_paStreams[n];
+ return m_paStreams[n];
}
return NULL;
}
@@ -213,19 +196,17 @@ CBasePin *CSource::GetPin(int n)
//
// Set Id to point to a CoTaskMemAlloc'd
-STDMETHODIMP CSourceStream::QueryId(__deref_out LPWSTR *Id)
-{
- CheckPointer(Id, E_POINTER);
- ValidateReadWritePtr(Id, sizeof(LPWSTR));
+STDMETHODIMP CSourceStream::QueryId(__deref_out LPWSTR *Id) {
+ CheckPointer(Id,E_POINTER);
+ ValidateReadWritePtr(Id,sizeof(LPWSTR));
// We give the pins id's which are 1,2,...
// FindPinNumber returns -1 for an invalid pin
- int i = 1 + m_pFilter->FindPinNumber(this);
- if(i < 1) return VFW_E_NOT_FOUND;
+ int i = 1+ m_pFilter->FindPinNumber(this);
+ if (i<1) return VFW_E_NOT_FOUND;
*Id = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * 12);
- if(*Id == NULL)
- {
- return E_OUTOFMEMORY;
+ if (*Id==NULL) {
+ return E_OUTOFMEMORY;
}
IntToWstr(i, *Id);
return NOERROR;
@@ -243,10 +224,9 @@ CSourceStream::CSourceStream(
__inout CSource *ps,
__in_opt LPCWSTR pPinName)
: CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName),
- m_pFilter(ps)
-{
+ m_pFilter(ps) {
- *phr = m_pFilter->AddPin(this);
+ *phr = m_pFilter->AddPin(this);
}
#ifdef UNICODE
@@ -256,20 +236,18 @@ CSourceStream::CSourceStream(
__inout CSource *ps,
__in_opt LPCWSTR pPinName)
: CBaseOutputPin(pObjectName, ps, ps->pStateLock(), phr, pPinName),
- m_pFilter(ps)
-{
+ m_pFilter(ps) {
- *phr = m_pFilter->AddPin(this);
+ *phr = m_pFilter->AddPin(this);
}
#endif
//
// CSourceStream::Destructor
//
// Decrements the number of pins on this filter
-CSourceStream::~CSourceStream(void)
-{
+CSourceStream::~CSourceStream(void) {
- m_pFilter->RemovePin(this);
+ m_pFilter->RemovePin(this);
}
@@ -277,16 +255,14 @@ CSourceStream::~CSourceStream(void)
// CheckMediaType
//
// Do we support this type? Provides the default support for 1 type.
-HRESULT CSourceStream::CheckMediaType(const CMediaType *pMediaType)
-{
+HRESULT CSourceStream::CheckMediaType(const CMediaType *pMediaType) {
CAutoLock lock(m_pFilter->pStateLock());
CMediaType mt;
GetMediaType(&mt);
- if(mt == *pMediaType)
- {
+ if (mt == *pMediaType) {
return NOERROR;
}
@@ -299,17 +275,14 @@ HRESULT CSourceStream::CheckMediaType(const CMediaType *pMediaType)
//
// By default we support only one type
// iPosition indexes are 0-n
-HRESULT CSourceStream::GetMediaType(int iPosition, __inout CMediaType *pMediaType)
-{
+HRESULT CSourceStream::GetMediaType(int iPosition, __inout CMediaType *pMediaType) {
CAutoLock lock(m_pFilter->pStateLock());
- if(iPosition < 0)
- {
+ if (iPosition<0) {
return E_INVALIDARG;
}
- if(iPosition > 0)
- {
+ if (iPosition>0) {
return VFW_S_NO_MORE_ITEMS;
}
return GetMediaType(pMediaType);
@@ -320,43 +293,38 @@ HRESULT CSourceStream::GetMediaType(int iPosition, __inout CMediaType *pMediaTyp
// Active
//
// The pin is active - start up the worker thread
-HRESULT CSourceStream::Active(void)
-{
+HRESULT CSourceStream::Active(void) {
CAutoLock lock(m_pFilter->pStateLock());
HRESULT hr;
- if(m_pFilter->IsActive())
- {
- return S_FALSE; // succeeded, but did not allocate resources (they already exist...)
+ if (m_pFilter->IsActive()) {
+ return S_FALSE; // succeeded, but did not allocate resources (they already exist...)
}
// do nothing if not connected - its ok not to connect to
// all pins of a source filter
- if(!IsConnected())
- {
+ if (!IsConnected()) {
return NOERROR;
}
hr = CBaseOutputPin::Active();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
ASSERT(!ThreadExists());
// start the thread
- if(!Create())
- {
+ if (!Create()) {
return E_FAIL;
}
// Tell thread to initialize. If OnThreadCreate Fails, so does this.
hr = Init();
- if(FAILED(hr))
- return hr;
+ if (FAILED(hr))
+ return hr;
return Pause();
}
@@ -367,8 +335,7 @@ HRESULT CSourceStream::Active(void)
//
// Pin is inactive - shut down the worker thread
// Waits for the worker to exit before returning.
-HRESULT CSourceStream::Inactive(void)
-{
+HRESULT CSourceStream::Inactive(void) {
CAutoLock lock(m_pFilter->pStateLock());
@@ -376,8 +343,7 @@ HRESULT CSourceStream::Inactive(void)
// do nothing if not connected - its ok not to connect to
// all pins of a source filter
- if(!IsConnected())
- {
+ if (!IsConnected()) {
return NOERROR;
}
@@ -385,27 +351,23 @@ HRESULT CSourceStream::Inactive(void)
// we may be stuck waiting for our own allocator!!!
hr = CBaseOutputPin::Inactive(); // call this first to Decommit the allocator
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
- if(ThreadExists())
- {
- hr = Stop();
+ if (ThreadExists()) {
+ hr = Stop();
- if(FAILED(hr))
- {
- return hr;
- }
+ if (FAILED(hr)) {
+ return hr;
+ }
- hr = Exit();
- if(FAILED(hr))
- {
- return hr;
- }
+ hr = Exit();
+ if (FAILED(hr)) {
+ return hr;
+ }
- Close(); // Wait for the thread to exit, then tidy up.
+ Close(); // Wait for the thread to exit, then tidy up.
}
// hr = CBaseOutputPin::Inactive(); // call this first to Decommit the allocator
@@ -422,31 +384,26 @@ HRESULT CSourceStream::Inactive(void)
//
// When this returns the thread exits
// Return codes > 0 indicate an error occured
-DWORD CSourceStream::ThreadProc(void)
-{
+DWORD CSourceStream::ThreadProc(void) {
HRESULT hr; // the return code from calls
Command com;
- do
- {
- com = GetRequest();
- if(com != CMD_INIT)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Thread expected init command")));
- Reply((DWORD) E_UNEXPECTED);
- }
- }
- while(com != CMD_INIT);
+ do {
+ com = GetRequest();
+ if (com != CMD_INIT) {
+ DbgLog((LOG_ERROR, 1, TEXT("Thread expected init command")));
+ Reply((DWORD) E_UNEXPECTED);
+ }
+ } while (com != CMD_INIT);
DbgLog((LOG_TRACE, 1, TEXT("CSourceStream worker thread initializing")));
hr = OnThreadCreate(); // perform set up tasks
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_ERROR, 1, TEXT("CSourceStream::OnThreadCreate failed. Aborting thread.")));
OnThreadDestroy();
- Reply(hr); // send failed return code from OnThreadCreate
+ Reply(hr); // send failed return code from OnThreadCreate
return 1;
}
@@ -454,41 +411,37 @@ DWORD CSourceStream::ThreadProc(void)
Reply(NOERROR);
Command cmd;
- do
- {
- cmd = GetRequest();
-
- switch(cmd)
- {
-
- case CMD_EXIT:
- Reply(NOERROR);
- break;
-
- case CMD_RUN:
- DbgLog((LOG_ERROR, 1, TEXT("CMD_RUN received before a CMD_PAUSE???")));
- // !!! fall through???
-
- case CMD_PAUSE:
- Reply(NOERROR);
- DoBufferProcessingLoop();
- break;
-
- case CMD_STOP:
- Reply(NOERROR);
- break;
-
- default:
- DbgLog((LOG_ERROR, 1, TEXT("Unknown command %d received!"), cmd));
- Reply((DWORD) E_NOTIMPL);
- break;
- }
- }
- while(cmd != CMD_EXIT);
+ do {
+ cmd = GetRequest();
+
+ switch (cmd) {
+
+ case CMD_EXIT:
+ Reply(NOERROR);
+ break;
+
+ case CMD_RUN:
+ DbgLog((LOG_ERROR, 1, TEXT("CMD_RUN received before a CMD_PAUSE???")));
+ // !!! fall through???
+
+ case CMD_PAUSE:
+ Reply(NOERROR);
+ DoBufferProcessingLoop();
+ break;
+
+ case CMD_STOP:
+ Reply(NOERROR);
+ break;
+
+ default:
+ DbgLog((LOG_ERROR, 1, TEXT("Unknown command %d received!"), cmd));
+ Reply((DWORD) E_NOTIMPL);
+ break;
+ }
+ } while (cmd != CMD_EXIT);
hr = OnThreadDestroy(); // tidy up.
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_ERROR, 1, TEXT("CSourceStream::OnThreadDestroy failed. Exiting thread.")));
return 1;
}
@@ -503,79 +456,66 @@ DWORD CSourceStream::ThreadProc(void)
//
// Grabs a buffer and calls the users processing function.
// Overridable, so that different delivery styles can be catered for.
-HRESULT CSourceStream::DoBufferProcessingLoop(void)
-{
+HRESULT CSourceStream::DoBufferProcessingLoop(void) {
Command com;
OnThreadStartPlay();
- do
- {
- while(!CheckRequest(&com))
- {
+ do {
+ while (!CheckRequest(&com)) {
- IMediaSample *pSample;
+ IMediaSample *pSample;
- HRESULT hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0);
- if(FAILED(hr))
- {
+ HRESULT hr = GetDeliveryBuffer(&pSample,NULL,NULL,0);
+ if (FAILED(hr)) {
Sleep(1);
- continue; // go round again. Perhaps the error will go away
- // or the allocator is decommited & we will be asked to
- // exit soon.
- }
+ continue; // go round again. Perhaps the error will go away
+ // or the allocator is decommited & we will be asked to
+ // exit soon.
+ }
- // Virtual function user will override.
- hr = FillBuffer(pSample);
+ // Virtual function user will override.
+ hr = FillBuffer(pSample);
- if(hr == S_OK)
- {
- hr = Deliver(pSample);
+ if (hr == S_OK) {
+ hr = Deliver(pSample);
pSample->Release();
// downstream filter returns S_FALSE if it wants us to
// stop or an error if it's reporting an error.
if(hr != S_OK)
{
- DbgLog((LOG_TRACE, 2, TEXT("Deliver() returned %08x; stopping"), hr));
- return S_OK;
+ DbgLog((LOG_TRACE, 2, TEXT("Deliver() returned %08x; stopping"), hr));
+ return S_OK;
}
- }
- else if(hr == S_FALSE)
- {
+ } else if (hr == S_FALSE) {
// derived class wants us to stop pushing data
- pSample->Release();
- DeliverEndOfStream();
- return S_OK;
- }
- else
- {
+ pSample->Release();
+ DeliverEndOfStream();
+ return S_OK;
+ } else {
// derived class encountered an error
pSample->Release();
- DbgLog((LOG_ERROR, 1, TEXT("Error %08lX from FillBuffer!!!"), hr));
+ DbgLog((LOG_ERROR, 1, TEXT("Error %08lX from FillBuffer!!!"), hr));
DeliverEndOfStream();
m_pFilter->NotifyEvent(EC_ERRORABORT, hr, 0);
return hr;
- }
+ }
// all paths release the sample
- }
+ }
// For all commands sent to us there must be a Reply call!
- if(com == CMD_RUN || com == CMD_PAUSE)
- {
- Reply(NOERROR);
- }
- else if(com != CMD_STOP)
- {
- Reply((DWORD) E_UNEXPECTED);
- DbgLog((LOG_ERROR, 1, TEXT("Unexpected command!!!")));
- }
- }
- while(com != CMD_STOP);
+ if (com == CMD_RUN || com == CMD_PAUSE) {
+ Reply(NOERROR);
+ } else if (com != CMD_STOP) {
+ Reply((DWORD) E_UNEXPECTED);
+ DbgLog((LOG_ERROR, 1, TEXT("Unexpected command!!!")));
+ }
+ } while (com != CMD_STOP);
return S_FALSE;
}
diff --git a/src/filters/BaseClasses/source.h b/src/filters/BaseClasses/source.h
index 33e23064a..528d5bcbf 100644
--- a/src/filters/BaseClasses/source.h
+++ b/src/filters/BaseClasses/source.h
@@ -40,8 +40,7 @@ class CSourceStream; // The class that will handle each pin
//
// Override construction to provide a means of creating
// CSourceStream derived objects - ie a way of creating pins.
-class CSource : public CBaseFilter
-{
+class CSource : public CBaseFilter {
public:
CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr);
@@ -57,10 +56,7 @@ public:
// -- Utilities --
- CCritSec* pStateLock(void)
- {
- return &m_cStateLock; // provide our critical section
- }
+ CCritSec* pStateLock(void) { return &m_cStateLock; } // provide our critical section
HRESULT AddPin(__in CSourceStream *);
HRESULT RemovePin(__in CSourceStream *);
@@ -71,11 +67,11 @@ public:
);
int FindPinNumber(__in IPin *iPin);
-
+
protected:
int m_iPins; // The number of pins on this filter. Updated by CSourceStream
- // constructors & destructors.
+ // constructors & destructors.
CSourceStream **m_paStreams; // the pins on this filter.
CCritSec m_cStateLock; // Lock this to serialize function accesses to the filter state
@@ -89,8 +85,7 @@ protected:
// Use this class to manage a stream of data that comes from a
// pin.
// Uses a worker thread to put data on the pin.
-class CSourceStream : public CAMThread, public CBaseOutputPin
-{
+class CSourceStream : public CAMThread, public CBaseOutputPin {
public:
CSourceStream(__in_opt LPCTSTR pObjectName,
@@ -124,18 +119,9 @@ protected:
// Called as the thread is created/destroyed - use to perform
// jobs such as start/stop streaming mode
// If OnThreadCreate returns an error the thread will exit.
- virtual HRESULT OnThreadCreate(void)
- {
- return NOERROR;
- };
- virtual HRESULT OnThreadDestroy(void)
- {
- return NOERROR;
- };
- virtual HRESULT OnThreadStartPlay(void)
- {
- return NOERROR;
- };
+ virtual HRESULT OnThreadCreate(void) {return NOERROR;};
+ virtual HRESULT OnThreadDestroy(void) {return NOERROR;};
+ virtual HRESULT OnThreadStartPlay(void) {return NOERROR;};
// *
// * Worker Thread
@@ -147,36 +133,15 @@ protected:
public:
// thread commands
enum Command {CMD_INIT, CMD_PAUSE, CMD_RUN, CMD_STOP, CMD_EXIT};
- HRESULT Init(void)
- {
- return CallWorker(CMD_INIT);
- }
- HRESULT Exit(void)
- {
- return CallWorker(CMD_EXIT);
- }
- HRESULT Run(void)
- {
- return CallWorker(CMD_RUN);
- }
- HRESULT Pause(void)
- {
- return CallWorker(CMD_PAUSE);
- }
- HRESULT Stop(void)
- {
- return CallWorker(CMD_STOP);
- }
+ HRESULT Init(void) { return CallWorker(CMD_INIT); }
+ HRESULT Exit(void) { return CallWorker(CMD_EXIT); }
+ HRESULT Run(void) { return CallWorker(CMD_RUN); }
+ HRESULT Pause(void) { return CallWorker(CMD_PAUSE); }
+ HRESULT Stop(void) { return CallWorker(CMD_STOP); }
protected:
- Command GetRequest(void)
- {
- return (Command) CAMThread::GetRequest();
- }
- BOOL CheckRequest(Command *pCom)
- {
- return CAMThread::CheckRequest((DWORD *) pCom);
- }
+ Command GetRequest(void) { return (Command) CAMThread::GetRequest(); }
+ BOOL CheckRequest(Command *pCom) { return CAMThread::CheckRequest( (DWORD *) pCom); }
// override these if you want to add thread commands
virtual DWORD ThreadProc(void); // the thread function
@@ -196,10 +161,7 @@ protected:
// This will only be called by the default implementations
// of CheckMediaType and GetMediaType(int, CMediaType*)
// You must override this fn. or the above 2!
- virtual HRESULT GetMediaType(__inout CMediaType *pMediaType)
- {
- return E_UNEXPECTED;
- }
+ virtual HRESULT GetMediaType(__inout CMediaType *pMediaType) {return E_UNEXPECTED;}
STDMETHODIMP QueryId(
__deref_out LPWSTR * Id
diff --git a/src/filters/BaseClasses/streams.h b/src/filters/BaseClasses/streams.h
index b31e02e5c..7d1afd0d5 100644
--- a/src/filters/BaseClasses/streams.h
+++ b/src/filters/BaseClasses/streams.h
@@ -45,10 +45,10 @@
#ifndef NUMELMS
#if _WIN32_WINNT < 0x0600
-#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
+ #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#else
-#define NUMELMS(aa) ARRAYSIZE(aa)
-#endif
+ #define NUMELMS(aa) ARRAYSIZE(aa)
+#endif
#endif
///////////////////////////////////////////////////////////////////////////
@@ -56,23 +56,21 @@
// the applicaiton is being compiled with the headers from Visual C++ 6.0.
/////////////////////////////////////////////////// ////////////////////////
#ifndef InterlockedExchangePointer
-#define InterlockedExchangePointer(Target, Value) \
+ #define InterlockedExchangePointer(Target, Value) \
(PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value))
#endif
#ifndef _WAVEFORMATEXTENSIBLE_
#define _WAVEFORMATEXTENSIBLE_
-typedef struct
-{
+typedef struct {
WAVEFORMATEX Format;
- union
- {
+ union {
WORD wValidBitsPerSample; /* bits of precision */
WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
WORD wReserved; /* If neither applies, set to zero. */
} Samples;
DWORD dwChannelMask; /* which channels are */
- /* present in stream */
+ /* present in stream */
GUID SubFormat;
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
#endif // !_WAVEFORMATEXTENSIBLE_
@@ -82,48 +80,48 @@ typedef struct
#endif // !defined(WAVE_FORMAT_EXTENSIBLE)
#ifndef GetWindowLongPtr
-#define GetWindowLongPtrA GetWindowLongA
-#define GetWindowLongPtrW GetWindowLongW
-#ifdef UNICODE
-#define GetWindowLongPtr GetWindowLongPtrW
-#else
-#define GetWindowLongPtr GetWindowLongPtrA
-#endif // !UNICODE
+ #define GetWindowLongPtrA GetWindowLongA
+ #define GetWindowLongPtrW GetWindowLongW
+ #ifdef UNICODE
+ #define GetWindowLongPtr GetWindowLongPtrW
+ #else
+ #define GetWindowLongPtr GetWindowLongPtrA
+ #endif // !UNICODE
#endif // !GetWindowLongPtr
#ifndef SetWindowLongPtr
-#define SetWindowLongPtrA SetWindowLongA
-#define SetWindowLongPtrW SetWindowLongW
-#ifdef UNICODE
-#define SetWindowLongPtr SetWindowLongPtrW
-#else
-#define SetWindowLongPtr SetWindowLongPtrA
-#endif // !UNICODE
+ #define SetWindowLongPtrA SetWindowLongA
+ #define SetWindowLongPtrW SetWindowLongW
+ #ifdef UNICODE
+ #define SetWindowLongPtr SetWindowLongPtrW
+ #else
+ #define SetWindowLongPtr SetWindowLongPtrA
+ #endif // !UNICODE
#endif // !SetWindowLongPtr
#ifndef GWLP_WNDPROC
-#define GWLP_WNDPROC (-4)
+ #define GWLP_WNDPROC (-4)
#endif
#ifndef GWLP_HINSTANCE
-#define GWLP_HINSTANCE (-6)
+ #define GWLP_HINSTANCE (-6)
#endif
#ifndef GWLP_HWNDPARENT
-#define GWLP_HWNDPARENT (-8)
+ #define GWLP_HWNDPARENT (-8)
#endif
#ifndef GWLP_USERDATA
-#define GWLP_USERDATA (-21)
+ #define GWLP_USERDATA (-21)
#endif
#ifndef GWLP_ID
-#define GWLP_ID (-12)
+ #define GWLP_ID (-12)
#endif
#ifndef DWLP_MSGRESULT
-#define DWLP_MSGRESULT 0
+ #define DWLP_MSGRESULT 0
#endif
-#ifndef DWLP_DLGPROC
-#define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT)
+#ifndef DWLP_DLGPROC
+ #define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT)
#endif
#ifndef DWLP_USER
-#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC)
+ #define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC)
#endif
@@ -197,8 +195,8 @@ LONG_PTR _SetWindowLongPtr(HWND hwnd, int nIndex, T p)
#else
-#ifdef _DEBUG
-#pragma message("STREAMS.H included TWICE")
-#endif
+ #ifdef _DEBUG
+ #pragma message("STREAMS.H included TWICE")
+ #endif
#endif // __STREAMS__
diff --git a/src/filters/BaseClasses/strmctl.cpp b/src/filters/BaseClasses/strmctl.cpp
index e59e0e154..b7f595217 100644
--- a/src/filters/BaseClasses/strmctl.cpp
+++ b/src/filters/BaseClasses/strmctl.cpp
@@ -11,17 +11,17 @@
#include <strmctl.h>
CBaseStreamControl::CBaseStreamControl(__inout HRESULT *phr)
- : m_StreamState(STREAM_FLOWING)
- , m_StreamStateOnStop(STREAM_FLOWING) // means no pending stop
- , m_tStartTime(MAX_TIME)
- , m_tStopTime(MAX_TIME)
- , m_StreamEvent(FALSE, phr)
- , m_dwStartCookie(0)
- , m_dwStopCookie(0)
- , m_pRefClock(NULL)
- , m_FilterState(State_Stopped)
- , m_bIsFlushing(FALSE)
- , m_bStopSendExtra(FALSE)
+: m_StreamState(STREAM_FLOWING)
+, m_StreamStateOnStop(STREAM_FLOWING) // means no pending stop
+, m_tStartTime(MAX_TIME)
+, m_tStopTime(MAX_TIME)
+, m_StreamEvent(FALSE, phr)
+, m_dwStartCookie(0)
+, m_dwStopCookie(0)
+, m_pRefClock(NULL)
+, m_FilterState(State_Stopped)
+, m_bIsFlushing(FALSE)
+, m_bStopSendExtra(FALSE)
{}
CBaseStreamControl::~CBaseStreamControl()
@@ -37,30 +37,28 @@ STDMETHODIMP CBaseStreamControl::StopAt(const REFERENCE_TIME * ptStop, BOOL bSen
CAutoLock lck(&m_CritSec);
m_bStopSendExtra = FALSE; // reset
m_bStopExtraSent = FALSE;
- if(ptStop)
+ if (ptStop)
{
- if(*ptStop == MAX_TIME)
+ if (*ptStop == MAX_TIME)
{
- DbgLog((LOG_TRACE, 2, TEXT("StopAt: Cancel stop")));
+ DbgLog((LOG_TRACE,2,TEXT("StopAt: Cancel stop")));
CancelStop();
- // If there's now a command to start in the future, we assume
- // they want to be stopped when the graph is first run
- if(m_FilterState == State_Stopped && m_tStartTime < MAX_TIME)
- {
- m_StreamState = STREAM_DISCARDING;
- DbgLog((LOG_TRACE, 2, TEXT("graph will begin by DISCARDING")));
- }
+ // If there's now a command to start in the future, we assume
+ // they want to be stopped when the graph is first run
+ if (m_FilterState == State_Stopped && m_tStartTime < MAX_TIME) {
+ m_StreamState = STREAM_DISCARDING;
+ DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING")));
+ }
return NOERROR;
}
- DbgLog((LOG_TRACE, 2, TEXT("StopAt: %dms extra=%d"),
- (int)(*ptStop / 10000), bSendExtra));
- // if the first command is to stop in the future, then we assume they
+ DbgLog((LOG_TRACE,2,TEXT("StopAt: %dms extra=%d"),
+ (int)(*ptStop/10000), bSendExtra));
+ // if the first command is to stop in the future, then we assume they
// want to be started when the graph is first run
- if(m_FilterState == State_Stopped && m_tStartTime > *ptStop)
- {
- m_StreamState = STREAM_FLOWING;
- DbgLog((LOG_TRACE, 2, TEXT("graph will begin by FLOWING")));
- }
+ if (m_FilterState == State_Stopped && m_tStartTime > *ptStop) {
+ m_StreamState = STREAM_FLOWING;
+ DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING")));
+ }
m_bStopSendExtra = bSendExtra;
m_tStopTime = *ptStop;
m_dwStopCookie = dwCookie;
@@ -68,8 +66,8 @@ STDMETHODIMP CBaseStreamControl::StopAt(const REFERENCE_TIME * ptStop, BOOL bSen
}
else
{
- DbgLog((LOG_TRACE, 2, TEXT("StopAt: now")));
- // sending an extra frame when told to stop now would mess people up
+ DbgLog((LOG_TRACE,2,TEXT("StopAt: now")));
+ // sending an extra frame when told to stop now would mess people up
m_bStopSendExtra = FALSE;
m_tStopTime = MAX_TIME;
m_dwStopCookie = 0;
@@ -82,39 +80,37 @@ STDMETHODIMP CBaseStreamControl::StopAt(const REFERENCE_TIME * ptStop, BOOL bSen
}
STDMETHODIMP CBaseStreamControl::StartAt
-(const REFERENCE_TIME *ptStart, DWORD dwCookie)
+( const REFERENCE_TIME *ptStart, DWORD dwCookie )
{
CAutoLock lck(&m_CritSec);
- if(ptStart)
+ if (ptStart)
{
- if(*ptStart == MAX_TIME)
+ if (*ptStart == MAX_TIME)
{
- DbgLog((LOG_TRACE, 2, TEXT("StartAt: Cancel start")));
+ DbgLog((LOG_TRACE,2,TEXT("StartAt: Cancel start")));
CancelStart();
- // If there's now a command to stop in the future, we assume
- // they want to be started when the graph is first run
- if(m_FilterState == State_Stopped && m_tStopTime < MAX_TIME)
- {
- DbgLog((LOG_TRACE, 2, TEXT("graph will begin by FLOWING")));
- m_StreamState = STREAM_FLOWING;
- }
+ // If there's now a command to stop in the future, we assume
+ // they want to be started when the graph is first run
+ if (m_FilterState == State_Stopped && m_tStopTime < MAX_TIME) {
+ DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING")));
+ m_StreamState = STREAM_FLOWING;
+ }
return NOERROR;
}
- DbgLog((LOG_TRACE, 2, TEXT("StartAt: %dms"), (int)(*ptStart / 10000)));
- // if the first command is to start in the future, then we assume they
+ DbgLog((LOG_TRACE,2,TEXT("StartAt: %dms"), (int)(*ptStart/10000)));
+ // if the first command is to start in the future, then we assume they
// want to be stopped when the graph is first run
- if(m_FilterState == State_Stopped && m_tStopTime >= *ptStart)
- {
- DbgLog((LOG_TRACE, 2, TEXT("graph will begin by DISCARDING")));
- m_StreamState = STREAM_DISCARDING;
- }
+ if (m_FilterState == State_Stopped && m_tStopTime >= *ptStart) {
+ DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING")));
+ m_StreamState = STREAM_DISCARDING;
+ }
m_tStartTime = *ptStart;
m_dwStartCookie = dwCookie;
// if (m_tStopTime == m_tStartTime) CancelStop();
}
else
{
- DbgLog((LOG_TRACE, 2, TEXT("StartAt: now")));
+ DbgLog((LOG_TRACE,2,TEXT("StartAt: now")));
m_tStartTime = MAX_TIME;
m_dwStartCookie = 0;
m_StreamState = STREAM_FLOWING;
@@ -127,8 +123,8 @@ STDMETHODIMP CBaseStreamControl::StartAt
// Retrieve information about current settings
STDMETHODIMP CBaseStreamControl::GetInfo(__out AM_STREAM_INFO *pInfo)
{
- if(pInfo == NULL)
- return E_POINTER;
+ if (pInfo == NULL)
+ return E_POINTER;
pInfo->tStart = m_tStartTime;
pInfo->tStop = m_tStopTime;
@@ -137,8 +133,7 @@ STDMETHODIMP CBaseStreamControl::GetInfo(__out AM_STREAM_INFO *pInfo)
pInfo->dwFlags = m_bStopSendExtra ? AM_STREAM_INFO_STOP_SEND_EXTRA : 0;
pInfo->dwFlags |= m_tStartTime == MAX_TIME ? 0 : AM_STREAM_INFO_START_DEFINED;
pInfo->dwFlags |= m_tStopTime == MAX_TIME ? 0 : AM_STREAM_INFO_STOP_DEFINED;
- switch(m_StreamState)
- {
+ switch (m_StreamState) {
default:
DbgBreak("Invalid stream state");
case STREAM_FLOWING:
@@ -155,10 +150,9 @@ void CBaseStreamControl::ExecuteStop()
{
ASSERT(CritCheckIn(&m_CritSec));
m_StreamState = m_StreamStateOnStop;
- if(m_dwStopCookie && m_pSink)
- {
- DbgLog((LOG_TRACE, 2, TEXT("*sending EC_STREAM_CONTROL_STOPPED (%d)"),
- m_dwStopCookie));
+ if (m_dwStopCookie && m_pSink) {
+ DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STOPPED (%d)"),
+ m_dwStopCookie));
m_pSink->Notify(EC_STREAM_CONTROL_STOPPED, (LONG_PTR)this, m_dwStopCookie);
}
CancelStop(); // This will do the tidy up
@@ -168,10 +162,9 @@ void CBaseStreamControl::ExecuteStart()
{
ASSERT(CritCheckIn(&m_CritSec));
m_StreamState = STREAM_FLOWING;
- if(m_dwStartCookie)
- {
- DbgLog((LOG_TRACE, 2, TEXT("*sending EC_STREAM_CONTROL_STARTED (%d)"),
- m_dwStartCookie));
+ if (m_dwStartCookie) {
+ DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STARTED (%d)"),
+ m_dwStartCookie));
m_pSink->Notify(EC_STREAM_CONTROL_STARTED, (LONG_PTR)this, m_dwStartCookie);
}
CancelStart(); // This will do the tidy up
@@ -239,7 +232,7 @@ void CBaseStreamControl::CancelStart()
enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckSampleTimes
-(__in const REFERENCE_TIME * pSampleStart, __in const REFERENCE_TIME * pSampleStop)
+( __in const REFERENCE_TIME * pSampleStart, __in const REFERENCE_TIME * pSampleStop )
{
CAutoLock lck(&m_CritSec);
@@ -249,170 +242,152 @@ enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckSampleTimes
// Don't ask me how I came up with the code below to handle all 19 cases
// - DannyMi
- if(m_tStopTime >= *pSampleStart)
+ if (m_tStopTime >= *pSampleStart)
{
- if(m_tStartTime >= *pSampleStop)
- return m_StreamState; // cases 8 11 12 15 17 18 19
- if(m_tStopTime < m_tStartTime)
- ExecuteStop(); // case 10
- ExecuteStart(); // cases 3 5 7 9 13 14
- return m_StreamState;
+ if (m_tStartTime >= *pSampleStop)
+ return m_StreamState; // cases 8 11 12 15 17 18 19
+ if (m_tStopTime < m_tStartTime)
+ ExecuteStop(); // case 10
+ ExecuteStart(); // cases 3 5 7 9 13 14
+ return m_StreamState;
}
- if(m_tStartTime >= *pSampleStop)
+ if (m_tStartTime >= *pSampleStop)
{
ExecuteStop(); // cases 6 16
return m_StreamState;
}
- if(m_tStartTime <= m_tStopTime)
+ if (m_tStartTime <= m_tStopTime)
{
- ExecuteStart();
- ExecuteStop();
+ ExecuteStart();
+ ExecuteStop();
return m_StreamState; // case 1
}
else
{
- ExecuteStop();
- ExecuteStart();
+ ExecuteStop();
+ ExecuteStart();
return m_StreamState; // cases 2 4
}
}
-enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckStreamState(IMediaSample * pSample)
+enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckStreamState( IMediaSample * pSample )
{
REFERENCE_TIME rtBufferStart, rtBufferStop;
const BOOL bNoBufferTimes =
- pSample == NULL ||
- FAILED(pSample->GetTime(&rtBufferStart, &rtBufferStop));
+ pSample == NULL ||
+ FAILED(pSample->GetTime(&rtBufferStart, &rtBufferStop));
StreamControlState state;
LONG lWait;
do
- {
- // something has to break out of the blocking
- if(m_bIsFlushing || m_FilterState == State_Stopped)
- return STREAM_DISCARDING;
-
- if(bNoBufferTimes)
- {
- // Can't do anything until we get a time stamp
- state = m_StreamState;
- break;
- }
- else
{
- state = CheckSampleTimes(&rtBufferStart, &rtBufferStop);
- if(state == STREAM_FLOWING)
- break;
+ // something has to break out of the blocking
+ if (m_bIsFlushing || m_FilterState == State_Stopped)
+ return STREAM_DISCARDING;
- // we aren't supposed to send this, but we've been
- // told to send one more than we were supposed to
- // (and the stop isn't still pending and we're streaming)
- if(m_bStopSendExtra && !m_bStopExtraSent &&
- m_tStopTime == MAX_TIME &&
- m_FilterState != State_Stopped)
- {
- m_bStopExtraSent = TRUE;
- DbgLog((LOG_TRACE, 2, TEXT("%d sending an EXTRA frame"),
- m_dwStopCookie));
- state = STREAM_FLOWING;
+ if (bNoBufferTimes) {
+ // Can't do anything until we get a time stamp
+ state = m_StreamState;
break;
+ } else {
+ state = CheckSampleTimes( &rtBufferStart, &rtBufferStop );
+ if (state == STREAM_FLOWING)
+ break;
+
+ // we aren't supposed to send this, but we've been
+ // told to send one more than we were supposed to
+ // (and the stop isn't still pending and we're streaming)
+ if (m_bStopSendExtra && !m_bStopExtraSent &&
+ m_tStopTime == MAX_TIME &&
+ m_FilterState != State_Stopped) {
+ m_bStopExtraSent = TRUE;
+ DbgLog((LOG_TRACE,2,TEXT("%d sending an EXTRA frame"),
+ m_dwStopCookie));
+ state = STREAM_FLOWING;
+ break;
+ }
}
- }
- // We're in discarding mode
+ // We're in discarding mode
- // If we've no clock, discard as fast as we can
- if(!m_pRefClock)
- {
- break;
+ // If we've no clock, discard as fast as we can
+ if (!m_pRefClock) {
+ break;
- // If we're paused, we can't discard in a timely manner because
- // there's no such thing as stream times. We must block until
- // we run or stop, or we'll end up throwing the whole stream away
- // as quickly as possible
- }
- else if(m_FilterState == State_Paused)
- {
- lWait = INFINITE;
+ // If we're paused, we can't discard in a timely manner because
+ // there's no such thing as stream times. We must block until
+ // we run or stop, or we'll end up throwing the whole stream away
+ // as quickly as possible
+ } else if (m_FilterState == State_Paused) {
+ lWait = INFINITE;
- }
- else
- {
- // wait until it's time for the sample until we say "discard"
- // ("discard in a timely fashion")
- REFERENCE_TIME rtNow;
- EXECUTE_ASSERT(SUCCEEDED(m_pRefClock->GetTime(&rtNow)));
- rtNow -= m_tRunStart; // Into relative ref-time
- lWait = LONG((rtBufferStart - rtNow) / 10000); // 100ns -> ms
- if(lWait < 10) break; // Not worth waiting - discard early
- }
+ } else {
+ // wait until it's time for the sample until we say "discard"
+ // ("discard in a timely fashion")
+ REFERENCE_TIME rtNow;
+ EXECUTE_ASSERT(SUCCEEDED(m_pRefClock->GetTime(&rtNow)));
+ rtNow -= m_tRunStart; // Into relative ref-time
+ lWait = LONG((rtBufferStart - rtNow)/10000); // 100ns -> ms
+ if (lWait < 10) break; // Not worth waiting - discard early
+ }
- }
- while(WaitForSingleObject(GetStreamEventHandle(), lWait) != WAIT_TIMEOUT);
+ } while(WaitForSingleObject(GetStreamEventHandle(), lWait) != WAIT_TIMEOUT);
return state;
}
-void CBaseStreamControl::NotifyFilterState(FILTER_STATE new_state, REFERENCE_TIME tStart)
+void CBaseStreamControl::NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart )
{
CAutoLock lck(&m_CritSec);
// or we will get confused
- if(m_FilterState == new_state)
- return;
+ if (m_FilterState == new_state)
+ return;
- switch(new_state)
+ switch (new_state)
{
- case State_Stopped:
-
- DbgLog((LOG_TRACE, 2, TEXT("Filter is STOPPED")));
-
- // execute any pending starts and stops in the right order,
- // to make sure all notifications get sent, and we end up
- // in the right state to begin next time (??? why not?)
-
- if(m_tStartTime != MAX_TIME && m_tStopTime == MAX_TIME)
- {
- ExecuteStart();
- }
- else if(m_tStopTime != MAX_TIME && m_tStartTime == MAX_TIME)
- {
- ExecuteStop();
- }
- else if(m_tStopTime != MAX_TIME && m_tStartTime != MAX_TIME)
- {
- if(m_tStartTime <= m_tStopTime)
- {
- ExecuteStart();
- ExecuteStop();
- }
- else
- {
- ExecuteStop();
- ExecuteStart();
- }
- }
- // always start off flowing when the graph starts streaming
- // unless told otherwise
- m_StreamState = STREAM_FLOWING;
- m_FilterState = new_state;
- break;
+ case State_Stopped:
+
+ DbgLog((LOG_TRACE,2,TEXT("Filter is STOPPED")));
+
+ // execute any pending starts and stops in the right order,
+ // to make sure all notifications get sent, and we end up
+ // in the right state to begin next time (??? why not?)
+
+ if (m_tStartTime != MAX_TIME && m_tStopTime == MAX_TIME) {
+ ExecuteStart();
+ } else if (m_tStopTime != MAX_TIME && m_tStartTime == MAX_TIME) {
+ ExecuteStop();
+ } else if (m_tStopTime != MAX_TIME && m_tStartTime != MAX_TIME) {
+ if (m_tStartTime <= m_tStopTime) {
+ ExecuteStart();
+ ExecuteStop();
+ } else {
+ ExecuteStop();
+ ExecuteStart();
+ }
+ }
+ // always start off flowing when the graph starts streaming
+ // unless told otherwise
+ m_StreamState = STREAM_FLOWING;
+ m_FilterState = new_state;
+ break;
- case State_Running:
+ case State_Running:
- DbgLog((LOG_TRACE, 2, TEXT("Filter is RUNNING")));
+ DbgLog((LOG_TRACE,2,TEXT("Filter is RUNNING")));
- m_tRunStart = tStart;
- // fall-through
+ m_tRunStart = tStart;
+ // fall-through
- default: // case State_Paused:
- m_FilterState = new_state;
+ default: // case State_Paused:
+ m_FilterState = new_state;
}
// unblock!
m_StreamEvent.Set();
diff --git a/src/filters/BaseClasses/strmctl.h b/src/filters/BaseClasses/strmctl.h
index 5caabaaee..cb2adf308 100644
--- a/src/filters/BaseClasses/strmctl.h
+++ b/src/filters/BaseClasses/strmctl.h
@@ -15,15 +15,14 @@ class CBaseStreamControl : public IAMStreamControl
public:
// Used by the implementation
enum StreamControlState
- {
- STREAM_FLOWING = 0x1000,
- STREAM_DISCARDING
+ { STREAM_FLOWING = 0x1000,
+ STREAM_DISCARDING
};
private:
enum StreamControlState m_StreamState; // Current stream state
enum StreamControlState m_StreamStateOnStop; // State after next stop
- // (i.e.Blocking or Discarding)
+ // (i.e.Blocking or Discarding)
REFERENCE_TIME m_tStartTime; // MAX_TIME implies none
REFERENCE_TIME m_tStopTime; // MAX_TIME implies none
@@ -52,14 +51,14 @@ private:
// Your pin must also expose IAMStreamControl when QI'd for it!
//
IReferenceClock * m_pRefClock; // Need it to set advises
- // Filter must tell us via
- // SetSyncSource
+ // Filter must tell us via
+ // SetSyncSource
IMediaEventSink * m_pSink; // Event sink
- // Filter must tell us after it
- // creates it in JoinFilterGraph()
+ // Filter must tell us after it
+ // creates it in JoinFilterGraph()
FILTER_STATE m_FilterState; // Just need it!
- // Filter must tell us via
- // NotifyFilterState
+ // Filter must tell us via
+ // NotifyFilterState
REFERENCE_TIME m_tRunStart; // Per the Run call to the filter
// This guy will return one of the three StreamControlState's. Here's what
@@ -72,8 +71,8 @@ private:
// expires, throw the sample away. If the event
// fires, call me back - I've changed my mind.
//
- enum StreamControlState CheckSampleTimes(__in const REFERENCE_TIME * pSampleStart,
- __in const REFERENCE_TIME * pSampleStop);
+ enum StreamControlState CheckSampleTimes( __in const REFERENCE_TIME * pSampleStart,
+ __in const REFERENCE_TIME * pSampleStop );
public:
// You don't have to tell us much when we're created, but there are other
@@ -91,26 +90,25 @@ public:
// We need a clock to see what time it is. This is for the
// "discard in a timely fashion" logic. If we discard everything as
// quick as possible, a whole 60 minute file could get discarded in the
- // first 10 seconds, and if somebody wants to turn streaming on at 30
+ // first 10 seconds, and if somebody wants to turn streaming on at 30
// minutes into the file, and they make the call more than a few seconds
// after the graph is run, it may be too late!
// So we hold every sample until it's time has gone, then we discard it.
// The filter should call this when it gets a SetSyncSource
//
- void SetSyncSource(IReferenceClock * pRefClock)
+ void SetSyncSource( IReferenceClock * pRefClock )
{
- CAutoLock lck(&m_CritSec);
- if(m_pRefClock) m_pRefClock->Release();
- m_pRefClock = pRefClock;
- if(m_pRefClock) m_pRefClock->AddRef();
+ CAutoLock lck(&m_CritSec);
+ if (m_pRefClock) m_pRefClock->Release();
+ m_pRefClock = pRefClock;
+ if (m_pRefClock) m_pRefClock->AddRef();
}
// Set event sink for notifications
// The filter should call this in its JoinFilterGraph after it creates the
// IMediaEventSink
//
- void SetFilterGraph(IMediaEventSink *pSink)
- {
+ void SetFilterGraph( IMediaEventSink *pSink ) {
m_pSink = pSink;
}
@@ -118,12 +116,12 @@ public:
// state of our owning filter.
// The app should call this ever state change
//
- void NotifyFilterState(FILTER_STATE new_state, REFERENCE_TIME tStart = 0);
+ void NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart = 0 );
// Filter should call Flushing(TRUE) in BeginFlush,
// and Flushing(FALSE) in EndFlush.
//
- void Flushing(BOOL bInProgress);
+ void Flushing( BOOL bInProgress );
// The two main methods of IAMStreamControl
@@ -131,12 +129,12 @@ public:
// Class adds default values suitable for immediate
// muting and unmuting of the stream.
- STDMETHODIMP StopAt(const REFERENCE_TIME * ptStop = NULL,
- BOOL bSendExtra = FALSE,
- DWORD dwCookie = 0);
- STDMETHODIMP StartAt(const REFERENCE_TIME * ptStart = NULL,
- DWORD dwCookie = 0);
- STDMETHODIMP GetInfo(__out AM_STREAM_INFO *pInfo);
+ STDMETHODIMP StopAt( const REFERENCE_TIME * ptStop = NULL,
+ BOOL bSendExtra = FALSE,
+ DWORD dwCookie = 0 );
+ STDMETHODIMP StartAt( const REFERENCE_TIME * ptStart = NULL,
+ DWORD dwCookie = 0 );
+ STDMETHODIMP GetInfo( __out AM_STREAM_INFO *pInfo);
// Helper function for pin's receive method. Call this with
// the sample and we'll tell you what to do with it. We'll do a
@@ -145,24 +143,15 @@ public:
// caller to either flow it or discard it.
// If pSample is NULL we evaluate based on the current state
// settings
- enum StreamControlState CheckStreamState(IMediaSample * pSample);
+ enum StreamControlState CheckStreamState( IMediaSample * pSample );
private:
// These don't require locking, but we are relying on the fact that
// m_StreamState can be retrieved with integrity, and is a snap shot that
// may have just been, or may be just about to be, changed.
- HANDLE GetStreamEventHandle() const
- {
- return m_StreamEvent;
- }
- enum StreamControlState GetStreamState() const
- {
- return m_StreamState;
- }
- BOOL IsStreaming() const
- {
- return m_StreamState == STREAM_FLOWING;
- }
+ HANDLE GetStreamEventHandle() const { return m_StreamEvent; }
+ enum StreamControlState GetStreamState() const { return m_StreamState; }
+ BOOL IsStreaming() const { return m_StreamState == STREAM_FLOWING; }
};
#endif
diff --git a/src/filters/BaseClasses/sysclock.cpp b/src/filters/BaseClasses/sysclock.cpp
index a91084019..0d5829176 100644
--- a/src/filters/BaseClasses/sysclock.cpp
+++ b/src/filters/BaseClasses/sysclock.cpp
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// File: SysClock.cpp
//
-// Desc: DirectShow base classes - implements a system clock based on
+// Desc: DirectShow base classes - implements a system clock based on
// IReferenceClock.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -19,8 +19,7 @@
being created. The class factory will call the static CreateInstance
function when it is asked to create a CLSID_SystemClock object */
-CFactoryTemplate g_Templates[1] =
-{
+CFactoryTemplate g_Templates[1] = {
{&CLSID_SystemClock, CSystemClock::CreateInstance}
};
@@ -30,7 +29,7 @@ int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
/* This goes in the factory template table to create new instances */
CUnknown * WINAPI CSystemClock::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
{
- return new CSystemClock(NAME("System reference clock"), pUnk, phr);
+ return new CSystemClock(NAME("System reference clock"),pUnk, phr);
}
@@ -43,11 +42,11 @@ STDMETHODIMP CSystemClock::NonDelegatingQueryInterface(
REFIID riid,
__deref_out void ** ppv)
{
- if(riid == IID_IPersist)
+ if (riid == IID_IPersist)
{
return GetInterface(static_cast<IPersist *>(this), ppv);
}
- else if(riid == IID_IAMClockAdjust)
+ else if (riid == IID_IAMClockAdjust)
{
return GetInterface(static_cast<IAMClockAdjust *>(this), ppv);
}
@@ -61,14 +60,14 @@ STDMETHODIMP CSystemClock::NonDelegatingQueryInterface(
STDMETHODIMP
CSystemClock::GetClassID(__out CLSID *pClsID)
{
- CheckPointer(pClsID, E_POINTER);
- ValidateReadWritePtr(pClsID, sizeof(CLSID));
+ CheckPointer(pClsID,E_POINTER);
+ ValidateReadWritePtr(pClsID,sizeof(CLSID));
*pClsID = CLSID_SystemClock;
return NOERROR;
}
-STDMETHODIMP
+STDMETHODIMP
CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta)
{
return SetTimeDelta(rtDelta);
diff --git a/src/filters/BaseClasses/transfrm.cpp b/src/filters/BaseClasses/transfrm.cpp
index 7f262face..62b4cc3f4 100644
--- a/src/filters/BaseClasses/transfrm.cpp
+++ b/src/filters/BaseClasses/transfrm.cpp
@@ -19,7 +19,7 @@
CTransformFilter::CTransformFilter(__in_opt LPCTSTR pName,
__inout_opt LPUNKNOWN pUnk,
REFCLSID clsid) :
- CBaseFilter(pName, pUnk, &m_csFilter, clsid),
+ CBaseFilter(pName,pUnk,&m_csFilter, clsid),
m_pInput(NULL),
m_pOutput(NULL),
m_bEOSDelivered(FALSE),
@@ -35,7 +35,7 @@ CTransformFilter::CTransformFilter(__in_opt LPCTSTR pName,
CTransformFilter::CTransformFilter(__in_opt LPCSTR pName,
__inout_opt LPUNKNOWN pUnk,
REFCLSID clsid) :
- CBaseFilter(pName, pUnk, &m_csFilter, clsid),
+ CBaseFilter(pName,pUnk,&m_csFilter, clsid),
m_pInput(NULL),
m_pOutput(NULL),
m_bEOSDelivered(FALSE),
@@ -93,8 +93,7 @@ CTransformFilter::GetPin(int n)
// Create an input pin if necessary
- if(m_pInput == NULL)
- {
+ if (m_pInput == NULL) {
m_pInput = new CTransformInputPin(NAME("Transform input pin"),
this, // Owner filter
@@ -104,12 +103,11 @@ CTransformFilter::GetPin(int n)
// Can't fail
ASSERT(SUCCEEDED(hr));
- if(m_pInput == NULL)
- {
+ if (m_pInput == NULL) {
return NULL;
}
m_pOutput = (CTransformOutputPin *)
- new CTransformOutputPin(NAME("Transform output pin"),
+ new CTransformOutputPin(NAME("Transform output pin"),
this, // Owner filter
&hr, // Result code
L"XForm Out"); // Pin name
@@ -117,8 +115,7 @@ CTransformFilter::GetPin(int n)
// Can't fail
ASSERT(SUCCEEDED(hr));
- if(m_pOutput == NULL)
- {
+ if (m_pOutput == NULL) {
delete m_pInput;
m_pInput = NULL;
}
@@ -126,16 +123,12 @@ CTransformFilter::GetPin(int n)
// Return the appropriate pin
- if(n == 0)
- {
+ if (n == 0) {
return m_pInput;
- }
- else if(n == 1)
- {
+ } else
+ if (n == 1) {
return m_pOutput;
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -149,31 +142,23 @@ CTransformFilter::GetPin(int n)
STDMETHODIMP CTransformFilter::FindPin(LPCWSTR Id, __deref_out IPin **ppPin)
{
- CheckPointer(ppPin, E_POINTER);
- ValidateReadWritePtr(ppPin, sizeof(IPin *));
+ CheckPointer(ppPin,E_POINTER);
+ ValidateReadWritePtr(ppPin,sizeof(IPin *));
- if(0 == lstrcmpW(Id, L"In"))
- {
+ if (0==lstrcmpW(Id,L"In")) {
*ppPin = GetPin(0);
- }
- else if(0 == lstrcmpW(Id, L"Out"))
- {
+ } else if (0==lstrcmpW(Id,L"Out")) {
*ppPin = GetPin(1);
- }
- else
- {
+ } else {
*ppPin = NULL;
return VFW_E_NOT_FOUND;
}
HRESULT hr = NOERROR;
// AddRef() returned pointer - but GetPin could fail if memory is low.
- if(*ppPin)
- {
+ if (*ppPin) {
(*ppPin)->AddRef();
- }
- else
- {
+ } else {
hr = E_OUTOFMEMORY; // probably. There's no pin anyway.
}
return hr;
@@ -221,7 +206,7 @@ CTransformFilter::BreakConnect(PIN_DIRECTION dir)
// Let derived classes know about connection completion
HRESULT
-CTransformFilter::CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin)
+CTransformFilter::CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin)
{
UNREFERENCED_PARAMETER(direction);
UNREFERENCED_PARAMETER(pReceivePin);
@@ -232,7 +217,7 @@ CTransformFilter::CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin)
// override this to know when the media type is really set
HRESULT
-CTransformFilter::SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt)
+CTransformFilter::SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt)
{
UNREFERENCED_PARAMETER(direction);
UNREFERENCED_PARAMETER(pmt);
@@ -255,36 +240,33 @@ CTransformFilter::InitializeOutputSample(IMediaSample *pSample, __deref_out IMed
// when we can't do it without skipping frames because we're not on a
// keyframe. If it really has to switch us, it still will, but then we
// will have to wait for the next keyframe
- if(!(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT))
- {
- dwFlags |= AM_GBF_NOTASYNCPOINT;
+ if (!(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT)) {
+ dwFlags |= AM_GBF_NOTASYNCPOINT;
}
ASSERT(m_pOutput->m_pAllocator != NULL);
HRESULT hr = m_pOutput->m_pAllocator->GetBuffer(
- &pOutSample
- , pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID ?
- &pProps->tStart : NULL
- , pProps->dwSampleFlags & AM_SAMPLE_STOPVALID ?
- &pProps->tStop : NULL
- , dwFlags
- );
+ &pOutSample
+ , pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID ?
+ &pProps->tStart : NULL
+ , pProps->dwSampleFlags & AM_SAMPLE_STOPVALID ?
+ &pProps->tStop : NULL
+ , dwFlags
+ );
*ppOutSample = pOutSample;
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
ASSERT(pOutSample);
IMediaSample2 *pOutSample2;
- if(SUCCEEDED(pOutSample->QueryInterface(IID_IMediaSample2,
- (void **)&pOutSample2)))
- {
+ if (SUCCEEDED(pOutSample->QueryInterface(IID_IMediaSample2,
+ (void **)&pOutSample2))) {
/* Modify it */
AM_SAMPLE2_PROPERTIES OutProps;
EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(
- FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)
- ));
+ FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)
+ ));
OutProps.dwTypeSpecificFlags = pProps->dwTypeSpecificFlags;
OutProps.dwSampleFlags =
(OutProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED) |
@@ -293,37 +275,30 @@ CTransformFilter::InitializeOutputSample(IMediaSample *pSample, __deref_out IMed
OutProps.tStop = pProps->tStop;
OutProps.cbData = FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId);
hr = pOutSample2->SetProperties(
- FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId),
- (PBYTE)&OutProps
- );
- if(pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
- {
+ FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId),
+ (PBYTE)&OutProps
+ );
+ if (pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
m_bSampleSkipped = FALSE;
}
pOutSample2->Release();
- }
- else
- {
- if(pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID)
- {
+ } else {
+ if (pProps->dwSampleFlags & AM_SAMPLE_TIMEVALID) {
pOutSample->SetTime(&pProps->tStart,
&pProps->tStop);
}
- if(pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT)
- {
+ if (pProps->dwSampleFlags & AM_SAMPLE_SPLICEPOINT) {
pOutSample->SetSyncPoint(TRUE);
}
- if(pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
- {
+ if (pProps->dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) {
pOutSample->SetDiscontinuity(TRUE);
m_bSampleSkipped = FALSE;
}
// Copy the media times
LONGLONG MediaStart, MediaEnd;
- if(pSample->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
- {
- pOutSample->SetMediaTime(&MediaStart, &MediaEnd);
+ if (pSample->GetMediaTime(&MediaStart,&MediaEnd) == NOERROR) {
+ pOutSample->SetMediaTime(&MediaStart,&MediaEnd);
}
}
return S_OK;
@@ -336,8 +311,7 @@ CTransformFilter::Receive(IMediaSample *pSample)
{
/* Check for other streams and pass them on */
AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA)
- {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->m_pInputPin->Receive(pSample);
}
HRESULT hr;
@@ -346,13 +320,12 @@ CTransformFilter::Receive(IMediaSample *pSample)
// If no output to deliver to then no point sending us data
- ASSERT(m_pOutput != NULL) ;
+ ASSERT (m_pOutput != NULL) ;
// Set up the output sample
hr = InitializeOutputSample(pSample, &pOutSample);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -366,37 +339,29 @@ CTransformFilter::Receive(IMediaSample *pSample)
// Stop the clock and log it (if PERF is defined)
MSR_STOP(m_idTransform);
- if(FAILED(hr))
- {
- DbgLog((LOG_TRACE, 1, TEXT("Error from transform")));
- }
- else
- {
+ if (FAILED(hr)) {
+ DbgLog((LOG_TRACE,1,TEXT("Error from transform")));
+ } else {
// the Transform() function can return S_FALSE to indicate that the
// sample should not be delivered; we only deliver the sample if it's
// really S_OK (same as NOERROR, of course.)
- if(hr == NOERROR)
- {
- hr = m_pOutput->m_pInputPin->Receive(pOutSample);
+ if (hr == NOERROR) {
+ hr = m_pOutput->m_pInputPin->Receive(pOutSample);
m_bSampleSkipped = FALSE; // last thing no longer dropped
- }
- else
- {
+ } else {
// S_FALSE returned from Transform is a PRIVATE agreement
// We should return NOERROR from Receive() in this cause because returning S_FALSE
// from Receive() means that this is the end of the stream and no more data should
// be sent.
- if(S_FALSE == hr)
- {
+ if (S_FALSE == hr) {
// Release the sample before calling notify to avoid
// deadlocks if the sample holds a lock on the system
// such as DirectDraw buffers do
pOutSample->Release();
m_bSampleSkipped = TRUE;
- if(!m_bQualityChanged)
- {
- NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
+ if (!m_bQualityChanged) {
+ NotifyEvent(EC_QUALITY_CHANGE,0,0);
m_bQualityChanged = TRUE;
}
return NOERROR;
@@ -430,8 +395,7 @@ HRESULT
CTransformFilter::EndOfStream(void)
{
HRESULT hr = NOERROR;
- if(m_pOutput != NULL)
- {
+ if (m_pOutput != NULL) {
hr = m_pOutput->DeliverEndOfStream();
}
@@ -445,16 +409,15 @@ HRESULT
CTransformFilter::BeginFlush(void)
{
HRESULT hr = NOERROR;
- if(m_pOutput != NULL)
- {
- // block receives -- done by caller (CBaseInputPin::BeginFlush)
+ if (m_pOutput != NULL) {
+ // block receives -- done by caller (CBaseInputPin::BeginFlush)
- // discard queued data -- we have no queued data
+ // discard queued data -- we have no queued data
- // free anyone blocked on receive - not possible in this filter
+ // free anyone blocked on receive - not possible in this filter
- // call downstream
- hr = m_pOutput->DeliverBeginFlush();
+ // call downstream
+ hr = m_pOutput->DeliverBeginFlush();
}
return hr;
}
@@ -470,7 +433,7 @@ CTransformFilter::EndFlush(void)
// ensure no more data to go downstream -- we have no queued data
// call EndFlush on downstream pins
- ASSERT(m_pOutput != NULL);
+ ASSERT (m_pOutput != NULL);
return m_pOutput->DeliverEndFlush();
// caller (the input pin's method) will unblock Receives
@@ -483,20 +446,18 @@ STDMETHODIMP
CTransformFilter::Stop()
{
CAutoLock lck1(&m_csFilter);
- if(m_State == State_Stopped)
- {
+ if (m_State == State_Stopped) {
return NOERROR;
}
// Succeed the Stop if we are not completely connected
ASSERT(m_pInput == NULL || m_pOutput != NULL);
- if(m_pInput == NULL || m_pInput->IsConnected() == FALSE ||
- m_pOutput->IsConnected() == FALSE)
- {
- m_State = State_Stopped;
- m_bEOSDelivered = FALSE;
- return NOERROR;
+ if (m_pInput == NULL || m_pInput->IsConnected() == FALSE ||
+ m_pOutput->IsConnected() == FALSE) {
+ m_State = State_Stopped;
+ m_bEOSDelivered = FALSE;
+ return NOERROR;
}
ASSERT(m_pInput);
@@ -514,11 +475,10 @@ CTransformFilter::Stop()
// to know about starting and stopping streaming
HRESULT hr = StopStreaming();
- if(SUCCEEDED(hr))
- {
- // complete the state transition
- m_State = State_Stopped;
- m_bEOSDelivered = FALSE;
+ if (SUCCEEDED(hr)) {
+ // complete the state transition
+ m_State = State_Stopped;
+ m_bEOSDelivered = FALSE;
}
return hr;
}
@@ -530,8 +490,7 @@ CTransformFilter::Pause()
CAutoLock lck(&m_csFilter);
HRESULT hr = NOERROR;
- if(m_State == State_Paused)
- {
+ if (m_State == State_Paused) {
// (This space left deliberately blank)
}
@@ -540,10 +499,8 @@ CTransformFilter::Pause()
// This makes sure that it doesn't sit there forever waiting for
// samples which we cannot ever deliver without an input connection.
- else if(m_pInput == NULL || m_pInput->IsConnected() == FALSE)
- {
- if(m_pOutput && m_bEOSDelivered == FALSE)
- {
+ else if (m_pInput == NULL || m_pInput->IsConnected() == FALSE) {
+ if (m_pOutput && m_bEOSDelivered == FALSE) {
m_pOutput->DeliverEndOfStream();
m_bEOSDelivered = TRUE;
}
@@ -553,24 +510,20 @@ CTransformFilter::Pause()
// We may have an input connection but no output connection
// However, if we have an input pin we do have an output pin
- else if(m_pOutput->IsConnected() == FALSE)
- {
+ else if (m_pOutput->IsConnected() == FALSE) {
m_State = State_Paused;
}
- else
- {
- if(m_State == State_Stopped)
- {
- // allow a class derived from CTransformFilter
- // to know about starting and stopping streaming
+ else {
+ if (m_State == State_Stopped) {
+ // allow a class derived from CTransformFilter
+ // to know about starting and stopping streaming
CAutoLock lck2(&m_csReceive);
- hr = StartStreaming();
- }
- if(SUCCEEDED(hr))
- {
- hr = CBaseFilter::Pause();
- }
+ hr = StartStreaming();
+ }
+ if (SUCCEEDED(hr)) {
+ hr = CBaseFilter::Pause();
+ }
}
m_bSampleSkipped = FALSE;
@@ -584,8 +537,7 @@ CTransformFilter::NewSegment(
REFERENCE_TIME tStop,
double dRate)
{
- if(m_pOutput != NULL)
- {
+ if (m_pOutput != NULL) {
return m_pOutput->DeliverNewSegment(tStart, tStop, dRate);
}
return S_OK;
@@ -596,28 +548,22 @@ HRESULT
CTransformInputPin::CheckStreaming()
{
ASSERT(m_pTransformFilter->m_pOutput != NULL);
- if(!m_pTransformFilter->m_pOutput->IsConnected())
- {
+ if (!m_pTransformFilter->m_pOutput->IsConnected()) {
return VFW_E_NOT_CONNECTED;
- }
- else
- {
+ } else {
// Shouldn't be able to get any data if we're not connected!
ASSERT(IsConnected());
// we're flushing
- if(m_bFlushing)
- {
+ if (m_bFlushing) {
return S_FALSE;
}
// Don't process stuff in Stopped state
- if(IsStopped())
- {
+ if (IsStopped()) {
return VFW_E_WRONG_STATE;
}
- if(m_bRunTimeError)
- {
- return VFW_E_RUNTIME_ERROR;
+ if (m_bRunTimeError) {
+ return VFW_E_RUNTIME_ERROR;
}
return S_OK;
}
@@ -638,7 +584,7 @@ CTransformInputPin::CTransformInputPin(
__in_opt LPCWSTR pName)
: CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName)
{
- DbgLog((LOG_TRACE, 2, TEXT("CTransformInputPin::CTransformInputPin")));
+ DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin")));
m_pTransformFilter = pTransformFilter;
}
@@ -650,7 +596,7 @@ CTransformInputPin::CTransformInputPin(
__in_opt LPCWSTR pName)
: CBaseInputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pName)
{
- DbgLog((LOG_TRACE, 2, TEXT("CTransformInputPin::CTransformInputPin")));
+ DbgLog((LOG_TRACE,2,TEXT("CTransformInputPin::CTransformInputPin")));
m_pTransformFilter = pTransformFilter;
}
#endif
@@ -660,10 +606,9 @@ CTransformInputPin::CTransformInputPin(
HRESULT
CTransformInputPin::CheckConnect(IPin *pPin)
{
- HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_INPUT, pPin);
- if(FAILED(hr))
- {
- return hr;
+ HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_INPUT,pPin);
+ if (FAILED(hr)) {
+ return hr;
}
return CBaseInputPin::CheckConnect(pPin);
}
@@ -686,9 +631,8 @@ CTransformInputPin::BreakConnect()
HRESULT
CTransformInputPin::CompleteConnect(IPin *pReceivePin)
{
- HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_INPUT, pReceivePin);
- if(FAILED(hr))
- {
+ HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_INPUT,pReceivePin);
+ if (FAILED(hr)) {
return hr;
}
return CBaseInputPin::CompleteConnect(pReceivePin);
@@ -703,23 +647,19 @@ CTransformInputPin::CheckMediaType(const CMediaType* pmt)
// Check the input type
HRESULT hr = m_pTransformFilter->CheckInputType(pmt);
- if(S_OK != hr)
- {
+ if (S_OK != hr) {
return hr;
}
// if the output pin is still connected, then we have
// to check the transform not just the input format
- if((m_pTransformFilter->m_pOutput != NULL) &&
- (m_pTransformFilter->m_pOutput->IsConnected()))
- {
- return m_pTransformFilter->CheckTransform(
- pmt,
- &m_pTransformFilter->m_pOutput->CurrentMediaType());
- }
- else
- {
+ if ((m_pTransformFilter->m_pOutput != NULL) &&
+ (m_pTransformFilter->m_pOutput->IsConnected())) {
+ return m_pTransformFilter->CheckTransform(
+ pmt,
+ &m_pTransformFilter->m_pOutput->CurrentMediaType());
+ } else {
return hr;
}
}
@@ -732,15 +672,14 @@ CTransformInputPin::SetMediaType(const CMediaType* mtIn)
{
// Set the base class media type (should always succeed)
HRESULT hr = CBasePin::SetMediaType(mtIn);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// check the transform can be done (should always succeed)
ASSERT(SUCCEEDED(m_pTransformFilter->CheckInputType(mtIn)));
- return m_pTransformFilter->SetMediaType(PINDIR_INPUT, mtIn);
+ return m_pTransformFilter->SetMediaType(PINDIR_INPUT,mtIn);
}
@@ -756,9 +695,8 @@ CTransformInputPin::EndOfStream(void)
{
CAutoLock lck(&m_pTransformFilter->m_csReceive);
HRESULT hr = CheckStreaming();
- if(S_OK == hr)
- {
- hr = m_pTransformFilter->EndOfStream();
+ if (S_OK == hr) {
+ hr = m_pTransformFilter->EndOfStream();
}
return hr;
}
@@ -772,15 +710,13 @@ CTransformInputPin::BeginFlush(void)
CAutoLock lck(&m_pTransformFilter->m_csFilter);
// Are we actually doing anything?
ASSERT(m_pTransformFilter->m_pOutput != NULL);
- if(!IsConnected() ||
- !m_pTransformFilter->m_pOutput->IsConnected())
- {
+ if (!IsConnected() ||
+ !m_pTransformFilter->m_pOutput->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
HRESULT hr = CBaseInputPin::BeginFlush();
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
return m_pTransformFilter->BeginFlush();
@@ -796,15 +732,13 @@ CTransformInputPin::EndFlush(void)
CAutoLock lck(&m_pTransformFilter->m_csFilter);
// Are we actually doing anything?
ASSERT(m_pTransformFilter->m_pOutput != NULL);
- if(!IsConnected() ||
- !m_pTransformFilter->m_pOutput->IsConnected())
- {
+ if (!IsConnected() ||
+ !m_pTransformFilter->m_pOutput->IsConnected()) {
return VFW_E_NOT_CONNECTED;
}
HRESULT hr = m_pTransformFilter->EndFlush();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -825,8 +759,7 @@ CTransformInputPin::Receive(IMediaSample * pSample)
// check all is well with the base class
hr = CBaseInputPin::Receive(pSample);
- if(S_OK == hr)
- {
+ if (S_OK == hr) {
hr = m_pTransformFilter->Receive(pSample);
}
return hr;
@@ -865,7 +798,7 @@ CTransformOutputPin::CTransformOutputPin(
: CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName),
m_pPosition(NULL)
{
- DbgLog((LOG_TRACE, 2, TEXT("CTransformOutputPin::CTransformOutputPin")));
+ DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::CTransformOutputPin")));
m_pTransformFilter = pTransformFilter;
}
@@ -879,7 +812,7 @@ CTransformOutputPin::CTransformOutputPin(
: CBaseOutputPin(pObjectName, pTransformFilter, &pTransformFilter->m_csFilter, phr, pPinName),
m_pPosition(NULL)
{
- DbgLog((LOG_TRACE, 2, TEXT("CTransformOutputPin::CTransformOutputPin")));
+ DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::CTransformOutputPin")));
m_pTransformFilter = pTransformFilter;
}
@@ -889,9 +822,9 @@ CTransformOutputPin::CTransformOutputPin(
CTransformOutputPin::~CTransformOutputPin()
{
- DbgLog((LOG_TRACE, 2, TEXT("CTransformOutputPin::~CTransformOutputPin")));
+ DbgLog((LOG_TRACE,2,TEXT("CTransformOutputPin::~CTransformOutputPin")));
- if(m_pPosition) m_pPosition->Release();
+ if (m_pPosition) m_pPosition->Release();
}
@@ -900,34 +833,29 @@ CTransformOutputPin::~CTransformOutputPin()
STDMETHODIMP
CTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
{
- CheckPointer(ppv, E_POINTER);
- ValidateReadWritePtr(ppv, sizeof(PVOID));
+ CheckPointer(ppv,E_POINTER);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
*ppv = NULL;
- if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking)
- {
+ if (riid == IID_IMediaPosition || riid == IID_IMediaSeeking) {
// we should have an input pin by now
ASSERT(m_pTransformFilter->m_pInput != NULL);
- if(m_pPosition == NULL)
- {
+ if (m_pPosition == NULL) {
HRESULT hr = CreatePosPassThru(
GetOwner(),
FALSE,
(IPin *)m_pTransformFilter->m_pInput,
&m_pPosition);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
}
return m_pPosition->QueryInterface(riid, ppv);
- }
- else
- {
+ } else {
return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -941,15 +869,13 @@ CTransformOutputPin::CheckConnect(IPin *pPin)
// we should have an input connection first
ASSERT(m_pTransformFilter->m_pInput != NULL);
- if((m_pTransformFilter->m_pInput->IsConnected() == FALSE))
- {
- return E_UNEXPECTED;
+ if ((m_pTransformFilter->m_pInput->IsConnected() == FALSE)) {
+ return E_UNEXPECTED;
}
- HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_OUTPUT, pPin);
- if(FAILED(hr))
- {
- return hr;
+ HRESULT hr = m_pTransformFilter->CheckConnect(PINDIR_OUTPUT,pPin);
+ if (FAILED(hr)) {
+ return hr;
}
return CBaseOutputPin::CheckConnect(pPin);
}
@@ -972,9 +898,8 @@ CTransformOutputPin::BreakConnect()
HRESULT
CTransformOutputPin::CompleteConnect(IPin *pReceivePin)
{
- HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_OUTPUT, pReceivePin);
- if(FAILED(hr))
- {
+ HRESULT hr = m_pTransformFilter->CompleteConnect(PINDIR_OUTPUT,pReceivePin);
+ if (FAILED(hr)) {
return hr;
}
return CBaseOutputPin::CompleteConnect(pReceivePin);
@@ -988,14 +913,13 @@ CTransformOutputPin::CheckMediaType(const CMediaType* pmtOut)
{
// must have selected input first
ASSERT(m_pTransformFilter->m_pInput != NULL);
- if((m_pTransformFilter->m_pInput->IsConnected() == FALSE))
- {
- return E_INVALIDARG;
+ if ((m_pTransformFilter->m_pInput->IsConnected() == FALSE)) {
+ return E_INVALIDARG;
}
return m_pTransformFilter->CheckTransform(
- &m_pTransformFilter->m_pInput->CurrentMediaType(),
- pmtOut);
+ &m_pTransformFilter->m_pInput->CurrentMediaType(),
+ pmtOut);
}
@@ -1012,22 +936,20 @@ CTransformOutputPin::SetMediaType(const CMediaType* pmtOut)
// Set the base class media type (should always succeed)
hr = CBasePin::SetMediaType(pmtOut);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
#ifdef _DEBUG
- if(FAILED(m_pTransformFilter->CheckTransform(&m_pTransformFilter->
- m_pInput->CurrentMediaType(), pmtOut)))
- {
- DbgLog((LOG_ERROR, 0, TEXT("*** This filter is accepting an output media type")));
- DbgLog((LOG_ERROR, 0, TEXT(" that it can't currently transform to. I hope")));
- DbgLog((LOG_ERROR, 0, TEXT(" it's smart enough to reconnect its input.")));
+ if (FAILED(m_pTransformFilter->CheckTransform(&m_pTransformFilter->
+ m_pInput->CurrentMediaType(),pmtOut))) {
+ DbgLog((LOG_ERROR,0,TEXT("*** This filter is accepting an output media type")));
+ DbgLog((LOG_ERROR,0,TEXT(" that it can't currently transform to. I hope")));
+ DbgLog((LOG_ERROR,0,TEXT(" it's smart enough to reconnect its input.")));
}
#endif
- return m_pTransformFilter->SetMediaType(PINDIR_OUTPUT, pmtOut);
+ return m_pTransformFilter->SetMediaType(PINDIR_OUTPUT,pmtOut);
}
@@ -1054,12 +976,9 @@ CTransformOutputPin::GetMediaType(
// We don't have any media types if our input is not connected
- if(m_pTransformFilter->m_pInput->IsConnected())
- {
- return m_pTransformFilter->GetMediaType(iPosition, pMediaType);
- }
- else
- {
+ if (m_pTransformFilter->m_pInput->IsConnected()) {
+ return m_pTransformFilter->GetMediaType(iPosition,pMediaType);
+ } else {
return VFW_S_NO_MORE_ITEMS;
}
}
@@ -1074,12 +993,11 @@ STDMETHODIMP
CTransformOutputPin::Notify(IBaseFilter * pSender, Quality q)
{
UNREFERENCED_PARAMETER(pSender);
- ValidateReadPtr(pSender, sizeof(IBaseFilter));
+ ValidateReadPtr(pSender,sizeof(IBaseFilter));
// First see if we want to handle this ourselves
HRESULT hr = m_pTransformFilter->AlterQuality(q);
- if(hr != S_FALSE)
- {
+ if (hr!=S_FALSE) {
return hr; // either S_OK or a failure
}
diff --git a/src/filters/BaseClasses/transfrm.h b/src/filters/BaseClasses/transfrm.h
index a9cdc3686..9b276471b 100644
--- a/src/filters/BaseClasses/transfrm.h
+++ b/src/filters/BaseClasses/transfrm.h
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// File: Transfrm.h
//
-// Desc: DirectShow base classes - defines classes from which simple
+// Desc: DirectShow base classes - defines classes from which simple
// transform codecs may be derived.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -88,19 +88,16 @@ public:
STDMETHODIMP EndFlush(void);
STDMETHODIMP NewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate);
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop,
+ double dRate);
// Check if it's OK to process samples
virtual HRESULT CheckStreaming();
// Media type
public:
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- };
+ CMediaType& CurrentMediaType() { return m_mt; };
};
@@ -159,8 +156,8 @@ public:
// called from CBaseOutputPin during connection to ask for
// the count and size of buffers we need.
HRESULT DecideBufferSize(
- IMemAllocator * pAlloc,
- __inout ALLOCATOR_PROPERTIES *pProp);
+ IMemAllocator * pAlloc,
+ __inout ALLOCATOR_PROPERTIES *pProp);
// returns the preferred formats for a pin
HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType);
@@ -170,10 +167,7 @@ public:
// Media type
public:
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- };
+ CMediaType& CurrentMediaType() { return m_mt; };
};
@@ -221,8 +215,8 @@ public:
// call the SetProperties function with appropriate arguments
virtual HRESULT DecideBufferSize(
- IMemAllocator * pAllocator,
- __inout ALLOCATOR_PROPERTIES *pprop) PURE;
+ IMemAllocator * pAllocator,
+ __inout ALLOCATOR_PROPERTIES *pprop) PURE;
// override to suggest OUTPUT pin media types
virtual HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType) PURE;
@@ -241,12 +235,12 @@ public:
virtual HRESULT AlterQuality(Quality q);
// override this to know when the media type is actually set
- virtual HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt);
+ virtual HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt);
// chance to grab extra interfaces on connection
- virtual HRESULT CheckConnect(PIN_DIRECTION dir, IPin *pPin);
+ virtual HRESULT CheckConnect(PIN_DIRECTION dir,IPin *pPin);
virtual HRESULT BreakConnect(PIN_DIRECTION dir);
- virtual HRESULT CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin);
+ virtual HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin);
// chance to customize the transform process
virtual HRESULT Receive(IMediaSample *pSample);
@@ -259,17 +253,15 @@ public:
virtual HRESULT BeginFlush(void);
virtual HRESULT EndFlush(void);
virtual HRESULT NewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate);
+ REFERENCE_TIME tStart,
+ REFERENCE_TIME tStop,
+ double dRate);
#ifdef PERF
// Override to register performance measurement with a less generic string
// You should do this to avoid confusion with other filters
virtual void RegisterPerfId()
- {
- m_idTransform = MSR_REGISTER(TEXT("Transform"));
- }
+ {m_idTransform = MSR_REGISTER(TEXT("Transform"));}
#endif // PERF
diff --git a/src/filters/BaseClasses/transip.cpp b/src/filters/BaseClasses/transip.cpp
index d3bb38908..e8e12eb5c 100644
--- a/src/filters/BaseClasses/transip.cpp
+++ b/src/filters/BaseClasses/transip.cpp
@@ -261,14 +261,14 @@
// =================================================================
CTransInPlaceFilter::CTransInPlaceFilter
-(__in_opt LPCTSTR pName,
- __inout_opt LPUNKNOWN pUnk,
- REFCLSID clsid,
- __inout HRESULT *phr,
- bool bModifiesData
-)
- : CTransformFilter(pName, pUnk, clsid),
- m_bModifiesData(bModifiesData)
+ ( __in_opt LPCTSTR pName,
+ __inout_opt LPUNKNOWN pUnk,
+ REFCLSID clsid,
+ __inout HRESULT *phr,
+ bool bModifiesData
+ )
+ : CTransformFilter(pName, pUnk, clsid),
+ m_bModifiesData(bModifiesData)
{
#ifdef PERF
RegisterPerfId();
@@ -278,14 +278,14 @@ CTransInPlaceFilter::CTransInPlaceFilter
#ifdef UNICODE
CTransInPlaceFilter::CTransInPlaceFilter
-(__in_opt LPCSTR pName,
- __inout_opt LPUNKNOWN pUnk,
- REFCLSID clsid,
- __inout HRESULT *phr,
- bool bModifiesData
-)
- : CTransformFilter(pName, pUnk, clsid),
- m_bModifiesData(bModifiesData)
+ ( __in_opt LPCSTR pName,
+ __inout_opt LPUNKNOWN pUnk,
+ REFCLSID clsid,
+ __inout HRESULT *phr,
+ bool bModifiesData
+ )
+ : CTransformFilter(pName, pUnk, clsid),
+ m_bModifiesData(bModifiesData)
{
#ifdef PERF
RegisterPerfId();
@@ -311,13 +311,12 @@ CTransInPlaceFilter::GetPin(int n)
// Create an input pin if not already done
- if(m_pInput == NULL)
- {
+ if (m_pInput == NULL) {
- m_pInput = new CTransInPlaceInputPin(NAME("TransInPlace input pin")
- , this // Owner filter
- , &hr // Result code
- , L"Input" // Pin name
+ m_pInput = new CTransInPlaceInputPin( NAME("TransInPlace input pin")
+ , this // Owner filter
+ , &hr // Result code
+ , L"Input" // Pin name
);
// Constructor for CTransInPlaceInputPin can't fail
@@ -326,20 +325,18 @@ CTransInPlaceFilter::GetPin(int n)
// Create an output pin if not already done
- if(m_pInput != NULL && m_pOutput == NULL)
- {
+ if (m_pInput!=NULL && m_pOutput == NULL) {
- m_pOutput = new CTransInPlaceOutputPin(NAME("TransInPlace output pin")
- , this // Owner filter
- , &hr // Result code
- , L"Output" // Pin name
+ m_pOutput = new CTransInPlaceOutputPin( NAME("TransInPlace output pin")
+ , this // Owner filter
+ , &hr // Result code
+ , L"Output" // Pin name
);
// a failed return code should delete the object
ASSERT(SUCCEEDED(hr));
- if(m_pOutput == NULL)
- {
+ if (m_pOutput == NULL) {
delete m_pInput;
m_pInput = NULL;
}
@@ -347,17 +344,12 @@ CTransInPlaceFilter::GetPin(int n)
// Return the appropriate pin
- ASSERT(n >= 0 && n <= 1);
- if(n == 0)
- {
+ ASSERT (n>=0 && n<=1);
+ if (n == 0) {
return m_pInput;
- }
- else if(n == 1)
- {
+ } else if (n==1) {
return m_pOutput;
- }
- else
- {
+ } else {
return NULL;
}
@@ -375,8 +367,7 @@ HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePi
// if we are not part of a graph, then don't indirect the pointer
// this probably prevents use of the filter without a filtergraph
- if(!m_pGraph)
- {
+ if (!m_pGraph) {
return VFW_E_NOT_IN_GRAPH;
}
@@ -390,11 +381,9 @@ HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePi
// call ReconnectEx passing the type we want to reconnect with
// via the base class ReconeectPin method.
- if(dir == PINDIR_OUTPUT)
- {
- if(m_pInput->IsConnected())
- {
- return ReconnectPin(m_pInput, &m_pOutput->CurrentMediaType());
+ if (dir == PINDIR_OUTPUT) {
+ if( m_pInput->IsConnected() ) {
+ return ReconnectPin( m_pInput, &m_pOutput->CurrentMediaType() );
}
return NOERROR;
}
@@ -403,14 +392,12 @@ HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePi
// Reconnect output if necessary
- if(m_pOutput->IsConnected())
- {
+ if( m_pOutput->IsConnected() ) {
- if(m_pInput->CurrentMediaType()
+ if ( m_pInput->CurrentMediaType()
!= m_pOutput->CurrentMediaType()
- )
- {
- return ReconnectPin(m_pOutput, &m_pInput->CurrentMediaType());
+ ) {
+ return ReconnectPin( m_pOutput, &m_pInput->CurrentMediaType() );
}
}
return NOERROR;
@@ -426,28 +413,24 @@ HRESULT CTransInPlaceFilter::CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePi
//
HRESULT CTransInPlaceFilter::DecideBufferSize
-(IMemAllocator *pAlloc
- , __inout ALLOCATOR_PROPERTIES *pProperties
-)
+ ( IMemAllocator *pAlloc
+ , __inout ALLOCATOR_PROPERTIES *pProperties
+ )
{
ALLOCATOR_PROPERTIES Request, Actual;
HRESULT hr;
// If we are connected upstream, get his views
- if(m_pInput->IsConnected())
- {
+ if (m_pInput->IsConnected()) {
// Get the input pin allocator, and get its size and count.
// we don't care about his alignment and prefix.
hr = InputPin()->PeekAllocator()->GetProperties(&Request);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
// Input connected but with a secretive allocator - enough!
return hr;
}
- }
- else
- {
+ } else {
// Propose one byte
// If this isn't enough then when the other pin does get connected
// we can revise it.
@@ -457,9 +440,9 @@ HRESULT CTransInPlaceFilter::DecideBufferSize
}
- DbgLog((LOG_MEMORY, 1, TEXT("Setting Allocator Requirements")));
- DbgLog((LOG_MEMORY, 1, TEXT("Count %d, Size %d"),
- Request.cBuffers, Request.cbBuffer));
+ DbgLog((LOG_MEMORY,1,TEXT("Setting Allocator Requirements")));
+ DbgLog((LOG_MEMORY,1,TEXT("Count %d, Size %d"),
+ Request.cBuffers, Request.cbBuffer));
// Pass the allocator requirements to our output side
// but do a little sanity checking first or we'll just hit
@@ -468,32 +451,24 @@ HRESULT CTransInPlaceFilter::DecideBufferSize
pProperties->cBuffers = Request.cBuffers;
pProperties->cbBuffer = Request.cbBuffer;
pProperties->cbAlign = Request.cbAlign;
- if(pProperties->cBuffers <= 0)
- {
- pProperties->cBuffers = 1;
- }
- if(pProperties->cbBuffer <= 0)
- {
- pProperties->cbBuffer = 1;
- }
+ if (pProperties->cBuffers<=0) {pProperties->cBuffers = 1; }
+ if (pProperties->cbBuffer<=0) {pProperties->cbBuffer = 1; }
hr = pAlloc->SetProperties(pProperties, &Actual);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
- DbgLog((LOG_MEMORY, 1, TEXT("Obtained Allocator Requirements")));
- DbgLog((LOG_MEMORY, 1, TEXT("Count %d, Size %d, Alignment %d"),
- Actual.cBuffers, Actual.cbBuffer, Actual.cbAlign));
+ DbgLog((LOG_MEMORY,1,TEXT("Obtained Allocator Requirements")));
+ DbgLog((LOG_MEMORY,1,TEXT("Count %d, Size %d, Alignment %d"),
+ Actual.cBuffers, Actual.cbBuffer, Actual.cbAlign));
// Make sure we got the right alignment and at least the minimum required
- if((Request.cBuffers > Actual.cBuffers)
+ if ( (Request.cBuffers > Actual.cBuffers)
|| (Request.cbBuffer > Actual.cbBuffer)
|| (Request.cbAlign > Actual.cbAlign)
- )
- {
+ ) {
return E_FAIL;
}
return NOERROR;
@@ -510,61 +485,51 @@ __out_opt IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
HRESULT hr;
REFERENCE_TIME tStart, tStop;
- const BOOL bTime = S_OK == pSource->GetTime(&tStart, &tStop);
+ const BOOL bTime = S_OK == pSource->GetTime( &tStart, &tStop);
// this may block for an indeterminate amount of time
hr = OutputPin()->PeekAllocator()->GetBuffer(
- &pDest
- , bTime ? &tStart : NULL
- , bTime ? &tStop : NULL
- , m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0
- );
+ &pDest
+ , bTime ? &tStart : NULL
+ , bTime ? &tStop : NULL
+ , m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0
+ );
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return NULL;
}
ASSERT(pDest);
IMediaSample2 *pSample2;
- if(SUCCEEDED(pDest->QueryInterface(IID_IMediaSample2, (void **)&pSample2)))
- {
+ if (SUCCEEDED(pDest->QueryInterface(IID_IMediaSample2, (void **)&pSample2))) {
HRESULT hrProps = pSample2->SetProperties(
- FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer),
- (PBYTE)m_pInput->SampleProps());
+ FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer),
+ (PBYTE)m_pInput->SampleProps());
pSample2->Release();
- if(FAILED(hrProps))
- {
+ if (FAILED(hrProps)) {
pDest->Release();
return NULL;
}
- }
- else
- {
- if(bTime)
- {
+ } else {
+ if (bTime) {
pDest->SetTime(&tStart, &tStop);
}
- if(S_OK == pSource->IsSyncPoint())
- {
+ if (S_OK == pSource->IsSyncPoint()) {
pDest->SetSyncPoint(TRUE);
}
- if(S_OK == pSource->IsDiscontinuity() || m_bSampleSkipped)
- {
+ if (S_OK == pSource->IsDiscontinuity() || m_bSampleSkipped) {
pDest->SetDiscontinuity(TRUE);
}
- if(S_OK == pSource->IsPreroll())
- {
+ if (S_OK == pSource->IsPreroll()) {
pDest->SetPreroll(TRUE);
}
// Copy the media type
AM_MEDIA_TYPE *pMediaType;
- if(S_OK == pSource->GetMediaType(&pMediaType))
- {
+ if (S_OK == pSource->GetMediaType(&pMediaType)) {
pDest->SetMediaType(pMediaType);
- DeleteMediaType(pMediaType);
+ DeleteMediaType( pMediaType );
}
}
@@ -573,16 +538,14 @@ __out_opt IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
// Copy the sample media times
REFERENCE_TIME TimeStart, TimeEnd;
- if(pSource->GetMediaTime(&TimeStart, &TimeEnd) == NOERROR)
- {
- pDest->SetMediaTime(&TimeStart, &TimeEnd);
+ if (pSource->GetMediaTime(&TimeStart,&TimeEnd) == NOERROR) {
+ pDest->SetMediaTime(&TimeStart,&TimeEnd);
}
// Copy the actual data length and the actual data.
{
const long lDataLength = pSource->GetActualDataLength();
- if(FAILED(pDest->SetActualDataLength(lDataLength)))
- {
+ if (FAILED(pDest->SetActualDataLength(lDataLength))) {
pDest->Release();
return NULL;
}
@@ -595,17 +558,16 @@ __out_opt IMediaSample * CTransInPlaceFilter::Copy(IMediaSample *pSource)
ASSERT(lDestSize >= lSourceSize && lDestSize >= lDataLength);
- if(FAILED(pSource->GetPointer(&pSourceBuffer)) ||
- FAILED(pDest->GetPointer(&pDestBuffer)) ||
- lDestSize < lDataLength ||
- lDataLength < 0)
- {
+ if (FAILED(pSource->GetPointer(&pSourceBuffer)) ||
+ FAILED(pDest->GetPointer(&pDestBuffer)) ||
+ lDestSize < lDataLength ||
+ lDataLength < 0) {
pDest->Release();
return NULL;
}
ASSERT(lDestSize == 0 || pSourceBuffer != NULL && pDestBuffer != NULL);
- CopyMemory((PVOID) pDestBuffer, (PVOID) pSourceBuffer, lDataLength);
+ CopyMemory( (PVOID) pDestBuffer, (PVOID) pSourceBuffer, lDataLength );
}
}
@@ -621,8 +583,7 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
{
/* Check for other streams and pass them on */
AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA)
- {
+ if (pProps->dwStreamId != AM_STREAM_MEDIA) {
return m_pOutput->Deliver(pSample);
}
HRESULT hr;
@@ -630,15 +591,13 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
// Start timing the TransInPlace (if PERF is defined)
MSR_START(m_idTransInPlace);
- if(UsingDifferentAllocators())
- {
+ if (UsingDifferentAllocators()) {
// We have to copy the data.
pSample = Copy(pSample);
- if(pSample == NULL)
- {
+ if (pSample==NULL) {
MSR_STOP(m_idTransInPlace);
return E_UNEXPECTED;
}
@@ -650,11 +609,9 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
// Stop the clock and log it (if PERF is defined)
MSR_STOP(m_idTransInPlace);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
DbgLog((LOG_TRACE, 1, TEXT("Error from TransInPlace")));
- if(UsingDifferentAllocators())
- {
+ if (UsingDifferentAllocators()) {
pSample->Release();
}
return hr;
@@ -663,24 +620,19 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
// the Transform() function can return S_FALSE to indicate that the
// sample should not be delivered; we only deliver the sample if it's
// really S_OK (same as NOERROR, of course.)
- if(hr == NOERROR)
- {
+ if (hr == NOERROR) {
hr = m_pOutput->Deliver(pSample);
- }
- else
- {
+ } else {
// But it would be an error to return this private workaround
// to the caller ...
- if(S_FALSE == hr)
- {
+ if (S_FALSE == hr) {
// S_FALSE returned from Transform is a PRIVATE agreement
// We should return NOERROR from Receive() in this cause because
// returning S_FALSE from Receive() means that this is the end
// of the stream and no more data should be sent.
m_bSampleSkipped = TRUE;
- if(!m_bQualityChanged)
- {
- NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
+ if (!m_bQualityChanged) {
+ NotifyEvent(EC_QUALITY_CHANGE,0,0);
m_bQualityChanged = TRUE;
}
hr = NOERROR;
@@ -689,8 +641,7 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
// release the output buffer. If the connected pin still needs it,
// it will have addrefed it itself.
- if(UsingDifferentAllocators())
- {
+ if (UsingDifferentAllocators()) {
pSample->Release();
}
@@ -708,11 +659,11 @@ CTransInPlaceFilter::Receive(IMediaSample *pSample)
// constructor
CTransInPlaceInputPin::CTransInPlaceInputPin
-(__in_opt LPCTSTR pObjectName
- , __inout CTransInPlaceFilter *pFilter
- , __inout HRESULT *phr
- , __in_opt LPCWSTR pName
-)
+ ( __in_opt LPCTSTR pObjectName
+ , __inout CTransInPlaceFilter *pFilter
+ , __inout HRESULT *phr
+ , __in_opt LPCWSTR pName
+ )
: CTransformInputPin(pObjectName,
pFilter,
phr,
@@ -721,7 +672,7 @@ CTransInPlaceInputPin::CTransInPlaceInputPin
, m_pTIPFilter(pFilter)
{
DbgLog((LOG_TRACE, 2
- , TEXT("CTransInPlaceInputPin::CTransInPlaceInputPin")));
+ , TEXT("CTransInPlaceInputPin::CTransInPlaceInputPin")));
} // constructor
@@ -742,29 +693,26 @@ CTransInPlaceInputPin::CTransInPlaceInputPin
STDMETHODIMP CTransInPlaceInputPin::GetAllocator(__deref_out IMemAllocator ** ppAllocator)
{
- CheckPointer(ppAllocator, E_POINTER);
- ValidateReadWritePtr(ppAllocator, sizeof(IMemAllocator *));
+ CheckPointer(ppAllocator,E_POINTER);
+ ValidateReadWritePtr(ppAllocator,sizeof(IMemAllocator *));
CAutoLock cObjectLock(m_pLock);
HRESULT hr;
- if(m_pTIPFilter->m_pOutput->IsConnected())
- {
+ if ( m_pTIPFilter->m_pOutput->IsConnected() ) {
// Store the allocator we got
hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin()
- ->GetAllocator(ppAllocator);
- if(SUCCEEDED(hr))
- {
- m_pTIPFilter->OutputPin()->SetAllocator(*ppAllocator);
+ ->GetAllocator( ppAllocator );
+ if (SUCCEEDED(hr)) {
+ m_pTIPFilter->OutputPin()->SetAllocator( *ppAllocator );
}
}
- else
- {
+ else {
// Help upstream filter (eg TIP filter which is having to do a copy)
// by providing a temp allocator here - we'll never use
// this allocator because when our output is connected we'll
// reconnect this pin
- hr = CTransformInputPin::GetAllocator(ppAllocator);
+ hr = CTransformInputPin::GetAllocator( ppAllocator );
}
return hr;
@@ -781,8 +729,8 @@ CTransInPlaceInputPin::NotifyAllocator(
BOOL bReadOnly)
{
HRESULT hr = S_OK;
- CheckPointer(pAllocator, E_POINTER);
- ValidateReadPtr(pAllocator, sizeof(IMemAllocator));
+ CheckPointer(pAllocator,E_POINTER);
+ ValidateReadPtr(pAllocator,sizeof(IMemAllocator));
CAutoLock cObjectLock(m_pLock);
@@ -793,84 +741,68 @@ CTransInPlaceInputPin::NotifyAllocator(
// If our output is not connected just accept the allocator
// We're never going to use this allocator because when our
// output pin is connected we'll reconnect this pin
- if(!m_pTIPFilter->OutputPin()->IsConnected())
- {
+ if (!m_pTIPFilter->OutputPin()->IsConnected()) {
return CTransformInputPin::NotifyAllocator(pAllocator, bReadOnly);
}
// If the allocator is read-only and we're modifying data
// and the allocator is the same as the output pin's
// then reject
- if(bReadOnly && m_pTIPFilter->m_bModifiesData)
- {
+ if (bReadOnly && m_pTIPFilter->m_bModifiesData) {
IMemAllocator *pOutputAllocator =
m_pTIPFilter->OutputPin()->PeekAllocator();
// Make sure we have an output allocator
- if(pOutputAllocator == NULL)
- {
+ if (pOutputAllocator == NULL) {
hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin()->
- GetAllocator(&pOutputAllocator);
- if(FAILED(hr))
- {
+ GetAllocator(&pOutputAllocator);
+ if(FAILED(hr)) {
hr = CreateMemoryAllocator(&pOutputAllocator);
}
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
m_pTIPFilter->OutputPin()->SetAllocator(pOutputAllocator);
pOutputAllocator->Release();
}
}
- if(pAllocator == pOutputAllocator)
- {
+ if (pAllocator == pOutputAllocator) {
hr = E_FAIL;
- }
- else if(SUCCEEDED(hr))
- {
+ } else if(SUCCEEDED(hr)) {
// Must copy so set the allocator properties on the output
ALLOCATOR_PROPERTIES Props, Actual;
hr = pAllocator->GetProperties(&Props);
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = pOutputAllocator->SetProperties(&Props, &Actual);
}
- if(SUCCEEDED(hr))
- {
- if((Props.cBuffers > Actual.cBuffers)
+ if (SUCCEEDED(hr)) {
+ if ( (Props.cBuffers > Actual.cBuffers)
|| (Props.cbBuffer > Actual.cbBuffer)
|| (Props.cbAlign > Actual.cbAlign)
- )
- {
+ ) {
hr = E_FAIL;
}
}
// Set the allocator on the output pin
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin()
- ->NotifyAllocator(pOutputAllocator, FALSE);
+ ->NotifyAllocator( pOutputAllocator, FALSE );
}
}
- }
- else
- {
+ } else {
hr = m_pTIPFilter->OutputPin()->ConnectedIMemInputPin()
- ->NotifyAllocator(pAllocator, bReadOnly);
- if(SUCCEEDED(hr))
- {
- m_pTIPFilter->OutputPin()->SetAllocator(pAllocator);
+ ->NotifyAllocator( pAllocator, bReadOnly );
+ if (SUCCEEDED(hr)) {
+ m_pTIPFilter->OutputPin()->SetAllocator( pAllocator );
}
}
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
// It's possible that the old and the new are the same thing.
// AddRef before release ensures that we don't unload it.
pAllocator->AddRef();
- if(m_pAllocator != NULL)
+ if( m_pAllocator != NULL )
m_pAllocator->Release();
m_pAllocator = pAllocator; // We have an allocator for the input pin
@@ -883,13 +815,13 @@ CTransInPlaceInputPin::NotifyAllocator(
// EnumMediaTypes
// - pass through to our downstream filter
-STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes(__deref_out IEnumMediaTypes **ppEnum)
+STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum )
{
// Can only pass through if connected
- if(!m_pTIPFilter->m_pOutput->IsConnected())
+ if( !m_pTIPFilter->m_pOutput->IsConnected() )
return VFW_E_NOT_CONNECTED;
- return m_pTIPFilter->m_pOutput->GetConnected()->EnumMediaTypes(ppEnum);
+ return m_pTIPFilter->m_pOutput->GetConnected()->EnumMediaTypes( ppEnum );
} // EnumMediaTypes
@@ -899,13 +831,13 @@ STDMETHODIMP CTransInPlaceInputPin::EnumMediaTypes(__deref_out IEnumMediaTypes *
// otherwise pass through to the downstream filter.
// This assumes that the filter does not change the media type.
-HRESULT CTransInPlaceInputPin::CheckMediaType(const CMediaType *pmt)
+HRESULT CTransInPlaceInputPin::CheckMediaType(const CMediaType *pmt )
{
HRESULT hr = m_pTIPFilter->CheckInputType(pmt);
- if(hr != S_OK) return hr;
+ if (hr!=S_OK) return hr;
- if(m_pTIPFilter->m_pOutput->IsConnected())
- return m_pTIPFilter->m_pOutput->GetConnected()->QueryAccept(pmt);
+ if( m_pTIPFilter->m_pOutput->IsConnected() )
+ return m_pTIPFilter->m_pOutput->GetConnected()->QueryAccept( pmt );
else
return S_OK;
@@ -918,9 +850,9 @@ STDMETHODIMP
CTransInPlaceInputPin::GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES *pProps)
{
- if(m_pTIPFilter->m_pOutput->IsConnected())
+ if( m_pTIPFilter->m_pOutput->IsConnected() )
return m_pTIPFilter->OutputPin()
- ->ConnectedIMemInputPin()->GetAllocatorRequirements(pProps);
+ ->ConnectedIMemInputPin()->GetAllocatorRequirements( pProps );
else
return E_NOTIMPL;
@@ -928,19 +860,18 @@ CTransInPlaceInputPin::GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES *pPro
// CTransInPlaceInputPin::CompleteConnect() calls CBaseInputPin::CompleteConnect()
-// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because
+// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because
// CTransInPlaceFilter::CompleteConnect() can reconnect a pin and we do not
// want to reconnect a pin if CBaseInputPin::CompleteConnect() fails.
HRESULT
CTransInPlaceInputPin::CompleteConnect(IPin *pReceivePin)
{
HRESULT hr = CBaseInputPin::CompleteConnect(pReceivePin);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
- return m_pTransformFilter->CompleteConnect(PINDIR_INPUT, pReceivePin);
+ return m_pTransformFilter->CompleteConnect(PINDIR_INPUT,pReceivePin);
} // CompleteConnect
@@ -956,27 +887,27 @@ CTransInPlaceOutputPin::CTransInPlaceOutputPin(
__inout CTransInPlaceFilter *pFilter,
__inout HRESULT * phr,
__in_opt LPCWSTR pPinName)
- : CTransformOutputPin(pObjectName
- , pFilter
- , phr
- , pPinName),
- m_pTIPFilter(pFilter)
+ : CTransformOutputPin( pObjectName
+ , pFilter
+ , phr
+ , pPinName),
+ m_pTIPFilter(pFilter)
{
- DbgLog((LOG_TRACE, 2
- , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin")));
+ DbgLog(( LOG_TRACE, 2
+ , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin")));
} // constructor
// EnumMediaTypes
// - pass through to our upstream filter
-STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes(__deref_out IEnumMediaTypes **ppEnum)
+STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum )
{
// Can only pass through if connected.
- if(! m_pTIPFilter->m_pInput->IsConnected())
+ if( ! m_pTIPFilter->m_pInput->IsConnected() )
return VFW_E_NOT_CONNECTED;
- return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes(ppEnum);
+ return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes( ppEnum );
} // EnumMediaTypes
@@ -986,19 +917,15 @@ STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes(__deref_out IEnumMediaTypes
// - agree to anything if not connected,
// otherwise pass through to the upstream filter.
-HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType *pmt)
+HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType *pmt )
{
// Don't accept any output pin type changes if we're copying
// between allocators - it's too late to change the input
// allocator size.
- if(m_pTIPFilter->UsingDifferentAllocators() && !m_pFilter->IsStopped())
- {
- if(*pmt == m_mt)
- {
+ if (m_pTIPFilter->UsingDifferentAllocators() && !m_pFilter->IsStopped()) {
+ if (*pmt == m_mt) {
return S_OK;
- }
- else
- {
+ } else {
return VFW_E_TYPE_NOT_ACCEPTED;
}
}
@@ -1006,10 +933,10 @@ HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType *pmt)
// Assumes the type does not change. That's why we're calling
// CheckINPUTType here on the OUTPUT pin.
HRESULT hr = m_pTIPFilter->CheckInputType(pmt);
- if(hr != S_OK) return hr;
+ if (hr!=S_OK) return hr;
- if(m_pTIPFilter->m_pInput->IsConnected())
- return m_pTIPFilter->m_pInput->GetConnected()->QueryAccept(pmt);
+ if( m_pTIPFilter->m_pInput->IsConnected() )
+ return m_pTIPFilter->m_pInput->GetConnected()->QueryAccept( pmt );
else
return S_OK;
@@ -1022,8 +949,7 @@ void
CTransInPlaceOutputPin::SetAllocator(IMemAllocator * pAllocator)
{
pAllocator->AddRef();
- if(m_pAllocator)
- {
+ if (m_pAllocator) {
m_pAllocator->Release();
}
m_pAllocator = pAllocator;
@@ -1031,19 +957,18 @@ CTransInPlaceOutputPin::SetAllocator(IMemAllocator * pAllocator)
// CTransInPlaceOutputPin::CompleteConnect() calls CBaseOutputPin::CompleteConnect()
-// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because
-// CTransInPlaceFilter::CompleteConnect() can reconnect a pin and we do not want to
-// reconnect a pin if CBaseOutputPin::CompleteConnect() fails.
-// CBaseOutputPin::CompleteConnect() often fails when our output pin is being connected
+// and then calls CTransInPlaceFilter::CompleteConnect(). It does this because
+// CTransInPlaceFilter::CompleteConnect() can reconnect a pin and we do not want to
+// reconnect a pin if CBaseOutputPin::CompleteConnect() fails.
+// CBaseOutputPin::CompleteConnect() often fails when our output pin is being connected
// to the Video Mixing Renderer.
HRESULT
CTransInPlaceOutputPin::CompleteConnect(IPin *pReceivePin)
{
HRESULT hr = CBaseOutputPin::CompleteConnect(pReceivePin);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
- return m_pTransformFilter->CompleteConnect(PINDIR_OUTPUT, pReceivePin);
+ return m_pTransformFilter->CompleteConnect(PINDIR_OUTPUT,pReceivePin);
} // CompleteConnect
diff --git a/src/filters/BaseClasses/transip.h b/src/filters/BaseClasses/transip.h
index cf91e6c3d..3fc335eff 100644
--- a/src/filters/BaseClasses/transip.h
+++ b/src/filters/BaseClasses/transip.h
@@ -57,7 +57,7 @@ public:
// --- IMemInputPin -----
// Provide an enumerator for media types by getting one from downstream
- STDMETHODIMP EnumMediaTypes(__deref_out IEnumMediaTypes **ppEnum);
+ STDMETHODIMP EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum );
// Say whether media type is acceptable.
HRESULT CheckMediaType(const CMediaType* pmt);
@@ -73,19 +73,14 @@ public:
// Allow the filter to see what allocator we have
// N.B. This does NOT AddRef
__out IMemAllocator * PeekAllocator() const
- {
- return m_pAllocator;
- }
+ { return m_pAllocator; }
// Pass this on downstream if it ever gets called.
STDMETHODIMP GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES *pProps);
HRESULT CompleteConnect(IPin *pReceivePin);
- inline const BOOL ReadOnly()
- {
- return m_bReadOnly ;
- }
+ inline const BOOL ReadOnly() { return m_bReadOnly ; }
}; // CTransInPlaceInputPin
@@ -118,7 +113,7 @@ public:
// virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc);
// Provide a media type enumerator. Get it from upstream.
- STDMETHODIMP EnumMediaTypes(__deref_out IEnumMediaTypes **ppEnum);
+ STDMETHODIMP EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum );
// Say whether media type is acceptable.
HRESULT CheckMediaType(const CMediaType* pmt);
@@ -128,16 +123,12 @@ public:
void SetAllocator(IMemAllocator * pAllocator);
__out_opt IMemInputPin * ConnectedIMemInputPin()
- {
- return m_pInputPin;
- }
+ { return m_pInputPin; }
// Allow the filter to see what allocator we have
// N.B. This does NOT AddRef
__out IMemAllocator * PeekAllocator() const
- {
- return m_pAllocator;
- }
+ { return m_pAllocator; }
HRESULT CompleteConnect(IPin *pReceivePin);
@@ -172,10 +163,9 @@ public:
// We override EnumMediaTypes to bypass the transform class enumerator
// which would otherwise call this.
HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType)
- {
- DbgBreak("CTransInPlaceFilter::GetMediaType should never be called");
- return E_UNEXPECTED;
- }
+ { DbgBreak("CTransInPlaceFilter::GetMediaType should never be called");
+ return E_UNEXPECTED;
+ }
// This is called when we actually have to provide our own allocator.
HRESULT DecideBufferSize(IMemAllocator*, __inout ALLOCATOR_PROPERTIES *);
@@ -194,7 +184,7 @@ public:
// ----- You may want to override this -----------------------------
// =================================================================
- HRESULT CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePin);
+ HRESULT CompleteConnect(PIN_DIRECTION dir,IPin *pReceivePin);
// chance to customize the transform process
virtual HRESULT Receive(IMediaSample *pSample);
@@ -213,9 +203,7 @@ public:
// Override to register performance measurement with a less generic string
// You should do this to avoid confusion with other filters
virtual void RegisterPerfId()
- {
- m_idTransInPlace = MSR_REGISTER(TEXT("TransInPlace"));
- }
+ {m_idTransInPlace = MSR_REGISTER(TEXT("TransInPlace"));}
#endif // PERF
diff --git a/src/filters/BaseClasses/videoctl.cpp b/src/filters/BaseClasses/videoctl.cpp
index 655b8db1e..b12ccbd37 100644
--- a/src/filters/BaseClasses/videoctl.cpp
+++ b/src/filters/BaseClasses/videoctl.cpp
@@ -17,8 +17,7 @@
LPTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID)
{
- if(LoadString(g_hInst, iResourceID, pBuffer, STR_MAX_LENGTH) == 0)
- {
+ if (LoadString(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
return TEXT("");
}
return pBuffer;
@@ -27,8 +26,7 @@ LPTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, in
#ifdef UNICODE
LPSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPSTR pBuffer, int iResourceID)
{
- if(LoadStringA(g_hInst, iResourceID, pBuffer, STR_MAX_LENGTH) == 0)
- {
+ if (LoadStringA(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
return "";
}
return pBuffer;
@@ -50,21 +48,17 @@ LPWSTR WINAPI WideStringFromResource(__out_ecount(STR_MAX_LENGTH) LPWSTR pBuffer
{
*pBuffer = 0;
- if(g_amPlatform == VER_PLATFORM_WIN32_NT)
- {
- LoadStringW(g_hInst, iResourceID, pBuffer, STR_MAX_LENGTH);
- }
- else
- {
-
- CHAR szBuffer[STR_MAX_LENGTH];
- DWORD dwStringLength = LoadString(g_hInst, iResourceID, szBuffer, STR_MAX_LENGTH);
- // if we loaded a string convert it to wide characters, ensuring
- // that we also null terminate the result.
- if(dwStringLength++)
- {
- MultiByteToWideChar(CP_ACP, 0, szBuffer, dwStringLength, pBuffer, STR_MAX_LENGTH);
- }
+ if (g_amPlatform == VER_PLATFORM_WIN32_NT) {
+ LoadStringW(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH);
+ } else {
+
+ CHAR szBuffer[STR_MAX_LENGTH];
+ DWORD dwStringLength = LoadString(g_hInst,iResourceID,szBuffer,STR_MAX_LENGTH);
+ // if we loaded a string convert it to wide characters, ensuring
+ // that we also null terminate the result.
+ if (dwStringLength++) {
+ MultiByteToWideChar(CP_ACP,0,szBuffer,dwStringLength,pBuffer,STR_MAX_LENGTH);
+ }
}
return pBuffer;
}
@@ -89,8 +83,7 @@ BOOL WINAPI GetDialogSize(int iResourceID,
GetDesktopWindow(),
pDlgProc,
lParam);
- if(hwnd == NULL)
- {
+ if (hwnd == NULL) {
return FALSE;
}
@@ -117,13 +110,10 @@ STDMETHODIMP CAggDirectDraw::NonDelegatingQueryInterface(REFIID riid, __deref_ou
// Do we have this interface
- if(riid == IID_IDirectDraw)
- {
- return GetInterface((IDirectDraw *)this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ if (riid == IID_IDirectDraw) {
+ return GetInterface((IDirectDraw *)this,ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid,ppv);
}
}
@@ -138,54 +128,54 @@ STDMETHODIMP CAggDirectDraw::Compact()
STDMETHODIMP CAggDirectDraw::CreateClipper(DWORD dwFlags, __deref_out LPDIRECTDRAWCLIPPER *lplpDDClipper, __inout_opt IUnknown *pUnkOuter)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->CreateClipper(dwFlags, lplpDDClipper, pUnkOuter);
+ return m_pDirectDraw->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
}
STDMETHODIMP CAggDirectDraw::CreatePalette(DWORD dwFlags,
- __in LPPALETTEENTRY lpColorTable,
- __deref_out LPDIRECTDRAWPALETTE *lplpDDPalette,
- __inout_opt IUnknown *pUnkOuter)
+ __in LPPALETTEENTRY lpColorTable,
+ __deref_out LPDIRECTDRAWPALETTE *lplpDDPalette,
+ __inout_opt IUnknown *pUnkOuter)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->CreatePalette(dwFlags, lpColorTable, lplpDDPalette, pUnkOuter);
+ return m_pDirectDraw->CreatePalette(dwFlags,lpColorTable,lplpDDPalette,pUnkOuter);
}
STDMETHODIMP CAggDirectDraw::CreateSurface(__in LPDDSURFACEDESC lpDDSurfaceDesc,
- __deref_out LPDIRECTDRAWSURFACE *lplpDDSurface,
- __inout_opt IUnknown *pUnkOuter)
+ __deref_out LPDIRECTDRAWSURFACE *lplpDDSurface,
+ __inout_opt IUnknown *pUnkOuter)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->CreateSurface(lpDDSurfaceDesc, lplpDDSurface, pUnkOuter);
+ return m_pDirectDraw->CreateSurface(lpDDSurfaceDesc,lplpDDSurface,pUnkOuter);
}
STDMETHODIMP CAggDirectDraw::DuplicateSurface(__in LPDIRECTDRAWSURFACE lpDDSurface,
- __deref_out LPDIRECTDRAWSURFACE *lplpDupDDSurface)
+ __deref_out LPDIRECTDRAWSURFACE *lplpDupDDSurface)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->DuplicateSurface(lpDDSurface, lplpDupDDSurface);
+ return m_pDirectDraw->DuplicateSurface(lpDDSurface,lplpDupDDSurface);
}
STDMETHODIMP CAggDirectDraw::EnumDisplayModes(DWORD dwSurfaceDescCount,
- __in LPDDSURFACEDESC lplpDDSurfaceDescList,
- __in LPVOID lpContext,
- __in LPDDENUMMODESCALLBACK lpEnumCallback)
+ __in LPDDSURFACEDESC lplpDDSurfaceDescList,
+ __in LPVOID lpContext,
+ __in LPDDENUMMODESCALLBACK lpEnumCallback)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->EnumDisplayModes(dwSurfaceDescCount, lplpDDSurfaceDescList, lpContext, lpEnumCallback);
+ return m_pDirectDraw->EnumDisplayModes(dwSurfaceDescCount,lplpDDSurfaceDescList,lpContext,lpEnumCallback);
}
STDMETHODIMP CAggDirectDraw::EnumSurfaces(DWORD dwFlags,
- __in LPDDSURFACEDESC lpDDSD,
- __in LPVOID lpContext,
- __in LPDDENUMSURFACESCALLBACK lpEnumCallback)
+ __in LPDDSURFACEDESC lpDDSD,
+ __in LPVOID lpContext,
+ __in LPDDENUMSURFACESCALLBACK lpEnumCallback)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->EnumSurfaces(dwFlags, lpDDSD, lpContext, lpEnumCallback);
+ return m_pDirectDraw->EnumSurfaces(dwFlags,lpDDSD,lpContext,lpEnumCallback);
}
@@ -196,10 +186,10 @@ STDMETHODIMP CAggDirectDraw::FlipToGDISurface()
}
-STDMETHODIMP CAggDirectDraw::GetCaps(__out LPDDCAPS lpDDDriverCaps, __out LPDDCAPS lpDDHELCaps)
+STDMETHODIMP CAggDirectDraw::GetCaps(__out LPDDCAPS lpDDDriverCaps,__out LPDDCAPS lpDDHELCaps)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->GetCaps(lpDDDriverCaps, lpDDHELCaps);
+ return m_pDirectDraw->GetCaps(lpDDDriverCaps,lpDDHELCaps);
}
@@ -210,10 +200,10 @@ STDMETHODIMP CAggDirectDraw::GetDisplayMode(__out LPDDSURFACEDESC lpDDSurfaceDes
}
-STDMETHODIMP CAggDirectDraw::GetFourCCCodes(__inout LPDWORD lpNumCodes, __out_ecount(*lpNumCodes) LPDWORD lpCodes)
+STDMETHODIMP CAggDirectDraw::GetFourCCCodes(__inout LPDWORD lpNumCodes,__out_ecount(*lpNumCodes) LPDWORD lpCodes)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->GetFourCCCodes(lpNumCodes, lpCodes);
+ return m_pDirectDraw->GetFourCCCodes(lpNumCodes,lpCodes);
}
@@ -259,24 +249,24 @@ STDMETHODIMP CAggDirectDraw::RestoreDisplayMode()
}
-STDMETHODIMP CAggDirectDraw::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
+STDMETHODIMP CAggDirectDraw::SetCooperativeLevel(HWND hWnd,DWORD dwFlags)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->SetCooperativeLevel(hWnd, dwFlags);
+ return m_pDirectDraw->SetCooperativeLevel(hWnd,dwFlags);
}
-STDMETHODIMP CAggDirectDraw::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBpp)
+STDMETHODIMP CAggDirectDraw::SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->SetDisplayMode(dwWidth, dwHeight, dwBpp);
+ return m_pDirectDraw->SetDisplayMode(dwWidth,dwHeight,dwBpp);
}
-STDMETHODIMP CAggDirectDraw::WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
+STDMETHODIMP CAggDirectDraw::WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent)
{
ASSERT(m_pDirectDraw);
- return m_pDirectDraw->WaitForVerticalBlank(dwFlags, hEvent);
+ return m_pDirectDraw->WaitForVerticalBlank(dwFlags,hEvent);
}
@@ -294,13 +284,10 @@ STDMETHODIMP CAggDrawSurface::NonDelegatingQueryInterface(REFIID riid, __deref_o
// Do we have this interface
- if(riid == IID_IDirectDrawSurface)
- {
- return GetInterface((IDirectDrawSurface *)this, ppv);
- }
- else
- {
- return CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ if (riid == IID_IDirectDrawSurface) {
+ return GetInterface((IDirectDrawSurface *)this,ppv);
+ } else {
+ return CUnknown::NonDelegatingQueryInterface(riid,ppv);
}
}
@@ -326,64 +313,64 @@ STDMETHODIMP CAggDrawSurface::Blt(__in LPRECT lpDestRect,
__in LPDDBLTFX lpDDBltFx)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->Blt(lpDestRect, lpDDSrcSurface, lpSrcRect, dwFlags, lpDDBltFx);
+ return m_pDirectDrawSurface->Blt(lpDestRect,lpDDSrcSurface,lpSrcRect,dwFlags,lpDDBltFx);
}
-STDMETHODIMP CAggDrawSurface::BltBatch(__in_ecount(dwCount) LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags)
+STDMETHODIMP CAggDrawSurface::BltBatch(__in_ecount(dwCount) LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->BltBatch(lpDDBltBatch, dwCount, dwFlags);
+ return m_pDirectDrawSurface->BltBatch(lpDDBltBatch,dwCount,dwFlags);
}
-STDMETHODIMP CAggDrawSurface::BltFast(DWORD dwX, DWORD dwY,
+STDMETHODIMP CAggDrawSurface::BltFast(DWORD dwX,DWORD dwY,
__in LPDIRECTDRAWSURFACE lpDDSrcSurface,
__in LPRECT lpSrcRect,
DWORD dwTrans)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->BltFast(dwX, dwY, lpDDSrcSurface, lpSrcRect, dwTrans);
+ return m_pDirectDrawSurface->BltFast(dwX,dwY,lpDDSrcSurface,lpSrcRect,dwTrans);
}
STDMETHODIMP CAggDrawSurface::DeleteAttachedSurface(DWORD dwFlags,
- __in LPDIRECTDRAWSURFACE lpDDSAttachedSurface)
+ __in LPDIRECTDRAWSURFACE lpDDSAttachedSurface)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->DeleteAttachedSurface(dwFlags, lpDDSAttachedSurface);
+ return m_pDirectDrawSurface->DeleteAttachedSurface(dwFlags,lpDDSAttachedSurface);
}
STDMETHODIMP CAggDrawSurface::EnumAttachedSurfaces(__in LPVOID lpContext,
- __in LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
+ __in LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->EnumAttachedSurfaces(lpContext, lpEnumSurfacesCallback);
+ return m_pDirectDrawSurface->EnumAttachedSurfaces(lpContext,lpEnumSurfacesCallback);
}
STDMETHODIMP CAggDrawSurface::EnumOverlayZOrders(DWORD dwFlags,
- __in LPVOID lpContext,
- __in LPDDENUMSURFACESCALLBACK lpfnCallback)
+ __in LPVOID lpContext,
+ __in LPDDENUMSURFACESCALLBACK lpfnCallback)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->EnumOverlayZOrders(dwFlags, lpContext, lpfnCallback);
+ return m_pDirectDrawSurface->EnumOverlayZOrders(dwFlags,lpContext,lpfnCallback);
}
-STDMETHODIMP CAggDrawSurface::Flip(__in LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags)
+STDMETHODIMP CAggDrawSurface::Flip(__in LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->Flip(lpDDSurfaceTargetOverride, dwFlags);
+ return m_pDirectDrawSurface->Flip(lpDDSurfaceTargetOverride,dwFlags);
}
STDMETHODIMP CAggDrawSurface::GetAttachedSurface(__in LPDDSCAPS lpDDSCaps,
- __deref_out LPDIRECTDRAWSURFACE *lplpDDAttachedSurface)
+ __deref_out LPDIRECTDRAWSURFACE *lplpDDAttachedSurface)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->GetAttachedSurface(lpDDSCaps, lplpDDAttachedSurface);
+ return m_pDirectDrawSurface->GetAttachedSurface(lpDDSCaps,lplpDDAttachedSurface);
}
@@ -408,10 +395,10 @@ STDMETHODIMP CAggDrawSurface::GetClipper(__deref_out LPDIRECTDRAWCLIPPER *lplpDD
}
-STDMETHODIMP CAggDrawSurface::GetColorKey(DWORD dwFlags, __out LPDDCOLORKEY lpDDColorKey)
+STDMETHODIMP CAggDrawSurface::GetColorKey(DWORD dwFlags,__out LPDDCOLORKEY lpDDColorKey)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->GetColorKey(dwFlags, lpDDColorKey);
+ return m_pDirectDrawSurface->GetColorKey(dwFlags,lpDDColorKey);
}
@@ -429,10 +416,10 @@ STDMETHODIMP CAggDrawSurface::GetFlipStatus(DWORD dwFlags)
}
-STDMETHODIMP CAggDrawSurface::GetOverlayPosition(__out LPLONG lpdwX, __out LPLONG lpdwY)
+STDMETHODIMP CAggDrawSurface::GetOverlayPosition(__out LPLONG lpdwX,__out LPLONG lpdwY)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->GetOverlayPosition(lpdwX, lpdwY);
+ return m_pDirectDrawSurface->GetOverlayPosition(lpdwX,lpdwY);
}
@@ -467,8 +454,7 @@ STDMETHODIMP CAggDrawSurface::GetSurfaceDesc(__out LPDDSURFACEDESC lpDDSurfaceDe
// First call down to the underlying DirectDraw
HRESULT hr = m_pDirectDrawSurface->GetSurfaceDesc(lpDDSurfaceDesc);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -478,10 +464,10 @@ STDMETHODIMP CAggDrawSurface::GetSurfaceDesc(__out LPDDSURFACEDESC lpDDSurfaceDe
}
-STDMETHODIMP CAggDrawSurface::Initialize(__in LPDIRECTDRAW lpDD, __in LPDDSURFACEDESC lpDDSurfaceDesc)
+STDMETHODIMP CAggDrawSurface::Initialize(__in LPDIRECTDRAW lpDD,__in LPDDSURFACEDESC lpDDSurfaceDesc)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->Initialize(lpDD, lpDDSurfaceDesc);
+ return m_pDirectDrawSurface->Initialize(lpDD,lpDDSurfaceDesc);
}
@@ -498,7 +484,7 @@ STDMETHODIMP CAggDrawSurface::Lock(__in LPRECT lpDestRect,
HANDLE hEvent)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->Lock(lpDestRect, lpDDSurfaceDesc, dwFlags, hEvent);
+ return m_pDirectDrawSurface->Lock(lpDestRect,lpDDSurfaceDesc,dwFlags,hEvent);
}
@@ -523,17 +509,17 @@ STDMETHODIMP CAggDrawSurface::SetClipper(__in LPDIRECTDRAWCLIPPER lpDDClipper)
}
-STDMETHODIMP CAggDrawSurface::SetColorKey(DWORD dwFlags, __in LPDDCOLORKEY lpDDColorKey)
+STDMETHODIMP CAggDrawSurface::SetColorKey(DWORD dwFlags,__in LPDDCOLORKEY lpDDColorKey)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->SetColorKey(dwFlags, lpDDColorKey);
+ return m_pDirectDrawSurface->SetColorKey(dwFlags,lpDDColorKey);
}
-STDMETHODIMP CAggDrawSurface::SetOverlayPosition(LONG dwX, LONG dwY)
+STDMETHODIMP CAggDrawSurface::SetOverlayPosition(LONG dwX,LONG dwY)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->SetOverlayPosition(dwX, dwY);
+ return m_pDirectDrawSurface->SetOverlayPosition(dwX,dwY);
}
@@ -552,13 +538,13 @@ STDMETHODIMP CAggDrawSurface::Unlock(__in LPVOID lpSurfaceData)
STDMETHODIMP CAggDrawSurface::UpdateOverlay(__in LPRECT lpSrcRect,
- __in LPDIRECTDRAWSURFACE lpDDDestSurface,
- __in LPRECT lpDestRect,
- DWORD dwFlags,
- __in LPDDOVERLAYFX lpDDOverlayFX)
+ __in LPDIRECTDRAWSURFACE lpDDDestSurface,
+ __in LPRECT lpDestRect,
+ DWORD dwFlags,
+ __in LPDDOVERLAYFX lpDDOverlayFX)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->UpdateOverlay(lpSrcRect, lpDDDestSurface, lpDestRect, dwFlags, lpDDOverlayFX);
+ return m_pDirectDrawSurface->UpdateOverlay(lpSrcRect,lpDDDestSurface,lpDestRect,dwFlags,lpDDOverlayFX);
}
@@ -569,10 +555,10 @@ STDMETHODIMP CAggDrawSurface::UpdateOverlayDisplay(DWORD dwFlags)
}
-STDMETHODIMP CAggDrawSurface::UpdateOverlayZOrder(DWORD dwFlags, __in LPDIRECTDRAWSURFACE lpDDSReference)
+STDMETHODIMP CAggDrawSurface::UpdateOverlayZOrder(DWORD dwFlags,__in LPDIRECTDRAWSURFACE lpDDSReference)
{
ASSERT(m_pDirectDrawSurface);
- return m_pDirectDrawSurface->UpdateOverlayZOrder(dwFlags, lpDDSReference);
+ return m_pDirectDrawSurface->UpdateOverlayZOrder(dwFlags,lpDDSReference);
}
@@ -595,8 +581,7 @@ CLoadDirectDraw::~CLoadDirectDraw()
{
ReleaseDirectDraw();
- if(m_hDirectDraw)
- {
+ if (m_hDirectDraw) {
NOTE("Unloading library");
FreeLibrary(m_hDirectDraw);
}
@@ -624,8 +609,7 @@ HRESULT CLoadDirectDraw::LoadDirectDraw(__in LPSTR szDevice)
// Is DirectDraw already loaded
- if(m_pDirectDraw)
- {
+ if (m_pDirectDraw) {
NOTE("Already loaded");
ASSERT(m_hDirectDraw);
return NOERROR;
@@ -639,9 +623,8 @@ HRESULT CLoadDirectDraw::LoadDirectDraw(__in LPSTR szDevice)
m_hDirectDraw = LoadLibrary(TEXT("DDRAW.DLL"));
SetErrorMode(ErrorMode);
- if(m_hDirectDraw == NULL)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Can't load DDRAW.DLL")));
+ if (m_hDirectDraw == NULL) {
+ DbgLog((LOG_ERROR,1,TEXT("Can't load DDRAW.DLL")));
NOTE("No library");
return E_NOINTERFACE;
}
@@ -649,40 +632,38 @@ HRESULT CLoadDirectDraw::LoadDirectDraw(__in LPSTR szDevice)
// Get the DLL address for the creator function
- pDrawCreate = (PDRAWCREATE)GetProcAddress(m_hDirectDraw, "DirectDrawCreate");
+ pDrawCreate = (PDRAWCREATE)GetProcAddress(m_hDirectDraw,"DirectDrawCreate");
// force ANSI, we assume it
- pDrawEnum = (PDRAWENUM)GetProcAddress(m_hDirectDraw, "DirectDrawEnumerateA");
+ pDrawEnum = (PDRAWENUM)GetProcAddress(m_hDirectDraw,"DirectDrawEnumerateA");
pDrawEnumEx = (LPDIRECTDRAWENUMERATEEXA)GetProcAddress(m_hDirectDraw,
- "DirectDrawEnumerateExA");
+ "DirectDrawEnumerateExA");
// We don't NEED DirectDrawEnumerateEx, that's just for multimon stuff
- if(pDrawCreate == NULL || pDrawEnum == NULL)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Can't get functions: Create=%x Enum=%x"),
- pDrawCreate, pDrawEnum));
+ if (pDrawCreate == NULL || pDrawEnum == NULL) {
+ DbgLog((LOG_ERROR,1,TEXT("Can't get functions: Create=%x Enum=%x"),
+ pDrawCreate, pDrawEnum));
NOTE("No entry point");
ReleaseDirectDraw();
return E_NOINTERFACE;
}
- DbgLog((LOG_TRACE, 3, TEXT("Creating DDraw for device %s"),
- szDevice ? szDevice : "<NULL>"));
+ DbgLog((LOG_TRACE,3,TEXT("Creating DDraw for device %s"),
+ szDevice ? szDevice : "<NULL>"));
// Create a DirectDraw display provider for this device, using the fancy
// multimon-aware version, if it exists
- if(pDrawEnumEx)
+ if (pDrawEnumEx)
m_pDirectDraw = DirectDrawCreateFromDeviceEx(szDevice, pDrawCreate,
- pDrawEnumEx);
+ pDrawEnumEx);
else
m_pDirectDraw = DirectDrawCreateFromDevice(szDevice, pDrawCreate,
- pDrawEnum);
+ pDrawEnum);
- if(m_pDirectDraw == NULL)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Can't create DDraw")));
- NOTE("No instance");
- ReleaseDirectDraw();
- return E_NOINTERFACE;
+ if (m_pDirectDraw == NULL) {
+ DbgLog((LOG_ERROR,1,TEXT("Can't create DDraw")));
+ NOTE("No instance");
+ ReleaseDirectDraw();
+ return E_NOINTERFACE;
}
return NOERROR;
}
@@ -700,8 +681,7 @@ void CLoadDirectDraw::ReleaseDirectDraw()
// Release any DirectDraw provider interface
- if(m_pDirectDraw)
- {
+ if (m_pDirectDraw) {
NOTE("Releasing instance");
m_pDirectDraw->Release();
m_pDirectDraw = NULL;
@@ -716,8 +696,7 @@ HRESULT CLoadDirectDraw::IsDirectDrawLoaded()
{
NOTE("Entering IsDirectDrawLoaded");
- if(m_pDirectDraw == NULL)
- {
+ if (m_pDirectDraw == NULL) {
NOTE("DirectDraw not loaded");
return S_FALSE;
}
@@ -731,8 +710,7 @@ LPDIRECTDRAW CLoadDirectDraw::GetDirectDraw()
{
NOTE("Entering GetDirectDraw");
- if(m_pDirectDraw == NULL)
- {
+ if (m_pDirectDraw == NULL) {
NOTE("No DirectDraw");
return NULL;
}
@@ -751,21 +729,18 @@ LPDIRECTDRAW CLoadDirectDraw::GetDirectDraw()
BOOL CLoadDirectDraw::IsDirectDrawVersion1()
{
- if(m_pDirectDraw == NULL)
- return FALSE;
+ if (m_pDirectDraw == NULL)
+ return FALSE;
IDirectDraw2 *p = NULL;
HRESULT hr = m_pDirectDraw->QueryInterface(IID_IDirectDraw2, (void **)&p);
- if(p)
- p->Release();
- if(hr == NOERROR)
- {
- DbgLog((LOG_TRACE, 3, TEXT("Direct Draw Version 2 or greater")));
- return FALSE;
- }
- else
- {
- DbgLog((LOG_TRACE, 3, TEXT("Direct Draw Version 1")));
- return TRUE;
+ if (p)
+ p->Release();
+ if (hr == NOERROR) {
+ DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 2 or greater")));
+ return FALSE;
+ } else {
+ DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 1")));
+ return TRUE;
}
}
diff --git a/src/filters/BaseClasses/videoctl.h b/src/filters/BaseClasses/videoctl.h
index 27bc1ce07..30c377834 100644
--- a/src/filters/BaseClasses/videoctl.h
+++ b/src/filters/BaseClasses/videoctl.h
@@ -43,44 +43,43 @@ protected:
public:
DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv);
// Constructor and destructor
- CAggDirectDraw(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk) :
- CUnknown(pName, pUnk),
+ CAggDirectDraw(__in_opt LPCTSTR pName,__inout_opt LPUNKNOWN pUnk) :
+ CUnknown(pName,pUnk),
m_pDirectDraw(NULL) { };
virtual CAggDirectDraw::~CAggDirectDraw() { };
// Set the object we should be aggregating
- void SetDirectDraw(__inout LPDIRECTDRAW pDirectDraw)
- {
+ void SetDirectDraw(__inout LPDIRECTDRAW pDirectDraw) {
m_pDirectDraw = pDirectDraw;
}
// IDirectDraw methods
STDMETHODIMP Compact();
- STDMETHODIMP CreateClipper(DWORD dwFlags, __deref_out LPDIRECTDRAWCLIPPER *lplpDDClipper, __inout_opt IUnknown *pUnkOuter);
- STDMETHODIMP CreatePalette(DWORD dwFlags, __in LPPALETTEENTRY lpColorTable, __deref_out LPDIRECTDRAWPALETTE *lplpDDPalette, __inout_opt IUnknown *pUnkOuter);
- STDMETHODIMP CreateSurface(__in LPDDSURFACEDESC lpDDSurfaceDesc, __deref_out LPDIRECTDRAWSURFACE *lplpDDSurface, __inout_opt IUnknown *pUnkOuter);
- STDMETHODIMP DuplicateSurface(__in LPDIRECTDRAWSURFACE lpDDSurface, __deref_out LPDIRECTDRAWSURFACE *lplpDupDDSurface);
- STDMETHODIMP EnumDisplayModes(DWORD dwSurfaceDescCount, __in LPDDSURFACEDESC lplpDDSurfaceDescList, __in LPVOID lpContext, __in LPDDENUMMODESCALLBACK lpEnumCallback);
- STDMETHODIMP EnumSurfaces(DWORD dwFlags, __in LPDDSURFACEDESC lpDDSD, __in LPVOID lpContext, __in LPDDENUMSURFACESCALLBACK lpEnumCallback);
+ STDMETHODIMP CreateClipper(DWORD dwFlags,__deref_out LPDIRECTDRAWCLIPPER *lplpDDClipper,__inout_opt IUnknown *pUnkOuter);
+ STDMETHODIMP CreatePalette(DWORD dwFlags,__in LPPALETTEENTRY lpColorTable,__deref_out LPDIRECTDRAWPALETTE *lplpDDPalette,__inout_opt IUnknown *pUnkOuter);
+ STDMETHODIMP CreateSurface(__in LPDDSURFACEDESC lpDDSurfaceDesc,__deref_out LPDIRECTDRAWSURFACE *lplpDDSurface,__inout_opt IUnknown *pUnkOuter);
+ STDMETHODIMP DuplicateSurface(__in LPDIRECTDRAWSURFACE lpDDSurface,__deref_out LPDIRECTDRAWSURFACE *lplpDupDDSurface);
+ STDMETHODIMP EnumDisplayModes(DWORD dwSurfaceDescCount,__in LPDDSURFACEDESC lplpDDSurfaceDescList,__in LPVOID lpContext,__in LPDDENUMMODESCALLBACK lpEnumCallback);
+ STDMETHODIMP EnumSurfaces(DWORD dwFlags,__in LPDDSURFACEDESC lpDDSD,__in LPVOID lpContext,__in LPDDENUMSURFACESCALLBACK lpEnumCallback);
STDMETHODIMP FlipToGDISurface();
- STDMETHODIMP GetCaps(__out LPDDCAPS lpDDDriverCaps, __out LPDDCAPS lpDDHELCaps);
+ STDMETHODIMP GetCaps(__out LPDDCAPS lpDDDriverCaps,__out LPDDCAPS lpDDHELCaps);
STDMETHODIMP GetDisplayMode(__out LPDDSURFACEDESC lpDDSurfaceDesc);
- STDMETHODIMP GetFourCCCodes(__inout LPDWORD lpNumCodes, __out_ecount(*lpNumCodes) LPDWORD lpCodes);
+ STDMETHODIMP GetFourCCCodes(__inout LPDWORD lpNumCodes,__out_ecount(*lpNumCodes) LPDWORD lpCodes);
STDMETHODIMP GetGDISurface(__deref_out LPDIRECTDRAWSURFACE *lplpGDIDDSurface);
STDMETHODIMP GetMonitorFrequency(__out LPDWORD lpdwFrequency);
STDMETHODIMP GetScanLine(__out LPDWORD lpdwScanLine);
STDMETHODIMP GetVerticalBlankStatus(__out LPBOOL lpblsInVB);
STDMETHODIMP Initialize(__in GUID *lpGUID);
STDMETHODIMP RestoreDisplayMode();
- STDMETHODIMP SetCooperativeLevel(HWND hWnd, DWORD dwFlags);
- STDMETHODIMP SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBpp);
- STDMETHODIMP WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent);
+ STDMETHODIMP SetCooperativeLevel(HWND hWnd,DWORD dwFlags);
+ STDMETHODIMP SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp);
+ STDMETHODIMP WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent);
};
@@ -95,19 +94,18 @@ protected:
public:
DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv);
// Constructor and destructor
- CAggDrawSurface(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk) :
- CUnknown(pName, pUnk),
+ CAggDrawSurface(__in_opt LPCTSTR pName,__inout_opt LPUNKNOWN pUnk) :
+ CUnknown(pName,pUnk),
m_pDirectDrawSurface(NULL) { };
virtual ~CAggDrawSurface() { };
// Set the object we should be aggregating
- void SetDirectDrawSurface(__inout LPDIRECTDRAWSURFACE pDirectDrawSurface)
- {
+ void SetDirectDrawSurface(__inout LPDIRECTDRAWSURFACE pDirectDrawSurface) {
m_pDirectDrawSurface = pDirectDrawSurface;
}
@@ -115,37 +113,37 @@ public:
STDMETHODIMP AddAttachedSurface(__in LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
STDMETHODIMP AddOverlayDirtyRect(__in LPRECT lpRect);
- STDMETHODIMP Blt(__in LPRECT lpDestRect, __in LPDIRECTDRAWSURFACE lpDDSrcSurface, __in LPRECT lpSrcRect, DWORD dwFlags, __in LPDDBLTFX lpDDBltFx);
- STDMETHODIMP BltBatch(__in_ecount(dwCount) LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags);
- STDMETHODIMP BltFast(DWORD dwX, DWORD dwY, __in LPDIRECTDRAWSURFACE lpDDSrcSurface, __in LPRECT lpSrcRect, DWORD dwTrans);
- STDMETHODIMP DeleteAttachedSurface(DWORD dwFlags, __in LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
- STDMETHODIMP EnumAttachedSurfaces(__in LPVOID lpContext, __in LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback);
- STDMETHODIMP EnumOverlayZOrders(DWORD dwFlags, __in LPVOID lpContext, __in LPDDENUMSURFACESCALLBACK lpfnCallback);
- STDMETHODIMP Flip(__in LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags);
- STDMETHODIMP GetAttachedSurface(__in LPDDSCAPS lpDDSCaps, __deref_out LPDIRECTDRAWSURFACE *lplpDDAttachedSurface);
+ STDMETHODIMP Blt(__in LPRECT lpDestRect,__in LPDIRECTDRAWSURFACE lpDDSrcSurface,__in LPRECT lpSrcRect,DWORD dwFlags,__in LPDDBLTFX lpDDBltFx);
+ STDMETHODIMP BltBatch(__in_ecount(dwCount) LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags);
+ STDMETHODIMP BltFast(DWORD dwX,DWORD dwY,__in LPDIRECTDRAWSURFACE lpDDSrcSurface,__in LPRECT lpSrcRect,DWORD dwTrans);
+ STDMETHODIMP DeleteAttachedSurface(DWORD dwFlags,__in LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
+ STDMETHODIMP EnumAttachedSurfaces(__in LPVOID lpContext,__in LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback);
+ STDMETHODIMP EnumOverlayZOrders(DWORD dwFlags,__in LPVOID lpContext,__in LPDDENUMSURFACESCALLBACK lpfnCallback);
+ STDMETHODIMP Flip(__in LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags);
+ STDMETHODIMP GetAttachedSurface(__in LPDDSCAPS lpDDSCaps,__deref_out LPDIRECTDRAWSURFACE *lplpDDAttachedSurface);
STDMETHODIMP GetBltStatus(DWORD dwFlags);
STDMETHODIMP GetCaps(__out LPDDSCAPS lpDDSCaps);
STDMETHODIMP GetClipper(__deref_out LPDIRECTDRAWCLIPPER *lplpDDClipper);
- STDMETHODIMP GetColorKey(DWORD dwFlags, __out LPDDCOLORKEY lpDDColorKey);
+ STDMETHODIMP GetColorKey(DWORD dwFlags,__out LPDDCOLORKEY lpDDColorKey);
STDMETHODIMP GetDC(__out HDC *lphDC);
STDMETHODIMP GetFlipStatus(DWORD dwFlags);
- STDMETHODIMP GetOverlayPosition(__out LPLONG lpdwX, __out LPLONG lpdwY);
+ STDMETHODIMP GetOverlayPosition(__out LPLONG lpdwX,__out LPLONG lpdwY);
STDMETHODIMP GetPalette(__deref_out LPDIRECTDRAWPALETTE *lplpDDPalette);
STDMETHODIMP GetPixelFormat(__out LPDDPIXELFORMAT lpDDPixelFormat);
STDMETHODIMP GetSurfaceDesc(__out LPDDSURFACEDESC lpDDSurfaceDesc);
- STDMETHODIMP Initialize(__in LPDIRECTDRAW lpDD, __in LPDDSURFACEDESC lpDDSurfaceDesc);
+ STDMETHODIMP Initialize(__in LPDIRECTDRAW lpDD,__in LPDDSURFACEDESC lpDDSurfaceDesc);
STDMETHODIMP IsLost();
- STDMETHODIMP Lock(__in LPRECT lpDestRect, __inout LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent);
+ STDMETHODIMP Lock(__in LPRECT lpDestRect,__inout LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent);
STDMETHODIMP ReleaseDC(HDC hDC);
STDMETHODIMP Restore();
STDMETHODIMP SetClipper(__in LPDIRECTDRAWCLIPPER lpDDClipper);
- STDMETHODIMP SetColorKey(DWORD dwFlags, __in LPDDCOLORKEY lpDDColorKey);
- STDMETHODIMP SetOverlayPosition(LONG dwX, LONG dwY);
+ STDMETHODIMP SetColorKey(DWORD dwFlags,__in LPDDCOLORKEY lpDDColorKey);
+ STDMETHODIMP SetOverlayPosition(LONG dwX,LONG dwY);
STDMETHODIMP SetPalette(__in LPDIRECTDRAWPALETTE lpDDPalette);
STDMETHODIMP Unlock(__in LPVOID lpSurfaceData);
- STDMETHODIMP UpdateOverlay(__in LPRECT lpSrcRect, __in LPDIRECTDRAWSURFACE lpDDDestSurface, __in LPRECT lpDestRect, DWORD dwFlags, __in LPDDOVERLAYFX lpDDOverlayFX);
+ STDMETHODIMP UpdateOverlay(__in LPRECT lpSrcRect,__in LPDIRECTDRAWSURFACE lpDDDestSurface,__in LPRECT lpDestRect,DWORD dwFlags,__in LPDDOVERLAYFX lpDDOverlayFX);
STDMETHODIMP UpdateOverlayDisplay(DWORD dwFlags);
- STDMETHODIMP UpdateOverlayZOrder(DWORD dwFlags, __in LPDIRECTDRAWSURFACE lpDDSReference);
+ STDMETHODIMP UpdateOverlayZOrder(DWORD dwFlags,__in LPDIRECTDRAWSURFACE lpDDSReference);
};
diff --git a/src/filters/BaseClasses/vtrans.cpp b/src/filters/BaseClasses/vtrans.cpp
index 750ab85d7..27502970f 100644
--- a/src/filters/BaseClasses/vtrans.cpp
+++ b/src/filters/BaseClasses/vtrans.cpp
@@ -12,7 +12,7 @@
// #include <vtransfr.h> // now in precomp file streams.h
CVideoTransformFilter::CVideoTransformFilter
-(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, REFCLSID clsid)
+ ( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, REFCLSID clsid)
: CTransformFilter(pName, pUnk, clsid)
, m_itrLate(0)
, m_nKeyFramePeriod(0) // No QM until we see at least 2 key frames
@@ -30,7 +30,7 @@ CVideoTransformFilter::CVideoTransformFilter
CVideoTransformFilter::~CVideoTransformFilter()
{
- // nothing to do
+ // nothing to do
}
@@ -118,7 +118,7 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
IMediaSample * pOutSample;
// If no output pin to deliver to then no point sending us data
- ASSERT(m_pOutput != NULL) ;
+ ASSERT (m_pOutput != NULL) ;
// The source filter may dynamically ask us to start transforming from a
// different media type than the one we're using now. If we don't, we'll
@@ -130,48 +130,45 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
#define rcT1 ((VIDEOINFOHEADER *)(pmt->pbFormat))->rcTarget
pSample->GetMediaType(&pmt);
- if(pmt != NULL && pmt->pbFormat != NULL)
- {
+ if (pmt != NULL && pmt->pbFormat != NULL) {
- // spew some debug output
- ASSERT(!IsEqualGUID(pmt->majortype, GUID_NULL));
+ // spew some debug output
+ ASSERT(!IsEqualGUID(pmt->majortype, GUID_NULL));
#ifdef _DEBUG
fccOut.SetFOURCC(&pmt->subtype);
- LONG lCompression = HEADER(pmt->pbFormat)->biCompression;
- LONG lBitCount = HEADER(pmt->pbFormat)->biBitCount;
- LONG lStride = (HEADER(pmt->pbFormat)->biWidth * lBitCount + 7) / 8;
- lStride = (lStride + 3) & ~3;
- DbgLog((LOG_TRACE, 3, TEXT("*Changing input type on the fly to")));
- DbgLog((LOG_TRACE, 3, TEXT("FourCC: %lx Compression: %lx BitCount: %ld"),
- fccOut.GetFOURCC(), lCompression, lBitCount));
- DbgLog((LOG_TRACE, 3, TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"),
- HEADER(pmt->pbFormat)->biHeight,
- rcT1.left, rcT1.top, rcT1.right, rcT1.bottom));
- DbgLog((LOG_TRACE, 3, TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"),
- rcS1.left, rcS1.top, rcS1.right, rcS1.bottom,
- lStride));
+ LONG lCompression = HEADER(pmt->pbFormat)->biCompression;
+ LONG lBitCount = HEADER(pmt->pbFormat)->biBitCount;
+ LONG lStride = (HEADER(pmt->pbFormat)->biWidth * lBitCount + 7) / 8;
+ lStride = (lStride + 3) & ~3;
+ DbgLog((LOG_TRACE,3,TEXT("*Changing input type on the fly to")));
+ DbgLog((LOG_TRACE,3,TEXT("FourCC: %lx Compression: %lx BitCount: %ld"),
+ fccOut.GetFOURCC(), lCompression, lBitCount));
+ DbgLog((LOG_TRACE,3,TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"),
+ HEADER(pmt->pbFormat)->biHeight,
+ rcT1.left, rcT1.top, rcT1.right, rcT1.bottom));
+ DbgLog((LOG_TRACE,3,TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"),
+ rcS1.left, rcS1.top, rcS1.right, rcS1.bottom,
+ lStride));
#endif
- // now switch to using the new format. I am assuming that the
- // derived filter will do the right thing when its media type is
- // switched and streaming is restarted.
-
- StopStreaming();
- m_pInput->CurrentMediaType() = *pmt;
- DeleteMediaType(pmt);
- // if this fails, playback will stop, so signal an error
- hr = StartStreaming();
- if(FAILED(hr))
- {
- return AbortPlayback(hr);
- }
+ // now switch to using the new format. I am assuming that the
+ // derived filter will do the right thing when its media type is
+ // switched and streaming is restarted.
+
+ StopStreaming();
+ m_pInput->CurrentMediaType() = *pmt;
+ DeleteMediaType(pmt);
+ // if this fails, playback will stop, so signal an error
+ hr = StartStreaming();
+ if (FAILED(hr)) {
+ return AbortPlayback(hr);
+ }
}
// Now that we have noticed any format changes on the input sample, it's
// OK to discard it.
- if(ShouldSkipFrame(pSample))
- {
+ if (ShouldSkipFrame(pSample)) {
MSR_NOTE(m_idSkip);
m_bSampleSkipped = TRUE;
return NOERROR;
@@ -180,8 +177,7 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
// Set up the output sample
hr = InitializeOutputSample(pSample, &pOutSample);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -194,70 +190,64 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
#define rcT ((VIDEOINFOHEADER *)(pmtOut->pbFormat))->rcTarget
pOutSample->GetMediaType(&pmtOut);
- if(pmtOut != NULL && pmtOut->pbFormat != NULL)
- {
+ if (pmtOut != NULL && pmtOut->pbFormat != NULL) {
- // spew some debug output
- ASSERT(!IsEqualGUID(pmtOut->majortype, GUID_NULL));
+ // spew some debug output
+ ASSERT(!IsEqualGUID(pmtOut->majortype, GUID_NULL));
#ifdef _DEBUG
fccOut.SetFOURCC(&pmtOut->subtype);
- LONG lCompression = HEADER(pmtOut->pbFormat)->biCompression;
- LONG lBitCount = HEADER(pmtOut->pbFormat)->biBitCount;
- LONG lStride = (HEADER(pmtOut->pbFormat)->biWidth * lBitCount + 7) / 8;
- lStride = (lStride + 3) & ~3;
- DbgLog((LOG_TRACE, 3, TEXT("*Changing output type on the fly to")));
- DbgLog((LOG_TRACE, 3, TEXT("FourCC: %lx Compression: %lx BitCount: %ld"),
- fccOut.GetFOURCC(), lCompression, lBitCount));
- DbgLog((LOG_TRACE, 3, TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"),
- HEADER(pmtOut->pbFormat)->biHeight,
- rcT.left, rcT.top, rcT.right, rcT.bottom));
- DbgLog((LOG_TRACE, 3, TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"),
- rcS.left, rcS.top, rcS.right, rcS.bottom,
- lStride));
+ LONG lCompression = HEADER(pmtOut->pbFormat)->biCompression;
+ LONG lBitCount = HEADER(pmtOut->pbFormat)->biBitCount;
+ LONG lStride = (HEADER(pmtOut->pbFormat)->biWidth * lBitCount + 7) / 8;
+ lStride = (lStride + 3) & ~3;
+ DbgLog((LOG_TRACE,3,TEXT("*Changing output type on the fly to")));
+ DbgLog((LOG_TRACE,3,TEXT("FourCC: %lx Compression: %lx BitCount: %ld"),
+ fccOut.GetFOURCC(), lCompression, lBitCount));
+ DbgLog((LOG_TRACE,3,TEXT("biHeight: %ld rcDst: (%ld, %ld, %ld, %ld)"),
+ HEADER(pmtOut->pbFormat)->biHeight,
+ rcT.left, rcT.top, rcT.right, rcT.bottom));
+ DbgLog((LOG_TRACE,3,TEXT("rcSrc: (%ld, %ld, %ld, %ld) Stride: %ld"),
+ rcS.left, rcS.top, rcS.right, rcS.bottom,
+ lStride));
#endif
- // now switch to using the new format. I am assuming that the
- // derived filter will do the right thing when its media type is
- // switched and streaming is restarted.
+ // now switch to using the new format. I am assuming that the
+ // derived filter will do the right thing when its media type is
+ // switched and streaming is restarted.
- StopStreaming();
- m_pOutput->CurrentMediaType() = *pmtOut;
- DeleteMediaType(pmtOut);
- hr = StartStreaming();
+ StopStreaming();
+ m_pOutput->CurrentMediaType() = *pmtOut;
+ DeleteMediaType(pmtOut);
+ hr = StartStreaming();
- if(SUCCEEDED(hr))
- {
- // a new format, means a new empty buffer, so wait for a keyframe
- // before passing anything on to the renderer.
- // !!! a keyframe may never come, so give up after 30 frames
- DbgLog((LOG_TRACE, 3, TEXT("Output format change means we must wait for a keyframe")));
- m_nWaitForKey = 30;
+ if (SUCCEEDED(hr)) {
+ // a new format, means a new empty buffer, so wait for a keyframe
+ // before passing anything on to the renderer.
+ // !!! a keyframe may never come, so give up after 30 frames
+ DbgLog((LOG_TRACE,3,TEXT("Output format change means we must wait for a keyframe")));
+ m_nWaitForKey = 30;
- // if this fails, playback will stop, so signal an error
- }
- else
- {
+ // if this fails, playback will stop, so signal an error
+ } else {
// Must release the sample before calling AbortPlayback
// because we might be holding the win16 lock or
// ddraw lock
pOutSample->Release();
- AbortPlayback(hr);
+ AbortPlayback(hr);
return hr;
- }
+ }
}
// After a discontinuity, we need to wait for the next key frame
- if(pSample->IsDiscontinuity() == S_OK)
- {
- DbgLog((LOG_TRACE, 3, TEXT("Non-key discontinuity - wait for keyframe")));
- m_nWaitForKey = 30;
+ if (pSample->IsDiscontinuity() == S_OK) {
+ DbgLog((LOG_TRACE,3,TEXT("Non-key discontinuity - wait for keyframe")));
+ m_nWaitForKey = 30;
}
// Start timing the transform (and log it if PERF is defined)
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
m_tDecodeStart = timeGetTime();
MSR_START(m_idTransform);
@@ -266,47 +256,39 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
// Stop the clock (and log it if PERF is defined)
MSR_STOP(m_idTransform);
- m_tDecodeStart = timeGetTime() - m_tDecodeStart;
- m_itrAvgDecode = m_tDecodeStart * (10000 / 16) + 15 * (m_itrAvgDecode / 16);
+ m_tDecodeStart = timeGetTime()-m_tDecodeStart;
+ m_itrAvgDecode = m_tDecodeStart*(10000/16) + 15*(m_itrAvgDecode/16);
// Maybe we're waiting for a keyframe still?
- if(m_nWaitForKey)
+ if (m_nWaitForKey)
m_nWaitForKey--;
- if(m_nWaitForKey && pSample->IsSyncPoint() == S_OK)
- m_nWaitForKey = FALSE;
+ if (m_nWaitForKey && pSample->IsSyncPoint() == S_OK)
+ m_nWaitForKey = FALSE;
// if so, then we don't want to pass this on to the renderer
- if(m_nWaitForKey && hr == NOERROR)
- {
- DbgLog((LOG_TRACE, 3, TEXT("still waiting for a keyframe")));
- hr = S_FALSE;
- }
+ if (m_nWaitForKey && hr == NOERROR) {
+ DbgLog((LOG_TRACE,3,TEXT("still waiting for a keyframe")));
+ hr = S_FALSE;
+ }
}
- if(FAILED(hr))
- {
- DbgLog((LOG_TRACE, 1, TEXT("Error from video transform")));
- }
- else
- {
+ if (FAILED(hr)) {
+ DbgLog((LOG_TRACE,1,TEXT("Error from video transform")));
+ } else {
// the Transform() function can return S_FALSE to indicate that the
// sample should not be delivered; we only deliver the sample if it's
// really S_OK (same as NOERROR, of course.)
// Try not to return S_FALSE to a direct draw buffer (it's wasteful)
// Try to take the decision earlier - before you get it.
- if(hr == NOERROR)
- {
- hr = m_pOutput->Deliver(pOutSample);
- }
- else
- {
+ if (hr == NOERROR) {
+ hr = m_pOutput->Deliver(pOutSample);
+ } else {
// S_FALSE returned from Transform is a PRIVATE agreement
// We should return NOERROR from Receive() in this case because returning S_FALSE
// from Receive() means that this is the end of the stream and no more data should
// be sent.
- if(S_FALSE == hr)
- {
+ if (S_FALSE == hr) {
// We must Release() the sample before doing anything
// like calling the filter graph because having the
@@ -314,10 +296,9 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
// (== win16 lock on some versions)
pOutSample->Release();
m_bSampleSkipped = TRUE;
- if(!m_bQualityChanged)
- {
+ if (!m_bQualityChanged) {
m_bQualityChanged = TRUE;
- NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
+ NotifyEvent(EC_QUALITY_CHANGE,0,0);
}
return NOERROR;
}
@@ -334,35 +315,30 @@ HRESULT CVideoTransformFilter::Receive(IMediaSample *pSample)
-BOOL CVideoTransformFilter::ShouldSkipFrame(IMediaSample * pIn)
+BOOL CVideoTransformFilter::ShouldSkipFrame( IMediaSample * pIn)
{
REFERENCE_TIME trStart, trStopAt;
HRESULT hr = pIn->GetTime(&trStart, &trStopAt);
// Don't skip frames with no timestamps
- if(hr != S_OK)
- return FALSE;
+ if (hr != S_OK)
+ return FALSE;
int itrFrame = (int)(trStopAt - trStart); // frame duration
- if(S_OK == pIn->IsSyncPoint())
- {
+ if(S_OK==pIn->IsSyncPoint()) {
MSR_INTEGER(m_idFrameType, 1);
- if(m_nKeyFramePeriod < m_nFramesSinceKeyFrame)
- {
+ if ( m_nKeyFramePeriod < m_nFramesSinceKeyFrame ) {
// record the max
m_nKeyFramePeriod = m_nFramesSinceKeyFrame;
}
m_nFramesSinceKeyFrame = 0;
m_bSkipping = FALSE;
- }
- else
- {
+ } else {
MSR_INTEGER(m_idFrameType, 2);
- if(m_nFramesSinceKeyFrame > m_nKeyFramePeriod
- && m_nKeyFramePeriod > 0
- )
- {
+ if ( m_nFramesSinceKeyFrame>m_nKeyFramePeriod
+ && m_nKeyFramePeriod>0
+ ) {
// We haven't seen the key frame yet, but we were clearly being
// overoptimistic about how frequent they are.
m_nKeyFramePeriod = m_nFramesSinceKeyFrame;
@@ -375,13 +351,11 @@ BOOL CVideoTransformFilter::ShouldSkipFrame(IMediaSample * pIn)
// then any quality problems are actually coming from somewhere else.
// Could be a net problem at the source for instance. In this case there's
// no point in us skipping frames here.
- if(m_itrAvgDecode * 4 > itrFrame)
- {
+ if (m_itrAvgDecode*4>itrFrame) {
// Don't skip unless we are at least a whole frame late.
// (We would skip B frames if more than 1/2 frame late, but they're safe).
- if(m_itrLate > itrFrame)
- {
+ if ( m_itrLate > itrFrame ) {
// Don't skip unless the anticipated key frame would be no more than
// 1 frame early. If the renderer has not been waiting (we *guess*
@@ -396,14 +370,13 @@ BOOL CVideoTransformFilter::ShouldSkipFrame(IMediaSample * pIn)
// We don't dare skip until we have seen some key frames and have
// some idea how often they occur and they are reasonably frequent.
- if(m_nKeyFramePeriod > 0)
- {
+ if (m_nKeyFramePeriod>0) {
// It would be crazy - but we could have a stream with key frames
// a very long way apart - and if they are further than about
// 3.5 minutes apart then we could get arithmetic overflow in
// reference time units. Therefore we switch to mSec at this point
- int it = (itrFrame / 10000)
- * (m_nKeyFramePeriod - m_nFramesSinceKeyFrame - 1);
+ int it = (itrFrame/10000)
+ * (m_nKeyFramePeriod-m_nFramesSinceKeyFrame - 1);
MSR_INTEGER(m_idTimeTillKey, it);
// For debug - might want to see the details - dump them as scratch pad
@@ -412,37 +385,28 @@ BOOL CVideoTransformFilter::ShouldSkipFrame(IMediaSample * pIn)
MSR_INTEGER(0, m_nFramesSinceKeyFrame);
MSR_INTEGER(0, m_nKeyFramePeriod);
#endif
- if(m_itrLate / 10000 > it)
- {
+ if (m_itrLate/10000 > it) {
m_bSkipping = TRUE;
// Now we are committed. Once we start skipping, we
// cannot stop until we hit a key frame.
- }
- else
- {
+ } else {
#ifdef VTRANSPERF
MSR_INTEGER(0, 777770); // not near enough to next key
#endif
}
- }
- else
- {
+ } else {
#ifdef VTRANSPERF
MSR_INTEGER(0, 777771); // Next key not predictable
#endif
}
- }
- else
- {
+ } else {
#ifdef VTRANSPERF
MSR_INTEGER(0, 777772); // Less than one frame late
MSR_INTEGER(0, m_itrLate);
MSR_INTEGER(0, itrFrame);
#endif
}
- }
- else
- {
+ } else {
#ifdef VTRANSPERF
MSR_INTEGER(0, 777773); // Decode time short - not not worth skipping
MSR_INTEGER(0, m_itrAvgDecode);
@@ -452,8 +416,7 @@ BOOL CVideoTransformFilter::ShouldSkipFrame(IMediaSample * pIn)
++m_nFramesSinceKeyFrame;
- if(m_bSkipping)
- {
+ if (m_bSkipping) {
// We will count down the lateness as we skip each frame.
// We re-assess each frame. The key frame might not arrive when expected.
// We reset m_itrLate if we get a new Quality message, but actually that's
@@ -464,13 +427,11 @@ BOOL CVideoTransformFilter::ShouldSkipFrame(IMediaSample * pIn)
m_itrLate = m_itrLate - itrFrame;
}
- MSR_INTEGER(m_idLate, (int)m_itrLate / 10000); // Note how late we think we are
- if(m_bSkipping)
- {
- if(!m_bQualityChanged)
- {
+ MSR_INTEGER(m_idLate, (int)m_itrLate/10000 ); // Note how late we think we are
+ if (m_bSkipping) {
+ if (!m_bQualityChanged) {
m_bQualityChanged = TRUE;
- NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
+ NotifyEvent(EC_QUALITY_CHANGE,0,0);
}
}
return m_bSkipping;
@@ -481,13 +442,10 @@ HRESULT CVideoTransformFilter::AlterQuality(Quality q)
{
// to reduce the amount of 64 bit arithmetic, m_itrLate is an int.
// +, -, >, == etc are not too bad, but * and / are painful.
- if(m_itrLate > 300000000)
- {
+ if (m_itrLate>300000000) {
// Avoid overflow and silliness - more than 30 secs late is already silly
m_itrLate = 300000000;
- }
- else
- {
+ } else {
m_itrLate = (int)q.Late;
}
// We ignore the other fields
diff --git a/src/filters/BaseClasses/vtrans.h b/src/filters/BaseClasses/vtrans.h
index d8cf55bdf..49b1509b1 100644
--- a/src/filters/BaseClasses/vtrans.h
+++ b/src/filters/BaseClasses/vtrans.h
@@ -13,7 +13,7 @@
class CVideoTransformFilter : public CTransformFilter
{
-public:
+ public:
CVideoTransformFilter(__in_opt LPCTSTR, __inout_opt LPUNKNOWN, REFCLSID clsid);
~CVideoTransformFilter();
@@ -53,8 +53,7 @@ public:
// If you override this - ensure that you register all these ids
// as well as any of your own,
- virtual void RegisterPerfId()
- {
+ virtual void RegisterPerfId() {
m_idSkip = MSR_REGISTER(TEXT("Video Transform Skip frame"));
m_idFrameType = MSR_REGISTER(TEXT("Video transform frame type"));
m_idLate = MSR_REGISTER(TEXT("Video Transform Lateness"));
@@ -63,7 +62,7 @@ public:
}
#endif
-protected:
+ protected:
// =========== QUALITY MANAGEMENT IMPLEMENTATION ========================
// Frames are assumed to come in three types:
@@ -102,10 +101,10 @@ protected:
// the quality management here if you have B-frames.
int m_nKeyFramePeriod; // the largest observed interval between type 1 frames
- // 1 means every frame is type 1, 2 means every other.
+ // 1 means every frame is type 1, 2 means every other.
int m_nFramesSinceKeyFrame; // Used to count frames since the last type 1.
- // becomes the new m_nKeyFramePeriod if greater.
+ // becomes the new m_nKeyFramePeriod if greater.
BOOL m_bSkipping; // we are skipping to the next type 1 frame
@@ -127,7 +126,7 @@ protected:
BOOL ShouldSkipFrame(IMediaSample * pIn);
int m_itrLate; // lateness from last Quality message
- // (this overflows at 214 secs late).
+ // (this overflows at 214 secs late).
int m_tDecodeStart; // timeGetTime when decode started.
int m_itrAvgDecode; // Average decode time in reference units.
diff --git a/src/filters/BaseClasses/winctrl.cpp b/src/filters/BaseClasses/winctrl.cpp
index 1c6b3669d..9b2c0df6d 100644
--- a/src/filters/BaseClasses/winctrl.cpp
+++ b/src/filters/BaseClasses/winctrl.cpp
@@ -30,46 +30,46 @@
BOOL WINAPI PossiblyEatMessage(HWND hwndDrain, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if(hwndDrain != NULL && !InSendMessage())
+ if (hwndDrain != NULL && !InSendMessage())
{
- switch(uMsg)
+ switch (uMsg)
{
- case WM_CHAR:
- case WM_DEADCHAR:
- case WM_KEYDOWN:
- case WM_KEYUP:
- case WM_LBUTTONDBLCLK:
- case WM_LBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_MBUTTONDBLCLK:
- case WM_MBUTTONDOWN:
- case WM_MBUTTONUP:
- case WM_MOUSEACTIVATE:
- case WM_MOUSEMOVE:
+ case WM_CHAR:
+ case WM_DEADCHAR:
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONUP:
+ case WM_MOUSEACTIVATE:
+ case WM_MOUSEMOVE:
// If we pass this on we don't get any mouse clicks
//case WM_NCHITTEST:
- case WM_NCLBUTTONDBLCLK:
- case WM_NCLBUTTONDOWN:
- case WM_NCLBUTTONUP:
- case WM_NCMBUTTONDBLCLK:
- case WM_NCMBUTTONDOWN:
- case WM_NCMBUTTONUP:
- case WM_NCMOUSEMOVE:
- case WM_NCRBUTTONDBLCLK:
- case WM_NCRBUTTONDOWN:
- case WM_NCRBUTTONUP:
- case WM_RBUTTONDBLCLK:
- case WM_RBUTTONDOWN:
- case WM_RBUTTONUP:
- case WM_SYSCHAR:
- case WM_SYSDEADCHAR:
- case WM_SYSKEYDOWN:
- case WM_SYSKEYUP:
-
- DbgLog((LOG_TRACE, 2, TEXT("Forwarding %x to drain")));
- PostMessage(hwndDrain, uMsg, wParam, lParam);
-
- return TRUE;
+ case WM_NCLBUTTONDBLCLK:
+ case WM_NCLBUTTONDOWN:
+ case WM_NCLBUTTONUP:
+ case WM_NCMBUTTONDBLCLK:
+ case WM_NCMBUTTONDOWN:
+ case WM_NCMBUTTONUP:
+ case WM_NCMOUSEMOVE:
+ case WM_NCRBUTTONDBLCLK:
+ case WM_NCRBUTTONDOWN:
+ case WM_NCRBUTTONUP:
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONUP:
+ case WM_SYSCHAR:
+ case WM_SYSDEADCHAR:
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+
+ DbgLog((LOG_TRACE, 2, TEXT("Forwarding %x to drain")));
+ PostMessage(hwndDrain, uMsg, wParam, lParam);
+
+ return TRUE;
}
}
return FALSE;
@@ -84,13 +84,13 @@ BOOL WINAPI PossiblyEatMessage(HWND hwndDrain, UINT uMsg, WPARAM wParam, LPARAM
// more direct and efficient mechanism as many values may be changed in one
CBaseControlWindow::CBaseControlWindow(
- __inout CBaseFilter *pFilter, // Owning filter
- __in CCritSec *pInterfaceLock, // Locking object
- __in_opt LPCTSTR pName, // Object description
- __inout_opt LPUNKNOWN pUnk, // Normal COM ownership
- __inout HRESULT *phr) : // OLE return code
+ __inout CBaseFilter *pFilter, // Owning filter
+ __in CCritSec *pInterfaceLock, // Locking object
+ __in_opt LPCTSTR pName, // Object description
+ __inout_opt LPUNKNOWN pUnk, // Normal COM ownership
+ __inout HRESULT *phr) : // OLE return code
- CBaseVideoWindow(pName, pUnk),
+ CBaseVideoWindow(pName,pUnk),
m_pInterfaceLock(pInterfaceLock),
m_hwndOwner(NULL),
m_hwndDrain(NULL),
@@ -113,14 +113,14 @@ CBaseControlWindow::CBaseControlWindow(
STDMETHODIMP CBaseControlWindow::put_Caption(__in BSTR strCaption)
{
- CheckPointer((PVOID)strCaption, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer((PVOID)strCaption,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
#ifdef UNICODE
SetWindowText(m_hwnd, strCaption);
#else
CHAR Caption[CAPTION];
- WideCharToMultiByte(CP_ACP, 0, strCaption, -1, Caption, CAPTION, NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0,strCaption,-1,Caption,CAPTION,NULL,NULL);
SetWindowText(m_hwnd, Caption);
#endif
return NOERROR;
@@ -135,20 +135,20 @@ STDMETHODIMP CBaseControlWindow::put_Caption(__in BSTR strCaption)
STDMETHODIMP CBaseControlWindow::get_Caption(__out BSTR *pstrCaption)
{
- CheckPointer(pstrCaption, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pstrCaption,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
WCHAR WideCaption[CAPTION];
#ifdef UNICODE
- GetWindowText(m_hwnd, WideCaption, CAPTION);
+ GetWindowText(m_hwnd,WideCaption,CAPTION);
#else
// Convert the ASCII caption to a UNICODE string
TCHAR Caption[CAPTION];
- GetWindowText(m_hwnd, Caption, CAPTION);
- MultiByteToWideChar(CP_ACP, 0, Caption, -1, WideCaption, CAPTION);
+ GetWindowText(m_hwnd,Caption,CAPTION);
+ MultiByteToWideChar(CP_ACP,0,Caption,-1,WideCaption,CAPTION);
#endif
- return WriteBSTR(pstrCaption, WideCaption);
+ return WriteBSTR(pstrCaption,WideCaption);
}
@@ -156,27 +156,24 @@ STDMETHODIMP CBaseControlWindow::get_Caption(__out BSTR *pstrCaption)
STDMETHODIMP CBaseControlWindow::put_WindowStyleEx(long WindowStyleEx)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Should we be taking off WS_EX_TOPMOST
- if(GetWindowLong(m_hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
- {
- if((WindowStyleEx & WS_EX_TOPMOST) == 0)
- {
- SendMessage(m_hwnd, m_ShowStageTop, (WPARAM) FALSE, (LPARAM) 0);
+ if (GetWindowLong(m_hwnd,GWL_EXSTYLE) & WS_EX_TOPMOST) {
+ if ((WindowStyleEx & WS_EX_TOPMOST) == 0) {
+ SendMessage(m_hwnd,m_ShowStageTop,(WPARAM) FALSE,(LPARAM) 0);
}
}
// Likewise should we be adding WS_EX_TOPMOST
- if(WindowStyleEx & WS_EX_TOPMOST)
- {
- SendMessage(m_hwnd, m_ShowStageTop, (WPARAM) TRUE, (LPARAM) 0);
+ if (WindowStyleEx & WS_EX_TOPMOST) {
+ SendMessage(m_hwnd,m_ShowStageTop,(WPARAM) TRUE,(LPARAM) 0);
WindowStyleEx &= (~WS_EX_TOPMOST);
- if(WindowStyleEx == 0) return NOERROR;
+ if (WindowStyleEx == 0) return NOERROR;
}
- return DoSetWindowStyle(WindowStyleEx, GWL_EXSTYLE);
+ return DoSetWindowStyle(WindowStyleEx,GWL_EXSTYLE);
}
@@ -184,9 +181,9 @@ STDMETHODIMP CBaseControlWindow::put_WindowStyleEx(long WindowStyleEx)
STDMETHODIMP CBaseControlWindow::get_WindowStyleEx(__out long *pWindowStyleEx)
{
- CheckPointer(pWindowStyleEx, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
- return DoGetWindowStyle(pWindowStyleEx, GWL_EXSTYLE);
+ CheckPointer(pWindowStyleEx,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
+ return DoGetWindowStyle(pWindowStyleEx,GWL_EXSTYLE);
}
@@ -196,19 +193,18 @@ STDMETHODIMP CBaseControlWindow::put_WindowStyle(long WindowStyle)
{
// These styles cannot be changed dynamically
- if((WindowStyle & WS_DISABLED) ||
- (WindowStyle & WS_ICONIC) ||
- (WindowStyle & WS_MAXIMIZE) ||
- (WindowStyle & WS_MINIMIZE) ||
- (WindowStyle & WS_HSCROLL) ||
- (WindowStyle & WS_VSCROLL))
- {
+ if ((WindowStyle & WS_DISABLED) ||
+ (WindowStyle & WS_ICONIC) ||
+ (WindowStyle & WS_MAXIMIZE) ||
+ (WindowStyle & WS_MINIMIZE) ||
+ (WindowStyle & WS_HSCROLL) ||
+ (WindowStyle & WS_VSCROLL)) {
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
- return DoSetWindowStyle(WindowStyle, GWL_STYLE);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
+ return DoSetWindowStyle(WindowStyle,GWL_STYLE);
}
@@ -216,9 +212,9 @@ STDMETHODIMP CBaseControlWindow::put_WindowStyle(long WindowStyle)
STDMETHODIMP CBaseControlWindow::get_WindowStyle(__out long *pWindowStyle)
{
- CheckPointer(pWindowStyle, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
- return DoGetWindowStyle(pWindowStyle, GWL_STYLE);
+ CheckPointer(pWindowStyle,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
+ return DoGetWindowStyle(pWindowStyle,GWL_STYLE);
}
@@ -229,27 +225,26 @@ STDMETHODIMP CBaseControlWindow::get_WindowStyle(__out long *pWindowStyle)
// In most cases the client will call get_WindowStyle before they call this
// and then AND and OR in extra bit settings according to the requirements
-HRESULT CBaseControlWindow::DoSetWindowStyle(long Style, long WindowLong)
+HRESULT CBaseControlWindow::DoSetWindowStyle(long Style,long WindowLong)
{
RECT WindowRect;
// Get the window's visibility before setting the style
BOOL bVisible = IsWindowVisible(m_hwnd);
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
// Set the new style flags for the window
- SetWindowLong(m_hwnd, WindowLong, Style);
+ SetWindowLong(m_hwnd,WindowLong,Style);
UINT WindowFlags = SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_NOACTIVATE;
WindowFlags |= SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE;
// Show the window again in the current position
- if(bVisible == TRUE)
- {
+ if (bVisible == TRUE) {
SetWindowPos(m_hwnd, // Base window handle
HWND_TOP, // Just a place holder
- 0, 0, 0, 0, // Leave size and position
+ 0,0,0,0, // Leave size and position
WindowFlags); // Just draw it again
return NOERROR;
@@ -268,13 +263,12 @@ HRESULT CBaseControlWindow::DoSetWindowStyle(long Style, long WindowLong)
SetWindowPos(m_hwnd, // Base window handle
HWND_TOP, // Just a place holder
- 0, 0, 0, 0, // Leave size and position
+ 0,0,0,0, // Leave size and position
WindowFlags); // Just draw it again
- ShowWindow(m_hwnd, SW_HIDE);
+ ShowWindow(m_hwnd,SW_HIDE);
- if(GetParent(m_hwnd))
- {
+ if (GetParent(m_hwnd)) {
MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2);
}
@@ -292,9 +286,9 @@ HRESULT CBaseControlWindow::DoSetWindowStyle(long Style, long WindowLong)
// Get the current base window style (either GWL_STYLE or GWL_EXSTYLE)
-HRESULT CBaseControlWindow::DoGetWindowStyle(__out long *pStyle, long WindowLong)
+HRESULT CBaseControlWindow::DoGetWindowStyle(__out long *pStyle,long WindowLong)
{
- *pStyle = GetWindowLong(m_hwnd, WindowLong);
+ *pStyle = GetWindowLong(m_hwnd,WindowLong);
return NOERROR;
}
@@ -306,7 +300,7 @@ HRESULT CBaseControlWindow::DoGetWindowStyle(__out long *pStyle, long WindowLong
STDMETHODIMP CBaseControlWindow::put_WindowState(long WindowState)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
DoShowWindow(WindowState);
return NOERROR;
}
@@ -320,8 +314,8 @@ STDMETHODIMP CBaseControlWindow::put_WindowState(long WindowState)
STDMETHODIMP CBaseControlWindow::get_WindowState(__out long *pWindowState)
{
- CheckPointer(pWindowState, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pWindowState,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
ASSERT(pWindowState);
*pWindowState = FALSE;
@@ -329,30 +323,24 @@ STDMETHODIMP CBaseControlWindow::get_WindowState(__out long *pWindowState)
// the current desktop even if it is completely obscured by other windows
// so the flag is a style for each window set with the WS_VISIBLE bit
- if(IsWindowVisible(m_hwnd) == TRUE)
- {
+ if (IsWindowVisible(m_hwnd) == TRUE) {
// Is the base window iconic
- if(IsIconic(m_hwnd) == TRUE)
- {
+ if (IsIconic(m_hwnd) == TRUE) {
*pWindowState |= SW_MINIMIZE;
}
// Has the window been maximised
- else if(IsZoomed(m_hwnd) == TRUE)
- {
+ else if (IsZoomed(m_hwnd) == TRUE) {
*pWindowState |= SW_MAXIMIZE;
}
// Window is normal
- else
- {
+ else {
*pWindowState |= SW_SHOW;
}
- }
- else
- {
+ } else {
*pWindowState |= SW_HIDE;
}
return NOERROR;
@@ -367,15 +355,13 @@ STDMETHODIMP CBaseControlWindow::get_WindowState(__out long *pWindowState)
STDMETHODIMP CBaseControlWindow::put_BackgroundPalette(long BackgroundPalette)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cWindowLock(&m_WindowLock);
// Check this is a valid automation boolean type
- if(BackgroundPalette != OATRUE)
- {
- if(BackgroundPalette != OAFALSE)
- {
+ if (BackgroundPalette != OATRUE) {
+ if (BackgroundPalette != OAFALSE) {
return E_INVALIDARG;
}
}
@@ -383,7 +369,7 @@ STDMETHODIMP CBaseControlWindow::put_BackgroundPalette(long BackgroundPalette)
// Make sure the window realises any palette it has again
m_bBackground = (BackgroundPalette == OATRUE ? TRUE : FALSE);
- PostMessage(m_hwnd, m_RealizePalette, 0, 0);
+ PostMessage(m_hwnd,m_RealizePalette,0,0);
PaintWindow(FALSE);
return NOERROR;
@@ -395,8 +381,8 @@ STDMETHODIMP CBaseControlWindow::put_BackgroundPalette(long BackgroundPalette)
STDMETHODIMP
CBaseControlWindow::get_BackgroundPalette(__out long *pBackgroundPalette)
{
- CheckPointer(pBackgroundPalette, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pBackgroundPalette,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cWindowLock(&m_WindowLock);
// Get the current background palette setting
@@ -410,14 +396,12 @@ CBaseControlWindow::get_BackgroundPalette(__out long *pBackgroundPalette)
STDMETHODIMP CBaseControlWindow::put_Visible(long Visible)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Check this is a valid automation boolean type
- if(Visible != OATRUE)
- {
- if(Visible != OAFALSE)
- {
+ if (Visible != OATRUE) {
+ if (Visible != OAFALSE) {
return E_INVALIDARG;
}
}
@@ -434,8 +418,8 @@ STDMETHODIMP CBaseControlWindow::put_Visible(long Visible)
STDMETHODIMP CBaseControlWindow::get_Visible(__out long *pVisible)
{
- CheckPointer(pVisible, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pVisible,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// See if the base window has a WS_VISIBLE style - this will return TRUE
// even if the window is completely obscured by other desktop windows, we
@@ -453,15 +437,14 @@ STDMETHODIMP CBaseControlWindow::get_Visible(__out long *pVisible)
STDMETHODIMP CBaseControlWindow::put_Left(long Left)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
BOOL bSuccess;
RECT WindowRect;
// Get the current window position in a RECT
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
- if(GetParent(m_hwnd))
- {
+ if (GetParent(m_hwnd)) {
MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2);
}
@@ -482,8 +465,7 @@ STDMETHODIMP CBaseControlWindow::put_Left(long Left)
WindowRect.bottom, // The HEIGHT (not bottom)
WindowFlags); // Show window options
- if(bSuccess == FALSE)
- {
+ if (bSuccess == FALSE) {
return E_INVALIDARG;
}
return NOERROR;
@@ -494,11 +476,11 @@ STDMETHODIMP CBaseControlWindow::put_Left(long Left)
STDMETHODIMP CBaseControlWindow::get_Left(__out long *pLeft)
{
- CheckPointer(pLeft, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pLeft,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT WindowRect;
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
*pLeft = WindowRect.left;
return NOERROR;
}
@@ -511,7 +493,7 @@ STDMETHODIMP CBaseControlWindow::get_Left(__out long *pLeft)
STDMETHODIMP CBaseControlWindow::put_Width(long Width)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
BOOL bSuccess;
RECT WindowRect;
@@ -519,10 +501,9 @@ STDMETHODIMP CBaseControlWindow::put_Width(long Width)
// get back from GetWindowRect is in left,top,right and bottom while the
// coordinates SetWindowPos wants are left,top,width and height values
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
- if(GetParent(m_hwnd))
- {
+ if (GetParent(m_hwnd)) {
MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2);
}
@@ -542,8 +523,7 @@ STDMETHODIMP CBaseControlWindow::put_Width(long Width)
WindowRect.bottom, // The HEIGHT (not bottom)
WindowFlags); // Show window options
- if(bSuccess == FALSE)
- {
+ if (bSuccess == FALSE) {
return E_INVALIDARG;
}
return NOERROR;
@@ -554,11 +534,11 @@ STDMETHODIMP CBaseControlWindow::put_Width(long Width)
STDMETHODIMP CBaseControlWindow::get_Width(__out long *pWidth)
{
- CheckPointer(pWidth, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pWidth,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT WindowRect;
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
*pWidth = WindowRect.right - WindowRect.left;
return NOERROR;
}
@@ -570,15 +550,14 @@ STDMETHODIMP CBaseControlWindow::get_Width(__out long *pWidth)
STDMETHODIMP CBaseControlWindow::put_Top(long Top)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
BOOL bSuccess;
RECT WindowRect;
// Get the current window position in a RECT
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
- if(GetParent(m_hwnd))
- {
+ if (GetParent(m_hwnd)) {
MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2);
}
@@ -599,8 +578,7 @@ STDMETHODIMP CBaseControlWindow::put_Top(long Top)
WindowRect.bottom, // The HEIGHT (not bottom)
WindowFlags); // Show window flags
- if(bSuccess == FALSE)
- {
+ if (bSuccess == FALSE) {
return E_INVALIDARG;
}
return NOERROR;
@@ -611,11 +589,11 @@ STDMETHODIMP CBaseControlWindow::put_Top(long Top)
STDMETHODIMP CBaseControlWindow::get_Top(long *pTop)
{
- CheckPointer(pTop, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pTop,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT WindowRect;
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
*pTop = WindowRect.top;
return NOERROR;
}
@@ -628,7 +606,7 @@ STDMETHODIMP CBaseControlWindow::get_Top(long *pTop)
STDMETHODIMP CBaseControlWindow::put_Height(long Height)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
BOOL bSuccess;
RECT WindowRect;
@@ -636,10 +614,9 @@ STDMETHODIMP CBaseControlWindow::put_Height(long Height)
// get back from GetWindowRect is in left,top,right and bottom while the
// coordinates SetWindowPos wants are left,top,width and height values
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
- if(GetParent(m_hwnd))
- {
+ if (GetParent(m_hwnd)) {
MapWindowPoints(HWND_DESKTOP, GetParent(m_hwnd), (LPPOINT)&WindowRect, 2);
}
@@ -655,8 +632,7 @@ STDMETHODIMP CBaseControlWindow::put_Height(long Height)
Height, // New height dimension
WindowFlags); // Show window flags
- if(bSuccess == FALSE)
- {
+ if (bSuccess == FALSE) {
return E_INVALIDARG;
}
return NOERROR;
@@ -667,11 +643,11 @@ STDMETHODIMP CBaseControlWindow::put_Height(long Height)
STDMETHODIMP CBaseControlWindow::get_Height(__out long *pHeight)
{
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT WindowRect;
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
*pHeight = WindowRect.bottom - WindowRect.top;
return NOERROR;
}
@@ -692,29 +668,26 @@ STDMETHODIMP CBaseControlWindow::put_Owner(OAHWND Owner)
{
// Check we are connected otherwise reject the call
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
m_hwndOwner = (HWND) Owner;
HWND hwndParent = m_hwndOwner;
// Add or remove WS_CHILD as appropriate
- LONG Style = GetWindowLong(m_hwnd, GWL_STYLE);
- if(Owner == NULL)
- {
+ LONG Style = GetWindowLong(m_hwnd,GWL_STYLE);
+ if (Owner == NULL) {
Style &= (~WS_CHILD);
- }
- else
- {
+ } else {
Style |= (WS_CHILD);
}
- SetWindowLong(m_hwnd, GWL_STYLE, Style);
+ SetWindowLong(m_hwnd,GWL_STYLE,Style);
// Don't call this with the filter locked
- SetParent(m_hwnd, hwndParent);
+ SetParent(m_hwnd,hwndParent);
PaintWindow(TRUE);
- NOTE1("Changed parent %lx", hwndParent);
+ NOTE1("Changed parent %lx",hwndParent);
return NOERROR;
}
@@ -728,8 +701,8 @@ STDMETHODIMP CBaseControlWindow::put_Owner(OAHWND Owner)
STDMETHODIMP CBaseControlWindow::get_Owner(__out OAHWND *Owner)
{
- CheckPointer(Owner, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(Owner,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
*Owner = (OAHWND) m_hwndOwner;
return NOERROR;
}
@@ -744,7 +717,7 @@ STDMETHODIMP CBaseControlWindow::put_MessageDrain(OAHWND Drain)
{
// Check we are connected otherwise reject the call
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
m_hwndDrain = (HWND) Drain;
return NOERROR;
}
@@ -754,8 +727,8 @@ STDMETHODIMP CBaseControlWindow::put_MessageDrain(OAHWND Drain)
STDMETHODIMP CBaseControlWindow::get_MessageDrain(__out OAHWND *Drain)
{
- CheckPointer(Drain, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(Drain,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
*Drain = (OAHWND) m_hwndDrain;
return NOERROR;
}
@@ -774,37 +747,35 @@ CBaseControlWindow::NotifyOwnerMessage(OAHWND hwnd, // Window handle
LONG_PTR wParam, // Parameters
LONG_PTR lParam) // for message
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Only interested in these Windows messages
- switch(uMsg)
- {
+ switch (uMsg) {
- case WM_SYSCOLORCHANGE:
- case WM_PALETTECHANGED:
- case WM_PALETTEISCHANGING:
- case WM_QUERYNEWPALETTE:
- case WM_DEVMODECHANGE:
- case WM_DISPLAYCHANGE:
- case WM_ACTIVATEAPP:
+ case WM_SYSCOLORCHANGE:
+ case WM_PALETTECHANGED:
+ case WM_PALETTEISCHANGING:
+ case WM_QUERYNEWPALETTE:
+ case WM_DEVMODECHANGE:
+ case WM_DISPLAYCHANGE:
+ case WM_ACTIVATEAPP:
- // If we do not have an owner then ignore
+ // If we do not have an owner then ignore
- if(m_hwndOwner == NULL)
- {
- return NOERROR;
- }
- SendMessage(m_hwnd, uMsg, (WPARAM)wParam, (LPARAM)lParam);
- break;
+ if (m_hwndOwner == NULL) {
+ return NOERROR;
+ }
+ SendMessage(m_hwnd,uMsg,(WPARAM)wParam,(LPARAM)lParam);
+ break;
- // do NOT fwd WM_MOVE. the parameters are the location of the parent
- // window, NOT what the renderer should be looking at. But we need
- // to make sure the overlay is moved with the parent window, so we
- // do this.
- case WM_MOVE:
- PostMessage(m_hwnd, WM_PAINT, 0, 0);
- break;
+ // do NOT fwd WM_MOVE. the parameters are the location of the parent
+ // window, NOT what the renderer should be looking at. But we need
+ // to make sure the overlay is moved with the parent window, so we
+ // do this.
+ case WM_MOVE:
+ PostMessage(m_hwnd,WM_PAINT,0,0);
+ break;
}
return NOERROR;
}
@@ -818,17 +789,15 @@ STDMETHODIMP CBaseControlWindow::SetWindowForeground(long Focus)
{
// Check this is a valid automation boolean type
- if(Focus != OATRUE)
- {
- if(Focus != OAFALSE)
- {
+ if (Focus != OATRUE) {
+ if (Focus != OAFALSE) {
return E_INVALIDARG;
}
}
// We shouldn't lock as this sends a message
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
BOOL bFocus = (Focus == OATRUE ? TRUE : FALSE);
DoSetWindowForeground(bFocus);
@@ -842,9 +811,9 @@ STDMETHODIMP CBaseControlWindow::SetWindowForeground(long Focus)
// occur as each of them gets updated (they are better set at design time)
STDMETHODIMP
-CBaseControlWindow::SetWindowPosition(long Left, long Top, long Width, long Height)
+CBaseControlWindow::SetWindowPosition(long Left,long Top,long Width,long Height)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
BOOL bSuccess;
// Set the new size and position
@@ -862,8 +831,7 @@ CBaseControlWindow::SetWindowPosition(long Left, long Top, long Width, long Heig
#ifdef _DEBUG
DbgLog((LOG_TRACE, 1, TEXT("SWP failed error %d"), GetLastError()));
#endif
- if(bSuccess == FALSE)
- {
+ if (bSuccess == FALSE) {
return E_INVALIDARG;
}
return NOERROR;
@@ -876,20 +844,20 @@ CBaseControlWindow::SetWindowPosition(long Left, long Top, long Width, long Heig
// therefore more suitable to a live environment rather than design time
STDMETHODIMP
-CBaseControlWindow::GetWindowPosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight)
+CBaseControlWindow::GetWindowPosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight)
{
// Should check the pointers are not NULL
- CheckPointer(pLeft, E_POINTER);
- CheckPointer(pTop, E_POINTER);
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pLeft,E_POINTER);
+ CheckPointer(pTop,E_POINTER);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT WindowRect;
// Get the current window coordinates
- EXECUTE_ASSERT(GetWindowRect(m_hwnd, &WindowRect));
+ EXECUTE_ASSERT(GetWindowRect(m_hwnd,&WindowRect));
// Convert the RECT into left,top,width and height values
@@ -909,30 +877,28 @@ CBaseControlWindow::GetWindowPosition(__out long *pLeft, __out long *pTop, __out
// maximised) then this returns the same coordinates as GetWindowPosition
STDMETHODIMP
-CBaseControlWindow::GetRestorePosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight)
+CBaseControlWindow::GetRestorePosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight)
{
// Should check the pointers are not NULL
- CheckPointer(pLeft, E_POINTER);
- CheckPointer(pTop, E_POINTER);
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pLeft,E_POINTER);
+ CheckPointer(pTop,E_POINTER);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Use GetWindowPlacement to find the restore position
WINDOWPLACEMENT Place;
Place.length = sizeof(WINDOWPLACEMENT);
- EXECUTE_ASSERT(GetWindowPlacement(m_hwnd, &Place));
+ EXECUTE_ASSERT(GetWindowPlacement(m_hwnd,&Place));
RECT WorkArea;
// We must take into account any task bar present
- if(SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, FALSE) == TRUE)
- {
- if(GetParent(m_hwnd) == NULL)
- {
+ if (SystemParametersInfo(SPI_GETWORKAREA,0,&WorkArea,FALSE) == TRUE) {
+ if (GetParent(m_hwnd) == NULL) {
Place.rcNormalPosition.top += WorkArea.top;
Place.rcNormalPosition.bottom += WorkArea.top;
Place.rcNormalPosition.left += WorkArea.left;
@@ -958,8 +924,8 @@ CBaseControlWindow::GetRestorePosition(__out long *pLeft, __out long *pTop, __ou
STDMETHODIMP CBaseControlWindow::get_BorderColor(__out long *Color)
{
- CheckPointer(Color, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(Color,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
*Color = (long) m_BorderColour;
return NOERROR;
}
@@ -969,7 +935,7 @@ STDMETHODIMP CBaseControlWindow::get_BorderColor(__out long *Color)
STDMETHODIMP CBaseControlWindow::put_BorderColor(long Color)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Have the window repainted with the new border colour
@@ -983,8 +949,8 @@ STDMETHODIMP CBaseControlWindow::put_BorderColor(long Color)
STDMETHODIMP CBaseControlWindow::get_FullScreenMode(__out long *FullScreenMode)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
- CheckPointer(FullScreenMode, E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
+ CheckPointer(FullScreenMode,E_POINTER);
return E_NOTIMPL;
}
@@ -1004,14 +970,12 @@ STDMETHODIMP CBaseControlWindow::put_FullScreenMode(long FullScreenMode)
STDMETHODIMP CBaseControlWindow::put_AutoShow(long AutoShow)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Check this is a valid automation boolean type
- if(AutoShow != OATRUE)
- {
- if(AutoShow != OAFALSE)
- {
+ if (AutoShow != OATRUE) {
+ if (AutoShow != OAFALSE) {
return E_INVALIDARG;
}
}
@@ -1027,8 +991,8 @@ STDMETHODIMP CBaseControlWindow::put_AutoShow(long AutoShow)
STDMETHODIMP CBaseControlWindow::get_AutoShow(__out long *AutoShow)
{
- CheckPointer(AutoShow, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(AutoShow,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
*AutoShow = (m_bAutoShow == TRUE ? OATRUE : OAFALSE);
return NOERROR;
}
@@ -1040,18 +1004,17 @@ STDMETHODIMP CBaseControlWindow::get_AutoShow(__out long *AutoShow)
// cards have a minimum stretch factor depending on the overlay surface size
STDMETHODIMP
-CBaseControlWindow::GetMinIdealImageSize(__out long *pWidth, __out long *pHeight)
+CBaseControlWindow::GetMinIdealImageSize(__out long *pWidth,__out long *pHeight)
{
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
FILTER_STATE State;
// Must not be stopped for this to work correctly
- m_pFilter->GetState(0, &State);
- if(State == State_Stopped)
- {
+ m_pFilter->GetState(0,&State);
+ if (State == State_Stopped) {
return VFW_E_WRONG_STATE;
}
@@ -1068,18 +1031,17 @@ CBaseControlWindow::GetMinIdealImageSize(__out long *pWidth, __out long *pHeight
// cards have a maximum stretch factor depending on the overlay surface size
STDMETHODIMP
-CBaseControlWindow::GetMaxIdealImageSize(__out long *pWidth, __out long *pHeight)
+CBaseControlWindow::GetMaxIdealImageSize(__out long *pWidth,__out long *pHeight)
{
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
FILTER_STATE State;
// Must not be stopped for this to work correctly
- m_pFilter->GetState(0, &State);
- if(State == State_Stopped)
- {
+ m_pFilter->GetState(0,&State);
+ if (State == State_Stopped) {
return VFW_E_WRONG_STATE;
}
@@ -1095,14 +1057,12 @@ CBaseControlWindow::GetMaxIdealImageSize(__out long *pWidth, __out long *pHeight
STDMETHODIMP
CBaseControlWindow::HideCursor(long HideCursor)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
// Check this is a valid automation boolean type
- if(HideCursor != OATRUE)
- {
- if(HideCursor != OAFALSE)
- {
+ if (HideCursor != OATRUE) {
+ if (HideCursor != OAFALSE) {
return E_INVALIDARG;
}
}
@@ -1116,8 +1076,8 @@ CBaseControlWindow::HideCursor(long HideCursor)
STDMETHODIMP CBaseControlWindow::IsCursorHidden(__out long *CursorHidden)
{
- CheckPointer(CursorHidden, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(CursorHidden,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
*CursorHidden = (m_bCursorHidden == TRUE ? OATRUE : OAFALSE);
return NOERROR;
}
@@ -1131,13 +1091,13 @@ STDMETHODIMP CBaseControlWindow::IsCursorHidden(__out long *CursorHidden)
// more direct and efficient mechanism as many values may be changed in one
CBaseControlVideo::CBaseControlVideo(
- __inout CBaseFilter *pFilter, // Owning filter
- __in CCritSec *pInterfaceLock, // Locking object
- __in_opt LPCTSTR pName, // Object description
- __inout_opt LPUNKNOWN pUnk, // Normal COM ownership
- __inout HRESULT *phr) : // OLE return code
+ __inout CBaseFilter *pFilter, // Owning filter
+ __in CCritSec *pInterfaceLock, // Locking object
+ __in_opt LPCTSTR pName, // Object description
+ __inout_opt LPUNKNOWN pUnk, // Normal COM ownership
+ __inout HRESULT *phr) : // OLE return code
- CBaseBasicVideo(pName, pUnk),
+ CBaseBasicVideo(pName,pUnk),
m_pFilter(pFilter),
m_pInterfaceLock(pInterfaceLock),
m_pPin(NULL)
@@ -1151,13 +1111,13 @@ CBaseControlVideo::CBaseControlVideo(
STDMETHODIMP CBaseControlVideo::get_AvgTimePerFrame(__out REFTIME *pAvgTimePerFrame)
{
- CheckPointer(pAvgTimePerFrame, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pAvgTimePerFrame,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
COARefTime AvgTime(pVideoInfo->AvgTimePerFrame);
*pAvgTimePerFrame = (REFTIME) AvgTime;
@@ -1169,13 +1129,13 @@ STDMETHODIMP CBaseControlVideo::get_AvgTimePerFrame(__out REFTIME *pAvgTimePerFr
STDMETHODIMP CBaseControlVideo::get_BitRate(__out long *pBitRate)
{
- CheckPointer(pBitRate, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pBitRate,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
*pBitRate = pVideoInfo->dwBitRate;
return NOERROR;
}
@@ -1185,13 +1145,13 @@ STDMETHODIMP CBaseControlVideo::get_BitRate(__out long *pBitRate)
STDMETHODIMP CBaseControlVideo::get_BitErrorRate(__out long *pBitErrorRate)
{
- CheckPointer(pBitErrorRate, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pBitErrorRate,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
*pBitErrorRate = pVideoInfo->dwBitErrorRate;
return NOERROR;
}
@@ -1201,13 +1161,13 @@ STDMETHODIMP CBaseControlVideo::get_BitErrorRate(__out long *pBitErrorRate)
STDMETHODIMP CBaseControlVideo::get_VideoWidth(__out long *pVideoWidth)
{
- CheckPointer(pVideoWidth, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pVideoWidth,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
*pVideoWidth = pVideoInfo->bmiHeader.biWidth;
return NOERROR;
}
@@ -1217,13 +1177,13 @@ STDMETHODIMP CBaseControlVideo::get_VideoWidth(__out long *pVideoWidth)
STDMETHODIMP CBaseControlVideo::get_VideoHeight(__out long *pVideoHeight)
{
- CheckPointer(pVideoHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pVideoHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
*pVideoHeight = pVideoInfo->bmiHeader.biHeight;
return NOERROR;
}
@@ -1237,42 +1197,39 @@ STDMETHODIMP CBaseControlVideo::get_VideoHeight(__out long *pVideoHeight)
// If the number of entries evaluates to zero then we return an S_FALSE code
STDMETHODIMP CBaseControlVideo::GetVideoPaletteEntries(long StartIndex,
- long Entries,
- __out long *pRetrieved,
- __out_ecount_part(Entries, *pRetrieved) long *pPalette)
+ long Entries,
+ __out long *pRetrieved,
+ __out_ecount_part(Entries, *pRetrieved) long *pPalette)
{
- CheckPointer(pRetrieved, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pRetrieved,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
CMediaType MediaType;
// Get the video format from the derived class
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
BITMAPINFOHEADER *pHeader = HEADER(pVideoInfo);
// Is the current format palettised
- if(PALETTISED(pVideoInfo) == FALSE)
- {
+ if (PALETTISED(pVideoInfo) == FALSE) {
*pRetrieved = 0;
return VFW_E_NO_PALETTE_AVAILABLE;
}
// Do they just want to know how many are available
- if(pPalette == NULL)
- {
+ if (pPalette == NULL) {
*pRetrieved = pHeader->biClrUsed;
return NOERROR;
}
// Make sure the start position is a valid offset
- if(StartIndex >= (LONG) pHeader->biClrUsed || StartIndex < 0)
- {
+ if (StartIndex >= (LONG) pHeader->biClrUsed || StartIndex < 0) {
*pRetrieved = 0;
return E_INVALIDARG;
}
@@ -1280,9 +1237,8 @@ STDMETHODIMP CBaseControlVideo::GetVideoPaletteEntries(long StartIndex,
// Correct the number we can retrieve
LONG Available = (LONG) pHeader->biClrUsed - StartIndex;
- *pRetrieved = max(0, min(Available, Entries));
- if(*pRetrieved == 0)
- {
+ *pRetrieved = max(0,min(Available,Entries));
+ if (*pRetrieved == 0) {
return S_FALSE;
}
@@ -1291,8 +1247,7 @@ STDMETHODIMP CBaseControlVideo::GetVideoPaletteEntries(long StartIndex,
PALETTEENTRY *pEntries = (PALETTEENTRY *) pPalette;
RGBQUAD *pColours = COLORS(pVideoInfo) + StartIndex;
- for(LONG Count = 0; Count < *pRetrieved; Count++)
- {
+ for (LONG Count = 0;Count < *pRetrieved;Count++) {
pEntries[Count].peRed = pColours[Count].rgbRed;
pEntries[Count].peGreen = pColours[Count].rgbGreen;
pEntries[Count].peBlue = pColours[Count].rgbBlue;
@@ -1307,17 +1262,17 @@ STDMETHODIMP CBaseControlVideo::GetVideoPaletteEntries(long StartIndex,
// cannot access the renderer media type directly as the window object thread
// may be updating it since dynamic format changes may change these values
-STDMETHODIMP CBaseControlVideo::GetVideoSize(__out long *pWidth, __out long *pHeight)
+STDMETHODIMP CBaseControlVideo::GetVideoSize(__out long *pWidth,__out long *pHeight)
{
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
// Get the video format from the derived class
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
*pWidth = pVideoInfo->bmiHeader.biWidth;
*pHeight = pVideoInfo->bmiHeader.biHeight;
return NOERROR;
@@ -1329,9 +1284,9 @@ STDMETHODIMP CBaseControlVideo::GetVideoSize(__out long *pWidth, __out long *pHe
// Then pass the rectangle on to the window object to set the source
STDMETHODIMP
-CBaseControlVideo::SetSourcePosition(long Left, long Top, long Width, long Height)
+CBaseControlVideo::SetSourcePosition(long Left,long Top,long Width,long Height)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
SourceRect.left = Left;
@@ -1342,16 +1297,14 @@ CBaseControlVideo::SetSourcePosition(long Left, long Top, long Width, long Heigh
// Check the source rectangle is valid
HRESULT hr = CheckSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the source rectangle
hr = SetSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1363,15 +1316,15 @@ CBaseControlVideo::SetSourcePosition(long Left, long Top, long Width, long Heigh
// object returns through GetSourceRect) which requires a little work
STDMETHODIMP
-CBaseControlVideo::GetSourcePosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight)
+CBaseControlVideo::GetSourcePosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight)
{
// Should check the pointers are non NULL
- CheckPointer(pLeft, E_POINTER);
- CheckPointer(pTop, E_POINTER);
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pLeft,E_POINTER);
+ CheckPointer(pTop,E_POINTER);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT SourceRect;
CAutoLock cInterfaceLock(m_pInterfaceLock);
@@ -1391,9 +1344,9 @@ CBaseControlVideo::GetSourcePosition(__out long *pLeft, __out long *pTop, __out
// Then pass the rectangle on to the window object to set the destination
STDMETHODIMP
-CBaseControlVideo::SetDestinationPosition(long Left, long Top, long Width, long Height)
+CBaseControlVideo::SetDestinationPosition(long Left,long Top,long Width,long Height)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
@@ -1405,16 +1358,14 @@ CBaseControlVideo::SetDestinationPosition(long Left, long Top, long Width, long
// Check the target rectangle is valid
HRESULT hr = CheckTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the new target rectangle
hr = SetTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1426,15 +1377,15 @@ CBaseControlVideo::SetDestinationPosition(long Left, long Top, long Width, long
// object returns through GetDestinationRect) which requires a little work
STDMETHODIMP
-CBaseControlVideo::GetDestinationPosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight)
+CBaseControlVideo::GetDestinationPosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight)
{
// Should check the pointers are not NULL
- CheckPointer(pLeft, E_POINTER);
- CheckPointer(pTop, E_POINTER);
- CheckPointer(pWidth, E_POINTER);
- CheckPointer(pHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pLeft,E_POINTER);
+ CheckPointer(pTop,E_POINTER);
+ CheckPointer(pWidth,E_POINTER);
+ CheckPointer(pHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
RECT DestinationRect;
CAutoLock cInterfaceLock(m_pInterfaceLock);
@@ -1456,7 +1407,7 @@ CBaseControlVideo::GetDestinationPosition(__out long *pLeft, __out long *pTop, _
STDMETHODIMP CBaseControlVideo::put_SourceLeft(long SourceLeft)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
GetSourceRect(&SourceRect);
@@ -1466,16 +1417,14 @@ STDMETHODIMP CBaseControlVideo::put_SourceLeft(long SourceLeft)
// Check the source rectangle is valid
HRESULT hr = CheckSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the source rectangle
hr = SetSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1486,8 +1435,8 @@ STDMETHODIMP CBaseControlVideo::put_SourceLeft(long SourceLeft)
STDMETHODIMP CBaseControlVideo::get_SourceLeft(__out long *pSourceLeft)
{
- CheckPointer(pSourceLeft, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pSourceLeft,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
@@ -1503,7 +1452,7 @@ STDMETHODIMP CBaseControlVideo::get_SourceLeft(__out long *pSourceLeft)
STDMETHODIMP CBaseControlVideo::put_SourceWidth(long SourceWidth)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
GetSourceRect(&SourceRect);
@@ -1512,16 +1461,14 @@ STDMETHODIMP CBaseControlVideo::put_SourceWidth(long SourceWidth)
// Check the source rectangle is valid
HRESULT hr = CheckSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the source rectangle
hr = SetSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1532,8 +1479,8 @@ STDMETHODIMP CBaseControlVideo::put_SourceWidth(long SourceWidth)
STDMETHODIMP CBaseControlVideo::get_SourceWidth(__out long *pSourceWidth)
{
- CheckPointer(pSourceWidth, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pSourceWidth,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
@@ -1550,7 +1497,7 @@ STDMETHODIMP CBaseControlVideo::get_SourceWidth(__out long *pSourceWidth)
STDMETHODIMP CBaseControlVideo::put_SourceTop(long SourceTop)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
GetSourceRect(&SourceRect);
@@ -1560,16 +1507,14 @@ STDMETHODIMP CBaseControlVideo::put_SourceTop(long SourceTop)
// Check the source rectangle is valid
HRESULT hr = CheckSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the source rectangle
hr = SetSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1580,8 +1525,8 @@ STDMETHODIMP CBaseControlVideo::put_SourceTop(long SourceTop)
STDMETHODIMP CBaseControlVideo::get_SourceTop(__out long *pSourceTop)
{
- CheckPointer(pSourceTop, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pSourceTop,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
@@ -1595,7 +1540,7 @@ STDMETHODIMP CBaseControlVideo::get_SourceTop(__out long *pSourceTop)
STDMETHODIMP CBaseControlVideo::put_SourceHeight(long SourceHeight)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
GetSourceRect(&SourceRect);
@@ -1604,16 +1549,14 @@ STDMETHODIMP CBaseControlVideo::put_SourceHeight(long SourceHeight)
// Check the source rectangle is valid
HRESULT hr = CheckSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the source rectangle
hr = SetSourceRect(&SourceRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1624,8 +1567,8 @@ STDMETHODIMP CBaseControlVideo::put_SourceHeight(long SourceHeight)
STDMETHODIMP CBaseControlVideo::get_SourceHeight(__out long *pSourceHeight)
{
- CheckPointer(pSourceHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pSourceHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT SourceRect;
@@ -1642,7 +1585,7 @@ STDMETHODIMP CBaseControlVideo::get_SourceHeight(__out long *pSourceHeight)
STDMETHODIMP CBaseControlVideo::put_DestinationLeft(long DestinationLeft)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
GetTargetRect(&DestinationRect);
@@ -1652,16 +1595,14 @@ STDMETHODIMP CBaseControlVideo::put_DestinationLeft(long DestinationLeft)
// Check the target rectangle is valid
HRESULT hr = CheckTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the new target rectangle
hr = SetTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1672,8 +1613,8 @@ STDMETHODIMP CBaseControlVideo::put_DestinationLeft(long DestinationLeft)
STDMETHODIMP CBaseControlVideo::get_DestinationLeft(__out long *pDestinationLeft)
{
- CheckPointer(pDestinationLeft, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pDestinationLeft,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
@@ -1687,7 +1628,7 @@ STDMETHODIMP CBaseControlVideo::get_DestinationLeft(__out long *pDestinationLeft
STDMETHODIMP CBaseControlVideo::put_DestinationWidth(long DestinationWidth)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
GetTargetRect(&DestinationRect);
@@ -1696,16 +1637,14 @@ STDMETHODIMP CBaseControlVideo::put_DestinationWidth(long DestinationWidth)
// Check the target rectangle is valid
HRESULT hr = CheckTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the new target rectangle
hr = SetTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1716,8 +1655,8 @@ STDMETHODIMP CBaseControlVideo::put_DestinationWidth(long DestinationWidth)
STDMETHODIMP CBaseControlVideo::get_DestinationWidth(__out long *pDestinationWidth)
{
- CheckPointer(pDestinationWidth, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pDestinationWidth,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
@@ -1734,7 +1673,7 @@ STDMETHODIMP CBaseControlVideo::get_DestinationWidth(__out long *pDestinationWid
STDMETHODIMP CBaseControlVideo::put_DestinationTop(long DestinationTop)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
GetTargetRect(&DestinationRect);
@@ -1744,16 +1683,14 @@ STDMETHODIMP CBaseControlVideo::put_DestinationTop(long DestinationTop)
// Check the target rectangle is valid
HRESULT hr = CheckTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the new target rectangle
hr = SetTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1764,8 +1701,8 @@ STDMETHODIMP CBaseControlVideo::put_DestinationTop(long DestinationTop)
STDMETHODIMP CBaseControlVideo::get_DestinationTop(__out long *pDestinationTop)
{
- CheckPointer(pDestinationTop, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pDestinationTop,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
@@ -1779,7 +1716,7 @@ STDMETHODIMP CBaseControlVideo::get_DestinationTop(__out long *pDestinationTop)
STDMETHODIMP CBaseControlVideo::put_DestinationHeight(long DestinationHeight)
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
GetTargetRect(&DestinationRect);
@@ -1788,16 +1725,14 @@ STDMETHODIMP CBaseControlVideo::put_DestinationHeight(long DestinationHeight)
// Check the target rectangle is valid
HRESULT hr = CheckTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
// Now set the new target rectangle
hr = SetTargetRect(&DestinationRect);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1808,8 +1743,8 @@ STDMETHODIMP CBaseControlVideo::put_DestinationHeight(long DestinationHeight)
STDMETHODIMP CBaseControlVideo::get_DestinationHeight(__out long *pDestinationHeight)
{
- CheckPointer(pDestinationHeight, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pDestinationHeight,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
RECT DestinationRect;
@@ -1823,11 +1758,10 @@ STDMETHODIMP CBaseControlVideo::get_DestinationHeight(__out long *pDestinationHe
STDMETHODIMP CBaseControlVideo::SetDefaultSourcePosition()
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
HRESULT hr = SetDefaultSourceRect();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1838,7 +1772,7 @@ STDMETHODIMP CBaseControlVideo::SetDefaultSourcePosition()
STDMETHODIMP CBaseControlVideo::IsUsingDefaultSource()
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
return IsDefaultSourceRect();
}
@@ -1848,11 +1782,10 @@ STDMETHODIMP CBaseControlVideo::IsUsingDefaultSource()
STDMETHODIMP CBaseControlVideo::SetDefaultDestinationPosition()
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
HRESULT hr = SetDefaultTargetRect();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return OnUpdateRectangles();
@@ -1863,7 +1796,7 @@ STDMETHODIMP CBaseControlVideo::SetDefaultDestinationPosition()
STDMETHODIMP CBaseControlVideo::IsUsingDefaultDestination()
{
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
return IsDefaultTargetRect();
}
@@ -1872,33 +1805,31 @@ STDMETHODIMP CBaseControlVideo::IsUsingDefaultDestination()
// Return a copy of the current image in the video renderer
STDMETHODIMP
-CBaseControlVideo::GetCurrentImage(__inout long *pBufferSize, __out_bcount_part(*pBufferSize, *pBufferSize) long *pVideoImage)
+CBaseControlVideo::GetCurrentImage(__inout long *pBufferSize,__out_bcount_part(*pBufferSize, *pBufferSize) long *pVideoImage)
{
- CheckPointer(pBufferSize, E_POINTER);
- CheckConnected(m_pPin, VFW_E_NOT_CONNECTED);
+ CheckPointer(pBufferSize,E_POINTER);
+ CheckConnected(m_pPin,VFW_E_NOT_CONNECTED);
CAutoLock cInterfaceLock(m_pInterfaceLock);
FILTER_STATE State;
// Make sure we are in a paused state
- if(pVideoImage != NULL)
- {
- m_pFilter->GetState(0, &State);
- if(State != State_Paused)
- {
+ if (pVideoImage != NULL) {
+ m_pFilter->GetState(0,&State);
+ if (State != State_Paused) {
return VFW_E_NOT_PAUSED;
}
- return GetStaticImage(pBufferSize, pVideoImage);
+ return GetStaticImage(pBufferSize,pVideoImage);
}
// Just return the memory required
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
RECT SourceRect;
GetSourceRect(&SourceRect);
- return GetImageSize(pVideoInfo, pBufferSize, &SourceRect);
+ return GetImageSize(pVideoInfo,pBufferSize,&SourceRect);
}
@@ -1918,20 +1849,17 @@ HRESULT CBaseControlVideo::GetImageSize(__in VIDEOINFOHEADER *pVideoInfo,
// Check we have the correct input parameters
- if(pSourceRect == NULL ||
- pVideoInfo == NULL ||
- pBufferSize == NULL)
- {
+ if (pSourceRect == NULL ||
+ pVideoInfo == NULL ||
+ pBufferSize == NULL) {
return E_UNEXPECTED;
}
// Is the data format compatible
- if(pVideoInfo->bmiHeader.biCompression != BI_RGB)
- {
- if(pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS)
- {
+ if (pVideoInfo->bmiHeader.biCompression != BI_RGB) {
+ if (pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS) {
return E_INVALIDARG;
}
}
@@ -1969,31 +1897,27 @@ HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample,
// Check we have an image to copy
- if(pMediaSample == NULL || pSourceRect == NULL ||
- pVideoInfo == NULL || pVideoImage == NULL ||
- pBufferSize == NULL)
- {
+ if (pMediaSample == NULL || pSourceRect == NULL ||
+ pVideoInfo == NULL || pVideoImage == NULL ||
+ pBufferSize == NULL) {
return E_UNEXPECTED;
}
// Is the data format compatible
- if(pVideoInfo->bmiHeader.biCompression != BI_RGB)
- {
- if(pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS)
- {
+ if (pVideoInfo->bmiHeader.biCompression != BI_RGB) {
+ if (pVideoInfo->bmiHeader.biCompression != BI_BITFIELDS) {
return E_INVALIDARG;
}
}
- if(*pBufferSize < 0)
- {
+ if (*pBufferSize < 0) {
return E_INVALIDARG;
}
// Arbitrarily large size to prevent integer overflow problems
- if(pVideoInfo->bmiHeader.biSize > 4096)
+ if (pVideoInfo->bmiHeader.biSize > 4096)
{
return E_INVALIDARG;
}
@@ -2008,8 +1932,7 @@ HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample,
DWORD Total;
DWORD dwDibSize;
- if(!ValidateBitmapInfoHeader(HEADER(pVideoInfo), Size))
- {
+ if( !ValidateBitmapInfoHeader( HEADER(pVideoInfo), Size)) {
return E_INVALIDARG;
}
@@ -2017,20 +1940,17 @@ HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample,
// tools aren't picking up the annotation
__analysis_assume(Size >= sizeof(BITMAPINFOHEADER));
- if(FAILED(SAFE_DIBSIZE(&bih, &dwDibSize)))
- {
+ if (FAILED(SAFE_DIBSIZE(&bih, &dwDibSize))) {
return E_INVALIDARG;
}
- if(FAILED(DWordAdd(Size, dwDibSize, &Total)))
- {
+ if (FAILED(DWordAdd(Size, dwDibSize, &Total))) {
return E_INVALIDARG;
}
// Make sure we have a large enough buffer
- if((DWORD)*pBufferSize < Total)
- {
+ if ((DWORD)*pBufferSize < Total) {
return E_OUTOFMEMORY;
}
@@ -2045,8 +1965,7 @@ HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample,
// Get the pointer to it's image data
HRESULT hr = pMediaSample->GetPointer(&pCurrentImage);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -2060,8 +1979,7 @@ HRESULT CBaseControlVideo::CopyImage(IMediaSample *pMediaSample,
// Even money on this GP faulting sometime...
- for(LONG Line = 0; Line < HEIGHT(pSourceRect); Line++)
- {
+ for (LONG Line = 0;Line < HEIGHT(pSourceRect);Line++) {
CopyMemory((PVOID)pImageData, (PVOID)pCurrentImage, ScanLine);
pImageData += DIBWIDTHBYTES(*(BITMAPINFOHEADER *)pVideoImage);
pCurrentImage += DIBWIDTHBYTES(pVideoInfo->bmiHeader);
@@ -2080,14 +1998,14 @@ HRESULT CBaseControlVideo::OnVideoSizeChange()
// Get the video format from the derived class
VIDEOINFOHEADER *pVideoInfo = GetVideoFormat();
- if(pVideoInfo == NULL)
- return E_OUTOFMEMORY;
+ if (pVideoInfo == NULL)
+ return E_OUTOFMEMORY;
WORD Width = (WORD) pVideoInfo->bmiHeader.biWidth;
WORD Height = (WORD) pVideoInfo->bmiHeader.biHeight;
return m_pFilter->NotifyEvent(EC_VIDEO_SIZE_CHANGED,
- MAKELPARAM(Width, Height),
- MAKEWPARAM(0, 0));
+ MAKELPARAM(Width,Height),
+ MAKEWPARAM(0,0));
}
@@ -2101,27 +2019,25 @@ HRESULT CBaseControlVideo::OnVideoSizeChange()
HRESULT CBaseControlVideo::CheckSourceRect(__in RECT *pSourceRect)
{
- CheckPointer(pSourceRect, E_POINTER);
- LONG Width, Height;
- GetVideoSize(&Width, &Height);
+ CheckPointer(pSourceRect,E_POINTER);
+ LONG Width,Height;
+ GetVideoSize(&Width,&Height);
// Check the coordinates are greater than zero
// and that the rectangle is valid (left<right, top<bottom)
- if((pSourceRect->left >= pSourceRect->right) ||
+ if ((pSourceRect->left >= pSourceRect->right) ||
(pSourceRect->left < 0) ||
(pSourceRect->top >= pSourceRect->bottom) ||
- (pSourceRect->top < 0))
- {
+ (pSourceRect->top < 0)) {
return E_INVALIDARG;
}
// Check the coordinates are less than the extents
- if((pSourceRect->right > Width) ||
- (pSourceRect->bottom > Height))
- {
+ if ((pSourceRect->right > Width) ||
+ (pSourceRect->bottom > Height)) {
return E_INVALIDARG;
}
@@ -2142,23 +2058,20 @@ HRESULT CBaseControlVideo::CheckTargetRect(__in RECT *pTargetRect)
{
// Check the pointer is valid
- if(pTargetRect == NULL)
- {
+ if (pTargetRect == NULL) {
return E_POINTER;
}
// These overflow the WIDTH and HEIGHT checks
- if(pTargetRect->left > pTargetRect->right ||
- pTargetRect->top > pTargetRect->bottom)
- {
- return E_INVALIDARG;
+ if (pTargetRect->left > pTargetRect->right ||
+ pTargetRect->top > pTargetRect->bottom) {
+ return E_INVALIDARG;
}
// Check the rectangle has valid coordinates
- if(WIDTH(pTargetRect) <= 0 || HEIGHT(pTargetRect) <= 0)
- {
+ if (WIDTH(pTargetRect) <= 0 || HEIGHT(pTargetRect) <= 0) {
return E_INVALIDARG;
}
diff --git a/src/filters/BaseClasses/winctrl.h b/src/filters/BaseClasses/winctrl.h
index b1bcf02b6..1080a47c6 100644
--- a/src/filters/BaseClasses/winctrl.h
+++ b/src/filters/BaseClasses/winctrl.h
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// File: WinCtrl.h
//
-// Desc: DirectShow base classes - defines classes for video control
+// Desc: DirectShow base classes - defines classes for video control
// interfaces.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -34,24 +34,12 @@ public:
// Internal methods for other objects to get information out
- HRESULT DoSetWindowStyle(long Style, long WindowLong);
- HRESULT DoGetWindowStyle(__out long *pStyle, long WindowLong);
- BOOL IsAutoShowEnabled()
- {
- return m_bAutoShow;
- };
- COLORREF GetBorderColour()
- {
- return m_BorderColour;
- };
- HWND GetOwnerWindow()
- {
- return m_hwndOwner;
- };
- BOOL IsCursorHidden()
- {
- return m_bCursorHidden;
- };
+ HRESULT DoSetWindowStyle(long Style,long WindowLong);
+ HRESULT DoGetWindowStyle(__out long *pStyle,long WindowLong);
+ BOOL IsAutoShowEnabled() { return m_bAutoShow; };
+ COLORREF GetBorderColour() { return m_BorderColour; };
+ HWND GetOwnerWindow() { return m_hwndOwner; };
+ BOOL IsCursorHidden() { return m_bCursorHidden; };
inline BOOL PossiblyEatMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -64,8 +52,7 @@ public:
// pins dynamically when requested in CBaseFilter::GetPin. This can
// not be called from our constructor because is is a virtual method
- void SetControlWindowPin(CBasePin *pPin)
- {
+ void SetControlWindowPin(CBasePin *pPin) {
m_pPin = pPin;
}
@@ -113,13 +100,13 @@ public:
// And these are the methods
STDMETHODIMP SetWindowForeground(long Focus);
- STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam);
- STDMETHODIMP GetMinIdealImageSize(__out long *pWidth, __out long *pHeight);
- STDMETHODIMP GetMaxIdealImageSize(__out long *pWidth, __out long *pHeight);
- STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
- STDMETHODIMP GetWindowPosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight);
- STDMETHODIMP GetRestorePosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight);
- STDMETHODIMP HideCursor(long HideCursor);
+ STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd,long uMsg,LONG_PTR wParam,LONG_PTR lParam);
+ STDMETHODIMP GetMinIdealImageSize(__out long *pWidth,__out long *pHeight);
+ STDMETHODIMP GetMaxIdealImageSize(__out long *pWidth,__out long *pHeight);
+ STDMETHODIMP SetWindowPosition(long Left,long Top,long Width,long Height);
+ STDMETHODIMP GetWindowPosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight);
+ STDMETHODIMP GetRestorePosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight);
+ STDMETHODIMP HideCursor(long HideCursor);
STDMETHODIMP IsCursorHidden(__out long *CursorHidden);
};
@@ -145,7 +132,7 @@ public:
virtual HRESULT SetDefaultSourceRect() PURE;
virtual HRESULT SetSourceRect(RECT *pSourceRect) PURE;
virtual HRESULT GetSourceRect(RECT *pSourceRect) PURE;
- virtual HRESULT GetStaticImage(__inout long *pBufferSize, __out_bcount_part(*pBufferSize, *pBufferSize) long *pDIBImage) PURE;
+ virtual HRESULT GetStaticImage(__inout long *pBufferSize,__out_bcount_part(*pBufferSize, *pBufferSize) long *pDIBImage) PURE;
// Derived classes must override this to return a VIDEOINFO representing
// the video format. We cannot call IPin ConnectionMediaType to get this
@@ -169,10 +156,7 @@ public:
__in RECT *pSourceRect);
// Override this if you want notifying when the rectangles change
- virtual HRESULT OnUpdateRectangles()
- {
- return NOERROR;
- };
+ virtual HRESULT OnUpdateRectangles() { return NOERROR; };
virtual HRESULT OnVideoSizeChange();
// Derived classes must call this to set the pin the filter is using
@@ -181,8 +165,7 @@ public:
// pins dynamically when requested in CBaseFilter::GetPin. This can
// not be called from our constructor because is is a virtual method
- void SetControlVideoPin(__inout CBasePin *pPin)
- {
+ void SetControlVideoPin(__inout CBasePin *pPin) {
m_pPin = pPin;
}
@@ -224,17 +207,17 @@ public:
// And these are the methods
- STDMETHODIMP GetVideoSize(__out long *pWidth, __out long *pHeight);
- STDMETHODIMP SetSourcePosition(long Left, long Top, long Width, long Height);
- STDMETHODIMP GetSourcePosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight);
- STDMETHODIMP GetVideoPaletteEntries(long StartIndex, long Entries, __out long *pRetrieved, __out_ecount_part(Entries, *pRetrieved) long *pPalette);
+ STDMETHODIMP GetVideoSize(__out long *pWidth,__out long *pHeight);
+ STDMETHODIMP SetSourcePosition(long Left,long Top,long Width,long Height);
+ STDMETHODIMP GetSourcePosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight);
+ STDMETHODIMP GetVideoPaletteEntries(long StartIndex,long Entries,__out long *pRetrieved,__out_ecount_part(Entries, *pRetrieved) long *pPalette);
STDMETHODIMP SetDefaultSourcePosition();
STDMETHODIMP IsUsingDefaultSource();
- STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
- STDMETHODIMP GetDestinationPosition(__out long *pLeft, __out long *pTop, __out long *pWidth, __out long *pHeight);
+ STDMETHODIMP SetDestinationPosition(long Left,long Top,long Width,long Height);
+ STDMETHODIMP GetDestinationPosition(__out long *pLeft,__out long *pTop,__out long *pWidth,__out long *pHeight);
STDMETHODIMP SetDefaultDestinationPosition();
STDMETHODIMP IsUsingDefaultDestination();
- STDMETHODIMP GetCurrentImage(__inout long *pBufferSize, __out_bcount_part(*pBufferSize, *pBufferSize) long *pVideoImage);
+ STDMETHODIMP GetCurrentImage(__inout long *pBufferSize,__out_bcount_part(*pBufferSize, *pBufferSize) long *pVideoImage);
};
#endif // __WINCTRL__
diff --git a/src/filters/BaseClasses/winutil.cpp b/src/filters/BaseClasses/winutil.cpp
index 2c50fc2e2..e5a63cc02 100644
--- a/src/filters/BaseClasses/winutil.cpp
+++ b/src/filters/BaseClasses/winutil.cpp
@@ -50,7 +50,7 @@ CBaseWindow::CBaseWindow(BOOL bDoGetDC, bool bDoPostToDestroy) :
HRESULT CBaseWindow::PrepareWindow()
{
- if(m_hwnd) return NOERROR;
+ if (m_hwnd) return NOERROR;
ASSERT(m_hwnd == NULL);
ASSERT(m_hdc == NULL);
@@ -59,8 +59,7 @@ HRESULT CBaseWindow::PrepareWindow()
m_pClassName = GetClassWindowStyles(&m_ClassStyles,
&m_WindowStyles,
&m_WindowStylesEx);
- if(m_pClassName == NULL)
- {
+ if (m_pClassName == NULL) {
return E_FAIL;
}
@@ -68,26 +67,22 @@ HRESULT CBaseWindow::PrepareWindow()
m_ShowStageMessage = RegisterWindowMessage(SHOWSTAGE);
// RegisterWindowMessage() returns 0 if an error occurs.
- if(0 == m_ShowStageMessage)
- {
+ if (0 == m_ShowStageMessage) {
return AmGetLastErrorToHResult();
}
m_ShowStageTop = RegisterWindowMessage(SHOWSTAGETOP);
- if(0 == m_ShowStageTop)
- {
+ if (0 == m_ShowStageTop) {
return AmGetLastErrorToHResult();
}
m_RealizePalette = RegisterWindowMessage(REALIZEPALETTE);
- if(0 == m_RealizePalette)
- {
+ if (0 == m_RealizePalette) {
return AmGetLastErrorToHResult();
}
MsgDestroy = RegisterWindowMessage(TEXT("AM_DESTROY"));
- if(0 == MsgDestroy)
- {
+ if (0 == MsgDestroy) {
return AmGetLastErrorToHResult();
}
@@ -117,23 +112,19 @@ CBaseWindow::~CBaseWindow()
HRESULT CBaseWindow::DoneWithWindow()
{
- if(!IsWindow(m_hwnd) || (GetWindowThreadProcessId(m_hwnd, NULL) != GetCurrentThreadId()))
- {
+ if (!IsWindow(m_hwnd) || (GetWindowThreadProcessId(m_hwnd, NULL) != GetCurrentThreadId())) {
- if(IsWindow(m_hwnd))
- {
+ if (IsWindow(m_hwnd)) {
- // This code should only be executed if the window exists and if the window's
+ // This code should only be executed if the window exists and if the window's
// messages are processed on a different thread.
ASSERT(GetWindowThreadProcessId(m_hwnd, NULL) != GetCurrentThreadId());
- if(m_bDoPostToDestroy)
- {
+ if (m_bDoPostToDestroy) {
HRESULT hr = S_OK;
CAMEvent m_evDone(FALSE, &hr);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -143,9 +134,7 @@ HRESULT CBaseWindow::DoneWithWindow()
// Sending a message gives less synchronization.
PostMessage(m_hwnd, MsgDestroy, (WPARAM)(HANDLE)m_evDone, 0);
WaitDispatchingMessages(m_evDone, INFINITE);
- }
- else
- {
+ } else {
SendMessage(m_hwnd, MsgDestroy, 0, 0);
}
}
@@ -161,7 +150,7 @@ HRESULT CBaseWindow::DoneWithWindow()
// We need to free this DC though because USER32 does not know
// anything about it.
//
- if(m_MemoryDC)
+ if (m_MemoryDC)
{
EXECUTE_ASSERT(DeleteDC(m_MemoryDC));
m_MemoryDC = NULL;
@@ -173,8 +162,7 @@ HRESULT CBaseWindow::DoneWithWindow()
return NOERROR;
}
const HWND hwnd = m_hwnd;
- if(hwnd == NULL)
- {
+ if (hwnd == NULL) {
return NOERROR;
}
@@ -183,15 +171,14 @@ HRESULT CBaseWindow::DoneWithWindow()
// Reset the window styles before destruction
- SetWindowLong(hwnd, GWL_STYLE, m_WindowStyles);
+ SetWindowLong(hwnd,GWL_STYLE,m_WindowStyles);
ASSERT(GetParent(hwnd) == NULL);
- NOTE1("Reset window styles %d", m_WindowStyles);
+ NOTE1("Reset window styles %d",m_WindowStyles);
// UnintialiseWindow sets m_hwnd to NULL so save a copy
UninitialiseWindow();
DbgLog((LOG_TRACE, 2, TEXT("Destroying 0x%8.8X"), hwnd));
- if(!DestroyWindow(hwnd))
- {
+ if (!DestroyWindow(hwnd)) {
DbgLog((LOG_TRACE, 0, TEXT("DestroyWindow %8.8X failed code %d"),
hwnd, GetLastError()));
DbgBreak("");
@@ -219,13 +206,12 @@ HRESULT CBaseWindow::DoneWithWindow()
HRESULT CBaseWindow::InactivateWindow()
{
// Has the window been activated
- if(m_bActivated == FALSE)
- {
+ if (m_bActivated == FALSE) {
return S_FALSE;
}
m_bActivated = FALSE;
- ShowWindow(m_hwnd, SW_HIDE);
+ ShowWindow(m_hwnd,SW_HIDE);
return NOERROR;
}
@@ -247,8 +233,7 @@ HRESULT CBaseWindow::ActivateWindow()
{
// Has the window been sized and positioned already
- if(m_bActivated == TRUE || GetParent(m_hwnd) != NULL)
- {
+ if (m_bActivated == TRUE || GetParent(m_hwnd) != NULL) {
SetWindowPos(m_hwnd, // Our window handle
HWND_TOP, // Put it at the top
@@ -263,9 +248,9 @@ HRESULT CBaseWindow::ActivateWindow()
// Calculate the desired client rectangle
RECT WindowRect, ClientRect = GetDefaultRect();
- GetWindowRect(m_hwnd, &WindowRect);
- AdjustWindowRectEx(&ClientRect, GetWindowLong(m_hwnd, GWL_STYLE),
- FALSE, GetWindowLong(m_hwnd, GWL_EXSTYLE));
+ GetWindowRect(m_hwnd,&WindowRect);
+ AdjustWindowRectEx(&ClientRect,GetWindowLong(m_hwnd,GWL_STYLE),
+ FALSE,GetWindowLong(m_hwnd,GWL_EXSTYLE));
// Align left and top edges on DWORD boundaries
@@ -290,14 +275,13 @@ HRESULT CBaseWindow::ActivateWindow()
HRESULT CBaseWindow::PerformanceAlignWindow()
{
- RECT ClientRect, WindowRect;
- GetWindowRect(m_hwnd, &WindowRect);
+ RECT ClientRect,WindowRect;
+ GetWindowRect(m_hwnd,&WindowRect);
ASSERT(m_bActivated == TRUE);
// Don't do this if we're owned
- if(GetParent(m_hwnd))
- {
+ if (GetParent(m_hwnd)) {
return NOERROR;
}
@@ -313,7 +297,7 @@ HRESULT CBaseWindow::PerformanceAlignWindow()
HWND_TOP, // Put it at the top
WindowRect.left, // Align left edge
WindowRect.top, // And also top place
- (int) 0, (int) 0, // Ignore these sizes
+ (int) 0,(int) 0, // Ignore these sizes
WindowFlags); // Don't show window
return NOERROR;
@@ -341,20 +325,17 @@ HRESULT CBaseWindow::SetPalette(HPALETTE hPalette)
HRESULT CBaseWindow::SetPalette()
{
- if(!m_bNoRealize)
- {
+ if (!m_bNoRealize) {
SendMessage(m_hwnd, m_RealizePalette, 0, 0);
return S_OK;
- }
- else
- {
+ } else {
// Just select the palette
ASSERT(m_hdc);
ASSERT(m_MemoryDC);
CAutoLock cPaletteLock(&m_PaletteLock);
- SelectPalette(m_hdc, m_hPalette, m_bBackground);
- SelectPalette(m_MemoryDC, m_hPalette, m_bBackground);
+ SelectPalette(m_hdc,m_hPalette,m_bBackground);
+ SelectPalette(m_MemoryDC,m_hPalette,m_bBackground);
return S_OK;
}
@@ -397,8 +378,7 @@ HRESULT CBaseWindow::DoRealisePalette(BOOL bForceBackground)
{
CAutoLock cPaletteLock(&m_PaletteLock);
- if(m_hPalette == NULL)
- {
+ if (m_hPalette == NULL) {
return NOERROR;
}
@@ -406,8 +386,8 @@ HRESULT CBaseWindow::DoRealisePalette(BOOL bForceBackground)
ASSERT(m_hdc);
ASSERT(m_MemoryDC);
- SelectPalette(m_hdc, m_hPalette, m_bBackground || bForceBackground);
- SelectPalette(m_MemoryDC, m_hPalette, m_bBackground);
+ SelectPalette(m_hdc,m_hPalette,m_bBackground || bForceBackground);
+ SelectPalette(m_MemoryDC,m_hPalette,m_bBackground);
}
// If we grab a critical section here we can deadlock
@@ -445,10 +425,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, // Window handle
// structure. IF we get any messages before WM_NCCREATE we will
// pass them to DefWindowProc.
- CBaseWindow *pBaseWindow = _GetWindowLongPtr<CBaseWindow*>(hwnd, 0);
+ CBaseWindow *pBaseWindow = _GetWindowLongPtr<CBaseWindow*>(hwnd,0);
- if(pBaseWindow == NULL)
- {
+ if (pBaseWindow == NULL) {
// Get the structure pointer from the create struct.
// We can only do this for WM_NCCREATE which should be one of
@@ -459,13 +438,12 @@ LRESULT CALLBACK WndProc(HWND hwnd, // Window handle
// and will then place it in the window structure
// turn off WS_EX_LAYOUTRTL style for quartz windows
- if(uMsg == WM_NCCREATE)
- {
+ if (uMsg == WM_NCCREATE) {
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~0x400000);
}
- if((uMsg != WM_NCCREATE)
- || (NULL == (pBaseWindow = *(CBaseWindow**)((LPCREATESTRUCT)lParam)->lpCreateParams)))
+ if ((uMsg != WM_NCCREATE)
+ || (NULL == (pBaseWindow = *(CBaseWindow**) ((LPCREATESTRUCT)lParam)->lpCreateParams)))
{
return(DefWindowProc(hwnd, uMsg, wParam, lParam));
}
@@ -479,8 +457,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, // Window handle
#ifdef _DEBUG
- if(0 == rc)
- {
+ if (0 == rc) {
// SetWindowLong MIGHT have failed. (Read the docs which admit
// that it is awkward to work out if you have had an error.)
LONG lasterror = GetLastError();
@@ -492,16 +469,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, // Window handle
}
// See if this is the packet of death
- if(uMsg == MsgDestroy && uMsg != 0)
- {
+ if (uMsg == MsgDestroy && uMsg != 0) {
pBaseWindow->DoneWithWindow();
- if(pBaseWindow->m_bDoPostToDestroy)
- {
+ if (pBaseWindow->m_bDoPostToDestroy) {
EXECUTE_ASSERT(SetEvent((HANDLE)wParam));
}
return 0;
}
- return pBaseWindow->OnReceiveMessage(hwnd, uMsg, wParam, lParam);
+ return pBaseWindow->OnReceiveMessage(hwnd,uMsg,wParam,lParam);
}
@@ -521,7 +496,7 @@ BOOL CBaseWindow::OnSize(LONG Width, LONG Height)
BOOL CBaseWindow::OnClose()
{
- ShowWindow(m_hwnd, SW_HIDE);
+ ShowWindow(m_hwnd,SW_HIDE);
return TRUE;
}
@@ -536,8 +511,7 @@ HRESULT CBaseWindow::UninitialiseWindow()
{
// Have we already cleaned up
- if(m_hwnd == NULL)
- {
+ if (m_hwnd == NULL) {
ASSERT(m_hdc == NULL);
ASSERT(m_MemoryDC == NULL);
return NOERROR;
@@ -547,13 +521,13 @@ HRESULT CBaseWindow::UninitialiseWindow()
EXECUTE_ASSERT(GdiFlush());
- if(m_hdc)
+ if (m_hdc)
{
- EXECUTE_ASSERT(ReleaseDC(m_hwnd, m_hdc));
+ EXECUTE_ASSERT(ReleaseDC(m_hwnd,m_hdc));
m_hdc = NULL;
}
- if(m_MemoryDC)
+ if (m_MemoryDC)
{
EXECUTE_ASSERT(DeleteDC(m_MemoryDC));
m_MemoryDC = NULL;
@@ -580,13 +554,13 @@ HRESULT CBaseWindow::InitialiseWindow(HWND hwnd)
ASSERT(IsWindow(hwnd));
m_hwnd = hwnd;
- if(m_bDoGetDC)
+ if (m_bDoGetDC)
{
EXECUTE_ASSERT(m_hdc = GetDC(hwnd));
EXECUTE_ASSERT(m_MemoryDC = CreateCompatibleDC(m_hdc));
- EXECUTE_ASSERT(SetStretchBltMode(m_hdc, COLORONCOLOR));
- EXECUTE_ASSERT(SetStretchBltMode(m_MemoryDC, COLORONCOLOR));
+ EXECUTE_ASSERT(SetStretchBltMode(m_hdc,COLORONCOLOR));
+ EXECUTE_ASSERT(SetStretchBltMode(m_MemoryDC,COLORONCOLOR));
}
return NOERROR;
@@ -606,13 +580,12 @@ HRESULT CBaseWindow::DoCreateWindow()
// for the entire lifetime of the window then changes the class style to do
// say so. If we don't set this flag then the DC comes from the cache and is
// really bad.
- if(m_bDoGetDC)
+ if (m_bDoGetDC)
{
m_ClassStyles |= CS_OWNDC;
}
- if(bRegistered == FALSE)
- {
+ if (bRegistered == FALSE) {
// Register the renderer window class
@@ -623,7 +596,7 @@ HRESULT CBaseWindow::DoCreateWindow()
wndclass.cbWndExtra = sizeof(CBaseWindow *);
wndclass.hInstance = m_hInstance;
wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) NULL;
wndclass.lpszMenuName = NULL;
@@ -652,8 +625,7 @@ HRESULT CBaseWindow::DoCreateWindow()
// last Win32 error on this thread) then signal the constructor thread
// to continue, release the mutex to let others have a go and exit
- if(hwnd == NULL)
- {
+ if (hwnd == NULL) {
DWORD Error = GetLastError();
return AmHresultFromWin32(Error);
}
@@ -685,7 +657,7 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
{
ASSERT(IsWindow(hwnd));
- if(PossiblyEatMessage(uMsg, wParam, lParam))
+ if (PossiblyEatMessage(uMsg, wParam, lParam))
return 0;
// This is sent by the IVideoWindow SetWindowForeground method. If the
@@ -694,8 +666,7 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
// topmost window without the foreground focus. If wParam is TRUE then
// for both cases the window will be forced into the foreground focus
- if(uMsg == m_ShowStageMessage)
- {
+ if (uMsg == m_ShowStageMessage) {
BOOL bVisible = IsWindowVisible(hwnd);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
@@ -703,8 +674,7 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
(bVisible ? SWP_NOACTIVATE : 0));
// Should we bring the window to the foreground
- if(wParam == TRUE)
- {
+ if (wParam == TRUE) {
SetForegroundWindow(hwnd);
}
return (LRESULT) 1;
@@ -716,8 +686,7 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
// must be on the same thread as that which created the window. The
// wParam parameter can be TRUE or FALSE to set and reset the topmost
- if(uMsg == m_ShowStageTop)
- {
+ if (uMsg == m_ShowStageTop) {
HWND HwndTop = (wParam == TRUE ? HWND_TOPMOST : HWND_NOTOPMOST);
BOOL bVisible = IsWindowVisible(hwnd);
SetWindowPos(hwnd, HwndTop, 0, 0, 0, 0,
@@ -728,26 +697,24 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
}
// New palette stuff
- if(uMsg == m_RealizePalette)
- {
+ if (uMsg == m_RealizePalette) {
ASSERT(m_hwnd == hwnd);
- return OnPaletteChange(m_hwnd, WM_QUERYNEWPALETTE);
+ return OnPaletteChange(m_hwnd,WM_QUERYNEWPALETTE);
}
- switch(uMsg)
- {
+ switch (uMsg) {
// Repaint the window if the system colours change
case WM_SYSCOLORCHANGE:
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd,NULL,FALSE);
return (LRESULT) 1;
- // Somebody has changed the palette
+ // Somebody has changed the palette
case WM_PALETTECHANGED:
- OnPaletteChange((HWND)wParam, uMsg);
+ OnPaletteChange((HWND)wParam,uMsg);
return (LRESULT) 0;
// We are about to receive the keyboard focus so we ask GDI to realise
@@ -756,34 +723,33 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
case WM_QUERYNEWPALETTE:
ASSERT(m_hwnd == hwnd);
- return OnPaletteChange(m_hwnd, uMsg);
+ return OnPaletteChange(m_hwnd,uMsg);
- // do NOT fwd WM_MOVE. the parameters are the location of the parent
- // window, NOT what the renderer should be looking at. But we need
- // to make sure the overlay is moved with the parent window, so we
- // do this.
+ // do NOT fwd WM_MOVE. the parameters are the location of the parent
+ // window, NOT what the renderer should be looking at. But we need
+ // to make sure the overlay is moved with the parent window, so we
+ // do this.
case WM_MOVE:
- if(IsWindowVisible(m_hwnd))
- {
- PostMessage(m_hwnd, WM_PAINT, 0, 0);
+ if (IsWindowVisible(m_hwnd)) {
+ PostMessage(m_hwnd,WM_PAINT,0,0);
}
break;
- // Store the width and height as useful base class members
+ // Store the width and height as useful base class members
case WM_SIZE:
OnSize(LOWORD(lParam), HIWORD(lParam));
return (LRESULT) 0;
- // Intercept the WM_CLOSE messages to hide the window
+ // Intercept the WM_CLOSE messages to hide the window
case WM_CLOSE:
OnClose();
return (LRESULT) 0;
}
- return DefWindowProc(hwnd, uMsg, wParam, lParam);
+ return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
@@ -794,26 +760,23 @@ INT_PTR CBaseWindow::OnReceiveMessage(HWND hwnd, // Window handle
// includes the standard VGA colours (at the beginning and end) otherwise
// GDI may have to map from our palette to the device palette while drawing
-LRESULT CBaseWindow::OnPaletteChange(HWND hwnd, UINT Message)
+LRESULT CBaseWindow::OnPaletteChange(HWND hwnd,UINT Message)
{
// First check we are not changing the palette during closedown
- if(m_hwnd == NULL || hwnd == NULL)
- {
+ if (m_hwnd == NULL || hwnd == NULL) {
return (LRESULT) 0;
}
ASSERT(!m_bRealizing);
// Should we realise our palette again
- if((Message == WM_QUERYNEWPALETTE || hwnd != m_hwnd))
- {
+ if ((Message == WM_QUERYNEWPALETTE || hwnd != m_hwnd)) {
// It seems that even if we're invisible that we can get asked
// to realize our palette and this can cause really ugly side-effects
// Seems like there's another bug but this masks it a least for the
// shutting down case.
- if(!IsWindowVisible(m_hwnd))
- {
+ if (!IsWindowVisible(m_hwnd)) {
DbgLog((LOG_TRACE, 1, TEXT("Realizing when invisible!")));
return (LRESULT) 0;
}
@@ -828,9 +791,8 @@ LRESULT CBaseWindow::OnPaletteChange(HWND hwnd, UINT Message)
#endif
// Should we redraw the window with the new palette
- if(Message == WM_PALETTECHANGED)
- {
- InvalidateRect(m_hwnd, NULL, FALSE);
+ if (Message == WM_PALETTECHANGED) {
+ InvalidateRect(m_hwnd,NULL,FALSE);
}
}
@@ -850,7 +812,7 @@ bool CBaseWindow::WindowExists()
RECT CBaseWindow::GetDefaultRect()
{
- RECT DefaultRect = {0, 0, DEFWIDTH, DEFHEIGHT};
+ RECT DefaultRect = {0,0,DEFWIDTH,DEFHEIGHT};
ASSERT(m_hwnd);
// ASSERT(m_hdc);
return DefaultRect;
@@ -924,7 +886,7 @@ HPALETTE CBaseWindow::GetPalette()
HRESULT CBaseWindow::DoShowWindow(LONG ShowCmd)
{
- ShowWindow(m_hwnd, ShowCmd);
+ ShowWindow(m_hwnd,ShowCmd);
return NOERROR;
}
@@ -933,7 +895,7 @@ HRESULT CBaseWindow::DoShowWindow(LONG ShowCmd)
void CBaseWindow::PaintWindow(BOOL bErase)
{
- InvalidateRect(m_hwnd, NULL, bErase);
+ InvalidateRect(m_hwnd,NULL,bErase);
}
@@ -945,7 +907,7 @@ void CBaseWindow::PaintWindow(BOOL bErase)
void CBaseWindow::DoSetWindowForeground(BOOL bFocus)
{
- SendMessage(m_hwnd, m_ShowStageMessage, (WPARAM) bFocus, (LPARAM) 0);
+ SendMessage(m_hwnd,m_ShowStageMessage,(WPARAM) bFocus,(LPARAM) 0);
}
@@ -984,8 +946,7 @@ void CDrawImage::DisplaySampleTimes(IMediaSample *pSample)
// logging "way up"
//
BOOL bAccept = DbgCheckModuleLevel(LOG_TRACE, 5);
- if(bAccept == FALSE)
- {
+ if (bAccept == FALSE) {
return;
}
#endif
@@ -999,27 +960,26 @@ void CDrawImage::DisplaySampleTimes(IMediaSample *pSample)
pSample->GetTime((REFERENCE_TIME*)&m_StartSample, (REFERENCE_TIME*)&m_EndSample);
HWND hwnd = m_pBaseWindow->GetWindowHWND();
- EXECUTE_ASSERT(GetClientRect(hwnd, &ClientRect));
+ EXECUTE_ASSERT(GetClientRect(hwnd,&ClientRect));
// Format the sample time stamps
- (void)StringCchPrintf(szTimes, NUMELMS(szTimes), TEXT("%08d : %08d"),
- m_StartSample.Millisecs(),
- m_EndSample.Millisecs());
+ (void)StringCchPrintf(szTimes,NUMELMS(szTimes),TEXT("%08d : %08d"),
+ m_StartSample.Millisecs(),
+ m_EndSample.Millisecs());
ASSERT(lstrlen(szTimes) < TIMELENGTH);
// Put the times in the middle at the bottom of the window
- GetTextExtentPoint32(m_hdc, szTimes, lstrlen(szTimes), &Size);
+ GetTextExtentPoint32(m_hdc,szTimes,lstrlen(szTimes),&Size);
INT XPos = ((ClientRect.right - ClientRect.left) - Size.cx) / 2;
INT YPos = ((ClientRect.bottom - ClientRect.top) - Size.cy) * 4 / 5;
// Check the window is big enough to have sample times displayed
- if((XPos > 0) && (YPos > 0))
- {
- TextOut(m_hdc, XPos, YPos, szTimes, lstrlen(szTimes));
+ if ((XPos > 0) && (YPos > 0)) {
+ TextOut(m_hdc,XPos,YPos,szTimes,lstrlen(szTimes));
}
}
@@ -1028,14 +988,14 @@ void CDrawImage::DisplaySampleTimes(IMediaSample *pSample)
// palette cookie. We simply call the SetDIBColorTable Windows API with the
// palette that is found after the BITMAPINFOHEADER - we return no errors
-void CDrawImage::UpdateColourTable(HDC hdc, __in BITMAPINFOHEADER *pbmi)
+void CDrawImage::UpdateColourTable(HDC hdc,__in BITMAPINFOHEADER *pbmi)
{
ASSERT(pbmi->biClrUsed);
- RGBQUAD *pColourTable = (RGBQUAD *)(pbmi + 1);
+ RGBQUAD *pColourTable = (RGBQUAD *)(pbmi+1);
// Set the new palette in the device context
- UINT uiReturn = SetDIBColorTable(hdc, (UINT) 0,
+ UINT uiReturn = SetDIBColorTable(hdc,(UINT) 0,
pbmi->biClrUsed,
pColourTable);
@@ -1077,13 +1037,12 @@ void CDrawImage::FastRender(IMediaSample *pMediaSample)
pbmi = HEADER(m_pMediaType->Format());
pSample = (CImageSample *) pMediaSample;
pDibData = pSample->GetDIBData();
- hOldBitmap = (HBITMAP) SelectObject(m_MemoryDC, pDibData->hBitmap);
+ hOldBitmap = (HBITMAP) SelectObject(m_MemoryDC,pDibData->hBitmap);
// Get a pointer to the real image data
HRESULT hr = pMediaSample->GetPointer(&pImage);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return;
}
@@ -1093,10 +1052,9 @@ void CDrawImage::FastRender(IMediaSample *pMediaSample)
// By the time we get to draw the images the format change will be done
// so all we do is ask the renderer for what it's palette version is
- if(pDibData->PaletteVersion < GetPaletteVersion())
- {
+ if (pDibData->PaletteVersion < GetPaletteVersion()) {
ASSERT(pbmi->biBitCount <= iPALETTE);
- UpdateColourTable(m_MemoryDC, pbmi);
+ UpdateColourTable(m_MemoryDC,pbmi);
pDibData->PaletteVersion = GetPaletteVersion();
}
@@ -1111,8 +1069,7 @@ void CDrawImage::FastRender(IMediaSample *pMediaSample)
// Is the window the same size as the video
- if(m_bStretch == FALSE)
- {
+ if (m_bStretch == FALSE) {
// Put the image straight into the window
@@ -1127,9 +1084,7 @@ void CDrawImage::FastRender(IMediaSample *pMediaSample)
SourceRect.top, // Y source position
SRCCOPY); // Simple copy
- }
- else
- {
+ } else {
// Stretch the image when copying to the window
@@ -1151,12 +1106,12 @@ void CDrawImage::FastRender(IMediaSample *pMediaSample)
// draw the times into the offscreen device context however that actually
// writes the text into the image data buffer which may not be writable
-#ifdef _DEBUG
+ #ifdef _DEBUG
DisplaySampleTimes(pMediaSample);
-#endif
+ #endif
// Put the old bitmap back into the device context so we don't leak
- SelectObject(m_MemoryDC, hOldBitmap);
+ SelectObject(m_MemoryDC,hOldBitmap);
}
@@ -1179,8 +1134,7 @@ void CDrawImage::SlowRender(IMediaSample *pMediaSample)
// Get the image data buffer
HRESULT hr = pMediaSample->GetPointer(&pImage);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return;
}
@@ -1196,14 +1150,12 @@ void CDrawImage::SlowRender(IMediaSample *pMediaSample)
LONG lAdjustedSourceTop = SourceRect.top;
// if the origin of bitmap is bottom-left, adjust soruce_rect_top
// to be the bottom-left corner instead of the top-left.
- if(pbmi->biHeight > 0)
- {
- lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom;
+ if (pbmi->biHeight > 0) {
+ lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom;
}
// Is the window the same size as the video
- if(m_bStretch == FALSE)
- {
+ if (m_bStretch == FALSE) {
// Put the image straight into the window
@@ -1221,9 +1173,7 @@ void CDrawImage::SlowRender(IMediaSample *pMediaSample)
(BITMAPINFO *) pbmi, // DIB header
DIB_RGB_COLORS); // Type of palette
- }
- else
- {
+ } else {
// Stretch the image when copying to the window
@@ -1251,9 +1201,9 @@ void CDrawImage::SlowRender(IMediaSample *pMediaSample)
// the screen, unfortunately this has considerable performance penalties
// and also means that this code is not executed when compiled retail
-#ifdef _DEBUG
+ #ifdef _DEBUG
DisplaySampleTimes(pMediaSample);
-#endif
+ #endif
}
@@ -1275,8 +1225,7 @@ BOOL CDrawImage::DrawImage(IMediaSample *pMediaSample)
// use to do faster image rendering, they may optionally also contain a
// DirectDraw surface pointer in which case we do not do the drawing
- if(m_bUsingImageAllocator == FALSE)
- {
+ if (m_bUsingImageAllocator == FALSE) {
SlowRender(pMediaSample);
EXECUTE_ASSERT(GdiFlush());
NotifyEndDraw();
@@ -1297,7 +1246,7 @@ BOOL CDrawImage::DrawVideoImageHere(
IMediaSample *pMediaSample,
__in LPRECT lprcSrc,
__in LPRECT lprcDst
-)
+ )
{
ASSERT(m_pMediaType);
BITMAPINFOHEADER *pbmi = HEADER(m_pMediaType->Format());
@@ -1306,22 +1255,19 @@ BOOL CDrawImage::DrawVideoImageHere(
// Get the image data buffer
HRESULT hr = pMediaSample->GetPointer(&pImage);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return FALSE;
}
RECT SourceRect;
RECT TargetRect;
- if(lprcSrc)
- {
+ if (lprcSrc) {
SourceRect = *lprcSrc;
}
else SourceRect = ScaleSourceRect(&m_SourceRect);
- if(lprcDst)
- {
+ if (lprcDst) {
TargetRect = *lprcDst;
}
else TargetRect = m_TargetRect;
@@ -1329,9 +1275,8 @@ BOOL CDrawImage::DrawVideoImageHere(
LONG lAdjustedSourceTop = SourceRect.top;
// if the origin of bitmap is bottom-left, adjust soruce_rect_top
// to be the bottom-left corner instead of the top-left.
- if(pbmi->biHeight > 0)
- {
- lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom;
+ if (pbmi->biHeight > 0) {
+ lAdjustedSourceTop = pbmi->biHeight - SourceRect.bottom;
}
@@ -1424,10 +1369,8 @@ void CDrawImage::SetStretchMode()
LONG SinkHeight = m_TargetRect.bottom - m_TargetRect.top;
m_bStretch = TRUE;
- if(SourceWidth == SinkWidth)
- {
- if(SourceHeight == SinkHeight)
- {
+ if (SourceWidth == SinkWidth) {
+ if (SourceHeight == SinkHeight) {
m_bStretch = FALSE;
}
}
@@ -1507,7 +1450,7 @@ void CDrawImage::IncrementPaletteVersion()
CImageAllocator::CImageAllocator(__inout CBaseFilter *pFilter,
__in_opt LPCTSTR pName,
__inout HRESULT *phr) :
- CBaseAllocator(pName, NULL, phr, TRUE, TRUE),
+ CBaseAllocator(pName,NULL,phr,TRUE,TRUE),
m_pFilter(pFilter)
{
ASSERT(phr);
@@ -1537,8 +1480,7 @@ void CImageAllocator::Free()
CImageSample *pSample;
DIBDATA *pDibData;
- while(m_lFree.GetCount() != 0)
- {
+ while (m_lFree.GetCount() != 0) {
pSample = (CImageSample *) m_lFree.RemoveHead();
pDibData = pSample->GetDIBData();
EXECUTE_ASSERT(DeleteObject(pDibData->hBitmap));
@@ -1556,8 +1498,7 @@ STDMETHODIMP CImageAllocator::CheckSizes(__in ALLOCATOR_PROPERTIES *pRequest)
{
// Check we have a valid connection
- if(m_pMediaType == NULL)
- {
+ if (m_pMediaType == NULL) {
return VFW_E_NOT_CONNECTED;
}
@@ -1573,15 +1514,13 @@ STDMETHODIMP CImageAllocator::CheckSizes(__in ALLOCATOR_PROPERTIES *pRequest)
// for an image smaller than this then we reject the call, if they ask
// for an image larger than this then we return what they can have
- if((DWORD) pRequest->cbBuffer < pVideoInfo->bmiHeader.biSizeImage)
- {
+ if ((DWORD) pRequest->cbBuffer < pVideoInfo->bmiHeader.biSizeImage) {
return E_INVALIDARG;
}
// Reject buffer prefixes
- if(pRequest->cbPrefix > 0)
- {
+ if (pRequest->cbPrefix > 0) {
return E_INVALIDARG;
}
@@ -1603,8 +1542,7 @@ STDMETHODIMP CImageAllocator::SetProperties(
// Check the parameters fit with the current connection
HRESULT hr = CheckSizes(&Adjusted);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
return CBaseAllocator::SetProperties(&Adjusted, pActual);
@@ -1628,8 +1566,7 @@ HRESULT CImageAllocator::Alloc(void)
// Check the base allocator says it's ok to continue
HRESULT hr = CBaseAllocator::Alloc();
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
@@ -1639,22 +1576,19 @@ HRESULT CImageAllocator::Alloc(void)
// case the available sample list is left with those already created
ASSERT(m_lAllocated == 0);
- while(m_lAllocated < m_lCount)
- {
+ while (m_lAllocated < m_lCount) {
// Create and initialise a shared memory GDI buffer
- hr = CreateDIB(m_lSize, DibData);
- if(FAILED(hr))
- {
+ hr = CreateDIB(m_lSize,DibData);
+ if (FAILED(hr)) {
return hr;
}
// Create the sample object and pass it the DIBDATA
- pSample = CreateImageSample(DibData.pBase, m_lSize);
- if(pSample == NULL)
- {
+ pSample = CreateImageSample(DibData.pBase,m_lSize);
+ if (pSample == NULL) {
EXECUTE_ASSERT(DeleteObject(DibData.hBitmap));
EXECUTE_ASSERT(CloseHandle(DibData.hMapping));
return E_OUTOFMEMORY;
@@ -1674,7 +1608,7 @@ HRESULT CImageAllocator::Alloc(void)
// may override it and allocate more specialised sample objects. So long as it
// derives its samples from CImageSample then all this code will still work ok
-CImageSample *CImageAllocator::CreateImageSample(__in_bcount(Length) LPBYTE pData, LONG Length)
+CImageSample *CImageAllocator::CreateImageSample(__in_bcount(Length) LPBYTE pData,LONG Length)
{
HRESULT hr = NOERROR;
CImageSample *pSample;
@@ -1687,8 +1621,7 @@ CImageSample *CImageAllocator::CreateImageSample(__in_bcount(Length) LPBYTE pDat
(LPBYTE) pData, // DIB address
(LONG) Length); // Size of DIB
- if(pSample == NULL || FAILED(hr))
- {
+ if (pSample == NULL || FAILED(hr)) {
delete pSample;
return NULL;
}
@@ -1700,7 +1633,7 @@ CImageSample *CImageAllocator::CreateImageSample(__in_bcount(Length) LPBYTE pDat
// generating DIBs for us to render. The memory block is created in shared
// memory so that GDI doesn't have to copy the memory when we do a BitBlt
-HRESULT CImageAllocator::CreateDIB(LONG InSize, DIBDATA &DibData)
+HRESULT CImageAllocator::CreateDIB(LONG InSize,DIBDATA &DibData)
{
BITMAPINFO *pbmi; // Format information for pin
BYTE *pBase; // Pointer to the actual image
@@ -1715,8 +1648,7 @@ HRESULT CImageAllocator::CreateDIB(LONG InSize, DIBDATA &DibData)
(DWORD) 0, // Less than 4Gb in size
InSize, // Size of buffer
NULL); // No name to section
- if(hMapping == NULL)
- {
+ if (hMapping == NULL) {
DWORD Error = GetLastError();
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error);
}
@@ -1727,8 +1659,7 @@ HRESULT CImageAllocator::CreateDIB(LONG InSize, DIBDATA &DibData)
// have the focus) in which case GDI will do after the palette mapping
pbmi = (BITMAPINFO *) HEADER(m_pMediaType->Format());
- if(m_pMediaType == NULL)
- {
+ if (m_pMediaType == NULL) {
DbgBreak("Invalid media type");
}
@@ -1739,8 +1670,7 @@ HRESULT CImageAllocator::CreateDIB(LONG InSize, DIBDATA &DibData)
hMapping, // Mapped memory handle
(DWORD) 0); // Offset into memory
- if(hBitmap == NULL || pBase == NULL)
- {
+ if (hBitmap == NULL || pBase == NULL) {
EXECUTE_ASSERT(CloseHandle(hMapping));
DWORD Error = GetLastError();
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, Error);
@@ -1752,7 +1682,7 @@ HRESULT CImageAllocator::CreateDIB(LONG InSize, DIBDATA &DibData)
DibData.hMapping = hMapping;
DibData.pBase = pBase;
DibData.PaletteVersion = PALETTE_VERSION;
- GetObject(hBitmap, sizeof(DIBSECTION), (VOID *)&DibData.DibSection);
+ GetObject(hBitmap,sizeof(DIBSECTION),(VOID *)&DibData.DibSection);
return NOERROR;
}
@@ -1803,7 +1733,7 @@ CImageSample::CImageSample(__inout CBaseAllocator *pAllocator,
__inout HRESULT *phr,
__in_bcount(length) LPBYTE pBuffer,
LONG length) :
- CMediaSample(pName, pAllocator, phr, pBuffer, length),
+ CMediaSample(pName,pAllocator,phr,pBuffer,length),
m_bInit(FALSE)
{
ASSERT(pAllocator);
@@ -1874,17 +1804,14 @@ BOOL CImagePalette::ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,
{
// We may not have a current format yet
- if(pOldInfo == NULL)
- {
+ if (pOldInfo == NULL) {
return TRUE;
}
// Do both formats not require a palette
- if(ContainsPalette(pNewInfo) == FALSE)
- {
- if(ContainsPalette(pOldInfo) == FALSE)
- {
+ if (ContainsPalette(pNewInfo) == FALSE) {
+ if (ContainsPalette(pOldInfo) == FALSE) {
return FALSE;
}
}
@@ -1892,14 +1819,13 @@ BOOL CImagePalette::ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,
// Compare the colours to see if they match
DWORD VideoEntries = pNewInfo->bmiHeader.biClrUsed;
- if(ContainsPalette(pNewInfo) == TRUE)
- if(ContainsPalette(pOldInfo) == TRUE)
- if(pOldInfo->bmiHeader.biClrUsed == VideoEntries)
- if(pOldInfo->bmiHeader.biClrUsed > 0)
- if(memcmp((PVOID) GetBitmapPalette(pNewInfo),
- (PVOID) GetBitmapPalette(pOldInfo),
- VideoEntries * sizeof(RGBQUAD)) == 0)
- {
+ if (ContainsPalette(pNewInfo) == TRUE)
+ if (ContainsPalette(pOldInfo) == TRUE)
+ if (pOldInfo->bmiHeader.biClrUsed == VideoEntries)
+ if (pOldInfo->bmiHeader.biClrUsed > 0)
+ if (memcmp((PVOID) GetBitmapPalette(pNewInfo),
+ (PVOID) GetBitmapPalette(pOldInfo),
+ VideoEntries * sizeof(RGBQUAD)) == 0) {
return FALSE;
}
@@ -1918,7 +1844,7 @@ BOOL CImagePalette::ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,
HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
const CMediaType *pmtOld,
- __in LPSTR szDevice)
+ __in LPSTR szDevice)
{
const VIDEOINFOHEADER *pNewInfo = (VIDEOINFOHEADER *) pmtNew->Format();
const VIDEOINFOHEADER *pOldInfo = (VIDEOINFOHEADER *) pmtOld->Format();
@@ -1929,8 +1855,7 @@ HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
// when previously we didn't or vica versa then this returns TRUE, if we
// previously needed a palette and we do now it compares their colours
- if(ShouldUpdate(pNewInfo, pOldInfo) == FALSE)
- {
+ if (ShouldUpdate(pNewInfo,pOldInfo) == FALSE) {
NOTE("No update needed");
return S_FALSE;
}
@@ -1941,18 +1866,16 @@ HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
// or renderer lock will ensure it doesn't get in until we are finished
RemovePalette();
- m_pFilter->NotifyEvent(EC_PALETTE_CHANGED, 0, 0);
+ m_pFilter->NotifyEvent(EC_PALETTE_CHANGED,0,0);
// Do we need a palette for the new format
- if(ContainsPalette(pNewInfo) == FALSE)
- {
+ if (ContainsPalette(pNewInfo) == FALSE) {
NOTE("New has no palette");
return S_FALSE;
}
- if(m_pBaseWindow)
- {
+ if (m_pBaseWindow) {
m_pBaseWindow->LockPaletteLock();
}
@@ -1965,8 +1888,7 @@ HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
m_hPalette = MakePalette(pNewInfo, szDevice);
ASSERT(m_hPalette != NULL);
- if(m_pBaseWindow)
- {
+ if (m_pBaseWindow) {
m_pBaseWindow->UnlockPaletteLock();
}
@@ -1974,13 +1896,13 @@ HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
// pointer to signal that no window is in use, if so we don't call it
// Some filters just want to use this object to create/manage palettes
- if(m_pBaseWindow) m_pBaseWindow->SetPalette(m_hPalette);
+ if (m_pBaseWindow) m_pBaseWindow->SetPalette(m_hPalette);
// This is the only time where we need access to the draw object to say
// to it that a new palette will be arriving on a sample real soon. The
// constructor may take a NULL pointer in which case we don't call this
- if(m_pDrawImage) m_pDrawImage->IncrementPaletteVersion();
+ if (m_pDrawImage) m_pDrawImage->IncrementPaletteVersion();
return NOERROR;
}
@@ -1991,7 +1913,7 @@ HRESULT CImagePalette::PreparePalette(const CMediaType *pmtNew,
// any buffer (eg YUV) and hand it back. We make a new palette out of that
// format and then copy the palette colours into the current connection type
-HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc, __out CMediaType *pDest)
+HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc,__out CMediaType *pDest)
{
// Reset the destination palette before starting
@@ -2001,8 +1923,7 @@ HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc, __out CMediaType *pDe
// Does the destination have a palette
- if(PALETTISED(pDestInfo) == FALSE)
- {
+ if (PALETTISED(pDestInfo) == FALSE) {
NOTE("No destination palette");
return S_FALSE;
}
@@ -2010,8 +1931,7 @@ HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc, __out CMediaType *pDe
// Does the source contain a palette
const VIDEOINFOHEADER *pSrcInfo = (VIDEOINFOHEADER *) pSrc->Format();
- if(ContainsPalette(pSrcInfo) == FALSE)
- {
+ if (ContainsPalette(pSrcInfo) == FALSE) {
NOTE("No source palette");
return S_FALSE;
}
@@ -2019,10 +1939,9 @@ HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc, __out CMediaType *pDe
// The number of colours may be zero filled
DWORD PaletteEntries = pSrcInfo->bmiHeader.biClrUsed;
- if(PaletteEntries == 0)
- {
+ if (PaletteEntries == 0) {
DWORD Maximum = (1 << pSrcInfo->bmiHeader.biBitCount);
- NOTE1("Setting maximum colours (%d)", Maximum);
+ NOTE1("Setting maximum colours (%d)",Maximum);
PaletteEntries = Maximum;
}
@@ -2035,8 +1954,7 @@ HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc, __out CMediaType *pDe
pDestInfo->bmiHeader.biClrImportant = pSrcInfo->bmiHeader.biClrImportant;
ULONG BitmapSize = GetBitmapFormatSize(HEADER(pSrcInfo));
- if(pDest->FormatLength() < BitmapSize)
- {
+ if (pDest->FormatLength() < BitmapSize) {
NOTE("Reallocating destination");
pDest->ReallocFormatBuffer(BitmapSize);
}
@@ -2058,18 +1976,15 @@ HRESULT CImagePalette::CopyPalette(const CMediaType *pSrc, __out CMediaType *pDe
HRESULT CImagePalette::RemovePalette()
{
- if(m_pBaseWindow)
- {
+ if (m_pBaseWindow) {
m_pBaseWindow->LockPaletteLock();
}
// Do we have a palette to remove
- if(m_hPalette != NULL)
- {
+ if (m_hPalette != NULL) {
- if(m_pBaseWindow)
- {
+ if (m_pBaseWindow) {
// Make sure that the window's palette handle matches
// our palette handle.
ASSERT(m_hPalette == m_pBaseWindow->GetPalette());
@@ -2081,8 +1996,7 @@ HRESULT CImagePalette::RemovePalette()
m_hPalette = NULL;
}
- if(m_pBaseWindow)
- {
+ if (m_pBaseWindow) {
m_pBaseWindow->UnlockPaletteLock();
}
@@ -2110,8 +2024,7 @@ HPALETTE CImagePalette::MakePalette(const VIDEOINFOHEADER *pVideoInfo, __in LPST
HPALETTE hPalette; // Logical palette object
lp = (LOGPALETTE *) new BYTE[sizeof(LOGPALETTE) + SIZE_PALETTE];
- if(lp == NULL)
- {
+ if (lp == NULL) {
return NULL;
}
@@ -2123,11 +2036,10 @@ HPALETTE CImagePalette::MakePalette(const VIDEOINFOHEADER *pVideoInfo, __in LPST
lp->palVersion = PALVERSION;
lp->palNumEntries = (USHORT) pHeader->biClrUsed;
- if(lp->palNumEntries == 0) lp->palNumEntries = (1 << pHeader->biBitCount);
+ if (lp->palNumEntries == 0) lp->palNumEntries = (1 << pHeader->biBitCount);
pColours = GetBitmapPalette(pVideoInfo);
- for(DWORD dwCount = 0; dwCount < lp->palNumEntries; dwCount++)
- {
+ for (DWORD dwCount = 0;dwCount < lp->palNumEntries;dwCount++) {
lp->palPalEntry[dwCount].peRed = pColours[dwCount].rgbRed;
lp->palPalEntry[dwCount].peGreen = pColours[dwCount].rgbGreen;
lp->palPalEntry[dwCount].peBlue = pColours[dwCount].rgbBlue;
@@ -2155,7 +2067,7 @@ HPALETTE CImagePalette::MakePalette(const VIDEOINFOHEADER *pVideoInfo, __in LPST
// We can be passed an optional device name if we wish to prepare a palette
// for a specific monitor on a multi monitor system
-HRESULT CImagePalette::MakeIdentityPalette(__inout_ecount_full(iColours) PALETTEENTRY *pEntry, INT iColours, __in LPSTR szDevice)
+HRESULT CImagePalette::MakeIdentityPalette(__inout_ecount_full(iColours) PALETTEENTRY *pEntry,INT iColours, __in LPSTR szDevice)
{
PALETTEENTRY SystemEntries[10]; // System palette entries
BOOL bIdentityPalette = TRUE; // Is an identity palette
@@ -2165,8 +2077,7 @@ HRESULT CImagePalette::MakeIdentityPalette(__inout_ecount_full(iColours) PALETTE
// Does this have the full colour range
- if(iColours < 10)
- {
+ if (iColours < 10) {
return S_FALSE;
}
@@ -2175,17 +2086,15 @@ HRESULT CImagePalette::MakeIdentityPalette(__inout_ecount_full(iColours) PALETTE
// Get a DC on the right monitor - it's ugly, but this is the way you have
// to do it
HDC hdc;
- if(szDevice == NULL || lstrcmpiLocaleIndependentA(szDevice, "DISPLAY") == 0)
+ if (szDevice == NULL || lstrcmpiLocaleIndependentA(szDevice, "DISPLAY") == 0)
hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
else
hdc = CreateDCA(NULL, szDevice, NULL, NULL);
- if(NULL == hdc)
- {
+ if (NULL == hdc) {
return E_OUTOFMEMORY;
}
- INT Reserved = GetDeviceCaps(hdc, NUMRESERVED);
- if(Reserved != 20)
- {
+ INT Reserved = GetDeviceCaps(hdc,NUMRESERVED);
+ if (Reserved != 20) {
DeleteDC(hdc);
return S_FALSE;
}
@@ -2194,29 +2103,24 @@ HRESULT CImagePalette::MakeIdentityPalette(__inout_ecount_full(iColours) PALETTE
// don't do a memory compare between our two arrays of colours is because
// I am not sure what will be in the flags fields for the system entries
- UINT Result = GetSystemPaletteEntries(hdc, 0, PalLoCount, SystemEntries);
- for(UINT Count = 0; Count < Result; Count++)
- {
- if(SystemEntries[Count].peRed != pEntry[Count].peRed ||
- SystemEntries[Count].peGreen != pEntry[Count].peGreen ||
- SystemEntries[Count].peBlue != pEntry[Count].peBlue)
- {
- bIdentityPalette = FALSE;
+ UINT Result = GetSystemPaletteEntries(hdc,0,PalLoCount,SystemEntries);
+ for (UINT Count = 0;Count < Result;Count++) {
+ if (SystemEntries[Count].peRed != pEntry[Count].peRed ||
+ SystemEntries[Count].peGreen != pEntry[Count].peGreen ||
+ SystemEntries[Count].peBlue != pEntry[Count].peBlue) {
+ bIdentityPalette = FALSE;
}
}
// And likewise compare against the last ten entries
- Result = GetSystemPaletteEntries(hdc, PalHiStart, PalLoCount, SystemEntries);
- for(UINT Count = 0; Count < Result; Count++)
- {
- if(INT(Count) + PalHiStart < iColours)
- {
- if(SystemEntries[Count].peRed != pEntry[PalHiStart + Count].peRed ||
- SystemEntries[Count].peGreen != pEntry[PalHiStart + Count].peGreen ||
- SystemEntries[Count].peBlue != pEntry[PalHiStart + Count].peBlue)
- {
- bIdentityPalette = FALSE;
+ Result = GetSystemPaletteEntries(hdc,PalHiStart,PalLoCount,SystemEntries);
+ for (UINT Count = 0;Count < Result;Count++) {
+ if (INT(Count) + PalHiStart < iColours) {
+ if (SystemEntries[Count].peRed != pEntry[PalHiStart + Count].peRed ||
+ SystemEntries[Count].peGreen != pEntry[PalHiStart + Count].peGreen ||
+ SystemEntries[Count].peBlue != pEntry[PalHiStart + Count].peBlue) {
+ bIdentityPalette = FALSE;
}
}
}
@@ -2224,15 +2128,13 @@ HRESULT CImagePalette::MakeIdentityPalette(__inout_ecount_full(iColours) PALETTE
// If not an identity palette then return S_FALSE
DeleteDC(hdc);
- if(bIdentityPalette == FALSE)
- {
+ if (bIdentityPalette == FALSE) {
return S_FALSE;
}
// Set the non VGA entries so that GDI doesn't map them
- for(UINT Count = PalLoCount; INT(Count) < min(PalHiStart, iColours); Count++)
- {
+ for (UINT Count = PalLoCount;INT(Count) < min(PalHiStart,iColours);Count++) {
pEntry[Count].peFlags = PC_NOCOLLAPSE;
}
return NOERROR;
@@ -2267,7 +2169,7 @@ HRESULT CImageDisplay::RefreshDisplayType(__in_opt LPSTR szDeviceName)
// Set the preferred format type
- ZeroMemory((PVOID)&m_Display, sizeof(VIDEOINFOHEADER) + sizeof(TRUECOLORINFO));
+ ZeroMemory((PVOID)&m_Display,sizeof(VIDEOINFOHEADER)+sizeof(TRUECOLORINFO));
m_Display.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_Display.bmiHeader.biBitCount = FALSE;
@@ -2276,29 +2178,26 @@ HRESULT CImageDisplay::RefreshDisplayType(__in_opt LPSTR szDeviceName)
// get caps of whichever monitor they are interested in (multi monitor)
HDC hdcDisplay;
// it's ugly, but this is the way you have to do it
- if(szDeviceName == NULL || lstrcmpiLocaleIndependentA(szDeviceName, "DISPLAY") == 0)
+ if (szDeviceName == NULL || lstrcmpiLocaleIndependentA(szDeviceName, "DISPLAY") == 0)
hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL);
else
hdcDisplay = CreateDCA(NULL, szDeviceName, NULL, NULL);
- if(hdcDisplay == NULL)
- {
- ASSERT(FALSE);
- DbgLog((LOG_ERROR, 1, TEXT("ACK! Can't get a DC for %hs"),
+ if (hdcDisplay == NULL) {
+ ASSERT(FALSE);
+ DbgLog((LOG_ERROR,1,TEXT("ACK! Can't get a DC for %hs"),
szDeviceName ? szDeviceName : "<NULL>"));
- return E_FAIL;
- }
- else
- {
- DbgLog((LOG_TRACE, 3, TEXT("Created a DC for %s"),
+ return E_FAIL;
+ } else {
+ DbgLog((LOG_TRACE,3,TEXT("Created a DC for %s"),
szDeviceName ? szDeviceName : "<NULL>"));
}
- HBITMAP hbm = CreateCompatibleBitmap(hdcDisplay, 1, 1);
- if(hbm)
+ HBITMAP hbm = CreateCompatibleBitmap(hdcDisplay,1,1);
+ if ( hbm )
{
- GetDIBits(hdcDisplay, hbm, 0, 1, NULL, (BITMAPINFO *)&m_Display.bmiHeader, DIB_RGB_COLORS);
+ GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&m_Display.bmiHeader,DIB_RGB_COLORS);
// This call will get the colour table or the proper bitfields
- GetDIBits(hdcDisplay, hbm, 0, 1, NULL, (BITMAPINFO *)&m_Display.bmiHeader, DIB_RGB_COLORS);
+ GetDIBits(hdcDisplay,hbm,0,1,NULL,(BITMAPINFO *)&m_Display.bmiHeader,DIB_RGB_COLORS);
DeleteObject(hbm);
}
DeleteDC(hdcDisplay);
@@ -2307,8 +2206,8 @@ HRESULT CImageDisplay::RefreshDisplayType(__in_opt LPSTR szDeviceName)
ASSERT(CheckHeaderValidity(&m_Display));
UpdateFormat(&m_Display);
- DbgLog((LOG_TRACE, 3, TEXT("New DISPLAY bit depth =%d"),
- m_Display.bmiHeader.biBitCount));
+ DbgLog((LOG_TRACE,3,TEXT("New DISPLAY bit depth =%d"),
+ m_Display.bmiHeader.biBitCount));
return NOERROR;
}
@@ -2322,15 +2221,13 @@ BOOL CImageDisplay::CheckBitFields(const VIDEOINFO *pInput)
{
DWORD *pBitFields = (DWORD *) BITMASKS(pInput);
- for(INT iColour = iRED; iColour <= iBLUE; iColour++)
- {
+ for (INT iColour = iRED;iColour <= iBLUE;iColour++) {
// First of all work out how many bits are set
DWORD SetBits = CountSetBits(pBitFields[iColour]);
- if(SetBits > iMAXBITS || SetBits == 0)
- {
- NOTE1("Bit fields for component %d invalid", iColour);
+ if (SetBits > iMAXBITS || SetBits == 0) {
+ NOTE1("Bit fields for component %d invalid",iColour);
return FALSE;
}
@@ -2346,9 +2243,8 @@ BOOL CImageDisplay::CheckBitFields(const VIDEOINFO *pInput)
DWORD TestField = pBitFields[iColour] >> PrefixBits;
DWORD Mask = ULONG_MAX << SetBits;
- if(TestField & Mask)
- {
- NOTE1("Bit fields for component %d not contiguous", iColour);
+ if (TestField & Mask) {
+ NOTE1("Bit fields for component %d not contiguous",iColour);
return FALSE;
}
}
@@ -2367,8 +2263,7 @@ DWORD CImageDisplay::CountSetBits(DWORD Field)
// Until the input is exhausted, count the number of bits
- while(init)
- {
+ while (init) {
init = init & (init - 1); // Turn off the bottommost bit
Count++;
}
@@ -2385,17 +2280,14 @@ DWORD CImageDisplay::CountPrefixBits(DWORD Field)
DWORD Mask = 1;
DWORD Count = 0;
- while(TRUE)
- {
- if(Field & Mask)
- {
+ while (TRUE) {
+ if (Field & Mask) {
return Count;
}
Count++;
ASSERT(Mask != 0x80000000);
- if(Mask == 0x80000000)
- {
+ if (Mask == 0x80000000) {
return Count;
}
Mask <<= 1;
@@ -2414,19 +2306,16 @@ BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput)
{
// Check the bitmap width and height are not negative.
- if(pInput->bmiHeader.biWidth <= 0 ||
- pInput->bmiHeader.biHeight <= 0)
- {
+ if (pInput->bmiHeader.biWidth <= 0 ||
+ pInput->bmiHeader.biHeight <= 0) {
NOTE("Invalid bitmap dimensions");
return FALSE;
}
// Check the compression is either BI_RGB or BI_BITFIELDS
- if(pInput->bmiHeader.biCompression != BI_RGB)
- {
- if(pInput->bmiHeader.biCompression != BI_BITFIELDS)
- {
+ if (pInput->bmiHeader.biCompression != BI_RGB) {
+ if (pInput->bmiHeader.biCompression != BI_BITFIELDS) {
NOTE("Invalid compression format");
return FALSE;
}
@@ -2434,12 +2323,9 @@ BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput)
// If BI_BITFIELDS compression format check the colour depth
- if(pInput->bmiHeader.biCompression == BI_BITFIELDS)
- {
- if(pInput->bmiHeader.biBitCount != 16)
- {
- if(pInput->bmiHeader.biBitCount != 32)
- {
+ if (pInput->bmiHeader.biCompression == BI_BITFIELDS) {
+ if (pInput->bmiHeader.biBitCount != 16) {
+ if (pInput->bmiHeader.biBitCount != 32) {
NOTE("BI_BITFIELDS not 16/32 bit depth");
return FALSE;
}
@@ -2448,10 +2334,8 @@ BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput)
// Check the assumptions about the layout of the bit fields
- if(pInput->bmiHeader.biCompression == BI_BITFIELDS)
- {
- if(CheckBitFields(pInput) == FALSE)
- {
+ if (pInput->bmiHeader.biCompression == BI_BITFIELDS) {
+ if (CheckBitFields(pInput) == FALSE) {
NOTE("Bit fields are not valid");
return FALSE;
}
@@ -2459,18 +2343,15 @@ BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput)
// Are the number of planes equal to one
- if(pInput->bmiHeader.biPlanes != 1)
- {
+ if (pInput->bmiHeader.biPlanes != 1) {
NOTE("Number of planes not one");
return FALSE;
}
// Check the image size is consistent (it can be zero)
- if(pInput->bmiHeader.biSizeImage != GetBitmapSize(&pInput->bmiHeader))
- {
- if(pInput->bmiHeader.biSizeImage)
- {
+ if (pInput->bmiHeader.biSizeImage != GetBitmapSize(&pInput->bmiHeader)) {
+ if (pInput->bmiHeader.biSizeImage) {
NOTE("Image size incorrectly set");
return FALSE;
}
@@ -2478,8 +2359,7 @@ BOOL CImageDisplay::CheckHeaderValidity(const VIDEOINFO *pInput)
// Check the size of the structure
- if(pInput->bmiHeader.biSize != sizeof(BITMAPINFOHEADER))
- {
+ if (pInput->bmiHeader.biSize != sizeof(BITMAPINFOHEADER)) {
NOTE("Size of BITMAPINFOHEADER wrong");
return FALSE;
}
@@ -2496,10 +2376,8 @@ BOOL CImageDisplay::CheckPaletteHeader(const VIDEOINFO *pInput)
{
// The checks here are for palettised videos only
- if(PALETTISED(pInput) == FALSE)
- {
- if(pInput->bmiHeader.biClrUsed)
- {
+ if (PALETTISED(pInput) == FALSE) {
+ if (pInput->bmiHeader.biClrUsed) {
NOTE("Invalid palette entries");
return FALSE;
}
@@ -2508,24 +2386,21 @@ BOOL CImageDisplay::CheckPaletteHeader(const VIDEOINFO *pInput)
// Compression type of BI_BITFIELDS is meaningless for palette video
- if(pInput->bmiHeader.biCompression != BI_RGB)
- {
+ if (pInput->bmiHeader.biCompression != BI_RGB) {
NOTE("Palettised video must be BI_RGB");
return FALSE;
}
// Check the number of palette colours is correct
- if(pInput->bmiHeader.biClrUsed > PALETTE_ENTRIES(pInput))
- {
+ if (pInput->bmiHeader.biClrUsed > PALETTE_ENTRIES(pInput)) {
NOTE("Too many colours in palette");
return FALSE;
}
// The number of important colours shouldn't exceed the number used
- if(pInput->bmiHeader.biClrImportant > pInput->bmiHeader.biClrUsed)
- {
+ if (pInput->bmiHeader.biClrImportant > pInput->bmiHeader.biClrUsed) {
NOTE("Too many important colours");
return FALSE;
}
@@ -2575,10 +2450,8 @@ HRESULT CImageDisplay::UpdateFormat(__inout VIDEOINFO *pVideoInfo)
// Set the number of colours explicitly
- if(PALETTISED(pVideoInfo))
- {
- if(pVideoInfo->bmiHeader.biClrUsed == 0)
- {
+ if (PALETTISED(pVideoInfo)) {
+ if (pVideoInfo->bmiHeader.biClrUsed == 0) {
pVideoInfo->bmiHeader.biClrUsed = PALETTE_ENTRIES(pVideoInfo);
}
}
@@ -2587,15 +2460,13 @@ HRESULT CImageDisplay::UpdateFormat(__inout VIDEOINFO *pVideoInfo)
// some displays the number of important colours is not initialised when
// retrieving the display type so we set the colours used correctly
- if(pVideoInfo->bmiHeader.biClrImportant > pVideoInfo->bmiHeader.biClrUsed)
- {
+ if (pVideoInfo->bmiHeader.biClrImportant > pVideoInfo->bmiHeader.biClrUsed) {
pVideoInfo->bmiHeader.biClrImportant = PALETTE_ENTRIES(pVideoInfo);
}
// Change the image size field to be explicit
- if(pVideoInfo->bmiHeader.biSizeImage == 0)
- {
+ if (pVideoInfo->bmiHeader.biSizeImage == 0) {
pVideoInfo->bmiHeader.biSizeImage = GetBitmapSize(&pVideoInfo->bmiHeader);
}
return NOERROR;
@@ -2614,17 +2485,14 @@ HRESULT CImageDisplay::CheckVideoType(const VIDEOINFO *pInput)
{
// First of all check the VIDEOINFOHEADER looks correct
- if(CheckHeaderValidity(pInput) == FALSE)
- {
+ if (CheckHeaderValidity(pInput) == FALSE) {
return E_INVALIDARG;
}
// Virtually all devices support palettised images efficiently
- if(m_Display.bmiHeader.biBitCount == pInput->bmiHeader.biBitCount)
- {
- if(PALETTISED(pInput) == TRUE)
- {
+ if (m_Display.bmiHeader.biBitCount == pInput->bmiHeader.biBitCount) {
+ if (PALETTISED(pInput) == TRUE) {
ASSERT(PALETTISED(&m_Display) == TRUE);
NOTE("(Video) Type connection ACCEPTED");
return NOERROR;
@@ -2634,16 +2502,14 @@ HRESULT CImageDisplay::CheckVideoType(const VIDEOINFO *pInput)
// Is the display depth greater than the input format
- if(m_Display.bmiHeader.biBitCount > pInput->bmiHeader.biBitCount)
- {
+ if (m_Display.bmiHeader.biBitCount > pInput->bmiHeader.biBitCount) {
NOTE("(Video) Mismatch agreed");
return NOERROR;
}
// Is the display depth less than the input format
- if(m_Display.bmiHeader.biBitCount < pInput->bmiHeader.biBitCount)
- {
+ if (m_Display.bmiHeader.biBitCount < pInput->bmiHeader.biBitCount) {
NOTE("(Video) Format mismatch");
return E_INVALIDARG;
}
@@ -2663,10 +2529,9 @@ HRESULT CImageDisplay::CheckVideoType(const VIDEOINFO *pInput)
const DWORD *pInputMask = GetBitMasks(pInput);
const DWORD *pDisplayMask = GetBitMasks((VIDEOINFO *)&m_Display);
- if(pInputMask[iRED] != pDisplayMask[iRED] ||
- pInputMask[iGREEN] != pDisplayMask[iGREEN] ||
- pInputMask[iBLUE] != pDisplayMask[iBLUE])
- {
+ if (pInputMask[iRED] != pDisplayMask[iRED] ||
+ pInputMask[iGREEN] != pDisplayMask[iGREEN] ||
+ pInputMask[iBLUE] != pDisplayMask[iBLUE]) {
NOTE("(Video) Bit field mismatch");
return E_INVALIDARG;
@@ -2681,25 +2546,19 @@ HRESULT CImageDisplay::CheckVideoType(const VIDEOINFO *pInput)
const DWORD *CImageDisplay::GetBitMasks(const VIDEOINFO *pVideoInfo)
{
- static const DWORD FailMasks[] = {0, 0, 0};
+ static const DWORD FailMasks[] = {0,0,0};
- if(pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS)
- {
+ if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) {
return BITMASKS(pVideoInfo);
}
ASSERT(pVideoInfo->bmiHeader.biCompression == BI_RGB);
- switch(pVideoInfo->bmiHeader.biBitCount)
- {
- case 16:
- return bits555;
- case 24:
- return bits888;
- case 32:
- return bits888;
- default:
- return FailMasks;
+ switch (pVideoInfo->bmiHeader.biBitCount) {
+ case 16: return bits555;
+ case 24: return bits888;
+ case 32: return bits888;
+ default: return FailMasks;
}
}
@@ -2715,8 +2574,7 @@ HRESULT CImageDisplay::CheckMediaType(const CMediaType *pmtIn)
// Does this have a VIDEOINFOHEADER format block
const GUID *pFormatType = pmtIn->FormatType();
- if(*pFormatType != FORMAT_VideoInfo)
- {
+ if (*pFormatType != FORMAT_VideoInfo) {
NOTE("Format GUID not a VIDEOINFOHEADER");
return E_INVALIDARG;
}
@@ -2725,8 +2583,7 @@ HRESULT CImageDisplay::CheckMediaType(const CMediaType *pmtIn)
// Check the format looks reasonably ok
ULONG Length = pmtIn->FormatLength();
- if(Length < SIZE_VIDEOHEADER)
- {
+ if (Length < SIZE_VIDEOHEADER) {
NOTE("Format smaller than a VIDEOHEADER");
return E_FAIL;
}
@@ -2736,8 +2593,7 @@ HRESULT CImageDisplay::CheckMediaType(const CMediaType *pmtIn)
// Check the major type is MEDIATYPE_Video
const GUID *pMajorType = pmtIn->Type();
- if(*pMajorType != MEDIATYPE_Video)
- {
+ if (*pMajorType != MEDIATYPE_Video) {
NOTE("Major type not MEDIATYPE_Video");
return E_INVALIDARG;
}
@@ -2745,8 +2601,7 @@ HRESULT CImageDisplay::CheckMediaType(const CMediaType *pmtIn)
// Check we can identify the media subtype
const GUID *pSubType = pmtIn->Subtype();
- if(GetBitCount(pSubType) == USHRT_MAX)
- {
+ if (GetBitCount(pSubType) == USHRT_MAX) {
NOTE("Invalid video media subtype");
return E_INVALIDARG;
}
@@ -2771,8 +2626,7 @@ BOOL CImageDisplay::GetColourMask(__out DWORD *pMaskRed,
// If this format is palettised then it doesn't have bit fields
- if(m_Display.bmiHeader.biBitCount < 16)
- {
+ if (m_Display.bmiHeader.biBitCount < 16) {
return FALSE;
}
@@ -2780,8 +2634,7 @@ BOOL CImageDisplay::GetColourMask(__out DWORD *pMaskRed,
// possible colour component ranges described by a byte. It is never
// allowed for a 24 bit colour depth image to have BI_BITFIELDS set
- if(m_Display.bmiHeader.biBitCount == 24)
- {
+ if (m_Display.bmiHeader.biBitCount == 24) {
ASSERT(m_Display.bmiHeader.biCompression == BI_RGB);
return TRUE;
}
@@ -2795,8 +2648,7 @@ BOOL CImageDisplay::GetColourMask(__out DWORD *pMaskRed,
// bits set in the mask and that they are all contiguous. All that
// therefore remains is to shift them into the correct position
- for(INT iColour = iRED; iColour <= iBLUE; iColour++)
- {
+ for (INT iColour = iRED;iColour <= iBLUE;iColour++) {
// This works out how many bits there are and where they live
@@ -2818,24 +2670,20 @@ BOOL CImageDisplay::GetColourMask(__out DWORD *pMaskRed,
*/
STDAPI ConvertVideoInfoToVideoInfo2(__inout AM_MEDIA_TYPE *pmt)
{
- if(pmt->formattype != FORMAT_VideoInfo)
- {
+ if (pmt->formattype != FORMAT_VideoInfo) {
return E_INVALIDARG;
}
- if(NULL == pmt->pbFormat || pmt->cbFormat < sizeof(VIDEOINFOHEADER))
- {
+ if (NULL == pmt->pbFormat || pmt->cbFormat < sizeof(VIDEOINFOHEADER)) {
return E_INVALIDARG;
}
VIDEOINFO *pVideoInfo = (VIDEOINFO *)pmt->pbFormat;
DWORD dwNewSize;
HRESULT hr = DWordAdd(pmt->cbFormat, sizeof(VIDEOINFOHEADER2) - sizeof(VIDEOINFOHEADER), &dwNewSize);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
PVOID pvNew = CoTaskMemAlloc(dwNewSize);
- if(pvNew == NULL)
- {
+ if (pvNew == NULL) {
return E_OUTOFMEMORY;
}
CopyMemory(pvNew, pmt->pbFormat, FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader));
@@ -2858,21 +2706,18 @@ STDAPI ConvertVideoInfoToVideoInfo2(__inout AM_MEDIA_TYPE *pmt)
// Check a media type containing VIDEOINFOHEADER
STDAPI CheckVideoInfoType(const AM_MEDIA_TYPE *pmt)
{
- if(NULL == pmt || NULL == pmt->pbFormat)
- {
+ if (NULL == pmt || NULL == pmt->pbFormat) {
return E_POINTER;
}
- if(pmt->majortype != MEDIATYPE_Video ||
- pmt->formattype != FORMAT_VideoInfo ||
- pmt->cbFormat < sizeof(VIDEOINFOHEADER))
- {
+ if (pmt->majortype != MEDIATYPE_Video ||
+ pmt->formattype != FORMAT_VideoInfo ||
+ pmt->cbFormat < sizeof(VIDEOINFOHEADER)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
const VIDEOINFOHEADER *pHeader = (const VIDEOINFOHEADER *)pmt->pbFormat;
- if(!ValidateBitmapInfoHeader(
- &pHeader->bmiHeader,
- pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader)))
- {
+ if (!ValidateBitmapInfoHeader(
+ &pHeader->bmiHeader,
+ pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
@@ -2882,21 +2727,18 @@ STDAPI CheckVideoInfoType(const AM_MEDIA_TYPE *pmt)
// Check a media type containing VIDEOINFOHEADER2
STDAPI CheckVideoInfo2Type(const AM_MEDIA_TYPE *pmt)
{
- if(NULL == pmt || NULL == pmt->pbFormat)
- {
+ if (NULL == pmt || NULL == pmt->pbFormat) {
return E_POINTER;
- }
- if(pmt->majortype != MEDIATYPE_Video ||
- pmt->formattype != FORMAT_VideoInfo2 ||
- pmt->cbFormat < sizeof(VIDEOINFOHEADER2))
- {
+ }
+ if (pmt->majortype != MEDIATYPE_Video ||
+ pmt->formattype != FORMAT_VideoInfo2 ||
+ pmt->cbFormat < sizeof(VIDEOINFOHEADER2)) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
const VIDEOINFOHEADER2 *pHeader = (const VIDEOINFOHEADER2 *)pmt->pbFormat;
- if(!ValidateBitmapInfoHeader(
- &pHeader->bmiHeader,
- pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader)))
- {
+ if (!ValidateBitmapInfoHeader(
+ &pHeader->bmiHeader,
+ pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader))) {
return VFW_E_TYPE_NOT_ACCEPTED;
}
diff --git a/src/filters/BaseClasses/winutil.h b/src/filters/BaseClasses/winutil.h
index e277ac458..27358f9fd 100644
--- a/src/filters/BaseClasses/winutil.h
+++ b/src/filters/BaseClasses/winutil.h
@@ -25,7 +25,7 @@ const int PROFILESTR = 128; // Normal profile string
const WORD PALVERSION = 0x300; // GDI palette version
const LONG PALETTE_VERSION = (LONG) 1; // Initial palette version
const COLORREF VIDEO_COLOUR = 0; // Defaults to black background
-const HANDLE hMEMORY = (HANDLE)(-1); // Says to open as memory file
+const HANDLE hMEMORY = (HANDLE) (-1); // Says to open as memory file
#define WIDTH(x) ((*(x)).right - (*(x)).left)
#define HEIGHT(x) ((*(x)).bottom - (*(x)).top)
@@ -59,8 +59,8 @@ protected:
BOOL m_bDoGetDC; // Should this window get a DC
bool m_bDoPostToDestroy; // Use PostMessage to destroy
CCritSec m_PaletteLock; // This lock protects m_hPalette.
- // It should be held anytime the
- // program use the value of m_hPalette.
+ // It should be held anytime the
+ // program use the value of m_hPalette.
// Maps windows message procedure into C++ methods
friend LRESULT CALLBACK WndProc(HWND hwnd, // Window handle
@@ -110,9 +110,7 @@ public:
void UnlockPaletteLock();
virtual BOOL PossiblyEatMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- return FALSE;
- };
+ { return FALSE; };
// Access our window information
@@ -123,9 +121,9 @@ public:
HDC GetMemoryHDC();
HDC GetWindowHDC();
-#ifdef _DEBUG
+ #ifdef _DEBUG
HPALETTE GetPalette();
-#endif // DEBUG
+ #endif // DEBUG
// This is the window procedure the derived object should override
@@ -137,9 +135,9 @@ public:
// Must be overriden to return class and window styles
virtual LPTSTR GetClassWindowStyles(
- __out DWORD *pClassStyles, // Class styles
- __out DWORD *pWindowStyles, // Window styles
- __out DWORD *pWindowStylesEx) PURE; // Extended styles
+ __out DWORD *pClassStyles, // Class styles
+ __out DWORD *pWindowStyles, // Window styles
+ __out DWORD *pWindowStylesEx) PURE; // Extended styles
};
@@ -182,7 +180,7 @@ protected:
void SlowRender(IMediaSample *pMediaSample);
void FastRender(IMediaSample *pMediaSample);
void DisplaySampleTimes(IMediaSample *pSample);
- void UpdateColourTable(HDC hdc, __in BITMAPINFOHEADER *pbmi);
+ void UpdateColourTable(HDC hdc,__in BITMAPINFOHEADER *pbmi);
void SetStretchMode();
public:
@@ -214,15 +212,13 @@ public:
// Called when we are about to draw an image
- void NotifyStartDraw()
- {
+ void NotifyStartDraw() {
MSR_START(m_perfidRenderTime);
};
// Called when we complete an image rendering
- void NotifyEndDraw()
- {
+ void NotifyEndDraw() {
MSR_STOP(m_perfidRenderTime);
};
};
@@ -232,8 +228,7 @@ public:
// samples we create from our allocator will have a DIBSECTION allocated to
// them. When we receive the sample we know we can BitBlt straight to an HDC
-typedef struct tagDIBDATA
-{
+typedef struct tagDIBDATA {
LONG PaletteVersion; // Current palette version in use
DIBSECTION DibSection; // Details of DIB section allocated
@@ -295,15 +290,15 @@ protected:
// Manage the shared DIBSECTION and DCI/DirectDraw buffers
- HRESULT CreateDIB(LONG InSize, DIBDATA &DibData);
+ HRESULT CreateDIB(LONG InSize,DIBDATA &DibData);
STDMETHODIMP CheckSizes(__in ALLOCATOR_PROPERTIES *pRequest);
- virtual CImageSample *CreateImageSample(__in_bcount(Length) LPBYTE pData, LONG Length);
+ virtual CImageSample *CreateImageSample(__in_bcount(Length) LPBYTE pData,LONG Length);
public:
// Constructor and destructor
- CImageAllocator(__inout CBaseFilter *pFilter, __in_opt LPCTSTR pName, __inout HRESULT *phr);
+ CImageAllocator(__inout CBaseFilter *pFilter,__in_opt LPCTSTR pName,__inout HRESULT *phr);
#ifdef _DEBUG
~CImageAllocator();
#endif
@@ -350,14 +345,14 @@ public:
static HPALETTE MakePalette(const VIDEOINFOHEADER *pVideoInfo, __in LPSTR szDevice);
HRESULT RemovePalette();
- static HRESULT MakeIdentityPalette(__inout_ecount_full(iColours) PALETTEENTRY *pEntry, INT iColours, __in LPSTR szDevice);
- HRESULT CopyPalette(const CMediaType *pSrc, __out CMediaType *pDest);
- BOOL ShouldUpdate(const VIDEOINFOHEADER *pNewInfo, const VIDEOINFOHEADER *pOldInfo);
- HRESULT PreparePalette(const CMediaType *pmtNew, const CMediaType *pmtOld, __in LPSTR szDevice);
+ static HRESULT MakeIdentityPalette(__inout_ecount_full(iColours) PALETTEENTRY *pEntry,INT iColours, __in LPSTR szDevice);
+ HRESULT CopyPalette(const CMediaType *pSrc,__out CMediaType *pDest);
+ BOOL ShouldUpdate(const VIDEOINFOHEADER *pNewInfo,const VIDEOINFOHEADER *pOldInfo);
+ HRESULT PreparePalette(const CMediaType *pmtNew,const CMediaType *pmtOld,__in LPSTR szDevice);
BOOL DrawVideoImageHere(HDC hdc, IMediaSample *pMediaSample, __in LPRECT lprcSrc, __in LPRECT lprcDst)
{
- return m_pDrawImage->DrawVideoImageHere(hdc, pMediaSample, lprcSrc, lprcDst);
+ return m_pDrawImage->DrawVideoImageHere(hdc, pMediaSample, lprcSrc,lprcDst);
}
};
diff --git a/src/filters/BaseClasses/wxdebug.cpp b/src/filters/BaseClasses/wxdebug.cpp
index 5ac541b87..d6aa59802 100644
--- a/src/filters/BaseClasses/wxdebug.cpp
+++ b/src/filters/BaseClasses/wxdebug.cpp
@@ -41,8 +41,7 @@ const INT iDEBUGINFO = 1024; // Used to format strings
HKEY_LOCAL_MACHINE\SOFTWARE\Debug\<Module Name>\<KeyName> key values
NOTE these must be in the same order as their enumeration definition */
-const LPCTSTR pKeyNames[] =
-{
+const LPCTSTR pKeyNames[] = {
TEXT("TIMING"), // Timing and performance measurements
TEXT("TRACE"), // General step point call tracing
TEXT("MEMORY"), // Memory and object allocation/destruction
@@ -53,7 +52,7 @@ const LPCTSTR pKeyNames[] =
TEXT("CUSTOM3"),
TEXT("CUSTOM4"),
TEXT("CUSTOM5")
-};
+ };
const TCHAR CAutoTrace::_szEntering[] = TEXT("->: %s");
const TCHAR CAutoTrace::_szLeaving[] = TEXT("<-: %s");
@@ -91,8 +90,8 @@ void WINAPI DbgInitialise(HINSTANCE hInst)
m_hInst = hInst;
DbgInitModuleName();
- if(GetProfileInt(m_ModuleName, TEXT("BreakOnLoad"), 0))
- DebugBreak();
+ if (GetProfileInt(m_ModuleName, TEXT("BreakOnLoad"), 0))
+ DebugBreak();
DbgInitModuleSettings(false);
DbgInitGlobalSettings(true);
dwTimeOffset = timeGetTime();
@@ -107,10 +106,9 @@ void WINAPI DbgInitialise(HINSTANCE hInst)
void WINAPI DbgTerminate()
{
- if(m_hOutput != INVALID_HANDLE_VALUE)
- {
- EXECUTE_ASSERT(CloseHandle(m_hOutput));
- m_hOutput = INVALID_HANDLE_VALUE;
+ if (m_hOutput != INVALID_HANDLE_VALUE) {
+ EXECUTE_ASSERT(CloseHandle(m_hOutput));
+ m_hOutput = INVALID_HANDLE_VALUE;
}
DeleteCriticalSection(&m_CSDebug);
m_bInit = FALSE;
@@ -129,48 +127,44 @@ void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax)
DWORD dwKeyValue; // This fields value
/* Try and read a value for each key position in turn */
- for(lKeyPos = 0; lKeyPos < iMAXLEVELS; lKeyPos++)
- {
+ for (lKeyPos = 0;lKeyPos < iMAXLEVELS;lKeyPos++) {
dwKeySize = sizeof(DWORD);
lReturn = RegQueryValueEx(
- hKey, // Handle to an open key
- pKeyNames[lKeyPos], // Subkey name derivation
- NULL, // Reserved field
- &dwKeyType, // Returns the field type
- (LPBYTE) &dwKeyValue, // Returns the field's value
- &dwKeySize); // Number of bytes transferred
+ hKey, // Handle to an open key
+ pKeyNames[lKeyPos], // Subkey name derivation
+ NULL, // Reserved field
+ &dwKeyType, // Returns the field type
+ (LPBYTE) &dwKeyValue, // Returns the field's value
+ &dwKeySize ); // Number of bytes transferred
/* If either the key was not available or it was not a DWORD value
then we ensure only the high priority debug logging is output
but we try and update the field to a zero filled DWORD value */
- if(lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD)
- {
+ if (lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD) {
dwKeyValue = 0;
lReturn = RegSetValueEx(
- hKey, // Handle of an open key
- pKeyNames[lKeyPos], // Address of subkey name
- (DWORD) 0, // Reserved field
- REG_DWORD, // Type of the key field
- (PBYTE) &dwKeyValue, // Value for the field
- sizeof(DWORD)); // Size of the field buffer
-
- if(lReturn != ERROR_SUCCESS)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Could not create subkey %s"), pKeyNames[lKeyPos]));
+ hKey, // Handle of an open key
+ pKeyNames[lKeyPos], // Address of subkey name
+ (DWORD) 0, // Reserved field
+ REG_DWORD, // Type of the key field
+ (PBYTE) &dwKeyValue, // Value for the field
+ sizeof(DWORD)); // Size of the field buffer
+
+ if (lReturn != ERROR_SUCCESS) {
+ DbgLog((LOG_ERROR,1,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos]));
dwKeyValue = 0;
}
}
if(fTakeMax)
{
- m_Levels[lKeyPos] = max(dwKeyValue, m_Levels[lKeyPos]);
+ m_Levels[lKeyPos] = max(dwKeyValue,m_Levels[lKeyPos]);
}
else
{
- if((m_Levels[lKeyPos] & LOG_FORCIBLY_SET) == 0)
- {
+ if((m_Levels[lKeyPos] & LOG_FORCIBLY_SET) == 0) {
m_Levels[lKeyPos] = dwKeyValue;
}
}
@@ -179,32 +173,30 @@ void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax)
/* Read the timeout value for catching hangs */
dwKeySize = sizeof(DWORD);
lReturn = RegQueryValueEx(
- hKey, // Handle to an open key
- TimeoutName, // Subkey name derivation
- NULL, // Reserved field
- &dwKeyType, // Returns the field type
- (LPBYTE) &dwWaitTimeout, // Returns the field's value
- &dwKeySize); // Number of bytes transferred
+ hKey, // Handle to an open key
+ TimeoutName, // Subkey name derivation
+ NULL, // Reserved field
+ &dwKeyType, // Returns the field type
+ (LPBYTE) &dwWaitTimeout, // Returns the field's value
+ &dwKeySize ); // Number of bytes transferred
/* If either the key was not available or it was not a DWORD value
then we ensure only the high priority debug logging is output
but we try and update the field to a zero filled DWORD value */
- if(lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD)
- {
+ if (lReturn != ERROR_SUCCESS || dwKeyType != REG_DWORD) {
dwWaitTimeout = INFINITE;
lReturn = RegSetValueEx(
- hKey, // Handle of an open key
- TimeoutName, // Address of subkey name
- (DWORD) 0, // Reserved field
- REG_DWORD, // Type of the key field
- (PBYTE) &dwWaitTimeout, // Value for the field
- sizeof(DWORD)); // Size of the field buffer
-
- if(lReturn != ERROR_SUCCESS)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Could not create subkey %s"), pKeyNames[lKeyPos]));
+ hKey, // Handle of an open key
+ TimeoutName, // Address of subkey name
+ (DWORD) 0, // Reserved field
+ REG_DWORD, // Type of the key field
+ (PBYTE) &dwWaitTimeout, // Value for the field
+ sizeof(DWORD)); // Size of the field buffer
+
+ if (lReturn != ERROR_SUCCESS) {
+ DbgLog((LOG_ERROR,1,TEXT("Could not create subkey %s"),pKeyNames[lKeyPos]));
dwWaitTimeout = INFINITE;
}
}
@@ -212,21 +204,18 @@ void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax)
void WINAPI DbgOutString(LPCTSTR psz)
{
- if(m_hOutput != INVALID_HANDLE_VALUE)
- {
+ if (m_hOutput != INVALID_HANDLE_VALUE) {
UINT cb = lstrlen(psz);
DWORD dw;
#ifdef UNICODE
CHAR szDest[2048];
WideCharToMultiByte(CP_ACP, 0, psz, -1, szDest, NUMELMS(szDest), 0, 0);
- WriteFile(m_hOutput, szDest, cb, &dw, NULL);
+ WriteFile (m_hOutput, szDest, cb, &dw, NULL);
#else
- WriteFile(m_hOutput, psz, cb, &dw, NULL);
+ WriteFile (m_hOutput, psz, cb, &dw, NULL);
#endif
- }
- else
- {
- OutputDebugString(psz);
+ } else {
+ OutputDebugString (psz);
}
}
@@ -240,19 +229,19 @@ HRESULT DbgUniqueProcessName(LPCTSTR inName, LPTSTR outName)
int dotPos = -1;
//scan the input and record the last '.' position
- while(*pIn && (pIn - inName) < MAX_PATH)
+ while (*pIn && (pIn - inName) < MAX_PATH)
{
- if(TEXT('.') == *pIn)
- dotPos = (int)(pIn - inName);
+ if ( TEXT('.') == *pIn )
+ dotPos = (int)(pIn-inName);
++pIn;
}
- if(*pIn) //input should be zero-terminated within MAX_PATH
+ if (*pIn) //input should be zero-terminated within MAX_PATH
return E_INVALIDARG;
DWORD dwProcessId = GetCurrentProcessId();
- if(dotPos < 0)
+ if (dotPos < 0)
{
//no extension in the input, appending process id to the input
hr = StringCchPrintf(outName, MAX_PATH, TEXT("%s_%d"), inName, dwProcessId);
@@ -260,12 +249,12 @@ HRESULT DbgUniqueProcessName(LPCTSTR inName, LPTSTR outName)
else
{
TCHAR pathAndBasename[_MAX_PATH] = {0};
-
+
//there's an extension - zero-terminate the path and basename first by copying
hr = StringCchCopyN(pathAndBasename, MAX_PATH, inName, (size_t)dotPos);
//re-combine path, basename and extension with processId appended to a basename
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
hr = StringCchPrintf(outName, MAX_PATH, TEXT("%s_%d%s"), pathAndBasename, dwProcessId, inName + dotPos);
}
@@ -276,7 +265,7 @@ HRESULT DbgUniqueProcessName(LPCTSTR inName, LPTSTR outName)
/* Called by DbgInitGlobalSettings to setup alternate logging destinations
*/
-void WINAPI DbgInitLogTo(
+void WINAPI DbgInitLogTo (
HKEY hKey)
{
LONG lReturn;
@@ -287,79 +276,75 @@ void WINAPI DbgInitLogTo(
dwKeySize = MAX_PATH;
lReturn = RegQueryValueEx(
- hKey, // Handle to an open key
- cszKey, // Subkey name derivation
- NULL, // Reserved field
- &dwKeyType, // Returns the field type
- (LPBYTE) szFile, // Returns the field's value
- &dwKeySize); // Number of bytes transferred
+ hKey, // Handle to an open key
+ cszKey, // Subkey name derivation
+ NULL, // Reserved field
+ &dwKeyType, // Returns the field type
+ (LPBYTE) szFile, // Returns the field's value
+ &dwKeySize); // Number of bytes transferred
// create an empty key if it does not already exist
//
- if(lReturn != ERROR_SUCCESS || dwKeyType != REG_SZ)
- {
- dwKeySize = sizeof(TCHAR);
- lReturn = RegSetValueEx(
- hKey, // Handle of an open key
- cszKey, // Address of subkey name
- (DWORD) 0, // Reserved field
- REG_SZ, // Type of the key field
- (PBYTE)szFile, // Value for the field
- dwKeySize); // Size of the field buffer
- }
+ if (lReturn != ERROR_SUCCESS || dwKeyType != REG_SZ)
+ {
+ dwKeySize = sizeof(TCHAR);
+ lReturn = RegSetValueEx(
+ hKey, // Handle of an open key
+ cszKey, // Address of subkey name
+ (DWORD) 0, // Reserved field
+ REG_SZ, // Type of the key field
+ (PBYTE)szFile, // Value for the field
+ dwKeySize); // Size of the field buffer
+ }
// if an output-to was specified. try to open it.
//
- if(m_hOutput != INVALID_HANDLE_VALUE)
- {
- EXECUTE_ASSERT(CloseHandle(m_hOutput));
- m_hOutput = INVALID_HANDLE_VALUE;
- }
- if(szFile[0] != 0)
- {
- if(!lstrcmpi(szFile, TEXT("Console")))
- {
- m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- if(m_hOutput == INVALID_HANDLE_VALUE)
- {
- AllocConsole();
- m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- }
- SetConsoleTitle(TEXT("ActiveX Debug Output"));
- }
- else if(szFile[0] &&
+ if (m_hOutput != INVALID_HANDLE_VALUE) {
+ EXECUTE_ASSERT(CloseHandle (m_hOutput));
+ m_hOutput = INVALID_HANDLE_VALUE;
+ }
+ if (szFile[0] != 0)
+ {
+ if (!lstrcmpi(szFile, TEXT("Console"))) {
+ m_hOutput = GetStdHandle (STD_OUTPUT_HANDLE);
+ if (m_hOutput == INVALID_HANDLE_VALUE) {
+ AllocConsole ();
+ m_hOutput = GetStdHandle (STD_OUTPUT_HANDLE);
+ }
+ SetConsoleTitle (TEXT("ActiveX Debug Output"));
+ } else if (szFile[0] &&
lstrcmpi(szFile, TEXT("Debug")) &&
lstrcmpi(szFile, TEXT("Debugger")) &&
lstrcmpi(szFile, TEXT("Deb")))
- {
+ {
m_hOutput = CreateFile(szFile, GENERIC_WRITE,
- FILE_SHARE_READ,
- NULL, OPEN_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
+ FILE_SHARE_READ,
+ NULL, OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
- if(INVALID_HANDLE_VALUE == m_hOutput &&
- GetLastError() == ERROR_SHARING_VIOLATION)
+ if (INVALID_HANDLE_VALUE == m_hOutput &&
+ GetLastError() == ERROR_SHARING_VIOLATION)
{
- TCHAR uniqueName[_MAX_PATH] = {0};
- if(SUCCEEDED(DbgUniqueProcessName(szFile, uniqueName)))
- {
+ TCHAR uniqueName[_MAX_PATH] = {0};
+ if (SUCCEEDED(DbgUniqueProcessName(szFile, uniqueName)))
+ {
m_hOutput = CreateFile(uniqueName, GENERIC_WRITE,
- FILE_SHARE_READ,
- NULL, OPEN_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- }
+ FILE_SHARE_READ,
+ NULL, OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ }
}
-
- if(INVALID_HANDLE_VALUE != m_hOutput)
+
+ if (INVALID_HANDLE_VALUE != m_hOutput)
{
- static const TCHAR cszBar[] = TEXT("\r\n\r\n=====DbgInitialize()=====\r\n\r\n");
- SetFilePointer(m_hOutput, 0, NULL, FILE_END);
- DbgOutString(cszBar);
+ static const TCHAR cszBar[] = TEXT("\r\n\r\n=====DbgInitialize()=====\r\n\r\n");
+ SetFilePointer (m_hOutput, 0, NULL, FILE_END);
+ DbgOutString (cszBar);
}
- }
- }
+ }
+ }
}
@@ -376,7 +361,7 @@ void WINAPI DbgInitGlobalSettings(bool fTakeMax)
HKEY hGlobalKey; // Global override key
/* Construct the global base key name */
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%s\\%s"), pBaseKey, pGlobalKey);
+ (void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%s\\%s"),pBaseKey,pGlobalKey);
/* Create or open the key for this module */
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
@@ -389,8 +374,7 @@ void WINAPI DbgInitGlobalSettings(bool fTakeMax)
&hGlobalKey, // Opened handle buffer
NULL); // What really happened
- if(lReturn != ERROR_SUCCESS)
- {
+ if (lReturn != ERROR_SUCCESS) {
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
szInfo, // Address of subkey name
(DWORD) 0, // Reserved value
@@ -400,9 +384,8 @@ void WINAPI DbgInitGlobalSettings(bool fTakeMax)
NULL, // Key security descriptor
&hGlobalKey, // Opened handle buffer
NULL); // What really happened
- if(lReturn != ERROR_SUCCESS)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Could not access GLOBAL module key")));
+ if (lReturn != ERROR_SUCCESS) {
+ DbgLog((LOG_ERROR,1,TEXT("Could not access GLOBAL module key")));
}
return;
}
@@ -425,7 +408,7 @@ void WINAPI DbgInitModuleSettings(bool fTakeMax)
HKEY hModuleKey; // Module key handle
/* Construct the base key name */
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%s\\%s"), pBaseKey, m_ModuleName);
+ (void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%s\\%s"),pBaseKey,m_ModuleName);
/* Create or open the key for this module */
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
@@ -438,8 +421,7 @@ void WINAPI DbgInitModuleSettings(bool fTakeMax)
&hModuleKey, // Opened handle buffer
NULL); // What really happened
- if(lReturn != ERROR_SUCCESS)
- {
+ if (lReturn != ERROR_SUCCESS) {
lReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Handle of an open key
szInfo, // Address of subkey name
(DWORD) 0, // Reserved value
@@ -449,9 +431,8 @@ void WINAPI DbgInitModuleSettings(bool fTakeMax)
NULL, // Key security descriptor
&hModuleKey, // Opened handle buffer
NULL); // What really happened
- if(lReturn != ERROR_SUCCESS)
- {
- DbgLog((LOG_ERROR, 1, TEXT("Could not access module key")));
+ if (lReturn != ERROR_SUCCESS) {
+ DbgLog((LOG_ERROR,1,TEXT("Could not access module key")));
}
return;
}
@@ -469,17 +450,14 @@ void WINAPI DbgInitModuleName()
TCHAR FullName[iDEBUGINFO]; // Load the full path and module name
LPTSTR pName; // Searches from the end for a backslash
- GetModuleFileName(m_hInst, FullName, iDEBUGINFO);
- pName = _tcsrchr(FullName, '\\');
- if(pName == NULL)
- {
+ GetModuleFileName(m_hInst,FullName,iDEBUGINFO);
+ pName = _tcsrchr(FullName,'\\');
+ if (pName == NULL) {
pName = FullName;
- }
- else
- {
+ } else {
pName++;
}
- (void)StringCchCopy(m_ModuleName, NUMELMS(m_ModuleName), pName);
+ (void)StringCchCopy(m_ModuleName,NUMELMS(m_ModuleName), pName);
}
struct MsgBoxMsg
@@ -496,15 +474,15 @@ struct MsgBoxMsg
// random threads at bad times can confuse the host (eg IE).
//
DWORD WINAPI MsgBoxThread(
- __inout LPVOID lpParameter // thread data
-)
+ __inout LPVOID lpParameter // thread data
+ )
{
MsgBoxMsg *pmsg = (MsgBoxMsg *)lpParameter;
pmsg->iResult = MessageBox(
- pmsg->hwnd,
- pmsg->szTitle,
- pmsg->szMessage,
- pmsg->dwFlags);
+ pmsg->hwnd,
+ pmsg->szTitle,
+ pmsg->szMessage,
+ pmsg->dwFlags);
return 0;
}
@@ -528,12 +506,12 @@ INT MessageBoxOtherThread(
MsgBoxMsg msg = {hwnd, szTitle, szMessage, dwFlags, 0};
DWORD dwid;
HANDLE hThread = CreateThread(
- 0, // security
- 0, // stack size
- MsgBoxThread,
- (void *)&msg, // arg
- 0, // flags
- &dwid);
+ 0, // security
+ 0, // stack size
+ MsgBoxThread,
+ (void *)&msg, // arg
+ 0, // flags
+ &dwid);
if(hThread)
{
WaitForSingleObject(hThread, INFINITE);
@@ -548,7 +526,7 @@ INT MessageBoxOtherThread(
/* Displays a message box if the condition evaluated to FALSE */
-void WINAPI DbgAssert(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine)
+void WINAPI DbgAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@@ -559,35 +537,35 @@ void WINAPI DbgAssert(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine)
TCHAR szInfo[iDEBUGINFO];
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
- pCondition, iLine, pFileName);
+ (void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
+ pCondition, iLine, pFileName);
- INT MsgId = MessageBoxOtherThread(NULL, szInfo, TEXT("ASSERT Failed"),
+ INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"),
MB_SYSTEMMODAL |
MB_ICONHAND |
MB_YESNOCANCEL |
MB_SETFOREGROUND);
- switch(MsgId)
+ switch (MsgId)
{
- case IDNO: /* Kill the application */
+ case IDNO: /* Kill the application */
- FatalAppExit(FALSE, TEXT("Application terminated"));
- break;
+ FatalAppExit(FALSE, TEXT("Application terminated"));
+ break;
- case IDCANCEL: /* Break into the debugger */
+ case IDCANCEL: /* Break into the debugger */
- DebugBreak();
- break;
+ DebugBreak();
+ break;
- case IDYES: /* Ignore assertion continue execution */
- break;
+ case IDYES: /* Ignore assertion continue execution */
+ break;
}
}
}
/* Displays a message box at a break point */
-void WINAPI DbgBreakPoint(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine)
+void WINAPI DbgBreakPoint(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@@ -597,33 +575,33 @@ void WINAPI DbgBreakPoint(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine)
{
TCHAR szInfo[iDEBUGINFO];
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
- pCondition, iLine, pFileName);
+ (void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
+ pCondition, iLine, pFileName);
- INT MsgId = MessageBoxOtherThread(NULL, szInfo, TEXT("Hard coded break point"),
+ INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("Hard coded break point"),
MB_SYSTEMMODAL |
MB_ICONHAND |
MB_YESNOCANCEL |
MB_SETFOREGROUND);
- switch(MsgId)
+ switch (MsgId)
{
- case IDNO: /* Kill the application */
+ case IDNO: /* Kill the application */
- FatalAppExit(FALSE, TEXT("Application terminated"));
- break;
+ FatalAppExit(FALSE, TEXT("Application terminated"));
+ break;
- case IDCANCEL: /* Break into the debugger */
+ case IDCANCEL: /* Break into the debugger */
- DebugBreak();
- break;
+ DebugBreak();
+ break;
- case IDYES: /* Ignore break point continue execution */
- break;
+ case IDYES: /* Ignore break point continue execution */
+ break;
}
}
}
-void WINAPI DbgBreakPoint(LPCTSTR pFileName, INT iLine, __format_string LPCTSTR szFormatString, ...)
+void WINAPI DbgBreakPoint(LPCTSTR pFileName,INT iLine,__format_string LPCTSTR szFormatString,...)
{
// A debug break point message can have at most 2000 characters if
// ANSI or UNICODE characters are being used. A debug break point message
@@ -635,19 +613,18 @@ void WINAPI DbgBreakPoint(LPCTSTR pFileName, INT iLine, __format_string LPCTSTR
TCHAR szBreakPointMessage[MAX_BREAK_POINT_MESSAGE_SIZE];
va_list va;
- va_start(va, szFormatString);
+ va_start( va, szFormatString );
- HRESULT hr = StringCchVPrintf(szBreakPointMessage, NUMELMS(szBreakPointMessage), szFormatString, va);
+ HRESULT hr = StringCchVPrintf( szBreakPointMessage, NUMELMS(szBreakPointMessage), szFormatString, va );
va_end(va);
- if(FAILED(hr))
- {
- DbgBreak("ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because StringCchVPrintf() failed.");
+ if( FAILED(hr) ) {
+ DbgBreak( "ERROR in DbgBreakPoint(). The variable length debug message could not be displayed because StringCchVPrintf() failed." );
return;
}
- ::DbgBreakPoint(szBreakPointMessage, pFileName, iLine);
+ ::DbgBreakPoint( szBreakPointMessage, pFileName, iLine );
}
@@ -664,7 +641,7 @@ void WINAPI DbgBreakPoint(LPCTSTR pFileName, INT iLine, __format_string LPCTSTR
*/
-BOOL WINAPI DbgCheckModuleLevel(DWORD Type, DWORD Level)
+BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level)
{
if(g_fAutoRefreshLevels)
{
@@ -672,8 +649,7 @@ BOOL WINAPI DbgCheckModuleLevel(DWORD Type, DWORD Level)
// notice registry changes because it's not available on win9x.
static DWORD g_dwLastRefresh = 0;
DWORD dwTime = timeGetTime();
- if(dwTime - g_dwLastRefresh > 1000)
- {
+ if(dwTime - g_dwLastRefresh > 1000) {
g_dwLastRefresh = dwTime;
// there's a race condition: multiple threads could update the
@@ -687,19 +663,15 @@ BOOL WINAPI DbgCheckModuleLevel(DWORD Type, DWORD Level)
DWORD Mask = 0x01;
// If no valid bits are set return FALSE
- if((Type & ((1 << iMAXLEVELS) - 1)))
- {
-
- // speed up unconditional output.
- if(0 == Level)
- return(TRUE);
-
- for(LONG lKeyPos = 0; lKeyPos < iMAXLEVELS; lKeyPos++)
- {
- if(Type & Mask)
- {
- if(Level <= (m_Levels[lKeyPos] & ~LOG_FORCIBLY_SET))
- {
+ if ((Type & ((1<<iMAXLEVELS)-1))) {
+
+ // speed up unconditional output.
+ if (0==Level)
+ return(TRUE);
+
+ for (LONG lKeyPos = 0;lKeyPos < iMAXLEVELS;lKeyPos++) {
+ if (Type & Mask) {
+ if (Level <= (m_Levels[lKeyPos] & ~LOG_FORCIBLY_SET)) {
return TRUE;
}
}
@@ -716,10 +688,8 @@ void WINAPI DbgSetModuleLevel(DWORD Type, DWORD Level)
{
DWORD Mask = 0x01;
- for(LONG lKeyPos = 0; lKeyPos < iMAXLEVELS; lKeyPos++)
- {
- if(Type & Mask)
- {
+ for (LONG lKeyPos = 0;lKeyPos < iMAXLEVELS;lKeyPos++) {
+ if (Type & Mask) {
m_Levels[lKeyPos] = Level | LOG_FORCIBLY_SET;
}
Mask <<= 1;
@@ -738,13 +708,12 @@ void WINAPI DbgSetAutoRefreshLevels(bool fAuto)
// warning -- this function is implemented twice for ansi applications
// linking to the unicode library
//
-void WINAPI DbgLogInfo(DWORD Type, DWORD Level, __format_string LPCSTR pFormat, ...)
+void WINAPI DbgLogInfo(DWORD Type,DWORD Level,__format_string LPCSTR pFormat,...)
{
/* Check the current level for this type combination */
- BOOL bAccept = DbgCheckModuleLevel(Type, Level);
- if(bAccept == FALSE)
- {
+ BOOL bAccept = DbgCheckModuleLevel(Type,Level);
+ if (bAccept == FALSE) {
return;
}
@@ -756,9 +725,9 @@ void WINAPI DbgLogInfo(DWORD Type, DWORD Level, __format_string LPCSTR pFormat,
va_start(va, pFormat);
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),
- TEXT("%s(tid %x) %8d : "),
- m_ModuleName,
- GetCurrentThreadId(), timeGetTime() - dwTimeOffset);
+ TEXT("%s(tid %x) %8d : "),
+ m_ModuleName,
+ GetCurrentThreadId(), timeGetTime() - dwTimeOffset);
CHAR szInfoA[2000];
WideCharToMultiByte(CP_ACP, 0, szInfo, -1, szInfoA, NUMELMS(szInfoA), 0, 0);
@@ -773,7 +742,7 @@ void WINAPI DbgLogInfo(DWORD Type, DWORD Level, __format_string LPCSTR pFormat,
va_end(va);
}
-void WINAPI DbgAssert(LPCSTR pCondition, LPCSTR pFileName, INT iLine)
+void WINAPI DbgAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@@ -785,34 +754,34 @@ void WINAPI DbgAssert(LPCSTR pCondition, LPCSTR pFileName, INT iLine)
TCHAR szInfo[iDEBUGINFO];
(void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%hs \nAt line %d of %hs\nContinue? (Cancel to debug)"),
- pCondition, iLine, pFileName);
+ pCondition, iLine, pFileName);
- INT MsgId = MessageBoxOtherThread(NULL, szInfo, TEXT("ASSERT Failed"),
+ INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"),
MB_SYSTEMMODAL |
MB_ICONHAND |
MB_YESNOCANCEL |
MB_SETFOREGROUND);
- switch(MsgId)
+ switch (MsgId)
{
- case IDNO: /* Kill the application */
+ case IDNO: /* Kill the application */
- FatalAppExit(FALSE, TEXT("Application terminated"));
- break;
+ FatalAppExit(FALSE, TEXT("Application terminated"));
+ break;
- case IDCANCEL: /* Break into the debugger */
+ case IDCANCEL: /* Break into the debugger */
- DebugBreak();
- break;
+ DebugBreak();
+ break;
- case IDYES: /* Ignore assertion continue execution */
- break;
+ case IDYES: /* Ignore assertion continue execution */
+ break;
}
}
}
/* Displays a message box at a break point */
-void WINAPI DbgBreakPoint(LPCSTR pCondition, LPCSTR pFileName, INT iLine)
+void WINAPI DbgBreakPoint(LPCSTR pCondition,LPCSTR pFileName,INT iLine)
{
if(g_fUseKASSERT)
{
@@ -822,36 +791,36 @@ void WINAPI DbgBreakPoint(LPCSTR pCondition, LPCSTR pFileName, INT iLine)
{
TCHAR szInfo[iDEBUGINFO];
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%hs \nAt line %d of %hs\nContinue? (Cancel to debug)"),
- pCondition, iLine, pFileName);
+ (void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%hs \nAt line %d of %hs\nContinue? (Cancel to debug)"),
+ pCondition, iLine, pFileName);
- INT MsgId = MessageBoxOtherThread(NULL, szInfo, TEXT("Hard coded break point"),
+ INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("Hard coded break point"),
MB_SYSTEMMODAL |
MB_ICONHAND |
MB_YESNOCANCEL |
MB_SETFOREGROUND);
- switch(MsgId)
+ switch (MsgId)
{
- case IDNO: /* Kill the application */
+ case IDNO: /* Kill the application */
- FatalAppExit(FALSE, TEXT("Application terminated"));
- break;
+ FatalAppExit(FALSE, TEXT("Application terminated"));
+ break;
- case IDCANCEL: /* Break into the debugger */
+ case IDCANCEL: /* Break into the debugger */
- DebugBreak();
- break;
+ DebugBreak();
+ break;
- case IDYES: /* Ignore break point continue execution */
- break;
+ case IDYES: /* Ignore break point continue execution */
+ break;
}
}
}
-void WINAPI DbgKernelAssert(LPCSTR pCondition, LPCSTR pFileName, INT iLine)
+void WINAPI DbgKernelAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine)
{
- DbgLog((LOG_ERROR, 0, TEXT("Assertion FAILED (%hs) at line %d in file %hs"),
- pCondition, iLine, pFileName));
+ DbgLog((LOG_ERROR,0,TEXT("Assertion FAILED (%hs) at line %d in file %hs"),
+ pCondition, iLine, pFileName));
DebugBreak();
}
@@ -866,14 +835,13 @@ void WINAPI DbgKernelAssert(LPCSTR pCondition, LPCSTR pFileName, INT iLine)
// warning -- this function is implemented twice for ansi applications
// linking to the unicode library
//
-void WINAPI DbgLogInfo(DWORD Type, DWORD Level, LPCTSTR pFormat, ...)
+void WINAPI DbgLogInfo(DWORD Type,DWORD Level,LPCTSTR pFormat,...)
{
/* Check the current level for this type combination */
- BOOL bAccept = DbgCheckModuleLevel(Type, Level);
- if(bAccept == FALSE)
- {
+ BOOL bAccept = DbgCheckModuleLevel(Type,Level);
+ if (bAccept == FALSE) {
return;
}
@@ -885,9 +853,9 @@ void WINAPI DbgLogInfo(DWORD Type, DWORD Level, LPCTSTR pFormat, ...)
va_start(va, pFormat);
(void)StringCchPrintf(szInfo, NUMELMS(szInfo),
- TEXT("%s(tid %x) %8d : "),
- m_ModuleName,
- GetCurrentThreadId(), timeGetTime() - dwTimeOffset);
+ TEXT("%s(tid %x) %8d : "),
+ m_ModuleName,
+ GetCurrentThreadId(), timeGetTime() - dwTimeOffset);
(void)StringCchVPrintf(szInfo + lstrlen(szInfo), NUMELMS(szInfo) - lstrlen(szInfo), pFormat, va);
(void)StringCchCat(szInfo, NUMELMS(szInfo), TEXT("\r\n"));
@@ -901,10 +869,10 @@ void WINAPI DbgLogInfo(DWORD Type, DWORD Level, LPCTSTR pFormat, ...)
boxes to the user, this provides an alternative which puts the error
condition on the debugger output with a suitable eye catching message */
-void WINAPI DbgKernelAssert(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine)
+void WINAPI DbgKernelAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
- DbgLog((LOG_ERROR, 0, TEXT("Assertion FAILED (%s) at line %d in file %s"),
- pCondition, iLine, pFileName));
+ DbgLog((LOG_ERROR,0,TEXT("Assertion FAILED (%s) at line %d in file %s"),
+ pCondition, iLine, pFileName));
DebugBreak();
}
@@ -929,8 +897,7 @@ DWORD WINAPI DbgRegisterObjectCreation(LPCSTR szObjectName,
ASSERT(pObject);
/* It is valid to pass a NULL object name */
- if(pObject == NULL)
- {
+ if (pObject == NULL) {
return FALSE;
}
@@ -938,8 +905,7 @@ DWORD WINAPI DbgRegisterObjectCreation(LPCSTR szObjectName,
being pulled in from an executable which has globally defined objects
as they are created by the C++ run time before WinMain is called */
- if(m_bInit == FALSE)
- {
+ if (m_bInit == FALSE) {
DbgInitialise(GetModuleHandle(NULL));
}
@@ -947,8 +913,7 @@ DWORD WINAPI DbgRegisterObjectCreation(LPCSTR szObjectName,
EnterCriticalSection(&m_CSDebug);
/* If no name then default to UNKNOWN */
- if(!szObjectName && !wszObjectName)
- {
+ if (!szObjectName && !wszObjectName) {
szObjectName = pUnknownName;
}
@@ -965,14 +930,11 @@ DWORD WINAPI DbgRegisterObjectCreation(LPCSTR szObjectName,
DWORD ObjectCookie = pObject->m_dwCookie;
ASSERT(ObjectCookie);
- if(wszObjectName)
- {
- DbgLog((LOG_MEMORY, 2, TEXT("Object created %d (%ls) %d Active"),
+ if(wszObjectName) {
+ DbgLog((LOG_MEMORY,2,TEXT("Object created %d (%ls) %d Active"),
pObject->m_dwCookie, wszObjectName, m_dwObjectCount));
- }
- else
- {
- DbgLog((LOG_MEMORY, 2, TEXT("Object created %d (%hs) %d Active"),
+ } else {
+ DbgLog((LOG_MEMORY,2,TEXT("Object created %d (%hs) %d Active"),
pObject->m_dwCookie, szObjectName, m_dwObjectCount));
}
@@ -996,18 +958,15 @@ BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie)
/* Scan the object list looking for a cookie match */
- while(pObject)
- {
- if(pObject->m_dwCookie == dwCookie)
- {
+ while (pObject) {
+ if (pObject->m_dwCookie == dwCookie) {
break;
}
pPrevious = pObject;
pObject = pObject->m_pNext;
}
- if(pObject == NULL)
- {
+ if (pObject == NULL) {
DbgBreak("Apparently destroying a bogus object");
LeaveCriticalSection(&m_CSDebug);
return FALSE;
@@ -1015,12 +974,9 @@ BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie)
/* Is the object at the head of the list */
- if(pPrevious == NULL)
- {
+ if (pPrevious == NULL) {
pListHead = pObject->m_pNext;
- }
- else
- {
+ } else {
pPrevious->m_pNext = pObject->m_pNext;
}
@@ -1028,14 +984,11 @@ BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie)
m_dwObjectCount--;
- if(pObject->m_wszName)
- {
- DbgLog((LOG_MEMORY, 2, TEXT("Object destroyed %d (%ls) %d Active"),
+ if(pObject->m_wszName) {
+ DbgLog((LOG_MEMORY,2,TEXT("Object destroyed %d (%ls) %d Active"),
pObject->m_dwCookie, pObject->m_wszName, m_dwObjectCount));
- }
- else
- {
- DbgLog((LOG_MEMORY, 2, TEXT("Object destroyed %d (%hs) %d Active"),
+ } else {
+ DbgLog((LOG_MEMORY,2,TEXT("Object destroyed %d (%hs) %d Active"),
pObject->m_dwCookie, pObject->m_szName, m_dwObjectCount));
}
@@ -1058,27 +1011,23 @@ void WINAPI DbgDumpObjectRegister()
/* Scan the object list displaying the name and cookie */
- DbgLog((LOG_MEMORY, 2, TEXT("")));
- DbgLog((LOG_MEMORY, 2, TEXT(" ID Object Description")));
- DbgLog((LOG_MEMORY, 2, TEXT("")));
+ DbgLog((LOG_MEMORY,2,TEXT("")));
+ DbgLog((LOG_MEMORY,2,TEXT(" ID Object Description")));
+ DbgLog((LOG_MEMORY,2,TEXT("")));
- while(pObject)
- {
- if(pObject->m_wszName)
- {
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%5d (%p) %30ls"), pObject->m_dwCookie, &pObject, pObject->m_wszName);
+ while (pObject) {
+ if(pObject->m_wszName) {
+ (void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%5d (%p) %30ls"),pObject->m_dwCookie, &pObject, pObject->m_wszName);
+ } else {
+ (void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("%5d (%p) %30hs"),pObject->m_dwCookie, &pObject, pObject->m_szName);
}
- else
- {
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("%5d (%p) %30hs"), pObject->m_dwCookie, &pObject, pObject->m_szName);
- }
- DbgLog((LOG_MEMORY, 2, szInfo));
+ DbgLog((LOG_MEMORY,2,szInfo));
pObject = pObject->m_pNext;
}
- (void)StringCchPrintf(szInfo, NUMELMS(szInfo), TEXT("Total object count %5d"), m_dwObjectCount);
- DbgLog((LOG_MEMORY, 2, TEXT("")));
- DbgLog((LOG_MEMORY, 1, szInfo));
+ (void)StringCchPrintf(szInfo,NUMELMS(szInfo),TEXT("Total object count %5d"),m_dwObjectCount);
+ DbgLog((LOG_MEMORY,2,TEXT("")));
+ DbgLog((LOG_MEMORY,1,szInfo));
LeaveCriticalSection(&m_CSDebug);
}
@@ -1086,28 +1035,24 @@ void WINAPI DbgDumpObjectRegister()
DWORD WINAPI DbgWaitForSingleObject(HANDLE h)
{
DWORD dwWaitResult;
- do
- {
+ do {
dwWaitResult = WaitForSingleObject(h, dwWaitTimeout);
ASSERT(dwWaitResult == WAIT_OBJECT_0);
- }
- while(dwWaitResult == WAIT_TIMEOUT);
+ } while (dwWaitResult == WAIT_TIMEOUT);
return dwWaitResult;
}
DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount,
- __in_ecount(nCount) CONST HANDLE *lpHandles,
- BOOL bWaitAll)
+ __in_ecount(nCount) CONST HANDLE *lpHandles,
+ BOOL bWaitAll)
{
DWORD dwWaitResult;
- do
- {
+ do {
dwWaitResult = WaitForMultipleObjects(nCount,
lpHandles,
bWaitAll,
dwWaitTimeout);
ASSERT((DWORD)(dwWaitResult - WAIT_OBJECT_0) < MAXIMUM_WAIT_OBJECTS);
- }
- while(dwWaitResult == WAIT_TIMEOUT);
+ } while (dwWaitResult == WAIT_TIMEOUT);
return dwWaitResult;
}
@@ -1120,37 +1065,33 @@ void WINAPI DbgSetWaitTimeout(DWORD dwTimeout)
#ifdef _OBJBASE_H_
-/* Stuff for printing out our GUID names */
+ /* Stuff for printing out our GUID names */
-GUID_STRING_ENTRY g_GuidNames[] =
-{
-#define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ GUID_STRING_ENTRY g_GuidNames[] = {
+ #define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
{ #name, { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } },
-#include <uuids.h>
-};
+ #include <uuids.h>
+ };
-CGuidNameList GuidNames;
-int g_cGuidNames = sizeof(g_GuidNames) / sizeof(g_GuidNames[0]);
+ CGuidNameList GuidNames;
+ int g_cGuidNames = sizeof(g_GuidNames) / sizeof(g_GuidNames[0]);
-char *CGuidNameList::operator [](const GUID &guid)
-{
- for(int i = 0; i < g_cGuidNames; i++)
+ char *CGuidNameList::operator [] (const GUID &guid)
{
- if(g_GuidNames[i].guid == guid)
- {
- return g_GuidNames[i].szName;
+ for (int i = 0; i < g_cGuidNames; i++) {
+ if (g_GuidNames[i].guid == guid) {
+ return g_GuidNames[i].szName;
+ }
+ }
+ if (guid == GUID_NULL) {
+ return "GUID_NULL";
}
- }
- if(guid == GUID_NULL)
- {
- return "GUID_NULL";
- }
-
- // !!! add something to print FOURCC guids?
- // shouldn't this print the hex CLSID?
- return "Unknown GUID Name";
-}
+ // !!! add something to print FOURCC guids?
+
+ // shouldn't this print the hex CLSID?
+ return "Unknown GUID Name";
+ }
#endif /* _OBJBASE_H_ */
@@ -1163,35 +1104,32 @@ CDisp::CDisp(LONGLONG ll, int Format)
// introducing a default format of CDISP_REFTIME
LARGE_INTEGER li;
li.QuadPart = ll;
- switch(Format)
- {
- case CDISP_DEC:
- {
- TCHAR temp[20];
- int pos = 20;
- temp[--pos] = 0;
- int digit;
- // always output at least one digit
- do
- {
- // Get the rightmost digit - we only need the low word
- digit = li.LowPart % 10;
- li.QuadPart /= 10;
- temp[--pos] = (TCHAR) digit + L'0';
- }
- while(li.QuadPart);
- (void)StringCchCopy(m_String, NUMELMS(m_String), temp + pos);
- break;
- }
- case CDISP_HEX:
- default:
- (void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("0x%X%8.8X"), li.HighPart, li.LowPart);
+ switch (Format) {
+ case CDISP_DEC:
+ {
+ TCHAR temp[20];
+ int pos=20;
+ temp[--pos] = 0;
+ int digit;
+ // always output at least one digit
+ do {
+ // Get the rightmost digit - we only need the low word
+ digit = li.LowPart % 10;
+ li.QuadPart /= 10;
+ temp[--pos] = (TCHAR) digit+L'0';
+ } while (li.QuadPart);
+ (void)StringCchCopy(m_String, NUMELMS(m_String), temp+pos);
+ break;
+ }
+ case CDISP_HEX:
+ default:
+ (void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("0x%X%8.8X"), li.HighPart, li.LowPart);
}
};
CDisp::CDisp(REFCLSID clsid)
{
-#ifdef UNICODE
+#ifdef UNICODE
(void)StringFromGUID2(clsid, m_String, NUMELMS(m_String));
#else
WCHAR wszTemp[50];
@@ -1205,32 +1143,28 @@ CDisp::CDisp(REFCLSID clsid)
CDisp::CDisp(CRefTime llTime)
{
LONGLONG llDiv;
- if(llTime < 0)
- {
+ if (llTime < 0) {
llTime = -llTime;
(void)StringCchCopy(m_String, NUMELMS(m_String), TEXT("-"));
}
llDiv = (LONGLONG)24 * 3600 * 10000000;
- if(llTime >= llDiv)
- {
+ if (llTime >= llDiv) {
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d days "), (LONG)(llTime / llDiv));
llTime = llTime % llDiv;
}
llDiv = (LONGLONG)3600 * 10000000;
- if(llTime >= llDiv)
- {
+ if (llTime >= llDiv) {
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d hrs "), (LONG)(llTime / llDiv));
llTime = llTime % llDiv;
}
llDiv = (LONGLONG)60 * 10000000;
- if(llTime >= llDiv)
- {
+ if (llTime >= llDiv) {
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d mins "), (LONG)(llTime / llDiv));
llTime = llTime % llDiv;
}
(void)StringCchPrintf(m_String + lstrlen(m_String), NUMELMS(m_String) - lstrlen(m_String), TEXT("%d.%3.3d sec"),
- (LONG)llTime / 10000000,
- (LONG)((llTime % 10000000) / 10000));
+ (LONG)llTime / 10000000,
+ (LONG)((llTime % 10000000) / 10000));
};
#endif // __STREAMS__
@@ -1243,27 +1177,23 @@ CDisp::CDisp(IPin *pPin)
TCHAR str[MAX_PIN_NAME];
CLSID clsid;
- if(pPin)
- {
- pPin->QueryPinInfo(&pi);
- pi.pFilter->GetClassID(&clsid);
- QueryPinInfoReleaseFilter(pi);
-#ifndef UNICODE
- WideCharToMultiByte(GetACP(), 0, pi.achName, lstrlenW(pi.achName) + 1,
- str, MAX_PIN_NAME, NULL, NULL);
-#else
- (void)StringCchCopy(str, NUMELMS(str), pi.achName);
-#endif
- }
- else
- {
- (void)StringCchCopy(str, NUMELMS(str), TEXT("NULL IPin"));
+ if (pPin) {
+ pPin->QueryPinInfo(&pi);
+ pi.pFilter->GetClassID(&clsid);
+ QueryPinInfoReleaseFilter(pi);
+ #ifndef UNICODE
+ WideCharToMultiByte(GetACP(), 0, pi.achName, lstrlenW(pi.achName) + 1,
+ str, MAX_PIN_NAME, NULL, NULL);
+ #else
+ (void)StringCchCopy(str, NUMELMS(str), pi.achName);
+ #endif
+ } else {
+ (void)StringCchCopy(str, NUMELMS(str), TEXT("NULL IPin"));
}
m_pString = (PTCHAR) new TCHAR[lstrlen(str)+64];
- if(!m_pString)
- {
- return;
+ if (!m_pString) {
+ return;
}
(void)StringCchPrintf(m_pString, lstrlen(str) + 64, TEXT("%hs(%s)"), GuidNames[clsid], str);
@@ -1317,15 +1247,14 @@ CDisp::~CDisp()
CDispBasic::~CDispBasic()
{
- if(m_pString != m_String)
- {
- delete [] m_pString;
+ if (m_pString != m_String) {
+ delete [] m_pString;
}
}
CDisp::CDisp(double d)
{
- (void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%d.%03d"), (int) d, (int)((d - (int) d) * 1000));
+ (void)StringCchPrintf(m_String, NUMELMS(m_String), TEXT("%d.%03d"), (int) d, (int) ((d - (int) d) * 1000));
}
@@ -1341,122 +1270,103 @@ void WINAPI DisplayType(LPCTSTR label, const AM_MEDIA_TYPE *pmtIn)
/* Dump the GUID types and a short description */
- DbgLog((LOG_TRACE, 5, TEXT("")));
- DbgLog((LOG_TRACE, 2, TEXT("%s M type %hs S type %hs"), label,
- GuidNames[pmtIn->majortype],
- GuidNames[pmtIn->subtype]));
- DbgLog((LOG_TRACE, 5, TEXT("Subtype description %s"), GetSubtypeName(&pmtIn->subtype)));
+ DbgLog((LOG_TRACE,5,TEXT("")));
+ DbgLog((LOG_TRACE,2,TEXT("%s M type %hs S type %hs"), label,
+ GuidNames[pmtIn->majortype],
+ GuidNames[pmtIn->subtype]));
+ DbgLog((LOG_TRACE,5,TEXT("Subtype description %s"),GetSubtypeName(&pmtIn->subtype)));
/* Dump the generic media types */
- if(pmtIn->bTemporalCompression)
- {
- DbgLog((LOG_TRACE, 5, TEXT("Temporally compressed")));
- }
- else
- {
- DbgLog((LOG_TRACE, 5, TEXT("Not temporally compressed")));
+ if (pmtIn->bTemporalCompression) {
+ DbgLog((LOG_TRACE,5,TEXT("Temporally compressed")));
+ } else {
+ DbgLog((LOG_TRACE,5,TEXT("Not temporally compressed")));
}
- if(pmtIn->bFixedSizeSamples)
- {
- DbgLog((LOG_TRACE, 5, TEXT("Sample size %d"), pmtIn->lSampleSize));
- }
- else
- {
- DbgLog((LOG_TRACE, 5, TEXT("Variable size samples")));
+ if (pmtIn->bFixedSizeSamples) {
+ DbgLog((LOG_TRACE,5,TEXT("Sample size %d"),pmtIn->lSampleSize));
+ } else {
+ DbgLog((LOG_TRACE,5,TEXT("Variable size samples")));
}
- if(pmtIn->formattype == FORMAT_VideoInfo)
- {
+ if (pmtIn->formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *)pmtIn->pbFormat;
- DisplayRECT(TEXT("Source rectangle"), pVideoInfo->rcSource);
- DisplayRECT(TEXT("Target rectangle"), pVideoInfo->rcTarget);
+ DisplayRECT(TEXT("Source rectangle"),pVideoInfo->rcSource);
+ DisplayRECT(TEXT("Target rectangle"),pVideoInfo->rcTarget);
DisplayBITMAPINFO(HEADER(pmtIn->pbFormat));
- }
- if(pmtIn->formattype == FORMAT_VideoInfo2)
- {
+ } if (pmtIn->formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2 *pVideoInfo2 = (VIDEOINFOHEADER2 *)pmtIn->pbFormat;
- DisplayRECT(TEXT("Source rectangle"), pVideoInfo2->rcSource);
- DisplayRECT(TEXT("Target rectangle"), pVideoInfo2->rcTarget);
+ DisplayRECT(TEXT("Source rectangle"),pVideoInfo2->rcSource);
+ DisplayRECT(TEXT("Target rectangle"),pVideoInfo2->rcTarget);
DbgLog((LOG_TRACE, 5, TEXT("Aspect Ratio: %d:%d"),
- pVideoInfo2->dwPictAspectRatioX,
- pVideoInfo2->dwPictAspectRatioY));
+ pVideoInfo2->dwPictAspectRatioX,
+ pVideoInfo2->dwPictAspectRatioY));
DisplayBITMAPINFO(&pVideoInfo2->bmiHeader);
- }
- else if(pmtIn->majortype == MEDIATYPE_Audio)
- {
- DbgLog((LOG_TRACE, 2, TEXT(" Format type %hs"),
- GuidNames[pmtIn->formattype]));
- DbgLog((LOG_TRACE, 2, TEXT(" Subtype %hs"),
- GuidNames[pmtIn->subtype]));
+ } else if (pmtIn->majortype == MEDIATYPE_Audio) {
+ DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"),
+ GuidNames[pmtIn->formattype]));
+ DbgLog((LOG_TRACE,2,TEXT(" Subtype %hs"),
+ GuidNames[pmtIn->subtype]));
- if((pmtIn->subtype != MEDIASUBTYPE_MPEG1Packet)
- && (pmtIn->cbFormat >= sizeof(PCMWAVEFORMAT)))
+ if ((pmtIn->subtype != MEDIASUBTYPE_MPEG1Packet)
+ && (pmtIn->cbFormat >= sizeof(PCMWAVEFORMAT)))
{
/* Dump the contents of the WAVEFORMATEX type-specific format structure */
WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmtIn->pbFormat;
- DbgLog((LOG_TRACE, 2, TEXT("wFormatTag %u"), pwfx->wFormatTag));
- DbgLog((LOG_TRACE, 2, TEXT("nChannels %u"), pwfx->nChannels));
- DbgLog((LOG_TRACE, 2, TEXT("nSamplesPerSec %lu"), pwfx->nSamplesPerSec));
- DbgLog((LOG_TRACE, 2, TEXT("nAvgBytesPerSec %lu"), pwfx->nAvgBytesPerSec));
- DbgLog((LOG_TRACE, 2, TEXT("nBlockAlign %u"), pwfx->nBlockAlign));
- DbgLog((LOG_TRACE, 2, TEXT("wBitsPerSample %u"), pwfx->wBitsPerSample));
+ DbgLog((LOG_TRACE,2,TEXT("wFormatTag %u"), pwfx->wFormatTag));
+ DbgLog((LOG_TRACE,2,TEXT("nChannels %u"), pwfx->nChannels));
+ DbgLog((LOG_TRACE,2,TEXT("nSamplesPerSec %lu"), pwfx->nSamplesPerSec));
+ DbgLog((LOG_TRACE,2,TEXT("nAvgBytesPerSec %lu"), pwfx->nAvgBytesPerSec));
+ DbgLog((LOG_TRACE,2,TEXT("nBlockAlign %u"), pwfx->nBlockAlign));
+ DbgLog((LOG_TRACE,2,TEXT("wBitsPerSample %u"), pwfx->wBitsPerSample));
/* PCM uses a WAVEFORMAT and does not have the extra size field */
- if(pmtIn->cbFormat >= sizeof(WAVEFORMATEX))
- {
- DbgLog((LOG_TRACE, 2, TEXT("cbSize %u"), pwfx->cbSize));
+ if (pmtIn->cbFormat >= sizeof(WAVEFORMATEX)) {
+ DbgLog((LOG_TRACE,2,TEXT("cbSize %u"), pwfx->cbSize));
}
- }
- else
- {
+ } else {
}
- }
- else
- {
- DbgLog((LOG_TRACE, 2, TEXT(" Format type %hs"),
- GuidNames[pmtIn->formattype]));
+ } else {
+ DbgLog((LOG_TRACE,2,TEXT(" Format type %hs"),
+ GuidNames[pmtIn->formattype]));
}
}
void DisplayBITMAPINFO(const BITMAPINFOHEADER* pbmi)
{
- DbgLog((LOG_TRACE, 5, TEXT("Size of BITMAPINFO structure %d"), pbmi->biSize));
- if(pbmi->biCompression < 256)
- {
- DbgLog((LOG_TRACE, 2, TEXT("%dx%dx%d bit (%d)"),
+ DbgLog((LOG_TRACE,5,TEXT("Size of BITMAPINFO structure %d"),pbmi->biSize));
+ if (pbmi->biCompression < 256) {
+ DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit (%d)"),
pbmi->biWidth, pbmi->biHeight,
pbmi->biBitCount, pbmi->biCompression));
- }
- else
- {
- DbgLog((LOG_TRACE, 2, TEXT("%dx%dx%d bit '%4.4hs'"),
+ } else {
+ DbgLog((LOG_TRACE,2,TEXT("%dx%dx%d bit '%4.4hs'"),
pbmi->biWidth, pbmi->biHeight,
pbmi->biBitCount, &pbmi->biCompression));
}
- DbgLog((LOG_TRACE, 2, TEXT("Image size %d"), pbmi->biSizeImage));
- DbgLog((LOG_TRACE, 5, TEXT("Planes %d"), pbmi->biPlanes));
- DbgLog((LOG_TRACE, 5, TEXT("X Pels per metre %d"), pbmi->biXPelsPerMeter));
- DbgLog((LOG_TRACE, 5, TEXT("Y Pels per metre %d"), pbmi->biYPelsPerMeter));
- DbgLog((LOG_TRACE, 5, TEXT("Colours used %d"), pbmi->biClrUsed));
+ DbgLog((LOG_TRACE,2,TEXT("Image size %d"),pbmi->biSizeImage));
+ DbgLog((LOG_TRACE,5,TEXT("Planes %d"),pbmi->biPlanes));
+ DbgLog((LOG_TRACE,5,TEXT("X Pels per metre %d"),pbmi->biXPelsPerMeter));
+ DbgLog((LOG_TRACE,5,TEXT("Y Pels per metre %d"),pbmi->biYPelsPerMeter));
+ DbgLog((LOG_TRACE,5,TEXT("Colours used %d"),pbmi->biClrUsed));
}
void DisplayRECT(LPCTSTR szLabel, const RECT& rc)
{
- DbgLog((LOG_TRACE, 5, TEXT("%s (Left %d Top %d Right %d Bottom %d)"),
+ DbgLog((LOG_TRACE,5,TEXT("%s (Left %d Top %d Right %d Bottom %d)"),
szLabel,
rc.left,
rc.top,
@@ -1467,110 +1377,93 @@ void DisplayRECT(LPCTSTR szLabel, const RECT& rc)
void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel)
{
- if(!pGraph)
+ if( !pGraph )
{
return;
}
IEnumFilters *pFilters;
- DbgLog((LOG_TRACE, dwLevel, TEXT("DumpGraph [%x]"), pGraph));
+ DbgLog((LOG_TRACE,dwLevel,TEXT("DumpGraph [%x]"), pGraph));
- if(FAILED(pGraph->EnumFilters(&pFilters)))
- {
- DbgLog((LOG_TRACE, dwLevel, TEXT("EnumFilters failed!")));
+ if (FAILED(pGraph->EnumFilters(&pFilters))) {
+ DbgLog((LOG_TRACE,dwLevel,TEXT("EnumFilters failed!")));
}
IBaseFilter *pFilter;
ULONG n;
- while(pFilters->Next(1, &pFilter, &n) == S_OK)
- {
- FILTER_INFO info;
+ while (pFilters->Next(1, &pFilter, &n) == S_OK) {
+ FILTER_INFO info;
- if(FAILED(pFilter->QueryFilterInfo(&info)))
- {
- DbgLog((LOG_TRACE, dwLevel, TEXT(" Filter [%p] -- failed QueryFilterInfo"), pFilter));
- }
- else
- {
- QueryFilterInfoReleaseGraph(info);
+ if (FAILED(pFilter->QueryFilterInfo(&info))) {
+ DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%p] -- failed QueryFilterInfo"), pFilter));
+ } else {
+ QueryFilterInfoReleaseGraph(info);
- // !!! should QueryVendorInfo here!
+ // !!! should QueryVendorInfo here!
+
+ DbgLog((LOG_TRACE,dwLevel,TEXT(" Filter [%p] '%ls'"), pFilter, info.achName));
- DbgLog((LOG_TRACE, dwLevel, TEXT(" Filter [%p] '%ls'"), pFilter, info.achName));
+ IEnumPins *pins;
- IEnumPins *pins;
+ if (FAILED(pFilter->EnumPins(&pins))) {
+ DbgLog((LOG_TRACE,dwLevel,TEXT("EnumPins failed!")));
+ } else {
- if(FAILED(pFilter->EnumPins(&pins)))
- {
- DbgLog((LOG_TRACE, dwLevel, TEXT("EnumPins failed!")));
- }
- else
- {
+ IPin *pPin;
+ while (pins->Next(1, &pPin, &n) == S_OK) {
+ PIN_INFO pinInfo;
- IPin *pPin;
- while(pins->Next(1, &pPin, &n) == S_OK)
- {
- PIN_INFO pinInfo;
-
- if(FAILED(pPin->QueryPinInfo(&pinInfo)))
- {
- DbgLog((LOG_TRACE, dwLevel, TEXT(" Pin [%x] -- failed QueryPinInfo"), pPin));
- }
- else
- {
- QueryPinInfoReleaseFilter(pinInfo);
-
- IPin *pPinConnected = NULL;
-
- HRESULT hr = pPin->ConnectedTo(&pPinConnected);
-
- if(pPinConnected)
- {
- DbgLog((LOG_TRACE, dwLevel, TEXT(" Pin [%p] '%ls' [%sput]")
- TEXT(" Connected to pin [%p]"),
- pPin, pinInfo.achName,
- pinInfo.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"),
- pPinConnected));
-
- pPinConnected->Release();
-
- // perhaps we should really dump the type both ways as a sanity
- // check?
- if(pinInfo.dir == PINDIR_OUTPUT)
- {
- AM_MEDIA_TYPE mt;
-
- hr = pPin->ConnectionMediaType(&mt);
-
- if(SUCCEEDED(hr))
- {
- DisplayType(TEXT("Connection type"), &mt);
-
- FreeMediaType(mt);
- }
- }
- }
- else
- {
- DbgLog((LOG_TRACE, dwLevel,
- TEXT(" Pin [%x] '%ls' [%sput]"),
- pPin, pinInfo.achName,
- pinInfo.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out")));
-
- }
- }
-
- pPin->Release();
+ if (FAILED(pPin->QueryPinInfo(&pinInfo))) {
+ DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%x] -- failed QueryPinInfo"), pPin));
+ } else {
+ QueryPinInfoReleaseFilter(pinInfo);
- }
+ IPin *pPinConnected = NULL;
- pins->Release();
- }
+ HRESULT hr = pPin->ConnectedTo(&pPinConnected);
- }
+ if (pPinConnected) {
+ DbgLog((LOG_TRACE,dwLevel,TEXT(" Pin [%p] '%ls' [%sput]")
+ TEXT(" Connected to pin [%p]"),
+ pPin, pinInfo.achName,
+ pinInfo.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out"),
+ pPinConnected));
+
+ pPinConnected->Release();
+
+ // perhaps we should really dump the type both ways as a sanity
+ // check?
+ if (pinInfo.dir == PINDIR_OUTPUT) {
+ AM_MEDIA_TYPE mt;
+
+ hr = pPin->ConnectionMediaType(&mt);
+
+ if (SUCCEEDED(hr)) {
+ DisplayType(TEXT("Connection type"), &mt);
+
+ FreeMediaType(mt);
+ }
+ }
+ } else {
+ DbgLog((LOG_TRACE,dwLevel,
+ TEXT(" Pin [%x] '%ls' [%sput]"),
+ pPin, pinInfo.achName,
+ pinInfo.dir == PINDIR_INPUT ? TEXT("In") : TEXT("Out")));
+
+ }
+ }
+
+ pPin->Release();
+
+ }
+
+ pins->Release();
+ }
- pFilter->Release();
+ }
+
+ pFilter->Release();
}
pFilters->Release();
diff --git a/src/filters/BaseClasses/wxdebug.h b/src/filters/BaseClasses/wxdebug.h
index be2959c2c..34ceefeec 100644
--- a/src/filters/BaseClasses/wxdebug.h
+++ b/src/filters/BaseClasses/wxdebug.h
@@ -51,21 +51,19 @@ enum { LOG_TIMING = 0x01, // Timing and performance measurements
LOG_CUSTOM3 = 0x80,
LOG_CUSTOM4 = 0x100,
LOG_CUSTOM5 = 0x200,
- };
+};
#define LOG_FORCIBLY_SET 0x80000000
enum { CDISP_HEX = 0x01,
- CDISP_DEC = 0x02
- };
+ CDISP_DEC = 0x02};
// For each object created derived from CBaseObject (in debug builds) we
// create a descriptor that holds it's name (statically allocated memory)
// and a cookie we assign it. We keep a list of all the active objects
// we have registered so that we can dump a list of remaining objects
-typedef struct tag_ObjectDesc
-{
+typedef struct tag_ObjectDesc {
LPCSTR m_szName;
LPCWSTR m_wszName;
DWORD m_dwCookie;
@@ -77,148 +75,148 @@ typedef struct tag_ObjectDesc
#ifdef _DEBUG
-#define NAME(x) TEXT(x)
+ #define NAME(x) TEXT(x)
-// These are used internally by the debug library (PRIVATE)
+ // These are used internally by the debug library (PRIVATE)
-void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax);
-void WINAPI DbgInitGlobalSettings(bool fTakeMax);
-void WINAPI DbgInitModuleSettings(bool fTakeMax);
-void WINAPI DbgInitModuleName();
-DWORD WINAPI DbgRegisterObjectCreation(
- LPCSTR szObjectName, LPCWSTR wszObjectName);
+ void WINAPI DbgInitKeyLevels(HKEY hKey, bool fTakeMax);
+ void WINAPI DbgInitGlobalSettings(bool fTakeMax);
+ void WINAPI DbgInitModuleSettings(bool fTakeMax);
+ void WINAPI DbgInitModuleName();
+ DWORD WINAPI DbgRegisterObjectCreation(
+ LPCSTR szObjectName, LPCWSTR wszObjectName);
-BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie);
+ BOOL WINAPI DbgRegisterObjectDestruction(DWORD dwCookie);
-// These are the PUBLIC entry points
+ // These are the PUBLIC entry points
-BOOL WINAPI DbgCheckModuleLevel(DWORD Type, DWORD Level);
-void WINAPI DbgSetModuleLevel(DWORD Type, DWORD Level);
-void WINAPI DbgSetAutoRefreshLevels(bool fAuto);
+ BOOL WINAPI DbgCheckModuleLevel(DWORD Type,DWORD Level);
+ void WINAPI DbgSetModuleLevel(DWORD Type,DWORD Level);
+ void WINAPI DbgSetAutoRefreshLevels(bool fAuto);
-// Initialise the library with the module handle
+ // Initialise the library with the module handle
-void WINAPI DbgInitialise(HINSTANCE hInst);
-void WINAPI DbgTerminate();
+ void WINAPI DbgInitialise(HINSTANCE hInst);
+ void WINAPI DbgTerminate();
-void WINAPI DbgDumpObjectRegister();
+ void WINAPI DbgDumpObjectRegister();
-// Display error and logging to the user
+ // Display error and logging to the user
-void WINAPI DbgAssert(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine);
-void WINAPI DbgBreakPoint(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine);
-void WINAPI DbgBreakPoint(LPCTSTR pFileName, INT iLine, __format_string LPCTSTR szFormatString, ...);
+ void WINAPI DbgAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine);
+ void WINAPI DbgBreakPoint(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine);
+ void WINAPI DbgBreakPoint(LPCTSTR pFileName,INT iLine,__format_string LPCTSTR szFormatString,...);
-void WINAPI DbgKernelAssert(LPCTSTR pCondition, LPCTSTR pFileName, INT iLine);
-void WINAPI DbgLogInfo(DWORD Type, DWORD Level, __format_string LPCTSTR pFormat, ...);
+ void WINAPI DbgKernelAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine);
+ void WINAPI DbgLogInfo(DWORD Type,DWORD Level,__format_string LPCTSTR pFormat,...);
#ifdef UNICODE
-void WINAPI DbgLogInfo(DWORD Type, DWORD Level, __format_string LPCSTR pFormat, ...);
-void WINAPI DbgAssert(LPCSTR pCondition, LPCSTR pFileName, INT iLine);
-void WINAPI DbgBreakPoint(LPCSTR pCondition, LPCSTR pFileName, INT iLine);
-void WINAPI DbgKernelAssert(LPCSTR pCondition, LPCSTR pFileName, INT iLine);
+ void WINAPI DbgLogInfo(DWORD Type,DWORD Level,__format_string LPCSTR pFormat,...);
+ void WINAPI DbgAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine);
+ void WINAPI DbgBreakPoint(LPCSTR pCondition,LPCSTR pFileName,INT iLine);
+ void WINAPI DbgKernelAssert(LPCSTR pCondition,LPCSTR pFileName,INT iLine);
#endif
-void WINAPI DbgOutString(LPCTSTR psz);
+ void WINAPI DbgOutString(LPCTSTR psz);
-// Debug infinite wait stuff
-DWORD WINAPI DbgWaitForSingleObject(HANDLE h);
-DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount,
- __in_ecount(nCount) CONST HANDLE *lpHandles,
- BOOL bWaitAll);
-void WINAPI DbgSetWaitTimeout(DWORD dwTimeout);
+ // Debug infinite wait stuff
+ DWORD WINAPI DbgWaitForSingleObject(HANDLE h);
+ DWORD WINAPI DbgWaitForMultipleObjects(DWORD nCount,
+ __in_ecount(nCount) CONST HANDLE *lpHandles,
+ BOOL bWaitAll);
+ void WINAPI DbgSetWaitTimeout(DWORD dwTimeout);
#ifdef __strmif_h__
-// Display a media type: Terse at level 2, verbose at level 5
-void WINAPI DisplayType(LPCTSTR label, const AM_MEDIA_TYPE *pmtIn);
+ // Display a media type: Terse at level 2, verbose at level 5
+ void WINAPI DisplayType(LPCTSTR label, const AM_MEDIA_TYPE *pmtIn);
-// Dump lots of information about a filter graph
-void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel);
+ // Dump lots of information about a filter graph
+ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel);
#endif
-#define KASSERT(_x_) if (!(_x_)) \
+ #define KASSERT(_x_) if (!(_x_)) \
DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__)
-// Break on the debugger without putting up a message box
-// message goes to debugger instead
+ // Break on the debugger without putting up a message box
+ // message goes to debugger instead
-#define KDbgBreak(_x_) \
+ #define KDbgBreak(_x_) \
DbgKernelAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__)
-// We chose a common name for our ASSERT macro, MFC also uses this name
-// So long as the implementation evaluates the condition and handles it
-// then we will be ok. Rather than override the behaviour expected we
-// will leave whatever first defines ASSERT as the handler (i.e. MFC)
-#ifndef ASSERT
-#define ASSERT(_x_) if (!(_x_)) \
+ // We chose a common name for our ASSERT macro, MFC also uses this name
+ // So long as the implementation evaluates the condition and handles it
+ // then we will be ok. Rather than override the behaviour expected we
+ // will leave whatever first defines ASSERT as the handler (i.e. MFC)
+ #ifndef ASSERT
+ #define ASSERT(_x_) if (!(_x_)) \
DbgAssert(TEXT(#_x_),TEXT(__FILE__),__LINE__)
-#endif
+ #endif
-#define DbgAssertAligned( _ptr_, _alignment_ ) ASSERT( ((DWORD_PTR) (_ptr_)) % (_alignment_) == 0)
+ #define DbgAssertAligned( _ptr_, _alignment_ ) ASSERT( ((DWORD_PTR) (_ptr_)) % (_alignment_) == 0)
-// Put up a message box informing the user of a halt
-// condition in the program
+ // Put up a message box informing the user of a halt
+ // condition in the program
-#define DbgBreak(_x_) \
+ #define DbgBreak(_x_) \
DbgBreakPoint(TEXT(#_x_),TEXT(__FILE__),__LINE__)
-#define EXECUTE_ASSERT(_x_) ASSERT(_x_)
-#define DbgLog(_x_) DbgLogInfo _x_
-// MFC style trace macros
+ #define EXECUTE_ASSERT(_x_) ASSERT(_x_)
+ #define DbgLog(_x_) DbgLogInfo _x_
+ // MFC style trace macros
-#define NOTE(_x_) DbgLog((LOG_TRACE,5,TEXT(_x_)))
-#define NOTE1(_x_,a) DbgLog((LOG_TRACE,5,TEXT(_x_),a))
-#define NOTE2(_x_,a,b) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b))
-#define NOTE3(_x_,a,b,c) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c))
-#define NOTE4(_x_,a,b,c,d) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d))
-#define NOTE5(_x_,a,b,c,d,e) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d,e))
+ #define NOTE(_x_) DbgLog((LOG_TRACE,5,TEXT(_x_)))
+ #define NOTE1(_x_,a) DbgLog((LOG_TRACE,5,TEXT(_x_),a))
+ #define NOTE2(_x_,a,b) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b))
+ #define NOTE3(_x_,a,b,c) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c))
+ #define NOTE4(_x_,a,b,c,d) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d))
+ #define NOTE5(_x_,a,b,c,d,e) DbgLog((LOG_TRACE,5,TEXT(_x_),a,b,c,d,e))
#else
-// Retail builds make public debug functions inert - WARNING the source
-// files do not define or build any of the entry points in debug builds
-// (public entry points compile to nothing) so if you go trying to call
-// any of the private entry points in your source they won't compile
+ // Retail builds make public debug functions inert - WARNING the source
+ // files do not define or build any of the entry points in debug builds
+ // (public entry points compile to nothing) so if you go trying to call
+ // any of the private entry points in your source they won't compile
-#define NAME(_x_) ((LPTSTR) NULL)
+ #define NAME(_x_) ((LPTSTR) NULL)
-#define DbgInitialise(hInst)
-#define DbgTerminate()
-#define DbgLog(_x_) 0
-#define DbgOutString(psz)
-#define DbgAssertAligned( _ptr_, _alignment_ ) 0
+ #define DbgInitialise(hInst)
+ #define DbgTerminate()
+ #define DbgLog(_x_) 0
+ #define DbgOutString(psz)
+ #define DbgAssertAligned( _ptr_, _alignment_ ) 0
-#define DbgRegisterObjectCreation(pObjectName)
-#define DbgRegisterObjectDestruction(dwCookie)
-#define DbgDumpObjectRegister()
+ #define DbgRegisterObjectCreation(pObjectName)
+ #define DbgRegisterObjectDestruction(dwCookie)
+ #define DbgDumpObjectRegister()
-#define DbgCheckModuleLevel(Type,Level)
-#define DbgSetModuleLevel(Type,Level)
-#define DbgSetAutoRefreshLevels(fAuto)
+ #define DbgCheckModuleLevel(Type,Level)
+ #define DbgSetModuleLevel(Type,Level)
+ #define DbgSetAutoRefreshLevels(fAuto)
-#define DbgWaitForSingleObject(h) WaitForSingleObject(h, INFINITE)
-#define DbgWaitForMultipleObjects(nCount, lpHandles, bWaitAll) \
+ #define DbgWaitForSingleObject(h) WaitForSingleObject(h, INFINITE)
+ #define DbgWaitForMultipleObjects(nCount, lpHandles, bWaitAll) \
WaitForMultipleObjects(nCount, lpHandles, bWaitAll, INFINITE)
-#define DbgSetWaitTimeout(dwTimeout)
+ #define DbgSetWaitTimeout(dwTimeout)
-#define KDbgBreak(_x_)
-#define DbgBreak(_x_)
+ #define KDbgBreak(_x_)
+ #define DbgBreak(_x_)
-#define KASSERT(_x_) ((void)0)
-#ifndef ASSERT
-#define ASSERT(_x_) ((void)0)
-#endif
-#define EXECUTE_ASSERT(_x_) ((void)(_x_))
+ #define KASSERT(_x_) ((void)0)
+ #ifndef ASSERT
+ #define ASSERT(_x_) ((void)0)
+ #endif
+ #define EXECUTE_ASSERT(_x_) ((void)(_x_))
-// MFC style trace macros
+ // MFC style trace macros
-#define NOTE(_x_) ((void)0)
-#define NOTE1(_x_,a) ((void)0)
-#define NOTE2(_x_,a,b) ((void)0)
-#define NOTE3(_x_,a,b,c) ((void)0)
-#define NOTE4(_x_,a,b,c,d) ((void)0)
-#define NOTE5(_x_,a,b,c,d,e) ((void)0)
+ #define NOTE(_x_) ((void)0)
+ #define NOTE1(_x_,a) ((void)0)
+ #define NOTE2(_x_,a,b) ((void)0)
+ #define NOTE3(_x_,a,b,c) ((void)0)
+ #define NOTE4(_x_,a,b,c,d) ((void)0)
+ #define NOTE5(_x_,a,b,c,d,e) ((void)0)
-#define DisplayType(label, pmtIn) ((void)0)
-#define DumpGraph(pGraph, label) ((void)0)
+ #define DisplayType(label, pmtIn) ((void)0)
+ #define DumpGraph(pGraph, label) ((void)0)
#endif
@@ -248,39 +246,37 @@ void WINAPI DumpGraph(IFilterGraph *pGraph, DWORD dwLevel);
#ifdef _OBJBASE_H_
-// Outputting GUID names. If you want to include the name
-// associated with a GUID (eg CLSID_...) then
-//
-// GuidNames[yourGUID]
-//
-// Returns the name defined in uuids.h as a string
-
-typedef struct
-{
- CHAR *szName;
- GUID guid;
-} GUID_STRING_ENTRY;
-
-class CGuidNameList
-{
-public:
- CHAR *operator [](const GUID& guid);
-};
+ // Outputting GUID names. If you want to include the name
+ // associated with a GUID (eg CLSID_...) then
+ //
+ // GuidNames[yourGUID]
+ //
+ // Returns the name defined in uuids.h as a string
+
+ typedef struct {
+ CHAR *szName;
+ GUID guid;
+ } GUID_STRING_ENTRY;
+
+ class CGuidNameList {
+ public:
+ CHAR *operator [] (const GUID& guid);
+ };
-extern CGuidNameList GuidNames;
+ extern CGuidNameList GuidNames;
#endif
#ifndef REMIND
-// REMIND macro - generates warning as reminder to complete coding
-// (eg) usage:
-//
-// #pragma message (REMIND("Add automation support"))
+ // REMIND macro - generates warning as reminder to complete coding
+ // (eg) usage:
+ //
+ // #pragma message (REMIND("Add automation support"))
-#define QUOTE(x) #x
-#define QQUOTE(y) QUOTE(y)
-#define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str
+ #define QUOTE(x) #x
+ #define QQUOTE(y) QUOTE(y)
+ #define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str
#endif
// Method to display objects in a useful format
@@ -293,10 +289,7 @@ extern CGuidNameList GuidNames;
class CDispBasic
{
public:
- CDispBasic()
- {
- m_pString = m_String;
- };
+ CDispBasic() { m_pString = m_String; };
~CDispBasic();
protected:
PTCHAR m_pString; // normally points to m_String... unless too much data
@@ -336,14 +329,10 @@ private:
public:
CAutoTrace(LPCTSTR szBlkName, const int level = 15)
: _szBlkName(szBlkName), _level(level)
- {
- DbgLog((LOG_TRACE, _level, _szEntering, _szBlkName));
- }
+ {DbgLog((LOG_TRACE, _level, _szEntering, _szBlkName));}
~CAutoTrace()
- {
- DbgLog((LOG_TRACE, _level, _szLeaving, _szBlkName));
- }
+ {DbgLog((LOG_TRACE, _level, _szLeaving, _szBlkName));}
};
#if defined (__FUNCTION__)
diff --git a/src/filters/BaseClasses/wxlist.cpp b/src/filters/BaseClasses/wxlist.cpp
index d44282426..e8fda9d6c 100644
--- a/src/filters/BaseClasses/wxlist.cpp
+++ b/src/filters/BaseClasses/wxlist.cpp
@@ -155,8 +155,7 @@ void CBaseList::RemoveAll()
which point the cache will be deleted anway */
CNode *pn = m_pFirst;
- while(pn)
- {
+ while (pn) {
CNode *op = pn;
pn = pn->Next();
delete op;
@@ -219,8 +218,7 @@ __out void *CBaseList::GetNextI(__inout POSITION& rp) const
{
/* have we reached the end of the list */
- if(rp == NULL)
- {
+ if (rp == NULL) {
return NULL;
}
@@ -252,8 +250,7 @@ __out void *CBaseList::GetNextI(__inout POSITION& rp) const
*/
__out_opt void *CBaseList::GetI(__in_opt POSITION p) const
{
- if(p == NULL)
- {
+ if (p == NULL) {
return NULL;
}
@@ -275,13 +272,11 @@ __out void *CBaseList::GetValidI(__in POSITION p) const
/* Return the first position in the list which holds the given pointer.
Return NULL if it's not found.
*/
-__out_opt POSITION CBaseList::FindI(__in void * pObj) const
+__out_opt POSITION CBaseList::FindI( __in void * pObj) const
{
POSITION pn;
- INTERNALTRAVERSELIST(*this, pn)
- {
- if(GetI(pn) == pObj)
- {
+ INTERNALTRAVERSELIST(*this, pn){
+ if (GetI(pn)==pObj) {
return pn;
}
}
@@ -339,7 +334,7 @@ __out_opt void *CBaseList::RemoveI(__in_opt POSITION pos)
/* Lock the critical section before continuing */
// ASSERT (pos!=NULL); // Removing NULL is to be harmless!
- if(pos == NULL) return NULL;
+ if (pos==NULL) return NULL;
CNode *pCurrent = (CNode *) pos;
@@ -348,24 +343,18 @@ __out_opt void *CBaseList::RemoveI(__in_opt POSITION pos)
/* Update the previous node */
CNode *pNode = pCurrent->Prev();
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
m_pFirst = pCurrent->Next();
- }
- else
- {
+ } else {
pNode->SetNext(pCurrent->Next());
}
/* Update the following node */
pNode = pCurrent->Next();
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
m_pLast = pCurrent->Prev();
- }
- else
- {
+ } else {
pNode->SetPrev(pCurrent->Prev());
}
@@ -412,15 +401,13 @@ __out_opt POSITION CBaseList::AddTailI(__in void *pObject)
that otherwise we will have to create a new one */
pNode = (CNode *) m_Cache.RemoveFromCache();
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
pNode = new CNode;
}
/* Check we have a valid object */
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
return NULL;
}
@@ -432,12 +419,9 @@ __out_opt POSITION CBaseList::AddTailI(__in void *pObject)
pNode->SetNext(NULL);
pNode->SetPrev(m_pLast);
- if(m_pLast == NULL)
- {
+ if (m_pLast == NULL) {
m_pFirst = pNode;
- }
- else
- {
+ } else {
m_pLast->SetNext(pNode);
}
@@ -466,15 +450,13 @@ __out_opt POSITION CBaseList::AddHeadI(__in void *pObject)
that otherwise we will have to create a new one */
pNode = (CNode *) m_Cache.RemoveFromCache();
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
pNode = new CNode;
}
/* Check we have a valid object */
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
return NULL;
}
@@ -488,12 +470,9 @@ __out_opt POSITION CBaseList::AddHeadI(__in void *pObject)
pNode->SetPrev(NULL);
pNode->SetNext(m_pFirst);
- if(m_pFirst == NULL)
- {
+ if (m_pFirst == NULL) {
m_pLast = pNode;
- }
- else
- {
+ } else {
m_pFirst->SetPrev(pNode);
}
m_pFirst = pNode;
@@ -518,12 +497,10 @@ BOOL CBaseList::AddTail(__in CBaseList *pList)
*/
POSITION pos = pList->GetHeadPositionI();
- while(pos)
- {
- if(NULL == AddTailI(pList->GetNextI(pos)))
- {
- return FALSE;
- }
+ while (pos) {
+ if (NULL == AddTailI(pList->GetNextI(pos))) {
+ return FALSE;
+ }
}
return TRUE;
} // AddTail(list)
@@ -546,10 +523,8 @@ BOOL CBaseList::AddHead(__in CBaseList *pList)
POSITION pos;
- INTERNALREVERSETRAVERSELIST(*pList, pos)
- {
- if(NULL == AddHeadI(pList->GetValidI(pos)))
- {
+ INTERNALREVERSETRAVERSELIST(*pList, pos) {
+ if (NULL== AddHeadI(pList->GetValidI(pos))){
return FALSE;
}
}
@@ -565,7 +540,7 @@ BOOL CBaseList::AddHead(__in CBaseList *pList)
*/
__out_opt POSITION CBaseList::AddAfterI(__in_opt POSITION pos, __in void * pObj)
{
- if(pos == NULL)
+ if (pos==NULL)
return AddHeadI(pObj);
/* As someone else might be furkling with the list -
@@ -573,21 +548,19 @@ __out_opt POSITION CBaseList::AddAfterI(__in_opt POSITION pos, __in void * pObj
*/
CNode *pAfter = (CNode *) pos;
ASSERT(pAfter != NULL);
- if(pAfter == m_pLast)
+ if (pAfter==m_pLast)
return AddTailI(pObj);
/* set pnode to point to a new node, preferably from the cache */
CNode *pNode = (CNode *) m_Cache.RemoveFromCache();
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
pNode = new CNode;
}
/* Check we have a valid object */
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
return NULL;
}
@@ -620,11 +593,10 @@ __out_opt POSITION CBaseList::AddAfterI(__in_opt POSITION pos, __in void * pObj
BOOL CBaseList::AddAfter(__in_opt POSITION p, __in CBaseList *pList)
{
POSITION pos;
- INTERNALTRAVERSELIST(*pList, pos)
- {
+ INTERNALTRAVERSELIST(*pList, pos) {
/* p follows along the elements being added */
p = AddAfterI(p, pList->GetValidI(pos));
- if(p == NULL) return FALSE;
+ if (p==NULL) return FALSE;
}
return TRUE;
} // AddAfter(list)
@@ -638,26 +610,24 @@ BOOL CBaseList::AddAfter(__in_opt POSITION p, __in CBaseList *pList)
*/
__out_opt POSITION CBaseList::AddBeforeI(__in_opt POSITION pos, __in void * pObj)
{
- if(pos == NULL)
+ if (pos==NULL)
return AddTailI(pObj);
/* set pnode to point to a new node, preferably from the cache */
CNode *pBefore = (CNode *) pos;
ASSERT(pBefore != NULL);
- if(pBefore == m_pFirst)
+ if (pBefore==m_pFirst)
return AddHeadI(pObj);
CNode * pNode = (CNode *) m_Cache.RemoveFromCache();
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
pNode = new CNode;
}
/* Check we have a valid object */
- if(pNode == NULL)
- {
+ if (pNode == NULL) {
return NULL;
}
@@ -691,11 +661,10 @@ __out_opt POSITION CBaseList::AddBeforeI(__in_opt POSITION pos, __in void * pObj
BOOL CBaseList::AddBefore(__in_opt POSITION p, __in CBaseList *pList)
{
POSITION pos;
- INTERNALREVERSETRAVERSELIST(*pList, pos)
- {
+ INTERNALREVERSETRAVERSELIST(*pList, pos) {
/* p follows along the elements being added */
p = AddBeforeI(p, pList->GetValidI(pos));
- if(p == NULL) return FALSE;
+ if (p==NULL) return FALSE;
}
return TRUE;
} // AddBefore(list)
@@ -719,7 +688,7 @@ BOOL CBaseList::AddBefore(__in_opt POSITION p, __in CBaseList *pList)
MoveElementsFromHeadThroughPositionToOtherTail
*/
BOOL CBaseList::MoveToTail
-(__in_opt POSITION pos, __in CBaseList *pList)
+ (__in_opt POSITION pos, __in CBaseList *pList)
{
/* Algorithm:
Note that the elements (including their order) in the concatenation
@@ -732,39 +701,38 @@ BOOL CBaseList::MoveToTail
6. Set/Reset any events
*/
- if(pos == NULL) return TRUE; // no-op. Eliminates special cases later.
+ if (pos==NULL) return TRUE; // no-op. Eliminates special cases later.
/* Make cMove the number of nodes to move */
CNode * p = (CNode *)pos;
int cMove = 0; // number of nodes to move
- while(p != NULL)
- {
- p = p->Prev();
- ++cMove;
+ while(p!=NULL) {
+ p = p->Prev();
+ ++cMove;
}
/* Join the two chains together */
- if(pList->m_pLast != NULL)
+ if (pList->m_pLast!=NULL)
pList->m_pLast->SetNext(m_pFirst);
- if(m_pFirst != NULL)
+ if (m_pFirst!=NULL)
m_pFirst->SetPrev(pList->m_pLast);
/* set first and last pointers */
p = (CNode *)pos;
- if(pList->m_pFirst == NULL)
+ if (pList->m_pFirst==NULL)
pList->m_pFirst = m_pFirst;
m_pFirst = p->Next();
- if(m_pFirst == NULL)
+ if (m_pFirst==NULL)
m_pLast = NULL;
pList->m_pLast = p;
/* Break the chain after p to create the new pieces */
- if(m_pFirst != NULL)
+ if (m_pFirst!=NULL)
m_pFirst->SetPrev(NULL);
p->SetNext(NULL);
@@ -794,27 +762,26 @@ BOOL CBaseList::MoveToTail
concatenates foo onto the start of bar and empties foo.
*/
BOOL CBaseList::MoveToHead
-(__in_opt POSITION pos, __in CBaseList *pList)
+ (__in_opt POSITION pos, __in CBaseList *pList)
{
/* See the comments on the algorithm in MoveToTail */
- if(pos == NULL) return TRUE; // no-op. Eliminates special cases later.
+ if (pos==NULL) return TRUE; // no-op. Eliminates special cases later.
/* Make cMove the number of nodes to move */
CNode * p = (CNode *)pos;
int cMove = 0; // number of nodes to move
- while(p != NULL)
- {
- p = p->Next();
- ++cMove;
+ while(p!=NULL) {
+ p = p->Next();
+ ++cMove;
}
/* Join the two chains together */
- if(pList->m_pFirst != NULL)
+ if (pList->m_pFirst!=NULL)
pList->m_pFirst->SetPrev(m_pLast);
- if(m_pLast != NULL)
+ if (m_pLast!=NULL)
m_pLast->SetNext(pList->m_pFirst);
@@ -822,17 +789,17 @@ BOOL CBaseList::MoveToHead
p = (CNode *)pos;
- if(pList->m_pLast == NULL)
+ if (pList->m_pLast==NULL)
pList->m_pLast = m_pLast;
m_pLast = p->Prev();
- if(m_pLast == NULL)
+ if (m_pLast==NULL)
m_pFirst = NULL;
pList->m_pFirst = p;
/* Break the chain after p to create the new pieces */
- if(m_pLast != NULL)
+ if (m_pLast!=NULL)
m_pLast->SetNext(NULL);
p->SetPrev(NULL);
@@ -873,8 +840,7 @@ void CBaseList::Reverse()
// Yes we COULD use a traverse, but it would look funny!
p = m_pFirst;
- while(p != NULL)
- {
+ while (p!=NULL) {
CNode * q;
q = p->Next();
p->SetNext(p->Prev());
@@ -889,16 +855,15 @@ void CBaseList::Reverse()
#if 0 // old version
- if(m_pFirst == NULL) return; // empty list
- if(m_pFirst->Next() == NULL) return; // single node list
+ if (m_pFirst==NULL) return; // empty list
+ if (m_pFirst->Next()==NULL) return; // single node list
/* run along forward chain */
- for(p = m_pFirst
- ; p != NULL
+ for ( p = m_pFirst
+ ; p!=NULL
; p = p->Next()
- )
- {
+ ){
p->SetPrev(p->Next());
}
@@ -908,11 +873,10 @@ void CBaseList::Reverse()
/* run along new reverse chain i.e. old forward chain again */
- for(p = m_pFirst // start at the old first element
- ; p->Prev() != NULL // while there's a node still to be set
+ for ( p = m_pFirst // start at the old first element
+ ; p->Prev()!=NULL // while there's a node still to be set
; p = p->Prev() // work in the same direction as before
- )
- {
+ ){
p->Prev()->SetNext(p);
}
diff --git a/src/filters/BaseClasses/wxlist.h b/src/filters/BaseClasses/wxlist.h
index 560c1841f..900792883 100644
--- a/src/filters/BaseClasses/wxlist.h
+++ b/src/filters/BaseClasses/wxlist.h
@@ -27,33 +27,30 @@
#ifndef __WXLIST__
#define __WXLIST__
-/* A POSITION represents (in some fashion that's opaque) a cursor
- on the list that can be set to identify any element. NULL is
- a valid value and several operations regard NULL as the position
- "one step off the end of the list". (In an n element list there
- are n+1 places to insert and NULL is that "n+1-th" value).
- The POSITION of an element in the list is only invalidated if
- that element is deleted. Move operations may mean that what
- was a valid POSITION in one list is now a valid POSITION in
- a different list.
-
- Some operations which at first sight are illegal are allowed as
- harmless no-ops. For instance RemoveHead is legal on an empty
- list and it returns NULL. This allows an atomic way to test if
- there is an element there, and if so, get it. The two operations
- AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper).
-
- Single element operations return POSITIONs, non-NULL means it worked.
- whole list operations return a BOOL. TRUE means it all worked.
-
- This definition is the same as the POSITION type for MFCs, so we must
- avoid defining it twice.
-*/
+ /* A POSITION represents (in some fashion that's opaque) a cursor
+ on the list that can be set to identify any element. NULL is
+ a valid value and several operations regard NULL as the position
+ "one step off the end of the list". (In an n element list there
+ are n+1 places to insert and NULL is that "n+1-th" value).
+ The POSITION of an element in the list is only invalidated if
+ that element is deleted. Move operations may mean that what
+ was a valid POSITION in one list is now a valid POSITION in
+ a different list.
+
+ Some operations which at first sight are illegal are allowed as
+ harmless no-ops. For instance RemoveHead is legal on an empty
+ list and it returns NULL. This allows an atomic way to test if
+ there is an element there, and if so, get it. The two operations
+ AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper).
+
+ Single element operations return POSITIONs, non-NULL means it worked.
+ whole list operations return a BOOL. TRUE means it all worked.
+
+ This definition is the same as the POSITION type for MFCs, so we must
+ avoid defining it twice.
+ */
#ifndef __AFX_H__
-struct __POSITION
-{
- int unused;
-};
+struct __POSITION { int unused; };
typedef __POSITION* POSITION;
#endif
@@ -64,24 +61,22 @@ const int DEFAULTCACHE = 10; /* Default node object cache size */
to the object that it looks after.
All of these pointers can be retrieved or set through member functions.
*/
-class CBaseList
+class CBaseList
#ifdef _DEBUG
: public CBaseObject
#endif
{
/* Making these classes inherit from CBaseObject does nothing
functionally but it allows us to check there are no memory
- leaks in debug builds.
+ leaks in debug builds.
*/
public:
#ifdef _DEBUG
- class CNode : public CBaseObject
- {
+ class CNode : public CBaseObject {
#else
- class CNode
- {
+ class CNode {
#endif
CNode *m_pPrev; /* Previous node in the list */
@@ -100,59 +95,39 @@ public:
/* Return the previous node before this one */
- __out CNode *Prev() const
- {
- return m_pPrev;
- };
+ __out CNode *Prev() const { return m_pPrev; };
/* Return the next node after this one */
- __out CNode *Next() const
- {
- return m_pNext;
- };
+ __out CNode *Next() const { return m_pNext; };
/* Set the previous node before this one */
- void SetPrev(__in_opt CNode *p)
- {
- m_pPrev = p;
- };
+ void SetPrev(__in_opt CNode *p) { m_pPrev = p; };
/* Set the next node after this one */
- void SetNext(__in_opt CNode *p)
- {
- m_pNext = p;
- };
+ void SetNext(__in_opt CNode *p) { m_pNext = p; };
/* Get the pointer to the object for this node */
- __out void *GetData() const
- {
- return m_pObject;
- };
+ __out void *GetData() const { return m_pObject; };
/* Set the pointer to the object for this node */
- void SetData(__in void *p)
- {
- m_pObject = p;
- };
+ void SetData(__in void *p) { m_pObject = p; };
};
class CNodeCache
{
public:
CNodeCache(INT iCacheSize) : m_iCacheSize(iCacheSize),
- m_pHead(NULL),
- m_iUsed(0)
- {};
- ~CNodeCache()
- {
+ m_pHead(NULL),
+ m_iUsed(0)
+ {};
+ ~CNodeCache() {
CNode *pNode = m_pHead;
- while(pNode)
- {
+ while (pNode) {
CNode *pCurrent = pNode;
pNode = pNode->Next();
delete pCurrent;
@@ -160,28 +135,22 @@ public:
};
void AddToCache(__inout CNode *pNode)
{
- if(m_iUsed < m_iCacheSize)
- {
+ if (m_iUsed < m_iCacheSize) {
pNode->SetNext(m_pHead);
m_pHead = pNode;
m_iUsed++;
- }
- else
- {
+ } else {
delete pNode;
}
};
CNode *RemoveFromCache()
{
CNode *pNode = m_pHead;
- if(pNode != NULL)
- {
+ if (pNode != NULL) {
m_pHead = pNode->Next();
m_iUsed--;
ASSERT(m_iUsed >= 0);
- }
- else
- {
+ } else {
ASSERT(m_iUsed == 0);
}
return pNode;
@@ -291,8 +260,7 @@ public:
*/
__out_opt POSITION Next(__in_opt POSITION pos) const
{
- if(pos == NULL)
- {
+ if (pos == NULL) {
return (POSITION) m_pFirst;
}
CNode *pn = (CNode *) pos;
@@ -302,8 +270,7 @@ public:
// See Next
__out_opt POSITION Prev(__in_opt POSITION pos) const
{
- if(pos == NULL)
- {
+ if (pos == NULL) {
return (POSITION) m_pLast;
}
CNode *pn = (CNode *) pos;
@@ -315,7 +282,7 @@ public:
pointer. Return NULL if the pointer was not not found.
*/
protected:
- __out_opt POSITION FindI(__in void * pObj) const;
+ __out_opt POSITION FindI( __in void * pObj) const;
// ??? Should there be (or even should there be only)
// ??? POSITION FindNextAfter(void * pObj, POSITION p)
@@ -413,9 +380,9 @@ public:
Return the position of the new object, NULL if it fails
Existing POSITIONs in *this are undisturbed, including p.
*/
-protected:
+ protected:
__out_opt POSITION AddBeforeI(__in_opt POSITION p, __in void * pObj);
-public:
+ public:
/* Add the list *pList to *this before position p in *this
AddAfter(NULL,x) adds x to the start - equivalent to AddHead
@@ -512,7 +479,7 @@ public:
/* set cursor to the position of each element of list in turn */
-#define TRAVERSELIST(list, cursor) \
+ #define TRAVERSELIST(list, cursor) \
for ( cursor = (list).GetHeadPosition() \
; cursor!=NULL \
; cursor = (list).Next(cursor) \
@@ -522,7 +489,7 @@ public:
/* set cursor to the position of each element of list in turn
in reverse order
*/
-#define REVERSETRAVERSELIST(list, cursor) \
+ #define REVERSETRAVERSELIST(list, cursor) \
for ( cursor = (list).GetTailPosition() \
; cursor!=NULL \
; cursor = (list).Prev(cursor) \
@@ -537,97 +504,42 @@ public:
INT iItems,
BOOL bLock = TRUE,
BOOL bAlert = FALSE) :
- CBaseList(pName, iItems)
- {
+ CBaseList(pName, iItems) {
UNREFERENCED_PARAMETER(bAlert);
UNREFERENCED_PARAMETER(bLock);
};
CGenericList(__in_opt LPCTSTR pName) :
- CBaseList(pName)
- {
+ CBaseList(pName) {
};
- __out_opt POSITION GetHeadPosition() const
- {
- return (POSITION)m_pFirst;
- }
- __out_opt POSITION GetTailPosition() const
- {
- return (POSITION)m_pLast;
- }
- int GetCount() const
- {
- return m_Count;
- }
+ __out_opt POSITION GetHeadPosition() const { return (POSITION)m_pFirst; }
+ __out_opt POSITION GetTailPosition() const { return (POSITION)m_pLast; }
+ int GetCount() const { return m_Count; }
- __out OBJECT *GetNext(__inout POSITION& rp) const
- {
- return (OBJECT *) GetNextI(rp);
- }
+ __out OBJECT *GetNext(__inout POSITION& rp) const { return (OBJECT *) GetNextI(rp); }
- __out_opt OBJECT *Get(__in_opt POSITION p) const
- {
- return (OBJECT *) GetI(p);
- }
- __out OBJECT *GetValid(__in POSITION p) const
- {
- return (OBJECT *) GetValidI(p);
- }
- __out_opt OBJECT *GetHead() const
- {
- return Get(GetHeadPosition());
- }
+ __out_opt OBJECT *Get(__in_opt POSITION p) const { return (OBJECT *) GetI(p); }
+ __out OBJECT *GetValid(__in POSITION p) const { return (OBJECT *) GetValidI(p); }
+ __out_opt OBJECT *GetHead() const { return Get(GetHeadPosition()); }
- __out_opt OBJECT *RemoveHead()
- {
- return (OBJECT *) RemoveHeadI();
- }
+ __out_opt OBJECT *RemoveHead() { return (OBJECT *) RemoveHeadI(); }
- __out_opt OBJECT *RemoveTail()
- {
- return (OBJECT *) RemoveTailI();
- }
+ __out_opt OBJECT *RemoveTail() { return (OBJECT *) RemoveTailI(); }
- __out_opt OBJECT *Remove(__in_opt POSITION p)
- {
- return (OBJECT *) RemoveI(p);
- }
- __out_opt POSITION AddBefore(__in_opt POSITION p, __in OBJECT * pObj)
- {
- return AddBeforeI(p, pObj);
- }
- __out_opt POSITION AddAfter(__in_opt POSITION p, __in OBJECT * pObj)
- {
- return AddAfterI(p, pObj);
- }
- __out_opt POSITION AddHead(__in OBJECT * pObj)
- {
- return AddHeadI(pObj);
- }
- __out_opt POSITION AddTail(__in OBJECT * pObj)
- {
- return AddTailI(pObj);
- }
+ __out_opt OBJECT *Remove(__in_opt POSITION p) { return (OBJECT *) RemoveI(p); }
+ __out_opt POSITION AddBefore(__in_opt POSITION p, __in OBJECT * pObj) { return AddBeforeI(p, pObj); }
+ __out_opt POSITION AddAfter(__in_opt POSITION p, __in OBJECT * pObj) { return AddAfterI(p, pObj); }
+ __out_opt POSITION AddHead(__in OBJECT * pObj) { return AddHeadI(pObj); }
+ __out_opt POSITION AddTail(__in OBJECT * pObj) { return AddTailI(pObj); }
BOOL AddTail(__in CGenericList<OBJECT> *pList)
- {
- return CBaseList::AddTail((CBaseList *) pList);
- }
+ { return CBaseList::AddTail((CBaseList *) pList); }
BOOL AddHead(__in CGenericList<OBJECT> *pList)
- {
- return CBaseList::AddHead((CBaseList *) pList);
- }
+ { return CBaseList::AddHead((CBaseList *) pList); }
BOOL AddAfter(__in_opt POSITION p, __in CGenericList<OBJECT> *pList)
- {
- return CBaseList::AddAfter(p, (CBaseList *) pList);
- };
+ { return CBaseList::AddAfter(p, (CBaseList *) pList); };
BOOL AddBefore(__in_opt POSITION p, __in CGenericList<OBJECT> *pList)
- {
- return CBaseList::AddBefore(p, (CBaseList *) pList);
- };
- __out_opt POSITION Find(__in OBJECT * pObj) const
- {
- return FindI(pObj);
- }
+ { return CBaseList::AddBefore(p, (CBaseList *) pList); };
+ __out_opt POSITION Find( __in OBJECT * pObj) const { return FindI(pObj); }
}; // end of class declaration
diff --git a/src/filters/BaseClasses/wxutil.cpp b/src/filters/BaseClasses/wxutil.cpp
index 65e3c904a..271f68da0 100644
--- a/src/filters/BaseClasses/wxutil.cpp
+++ b/src/filters/BaseClasses/wxutil.cpp
@@ -17,10 +17,8 @@
CAMEvent::CAMEvent(BOOL fManualReset, __inout_opt HRESULT *phr)
{
m_hEvent = CreateEvent(NULL, fManualReset, FALSE, NULL);
- if(NULL == m_hEvent)
- {
- if(NULL != phr && SUCCEEDED(*phr))
- {
+ if (NULL == m_hEvent) {
+ if (NULL != phr && SUCCEEDED(*phr)) {
*phr = E_OUTOFMEMORY;
}
}
@@ -29,10 +27,8 @@ CAMEvent::CAMEvent(BOOL fManualReset, __inout_opt HRESULT *phr)
CAMEvent::CAMEvent(__inout_opt HRESULT *phr)
{
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- if(NULL == m_hEvent)
- {
- if(NULL != phr && SUCCEEDED(*phr))
- {
+ if (NULL == m_hEvent) {
+ if (NULL != phr && SUCCEEDED(*phr)) {
*phr = E_OUTOFMEMORY;
}
}
@@ -40,9 +36,8 @@ CAMEvent::CAMEvent(__inout_opt HRESULT *phr)
CAMEvent::~CAMEvent()
{
- if(m_hEvent)
- {
- EXECUTE_ASSERT(CloseHandle(m_hEvent));
+ if (m_hEvent) {
+ EXECUTE_ASSERT(CloseHandle(m_hEvent));
}
}
@@ -68,35 +63,30 @@ BOOL CAMMsgEvent::WaitMsg(DWORD dwTimeout)
// the timeout will eventually run down as we iterate
// processing messages. grab the start time so that
// we can calculate elapsed times.
- if(dwWaitTime != INFINITE)
- {
+ if (dwWaitTime != INFINITE) {
dwStartTime = timeGetTime();
}
- do
- {
- dwWait = MsgWaitForMultipleObjects(1, &m_hEvent, FALSE, dwWaitTime, QS_SENDMESSAGE);
- if(dwWait == WAIT_OBJECT_0 + 1)
- {
- MSG Message;
- PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE);
+ do {
+ dwWait = MsgWaitForMultipleObjects(1,&m_hEvent,FALSE, dwWaitTime, QS_SENDMESSAGE);
+ if (dwWait == WAIT_OBJECT_0 + 1) {
+ MSG Message;
+ PeekMessage(&Message,NULL,0,0,PM_NOREMOVE);
- // If we have an explicit length of time to wait calculate
- // the next wake up point - which might be now.
- // If dwTimeout is INFINITE, it stays INFINITE
- if(dwWaitTime != INFINITE)
- {
+ // If we have an explicit length of time to wait calculate
+ // the next wake up point - which might be now.
+ // If dwTimeout is INFINITE, it stays INFINITE
+ if (dwWaitTime != INFINITE) {
- DWORD dwElapsed = timeGetTime() - dwStartTime;
+ DWORD dwElapsed = timeGetTime()-dwStartTime;
- dwWaitTime =
- (dwElapsed >= dwTimeout)
- ? 0 // wake up with WAIT_TIMEOUT
- : dwTimeout - dwElapsed;
- }
+ dwWaitTime =
+ (dwElapsed >= dwTimeout)
+ ? 0 // wake up with WAIT_TIMEOUT
+ : dwTimeout-dwElapsed;
+ }
}
- }
- while(dwWait == WAIT_OBJECT_0 + 1);
+ } while (dwWait == WAIT_OBJECT_0 + 1);
// return TRUE if we woke on the event handle,
// FALSE if we timed out.
@@ -113,8 +103,7 @@ CAMThread::CAMThread(__inout_opt HRESULT *phr)
m_hThread = NULL;
}
-CAMThread::~CAMThread()
-{
+CAMThread::~CAMThread() {
Close();
}
@@ -125,8 +114,7 @@ DWORD WINAPI
CAMThread::InitialThreadProc(__inout LPVOID pv)
{
HRESULT hrCoInit = CAMThread::CoInitializeHelper();
- if(FAILED(hrCoInit))
- {
+ if(FAILED(hrCoInit)) {
DbgLog((LOG_ERROR, 1, TEXT("CoInitializeEx failed.")));
}
@@ -134,8 +122,7 @@ CAMThread::InitialThreadProc(__inout LPVOID pv)
HRESULT hr = pThread->ThreadProc();
- if(SUCCEEDED(hrCoInit))
- {
+ if(SUCCEEDED(hrCoInit)) {
CoUninitialize();
}
@@ -149,22 +136,20 @@ CAMThread::Create()
CAutoLock lock(&m_AccessLock);
- if(ThreadExists())
- {
- return FALSE;
+ if (ThreadExists()) {
+ return FALSE;
}
m_hThread = CreateThread(
- NULL,
- 0,
- CAMThread::InitialThreadProc,
- this,
- 0,
- &threadid);
-
- if(!m_hThread)
- {
- return FALSE;
+ NULL,
+ 0,
+ CAMThread::InitialThreadProc,
+ this,
+ 0,
+ &threadid);
+
+ if (!m_hThread) {
+ return FALSE;
}
return TRUE;
@@ -176,9 +161,8 @@ CAMThread::CallWorker(DWORD dwParam)
// lock access to the worker thread for scope of this object
CAutoLock lock(&m_AccessLock);
- if(!ThreadExists())
- {
- return (DWORD) E_FAIL;
+ if (!ThreadExists()) {
+ return (DWORD) E_FAIL;
}
// set the parameter
@@ -206,17 +190,13 @@ CAMThread::GetRequest()
BOOL
CAMThread::CheckRequest(__out_opt DWORD * pParam)
{
- if(!m_EventSend.Check())
- {
- return FALSE;
- }
- else
- {
- if(pParam)
- {
- *pParam = m_dwParam;
- }
- return TRUE;
+ if (!m_EventSend.Check()) {
+ return FALSE;
+ } else {
+ if (pParam) {
+ *pParam = m_dwParam;
+ }
+ return TRUE;
}
}
@@ -258,13 +238,13 @@ HRESULT CAMThread::CoInitializeHelper()
HINSTANCE hOle = GetModuleHandle(TEXT("ole32.dll"));
if(hOle)
{
- typedef HRESULT(STDAPICALLTYPE * PCoInitializeEx)(
+ typedef HRESULT (STDAPICALLTYPE *PCoInitializeEx)(
LPVOID pvReserved, DWORD dwCoInit);
PCoInitializeEx pCoInitializeEx =
(PCoInitializeEx)(GetProcAddress(hOle, "CoInitializeEx"));
if(pCoInitializeEx)
{
- hr = (*pCoInitializeEx)(0, COINIT_DISABLE_OLE1DDE);
+ hr = (*pCoInitializeEx)(0, COINIT_DISABLE_OLE1DDE );
}
}
else
@@ -281,38 +261,34 @@ HRESULT CAMThread::CoInitializeHelper()
// queue when the thread exited
CMsgThread::~CMsgThread()
{
- if(m_hThread != NULL)
- {
+ if (m_hThread != NULL) {
WaitForSingleObject(m_hThread, INFINITE);
EXECUTE_ASSERT(CloseHandle(m_hThread));
}
POSITION pos = m_ThreadQueue.GetHeadPosition();
- while(pos)
- {
+ while (pos) {
CMsg * pMsg = m_ThreadQueue.GetNext(pos);
delete pMsg;
}
m_ThreadQueue.RemoveAll();
- if(m_hSem != NULL)
- {
+ if (m_hSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hSem));
}
}
BOOL
CMsgThread::CreateThread(
-)
+ )
{
m_hSem = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL);
- if(m_hSem == NULL)
- {
+ if (m_hSem == NULL) {
return FALSE;
}
m_hThread = ::CreateThread(NULL, 0, DefaultThreadProc,
- (LPVOID)this, 0, &m_ThreadId);
+ (LPVOID)this, 0, &m_ThreadId);
return m_hThread != NULL;
}
@@ -325,7 +301,7 @@ CMsgThread::CreateThread(
DWORD WINAPI
CMsgThread::DefaultThreadProc(
__inout LPVOID lpParam
-)
+ )
{
CMsgThread *lpThis = (CMsgThread *)lpParam;
CMsg msg;
@@ -337,13 +313,11 @@ CMsgThread::DefaultThreadProc(
// allow a derived class to handle thread startup
lpThis->OnThreadInit();
- do
- {
- lpThis->GetThreadMsg(&msg);
- lResult = lpThis->ThreadMessageProc(msg.uMsg, msg.dwFlags,
- msg.lpParam, msg.pEvent);
- }
- while(lResult == 0L);
+ do {
+ lpThis->GetThreadMsg(&msg);
+ lResult = lpThis->ThreadMessageProc(msg.uMsg,msg.dwFlags,
+ msg.lpParam, msg.pEvent);
+ } while (lResult == 0L);
// !!!
CoUninitialize();
@@ -360,17 +334,13 @@ CMsgThread::GetThreadMsg(__out CMsg *msg)
CMsg * pmsg = NULL;
// keep trying until a message appears
- while(TRUE)
- {
+ while (TRUE) {
{
CAutoLock lck(&m_Lock);
pmsg = m_ThreadQueue.RemoveHead();
- if(pmsg == NULL)
- {
+ if (pmsg == NULL) {
m_lWaiting++;
- }
- else
- {
+ } else {
break;
}
}
@@ -389,18 +359,14 @@ CMsgThread::GetThreadMsg(__out CMsg *msg)
void WINAPI IntToWstr(int i, __out_ecount(12) LPWSTR wstr)
{
#ifdef UNICODE
- if(FAILED(StringCchPrintf(wstr, 12, L"%d", i)))
- {
+ if (FAILED(StringCchPrintf(wstr, 12, L"%d", i))) {
wstr[0] = 0;
}
#else
TCHAR temp[12];
- if(FAILED(StringCchPrintf(temp, NUMELMS(temp), "%d", i)))
- {
+ if (FAILED(StringCchPrintf(temp, NUMELMS(temp), "%d", i))) {
wstr[0] = 0;
- }
- else
- {
+ } else {
MultiByteToWideChar(CP_ACP, 0, temp, -1, wstr, 12);
}
#endif
@@ -416,44 +382,40 @@ void * __stdcall memmoveInternal(void * dst, const void * src, size_t count)
void * ret = dst;
#ifdef _X86_
- if(dst <= src || (char *)dst >= ((char *)src + count))
- {
+ if (dst <= src || (char *)dst >= ((char *)src + count)) {
/*
* Non-Overlapping Buffers
* copy from lower addresses to higher addresses
*/
- _asm
- {
- mov esi, src
- mov edi, dst
- mov ecx, count
+ _asm {
+ mov esi,src
+ mov edi,dst
+ mov ecx,count
cld
- mov edx, ecx
- and edx, MEMORY_ALIGNMENT_MASK
- shr ecx, MEMORY_ALIGNMENT_LOG2
+ mov edx,ecx
+ and edx,MEMORY_ALIGNMENT_MASK
+ shr ecx,MEMORY_ALIGNMENT_LOG2
rep movsd
- or ecx, edx
+ or ecx,edx
jz memmove_done
rep movsb
- memmove_done:
+memmove_done:
}
}
- else
- {
+ else {
/*
* Overlapping Buffers
* copy from higher addresses to lower addresses
*/
- _asm
- {
- mov esi, src
- mov edi, dst
- mov ecx, count
+ _asm {
+ mov esi,src
+ mov edi,dst
+ mov ecx,count
std
- add esi, ecx
- add edi, ecx
+ add esi,ecx
+ add edi,ecx
dec esi
dec edi
rep movsb
@@ -477,20 +439,20 @@ HRESULT AMSafeMemMoveOffset(
__in size_t count)
{
// prevent read overruns
- if(count + cb_src_offset < count || // prevent integer overflow
- count + cb_src_offset > src_size) // prevent read overrun
+ if( count + cb_src_offset < count || // prevent integer overflow
+ count + cb_src_offset > src_size) // prevent read overrun
{
return E_INVALIDARG;
}
// prevent write overruns
- if(count + cb_dst_offset < count || // prevent integer overflow
- count + cb_dst_offset > dst_size) // prevent write overrun
+ if( count + cb_dst_offset < count || // prevent integer overflow
+ count + cb_dst_offset > dst_size) // prevent write overrun
{
return E_INVALIDARG;
}
- memmoveInternal((BYTE *)dst + cb_dst_offset, (BYTE *)src + cb_src_offset, count);
+ memmoveInternal( (BYTE *)dst+cb_dst_offset, (BYTE *)src+cb_src_offset, count);
return S_OK;
}
@@ -521,30 +483,26 @@ CCritSec::~CCritSec()
void CCritSec::Lock()
{
- UINT tracelevel = 3;
+ UINT tracelevel=3;
DWORD us = GetCurrentThreadId();
DWORD currentOwner = m_currentOwner;
- if(currentOwner && (currentOwner != us))
- {
+ if (currentOwner && (currentOwner != us)) {
// already owned, but not by us
- if(m_fTrace)
- {
+ if (m_fTrace) {
DbgLog((LOG_LOCKING, 2, TEXT("Thread %d about to wait for lock %x owned by %d"),
- GetCurrentThreadId(), &m_CritSec, currentOwner));
- tracelevel = 2;
- // if we saw the message about waiting for the critical
- // section we ensure we see the message when we get the
- // critical section
+ GetCurrentThreadId(), &m_CritSec, currentOwner));
+ tracelevel=2;
+ // if we saw the message about waiting for the critical
+ // section we ensure we see the message when we get the
+ // critical section
}
}
EnterCriticalSection(&m_CritSec);
- if(0 == m_lockCount++)
- {
+ if (0 == m_lockCount++) {
// we now own it for the first time. Set owner information
m_currentOwner = us;
- if(m_fTrace)
- {
+ if (m_fTrace) {
DbgLog((LOG_LOCKING, tracelevel, TEXT("Thread %d now owns lock %x"), m_currentOwner, &m_CritSec));
}
}
@@ -552,33 +510,28 @@ void CCritSec::Lock()
bool CCritSec::TryLock()
{
- UINT tracelevel = 3;
+ UINT tracelevel=3;
DWORD us = GetCurrentThreadId();
DWORD currentOwner = m_currentOwner;
BOOL bSuccess = TryEnterCriticalSection(&m_CritSec);
- if(bSuccess)
- {
- if(0 == m_lockCount++)
- {
- // we now own it for the first time. Set owner information
- m_currentOwner = us;
-
- if(m_fTrace)
- {
- DbgLog((LOG_LOCKING, tracelevel, TEXT("Thread %d now owns lock %x"), m_currentOwner, &m_CritSec));
- }
- }
- }
- return bSuccess != 0;
-}
-
-void CCritSec::Unlock()
-{
- if(0 == --m_lockCount)
- {
+ if (bSuccess)
+ {
+ if (0 == m_lockCount++) {
+ // we now own it for the first time. Set owner information
+ m_currentOwner = us;
+
+ if (m_fTrace) {
+ DbgLog((LOG_LOCKING, tracelevel, TEXT("Thread %d now owns lock %x"), m_currentOwner, &m_CritSec));
+ }
+ }
+ }
+ return bSuccess != 0;
+}
+
+void CCritSec::Unlock() {
+ if (0 == --m_lockCount) {
// about to be unowned
- if(m_fTrace)
- {
+ if (m_fTrace) {
DbgLog((LOG_LOCKING, 3, TEXT("Thread %d releasing lock %x"), m_currentOwner, &m_CritSec));
}
@@ -616,16 +569,16 @@ BOOL WINAPI CritCheckOut(const CCritSec * pcCrit)
STDAPI WriteBSTR(__deref_out BSTR *pstrDest, LPCWSTR szSrc)
{
- *pstrDest = SysAllocString(szSrc);
- if(!(*pstrDest)) return E_OUTOFMEMORY;
+ *pstrDest = SysAllocString( szSrc );
+ if( !(*pstrDest) ) return E_OUTOFMEMORY;
return NOERROR;
}
STDAPI FreeBSTR(__deref_in BSTR* pstr)
{
- if((PVOID)*pstr == NULL) return S_FALSE;
- SysFreeString(*pstr);
+ if( (PVOID)*pstr == NULL ) return S_FALSE;
+ SysFreeString( *pstr );
return NOERROR;
}
@@ -642,14 +595,12 @@ STDAPI AMGetWideString(LPCWSTR psz, __deref_out LPWSTR *ppszReturn)
*ppszReturn = NULL;
size_t nameLen;
HRESULT hr = StringCbLengthW(psz, 100000, &nameLen);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
*ppszReturn = (LPWSTR)CoTaskMemAlloc(nameLen + sizeof(WCHAR));
- if(*ppszReturn == NULL)
- {
- return E_OUTOFMEMORY;
+ if (*ppszReturn == NULL) {
+ return E_OUTOFMEMORY;
}
CopyMemory(*ppszReturn, psz, nameLen + sizeof(WCHAR));
return NOERROR;
@@ -675,42 +626,35 @@ DWORD WINAPI WaitDispatchingMessages(
static UINT uMsgId = 0;
HANDLE hObjects[2] = { hObject, hEvent };
- if(dwWait != INFINITE && dwWait != 0)
- {
+ if (dwWait != INFINITE && dwWait != 0) {
dwStart = GetTickCount();
}
- for(; ;)
- {
+ for (; ; ) {
DWORD nCount = NULL != hEvent ? 2 : 1;
// Minimize the chance of actually dispatching any messages
// by seeing if we can lock immediately.
dwResult = WaitForMultipleObjects(nCount, hObjects, FALSE, 0);
- if(dwResult < WAIT_OBJECT_0 + nCount)
- {
+ if (dwResult < WAIT_OBJECT_0 + nCount) {
break;
}
DWORD dwTimeOut = dwWait;
- if(dwTimeOut > 10)
- {
+ if (dwTimeOut > 10) {
dwTimeOut = 10;
}
dwResult = MsgWaitForMultipleObjects(
- nCount,
- hObjects,
- FALSE,
- dwTimeOut,
- hwnd == NULL ? QS_SENDMESSAGE :
- QS_SENDMESSAGE + QS_POSTMESSAGE);
- if(dwResult == WAIT_OBJECT_0 + nCount ||
- dwResult == WAIT_TIMEOUT && dwTimeOut != dwWait)
- {
+ nCount,
+ hObjects,
+ FALSE,
+ dwTimeOut,
+ hwnd == NULL ? QS_SENDMESSAGE :
+ QS_SENDMESSAGE + QS_POSTMESSAGE);
+ if (dwResult == WAIT_OBJECT_0 + nCount ||
+ dwResult == WAIT_TIMEOUT && dwTimeOut != dwWait) {
MSG msg;
- if(hwnd != NULL)
- {
- while(PeekMessage(&msg, hwnd, uMsg, uMsg, PM_REMOVE))
- {
+ if (hwnd != NULL) {
+ while (PeekMessage(&msg, hwnd, uMsg, uMsg, PM_REMOVE)) {
DispatchMessage(&msg);
}
}
@@ -718,54 +662,41 @@ DWORD WINAPI WaitDispatchingMessages(
// messages
PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
- if(dwWait != INFINITE && dwWait != 0)
- {
+ if (dwWait != INFINITE && dwWait != 0) {
DWORD dwNow = GetTickCount();
// Working with differences handles wrap-around
DWORD dwDiff = dwNow - dwStart;
- if(dwDiff > dwWait)
- {
+ if (dwDiff > dwWait) {
dwWait = 0;
- }
- else
- {
+ } else {
dwWait -= dwDiff;
}
dwStart = dwNow;
}
- if(!bPeeked)
- {
+ if (!bPeeked) {
// Raise our priority to prevent our message queue
// building up
dwThreadPriority = GetThreadPriority(GetCurrentThread());
- if(dwThreadPriority < THREAD_PRIORITY_HIGHEST)
- {
+ if (dwThreadPriority < THREAD_PRIORITY_HIGHEST) {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
}
bPeeked = TRUE;
}
- }
- else
- {
+ } else {
break;
}
}
- if(bPeeked)
- {
+ if (bPeeked) {
SetThreadPriority(GetCurrentThread(), dwThreadPriority);
- if(HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE)
- {
- if(uMsgId == 0)
- {
+ if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) & QS_POSTMESSAGE) {
+ if (uMsgId == 0) {
uMsgId = RegisterWindowMessage(TEXT("AMUnblock"));
}
- if(uMsgId != 0)
- {
+ if (uMsgId != 0) {
MSG msg;
// Remove old ones
- while(PeekMessage(&msg, (HWND) - 1, uMsgId, uMsgId, PM_REMOVE))
- {
+ while (PeekMessage(&msg, (HWND)-1, uMsgId, uMsgId, PM_REMOVE)) {
}
}
PostThreadMessage(GetCurrentThreadId(), uMsgId, 0, 0);
@@ -789,9 +720,9 @@ HRESULT AmGetLastErrorToHResult()
IUnknown* QzAtlComPtrAssign(__deref_inout_opt IUnknown** pp, __in_opt IUnknown* lp)
{
- if(lp != NULL)
+ if (lp != NULL)
lp->AddRef();
- if(*pp)
+ if (*pp)
(*pp)->Release();
*pp = lp;
return lp;
@@ -806,52 +737,48 @@ timeSetEvent() if the current operating system supports it. TIME_KILL_SYNCHRONO
is supported on Windows XP and later operating systems.
Parameters:
-- The same parameters as timeSetEvent(). See timeSetEvent()'s documentation in
+- The same parameters as timeSetEvent(). See timeSetEvent()'s documentation in
the Platform SDK for more information.
Return Value:
-- The same return value as timeSetEvent(). See timeSetEvent()'s documentation in
+- The same return value as timeSetEvent(). See timeSetEvent()'s documentation in
the Platform SDK for more information.
******************************************************************************/
-MMRESULT CompatibleTimeSetEvent(UINT uDelay, UINT uResolution, __in LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent)
+MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, __in LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent )
{
-#if WINVER >= 0x0501
+ #if WINVER >= 0x0501
{
static bool fCheckedVersion = false;
- static bool fTimeKillSynchronousFlagAvailable = false;
+ static bool fTimeKillSynchronousFlagAvailable = false;
- if(!fCheckedVersion)
- {
+ if( !fCheckedVersion ) {
fTimeKillSynchronousFlagAvailable = TimeKillSynchronousFlagAvailable();
fCheckedVersion = true;
}
- if(fTimeKillSynchronousFlagAvailable)
- {
+ if( fTimeKillSynchronousFlagAvailable ) {
fuEvent = fuEvent | TIME_KILL_SYNCHRONOUS;
}
}
-#endif // WINVER >= 0x0501
+ #endif // WINVER >= 0x0501
- return timeSetEvent(uDelay, uResolution, lpTimeProc, dwUser, fuEvent);
+ return timeSetEvent( uDelay, uResolution, lpTimeProc, dwUser, fuEvent );
}
-bool TimeKillSynchronousFlagAvailable(void)
+bool TimeKillSynchronousFlagAvailable( void )
{
OSVERSIONINFO osverinfo;
osverinfo.dwOSVersionInfoSize = sizeof(osverinfo);
- if(GetVersionEx(&osverinfo))
- {
-
+ if( GetVersionEx( &osverinfo ) ) {
+
// Windows XP's major version is 5 and its' minor version is 1.
// timeSetEvent() started supporting the TIME_KILL_SYNCHRONOUS flag
// in Windows XP.
- if((osverinfo.dwMajorVersion > 5) ||
- ((osverinfo.dwMajorVersion == 5) && (osverinfo.dwMinorVersion >= 1)))
- {
+ if( (osverinfo.dwMajorVersion > 5) ||
+ ( (osverinfo.dwMajorVersion == 5) && (osverinfo.dwMinorVersion >= 1) ) ) {
return true;
}
}
diff --git a/src/filters/BaseClasses/wxutil.h b/src/filters/BaseClasses/wxutil.h
index a9e4aa4f0..caef83c56 100644
--- a/src/filters/BaseClasses/wxutil.h
+++ b/src/filters/BaseClasses/wxutil.h
@@ -15,8 +15,7 @@
#pragma warning(disable: 4705)
// wrapper for whatever critical section we have
-class CCritSec
-{
+class CCritSec {
// make copy constructor and assignment operator inaccessible
@@ -39,28 +38,24 @@ public:
#else
public:
- CCritSec()
- {
+ CCritSec() {
InitializeCriticalSection(&m_CritSec);
};
- ~CCritSec()
- {
+ ~CCritSec() {
DeleteCriticalSection(&m_CritSec);
};
- void Lock()
- {
+ void Lock() {
EnterCriticalSection(&m_CritSec);
};
- bool TryLock()
- {
+ bool TryLock()
+ {
return TryEnterCriticalSection(&m_CritSec) != 0;
};
- void Unlock()
- {
+ void Unlock() {
LeaveCriticalSection(&m_CritSec);
};
#endif
@@ -77,22 +72,21 @@ public:
//
#ifdef _DEBUG
-BOOL WINAPI CritCheckIn(CCritSec * pcCrit);
-BOOL WINAPI CritCheckIn(const CCritSec * pcCrit);
-BOOL WINAPI CritCheckOut(CCritSec * pcCrit);
-BOOL WINAPI CritCheckOut(const CCritSec * pcCrit);
-void WINAPI DbgLockTrace(CCritSec * pcCrit, BOOL fTrace);
+ BOOL WINAPI CritCheckIn(CCritSec * pcCrit);
+ BOOL WINAPI CritCheckIn(const CCritSec * pcCrit);
+ BOOL WINAPI CritCheckOut(CCritSec * pcCrit);
+ BOOL WINAPI CritCheckOut(const CCritSec * pcCrit);
+ void WINAPI DbgLockTrace(CCritSec * pcCrit, BOOL fTrace);
#else
-#define CritCheckIn(x) TRUE
-#define CritCheckOut(x) TRUE
-#define DbgLockTrace(pc, fT)
+ #define CritCheckIn(x) TRUE
+ #define CritCheckOut(x) TRUE
+ #define DbgLockTrace(pc, fT)
#endif
// locks a critical section, and unlocks it automatically
// when the lock goes out of scope
-class CAutoLock
-{
+class CAutoLock {
// make copy constructor and assignment operator inaccessible
@@ -109,8 +103,7 @@ public:
m_pLock->Lock();
};
- ~CAutoLock()
- {
+ ~CAutoLock() {
m_pLock->Unlock();
};
};
@@ -134,27 +127,14 @@ public:
~CAMEvent();
// Cast to HANDLE - we don't support this as an lvalue
- operator HANDLE() const
- {
- return m_hEvent;
- };
+ operator HANDLE () const { return m_hEvent; };
- void Set()
- {
- EXECUTE_ASSERT(SetEvent(m_hEvent));
- };
- BOOL Wait(DWORD dwTimeout = INFINITE)
- {
- return (WaitForSingleObject(m_hEvent, dwTimeout) == WAIT_OBJECT_0);
- };
- void Reset()
- {
- ResetEvent(m_hEvent);
- };
- BOOL Check()
- {
- return Wait(0);
+ void Set() {EXECUTE_ASSERT(SetEvent(m_hEvent));};
+ BOOL Wait(DWORD dwTimeout = INFINITE) {
+ return (WaitForSingleObject(m_hEvent, dwTimeout) == WAIT_OBJECT_0);
};
+ void Reset() { ResetEvent(m_hEvent); };
+ BOOL Check() { return Wait(0); };
};
@@ -181,8 +161,7 @@ public:
#ifdef AM_NOVTABLE
// simple thread class supports creation of worker thread, synchronization
// and communication. Can be derived to simplify parameter passing
-class AM_NOVTABLE CAMThread
-{
+class AM_NOVTABLE CAMThread {
// make copy constructor and assignment operator inaccessible
@@ -222,8 +201,7 @@ public:
// accessor thread calls this when done with thread (having told thread
// to exit)
- void Close()
- {
+ void Close() {
// Disable warning: Conversion from LONG to PVOID of greater size
#pragma warning(push)
@@ -231,8 +209,7 @@ public:
HANDLE hThread = (HANDLE)InterlockedExchangePointer(&m_hThread, 0);
#pragma warning(pop)
- if(hThread)
- {
+ if (hThread) {
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
@@ -242,12 +219,9 @@ public:
// Return TRUE if the thread exists. FALSE otherwise
BOOL ThreadExists(void) const
{
- if(m_hThread == 0)
- {
+ if (m_hThread == 0) {
return FALSE;
- }
- else
- {
+ } else {
return TRUE;
}
}
@@ -263,16 +237,10 @@ public:
// If you want to do WaitForMultipleObjects you'll need to include
// this handle in your wait list or you won't be responsive
- HANDLE GetRequestHandle() const
- {
- return m_EventSend;
- };
+ HANDLE GetRequestHandle() const { return m_EventSend; };
// Find out what the request was
- DWORD GetRequestParam() const
- {
- return m_dwParam;
- };
+ DWORD GetRequestParam() const { return m_dwParam; };
// call CoInitializeEx (COINIT_DISABLE_OLE1DDE) if
// available. S_FALSE means it's not available.
@@ -296,8 +264,7 @@ public:
#define DEFAULT_QUEUESIZE 2
-template <class T> class CQueue
-{
+template <class T> class CQueue {
private:
HANDLE hSemPut; // Semaphore controlling queue "putting"
HANDLE hSemGet; // Semaphore controlling queue "getting"
@@ -307,8 +274,7 @@ private:
int iNextGet; // Array index of next "GetMsg"
T *QueueObjects; // Array of objects (ptr's to void)
- void Initialize(int n)
- {
+ void Initialize(int n) {
iNextPut = iNextGet = 0;
nMax = n;
InitializeCriticalSection(&CritSect);
@@ -319,26 +285,22 @@ private:
public:
- CQueue(int n)
- {
+ CQueue(int n) {
Initialize(n);
}
- CQueue()
- {
+ CQueue() {
Initialize(DEFAULT_QUEUESIZE);
}
- ~CQueue()
- {
+ ~CQueue() {
delete [] QueueObjects;
DeleteCriticalSection(&CritSect);
CloseHandle(hSemPut);
CloseHandle(hSemGet);
}
- T GetQueueObject()
- {
+ T GetQueueObject() {
int iSlot;
T Object;
LONG lPrevious;
@@ -360,8 +322,7 @@ public:
return Object;
}
- void PutQueueObject(T Object)
- {
+ void PutQueueObject(T Object) {
int iSlot;
LONG lPrevious;
@@ -412,8 +373,7 @@ inline void * __cdecl memchrInternal(const void *buf, int chr, size_t cnt)
#ifdef _X86_
void *pRet = NULL;
- _asm
- {
+ _asm {
cld // make sure we get the direction right
mov ecx, cnt // num of bytes to scan
mov edi, buf // pointer byte stream
@@ -421,15 +381,14 @@ inline void * __cdecl memchrInternal(const void *buf, int chr, size_t cnt)
repne scasb // look for the byte in the byte stream
jnz exit_memchr // Z flag set if byte found
dec edi // scasb always increments edi even when it
- // finds the required byte
+ // finds the required byte
mov pRet, edi
- exit_memchr:
+exit_memchr:
}
return pRet;
#else
- while(cnt && (*(unsigned char *)buf != (unsigned char)chr))
- {
+ while ( cnt && (*(unsigned char *)buf != (unsigned char)chr) ) {
buf = (unsigned char *)buf + 1;
cnt--;
}
@@ -529,76 +488,42 @@ IUnknown* QzAtlComPtrAssign(__deref_inout_opt IUnknown** pp, __in_opt IUnknown*
template <class T>
class QzCComPtr
{
- public:
- typedef T _PtrClass;
- QzCComPtr()
- {
- p = NULL;
- }
- QzCComPtr(T* lp)
- {
- if((p = lp) != NULL)
- p->AddRef();
- }
- QzCComPtr(const QzCComPtr<T>& lp)
- {
- if((p = lp.p) != NULL)
- p->AddRef();
- }
- ~QzCComPtr()
- {
- if(p) p->Release();
- }
- void Release()
- {
- if(p) p->Release();
- p = NULL;
- }
- operator T*()
- {
- return (T*)p;
- }
- T& operator*()
- {
- ASSERT(p != NULL);
- return *p;
- }
- //The assert on operator& usually indicates a bug. If this is really
- //what is needed, however, take the address of the p member explicitly.
- T** operator&()
- {
- ASSERT(p == NULL);
- return &p;
- }
- T* operator->()
- {
- ASSERT(p != NULL);
- return p;
- }
- T* operator=(T* lp)
- {
- return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp);
- }
- T* operator=(const QzCComPtr<T>& lp)
- {
- return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp.p);
- }
+public:
+ typedef T _PtrClass;
+ QzCComPtr() {p=NULL;}
+ QzCComPtr(T* lp)
+ {
+ if ((p = lp) != NULL)
+ p->AddRef();
+ }
+ QzCComPtr(const QzCComPtr<T>& lp)
+ {
+ if ((p = lp.p) != NULL)
+ p->AddRef();
+ }
+ ~QzCComPtr() {if (p) p->Release();}
+ void Release() {if (p) p->Release(); p=NULL;}
+ operator T*() {return (T*)p;}
+ T& operator*() {ASSERT(p!=NULL); return *p; }
+ //The assert on operator& usually indicates a bug. If this is really
+ //what is needed, however, take the address of the p member explicitly.
+ T** operator&() { ASSERT(p==NULL); return &p; }
+ T* operator->() { ASSERT(p!=NULL); return p; }
+ T* operator=(T* lp){return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp);}
+ T* operator=(const QzCComPtr<T>& lp)
+ {
+ return (T*)QzAtlComPtrAssign((IUnknown**)&p, lp.p);
+ }
#if _MSC_VER>1020
- bool operator!()
- {
- return (p == NULL);
- }
+ bool operator!(){return (p == NULL);}
#else
- BOOL operator!()
- {
- return (p == NULL) ? TRUE : FALSE;
- }
+ BOOL operator!(){return (p == NULL) ? TRUE : FALSE;}
#endif
- T* p;
+ T* p;
};
-MMRESULT CompatibleTimeSetEvent(UINT uDelay, UINT uResolution, __in LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent);
-bool TimeKillSynchronousFlagAvailable(void);
+MMRESULT CompatibleTimeSetEvent( UINT uDelay, UINT uResolution, __in LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent );
+bool TimeKillSynchronousFlagAvailable( void );
// Helper to replace lstrcpmi
__inline int lstrcmpiLocaleIndependentW(LPCWSTR lpsz1, LPCWSTR lpsz2)
diff --git a/src/filters/FilterApp.cpp b/src/filters/FilterApp.cpp
index 3079eaab9..30cc0da63 100644
--- a/src/filters/FilterApp.cpp
+++ b/src/filters/FilterApp.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,21 +30,21 @@ CFilterApp::CFilterApp()
BOOL CFilterApp::InitInstance()
{
- if(!__super::InitInstance())
- return FALSE;
-
- SetRegistryKey(_T("Gabest"));
-
- DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0);
-
- return TRUE;
+ if(!__super::InitInstance())
+ return FALSE;
+
+ SetRegistryKey(_T("Gabest"));
+
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0);
+
+ return TRUE;
}
BOOL CFilterApp::ExitInstance()
{
- DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0);
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0);
- return __super::ExitInstance();
+ return __super::ExitInstance();
}
BEGIN_MESSAGE_MAP(CFilterApp, CWinApp)
diff --git a/src/filters/FilterApp.h b/src/filters/FilterApp.h
index e258897fa..0c95ee723 100644
--- a/src/filters/FilterApp.h
+++ b/src/filters/FilterApp.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,10 +24,10 @@
class CFilterApp : public CWinApp
{
public:
- CFilterApp();
+ CFilterApp();
- BOOL InitInstance();
- BOOL ExitInstance();
+ BOOL InitInstance();
+ BOOL ExitInstance();
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
};
diff --git a/src/filters/InternalPropertyPage.cpp b/src/filters/InternalPropertyPage.cpp
index e97b8974b..5f5f1c7c9 100644
--- a/src/filters/InternalPropertyPage.cpp
+++ b/src/filters/InternalPropertyPage.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,72 +28,72 @@
//
CInternalPropertyPageWnd::CInternalPropertyPageWnd()
- : m_fDirty(false)
- , m_fontheight(13)
+ : m_fDirty(false)
+ , m_fontheight(13)
{
}
BOOL CInternalPropertyPageWnd::Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd)
{
- if(!pPageSite || !pRect) return FALSE;
-
- m_pPageSite = pPageSite;
-
- if(!m_font.m_hObject)
- {
- CString face;
- WORD height;
- extern BOOL AFXAPI AfxGetPropSheetFont(CString & strFace, WORD & wSize, BOOL bWizard); // yay
- if(!AfxGetPropSheetFont(face, height, FALSE))
- return FALSE;
-
- LOGFONT lf;
- memset(&lf, 0, sizeof(lf));
- _tcscpy(lf.lfFaceName, face);
- HDC hDC = ::GetDC(0);
- lf.lfHeight = -MulDiv(height, GetDeviceCaps(hDC, LOGPIXELSY), 72);
- ::ReleaseDC(0, hDC);
- lf.lfWeight = FW_NORMAL;
- lf.lfCharSet = DEFAULT_CHARSET;
- if(!m_font.CreateFontIndirect(&lf))
- return FALSE;
-
- lf.lfHeight -= -1;
- _tcscpy(lf.lfFaceName, _T("Lucida Console"));
- if(!m_monospacefont.CreateFontIndirect(&lf))
- {
- _tcscpy(lf.lfFaceName, _T("Courier New"));
- if(!m_monospacefont.CreateFontIndirect(&lf))
- return FALSE;
- }
-
- hDC = ::GetDC(0);
- HFONT hFontOld = (HFONT)::SelectObject(hDC, m_font.m_hObject);
- CSize size;
- ::GetTextExtentPoint32(hDC, _T("x"), 1, &size);
- ::SelectObject(hDC, hFontOld);
- ::ReleaseDC(0, hDC);
-
- m_fontheight = size.cy;
- }
-
- LPCTSTR wc = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS, 0, (HBRUSH)(COLOR_BTNFACE + 1));
- if(!CreateEx(0, wc, _T("CInternalPropertyPageWnd"), WS_CHILDWINDOW, *pRect, pParentWnd, 0))
- return FALSE;
-
- SetFont(&m_font);
-
- return TRUE;
+ if(!pPageSite || !pRect) return FALSE;
+
+ m_pPageSite = pPageSite;
+
+ if(!m_font.m_hObject)
+ {
+ CString face;
+ WORD height;
+ extern BOOL AFXAPI AfxGetPropSheetFont(CString& strFace, WORD& wSize, BOOL bWizard); // yay
+ if(!AfxGetPropSheetFont(face, height, FALSE))
+ return FALSE;
+
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(lf));
+ _tcscpy(lf.lfFaceName, face);
+ HDC hDC = ::GetDC(0);
+ lf.lfHeight = -MulDiv(height, GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ ::ReleaseDC(0, hDC);
+ lf.lfWeight = FW_NORMAL;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ if(!m_font.CreateFontIndirect(&lf))
+ return FALSE;
+
+ lf.lfHeight -= -1;
+ _tcscpy(lf.lfFaceName, _T("Lucida Console"));
+ if(!m_monospacefont.CreateFontIndirect(&lf))
+ {
+ _tcscpy(lf.lfFaceName, _T("Courier New"));
+ if(!m_monospacefont.CreateFontIndirect(&lf))
+ return FALSE;
+ }
+
+ hDC = ::GetDC(0);
+ HFONT hFontOld = (HFONT)::SelectObject(hDC, m_font.m_hObject);
+ CSize size;
+ ::GetTextExtentPoint32(hDC, _T("x"), 1, &size);
+ ::SelectObject(hDC, hFontOld);
+ ::ReleaseDC(0, hDC);
+
+ m_fontheight = size.cy;
+ }
+
+ LPCTSTR wc = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS, 0, (HBRUSH)(COLOR_BTNFACE + 1));
+ if(!CreateEx(0, wc, _T("CInternalPropertyPageWnd"), WS_CHILDWINDOW, *pRect, pParentWnd, 0))
+ return FALSE;
+
+ SetFont(&m_font);
+
+ return TRUE;
}
BOOL CInternalPropertyPageWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
- if(message == WM_COMMAND || message == WM_HSCROLL || message == WM_VSCROLL)
- {
- SetDirty(true);
- }
+ if(message == WM_COMMAND || message == WM_HSCROLL || message == WM_VSCROLL)
+ {
+ SetDirty(true);
+ }
- return __super::OnWndMsg(message, wParam, lParam, pResult);
+ return __super::OnWndMsg(message, wParam, lParam, pResult);
}
BEGIN_MESSAGE_MAP(CInternalPropertyPageWnd, CWnd)
@@ -104,95 +104,91 @@ END_MESSAGE_MAP()
//
CInternalPropertyPage::CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr)
- : CUnknown(_T("CInternalPropertyPage"), lpunk)
- , m_pWnd(NULL)
+ : CUnknown(_T("CInternalPropertyPage"), lpunk)
+ , m_pWnd(NULL)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CInternalPropertyPage::~CInternalPropertyPage()
{
- if(m_pWnd)
- {
- if(m_pWnd->m_hWnd)
- {
- ASSERT(0);
- m_pWnd->DestroyWindow();
- }
- delete m_pWnd;
- m_pWnd = NULL;
- }
+ if(m_pWnd)
+ {
+ if(m_pWnd->m_hWnd) {ASSERT(0); m_pWnd->DestroyWindow();}
+ delete m_pWnd;
+ m_pWnd = NULL;
+ }
}
STDMETHODIMP CInternalPropertyPage::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI2(IPropertyPage)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI2(IPropertyPage)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IPropertyPage
STDMETHODIMP CInternalPropertyPage::SetPageSite(IPropertyPageSite* pPageSite)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- if(pPageSite && m_pPageSite || !pPageSite && !m_pPageSite)
- return E_UNEXPECTED;
+ if(pPageSite && m_pPageSite || !pPageSite && !m_pPageSite)
+ return E_UNEXPECTED;
- m_pPageSite = pPageSite;
+ m_pPageSite = pPageSite;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CInternalPropertyPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
CheckPointer(pRect, E_POINTER);
- if(!m_pWnd || m_pWnd->m_hWnd || m_pUnks.IsEmpty())
+ if(!m_pWnd || m_pWnd->m_hWnd || m_pUnks.IsEmpty())
return E_UNEXPECTED;
- if(!m_pWnd->Create(m_pPageSite, pRect, CWnd::FromHandle(hwndParent)))
- return E_OUTOFMEMORY;
+ if(!m_pWnd->Create(m_pPageSite, pRect, CWnd::FromHandle(hwndParent)))
+ return E_OUTOFMEMORY;
- if(!m_pWnd->OnActivate())
- {
- m_pWnd->DestroyWindow();
- return E_FAIL;
- }
+ if(!m_pWnd->OnActivate())
+ {
+ m_pWnd->DestroyWindow();
+ return E_FAIL;
+ }
- m_pWnd->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT);
- m_pWnd->ShowWindow(SW_SHOWNORMAL);
+ m_pWnd->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT);
+ m_pWnd->ShowWindow(SW_SHOWNORMAL);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CInternalPropertyPage::Deactivate()
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- if(!m_pWnd || !m_pWnd->m_hWnd)
- return E_UNEXPECTED;
+ if(!m_pWnd || !m_pWnd->m_hWnd)
+ return E_UNEXPECTED;
- m_pWnd->OnDeactivate();
+ m_pWnd->OnDeactivate();
- m_pWnd->ModifyStyleEx(WS_EX_CONTROLPARENT, 0);
- m_pWnd->DestroyWindow();
+ m_pWnd->ModifyStyleEx(WS_EX_CONTROLPARENT, 0);
+ m_pWnd->DestroyWindow();
return S_OK;
}
STDMETHODIMP CInternalPropertyPage::GetPageInfo(PROPPAGEINFO* pPageInfo)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- CheckPointer(pPageInfo, E_POINTER);
+ CheckPointer(pPageInfo, E_POINTER);
LPOLESTR pszTitle;
HRESULT hr = AMGetWideString(CStringW(GetWindowTitle()), &pszTitle);
@@ -210,107 +206,107 @@ STDMETHODIMP CInternalPropertyPage::GetPageInfo(PROPPAGEINFO* pPageInfo)
STDMETHODIMP CInternalPropertyPage::SetObjects(ULONG cObjects, LPUNKNOWN* ppUnk)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- if(cObjects && m_pWnd || !cObjects && !m_pWnd)
- return E_UNEXPECTED;
+ if(cObjects && m_pWnd || !cObjects && !m_pWnd)
+ return E_UNEXPECTED;
- m_pUnks.RemoveAll();
+ m_pUnks.RemoveAll();
- if(cObjects > 0)
- {
- CheckPointer(ppUnk, E_POINTER);
+ if(cObjects > 0)
+ {
+ CheckPointer(ppUnk, E_POINTER);
- for(ULONG i = 0; i < cObjects; i++)
- m_pUnks.AddTail(ppUnk[i]);
+ for(ULONG i = 0; i < cObjects; i++)
+ m_pUnks.AddTail(ppUnk[i]);
- if(!(m_pWnd = GetWindow()))
- return E_OUTOFMEMORY;
+ if(!(m_pWnd = GetWindow()))
+ return E_OUTOFMEMORY;
- if(!m_pWnd->OnConnect(m_pUnks))
- {
- delete m_pWnd;
- m_pWnd = NULL;
+ if(!m_pWnd->OnConnect(m_pUnks))
+ {
+ delete m_pWnd;
+ m_pWnd = NULL;
- return E_FAIL;
- }
- }
- else
- {
- m_pWnd->OnDisconnect();
+ return E_FAIL;
+ }
+ }
+ else
+ {
+ m_pWnd->OnDisconnect();
- m_pWnd->DestroyWindow();
- delete m_pWnd;
- m_pWnd = NULL;
- }
+ m_pWnd->DestroyWindow();
+ delete m_pWnd;
+ m_pWnd = NULL;
+ }
return S_OK;
}
STDMETHODIMP CInternalPropertyPage::Show(UINT nCmdShow)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- if(!m_pWnd) return E_UNEXPECTED;
+ if(!m_pWnd) return E_UNEXPECTED;
if((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE))
- return E_INVALIDARG;
+ return E_INVALIDARG;
- m_pWnd->ShowWindow(nCmdShow);
- m_pWnd->Invalidate();
+ m_pWnd->ShowWindow(nCmdShow);
+ m_pWnd->Invalidate();
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CInternalPropertyPage::Move(LPCRECT pRect)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
CheckPointer(pRect, E_POINTER);
- if(!m_pWnd) return E_UNEXPECTED;
+ if(!m_pWnd) return E_UNEXPECTED;
- m_pWnd->MoveWindow(pRect, TRUE);
+ m_pWnd->MoveWindow(pRect, TRUE);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CInternalPropertyPage::IsPageDirty()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- return m_pWnd && m_pWnd->GetDirty() ? S_OK : S_FALSE;
+ return m_pWnd && m_pWnd->GetDirty() ? S_OK : S_FALSE;
}
STDMETHODIMP CInternalPropertyPage::Apply()
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
if(!m_pWnd || m_pUnks.IsEmpty() || !m_pPageSite)
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
if(m_pWnd->GetDirty() && m_pWnd->OnApply())
- m_pWnd->SetDirty(false);
+ m_pWnd->SetDirty(false);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CInternalPropertyPage::Help(LPCWSTR lpszHelpDir)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
STDMETHODIMP CInternalPropertyPage::TranslateAccelerator(LPMSG lpMsg)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
diff --git a/src/filters/InternalPropertyPage.h b/src/filters/InternalPropertyPage.h
index f1d3fc61b..07247bd8a 100644
--- a/src/filters/InternalPropertyPage.h
+++ b/src/filters/InternalPropertyPage.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,78 +24,61 @@
#include <atlcoll.h>
[uuid("03481710-D73E-4674-839F-03EDE2D60ED8")]
-interface ISpecifyPropertyPages2 :
-public ISpecifyPropertyPages
+interface ISpecifyPropertyPages2 : public ISpecifyPropertyPages
{
- STDMETHOD(CreatePage)(const GUID& guid, IPropertyPage** ppPage) = 0;
+ STDMETHOD (CreatePage) (const GUID& guid, IPropertyPage** ppPage) = 0;
};
class CInternalPropertyPageWnd : public CWnd
{
- bool m_fDirty;
- CComPtr<IPropertyPageSite> m_pPageSite;
+ bool m_fDirty;
+ CComPtr<IPropertyPageSite> m_pPageSite;
protected:
- CFont m_font, m_monospacefont;
- int m_fontheight;
+ CFont m_font, m_monospacefont;
+ int m_fontheight;
- virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
+ virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
public:
- CInternalPropertyPageWnd();
-
- void SetDirty(bool fDirty = true)
- {
- m_fDirty = fDirty;
- if(fDirty && m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
- }
- bool GetDirty()
- {
- return m_fDirty;
- }
-
- virtual BOOL Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd);
-
- virtual bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
- {
- return true;
- }
- virtual void OnDisconnect() {}
- virtual bool OnActivate()
- {
- return true;
- }
- virtual void OnDeactivate() {}
- virtual bool OnApply()
- {
- return true;
- }
-
- DECLARE_MESSAGE_MAP()
+ CInternalPropertyPageWnd();
+
+ void SetDirty(bool fDirty = true) {m_fDirty = fDirty; if(fDirty && m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);}
+ bool GetDirty() {return m_fDirty;}
+
+ virtual BOOL Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd);
+
+ virtual bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks) {return true;}
+ virtual void OnDisconnect() {}
+ virtual bool OnActivate() {return true;}
+ virtual void OnDeactivate() {}
+ virtual bool OnApply() {return true;}
+
+ DECLARE_MESSAGE_MAP()
};
class CInternalPropertyPage
- : public CUnknown
- , public IPropertyPage
- , public CCritSec
+ : public CUnknown
+ , public IPropertyPage
+ , public CCritSec
{
- CComPtr<IPropertyPageSite> m_pPageSite;
- CInterfaceList<IUnknown, &IID_IUnknown> m_pUnks;
- CInternalPropertyPageWnd* m_pWnd;
+ CComPtr<IPropertyPageSite> m_pPageSite;
+ CInterfaceList<IUnknown, &IID_IUnknown> m_pUnks;
+ CInternalPropertyPageWnd* m_pWnd;
protected:
- virtual CInternalPropertyPageWnd* GetWindow() = 0;
- virtual LPCTSTR GetWindowTitle() = 0;
- virtual CSize GetWindowSize() = 0;
+ virtual CInternalPropertyPageWnd* GetWindow() = 0;
+ virtual LPCTSTR GetWindowTitle() = 0;
+ virtual CSize GetWindowSize() = 0;
public:
- CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CInternalPropertyPage();
+ CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CInternalPropertyPage();
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IPropertyPage
+ // IPropertyPage
STDMETHODIMP SetPageSite(IPropertyPageSite* pPageSite);
STDMETHODIMP Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal);
@@ -113,24 +96,24 @@ public:
template<class WndClass>
class CInternalPropertyPageTempl : public CInternalPropertyPage
{
- virtual CInternalPropertyPageWnd* GetWindow()
- {
- return DNew WndClass();
- }
+ virtual CInternalPropertyPageWnd* GetWindow()
+ {
+ return DNew WndClass();
+ }
- virtual LPCTSTR GetWindowTitle()
- {
- return WndClass::GetWindowTitle();
- }
+ virtual LPCTSTR GetWindowTitle()
+ {
+ return WndClass::GetWindowTitle();
+ }
- virtual CSize GetWindowSize()
- {
- return WndClass::GetWindowSize();
- }
+ virtual CSize GetWindowSize()
+ {
+ return WndClass::GetWindowSize();
+ }
public:
- CInternalPropertyPageTempl(LPUNKNOWN lpunk, HRESULT* phr)
- : CInternalPropertyPage(lpunk, phr)
- {
- }
+ CInternalPropertyPageTempl(LPUNKNOWN lpunk, HRESULT* phr)
+ : CInternalPropertyPage(lpunk, phr)
+ {
+ }
};
diff --git a/src/filters/PinInfoWnd.cpp b/src/filters/PinInfoWnd.cpp
index a64b05c3d..e2d6208b6 100644
--- a/src/filters/PinInfoWnd.cpp
+++ b/src/filters/PinInfoWnd.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,58 +33,58 @@ CPinInfoWnd::CPinInfoWnd()
bool CPinInfoWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
{
- ASSERT(!m_pBF);
-
- m_pBF.Release();
+ ASSERT(!m_pBF);
- POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pBF = pUnks.GetNext(pos)));
+ m_pBF.Release();
- if(!m_pBF) return false;
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pBF = pUnks.GetNext(pos)));
+
+ if(!m_pBF) return false;
- return true;
+ return true;
}
void CPinInfoWnd::OnDisconnect()
{
- m_pBF.Release();
+ m_pBF.Release();
}
bool CPinInfoWnd::OnActivate()
{
- DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
- CPoint p(10, 10);
+ CPoint p(10, 10);
- m_pin_static.Create(_T("Pin:"), dwStyle, CRect(p + CPoint(0, 3), CSize(30, m_fontheight)), this);
- m_pin_combo.Create(dwStyle | CBS_DROPDOWNLIST, CRect(p + CPoint(30, 0), CSize(450, 200)), this, IDC_PP_COMBO1);
- BeginEnumPins(m_pBF, pEP, pPin)
- {
- CPinInfo pi;
- if(FAILED(pPin->QueryPinInfo(&pi))) continue;
- CString str = CString(pi.achName);
- if(!str.Find(_T("Apple"))) str.Delete(0, 1);
- CString dir = _T("[?] ");
- if(pi.dir == PINDIR_INPUT) dir = _T("[IN] ");
- else if(pi.dir == PINDIR_OUTPUT) dir = _T("[OUT] ");
- m_pin_combo.SetItemDataPtr(m_pin_combo.AddString(dir + str), pPin);
- }
- EndEnumPins
- m_pin_combo.SetCurSel(0);
+ m_pin_static.Create(_T("Pin:"), dwStyle, CRect(p + CPoint(0, 3), CSize(30, m_fontheight)), this);
+ m_pin_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CPoint(30, 0), CSize(450, 200)), this, IDC_PP_COMBO1);
+ BeginEnumPins(m_pBF, pEP, pPin)
+ {
+ CPinInfo pi;
+ if(FAILED(pPin->QueryPinInfo(&pi))) continue;
+ CString str = CString(pi.achName);
+ if(!str.Find(_T("Apple"))) str.Delete(0,1);
+ CString dir = _T("[?] ");
+ if(pi.dir == PINDIR_INPUT) dir = _T("[IN] ");
+ else if(pi.dir == PINDIR_OUTPUT) dir = _T("[OUT] ");
+ m_pin_combo.SetItemDataPtr(m_pin_combo.AddString(dir + str), pPin);
+ }
+ EndEnumPins
+ m_pin_combo.SetCurSel(0);
- p.y += m_fontheight + 20;
+ p.y += m_fontheight + 20;
- m_info_edit.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), dwStyle | WS_BORDER | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY, CRect(p, CSize(480, m_fontheight * 20)), this, IDC_PP_EDIT1);
- m_info_edit.SetLimitText(60000);
+ m_info_edit.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), dwStyle|WS_BORDER|WS_VSCROLL|WS_HSCROLL|ES_MULTILINE|ES_AUTOHSCROLL|ES_READONLY, CRect(p, CSize(480, m_fontheight*20)), this, IDC_PP_EDIT1);
+ m_info_edit.SetLimitText(60000);
- OnCbnSelchangeCombo1();
+ OnCbnSelchangeCombo1();
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
- pWnd->SetFont(&m_font, FALSE);
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
- m_info_edit.SetFont(&m_monospacefont);
+ m_info_edit.SetFont(&m_monospacefont);
- return true;
+ return true;
}
void CPinInfoWnd::OnDeactivate()
@@ -93,116 +93,116 @@ void CPinInfoWnd::OnDeactivate()
bool CPinInfoWnd::OnApply()
{
- OnDeactivate();
+ OnDeactivate();
- if(m_pBF)
- {
- }
+ if(m_pBF)
+ {
+ }
- return true;
+ return true;
}
BEGIN_MESSAGE_MAP(CPinInfoWnd, CInternalPropertyPageWnd)
- ON_CBN_SELCHANGE(IDC_PP_COMBO1, OnCbnSelchangeCombo1)
+ ON_CBN_SELCHANGE(IDC_PP_COMBO1, OnCbnSelchangeCombo1)
END_MESSAGE_MAP()
void CPinInfoWnd::AddLine(CString str)
{
- str.Replace(_T("\n"), _T("\r\n"));
- int len = m_info_edit.GetWindowTextLength();
- m_info_edit.SetSel(len, len, TRUE);
- m_info_edit.ReplaceSel(str);
+ str.Replace(_T("\n"), _T("\r\n"));
+ int len = m_info_edit.GetWindowTextLength();
+ m_info_edit.SetSel(len, len, TRUE);
+ m_info_edit.ReplaceSel(str);
}
void CPinInfoWnd::OnCbnSelchangeCombo1()
{
- m_info_edit.SetWindowText(_T(""));
-
- int i = m_pin_combo.GetCurSel();
- if(i < 0) return;
-
- CComPtr<IPin> pPin = (IPin*)m_pin_combo.GetItemDataPtr(i);
- if(!pPin) return;
-
- CString str;
-
- PIN_INFO PinInfo;
- if(SUCCEEDED(pPin->QueryPinInfo(&PinInfo)))
- {
- CString strName;
- CLSID FilterClsid;
- FILTER_INFO FilterInfo;
-
- if(SUCCEEDED(PinInfo.pFilter->QueryFilterInfo(&FilterInfo)))
- {
- CRegKey key;
- PinInfo.pFilter->GetClassID(&FilterClsid);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11D0-BD40-00A0C911CE86}\\Instance\\") + CStringFromGUID(FilterClsid), KEY_READ))
- {
- ULONG len;
- TCHAR buff[128];
- len = countof(buff);
- key.QueryStringValue(_T("FriendlyName"), buff, &len);
- strName = CString(buff);
- }
- else
- strName = FilterInfo.achName;
- str.Format(_T("Filter : %s - CLSID : %s\n\n"), strName, CStringFromGUID(FilterClsid));
- AddLine(str);
- FilterInfo.pGraph->Release();
- }
- PinInfo.pFilter->Release();
- }
-
- CMediaTypeEx cmt;
-
- CComPtr<IPin> pPinTo;
- if(SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo)
- {
- str.Format(_T("- Connected to:\n\nCLSID: %s\nFilter: %s\nPin: %s\n\n"),
- CString(CStringFromGUID(GetCLSID(pPinTo))),
- CString(GetFilterName(GetFilterFromPin(pPinTo))),
- CString(GetPinName(pPinTo)));
-
- AddLine(str);
-
- AddLine(_T("- Connection media type:\n\n"));
-
- if(SUCCEEDED(pPin->ConnectionMediaType(&cmt)))
- {
- CAtlList<CString> sl;
- cmt.Dump(sl);
- POSITION pos = sl.GetHeadPosition();
- while(pos) AddLine(sl.GetNext(pos) + '\n');
- }
- }
- else
- {
- str = _T("- Not connected\n\n");
- }
-
- int iMT = 0;
-
- BeginEnumMediaTypes(pPin, pEMT, pmt)
- {
- CMediaTypeEx mt(*pmt);
-
- str.Format(_T("- Enumerated media type %d:\n\n"), iMT++);
- AddLine(str);
-
- if(cmt.majortype != GUID_NULL && mt == cmt)
- {
- AddLine(_T("Set as the current media type\n\n"));
- }
- else
- {
- CAtlList<CString> sl;
- mt.Dump(sl);
- POSITION pos = sl.GetHeadPosition();
- while(pos) AddLine(sl.GetNext(pos) + '\n');
- }
- }
- EndEnumMediaTypes(pmt)
-
- m_info_edit.SetSel(0, 0);
+ m_info_edit.SetWindowText(_T(""));
+
+ int i = m_pin_combo.GetCurSel();
+ if(i < 0) return;
+
+ CComPtr<IPin> pPin = (IPin*)m_pin_combo.GetItemDataPtr(i);
+ if(!pPin) return;
+
+ CString str;
+
+ PIN_INFO PinInfo;
+ if (SUCCEEDED (pPin->QueryPinInfo(&PinInfo)))
+ {
+ CString strName;
+ CLSID FilterClsid;
+ FILTER_INFO FilterInfo;
+
+ if (SUCCEEDED (PinInfo.pFilter->QueryFilterInfo (&FilterInfo)))
+ {
+ CRegKey key;
+ PinInfo.pFilter->GetClassID(&FilterClsid);
+ if (ERROR_SUCCESS == key.Open (HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11D0-BD40-00A0C911CE86}\\Instance\\") + CStringFromGUID(FilterClsid), KEY_READ))
+ {
+ ULONG len;
+ TCHAR buff[128];
+ len = countof(buff);
+ key.QueryStringValue(_T("FriendlyName"), buff, &len);
+ strName = CString (buff);
+ }
+ else
+ strName = FilterInfo.achName;
+ str.Format (_T("Filter : %s - CLSID : %s\n\n"), strName, CStringFromGUID(FilterClsid));
+ AddLine(str);
+ FilterInfo.pGraph->Release();
+ }
+ PinInfo.pFilter->Release();
+ }
+
+ CMediaTypeEx cmt;
+
+ CComPtr<IPin> pPinTo;
+ if(SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo)
+ {
+ str.Format(_T("- Connected to:\n\nCLSID: %s\nFilter: %s\nPin: %s\n\n"),
+ CString(CStringFromGUID(GetCLSID(pPinTo))),
+ CString(GetFilterName(GetFilterFromPin(pPinTo))),
+ CString(GetPinName(pPinTo)));
+
+ AddLine(str);
+
+ AddLine(_T("- Connection media type:\n\n"));
+
+ if(SUCCEEDED(pPin->ConnectionMediaType(&cmt)))
+ {
+ CAtlList<CString> sl;
+ cmt.Dump(sl);
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) AddLine(sl.GetNext(pos) + '\n');
+ }
+ }
+ else
+ {
+ str = _T("- Not connected\n\n");
+ }
+
+ int iMT = 0;
+
+ BeginEnumMediaTypes(pPin, pEMT, pmt)
+ {
+ CMediaTypeEx mt(*pmt);
+
+ str.Format(_T("- Enumerated media type %d:\n\n"), iMT++);
+ AddLine(str);
+
+ if(cmt.majortype != GUID_NULL && mt == cmt)
+ {
+ AddLine(_T("Set as the current media type\n\n"));
+ }
+ else
+ {
+ CAtlList<CString> sl;
+ mt.Dump(sl);
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) AddLine(sl.GetNext(pos) + '\n');
+ }
+ }
+ EndEnumMediaTypes(pmt)
+
+ m_info_edit.SetSel(0, 0);
}
diff --git a/src/filters/PinInfoWnd.h b/src/filters/PinInfoWnd.h
index e441123e4..6efa4c56b 100644
--- a/src/filters/PinInfoWnd.h
+++ b/src/filters/PinInfoWnd.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,39 +27,33 @@
[uuid("A1EB391C-6089-4A87-9988-BE50872317D4")]
class CPinInfoWnd : public CInternalPropertyPageWnd
{
- CComQIPtr<IBaseFilter> m_pBF;
+ CComQIPtr<IBaseFilter> m_pBF;
- enum
- {
- IDC_PP_COMBO1 = 10000,
- IDC_PP_EDIT1,
- };
+ enum
+ {
+ IDC_PP_COMBO1 = 10000,
+ IDC_PP_EDIT1,
+ };
- CStatic m_pin_static;
- CComboBox m_pin_combo;
- CEdit m_info_edit;
+ CStatic m_pin_static;
+ CComboBox m_pin_combo;
+ CEdit m_info_edit;
- void AddLine(CString str);
+ void AddLine(CString str);
public:
- CPinInfoWnd();
-
- bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
- void OnDisconnect();
- bool OnActivate();
- void OnDeactivate();
- bool OnApply();
+ CPinInfoWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
- static LPCTSTR GetWindowTitle()
- {
- return _T("Pin Info");
- }
- static CSize GetWindowSize()
- {
- return CSize(500, 300);
- }
+ static LPCTSTR GetWindowTitle() {return _T("Pin Info");}
+ static CSize GetWindowSize() {return CSize(500, 300);}
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
- void OnCbnSelchangeCombo1();
+ void OnCbnSelchangeCombo1();
}; \ No newline at end of file
diff --git a/src/filters/misc/SyncClock/Interfaces.h b/src/filters/misc/SyncClock/Interfaces.h
index 3d23d2075..a4bff0b25 100644
--- a/src/filters/misc/SyncClock/Interfaces.h
+++ b/src/filters/misc/SyncClock/Interfaces.h
@@ -3,12 +3,11 @@
const IID IID_ISyncClock = {0xa62888fb, 0x8e37, 0x44d2, {0x88, 0x50, 0xb3, 0xe3, 0xf2, 0xc1, 0x16, 0x9f}};
MIDL_INTERFACE("A62888FB-8E37-44d2-8850-B3E3F2C1169F")
-ISyncClock:
-public IUnknown
+ISyncClock: public IUnknown
{
public:
- virtual HRESULT STDMETHODCALLTYPE AdjustClock(DOUBLE adjustment) = 0;
- virtual HRESULT STDMETHODCALLTYPE SetBias(DOUBLE bias) = 0;
- virtual HRESULT STDMETHODCALLTYPE GetBias(DOUBLE *bias) = 0;
- virtual HRESULT STDMETHODCALLTYPE GetStartTime(REFERENCE_TIME *startTime);
+ virtual HRESULT STDMETHODCALLTYPE AdjustClock(DOUBLE adjustment) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetBias(DOUBLE bias) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetBias(DOUBLE *bias) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetStartTime(REFERENCE_TIME *startTime);
};
diff --git a/src/filters/misc/SyncClock/SyncClock.cpp b/src/filters/misc/SyncClock/SyncClock.cpp
index a351a5273..51743b592 100644
--- a/src/filters/misc/SyncClock/SyncClock.cpp
+++ b/src/filters/misc/SyncClock/SyncClock.cpp
@@ -10,12 +10,12 @@
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CSyncClockFilter), L"SyncClock", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CSyncClockFilter), L"SyncClock", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSyncClockFilter>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSyncClockFilter>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
@@ -37,8 +37,8 @@ CFilterApp theApp;
#endif
CSyncClockFilter::CSyncClockFilter(LPUNKNOWN pUnk, HRESULT *phr)
- : CBaseFilter(NAME("SyncClock"), NULL, &m_Lock, CLSID_NULL)
- , m_Clock(static_cast<IBaseFilter*>(this), phr)
+ : CBaseFilter(NAME("SyncClock"), NULL, &m_Lock, CLSID_NULL)
+ , m_Clock(static_cast<IBaseFilter*>(this), phr)
{
}
@@ -48,30 +48,30 @@ CSyncClockFilter::~CSyncClockFilter()
STDMETHODIMP CSyncClockFilter::AdjustClock(DOUBLE adjustment)
{
- m_Clock.adjustment = adjustment;
- return S_OK;
+ m_Clock.adjustment = adjustment;
+ return S_OK;
}
STDMETHODIMP CSyncClockFilter::SetBias(DOUBLE bias)
{
- m_Clock.bias = bias;
- return S_OK;
+ m_Clock.bias = bias;
+ return S_OK;
}
STDMETHODIMP CSyncClockFilter::GetBias(DOUBLE *bias)
{
- *bias = m_Clock.bias;
- return S_OK;
+ *bias = m_Clock.bias;
+ return S_OK;
}
STDMETHODIMP CSyncClockFilter::GetStartTime(REFERENCE_TIME *startTime)
{
- *startTime = m_tStart;
- return S_OK;
+ *startTime = m_tStart;
+ return S_OK;
}
-STDMETHODIMP CSyncClockFilter::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
+STDMETHODIMP CSyncClockFilter::NonDelegatingQueryInterface( REFIID riid, void ** ppv )
{
CheckPointer(ppv, E_POINTER);
@@ -79,12 +79,13 @@ STDMETHODIMP CSyncClockFilter::NonDelegatingQueryInterface(REFIID riid, void **
{
return GetInterface(static_cast<IReferenceClock*>(&m_Clock), ppv);
}
- else if(riid == IID_ISyncClock)
+ else
+ if(riid == IID_ISyncClock)
{
return GetInterface(static_cast<ISyncClock*>(this), ppv);
}
- else
- {
+ else
+ {
return CBaseFilter::NonDelegatingQueryInterface(riid, ppv);
}
}
@@ -102,39 +103,39 @@ CBasePin *CSyncClockFilter::GetPin(int i)
// CSyncClock methods
CSyncClock::CSyncClock(LPUNKNOWN pUnk, HRESULT *phr)
- : CBaseReferenceClock(NAME("SyncClock"), pUnk, phr)
- , m_pCurrentRefClock(0), m_pPrevRefClock(0)
+ : CBaseReferenceClock(NAME("SyncClock"), pUnk, phr)
+ , m_pCurrentRefClock(0), m_pPrevRefClock(0)
{
- QueryPerformanceFrequency((LARGE_INTEGER*)&m_llPerfFrequency);
+ QueryPerformanceFrequency((LARGE_INTEGER*)&m_llPerfFrequency);
m_rtPrivateTime = GetTicks100ns();
m_rtPrevTime = m_rtPrivateTime;
- adjustment = 1.0;
- bias = 1.0;
+ adjustment = 1.0;
+ bias = 1.0;
}
REFERENCE_TIME CSyncClock::GetPrivateTime()
{
CAutoLock cObjectLock(this);
- REFERENCE_TIME rtTime = GetTicks100ns();
+ REFERENCE_TIME rtTime = GetTicks100ns();
- REFERENCE_TIME delta = rtTime - m_rtPrevTime;
- // We ignore that rtTime may wrap around. Not gonna happen too often
- m_rtPrevTime = rtTime;
+ REFERENCE_TIME delta = rtTime - m_rtPrevTime;
+ // We ignore that rtTime may wrap around. Not gonna happen too often
+ m_rtPrevTime = rtTime;
- delta = (REFERENCE_TIME)((DOUBLE)delta * adjustment * bias);
- m_rtPrivateTime = m_rtPrivateTime + delta;
+ delta = (REFERENCE_TIME)((DOUBLE)delta * adjustment * bias);
+ m_rtPrivateTime = m_rtPrivateTime + delta;
return m_rtPrivateTime;
}
REFERENCE_TIME CSyncClock::GetTicks100ns()
{
- LONGLONG i64Ticks100ns;
- if(m_llPerfFrequency != 0)
- {
- QueryPerformanceCounter((LARGE_INTEGER*)&i64Ticks100ns);
- i64Ticks100ns = LONGLONG((double(i64Ticks100ns) * 10000000) / double(m_llPerfFrequency) + 0.5);
- return (REFERENCE_TIME)i64Ticks100ns;
- }
- return 0;
+ LONGLONG i64Ticks100ns;
+ if (m_llPerfFrequency != 0)
+ {
+ QueryPerformanceCounter((LARGE_INTEGER*)&i64Ticks100ns);
+ i64Ticks100ns = LONGLONG((double(i64Ticks100ns) * 10000000) / double(m_llPerfFrequency) + 0.5);
+ return (REFERENCE_TIME)i64Ticks100ns;
+ }
+ return 0;
}
diff --git a/src/filters/misc/SyncClock/SyncClock.h b/src/filters/misc/SyncClock/SyncClock.h
index d6b591bcd..54bef1292 100644
--- a/src/filters/misc/SyncClock/SyncClock.h
+++ b/src/filters/misc/SyncClock/SyncClock.h
@@ -12,22 +12,22 @@ class CSyncClock: public CBaseReferenceClock
public:
CSyncClock(LPUNKNOWN pUnk, HRESULT *phr);
- REFERENCE_TIME GetPrivateTime();
- IUnknown * pUnk()
+ REFERENCE_TIME GetPrivateTime();
+ IUnknown * pUnk()
{
- return static_cast<IUnknown*>(static_cast<IReferenceClock*>(this));
- }
- DOUBLE adjustment; // For adjusting speed temporarily
- DOUBLE bias; // For changing speed permanently
+ return static_cast<IUnknown*>(static_cast<IReferenceClock*>(this));
+ }
+ DOUBLE adjustment; // For adjusting speed temporarily
+ DOUBLE bias; // For changing speed permanently
private:
REFERENCE_TIME m_rtPrivateTime;
- LONGLONG m_llPerfFrequency;
- REFERENCE_TIME m_rtPrevTime;
+ LONGLONG m_llPerfFrequency;
+ REFERENCE_TIME m_rtPrevTime;
CCritSec m_csClock;
IReferenceClock * m_pCurrentRefClock;
IReferenceClock * m_pPrevRefClock;
- REFERENCE_TIME GetTicks100ns();
+ REFERENCE_TIME GetTicks100ns();
};
[uuid("57797fe5-ee9b-4408-98a9-20b134e7e8f0")]
@@ -35,16 +35,16 @@ class CSyncClockFilter: public ISyncClock, public CBaseFilter
{
public:
CSyncClockFilter(LPUNKNOWN pUnk, HRESULT *phr);
- virtual ~CSyncClockFilter();
+ virtual ~CSyncClockFilter();
- DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface( REFIID riid, void ** ppv);
- // ISyncClock
- STDMETHODIMP AdjustClock(DOUBLE adjustment);
- STDMETHODIMP SetBias(DOUBLE bias);
- STDMETHODIMP GetBias(DOUBLE *bias);
- STDMETHODIMP GetStartTime(REFERENCE_TIME *startTime);
+ // ISyncClock
+ STDMETHODIMP AdjustClock(DOUBLE adjustment);
+ STDMETHODIMP SetBias(DOUBLE bias);
+ STDMETHODIMP GetBias(DOUBLE *bias);
+ STDMETHODIMP GetStartTime(REFERENCE_TIME *startTime);
// CBaseFilter methods
int CSyncClockFilter::GetPinCount();
diff --git a/src/filters/misc/SyncClock/resource.h b/src/filters/misc/SyncClock/resource.h
index 0747f6fe1..840f23225 100644
--- a/src/filters/misc/SyncClock/resource.h
+++ b/src/filters/misc/SyncClock/resource.h
@@ -3,7 +3,7 @@
// Used by SyncClock.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/misc/SyncClock/stdafx.cpp b/src/filters/misc/SyncClock/stdafx.cpp
index 0385cc615..8905f2db5 100644
--- a/src/filters/misc/SyncClock/stdafx.cpp
+++ b/src/filters/misc/SyncClock/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/misc/SyncClock/stdafx.h b/src/filters/misc/SyncClock/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/misc/SyncClock/stdafx.h
+++ b/src/filters/misc/SyncClock/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxer.cpp b/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
index 7e28159f1..4ff8199f9 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxer.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,12 +27,12 @@
//
CBaseMuxerFilter::CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
- : CBaseFilter(NAME("CBaseMuxerFilter"), pUnk, this, clsid)
- , m_rtCurrent(0)
+ : CBaseFilter(NAME("CBaseMuxerFilter"), pUnk, this, clsid)
+ , m_rtCurrent(0)
{
- if(phr) *phr = S_OK;
- m_pOutput.Attach(DNew CBaseMuxerOutputPin(L"Output", this, this, phr));
- AddInput();
+ if(phr) *phr = S_OK;
+ m_pOutput.Attach(DNew CBaseMuxerOutputPin(L"Output", this, this, phr));
+ AddInput();
}
CBaseMuxerFilter::~CBaseMuxerFilter()
@@ -41,452 +41,396 @@ CBaseMuxerFilter::~CBaseMuxerFilter()
STDMETHODIMP CBaseMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
-
- *ppv = NULL;
-
- return
- QI(IMediaSeeking)
- QI(IPropertyBag)
- QI(IPropertyBag2)
- QI(IDSMPropertyBag)
- QI(IDSMResourceBag)
- QI(IDSMChapterBag)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ return
+ QI(IMediaSeeking)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ QI(IDSMResourceBag)
+ QI(IDSMChapterBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
//
void CBaseMuxerFilter::AddInput()
{
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CBasePin* pPin = m_pInputs.GetNext(pos);
- if(!pPin->IsConnected()) return;
- }
-
- CStringW name;
-
- name.Format(L"Input %d", m_pInputs.GetCount() + 1);
-
- CBaseMuxerInputPin* pInputPin = NULL;
- if(FAILED(CreateInput(name, &pInputPin)) || !pInputPin)
- {
- ASSERT(0);
- return;
- }
- CAutoPtr<CBaseMuxerInputPin> pAutoPtrInputPin(pInputPin);
-
- name.Format(L"~Output %d", m_pRawOutputs.GetCount() + 1);
-
- CBaseMuxerRawOutputPin* pRawOutputPin = NULL;
- if(FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin)
- {
- ASSERT(0);
- return;
- }
- CAutoPtr<CBaseMuxerRawOutputPin> pAutoPtrRawOutputPin(pRawOutputPin);
-
- pInputPin->SetRelatedPin(pRawOutputPin);
- pRawOutputPin->SetRelatedPin(pInputPin);
-
- m_pInputs.AddTail(pAutoPtrInputPin);
- m_pRawOutputs.AddTail(pAutoPtrRawOutputPin);
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBasePin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) return;
+ }
+
+ CStringW name;
+
+ name.Format(L"Input %d", m_pInputs.GetCount()+1);
+
+ CBaseMuxerInputPin* pInputPin = NULL;
+ if(FAILED(CreateInput(name, &pInputPin)) || !pInputPin) {ASSERT(0); return;}
+ CAutoPtr<CBaseMuxerInputPin> pAutoPtrInputPin(pInputPin);
+
+ name.Format(L"~Output %d", m_pRawOutputs.GetCount()+1);
+
+ CBaseMuxerRawOutputPin* pRawOutputPin = NULL;
+ if(FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin) {ASSERT(0); return;}
+ CAutoPtr<CBaseMuxerRawOutputPin> pAutoPtrRawOutputPin(pRawOutputPin);
+
+ pInputPin->SetRelatedPin(pRawOutputPin);
+ pRawOutputPin->SetRelatedPin(pInputPin);
+
+ m_pInputs.AddTail(pAutoPtrInputPin);
+ m_pRawOutputs.AddTail(pAutoPtrRawOutputPin);
}
HRESULT CBaseMuxerFilter::CreateInput(CStringW name, CBaseMuxerInputPin** ppPin)
{
- CheckPointer(ppPin, E_POINTER);
- HRESULT hr = S_OK;
- *ppPin = DNew CBaseMuxerInputPin(name, this, this, &hr);
- return hr;
+ CheckPointer(ppPin, E_POINTER);
+ HRESULT hr = S_OK;
+ *ppPin = DNew CBaseMuxerInputPin(name, this, this, &hr);
+ return hr;
}
HRESULT CBaseMuxerFilter::CreateRawOutput(CStringW name, CBaseMuxerRawOutputPin** ppPin)
{
- CheckPointer(ppPin, E_POINTER);
- HRESULT hr = S_OK;
- *ppPin = DNew CBaseMuxerRawOutputPin(name, this, this, &hr);
- return hr;
+ CheckPointer(ppPin, E_POINTER);
+ HRESULT hr = S_OK;
+ *ppPin = DNew CBaseMuxerRawOutputPin(name, this, this, &hr);
+ return hr;
}
//
DWORD CBaseMuxerFilter::ThreadProc()
{
- SetThreadPriority(m_hThread, THREAD_PRIORITY_ABOVE_NORMAL);
-
- POSITION pos;
-
- while(1)
- {
- DWORD cmd = GetRequest();
-
- switch(cmd)
- {
- default:
- case CMD_EXIT:
- CAMThread::m_hThread = NULL;
- Reply(S_OK);
- return 0;
-
- case CMD_RUN:
- m_pActivePins.RemoveAll();
- m_pPins.RemoveAll();
-
- pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CBaseMuxerInputPin* pPin = m_pInputs.GetNext(pos);
- if(pPin->IsConnected())
- {
- m_pActivePins.AddTail(pPin);
- m_pPins.AddTail(pPin);
- }
- }
-
- m_rtCurrent = 0;
-
- Reply(S_OK);
-
- MuxInit();
-
- try
- {
- MuxHeaderInternal();
-
- while(!CheckRequest(NULL) && m_pActivePins.GetCount())
- {
- if(m_State == State_Paused)
- {
- Sleep(10);
- continue;
- }
-
- CAutoPtr<MuxerPacket> pPacket = GetPacket();
- if(!pPacket)
- {
- Sleep(1);
- continue;
- }
-
- if(pPacket->IsTimeValid())
- m_rtCurrent = pPacket->rtStart;
-
- if(pPacket->IsEOS())
- m_pActivePins.RemoveAt(m_pActivePins.Find(pPacket->pPin));
-
- MuxPacketInternal(pPacket);
- }
-
- MuxFooterInternal();
- }
- catch(HRESULT hr)
- {
- CComQIPtr<IMediaEventSink>(m_pGraph)->Notify(EC_ERRORABORT, hr, 0);
- }
-
- m_pOutput->DeliverEndOfStream();
-
- pos = m_pRawOutputs.GetHeadPosition();
- while(pos) m_pRawOutputs.GetNext(pos)->DeliverEndOfStream();
-
- m_pActivePins.RemoveAll();
- m_pPins.RemoveAll();
-
- break;
- }
- }
-
- ASSERT(0); // this function should only return via CMD_EXIT
-
- CAMThread::m_hThread = NULL;
- return 0;
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_ABOVE_NORMAL);
+
+ POSITION pos;
+
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ return 0;
+
+ case CMD_RUN:
+ m_pActivePins.RemoveAll();
+ m_pPins.RemoveAll();
+
+ pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBaseMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(pPin->IsConnected())
+ {
+ m_pActivePins.AddTail(pPin);
+ m_pPins.AddTail(pPin);
+ }
+ }
+
+ m_rtCurrent = 0;
+
+ Reply(S_OK);
+
+ MuxInit();
+
+ try
+ {
+ MuxHeaderInternal();
+
+ while(!CheckRequest(NULL) && m_pActivePins.GetCount())
+ {
+ if(m_State == State_Paused) {Sleep(10); continue;}
+
+ CAutoPtr<MuxerPacket> pPacket = GetPacket();
+ if(!pPacket) {Sleep(1); continue;}
+
+ if(pPacket->IsTimeValid())
+ m_rtCurrent = pPacket->rtStart;
+
+ if(pPacket->IsEOS())
+ m_pActivePins.RemoveAt(m_pActivePins.Find(pPacket->pPin));
+
+ MuxPacketInternal(pPacket);
+ }
+
+ MuxFooterInternal();
+ }
+ catch(HRESULT hr)
+ {
+ CComQIPtr<IMediaEventSink>(m_pGraph)->Notify(EC_ERRORABORT, hr, 0);
+ }
+
+ m_pOutput->DeliverEndOfStream();
+
+ pos = m_pRawOutputs.GetHeadPosition();
+ while(pos) m_pRawOutputs.GetNext(pos)->DeliverEndOfStream();
+
+ m_pActivePins.RemoveAll();
+ m_pPins.RemoveAll();
+
+ break;
+ }
+ }
+
+ ASSERT(0); // this function should only return via CMD_EXIT
+
+ CAMThread::m_hThread = NULL;
+ return 0;
}
void CBaseMuxerFilter::MuxHeaderInternal()
{
- TRACE(_T("MuxHeader\n"));
+ TRACE(_T("MuxHeader\n"));
- if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
- MuxHeader(pBitStream);
+ if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
+ MuxHeader(pBitStream);
- MuxHeader();
+ MuxHeader();
- //
+ //
- POSITION pos = m_pPins.GetHeadPosition();
- while(pos)
- {
- if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
- pOutput->MuxHeader(pInput->CurrentMediaType());
- }
+ POSITION pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxHeader(pInput->CurrentMediaType());
+ }
}
void CBaseMuxerFilter::MuxPacketInternal(const MuxerPacket* pPacket)
{
- TRACE(_T("MuxPacket pPin=%x, size=%d, s%d e%d b%d, rt=(%I64d-%I64d)\n"),
- pPacket->pPin->GetID(),
- pPacket->pData.GetCount(),
- !!(pPacket->flags & MuxerPacket::syncpoint),
- !!(pPacket->flags & MuxerPacket::eos),
- !!(pPacket->flags & MuxerPacket::bogus),
- pPacket->rtStart / 10000, pPacket->rtStop / 10000);
-
- if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
- MuxPacket(pBitStream, pPacket);
-
- MuxPacket(pPacket);
-
- if(CBaseMuxerInputPin* pInput = pPacket->pPin)
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
- pOutput->MuxPacket(pInput->CurrentMediaType(), pPacket);
+ TRACE(_T("MuxPacket pPin=%x, size=%d, s%d e%d b%d, rt=(%I64d-%I64d)\n"),
+ pPacket->pPin->GetID(),
+ pPacket->pData.GetCount(),
+ !!(pPacket->flags & MuxerPacket::syncpoint),
+ !!(pPacket->flags & MuxerPacket::eos),
+ !!(pPacket->flags & MuxerPacket::bogus),
+ pPacket->rtStart/10000, pPacket->rtStop/10000);
+
+ if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
+ MuxPacket(pBitStream, pPacket);
+
+ MuxPacket(pPacket);
+
+ if(CBaseMuxerInputPin* pInput = pPacket->pPin)
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxPacket(pInput->CurrentMediaType(), pPacket);
}
void CBaseMuxerFilter::MuxFooterInternal()
{
- TRACE(_T("MuxFooter\n"));
-
- if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
- MuxFooter(pBitStream);
+ TRACE(_T("MuxFooter\n"));
+
+ if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
+ MuxFooter(pBitStream);
- MuxFooter();
+ MuxFooter();
- //
+ //
- POSITION pos = m_pPins.GetHeadPosition();
- while(pos)
- {
- if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
- if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
- pOutput->MuxFooter(pInput->CurrentMediaType());
- }
+ POSITION pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxFooter(pInput->CurrentMediaType());
+ }
}
CAutoPtr<MuxerPacket> CBaseMuxerFilter::GetPacket()
{
- REFERENCE_TIME rtMin = _I64_MAX;
- CBaseMuxerInputPin* pPinMin = NULL;
- int i = int(m_pActivePins.GetCount());
-
- POSITION pos = m_pActivePins.GetHeadPosition();
- while(pos)
- {
- CBaseMuxerInputPin* pPin = m_pActivePins.GetNext(pos);
-
- CAutoLock cAutoLock(&pPin->m_csQueue);
- if(!pPin->m_queue.GetCount()) continue;
-
- MuxerPacket* p = pPin->m_queue.GetHead();
-
- if(p->IsBogus() || !p->IsTimeValid() || p->IsEOS())
- {
- pPinMin = pPin;
- i = 0;
- break;
- }
-
- if(p->rtStart < rtMin)
- {
- rtMin = p->rtStart;
- pPinMin = pPin;
- }
-
- i--;
- }
-
- CAutoPtr<MuxerPacket> pPacket;
-
- if(pPinMin && i == 0)
- {
- pPacket = pPinMin->PopPacket();
- }
- else
- {
- pos = m_pActivePins.GetHeadPosition();
- while(pos) m_pActivePins.GetNext(pos)->m_evAcceptPacket.Set();
- }
-
- return pPacket;
+ REFERENCE_TIME rtMin = _I64_MAX;
+ CBaseMuxerInputPin* pPinMin = NULL;
+ int i = int(m_pActivePins.GetCount());
+
+ POSITION pos = m_pActivePins.GetHeadPosition();
+ while(pos)
+ {
+ CBaseMuxerInputPin* pPin = m_pActivePins.GetNext(pos);
+
+ CAutoLock cAutoLock(&pPin->m_csQueue);
+ if(!pPin->m_queue.GetCount()) continue;
+
+ MuxerPacket* p = pPin->m_queue.GetHead();
+
+ if(p->IsBogus() || !p->IsTimeValid() || p->IsEOS())
+ {
+ pPinMin = pPin;
+ i = 0;
+ break;
+ }
+
+ if(p->rtStart < rtMin)
+ {
+ rtMin = p->rtStart;
+ pPinMin = pPin;
+ }
+
+ i--;
+ }
+
+ CAutoPtr<MuxerPacket> pPacket;
+
+ if(pPinMin && i == 0)
+ {
+ pPacket = pPinMin->PopPacket();
+ }
+ else
+ {
+ pos = m_pActivePins.GetHeadPosition();
+ while(pos) m_pActivePins.GetNext(pos)->m_evAcceptPacket.Set();
+ }
+
+ return pPacket;
}
//
int CBaseMuxerFilter::GetPinCount()
{
- return int(m_pInputs.GetCount()) + (m_pOutput ? 1 : 0) + int(m_pRawOutputs.GetCount());
+ return int(m_pInputs.GetCount()) + (m_pOutput ? 1 : 0) + int(m_pRawOutputs.GetCount());
}
CBasePin* CBaseMuxerFilter::GetPin(int n)
{
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pInputs.GetCount())
- {
- if(POSITION pos = m_pInputs.FindIndex(n))
- return m_pInputs.GetAt(pos);
- }
+ if(n >= 0 && n < (int)m_pInputs.GetCount())
+ {
+ if(POSITION pos = m_pInputs.FindIndex(n))
+ return m_pInputs.GetAt(pos);
+ }
- n -= int(m_pInputs.GetCount());
+ n -= int(m_pInputs.GetCount());
- if(n == 0 && m_pOutput)
- {
- return m_pOutput;
- }
+ if(n == 0 && m_pOutput)
+ {
+ return m_pOutput;
+ }
- n--;
+ n--;
- if(n >= 0 && n < (int)m_pRawOutputs.GetCount())
- {
- if(POSITION pos = m_pRawOutputs.FindIndex(n))
- return m_pRawOutputs.GetAt(pos);
- }
+ if(n >= 0 && n < (int)m_pRawOutputs.GetCount())
+ {
+ if(POSITION pos = m_pRawOutputs.FindIndex(n))
+ return m_pRawOutputs.GetAt(pos);
+ }
- n -= int(m_pRawOutputs.GetCount());
+ n -= int(m_pRawOutputs.GetCount());
- return NULL;
+ return NULL;
}
STDMETHODIMP CBaseMuxerFilter::Stop()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- HRESULT hr = __super::Stop();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::Stop();
+ if(FAILED(hr)) return hr;
- CallWorker(CMD_EXIT);
+ CallWorker(CMD_EXIT);
- return hr;
+ return hr;
}
STDMETHODIMP CBaseMuxerFilter::Pause()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- FILTER_STATE fs = m_State;
+ FILTER_STATE fs = m_State;
- HRESULT hr = __super::Pause();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::Pause();
+ if(FAILED(hr)) return hr;
- if(fs == State_Stopped && m_pOutput)
- {
- CAMThread::Create();
- CallWorker(CMD_RUN);
- }
+ if(fs == State_Stopped && m_pOutput)
+ {
+ CAMThread::Create();
+ CallWorker(CMD_RUN);
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CBaseMuxerFilter::Run(REFERENCE_TIME tStart)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- HRESULT hr = __super::Run(tStart);
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::Run(tStart);
+ if(FAILED(hr)) return hr;
- return hr;
+ return hr;
}
// IMediaSeeking
STDMETHODIMP CBaseMuxerFilter::GetCapabilities(DWORD* pCapabilities)
{
- return pCapabilities ? *pCapabilities = AM_SEEKING_CanGetDuration | AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
+ return pCapabilities ? *pCapabilities = AM_SEEKING_CanGetDuration|AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
}
STDMETHODIMP CBaseMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
{
- CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) return S_OK;
- DWORD caps;
- GetCapabilities(&caps);
- caps &= *pCapabilities;
- return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
-}
-STDMETHODIMP CBaseMuxerFilter::IsFormatSupported(const GUID* pFormat)
-{
- return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
-}
-STDMETHODIMP CBaseMuxerFilter::QueryPreferredFormat(GUID* pFormat)
-{
- return GetTimeFormat(pFormat);
-}
-STDMETHODIMP CBaseMuxerFilter::GetTimeFormat(GUID* pFormat)
-{
- return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
-}
-STDMETHODIMP CBaseMuxerFilter::IsUsingTimeFormat(const GUID* pFormat)
-{
- return IsFormatSupported(pFormat);
-}
-STDMETHODIMP CBaseMuxerFilter::SetTimeFormat(const GUID* pFormat)
-{
- return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
-}
+ CheckPointer(pCapabilities, E_POINTER);
+ if(*pCapabilities == 0) return S_OK;
+ DWORD caps;
+ GetCapabilities(&caps);
+ caps &= *pCapabilities;
+ return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
+}
+STDMETHODIMP CBaseMuxerFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
+STDMETHODIMP CBaseMuxerFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
+STDMETHODIMP CBaseMuxerFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
+STDMETHODIMP CBaseMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
+STDMETHODIMP CBaseMuxerFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
STDMETHODIMP CBaseMuxerFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- *pDuration = 0;
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- REFERENCE_TIME rt = m_pInputs.GetNext(pos)->GetDuration();
- if(rt > *pDuration) *pDuration = rt;
- }
- return S_OK;
-}
-STDMETHODIMP CBaseMuxerFilter::GetStopPosition(LONGLONG* pStop)
-{
- return E_NOTIMPL;
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = 0;
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos) {REFERENCE_TIME rt = m_pInputs.GetNext(pos)->GetDuration(); if(rt > *pDuration) *pDuration = rt;}
+ return S_OK;
}
+STDMETHODIMP CBaseMuxerFilter::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
STDMETHODIMP CBaseMuxerFilter::GetCurrentPosition(LONGLONG* pCurrent)
{
- CheckPointer(pCurrent, E_POINTER);
- *pCurrent = m_rtCurrent;
- return S_OK;
-}
-STDMETHODIMP CBaseMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
-{
- return E_NOTIMPL;
+ CheckPointer(pCurrent, E_POINTER);
+ *pCurrent = m_rtCurrent;
+ return S_OK;
}
+STDMETHODIMP CBaseMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
STDMETHODIMP CBaseMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- FILTER_STATE fs;
-
- if(SUCCEEDED(GetState(0, &fs)) && fs == State_Stopped)
- {
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CBasePin* pPin = m_pInputs.GetNext(pos);
- CComQIPtr<IMediaSeeking> pMS = pPin->GetConnected();
- if(!pMS) pMS = GetFilterFromPin(pPin->GetConnected());
- if(pMS) pMS->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags);
- }
-
- return S_OK;
- }
-
- return VFW_E_WRONG_STATE;
-}
-STDMETHODIMP CBaseMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CBaseMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CBaseMuxerFilter::SetRate(double dRate)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CBaseMuxerFilter::GetRate(double* pdRate)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CBaseMuxerFilter::GetPreroll(LONGLONG* pllPreroll)
-{
- return E_NOTIMPL;
-}
+ FILTER_STATE fs;
+
+ if(SUCCEEDED(GetState(0, &fs)) && fs == State_Stopped)
+ {
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBasePin* pPin = m_pInputs.GetNext(pos);
+ CComQIPtr<IMediaSeeking> pMS = pPin->GetConnected();
+ if(!pMS) pMS = GetFilterFromPin(pPin->GetConnected());
+ if(pMS) pMS->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+ }
+
+ return S_OK;
+ }
+
+ return VFW_E_WRONG_STATE;
+}
+STDMETHODIMP CBaseMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxer.h b/src/filters/muxer/BaseMuxer/BaseMuxer.h
index ce89c3af2..71aed60fa 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxer.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxer.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,88 +25,85 @@
#include "BaseMuxerOutputPin.h"
class CBaseMuxerFilter
- : public CBaseFilter
- , public CCritSec
- , public CAMThread
- , public IMediaSeeking
- , public IDSMPropertyBagImpl
- , public IDSMResourceBagImpl
- , public IDSMChapterBagImpl
+ : public CBaseFilter
+ , public CCritSec
+ , public CAMThread
+ , public IMediaSeeking
+ , public IDSMPropertyBagImpl
+ , public IDSMResourceBagImpl
+ , public IDSMChapterBagImpl
{
private:
- CAutoPtrList<CBaseMuxerInputPin> m_pInputs;
- CAutoPtr<CBaseMuxerOutputPin> m_pOutput;
- CAutoPtrList<CBaseMuxerRawOutputPin> m_pRawOutputs;
+ CAutoPtrList<CBaseMuxerInputPin> m_pInputs;
+ CAutoPtr<CBaseMuxerOutputPin> m_pOutput;
+ CAutoPtrList<CBaseMuxerRawOutputPin> m_pRawOutputs;
- enum {CMD_EXIT, CMD_RUN};
- DWORD ThreadProc();
+ enum {CMD_EXIT, CMD_RUN};
+ DWORD ThreadProc();
- REFERENCE_TIME m_rtCurrent;
- CAtlList<CBaseMuxerInputPin*> m_pActivePins;
+ REFERENCE_TIME m_rtCurrent;
+ CAtlList<CBaseMuxerInputPin*> m_pActivePins;
- CAutoPtr<MuxerPacket> GetPacket();
+ CAutoPtr<MuxerPacket> GetPacket();
- void MuxHeaderInternal();
- void MuxPacketInternal(const MuxerPacket* pPacket);
- void MuxFooterInternal();
+ void MuxHeaderInternal();
+ void MuxPacketInternal(const MuxerPacket* pPacket);
+ void MuxFooterInternal();
protected:
- CAtlList<CBaseMuxerInputPin*> m_pPins;
- CBaseMuxerOutputPin* GetOutputPin()
- {
- return m_pOutput;
- }
+ CAtlList<CBaseMuxerInputPin*> m_pPins;
+ CBaseMuxerOutputPin* GetOutputPin() {return m_pOutput;}
- virtual void MuxInit() = 0;
+ virtual void MuxInit() = 0;
- // only called when the output pin is connected
- virtual void MuxHeader(IBitStream* pBS) {}
- virtual void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket) {}
- virtual void MuxFooter(IBitStream* pBS) {}
+ // only called when the output pin is connected
+ virtual void MuxHeader(IBitStream* pBS) {}
+ virtual void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket) {}
+ virtual void MuxFooter(IBitStream* pBS) {}
- // always called (useful if the derived class wants to write somewhere else than downstream)
- virtual void MuxHeader() {}
- virtual void MuxPacket(const MuxerPacket* pPacket) {}
- virtual void MuxFooter() {}
+ // always called (useful if the derived class wants to write somewhere else than downstream)
+ virtual void MuxHeader() {}
+ virtual void MuxPacket(const MuxerPacket* pPacket) {}
+ virtual void MuxFooter() {}
- // allows customized pins in derived classes
- virtual HRESULT CreateInput(CStringW name, CBaseMuxerInputPin** ppPin);
- virtual HRESULT CreateRawOutput(CStringW name, CBaseMuxerRawOutputPin** ppPin);
+ // allows customized pins in derived classes
+ virtual HRESULT CreateInput(CStringW name, CBaseMuxerInputPin** ppPin);
+ virtual HRESULT CreateRawOutput(CStringW name, CBaseMuxerRawOutputPin** ppPin);
public:
- CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
- virtual ~CBaseMuxerFilter();
+ CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CBaseMuxerFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- void AddInput();
-
- int GetPinCount();
- CBasePin* GetPin(int n);
-
- STDMETHODIMP Stop();
- STDMETHODIMP Pause();
- STDMETHODIMP Run(REFERENCE_TIME tStart);
-
- // IMediaSeeking
-
- STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
- STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(double* pdRate);
- STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+ void AddInput();
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
};
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
index 4eb5d5cae..4aa1bedb9 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,13 +33,13 @@
//
CBaseMuxerInputPin::CBaseMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseInputPin(NAME("CBaseMuxerInputPin"), pFilter, pLock, phr, pName)
- , m_rtDuration(0)
- , m_evAcceptPacket(TRUE)
- , m_iPacketIndex(0)
+ : CBaseInputPin(NAME("CBaseMuxerInputPin"), pFilter, pLock, phr, pName)
+ , m_rtDuration(0)
+ , m_evAcceptPacket(TRUE)
+ , m_iPacketIndex(0)
{
- static int s_iID = 0;
- m_iID = s_iID++;
+ static int s_iID = 0;
+ m_iID = s_iID++;
}
CBaseMuxerInputPin::~CBaseMuxerInputPin()
@@ -48,232 +48,232 @@ CBaseMuxerInputPin::~CBaseMuxerInputPin()
STDMETHODIMP CBaseMuxerInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
-
- return
- QI(IBaseMuxerRelatedPin)
- QI(IPropertyBag)
- QI(IPropertyBag2)
- QI(IDSMPropertyBag)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IBaseMuxerRelatedPin)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
bool CBaseMuxerInputPin::IsSubtitleStream()
{
- return m_mt.majortype == MEDIATYPE_Subtitle || m_mt.majortype == MEDIATYPE_Text;
+ return m_mt.majortype == MEDIATYPE_Subtitle || m_mt.majortype == MEDIATYPE_Text;
}
void CBaseMuxerInputPin::PushPacket(CAutoPtr<MuxerPacket> pPacket)
{
- for(int i = 0; m_pFilter->IsActive() && !m_bFlushing
- && !m_evAcceptPacket.Wait(1)
- && i < 1000;
- i++);
+ for(int i = 0; m_pFilter->IsActive() && !m_bFlushing
+ && !m_evAcceptPacket.Wait(1)
+ && i < 1000;
+ i++);
- if(!m_pFilter->IsActive() || m_bFlushing)
- return;
+ if(!m_pFilter->IsActive() || m_bFlushing)
+ return;
- CAutoLock cAutoLock(&m_csQueue);
+ CAutoLock cAutoLock(&m_csQueue);
- m_queue.AddTail(pPacket);
+ m_queue.AddTail(pPacket);
- if(m_queue.GetCount() >= MAXQUEUESIZE)
- m_evAcceptPacket.Reset();
+ if(m_queue.GetCount() >= MAXQUEUESIZE)
+ m_evAcceptPacket.Reset();
}
CAutoPtr<MuxerPacket> CBaseMuxerInputPin::PopPacket()
{
- CAutoPtr<MuxerPacket> pPacket;
+ CAutoPtr<MuxerPacket> pPacket;
- CAutoLock cAutoLock(&m_csQueue);
+ CAutoLock cAutoLock(&m_csQueue);
- if(m_queue.GetCount())
- pPacket = m_queue.RemoveHead();
+ if(m_queue.GetCount())
+ pPacket = m_queue.RemoveHead();
- if(m_queue.GetCount() < MAXQUEUESIZE)
- m_evAcceptPacket.Set();
+ if(m_queue.GetCount() < MAXQUEUESIZE)
+ m_evAcceptPacket.Set();
- return pPacket;
+ return pPacket;
}
HRESULT CBaseMuxerInputPin::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->formattype == FORMAT_WaveFormatEx)
- {
- WORD wFormatTag = ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag;
- if((wFormatTag == WAVE_FORMAT_PCM
- || wFormatTag == WAVE_FORMAT_EXTENSIBLE
- || wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
- && pmt->subtype != FOURCCMap(wFormatTag)
- && !(pmt->subtype == MEDIASUBTYPE_PCM && wFormatTag == WAVE_FORMAT_EXTENSIBLE)
- && !(pmt->subtype == MEDIASUBTYPE_PCM && wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
- && pmt->subtype != MEDIASUBTYPE_DVD_LPCM_AUDIO
- && pmt->subtype != MEDIASUBTYPE_DOLBY_AC3
- && pmt->subtype != MEDIASUBTYPE_DTS)
- {
- return E_INVALIDARG;
- }
- }
-
- return pmt->majortype == MEDIATYPE_Video
- || pmt->majortype == MEDIATYPE_Audio && pmt->formattype != FORMAT_VorbisFormat
- || pmt->majortype == MEDIATYPE_Text && pmt->subtype == MEDIASUBTYPE_NULL && pmt->formattype == FORMAT_None
- || pmt->majortype == MEDIATYPE_Subtitle
- ? S_OK
- : E_INVALIDARG;
+ if(pmt->formattype == FORMAT_WaveFormatEx)
+ {
+ WORD wFormatTag = ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag;
+ if((wFormatTag == WAVE_FORMAT_PCM
+ || wFormatTag == WAVE_FORMAT_EXTENSIBLE
+ || wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
+ && pmt->subtype != FOURCCMap(wFormatTag)
+ && !(pmt->subtype == MEDIASUBTYPE_PCM && wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ && !(pmt->subtype == MEDIASUBTYPE_PCM && wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
+ && pmt->subtype != MEDIASUBTYPE_DVD_LPCM_AUDIO
+ && pmt->subtype != MEDIASUBTYPE_DOLBY_AC3
+ && pmt->subtype != MEDIASUBTYPE_DTS)
+ {
+ return E_INVALIDARG;
+ }
+ }
+
+ return pmt->majortype == MEDIATYPE_Video
+ || pmt->majortype == MEDIATYPE_Audio && pmt->formattype != FORMAT_VorbisFormat
+ || pmt->majortype == MEDIATYPE_Text && pmt->subtype == MEDIASUBTYPE_NULL && pmt->formattype == FORMAT_None
+ || pmt->majortype == MEDIATYPE_Subtitle
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CBaseMuxerInputPin::BreakConnect()
{
- HRESULT hr = __super::BreakConnect();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::BreakConnect();
+ if(FAILED(hr)) return hr;
- RemoveAll();
+ RemoveAll();
- // TODO: remove extra disconnected pins, leave one
+ // TODO: remove extra disconnected pins, leave one
- return hr;
+ return hr;
}
HRESULT CBaseMuxerInputPin::CompleteConnect(IPin* pReceivePin)
{
- HRESULT hr = __super::CompleteConnect(pReceivePin);
- if(FAILED(hr)) return hr;
-
- // duration
-
- m_rtDuration = 0;
- CComQIPtr<IMediaSeeking> pMS;
- if((pMS = GetFilterFromPin(pReceivePin)) || (pMS = pReceivePin))
- pMS->GetDuration(&m_rtDuration);
-
- // properties
-
- for(CComPtr<IPin> pPin = pReceivePin; pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin)))
- {
- if(CComQIPtr<IDSMPropertyBag> pPB = pPin)
- {
- ULONG cProperties = 0;
- if(SUCCEEDED(pPB->CountProperties(&cProperties)) && cProperties > 0)
- {
- for(ULONG iProperty = 0; iProperty < cProperties; iProperty++)
- {
- PROPBAG2 PropBag;
- memset(&PropBag, 0, sizeof(PropBag));
- ULONG cPropertiesReturned = 0;
- if(FAILED(pPB->GetPropertyInfo(iProperty, 1, &PropBag, &cPropertiesReturned)))
- continue;
-
- HRESULT hr;
- CComVariant var;
- if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr))
- SetProperty(PropBag.pstrName, &var);
-
- CoTaskMemFree(PropBag.pstrName);
- }
- }
- }
- }
-
- (static_cast<CBaseMuxerFilter*>(m_pFilter))->AddInput();
-
- return S_OK;
+ HRESULT hr = __super::CompleteConnect(pReceivePin);
+ if(FAILED(hr)) return hr;
+
+ // duration
+
+ m_rtDuration = 0;
+ CComQIPtr<IMediaSeeking> pMS;
+ if((pMS = GetFilterFromPin(pReceivePin)) || (pMS = pReceivePin))
+ pMS->GetDuration(&m_rtDuration);
+
+ // properties
+
+ for(CComPtr<IPin> pPin = pReceivePin; pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin)))
+ {
+ if(CComQIPtr<IDSMPropertyBag> pPB = pPin)
+ {
+ ULONG cProperties = 0;
+ if(SUCCEEDED(pPB->CountProperties(&cProperties)) && cProperties > 0)
+ {
+ for(ULONG iProperty = 0; iProperty < cProperties; iProperty++)
+ {
+ PROPBAG2 PropBag;
+ memset(&PropBag, 0, sizeof(PropBag));
+ ULONG cPropertiesReturned = 0;
+ if(FAILED(pPB->GetPropertyInfo(iProperty, 1, &PropBag, &cPropertiesReturned)))
+ continue;
+
+ HRESULT hr;
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr))
+ SetProperty(PropBag.pstrName, &var);
+
+ CoTaskMemFree(PropBag.pstrName);
+ }
+ }
+ }
+ }
+
+ (static_cast<CBaseMuxerFilter*>(m_pFilter))->AddInput();
+
+ return S_OK;
}
HRESULT CBaseMuxerInputPin::Active()
{
- m_rtMaxStart = _I64_MIN;
- m_fEOS = false;
- m_iPacketIndex = 0;
- m_evAcceptPacket.Set();
- return __super::Active();
+ m_rtMaxStart = _I64_MIN;
+ m_fEOS = false;
+ m_iPacketIndex = 0;
+ m_evAcceptPacket.Set();
+ return __super::Active();
}
HRESULT CBaseMuxerInputPin::Inactive()
{
- CAutoLock cAutoLock(&m_csQueue);
- m_queue.RemoveAll();
- return __super::Inactive();
+ CAutoLock cAutoLock(&m_csQueue);
+ m_queue.RemoveAll();
+ return __super::Inactive();
}
STDMETHODIMP CBaseMuxerInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- return __super::NewSegment(tStart, tStop, dRate);
+ return __super::NewSegment(tStart, tStop, dRate);
}
STDMETHODIMP CBaseMuxerInputPin::Receive(IMediaSample* pSample)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- HRESULT hr = __super::Receive(pSample);
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::Receive(pSample);
+ if(FAILED(hr)) return hr;
- CAutoPtr<MuxerPacket> pPacket(DNew MuxerPacket(this));
+ CAutoPtr<MuxerPacket> pPacket(DNew MuxerPacket(this));
- long len = pSample->GetActualDataLength();
+ long len = pSample->GetActualDataLength();
- BYTE* pData = NULL;
- if(FAILED(pSample->GetPointer(&pData)) || !pData)
- return S_OK;
+ BYTE* pData = NULL;
+ if(FAILED(pSample->GetPointer(&pData)) || !pData)
+ return S_OK;
- pPacket->pData.SetCount(len);
- memcpy(pPacket->pData.GetData(), pData, len);
+ pPacket->pData.SetCount(len);
+ memcpy(pPacket->pData.GetData(), pData, len);
- if(S_OK == pSample->IsSyncPoint() || m_mt.majortype == MEDIATYPE_Audio && !m_mt.bTemporalCompression)
- {
- pPacket->flags |= MuxerPacket::syncpoint;
- }
+ if(S_OK == pSample->IsSyncPoint() || m_mt.majortype == MEDIATYPE_Audio && !m_mt.bTemporalCompression)
+ {
+ pPacket->flags |= MuxerPacket::syncpoint;
+ }
- if(S_OK == pSample->GetTime(&pPacket->rtStart, &pPacket->rtStop))
- {
- pPacket->flags |= MuxerPacket::timevalid;
+ if(S_OK == pSample->GetTime(&pPacket->rtStart, &pPacket->rtStop))
+ {
+ pPacket->flags |= MuxerPacket::timevalid;
- pPacket->rtStart += m_tStart;
- pPacket->rtStop += m_tStart;
+ pPacket->rtStart += m_tStart;
+ pPacket->rtStop += m_tStart;
- if((pPacket->flags & MuxerPacket::syncpoint) && pPacket->rtStart < m_rtMaxStart)
- {
- pPacket->flags &= ~MuxerPacket::syncpoint;
- pPacket->flags |= MuxerPacket::bogus;
- }
+ if((pPacket->flags & MuxerPacket::syncpoint) && pPacket->rtStart < m_rtMaxStart)
+ {
+ pPacket->flags &= ~MuxerPacket::syncpoint;
+ pPacket->flags |= MuxerPacket::bogus;
+ }
- m_rtMaxStart = max(m_rtMaxStart, pPacket->rtStart);
- }
- else if(pPacket->flags & MuxerPacket::syncpoint)
- {
- pPacket->flags &= ~MuxerPacket::syncpoint;
- pPacket->flags |= MuxerPacket::bogus;
- }
+ m_rtMaxStart = max(m_rtMaxStart, pPacket->rtStart);
+ }
+ else if(pPacket->flags & MuxerPacket::syncpoint)
+ {
+ pPacket->flags &= ~MuxerPacket::syncpoint;
+ pPacket->flags |= MuxerPacket::bogus;
+ }
- if(S_OK == pSample->IsDiscontinuity())
- {
- pPacket->flags |= MuxerPacket::discontinuity;
- }
+ if(S_OK == pSample->IsDiscontinuity())
+ {
+ pPacket->flags |= MuxerPacket::discontinuity;
+ }
- pPacket->index = m_iPacketIndex++;
+ pPacket->index = m_iPacketIndex++;
- PushPacket(pPacket);
+ PushPacket(pPacket);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseMuxerInputPin::EndOfStream()
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- HRESULT hr = __super::EndOfStream();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::EndOfStream();
+ if(FAILED(hr)) return hr;
- ASSERT(!m_fEOS);
+ ASSERT(!m_fEOS);
- CAutoPtr<MuxerPacket> pPacket(DNew MuxerPacket(this));
- pPacket->flags |= MuxerPacket::eos;
- PushPacket(pPacket);
+ CAutoPtr<MuxerPacket> pPacket(DNew MuxerPacket(this));
+ pPacket->flags |= MuxerPacket::eos;
+ PushPacket(pPacket);
- m_fEOS = true;
+ m_fEOS = true;
- return hr;
+ return hr;
}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h
index 826931e93..7b10c3474 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerInputPin.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,88 +28,58 @@ class CBaseMuxerInputPin;
struct MuxerPacket
{
- CBaseMuxerInputPin* pPin;
- REFERENCE_TIME rtStart, rtStop;
- CAtlArray<BYTE> pData;
- enum flag_t {empty = 0, timevalid = 1, syncpoint = 2, discontinuity = 4, eos = 8, bogus = 16};
- DWORD flags;
- int index;
- struct MuxerPacket(CBaseMuxerInputPin* pPin)
- {
- this->pPin = pPin;
- rtStart = rtStop = _I64_MIN;
- flags = empty;
- index = -1;
- }
- bool IsTimeValid() const
- {
- return !!(flags & timevalid);
- }
- bool IsSyncPoint() const
- {
- return !!(flags & syncpoint);
- }
- bool IsDiscontinuity() const
- {
- return !!(flags & discontinuity);
- }
- bool IsEOS() const
- {
- return !!(flags & eos);
- }
- bool IsBogus() const
- {
- return !!(flags & bogus);
- }
+ CBaseMuxerInputPin* pPin;
+ REFERENCE_TIME rtStart, rtStop;
+ CAtlArray<BYTE> pData;
+ enum flag_t {empty = 0, timevalid = 1, syncpoint = 2, discontinuity = 4, eos = 8, bogus = 16};
+ DWORD flags;
+ int index;
+ struct MuxerPacket(CBaseMuxerInputPin* pPin) {this->pPin = pPin; rtStart = rtStop = _I64_MIN; flags = empty; index = -1;}
+ bool IsTimeValid() const {return !!(flags & timevalid);}
+ bool IsSyncPoint() const {return !!(flags & syncpoint);}
+ bool IsDiscontinuity() const {return !!(flags & discontinuity);}
+ bool IsEOS() const {return !!(flags & eos);}
+ bool IsBogus() const {return !!(flags & bogus);}
};
class CBaseMuxerInputPin : public CBaseInputPin, public CBaseMuxerRelatedPin, public IDSMPropertyBagImpl
{
private:
- int m_iID;
+ int m_iID;
- CCritSec m_csReceive;
- REFERENCE_TIME m_rtMaxStart, m_rtDuration;
- bool m_fEOS;
- int m_iPacketIndex;
+ CCritSec m_csReceive;
+ REFERENCE_TIME m_rtMaxStart, m_rtDuration;
+ bool m_fEOS;
+ int m_iPacketIndex;
- CCritSec m_csQueue;
- CAutoPtrList<MuxerPacket> m_queue;
- void PushPacket(CAutoPtr<MuxerPacket> pPacket);
- CAutoPtr<MuxerPacket> PopPacket();
- CAMEvent m_evAcceptPacket;
+ CCritSec m_csQueue;
+ CAutoPtrList<MuxerPacket> m_queue;
+ void PushPacket(CAutoPtr<MuxerPacket> pPacket);
+ CAutoPtr<MuxerPacket> PopPacket();
+ CAMEvent m_evAcceptPacket;
- friend class CBaseMuxerFilter;
+ friend class CBaseMuxerFilter;
public:
- CBaseMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CBaseMuxerInputPin();
+ CBaseMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseMuxerInputPin();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- REFERENCE_TIME GetDuration()
- {
- return m_rtDuration;
- }
- int GetID()
- {
- return m_iID;
- }
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- }
- bool IsSubtitleStream();
+ REFERENCE_TIME GetDuration() {return m_rtDuration;}
+ int GetID() {return m_iID;}
+ CMediaType& CurrentMediaType() {return m_mt;}
+ bool IsSubtitleStream();
HRESULT CheckMediaType(const CMediaType* pmt);
HRESULT BreakConnect();
HRESULT CompleteConnect(IPin* pReceivePin);
- HRESULT Active();
- HRESULT Inactive();
+ HRESULT Active();
+ HRESULT Inactive();
STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- STDMETHODIMP Receive(IMediaSample* pSample);
+ STDMETHODIMP Receive(IMediaSample* pSample);
STDMETHODIMP EndOfStream();
};
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
index 8f5c2019f..d827ba1f6 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -34,28 +34,28 @@
//
CBaseMuxerOutputPin::CBaseMuxerOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseOutputPin(_T("CBaseMuxerOutputPin"), pFilter, pLock, phr, pName)
+ : CBaseOutputPin(_T("CBaseMuxerOutputPin"), pFilter, pLock, phr, pName)
{
}
IBitStream* CBaseMuxerOutputPin::GetBitStream()
{
- if(!m_pBitStream)
- {
- if(CComQIPtr<IStream> pStream = GetConnected())
- {
- m_pBitStream = DNew CBitStream(pStream, true);
- }
- }
-
- return m_pBitStream;
+ if(!m_pBitStream)
+ {
+ if(CComQIPtr<IStream> pStream = GetConnected())
+ {
+ m_pBitStream = DNew CBitStream(pStream, true);
+ }
+ }
+
+ return m_pBitStream;
}
HRESULT CBaseMuxerOutputPin::BreakConnect()
{
- m_pBitStream = NULL;
+ m_pBitStream = NULL;
- return __super::BreakConnect();
+ return __super::BreakConnect();
}
HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -65,8 +65,8 @@ HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_P
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = 1;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 1;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -79,37 +79,37 @@ HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_P
HRESULT CBaseMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL
- ? S_OK
- : E_INVALIDARG;
+ return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CBaseMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- pmt->ResetFormatBuffer();
- pmt->InitMediaType();
- pmt->majortype = MEDIATYPE_Stream;
- pmt->subtype = MEDIASUBTYPE_NULL;
- pmt->formattype = FORMAT_None;
+ pmt->ResetFormatBuffer();
+ pmt->InitMediaType();
+ pmt->majortype = MEDIATYPE_Stream;
+ pmt->subtype = MEDIASUBTYPE_NULL;
+ pmt->formattype = FORMAT_None;
- return S_OK;
+ return S_OK;
}
HRESULT CBaseMuxerOutputPin::DeliverEndOfStream()
{
- m_pBitStream = NULL;
+ m_pBitStream = NULL;
- return __super::DeliverEndOfStream();
+ return __super::DeliverEndOfStream();
}
STDMETHODIMP CBaseMuxerOutputPin::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//
@@ -117,392 +117,381 @@ STDMETHODIMP CBaseMuxerOutputPin::Notify(IBaseFilter* pSender, Quality q)
//
CBaseMuxerRawOutputPin::CBaseMuxerRawOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseMuxerOutputPin(pName, pFilter, pLock, phr)
+ : CBaseMuxerOutputPin(pName, pFilter, pLock, phr)
{
}
STDMETHODIMP CBaseMuxerRawOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- QI(IBaseMuxerRelatedPin)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IBaseMuxerRelatedPin)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
void CBaseMuxerRawOutputPin::MuxHeader(const CMediaType& mt)
{
- CComQIPtr<IBitStream> pBitStream = GetBitStream();
- if(!pBitStream) return;
-
- const BYTE utf8bom[3] = {0xef, 0xbb, 0xbf};
-
- if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO)
- {
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.Format();
-
- for(DWORD i = 0; i < vih->cbSequenceHeader - 2; i += 2)
- {
- pBitStream->BitWrite(0x00000001, 32);
- WORD size = (((BYTE*)vih->dwSequenceHeader)[i+0] << 8) | ((BYTE*)vih->dwSequenceHeader)[i+1];
- pBitStream->ByteWrite(&((BYTE*)vih->dwSequenceHeader)[i+2], size);
- i += size;
- }
- }
- else if(mt.subtype == MEDIASUBTYPE_UTF8)
- {
- pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
- }
- else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2)
- {
- SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
- BYTE* p = (BYTE*)si + si->dwOffset;
-
- if(memcmp(utf8bom, p, 3) != 0)
- pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
-
- CStringA str((char*)p, mt.FormatLength() - (p - mt.Format()));
- pBitStream->StrWrite(str + '\n', true);
-
- if(str.Find("[Events]") < 0)
- pBitStream->StrWrite("\n\n[Events]\n", true);
- }
- else if(mt.subtype == MEDIASUBTYPE_SSF)
- {
- DWORD dwOffset = ((SUBTITLEINFO*)mt.pbFormat)->dwOffset;
- try
- {
- m_ssf.Parse(ssf::MemoryInputStream(mt.pbFormat + dwOffset, mt.cbFormat - dwOffset, false, false));
- }
- catch(ssf::Exception&) {}
- }
- else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
- {
- m_idx.RemoveAll();
- }
- else if(mt.majortype == MEDIATYPE_Audio
- && (mt.subtype == MEDIASUBTYPE_PCM
- || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
- || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
- || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
- && mt.formattype == FORMAT_WaveFormatEx)
- {
- pBitStream->BitWrite('RIFF', 32);
- pBitStream->BitWrite(0, 32); // file length - 8, set later
- pBitStream->BitWrite('WAVE', 32);
-
- pBitStream->BitWrite('fmt ', 32);
- pBitStream->ByteWrite(&mt.cbFormat, 4);
- pBitStream->ByteWrite(mt.pbFormat, mt.cbFormat);
-
- pBitStream->BitWrite('data', 32);
- pBitStream->BitWrite(0, 32); // data length, set later
- }
+ CComQIPtr<IBitStream> pBitStream = GetBitStream();
+ if(!pBitStream) return;
+
+ const BYTE utf8bom[3] = {0xef, 0xbb, 0xbf};
+
+ if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.Format();
+
+ for(DWORD i = 0; i < vih->cbSequenceHeader-2; i += 2)
+ {
+ pBitStream->BitWrite(0x00000001, 32);
+ WORD size = (((BYTE*)vih->dwSequenceHeader)[i+0]<<8) | ((BYTE*)vih->dwSequenceHeader)[i+1];
+ pBitStream->ByteWrite(&((BYTE*)vih->dwSequenceHeader)[i+2], size);
+ i += size;
+ }
+ }
+ else if(mt.subtype == MEDIASUBTYPE_UTF8)
+ {
+ pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
+ BYTE* p = (BYTE*)si + si->dwOffset;
+
+ if(memcmp(utf8bom, p, 3) != 0)
+ pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
+
+ CStringA str((char*)p, mt.FormatLength() - (p - mt.Format()));
+ pBitStream->StrWrite(str + '\n', true);
+
+ if(str.Find("[Events]") < 0)
+ pBitStream->StrWrite("\n\n[Events]\n", true);
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSF)
+ {
+ DWORD dwOffset = ((SUBTITLEINFO*)mt.pbFormat)->dwOffset;
+ try {m_ssf.Parse(ssf::MemoryInputStream(mt.pbFormat + dwOffset, mt.cbFormat - dwOffset, false, false));}
+ catch(ssf::Exception&) {}
+ }
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ m_idx.RemoveAll();
+ }
+ else if(mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ pBitStream->BitWrite('RIFF', 32);
+ pBitStream->BitWrite(0, 32); // file length - 8, set later
+ pBitStream->BitWrite('WAVE', 32);
+
+ pBitStream->BitWrite('fmt ', 32);
+ pBitStream->ByteWrite(&mt.cbFormat, 4);
+ pBitStream->ByteWrite(mt.pbFormat, mt.cbFormat);
+
+ pBitStream->BitWrite('data', 32);
+ pBitStream->BitWrite(0, 32); // data length, set later
+ }
}
void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket* pPacket)
{
- CComQIPtr<IBitStream> pBitStream = GetBitStream();
- if(!pBitStream) return;
-
- const BYTE* pData = pPacket->pData.GetData();
- const int DataSize = int(pPacket->pData.GetCount());
-
- if(mt.subtype == MEDIASUBTYPE_AAC && mt.formattype == FORMAT_WaveFormatEx)
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
-
- int profile = 0;
-
- int srate_idx = 11;
- if(92017 <= wfe->nSamplesPerSec) srate_idx = 0;
- else if(75132 <= wfe->nSamplesPerSec) srate_idx = 1;
- else if(55426 <= wfe->nSamplesPerSec) srate_idx = 2;
- else if(46009 <= wfe->nSamplesPerSec) srate_idx = 3;
- else if(37566 <= wfe->nSamplesPerSec) srate_idx = 4;
- else if(27713 <= wfe->nSamplesPerSec) srate_idx = 5;
- else if(23004 <= wfe->nSamplesPerSec) srate_idx = 6;
- else if(18783 <= wfe->nSamplesPerSec) srate_idx = 7;
- else if(13856 <= wfe->nSamplesPerSec) srate_idx = 8;
- else if(11502 <= wfe->nSamplesPerSec) srate_idx = 9;
- else if(9391 <= wfe->nSamplesPerSec) srate_idx = 10;
-
- int channels = wfe->nChannels;
-
- if(wfe->cbSize >= 2)
- {
- BYTE* p = (BYTE*)(wfe + 1);
- profile = (p[0] >> 3) - 1;
- srate_idx = ((p[0] & 7) << 1) | ((p[1] & 0x80) >> 7);
- channels = (p[1] >> 3) & 15;
- }
-
- int len = (DataSize + 7) & 0x1fff;
-
- BYTE hdr[7] = {0xff, 0xf9};
- hdr[2] = (profile << 6) | (srate_idx << 2) | ((channels & 4) >> 2);
- hdr[3] = ((channels & 3) << 6) | (len >> 11);
- hdr[4] = (len >> 3) & 0xff;
- hdr[5] = ((len & 7) << 5) | 0x1f;
- hdr[6] = 0xfc;
-
- pBitStream->ByteWrite(hdr, sizeof(hdr));
- }
- else if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO)
- {
- const BYTE* p = pData;
- int i = DataSize;
-
- while(i >= 4)
- {
- DWORD len = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
-
- i -= len + 4;
- p += len + 4;
- }
-
- if(i == 0)
- {
- p = pData;
- i = DataSize;
-
- while(i >= 4)
- {
- DWORD len = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
-
- pBitStream->BitWrite(0x00000001, 32);
-
- p += 4;
- i -= 4;
-
- if(len > i || len == 1)
- {
- len = i;
- ASSERT(0);
- }
-
- pBitStream->ByteWrite(p, len);
-
- p += len;
- i -= len;
- }
-
- return;
- }
- }
- else if(mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text)
- {
- CStringA str((char*)pData, DataSize);
- str.Trim();
- if(str.IsEmpty()) return;
-
- DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
- DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
-
- str.Format("%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n",
- pPacket->index + 1,
- start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart / 10000) % 1000),
- stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop / 10000) % 1000),
- CStringA(str));
-
- pBitStream->StrWrite(str, true);
-
- return;
- }
- else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2)
- {
- CStringA str((char*)pData, DataSize);
- str.Trim();
- if(str.IsEmpty()) return;
-
- DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
- DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
-
- int fields = mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
-
- CAtlList<CStringA> sl;
- Explode(str, sl, ',', fields);
- if(sl.GetCount() < fields) return;
-
- CStringA readorder = sl.RemoveHead(); // TODO
- CStringA layer = sl.RemoveHead();
- CStringA style = sl.RemoveHead();
- CStringA actor = sl.RemoveHead();
- CStringA left = sl.RemoveHead();
- CStringA right = sl.RemoveHead();
- CStringA top = sl.RemoveHead();
- if(fields == 10) top += ',' + sl.RemoveHead(); // bottom
- CStringA effect = sl.RemoveHead();
- str = sl.RemoveHead();
-
- if(mt.subtype == MEDIASUBTYPE_SSA) layer = "Marked=0";
-
- str.Format("Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s,%s,%s,%s,%s,%s,%s\n",
- layer,
- start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart / 100000) % 100),
- stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop / 100000) % 100),
- style, actor, left, right, top, effect,
- CStringA(str));
-
- pBitStream->StrWrite(str, true);
-
- return;
- }
- else if(mt.subtype == MEDIASUBTYPE_SSF)
- {
- float start = (float)pPacket->rtStart / 10000000;
- float stop = (float)pPacket->rtStop / 10000000;
- m_ssf.Append(ssf::WCharInputStream(UTF8To16(CStringA((char*)pData, DataSize))), start, stop, true);
- return;
- }
- else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
- {
- bool fTimeValid = pPacket->IsTimeValid();
-
- if(fTimeValid)
- {
- idx_t i;
- i.rt = pPacket->rtStart;
- i.fp = pBitStream->GetPos();
- m_idx.AddTail(i);
- }
-
- int DataSizeLeft = DataSize;
-
- while(DataSizeLeft > 0)
- {
- int BytesAvail = 0x7ec - (fTimeValid ? 9 : 4);
- int Size = min(BytesAvail, DataSizeLeft);
- int Padding = 0x800 - Size - 20 - (fTimeValid ? 9 : 4);
-
- pBitStream->BitWrite(0x000001ba, 32);
- pBitStream->BitWrite(0x440004000401ui64, 48);
- pBitStream->BitWrite(0x000003f8, 32);
- pBitStream->BitWrite(0x000001bd, 32);
-
- if(fTimeValid)
- {
- pBitStream->BitWrite(Size + 9, 16);
- pBitStream->BitWrite(0x8180052100010001ui64, 64);
- }
- else
- {
- pBitStream->BitWrite(Size + 4, 16);
- pBitStream->BitWrite(0x810000, 24);
- }
-
- pBitStream->BitWrite(0x20, 8);
-
- pBitStream->ByteWrite(pData, Size);
-
- pData += Size;
- DataSizeLeft -= Size;
-
- if(Padding > 0)
- {
- Padding -= 6;
- ASSERT(Padding >= 0);
- pBitStream->BitWrite(0x000001be, 32);
- pBitStream->BitWrite(Padding, 16);
- while(Padding-- > 0) pBitStream->BitWrite(0xff, 8);
- }
-
- fTimeValid = false;
- }
-
- return;
- }
- else if(mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
-
- // This code is probably totally broken for anything but 16 bits
- for(int i = 0, bps = wfe->wBitsPerSample / 8; i < DataSize; i += bps)
- for(int j = bps - 1; j >= 0; j--)
- pBitStream->BitWrite(pData[i+j], 8);
-
- return;
- }
- // else // TODO: restore more streams (vorbis to ogg)
-
- pBitStream->ByteWrite(pData, DataSize);
+ CComQIPtr<IBitStream> pBitStream = GetBitStream();
+ if(!pBitStream) return;
+
+ const BYTE* pData = pPacket->pData.GetData();
+ const int DataSize = int(pPacket->pData.GetCount());
+
+ if(mt.subtype == MEDIASUBTYPE_AAC && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ int profile = 0;
+
+ int srate_idx = 11;
+ if(92017 <= wfe->nSamplesPerSec) srate_idx = 0;
+ else if(75132 <= wfe->nSamplesPerSec) srate_idx = 1;
+ else if(55426 <= wfe->nSamplesPerSec) srate_idx = 2;
+ else if(46009 <= wfe->nSamplesPerSec) srate_idx = 3;
+ else if(37566 <= wfe->nSamplesPerSec) srate_idx = 4;
+ else if(27713 <= wfe->nSamplesPerSec) srate_idx = 5;
+ else if(23004 <= wfe->nSamplesPerSec) srate_idx = 6;
+ else if(18783 <= wfe->nSamplesPerSec) srate_idx = 7;
+ else if(13856 <= wfe->nSamplesPerSec) srate_idx = 8;
+ else if(11502 <= wfe->nSamplesPerSec) srate_idx = 9;
+ else if(9391 <= wfe->nSamplesPerSec) srate_idx = 10;
+
+ int channels = wfe->nChannels;
+
+ if(wfe->cbSize >= 2)
+ {
+ BYTE* p = (BYTE*)(wfe+1);
+ profile = (p[0]>>3)-1;
+ srate_idx = ((p[0]&7)<<1)|((p[1]&0x80)>>7);
+ channels = (p[1]>>3)&15;
+ }
+
+ int len = (DataSize + 7) & 0x1fff;
+
+ BYTE hdr[7] = {0xff, 0xf9};
+ hdr[2] = (profile<<6) | (srate_idx<<2) | ((channels&4)>>2);
+ hdr[3] = ((channels&3)<<6) | (len>>11);
+ hdr[4] = (len>>3)&0xff;
+ hdr[5] = ((len&7)<<5) | 0x1f;
+ hdr[6] = 0xfc;
+
+ pBitStream->ByteWrite(hdr, sizeof(hdr));
+ }
+ else if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ const BYTE* p = pData;
+ int i = DataSize;
+
+ while(i >= 4)
+ {
+ DWORD len = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
+
+ i -= len + 4;
+ p += len + 4;
+ }
+
+ if(i == 0)
+ {
+ p = pData;
+ i = DataSize;
+
+ while(i >= 4)
+ {
+ DWORD len = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
+
+ pBitStream->BitWrite(0x00000001, 32);
+
+ p += 4;
+ i -= 4;
+
+ if(len > i || len == 1) {len = i; ASSERT(0);}
+
+ pBitStream->ByteWrite(p, len);
+
+ p += len;
+ i -= len;
+ }
+
+ return;
+ }
+ }
+ else if(mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text)
+ {
+ CStringA str((char*)pData, DataSize);
+ str.Trim();
+ if(str.IsEmpty()) return;
+
+ DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
+ DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
+
+ str.Format("%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n",
+ pPacket->index+1,
+ start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/10000)%1000),
+ stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/10000)%1000),
+ CStringA(str));
+
+ pBitStream->StrWrite(str, true);
+
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ CStringA str((char*)pData, DataSize);
+ str.Trim();
+ if(str.IsEmpty()) return;
+
+ DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
+ DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
+
+ int fields = mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
+
+ CAtlList<CStringA> sl;
+ Explode(str, sl, ',', fields);
+ if(sl.GetCount() < fields) return;
+
+ CStringA readorder = sl.RemoveHead(); // TODO
+ CStringA layer = sl.RemoveHead();
+ CStringA style = sl.RemoveHead();
+ CStringA actor = sl.RemoveHead();
+ CStringA left = sl.RemoveHead();
+ CStringA right = sl.RemoveHead();
+ CStringA top = sl.RemoveHead();
+ if(fields == 10) top += ',' + sl.RemoveHead(); // bottom
+ CStringA effect = sl.RemoveHead();
+ str = sl.RemoveHead();
+
+ if(mt.subtype == MEDIASUBTYPE_SSA) layer = "Marked=0";
+
+ str.Format("Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s,%s,%s,%s,%s,%s,%s\n",
+ layer,
+ start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/100000)%100),
+ stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/100000)%100),
+ style, actor, left, right, top, effect,
+ CStringA(str));
+
+ pBitStream->StrWrite(str, true);
+
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSF)
+ {
+ float start = (float)pPacket->rtStart / 10000000;
+ float stop = (float)pPacket->rtStop / 10000000;
+ m_ssf.Append(ssf::WCharInputStream(UTF8To16(CStringA((char*)pData, DataSize))), start, stop, true);
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ bool fTimeValid = pPacket->IsTimeValid();
+
+ if(fTimeValid)
+ {
+ idx_t i;
+ i.rt = pPacket->rtStart;
+ i.fp = pBitStream->GetPos();
+ m_idx.AddTail(i);
+ }
+
+ int DataSizeLeft = DataSize;
+
+ while(DataSizeLeft > 0)
+ {
+ int BytesAvail = 0x7ec - (fTimeValid ? 9 : 4);
+ int Size = min(BytesAvail, DataSizeLeft);
+ int Padding = 0x800 - Size - 20 - (fTimeValid ? 9 : 4);
+
+ pBitStream->BitWrite(0x000001ba, 32);
+ pBitStream->BitWrite(0x440004000401ui64, 48);
+ pBitStream->BitWrite(0x000003f8, 32);
+ pBitStream->BitWrite(0x000001bd, 32);
+
+ if(fTimeValid)
+ {
+ pBitStream->BitWrite(Size+9, 16);
+ pBitStream->BitWrite(0x8180052100010001ui64, 64);
+ }
+ else
+ {
+ pBitStream->BitWrite(Size+4, 16);
+ pBitStream->BitWrite(0x810000, 24);
+ }
+
+ pBitStream->BitWrite(0x20, 8);
+
+ pBitStream->ByteWrite(pData, Size);
+
+ pData += Size;
+ DataSizeLeft -= Size;
+
+ if(Padding > 0)
+ {
+ Padding -= 6;
+ ASSERT(Padding >= 0);
+ pBitStream->BitWrite(0x000001be, 32);
+ pBitStream->BitWrite(Padding, 16);
+ while(Padding-- > 0) pBitStream->BitWrite(0xff, 8);
+ }
+
+ fTimeValid = false;
+ }
+
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ // This code is probably totally broken for anything but 16 bits
+ for(int i = 0, bps = wfe->wBitsPerSample/8; i < DataSize; i += bps)
+ for(int j = bps-1; j >= 0; j--)
+ pBitStream->BitWrite(pData[i+j], 8);
+
+ return;
+ }
+ // else // TODO: restore more streams (vorbis to ogg)
+
+ pBitStream->ByteWrite(pData, DataSize);
}
void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
{
- CComQIPtr<IBitStream> pBitStream = GetBitStream();
- if(!pBitStream) return;
-
- if(mt.majortype == MEDIATYPE_Audio
- && (mt.subtype == MEDIASUBTYPE_PCM
- || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
- || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
- || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
- && mt.formattype == FORMAT_WaveFormatEx)
- {
- pBitStream->BitFlush();
-
- ASSERT(pBitStream->GetPos() <= 0xffffffff);
- UINT32 size = (UINT32)pBitStream->GetPos();
-
- size -= 8;
- pBitStream->Seek(4);
- pBitStream->ByteWrite(&size, 4);
-
- size -= sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength();
- pBitStream->Seek(sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength() + 4);
- pBitStream->ByteWrite(&size, 4);
- }
- else if(mt.subtype == MEDIASUBTYPE_SSF)
- {
- ssf::WCharOutputStream s;
- try
- {
- m_ssf.Dump(s);
- }
- catch(ssf::Exception&) {}
- CStringA str = UTF16To8(s.GetString());
- pBitStream->StrWrite(str, true);
- }
- else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
- {
- if(CComQIPtr<IFileSinkFilter> pFSF = GetFilterFromPin(GetConnected()))
- {
- WCHAR* fn = NULL;
- if(SUCCEEDED(pFSF->GetCurFile(&fn, NULL)))
- {
- CPathW p(fn);
- p.RenameExtension(L".idx");
- CoTaskMemFree(fn);
-
- if(FILE* f = _tfopen(CString((LPCWSTR)p), _T("w")))
- {
- SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
-
- _ftprintf(f, _T("%s\n"), _T("# VobSub index file, v7 (do not modify this line!)"));
-
- fwrite(mt.Format() + si->dwOffset, mt.FormatLength() - si->dwOffset, 1, f);
-
- CString iso6391 = ISO6392To6391(si->IsoLang);
- if(iso6391.IsEmpty()) iso6391 = _T("--");
- _ftprintf(f, _T("\nlangidx: 0\n\nid: %s, index: 0\n"), iso6391);
-
- CString alt = CString(CStringW(si->TrackName));
- if(!alt.IsEmpty()) _ftprintf(f, _T("alt: %s\n"), alt);
-
- POSITION pos = m_idx.GetHeadPosition();
- while(pos)
- {
- const idx_t& i = m_idx.GetNext(pos);
- DVD_HMSF_TIMECODE start = RT2HMSF(i.rt, 25);
- _ftprintf(f, _T("timestamp: %02d:%02d:%02d:%03d, filepos: %09I64x\n"),
- start.bHours, start.bMinutes, start.bSeconds, (int)((i.rt / 10000) % 1000),
- i.fp);
- }
-
- fclose(f);
- }
- }
- }
- }
+ CComQIPtr<IBitStream> pBitStream = GetBitStream();
+ if(!pBitStream) return;
+
+ if(mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ pBitStream->BitFlush();
+
+ ASSERT(pBitStream->GetPos() <= 0xffffffff);
+ UINT32 size = (UINT32)pBitStream->GetPos();
+
+ size -= 8;
+ pBitStream->Seek(4);
+ pBitStream->ByteWrite(&size, 4);
+
+ size -= sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength();
+ pBitStream->Seek(sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength() + 4);
+ pBitStream->ByteWrite(&size, 4);
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSF)
+ {
+ ssf::WCharOutputStream s;
+ try {m_ssf.Dump(s);} catch(ssf::Exception&) {}
+ CStringA str = UTF16To8(s.GetString());
+ pBitStream->StrWrite(str, true);
+ }
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ if(CComQIPtr<IFileSinkFilter> pFSF = GetFilterFromPin(GetConnected()))
+ {
+ WCHAR* fn = NULL;
+ if(SUCCEEDED(pFSF->GetCurFile(&fn, NULL)))
+ {
+ CPathW p(fn);
+ p.RenameExtension(L".idx");
+ CoTaskMemFree(fn);
+
+ if(FILE* f = _tfopen(CString((LPCWSTR)p), _T("w")))
+ {
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
+
+ _ftprintf(f, _T("%s\n"), _T("# VobSub index file, v7 (do not modify this line!)"));
+
+ fwrite(mt.Format() + si->dwOffset, mt.FormatLength() - si->dwOffset, 1, f);
+
+ CString iso6391 = ISO6392To6391(si->IsoLang);
+ if(iso6391.IsEmpty()) iso6391 = _T("--");
+ _ftprintf(f, _T("\nlangidx: 0\n\nid: %s, index: 0\n"), iso6391);
+
+ CString alt = CString(CStringW(si->TrackName));
+ if(!alt.IsEmpty()) _ftprintf(f, _T("alt: %s\n"), alt);
+
+ POSITION pos = m_idx.GetHeadPosition();
+ while(pos)
+ {
+ const idx_t& i = m_idx.GetNext(pos);
+ DVD_HMSF_TIMECODE start = RT2HMSF(i.rt, 25);
+ _ftprintf(f, _T("timestamp: %02d:%02d:%02d:%03d, filepos: %09I64x\n"),
+ start.bHours, start.bMinutes, start.bSeconds, (int)((i.rt/10000)%1000),
+ i.fp);
+ }
+
+ fclose(f);
+ }
+ }
+ }
+ }
}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h
index 9ae84bc79..616943d3e 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,15 +28,15 @@
class CBaseMuxerOutputPin : public CBaseOutputPin
{
- CComPtr<IBitStream> m_pBitStream;
+ CComPtr<IBitStream> m_pBitStream;
public:
- CBaseMuxerOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CBaseMuxerOutputPin() {}
+ CBaseMuxerOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseMuxerOutputPin() {}
- IBitStream* GetBitStream();
+ IBitStream* GetBitStream();
- HRESULT BreakConnect();
+ HRESULT BreakConnect();
HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
@@ -45,28 +45,24 @@ public:
HRESULT DeliverEndOfStream();
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
class CBaseMuxerRawOutputPin : public CBaseMuxerOutputPin, public CBaseMuxerRelatedPin
{
- struct idx_t
- {
- REFERENCE_TIME rt;
- __int64 fp;
- };
- CAtlList<idx_t> m_idx;
+ struct idx_t {REFERENCE_TIME rt; __int64 fp;};
+ CAtlList<idx_t> m_idx;
- ssf::SubtitleFile m_ssf;
+ ssf::SubtitleFile m_ssf;
public:
- CBaseMuxerRawOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CBaseMuxerRawOutputPin() {}
+ CBaseMuxerRawOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseMuxerRawOutputPin() {}
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- virtual void MuxHeader(const CMediaType& mt);
- virtual void MuxPacket(const CMediaType& mt, const MuxerPacket* pPacket);
- virtual void MuxFooter(const CMediaType& mt);
+ virtual void MuxHeader(const CMediaType& mt);
+ virtual void MuxPacket(const CMediaType& mt, const MuxerPacket* pPacket);
+ virtual void MuxFooter(const CMediaType& mt);
};
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp
index 2b6548c65..c4ba9b3bd 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -38,11 +38,11 @@ CBaseMuxerRelatedPin::~CBaseMuxerRelatedPin()
STDMETHODIMP CBaseMuxerRelatedPin::SetRelatedPin(CBasePin* pPin)
{
- m_pRelatedPin = pPin;
- return S_OK;
+ m_pRelatedPin = pPin;
+ return S_OK;
}
STDMETHODIMP_(CBasePin*) CBaseMuxerRelatedPin::GetRelatedPin()
{
- return m_pRelatedPin;
+ return m_pRelatedPin;
}
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h
index 5c7bd26cb..2b7f7095e 100644
--- a/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h
+++ b/src/filters/muxer/BaseMuxer/BaseMuxerRelatedPin.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -22,23 +22,22 @@
#pragma once
[uuid("EE6F2741-7DB4-4AAD-A3CB-545208EE4C0A")]
-interface IBaseMuxerRelatedPin :
-public IUnknown
+interface IBaseMuxerRelatedPin : public IUnknown
{
- STDMETHOD(SetRelatedPin)(CBasePin* pPin) = 0;
- STDMETHOD_(CBasePin*, GetRelatedPin)() = 0;
+ STDMETHOD(SetRelatedPin) (CBasePin* pPin) = 0;
+ STDMETHOD_(CBasePin*, GetRelatedPin) () = 0;
};
class CBaseMuxerRelatedPin : public IBaseMuxerRelatedPin
{
- CBasePin* m_pRelatedPin; // should not hold a reference because it would be circular
+ CBasePin* m_pRelatedPin; // should not hold a reference because it would be circular
public:
- CBaseMuxerRelatedPin();
- virtual ~CBaseMuxerRelatedPin();
+ CBaseMuxerRelatedPin();
+ virtual ~CBaseMuxerRelatedPin();
- // IBaseMuxerRelatedPin
+ // IBaseMuxerRelatedPin
- STDMETHODIMP SetRelatedPin(CBasePin* pPin);
- STDMETHODIMP_(CBasePin*) GetRelatedPin();
+ STDMETHODIMP SetRelatedPin(CBasePin* pPin);
+ STDMETHODIMP_(CBasePin*) GetRelatedPin();
}; \ No newline at end of file
diff --git a/src/filters/muxer/BaseMuxer/BitStream.cpp b/src/filters/muxer/BaseMuxer/BitStream.cpp
index 55ac46500..3481740fa 100644
--- a/src/filters/muxer/BaseMuxer/BitStream.cpp
+++ b/src/filters/muxer/BaseMuxer/BitStream.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,134 +27,130 @@
//
CBitStream::CBitStream(IStream* pStream, bool fThrowError)
- : CUnknown(_T("CBitStream"), NULL)
- , m_pStream(pStream)
- , m_fThrowError(fThrowError)
- , m_bitlen(0)
+ : CUnknown(_T("CBitStream"), NULL)
+ , m_pStream(pStream)
+ , m_fThrowError(fThrowError)
+ , m_bitlen(0)
{
- ASSERT(m_pStream);
+ ASSERT(m_pStream);
- LARGE_INTEGER li = {0};
- m_pStream->Seek(li, STREAM_SEEK_SET, NULL);
+ LARGE_INTEGER li = {0};
+ m_pStream->Seek(li, STREAM_SEEK_SET, NULL);
- ULARGE_INTEGER uli = {0};
- m_pStream->SetSize(uli); // not that it worked...
+ ULARGE_INTEGER uli = {0};
+ m_pStream->SetSize(uli); // not that it worked...
- m_pStream->Commit(S_OK); // also seems to have no effect, but maybe in the future...
+ m_pStream->Commit(S_OK); // also seems to have no effect, but maybe in the future...
}
CBitStream::~CBitStream()
{
- BitFlush();
+ BitFlush();
}
STDMETHODIMP CBitStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- *ppv = NULL;
+ *ppv = NULL;
- return
- QI(IBitStream)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IBitStream)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IBitStream
STDMETHODIMP_(UINT64) CBitStream::GetPos()
{
- ULARGE_INTEGER pos = {0, 0};
- m_pStream->Seek(*(LARGE_INTEGER*)&pos, STREAM_SEEK_CUR, &pos);
- return pos.QuadPart;
+ ULARGE_INTEGER pos = {0, 0};
+ m_pStream->Seek(*(LARGE_INTEGER*)&pos, STREAM_SEEK_CUR, &pos);
+ return pos.QuadPart;
}
STDMETHODIMP_(UINT64) CBitStream::Seek(UINT64 pos)
{
- BitFlush();
-
- LARGE_INTEGER li;
- li.QuadPart = pos;
- ULARGE_INTEGER linew;
- linew.QuadPart = -1;
- m_pStream->Seek(li, STREAM_SEEK_SET, &linew);
- ASSERT(li.QuadPart == linew.QuadPart);
- return linew.QuadPart;
+ BitFlush();
+
+ LARGE_INTEGER li;
+ li.QuadPart = pos;
+ ULARGE_INTEGER linew;
+ linew.QuadPart = -1;
+ m_pStream->Seek(li, STREAM_SEEK_SET, &linew);
+ ASSERT(li.QuadPart == linew.QuadPart);
+ return linew.QuadPart;
}
STDMETHODIMP CBitStream::ByteWrite(const void* pData, int len)
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- BitFlush();
+ BitFlush();
- if(len > 0)
- {
- ULONG cbWritten = 0;
- hr = m_pStream->Write(pData, len, &cbWritten);
+ if(len > 0)
+ {
+ ULONG cbWritten = 0;
+ hr = m_pStream->Write(pData, len, &cbWritten);
- ASSERT(SUCCEEDED(hr));
- if(m_fThrowError && FAILED(hr)) throw hr;
- }
+ ASSERT(SUCCEEDED(hr));
+ if(m_fThrowError && FAILED(hr)) throw hr;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CBitStream::BitWrite(UINT64 data, int len)
{
- HRESULT hr = S_OK;
-
- ASSERT(len >= 0 && len <= 64);
+ HRESULT hr = S_OK;
- if(len > 56)
- {
- BitWrite(data >> 56, len - 56);
- len = 56;
- }
+ ASSERT(len >= 0 && len <= 64);
- m_bitbuff <<= len;
- m_bitbuff |= data & ((1ui64 << len) - 1);
- m_bitlen += len;
+ if(len > 56) {BitWrite(data >> 56, len - 56); len = 56;}
- while(m_bitlen >= 8)
- {
- BYTE b = (BYTE)(m_bitbuff >> (m_bitlen - 8));
- hr = m_pStream->Write(&b, 1, NULL);
- m_bitlen -= 8;
+ m_bitbuff <<= len;
+ m_bitbuff |= data & ((1ui64 << len) - 1);
+ m_bitlen += len;
+
+ while(m_bitlen >= 8)
+ {
+ BYTE b = (BYTE)(m_bitbuff >> (m_bitlen - 8));
+ hr = m_pStream->Write(&b, 1, NULL);
+ m_bitlen -= 8;
- ASSERT(SUCCEEDED(hr));
- if(m_fThrowError && FAILED(hr)) throw E_FAIL;
- }
+ ASSERT(SUCCEEDED(hr));
+ if(m_fThrowError && FAILED(hr)) throw E_FAIL;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CBitStream::BitFlush()
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- if(m_bitlen > 0)
- {
- ASSERT(m_bitlen < 8);
- BYTE b = (BYTE)(m_bitbuff << (8 - m_bitlen));
- hr = m_pStream->Write(&b, 1, NULL);
- m_bitlen = 0;
+ if(m_bitlen > 0)
+ {
+ ASSERT(m_bitlen < 8);
+ BYTE b = (BYTE)(m_bitbuff << (8 - m_bitlen));
+ hr = m_pStream->Write(&b, 1, NULL);
+ m_bitlen = 0;
- ASSERT(SUCCEEDED(hr));
- if(m_fThrowError && FAILED(hr)) throw E_FAIL;
- }
+ ASSERT(SUCCEEDED(hr));
+ if(m_fThrowError && FAILED(hr)) throw E_FAIL;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CBitStream::StrWrite(LPCSTR pData, BOOL bFixNewLine)
{
- CStringA str = pData;
+ CStringA str = pData;
- if(bFixNewLine)
- {
- str.Replace("\r", "");
- str.Replace("\n", "\r\n");
- }
+ if(bFixNewLine)
+ {
+ str.Replace("\r", "");
+ str.Replace("\n", "\r\n");
+ }
- return ByteWrite((LPCSTR)str, str.GetLength());
+ return ByteWrite((LPCSTR)str, str.GetLength());
}
diff --git a/src/filters/muxer/BaseMuxer/BitStream.h b/src/filters/muxer/BaseMuxer/BitStream.h
index 259c1f201..26621660e 100644
--- a/src/filters/muxer/BaseMuxer/BitStream.h
+++ b/src/filters/muxer/BaseMuxer/BitStream.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -22,37 +22,36 @@
#pragma once
[uuid("30AB78C7-5259-4594-AEFE-9C0FC2F08A5E")]
-interface IBitStream :
-public IUnknown
+interface IBitStream : public IUnknown
{
- STDMETHOD_(UINT64, GetPos)() = 0;
- STDMETHOD_(UINT64, Seek)(UINT64 pos) = 0; // it's a _stream_, please don't seek if you don't have to
- STDMETHOD(ByteWrite)(const void* pData, int len) = 0;
- STDMETHOD(BitWrite)(UINT64 data, int len) = 0;
- STDMETHOD(BitFlush)() = 0;
- STDMETHOD(StrWrite)(LPCSTR pData, BOOL bFixNewLine) = 0;
+ STDMETHOD_(UINT64, GetPos) () = 0;
+ STDMETHOD_(UINT64, Seek) (UINT64 pos) = 0; // it's a _stream_, please don't seek if you don't have to
+ STDMETHOD(ByteWrite) (const void* pData, int len) = 0;
+ STDMETHOD(BitWrite) (UINT64 data, int len) = 0;
+ STDMETHOD(BitFlush) () = 0;
+ STDMETHOD(StrWrite) (LPCSTR pData, BOOL bFixNewLine) = 0;
};
class CBitStream : public CUnknown, public IBitStream
{
- CComPtr<IStream> m_pStream;
- bool m_fThrowError;
- UINT64 m_bitbuff;
- int m_bitlen;
+ CComPtr<IStream> m_pStream;
+ bool m_fThrowError;
+ UINT64 m_bitbuff;
+ int m_bitlen;
public:
- CBitStream(IStream* pStream, bool m_fThrowError = false);
- virtual ~CBitStream();
+ CBitStream(IStream* pStream, bool m_fThrowError = false);
+ virtual ~CBitStream();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IBitStream
+ // IBitStream
- STDMETHODIMP_(UINT64) GetPos();
- STDMETHODIMP_(UINT64) Seek(UINT64 pos);
- STDMETHODIMP ByteWrite(const void* pData, int len);
- STDMETHODIMP BitWrite(UINT64 data, int len);
- STDMETHODIMP BitFlush();
- STDMETHODIMP StrWrite(LPCSTR pData, BOOL bFixNewLine);
+ STDMETHODIMP_(UINT64) GetPos();
+ STDMETHODIMP_(UINT64) Seek(UINT64 pos);
+ STDMETHODIMP ByteWrite(const void* pData, int len);
+ STDMETHODIMP BitWrite(UINT64 data, int len);
+ STDMETHODIMP BitFlush();
+ STDMETHODIMP StrWrite(LPCSTR pData, BOOL bFixNewLine);
};
diff --git a/src/filters/muxer/BaseMuxer/stdafx.cpp b/src/filters/muxer/BaseMuxer/stdafx.cpp
index fbb1d74c1..6f5d2a928 100644
--- a/src/filters/muxer/BaseMuxer/stdafx.cpp
+++ b/src/filters/muxer/BaseMuxer/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/BaseMuxer/stdafx.h b/src/filters/muxer/BaseMuxer/stdafx.h
index 6c97773a5..a2674a8f9 100644
--- a/src/filters/muxer/BaseMuxer/stdafx.h
+++ b/src/filters/muxer/BaseMuxer/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/DSMMuxer/DSMMuxer.cpp b/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
index 79a60f381..ca349a306 100644
--- a/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
+++ b/src/filters/muxer/DSMMuxer/DSMMuxer.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -32,7 +32,7 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_DirectShowMedia}
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_DirectShowMedia}
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -43,24 +43,24 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CDSMMuxerFilter), L"MPC - DSM Muxer", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CDSMMuxerFilter), L"MPC - DSM Muxer", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDSMMuxerFilter>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDSMMuxerFilter>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -69,16 +69,13 @@ CFilterApp theApp;
#endif
-template<typename T> static T myabs(T n)
-{
- return n >= 0 ? n : -n;
-}
+template<typename T> static T myabs(T n) {return n >= 0 ? n : -n;}
static int GetByteLength(UINT64 data, int min = 0)
{
- int i = 7;
- while(i >= min && ((BYTE*)&data)[i] == 0) i--;
- return ++i;
+ int i = 7;
+ while(i >= min && ((BYTE*)&data)[i] == 0) i--;
+ return ++i;
}
//
@@ -86,11 +83,11 @@ static int GetByteLength(UINT64 data, int min = 0)
//
CDSMMuxerFilter::CDSMMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, bool fAutoChap, bool fAutoRes)
- : CBaseMuxerFilter(pUnk, phr, __uuidof(this))
- , m_fAutoChap(fAutoChap)
- , m_fAutoRes(fAutoRes)
+ : CBaseMuxerFilter(pUnk, phr, __uuidof(this))
+ , m_fAutoChap(fAutoChap)
+ , m_fAutoRes(fAutoRes)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CDSMMuxerFilter::~CDSMMuxerFilter()
@@ -99,360 +96,356 @@ CDSMMuxerFilter::~CDSMMuxerFilter()
STDMETHODIMP CDSMMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- *ppv = NULL;
+ *ppv = NULL;
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
void CDSMMuxerFilter::MuxPacketHeader(IBitStream* pBS, dsmp_t type, UINT64 len)
{
- ASSERT(type < 32);
+ ASSERT(type < 32);
- int i = GetByteLength(len, 1);
+ int i = GetByteLength(len, 1);
- pBS->BitWrite(DSMSW, DSMSW_SIZE << 3);
- pBS->BitWrite(type, 5);
- pBS->BitWrite(i - 1, 3);
- pBS->BitWrite(len, i << 3);
+ pBS->BitWrite(DSMSW, DSMSW_SIZE<<3);
+ pBS->BitWrite(type, 5);
+ pBS->BitWrite(i-1, 3);
+ pBS->BitWrite(len, i<<3);
}
void CDSMMuxerFilter::MuxFileInfo(IBitStream* pBS)
{
- int len = 1;
- CSimpleMap<CStringA, CStringA> si;
-
- for(int i = 0; i < GetSize(); i++)
- {
- CStringA key = CStringA(CString(GetKeyAt(i))), value = UTF16To8(GetValueAt(i));
- if(key.GetLength() != 4) continue;
- si.Add(key, value);
- len += 4 + value.GetLength() + 1;
- }
-
- MuxPacketHeader(pBS, DSMP_FILEINFO, len);
- pBS->BitWrite(DSMF_VERSION, 8);
- for(int i = 0; i < si.GetSize(); i++)
- {
- CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
- pBS->ByteWrite((LPCSTR)key, 4);
- pBS->ByteWrite((LPCSTR)value, value.GetLength() + 1);
- }
+ int len = 1;
+ CSimpleMap<CStringA, CStringA> si;
+
+ for(int i = 0; i < GetSize(); i++)
+ {
+ CStringA key = CStringA(CString(GetKeyAt(i))), value = UTF16To8(GetValueAt(i));
+ if(key.GetLength() != 4) continue;
+ si.Add(key, value);
+ len += 4 + value.GetLength() + 1;
+ }
+
+ MuxPacketHeader(pBS, DSMP_FILEINFO, len);
+ pBS->BitWrite(DSMF_VERSION, 8);
+ for(int i = 0; i < si.GetSize(); i++)
+ {
+ CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
+ pBS->ByteWrite((LPCSTR)key, 4);
+ pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
+ }
}
void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
{
- int len = 1;
- CSimpleMap<CStringA, CStringA> si;
-
- for(int i = 0; i < pPin->GetSize(); i++)
- {
- CStringA key = CStringA(CString(pPin->GetKeyAt(i))), value = UTF16To8(pPin->GetValueAt(i));
- if(key.GetLength() != 4) continue;
- si.Add(key, value);
- len += 4 + value.GetLength() + 1;
- }
-
- if(len > 1)
- {
- MuxPacketHeader(pBS, DSMP_STREAMINFO, len);
- pBS->BitWrite(pPin->GetID(), 8);
- for(int i = 0; i < si.GetSize(); i++)
- {
- CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
- pBS->ByteWrite((LPCSTR)key, 4);
- pBS->ByteWrite((LPCSTR)value, value.GetLength() + 1);
- }
- }
+ int len = 1;
+ CSimpleMap<CStringA, CStringA> si;
+
+ for(int i = 0; i < pPin->GetSize(); i++)
+ {
+ CStringA key = CStringA(CString(pPin->GetKeyAt(i))), value = UTF16To8(pPin->GetValueAt(i));
+ if(key.GetLength() != 4) continue;
+ si.Add(key, value);
+ len += 4 + value.GetLength() + 1;
+ }
+
+ if(len > 1)
+ {
+ MuxPacketHeader(pBS, DSMP_STREAMINFO, len);
+ pBS->BitWrite(pPin->GetID(), 8);
+ for(int i = 0; i < si.GetSize(); i++)
+ {
+ CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
+ pBS->ByteWrite((LPCSTR)key, 4);
+ pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
+ }
+ }
}
void CDSMMuxerFilter::MuxInit()
{
- m_sps.RemoveAll();
- m_isps.RemoveAll();
- m_rtPrevSyncPoint = _I64_MIN;
+ m_sps.RemoveAll();
+ m_isps.RemoveAll();
+ m_rtPrevSyncPoint = _I64_MIN;
}
void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
{
- CString muxer;
- muxer.Format(_T("DSM Muxer (%s)"), CString(__TIMESTAMP__));
-
- SetProperty(L"MUXR", CStringW(muxer));
- SetProperty(L"DATE", CStringW(CTime::GetCurrentTime().FormatGmt(_T("%Y-%m-%d %H:%M:%S"))));
-
- MuxFileInfo(pBS);
-
- POSITION pos = m_pPins.GetHeadPosition();
- while(pos)
- {
- CBaseMuxerInputPin* pPin = m_pPins.GetNext(pos);
- const CMediaType& mt = pPin->CurrentMediaType();
-
- ASSERT((mt.lSampleSize >> 30) == 0); // you don't need >1GB samples, do you?
-
- MuxPacketHeader(pBS, DSMP_MEDIATYPE, 5 + sizeof(GUID) * 3 + mt.FormatLength());
- pBS->BitWrite(pPin->GetID(), 8);
- pBS->ByteWrite(&mt.majortype, sizeof(mt.majortype));
- pBS->ByteWrite(&mt.subtype, sizeof(mt.subtype));
- pBS->BitWrite(mt.bFixedSizeSamples, 1);
- pBS->BitWrite(mt.bTemporalCompression, 1);
- pBS->BitWrite(mt.lSampleSize, 30);
- pBS->ByteWrite(&mt.formattype, sizeof(mt.formattype));
- pBS->ByteWrite(mt.Format(), mt.FormatLength());
-
- MuxStreamInfo(pBS, pPin);
- }
-
- // resources & chapters
-
- CInterfaceList<IDSMResourceBag> pRBs;
- pRBs.AddTail(this);
-
- CComQIPtr<IDSMChapterBag> pCB = (IUnknown*)(INonDelegatingUnknown*)this;
-
- pos = m_pPins.GetHeadPosition();
- while(pos)
- {
- for(CComPtr<IPin> pPin = m_pPins.GetNext(pos)->GetConnected(); pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin)))
- {
- if(m_fAutoRes)
- {
- CComQIPtr<IDSMResourceBag> pPB = GetFilterFromPin(pPin);
- if(pPB && !pRBs.Find(pPB)) pRBs.AddTail(pPB);
- }
-
- if(m_fAutoChap)
- {
- if(!pCB || pCB->ChapGetCount() == 0) pCB = GetFilterFromPin(pPin);
- }
- }
- }
-
- // resources
-
- pos = pRBs.GetHeadPosition();
- while(pos)
- {
- IDSMResourceBag* pRB = pRBs.GetNext(pos);
-
- for(DWORD i = 0, j = pRB->ResGetCount(); i < j; i++)
- {
- CComBSTR name, desc, mime;
- BYTE* pData = NULL;
- DWORD len = 0;
- if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL)))
- {
- CStringA utf8_name = UTF16To8(name);
- CStringA utf8_desc = UTF16To8(desc);
- CStringA utf8_mime = UTF16To8(mime);
-
- MuxPacketHeader(pBS, DSMP_RESOURCE,
- 1 +
- utf8_name.GetLength() + 1 +
- utf8_desc.GetLength() + 1 +
- utf8_mime.GetLength() + 1 +
- len);
-
- pBS->BitWrite(0, 2);
- pBS->BitWrite(0, 6); // reserved
- pBS->ByteWrite(utf8_name, utf8_name.GetLength() + 1);
- pBS->ByteWrite(utf8_desc, utf8_desc.GetLength() + 1);
- pBS->ByteWrite(utf8_mime, utf8_mime.GetLength() + 1);
- pBS->ByteWrite(pData, len);
-
- CoTaskMemFree(pData);
- }
- }
- }
-
- // chapters
-
- if(pCB)
- {
- CAtlList<CDSMChapter> chapters;
- REFERENCE_TIME rtPrev = 0;
- int len = 0;
-
- pCB->ChapSort();
-
- for(DWORD i = 0; i < pCB->ChapGetCount(); i++)
- {
- CDSMChapter c;
- CComBSTR name;
- if(SUCCEEDED(pCB->ChapGet(i, &c.rt, &name)))
- {
- REFERENCE_TIME rtDiff = c.rt - rtPrev;
- rtPrev = c.rt;
- c.rt = rtDiff;
- c.name = name;
- len += 1 + GetByteLength(myabs(c.rt)) + UTF16To8(c.name).GetLength() + 1;
- chapters.AddTail(c);
- }
- }
-
- if(chapters.GetCount())
- {
- MuxPacketHeader(pBS, DSMP_CHAPTERS, len);
-
- pos = chapters.GetHeadPosition();
- while(pos)
- {
- CDSMChapter& c = chapters.GetNext(pos);
- CStringA name = UTF16To8(c.name);
- int irt = GetByteLength(myabs(c.rt));
- pBS->BitWrite(c.rt < 0, 1);
- pBS->BitWrite(irt, 3);
- pBS->BitWrite(0, 4);
- pBS->BitWrite(myabs(c.rt), irt << 3);
- pBS->ByteWrite((LPCSTR)name, name.GetLength() + 1);
- }
- }
- }
+ CString muxer;
+ muxer.Format(_T("DSM Muxer (%s)"), CString(__TIMESTAMP__));
+
+ SetProperty(L"MUXR", CStringW(muxer));
+ SetProperty(L"DATE", CStringW(CTime::GetCurrentTime().FormatGmt(_T("%Y-%m-%d %H:%M:%S"))));
+
+ MuxFileInfo(pBS);
+
+ POSITION pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ CBaseMuxerInputPin* pPin = m_pPins.GetNext(pos);
+ const CMediaType& mt = pPin->CurrentMediaType();
+
+ ASSERT((mt.lSampleSize >> 30) == 0); // you don't need >1GB samples, do you?
+
+ MuxPacketHeader(pBS, DSMP_MEDIATYPE, 5 + sizeof(GUID)*3 + mt.FormatLength());
+ pBS->BitWrite(pPin->GetID(), 8);
+ pBS->ByteWrite(&mt.majortype, sizeof(mt.majortype));
+ pBS->ByteWrite(&mt.subtype, sizeof(mt.subtype));
+ pBS->BitWrite(mt.bFixedSizeSamples, 1);
+ pBS->BitWrite(mt.bTemporalCompression, 1);
+ pBS->BitWrite(mt.lSampleSize, 30);
+ pBS->ByteWrite(&mt.formattype, sizeof(mt.formattype));
+ pBS->ByteWrite(mt.Format(), mt.FormatLength());
+
+ MuxStreamInfo(pBS, pPin);
+ }
+
+ // resources & chapters
+
+ CInterfaceList<IDSMResourceBag> pRBs;
+ pRBs.AddTail(this);
+
+ CComQIPtr<IDSMChapterBag> pCB = (IUnknown*)(INonDelegatingUnknown*)this;
+
+ pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ for(CComPtr<IPin> pPin = m_pPins.GetNext(pos)->GetConnected(); pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin)))
+ {
+ if(m_fAutoRes)
+ {
+ CComQIPtr<IDSMResourceBag> pPB = GetFilterFromPin(pPin);
+ if(pPB && !pRBs.Find(pPB)) pRBs.AddTail(pPB);
+ }
+
+ if(m_fAutoChap)
+ {
+ if(!pCB || pCB->ChapGetCount() == 0) pCB = GetFilterFromPin(pPin);
+ }
+ }
+ }
+
+ // resources
+
+ pos = pRBs.GetHeadPosition();
+ while(pos)
+ {
+ IDSMResourceBag* pRB = pRBs.GetNext(pos);
+
+ for(DWORD i = 0, j = pRB->ResGetCount(); i < j; i++)
+ {
+ CComBSTR name, desc, mime;
+ BYTE* pData = NULL;
+ DWORD len = 0;
+ if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL)))
+ {
+ CStringA utf8_name = UTF16To8(name);
+ CStringA utf8_desc = UTF16To8(desc);
+ CStringA utf8_mime = UTF16To8(mime);
+
+ MuxPacketHeader(pBS, DSMP_RESOURCE,
+ 1 +
+ utf8_name.GetLength()+1 +
+ utf8_desc.GetLength()+1 +
+ utf8_mime.GetLength()+1 +
+ len);
+
+ pBS->BitWrite(0, 2);
+ pBS->BitWrite(0, 6); // reserved
+ pBS->ByteWrite(utf8_name, utf8_name.GetLength()+1);
+ pBS->ByteWrite(utf8_desc, utf8_desc.GetLength()+1);
+ pBS->ByteWrite(utf8_mime, utf8_mime.GetLength()+1);
+ pBS->ByteWrite(pData, len);
+
+ CoTaskMemFree(pData);
+ }
+ }
+ }
+
+ // chapters
+
+ if(pCB)
+ {
+ CAtlList<CDSMChapter> chapters;
+ REFERENCE_TIME rtPrev = 0;
+ int len = 0;
+
+ pCB->ChapSort();
+
+ for(DWORD i = 0; i < pCB->ChapGetCount(); i++)
+ {
+ CDSMChapter c;
+ CComBSTR name;
+ if(SUCCEEDED(pCB->ChapGet(i, &c.rt, &name)))
+ {
+ REFERENCE_TIME rtDiff = c.rt - rtPrev; rtPrev = c.rt; c.rt = rtDiff;
+ c.name = name;
+ len += 1 + GetByteLength(myabs(c.rt)) + UTF16To8(c.name).GetLength()+1;
+ chapters.AddTail(c);
+ }
+ }
+
+ if(chapters.GetCount())
+ {
+ MuxPacketHeader(pBS, DSMP_CHAPTERS, len);
+
+ pos = chapters.GetHeadPosition();
+ while(pos)
+ {
+ CDSMChapter& c = chapters.GetNext(pos);
+ CStringA name = UTF16To8(c.name);
+ int irt = GetByteLength(myabs(c.rt));
+ pBS->BitWrite(c.rt < 0, 1);
+ pBS->BitWrite(irt, 3);
+ pBS->BitWrite(0, 4);
+ pBS->BitWrite(myabs(c.rt), irt<<3);
+ pBS->ByteWrite((LPCSTR)name, name.GetLength()+1);
+ }
+ }
+ }
}
void CDSMMuxerFilter::MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket)
{
- if(pPacket->IsEOS())
- return;
-
- if(pPacket->pPin->CurrentMediaType().majortype == MEDIATYPE_Text)
- {
- CStringA str((char*)pPacket->pData.GetData(), pPacket->pData.GetCount());
- str.Replace("\xff", " ");
- str.Replace("&nbsp;", " ");
- str.Replace("&nbsp", " ");
- str.Trim();
- if(str.IsEmpty())
- return;
- }
-
- ASSERT(!pPacket->IsSyncPoint() || pPacket->IsTimeValid());
-
- REFERENCE_TIME rtTimeStamp = _I64_MIN, rtDuration = 0;
- int iTimeStamp = 0, iDuration = 0;
-
- if(pPacket->IsTimeValid())
- {
- rtTimeStamp = pPacket->rtStart;
- rtDuration = max(pPacket->rtStop - pPacket->rtStart, 0);
-
- iTimeStamp = GetByteLength(myabs(rtTimeStamp));
- ASSERT(iTimeStamp <= 7);
-
- iDuration = GetByteLength(rtDuration);
- ASSERT(iDuration <= 7);
-
- IndexSyncPoint(pPacket, pBS->GetPos());
- }
-
- int len = 2 + iTimeStamp + iDuration + pPacket->pData.GetCount(); // id + flags + data
-
- MuxPacketHeader(pBS, DSMP_SAMPLE, len);
- pBS->BitWrite(pPacket->pPin->GetID(), 8);
- pBS->BitWrite(pPacket->IsSyncPoint(), 1);
- pBS->BitWrite(rtTimeStamp < 0, 1);
- pBS->BitWrite(iTimeStamp, 3);
- pBS->BitWrite(iDuration, 3);
- pBS->BitWrite(myabs(rtTimeStamp), iTimeStamp << 3);
- pBS->BitWrite(rtDuration, iDuration << 3);
- pBS->ByteWrite(pPacket->pData.GetData(), pPacket->pData.GetCount());
+ if(pPacket->IsEOS())
+ return;
+
+ if(pPacket->pPin->CurrentMediaType().majortype == MEDIATYPE_Text)
+ {
+ CStringA str((char*)pPacket->pData.GetData(), pPacket->pData.GetCount());
+ str.Replace("\xff", " ");
+ str.Replace("&nbsp;", " ");
+ str.Replace("&nbsp", " ");
+ str.Trim();
+ if(str.IsEmpty())
+ return;
+ }
+
+ ASSERT(!pPacket->IsSyncPoint() || pPacket->IsTimeValid());
+
+ REFERENCE_TIME rtTimeStamp = _I64_MIN, rtDuration = 0;
+ int iTimeStamp = 0, iDuration = 0;
+
+ if(pPacket->IsTimeValid())
+ {
+ rtTimeStamp = pPacket->rtStart;
+ rtDuration = max(pPacket->rtStop - pPacket->rtStart, 0);
+
+ iTimeStamp = GetByteLength(myabs(rtTimeStamp));
+ ASSERT(iTimeStamp <= 7);
+
+ iDuration = GetByteLength(rtDuration);
+ ASSERT(iDuration <= 7);
+
+ IndexSyncPoint(pPacket, pBS->GetPos());
+ }
+
+ int len = 2 + iTimeStamp + iDuration + pPacket->pData.GetCount(); // id + flags + data
+
+ MuxPacketHeader(pBS, DSMP_SAMPLE, len);
+ pBS->BitWrite(pPacket->pPin->GetID(), 8);
+ pBS->BitWrite(pPacket->IsSyncPoint(), 1);
+ pBS->BitWrite(rtTimeStamp < 0, 1);
+ pBS->BitWrite(iTimeStamp, 3);
+ pBS->BitWrite(iDuration, 3);
+ pBS->BitWrite(myabs(rtTimeStamp), iTimeStamp<<3);
+ pBS->BitWrite(rtDuration, iDuration<<3);
+ pBS->ByteWrite(pPacket->pData.GetData(), pPacket->pData.GetCount());
}
void CDSMMuxerFilter::MuxFooter(IBitStream* pBS)
{
- // syncpoints
-
- int len = 0;
- CAtlList<IndexedSyncPoint> isps;
- REFERENCE_TIME rtPrev = 0, rt;
- UINT64 fpPrev = 0, fp;
-
- POSITION pos = m_isps.GetHeadPosition();
- while(pos)
- {
- IndexedSyncPoint& isp = m_isps.GetNext(pos);
- TRACE(_T("sp[%d]: %I64d %I64x\n"), isp.id, isp.rt, isp.fp);
-
- rt = isp.rt - rtPrev;
- rtPrev = isp.rt;
- fp = isp.fp - fpPrev;
- fpPrev = isp.fp;
-
- IndexedSyncPoint isp2;
- isp2.fp = fp;
- isp2.rt = rt;
- isps.AddTail(isp2);
-
- len += 1 + GetByteLength(myabs(rt)) + GetByteLength(fp); // flags + rt + fp
- }
-
- MuxPacketHeader(pBS, DSMP_SYNCPOINTS, len);
-
- pos = isps.GetHeadPosition();
- while(pos)
- {
- IndexedSyncPoint& isp = isps.GetNext(pos);
-
- int irt = GetByteLength(myabs(isp.rt));
- int ifp = GetByteLength(isp.fp);
-
- pBS->BitWrite(isp.rt < 0, 1);
- pBS->BitWrite(irt, 3);
- pBS->BitWrite(ifp, 3);
- pBS->BitWrite(0, 1); // reserved
- pBS->BitWrite(myabs(isp.rt), irt << 3);
- pBS->BitWrite(isp.fp, ifp << 3);
- }
+ // syncpoints
+
+ int len = 0;
+ CAtlList<IndexedSyncPoint> isps;
+ REFERENCE_TIME rtPrev = 0, rt;
+ UINT64 fpPrev = 0, fp;
+
+ POSITION pos = m_isps.GetHeadPosition();
+ while(pos)
+ {
+ IndexedSyncPoint& isp = m_isps.GetNext(pos);
+ TRACE(_T("sp[%d]: %I64d %I64x\n"), isp.id, isp.rt, isp.fp);
+
+ rt = isp.rt - rtPrev; rtPrev = isp.rt;
+ fp = isp.fp - fpPrev; fpPrev = isp.fp;
+
+ IndexedSyncPoint isp2;
+ isp2.fp = fp;
+ isp2.rt = rt;
+ isps.AddTail(isp2);
+
+ len += 1 + GetByteLength(myabs(rt)) + GetByteLength(fp); // flags + rt + fp
+ }
+
+ MuxPacketHeader(pBS, DSMP_SYNCPOINTS, len);
+
+ pos = isps.GetHeadPosition();
+ while(pos)
+ {
+ IndexedSyncPoint& isp = isps.GetNext(pos);
+
+ int irt = GetByteLength(myabs(isp.rt));
+ int ifp = GetByteLength(isp.fp);
+
+ pBS->BitWrite(isp.rt < 0, 1);
+ pBS->BitWrite(irt, 3);
+ pBS->BitWrite(ifp, 3);
+ pBS->BitWrite(0, 1); // reserved
+ pBS->BitWrite(myabs(isp.rt), irt<<3);
+ pBS->BitWrite(isp.fp, ifp<<3);
+ }
}
void CDSMMuxerFilter::IndexSyncPoint(const MuxerPacket* p, __int64 fp)
{
- // Yes, this is as complicated as it looks.
- // Rule #1: don't write this packet if you can't do it reliably.
- // (think about overlapped subtitles, line1: 0->10, line2: 1->9)
-
- // FIXME: the very last syncpoints won't get moved to m_isps because there are no more syncpoints to trigger it!
-
- if(fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint())
- return;
-
- ASSERT(p->rtStart >= m_rtPrevSyncPoint);
- m_rtPrevSyncPoint = p->rtStart;
-
- SyncPoint sp;
- sp.id = p->pPin->GetID();
- sp.rtStart = p->rtStart;
- sp.rtStop = p->pPin->IsSubtitleStream() ? p->rtStop : _I64_MAX;
- sp.fp = fp;
-
- {
- SyncPoint& head = !m_sps.IsEmpty() ? m_sps.GetHead() : sp;
- SyncPoint& tail = !m_sps.IsEmpty() ? m_sps.GetTail() : sp;
- REFERENCE_TIME rtfp = !m_isps.IsEmpty() ? m_isps.GetTail().rtfp : _I64_MIN;
-
- if(head.rtStart > rtfp + 1000000) // 100ms limit, just in case every stream had only keyframes, then sycnpoints would be too frequent
- {
- IndexedSyncPoint isp;
- isp.id = head.id;
- isp.rt = tail.rtStart;
- isp.rtfp = head.rtStart;
- isp.fp = head.fp;
- m_isps.AddTail(isp);
- }
- }
-
- POSITION pos = m_sps.GetHeadPosition();
- while(pos)
- {
- POSITION cur = pos;
- SyncPoint& sp2 = m_sps.GetNext(pos);
- if(sp2.id == sp.id && sp2.rtStop <= sp.rtStop || sp2.rtStop <= sp.rtStart)
- m_sps.RemoveAt(cur);
- }
-
- m_sps.AddTail(sp);
+ // Yes, this is as complicated as it looks.
+ // Rule #1: don't write this packet if you can't do it reliably.
+ // (think about overlapped subtitles, line1: 0->10, line2: 1->9)
+
+ // FIXME: the very last syncpoints won't get moved to m_isps because there are no more syncpoints to trigger it!
+
+ if(fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint())
+ return;
+
+ ASSERT(p->rtStart >= m_rtPrevSyncPoint);
+ m_rtPrevSyncPoint = p->rtStart;
+
+ SyncPoint sp;
+ sp.id = p->pPin->GetID();
+ sp.rtStart = p->rtStart;
+ sp.rtStop = p->pPin->IsSubtitleStream() ? p->rtStop : _I64_MAX;
+ sp.fp = fp;
+
+ {
+ SyncPoint& head = !m_sps.IsEmpty() ? m_sps.GetHead() : sp;
+ SyncPoint& tail = !m_sps.IsEmpty() ? m_sps.GetTail() : sp;
+ REFERENCE_TIME rtfp = !m_isps.IsEmpty() ? m_isps.GetTail().rtfp : _I64_MIN;
+
+ if(head.rtStart > rtfp + 1000000) // 100ms limit, just in case every stream had only keyframes, then sycnpoints would be too frequent
+ {
+ IndexedSyncPoint isp;
+ isp.id = head.id;
+ isp.rt = tail.rtStart;
+ isp.rtfp = head.rtStart;
+ isp.fp = head.fp;
+ m_isps.AddTail(isp);
+ }
+ }
+
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ SyncPoint& sp2 = m_sps.GetNext(pos);
+ if(sp2.id == sp.id && sp2.rtStop <= sp.rtStop || sp2.rtStop <= sp.rtStart)
+ m_sps.RemoveAt(cur);
+ }
+
+ m_sps.AddTail(sp);
} \ No newline at end of file
diff --git a/src/filters/muxer/DSMMuxer/DSMMuxer.h b/src/filters/muxer/DSMMuxer/DSMMuxer.h
index 2c5caa023..1d3269127 100644
--- a/src/filters/muxer/DSMMuxer/DSMMuxer.h
+++ b/src/filters/muxer/DSMMuxer/DSMMuxer.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,40 +27,30 @@
[uuid("C6590B76-587E-4082-9125-680D0693A97B")]
class CDSMMuxerFilter : public CBaseMuxerFilter
{
- bool m_fAutoChap, m_fAutoRes;
+ bool m_fAutoChap, m_fAutoRes;
- struct SyncPoint
- {
- BYTE id;
- REFERENCE_TIME rtStart, rtStop;
- __int64 fp;
- };
- struct IndexedSyncPoint
- {
- BYTE id;
- REFERENCE_TIME rt, rtfp;
- __int64 fp;
- };
- CAtlList<SyncPoint> m_sps;
- CAtlList<IndexedSyncPoint> m_isps;
- REFERENCE_TIME m_rtPrevSyncPoint;
- void IndexSyncPoint(const MuxerPacket* p, __int64 fp);
+ struct SyncPoint {BYTE id; REFERENCE_TIME rtStart, rtStop; __int64 fp;};
+ struct IndexedSyncPoint {BYTE id; REFERENCE_TIME rt, rtfp; __int64 fp;};
+ CAtlList<SyncPoint> m_sps;
+ CAtlList<IndexedSyncPoint> m_isps;
+ REFERENCE_TIME m_rtPrevSyncPoint;
+ void IndexSyncPoint(const MuxerPacket* p, __int64 fp);
- void MuxPacketHeader(IBitStream* pBS, dsmp_t type, UINT64 len);
- void MuxFileInfo(IBitStream* pBS);
- void MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin);
+ void MuxPacketHeader(IBitStream* pBS, dsmp_t type, UINT64 len);
+ void MuxFileInfo(IBitStream* pBS);
+ void MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin);
protected:
- void MuxInit();
+ void MuxInit();
- void MuxHeader(IBitStream* pBS);
- void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket);
- void MuxFooter(IBitStream* pBS);
+ void MuxHeader(IBitStream* pBS);
+ void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket);
+ void MuxFooter(IBitStream* pBS);
public:
- CDSMMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, bool fAutoChap = true, bool fAutoRes = true);
- virtual ~CDSMMuxerFilter();
+ CDSMMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, bool fAutoChap = true, bool fAutoRes = true);
+ virtual ~CDSMMuxerFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
};
diff --git a/src/filters/muxer/DSMMuxer/resource.h b/src/filters/muxer/DSMMuxer/resource.h
index 07b0c9339..be7a94010 100644
--- a/src/filters/muxer/DSMMuxer/resource.h
+++ b/src/filters/muxer/DSMMuxer/resource.h
@@ -4,7 +4,7 @@
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/muxer/DSMMuxer/stdafx.cpp b/src/filters/muxer/DSMMuxer/stdafx.cpp
index b28942ef3..5e2cdab92 100644
--- a/src/filters/muxer/DSMMuxer/stdafx.cpp
+++ b/src/filters/muxer/DSMMuxer/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/DSMMuxer/stdafx.h b/src/filters/muxer/DSMMuxer/stdafx.h
index 54ba53b6e..7be94a40c 100644
--- a/src/filters/muxer/DSMMuxer/stdafx.h
+++ b/src/filters/muxer/DSMMuxer/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
index 8e26ed419..1de7b2956 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaFile.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,8 +27,8 @@ using namespace MatroskaWriter;
static void bswap(BYTE* s, int len)
{
- for(BYTE* d = s + len - 1; s < d; s++, d--)
- *s ^= *d, *d ^= *s, *s ^= *d;
+ for(BYTE* d = s + len-1; s < d; s++, d--)
+ *s ^= *d, *d ^= *s, *s ^= *d;
}
//
@@ -39,824 +39,824 @@ CID::CID(DWORD id) : m_id(id)
MatroskaWriter::QWORD CID::Size(bool fWithHeader)
{
- return CUInt(0, m_id).Size(false);
+ return CUInt(0, m_id).Size(false);
}
HRESULT CID::Write(IStream* pStream)
{
- MatroskaWriter::QWORD len = CID::Size();
- DWORD id = m_id;
- bswap((BYTE*)&id, (int)len);
- *(BYTE*)&id = ((*(BYTE*)&id) & (1 << (8 - len)) - 1) | (1 << (8 - len));
- return pStream->Write(&id, (ULONG)len, NULL);
+ MatroskaWriter::QWORD len = CID::Size();
+ DWORD id = m_id;
+ bswap((BYTE*)&id, (int)len);
+ *(BYTE*)&id = ((*(BYTE*)&id)&(1<<(8-len))-1)|(1<<(8-len));
+ return pStream->Write(&id, (ULONG)len, NULL);
}
MatroskaWriter::QWORD CID::HeaderSize(MatroskaWriter::QWORD len)
{
- return CID::Size() + CLength(len).Size();
+ return CID::Size() + CLength(len).Size();
}
HRESULT CID::HeaderWrite(IStream* pStream)
{
- CID::Write(pStream);
- CLength(Size(false)).Write(pStream);
- return S_OK;
+ CID::Write(pStream);
+ CLength(Size(false)).Write(pStream);
+ return S_OK;
}
MatroskaWriter::QWORD CBinary::Size(bool fWithHeader)
{
- if(GetCount() == 0) return 0;
+ if(GetCount() == 0) return 0;
- MatroskaWriter::QWORD len = 0;
- len += GetCount();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += GetCount();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CBinary::Write(IStream* pStream)
{
- if(GetCount() == 0) return S_OK;
+ if(GetCount() == 0) return S_OK;
- HeaderWrite(pStream);
- return pStream->Write(GetData(), GetCount(), NULL);
+ HeaderWrite(pStream);
+ return pStream->Write(GetData(), GetCount(), NULL);
}
MatroskaWriter::QWORD CANSI::Size(bool fWithHeader)
{
- if(GetLength() == 0) return 0;
+ if(GetLength() == 0) return 0;
- MatroskaWriter::QWORD len = 0;
- len += GetLength();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += GetLength();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CANSI::Write(IStream* pStream)
{
- if(GetLength() == 0) return S_OK;
+ if(GetLength() == 0) return S_OK;
- HeaderWrite(pStream);
- return pStream->Write((LPCSTR) * this, GetLength(), NULL);
+ HeaderWrite(pStream);
+ return pStream->Write((LPCSTR)*this, GetLength(), NULL);
}
MatroskaWriter::QWORD CUTF8::Size(bool fWithHeader)
{
- if(GetLength() == 0) return 0;
+ if(GetLength() == 0) return 0;
- MatroskaWriter::QWORD len = 0;
- len += UTF16To8(*this).GetLength();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += UTF16To8(*this).GetLength();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CUTF8::Write(IStream* pStream)
{
- if(GetLength() == 0) return S_OK;
+ if(GetLength() == 0) return S_OK;
- HeaderWrite(pStream);
- CStringA str = UTF16To8(*this);
- return pStream->Write((BYTE*)(LPCSTR)str, str.GetLength(), NULL);
+ HeaderWrite(pStream);
+ CStringA str = UTF16To8(*this);
+ return pStream->Write((BYTE*)(LPCSTR)str, str.GetLength(), NULL);
}
template<class T, class BASE>
MatroskaWriter::QWORD CSimpleVar<T, BASE>::Size(bool fWithHeader)
{
- if(!m_fSet) return 0;
+ if(!m_fSet) return 0;
- MatroskaWriter::QWORD len = 0;
- len += sizeof(T);
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += sizeof(T);
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
template<class T, class BASE>
HRESULT CSimpleVar<T, BASE>::Write(IStream* pStream)
{
- if(!m_fSet) return S_OK;
+ if(!m_fSet) return S_OK;
- HeaderWrite(pStream);
- T val = m_val;
- bswap((BYTE*)&val, sizeof(T));
- return pStream->Write(&val, sizeof(T), NULL);
+ HeaderWrite(pStream);
+ T val = m_val;
+ bswap((BYTE*)&val, sizeof(T));
+ return pStream->Write(&val, sizeof(T), NULL);
}
MatroskaWriter::QWORD CUInt::Size(bool fWithHeader)
{
- if(!m_fSet) return 0;
-
- MatroskaWriter::QWORD len = 0;
-
- if(m_val == 0)
- {
- len++;
- }
- else
- {
- for(int i = 8; i > 0; i--)
- {
- if(((0xffi64 << ((i - 1) * 8))&m_val))
- {
- len += i;
- break;
- }
- }
- }
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ if(!m_fSet) return 0;
+
+ MatroskaWriter::QWORD len = 0;
+
+ if(m_val == 0)
+ {
+ len++;
+ }
+ else
+ {
+ for(int i = 8; i > 0; i--)
+ {
+ if(((0xffi64<<((i-1)*8))&m_val))
+ {
+ len += i;
+ break;
+ }
+ }
+ }
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CUInt::Write(IStream* pStream)
{
- if(!m_fSet) return S_OK;
+ if(!m_fSet) return S_OK;
- CID::Write(pStream);
- CLength l(Size(false));
- l.Write(pStream);
- UINT64 val = m_val;
- bswap((BYTE*)&val, (int)l);
- return pStream->Write(&val, (ULONG)l, NULL);
+ CID::Write(pStream);
+ CLength l(Size(false));
+ l.Write(pStream);
+ UINT64 val = m_val;
+ bswap((BYTE*)&val, (int)l);
+ return pStream->Write(&val, (ULONG)l, NULL);
}
MatroskaWriter::QWORD CInt::Size(bool fWithHeader)
{
- if(!m_fSet) return 0;
-
- MatroskaWriter::QWORD len = 0;
-
- if(m_val == 0)
- {
- len++;
- }
- else
- {
- UINT64 val = m_val >= 0 ? m_val : -m_val;
- for(int i = 8; i > 0; i--)
- {
- if(((0xffi64 << ((i - 1) * 8))&val))
- {
- len += i;
- if(m_val < 0 && !(m_val&(0x80 << (i - 1))))
- len++;
- break;
- }
- }
- }
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ if(!m_fSet) return 0;
+
+ MatroskaWriter::QWORD len = 0;
+
+ if(m_val == 0)
+ {
+ len++;
+ }
+ else
+ {
+ UINT64 val = m_val >= 0 ? m_val : -m_val;
+ for(int i = 8; i > 0; i--)
+ {
+ if(((0xffi64<<((i-1)*8))&val))
+ {
+ len += i;
+ if(m_val < 0 && !(m_val&(0x80<<(i-1))))
+ len++;
+ break;
+ }
+ }
+ }
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CInt::Write(IStream* pStream)
{
- if(!m_fSet) return S_OK;
+ if(!m_fSet) return S_OK;
- CID::Write(pStream);
- CLength l(Size(false));
- l.Write(pStream);
- UINT64 val = m_val;
- bswap((BYTE*)&val, (int)l);
- return pStream->Write(&val, (ULONG)l, NULL);
+ CID::Write(pStream);
+ CLength l(Size(false));
+ l.Write(pStream);
+ UINT64 val = m_val;
+ bswap((BYTE*)&val, (int)l);
+ return pStream->Write(&val, (ULONG)l, NULL);
}
MatroskaWriter::QWORD CLength::Size(bool fWithHeader)
{
- if(m_len == 0x00FFFFFFFFFFFFFFi64)
- return 8;
+ if(m_len == 0x00FFFFFFFFFFFFFFi64)
+ return 8;
- MatroskaWriter::QWORD len = 0;
- for(int i = 1; i <= 8; i++)
- {
- if(!(m_len&(~((1i64 << (7 * i)) - 1))) && (m_len&((1i64 << (7 * i)) - 1)) != ((1i64 << (7 * i)) - 1))
- {
- len += i;
- break;
- }
- }
- return len;
+ MatroskaWriter::QWORD len = 0;
+ for(int i = 1; i <= 8; i++)
+ {
+ if(!(m_len&(~((1i64<<(7*i))-1))) && (m_len&((1i64<<(7*i))-1)) != ((1i64<<(7*i))-1))
+ {
+ len += i;
+ break;
+ }
+ }
+ return len;
}
HRESULT CLength::Write(IStream* pStream)
{
- MatroskaWriter::QWORD len = Size(false);
- UINT64 val = m_len;
- bswap((BYTE*)&val, (int)len);
- *(BYTE*)&val = ((*(BYTE*)&val) & (1 << (8 - len)) - 1) | (1 << (8 - len));
- return pStream->Write(&val, (ULONG)len, NULL);
+ MatroskaWriter::QWORD len = Size(false);
+ UINT64 val = m_len;
+ bswap((BYTE*)&val, (int)len);
+ *(BYTE*)&val = ((*(BYTE*)&val)&(1<<(8-len))-1)|(1<<(8-len));
+ return pStream->Write(&val, (ULONG)len, NULL);
}
//
-EBML::EBML(DWORD id)
- : CID(id)
- , EBMLVersion(0x4286)
- , EBMLReadVersion(0x42F7)
- , EBMLMaxIDLength(0x42F2)
- , EBMLMaxSizeLength(0x42F3)
- , DocType(0x4282)
- , DocTypeVersion(0x4287)
- , DocTypeReadVersion(0x4285)
+EBML::EBML(DWORD id)
+ : CID(id)
+ , EBMLVersion(0x4286)
+ , EBMLReadVersion(0x42F7)
+ , EBMLMaxIDLength(0x42F2)
+ , EBMLMaxSizeLength(0x42F3)
+ , DocType(0x4282)
+ , DocTypeVersion(0x4287)
+ , DocTypeReadVersion(0x4285)
{
}
MatroskaWriter::QWORD EBML::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += EBMLVersion.Size();
- len += EBMLReadVersion.Size();
- len += EBMLMaxIDLength.Size();
- len += EBMLMaxSizeLength.Size();
- len += DocType.Size();
- len += DocTypeVersion.Size();
- len += DocTypeReadVersion.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += EBMLVersion.Size();
+ len += EBMLReadVersion.Size();
+ len += EBMLMaxIDLength.Size();
+ len += EBMLMaxSizeLength.Size();
+ len += DocType.Size();
+ len += DocTypeVersion.Size();
+ len += DocTypeReadVersion.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT EBML::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- EBMLVersion.Write(pStream);
- EBMLReadVersion.Write(pStream);
- EBMLMaxIDLength.Write(pStream);
- EBMLMaxSizeLength.Write(pStream);
- DocType.Write(pStream);
- DocTypeVersion.Write(pStream);
- DocTypeReadVersion.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ EBMLVersion.Write(pStream);
+ EBMLReadVersion.Write(pStream);
+ EBMLMaxIDLength.Write(pStream);
+ EBMLMaxSizeLength.Write(pStream);
+ DocType.Write(pStream);
+ DocTypeVersion.Write(pStream);
+ DocTypeReadVersion.Write(pStream);
+ return S_OK;
}
Info::Info(DWORD id)
- : CID(id)
- , SegmentUID(0x73A4)
- , SegmentFilename(0x7384)
- , PrevUID(0x3CB923)
- , PrevFilename(0x3C83AB)
- , NextUID(0x3EB923)
- , NextFilename(0x3E83BB)
- , TimeCodeScale(0x2AD7B1, 1000000ui64)
- , Duration(0x4489)
- , DateUTC(0x4461)
- , Title(0x7BA9)
- , MuxingApp(0x4D80)
- , WritingApp(0x5741)
+ : CID(id)
+ , SegmentUID(0x73A4)
+ , SegmentFilename(0x7384)
+ , PrevUID(0x3CB923)
+ , PrevFilename(0x3C83AB)
+ , NextUID(0x3EB923)
+ , NextFilename(0x3E83BB)
+ , TimeCodeScale(0x2AD7B1, 1000000ui64)
+ , Duration(0x4489)
+ , DateUTC(0x4461)
+ , Title(0x7BA9)
+ , MuxingApp(0x4D80)
+ , WritingApp(0x5741)
{
}
MatroskaWriter::QWORD Info::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += SegmentUID.Size();
- len += PrevUID.Size();
- len += NextUID.Size();
- len += SegmentFilename.Size();
- len += PrevFilename.Size();
- len += NextFilename.Size();
- len += TimeCodeScale.Size();
- len += Duration.Size();
- len += DateUTC.Size();
- len += Title.Size();
- len += MuxingApp.Size();
- len += WritingApp.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += SegmentUID.Size();
+ len += PrevUID.Size();
+ len += NextUID.Size();
+ len += SegmentFilename.Size();
+ len += PrevFilename.Size();
+ len += NextFilename.Size();
+ len += TimeCodeScale.Size();
+ len += Duration.Size();
+ len += DateUTC.Size();
+ len += Title.Size();
+ len += MuxingApp.Size();
+ len += WritingApp.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Info::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- SegmentUID.Write(pStream);
- PrevUID.Write(pStream);
- NextUID.Write(pStream);
- SegmentFilename.Write(pStream);
- PrevFilename.Write(pStream);
- NextFilename.Write(pStream);
- TimeCodeScale.Write(pStream);
- Duration.Write(pStream);
- DateUTC.Write(pStream);
- Title.Write(pStream);
- MuxingApp.Write(pStream);
- WritingApp.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ SegmentUID.Write(pStream);
+ PrevUID.Write(pStream);
+ NextUID.Write(pStream);
+ SegmentFilename.Write(pStream);
+ PrevFilename.Write(pStream);
+ NextFilename.Write(pStream);
+ TimeCodeScale.Write(pStream);
+ Duration.Write(pStream);
+ DateUTC.Write(pStream);
+ Title.Write(pStream);
+ MuxingApp.Write(pStream);
+ WritingApp.Write(pStream);
+ return S_OK;
}
Segment::Segment(DWORD id)
- : CID(id)
+ : CID(id)
{
}
MatroskaWriter::QWORD Segment::Size(bool fWithHeader)
{
- return 0x00FFFFFFFFFFFFFFi64;
- /*
- MatroskaWriter::QWORD len = 0;
- if(fWithHeader) len += HeaderSize(len);
- return len;
- */
+ return 0x00FFFFFFFFFFFFFFi64;
+/*
+ MatroskaWriter::QWORD len = 0;
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+*/
}
HRESULT Segment::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ return S_OK;
}
Track::Track(DWORD id)
- : CID(id)
+ : CID(id)
{
}
MatroskaWriter::QWORD Track::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += TrackEntries.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += TrackEntries.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Track::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- TrackEntries.Write(pStream);
- return S_OK;
-}
-
-TrackEntry::TrackEntry(DWORD id)
- : CID(id)
- , TrackNumber(0xD7)
- , TrackUID(0x73C5)
- , TrackType(0x83)
- , FlagEnabled(0xB9)
- , FlagDefault(0x88)
- , FlagLacing(0x9C)
- , MinCache(0x6DE7)
- , MaxCache(0x6DF8)
- , Name(0x536E)
- , Language(0x22B59C)
- , CodecID(0x86)
- , CodecPrivate(0x63A2)
- , CodecName(0x258688)
- , CodecSettings(0x3A9697)
- , CodecInfoURL(0x3B4040)
- , CodecDownloadURL(0x26B240)
- , CodecDecodeAll(0xAA)
- , TrackOverlay(0x6FAB)
- , DefaultDuration(0x23E383)
- , v(0xE0)
- , a(0xE1)
-{
- DescType = NoDesc;
+ HeaderWrite(pStream);
+ TrackEntries.Write(pStream);
+ return S_OK;
+}
+
+TrackEntry::TrackEntry(DWORD id)
+ : CID(id)
+ , TrackNumber(0xD7)
+ , TrackUID(0x73C5)
+ , TrackType(0x83)
+ , FlagEnabled(0xB9)
+ , FlagDefault(0x88)
+ , FlagLacing(0x9C)
+ , MinCache(0x6DE7)
+ , MaxCache(0x6DF8)
+ , Name(0x536E)
+ , Language(0x22B59C)
+ , CodecID(0x86)
+ , CodecPrivate(0x63A2)
+ , CodecName(0x258688)
+ , CodecSettings(0x3A9697)
+ , CodecInfoURL(0x3B4040)
+ , CodecDownloadURL(0x26B240)
+ , CodecDecodeAll(0xAA)
+ , TrackOverlay(0x6FAB)
+ , DefaultDuration(0x23E383)
+ , v(0xE0)
+ , a(0xE1)
+{
+ DescType = NoDesc;
}
MatroskaWriter::QWORD TrackEntry::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += TrackNumber.Size();
- len += TrackUID.Size();
- len += TrackType.Size();
- len += FlagEnabled.Size();
- len += FlagDefault.Size();
- len += FlagLacing.Size();
- len += MinCache.Size();
- len += MaxCache.Size();
- len += Name.Size();
- len += Language.Size();
- len += CodecID.Size();
- len += CodecPrivate.Size();
- len += CodecName.Size();
- len += CodecSettings.Size();
- len += CodecInfoURL.Size();
- len += CodecDownloadURL.Size();
- len += CodecDecodeAll.Size();
- len += TrackOverlay.Size();
- len += DefaultDuration.Size();
- if(DescType == TypeVideo) len += v.Size();
- if(DescType == TypeAudio) len += a.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += TrackNumber.Size();
+ len += TrackUID.Size();
+ len += TrackType.Size();
+ len += FlagEnabled.Size();
+ len += FlagDefault.Size();
+ len += FlagLacing.Size();
+ len += MinCache.Size();
+ len += MaxCache.Size();
+ len += Name.Size();
+ len += Language.Size();
+ len += CodecID.Size();
+ len += CodecPrivate.Size();
+ len += CodecName.Size();
+ len += CodecSettings.Size();
+ len += CodecInfoURL.Size();
+ len += CodecDownloadURL.Size();
+ len += CodecDecodeAll.Size();
+ len += TrackOverlay.Size();
+ len += DefaultDuration.Size();
+ if(DescType == TypeVideo) len += v.Size();
+ if(DescType == TypeAudio) len += a.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT TrackEntry::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- TrackNumber.Write(pStream);
- TrackUID.Write(pStream);
- TrackType.Write(pStream);
- FlagEnabled.Write(pStream);
- FlagDefault.Write(pStream);
- FlagLacing.Write(pStream);
- MinCache.Write(pStream);
- MaxCache.Write(pStream);
- Name.Write(pStream);
- Language.Write(pStream);
- CodecID.Write(pStream);
- CodecPrivate.Write(pStream);
- CodecName.Write(pStream);
- CodecSettings.Write(pStream);
- CodecInfoURL.Write(pStream);
- CodecDownloadURL.Write(pStream);
- CodecDecodeAll.Write(pStream);
- TrackOverlay.Write(pStream);
- DefaultDuration.Write(pStream);
- if(DescType == TypeVideo) v.Write(pStream);
- if(DescType == TypeAudio) a.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ TrackNumber.Write(pStream);
+ TrackUID.Write(pStream);
+ TrackType.Write(pStream);
+ FlagEnabled.Write(pStream);
+ FlagDefault.Write(pStream);
+ FlagLacing.Write(pStream);
+ MinCache.Write(pStream);
+ MaxCache.Write(pStream);
+ Name.Write(pStream);
+ Language.Write(pStream);
+ CodecID.Write(pStream);
+ CodecPrivate.Write(pStream);
+ CodecName.Write(pStream);
+ CodecSettings.Write(pStream);
+ CodecInfoURL.Write(pStream);
+ CodecDownloadURL.Write(pStream);
+ CodecDecodeAll.Write(pStream);
+ TrackOverlay.Write(pStream);
+ DefaultDuration.Write(pStream);
+ if(DescType == TypeVideo) v.Write(pStream);
+ if(DescType == TypeAudio) a.Write(pStream);
+ return S_OK;
}
Video::Video(DWORD id)
- : CID(id)
- , FlagInterlaced(0x9A)
- , StereoMode(0x53B8)
- , PixelWidth(0xB0)
- , PixelHeight(0xBA)
- , DisplayWidth(0x54B0)
- , DisplayHeight(0x54BA)
- , DisplayUnit(0x54B2)
- , AspectRatioType(0x54B3)
- , ColourSpace(0x2EB524)
- , GammaValue(0x2FB523)
- , FramePerSec(0x2383E3)
+ : CID(id)
+ , FlagInterlaced(0x9A)
+ , StereoMode(0x53B8)
+ , PixelWidth(0xB0)
+ , PixelHeight(0xBA)
+ , DisplayWidth(0x54B0)
+ , DisplayHeight(0x54BA)
+ , DisplayUnit(0x54B2)
+ , AspectRatioType(0x54B3)
+ , ColourSpace(0x2EB524)
+ , GammaValue(0x2FB523)
+ , FramePerSec(0x2383E3)
{
}
MatroskaWriter::QWORD Video::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += FlagInterlaced.Size();
- len += StereoMode.Size();
- len += PixelWidth.Size();
- len += PixelHeight.Size();
- len += DisplayWidth.Size();
- len += DisplayHeight.Size();
- len += DisplayUnit.Size();
- len += AspectRatioType.Size();
- len += ColourSpace.Size();
- len += GammaValue.Size();
- len += FramePerSec.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += FlagInterlaced.Size();
+ len += StereoMode.Size();
+ len += PixelWidth.Size();
+ len += PixelHeight.Size();
+ len += DisplayWidth.Size();
+ len += DisplayHeight.Size();
+ len += DisplayUnit.Size();
+ len += AspectRatioType.Size();
+ len += ColourSpace.Size();
+ len += GammaValue.Size();
+ len += FramePerSec.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Video::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- FlagInterlaced.Write(pStream);
- StereoMode.Write(pStream);
- PixelWidth.Write(pStream);
- PixelHeight.Write(pStream);
- DisplayWidth.Write(pStream);
- DisplayHeight.Write(pStream);
- DisplayUnit.Write(pStream);
- AspectRatioType.Write(pStream);
- ColourSpace.Write(pStream);
- GammaValue.Write(pStream);
- FramePerSec.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ FlagInterlaced.Write(pStream);
+ StereoMode.Write(pStream);
+ PixelWidth.Write(pStream);
+ PixelHeight.Write(pStream);
+ DisplayWidth.Write(pStream);
+ DisplayHeight.Write(pStream);
+ DisplayUnit.Write(pStream);
+ AspectRatioType.Write(pStream);
+ ColourSpace.Write(pStream);
+ GammaValue.Write(pStream);
+ FramePerSec.Write(pStream);
+ return S_OK;
}
Audio::Audio(DWORD id)
- : CID(id)
- , SamplingFrequency(0xB5)
- , OutputSamplingFrequency(0x78B5)
- , Channels(0x9F)
- , ChannelPositions(0x7D7B)
- , BitDepth(0x6264)
+ : CID(id)
+ , SamplingFrequency(0xB5)
+ , OutputSamplingFrequency(0x78B5)
+ , Channels(0x9F)
+ , ChannelPositions(0x7D7B)
+ , BitDepth(0x6264)
{
}
MatroskaWriter::QWORD Audio::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += SamplingFrequency.Size();
- len += OutputSamplingFrequency.Size();
- len += Channels.Size();
- len += ChannelPositions.Size();
- len += BitDepth.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += SamplingFrequency.Size();
+ len += OutputSamplingFrequency.Size();
+ len += Channels.Size();
+ len += ChannelPositions.Size();
+ len += BitDepth.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Audio::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- SamplingFrequency.Write(pStream);
- OutputSamplingFrequency.Write(pStream);
- Channels.Write(pStream);
- ChannelPositions.Write(pStream);
- BitDepth.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ SamplingFrequency.Write(pStream);
+ OutputSamplingFrequency.Write(pStream);
+ Channels.Write(pStream);
+ ChannelPositions.Write(pStream);
+ BitDepth.Write(pStream);
+ return S_OK;
}
Cluster::Cluster(DWORD id)
- : CID(id)
- , TimeCode(0xE7)
- , Position(0xA7)
- , PrevSize(0xAB)
+ : CID(id)
+ , TimeCode(0xE7)
+ , Position(0xA7)
+ , PrevSize(0xAB)
{
}
MatroskaWriter::QWORD Cluster::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += TimeCode.Size();
- len += Position.Size();
- len += PrevSize.Size();
- len += BlockGroups.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += TimeCode.Size();
+ len += Position.Size();
+ len += PrevSize.Size();
+ len += BlockGroups.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Cluster::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- TimeCode.Write(pStream);
- Position.Write(pStream);
- PrevSize.Write(pStream);
- BlockGroups.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ TimeCode.Write(pStream);
+ Position.Write(pStream);
+ PrevSize.Write(pStream);
+ BlockGroups.Write(pStream);
+ return S_OK;
}
BlockGroup::BlockGroup(DWORD id)
- : CID(id)
- , BlockDuration(0x9B)
- , ReferencePriority(0xFA)
- , ReferenceBlock(0xFB)
- , ReferenceVirtual(0xFD)
- , CodecState(0xA4)
+ : CID(id)
+ , BlockDuration(0x9B)
+ , ReferencePriority(0xFA)
+ , ReferenceBlock(0xFB)
+ , ReferenceVirtual(0xFD)
+ , CodecState(0xA4)
{
}
MatroskaWriter::QWORD BlockGroup::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += BlockDuration.Size();
- len += ReferencePriority.Size();
- len += ReferenceBlock.Size();
- len += ReferenceVirtual.Size();
- len += CodecState.Size();
- len += Block.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += BlockDuration.Size();
+ len += ReferencePriority.Size();
+ len += ReferenceBlock.Size();
+ len += ReferenceVirtual.Size();
+ len += CodecState.Size();
+ len += Block.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT BlockGroup::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- BlockDuration.Write(pStream);
- ReferencePriority.Write(pStream);
- ReferenceBlock.Write(pStream);
- ReferenceVirtual.Write(pStream);
- CodecState.Write(pStream);
- Block.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ BlockDuration.Write(pStream);
+ ReferencePriority.Write(pStream);
+ ReferenceBlock.Write(pStream);
+ ReferenceVirtual.Write(pStream);
+ CodecState.Write(pStream);
+ Block.Write(pStream);
+ return S_OK;
}
CBlock::CBlock(DWORD id)
- : CID(id)
- , TimeCode(0)
+ : CID(id)
+ , TimeCode(0)
{
}
MatroskaWriter::QWORD CBlock::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += TrackNumber.Size() + 2 + 1; // TrackNumber + TimeCode + Lacing
- if(BlockData.GetCount() > 1)
- {
- len += 1; // nBlockData
- POSITION pos = BlockData.GetHeadPosition();
- while(pos)
- {
- CBinary* b = BlockData.GetNext(pos);
- if(pos) len += b->GetCount() / 255 + 1;
- }
- }
- POSITION pos = BlockData.GetHeadPosition();
- while(pos)
- {
- CBinary* b = BlockData.GetNext(pos);
- len += b->GetCount();
- }
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += TrackNumber.Size() + 2 + 1; // TrackNumber + TimeCode + Lacing
+ if(BlockData.GetCount() > 1)
+ {
+ len += 1; // nBlockData
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ if(pos) len += b->GetCount()/255 + 1;
+ }
+ }
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ len += b->GetCount();
+ }
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CBlock::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- TrackNumber.Write(pStream);
- short t = (short)TimeCode;
- bswap((BYTE*)&t, 2);
- pStream->Write(&t, 2, NULL);
- BYTE Lacing = 0;
- BYTE n = BlockData.GetCount();
- if(n > 1) Lacing |= 2;
- pStream->Write(&Lacing, 1, NULL);
- if(n > 1)
- {
- pStream->Write(&n, 1, NULL);
- POSITION pos = BlockData.GetHeadPosition();
- while(pos)
- {
- CBinary* b = BlockData.GetNext(pos);
- if(pos)
- {
- int len = b->GetCount();
- while(len >= 0)
- {
- n = min(len, 255);
- pStream->Write(&n, 1, NULL);
- len -= 255;
- }
- }
- }
- }
- POSITION pos = BlockData.GetHeadPosition();
- while(pos)
- {
- CBinary* b = BlockData.GetNext(pos);
- pStream->Write(b->GetData(), b->GetCount(), NULL);
- }
- return S_OK;
+ HeaderWrite(pStream);
+ TrackNumber.Write(pStream);
+ short t = (short)TimeCode;
+ bswap((BYTE*)&t, 2);
+ pStream->Write(&t, 2, NULL);
+ BYTE Lacing = 0;
+ BYTE n = BlockData.GetCount();
+ if(n > 1) Lacing |= 2;
+ pStream->Write(&Lacing, 1, NULL);
+ if(n > 1)
+ {
+ pStream->Write(&n, 1, NULL);
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ if(pos)
+ {
+ int len = b->GetCount();
+ while(len >= 0)
+ {
+ n = min(len, 255);
+ pStream->Write(&n, 1, NULL);
+ len -= 255;
+ }
+ }
+ }
+ }
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ pStream->Write(b->GetData(), b->GetCount(), NULL);
+ }
+ return S_OK;
}
Cue::Cue(DWORD id)
- : CID(id)
+ : CID(id)
{
}
MatroskaWriter::QWORD Cue::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += CuePoints.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += CuePoints.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Cue::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- CuePoints.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ CuePoints.Write(pStream);
+ return S_OK;
}
CuePoint::CuePoint(DWORD id)
- : CID(id)
- , CueTime(0xB3)
+ : CID(id)
+ , CueTime(0xB3)
{
}
MatroskaWriter::QWORD CuePoint::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += CueTime.Size();
- len += CueTrackPositions.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += CueTime.Size();
+ len += CueTrackPositions.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CuePoint::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- CueTime.Write(pStream);
- CueTrackPositions.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ CueTime.Write(pStream);
+ CueTrackPositions.Write(pStream);
+ return S_OK;
}
CueTrackPosition::CueTrackPosition(DWORD id)
- : CID(id)
- , CueTrack(0xF7)
- , CueClusterPosition(0xF1)
- , CueBlockNumber(0x5387)
- , CueCodecState(0xEA)
+ : CID(id)
+ , CueTrack(0xF7)
+ , CueClusterPosition(0xF1)
+ , CueBlockNumber(0x5387)
+ , CueCodecState(0xEA)
{
}
MatroskaWriter::QWORD CueTrackPosition::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += CueTrack.Size();
- len += CueClusterPosition.Size();
- len += CueBlockNumber.Size();
- len += CueCodecState.Size();
+ MatroskaWriter::QWORD len = 0;
+ len += CueTrack.Size();
+ len += CueClusterPosition.Size();
+ len += CueBlockNumber.Size();
+ len += CueCodecState.Size();
// len += CueReferences.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT CueTrackPosition::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- CueTrack.Write(pStream);
- CueClusterPosition.Write(pStream);
- CueBlockNumber.Write(pStream);
- CueCodecState.Write(pStream);
+ HeaderWrite(pStream);
+ CueTrack.Write(pStream);
+ CueClusterPosition.Write(pStream);
+ CueBlockNumber.Write(pStream);
+ CueCodecState.Write(pStream);
// CueReferences.Write(pStream);
- return S_OK;
+ return S_OK;
}
Seek::Seek(DWORD id)
- : CID(id)
+ : CID(id)
{
}
MatroskaWriter::QWORD Seek::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += SeekHeads.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += SeekHeads.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Seek::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- SeekHeads.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ SeekHeads.Write(pStream);
+ return S_OK;
}
SeekID::SeekID(DWORD id)
- : CID(id)
- , m_id(0)
+ : CID(id)
+ , m_id(0)
{
}
MatroskaWriter::QWORD SeekID::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += m_id.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += m_id.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT SeekID::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- m_id.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ m_id.Write(pStream);
+ return S_OK;
}
SeekHead::SeekHead(DWORD id)
- : CID(id)
- , Position(0x53AC)
+ : CID(id)
+ , Position(0x53AC)
{
}
MatroskaWriter::QWORD SeekHead::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += ID.Size();
- len += Position.Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += ID.Size();
+ len += Position.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT SeekHead::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- ID.Write(pStream);
- Position.Write(pStream);
- return S_OK;
+ HeaderWrite(pStream);
+ ID.Write(pStream);
+ Position.Write(pStream);
+ return S_OK;
}
Tags::Tags(DWORD id)
- : CID(id)
+ : CID(id)
{
}
MatroskaWriter::QWORD Tags::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
+ MatroskaWriter::QWORD len = 0;
// len += .Size();
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Tags::Write(IStream* pStream)
{
- HeaderWrite(pStream);
+ HeaderWrite(pStream);
// .Write(pStream);
- return S_OK;
+ return S_OK;
}
Void::Void(MatroskaWriter::QWORD len, DWORD id)
- : CID(id)
- , m_len(len)
+ : CID(id)
+ , m_len(len)
{
}
MatroskaWriter::QWORD Void::Size(bool fWithHeader)
{
- MatroskaWriter::QWORD len = 0;
- len += m_len;
- if(fWithHeader) len += HeaderSize(len);
- return len;
+ MatroskaWriter::QWORD len = 0;
+ len += m_len;
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
}
HRESULT Void::Write(IStream* pStream)
{
- HeaderWrite(pStream);
- BYTE buff[64];
- memset(buff, 0x80, sizeof(buff));
- for(int len = (int)m_len; len > 0; len -= sizeof(buff))
- pStream->Write(buff, (ULONG)min(sizeof(buff), len), NULL);
- return S_OK;
+ HeaderWrite(pStream);
+ BYTE buff[64];
+ memset(buff, 0x80, sizeof(buff));
+ for(int len = (int)m_len; len > 0; len -= sizeof(buff))
+ pStream->Write(buff, (ULONG)min(sizeof(buff), len), NULL);
+ return S_OK;
}
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaFile.h b/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
index 3965ac6d8..80273dd76 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaFile.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,304 +26,264 @@
namespace MatroskaWriter
{
-typedef unsigned __int64 QWORD;
-
-class CID
-{
-protected:
- DWORD m_id;
- QWORD HeaderSize(QWORD len);
- HRESULT HeaderWrite(IStream* pStream);
-
-public:
- CID(DWORD id);
- DWORD GetID() const
- {
- return m_id;
- }
- virtual QWORD Size(bool fWithHeader = true);
- virtual HRESULT Write(IStream* pStream);
-};
-
-class CLength : public CID
-{
- UINT64 m_len;
-public:
- CLength(UINT64 len = 0) : CID(0), m_len(len) {}
- operator UINT64()
- {
- return m_len;
- }
- QWORD Size(bool fWithHeader = false);
- HRESULT Write(IStream* pStream);
-};
-
-class CBinary : public CAtlArray<BYTE>, public CID
-{
-public:
- CBinary(DWORD id) : CID(id) {}
- CBinary& operator = (const CBinary& b)
- {
- Copy(b);
- return(*this);
- }
- operator BYTE*()
- {
- return (BYTE*)GetData();
- }
- CBinary& Set(CStringA str)
- {
- SetCount(str.GetLength() + 1);
- strcpy((char*)GetData(), str);
- return(*this);
- }
+ typedef unsigned __int64 QWORD;
+
+ class CID
+ {
+ protected:
+ DWORD m_id;
+ QWORD HeaderSize(QWORD len);
+ HRESULT HeaderWrite(IStream* pStream);
+
+ public:
+ CID(DWORD id);
+ DWORD GetID() const {return m_id;}
+ virtual QWORD Size(bool fWithHeader = true);
+ virtual HRESULT Write(IStream* pStream);
+ };
+
+ class CLength : public CID
+ {
+ UINT64 m_len;
+ public:
+ CLength(UINT64 len = 0) : CID(0), m_len(len) {}
+ operator UINT64() {return m_len;}
+ QWORD Size(bool fWithHeader = false);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CBinary : public CAtlArray<BYTE>, public CID
+ {
+ public:
+ CBinary(DWORD id) : CID(id) {}
+ CBinary& operator = (const CBinary& b) {Copy(b); return(*this);}
+ operator BYTE*() {return (BYTE*)GetData();}
+ CBinary& Set(CStringA str) {SetCount(str.GetLength()+1); strcpy((char*)GetData(), str); return(*this);}
// CBinary& Set(CStringA str) {SetCount(str.GetLength()); memcpy((char*)GetData(), str, str.GetLength()); return(*this);}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CANSI : public CStringA, public CID
-{
-public:
- CANSI(DWORD id) : CID(id) {}
- CANSI& Set(CStringA str)
- {
- CStringA::operator = (str);
- return(*this);
- }
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CUTF8 : public CStringW, public CID
-{
-public:
- CUTF8(DWORD id) : CID(id) {}
- CUTF8& Set(CStringW str)
- {
- CStringW::operator = (str);
- return(*this);
- }
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-template<class T, class BASE>
-class CSimpleVar : public CID
-{
-protected:
- T m_val;
- bool m_fSet;
-public:
- explicit CSimpleVar(DWORD id, T val = 0) : CID(id), m_val(val)
- {
- m_fSet = !!val;
- }
- operator T()
- {
- return m_val;
- }
- BASE& Set(T val)
- {
- m_val = val;
- m_fSet = true;
- return(*(BASE*)this);
- }
- void UnSet()
- {
- m_fSet = false;
- }
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CUInt : public CSimpleVar<UINT64, CUInt>
-{
-public:
- explicit CUInt(DWORD id, UINT64 val = 0) : CSimpleVar<UINT64, CUInt>(id, val) {}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CInt : public CSimpleVar<INT64, CInt>
-{
-public:
- explicit CInt(DWORD id, INT64 val = 0) : CSimpleVar<INT64, CInt>(id, val) {}
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CByte : public CSimpleVar<BYTE, CByte>
-{
-public:
- explicit CByte(DWORD id, BYTE val = 0) : CSimpleVar<BYTE, CByte>(id, val) {}
-};
-
-class CShort : public CSimpleVar<short, CShort>
-{
-public:
- explicit CShort(DWORD id, short val = 0) : CSimpleVar<short, CShort>(id, val) {}
-};
-
-class CFloat : public CSimpleVar<float, CFloat>
-{
-public:
- explicit CFloat(DWORD id, float val = 0) : CSimpleVar<float, CFloat>(id, val) {}
-};
-
-template<class T>
-class CNode : public CAutoPtrList<T>
-{
-public:
- QWORD Size(bool fWithHeader = true)
- {
- QWORD len = 0;
- POSITION pos = GetHeadPosition();
- while(pos) len += GetNext(pos)->Size(fWithHeader);
- return len;
- }
- HRESULT Write(IStream* pStream)
- {
- HRESULT hr;
- POSITION pos = GetHeadPosition();
- while(pos) if(FAILED(hr = GetNext(pos)->Write(pStream))) return hr;
- return S_OK;
- }
-};
-
-class EBML : public CID
-{
-public:
- CUInt EBMLVersion, EBMLReadVersion;
- CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
- CANSI DocType;
- CUInt DocTypeVersion, DocTypeReadVersion;
-
- EBML(DWORD id = 0x1A45DFA3);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Info : public CID
-{
-public:
- CBinary SegmentUID, PrevUID, NextUID;
- CUTF8 SegmentFilename, PrevFilename, NextFilename;
- CUInt TimeCodeScale; // [ns], default: 1.000.000
- CFloat Duration;
- CInt DateUTC;
- CUTF8 Title, MuxingApp, WritingApp;
-
- Info(DWORD id = 0x1549A966);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Video : public CID
-{
-public:
- CUInt FlagInterlaced, StereoMode;
- CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
- CUInt AspectRatioType;
- CUInt ColourSpace;
- CFloat GammaValue;
- CFloat FramePerSec;
-
- Video(DWORD id = 0xE0);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Audio : public CID
-{
-public:
- CFloat SamplingFrequency;
- CFloat OutputSamplingFrequency;
- CUInt Channels;
- CBinary ChannelPositions;
- CUInt BitDepth;
-
- Audio(DWORD id = 0xE1);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class TrackEntry : public CID
-{
-public:
- enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
- CUInt TrackNumber, TrackUID, TrackType;
- CUInt FlagEnabled, FlagDefault, FlagLacing;
- CUInt MinCache, MaxCache;
- CUTF8 Name;
- CANSI Language;
- CBinary CodecID;
- CBinary CodecPrivate;
- CUTF8 CodecName;
- CUTF8 CodecSettings;
- CANSI CodecInfoURL;
- CANSI CodecDownloadURL;
- CUInt CodecDecodeAll;
- CUInt TrackOverlay;
- CUInt DefaultDuration;
- enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
- int DescType;
- Video v;
- Audio a;
-
- TrackEntry(DWORD id = 0xAE);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Track : public CID
-{
-public:
- CNode<TrackEntry> TrackEntries;
-
- Track(DWORD id = 0x1654AE6B);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CBlock : public CID
-{
-public:
- CLength TrackNumber;
- REFERENCE_TIME TimeCode, TimeCodeStop;
- CNode<CBinary> BlockData;
-
- CBlock(DWORD id = 0xA1);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class BlockGroup : public CID
-{
-public:
- CUInt BlockDuration;
- CUInt ReferencePriority;
- CInt ReferenceBlock;
- CInt ReferenceVirtual;
- CBinary CodecState;
- CBlock Block;
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CANSI : public CStringA, public CID
+ {
+ public:
+ CANSI(DWORD id) : CID(id) {}
+ CANSI& Set(CStringA str) {CStringA::operator = (str); return(*this);}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CUTF8 : public CStringW, public CID
+ {
+ public:
+ CUTF8(DWORD id) : CID(id) {}
+ CUTF8& Set(CStringW str) {CStringW::operator = (str); return(*this);}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ template<class T, class BASE>
+ class CSimpleVar : public CID
+ {
+ protected:
+ T m_val;
+ bool m_fSet;
+ public:
+ explicit CSimpleVar(DWORD id, T val = 0) : CID(id), m_val(val) {m_fSet = !!val;}
+ operator T() {return m_val;}
+ BASE& Set(T val) {m_val = val; m_fSet = true; return(*(BASE*)this);}
+ void UnSet() {m_fSet = false;}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CUInt : public CSimpleVar<UINT64, CUInt>
+ {
+ public:
+ explicit CUInt(DWORD id, UINT64 val = 0) : CSimpleVar<UINT64, CUInt>(id, val) {}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CInt : public CSimpleVar<INT64, CInt>
+ {
+ public:
+ explicit CInt(DWORD id, INT64 val = 0) : CSimpleVar<INT64, CInt>(id, val) {}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CByte : public CSimpleVar<BYTE, CByte>
+ {
+ public:
+ explicit CByte(DWORD id, BYTE val = 0) : CSimpleVar<BYTE, CByte>(id, val) {}
+ };
+
+ class CShort : public CSimpleVar<short, CShort>
+ {
+ public:
+ explicit CShort(DWORD id, short val = 0) : CSimpleVar<short, CShort>(id, val) {}
+ };
+
+ class CFloat : public CSimpleVar<float, CFloat>
+ {
+ public:
+ explicit CFloat(DWORD id, float val = 0) : CSimpleVar<float, CFloat>(id, val) {}
+ };
+
+ template<class T>
+ class CNode : public CAutoPtrList<T>
+ {
+ public:
+ QWORD Size(bool fWithHeader = true)
+ {
+ QWORD len = 0;
+ POSITION pos = GetHeadPosition();
+ while(pos) len += GetNext(pos)->Size(fWithHeader);
+ return len;
+ }
+ HRESULT Write(IStream* pStream)
+ {
+ HRESULT hr;
+ POSITION pos = GetHeadPosition();
+ while(pos) if(FAILED(hr = GetNext(pos)->Write(pStream))) return hr;
+ return S_OK;
+ }
+ };
+
+ class EBML : public CID
+ {
+ public:
+ CUInt EBMLVersion, EBMLReadVersion;
+ CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
+ CANSI DocType;
+ CUInt DocTypeVersion, DocTypeReadVersion;
+
+ EBML(DWORD id = 0x1A45DFA3);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Info : public CID
+ {
+ public:
+ CBinary SegmentUID, PrevUID, NextUID;
+ CUTF8 SegmentFilename, PrevFilename, NextFilename;
+ CUInt TimeCodeScale; // [ns], default: 1.000.000
+ CFloat Duration;
+ CInt DateUTC;
+ CUTF8 Title, MuxingApp, WritingApp;
+
+ Info(DWORD id = 0x1549A966);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Video : public CID
+ {
+ public:
+ CUInt FlagInterlaced, StereoMode;
+ CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
+ CUInt AspectRatioType;
+ CUInt ColourSpace;
+ CFloat GammaValue;
+ CFloat FramePerSec;
+
+ Video(DWORD id = 0xE0);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Audio : public CID
+ {
+ public:
+ CFloat SamplingFrequency;
+ CFloat OutputSamplingFrequency;
+ CUInt Channels;
+ CBinary ChannelPositions;
+ CUInt BitDepth;
+
+ Audio(DWORD id = 0xE1);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class TrackEntry : public CID
+ {
+ public:
+ enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
+ CUInt TrackNumber, TrackUID, TrackType;
+ CUInt FlagEnabled, FlagDefault, FlagLacing;
+ CUInt MinCache, MaxCache;
+ CUTF8 Name;
+ CANSI Language;
+ CBinary CodecID;
+ CBinary CodecPrivate;
+ CUTF8 CodecName;
+ CUTF8 CodecSettings;
+ CANSI CodecInfoURL;
+ CANSI CodecDownloadURL;
+ CUInt CodecDecodeAll;
+ CUInt TrackOverlay;
+ CUInt DefaultDuration;
+ enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
+ int DescType;
+ Video v;
+ Audio a;
+
+ TrackEntry(DWORD id = 0xAE);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Track : public CID
+ {
+ public:
+ CNode<TrackEntry> TrackEntries;
+
+ Track(DWORD id = 0x1654AE6B);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CBlock : public CID
+ {
+ public:
+ CLength TrackNumber;
+ REFERENCE_TIME TimeCode, TimeCodeStop;
+ CNode<CBinary> BlockData;
+
+ CBlock(DWORD id = 0xA1);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class BlockGroup : public CID
+ {
+ public:
+ CUInt BlockDuration;
+ CUInt ReferencePriority;
+ CInt ReferenceBlock;
+ CInt ReferenceVirtual;
+ CBinary CodecState;
+ CBlock Block;
// CNode<TimeSlice> TimeSlices;
- BlockGroup(DWORD id = 0xA0);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
+ BlockGroup(DWORD id = 0xA0);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
-class Cluster : public CID
-{
-public:
- CUInt TimeCode, Position, PrevSize;
- CNode<BlockGroup> BlockGroups;
+ class Cluster : public CID
+ {
+ public:
+ CUInt TimeCode, Position, PrevSize;
+ CNode<BlockGroup> BlockGroups;
- Cluster(DWORD id = 0x1F43B675);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
+ Cluster(DWORD id = 0x1F43B675);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
/* class CueReference : public CID
{
@@ -335,96 +295,93 @@ public:
HRESULT Write(IStream* pStream);
};
*/
-class CueTrackPosition : public CID
-{
-public:
- CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
+ class CueTrackPosition : public CID
+ {
+ public:
+ CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
// CNode<CueReference> CueReferences;
- CueTrackPosition(DWORD id = 0xB7);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class CuePoint : public CID
-{
-public:
- CUInt CueTime;
- CNode<CueTrackPosition> CueTrackPositions;
-
- CuePoint(DWORD id = 0xBB);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Cue : public CID
-{
-public:
- CNode<CuePoint> CuePoints;
-
- Cue(DWORD id = 0x1C53BB6B);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class SeekID : public CID
-{
- CID m_id;
-public:
- SeekID(DWORD id = 0x53AB);
- void Set(DWORD id)
- {
- m_id = id;
- }
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class SeekHead : public CID
-{
-public:
- SeekID ID;
- CUInt Position;
-
- SeekHead(DWORD id = 0x4DBB);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Seek : public CID
-{
-public:
- CNode<SeekHead> SeekHeads;
-
- Seek(DWORD id = 0x114D9B74);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Segment : public CID
-{
-public:
- Segment(DWORD id = 0x18538067);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Tags : public CID
-{
-public:
- // TODO
-
- Tags(DWORD id = 0x1254C367);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
-
-class Void : public CID
-{
- QWORD m_len;
-public:
- Void(QWORD len, DWORD id = 0xEC);
- QWORD Size(bool fWithHeader = true);
- HRESULT Write(IStream* pStream);
-};
+ CueTrackPosition(DWORD id = 0xB7);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CuePoint : public CID
+ {
+ public:
+ CUInt CueTime;
+ CNode<CueTrackPosition> CueTrackPositions;
+
+ CuePoint(DWORD id = 0xBB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Cue : public CID
+ {
+ public:
+ CNode<CuePoint> CuePoints;
+
+ Cue(DWORD id = 0x1C53BB6B);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class SeekID : public CID
+ {
+ CID m_id;
+ public:
+ SeekID(DWORD id = 0x53AB);
+ void Set(DWORD id) {m_id = id;}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class SeekHead : public CID
+ {
+ public:
+ SeekID ID;
+ CUInt Position;
+
+ SeekHead(DWORD id = 0x4DBB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Seek : public CID
+ {
+ public:
+ CNode<SeekHead> SeekHeads;
+
+ Seek(DWORD id = 0x114D9B74);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Segment : public CID
+ {
+ public:
+ Segment(DWORD id = 0x18538067);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Tags : public CID
+ {
+ public:
+ // TODO
+
+ Tags(DWORD id = 0x1254C367);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Void : public CID
+ {
+ QWORD m_len;
+ public:
+ Void(QWORD len, DWORD id = 0xEC);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
}
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
index fd353c4fa..c4fff1a35 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,7 +33,7 @@ using namespace MatroskaWriter;
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska}
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska}
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -44,24 +44,24 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMatroskaMuxerFilter), L"MPC - Matroska Muxer", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CMatroskaMuxerFilter), L"MPC - Matroska Muxer", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaMuxerFilter>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaMuxerFilter>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -75,627 +75,576 @@ CFilterApp theApp;
//
CMatroskaMuxerFilter::CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseFilter(NAME("CMatroskaMuxerFilter"), pUnk, this, __uuidof(this))
- , m_rtCurrent(0)
- , m_fNegative(true), m_fPositive(false)
+ : CBaseFilter(NAME("CMatroskaMuxerFilter"), pUnk, this, __uuidof(this))
+ , m_rtCurrent(0)
+ , m_fNegative(true), m_fPositive(false)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- m_pOutput.Attach(DNew CMatroskaMuxerOutputPin(NAME("CMatroskaMuxerOutputPin"), this, this, phr));
+ m_pOutput.Attach(DNew CMatroskaMuxerOutputPin(NAME("CMatroskaMuxerOutputPin"), this, this, phr));
- AddInput();
+ AddInput();
- srand(clock());
+ srand(clock());
}
CMatroskaMuxerFilter::~CMatroskaMuxerFilter()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
}
STDMETHODIMP CMatroskaMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- *ppv = NULL;
+ *ppv = NULL;
- return
+ return
// QI(IAMFilterMiscFlags)
- QI(IMediaSeeking)
- QI(IMatroskaMuxer)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ QI(IMediaSeeking)
+ QI(IMatroskaMuxer)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
UINT CMatroskaMuxerFilter::GetTrackNumber(CBasePin* pPin)
{
- UINT nTrackNumber = 0;
+ UINT nTrackNumber = 0;
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- nTrackNumber++;
- if(m_pInputs.GetNext(pos) == pPin)
- return nTrackNumber;
- }
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ nTrackNumber++;
+ if(m_pInputs.GetNext(pos) == pPin)
+ return nTrackNumber;
+ }
- return 0;
+ return 0;
}
void CMatroskaMuxerFilter::AddInput()
{
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CBasePin* pPin = m_pInputs.GetNext(pos);
- if(!pPin->IsConnected()) return;
- }
-
- CStringW name;
- name.Format(L"Track %d", m_pInputs.GetCount() + 1);
-
- HRESULT hr;
- CAutoPtr<CMatroskaMuxerInputPin> pPin(DNew CMatroskaMuxerInputPin(name, this, this, &hr));
- m_pInputs.AddTail(pPin);
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBasePin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) return;
+ }
+
+ CStringW name;
+ name.Format(L"Track %d", m_pInputs.GetCount()+1);
+
+ HRESULT hr;
+ CAutoPtr<CMatroskaMuxerInputPin> pPin(DNew CMatroskaMuxerInputPin(name, this, this, &hr));
+ m_pInputs.AddTail(pPin);
}
int CMatroskaMuxerFilter::GetPinCount()
{
- return m_pInputs.GetCount() + (m_pOutput ? 1 : 0);
+ return m_pInputs.GetCount() + (m_pOutput ? 1 : 0);
}
CBasePin* CMatroskaMuxerFilter::GetPin(int n)
{
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pInputs.GetCount())
- {
- if(POSITION pos = m_pInputs.FindIndex(n))
- return m_pInputs.GetAt(pos);
- }
+ if(n >= 0 && n < (int)m_pInputs.GetCount())
+ {
+ if(POSITION pos = m_pInputs.FindIndex(n))
+ return m_pInputs.GetAt(pos);
+ }
- if(n == m_pInputs.GetCount() && m_pOutput)
- {
- return m_pOutput;
- }
+ if(n == m_pInputs.GetCount() && m_pOutput)
+ {
+ return m_pOutput;
+ }
- return NULL;
+ return NULL;
}
STDMETHODIMP CMatroskaMuxerFilter::Stop()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- HRESULT hr;
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Stop()))
+ return hr;
- if(FAILED(hr = __super::Stop()))
- return hr;
+ CallWorker(CMD_EXIT);
- CallWorker(CMD_EXIT);
-
- return hr;
+ return hr;
}
STDMETHODIMP CMatroskaMuxerFilter::Pause()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- FILTER_STATE fs = m_State;
+ FILTER_STATE fs = m_State;
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::Pause()))
- return hr;
+ if(FAILED(hr = __super::Pause()))
+ return hr;
- if(fs == State_Stopped && m_pOutput)
- {
- CAMThread::Create();
- CallWorker(CMD_RUN);
- }
+ if(fs == State_Stopped && m_pOutput)
+ {
+ CAMThread::Create();
+ CallWorker(CMD_RUN);
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CMatroskaMuxerFilter::Run(REFERENCE_TIME tStart)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::Run(tStart)))
- return hr;
+ if(FAILED(hr = __super::Run(tStart)))
+ return hr;
- return hr;
+ return hr;
}
// IAMFilterMiscFlags
STDMETHODIMP_(ULONG) CMatroskaMuxerFilter::GetMiscFlags()
{
- return AM_FILTER_MISC_FLAGS_IS_RENDERER;
+ return AM_FILTER_MISC_FLAGS_IS_RENDERER;
}
// IMediaSeeking
STDMETHODIMP CMatroskaMuxerFilter::GetCapabilities(DWORD* pCapabilities)
{
- return pCapabilities ? *pCapabilities =
- AM_SEEKING_CanGetDuration |
- AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
+ return pCapabilities ? *pCapabilities =
+ AM_SEEKING_CanGetDuration|
+ AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
}
STDMETHODIMP CMatroskaMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
{
- CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) return S_OK;
- DWORD caps;
- GetCapabilities(&caps);
- caps &= *pCapabilities;
- return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
-}
-STDMETHODIMP CMatroskaMuxerFilter::IsFormatSupported(const GUID* pFormat)
-{
- return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
-}
-STDMETHODIMP CMatroskaMuxerFilter::QueryPreferredFormat(GUID* pFormat)
-{
- return GetTimeFormat(pFormat);
-}
-STDMETHODIMP CMatroskaMuxerFilter::GetTimeFormat(GUID* pFormat)
-{
- return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
-}
-STDMETHODIMP CMatroskaMuxerFilter::IsUsingTimeFormat(const GUID* pFormat)
-{
- return IsFormatSupported(pFormat);
-}
-STDMETHODIMP CMatroskaMuxerFilter::SetTimeFormat(const GUID* pFormat)
-{
- return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
+ CheckPointer(pCapabilities, E_POINTER);
+ if(*pCapabilities == 0) return S_OK;
+ DWORD caps;
+ GetCapabilities(&caps);
+ caps &= *pCapabilities;
+ return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
}
+STDMETHODIMP CMatroskaMuxerFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
+STDMETHODIMP CMatroskaMuxerFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
+STDMETHODIMP CMatroskaMuxerFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
+STDMETHODIMP CMatroskaMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
+STDMETHODIMP CMatroskaMuxerFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
STDMETHODIMP CMatroskaMuxerFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- *pDuration = 0;
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- REFERENCE_TIME rt = m_pInputs.GetNext(pos)->m_rtDur;
- if(rt > *pDuration) *pDuration = rt;
- }
- return S_OK;
-}
-STDMETHODIMP CMatroskaMuxerFilter::GetStopPosition(LONGLONG* pStop)
-{
- return E_NOTIMPL;
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = 0;
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos) {REFERENCE_TIME rt = m_pInputs.GetNext(pos)->m_rtDur; if(rt > *pDuration) *pDuration = rt;}
+ return S_OK;
}
+STDMETHODIMP CMatroskaMuxerFilter::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
STDMETHODIMP CMatroskaMuxerFilter::GetCurrentPosition(LONGLONG* pCurrent)
{
- CheckPointer(pCurrent, E_POINTER);
- *pCurrent = m_rtCurrent;
- return S_OK;
-}
-STDMETHODIMP CMatroskaMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CMatroskaMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CMatroskaMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CMatroskaMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CMatroskaMuxerFilter::SetRate(double dRate)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CMatroskaMuxerFilter::GetRate(double* pdRate)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CMatroskaMuxerFilter::GetPreroll(LONGLONG* pllPreroll)
-{
- return E_NOTIMPL;
+ CheckPointer(pCurrent, E_POINTER);
+ *pCurrent = m_rtCurrent;
+ return S_OK;
}
+STDMETHODIMP CMatroskaMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
-// IMatroskaMuxer
+// IMatroskaMuxer
STDMETHODIMP CMatroskaMuxerFilter::CorrectTimeOffset(bool fNegative, bool fPositive)
{
- m_fNegative = fNegative;
- m_fPositive = fPositive;
- return S_OK;
+ m_fNegative = fNegative;
+ m_fPositive = fPositive;
+ return S_OK;
}
//
ULONGLONG GetStreamPosition(IStream* pStream)
{
- ULARGE_INTEGER pos = {0, 0};
- pStream->Seek(*(LARGE_INTEGER*)&pos, STREAM_SEEK_CUR, &pos);
- return pos.QuadPart;
+ ULARGE_INTEGER pos = {0, 0};
+ pStream->Seek(*(LARGE_INTEGER*)&pos, STREAM_SEEK_CUR, &pos);
+ return pos.QuadPart;
}
ULONGLONG SetStreamPosition(IStream* pStream, ULONGLONG seekpos)
{
- LARGE_INTEGER pos;
- pos.QuadPart = seekpos;
- ULARGE_INTEGER posnew;
- posnew.QuadPart = GetStreamPosition(pStream);
- pStream->Seek(pos, STREAM_SEEK_SET, &posnew);
- return posnew.QuadPart;
+ LARGE_INTEGER pos;
+ pos.QuadPart = seekpos;
+ ULARGE_INTEGER posnew;
+ posnew.QuadPart = GetStreamPosition(pStream);
+ pStream->Seek(pos, STREAM_SEEK_SET, &posnew);
+ return posnew.QuadPart;
}
DWORD CMatroskaMuxerFilter::ThreadProc()
{
- CComQIPtr<IStream> pStream;
-
- if(!m_pOutput || !(pStream = m_pOutput->GetConnected()))
- {
- while(1)
- {
- DWORD cmd = GetRequest();
- if(cmd == CMD_EXIT) CAMThread::m_hThread = NULL;
- Reply(S_OK);
- if(cmd == CMD_EXIT) return 0;
- }
- }
-
- REFERENCE_TIME rtDur = 0;
- GetDuration(&rtDur);
-
- SetStreamPosition(pStream, 0);
-
- ULARGE_INTEGER uli = {0};
- pStream->SetSize(uli);
-
- EBML hdr;
- hdr.DocType.Set("matroska");
- hdr.DocTypeVersion.Set(1);
- hdr.DocTypeReadVersion.Set(1);
- hdr.Write(pStream);
-
- Segment().Write(pStream);
- ULONGLONG segpos = GetStreamPosition(pStream);
-
- // TODO
- MatroskaWriter::QWORD voidlen = 100;
- if(rtDur > 0) voidlen += int(1.0 * rtDur / MAXCLUSTERTIME / 10000 + 0.5) * 20;
- else voidlen += int(1.0 * 1000 * 60 * 60 * 24 / MAXCLUSTERTIME + 0.5) * 20; // when no duration is known, allocate for 24 hours (~340k)
- ULONGLONG voidpos = GetStreamPosition(pStream);
- {
- Void v(voidlen);
- voidlen = v.Size();
- v.Write(pStream);
- }
-
- // Meta Seek
-
- Seek seek;
- CAutoPtr<SeekHead> sh;
-
- // Segment Info
-
- sh.Attach(DNew SeekHead());
- sh->ID.Set(0x1549A966);
- sh->Position.Set(GetStreamPosition(pStream) - segpos);
- seek.SeekHeads.AddTail(sh);
-
- ULONGLONG infopos = GetStreamPosition(pStream);
- Info info;
- info.MuxingApp.Set(L"DirectShow Matroska Muxer");
- info.TimeCodeScale.Set(1000000);
- info.Duration.Set((float)rtDur / 10000);
- struct tm _2001 = {0, 0, 0, 1, 0, 101, 0, 0, 1};
- info.DateUTC.Set((_time64(NULL) - _mktime64(&_2001)) * 1000000000);
- info.Write(pStream);
-
- // Tracks
-
- sh.Attach(DNew SeekHead());
- sh->ID.Set(0x1654AE6B);
- sh->Position.Set(GetStreamPosition(pStream) - segpos);
- seek.SeekHeads.AddTail(sh);
-
- UINT64 TrackNumber = 0;
- /*
- CNode<Track> Tracks;
- CAutoPtr<Track> pT(DNew Track());
- POSITION pos = m_pInputs.GetHeadPosition();
- for(int i = 1; pos; i++)
- {
- CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
- if(!pPin->IsConnected()) continue;
-
- CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
- *pTE = *pPin->GetTrackEntry();
- if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
- TrackNumber = pTE->TrackNumber;
- pT->TrackEntries.AddTail(pTE);
- }
- Tracks.AddTail(pT);
- Tracks.Write(pStream);
-
- if(TrackNumber == 0) TrackNumber = 1;
- */
- bool fTracksWritten = false;
-
- //
-
- Cluster c;
- c.TimeCode.Set(0);
-
- bool fFirstBlock = true;
- INT64 firstTimeCode = 0;
-
- CAtlList<CMatroskaMuxerInputPin*> pActivePins;
-
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
- if(pPin->IsConnected()) pActivePins.AddTail(pPin);
- }
-
- while(1)
- {
- DWORD cmd = GetRequest();
-
- switch(cmd)
- {
- default:
- case CMD_EXIT:
- CAMThread::m_hThread = NULL;
- Reply(S_OK);
- return 0;
-
- case CMD_RUN:
- Reply(S_OK);
-
- Cue cue;
- ULONGLONG lastcueclusterpos = -1;
- INT64 lastcuetimecode = -1;
- UINT64 nBlocksInCueTrack = 0;
-
- while(!CheckRequest(NULL))
- {
- if(m_State == State_Paused)
- {
- Sleep(10);
- continue;
- }
-
- int nPinsGotSomething = 0, nPinsNeeded = 0;
- CMatroskaMuxerInputPin* pPin = NULL;
- REFERENCE_TIME rtMin = _I64_MAX;
-
- pos = pActivePins.GetHeadPosition();
- while(pos)
- {
- CMatroskaMuxerInputPin* pTmp = pActivePins.GetNext(pos);
-
- CAutoLock cAutoLock(&pTmp->m_csQueue);
-
- if(pTmp->m_blocks.GetCount() == 0 && pTmp->m_fEndOfStreamReceived)
- {
- pActivePins.RemoveAt(pActivePins.Find(pTmp));
- continue;
- }
-
- if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle)
- nPinsNeeded++;
-
- if(pTmp->m_blocks.GetCount() > 0)
- {
- if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle)
- nPinsGotSomething++;
-
- if(pTmp->m_blocks.GetCount() > 0)
- {
- REFERENCE_TIME rt = pTmp->m_blocks.GetHead()->Block.TimeCode;
- if(rt < rtMin)
- {
- rtMin = rt;
- pPin = pTmp;
- }
- }
- }
- }
-
- if(pActivePins.GetCount() == 0)
- {
- break;
- }
-
- if(!pPin || nPinsNeeded > nPinsGotSomething || !pPin && nPinsGotSomething == 0)
- {
- Sleep(1);
- continue;
- }
-
- if(!fTracksWritten)
- {
- CNode<Track> Tracks;
- CAutoPtr<Track> pT(DNew Track());
- POSITION pos = pActivePins.GetHeadPosition();
- for(int i = 1; pos; i++)
- {
- CMatroskaMuxerInputPin* pPin = pActivePins.GetNext(pos);
-
- CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
- *pTE = *pPin->GetTrackEntry();
- if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
- TrackNumber = pTE->TrackNumber;
- pT->TrackEntries.AddTail(pTE);
- }
- Tracks.AddTail(pT);
- Tracks.Write(pStream);
-
- if(TrackNumber == 0) TrackNumber = 1;
-
- fTracksWritten = true;
- }
-
- ASSERT(pPin);
-
- CAutoPtr<BlockGroup> b;
-
- {
- CAutoLock cAutoLock(&pPin->m_csQueue);
- b = pPin->m_blocks.RemoveHead();
- }
-
- if(b)
- {
- if(fFirstBlock)
- {
- if(b->Block.TimeCode < 0 && m_fNegative || b->Block.TimeCode > 0 && m_fPositive)
- firstTimeCode = b->Block.TimeCode;
- fFirstBlock = false;
- }
-
- b->Block.TimeCode -= firstTimeCode;
- b->Block.TimeCodeStop -= firstTimeCode;
-
- /*
- TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n"),
- GetTrackNumber(pPin),
- (INT64)b->Block.TimeCode, (INT64)b->Block.TimeCodeStop, (UINT64)b->BlockDuration,
- (int)((b->Block.TimeCode)/MAXCLUSTERTIME), (int)(b->Block.TimeCode%MAXCLUSTERTIME),
- b->Block.BlockData.GetCount(), (int)b->ReferenceBlock);
- */
- if(b->Block.TimeCode < SHRT_MIN /*0*/)
- {
- ASSERT(0);
- continue;
- }
-
- while((INT64)(c.TimeCode + MAXCLUSTERTIME) < b->Block.TimeCode)
- {
- if(!c.BlockGroups.IsEmpty())
- {
- sh.Attach(DNew SeekHead());
- sh->ID.Set(c.GetID()/*0x1F43B675*/);
- sh->Position.Set(GetStreamPosition(pStream) - segpos);
- seek.SeekHeads.AddTail(sh);
-
- c.Write(pStream); // TODO: write blocks
- }
-
- c.TimeCode.Set(c.TimeCode + MAXCLUSTERTIME);
- c.BlockGroups.RemoveAll();
- nBlocksInCueTrack = 0;
- }
-
- if(b->Block.TrackNumber == TrackNumber)
- {
- nBlocksInCueTrack++;
- }
-
- if(b->ReferenceBlock == 0 && b->Block.TrackNumber == TrackNumber)
- {
- ULONGLONG clusterpos = GetStreamPosition(pStream) - segpos;
- if(lastcueclusterpos != clusterpos || lastcuetimecode + 1000 < b->Block.TimeCode)
- {
- CAutoPtr<CueTrackPosition> ctp(DNew CueTrackPosition());
- ctp->CueTrack.Set(b->Block.TrackNumber);
- ctp->CueClusterPosition.Set(clusterpos);
- if(c.BlockGroups.GetCount() > 0) ctp->CueBlockNumber.Set(nBlocksInCueTrack);
- CAutoPtr<CuePoint> cp(DNew CuePoint());
- cp->CueTime.Set(b->Block.TimeCode);
- cp->CueTrackPositions.AddTail(ctp);
- cue.CuePoints.AddTail(cp);
- lastcueclusterpos = clusterpos;
- lastcuetimecode = b->Block.TimeCode;
- }
- }
-
- info.Duration.Set(max(info.Duration, (float)b->Block.TimeCodeStop));
-
- m_rtCurrent = b->Block.TimeCode * 10000;
-
- b->Block.TimeCode -= c.TimeCode;
- c.BlockGroups.AddTail(b);
- }
- }
-
- if(!c.BlockGroups.IsEmpty())
- {
- sh.Attach(DNew SeekHead());
- sh->ID.Set(c.GetID()/*0x1F43B675*/);
- sh->Position.Set(GetStreamPosition(pStream) - segpos);
- seek.SeekHeads.AddTail(sh);
-
- c.Write(pStream);
- }
-
- ULONGLONG cuepos = 0;
- if(!cue.CuePoints.IsEmpty())
- {
- sh.Attach(DNew SeekHead());
- sh->ID.Set(cue.GetID()/*0x1C53BB6B*/);
- sh->Position.Set(GetStreamPosition(pStream) - segpos);
- seek.SeekHeads.AddTail(sh);
-
- cue.Write(pStream);
- }
-
- {
- Tags tags;
-
- sh.Attach(DNew SeekHead());
- sh->ID.Set(tags.GetID());
- sh->Position.Set(GetStreamPosition(pStream) - segpos);
- seek.SeekHeads.AddTail(sh);
-
- tags.Write(pStream);
- }
-
- SetStreamPosition(pStream, voidpos);
- int len = (int)(voidlen - seek.Size());
- ASSERT(len >= 0 && len != 1);
- seek.Write(pStream);
-
- if(len == 0)
- {
- // nothing to do
- }
- else if(len >= 2)
- {
- for(int i = 0; i < 8; i++)
- {
- if(len >= (1 << i * 7) - 2 && len <= (1 << (i + 1) * 7) - 2)
- {
- Void(len - 2 - i).Write(pStream);
- break;
- }
- }
- }
-
- if(abs(m_rtCurrent - (REFERENCE_TIME)info.Duration * 10000) > 10000000i64)
- {
- info.Duration.Set(m_rtCurrent / 10000 + 1);
- }
-
- SetStreamPosition(pStream, infopos);
- info.Write(pStream);
-
- // TODO: write some tags
-
- m_pOutput->DeliverEndOfStream();
-
- break;
- }
- }
-
- ASSERT(0); // we should only exit via CMD_EXIT
-
- CAMThread::m_hThread = NULL;
- return 0;
+ CComQIPtr<IStream> pStream;
+
+ if(!m_pOutput || !(pStream = m_pOutput->GetConnected()))
+ {
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+ if(cmd == CMD_EXIT) CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ if(cmd == CMD_EXIT) return 0;
+ }
+ }
+
+ REFERENCE_TIME rtDur = 0;
+ GetDuration(&rtDur);
+
+ SetStreamPosition(pStream, 0);
+
+ ULARGE_INTEGER uli = {0};
+ pStream->SetSize(uli);
+
+ EBML hdr;
+ hdr.DocType.Set("matroska");
+ hdr.DocTypeVersion.Set(1);
+ hdr.DocTypeReadVersion.Set(1);
+ hdr.Write(pStream);
+
+ Segment().Write(pStream);
+ ULONGLONG segpos = GetStreamPosition(pStream);
+
+ // TODO
+ MatroskaWriter::QWORD voidlen = 100;
+ if(rtDur > 0) voidlen += int(1.0 * rtDur / MAXCLUSTERTIME / 10000 + 0.5) * 20;
+ else voidlen += int(1.0 * 1000*60*60*24 / MAXCLUSTERTIME + 0.5) * 20; // when no duration is known, allocate for 24 hours (~340k)
+ ULONGLONG voidpos = GetStreamPosition(pStream);
+ {
+ Void v(voidlen);
+ voidlen = v.Size();
+ v.Write(pStream);
+ }
+
+ // Meta Seek
+
+ Seek seek;
+ CAutoPtr<SeekHead> sh;
+
+ // Segment Info
+
+ sh.Attach(DNew SeekHead());
+ sh->ID.Set(0x1549A966);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ ULONGLONG infopos = GetStreamPosition(pStream);
+ Info info;
+ info.MuxingApp.Set(L"DirectShow Matroska Muxer");
+ info.TimeCodeScale.Set(1000000);
+ info.Duration.Set((float)rtDur / 10000);
+ struct tm _2001 = {0, 0, 0, 1, 0, 101, 0, 0, 1};
+ info.DateUTC.Set((_time64(NULL) - _mktime64(&_2001)) * 1000000000);
+ info.Write(pStream);
+
+ // Tracks
+
+ sh.Attach(DNew SeekHead());
+ sh->ID.Set(0x1654AE6B);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ UINT64 TrackNumber = 0;
+/*
+ CNode<Track> Tracks;
+ CAutoPtr<Track> pT(DNew Track());
+ POSITION pos = m_pInputs.GetHeadPosition();
+ for(int i = 1; pos; i++)
+ {
+ CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) continue;
+
+ CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
+ *pTE = *pPin->GetTrackEntry();
+ if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
+ TrackNumber = pTE->TrackNumber;
+ pT->TrackEntries.AddTail(pTE);
+ }
+ Tracks.AddTail(pT);
+ Tracks.Write(pStream);
+
+ if(TrackNumber == 0) TrackNumber = 1;
+*/
+ bool fTracksWritten = false;
+
+ //
+
+ Cluster c;
+ c.TimeCode.Set(0);
+
+ bool fFirstBlock = true;
+ INT64 firstTimeCode = 0;
+
+ CAtlList<CMatroskaMuxerInputPin*> pActivePins;
+
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(pPin->IsConnected()) pActivePins.AddTail(pPin);
+ }
+
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ return 0;
+
+ case CMD_RUN:
+ Reply(S_OK);
+
+ Cue cue;
+ ULONGLONG lastcueclusterpos = -1;
+ INT64 lastcuetimecode = -1;
+ UINT64 nBlocksInCueTrack = 0;
+
+ while(!CheckRequest(NULL))
+ {
+ if(m_State == State_Paused)
+ {
+ Sleep(10);
+ continue;
+ }
+
+ int nPinsGotSomething = 0, nPinsNeeded = 0;
+ CMatroskaMuxerInputPin* pPin = NULL;
+ REFERENCE_TIME rtMin = _I64_MAX;
+
+ pos = pActivePins.GetHeadPosition();
+ while(pos)
+ {
+ CMatroskaMuxerInputPin* pTmp = pActivePins.GetNext(pos);
+
+ CAutoLock cAutoLock(&pTmp->m_csQueue);
+
+ if(pTmp->m_blocks.GetCount() == 0 && pTmp->m_fEndOfStreamReceived)
+ {
+ pActivePins.RemoveAt(pActivePins.Find(pTmp));
+ continue;
+ }
+
+ if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle)
+ nPinsNeeded++;
+
+ if(pTmp->m_blocks.GetCount() > 0)
+ {
+ if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle)
+ nPinsGotSomething++;
+
+ if(pTmp->m_blocks.GetCount() > 0)
+ {
+ REFERENCE_TIME rt = pTmp->m_blocks.GetHead()->Block.TimeCode;
+ if(rt < rtMin) {rtMin = rt; pPin = pTmp;}
+ }
+ }
+ }
+
+ if(pActivePins.GetCount() == 0)
+ {
+ break;
+ }
+
+ if(!pPin || nPinsNeeded > nPinsGotSomething || !pPin && nPinsGotSomething == 0)
+ {
+ Sleep(1);
+ continue;
+ }
+
+ if(!fTracksWritten)
+ {
+ CNode<Track> Tracks;
+ CAutoPtr<Track> pT(DNew Track());
+ POSITION pos = pActivePins.GetHeadPosition();
+ for(int i = 1; pos; i++)
+ {
+ CMatroskaMuxerInputPin* pPin = pActivePins.GetNext(pos);
+
+ CAutoPtr<TrackEntry> pTE(DNew TrackEntry());
+ *pTE = *pPin->GetTrackEntry();
+ if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
+ TrackNumber = pTE->TrackNumber;
+ pT->TrackEntries.AddTail(pTE);
+ }
+ Tracks.AddTail(pT);
+ Tracks.Write(pStream);
+
+ if(TrackNumber == 0) TrackNumber = 1;
+
+ fTracksWritten = true;
+ }
+
+ ASSERT(pPin);
+
+ CAutoPtr<BlockGroup> b;
+
+ {
+ CAutoLock cAutoLock(&pPin->m_csQueue);
+ b = pPin->m_blocks.RemoveHead();
+ }
+
+ if(b)
+ {
+ if(fFirstBlock)
+ {
+ if(b->Block.TimeCode < 0 && m_fNegative || b->Block.TimeCode > 0 && m_fPositive)
+ firstTimeCode = b->Block.TimeCode;
+ fFirstBlock = false;
+ }
+
+ b->Block.TimeCode -= firstTimeCode;
+ b->Block.TimeCodeStop -= firstTimeCode;
+
+/*
+TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n"),
+ GetTrackNumber(pPin),
+ (INT64)b->Block.TimeCode, (INT64)b->Block.TimeCodeStop, (UINT64)b->BlockDuration,
+ (int)((b->Block.TimeCode)/MAXCLUSTERTIME), (int)(b->Block.TimeCode%MAXCLUSTERTIME),
+ b->Block.BlockData.GetCount(), (int)b->ReferenceBlock);
+*/
+ if(b->Block.TimeCode < SHRT_MIN /*0*/) {ASSERT(0); continue;}
+
+ while((INT64)(c.TimeCode + MAXCLUSTERTIME) < b->Block.TimeCode)
+ {
+ if(!c.BlockGroups.IsEmpty())
+ {
+ sh.Attach(DNew SeekHead());
+ sh->ID.Set(c.GetID()/*0x1F43B675*/);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ c.Write(pStream); // TODO: write blocks
+ }
+
+ c.TimeCode.Set(c.TimeCode + MAXCLUSTERTIME);
+ c.BlockGroups.RemoveAll();
+ nBlocksInCueTrack = 0;
+ }
+
+ if(b->Block.TrackNumber == TrackNumber)
+ {
+ nBlocksInCueTrack++;
+ }
+
+ if(b->ReferenceBlock == 0 && b->Block.TrackNumber == TrackNumber)
+ {
+ ULONGLONG clusterpos = GetStreamPosition(pStream) - segpos;
+ if(lastcueclusterpos != clusterpos || lastcuetimecode + 1000 < b->Block.TimeCode)
+ {
+ CAutoPtr<CueTrackPosition> ctp(DNew CueTrackPosition());
+ ctp->CueTrack.Set(b->Block.TrackNumber);
+ ctp->CueClusterPosition.Set(clusterpos);
+ if(c.BlockGroups.GetCount() > 0) ctp->CueBlockNumber.Set(nBlocksInCueTrack);
+ CAutoPtr<CuePoint> cp(DNew CuePoint());
+ cp->CueTime.Set(b->Block.TimeCode);
+ cp->CueTrackPositions.AddTail(ctp);
+ cue.CuePoints.AddTail(cp);
+ lastcueclusterpos = clusterpos;
+ lastcuetimecode = b->Block.TimeCode;
+ }
+ }
+
+ info.Duration.Set(max(info.Duration, (float)b->Block.TimeCodeStop));
+
+ m_rtCurrent = b->Block.TimeCode*10000;
+
+ b->Block.TimeCode -= c.TimeCode;
+ c.BlockGroups.AddTail(b);
+ }
+ }
+
+ if(!c.BlockGroups.IsEmpty())
+ {
+ sh.Attach(DNew SeekHead());
+ sh->ID.Set(c.GetID()/*0x1F43B675*/);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ c.Write(pStream);
+ }
+
+ ULONGLONG cuepos = 0;
+ if(!cue.CuePoints.IsEmpty())
+ {
+ sh.Attach(DNew SeekHead());
+ sh->ID.Set(cue.GetID()/*0x1C53BB6B*/);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ cue.Write(pStream);
+ }
+
+ {
+ Tags tags;
+
+ sh.Attach(DNew SeekHead());
+ sh->ID.Set(tags.GetID());
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ tags.Write(pStream);
+ }
+
+ SetStreamPosition(pStream, voidpos);
+ int len = (int)(voidlen - seek.Size());
+ ASSERT(len >= 0 && len != 1);
+ seek.Write(pStream);
+
+ if(len == 0)
+ {
+ // nothing to do
+ }
+ else if(len >= 2)
+ {
+ for(int i = 0; i < 8; i++)
+ {
+ if(len >= (1<<i*7)-2 && len <= (1<<(i+1)*7)-2)
+ {
+ Void(len-2-i).Write(pStream);
+ break;
+ }
+ }
+ }
+
+ if(abs(m_rtCurrent - (REFERENCE_TIME)info.Duration*10000) > 10000000i64)
+ {
+ info.Duration.Set(m_rtCurrent / 10000 + 1);
+ }
+
+ SetStreamPosition(pStream, infopos);
+ info.Write(pStream);
+
+ // TODO: write some tags
+
+ m_pOutput->DeliverEndOfStream();
+
+ break;
+ }
+ }
+
+ ASSERT(0); // we should only exit via CMD_EXIT
+
+ CAMThread::m_hThread = NULL;
+ return 0;
}
//
@@ -703,10 +652,10 @@ DWORD CMatroskaMuxerFilter::ThreadProc()
//
CMatroskaMuxerInputPin::CMatroskaMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseInputPin(NAME("CMatroskaMuxerInputPin"), pFilter, pLock, phr, pName)
- , m_fActive(false)
- , m_fEndOfStreamReceived(false)
- , m_rtDur(0)
+ : CBaseInputPin(NAME("CMatroskaMuxerInputPin"), pFilter, pLock, phr, pName)
+ , m_fActive(false)
+ , m_fEndOfStreamReceived(false)
+ , m_rtDur(0)
{
}
@@ -716,644 +665,631 @@ CMatroskaMuxerInputPin::~CMatroskaMuxerInputPin()
STDMETHODIMP CMatroskaMuxerInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMatroskaMuxerInputPin::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Video && (pmt->formattype == FORMAT_VideoInfo
- || pmt->formattype == FORMAT_VideoInfo2)
+ return pmt->majortype == MEDIATYPE_Video && (pmt->formattype == FORMAT_VideoInfo
+ || pmt->formattype == FORMAT_VideoInfo2)
// || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_MPEG1Payload && pmt->formattype == FORMAT_MPEGVideo
// || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_MPEG2_VIDEO && pmt->formattype == FORMAT_MPEG2_VIDEO
- || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_DiracVideo && pmt->formattype == FORMAT_DiracVideoInfo
- || pmt->majortype == MEDIATYPE_Audio && pmt->formattype == FORMAT_WaveFormatEx && pmt->subtype == FOURCCMap(((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag)
- || pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_Vorbis && pmt->formattype == FORMAT_VorbisFormat
- || pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_Vorbis2 && pmt->formattype == FORMAT_VorbisFormat2
- || pmt->majortype == MEDIATYPE_Audio && (pmt->subtype == MEDIASUBTYPE_14_4
- || pmt->subtype == MEDIASUBTYPE_28_8
- || pmt->subtype == MEDIASUBTYPE_ATRC
- || pmt->subtype == MEDIASUBTYPE_COOK
- || pmt->subtype == MEDIASUBTYPE_DNET
- || pmt->subtype == MEDIASUBTYPE_SIPR) && pmt->formattype == FORMAT_WaveFormatEx
- || pmt->majortype == MEDIATYPE_Text && pmt->subtype == MEDIASUBTYPE_NULL && pmt->formattype == FORMAT_None
- || pmt->majortype == MEDIATYPE_Subtitle && pmt->formattype == FORMAT_SubtitleInfo
- ? S_OK
- : E_INVALIDARG;
+ || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_DiracVideo && pmt->formattype == FORMAT_DiracVideoInfo
+ || pmt->majortype == MEDIATYPE_Audio && pmt->formattype == FORMAT_WaveFormatEx && pmt->subtype == FOURCCMap(((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag)
+ || pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_Vorbis && pmt->formattype == FORMAT_VorbisFormat
+ || pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_Vorbis2 && pmt->formattype == FORMAT_VorbisFormat2
+ || pmt->majortype == MEDIATYPE_Audio && (pmt->subtype == MEDIASUBTYPE_14_4
+ || pmt->subtype == MEDIASUBTYPE_28_8
+ || pmt->subtype == MEDIASUBTYPE_ATRC
+ || pmt->subtype == MEDIASUBTYPE_COOK
+ || pmt->subtype == MEDIASUBTYPE_DNET
+ || pmt->subtype == MEDIASUBTYPE_SIPR) && pmt->formattype == FORMAT_WaveFormatEx
+ || pmt->majortype == MEDIATYPE_Text && pmt->subtype == MEDIASUBTYPE_NULL && pmt->formattype == FORMAT_None
+ || pmt->majortype == MEDIATYPE_Subtitle && pmt->formattype == FORMAT_SubtitleInfo
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CMatroskaMuxerInputPin::BreakConnect()
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::BreakConnect()))
- return hr;
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
- m_pTE.Free();
+ m_pTE.Free();
- return hr;
+ return hr;
}
HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
{
- HRESULT hr;
-
- if(FAILED(hr = __super::CompleteConnect(pPin)))
- return hr;
-
- m_rtDur = 0;
- CComQIPtr<IMediaSeeking> pMS;
- if((pMS = GetFilterFromPin(pPin)) || (pMS = pPin))
- pMS->GetDuration(&m_rtDur);
-
- m_pTE.Free();
- m_pTE.Attach(DNew TrackEntry());
-
- m_pTE->TrackUID.Set(rand());
- m_pTE->MinCache.Set(1);
- m_pTE->MaxCache.Set(1);
- m_pTE->TrackNumber.Set((static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this));
-
- hr = E_FAIL;
-
- if(m_mt.majortype == MEDIATYPE_Video)
- {
- m_pTE->TrackType.Set(TrackEntry::TypeVideo);
-
- if(m_mt.formattype == FORMAT_VideoInfo
- && m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
- || m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40)
- {
- m_pTE->CodecID.Set("V_REAL/RV00");
- m_pTE->CodecID.SetAt(9, (BYTE)(m_mt.subtype.Data1 >> 16));
-
- if(m_mt.formattype == FORMAT_VideoInfo)
- {
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
- if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER))
- {
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER));
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER), m_pTE->CodecPrivate.GetCount());
- }
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame * 100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
- VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
- if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER2))
- {
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER2));
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER2), m_pTE->CodecPrivate.GetCount());
- }
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame * 100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
- m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
- m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
- }
- else
- {
- ASSERT(0);
- return hr;
- }
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo)
- {
- m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
-
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader));
- memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame * 100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
- m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
-
- VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader));
- memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame * 100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
- m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
- m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
- if(vih->AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_DiracVideoInfo)
- {
- m_pTE->CodecID.Set("V_DIRAC");
-
- DIRACINFOHEADER* vih = (DIRACINFOHEADER*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(vih->cbSequenceHeader);
- memcpy(m_pTE->CodecPrivate, (BYTE*)&vih->dwSequenceHeader[0], m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(vih->hdr.AvgTimePerFrame * 100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(vih->hdr.bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(vih->hdr.bmiHeader.biHeight));
- // m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
- // m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
- if(vih->hdr.AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->hdr.AvgTimePerFrame));
-
- hr = S_OK;
- }
- /*
- else if(m_mt.formattype == FORMAT_MPEGVideo)
- {
- m_pTE->CodecID.Set("V_DSHOW/MPEG1VIDEO"); // V_MPEG1
-
- MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(pm1vi->hdr.AvgTimePerFrame*100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(pm1vi->hdr.bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(pm1vi->hdr.bmiHeader.biHeight));
- if(pm1vi->hdr.AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm1vi->hdr.AvgTimePerFrame));
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_MPEG2_VIDEO)
- {
- m_pTE->CodecID.Set("V_DSHOW/MPEG2VIDEO"); // V_MPEG2
-
- MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
- m_pTE->DefaultDuration.Set(pm2vi->hdr.AvgTimePerFrame*100);
- m_pTE->DescType = TrackEntry::DescVideo;
- m_pTE->v.PixelWidth.Set(pm2vi->hdr.bmiHeader.biWidth);
- m_pTE->v.PixelHeight.Set(abs(pm2vi->hdr.bmiHeader.biHeight));
- if(pm2vi->hdr.AvgTimePerFrame > 0)
- m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm2vi->hdr.AvgTimePerFrame));
-
- hr = S_OK;
- }
- */
- }
- else if(m_mt.majortype == MEDIATYPE_Audio)
- {
- m_pTE->TrackType.Set(TrackEntry::TypeAudio);
-
- if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_AAC
- && m_mt.cbFormat >= sizeof(WAVEFORMATEX) + 2)
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- BYTE* p = (BYTE*)(wfe + 1);
-
- DWORD nSamplesPerSec = wfe->nSamplesPerSec;
-
- int profile = (p[0] >> 3) - 1;
- int rate1 = ((p[0] & 7) << 1) | (p[1] >> 7);
- int channels = ((p[1] >> 3) & 15);
- int exttype = 0;
- int rate2 = rate1;
-
- if(wfe->cbSize >= 5)
- {
- profile = 4;
-
- exttype = (p[2] << 3) | (p[3] >> 5);
- ASSERT(exttype == 0x2B7);
- ASSERT((p[3] & 31) == 5);
- ASSERT((p[4] >> 7) == 1);
- rate2 = ((p[4] >> 3) & 15);
-
- if(rate2 < rate1)
- {
- m_pTE->a.OutputSamplingFrequency.Set((float)nSamplesPerSec);
- nSamplesPerSec /= 2;
- }
- }
-
- switch(profile)
- {
- default:
- case 0:
- m_pTE->CodecID.Set("A_AAC/MPEG2/MAIN");
- break;
- case 1:
- m_pTE->CodecID.Set("A_AAC/MPEG2/LC");
- break;
- case 2:
- m_pTE->CodecID.Set("A_AAC/MPEG2/SSR");
- break;
- case 3:
- m_pTE->CodecID.Set("A_AAC/MPEG4/LTP");
- break;
- case 4:
- m_pTE->CodecID.Set("A_AAC/MPEG4/LC/SBR");
- break;
- }
-
- ASSERT(channels == wfe->nChannels);
-
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)nSamplesPerSec);
- m_pTE->a.Channels.Set(channels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3)
- {
- m_pTE->CodecID.Set("A_AC3");
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
- m_pTE->a.Channels.Set(wfe->nChannels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS)
- {
- m_pTE->CodecID.Set("A_DTS");
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
- m_pTE->a.Channels.Set(wfe->nChannels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_FLAC)
- {
- m_pTE->CodecID.Set("A_FLAC");
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
- m_pTE->a.Channels.Set(wfe->nChannels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- if(wfe->cbSize)
- {
- m_pTE->CodecPrivate.SetCount(wfe->cbSize);
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(WAVEFORMATEX), wfe->cbSize);
- }
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
- && (m_mt.subtype == MEDIASUBTYPE_14_4
- || m_mt.subtype == MEDIASUBTYPE_28_8
- || m_mt.subtype == MEDIASUBTYPE_ATRC
- || m_mt.subtype == MEDIASUBTYPE_COOK
- || m_mt.subtype == MEDIASUBTYPE_DNET
- || m_mt.subtype == MEDIASUBTYPE_SIPR))
- {
- CStringA id;
- id.Format("A_REAL/%c%c%c%c",
- (char)((m_mt.subtype.Data1 >> 0) & 0xff),
- (char)((m_mt.subtype.Data1 >> 8) & 0xff),
- (char)((m_mt.subtype.Data1 >> 16) & 0xff),
- (char)((m_mt.subtype.Data1 >> 24) & 0xff));
-
- m_pTE->CodecID.Set(id);
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- DWORD cbSize = sizeof(WAVEFORMATEX) + wfe->cbSize;
- if(m_mt.cbFormat > cbSize)
- {
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - cbSize);
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + cbSize, m_pTE->CodecPrivate.GetCount());
- }
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
- m_pTE->a.Channels.Set(wfe->nChannels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM)
- {
- m_pTE->CodecID.Set("A_PCM/INT/LIT");
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
- m_pTE->a.Channels.Set(wfe->nChannels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_WaveFormatEx)
- {
- m_pTE->CodecID.Set("A_MS/ACM");
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat);
- memcpy(m_pTE->CodecPrivate, wfe, m_pTE->CodecPrivate.GetCount());
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
- m_pTE->a.Channels.Set(wfe->nChannels);
- m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_VorbisFormat)
- {
- m_pTE->CodecID.Set("A_VORBIS");
-
- VORBISFORMAT* pvf = (VORBISFORMAT*)m_mt.pbFormat;
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)pvf->nSamplesPerSec);
- m_pTE->a.Channels.Set(pvf->nChannels);
-
- // m_pTE->CodecPrivate will be filled later
-
- hr = S_OK;
- }
- else if(m_mt.formattype == FORMAT_VorbisFormat2)
- {
- m_pTE->CodecID.Set("A_VORBIS");
-
- VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)m_mt.pbFormat;
- m_pTE->DescType = TrackEntry::DescAudio;
- m_pTE->a.SamplingFrequency.Set((float)pvf2->SamplesPerSec);
- m_pTE->a.Channels.Set(pvf2->Channels);
- m_pTE->a.BitDepth.Set(pvf2->BitsPerSample);
-
- int len = 1;
- for(int i = 0; i < 2; i++) len += pvf2->HeaderSize[i] / 255 + 1;
- for(int i = 0; i < 3; i++) len += pvf2->HeaderSize[i];
- m_pTE->CodecPrivate.SetCount(len);
-
- BYTE* src = (BYTE*)m_mt.pbFormat + sizeof(VORBISFORMAT2);
- BYTE* dst = m_pTE->CodecPrivate.GetData();
-
- *dst++ = 2;
- for(int i = 0; i < 2; i++)
- for(int len = pvf2->HeaderSize[i]; len >= 0; len -= 255)
- * dst++ = min(len, 255);
-
- memcpy(dst, src, pvf2->HeaderSize[0]);
- dst += pvf2->HeaderSize[0];
- src += pvf2->HeaderSize[0];
- memcpy(dst, src, pvf2->HeaderSize[1]);
- dst += pvf2->HeaderSize[1];
- src += pvf2->HeaderSize[1];
- memcpy(dst, src, pvf2->HeaderSize[2]);
- dst += pvf2->HeaderSize[2];
- src += pvf2->HeaderSize[2];
-
- ASSERT(src <= m_mt.pbFormat + m_mt.cbFormat);
- ASSERT(dst <= m_pTE->CodecPrivate.GetData() + m_pTE->CodecPrivate.GetCount());
-
- hr = S_OK;
- }
- }
- else if(m_mt.majortype == MEDIATYPE_Text)
- {
- m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
-
- if(m_mt.formattype == FORMAT_None)
- {
- m_pTE->CodecID.Set("S_TEXT/ASCII");
- hr = S_OK;
- }
- }
- else if(m_mt.majortype == MEDIATYPE_Subtitle)
- {
- m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
-
- m_pTE->CodecID.Set(
- m_mt.subtype == MEDIASUBTYPE_UTF8 ? "S_TEXT/UTF8" :
- m_mt.subtype == MEDIASUBTYPE_SSA ? "S_TEXT/SSA" :
- m_mt.subtype == MEDIASUBTYPE_ASS ? "S_TEXT/ASS" :
- m_mt.subtype == MEDIASUBTYPE_USF ? "S_TEXT/USF" :
- m_mt.subtype == MEDIASUBTYPE_VOBSUB ? "S_VOBSUB" :
- "");
-
- if(!m_pTE->CodecID.IsEmpty())
- {
- hr = S_OK;
-
- SUBTITLEINFO* psi = (SUBTITLEINFO*)m_mt.pbFormat;
- if(psi->dwOffset)
- {
- m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - psi->dwOffset);
- memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + psi->dwOffset, m_pTE->CodecPrivate.GetCount());
- }
- }
- }
-
- if(S_OK == hr)
- {
- (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->AddInput();
- }
-
- return hr;
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
+
+ m_rtDur = 0;
+ CComQIPtr<IMediaSeeking> pMS;
+ if((pMS = GetFilterFromPin(pPin)) || (pMS = pPin))
+ pMS->GetDuration(&m_rtDur);
+
+ m_pTE.Free();
+ m_pTE.Attach(DNew TrackEntry());
+
+ m_pTE->TrackUID.Set(rand());
+ m_pTE->MinCache.Set(1);
+ m_pTE->MaxCache.Set(1);
+ m_pTE->TrackNumber.Set((static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this));
+
+ hr = E_FAIL;
+
+ if(m_mt.majortype == MEDIATYPE_Video)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeVideo);
+
+ if(m_mt.formattype == FORMAT_VideoInfo
+ && m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
+ || m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40)
+ {
+ m_pTE->CodecID.Set("V_REAL/RV00");
+ m_pTE->CodecID.SetAt(9, (BYTE)(m_mt.subtype.Data1>>16));
+
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
+ if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER))
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER));
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER), m_pTE->CodecPrivate.GetCount());
+ }
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
+ if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER2))
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER2));
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER2), m_pTE->CodecPrivate.GetCount());
+ }
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
+ m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
+ }
+ else
+ {
+ ASSERT(0);
+ return hr;
+ }
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader));
+ memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
+
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader));
+ memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
+ m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_DiracVideoInfo)
+ {
+ m_pTE->CodecID.Set("V_DIRAC");
+
+ DIRACINFOHEADER* vih = (DIRACINFOHEADER*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(vih->cbSequenceHeader);
+ memcpy(m_pTE->CodecPrivate, (BYTE*)&vih->dwSequenceHeader[0], m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(vih->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->hdr.bmiHeader.biHeight));
+ // m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
+ // m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
+ if(vih->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+/*
+ else if(m_mt.formattype == FORMAT_MPEGVideo)
+ {
+ m_pTE->CodecID.Set("V_DSHOW/MPEG1VIDEO"); // V_MPEG1
+
+ MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(pm1vi->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(pm1vi->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(pm1vi->hdr.bmiHeader.biHeight));
+ if(pm1vi->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm1vi->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ m_pTE->CodecID.Set("V_DSHOW/MPEG2VIDEO"); // V_MPEG2
+
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(pm2vi->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(pm2vi->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(pm2vi->hdr.bmiHeader.biHeight));
+ if(pm2vi->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm2vi->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+*/
+ }
+ else if(m_mt.majortype == MEDIATYPE_Audio)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeAudio);
+
+ if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_AAC
+ && m_mt.cbFormat >= sizeof(WAVEFORMATEX)+2)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ BYTE* p = (BYTE*)(wfe+1);
+
+ DWORD nSamplesPerSec = wfe->nSamplesPerSec;
+
+ int profile = (p[0]>>3)-1;
+ int rate1 = ((p[0]&7)<<1)|(p[1]>>7);
+ int channels = ((p[1]>>3)&15);
+ int exttype = 0;
+ int rate2 = rate1;
+
+ if(wfe->cbSize >= 5)
+ {
+ profile = 4;
+
+ exttype = (p[2]<<3)|(p[3]>>5);
+ ASSERT(exttype == 0x2B7);
+ ASSERT((p[3]&31) == 5);
+ ASSERT((p[4]>>7) == 1);
+ rate2 = ((p[4]>>3)&15);
+
+ if(rate2 < rate1)
+ {
+ m_pTE->a.OutputSamplingFrequency.Set((float)nSamplesPerSec);
+ nSamplesPerSec /= 2;
+ }
+ }
+
+ switch(profile)
+ {
+ default:
+ case 0: m_pTE->CodecID.Set("A_AAC/MPEG2/MAIN"); break;
+ case 1: m_pTE->CodecID.Set("A_AAC/MPEG2/LC"); break;
+ case 2: m_pTE->CodecID.Set("A_AAC/MPEG2/SSR"); break;
+ case 3: m_pTE->CodecID.Set("A_AAC/MPEG4/LTP"); break;
+ case 4: m_pTE->CodecID.Set("A_AAC/MPEG4/LC/SBR"); break;
+ }
+
+ ASSERT(channels == wfe->nChannels);
+
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)nSamplesPerSec);
+ m_pTE->a.Channels.Set(channels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3)
+ {
+ m_pTE->CodecID.Set("A_AC3");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS)
+ {
+ m_pTE->CodecID.Set("A_DTS");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_FLAC)
+ {
+ m_pTE->CodecID.Set("A_FLAC");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ if(wfe->cbSize)
+ {
+ m_pTE->CodecPrivate.SetCount(wfe->cbSize);
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(WAVEFORMATEX), wfe->cbSize);
+ }
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && (m_mt.subtype == MEDIASUBTYPE_14_4
+ || m_mt.subtype == MEDIASUBTYPE_28_8
+ || m_mt.subtype == MEDIASUBTYPE_ATRC
+ || m_mt.subtype == MEDIASUBTYPE_COOK
+ || m_mt.subtype == MEDIASUBTYPE_DNET
+ || m_mt.subtype == MEDIASUBTYPE_SIPR))
+ {
+ CStringA id;
+ id.Format("A_REAL/%c%c%c%c",
+ (char)((m_mt.subtype.Data1>>0)&0xff),
+ (char)((m_mt.subtype.Data1>>8)&0xff),
+ (char)((m_mt.subtype.Data1>>16)&0xff),
+ (char)((m_mt.subtype.Data1>>24)&0xff));
+
+ m_pTE->CodecID.Set(id);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ DWORD cbSize = sizeof(WAVEFORMATEX) + wfe->cbSize;
+ if(m_mt.cbFormat > cbSize)
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - cbSize);
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + cbSize, m_pTE->CodecPrivate.GetCount());
+ }
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM)
+ {
+ m_pTE->CodecID.Set("A_PCM/INT/LIT");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx)
+ {
+ m_pTE->CodecID.Set("A_MS/ACM");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat);
+ memcpy(m_pTE->CodecPrivate, wfe, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VorbisFormat)
+ {
+ m_pTE->CodecID.Set("A_VORBIS");
+
+ VORBISFORMAT* pvf = (VORBISFORMAT*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)pvf->nSamplesPerSec);
+ m_pTE->a.Channels.Set(pvf->nChannels);
+
+ // m_pTE->CodecPrivate will be filled later
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VorbisFormat2)
+ {
+ m_pTE->CodecID.Set("A_VORBIS");
+
+ VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)pvf2->SamplesPerSec);
+ m_pTE->a.Channels.Set(pvf2->Channels);
+ m_pTE->a.BitDepth.Set(pvf2->BitsPerSample);
+
+ int len = 1;
+ for(int i = 0; i < 2; i++) len += pvf2->HeaderSize[i]/255 + 1;
+ for(int i = 0; i < 3; i++) len += pvf2->HeaderSize[i];
+ m_pTE->CodecPrivate.SetCount(len);
+
+ BYTE* src = (BYTE*)m_mt.pbFormat + sizeof(VORBISFORMAT2);
+ BYTE* dst = m_pTE->CodecPrivate.GetData();
+
+ *dst++ = 2;
+ for(int i = 0; i < 2; i++)
+ for(int len = pvf2->HeaderSize[i]; len >= 0; len -= 255)
+ *dst++ = min(len, 255);
+
+ memcpy(dst, src, pvf2->HeaderSize[0]);
+ dst += pvf2->HeaderSize[0];
+ src += pvf2->HeaderSize[0];
+ memcpy(dst, src, pvf2->HeaderSize[1]);
+ dst += pvf2->HeaderSize[1];
+ src += pvf2->HeaderSize[1];
+ memcpy(dst, src, pvf2->HeaderSize[2]);
+ dst += pvf2->HeaderSize[2];
+ src += pvf2->HeaderSize[2];
+
+ ASSERT(src <= m_mt.pbFormat + m_mt.cbFormat);
+ ASSERT(dst <= m_pTE->CodecPrivate.GetData() + m_pTE->CodecPrivate.GetCount());
+
+ hr = S_OK;
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Text)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
+
+ if(m_mt.formattype == FORMAT_None)
+ {
+ m_pTE->CodecID.Set("S_TEXT/ASCII");
+ hr = S_OK;
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
+
+ m_pTE->CodecID.Set(
+ m_mt.subtype == MEDIASUBTYPE_UTF8 ? "S_TEXT/UTF8" :
+ m_mt.subtype == MEDIASUBTYPE_SSA ? "S_TEXT/SSA" :
+ m_mt.subtype == MEDIASUBTYPE_ASS ? "S_TEXT/ASS" :
+ m_mt.subtype == MEDIASUBTYPE_USF ? "S_TEXT/USF" :
+ m_mt.subtype == MEDIASUBTYPE_VOBSUB ? "S_VOBSUB" :
+ "");
+
+ if(!m_pTE->CodecID.IsEmpty())
+ {
+ hr = S_OK;
+
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)m_mt.pbFormat;
+ if(psi->dwOffset)
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - psi->dwOffset);
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + psi->dwOffset, m_pTE->CodecPrivate.GetCount());
+ }
+ }
+ }
+
+ if(S_OK == hr)
+ {
+ (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->AddInput();
+ }
+
+ return hr;
}
HRESULT CMatroskaMuxerInputPin::Active()
{
- m_fActive = true;
- m_rtLastStart = m_rtLastStop = -1;
- m_fEndOfStreamReceived = false;
- return __super::Active();
+ m_fActive = true;
+ m_rtLastStart = m_rtLastStop = -1;
+ m_fEndOfStreamReceived = false;
+ return __super::Active();
}
HRESULT CMatroskaMuxerInputPin::Inactive()
{
- m_fActive = false;
- CAutoLock cAutoLock(&m_csQueue);
- m_blocks.RemoveAll();
- m_pVorbisHdrs.RemoveAll();
- return __super::Inactive();
+ m_fActive = false;
+ CAutoLock cAutoLock(&m_csQueue);
+ m_blocks.RemoveAll();
+ m_pVorbisHdrs.RemoveAll();
+ return __super::Inactive();
}
STDMETHODIMP CMatroskaMuxerInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
- return __super::NewSegment(tStart, tStop, dRate);
+ CAutoLock cAutoLock(&m_csReceive);
+ return __super::NewSegment(tStart, tStop, dRate);
}
STDMETHODIMP CMatroskaMuxerInputPin::BeginFlush()
{
- return __super::BeginFlush();
+ return __super::BeginFlush();
}
STDMETHODIMP CMatroskaMuxerInputPin::EndFlush()
{
- return __super::EndFlush();
+ return __super::EndFlush();
}
STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
{
- if(m_fEndOfStreamReceived)
- {
- /*ASSERT(0);*/ return S_FALSE;
- }
+ if(m_fEndOfStreamReceived) {/*ASSERT(0);*/ return S_FALSE;}
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- while(m_fActive)
- {
- {
- CAutoLock cAutoLock2(&m_csQueue);
- if(m_blocks.GetCount() < MAXBLOCKS)
- break;
- }
+ while(m_fActive)
+ {
+ {
+ CAutoLock cAutoLock2(&m_csQueue);
+ if(m_blocks.GetCount() < MAXBLOCKS)
+ break;
+ }
- Sleep(1);
- }
+ Sleep(1);
+ }
- if(!m_fActive) return S_FALSE;
+ if(!m_fActive) return S_FALSE;
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::Receive(pSample)))
- return hr;
+ if(FAILED(hr = __super::Receive(pSample)))
+ return hr;
- BYTE* pData = NULL;
- pSample->GetPointer(&pData);
+ BYTE* pData = NULL;
+ pSample->GetPointer(&pData);
- long len = pSample->GetActualDataLength();
+ long len = pSample->GetActualDataLength();
- REFERENCE_TIME rtStart = -1, rtStop = -1;
- hr = pSample->GetTime(&rtStart, &rtStop);
+ REFERENCE_TIME rtStart = -1, rtStop = -1;
+ hr = pSample->GetTime(&rtStart, &rtStop);
- if(FAILED(hr) || rtStart == -1 || rtStop == -1)
- {
- TRACE(_T("No timestamp was set on the sample!!!"));
- m_pFilter->NotifyEvent(EC_ERRORABORT, VFW_E_SAMPLE_TIME_NOT_SET, 0);
- return VFW_E_SAMPLE_TIME_NOT_SET;
- }
+ if(FAILED(hr) || rtStart == -1 || rtStop == -1)
+ {
+ TRACE(_T("No timestamp was set on the sample!!!"));
+ m_pFilter->NotifyEvent(EC_ERRORABORT, VFW_E_SAMPLE_TIME_NOT_SET, 0);
+ return VFW_E_SAMPLE_TIME_NOT_SET;
+ }
// rtStart += m_tStart;
// rtStop += m_tStart;
- /**/
- TRACE(_T("Received (%d): %I64d-%I64d (c=%d, co=%dms), len=%d, d%d p%d s%d\n"),
- (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this),
- rtStart, rtStop, (int)((rtStart / 10000) / MAXCLUSTERTIME), (int)((rtStart / 10000) % MAXCLUSTERTIME),
- len,
- pSample->IsDiscontinuity() == S_OK ? 1 : 0,
- pSample->IsPreroll() == S_OK ? 1 : 0,
- pSample->IsSyncPoint() == S_OK ? 1 : 0);
-
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3)
- {
- CAutoPtr<CBinary> data(DNew CBinary(0));
- data->SetCount(len);
- memcpy(data->GetData(), pData, len);
- m_pVorbisHdrs.Add(data);
-
- if(m_pVorbisHdrs.GetCount() == 3)
- {
- int len = 1;
- for(int i = 0; i < 2; i++) len += m_pVorbisHdrs[i]->GetCount() / 255 + 1;
- for(int i = 0; i < 3; i++) len += m_pVorbisHdrs[i]->GetCount();
- m_pTE->CodecPrivate.SetCount(len);
-
- BYTE* dst = m_pTE->CodecPrivate.GetData();
-
- *dst++ = 2;
- for(int i = 0; i < 2; i++)
- for(int len = m_pVorbisHdrs[i]->GetCount(); len >= 0; len -= 255)
- * dst++ = min(len, 255);
-
- for(int i = 0; i < 3; i++)
- {
- memcpy(dst, m_pVorbisHdrs[i]->GetData(), m_pVorbisHdrs[i]->GetCount());
- dst += m_pVorbisHdrs[i]->GetCount();
- }
- }
-
- return S_OK;
- }
-
- if(m_mt.formattype == FORMAT_WaveFormatEx
- && (((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM
- || ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_MPEGLAYER3))
- pSample->SetSyncPoint(TRUE); // HACK: some capture filters don't set this
-
- CAutoPtr<BlockGroup> b(DNew BlockGroup());
- /*
- // TODO: test this with a longer capture (pcm, mp3)
- if(S_OK == pSample->IsSyncPoint() && rtStart < m_rtLastStart)
- {
- TRACE(_T("!!! timestamp went backwards, dropping this frame !!! rtStart (%I64) < m_rtLastStart (%I64)"), rtStart, m_rtLastStart);
- return S_OK;
- }
- */
- if((S_OK != pSample->IsSyncPoint() || m_rtLastStart == rtStart) && m_rtLastStart >= 0 /*&& m_rtLastStart < rtStart*/)
- {
- ASSERT(m_rtLastStart - rtStart <= 0);
- REFERENCE_TIME rtDiff = m_rtLastStart - rtStart;
- b->ReferenceBlock.Set((rtDiff + (rtDiff >= 0 ? 5000 : -5000)) / 10000);
- }
-
- b->Block.TrackNumber = (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this);
-
- b->Block.TimeCode = (rtStart + 5000) / 10000;
- b->Block.TimeCodeStop = (rtStop + 5000) / 10000;
-
- if(m_pTE->TrackType == TrackEntry::TypeSubtitle)
- {
- b->BlockDuration.Set((rtStop - rtStart + 5000) / 10000);
- }
-
- CAutoPtr<CBinary> data(DNew CBinary(0));
- data->SetCount(len);
- memcpy(data->GetData(), pData, len);
- b->Block.BlockData.AddTail(data);
-
- CAutoLock cAutoLock2(&m_csQueue);
- m_blocks.AddTail(b); // TODO: lacing for audio
-
- m_rtLastStart = rtStart;
- m_rtLastStop = rtStop;
-
- return S_OK;
+/**/
+ TRACE(_T("Received (%d): %I64d-%I64d (c=%d, co=%dms), len=%d, d%d p%d s%d\n"),
+ (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this),
+ rtStart, rtStop, (int)((rtStart/10000)/MAXCLUSTERTIME), (int)((rtStart/10000)%MAXCLUSTERTIME),
+ len,
+ pSample->IsDiscontinuity() == S_OK ? 1 : 0,
+ pSample->IsPreroll() == S_OK ? 1 : 0,
+ pSample->IsSyncPoint() == S_OK ? 1 : 0);
+
+ if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3)
+ {
+ CAutoPtr<CBinary> data(DNew CBinary(0));
+ data->SetCount(len);
+ memcpy(data->GetData(), pData, len);
+ m_pVorbisHdrs.Add(data);
+
+ if(m_pVorbisHdrs.GetCount() == 3)
+ {
+ int len = 1;
+ for(int i = 0; i < 2; i++) len += m_pVorbisHdrs[i]->GetCount()/255 + 1;
+ for(int i = 0; i < 3; i++) len += m_pVorbisHdrs[i]->GetCount();
+ m_pTE->CodecPrivate.SetCount(len);
+
+ BYTE* dst = m_pTE->CodecPrivate.GetData();
+
+ *dst++ = 2;
+ for(int i = 0; i < 2; i++)
+ for(int len = m_pVorbisHdrs[i]->GetCount(); len >= 0; len -= 255)
+ *dst++ = min(len, 255);
+
+ for(int i = 0; i < 3; i++)
+ {
+ memcpy(dst, m_pVorbisHdrs[i]->GetData(), m_pVorbisHdrs[i]->GetCount());
+ dst += m_pVorbisHdrs[i]->GetCount();
+ }
+ }
+
+ return S_OK;
+ }
+
+ if(m_mt.formattype == FORMAT_WaveFormatEx
+ && (((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM
+ || ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_MPEGLAYER3))
+ pSample->SetSyncPoint(TRUE); // HACK: some capture filters don't set this
+
+ CAutoPtr<BlockGroup> b(DNew BlockGroup());
+/*
+ // TODO: test this with a longer capture (pcm, mp3)
+ if(S_OK == pSample->IsSyncPoint() && rtStart < m_rtLastStart)
+ {
+ TRACE(_T("!!! timestamp went backwards, dropping this frame !!! rtStart (%I64) < m_rtLastStart (%I64)"), rtStart, m_rtLastStart);
+ return S_OK;
+ }
+*/
+ if((S_OK != pSample->IsSyncPoint() || m_rtLastStart == rtStart) && m_rtLastStart >= 0 /*&& m_rtLastStart < rtStart*/)
+ {
+ ASSERT(m_rtLastStart - rtStart <= 0);
+ REFERENCE_TIME rtDiff = m_rtLastStart - rtStart;
+ b->ReferenceBlock.Set((rtDiff + (rtDiff >= 0 ? 5000 : -5000)) / 10000);
+ }
+
+ b->Block.TrackNumber = (static_cast<CMatroskaMuxerFilter*>(m_pFilter))->GetTrackNumber(this);
+
+ b->Block.TimeCode = (rtStart + 5000) / 10000;
+ b->Block.TimeCodeStop = (rtStop + 5000) / 10000;
+
+ if(m_pTE->TrackType == TrackEntry::TypeSubtitle)
+ {
+ b->BlockDuration.Set((rtStop - rtStart + 5000) / 10000);
+ }
+
+ CAutoPtr<CBinary> data(DNew CBinary(0));
+ data->SetCount(len);
+ memcpy(data->GetData(), pData, len);
+ b->Block.BlockData.AddTail(data);
+
+ CAutoLock cAutoLock2(&m_csQueue);
+ m_blocks.AddTail(b); // TODO: lacing for audio
+
+ m_rtLastStart = rtStart;
+ m_rtLastStop = rtStop;
+
+ return S_OK;
}
STDMETHODIMP CMatroskaMuxerInputPin::EndOfStream()
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::EndOfStream()))
- return hr;
+ if(FAILED(hr = __super::EndOfStream()))
+ return hr;
- CAutoLock cAutoLock(&m_csQueue);
+ CAutoLock cAutoLock(&m_csQueue);
- m_fEndOfStreamReceived = true;
+ m_fEndOfStreamReceived = true;
- return hr;
+ return hr;
}
//
@@ -1361,7 +1297,7 @@ STDMETHODIMP CMatroskaMuxerInputPin::EndOfStream()
//
CMatroskaMuxerOutputPin::CMatroskaMuxerOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
+ : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
{
}
@@ -1371,10 +1307,10 @@ CMatroskaMuxerOutputPin::~CMatroskaMuxerOutputPin()
STDMETHODIMP CMatroskaMuxerOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMatroskaMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -1384,8 +1320,8 @@ HRESULT CMatroskaMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCAT
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = 1;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 1;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -1398,30 +1334,30 @@ HRESULT CMatroskaMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCAT
HRESULT CMatroskaMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_Matroska
- ? S_OK
- : E_INVALIDARG;
+ return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_Matroska
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CMatroskaMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- pmt->ResetFormatBuffer();
- pmt->InitMediaType();
- pmt->majortype = MEDIATYPE_Stream;
- pmt->subtype = MEDIASUBTYPE_Matroska;
- pmt->formattype = FORMAT_None;
+ pmt->ResetFormatBuffer();
+ pmt->InitMediaType();
+ pmt->majortype = MEDIATYPE_Stream;
+ pmt->subtype = MEDIASUBTYPE_Matroska;
+ pmt->formattype = FORMAT_None;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CMatroskaMuxerOutputPin::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
diff --git a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h
index b89e92f02..68bcdd2e0 100644
--- a/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h
+++ b/src/filters/muxer/MatroskaMuxer/MatroskaMuxer.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,52 +30,49 @@
class CMatroskaMuxerInputPin : public CBaseInputPin
{
- CAutoPtr<MatroskaWriter::TrackEntry> m_pTE;
- CAutoPtrArray<MatroskaWriter::CBinary> m_pVorbisHdrs;
+ CAutoPtr<MatroskaWriter::TrackEntry> m_pTE;
+ CAutoPtrArray<MatroskaWriter::CBinary> m_pVorbisHdrs;
- bool m_fActive;
- CCritSec m_csReceive;
+ bool m_fActive;
+ CCritSec m_csReceive;
- REFERENCE_TIME m_rtLastStart, m_rtLastStop;
+ REFERENCE_TIME m_rtLastStart, m_rtLastStop;
public:
- CMatroskaMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CMatroskaMuxerInputPin();
+ CMatroskaMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMatroskaMuxerInputPin();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- MatroskaWriter::TrackEntry* GetTrackEntry()
- {
- return m_pTE;
- }
+ MatroskaWriter::TrackEntry* GetTrackEntry() {return m_pTE;}
- REFERENCE_TIME m_rtDur;
+ REFERENCE_TIME m_rtDur;
- CCritSec m_csQueue;
- CAutoPtrList<MatroskaWriter::BlockGroup> m_blocks;
- bool m_fEndOfStreamReceived;
+ CCritSec m_csQueue;
+ CAutoPtrList<MatroskaWriter::BlockGroup> m_blocks;
+ bool m_fEndOfStreamReceived;
HRESULT CheckMediaType(const CMediaType* pmt);
HRESULT BreakConnect();
HRESULT CompleteConnect(IPin* pPin);
- HRESULT Active(), Inactive();
+ HRESULT Active(), Inactive();
STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- STDMETHODIMP BeginFlush();
- STDMETHODIMP EndFlush();
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
- STDMETHODIMP Receive(IMediaSample* pSample);
+ STDMETHODIMP Receive(IMediaSample* pSample);
STDMETHODIMP EndOfStream();
};
class CMatroskaMuxerOutputPin : public CBaseOutputPin
{
public:
- CMatroskaMuxerOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CMatroskaMuxerOutputPin();
+ CMatroskaMuxerOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMatroskaMuxerOutputPin();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
@@ -83,80 +80,79 @@ public:
HRESULT CheckMediaType(const CMediaType* pmt);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
[uuid("38E2D43D-915D-493C-B373-888DB16EE3DC")]
-interface IMatroskaMuxer :
-public IUnknown
+interface IMatroskaMuxer : public IUnknown
{
- STDMETHOD(CorrectTimeOffset)(bool fNegative, bool fPositive) = 0;
- // TODO: chapters
+ STDMETHOD (CorrectTimeOffset) (bool fNegative, bool fPositive) = 0;
+ // TODO: chapters
};
[uuid("1E1299A2-9D42-4F12-8791-D79E376F4143")]
class CMatroskaMuxerFilter
- : public CBaseFilter
- , public CCritSec
- , public CAMThread
- , public IAMFilterMiscFlags
- , public IMediaSeeking
- , public IMatroskaMuxer
+ : public CBaseFilter
+ , public CCritSec
+ , public CAMThread
+ , public IAMFilterMiscFlags
+ , public IMediaSeeking
+ , public IMatroskaMuxer
{
protected:
- CAutoPtrList<CMatroskaMuxerInputPin> m_pInputs;
- CAutoPtr<CMatroskaMuxerOutputPin> m_pOutput;
+ CAutoPtrList<CMatroskaMuxerInputPin> m_pInputs;
+ CAutoPtr<CMatroskaMuxerOutputPin> m_pOutput;
- REFERENCE_TIME m_rtCurrent;
+ REFERENCE_TIME m_rtCurrent;
- bool m_fNegative, m_fPositive;
+ bool m_fNegative, m_fPositive;
- enum {CMD_EXIT, CMD_RUN};
- DWORD ThreadProc();
+ enum {CMD_EXIT, CMD_RUN};
+ DWORD ThreadProc();
public:
- CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CMatroskaMuxerFilter();
+ CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CMatroskaMuxerFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- void AddInput();
- UINT GetTrackNumber(CBasePin* pPin);
+ void AddInput();
+ UINT GetTrackNumber(CBasePin* pPin);
- int GetPinCount();
- CBasePin* GetPin(int n);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
- STDMETHODIMP Stop();
- STDMETHODIMP Pause();
- STDMETHODIMP Run(REFERENCE_TIME tStart);
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
- // IAMFilterMiscFlags
+ // IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags();
+ STDMETHODIMP_(ULONG) GetMiscFlags();
- // IMediaSeeking
+ // IMediaSeeking
- STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
- STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(double* pdRate);
- STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
- // IMatroskaMuxer
+ // IMatroskaMuxer
- STDMETHODIMP CorrectTimeOffset(bool fNegative, bool fPositive);
+ STDMETHODIMP CorrectTimeOffset(bool fNegative, bool fPositive);
};
diff --git a/src/filters/muxer/MatroskaMuxer/resource.h b/src/filters/muxer/MatroskaMuxer/resource.h
index 22bd5aaf8..cfa5a212d 100644
--- a/src/filters/muxer/MatroskaMuxer/resource.h
+++ b/src/filters/muxer/MatroskaMuxer/resource.h
@@ -3,7 +3,7 @@
// Used by MatroskaMuxer.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/muxer/MatroskaMuxer/stdafx.cpp b/src/filters/muxer/MatroskaMuxer/stdafx.cpp
index 7f32a5e45..6927dbf9c 100644
--- a/src/filters/muxer/MatroskaMuxer/stdafx.cpp
+++ b/src/filters/muxer/MatroskaMuxer/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/MatroskaMuxer/stdafx.h b/src/filters/muxer/MatroskaMuxer/stdafx.h
index 2bec11afc..22cb54295 100644
--- a/src/filters/muxer/MatroskaMuxer/stdafx.h
+++ b/src/filters/muxer/MatroskaMuxer/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/WavDest/WavDest.cpp b/src/filters/muxer/WavDest/WavDest.cpp
index 5819b2cb8..ff3085f24 100644
--- a/src/filters/muxer/WavDest/WavDest.cpp
+++ b/src/filters/muxer/WavDest/WavDest.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,12 +29,12 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -45,7 +45,7 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CWavDestFilter), L"MPC - WavDest", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CWavDestFilter), L"MPC - WavDest", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
@@ -57,12 +57,12 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -76,7 +76,7 @@ CFilterApp theApp;
//
CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CTransformFilter(NAME("WavDest filter"), pUnk, __uuidof(this))
+ : CTransformFilter(NAME("WavDest filter"), pUnk, __uuidof(this))
{
if(SUCCEEDED(*phr))
{
@@ -88,10 +88,10 @@ CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
else
{
*phr = E_OUTOFMEMORY;
- return;
+ return;
}
- if(CTransformInputPin* pIn = DNew CTransformInputPin(NAME("Transform input pin"), this, phr, L"In"))
+ if(CTransformInputPin* pIn = DNew CTransformInputPin(NAME("Transform input pin"), this, phr, L"In"))
{
if(SUCCEEDED(*phr)) m_pInput = pIn;
else delete pIn;
@@ -99,7 +99,7 @@ CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
else
{
*phr = E_OUTOFMEMORY;
- return;
+ return;
}
}
}
@@ -120,7 +120,7 @@ HRESULT CWavDestFilter::Receive(IMediaSample* pSample)
// don't update the count if Deliver() downstream fails.
if(hr != S_OK)
- m_cbWavData = cbOld;
+ m_cbWavData = cbOld;
return hr;
}
@@ -128,15 +128,15 @@ HRESULT CWavDestFilter::Receive(IMediaSample* pSample)
HRESULT CWavDestFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
REFERENCE_TIME rtStart, rtEnd;
-
+
HRESULT hr = Copy(pIn, pOut);
if(FAILED(hr))
- return hr;
+ return hr;
// Prepare it for writing
LONG lActual = pOut->GetActualDataLength();
- if(m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader) // overflow
+ if(m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader ) // overflow
return E_FAIL;
rtStart = m_cbWavData + m_cbHeader;
@@ -144,7 +144,7 @@ HRESULT CWavDestFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
m_cbWavData += lActual;
EXECUTE_ASSERT(pOut->SetTime(&rtStart, &rtEnd) == S_OK);
-
+
return S_OK;
}
@@ -157,7 +157,7 @@ HRESULT CWavDestFilter::Copy(IMediaSample* pSource, IMediaSample* pDest) const
long lDestSize = pDest->GetSize();
ASSERT(lDestSize >= lSourceSize);
#endif
-
+
pSource->GetPointer(&pSourceBuffer);
pDest->GetPointer(&pDestBuffer);
@@ -167,11 +167,11 @@ HRESULT CWavDestFilter::Copy(IMediaSample* pSource, IMediaSample* pDest) const
REFERENCE_TIME TimeStart, TimeEnd;
if(NOERROR == pSource->GetTime(&TimeStart, &TimeEnd))
- pDest->SetTime(&TimeStart, &TimeEnd);
+ pDest->SetTime(&TimeStart, &TimeEnd);
LONGLONG MediaStart, MediaEnd;
if(pSource->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
- pDest->SetMediaTime(&MediaStart, &MediaEnd);
+ pDest->SetMediaTime(&MediaStart, &MediaEnd);
// Copy the media type
AM_MEDIA_TYPE* pMediaType;
@@ -183,20 +183,20 @@ HRESULT CWavDestFilter::Copy(IMediaSample* pSource, IMediaSample* pDest) const
long lDataLength = pSource->GetActualDataLength();
pDest->SetActualDataLength(lDataLength);
- return NOERROR;
+ return NOERROR;
}
HRESULT CWavDestFilter::CheckInputType(const CMediaType* mtIn)
{
- return mtIn->formattype == FORMAT_WaveFormatEx ? S_OK : S_FALSE;
+ return mtIn->formattype == FORMAT_WaveFormatEx ? S_OK : S_FALSE;
}
HRESULT CWavDestFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
ASSERT(iPosition == 0 || iPosition == 1);
- if(iPosition == 0)
- {
+ if(iPosition == 0)
+ {
pMediaType->SetType(&MEDIATYPE_Stream);
pMediaType->SetSubtype(&MEDIASUBTYPE_WAVE);
return S_OK;
@@ -208,40 +208,40 @@ HRESULT CWavDestFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
{
if(m_pInput->IsConnected() == FALSE)
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
ASSERT(pAlloc);
ASSERT(pProperties);
- HRESULT hr = NOERROR;
+ HRESULT hr = NOERROR;
pProperties->cBuffers = 1;
pProperties->cbAlign = 1;
-
+
CComPtr<IMemAllocator> pInAlloc;
ALLOCATOR_PROPERTIES InProps;
if(SUCCEEDED(hr = m_pInput->GetAllocator(&pInAlloc))
- && SUCCEEDED(hr = pInAlloc->GetProperties(&InProps)))
+ && SUCCEEDED(hr = pInAlloc->GetProperties(&InProps)))
{
- pProperties->cbBuffer = InProps.cbBuffer;
- }
- else
- {
- return hr;
+ pProperties->cbBuffer = InProps.cbBuffer;
}
+ else
+ {
+ return hr;
+ }
ASSERT(pProperties->cbBuffer);
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual)))
- return hr;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties,&Actual)))
+ return hr;
ASSERT(Actual.cBuffers == 1);
if(pProperties->cBuffers > Actual.cBuffers
- || pProperties->cbBuffer > Actual.cbBuffer)
- {
- return E_FAIL;
+ || pProperties->cbBuffer > Actual.cbBuffer)
+ {
+ return E_FAIL;
}
return NOERROR;
@@ -258,11 +258,11 @@ HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPER
HRESULT CWavDestFilter::StartStreaming()
{
// leave space for the header
- m_cbHeader = sizeof(RIFFLIST) +
- sizeof(RIFFCHUNK) +
- m_pInput->CurrentMediaType().FormatLength() +
+ m_cbHeader = sizeof(RIFFLIST) +
+ sizeof(RIFFCHUNK) +
+ m_pInput->CurrentMediaType().FormatLength() +
sizeof(RIFFCHUNK);
-
+
m_cbWavData = 0;
return S_OK;
@@ -271,12 +271,12 @@ HRESULT CWavDestFilter::StartStreaming()
HRESULT CWavDestFilter::StopStreaming()
{
IStream* pStream;
- if(m_pOutput->IsConnected() == FALSE)
+ if (m_pOutput->IsConnected() == FALSE)
return E_FAIL;
IPin* pDwnstrmInputPin = m_pOutput->GetConnected();
- if(!pDwnstrmInputPin)
+ if (!pDwnstrmInputPin)
return E_FAIL;
HRESULT hr = ((IMemInputPin *) pDwnstrmInputPin)->QueryInterface(IID_IStream, (void **)&pStream);
@@ -301,10 +301,9 @@ HRESULT CWavDestFilter::StopStreaming()
LARGE_INTEGER li;
ZeroMemory(&li, sizeof(li));
-
+
hr = pStream->Seek(li, STREAM_SEEK_SET, 0);
- if(SUCCEEDED(hr))
- {
+ if(SUCCEEDED(hr)) {
hr = pStream->Write(pb, m_cbHeader, 0);
}
pStream->Release();
@@ -314,7 +313,7 @@ HRESULT CWavDestFilter::StopStreaming()
}
CWavDestOutputPin::CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr)
- : CTransformOutputPin(NAME("WavDest output pin"), pFilter, phr, L"Out")
+ : CTransformOutputPin(NAME("WavDest output pin"), pFilter, phr, L"Out")
{
}
diff --git a/src/filters/muxer/WavDest/WavDest.h b/src/filters/muxer/WavDest/WavDest.h
index 2c1cb569a..84b054d32 100644
--- a/src/filters/muxer/WavDest/WavDest.h
+++ b/src/filters/muxer/WavDest/WavDest.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -39,7 +39,7 @@ public:
CWavDestFilter(LPUNKNOWN pUnk, HRESULT* pHr);
~CWavDestFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
HRESULT Receive(IMediaSample* pSample);
diff --git a/src/filters/muxer/WavDest/stdafx.cpp b/src/filters/muxer/WavDest/stdafx.cpp
index c21a39cec..e9267f937 100644
--- a/src/filters/muxer/WavDest/stdafx.cpp
+++ b/src/filters/muxer/WavDest/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/muxer/WavDest/stdafx.h b/src/filters/muxer/WavDest/stdafx.h
index 1d4063afa..2b6b600ac 100644
--- a/src/filters/muxer/WavDest/stdafx.h
+++ b/src/filters/muxer/WavDest/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp
index 95bf6bea3..7b610a505 100644
--- a/src/filters/parser/AviSplitter/AviFile.cpp
+++ b/src/filters/parser/AviSplitter/AviFile.cpp
@@ -6,618 +6,607 @@
//
CAviFile::CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) return;
- m_isamv = false;
- hr = Init();
+ if(FAILED(hr)) return;
+ m_isamv = false;
+ hr = Init();
}
-template<typename T>
+template<typename T>
HRESULT CAviFile::Read(T& var, int offset)
{
- memset(&var, 0, sizeof(var));
- HRESULT hr = ByteRead((BYTE*)&var + offset, sizeof(var) - offset);
- return hr;
+ memset(&var, 0, sizeof(var));
+ HRESULT hr = ByteRead((BYTE*)&var + offset, sizeof(var) - offset);
+ return hr;
}
HRESULT CAviFile::Init()
{
- Seek(0);
- DWORD dw[3];
- if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV ')))
- return E_FAIL;
-
- m_isamv = (dw[2] == FCC('AMV '));
- Seek(0);
- HRESULT hr = Parse(0, GetLength());
- if(m_movis.GetCount() == 0) // FAILED(hr) is allowed as long as there was a movi chunk found
- return E_FAIL;
-
- if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0)
- m_avih.dwStreams = m_strms.GetCount();
-
- if(m_avih.dwStreams != m_strms.GetCount())
- return E_FAIL;
-
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- if(s->strh.fccType != FCC('auds')) continue;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
- if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
- && s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec)
- {
- // correcting encoder bugs...
- s->strh.dwScale = 1152;
- s->strh.dwRate = wfe->nSamplesPerSec;
- }
- }
-
- if(!m_isamv && (FAILED(BuildIndex())))
- EmptyIndex();
-
- return S_OK;
+ Seek(0);
+ DWORD dw[3];
+ if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX') && dw[2] != FCC('AMV ')))
+ return E_FAIL;
+
+ m_isamv = (dw[2] == FCC('AMV '));
+ Seek(0);
+ HRESULT hr = Parse(0, GetLength());
+ if(m_movis.GetCount() == 0) // FAILED(hr) is allowed as long as there was a movi chunk found
+ return E_FAIL;
+
+ if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0)
+ m_avih.dwStreams = m_strms.GetCount();
+
+ if(m_avih.dwStreams != m_strms.GetCount())
+ return E_FAIL;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ if(s->strh.fccType != FCC('auds')) continue;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
+ if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
+ && s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec)
+ {
+ // correcting encoder bugs...
+ s->strh.dwScale = 1152;
+ s->strh.dwRate = wfe->nSamplesPerSec;
+ }
+ }
+
+ if (!m_isamv && (FAILED(BuildIndex())))
+ EmptyIndex();
+
+ return S_OK;
}
HRESULT CAviFile::BuildAMVIndex()
{
- strm_t::chunk NewChunk;
- ULONG ulType;
- ULONG ulSize;
-
- memset(&NewChunk, 0, sizeof(strm_t::chunk));
- while((Read(ulType) == S_OK) && (Read(ulSize) == S_OK))
- {
- switch(ulType)
- {
- case FCC('00dc'): // 01bw : JPeg
- NewChunk.size = ulSize;
- NewChunk.filepos = GetPos();
- NewChunk.orgsize = ulSize;
- NewChunk.fKeyFrame = true;
- m_strms[0]->cs.Add(NewChunk);
- break;
- case FCC('01wb') : // 00dc : Audio
- NewChunk.size = ulSize;
- NewChunk.orgsize = ulSize;
- NewChunk.fKeyFrame = true;
- NewChunk.filepos = GetPos();
- m_strms[1]->cs.Add(NewChunk);
- break;
- }
- Seek(GetPos() + ulSize);
- }
-
- TRACE("Video packet : %d Audio packet :%d\n", m_strms[0]->cs.GetCount(), m_strms[1]->cs.GetCount());
- return S_OK;
+ strm_t::chunk NewChunk;
+ ULONG ulType;
+ ULONG ulSize;
+
+ memset (&NewChunk, 0, sizeof(strm_t::chunk));
+ while((Read(ulType) == S_OK) && (Read(ulSize) == S_OK))
+ {
+ switch (ulType)
+ {
+ case FCC('00dc'): // 01bw : JPeg
+ NewChunk.size = ulSize;
+ NewChunk.filepos = GetPos();
+ NewChunk.orgsize = ulSize;
+ NewChunk.fKeyFrame = true;
+ m_strms[0]->cs.Add (NewChunk);
+ break;
+ case FCC('01wb') : // 00dc : Audio
+ NewChunk.size = ulSize;
+ NewChunk.orgsize = ulSize;
+ NewChunk.fKeyFrame = true;
+ NewChunk.filepos = GetPos();
+ m_strms[1]->cs.Add (NewChunk);
+ break;
+ }
+ Seek(GetPos() + ulSize);
+ }
+
+ TRACE ("Video packet : %d Audio packet :%d\n", m_strms[0]->cs.GetCount(), m_strms[1]->cs.GetCount());
+ return S_OK;
}
HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
{
- HRESULT hr = S_OK;
-
- CAutoPtr<strm_t> strm;
-
- while(S_OK == hr && GetPos() < end)
- {
- UINT64 pos = GetPos();
-
- DWORD id = 0, size;
- if(S_OK != Read(id) || id == 0)
- return E_FAIL;
-
- if(id == FCC('RIFF') || id == FCC('LIST'))
- {
- if(S_OK != Read(size) || S_OK != Read(id))
- return E_FAIL;
-
- if(m_isamv) size = end - GetPos() - 8; // No size set in AVM : guess end of file...
- size += (size & 1) + 8;
-
- TRACE(_T("CAviFile::Parse(..): LIST '%c%c%c%c'\n"),
- TCHAR((id >> 0) & 0xff),
- TCHAR((id >> 8) & 0xff),
- TCHAR((id >> 16) & 0xff),
- TCHAR((id >> 24) & 0xff));
-
- if(id == FCC('movi'))
- {
- m_movis.AddTail(pos);
- if(m_isamv) BuildAMVIndex();
- }
- else
- {
- hr = Parse(id, pos + size);
- }
- }
- else
- {
- if(S_OK != Read(size))
- return E_FAIL;
-
- TRACE(_T("CAviFile::Parse(..): '%c%c%c%c'\n"),
- TCHAR((id >> 0) & 0xff),
- TCHAR((id >> 8) & 0xff),
- TCHAR((id >> 16) & 0xff),
- TCHAR((id >> 24) & 0xff));
-
- if(parentid == FCC('INFO') && size > 0)
- {
- switch(id)
- {
- case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
- case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
- case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
- case FCC('ICMT'): // Comments. Provides general comments about the file or the subject of the file. If the comment is several sentences long, end each sentence with a period. Do not include new-line characters.
- case FCC('ICOP'): // Copyright. Records the copyright information for the file; for example, “Copyright Encyclopedia International 1991.” If there are multiple copyrights, separate them by a semicolon followed by a space.
- case FCC('ICRD'): // Creation date. Specifies the date the subject of the file was created. List dates in year-month-day format, padding one-digit months and days with a zero on the left; for example, “1553-05-03” for May 3, 1553.
- case FCC('ICRP'): // Cropped. Describes whether an image has been cropped and, if so, how it was cropped; for example, “lower-right corner.”
- case FCC('IDIM'): // Dimensions. Specifies the size of the original subject of the file; for example, “8.5 in h, 11 in w.”
- case FCC('IDPI'): // Dots Per Inch. Stores dots per inch setting of the digitizer used to produce the file, such as “300.”
- case FCC('IENG'): // Engineer. Stores the name of the engineer who worked on the file. If there are multiple engineers, separate the names by a semicolon and a blank; for example, “Smith, John; Adams, Joe.”
- case FCC('IGNR'): // Genre. Describes the original work, such as “landscape,” “portrait,” “still life,” etc.
- case FCC('IKEY'): // Keywords. Provides a list of keywords that refer to the file or subject of the file. Separate multiple keywords with a semicolon and a blank; for example, “Seattle; aerial view; scenery.”
- case FCC('ILGT'): // Lightness. Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.
- case FCC('IMED'): // Medium. Describes the original subject of the file, such as “computer image,” “drawing,” “lithograph,” and so on.
- case FCC('INAM'): // Name. Stores the title of the subject of the file, such as “Seattle From Above.”
- case FCC('IPLT'): // Palette Setting. Specifies the number of colors requested when digitizing an image, such as “256.”
- case FCC('IPRD'): // Product. Specifies the name of the title the file was originally intended for, such as “Encyclopedia of Pacific Northwest Geography.”
- case FCC('ISBJ'): // Subject. Describes the contents of the file, such as “Aerial view of Seattle.”
- case FCC('ISFT'): // Software. Identifies the name of the software package used to create the file, such as “Microsoft WaveEdit.”
- case FCC('ISHP'): // Sharpness. Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).
- case FCC('ISRC'): // Source. Identifies the name of the person or organization who supplied the original subject of the file; for example, “Trey Research.”
- case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
- case FCC('ITCH'): // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
- {
- CStringA str;
- if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) return E_FAIL;
- m_info[id] = str;
- break;
- }
- }
- }
-
- switch(id)
- {
- case FCC('amvh'):
- case FCC('avih'):
- m_avih.fcc = id;
- m_avih.cb = size;
- if(S_OK != Read(m_avih, 8)) return E_FAIL;
- break;
- case FCC('strh'):
- if(!strm) strm.Attach(DNew strm_t());
- strm->strh.fcc = FCC('strh');
- strm->strh.cb = size;
- if(S_OK != Read(strm->strh, 8)) return E_FAIL;
- if(m_isamv)
- {
- // First alway video, second always audio
- strm->strh.fccType = m_strms.GetCount() == 0 ? FCC('vids') : FCC('amva');
- strm->strh.dwRate = m_avih.dwReserved[0] * 1000; // dwReserved[0] = fps!
- strm->strh.dwScale = 1000;
- }
- break;
- case FCC('strn'):
- if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) return E_FAIL;
- break;
- case FCC('strf'):
- if(!strm) strm.Attach(DNew strm_t());
- strm->strf.SetCount(size);
- if(S_OK != ByteRead(strm->strf.GetData(), size)) return E_FAIL;
- if(m_isamv)
- {
- if(strm->strh.fccType == FCC('vids'))
- {
- strm->strf.SetCount(sizeof(BITMAPINFOHEADER));
- BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)strm->strf.GetData())->bmiHeader;
- pbmi->biSize = sizeof(BITMAPINFOHEADER);
- pbmi->biHeight = m_avih.dwHeight;
- pbmi->biWidth = m_avih.dwWidth;
- pbmi->biCompression = FCC('AMVV');
- pbmi->biPlanes = 1;
- pbmi->biBitCount = 24;
- pbmi->biSizeImage = pbmi->biHeight * pbmi->biWidth * (pbmi->biBitCount / 8);
- }
- m_strms.Add(strm);
- }
-
- break;
- case FCC('indx'):
- if(!strm) strm.Attach(DNew strm_t());
- ASSERT(strm->indx == NULL);
- AVISUPERINDEX* pSuperIndex;
- if(size < MAXDWORD - 8)
- {
- // Fix buffer overrun vulnerability : http://www.vulnhunt.com/advisories/CAL-20070912-1_Multiple_vendor_produce_handling_AVI_file_vulnerabilities.txt
- TRY
- {
- pSuperIndex = (AVISUPERINDEX*)DNew unsigned char [(size_t)(size + 8)];
- }
- CATCH(CMemoryException, e)
- {
- pSuperIndex = NULL;
- }
- END_CATCH
- if(pSuperIndex)
- {
- strm->indx.Attach(pSuperIndex);
- strm->indx->fcc = FCC('indx');
- strm->indx->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) return E_FAIL;
- ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
- }
- }
- break;
- case FCC('dmlh'):
- if(S_OK != Read(m_dmlh)) return E_FAIL;
- break;
- case FCC('vprp'):
+ HRESULT hr = S_OK;
+
+ CAutoPtr<strm_t> strm;
+
+ while(S_OK == hr && GetPos() < end)
+ {
+ UINT64 pos = GetPos();
+
+ DWORD id = 0, size;
+ if(S_OK != Read(id) || id == 0)
+ return E_FAIL;
+
+ if(id == FCC('RIFF') || id == FCC('LIST'))
+ {
+ if(S_OK != Read(size) || S_OK != Read(id))
+ return E_FAIL;
+
+ if (m_isamv) size = end - GetPos() - 8; // No size set in AVM : guess end of file...
+ size += (size&1) + 8;
+
+ TRACE(_T("CAviFile::Parse(..): LIST '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+
+ if(id == FCC('movi'))
+ {
+ m_movis.AddTail(pos);
+ if (m_isamv) BuildAMVIndex();
+ }
+ else
+ {
+ hr = Parse(id, pos + size);
+ }
+ }
+ else
+ {
+ if(S_OK != Read(size))
+ return E_FAIL;
+
+ TRACE(_T("CAviFile::Parse(..): '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+
+ if(parentid == FCC('INFO') && size > 0)
+ {
+ switch(id)
+ {
+ case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
+ case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
+ case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
+ case FCC('ICMT'): // Comments. Provides general comments about the file or the subject of the file. If the comment is several sentences long, end each sentence with a period. Do not include new-line characters.
+ case FCC('ICOP'): // Copyright. Records the copyright information for the file; for example, “Copyright Encyclopedia International 1991.” If there are multiple copyrights, separate them by a semicolon followed by a space.
+ case FCC('ICRD'): // Creation date. Specifies the date the subject of the file was created. List dates in year-month-day format, padding one-digit months and days with a zero on the left; for example, “1553-05-03” for May 3, 1553.
+ case FCC('ICRP'): // Cropped. Describes whether an image has been cropped and, if so, how it was cropped; for example, “lower-right corner.”
+ case FCC('IDIM'): // Dimensions. Specifies the size of the original subject of the file; for example, “8.5 in h, 11 in w.”
+ case FCC('IDPI'): // Dots Per Inch. Stores dots per inch setting of the digitizer used to produce the file, such as “300.”
+ case FCC('IENG'): // Engineer. Stores the name of the engineer who worked on the file. If there are multiple engineers, separate the names by a semicolon and a blank; for example, “Smith, John; Adams, Joe.”
+ case FCC('IGNR'): // Genre. Describes the original work, such as “landscape,” “portrait,” “still life,” etc.
+ case FCC('IKEY'): // Keywords. Provides a list of keywords that refer to the file or subject of the file. Separate multiple keywords with a semicolon and a blank; for example, “Seattle; aerial view; scenery.”
+ case FCC('ILGT'): // Lightness. Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.
+ case FCC('IMED'): // Medium. Describes the original subject of the file, such as “computer image,” “drawing,” “lithograph,” and so on.
+ case FCC('INAM'): // Name. Stores the title of the subject of the file, such as “Seattle From Above.”
+ case FCC('IPLT'): // Palette Setting. Specifies the number of colors requested when digitizing an image, such as “256.”
+ case FCC('IPRD'): // Product. Specifies the name of the title the file was originally intended for, such as “Encyclopedia of Pacific Northwest Geography.”
+ case FCC('ISBJ'): // Subject. Describes the contents of the file, such as “Aerial view of Seattle.”
+ case FCC('ISFT'): // Software. Identifies the name of the software package used to create the file, such as “Microsoft WaveEdit.”
+ case FCC('ISHP'): // Sharpness. Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).
+ case FCC('ISRC'): // Source. Identifies the name of the person or organization who supplied the original subject of the file; for example, “Trey Research.”
+ case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
+ case FCC('ITCH'): // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
+ {
+ CStringA str;
+ if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) return E_FAIL;
+ m_info[id] = str;
+ break;
+ }
+ }
+ }
+
+ switch(id)
+ {
+ case FCC('amvh'):
+ case FCC('avih'):
+ m_avih.fcc = id;
+ m_avih.cb = size;
+ if(S_OK != Read(m_avih, 8)) return E_FAIL;
+ break;
+ case FCC('strh'):
+ if(!strm) strm.Attach(DNew strm_t());
+ strm->strh.fcc = FCC('strh');
+ strm->strh.cb = size;
+ if(S_OK != Read(strm->strh, 8)) return E_FAIL;
+ if (m_isamv)
+ {
+ // First alway video, second always audio
+ strm->strh.fccType = m_strms.GetCount() == 0 ? FCC('vids') : FCC('amva');
+ strm->strh.dwRate = m_avih.dwReserved[0]*1000; // dwReserved[0] = fps!
+ strm->strh.dwScale = 1000;
+ }
+ break;
+ case FCC('strn'):
+ if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) return E_FAIL;
+ break;
+ case FCC('strf'):
+ if(!strm) strm.Attach(DNew strm_t());
+ strm->strf.SetCount(size);
+ if(S_OK != ByteRead(strm->strf.GetData(), size)) return E_FAIL;
+ if (m_isamv)
+ {
+ if (strm->strh.fccType == FCC('vids'))
+ {
+ strm->strf.SetCount(sizeof(BITMAPINFOHEADER));
+ BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)strm->strf.GetData())->bmiHeader;
+ pbmi->biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->biHeight = m_avih.dwHeight;
+ pbmi->biWidth = m_avih.dwWidth;
+ pbmi->biCompression = FCC('AMVV');
+ pbmi->biPlanes = 1;
+ pbmi->biBitCount = 24;
+ pbmi->biSizeImage = pbmi->biHeight * pbmi->biWidth * (pbmi->biBitCount/8);
+ }
+ m_strms.Add(strm);
+ }
+
+ break;
+ case FCC('indx'):
+ if(!strm) strm.Attach(DNew strm_t());
+ ASSERT(strm->indx == NULL);
+ AVISUPERINDEX* pSuperIndex;
+ if (size < MAXDWORD-8)
+ {
+ // Fix buffer overrun vulnerability : http://www.vulnhunt.com/advisories/CAL-20070912-1_Multiple_vendor_produce_handling_AVI_file_vulnerabilities.txt
+ TRY
+ {
+ pSuperIndex = (AVISUPERINDEX*)DNew unsigned char [(size_t)(size + 8)];
+ }
+ CATCH (CMemoryException, e)
+ {
+ pSuperIndex = NULL;
+ }
+ END_CATCH
+ if (pSuperIndex)
+ {
+ strm->indx.Attach(pSuperIndex);
+ strm->indx->fcc = FCC('indx');
+ strm->indx->cb = size;
+ if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) return E_FAIL;
+ ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
+ }
+ }
+ break;
+ case FCC('dmlh'):
+ if(S_OK != Read(m_dmlh)) return E_FAIL;
+ break;
+ case FCC('vprp'):
// if(S_OK != Read(m_vprp)) return E_FAIL;
- break;
- case FCC('idx1'):
- ASSERT(m_idx1 == NULL);
- m_idx1.Attach((AVIOLDINDEX*)DNew BYTE[size + 8]);
- m_idx1->fcc = FCC('idx1');
- m_idx1->cb = size;
- if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) return E_FAIL;
- break;
- default :
- TRACE(_T("CAviFile::Parse(..): unknown tag '%c%c%c%c'\n"),
- TCHAR((id >> 0) & 0xff),
- TCHAR((id >> 8) & 0xff),
- TCHAR((id >> 16) & 0xff),
- TCHAR((id >> 24) & 0xff));
- break;
- }
-
- size += (size & 1) + 8;
- }
-
- Seek(pos + size);
- }
-
- if(strm) m_strms.Add(strm);
-
- return hr;
+ break;
+ case FCC('idx1'):
+ ASSERT(m_idx1 == NULL);
+ m_idx1.Attach((AVIOLDINDEX*)DNew BYTE[size + 8]);
+ m_idx1->fcc = FCC('idx1');
+ m_idx1->cb = size;
+ if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) return E_FAIL;
+ break;
+ default :
+ TRACE(_T("CAviFile::Parse(..): unknown tag '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+ break;
+ }
+
+ size += (size&1) + 8;
+ }
+
+ Seek(pos + size);
+ }
+
+ if(strm) m_strms.Add(strm);
+
+ return hr;
}
REFERENCE_TIME CAviFile::GetTotalTime()
{
- REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
+ REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
- t = max(t, t2);
- }
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
+ t = max(t, t2);
+ }
- if(t == 0) t = 10i64 * m_avih.dwMicroSecPerFrame * m_avih.dwTotalFrames;
+ if(t == 0) t = 10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames;
- return(t);
+ return(t);
}
HRESULT CAviFile::BuildIndex()
{
- EmptyIndex();
-
- int nSuperIndexes = 0;
-
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- if(s->indx && s->indx->nEntriesInUse > 0) nSuperIndexes++;
- }
-
- if(nSuperIndexes == m_avih.dwStreams)
- {
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
-
- AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
-
- DWORD nEntriesInUse = 0;
-
- for(int j = 0; j < (int)idx->nEntriesInUse; j++)
- {
- Seek(idx->aIndex[j].qwOffset);
-
- AVISTDINDEX stdidx;
- if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex)))
- {
- EmptyIndex();
- return E_FAIL;
- }
-
- nEntriesInUse += stdidx.nEntriesInUse;
- }
-
- s->cs.SetCount(nEntriesInUse);
-
- DWORD frame = 0;
- UINT64 size = 0;
-
- for(int j = 0; j < (int)idx->nEntriesInUse; j++)
- {
- Seek(idx->aIndex[j].qwOffset);
-
- CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
- if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize))
- {
- EmptyIndex();
- return E_FAIL;
- }
-
- for(int k = 0, l = 0; k < (int)p->nEntriesInUse; k++)
- {
- s->cs[frame].size = size;
- s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
- s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize & AVISTDINDEX_DELTAFRAME)
- || s->strh.fccType == FCC('auds');
- s->cs[frame].fChunkHdr = false;
- s->cs[frame].orgsize = p->aIndex[k].dwSize & AVISTDINDEX_SIZEMASK;
-
- if(m_idx1)
- {
- s->cs[frame].filepos -= 8;
- s->cs[frame].fChunkHdr = true;
- }
-
- frame++;
- size += s->GetChunkSize(p->aIndex[k].dwSize & AVISTDINDEX_SIZEMASK);
- }
- }
-
- s->totalsize = size;
- }
- }
- else if(AVIOLDINDEX* idx = m_idx1)
- {
- int len = idx->cb / sizeof(idx->aIndex[0]);
-
- UINT64 offset = m_movis.GetHead() + 8;
-
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
-
- int nFrames = 0;
-
- for(int j = 0; j < len; j++)
- {
- if(TRACKNUM(idx->aIndex[j].dwChunkId) == i)
- nFrames++;
- }
-
- s->cs.SetCount(nFrames);
-
- DWORD frame = 0;
- UINT64 size = 0;
-
- for(int j = 0, k = 0; j < len; j++)
- {
- DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
-
- if(TrackNumber == i)
- {
- if(j == 0 && idx->aIndex[j].dwOffset > offset)
- {
- DWORD id;
- Seek(offset + idx->aIndex[j].dwOffset);
- Read(id);
- if(id != idx->aIndex[j].dwChunkId)
- {
- TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
- offset = 0;
- }
- }
-
- s->cs[frame].size = size;
- s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
- s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags & AVIIF_KEYFRAME)
- || s->strh.fccType == FCC('auds') // FIXME: some audio index is without any kf flag
- || frame == 0; // grrr
- s->cs[frame].fChunkHdr = j == len - 1 || idx->aIndex[j].dwOffset != idx->aIndex[j+1].dwOffset;
- s->cs[frame].orgsize = idx->aIndex[j].dwSize;
-
- frame++;
- size += s->GetChunkSize(idx->aIndex[j].dwSize);
- }
- }
-
- s->totalsize = size;
- }
- }
-
- m_idx1.Free();
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- m_strms[i]->indx.Free();
-
- return S_OK;
+ EmptyIndex();
+
+ int nSuperIndexes = 0;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ if(s->indx && s->indx->nEntriesInUse > 0) nSuperIndexes++;
+ }
+
+ if(nSuperIndexes == m_avih.dwStreams)
+ {
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+
+ AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
+
+ DWORD nEntriesInUse = 0;
+
+ for(int j = 0; j < (int)idx->nEntriesInUse; j++)
+ {
+ Seek(idx->aIndex[j].qwOffset);
+
+ AVISTDINDEX stdidx;
+ if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex)))
+ {
+ EmptyIndex();
+ return E_FAIL;
+ }
+
+ nEntriesInUse += stdidx.nEntriesInUse;
+ }
+
+ s->cs.SetCount(nEntriesInUse);
+
+ DWORD frame = 0;
+ UINT64 size = 0;
+
+ for(int j = 0; j < (int)idx->nEntriesInUse; j++)
+ {
+ Seek(idx->aIndex[j].qwOffset);
+
+ CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)DNew BYTE[idx->aIndex[j].dwSize]);
+ if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize))
+ {
+ EmptyIndex();
+ return E_FAIL;
+ }
+
+ for(int k = 0, l = 0; k < (int)p->nEntriesInUse; k++)
+ {
+ s->cs[frame].size = size;
+ s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
+ s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize&AVISTDINDEX_DELTAFRAME)
+ || s->strh.fccType == FCC('auds');
+ s->cs[frame].fChunkHdr = false;
+ s->cs[frame].orgsize = p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK;
+
+ if(m_idx1)
+ {
+ s->cs[frame].filepos -= 8;
+ s->cs[frame].fChunkHdr = true;
+ }
+
+ frame++;
+ size += s->GetChunkSize(p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK);
+ }
+ }
+
+ s->totalsize = size;
+ }
+ }
+ else if(AVIOLDINDEX* idx = m_idx1)
+ {
+ int len = idx->cb/sizeof(idx->aIndex[0]);
+
+ UINT64 offset = m_movis.GetHead() + 8;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+
+ int nFrames = 0;
+
+ for(int j = 0; j < len; j++)
+ {
+ if(TRACKNUM(idx->aIndex[j].dwChunkId) == i)
+ nFrames++;
+ }
+
+ s->cs.SetCount(nFrames);
+
+ DWORD frame = 0;
+ UINT64 size = 0;
+
+ for(int j = 0, k = 0; j < len; j++)
+ {
+ DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
+
+ if(TrackNumber == i)
+ {
+ if(j == 0 && idx->aIndex[j].dwOffset > offset)
+ {
+ DWORD id;
+ Seek(offset + idx->aIndex[j].dwOffset);
+ Read(id);
+ if(id != idx->aIndex[j].dwChunkId)
+ {
+ TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
+ offset = 0;
+ }
+ }
+
+ s->cs[frame].size = size;
+ s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
+ s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags&AVIIF_KEYFRAME)
+ || s->strh.fccType == FCC('auds') // FIXME: some audio index is without any kf flag
+ || frame == 0; // grrr
+ s->cs[frame].fChunkHdr = j == len-1 || idx->aIndex[j].dwOffset != idx->aIndex[j+1].dwOffset;
+ s->cs[frame].orgsize = idx->aIndex[j].dwSize;
+
+ frame++;
+ size += s->GetChunkSize(idx->aIndex[j].dwSize);
+ }
+ }
+
+ s->totalsize = size;
+ }
+ }
+
+ m_idx1.Free();
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->indx.Free();
+
+ return S_OK;
}
void CAviFile::EmptyIndex()
{
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- strm_t* s = m_strms[i];
- s->cs.RemoveAll();
- s->totalsize = 0;
- }
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ s->cs.RemoveAll();
+ s->totalsize = 0;
+ }
}
bool CAviFile::IsInterleaved(bool fKeepInfo)
{
- if(m_strms.GetCount() < 2)
- return(true);
- /*
- if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
- return(true);
- */
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
-
- DWORD* curchunks = DNew DWORD[m_avih.dwStreams];
- UINT64* cursizes = DNew UINT64[m_avih.dwStreams];
-
- memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
- memset(cursizes, 0, sizeof(UINT64)*m_avih.dwStreams);
-
- int end = 0;
-
- while(1)
- {
- UINT64 fpmin = _I64_MAX;
-
- DWORD n = -1;
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- int curchunk = curchunks[i];
- CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
- if(curchunk >= cs.GetCount()) continue;
+ if(m_strms.GetCount() < 2)
+ return(true);
+/*
+ if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
+ return(true);
+*/
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
+
+ DWORD* curchunks = DNew DWORD[m_avih.dwStreams];
+ UINT64* cursizes = DNew UINT64[m_avih.dwStreams];
+
+ memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
+ memset(cursizes, 0, sizeof(UINT64)*m_avih.dwStreams);
+
+ int end = 0;
+
+ while(1)
+ {
+ UINT64 fpmin = _I64_MAX;
+
+ DWORD n = -1;
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
+ if(curchunk >= cs.GetCount()) continue;
UINT64 fp = cs[curchunk].filepos;
- if(fp < fpmin)
- {
- fpmin = fp;
- n = i;
- }
- }
- if(n == -1) break;
-
- strm_t* s = m_strms[n];
- DWORD& curchunk = curchunks[n];
- UINT64& cursize = cursizes[n];
-
- if(!s->IsRawSubtitleStream())
- {
- strm_t::chunk2& cs2 = s->cs2[curchunk];
- cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize) >> 13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
+ if(fp < fpmin) {fpmin = fp; n = i;}
+ }
+ if(n == -1) break;
+
+ strm_t* s = m_strms[n];
+ DWORD& curchunk = curchunks[n];
+ UINT64& cursize = cursizes[n];
+
+ if(!s->IsRawSubtitleStream())
+ {
+ strm_t::chunk2& cs2 = s->cs2[curchunk];
+ cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)>>13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
// cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)/10000);
- cs2.n = end++;
- }
+ cs2.n = end++;
+ }
- cursize = s->cs[curchunk].size;
- curchunk++;
- }
+ cursize = s->cs[curchunk].size;
+ curchunk++;
+ }
- memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
+ memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
- strm_t::chunk2 cs2last = { -1, 0};
+ strm_t::chunk2 cs2last = {-1, 0};
- bool fInterleaved = true;
+ bool fInterleaved = true;
- while(fInterleaved)
- {
- strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
+ while(fInterleaved)
+ {
+ strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
- int n = -1;
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- {
- int curchunk = curchunks[i];
- if(curchunk >= m_strms[i]->cs2.GetCount()) continue;
- strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t)
- {
- cs2min = cs2;
- n = i;
- }
- }
- if(n == -1) break;
+ int n = -1;
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ if(curchunk >= m_strms[i]->cs2.GetCount()) continue;
+ strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
+ if(cs2.t < cs2min.t) {cs2min = cs2; n = i;}
+ }
+ if(n == -1) break;
- curchunks[n]++;
+ curchunks[n]++;
- if(cs2last.t >= 0 && abs((int)cs2min.n - (int)cs2last.n) >= 1000)
- fInterleaved = false;
+ if(cs2last.t >= 0 && abs((int)cs2min.n - (int)cs2last.n) >= 1000)
+ fInterleaved = false;
- cs2last = cs2min;
- }
+ cs2last = cs2min;
+ }
- delete [] curchunks;
- delete [] cursizes;
+ delete [] curchunks;
+ delete [] cursizes;
- if(fInterleaved && !fKeepInfo)
- {
- // this is not needed anymore, let's save a little memory then
- for(int i = 0; i < (int)m_avih.dwStreams; i++)
- m_strms[i]->cs2.RemoveAll();
- }
+ if(fInterleaved && !fKeepInfo)
+ {
+ // this is not needed anymore, let's save a little memory then
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->cs2.RemoveAll();
+ }
- return(fInterleaved);
+ return(fInterleaved);
}
REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size)
{
- float dframe = frame;
+ float dframe = frame;
- if(strh.fccType == FCC('auds'))
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
+ if(strh.fccType == FCC('auds'))
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
- dframe = wfe->nBlockAlign ? 1.0f * size / wfe->nBlockAlign : 0;
- }
+ dframe = wfe->nBlockAlign ? 1.0f * size / wfe->nBlockAlign : 0;
+ }
- float scale_per_rate = strh.dwRate ? 1.0f * strh.dwScale / strh.dwRate : 0;
+ float scale_per_rate = strh.dwRate ? 1.0f * strh.dwScale / strh.dwRate : 0;
- return (REFERENCE_TIME)(scale_per_rate * dframe * 10000000 + 0.5f);
+ return (REFERENCE_TIME)(scale_per_rate * dframe * 10000000 + 0.5f);
}
int CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
{
- int frame = -1;
+ int frame = -1;
- float rate_per_scale = strh.dwScale ? 1.0f * strh.dwRate / strh.dwScale : 0;
+ float rate_per_scale = strh.dwScale ? 1.0f * strh.dwRate / strh.dwScale : 0;
- if(strh.fccType == FCC('auds'))
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
+ if(strh.fccType == FCC('auds'))
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
- __int64 size = (__int64)(rate_per_scale * wfe->nBlockAlign * rt / 10000000 + 0.5f);
+ __int64 size = (__int64)(rate_per_scale * wfe->nBlockAlign * rt / 10000000 + 0.5f);
- for(frame = 0; frame < cs.GetCount(); frame++)
- {
- if(cs[frame].size > size)
- {
- frame--;
- break;
- }
- }
- }
- else
- {
- frame = (int)(rate_per_scale * rt / 10000000 + 0.5f);
- }
+ for(frame = 0; frame < cs.GetCount(); frame++)
+ {
+ if(cs[frame].size > size)
+ {
+ frame--;
+ break;
+ }
+ }
+ }
+ else
+ {
+ frame = (int)(rate_per_scale * rt / 10000000 + 0.5f);
+ }
- if(frame >= cs.GetCount()) frame = cs.GetCount() - 1;
+ if(frame >= cs.GetCount()) frame = cs.GetCount()-1;
- return frame;
+ return frame;
}
int CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt)
{
- int i = GetFrame(rt);
- for(; i > 0; i--)
- {
- if(cs[i].fKeyFrame) break;
- }
- return(i);
+ int i = GetFrame(rt);
+ for(; i > 0; i--) {if(cs[i].fKeyFrame) break;}
+ return(i);
}
DWORD CAviFile::strm_t::GetChunkSize(DWORD size)
{
- if(strh.fccType == FCC('auds'))
- {
- WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
- size = nBlockAlign ? (size + (nBlockAlign - 1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
- }
+ if(strh.fccType == FCC('auds'))
+ {
+ WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
+ size = nBlockAlign ? (size + (nBlockAlign-1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
+ }
- return size;
+ return size;
}
bool CAviFile::strm_t::IsRawSubtitleStream()
{
- return strh.fccType == FCC('txts') && cs.GetCount() == 1;
+ return strh.fccType == FCC('txts') && cs.GetCount() == 1;
}
diff --git a/src/filters/parser/AviSplitter/AviFile.h b/src/filters/parser/AviSplitter/AviFile.h
index 5d7a8ddb0..6ef8cf9d3 100644
--- a/src/filters/parser/AviSplitter/AviFile.h
+++ b/src/filters/parser/AviSplitter/AviFile.h
@@ -5,62 +5,50 @@
class CAviFile : public CBaseSplitterFile
{
- HRESULT Init();
- HRESULT Parse(DWORD parentid, __int64 end);
- HRESULT BuildAMVIndex();
+ HRESULT Init();
+ HRESULT Parse(DWORD parentid, __int64 end);
+ HRESULT BuildAMVIndex();
public:
- CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- //using CBaseSplitterFile::Read;
- template<typename T> HRESULT Read(T& var, int offset = 0);
+ //using CBaseSplitterFile::Read;
+ template<typename T> HRESULT Read(T& var, int offset = 0);
- AVIMAINHEADER m_avih;
- struct ODMLExtendedAVIHeader
- {
- DWORD dwTotalFrames;
- } m_dmlh;
+ AVIMAINHEADER m_avih;
+ struct ODMLExtendedAVIHeader {DWORD dwTotalFrames;} m_dmlh;
// VideoPropHeader m_vprp;
- struct strm_t
- {
- AVISTREAMHEADER strh;
- CAtlArray<BYTE> strf;
- CStringA strn;
- CAutoPtr<AVISUPERINDEX> indx;
- struct chunk
- {
- UINT64 fKeyFrame: 1, fChunkHdr: 1, size: 62;
- UINT64 filepos;
- DWORD orgsize;
- };
- CAtlArray<chunk> cs;
- UINT64 totalsize;
- REFERENCE_TIME GetRefTime(DWORD frame, UINT64 size);
- int GetTime(DWORD frame, UINT64 size);
- int GetFrame(REFERENCE_TIME rt);
- int GetKeyFrame(REFERENCE_TIME rt);
- DWORD GetChunkSize(DWORD size);
- bool IsRawSubtitleStream();
-
- // tmp
- struct chunk2
- {
- DWORD t;
- DWORD n;
- };
- CAtlArray<chunk2> cs2;
- };
- CAutoPtrArray<strm_t> m_strms;
- CAtlMap<DWORD, CStringA> m_info;
- CAutoPtr<AVIOLDINDEX> m_idx1;
-
- CAtlList<UINT64> m_movis;
- bool m_isamv;
-
- REFERENCE_TIME GetTotalTime();
- HRESULT BuildIndex();
- void EmptyIndex();
- bool IsInterleaved(bool fKeepInfo = false);
+ struct strm_t
+ {
+ AVISTREAMHEADER strh;
+ CAtlArray<BYTE> strf;
+ CStringA strn;
+ CAutoPtr<AVISUPERINDEX> indx;
+ struct chunk {UINT64 fKeyFrame:1, fChunkHdr:1, size:62; UINT64 filepos; DWORD orgsize;};
+ CAtlArray<chunk> cs;
+ UINT64 totalsize;
+ REFERENCE_TIME GetRefTime(DWORD frame, UINT64 size);
+ int GetTime(DWORD frame, UINT64 size);
+ int GetFrame(REFERENCE_TIME rt);
+ int GetKeyFrame(REFERENCE_TIME rt);
+ DWORD GetChunkSize(DWORD size);
+ bool IsRawSubtitleStream();
+
+ // tmp
+ struct chunk2 {DWORD t; DWORD n;};
+ CAtlArray<chunk2> cs2;
+ };
+ CAutoPtrArray<strm_t> m_strms;
+ CAtlMap<DWORD, CStringA> m_info;
+ CAutoPtr<AVIOLDINDEX> m_idx1;
+
+ CAtlList<UINT64> m_movis;
+ bool m_isamv;
+
+ REFERENCE_TIME GetTotalTime();
+ HRESULT BuildIndex();
+ void EmptyIndex();
+ bool IsInterleaved(bool fKeepInfo = false);
};
#define TRACKNUM(fcc) (10*((fcc&0xff)-0x30) + (((fcc>>8)&0xff)-0x30))
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.cpp b/src/filters/parser/AviSplitter/AviReportWnd.cpp
index 76e1a0ab4..95a20c668 100644
--- a/src/filters/parser/AviSplitter/AviReportWnd.cpp
+++ b/src/filters/parser/AviSplitter/AviReportWnd.cpp
@@ -7,165 +7,165 @@
CAviReportWnd::CAviReportWnd()
{
- m_font.CreateFont(12, 0, 0, 0, 400, 0, 0, 0, 1, 0, 0, 0, 0, _T("MS Shell Dlg"));
+ m_font.CreateFont(12, 0, 0, 0, 400, 0, 0, 0, 1, 0, 0, 0, 0, _T("MS Shell Dlg"));
}
bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText)
{
- m_nChunks = 0;
- m_rtDur = 0;
+ m_nChunks = 0;
+ m_rtDur = 0;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
- {
- int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt <= 0) continue;
- CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
- m_nChunks = max(m_nChunks, c2.n);
- m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t << 13);
- }
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int cnt = pAF->m_strms[i]->cs2.GetCount();
+ if(cnt <= 0) continue;
+ CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
+ m_nChunks = max(m_nChunks, c2.n);
+ m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t<<13);
+ }
- CRect r, r2;
- GetDesktopWindow()->GetWindowRect(r);
- r.DeflateRect(r.Width() / 4, r.Height() / 4);
+ CRect r, r2;
+ GetDesktopWindow()->GetWindowRect(r);
+ r.DeflateRect(r.Width()/4, r.Height()/4);
- LPCTSTR wndclass = AfxRegisterWndClass(
- CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS,
- AfxGetApp()->LoadStandardCursor(IDC_ARROW),
- (HBRUSH)(COLOR_BTNFACE + 1), 0);
+ LPCTSTR wndclass = AfxRegisterWndClass(
+ CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS,
+ AfxGetApp()->LoadStandardCursor(IDC_ARROW),
+ (HBRUSH)(COLOR_BTNFACE + 1), 0);
- CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW | WS_CAPTION | WS_CLIPCHILDREN, r, NULL, 0);
+ CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW|WS_CAPTION|WS_CLIPCHILDREN, r, NULL, 0);
- CRect cr;
- GetClientRect(cr);
- cr.DeflateRect(10, 10);
+ CRect cr;
+ GetClientRect(cr);
+ cr.DeflateRect(10, 10);
- SetFont(&m_font, FALSE);
+ SetFont(&m_font, FALSE);
- CDC* pDC = GetDC();
- CFont* pOldFont = pDC->SelectObject(&m_font);
+ CDC* pDC = GetDC();
+ CFont* pOldFont = pDC->SelectObject(&m_font);
- //
+ //
- CString str(
- _T("This AVI file was not prepared for sequential reading, the alternative ")
- _T("'Avi Splitter' will now let the default one handle it. ")
- _T("The complete reinterleaving of this file is strongly recommended before ")
- _T("burning it onto a slow media like cd-rom."));
+ CString str(
+ _T("This AVI file was not prepared for sequential reading, the alternative ")
+ _T("'Avi Splitter' will now let the default one handle it. ")
+ _T("The complete reinterleaving of this file is strongly recommended before ")
+ _T("burning it onto a slow media like cd-rom."));
- r = cr;
+ r = cr;
- pDC->DrawText(str, r, DT_WORDBREAK | DT_CALCRECT);
- r.right = cr.right;
+ pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
+ r.right = cr.right;
- m_message.Create(str, WS_CHILD | WS_VISIBLE, r, this);
- m_message.SetFont(&m_font, FALSE);
+ m_message.Create(str, WS_CHILD|WS_VISIBLE, r, this);
+ m_message.SetFont(&m_font, FALSE);
- //
+ //
- r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
+ r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
- str = _T("Do not show this dialog again (hold Shift to re-enable it)");
+ str = _T("Do not show this dialog again (hold Shift to re-enable it)");
- pDC->DrawText(str, r, DT_WORDBREAK | DT_CALCRECT);
- r.right = cr.right;
+ pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
+ r.right = cr.right;
- m_checkbox.Create(str, WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK);
- m_checkbox.SetFont(&m_font, FALSE);
+ m_checkbox.Create(str, WS_CHILD|WS_VISIBLE|BS_CHECKBOX|BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK);
+ m_checkbox.SetFont(&m_font, FALSE);
- CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked?BST_CHECKED:BST_UNCHECKED);
- //
+ //
- if(!fShowWarningText)
- {
- m_message.ShowWindow(SW_HIDE);
- m_checkbox.ShowWindow(SW_HIDE);
- r = cr;
- }
- else
- {
- r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
- }
+ if(!fShowWarningText)
+ {
+ m_message.ShowWindow(SW_HIDE);
+ m_checkbox.ShowWindow(SW_HIDE);
+ r = cr;
+ }
+ else
+ {
+ r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
+ }
- m_graph.Create(pAF, r, this);
+ m_graph.Create(pAF, r, this);
- //
+ //
- pDC->SelectObject(pOldFont);
- ReleaseDC(pDC);
+ pDC->SelectObject(pOldFont);
+ ReleaseDC(pDC);
- SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- SetForegroundWindow();
- ShowWindow(SW_SHOWNORMAL);
+ SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ SetForegroundWindow();
+ ShowWindow(SW_SHOWNORMAL);
- return !!RunModalLoop();
+ return !!RunModalLoop();
}
IMPLEMENT_DYNCREATE(CAviReportWnd, CWnd)
BEGIN_MESSAGE_MAP(CAviReportWnd, CWnd)
- ON_WM_CLOSE()
- ON_WM_MOUSEMOVE()
+ ON_WM_CLOSE()
+ ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()
void CAviReportWnd::OnClose()
{
- EndModalLoop(IsDlgButtonChecked(IDC_DONOTSHOWAGAINCHECK));
- __super::OnClose();
+ EndModalLoop(IsDlgButtonChecked(IDC_DONOTSHOWAGAINCHECK));
+ __super::OnClose();
}
void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p)
{
- MapWindowPoints(&m_graph, &p, 1);
-
- CRect r, r2;
- m_graph.GetClientRect(r);
- r2 = r;
- r.bottom -= GRAPHFOOTER;
- r2.top = r.bottom;
-
- if(r.PtInRect(p))
- {
- SetCapture();
-
- int x = p.x - r.left;
- int y = r.bottom - p.y;
-
- REFERENCE_TIME rt = m_rtDur * x / r.Width();
- int chunk = (int)(1.0 * m_nChunks * y / r.Height());
-
- rt /= 10000;
- int ms = (int)(rt % 1000);
- rt /= 1000;
- int s = (int)(rt % 60);
- rt /= 60;
- int m = (int)(rt % 60);
- rt /= 60;
- int h = (int)(rt);
-
- CString str;
- str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
- SetWindowText(str);
- }
- else if(r2.PtInRect(p))
- {
- SetCapture();
-
- int dist = m_graph.GetChunkDist(p.x - r2.left);
- CString str;
- str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
- if(dist >= 1000) str += _T(" - over the limit!");
- str += ")";
- SetWindowText(str);
- }
- else if(GetCapture() == this)
- {
- SetWindowText(TITLE);
-
- ReleaseCapture();
- }
-
- __super::OnMouseMove(nFlags, p);
+ MapWindowPoints(&m_graph, &p, 1);
+
+ CRect r, r2;
+ m_graph.GetClientRect(r);
+ r2 = r;
+ r.bottom -= GRAPHFOOTER;
+ r2.top = r.bottom;
+
+ if(r.PtInRect(p))
+ {
+ SetCapture();
+
+ int x = p.x - r.left;
+ int y = r.bottom - p.y;
+
+ REFERENCE_TIME rt = m_rtDur * x / r.Width();
+ int chunk = (int)(1.0 * m_nChunks * y / r.Height());
+
+ rt /= 10000;
+ int ms = (int)(rt%1000);
+ rt /= 1000;
+ int s = (int)(rt%60);
+ rt /= 60;
+ int m = (int)(rt%60);
+ rt /= 60;
+ int h = (int)(rt);
+
+ CString str;
+ str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
+ SetWindowText(str);
+ }
+ else if(r2.PtInRect(p))
+ {
+ SetCapture();
+
+ int dist = m_graph.GetChunkDist(p.x - r2.left);
+ CString str;
+ str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
+ if(dist >= 1000) str += _T(" - over the limit!");
+ str += ")";
+ SetWindowText(str);
+ }
+ else if(GetCapture() == this)
+ {
+ SetWindowText(TITLE);
+
+ ReleaseCapture();
+ }
+
+ __super::OnMouseMove(nFlags, p);
}
//////////////
@@ -176,187 +176,169 @@ CAviPlotterWnd::CAviPlotterWnd()
bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
{
- if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE, r, pParentWnd, 0))
- return(false);
-
- GetClientRect(r);
- int w = r.Width();
- int h = r.Height() - GRAPHFOOTER;
-
- CDC* pDC = GetDC();
- m_dc.CreateCompatibleDC(pDC);
- m_bm.CreateCompatibleBitmap(pDC, r.Width(), r.Height());
- ReleaseDC(pDC);
-
- CBitmap* pOldBitmap = m_dc.SelectObject(&m_bm);
-
- m_dc.FillSolidRect(r, 0);
-
- {
- CPen pen(PS_DOT, 1, 0x008000);
- CPen* pOldPen = m_dc.SelectObject(&pen);
- for(int y = 0, dy = max(h / 10, 1); y < h; y += dy)
- {
- if(y == 0) continue;
- m_dc.MoveTo(0, y);
- m_dc.LineTo(w, y);
- }
- for(int x = 0, dx = max(w / 10, 1); x < w; x += dx)
- {
- if(x == 0) continue;
- m_dc.MoveTo(x, 0);
- m_dc.LineTo(x, w);
- }
- m_dc.SelectObject(pOldPen);
- }
-
- {
- CPen pen(PS_SOLID, 1, 0x00ff00);
- CPen* pOldPen = m_dc.SelectObject(&pen);
- m_dc.MoveTo(15, 30);
- m_dc.LineTo(15, 2);
- m_dc.LineTo(19, 10);
- m_dc.LineTo(11, 10);
- m_dc.LineTo(15, 2);
- m_dc.MoveTo(w - 30 - 10, h - 15);
- m_dc.LineTo(w - 2 - 10, h - 15);
- m_dc.LineTo(w - 10 - 10, h - 19);
- m_dc.LineTo(w - 10 - 10, h - 11);
- m_dc.LineTo(w - 2 - 10, h - 15);
- m_dc.SelectObject(pOldPen);
-
- m_dc.SetTextColor(0x008000);
- m_dc.TextOut(20, 10, _T("Chunk"));
-
- CSize size = m_dc.GetTextExtent(_T("Time"));
- m_dc.TextOut(w - size.cx - 10, h - size.cy - 20, _T("Time"));
- }
-
- COLORREF clr[] = {0x0000ff, 0xff0000, 0x40ffff, 0xff40ff, 0xffff40, 0xffffff};
-
- for(int i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < (int)pAF->m_avih.dwStreams; i++, y += dy)
- {
- m_dc.SetTextColor(clr[i%pAF->m_avih.dwStreams]);
- m_dc.SetBkMode(TRANSPARENT);
- CString str;
- str.Format(_T("Stream %d"), i);
- m_dc.TextOut(10, y, str);
- }
-
- DWORD nmax = 0, tmax = 0;
-
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
- {
- int cnt = pAF->m_strms[i]->cs2.GetCount();
- if(cnt <= 0) continue;
- CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
- nmax = max(nmax, c2.n);
- tmax = max(tmax, c2.t);
- }
-
- if(nmax > 0 && tmax > 0)
- {
- CAtlArray<CPen> pen;
- pen.SetCount(pAF->m_avih.dwStreams);
- for(int i = 0; i < pen.GetCount(); i++)
- pen[i].CreatePen(PS_SOLID, 2, clr[i]);
-
- CAtlArray<CPoint> pp;
- pp.SetCount(pAF->m_avih.dwStreams);
- for(int i = 0; i < pen.GetCount(); i++)
- pp[i].SetPoint(-1, -1);
-
- m_chunkdist.SetCount(w);
- memset(m_chunkdist.GetData(), 0, sizeof(int)*w);
-
- DWORD* curchunks = DNew DWORD[pAF->m_avih.dwStreams];
- memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
-
- CAviFile::strm_t::chunk2 cs2last = { -1, 0};
-
- while(1)
- {
- CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
-
- int n = -1;
- for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
- {
- int curchunk = curchunks[i];
- if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) continue;
- CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
- if(cs2.t < cs2min.t)
- {
- cs2min = cs2;
- n = i;
- }
- }
- if(n == -1) break;
-
-
- CPoint p;
- p.x = (int)(1.0 * w * cs2min.t / tmax);
- p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
- if(pp[n] != p)
- {
- CPen* pOldPen = m_dc.SelectObject(&pen[n]);
- if(pp[n] == CPoint(-1, -1)) m_dc.MoveTo(p);
- else
- {
- m_dc.MoveTo(pp[n]);
- m_dc.LineTo(p);
- }
- m_dc.SelectObject(pOldPen);
- pp[n] = p;
- }
-
- int dist = abs((int)cs2min.n - (int)cs2last.n);
-
- if(cs2last.t >= 0 /*&& dist >= 1000*/)
- {
- if(p.x >= 0 && p.x < w)
- {
- m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
- }
- }
-
- curchunks[n]++;
- cs2last = cs2min;
- }
-
- CPen red(PS_SOLID, 1, 0x0000ff);
- CPen green(PS_SOLID, 1, 0x00ff00);
-
- for(int x = 0; x < w; x++)
- {
- CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
- m_dc.MoveTo(x, h);
- m_dc.LineTo(x, h + GRAPHFOOTER);
- m_dc.SelectObject(pOldPen);
- }
-
- delete [] curchunks;
- }
-
- m_dc.SelectObject(pOldBitmap);
-
- return(true);
+ if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0))
+ return(false);
+
+ GetClientRect(r);
+ int w = r.Width();
+ int h = r.Height() - GRAPHFOOTER;
+
+ CDC* pDC = GetDC();
+ m_dc.CreateCompatibleDC(pDC);
+ m_bm.CreateCompatibleBitmap(pDC, r.Width(), r.Height());
+ ReleaseDC(pDC);
+
+ CBitmap* pOldBitmap = m_dc.SelectObject(&m_bm);
+
+ m_dc.FillSolidRect(r, 0);
+
+ {
+ CPen pen(PS_DOT, 1, 0x008000);
+ CPen* pOldPen = m_dc.SelectObject(&pen);
+ for(int y = 0, dy = max(h/10,1); y < h; y += dy) {if(y == 0) continue; m_dc.MoveTo(0, y); m_dc.LineTo(w, y);}
+ for(int x = 0, dx = max(w/10,1); x < w; x += dx) {if(x == 0) continue; m_dc.MoveTo(x, 0); m_dc.LineTo(x, w);}
+ m_dc.SelectObject(pOldPen);
+ }
+
+ {
+ CPen pen(PS_SOLID, 1, 0x00ff00);
+ CPen* pOldPen = m_dc.SelectObject(&pen);
+ m_dc.MoveTo(15, 30);
+ m_dc.LineTo(15, 2);
+ m_dc.LineTo(19, 10);
+ m_dc.LineTo(11, 10);
+ m_dc.LineTo(15, 2);
+ m_dc.MoveTo(w-30-10, h-15);
+ m_dc.LineTo(w-2-10, h-15);
+ m_dc.LineTo(w-10-10, h-19);
+ m_dc.LineTo(w-10-10, h-11);
+ m_dc.LineTo(w-2-10, h-15);
+ m_dc.SelectObject(pOldPen);
+
+ m_dc.SetTextColor(0x008000);
+ m_dc.TextOut(20, 10, _T("Chunk"));
+
+ CSize size = m_dc.GetTextExtent(_T("Time"));
+ m_dc.TextOut(w - size.cx - 10, h - size.cy - 20, _T("Time"));
+ }
+
+ COLORREF clr[] = {0x0000ff,0xff0000,0x40ffff,0xff40ff,0xffff40,0xffffff};
+
+ for(int i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < (int)pAF->m_avih.dwStreams; i++, y += dy)
+ {
+ m_dc.SetTextColor(clr[i%pAF->m_avih.dwStreams]);
+ m_dc.SetBkMode(TRANSPARENT);
+ CString str;
+ str.Format(_T("Stream %d"), i);
+ m_dc.TextOut(10, y, str);
+ }
+
+ DWORD nmax = 0, tmax = 0;
+
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int cnt = pAF->m_strms[i]->cs2.GetCount();
+ if(cnt <= 0) continue;
+ CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
+ nmax = max(nmax, c2.n);
+ tmax = max(tmax, c2.t);
+ }
+
+ if(nmax > 0 && tmax > 0)
+ {
+ CAtlArray<CPen> pen;
+ pen.SetCount(pAF->m_avih.dwStreams);
+ for(int i = 0; i < pen.GetCount(); i++)
+ pen[i].CreatePen(PS_SOLID, 2, clr[i]);
+
+ CAtlArray<CPoint> pp;
+ pp.SetCount(pAF->m_avih.dwStreams);
+ for(int i = 0; i < pen.GetCount(); i++)
+ pp[i].SetPoint(-1, -1);
+
+ m_chunkdist.SetCount(w);
+ memset(m_chunkdist.GetData(), 0, sizeof(int)*w);
+
+ DWORD* curchunks = DNew DWORD[pAF->m_avih.dwStreams];
+ memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
+
+ CAviFile::strm_t::chunk2 cs2last = {-1, 0};
+
+ while(1)
+ {
+ CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
+
+ int n = -1;
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) continue;
+ CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
+ if(cs2.t < cs2min.t) {cs2min = cs2; n = i;}
+ }
+ if(n == -1) break;
+
+
+ CPoint p;
+ p.x = (int)(1.0 * w * cs2min.t / tmax);
+ p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
+ if(pp[n] != p)
+ {
+ CPen* pOldPen = m_dc.SelectObject(&pen[n]);
+ if(pp[n] == CPoint(-1, -1)) m_dc.MoveTo(p);
+ else {m_dc.MoveTo(pp[n]); m_dc.LineTo(p);}
+ m_dc.SelectObject(pOldPen);
+ pp[n] = p;
+ }
+
+ int dist = abs((int)cs2min.n - (int)cs2last.n);
+
+ if(cs2last.t >= 0 /*&& dist >= 1000*/)
+ {
+ if(p.x >= 0 && p.x < w)
+ {
+ m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
+ }
+ }
+
+ curchunks[n]++;
+ cs2last = cs2min;
+ }
+
+ CPen red(PS_SOLID, 1, 0x0000ff);
+ CPen green(PS_SOLID, 1, 0x00ff00);
+
+ for(int x = 0; x < w; x++)
+ {
+ CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
+ m_dc.MoveTo(x, h);
+ m_dc.LineTo(x, h + GRAPHFOOTER);
+ m_dc.SelectObject(pOldPen);
+ }
+
+ delete [] curchunks;
+ }
+
+ m_dc.SelectObject(pOldBitmap);
+
+ return(true);
}
IMPLEMENT_DYNCREATE(CAviPlotterWnd, CWnd)
BEGIN_MESSAGE_MAP(CAviPlotterWnd, CWnd)
- ON_WM_PAINT()
+ ON_WM_PAINT()
END_MESSAGE_MAP()
void CAviPlotterWnd::OnPaint()
{
- CPaintDC dc(this); // device context for painting
+ CPaintDC dc(this); // device context for painting
- CRect r;
- GetClientRect(r);
+ CRect r;
+ GetClientRect(r);
- CBitmap* pOld = m_dc.SelectObject(&m_bm);
- dc.BitBlt(0, 0, r.Width(), r.Height(), &m_dc, 0, 0, SRCCOPY);
- m_dc.SelectObject(pOld);
+ CBitmap* pOld = m_dc.SelectObject(&m_bm);
+ dc.BitBlt(0, 0, r.Width(), r.Height(), &m_dc, 0, 0, SRCCOPY);
+ m_dc.SelectObject(pOld);
}
diff --git a/src/filters/parser/AviSplitter/AviReportWnd.h b/src/filters/parser/AviSplitter/AviReportWnd.h
index cd30807e0..cd5c3b331 100644
--- a/src/filters/parser/AviSplitter/AviReportWnd.h
+++ b/src/filters/parser/AviSplitter/AviReportWnd.h
@@ -4,47 +4,44 @@
class CAviPlotterWnd : public CStatic
{
- DECLARE_DYNCREATE(CAviPlotterWnd)
+ DECLARE_DYNCREATE(CAviPlotterWnd)
private:
- CDC m_dc;
- CBitmap m_bm;
+ CDC m_dc;
+ CBitmap m_bm;
- CAtlArray<int> m_chunkdist;
+ CAtlArray<int> m_chunkdist;
public:
- CAviPlotterWnd();
- bool Create(CAviFile* pAF, CRect r, CWnd* pParentWnd);
+ CAviPlotterWnd();
+ bool Create(CAviFile* pAF, CRect r, CWnd* pParentWnd);
- int GetChunkDist(int x)
- {
- return x >= 0 && x < m_chunkdist.GetCount() ? m_chunkdist[x] : 0;
- }
+ int GetChunkDist(int x) {return x >= 0 && x < m_chunkdist.GetCount() ? m_chunkdist[x] : 0;}
- DECLARE_MESSAGE_MAP()
- afx_msg void OnPaint();
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnPaint();
};
class CAviReportWnd : public CWnd
{
- DECLARE_DYNCREATE(CAviReportWnd)
+ DECLARE_DYNCREATE(CAviReportWnd)
protected:
- CFont m_font;
- CStatic m_message;
- CButton m_checkbox;
- CAviPlotterWnd m_graph;
+ CFont m_font;
+ CStatic m_message;
+ CButton m_checkbox;
+ CAviPlotterWnd m_graph;
- int m_nChunks;
- REFERENCE_TIME m_rtDur;
+ int m_nChunks;
+ REFERENCE_TIME m_rtDur;
public:
- CAviReportWnd();
- bool DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText);
+ CAviReportWnd();
+ bool DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText);
- DECLARE_MESSAGE_MAP()
- afx_msg void OnClose();
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnClose();
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
};
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp
index a34593187..d31561221 100644
--- a/src/filters/parser/AviSplitter/AviSplitter.cpp
+++ b/src/filters/parser/AviSplitter/AviSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,8 +29,8 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -41,39 +41,39 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CAviSplitterFilter), L"MPC - Avi Splitter", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CAviSourceFilter), L"MPC - Avi Source", MERIT_NORMAL + 1, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CAviSplitterFilter), L"MPC - Avi Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CAviSourceFilter), L"MPC - Avi Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAviSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CAviSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAviSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CAviSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- CAtlList<CString> chkbytes;
- chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920")); // 'RIFF' ... 'AVI '
- chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958")); // 'RIFF' ... 'AVIX'
- chkbytes.AddTail(_T("0,4,,52494646,8,4,,414D5620")); // 'RIFF' ... 'AMV '
-
- RegisterSourceFilter(
- CLSID_AsyncReader,
- MEDIASUBTYPE_Avi,
- chkbytes,
- _T(".avi"), _T(".divx"), _T(".vp6"), _T(".amv"), NULL);
-
- return AMovieDllRegisterServer2(TRUE);
+ CAtlList<CString> chkbytes;
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920")); // 'RIFF' ... 'AVI '
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958")); // 'RIFF' ... 'AVIX'
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,414D5620")); // 'RIFF' ... 'AMV '
+
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Avi,
+ chkbytes,
+ _T(".avi"), _T(".divx"), _T(".vp6"), _T(".amv"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
// UnRegisterSourceFilter(MEDIASUBTYPE_Avi);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
@@ -81,27 +81,27 @@ extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
class CAviSplitterApp : public CWinApp
{
public:
- CAviSplitterApp() {}
-
- BOOL InitInstance()
- {
- if(!__super::InitInstance()) return FALSE;
- DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
- return TRUE;
- }
-
- BOOL ExitInstance()
- {
- DllEntryPoint(m_hInstance, DLL_PROCESS_DETACH, 0);
- return __super::ExitInstance();
- }
-
- void SetDefaultRegistryKey()
- {
- SetRegistryKey(_T("Gabest"));
- }
-
- DECLARE_MESSAGE_MAP()
+ CAviSplitterApp() {}
+
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+ DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
+ return TRUE;
+ }
+
+ BOOL ExitInstance()
+ {
+ DllEntryPoint(m_hInstance, DLL_PROCESS_DETACH, 0);
+ return __super::ExitInstance();
+ }
+
+ void SetDefaultRegistryKey()
+ {
+ SetRegistryKey(_T("Gabest"));
+ }
+
+ DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CAviSplitterApp, CWinApp)
@@ -116,737 +116,709 @@ CAviSplitterApp theApp;
//
CAviSplitterFilter::CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this))
- , m_timeformat(TIME_FORMAT_MEDIA_TIME)
+ : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this))
+ , m_timeformat(TIME_FORMAT_MEDIA_TIME)
{
}
STDMETHODIMP CAviSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- *ppv = NULL;
+ *ppv = NULL;
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
+ CheckPointer(pAsyncReader, E_POINTER);
- HRESULT hr = E_FAIL;
+ HRESULT hr = E_FAIL;
- m_pFile.Free();
- m_tFrame.Free();
+ m_pFile.Free();
+ m_tFrame.Free();
- m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
+ m_pFile.Attach(DNew CAviFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
- bool fShiftDown = !!(::GetKeyState(VK_SHIFT) & 0x8000);
- bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
+ bool fShiftDown = !!(::GetKeyState(VK_SHIFT)&0x8000);
+ bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
- if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown))
- {
+ if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown))
+ {
#ifdef REGISTER_FILTER
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
- bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
-
- if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown)
- {
- CAviReportWnd wnd;
- fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
- AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
- }
-
- if(fShowWarningText) hr = E_FAIL;
- }
-
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetTotalTime();
-
- bool fHasIndex = false;
-
- for(DWORD i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); i++)
- if(m_pFile->m_strms[i]->cs.GetCount() > 0)
- fHasIndex = true;
-
- for(DWORD i = 0; i < m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
-
- if(fHasIndex && s->cs.GetCount() == 0) continue;
-
- CMediaType mt;
- CAtlArray<CMediaType> mts;
-
- CStringW name, label;
-
- if(s->strh.fccType == FCC('vids'))
- {
- label = L"Video";
-
- ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
-
- BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap(pbmi->biCompression);
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
- if(s->strh.dwRate > 0) pvih->AvgTimePerFrame = 10000000i64 * s->strh.dwScale / s->strh.dwRate;
- switch(pbmi->biCompression)
- {
- case BI_RGB:
- case BI_BITFIELDS:
- mt.subtype =
- pbmi->biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
- pbmi->biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
- pbmi->biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
- pbmi->biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
- pbmi->biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
- pbmi->biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
- MEDIASUBTYPE_NULL;
- break;
+ bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
+
+ if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown)
+ {
+ CAviReportWnd wnd;
+ fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
+ AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
+ }
+
+ if(fShowWarningText) hr = E_FAIL;
+ }
+
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetTotalTime();
+
+ bool fHasIndex = false;
+
+ for(DWORD i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); i++)
+ if(m_pFile->m_strms[i]->cs.GetCount() > 0)
+ fHasIndex = true;
+
+ for(DWORD i = 0; i < m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+
+ if(fHasIndex && s->cs.GetCount() == 0) continue;
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ CStringW name, label;
+
+ if(s->strh.fccType == FCC('vids'))
+ {
+ label = L"Video";
+
+ ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
+
+ BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(pbmi->biCompression);
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
+ if(s->strh.dwRate > 0) pvih->AvgTimePerFrame = 10000000i64 * s->strh.dwScale / s->strh.dwRate;
+ switch(pbmi->biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pbmi->biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pbmi->biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pbmi->biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pbmi->biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pbmi->biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pbmi->biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
// case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
- }
-
- if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0)
- {
- __int64 size = 0;
- for(int i = 0; i < s->cs.GetCount(); i++)
- size += s->cs[i].orgsize;
- pvih->dwBitRate = size * 8 / s->cs.GetCount() * 10000000i64 / pvih->AvgTimePerFrame;
- }
-
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (pvih->bmiHeader.biWidth * pvih->bmiHeader.biHeight * 4));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva'))
- {
- label = L"Audio";
-
- ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
- || s->strf.GetCount() == sizeof(PCMWAVEFORMAT));
+ }
+
+ if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0)
+ {
+ __int64 size = 0;
+ for(int i = 0; i < s->cs.GetCount(); i++)
+ size += s->cs[i].orgsize;
+ pvih->dwBitRate = size*8 / s->cs.GetCount() * 10000000i64 / pvih->AvgTimePerFrame;
+ }
+
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (pvih->bmiHeader.biWidth*pvih->bmiHeader.biHeight*4));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('auds') || s->strh.fccType == FCC('amva'))
+ {
+ label = L"Audio";
+
+ ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
+ || s->strf.GetCount() == sizeof(PCMWAVEFORMAT));
WAVEFORMATEX* pwfe = (WAVEFORMATEX*)s->strf.GetData();
- if(pwfe->nBlockAlign == 0) continue;
-
- mt.majortype = MEDIATYPE_Audio;
- if(m_pFile->m_isamv)
- mt.subtype = FOURCCMap(MAKEFOURCC('A', 'M', 'V', 'A'));
- else
- mt.subtype = FOURCCMap(pwfe->wFormatTag);
- mt.formattype = FORMAT_WaveFormatEx;
- mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
- pwfe = (WAVEFORMATEX*)mt.Format();
- if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) pwfe->cbSize = 0;
- if(pwfe->wFormatTag == WAVE_FORMAT_PCM) pwfe->nBlockAlign = pwfe->nChannels * pwfe->wBitsPerSample >> 3;
- if(pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) mt.subtype = FOURCCMap(WAVE_FORMAT_PCM); // audio renderer doesn't accept fffe in the subtype
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (pwfe->nChannels * pwfe->nSamplesPerSec * 32 >> 3));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('mids'))
- {
- label = L"Midi";
-
- mt.majortype = MEDIATYPE_Midi;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (1024 * 1024));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('txts'))
- {
- label = L"Text";
-
- mt.majortype = MEDIATYPE_Text;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (1024 * 1024));
- mts.Add(mt);
- }
- else if(s->strh.fccType == FCC('iavs'))
- {
- label = L"Interleaved";
-
- ASSERT(s->strh.fccHandler == FCC('dvsd'));
-
- mt.majortype = MEDIATYPE_Interleaved;
- mt.subtype = FOURCCMap(s->strh.fccHandler);
- mt.formattype = FORMAT_DvInfo;
- mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(DVINFO)));
- mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
- ? s->strh.dwSuggestedBufferSize * 3 / 2
- : (1024 * 1024));
- mts.Add(mt);
- }
-
- if(mts.IsEmpty())
- {
- TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
- continue;
- }
-
- //Put filename at front sometime(eg. ~temp.avi) will cause filter graph
- //stop check this pin. Not sure the reason exactly. but it happens.
- //If you know why, please emailto: tomasen@gmail.com
- if(s->strn.IsEmpty())
- name.Format(L"%s %d", label , i);
- else
- name.Format(L"%s %d %s", label , i , CStringW(s->strn));
-
- HRESULT hr;
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CAviSplitterOutputPin(mts, name, this, this, &hr));
- AddOutputPin(i, pPinOut);
- }
-
- POSITION pos = m_pFile->m_info.GetStartPosition();
- while(pos)
- {
- DWORD fcc;
- CStringA value;
- m_pFile->m_info.GetNextAssoc(pos, fcc, value);
+ if(pwfe->nBlockAlign == 0) continue;
+
+ mt.majortype = MEDIATYPE_Audio;
+ if (m_pFile->m_isamv)
+ mt.subtype = FOURCCMap(MAKEFOURCC('A','M','V','A'));
+ else
+ mt.subtype = FOURCCMap(pwfe->wFormatTag);
+ mt.formattype = FORMAT_WaveFormatEx;
+ mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
+ pwfe = (WAVEFORMATEX*)mt.Format();
+ if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) pwfe->cbSize = 0;
+ if(pwfe->wFormatTag == WAVE_FORMAT_PCM) pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
+ if(pwfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE) mt.subtype = FOURCCMap(WAVE_FORMAT_PCM); // audio renderer doesn't accept fffe in the subtype
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (pwfe->nChannels*pwfe->nSamplesPerSec*32>>3));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('mids'))
+ {
+ label = L"Midi";
+
+ mt.majortype = MEDIATYPE_Midi;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('txts'))
+ {
+ label = L"Text";
+
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('iavs'))
+ {
+ label = L"Interleaved";
+
+ ASSERT(s->strh.fccHandler == FCC('dvsd'));
+
+ mt.majortype = MEDIATYPE_Interleaved;
+ mt.subtype = FOURCCMap(s->strh.fccHandler);
+ mt.formattype = FORMAT_DvInfo;
+ mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(DVINFO)));
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
+ continue;
+ }
+
+ //Put filename at front sometime(eg. ~temp.avi) will cause filter graph
+ //stop check this pin. Not sure the reason exactly. but it happens.
+ //If you know why, please emailto: tomasen@gmail.com
+ if(s->strn.IsEmpty())
+ name.Format(L"%s %d", label , i);
+ else
+ name.Format(L"%s %d %s", label , i , CStringW(s->strn) );
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CAviSplitterOutputPin(mts, name, this, this, &hr));
+ AddOutputPin(i, pPinOut);
+ }
+
+ POSITION pos = m_pFile->m_info.GetStartPosition();
+ while(pos)
+ {
+ DWORD fcc;
+ CStringA value;
+ m_pFile->m_info.GetNextAssoc(pos, fcc, value);
switch(fcc)
- {
- case FCC('INAM'):
- SetProperty(L"TITL", CStringW(value));
- break;
- case FCC('IART'):
- SetProperty(L"AUTH", CStringW(value));
- break;
- case FCC('ICOP'):
- SetProperty(L"CPYR", CStringW(value));
- break;
- case FCC('ISBJ'):
- SetProperty(L"DESC", CStringW(value));
- break;
- }
- }
-
- m_tFrame.Attach(DNew DWORD[m_pFile->m_avih.dwStreams]);
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ {
+ case FCC('INAM'): SetProperty(L"TITL", CStringW(value)); break;
+ case FCC('IART'): SetProperty(L"AUTH", CStringW(value)); break;
+ case FCC('ICOP'): SetProperty(L"CPYR", CStringW(value)); break;
+ case FCC('ISBJ'): SetProperty(L"DESC", CStringW(value)); break;
+ }
+ }
+
+ m_tFrame.Attach(DNew DWORD[m_pFile->m_avih.dwStreams]);
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CAviSplitterFilter::DemuxInit()
{
- if(!m_pFile) return(false);
+ if(!m_pFile) return(false);
- // reindex if needed
+ // reindex if needed
- bool fReIndex = false;
+ bool fReIndex = false;
- for(int i = 0; i < (int)m_pFile->m_avih.dwStreams && !fReIndex; i++)
- {
- if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i))
- fReIndex = true;
- }
+ for(int i = 0; i < (int)m_pFile->m_avih.dwStreams && !fReIndex; i++)
+ {
+ if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i))
+ fReIndex = true;
+ }
- if(fReIndex)
- {
- m_pFile->EmptyIndex();
+ if(fReIndex)
+ {
+ m_pFile->EmptyIndex();
- m_fAbort = false;
- m_nOpenProgress = 0;
+ m_fAbort = false;
+ m_nOpenProgress = 0;
- m_rtDuration = 0;
+ m_rtDuration = 0;
- CAutoVectorPtr<UINT64> pSize;
- pSize.Allocate(m_pFile->m_avih.dwStreams);
- memset((UINT64*)pSize, 0, sizeof(UINT64)*m_pFile->m_avih.dwStreams);
- m_pFile->Seek(0);
+ CAutoVectorPtr<UINT64> pSize;
+ pSize.Allocate(m_pFile->m_avih.dwStreams);
+ memset((UINT64*)pSize, 0, sizeof(UINT64)*m_pFile->m_avih.dwStreams);
+ m_pFile->Seek(0);
ReIndex(m_pFile->GetLength(), pSize);
- if(m_fAbort) m_pFile->EmptyIndex();
+ if(m_fAbort) m_pFile->EmptyIndex();
- m_fAbort = false;
- m_nOpenProgress = 100;
- }
+ m_fAbort = false;
+ m_nOpenProgress = 100;
+ }
- return(true);
+ return(true);
}
HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize)
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort)
- {
- __int64 pos = m_pFile->GetPos();
+ while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort)
+ {
+ __int64 pos = m_pFile->GetPos();
- DWORD id = 0, size;
- if(S_OK != m_pFile->Read(id) || id == 0)
- return E_FAIL;
+ DWORD id = 0, size;
+ if(S_OK != m_pFile->Read(id) || id == 0)
+ return E_FAIL;
- if(id == FCC('RIFF') || id == FCC('LIST'))
- {
- if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id))
- return E_FAIL;
+ if(id == FCC('RIFF') || id == FCC('LIST'))
+ {
+ if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id))
+ return E_FAIL;
- size += (size & 1) + 8;
+ size += (size&1) + 8;
- if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec '))
- hr = ReIndex(pos + size, pSize);
- }
- else
- {
- if(S_OK != m_pFile->Read(size))
- return E_FAIL;
+ if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec '))
+ hr = ReIndex(pos + size, pSize);
+ }
+ else
+ {
+ if(S_OK != m_pFile->Read(size))
+ return E_FAIL;
- DWORD TrackNumber = TRACKNUM(id);
+ DWORD TrackNumber = TRACKNUM(id);
- if(TrackNumber < m_pFile->m_strms.GetCount())
- {
- CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
+ if(TrackNumber < m_pFile->m_strms.GetCount())
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
- WORD type = TRACKTYPE(id);
+ WORD type = TRACKTYPE(id);
- if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
- || type == 'iv' || type == '__' || type == 'xx')
- {
- CAviFile::strm_t::chunk c;
- c.filepos = pos;
- c.size = pSize[TrackNumber];
- c.orgsize = size;
- c.fKeyFrame = size > 0; // TODO: find a better way...
- c.fChunkHdr = true;
- s->cs.Add(c);
+ if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
+ || type == 'iv' || type == '__' || type == 'xx')
+ {
+ CAviFile::strm_t::chunk c;
+ c.filepos = pos;
+ c.size = pSize[TrackNumber];
+ c.orgsize = size;
+ c.fKeyFrame = size > 0; // TODO: find a better way...
+ c.fChunkHdr = true;
+ s->cs.Add(c);
- pSize[TrackNumber] += s->GetChunkSize(size);
+ pSize[TrackNumber] += s->GetChunkSize(size);
- REFERENCE_TIME rt = s->GetRefTime(s->cs.GetCount() - 1, pSize[TrackNumber]);
- m_rtDuration = max(rt, m_rtDuration);
- }
- }
+ REFERENCE_TIME rt = s->GetRefTime(s->cs.GetCount()-1, pSize[TrackNumber]);
+ m_rtDuration = max(rt, m_rtDuration);
+ }
+ }
- size += (size & 1) + 8;
- }
+ size += (size&1) + 8;
+ }
- m_pFile->Seek(pos + size);
+ m_pFile->Seek(pos + size);
- m_nOpenProgress = m_pFile->GetPos() * 100 / m_pFile->GetLength();
+ m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
- DWORD cmd;
- if(CheckRequest(&cmd))
- {
- if(cmd == CMD_EXIT) m_fAbort = true;
- else Reply(S_OK);
- }
- }
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
- return hr;
+ return hr;
}
void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- memset((DWORD*)m_tFrame, 0, sizeof(DWORD)*m_pFile->m_avih.dwStreams);
- m_pFile->Seek(0);
-
- DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt / 10000));
-
- if(rt > 0)
- {
- UINT64 minfp = _I64_MAX;
-
- for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[j];
-
- int f = s->GetKeyFrame(rt);
- UINT64 fp = f >= 0 ? s->cs[f].filepos : m_pFile->GetLength();
-
- if(!s->IsRawSubtitleStream())
- minfp = min(minfp, fp);
- }
-
- for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[j];
-
- for(int i = 0; i < s->cs.GetCount(); i++)
- {
- CAviFile::strm_t::chunk& c = s->cs[i];
- if(c.filepos >= minfp)
- {
- m_tFrame[j] = i;
- break;
- }
- }
- }
-
- DbgLog((LOG_TRACE, 0, _T("minfp: %I64d"), minfp));
- }
+ memset((DWORD*)m_tFrame, 0, sizeof(DWORD)*m_pFile->m_avih.dwStreams);
+ m_pFile->Seek(0);
+
+ DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt/10000));
+
+ if(rt > 0)
+ {
+ UINT64 minfp = _I64_MAX;
+
+ for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[j];
+
+ int f = s->GetKeyFrame(rt);
+ UINT64 fp = f >= 0 ? s->cs[f].filepos : m_pFile->GetLength();
+
+ if(!s->IsRawSubtitleStream())
+ minfp = min(minfp, fp);
+ }
+
+ for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[j];
+
+ for(int i = 0; i < s->cs.GetCount(); i++)
+ {
+ CAviFile::strm_t::chunk& c = s->cs[i];
+ if(c.filepos >= minfp)
+ {
+ m_tFrame[j] = i;
+ break;
+ }
+ }
+ }
+
+ DbgLog((LOG_TRACE, 0, _T("minfp: %I64d"), minfp));
+ }
}
bool CAviSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
-
- int nTracks = (int)m_pFile->m_strms.GetCount();
-
- CAtlArray<BOOL> fDiscontinuity;
- fDiscontinuity.SetCount(nTracks);
- memset(fDiscontinuity.GetData(), 0, nTracks * sizeof(bool));
-
- while(SUCCEEDED(hr) && !CheckRequest(NULL))
- {
- int minTrack = nTracks;
- UINT64 minFilePos = _I64_MAX;
-
- for(int i = 0; i < nTracks; i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
-
- DWORD f = m_tFrame[i];
- if(f >= (DWORD)s->cs.GetCount()) continue;
-
- bool fUrgent = s->IsRawSubtitleStream();
-
- if(fUrgent || s->cs[f].filepos < minFilePos)
- {
- minTrack = i;
- minFilePos = s->cs[f].filepos;
- }
-
- if(fUrgent) break;
- }
-
- if(minTrack == nTracks)
- break;
-
- DWORD& f = m_tFrame[minTrack];
-
- do
- {
- CAviFile::strm_t* s = m_pFile->m_strms[minTrack];
-
- m_pFile->Seek(s->cs[f].filepos);
-
- DWORD size = 0;
-
- if(s->cs[f].fChunkHdr)
- {
- DWORD id = 0;
- if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
- || S_OK != m_pFile->Read(size))
- {
- fDiscontinuity[minTrack] = true;
- break;
- }
-
- UINT64 expectedsize = -1;
- expectedsize = f < (DWORD)s->cs.GetCount() - 1
- ? s->cs[f+1].size - s->cs[f].size
- : s->totalsize - s->cs[f].size;
-
- if(expectedsize != s->GetChunkSize(size))
- {
- fDiscontinuity[minTrack] = true;
- // ASSERT(0);
- break;
- }
- }
- else
- {
- size = s->cs[f].orgsize;
- }
-
- CAutoPtr<Packet> p(DNew Packet());
-
- p->TrackNumber = minTrack;
- p->bSyncPoint = (BOOL)s->cs[f].fKeyFrame;
- p->bDiscontinuity = fDiscontinuity[minTrack];
- p->rtStart = s->GetRefTime(f, s->cs[f].size);
- p->rtStop = s->GetRefTime(f + 1, f + 1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
-
- p->SetCount(size);
- if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount())))
- return(true); // break;
- /*
- DbgLog((LOG_TRACE, 0, _T("%d (%d): %I64d - %I64d, %I64d - %I64d (size = %d)"),
- minTrack, (int)p->bSyncPoint,
- (p->rtStart)/10000, (p->rtStop)/10000,
- (p->rtStart-m_rtStart)/10000, (p->rtStop-m_rtStart)/10000,
- size));
- */
- hr = DeliverPacket(p);
-
- fDiscontinuity[minTrack] = false;
- }
- while(0);
-
- f++;
- }
-
- return(true);
+ HRESULT hr = S_OK;
+
+ int nTracks = (int)m_pFile->m_strms.GetCount();
+
+ CAtlArray<BOOL> fDiscontinuity;
+ fDiscontinuity.SetCount(nTracks);
+ memset(fDiscontinuity.GetData(), 0, nTracks*sizeof(bool));
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ int minTrack = nTracks;
+ UINT64 minFilePos = _I64_MAX;
+
+ for(int i = 0; i < nTracks; i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+
+ DWORD f = m_tFrame[i];
+ if(f >= (DWORD)s->cs.GetCount()) continue;
+
+ bool fUrgent = s->IsRawSubtitleStream();
+
+ if(fUrgent || s->cs[f].filepos < minFilePos)
+ {
+ minTrack = i;
+ minFilePos = s->cs[f].filepos;
+ }
+
+ if(fUrgent) break;
+ }
+
+ if(minTrack == nTracks)
+ break;
+
+ DWORD& f = m_tFrame[minTrack];
+
+ do
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[minTrack];
+
+ m_pFile->Seek(s->cs[f].filepos);
+
+ DWORD size = 0;
+
+ if(s->cs[f].fChunkHdr)
+ {
+ DWORD id = 0;
+ if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
+ || S_OK != m_pFile->Read(size))
+ {
+ fDiscontinuity[minTrack] = true;
+ break;
+ }
+
+ UINT64 expectedsize = -1;
+ expectedsize = f < (DWORD)s->cs.GetCount()-1
+ ? s->cs[f+1].size - s->cs[f].size
+ : s->totalsize - s->cs[f].size;
+
+ if(expectedsize != s->GetChunkSize(size))
+ {
+ fDiscontinuity[minTrack] = true;
+ // ASSERT(0);
+ break;
+ }
+ }
+ else
+ {
+ size = s->cs[f].orgsize;
+ }
+
+ CAutoPtr<Packet> p(DNew Packet());
+
+ p->TrackNumber = minTrack;
+ p->bSyncPoint = (BOOL)s->cs[f].fKeyFrame;
+ p->bDiscontinuity = fDiscontinuity[minTrack];
+ p->rtStart = s->GetRefTime(f, s->cs[f].size);
+ p->rtStop = s->GetRefTime(f+1, f+1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
+
+ p->SetCount(size);
+ if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount())))
+ return(true); // break;
+/*
+ DbgLog((LOG_TRACE, 0, _T("%d (%d): %I64d - %I64d, %I64d - %I64d (size = %d)"),
+ minTrack, (int)p->bSyncPoint,
+ (p->rtStart)/10000, (p->rtStop)/10000,
+ (p->rtStart-m_rtStart)/10000, (p->rtStop-m_rtStart)/10000,
+ size));
+*/
+ hr = DeliverPacket(p);
+
+ fDiscontinuity[minTrack] = false;
+ }
+ while(0);
+
+ f++;
+ }
+
+ return(true);
}
// IMediaSeeking
STDMETHODIMP CAviSplitterFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
-
- if(m_timeformat == TIME_FORMAT_FRAME)
- {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids'))
- {
- *pDuration = s->cs.GetCount();
- return S_OK;
- }
- }
-
- return E_UNEXPECTED;
- }
-
- return __super::GetDuration(pDuration);
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
+
+ if(m_timeformat == TIME_FORMAT_FRAME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ *pDuration = s->cs.GetCount();
+ return S_OK;
+ }
+ }
+
+ return E_UNEXPECTED;
+ }
+
+ return __super::GetDuration(pDuration);
}
//
STDMETHODIMP CAviSplitterFilter::IsFormatSupported(const GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- HRESULT hr = __super::IsFormatSupported(pFormat);
- if(S_OK == hr) return hr;
- return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
+ CheckPointer(pFormat, E_POINTER);
+ HRESULT hr = __super::IsFormatSupported(pFormat);
+ if(S_OK == hr) return hr;
+ return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
}
STDMETHODIMP CAviSplitterFilter::GetTimeFormat(GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- *pFormat = m_timeformat;
- return S_OK;
+ CheckPointer(pFormat, E_POINTER);
+ *pFormat = m_timeformat;
+ return S_OK;
}
STDMETHODIMP CAviSplitterFilter::IsUsingTimeFormat(const GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- return *pFormat == m_timeformat ? S_OK : S_FALSE;
+ CheckPointer(pFormat, E_POINTER);
+ return *pFormat == m_timeformat ? S_OK : S_FALSE;
}
STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat)
{
- CheckPointer(pFormat, E_POINTER);
- if(S_OK != IsFormatSupported(pFormat)) return E_FAIL;
- m_timeformat = *pFormat;
- return S_OK;
+ CheckPointer(pFormat, E_POINTER);
+ if(S_OK != IsFormatSupported(pFormat)) return E_FAIL;
+ m_timeformat = *pFormat;
+ return S_OK;
}
STDMETHODIMP CAviSplitterFilter::GetStopPosition(LONGLONG* pStop)
{
- CheckPointer(pStop, E_POINTER);
- if(FAILED(__super::GetStopPosition(pStop))) return E_FAIL;
- if(m_timeformat == TIME_FORMAT_MEDIA_TIME) return S_OK;
- LONGLONG rt = *pStop;
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
- return S_OK;
+ CheckPointer(pStop, E_POINTER);
+ if(FAILED(__super::GetStopPosition(pStop))) return E_FAIL;
+ if(m_timeformat == TIME_FORMAT_MEDIA_TIME) return S_OK;
+ LONGLONG rt = *pStop;
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ return S_OK;
}
STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
{
- CheckPointer(pTarget, E_POINTER);
-
- const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
- const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
-
- if(TargetFormat == SourceFormat)
- {
- *pTarget = Source;
- return S_OK;
- }
- else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME)
- {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids'))
- {
- *pTarget = s->GetFrame(Source);
- return S_OK;
- }
- }
- }
- else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME)
- {
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType == FCC('vids'))
- {
- if(Source < 0 || Source >= s->cs.GetCount()) return E_FAIL;
- CAviFile::strm_t::chunk& c = s->cs[(int)Source];
- *pTarget = s->GetRefTime((DWORD)Source, c.size);
- return S_OK;
- }
- }
- }
-
- return E_FAIL;
+ CheckPointer(pTarget, E_POINTER);
+
+ const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
+ const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
+
+ if(TargetFormat == SourceFormat)
+ {
+ *pTarget = Source;
+ return S_OK;
+ }
+ else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ *pTarget = s->GetFrame(Source);
+ return S_OK;
+ }
+ }
+ }
+ else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ if(Source < 0 || Source >= s->cs.GetCount()) return E_FAIL;
+ CAviFile::strm_t::chunk& c = s->cs[(int)Source];
+ *pTarget = s->GetRefTime((DWORD)Source, c.size);
+ return S_OK;
+ }
+ }
+ }
+
+ return E_FAIL;
}
STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
- HRESULT hr;
- if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME)
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME)
+ return hr;
- if(pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
- if(pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ if(pCurrent)
+ if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ if(pStop)
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
- return S_OK;
+ return S_OK;
}
HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- if(m_timeformat != TIME_FORMAT_FRAME)
- return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
-
- if(!pCurrent && !pStop
- || (dwCurrentFlags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
- && (dwStopFlags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
- return S_OK;
-
- REFERENCE_TIME
- rtCurrent = m_rtCurrent,
- rtStop = m_rtStop;
-
- if((dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- && FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME)))
- return E_FAIL;
- if((dwStopFlags & AM_SEEKING_PositioningBitsMask)
- && FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME)))
- return E_FAIL;
-
- if(pCurrent)
- switch(dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- {
- case AM_SEEKING_NoPositioning:
- break;
- case AM_SEEKING_AbsolutePositioning:
- rtCurrent = *pCurrent;
- break;
- case AM_SEEKING_RelativePositioning:
- rtCurrent = rtCurrent + *pCurrent;
- break;
- case AM_SEEKING_IncrementalPositioning:
- rtCurrent = rtCurrent + *pCurrent;
- break;
- }
-
- if(pStop)
- switch(dwStopFlags & AM_SEEKING_PositioningBitsMask)
- {
- case AM_SEEKING_NoPositioning:
- break;
- case AM_SEEKING_AbsolutePositioning:
- rtStop = *pStop;
- break;
- case AM_SEEKING_RelativePositioning:
- rtStop += *pStop;
- break;
- case AM_SEEKING_IncrementalPositioning:
- rtStop = rtCurrent + *pStop;
- break;
- }
-
- if((dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- && pCurrent)
- if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) return E_FAIL;
- if((dwStopFlags & AM_SEEKING_PositioningBitsMask)
- && pStop)
- if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) return E_FAIL;
-
- return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+ if(m_timeformat != TIME_FORMAT_FRAME)
+ return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+
+ if(!pCurrent && !pStop
+ || (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
+ && (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+ return S_OK;
+
+ REFERENCE_TIME
+ rtCurrent = m_rtCurrent,
+ rtStop = m_rtStop;
+
+ if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ && FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME)))
+ return E_FAIL;
+ if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ && FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME)))
+ return E_FAIL;
+
+ if(pCurrent)
+ switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtCurrent = *pCurrent; break;
+ case AM_SEEKING_RelativePositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ case AM_SEEKING_IncrementalPositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ }
+
+ if(pStop)
+ switch(dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtStop = *pStop; break;
+ case AM_SEEKING_RelativePositioning: rtStop += *pStop; break;
+ case AM_SEEKING_IncrementalPositioning: rtStop = rtCurrent + *pStop; break;
+ }
+
+ if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ && pCurrent)
+ if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) return E_FAIL;
+ if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ && pStop)
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) return E_FAIL;
+
+ return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
// IKeyFrameInfo
STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) return E_UNEXPECTED;
+ if(!m_pFile) return E_UNEXPECTED;
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- nKFs = 0;
+ nKFs = 0;
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) continue;
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType != FCC('vids')) continue;
- for(int j = 0; j < s->cs.GetCount(); j++)
- {
- CAviFile::strm_t::chunk& c = s->cs[j];
- if(c.fKeyFrame) nKFs++;
- }
+ for(int j = 0; j < s->cs.GetCount(); j++)
+ {
+ CAviFile::strm_t::chunk& c = s->cs[j];
+ if(c.fKeyFrame) nKFs++;
+ }
- if(nKFs == s->cs.GetCount())
- hr = S_FALSE;
+ if(nKFs == s->cs.GetCount())
+ hr = S_FALSE;
- break;
- }
+ break;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) return E_UNEXPECTED;
- if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) return E_INVALIDARG;
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) return E_INVALIDARG;
- UINT nKFsTmp = 0;
+ UINT nKFsTmp = 0;
- for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
- {
- CAviFile::strm_t* s = m_pFile->m_strms[i];
- if(s->strh.fccType != FCC('vids')) continue;
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType != FCC('vids')) continue;
- bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
+ bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
- for(int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; j++)
- {
- if(s->cs[j].fKeyFrame)
- pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
- }
+ for(int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; j++)
+ {
+ if(s->cs[j].fKeyFrame)
+ pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
+ }
- break;
- }
+ break;
+ }
- nKFs = nKFsTmp;
+ nKFs = nKFsTmp;
- return S_OK;
+ return S_OK;
}
//
@@ -854,10 +826,10 @@ STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
//
CAviSourceFilter::CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CAviSplitterFilter(pUnk, phr)
+ : CAviSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -865,29 +837,29 @@ CAviSourceFilter::CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
CAviSplitterOutputPin::CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
{
}
HRESULT CAviSplitterOutputPin::CheckConnect(IPin* pPin)
{
- int iPosition = 0;
- CMediaType mt;
- while(S_OK == GetMediaType(iPosition++, &mt))
- {
- if(mt.majortype == MEDIATYPE_Video
- && (mt.subtype == FOURCCMap(FCC('IV32'))
- || mt.subtype == FOURCCMap(FCC('IV31'))
- || mt.subtype == FOURCCMap(FCC('IF09'))))
- {
- CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
- if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer)
- return E_FAIL;
- }
-
- mt.InitMediaType();
- }
-
- return __super::CheckConnect(pPin);
+ int iPosition = 0;
+ CMediaType mt;
+ while(S_OK == GetMediaType(iPosition++, &mt))
+ {
+ if(mt.majortype == MEDIATYPE_Video
+ && (mt.subtype == FOURCCMap(FCC('IV32'))
+ || mt.subtype == FOURCCMap(FCC('IV31'))
+ || mt.subtype == FOURCCMap(FCC('IF09'))))
+ {
+ CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
+ if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer)
+ return E_FAIL;
+ }
+
+ mt.InitMediaType();
+ }
+
+ return __super::CheckConnect(pPin);
}
diff --git a/src/filters/parser/AviSplitter/AviSplitter.h b/src/filters/parser/AviSplitter/AviSplitter.h
index d8e59040b..f3e0c50cf 100644
--- a/src/filters/parser/AviSplitter/AviSplitter.h
+++ b/src/filters/parser/AviSplitter/AviSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,57 +30,57 @@ class CAviFile;
class CAviSplitterOutputPin : public CBaseSplitterOutputPin
{
public:
- CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- HRESULT CheckConnect(IPin* pPin);
+ HRESULT CheckConnect(IPin* pPin);
};
[uuid("9736D831-9D6C-4E72-B6E7-560EF9181001")]
class CAviSplitterFilter : public CBaseSplitterFilter
{
- CAutoVectorPtr<DWORD> m_tFrame;
+ CAutoVectorPtr<DWORD> m_tFrame;
protected:
- CAutoPtr<CAviFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CAviFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
- HRESULT ReIndex(__int64 end, UINT64* pSize);
+ HRESULT ReIndex(__int64 end, UINT64* pSize);
public:
- CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IMediaSeeking
+ // IMediaSeeking
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
- // TODO: this is too ugly, integrate this with the baseclass somehow
- GUID m_timeformat;
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ // TODO: this is too ugly, integrate this with the baseclass somehow
+ GUID m_timeformat;
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- // IKeyFrameInfo
+ // IKeyFrameInfo
- STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+ STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
};
[uuid("CEA8DEFF-0AF7-4DB9-9A38-FB3C3AEFC0DE")]
class CAviSourceFilter : public CAviSplitterFilter
{
public:
- CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/AviSplitter/resource.h b/src/filters/parser/AviSplitter/resource.h
index 80a8d5879..f29274003 100644
--- a/src/filters/parser/AviSplitter/resource.h
+++ b/src/filters/parser/AviSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by AviSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/AviSplitter/stdafx.cpp b/src/filters/parser/AviSplitter/stdafx.cpp
index 793af597c..c356f5dba 100644
--- a/src/filters/parser/AviSplitter/stdafx.cpp
+++ b/src/filters/parser/AviSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/AviSplitter/stdafx.h b/src/filters/parser/AviSplitter/stdafx.h
index ec6ed9d77..5f53f59b5 100644
--- a/src/filters/parser/AviSplitter/stdafx.h
+++ b/src/filters/parser/AviSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/BaseSplitter/AsyncReader.cpp b/src/filters/parser/BaseSplitter/AsyncReader.cpp
index 99161206f..2231aa440 100644
--- a/src/filters/parser/BaseSplitter/AsyncReader.cpp
+++ b/src/filters/parser/BaseSplitter/AsyncReader.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,205 +30,187 @@
// CAsyncFileReader
//
-CAsyncFileReader::CAsyncFileReader(CString fn, HRESULT& hr)
- : CUnknown(NAME("CAsyncFileReader"), NULL, &hr)
- , m_len(-1)
- , m_hBreakEvent(NULL)
- , m_lOsError(0)
+CAsyncFileReader::CAsyncFileReader(CString fn, HRESULT& hr)
+ : CUnknown(NAME("CAsyncFileReader"), NULL, &hr)
+ , m_len(-1)
+ , m_hBreakEvent(NULL)
+ , m_lOsError(0)
{
- hr = Open(fn, modeRead | shareDenyNone | typeBinary | osSequentialScan) ? S_OK : E_FAIL;
- if(SUCCEEDED(hr)) m_len = GetLength();
+ hr = Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
+ if(SUCCEEDED(hr)) m_len = GetLength();
}
-CAsyncFileReader::CAsyncFileReader(CAtlList<CHdmvClipInfo::PlaylistItem>& Items, HRESULT& hr)
- : CUnknown(NAME("CAsyncFileReader"), NULL, &hr)
- , m_len(-1)
- , m_hBreakEvent(NULL)
- , m_lOsError(0)
+CAsyncFileReader::CAsyncFileReader(CAtlList<CHdmvClipInfo::PlaylistItem>& Items, HRESULT& hr)
+ : CUnknown(NAME("CAsyncFileReader"), NULL, &hr)
+ , m_len(-1)
+ , m_hBreakEvent(NULL)
+ , m_lOsError(0)
{
- hr = OpenFiles(Items, modeRead | shareDenyNone | typeBinary | osSequentialScan) ? S_OK : E_FAIL;
- if(SUCCEEDED(hr)) m_len = GetLength();
+ hr = OpenFiles(Items, modeRead|shareDenyNone|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
+ if(SUCCEEDED(hr)) m_len = GetLength();
}
STDMETHODIMP CAsyncFileReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- QI(IAsyncReader)
- QI(ISyncReader)
- QI(IFileHandle)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IAsyncReader)
+ QI(ISyncReader)
+ QI(IFileHandle)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IAsyncReader
STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE* pBuffer)
{
- do
- {
- try
- {
- if(llPosition + lLength > GetLength()) return E_FAIL; // strange, but the Seek below can return llPosition even if the file is not that big (?)
- if(llPosition != Seek(llPosition, begin)) return E_FAIL;
- if((UINT)lLength < Read(pBuffer, lLength)) return E_FAIL;
+ do
+ {
+ try
+ {
+ if(llPosition+lLength > GetLength()) return E_FAIL; // strange, but the Seek below can return llPosition even if the file is not that big (?)
+ if(llPosition != Seek(llPosition, begin)) return E_FAIL;
+ if((UINT)lLength < Read(pBuffer, lLength)) return E_FAIL;
#if 0 // def DEBUG
- static __int64 s_total = 0, s_laststoppos = 0;
- s_total += lLength;
- if(s_laststoppos > llPosition)
- TRACE(_T("[%I64d - %I64d] %d (%I64d)\n"), llPosition, llPosition + lLength, lLength, s_total);
- s_laststoppos = llPosition + lLength;
+ static __int64 s_total = 0, s_laststoppos = 0;
+ s_total += lLength;
+ if(s_laststoppos > llPosition)
+ TRACE(_T("[%I64d - %I64d] %d (%I64d)\n"), llPosition, llPosition + lLength, lLength, s_total);
+ s_laststoppos = llPosition + lLength;
#endif
- return S_OK;
- }
- catch(CFileException* e)
- {
- m_lOsError = e->m_lOsError;
- e->Delete();
- Sleep(1);
- CString fn = m_strFileName;
- try
- {
- Close();
- }
- catch(CFileException* e)
- {
- e->Delete();
- }
- try
- {
- Open(fn, modeRead | shareDenyNone | typeBinary | osSequentialScan);
- }
- catch(CFileException* e)
- {
- e->Delete();
- }
- m_strFileName = fn;
- }
- }
- while(m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
-
- return E_FAIL;
+ return S_OK;
+ }
+ catch(CFileException* e)
+ {
+ m_lOsError = e->m_lOsError;
+ e->Delete();
+ Sleep(1);
+ CString fn = m_strFileName;
+ try {Close();} catch(CFileException* e) {e->Delete();}
+ try {Open(fn, modeRead|shareDenyNone|typeBinary|osSequentialScan);} catch(CFileException* e) {e->Delete();}
+ m_strFileName = fn;
+ }
+ }
+ while(m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
+
+ return E_FAIL;
}
STDMETHODIMP CAsyncFileReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
{
- LONGLONG len = m_len >= 0 ? m_len : GetLength();
- if(pTotal) *pTotal = len;
- if(pAvailable) *pAvailable = len;
- return S_OK;
+ LONGLONG len = m_len >= 0 ? m_len : GetLength();
+ if(pTotal) *pTotal = len;
+ if(pAvailable) *pAvailable = len;
+ return S_OK;
}
// IFileHandle
STDMETHODIMP_(HANDLE) CAsyncFileReader::GetFileHandle()
{
- return m_hFile;
+ return m_hFile;
}
STDMETHODIMP_(LPCTSTR) CAsyncFileReader::GetFileName()
{
- return m_nCurPart != -1 ? m_strFiles[m_nCurPart] : m_strFiles[0];
+ return m_nCurPart != -1 ? m_strFiles[m_nCurPart] : m_strFiles[0];
}
//
// CAsyncUrlReader
//
-CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr)
- : CAsyncFileReader(url, hr)
+CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr)
+ : CAsyncFileReader(url, hr)
{
- if(SUCCEEDED(hr)) return;
+ if(SUCCEEDED(hr)) return;
- m_url = url;
+ m_url = url;
- if(CAMThread::Create())
- CallWorker(CMD_INIT);
+ if(CAMThread::Create())
+ CallWorker(CMD_INIT);
- hr = Open(m_fn, modeRead | shareDenyRead | typeBinary | osSequentialScan) ? S_OK : E_FAIL;
- m_len = -1; // force GetLength() return actual length always
+ hr = Open(m_fn, modeRead|shareDenyRead|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
+ m_len = -1; // force GetLength() return actual length always
}
CAsyncUrlReader::~CAsyncUrlReader()
{
- if(ThreadExists())
- CallWorker(CMD_EXIT);
-
- if(!m_fn.IsEmpty())
- {
- CMultiFiles::Close();
- DeleteFile(m_fn);
- }
+ if(ThreadExists())
+ CallWorker(CMD_EXIT);
+
+ if(!m_fn.IsEmpty())
+ {
+ CMultiFiles::Close();
+ DeleteFile(m_fn);
+ }
}
// IAsyncReader
STDMETHODIMP CAsyncUrlReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
{
- if(pTotal) *pTotal = 0;
- return __super::Length(NULL, pAvailable);
+ if(pTotal) *pTotal = 0;
+ return __super::Length(NULL, pAvailable);
}
// CAMThread
DWORD CAsyncUrlReader::ThreadProc()
{
- AfxSocketInit(NULL);
-
- DWORD cmd = GetRequest();
- if(cmd != CMD_INIT)
- {
- Reply(E_FAIL);
- return E_FAIL;
- }
-
- try
- {
- CInternetSession is;
- CAutoPtr<CStdioFile> fin(is.OpenURL(m_url, 1, INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_CACHE_WRITE));
-
- TCHAR path[_MAX_PATH], fn[_MAX_PATH];
- CFile fout;
- if(GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
- && fout.Open(fn, modeCreate | modeWrite | shareDenyWrite | typeBinary))
- {
- m_fn = fn;
-
- char buff[1024];
- int len = fin->Read(buff, sizeof(buff));
- if(len > 0) fout.Write(buff, len);
-
- Reply(S_OK);
-
- while(!CheckRequest(&cmd))
- {
- int len = fin->Read(buff, sizeof(buff));
- if(len > 0) fout.Write(buff, len);
- }
- }
- else
- {
- Reply(E_FAIL);
- }
-
- fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
- }
- catch(CInternetException* ie)
- {
- ie->Delete();
- Reply(E_FAIL);
- }
-
- //
-
- cmd = GetRequest();
- ASSERT(cmd == CMD_EXIT);
- Reply(S_OK);
-
- //
-
- m_hThread = NULL;
-
- return S_OK;
+ AfxSocketInit(NULL);
+
+ DWORD cmd = GetRequest();
+ if(cmd != CMD_INIT) {Reply(E_FAIL); return E_FAIL;}
+
+ try
+ {
+ CInternetSession is;
+ CAutoPtr<CStdioFile> fin(is.OpenURL(m_url, 1, INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_NO_CACHE_WRITE));
+
+ TCHAR path[_MAX_PATH], fn[_MAX_PATH];
+ CFile fout;
+ if(GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
+ && fout.Open(fn, modeCreate|modeWrite|shareDenyWrite|typeBinary))
+ {
+ m_fn = fn;
+
+ char buff[1024];
+ int len = fin->Read(buff, sizeof(buff));
+ if(len > 0) fout.Write(buff, len);
+
+ Reply(S_OK);
+
+ while(!CheckRequest(&cmd))
+ {
+ int len = fin->Read(buff, sizeof(buff));
+ if(len > 0) fout.Write(buff, len);
+ }
+ }
+ else
+ {
+ Reply(E_FAIL);
+ }
+
+ fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
+ }
+ catch(CInternetException* ie)
+ {
+ ie->Delete();
+ Reply(E_FAIL);
+ }
+
+ //
+
+ cmd = GetRequest();
+ ASSERT(cmd == CMD_EXIT);
+ Reply(S_OK);
+
+ //
+
+ m_hThread = NULL;
+
+ return S_OK;
}
diff --git a/src/filters/parser/BaseSplitter/AsyncReader.h b/src/filters/parser/BaseSplitter/AsyncReader.h
index 8f9cdfcf0..d26552f0e 100644
--- a/src/filters/parser/BaseSplitter/AsyncReader.h
+++ b/src/filters/parser/BaseSplitter/AsyncReader.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,105 +24,73 @@
#include "MultiFiles.h"
[uuid("6DDB4EE7-45A0-4459-A508-BD77B32C91B2")]
-interface ISyncReader :
-public IUnknown
+interface ISyncReader : public IUnknown
{
- STDMETHOD_(void, SetBreakEvent)(HANDLE hBreakEvent) = 0;
- STDMETHOD_(bool, HasErrors)() = 0;
- STDMETHOD_(void, ClearErrors)() = 0;
- STDMETHOD_(void, SetPTSOffset)(REFERENCE_TIME* rtPTSOffset) = 0;
+ STDMETHOD_(void, SetBreakEvent) (HANDLE hBreakEvent) = 0;
+ STDMETHOD_(bool, HasErrors) () = 0;
+ STDMETHOD_(void, ClearErrors) () = 0;
+ STDMETHOD_(void, SetPTSOffset) (REFERENCE_TIME* rtPTSOffset) = 0;
};
[uuid("7D55F67A-826E-40B9-8A7D-3DF0CBBD272D")]
-interface IFileHandle :
-public IUnknown
+interface IFileHandle : public IUnknown
{
- STDMETHOD_(HANDLE, GetFileHandle)() = 0;
- STDMETHOD_(LPCTSTR, GetFileName)() = 0;
+ STDMETHOD_(HANDLE, GetFileHandle)() = 0;
+ STDMETHOD_(LPCTSTR, GetFileName)() = 0;
};
class CAsyncFileReader : public CUnknown, public CMultiFiles, public IAsyncReader, public ISyncReader, public IFileHandle
{
protected:
- ULONGLONG m_len;
- HANDLE m_hBreakEvent;
- LONG m_lOsError; // CFileException::m_lOsError
+ ULONGLONG m_len;
+ HANDLE m_hBreakEvent;
+ LONG m_lOsError; // CFileException::m_lOsError
public:
- CAsyncFileReader(CString fn, HRESULT& hr);
- CAsyncFileReader(CAtlList<CHdmvClipInfo::PlaylistItem>& Items, HRESULT& hr);
-
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
-
- // IAsyncReader
-
- STDMETHODIMP RequestAllocator(IMemAllocator* pPreferred, ALLOCATOR_PROPERTIES* pProps, IMemAllocator** ppActual)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP Request(IMediaSample* pSample, DWORD_PTR dwUser)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP WaitForNext(DWORD dwTimeout, IMediaSample** ppSample, DWORD_PTR* pdwUser)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP SyncReadAligned(IMediaSample* pSample)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP SyncRead(LONGLONG llPosition, LONG lLength, BYTE* pBuffer);
- STDMETHODIMP Length(LONGLONG* pTotal, LONGLONG* pAvailable);
- STDMETHODIMP BeginFlush()
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP EndFlush()
- {
- return E_NOTIMPL;
- }
-
- // ISyncReader
-
- STDMETHODIMP_(void) SetBreakEvent(HANDLE hBreakEvent)
- {
- m_hBreakEvent = hBreakEvent;
- }
- STDMETHODIMP_(bool) HasErrors()
- {
- return m_lOsError != 0;
- }
- STDMETHODIMP_(void) ClearErrors()
- {
- m_lOsError = 0;
- }
- STDMETHODIMP_(void) SetPTSOffset(REFERENCE_TIME* rtPTSOffset)
- {
- m_pCurrentPTSOffset = rtPTSOffset;
- };
-
- // IFileHandle
-
- STDMETHODIMP_(HANDLE) GetFileHandle();
- STDMETHODIMP_(LPCTSTR) GetFileName();
+ CAsyncFileReader(CString fn, HRESULT& hr);
+ CAsyncFileReader(CAtlList<CHdmvClipInfo::PlaylistItem>& Items, HRESULT& hr);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IAsyncReader
+
+ STDMETHODIMP RequestAllocator(IMemAllocator* pPreferred, ALLOCATOR_PROPERTIES* pProps, IMemAllocator** ppActual) {return E_NOTIMPL;}
+ STDMETHODIMP Request(IMediaSample* pSample, DWORD_PTR dwUser) {return E_NOTIMPL;}
+ STDMETHODIMP WaitForNext(DWORD dwTimeout, IMediaSample** ppSample, DWORD_PTR* pdwUser) {return E_NOTIMPL;}
+ STDMETHODIMP SyncReadAligned(IMediaSample* pSample) {return E_NOTIMPL;}
+ STDMETHODIMP SyncRead(LONGLONG llPosition, LONG lLength, BYTE* pBuffer);
+ STDMETHODIMP Length(LONGLONG* pTotal, LONGLONG* pAvailable);
+ STDMETHODIMP BeginFlush() {return E_NOTIMPL;}
+ STDMETHODIMP EndFlush() {return E_NOTIMPL;}
+
+ // ISyncReader
+
+ STDMETHODIMP_(void) SetBreakEvent(HANDLE hBreakEvent) {m_hBreakEvent = hBreakEvent;}
+ STDMETHODIMP_(bool) HasErrors() {return m_lOsError != 0;}
+ STDMETHODIMP_(void) ClearErrors() {m_lOsError = 0;}
+ STDMETHODIMP_(void) SetPTSOffset (REFERENCE_TIME* rtPTSOffset) { m_pCurrentPTSOffset = rtPTSOffset;};
+
+ // IFileHandle
+
+ STDMETHODIMP_(HANDLE) GetFileHandle();
+ STDMETHODIMP_(LPCTSTR) GetFileName();
};
class CAsyncUrlReader : public CAsyncFileReader, protected CAMThread
{
- CString m_url, m_fn;
+ CString m_url, m_fn;
protected:
- enum {CMD_EXIT, CMD_INIT};
+ enum {CMD_EXIT, CMD_INIT};
DWORD ThreadProc();
public:
- CAsyncUrlReader(CString url, HRESULT& hr);
- virtual ~CAsyncUrlReader();
+ CAsyncUrlReader(CString url, HRESULT& hr);
+ virtual ~CAsyncUrlReader();
- // IAsyncReader
+ // IAsyncReader
- STDMETHODIMP Length(LONGLONG* pTotal, LONGLONG* pAvailable);
+ STDMETHODIMP Length(LONGLONG* pTotal, LONGLONG* pAvailable);
};
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.cpp b/src/filters/parser/BaseSplitter/BaseSplitter.cpp
index 783230bb6..1a57ed507 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitter.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -43,57 +43,57 @@ CPacketQueue::CPacketQueue() : m_size(0)
void CPacketQueue::Add(CAutoPtr<Packet> p)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
+
+ if(p)
+ {
+ m_size += p->GetDataSize();
- if(p)
- {
- m_size += p->GetDataSize();
-
- if(p->bAppendable && !p->bDiscontinuity && !p->pmt
- && p->rtStart == Packet::INVALID_TIME
- && !IsEmpty() && GetTail()->rtStart != Packet::INVALID_TIME)
- {
- Packet* tail = GetTail();
- int oldsize = tail->GetCount();
- int newsize = tail->GetCount() + p->GetCount();
- tail->SetCount(newsize, max(1024, newsize)); // doubles the reserved buffer size
- memcpy(tail->GetData() + oldsize, p->GetData(), p->GetCount());
- /*
- GetTail()->Append(*p); // too slow
- */
- return;
- }
- }
-
- AddTail(p);
+ if(p->bAppendable && !p->bDiscontinuity && !p->pmt
+ && p->rtStart == Packet::INVALID_TIME
+ && !IsEmpty() && GetTail()->rtStart != Packet::INVALID_TIME)
+ {
+ Packet* tail = GetTail();
+ int oldsize = tail->GetCount();
+ int newsize = tail->GetCount() + p->GetCount();
+ tail->SetCount(newsize, max(1024, newsize)); // doubles the reserved buffer size
+ memcpy(tail->GetData() + oldsize, p->GetData(), p->GetCount());
+ /*
+ GetTail()->Append(*p); // too slow
+ */
+ return;
+ }
+ }
+
+ AddTail(p);
}
CAutoPtr<Packet> CPacketQueue::Remove()
{
- CAutoLock cAutoLock(this);
- ASSERT(__super::GetCount() > 0);
- CAutoPtr<Packet> p = RemoveHead();
- if(p) m_size -= p->GetDataSize();
- return p;
+ CAutoLock cAutoLock(this);
+ ASSERT(__super::GetCount() > 0);
+ CAutoPtr<Packet> p = RemoveHead();
+ if(p) m_size -= p->GetDataSize();
+ return p;
}
void CPacketQueue::RemoveAll()
{
- CAutoLock cAutoLock(this);
- m_size = 0;
- __super::RemoveAll();
+ CAutoLock cAutoLock(this);
+ m_size = 0;
+ __super::RemoveAll();
}
int CPacketQueue::GetCount()
{
- CAutoLock cAutoLock(this);
- return __super::GetCount();
+ CAutoLock cAutoLock(this);
+ return __super::GetCount();
}
int CPacketQueue::GetSize()
{
- CAutoLock cAutoLock(this);
- return m_size;
+ CAutoLock cAutoLock(this);
+ return m_size;
}
//
@@ -101,7 +101,7 @@ int CPacketQueue::GetSize()
//
CBaseSplitterInputPin::CBaseSplitterInputPin(TCHAR* pName, CBaseSplitterFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBasePin(pName, pFilter, pLock, phr, L"Input", PINDIR_INPUT)
+ : CBasePin(pName, pFilter, pLock, phr, L"Input", PINDIR_INPUT)
{
}
@@ -111,80 +111,80 @@ CBaseSplitterInputPin::~CBaseSplitterInputPin()
HRESULT CBaseSplitterInputPin::GetAsyncReader(IAsyncReader** ppAsyncReader)
{
- CheckPointer(ppAsyncReader, E_POINTER);
- *ppAsyncReader = NULL;
- CheckPointer(m_pAsyncReader, VFW_E_NOT_CONNECTED);
- (*ppAsyncReader = m_pAsyncReader)->AddRef();
- return S_OK;
+ CheckPointer(ppAsyncReader, E_POINTER);
+ *ppAsyncReader = NULL;
+ CheckPointer(m_pAsyncReader, VFW_E_NOT_CONNECTED);
+ (*ppAsyncReader = m_pAsyncReader)->AddRef();
+ return S_OK;
}
STDMETHODIMP CBaseSplitterInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CBaseSplitterInputPin::CheckMediaType(const CMediaType* pmt)
{
- return S_OK;
- /*
- return pmt->majortype == MEDIATYPE_Stream
- ? S_OK
- : E_INVALIDARG;
- */
+ return S_OK;
+/*
+ return pmt->majortype == MEDIATYPE_Stream
+ ? S_OK
+ : E_INVALIDARG;
+*/
}
HRESULT CBaseSplitterInputPin::CheckConnect(IPin* pPin)
{
- HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin)))
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = __super::CheckConnect(pPin)))
+ return hr;
- return CComQIPtr<IAsyncReader>(pPin) ? S_OK : E_NOINTERFACE;
+ return CComQIPtr<IAsyncReader>(pPin) ? S_OK : E_NOINTERFACE;
}
HRESULT CBaseSplitterInputPin::BreakConnect()
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::BreakConnect()))
- return hr;
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
- if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->BreakConnect(PINDIR_INPUT, this)))
- return hr;
+ if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->BreakConnect(PINDIR_INPUT, this)))
+ return hr;
- m_pAsyncReader.Release();
+ m_pAsyncReader.Release();
- return S_OK;
+ return S_OK;
}
HRESULT CBaseSplitterInputPin::CompleteConnect(IPin* pPin)
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin)))
- return hr;
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
- CheckPointer(pPin, E_POINTER);
- m_pAsyncReader = pPin;
- CheckPointer(m_pAsyncReader, E_NOINTERFACE);
+ CheckPointer(pPin, E_POINTER);
+ m_pAsyncReader = pPin;
+ CheckPointer(m_pAsyncReader, E_NOINTERFACE);
- if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this)))
- return hr;
+ if(FAILED(hr = (static_cast<CBaseSplitterFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this)))
+ return hr;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterInputPin::BeginFlush()
{
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
STDMETHODIMP CBaseSplitterInputPin::EndFlush()
{
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
//
@@ -192,26 +192,26 @@ STDMETHODIMP CBaseSplitterInputPin::EndFlush()
//
CBaseSplitterOutputPin::CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers)
- : CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
- , m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
- , m_fFlushing(false)
- , m_eEndFlush(TRUE)
+ : CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
+ , m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
+ , m_fFlushing(false)
+ , m_eEndFlush(TRUE)
{
- m_mts.Copy(mts);
- m_nBuffers = max(nBuffers, 1);
- memset(&m_brs, 0, sizeof(m_brs));
- m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+ m_mts.Copy(mts);
+ m_nBuffers = max(nBuffers, 1);
+ memset(&m_brs, 0, sizeof(m_brs));
+ m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
}
CBaseSplitterOutputPin::CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers)
- : CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
- , m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
- , m_fFlushing(false)
- , m_eEndFlush(TRUE)
+ : CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
+ , m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
+ , m_fFlushing(false)
+ , m_eEndFlush(TRUE)
{
- m_nBuffers = max(nBuffers, 1);
- memset(&m_brs, 0, sizeof(m_brs));
- m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+ m_nBuffers = max(nBuffers, 1);
+ memset(&m_brs, 0, sizeof(m_brs));
+ m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
}
CBaseSplitterOutputPin::~CBaseSplitterOutputPin()
@@ -220,26 +220,26 @@ CBaseSplitterOutputPin::~CBaseSplitterOutputPin()
STDMETHODIMP CBaseSplitterOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
-// riid == __uuidof(IMediaSeeking) ? m_pFilter->QueryInterface(riid, ppv) :
- QI(IMediaSeeking)
- QI(IPropertyBag)
- QI(IPropertyBag2)
- QI(IDSMPropertyBag)
- QI(IBitRateInfo)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+// riid == __uuidof(IMediaSeeking) ? m_pFilter->QueryInterface(riid, ppv) :
+ QI(IMediaSeeking)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ QI(IBitRateInfo)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CBaseSplitterOutputPin::SetName(LPCWSTR pName)
{
- CheckPointer(pName, E_POINTER);
- if(m_pName) delete [] m_pName;
- m_pName = DNew WCHAR[wcslen(pName)+1];
- CheckPointer(m_pName, E_OUTOFMEMORY);
- wcscpy(m_pName, pName);
- return S_OK;
+ CheckPointer(pName, E_POINTER);
+ if(m_pName) delete [] m_pName;
+ m_pName = DNew WCHAR[wcslen(pName)+1];
+ CheckPointer(m_pName, E_OUTOFMEMORY);
+ wcscpy(m_pName, pName);
+ return S_OK;
}
HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -249,14 +249,14 @@ HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATO
HRESULT hr = NOERROR;
- pProperties->cBuffers = m_nBuffers;
- pProperties->cbBuffer = max(m_mt.lSampleSize, 1);
+ pProperties->cBuffers = m_nBuffers;
+ pProperties->cbBuffer = max(m_mt.lSampleSize, 1);
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat)
- {
- // oh great, the oggds vorbis decoder assumes there will be two at least, stupid thing...
- pProperties->cBuffers = max(pProperties->cBuffers, 2);
- }
+ if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat)
+ {
+ // oh great, the oggds vorbis decoder assumes there will be two at least, stupid thing...
+ pProperties->cBuffers = max(pProperties->cBuffers, 2);
+ }
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -269,30 +269,30 @@ HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATO
HRESULT CBaseSplitterOutputPin::CheckMediaType(const CMediaType* pmt)
{
- for(int i = 0; i < m_mts.GetCount(); i++)
- {
- if(*pmt == m_mts[i])
- return S_OK;
- }
+ for(int i = 0; i < m_mts.GetCount(); i++)
+ {
+ if(*pmt == m_mts[i])
+ return S_OK;
+ }
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
HRESULT CBaseSplitterOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition >= m_mts.GetCount()) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= m_mts.GetCount()) return VFW_S_NO_MORE_ITEMS;
- *pmt = m_mts[iPosition];
+ *pmt = m_mts[iPosition];
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterOutputPin::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//
@@ -301,394 +301,393 @@ HRESULT CBaseSplitterOutputPin::Active()
{
CAutoLock cAutoLock(m_pLock);
- if(m_Connected)
- Create();
+ if(m_Connected)
+ Create();
- return __super::Active();
+ return __super::Active();
}
HRESULT CBaseSplitterOutputPin::Inactive()
{
CAutoLock cAutoLock(m_pLock);
- if(ThreadExists())
- CallWorker(CMD_EXIT);
+ if(ThreadExists())
+ CallWorker(CMD_EXIT);
- return __super::Inactive();
+ return __super::Inactive();
}
HRESULT CBaseSplitterOutputPin::DeliverBeginFlush()
{
- m_eEndFlush.Reset();
- m_fFlushed = false;
- m_fFlushing = true;
- m_hrDeliver = S_FALSE;
- m_queue.RemoveAll();
- HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
- if(S_OK != hr) m_eEndFlush.Set();
- return(hr);
+ m_eEndFlush.Reset();
+ m_fFlushed = false;
+ m_fFlushing = true;
+ m_hrDeliver = S_FALSE;
+ m_queue.RemoveAll();
+ HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
+ if(S_OK != hr) m_eEndFlush.Set();
+ return(hr);
}
HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
{
- if(!ThreadExists()) return S_FALSE;
- HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
- m_hrDeliver = S_OK;
- m_fFlushing = false;
- m_fFlushed = true;
- m_eEndFlush.Set();
- return hr;
+ if(!ThreadExists()) return S_FALSE;
+ HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
+ m_hrDeliver = S_OK;
+ m_fFlushing = false;
+ m_fFlushed = true;
+ m_eEndFlush.Set();
+ return hr;
}
HRESULT CBaseSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
- if(m_fFlushing) return S_FALSE;
- m_rtStart = tStart;
- if(!ThreadExists()) return S_FALSE;
- HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
- if(S_OK != hr) return hr;
- MakeISCRHappy();
- return hr;
+ m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+ if(m_fFlushing) return S_FALSE;
+ m_rtStart = tStart;
+ if(!ThreadExists()) return S_FALSE;
+ HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
+ if(S_OK != hr) return hr;
+ MakeISCRHappy();
+ return hr;
}
int CBaseSplitterOutputPin::QueueCount()
{
- return m_queue.GetCount();
+ return m_queue.GetCount();
}
int CBaseSplitterOutputPin::QueueSize()
{
- return m_queue.GetSize();
+ return m_queue.GetSize();
}
HRESULT CBaseSplitterOutputPin::QueueEndOfStream()
{
- return QueuePacket(CAutoPtr<Packet>()); // NULL means EndOfStream
+ return QueuePacket(CAutoPtr<Packet>()); // NULL means EndOfStream
}
HRESULT CBaseSplitterOutputPin::QueuePacket(CAutoPtr<Packet> p)
{
- if(!ThreadExists()) return S_FALSE;
+ if(!ThreadExists()) return S_FALSE;
- while(S_OK == m_hrDeliver
- && (!(static_cast<CBaseSplitterFilter*>(m_pFilter))->IsAnyPinDrying()
- || m_queue.GetSize() > MAXPACKETSIZE * 100))
- Sleep(1);
+ while(S_OK == m_hrDeliver
+ && (!(static_cast<CBaseSplitterFilter*>(m_pFilter))->IsAnyPinDrying()
+ || m_queue.GetSize() > MAXPACKETSIZE*100))
+ Sleep(1);
- if(S_OK != m_hrDeliver)
- return m_hrDeliver;
+ if(S_OK != m_hrDeliver)
+ return m_hrDeliver;
- m_queue.Add(p);
+ m_queue.Add(p);
- return m_hrDeliver;
+ return m_hrDeliver;
}
bool CBaseSplitterOutputPin::IsDiscontinuous()
{
- return m_mt.majortype == MEDIATYPE_Text
- || m_mt.majortype == MEDIATYPE_ScriptCommand
- || m_mt.majortype == MEDIATYPE_Subtitle
- || m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE
- || m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE
- || m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE;
+ return m_mt.majortype == MEDIATYPE_Text
+ || m_mt.majortype == MEDIATYPE_ScriptCommand
+ || m_mt.majortype == MEDIATYPE_Subtitle
+ || m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE
+ || m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE
+ || m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE;
}
bool CBaseSplitterOutputPin::IsActive()
{
- CComPtr<IPin> pPin = this;
- do
- {
- CComPtr<IPin> pPinTo;
- CComQIPtr<IStreamSwitcherInputPin> pSSIP;
- if(S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive())
- return(false);
- pPin = GetFirstPin(GetFilterFromPin(pPinTo), PINDIR_OUTPUT);
- }
- while(pPin);
+ CComPtr<IPin> pPin = this;
+ do
+ {
+ CComPtr<IPin> pPinTo;
+ CComQIPtr<IStreamSwitcherInputPin> pSSIP;
+ if(S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive())
+ return(false);
+ pPin = GetFirstPin(GetFilterFromPin(pPinTo), PINDIR_OUTPUT);
+ }
+ while(pPin);
- return(true);
+ return(true);
}
DWORD CBaseSplitterOutputPin::ThreadProc()
{
- m_hrDeliver = S_OK;
- m_fFlushing = m_fFlushed = false;
- m_eEndFlush.Set();
-
- while(1)
- {
- Sleep(1);
-
- DWORD cmd;
- if(CheckRequest(&cmd))
- {
- m_hThread = NULL;
- cmd = GetRequest();
- Reply(S_OK);
- ASSERT(cmd == CMD_EXIT);
- return 0;
- }
-
- int cnt = 0;
- do
- {
- CAutoPtr<Packet> p;
-
- {
- CAutoLock cAutoLock(&m_queue);
- if((cnt = m_queue.GetCount()) > 0)
- p = m_queue.Remove();
- }
-
- if(S_OK == m_hrDeliver && cnt > 0)
- {
- ASSERT(!m_fFlushing);
-
- m_fFlushed = false;
-
- // flushing can still start here, to release a blocked deliver call
-
- HRESULT hr = p
- ? DeliverPacket(p)
- : DeliverEndOfStream();
-
- m_eEndFlush.Wait(); // .. so we have to wait until it is done
-
- if(hr != S_OK && !m_fFlushed) // and only report the error in m_hrDeliver if we didn't flush the stream
- {
- // CAutoLock cAutoLock(&m_csQueueLock);
- m_hrDeliver = hr;
- break;
- }
- }
- }
- while(--cnt > 0);
- }
+ m_hrDeliver = S_OK;
+ m_fFlushing = m_fFlushed = false;
+ m_eEndFlush.Set();
+
+ while(1)
+ {
+ Sleep(1);
+
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ m_hThread = NULL;
+ cmd = GetRequest();
+ Reply(S_OK);
+ ASSERT(cmd == CMD_EXIT);
+ return 0;
+ }
+
+ int cnt = 0;
+ do
+ {
+ CAutoPtr<Packet> p;
+
+ {
+ CAutoLock cAutoLock(&m_queue);
+ if((cnt = m_queue.GetCount()) > 0)
+ p = m_queue.Remove();
+ }
+
+ if(S_OK == m_hrDeliver && cnt > 0)
+ {
+ ASSERT(!m_fFlushing);
+
+ m_fFlushed = false;
+
+ // flushing can still start here, to release a blocked deliver call
+
+ HRESULT hr = p
+ ? DeliverPacket(p)
+ : DeliverEndOfStream();
+
+ m_eEndFlush.Wait(); // .. so we have to wait until it is done
+
+ if(hr != S_OK && !m_fFlushed) // and only report the error in m_hrDeliver if we didn't flush the stream
+ {
+ // CAutoLock cAutoLock(&m_csQueueLock);
+ m_hrDeliver = hr;
+ break;
+ }
+ }
+ }
+ while(--cnt > 0);
+ }
}
HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
- HRESULT hr;
-
- INT_PTR nBytes = p->GetCount();
-
- if(nBytes == 0)
- {
- return S_OK;
- }
-
- m_brs.nBytesSinceLastDeliverTime += nBytes;
-
- if(p->rtStart != Packet::INVALID_TIME)
- {
- if(m_brs.rtLastDeliverTime == Packet::INVALID_TIME)
- {
- m_brs.rtLastDeliverTime = p->rtStart;
- m_brs.nBytesSinceLastDeliverTime = 0;
- }
-
- if(m_brs.rtLastDeliverTime + 10000000 < p->rtStart)
- {
- REFERENCE_TIME rtDiff = p->rtStart - m_brs.rtLastDeliverTime;
-
- double secs, bits;
-
- secs = (double)rtDiff / 10000000;
- bits = 8.0 * m_brs.nBytesSinceLastDeliverTime;
- m_brs.nCurrentBitRate = (DWORD)(bits / secs);
-
- m_brs.rtTotalTimeDelivered += rtDiff;
- m_brs.nTotalBytesDelivered += m_brs.nBytesSinceLastDeliverTime;
-
- secs = (double)m_brs.rtTotalTimeDelivered / 10000000;
- bits = 8.0 * m_brs.nTotalBytesDelivered;
- m_brs.nAverageBitRate = (DWORD)(bits / secs);
-
- m_brs.rtLastDeliverTime = p->rtStart;
- m_brs.nBytesSinceLastDeliverTime = 0;
- /*
- TRACE(_T("[%d] c: %d kbps, a: %d kbps\n"),
- p->TrackNumber,
- (m_brs.nCurrentBitRate+500)/1000,
- (m_brs.nAverageBitRate+500)/1000);
- */
- }
-
- double dRate = 1.0;
- if(SUCCEEDED((static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(&dRate)))
- {
- p->rtStart = (REFERENCE_TIME)((double)p->rtStart / dRate);
- p->rtStop = (REFERENCE_TIME)((double)p->rtStop / dRate);
- }
- }
-
- do
- {
- CComPtr<IMediaSample> pSample;
- if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) break;
-
- if(nBytes > pSample->GetSize())
- {
- pSample.Release();
-
- ALLOCATOR_PROPERTIES props, actual;
- if(S_OK != (hr = m_pAllocator->GetProperties(&props))) break;
- props.cbBuffer = nBytes * 3 / 2;
-
- if(props.cBuffers > 1)
- {
- if(S_OK != (hr = __super::DeliverBeginFlush())) break;
- if(S_OK != (hr = __super::DeliverEndFlush())) break;
- }
-
- if(S_OK != (hr = m_pAllocator->Decommit())) break;
- if(S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) break;
- if(S_OK != (hr = m_pAllocator->Commit())) break;
- if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) break;
- }
-
- if(p->pmt)
- {
- pSample->SetMediaType(p->pmt);
- p->bDiscontinuity = true;
-
- CAutoLock cAutoLock(m_pLock);
- m_mts.RemoveAll();
- m_mts.Add(*p->pmt);
- }
-
- bool fTimeValid = p->rtStart != Packet::INVALID_TIME;
- /*
- //if(p->TrackNumber == 1)
- //if(p->rtStart != Packet::INVALID_TIME)
- TRACE(_T("[%d]: d%d s%d p%d, b=%d, %I64d-%I64d \n"),
- p->TrackNumber,
- p->bDiscontinuity, p->bSyncPoint, fTimeValid && p->rtStart < 0,
- nBytes, p->rtStart, p->rtStop);
- */
- ASSERT(!p->bSyncPoint || fTimeValid);
-
- BYTE* pData = NULL;
- if(S_OK != (hr = pSample->GetPointer(&pData)) || !pData) break;
- memcpy(pData, p->GetData(), nBytes);
- if(S_OK != (hr = pSample->SetActualDataLength(nBytes))) break;
- if(S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) break;
- if(S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) break;
- if(S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) break;
- if(S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) break;
- if(S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) break;
- if(S_OK != (hr = Deliver(pSample))) break;
- }
- while(false);
-
- return hr;
+ HRESULT hr;
+
+ INT_PTR nBytes = p->GetCount();
+
+ if(nBytes == 0)
+ {
+ return S_OK;
+ }
+
+ m_brs.nBytesSinceLastDeliverTime += nBytes;
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ if(m_brs.rtLastDeliverTime == Packet::INVALID_TIME)
+ {
+ m_brs.rtLastDeliverTime = p->rtStart;
+ m_brs.nBytesSinceLastDeliverTime = 0;
+ }
+
+ if(m_brs.rtLastDeliverTime + 10000000 < p->rtStart)
+ {
+ REFERENCE_TIME rtDiff = p->rtStart - m_brs.rtLastDeliverTime;
+
+ double secs, bits;
+
+ secs = (double)rtDiff / 10000000;
+ bits = 8.0 * m_brs.nBytesSinceLastDeliverTime;
+ m_brs.nCurrentBitRate = (DWORD)(bits / secs);
+
+ m_brs.rtTotalTimeDelivered += rtDiff;
+ m_brs.nTotalBytesDelivered += m_brs.nBytesSinceLastDeliverTime;
+
+ secs = (double)m_brs.rtTotalTimeDelivered / 10000000;
+ bits = 8.0 * m_brs.nTotalBytesDelivered;
+ m_brs.nAverageBitRate = (DWORD)(bits / secs);
+
+ m_brs.rtLastDeliverTime = p->rtStart;
+ m_brs.nBytesSinceLastDeliverTime = 0;
+/*
+ TRACE(_T("[%d] c: %d kbps, a: %d kbps\n"),
+ p->TrackNumber,
+ (m_brs.nCurrentBitRate+500)/1000,
+ (m_brs.nAverageBitRate+500)/1000);
+*/
+ }
+
+ double dRate = 1.0;
+ if(SUCCEEDED((static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(&dRate)))
+ {
+ p->rtStart = (REFERENCE_TIME)((double)p->rtStart / dRate);
+ p->rtStop = (REFERENCE_TIME)((double)p->rtStop / dRate);
+ }
+ }
+
+ do
+ {
+ CComPtr<IMediaSample> pSample;
+ if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) break;
+
+ if(nBytes > pSample->GetSize())
+ {
+ pSample.Release();
+
+ ALLOCATOR_PROPERTIES props, actual;
+ if(S_OK != (hr = m_pAllocator->GetProperties(&props))) break;
+ props.cbBuffer = nBytes*3/2;
+
+ if(props.cBuffers > 1)
+ {
+ if(S_OK != (hr = __super::DeliverBeginFlush())) break;
+ if(S_OK != (hr = __super::DeliverEndFlush())) break;
+ }
+
+ if(S_OK != (hr = m_pAllocator->Decommit())) break;
+ if(S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) break;
+ if(S_OK != (hr = m_pAllocator->Commit())) break;
+ if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) break;
+ }
+
+ if(p->pmt)
+ {
+ pSample->SetMediaType(p->pmt);
+ p->bDiscontinuity = true;
+
+ CAutoLock cAutoLock(m_pLock);
+ m_mts.RemoveAll();
+ m_mts.Add(*p->pmt);
+ }
+
+ bool fTimeValid = p->rtStart != Packet::INVALID_TIME;
+/*
+//if(p->TrackNumber == 1)
+//if(p->rtStart != Packet::INVALID_TIME)
+TRACE(_T("[%d]: d%d s%d p%d, b=%d, %I64d-%I64d \n"),
+ p->TrackNumber,
+ p->bDiscontinuity, p->bSyncPoint, fTimeValid && p->rtStart < 0,
+ nBytes, p->rtStart, p->rtStop);
+*/
+ ASSERT(!p->bSyncPoint || fTimeValid);
+
+ BYTE* pData = NULL;
+ if(S_OK != (hr = pSample->GetPointer(&pData)) || !pData) break;
+ memcpy(pData, p->GetData(), nBytes);
+ if(S_OK != (hr = pSample->SetActualDataLength(nBytes))) break;
+ if(S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) break;
+ if(S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) break;
+ if(S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) break;
+ if(S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) break;
+ if(S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) break;
+ if(S_OK != (hr = Deliver(pSample))) break;
+ }
+ while(false);
+
+ return hr;
}
void CBaseSplitterOutputPin::MakeISCRHappy()
{
- CComPtr<IPin> pPinTo = this, pTmp;
- while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp))
- {
- pTmp = NULL;
+ CComPtr<IPin> pPinTo = this, pTmp;
+ while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp))
+ {
+ pTmp = NULL;
- CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
+ CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
- if(GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR
- {
- CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = (DWORD) - 1;
- p->rtStart = -1;
- p->rtStop = 0;
- p->bSyncPoint = FALSE;
- p->SetData(" ", 2);
- QueuePacket(p);
- break;
- }
+ if(GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR
+ {
+ CAutoPtr<Packet> p(DNew Packet());
+ p->TrackNumber = (DWORD)-1;
+ p->rtStart = -1; p->rtStop = 0;
+ p->bSyncPoint = FALSE;
+ p->SetData(" ", 2);
+ QueuePacket(p);
+ break;
+ }
- pPinTo = GetFirstPin(pBF, PINDIR_OUTPUT);
- }
+ pPinTo = GetFirstPin(pBF, PINDIR_OUTPUT);
+ }
}
HRESULT CBaseSplitterOutputPin::GetDeliveryBuffer(IMediaSample** ppSample, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags)
{
- return __super::GetDeliveryBuffer(ppSample, pStartTime, pEndTime, dwFlags);
+ return __super::GetDeliveryBuffer(ppSample, pStartTime, pEndTime, dwFlags);
}
HRESULT CBaseSplitterOutputPin::Deliver(IMediaSample* pSample)
{
- return __super::Deliver(pSample);
+ return __super::Deliver(pSample);
}
// IMediaSeeking
STDMETHODIMP CBaseSplitterOutputPin::GetCapabilities(DWORD* pCapabilities)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetCapabilities(pCapabilities);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetCapabilities(pCapabilities);
}
STDMETHODIMP CBaseSplitterOutputPin::CheckCapabilities(DWORD* pCapabilities)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->CheckCapabilities(pCapabilities);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->CheckCapabilities(pCapabilities);
}
STDMETHODIMP CBaseSplitterOutputPin::IsFormatSupported(const GUID* pFormat)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->IsFormatSupported(pFormat);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->IsFormatSupported(pFormat);
}
STDMETHODIMP CBaseSplitterOutputPin::QueryPreferredFormat(GUID* pFormat)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->QueryPreferredFormat(pFormat);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->QueryPreferredFormat(pFormat);
}
STDMETHODIMP CBaseSplitterOutputPin::GetTimeFormat(GUID* pFormat)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetTimeFormat(pFormat);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetTimeFormat(pFormat);
}
STDMETHODIMP CBaseSplitterOutputPin::IsUsingTimeFormat(const GUID* pFormat)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->IsUsingTimeFormat(pFormat);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->IsUsingTimeFormat(pFormat);
}
STDMETHODIMP CBaseSplitterOutputPin::SetTimeFormat(const GUID* pFormat)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->SetTimeFormat(pFormat);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->SetTimeFormat(pFormat);
}
STDMETHODIMP CBaseSplitterOutputPin::GetDuration(LONGLONG* pDuration)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetDuration(pDuration);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetDuration(pDuration);
}
STDMETHODIMP CBaseSplitterOutputPin::GetStopPosition(LONGLONG* pStop)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetStopPosition(pStop);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetStopPosition(pStop);
}
STDMETHODIMP CBaseSplitterOutputPin::GetCurrentPosition(LONGLONG* pCurrent)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetCurrentPosition(pCurrent);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetCurrentPosition(pCurrent);
}
STDMETHODIMP CBaseSplitterOutputPin::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat);
}
STDMETHODIMP CBaseSplitterOutputPin::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->SetPositionsInternal(this, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->SetPositionsInternal(this, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
STDMETHODIMP CBaseSplitterOutputPin::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetPositions(pCurrent, pStop);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetPositions(pCurrent, pStop);
}
STDMETHODIMP CBaseSplitterOutputPin::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetAvailable(pEarliest, pLatest);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetAvailable(pEarliest, pLatest);
}
STDMETHODIMP CBaseSplitterOutputPin::SetRate(double dRate)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->SetRate(dRate);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->SetRate(dRate);
}
STDMETHODIMP CBaseSplitterOutputPin::GetRate(double* pdRate)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(pdRate);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetRate(pdRate);
}
STDMETHODIMP CBaseSplitterOutputPin::GetPreroll(LONGLONG* pllPreroll)
{
- return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetPreroll(pllPreroll);
+ return (static_cast<CBaseSplitterFilter*>(m_pFilter))->GetPreroll(pllPreroll);
}
//
@@ -696,784 +695,729 @@ STDMETHODIMP CBaseSplitterOutputPin::GetPreroll(LONGLONG* pllPreroll)
//
CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
- : CBaseFilter(pName, pUnk, this, clsid)
- , m_rtDuration(0), m_rtStart(0), m_rtStop(0), m_rtCurrent(0)
- , m_dRate(1.0)
- , m_nOpenProgress(100)
- , m_fAbort(false)
- , m_rtLastStart(_I64_MIN)
- , m_rtLastStop(_I64_MIN)
- , m_priority(THREAD_PRIORITY_NORMAL)
+ : CBaseFilter(pName, pUnk, this, clsid)
+ , m_rtDuration(0), m_rtStart(0), m_rtStop(0), m_rtCurrent(0)
+ , m_dRate(1.0)
+ , m_nOpenProgress(100)
+ , m_fAbort(false)
+ , m_rtLastStart(_I64_MIN)
+ , m_rtLastStop(_I64_MIN)
+ , m_priority(THREAD_PRIORITY_NORMAL)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- m_pInput.Attach(DNew CBaseSplitterInputPin(NAME("CBaseSplitterInputPin"), this, this, phr));
+ m_pInput.Attach(DNew CBaseSplitterInputPin(NAME("CBaseSplitterInputPin"), this, this, phr));
}
CBaseSplitterFilter::~CBaseSplitterFilter()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- CAMThread::CallWorker(CMD_EXIT);
- CAMThread::Close();
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
}
STDMETHODIMP CBaseSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- *ppv = NULL;
+ *ppv = NULL;
- if(m_pInput && riid == __uuidof(IFileSourceFilter))
- return E_NOINTERFACE;
+ if(m_pInput && riid == __uuidof(IFileSourceFilter))
+ return E_NOINTERFACE;
- return
- QI(IFileSourceFilter)
- QI(IMediaSeeking)
- QI(IAMOpenProgress)
- QI2(IAMMediaContent)
- QI2(IAMExtendedSeeking)
- QI(IKeyFrameInfo)
- QI(IBufferInfo)
- QI(IPropertyBag)
- QI(IPropertyBag2)
- QI(IDSMPropertyBag)
- QI(IDSMResourceBag)
- QI(IDSMChapterBag)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ QI(IMediaSeeking)
+ QI(IAMOpenProgress)
+ QI2(IAMMediaContent)
+ QI2(IAMExtendedSeeking)
+ QI(IKeyFrameInfo)
+ QI(IBufferInfo)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ QI(IDSMResourceBag)
+ QI(IDSMChapterBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
CBaseSplitterOutputPin* CBaseSplitterFilter::GetOutputPin(DWORD TrackNum)
{
- CAutoLock cAutoLock(&m_csPinMap);
+ CAutoLock cAutoLock(&m_csPinMap);
CBaseSplitterOutputPin* pPin = NULL;
- m_pPinMap.Lookup(TrackNum, pPin);
- return pPin;
+ m_pPinMap.Lookup(TrackNum, pPin);
+ return pPin;
}
DWORD CBaseSplitterFilter::GetOutputTrackNum(CBaseSplitterOutputPin* pPin)
{
- CAutoLock cAutoLock(&m_csPinMap);
+ CAutoLock cAutoLock(&m_csPinMap);
- POSITION pos = m_pPinMap.GetStartPosition();
- while(pos)
- {
- DWORD TrackNum;
- CBaseSplitterOutputPin* pPinTmp;
- m_pPinMap.GetNextAssoc(pos, TrackNum, pPinTmp);
- if(pPinTmp == pPin) return TrackNum;
- }
+ POSITION pos = m_pPinMap.GetStartPosition();
+ while(pos)
+ {
+ DWORD TrackNum;
+ CBaseSplitterOutputPin* pPinTmp;
+ m_pPinMap.GetNextAssoc(pos, TrackNum, pPinTmp);
+ if(pPinTmp == pPin) return TrackNum;
+ }
- return (DWORD) - 1;
+ return (DWORD)-1;
}
HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, const AM_MEDIA_TYPE* pmt)
{
- CAutoLock cAutoLock(&m_csPinMap);
+ CAutoLock cAutoLock(&m_csPinMap);
- CBaseSplitterOutputPin* pPin;
- if(m_pPinMap.Lookup(TrackNumSrc, pPin))
- {
- if(CComQIPtr<IPin> pPinTo = pPin->GetConnected())
- {
- if(pmt && S_OK != pPinTo->QueryAccept(pmt))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
+ CBaseSplitterOutputPin* pPin;
+ if(m_pPinMap.Lookup(TrackNumSrc, pPin))
+ {
+ if(CComQIPtr<IPin> pPinTo = pPin->GetConnected())
+ {
+ if(pmt && S_OK != pPinTo->QueryAccept(pmt))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
- m_pPinMap.RemoveKey(TrackNumSrc);
- m_pPinMap[TrackNumDst] = pPin;
+ m_pPinMap.RemoveKey(TrackNumSrc);
+ m_pPinMap[TrackNumDst] = pPin;
- if(pmt)
- {
- CAutoLock cAutoLock(&m_csmtnew);
- m_mtnew[TrackNumDst] = *pmt;
- }
+ if(pmt)
+ {
+ CAutoLock cAutoLock(&m_csmtnew);
+ m_mtnew[TrackNumDst] = *pmt;
+ }
- return S_OK;
- }
+ return S_OK;
+ }
- return E_FAIL;
+ return E_FAIL;
}
HRESULT CBaseSplitterFilter::AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitterOutputPin> pPin)
{
- CAutoLock cAutoLock(&m_csPinMap);
+ CAutoLock cAutoLock(&m_csPinMap);
- if(!pPin) return E_INVALIDARG;
- m_pPinMap[TrackNum] = pPin;
- m_pOutputs.AddTail(pPin);
- return S_OK;
+ if(!pPin) return E_INVALIDARG;
+ m_pPinMap[TrackNum] = pPin;
+ m_pOutputs.AddTail(pPin);
+ return S_OK;
}
HRESULT CBaseSplitterFilter::DeleteOutputs()
{
- m_rtDuration = 0;
+ m_rtDuration = 0;
- m_pRetiredOutputs.RemoveAll();
+ m_pRetiredOutputs.RemoveAll();
- CAutoLock cAutoLockF(this);
- if(m_State != State_Stopped) return VFW_E_NOT_STOPPED;
+ CAutoLock cAutoLockF(this);
+ if(m_State != State_Stopped) return VFW_E_NOT_STOPPED;
- while(m_pOutputs.GetCount())
- {
- CAutoPtr<CBaseSplitterOutputPin> pPin = m_pOutputs.RemoveHead();
- if(IPin* pPinTo = pPin->GetConnected()) pPinTo->Disconnect();
- pPin->Disconnect();
- // we can't just let it be deleted now, something might have AddRefed on it (graphedit...)
- m_pRetiredOutputs.AddTail(pPin);
- }
+ while(m_pOutputs.GetCount())
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPin = m_pOutputs.RemoveHead();
+ if(IPin* pPinTo = pPin->GetConnected()) pPinTo->Disconnect();
+ pPin->Disconnect();
+ // we can't just let it be deleted now, something might have AddRefed on it (graphedit...)
+ m_pRetiredOutputs.AddTail(pPin);
+ }
- CAutoLock cAutoLockPM(&m_csPinMap);
- m_pPinMap.RemoveAll();
+ CAutoLock cAutoLockPM(&m_csPinMap);
+ m_pPinMap.RemoveAll();
- CAutoLock cAutoLockMT(&m_csmtnew);
- m_mtnew.RemoveAll();
+ CAutoLock cAutoLockMT(&m_csmtnew);
+ m_mtnew.RemoveAll();
- RemoveAll();
- ResRemoveAll();
- ChapRemoveAll();
+ RemoveAll();
+ ResRemoveAll();
+ ChapRemoveAll();
- m_fontinst.UninstallFonts();
+ m_fontinst.UninstallFonts();
- m_pSyncReader.Release();
+ m_pSyncReader.Release();
- return S_OK;
+ return S_OK;
}
void CBaseSplitterFilter::DeliverBeginFlush()
{
- m_fFlushing = true;
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) m_pOutputs.GetNext(pos)->DeliverBeginFlush();
+ m_fFlushing = true;
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->DeliverBeginFlush();
}
void CBaseSplitterFilter::DeliverEndFlush()
{
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) m_pOutputs.GetNext(pos)->DeliverEndFlush();
- m_fFlushing = false;
- m_eEndFlush.Set();
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->DeliverEndFlush();
+ m_fFlushing = false;
+ m_eEndFlush.Set();
}
DWORD CBaseSplitterFilter::ThreadProc()
{
- if(m_pSyncReader)
- m_pSyncReader->SetBreakEvent(GetRequestHandle());
+ if(m_pSyncReader)
+ m_pSyncReader->SetBreakEvent(GetRequestHandle());
- if(!DemuxInit())
- {
- while(1)
- {
- DWORD cmd = GetRequest();
- if(cmd == CMD_EXIT) CAMThread::m_hThread = NULL;
- Reply(S_OK);
- if(cmd == CMD_EXIT) return 0;
- }
- }
+ if(!DemuxInit())
+ {
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+ if(cmd == CMD_EXIT) CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ if(cmd == CMD_EXIT) return 0;
+ }
+ }
- m_eEndFlush.Set();
- m_fFlushing = false;
+ m_eEndFlush.Set();
+ m_fFlushing = false;
- for(DWORD cmd = -1; ; cmd = GetRequest())
- {
- if(cmd == CMD_EXIT)
- {
- m_hThread = NULL;
- Reply(S_OK);
- return 0;
- }
+ for(DWORD cmd = -1; ; cmd = GetRequest())
+ {
+ if(cmd == CMD_EXIT)
+ {
+ m_hThread = NULL;
+ Reply(S_OK);
+ return 0;
+ }
- SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
+ SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
- m_rtStart = m_rtNewStart;
- m_rtStop = m_rtNewStop;
+ m_rtStart = m_rtNewStart;
+ m_rtStop = m_rtNewStop;
- DemuxSeek(m_rtStart);
+ DemuxSeek(m_rtStart);
- if(cmd != -1)
- Reply(S_OK);
+ if(cmd != -1)
+ Reply(S_OK);
- m_eEndFlush.Wait();
+ m_eEndFlush.Wait();
- m_pActivePins.RemoveAll();
+ m_pActivePins.RemoveAll();
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos && !m_fFlushing)
- {
- CBaseSplitterOutputPin* pPin = m_pOutputs.GetNext(pos);
- if(pPin->IsConnected() && pPin->IsActive())
- {
- m_pActivePins.AddTail(pPin);
- pPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
- }
- }
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos && !m_fFlushing)
+ {
+ CBaseSplitterOutputPin* pPin = m_pOutputs.GetNext(pos);
+ if(pPin->IsConnected() && pPin->IsActive())
+ {
+ m_pActivePins.AddTail(pPin);
+ pPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
+ }
+ }
- do
- {
- m_bDiscontinuitySent.RemoveAll();
- }
- while(!DemuxLoop());
+ do {m_bDiscontinuitySent.RemoveAll();}
+ while(!DemuxLoop());
- pos = m_pActivePins.GetHeadPosition();
- while(pos && !CheckRequest(&cmd))
- m_pActivePins.GetNext(pos)->QueueEndOfStream();
- }
+ pos = m_pActivePins.GetHeadPosition();
+ while(pos && !CheckRequest(&cmd))
+ m_pActivePins.GetNext(pos)->QueueEndOfStream();
+ }
- ASSERT(0); // we should only exit via CMD_EXIT
+ ASSERT(0); // we should only exit via CMD_EXIT
- m_hThread = NULL;
- return 0;
+ m_hThread = NULL;
+ return 0;
}
HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p)
{
- HRESULT hr = S_FALSE;
+ HRESULT hr = S_FALSE;
- CBaseSplitterOutputPin* pPin = GetOutputPin(p->TrackNumber);
- if(!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin))
- return S_FALSE;
+ CBaseSplitterOutputPin* pPin = GetOutputPin(p->TrackNumber);
+ if(!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin))
+ return S_FALSE;
- if(p->rtStart != Packet::INVALID_TIME)
- {
- m_rtCurrent = p->rtStart;
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ m_rtCurrent = p->rtStart;
- p->rtStart -= m_rtStart;
- p->rtStop -= m_rtStart;
+ p->rtStart -= m_rtStart;
+ p->rtStop -= m_rtStart;
- ASSERT(p->rtStart <= p->rtStop);
- }
+ ASSERT(p->rtStart <= p->rtStop);
+ }
- {
- CAutoLock cAutoLock(&m_csmtnew);
+ {
+ CAutoLock cAutoLock(&m_csmtnew);
- CMediaType mt;
- if(m_mtnew.Lookup(p->TrackNumber, mt))
- {
- p->pmt = CreateMediaType(&mt);
- m_mtnew.RemoveKey(p->TrackNumber);
- }
- }
+ CMediaType mt;
+ if(m_mtnew.Lookup(p->TrackNumber, mt))
+ {
+ p->pmt = CreateMediaType(&mt);
+ m_mtnew.RemoveKey(p->TrackNumber);
+ }
+ }
- if(!m_bDiscontinuitySent.Find(p->TrackNumber))
- p->bDiscontinuity = TRUE;
+ if(!m_bDiscontinuitySent.Find(p->TrackNumber))
+ p->bDiscontinuity = TRUE;
- DWORD TrackNumber = p->TrackNumber;
- BOOL bDiscontinuity = p->bDiscontinuity;
- /*
- //if(p->TrackNumber == 1)
- //if(p->rtStart != Packet::INVALID_TIME)
- TRACE(_T("[%d]: d%d s%d p%d, b=%d, %I64d-%I64d \n"),
- p->TrackNumber,
- p->bDiscontinuity, p->bSyncPoint, p->rtStart != Packet::INVALID_TIME && p->rtStart < 0,
- p->GetCount(), p->rtStart, p->rtStop);
- */
+ DWORD TrackNumber = p->TrackNumber;
+ BOOL bDiscontinuity = p->bDiscontinuity;
+/*
+//if(p->TrackNumber == 1)
+//if(p->rtStart != Packet::INVALID_TIME)
+TRACE(_T("[%d]: d%d s%d p%d, b=%d, %I64d-%I64d \n"),
+ p->TrackNumber,
+ p->bDiscontinuity, p->bSyncPoint, p->rtStart != Packet::INVALID_TIME && p->rtStart < 0,
+ p->GetCount(), p->rtStart, p->rtStop);
+*/
- hr = pPin->QueuePacket(p);
+ hr = pPin->QueuePacket(p);
- if(S_OK != hr)
- {
- if(POSITION pos = m_pActivePins.Find(pPin))
- m_pActivePins.RemoveAt(pos);
+ if(S_OK != hr)
+ {
+ if(POSITION pos = m_pActivePins.Find(pPin))
+ m_pActivePins.RemoveAt(pos);
- if(!m_pActivePins.IsEmpty()) // only die when all pins are down
- hr = S_OK;
+ if(!m_pActivePins.IsEmpty()) // only die when all pins are down
+ hr = S_OK;
- return hr;
- }
+ return hr;
+ }
- if(bDiscontinuity)
- m_bDiscontinuitySent.AddTail(TrackNumber);
+ if(bDiscontinuity)
+ m_bDiscontinuitySent.AddTail(TrackNumber);
- return hr;
+ return hr;
}
bool CBaseSplitterFilter::IsAnyPinDrying()
{
- int totalcount = 0, totalsize = 0;
+ int totalcount = 0, totalsize = 0;
- POSITION pos = m_pActivePins.GetHeadPosition();
- while(pos)
- {
- CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos);
- int count = pPin->QueueCount();
- int size = pPin->QueueSize();
- if(!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE))
- {
+ POSITION pos = m_pActivePins.GetHeadPosition();
+ while(pos)
+ {
+ CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos);
+ int count = pPin->QueueCount();
+ int size = pPin->QueueSize();
+ if(!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE))
+ {
// if(m_priority != THREAD_PRIORITY_ABOVE_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3))
- if(m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS / 3 || size < MINPACKETSIZE / 3))
- {
- // SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_ABOVE_NORMAL);
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
- m_priority = THREAD_PRIORITY_BELOW_NORMAL;
- }
- return(true);
- }
- totalcount += count;
- totalsize += size;
- }
-
- if(m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS * 2 / 3 || totalsize > MAXPACKETSIZE * 2 / 3))
- {
+ if(m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3))
+ {
+ // SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_ABOVE_NORMAL);
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
+ m_priority = THREAD_PRIORITY_BELOW_NORMAL;
+ }
+ return(true);
+ }
+ totalcount += count;
+ totalsize += size;
+ }
+
+ if(m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3))
+ {
// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos) m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL);
- m_priority = THREAD_PRIORITY_NORMAL;
- }
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL);
+ m_priority = THREAD_PRIORITY_NORMAL;
+ }
- if(totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE)
- return(true);
+ if(totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE)
+ return(true);
- return(false);
+ return(false);
}
HRESULT CBaseSplitterFilter::BreakConnect(PIN_DIRECTION dir, CBasePin* pPin)
{
- CheckPointer(pPin, E_POINTER);
+ CheckPointer(pPin, E_POINTER);
- if(dir == PINDIR_INPUT)
- {
- DeleteOutputs();
- }
- else if(dir == PINDIR_OUTPUT)
- {
- }
- else
- {
- return E_UNEXPECTED;
- }
+ if(dir == PINDIR_INPUT)
+ {
+ DeleteOutputs();
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
- return S_OK;
+ return S_OK;
}
HRESULT CBaseSplitterFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin)
{
- CheckPointer(pPin, E_POINTER);
+ CheckPointer(pPin, E_POINTER);
- if(dir == PINDIR_INPUT)
- {
- CBaseSplitterInputPin* pIn = static_cast<CBaseSplitterInputPin*>(pPin);
+ if(dir == PINDIR_INPUT)
+ {
+ CBaseSplitterInputPin* pIn = static_cast<CBaseSplitterInputPin*>(pPin);
- HRESULT hr;
+ HRESULT hr;
- CComPtr<IAsyncReader> pAsyncReader;
- if(FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
- || FAILED(hr = DeleteOutputs())
- || FAILED(hr = CreateOutputs(pAsyncReader)))
- return hr;
+ CComPtr<IAsyncReader> pAsyncReader;
+ if(FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
+ || FAILED(hr = DeleteOutputs())
+ || FAILED(hr = CreateOutputs(pAsyncReader)))
+ return hr;
- ChapSort();
+ ChapSort();
- m_pSyncReader = pAsyncReader;
- }
- else if(dir == PINDIR_OUTPUT)
- {
- m_pRetiredOutputs.RemoveAll();
- }
- else
- {
- return E_UNEXPECTED;
- }
+ m_pSyncReader = pAsyncReader;
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ m_pRetiredOutputs.RemoveAll();
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
- return S_OK;
+ return S_OK;
}
int CBaseSplitterFilter::GetPinCount()
{
- return (m_pInput ? 1 : 0) + m_pOutputs.GetCount();
+ return (m_pInput ? 1 : 0) + m_pOutputs.GetCount();
}
CBasePin* CBaseSplitterFilter::GetPin(int n)
{
CAutoLock cAutoLock(this);
- if(n >= 0 && n < (int)m_pOutputs.GetCount())
- {
- if(POSITION pos = m_pOutputs.FindIndex(n))
- return m_pOutputs.GetAt(pos);
- }
+ if(n >= 0 && n < (int)m_pOutputs.GetCount())
+ {
+ if(POSITION pos = m_pOutputs.FindIndex(n))
+ return m_pOutputs.GetAt(pos);
+ }
- if(n == m_pOutputs.GetCount() && m_pInput)
- {
- return m_pInput;
- }
+ if(n == m_pOutputs.GetCount() && m_pInput)
+ {
+ return m_pInput;
+ }
- return NULL;
+ return NULL;
}
STDMETHODIMP CBaseSplitterFilter::Stop()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- DeliverBeginFlush();
- CallWorker(CMD_EXIT);
- DeliverEndFlush();
+ DeliverBeginFlush();
+ CallWorker(CMD_EXIT);
+ DeliverEndFlush();
- HRESULT hr;
- if(FAILED(hr = __super::Stop()))
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = __super::Stop()))
+ return hr;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::Pause()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- FILTER_STATE fs = m_State;
+ FILTER_STATE fs = m_State;
- HRESULT hr;
- if(FAILED(hr = __super::Pause()))
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = __super::Pause()))
+ return hr;
- if(fs == State_Stopped)
- {
- Create();
- }
+ if(fs == State_Stopped)
+ {
+ Create();
+ }
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::Run(REFERENCE_TIME tStart)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
- HRESULT hr;
- if(FAILED(hr = __super::Run(tStart)))
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = __super::Run(tStart)))
+ return hr;
- return S_OK;
+ return S_OK;
}
// IFileSourceFilter
STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- CheckPointer(pszFileName, E_POINTER);
+ CheckPointer(pszFileName, E_POINTER);
- m_fn = pszFileName;
- HRESULT hr = E_FAIL;
- CComPtr<IAsyncReader> pAsyncReader;
- CAtlList<CHdmvClipInfo::PlaylistItem> Items;
- if(BuildPlaylist(pszFileName, Items))
- pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(Items, hr);
- else
- pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
- if(FAILED(hr)
- || FAILED(hr = DeleteOutputs())
- || FAILED(hr = CreateOutputs(pAsyncReader)))
- {
- m_fn = "";
- return hr;
- }
+ m_fn = pszFileName;
+ HRESULT hr = E_FAIL;
+ CComPtr<IAsyncReader> pAsyncReader;
+ CAtlList<CHdmvClipInfo::PlaylistItem> Items;
+ if (BuildPlaylist (pszFileName, Items))
+ pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(Items, hr);
+ else
+ pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
+ if(FAILED(hr)
+ || FAILED(hr = DeleteOutputs())
+ || FAILED(hr = CreateOutputs(pAsyncReader)))
+ {
+ m_fn = "";
+ return hr;
+ }
- ChapSort();
+ ChapSort();
- m_pSyncReader = pAsyncReader;
+ m_pSyncReader = pAsyncReader;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- CheckPointer(ppszFileName, E_POINTER);
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
- wcscpy(*ppszFileName, m_fn);
- return S_OK;
+ CheckPointer(ppszFileName, E_POINTER);
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+ wcscpy(*ppszFileName, m_fn);
+ return S_OK;
}
LPCTSTR CBaseSplitterFilter::GetPartFilename(IAsyncReader* pAsyncReader)
{
- CComQIPtr<IFileHandle> pFH = pAsyncReader;
- return pFH ? pFH->GetFileName() : m_fn;
+ CComQIPtr<IFileHandle> pFH = pAsyncReader;
+ return pFH ? pFH->GetFileName() : m_fn;
}
// IMediaSeeking
STDMETHODIMP CBaseSplitterFilter::GetCapabilities(DWORD* pCapabilities)
{
- return pCapabilities ? *pCapabilities =
- AM_SEEKING_CanGetStopPos |
- AM_SEEKING_CanGetDuration |
- AM_SEEKING_CanSeekAbsolute |
- AM_SEEKING_CanSeekForwards |
- AM_SEEKING_CanSeekBackwards, S_OK : E_POINTER;
+ return pCapabilities ? *pCapabilities =
+ AM_SEEKING_CanGetStopPos|
+ AM_SEEKING_CanGetDuration|
+ AM_SEEKING_CanSeekAbsolute|
+ AM_SEEKING_CanSeekForwards|
+ AM_SEEKING_CanSeekBackwards, S_OK : E_POINTER;
}
STDMETHODIMP CBaseSplitterFilter::CheckCapabilities(DWORD* pCapabilities)
{
- CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) return S_OK;
- DWORD caps;
- GetCapabilities(&caps);
- if((caps&*pCapabilities) == 0) return E_FAIL;
- if(caps == *pCapabilities) return S_OK;
- return S_FALSE;
-}
-STDMETHODIMP CBaseSplitterFilter::IsFormatSupported(const GUID* pFormat)
-{
- return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
-}
-STDMETHODIMP CBaseSplitterFilter::QueryPreferredFormat(GUID* pFormat)
-{
- return GetTimeFormat(pFormat);
-}
-STDMETHODIMP CBaseSplitterFilter::GetTimeFormat(GUID* pFormat)
-{
- return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
-}
-STDMETHODIMP CBaseSplitterFilter::IsUsingTimeFormat(const GUID* pFormat)
-{
- return IsFormatSupported(pFormat);
-}
-STDMETHODIMP CBaseSplitterFilter::SetTimeFormat(const GUID* pFormat)
-{
- return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
-}
-STDMETHODIMP CBaseSplitterFilter::GetDuration(LONGLONG* pDuration)
-{
- CheckPointer(pDuration, E_POINTER);
- *pDuration = m_rtDuration;
- return S_OK;
-}
-STDMETHODIMP CBaseSplitterFilter::GetStopPosition(LONGLONG* pStop)
-{
- return GetDuration(pStop);
-}
-STDMETHODIMP CBaseSplitterFilter::GetCurrentPosition(LONGLONG* pCurrent)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CBaseSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
-{
- return E_NOTIMPL;
-}
+ CheckPointer(pCapabilities, E_POINTER);
+ if(*pCapabilities == 0) return S_OK;
+ DWORD caps;
+ GetCapabilities(&caps);
+ if((caps&*pCapabilities) == 0) return E_FAIL;
+ if(caps == *pCapabilities) return S_OK;
+ return S_FALSE;
+}
+STDMETHODIMP CBaseSplitterFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
+STDMETHODIMP CBaseSplitterFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
+STDMETHODIMP CBaseSplitterFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
+STDMETHODIMP CBaseSplitterFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
+STDMETHODIMP CBaseSplitterFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
+STDMETHODIMP CBaseSplitterFilter::GetDuration(LONGLONG* pDuration) {CheckPointer(pDuration, E_POINTER); *pDuration = m_rtDuration; return S_OK;}
+STDMETHODIMP CBaseSplitterFilter::GetStopPosition(LONGLONG* pStop) {return GetDuration(pStop);}
+STDMETHODIMP CBaseSplitterFilter::GetCurrentPosition(LONGLONG* pCurrent) {return E_NOTIMPL;}
+STDMETHODIMP CBaseSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
STDMETHODIMP CBaseSplitterFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- return SetPositionsInternal(this, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+ return SetPositionsInternal(this, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
}
STDMETHODIMP CBaseSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
{
- if(pCurrent) *pCurrent = m_rtCurrent;
- if(pStop) *pStop = m_rtStop;
- return S_OK;
+ if(pCurrent) *pCurrent = m_rtCurrent;
+ if(pStop) *pStop = m_rtStop;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
{
- if(pEarliest) *pEarliest = 0;
- return GetDuration(pLatest);
-}
-STDMETHODIMP CBaseSplitterFilter::SetRate(double dRate)
-{
- return dRate > 0 ? m_dRate = dRate, S_OK : E_INVALIDARG;
-}
-STDMETHODIMP CBaseSplitterFilter::GetRate(double* pdRate)
-{
- return pdRate ? *pdRate = m_dRate, S_OK : E_POINTER;
-}
-STDMETHODIMP CBaseSplitterFilter::GetPreroll(LONGLONG* pllPreroll)
-{
- return pllPreroll ? *pllPreroll = 0, S_OK : E_POINTER;
+ if(pEarliest) *pEarliest = 0;
+ return GetDuration(pLatest);
}
+STDMETHODIMP CBaseSplitterFilter::SetRate(double dRate) {return dRate > 0 ? m_dRate = dRate, S_OK : E_INVALIDARG;}
+STDMETHODIMP CBaseSplitterFilter::GetRate(double* pdRate) {return pdRate ? *pdRate = m_dRate, S_OK : E_POINTER;}
+STDMETHODIMP CBaseSplitterFilter::GetPreroll(LONGLONG* pllPreroll) {return pllPreroll ? *pllPreroll = 0, S_OK : E_POINTER;}
HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
+
+ if(!pCurrent && !pStop
+ || (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
+ && (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+ return S_OK;
+
+ REFERENCE_TIME
+ rtCurrent = m_rtCurrent,
+ rtStop = m_rtStop;
+
+ if(pCurrent)
+ switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtCurrent = *pCurrent; break;
+ case AM_SEEKING_RelativePositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ case AM_SEEKING_IncrementalPositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ }
+
+ if(pStop)
+ switch(dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtStop = *pStop; break;
+ case AM_SEEKING_RelativePositioning: rtStop += *pStop; break;
+ case AM_SEEKING_IncrementalPositioning: rtStop = rtCurrent + *pStop; break;
+ }
+
+ if(m_rtCurrent == rtCurrent && m_rtStop == rtStop)
+ return S_OK;
- if(!pCurrent && !pStop
- || (dwCurrentFlags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
- && (dwStopFlags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
- return S_OK;
-
- REFERENCE_TIME
- rtCurrent = m_rtCurrent,
- rtStop = m_rtStop;
-
- if(pCurrent)
- switch(dwCurrentFlags & AM_SEEKING_PositioningBitsMask)
- {
- case AM_SEEKING_NoPositioning:
- break;
- case AM_SEEKING_AbsolutePositioning:
- rtCurrent = *pCurrent;
- break;
- case AM_SEEKING_RelativePositioning:
- rtCurrent = rtCurrent + *pCurrent;
- break;
- case AM_SEEKING_IncrementalPositioning:
- rtCurrent = rtCurrent + *pCurrent;
- break;
- }
-
- if(pStop)
- switch(dwStopFlags & AM_SEEKING_PositioningBitsMask)
- {
- case AM_SEEKING_NoPositioning:
- break;
- case AM_SEEKING_AbsolutePositioning:
- rtStop = *pStop;
- break;
- case AM_SEEKING_RelativePositioning:
- rtStop += *pStop;
- break;
- case AM_SEEKING_IncrementalPositioning:
- rtStop = rtCurrent + *pStop;
- break;
- }
-
- if(m_rtCurrent == rtCurrent && m_rtStop == rtStop)
- return S_OK;
-
- if(m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id))
- {
- m_LastSeekers.AddTail(id);
- return S_OK;
- }
-
- m_rtLastStart = rtCurrent;
- m_rtLastStop = rtStop;
- m_LastSeekers.RemoveAll();
- m_LastSeekers.AddTail(id);
-
- DbgLog((LOG_TRACE, 0, _T("Seek Started %I64d"), rtCurrent));
-
- m_rtNewStart = m_rtCurrent = rtCurrent;
- m_rtNewStop = rtStop;
-
- if(ThreadExists())
- {
- DeliverBeginFlush();
- CallWorker(CMD_SEEK);
- DeliverEndFlush();
- }
-
- DbgLog((LOG_TRACE, 0, _T("Seek Ended")));
-
- return S_OK;
+ if(m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id))
+ {
+ m_LastSeekers.AddTail(id);
+ return S_OK;
+ }
+
+ m_rtLastStart = rtCurrent;
+ m_rtLastStop = rtStop;
+ m_LastSeekers.RemoveAll();
+ m_LastSeekers.AddTail(id);
+
+DbgLog((LOG_TRACE, 0, _T("Seek Started %I64d"), rtCurrent));
+
+ m_rtNewStart = m_rtCurrent = rtCurrent;
+ m_rtNewStop = rtStop;
+
+ if(ThreadExists())
+ {
+ DeliverBeginFlush();
+ CallWorker(CMD_SEEK);
+ DeliverEndFlush();
+ }
+
+DbgLog((LOG_TRACE, 0, _T("Seek Ended")));
+
+ return S_OK;
}
// IAMOpenProgress
STDMETHODIMP CBaseSplitterFilter::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
{
- CheckPointer(pllTotal, E_POINTER);
- CheckPointer(pllCurrent, E_POINTER);
+ CheckPointer(pllTotal, E_POINTER);
+ CheckPointer(pllCurrent, E_POINTER);
- *pllTotal = 100;
- *pllCurrent = m_nOpenProgress;
+ *pllTotal = 100;
+ *pllCurrent = m_nOpenProgress;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::AbortOperation()
{
- m_fAbort = true;
- return S_OK;
+ m_fAbort = true;
+ return S_OK;
}
// IAMMediaContent
STDMETHODIMP CBaseSplitterFilter::get_AuthorName(BSTR* pbstrAuthorName)
{
- return GetProperty(L"AUTH", pbstrAuthorName);
+ return GetProperty(L"AUTH", pbstrAuthorName);
}
STDMETHODIMP CBaseSplitterFilter::get_Title(BSTR* pbstrTitle)
{
- return GetProperty(L"TITL", pbstrTitle);
+ return GetProperty(L"TITL", pbstrTitle);
}
STDMETHODIMP CBaseSplitterFilter::get_Rating(BSTR* pbstrRating)
{
- return GetProperty(L"RTNG", pbstrRating);
+ return GetProperty(L"RTNG", pbstrRating);
}
STDMETHODIMP CBaseSplitterFilter::get_Description(BSTR* pbstrDescription)
{
- return GetProperty(L"DESC", pbstrDescription);
+ return GetProperty(L"DESC", pbstrDescription);
}
STDMETHODIMP CBaseSplitterFilter::get_Copyright(BSTR* pbstrCopyright)
{
- return GetProperty(L"CPYR", pbstrCopyright);
+ return GetProperty(L"CPYR", pbstrCopyright);
}
// IAMExtendedSeeking
STDMETHODIMP CBaseSplitterFilter::get_ExSeekCapabilities(long* pExCapabilities)
{
- CheckPointer(pExCapabilities, E_POINTER);
- *pExCapabilities = AM_EXSEEK_CANSEEK;
- if(ChapGetCount()) *pExCapabilities |= AM_EXSEEK_MARKERSEEK;
- return S_OK;
+ CheckPointer(pExCapabilities, E_POINTER);
+ *pExCapabilities = AM_EXSEEK_CANSEEK;
+ if(ChapGetCount()) *pExCapabilities |= AM_EXSEEK_MARKERSEEK;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::get_MarkerCount(long* pMarkerCount)
{
- CheckPointer(pMarkerCount, E_POINTER);
- *pMarkerCount = (long)ChapGetCount();
- return S_OK;
+ CheckPointer(pMarkerCount, E_POINTER);
+ *pMarkerCount = (long)ChapGetCount();
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::get_CurrentMarker(long* pCurrentMarker)
{
- CheckPointer(pCurrentMarker, E_POINTER);
- REFERENCE_TIME rt = m_rtCurrent;
- long i = ChapLookup(&rt);
- if(i < 0) return E_FAIL;
- *pCurrentMarker = i + 1;
- return S_OK;
+ CheckPointer(pCurrentMarker, E_POINTER);
+ REFERENCE_TIME rt = m_rtCurrent;
+ long i = ChapLookup(&rt);
+ if(i < 0) return E_FAIL;
+ *pCurrentMarker = i+1;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::GetMarkerTime(long MarkerNum, double* pMarkerTime)
{
- CheckPointer(pMarkerTime, E_POINTER);
- REFERENCE_TIME rt;
- if(FAILED(ChapGet((int)MarkerNum - 1, &rt))) return E_FAIL;
- *pMarkerTime = (double)rt / 10000000;
- return S_OK;
+ CheckPointer(pMarkerTime, E_POINTER);
+ REFERENCE_TIME rt;
+ if(FAILED(ChapGet((int)MarkerNum-1, &rt))) return E_FAIL;
+ *pMarkerTime = (double)rt / 10000000;
+ return S_OK;
}
STDMETHODIMP CBaseSplitterFilter::GetMarkerName(long MarkerNum, BSTR* pbstrMarkerName)
{
- return ChapGet((int)MarkerNum - 1, NULL, pbstrMarkerName);
+ return ChapGet((int)MarkerNum-1, NULL, pbstrMarkerName);
}
// IKeyFrameInfo
STDMETHODIMP CBaseSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
STDMETHODIMP CBaseSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
// IBufferInfo
STDMETHODIMP_(int) CBaseSplitterFilter::GetCount()
{
- CAutoLock cAutoLock(m_pLock);
+ CAutoLock cAutoLock(m_pLock);
- return m_pOutputs.GetCount();
+ return m_pOutputs.GetCount();
}
STDMETHODIMP CBaseSplitterFilter::GetStatus(int i, int& samples, int& size)
{
- CAutoLock cAutoLock(m_pLock);
+ CAutoLock cAutoLock(m_pLock);
- if(POSITION pos = m_pOutputs.FindIndex(i))
- {
- CBaseSplitterOutputPin* pPin = m_pOutputs.GetAt(pos);
- samples = pPin->QueueCount();
- size = pPin->QueueSize();
- return pPin->IsConnected() ? S_OK : S_FALSE;
- }
+ if(POSITION pos = m_pOutputs.FindIndex(i))
+ {
+ CBaseSplitterOutputPin* pPin = m_pOutputs.GetAt(pos);
+ samples = pPin->QueueCount();
+ size = pPin->QueueSize();
+ return pPin->IsConnected() ? S_OK : S_FALSE;
+ }
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
STDMETHODIMP_(DWORD) CBaseSplitterFilter::GetPriority()
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.h b/src/filters/parser/BaseSplitter/BaseSplitter.h
index e8bb0d5f5..68114f7e7 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitter.h
+++ b/src/filters/parser/BaseSplitter/BaseSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -35,416 +35,341 @@
class Packet : public CAtlArray<BYTE>
{
public:
- DWORD TrackNumber;
- BOOL bDiscontinuity, bSyncPoint, bAppendable;
- static const REFERENCE_TIME INVALID_TIME = _I64_MIN;
- REFERENCE_TIME rtStart, rtStop;
- AM_MEDIA_TYPE* pmt;
- Packet()
- {
- pmt = NULL;
- bDiscontinuity = bAppendable = FALSE;
- }
- virtual ~Packet()
- {
- if(pmt) DeleteMediaType(pmt);
- }
- virtual int GetDataSize()
- {
- return GetCount();
- }
- void SetData(const void* ptr, DWORD len)
- {
- SetCount(len);
- memcpy(GetData(), ptr, len);
- }
+ DWORD TrackNumber;
+ BOOL bDiscontinuity, bSyncPoint, bAppendable;
+ static const REFERENCE_TIME INVALID_TIME = _I64_MIN;
+ REFERENCE_TIME rtStart, rtStop;
+ AM_MEDIA_TYPE* pmt;
+ Packet() {pmt = NULL; bDiscontinuity = bAppendable = FALSE;}
+ virtual ~Packet() {if(pmt) DeleteMediaType(pmt);}
+ virtual int GetDataSize() {return GetCount();}
+ void SetData(const void* ptr, DWORD len) {SetCount(len); memcpy(GetData(), ptr, len);}
};
-class CPacketQueue
- : public CCritSec
- , protected CAutoPtrList<Packet>
+class CPacketQueue
+ : public CCritSec
+ , protected CAutoPtrList<Packet>
{
- int m_size;
+ int m_size;
public:
- CPacketQueue();
- void Add(CAutoPtr<Packet> p);
- CAutoPtr<Packet> Remove();
- void RemoveAll();
- int GetCount(), GetSize();
+ CPacketQueue();
+ void Add(CAutoPtr<Packet> p);
+ CAutoPtr<Packet> Remove();
+ void RemoveAll();
+ int GetCount(), GetSize();
};
class CBaseSplitterFilter;
-class CBaseSplitterInputPin
- : public CBasePin
+class CBaseSplitterInputPin
+ : public CBasePin
{
protected:
- CComQIPtr<IAsyncReader> m_pAsyncReader;
+ CComQIPtr<IAsyncReader> m_pAsyncReader;
public:
- CBaseSplitterInputPin(TCHAR* pName, CBaseSplitterFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CBaseSplitterInputPin();
+ CBaseSplitterInputPin(TCHAR* pName, CBaseSplitterFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseSplitterInputPin();
- HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
+ HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT CheckMediaType(const CMediaType* pmt);
HRESULT CheckConnect(IPin* pPin);
HRESULT BreakConnect();
- HRESULT CompleteConnect(IPin* pPin);
+ HRESULT CompleteConnect(IPin* pPin);
- STDMETHODIMP BeginFlush();
- STDMETHODIMP EndFlush();
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
};
-class CBaseSplitterOutputPin
- : public CBaseOutputPin
- , public IDSMPropertyBagImpl
- , protected CAMThread
- , public IMediaSeeking
- , public IBitRateInfo
+class CBaseSplitterOutputPin
+ : public CBaseOutputPin
+ , public IDSMPropertyBagImpl
+ , protected CAMThread
+ , public IMediaSeeking
+ , public IBitRateInfo
{
protected:
- CAtlArray<CMediaType> m_mts;
- int m_nBuffers;
+ CAtlArray<CMediaType> m_mts;
+ int m_nBuffers;
private:
- CPacketQueue m_queue;
+ CPacketQueue m_queue;
- HRESULT m_hrDeliver;
+ HRESULT m_hrDeliver;
- bool m_fFlushing, m_fFlushed;
- CAMEvent m_eEndFlush;
+ bool m_fFlushing, m_fFlushed;
+ CAMEvent m_eEndFlush;
- enum {CMD_EXIT};
+ enum {CMD_EXIT};
DWORD ThreadProc();
- void MakeISCRHappy();
+ void MakeISCRHappy();
- // please only use DeliverPacket from the derived class
+ // please only use DeliverPacket from the derived class
HRESULT GetDeliveryBuffer(IMediaSample** ppSample, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
HRESULT Deliver(IMediaSample* pSample);
- // bitrate stats
+ // bitrate stats
- struct
- {
- UINT64 nTotalBytesDelivered;
- REFERENCE_TIME rtTotalTimeDelivered;
- UINT64 nBytesSinceLastDeliverTime;
- REFERENCE_TIME rtLastDeliverTime;
- DWORD nCurrentBitRate;
- DWORD nAverageBitRate;
- } m_brs;
+ struct
+ {
+ UINT64 nTotalBytesDelivered;
+ REFERENCE_TIME rtTotalTimeDelivered;
+ UINT64 nBytesSinceLastDeliverTime;
+ REFERENCE_TIME rtLastDeliverTime;
+ DWORD nCurrentBitRate;
+ DWORD nAverageBitRate;
+ } m_brs;
protected:
- REFERENCE_TIME m_rtStart;
-
- // override this if you need some second level stream specific demuxing (optional)
- // the default implementation will send the sample as is
- virtual HRESULT DeliverPacket(CAutoPtr<Packet> p);
-
- // IMediaSeeking
-
- STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
- STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(double* pdRate);
- STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+ REFERENCE_TIME m_rtStart;
+
+ // override this if you need some second level stream specific demuxing (optional)
+ // the default implementation will send the sample as is
+ virtual HRESULT DeliverPacket(CAutoPtr<Packet> p);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
public:
- CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
- CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
- virtual ~CBaseSplitterOutputPin();
+ CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
+ CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
+ virtual ~CBaseSplitterOutputPin();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT SetName(LPCWSTR pName);
+ HRESULT SetName(LPCWSTR pName);
HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
HRESULT CheckMediaType(const CMediaType* pmt);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- }
-
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
-
- // Queueing
-
- HANDLE GetThreadHandle()
- {
- ASSERT(m_hThread != NULL);
- return m_hThread;
- }
- void SetThreadPriority(int nPriority)
- {
- if(m_hThread) ::SetThreadPriority(m_hThread, nPriority);
- }
-
- HRESULT Active();
+ CMediaType& CurrentMediaType() {return m_mt;}
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+
+ // Queueing
+
+ HANDLE GetThreadHandle() {ASSERT(m_hThread != NULL); return m_hThread;}
+ void SetThreadPriority(int nPriority) {if(m_hThread) ::SetThreadPriority(m_hThread, nPriority);}
+
+ HRESULT Active();
HRESULT Inactive();
HRESULT DeliverBeginFlush();
- HRESULT DeliverEndFlush();
+ HRESULT DeliverEndFlush();
HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- int QueueCount();
- int QueueSize();
+ int QueueCount();
+ int QueueSize();
HRESULT QueueEndOfStream();
- HRESULT QueuePacket(CAutoPtr<Packet> p);
+ HRESULT QueuePacket(CAutoPtr<Packet> p);
- // returns true for everything which (the lack of) would not block other streams (subtitle streams, basically)
- virtual bool IsDiscontinuous();
+ // returns true for everything which (the lack of) would not block other streams (subtitle streams, basically)
+ virtual bool IsDiscontinuous();
- // returns IStreamsSwitcherInputPin::IsActive(), when it can find one downstream
- bool IsActive();
+ // returns IStreamsSwitcherInputPin::IsActive(), when it can find one downstream
+ bool IsActive();
- // IBitRateInfo
+ // IBitRateInfo
- STDMETHODIMP_(DWORD) GetCurrentBitRate()
- {
- return m_brs.nCurrentBitRate;
- }
- STDMETHODIMP_(DWORD) GetAverageBitRate()
- {
- return m_brs.nAverageBitRate;
- }
+ STDMETHODIMP_(DWORD) GetCurrentBitRate() {return m_brs.nCurrentBitRate;}
+ STDMETHODIMP_(DWORD) GetAverageBitRate() {return m_brs.nAverageBitRate;}
};
-class CBaseSplitterFilter
- : public CBaseFilter
- , public CCritSec
- , public IDSMPropertyBagImpl
- , public IDSMResourceBagImpl
- , public IDSMChapterBagImpl
- , protected CAMThread
- , public IFileSourceFilter
- , public IMediaSeeking
- , public IAMOpenProgress
- , public IAMMediaContent
- , public IAMExtendedSeeking
- , public IKeyFrameInfo
- , public IBufferInfo
+class CBaseSplitterFilter
+ : public CBaseFilter
+ , public CCritSec
+ , public IDSMPropertyBagImpl
+ , public IDSMResourceBagImpl
+ , public IDSMChapterBagImpl
+ , protected CAMThread
+ , public IFileSourceFilter
+ , public IMediaSeeking
+ , public IAMOpenProgress
+ , public IAMMediaContent
+ , public IAMExtendedSeeking
+ , public IKeyFrameInfo
+ , public IBufferInfo
{
- CCritSec m_csPinMap;
- CAtlMap<DWORD, CBaseSplitterOutputPin*> m_pPinMap;
+ CCritSec m_csPinMap;
+ CAtlMap<DWORD, CBaseSplitterOutputPin*> m_pPinMap;
- CCritSec m_csmtnew;
- CAtlMap<DWORD, CMediaType> m_mtnew;
+ CCritSec m_csmtnew;
+ CAtlMap<DWORD, CMediaType> m_mtnew;
- CAutoPtrList<CBaseSplitterOutputPin> m_pRetiredOutputs;
+ CAutoPtrList<CBaseSplitterOutputPin> m_pRetiredOutputs;
- CComQIPtr<ISyncReader> m_pSyncReader;
+ CComQIPtr<ISyncReader> m_pSyncReader;
protected:
- CStringW m_fn;
+ CStringW m_fn;
- CAutoPtr<CBaseSplitterInputPin> m_pInput;
- CAutoPtrList<CBaseSplitterOutputPin> m_pOutputs;
+ CAutoPtr<CBaseSplitterInputPin> m_pInput;
+ CAutoPtrList<CBaseSplitterOutputPin> m_pOutputs;
- CBaseSplitterOutputPin* GetOutputPin(DWORD TrackNum);
- DWORD GetOutputTrackNum(CBaseSplitterOutputPin* pPin);
- HRESULT AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitterOutputPin> pPin);
- HRESULT RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, const AM_MEDIA_TYPE* pmt);
- virtual HRESULT DeleteOutputs();
- virtual HRESULT CreateOutputs(IAsyncReader* pAsyncReader) = 0; // override this ...
- virtual LPCTSTR GetPartFilename(IAsyncReader* pAsyncReader);
+ CBaseSplitterOutputPin* GetOutputPin(DWORD TrackNum);
+ DWORD GetOutputTrackNum(CBaseSplitterOutputPin* pPin);
+ HRESULT AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitterOutputPin> pPin);
+ HRESULT RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, const AM_MEDIA_TYPE* pmt);
+ virtual HRESULT DeleteOutputs();
+ virtual HRESULT CreateOutputs(IAsyncReader* pAsyncReader) = 0; // override this ...
+ virtual LPCTSTR GetPartFilename(IAsyncReader* pAsyncReader);
- LONGLONG m_nOpenProgress;
- bool m_fAbort;
+ LONGLONG m_nOpenProgress;
+ bool m_fAbort;
- REFERENCE_TIME m_rtDuration; // derived filter should set this at the end of CreateOutputs
- REFERENCE_TIME m_rtStart, m_rtStop, m_rtCurrent, m_rtNewStart, m_rtNewStop;
- double m_dRate;
+ REFERENCE_TIME m_rtDuration; // derived filter should set this at the end of CreateOutputs
+ REFERENCE_TIME m_rtStart, m_rtStop, m_rtCurrent, m_rtNewStart, m_rtNewStop;
+ double m_dRate;
- CAtlList<UINT64> m_bDiscontinuitySent;
- CAtlList<CBaseSplitterOutputPin*> m_pActivePins;
+ CAtlList<UINT64> m_bDiscontinuitySent;
+ CAtlList<CBaseSplitterOutputPin*> m_pActivePins;
- CAMEvent m_eEndFlush;
- bool m_fFlushing;
+ CAMEvent m_eEndFlush;
+ bool m_fFlushing;
- void DeliverBeginFlush();
- void DeliverEndFlush();
- HRESULT DeliverPacket(CAutoPtr<Packet> p);
+ void DeliverBeginFlush();
+ void DeliverEndFlush();
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
- DWORD m_priority;
+ DWORD m_priority;
- CFontInstaller m_fontinst;
+ CFontInstaller m_fontinst;
protected:
- enum {CMD_EXIT, CMD_SEEK};
+ enum {CMD_EXIT, CMD_SEEK};
DWORD ThreadProc();
- // ... and also override all these too
- virtual bool DemuxInit() = 0;
- virtual void DemuxSeek(REFERENCE_TIME rt) = 0;
- virtual bool DemuxLoop() = 0;
- virtual bool BuildPlaylist(LPCTSTR pszFileName, CAtlList<CHdmvClipInfo::PlaylistItem>& Items)
- {
- return false;
- };
+ // ... and also override all these too
+ virtual bool DemuxInit() = 0;
+ virtual void DemuxSeek(REFERENCE_TIME rt) = 0;
+ virtual bool DemuxLoop() = 0;
+ virtual bool BuildPlaylist(LPCTSTR pszFileName, CAtlList<CHdmvClipInfo::PlaylistItem>& Items) { return false; };
public:
- CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
- virtual ~CBaseSplitterFilter();
+ CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CBaseSplitterFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- bool IsAnyPinDrying();
+ bool IsAnyPinDrying();
- HRESULT BreakConnect(PIN_DIRECTION dir, CBasePin* pPin);
- HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin);
+ HRESULT BreakConnect(PIN_DIRECTION dir, CBasePin* pPin);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin);
- int GetPinCount();
- CBasePin* GetPin(int n);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
- STDMETHODIMP Stop();
- STDMETHODIMP Pause();
- STDMETHODIMP Run(REFERENCE_TIME tStart);
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
- // IFileSourceFilter
+ // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
- // IMediaSeeking
+ // IMediaSeeking
- STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
- STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(double* pdRate);
- STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
protected:
- friend class CBaseSplitterOutputPin;
- virtual HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ friend class CBaseSplitterOutputPin;
+ virtual HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
private:
- REFERENCE_TIME m_rtLastStart, m_rtLastStop;
- CAtlList<void*> m_LastSeekers;
+ REFERENCE_TIME m_rtLastStart, m_rtLastStop;
+ CAtlList<void*> m_LastSeekers;
public:
- // IAMOpenProgress
-
- STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
- STDMETHODIMP AbortOperation();
-
- // IDispatch
-
- STDMETHODIMP GetTypeInfoCount(UINT* pctinfo)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr)
- {
- return E_NOTIMPL;
- }
-
- // IAMMediaContent
-
- STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName);
- STDMETHODIMP get_Title(BSTR* pbstrTitle);
- STDMETHODIMP get_Rating(BSTR* pbstrRating);
- STDMETHODIMP get_Description(BSTR* pbstrDescription);
- STDMETHODIMP get_Copyright(BSTR* pbstrCopyright);
- STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText)
- {
- return E_NOTIMPL;
- }
-
- // IAMExtendedSeeking
-
- STDMETHODIMP get_ExSeekCapabilities(long* pExCapabilities);
- STDMETHODIMP get_MarkerCount(long* pMarkerCount);
- STDMETHODIMP get_CurrentMarker(long* pCurrentMarker);
- STDMETHODIMP GetMarkerTime(long MarkerNum, double* pMarkerTime);
- STDMETHODIMP GetMarkerName(long MarkerNum, BSTR* pbstrMarkerName);
- STDMETHODIMP put_PlaybackSpeed(double Speed)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_PlaybackSpeed(double* pSpeed)
- {
- return E_NOTIMPL;
- }
-
- // IKeyFrameInfo
-
- STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
-
- // IBufferInfo
-
- STDMETHODIMP_(int) GetCount();
- STDMETHODIMP GetStatus(int i, int& samples, int& size);
- STDMETHODIMP_(DWORD) GetPriority();
+ // IAMOpenProgress
+
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+ STDMETHODIMP AbortOperation();
+
+ // IDispatch
+
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
+ STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
+
+ // IAMMediaContent
+
+ STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName);
+ STDMETHODIMP get_Title(BSTR* pbstrTitle);
+ STDMETHODIMP get_Rating(BSTR* pbstrRating);
+ STDMETHODIMP get_Description(BSTR* pbstrDescription);
+ STDMETHODIMP get_Copyright(BSTR* pbstrCopyright);
+ STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
+
+ // IAMExtendedSeeking
+
+ STDMETHODIMP get_ExSeekCapabilities(long* pExCapabilities);
+ STDMETHODIMP get_MarkerCount(long* pMarkerCount);
+ STDMETHODIMP get_CurrentMarker(long* pCurrentMarker);
+ STDMETHODIMP GetMarkerTime(long MarkerNum, double* pMarkerTime);
+ STDMETHODIMP GetMarkerName(long MarkerNum, BSTR* pbstrMarkerName);
+ STDMETHODIMP put_PlaybackSpeed(double Speed) {return E_NOTIMPL;}
+ STDMETHODIMP get_PlaybackSpeed(double* pSpeed) {return E_NOTIMPL;}
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+
+ // IBufferInfo
+
+ STDMETHODIMP_(int) GetCount();
+ STDMETHODIMP GetStatus(int i, int& samples, int& size);
+ STDMETHODIMP_(DWORD) GetPriority();
};
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp
index 577bafc8e..64571d736 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFile.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,228 +28,217 @@
//
CBaseSplitterFile::CBaseSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, int cachelen, bool fRandomAccess, bool fStreaming)
- : m_pAsyncReader(pAsyncReader)
- , m_fStreaming(false)
- , m_fRandomAccess(false)
- , m_pos(0), m_len(0)
- , m_bitbuff(0), m_bitlen(0)
- , m_cachepos(0), m_cachelen(0)
+ : m_pAsyncReader(pAsyncReader)
+ , m_fStreaming(false)
+ , m_fRandomAccess(false)
+ , m_pos(0), m_len(0)
+ , m_bitbuff(0), m_bitlen(0)
+ , m_cachepos(0), m_cachelen(0)
{
- if(!m_pAsyncReader)
- {
- hr = E_UNEXPECTED;
- return;
- }
-
- LONGLONG total = 0, available;
- hr = m_pAsyncReader->Length(&total, &available);
-
- m_fStreaming = total == 0 && available > 0;
- m_fRandomAccess = total > 0 && total == available;
- m_len = total;
-
- if(FAILED(hr) || fRandomAccess && !m_fRandomAccess || !fStreaming && m_fStreaming || m_len < 0)
- {
- hr = E_FAIL;
- return;
- }
-
- if(!SetCacheSize(cachelen))
- {
- hr = E_OUTOFMEMORY;
- return;
- }
-
- hr = S_OK;
+ if(!m_pAsyncReader) {hr = E_UNEXPECTED; return;}
+
+ LONGLONG total = 0, available;
+ hr = m_pAsyncReader->Length(&total, &available);
+
+ m_fStreaming = total == 0 && available > 0;
+ m_fRandomAccess = total > 0 && total == available;
+ m_len = total;
+
+ if(FAILED(hr) || fRandomAccess && !m_fRandomAccess || !fStreaming && m_fStreaming || m_len < 0)
+ {
+ hr = E_FAIL;
+ return;
+ }
+
+ if(!SetCacheSize(cachelen))
+ {
+ hr = E_OUTOFMEMORY;
+ return;
+ }
+
+ hr = S_OK;
}
bool CBaseSplitterFile::SetCacheSize(int cachelen)
{
- m_pCache.Free();
- m_cachetotal = 0;
- m_pCache.Allocate((size_t)cachelen);
- if(!m_pCache) return false;
- m_cachetotal = cachelen;
- m_cachelen = 0;
- return true;
+ m_pCache.Free();
+ m_cachetotal = 0;
+ m_pCache.Allocate((size_t)cachelen);
+ if(!m_pCache) return false;
+ m_cachetotal = cachelen;
+ m_cachelen = 0;
+ return true;
}
__int64 CBaseSplitterFile::GetPos()
{
- return m_pos - (m_bitlen >> 3);
+ return m_pos - (m_bitlen>>3);
}
__int64 CBaseSplitterFile::GetAvailable()
{
- LONGLONG total, available = 0;
- m_pAsyncReader->Length(&total, &available);
- return available;
+ LONGLONG total, available = 0;
+ m_pAsyncReader->Length(&total, &available);
+ return available;
}
__int64 CBaseSplitterFile::GetLength(bool fUpdate)
{
- if(m_fStreaming)
- {
- m_len = GetAvailable();
- }
- else if(fUpdate)
- {
- LONGLONG total = 0, available;
- m_pAsyncReader->Length(&total, &available);
- m_len = total;
- }
-
- return m_len;
+ if(m_fStreaming)
+ {
+ m_len = GetAvailable();
+ }
+ else if(fUpdate)
+ {
+ LONGLONG total = 0, available;
+ m_pAsyncReader->Length(&total, &available);
+ m_len = total;
+ }
+
+ return m_len;
}
void CBaseSplitterFile::Seek(__int64 pos)
{
- __int64 len = GetLength();
- m_pos = min(max(pos, 0), len);
- BitFlush();
+ __int64 len = GetLength();
+ m_pos = min(max(pos, 0), len);
+ BitFlush();
}
HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len)
{
- CheckPointer(m_pAsyncReader, E_NOINTERFACE);
-
- HRESULT hr = S_OK;
-
- if(!m_fRandomAccess)
- {
- LONGLONG total = 0, available = -1;
- m_pAsyncReader->Length(&total, &available);
- if(total == available)
- {
- m_fRandomAccess = true;
- OnComplete();
- }
- }
-
- if(m_cachetotal == 0 || !m_pCache)
- {
- hr = m_pAsyncReader->SyncRead(m_pos, (long)len, pData);
- m_pos += len;
- return hr;
- }
-
- BYTE* pCache = m_pCache;
-
- if(m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen)
- {
- __int64 minlen = min(len, m_cachelen - (m_pos - m_cachepos));
-
- memcpy(pData, &pCache[m_pos - m_cachepos], (size_t)minlen);
-
- len -= minlen;
- m_pos += minlen;
- pData += minlen;
- }
-
- while(len > m_cachetotal)
- {
- hr = m_pAsyncReader->SyncRead(m_pos, (long)m_cachetotal, pData);
- if(S_OK != hr) return hr;
-
- len -= m_cachetotal;
- m_pos += m_cachetotal;
- pData += m_cachetotal;
- }
-
- while(len > 0)
- {
- __int64 tmplen = GetLength();
- __int64 maxlen = min(tmplen - m_pos, m_cachetotal);
- __int64 minlen = min(len, maxlen);
- if(minlen <= 0) return S_FALSE;
-
- hr = m_pAsyncReader->SyncRead(m_pos, (long)maxlen, pCache);
- if(S_OK != hr) return hr;
-
- m_cachepos = m_pos;
- m_cachelen = maxlen;
-
- memcpy(pData, pCache, (size_t)minlen);
-
- len -= minlen;
- m_pos += minlen;
- pData += minlen;
- }
-
- return hr;
+ CheckPointer(m_pAsyncReader, E_NOINTERFACE);
+
+ HRESULT hr = S_OK;
+
+ if(!m_fRandomAccess)
+ {
+ LONGLONG total = 0, available = -1;
+ m_pAsyncReader->Length(&total, &available);
+ if(total == available) {m_fRandomAccess = true; OnComplete();}
+ }
+
+ if(m_cachetotal == 0 || !m_pCache)
+ {
+ hr = m_pAsyncReader->SyncRead(m_pos, (long)len, pData);
+ m_pos += len;
+ return hr;
+ }
+
+ BYTE* pCache = m_pCache;
+
+ if(m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen)
+ {
+ __int64 minlen = min(len, m_cachelen - (m_pos - m_cachepos));
+
+ memcpy(pData, &pCache[m_pos - m_cachepos], (size_t)minlen);
+
+ len -= minlen;
+ m_pos += minlen;
+ pData += minlen;
+ }
+
+ while(len > m_cachetotal)
+ {
+ hr = m_pAsyncReader->SyncRead(m_pos, (long)m_cachetotal, pData);
+ if(S_OK != hr) return hr;
+
+ len -= m_cachetotal;
+ m_pos += m_cachetotal;
+ pData += m_cachetotal;
+ }
+
+ while(len > 0)
+ {
+ __int64 tmplen = GetLength();
+ __int64 maxlen = min(tmplen - m_pos, m_cachetotal);
+ __int64 minlen = min(len, maxlen);
+ if(minlen <= 0) return S_FALSE;
+
+ hr = m_pAsyncReader->SyncRead(m_pos, (long)maxlen, pCache);
+ if(S_OK != hr) return hr;
+
+ m_cachepos = m_pos;
+ m_cachelen = maxlen;
+
+ memcpy(pData, pCache, (size_t)minlen);
+
+ len -= minlen;
+ m_pos += minlen;
+ pData += minlen;
+ }
+
+ return hr;
}
UINT64 CBaseSplitterFile::BitRead(int nBits, bool fPeek)
{
- ASSERT(nBits >= 0 && nBits <= 64);
+ ASSERT(nBits >= 0 && nBits <= 64);
- while(m_bitlen < nBits)
- {
- m_bitbuff <<= 8;
- if(S_OK != Read((BYTE*)&m_bitbuff, 1))
- {
- return 0; // EOF? // ASSERT(0);
- }
- m_bitlen += 8;
- }
+ while(m_bitlen < nBits)
+ {
+ m_bitbuff <<= 8;
+ if(S_OK != Read((BYTE*)&m_bitbuff, 1)) {return 0;} // EOF? // ASSERT(0);
+ m_bitlen += 8;
+ }
- int bitlen = m_bitlen - nBits;
+ int bitlen = m_bitlen - nBits;
- UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
+ UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
- if(!fPeek)
- {
- m_bitbuff &= ((1ui64 << bitlen) - 1);
- m_bitlen = bitlen;
- }
+ if(!fPeek)
+ {
+ m_bitbuff &= ((1ui64 << bitlen) - 1);
+ m_bitlen = bitlen;
+ }
- return ret;
+ return ret;
}
void CBaseSplitterFile::BitByteAlign()
{
- m_bitlen &= ~7;
+ m_bitlen &= ~7;
}
void CBaseSplitterFile::BitFlush()
{
- m_bitlen = 0;
+ m_bitlen = 0;
}
HRESULT CBaseSplitterFile::ByteRead(BYTE* pData, __int64 len)
{
Seek(GetPos());
- return Read(pData, len);
+ return Read(pData, len);
}
UINT64 CBaseSplitterFile::UExpGolombRead()
{
- int n = -1;
- for(BYTE b = 0; !b; n++) b = BitRead(1);
- return (1ui64 << n) - 1 + BitRead(n);
+ int n = -1;
+ for(BYTE b = 0; !b; n++) b = BitRead(1);
+ return (1ui64 << n) - 1 + BitRead(n);
}
INT64 CBaseSplitterFile::SExpGolombRead()
{
- UINT64 k = UExpGolombRead();
- return ((k & 1) ? 1 : -1) * ((k + 1) >> 1);
+ UINT64 k = UExpGolombRead();
+ return ((k&1) ? 1 : -1) * ((k + 1) >> 1);
}
HRESULT CBaseSplitterFile::HasMoreData(__int64 len, DWORD ms)
{
- __int64 available = GetLength() - GetPos();
+ __int64 available = GetLength() - GetPos();
- if(!m_fStreaming)
- {
- return available < 1 ? E_FAIL : S_OK;
- }
+ if(!m_fStreaming)
+ {
+ return available < 1 ? E_FAIL : S_OK;
+ }
- if(available < len)
- {
- if(ms > 0) Sleep(ms);
- return S_FALSE;
- }
+ if(available < len)
+ {
+ if(ms > 0) Sleep(ms);
+ return S_FALSE;
+ }
- return S_OK;
+ return S_OK;
}
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFile.h b/src/filters/parser/BaseSplitter/BaseSplitterFile.h
index 88c544a6b..e7498223e 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFile.h
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFile.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,51 +27,42 @@
class CBaseSplitterFile
{
- CComPtr<IAsyncReader> m_pAsyncReader;
- CAutoVectorPtr<BYTE> m_pCache;
- __int64 m_cachepos, m_cachelen, m_cachetotal;
+ CComPtr<IAsyncReader> m_pAsyncReader;
+ CAutoVectorPtr<BYTE> m_pCache;
+ __int64 m_cachepos, m_cachelen, m_cachetotal;
- bool m_fStreaming, m_fRandomAccess;
- __int64 m_pos, m_len;
+ bool m_fStreaming, m_fRandomAccess;
+ __int64 m_pos, m_len;
- virtual HRESULT Read(BYTE* pData, __int64 len); // use ByteRead
+ virtual HRESULT Read(BYTE* pData, __int64 len); // use ByteRead
protected:
- UINT64 m_bitbuff;
- int m_bitlen;
+ UINT64 m_bitbuff;
+ int m_bitlen;
- virtual void OnComplete() {}
+ virtual void OnComplete() {}
public:
- CBaseSplitterFile(IAsyncReader* pReader, HRESULT& hr, int cachelen = DEFAULT_CACHE_LENGTH, bool fRandomAccess = true, bool fStreaming = false);
- virtual ~CBaseSplitterFile() {}
+ CBaseSplitterFile(IAsyncReader* pReader, HRESULT& hr, int cachelen = DEFAULT_CACHE_LENGTH, bool fRandomAccess = true, bool fStreaming = false);
+ virtual ~CBaseSplitterFile() {}
- bool SetCacheSize(int cachelen = DEFAULT_CACHE_LENGTH);
+ bool SetCacheSize(int cachelen = DEFAULT_CACHE_LENGTH);
- __int64 GetPos();
- __int64 GetAvailable();
- __int64 GetLength(bool fUpdate = false);
- __int64 GetRemaining()
- {
- return max(0, GetLength() - GetPos());
- }
- virtual void Seek(__int64 pos);
+ __int64 GetPos();
+ __int64 GetAvailable();
+ __int64 GetLength(bool fUpdate = false);
+ __int64 GetRemaining() {return max(0, GetLength() - GetPos());}
+ virtual void Seek(__int64 pos);
- UINT64 UExpGolombRead();
- INT64 SExpGolombRead();
+ UINT64 UExpGolombRead();
+ INT64 SExpGolombRead();
- UINT64 BitRead(int nBits, bool fPeek = false);
- void BitByteAlign(), BitFlush();
- HRESULT ByteRead(BYTE* pData, __int64 len);
+ UINT64 BitRead(int nBits, bool fPeek = false);
+ void BitByteAlign(), BitFlush();
+ HRESULT ByteRead(BYTE* pData, __int64 len);
- bool IsStreaming() const
- {
- return m_fStreaming;
- }
- bool IsRandomAccess() const
- {
- return m_fRandomAccess;
- }
+ bool IsStreaming() const {return m_fStreaming;}
+ bool IsRandomAccess() const {return m_fRandomAccess;}
- HRESULT HasMoreData(__int64 len = 1, DWORD ms = 1);
+ HRESULT HasMoreData(__int64 len = 1, DWORD ms = 1);
};
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
index 16519f316..acb44acef 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -34,9 +34,9 @@
//
CBaseSplitterFileEx::CBaseSplitterFileEx(IAsyncReader* pReader, HRESULT& hr, int cachelen, bool fRandomAccess, bool fStreaming)
- : CBaseSplitterFile(pReader, hr, cachelen, fRandomAccess, fStreaming)
- , m_tslen(0)
- , m_rtPTSOffset(0)
+ : CBaseSplitterFile(pReader, hr, cachelen, fRandomAccess, fStreaming)
+ , m_tslen(0)
+ ,m_rtPTSOffset(0)
{
}
@@ -48,16 +48,16 @@ CBaseSplitterFileEx::~CBaseSplitterFileEx()
bool CBaseSplitterFileEx::NextMpegStartCode(BYTE& code, __int64 len)
{
- BitByteAlign();
- DWORD dw = -1;
- do
- {
- if(len-- == 0 || !GetRemaining()) return(false);
- dw = (dw << 8) | (BYTE)BitRead(8);
- }
- while((dw & 0xffffff00) != 0x00000100);
- code = (BYTE)(dw & 0xff);
- return(true);
+ BitByteAlign();
+ DWORD dw = -1;
+ do
+ {
+ if(len-- == 0 || !GetRemaining()) return(false);
+ dw = (dw << 8) | (BYTE)BitRead(8);
+ }
+ while((dw&0xffffff00) != 0x00000100);
+ code = (BYTE)(dw&0xff);
+ return(true);
}
//
@@ -66,651 +66,602 @@ bool CBaseSplitterFileEx::NextMpegStartCode(BYTE& code, __int64 len)
bool CBaseSplitterFileEx::Read(pshdr& h)
{
- memset(&h, 0, sizeof(h));
-
- BYTE b = (BYTE)BitRead(8, true);
-
- if((b & 0xf1) == 0x21)
- {
- h.type = mpeg1;
-
- EXECUTE_ASSERT(BitRead(4) == 2);
-
- h.scr = 0;
- h.scr |= BitRead(3) << 30;
- MARKER; // 32..30
- h.scr |= BitRead(15) << 15;
- MARKER; // 29..15
- h.scr |= BitRead(15);
- MARKER;
- MARKER; // 14..0
- h.bitrate = BitRead(22);
- MARKER;
- }
- else if((b & 0xc4) == 0x44)
- {
- h.type = mpeg2;
-
- EXECUTE_ASSERT(BitRead(2) == 1);
-
- h.scr = 0;
- h.scr |= BitRead(3) << 30;
- MARKER; // 32..30
- h.scr |= BitRead(15) << 15;
- MARKER; // 29..15
- h.scr |= BitRead(15);
- MARKER; // 14..0
- h.scr = (h.scr * 300 + BitRead(9)) * 10 / 27;
- MARKER;
- h.bitrate = BitRead(22);
- MARKER;
- MARKER;
- BitRead(5); // reserved
- UINT64 stuffing = BitRead(3);
- while(stuffing-- > 0) EXECUTE_ASSERT(BitRead(8) == 0xff);
- }
- else
- {
- return(false);
- }
-
- h.bitrate *= 400;
-
- return(true);
+ memset(&h, 0, sizeof(h));
+
+ BYTE b = (BYTE)BitRead(8, true);
+
+ if((b&0xf1) == 0x21)
+ {
+ h.type = mpeg1;
+
+ EXECUTE_ASSERT(BitRead(4) == 2);
+
+ h.scr = 0;
+ h.scr |= BitRead(3) << 30; MARKER; // 32..30
+ h.scr |= BitRead(15) << 15; MARKER; // 29..15
+ h.scr |= BitRead(15); MARKER; MARKER; // 14..0
+ h.bitrate = BitRead(22); MARKER;
+ }
+ else if((b&0xc4) == 0x44)
+ {
+ h.type = mpeg2;
+
+ EXECUTE_ASSERT(BitRead(2) == 1);
+
+ h.scr = 0;
+ h.scr |= BitRead(3) << 30; MARKER; // 32..30
+ h.scr |= BitRead(15) << 15; MARKER; // 29..15
+ h.scr |= BitRead(15); MARKER; // 14..0
+ h.scr = (h.scr*300 + BitRead(9)) * 10 / 27; MARKER;
+ h.bitrate = BitRead(22); MARKER; MARKER;
+ BitRead(5); // reserved
+ UINT64 stuffing = BitRead(3);
+ while(stuffing-- > 0) EXECUTE_ASSERT(BitRead(8) == 0xff);
+ }
+ else
+ {
+ return(false);
+ }
+
+ h.bitrate *= 400;
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(pssyshdr& h)
{
- memset(&h, 0, sizeof(h));
-
- WORD len = (WORD)BitRead(16);
- MARKER;
- h.rate_bound = (DWORD)BitRead(22);
- MARKER;
- h.audio_bound = (BYTE)BitRead(6);
- h.fixed_rate = !!BitRead(1);
- h.csps = !!BitRead(1);
- h.sys_audio_loc_flag = !!BitRead(1);
- h.sys_video_loc_flag = !!BitRead(1);
- MARKER;
- h.video_bound = (BYTE)BitRead(5);
-
- EXECUTE_ASSERT((BitRead(8) & 0x7f) == 0x7f); // reserved (should be 0xff, but not in reality)
-
- for(len -= 6; len > 3; len -= 3) // TODO: also store these, somewhere, if needed
- {
- UINT64 stream_id = BitRead(8);
- EXECUTE_ASSERT(BitRead(2) == 3);
- UINT64 p_std_buff_size_bound = (BitRead(1) ? 1024 : 128) * BitRead(13);
- }
-
- return(true);
+ memset(&h, 0, sizeof(h));
+
+ WORD len = (WORD)BitRead(16); MARKER;
+ h.rate_bound = (DWORD)BitRead(22); MARKER;
+ h.audio_bound = (BYTE)BitRead(6);
+ h.fixed_rate = !!BitRead(1);
+ h.csps = !!BitRead(1);
+ h.sys_audio_loc_flag = !!BitRead(1);
+ h.sys_video_loc_flag = !!BitRead(1); MARKER;
+ h.video_bound = (BYTE)BitRead(5);
+
+ EXECUTE_ASSERT((BitRead(8)&0x7f) == 0x7f); // reserved (should be 0xff, but not in reality)
+
+ for(len -= 6; len > 3; len -= 3) // TODO: also store these, somewhere, if needed
+ {
+ UINT64 stream_id = BitRead(8);
+ EXECUTE_ASSERT(BitRead(2) == 3);
+ UINT64 p_std_buff_size_bound = (BitRead(1)?1024:128)*BitRead(13);
+ }
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code)
{
- memset(&h, 0, sizeof(h));
-
- if(!(code >= 0xbd && code < 0xf0 || code == 0xfd)) // 0xfd => blu-ray (.m2ts)
- return(false);
-
- h.len = (WORD)BitRead(16);
-
- if(code == 0xbe || code == 0xbf)
- return(true);
-
- // mpeg1 stuffing (ff ff .. , max 16x)
- for(int i = 0; i < 16 && BitRead(8, true) == 0xff; i++)
- {
- BitRead(8);
- if(h.len) h.len--;
- }
-
- h.type = (BYTE)BitRead(2, true) == mpeg2 ? mpeg2 : mpeg1;
-
- if(h.type == mpeg1)
- {
- BYTE b = (BYTE)BitRead(2);
-
- if(b == 1)
- {
- h.std_buff_size = (BitRead(1) ? 1024 : 128) * BitRead(13);
- if(h.len) h.len -= 2;
- b = (BYTE)BitRead(2);
- }
-
- if(b == 0)
- {
- h.fpts = (BYTE)BitRead(1);
- h.fdts = (BYTE)BitRead(1);
- }
- }
- else if(h.type == mpeg2)
- {
- EXECUTE_ASSERT(BitRead(2) == mpeg2);
- h.scrambling = (BYTE)BitRead(2);
- h.priority = (BYTE)BitRead(1);
- h.alignment = (BYTE)BitRead(1);
- h.copyright = (BYTE)BitRead(1);
- h.original = (BYTE)BitRead(1);
- h.fpts = (BYTE)BitRead(1);
- h.fdts = (BYTE)BitRead(1);
- h.escr = (BYTE)BitRead(1);
- h.esrate = (BYTE)BitRead(1);
- h.dsmtrickmode = (BYTE)BitRead(1);
- h.morecopyright = (BYTE)BitRead(1);
- h.crc = (BYTE)BitRead(1);
- h.extension = (BYTE)BitRead(1);
- h.hdrlen = (BYTE)BitRead(8);
- }
- else
- {
- if(h.len) while(h.len-- > 0) BitRead(8);
- return(false);
- }
-
- if(h.fpts)
- {
- if(h.type == mpeg2)
- {
- BYTE b = (BYTE)BitRead(4);
- if(!(h.fdts && b == 3 || !h.fdts && b == 2))
- {
- ASSERT(0);
- return(false);
- }
- }
-
- h.pts = 0;
- h.pts |= BitRead(3) << 30;
- MARKER; // 32..30
- h.pts |= BitRead(15) << 15;
- MARKER; // 29..15
- h.pts |= BitRead(15);
- MARKER; // 14..0
- h.pts = 10000 * h.pts / 90 + m_rtPTSOffset;
- }
-
- if(h.fdts)
- {
- if((BYTE)BitRead(4) != 1)
- {
- ASSERT(0);
- return(false);
- }
-
- h.dts = 0;
- h.dts |= BitRead(3) << 30;
- MARKER; // 32..30
- h.dts |= BitRead(15) << 15;
- MARKER; // 29..15
- h.dts |= BitRead(15);
- MARKER; // 14..0
- h.dts = 10000 * h.dts / 90 + m_rtPTSOffset;
- }
-
- // skip to the end of header
-
- if(h.type == mpeg1)
- {
- if(!h.fpts && !h.fdts && BitRead(4) != 0xf)
- {
- /*ASSERT(0);*/ return(false);
- }
-
- if(h.len)
- {
- h.len--;
- if(h.pts) h.len -= 4;
- if(h.dts) h.len -= 5;
- }
- }
-
- if(h.type == mpeg2)
- {
- if(h.len) h.len -= 3 + h.hdrlen;
-
- int left = h.hdrlen;
- if(h.fpts) left -= 5;
- if(h.fdts) left -= 5;
- while(left-- > 0) BitRead(8);
- /*
- // mpeg2 stuffing (ff ff .. , max 32x)
- while(BitRead(8, true) == 0xff) {BitRead(8); if(h.len) h.len--;}
- Seek(GetPos()); // put last peeked byte back for Read()
-
- // FIXME: this doesn't seems to be here,
- // infact there can be ff's as part of the data
- // right at the beginning of the packet, which
- // we should not skip...
- */
- }
+ memset(&h, 0, sizeof(h));
+
+ if(!(code >= 0xbd && code < 0xf0 || code == 0xfd)) // 0xfd => blu-ray (.m2ts)
+ return(false);
+
+ h.len = (WORD)BitRead(16);
+
+ if(code == 0xbe || code == 0xbf)
+ return(true);
+
+ // mpeg1 stuffing (ff ff .. , max 16x)
+ for(int i = 0; i < 16 && BitRead(8, true) == 0xff; i++)
+ {
+ BitRead(8);
+ if(h.len) h.len--;
+ }
+
+ h.type = (BYTE)BitRead(2, true) == mpeg2 ? mpeg2 : mpeg1;
+
+ if(h.type == mpeg1)
+ {
+ BYTE b = (BYTE)BitRead(2);
+
+ if(b == 1)
+ {
+ h.std_buff_size = (BitRead(1)?1024:128)*BitRead(13);
+ if(h.len) h.len -= 2;
+ b = (BYTE)BitRead(2);
+ }
+
+ if(b == 0)
+ {
+ h.fpts = (BYTE)BitRead(1);
+ h.fdts = (BYTE)BitRead(1);
+ }
+ }
+ else if(h.type == mpeg2)
+ {
+ EXECUTE_ASSERT(BitRead(2) == mpeg2);
+ h.scrambling = (BYTE)BitRead(2);
+ h.priority = (BYTE)BitRead(1);
+ h.alignment = (BYTE)BitRead(1);
+ h.copyright = (BYTE)BitRead(1);
+ h.original = (BYTE)BitRead(1);
+ h.fpts = (BYTE)BitRead(1);
+ h.fdts = (BYTE)BitRead(1);
+ h.escr = (BYTE)BitRead(1);
+ h.esrate = (BYTE)BitRead(1);
+ h.dsmtrickmode = (BYTE)BitRead(1);
+ h.morecopyright = (BYTE)BitRead(1);
+ h.crc = (BYTE)BitRead(1);
+ h.extension = (BYTE)BitRead(1);
+ h.hdrlen = (BYTE)BitRead(8);
+ }
+ else
+ {
+ if(h.len) while(h.len-- > 0) BitRead(8);
+ return(false);
+ }
+
+ if(h.fpts)
+ {
+ if(h.type == mpeg2)
+ {
+ BYTE b = (BYTE)BitRead(4);
+ if(!(h.fdts && b == 3 || !h.fdts && b == 2)) {ASSERT(0); return(false);}
+ }
+
+ h.pts = 0;
+ h.pts |= BitRead(3) << 30; MARKER; // 32..30
+ h.pts |= BitRead(15) << 15; MARKER; // 29..15
+ h.pts |= BitRead(15); MARKER; // 14..0
+ h.pts = 10000*h.pts/90 + m_rtPTSOffset;
+ }
+
+ if(h.fdts)
+ {
+ if((BYTE)BitRead(4) != 1) {ASSERT(0); return(false);}
+
+ h.dts = 0;
+ h.dts |= BitRead(3) << 30; MARKER; // 32..30
+ h.dts |= BitRead(15) << 15; MARKER; // 29..15
+ h.dts |= BitRead(15); MARKER; // 14..0
+ h.dts = 10000*h.dts/90 + m_rtPTSOffset;
+ }
+
+ // skip to the end of header
+
+ if(h.type == mpeg1)
+ {
+ if(!h.fpts && !h.fdts && BitRead(4) != 0xf) {/*ASSERT(0);*/ return(false);}
+
+ if(h.len)
+ {
+ h.len--;
+ if(h.pts) h.len -= 4;
+ if(h.dts) h.len -= 5;
+ }
+ }
+
+ if(h.type == mpeg2)
+ {
+ if(h.len) h.len -= 3+h.hdrlen;
+
+ int left = h.hdrlen;
+ if(h.fpts) left -= 5;
+ if(h.fdts) left -= 5;
+ while(left-- > 0) BitRead(8);
+/*
+ // mpeg2 stuffing (ff ff .. , max 32x)
+ while(BitRead(8, true) == 0xff) {BitRead(8); if(h.len) h.len--;}
+ Seek(GetPos()); // put last peeked byte back for Read()
+
+ // FIXME: this doesn't seems to be here,
+ // infact there can be ff's as part of the data
+ // right at the beginning of the packet, which
+ // we should not skip...
+*/
+ }
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
{
- __int64 endpos = GetPos() + len; // - sequence header length
+ __int64 endpos = GetPos() + len; // - sequence header length
- BYTE id = 0;
+ BYTE id = 0;
- while(GetPos() < endpos && id != 0xb3)
- {
- if(!NextMpegStartCode(id, len))
- return(false);
- }
+ while(GetPos() < endpos && id != 0xb3)
+ {
+ if(!NextMpegStartCode(id, len))
+ return(false);
+ }
- if(id != 0xb3)
- return(false);
+ if(id != 0xb3)
+ return(false);
- __int64 shpos = GetPos() - 4;
+ __int64 shpos = GetPos() - 4;
- h.width = (WORD)BitRead(12);
- h.height = (WORD)BitRead(12);
- h.ar = BitRead(4);
+ h.width = (WORD)BitRead(12);
+ h.height = (WORD)BitRead(12);
+ h.ar = BitRead(4);
static int ifps[16] = {0, 1126125, 1125000, 1080000, 900900, 900000, 540000, 450450, 450000, 0, 0, 0, 0, 0, 0, 0};
- h.ifps = ifps[BitRead(4)];
- h.bitrate = (DWORD)BitRead(18);
- MARKER;
- h.vbv = (DWORD)BitRead(10);
- h.constrained = BitRead(1);
-
- if(h.fiqm = BitRead(1))
- for(int i = 0; i < countof(h.iqm); i++)
- h.iqm[i] = (BYTE)BitRead(8);
-
- if(h.fniqm = BitRead(1))
- for(int i = 0; i < countof(h.niqm); i++)
- h.niqm[i] = (BYTE)BitRead(8);
-
- __int64 shlen = GetPos() - shpos;
-
- static float ar[] =
- {
- 1.0000f, 1.0000f, 0.6735f, 0.7031f, 0.7615f, 0.8055f, 0.8437f, 0.8935f,
- 0.9157f, 0.9815f, 1.0255f, 1.0695f, 1.0950f, 1.1575f, 1.2015f, 1.0000f
- };
-
- h.arx = (int)((float)h.width / ar[h.ar] + 0.5);
- h.ary = h.height;
-
- mpeg_t type = mpeg1;
-
- __int64 shextpos = 0, shextlen = 0;
-
- if(NextMpegStartCode(id, 8) && id == 0xb5) // sequence header ext
- {
- shextpos = GetPos() - 4;
-
- h.startcodeid = BitRead(4);
- h.profile_levelescape = BitRead(1); // reserved, should be 0
- h.profile = BitRead(3);
- h.level = BitRead(4);
- h.progressive = BitRead(1);
- h.chroma = BitRead(2);
- h.width |= (BitRead(2) << 12);
- h.height |= (BitRead(2) << 12);
- h.bitrate |= (BitRead(12) << 18);
- MARKER;
- h.vbv |= (BitRead(8) << 10);
- h.lowdelay = BitRead(1);
- h.ifps = (DWORD)(h.ifps * (BitRead(2) + 1) / (BitRead(5) + 1));
-
- shextlen = GetPos() - shextpos;
-
- struct
- {
- DWORD x, y;
- } ar[] = {{h.width, h.height}, {4, 3}, {16, 9}, {221, 100}, {h.width, h.height}};
- int i = min(max(h.ar, 1), 5) - 1;
- h.arx = ar[i].x;
- h.ary = ar[i].y;
-
- type = mpeg2;
- }
-
- h.ifps = 10 * h.ifps / 27;
- h.bitrate = h.bitrate == (1 << 30) - 1 ? 0 : h.bitrate * 400;
-
- DWORD a = h.arx, b = h.ary;
- while(a)
- {
- DWORD tmp = a;
- a = b % tmp;
- b = tmp;
- }
- if(b) h.arx /= b, h.ary /= b;
-
- if(!pmt) return(true);
-
- pmt->majortype = MEDIATYPE_Video;
-
- if(type == mpeg1)
- {
- pmt->subtype = MEDIASUBTYPE_MPEG1Payload;
- pmt->formattype = FORMAT_MPEGVideo;
- int len = FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader) + shlen + shextlen;
- MPEG1VIDEOINFO* vi = (MPEG1VIDEOINFO*)DNew BYTE[len];
- memset(vi, 0, len);
- vi->hdr.dwBitRate = h.bitrate;
- vi->hdr.AvgTimePerFrame = h.ifps;
- vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
- vi->hdr.bmiHeader.biWidth = h.width;
- vi->hdr.bmiHeader.biHeight = h.height;
- vi->hdr.bmiHeader.biXPelsPerMeter = h.width * h.ary;
- vi->hdr.bmiHeader.biYPelsPerMeter = h.height * h.arx;
- vi->cbSequenceHeader = shlen + shextlen;
- Seek(shpos);
- ByteRead((BYTE*)&vi->bSequenceHeader[0], shlen);
- if(shextpos && shextlen) Seek(shextpos);
- ByteRead((BYTE*)&vi->bSequenceHeader[0] + shlen, shextlen);
- pmt->SetFormat((BYTE*)vi, len);
- delete [] vi;
- }
- else if(type == mpeg2)
- {
- pmt->subtype = MEDIASUBTYPE_MPEG2_VIDEO;
- pmt->formattype = FORMAT_MPEG2_VIDEO;
- int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + shlen + shextlen;
- MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
- memset(vi, 0, len);
- vi->hdr.dwBitRate = h.bitrate;
- vi->hdr.AvgTimePerFrame = h.ifps;
- vi->hdr.dwPictAspectRatioX = h.arx;
- vi->hdr.dwPictAspectRatioY = h.ary;
- vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
- vi->hdr.bmiHeader.biWidth = h.width;
- vi->hdr.bmiHeader.biHeight = h.height;
- vi->dwProfile = h.profile;
- vi->dwLevel = h.level;
- vi->cbSequenceHeader = shlen + shextlen;
- Seek(shpos);
- ByteRead((BYTE*)&vi->dwSequenceHeader[0], shlen);
- if(shextpos && shextlen) Seek(shextpos);
- ByteRead((BYTE*)&vi->dwSequenceHeader[0] + shlen, shextlen);
- pmt->SetFormat((BYTE*)vi, len);
- delete [] vi;
- }
- else
- {
- return(false);
- }
-
- return(true);
+ h.ifps = ifps[BitRead(4)];
+ h.bitrate = (DWORD)BitRead(18); MARKER;
+ h.vbv = (DWORD)BitRead(10);
+ h.constrained = BitRead(1);
+
+ if(h.fiqm = BitRead(1))
+ for(int i = 0; i < countof(h.iqm); i++)
+ h.iqm[i] = (BYTE)BitRead(8);
+
+ if(h.fniqm = BitRead(1))
+ for(int i = 0; i < countof(h.niqm); i++)
+ h.niqm[i] = (BYTE)BitRead(8);
+
+ __int64 shlen = GetPos() - shpos;
+
+ static float ar[] =
+ {
+ 1.0000f,1.0000f,0.6735f,0.7031f,0.7615f,0.8055f,0.8437f,0.8935f,
+ 0.9157f,0.9815f,1.0255f,1.0695f,1.0950f,1.1575f,1.2015f,1.0000f
+ };
+
+ h.arx = (int)((float)h.width / ar[h.ar] + 0.5);
+ h.ary = h.height;
+
+ mpeg_t type = mpeg1;
+
+ __int64 shextpos = 0, shextlen = 0;
+
+ if(NextMpegStartCode(id, 8) && id == 0xb5) // sequence header ext
+ {
+ shextpos = GetPos() - 4;
+
+ h.startcodeid = BitRead(4);
+ h.profile_levelescape = BitRead(1); // reserved, should be 0
+ h.profile = BitRead(3);
+ h.level = BitRead(4);
+ h.progressive = BitRead(1);
+ h.chroma = BitRead(2);
+ h.width |= (BitRead(2)<<12);
+ h.height |= (BitRead(2)<<12);
+ h.bitrate |= (BitRead(12)<<18); MARKER;
+ h.vbv |= (BitRead(8)<<10);
+ h.lowdelay = BitRead(1);
+ h.ifps = (DWORD)(h.ifps * (BitRead(2)+1) / (BitRead(5)+1));
+
+ shextlen = GetPos() - shextpos;
+
+ struct {DWORD x, y;} ar[] = {{h.width,h.height},{4,3},{16,9},{221,100},{h.width,h.height}};
+ int i = min(max(h.ar, 1), 5)-1;
+ h.arx = ar[i].x;
+ h.ary = ar[i].y;
+
+ type = mpeg2;
+ }
+
+ h.ifps = 10 * h.ifps / 27;
+ h.bitrate = h.bitrate == (1<<30)-1 ? 0 : h.bitrate * 400;
+
+ DWORD a = h.arx, b = h.ary;
+ while(a) {DWORD tmp = a; a = b % tmp; b = tmp;}
+ if(b) h.arx /= b, h.ary /= b;
+
+ if(!pmt) return(true);
+
+ pmt->majortype = MEDIATYPE_Video;
+
+ if(type == mpeg1)
+ {
+ pmt->subtype = MEDIASUBTYPE_MPEG1Payload;
+ pmt->formattype = FORMAT_MPEGVideo;
+ int len = FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader) + shlen + shextlen;
+ MPEG1VIDEOINFO* vi = (MPEG1VIDEOINFO*)DNew BYTE[len];
+ memset(vi, 0, len);
+ vi->hdr.dwBitRate = h.bitrate;
+ vi->hdr.AvgTimePerFrame = h.ifps;
+ vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ vi->hdr.bmiHeader.biWidth = h.width;
+ vi->hdr.bmiHeader.biHeight = h.height;
+ vi->hdr.bmiHeader.biXPelsPerMeter = h.width * h.ary;
+ vi->hdr.bmiHeader.biYPelsPerMeter = h.height * h.arx;
+ vi->cbSequenceHeader = shlen + shextlen;
+ Seek(shpos);
+ ByteRead((BYTE*)&vi->bSequenceHeader[0], shlen);
+ if(shextpos && shextlen) Seek(shextpos);
+ ByteRead((BYTE*)&vi->bSequenceHeader[0] + shlen, shextlen);
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+ else if(type == mpeg2)
+ {
+ pmt->subtype = MEDIASUBTYPE_MPEG2_VIDEO;
+ pmt->formattype = FORMAT_MPEG2_VIDEO;
+ int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + shlen + shextlen;
+ MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
+ memset(vi, 0, len);
+ vi->hdr.dwBitRate = h.bitrate;
+ vi->hdr.AvgTimePerFrame = h.ifps;
+ vi->hdr.dwPictAspectRatioX = h.arx;
+ vi->hdr.dwPictAspectRatioY = h.ary;
+ vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ vi->hdr.bmiHeader.biWidth = h.width;
+ vi->hdr.bmiHeader.biHeight = h.height;
+ vi->dwProfile = h.profile;
+ vi->dwLevel = h.level;
+ vi->cbSequenceHeader = shlen + shextlen;
+ Seek(shpos);
+ ByteRead((BYTE*)&vi->dwSequenceHeader[0], shlen);
+ if(shextpos && shextlen) Seek(shextpos);
+ ByteRead((BYTE*)&vi->dwSequenceHeader[0] + shlen, shextlen);
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+ else
+ {
+ return(false);
+ }
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
-
- int syncbits = fAllowV25 ? 11 : 12;
-
- for(; len >= 4 && BitRead(syncbits, true) != (1 << syncbits) - 1; len--)
- BitRead(8);
-
- if(len < 4)
- return(false);
-
- h.sync = BitRead(11);
- h.version = BitRead(2);
- h.layer = BitRead(2);
- h.crc = BitRead(1);
- h.bitrate = BitRead(4);
- h.freq = BitRead(2);
- h.padding = BitRead(1);
- h.privatebit = BitRead(1);
- h.channels = BitRead(2);
- h.modeext = BitRead(2);
- h.copyright = BitRead(1);
- h.original = BitRead(1);
- h.emphasis = BitRead(2);
-
- if(h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2)
- return(false);
-
- if(h.version == 3 && h.layer == 2)
- {
- if((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
- && (h.bitrate >= 11 && h.bitrate <= 14) && h.channels == 3)
- return(false);
- }
-
- h.layer = 4 - h.layer;
-
- //
-
- static int brtbl[][5] =
- {
- {0, 0, 0, 0, 0},
- {32, 32, 32, 32, 8},
- {64, 48, 40, 48, 16},
- {96, 56, 48, 56, 24},
- {128, 64, 56, 64, 32},
- {160, 80, 64, 80, 40},
- {192, 96, 80, 96, 48},
- {224, 112, 96, 112, 56},
- {256, 128, 112, 128, 64},
- {288, 160, 128, 144, 80},
- {320, 192, 160, 160, 96},
- {352, 224, 192, 176, 112},
- {384, 256, 224, 192, 128},
- {416, 320, 256, 224, 144},
- {448, 384, 320, 256, 160},
- {0, 0, 0, 0, 0},
- };
-
- static int brtblcol[][4] = {{0, 3, 4, 4}, {0, 0, 1, 2}};
- int bitrate = 1000 * brtbl[h.bitrate][brtblcol[h.version&1][h.layer]];
- if(bitrate == 0) return(false);
-
- static int freq[][4] = {{11025, 0, 22050, 44100}, {12000, 0, 24000, 48000}, {8000, 0, 16000, 32000}};
-
- bool l3ext = h.layer == 3 && !(h.version & 1);
-
- h.nSamplesPerSec = freq[h.freq][h.version];
- h.FrameSize = h.layer == 1
- ? (12 * bitrate / h.nSamplesPerSec + h.padding) * 4
- : (l3ext ? 72 : 144) * bitrate / h.nSamplesPerSec + h.padding;
- h.rtDuration = 10000000i64 * (h.layer == 1 ? 384 : l3ext ? 576 : 1152) / h.nSamplesPerSec;// / (h.channels == 3 ? 1 : 2);
- h.nBytesPerSec = bitrate / 8;
-
- if(!pmt) return(true);
-
- /*int*/
- len = h.layer == 3
- ? sizeof(WAVEFORMATEX/*MPEGLAYER3WAVEFORMAT*/) // no need to overcomplicate this...
- : sizeof(MPEG1WAVEFORMAT);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[len];
- memset(wfe, 0, len);
- wfe->cbSize = len - sizeof(WAVEFORMATEX);
-
- if(h.layer == 3)
- {
- wfe->wFormatTag = WAVE_FORMAT_MP3;
-
- /* MPEGLAYER3WAVEFORMAT* f = (MPEGLAYER3WAVEFORMAT*)wfe;
- f->wfx.wFormatTag = WAVE_FORMAT_MP3;
- f->wID = MPEGLAYER3_ID_UNKNOWN;
- f->fdwFlags = h.padding ? MPEGLAYER3_FLAG_PADDING_ON : MPEGLAYER3_FLAG_PADDING_OFF; // _OFF or _ISO ?
- */
- }
- else
- {
- MPEG1WAVEFORMAT* f = (MPEG1WAVEFORMAT*)wfe;
- f->wfx.wFormatTag = WAVE_FORMAT_MPEG;
- f->fwHeadMode = 1 << h.channels;
- f->fwHeadModeExt = 1 << h.modeext;
- f->wHeadEmphasis = h.emphasis + 1;
- if(h.privatebit) f->fwHeadFlags |= ACM_MPEG_PRIVATEBIT;
- if(h.copyright) f->fwHeadFlags |= ACM_MPEG_COPYRIGHT;
- if(h.original) f->fwHeadFlags |= ACM_MPEG_ORIGINALHOME;
- if(h.crc == 0) f->fwHeadFlags |= ACM_MPEG_PROTECTIONBIT;
- if(h.version == 3) f->fwHeadFlags |= ACM_MPEG_ID_MPEG1;
- f->fwHeadLayer = 1 << (h.layer - 1);
- f->dwHeadBitrate = bitrate;
- }
-
- wfe->nChannels = h.channels == 3 ? 1 : 2;
- wfe->nSamplesPerSec = h.nSamplesPerSec;
- wfe->nBlockAlign = h.FrameSize;
- wfe->nAvgBytesPerSec = h.nBytesPerSec;
-
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = FOURCCMap(wfe->wFormatTag);
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX) + wfe->cbSize);
-
- delete [] wfe;
-
- return(true);
+ memset(&h, 0, sizeof(h));
+
+ int syncbits = fAllowV25 ? 11 : 12;
+
+ for(; len >= 4 && BitRead(syncbits, true) != (1<<syncbits) - 1; len--)
+ BitRead(8);
+
+ if(len < 4)
+ return(false);
+
+ h.sync = BitRead(11);
+ h.version = BitRead(2);
+ h.layer = BitRead(2);
+ h.crc = BitRead(1);
+ h.bitrate = BitRead(4);
+ h.freq = BitRead(2);
+ h.padding = BitRead(1);
+ h.privatebit = BitRead(1);
+ h.channels = BitRead(2);
+ h.modeext = BitRead(2);
+ h.copyright = BitRead(1);
+ h.original = BitRead(1);
+ h.emphasis = BitRead(2);
+
+ if(h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2)
+ return(false);
+
+ if(h.version == 3 && h.layer == 2)
+ {
+ if((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
+ && (h.bitrate >= 11 && h.bitrate <= 14) && h.channels == 3)
+ return(false);
+ }
+
+ h.layer = 4 - h.layer;
+
+ //
+
+ static int brtbl[][5] =
+ {
+ {0,0,0,0,0},
+ {32,32,32,32,8},
+ {64,48,40,48,16},
+ {96,56,48,56,24},
+ {128,64,56,64,32},
+ {160,80,64,80,40},
+ {192,96,80,96,48},
+ {224,112,96,112,56},
+ {256,128,112,128,64},
+ {288,160,128,144,80},
+ {320,192,160,160,96},
+ {352,224,192,176,112},
+ {384,256,224,192,128},
+ {416,320,256,224,144},
+ {448,384,320,256,160},
+ {0,0,0,0,0},
+ };
+
+ static int brtblcol[][4] = {{0,3,4,4},{0,0,1,2}};
+ int bitrate = 1000*brtbl[h.bitrate][brtblcol[h.version&1][h.layer]];
+ if(bitrate == 0) return(false);
+
+ static int freq[][4] = {{11025,0,22050,44100},{12000,0,24000,48000},{8000,0,16000,32000}};
+
+ bool l3ext = h.layer == 3 && !(h.version&1);
+
+ h.nSamplesPerSec = freq[h.freq][h.version];
+ h.FrameSize = h.layer == 1
+ ? (12 * bitrate / h.nSamplesPerSec + h.padding) * 4
+ : (l3ext ? 72 : 144) * bitrate / h.nSamplesPerSec + h.padding;
+ h.rtDuration = 10000000i64 * (h.layer == 1 ? 384 : l3ext ? 576 : 1152) / h.nSamplesPerSec;// / (h.channels == 3 ? 1 : 2);
+ h.nBytesPerSec = bitrate / 8;
+
+ if(!pmt) return(true);
+
+ /*int*/ len = h.layer == 3
+ ? sizeof(WAVEFORMATEX/*MPEGLAYER3WAVEFORMAT*/) // no need to overcomplicate this...
+ : sizeof(MPEG1WAVEFORMAT);
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[len];
+ memset(wfe, 0, len);
+ wfe->cbSize = len - sizeof(WAVEFORMATEX);
+
+ if(h.layer == 3)
+ {
+ wfe->wFormatTag = WAVE_FORMAT_MP3;
+
+/* MPEGLAYER3WAVEFORMAT* f = (MPEGLAYER3WAVEFORMAT*)wfe;
+ f->wfx.wFormatTag = WAVE_FORMAT_MP3;
+ f->wID = MPEGLAYER3_ID_UNKNOWN;
+ f->fdwFlags = h.padding ? MPEGLAYER3_FLAG_PADDING_ON : MPEGLAYER3_FLAG_PADDING_OFF; // _OFF or _ISO ?
+*/
+ }
+ else
+ {
+ MPEG1WAVEFORMAT* f = (MPEG1WAVEFORMAT*)wfe;
+ f->wfx.wFormatTag = WAVE_FORMAT_MPEG;
+ f->fwHeadMode = 1 << h.channels;
+ f->fwHeadModeExt = 1 << h.modeext;
+ f->wHeadEmphasis = h.emphasis+1;
+ if(h.privatebit) f->fwHeadFlags |= ACM_MPEG_PRIVATEBIT;
+ if(h.copyright) f->fwHeadFlags |= ACM_MPEG_COPYRIGHT;
+ if(h.original) f->fwHeadFlags |= ACM_MPEG_ORIGINALHOME;
+ if(h.crc == 0) f->fwHeadFlags |= ACM_MPEG_PROTECTIONBIT;
+ if(h.version == 3) f->fwHeadFlags |= ACM_MPEG_ID_MPEG1;
+ f->fwHeadLayer = 1 << (h.layer-1);
+ f->dwHeadBitrate = bitrate;
+ }
+
+ wfe->nChannels = h.channels == 3 ? 1 : 2;
+ wfe->nSamplesPerSec = h.nSamplesPerSec;
+ wfe->nBlockAlign = h.FrameSize;
+ wfe->nAvgBytesPerSec = h.nBytesPerSec;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = FOURCCMap(wfe->wFormatTag);
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX) + wfe->cbSize);
+
+ delete [] wfe;
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- for(; len >= 7 && BitRead(12, true) != 0xfff; len--)
- BitRead(8);
+ for(; len >= 7 && BitRead(12, true) != 0xfff; len--)
+ BitRead(8);
- if(len < 7)
- return(false);
+ if(len < 7)
+ return(false);
- h.sync = BitRead(12);
- h.version = BitRead(1);
- h.layer = BitRead(2);
- h.fcrc = BitRead(1);
- h.profile = BitRead(2);
- h.freq = BitRead(4);
- h.privatebit = BitRead(1);
- h.channels = BitRead(3);
- h.original = BitRead(1);
- h.home = BitRead(1);
+ h.sync = BitRead(12);
+ h.version = BitRead(1);
+ h.layer = BitRead(2);
+ h.fcrc = BitRead(1);
+ h.profile = BitRead(2);
+ h.freq = BitRead(4);
+ h.privatebit = BitRead(1);
+ h.channels = BitRead(3);
+ h.original = BitRead(1);
+ h.home = BitRead(1);
- h.copyright_id_bit = BitRead(1);
- h.copyright_id_start = BitRead(1);
- h.aac_frame_length = BitRead(13);
- h.adts_buffer_fullness = BitRead(11);
- h.no_raw_data_blocks_in_frame = BitRead(2);
+ h.copyright_id_bit = BitRead(1);
+ h.copyright_id_start = BitRead(1);
+ h.aac_frame_length = BitRead(13);
+ h.adts_buffer_fullness = BitRead(11);
+ h.no_raw_data_blocks_in_frame = BitRead(2);
- if(h.fcrc == 0) h.crc = BitRead(16);
+ if(h.fcrc == 0) h.crc = BitRead(16);
- if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7))
- return(false);
+ if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7))
+ return(false);
- h.FrameSize = h.aac_frame_length - (h.fcrc == 0 ? 9 : 7);
+ h.FrameSize = h.aac_frame_length - (h.fcrc == 0 ? 9 : 7);
static int freq[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000};
- h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
- h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
+ h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
+ h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
- if(!pmt) return(true);
+ if(!pmt) return(true);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[sizeof(WAVEFORMATEX)+5];
- memset(wfe, 0, sizeof(WAVEFORMATEX) + 5);
- wfe->wFormatTag = WAVE_FORMAT_AAC;
- wfe->nChannels = h.channels <= 6 ? h.channels : 2;
- wfe->nSamplesPerSec = freq[h.freq];
- wfe->nBlockAlign = h.aac_frame_length;
- wfe->nAvgBytesPerSec = h.nBytesPerSec;
- wfe->cbSize = MakeAACInitData((BYTE*)(wfe + 1), h.profile, wfe->nSamplesPerSec, wfe->nChannels);
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)DNew BYTE[sizeof(WAVEFORMATEX)+5];
+ memset(wfe, 0, sizeof(WAVEFORMATEX)+5);
+ wfe->wFormatTag = WAVE_FORMAT_AAC;
+ wfe->nChannels = h.channels <= 6 ? h.channels : 2;
+ wfe->nSamplesPerSec = freq[h.freq];
+ wfe->nBlockAlign = h.aac_frame_length;
+ wfe->nAvgBytesPerSec = h.nBytesPerSec;
+ wfe->cbSize = MakeAACInitData((BYTE*)(wfe+1), h.profile, wfe->nSamplesPerSec, wfe->nChannels);
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_AAC;
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX) + wfe->cbSize);
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_AAC;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX)+wfe->cbSize);
- delete [] wfe;
+ delete [] wfe;
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
-
- for(; len >= 7 && BitRead(16, true) != 0x0b77; len--)
- BitRead(8);
-
- if(len < 7)
- return(false);
-
- h.sync = (WORD)BitRead(16);
- if(h.sync != 0x0B77)
- return(false);
-
- h.crc1 = (WORD)BitRead(16);
- h.fscod = BitRead(2);
- h.frmsizecod = BitRead(6);
- h.bsid = BitRead(5);
- h.bsmod = BitRead(3);
- h.acmod = BitRead(3);
- if((h.acmod & 1) && h.acmod != 1) h.cmixlev = BitRead(2);
- if(h.acmod & 4) h.surmixlev = BitRead(2);
- if(h.acmod == 2) h.dsurmod = BitRead(2);
- h.lfeon = BitRead(1);
-
- if(h.bsid >= 17 || h.fscod == 3 || h.frmsizecod >= 48)
- return(false);
-
- if(!pmt) return(true);
-
- WAVEFORMATEX wfe;
- memset(&wfe, 0, sizeof(wfe));
- wfe.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
-
- static int channels[] = {2, 1, 2, 3, 3, 4, 4, 5};
- wfe.nChannels = channels[h.acmod] + h.lfeon;
-
- static int freq[] = {48000, 44100, 32000, 0};
- wfe.nSamplesPerSec = freq[h.fscod];
-
- switch(h.bsid)
- {
- case 9:
- wfe.nSamplesPerSec >>= 1;
- break;
- case 10:
- wfe.nSamplesPerSec >>= 2;
- break;
- case 11:
- wfe.nSamplesPerSec >>= 3;
- break;
- default:
- break;
- }
+ memset(&h, 0, sizeof(h));
+
+ for(; len >= 7 && BitRead(16, true) != 0x0b77; len--)
+ BitRead(8);
+
+ if(len < 7)
+ return(false);
+
+ h.sync = (WORD)BitRead(16);
+ if(h.sync != 0x0B77)
+ return(false);
+
+ h.crc1 = (WORD)BitRead(16);
+ h.fscod = BitRead(2);
+ h.frmsizecod = BitRead(6);
+ h.bsid = BitRead(5);
+ h.bsmod = BitRead(3);
+ h.acmod = BitRead(3);
+ if((h.acmod & 1) && h.acmod != 1) h.cmixlev = BitRead(2);
+ if(h.acmod & 4) h.surmixlev = BitRead(2);
+ if(h.acmod == 2) h.dsurmod = BitRead(2);
+ h.lfeon = BitRead(1);
+
+ if(h.bsid >= 17 || h.fscod == 3 || h.frmsizecod >= 48)
+ return(false);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- static int rate[] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, 768, 896, 1024, 1152, 1280};
+ static int channels[] = {2, 1, 2, 3, 3, 4, 4, 5};
+ wfe.nChannels = channels[h.acmod] + h.lfeon;
- wfe.nAvgBytesPerSec = (rate[h.frmsizecod>>1] * 1000) / 8;
- wfe.nBlockAlign = (WORD)(1536 * wfe.nAvgBytesPerSec / wfe.nSamplesPerSec);
+ static int freq[] = {48000, 44100, 32000, 0};
+ wfe.nSamplesPerSec = freq[h.fscod];
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_DOLBY_AC3;
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+ switch(h.bsid)
+ {
+ case 9: wfe.nSamplesPerSec >>= 1; break;
+ case 10: wfe.nSamplesPerSec >>= 2; break;
+ case 11: wfe.nSamplesPerSec >>= 3; break;
+ default: break;
+ }
- return(true);
+ static int rate[] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, 768, 896, 1024, 1152, 1280};
+
+ wfe.nAvgBytesPerSec = (rate[h.frmsizecod>>1] * 1000) / 8;
+ wfe.nBlockAlign = (WORD)(1536 * wfe.nAvgBytesPerSec / wfe.nSamplesPerSec);
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_DOLBY_AC3;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- for(; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--)
- BitRead(8);
+ for(; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--)
+ BitRead(8);
- if(len < 10)
- return(false);
+ if(len < 10)
+ return(false);
- h.sync = (DWORD)BitRead(32);
- h.frametype = BitRead(1);
- h.deficitsamplecount = BitRead(5);
- h.fcrc = BitRead(1);
- h.nblocks = BitRead(7);
- h.framebytes = (WORD)BitRead(14) + 1;
- h.amode = BitRead(6);
- h.sfreq = BitRead(4);
- h.rate = BitRead(5);
+ h.sync = (DWORD)BitRead(32);
+ h.frametype = BitRead(1);
+ h.deficitsamplecount = BitRead(5);
+ h.fcrc = BitRead(1);
+ h.nblocks = BitRead(7);
+ h.framebytes = (WORD)BitRead(14)+1;
+ h.amode = BitRead(6);
+ h.sfreq = BitRead(4);
+ h.rate = BitRead(5);
h.downmix = BitRead(1);
h.dynrange = BitRead(1);
@@ -724,1006 +675,981 @@ bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt)
h.predictor_history = BitRead(1);
- if(!pmt) return(true);
+ if(!pmt) return(true);
- WAVEFORMATEX wfe;
- memset(&wfe, 0, sizeof(wfe));
- wfe.wFormatTag = WAVE_FORMAT_DVD_DTS;
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = WAVE_FORMAT_DVD_DTS;
- static int channels[] = {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
+ static int channels[] = {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
- if(h.amode < countof(channels))
- {
- wfe.nChannels = channels[h.amode];
- if(h.lfe > 0)
- ++wfe.nChannels;
- }
+ if(h.amode < countof(channels))
+ {
+ wfe.nChannels = channels[h.amode];
+ if (h.lfe > 0)
+ ++wfe.nChannels;
+ }
- static int freq[] = {0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, 12000, 24000, 48000, 0, 0};
- wfe.nSamplesPerSec = freq[h.sfreq];
+ static int freq[] = {0,8000,16000,32000,0,0,11025,22050,44100,0,0,12000,24000,48000,0,0};
+ wfe.nSamplesPerSec = freq[h.sfreq];
- static int rate[] =
- {
- 32000, 56000, 64000, 96000, 112000, 128000, 192000, 224000,
- 256000, 320000, 384000, 448000, 512000, 576000, 640000, 754500,
- 960000, 1024000, 1152000, 1280000, 1344000, 1408000, 1411200, 1472000,
- 1509750, 1920000, 2048000, 3072000, 3840000, 0, 0, 0
- };
+ static int rate[] =
+ {
+ 32000,56000,64000,96000,112000,128000,192000,224000,
+ 256000,320000,384000,448000,512000,576000,640000,754500,
+ 960000,1024000,1152000,1280000,1344000,1408000,1411200,1472000,
+ 1509750,1920000,2048000,3072000,3840000,0,0,0
+ };
- wfe.nAvgBytesPerSec = (rate[h.rate] + 4) / 8;
- wfe.nBlockAlign = h.framebytes;
+ wfe.nAvgBytesPerSec = (rate[h.rate] + 4) / 8;
+ wfe.nBlockAlign = h.framebytes;
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_DTS;
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_DTS;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(hdmvlpcmhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- h.size = BitRead(16);
- h.channels = BitRead(4);
- h.samplerate = BitRead(4);
- h.bitpersample = BitRead(2);
+ h.size = BitRead(16);
+ h.channels = BitRead(4);
+ h.samplerate = BitRead(4);
+ h.bitpersample = BitRead(2);
- if(h.channels == 0 || h.channels == 2 ||
- (h.samplerate != 1 && h.samplerate != 4 && h.samplerate != 5) ||
- h.bitpersample < 0 || h.bitpersample > 3)
- return(false);
+ if (h.channels==0 || h.channels==2 ||
+ (h.samplerate != 1 && h.samplerate!= 4 && h.samplerate!= 5) ||
+ h.bitpersample<0 || h.bitpersample>3)
+ return(false);
- if(!pmt) return(true);
+ if(!pmt) return(true);
- WAVEFORMATEX_HDMV_LPCM wfe;
- wfe.wFormatTag = WAVE_FORMAT_PCM;
+ WAVEFORMATEX_HDMV_LPCM wfe;
+ wfe.wFormatTag = WAVE_FORMAT_PCM;
- static int channels[] = {0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8};
- wfe.nChannels = channels[h.channels];
- wfe.channel_conf = h.channels;
+ static int channels[] = {0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8};
+ wfe.nChannels = channels[h.channels];
+ wfe.channel_conf = h.channels;
- static int freq[] = {0, 48000, 0, 0, 96000, 192000};
- wfe.nSamplesPerSec = freq[h.samplerate];
+ static int freq[] = {0, 48000, 0, 0, 96000, 192000};
+ wfe.nSamplesPerSec = freq[h.samplerate];
- static int bitspersample[] = {0, 16, 20, 24};
- wfe.wBitsPerSample = bitspersample[h.bitpersample];
+ static int bitspersample[] = {0, 16, 20, 24};
+ wfe.wBitsPerSample = bitspersample[h.bitpersample];
- wfe.nBlockAlign = wfe.nChannels * wfe.wBitsPerSample >> 3;
- wfe.nAvgBytesPerSec = wfe.nBlockAlign * wfe.nSamplesPerSec;
+ wfe.nBlockAlign = wfe.nChannels*wfe.wBitsPerSample>>3;
+ wfe.nAvgBytesPerSec = wfe.nBlockAlign*wfe.nSamplesPerSec;
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_HDMV_LPCM_AUDIO;
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_HDMV_LPCM_AUDIO;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(lpcmhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
-
- h.emphasis = BitRead(1);
- h.mute = BitRead(1);
- h.reserved1 = BitRead(1);
- h.framenum = BitRead(5);
- h.quantwordlen = BitRead(2);
- h.freq = BitRead(2);
- h.reserved2 = BitRead(1);
- h.channels = BitRead(3);
- h.drc = (BYTE)BitRead(8);
-
- if(h.quantwordlen == 3 || h.reserved1 || h.reserved2)
- return(false);
-
- if(!pmt) return(true);
-
- WAVEFORMATEX wfe;
- memset(&wfe, 0, sizeof(wfe));
- wfe.wFormatTag = WAVE_FORMAT_PCM;
- wfe.nChannels = h.channels + 1;
- static int freq[] = {48000, 96000, 44100, 32000};
- wfe.nSamplesPerSec = freq[h.freq];
- switch(h.quantwordlen)
- {
- case 0:
- wfe.wBitsPerSample = 16;
- break;
- case 1:
- wfe.wBitsPerSample = 20;
- break;
- case 2:
- wfe.wBitsPerSample = 24;
- break;
- }
- wfe.nBlockAlign = (wfe.nChannels * 2 * wfe.wBitsPerSample) / 8;
- wfe.nAvgBytesPerSec = (wfe.nBlockAlign * wfe.nSamplesPerSec) / 2;
-
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_DVD_LPCM_AUDIO;
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
-
- // TODO: what to do with dvd-audio lpcm?
-
- return(true);
+ memset(&h, 0, sizeof(h));
+
+ h.emphasis = BitRead(1);
+ h.mute = BitRead(1);
+ h.reserved1 = BitRead(1);
+ h.framenum = BitRead(5);
+ h.quantwordlen = BitRead(2);
+ h.freq = BitRead(2);
+ h.reserved2 = BitRead(1);
+ h.channels = BitRead(3);
+ h.drc = (BYTE)BitRead(8);
+
+ if(h.quantwordlen == 3 || h.reserved1 || h.reserved2)
+ return(false);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = WAVE_FORMAT_PCM;
+ wfe.nChannels = h.channels+1;
+ static int freq[] = {48000, 96000, 44100, 32000};
+ wfe.nSamplesPerSec = freq[h.freq];
+ switch (h.quantwordlen)
+ {
+ case 0:
+ wfe.wBitsPerSample = 16;
+ break;
+ case 1:
+ wfe.wBitsPerSample = 20;
+ break;
+ case 2:
+ wfe.wBitsPerSample = 24;
+ break;
+ }
+ wfe.nBlockAlign = (wfe.nChannels*2*wfe.wBitsPerSample) / 8;
+ wfe.nAvgBytesPerSec = (wfe.nBlockAlign*wfe.nSamplesPerSec) / 2;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_DVD_LPCM_AUDIO;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ // TODO: what to do with dvd-audio lpcm?
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(dvdspuhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- if(!pmt) return(true);
+ if(!pmt) return(true);
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = MEDIASUBTYPE_DVD_SUBPICTURE;
- pmt->formattype = FORMAT_None;
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = MEDIASUBTYPE_DVD_SUBPICTURE;
+ pmt->formattype = FORMAT_None;
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(hdmvsubhdr& h, CMediaType* pmt, const char* language_code)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- if(!pmt) return(true);
+ if(!pmt) return(true);
- pmt->majortype = MEDIATYPE_Subtitle;
- pmt->subtype = MEDIASUBTYPE_HDMVSUB;
- pmt->formattype = FORMAT_None;
+ pmt->majortype = MEDIATYPE_Subtitle;
+ pmt->subtype = MEDIASUBTYPE_HDMVSUB;
+ pmt->formattype = FORMAT_None;
- SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
- if(psi)
- {
- memset(psi, 0, pmt->FormatLength());
- strcpy(psi->IsoLang, language_code ? language_code : "eng");
- }
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
+ if (psi)
+ {
+ memset(psi, 0, pmt->FormatLength());
+ strcpy(psi->IsoLang, language_code ? language_code : "eng");
+ }
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(svcdspuhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- if(!pmt) return(true);
+ if(!pmt) return(true);
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = MEDIASUBTYPE_SVCD_SUBPICTURE;
- pmt->formattype = FORMAT_None;
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = MEDIASUBTYPE_SVCD_SUBPICTURE;
+ pmt->formattype = FORMAT_None;
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(cvdspuhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- if(!pmt) return(true);
+ if(!pmt) return(true);
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = MEDIASUBTYPE_CVD_SUBPICTURE;
- pmt->formattype = FORMAT_None;
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = MEDIASUBTYPE_CVD_SUBPICTURE;
+ pmt->formattype = FORMAT_None;
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(ps2audhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
-
- if(BitRead(16, true) != 'SS')
- return(false);
-
- __int64 pos = GetPos();
-
- while(BitRead(16, true) == 'SS')
- {
- DWORD tag = (DWORD)BitRead(32, true);
- DWORD size = 0;
-
- if(tag == 'SShd')
- {
- BitRead(32);
- ByteRead((BYTE*)&size, sizeof(size));
- ASSERT(size == 0x18);
- Seek(GetPos());
- ByteRead((BYTE*)&h, sizeof(h));
- }
- else if(tag == 'SSbd')
- {
- BitRead(32);
- ByteRead((BYTE*)&size, sizeof(size));
- break;
- }
- }
-
- Seek(pos);
-
- if(!pmt) return(true);
-
- WAVEFORMATEXPS2 wfe;
- wfe.wFormatTag =
- h.unk1 == 0x01 ? WAVE_FORMAT_PS2_PCM :
- h.unk1 == 0x10 ? WAVE_FORMAT_PS2_ADPCM :
- WAVE_FORMAT_UNKNOWN;
- wfe.nChannels = (WORD)h.channels;
- wfe.nSamplesPerSec = h.freq;
- wfe.wBitsPerSample = 16; // always?
- wfe.nBlockAlign = wfe.nChannels * wfe.wBitsPerSample >> 3;
- wfe.nAvgBytesPerSec = wfe.nBlockAlign * wfe.nSamplesPerSec;
- wfe.dwInterleave = h.interleave;
-
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = FOURCCMap(wfe.wFormatTag);
- pmt->formattype = FORMAT_WaveFormatEx;
- pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
-
- return(true);
+ memset(&h, 0, sizeof(h));
+
+ if(BitRead(16, true) != 'SS')
+ return(false);
+
+ __int64 pos = GetPos();
+
+ while(BitRead(16, true) == 'SS')
+ {
+ DWORD tag = (DWORD)BitRead(32, true);
+ DWORD size = 0;
+
+ if(tag == 'SShd')
+ {
+ BitRead(32);
+ ByteRead((BYTE*)&size, sizeof(size));
+ ASSERT(size == 0x18);
+ Seek(GetPos());
+ ByteRead((BYTE*)&h, sizeof(h));
+ }
+ else if(tag == 'SSbd')
+ {
+ BitRead(32);
+ ByteRead((BYTE*)&size, sizeof(size));
+ break;
+ }
+ }
+
+ Seek(pos);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEXPS2 wfe;
+ wfe.wFormatTag =
+ h.unk1 == 0x01 ? WAVE_FORMAT_PS2_PCM :
+ h.unk1 == 0x10 ? WAVE_FORMAT_PS2_ADPCM :
+ WAVE_FORMAT_UNKNOWN;
+ wfe.nChannels = (WORD)h.channels;
+ wfe.nSamplesPerSec = h.freq;
+ wfe.wBitsPerSample = 16; // always?
+ wfe.nBlockAlign = wfe.nChannels*wfe.wBitsPerSample>>3;
+ wfe.nAvgBytesPerSec = wfe.nBlockAlign*wfe.nSamplesPerSec;
+ wfe.dwInterleave = h.interleave;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = FOURCCMap(wfe.wFormatTag);
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(ps2subhdr& h, CMediaType* pmt)
{
- memset(&h, 0, sizeof(h));
+ memset(&h, 0, sizeof(h));
- if(!pmt) return(true);
+ if(!pmt) return(true);
- pmt->majortype = MEDIATYPE_Subtitle;
- pmt->subtype = MEDIASUBTYPE_PS2_SUB;
- pmt->formattype = FORMAT_None;
+ pmt->majortype = MEDIATYPE_Subtitle;
+ pmt->subtype = MEDIASUBTYPE_PS2_SUB;
+ pmt->formattype = FORMAT_None;
- return(true);
+ return(true);
}
bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
{
- memset(&h, 0, sizeof(h));
-
- BitByteAlign();
-
- if(m_tslen == 0)
- {
- __int64 pos = GetPos();
-
- for(int i = 0; i < 192; i++)
- {
- if(BitRead(8, true) == 0x47)
- {
- __int64 pos = GetPos();
- Seek(pos + 188);
- if(BitRead(8, true) == 0x47)
- {
- m_tslen = 188; // TS stream
- break;
- }
- Seek(pos + 192);
- if(BitRead(8, true) == 0x47)
- {
- m_tslen = 192; // M2TS stream
- break;
- }
- }
-
- BitRead(8);
- }
-
- Seek(pos);
-
- if(m_tslen == 0)
- {
- return(false);
- }
- }
-
- if(fSync)
- {
- for(int i = 0; i < m_tslen; i++)
- {
- if(BitRead(8, true) == 0x47)
- {
- if(i == 0) break;
- Seek(GetPos() + m_tslen);
- if(BitRead(8, true) == 0x47)
- {
- Seek(GetPos() - m_tslen);
- break;
- }
- }
-
- BitRead(8);
-
- if(i == m_tslen - 1)
- return(false);
- }
- }
-
- if(BitRead(8, true) != 0x47)
- return(false);
-
- h.next = GetPos() + m_tslen;
-
- h.sync = (BYTE)BitRead(8);
- h.error = BitRead(1);
- h.payloadstart = BitRead(1);
- h.transportpriority = BitRead(1);
- h.pid = BitRead(13);
- h.scrambling = BitRead(2);
- h.adapfield = BitRead(1);
- h.payload = BitRead(1);
- h.counter = BitRead(4);
-
- h.bytes = 188 - 4;
-
- if(h.adapfield)
- {
- h.length = (BYTE)BitRead(8);
-
- if(h.length > 0)
- {
- h.discontinuity = BitRead(1);
- h.randomaccess = BitRead(1);
- h.priority = BitRead(1);
- h.fPCR = BitRead(1);
- h.OPCR = BitRead(1);
- h.splicingpoint = BitRead(1);
- h.privatedata = BitRead(1);
- h.extension = BitRead(1);
-
- int i = 1;
-
- if(h.fPCR)
- {
- h.PCR = BitRead(33);
- BitRead(6);
- UINT64 PCRExt = BitRead(9);
- h.PCR = (h.PCR * 300 + PCRExt) * 10 / 27;
- i += 6;
- }
-
- ASSERT(i <= h.length);
-
- for(; i < h.length; i++)
- BitRead(8);
- }
-
- h.bytes -= h.length + 1;
-
- if(h.bytes < 0)
- {
- ASSERT(0);
- return false;
- }
- }
-
- return true;
+ memset(&h, 0, sizeof(h));
+
+ BitByteAlign();
+
+ if(m_tslen == 0)
+ {
+ __int64 pos = GetPos();
+
+ for(int i = 0; i < 192; i++)
+ {
+ if(BitRead(8, true) == 0x47)
+ {
+ __int64 pos = GetPos();
+ Seek(pos + 188);
+ if(BitRead(8, true) == 0x47) {m_tslen = 188; break;} // TS stream
+ Seek(pos + 192);
+ if(BitRead(8, true) == 0x47) {m_tslen = 192; break;} // M2TS stream
+ }
+
+ BitRead(8);
+ }
+
+ Seek(pos);
+
+ if(m_tslen == 0)
+ {
+ return(false);
+ }
+ }
+
+ if(fSync)
+ {
+ for(int i = 0; i < m_tslen; i++)
+ {
+ if(BitRead(8, true) == 0x47)
+ {
+ if(i == 0) break;
+ Seek(GetPos()+m_tslen);
+ if(BitRead(8, true) == 0x47) {Seek(GetPos()-m_tslen); break;}
+ }
+
+ BitRead(8);
+
+ if(i == m_tslen-1)
+ return(false);
+ }
+ }
+
+ if(BitRead(8, true) != 0x47)
+ return(false);
+
+ h.next = GetPos() + m_tslen;
+
+ h.sync = (BYTE)BitRead(8);
+ h.error = BitRead(1);
+ h.payloadstart = BitRead(1);
+ h.transportpriority = BitRead(1);
+ h.pid = BitRead(13);
+ h.scrambling = BitRead(2);
+ h.adapfield = BitRead(1);
+ h.payload = BitRead(1);
+ h.counter = BitRead(4);
+
+ h.bytes = 188 - 4;
+
+ if(h.adapfield)
+ {
+ h.length = (BYTE)BitRead(8);
+
+ if(h.length > 0)
+ {
+ h.discontinuity = BitRead(1);
+ h.randomaccess = BitRead(1);
+ h.priority = BitRead(1);
+ h.fPCR = BitRead(1);
+ h.OPCR = BitRead(1);
+ h.splicingpoint = BitRead(1);
+ h.privatedata = BitRead(1);
+ h.extension = BitRead(1);
+
+ int i = 1;
+
+ if(h.fPCR)
+ {
+ h.PCR = BitRead(33);
+ BitRead(6);
+ UINT64 PCRExt = BitRead(9);
+ h.PCR = (h.PCR*300 + PCRExt) * 10 / 27;
+ i += 6;
+ }
+
+ ASSERT(i <= h.length);
+
+ for(; i < h.length; i++)
+ BitRead(8);
+ }
+
+ h.bytes -= h.length+1;
+
+ if(h.bytes < 0) {ASSERT(0); return false;}
+ }
+
+ return true;
}
bool CBaseSplitterFileEx::Read(trsechdr& h)
{
- BYTE pointer_field = BitRead(8);
- while(pointer_field-- > 0) BitRead(8);
- h.table_id = BitRead(8);
- h.section_syntax_indicator = BitRead(1);
- h.zero = BitRead(1);
- h.reserved1 = BitRead(2);
- h.section_length = BitRead(12);
- h.transport_stream_id = BitRead(16);
- h.reserved2 = BitRead(2);
- h.version_number = BitRead(5);
- h.current_next_indicator = BitRead(1);
- h.section_number = BitRead(8);
- h.last_section_number = BitRead(8);
- return h.section_syntax_indicator == 1 && h.zero == 0;
+ BYTE pointer_field = BitRead(8);
+ while(pointer_field-- > 0) BitRead(8);
+ h.table_id = BitRead(8);
+ h.section_syntax_indicator = BitRead(1);
+ h.zero = BitRead(1);
+ h.reserved1 = BitRead(2);
+ h.section_length = BitRead(12);
+ h.transport_stream_id = BitRead(16);
+ h.reserved2 = BitRead(2);
+ h.version_number = BitRead(5);
+ h.current_next_indicator = BitRead(1);
+ h.section_number = BitRead(8);
+ h.last_section_number = BitRead(8);
+ return h.section_syntax_indicator == 1 && h.zero == 0;
}
bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync)
{
- memset(&h, 0, sizeof(h));
-
- BitByteAlign();
-
- if(fSync)
- {
- for(int i = 0; i < 65536; i++)
- {
- if((BitRead(64, true) & 0xfffffc00ffe00000i64) == 0x4156000055000000i64)
- break;
- BitRead(8);
- }
- }
-
- if((BitRead(64, true) & 0xfffffc00ffe00000i64) != 0x4156000055000000i64)
- return(false);
-
- h.sync = (WORD)BitRead(16);
- h.streamid = (BYTE)BitRead(8);
- h.counter = (BYTE)BitRead(8);
- h.res1 = (BYTE)BitRead(8);
- h.res2 = BitRead(3);
- h.fpts = BitRead(1);
- h.postbytes = BitRead(2);
- h.prebytes = BitRead(2);
- h.length = (WORD)BitRead(16);
-
- if(h.length > 6136)
- return(false);
-
- __int64 pos = GetPos();
-
- if(h.streamid == 1 && h.fpts)
- {
- h.pts = 10000 * BitRead(32) / 90 + m_rtPTSOffset;
- }
- else if(h.streamid == 2 && (h.fpts || (BitRead(32, true) & 0xffffffe0) == 0x000001c0))
- {
- BYTE b;
- if(!NextMpegStartCode(b, 4)) return(false);
- peshdr h2;
- if(!Read(h2, b)) return(false);
- if(h.fpts = h2.fpts) h.pts = h2.pts;
- }
-
- BitRead(8 * h.prebytes);
-
- h.length -= GetPos() - pos;
-
- return(true);
+ memset(&h, 0, sizeof(h));
+
+ BitByteAlign();
+
+ if(fSync)
+ {
+ for(int i = 0; i < 65536; i++)
+ {
+ if((BitRead(64, true)&0xfffffc00ffe00000i64) == 0x4156000055000000i64)
+ break;
+ BitRead(8);
+ }
+ }
+
+ if((BitRead(64, true)&0xfffffc00ffe00000i64) != 0x4156000055000000i64)
+ return(false);
+
+ h.sync = (WORD)BitRead(16);
+ h.streamid = (BYTE)BitRead(8);
+ h.counter = (BYTE)BitRead(8);
+ h.res1 = (BYTE)BitRead(8);
+ h.res2 = BitRead(3);
+ h.fpts = BitRead(1);
+ h.postbytes = BitRead(2);
+ h.prebytes = BitRead(2);
+ h.length = (WORD)BitRead(16);
+
+ if(h.length > 6136)
+ return(false);
+
+ __int64 pos = GetPos();
+
+ if(h.streamid == 1 && h.fpts)
+ {
+ h.pts = 10000*BitRead(32)/90 + m_rtPTSOffset;
+ }
+ else if(h.streamid == 2 && (h.fpts || (BitRead(32, true)&0xffffffe0) == 0x000001c0))
+ {
+ BYTE b;
+ if(!NextMpegStartCode(b, 4)) return(false);
+ peshdr h2;
+ if(!Read(h2, b)) return(false);
+ if(h.fpts = h2.fpts) h.pts = h2.pts;
+ }
+
+ BitRead(8*h.prebytes);
+
+ h.length -= GetPos() - pos;
+
+ return(true);
}
void CBaseSplitterFileEx::RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length)
-{
- int si = 0;
- int di = 0;
- while(si + 2 < length)
- {
+{
+ int si=0;
+ int di=0;
+ 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;
+ 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
return;
}
- dst[di++] = src[si++];
+ dst[di++]= src[si++];
}
}
bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
{
- __int64 endpos = GetPos() + len; // - sequence header length
+ __int64 endpos = GetPos() + len; // - sequence header length
- DWORD dwStartCode;
+ DWORD dwStartCode;
- while(GetPos() < endpos + 4 && BitRead(32, true) == 0x00000001 && (!h.spslen || !h.ppslen))
- {
- __int64 pos = GetPos();
+ while(GetPos() < endpos+4 && BitRead(32, true) == 0x00000001 && (!h.spslen || !h.ppslen))
+ {
+ __int64 pos = GetPos();
- BitRead(32);
- BYTE id = BitRead(8);
-
- if((id & 0x9f) == 0x07 && (id & 0x60) != 0)
- {
+ BitRead(32);
+ BYTE id = BitRead(8);
+
+ if((id&0x9f) == 0x07 && (id&0x60) != 0)
+ {
#if 1
- BYTE SPSTemp[MAX_SPS];
- BYTE SPSBuff[MAX_SPS];
- CGolombBuffer gb(SPSBuff, MAX_SPS);
- __int64 num_units_in_tick;
- __int64 time_scale;
- long fixed_frame_rate_flag;
-
- h.spspos = pos;
-
- // Manage H264 escape codes (see "remove escapes (very rare 1:2^22)" in ffmpeg h264.c file)
- ByteRead((BYTE*)SPSTemp, MAX_SPS);
- RemoveMpegEscapeCode(SPSBuff, SPSTemp, MAX_SPS);
-
- h.profile = (BYTE)gb.BitRead(8);
- gb.BitRead(8);
- h.level = (BYTE)gb.BitRead(8);
-
- gb.UExpGolombRead(); // seq_parameter_set_id
-
- if(h.profile >= 100) // high profile
- {
- if(gb.UExpGolombRead() == 3) // chroma_format_idc
- {
- gb.BitRead(1); // residue_transform_flag
- }
-
- gb.UExpGolombRead(); // bit_depth_luma_minus8
- gb.UExpGolombRead(); // bit_depth_chroma_minus8
-
- gb.BitRead(1); // qpprime_y_zero_transform_bypass_flag
-
- if(gb.BitRead(1)) // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++)
- if(gb.BitRead(1)) // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j)
- next = (next + gb.SExpGolombRead() + 256) & 255;
- }
-
- gb.UExpGolombRead(); // log2_max_frame_num_minus4
-
- UINT64 pic_order_cnt_type = gb.UExpGolombRead();
-
- if(pic_order_cnt_type == 0)
- {
- gb.UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- }
- else if(pic_order_cnt_type == 1)
- {
- gb.BitRead(1); // delta_pic_order_always_zero_flag
- gb.SExpGolombRead(); // offset_for_non_ref_pic
- gb.SExpGolombRead(); // offset_for_top_to_bottom_field
- UINT64 num_ref_frames_in_pic_order_cnt_cycle = gb.UExpGolombRead();
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
- gb.SExpGolombRead(); // offset_for_ref_frame[i]
- }
-
- gb.UExpGolombRead(); // num_ref_frames
- gb.BitRead(1); // gaps_in_frame_num_value_allowed_flag
-
- UINT64 pic_width_in_mbs_minus1 = gb.UExpGolombRead();
- UINT64 pic_height_in_map_units_minus1 = gb.UExpGolombRead();
- BYTE frame_mbs_only_flag = (BYTE)gb.BitRead(1);
-
- h.width = (pic_width_in_mbs_minus1 + 1) * 16;
- h.height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16;
-
- if(h.height == 1088) h.height = 1080; // Prevent blur lines
-
- if(!frame_mbs_only_flag)
- gb.BitRead(1); // mb_adaptive_frame_field_flag
- gb.BitRead(1); // direct_8x8_inference_flag
- if(gb.BitRead(1)) // frame_cropping_flag
- {
- gb.UExpGolombRead(); // frame_cropping_rect_left_offset
- gb.UExpGolombRead(); // frame_cropping_rect_right_offset
- gb.UExpGolombRead(); // frame_cropping_rect_top_offset
- gb.UExpGolombRead(); // frame_cropping_rect_bottom_offset
- }
-
- if(gb.BitRead(1)) // vui_parameters_present_flag
- {
- if(gb.BitRead(1)) // aspect_ratio_info_present_flag
- {
- if(255 == (BYTE)gb.BitRead(8)) // aspect_ratio_idc)
- {
- gb.BitRead(16); // sar_width
- gb.BitRead(16); // sar_height
- }
- }
-
- if(gb.BitRead(1)) // overscan_info_present_flag
- {
- gb.BitRead(1); // overscan_appropriate_flag
- }
-
- if(gb.BitRead(1)) // video_signal_type_present_flag
- {
- gb.BitRead(3); // video_format
- gb.BitRead(1); // video_full_range_flag
- if(gb.BitRead(1)) // colour_description_present_flag
- {
- gb.BitRead(8); // colour_primaries
- gb.BitRead(8); // transfer_characteristics
- gb.BitRead(8); // matrix_coefficients
- }
- }
- if(gb.BitRead(1)) // chroma_location_info_present_flag
- {
- gb.UExpGolombRead(); // chroma_sample_loc_type_top_field
- gb.UExpGolombRead(); // chroma_sample_loc_type_bottom_field
- }
- if(gb.BitRead(1)) // timing_info_present_flag
- {
- num_units_in_tick = gb.BitRead(32);
- time_scale = gb.BitRead(32);
- fixed_frame_rate_flag = gb.BitRead(1);
-
- // Trick for weird parameters (10x to Madshi)!
- if((num_units_in_tick < 1000) || (num_units_in_tick > 1001))
- {
- if((time_scale % num_units_in_tick != 0) && ((time_scale * 1001) % num_units_in_tick == 0))
- {
- time_scale = (time_scale * 1001) / num_units_in_tick;
- num_units_in_tick = 1001;
- }
- else
- {
- time_scale = (time_scale * 1000) / num_units_in_tick;
- num_units_in_tick = 1000;
- }
- }
- time_scale = time_scale / 2; // VUI consider fields even for progressive stream : divide by 2!
-
- if(time_scale)
- h.AvgTimePerFrame = (10000000I64 * num_units_in_tick) / time_scale;
- }
- }
-
- Seek(h.spspos + gb.GetPos());
+ BYTE SPSTemp[MAX_SPS];
+ BYTE SPSBuff[MAX_SPS];
+ CGolombBuffer gb (SPSBuff, MAX_SPS);
+ __int64 num_units_in_tick;
+ __int64 time_scale;
+ long fixed_frame_rate_flag;
+
+ h.spspos = pos;
+
+ // Manage H264 escape codes (see "remove escapes (very rare 1:2^22)" in ffmpeg h264.c file)
+ ByteRead((BYTE*)SPSTemp, MAX_SPS);
+ RemoveMpegEscapeCode (SPSBuff, SPSTemp, MAX_SPS);
+
+ h.profile = (BYTE)gb.BitRead(8);
+ gb.BitRead(8);
+ h.level = (BYTE)gb.BitRead(8);
+
+ gb.UExpGolombRead(); // seq_parameter_set_id
+
+ if(h.profile >= 100) // high profile
+ {
+ if(gb.UExpGolombRead() == 3) // chroma_format_idc
+ {
+ gb.BitRead(1); // residue_transform_flag
+ }
+
+ gb.UExpGolombRead(); // bit_depth_luma_minus8
+ gb.UExpGolombRead(); // bit_depth_chroma_minus8
+
+ gb.BitRead(1); // qpprime_y_zero_transform_bypass_flag
+
+ if(gb.BitRead(1)) // seq_scaling_matrix_present_flag
+ for(int i = 0; i < 8; i++)
+ if(gb.BitRead(1)) // seq_scaling_list_present_flag
+ for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j)
+ next = (next + gb.SExpGolombRead() + 256) & 255;
+ }
+
+ gb.UExpGolombRead(); // log2_max_frame_num_minus4
+
+ UINT64 pic_order_cnt_type = gb.UExpGolombRead();
+
+ if(pic_order_cnt_type == 0)
+ {
+ gb.UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
+ }
+ else if(pic_order_cnt_type == 1)
+ {
+ gb.BitRead(1); // delta_pic_order_always_zero_flag
+ gb.SExpGolombRead(); // offset_for_non_ref_pic
+ gb.SExpGolombRead(); // offset_for_top_to_bottom_field
+ UINT64 num_ref_frames_in_pic_order_cnt_cycle = gb.UExpGolombRead();
+ for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
+ gb.SExpGolombRead(); // offset_for_ref_frame[i]
+ }
+
+ gb.UExpGolombRead(); // num_ref_frames
+ gb.BitRead(1); // gaps_in_frame_num_value_allowed_flag
+
+ UINT64 pic_width_in_mbs_minus1 = gb.UExpGolombRead();
+ UINT64 pic_height_in_map_units_minus1 = gb.UExpGolombRead();
+ BYTE frame_mbs_only_flag = (BYTE)gb.BitRead(1);
+
+ h.width = (pic_width_in_mbs_minus1 + 1) * 16;
+ h.height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16;
+
+ if (h.height == 1088) h.height = 1080; // Prevent blur lines
+
+ if (!frame_mbs_only_flag)
+ gb.BitRead(1); // mb_adaptive_frame_field_flag
+ gb.BitRead(1); // direct_8x8_inference_flag
+ if (gb.BitRead(1)) // frame_cropping_flag
+ {
+ gb.UExpGolombRead(); // frame_cropping_rect_left_offset
+ gb.UExpGolombRead(); // frame_cropping_rect_right_offset
+ gb.UExpGolombRead(); // frame_cropping_rect_top_offset
+ gb.UExpGolombRead(); // frame_cropping_rect_bottom_offset
+ }
+
+ if (gb.BitRead(1)) // vui_parameters_present_flag
+ {
+ if (gb.BitRead(1)) // aspect_ratio_info_present_flag
+ {
+ if (255==(BYTE)gb.BitRead(8)) // aspect_ratio_idc)
+ {
+ gb.BitRead(16); // sar_width
+ gb.BitRead(16); // sar_height
+ }
+ }
+
+ if (gb.BitRead(1)) // overscan_info_present_flag
+ {
+ gb.BitRead(1); // overscan_appropriate_flag
+ }
+
+ if (gb.BitRead(1)) // video_signal_type_present_flag
+ {
+ gb.BitRead(3); // video_format
+ gb.BitRead(1); // video_full_range_flag
+ if(gb.BitRead(1)) // colour_description_present_flag
+ {
+ gb.BitRead(8); // colour_primaries
+ gb.BitRead(8); // transfer_characteristics
+ gb.BitRead(8); // matrix_coefficients
+ }
+ }
+ if(gb.BitRead(1)) // chroma_location_info_present_flag
+ {
+ gb.UExpGolombRead(); // chroma_sample_loc_type_top_field
+ gb.UExpGolombRead(); // chroma_sample_loc_type_bottom_field
+ }
+ if (gb.BitRead(1)) // timing_info_present_flag
+ {
+ num_units_in_tick = gb.BitRead(32);
+ time_scale = gb.BitRead(32);
+ fixed_frame_rate_flag = gb.BitRead(1);
+
+ // Trick for weird parameters (10x to Madshi)!
+ if ((num_units_in_tick < 1000) || (num_units_in_tick > 1001))
+ {
+ if ((time_scale % num_units_in_tick != 0) && ((time_scale*1001) % num_units_in_tick == 0))
+ {
+ time_scale = (time_scale * 1001) / num_units_in_tick;
+ num_units_in_tick = 1001;
+ }
+ else
+ {
+ time_scale = (time_scale * 1000) / num_units_in_tick;
+ num_units_in_tick = 1000;
+ }
+ }
+ time_scale = time_scale / 2; // VUI consider fields even for progressive stream : divide by 2!
+
+ if (time_scale)
+ h.AvgTimePerFrame = (10000000I64*num_units_in_tick)/time_scale;
+ }
+ }
+
+ Seek(h.spspos+gb.GetPos());
#else
- __int64 num_units_in_tick;
- __int64 time_scale;
- long fixed_frame_rate_flag;
-
- h.spspos = pos;
-
- h.profile = (BYTE)BitRead(8);
- BitRead(8);
- h.level = (BYTE)BitRead(8);
-
- UExpGolombRead(); // seq_parameter_set_id
-
- if(h.profile >= 100) // high profile
- {
- if(UExpGolombRead() == 3) // chroma_format_idc
- {
- BitRead(1); // residue_transform_flag
- }
-
- UExpGolombRead(); // bit_depth_luma_minus8
- UExpGolombRead(); // bit_depth_chroma_minus8
-
- BitRead(1); // qpprime_y_zero_transform_bypass_flag
-
- if(BitRead(1)) // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++)
- if(BitRead(1)) // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j)
- next = (next + SExpGolombRead() + 256) & 255;
- }
-
- UExpGolombRead(); // log2_max_frame_num_minus4
-
- UINT64 pic_order_cnt_type = UExpGolombRead();
-
- if(pic_order_cnt_type == 0)
- {
- UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- }
- else if(pic_order_cnt_type == 1)
- {
- BitRead(1); // delta_pic_order_always_zero_flag
- SExpGolombRead(); // offset_for_non_ref_pic
- SExpGolombRead(); // offset_for_top_to_bottom_field
- UINT64 num_ref_frames_in_pic_order_cnt_cycle = UExpGolombRead();
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
- SExpGolombRead(); // offset_for_ref_frame[i]
- }
-
- UExpGolombRead(); // num_ref_frames
- BitRead(1); // gaps_in_frame_num_value_allowed_flag
-
- UINT64 pic_width_in_mbs_minus1 = UExpGolombRead();
- UINT64 pic_height_in_map_units_minus1 = UExpGolombRead();
- BYTE frame_mbs_only_flag = (BYTE)BitRead(1);
-
- h.width = (pic_width_in_mbs_minus1 + 1) * 16;
- h.height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16;
-
- if(h.height == 1088) h.height = 1080; // Prevent blur lines
-
- if(!frame_mbs_only_flag)
- BitRead(1); // mb_adaptive_frame_field_flag
- BitRead(1); // direct_8x8_inference_flag
- if(BitRead(1)) // frame_cropping_flag
- {
- UExpGolombRead(); // frame_cropping_rect_left_offset
- UExpGolombRead(); // frame_cropping_rect_right_offset
- UExpGolombRead(); // frame_cropping_rect_top_offset
- UExpGolombRead(); // frame_cropping_rect_bottom_offset
- }
-
- if(BitRead(1)) // vui_parameters_present_flag
- {
- if(BitRead(1)) // aspect_ratio_info_present_flag
- {
- if(255 == (BYTE)BitRead(8)) // aspect_ratio_idc)
- {
- BitRead(16); // sar_width
- BitRead(16); // sar_height
- }
- }
-
- if(BitRead(1)) // overscan_info_present_flag
- {
- BitRead(1); // overscan_appropriate_flag
- }
-
- if(BitRead(1)) // video_signal_type_present_flag
- {
- BitRead(3); // video_format
- BitRead(1); // video_full_range_flag
- if(BitRead(1)) // colour_description_present_flag
- {
- BitRead(8); // colour_primaries
- BitRead(8); // transfer_characteristics
- BitRead(8); // matrix_coefficients
- }
- }
- if(BitRead(1)) // chroma_location_info_present_flag
- {
- UExpGolombRead(); // chroma_sample_loc_type_top_field
- UExpGolombRead(); // chroma_sample_loc_type_bottom_field
- }
- if(BitRead(1)) // timing_info_present_flag
- {
- num_units_in_tick = BitRead(32);
- time_scale = BitRead(32);
- fixed_frame_rate_flag = BitRead(1);
-
- // Trick for weird parameters (10x to Madshi)!
- if((num_units_in_tick < 1000) || (num_units_in_tick > 1001))
- {
- if((time_scale % num_units_in_tick != 0) && ((time_scale * 1001) % num_units_in_tick == 0))
- {
- time_scale = (time_scale * 1001) / num_units_in_tick;
- num_units_in_tick = 1001;
- }
- else
- {
- time_scale = (time_scale * 1000) / num_units_in_tick;
- num_units_in_tick = 1000;
- }
- }
- time_scale = time_scale / 2; // VUI consider fields even for progressive stream : divide by 2!
-
- if(time_scale)
- h.AvgTimePerFrame = (10000000I64 * num_units_in_tick) / time_scale;
- }
- }
+ __int64 num_units_in_tick;
+ __int64 time_scale;
+ long fixed_frame_rate_flag;
+
+ h.spspos = pos;
+
+ h.profile = (BYTE)BitRead(8);
+ BitRead(8);
+ h.level = (BYTE)BitRead(8);
+
+ UExpGolombRead(); // seq_parameter_set_id
+
+ if(h.profile >= 100) // high profile
+ {
+ if(UExpGolombRead() == 3) // chroma_format_idc
+ {
+ BitRead(1); // residue_transform_flag
+ }
+
+ UExpGolombRead(); // bit_depth_luma_minus8
+ UExpGolombRead(); // bit_depth_chroma_minus8
+
+ BitRead(1); // qpprime_y_zero_transform_bypass_flag
+
+ if(BitRead(1)) // seq_scaling_matrix_present_flag
+ for(int i = 0; i < 8; i++)
+ if(BitRead(1)) // seq_scaling_list_present_flag
+ for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j)
+ next = (next + SExpGolombRead() + 256) & 255;
+ }
+
+ UExpGolombRead(); // log2_max_frame_num_minus4
+
+ UINT64 pic_order_cnt_type = UExpGolombRead();
+
+ if(pic_order_cnt_type == 0)
+ {
+ UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
+ }
+ else if(pic_order_cnt_type == 1)
+ {
+ BitRead(1); // delta_pic_order_always_zero_flag
+ SExpGolombRead(); // offset_for_non_ref_pic
+ SExpGolombRead(); // offset_for_top_to_bottom_field
+ UINT64 num_ref_frames_in_pic_order_cnt_cycle = UExpGolombRead();
+ for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
+ SExpGolombRead(); // offset_for_ref_frame[i]
+ }
+
+ UExpGolombRead(); // num_ref_frames
+ BitRead(1); // gaps_in_frame_num_value_allowed_flag
+
+ UINT64 pic_width_in_mbs_minus1 = UExpGolombRead();
+ UINT64 pic_height_in_map_units_minus1 = UExpGolombRead();
+ BYTE frame_mbs_only_flag = (BYTE)BitRead(1);
+
+ h.width = (pic_width_in_mbs_minus1 + 1) * 16;
+ h.height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16;
+
+ if (h.height == 1088) h.height = 1080; // Prevent blur lines
+
+ if (!frame_mbs_only_flag)
+ BitRead(1); // mb_adaptive_frame_field_flag
+ BitRead(1); // direct_8x8_inference_flag
+ if (BitRead(1)) // frame_cropping_flag
+ {
+ UExpGolombRead(); // frame_cropping_rect_left_offset
+ UExpGolombRead(); // frame_cropping_rect_right_offset
+ UExpGolombRead(); // frame_cropping_rect_top_offset
+ UExpGolombRead(); // frame_cropping_rect_bottom_offset
+ }
+
+ if (BitRead(1)) // vui_parameters_present_flag
+ {
+ if (BitRead(1)) // aspect_ratio_info_present_flag
+ {
+ if (255==(BYTE)BitRead(8)) // aspect_ratio_idc)
+ {
+ BitRead(16); // sar_width
+ BitRead(16); // sar_height
+ }
+ }
+
+ if (BitRead(1)) // overscan_info_present_flag
+ {
+ BitRead(1); // overscan_appropriate_flag
+ }
+
+ if (BitRead(1)) // video_signal_type_present_flag
+ {
+ BitRead(3); // video_format
+ BitRead(1); // video_full_range_flag
+ if(BitRead(1)) // colour_description_present_flag
+ {
+ BitRead(8); // colour_primaries
+ BitRead(8); // transfer_characteristics
+ BitRead(8); // matrix_coefficients
+ }
+ }
+ if(BitRead(1)) // chroma_location_info_present_flag
+ {
+ UExpGolombRead(); // chroma_sample_loc_type_top_field
+ UExpGolombRead(); // chroma_sample_loc_type_bottom_field
+ }
+ if (BitRead(1)) // timing_info_present_flag
+ {
+ num_units_in_tick = BitRead(32);
+ time_scale = BitRead(32);
+ fixed_frame_rate_flag = BitRead(1);
+
+ // Trick for weird parameters (10x to Madshi)!
+ if ((num_units_in_tick < 1000) || (num_units_in_tick > 1001))
+ {
+ if ((time_scale % num_units_in_tick != 0) && ((time_scale*1001) % num_units_in_tick == 0))
+ {
+ time_scale = (time_scale * 1001) / num_units_in_tick;
+ num_units_in_tick = 1001;
+ }
+ else
+ {
+ time_scale = (time_scale * 1000) / num_units_in_tick;
+ num_units_in_tick = 1000;
+ }
+ }
+ time_scale = time_scale / 2; // VUI consider fields even for progressive stream : divide by 2!
+
+ if (time_scale)
+ h.AvgTimePerFrame = (10000000I64*num_units_in_tick)/time_scale;
+ }
+ }
#endif
- }
- else if((id & 0x9f) == 0x08 && (id & 0x60) != 0)
- {
- h.ppspos = pos;
- }
+ }
+ else if((id&0x9f) == 0x08 && (id&0x60) != 0)
+ {
+ h.ppspos = pos;
+ }
- BitByteAlign();
+ BitByteAlign();
- dwStartCode = BitRead(32, true);
- while(GetPos() < endpos + 4 && (dwStartCode != 0x00000001) && (dwStartCode & 0xFFFFFF00) != 0x00000100)
- {
- BitRead(8);
- dwStartCode = BitRead(32, true);
- }
+ dwStartCode = BitRead(32, true);
+ while(GetPos() < endpos+4 && (dwStartCode != 0x00000001) && (dwStartCode & 0xFFFFFF00) != 0x00000100)
+ {
+ BitRead(8);
+ dwStartCode = BitRead(32, true);
+ }
- if(h.spspos != 0 && h.spslen == 0)
- h.spslen = GetPos() - h.spspos;
- else if(h.ppspos != 0 && h.ppslen == 0)
- h.ppslen = GetPos() - h.ppspos;
+ if(h.spspos != 0 && h.spslen == 0)
+ h.spslen = GetPos() - h.spspos;
+ else if(h.ppspos != 0 && h.ppslen == 0)
+ h.ppslen = GetPos() - h.ppspos;
- }
+ }
- if(!h.spspos || !h.spslen || !h.ppspos || !h.ppslen)
- return(false);
+ if(!h.spspos || !h.spslen || !h.ppspos || !h.ppslen)
+ return(false);
- if(!pmt) return(true);
+ if(!pmt) return(true);
- {
- int extra = 2 + h.spslen - 4 + 2 + h.ppslen - 4;
+ {
+ int extra = 2+h.spslen-4 + 2+h.ppslen-4;
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = FOURCCMap('1CVA');
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = FOURCCMap('1CVA');
//pmt->subtype = MEDIASUBTYPE_H264; // TODO : put MEDIASUBTYPE_H264 to support Windows 7 decoder !
- pmt->formattype = FORMAT_MPEG2_VIDEO;
- int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extra;
- MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
- memset(vi, 0, len);
- // vi->hdr.dwBitRate = ;
- vi->hdr.AvgTimePerFrame = h.AvgTimePerFrame;
- vi->hdr.dwPictAspectRatioX = h.width;
- vi->hdr.dwPictAspectRatioY = h.height;
- vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
- vi->hdr.bmiHeader.biWidth = h.width;
- vi->hdr.bmiHeader.biHeight = h.height;
- vi->hdr.bmiHeader.biCompression = '1CVA';
- vi->dwProfile = h.profile;
- vi->dwFlags = 4; // ?
- vi->dwLevel = h.level;
- vi->cbSequenceHeader = extra;
- BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
- *p++ = (h.spslen - 4) >> 8;
- *p++ = (h.spslen - 4) & 0xff;
- Seek(h.spspos + 4);
- ByteRead(p, h.spslen - 4);
- p += h.spslen - 4;
- *p++ = (h.ppslen - 4) >> 8;
- *p++ = (h.ppslen - 4) & 0xff;
- Seek(h.ppspos + 4);
- ByteRead(p, h.ppslen - 4);
- p += h.ppslen - 4;
- pmt->SetFormat((BYTE*)vi, len);
- delete [] vi;
- }
-
- return(true);
+ pmt->formattype = FORMAT_MPEG2_VIDEO;
+ int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extra;
+ MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
+ memset(vi, 0, len);
+ // vi->hdr.dwBitRate = ;
+ vi->hdr.AvgTimePerFrame = h.AvgTimePerFrame;
+ vi->hdr.dwPictAspectRatioX = h.width;
+ vi->hdr.dwPictAspectRatioY = h.height;
+ vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ vi->hdr.bmiHeader.biWidth = h.width;
+ vi->hdr.bmiHeader.biHeight = h.height;
+ vi->hdr.bmiHeader.biCompression = '1CVA';
+ vi->dwProfile = h.profile;
+ vi->dwFlags = 4; // ?
+ vi->dwLevel = h.level;
+ vi->cbSequenceHeader = extra;
+ BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
+ *p++ = (h.spslen-4) >> 8;
+ *p++ = (h.spslen-4) & 0xff;
+ Seek(h.spspos+4);
+ ByteRead(p, h.spslen-4);
+ p += h.spslen-4;
+ *p++ = (h.ppslen-4) >> 8;
+ *p++ = (h.ppslen-4) & 0xff;
+ Seek(h.ppspos+4);
+ ByteRead(p, h.ppslen-4);
+ p += h.ppslen-4;
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(vc1hdr& h, int len, CMediaType* pmt)
{
- __int64 endpos = GetPos() + len; // - sequence header length
- __int64 extrapos = 0, extralen = 0;
- int nFrameRateNum = 0, nFrameRateDen = 1;
-
- if(GetPos() < endpos + 4 && BitRead(32, true) == 0x0000010F)
- {
- extrapos = GetPos();
-
- BitRead(32);
-
- h.profile = BitRead(2);
-
- // Check if advanced profile
- if(h.profile != 3) return(false);
-
- h.level = BitRead(3);
- h.chromaformat = BitRead(2);
-
- // (fps-2)/4 (->30)
- h.frmrtq_postproc = BitRead(3); //common
- // (bitrate-32kbps)/64kbps
- h.bitrtq_postproc = BitRead(5); //common
- h.postprocflag = BitRead(1); //common
-
- h.width = (BitRead(12) + 1) << 1;
- h.height = (BitRead(12) + 1) << 1;
-
- h.broadcast = BitRead(1);
- h.interlace = BitRead(1);
- h.tfcntrflag = BitRead(1);
- h.finterpflag = BitRead(1);
- BitRead(1); // reserved
- h.psf = BitRead(1);
- if(BitRead(1))
- {
- int ar = 0;
- h.ArX = BitRead(14) + 1;
- h.ArY = BitRead(14) + 1;
- if(BitRead(1))
- ar = BitRead(4);
- // TODO : next is not the true A/R!
- if(ar && ar < 14)
- {
+ __int64 endpos = GetPos() + len; // - sequence header length
+ __int64 extrapos = 0, extralen = 0;
+ int nFrameRateNum = 0, nFrameRateDen = 1;
+
+ if (GetPos() < endpos+4 && BitRead(32, true) == 0x0000010F)
+ {
+ extrapos = GetPos();
+
+ BitRead(32);
+
+ h.profile = BitRead(2);
+
+ // Check if advanced profile
+ if (h.profile != 3) return(false);
+
+ h.level = BitRead (3);
+ h.chromaformat = BitRead (2);
+
+ // (fps-2)/4 (->30)
+ h.frmrtq_postproc = BitRead (3); //common
+ // (bitrate-32kbps)/64kbps
+ h.bitrtq_postproc = BitRead (5); //common
+ h.postprocflag = BitRead (1); //common
+
+ h.width = (BitRead (12) + 1) << 1;
+ h.height = (BitRead (12) + 1) << 1;
+
+ h.broadcast = BitRead (1);
+ h.interlace = BitRead (1);
+ h.tfcntrflag = BitRead (1);
+ h.finterpflag = BitRead (1);
+ BitRead (1); // reserved
+ h.psf = BitRead (1);
+ if(BitRead (1))
+ {
+ int ar = 0;
+ h.ArX = BitRead (14) + 1;
+ h.ArY = BitRead (14) + 1;
+ if(BitRead (1))
+ ar = BitRead (4);
+ // TODO : next is not the true A/R!
+ if(ar && ar < 14)
+ {
// h.ArX = ff_vc1_pixel_aspect[ar].num;
// h.ArY = ff_vc1_pixel_aspect[ar].den;
- }
- else if(ar == 15)
- {
- /*h.ArX =*/ BitRead(8);
- /*h.ArY =*/
- BitRead(8);
- }
-
- // Read framerate
- const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
- ff_vc1_fps_dr[2] = { 1000, 1001 };
-
- if(BitRead(1))
- {
- if(BitRead(1))
- {
- nFrameRateNum = 32;
- nFrameRateDen = BitRead(16) + 1;
- }
- else
- {
- int nr, dr;
- nr = BitRead(8);
- dr = BitRead(4);
- if(nr && nr < 8 && dr && dr < 3)
- {
- nFrameRateNum = ff_vc1_fps_dr[dr - 1];
- nFrameRateDen = ff_vc1_fps_nr[nr - 1] * 1000;
- }
- }
- }
-
- }
-
- Seek(extrapos + 4);
- extralen = 0;
- long parse = 0;
-
- while(GetPos() < endpos + 4 && ((parse == 0x0000010E) || (parse & 0xFFFFFF00) != 0x00000100))
- {
- parse = (parse << 8) | BitRead(8);
- extralen++;
- }
- }
-
- if(!extrapos || !extralen)
- return(false);
-
- if(!pmt) return(true);
-
- {
- //pmt->majortype = MEDIATYPE_Video;
- //pmt->subtype = FOURCCMap('1CVW');
- //pmt->formattype = FORMAT_MPEG2_VIDEO;
- //int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extralen + 1;
- //MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
- //memset(vi, 0, len);
- //// vi->hdr.dwBitRate = ;
- //vi->hdr.AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
- //vi->hdr.dwPictAspectRatioX = h.width;
- //vi->hdr.dwPictAspectRatioY = h.height;
- //vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
- //vi->hdr.bmiHeader.biWidth = h.width;
- //vi->hdr.bmiHeader.biHeight = h.height;
- //vi->hdr.bmiHeader.biCompression = '1CVW';
- //vi->dwProfile = h.profile;
- //vi->dwFlags = 4; // ?
- //vi->dwLevel = h.level;
- //vi->cbSequenceHeader = extralen+1;
- //BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
- //*p++ = 0;
- //Seek(extrapos);
- //ByteRead(p, extralen);
- //pmt->SetFormat((BYTE*)vi, len);
- //delete [] vi;
-
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = FOURCCMap('1CVW');
- pmt->formattype = FORMAT_VIDEOINFO2;
- int len = sizeof(VIDEOINFOHEADER2) + extralen + 1;
- VIDEOINFOHEADER2* vi = (VIDEOINFOHEADER2*)DNew BYTE[len];
- memset(vi, 0, len);
- vi->AvgTimePerFrame = (10000000I64 * nFrameRateNum) / nFrameRateDen;
- vi->dwPictAspectRatioX = h.width;
- vi->dwPictAspectRatioY = h.height;
- vi->bmiHeader.biSize = sizeof(vi->bmiHeader);
- vi->bmiHeader.biWidth = h.width;
- vi->bmiHeader.biHeight = h.height;
- vi->bmiHeader.biCompression = '1CVW';
- BYTE* p = (BYTE*)vi + sizeof(VIDEOINFOHEADER2);
- *p++ = 0;
- Seek(extrapos);
- ByteRead(p, extralen);
- pmt->SetFormat((BYTE*)vi, len);
- delete [] vi;
- }
-
- return(true);
+ }
+ else if(ar == 15)
+ {
+ /*h.ArX =*/ BitRead (8);
+ /*h.ArY =*/ BitRead (8);
+ }
+
+ // Read framerate
+ const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
+ ff_vc1_fps_dr[2] = { 1000, 1001 };
+
+ if(BitRead (1))
+ {
+ if(BitRead (1))
+ {
+ nFrameRateNum = 32;
+ nFrameRateDen = BitRead (16) + 1;
+ } else {
+ int nr, dr;
+ nr = BitRead (8);
+ dr = BitRead (4);
+ if(nr && nr < 8 && dr && dr < 3)
+ {
+ nFrameRateNum = ff_vc1_fps_dr[dr - 1];
+ nFrameRateDen = ff_vc1_fps_nr[nr - 1] * 1000;
+ }
+ }
+ }
+
+ }
+
+ Seek(extrapos+4);
+ extralen = 0;
+ long parse = 0;
+
+ while (GetPos() < endpos+4 && ((parse == 0x0000010E) || (parse & 0xFFFFFF00) != 0x00000100))
+ {
+ parse = (parse<<8) | BitRead(8);
+ extralen++;
+ }
+ }
+
+ if(!extrapos || !extralen)
+ return(false);
+
+ if(!pmt) return(true);
+
+ {
+ //pmt->majortype = MEDIATYPE_Video;
+ //pmt->subtype = FOURCCMap('1CVW');
+ //pmt->formattype = FORMAT_MPEG2_VIDEO;
+ //int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extralen + 1;
+ //MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)DNew BYTE[len];
+ //memset(vi, 0, len);
+ //// vi->hdr.dwBitRate = ;
+ //vi->hdr.AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
+ //vi->hdr.dwPictAspectRatioX = h.width;
+ //vi->hdr.dwPictAspectRatioY = h.height;
+ //vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ //vi->hdr.bmiHeader.biWidth = h.width;
+ //vi->hdr.bmiHeader.biHeight = h.height;
+ //vi->hdr.bmiHeader.biCompression = '1CVW';
+ //vi->dwProfile = h.profile;
+ //vi->dwFlags = 4; // ?
+ //vi->dwLevel = h.level;
+ //vi->cbSequenceHeader = extralen+1;
+ //BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
+ //*p++ = 0;
+ //Seek(extrapos);
+ //ByteRead(p, extralen);
+ //pmt->SetFormat((BYTE*)vi, len);
+ //delete [] vi;
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = FOURCCMap('1CVW');
+ pmt->formattype = FORMAT_VIDEOINFO2;
+ int len = sizeof(VIDEOINFOHEADER2) + extralen + 1;
+ VIDEOINFOHEADER2* vi = (VIDEOINFOHEADER2*)DNew BYTE[len];
+ memset(vi, 0, len);
+ vi->AvgTimePerFrame = (10000000I64*nFrameRateNum)/nFrameRateDen;
+ vi->dwPictAspectRatioX = h.width;
+ vi->dwPictAspectRatioY = h.height;
+ vi->bmiHeader.biSize = sizeof(vi->bmiHeader);
+ vi->bmiHeader.biWidth = h.width;
+ vi->bmiHeader.biHeight = h.height;
+ vi->bmiHeader.biCompression = '1CVW';
+ BYTE* p = (BYTE*)vi + sizeof(VIDEOINFOHEADER2);
+ *p++ = 0;
+ Seek(extrapos);
+ ByteRead(p, extralen);
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+
+ return(true);
}
bool CBaseSplitterFileEx::Read(dvbsub& h, int len, CMediaType* pmt)
{
- __int64 endpos = GetPos() + len; // - sequence header length
- __int64 extrapos = 0, extralen = 0;
- int nFrameRateNum = 0, nFrameRateDen = 1;
+ __int64 endpos = GetPos() + len; // - sequence header length
+ __int64 extrapos = 0, extralen = 0;
+ int nFrameRateNum = 0, nFrameRateDen = 1;
- if((BitRead(32, true) & 0xFFFFFF00) == 0x20000f00)
- {
- static const SUBTITLEINFO SubFormat = { 0, "", L"" };
+ if ((BitRead(32, true) & 0xFFFFFF00) == 0x20000f00)
+ {
+ static const SUBTITLEINFO SubFormat = { 0, "", L"" };
- pmt->majortype = MEDIATYPE_Subtitle;
- pmt->subtype = MEDIASUBTYPE_DVB_SUBTITLES;
- pmt->formattype = FORMAT_None;
- pmt->SetFormat((BYTE*)&SubFormat, sizeof(SUBTITLEINFO));
+ pmt->majortype = MEDIATYPE_Subtitle;
+ pmt->subtype = MEDIASUBTYPE_DVB_SUBTITLES;
+ pmt->formattype = FORMAT_None;
+ pmt->SetFormat ((BYTE*)&SubFormat, sizeof(SUBTITLEINFO));
- return true;
- }
+ return true;
+ }
- return false;
+ return false;
}
/*
diff --git a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
index 7cb0ae0d6..72f604c85 100644
--- a/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
+++ b/src/filters/parser/BaseSplitter/BaseSplitterFileEx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,363 +25,360 @@
class CBaseSplitterFileEx : public CBaseSplitterFile
{
- int m_tslen; // transport stream packet length (188 or 192 bytes, auto-detected)
+ int m_tslen; // transport stream packet length (188 or 192 bytes, auto-detected)
protected :
- REFERENCE_TIME m_rtPTSOffset;
+ REFERENCE_TIME m_rtPTSOffset;
public:
- CBaseSplitterFileEx(IAsyncReader* pReader, HRESULT& hr, int cachelen = DEFAULT_CACHE_LENGTH, bool fRandomAccess = true, bool fStreaming = false);
- virtual ~CBaseSplitterFileEx();
+ CBaseSplitterFileEx(IAsyncReader* pReader, HRESULT& hr, int cachelen = DEFAULT_CACHE_LENGTH, bool fRandomAccess = true, bool fStreaming = false);
+ virtual ~CBaseSplitterFileEx();
- // using CBaseSplitterFile::Read;
+ // using CBaseSplitterFile::Read;
- bool NextMpegStartCode(BYTE& b, __int64 len = 65536);
+ bool NextMpegStartCode(BYTE& b, __int64 len = 65536);
#pragma pack(push, 1)
- enum mpeg_t {mpegunk, mpeg1, mpeg2};
-
- struct pshdr
- {
- mpeg_t type;
- UINT64 scr, bitrate;
- };
-
- struct pssyshdr
- {
- DWORD rate_bound;
- BYTE video_bound, audio_bound;
- bool fixed_rate, csps;
- bool sys_video_loc_flag, sys_audio_loc_flag;
- };
-
- struct peshdr
- {
- WORD len;
-
- BYTE type: 2, fpts: 1, fdts: 1;
- REFERENCE_TIME pts, dts;
-
- // mpeg1 stuff
- UINT64 std_buff_size;
-
- // mpeg2 stuff
- BYTE scrambling: 2, priority: 1, alignment: 1, copyright: 1, original: 1;
- BYTE escr: 1, esrate: 1, dsmtrickmode: 1, morecopyright: 1, crc: 1, extension: 1;
- BYTE hdrlen;
-
- struct peshdr()
- {
- memset(this, 0, sizeof(*this));
- }
- };
-
- class seqhdr
- {
- public:
- WORD width;
- WORD height;
- BYTE ar: 4;
- DWORD ifps;
- DWORD bitrate;
- DWORD vbv;
- BYTE constrained: 1;
- BYTE fiqm: 1;
- BYTE iqm[64];
- BYTE fniqm: 1;
- BYTE niqm[64];
- // ext
- BYTE startcodeid: 4;
- BYTE profile_levelescape: 1;
- BYTE profile: 3;
- BYTE level: 4;
- BYTE progressive: 1;
- BYTE chroma: 2;
- BYTE lowdelay: 1;
- // misc
- int arx, ary;
- };
-
- class mpahdr
- {
- public:
- WORD sync: 11;
- WORD version: 2;
- WORD layer: 2;
- WORD crc: 1;
- WORD bitrate: 4;
- WORD freq: 2;
- WORD padding: 1;
- WORD privatebit: 1;
- WORD channels: 2;
- WORD modeext: 2;
- WORD copyright: 1;
- WORD original: 1;
- WORD emphasis: 2;
-
- int nSamplesPerSec, FrameSize, nBytesPerSec;
- REFERENCE_TIME rtDuration;
- };
-
- class aachdr
- {
- public:
- WORD sync: 12;
- WORD version: 1;
- WORD layer: 2;
- WORD fcrc: 1;
- WORD profile: 2;
- WORD freq: 4;
- WORD privatebit: 1;
- WORD channels: 3;
- WORD original: 1;
- WORD home: 1; // ?
-
- WORD copyright_id_bit: 1;
- WORD copyright_id_start: 1;
- WORD aac_frame_length: 13;
- WORD adts_buffer_fullness: 11;
- WORD no_raw_data_blocks_in_frame: 2;
-
- WORD crc;
-
- int FrameSize, nBytesPerSec;
- REFERENCE_TIME rtDuration;
- };
-
- class ac3hdr
- {
- public:
- WORD sync;
- WORD crc1;
- BYTE fscod: 2;
- BYTE frmsizecod: 6;
- BYTE bsid: 5;
- BYTE bsmod: 3;
- BYTE acmod: 3;
- BYTE cmixlev: 2;
- BYTE surmixlev: 2;
- BYTE dsurmod: 2;
- BYTE lfeon: 1;
- // the rest is unimportant for us
- };
-
- class dtshdr
- {
- public:
- DWORD sync;
- BYTE frametype: 1;
- BYTE deficitsamplecount: 5;
- BYTE fcrc: 1;
- BYTE nblocks: 7;
- WORD framebytes;
- BYTE amode: 6;
- BYTE sfreq: 4;
- BYTE rate: 5;
-
- BYTE downmix: 1;
- BYTE dynrange: 1;
- BYTE timestamp: 1;
- BYTE aux_data: 1;
- BYTE hdcd: 1;
- BYTE ext_descr: 3;
- BYTE ext_coding: 1;
- BYTE aspf: 1;
- BYTE lfe: 2;
- BYTE predictor_history: 1;
-
- };
-
- class lpcmhdr
- {
- public:
- BYTE emphasis: 1;
- BYTE mute: 1;
- BYTE reserved1: 1;
- BYTE framenum: 5;
- BYTE quantwordlen: 2;
- BYTE freq: 2; // 48, 96, 44.1, 32
- BYTE reserved2: 1;
- BYTE channels: 3; // +1
- BYTE drc; // 0x80: off
- };
-
- class hdmvlpcmhdr
- {
- public:
- WORD size;
- BYTE channels: 4;
- BYTE samplerate: 4;
- BYTE bitpersample: 2;
- };
-
- class dvdspuhdr
- {
- public:
- // nothing ;)
- };
-
- class hdmvsubhdr
- {
- public:
- // nothing ;)
- };
-
- class svcdspuhdr
- {
- public:
- // nothing ;)
- };
-
- class cvdspuhdr
- {
- public:
- // nothing ;)
- };
-
- class ps2audhdr
- {
- public:
- // 'SShd' + len (0x18)
- DWORD unk1;
- DWORD freq;
- DWORD channels;
- DWORD interleave; // bytes per channel
- // padding: FF .. FF
- // 'SSbd' + len
- // pcm or adpcm data
- };
-
- class ps2subhdr
- {
- public:
- // nothing ;)
- };
-
- struct trhdr
- {
- BYTE sync; // 0x47
- BYTE error: 1;
- BYTE payloadstart: 1;
- BYTE transportpriority: 1;
- WORD pid: 13;
- BYTE scrambling: 2;
- BYTE adapfield: 1;
- BYTE payload: 1;
- BYTE counter: 4;
- // if adapfield set
- BYTE length;
- BYTE discontinuity: 1;
- BYTE randomaccess: 1;
- BYTE priority: 1;
- BYTE fPCR: 1;
- BYTE OPCR: 1;
- BYTE splicingpoint: 1;
- BYTE privatedata: 1;
- BYTE extension: 1;
- // TODO: add more fields here when the flags above are set (they aren't very interesting...)
- __int64 PCR;
-
- int bytes;
- __int64 next;
- };
-
- struct trsechdr
- {
- BYTE table_id;
- WORD section_syntax_indicator: 1;
- WORD zero: 1;
- WORD reserved1: 2;
- WORD section_length: 12;
- WORD transport_stream_id;
- BYTE reserved2: 2;
- BYTE version_number: 5;
- BYTE current_next_indicator: 1;
- BYTE section_number;
- BYTE last_section_number;
- };
-
- // http://www.technotrend.de/download/av_format_v1.pdf
-
- struct pvahdr
- {
- WORD sync; // 'VA'
- BYTE streamid; // 1 - video, 2 - audio
- BYTE counter;
- BYTE res1; // 0x55
- BYTE res2: 3;
- BYTE fpts: 1;
- BYTE postbytes: 2;
- BYTE prebytes: 2;
- WORD length;
- REFERENCE_TIME pts;
- };
-
- struct avchdr
- {
- BYTE profile, level;
- unsigned int width, height;
- __int64 spspos, spslen;
- __int64 ppspos, ppslen;
- __int64 AvgTimePerFrame;
-
- avchdr()
- {
- spspos = 0;
- spslen = 0;
- ppspos = 0;
- ppslen = 0;
- AvgTimePerFrame = 0;
- }
- };
-
- struct vc1hdr
- {
- BYTE profile;
- BYTE level;
- BYTE chromaformat;
- BYTE frmrtq_postproc;
- BYTE bitrtq_postproc;
- BYTE postprocflag;
- BYTE broadcast;
- BYTE interlace;
- BYTE tfcntrflag;
- BYTE finterpflag;
- BYTE psf;
- UINT ArX;
- UINT ArY;
- unsigned int width, height;
- };
-
- struct dvbsub
- {
- };
+ enum mpeg_t {mpegunk, mpeg1, mpeg2};
+
+ struct pshdr
+ {
+ mpeg_t type;
+ UINT64 scr, bitrate;
+ };
+
+ struct pssyshdr
+ {
+ DWORD rate_bound;
+ BYTE video_bound, audio_bound;
+ bool fixed_rate, csps;
+ bool sys_video_loc_flag, sys_audio_loc_flag;
+ };
+
+ struct peshdr
+ {
+ WORD len;
+
+ BYTE type:2, fpts:1, fdts:1;
+ REFERENCE_TIME pts, dts;
+
+ // mpeg1 stuff
+ UINT64 std_buff_size;
+
+ // mpeg2 stuff
+ BYTE scrambling:2, priority:1, alignment:1, copyright:1, original:1;
+ BYTE escr:1, esrate:1, dsmtrickmode:1, morecopyright:1, crc:1, extension:1;
+ BYTE hdrlen;
+
+ struct peshdr() {memset(this, 0, sizeof(*this));}
+ };
+
+ class seqhdr
+ {
+ public:
+ WORD width;
+ WORD height;
+ BYTE ar:4;
+ DWORD ifps;
+ DWORD bitrate;
+ DWORD vbv;
+ BYTE constrained:1;
+ BYTE fiqm:1;
+ BYTE iqm[64];
+ BYTE fniqm:1;
+ BYTE niqm[64];
+ // ext
+ BYTE startcodeid:4;
+ BYTE profile_levelescape:1;
+ BYTE profile:3;
+ BYTE level:4;
+ BYTE progressive:1;
+ BYTE chroma:2;
+ BYTE lowdelay:1;
+ // misc
+ int arx, ary;
+ };
+
+ class mpahdr
+ {
+ public:
+ WORD sync:11;
+ WORD version:2;
+ WORD layer:2;
+ WORD crc:1;
+ WORD bitrate:4;
+ WORD freq:2;
+ WORD padding:1;
+ WORD privatebit:1;
+ WORD channels:2;
+ WORD modeext:2;
+ WORD copyright:1;
+ WORD original:1;
+ WORD emphasis:2;
+
+ int nSamplesPerSec, FrameSize, nBytesPerSec;
+ REFERENCE_TIME rtDuration;
+ };
+
+ class aachdr
+ {
+ public:
+ WORD sync:12;
+ WORD version:1;
+ WORD layer:2;
+ WORD fcrc:1;
+ WORD profile:2;
+ WORD freq:4;
+ WORD privatebit:1;
+ WORD channels:3;
+ WORD original:1;
+ WORD home:1; // ?
+
+ WORD copyright_id_bit:1;
+ WORD copyright_id_start:1;
+ WORD aac_frame_length:13;
+ WORD adts_buffer_fullness:11;
+ WORD no_raw_data_blocks_in_frame:2;
+
+ WORD crc;
+
+ int FrameSize, nBytesPerSec;
+ REFERENCE_TIME rtDuration;
+ };
+
+ class ac3hdr
+ {
+ public:
+ WORD sync;
+ WORD crc1;
+ BYTE fscod:2;
+ BYTE frmsizecod:6;
+ BYTE bsid:5;
+ BYTE bsmod:3;
+ BYTE acmod:3;
+ BYTE cmixlev:2;
+ BYTE surmixlev:2;
+ BYTE dsurmod:2;
+ BYTE lfeon:1;
+ // the rest is unimportant for us
+ };
+
+ class dtshdr
+ {
+ public:
+ DWORD sync;
+ BYTE frametype:1;
+ BYTE deficitsamplecount:5;
+ BYTE fcrc:1;
+ BYTE nblocks:7;
+ WORD framebytes;
+ BYTE amode:6;
+ BYTE sfreq:4;
+ BYTE rate:5;
+
+ BYTE downmix:1;
+ BYTE dynrange:1;
+ BYTE timestamp:1;
+ BYTE aux_data:1;
+ BYTE hdcd:1;
+ BYTE ext_descr:3;
+ BYTE ext_coding:1;
+ BYTE aspf:1;
+ BYTE lfe:2;
+ BYTE predictor_history:1;
+
+ };
+
+ class lpcmhdr
+ {
+ public:
+ BYTE emphasis:1;
+ BYTE mute:1;
+ BYTE reserved1:1;
+ BYTE framenum:5;
+ BYTE quantwordlen:2;
+ BYTE freq:2; // 48, 96, 44.1, 32
+ BYTE reserved2:1;
+ BYTE channels:3; // +1
+ BYTE drc; // 0x80: off
+ };
+
+ class hdmvlpcmhdr
+ {
+ public:
+ WORD size;
+ BYTE channels:4;
+ BYTE samplerate:4;
+ BYTE bitpersample:2;
+ };
+
+ class dvdspuhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class hdmvsubhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class svcdspuhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class cvdspuhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class ps2audhdr
+ {
+ public:
+ // 'SShd' + len (0x18)
+ DWORD unk1;
+ DWORD freq;
+ DWORD channels;
+ DWORD interleave; // bytes per channel
+ // padding: FF .. FF
+ // 'SSbd' + len
+ // pcm or adpcm data
+ };
+
+ class ps2subhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ struct trhdr
+ {
+ BYTE sync; // 0x47
+ BYTE error:1;
+ BYTE payloadstart:1;
+ BYTE transportpriority:1;
+ WORD pid:13;
+ BYTE scrambling:2;
+ BYTE adapfield:1;
+ BYTE payload:1;
+ BYTE counter:4;
+ // if adapfield set
+ BYTE length;
+ BYTE discontinuity:1;
+ BYTE randomaccess:1;
+ BYTE priority:1;
+ BYTE fPCR:1;
+ BYTE OPCR:1;
+ BYTE splicingpoint:1;
+ BYTE privatedata:1;
+ BYTE extension:1;
+ // TODO: add more fields here when the flags above are set (they aren't very interesting...)
+ __int64 PCR;
+
+ int bytes;
+ __int64 next;
+ };
+
+ struct trsechdr
+ {
+ BYTE table_id;
+ WORD section_syntax_indicator:1;
+ WORD zero:1;
+ WORD reserved1:2;
+ WORD section_length:12;
+ WORD transport_stream_id;
+ BYTE reserved2:2;
+ BYTE version_number:5;
+ BYTE current_next_indicator:1;
+ BYTE section_number;
+ BYTE last_section_number;
+ };
+
+ // http://www.technotrend.de/download/av_format_v1.pdf
+
+ struct pvahdr
+ {
+ WORD sync; // 'VA'
+ BYTE streamid; // 1 - video, 2 - audio
+ BYTE counter;
+ BYTE res1; // 0x55
+ BYTE res2:3;
+ BYTE fpts:1;
+ BYTE postbytes:2;
+ BYTE prebytes:2;
+ WORD length;
+ REFERENCE_TIME pts;
+ };
+
+ struct avchdr
+ {
+ BYTE profile, level;
+ unsigned int width, height;
+ __int64 spspos, spslen;
+ __int64 ppspos, ppslen;
+ __int64 AvgTimePerFrame;
+
+ avchdr()
+ {
+ spspos = 0;
+ spslen = 0;
+ ppspos = 0;
+ ppslen = 0;
+ AvgTimePerFrame = 0;
+ }
+ };
+
+ struct vc1hdr
+ {
+ BYTE profile;
+ BYTE level;
+ BYTE chromaformat;
+ BYTE frmrtq_postproc;
+ BYTE bitrtq_postproc;
+ BYTE postprocflag;
+ BYTE broadcast;
+ BYTE interlace;
+ BYTE tfcntrflag;
+ BYTE finterpflag;
+ BYTE psf;
+ UINT ArX;
+ UINT ArY;
+ unsigned int width, height;
+ };
+
+ struct dvbsub
+ {
+ };
#pragma pack(pop)
- bool Read(pshdr& h);
- bool Read(pssyshdr& h);
- bool Read(peshdr& h, BYTE code);
- bool Read(seqhdr& h, int len, CMediaType* pmt = NULL);
- bool Read(mpahdr& h, int len, bool fAllowV25, CMediaType* pmt = NULL);
- bool Read(aachdr& h, int len, CMediaType* pmt = NULL);
- bool Read(ac3hdr& h, int len, CMediaType* pmt = NULL);
- bool Read(dtshdr& h, int len, CMediaType* pmt = NULL);
- bool Read(lpcmhdr& h, CMediaType* pmt = NULL);
- bool Read(hdmvlpcmhdr& h, CMediaType* pmt = NULL);
- bool Read(dvdspuhdr& h, CMediaType* pmt = NULL);
- bool Read(hdmvsubhdr& h, CMediaType* pmt = NULL, const char* language_code = NULL);
- bool Read(svcdspuhdr& h, CMediaType* pmt = NULL);
- bool Read(cvdspuhdr& h, CMediaType* pmt = NULL);
- bool Read(ps2audhdr& h, CMediaType* pmt = NULL);
- bool Read(ps2subhdr& h, CMediaType* pmt = NULL);
- bool Read(trhdr& h, bool fSync = true);
- bool Read(trsechdr& h);
- bool Read(pvahdr& h, bool fSync = true);
- bool Read(avchdr& h, int len, CMediaType* pmt = NULL);
- bool Read(vc1hdr& h, int len, CMediaType* pmt = NULL);
- bool Read(dvbsub& h, int len, CMediaType* pmt = NULL);
-
- void RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length);
+ bool Read(pshdr& h);
+ bool Read(pssyshdr& h);
+ bool Read(peshdr& h, BYTE code);
+ bool Read(seqhdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(mpahdr& h, int len, bool fAllowV25, CMediaType* pmt = NULL);
+ bool Read(aachdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(ac3hdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(dtshdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(lpcmhdr& h, CMediaType* pmt = NULL);
+ bool Read(hdmvlpcmhdr& h, CMediaType* pmt = NULL);
+ bool Read(dvdspuhdr& h, CMediaType* pmt = NULL);
+ bool Read(hdmvsubhdr& h, CMediaType* pmt = NULL, const char* language_code = NULL);
+ bool Read(svcdspuhdr& h, CMediaType* pmt = NULL);
+ bool Read(cvdspuhdr& h, CMediaType* pmt = NULL);
+ bool Read(ps2audhdr& h, CMediaType* pmt = NULL);
+ bool Read(ps2subhdr& h, CMediaType* pmt = NULL);
+ bool Read(trhdr& h, bool fSync = true);
+ bool Read(trsechdr& h);
+ bool Read(pvahdr& h, bool fSync = true);
+ bool Read(avchdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(vc1hdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(dvbsub& h, int len, CMediaType* pmt = NULL);
+
+ void RemoveMpegEscapeCode(BYTE* dst, BYTE* src, int length);
};
diff --git a/src/filters/parser/BaseSplitter/MultiFiles.cpp b/src/filters/parser/BaseSplitter/MultiFiles.cpp
index 0e1443d89..c40610d85 100644
--- a/src/filters/parser/BaseSplitter/MultiFiles.cpp
+++ b/src/filters/parser/BaseSplitter/MultiFiles.cpp
@@ -28,182 +28,181 @@
IMPLEMENT_DYNAMIC(CMultiFiles, CObject)
CMultiFiles::CMultiFiles()
- : m_hFile(INVALID_HANDLE_VALUE)
- , m_llTotalLength(0)
- , m_nCurPart(-1)
- , m_pCurrentPTSOffset(NULL)
+ : m_hFile(INVALID_HANDLE_VALUE)
+ , m_llTotalLength(0)
+ , m_nCurPart(-1)
+ , m_pCurrentPTSOffset(NULL)
{
}
void CMultiFiles::Reset()
{
- m_strFiles.RemoveAll();
- m_FilesSize.RemoveAll();
- m_rtPtsOffsets.RemoveAll();
- m_llTotalLength = 0;
+ m_strFiles.RemoveAll();
+ m_FilesSize.RemoveAll();
+ m_rtPtsOffsets.RemoveAll();
+ m_llTotalLength = 0;
}
BOOL CMultiFiles::Open(LPCTSTR lpszFileName, UINT nOpenFlags)
{
- Reset();
- m_strFiles.Add(lpszFileName);
+ Reset();
+ m_strFiles.Add (lpszFileName);
- return OpenPart(0);
+ return OpenPart(0);
}
BOOL CMultiFiles::OpenFiles(CAtlList<CHdmvClipInfo::PlaylistItem>& files, UINT nOpenFlags)
{
- POSITION pos = files.GetHeadPosition();
- LARGE_INTEGER llSize;
- int nPos = 0;
- REFERENCE_TIME rtDur = 0;
-
- Reset();
- while(pos)
- {
- CHdmvClipInfo::PlaylistItem& s = files.GetNext(pos);
- m_strFiles.Add(s.m_strFileName);
- if(!OpenPart(nPos)) return false;
-
- llSize.QuadPart = 0;
- GetFileSizeEx(m_hFile, &llSize);
- m_llTotalLength += llSize.QuadPart;
- m_FilesSize.Add(llSize.QuadPart);
- m_rtPtsOffsets.Add(rtDur);
- rtDur += s.Duration();
- nPos++;
- }
-
- if(files.GetCount() > 1) ClosePart();
-
- return TRUE;
+ POSITION pos = files.GetHeadPosition();
+ LARGE_INTEGER llSize;
+ int nPos = 0;
+ REFERENCE_TIME rtDur = 0;
+
+ Reset();
+ while(pos)
+ {
+ CHdmvClipInfo::PlaylistItem& s = files.GetNext(pos);
+ m_strFiles.Add(s.m_strFileName);
+ if (!OpenPart(nPos)) return false;
+
+ llSize.QuadPart = 0;
+ GetFileSizeEx (m_hFile, &llSize);
+ m_llTotalLength += llSize.QuadPart;
+ m_FilesSize.Add (llSize.QuadPart);
+ m_rtPtsOffsets.Add (rtDur);
+ rtDur += s.Duration();
+ nPos++;
+ }
+
+ if (files.GetCount() > 1) ClosePart();
+
+ return TRUE;
}
ULONGLONG CMultiFiles::Seek(LONGLONG lOff, UINT nFrom)
{
- LARGE_INTEGER llNewPos;
- LARGE_INTEGER llOff;
-
- if(m_strFiles.GetCount() == 1)
- {
- llOff.QuadPart = lOff;
- SetFilePointerEx(m_hFile, llOff, &llNewPos, nFrom);
-
- return llNewPos.QuadPart;
- }
- else
- {
- LONGLONG lAbsolutePos = GetAbsolutePosition(lOff, nFrom);
- int nNewPart = 0;
- ULONGLONG llSum = 0;
-
- while(m_FilesSize[nNewPart] + llSum <= lAbsolutePos)
- {
- llSum += m_FilesSize[nNewPart];
- nNewPart++;
- }
-
- OpenPart(nNewPart);
- llOff.QuadPart = lAbsolutePos - llSum;
- SetFilePointerEx(m_hFile, llOff, &llNewPos, FILE_BEGIN);
-
- return llSum + llNewPos.QuadPart;
- }
+ LARGE_INTEGER llNewPos;
+ LARGE_INTEGER llOff;
+
+ if (m_strFiles.GetCount() == 1)
+ {
+ llOff.QuadPart = lOff;
+ SetFilePointerEx (m_hFile, llOff, &llNewPos, nFrom);
+
+ return llNewPos.QuadPart;
+ }
+ else
+ {
+ LONGLONG lAbsolutePos = GetAbsolutePosition(lOff, nFrom);
+ int nNewPart = 0;
+ ULONGLONG llSum = 0;
+
+ while (m_FilesSize[nNewPart]+llSum <= lAbsolutePos)
+ {
+ llSum += m_FilesSize[nNewPart];
+ nNewPart++;
+ }
+
+ OpenPart (nNewPart);
+ llOff.QuadPart = lAbsolutePos - llSum;
+ SetFilePointerEx (m_hFile, llOff, &llNewPos, FILE_BEGIN);
+
+ return llSum + llNewPos.QuadPart;
+ }
}
ULONGLONG CMultiFiles::GetAbsolutePosition(LONGLONG lOff, UINT nFrom)
{
- LARGE_INTEGER llNoMove = {0, 0};
- LARGE_INTEGER llCurPos;
-
- switch(nFrom)
- {
- case begin :
- return lOff;
- case current :
- SetFilePointerEx(m_hFile, llNoMove, &llCurPos, FILE_CURRENT);
- return llCurPos.QuadPart + lOff;
- case end :
- return m_llTotalLength - lOff;
- default:
- return 0; // just used to quash "not all control paths return a value" warning
- }
+ LARGE_INTEGER llNoMove = {0, 0};
+ LARGE_INTEGER llCurPos;
+
+ switch (nFrom)
+ {
+ case begin :
+ return lOff;
+ case current :
+ SetFilePointerEx (m_hFile, llNoMove, &llCurPos, FILE_CURRENT);
+ return llCurPos.QuadPart + lOff;
+ case end :
+ return m_llTotalLength - lOff;
+ default:
+ return 0; // just used to quash "not all control paths return a value" warning
+ }
}
ULONGLONG CMultiFiles::GetLength() const
{
- if(m_strFiles.GetCount() == 1)
- {
- ULONGLONG llTotalSize = 0;
- LARGE_INTEGER llSize;
- GetFileSizeEx(m_hFile, &llSize);
- return llSize.QuadPart;
- }
- else
- return m_llTotalLength;
+ if (m_strFiles.GetCount() == 1)
+ {
+ ULONGLONG llTotalSize = 0;
+ LARGE_INTEGER llSize;
+ GetFileSizeEx (m_hFile, &llSize);
+ return llSize.QuadPart;
+ }
+ else
+ return m_llTotalLength;
}
UINT CMultiFiles::Read(void* lpBuf, UINT nCount)
{
- DWORD dwRead;
- do
- {
- if(!ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
- break;
-
- if(dwRead != nCount && m_nCurPart < m_strFiles.GetCount() - 1)
- {
- OpenPart(m_nCurPart + 1);
- lpBuf = (void*)((BYTE*)lpBuf + dwRead);
- nCount -= dwRead;
- }
- }
- while(nCount != dwRead && m_nCurPart < m_strFiles.GetCount() - 1);
- return dwRead;
+ DWORD dwRead;
+ do
+ {
+ if (!ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
+ break;
+
+ if (dwRead != nCount && m_nCurPart < m_strFiles.GetCount()-1)
+ {
+ OpenPart (m_nCurPart+1);
+ lpBuf = (void*)((BYTE*)lpBuf + dwRead);
+ nCount -= dwRead;
+ }
+ } while (nCount != dwRead && m_nCurPart < m_strFiles.GetCount()-1);
+ return dwRead;
}
void CMultiFiles::Close()
{
- ClosePart();
- Reset();
+ ClosePart();
+ Reset();
}
CMultiFiles::~CMultiFiles()
{
- Close();
+ Close();
}
BOOL CMultiFiles::OpenPart(int nPart)
{
- if(m_nCurPart == nPart)
- return TRUE;
- else
- {
- CString fn;
+ if (m_nCurPart == nPart)
+ return TRUE;
+ else
+ {
+ CString fn;
- ClosePart();
+ ClosePart();
- fn = m_strFiles.GetAt(nPart);
- m_hFile = CreateFile(fn, GENERIC_READ, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ fn = m_strFiles.GetAt(nPart);
+ m_hFile = CreateFile (fn, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- if(m_hFile != INVALID_HANDLE_VALUE)
- {
- m_nCurPart = nPart;
- if(m_pCurrentPTSOffset != NULL) *m_pCurrentPTSOffset = m_rtPtsOffsets[nPart];
- }
+ if (m_hFile != INVALID_HANDLE_VALUE)
+ {
+ m_nCurPart = nPart;
+ if (m_pCurrentPTSOffset != NULL) *m_pCurrentPTSOffset = m_rtPtsOffsets[nPart];
+ }
- return (m_hFile != INVALID_HANDLE_VALUE);
- }
+ return (m_hFile != INVALID_HANDLE_VALUE);
+ }
}
void CMultiFiles::ClosePart()
{
- if(m_hFile != INVALID_HANDLE_VALUE)
- {
- CloseHandle(m_hFile);
- m_hFile = INVALID_HANDLE_VALUE;
- m_nCurPart = -1;
- }
+ if (m_hFile != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle (m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ m_nCurPart = -1;
+ }
}
diff --git a/src/filters/parser/BaseSplitter/MultiFiles.h b/src/filters/parser/BaseSplitter/MultiFiles.h
index 003601cd0..b07862a0a 100644
--- a/src/filters/parser/BaseSplitter/MultiFiles.h
+++ b/src/filters/parser/BaseSplitter/MultiFiles.h
@@ -28,75 +28,73 @@
class CMultiFiles : public CObject
{
- DECLARE_DYNAMIC(CMultiFiles)
+ DECLARE_DYNAMIC(CMultiFiles)
public:
// Flag values
- enum OpenFlags
- {
- modeRead = (int) 0x00000,
- modeWrite = (int) 0x00001,
- modeReadWrite = (int) 0x00002,
- shareCompat = (int) 0x00000,
- shareExclusive = (int) 0x00010,
- shareDenyWrite = (int) 0x00020,
- shareDenyRead = (int) 0x00030,
- shareDenyNone = (int) 0x00040,
- modeNoInherit = (int) 0x00080,
- modeCreate = (int) 0x01000,
- modeNoTruncate = (int) 0x02000,
- typeText = (int) 0x04000, // typeText and typeBinary are
- typeBinary = (int) 0x08000, // used in derived classes only
- osNoBuffer = (int) 0x10000,
- osWriteThrough = (int) 0x20000,
- osRandomAccess = (int) 0x40000,
- osSequentialScan = (int) 0x80000,
- };
+ enum OpenFlags {
+ modeRead = (int) 0x00000,
+ modeWrite = (int) 0x00001,
+ modeReadWrite = (int) 0x00002,
+ shareCompat = (int) 0x00000,
+ shareExclusive = (int) 0x00010,
+ shareDenyWrite = (int) 0x00020,
+ shareDenyRead = (int) 0x00030,
+ shareDenyNone = (int) 0x00040,
+ modeNoInherit = (int) 0x00080,
+ modeCreate = (int) 0x01000,
+ modeNoTruncate = (int) 0x02000,
+ typeText = (int) 0x04000, // typeText and typeBinary are
+ typeBinary = (int) 0x08000, // used in derived classes only
+ osNoBuffer = (int) 0x10000,
+ osWriteThrough = (int) 0x20000,
+ osRandomAccess = (int) 0x40000,
+ osSequentialScan = (int) 0x80000,
+ };
- enum Attribute
- {
- normal = 0x00,
- readOnly = 0x01,
- hidden = 0x02,
- system = 0x04,
- volume = 0x08,
- directory = 0x10,
- archive = 0x20
- };
+ enum Attribute {
+ normal = 0x00,
+ readOnly = 0x01,
+ hidden = 0x02,
+ system = 0x04,
+ volume = 0x08,
+ directory = 0x10,
+ archive = 0x20
+ };
- enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
+ enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
// Constructors
- CMultiFiles();
+ CMultiFiles();
- CString m_strFileName;
+ CString m_strFileName;
// Operations
- virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags);
- virtual BOOL OpenFiles(CAtlList<CHdmvClipInfo::PlaylistItem>& files, UINT nOpenFlags);
+ virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags);
+ virtual BOOL OpenFiles(CAtlList<CHdmvClipInfo::PlaylistItem>& files, UINT nOpenFlags);
- virtual ULONGLONG Seek(LONGLONG lOff, UINT nFrom);
- virtual ULONGLONG GetLength() const;
+ virtual ULONGLONG Seek(LONGLONG lOff, UINT nFrom);
+ virtual ULONGLONG GetLength() const;
- virtual UINT Read(void* lpBuf, UINT nCount);
- virtual void Close();
+ virtual UINT Read(void* lpBuf, UINT nCount);
+ virtual void Close();
// Implementation
public:
- virtual ~CMultiFiles();
+ virtual ~CMultiFiles();
protected:
- REFERENCE_TIME* m_pCurrentPTSOffset;
- CAtlArray<CString> m_strFiles;
- CAtlArray<ULONGLONG> m_FilesSize;
- CAtlArray<REFERENCE_TIME> m_rtPtsOffsets;
- HANDLE m_hFile;
- int m_nCurPart;
- ULONGLONG m_llTotalLength;
+ REFERENCE_TIME* m_pCurrentPTSOffset;
+ CAtlArray<CString> m_strFiles;
+ CAtlArray<ULONGLONG> m_FilesSize;
+ CAtlArray<REFERENCE_TIME> m_rtPtsOffsets;
+ HANDLE m_hFile;
+ int m_nCurPart;
+ ULONGLONG m_llTotalLength;
- BOOL OpenPart(int nPart);
- void ClosePart();
- ULONGLONG GetAbsolutePosition(LONGLONG lOff, UINT nFrom);
- void Reset();
+ BOOL OpenPart(int nPart);
+ void ClosePart();
+ ULONGLONG GetAbsolutePosition(LONGLONG lOff, UINT nFrom);
+ void Reset();
};
diff --git a/src/filters/parser/BaseSplitter/stdafx.cpp b/src/filters/parser/BaseSplitter/stdafx.cpp
index 0533f2b32..4c0a34f8e 100644
--- a/src/filters/parser/BaseSplitter/stdafx.cpp
+++ b/src/filters/parser/BaseSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/BaseSplitter/stdafx.h b/src/filters/parser/BaseSplitter/stdafx.h
index 6fe7f24f9..f7ba733d1 100644
--- a/src/filters/parser/BaseSplitter/stdafx.h
+++ b/src/filters/parser/BaseSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/DSMSplitter/DSMSplitter.cpp b/src/filters/parser/DSMSplitter/DSMSplitter.cpp
index 4e40972f8..300a3cf7a 100644
--- a/src/filters/parser/DSMSplitter/DSMSplitter.cpp
+++ b/src/filters/parser/DSMSplitter/DSMSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,49 +30,49 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_DirectShowMedia},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_DirectShowMedia},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CDSMSplitterFilter), L"MPC - DSM Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CDSMSourceFilter), L"MPC - DSM Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CDSMSplitterFilter), L"MPC - DSM Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CDSMSourceFilter), L"MPC - DSM Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDSMSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDSMSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDSMSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDSMSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- CString str;
- str.Format(_T("0,%d,,%%0%dI64x"), DSMSW_SIZE, DSMSW_SIZE * 2);
- str.Format(CString(str), DSMSW);
+ CString str;
+ str.Format(_T("0,%d,,%%0%dI64x"), DSMSW_SIZE, DSMSW_SIZE*2);
+ str.Format(CString(str), DSMSW);
- RegisterSourceFilter(
- CLSID_AsyncReader,
- MEDIASUBTYPE_DirectShowMedia,
- str, NULL);
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_DirectShowMedia,
+ str, NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_DirectShowMedia);
+ UnRegisterSourceFilter(MEDIASUBTYPE_DirectShowMedia);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -86,7 +86,7 @@ CFilterApp theApp;
//
CDSMSplitterFilter::CDSMSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CDSMSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CDSMSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
@@ -94,168 +94,156 @@ CDSMSplitterFilter::~CDSMSplitterFilter()
{
}
-static int compare_id(const void* id1, const void* id2)
-{
- return (int) * (BYTE*)id1 - (int) * (BYTE*)id2;
-}
+static int compare_id(const void* id1, const void* id2) {return (int)*(BYTE*)id1 - (int)*(BYTE*)id2;}
HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
- m_pFile.Attach(DNew CDSMSplitterFile(pAsyncReader, hr, *this, *this));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->m_rtDuration;
-
- CAtlArray<BYTE> ids;
-
- POSITION pos = m_pFile->m_mts.GetStartPosition();
- while(pos)
- {
- BYTE id;
- CMediaType mt;
- m_pFile->m_mts.GetNextAssoc(pos, id, mt);
- ids.Add(id);
- }
-
- qsort(ids.GetData(), ids.GetCount(), sizeof(BYTE), compare_id);
-
- for(int i = 0; i < ids.GetCount(); i++)
- {
- BYTE id = ids[i];
- CMediaType& mt = m_pFile->m_mts[id];
-
- CStringW name, lang;
- name.Format(L"Output %02d", id);
-
- CAtlArray<CMediaType> mts;
- mts.Add(mt);
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
-
- name.Empty();
-
- pos = m_pFile->m_sim[id].GetStartPosition();
- while(pos)
- {
- CStringA key;
- CStringW value;
- m_pFile->m_sim[id].GetNextAssoc(pos, key, value);
- pPinOut->SetProperty(CStringW(key), value);
-
- if(key == "NAME") name = value;
- if(key == "LANG") if((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) lang = value;
- }
-
- if(!name.IsEmpty() || !lang.IsEmpty())
- {
- if(!name.IsEmpty())
- {
- if(!lang.IsEmpty()) name += L" (" + lang + L")";
- }
- else if(!lang.IsEmpty()) name = lang;
- pPinOut->SetName(name);
- }
-
- EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
- }
-
- pos = m_pFile->m_fim.GetStartPosition();
- while(pos)
- {
- CStringA key;
- CStringW value;
- m_pFile->m_fim.GetNextAssoc(pos, key, value);
- SetProperty(CStringW(key), value);
- }
-
- for(int i = 0; i < m_resources.GetCount(); i++)
- {
- const CDSMResource& r = m_resources[i];
- if(r.mime == "application/x-truetype-font")
- m_fontinst.InstallFont(r.data);
- }
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pFile.Attach(DNew CDSMSplitterFile(pAsyncReader, hr, *this, *this));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->m_rtDuration;
+
+ CAtlArray<BYTE> ids;
+
+ POSITION pos = m_pFile->m_mts.GetStartPosition();
+ while(pos)
+ {
+ BYTE id;
+ CMediaType mt;
+ m_pFile->m_mts.GetNextAssoc(pos, id, mt);
+ ids.Add(id);
+ }
+
+ qsort(ids.GetData(), ids.GetCount(), sizeof(BYTE), compare_id);
+
+ for(int i = 0; i < ids.GetCount(); i++)
+ {
+ BYTE id = ids[i];
+ CMediaType& mt = m_pFile->m_mts[id];
+
+ CStringW name, lang;
+ name.Format(L"Output %02d", id);
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
+
+ name.Empty();
+
+ pos = m_pFile->m_sim[id].GetStartPosition();
+ while(pos)
+ {
+ CStringA key; CStringW value;
+ m_pFile->m_sim[id].GetNextAssoc(pos, key, value);
+ pPinOut->SetProperty(CStringW(key), value);
+
+ if(key == "NAME") name = value;
+ if(key == "LANG") if((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) lang = value;
+ }
+
+ if(!name.IsEmpty() || !lang.IsEmpty())
+ {
+ if(!name.IsEmpty()) {if(!lang.IsEmpty()) name += L" (" + lang + L")";}
+ else if(!lang.IsEmpty()) name = lang;
+ pPinOut->SetName(name);
+ }
+
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
+ }
+
+ pos = m_pFile->m_fim.GetStartPosition();
+ while(pos)
+ {
+ CStringA key; CStringW value;
+ m_pFile->m_fim.GetNextAssoc(pos, key, value);
+ SetProperty(CStringW(key), value);
+ }
+
+ for(int i = 0; i < m_resources.GetCount(); i++)
+ {
+ const CDSMResource& r = m_resources[i];
+ if(r.mime == "application/x-truetype-font")
+ m_fontinst.InstallFont(r.data);
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CDSMSplitterFilter::DemuxInit()
{
- return true;
+ return true;
}
void CDSMSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- m_pFile->Seek(m_pFile->FindSyncPoint(rt));
+ m_pFile->Seek(m_pFile->FindSyncPoint(rt));
}
bool CDSMSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining())
- {
- dsmp_t type;
- UINT64 len;
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining())
+ {
+ dsmp_t type;
+ UINT64 len;
- if(!m_pFile->Sync(type, len))
- continue;
+ if(!m_pFile->Sync(type, len))
+ continue;
- __int64 pos = m_pFile->GetPos();
+ __int64 pos = m_pFile->GetPos();
- if(type == DSMP_SAMPLE)
- {
- CAutoPtr<Packet> p(DNew Packet());
- if(m_pFile->Read(len, p))
- {
- if(p->rtStart != Packet::INVALID_TIME)
- {
- p->rtStart -= m_pFile->m_rtFirst;
- p->rtStop -= m_pFile->m_rtFirst;
- }
+ if(type == DSMP_SAMPLE)
+ {
+ CAutoPtr<Packet> p(DNew Packet());
+ if(m_pFile->Read(len, p))
+ {
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ p->rtStart -= m_pFile->m_rtFirst;
+ p->rtStop -= m_pFile->m_rtFirst;
+ }
- hr = DeliverPacket(p);
- }
- }
+ hr = DeliverPacket(p);
+ }
+ }
- m_pFile->Seek(pos + len);
- }
+ m_pFile->Seek(pos + len);
+ }
- return(true);
+ return(true);
}
// IKeyFrameInfo
STDMETHODIMP CDSMSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- CheckPointer(m_pFile, E_UNEXPECTED);
- nKFs = m_pFile->m_sps.GetCount();
- return S_OK;
+ CheckPointer(m_pFile, E_UNEXPECTED);
+ nKFs = m_pFile->m_sps.GetCount();
+ return S_OK;
}
STDMETHODIMP CDSMSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
- CheckPointer(m_pFile, E_UNEXPECTED);
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+ CheckPointer(m_pFile, E_UNEXPECTED);
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
- // these aren't really the keyframes, but quicky accessable points in the stream
- for(nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++)
- pKFs[nKFs] = m_pFile->m_sps[nKFs].rt;
+ // these aren't really the keyframes, but quicky accessable points in the stream
+ for(nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++)
+ pKFs[nKFs] = m_pFile->m_sps[nKFs].rt;
- return S_OK;
+ return S_OK;
}
//
@@ -263,8 +251,8 @@ STDMETHODIMP CDSMSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
//
CDSMSourceFilter::CDSMSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CDSMSplitterFilter(pUnk, phr)
+ : CDSMSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
diff --git a/src/filters/parser/DSMSplitter/DSMSplitter.h b/src/filters/parser/DSMSplitter/DSMSplitter.h
index 81469b232..77bc53cad 100644
--- a/src/filters/parser/DSMSplitter/DSMSplitter.h
+++ b/src/filters/parser/DSMSplitter/DSMSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,26 +30,26 @@
class CDSMSplitterFilter : public CBaseSplitterFilter
{
protected:
- CAutoPtr<CDSMSplitterFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CDSMSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CDSMSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CDSMSplitterFilter();
+ CDSMSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CDSMSplitterFilter();
- // IKeyFrameInfo
+ // IKeyFrameInfo
- STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
};
[uuid("803E8280-F3CE-4201-982C-8CD8FB512004")]
class CDSMSourceFilter : public CDSMSplitterFilter
{
public:
- CDSMSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CDSMSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp
index 4d6f56e53..f4448f661 100644
--- a/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp
+++ b/src/filters/parser/DSMSplitter/DSMSplitterFile.cpp
@@ -3,428 +3,395 @@
#include "../../../DSUtil/DSUtil.h"
#include <moreuuids.h>
-CDSMSplitterFile::CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap)
- : CBaseSplitterFile(pReader, hr, DEFAULT_CACHE_LENGTH, false)
- , m_rtFirst(0)
- , m_rtDuration(0)
+CDSMSplitterFile::CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap)
+ : CBaseSplitterFile(pReader, hr, DEFAULT_CACHE_LENGTH, false)
+ , m_rtFirst(0)
+ , m_rtDuration(0)
{
- if(FAILED(hr)) return;
+ if(FAILED(hr)) return;
- hr = Init(res, chap);
+ hr = Init(res, chap);
}
HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap)
{
- Seek(0);
-
- if(BitRead(DSMSW_SIZE << 3) != DSMSW || BitRead(5) != DSMP_FILEINFO)
- return E_FAIL;
-
- Seek(0);
-
- m_mts.RemoveAll();
- m_rtFirst = m_rtDuration = 0;
- m_fim.RemoveAll();
- m_sim.RemoveAll();
- res.ResRemoveAll();
- chap.ChapRemoveAll();
-
- dsmp_t type;
- UINT64 len;
- int limit = 65536;
-
- // examine the beginning of the file ...
-
- while(Sync(type, len, 0))
- {
- __int64 pos = GetPos();
-
- if(type == DSMP_MEDIATYPE)
- {
- BYTE id;
- CMediaType mt;
- if(Read(len, id, mt)) m_mts[id] = mt;
- }
- else if(type == DSMP_SAMPLE)
- {
- Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
- {
- m_rtFirst = p.rtStart;
- break;
- }
- }
- else if(type == DSMP_FILEINFO)
- {
- if((BYTE)BitRead(8) > DSMF_VERSION) return E_FAIL;
- Read(len - 1, m_fim);
- }
- else if(type == DSMP_STREAMINFO)
- {
- Read(len - 1, m_sim[(BYTE)BitRead(8)]);
- }
- else if(type == DSMP_SYNCPOINTS)
- {
- Read(len, m_sps);
- }
- else if(type == DSMP_RESOURCE)
- {
- Read(len, res);
- }
- else if(type == DSMP_CHAPTERS)
- {
- Read(len, chap);
- }
-
- Seek(pos + len);
- }
-
- if(type != DSMP_SAMPLE)
- return E_FAIL;
-
- // ... and the end
-
- if(IsRandomAccess())
- for(int i = 1, j = (int)((GetLength() + limit / 2) / limit); i <= j; i++)
- {
- __int64 seekpos = max(0, (__int64)GetLength() - i * limit);
- Seek(seekpos);
-
- while(Sync(type, len, limit) && GetPos() < seekpos + limit)
- {
- __int64 pos = GetPos();
-
- if(type == DSMP_SAMPLE)
- {
- Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
- {
- m_rtDuration = max(m_rtDuration, p.rtStop - m_rtFirst); // max isn't really needed, only for safety
- i = j;
- }
- }
- else if(type == DSMP_SYNCPOINTS)
- {
- Read(len, m_sps);
- }
- else if(type == DSMP_RESOURCE)
- {
- Read(len, res);
- }
- else if(type == DSMP_CHAPTERS)
- {
- Read(len, chap);
- }
-
- Seek(pos + len);
- }
- }
-
- if(m_rtFirst < 0)
- {
- m_rtDuration += m_rtFirst;
- m_rtFirst = 0;
- }
-
- return m_mts.GetCount() > 0 ? S_OK : E_FAIL;
+ Seek(0);
+
+ if(BitRead(DSMSW_SIZE<<3) != DSMSW || BitRead(5) != DSMP_FILEINFO)
+ return E_FAIL;
+
+ Seek(0);
+
+ m_mts.RemoveAll();
+ m_rtFirst = m_rtDuration = 0;
+ m_fim.RemoveAll();
+ m_sim.RemoveAll();
+ res.ResRemoveAll();
+ chap.ChapRemoveAll();
+
+ dsmp_t type;
+ UINT64 len;
+ int limit = 65536;
+
+ // examine the beginning of the file ...
+
+ while(Sync(type, len, 0))
+ {
+ __int64 pos = GetPos();
+
+ if(type == DSMP_MEDIATYPE)
+ {
+ BYTE id;
+ CMediaType mt;
+ if(Read(len, id, mt)) m_mts[id] = mt;
+ }
+ else if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ m_rtFirst = p.rtStart;
+ break;
+ }
+ }
+ else if(type == DSMP_FILEINFO) {if((BYTE)BitRead(8) > DSMF_VERSION) return E_FAIL; Read(len-1, m_fim);}
+ else if(type == DSMP_STREAMINFO) {Read(len-1, m_sim[(BYTE)BitRead(8)]);}
+ else if(type == DSMP_SYNCPOINTS) {Read(len, m_sps);}
+ else if(type == DSMP_RESOURCE) {Read(len, res);}
+ else if(type == DSMP_CHAPTERS) {Read(len, chap);}
+
+ Seek(pos + len);
+ }
+
+ if(type != DSMP_SAMPLE)
+ return E_FAIL;
+
+ // ... and the end
+
+ if(IsRandomAccess())
+ for(int i = 1, j = (int)((GetLength()+limit/2)/limit); i <= j; i++)
+ {
+ __int64 seekpos = max(0, (__int64)GetLength()-i*limit);
+ Seek(seekpos);
+
+ while(Sync(type, len, limit) && GetPos() < seekpos+limit)
+ {
+ __int64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ m_rtDuration = max(m_rtDuration, p.rtStop - m_rtFirst); // max isn't really needed, only for safety
+ i = j;
+ }
+ }
+ else if(type == DSMP_SYNCPOINTS) {Read(len, m_sps);}
+ else if(type == DSMP_RESOURCE) {Read(len, res);}
+ else if(type == DSMP_CHAPTERS) {Read(len, chap);}
+
+ Seek(pos + len);
+ }
+ }
+
+ if(m_rtFirst < 0)
+ {
+ m_rtDuration += m_rtFirst;
+ m_rtFirst = 0;
+ }
+
+ return m_mts.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CDSMSplitterFile::Sync(dsmp_t& type, UINT64& len, __int64 limit)
{
- UINT64 pos;
- return Sync(pos, type, len, limit);
+ UINT64 pos;
+ return Sync(pos, type, len, limit);
}
bool CDSMSplitterFile::Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit)
{
- BitByteAlign();
+ BitByteAlign();
- limit += DSMSW_SIZE;
+ limit += DSMSW_SIZE;
- for(UINT64 id = 0; (id&((1ui64 << (DSMSW_SIZE << 3)) - 1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8))
- {
- if(limit-- <= 0 || GetRemaining() <= 2)
- return(false);
- }
+ for(UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8))
+ {
+ if(limit-- <= 0 || GetRemaining() <= 2)
+ return(false);
+ }
- syncpos = GetPos() - (DSMSW_SIZE << 3);
- type = (dsmp_t)BitRead(5);
- len = BitRead(((int)BitRead(3) + 1) << 3);
+ syncpos = GetPos() - (DSMSW_SIZE<<3);
+ type = (dsmp_t)BitRead(5);
+ len = BitRead(((int)BitRead(3)+1)<<3);
- return(true);
+ return(true);
}
bool CDSMSplitterFile::Read(__int64 len, BYTE& id, CMediaType& mt)
{
- id = (BYTE)BitRead(8);
- ByteRead((BYTE*)&mt.majortype, sizeof(mt.majortype));
- ByteRead((BYTE*)&mt.subtype, sizeof(mt.subtype));
- mt.bFixedSizeSamples = (BOOL)BitRead(1);
- mt.bTemporalCompression = (BOOL)BitRead(1);
- mt.lSampleSize = (ULONG)BitRead(30);
- ByteRead((BYTE*)&mt.formattype, sizeof(mt.formattype));
- len -= 5 + sizeof(GUID) * 3;
- ASSERT(len >= 0);
- if(len > 0)
- {
- mt.AllocFormatBuffer((LONG)len);
- ByteRead(mt.Format(), mt.FormatLength());
- }
- else mt.ResetFormatBuffer();
- return true;
+ id = (BYTE)BitRead(8);
+ ByteRead((BYTE*)&mt.majortype, sizeof(mt.majortype));
+ ByteRead((BYTE*)&mt.subtype, sizeof(mt.subtype));
+ mt.bFixedSizeSamples = (BOOL)BitRead(1);
+ mt.bTemporalCompression = (BOOL)BitRead(1);
+ mt.lSampleSize = (ULONG)BitRead(30);
+ ByteRead((BYTE*)&mt.formattype, sizeof(mt.formattype));
+ len -= 5 + sizeof(GUID)*3;
+ ASSERT(len >= 0);
+ if(len > 0) {mt.AllocFormatBuffer((LONG)len); ByteRead(mt.Format(), mt.FormatLength());}
+ else mt.ResetFormatBuffer();
+ return true;
}
bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData)
{
- if(!p) return false;
-
- p->TrackNumber = (DWORD)BitRead(8);
- p->bSyncPoint = (BOOL)BitRead(1);
- bool fSign = !!BitRead(1);
- int iTimeStamp = (int)BitRead(3);
- int iDuration = (int)BitRead(3);
-
- if(fSign && !iTimeStamp)
- {
- ASSERT(!iDuration);
- p->rtStart = Packet::INVALID_TIME;
- p->rtStop = Packet::INVALID_TIME + 1;
- }
- else
- {
- p->rtStart = (REFERENCE_TIME)BitRead(iTimeStamp << 3) * (fSign ? -1 : 1);
- p->rtStop = p->rtStart + BitRead(iDuration << 3);
- }
-
- if(fData)
- {
+ if(!p) return false;
+
+ p->TrackNumber = (DWORD)BitRead(8);
+ p->bSyncPoint = (BOOL)BitRead(1);
+ bool fSign = !!BitRead(1);
+ int iTimeStamp = (int)BitRead(3);
+ int iDuration = (int)BitRead(3);
+
+ if(fSign && !iTimeStamp)
+ {
+ ASSERT(!iDuration);
+ p->rtStart = Packet::INVALID_TIME;
+ p->rtStop = Packet::INVALID_TIME + 1;
+ }
+ else
+ {
+ p->rtStart = (REFERENCE_TIME)BitRead(iTimeStamp<<3) * (fSign ? -1 : 1);
+ p->rtStop = p->rtStart + BitRead(iDuration<<3);
+ }
+
+ if(fData)
+ {
p->SetCount((INT_PTR)len - (2 + iTimeStamp + iDuration));
- ByteRead(p->GetData(), p->GetCount());
- }
+ ByteRead(p->GetData(), p->GetCount());
+ }
- return true;
+ return true;
}
bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps)
{
- SyncPoint sp = {0, 0};
- sps.RemoveAll();
+ SyncPoint sp = {0, 0};
+ sps.RemoveAll();
- while(len > 0)
- {
- bool fSign = !!BitRead(1);
- int iTimeStamp = (int)BitRead(3);
- int iFilePos = (int)BitRead(3);
- BitRead(1); // reserved
+ while(len > 0)
+ {
+ bool fSign = !!BitRead(1);
+ int iTimeStamp = (int)BitRead(3);
+ int iFilePos = (int)BitRead(3);
+ BitRead(1); // reserved
- sp.rt += (REFERENCE_TIME)BitRead(iTimeStamp << 3) * (fSign ? -1 : 1);
- sp.fp += BitRead(iFilePos << 3);
- sps.Add(sp);
+ sp.rt += (REFERENCE_TIME)BitRead(iTimeStamp<<3) * (fSign ? -1 : 1);
+ sp.fp += BitRead(iFilePos<<3);
+ sps.Add(sp);
- len -= 1 + iTimeStamp + iFilePos;
- }
+ len -= 1 + iTimeStamp + iFilePos;
+ }
- if(len != 0)
- {
- sps.RemoveAll();
- return false;
- }
+ if(len != 0)
+ {
+ sps.RemoveAll();
+ return false;
+ }
- // TODO: sort sps
+ // TODO: sort sps
- return true;
+ return true;
}
bool CDSMSplitterFile::Read(__int64 len, CStreamInfoMap& im)
{
- while(len >= 5)
- {
- CStringA key;
- ByteRead((BYTE*)key.GetBufferSetLength(4), 4);
- len -= 4;
- len -= Read(len, im[key]);
- }
-
- return len == 0;
+ while(len >= 5)
+ {
+ CStringA key;
+ ByteRead((BYTE*)key.GetBufferSetLength(4), 4);
+ len -= 4;
+ len -= Read(len, im[key]);
+ }
+
+ return len == 0;
}
bool CDSMSplitterFile::Read(__int64 len, IDSMResourceBagImpl& res)
{
- BYTE compression = (BYTE)BitRead(2);
- BYTE reserved = (BYTE)BitRead(6);
- len--;
+ BYTE compression = (BYTE)BitRead(2);
+ BYTE reserved = (BYTE)BitRead(6);
+ len--;
- CDSMResource r;
- len -= Read(len, r.name);
- len -= Read(len, r.desc);
- len -= Read(len, r.mime);
+ CDSMResource r;
+ len -= Read(len, r.name);
+ len -= Read(len, r.desc);
+ len -= Read(len, r.mime);
- if(compression != 0) return false; // TODO
+ if(compression != 0) return false; // TODO
- r.data.SetCount(len);
- ByteRead(r.data.GetData(), r.data.GetCount());
+ r.data.SetCount(len);
+ ByteRead(r.data.GetData(), r.data.GetCount());
- res += r;
+ res += r;
- return true;
+ return true;
}
bool CDSMSplitterFile::Read(__int64 len, IDSMChapterBagImpl& chap)
{
- CDSMChapter c(0, L"");
+ CDSMChapter c(0, L"");
- while(len > 0)
- {
- bool fSign = !!BitRead(1);
- int iTimeStamp = (int)BitRead(3);
- BitRead(4); // reserved
- len--;
+ while(len > 0)
+ {
+ bool fSign = !!BitRead(1);
+ int iTimeStamp = (int)BitRead(3);
+ BitRead(4); // reserved
+ len--;
- c.rt += (REFERENCE_TIME)BitRead(iTimeStamp << 3) * (fSign ? -1 : 1);
- len -= iTimeStamp;
- len -= Read(len, c.name);
+ c.rt += (REFERENCE_TIME)BitRead(iTimeStamp<<3) * (fSign ? -1 : 1);
+ len -= iTimeStamp;
+ len -= Read(len, c.name);
- chap += c;
- }
+ chap += c;
+ }
- chap.ChapSort();
+ chap.ChapSort();
- return len == 0;
+ return len == 0;
}
__int64 CDSMSplitterFile::Read(__int64 len, CStringW& str)
{
- char c;
- CStringA s;
- __int64 i = 0;
- while(i++ < len && (c = (char)BitRead(8)) != 0) s += c;
- str = UTF8To16(s);
- return i;
+ char c;
+ CStringA s;
+ __int64 i = 0;
+ while(i++ < len && (c = (char)BitRead(8)) != 0) s += c;
+ str = UTF8To16(s);
+ return i;
}
__int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
{
- if(/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1)
- {
- int i = range_bsearch(m_sps, m_rtFirst + rt);
- return i >= 0 ? m_sps[i].fp : 0;
- }
-
- if(m_rtDuration <= 0 || rt <= m_rtFirst)
- return 0;
-
- // ok, do the hard way then
-
- dsmp_t type;
- UINT64 syncpos, len;
-
- // 1. find some boundaries close to rt's position (minpos, maxpos)
-
- __int64 minpos = 0, maxpos = GetLength();
-
- for(int i = 0; i < 10 && (maxpos - minpos) >= 1024 * 1024; i++)
- {
- Seek((minpos + maxpos) / 2);
-
- while(GetPos() < maxpos)
- {
- if(!Sync(syncpos, type, len))
- continue;
-
- __int64 pos = GetPos();
-
- if(type == DSMP_SAMPLE)
- {
- Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
- {
- REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
- if(dt >= 0) maxpos = max((__int64)syncpos - 65536, minpos);
- else minpos = syncpos;
- break;
- }
- }
-
- Seek(pos + len);
- }
- }
-
- // 2. find the first packet just after rt (maxpos)
-
- Seek(minpos);
-
- while(GetRemaining())
- {
- if(!Sync(syncpos, type, len))
- continue;
-
- __int64 pos = GetPos();
-
- if(type == DSMP_SAMPLE)
- {
- Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
- {
- REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
- if(dt >= 0)
- {
- maxpos = (__int64)syncpos;
- break;
- }
- }
- }
-
- Seek(pos + len);
- }
-
- // 3. iterate backwards from maxpos and find at least one syncpoint for every stream, except for subtitle streams
-
- CAtlMap<BYTE, BYTE> ids;
-
- {
- POSITION pos = m_mts.GetStartPosition();
- while(pos)
- {
- BYTE id;
- CMediaType mt;
- m_mts.GetNextAssoc(pos, id, mt);
- if(mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle)
- ids[id] = 0;
- }
- }
-
- __int64 ret = maxpos;
-
- while(maxpos > 0 && !ids.IsEmpty())
- {
- minpos = max(0, maxpos - 65536);
-
- Seek(minpos);
-
- while(Sync(syncpos, type, len) && GetPos() < maxpos)
- {
- UINT64 pos = GetPos();
-
- if(type == DSMP_SAMPLE)
- {
- Packet p;
- if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint)
- {
- BYTE id = (BYTE)p.TrackNumber, tmp;
- if(ids.Lookup(id, tmp))
- {
- ids.RemoveKey((BYTE)p.TrackNumber);
- ret = min(ret, (__int64)syncpos);
- }
- }
- }
-
- Seek(pos + len);
- }
-
- maxpos = minpos;
- }
-
- return ret;
+ if(/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1)
+ {
+ int i = range_bsearch(m_sps, m_rtFirst + rt);
+ return i >= 0 ? m_sps[i].fp : 0;
+ }
+
+ if(m_rtDuration <= 0 || rt <= m_rtFirst)
+ return 0;
+
+ // ok, do the hard way then
+
+ dsmp_t type;
+ UINT64 syncpos, len;
+
+ // 1. find some boundaries close to rt's position (minpos, maxpos)
+
+ __int64 minpos = 0, maxpos = GetLength();
+
+ for(int i = 0; i < 10 && (maxpos - minpos) >= 1024*1024; i++)
+ {
+ Seek((minpos + maxpos) / 2);
+
+ while(GetPos() < maxpos)
+ {
+ if(!Sync(syncpos, type, len))
+ continue;
+
+ __int64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
+ if(dt >= 0) maxpos = max((__int64)syncpos - 65536, minpos);
+ else minpos = syncpos;
+ break;
+ }
+ }
+
+ Seek(pos + len);
+ }
+ }
+
+ // 2. find the first packet just after rt (maxpos)
+
+ Seek(minpos);
+
+ while(GetRemaining())
+ {
+ if(!Sync(syncpos, type, len))
+ continue;
+
+ __int64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
+ if(dt >= 0) {maxpos = (__int64)syncpos; break;}
+ }
+ }
+
+ Seek(pos + len);
+ }
+
+ // 3. iterate backwards from maxpos and find at least one syncpoint for every stream, except for subtitle streams
+
+ CAtlMap<BYTE,BYTE> ids;
+
+ {
+ POSITION pos = m_mts.GetStartPosition();
+ while(pos)
+ {
+ BYTE id;
+ CMediaType mt;
+ m_mts.GetNextAssoc(pos, id, mt);
+ if(mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle)
+ ids[id] = 0;
+ }
+ }
+
+ __int64 ret = maxpos;
+
+ while(maxpos > 0 && !ids.IsEmpty())
+ {
+ minpos = max(0, maxpos - 65536);
+
+ Seek(minpos);
+
+ while(Sync(syncpos, type, len) && GetPos() < maxpos)
+ {
+ UINT64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint)
+ {
+ BYTE id = (BYTE)p.TrackNumber, tmp;
+ if(ids.Lookup(id, tmp))
+ {
+ ids.RemoveKey((BYTE)p.TrackNumber);
+ ret = min(ret, (__int64)syncpos);
+ }
+ }
+ }
+
+ Seek(pos + len);
+ }
+
+ maxpos = minpos;
+ }
+
+ return ret;
}
diff --git a/src/filters/parser/DSMSplitter/DSMSplitterFile.h b/src/filters/parser/DSMSplitter/DSMSplitterFile.h
index 21fb2fde5..7c350db2f 100644
--- a/src/filters/parser/DSMSplitter/DSMSplitterFile.h
+++ b/src/filters/parser/DSMSplitter/DSMSplitterFile.h
@@ -6,34 +6,30 @@
class CDSMSplitterFile : public CBaseSplitterFile
{
- HRESULT Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap);
+ HRESULT Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap);
public:
- CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap);
-
- CAtlMap<BYTE, CMediaType> m_mts;
- REFERENCE_TIME m_rtFirst, m_rtDuration;
-
- struct SyncPoint
- {
- REFERENCE_TIME rt;
- __int64 fp;
- };
- CAtlArray<SyncPoint> m_sps;
-
- typedef CAtlMap<CStringA, CStringW, CStringElementTraits<CStringA>, CStringElementTraits<CStringW> > CStreamInfoMap;
- CStreamInfoMap m_fim;
- CAtlMap<BYTE, CStreamInfoMap> m_sim;
-
- bool Sync(dsmp_t& type, UINT64& len, __int64 limit = 65536);
- bool Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit = 65536);
- bool Read(__int64 len, BYTE& id, CMediaType& mt);
- bool Read(__int64 len, Packet* p, bool fData = true);
- bool Read(__int64 len, CAtlArray<SyncPoint>& sps);
- bool Read(__int64 len, CStreamInfoMap& im);
- bool Read(__int64 len, IDSMResourceBagImpl& res);
- bool Read(__int64 len, IDSMChapterBagImpl& chap);
- __int64 Read(__int64 len, CStringW& str);
-
- __int64 FindSyncPoint(REFERENCE_TIME rt);
+ CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap);
+
+ CAtlMap<BYTE, CMediaType> m_mts;
+ REFERENCE_TIME m_rtFirst, m_rtDuration;
+
+ struct SyncPoint {REFERENCE_TIME rt; __int64 fp;};
+ CAtlArray<SyncPoint> m_sps;
+
+ typedef CAtlMap<CStringA, CStringW, CStringElementTraits<CStringA>, CStringElementTraits<CStringW> > CStreamInfoMap;
+ CStreamInfoMap m_fim;
+ CAtlMap<BYTE, CStreamInfoMap> m_sim;
+
+ bool Sync(dsmp_t& type, UINT64& len, __int64 limit = 65536);
+ bool Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit = 65536);
+ bool Read(__int64 len, BYTE& id, CMediaType& mt);
+ bool Read(__int64 len, Packet* p, bool fData = true);
+ bool Read(__int64 len, CAtlArray<SyncPoint>& sps);
+ bool Read(__int64 len, CStreamInfoMap& im);
+ bool Read(__int64 len, IDSMResourceBagImpl& res);
+ bool Read(__int64 len, IDSMChapterBagImpl& chap);
+ __int64 Read(__int64 len, CStringW& str);
+
+ __int64 FindSyncPoint(REFERENCE_TIME rt);
};
diff --git a/src/filters/parser/DSMSplitter/resource.h b/src/filters/parser/DSMSplitter/resource.h
index 003e79ee4..66d1331cb 100644
--- a/src/filters/parser/DSMSplitter/resource.h
+++ b/src/filters/parser/DSMSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by DSMSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/DSMSplitter/stdafx.cpp b/src/filters/parser/DSMSplitter/stdafx.cpp
index 0046e7260..0a00e1846 100644
--- a/src/filters/parser/DSMSplitter/stdafx.cpp
+++ b/src/filters/parser/DSMSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/DSMSplitter/stdafx.h b/src/filters/parser/DSMSplitter/stdafx.h
index 089cf8fa0..e8beccd47 100644
--- a/src/filters/parser/DSMSplitter/stdafx.h
+++ b/src/filters/parser/DSMSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/DiracSplitter/DiracSplitter.cpp b/src/filters/parser/DiracSplitter/DiracSplitter.cpp
index b9e3cc8b7..db544603f 100644
--- a/src/filters/parser/DiracSplitter/DiracSplitter.cpp
+++ b/src/filters/parser/DiracSplitter/DiracSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2004 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,7 +28,7 @@
#ifdef REGISTER_FILTER
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
-{
+{
{&MEDIATYPE_Stream, &MEDIASUBTYPE_Dirac},
{&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
};
@@ -74,8 +74,8 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
RegisterSourceFilter(
- CLSID_AsyncReader,
- MEDIASUBTYPE_Dirac,
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Dirac,
_T("0,8,,4B572D4449524143"), // KW-DIRAC
_T(".drc"), NULL);
@@ -107,7 +107,7 @@ STDMETHODIMP CDiracSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void
{
CheckPointer(ppv, E_POINTER);
- return
+ return
__super::NonDelegatingQueryInterface(riid, ppv);
}
@@ -121,11 +121,7 @@ HRESULT CDiracSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
m_pFile.Attach(DNew CDiracSplitterFile(pAsyncReader, hr));
if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
CAtlArray<CMediaType> mts;
mts.Add(m_pFile->GetMediaType());
@@ -162,7 +158,7 @@ void CDiracSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
// TODO
__int64 len = m_pFile->GetLength();
- __int64 seekpos = (__int64)(1.0 * rt / m_rtDuration * len);
+ __int64 seekpos = (__int64)(1.0*rt/m_rtDuration*len);
m_pFile->Seek(seekpos);
seekpos = 0;
@@ -176,11 +172,7 @@ void CDiracSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
for(int j = 0; j < 10; j++)
{
while(m_pFile->Next(code) && code != AU_START_CODE);
- if(code != AU_START_CODE)
- {
- m_pFile->Seek(seekpos >>= 1);
- continue;
- }
+ if(code != AU_START_CODE) {m_pFile->Seek(seekpos >>= 1); continue;}
__int64 pos = m_pFile->GetPos() - 5;
@@ -194,7 +186,7 @@ void CDiracSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
break;
}
- m_pFile->Seek(pos - (__int64)(1.0 * dt / m_rtDuration * len));
+ m_pFile->Seek(pos - (__int64)(1.0*dt/m_rtDuration*len));
pdt = dt;
}
@@ -222,7 +214,7 @@ bool CDiracSplitterFilter::DemuxLoop()
memcpy(p->GetData(), pBuff, size);
p->TrackNumber = 0;
- p->rtStart = rtAvgTimePerFrame * fnum;
+ p->rtStart = rtAvgTimePerFrame*fnum;
p->rtStop = p->rtStart + rtAvgTimePerFrame;
p->bSyncPoint = code == AU_START_CODE;
@@ -283,8 +275,7 @@ void CDiracVideoDecoder::FreeDecoder()
{
dirac_decoder_close((dirac_decoder_t*)m_decoder);
m_decoder = NULL;
- delete [] m_pYUV[0];
- m_pYUV[0] = NULL;
+ delete [] m_pYUV[0]; m_pYUV[0] = NULL;
}
}
@@ -304,7 +295,7 @@ HRESULT CDiracVideoDecoder::Receive(IMediaSample* pIn)
long len = pIn->GetActualDataLength();
if(len <= 0) return S_OK; // nothing to do
- if(pIn->IsDiscontinuity() == S_OK)
+ if(pIn->IsDiscontinuity() == S_OK)
InitDecoder();
dirac_decoder_t* decoder = (dirac_decoder_t*)m_decoder;
@@ -326,7 +317,7 @@ HRESULT CDiracVideoDecoder::Receive(IMediaSample* pIn)
{
DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)m_pInput->CurrentMediaType().Format();
if(dvih->hdr.bmiHeader.biWidth != decoder->src_params.width
- || dvih->hdr.bmiHeader.biHeight != decoder->src_params.height)
+ || dvih->hdr.bmiHeader.biHeight != decoder->src_params.height)
return E_FAIL; // hmm
}
@@ -335,14 +326,13 @@ HRESULT CDiracVideoDecoder::Receive(IMediaSample* pIn)
int w = decoder->src_params.width;
int h = decoder->src_params.height;
int wc = decoder->src_params.chroma_width;
- int hc = decoder->src_params.chroma_height;
- delete [] m_pYUV[0];
- m_pYUV[0] = NULL;
+ int hc = decoder->src_params.chroma_height;
+ delete [] m_pYUV[0]; m_pYUV[0] = NULL;
m_pYUV[0] = DNew BYTE[w*h + wc*hc*2 + w/2*h/2];
- m_pYUV[1] = m_pYUV[0] + w * h;
- m_pYUV[2] = m_pYUV[1] + wc * hc;
- m_pYUV[3] = m_pYUV[2] + wc * hc;
- memset(m_pYUV[3], 0x80, w / 2 * h / 2);
+ m_pYUV[1] = m_pYUV[0] + w*h;
+ m_pYUV[2] = m_pYUV[1] + wc*hc;
+ m_pYUV[3] = m_pYUV[2] + wc*hc;
+ memset(m_pYUV[3], 0x80, w/2*h/2);
m_rtAvgTimePerFrame = 10000000i64 * decoder->src_params.frame_rate.denominator / decoder->src_params.frame_rate.numerator;
dirac_set_buf(decoder, m_pYUV, NULL);
}
@@ -379,7 +369,7 @@ HRESULT CDiracVideoDecoder::Deliver(IMediaSample* pIn, REFERENCE_TIME rtStart, R
CComPtr<IMediaSample> pOut;
BYTE* pDataOut = NULL;
if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
- || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
return hr;
AM_MEDIA_TYPE* pmt;
@@ -423,28 +413,28 @@ void CDiracVideoDecoder::Copy(BYTE* pOut)
int pitchIn = w;
BYTE* pY = m_pYUV[0];
- BYTE* pU = w / 2 == wc && h / 2 == hc ? m_pYUV[1] : m_pYUV[3]; // FIXME
- BYTE* pV = w / 2 == wc && h / 2 == hc ? m_pYUV[2] : m_pYUV[3]; // FIXME
+ BYTE* pU = w/2 == wc && h/2 == hc ? m_pYUV[1] : m_pYUV[3]; // FIXME
+ BYTE* pV = w/2 == wc && h/2 == hc ? m_pYUV[2] : m_pYUV[3]; // FIXME
if(bihOut.biCompression == '2YUY')
{
- BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth * 2, pY, pU, pV, pitchIn);
+ BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pY, pU, pV, pitchIn);
}
else if(bihOut.biCompression == 'I420' || bihOut.biCompression == 'VUYI')
{
- BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth * h, pOut + bihOut.biWidth * h * 5 / 4, bihOut.biWidth, pY, pU, pV, pitchIn);
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h, pOut + bihOut.biWidth*h*5/4, bihOut.biWidth, pY, pU, pV, pitchIn);
}
else if(bihOut.biCompression == '21VY')
{
- BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth * h * 5 / 4, pOut + bihOut.biWidth * h, bihOut.biWidth, pY, pU, pV, pitchIn);
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h*5/4, pOut + bihOut.biWidth*h, bihOut.biWidth, pY, pU, pV, pitchIn);
}
else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
{
- int pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
+ int pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
if(bihOut.biHeight > 0)
{
- pOut += pitchOut * (h - 1);
+ pOut += pitchOut*(h-1);
pitchOut = -pitchOut;
}
@@ -460,10 +450,10 @@ HRESULT CDiracVideoDecoder::CheckInputType(const CMediaType* mtIn)
{
DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mtIn->Format();
- if(mtIn->majortype != MEDIATYPE_Video
- || mtIn->subtype != MEDIASUBTYPE_DiracVideo
- || mtIn->formattype != FORMAT_DiracVideoInfo
- || (dvih->hdr.bmiHeader.biWidth & 1) || (dvih->hdr.bmiHeader.biHeight & 1))
+ if(mtIn->majortype != MEDIATYPE_Video
+ || mtIn->subtype != MEDIASUBTYPE_DiracVideo
+ || mtIn->formattype != FORMAT_DiracVideoInfo
+ || (dvih->hdr.bmiHeader.biWidth&1) || (dvih->hdr.bmiHeader.biHeight&1))
return VFW_E_TYPE_NOT_ACCEPTED;
return S_OK;
@@ -475,22 +465,22 @@ HRESULT CDiracVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaT
{
BITMAPINFOHEADER bih1, bih2;
if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
- && abs(bih1.biHeight) != abs(bih2.biHeight))
+ && abs(bih1.biHeight) != abs(bih2.biHeight))
return VFW_E_TYPE_NOT_ACCEPTED;
}
return mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_DiracVideo
- && mtOut->majortype == MEDIATYPE_Video && (mtOut->subtype == MEDIASUBTYPE_YUY2
- || mtOut->subtype == MEDIASUBTYPE_YV12
- || mtOut->subtype == MEDIASUBTYPE_I420
- || mtOut->subtype == MEDIASUBTYPE_IYUV
- || mtOut->subtype == MEDIASUBTYPE_ARGB32
- || mtOut->subtype == MEDIASUBTYPE_RGB32
- || mtOut->subtype == MEDIASUBTYPE_RGB24
- || mtOut->subtype == MEDIASUBTYPE_RGB565
- || mtOut->subtype == MEDIASUBTYPE_RGB555)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ && mtOut->majortype == MEDIATYPE_Video && (mtOut->subtype == MEDIASUBTYPE_YUY2
+ || mtOut->subtype == MEDIASUBTYPE_YV12
+ || mtOut->subtype == MEDIASUBTYPE_I420
+ || mtOut->subtype == MEDIASUBTYPE_IYUV
+ || mtOut->subtype == MEDIASUBTYPE_ARGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB24
+ || mtOut->subtype == MEDIASUBTYPE_RGB565
+ || mtOut->subtype == MEDIASUBTYPE_RGB555)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CDiracVideoDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
@@ -507,24 +497,19 @@ HRESULT CDiracVideoDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATO
HRESULT hr;
ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CDiracVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- struct
- {
- const GUID* subtype;
- WORD biPlanes, biBitCount;
- DWORD biCompression;
- } fmts[] =
+ struct {const GUID* subtype; WORD biPlanes, biBitCount; DWORD biCompression;} fmts[] =
{
{&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
{&MEDIASUBTYPE_I420, 3, 12, '024I'},
@@ -543,10 +528,10 @@ HRESULT CDiracVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
};
if(m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo)
- iPosition = iPosition * 2 + 1;
+ iPosition = iPosition*2 + 1;
if(iPosition < 0) return E_INVALIDARG;
- if(iPosition >= 2 * countof(fmts)) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition >= 2*countof(fmts)) return VFW_S_NO_MORE_ITEMS;
BITMAPINFOHEADER bih;
ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
@@ -562,9 +547,9 @@ HRESULT CDiracVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
bihOut.biPlanes = fmts[iPosition/2].biPlanes;
bihOut.biBitCount = fmts[iPosition/2].biBitCount;
bihOut.biCompression = fmts[iPosition/2].biCompression;
- bihOut.biSizeImage = bih.biWidth * bih.biHeight * bihOut.biBitCount >> 3;
+ bihOut.biSizeImage = bih.biWidth*bih.biHeight*bihOut.biBitCount>>3;
- if(iPosition & 1)
+ if(iPosition&1)
{
pmt->formattype = FORMAT_VideoInfo;
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
@@ -575,7 +560,7 @@ HRESULT CDiracVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
vih->bmiHeader.biWidth = ((VIDEOINFOHEADER2*)m_pInput->CurrentMediaType().Format())->dwPictAspectRatioX;
vih->bmiHeader.biHeight = ((VIDEOINFOHEADER2*)m_pInput->CurrentMediaType().Format())->dwPictAspectRatioY;
- vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth * vih->bmiHeader.biHeight * vih->bmiHeader.biBitCount >> 3;
+ vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth*vih->bmiHeader.biHeight*vih->bmiHeader.biBitCount>>3;
}
}
else
@@ -617,7 +602,7 @@ HRESULT CDiracVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tSt
HRESULT CDiracVideoDecoder::AlterQuality(Quality q)
{
- if(q.Late > 500 * 10000i64) m_fDropFrames = true;
+ if(q.Late > 500*10000i64) m_fDropFrames = true;
if(q.Late <= 0) m_fDropFrames = false;
return E_NOTIMPL;
}
diff --git a/src/filters/parser/DiracSplitter/DiracSplitter.h b/src/filters/parser/DiracSplitter/DiracSplitter.h
index 4b3915ba2..0ed5d14cb 100644
--- a/src/filters/parser/DiracSplitter/DiracSplitter.h
+++ b/src/filters/parser/DiracSplitter/DiracSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,17 +28,17 @@
class CDiracSplitterFilter : public CBaseSplitterFilter
{
protected:
- CAutoPtr<CDiracSplitterFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CDiracSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CDiracSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CDiracSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
};
@@ -46,35 +46,35 @@ public:
class CDiracSourceFilter : public CDiracSplitterFilter
{
public:
- CDiracSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CDiracSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
[uuid("F78CF248-180E-4713-B107-B13F7B5C31E1")]
class CDiracVideoDecoder : public CTransformFilter
{
void* m_decoder; // dirac_decoder_t*
- void InitDecoder(), FreeDecoder();
- BYTE* m_pYUV[4];
- bool m_fDropFrames;
- REFERENCE_TIME m_tStart, m_rtAvgTimePerFrame;
+ void InitDecoder(), FreeDecoder();
+ BYTE* m_pYUV[4];
+ bool m_fDropFrames;
+ REFERENCE_TIME m_tStart, m_rtAvgTimePerFrame;
- HRESULT Deliver(IMediaSample* pIn, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- void Copy(BYTE* pOut);
+ HRESULT Deliver(IMediaSample* pIn, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ void Copy(BYTE* pOut);
public:
- CDiracVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CDiracVideoDecoder();
+ CDiracVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDiracVideoDecoder();
- HRESULT Receive(IMediaSample* pIn);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT Receive(IMediaSample* pIn);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- HRESULT AlterQuality(Quality q);
+ HRESULT AlterQuality(Quality q);
}; \ No newline at end of file
diff --git a/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp b/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp
index 7bae7f357..de3b42b45 100644
--- a/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp
+++ b/src/filters/parser/DiracSplitter/DiracSplitterFile.cpp
@@ -18,11 +18,11 @@ HRESULT CDiracSplitterFile::Init()
HRESULT hr = E_FAIL;
Seek(0);
-
+
// Dirac streams are no longer preceded with KW-DIRAC
//UINT64 hdr;
//if(FAILED(Read((BYTE*)&hdr, sizeof(hdr))) || hdr != 0x43415249442D574Bui64) // KW-DIRAC
- //return E_FAIL;
+ //return E_FAIL;
dirac_decoder_t* decoder = dirac_decoder_init(0);
@@ -31,20 +31,12 @@ HRESULT CDiracSplitterFile::Init()
while(GetPos() < limit)
{
BYTE b;
- if(!Next(b))
- {
- ASSERT(0);
- break;
- }
+ if(!Next(b)) {ASSERT(0); break;}
if(b == AU_START_CODE)
{
__int64 pos = GetPos() - 13; //Parse info size = 13
- if(!Next(b))
- {
- ASSERT(0);
- break;
- }
+ if(!Next(b)) {ASSERT(0); break;}
__int64 len = GetPos() - pos;
Seek(pos);
@@ -61,14 +53,10 @@ HRESULT CDiracSplitterFile::Init()
dirac_buffer(decoder, (BYTE*)&dvih->dwSequenceHeader[0], (BYTE*)&dvih->dwSequenceHeader[0] + len);
DecoderState dec_state = dirac_parse(decoder);
- if(dec_state != STATE_SEQUENCE)
- {
- ASSERT(0);
- break;
- }
+ if(dec_state != STATE_SEQUENCE) {ASSERT(0); break;}
if(decoder->src_params.frame_rate.denominator)
- dvih->hdr.AvgTimePerFrame = 10000000i64 * decoder->src_params.frame_rate.denominator / decoder->src_params.frame_rate.numerator;
+ dvih->hdr.AvgTimePerFrame = 10000000i64 * decoder->src_params.frame_rate.denominator / decoder->src_params.frame_rate.numerator;
dvih->hdr.bmiHeader.biSize = sizeof(dvih->hdr.bmiHeader);
dvih->hdr.bmiHeader.biWidth = decoder->src_params.width;
dvih->hdr.bmiHeader.biHeight = decoder->src_params.height;
@@ -94,7 +82,7 @@ HRESULT CDiracSplitterFile::Init()
}
UINT64 CDiracSplitterFile::UnsignedGolombDecode()
-{
+{
int M = 0;
while(M < 64 && !BitRead(1))
M++;
@@ -103,7 +91,7 @@ UINT64 CDiracSplitterFile::UnsignedGolombDecode()
for(int i = 0; i < M; i++)
info |= BitRead(1) << i;
- return (1ui64 << M) - 1 + info;
+ return (1ui64<<M)-1 + info;
}
bool CDiracSplitterFile::Next(BYTE& code, __int64 len)
@@ -115,10 +103,10 @@ bool CDiracSplitterFile::Next(BYTE& code, __int64 len)
if(len-- == 0 || GetPos() >= GetLength()) return(false);
qw = (qw << 8) | (BYTE)BitRead(8);
}
- while((qw & 0xffffffff00) != ((UINT64)START_CODE_PREFIX << 8));
+ while((qw&0xffffffff00) != ((UINT64)START_CODE_PREFIX<<8));
int size_bytes = 0;
// Read in the 6 bytes of next and previous parse unit offsets.
- while(size_bytes < 6)
+ while (size_bytes < 6)
{
if(len-- == 0 || GetPos() >= GetLength()) return(false);
BitRead(8);
@@ -143,7 +131,7 @@ const BYTE* CDiracSplitterFile::NextBlock(BYTE& code, int& size, int& fnum)
if(size == 0)
{
- if((qw & 0xffffffff00) == ((UINT64)START_CODE_PREFIX << 8))
+ if((qw & 0xffffffff00) == ((UINT64)START_CODE_PREFIX<<8) )
code = (BYTE)(qw & 0xff);
if(isFrameStartCode(code))
@@ -157,14 +145,14 @@ const BYTE* CDiracSplitterFile::NextBlock(BYTE& code, int& size, int& fnum)
}
else
{
- if((qw & 0xffffffff00) == ((UINT64)START_CODE_PREFIX << 8))
+ if((qw & 0xffffffff00) == ((UINT64)START_CODE_PREFIX<<8))
break;
}
}
if(size >= m_pBuff.GetSize())
{
- int newsize = max(1024, size * 2);
+ int newsize = max(1024, size*2);
m_pBuff.SetSize(newsize, newsize);
pBuff = m_pBuff.GetData();
}
diff --git a/src/filters/parser/DiracSplitter/DiracSplitterFile.h b/src/filters/parser/DiracSplitter/DiracSplitterFile.h
index a69e61fb1..cc2ec185a 100644
--- a/src/filters/parser/DiracSplitter/DiracSplitterFile.h
+++ b/src/filters/parser/DiracSplitter/DiracSplitterFile.h
@@ -7,27 +7,21 @@
class CDiracSplitterFile : public CBaseSplitterFile
{
- CMediaType m_mt;
- REFERENCE_TIME m_rtDuration;
- CArray<BYTE> m_pBuff;
+ CMediaType m_mt;
+ REFERENCE_TIME m_rtDuration;
+ CArray<BYTE> m_pBuff;
- HRESULT Init();
+ HRESULT Init();
public:
- CDiracSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ CDiracSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
// using CBaseSplitterFile::Read;
- bool Next(BYTE& code, __int64 len = -1);
- const BYTE* NextBlock(BYTE& code, int& size, int& fnum);
- UINT64 UnsignedGolombDecode();
+ bool Next(BYTE& code, __int64 len = -1);
+ const BYTE* NextBlock(BYTE& code, int& size, int& fnum);
+ UINT64 UnsignedGolombDecode();
- const CMediaType& GetMediaType()
- {
- return m_mt;
- }
- REFERENCE_TIME GetDuration()
- {
- return m_rtDuration;
- }
+ const CMediaType& GetMediaType() {return m_mt;}
+ REFERENCE_TIME GetDuration() {return m_rtDuration;}
};
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.cpp
index 8248a0003..33bb8ff9f 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.cpp
@@ -42,40 +42,40 @@
using namespace dirac;
// Constructor for encoding
-SequenceHeaderByteIO::SequenceHeaderByteIO(SourceParams& src_params,
- EncoderParams& enc_params):
- ParseUnitByteIO(),
- m_parseparams_byteio(*this, m_parse_params, enc_params),
+SequenceHeaderByteIO::SequenceHeaderByteIO( SourceParams& src_params,
+ EncoderParams& enc_params):
+ParseUnitByteIO(),
+m_parseparams_byteio(*this, m_parse_params, enc_params),
// create default source parameters for comparisions
- m_default_src_params(src_params.GetVideoFormat()),
- m_src_params(src_params),
- m_sourceparams_byteio(m_src_params,
- m_default_src_params,
- *this),
- m_codec_params(enc_params),
- m_codingparams_byteio(m_src_params,
- m_codec_params,
- m_default_src_params,
- *this)
+m_default_src_params(src_params.GetVideoFormat()),
+m_src_params(src_params),
+m_sourceparams_byteio( m_src_params,
+ m_default_src_params,
+ *this),
+m_codec_params(enc_params),
+m_codingparams_byteio(m_src_params,
+ m_codec_params,
+ m_default_src_params,
+ *this)
{
}
// Constructor for decoding
SequenceHeaderByteIO::SequenceHeaderByteIO(const ParseUnitByteIO& parseunit_byteio,
- ParseParams& parse_params,
- SourceParams& src_params,
- CodecParams& codec_params) :
- ParseUnitByteIO(parseunit_byteio),
- m_parseparams_byteio(parseunit_byteio, parse_params),
- m_src_params(src_params),
- m_sourceparams_byteio(m_src_params,
- m_default_src_params,
- parseunit_byteio),
- m_codec_params(codec_params),
- m_codingparams_byteio(m_src_params,
- m_codec_params,
- m_default_src_params,
- parseunit_byteio)
+ ParseParams& parse_params,
+ SourceParams& src_params,
+ CodecParams& codec_params) :
+ParseUnitByteIO(parseunit_byteio),
+m_parseparams_byteio( parseunit_byteio, parse_params),
+m_src_params(src_params),
+m_sourceparams_byteio( m_src_params,
+ m_default_src_params,
+ parseunit_byteio),
+m_codec_params(codec_params),
+m_codingparams_byteio( m_src_params,
+ m_codec_params,
+ m_default_src_params,
+ parseunit_byteio)
{
}
@@ -84,7 +84,7 @@ SequenceHeaderByteIO::~SequenceHeaderByteIO()
}
//-----public------------------------------------------------------
-bool SequenceHeaderByteIO::Input()
+bool SequenceHeaderByteIO::Input()
{
//int o=mp_stream->tellg();
InputParseParams();
@@ -92,22 +92,22 @@ bool SequenceHeaderByteIO::Input()
// Inout Video format
SetByteParams(m_parseparams_byteio);
VideoFormat vf = IntToVideoFormat(ReadUint());
- if(vf == VIDEO_FORMAT_UNDEFINED)
- DIRAC_THROW_EXCEPTION(
- ERR_INVALID_VIDEO_FORMAT,
- "Dirac does not recognise the specified video-format",
- SEVERITY_ACCESSUNIT_ERROR);
+ if(vf==VIDEO_FORMAT_UNDEFINED)
+ DIRAC_THROW_EXCEPTION(
+ ERR_INVALID_VIDEO_FORMAT,
+ "Dirac does not recognise the specified video-format",
+ SEVERITY_ACCESSUNIT_ERROR);
SourceParams src_params(vf, true);
m_src_params = src_params;
-
+
InputSourceParams();
-
+
CodecParams codec_params(vf);
m_codec_params = codec_params;
-
+
InputCodingParams();
-
+
return true;
}
@@ -122,15 +122,15 @@ void SequenceHeaderByteIO::Output()
OutputSourceParams();
OutputCodingParams();
-
+
}
int SequenceHeaderByteIO::GetSize() const
{
- return ParseUnitByteIO::GetSize() +
- m_parseparams_byteio.GetSize() +
- ByteIO::GetSize() +
- m_sourceparams_byteio.GetSize() +
+ return ParseUnitByteIO::GetSize()+
+ m_parseparams_byteio.GetSize()+
+ ByteIO::GetSize() +
+ m_sourceparams_byteio.GetSize()+
m_codingparams_byteio.GetSize();
}
@@ -150,7 +150,7 @@ unsigned char SequenceHeaderByteIO::CalcParseCode() const
void SequenceHeaderByteIO::InputSourceParams()
{
- // copy current input params
+ // copy current input params
m_sourceparams_byteio.SetByteParams(*this);
m_sourceparams_byteio.Input();
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.h
index 346bd4110..2c2966ed8 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/accessunit_byteio.h
@@ -50,135 +50,132 @@
namespace dirac
{
-/**
-* A random access point within a Dirac bytestream
-*/
-class SequenceHeaderByteIO : public ParseUnitByteIO
-{
-public:
-
/**
- * Constructor (encoding)
- *@param src_params Source parameters for current AccessUnit
- *@param enc_params Encoder parameters for current AccessUnit
+ * A random access point within a Dirac bytestream
*/
- SequenceHeaderByteIO(SourceParams& src_params,
- EncoderParams& enc_params);
-
- /**
- * Constructor (decoding)
- *@param parseunit_byteio Source of data
- *@param parse_params Destination of parse paramters data
- *@param src_params Destination of source paramters data
- *@param codec_params Destination of coding paramters data
- */
- SequenceHeaderByteIO(const ParseUnitByteIO& parseunit_byteio,
+ class SequenceHeaderByteIO : public ParseUnitByteIO
+ {
+ public:
+
+ /**
+ * Constructor (encoding)
+ *@param src_params Source parameters for current AccessUnit
+ *@param enc_params Encoder parameters for current AccessUnit
+ */
+ SequenceHeaderByteIO( SourceParams& src_params,
+ EncoderParams& enc_params);
+
+ /**
+ * Constructor (decoding)
+ *@param parseunit_byteio Source of data
+ *@param parse_params Destination of parse paramters data
+ *@param src_params Destination of source paramters data
+ *@param codec_params Destination of coding paramters data
+ */
+ SequenceHeaderByteIO(const ParseUnitByteIO& parseunit_byteio,
ParseParams& parse_params,
SourceParams& src_params,
CodecParams& codec_params);
- /**
- * Destructor
- */
- ~SequenceHeaderByteIO();
-
- /**
- * Parses data in Dirac-stream format (decoding)
- */
- bool Input();
-
- /**
- * Writes access-unit info to Dirac stream-format (encoding)
- */
- void Output();
-
- /*
- * Gets size of access-unit (in bytes)
- */
- int GetSize() const;
-
- /**
- * Gets parse-unit type
- */
- ParseUnitType GetType() const
- {
- return PU_SEQ_HEADER;
- }
-
-private:
-
- /**
- * Calculates parse-code based on access-unit parameters (encoding)
- *@return Char bit-set
- */
- unsigned char CalcParseCode() const;
-
- /**
- * Parse source attributes from bytestream-compatible input (decoding)
- */
- void InputSourceParams();
-
- /**
- * Parse parse attributes from bytestream-compatible input (decoding)
- */
- void InputParseParams();
-
- /**
- * Parse Coding attributes from bytestream-compatible input (decoding)
- */
- void InputCodingParams();
-
- /**
- * Output source attributes for bytestream-compatible output (encoding)
- */
- void OutputSourceParams();
-
- /**
- * Output parse attributes for bytestream-compatible output (encoding)
- */
- void OutputParseParams();
-
- /**
- * Output coding attributes for bytestream-compatible output (encoding)
- */
- void OutputCodingParams();
-
- /**
- * Current parse parameters
- */
- ParseParams m_parse_params;
-
-
- /**
- * Parse-params byte input/output
- */
- ParseParamsByteIO m_parseparams_byteio;
-
- /**
- * Default source parameters
- */
- SourceParams m_default_src_params;
-
- /**
- * Current source parameters
- */
- SourceParams& m_src_params;
-
- /**
- * Source-params byte input/output
- */
- SourceParamsByteIO m_sourceparams_byteio;
-
- /**
- * Current codec parameters
- */
- CodecParams& m_codec_params;
-
- /**
- * Coding-params byte input/output
- */
- CodingParamsByteIO m_codingparams_byteio;
-};
+ /**
+ * Destructor
+ */
+ ~SequenceHeaderByteIO();
+
+ /**
+ * Parses data in Dirac-stream format (decoding)
+ */
+ bool Input();
+
+ /**
+ * Writes access-unit info to Dirac stream-format (encoding)
+ */
+ void Output();
+
+ /*
+ * Gets size of access-unit (in bytes)
+ */
+ int GetSize() const;
+
+ /**
+ * Gets parse-unit type
+ */
+ ParseUnitType GetType() const { return PU_SEQ_HEADER;}
+
+ private:
+
+ /**
+ * Calculates parse-code based on access-unit parameters (encoding)
+ *@return Char bit-set
+ */
+ unsigned char CalcParseCode() const;
+
+ /**
+ * Parse source attributes from bytestream-compatible input (decoding)
+ */
+ void InputSourceParams();
+
+ /**
+ * Parse parse attributes from bytestream-compatible input (decoding)
+ */
+ void InputParseParams();
+
+ /**
+ * Parse Coding attributes from bytestream-compatible input (decoding)
+ */
+ void InputCodingParams();
+
+ /**
+ * Output source attributes for bytestream-compatible output (encoding)
+ */
+ void OutputSourceParams();
+
+ /**
+ * Output parse attributes for bytestream-compatible output (encoding)
+ */
+ void OutputParseParams();
+
+ /**
+ * Output coding attributes for bytestream-compatible output (encoding)
+ */
+ void OutputCodingParams();
+
+ /**
+ * Current parse parameters
+ */
+ ParseParams m_parse_params;
+
+
+ /**
+ * Parse-params byte input/output
+ */
+ ParseParamsByteIO m_parseparams_byteio;
+
+ /**
+ * Default source parameters
+ */
+ SourceParams m_default_src_params;
+
+ /**
+ * Current source parameters
+ */
+ SourceParams& m_src_params;
+
+ /**
+ * Source-params byte input/output
+ */
+ SourceParamsByteIO m_sourceparams_byteio;
+
+ /**
+ * Current codec parameters
+ */
+ CodecParams& m_codec_params;
+
+ /**
+ * Coding-params byte input/output
+ */
+ CodingParamsByteIO m_codingparams_byteio;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.cpp
index 724239e54..12b129953 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.cpp
@@ -42,37 +42,37 @@ using namespace dirac;
using namespace std;
ByteIO::ByteIO(bool new_stream):
- m_current_byte(0),
- m_current_pos(0),
- m_num_bytes(0),
- m_new_stream(true),
- m_bits_left(0)
+m_current_byte(0),
+m_current_pos(0),
+m_num_bytes(0),
+m_new_stream(true),
+m_bits_left(0)
{
if(new_stream)
mp_stream = new stringstream(stringstream::in | stringstream::out |
stringstream::binary);
-
+
}
ByteIO::ByteIO(const ByteIO& stream_data):
- m_current_byte(0),
- m_current_pos(0),
- m_num_bytes(0),
- m_new_stream(false),
- m_bits_left(0)
+m_current_byte(0),
+m_current_pos(0),
+m_num_bytes(0),
+m_new_stream(false),
+m_bits_left(0)
{
- mp_stream = stream_data.mp_stream;
+ mp_stream=stream_data.mp_stream;
}
ByteIO::~ByteIO()
{
- if(m_new_stream)
+ if (m_new_stream)
delete mp_stream;
}
-const string ByteIO::GetBytes()
+const string ByteIO::GetBytes()
{
return mp_stream->str();
}
@@ -84,35 +84,35 @@ int ByteIO::GetSize() const
void ByteIO::SetByteParams(const ByteIO& byte_io)
{
- mp_stream = byte_io.mp_stream;
- m_current_byte = byte_io.m_current_byte;
- m_current_pos = byte_io.m_current_pos;
+ mp_stream=byte_io.mp_stream;
+ m_current_byte=byte_io.m_current_byte;
+ m_current_pos=byte_io.m_current_pos;
}
//----------protected---------------------------------------------------------------
void ByteIO::ByteAlignInput()
{
- m_current_pos = 0;
- m_current_byte = 0;
+ m_current_pos=0;
+ m_current_byte=0;
}
void ByteIO::ByteAlignOutput()
{
- if(m_current_pos != 0)
+ if(m_current_pos!=0)
OutputCurrentByte();
}
int ByteIO::ReadBit()
{
if(m_current_pos == CHAR_BIT)
- m_current_pos = 0;
+ m_current_pos=0;
- if(m_current_pos == 0)
+ if (m_current_pos == 0)
m_current_byte = InputUnByte();
#if 1
// MSB to LSB
- return GetBit(m_current_byte, (CHAR_BIT - 1 - m_current_pos++));
+ return GetBit(m_current_byte, (CHAR_BIT-1-m_current_pos++));
#else
// LSB to MSB
return GetBit(m_current_byte, m_current_pos++);
@@ -121,7 +121,7 @@ int ByteIO::ReadBit()
int ByteIO::ReadBitB()
{
- if(m_bits_left)
+ if (m_bits_left)
{
--m_bits_left;
return ReadBit();
@@ -143,7 +143,7 @@ bool ByteIO::ReadBoolB()
unsigned int ByteIO::ReadNBits(int count)
{
unsigned int val = 0;
- for(int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i)
{
val <<= 1;
val += ReadBit();
@@ -166,14 +166,14 @@ int ByteIO::ReadSint()
int val = ReadUint();
bool bit;
- //get the sign
- if(val != 0)
+ //get the sign
+ if (val != 0)
{
bit = ReadBit();
- if(bit)
+ if (bit )
val = -val;
}
- return val;
+ return val;
}
int ByteIO::ReadSintB()
@@ -182,24 +182,24 @@ int ByteIO::ReadSintB()
int val = ReadUintB();
bool bit;
- //get the sign
- if(val != 0)
+ //get the sign
+ if (val != 0)
{
bit = ReadBitB();
- if(bit)
+ if (bit )
val = -val;
}
- return val;
+ return val;
}
unsigned int ByteIO::ReadUint()
{
unsigned int value = 1;
- while(!ReadBit())
+ while (!ReadBit())
{
value <<= 1;
- if(ReadBit())
- value += 1;
+ if (ReadBit())
+ value +=1;
}
--value;
return value;
@@ -208,11 +208,11 @@ unsigned int ByteIO::ReadUint()
unsigned int ByteIO::ReadUintB()
{
unsigned int value = 1;
- while(!ReadBitB())
+ while (!ReadBitB())
{
value <<= 1;
- if(ReadBitB())
- value += 1;
+ if (ReadBitB())
+ value +=1;
}
--value;
return value;
@@ -223,21 +223,21 @@ void ByteIO::WriteBit(const bool& bit)
if(bit)
#if 1
// MSB to LSB
- SetBit(m_current_byte, CHAR_BIT - 1 - m_current_pos);
+ SetBit(m_current_byte, CHAR_BIT-1-m_current_pos);
#else
// LSB to MSB
SetBit(m_current_byte, m_current_pos);
#endif
- if(m_current_pos == CHAR_BIT - 1)
- {
+ if ( m_current_pos == CHAR_BIT-1)
+ {
// If a whole byte has been written, output to stream
OutputCurrentByte();
m_current_byte = 0;
m_current_pos = 0;
- }
+ }
else
- // Shift mask to next bit in the output byte
+ // Shift mask to next bit in the output byte
++m_current_pos;
}
@@ -245,7 +245,7 @@ void ByteIO::WriteNBits(unsigned int val, int count)
{
do
{
- WriteBit(val & (1 << (count - 1)));
+ WriteBit(val & ( 1 << (count-1)));
count--;
}
while(count > 0);
@@ -253,7 +253,7 @@ void ByteIO::WriteNBits(unsigned int val, int count)
int ByteIO::WriteNBits(unsigned int val)
{
- int nbits = static_cast<int>(log(static_cast<double>(val)) / log(2.0)) + 1;
+ int nbits = static_cast<int>(log(static_cast<double>(val))/log(2.0)) + 1;
WriteNBits(val, nbits);
return nbits;
}
@@ -265,24 +265,24 @@ void ByteIO::WriteSint(int val)
WriteUint(value);
//do sign
- if(val < 0) WriteBit(1);
- else if(val > 0) WriteBit(0);
+ if (val<0) WriteBit(1);
+ else if (val>0) WriteBit(0);
}
void ByteIO::WriteUint(unsigned int value)
{
- unsigned int val = value + 1;
+ unsigned int val = value+1;
int num_follow_zeroes = 0;
- while(val >= (1U << num_follow_zeroes))
+ while (val >= (1U <<num_follow_zeroes))
++num_follow_zeroes;
--num_follow_zeroes;
- for(int i = num_follow_zeroes - 1; i >= 0; --i)
+ for (int i=num_follow_zeroes-1; i>=0; --i)
{
WriteBit(BIT_ZERO);
- WriteBit(val&(1 << i));
+ WriteBit(val&(1<<i));
}
WriteBit(BIT_ONE);
}
@@ -290,10 +290,10 @@ void ByteIO::WriteUint(unsigned int value)
void ByteIO::RemoveRedundantBytes(const int size)
{
int prev_pos = mp_stream->tellg();
- string data = mp_stream->str();
+ string data=mp_stream->str();
data.erase(0, size);
mp_stream->str(data);
- m_num_bytes = data.size();
+ m_num_bytes=data.size();
if(data.size())
- SeekGet(max(prev_pos - size, 0), ios_base::beg);
+ SeekGet(max(prev_pos-size, 0), ios_base::beg);
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.h
index 806d98a55..db885d658 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/byteio.h
@@ -53,371 +53,342 @@
namespace dirac
{
+
+ // BIT DEFS
+ #define BIT_ZERO 0
+ #define BIT_ONE 1
+
+ // most significant bit in a character
+ #define MS_BIT (1 << (CHAR_BIT - 1))
+
+ /* array index for character containing bit */
+ //#define BIT_IN_CHAR(bit) (1 << (CHAR_BIT-1-bit))
+ #define BIT_IN_CHAR(bit) (1 << bit)
+
+
+ /**
+ * Class ByteIO - top-level class for reading/writing bytes to a stream
+ */
+ class ByteIO
+ {
+ public:
+
+ /**
+ * Default constructor
+ *@param new_stream <B>Has Creates & owns data buffer </B>
+ */
+ ByteIO(bool new_stream=true);
+
+ /**
+ * Constructor
+ *@param stream_data Copies data buffer details
+ */
+ ByteIO(const ByteIO& stream_data);
+
+ /**
+ * Destructor
+ */
+ virtual ~ByteIO();
+
+ /**
+ * Gathers byte-stream statistics
+ *@param dirac_byte_stats Collates byte information
+ */
+ virtual void CollateByteStats(DiracByteStats& dirac_byte_stats)
+ { dirac_byte_stats.Clear(); }
+
+ /**
+ * Get bytes in Dirac-bytestream format
+ */
+ virtual const std::string GetBytes();
+
+ /**
+ * Get position of read stream pointer
+ */
+ int GetReadBytePosition() const { return mp_stream->tellg();};
+
+
+ /**
+ *Gets size (in bytes)
+ */
+ virtual int GetSize() const;
+
+ /**
+ * Copies stream source/destination info
+ *@param byte_io Byte source/destination
+ */
+ void SetByteParams(const ByteIO& byte_io);
+
+ /**
+ * Sync input for byte-alignment
+ */
+ void ByteAlignOutput();
+
+ /**
+ * Ouputs an unsigned integer in interleaved exp Golomb format
+ *@param value Integer to be output
+ */
+ //void OutputVarLengthUint(const unsigned int& value);
+ void WriteUint(unsigned int value);
+
+ /**
+ * Sets input size in bits. Read is limited by this
+ */
+ void SetBitsLeft(int left_bits) { m_bits_left = left_bits; }
+
+ /**
+ * Sets input size in bits. Read is limited by this
+ */
+ int BitsLeft(void) { return m_bits_left; }
+
+ protected:
+
+ inline bool CanRead() const { return(!mp_stream->eof()); }
+
+ inline bool GetBit(unsigned char& c, int pos) const { return (c & BIT_IN_CHAR(pos)); }
+
+ inline void SetBit(unsigned char& c, int pos) const { c |= BIT_IN_CHAR(pos); }
+
+ inline void SetBits(unsigned char& c, unsigned char bits) const { c |= bits; }
+
+ /**
+ * Sync input for byte-alignment
+ */
+ void ByteAlignInput();
+
+
+ /**
+ * Reads boolean value
+ */
+ bool ReadBool();
+
+ /**
+ * Reads boolean value - bounded i/o
+ */
+ bool ReadBoolB();
+
+ /**
+ * Reads next bit
+ */
+ int ReadBit();
+
+ /**
+ * Reads next bit - bounded i/o
+ */
+ int ReadBitB();
+
+ /**
+ * Reads next 'count' bits
+ *@param count number of bits to be read
+ *@return unsigned interger read
+ */
+ unsigned int ReadNBits(int count);
+
+ /**
+ * Reads from stream
+ *@param data Start of char buffer
+ *@param count Number of bytes to read
+ */
+ void InputBytes(char* data, int count)
+ {
+ //int j=mp_stream->tellg();
+ mp_stream->read(data, count);
-// BIT DEFS
-#define BIT_ZERO 0
-#define BIT_ONE 1
-
-// most significant bit in a character
-#define MS_BIT (1 << (CHAR_BIT - 1))
-
-/* array index for character containing bit */
-//#define BIT_IN_CHAR(bit) (1 << (CHAR_BIT-1-bit))
-#define BIT_IN_CHAR(bit) (1 << bit)
-
+ //int h=mp_stream->tellg();
+ }
-/**
-* Class ByteIO - top-level class for reading/writing bytes to a stream
-*/
-class ByteIO
-{
-public:
-
- /**
- * Default constructor
- *@param new_stream <B>Has Creates & owns data buffer </B>
- */
- ByteIO(bool new_stream = true);
-
- /**
- * Constructor
- *@param stream_data Copies data buffer details
- */
- ByteIO(const ByteIO& stream_data);
-
- /**
- * Destructor
- */
- virtual ~ByteIO();
-
- /**
- * Gathers byte-stream statistics
- *@param dirac_byte_stats Collates byte information
- */
- virtual void CollateByteStats(DiracByteStats& dirac_byte_stats)
- {
- dirac_byte_stats.Clear();
- }
-
- /**
- * Get bytes in Dirac-bytestream format
- */
- virtual const std::string GetBytes();
-
- /**
- * Get position of read stream pointer
- */
- int GetReadBytePosition() const
- {
- return mp_stream->tellg();
- };
-
-
- /**
- *Gets size (in bytes)
- */
- virtual int GetSize() const;
-
- /**
- * Copies stream source/destination info
- *@param byte_io Byte source/destination
- */
- void SetByteParams(const ByteIO& byte_io);
-
- /**
- * Sync input for byte-alignment
- */
- void ByteAlignOutput();
-
- /**
- * Ouputs an unsigned integer in interleaved exp Golomb format
- *@param value Integer to be output
- */
- //void OutputVarLengthUint(const unsigned int& value);
- void WriteUint(unsigned int value);
-
- /**
- * Sets input size in bits. Read is limited by this
- */
- void SetBitsLeft(int left_bits)
- {
- m_bits_left = left_bits;
- }
-
- /**
- * Sets input size in bits. Read is limited by this
- */
- int BitsLeft(void)
- {
- return m_bits_left;
- }
-
-protected:
-
- inline bool CanRead() const
- {
- return(!mp_stream->eof());
- }
-
- inline bool GetBit(unsigned char& c, int pos) const
- {
- return (c & BIT_IN_CHAR(pos));
- }
-
- inline void SetBit(unsigned char& c, int pos) const
- {
- c |= BIT_IN_CHAR(pos);
- }
-
- inline void SetBits(unsigned char& c, unsigned char bits) const
- {
- c |= bits;
- }
-
- /**
- * Sync input for byte-alignment
- */
- void ByteAlignInput();
-
-
- /**
- * Reads boolean value
- */
- bool ReadBool();
-
- /**
- * Reads boolean value - bounded i/o
- */
- bool ReadBoolB();
-
- /**
- * Reads next bit
- */
- int ReadBit();
-
- /**
- * Reads next bit - bounded i/o
- */
- int ReadBitB();
-
- /**
- * Reads next 'count' bits
- *@param count number of bits to be read
- *@return unsigned interger read
- */
- unsigned int ReadNBits(int count);
-
- /**
- * Reads from stream
- *@param data Start of char buffer
- *@param count Number of bytes to read
- */
- void InputBytes(char* data, int count)
- {
- //int j=mp_stream->tellg();
- mp_stream->read(data, count);
-
- //int h=mp_stream->tellg();
- }
-
- /**
- * Flushes the bounde input
- */
- void FlushInputB();
-
- /**
- * Reads a signed integer in interleaved exp-Golomb format
- *return Signed integer read
- */
- //int InputVarLengthInt();
- int ReadSint();
-
- /**
- * Reads a signed integer in interleaved exp-Golomb format from bounded input
- *return Signed integer read
- */
- int ReadSintB();
-
- /**
- * Reads an unsigned integer in interleaved exp Golomb format
- *@return Unsigned Integer read
- */
- //unsigned int InputVarLengthUint();
- unsigned int ReadUint();
-
- /**
- * Reads an unsigned integer in interleaved exp Golomb format from bounded input
- *@return Unsigned Integer read
- */
- //unsigned int InputVarLengthUint();
- unsigned int ReadUintB();
-
- /**
- * Reads a fixed length unsigned integer from the stream in big endian
- *@param byte_size Number of bytes in fixed length integer
- *@return Unsigned Integer read
- */
- //inline unsigned int InputFixedLengthUint(const int byte_size) {
- inline unsigned int ReadUintLit(const int byte_size)
- {
- unsigned int val = 0;
- for(int i = 0; i < byte_size; ++i)
+ /**
+ * Flushes the bounde input
+ */
+ void FlushInputB();
+
+ /**
+ * Reads a signed integer in interleaved exp-Golomb format
+ *return Signed integer read
+ */
+ //int InputVarLengthInt();
+ int ReadSint();
+
+ /**
+ * Reads a signed integer in interleaved exp-Golomb format from bounded input
+ *return Signed integer read
+ */
+ int ReadSintB();
+
+ /**
+ * Reads an unsigned integer in interleaved exp Golomb format
+ *@return Unsigned Integer read
+ */
+ //unsigned int InputVarLengthUint();
+ unsigned int ReadUint();
+
+ /**
+ * Reads an unsigned integer in interleaved exp Golomb format from bounded input
+ *@return Unsigned Integer read
+ */
+ //unsigned int InputVarLengthUint();
+ unsigned int ReadUintB();
+
+ /**
+ * Reads a fixed length unsigned integer from the stream in big endian
+ *@param byte_size Number of bytes in fixed length integer
+ *@return Unsigned Integer read
+ */
+ //inline unsigned int InputFixedLengthUint(const int byte_size) {
+ inline unsigned int ReadUintLit(const int byte_size) {
+ unsigned int val=0;
+ for(int i=0; i < byte_size; ++i)
+ {
+ val <<= 8;
+ val += (unsigned char)mp_stream->get();
+ }
+ m_num_bytes+=byte_size;
+ return val;
+ }
+
+ /**
+ * Reads a byte from the stream
+ */
+ inline unsigned char InputUnByte() {m_num_bytes++ ; return mp_stream->get(); }
+
+ /**
+ * Reads a series of bytes from a stream
+ */
+ inline std::string InputUnString(const int count)
{
- val <<= 8;
- val += (unsigned char)mp_stream->get();
+ std::string str;
+ for(int index=0; index < count; ++index)
+ str.push_back(InputUnByte());
+ return str;
}
- m_num_bytes += byte_size;
- return val;
- }
-
- /**
- * Reads a byte from the stream
- */
- inline unsigned char InputUnByte()
- {
- m_num_bytes++ ;
- return mp_stream->get();
- }
-
- /**
- * Reads a series of bytes from a stream
- */
- inline std::string InputUnString(const int count)
- {
- std::string str;
- for(int index = 0; index < count; ++index)
- str.push_back(InputUnByte());
- return str;
- }
-
- /**
- * Outputs a bit
- *@param bit 1/0 Output
- */
- void WriteBit(const bool& bit);
-
- /**
- * Outputs an unsigned integer
- *@param val Integer to be output
- *@return number of bits written
- */
- int WriteNBits(unsigned int val);
-
- /**
- * Outputs an n bit integer
- *@param val Unsigned Integer to be output
- *@param count number of bits to be written
- */
- void WriteNBits(unsigned int val, int count);
-
-
-
- /**
- * Outputs a series of bytes
- */
- void OutputBytes(const std::string& bytes)
- {
- int cur_pos = mp_stream->tellg();
- mp_stream->str(mp_stream->str() + bytes);
- m_num_bytes += bytes.size();
+
+ /**
+ * Outputs a bit
+ *@param bit 1/0 Output
+ */
+ void WriteBit(const bool& bit);
+
+ /**
+ * Outputs an unsigned integer
+ *@param val Integer to be output
+ *@return number of bits written
+ */
+ int WriteNBits(unsigned int val);
+
+ /**
+ * Outputs an n bit integer
+ *@param val Unsigned Integer to be output
+ *@param count number of bits to be written
+ */
+ void WriteNBits(unsigned int val, int count);
+
+
+
+ /**
+ * Outputs a series of bytes
+ */
+ void OutputBytes(const std::string& bytes) {
+ int cur_pos = mp_stream->tellg();
+ mp_stream->str(mp_stream->str()+bytes);
+ m_num_bytes+=bytes.size();
// *mp_stream << bytes;
- mp_stream->seekg(std::max(cur_pos, 0), std::ios_base::beg);
- }
-
- /**
- * Outputs current byte contents
- */
- inline void OutputCurrentByte()
- {
- if(m_current_pos)
- {
- *mp_stream << (m_current_byte);
- ++m_num_bytes;
- m_current_pos = 0;
- m_current_byte = 0;
+ mp_stream->seekg(std::max(cur_pos,0), std::ios_base::beg);
}
- };
-
- /**
- * Outputs an integer in Golomb signed integer format
- *@param val Integer to be output
- */
- //void OutputVarLengthInt(const int val);
- void WriteSint(int val);
-
- /**
- * Output unsigned int value in big endian format
- * @param value Integer to be output
- * @param length number of bytes in val to output
- */
- //inline void OutputFixedLengthUint(const unsigned int& value, const int& length)
- inline void WriteUintLit(const unsigned int& value, const int& length)
- {
- for(int i = length - 1; i >= 0 ; --i)
+
+ /**
+ * Outputs current byte contents
+ */
+ inline void OutputCurrentByte()
{
- unsigned char cp = (value >> (i * 8)) & 0xff;
- *mp_stream << cp;
- }
- m_num_bytes += length;
- }
-
- /**
- * Removes portion of byte-stream no longer required
- *@param count Number of bytes to be removed from beginning of stream
- */
- void RemoveRedundantBytes(const int count);
-
- inline void SeekGet(const int offset, std::ios_base::seekdir dir)
- {
- mp_stream->seekg(offset, dir);
- }
-
- /**
- * Input/output steam
- */
- std::stringstream* mp_stream;
-
-
-private:
-
- /**
- * ArithCodec can see internals for getting/setting bits
- */
- friend class ArithCodecBase;
-
- /**
- * VLC entropy coder can see internals for getting/setting bits
- */
- friend class ArithCodecToVLCAdapter;
-
- /**
- * Char used for temporary storage of op data bits
- */
- unsigned char m_current_byte;
-
- /**
- * Used to set individual bit within the current header byte
- */
- int m_current_pos;
-
- /**
- * Number of bytes processed
- */
- int m_num_bytes;
-
- /**
- * stream alloc flag
- */
- bool m_new_stream;
-
- /**
- * num bits left to read
- */
- int m_bits_left;
-protected:
-
-
-};
+ if (m_current_pos)
+ {
+ *mp_stream << (m_current_byte);
+ ++m_num_bytes;
+ m_current_pos = 0;
+ m_current_byte = 0;
+ }
+ };
+
+ /**
+ * Outputs an integer in Golomb signed integer format
+ *@param val Integer to be output
+ */
+ //void OutputVarLengthInt(const int val);
+ void WriteSint(int val);
+
+ /**
+ * Output unsigned int value in big endian format
+ * @param value Integer to be output
+ * @param length number of bytes in val to output
+ */
+ //inline void OutputFixedLengthUint(const unsigned int& value, const int& length)
+ inline void WriteUintLit(const unsigned int& value, const int& length)
+ {
+ for(int i=length-1; i >=0 ; --i)
+ {
+ unsigned char cp = (value>>(i*8))&0xff;
+ *mp_stream << cp;
+ }
+ m_num_bytes+=length;
+ }
+
+ /**
+ * Removes portion of byte-stream no longer required
+ *@param count Number of bytes to be removed from beginning of stream
+ */
+ void RemoveRedundantBytes(const int count);
+
+ inline void SeekGet(const int offset, std::ios_base::seekdir dir)
+ {
+ mp_stream->seekg(offset, dir);
+ }
+
+ /**
+ * Input/output steam
+ */
+ std::stringstream* mp_stream;
+
+
+ private:
+
+ /**
+ * ArithCodec can see internals for getting/setting bits
+ */
+ friend class ArithCodecBase;
+
+ /**
+ * VLC entropy coder can see internals for getting/setting bits
+ */
+ friend class ArithCodecToVLCAdapter;
+
+ /**
+ * Char used for temporary storage of op data bits
+ */
+ unsigned char m_current_byte;
+
+ /**
+ * Used to set individual bit within the current header byte
+ */
+ int m_current_pos;
+
+ /**
+ * Number of bytes processed
+ */
+ int m_num_bytes;
+
+ /**
+ * stream alloc flag
+ */
+ bool m_new_stream;
+
+ /**
+ * num bits left to read
+ */
+ int m_bits_left;
+ protected:
+
+
+ };
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.cpp
index 69875e31b..7326b4562 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.cpp
@@ -42,13 +42,13 @@
using namespace dirac;
CodingParamsByteIO::CodingParamsByteIO(const SourceParams& src_params,
- CodecParams& codec_params,
- const SourceParams& default_source_params,
- const ByteIO& stream_data):
- ByteIO(stream_data),
- m_src_params(src_params),
- m_codec_params(codec_params),
- m_default_source_params(default_source_params)
+ CodecParams& codec_params,
+ const SourceParams& default_source_params,
+ const ByteIO& stream_data):
+ByteIO(stream_data),
+m_src_params(src_params),
+m_codec_params(codec_params),
+m_default_source_params(default_source_params)
{
}
@@ -75,22 +75,22 @@ void CodingParamsByteIO::Input()
// If source was coded as fields, halve the vertical dimensions
// to set them to field dimensions
- if(m_codec_params.FieldCoding())
+ if (m_codec_params.FieldCoding())
{
- m_codec_params.SetYl(m_codec_params.Yl() >> 1);
- m_codec_params.SetChromaYl(m_codec_params.ChromaYl() >> 1);
+ m_codec_params.SetYl(m_codec_params.Yl()>>1);
+ m_codec_params.SetChromaYl(m_codec_params.ChromaYl()>>1);
}
unsigned int luma_depth = static_cast<unsigned int>
- (
- std::log((double)m_src_params.LumaExcursion()) / std::log(2.0) + 1
- );
+ (
+ std::log((double)m_src_params.LumaExcursion())/std::log(2.0) + 1
+ );
m_codec_params.SetLumaDepth(luma_depth);
unsigned int chroma_depth = static_cast<unsigned int>
- (
- std::log((double)m_src_params.ChromaExcursion()) / std::log(2.0) + 1
- );
+ (
+ std::log((double)m_src_params.ChromaExcursion())/std::log(2.0) + 1
+ );
m_codec_params.SetChromaDepth(chroma_depth);
// byte align
@@ -112,7 +112,7 @@ void CodingParamsByteIO::Output()
void CodingParamsByteIO::InputPictureCodingMode()
{
unsigned int coding_mode = ReadUint();
- if(coding_mode > 1)
+ if (coding_mode > 1)
{
std::ostringstream errstr;
errstr << "Picture coding mode " << coding_mode
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.h
index 05b512df8..b96b037a0 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/codingparams_byteio.h
@@ -51,83 +51,83 @@
namespace dirac
{
-
-/**
-* Represents compressed sequence-parameter data used in an AccessUnit
-*/
-class CodingParamsByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- *@param src_params Source parameters
- *@param codec_params Coding parameters
- *@param default_source_params Default source parameters
- *@param stream_data Source/Destination of data
- */
- CodingParamsByteIO(const SourceParams& src_params,
- CodecParams& codec_params,
- const SourceParams& default_source_params,
- const ByteIO& stream_data);
-
-
- /**
- * Destructor
- */
- ~CodingParamsByteIO();
-
- /**
- * Reads sequence information from Dirac byte-format
- */
- void Input();
-
- /**
- * Outputs sequence information to Dirac byte-format
- */
- void Output();
-
-protected:
-
-
-private:
-
- /**
- * Reads number of bits used to compress input signal
- */
- void InputVideoDepth();
-
- /**
- * Reads picture coding mode - 0 - frames, 1 - fields
- */
- void InputPictureCodingMode();
-
- /**
- * Outputs number of bits used to compress input signal
- */
- void OutputVideoDepth();
-
+
/**
- * Outputs how input was coded - i.e. frames or fields
+ * Represents compressed sequence-parameter data used in an AccessUnit
*/
- void OutputPictureCodingMode();
-
- /**
- * Source paramters for intput/output
- */
- const SourceParams& m_src_params;
-
- /**
- * Coding paramters for intput/output
- */
- CodecParams& m_codec_params;
-
- /**
- * Default source parameters
- */
- const SourceParams& m_default_source_params;
-
-};
+ class CodingParamsByteIO : public ByteIO
+ {
+ public:
+
+ /**
+ * Constructor
+ *@param src_params Source parameters
+ *@param codec_params Coding parameters
+ *@param default_source_params Default source parameters
+ *@param stream_data Source/Destination of data
+ */
+ CodingParamsByteIO(const SourceParams& src_params,
+ CodecParams& codec_params,
+ const SourceParams& default_source_params,
+ const ByteIO& stream_data);
+
+
+ /**
+ * Destructor
+ */
+ ~CodingParamsByteIO();
+
+ /**
+ * Reads sequence information from Dirac byte-format
+ */
+ void Input();
+
+ /**
+ * Outputs sequence information to Dirac byte-format
+ */
+ void Output();
+
+ protected:
+
+
+ private:
+
+ /**
+ * Reads number of bits used to compress input signal
+ */
+ void InputVideoDepth();
+
+ /**
+ * Reads picture coding mode - 0 - frames, 1 - fields
+ */
+ void InputPictureCodingMode();
+
+ /**
+ * Outputs number of bits used to compress input signal
+ */
+ void OutputVideoDepth();
+
+ /**
+ * Outputs how input was coded - i.e. frames or fields
+ */
+ void OutputPictureCodingMode();
+
+ /**
+ * Source paramters for intput/output
+ */
+ const SourceParams& m_src_params;
+
+ /**
+ * Coding paramters for intput/output
+ */
+ CodecParams& m_codec_params;
+
+ /**
+ * Default source parameters
+ */
+ const SourceParams& m_default_source_params;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.cpp
index 88a63811a..07f5433d1 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.cpp
@@ -42,13 +42,13 @@ using namespace std;
ComponentByteIO::ComponentByteIO(CompSort cs,
const ByteIO& byteio):
- ByteIO(byteio),
- m_compsort(cs)
+ByteIO(byteio),
+m_compsort(cs)
{}
ComponentByteIO::ComponentByteIO(CompSort cs):
- ByteIO(),
- m_compsort(cs)
+ByteIO(),
+m_compsort(cs)
{}
ComponentByteIO::~ComponentByteIO()
@@ -83,16 +83,16 @@ void ComponentByteIO::CollateByteStats(DiracByteStats& dirac_byte_stats)
bool ComponentByteIO::Input()
{
-
- return true;
+
+ return true;
}
void ComponentByteIO::Output()
{
-
+
}
//-------------private-------------------------------------------------------
-
+
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.h
index 03ee2f1ea..e80b0877a 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/component_byteio.h
@@ -52,73 +52,73 @@
namespace dirac
{
-/**
-* Picture component in Dirac bytestream format
-*/
-class ComponentByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- *@param cs Picture-component type
- *@param byteIO Input/output Byte stream
- */
- ComponentByteIO(CompSort cs,
- const ByteIO& byteIO);
-
- /**
- * Constructor
- *@param cs Picture-component type
- */
- ComponentByteIO(CompSort cs);
-
/**
- * Destructor
+ * Picture component in Dirac bytestream format
*/
- ~ComponentByteIO();
-
- /**
- * Gathers byte stats on the component data
- *@param dirac_byte_stats Stat container
- */
- void CollateByteStats(DiracByteStats& dirac_byte_stats);
-
- /**
- * Add a subband byte-stream to this component
- *@param p_subband_byteio Subband to be added
- */
- void AddSubband(SubbandByteIO *p_subband_byteio);
-
- /**
- * Inputs data from Dirac stream-format
- */
- bool Input();
-
- /**
- * Outputs picture values to Dirac stream-format
- */
- void Output();
-
-
-
-protected:
-
-
-private:
-
- /**
- * Picture component type
- */
- CompSort m_compsort;
-
- /**
- * List of subbands in output/input order
- */
- std::vector<ByteIO*> m_subband_list;
-
-
-};
+ class ComponentByteIO : public ByteIO
+ {
+ public:
+
+ /**
+ * Constructor
+ *@param cs Picture-component type
+ *@param byteIO Input/output Byte stream
+ */
+ ComponentByteIO(CompSort cs,
+ const ByteIO& byteIO);
+
+ /**
+ * Constructor
+ *@param cs Picture-component type
+ */
+ ComponentByteIO(CompSort cs);
+
+ /**
+ * Destructor
+ */
+ ~ComponentByteIO();
+
+ /**
+ * Gathers byte stats on the component data
+ *@param dirac_byte_stats Stat container
+ */
+ void CollateByteStats(DiracByteStats& dirac_byte_stats);
+
+ /**
+ * Add a subband byte-stream to this component
+ *@param p_subband_byteio Subband to be added
+ */
+ void AddSubband(SubbandByteIO *p_subband_byteio);
+
+ /**
+ * Inputs data from Dirac stream-format
+ */
+ bool Input();
+
+ /**
+ * Outputs picture values to Dirac stream-format
+ */
+ void Output();
+
+
+
+ protected:
+
+
+ private:
+
+ /**
+ * Picture component type
+ */
+ CompSort m_compsort;
+
+ /**
+ * List of subbands in output/input order
+ */
+ std::vector<ByteIO*> m_subband_list;
+
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.cpp
index 883badb14..9c697bc3d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.cpp
@@ -46,7 +46,7 @@ DiracByteStats::DiracByteStats()
}
DiracByteStats::DiracByteStats(const DiracByteStats& dirac_byte_stats):
- m_byte_count(dirac_byte_stats.m_byte_count)
+m_byte_count(dirac_byte_stats.m_byte_count)
{
}
@@ -60,25 +60,25 @@ void DiracByteStats::Clear()
m_byte_count.clear();
}
-int64_t DiracByteStats::GetBitCount(const StatType& stat_type) const
+int64_t DiracByteStats::GetBitCount(const StatType& stat_type) const
{
return GetByteCount(stat_type) * CHAR_BIT;
}
int64_t DiracByteStats::GetByteCount(const StatType& stat_type) const
{
- std::map<StatType, int64_t>::const_iterator it;
- it = m_byte_count.find(stat_type);
- if(it == m_byte_count.end())
- return 0;
+ std::map<StatType, int64_t>::const_iterator it;
+ it = m_byte_count.find(stat_type);
+ if(it==m_byte_count.end())
+ return 0;
- return it->second;
+ return it->second;
}
void DiracByteStats::SetByteCount(const StatType& stat_type, int64_t count)
{
- if(m_byte_count.find(stat_type) == m_byte_count.end())
- m_byte_count[stat_type] = 0;
+ if(m_byte_count.find(stat_type)==m_byte_count.end())
+ m_byte_count[stat_type]=0;
- m_byte_count[stat_type] += count;
-}
+ m_byte_count[stat_type]+=count;
+ }
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.h
index d32635a2a..0da273f0a 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stats.h
@@ -50,71 +50,70 @@
namespace dirac
{
-#ifdef _MSC_VER
-// char length
-#define CHAR_BIT 8
+ #ifdef _MSC_VER
+ // char length
+ #define CHAR_BIT 8
#endif
-typedef enum
-{
- STAT_TOTAL_BYTE_COUNT = 0,
- STAT_MV_BYTE_COUNT,
- STAT_YCOMP_BYTE_COUNT,
- STAT_UCOMP_BYTE_COUNT,
- STAT_VCOMP_BYTE_COUNT
-} StatType;
-
-
-/**
-* Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream
-*/
-class DiracByteStats
-{
-public:
- /**
- * Constructor
- */
- DiracByteStats();
-
- /**
- * Copy constructor
- */
- DiracByteStats(const DiracByteStats& dirac_byte_stats);
-
- /**
- * Destructor
- */
- ~DiracByteStats();
-
- /**
- * Clears data
- */
- void Clear();
-
- /**
- * Gets number of bits for a particular stat-type
- */
- int64_t GetBitCount(const StatType& stat_type) const;
-
- /**
- * Gets number of bytes for a particular stat-type
- */
- int64_t GetByteCount(const StatType& stat_type) const;
-
- /**
- * Sets number of bytes for a particular stat-type
- */
- void SetByteCount(const StatType& stat_type, int64_t count);
-
-
-private:
-
- /**
- * Map of byte-counts
- */
- std::map<StatType, int64_t> m_byte_count;
-
-};
+ typedef enum {
+ STAT_TOTAL_BYTE_COUNT=0,
+ STAT_MV_BYTE_COUNT,
+ STAT_YCOMP_BYTE_COUNT,
+ STAT_UCOMP_BYTE_COUNT,
+ STAT_VCOMP_BYTE_COUNT
+ } StatType;
+
+
+ /**
+ * Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream
+ */
+ class DiracByteStats
+ {
+ public:
+ /**
+ * Constructor
+ */
+ DiracByteStats();
+
+ /**
+ * Copy constructor
+ */
+ DiracByteStats(const DiracByteStats& dirac_byte_stats);
+
+ /**
+ * Destructor
+ */
+ ~DiracByteStats();
+
+ /**
+ * Clears data
+ */
+ void Clear();
+
+ /**
+ * Gets number of bits for a particular stat-type
+ */
+ int64_t GetBitCount(const StatType& stat_type) const;
+
+ /**
+ * Gets number of bytes for a particular stat-type
+ */
+ int64_t GetByteCount(const StatType& stat_type) const;
+
+ /**
+ * Sets number of bytes for a particular stat-type
+ */
+ void SetByteCount(const StatType& stat_type, int64_t count);
+
+
+ private:
+
+ /**
+ * Map of byte-counts
+ */
+ std::map<StatType, int64_t> m_byte_count;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.cpp
index b31e8de47..a45e54706 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.cpp
@@ -44,8 +44,8 @@ using namespace dirac;
using namespace std;
DiracByteStream::DiracByteStream():
- ByteIO(),
- mp_prev_parse_unit(NULL)
+ByteIO(),
+mp_prev_parse_unit(NULL)
{
}
@@ -86,29 +86,29 @@ void DiracByteStream::Reset(ParseUnitByteIO* p_curr_unit, int pos)
ParseUnitByteIO* DiracByteStream::GetNextParseUnit()
{
- if(GetSize() == 0)
+ if(GetSize()==0)
return NULL;
- int pos = 0;
+ int pos=0;
if(mp_prev_parse_unit)
{
// remove the unwanted bytes associated with the previous parse-unit
int prev_offset = mp_prev_parse_unit->GetNextParseOffset();
RemoveRedundantBytes(prev_offset ? prev_offset : mp_prev_parse_unit->GetSize());
delete mp_prev_parse_unit;
- mp_prev_parse_unit = NULL;
+ mp_prev_parse_unit=NULL;
if(!GetSize())
return NULL;
}
- ParseUnitByteIO* p_curr_unit = NULL;
+ ParseUnitByteIO* p_curr_unit=NULL;
while(true)
{
pos = GetReadBytePosition();
p_curr_unit = new ParseUnitByteIO(*this);
- if(!p_curr_unit->Input())
+ if (!p_curr_unit->Input())
{
Reset(p_curr_unit, pos);
return NULL;
@@ -121,7 +121,7 @@ ParseUnitByteIO* DiracByteStream::GetNextParseUnit()
return NULL;
}
- if(p_curr_unit->IsEndOfSequence())
+ if (p_curr_unit->IsEndOfSequence())
{
break;
}
@@ -140,15 +140,15 @@ ParseUnitByteIO* DiracByteStream::GetNextParseUnit()
} // while
// Remove all redundant bytes that are not part of a parse unit
- int remove_size = std::max(0, GetReadBytePosition() - p_curr_unit->GetSize());
- if(remove_size)
+ int remove_size = std::max (0, GetReadBytePosition()-p_curr_unit->GetSize());
+ if (remove_size)
{
- //std::cerr << "Size="<<GetSize() << " Un-useful bytes=" << remove_size << std::endl;
+ //std::cerr << "Size="<<GetSize() << " Un-useful bytes=" << remove_size << std::endl;
RemoveRedundantBytes(remove_size);
}
- mp_prev_parse_unit = p_curr_unit;
- return p_curr_unit;
+ mp_prev_parse_unit=p_curr_unit;
+ return p_curr_unit;
}
DiracByteStats DiracByteStream::GetSequenceStats() const
@@ -161,7 +161,7 @@ DiracByteStats DiracByteStream::GetSequenceStats() const
void DiracByteStream::AddSequenceHeader(SequenceHeaderByteIO *p_seqheader_byteio)
{
// set previous parse-unit details
- ParseUnitByteIO *mp_previous_parse_unit = mp_prev_parse_unit;
+ ParseUnitByteIO *mp_previous_parse_unit=mp_prev_parse_unit;
if(!m_parse_unit_list.empty())
mp_previous_parse_unit = m_parse_unit_list.back().second;
@@ -170,7 +170,7 @@ void DiracByteStream::AddSequenceHeader(SequenceHeaderByteIO *p_seqheader_byteio
p_seqheader_byteio->SetAdjacentParseUnits(mp_previous_parse_unit);
// push onto to pending list
- m_parse_unit_list.push(std::make_pair(PU_SEQ_HEADER, p_seqheader_byteio));
+ m_parse_unit_list.push(std::make_pair (PU_SEQ_HEADER, p_seqheader_byteio) );
// set previous parse-unit
mp_previous_parse_unit = p_seqheader_byteio;
@@ -182,7 +182,7 @@ void DiracByteStream::AddSequenceHeader(SequenceHeaderByteIO *p_seqheader_byteio
void DiracByteStream::AddPicture(PictureByteIO *p_frame_byteio)
{
// set previous parse-unit details
- ParseUnitByteIO *mp_previous_parse_unit = mp_prev_parse_unit;
+ ParseUnitByteIO *mp_previous_parse_unit=mp_prev_parse_unit;
if(!m_parse_unit_list.empty())
mp_previous_parse_unit = m_parse_unit_list.back().second;
@@ -190,26 +190,26 @@ void DiracByteStream::AddPicture(PictureByteIO *p_frame_byteio)
// set adjacent parse-unit
p_frame_byteio->SetAdjacentParseUnits(mp_previous_parse_unit);
- // push onto to pending list
- m_parse_unit_list.push(std::make_pair(PU_PICTURE, p_frame_byteio));
+ // push onto to pending list
+ m_parse_unit_list.push(std::make_pair(PU_PICTURE, p_frame_byteio ) );
- // set previous parse-unit
+ // set previous parse-unit
mp_previous_parse_unit = p_frame_byteio;
- // save stats
+ // save stats
p_frame_byteio->CollateByteStats(m_sequence_stats);
}
void DiracByteStream::Clear()
{
- while(!m_parse_unit_list.empty())
+ while(!m_parse_unit_list.empty())
{
- ParseUnitByteIO* p_parse_unit = m_parse_unit_list.front().second;
+ ParseUnitByteIO* p_parse_unit=m_parse_unit_list.front().second;
m_parse_unit_list.pop();
if(m_parse_unit_list.empty())
{
delete mp_prev_parse_unit;
- mp_prev_parse_unit = p_parse_unit;
+ mp_prev_parse_unit=p_parse_unit;
}
else
delete p_parse_unit;
@@ -221,8 +221,8 @@ DiracByteStats DiracByteStream::EndSequence()
// create
EndOfSequenceByteIO *p_endofsequence_byteio = new EndOfSequenceByteIO(*this);
- // set previous parse-unit details
- ParseUnitByteIO *mp_previous_parse_unit = mp_prev_parse_unit;
+ // set previous parse-unit details
+ ParseUnitByteIO *mp_previous_parse_unit=mp_prev_parse_unit;
if(!m_parse_unit_list.empty())
mp_previous_parse_unit = m_parse_unit_list.back().second;
@@ -230,8 +230,8 @@ DiracByteStats DiracByteStream::EndSequence()
// set adjacent parse-unit
p_endofsequence_byteio->SetAdjacentParseUnits(mp_previous_parse_unit);
- // push onto to pending list
- m_parse_unit_list.push(std::make_pair(PU_END_OF_SEQUENCE, p_endofsequence_byteio));
+ // push onto to pending list
+ m_parse_unit_list.push(std::make_pair(PU_END_OF_SEQUENCE, p_endofsequence_byteio) );
p_endofsequence_byteio->CollateByteStats(m_sequence_stats);
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.h
index 6d2bf229d..d448b5fca 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/dirac_byte_stream.h
@@ -53,105 +53,105 @@
namespace dirac
{
-/**
-* Represents a series of bytes in the Dirac bytestream specfication format.
-* These bytes are grouped into more managable parse units by this class.
-*/
-class DiracByteStream : public ByteIO
-{
-public:
-
- /**
- * Constructor
- */
- DiracByteStream();
-
- /**
- * Destructor
- */
- ~DiracByteStream();
-
- /**
- * Adds Dirac-formatted bytes to internal-byte-stream for processing
- *@param start Start of char list
- *@param count Number of chars
- */
- void AddBytes(char* start, int count);
-
- /**
- * Gets the statistics of the most recent parse-unit to be processed
- *@return Byte-statistics
- */
- DiracByteStats GetLastUnitStats();
-
- /**
- * Gets the next parse-unit in the current byte-stream
- */
- ParseUnitByteIO* GetNextParseUnit();
-
-
- /**
- * Gets stats for current sequence
- */
- DiracByteStats GetSequenceStats() const;
-
- /**
- * Adds a random access point to the current Dirac byte stream
- *@param p_seqheader_byteio Sequence header data.
- */
- void AddSequenceHeader(SequenceHeaderByteIO *p_seqheader_byteio);
-
/**
- * Adds a picture to the current Dirac byte stream
- *@param p_frame_byteio Picture stream. This class is now responsible for deleting.
+ * Represents a series of bytes in the Dirac bytestream specfication format.
+ * These bytes are grouped into more managable parse units by this class.
*/
- void AddPicture(PictureByteIO *p_frame_byteio);
-
- /**
- * Clear parse-units
- */
- void Clear();
-
- /**
- * Insert end-of-sequence data
- *@return Sequence stats
- */
- DiracByteStats EndSequence();
-
- /**
- * Gets a pointer to all current output bytes
- */
- const std::string GetBytes();
-
- /**
- * Any info pending?
- */
- bool IsUnitAvailable() const;
-
-private:
-
- void Reset(ParseUnitByteIO* p_curr_unit, int pos);
-
-private:
-
- /**
- * Parse-units in Dirac stream
- */
- typedef std::queue< std::pair <ParseUnitType, ParseUnitByteIO*> > ParseUnitList;
- ParseUnitList m_parse_unit_list;
-
- /**
- * Last unit to be processed
- * Required for specifying the previous parse-unit
- */
- ParseUnitByteIO* mp_prev_parse_unit;
-
- /**
- * Stats for current sequence
- */
- DiracByteStats m_sequence_stats;
-
-};
+ class DiracByteStream : public ByteIO
+ {
+ public:
+
+ /**
+ * Constructor
+ */
+ DiracByteStream();
+
+ /**
+ * Destructor
+ */
+ ~DiracByteStream();
+
+ /**
+ * Adds Dirac-formatted bytes to internal-byte-stream for processing
+ *@param start Start of char list
+ *@param count Number of chars
+ */
+ void AddBytes(char* start, int count);
+
+ /**
+ * Gets the statistics of the most recent parse-unit to be processed
+ *@return Byte-statistics
+ */
+ DiracByteStats GetLastUnitStats();
+
+ /**
+ * Gets the next parse-unit in the current byte-stream
+ */
+ ParseUnitByteIO* GetNextParseUnit();
+
+
+ /**
+ * Gets stats for current sequence
+ */
+ DiracByteStats GetSequenceStats() const;
+
+ /**
+ * Adds a random access point to the current Dirac byte stream
+ *@param p_seqheader_byteio Sequence header data.
+ */
+ void AddSequenceHeader(SequenceHeaderByteIO *p_seqheader_byteio);
+
+ /**
+ * Adds a picture to the current Dirac byte stream
+ *@param p_frame_byteio Picture stream. This class is now responsible for deleting.
+ */
+ void AddPicture(PictureByteIO *p_frame_byteio);
+
+ /**
+ * Clear parse-units
+ */
+ void Clear();
+
+ /**
+ * Insert end-of-sequence data
+ *@return Sequence stats
+ */
+ DiracByteStats EndSequence();
+
+ /**
+ * Gets a pointer to all current output bytes
+ */
+ const std::string GetBytes();
+
+ /**
+ * Any info pending?
+ */
+ bool IsUnitAvailable() const;
+
+ private:
+
+ void Reset(ParseUnitByteIO* p_curr_unit, int pos);
+
+ private:
+
+ /**
+ * Parse-units in Dirac stream
+ */
+ typedef std::queue< std::pair <ParseUnitType, ParseUnitByteIO*> > ParseUnitList;
+ ParseUnitList m_parse_unit_list;
+
+ /**
+ * Last unit to be processed
+ * Required for specifying the previous parse-unit
+ */
+ ParseUnitByteIO* mp_prev_parse_unit;
+
+ /**
+ * Stats for current sequence
+ */
+ DiracByteStats m_sequence_stats;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.cpp
index f1faa202c..e74a4f278 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.cpp
@@ -40,14 +40,14 @@
using namespace dirac;
-SourceParamsByteIO::SourceParamsByteIO(SourceParams& src_params,
- const SourceParams& default_src_params,
- const ByteIO& stream_data):
- ByteIO(stream_data),
- m_src_params(src_params),
- m_default_src_params(default_src_params)
+SourceParamsByteIO::SourceParamsByteIO( SourceParams& src_params,
+ const SourceParams& default_src_params,
+ const ByteIO& stream_data):
+ByteIO(stream_data),
+m_src_params(src_params),
+m_default_src_params(default_src_params)
{
-
+
}
@@ -71,7 +71,7 @@ void SourceParamsByteIO::Input()
// input frame rate
InputFrameRate();
- // input pixel aspect ratio
+ // input pixel aspect ratio
InputPixelAspectRatio();
// input clean area
@@ -98,7 +98,7 @@ void SourceParamsByteIO::Output()
// output frame rate
OutputFrameRate();
- // output pixel aspect ratio
+ // output pixel aspect ratio
OutputPixelAspectRatio();
// output clean area
@@ -135,12 +135,12 @@ void SourceParamsByteIO::InputChromaSamplingFormat()
// set chroma
ChromaFormat chroma_format = IntToChromaFormat(ReadUint());
- if(chroma_format == formatNK)
+ if(chroma_format==formatNK)
DIRAC_THROW_EXCEPTION(
- ERR_INVALID_CHROMA_FORMAT,
- "Dirac does not recognise the specified chroma-format",
- SEVERITY_ACCESSUNIT_ERROR)
- m_src_params.SetCFormat(chroma_format);
+ ERR_INVALID_CHROMA_FORMAT,
+ "Dirac does not recognise the specified chroma-format",
+ SEVERITY_ACCESSUNIT_ERROR)
+ m_src_params.SetCFormat(chroma_format);
}
void SourceParamsByteIO::InputPixelAspectRatio()
@@ -151,24 +151,24 @@ void SourceParamsByteIO::InputPixelAspectRatio()
// read index value
int pixel_aspect_ratio_index = ReadUint();
- PixelAspectRatioType pixel_aspect_ratio = IntToPixelAspectRatioType(pixel_aspect_ratio_index);
- if(pixel_aspect_ratio == PIXEL_ASPECT_RATIO_UNDEFINED)
- DIRAC_THROW_EXCEPTION(
- ERR_INVALID_PIXEL_ASPECT_RATIO,
- "Dirac does not recognise the specified pixel_aspect_ratio",
- SEVERITY_ACCESSUNIT_ERROR)
-
- if(pixel_aspect_ratio_index != PIXEL_ASPECT_RATIO_CUSTOM)
- {
- m_src_params.SetPixelAspectRatio(pixel_aspect_ratio);
- }
- else
- {
- // read num/denom
- int numerator = ReadUint();
- int denominator = ReadUint();
- m_src_params.SetPixelAspectRatio(numerator, denominator);
- }
+ PixelAspectRatioType pixel_aspect_ratio=IntToPixelAspectRatioType(pixel_aspect_ratio_index);
+ if(pixel_aspect_ratio==PIXEL_ASPECT_RATIO_UNDEFINED)
+ DIRAC_THROW_EXCEPTION(
+ ERR_INVALID_PIXEL_ASPECT_RATIO,
+ "Dirac does not recognise the specified pixel_aspect_ratio",
+ SEVERITY_ACCESSUNIT_ERROR)
+
+ if(pixel_aspect_ratio_index!=PIXEL_ASPECT_RATIO_CUSTOM)
+ {
+ m_src_params.SetPixelAspectRatio(pixel_aspect_ratio);
+ }
+ else
+ {
+ // read num/denom
+ int numerator = ReadUint();
+ int denominator = ReadUint();
+ m_src_params.SetPixelAspectRatio(numerator, denominator);
+ }
}
@@ -178,10 +178,10 @@ void SourceParamsByteIO::InputCleanArea()
if(!clean_area_flag)
return;
- m_src_params.SetCleanWidth(ReadUint());
- m_src_params.SetCleanHeight(ReadUint());
- m_src_params.SetLeftOffset(ReadUint());
- m_src_params.SetTopOffset(ReadUint());
+ m_src_params.SetCleanWidth( ReadUint() );
+ m_src_params.SetCleanHeight( ReadUint() );
+ m_src_params.SetLeftOffset( ReadUint() );
+ m_src_params.SetTopOffset( ReadUint() );
}
void SourceParamsByteIO::InputColourMatrix()
@@ -214,8 +214,8 @@ void SourceParamsByteIO::InputColourSpecification()
// read index value
int colour_spec_index = ReadUint();
- m_src_params.SetColourSpecification(colour_spec_index);
- if(colour_spec_index == 0)
+ m_src_params.SetColourSpecification( colour_spec_index );
+ if(colour_spec_index==0)
{
InputColourPrimaries();
InputColourMatrix();
@@ -230,24 +230,24 @@ void SourceParamsByteIO::InputFrameRate()
return;
int frame_rate_index = ReadUint();
- FrameRateType frame_rate = IntToFrameRateType(frame_rate_index);
- if(frame_rate == FRAMERATE_UNDEFINED)
+ FrameRateType frame_rate=IntToFrameRateType(frame_rate_index);
+ if(frame_rate==FRAMERATE_UNDEFINED)
DIRAC_THROW_EXCEPTION(
- ERR_INVALID_PICTURE_RATE,
- "Dirac does not recognise the specified frame-rate",
- SEVERITY_ACCESSUNIT_ERROR)
+ ERR_INVALID_PICTURE_RATE,
+ "Dirac does not recognise the specified frame-rate",
+ SEVERITY_ACCESSUNIT_ERROR)
- if(frame_rate_index != FRAMERATE_CUSTOM)
- {
- m_src_params.SetFrameRate(frame_rate);
- }
- else
- {
- // read num/denom
- int numerator = ReadUint();
- int denominator = ReadUint();
- m_src_params.SetFrameRate(numerator, denominator);
- }
+ if(frame_rate_index!=FRAMERATE_CUSTOM)
+ {
+ m_src_params.SetFrameRate(frame_rate);
+ }
+ else
+ {
+ // read num/denom
+ int numerator = ReadUint();
+ int denominator = ReadUint();
+ m_src_params.SetFrameRate(numerator, denominator);
+ }
}
void SourceParamsByteIO::InputScanFormat()
@@ -257,7 +257,7 @@ void SourceParamsByteIO::InputScanFormat()
return;
unsigned int source_sampling = ReadUint();
- if(source_sampling > 1)
+ if (source_sampling > 1)
{
std::ostringstream errstr;
errstr << "Source Sampling " << source_sampling
@@ -279,25 +279,25 @@ void SourceParamsByteIO::InputSignalRange()
// read index value
int signal_range_index = ReadUint();
SignalRangeType signal_range = IntToSignalRangeType(signal_range_index);
- if(signal_range == SIGNAL_RANGE_UNDEFINED)
+ if(signal_range==SIGNAL_RANGE_UNDEFINED)
DIRAC_THROW_EXCEPTION(
- ERR_INVALID_SIGNAL_RANGE,
- "Dirac does not recognise the specified signal-range",
- SEVERITY_ACCESSUNIT_ERROR)
+ ERR_INVALID_SIGNAL_RANGE,
+ "Dirac does not recognise the specified signal-range",
+ SEVERITY_ACCESSUNIT_ERROR)
- if(signal_range_index != SIGNAL_RANGE_CUSTOM)
- {
- m_src_params.SetSignalRange(signal_range);
- }
- else
- {
- // read luma values
- m_src_params.SetLumaOffset(ReadUint());
- m_src_params.SetLumaExcursion(ReadUint());
- // read chroma values
- m_src_params.SetChromaOffset(ReadUint());
- m_src_params.SetChromaExcursion(ReadUint());
- }
+ if(signal_range_index!=SIGNAL_RANGE_CUSTOM)
+ {
+ m_src_params.SetSignalRange(signal_range);
+ }
+ else
+ {
+ // read luma values
+ m_src_params.SetLumaOffset( ReadUint() );
+ m_src_params.SetLumaExcursion( ReadUint() );
+ // read chroma values
+ m_src_params.SetChromaOffset( ReadUint() );
+ m_src_params.SetChromaExcursion( ReadUint() );
+ }
}
void SourceParamsByteIO::InputTransferFunction()
@@ -315,8 +315,8 @@ void SourceParamsByteIO::OutputFrameSize()
{
// output 'is custom' dimensions flag
- bool is_custom = (m_src_params.Xl() != m_default_src_params.Xl() ||
- m_src_params.Yl() != m_default_src_params.Yl());
+ bool is_custom = (m_src_params.Xl()!=m_default_src_params.Xl() ||
+ m_src_params.Yl()!=m_default_src_params.Yl());
WriteBit(is_custom);
@@ -332,8 +332,8 @@ void SourceParamsByteIO::OutputFrameSize()
void SourceParamsByteIO::OutputChromaSamplingFormat()
{
// output 'is default' flag
- bool not_default = m_src_params.CFormat() != m_default_src_params.CFormat();
-
+ bool not_default = m_src_params.CFormat()!=m_default_src_params.CFormat();
+
WriteBit(not_default);
if(!not_default)
@@ -346,20 +346,20 @@ void SourceParamsByteIO::OutputChromaSamplingFormat()
void SourceParamsByteIO::OutputPixelAspectRatio()
{
- if(m_src_params.PixelAspectRatioIndex() != PIXEL_ASPECT_RATIO_CUSTOM
- && m_src_params.PixelAspectRatioIndex() == m_default_src_params.PixelAspectRatioIndex())
+ if (m_src_params.PixelAspectRatioIndex()!= PIXEL_ASPECT_RATIO_CUSTOM
+ && m_src_params.PixelAspectRatioIndex() == m_default_src_params.PixelAspectRatioIndex())
{
// default frame rate index
WriteBit(0);
return;
}
// Non-defaults
- WriteBit(1);
+ WriteBit(1);
// Picture rate index
WriteUint(m_src_params.PixelAspectRatioIndex());
-
- if(!m_src_params.PixelAspectRatioIndex()) // i,e. custom value
+
+ if (!m_src_params.PixelAspectRatioIndex()) // i,e. custom value
{
WriteUint(m_src_params.PixelAspectRatio().m_num);
WriteUint(m_src_params.PixelAspectRatio().m_denom);
@@ -369,10 +369,10 @@ void SourceParamsByteIO::OutputPixelAspectRatio()
void SourceParamsByteIO::OutputCleanArea()
{
- if(m_src_params.CleanWidth() != m_default_src_params.CleanWidth() ||
- m_src_params.CleanHeight() != m_default_src_params.CleanHeight() ||
- m_src_params.LeftOffset() != m_default_src_params.LeftOffset() ||
- m_src_params.TopOffset() != m_default_src_params.TopOffset())
+ if (m_src_params.CleanWidth() != m_default_src_params.CleanWidth() ||
+ m_src_params.CleanHeight() != m_default_src_params.CleanHeight() ||
+ m_src_params.LeftOffset() != m_default_src_params.LeftOffset() ||
+ m_src_params.TopOffset() != m_default_src_params.TopOffset())
{
WriteBit(1); // non-default value
WriteUint(m_src_params.CleanWidth());
@@ -386,9 +386,9 @@ void SourceParamsByteIO::OutputCleanArea()
void SourceParamsByteIO::OutputColourSpecification()
{
- if(m_src_params.ColourSpecificationIndex() &&
- m_src_params.ColourSpecificationIndex() ==
- m_default_src_params.ColourSpecificationIndex())
+ if (m_src_params.ColourSpecificationIndex() &&
+ m_src_params.ColourSpecificationIndex() ==
+ m_default_src_params.ColourSpecificationIndex())
{
// default colour specification
WriteBit(0);
@@ -396,14 +396,14 @@ void SourceParamsByteIO::OutputColourSpecification()
}
// Non-defaults
- WriteBit(1);
+ WriteBit(1);
// Output Colour specification index
WriteUint(m_src_params.ColourSpecificationIndex());
- if(!m_src_params.ColourSpecificationIndex()) // i,e, custom values
+ if (!m_src_params.ColourSpecificationIndex()) // i,e, custom values
{
// Output Colour Primaries
- if(m_src_params.ColourPrimariesIndex() == m_default_src_params.ColourPrimariesIndex())
+ if (m_src_params.ColourPrimariesIndex() == m_default_src_params.ColourPrimariesIndex())
{
// default value
WriteBit(0);
@@ -415,7 +415,7 @@ void SourceParamsByteIO::OutputColourSpecification()
}
// Output Colour Matrix
- if(m_src_params.ColourMatrixIndex() == m_default_src_params.ColourMatrixIndex())
+ if (m_src_params.ColourMatrixIndex() == m_default_src_params.ColourMatrixIndex())
{
// default value
WriteBit(0);
@@ -427,7 +427,7 @@ void SourceParamsByteIO::OutputColourSpecification()
}
// Output TransferFunction
- if(m_src_params.TransferFunctionIndex() == m_default_src_params.TransferFunctionIndex())
+ if (m_src_params.TransferFunctionIndex() == m_default_src_params.TransferFunctionIndex())
{
// default value
WriteBit(0);
@@ -442,20 +442,20 @@ void SourceParamsByteIO::OutputColourSpecification()
void SourceParamsByteIO::OutputFrameRate()
{
- if(m_src_params.FrameRateIndex() != FRAMERATE_CUSTOM
- && m_src_params.FrameRateIndex() == m_default_src_params.FrameRateIndex())
+ if (m_src_params.FrameRateIndex()!=FRAMERATE_CUSTOM
+ && m_src_params.FrameRateIndex() == m_default_src_params.FrameRateIndex())
{
// default frame rate index
WriteBit(0);
return;
}
// Non-defaults
- WriteBit(1);
+ WriteBit(1);
// Picture rate index
WriteUint(m_src_params.FrameRateIndex());
-
- if(!m_src_params.FrameRateIndex()) // i,e. custom value
+
+ if (!m_src_params.FrameRateIndex()) // i,e. custom value
{
WriteUint(m_src_params.FrameRate().m_num);
WriteUint(m_src_params.FrameRate().m_denom);
@@ -465,8 +465,8 @@ void SourceParamsByteIO::OutputFrameRate()
void SourceParamsByteIO::OutputScanFormat()
{
// output 'is default' flag
- bool not_interlace_default = m_src_params.SourceSampling() != m_default_src_params.SourceSampling();
-
+ bool not_interlace_default = m_src_params.SourceSampling()!=m_default_src_params.SourceSampling();
+
WriteBit(not_interlace_default);
if(!not_interlace_default)
@@ -479,20 +479,20 @@ void SourceParamsByteIO::OutputScanFormat()
void SourceParamsByteIO::OutputSignalRange()
{
- if(m_src_params.SignalRangeIndex() != SIGNAL_RANGE_CUSTOM &&
- m_src_params.SignalRangeIndex() == m_default_src_params.SignalRangeIndex())
+ if (m_src_params.SignalRangeIndex()!=SIGNAL_RANGE_CUSTOM &&
+ m_src_params.SignalRangeIndex() == m_default_src_params.SignalRangeIndex())
{
// defaults
WriteBit(0);
return;
}
-
+
// Non-defaults
- WriteBit(1);
+ WriteBit(1);
// Output Signal Range Index
WriteUint(m_src_params.SignalRangeIndex());
- if(!m_src_params.SignalRangeIndex()) // i.e. custom values
+ if (!m_src_params.SignalRangeIndex()) // i.e. custom values
{
WriteUint(m_src_params.LumaOffset());
WriteUint(m_src_params.LumaExcursion());
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.h
index 12cf7cec6..bc5fe823d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/displayparams_byteio.h
@@ -51,148 +51,148 @@
namespace dirac
{
-
-/**
-* Represents compressed source-parameter data contained in a sequence header
-*/
-class SourceParamsByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor for Input/Output
- *@param src_params Source parameters
- *@param default_src_params Default Source parameters
- *@param stream_data Source/Destination of data
- */
- SourceParamsByteIO(SourceParams& src_params,
- const SourceParams& default_src_params,
- const ByteIO& stream_data);
- /**
- * Destructor
- */
- ~SourceParamsByteIO();
-
- /**
- * Reads source params information from Dirac byte-format
- */
- void Input();
-
- /**
- * Outputs source params information to Dirac byte-format
- */
- void Output();
-
-protected:
-
-
-private:
-
- /**
- * Reads frame dimensions
- */
- void InputFrameSize();
-
- /**
- * Reads Chroma Sampling Format
- */
- void InputChromaSamplingFormat();
-
- /**
- * Reads pixel aspect ratio info
- */
- void InputPixelAspectRatio();
-
- /**
- * Reads clean-area info
- */
- void InputCleanArea();
-
- /**
- * Reads colour-matrix info
- */
- void InputColourMatrix();
-
- /**
- * Reads primary-colour info
- */
- void InputColourPrimaries();
-
- /**
- * Reads colour spec info
- */
- void InputColourSpecification();
-
- /**
- * Reads frame-rate info
- */
- void InputFrameRate();
-
- /**
- * Reads Scan info
- */
- void InputScanFormat();
-
- /**
- * Reads signal range info
- */
- void InputSignalRange();
-
- /**
- * Reads transfer-function info
- */
- void InputTransferFunction();
-
- /**
- * Outputs frame dimensions
- */
- void OutputFrameSize();
-
- /**
- * Outputs Chroma Sampling Format
- */
- void OutputChromaSamplingFormat();
-
- /**
- * Outputs pixel aspect ratio info
- */
- void OutputPixelAspectRatio();
-
- /**
- * Outputs clean-area info
- */
- void OutputCleanArea();
-
- /**
- * Outputs colour spec info
- */
- void OutputColourSpecification();
-
- /**
- * Outputs frame-rate info
- */
- void OutputFrameRate();
-
- /**
- * Outputs Scan info
- */
- void OutputScanFormat();
-
- /**
- * Outputs signal range info
- */
- void OutputSignalRange();
-
- /**
- * Source parameters for input/ouput
- */
- SourceParams& m_src_params;
-
- /**
- * Default source parameters
- */
- const SourceParams& m_default_src_params;
-};
+
+ /**
+ * Represents compressed source-parameter data contained in a sequence header
+ */
+ class SourceParamsByteIO : public ByteIO
+ {
+ public:
+
+ /**
+ * Constructor for Input/Output
+ *@param src_params Source parameters
+ *@param default_src_params Default Source parameters
+ *@param stream_data Source/Destination of data
+ */
+ SourceParamsByteIO( SourceParams& src_params,
+ const SourceParams& default_src_params,
+ const ByteIO& stream_data);
+ /**
+ * Destructor
+ */
+ ~SourceParamsByteIO();
+
+ /**
+ * Reads source params information from Dirac byte-format
+ */
+ void Input();
+
+ /**
+ * Outputs source params information to Dirac byte-format
+ */
+ void Output();
+
+ protected:
+
+
+ private:
+
+ /**
+ * Reads frame dimensions
+ */
+ void InputFrameSize();
+
+ /**
+ * Reads Chroma Sampling Format
+ */
+ void InputChromaSamplingFormat();
+
+ /**
+ * Reads pixel aspect ratio info
+ */
+ void InputPixelAspectRatio();
+
+ /**
+ * Reads clean-area info
+ */
+ void InputCleanArea();
+
+ /**
+ * Reads colour-matrix info
+ */
+ void InputColourMatrix();
+
+ /**
+ * Reads primary-colour info
+ */
+ void InputColourPrimaries();
+
+ /**
+ * Reads colour spec info
+ */
+ void InputColourSpecification();
+
+ /**
+ * Reads frame-rate info
+ */
+ void InputFrameRate();
+
+ /**
+ * Reads Scan info
+ */
+ void InputScanFormat();
+
+ /**
+ * Reads signal range info
+ */
+ void InputSignalRange();
+
+ /**
+ * Reads transfer-function info
+ */
+ void InputTransferFunction();
+
+ /**
+ * Outputs frame dimensions
+ */
+ void OutputFrameSize();
+
+ /**
+ * Outputs Chroma Sampling Format
+ */
+ void OutputChromaSamplingFormat();
+
+ /**
+ * Outputs pixel aspect ratio info
+ */
+ void OutputPixelAspectRatio();
+
+ /**
+ * Outputs clean-area info
+ */
+ void OutputCleanArea();
+
+ /**
+ * Outputs colour spec info
+ */
+ void OutputColourSpecification();
+
+ /**
+ * Outputs frame-rate info
+ */
+ void OutputFrameRate();
+
+ /**
+ * Outputs Scan info
+ */
+ void OutputScanFormat();
+
+ /**
+ * Outputs signal range info
+ */
+ void OutputSignalRange();
+
+ /**
+ * Source parameters for input/ouput
+ */
+ SourceParams& m_src_params;
+
+ /**
+ * Default source parameters
+ */
+ const SourceParams& m_default_src_params;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.cpp
index 58f74870a..ca0144e8e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.cpp
@@ -46,9 +46,9 @@ using namespace std;
EndOfSequenceByteIO::EndOfSequenceByteIO(const ByteIO& byte_io):
- ParseUnitByteIO(byte_io)
+ParseUnitByteIO(byte_io)
{
-
+
}
@@ -65,14 +65,14 @@ void EndOfSequenceByteIO::CollateByteStats(DiracByteStats& dirac_byte_stats)
//-------------private-------------------------------------------------------
-
+
unsigned char EndOfSequenceByteIO::CalcParseCode() const
{
unsigned char code = 0;
- // set end-of-sequence parse-code
- SetBits(code, PARSE_CODE_END_OF_SEQUENCE);
+ // set end-of-sequence parse-code
+ SetBits(code, PARSE_CODE_END_OF_SEQUENCE);
- return code;
+ return code;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.h
index f1b7bdb87..0bce3997f 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/endofsequence_byteio.h
@@ -50,60 +50,54 @@
namespace dirac
{
-/**
-* Signals the end of a sequence in a Dirac-formatted bitstream. Current Accessunit parameters
-* are no longer valid for subsequent frames
-*/
-class EndOfSequenceByteIO : public ParseUnitByteIO
-{
-public:
-
- /**
- * Constructor
- *@param stream_data Stream parameters
- */
- EndOfSequenceByteIO(const ByteIO& stream_data);
-
- /**
- * Destructor
- */
- ~EndOfSequenceByteIO();
-
-
- /**
- * Gets parse-unit type
- */
- ParseUnitType GetType() const
- {
- return PU_END_OF_SEQUENCE;
- }
-
- /**
- * Gathers byte stats on the end of sequence data
- *@param dirac_byte_stats Stat container
- */
- void CollateByteStats(DiracByteStats& dirac_byte_stats);
-protected:
-
/**
- * Calculates number of bytes to start of next unit
- *@return Zero(0) End of sequence does not specify a 'next'unit
+ * Signals the end of a sequence in a Dirac-formatted bitstream. Current Accessunit parameters
+ * are no longer valid for subsequent frames
*/
- int CalcNextUnitOffset()
+ class EndOfSequenceByteIO : public ParseUnitByteIO
{
- return 0;
- }
-
-private:
-
- /**
- * Calculates parse-code based on picture parameters
- *@return Char bit-set
- */
- unsigned char CalcParseCode() const;
-
-
-};
+ public:
+
+ /**
+ * Constructor
+ *@param stream_data Stream parameters
+ */
+ EndOfSequenceByteIO(const ByteIO& stream_data);
+
+ /**
+ * Destructor
+ */
+ ~EndOfSequenceByteIO();
+
+
+ /**
+ * Gets parse-unit type
+ */
+ ParseUnitType GetType() const { return PU_END_OF_SEQUENCE;}
+
+ /**
+ * Gathers byte stats on the end of sequence data
+ *@param dirac_byte_stats Stat container
+ */
+ void CollateByteStats(DiracByteStats& dirac_byte_stats);
+ protected:
+
+ /**
+ * Calculates number of bytes to start of next unit
+ *@return Zero(0) End of sequence does not specify a 'next'unit
+ */
+ int CalcNextUnitOffset() { return 0;}
+
+ private:
+
+ /**
+ * Calculates parse-code based on picture parameters
+ *@return Char bit-set
+ */
+ unsigned char CalcParseCode() const;
+
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.cpp
index 075fe0176..2ed0357aa 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.cpp
@@ -42,35 +42,35 @@
using namespace dirac;
MvDataByteIO::MvDataByteIO(PictureParams& pparams,
- PicturePredParams& picpredparams):
- ByteIO(),
- m_pparams(pparams),
- m_picpredparams(picpredparams),
- m_splitmode_data(),
- m_predmode_data(),
- m_mv1hblock_data(),
- m_mv1vblock_data(),
- m_mv2hblock_data(),
- m_mv2vblock_data(),
- m_ydcblock_data(),
- m_udcblock_data(),
- m_vdcblock_data()
+ PicturePredParams& picpredparams):
+ByteIO(),
+m_pparams(pparams),
+m_picpredparams(picpredparams),
+m_splitmode_data(),
+m_predmode_data(),
+m_mv1hblock_data(),
+m_mv1vblock_data(),
+m_mv2hblock_data(),
+m_mv2vblock_data(),
+m_ydcblock_data(),
+m_udcblock_data(),
+m_vdcblock_data()
{}
MvDataByteIO::MvDataByteIO(ByteIO &byte_io, PictureParams& pparams,
- PicturePredParams& picpredparams):
- ByteIO(byte_io),
- m_pparams(pparams),
- m_picpredparams(picpredparams),
- m_splitmode_data(byte_io),
- m_predmode_data(byte_io),
- m_mv1hblock_data(byte_io),
- m_mv1vblock_data(byte_io),
- m_mv2hblock_data(byte_io),
- m_mv2vblock_data(byte_io),
- m_ydcblock_data(byte_io),
- m_udcblock_data(byte_io),
- m_vdcblock_data(byte_io)
+ PicturePredParams& picpredparams):
+ByteIO(byte_io),
+m_pparams(pparams),
+m_picpredparams(picpredparams),
+m_splitmode_data(byte_io),
+m_predmode_data(byte_io),
+m_mv1hblock_data(byte_io),
+m_mv1vblock_data(byte_io),
+m_mv2hblock_data(byte_io),
+m_mv2vblock_data(byte_io),
+m_ydcblock_data(byte_io),
+m_udcblock_data(byte_io),
+m_vdcblock_data(byte_io)
{}
MvDataByteIO::~MvDataByteIO()
@@ -85,50 +85,50 @@ void MvDataByteIO::CollateByteStats(DiracByteStats& dirac_byte_stats)
int MvDataByteIO::GetSize() const
{
- if(m_pparams.NumRefs() == 2)
+ if (m_pparams.NumRefs()==2)
return ByteIO::GetSize() +
- m_splitmode_data.GetSize() +
- m_predmode_data.GetSize() +
- m_mv1hblock_data.GetSize() +
- m_mv1vblock_data.GetSize() +
- m_mv2hblock_data.GetSize() +
- m_mv2vblock_data.GetSize() +
- m_ydcblock_data.GetSize() +
- m_udcblock_data.GetSize() +
+ m_splitmode_data.GetSize()+
+ m_predmode_data.GetSize()+
+ m_mv1hblock_data.GetSize()+
+ m_mv1vblock_data.GetSize()+
+ m_mv2hblock_data.GetSize()+
+ m_mv2vblock_data.GetSize()+
+ m_ydcblock_data.GetSize()+
+ m_udcblock_data.GetSize()+
m_vdcblock_data.GetSize();
else
return ByteIO::GetSize() +
- m_splitmode_data.GetSize() +
- m_predmode_data.GetSize() +
- m_mv1hblock_data.GetSize() +
- m_mv1vblock_data.GetSize() +
- m_ydcblock_data.GetSize() +
- m_udcblock_data.GetSize() +
+ m_splitmode_data.GetSize()+
+ m_predmode_data.GetSize()+
+ m_mv1hblock_data.GetSize()+
+ m_mv1vblock_data.GetSize()+
+ m_ydcblock_data.GetSize()+
+ m_udcblock_data.GetSize()+
m_vdcblock_data.GetSize();
}
const std::string MvDataByteIO::GetBytes()
{
//Output header and block data
- if(m_pparams.NumRefs() == 2)
+ if (m_pparams.NumRefs()==2 )
return ByteIO::GetBytes() +
- m_splitmode_data.GetBytes() +
- m_predmode_data.GetBytes() +
- m_mv1hblock_data.GetBytes() +
- m_mv1vblock_data.GetBytes() +
- m_mv2hblock_data.GetBytes() +
- m_mv2vblock_data.GetBytes() +
- m_ydcblock_data.GetBytes() +
- m_udcblock_data.GetBytes() +
+ m_splitmode_data.GetBytes()+
+ m_predmode_data.GetBytes()+
+ m_mv1hblock_data.GetBytes()+
+ m_mv1vblock_data.GetBytes()+
+ m_mv2hblock_data.GetBytes()+
+ m_mv2vblock_data.GetBytes()+
+ m_ydcblock_data.GetBytes()+
+ m_udcblock_data.GetBytes()+
m_vdcblock_data.GetBytes();
else
return ByteIO::GetBytes() +
- m_splitmode_data.GetBytes() +
- m_predmode_data.GetBytes() +
- m_mv1hblock_data.GetBytes() +
- m_mv1vblock_data.GetBytes() +
- m_ydcblock_data.GetBytes() +
- m_udcblock_data.GetBytes() +
+ m_splitmode_data.GetBytes()+
+ m_predmode_data.GetBytes()+
+ m_mv1hblock_data.GetBytes()+
+ m_mv1vblock_data.GetBytes()+
+ m_ydcblock_data.GetBytes()+
+ m_udcblock_data.GetBytes()+
m_vdcblock_data.GetBytes();
}
@@ -186,7 +186,7 @@ void MvDataByteIO::OutputBlockParams()
// output custom block params flag
unsigned int pidx = BlockParametersIndex(olb_params);
WriteUint(pidx);
- if(pidx == 0) // custom block params
+ if (pidx == 0) // custom block params
{
// output Xblen
WriteUint(olb_params.Xblen());
@@ -204,7 +204,7 @@ void MvDataByteIO::InputBlockParams()
OLBParams olb_params;
unsigned int p_idx = ReadUint();
- if(p_idx == 0)
+ if (p_idx == 0)
{
// Input Xblen
olb_params.SetXblen(ReadUint());
@@ -216,7 +216,7 @@ void MvDataByteIO::InputBlockParams()
olb_params.SetYbsep(ReadUint());
}
else
- SetDefaultBlockParameters(olb_params, p_idx);
+ SetDefaultBlockParameters (olb_params, p_idx);
m_picpredparams.SetLumaBlockParams(olb_params);
}
@@ -231,13 +231,13 @@ void MvDataByteIO::InputMVPrecision()
{
// Input Motion vector precision
MVPrecisionType mv_prec = IntToMVPrecisionType(ReadUint());
- if(mv_prec == MV_PRECISION_UNDEFINED)
+ if(mv_prec==MV_PRECISION_UNDEFINED)
DIRAC_THROW_EXCEPTION(
- ERR_INVALID_MOTION_VECTOR_PRECISION,
- "Dirac does not recognise the specified MV precision",
- SEVERITY_PICTURE_ERROR)
+ ERR_INVALID_MOTION_VECTOR_PRECISION,
+ "Dirac does not recognise the specified MV precision",
+ SEVERITY_PICTURE_ERROR)
- m_picpredparams.SetMVPrecision(mv_prec);
+ m_picpredparams.SetMVPrecision(mv_prec);
}
void MvDataByteIO::OutputGlobalMotionParams()
@@ -252,15 +252,15 @@ void MvDataByteIO::InputGlobalMotionParams()
{
// Always setting global motion to false
// Using Global motion flag
- if(ReadBool())
+ if (ReadBool())
{
m_picpredparams.SetUsingGlobalMotion(true);
// NOTE: FIXME - input actual global motion params in future
DIRAC_THROW_EXCEPTION(
- ERR_UNSUPPORTED_STREAM_DATA,
- "Cannot handle global motion parameters",
- SEVERITY_PICTURE_ERROR)
+ ERR_UNSUPPORTED_STREAM_DATA,
+ "Cannot handle global motion parameters",
+ SEVERITY_PICTURE_ERROR)
}
else
m_picpredparams.SetUsingGlobalMotion(false);
@@ -278,7 +278,7 @@ void MvDataByteIO::InputFramePredictionMode()
// TODO - need to process this field when alternative prediction modes
// become available.
unsigned int frame_pred_mode = ReadUint();
- if(frame_pred_mode != 0)
+ if (frame_pred_mode != 0)
{
DIRAC_THROW_EXCEPTION(
ERR_UNSUPPORTED_STREAM_DATA,
@@ -291,16 +291,16 @@ void MvDataByteIO::InputFramePredictionMode()
void MvDataByteIO::OutputPictureWeights()
{
// Output default weights flags
- if(m_picpredparams.PictureWeightsBits() != 1 ||
- m_picpredparams.Ref1Weight() != 1 ||
- (m_pparams.Refs().size() > 1 && m_picpredparams.Ref2Weight() != 1))
+ if (m_picpredparams.PictureWeightsBits() != 1 ||
+ m_picpredparams.Ref1Weight() != 1 ||
+ (m_pparams.Refs().size() > 1 && m_picpredparams.Ref2Weight() != 1) )
{
- WriteBit(true);
+ WriteBit(true);
// Output weight precision bits
WriteUint(m_picpredparams.PictureWeightsBits());
// Output Ref1 weight
WriteSint(m_picpredparams.Ref1Weight());
- if(m_pparams.Refs().size() > 1)
+ if (m_pparams.Refs().size() > 1)
{
// Output Ref1 weight
WriteSint(m_picpredparams.Ref2Weight());
@@ -308,17 +308,17 @@ void MvDataByteIO::OutputPictureWeights()
}
else
{
- WriteBit(false);
+ WriteBit(false);
}
}
void MvDataByteIO::InputPictureWeights()
{
- if(ReadBool())
+ if (ReadBool())
{
m_picpredparams.SetPictureWeightsPrecision(ReadUint());
m_picpredparams.SetRef1Weight(ReadSint());
- if(m_pparams.Refs().size() > 1)
+ if (m_pparams.Refs().size() > 1)
m_picpredparams.SetRef2Weight(ReadSint());
else
m_picpredparams.SetRef2Weight(0);
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.h
index ff809c3d5..578a3594e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdata_byteio.h
@@ -53,244 +53,217 @@
namespace dirac
{
-/**
-* Represents compressed sequence-parameter data used in an AccessUnit
-*/
-class MvDataByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- *@param pparams Picture Params
- *@param picpredparams Picture prediction parameters
- */
- MvDataByteIO(PictureParams& pparams,
- PicturePredParams& picpredparams);
-
- /**
- * Constructor
- *@param byte_io Input/Output Byte stream
- *@param pparams Picture Params
- *@param picpredparams Picture prediction parameters
- */
- MvDataByteIO(ByteIO &byte_io, PictureParams& pparams,
- PicturePredParams& picpredparams);
-
- /**
- * Destructor
- */
- virtual ~MvDataByteIO();
-
- /**
- * Gathers byte stats on the motion vector data
- *@param dirac_byte_stats Stat container
- */
- void CollateByteStats(DiracByteStats& dirac_byte_stats);
-
- /**
- * Outputs motion vector data Dirac byte-format
- */
- void Output();
-
- /**
- * Inputs motion vector information
- */
- void Input();
-
-
- /**
- * Get string containing coded bytes
- */
- virtual const std::string GetBytes();
-
/**
- * Return pointer to the superblock splitting modes ByteIO stream
+ * Represents compressed sequence-parameter data used in an AccessUnit
*/
- MvDataElementByteIO* SplitModeData()
+ class MvDataByteIO : public ByteIO
{
- return &m_splitmode_data;
+ public:
+
+ /**
+ * Constructor
+ *@param pparams Picture Params
+ *@param picpredparams Picture prediction parameters
+ */
+ MvDataByteIO(PictureParams& pparams,
+ PicturePredParams& picpredparams);
+
+ /**
+ * Constructor
+ *@param byte_io Input/Output Byte stream
+ *@param pparams Picture Params
+ *@param picpredparams Picture prediction parameters
+ */
+ MvDataByteIO(ByteIO &byte_io, PictureParams& pparams,
+ PicturePredParams& picpredparams);
+
+ /**
+ * Destructor
+ */
+ virtual ~MvDataByteIO();
+
+ /**
+ * Gathers byte stats on the motion vector data
+ *@param dirac_byte_stats Stat container
+ */
+ void CollateByteStats(DiracByteStats& dirac_byte_stats);
+
+ /**
+ * Outputs motion vector data Dirac byte-format
+ */
+ void Output();
+
+ /**
+ * Inputs motion vector information
+ */
+ void Input();
+
+
+ /**
+ * Get string containing coded bytes
+ */
+ virtual const std::string GetBytes();
+
+ /**
+ * Return pointer to the superblock splitting modes ByteIO stream
+ */
+ MvDataElementByteIO* SplitModeData() { return &m_splitmode_data; };
+
+ /**
+ * Return pointer to the superblock splitting modes ByteIO stream
+ */
+ MvDataElementByteIO* PredModeData() { return &m_predmode_data; };
+
+ /**
+ * Return pointer to the block MVs reference 1 ByteIO stream
+ */
+ MvDataElementByteIO* MV1HorizData() { return &m_mv1hblock_data; };
+
+ /**
+ * Return pointer to the block MVs reference 1 ByteIO stream
+ */
+ MvDataElementByteIO* MV1VertData() { return &m_mv1vblock_data; };
+
+ /**
+ * Return pointer to the block MV reference 2 ByteIO stream
+ */
+ MvDataElementByteIO* MV2HorizData() { return &m_mv2hblock_data; };
+
+ /**
+ * Return pointer to the block MV reference 2 ByteIO stream
+ */
+ MvDataElementByteIO* MV2VertData() { return &m_mv2vblock_data; };
+
+ /**
+ * Return pointer to the block Y DC values ByteIO stream
+ */
+ MvDataElementByteIO* YDCData() { return &m_ydcblock_data; };
+
+ /**
+ * Return pointer to the block U DC values ByteIO stream
+ */
+ MvDataElementByteIO* UDCData() { return &m_udcblock_data; };
+
+ /**
+ * Return pointer to the block V DC values ByteIO stream
+ */
+ MvDataElementByteIO* VDCData() { return &m_vdcblock_data; };
+
+ /**
+ * Return the size
+ */
+ int GetSize() const;
+
+ protected:
+
+
+ private:
+ /**
+ * Inputs block parameters
+ */
+ void InputBlockParams();
+
+ /**
+ * Inputs Motion vector precision data
+ */
+ void InputMVPrecision();
+
+ /**
+ * Inputs global motion parameters
+ */
+ void InputGlobalMotionParams();
+
+ /**
+ * Inputs picture prediction mode
+ */
+ void InputFramePredictionMode();
+
+ /**
+ * Inputs Picture Weights
+ */
+ void InputPictureWeights();
+
+ /**
+ * Outputs block parameters
+ */
+ void OutputBlockParams();
+
+ /**
+ * Outputs Motion vector precision data
+ */
+ void OutputMVPrecision();
+
+ /**
+ * Outputs global motion parameters
+ */
+ void OutputGlobalMotionParams();
+
+ /**
+ * Outputs picture prediction mode
+ */
+ void OutputFramePredictionMode();
+
+ /**
+ * Outputs Picture Weights
+ */
+ void OutputPictureWeights();
+
+ /**
+ * Sequence paramters for intput/output
+ */
+ PictureParams& m_pparams;
+
+ /**
+ * Codec params - EncParams for Output and DecParams for input
+ */
+ PicturePredParams& m_picpredparams;
+
+ /**
+ * block data containing split modes
+ */
+ MvDataElementByteIO m_splitmode_data;
+
+ /**
+ * block data containing prediction modes
+ */
+ MvDataElementByteIO m_predmode_data;
+
+ /**
+ * block data containing horizontal MV components for reference 1
+ */
+ MvDataElementByteIO m_mv1hblock_data;
+
+ /**
+ * block data containing vertical MV components for reference 1
+ */
+ MvDataElementByteIO m_mv1vblock_data;
+
+ /**
+ * block data containing horizontal MV components for reference 2
+ */
+ MvDataElementByteIO m_mv2hblock_data;
+
+ /**
+ * block data containing vertical MV components for reference 2
+ */
+ MvDataElementByteIO m_mv2vblock_data;
+
+ /**
+ * block data containing Y DC data
+ */
+ MvDataElementByteIO m_ydcblock_data;
+
+ /**
+ * block data containing U DC data
+ */
+ MvDataElementByteIO m_udcblock_data;
+
+ /**
+ * block data containing V DC data
+ */
+ MvDataElementByteIO m_vdcblock_data;
};
- /**
- * Return pointer to the superblock splitting modes ByteIO stream
- */
- MvDataElementByteIO* PredModeData()
- {
- return &m_predmode_data;
- };
-
- /**
- * Return pointer to the block MVs reference 1 ByteIO stream
- */
- MvDataElementByteIO* MV1HorizData()
- {
- return &m_mv1hblock_data;
- };
-
- /**
- * Return pointer to the block MVs reference 1 ByteIO stream
- */
- MvDataElementByteIO* MV1VertData()
- {
- return &m_mv1vblock_data;
- };
-
- /**
- * Return pointer to the block MV reference 2 ByteIO stream
- */
- MvDataElementByteIO* MV2HorizData()
- {
- return &m_mv2hblock_data;
- };
-
- /**
- * Return pointer to the block MV reference 2 ByteIO stream
- */
- MvDataElementByteIO* MV2VertData()
- {
- return &m_mv2vblock_data;
- };
-
- /**
- * Return pointer to the block Y DC values ByteIO stream
- */
- MvDataElementByteIO* YDCData()
- {
- return &m_ydcblock_data;
- };
-
- /**
- * Return pointer to the block U DC values ByteIO stream
- */
- MvDataElementByteIO* UDCData()
- {
- return &m_udcblock_data;
- };
-
- /**
- * Return pointer to the block V DC values ByteIO stream
- */
- MvDataElementByteIO* VDCData()
- {
- return &m_vdcblock_data;
- };
-
- /**
- * Return the size
- */
- int GetSize() const;
-
-protected:
-
-
-private:
- /**
- * Inputs block parameters
- */
- void InputBlockParams();
-
- /**
- * Inputs Motion vector precision data
- */
- void InputMVPrecision();
-
- /**
- * Inputs global motion parameters
- */
- void InputGlobalMotionParams();
-
- /**
- * Inputs picture prediction mode
- */
- void InputFramePredictionMode();
-
- /**
- * Inputs Picture Weights
- */
- void InputPictureWeights();
-
- /**
- * Outputs block parameters
- */
- void OutputBlockParams();
-
- /**
- * Outputs Motion vector precision data
- */
- void OutputMVPrecision();
-
- /**
- * Outputs global motion parameters
- */
- void OutputGlobalMotionParams();
-
- /**
- * Outputs picture prediction mode
- */
- void OutputFramePredictionMode();
-
- /**
- * Outputs Picture Weights
- */
- void OutputPictureWeights();
-
- /**
- * Sequence paramters for intput/output
- */
- PictureParams& m_pparams;
-
- /**
- * Codec params - EncParams for Output and DecParams for input
- */
- PicturePredParams& m_picpredparams;
-
- /**
- * block data containing split modes
- */
- MvDataElementByteIO m_splitmode_data;
-
- /**
- * block data containing prediction modes
- */
- MvDataElementByteIO m_predmode_data;
-
- /**
- * block data containing horizontal MV components for reference 1
- */
- MvDataElementByteIO m_mv1hblock_data;
-
- /**
- * block data containing vertical MV components for reference 1
- */
- MvDataElementByteIO m_mv1vblock_data;
-
- /**
- * block data containing horizontal MV components for reference 2
- */
- MvDataElementByteIO m_mv2hblock_data;
-
- /**
- * block data containing vertical MV components for reference 2
- */
- MvDataElementByteIO m_mv2vblock_data;
-
- /**
- * block data containing Y DC data
- */
- MvDataElementByteIO m_ydcblock_data;
-
- /**
- * block data containing U DC data
- */
- MvDataElementByteIO m_udcblock_data;
-
- /**
- * block data containing V DC data
- */
- MvDataElementByteIO m_vdcblock_data;
-};
-
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.cpp
index 524845df4..f8785616d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.cpp
@@ -44,14 +44,14 @@
using namespace dirac;
MvDataElementByteIO::MvDataElementByteIO():
- ByteIO(),
- m_block_data()
+ByteIO(),
+m_block_data()
{
}
MvDataElementByteIO::MvDataElementByteIO(ByteIO &byte_io):
- ByteIO(byte_io),
- m_block_data(byte_io)
+ByteIO(byte_io),
+m_block_data(byte_io)
{
}
@@ -88,7 +88,7 @@ void MvDataElementByteIO::Input()
}
void MvDataElementByteIO::Output()
-{
+{
//Output size of block data
WriteUint(m_block_data.GetSize());
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.h
index 6896ac7ea..2e0aa4211 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/mvdataelement_byteio.h
@@ -53,80 +53,74 @@
namespace dirac
{
-
-/**
-* Represents compressed sequence-parameter data used in an AccessUnit
-*/
-class MvDataElementByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- */
- MvDataElementByteIO();
-
- /**
- * Constructor
- *@param byte_io Input/Output Byte stream
- */
- MvDataElementByteIO(ByteIO &byte_io);
-
- /**
- * Destructor
- */
- virtual ~MvDataElementByteIO();
-
- /**
- * Outputs motion vector data Dirac byte-format
- */
- void Output();
-
- /**
- * Inputs motion vector information
- */
- void Input();
-
-
- /**
- * Get string containing coded bytes
- */
- virtual const std::string GetBytes();
-
+
/**
- * Return pointer to the block data ByteIO stream
+ * Represents compressed sequence-parameter data used in an AccessUnit
*/
- ByteIO* DataBlock()
+ class MvDataElementByteIO : public ByteIO
{
- return &m_block_data;
+ public:
+
+ /**
+ * Constructor
+ */
+ MvDataElementByteIO();
+
+ /**
+ * Constructor
+ *@param byte_io Input/Output Byte stream
+ */
+ MvDataElementByteIO(ByteIO &byte_io);
+
+ /**
+ * Destructor
+ */
+ virtual ~MvDataElementByteIO();
+
+ /**
+ * Outputs motion vector data Dirac byte-format
+ */
+ void Output();
+
+ /**
+ * Inputs motion vector information
+ */
+ void Input();
+
+
+ /**
+ * Get string containing coded bytes
+ */
+ virtual const std::string GetBytes();
+
+ /**
+ * Return pointer to the block data ByteIO stream
+ */
+ ByteIO* DataBlock() { return &m_block_data; };
+
+ /**
+ * Return the input block data size
+ */
+ unsigned int DataBlockSize() { return m_block_size; }
+
+ /**
+ * Return the size
+ */
+ int GetSize() const;
+
+ protected:
+
+ /**
+ * block data
+ */
+ ByteIO m_block_data;
+
+ /**
+ * In block data size
+ */
+ unsigned int m_block_size;
};
- /**
- * Return the input block data size
- */
- unsigned int DataBlockSize()
- {
- return m_block_size;
- }
-
- /**
- * Return the size
- */
- int GetSize() const;
-
-protected:
-
- /**
- * block data
- */
- ByteIO m_block_data;
-
- /**
- * In block data size
- */
- unsigned int m_block_size;
-};
-
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.cpp
index cd3691ee0..5034933bc 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.cpp
@@ -44,15 +44,15 @@ const unsigned int PP_AU_PICTURE_NUM_SIZE = 4;
using namespace dirac;
-ParseParamsByteIO::ParseParamsByteIO(const ByteIO& stream_data,
- ParseParams &parse_params,
- EncoderParams &enc_params):
- ByteIO(stream_data),
- m_parse_params(parse_params)
+ParseParamsByteIO::ParseParamsByteIO( const ByteIO& stream_data,
+ ParseParams &parse_params,
+ EncoderParams &enc_params):
+ByteIO(stream_data),
+m_parse_params(parse_params)
{
- if(enc_params.NumL1() == 0)
+ if (enc_params.NumL1() == 0)
{
- if(!enc_params.UsingAC())
+ if (!enc_params.UsingAC())
{
// Simple Profile
m_parse_params.SetProfile(1);
@@ -66,15 +66,15 @@ ParseParamsByteIO::ParseParamsByteIO(const ByteIO& stream_data,
else
{
// Main (Long GOP) profile
- m_parse_params.SetProfile(8);
+ m_parse_params.SetProfile(8);
}
// FIXME - no support for Low Delay Profile
}
-ParseParamsByteIO::ParseParamsByteIO(const ByteIO& stream_data,
+ParseParamsByteIO::ParseParamsByteIO( const ByteIO& stream_data,
ParseParams &parse_params):
- ByteIO(stream_data),
- m_parse_params(parse_params)
+ByteIO(stream_data),
+m_parse_params(parse_params)
{
@@ -89,8 +89,8 @@ void ParseParamsByteIO::CheckVersion()
std::ostringstream errstr;
ParseParams def_parse_params;
- if(m_parse_params.MajorVersion() > def_parse_params.MajorVersion() ||
- m_parse_params.MajorVersion() == 0 ||
+ if (m_parse_params.MajorVersion() > def_parse_params.MajorVersion() ||
+ m_parse_params.MajorVersion() == 0 ||
(m_parse_params.MajorVersion() == def_parse_params.MajorVersion() &&
m_parse_params.MinorVersion() > def_parse_params.MinorVersion()))
{
@@ -103,7 +103,7 @@ void ParseParamsByteIO::CheckVersion()
errstr << ". May not be able to decode bitstream correctly" << std::endl;
}
- if(errstr.str().size())
+ if (errstr.str().size())
{
DiracException err(
ERR_UNSUPPORTED_STREAM_DATA,
@@ -120,21 +120,21 @@ void ParseParamsByteIO::CheckProfile()
// No profiles were specified in versions 1.0, 1.1, and 2.0 and 2.1.
// So for these versions profile should be 0 in the bitstream
- if(m_parse_params.MajorVersion() <= 2 &&
- m_parse_params.MinorVersion() < 2 &&
- m_parse_params.Profile() != 0)
+ if (m_parse_params.MajorVersion() <= 2 &&
+ m_parse_params.MinorVersion() < 2 &&
+ m_parse_params.Profile() != 0)
{
errstr << "Cannot handle profile " << m_parse_params.Profile()
<< " for bitstream version " << m_parse_params.MajorVersion()
<< "." << m_parse_params.MinorVersion();
errstr << ". May not be able to decode bitstream correctly" << std::endl;
}
- else if(m_parse_params.MajorVersion() == def_parse_params.MajorVersion() &&
- m_parse_params.MinorVersion() == def_parse_params.MinorVersion() &&
- m_parse_params.Profile() != 1 /* Simple */ &&
- m_parse_params.Profile() != 2 /* Main (Intra) */ &&
- m_parse_params.Profile() != 8 /* Main (Long GOP) */
- )
+ else if (m_parse_params.MajorVersion() == def_parse_params.MajorVersion() &&
+ m_parse_params.MinorVersion() == def_parse_params.MinorVersion() &&
+ m_parse_params.Profile() != 1 /* Simple */ &&
+ m_parse_params.Profile() != 2 /* Main (Intra) */ &&
+ m_parse_params.Profile() != 8 /* Main (Long GOP) */
+ )
{
errstr << "Cannot handle profile " << m_parse_params.Profile()
<< " for bitstream version " << m_parse_params.MajorVersion()
@@ -144,7 +144,7 @@ void ParseParamsByteIO::CheckProfile()
errstr << ". May not be able to decode bitstream correctly" << std::endl;
}
- if(errstr.str().size())
+ if (errstr.str().size())
{
DiracException err(
ERR_UNSUPPORTED_STREAM_DATA,
@@ -160,15 +160,15 @@ void ParseParamsByteIO::CheckLevel()
ParseParams def_parse_params;
// No resources constraints for decoder
- if(def_parse_params.Level() == 0)
+ if (def_parse_params.Level() == 0)
return;
// Constraints on Decoder. Can Handles level 1 for Simple and Main (Intra)
// profiles, and level 128 for Main (Long GOP) Profile.
- if(def_parse_params.Level() != 0)
+ if (def_parse_params.Level() != 0)
{
- if((m_parse_params.Profile() <= 2 && m_parse_params.Level() != 1) ||
- (m_parse_params.Profile() == 8 && m_parse_params.Level() != 128))
+ if ((m_parse_params.Profile() <= 2 && m_parse_params.Level() != 1) ||
+ (m_parse_params.Profile() ==8 && m_parse_params.Level() != 128))
{
errstr << "Cannot handle Level " << m_parse_params.Level()
<< " for bitstream version " << m_parse_params.MajorVersion()
@@ -180,7 +180,7 @@ void ParseParamsByteIO::CheckLevel()
}
}
- if(errstr.str().size())
+ if (errstr.str().size())
{
DiracException err(
ERR_UNSUPPORTED_STREAM_DATA,
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.h
index 04f040c2d..1e5423f31 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseparams_byteio.h
@@ -51,65 +51,65 @@
namespace dirac
{
-
-/**
-* Represents compressed parse-parameter data used in an AccessUnit
-*/
-class ParseParamsByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- *@param stream_data Destination of data
- *@param parse_params Parse parameters
- *@param enc_params Encoder parameters
- */
- ParseParamsByteIO(const ByteIO& stream_data,
- ParseParams &parse_params,
- EncoderParams &enc_params);
-
- /**
- * Constructor
- *@param stream_data Source of data
- *@param parse_params Destination of parse params
- */
- ParseParamsByteIO(const ByteIO& stream_data,
- ParseParams &parse_params);
-
- /**
- * Destructor
- */
- ~ParseParamsByteIO();
-
- /**
- * Reads parse information from Dirac byte-format
- */
- void Input();
-
- /**
- * Outputs parse information to Dirac byte-format
- */
- void Output();
-
- /**
- * Get access-unit number
- */
- int GetIdNumber() const;
-
-protected:
-
-private:
- void CheckVersion();
- void CheckProfile();
- void CheckLevel();
-
-private:
+
/**
- * Reference to parse parameters
+ * Represents compressed parse-parameter data used in an AccessUnit
*/
- ParseParams& m_parse_params;
-};
+ class ParseParamsByteIO : public ByteIO
+ {
+ public:
+
+ /**
+ * Constructor
+ *@param stream_data Destination of data
+ *@param parse_params Parse parameters
+ *@param enc_params Encoder parameters
+ */
+ ParseParamsByteIO(const ByteIO& stream_data,
+ ParseParams &parse_params,
+ EncoderParams &enc_params);
+
+ /**
+ * Constructor
+ *@param stream_data Source of data
+ *@param parse_params Destination of parse params
+ */
+ ParseParamsByteIO(const ByteIO& stream_data,
+ ParseParams &parse_params);
+
+ /**
+ * Destructor
+ */
+ ~ParseParamsByteIO();
+
+ /**
+ * Reads parse information from Dirac byte-format
+ */
+ void Input();
+
+ /**
+ * Outputs parse information to Dirac byte-format
+ */
+ void Output();
+
+ /**
+ * Get access-unit number
+ */
+ int GetIdNumber() const;
+
+ protected:
+
+ private:
+ void CheckVersion();
+ void CheckProfile();
+ void CheckLevel();
+
+ private:
+ /**
+ * Reference to parse parameters
+ */
+ ParseParams& m_parse_params;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.cpp
index 9d4ac83de..56c0ebb8b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.cpp
@@ -52,30 +52,30 @@ const int PU_NEXT_PARSE_OFFSET_SIZE = 4;
const int PU_PREVIOUS_PARSE_OFFSET_SIZE = 4;
const int PU_PREFIX_SIZE = 4;
const int PU_PARSE_CODE_SIZE = 1;
-const int PU_PARSEUNIT_SIZE = PU_NEXT_PARSE_OFFSET_SIZE + PU_PREVIOUS_PARSE_OFFSET_SIZE +
+const int PU_PARSEUNIT_SIZE = PU_NEXT_PARSE_OFFSET_SIZE + PU_PREVIOUS_PARSE_OFFSET_SIZE+
PU_PREFIX_SIZE + PU_PARSE_CODE_SIZE;
ParseUnitByteIO::ParseUnitByteIO():
- ByteIO(),
- m_previous_parse_offset(0),
- m_next_parse_offset(0)
+ByteIO(),
+m_previous_parse_offset(0),
+m_next_parse_offset(0)
{
}
ParseUnitByteIO::ParseUnitByteIO(const ByteIO& byte_io):
- ByteIO(byte_io),
- m_previous_parse_offset(0),
- m_next_parse_offset(0)
+ByteIO(byte_io),
+m_previous_parse_offset(0),
+m_next_parse_offset(0)
{
}
ParseUnitByteIO::ParseUnitByteIO(const ParseUnitByteIO& parseunit_byteio):
- ByteIO(parseunit_byteio),
- m_previous_parse_offset(parseunit_byteio.m_previous_parse_offset),
- m_next_parse_offset(parseunit_byteio.m_next_parse_offset),
- m_parse_code(parseunit_byteio.m_parse_code)
+ByteIO(parseunit_byteio),
+m_previous_parse_offset(parseunit_byteio.m_previous_parse_offset),
+m_next_parse_offset(parseunit_byteio.m_next_parse_offset),
+m_parse_code(parseunit_byteio.m_parse_code)
{
}
@@ -113,16 +113,16 @@ bool ParseUnitByteIO::Input()
bool ParseUnitByteIO::IsValid()
{
- if(IsEndOfSequence())
+ if (IsEndOfSequence())
return true;
// Skip past the end of current parse unit
- SeekGet(m_next_parse_offset - GetSize(), ios_base::cur);
+ SeekGet(m_next_parse_offset-GetSize(), ios_base::cur);
// check the next series of bytes are the parse-info prefix
string prefix = InputUnString(PU_PREFIX_SIZE);
- if(prefix == PU_PREFIX)
+ if(prefix==PU_PREFIX)
{
unsigned char next_parse_code;
@@ -133,28 +133,28 @@ bool ParseUnitByteIO::IsValid()
int next_unit_previous_parse_offset;
next_unit_previous_parse_offset = ReadUintLit(PU_PREVIOUS_PARSE_OFFSET_SIZE);
- if(next_unit_previous_parse_offset == m_next_parse_offset)
+ if (next_unit_previous_parse_offset == m_next_parse_offset)
{
- SeekGet(-(m_next_parse_offset - GetSize() + PU_PARSEUNIT_SIZE), ios_base::cur);
+ SeekGet(-(m_next_parse_offset-GetSize()+PU_PARSEUNIT_SIZE), ios_base::cur);
return true;
}
}
- SeekGet(-(m_next_parse_offset - GetSize()), ios_base::cur);
+ SeekGet(-(m_next_parse_offset-GetSize()), ios_base::cur);
return false;
}
bool ParseUnitByteIO::CanSkip()
{
- if(m_next_parse_offset == 0 || m_next_parse_offset == GetSize())
+ if(m_next_parse_offset==0 || m_next_parse_offset == GetSize())
return true;
// Skip past the end of current parse unit and past the header of the
// next unit
- SeekGet(m_next_parse_offset - GetSize() + GetSize(), ios_base::cur);
+ SeekGet(m_next_parse_offset-GetSize() + GetSize(), ios_base::cur);
if(GetReadBytePosition() >= 0)
{
- SeekGet(-(m_next_parse_offset - GetSize() + GetSize()), ios_base::cur);
- return true; // success
+ SeekGet(-(m_next_parse_offset-GetSize() + GetSize()), ios_base::cur);
+ return true; // success
}
// end of stream reached
@@ -171,15 +171,15 @@ const string ParseUnitByteIO::GetBytes()
//FIXME : Need to do this properly.
// Write the parse offsets in Big Endian format
- for(int i = PU_NEXT_PARSE_OFFSET_SIZE - 1; i >= 0; --i)
+ for(int i=PU_NEXT_PARSE_OFFSET_SIZE-1; i >= 0; --i)
{
- unsigned char cp = (m_next_parse_offset >> (i * 8)) & 0xff;
+ unsigned char cp = (m_next_parse_offset>>(i*8)) & 0xff;
parse_string << cp;
}
- for(int i = PU_PREVIOUS_PARSE_OFFSET_SIZE - 1; i >= 0; --i)
+ for(int i=PU_PREVIOUS_PARSE_OFFSET_SIZE-1; i >= 0; --i)
{
- unsigned char cp = (m_previous_parse_offset >> (i * 8)) & 0xff;
+ unsigned char cp = (m_previous_parse_offset>>(i*8)) & 0xff;
parse_string << cp;
}
@@ -251,32 +251,32 @@ int ParseUnitByteIO::CalcNextUnitOffset()
bool ParseUnitByteIO::SyncToUnitStart()
{
- // locate parse-unit prefix
+ // locate parse-unit prefix
string byte_buffer;
- while(CanRead() == true && mp_stream->tellg() >= 0)
+ while(CanRead()==true && mp_stream->tellg() >= 0)
{
// ensure current buffer length
if((int)byte_buffer.size() == PU_PREFIX_SIZE)
{
- byte_buffer.assign(byte_buffer.substr(1, PU_PREFIX_SIZE - 1));
+ byte_buffer.assign(byte_buffer.substr(1,PU_PREFIX_SIZE-1));
}
// read next byte
byte_buffer.push_back(InputUnByte());
//look to see if we have prefix
- if(byte_buffer == PU_PREFIX)
+ if(byte_buffer==PU_PREFIX)
{
// check we can read a parse-unit
//int prev_pos = mp_stream->tellg();
- mp_stream->seekg(PU_PARSEUNIT_SIZE - PU_PREFIX_SIZE, ios_base::cur);
+ mp_stream->seekg (PU_PARSEUNIT_SIZE-PU_PREFIX_SIZE, ios_base::cur);
int cur_pos = mp_stream->tellg();
- if(cur_pos < 0) // past end of stream
+ if (cur_pos < 0) // past end of stream
{
mp_stream->clear();
return false;
}
- mp_stream->seekg(-(PU_PARSEUNIT_SIZE - PU_PREFIX_SIZE), ios_base::cur);
+ mp_stream->seekg(-(PU_PARSEUNIT_SIZE-PU_PREFIX_SIZE), ios_base::cur);
return true;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.h
index ab015d1fe..8d7742afa 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/parseunit_byteio.h
@@ -53,216 +53,193 @@
namespace dirac
{
-/* Types of parse-unit */
-typedef enum
-{
- PU_SEQ_HEADER = 0,
- PU_PICTURE,
- PU_END_OF_SEQUENCE,
- PU_AUXILIARY_DATA,
- PU_PADDING_DATA,
- PU_CORE_PICTURE,
- PU_LOW_DELAY_PICTURE,
- PU_UNDEFINED
-} ParseUnitType;
-
-/**
-* Represents a collection of data in a Dirac bytestream that can be parsed as a
-* self-contained unit
-*/
-class ParseUnitByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- */
- ParseUnitByteIO();
-
- /**
- * Constructor
- *@param byte_io Stream parameters
- */
- ParseUnitByteIO(const ByteIO& byte_io);
-
- /**
- * Constructor
- *@param parseunit_byteio Parse-unit parameters
- */
- ParseUnitByteIO(const ParseUnitByteIO& parseunit_byteio);
-
- /**
- * Destructor
- */
- ~ParseUnitByteIO();
-
- /**
- * Gathers byte stats on the parse-unit data
- *@param dirac_byte_stats Stat container
- */
- virtual void CollateByteStats(DiracByteStats& dirac_byte_stats);
-
- /**
- * Reads from byte-stream to find parse data
- *@return <B>false</B> if not enough data in stream
- */
- bool Input(); // decoding
-
- /**
- * Accesses validity of a unit by comparing it with an adjacent unit
- */
- bool IsValid();
-
- /**
- * Can Skip past the entire parse-unit
- *@return <B>false</B> Nothing to skip to
- */
- bool CanSkip();
-
- /**
- * Gets string containing coded bytes
- */
- virtual const std::string GetBytes(); // encoding
-
- /**
- * Set next/previous parse-unit values
- *@param p_prev_parseunit Previous parse-unit
- */
- void SetAdjacentParseUnits(ParseUnitByteIO *p_prev_parseunit); // encoding
-
- /*
- * Gets number of bytes input/output within unit
- */
- virtual int GetSize() const;
-
- /**
- * Gets expected number of bytes to start of next parse-unit
- */
- int GetNextParseOffset() const;
-
- /**
- * Gets number of bytes to start of previous parse-unit
- */
- int GetPreviousParseOffset() const;
-
- /**
- * Gets parse-unit type
- */
- virtual ParseUnitType GetType() const;
-
- /**
- * Returns true is parse unit is a Sequence Header
- */
- bool IsSeqHeader() const
- {
- return m_parse_code == 0x00;
- }
-
- /**
- * Returns true is parse unit is an End of Sequence unit
- */
- bool IsEndOfSequence() const
- {
- return m_parse_code == 0x10;
- }
-
- /**
- * Returns true is parse unit is Auxiliary Data
- */
- bool IsAuxiliaryData() const
- {
- return (m_parse_code & 0xF8) == 0x20;
- }
-
- /**
- * Returns true is parse unit is Padding data
- */
- bool IsPaddingData() const
- {
- return m_parse_code == 0x30;
- }
-
- /**
- * Returns true is parse unit is Picture data
- */
- bool IsPicture() const
- {
- return ((m_parse_code & 0x08) == 0x08);
- }
-
- /**
- * Returns true is parse unit is Low Delay Sybtax unit
- */
- bool IsLowDelay() const
- {
- return ((m_parse_code & 0x88) == 0x88);
- }
-
- /**
- * Returns true is parse unit is Core syntax unit
- */
- bool IsCoreSyntax() const
- {
- return ((m_parse_code & 0x88) == 0x08);
- }
-
- /**
- * Returns true is parse unit uses Arithmetic coding
- */
- bool IsUsingAC() const
+ /* Types of parse-unit */
+ typedef enum {
+ PU_SEQ_HEADER=0,
+ PU_PICTURE,
+ PU_END_OF_SEQUENCE,
+ PU_AUXILIARY_DATA,
+ PU_PADDING_DATA,
+ PU_CORE_PICTURE,
+ PU_LOW_DELAY_PICTURE,
+ PU_UNDEFINED
+ } ParseUnitType;
+
+ /**
+ * Represents a collection of data in a Dirac bytestream that can be parsed as a
+ * self-contained unit
+ */
+ class ParseUnitByteIO : public ByteIO
{
- return ((m_parse_code & 0x48) == 0x08);
- }
-
-protected:
-
- /**
- * Calculates number of bytes to start of next unit
- *@return Number of bytes to next unit
- */
- virtual int CalcNextUnitOffset();
-
- /**
- * Pure virtual method for calculating parse-code
- *@return Char containing bit-set for parse-unit parameters
- */
- virtual unsigned char CalcParseCode() const
- {
- return 0; // encoding
- }
-
- /**
- * Locates start of parse-unit
- *@return <B>false</B> if not enough data
- */
- bool SyncToUnitStart(); // decoding
-
- /**
- * Get parse code
- */
- unsigned char GetParseCode() const
- {
- return m_parse_code;
- }
-
-private:
-
- /**
- * Number of bytes to next parse-unit
- */
- int m_previous_parse_offset;
-
- /**
- * Number of bytes to previous parse-unit
- */
- int m_next_parse_offset;
-
- /**
- * Parse-type-identifier
- */
- unsigned char m_parse_code;
-
-};
+ public:
+
+ /**
+ * Constructor
+ */
+ ParseUnitByteIO();
+
+ /**
+ * Constructor
+ *@param byte_io Stream parameters
+ */
+ ParseUnitByteIO(const ByteIO& byte_io);
+
+ /**
+ * Constructor
+ *@param parseunit_byteio Parse-unit parameters
+ */
+ ParseUnitByteIO(const ParseUnitByteIO& parseunit_byteio);
+
+ /**
+ * Destructor
+ */
+ ~ParseUnitByteIO();
+
+ /**
+ * Gathers byte stats on the parse-unit data
+ *@param dirac_byte_stats Stat container
+ */
+ virtual void CollateByteStats(DiracByteStats& dirac_byte_stats);
+
+ /**
+ * Reads from byte-stream to find parse data
+ *@return <B>false</B> if not enough data in stream
+ */
+ bool Input(); // decoding
+
+ /**
+ * Accesses validity of a unit by comparing it with an adjacent unit
+ */
+ bool IsValid();
+
+ /**
+ * Can Skip past the entire parse-unit
+ *@return <B>false</B> Nothing to skip to
+ */
+ bool CanSkip();
+
+ /**
+ * Gets string containing coded bytes
+ */
+ virtual const std::string GetBytes(); // encoding
+
+ /**
+ * Set next/previous parse-unit values
+ *@param p_prev_parseunit Previous parse-unit
+ */
+ void SetAdjacentParseUnits(ParseUnitByteIO *p_prev_parseunit); // encoding
+
+ /*
+ * Gets number of bytes input/output within unit
+ */
+ virtual int GetSize() const;
+
+ /**
+ * Gets expected number of bytes to start of next parse-unit
+ */
+ int GetNextParseOffset() const;
+
+ /**
+ * Gets number of bytes to start of previous parse-unit
+ */
+ int GetPreviousParseOffset() const;
+
+ /**
+ * Gets parse-unit type
+ */
+ virtual ParseUnitType GetType() const;
+
+ /**
+ * Returns true is parse unit is a Sequence Header
+ */
+ bool IsSeqHeader() const
+ { return m_parse_code==0x00; }
+
+ /**
+ * Returns true is parse unit is an End of Sequence unit
+ */
+ bool IsEndOfSequence() const
+ { return m_parse_code==0x10; }
+
+ /**
+ * Returns true is parse unit is Auxiliary Data
+ */
+ bool IsAuxiliaryData() const
+ { return (m_parse_code&0xF8)==0x20; }
+
+ /**
+ * Returns true is parse unit is Padding data
+ */
+ bool IsPaddingData() const
+ { return m_parse_code==0x30; }
+
+ /**
+ * Returns true is parse unit is Picture data
+ */
+ bool IsPicture() const
+ { return ((m_parse_code&0x08)==0x08); }
+
+ /**
+ * Returns true is parse unit is Low Delay Sybtax unit
+ */
+ bool IsLowDelay() const
+ { return ((m_parse_code&0x88)==0x88); }
+
+ /**
+ * Returns true is parse unit is Core syntax unit
+ */
+ bool IsCoreSyntax() const
+ { return ((m_parse_code&0x88)==0x08); }
+
+ /**
+ * Returns true is parse unit uses Arithmetic coding
+ */
+ bool IsUsingAC() const
+ { return ((m_parse_code&0x48)==0x08); }
+
+ protected:
+
+ /**
+ * Calculates number of bytes to start of next unit
+ *@return Number of bytes to next unit
+ */
+ virtual int CalcNextUnitOffset();
+
+ /**
+ * Pure virtual method for calculating parse-code
+ *@return Char containing bit-set for parse-unit parameters
+ */
+ virtual unsigned char CalcParseCode() const { return 0;} // encoding
+
+ /**
+ * Locates start of parse-unit
+ *@return <B>false</B> if not enough data
+ */
+ bool SyncToUnitStart(); // decoding
+
+ /**
+ * Get parse code
+ */
+ unsigned char GetParseCode() const { return m_parse_code;}
+
+ private:
+
+ /**
+ * Number of bytes to next parse-unit
+ */
+ int m_previous_parse_offset;
+
+ /**
+ * Number of bytes to previous parse-unit
+ */
+ int m_next_parse_offset;
+
+ /**
+ * Parse-type-identifier
+ */
+ unsigned char m_parse_code;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.cpp
index 06b52aa62..23231bea7 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.cpp
@@ -54,37 +54,37 @@ const int CODE_VLC_ENTROPY_CODING_BIT = 6;
const unsigned int MAX_NUM_REFS = 2;
PictureByteIO::PictureByteIO(PictureParams& frame_params,
- int frame_num) :
- ParseUnitByteIO(),
- m_frame_params(frame_params),
- m_frame_num(frame_num),
- m_mv_data(0),
- m_transform_data(0)
+ int frame_num) :
+ParseUnitByteIO(),
+m_frame_params(frame_params),
+m_frame_num(frame_num),
+m_mv_data(0),
+m_transform_data(0)
{
-
+
}
PictureByteIO::PictureByteIO(PictureParams& frame_params,
- const ParseUnitByteIO& parseunit_byteio):
- ParseUnitByteIO(parseunit_byteio),
- m_frame_params(frame_params),
- m_frame_num(0),
- m_mv_data(0),
- m_transform_data(0)
+ const ParseUnitByteIO& parseunit_byteio ):
+ParseUnitByteIO(parseunit_byteio),
+m_frame_params(frame_params),
+m_frame_num(0),
+m_mv_data(0),
+m_transform_data(0)
{
-
+
}
PictureByteIO::~PictureByteIO()
{
//delete block data
- if(m_mv_data)
+ if (m_mv_data)
{
delete m_mv_data;
m_mv_data = 0;
}
- if(m_transform_data)
+ if (m_transform_data)
{
delete m_transform_data;
m_transform_data = 0;
@@ -110,13 +110,13 @@ bool PictureByteIO::Input()
// Use of VLC for entropy coding is supported for
// intra frames only
- if(m_frame_params.GetPictureType() == INTER_PICTURE &&
- m_frame_params.UsingAC() == false)
+ if (m_frame_params.GetPictureType() == INTER_PICTURE &&
+ m_frame_params.UsingAC() == false)
{
DIRAC_THROW_EXCEPTION(
- ERR_UNSUPPORTED_STREAM_DATA,
- "VLC codes for entropy coding of coefficient data supported for Intra frames only",
- SEVERITY_PICTURE_ERROR);
+ ERR_UNSUPPORTED_STREAM_DATA,
+ "VLC codes for entropy coding of coefficient data supported for Intra frames only",
+ SEVERITY_PICTURE_ERROR);
}
// input picture number
@@ -125,10 +125,10 @@ bool PictureByteIO::Input()
// input reference Picture numbers
InputReferencePictures();
-
+
// input retired Picture numbers list
m_frame_params.SetRetiredPictureNum(-1);
- if(IsRef())
+ if (IsRef())
InputRetiredPicture();
// byte align
@@ -137,7 +137,7 @@ bool PictureByteIO::Input()
return true;
}
-const string PictureByteIO::GetBytes()
+const string PictureByteIO::GetBytes()
{
// Write mv data
if(m_frame_params.PicSort().IsInter() && m_mv_data)
@@ -146,7 +146,7 @@ const string PictureByteIO::GetBytes()
}
// Write transform header
- if(m_transform_data)
+ if (m_transform_data)
{
OutputBytes(m_transform_data->GetBytes());
}
@@ -156,15 +156,15 @@ const string PictureByteIO::GetBytes()
int PictureByteIO::GetSize() const
{
int size = 0;
- if(m_mv_data)
+ if (m_mv_data)
size += m_mv_data->GetSize();
- if(m_transform_data)
+ if (m_transform_data)
size += m_transform_data->GetSize();
//std::cerr << "Picture Header Size=" << ByteIO::GetSize();
//std::cerr << "Data Size=" << size << std::endl;
- return size + ParseUnitByteIO::GetSize() + ByteIO::GetSize();
+ return size+ParseUnitByteIO::GetSize()+ByteIO::GetSize();
}
void PictureByteIO::Output()
@@ -172,23 +172,23 @@ void PictureByteIO::Output()
// output picture number
WriteUintLit(m_frame_num, PP_PICTURE_NUM_SIZE);
- if(m_frame_params.GetPictureType() == INTER_PICTURE)
+ if(m_frame_params.GetPictureType()==INTER_PICTURE)
{
// output reference picture numbers
const std::vector<int>& refs = m_frame_params.Refs();
- for(size_t i = 0; i < refs.size() && i < MAX_NUM_REFS; ++i)
+ for(size_t i=0; i < refs.size() && i < MAX_NUM_REFS; ++i)
WriteSint(refs[i] - m_frame_num);
}
// output retired picture
- ASSERTM(m_frame_params.GetReferenceType() == REFERENCE_PICTURE || m_frame_params.RetiredPictureNum() == -1, "Only Reference frames can retire frames");
+ ASSERTM (m_frame_params.GetReferenceType() == REFERENCE_PICTURE || m_frame_params.RetiredPictureNum() == -1, "Only Reference frames can retire frames");
if(m_frame_params.GetReferenceType() == REFERENCE_PICTURE)
{
- if(m_frame_params.RetiredPictureNum() == -1)
+ if (m_frame_params.RetiredPictureNum() == -1)
WriteSint(0);
else
{
- WriteSint(m_frame_params.RetiredPictureNum() - m_frame_num);
+ WriteSint (m_frame_params.RetiredPictureNum() - m_frame_num);
}
}
// byte align output
@@ -198,14 +198,14 @@ void PictureByteIO::Output()
//-------------private-------------------------------------------------------
-
+
unsigned char PictureByteIO::CalcParseCode() const
{
unsigned char code = 0;
int num_refs = m_frame_params.Refs().size();
- if(m_frame_params.GetPictureType() == INTER_PICTURE)
+ if(m_frame_params.GetPictureType()==INTER_PICTURE)
{
// set number of refs
if(num_refs == 1)
@@ -214,42 +214,42 @@ unsigned char PictureByteIO::CalcParseCode() const
SetBit(code, CODE_TWO_REF_BIT);
}
// set ref type
- if(m_frame_params.GetReferenceType() == REFERENCE_PICTURE)
+ if(m_frame_params.GetReferenceType()==REFERENCE_PICTURE)
SetBit(code, CODE_REF_PICTURE_BIT);
// Set parse unit type
SetBit(code, CODE_PUTYPE_1_BIT);
// Set Entropy Coding type
- if(!m_frame_params.UsingAC())
+ if (!m_frame_params.UsingAC())
{
SetBit(code, CODE_VLC_ENTROPY_CODING_BIT);
}
return code;
-
+
}
-void PictureByteIO::InputReferencePictures()
+void PictureByteIO::InputReferencePictures()
{
// get number of frames referred to
- int ref_count = NumRefs();
+ int ref_count = NumRefs();
- // get the number of these frames
+ // get the number of these frames
vector<int>& refs = m_frame_params.Refs();
refs.resize(ref_count);
- for(int i = 0; i < ref_count; ++i)
- refs[i] = m_frame_num + ReadSint();
+ for(int i=0; i < ref_count; ++i)
+ refs[i]=m_frame_num+ReadSint();
}
-
-void PictureByteIO::InputRetiredPicture()
+
+void PictureByteIO::InputRetiredPicture()
{
TESTM(IsRef(), "Retired Picture offset only set for Reference Frames");
// input retired picture offset
int offset = ReadSint();
// input retired frames
- if(offset)
+ if (offset)
{
m_frame_params.SetRetiredPictureNum(m_frame_num + offset);
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.h
index 1fcd0cb9c..bdca76f40 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/picture_byteio.h
@@ -54,178 +54,154 @@
namespace dirac
{
-/**
-* A compressed picture in Dirac bytestream format
-*/
-class PictureByteIO : public ParseUnitByteIO
-{
-public:
-
- /**
- * Constructor
- *@param frame_params Picture parameters
- *@param frame_num Picture number
- */
- PictureByteIO(PictureParams& frame_params,
- int frame_num);
-
-
- /**
- * Constructor
- *@param frame_params Destination of data
- *@param parseunit_byteio Source of data
- */
- PictureByteIO(PictureParams& frame_params,
- const ParseUnitByteIO& parseunit_byteio);
-
- /**
- * Destructor
- */
- virtual ~PictureByteIO();
-
- /**
- * Gathers byte stats on the picture data
- *@param dirac_byte_stats Stat container
- */
- void CollateByteStats(DiracByteStats& dirac_byte_stats);
-
- /**
- * Inputs data from Dirac stream-format
- */
- bool Input();
-
- /**
- * Outputs picture values to Dirac stream-format
- */
- void Output();
-
-
-
- const std::string GetBytes();
-
- int GetSize() const;
-
- /**
- * Gets parse-unit type
- */
- ParseUnitType GetType() const
- {
- return PU_PICTURE;
- }
-
- /**
- * Returns true is picture in Reference picture
- */
- int IsRef() const
- {
- return (GetParseCode() & 0x0C) == 0x0C;
- }
-
- /**
- * Returns true is picture in Non-Reference picture
- */
- int IsNonRef() const
- {
- return (GetParseCode() & 0x0C) == 0x08;
- }
-
- /**
- * Gets parse-unit type
- */
- int NumRefs() const
- {
- return (GetParseCode() & 0x03);
- }
-
- /**
- * Returns true is picture is Intra picture
- */
- bool IsIntra() const
- {
- return IsPicture() && (NumRefs() == 0) ;
- }
-
/**
- * Returns true is picture is Inter picture
- */
- bool IsInter() const
- {
- return IsPicture() && (NumRefs() > 0) ;
- }
-
- /***
- * Sets the MVDataIO
+ * A compressed picture in Dirac bytestream format
*/
- void SetMvData(MvDataByteIO *mv_data)
+ class PictureByteIO : public ParseUnitByteIO
{
- m_mv_data = mv_data;
- }
-
- /***
- * Sets the TransformByteIo
- */
- void SetTransformData(TransformByteIO *transform_data)
- {
- m_transform_data = transform_data;
- }
-
-protected:
-
-
-private:
-
- /**
- * Calculates parse-code based on picture parameters
- *@return Char bit-set
- */
- unsigned char CalcParseCode() const;
-
- /**
- * Reads reference-picture data
- */
- void InputReferencePictures();
-
- /**
- * Reads retired picture number
- */
- void InputRetiredPicture();
-
- /**
- * Calculates picture-type (eg INTRA/INTER) of picture
- */
- void SetPictureType();
-
- /**
- * Calculates reference-type of picture
- */
- void SetReferenceType();
-
- /**
- * Sets the entropy coding flag in the picture parameters
- */
- void SetEntropyCodingFlag();
-
- /**
- * Picture parameters
- */
- PictureParams& m_frame_params;
-
- /**
- * Picture number
- */
- int m_frame_num;
-
- /**
- * MV data
- */
- MvDataByteIO * m_mv_data;
-
- /**
- * Transform data
- */
- TransformByteIO * m_transform_data;
-
-};
+ public:
+
+ /**
+ * Constructor
+ *@param frame_params Picture parameters
+ *@param frame_num Picture number
+ */
+ PictureByteIO(PictureParams& frame_params,
+ int frame_num);
+
+
+ /**
+ * Constructor
+ *@param frame_params Destination of data
+ *@param parseunit_byteio Source of data
+ */
+ PictureByteIO(PictureParams& frame_params,
+ const ParseUnitByteIO& parseunit_byteio);
+
+ /**
+ * Destructor
+ */
+ virtual ~PictureByteIO();
+
+ /**
+ * Gathers byte stats on the picture data
+ *@param dirac_byte_stats Stat container
+ */
+ void CollateByteStats(DiracByteStats& dirac_byte_stats);
+
+ /**
+ * Inputs data from Dirac stream-format
+ */
+ bool Input();
+
+ /**
+ * Outputs picture values to Dirac stream-format
+ */
+ void Output();
+
+
+
+ const std::string GetBytes();
+
+ int GetSize() const;
+
+ /**
+ * Gets parse-unit type
+ */
+ ParseUnitType GetType() const { return PU_PICTURE;}
+
+ /**
+ * Returns true is picture in Reference picture
+ */
+ int IsRef() const { return (GetParseCode()&0x0C)==0x0C;}
+
+ /**
+ * Returns true is picture in Non-Reference picture
+ */
+ int IsNonRef() const { return (GetParseCode()&0x0C)==0x08;}
+
+ /**
+ * Gets parse-unit type
+ */
+ int NumRefs() const { return (GetParseCode()&0x03);}
+
+ /**
+ * Returns true is picture is Intra picture
+ */
+ bool IsIntra() const { return IsPicture() && (NumRefs()==0) ; }
+
+ /**
+ * Returns true is picture is Inter picture
+ */
+ bool IsInter() const { return IsPicture() && (NumRefs()>0) ; }
+
+ /***
+ * Sets the MVDataIO
+ */
+ void SetMvData(MvDataByteIO *mv_data) {m_mv_data = mv_data; }
+
+ /***
+ * Sets the TransformByteIo
+ */
+ void SetTransformData(TransformByteIO *transform_data) {m_transform_data = transform_data; }
+
+ protected:
+
+
+ private:
+
+ /**
+ * Calculates parse-code based on picture parameters
+ *@return Char bit-set
+ */
+ unsigned char CalcParseCode() const;
+
+ /**
+ * Reads reference-picture data
+ */
+ void InputReferencePictures();
+
+ /**
+ * Reads retired picture number
+ */
+ void InputRetiredPicture();
+
+ /**
+ * Calculates picture-type (eg INTRA/INTER) of picture
+ */
+ void SetPictureType();
+
+ /**
+ * Calculates reference-type of picture
+ */
+ void SetReferenceType();
+
+ /**
+ * Sets the entropy coding flag in the picture parameters
+ */
+ void SetEntropyCodingFlag();
+
+ /**
+ * Picture parameters
+ */
+ PictureParams& m_frame_params;
+
+ /**
+ * Picture number
+ */
+ int m_frame_num;
+
+ /**
+ * MV data
+ */
+ MvDataByteIO * m_mv_data;
+
+ /**
+ * Transform data
+ */
+ TransformByteIO * m_transform_data;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.cpp
index 41b6fcb66..63d0607b9 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.cpp
@@ -42,19 +42,19 @@ using namespace std;
SubbandByteIO::SubbandByteIO(Subband& sub_band,
const ByteIO& byteio):
- ByteIO(byteio),
- m_subband(sub_band),
- m_band_data_length(0)
+ByteIO(byteio),
+m_subband(sub_band),
+m_band_data_length(0)
{
-
+
}
SubbandByteIO::SubbandByteIO(Subband& sub_band):
- ByteIO(),
- m_subband(sub_band),
- m_band_data_length(0)
+ByteIO(),
+m_subband(sub_band),
+m_band_data_length(0)
{
-
+
}
SubbandByteIO::~SubbandByteIO()
@@ -70,7 +70,7 @@ bool SubbandByteIO::Input()
m_band_data_length = ReadUint();
// set skip flag if no data
- m_subband.SetSkip(m_band_data_length == 0 ? true : false);
+ m_subband.SetSkip(m_band_data_length==0 ? true : false);
// check for zero-length sub-band
if(m_subband.Skipped())
@@ -79,16 +79,16 @@ bool SubbandByteIO::Input()
return true;
}
- // If we're not skipped, we need a quantisation index for the subband
- m_subband.SetQuantIndex(ReadUint());
+ // If we're not skipped, we need a quantisation index for the subband
+ m_subband.SetQuantIndex(ReadUint() );
- if(!m_subband.UsingMultiQuants())
+ if ( !m_subband.UsingMultiQuants() )
{
- // Propogate the quantiser index to all the code blocks if we
+ // Propogate the quantiser index to all the code blocks if we
// don't have multiquants
- for(int j = 0 ; j < m_subband.GetCodeBlocks().LengthY() ; ++j)
- for(int i = 0 ; i < m_subband.GetCodeBlocks().LengthX() ; ++i)
- m_subband.GetCodeBlocks()[j][i].SetQuantIndex(m_subband.QuantIndex());
+ for ( int j=0 ; j<m_subband.GetCodeBlocks().LengthY() ; ++j )
+ for ( int i=0 ; i<m_subband.GetCodeBlocks().LengthX() ; ++i )
+ m_subband.GetCodeBlocks()[j][i].SetQuantIndex( m_subband.QuantIndex() );
}
// byte align
@@ -98,12 +98,12 @@ bool SubbandByteIO::Input()
return true;
}
-int SubbandByteIO::GetBandDataLength() const
+int SubbandByteIO::GetBandDataLength() const
{
return m_band_data_length;
}
-const string SubbandByteIO::GetBytes()
+const string SubbandByteIO::GetBytes()
{
ByteIO byte_io;
@@ -113,7 +113,7 @@ const string SubbandByteIO::GetBytes()
byte_io.WriteUint(GetSize());
// check for zero-length sub-band
- if(GetSize() == 0)
+ if(GetSize()==0)
{
byte_io.ByteAlignOutput();
return byte_io.GetBytes();
@@ -128,10 +128,10 @@ const string SubbandByteIO::GetBytes()
//std::cerr << "Subband hdr size=" << byte_io.GetSize();
//std::cerr << " Arithdata size=" << this->GetSize()<< std::endl;
- return byte_io.GetBytes() + ByteIO::GetBytes();
+ return byte_io.GetBytes()+ByteIO::GetBytes();
}
//-------------private-------------------------------------------------------
-
+
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.h
index ad8460c6b..88d03cf87 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/subband_byteio.h
@@ -50,65 +50,65 @@
namespace dirac
{
-/**
-* Subband Dirac-bytestream input/output
-*/
-class SubbandByteIO : public ByteIO
-{
-public:
-
- /**
- * Constructor
- *@param sub_band Corresponding Subband
- *@param byteio Source/Destination of data
- */
- SubbandByteIO(Subband& sub_band,
- const ByteIO& byteio);
-
-
- /* Constructor
- *@param sub_band Corresponding Subband
- *@param byteio Source/Destination of data
- */
- SubbandByteIO(Subband& sub_band);
-
- /**
- * Destructor
- */
- ~SubbandByteIO();
-
- /**
- * Inputs data from Dirac stream-format
- */
- bool Input();
-
-
- /**
- * Gets number of bytes in Arith-coded data block
- */
- int GetBandDataLength() const;
-
- /**
- * Gets subband bytes in Dirac-bytestream format
- */
- const std::string GetBytes();
-
-
-protected:
-
-
-private:
-
- /**
- * Sub-band that is inputed/outputed
- */
- Subband& m_subband;
-
/**
- * Number of bytes in arith-coded data block
+ * Subband Dirac-bytestream input/output
*/
- int m_band_data_length;
-};
+ class SubbandByteIO : public ByteIO
+ {
+ public:
+
+ /**
+ * Constructor
+ *@param sub_band Corresponding Subband
+ *@param byteio Source/Destination of data
+ */
+ SubbandByteIO(Subband& sub_band,
+ const ByteIO& byteio);
+
+
+ /* Constructor
+ *@param sub_band Corresponding Subband
+ *@param byteio Source/Destination of data
+ */
+ SubbandByteIO(Subband& sub_band);
+
+ /**
+ * Destructor
+ */
+ ~SubbandByteIO();
+
+ /**
+ * Inputs data from Dirac stream-format
+ */
+ bool Input();
+
+
+ /**
+ * Gets number of bytes in Arith-coded data block
+ */
+ int GetBandDataLength() const;
+
+ /**
+ * Gets subband bytes in Dirac-bytestream format
+ */
+ const std::string GetBytes();
+
+
+ protected:
+
+
+ private:
+
+ /**
+ * Sub-band that is inputed/outputed
+ */
+ Subband& m_subband;
+
+ /**
+ * Number of bytes in arith-coded data block
+ */
+ int m_band_data_length;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.cpp
index 918b781fe..6eba5a31d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.cpp
@@ -43,57 +43,57 @@ using namespace dirac;
TransformByteIO::TransformByteIO(PictureParams& fparams,
CodecParams& cparams):
- ByteIO(),
- m_fparams(fparams),
- m_cparams(cparams),
- m_default_cparams(cparams.GetVideoFormat(), fparams.GetPictureType(), fparams.Refs().size(), true)
+ByteIO(),
+m_fparams(fparams),
+m_cparams(cparams),
+m_default_cparams(cparams.GetVideoFormat(), fparams.GetPictureType(), fparams.Refs().size(), true)
{
}
TransformByteIO::TransformByteIO(ByteIO &byte_io,
PictureParams& fparams,
CodecParams& cparams):
- ByteIO(byte_io),
- m_fparams(fparams),
- m_cparams(cparams),
- m_default_cparams(cparams.GetVideoFormat(), fparams.GetPictureType(), fparams.Refs().size(), true)
+ByteIO(byte_io),
+m_fparams(fparams),
+m_cparams(cparams),
+m_default_cparams(cparams.GetVideoFormat(), fparams.GetPictureType(), fparams.Refs().size(), true)
{
}
TransformByteIO::~TransformByteIO()
{
- for(size_t index = 0; index < m_component_list.size(); ++index)
- delete m_component_list[index];
+ for(size_t index=0; index < m_component_list.size(); ++index)
+ delete m_component_list[index];
}
void TransformByteIO::CollateByteStats(DiracByteStats& dirac_byte_stats)
{
// set number of component bytes
- for(size_t index = 0; index < m_component_list.size(); ++index)
+ for(size_t index=0; index < m_component_list.size(); ++index)
m_component_list[index]->CollateByteStats(dirac_byte_stats);
}
int TransformByteIO::GetSize() const
{
//std::cerr << "Transform Size=" << ByteIO::GetSize() << std::endl;
- int size = 0;
- for(size_t index = 0; index < m_component_list.size(); ++index)
+ int size=0;
+ for(size_t index=0; index < m_component_list.size(); ++index)
size += m_component_list[index]->GetSize();
- return ByteIO::GetSize() + size;
+ return ByteIO::GetSize()+size;
}
const std::string TransformByteIO::GetBytes()
{
std::string bytes;
- for(size_t index = 0; index < m_component_list.size(); ++index)
+ for(size_t index=0; index < m_component_list.size(); ++index)
bytes += m_component_list[index]->GetBytes();
- return ByteIO::GetBytes() + bytes;
+ return ByteIO::GetBytes()+bytes;
}
void TransformByteIO::Output()
{
// Zero Transform flag - applies only to inter frames
- if(m_fparams.PicSort().IsInter())
+ if (m_fparams.PicSort().IsInter())
WriteBit(false);
// Wavelet index
WriteUint(m_cparams.TransformFilter());
@@ -103,9 +103,9 @@ void TransformByteIO::Output()
// Spatial Partition flag
WriteBit(m_cparams.SpatialPartition());
- if(m_cparams.SpatialPartition())
+ if (m_cparams.SpatialPartition())
{
- for(unsigned int i = 0; i <= m_cparams.TransformDepth(); ++i)
+ for (unsigned int i = 0; i <= m_cparams.TransformDepth(); ++i)
{
const CodeBlocks &cb = m_cparams.GetCodeBlocks(i);
// Number of Horizontal code blocks for level i
@@ -127,25 +127,25 @@ void TransformByteIO::Input()
m_cparams.SetZeroTransform(false);
// Zero transform flag - applies only for inter frames
- if(m_fparams.PicSort().IsInter())
+ if (m_fparams.PicSort().IsInter())
m_cparams.SetZeroTransform(ReadBool());
- if(m_cparams.ZeroTransform())
+ if (m_cparams.ZeroTransform())
return;
// Transform filter
m_cparams.SetTransformFilter(ReadUint());
// transform depth
- m_cparams.SetTransformDepth(ReadUint());
+ m_cparams.SetTransformDepth(ReadUint());
// Spatial partition flag
m_cparams.SetSpatialPartition(ReadBool());
- if(m_cparams.SpatialPartition())
+ if (m_cparams.SpatialPartition())
{
// Input number of code blocks for each level
- for(unsigned int i = 0; i <= m_cparams.TransformDepth(); ++i)
+ for (unsigned int i = 0; i <= m_cparams.TransformDepth(); ++i)
{
// number of horizontal code blocks for level i
unsigned int hblocks = ReadUint();
@@ -162,7 +162,7 @@ void TransformByteIO::Input()
void TransformByteIO::AddComponent(ComponentByteIO* component_byteio)
{
- m_component_list.push_back(component_byteio);
+ m_component_list.push_back(component_byteio);
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.h
index 0153c8302..6fa1c0c5f 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_byteio/transform_byteio.h
@@ -52,94 +52,94 @@
namespace dirac
{
-
-/**
-* Represents compressed sequence-parameter data used in an AccessUnit
-*/
-class TransformByteIO : public ByteIO
-{
-public:
-
- /**
- * Output Constructor
- *@param fparams Picture parameters
- *@param c_params Codec params
- */
- TransformByteIO(PictureParams& fparams,
- CodecParams& c_params);
-
- /**
- * Input Constructor
- *@param byte_io ByteIO object for copy constructor
- *@param fparams Picture parameters
- *@param c_params Codec params
- */
- TransformByteIO(ByteIO &byte_io, PictureParams& fparams,
- CodecParams& c_params);
-
- /**
- * Destructor
- */
- virtual ~TransformByteIO();
-
- /**
- * Gathers byte stats on the transform data
- *@param dirac_byte_stats Stats container
- */
- void CollateByteStats(DiracByteStats& dirac_byte_stats);
-
- /**
- * Outputs sequence information to Dirac byte-format
- */
- void Output();
-
- /**
- * Outputs sequence information to Dirac byte-format
- */
- void Input();
-
-
- /**
- * Get string containing coded bytes
- */
- virtual const std::string GetBytes();
-
- /**
- * Return the size
- */
- int GetSize() const;
-
- /**
- * Adds a Picture-component in Dirac-bytestream format
- *@param component_byteio Picture-component bytestream
- */
- void AddComponent(ComponentByteIO *component_byteio);
-
-protected:
-
-
-private:
-
- /**
- * Sequence paramters for intput/output
- */
- PictureParams& m_fparams;
-
+
/**
- * Codec params - EncParams for Output and DecParams for input
- */
- CodecParams& m_cparams;
-
- /**
- * Default Codec params - EncParams for Output and DecParams for input
- */
- CodecParams m_default_cparams;
-
- /***
- * Transform Component data
+ * Represents compressed sequence-parameter data used in an AccessUnit
*/
- std::vector<ComponentByteIO *> m_component_list;
-};
+ class TransformByteIO : public ByteIO
+ {
+ public:
+
+ /**
+ * Output Constructor
+ *@param fparams Picture parameters
+ *@param c_params Codec params
+ */
+ TransformByteIO(PictureParams& fparams,
+ CodecParams& c_params);
+
+ /**
+ * Input Constructor
+ *@param byte_io ByteIO object for copy constructor
+ *@param fparams Picture parameters
+ *@param c_params Codec params
+ */
+ TransformByteIO(ByteIO &byte_io, PictureParams& fparams,
+ CodecParams& c_params);
+
+ /**
+ * Destructor
+ */
+ virtual ~TransformByteIO();
+
+ /**
+ * Gathers byte stats on the transform data
+ *@param dirac_byte_stats Stats container
+ */
+ void CollateByteStats(DiracByteStats& dirac_byte_stats);
+
+ /**
+ * Outputs sequence information to Dirac byte-format
+ */
+ void Output();
+
+ /**
+ * Outputs sequence information to Dirac byte-format
+ */
+ void Input();
+
+
+ /**
+ * Get string containing coded bytes
+ */
+ virtual const std::string GetBytes();
+
+ /**
+ * Return the size
+ */
+ int GetSize() const;
+
+ /**
+ * Adds a Picture-component in Dirac-bytestream format
+ *@param component_byteio Picture-component bytestream
+ */
+ void AddComponent(ComponentByteIO *component_byteio);
+
+ protected:
+
+
+ private:
+
+ /**
+ * Sequence paramters for intput/output
+ */
+ PictureParams& m_fparams;
+
+ /**
+ * Codec params - EncParams for Output and DecParams for input
+ */
+ CodecParams& m_cparams;
+
+ /**
+ * Default Codec params - EncParams for Output and DecParams for input
+ */
+ CodecParams m_default_cparams;
+
+ /***
+ * Transform Component data
+ */
+ std::vector<ComponentByteIO *> m_component_list;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.cpp
index 1ee3b4777..756ac19b5 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.cpp
@@ -37,139 +37,133 @@
#include <libdirac_common/arith_codec.h>
-namespace dirac
-{
-
-const unsigned int Context::lut[256] =
-{
- //LUT corresponds to window = 16 @ p0=0.5 & 8 @ p=1.0
- 0, 2, 5, 8, 11, 15, 20, 24,
- 29, 35, 41, 47, 53, 60, 67, 74,
- 82, 89, 97, 106, 114, 123, 132, 141,
- 150, 160, 170, 180, 190, 201, 211, 222,
- 233, 244, 256, 267, 279, 291, 303, 315,
- 327, 340, 353, 366, 379, 392, 405, 419,
- 433, 447, 461, 475, 489, 504, 518, 533,
- 548, 563, 578, 593, 609, 624, 640, 656,
- 672, 688, 705, 721, 738, 754, 771, 788,
- 805, 822, 840, 857, 875, 892, 910, 928,
- 946, 964, 983, 1001, 1020, 1038, 1057, 1076,
- 1095, 1114, 1133, 1153, 1172, 1192, 1211, 1231,
- 1251, 1271, 1291, 1311, 1332, 1352, 1373, 1393,
- 1414, 1435, 1456, 1477, 1498, 1520, 1541, 1562,
- 1584, 1606, 1628, 1649, 1671, 1694, 1716, 1738,
- 1760, 1783, 1806, 1828, 1851, 1874, 1897, 1920,
- 1935, 1942, 1949, 1955, 1961, 1968, 1974, 1980,
- 1985, 1991, 1996, 2001, 2006, 2011, 2016, 2021,
- 2025, 2029, 2033, 2037, 2040, 2044, 2047, 2050,
- 2053, 2056, 2058, 2061, 2063, 2065, 2066, 2068,
- 2069, 2070, 2071, 2072, 2072, 2072, 2072, 2072,
- 2072, 2071, 2070, 2069, 2068, 2066, 2065, 2063,
- 2060, 2058, 2055, 2052, 2049, 2045, 2042, 2038,
- 2033, 2029, 2024, 2019, 2013, 2008, 2002, 1996,
- 1989, 1982, 1975, 1968, 1960, 1952, 1943, 1934,
- 1925, 1916, 1906, 1896, 1885, 1874, 1863, 1851,
- 1839, 1827, 1814, 1800, 1786, 1772, 1757, 1742,
- 1727, 1710, 1694, 1676, 1659, 1640, 1622, 1602,
- 1582, 1561, 1540, 1518, 1495, 1471, 1447, 1422,
- 1396, 1369, 1341, 1312, 1282, 1251, 1219, 1186,
- 1151, 1114, 1077, 1037, 995, 952, 906, 857,
- 805, 750, 690, 625, 553, 471, 376, 255
-};
-
-ArithCodecBase::ArithCodecBase(ByteIO* p_byteio, size_t number_of_contexts):
- m_context_list(number_of_contexts),
- m_scount(0),
- m_byteio(p_byteio),
- m_decode_data_ptr(0)
-{
- // nothing needed here
-}
-
-ArithCodecBase::~ArithCodecBase()
-{
- delete[] m_decode_data_ptr;
-}
-
-
-void ArithCodecBase::InitEncoder()
-{
- // Set the m_code word stuff
- m_low_code = 0;
- m_range = 0xFFFF;
- m_underflow = 0;
-}
-
-void ArithCodecBase::FlushEncoder()
-{
-
- // Do final renormalisation and output
- while(((m_low_code + m_range - 1) ^ m_low_code) < 0x8000)
+namespace dirac{
+
+ const unsigned int Context::lut[256] = {
+ //LUT corresponds to window = 16 @ p0=0.5 & 8 @ p=1.0
+ 0, 2, 5, 8, 11, 15, 20, 24,
+ 29, 35, 41, 47, 53, 60, 67, 74,
+ 82, 89, 97, 106, 114, 123, 132, 141,
+ 150, 160, 170, 180, 190, 201, 211, 222,
+ 233, 244, 256, 267, 279, 291, 303, 315,
+ 327, 340, 353, 366, 379, 392, 405, 419,
+ 433, 447, 461, 475, 489, 504, 518, 533,
+ 548, 563, 578, 593, 609, 624, 640, 656,
+ 672, 688, 705, 721, 738, 754, 771, 788,
+ 805, 822, 840, 857, 875, 892, 910, 928,
+ 946, 964, 983, 1001, 1020, 1038, 1057, 1076,
+ 1095, 1114, 1133, 1153, 1172, 1192, 1211, 1231,
+ 1251, 1271, 1291, 1311, 1332, 1352, 1373, 1393,
+ 1414, 1435, 1456, 1477, 1498, 1520, 1541, 1562,
+ 1584, 1606, 1628, 1649, 1671, 1694, 1716, 1738,
+ 1760, 1783, 1806, 1828, 1851, 1874, 1897, 1920,
+ 1935, 1942, 1949, 1955, 1961, 1968, 1974, 1980,
+ 1985, 1991, 1996, 2001, 2006, 2011, 2016, 2021,
+ 2025, 2029, 2033, 2037, 2040, 2044, 2047, 2050,
+ 2053, 2056, 2058, 2061, 2063, 2065, 2066, 2068,
+ 2069, 2070, 2071, 2072, 2072, 2072, 2072, 2072,
+ 2072, 2071, 2070, 2069, 2068, 2066, 2065, 2063,
+ 2060, 2058, 2055, 2052, 2049, 2045, 2042, 2038,
+ 2033, 2029, 2024, 2019, 2013, 2008, 2002, 1996,
+ 1989, 1982, 1975, 1968, 1960, 1952, 1943, 1934,
+ 1925, 1916, 1906, 1896, 1885, 1874, 1863, 1851,
+ 1839, 1827, 1814, 1800, 1786, 1772, 1757, 1742,
+ 1727, 1710, 1694, 1676, 1659, 1640, 1622, 1602,
+ 1582, 1561, 1540, 1518, 1495, 1471, 1447, 1422,
+ 1396, 1369, 1341, 1312, 1282, 1251, 1219, 1186,
+ 1151, 1114, 1077, 1037, 995, 952, 906, 857,
+ 805, 750, 690, 625, 553, 471, 376, 255
+ };
+
+ ArithCodecBase::ArithCodecBase(ByteIO* p_byteio, size_t number_of_contexts):
+ m_context_list( number_of_contexts ),
+ m_scount( 0 ),
+ m_byteio(p_byteio ),
+ m_decode_data_ptr( 0 )
{
- m_byteio->WriteBit(m_low_code & 0x8000);
- for(; m_underflow > 0; m_underflow--)
- m_byteio->WriteBit(~m_low_code & 0x8000);
-
- m_low_code <<= 1;
- m_low_code &= 0xFFFF;
- m_range <<= 1;
+ // nothing needed here
}
- while((m_low_code & 0x4000) && !((m_low_code + m_range - 1) & 0x4000))
+ ArithCodecBase::~ArithCodecBase() {
+ delete[] m_decode_data_ptr; }
+
+
+ void ArithCodecBase::InitEncoder()
{
- m_underflow += 1;
- m_low_code ^= 0x4000;
- m_low_code <<= 1;
- m_low_code &= 0xFFFF;
- m_range <<= 1;
+ // Set the m_code word stuff
+ m_low_code = 0;
+ m_range = 0xFFFF;
+ m_underflow = 0;
}
- m_byteio->WriteBit(m_low_code & 0x4000);
- while(m_underflow >= 0)
+ void ArithCodecBase::FlushEncoder()
{
- m_byteio->WriteBit(~m_low_code & 0x4000);
- m_underflow -= 1;
+
+ // Do final renormalisation and output
+ while (((m_low_code+m_range-1)^m_low_code)<0x8000 )
+ {
+ m_byteio->WriteBit( m_low_code & 0x8000);
+ for (; m_underflow > 0; m_underflow-- )
+ m_byteio->WriteBit(~m_low_code & 0x8000);
+
+ m_low_code <<= 1;
+ m_low_code &= 0xFFFF;
+ m_range <<= 1;
+ }
+
+ while ( (m_low_code & 0x4000) && !((m_low_code+m_range-1) & 0x4000) )
+ {
+ m_underflow += 1;
+ m_low_code ^= 0x4000;
+ m_low_code <<= 1;
+ m_low_code &= 0xFFFF;
+ m_range <<= 1;
+ }
+
+ m_byteio->WriteBit(m_low_code & 0x4000);
+ while ( m_underflow >= 0 ) {
+ m_byteio->WriteBit(~m_low_code & 0x4000);
+ m_underflow -= 1; }
+
+ // byte align
+ m_byteio->ByteAlignOutput();
}
+
+ void ArithCodecBase::InitDecoder(int num_bytes)
+ {
+ ReadAllData(num_bytes);
+ m_input_bits_left = 8;
- // byte align
- m_byteio->ByteAlignOutput();
-}
+ m_code = 0;
+ m_low_code = 0;
-void ArithCodecBase::InitDecoder(int num_bytes)
-{
- ReadAllData(num_bytes);
- m_input_bits_left = 8;
+ m_range = 0xFFFF;
- m_code = 0;
- m_low_code = 0;
+ m_code = 0;
+ for (int i=0; i<16; ++i)
+ {
+ m_code <<= 1;
+ m_code += InputBit();
+ }
- m_range = 0xFFFF;
+ }
- m_code = 0;
- for(int i = 0; i < 16; ++i)
+ int ArithCodecBase::ByteCount() const
{
- m_code <<= 1;
- m_code += InputBit();
+ return m_byteio->GetSize();
}
-}
-
-int ArithCodecBase::ByteCount() const
-{
- return m_byteio->GetSize();
-}
-
-void ArithCodecBase::ReadAllData(int num_bytes)
-{
- if(m_decode_data_ptr)
- delete[] m_decode_data_ptr;
+ void ArithCodecBase::ReadAllData(int num_bytes)
+ {
+ if ( m_decode_data_ptr )
+ delete[] m_decode_data_ptr;
- m_decode_data_ptr = new char[num_bytes+2];
- m_byteio->InputBytes(m_decode_data_ptr , num_bytes);
- m_decode_data_ptr[num_bytes] = (char)255;
- m_decode_data_ptr[num_bytes+1] = (char)255;
+ m_decode_data_ptr = new char[num_bytes+2];
+ m_byteio->InputBytes( m_decode_data_ptr , num_bytes );
+ m_decode_data_ptr[num_bytes] = (char)255;
+ m_decode_data_ptr[num_bytes+1] = (char)255;
- m_data_ptr = m_decode_data_ptr;
-}
+ m_data_ptr = m_decode_data_ptr;
+ }
}// namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.h
index d4a47106a..72da756a4 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arith_codec.h
@@ -62,422 +62,407 @@
namespace dirac
{
-class Context
-{
-public:
-
- //! Default Constructor.
- /*!
- Default constructor initialises counts to 1 each of 0 and 1.
- */
- inline Context();
-
- //Class is POD
- //Use built in copy constructor, assignment and destructor.
-
- //! Returns estimate of probability of 0 (false) scaled to 2**16
-
- inline unsigned int GetScaledProb0() const
- {
- return m_prob0;
- }
-
- //! Updates context counts
- inline void Update(bool symbol)
- {
- if(symbol) m_prob0 -= lut[m_prob0>>8];
- else m_prob0 += lut[255-(m_prob0>>8)];
- }
-
-private:
-
- int m_prob0;
- static const unsigned int lut[256]; //Probability update table
-};
-
-Context::Context(): m_prob0(0x8000) {}
-
-class ArithCodecBase
-{
-
-public:
-
- //! Constructor
- /*!
- Creates an ArithCodec object to decode input based on a set of
- parameters.
- \param p_byteio input/output for encoded bits
- \param number_of_contexts the number of contexts used
- */
- ArithCodecBase(ByteIO* p_byteio, size_t number_of_contexts);
-
- //! Destructor
- /*!
- Destructor is virtual as this class is abstract.
- */
- virtual ~ArithCodecBase();
+ class Context {
+ public:
-protected:
+ //! Default Constructor.
+ /*!
+ Default constructor initialises counts to 1 each of 0 and 1.
+ */
+ inline Context();
- //core encode functions
- ////////////////////////////
+ //Class is POD
+ //Use built in copy constructor, assignment and destructor.
- //! Initialises the Encoder
- void InitEncoder();
+ //! Returns estimate of probability of 0 (false) scaled to 2**16
- //! encodes a symbol and writes to output
- void EncodeSymbol(const bool symbol, const int context_num);
+ inline unsigned int GetScaledProb0( ) const{ return m_prob0;}
- void EncodeUInt(const unsigned int value, const int bin1, const int max_bin);
+ //! Updates context counts
+ inline void Update( bool symbol ) {
+ if (symbol) m_prob0 -= lut[m_prob0>>8];
+ else m_prob0 += lut[255-(m_prob0>>8)];
+ }
- void EncodeSInt(const int value, const int bin1, const int max_bin);
+ private:
- //! flushes the output of the encoder.
- void FlushEncoder();
+ int m_prob0;
+ static const unsigned int lut[256]; //Probability update table
+ };
+
+ Context::Context(): m_prob0( 0x8000 ) {}
- int ByteCount() const;
+ class ArithCodecBase {
- // core decode functions
- ////////////////////////////
+ public:
- //! Initialise the Decoder
- void InitDecoder(int num_bytes);
+ //! Constructor
+ /*!
+ Creates an ArithCodec object to decode input based on a set of
+ parameters.
+ \param p_byteio input/output for encoded bits
+ \param number_of_contexts the number of contexts used
+ */
+ ArithCodecBase(ByteIO* p_byteio, size_t number_of_contexts);
- //! Decodes a symbol given a context number
- bool DecodeSymbol(int context_num);
+ //! Destructor
+ /*!
+ Destructor is virtual as this class is abstract.
+ */
+ virtual ~ArithCodecBase();
- unsigned int DecodeUInt(const int bin1, const int max_bin);
+ protected:
- int DecodeSInt(const int bin1, const int max_bin);
+ //core encode functions
+ ////////////////////////////
- //! List of contexts
- std::vector<Context> m_context_list;
+ //! Initialises the Encoder
+ void InitEncoder();
-private:
+ //! encodes a symbol and writes to output
+ void EncodeSymbol(const bool symbol, const int context_num);
- //! private, bodyless copy constructor: class should not be copied
- ArithCodecBase(const ArithCodecBase & cpy);
+ void EncodeUInt(const unsigned int value, const int bin1, const int max_bin);
- //! private, bodyless copy operator=: class should not be assigned
- ArithCodecBase & operator = (const ArithCodecBase & rhs);
+ void EncodeSInt(const int value, const int bin1, const int max_bin);
+ //! flushes the output of the encoder.
+ void FlushEncoder();
- // Decode functions
- ////////////////////////////
+ int ByteCount() const;
- //! Read all the data in
- void ReadAllData(int num_bytes);
+ // core decode functions
+ ////////////////////////////
- //! Read in a bit of data
- inline bool InputBit();
+ //! Initialise the Decoder
+ void InitDecoder(int num_bytes);
- // Codec data
- ////////////////////////////
+ //! Decodes a symbol given a context number
+ bool DecodeSymbol( int context_num );
- unsigned int m_scount;
+ unsigned int DecodeUInt(const int bin1, const int max_bin);
- //! Start of the current code range
- unsigned int m_low_code;
+ int DecodeSInt(const int bin1, const int max_bin);
+
+ //! List of contexts
+ std::vector<Context> m_context_list;
- //! Length of the current code range
- unsigned int m_range;
+ private:
+
+ //! private, bodyless copy constructor: class should not be copied
+ ArithCodecBase(const ArithCodecBase & cpy);
- //! Input/output stream of Dirac-format bytes
- ByteIO *m_byteio;
+ //! private, bodyless copy operator=: class should not be assigned
+ ArithCodecBase & operator = (const ArithCodecBase & rhs);
+
+
+ // Decode functions
+ ////////////////////////////
- // For encoder only
+ //! Read all the data in
+ void ReadAllData(int num_bytes);
- //! Number of underflow bits
- int m_underflow;
+ //! Read in a bit of data
+ inline bool InputBit();
- //! A pointer to the data for reading in
- char* m_decode_data_ptr;
+ // Codec data
+ ////////////////////////////
+
+ unsigned int m_scount;
+
+ //! Start of the current code range
+ unsigned int m_low_code;
+
+ //! Length of the current code range
+ unsigned int m_range;
- //! A point to the byte currently being read
- char* m_data_ptr;
+ //! Input/output stream of Dirac-format bytes
+ ByteIO *m_byteio;
- //! The index of the bit of the byte being read
- int m_input_bits_left;
+ // For encoder only
- //! The present input code
- unsigned int m_code;
+ //! Number of underflow bits
+ int m_underflow;
-};
+ //! A pointer to the data for reading in
+ char* m_decode_data_ptr;
+ //! A point to the byte currently being read
+ char* m_data_ptr;
-inline bool ArithCodecBase::DecodeSymbol(int context_num)
-{
+ //! The index of the bit of the byte being read
+ int m_input_bits_left;
- // Determine the next symbol value by placing code within
- // the [low,high] interval.
+ //! The present input code
+ unsigned int m_code;
- // Fetch the statistical context to be used
- Context& ctx = m_context_list[context_num];
+ };
- // Decode as per updated specification
- const unsigned int count = m_code - m_low_code ;
- const unsigned int range_x_prob = (m_range * ctx.GetScaledProb0()) >> 16;
- const bool symbol = (count >= range_x_prob);
- // Rescale the interval
- if(symbol) //symbol is 1
- {
- m_low_code += range_x_prob;
- m_range -= range_x_prob;
- }
- else //symbol is 0, so m_low_code unchanged
+ inline bool ArithCodecBase::DecodeSymbol( int context_num )
{
- m_range = range_x_prob;
- }
+
+ // Determine the next symbol value by placing code within
+ // the [low,high] interval.
- // Update the statistical context
- ctx.Update(symbol);
+ // Fetch the statistical context to be used
+ Context& ctx = m_context_list[context_num];
- while(m_range <= 0x4000)
- {
- if(((m_low_code + m_range - 1) ^ m_low_code) >= 0x8000)
+ // Decode as per updated specification
+ const unsigned int count = m_code - m_low_code ;
+ const unsigned int range_x_prob = ( m_range* ctx.GetScaledProb0())>>16;
+ const bool symbol = ( count >= range_x_prob );
+
+ // Rescale the interval
+ if( symbol ) //symbol is 1
+ {
+ m_low_code += range_x_prob;
+ m_range -= range_x_prob;
+ }
+ else //symbol is 0, so m_low_code unchanged
{
- // Straddle condition
- // We must have an underflow situation with
- // low = 0x01... and high = 0x10...
- // Flip 2nd bit prior to rescaling
- m_code ^= 0x4000;
- m_low_code ^= 0x4000;
+ m_range = range_x_prob;
}
- // Double low and range, throw away top bit of low
- m_low_code <<= 1;
- m_range <<= 1;
- m_low_code &= 0xFFFF;
+ // Update the statistical context
+ ctx.Update( symbol );
- // Shift in another bit of code
- m_code <<= 1;
- m_code += InputBit();
- m_code &= 0xFFFF;
+ while ( m_range<=0x4000 )
+ {
+ if( ( (m_low_code+m_range-1)^m_low_code)>=0x8000 )
+ {
+ // Straddle condition
+ // We must have an underflow situation with
+ // low = 0x01... and high = 0x10...
+ // Flip 2nd bit prior to rescaling
+ m_code ^= 0x4000;
+ m_low_code ^= 0x4000;
+ }
+
+ // Double low and range, throw away top bit of low
+ m_low_code <<= 1;
+ m_range <<= 1;
+ m_low_code &= 0xFFFF;
+
+ // Shift in another bit of code
+ m_code <<= 1;
+ m_code += InputBit();
+ m_code &= 0xFFFF;
+
+ }
+ return symbol;
}
- return symbol;
-}
-
-inline unsigned int ArithCodecBase::DecodeUInt(const int bin1, const int max_bin)
-{
- const int info_ctx = (max_bin + 1);
- int bin = bin1;
- unsigned int value = 1;
- while(!DecodeSymbol(bin))
- {
- value <<= 1;
- if(DecodeSymbol(info_ctx)) value += 1;
- if(bin < max_bin) bin += 1;
+ inline unsigned int ArithCodecBase::DecodeUInt(const int bin1, const int max_bin) {
+ const int info_ctx = (max_bin+1);
+ int bin = bin1;
+ unsigned int value = 1;
+ while (!DecodeSymbol(bin)) {
+ value <<= 1;
+ if (DecodeSymbol(info_ctx)) value+=1;
+ if (bin<max_bin) bin+=1;
+ }
+ value -= 1;
+ return value;
}
- value -= 1;
- return value;
-}
-inline int ArithCodecBase::DecodeSInt(const int bin1, const int max_bin)
-{
- int value = 0;
- const int magnitude = DecodeUInt(bin1, max_bin);
- if(magnitude != 0)
- {
- if(DecodeSymbol(max_bin + 2)) value = -magnitude;
- else value = magnitude;
+ inline int ArithCodecBase::DecodeSInt(const int bin1, const int max_bin) {
+ int value = 0;
+ const int magnitude = DecodeUInt(bin1, max_bin);
+ if (magnitude!=0) {
+ if (DecodeSymbol(max_bin+2)) value=-magnitude;
+ else value=magnitude;
+ }
+ return value;
}
- return value;
-}
-
-inline void ArithCodecBase::EncodeSymbol(const bool symbol, const int context_num)
-{
-
- // Adjust high and low (rescale interval) based on the symbol we are encoding
-
- Context& ctx = m_context_list[context_num];
- const unsigned int range_x_prob = (m_range * ctx.GetScaledProb0()) >> 16;
-
- if(symbol) //symbol is 1
- {
- m_low_code += range_x_prob;
- m_range -= range_x_prob;
- }
- else // symbol is 0, so m_low_code unchanged
+ inline void ArithCodecBase::EncodeSymbol(const bool symbol, const int context_num)
{
- m_range = range_x_prob;
- }
- // Update the statistical context
- ctx.Update(symbol);
+ // Adjust high and low (rescale interval) based on the symbol we are encoding
- while(m_range <= 0x4000)
- {
- if(((m_low_code + m_range - 1) ^ m_low_code) >= 0x8000)
- {
- // Straddle condition
- // We must have an underflow situation with
- // low = 0x01... and high = 0x10...
+ Context& ctx = m_context_list[context_num];
- m_low_code ^= 0x4000;
- m_underflow++;
+ const unsigned int range_x_prob = ( m_range* ctx.GetScaledProb0())>>16;
+ if ( symbol ) //symbol is 1
+ {
+ m_low_code += range_x_prob;
+ m_range -= range_x_prob;
}
- else
+ else // symbol is 0, so m_low_code unchanged
{
- // Bits agree - output them
- m_byteio->WriteBit(m_low_code & 0x8000);
- for(; m_underflow > 0; m_underflow--)
- m_byteio->WriteBit(~m_low_code & 0x8000);
+ m_range = range_x_prob;
}
-
- // Double low value and range
- m_low_code <<= 1;
- m_range <<= 1;
-
- // keep low to 16 bits - throw out top bit
- m_low_code &= 0xFFFF;
-
+
+ // Update the statistical context
+ ctx.Update( symbol );
+
+ while ( m_range <= 0x4000 )
+ {
+ if ( ( (m_low_code+m_range-1)^m_low_code)>=0x8000 )
+ {
+ // Straddle condition
+ // We must have an underflow situation with
+ // low = 0x01... and high = 0x10...
+
+ m_low_code ^= 0x4000;
+ m_underflow++;
+
+ }
+ else
+ {
+ // Bits agree - output them
+ m_byteio->WriteBit( m_low_code & 0x8000);
+ for (; m_underflow > 0; m_underflow-- )
+ m_byteio->WriteBit(~m_low_code & 0x8000);
+ }
+
+ // Double low value and range
+ m_low_code <<= 1;
+ m_range <<= 1;
+
+ // keep low to 16 bits - throw out top bit
+ m_low_code &= 0xFFFF;
+
+ }
}
-}
-inline void ArithCodecBase::EncodeUInt(const unsigned int the_int,
- const int bin1, const int max_bin)
-{
- const int value = (the_int + 1);
- const int info_ctx = (max_bin + 1);
- int bin = bin1;
- int top_bit = 1;
- {
- int max_value = 1;
- while(value > max_value)
+ inline void ArithCodecBase::EncodeUInt(const unsigned int the_int,
+ const int bin1, const int max_bin) {
+ const int value = (the_int+1);
+ const int info_ctx = (max_bin+1);
+ int bin = bin1;
+ int top_bit = 1;
{
- top_bit <<= 1;
- max_value <<= 1;
- max_value += 1;
+ int max_value = 1;
+ while (value>max_value) {
+ top_bit <<= 1;
+ max_value <<= 1;
+ max_value += 1;
+ }
}
- }
- bool stop = (top_bit == 1);
- EncodeSymbol(stop, bin);
- while(!stop)
- {
- top_bit >>= 1;
- EncodeSymbol((value & top_bit), info_ctx);
- if(bin < max_bin) bin += 1;
- stop = (top_bit == 1);
+ bool stop = (top_bit==1);
EncodeSymbol(stop, bin);
+ while (!stop) {
+ top_bit >>= 1;
+ EncodeSymbol( (value&top_bit), info_ctx);
+ if ( bin < max_bin) bin+=1;
+ stop = (top_bit==1);
+ EncodeSymbol(stop, bin);
+ }
}
-}
-inline void ArithCodecBase::EncodeSInt(const int value,
- const int bin1, const int max_bin)
-{
- EncodeUInt(std::abs(value), bin1, max_bin);
- if(value != 0)
- {
- EncodeSymbol((value < 0), max_bin + 2);
+ inline void ArithCodecBase::EncodeSInt(const int value,
+ const int bin1, const int max_bin) {
+ EncodeUInt(std::abs(value), bin1, max_bin);
+ if (value != 0) {
+ EncodeSymbol( (value < 0), max_bin+2 );
+ }
}
-}
-
-//! Abstract binary arithmetic coding class
-/*!
- This is an abtract binary arithmetic encoding class, used as the base
- for concrete classes that encode motion vectors and subband residues.
- \param T a container (most probably, or array) type
-*/
-template<class T> //T is container/array type
-class ArithCodec
- : public ArithCodecBase
-{
-public:
-
- //! Constructor for encoding
+ //! Abstract binary arithmetic coding class
/*!
- Creates an ArithCodec object to decode input based on a set of
- parameters.
- \param p_byteio input/output for encoded bits
- \param number_of_contexts the number of contexts used
+ This is an abtract binary arithmetic encoding class, used as the base
+ for concrete classes that encode motion vectors and subband residues.
+ \param T a container (most probably, or array) type
*/
- ArithCodec(ByteIO* p_byteio, size_t number_of_contexts);
-
-
- //! Destructor
- /*!
- Destructor is virtual as this class is abstract.
- */
- virtual ~ArithCodec() {}
-
- //! Compresses the input and returns the number of bits written.
- /*!
- Compress takes a type T object (a container or array) and
- compresses it using the abstract function DoWorkCode() which
- is overridden in subclasses. It returns the number of
- bits written.
- \param in_data the input to be compressed. Non-const,
- since the compression may be lossy.
- */
- int Compress(T & in_data);
-
- //! Decompresses the bitstream and writes into the output.
- /*!
- Decompresses the bitstream, up to the number of bytes
- specified and writes into the output subclasses.
- \param out_data the output into which the decompressed data
- is written.
- \param num_bytes the number of bytes to be read from the
- bitstream.
- */
- void Decompress(T & out_data, const int num_bytes);
-
-protected:
-
- //virtual encode-only functions
- ///////////////////////////////
-
- //! Does the work of actually coding the data
- virtual void DoWorkCode(T & in_data) = 0;
-
- //! virtual decode-only functions
- ///////////////////////////////
- virtual void DoWorkDecode(T & out_data) = 0;
-};
-
-//Implementation - core functions
-/////////////////////////////////
-
-template<class T>
-ArithCodec<T>::ArithCodec(ByteIO* p_byteio, size_t number_of_contexts):
- ArithCodecBase(p_byteio, number_of_contexts) {}
-
+ template<class T> //T is container/array type
+ class ArithCodec
+ : public ArithCodecBase
+ {
+ public:
+
+ //! Constructor for encoding
+ /*!
+ Creates an ArithCodec object to decode input based on a set of
+ parameters.
+ \param p_byteio input/output for encoded bits
+ \param number_of_contexts the number of contexts used
+ */
+ ArithCodec(ByteIO* p_byteio, size_t number_of_contexts);
+
+
+ //! Destructor
+ /*!
+ Destructor is virtual as this class is abstract.
+ */
+ virtual ~ArithCodec() {}
+
+ //! Compresses the input and returns the number of bits written.
+ /*!
+ Compress takes a type T object (a container or array) and
+ compresses it using the abstract function DoWorkCode() which
+ is overridden in subclasses. It returns the number of
+ bits written.
+ \param in_data the input to be compressed. Non-const,
+ since the compression may be lossy.
+ */
+ int Compress(T & in_data);
+
+ //! Decompresses the bitstream and writes into the output.
+ /*!
+ Decompresses the bitstream, up to the number of bytes
+ specified and writes into the output subclasses.
+ \param out_data the output into which the decompressed data
+ is written.
+ \param num_bytes the number of bytes to be read from the
+ bitstream.
+ */
+ void Decompress(T & out_data, const int num_bytes);
+
+ protected:
+
+ //virtual encode-only functions
+ ///////////////////////////////
+
+ //! Does the work of actually coding the data
+ virtual void DoWorkCode(T & in_data) = 0;
+
+ //! virtual decode-only functions
+ ///////////////////////////////
+ virtual void DoWorkDecode(T & out_data)=0;
+ };
+
+ //Implementation - core functions
+ /////////////////////////////////
+
+ template<class T>
+ ArithCodec<T>::ArithCodec(ByteIO* p_byteio, size_t number_of_contexts):
+ ArithCodecBase(p_byteio, number_of_contexts) {}
+
+
+
+ template<class T>
+ int ArithCodec<T>::Compress(T &in_data)
+ {
+ InitEncoder();
+ DoWorkCode(in_data);
+ FlushEncoder();
+ return ByteCount();
+ }
-template<class T>
-int ArithCodec<T>::Compress(T &in_data)
-{
- InitEncoder();
- DoWorkCode(in_data);
- FlushEncoder();
- return ByteCount();
-}
-
-template<class T>
-void ArithCodec<T>::Decompress(T &out_data, const int num_bytes)
-{
- InitDecoder(num_bytes);
- DoWorkDecode(out_data);
-}
+ template<class T>
+ void ArithCodec<T>::Decompress( T &out_data, const int num_bytes )
+ {
+ InitDecoder(num_bytes);
+ DoWorkDecode( out_data );
+ }
-inline bool ArithCodecBase::InputBit()
-{
- if(m_input_bits_left == 0)
+ inline bool ArithCodecBase::InputBit()
{
- m_data_ptr++;
- m_input_bits_left = 8;
+ if (m_input_bits_left == 0)
+ {
+ m_data_ptr++;
+ m_input_bits_left = 8;
+ }
+ m_input_bits_left--;
+ // MSB to LSB
+ return bool( ( (*m_data_ptr) >> m_input_bits_left ) & 1 );
}
- m_input_bits_left--;
- // MSB to LSB
- return bool(((*m_data_ptr) >> m_input_bits_left) & 1);
-}
}// namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arrays.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arrays.h
index d124654a7..276ba5ef2 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arrays.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/arrays.h
@@ -20,7 +20,7 @@
* Portions created by the Initial Developer are Copyright (C) 2004.
* All Rights Reserved.
*
-* Contributor(s): Thomas Davies (Original Author),
+* Contributor(s): Thomas Davies (Original Author),
* Peter Meerwald (pmeerw@users.sourceforge.net)
* Mike Ferenduros (mike_ferenzduros@users.sourceforge.net)
* Anuradha Suraparaju
@@ -52,597 +52,544 @@
namespace dirac
{
-//! Range type.
-/*!
- Range type encapsulating a closed range of values [first,last].
- Used to initialies OneDArrays.
- */
-class Range
-{
-public:
- //! Constructor
+ //! Range type.
/*!
- Constructor taking a start and an end point for the range.
+ Range type encapsulating a closed range of values [first,last].
+ Used to initialies OneDArrays.
*/
- Range(int s, int e): m_fst(s), m_lst(e) {}
-
- //! Returns the start of the range.
- int First() const
- {
- return m_fst;
- }
-
- //! Returns the end point of the range.
- int Last() const
+ class Range
{
- return m_lst;
- }
-
-private:
- int m_fst , m_lst;
-};
-
-//////////////////////////////
-//One-Dimensional Array type//
-//////////////////////////////
-
-//! A template class for one-dimensional arrays.
-/*!
- A template class for one-D arrays. Can be used wherever built-in
- arrays are used, and eliminates the need for explicit memory
- (de-)allocation. Also supports arrays not based at zero.
- */
-template <class T> class OneDArray
-{
-public:
- //! Default constructor.
- /*!
- Default constructor produces an empty array.
- */
- OneDArray();
+ public:
+ //! Constructor
+ /*!
+ Constructor taking a start and an end point for the range.
+ */
+ Range(int s, int e): m_fst(s), m_lst(e){}
- //! 'Length' constructor.
- /*!
- Length constructor produces a zero-based array.
- */
- OneDArray(const int len);
+ //! Returns the start of the range.
+ int First() const {return m_fst;}
- //! Range constructor
- /*!
- Range constructor produces an array with values indexed within the
- range parameters.
- \param r a range of indexing values.
- */
- OneDArray(const Range& r);
+ //! Returns the end point of the range.
+ int Last() const {return m_lst;}
- //! Destructor.
- /*!
- Destructor frees the data allocated in the constructors.
- */
- ~OneDArray()
- {
- FreePtr();
- }
+ private:
+ int m_fst ,m_lst;
+ };
- //! Copy constructor.
- /*!
- Copy constructor copies both data and metadata.
- */
- OneDArray(const OneDArray<T>& cpy);
+ //////////////////////////////
+ //One-Dimensional Array type//
+ //////////////////////////////
- //! Assignment=
+ //! A template class for one-dimensional arrays.
/*!
- Assignment= assigns both data and metadata.
+ A template class for one-D arrays. Can be used wherever built-in
+ arrays are used, and eliminates the need for explicit memory
+ (de-)allocation. Also supports arrays not based at zero.
*/
- OneDArray<T>& operator=(const OneDArray<T>& rhs);
+ template <class T> class OneDArray
+ {
+ public:
+ //! Default constructor.
+ /*!
+ Default constructor produces an empty array.
+ */
+ OneDArray();
+
+ //! 'Length' constructor.
+ /*!
+ Length constructor produces a zero-based array.
+ */
+ OneDArray(const int len);
+
+ //! Range constructor
+ /*!
+ Range constructor produces an array with values indexed within the
+ range parameters.
+ \param r a range of indexing values.
+ */
+ OneDArray(const Range& r);
+
+ //! Destructor.
+ /*!
+ Destructor frees the data allocated in the constructors.
+ */
+ ~OneDArray()
+ {
+ FreePtr();
+ }
- //! Resize the array, throwing away the current data.
- void Resize(int l);
+ //! Copy constructor.
+ /*!
+ Copy constructor copies both data and metadata.
+ */
+ OneDArray(const OneDArray<T>& cpy);
- //! Element access.
- T& operator[](const int pos)
- {
- return m_ptr[pos-m_first];
- }
+ //! Assignment=
+ /*!
+ Assignment= assigns both data and metadata.
+ */
+ OneDArray<T>& operator=(const OneDArray<T>& rhs);
- //! Element access.
- const T& operator[](const int pos) const
- {
- return m_ptr[pos-m_first];
- }
+ //! Resize the array, throwing away the current data.
+ void Resize(int l);
- //! Returns the length of the array.
- int Length() const
- {
- return m_length;
- }
+ //! Element access.
+ T& operator[](const int pos){return m_ptr[pos-m_first];}
- //! Returns the index of the first element.
- int First() const
- {
- return m_first;
- }
+ //! Element access.
+ const T& operator[](const int pos) const {return m_ptr[pos-m_first];}
- //! Returns the index of the last element.
- int Last() const
- {
- return m_last;
- }
+ //! Returns the length of the array.
+ int Length() const {return m_length;}
-private:
- void Init(const int len);
+ //! Returns the index of the first element.
+ int First() const {return m_first;}
- void Init(const Range& r);
+ //! Returns the index of the last element.
+ int Last() const {return m_last;}
- void FreePtr();
+ private:
+ void Init(const int len);
- int m_first, m_last;
- int m_length;
- T* m_ptr;
-};
+ void Init(const Range& r);
-//public member functions//
-///////////////////////////
+ void FreePtr();
-template <class T>
-OneDArray<T>::OneDArray()
-{
- Init(0);
-}
+ int m_first, m_last;
+ int m_length;
+ T* m_ptr;
+ };
-template <class T>
-OneDArray<T>::OneDArray(const int len)
-{
- Init(len);
-}
+ //public member functions//
+ ///////////////////////////
-template <class T>
-OneDArray<T>::OneDArray(const Range& r)
-{
- Init(r);
-}
-
-template <class T>
-OneDArray<T>::OneDArray(const OneDArray<T>& cpy)
-{
- m_first = cpy.m_first;
- m_last = cpy.m_last;
- m_length = m_last - m_first + 1;
+ template <class T>
+ OneDArray<T>::OneDArray()
+ {
+ Init(0);
+ }
- if(m_first == 0)
- Init(m_length);
- else
- Init(Range(m_first , m_last));
+ template <class T>
+ OneDArray<T>::OneDArray(const int len)
+ {
+ Init(len);
+ }
- memcpy(m_ptr , cpy.m_ptr , m_length * sizeof(T));
-}
+ template <class T>
+ OneDArray<T>::OneDArray(const Range& r)
+ {
+ Init(r);
+ }
-template <class T>
-OneDArray<T>& OneDArray<T>::operator=(const OneDArray<T>& rhs)
-{
- if(&rhs != this)
+ template <class T>
+ OneDArray<T>::OneDArray(const OneDArray<T>& cpy)
{
- FreePtr();
- m_first = rhs.m_first;
- m_last = rhs.m_last;
- m_length = rhs.m_length;
+ m_first = cpy.m_first;
+ m_last = cpy.m_last;
+ m_length = m_last - m_first + 1;
- if(m_first == 0)
+ if (m_first==0)
Init(m_length);
else
Init(Range(m_first , m_last));
- memcpy(m_ptr , rhs.m_ptr , m_length * sizeof(T));
-
+ memcpy( m_ptr , cpy.m_ptr , m_length * sizeof( T ) );
}
- return *this;
-}
-template <class T>
-void OneDArray<T>::Resize(int l)
-{
- if(l != m_length)
+ template <class T>
+ OneDArray<T>& OneDArray<T>::operator=(const OneDArray<T>& rhs)
{
- FreePtr();
- Init(l);
- }
-}
-
-//private member functions//
-////////////////////////////
-
-template <class T>
-void OneDArray<T>::Init(const int len)
-{
- Range r(0 , len - 1);
+ if (&rhs != this)
+ {
+ FreePtr();
+ m_first = rhs.m_first;
+ m_last = rhs.m_last;
+ m_length = rhs.m_length;
- Init(r);
+ if (m_first == 0)
+ Init(m_length);
+ else
+ Init(Range(m_first , m_last));
-}
+ memcpy( m_ptr , rhs.m_ptr , m_length * sizeof( T ) );
-template <class T>
-void OneDArray<T>::Init(const Range& r)
-{
-
- m_first = r.First();
- m_last = r.Last();
- m_length = m_last - m_first + 1;
+ }
+ return *this;
+ }
- if(m_length > 0)
+ template <class T>
+ void OneDArray<T>::Resize(int l)
{
- m_ptr = new T[ m_length ];
+ if (l != m_length)
+ {
+ FreePtr();
+ Init(l);
+ }
}
- else
+
+ //private member functions//
+ ////////////////////////////
+
+ template <class T>
+ void OneDArray<T>::Init(const int len)
{
- m_length = 0;
- m_first = 0;
- m_last = -1;
- m_ptr = NULL;
- }
-}
+ Range r(0 , len-1);
-template <class T>
-void OneDArray<T>::FreePtr()
-{
- if(m_length > 0)
- delete[] m_ptr;
-}
-
-
-//////////////////////////////
-//Two-Dimensional Array type//
-//////////////////////////////
-
-//! A template class for two-dimensional arrays.
-/*!
- A template class to do two-d arrays, so that explicit memory
- (de-)allocation is not required. Only zero-based arrays are
- currently supported so that access is fast. Accessing elements along
- a row is therefore much faster than accessing them along a column.
- Rows are contiguous in memory, so array[y][x] is equivalent to
- array[0][x+y*LengthX()].
- */
-template <class T> class TwoDArray
-{
- typedef T* element_type;
+ Init(r);
-public:
+ }
- //! Default constructor.
- /*!
- Default constructor creates an empty array.
- */
- TwoDArray()
+ template <class T>
+ void OneDArray<T>::Init(const Range& r)
{
- Init(0, 0);
- }
- //! Constructor.
- /*!
- The constructor creates an array of given width height.
- */
- TwoDArray(const int height , const int width)
- {
- Init(height , width);
- }
+ m_first = r.First();
+ m_last = r.Last();
+ m_length = m_last - m_first + 1;
- //! Constructor.
- /*!
- The constructor creates an array of given width and length height
- and initialises it to a value
- */
- TwoDArray(const int height , const int width , T val);
+ if ( m_length>0 )
+ {
+ m_ptr = new T[ m_length ];
+ }
+ else
+ {
+ m_length = 0;
+ m_first = 0;
+ m_last = -1;
+ m_ptr = NULL;
+ }
+ }
- //! Destructor
- /*!
- Destructor frees the data allocated in the constructor.
- */
- virtual ~TwoDArray()
+ template <class T>
+ void OneDArray<T>::FreePtr()
{
- FreeData();
+ if ( m_length>0 )
+ delete[] m_ptr;
}
- //! Copy constructor.
- /*!
- Copy constructor copies data and metadata.
- */
- TwoDArray(const TwoDArray<T>& Cpy);
- //! Assignment =
- /*!
- Assignement = assigns both data and metadata.
- */
- TwoDArray<T>& operator=(const TwoDArray<T>& rhs);
+ //////////////////////////////
+ //Two-Dimensional Array type//
+ //////////////////////////////
- //! Copy Contents
+ //! A template class for two-dimensional arrays.
/*!
- Copy contents of array into output array retaining the dimensions
- of the output array. If output array is larger that array then
- pad with last true value.
- Return true is copy was successful
+ A template class to do two-d arrays, so that explicit memory
+ (de-)allocation is not required. Only zero-based arrays are
+ currently supported so that access is fast. Accessing elements along
+ a row is therefore much faster than accessing them along a column.
+ Rows are contiguous in memory, so array[y][x] is equivalent to
+ array[0][x+y*LengthX()].
*/
- bool CopyContents(TwoDArray<T>& out) const;
+ template <class T> class TwoDArray
+ {
+ typedef T* element_type;
+
+ public:
+
+ //! Default constructor.
+ /*!
+ Default constructor creates an empty array.
+ */
+ TwoDArray(){ Init(0,0); }
+
+ //! Constructor.
+ /*!
+ The constructor creates an array of given width height.
+ */
+ TwoDArray( const int height , const int width ){Init(height , width);}
+
+ //! Constructor.
+ /*!
+ The constructor creates an array of given width and length height
+ and initialises it to a value
+ */
+ TwoDArray( const int height , const int width , T val);
+
+ //! Destructor
+ /*!
+ Destructor frees the data allocated in the constructor.
+ */
+ virtual ~TwoDArray(){
+ FreeData();
+ }
- //! Fill contents
- /*!
- Initialise the array with the val provided.
- */
- void Fill(T val);
+ //! Copy constructor.
+ /*!
+ Copy constructor copies data and metadata.
+ */
+ TwoDArray(const TwoDArray<T>& Cpy);
- //! Resizes the array, deleting the current data.
- void Resize(const int height, const int width);
+ //! Assignment =
+ /*!
+ Assignement = assigns both data and metadata.
+ */
+ TwoDArray<T>& operator=(const TwoDArray<T>& rhs);
- //! Element access.
- /*!
- Accesses the rows of the arrays, which are returned in the form
- of pointers to the row data NOT OneDArray objects.
- */
- inline element_type& operator[](const int pos)
- {
- return m_array_of_rows[pos];
- }
+ //! Copy Contents
+ /*!
+ Copy contents of array into output array retaining the dimensions
+ of the output array. If output array is larger that array then
+ pad with last true value.
+ Return true is copy was successful
+ */
+ bool CopyContents(TwoDArray<T>& out) const;
- //! Element access.
- /*!
- Accesses the rows of the arrays, which are returned in the form of
- pointers to the row data NOT OneDArray objects.
- */
- inline const element_type& operator[](const int pos) const
- {
- return m_array_of_rows[pos];
- }
+ //! Fill contents
+ /*!
+ Initialise the array with the val provided.
+ */
+ void Fill(T val);
- //! Returns the width
- int LengthX() const
- {
- return m_length_x;
- }
+ //! Resizes the array, deleting the current data.
+ void Resize(const int height, const int width);
- //! Returns the height
- int LengthY() const
- {
- return m_length_y;
- }
+ //! Element access.
+ /*!
+ Accesses the rows of the arrays, which are returned in the form
+ of pointers to the row data NOT OneDArray objects.
+ */
+ inline element_type& operator[](const int pos){return m_array_of_rows[pos];}
- //! Returns the index of the first element of a row
- int FirstX() const
- {
- return m_first_x;
- }
+ //! Element access.
+ /*!
+ Accesses the rows of the arrays, which are returned in the form of
+ pointers to the row data NOT OneDArray objects.
+ */
+ inline const element_type& operator[](const int pos) const {return m_array_of_rows[pos];}
- //! Returns the index of the first element of a column
- int FirstY() const
- {
- return m_first_y;
- }
+ //! Returns the width
+ int LengthX() const { return m_length_x; }
- //! Returns the index of the last element of a row
- int LastX() const
- {
- return m_last_x;
- }
+ //! Returns the height
+ int LengthY() const { return m_length_y; }
- //! Returns the index of the first element of a column
- int LastY() const
- {
- return m_last_y;
- }
+ //! Returns the index of the first element of a row
+ int FirstX() const { return m_first_x; }
-private:
- //! Initialise the array
- void Init(const int height, const int width);
+ //! Returns the index of the first element of a column
+ int FirstY() const { return m_first_y; }
- //! Free all the allocated data
- void FreeData();
+ //! Returns the index of the last element of a row
+ int LastX() const { return m_last_x; }
- int m_first_x;
- int m_first_y;
+ //! Returns the index of the first element of a column
+ int LastY() const { return m_last_y; }
- int m_last_x;
- int m_last_y;
+ private:
+ //! Initialise the array
+ void Init(const int height,const int width);
- int m_length_x;
- int m_length_y;
+ //! Free all the allocated data
+ void FreeData();
- element_type* m_array_of_rows;
-};
+ int m_first_x;
+ int m_first_y;
-//public member functions//
-///////////////////////////
+ int m_last_x;
+ int m_last_y;
-template <class T>
-TwoDArray<T>::TwoDArray(const int height , const int width , const T val)
-{
- Init(height , width);
- std::fill_n(m_array_of_rows[0], m_length_x * m_length_y, val);
-}
+ int m_length_x;
+ int m_length_y;
-template <class T>
-TwoDArray<T>::TwoDArray(const TwoDArray<T>& Cpy)
-{
- m_first_x = Cpy.m_first_x;
- m_first_y = Cpy.m_first_y;
- m_last_x = Cpy.m_last_x;
- m_last_y = Cpy.m_last_y;
+ element_type* m_array_of_rows;
+ };
- m_length_x = m_last_x - m_first_x + 1;
- m_length_y = m_last_y - m_first_y + 1;
+ //public member functions//
+ ///////////////////////////
- if(m_first_x == 0 && m_first_y == 0)
- Init(m_length_y , m_length_x);
- else
+ template <class T>
+ TwoDArray<T>::TwoDArray( const int height , const int width , const T val)
{
- //based 2D arrays not yet supported
- }
-
- memcpy(m_array_of_rows[0] , (Cpy.m_array_of_rows)[0] , m_length_x * m_length_y * sizeof(T));
-
-}
+ Init( height , width );
+ std::fill_n( m_array_of_rows[0], m_length_x*m_length_y, val);
+ }
-template <class T>
-TwoDArray<T>& TwoDArray<T>::operator=(const TwoDArray<T>& rhs)
-{
- if(&rhs != this)
+ template <class T>
+ TwoDArray<T>::TwoDArray(const TwoDArray<T>& Cpy)
{
- FreeData();
-
- m_first_x = rhs.m_first_x;
- m_first_y = rhs.m_first_y;
-
- m_last_x = rhs.m_last_x;
- m_last_y = rhs.m_last_y;
+ m_first_x = Cpy.m_first_x;
+ m_first_y = Cpy.m_first_y;
+ m_last_x = Cpy.m_last_x;
+ m_last_y = Cpy.m_last_y;
m_length_x = m_last_x - m_first_x + 1;
- m_length_y = m_last_y - m_first_y + 1;
+ m_length_y = m_last_y - m_first_y + 1;
- if(m_first_x == 0 && m_first_y == 0)
+ if (m_first_x == 0 && m_first_y == 0)
Init(m_length_y , m_length_x);
- else
- {
- //based 2D arrays not yet supported
+ else{
+ //based 2D arrays not yet supported
}
- memcpy(m_array_of_rows[0], (rhs.m_array_of_rows)[0], m_length_x * m_length_y * sizeof(T));
+ memcpy( m_array_of_rows[0] , (Cpy.m_array_of_rows)[0] , m_length_x * m_length_y * sizeof( T ) );
}
- return *this;
-
-}
-
-template <class T>
-bool TwoDArray<T>::CopyContents(TwoDArray<T>& out) const
-{
- if(&out != this)
+ template <class T>
+ TwoDArray<T>& TwoDArray<T>::operator=(const TwoDArray<T>& rhs)
{
- int rows = std::min(m_length_y, out.m_length_y);
- int cols = std::min(m_length_x, out.m_length_x);
- for(int j = 0; j < rows; ++j)
+ if (&rhs != this)
{
- memcpy(out.m_array_of_rows[j], m_array_of_rows[j], cols * sizeof(T)) ;
- for(int i = cols; i < out.m_length_x; ++i)
- out.m_array_of_rows[j][i] = out.m_array_of_rows[j][cols-1];
+ FreeData();
+
+ m_first_x = rhs.m_first_x;
+ m_first_y = rhs.m_first_y;
+
+ m_last_x = rhs.m_last_x;
+ m_last_y = rhs.m_last_y;
+
+ m_length_x = m_last_x - m_first_x + 1;
+ m_length_y = m_last_y - m_first_y + 1;
+
+ if (m_first_x == 0 && m_first_y == 0)
+ Init(m_length_y , m_length_x);
+ else
+ {
+ //based 2D arrays not yet supported
+ }
+
+ memcpy( m_array_of_rows[0], (rhs.m_array_of_rows)[0], m_length_x * m_length_y * sizeof( T ) );
+
}
- for(int j = rows; j < out.m_length_y; ++j)
+
+ return *this;
+
+ }
+
+ template <class T>
+ bool TwoDArray<T>::CopyContents(TwoDArray<T>& out) const
+ {
+ if (&out != this)
{
- memcpy(out.m_array_of_rows[j], out.m_array_of_rows[rows-1], out.m_length_x * sizeof(T)) ;
+ int rows = std::min (m_length_y, out.m_length_y);
+ int cols = std::min (m_length_x, out.m_length_x);
+ for (int j = 0; j < rows; ++j)
+ {
+ memcpy( out.m_array_of_rows[j], m_array_of_rows[j], cols * sizeof( T )) ;
+ for (int i = cols; i <out.m_length_x; ++i)
+ out.m_array_of_rows[j][i] = out.m_array_of_rows[j][cols-1];
+ }
+ for (int j = rows; j < out.m_length_y; ++j)
+ {
+ memcpy( out.m_array_of_rows[j], out.m_array_of_rows[rows-1], out.m_length_x * sizeof( T )) ;
+ }
}
+ return true;
}
- return true;
-}
-
-template <class T>
-void TwoDArray<T>::Fill(T val)
-{
- if(m_length_x && m_length_y)
- std::fill_n(m_array_of_rows[0], m_length_x * m_length_y, val);
-}
+
+ template <class T>
+ void TwoDArray<T>::Fill( T val)
+ {
+ if (m_length_x && m_length_y)
+ std::fill_n( m_array_of_rows[0], m_length_x*m_length_y, val);
+ }
-template <class T>
-void TwoDArray<T>::Resize(const int height, const int width)
-{
- if(height != m_length_y || width != m_length_x)
+ template <class T>
+ void TwoDArray<T>::Resize(const int height, const int width)
{
- FreeData();
- Init(height , width);
+ if (height != m_length_y || width != m_length_x)
+ {
+ FreeData();
+ Init(height , width);
+ }
}
-}
-
-//private member functions//
-////////////////////////////
-template <class T>
-void TwoDArray<T>::Init(const int height , const int width)
-{
- m_length_x = width;
- m_length_y = height;
- m_first_x = 0;
- m_first_y = 0;
-
- m_last_x = m_length_x - 1;
- m_last_y = m_length_y - 1;
+ //private member functions//
+ ////////////////////////////
- if(m_length_y > 0)
+ template <class T>
+ void TwoDArray<T>::Init(const int height , const int width)
{
- // allocate the array containing ptrs to all the rows
- m_array_of_rows = new element_type[ m_length_y ];
+ m_length_x = width;
+ m_length_y = height;
+ m_first_x = 0;
+ m_first_y = 0;
- if(m_length_x > 0)
- {
- // Allocate the whole thing as a single big block
- m_array_of_rows[0] = new T[ m_length_x * m_length_y ];
+ m_last_x = m_length_x-1;
+ m_last_y = m_length_y-1;
- // Point the pointers
- for(int j = 1 ; j < m_length_y ; ++j)
- m_array_of_rows[j] = m_array_of_rows[0] + j * m_length_x;
+ if (m_length_y>0)
+ {
+ // allocate the array containing ptrs to all the rows
+ m_array_of_rows = new element_type[ m_length_y ];
+
+ if ( m_length_x>0 )
+ {
+ // Allocate the whole thing as a single big block
+ m_array_of_rows[0] = new T[ m_length_x * m_length_y ];
+
+ // Point the pointers
+ for (int j=1 ; j<m_length_y ; ++j)
+ m_array_of_rows[j] = m_array_of_rows[0] + j * m_length_x;
+ }
+ else
+ {
+ m_length_x = 0;
+ m_first_x = 0;
+ m_last_x = -1;
+ }
}
- else
+ else
{
m_length_x = 0;
+ m_length_y = 0;
m_first_x = 0;
+ m_first_y = 0;
m_last_x = -1;
+ m_last_y = -1;
+ m_array_of_rows = NULL;
}
}
- else
- {
- m_length_x = 0;
- m_length_y = 0;
- m_first_x = 0;
- m_first_y = 0;
- m_last_x = -1;
- m_last_y = -1;
- m_array_of_rows = NULL;
- }
-}
-template <class T>
-void TwoDArray<T>::FreeData()
-{
- if(m_length_y > 0)
+ template <class T>
+ void TwoDArray<T>::FreeData()
{
- if(m_length_x > 0)
+ if (m_length_y>0)
{
- delete[] m_array_of_rows[0];
- }
-
- m_length_y = m_length_x = 0;
- // deallocate the array of rows
- delete[] m_array_of_rows;
+ if (m_length_x>0)
+ {
+ delete[] m_array_of_rows[0];
+ }
+
+ m_length_y = m_length_x = 0;
+ // deallocate the array of rows
+ delete[] m_array_of_rows;
+ }
}
-}
-// Related functions
+ // Related functions
-//! A function for extracting array data
-template <class T >
-std::ostream & operator<< (std::ostream & stream, TwoDArray<T> & array)
-{
- for(int j = 0 ; j < array.LengthY() ; ++j)
+ //! A function for extracting array data
+ template <class T >
+ std::ostream & operator<< (std::ostream & stream, TwoDArray<T> & array)
{
- for(int i = 0 ; i < array.LengthX() ; ++i)
+ for (int j=0 ; j<array.LengthY() ; ++j)
{
- stream << array[j][i] << " ";
- }// i
- stream << std::endl;
- }// j
-
- return stream;
-}
+ for (int i=0 ; i<array.LengthX() ; ++i)
+ {
+ stream << array[j][i] << " ";
+ }// i
+ stream << std::endl;
+ }// j
+
+ return stream;
+ }
-//! A function for inserting array data
-template <class T >
-std::istream & operator>> (std::istream & stream, TwoDArray<T> & array)
-{
- for(int j = 0 ; j < array.LengthY() ; ++j)
+ //! A function for inserting array data
+ template <class T >
+ std::istream & operator>> (std::istream & stream, TwoDArray<T> & array)
{
- for(int i = 0 ; i < array.LengthX() ; ++i)
+ for (int j=0 ; j<array.LengthY() ; ++j)
{
- stream >> array[j][i];
- }// i
- }// j
+ for (int i=0 ; i<array.LengthX() ; ++i)
+ {
+ stream >> array[j][i];
+ }// i
+ }// j
- return stream;
-}
+ return stream;
+ }
} //namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.cpp
index bb751e1f0..fc0e42312 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.cpp
@@ -72,25 +72,25 @@ GenericIntraDCBandCodec<ArithCodec<CoeffArray> >::GenericIntraDCBandCodec(
void IntraDCBandCodec::DoWorkCode(CoeffArray& in_data)
{
// Residues after prediction, quantisation and inverse quantisation
- m_dc_pred_res.Resize(m_node.Yl() , m_node.Xl());
- m_dc_pred_res.Fill(0);
+ m_dc_pred_res.Resize( m_node.Yl() , m_node.Xl() );
+ m_dc_pred_res.Fill( 0 );
BandCodec::DoWorkCode(in_data);
}
-void IntraDCBandCodec::CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos)
+void IntraDCBandCodec::CodeCoeff( CoeffArray& in_data, const int xpos, const int ypos)
{
m_nhood_nonzero = false;
- if(ypos > m_node.Yp())
+ if (ypos > m_node.Yp())
m_nhood_nonzero |= bool(m_dc_pred_res[ypos-1][xpos]);
- if(xpos > m_node.Xp())
+ if (xpos > m_node.Xp())
m_nhood_nonzero |= bool(m_dc_pred_res[ypos][xpos-1]);
- if(ypos > m_node.Yp() && xpos > m_node.Xp())
+ if (ypos > m_node.Yp() && xpos > m_node.Xp())
m_nhood_nonzero |= bool(m_dc_pred_res[ypos-1][xpos-1]);
- ValueType prediction = GetPrediction(in_data , xpos , ypos);
+ ValueType prediction = GetPrediction( in_data , xpos , ypos );
ValueType val = in_data[ypos][xpos] - prediction;
- CodeVal(in_data , xpos , ypos , val);
+ CodeVal( in_data , xpos , ypos , val );
m_dc_pred_res[ypos][xpos] = in_data[ypos][xpos];
in_data[ypos][xpos] += prediction;
}
@@ -98,22 +98,22 @@ void IntraDCBandCodec::CodeCoeff(CoeffArray& in_data, const int xpos, const int
void IntraDCBandCodec::DoWorkDecode(CoeffArray& out_data)
{
// Residues after prediction, quantisation and inverse quantisation
- m_dc_pred_res.Resize(m_node.Yl() , m_node.Xl());
- m_dc_pred_res.Fill(0);
+ m_dc_pred_res.Resize( m_node.Yl() , m_node.Xl() );
+ m_dc_pred_res.Fill( 0 );
BandCodec::DoWorkDecode(out_data);
}
-void IntraDCBandCodec::DecodeCoeff(CoeffArray& out_data, const int xpos, const int ypos)
+void IntraDCBandCodec::DecodeCoeff( CoeffArray& out_data, const int xpos, const int ypos)
{
m_nhood_nonzero = false;
- if(ypos > m_node.Yp())
+ if (ypos > m_node.Yp())
m_nhood_nonzero |= bool(m_dc_pred_res[ypos-1][xpos]);
- if(xpos > m_node.Xp())
+ if (xpos > m_node.Xp())
m_nhood_nonzero |= bool(m_dc_pred_res[ypos][xpos-1]);
- if(ypos > m_node.Yp() && xpos > m_node.Xp())
+ if (ypos > m_node.Yp() && xpos > m_node.Xp())
m_nhood_nonzero |= bool(m_dc_pred_res[ypos-1][xpos-1]);
- DecodeVal(out_data , xpos , ypos);
+ DecodeVal( out_data , xpos , ypos );
m_dc_pred_res[ypos][xpos] = out_data[ypos][xpos];
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.h
index e03c75aaa..dfebb2e7f 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec.h
@@ -48,201 +48,201 @@
namespace dirac
{
-class SubbandByteIO;
+ class SubbandByteIO;
-//Subclasses the arithmetic codec to produce a coding/decoding tool for subbands
+ //Subclasses the arithmetic codec to produce a coding/decoding tool for subbands
-//! A template class for coding and decoding wavelet subband data.
-template<typename EntropyCodec>
-class GenericBandCodec: public EntropyCodec
-{
-public:
-
- //! Constructor
- /*!
- Creates a BandCodec object to encode subband data
- \param subband_byteio input/output for the encoded bits
- \param number_of_contexts the number of contexts used in the encoding process
- \param band_list the set of all the subbands
- \param band_num the number of the subband being coded
- \param is_intra Flag indicating whether the band comes from an intra picture
- */
- GenericBandCodec(SubbandByteIO* subband_byteio,
- size_t number_of_contexts,
- const SubbandList& band_list,
- int band_num,
- const bool is_intra);
+ //! A template class for coding and decoding wavelet subband data.
+ template<typename EntropyCodec>
+ class GenericBandCodec: public EntropyCodec
+ {
+ public:
-protected:
- //! Code an individual quantised value and perform inverse-quantisation
- inline void CodeVal(CoeffArray& in_data , const int xpos , const int ypos , const CoeffType val);
+ //! Constructor
+ /*!
+ Creates a BandCodec object to encode subband data
+ \param subband_byteio input/output for the encoded bits
+ \param number_of_contexts the number of contexts used in the encoding process
+ \param band_list the set of all the subbands
+ \param band_num the number of the subband being coded
+ \param is_intra Flag indicating whether the band comes from an intra picture
+ */
+ GenericBandCodec(SubbandByteIO* subband_byteio,
+ size_t number_of_contexts,
+ const SubbandList& band_list,
+ int band_num,
+ const bool is_intra);
- //! Decode an individual quantised value and perform inverse-quantisation
- inline void DecodeVal(CoeffArray& out_data , const int xpos , const int ypos);
+ protected:
+ //! Code an individual quantised value and perform inverse-quantisation
+ inline void CodeVal( CoeffArray& in_data , const int xpos , const int ypos , const CoeffType val);
- //! Encode the offset for a code block quantiser
- void CodeQuantIndexOffset(const int offset);
+ //! Decode an individual quantised value and perform inverse-quantisation
+ inline void DecodeVal(CoeffArray& out_data , const int xpos , const int ypos );
- //! Decode the offset for a code block quantiser
- int DecodeQuantIndexOffset();
+ //! Encode the offset for a code block quantiser
+ void CodeQuantIndexOffset( const int offset );
- //! Set a code block area to a given value
- inline void SetToVal(const CodeBlock& code_block , CoeffArray& coeff_data , const CoeffType val);
+ //! Decode the offset for a code block quantiser
+ int DecodeQuantIndexOffset();
- //! Set all block values to 0
- virtual void ClearBlock(const CodeBlock& code_block , CoeffArray& coeff_data);
+ //! Set a code block area to a given value
+ inline void SetToVal( const CodeBlock& code_block , CoeffArray& coeff_data , const CoeffType val);
-protected:
- //functions
- // Overridden from the base class
- virtual void DoWorkCode(CoeffArray& in_data);
- // Ditto
- virtual void DoWorkDecode(CoeffArray& out_data);
+ //! Set all block values to 0
+ virtual void ClearBlock( const CodeBlock& code_block , CoeffArray& coeff_data);
- virtual void CodeCoeffBlock(const CodeBlock& code_block , CoeffArray& in_data);
- virtual void DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data);
+ protected:
+ //functions
+ // Overridden from the base class
+ virtual void DoWorkCode(CoeffArray& in_data);
+ // Ditto
+ virtual void DoWorkDecode(CoeffArray& out_data);
- virtual void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
+ virtual void CodeCoeffBlock(const CodeBlock& code_block , CoeffArray& in_data);
+ virtual void DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data);
- virtual void DecodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
- //! A function for choosing the context for "follow bits"
- inline int ChooseFollowContext(const int bin_number) const;
+ virtual void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
- //! A function for choosing the context for "information bits"
- inline int ChooseInfoContext() const;
+ virtual void DecodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
+ //! A function for choosing the context for "follow bits"
+ inline int ChooseFollowContext( const int bin_number ) const;
- //! A function for choosing the context for sign bits
- inline int ChooseSignContext(const CoeffArray& data , const int xpos , const int ypos) const;
+ //! A function for choosing the context for "information bits"
+ inline int ChooseInfoContext() const;
-private:
- //! Private, bodyless copy constructor: class should not be copied
- GenericBandCodec(const GenericBandCodec& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- GenericBandCodec& operator=(const GenericBandCodec& rhs);
+ //! A function for choosing the context for sign bits
+ inline int ChooseSignContext(const CoeffArray& data , const int xpos , const int ypos ) const;
-protected:
+ private:
+ //! Private, bodyless copy constructor: class should not be copied
+ GenericBandCodec(const GenericBandCodec& cpy);
+ //! Private, bodyless copy operator=: class should not be assigned
+ GenericBandCodec& operator=(const GenericBandCodec& rhs);
- //! Flag indicating whether the band comes from an intra picture
- bool m_is_intra;
+ protected:
- //! variables
- int m_bnum;
+ //! Flag indicating whether the band comes from an intra picture
+ bool m_is_intra;
- //! the subband being coded
- const Subband m_node;
+ //! variables
+ int m_bnum;
- //! the quantisation index of the last codeblock
- int m_last_qf_idx;
+ //! the subband being coded
+ const Subband m_node;
- //! quantisation value
- int m_qf;
+ //! the quantisation index of the last codeblock
+ int m_last_qf_idx;
- //! reconstruction point
- CoeffType m_offset;
+ //! quantisation value
+ int m_qf;
- //! True if neighbours non-zero
- bool m_nhood_nonzero;
+ //! reconstruction point
+ CoeffType m_offset;
- //! the parent subband
- Subband m_pnode;
+ //! True if neighbours non-zero
+ bool m_nhood_nonzero;
- //! position of the parent coefficient
- int m_pxpos, m_pypos;
+ //! the parent subband
+ Subband m_pnode;
- //! True if the parent of a coeff is not zero
- bool m_parent_notzero;
+ //! position of the parent coefficient
+ int m_pxpos, m_pypos;
-};
+ //! True if the parent of a coeff is not zero
+ bool m_parent_notzero;
-//! A general class for coding and decoding wavelet subband data.
-/*!
- A general class for coding and decoding wavelet subband data, deriving from the abstract ArithCodec class.
- */
-typedef GenericBandCodec<ArithCodec<CoeffArray> > BandCodec;
-typedef BandCodec LFBandCodec;
+ };
-//////////////////////////////////////////////////////////////////////////////////
-//Finally,special class incorporating prediction for the DC band of intra frames//
-//////////////////////////////////////////////////////////////////////////////////
-
-//! A template class specially for coding the DC subband of Intra frames
-template<typename EntropyCodec>
-class GenericIntraDCBandCodec : public GenericBandCodec<EntropyCodec>
-{
-public:
- //! Constructor
+ //! A general class for coding and decoding wavelet subband data.
/*!
- Creates a IntraDCBandCodec object to encode subband data
- \param subband_byteio input/output for the encoded bits
- \param number_of_contexts the number of contexts used in the encoding process
- \param band_list the set of all the subbands
+ A general class for coding and decoding wavelet subband data, deriving from the abstract ArithCodec class.
*/
- GenericIntraDCBandCodec(SubbandByteIO* subband_byteio,
- size_t number_of_contexts,
- const SubbandList& band_list)
- : GenericBandCodec<EntropyCodec>(subband_byteio, number_of_contexts,
- band_list, band_list.Length(),
- true) {}
-
-protected:
- //! When coding a skipped block, propegate the predicted values for future non skipped blocks
- void ClearBlock(const CodeBlock& code_block , CoeffArray& coeff_data);
-
- //! Prediction of a DC value from its previously coded neighbours
- CoeffType GetPrediction(const CoeffArray& data , const int xpos , const int ypos) const;
-
- //! Decode codeblock of coefficients and perform DC prediction
- void DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data);
-};
-
-
-//! A class specially for coding the DC subband of Intra frames
-/*!
- A class specially for coding the DC subband of Intra frames, using
- intra-band prediction of coefficients. It uses the abstract ArithCodec
- class
-*/
-class IntraDCBandCodec: public GenericIntraDCBandCodec<ArithCodec<CoeffArray> >
-{
-public:
- //! Constructor
+ typedef GenericBandCodec<ArithCodec<CoeffArray> > BandCodec;
+ typedef BandCodec LFBandCodec;
+
+ //////////////////////////////////////////////////////////////////////////////////
+ //Finally,special class incorporating prediction for the DC band of intra frames//
+ //////////////////////////////////////////////////////////////////////////////////
+
+ //! A template class specially for coding the DC subband of Intra frames
+ template<typename EntropyCodec>
+ class GenericIntraDCBandCodec : public GenericBandCodec<EntropyCodec>
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a IntraDCBandCodec object to encode subband data
+ \param subband_byteio input/output for the encoded bits
+ \param number_of_contexts the number of contexts used in the encoding process
+ \param band_list the set of all the subbands
+ */
+ GenericIntraDCBandCodec(SubbandByteIO* subband_byteio,
+ size_t number_of_contexts,
+ const SubbandList& band_list)
+ : GenericBandCodec<EntropyCodec>(subband_byteio,number_of_contexts,
+ band_list, band_list.Length(),
+ true){}
+
+ protected:
+ //! When coding a skipped block, propegate the predicted values for future non skipped blocks
+ void ClearBlock( const CodeBlock& code_block , CoeffArray& coeff_data);
+
+ //! Prediction of a DC value from its previously coded neighbours
+ CoeffType GetPrediction(const CoeffArray& data , const int xpos , const int ypos ) const;
+
+ //! Decode codeblock of coefficients and perform DC prediction
+ void DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data);
+ };
+
+
+ //! A class specially for coding the DC subband of Intra frames
/*!
- Creates a IntraDCBandCodec object to encode subband data, based on parameters
- \param subband_byteio input/output for the encoded bits
- \param number_of_contexts the number of contexts used in the encoding process
- \param band_list the set of all the subbands
- */
- IntraDCBandCodec(SubbandByteIO* subband_byteio,
- size_t number_of_contexts,
- const SubbandList& band_list)
- : GenericIntraDCBandCodec<ArithCodec<CoeffArray> >(subband_byteio,
- number_of_contexts,
- band_list) {}
-
-
-private:
- //! Initialize extra data required for error-feedback DC quantization
- void DoWorkCode(CoeffArray& in_data); //overridden from the base class
-
- //! Ditto
- void DoWorkDecode(CoeffArray& out_data);
-
- //! Encode a single coefficient using error-feedback DC quantization
- void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
-
- //! Decode a single coefficient using error-feedback DC quantization
- void DecodeCoeff(CoeffArray& out_data, const int xpos, const int ypos);
-
- //! Private, bodyless copy constructor: class should not be copied
- IntraDCBandCodec(const IntraDCBandCodec& cpy);
-
- //! Private, bodyless copy operator=: class should not be assigned
- IntraDCBandCodec& operator=(const IntraDCBandCodec& rhs);
-
-private:
- CoeffArray m_dc_pred_res;
-};
+ A class specially for coding the DC subband of Intra frames, using
+ intra-band prediction of coefficients. It uses the abstract ArithCodec
+ class
+ */
+ class IntraDCBandCodec: public GenericIntraDCBandCodec<ArithCodec<CoeffArray> >
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a IntraDCBandCodec object to encode subband data, based on parameters
+ \param subband_byteio input/output for the encoded bits
+ \param number_of_contexts the number of contexts used in the encoding process
+ \param band_list the set of all the subbands
+ */
+ IntraDCBandCodec(SubbandByteIO* subband_byteio,
+ size_t number_of_contexts,
+ const SubbandList& band_list)
+ : GenericIntraDCBandCodec<ArithCodec<CoeffArray> >(subband_byteio,
+ number_of_contexts,
+ band_list){}
+
+
+ private:
+ //! Initialize extra data required for error-feedback DC quantization
+ void DoWorkCode(CoeffArray& in_data); //overridden from the base class
+
+ //! Ditto
+ void DoWorkDecode(CoeffArray& out_data);
+
+ //! Encode a single coefficient using error-feedback DC quantization
+ void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
+
+ //! Decode a single coefficient using error-feedback DC quantization
+ void DecodeCoeff(CoeffArray& out_data, const int xpos, const int ypos);
+
+ //! Private, bodyless copy constructor: class should not be copied
+ IntraDCBandCodec(const IntraDCBandCodec& cpy);
+
+ //! Private, bodyless copy operator=: class should not be assigned
+ IntraDCBandCodec& operator=(const IntraDCBandCodec& rhs);
+
+ private:
+ CoeffArray m_dc_pred_res;
+ };
}// end namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec_template.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec_template.h
index b1f924786..8ca94d089 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec_template.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_codec_template.h
@@ -7,18 +7,18 @@ using namespace dirac;
//! Constructor for encoding.
template<typename EntropyCodec>
GenericBandCodec<EntropyCodec>::GenericBandCodec(SubbandByteIO* subband_byteio,
- size_t number_of_contexts,
- const SubbandList & band_list,
- int band_num,
- const bool is_intra):
- EntropyCodec(subband_byteio, number_of_contexts),
+ size_t number_of_contexts,
+ const SubbandList & band_list,
+ int band_num,
+ const bool is_intra):
+ EntropyCodec(subband_byteio,number_of_contexts),
m_is_intra(is_intra),
m_bnum(band_num),
m_node(band_list(band_num)),
m_last_qf_idx(m_node.QuantIndex())
{
- if(m_node.Parent() != 0)
- m_pnode = band_list(m_node.Parent());
+ if (m_node.Parent()!=0)
+ m_pnode=band_list(m_node.Parent());
}
@@ -27,30 +27,30 @@ template<typename EntropyCodec>
void GenericBandCodec<EntropyCodec>::DoWorkCode(CoeffArray& in_data)
{
- const TwoDArray<CodeBlock>& block_list(m_node.GetCodeBlocks());
+ const TwoDArray<CodeBlock>& block_list( m_node.GetCodeBlocks() );
// coeff blocks can be skipped only if SpatialPartitioning is
// enabled i.e. more than one code-block per subband
bool code_skip = (block_list.LengthX() > 1 || block_list.LengthY() > 1);
// Now loop over the blocks and code
- for(int j = block_list.FirstY() ; j <= block_list.LastY() ; ++j)
+ for (int j=block_list.FirstY() ; j<=block_list.LastY() ; ++j)
{
CodeBlock *block = block_list[j];
- for(int i = block_list.FirstX() ; i <= block_list.LastX() ; ++i)
+ for (int i=block_list.FirstX() ; i<=block_list.LastX() ; ++i)
{
- if(code_skip)
- EntropyCodec::EncodeSymbol(block[i].Skipped() , BLOCK_SKIP_CTX);
- if(!block[i].Skipped())
- CodeCoeffBlock(block[i] , in_data);
+ if (code_skip)
+ EntropyCodec::EncodeSymbol(block[i].Skipped() , BLOCK_SKIP_CTX );
+ if ( !block[i].Skipped() )
+ CodeCoeffBlock( block[i] , in_data );
else
- ClearBlock(block[i] , in_data);
+ ClearBlock (block[i] , in_data);
}// i
}// j
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::CodeCoeffBlock(const CodeBlock& code_block , CoeffArray& in_data)
+void GenericBandCodec<EntropyCodec>::CodeCoeffBlock( const CodeBlock& code_block , CoeffArray& in_data )
{
//main coding function, using binarisation
@@ -63,39 +63,39 @@ void GenericBandCodec<EntropyCodec>::CodeCoeffBlock(const CodeBlock& code_block
bool has_parent = m_node.Parent() != 0;
- if(m_node.UsingMultiQuants())
+ if ( m_node.UsingMultiQuants() )
{
- CodeQuantIndexOffset(qf_idx - m_last_qf_idx);
- m_last_qf_idx = qf_idx;
+ CodeQuantIndexOffset( qf_idx - m_last_qf_idx);
+ m_last_qf_idx = qf_idx;
}
- m_qf = dirac_quantiser_lists.QuantFactor4(qf_idx);
- if(m_is_intra)
- m_offset = dirac_quantiser_lists.IntraQuantOffset4(qf_idx);
+ m_qf = dirac_quantiser_lists.QuantFactor4( qf_idx );
+ if (m_is_intra)
+ m_offset = dirac_quantiser_lists.IntraQuantOffset4( qf_idx );
else
- m_offset = dirac_quantiser_lists.InterQuantOffset4(qf_idx);
+ m_offset = dirac_quantiser_lists.InterQuantOffset4( qf_idx );
- for(int ypos = ybeg; ypos < yend ; ++ypos)
+ for ( int ypos=ybeg; ypos<yend ;++ypos)
{
- m_pypos = ((ypos - m_node.Yp()) >> 1) + m_pnode.Yp();
- for(int xpos = xbeg; xpos < xend ; ++xpos)
+ m_pypos=(( ypos-m_node.Yp() )>>1)+m_pnode.Yp();
+ for ( int xpos=xbeg; xpos<xend ;++xpos)
{
- m_pxpos = ((xpos - m_node.Xp()) >> 1) + m_pnode.Xp();
+ m_pxpos=(( xpos-m_node.Xp() )>>1)+m_pnode.Xp();
m_nhood_nonzero = false;
- if(ypos > m_node.Yp())
+ if (ypos > m_node.Yp())
m_nhood_nonzero |= bool(in_data[ypos-1][xpos]);
- if(xpos > m_node.Xp())
+ if (xpos > m_node.Xp())
m_nhood_nonzero |= bool(in_data[ypos][xpos-1]);
- if(ypos > m_node.Yp() && xpos > m_node.Xp())
+ if (ypos > m_node.Yp() && xpos > m_node.Xp())
m_nhood_nonzero |= bool(in_data[ypos-1][xpos-1]);
- if(has_parent)
- m_parent_notzero = static_cast<bool>(in_data[m_pypos][m_pxpos]);
+ if (has_parent)
+ m_parent_notzero = static_cast<bool> ( in_data[m_pypos][m_pxpos] );
else
m_parent_notzero = false;
- CodeCoeff(in_data , xpos , ypos);
+ CodeCoeff( in_data , xpos , ypos );
}// xpos
}// ypos
@@ -103,9 +103,9 @@ void GenericBandCodec<EntropyCodec>::CodeCoeffBlock(const CodeBlock& code_block
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos)
+void GenericBandCodec<EntropyCodec>::CodeCoeff( CoeffArray& in_data, const int xpos, const int ypos)
{
- CodeVal(in_data , xpos , ypos , in_data[ypos][xpos]);
+ CodeVal( in_data , xpos , ypos , in_data[ypos][xpos] );
}
@@ -128,99 +128,99 @@ based on position, and have different contexts from the info bits.
*/
template<typename EntropyCodec>
-inline void GenericBandCodec<EntropyCodec>::CodeVal(CoeffArray& in_data ,
- const int xpos ,
- const int ypos ,
- const CoeffType val)
+inline void GenericBandCodec<EntropyCodec>::CodeVal( CoeffArray& in_data ,
+ const int xpos ,
+ const int ypos ,
+ const CoeffType val )
{
- unsigned int abs_val(std::abs(val));
+ unsigned int abs_val( std::abs(val) );
abs_val <<= 2;
abs_val /= m_qf;
- const int N = abs_val + 1;
- int num_follow_zeroes = 0;
+ const int N = abs_val+1;
+ int num_follow_zeroes=0;
- while(N >= (1 << num_follow_zeroes))
+ while ( N >= (1<<num_follow_zeroes) )
++num_follow_zeroes;
--num_follow_zeroes;
- for(int i = num_follow_zeroes - 1, c = 1; i >= 0; --i, ++c)
+ for ( int i=num_follow_zeroes-1, c=1; i>=0; --i, ++c )
{
- EntropyCodec::EncodeSymbol(0, ChooseFollowContext(c));
- EntropyCodec::EncodeSymbol(N&(1 << i), ChooseInfoContext());
+ EntropyCodec::EncodeSymbol( 0, ChooseFollowContext( c ) );
+ EntropyCodec::EncodeSymbol( N&(1<<i), ChooseInfoContext() );
}
- EntropyCodec::EncodeSymbol(1, ChooseFollowContext(num_follow_zeroes + 1));
+ EntropyCodec::EncodeSymbol( 1, ChooseFollowContext( num_follow_zeroes+1 ) );
- in_data[ypos][xpos] = static_cast<CoeffType>(abs_val);
+ in_data[ypos][xpos] = static_cast<CoeffType>( abs_val );
- if(abs_val)
+ if ( abs_val )
{
// Must code sign bits and reconstruct
in_data[ypos][xpos] *= m_qf;
- in_data[ypos][xpos] += m_offset + 2;
+ in_data[ypos][xpos] += m_offset+2;
in_data[ypos][xpos] >>= 2;
- if(val > 0)
+ if ( val>0 )
{
- EntropyCodec::EncodeSymbol(0 , ChooseSignContext(in_data , xpos , ypos));
+ EntropyCodec::EncodeSymbol( 0 , ChooseSignContext( in_data , xpos , ypos ) );
}
else
{
- EntropyCodec::EncodeSymbol(1 , ChooseSignContext(in_data , xpos , ypos));
+ EntropyCodec::EncodeSymbol( 1 , ChooseSignContext( in_data , xpos , ypos ) );
in_data[ypos][xpos] = -in_data[ypos][xpos];
}
}
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::CodeQuantIndexOffset(const int offset)
+void GenericBandCodec<EntropyCodec>::CodeQuantIndexOffset( const int offset )
{
- const int abs_val = std::abs(offset);
+ const int abs_val = std::abs( offset );
- int N = abs_val + 1;
- int num_follow_zeroes = 0;
+ int N = abs_val+1;
+ int num_follow_zeroes=0;
- while(N >= (1 << num_follow_zeroes))
+ while ( N>= (1<<num_follow_zeroes) )
++num_follow_zeroes;
--num_follow_zeroes;
- for(int i = num_follow_zeroes - 1, c = 1; i >= 0; --i, ++c)
+ for ( int i=num_follow_zeroes-1, c=1; i>=0; --i, ++c )
{
- EntropyCodec::EncodeSymbol(0 , Q_OFFSET_FOLLOW_CTX);
- EntropyCodec::EncodeSymbol(N&(1 << i), Q_OFFSET_INFO_CTX);
+ EntropyCodec::EncodeSymbol( 0 , Q_OFFSET_FOLLOW_CTX );
+ EntropyCodec::EncodeSymbol( N&(1<<i), Q_OFFSET_INFO_CTX );
}
- EntropyCodec::EncodeSymbol(1 , Q_OFFSET_FOLLOW_CTX);
+ EntropyCodec::EncodeSymbol( 1 , Q_OFFSET_FOLLOW_CTX );
- if(abs_val)
+ if ( abs_val )
{
- if(offset > 0)
- EntropyCodec::EncodeSymbol(0 , Q_OFFSET_SIGN_CTX);
+ if ( offset>0 )
+ EntropyCodec::EncodeSymbol( 0 , Q_OFFSET_SIGN_CTX );
else
- EntropyCodec::EncodeSymbol(1 , Q_OFFSET_SIGN_CTX);
+ EntropyCodec::EncodeSymbol( 1 , Q_OFFSET_SIGN_CTX );
}
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::DoWorkDecode(CoeffArray& out_data)
+void GenericBandCodec<EntropyCodec>::DoWorkDecode( CoeffArray& out_data )
{
- const TwoDArray<CodeBlock>& block_list(m_node.GetCodeBlocks());
+ const TwoDArray<CodeBlock>& block_list( m_node.GetCodeBlocks() );
// coeff blocks can be skipped only if SpatialPartitioning is
// enabled i.e. more than one code-block per subband
- bool decode_skip = (block_list.LengthX() > 1 || block_list.LengthY() > 1);
+ bool decode_skip= (block_list.LengthX() > 1 || block_list.LengthY() > 1);
// Now loop over the blocks and decode
- for(int j = block_list.FirstY() ; j <= block_list.LastY() ; ++j)
+ for (int j=block_list.FirstY() ; j<=block_list.LastY() ; ++j)
{
CodeBlock *block = block_list[j];
- for(int i = block_list.FirstX() ; i <= block_list.LastX() ; ++i)
+ for (int i=block_list.FirstX() ; i<=block_list.LastX() ; ++i)
{
- if(decode_skip)
- block[i].SetSkip(EntropyCodec::DecodeSymbol(BLOCK_SKIP_CTX));
- if(!block[i].Skipped())
- DecodeCoeffBlock(block[i] , out_data);
+ if (decode_skip)
+ block[i].SetSkip( EntropyCodec::DecodeSymbol( BLOCK_SKIP_CTX ) );
+ if ( !block[i].Skipped() )
+ DecodeCoeffBlock( block[i] , out_data );
else
- ClearBlock(block[i] , out_data);
+ ClearBlock (block[i] , out_data);
}// i
}// j
@@ -228,7 +228,7 @@ void GenericBandCodec<EntropyCodec>::DoWorkDecode(CoeffArray& out_data)
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data)
+void GenericBandCodec<EntropyCodec>::DecodeCoeffBlock( const CodeBlock& code_block , CoeffArray& out_data )
{
@@ -241,13 +241,13 @@ void GenericBandCodec<EntropyCodec>::DecodeCoeffBlock(const CodeBlock& code_bloc
bool has_parent = m_node.Parent() != 0;
- if(m_node.UsingMultiQuants())
+ if ( m_node.UsingMultiQuants() )
{
- qf_idx = m_last_qf_idx + DecodeQuantIndexOffset();
+ qf_idx = m_last_qf_idx+DecodeQuantIndexOffset();
m_last_qf_idx = qf_idx;
}
- if(qf_idx > (int)dirac_quantiser_lists.MaxQuantIndex())
+ if (qf_idx > (int)dirac_quantiser_lists.MaxQuantIndex())
{
std::ostringstream errstr;
errstr << "Quantiser index out of range [0.."
@@ -258,54 +258,54 @@ void GenericBandCodec<EntropyCodec>::DecodeCoeffBlock(const CodeBlock& code_bloc
SEVERITY_PICTURE_ERROR);
}
- m_qf = dirac_quantiser_lists.QuantFactor4(qf_idx);
+ m_qf = dirac_quantiser_lists.QuantFactor4( qf_idx );
- if(m_is_intra)
- m_offset = dirac_quantiser_lists.IntraQuantOffset4(qf_idx);
+ if (m_is_intra)
+ m_offset = dirac_quantiser_lists.IntraQuantOffset4( qf_idx );
else
- m_offset = dirac_quantiser_lists.InterQuantOffset4(qf_idx);
+ m_offset = dirac_quantiser_lists.InterQuantOffset4( qf_idx );
//Work
- for(int ypos = ybeg; ypos < yend ; ++ypos)
+ for ( int ypos=ybeg; ypos<yend ;++ypos)
{
- m_pypos = ((ypos - m_node.Yp()) >> 1) + m_pnode.Yp();
+ m_pypos=(( ypos-m_node.Yp() )>>1)+m_pnode.Yp();
CoeffType *p_out_data = NULL;
- if(has_parent)
+ if (has_parent)
p_out_data = out_data[m_pypos];
CoeffType *c_out_data_1 = NULL;
- if(ypos != m_node.Yp())
+ if (ypos!=m_node.Yp())
c_out_data_1 = out_data[ypos-1];
CoeffType *c_out_data_2 = out_data[ypos];
- for(int xpos = xbeg; xpos < xend ; ++xpos)
+ for ( int xpos=xbeg; xpos<xend ;++xpos)
{
- m_pxpos = ((xpos - m_node.Xp()) >> 1) + m_pnode.Xp();
+ m_pxpos=(( xpos-m_node.Xp() )>>1)+m_pnode.Xp();
m_nhood_nonzero = false;
/* c_out_data_1 is the line above the current
* c_out_data_2 is the current line */
- if(ypos > m_node.Yp())
+ if (ypos > m_node.Yp())
m_nhood_nonzero |= bool(c_out_data_1[xpos]);
- if(xpos > m_node.Xp())
+ if (xpos > m_node.Xp())
m_nhood_nonzero |= bool(c_out_data_2[xpos-1]);
- if(ypos > m_node.Yp() && xpos > m_node.Xp())
+ if (ypos > m_node.Yp() && xpos > m_node.Xp())
m_nhood_nonzero |= bool(c_out_data_1[xpos-1]);
- if(has_parent)
- m_parent_notzero = (p_out_data[m_pxpos] != 0);
+ if (has_parent)
+ m_parent_notzero = ( p_out_data[m_pxpos] != 0 );
else
m_parent_notzero = false;
- DecodeCoeff(out_data , xpos , ypos);
+ DecodeCoeff( out_data , xpos , ypos );
}// xpos
}// ypos
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::DecodeCoeff(CoeffArray& in_data, const int xpos, const int ypos)
+void GenericBandCodec<EntropyCodec>::DecodeCoeff( CoeffArray& in_data, const int xpos, const int ypos)
{
- DecodeVal(in_data , xpos , ypos);
+ DecodeVal( in_data , xpos , ypos );
}
@@ -327,80 +327,80 @@ All bits are arithmetically coded. The follow bits have separate contexts
based on position, and have different contexts from the info bits.
*/
template<typename EntropyCodec>
-inline void GenericBandCodec<EntropyCodec>::DecodeVal(CoeffArray& out_data , const int xpos , const int ypos)
+inline void GenericBandCodec<EntropyCodec>::DecodeVal( CoeffArray& out_data , const int xpos , const int ypos )
{
CoeffType& out_pixel = out_data[ypos][xpos];
out_pixel = 1;
- int bit_count = 1;
+ int bit_count=1;
- while(!EntropyCodec::DecodeSymbol(ChooseFollowContext(bit_count)))
+ while ( !EntropyCodec::DecodeSymbol( ChooseFollowContext( bit_count ) ) )
{
out_pixel <<= 1;
- out_pixel |= EntropyCodec::DecodeSymbol(ChooseInfoContext());
+ out_pixel |= EntropyCodec::DecodeSymbol( ChooseInfoContext() );
bit_count++;
};
--out_pixel;
- if(out_pixel)
+ if ( out_pixel )
{
out_pixel *= m_qf;
- out_pixel += m_offset + 2;
+ out_pixel += m_offset+2;
out_pixel >>= 2;
- if(EntropyCodec::DecodeSymbol(ChooseSignContext(out_data, xpos, ypos)))
+ if ( EntropyCodec::DecodeSymbol( ChooseSignContext(out_data, xpos, ypos)) )
out_pixel = -out_pixel;
}
}
template<typename EntropyCodec>
-inline int GenericBandCodec<EntropyCodec>::ChooseFollowContext(const int bin_number) const
+inline int GenericBandCodec<EntropyCodec>::ChooseFollowContext( const int bin_number ) const
{
//condition on neighbouring values and parent values
- if(!m_parent_notzero)
+ if (!m_parent_notzero)
{
- switch(bin_number)
+ switch ( bin_number )
{
- case 1 :
- if(m_nhood_nonzero == false)
- return Z_FBIN1z_CTX;
-
- return Z_FBIN1nz_CTX;
-
- case 2 :
- return Z_FBIN2_CTX;
- case 3 :
- return Z_FBIN3_CTX;
- case 4 :
- return Z_FBIN4_CTX;
- case 5 :
- return Z_FBIN5_CTX;
- default :
- return Z_FBIN6plus_CTX;
+ case 1 :
+ if(m_nhood_nonzero == false)
+ return Z_FBIN1z_CTX;
+
+ return Z_FBIN1nz_CTX;
+
+ case 2 :
+ return Z_FBIN2_CTX;
+ case 3 :
+ return Z_FBIN3_CTX;
+ case 4 :
+ return Z_FBIN4_CTX;
+ case 5 :
+ return Z_FBIN5_CTX;
+ default :
+ return Z_FBIN6plus_CTX;
}
}
else
{
- switch(bin_number)
+ switch ( bin_number )
{
- case 1 :
- if(m_nhood_nonzero == false)
- return NZ_FBIN1z_CTX;
-
- return NZ_FBIN1nz_CTX;
-
- case 2 :
- return NZ_FBIN2_CTX;
- case 3 :
- return NZ_FBIN3_CTX;
- case 4 :
- return NZ_FBIN4_CTX;
- case 5 :
- return NZ_FBIN5_CTX;
- default :
- return NZ_FBIN6plus_CTX;
+ case 1 :
+ if(m_nhood_nonzero == false)
+ return NZ_FBIN1z_CTX;
+
+ return NZ_FBIN1nz_CTX;
+
+ case 2 :
+ return NZ_FBIN2_CTX;
+ case 3 :
+ return NZ_FBIN3_CTX;
+ case 4 :
+ return NZ_FBIN4_CTX;
+ case 5 :
+ return NZ_FBIN5_CTX;
+ default :
+ return NZ_FBIN6plus_CTX;
}
}
@@ -416,33 +416,33 @@ inline int GenericBandCodec<EntropyCodec>::ChooseInfoContext() const
}
template<typename EntropyCodec>
-inline int GenericBandCodec<EntropyCodec>::ChooseSignContext(const CoeffArray& data , const int xpos , const int ypos) const
+inline int GenericBandCodec<EntropyCodec>::ChooseSignContext( const CoeffArray& data , const int xpos , const int ypos ) const
{
- if(m_node.Yp() == 0 && m_node.Xp() != 0)
+ if ( m_node.Yp()==0 && m_node.Xp()!=0 )
{
//we're in a vertically oriented subband
- if(ypos == 0)
+ if (ypos == 0)
return SIGN0_CTX;
else
{
- if(data[ypos-1][xpos] > 0)
+ if (data[ypos-1][xpos]>0)
return SIGN_POS_CTX;
- else if(data[ypos-1][xpos] < 0)
+ else if (data[ypos-1][xpos]<0)
return SIGN_NEG_CTX;
else
return SIGN0_CTX;
}
}
- else if(m_node.Xp() == 0 && m_node.Yp() != 0)
+ else if ( m_node.Xp()==0 && m_node.Yp()!=0 )
{
//we're in a horizontally oriented subband
- if(xpos == 0)
+ if (xpos == 0)
return SIGN0_CTX;
else
{
- if(data[ypos][xpos-1] > 0)
+ if ( data[ypos][xpos-1] > 0 )
return SIGN_POS_CTX;
- else if(data[ypos][xpos-1] < 0)
+ else if ( data[ypos][xpos-1] < 0 )
return SIGN_NEG_CTX;
else
return SIGN0_CTX;
@@ -457,40 +457,40 @@ int GenericBandCodec<EntropyCodec>::DecodeQuantIndexOffset()
{
int offset = 1;
- while(!EntropyCodec::DecodeSymbol(Q_OFFSET_FOLLOW_CTX))
+ while ( !EntropyCodec::DecodeSymbol( Q_OFFSET_FOLLOW_CTX ) )
{
offset <<= 1;
- offset |= EntropyCodec::DecodeSymbol(Q_OFFSET_INFO_CTX);
+ offset |= EntropyCodec::DecodeSymbol( Q_OFFSET_INFO_CTX );
}
--offset;
- if(offset)
+ if ( offset )
{
- if(EntropyCodec::DecodeSymbol(Q_OFFSET_SIGN_CTX))
+ if ( EntropyCodec::DecodeSymbol( Q_OFFSET_SIGN_CTX ) )
offset = -offset;
}
return offset;
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::SetToVal(const CodeBlock& code_block , CoeffArray& pic_data , const CoeffType val)
+void GenericBandCodec<EntropyCodec>::SetToVal( const CodeBlock& code_block , CoeffArray& pic_data , const CoeffType val)
{
- for(int j = code_block.Ystart() ; j < code_block.Yend() ; j++)
+ for (int j=code_block.Ystart() ; j<code_block.Yend() ; j++)
{
- for(int i = code_block.Xstart() ; i < code_block.Xend() ; i++)
- {
+ for (int i=code_block.Xstart() ; i<code_block.Xend() ; i++)
+ {
pic_data[j][i] = val;
- }// i
+ }// i
}// j
}
template<typename EntropyCodec>
-void GenericBandCodec<EntropyCodec>::ClearBlock(const CodeBlock& code_block , CoeffArray& coeff_data)
+void GenericBandCodec<EntropyCodec>::ClearBlock( const CodeBlock& code_block , CoeffArray& coeff_data)
{
- for(int j = code_block.Ystart() ; j < code_block.Yend() ; j++)
+ for (int j=code_block.Ystart() ; j<code_block.Yend() ; j++)
{
CoeffType *pic = &coeff_data[j][code_block.Xstart()];
- memset(pic, 0, (code_block.Xend() - code_block.Xstart())*sizeof(CoeffType));
+ memset (pic, 0, (code_block.Xend()-code_block.Xstart())*sizeof(CoeffType));
}// j
}
@@ -501,11 +501,11 @@ void GenericIntraDCBandCodec<EntropyCodec>::DecodeCoeffBlock(const CodeBlock& co
{
GenericBandCodec<EntropyCodec>::DecodeCoeffBlock(code_block, out_data);
/* do prediction for this block */
- for(int ypos = code_block.Ystart() ; ypos < code_block.Yend() ; ++ypos)
+ for ( int ypos=code_block.Ystart() ; ypos<code_block.Yend() ; ++ypos)
{
- for(int xpos = code_block.Xstart() ; xpos < code_block.Xend() ; ++xpos)
+ for ( int xpos=code_block.Xstart() ; xpos<code_block.Xend() ; ++xpos)
{
- out_data[ypos][xpos] += GetPrediction(out_data , xpos , ypos);
+ out_data[ypos][xpos] += GetPrediction( out_data , xpos , ypos );
}
}
}
@@ -515,41 +515,41 @@ void GenericIntraDCBandCodec<EntropyCodec>::DecodeCoeffBlock(const CodeBlock& co
* predict the values in the next codeblock */
template<typename EntropyCodec>
-void GenericIntraDCBandCodec<EntropyCodec>::ClearBlock(const CodeBlock& code_block , CoeffArray& coeff_data)
+void GenericIntraDCBandCodec<EntropyCodec>::ClearBlock( const CodeBlock& code_block , CoeffArray& coeff_data)
{
- for(int ypos = code_block.Ystart() ; ypos < code_block.Yend() ; ++ypos)
+ for (int ypos=code_block.Ystart() ; ypos<code_block.Yend() ; ++ypos)
{
- for(int xpos = code_block.Xstart() ; xpos < code_block.Xend() ; ++xpos)
+ for (int xpos=code_block.Xstart() ; xpos<code_block.Xend() ; ++xpos)
{
/* NB, it is correct to overwrite the old value */
- coeff_data[ypos][xpos] = GetPrediction(coeff_data , xpos , ypos);
+ coeff_data[ypos][xpos] = GetPrediction( coeff_data , xpos , ypos );
} // i
} // j
}
template<typename EntropyCodec>
-CoeffType GenericIntraDCBandCodec<EntropyCodec>::GetPrediction(const CoeffArray& data , const int xpos , const int ypos) const
+CoeffType GenericIntraDCBandCodec<EntropyCodec>::GetPrediction( const CoeffArray& data , const int xpos , const int ypos ) const
{
/* NB, 4.5.3 integer division
* numbers are rounded down towards -ve infinity, differing from
* C's convention that rounds towards 0
*/
- if(ypos != 0)
+ if (ypos!=0)
{
- if(xpos != 0)
+ if (xpos!=0)
{
- int sum = data[ypos][xpos-1] + data[ypos-1][xpos-1] + data[ypos-1][xpos] + 3 / 2;
- if(sum < 0)
- return (sum - 2) / 3;
+ int sum = data[ypos][xpos-1] + data[ypos-1][xpos-1] + data[ypos-1][xpos] + 3/2;
+ if (sum<0)
+ return (sum-2)/3;
else
- return sum / 3;
+ return sum/3;
}
else
return data[ypos - 1][0];
}
else
{
- if(xpos != 0)
+ if(xpos!=0)
return data[0][xpos - 1];
else
return 0;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.cpp
index 9ea1aa081..b6ddf5337 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.cpp
@@ -47,8 +47,8 @@
using namespace dirac;
ArithCodecToVLCAdapter::ArithCodecToVLCAdapter(
- SubbandByteIO* subband_byteio,
- size_t /*number_of_contexts*/):
+ SubbandByteIO* subband_byteio,
+ size_t /*number_of_contexts*/):
m_byteio(subband_byteio)
{}
@@ -82,19 +82,19 @@ GenericIntraDCBandCodec<ArithCodecToVLCAdapter>::GenericIntraDCBandCodec(
const SubbandList & band_list);
IntraDCBandVLC::IntraDCBandVLC(SubbandByteIO* subband_byteio,
- const SubbandList& band_list):
+ const SubbandList& band_list):
GenericIntraDCBandCodec<ArithCodecToVLCAdapter>(subband_byteio, 0, band_list)
{}
-void IntraDCBandVLC::CodeCoeff(CoeffArray& in_data ,
- const int xpos ,
- const int ypos)
+void IntraDCBandVLC::CodeCoeff( CoeffArray& in_data ,
+ const int xpos ,
+ const int ypos )
{
CoeffType val, prediction;
- prediction = GetPrediction(in_data, xpos, ypos);
+ prediction = GetPrediction( in_data, xpos, ypos );
val = in_data[ypos][xpos] - prediction;
- CodeVal(in_data , xpos , ypos , val);
+ CodeVal( in_data , xpos , ypos , val );
in_data[ypos][xpos] += prediction;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.h
index 4cde9849c..597802d26 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/band_vlc.h
@@ -48,92 +48,92 @@
namespace dirac
{
-class SubbandByteIO;
-class ByteIO;
+ class SubbandByteIO;
+ class ByteIO;
-/*! Abstract VLC entropy codec base class */
-class ArithCodecToVLCAdapter
-{
-public:
- /*! Constructor */
- ArithCodecToVLCAdapter(SubbandByteIO* subband_byteio, size_t number_of_contexts);
+ /*! Abstract VLC entropy codec base class */
+ class ArithCodecToVLCAdapter
+ {
+ public:
+ /*! Constructor */
+ ArithCodecToVLCAdapter(SubbandByteIO* subband_byteio, size_t number_of_contexts);
- /*! Virtual Destructor */
- virtual ~ArithCodecToVLCAdapter() {}
+ /*! Virtual Destructor */
+ virtual ~ArithCodecToVLCAdapter(){}
- /* Compresses the input and returns the number of bits written */
- int Compress(CoeffArray &in_data);
+ /* Compresses the input and returns the number of bits written */
+ int Compress (CoeffArray &in_data);
- /* Decompresses the bitstream */
- void Decompress(CoeffArray& out_data, int num_bytes);
+ /* Decompresses the bitstream */
+ void Decompress (CoeffArray& out_data, int num_bytes);
- /* Encodes a symbol and writes to the output */
- void EncodeSymbol(bool val, int /*context_num*/)
- {
- m_byteio->WriteBit(val);
- }
+ /* Encodes a symbol and writes to the output */
+ void EncodeSymbol(bool val, int /*context_num*/)
+ {
+ m_byteio->WriteBit(val);
+ }
- /* Decodes a symbol */
- bool DecodeSymbol(int /*context_num*/)
- {
- return m_byteio->ReadBoolB();
- }
-
- /*! Purely virtual function that does the actual encoding. Derived classes must define it */
- virtual void DoWorkCode(CoeffArray &in_data) = 0;
-
- /*! Purely virtual function that does the actual decoding. Derived classes must define it */
- virtual void DoWorkDecode(CoeffArray &out_data) = 0;
-
-protected:
- /*! Input/output stream for Dirac-format bytes */
- ByteIO *m_byteio;
-
-private:
- //! Private, bodyless copy constructor: class should not be copied
- ArithCodecToVLCAdapter(const ArithCodecToVLCAdapter& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- ArithCodecToVLCAdapter& operator=(const ArithCodecToVLCAdapter& rhs);
-};
-
-
-//! A general class for coding and decoding wavelet subband data using variable length coding.
-/*!
- A general class for coding and decoding wavelet subband data using variable length coding,
- */
-typedef GenericBandCodec<ArithCodecToVLCAdapter> BandVLC;
-
-//////////////////////////////////////////////////////////////////////////////////
-//Finally,special class incorporating prediction for the DC band of intra frames//
-//////////////////////////////////////////////////////////////////////////////////
-
-//! A class specially for coding the DC subband of Intra frames
-/*!
- A class specially for coding the DC subband of Intra frames, using intra-band prediction
- of coefficients.
-*/
-class IntraDCBandVLC: public GenericIntraDCBandCodec<ArithCodecToVLCAdapter>
-{
-public:
- //! Constructor
+ /* Decodes a symbol */
+ bool DecodeSymbol(int /*context_num*/)
+ {
+ return m_byteio->ReadBoolB();
+ }
+
+ /*! Purely virtual function that does the actual encoding. Derived classes must define it */
+ virtual void DoWorkCode(CoeffArray &in_data) = 0;
+
+ /*! Purely virtual function that does the actual decoding. Derived classes must define it */
+ virtual void DoWorkDecode(CoeffArray &out_data) = 0;
+
+ protected:
+ /*! Input/output stream for Dirac-format bytes */
+ ByteIO *m_byteio;
+
+ private:
+ //! Private, bodyless copy constructor: class should not be copied
+ ArithCodecToVLCAdapter(const ArithCodecToVLCAdapter& cpy);
+ //! Private, bodyless copy operator=: class should not be assigned
+ ArithCodecToVLCAdapter& operator=(const ArithCodecToVLCAdapter& rhs);
+ };
+
+
+ //! A general class for coding and decoding wavelet subband data using variable length coding.
/*!
- Creates a IntraDCBandVLC object to encode subband data, based on parameters
- \param subband_byteio input/output for the encoded bits
- \param band_list the set of all the subbands
+ A general class for coding and decoding wavelet subband data using variable length coding,
*/
- IntraDCBandVLC(SubbandByteIO* subband_byteio,
- const SubbandList& band_list);
-private:
- //! Encode a single coefficient using error-feedback DC quantization
- void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
-
-private:
- //! Private, bodyless copy constructor: class should not be copied
- IntraDCBandVLC(const IntraDCBandVLC& cpy);
-
- //! Private, bodyless copy operator=: class should not be assigned
- IntraDCBandVLC& operator=(const IntraDCBandVLC& rhs);
-};
+ typedef GenericBandCodec<ArithCodecToVLCAdapter> BandVLC;
+
+ //////////////////////////////////////////////////////////////////////////////////
+ //Finally,special class incorporating prediction for the DC band of intra frames//
+ //////////////////////////////////////////////////////////////////////////////////
+
+ //! A class specially for coding the DC subband of Intra frames
+ /*!
+ A class specially for coding the DC subband of Intra frames, using intra-band prediction
+ of coefficients.
+ */
+ class IntraDCBandVLC: public GenericIntraDCBandCodec<ArithCodecToVLCAdapter>
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a IntraDCBandVLC object to encode subband data, based on parameters
+ \param subband_byteio input/output for the encoded bits
+ \param band_list the set of all the subbands
+ */
+ IntraDCBandVLC(SubbandByteIO* subband_byteio,
+ const SubbandList& band_list);
+ private:
+ //! Encode a single coefficient using error-feedback DC quantization
+ void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
+
+ private:
+ //! Private, bodyless copy constructor: class should not be copied
+ IntraDCBandVLC (const IntraDCBandVLC& cpy);
+
+ //! Private, bodyless copy operator=: class should not be assigned
+ IntraDCBandVLC& operator=(const IntraDCBandVLC& rhs);
+ };
}// end namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.cpp
index 7a3470ad8..aed3d145c 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.cpp
@@ -49,7 +49,7 @@ using std::vector;
////////////////
//Constructor
-BasicOutputManager::BasicOutputManager(std::ostream* out_data):
+BasicOutputManager::BasicOutputManager(std::ostream* out_data ):
m_num_out_bytes(0),
m_op_ptr(out_data)
{
@@ -59,9 +59,9 @@ BasicOutputManager::BasicOutputManager(std::ostream* out_data):
void BasicOutputManager::InitOutputStream()
{
// Set byte pointer to start of buffer
- m_current_byte = 0;
- // Set output mask to MSB of byte
- m_output_mask = 0x80;
+ m_current_byte = 0;
+ // Set output mask to MSB of byte
+ m_output_mask = 0x80;
// Reset the output buffer
m_buffer.clear();
}
@@ -69,82 +69,82 @@ void BasicOutputManager::InitOutputStream()
void BasicOutputManager::OutputSkipInterpretStartPrefixByte()
{
size_t buf_size = m_buffer.size();
- if(buf_size >= 4 &&
- m_buffer[buf_size-1] == (char)START_CODE_PREFIX_BYTE3 &&
- m_buffer[buf_size-2] == (char)START_CODE_PREFIX_BYTE2 &&
- m_buffer[buf_size-3] == (char)START_CODE_PREFIX_BYTE1 &&
- m_buffer[buf_size-4] == (char)START_CODE_PREFIX_BYTE0)
+ if (buf_size >=4 &&
+ m_buffer[buf_size-1] == (char)START_CODE_PREFIX_BYTE3 &&
+ m_buffer[buf_size-2] == (char)START_CODE_PREFIX_BYTE2 &&
+ m_buffer[buf_size-3] == (char)START_CODE_PREFIX_BYTE1 &&
+ m_buffer[buf_size-4] == (char)START_CODE_PREFIX_BYTE0)
{
m_buffer.push_back((char)NOT_START_CODE);
std::cerr << "Wrote ignore code " << std::endl;
}
}
-void BasicOutputManager::OutputBit(const bool& bit)
+void BasicOutputManager::OutputBit(const bool& bit )
{
- m_current_byte |= (bit ? (m_output_mask) : 0);
+ m_current_byte |= (bit ? (m_output_mask):0);
// Shift mask to next bit in the output byte
- m_output_mask >>= 1;
+ m_output_mask >>= 1;
- if(m_output_mask == 0)
- {
+ if ( m_output_mask == 0 )
+ {
// If a whole byte has been written, write out
m_output_mask = 0x80;
m_buffer.push_back(m_current_byte);
OutputSkipInterpretStartPrefixByte();
m_current_byte = 0;
- }
+ }
}
void BasicOutputManager::OutputBit(const bool& bit, int& count)
{
OutputBit(bit);
- count++;
+ count++;
}
void BasicOutputManager::OutputByte(const char& byte)
{
FlushOutput();
- m_buffer.push_back(byte);
+ m_buffer.push_back( byte );
OutputSkipInterpretStartPrefixByte();
}
-void BasicOutputManager::OutputBytes(char* str_array)
+void BasicOutputManager::OutputBytes( char* str_array )
{
FlushOutput();
- while(*str_array != 0)
+ while ( *str_array != 0 )
{
- m_buffer.push_back(*str_array);
+ m_buffer.push_back( *str_array );
str_array++;
}
}
-void BasicOutputManager::OutputBytes(char* str_array, int num)
+void BasicOutputManager::OutputBytes(char* str_array,int num)
{
FlushOutput();
- for(int i = 0 ; i < num ; ++i)
- m_buffer.push_back(str_array[i]);
+ for ( int i=0 ; i<num ; ++i )
+ m_buffer.push_back( str_array[i] );
}
void BasicOutputManager::WriteToFile()
{
FlushOutput();
- for(vector<char>::iterator it = m_buffer.begin() ; it != m_buffer.end() ; ++it)
+ for ( vector<char>::iterator it=m_buffer.begin() ; it!=m_buffer.end() ; ++it )
{
- m_op_ptr->write(&(*it) , 1);
+ m_op_ptr->write( &( *it ) , 1 );
}
m_num_out_bytes = m_buffer.size();
- InitOutputStream();
+ InitOutputStream();
}
void BasicOutputManager::FlushOutput()
{
// Flush the current byte to output buffer and reset
- if(m_output_mask != 0x80)
+ if ( m_output_mask != 0x80 )
{
- m_buffer.push_back(m_current_byte);
+ m_buffer.push_back( m_current_byte );
m_current_byte = 0;
m_output_mask = 0x80;
}
@@ -152,27 +152,27 @@ void BasicOutputManager::FlushOutput()
size_t BasicOutputManager::Size() const
{
- if(m_output_mask == 0x80)
+ if ( m_output_mask==0x80 )
return m_buffer.size();
else
- return m_buffer.size() + 1;
+ return m_buffer.size()+1;
}
// Unit output - a subband or the MV data, for example //
-UnitOutputManager::UnitOutputManager(std::ostream* out_data):
+UnitOutputManager::UnitOutputManager(std::ostream* out_data ):
m_header(out_data),
m_data(out_data),
m_unit_bytes(0),
m_unit_data_bytes(0),
m_unit_head_bytes(0)
-{}
+ {}
void UnitOutputManager::WriteToFile()
{
m_header.WriteToFile();
m_data.WriteToFile();
-
+
// after writing to file, get the number of unit bytes written
m_unit_data_bytes = m_data.GetNumBytes();
m_unit_head_bytes = m_header.GetNumBytes();
@@ -182,16 +182,16 @@ void UnitOutputManager::WriteToFile()
size_t UnitOutputManager::Size() const
{
- return m_data.Size() + m_header.Size();
+ return m_data.Size()+m_header.Size();
}
-FrameOutputManager::FrameOutputManager(std::ostream* out_data , int num_bands) :
- m_data_array(3 , num_bands),
- m_comp_bytes(3),
- m_comp_hdr_bytes(3),
- m_out_stream(out_data)
+FrameOutputManager::FrameOutputManager( std::ostream* out_data , int num_bands ) :
+ m_data_array( 3 , num_bands ),
+ m_comp_bytes( 3 ),
+ m_comp_hdr_bytes( 3 ),
+ m_out_stream( out_data )
{
- Init(num_bands);
+ Init( num_bands );
}
FrameOutputManager::~FrameOutputManager()
@@ -218,13 +218,13 @@ void FrameOutputManager::WriteToFile()
m_header_bytes += m_mv_hdr_bytes;
// Write out the component data
- for(int c = 0 ; c < 3 ; ++c)
+ for ( int c=0 ; c<3 ; ++c)
{
m_comp_hdr_bytes[c] = 0;
m_comp_bytes[c] = 0;
- for(int b = m_data_array.LastX() ; b >= 0 ; --b)
+ for ( int b=m_data_array.LastX() ; b>=0 ; --b)
{
m_data_array[c][b]->WriteToFile();
// after writing to file, get the number of bytes written
@@ -234,52 +234,52 @@ void FrameOutputManager::WriteToFile()
}// c
- for(int c = 0 ; c < m_data_array.LengthY() ; ++c)
+ for ( int c=0 ; c<m_data_array.LengthY() ; ++c)
{
m_total_bytes += m_comp_bytes[c];
m_header_bytes += m_comp_hdr_bytes[c];
}
}
-UnitOutputManager& FrameOutputManager::BandOutput(const int csort , const int band_num)
+UnitOutputManager& FrameOutputManager::BandOutput( const int csort , const int band_num)
{
- return *(m_data_array[csort][band_num-1]);
+ return *( m_data_array[csort][band_num-1] );
}
-const UnitOutputManager& FrameOutputManager::BandOutput(const int csort , const int band_num) const
+const UnitOutputManager& FrameOutputManager::BandOutput( const int csort , const int band_num) const
{
- return *(m_data_array[csort][band_num-1]);
+ return *( m_data_array[csort][band_num-1] );
}
// Picture stuff
-void FrameOutputManager::Init(int num_bands)
+void FrameOutputManager::Init( int num_bands )
{
// Initialise output for the picture header
- m_frame_header = new BasicOutputManager(m_out_stream);
+ m_frame_header = new BasicOutputManager( m_out_stream );
// Initialise output for the MV data
- m_mv_data = new UnitOutputManager(m_out_stream);
+ m_mv_data = new UnitOutputManager( m_out_stream );
// Initialise subband outputs
- for(int c = 0 ; c < 3 ; ++c)
- for(int b = 0 ; b < num_bands ; ++b)
- m_data_array[c][b] = new UnitOutputManager(m_out_stream);
+ for ( int c=0 ; c<3 ; ++c)
+ for ( int b=0 ; b<num_bands ; ++b)
+ m_data_array[c][b] = new UnitOutputManager( m_out_stream );
}
void FrameOutputManager::Reset()
{
const int num_bands = m_data_array.LengthX();
DeleteAll();
- Init(num_bands);
-}
+ Init( num_bands );
+}
void FrameOutputManager::DeleteAll()
{
// Delete subband outputs
- for(int c = 0 ; c < 3 ; ++c)
- for(int b = 0 ; b < m_data_array.LengthX() ; ++b)
+ for ( int c=0 ; c<3 ; ++c)
+ for ( int b=0 ; b<m_data_array.LengthX() ; ++b )
delete m_data_array[c][b];
// Delete MV data op
@@ -287,7 +287,7 @@ void FrameOutputManager::DeleteAll()
// Delete picture header op
delete m_frame_header;
-}
+}
size_t FrameOutputManager::Size() const
{
@@ -295,9 +295,9 @@ size_t FrameOutputManager::Size() const
size += m_frame_header->Size();
- for(int c = 0 ; c < 3 ; ++c)
+ for ( int c=0 ; c<3 ; ++c)
{
- for(int b = 0 ; b < m_data_array.LengthX() ; ++b)
+ for ( int b=0 ; b<m_data_array.LengthX() ; ++b )
{
size += m_data_array[c][b]->Size();
}
@@ -306,17 +306,17 @@ size_t FrameOutputManager::Size() const
size += m_mv_data->Size();
return size;
-}
+}
// Sequence stuff //
-SequenceOutputManager::SequenceOutputManager(std::ostream* out_data):
- m_frame_op_mgr(out_data),
- m_seq_header(out_data),
- m_seq_end(out_data),
- m_comp_bytes(3),
- m_comp_hdr_bytes(3),
+SequenceOutputManager::SequenceOutputManager( std::ostream* out_data ):
+ m_frame_op_mgr( out_data ),
+ m_seq_header( out_data ),
+ m_seq_end( out_data ),
+ m_comp_bytes( 3 ),
+ m_comp_hdr_bytes( 3 ),
m_mv_hdr_bytes(0),
m_mv_bytes(0),
m_total_bytes(0),
@@ -324,7 +324,7 @@ SequenceOutputManager::SequenceOutputManager(std::ostream* out_data):
m_trailer_bytes(0)
{
- for(int c = 0 ; c < 3 ; ++c)
+ for (int c=0 ; c<3 ; ++c )
{
m_comp_hdr_bytes[c] = 0;
m_comp_bytes[c] = 0;
@@ -334,12 +334,12 @@ SequenceOutputManager::SequenceOutputManager(std::ostream* out_data):
void SequenceOutputManager::WriteFrameData()
{
m_frame_op_mgr.WriteToFile();
-
+
// Keep up with count of component bytes
- for(int c = 0 ; c < m_comp_hdr_bytes.Length(); ++c)
+ for (int c=0 ; c<m_comp_hdr_bytes.Length(); ++c)
{
- m_comp_hdr_bytes[c] += m_frame_op_mgr.ComponentHeadBytes(c);
- m_comp_bytes[c] += m_frame_op_mgr.ComponentBytes(c);
+ m_comp_hdr_bytes[c] += m_frame_op_mgr.ComponentHeadBytes( c );
+ m_comp_bytes[c] += m_frame_op_mgr.ComponentBytes( c );
}// c
// Keep up with count of MV bytes
@@ -371,7 +371,7 @@ void SequenceOutputManager::WriteSeqTrailerToFile()
////////////////
//Constructor
-BitInputManager::BitInputManager(std::istream* in_data):
+BitInputManager::BitInputManager(std::istream* in_data ):
m_ip_ptr(in_data)
{
InitInputStream();
@@ -386,16 +386,16 @@ void BitInputManager::InitInputStream()
bool BitInputManager::InputBit()
{
- //assumes mode errors will be caught by iostream class
+ //assumes mode errors will be caught by iostream class
- if(m_input_bits_left == 0)
+ if (m_input_bits_left == 0)
{
- m_ip_ptr->read(&m_current_byte, 1);
+ m_ip_ptr->read(&m_current_byte,1);
m_input_bits_left = 8;
- if(m_shift == START_CODE_PREFIX && (unsigned char)m_current_byte == NOT_START_CODE)
+ if (m_shift == START_CODE_PREFIX && (unsigned char)m_current_byte == NOT_START_CODE)
{
std::cerr << "Ignoring byte " << std::endl;
- m_ip_ptr->read(&m_current_byte, 1);
+ m_ip_ptr->read(&m_current_byte,1);
m_shift = 0xffffffff;
}
m_shift = (m_shift << 8) | m_current_byte;
@@ -403,7 +403,7 @@ bool BitInputManager::InputBit()
m_input_bits_left--;
- return bool((m_current_byte >> m_input_bits_left) & 1);
+ return bool( ( m_current_byte >> m_input_bits_left ) & 1 );
}
@@ -415,7 +415,7 @@ bool BitInputManager::InputBit(int& count)
bool BitInputManager::InputBit(int& count, const int max_count)
{
- if(count < max_count)
+ if ( count<max_count )
{
count++;
return InputBit();
@@ -426,29 +426,29 @@ bool BitInputManager::InputBit(int& count, const int max_count)
char BitInputManager::InputByte()
{
- // Forget about what's in the current byte
+ // Forget about what's in the current byte
FlushInput();
char byte;
- m_ip_ptr->read(&byte, 1);
+ m_ip_ptr->read(&byte,1);
- return byte;
+ return byte;
}
void BitInputManager::InputBytes(char* cptr, int num)
{
- // Forget about what's in the current byte
+ // Forget about what's in the current byte
FlushInput();
- m_ip_ptr->read(cptr, num);
+ m_ip_ptr->read(cptr,num);
}
void BitInputManager::FlushInput()
{
- m_input_bits_left = 0;
+ m_input_bits_left = 0;
}
-bool BitInputManager::End() const
+bool BitInputManager::End() const
{
- return m_ip_ptr->eof();
+ return m_ip_ptr->eof();
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.h
index 194fca1e0..6f75e8004 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/bit_manager.h
@@ -48,543 +48,477 @@
namespace dirac
{
-//! Prefix for all start codes
-const unsigned int START_CODE_PREFIX = 0x42424344; //BBCD
-const unsigned int START_CODE_PREFIX_BYTE0 =
- (START_CODE_PREFIX >> 24) & 0xFF;
-const unsigned int START_CODE_PREFIX_BYTE1 =
- (START_CODE_PREFIX >> 16) & 0xFF;
-const unsigned int START_CODE_PREFIX_BYTE2 =
- (START_CODE_PREFIX >> 8) & 0xFF;
-const unsigned int START_CODE_PREFIX_BYTE3 =
- START_CODE_PREFIX & 0xFF;
-
-//! Random Access Point (RAP) Intra Picture start Code
-const unsigned char RAP_START_CODE = 0xD7;
-//! Non-RAP Intra Picture start code
-const unsigned char IFRAME_START_CODE = 0xD6;
-//! L1 Picture start code
-const unsigned char L1FRAME_START_CODE = 0xD4;
-//! L2 Picture start code
-const unsigned char L2FRAME_START_CODE = 0xD5;
-//! Sequence end code
-const unsigned char SEQ_END_CODE = 0xD0;
-//! Not a start code but part of data
-const unsigned char NOT_START_CODE = 0xFF;
-//! Bitstream version
-const unsigned char BITSTREAM_VERSION = 0x05; //0.5
-
-
-////////////////////////////////////////////////
-//--------------Bit output stuff--------------//
-////////////////////////////////////////////////
-
-class UnitOutputManager;
-class FrameOutputManager;
-class SequenceOutputManager;
-
-//! Class for managing bit- and byte-oriented output.
-/*!
- A class for managing bit- and byte-oriented output. Wraps around
- an ostream object but stores data in memory until told told to
- write out in order to support data re-ordering - for example
- writing a header once the subsequent data has been obtained.
- Implementation to be reviewed in future. TJD 13 April 2004.
-*/
-class BasicOutputManager
-{
- // Data cannot be written to file directly, only by other o/p classes
- friend class UnitOutputManager;
- friend class FrameOutputManager;
- friend class SequenceOutputManager;
-
-public:
- //! Constructor
+ //! Prefix for all start codes
+ const unsigned int START_CODE_PREFIX = 0x42424344; //BBCD
+ const unsigned int START_CODE_PREFIX_BYTE0 =
+ (START_CODE_PREFIX >> 24) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE1 =
+ (START_CODE_PREFIX >> 16) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE2 =
+ (START_CODE_PREFIX >> 8) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE3 =
+ START_CODE_PREFIX & 0xFF;
+
+ //! Random Access Point (RAP) Intra Picture start Code
+ const unsigned char RAP_START_CODE = 0xD7;
+ //! Non-RAP Intra Picture start code
+ const unsigned char IFRAME_START_CODE = 0xD6;
+ //! L1 Picture start code
+ const unsigned char L1FRAME_START_CODE = 0xD4;
+ //! L2 Picture start code
+ const unsigned char L2FRAME_START_CODE = 0xD5;
+ //! Sequence end code
+ const unsigned char SEQ_END_CODE = 0xD0;
+ //! Not a start code but part of data
+ const unsigned char NOT_START_CODE = 0xFF;
+ //! Bitstream version
+ const unsigned char BITSTREAM_VERSION = 0x05; //0.5
+
+
+ ////////////////////////////////////////////////
+ //--------------Bit output stuff--------------//
+ ////////////////////////////////////////////////
+
+ class UnitOutputManager;
+ class FrameOutputManager;
+ class SequenceOutputManager;
+
+ //! Class for managing bit- and byte-oriented output.
/*!
- Constructor requires an ostream object pointer.
- \param out_data the output stream object pointer
+ A class for managing bit- and byte-oriented output. Wraps around
+ an ostream object but stores data in memory until told told to
+ write out in order to support data re-ordering - for example
+ writing a header once the subsequent data has been obtained.
+ Implementation to be reviewed in future. TJD 13 April 2004.
*/
- BasicOutputManager(std::ostream* out_data);
-
- //Copy constructor is default shallow copy
-
- //Operator= is default shallow=
-
- //! Destructor
- ~BasicOutputManager() {}
-
- //! Write a bit out.
- /*!
- Write a bit out to the internal data cache.
- */
- void OutputBit(const bool& bit);
-
- //! Write a bit out and increment count
- /*!
- Write a bit out to the internal data cache and increment the
- count of bits written.
- */
- void OutputBit(const bool& bit, int& count);
-
- //! Write a byte out.
- /*!
- Write a byte out to the internal data cache.
- */
- void OutputByte(const char& byte);
-
- //! Write a null-terminated set of bytes out.
- /*!
- Write a null-terminated set of bytes out to the internal data cache.
- */
- void OutputBytes(char* str_array);
-
- //! Write a number of bytes out.
- /*!
- Write a number of bytes out to the internal data cache.
- */
- void OutputBytes(char* str_array, int num);
-
- //! Return the number of bytes last output to file.
- /*!
- Return the number of bytes last output to file.
- */
- size_t GetNumBytes() const
+ class BasicOutputManager
{
- return m_num_out_bytes;
- }
-
- //! Current size of the internal data cache in bytes.
+ // Data cannot be written to file directly, only by other o/p classes
+ friend class UnitOutputManager;
+ friend class FrameOutputManager;
+ friend class SequenceOutputManager;
+
+ public:
+ //! Constructor
+ /*!
+ Constructor requires an ostream object pointer.
+ \param out_data the output stream object pointer
+ */
+ BasicOutputManager(std::ostream* out_data );
+
+ //Copy constructor is default shallow copy
+
+ //Operator= is default shallow=
+
+ //! Destructor
+ ~BasicOutputManager(){}
+
+ //! Write a bit out.
+ /*!
+ Write a bit out to the internal data cache.
+ */
+ void OutputBit(const bool& bit);
+
+ //! Write a bit out and increment count
+ /*!
+ Write a bit out to the internal data cache and increment the
+ count of bits written.
+ */
+ void OutputBit(const bool& bit,int& count);
+
+ //! Write a byte out.
+ /*!
+ Write a byte out to the internal data cache.
+ */
+ void OutputByte(const char& byte);
+
+ //! Write a null-terminated set of bytes out.
+ /*!
+ Write a null-terminated set of bytes out to the internal data cache.
+ */
+ void OutputBytes(char* str_array);
+
+ //! Write a number of bytes out.
+ /*!
+ Write a number of bytes out to the internal data cache.
+ */
+ void OutputBytes(char* str_array,int num);
+
+ //! Return the number of bytes last output to file.
+ /*!
+ Return the number of bytes last output to file.
+ */
+ size_t GetNumBytes() const {return m_num_out_bytes;}
+
+ //! Current size of the internal data cache in bytes.
+ /*!
+ Current size of the internal data cache in bytes.
+ */
+ size_t Size() const;
+
+ private:
+ // Number of output bytes written
+ size_t m_num_out_bytes;
+ std::ostream* m_op_ptr;
+ // Buffer used to store output prior to saving to file
+ std::vector<char> m_buffer;
+ // Char used for temporary storage of op data bits
+ char m_current_byte;
+ // Used to set individual bit within the current header byte
+ int m_output_mask;
+
+ //functions
+
+ //! Write all data to file.
+ /*!
+ Dump the internal data cache to the internal ostream object.
+ */
+ void WriteToFile();
+
+ //Initialise the output stream.
+ void InitOutputStream();
+
+ //Clean out any remaining output bits to the buffer
+ void FlushOutput();
+
+ //! Write an ignore code
+ /*!
+ Write a skip interpret start prefix byte out to the internal data
+ cache.
+ */
+ void OutputSkipInterpretStartPrefixByte();
+ };
+
+ //! A class for handling data output, including headers.
/*!
- Current size of the internal data cache in bytes.
+ A class for handling data output, including headers and reordering.
*/
- size_t Size() const;
-
-private:
- // Number of output bytes written
- size_t m_num_out_bytes;
- std::ostream* m_op_ptr;
- // Buffer used to store output prior to saving to file
- std::vector<char> m_buffer;
- // Char used for temporary storage of op data bits
- char m_current_byte;
- // Used to set individual bit within the current header byte
- int m_output_mask;
-
- //functions
-
- //! Write all data to file.
- /*!
- Dump the internal data cache to the internal ostream object.
- */
- void WriteToFile();
-
- //Initialise the output stream.
- void InitOutputStream();
-
- //Clean out any remaining output bits to the buffer
- void FlushOutput();
-
- //! Write an ignore code
- /*!
- Write a skip interpret start prefix byte out to the internal data
- cache.
- */
- void OutputSkipInterpretStartPrefixByte();
-};
-
-//! A class for handling data output, including headers.
-/*!
-A class for handling data output, including headers and reordering.
-*/
-class UnitOutputManager
-{
- // Only the FrameOutputManager can make this class write data to file
- friend class FrameOutputManager;
-
-public:
- //! Constructor.
- /*!
- Constructor wraps around a pointer to an ostream object, and
- initialises two BasicOutputManager objects for header and data
- */
- UnitOutputManager(std::ostream* out_data);
-
- //Copy constructor is default shallow copy
-
- //Operator= is default shallow=
-
- //! Destructor
- ~UnitOutputManager() {}
-
- //! Handles the header bits.
- /*!
- A BasicOutputManager object for handling the header bits.
- */
- BasicOutputManager& Header()
+ class UnitOutputManager
{
- return m_header;
- }
-
- //! Handles the data bits.
- /*!
- A BasicOutputManager object for handling the data bits.
- */
- BasicOutputManager& Data()
+ // Only the FrameOutputManager can make this class write data to file
+ friend class FrameOutputManager;
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor wraps around a pointer to an ostream object, and
+ initialises two BasicOutputManager objects for header and data
+ */
+ UnitOutputManager(std::ostream* out_data );
+
+ //Copy constructor is default shallow copy
+
+ //Operator= is default shallow=
+
+ //! Destructor
+ ~UnitOutputManager(){}
+
+ //! Handles the header bits.
+ /*!
+ A BasicOutputManager object for handling the header bits.
+ */
+ BasicOutputManager& Header(){return m_header;}
+
+ //! Handles the data bits.
+ /*!
+ A BasicOutputManager object for handling the data bits.
+ */
+ BasicOutputManager& Data(){return m_data;}
+
+ //! Returns the total number of bytes written in the last unit coded.
+ /*!
+ Returns the total number of bytes written in the last unit coded - header + data.
+ */
+ const size_t GetUnitBytes() const {return m_unit_bytes;}
+
+ //! Returns the total number of header bytes written in the last unit coded.
+ const size_t GetUnitHeaderBytes() const {return m_unit_head_bytes;}
+
+ //! Current size of the internal data cache in bytes.
+ /*!
+ Current size of the internal data cache in bytes.
+ */
+ size_t Size() const;
+
+ private:
+ // basic output managers for the header and data
+ BasicOutputManager m_header,m_data;
+
+ // total number of bytes written in the last unit coded
+ size_t m_unit_bytes;
+
+ // number of data bytes for the last unit coded
+ size_t m_unit_data_bytes;
+
+ // number of data bytes for the last unit coded
+ size_t m_unit_head_bytes;
+
+ // functions
+
+ //! Writes the bit caches to file.
+ /*!
+ Writes the header bits to the ostream, followed by the data bits.
+ */
+ void WriteToFile();
+ };
+
+ class FrameOutputManager
{
- return m_data;
- }
+ public:
- //! Returns the total number of bytes written in the last unit coded.
- /*!
- Returns the total number of bytes written in the last unit coded - header + data.
- */
- const size_t GetUnitBytes() const
- {
- return m_unit_bytes;
- }
+ // Only the SequenceOutputManager can make this class write data to file
+ friend class SequenceOutputManager;
- //! Returns the total number of header bytes written in the last unit coded.
- const size_t GetUnitHeaderBytes() const
- {
- return m_unit_head_bytes;
- }
+ //! Constructor
+ /*
+ Constructs a class which manages output for an entire picture.
+ \param out_data pointer to the output stream
+ \param num_bands the number of subbands per component
+ */
+ FrameOutputManager( std::ostream* out_data , const int num_bands=13 );
- //! Current size of the internal data cache in bytes.
- /*!
- Current size of the internal data cache in bytes.
- */
- size_t Size() const;
-
-private:
- // basic output managers for the header and data
- BasicOutputManager m_header, m_data;
-
- // total number of bytes written in the last unit coded
- size_t m_unit_bytes;
-
- // number of data bytes for the last unit coded
- size_t m_unit_data_bytes;
-
- // number of data bytes for the last unit coded
- size_t m_unit_head_bytes;
-
- // functions
-
- //! Writes the bit caches to file.
- /*!
- Writes the header bits to the ostream, followed by the data bits.
- */
- void WriteToFile();
-};
-
-class FrameOutputManager
-{
-public:
-
- // Only the SequenceOutputManager can make this class write data to file
- friend class SequenceOutputManager;
+ //! Destructor
+ ~FrameOutputManager();
- //! Constructor
- /*
- Constructs a class which manages output for an entire picture.
- \param out_data pointer to the output stream
- \param num_bands the number of subbands per component
- */
- FrameOutputManager(std::ostream* out_data , const int num_bands = 13);
-
- //! Destructor
- ~FrameOutputManager();
-
- //! Set the number of bands there will be in a component
- void SetNumBands(const int num_bands);
-
- //! Get an output manager for a subband
- /*!
- Get an output manager for a subband.
- \param csort the component (Y, U or V)
- \param band_num the number of the subband
- */
- UnitOutputManager& BandOutput(const int csort , const int band_num);
+ //! Set the number of bands there will be in a component
+ void SetNumBands( const int num_bands );
- //! Get an output manager for a subband
- /*!
- Get an output manager for a subband.
- \param csort the component (Y, U or V)
- \param band_num the number of the subband
- */
- const UnitOutputManager& BandOutput(const int csort , const int band_num) const;
+ //! Get an output manager for a subband
+ /*!
+ Get an output manager for a subband.
+ \param csort the component (Y, U or V)
+ \param band_num the number of the subband
+ */
+ UnitOutputManager& BandOutput( const int csort , const int band_num );
- //! Get an output manager for MV data
- /*!
- Get an output manager for MV data
- */
- UnitOutputManager& MVOutput()
- {
- return *m_mv_data;
- }
+ //! Get an output manager for a subband
+ /*!
+ Get an output manager for a subband.
+ \param csort the component (Y, U or V)
+ \param band_num the number of the subband
+ */
+ const UnitOutputManager& BandOutput( const int csort , const int band_num ) const;
- //! Get an output manager for MV data
- /*!
- Get an output manager for MV data
- */
- const UnitOutputManager& MVOutput() const
- {
- return *m_mv_data;
- }
+ //! Get an output manager for MV data
+ /*!
+ Get an output manager for MV data
+ */
+ UnitOutputManager& MVOutput(){ return *m_mv_data; }
- //! Get an output manager for the picture header
- BasicOutputManager& HeaderOutput()
- {
- return *m_frame_header;
- }
+ //! Get an output manager for MV data
+ /*!
+ Get an output manager for MV data
+ */
+ const UnitOutputManager& MVOutput() const { return *m_mv_data; }
- //! Return the number of bytes used for each component
- const size_t ComponentBytes(const int comp_num) const
- {
- return m_comp_bytes[comp_num];
- }
+ //! Get an output manager for the picture header
+ BasicOutputManager& HeaderOutput(){ return *m_frame_header; }
- //! Return the number of header bytes used for each component
- const size_t ComponentHeadBytes(const int comp_num) const
- {
- return m_comp_hdr_bytes[comp_num];
- }
+ //! Return the number of bytes used for each component
+ const size_t ComponentBytes( const int comp_num ) const { return m_comp_bytes[comp_num];}
- //! Return the number of motion vector bytes used
- const size_t MVBytes() const
- {
- return m_mv_bytes;
- }
+ //! Return the number of header bytes used for each component
+ const size_t ComponentHeadBytes( const int comp_num ) const { return m_comp_hdr_bytes[comp_num];}
- //! Return the number of motion vector header bytes used
- const size_t MVHeadBytes() const
- {
- return m_mv_hdr_bytes;
- }
+ //! Return the number of motion vector bytes used
+ const size_t MVBytes() const { return m_mv_bytes;}
- //! Return the number of bytes used for the whole picture
- const size_t FrameBytes() const
- {
- return m_total_bytes;
- }
+ //! Return the number of motion vector header bytes used
+ const size_t MVHeadBytes() const { return m_mv_hdr_bytes;}
- //! Return the number of header bytes used throughout the picture
- const size_t FrameHeadBytes() const
- {
- return m_header_bytes;
- }
+ //! Return the number of bytes used for the whole picture
+ const size_t FrameBytes() const { return m_total_bytes;}
- //! Current size of the internal data cache in bytes.
- /*!
- Current size of the internal data cache in bytes.
- */
- size_t Size() const;
+ //! Return the number of header bytes used throughout the picture
+ const size_t FrameHeadBytes() const { return m_header_bytes;}
-private:
+ //! Current size of the internal data cache in bytes.
+ /*!
+ Current size of the internal data cache in bytes.
+ */
+ size_t Size() const;
- // Array of subband outputs, 1 for each component and subband
- TwoDArray< UnitOutputManager* > m_data_array;
+ private:
- // Motion vector output
- UnitOutputManager* m_mv_data;
+ // Array of subband outputs, 1 for each component and subband
+ TwoDArray< UnitOutputManager* > m_data_array;
- // Picture header output
- BasicOutputManager* m_frame_header;
+ // Motion vector output
+ UnitOutputManager* m_mv_data;
- // The total number of picture bytes
- size_t m_total_bytes;
+ // Picture header output
+ BasicOutputManager* m_frame_header;
- // The total number of header bytes
- size_t m_header_bytes;
+ // The total number of picture bytes
+ size_t m_total_bytes;
- // The total number of MV header bytes
- size_t m_mv_hdr_bytes;
+ // The total number of header bytes
+ size_t m_header_bytes;
- // The total number of MV bytes
- size_t m_mv_bytes;
+ // The total number of MV header bytes
+ size_t m_mv_hdr_bytes;
- // The total number of bytes in each component
- OneDArray< size_t > m_comp_bytes;
+ // The total number of MV bytes
+ size_t m_mv_bytes;
- // The total number of header bytes in each component
- OneDArray< size_t > m_comp_hdr_bytes;
+ // The total number of bytes in each component
+ OneDArray< size_t > m_comp_bytes;
- // A copy of a pointer to the output stream
- std::ostream* m_out_stream;
+ // The total number of header bytes in each component
+ OneDArray< size_t > m_comp_hdr_bytes;
- // Functions
+ // A copy of a pointer to the output stream
+ std::ostream* m_out_stream;
- //! Initialise the band data
- void Init(const int num_bands);
+ // Functions
- //! Reset all the data
- void Reset();
+ //! Initialise the band data
+ void Init( const int num_bands );
- //! Delete all the data
- void DeleteAll();
+ //! Reset all the data
+ void Reset();
- //! Write all the picture data to file
- void WriteToFile();
-};
+ //! Delete all the data
+ void DeleteAll();
-class SequenceOutputManager
-{
-public:
- //! Constructor
- SequenceOutputManager(std::ostream* out_data);
+ //! Write all the picture data to file
+ void WriteToFile();
+ };
- //! Return a reference to the output for a single picture
- FrameOutputManager& FrameOutput()
+ class SequenceOutputManager
{
- return m_frame_op_mgr;
- }
+ public:
+ //! Constructor
+ SequenceOutputManager( std::ostream* out_data );
- //! Return a reference to the output for the sequence header
- BasicOutputManager& HeaderOutput()
- {
- return m_seq_header;
- }
+ //! Return a reference to the output for a single picture
+ FrameOutputManager& FrameOutput(){ return m_frame_op_mgr; }
- //! Return a reference to the output for the sequence trailer
- BasicOutputManager& TrailerOutput()
- {
- return m_seq_end;
- }
+ //! Return a reference to the output for the sequence header
+ BasicOutputManager& HeaderOutput(){ return m_seq_header; }
- //! Reset the picture data without outputting
- void ResetFrame()
- {
- m_frame_op_mgr.Reset();
- }
+ //! Return a reference to the output for the sequence trailer
+ BasicOutputManager& TrailerOutput(){ return m_seq_end; }
- //! Write the sequence header
- void WriteSeqHeaderToFile();
+ //! Reset the picture data without outputting
+ void ResetFrame(){ m_frame_op_mgr.Reset(); }
- //! Write all the picture data to file
- void WriteFrameData();
+ //! Write the sequence header
+ void WriteSeqHeaderToFile();
- //! Write the sequence trailer
- void WriteSeqTrailerToFile();
+ //! Write all the picture data to file
+ void WriteFrameData();
- //! Return the total number of bytes used for the sequence
- const size_t SequenceBytes()
- {
- return m_total_bytes;
- }
+ //! Write the sequence trailer
+ void WriteSeqTrailerToFile();
- //! Return the total number of header bytes used throughout the sequence
- const size_t SequenceHeadBytes()
- {
- return m_header_bytes;
- }
+ //! Return the total number of bytes used for the sequence
+ const size_t SequenceBytes() { return m_total_bytes; }
- //! Return the total number bytes used for MVs
- const size_t MVBytes()
- {
- return m_mv_bytes;
- }
+ //! Return the total number of header bytes used throughout the sequence
+ const size_t SequenceHeadBytes() { return m_header_bytes; }
- //! Return the total number bytes used for a component
- const size_t ComponentBytes(const int comp_num)
- {
- return m_comp_bytes[comp_num];
- }
+ //! Return the total number bytes used for MVs
+ const size_t MVBytes() { return m_mv_bytes; }
- //! Reset the picture data
- void ResetFrameData();
+ //! Return the total number bytes used for a component
+ const size_t ComponentBytes( const int comp_num ) { return m_comp_bytes[comp_num]; }
+ //! Reset the picture data
+ void ResetFrameData();
-private:
- // The picture output manager
- FrameOutputManager m_frame_op_mgr;
+ private:
- // Output manager for the sequence header
- BasicOutputManager m_seq_header;
+ // The picture output manager
+ FrameOutputManager m_frame_op_mgr;
- // Output manager for the sequence end
- BasicOutputManager m_seq_end;
+ // Output manager for the sequence header
+ BasicOutputManager m_seq_header;
- // The total number of bytes in each component
- OneDArray< size_t > m_comp_bytes;
+ // Output manager for the sequence end
+ BasicOutputManager m_seq_end;
- // The total number of header bits in each component
- OneDArray< size_t > m_comp_hdr_bytes;
+ // The total number of bytes in each component
+ OneDArray< size_t > m_comp_bytes;
- // The number of MV header bytes
- size_t m_mv_hdr_bytes;
+ // The total number of header bits in each component
+ OneDArray< size_t > m_comp_hdr_bytes;
- // The total number of MV bytes
- size_t m_mv_bytes;
+ // The number of MV header bytes
+ size_t m_mv_hdr_bytes;
- // The total number of bytes written so far
- size_t m_total_bytes;
+ // The total number of MV bytes
+ size_t m_mv_bytes;
- // The total number of header bytes written so far
- size_t m_header_bytes;
+ // The total number of bytes written so far
+ size_t m_total_bytes;
- // The total number of trailer bytes written so far
- size_t m_trailer_bytes;
-};
+ // The total number of header bytes written so far
+ size_t m_header_bytes;
-///////////////////////////////////////////////
-//--------------Bit input stuff--------------//
-///////////////////////////////////////////////
+ // The total number of trailer bytes written so far
+ size_t m_trailer_bytes;
+ };
-//! A class for managing bit-wise and byte-wise input.
-class BitInputManager
-{
+ ///////////////////////////////////////////////
+ //--------------Bit input stuff--------------//
+ ///////////////////////////////////////////////
-public:
- //! Constructor.
- /*!
- Constructor. Wraps around an istream object.
- */
- BitInputManager(std::istream* in_data);
+ //! A class for managing bit-wise and byte-wise input.
+ class BitInputManager
+ {
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor. Wraps around an istream object.
+ */
+ BitInputManager(std::istream* in_data );
- //Copy constructor is default shallow copy
+ //Copy constructor is default shallow copy
- //Operator= is default shallow=
+ //Operator= is default shallow=
- //! Destructor
- ~BitInputManager() {}
+ //! Destructor
+ ~BitInputManager(){}
- //input functions
- //! Obtain the next bit.
- bool InputBit();
+ //input functions
+ //! Obtain the next bit.
+ bool InputBit();
- //! Obtain the next bit, incrementing count.
- bool InputBit(int& count);
+ //! Obtain the next bit, incrementing count.
+ bool InputBit(int& count);
- //! Obtain the next bit, incrementing count, if count<max_count; else return 0 (false).
- bool InputBit(int& count, const int max_count);
+ //! Obtain the next bit, incrementing count, if count<max_count; else return 0 (false).
+ bool InputBit(int& count, const int max_count);
- //! Obtain the next byte.
- char InputByte();
+ //! Obtain the next byte.
+ char InputByte();
- //! Obtain a number of bytes.
- void InputBytes(char* cptr, int num);
+ //! Obtain a number of bytes.
+ void InputBytes(char* cptr,int num);
- //! Move onto the next byte. Needed if a data unit is not an exact number of bytes.
- void FlushInput();
+ //! Move onto the next byte. Needed if a data unit is not an exact number of bytes.
+ void FlushInput();
- //! Returns true if we're at the end of the input, false otherwise
- bool End() const ;
+ //! Returns true if we're at the end of the input, false otherwise
+ bool End() const ;
-private:
+ private:
- std::istream* m_ip_ptr;
- // Char used for temporary storage of ip bits
- char m_current_byte;
- // The number of bits left withint the current input byte being decoded
- int m_input_bits_left;
+ std::istream* m_ip_ptr;
+ // Char used for temporary storage of ip bits
+ char m_current_byte;
+ // The number of bits left withint the current input byte being decoded
+ int m_input_bits_left;
- //used to check if start code is detected
- unsigned int m_shift;
- //functions
- // Initialise the input stream
- void InitInputStream();
-};
+ //used to check if start code is detected
+ unsigned int m_shift;
+ //functions
+ // Initialise the input stream
+ void InitInputStream();
+ };
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.cpp
index 003f6d06b..82abf66b8 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.cpp
@@ -42,32 +42,32 @@ using namespace dirac;
using namespace std;
CommandLine::CommandLine(int argc, char * argv[], const set<string> & bool_opts)
- : m_options(),
- m_inputs(),
- m_bool_opts(bool_opts)
+ : m_options(),
+ m_inputs(),
+ m_bool_opts(bool_opts)
{
bool option_active = false;
vector<option>::iterator active_option;
- for(int i = 1; i < argc; ++i)
+ for (int i = 1; i < argc; ++i)
{
// is it an option?
- if((strlen(argv[i]) > 1) && (argv[i][0] == '-'))
+ if ((strlen(argv[i]) > 1) && (argv[i][0] == '-'))
{
// store new key
string opt_key = string(&argv[i][1]);
m_options.push_back(option(opt_key));
-
+
// active option is now last in list
active_option = m_options.end();
--active_option;
-
+
// check option list to see if we're looking for an argument
option_active = (m_bool_opts.find(opt_key) == m_bool_opts.end());
}
else
{
- if(option_active)
+ if (option_active)
active_option->m_value = string(argv[i]);
else
m_inputs.push_back(string(argv[i]));
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.h
index 2c5fdf49b..0977c8b27 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/cmd_line.h
@@ -45,47 +45,47 @@
namespace dirac
{
-// structure for defining the nature of options
-// a very simple command-line parser
-class CommandLine
-{
-public:
- struct option
- {
- std::string m_name;
- std::string m_value;
-
- option(const std::string & a_name)
- : m_name(a_name), m_value("")
- {
- // nada
- }
- };
+ // structure for defining the nature of options
+ // a very simple command-line parser
+ class CommandLine
+ {
+ public:
+ struct option
+ {
+ std::string m_name;
+ std::string m_value;
- //! Constructor
- CommandLine(int argc, char * argv[], const std::set<std::string> & bool_opts);
+ option(const std::string & a_name)
+ : m_name(a_name), m_value("")
+ {
+ // nada
+ }
+ };
- const std::vector<option> & GetOptions() const
- {
- return m_options;
- }
+ //! Constructor
+ CommandLine(int argc, char * argv[], const std::set<std::string> & bool_opts);
- const std::vector<std::string> & GetInputs() const
- {
- return m_inputs;
- }
+ const std::vector<option> & GetOptions() const
+ {
+ return m_options;
+ }
- // convenience property
- size_t Count() const
- {
- return m_options.size();
- }
+ const std::vector<std::string> & GetInputs() const
+ {
+ return m_inputs;
+ }
+
+ // convenience property
+ size_t Count() const
+ {
+ return m_options.size();
+ }
-private:
- std::vector<option> m_options;
- std::vector<std::string> m_inputs;
- const std::set<std::string> & m_bool_opts;
-};
+ private:
+ std::vector<option> m_options;
+ std::vector<std::string> m_inputs;
+ const std::set<std::string> & m_bool_opts;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.cpp
index cda129fe0..35adcc5ef 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.cpp
@@ -57,9 +57,9 @@ using namespace dirac;
//EntropyCorrector functions
EntropyCorrector::EntropyCorrector(int depth):
- m_Yfctrs(3 , 3 * depth + 1),
- m_Ufctrs(3 , 3 * depth + 1),
- m_Vfctrs(3 , 3 * depth + 1)
+ m_Yfctrs( 3 , 3*depth+1 ),
+ m_Ufctrs( 3 , 3*depth+1 ),
+ m_Vfctrs( 3 , 3*depth+1 )
{
Init();
}
@@ -68,9 +68,9 @@ float EntropyCorrector::Factor(const int bandnum , const PictureParams& pp ,
const CompSort c) const
{
int idx = pp.PicSort().IsIntra() ? 0 : (pp.IsBPicture() ? 1 : 2);
- if(c == U_COMP)
+ if (c == U_COMP)
return m_Ufctrs[idx][bandnum-1];
- else if(c == V_COMP)
+ else if (c == V_COMP)
return m_Vfctrs[idx][bandnum-1];
else
return m_Yfctrs[idx][bandnum-1];
@@ -80,9 +80,9 @@ void EntropyCorrector::Init()
{
//do I-pictures
- for(int i = 0 ; i < m_Yfctrs.LengthX() ; ++i)
+ for (int i=0 ; i<m_Yfctrs.LengthX() ; ++i )
{
- if(i == m_Yfctrs.LastX())
+ if ( i == m_Yfctrs.LastX() )
{
// Set factor for Intra pictures
m_Yfctrs[0][i] = 1.0f;
@@ -97,7 +97,7 @@ void EntropyCorrector::Init()
m_Ufctrs[2][i] = 0.85f;
m_Vfctrs[2][i] = 0.85f;
}
- else if(i >= m_Yfctrs.LastX() - 3)
+ else if ( i >= m_Yfctrs.LastX()-3 )
{
// Set factor for Intra pictures
m_Yfctrs[0][i] = 0.85f;
@@ -132,20 +132,19 @@ void EntropyCorrector::Init()
}
void EntropyCorrector::Update(int bandnum , const PictureParams& pp ,
- CompSort c , int est_bits , int actual_bits)
-{
+ CompSort c ,int est_bits , int actual_bits){
//updates the factors - note that the estimated bits are assumed to already include the correction factor
float multiplier;
- if(actual_bits != 0 && est_bits != 0)
- multiplier = float(actual_bits) / float(est_bits);
+ if (actual_bits != 0 && est_bits != 0)
+ multiplier = float(actual_bits)/float(est_bits);
else
- multiplier = 1.0;
+ multiplier=1.0;
int idx = pp.PicSort().IsIntra() ? 0 : (pp.IsBPicture() ? 1 : 2);
- if(c == U_COMP)
+ if (c == U_COMP)
m_Ufctrs[idx][bandnum-1] *= multiplier;
- else if(c == V_COMP)
+ else if (c == V_COMP)
m_Vfctrs[idx][bandnum-1] *= multiplier;
else
m_Yfctrs[idx][bandnum-1] *= multiplier;
@@ -158,16 +157,16 @@ OLBParams::OLBParams(const int xblen, int const yblen, int const xbsep, int cons
m_yblen(yblen),
m_xbsep(xbsep),
m_ybsep(ybsep),
- m_xoffset((xblen - xbsep) / 2),
- m_yoffset((yblen - ybsep) / 2)
+ m_xoffset( (xblen-xbsep)/2 ),
+ m_yoffset( (yblen-ybsep)/2 )
{}
bool OLBParams::operator ==(const OLBParams bparams) const
{
- if(bparams.Xblen() != m_xblen ||
- bparams.Yblen() != m_yblen ||
- bparams.Xbsep() != m_xbsep ||
- bparams.Ybsep() != m_ybsep)
+ if (bparams.Xblen() != m_xblen ||
+ bparams.Yblen() != m_yblen ||
+ bparams.Xbsep() != m_xbsep ||
+ bparams.Ybsep() != m_ybsep)
return false;
@@ -214,21 +213,20 @@ void PicturePredParams::SetBlockSizes(const OLBParams& olbparams , const ChromaF
OLBParams tmp_olbparams = olbparams;
// Factors for scaling chroma blocks
- int xcfactor, ycfactor;
+ int xcfactor,ycfactor;
- if(cformat == format420)
+ if (cformat == format420)
{
xcfactor = 2;
ycfactor = 2;
}
- else if(cformat == format422)
+ else if (cformat == format422)
{
xcfactor = 2;
ycfactor = 1;
}
else
- {
- // assume 444
+ {// assume 444
xcfactor = 1;
ycfactor = 1;
}
@@ -237,97 +235,97 @@ void PicturePredParams::SetBlockSizes(const OLBParams& olbparams , const ChromaF
m_lbparams[2] = tmp_olbparams;
// Check separations are all divisible by 4
- int remainder = m_lbparams[2].Xbsep() % 4;
- if(remainder != 0 || m_lbparams[2].Xbsep() == 0)
+ int remainder= m_lbparams[2].Xbsep()%4;
+ if ( remainder!=0 || m_lbparams[2].Xbsep()==0 )
{
- m_lbparams[2].SetXbsep(m_lbparams[2].Xbsep() + (4 - remainder));
- m_lbparams[2].SetXblen(m_lbparams[2].Xbsep() + 4);
+ m_lbparams[2].SetXbsep( m_lbparams[2].Xbsep()+(4-remainder));
+ m_lbparams[2].SetXblen( m_lbparams[2].Xbsep()+4 );
}
- remainder = m_lbparams[2].Ybsep() % 4;
- if(remainder != 0 || m_lbparams[2].Ybsep() == 0)
+ remainder= m_lbparams[2].Ybsep()%4;
+ if ( remainder!=0 || m_lbparams[2].Ybsep()==0 )
{
- m_lbparams[2].SetYbsep(m_lbparams[2].Ybsep() + (4 - remainder));
- m_lbparams[2].SetYblen(m_lbparams[2].Ybsep() + 4);
+ m_lbparams[2].SetYbsep( m_lbparams[2].Ybsep()+(4-remainder));
+ m_lbparams[2].SetYblen( m_lbparams[2].Ybsep()+4 );
}
// Now check lengths are divisible by 4
- remainder = m_lbparams[2].Xblen() % 4;
- if(remainder != 0)
+ remainder= m_lbparams[2].Xblen()%4;
+ if ( remainder!=0 )
{
- m_lbparams[2].SetXblen(m_lbparams[2].Xbsep() + 4);
+ m_lbparams[2].SetXblen( m_lbparams[2].Xbsep()+4);
}
- remainder = m_lbparams[2].Yblen() % 4;
- if(remainder != 0)
+ remainder= m_lbparams[2].Yblen()%4;
+ if ( remainder!=0 )
{
- m_lbparams[2].SetYblen(m_lbparams[2].Ybsep() + 4);
+ m_lbparams[2].SetYblen( m_lbparams[2].Ybsep()+4);
}
// Check there's non-negative overlap,
// XBLEN >= XBSEP, YBLEN >= YBSEP
- if(m_lbparams[2].Xbsep() > m_lbparams[2].Xblen())
+ if (m_lbparams[2].Xbsep()>m_lbparams[2].Xblen())
{
- m_lbparams[2].SetXblen(m_lbparams[2].Xbsep() + 4);
+ m_lbparams[2].SetXblen( m_lbparams[2].Xbsep()+4);
}
- if(m_lbparams[2].Ybsep() > m_lbparams[2].Yblen())
+ if (m_lbparams[2].Ybsep()>m_lbparams[2].Yblen())
{
- m_lbparams[2].SetYblen(m_lbparams[2].Ybsep() + 4);
+ m_lbparams[2].SetYblen( m_lbparams[2].Ybsep()+4);
}
// Check the lengths aren't too big (100% is max roll-off)
// XBLEN <= 2*XBSEP, YBLEN <= 2*YBSEP
- if(2 * m_lbparams[2].Xbsep() < m_lbparams[2].Xblen())
+ if (2*m_lbparams[2].Xbsep()<m_lbparams[2].Xblen())
{
- m_lbparams[2].SetXblen(m_lbparams[2].Xbsep() + 4);
+ m_lbparams[2].SetXblen( m_lbparams[2].Xbsep()+4);
}
- if(2 * m_lbparams[2].Ybsep() < m_lbparams[2].Yblen())
+ if (2*m_lbparams[2].Ybsep()<m_lbparams[2].Yblen())
{
- m_lbparams[2].SetYblen(m_lbparams[2].Ybsep() + 4);
+ m_lbparams[2].SetYblen( m_lbparams[2].Ybsep()+4);
}
// Set the chroma values
- m_cbparams[2].SetXbsep(m_lbparams[2].Xbsep() / xcfactor);
- m_cbparams[2].SetXblen(m_lbparams[2].Xblen() / xcfactor);
- m_cbparams[2].SetYbsep(m_lbparams[2].Ybsep() / ycfactor);
- m_cbparams[2].SetYblen(m_lbparams[2].Yblen() / ycfactor);
+ m_cbparams[2].SetXbsep( m_lbparams[2].Xbsep()/xcfactor );
+ m_cbparams[2].SetXblen( m_lbparams[2].Xblen()/xcfactor );
+ m_cbparams[2].SetYbsep( m_lbparams[2].Ybsep()/ycfactor );
+ m_cbparams[2].SetYblen( m_lbparams[2].Yblen()/ycfactor );
//Now work out the overlaps for splitting levels 1 and 0
- m_lbparams[1].SetXbsep(m_lbparams[2].Xbsep() * 2);
- m_lbparams[1].SetXblen(m_lbparams[2].Xblen() + m_lbparams[2].Xbsep());
- m_lbparams[1].SetYbsep(m_lbparams[2].Ybsep() * 2);
- m_lbparams[1].SetYblen(m_lbparams[2].Yblen() + m_lbparams[2].Xbsep());
-
- m_lbparams[0].SetXbsep(m_lbparams[1].Xbsep() * 2);
- m_lbparams[0].SetXblen(m_lbparams[1].Xblen() + m_lbparams[1].Xbsep());
- m_lbparams[0].SetYbsep(m_lbparams[1].Ybsep() * 2);
- m_lbparams[0].SetYblen(m_lbparams[1].Yblen() + m_lbparams[1].Xbsep());
-
- m_cbparams[1].SetXbsep(m_cbparams[2].Xbsep() * 2);
- m_cbparams[1].SetXblen(m_cbparams[2].Xblen() + m_cbparams[2].Xbsep());
- m_cbparams[1].SetYbsep(m_cbparams[2].Ybsep() * 2);
- m_cbparams[1].SetYblen(m_cbparams[2].Yblen() + m_cbparams[2].Xbsep());
-
- m_cbparams[0].SetXbsep(m_cbparams[1].Xbsep() * 2);
- m_cbparams[0].SetXblen(m_cbparams[1].Xblen() + m_cbparams[1].Xbsep());
- m_cbparams[0].SetYbsep(m_cbparams[1].Ybsep() * 2);
- m_cbparams[0].SetYblen(m_cbparams[1].Yblen() + m_cbparams[1].Xbsep());
-
- if(m_lbparams[2].Xbsep() != olbparams.Xbsep() ||
- m_lbparams[2].Ybsep() != olbparams.Ybsep() ||
- m_lbparams[2].Xblen() != olbparams.Xblen() ||
- m_lbparams[2].Yblen() != olbparams.Yblen())
+ m_lbparams[1].SetXbsep( m_lbparams[2].Xbsep()*2 );
+ m_lbparams[1].SetXblen( m_lbparams[2].Xblen() + m_lbparams[2].Xbsep() );
+ m_lbparams[1].SetYbsep( m_lbparams[2].Ybsep()*2 );
+ m_lbparams[1].SetYblen( m_lbparams[2].Yblen() + m_lbparams[2].Xbsep() );
+
+ m_lbparams[0].SetXbsep( m_lbparams[1].Xbsep()*2 );
+ m_lbparams[0].SetXblen( m_lbparams[1].Xblen() + m_lbparams[1].Xbsep() );
+ m_lbparams[0].SetYbsep( m_lbparams[1].Ybsep()*2 );
+ m_lbparams[0].SetYblen( m_lbparams[1].Yblen() + m_lbparams[1].Xbsep() );
+
+ m_cbparams[1].SetXbsep( m_cbparams[2].Xbsep()*2 );
+ m_cbparams[1].SetXblen( m_cbparams[2].Xblen() + m_cbparams[2].Xbsep() );
+ m_cbparams[1].SetYbsep( m_cbparams[2].Ybsep()*2 );
+ m_cbparams[1].SetYblen( m_cbparams[2].Yblen() + m_cbparams[2].Xbsep() );
+
+ m_cbparams[0].SetXbsep( m_cbparams[1].Xbsep()*2 );
+ m_cbparams[0].SetXblen( m_cbparams[1].Xblen() + m_cbparams[1].Xbsep() );
+ m_cbparams[0].SetYbsep( m_cbparams[1].Ybsep()*2 );
+ m_cbparams[0].SetYblen( m_cbparams[1].Yblen() + m_cbparams[1].Xbsep() );
+
+ if ( m_lbparams[2].Xbsep()!=olbparams.Xbsep() ||
+ m_lbparams[2].Ybsep()!=olbparams.Ybsep() ||
+ m_lbparams[2].Xblen()!=olbparams.Xblen() ||
+ m_lbparams[2].Yblen()!=olbparams.Yblen() )
{
- std::cout << std::endl << "WARNING: block parameters are inconsistent with ";
- std::cout << "specification requirements, which are:";
- std::cout << std::endl << "\t 1. Lengths and separations must be positive multiples of 4";
- std::cout << std::endl << "\t 2. Length can't be more than twice separations";
- std::cout << std::endl << "\t 3. Lengths must be greater than or equal to separations";
- std::cout << std::endl << std::endl << "Instead, using:";
- std::cout << " xblen=" << m_lbparams[2].Xblen();
- std::cout << " yblen=" << m_lbparams[2].Yblen();
- std::cout << " xbsep=" << m_lbparams[2].Xbsep();
- std::cout << " ybsep=" << m_lbparams[2].Ybsep() << std::endl;
+ std::cout<<std::endl<<"WARNING: block parameters are inconsistent with ";
+ std::cout<<"specification requirements, which are:";
+ std::cout<<std::endl<<"\t 1. Lengths and separations must be positive multiples of 4";
+ std::cout<<std::endl<<"\t 2. Length can't be more than twice separations";
+ std::cout<<std::endl<<"\t 3. Lengths must be greater than or equal to separations";
+ std::cout<<std::endl<<std::endl<<"Instead, using:";
+ std::cout<<" xblen="<<m_lbparams[2].Xblen();
+ std::cout<<" yblen="<<m_lbparams[2].Yblen();
+ std::cout<<" xbsep="<<m_lbparams[2].Xbsep();
+ std::cout<<" ybsep="<<m_lbparams[2].Ybsep() << std::endl;
}
}
@@ -335,21 +333,21 @@ void PicturePredParams::SetBlockSizes(const OLBParams& olbparams , const ChromaF
// Codec params functions
CodecParams::CodecParams(const VideoFormat &vd, PictureType ftype, unsigned int num_refs, bool set_defaults):
- m_video_format(vd)
+ m_video_format(vd)
{
- if(set_defaults)
+ if (set_defaults)
SetDefaultCodecParameters(*this, ftype, num_refs);
}
-WltFilter CodecParams::TransformFilter(unsigned int wf_idx)
+WltFilter CodecParams::TransformFilter (unsigned int wf_idx)
{
- if(wf_idx >= filterNK)
+ if (wf_idx >= filterNK)
DIRAC_THROW_EXCEPTION(
ERR_UNSUPPORTED_STREAM_DATA,
"Wavelet filter idx out of range [0-7]",
SEVERITY_PICTURE_ERROR);
- if(wf_idx == FIDELITY)
+ if (wf_idx==FIDELITY)
{
std::ostringstream errstr;
errstr << "Wavelet Filter " << wf_idx << " currently not supported";
@@ -366,18 +364,18 @@ void CodecParams::SetTransformFilter(unsigned int wf_idx)
SetTransformFilter(TransformFilter(wf_idx));
}
-void CodecParams::SetTransformDepth(unsigned int wd)
+void CodecParams::SetTransformDepth (unsigned int wd)
{
m_wlt_depth = wd;
// Resize the code block size array.
- m_cb.Resize(wd + 1);
+ m_cb.Resize(wd+1);
}
-void CodecParams::SetCodeBlocks(unsigned int level,
- unsigned int hblocks,
- unsigned int vblocks)
+void CodecParams::SetCodeBlocks (unsigned int level,
+ unsigned int hblocks,
+ unsigned int vblocks)
{
- if(level > m_wlt_depth)
+ if (level > m_wlt_depth)
{
std::ostringstream errstr;
errstr << "level " << level << " out of range [0-" << m_wlt_depth << "]";
@@ -391,9 +389,9 @@ void CodecParams::SetCodeBlocks(unsigned int level,
m_cb[level].SetVerticalCodeBlocks(vblocks);
}
-const CodeBlocks &CodecParams::GetCodeBlocks(unsigned int level) const
+const CodeBlocks &CodecParams::GetCodeBlocks (unsigned int level) const
{
- if(level > m_wlt_depth)
+ if (level > m_wlt_depth)
{
std::ostringstream errstr;
errstr << "level " << level << " out of range [0-" << m_wlt_depth << "]";
@@ -406,9 +404,9 @@ const CodeBlocks &CodecParams::GetCodeBlocks(unsigned int level) const
return m_cb[level];
}
-void CodecParams::SetCodeBlockMode(unsigned int cb_mode)
+void CodecParams::SetCodeBlockMode (unsigned int cb_mode)
{
- if(cb_mode >= QUANT_UNDEF)
+ if (cb_mode >= QUANT_UNDEF)
{
std::ostringstream errstr;
errstr << "Code Block mode " << cb_mode << " out of supported range [0-" << QUANT_MULTIPLE << "]";
@@ -452,18 +450,18 @@ EncoderParams::EncoderParams(const VideoFormat& video_format,
void EncoderParams::CalcLambdas(const float qf)
{
- if(!m_lossless)
+ if (!m_lossless )
{
- m_I_lambda = std::pow(10.0 , (12.0 - qf) / 2.5) / 16.0;
+ m_I_lambda = std::pow( 10.0 , (12.0-qf )/2.5 )/16.0;
- m_L1_lambda = m_I_lambda * 4.0;
- m_L2_lambda = m_I_lambda * 32.0;
+ m_L1_lambda = m_I_lambda*4.0;
+ m_L2_lambda = m_I_lambda*32.0;
// Set the lambdas for motion estimation
const double me_ratio = 2.0;
// Use the same ME lambda for L1 and L2 pictures
- m_L1_me_lambda = std::sqrt(m_L1_lambda) * me_ratio;
+ m_L1_me_lambda = std::sqrt(m_L1_lambda)*me_ratio;
m_L2_me_lambda = m_L1_me_lambda;
}
else
@@ -487,36 +485,36 @@ void EncoderParams::SetInterTransformFilter(unsigned int wf_idx)
SetInterTransformFilter(TransformFilter(wf_idx));
}
-void EncoderParams::SetUsualCodeBlocks(const PictureType &/*ftype*/)
+void EncoderParams::SetUsualCodeBlocks ( const PictureType &/*ftype*/)
{
// No subband splitting if spatial partitioning if false
// Since this function is common to encoder and decoder we allow the
// setting of code blocks without checking if DefaultSpatialPartition is
// true.
- if(SpatialPartition() == false)
+ if (SpatialPartition() == false)
return;
SetCodeBlocks(0, 1, 1);
int depth = TransformDepth();
- if(depth == 0)
+ if (depth == 0)
return;
- int xl_pad = (Xl() + (1 << depth) - 1) & ~((1 << depth) - 1);
- int yl_pad = (Yl() + (1 << depth) - 1) & ~((1 << depth) - 1);
+ int xl_pad = (Xl() + (1 << depth)-1) & ~((1 << depth)-1);
+ int yl_pad = (Yl() + (1 << depth)-1) & ~((1 << depth)-1);
/* NB, could have different sizes based upon ftype == INTRA_PICTURE */
/* aim for 12x12 codeblocks in each subband, execpt the DC with 4x4 */
- for(int i = 1; i <= depth; i++)
- SetCodeBlocks(depth - i + 1, std::max(1, (xl_pad >> i) / 12), std::max(1, (yl_pad >> i) / 12));
- SetCodeBlocks(0, std::max(1, (xl_pad >> depth) / 4), std::max(1, (yl_pad >> depth) / 4));
+ for (int i = 1; i <= depth; i++)
+ SetCodeBlocks(depth-i+1, std::max(1,(xl_pad >> i) /12), std::max(1, (yl_pad >> i) /12));
+ SetCodeBlocks(0, std::max(1,(xl_pad >> depth) /4), std::max(1,(yl_pad >> depth) /4));
}
int EncoderParams::GOPLength() const
{
- if(m_num_L1 > 0)
- return (m_num_L1 + 1) * m_L1_sep;
+ if (m_num_L1>0)
+ return (m_num_L1+1)*m_L1_sep;
- return ((m_num_L1 == 0) ? 10 : 0);
+ return ((m_num_L1==0) ? 10 : 0);
}
DecoderParams::DecoderParams(const VideoFormat& video_format,
@@ -550,11 +548,11 @@ SourceParams::SourceParams(const VideoFormat& video_format,
int SourceParams::ChromaWidth() const
{
- switch(m_cformat)
+ switch (m_cformat)
{
case format420:
case format422:
- return m_xl / 2;
+ return m_xl/2;
case format444:
default:
@@ -564,10 +562,10 @@ int SourceParams::ChromaWidth() const
int SourceParams::ChromaHeight() const
{
- switch(m_cformat)
+ switch (m_cformat)
{
case format420:
- return m_yl / 2;
+ return m_yl/2;
case format422:
case format444:
@@ -577,10 +575,10 @@ int SourceParams::ChromaHeight() const
}
-void SourceParams::SetFrameRate(FrameRateType fr)
+void SourceParams::SetFrameRate (FrameRateType fr)
{
m_fr_idx = fr;
- switch(fr)
+ switch (fr)
{
case FRAMERATE_23p97_FPS:
m_framerate.m_num = 24000;
@@ -629,11 +627,11 @@ void SourceParams::SetFrameRate(FrameRateType fr)
}
}
-void SourceParams::SetPixelAspectRatio(PixelAspectRatioType pix_asr_idx)
+void SourceParams::SetPixelAspectRatio (PixelAspectRatioType pix_asr_idx)
{
m_pix_asr_idx = pix_asr_idx;
- switch(pix_asr_idx)
+ switch (pix_asr_idx)
{
case PIXEL_ASPECT_RATIO_1_1:
m_pixel_aspect_ratio.m_num = m_pixel_aspect_ratio.m_denom = 1;
@@ -665,10 +663,10 @@ void SourceParams::SetPixelAspectRatio(PixelAspectRatioType pix_asr_idx)
}
}
-void SourceParams::SetSignalRange(SignalRangeType sr)
+void SourceParams::SetSignalRange (SignalRangeType sr)
{
m_sr_idx = sr;
- switch(sr)
+ switch (sr)
{
case SIGNAL_RANGE_8BIT_FULL:
m_luma_offset = 0;
@@ -704,7 +702,7 @@ void SourceParams::SetSignalRange(SignalRangeType sr)
}
}
-void SourceParams::SetColourSpecification(unsigned int cs_idx)
+void SourceParams::SetColourSpecification (unsigned int cs_idx)
{
m_cs_idx = cs_idx;
switch(cs_idx)
@@ -738,30 +736,30 @@ void SourceParams::SetColourSpecification(unsigned int cs_idx)
}
}
-void SourceParams::SetColourPrimariesIndex(unsigned int cp)
+void SourceParams::SetColourPrimariesIndex (unsigned int cp)
{
m_cs_idx = 0;
- if(cp >= CP_UNDEF)
+ if (cp >= CP_UNDEF)
{
//TODO: flag a warning
}
m_col_primary = static_cast<ColourPrimaries>(cp);
}
-void SourceParams::SetColourMatrixIndex(unsigned int cm)
+void SourceParams::SetColourMatrixIndex (unsigned int cm)
{
m_cs_idx = 0;
- if(cm >= CM_UNDEF)
+ if (cm >= CM_UNDEF)
{
//TODO: flag a warning
}
m_col_matrix = static_cast<ColourMatrix>(cm);
}
-void SourceParams::SetTransferFunctionIndex(unsigned int tf)
+void SourceParams::SetTransferFunctionIndex (unsigned int tf)
{
m_cs_idx = 0;
- if(tf >= TF_UNDEF)
+ if (tf >= TF_UNDEF)
{
//TODO: flag a warning
}
@@ -773,21 +771,21 @@ void SourceParams::SetTransferFunctionIndex(unsigned int tf)
// Default constructor
PictureParams::PictureParams():
m_psort(PictureSort::IntraRefPictureSort()),
- m_picture_type(INTRA_PICTURE),
- m_reference_type(REFERENCE_PICTURE),
+ m_picture_type( INTRA_PICTURE ),
+ m_reference_type( REFERENCE_PICTURE ),
m_output(false),
m_using_ac(true)
{}
// Constructor
PictureParams::PictureParams(const ChromaFormat& cf,
- int xlen, int ylen,
- unsigned int luma_depth,
- unsigned int chroma_depth) :
+ int xlen, int ylen,
+ unsigned int luma_depth,
+ unsigned int chroma_depth) :
m_cformat(cf),
m_psort(PictureSort::IntraRefPictureSort()),
- m_picture_type(INTRA_PICTURE),
- m_reference_type(REFERENCE_PICTURE),
+ m_picture_type( INTRA_PICTURE ),
+ m_reference_type( REFERENCE_PICTURE ),
m_output(false),
m_xl(xlen),
m_yl(ylen),
@@ -796,17 +794,17 @@ PictureParams::PictureParams(const ChromaFormat& cf,
m_using_ac(true)
{
m_cxl = m_cyl = 0;
- if(cf == format420)
+ if (cf == format420)
{
- m_cxl = xlen >> 1;
- m_cyl = ylen >> 1;
+ m_cxl = xlen>>1;
+ m_cyl = ylen>>1;
}
- else if(cf == format422)
+ else if (cf == format422)
{
- m_cxl = xlen >> 1;
+ m_cxl = xlen>>1;
m_cyl = ylen;
}
- else if(cf == format444)
+ else if (cf == format444)
{
m_cxl = xlen;
m_cyl = ylen;
@@ -819,14 +817,14 @@ PictureParams::PictureParams(const ChromaFormat& cf, const PictureSort& ps):
m_output(false),
m_using_ac(true)
{
- SetPicSort(ps);
+ SetPicSort( ps );
}
PictureParams::PictureParams(const SourceParams& sparams):
m_cformat(sparams.CFormat()),
m_psort(PictureSort::IntraRefPictureSort()),
- m_picture_type(INTRA_PICTURE),
- m_reference_type(REFERENCE_PICTURE),
+ m_picture_type( INTRA_PICTURE ),
+ m_reference_type( REFERENCE_PICTURE ),
m_output(false),
m_xl(sparams.Xl()),
m_yl(sparams.Yl()),
@@ -834,20 +832,20 @@ PictureParams::PictureParams(const SourceParams& sparams):
m_cyl(sparams.ChromaHeight()),
m_using_ac(true)
{
- if(sparams.SourceSampling() == 1)
+ if (sparams.SourceSampling() == 1)
{
- m_yl = (m_yl >> 1);
- m_cyl = (m_cyl >> 1);
+ m_yl = (m_yl>>1);
+ m_cyl = (m_cyl>>1);
}
m_luma_depth = static_cast<unsigned int>
- (
- std::log((double)sparams.LumaExcursion()) / std::log(2.0) + 1
- );
+ (
+ std::log((double)sparams.LumaExcursion())/std::log(2.0) + 1
+ );
m_chroma_depth = static_cast<unsigned int>
- (
- std::log((double)sparams.ChromaExcursion()) / std::log(2.0) + 1
- );
+ (
+ std::log((double)sparams.ChromaExcursion())/std::log(2.0) + 1
+ );
}
@@ -856,11 +854,11 @@ void PictureParams::SetXl(int xlen)
{
m_xl = xlen;
m_cxl = 0;
- if(m_cformat == format420 || m_cformat == format422)
+ if (m_cformat == format420 || m_cformat == format422)
{
- m_cxl = m_xl >> 1;
+ m_cxl = m_xl>>1;
}
- else if(m_cformat == format444)
+ else if (m_cformat == format444)
{
m_cxl = m_xl;
}
@@ -870,11 +868,11 @@ void PictureParams::SetYl(int ylen)
{
m_yl = ylen;
m_cyl = 0;
- if(m_cformat == format420)
+ if (m_cformat == format420)
{
- m_cyl = m_yl >> 1;
+ m_cyl = m_yl>>1;
}
- else if(m_cformat == format422 || m_cformat == format444)
+ else if (m_cformat == format422 || m_cformat == format444)
{
m_cyl = m_yl;
}
@@ -882,29 +880,29 @@ void PictureParams::SetYl(int ylen)
bool PictureParams::IsBPicture() const
{
- bool is_B_picture(false);
+ bool is_B_picture( false );
- if(m_refs.size() == 2)
+ if ( m_refs.size() == 2 )
{
- if(m_refs[0] < m_fnum && m_refs[1] > m_fnum)
+ if ( m_refs[0] < m_fnum && m_refs[1] > m_fnum )
is_B_picture = true;
- if(m_refs[0] > m_fnum && m_refs[1] < m_fnum)
+ if ( m_refs[0] > m_fnum && m_refs[1] < m_fnum )
is_B_picture = true;
}
return is_B_picture;
}
-void PictureParams::SetPicSort(const PictureSort& ps)
+void PictureParams::SetPicSort( const PictureSort& ps )
{
- m_psort = ps;
- if(ps.IsIntra())
+ m_psort=ps;
+ if ( ps.IsIntra() )
m_picture_type = INTRA_PICTURE;
else
m_picture_type = INTER_PICTURE;
- if(ps.IsRef())
+ if ( ps.IsRef() )
m_reference_type = REFERENCE_PICTURE;
else
m_reference_type = NON_REFERENCE_PICTURE;
@@ -914,7 +912,7 @@ void PictureParams::SetPicSort(const PictureSort& ps)
void PictureParams::SetPictureType(const PictureType ftype)
{
m_picture_type = ftype;
- if(ftype == INTRA_PICTURE)
+ if (ftype == INTRA_PICTURE )
m_psort.SetIntra();
else
m_psort.SetInter();
@@ -923,7 +921,7 @@ void PictureParams::SetPictureType(const PictureType ftype)
void PictureParams::SetReferenceType(const ReferenceType rtype)
{
m_reference_type = rtype;
- if(rtype == REFERENCE_PICTURE)
+ if (rtype == REFERENCE_PICTURE )
m_psort.SetRef();
else
m_psort.SetNonRef();
@@ -931,14 +929,14 @@ void PictureParams::SetReferenceType(const ReferenceType rtype)
QuantiserLists::QuantiserLists()
- :
+:
// FIXME: hardcode m_max_qindex to 119. In future this will depend on level
// As per spec max qf_idx is 127. But for values of qf_idx > 120 we
// will need more than 32 bits. Hence qf_idx is limited to 119.
- m_max_qindex(119),
- m_qflist4(m_max_qindex + 1),
- m_intra_offset4(m_max_qindex + 1),
- m_inter_offset4(m_max_qindex + 1)
+ m_max_qindex( 119 ),
+ m_qflist4( m_max_qindex+1 ),
+ m_intra_offset4( m_max_qindex+1 ),
+ m_inter_offset4( m_max_qindex+1 )
{
m_qflist4[0] = 4;
m_qflist4[1] = 5;
@@ -953,32 +951,32 @@ QuantiserLists::QuantiserLists()
uint64_t base, qfactor;
#endif //_MSC_VER
- for(unsigned int q = 2; q <= m_max_qindex; ++q)
+ for (unsigned int q=2; q<=m_max_qindex; ++q)
{
- base = (1 << (q / 4));
+ base = (1<<(q/4));
- switch(q % 4)
+ switch (q%4)
{
- case 0:
- qfactor = 4 * base;
- break;
- case 1:
- qfactor = (503829 * base + 52958) / 105917;
- break;
- case 2:
- qfactor = (665857 * base + 58854) / 117708;
- break;
- case 3:
- qfactor = (440253 * base + 32722) / 65444;
- break;
- default: //Default case never used
- qfactor = 0;
+ case 0:
+ qfactor = 4*base;
+ break;
+ case 1:
+ qfactor = (503829*base+52958)/105917;
+ break;
+ case 2:
+ qfactor = (665857*base+58854)/117708;
+ break;
+ case 3:
+ qfactor = (440253*base+32722)/65444;
+ break;
+ default: //Default case never used
+ qfactor = 0;
}
- m_qflist4[q] = int(qfactor);
+ m_qflist4[q] = int( qfactor );
- m_intra_offset4[q] = (m_qflist4[q] + 1) >> 1;
- m_inter_offset4[q] = (3 * m_qflist4[q] + 4) >> 3;
+ m_intra_offset4[q] = (m_qflist4[q]+1)>>1;
+ m_inter_offset4[q] = (3*m_qflist4[q]+4)>>3;
}// q
}
@@ -1129,7 +1127,7 @@ MVPrecisionType IntToMVPrecisionType(int mv_prec)
switch(mv_prec)
{
case MV_PRECISION_PIXEL:
- return MV_PRECISION_PIXEL;
+ return MV_PRECISION_PIXEL;
case MV_PRECISION_HALF_PIXEL:
return MV_PRECISION_HALF_PIXEL;
case MV_PRECISION_QUARTER_PIXEL:
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.h
index 7ee59d81b..0ec2653e3 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common.h
@@ -54,2194 +54,1559 @@
#include <cmath>
namespace dirac
{
-/*! \file
- This file contains common classes used throughout the encoder and
- decoder. The main classes are the encoder and decoder parameters for
- controlling the encode and decode processes. These are passed
- throughout the codec. There are also parameter classes for sequences
- and Pictures.
-*/
+ /*! \file
+ This file contains common classes used throughout the encoder and
+ decoder. The main classes are the encoder and decoder parameters for
+ controlling the encode and decode processes. These are passed
+ throughout the codec. There are also parameter classes for sequences
+ and Pictures.
+ */
-//Some basic types used throughout the codec ...//
-//////////////////////////////////////////////////////////////
+ //Some basic types used throughout the codec ...//
+ //////////////////////////////////////////////////////////////
-//! Type of picture data (including motion compensated residuals)
-typedef short ValueType;
+ //! Type of picture data (including motion compensated residuals)
+ typedef short ValueType;
#if !defined(HAVE_MMX)
-//! Type of wavelet coefficient data (should be larger than ValueType)
-typedef int CoeffType;
+ //! Type of wavelet coefficient data (should be larger than ValueType)
+ typedef int CoeffType;
#else
-//! Type of wavelet coefficient data (should be larger than ValueType)
-typedef short CoeffType;
+ //! Type of wavelet coefficient data (should be larger than ValueType)
+ typedef short CoeffType;
#endif
-//! Type for performing calculations on ValueType and CoeffType. Should be >ValueType, >=CoeffType
-typedef int CalcValueType;
-
-//! Prediction modes for blocks
-enum PredMode { INTRA , REF1_ONLY , REF2_ONLY , REF1AND2, UNDEFINED };
-
-//! Types of picture component
-enum CompSort { Y_COMP , U_COMP , V_COMP };
-
-//! Addition or subtraction
-enum AddOrSub { ADD , SUBTRACT };
-
-//! Forward or backward
-enum Direction { FORWARD , BACKWARD };
+ //! Type for performing calculations on ValueType and CoeffType. Should be >ValueType, >=CoeffType
+ typedef int CalcValueType;
+
+ //! Prediction modes for blocks
+ enum PredMode{ INTRA , REF1_ONLY , REF2_ONLY , REF1AND2, UNDEFINED };
+
+ //! Types of picture component
+ enum CompSort{ Y_COMP , U_COMP , V_COMP };
+
+ //! Addition or subtraction
+ enum AddOrSub{ ADD , SUBTRACT };
+
+ //! Forward or backward
+ enum Direction { FORWARD , BACKWARD };
+
+ //! Contexts used for coefficient coding
+ enum CtxAliases
+ {//used for residual coding
+ SIGN0_CTX, // -sign, previous symbol is 0
+ SIGN_POS_CTX, // -sign, previous symbol is +ve
+ SIGN_NEG_CTX, // -sign, previous symbol is -ve
+
+ // Follow bit contexts
+ Z_FBIN1z_CTX, // -bin 1, parent is zero, neighbours zero
+ Z_FBIN1nz_CTX, // -bin 1, parent is zero, neighbours non-zero
+ Z_FBIN2_CTX, // -bin 2, parent is zero
+ Z_FBIN3_CTX, // -bin 3, parent is zero
+ Z_FBIN4_CTX, // -bin 4, parent is zero
+ Z_FBIN5_CTX, // -bin 5, parent is zero
+ Z_FBIN6plus_CTX, // -bins 6 plus, parent is zero
+
+ NZ_FBIN1z_CTX, // -bin 1, parent is non-zero, neighbours zero
+ NZ_FBIN1nz_CTX, // -bin 1, parent is non-zero, neighbours non-zero
+ NZ_FBIN2_CTX, // -bin 2, parent is non-zero
+ NZ_FBIN3_CTX, // -bin 3, parent is non-zero
+ NZ_FBIN4_CTX, // -bin 4, parent is non-zero
+ NZ_FBIN5_CTX, // -bin 5, parent is non-zero
+ NZ_FBIN6plus_CTX, // -bins 6 plus, parent is non-zero
+
+ // Information bit contexts
+ INFO_CTX,
+
+ BLOCK_SKIP_CTX, // - blocks are skipped
+ Q_OFFSET_FOLLOW_CTX, // - code block quantiser offset magnitude
+ Q_OFFSET_INFO_CTX, // - code block quantiser offset info context
+ Q_OFFSET_SIGN_CTX, // - code block quantiser offset sign
+ TOTAL_COEFF_CTXS // The total number of coefficient contexts
+ };
-//! Contexts used for coefficient coding
-enum CtxAliases
-{
- //used for residual coding
- SIGN0_CTX, // -sign, previous symbol is 0
- SIGN_POS_CTX, // -sign, previous symbol is +ve
- SIGN_NEG_CTX, // -sign, previous symbol is -ve
-
- // Follow bit contexts
- Z_FBIN1z_CTX, // -bin 1, parent is zero, neighbours zero
- Z_FBIN1nz_CTX, // -bin 1, parent is zero, neighbours non-zero
- Z_FBIN2_CTX, // -bin 2, parent is zero
- Z_FBIN3_CTX, // -bin 3, parent is zero
- Z_FBIN4_CTX, // -bin 4, parent is zero
- Z_FBIN5_CTX, // -bin 5, parent is zero
- Z_FBIN6plus_CTX, // -bins 6 plus, parent is zero
-
- NZ_FBIN1z_CTX, // -bin 1, parent is non-zero, neighbours zero
- NZ_FBIN1nz_CTX, // -bin 1, parent is non-zero, neighbours non-zero
- NZ_FBIN2_CTX, // -bin 2, parent is non-zero
- NZ_FBIN3_CTX, // -bin 3, parent is non-zero
- NZ_FBIN4_CTX, // -bin 4, parent is non-zero
- NZ_FBIN5_CTX, // -bin 5, parent is non-zero
- NZ_FBIN6plus_CTX, // -bins 6 plus, parent is non-zero
-
- // Information bit contexts
- INFO_CTX,
-
- BLOCK_SKIP_CTX, // - blocks are skipped
- Q_OFFSET_FOLLOW_CTX, // - code block quantiser offset magnitude
- Q_OFFSET_INFO_CTX, // - code block quantiser offset info context
- Q_OFFSET_SIGN_CTX, // - code block quantiser offset sign
- TOTAL_COEFF_CTXS // The total number of coefficient contexts
-};
-
-//! Contexts used for MV data coding
-enum MvCtxAliases
-{
- // DC value contexts //
- ///////////////////////
+ //! Contexts used for MV data coding
+ enum MvCtxAliases
+ {
+ // DC value contexts //
+ ///////////////////////
- DC_FBIN1_CTX,
- DC_FBIN2plus_CTX,
- DC_INFO_CTX,
- DC_SIGN_CTX,
+ DC_FBIN1_CTX,
+ DC_FBIN2plus_CTX,
+ DC_INFO_CTX,
+ DC_SIGN_CTX,
- // Motion vector contexts //
- ////////////////////////////
+ // Motion vector contexts //
+ ////////////////////////////
- MV_FBIN1_CTX,
- MV_FBIN2_CTX,
- MV_FBIN3_CTX,
- MV_FBIN4_CTX,
- MV_FBIN5plus_CTX,
+ MV_FBIN1_CTX,
+ MV_FBIN2_CTX,
+ MV_FBIN3_CTX,
+ MV_FBIN4_CTX,
+ MV_FBIN5plus_CTX,
- MV_INFO_CTX,
+ MV_INFO_CTX,
- MV_SIGN_CTX,
+ MV_SIGN_CTX,
- // Prediction mode contexts
+ // Prediction mode contexts
- PMODE_BIT0_CTX, // -bit 0, prediction mode value
- PMODE_BIT1_CTX, // -bin 1, prediction mode value
+ PMODE_BIT0_CTX, // -bit 0, prediction mode value
+ PMODE_BIT1_CTX, // -bin 1, prediction mode value
- // Macroblock contexts
+ // Macroblock contexts
- SB_SPLIT_BIN1_CTX, // bin 1, SB split mode vals
- SB_SPLIT_BIN2_CTX, // bin 2, SB split mode vals. Bin 3 not required
+ SB_SPLIT_BIN1_CTX, // bin 1, SB split mode vals
+ SB_SPLIT_BIN2_CTX, // bin 2, SB split mode vals. Bin 3 not required
- SB_SPLIT_INFO_CTX, // info context for SB split mode
+ SB_SPLIT_INFO_CTX, // info context for SB split mode
- TOTAL_MV_CTXS // The total number of motion vector contexts
-};
+ TOTAL_MV_CTXS // The total number of motion vector contexts
+ };
-/**
-* Function to convert an integer to a valid VideoFormat
-*@param video_format Integer corresponding to a format
-*@return Valid video-format (returns VIDEO_FORMAT_UNDEFINED if no valid format found)
-*/
-VideoFormat IntToVideoFormat(int video_format);
+ /**
+ * Function to convert an integer to a valid VideoFormat
+ *@param video_format Integer corresponding to a format
+ *@return Valid video-format (returns VIDEO_FORMAT_UNDEFINED if no valid format found)
+ */
+ VideoFormat IntToVideoFormat(int video_format);
-/**
-* Function to convert an integer to a valid VideoFormat
-*@param chroma_format Integer corresponding to a format
-*@return Valid chroma-format (returns formatNK if no valid format found)
-*/
-ChromaFormat IntToChromaFormat(int chroma_format);
+ /**
+ * Function to convert an integer to a valid VideoFormat
+ *@param chroma_format Integer corresponding to a format
+ *@return Valid chroma-format (returns formatNK if no valid format found)
+ */
+ ChromaFormat IntToChromaFormat(int chroma_format);
-/**
+ /**
* Function to convert an integer to a valid FrameRate type
*@param frame_rate_idx Integer corresponding to a frame-rate in the spec table
*@return Valid FrameRateType (returns FRAMERATE_UNDEFINED if no valid frame-rate found)
*/
-FrameRateType IntToFrameRateType(int frame_rate_idx);
-
-/**
-* Function to convert an integer to a valid PixelAspectRatio type
-*@param pix_asr_idx Integer corresponding to a pixel aspect ratio in the spec table
-*@return Valid PixelAspectRatioType (returns PIXEL_ASPECT_RATIO_UNDEFINED if no valid pixel aspect ratio found)
-*/
-PixelAspectRatioType IntToPixelAspectRatioType(int pix_asr_idx);
-
-/**
-* Function to convert an integer to a valid SignalRange type
-*@param signal_range_idx Integer corresponding to a signal-range in the spec table
-*@return Valid SignalRangeType (returns SIGNAL_RANGE_UNDEFINED if no valid signal-ratio found)
-*/
-SignalRangeType IntToSignalRangeType(int signal_range_idx);
-
-/**
+ FrameRateType IntToFrameRateType(int frame_rate_idx);
+
+ /**
+ * Function to convert an integer to a valid PixelAspectRatio type
+ *@param pix_asr_idx Integer corresponding to a pixel aspect ratio in the spec table
+ *@return Valid PixelAspectRatioType (returns PIXEL_ASPECT_RATIO_UNDEFINED if no valid pixel aspect ratio found)
+ */
+ PixelAspectRatioType IntToPixelAspectRatioType(int pix_asr_idx);
+
+ /**
+ * Function to convert an integer to a valid SignalRange type
+ *@param signal_range_idx Integer corresponding to a signal-range in the spec table
+ *@return Valid SignalRangeType (returns SIGNAL_RANGE_UNDEFINED if no valid signal-ratio found)
+ */
+ SignalRangeType IntToSignalRangeType(int signal_range_idx);
+
+ /**
* Function to convert an integer to a valid motion-vector precision type
*@param mv_prec Integer corresponding to a valid motion-vector precision
*@return Valid MVPrecisionType (returns SIGNAL_RANGE_UNDEFINED if no valid precision found)
*/
-MVPrecisionType IntToMVPrecisionType(int mv_prec);
-
-//Classes used throughout the codec//
-/////////////////////////////////////
-
-//! Class defining a rational number
-class Rational
-{
-public:
- //! Numerator
- unsigned int m_num;
- //! Denominator
- unsigned int m_denom;
-};
-
-//! Picture type Class
-class PictureSort
-{
-public:
- PictureSort()
- {
- fs = 0x00; // default intra non-ref
- }
-
- void SetIntra()
- {
- fs &= 0xfe;
- }
- void SetInter()
- {
- fs |= 0x01;
- }
- void SetNonRef()
- {
- fs &= 0xfd;
- }
- void SetRef()
- {
- fs |= 0x02;
- }
-
- bool IsInter() const
- {
- return fs & 0x01;
- }
- bool IsIntra() const
- {
- return !IsInter();
- }
- bool IsRef() const
- {
- return fs & 0x02;
+ MVPrecisionType IntToMVPrecisionType(int mv_prec);
+
+ //Classes used throughout the codec//
+ /////////////////////////////////////
+
+ //! Class defining a rational number
+ class Rational
+ {
+ public:
+ //! Numerator
+ unsigned int m_num;
+ //! Denominator
+ unsigned int m_denom;
};
- bool IsNonRef() const
- {
- return !IsRef();
- }
-
- void SetIntraNonRef()
- {
- SetIntra();
- SetNonRef();
- }
- void SetIntraRef()
- {
- SetIntra();
- SetRef();
- }
- void SetInterNonRef()
- {
- SetInter();
- SetNonRef();
- }
- void SetInterRef()
- {
- SetInter();
- SetRef();
- }
-
- bool IsIntraNonRef() const
- {
- return (fs & 0x03) == 0x00;
- }
- bool IsIntraRef() const
- {
- return (fs & 0x03) == 0x02;
- }
- bool IsInterNonRef() const
- {
- return (fs & 0x03) == 0x01;
- }
- bool IsInterRef() const
- {
- return (fs & 0x03) == 0x03;
- }
-
- void Clear()
- {
- fs = 0x00;
- }
-
- static PictureSort IntraRefPictureSort()
- {
- PictureSort fs;
- fs.SetIntraRef();
- return fs;
- }
-
- static PictureSort InterRefPictureSort()
- {
- PictureSort fs;
- fs.SetInterRef();
- return fs;
- }
-
- static PictureSort IntraNonRefPictureSort()
- {
- PictureSort fs;
- fs.SetIntraNonRef();
- return fs;
- }
- static PictureSort InterNonRefPictureSort()
- {
- PictureSort fs;
- fs.SetInterNonRef();
- return fs;
- }
-
-private:
- unsigned char fs;
-};
-
-//! Parameters relating to the source material being encoded/decoded
-class SourceParams
-{
-public:
- //! default constructor
- SourceParams(const VideoFormat &vf = VIDEO_FORMAT_CUSTOM,
- bool set_defaults = true);
-
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- ////////////////////////////////////////////////////////////////////
-
- // Gets
- //! Returns video-format
- VideoFormat GetVideoFormat() const
- {
- return m_video_format;
- }
-
- //! Returns the picture width
- unsigned int Xl() const
- {
- return m_xl;
- }
-
- //! Returns the picture height
- unsigned int Yl() const
- {
- return m_yl;
- }
-
- //! Returns the chroma format of the sequence (420, 422, 444)
- ChromaFormat CFormat() const
- {
- return m_cformat;
- }
-
- //! Returns the chroma width
- int ChromaWidth() const;
-
- //! Returns the chroma height
- int ChromaHeight() const;
+ //! Picture type Class
+ class PictureSort
+ {
+ public:
+ PictureSort() { fs = 0x00; } // default intra non-ref
+
+ void SetIntra() { fs &= 0xfe; }
+ void SetInter() { fs |= 0x01; }
+ void SetNonRef() { fs &= 0xfd; }
+ void SetRef() { fs |= 0x02; }
+
+ bool IsInter () const { return fs & 0x01; }
+ bool IsIntra () const { return !IsInter(); }
+ bool IsRef() const { return fs & 0x02; };
+ bool IsNonRef() const { return !IsRef(); }
+
+ void SetIntraNonRef() { SetIntra(); SetNonRef(); }
+ void SetIntraRef() { SetIntra(); SetRef(); }
+ void SetInterNonRef() { SetInter(); SetNonRef(); }
+ void SetInterRef() { SetInter(); SetRef(); }
+
+ bool IsIntraNonRef() const { return (fs & 0x03) == 0x00; }
+ bool IsIntraRef() const { return (fs & 0x03) == 0x02; }
+ bool IsInterNonRef() const { return (fs & 0x03) == 0x01; }
+ bool IsInterRef() const { return (fs & 0x03) == 0x03; }
+
+ void Clear() { fs=0x00; }
+
+ static PictureSort IntraRefPictureSort()
+ {
+ PictureSort fs;
+ fs.SetIntraRef();
+ return fs;
+ }
+
+ static PictureSort InterRefPictureSort()
+ {
+ PictureSort fs;
+ fs.SetInterRef();
+ return fs;
+ }
+
+ static PictureSort IntraNonRefPictureSort()
+ {
+ PictureSort fs;
+ fs.SetIntraNonRef();
+ return fs;
+ }
+
+ static PictureSort InterNonRefPictureSort()
+ {
+ PictureSort fs;
+ fs.SetInterNonRef();
+ return fs;
+ }
+
+ private:
+ unsigned char fs;
+ };
- //! Returns the source sampling field of the source scan format
- unsigned int SourceSampling() const
+ //! Parameters relating to the source material being encoded/decoded
+ class SourceParams
{
- return m_source_sampling;
- }
+ public:
+ //! default constructor
+ SourceParams (const VideoFormat &vf = VIDEO_FORMAT_CUSTOM,
+ bool set_defaults=true);
- //! Returns true if top field comes first in time
- bool TopFieldFirst() const
- {
- return m_topfieldfirst;
- }
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
- //! Return the number for frames per second
- Rational FrameRate() const
- {
- return m_framerate;
- }
+ // Gets
+ //! Returns video-format
+ VideoFormat GetVideoFormat() const { return m_video_format;}
- //! Return the type from the frame rate table
- FrameRateType FrameRateIndex() const
- {
- return m_fr_idx;
- }
+ //! Returns the picture width
+ unsigned int Xl() const {return m_xl;}
- //! Return the pixel aspect ratio
- Rational PixelAspectRatio() const
- {
- return m_pixel_aspect_ratio;
- }
-
- //! Return the type from the pixel aspect ratio table
- PixelAspectRatioType PixelAspectRatioIndex() const
- {
- return m_pix_asr_idx;
- }
+ //! Returns the picture height
+ unsigned int Yl() const {return m_yl;}
- // Clean area parameters
- //! Return the Clean area width
- unsigned int CleanWidth() const
- {
- return m_clean_width;
- }
- //! Return the Clean area height
- unsigned int CleanHeight() const
- {
- return m_clean_height;
- }
- //! Return the Clean area left offset
- unsigned int LeftOffset() const
- {
- return m_left_offset;
- }
- //! Return the Clean area top offset
- unsigned int TopOffset() const
- {
- return m_top_offset;
- }
+ //! Returns the chroma format of the sequence (420, 422, 444)
+ ChromaFormat CFormat() const {return m_cformat;}
- // Signal Range parameters
+ //! Returns the chroma width
+ int ChromaWidth() const;
- //! Return the type from the signal range table
- SignalRangeType SignalRangeIndex() const
- {
- return m_sr_idx;
- }
+ //! Returns the chroma height
+ int ChromaHeight() const;
- //! Return the luma offset
- unsigned int LumaOffset() const
- {
- return m_luma_offset;
- }
- //! Return the luma excursion
- unsigned int LumaExcursion() const
- {
- return m_luma_excursion;
- }
- //! Return the chroma offset
- unsigned int ChromaOffset() const
- {
- return m_chroma_offset;
- }
- //! Return the chroma excursion
- unsigned int ChromaExcursion() const
- {
- return m_chroma_excursion;
- }
+ //! Returns the source sampling field of the source scan format
+ unsigned int SourceSampling() const { return m_source_sampling; }
- //! Return the index into the colour specification table
- unsigned int ColourSpecificationIndex() const
- {
- return m_cs_idx;
- }
+ //! Returns true if top field comes first in time
+ bool TopFieldFirst() const { return m_topfieldfirst; }
- //! Return the colour primaries index
- ColourPrimaries ColourPrimariesIndex() const
- {
- return m_col_primary;
- }
- //! Return the colour matrix index
- ColourMatrix ColourMatrixIndex() const
- {
- return m_col_matrix;
- }
- //! Return the transfer function index
- TransferFunction TransferFunctionIndex() const
- {
- return m_transfer_func;
- }
+ //! Return the number for frames per second
+ Rational FrameRate() const { return m_framerate; }
- // Sets
+ //! Return the type from the frame rate table
+ FrameRateType FrameRateIndex() const { return m_fr_idx; }
+
+ //! Return the pixel aspect ratio
+ Rational PixelAspectRatio() const { return m_pixel_aspect_ratio; }
+
+ //! Return the type from the pixel aspect ratio table
+ PixelAspectRatioType PixelAspectRatioIndex() const { return m_pix_asr_idx; }
+
+ // Clean area parameters
+ //! Return the Clean area width
+ unsigned int CleanWidth() const { return m_clean_width; }
+ //! Return the Clean area height
+ unsigned int CleanHeight() const { return m_clean_height; }
+ //! Return the Clean area left offset
+ unsigned int LeftOffset() const { return m_left_offset; }
+ //! Return the Clean area top offset
+ unsigned int TopOffset() const { return m_top_offset; }
+
+ // Signal Range parameters
+
+ //! Return the type from the signal range table
+ SignalRangeType SignalRangeIndex() const { return m_sr_idx; }
+
+ //! Return the luma offset
+ unsigned int LumaOffset() const { return m_luma_offset; }
+ //! Return the luma excursion
+ unsigned int LumaExcursion() const { return m_luma_excursion; }
+ //! Return the chroma offset
+ unsigned int ChromaOffset() const { return m_chroma_offset; }
+ //! Return the chroma excursion
+ unsigned int ChromaExcursion() const { return m_chroma_excursion; }
+
+ //! Return the index into the colour specification table
+ unsigned int ColourSpecificationIndex() const { return m_cs_idx; }
+
+ //! Return the colour primaries index
+ ColourPrimaries ColourPrimariesIndex() const { return m_col_primary; }
+ //! Return the colour matrix index
+ ColourMatrix ColourMatrixIndex() const { return m_col_matrix; }
+ //! Return the transfer function index
+ TransferFunction TransferFunctionIndex() const { return m_transfer_func; }
+
+ // Sets
+
+ //! Sets the picture width
+ void SetXl(unsigned int xlen) {m_xl = xlen;}
+
+ //! Sets the picture height
+ void SetYl(unsigned int ylen) {m_yl = ylen;}
+
+ //! Sets the chroma format (Y only, 420, 422 etc)
+ void SetCFormat(ChromaFormat cf) {m_cformat=cf;}
+
+ //! Set if the source sampling field of the scan format
+ void SetSourceSampling(unsigned int source_sampling)
+ { m_source_sampling = source_sampling; }
+
+ //! Set Topfield first. True if top field comes first in time
+ void SetTopFieldFirst(bool tff) { m_topfieldfirst = tff; }
+
+ //! Sets the video format
+ void SetVideoFormat(VideoFormat vf){ m_video_format=vf;}
+
+ //! Set the frame rate
+ void SetFrameRate(const Rational &frate )
+ {
+ m_fr_idx = FRAMERATE_CUSTOM; m_framerate = frate;
+ }
+
+ //! Set the frame rate
+ void SetFrameRate(unsigned int fr_num, unsigned int fr_denom )
+ {
+ m_fr_idx = FRAMERATE_CUSTOM;
+ m_framerate.m_num = fr_num;
+ m_framerate.m_denom = fr_denom;
+ }
- //! Sets the picture width
- void SetXl(unsigned int xlen)
- {
- m_xl = xlen;
- }
+ //! Set the frame rate
+ void SetFrameRate(FrameRateType fr);
- //! Sets the picture height
- void SetYl(unsigned int ylen)
- {
- m_yl = ylen;
- }
+ //! Set the pixel aspect ratio
+ void SetPixelAspectRatio(const Rational &pix_asr)
+ {
+ m_pix_asr_idx = PIXEL_ASPECT_RATIO_CUSTOM;
+ m_pixel_aspect_ratio = pix_asr;
+ }
+
+ //! Set the pixel aspect ratio
+ void SetPixelAspectRatio(unsigned int pix_as_num, unsigned int pix_as_denom )
+ {
+ m_pix_asr_idx = PIXEL_ASPECT_RATIO_CUSTOM;
+ m_pixel_aspect_ratio.m_num = pix_as_num;
+ m_pixel_aspect_ratio.m_denom = pix_as_denom;
+ }
+
+ //! Set the Pixel Aspect Ratio
+ void SetPixelAspectRatio(PixelAspectRatioType pixel_aspect_ratio);
+
+ // Clean area parameters
+ //! Set the Clean area width
+ void SetCleanWidth(unsigned int clean_width) { m_clean_width = clean_width; }
+ //! Set the Clean area height
+ void SetCleanHeight(unsigned int clean_height) { m_clean_height = clean_height; }
+ //! Set the Clean area left offset
+ void SetLeftOffset(unsigned int left_offset) { m_left_offset = left_offset; }
+ //! Set the Clean area top offset
+ void SetTopOffset(unsigned int top_offset) { m_top_offset = top_offset; }
+
+ // Signal Range parameters
+ //! Set the Signal Range parameters
+ void SetSignalRange(SignalRangeType sr);
+
+ //! Set the luma offset
+ void SetLumaOffset(unsigned int luma_offset) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_luma_offset = luma_offset; }
+ //! Set the luma excursion
+ void SetLumaExcursion(unsigned int luma_exc) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_luma_excursion = luma_exc; }
+ //! Set the chroma offset
+ void SetChromaOffset(unsigned int chroma_off) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_chroma_offset = chroma_off; }
+ //! Set the chroma excursion
+ void SetChromaExcursion(unsigned int chroma_exc) { m_sr_idx = SIGNAL_RANGE_CUSTOM; m_chroma_excursion = chroma_exc; }
+
+ //! Set the Colour specification
+ void SetColourSpecification(unsigned int cs_idx);
+ //! Set the colour primaries index
+ void SetColourPrimariesIndex(unsigned int cp);
+ //! Set the colour matrix index
+ void SetColourMatrixIndex(unsigned int cm);
+ //! Set the transfer function index
+ void SetTransferFunctionIndex(unsigned int tf);
+
+ private:
+ //!Video-format
+ VideoFormat m_video_format;
+
+ //! Width of video
+ unsigned int m_xl;
+
+ //! Height of video
+ unsigned int m_yl;
+
+ //! Presence of chroma and/or chroma sampling structure
+ ChromaFormat m_cformat;
+
+ //! Source sampling field : 0 - progressive, 1 - interlaced
+ unsigned int m_source_sampling;
+
+ //! If m_source_sampling=1, true if the top field is first in temporal order
+ bool m_topfieldfirst;
+
+ //! Index into frame rate table
+ FrameRateType m_fr_idx;
+
+ //! Frame Rate i.e number of frames per second
+ Rational m_framerate;
+
+ //! Index into pixel aspect ratio table
+ PixelAspectRatioType m_pix_asr_idx;
+
+ //! Pixel Aspect Ratio
+ Rational m_pixel_aspect_ratio;
+
+ // Clean area parameters
+
+ //! Clean area width
+ unsigned int m_clean_width;
+
+ //! Clean area height
+ unsigned int m_clean_height;
+
+ //! Clean area left offset
+ unsigned int m_left_offset;
+
+ //! Clean area top offset
+ unsigned int m_top_offset;
+
+ // signal range parameters
+
+ //! Index into signal range table
+ SignalRangeType m_sr_idx;
+
+ //! Luma offset
+ unsigned int m_luma_offset;
+ //! Luma excursion
+ unsigned int m_luma_excursion;
+ //! Chroma offset
+ unsigned int m_chroma_offset;
+ //! Chroma excursion
+ unsigned int m_chroma_excursion;
+
+ //! Index into colour spec table
+ unsigned int m_cs_idx;
- //! Sets the chroma format (Y only, 420, 422 etc)
- void SetCFormat(ChromaFormat cf)
- {
- m_cformat = cf;
- }
+ //! Colour Primaries Index
+ ColourPrimaries m_col_primary;
- //! Set if the source sampling field of the scan format
- void SetSourceSampling(unsigned int source_sampling)
- {
- m_source_sampling = source_sampling;
- }
+ // Colour Matrix index
+ ColourMatrix m_col_matrix;
- //! Set Topfield first. True if top field comes first in time
- void SetTopFieldFirst(bool tff)
- {
- m_topfieldfirst = tff;
- }
+ // Transfer function index
+ TransferFunction m_transfer_func;
+ };
- //! Sets the video format
- void SetVideoFormat(VideoFormat vf)
- {
- m_video_format = vf;
- }
- //! Set the frame rate
- void SetFrameRate(const Rational &frate)
+ //! Parameters for initialising picture class objects
+ class PictureParams
{
- m_fr_idx = FRAMERATE_CUSTOM;
- m_framerate = frate;
- }
- //! Set the frame rate
- void SetFrameRate(unsigned int fr_num, unsigned int fr_denom)
- {
- m_fr_idx = FRAMERATE_CUSTOM;
- m_framerate.m_num = fr_num;
- m_framerate.m_denom = fr_denom;
- }
+ public:
+ //! Default constructor
+ PictureParams();
- //! Set the frame rate
- void SetFrameRate(FrameRateType fr);
+ //! Constructor
+ /*!
+ Picture chroma format is set Picture sort defaults to I picture.
+ */
+ PictureParams(const ChromaFormat& cf, int xlen, int ylen,
+ unsigned int luma_depth, unsigned int chroma_depth);
- //! Set the pixel aspect ratio
- void SetPixelAspectRatio(const Rational &pix_asr)
- {
- m_pix_asr_idx = PIXEL_ASPECT_RATIO_CUSTOM;
- m_pixel_aspect_ratio = pix_asr;
- }
+ //! Constructor
+ /*!
+ Picture chroma format and picture sort are set.
+ */
+ PictureParams(const ChromaFormat& cf, const PictureSort& fs);
- //! Set the pixel aspect ratio
- void SetPixelAspectRatio(unsigned int pix_as_num, unsigned int pix_as_denom)
- {
- m_pix_asr_idx = PIXEL_ASPECT_RATIO_CUSTOM;
- m_pixel_aspect_ratio.m_num = pix_as_num;
- m_pixel_aspect_ratio.m_denom = pix_as_denom;
- }
+ //! Constructor
+ /*!
+ Constructor. Parameters are derived from the source parameters
+ */
+ PictureParams(const SourceParams& sparams);
- //! Set the Pixel Aspect Ratio
- void SetPixelAspectRatio(PixelAspectRatioType pixel_aspect_ratio);
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
- // Clean area parameters
- //! Set the Clean area width
- void SetCleanWidth(unsigned int clean_width)
- {
- m_clean_width = clean_width;
- }
- //! Set the Clean area height
- void SetCleanHeight(unsigned int clean_height)
- {
- m_clean_height = clean_height;
- }
- //! Set the Clean area left offset
- void SetLeftOffset(unsigned int left_offset)
- {
- m_left_offset = left_offset;
- }
- //! Set the Clean area top offset
- void SetTopOffset(unsigned int top_offset)
- {
- m_top_offset = top_offset;
- }
+ // Gets ...
- // Signal Range parameters
- //! Set the Signal Range parameters
- void SetSignalRange(SignalRangeType sr);
+ //! Returns the chroma format of the picture
+ const ChromaFormat& CFormat() const{return m_cformat;}
- //! Set the luma offset
- void SetLumaOffset(unsigned int luma_offset)
- {
- m_sr_idx = SIGNAL_RANGE_CUSTOM;
- m_luma_offset = luma_offset;
- }
- //! Set the luma excursion
- void SetLumaExcursion(unsigned int luma_exc)
- {
- m_sr_idx = SIGNAL_RANGE_CUSTOM;
- m_luma_excursion = luma_exc;
- }
- //! Set the chroma offset
- void SetChromaOffset(unsigned int chroma_off)
- {
- m_sr_idx = SIGNAL_RANGE_CUSTOM;
- m_chroma_offset = chroma_off;
- }
- //! Set the chroma excursion
- void SetChromaExcursion(unsigned int chroma_exc)
- {
- m_sr_idx = SIGNAL_RANGE_CUSTOM;
- m_chroma_excursion = chroma_exc;
- }
+ //! Returns the picture width
+ int Xl() const {return m_xl;}
- //! Set the Colour specification
- void SetColourSpecification(unsigned int cs_idx);
- //! Set the colour primaries index
- void SetColourPrimariesIndex(unsigned int cp);
- //! Set the colour matrix index
- void SetColourMatrixIndex(unsigned int cm);
- //! Set the transfer function index
- void SetTransferFunctionIndex(unsigned int tf);
+ //! Returns the picture height
+ int Yl() const {return m_yl;}
-private:
- //!Video-format
- VideoFormat m_video_format;
+ //! Returns the chroma width of the picture
+ int ChromaXl() const{return m_cxl;}
- //! Width of video
- unsigned int m_xl;
+ //! Returns the chroma height of the picture
+ int ChromaYl() const{return m_cyl;}
- //! Height of video
- unsigned int m_yl;
+ //! Returns the luma depth
+ unsigned int LumaDepth() const { return m_luma_depth; }
- //! Presence of chroma and/or chroma sampling structure
- ChromaFormat m_cformat;
+ //! Returns the chroma depth
+ unsigned int ChromaDepth() const { return m_chroma_depth; }
- //! Source sampling field : 0 - progressive, 1 - interlaced
- unsigned int m_source_sampling;
+ //! Returns the type of the picture
+ const PictureSort& PicSort() const {return m_psort;}
- //! If m_source_sampling=1, true if the top field is first in temporal order
- bool m_topfieldfirst;
+ //! Returns the number of the picture (in time order)
+ int PictureNum() const {return m_fnum;}
- //! Index into frame rate table
- FrameRateType m_fr_idx;
+ //! Returns the retired reference picture number
+ int RetiredPictureNum() const {return m_retd_fnum;}
- //! Frame Rate i.e number of frames per second
- Rational m_framerate;
+ //! Returns whether the picture is bi-directionally predicted by checking references
+ bool IsBPicture() const;
- //! Index into pixel aspect ratio table
- PixelAspectRatioType m_pix_asr_idx;
+ //! Returns the number of pictures after the current picture number after which the picture can be discarded
+ int ExpiryTime() const {return m_expiry_time;}
- //! Pixel Aspect Ratio
- Rational m_pixel_aspect_ratio;
+ //! Returns an indication of whether the picture has been output yet
+ bool Output() const {return m_output;}
- // Clean area parameters
+ //! Returns a const C++ reference to the set of reference picture numbers (will be empty if the picture is an I picture)
+ const std::vector<int>& Refs() const {return m_refs;}
- //! Clean area width
- unsigned int m_clean_width;
+ //! Returns non-const C++ referece to the vector of reference pictures, to allow them to be set
+ std::vector<int>& Refs(){return m_refs;}
- //! Clean area height
- unsigned int m_clean_height;
+ //! Return the number of reference pictures
+ unsigned int NumRefs()const {return m_refs.size();}
- //! Clean area left offset
- unsigned int m_left_offset;
+ //! Returns type of picture (see enum)
+ PictureType GetPictureType () const { return m_picture_type; }
- //! Clean area top offset
- unsigned int m_top_offset;
+ //! Returns reference picture type (see enum)
+ ReferenceType GetReferenceType() const { return m_reference_type;}
- // signal range parameters
+ //! Returns true is entropy coding using Arithmetic coding
+ bool UsingAC() const { return m_using_ac; }
- //! Index into signal range table
- SignalRangeType m_sr_idx;
+ // ... Sets
- //! Luma offset
- unsigned int m_luma_offset;
- //! Luma excursion
- unsigned int m_luma_excursion;
- //! Chroma offset
- unsigned int m_chroma_offset;
- //! Chroma excursion
- unsigned int m_chroma_excursion;
+ //! Sets the type of picture
+ void SetPicSort( const PictureSort& ps );
- //! Index into colour spec table
- unsigned int m_cs_idx;
+ //! Sets the picture to be Intra/Inter
+ void SetPictureType(const PictureType ftype);
- //! Colour Primaries Index
- ColourPrimaries m_col_primary;
+ //! Sets the picture to be a reference or not
+ void SetReferenceType(const ReferenceType rtype);
- // Colour Matrix index
- ColourMatrix m_col_matrix;
+ //! Sets the picture number
+ void SetPictureNum( const int fn ){ m_fnum=fn; }
- // Transfer function index
- TransferFunction m_transfer_func;
-};
+ //! Sets how long the picture will stay in the buffer (encoder only)
+ void SetExpiryTime( const int expt ){ m_expiry_time=expt; }
+ //! Sets a flag to indicate that the picture has been output
+ void SetAsOutput(){m_output=true;}
-//! Parameters for initialising picture class objects
-class PictureParams
-{
+ //! Sets the chroma format
+ void SetCFormat(ChromaFormat cf){ m_cformat = cf; }
-public:
- //! Default constructor
- PictureParams();
+ //! Sets the picture width
+ void SetXl(int xlen);
- //! Constructor
- /*!
- Picture chroma format is set Picture sort defaults to I picture.
- */
- PictureParams(const ChromaFormat& cf, int xlen, int ylen,
- unsigned int luma_depth, unsigned int chroma_depth);
+ //! Sets the picture height
+ void SetYl(int ylen);
- //! Constructor
- /*!
- Picture chroma format and picture sort are set.
- */
- PictureParams(const ChromaFormat& cf, const PictureSort& fs);
+ //! Set Luma Depth
+ void SetLumaDepth(unsigned int luma_depth) { m_luma_depth = luma_depth; }
- //! Constructor
- /*!
- Constructor. Parameters are derived from the source parameters
- */
- PictureParams(const SourceParams& sparams);
+ //! Set Chroma Depth
+ void SetChromaDepth(unsigned int chroma_depth) { m_chroma_depth = chroma_depth; }
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- ////////////////////////////////////////////////////////////////////
+ //! Sets the retired reference picture number
+ void SetRetiredPictureNum(int retd_fnum) {m_retd_fnum = retd_fnum;}
- // Gets ...
+ //! Sets the arithmetic coding flag
+ void SetUsingAC(bool using_ac) { m_using_ac = using_ac; }
- //! Returns the chroma format of the picture
- const ChromaFormat& CFormat() const
- {
- return m_cformat;
- }
+ private:
- //! Returns the picture width
- int Xl() const
- {
- return m_xl;
- }
+ //! The chroma format
+ ChromaFormat m_cformat;
- //! Returns the picture height
- int Yl() const
- {
- return m_yl;
- }
+ //! The picture sort
+ PictureSort m_psort;
- //! Returns the chroma width of the picture
- int ChromaXl() const
- {
- return m_cxl;
- }
+ //! The set of picture numbers of reference pictures
+ std::vector<int> m_refs;
- //! Returns the chroma height of the picture
- int ChromaYl() const
- {
- return m_cyl;
- }
+ //! The number of pictures, after the current picture number, after the (de)coding of which the picture can be deleted
+ int m_expiry_time;
- //! Returns the luma depth
- unsigned int LumaDepth() const
- {
- return m_luma_depth;
- }
+ //! The picture number, in temporal order
+ int m_fnum;
- //! Returns the chroma depth
- unsigned int ChromaDepth() const
- {
- return m_chroma_depth;
- }
+ //! Picture type
+ PictureType m_picture_type;
- //! Returns the type of the picture
- const PictureSort& PicSort() const
- {
- return m_psort;
- }
+ //! Reference type
+ ReferenceType m_reference_type;
- //! Returns the number of the picture (in time order)
- int PictureNum() const
- {
- return m_fnum;
- }
+ //! True if the picture has been output, false if not
+ bool m_output;
- //! Returns the retired reference picture number
- int RetiredPictureNum() const
- {
- return m_retd_fnum;
- }
+ //! The picture number of the retired picture
+ mutable int m_retd_fnum;
- //! Returns whether the picture is bi-directionally predicted by checking references
- bool IsBPicture() const;
+ //! Picture luma width
+ int m_xl;
- //! Returns the number of pictures after the current picture number after which the picture can be discarded
- int ExpiryTime() const
- {
- return m_expiry_time;
- }
+ //! Picture luma height
+ int m_yl;
- //! Returns an indication of whether the picture has been output yet
- bool Output() const
- {
- return m_output;
- }
+ //! Picture chroma width
+ int m_cxl;
- //! Returns a const C++ reference to the set of reference picture numbers (will be empty if the picture is an I picture)
- const std::vector<int>& Refs() const
- {
- return m_refs;
- }
+ //! Picture chroma height
+ int m_cyl;
- //! Returns non-const C++ referece to the vector of reference pictures, to allow them to be set
- std::vector<int>& Refs()
- {
- return m_refs;
- }
+ //! Luma depth - number of bits required for lumz
+ unsigned int m_luma_depth;
- //! Return the number of reference pictures
- unsigned int NumRefs()const
- {
- return m_refs.size();
- }
+ //! chroma depth - number of bits required for luma
+ unsigned int m_chroma_depth;
- //! Returns type of picture (see enum)
- PictureType GetPictureType() const
- {
- return m_picture_type;
- }
+ //! arithmetic coding flag
+ bool m_using_ac;
+ };
- //! Returns reference picture type (see enum)
- ReferenceType GetReferenceType() const
- {
- return m_reference_type;
- }
- //! Returns true is entropy coding using Arithmetic coding
- bool UsingAC() const
+ //! A class for picture component data.
+ /*!
+ A class for encapsulating picture data, derived from TwoDArray.
+ */
+ class PicArray: public TwoDArray<ValueType>
{
- return m_using_ac;
- }
+ public:
+ //! Default constructor
+ /*!
+ Default constructor creates an empty array.
+ */
+ PicArray(): TwoDArray<ValueType>(){}
- // ... Sets
+ //! Constructor.
+ /*!
+ Contructor creates a two-D array, with specified size and colour
+ format.
+ */
+ PicArray(int height, int width, CompSort cs=Y_COMP):
+ TwoDArray<ValueType>(height, width), m_csort(cs){}
- //! Sets the type of picture
- void SetPicSort(const PictureSort& ps);
+ //copy constructor and assignment= derived by inheritance
- //! Sets the picture to be Intra/Inter
- void SetPictureType(const PictureType ftype);
+ //! Destructor
+ ~PicArray(){}
- //! Sets the picture to be a reference or not
- void SetReferenceType(const ReferenceType rtype);
+ //! Return which component is stored
+ const CompSort& CSort() const {return m_csort;}
+
+ //! Set the type of component being stored
+ void SetCSort(const CompSort cs){ m_csort = cs; }
- //! Sets the picture number
- void SetPictureNum(const int fn)
- {
- m_fnum = fn;
- }
+ private:
- //! Sets how long the picture will stay in the buffer (encoder only)
- void SetExpiryTime(const int expt)
- {
- m_expiry_time = expt;
- }
+ CompSort m_csort;
+ };
- //! Sets a flag to indicate that the picture has been output
- void SetAsOutput()
- {
- m_output = true;
- }
- //! Sets the chroma format
- void SetCFormat(ChromaFormat cf)
+ //! A structure for recording costs, particularly in quantisation.
+ class CostType
{
- m_cformat = cf;
- }
+ public:
+ //! The error (MSE or 4th power)
+ double Error;
- //! Sets the picture width
- void SetXl(int xlen);
+ //! The entropy in bits per symbol.
+ double ENTROPY;
- //! Sets the picture height
- void SetYl(int ylen);
+ //! The Lagrangian combination of MSE+lambda*entropy
+ double TOTAL;
+ };
- //! Set Luma Depth
- void SetLumaDepth(unsigned int luma_depth)
- {
- m_luma_depth = luma_depth;
- }
- //! Set Chroma Depth
- void SetChromaDepth(unsigned int chroma_depth)
- {
- m_chroma_depth = chroma_depth;
- }
+ //! A class used for correcting estimates of entropy.
+ /*!
+ A class used by the encoder for correcting estimates of entropy. Used
+ for selecting quantisers in subband coefficient coding. Factors can be
+ adjusted in the light of previous experience.
+ */
+ class EntropyCorrector
+ {
+ public:
+ //! Constructor.
+ /*!
+ Constructs arrays of correction factors of size.
+ \param depth the depth of the wavelet transform.
+ */
+ EntropyCorrector(int depth);
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
+
+ //! Returns the correction factor.
+ /*!
+ Returns the correction factor for the band given also the type of
+ picture and component.
+ */
+ float Factor(const int bandnum, const PictureParams& pp,
+ const CompSort c) const;
+
+ //! Update the correction factors.
+ /*!
+ Update the factors for a given subband, component and picture type.
+ \param bandnum the number of the subband to update
+ \param pp picture parameters
+ \param c component type
+ \param est_bits the number of bits it was estimated would be used
+ \param actual_bits the number of bits that actually were used
+ */
+ void Update(int bandnum, const PictureParams& pp,
+ CompSort c,int est_bits,int actual_bits);
+
+ private:
+ //! Initialises the correction factors
+ void Init();
+
+ TwoDArray<float> m_Yfctrs;
+ TwoDArray<float> m_Ufctrs;
+ TwoDArray<float> m_Vfctrs;
+ };
- //! Sets the retired reference picture number
- void SetRetiredPictureNum(int retd_fnum)
+ //! Parameters for overlapped block motion compensation
+ class OLBParams
{
- m_retd_fnum = retd_fnum;
- }
- //! Sets the arithmetic coding flag
- void SetUsingAC(bool using_ac)
- {
- m_using_ac = using_ac;
- }
+ public:
-private:
+ //! Default constructor does nothing
+ OLBParams(){}
- //! The chroma format
- ChromaFormat m_cformat;
+ //! Constructor
+ /*
+ Constructor rationalises proposed parameters to allow suitable
+ overlap and fit in with chroma format
+ \param xblen the horizontal block length
+ \param yblen the vertical block length
+ \param xblen the horizontal block separation
+ \param yblen the vertical block separation
- //! The picture sort
- PictureSort m_psort;
+ */
+ OLBParams(const int xblen, const int yblen,
+ const int xbsep, const int ybsep);
- //! The set of picture numbers of reference pictures
- std::vector<int> m_refs;
+ // Gets ...
- //! The number of pictures, after the current picture number, after the (de)coding of which the picture can be deleted
- int m_expiry_time;
+ //! Returns the horizontal block length
+ int Xblen() const {return m_xblen;}
- //! The picture number, in temporal order
- int m_fnum;
+ //! Returns the vertical block length
+ int Yblen() const {return m_yblen;}
- //! Picture type
- PictureType m_picture_type;
+ //! Returns the horizontal block separation
+ int Xbsep() const {return m_xbsep;}
- //! Reference type
- ReferenceType m_reference_type;
+ //! Returns the vertical block separation
+ int Ybsep() const {return m_ybsep;}
- //! True if the picture has been output, false if not
- bool m_output;
+ //! The offset in the horizontal start of the block caused by overlap,=(XBLEN-XBSEP)/2
+ int Xoffset() const {return m_xoffset;}
- //! The picture number of the retired picture
- mutable int m_retd_fnum;
+ //! The offset in the vertical start of the block caused by overlap,=(YBLEN-YBSEP)/2
+ int Yoffset() const {return m_yoffset;}
- //! Picture luma width
- int m_xl;
+ // ... and sets
- //! Picture luma height
- int m_yl;
+ //! Sets the block width
+ void SetXblen( int xblen ){ m_xblen = xblen; m_xoffset = (m_xblen-m_xbsep)/2;}
- //! Picture chroma width
- int m_cxl;
+ //! Sets the block height
+ void SetYblen( int yblen ){ m_yblen = yblen; m_yoffset = (m_yblen-m_ybsep)/2;}
- //! Picture chroma height
- int m_cyl;
+ //! Sets the block horizontal separation
+ void SetXbsep( int xbsep ){ m_xbsep = xbsep; m_xoffset = (m_xblen-m_xbsep)/2;}
- //! Luma depth - number of bits required for lumz
- unsigned int m_luma_depth;
+ //! Sets the block vertical separation
+ void SetYbsep( int ybsep ){ m_ybsep = ybsep; m_yoffset = (m_yblen-m_ybsep)/2;}
- //! chroma depth - number of bits required for luma
- unsigned int m_chroma_depth;
+ bool operator == (const OLBParams bparams) const;
- //! arithmetic coding flag
- bool m_using_ac;
-};
+ // overloaded stream operators
+ friend std::ostream & operator<< (std::ostream &, OLBParams &);
+ friend std::istream & operator>> (std::istream &, OLBParams &);
-//! A class for picture component data.
-/*!
- A class for encapsulating picture data, derived from TwoDArray.
- */
-class PicArray: public TwoDArray<ValueType>
-{
-public:
- //! Default constructor
- /*!
- Default constructor creates an empty array.
- */
- PicArray(): TwoDArray<ValueType>() {}
-
- //! Constructor.
- /*!
- Contructor creates a two-D array, with specified size and colour
- format.
- */
- PicArray(int height, int width, CompSort cs = Y_COMP):
- TwoDArray<ValueType>(height, width), m_csort(cs) {}
+ private:
- //copy constructor and assignment= derived by inheritance
-
- //! Destructor
- ~PicArray() {}
-
- //! Return which component is stored
- const CompSort& CSort() const
- {
- return m_csort;
- }
+ int m_xblen;
+ int m_yblen;
+ int m_xbsep;
+ int m_ybsep;
+ int m_xoffset;
+ int m_yoffset;
+ };
- //! Set the type of component being stored
- void SetCSort(const CompSort cs)
+ //! Parameters relating to the complexity of encoder/decoder
+ class ParseParams
{
- m_csort = cs;
- }
-
-private:
-
- CompSort m_csort;
-};
-
-
-//! A structure for recording costs, particularly in quantisation.
-class CostType
-{
-public:
- //! The error (MSE or 4th power)
- double Error;
-
- //! The entropy in bits per symbol.
- double ENTROPY;
+ public:
+ //! Default constructor
+ ParseParams();
- //! The Lagrangian combination of MSE+lambda*entropy
- double TOTAL;
-};
+ // Gets
+ //! Get the major version
+ unsigned int MajorVersion() const { return m_major_ver; }
-//! A class used for correcting estimates of entropy.
-/*!
- A class used by the encoder for correcting estimates of entropy. Used
- for selecting quantisers in subband coefficient coding. Factors can be
- adjusted in the light of previous experience.
- */
-class EntropyCorrector
-{
-public:
- //! Constructor.
- /*!
- Constructs arrays of correction factors of size.
- \param depth the depth of the wavelet transform.
- */
- EntropyCorrector(int depth);
-
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- ////////////////////////////////////////////////////////////////////
-
- //! Returns the correction factor.
- /*!
- Returns the correction factor for the band given also the type of
- picture and component.
- */
- float Factor(const int bandnum, const PictureParams& pp,
- const CompSort c) const;
-
- //! Update the correction factors.
- /*!
- Update the factors for a given subband, component and picture type.
- \param bandnum the number of the subband to update
- \param pp picture parameters
- \param c component type
- \param est_bits the number of bits it was estimated would be used
- \param actual_bits the number of bits that actually were used
- */
- void Update(int bandnum, const PictureParams& pp,
- CompSort c, int est_bits, int actual_bits);
+ //! Get the minor version
+ unsigned int MinorVersion() const { return m_minor_ver; }
-private:
- //! Initialises the correction factors
- void Init();
+ //! Get the Profile
+ unsigned int Profile() const { return m_profile; }
- TwoDArray<float> m_Yfctrs;
- TwoDArray<float> m_Ufctrs;
- TwoDArray<float> m_Vfctrs;
-};
+ //! Get the Level
+ unsigned int Level() const { return m_level; }
-//! Parameters for overlapped block motion compensation
-class OLBParams
-{
+ // Sets
-public:
+ //! Set the major version
+ void SetMajorVersion(unsigned int major_ver) {m_major_ver = major_ver; }
- //! Default constructor does nothing
- OLBParams() {}
+ //! Set the minor version
+ void SetMinorVersion(unsigned int minor_ver) { m_minor_ver = minor_ver; }
- //! Constructor
- /*
- Constructor rationalises proposed parameters to allow suitable
- overlap and fit in with chroma format
- \param xblen the horizontal block length
- \param yblen the vertical block length
- \param xblen the horizontal block separation
- \param yblen the vertical block separation
+ //! Set the Profile
+ void SetProfile(unsigned int profile) { m_profile = profile; }
- */
- OLBParams(const int xblen, const int yblen,
- const int xbsep, const int ybsep);
+ //! Set the Level
+ void SetLevel(unsigned int level) { m_level = level; }
- // Gets ...
-
- //! Returns the horizontal block length
- int Xblen() const
- {
- return m_xblen;
- }
-
- //! Returns the vertical block length
- int Yblen() const
- {
- return m_yblen;
- }
-
- //! Returns the horizontal block separation
- int Xbsep() const
- {
- return m_xbsep;
- }
-
- //! Returns the vertical block separation
- int Ybsep() const
- {
- return m_ybsep;
- }
-
- //! The offset in the horizontal start of the block caused by overlap,=(XBLEN-XBSEP)/2
- int Xoffset() const
- {
- return m_xoffset;
- }
-
- //! The offset in the vertical start of the block caused by overlap,=(YBLEN-YBSEP)/2
- int Yoffset() const
- {
- return m_yoffset;
- }
-
- // ... and sets
-
- //! Sets the block width
- void SetXblen(int xblen)
- {
- m_xblen = xblen;
- m_xoffset = (m_xblen - m_xbsep) / 2;
- }
+ private:
+ //! Major Version
+ unsigned int m_major_ver;
+ //! Minor Version
+ unsigned int m_minor_ver;
+ //! Profile
+ unsigned int m_profile;
+ //! Level
+ unsigned int m_level;
+ };
- //! Sets the block height
- void SetYblen(int yblen)
- {
- m_yblen = yblen;
- m_yoffset = (m_yblen - m_ybsep) / 2;
- }
+ //! Structure to hold code block sizes when spatial partitioning is used
+ class CodeBlocks
+ {
+ public:
+ //! Default Constructor
+ CodeBlocks () : m_hblocks(1), m_vblocks(1)
+ {}
+
+ //! Constructor
+ CodeBlocks (unsigned int hblocks, unsigned int vblocks) :
+ m_hblocks(hblocks),
+ m_vblocks(vblocks)
+ {}
+
+ // Gets
+ //! Return the number of horizontal code blocks
+ unsigned int HorizontalCodeBlocks() const { return m_hblocks; }
+ //! Return the number of vertical code blocks
+ unsigned int VerticalCodeBlocks() const { return m_vblocks; }
+ // Sets
+ //! Set the number of horizontal code blocks
+ void SetHorizontalCodeBlocks(unsigned int hblocks) { m_hblocks = hblocks; }
+ //! Set the number of vertical code blocks
+ void SetVerticalCodeBlocks(unsigned int vblocks) { m_vblocks = vblocks; }
+ private:
+ //! Number of Horizontal code blocks
+ unsigned int m_hblocks;
+ //! Number of Vertical code blocks
+ unsigned int m_vblocks;
+ };
- //! Sets the block horizontal separation
- void SetXbsep(int xbsep)
+ //! Structure to hold motion parameters when motion comp is used
+ class PicturePredParams
{
- m_xbsep = xbsep;
- m_xoffset = (m_xblen - m_xbsep) / 2;
- }
+ public:
+ PicturePredParams():
+ m_lbparams(3),
+ m_cbparams(3) {}
- //! Sets the block vertical separation
- void SetYbsep(int ybsep)
- {
- m_ybsep = ybsep;
- m_yoffset = (m_yblen - m_ybsep) / 2;
- }
+ //! Return the global motion flag used for encoding/decoding
+ bool UsingGlobalMotion() const { return m_use_global_motion; }
- bool operator == (const OLBParams bparams) const;
+ //! Return the number of picture weight precision bits
+ unsigned int PictureWeightsBits() const { return m_picture_weights_bits; }
- // overloaded stream operators
- friend std::ostream & operator<< (std::ostream &, OLBParams &);
- friend std::istream & operator>> (std::istream &, OLBParams &);
+ //! Return the Ref1 weight
+ int Ref1Weight() const { return m_ref1_weight; }
+ //! Return the Ref2 weight
+ int Ref2Weight() const { return m_ref2_weight; }
-private:
+ bool CustomRefWeights()
+ {
+ return (m_picture_weights_bits != 1 ||
+ m_ref1_weight != 1 ||
+ m_ref2_weight != 1);
+ }
- int m_xblen;
- int m_yblen;
- int m_xbsep;
- int m_ybsep;
- int m_xoffset;
- int m_yoffset;
-};
+ //! Return the number of superblocks horizontally
+ int XNumSB() const {return m_x_num_sb;}
-//! Parameters relating to the complexity of encoder/decoder
-class ParseParams
-{
-public:
- //! Default constructor
- ParseParams();
+ //! Return the number of superblocks vertically
+ int YNumSB() const {return m_y_num_sb;}
- // Gets
+ //! Return the number of blocks horizontally
+ int XNumBlocks() const {return m_x_num_blocks;}
- //! Get the major version
- unsigned int MajorVersion() const
- {
- return m_major_ver;
- }
+ //! Returns the number of blocks vertically
+ int YNumBlocks() const {return m_y_num_blocks;}
- //! Get the minor version
- unsigned int MinorVersion() const
- {
- return m_minor_ver;
- }
+ //! Return the Luma block parameters for each macroblock splitting level
+ const OLBParams& LumaBParams(int n) const {return m_lbparams[n];}
- //! Get the Profile
- unsigned int Profile() const
- {
- return m_profile;
- }
+ //! Return the Chroma block parameters for each macroblock splitting level
+ const OLBParams& ChromaBParams(int n) const {return m_cbparams[n];}
- //! Get the Level
- unsigned int Level() const
- {
- return m_level;
- }
+ //! Return the number of accuracy bits used for motion vectors
+ MVPrecisionType MVPrecision() const { return m_mv_precision; }
- // Sets
+ //! Set how many SBs there are horizontally
+ void SetXNumSB(const int xn){m_x_num_sb=xn;}
- //! Set the major version
- void SetMajorVersion(unsigned int major_ver)
- {
- m_major_ver = major_ver;
- }
+ //! Set how many SBs there are vertically
+ void SetYNumSB(const int yn){m_y_num_sb=yn;}
- //! Set the minor version
- void SetMinorVersion(unsigned int minor_ver)
- {
- m_minor_ver = minor_ver;
- }
+ //! Set how many blocks there are horizontally
+ void SetXNumBlocks(const int xn){m_x_num_blocks=xn;}
- //! Set the Profile
- void SetProfile(unsigned int profile)
- {
- m_profile = profile;
- }
+ //! Set how many blocks there are vertically
+ void SetYNumBlocks(const int yn){m_y_num_blocks=yn;}
- //! Set the Level
- void SetLevel(unsigned int level)
- {
- m_level = level;
- }
+ //! Set the block sizes for all SB splitting levels given these prototype block sizes for level=2
+ void SetBlockSizes(const OLBParams& olbparams , const ChromaFormat cformat);
-private:
- //! Major Version
- unsigned int m_major_ver;
- //! Minor Version
- unsigned int m_minor_ver;
- //! Profile
- unsigned int m_profile;
- //! Level
- unsigned int m_level;
-};
-
-//! Structure to hold code block sizes when spatial partitioning is used
-class CodeBlocks
-{
-public:
- //! Default Constructor
- CodeBlocks() : m_hblocks(1), m_vblocks(1)
- {}
-
- //! Constructor
- CodeBlocks(unsigned int hblocks, unsigned int vblocks) :
- m_hblocks(hblocks),
- m_vblocks(vblocks)
- {}
-
- // Gets
- //! Return the number of horizontal code blocks
- unsigned int HorizontalCodeBlocks() const
- {
- return m_hblocks;
- }
- //! Return the number of vertical code blocks
- unsigned int VerticalCodeBlocks() const
- {
- return m_vblocks;
- }
- // Sets
- //! Set the number of horizontal code blocks
- void SetHorizontalCodeBlocks(unsigned int hblocks)
- {
- m_hblocks = hblocks;
- }
- //! Set the number of vertical code blocks
- void SetVerticalCodeBlocks(unsigned int vblocks)
- {
- m_vblocks = vblocks;
- }
-private:
- //! Number of Horizontal code blocks
- unsigned int m_hblocks;
- //! Number of Vertical code blocks
- unsigned int m_vblocks;
-};
-
-//! Structure to hold motion parameters when motion comp is used
-class PicturePredParams
-{
-public:
- PicturePredParams():
- m_lbparams(3),
- m_cbparams(3) {}
+ //! Set block level luma params
+ void SetLumaBlockParams(const OLBParams& olbparams) {m_lbparams[2] = olbparams;}
- //! Return the global motion flag used for encoding/decoding
- bool UsingGlobalMotion() const
- {
- return m_use_global_motion;
- }
+ //! Set the number of accuracy bits for motion vectors
+ void SetMVPrecision(const MVPrecisionType p)
+ {
+ // Assert in debug mode. Maybe we should throw an exception???
+ TESTM((p >=0 && p <=3), "Motion precision value in range 0..3");
+ m_mv_precision = p;
+ }
- //! Return the number of picture weight precision bits
- unsigned int PictureWeightsBits() const
- {
- return m_picture_weights_bits;
- }
+ void SetMVPrecision(const MVPrecisionType p) const
+ {
+ // Assert in debug mode. Maybe we should throw an exception???
+ TESTM((p >=0 && p <=3), "Motion precision value in range 0..3");
+ m_mv_precision = p;
+ }
- //! Return the Ref1 weight
- int Ref1Weight() const
- {
- return m_ref1_weight;
- }
+ //! Set the wavelet filter used for picture (de)coding
+ void SetUsingGlobalMotion(bool gm) { m_use_global_motion=gm; }
- //! Return the Ref2 weight
- int Ref2Weight() const
- {
- return m_ref2_weight;
- }
+ //! Set the picture weight precision bits used for (de)coding
+ void SetPictureWeightsPrecision(unsigned int wt_prec) { m_picture_weights_bits=wt_prec; }
- bool CustomRefWeights()
- {
- return (m_picture_weights_bits != 1 ||
- m_ref1_weight != 1 ||
- m_ref2_weight != 1);
- }
+ //! Set the ref 1 picture weight
+ void SetRef1Weight(int wt) { m_ref1_weight=wt; }
- //! Return the number of superblocks horizontally
- int XNumSB() const
- {
- return m_x_num_sb;
- }
+ //! Set the ref 2 picture weight
+ void SetRef2Weight(int wt) { m_ref2_weight=wt; }
- //! Return the number of superblocks vertically
- int YNumSB() const
- {
- return m_y_num_sb;
- }
+ private:
- //! Return the number of blocks horizontally
- int XNumBlocks() const
- {
- return m_x_num_blocks;
- }
+ //! The number of superblocks horizontally
+ int m_x_num_sb;
- //! Returns the number of blocks vertically
- int YNumBlocks() const
- {
- return m_y_num_blocks;
- }
+ //! The number of superblocks verticaly
+ int m_y_num_sb;
- //! Return the Luma block parameters for each macroblock splitting level
- const OLBParams& LumaBParams(int n) const
- {
- return m_lbparams[n];
- }
+ //! The number of blocks horizontally
+ int m_x_num_blocks;
- //! Return the Chroma block parameters for each macroblock splitting level
- const OLBParams& ChromaBParams(int n) const
- {
- return m_cbparams[n];
- }
+ //! The number of blocks vertically
+ int m_y_num_blocks;
- //! Return the number of accuracy bits used for motion vectors
- MVPrecisionType MVPrecision() const
- {
- return m_mv_precision;
- }
+ OneDArray<OLBParams> m_lbparams;
- //! Set how many SBs there are horizontally
- void SetXNumSB(const int xn)
- {
- m_x_num_sb = xn;
- }
+ OneDArray<OLBParams> m_cbparams;
- //! Set how many SBs there are vertically
- void SetYNumSB(const int yn)
- {
- m_y_num_sb = yn;
- }
+ //! The precision of motion vectors (number of accuracy bits eg 1=half-pel accuracy)
+ mutable MVPrecisionType m_mv_precision;
- //! Set how many blocks there are horizontally
- void SetXNumBlocks(const int xn)
- {
- m_x_num_blocks = xn;
- }
+ //! picture predicion parameters - precision
+ unsigned int m_picture_weights_bits;
- //! Set how many blocks there are vertically
- void SetYNumBlocks(const int yn)
- {
- m_y_num_blocks = yn;
- }
+ //! picture predicion parameters - reference picture 1 weight
+ int m_ref1_weight;
- //! Set the block sizes for all SB splitting levels given these prototype block sizes for level=2
- void SetBlockSizes(const OLBParams& olbparams , const ChromaFormat cformat);
+ //! picture predicion parameters - reference picture 2 weight
+ int m_ref2_weight;
- //! Set block level luma params
- void SetLumaBlockParams(const OLBParams& olbparams)
- {
- m_lbparams[2] = olbparams;
- }
+ //! Global motion fields
+ bool m_use_global_motion;
- //! Set the number of accuracy bits for motion vectors
- void SetMVPrecision(const MVPrecisionType p)
- {
- // Assert in debug mode. Maybe we should throw an exception???
- TESTM((p >= 0 && p <= 3), "Motion precision value in range 0..3");
- m_mv_precision = p;
- }
+ };
- void SetMVPrecision(const MVPrecisionType p) const
+ //! Parameters common to coder and decoder operation
+ /*!
+ Parameters used throughout both the encoder and the decoder
+ */
+ class CodecParams
{
- // Assert in debug mode. Maybe we should throw an exception???
- TESTM((p >= 0 && p <= 3), "Motion precision value in range 0..3");
- m_mv_precision = p;
- }
+ public:
- //! Set the wavelet filter used for picture (de)coding
- void SetUsingGlobalMotion(bool gm)
- {
- m_use_global_motion = gm;
- }
+ //! Default constructor
+ CodecParams (const VideoFormat& video_format = VIDEO_FORMAT_CUSTOM,
+ PictureType ftype = INTRA_PICTURE,
+ unsigned int num_refs = 0,
+ bool set_defaults=true);
- //! Set the picture weight precision bits used for (de)coding
- void SetPictureWeightsPrecision(unsigned int wt_prec)
- {
- m_picture_weights_bits = wt_prec;
- }
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
- //! Set the ref 1 picture weight
- void SetRef1Weight(int wt)
- {
- m_ref1_weight = wt;
- }
+ // Gets ...
- //! Set the ref 2 picture weight
- void SetRef2Weight(int wt)
- {
- m_ref2_weight = wt;
- }
+ //! Returns the picture coding mode (independent of source format)
+ /*! Returns the picture coding mode (independent of source format)
+ * 0 = Frame coding (no quincunx)
+ * 1 = Field coding (no quincunx)
+ */
+ int PictureCodingMode() const {return m_pic_coding_mode;}
-private:
+ //! Returns true if the pictures are being coded as fields (mode 1 or 3)
+ bool FieldCoding() const { return (m_pic_coding_mode==1); }
- //! The number of superblocks horizontally
- int m_x_num_sb;
+ //! Returns true if the topmost field comes first in time when coding
+ bool TopFieldFirst() const {return m_topfieldfirst;}
- //! The number of superblocks verticaly
- int m_y_num_sb;
+ //! Return the picture/field luma width
+ int Xl() const {return m_xl;}
- //! The number of blocks horizontally
- int m_x_num_blocks;
+ //! Return the picture/field luma height
+ int Yl() const {return m_yl;}
- //! The number of blocks vertically
- int m_y_num_blocks;
+ //! Return the picture/field chroma width
+ int ChromaXl() const {return m_cxl;}
- OneDArray<OLBParams> m_lbparams;
+ //! Return the picture/field chroma height
+ int ChromaYl() const {return m_cyl;}
- OneDArray<OLBParams> m_cbparams;
+ //! Returns the luma depth
+ unsigned int LumaDepth() const { return m_luma_depth; }
- //! The precision of motion vectors (number of accuracy bits eg 1=half-pel accuracy)
- mutable MVPrecisionType m_mv_precision;
+ //! Returns the chroma depth
+ unsigned int ChromaDepth() const { return m_chroma_depth; }
- //! picture predicion parameters - precision
- unsigned int m_picture_weights_bits;
+ //! Return zero transform flag being used for picture (de)coding
+ bool ZeroTransform() const { return m_zero_transform; }
- //! picture predicion parameters - reference picture 1 weight
- int m_ref1_weight;
+ //! Return the wavelet filter currently being used for picture (de)coding
+ WltFilter TransformFilter() const { return m_wlt_filter; }
- //! picture predicion parameters - reference picture 2 weight
- int m_ref2_weight;
+ //! Return the transform depth being used for picture (de)coding
+ unsigned int TransformDepth() const { return m_wlt_depth; }
- //! Global motion fields
- bool m_use_global_motion;
+ //! Return multiple quantisers flag being used for picture (de)coding
+ CodeBlockMode GetCodeBlockMode() const { return m_cb_mode; }
-};
+ //! Return the spatial partitioning flag being used for picture (de)coding
+ bool SpatialPartition() const { return m_spatial_partition; }
-//! Parameters common to coder and decoder operation
-/*!
- Parameters used throughout both the encoder and the decoder
-*/
-class CodecParams
-{
-public:
+ //! Return the code blocks for a particular level
+ const CodeBlocks &GetCodeBlocks(unsigned int level) const;
- //! Default constructor
- CodecParams(const VideoFormat& video_format = VIDEO_FORMAT_CUSTOM,
- PictureType ftype = INTRA_PICTURE,
- unsigned int num_refs = 0,
- bool set_defaults = true);
+ //! Return the video format currently being used for picture (de)coding
+ VideoFormat GetVideoFormat() const { return m_video_format; }
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- ////////////////////////////////////////////////////////////////////
+ //! Return the picture prediction params
+ PicturePredParams& GetPicPredParams(){return m_picpredparams;}
- // Gets ...
+ //! Return the picture prediction params
+ const PicturePredParams& GetPicPredParams() const {return m_picpredparams;}
- //! Returns the picture coding mode (independent of source format)
- /*! Returns the picture coding mode (independent of source format)
- * 0 = Frame coding (no quincunx)
- * 1 = Field coding (no quincunx)
- */
- int PictureCodingMode() const
- {
- return m_pic_coding_mode;
- }
+ // ... and Sets
+ //! Sets whether input is coded as fields or quincunxially
+ void SetPictureCodingMode(int pic_coding){m_pic_coding_mode=pic_coding;}
- //! Returns true if the pictures are being coded as fields (mode 1 or 3)
- bool FieldCoding() const
- {
- return (m_pic_coding_mode == 1);
- }
+ //! Sets whether the topmost field comes first in time [NB: TBD since this duplicates metadata in the sequence header]
+ void SetTopFieldFirst(bool topf){m_topfieldfirst=topf;}
- //! Returns true if the topmost field comes first in time when coding
- bool TopFieldFirst() const
- {
- return m_topfieldfirst;
- }
+ //! Set the picture/field luma width
+ void SetXl(const int x){m_xl=x;}
- //! Return the picture/field luma width
- int Xl() const
- {
- return m_xl;
- }
+ //! Set the picture/field luma height
+ void SetYl(const int y){m_yl=y;}
- //! Return the picture/field luma height
- int Yl() const
- {
- return m_yl;
- }
+ //! Set the frame/field chroma width
+ void SetChromaXl(const int x){m_cxl=x;}
- //! Return the picture/field chroma width
- int ChromaXl() const
- {
- return m_cxl;
- }
+ //! Set the frame/field chroma height
+ void SetChromaYl(const int y){m_cyl=y;}
- //! Return the picture/field chroma height
- int ChromaYl() const
- {
- return m_cyl;
- }
+ //! Set Luma Depth
+ void SetLumaDepth(unsigned int luma_depth) { m_luma_depth = luma_depth; }
- //! Returns the luma depth
- unsigned int LumaDepth() const
- {
- return m_luma_depth;
- }
+ //! Set Chroma Depth
+ void SetChromaDepth(unsigned int chroma_depth) { m_chroma_depth = chroma_depth; }
- //! Returns the chroma depth
- unsigned int ChromaDepth() const
- {
- return m_chroma_depth;
- }
+ //! Set the zero transform flag being used for picture (de)coding
+ void SetZeroTransform(bool zero_transform) { m_zero_transform = zero_transform; }
- //! Return zero transform flag being used for picture (de)coding
- bool ZeroTransform() const
- {
- return m_zero_transform;
- }
+ //! Set the wavelet filter used for picture (de)coding
+ void SetTransformFilter(const WltFilter wf) { m_wlt_filter=wf; }
- //! Return the wavelet filter currently being used for picture (de)coding
- WltFilter TransformFilter() const
- {
- return m_wlt_filter;
- }
+ //! Set the wavelet filter used for picture (de)coding
+ void SetTransformFilter(unsigned int wf_idx);
- //! Return the transform depth being used for picture (de)coding
- unsigned int TransformDepth() const
- {
- return m_wlt_depth;
- }
+ //! Set the transform depth used for picture (de)coding and allocate for the code blocks array
+ void SetTransformDepth(unsigned int wd);
- //! Return multiple quantisers flag being used for picture (de)coding
- CodeBlockMode GetCodeBlockMode() const
- {
- return m_cb_mode;
- }
+ //! Set the multiple quantisers flag usedto picture (de)coding
+ void SetCodeBlockMode(unsigned int cb_mode);
- //! Return the spatial partitioning flag being used for picture (de)coding
- bool SpatialPartition() const
- {
- return m_spatial_partition;
- }
+ //! Set the spatial partition flag usedto picture (de)coding
+ void SetSpatialPartition(bool spatial_partition) { m_spatial_partition=spatial_partition; }
- //! Return the code blocks for a particular level
- const CodeBlocks &GetCodeBlocks(unsigned int level) const;
+ //! Set the number of code blocks for a particular level
+ void SetCodeBlocks(unsigned int level, unsigned int hblocks, unsigned int vblocks);
- //! Return the video format currently being used for picture (de)coding
- VideoFormat GetVideoFormat() const
- {
- return m_video_format;
- }
+ //! Set the video format used for picture (de)coding
+ void SetVideoFormat(const VideoFormat vd) { m_video_format=vd; }
- //! Return the picture prediction params
- PicturePredParams& GetPicPredParams()
- {
- return m_picpredparams;
- }
+ protected:
+ //! Return the Wavelet filter associated with the wavelet index
+ WltFilter TransformFilter (unsigned int wf_idx);
+ private:
- //! Return the picture prediction params
- const PicturePredParams& GetPicPredParams() const
- {
- return m_picpredparams;
- }
+ //! The picture prediction parameters
+ PicturePredParams m_picpredparams;
- // ... and Sets
- //! Sets whether input is coded as fields or quincunxially
- void SetPictureCodingMode(int pic_coding)
- {
- m_pic_coding_mode = pic_coding;
- }
+ //! The picture coding mode
+ int m_pic_coding_mode;
- //! Sets whether the topmost field comes first in time [NB: TBD since this duplicates metadata in the sequence header]
- void SetTopFieldFirst(bool topf)
- {
- m_topfieldfirst = topf;
- }
+ //! True if interlaced and top field is first in temporal order
+ bool m_topfieldfirst;
- //! Set the picture/field luma width
- void SetXl(const int x)
- {
- m_xl = x;
- }
+ //! The frame/field luma width
+ int m_xl;
- //! Set the picture/field luma height
- void SetYl(const int y)
- {
- m_yl = y;
- }
+ //! The frame/field luma height
+ int m_yl;
- //! Set the frame/field chroma width
- void SetChromaXl(const int x)
- {
- m_cxl = x;
- }
+ //! The frame/field chroma width
+ int m_cxl;
- //! Set the frame/field chroma height
- void SetChromaYl(const int y)
- {
- m_cyl = y;
- }
+ //! The frame/field chroma height
+ int m_cyl;
- //! Set Luma Depth
- void SetLumaDepth(unsigned int luma_depth)
- {
- m_luma_depth = luma_depth;
- }
+ //! Luma depth - number of bits required for lumz
+ unsigned int m_luma_depth;
- //! Set Chroma Depth
- void SetChromaDepth(unsigned int chroma_depth)
- {
- m_chroma_depth = chroma_depth;
- }
+ //! chroma depth - number of bits required for luma
+ unsigned int m_chroma_depth;
- //! Set the zero transform flag being used for picture (de)coding
- void SetZeroTransform(bool zero_transform)
- {
- m_zero_transform = zero_transform;
- }
+ //! The video format being used
+ VideoFormat m_video_format;
- //! Set the wavelet filter used for picture (de)coding
- void SetTransformFilter(const WltFilter wf)
- {
- m_wlt_filter = wf;
- }
+ //! Zero transform flag
+ bool m_zero_transform;
- //! Set the wavelet filter used for picture (de)coding
- void SetTransformFilter(unsigned int wf_idx);
+ //! The wavelet filter being used
+ WltFilter m_wlt_filter;
- //! Set the transform depth used for picture (de)coding and allocate for the code blocks array
- void SetTransformDepth(unsigned int wd);
+ //! Wavelet depth
+ unsigned int m_wlt_depth;
- //! Set the multiple quantisers flag usedto picture (de)coding
- void SetCodeBlockMode(unsigned int cb_mode);
+ //! Code block mode
+ CodeBlockMode m_cb_mode;
- //! Set the spatial partition flag usedto picture (de)coding
- void SetSpatialPartition(bool spatial_partition)
- {
- m_spatial_partition = spatial_partition;
- }
+ //! Spatial partitioning flag
+ bool m_spatial_partition;
- //! Set the number of code blocks for a particular level
- void SetCodeBlocks(unsigned int level, unsigned int hblocks, unsigned int vblocks);
+ //! Code block array. Number of entries is m_wlt_depth+1
+ OneDArray<CodeBlocks> m_cb;
+ };
- //! Set the video format used for picture (de)coding
- void SetVideoFormat(const VideoFormat vd)
+ //! Parameters for the encoding process
+ /*!
+ Parameters for the encoding process, derived from CodecParams.
+ */
+ class EncoderParams: public CodecParams
{
- m_video_format = vd;
- }
+ //codec params plus parameters relating solely to the operation of the encoder
-protected:
- //! Return the Wavelet filter associated with the wavelet index
- WltFilter TransformFilter(unsigned int wf_idx);
-private:
+ public:
+ //! Default constructor
+ EncoderParams(const VideoFormat& video_format,
+ PictureType ftype = INTER_PICTURE,
+ unsigned int num_refs = 2,
+ bool set_defaults=true);
- //! The picture prediction parameters
- PicturePredParams m_picpredparams;
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ //This means pointers are copied, not the objects they point to.////
+ ////////////////////////////////////////////////////////////////////
- //! The picture coding mode
- int m_pic_coding_mode;
+ // Gets ...
- //! True if interlaced and top field is first in temporal order
- bool m_topfieldfirst;
- //! The frame/field luma width
- int m_xl;
+ //! Returns true if we're operating verbosely, false otherwise
+ bool Verbose() const {return m_verbose;}
- //! The frame/field luma height
- int m_yl;
+ //! Returns a flag indicating that we're doing local decoding
+ bool LocalDecode() const {return m_loc_decode;}
- //! The frame/field chroma width
- int m_cxl;
+ //! Get whether we're doing lossless coding
+ bool Lossless() const {return m_lossless;}
- //! The frame/field chroma height
- int m_cyl;
+ //! Get whether we're doing full-search motion estimation
+ bool FullSearch() const {return m_full_search; }
- //! Luma depth - number of bits required for lumz
- unsigned int m_luma_depth;
+ //! Get the horizontal search range for full-search motion estimation
+ int XRangeME() const {return m_x_range_me;}
- //! chroma depth - number of bits required for luma
- unsigned int m_chroma_depth;
+ //! Get the vertical search range for full-search motion estimation
+ int YRangeME() const {return m_y_range_me;}
- //! The video format being used
- VideoFormat m_video_format;
+ //! Get whether we're doing combined component motion estimation
+ bool CombinedME() const {return m_combined_me; }
- //! Zero transform flag
- bool m_zero_transform;
+ //! Get the quality factor
+ float Qf() const {return m_qf;}
- //! The wavelet filter being used
- WltFilter m_wlt_filter;
+ //! Return the nominal number of L1 pictures before the next I picture
+ /*!
+ Return the nominal number of L1 pictures before the next I picture. Can be
+ overridden by I-picture insertion
- //! Wavelet depth
- unsigned int m_wlt_depth;
+ */
+ int NumL1() const {return m_num_L1;}
- //! Code block mode
- CodeBlockMode m_cb_mode;
+ //! Return the separation between L1 pictures (and between L1 and I pictures)
+ int L1Sep() const {return m_L1_sep;}
- //! Spatial partitioning flag
- bool m_spatial_partition;
+ //! Return the amount we're weighting noise in the U component
+ float UFactor() const {return m_ufactor;}
- //! Code block array. Number of entries is m_wlt_depth+1
- OneDArray<CodeBlocks> m_cb;
-};
+ //! Return the amount we're weighting noise in the V component
+ float VFactor() const {return m_vfactor;}
-//! Parameters for the encoding process
-/*!
- Parameters for the encoding process, derived from CodecParams.
- */
-class EncoderParams: public CodecParams
-{
- //codec params plus parameters relating solely to the operation of the encoder
+ //! Return the number of cycles per degree at the nominal viewing distance for the raster
+ float CPD() const {return m_cpd;}
-public:
- //! Default constructor
- EncoderParams(const VideoFormat& video_format,
- PictureType ftype = INTER_PICTURE,
- unsigned int num_refs = 2,
- bool set_defaults = true);
+ //! Return what prefiltering is in place
+ PrefilterType Prefilter() const {return m_prefilter;}
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- //This means pointers are copied, not the objects they point to.////
- ////////////////////////////////////////////////////////////////////
+ //! Return the prefiltering strength
+ int PrefilterStrength() const {return m_prefilter_strength;}
- // Gets ...
+ //! Return the Lagrangian parameter to be used for I pictures
+ float ILambda() const {return m_I_lambda;}
+ //! Return the Lagrangian parameter to be used for L1 pictures
+ float L1Lambda() const {return m_L1_lambda;}
- //! Returns true if we're operating verbosely, false otherwise
- bool Verbose() const
- {
- return m_verbose;
- }
+ //! Return the Lagrangian parameter to be used for L2 pictures
+ float L2Lambda() const {return m_L2_lambda;}
- //! Returns a flag indicating that we're doing local decoding
- bool LocalDecode() const
- {
- return m_loc_decode;
- }
+ //! Return the Lagrangian ME parameter to be used for L1 pictures
+ float L1MELambda() const {return m_L1_me_lambda;}
- //! Get whether we're doing lossless coding
- bool Lossless() const
- {
- return m_lossless;
- }
+ //! Return the Lagrangian ME parameter to be used for L2 pictures
+ float L2MELambda() const {return m_L2_me_lambda;}
- //! Get whether we're doing full-search motion estimation
- bool FullSearch() const
- {
- return m_full_search;
- }
+ //! Return the size of the GOP
+ int GOPLength() const;
- //! Get the horizontal search range for full-search motion estimation
- int XRangeME() const
- {
- return m_x_range_me;
- }
+ //! Return the output path to be used for storing diagnositic data
+ char * OutputPath() const {return ( char* ) m_output_path.c_str();}
- //! Get the vertical search range for full-search motion estimation
- int YRangeME() const
- {
- return m_y_range_me;
- }
+ //! Return a reference to the entropy factors
+ const EntropyCorrector& EntropyFactors() const {return *m_ent_correct;}
- //! Get whether we're doing combined component motion estimation
- bool CombinedME() const
- {
- return m_combined_me;
- }
+ //! Return a reference to the entropy factors - we need to be able to change the values of the entropy factors in situ
+ EntropyCorrector& EntropyFactors() {return *m_ent_correct;}
- //! Get the quality factor
- float Qf() const
- {
- return m_qf;
- }
+ //! Return the Wavelet filter to be used for intra pictures
+ WltFilter IntraTransformFilter() { return m_intra_wltfilter; }
- //! Return the nominal number of L1 pictures before the next I picture
- /*!
- Return the nominal number of L1 pictures before the next I picture. Can be
- overridden by I-picture insertion
+ //! Return the Wavelet filter to be used for Inter pictures
+ WltFilter InterTransformFilter() { return m_inter_wltfilter; }
- */
- int NumL1() const
- {
- return m_num_L1;
- }
+ //! Return the Target Bit Rate in kbps
+ int TargetRate() {return m_target_rate;}
- //! Return the separation between L1 pictures (and between L1 and I pictures)
- int L1Sep() const
- {
- return m_L1_sep;
- }
+ //! Return true if using Arithmetic coding
+ bool UsingAC() const {return m_using_ac;}
- //! Return the amount we're weighting noise in the U component
- float UFactor() const
- {
- return m_ufactor;
- }
+ // ... and Sets
- //! Return the amount we're weighting noise in the V component
- float VFactor() const
- {
- return m_vfactor;
- }
+ //! Sets verbosity on or off
+ void SetVerbose(bool v){m_verbose=v;}
- //! Return the number of cycles per degree at the nominal viewing distance for the raster
- float CPD() const
- {
- return m_cpd;
- }
+ //! Sets a flag indicating that we're producing a locally decoded o/p
+ void SetLocalDecode( const bool decode ){m_loc_decode=decode;}
- //! Return what prefiltering is in place
- PrefilterType Prefilter() const
- {
- return m_prefilter;
- }
+ //! Set whether we're doing lossless coding
+ void SetLossless(const bool l){m_lossless = l;}
- //! Return the prefiltering strength
- int PrefilterStrength() const
- {
- return m_prefilter_strength;
- }
+ //! Set whether we're doing full-search motion estimation
+ void SetFullSearch(const bool fs){m_full_search = fs;}
- //! Return the Lagrangian parameter to be used for I pictures
- float ILambda() const
- {
- return m_I_lambda;
- }
+ //! Set whether we're doing combined component motion estimation
+ void SetCombinedME(const bool cme){m_combined_me = cme;}
- //! Return the Lagrangian parameter to be used for L1 pictures
- float L1Lambda() const
- {
- return m_L1_lambda;
- }
+ //! Set the horizontal search range for full-search motion estimation
+ void SetXRangeME(const int xr){m_x_range_me = xr;}
- //! Return the Lagrangian parameter to be used for L2 pictures
- float L2Lambda() const
- {
- return m_L2_lambda;
- }
+ //! Set the vertical search range for full-search motion estimation
+ void SetYRangeME(const int yr){m_y_range_me = yr;}
- //! Return the Lagrangian ME parameter to be used for L1 pictures
- float L1MELambda() const
- {
- return m_L1_me_lambda;
- }
+ //! Set the quality factor
+ void SetQf(const float qfac){ m_qf=qfac; CalcLambdas(m_qf); }
- //! Return the Lagrangian ME parameter to be used for L2 pictures
- float L2MELambda() const
- {
- return m_L2_me_lambda;
- }
+ //! Set the nominal number of L1 pictures between I pictures
+ void SetNumL1(const int nl){m_num_L1=nl;}
- //! Return the size of the GOP
- int GOPLength() const;
+ //! Set the separation between L1 pictures
+ void SetL1Sep(const int lsep){m_L1_sep=lsep;}
- //! Return the output path to be used for storing diagnositic data
- char * OutputPath() const
- {
- return (char*) m_output_path.c_str();
- }
+ //! Set the amount to weight noise in the U component
+ void SetUFactor(const float uf){m_ufactor=uf;}
- //! Return a reference to the entropy factors
- const EntropyCorrector& EntropyFactors() const
- {
- return *m_ent_correct;
- }
+ //! Set the amount to weight noise in the V component
+ void SetVFactor(const float vf){m_vfactor=vf;}
- //! Return a reference to the entropy factors - we need to be able to change the values of the entropy factors in situ
- EntropyCorrector& EntropyFactors()
- {
- return *m_ent_correct;
- }
+ //! Set the number of cycles per degree at the nominal viewing distance
+ void SetCPD(const float cpd){m_cpd=cpd;}
- //! Return the Wavelet filter to be used for intra pictures
- WltFilter IntraTransformFilter()
- {
- return m_intra_wltfilter;
- }
+ //! Set denoising value - true or false
+ void SetPrefilter(const PrefilterType pf, const int str){m_prefilter=pf;
+ m_prefilter_strength=str;}
- //! Return the Wavelet filter to be used for Inter pictures
- WltFilter InterTransformFilter()
- {
- return m_inter_wltfilter;
- }
+ //! Set the output path to be used for diagnostic data
+ void SetOutputPath(const char * op){ m_output_path = op; }
- //! Return the Target Bit Rate in kbps
- int TargetRate()
- {
- return m_target_rate;
- }
+ //! Sets the entropy factors - TBD: set this up in a constructor and pass encoder params around entirely by reference
+ void SetEntropyFactors(EntropyCorrector* entcorrect){m_ent_correct=entcorrect;}
+ //! Set the Wavelet filter to be used for intra pictures
+ void SetIntraTransformFilter(unsigned int wf_idx);
- //! Return true if using Arithmetic coding
- bool UsingAC() const
- {
- return m_using_ac;
- }
+ //! Set the Wavelet filter to be used for inter pictures
+ void SetInterTransformFilter(unsigned int wf_idx);
- // ... and Sets
+ //! Set the Wavelet filter to be used for intra pictures
+ void SetIntraTransformFilter(WltFilter wf) { m_intra_wltfilter = wf; }
+
+ //! Set the number of code blocks for all levels
+ void SetUsualCodeBlocks(const PictureType& ftype);
- //! Sets verbosity on or off
- void SetVerbose(bool v)
- {
- m_verbose = v;
- }
+ //! Set the Wavelet filter to be used for inter pictures
+ void SetInterTransformFilter(WltFilter wf) { m_inter_wltfilter = wf; }
- //! Sets a flag indicating that we're producing a locally decoded o/p
- void SetLocalDecode(const bool decode)
- {
- m_loc_decode = decode;
- }
+ //! Set the target bit rate
+ void SetTargetRate(const int rate){m_target_rate = rate;}
- //! Set whether we're doing lossless coding
- void SetLossless(const bool l)
- {
- m_lossless = l;
- }
+ //! Set the arithmetic coding flag
+ void SetUsingAC(bool using_ac) {m_using_ac = using_ac;}
+ private:
- //! Set whether we're doing full-search motion estimation
- void SetFullSearch(const bool fs)
- {
- m_full_search = fs;
- }
+ //! Calculate the Lagrangian parameters from the quality factor
+ void CalcLambdas(const float qf);
- //! Set whether we're doing combined component motion estimation
- void SetCombinedME(const bool cme)
- {
- m_combined_me = cme;
- }
+ private:
- //! Set the horizontal search range for full-search motion estimation
- void SetXRangeME(const int xr)
- {
- m_x_range_me = xr;
- }
+ //! Code/decode with commentary if true
+ bool m_verbose;
- //! Set the vertical search range for full-search motion estimation
- void SetYRangeME(const int yr)
- {
- m_y_range_me = yr;
- }
+ //! Flag indicating we're doing local decoding
+ bool m_loc_decode;
- //! Set the quality factor
- void SetQf(const float qfac)
- {
- m_qf = qfac;
- CalcLambdas(m_qf);
- }
+ //! A flag indicating we're doing lossless coding
+ bool m_lossless;
- //! Set the nominal number of L1 pictures between I pictures
- void SetNumL1(const int nl)
- {
- m_num_L1 = nl;
- }
+ //! A flag indicating whether we're doing full-search block matching
+ bool m_full_search;
- //! Set the separation between L1 pictures
- void SetL1Sep(const int lsep)
- {
- m_L1_sep = lsep;
- }
+ //! A flag indicating whether we're doing combined component motion estimation
+ bool m_combined_me;
- //! Set the amount to weight noise in the U component
- void SetUFactor(const float uf)
- {
- m_ufactor = uf;
- }
+ //! The horizontal range for full-search block matching
+ int m_x_range_me;
- //! Set the amount to weight noise in the V component
- void SetVFactor(const float vf)
- {
- m_vfactor = vf;
- }
+ //! The vertical range for full-search block matching
+ int m_y_range_me;
- //! Set the number of cycles per degree at the nominal viewing distance
- void SetCPD(const float cpd)
- {
- m_cpd = cpd;
- }
+ //! Quality factor
+ float m_qf;
- //! Set denoising value - true or false
- void SetPrefilter(const PrefilterType pf, const int str)
- {
- m_prefilter = pf;
- m_prefilter_strength = str;
- }
+ //! Number of L1 pictures before next I picture
+ int m_num_L1;
- //! Set the output path to be used for diagnostic data
- void SetOutputPath(const char * op)
- {
- m_output_path = op;
- }
+ //! Separation between L1 pictures
+ int m_L1_sep;
- //! Sets the entropy factors - TBD: set this up in a constructor and pass encoder params around entirely by reference
- void SetEntropyFactors(EntropyCorrector* entcorrect)
- {
- m_ent_correct = entcorrect;
- }
- //! Set the Wavelet filter to be used for intra pictures
- void SetIntraTransformFilter(unsigned int wf_idx);
-
- //! Set the Wavelet filter to be used for inter pictures
- void SetInterTransformFilter(unsigned int wf_idx);
+ //! factor for weighting U component quantisation errors
+ float m_ufactor;
- //! Set the Wavelet filter to be used for intra pictures
- void SetIntraTransformFilter(WltFilter wf)
- {
- m_intra_wltfilter = wf;
- }
+ //! factor for weighting V component quantisation errors
+ float m_vfactor;
- //! Set the number of code blocks for all levels
- void SetUsualCodeBlocks(const PictureType& ftype);
+ //! Cycles per degree assumed for viewing the video
+ float m_cpd;
- //! Set the Wavelet filter to be used for inter pictures
- void SetInterTransformFilter(WltFilter wf)
- {
- m_inter_wltfilter = wf;
- }
-
- //! Set the target bit rate
- void SetTargetRate(const int rate)
- {
- m_target_rate = rate;
- }
-
- //! Set the arithmetic coding flag
- void SetUsingAC(bool using_ac)
- {
- m_using_ac = using_ac;
- }
-private:
+ //! Indicator for prefiltering
+ PrefilterType m_prefilter;
- //! Calculate the Lagrangian parameters from the quality factor
- void CalcLambdas(const float qf);
+ //! Prefiltering strength
+ int m_prefilter_strength;
-private:
+ //! Lagrangian parameter for Intra picture coding
+ float m_I_lambda;
- //! Code/decode with commentary if true
- bool m_verbose;
+ //! Lagrangian parameter for L1 picture coding
+ float m_L1_lambda;
- //! Flag indicating we're doing local decoding
- bool m_loc_decode;
+ //! Lagrangian parameter for L2 picture coding
+ float m_L2_lambda;
- //! A flag indicating we're doing lossless coding
- bool m_lossless;
+ //! Lagrangian param for L1 motion estimation
+ float m_L1_me_lambda;
- //! A flag indicating whether we're doing full-search block matching
- bool m_full_search;
+ //! Lagrangian param for L2 motion estimation
+ float m_L2_me_lambda;
- //! A flag indicating whether we're doing combined component motion estimation
- bool m_combined_me;
+ //! Correction factors for quantiser selection
+ EntropyCorrector* m_ent_correct;
- //! The horizontal range for full-search block matching
- int m_x_range_me;
+ //! Output file path
+ std::string m_output_path;
- //! The vertical range for full-search block matching
- int m_y_range_me;
+ //! Wavelet filter for Intra pictures
+ WltFilter m_intra_wltfilter;
- //! Quality factor
- float m_qf;
+ //! Wavelet filter for Inter pictures
+ WltFilter m_inter_wltfilter;
- //! Number of L1 pictures before next I picture
- int m_num_L1;
+ //! Target bit rate
+ int m_target_rate;
- //! Separation between L1 pictures
- int m_L1_sep;
+ //! Arithmetic coding flag
+ bool m_using_ac;
- //! factor for weighting U component quantisation errors
- float m_ufactor;
-
- //! factor for weighting V component quantisation errors
- float m_vfactor;
-
- //! Cycles per degree assumed for viewing the video
- float m_cpd;
-
- //! Indicator for prefiltering
- PrefilterType m_prefilter;
-
- //! Prefiltering strength
- int m_prefilter_strength;
-
- //! Lagrangian parameter for Intra picture coding
- float m_I_lambda;
-
- //! Lagrangian parameter for L1 picture coding
- float m_L1_lambda;
-
- //! Lagrangian parameter for L2 picture coding
- float m_L2_lambda;
-
- //! Lagrangian param for L1 motion estimation
- float m_L1_me_lambda;
-
- //! Lagrangian param for L2 motion estimation
- float m_L2_me_lambda;
+ };
- //! Correction factors for quantiser selection
- EntropyCorrector* m_ent_correct;
+ //! Parameters for the decoding process
+ /*!
+ Parameters for the decoding process. Derived from CodecParams.
+ */
+ class DecoderParams: public CodecParams
+ {
+ public:
+ //! Default constructor
+ DecoderParams(const VideoFormat& video_format = VIDEO_FORMAT_CIF, PictureType ftype=INTRA_PICTURE, unsigned int num_refs = 0, bool set_defaults = false);
- //! Output file path
- std::string m_output_path;
+ //! Returns true if we're operating verbosely, false otherwise
+ bool Verbose() const {return m_verbose;}
- //! Wavelet filter for Intra pictures
- WltFilter m_intra_wltfilter;
+ //! Sets verbosity on or off
+ void SetVerbose(bool v){m_verbose=v;}
- //! Wavelet filter for Inter pictures
- WltFilter m_inter_wltfilter;
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ //This means pointers are copied, not the objects they point to.////
+ ////////////////////////////////////////////////////////////////////
- //! Target bit rate
- int m_target_rate;
- //! Arithmetic coding flag
- bool m_using_ac;
+ private:
-};
+ //! Code/decode with commentary if true
+ bool m_verbose;
-//! Parameters for the decoding process
-/*!
- Parameters for the decoding process. Derived from CodecParams.
- */
-class DecoderParams: public CodecParams
-{
-public:
- //! Default constructor
- DecoderParams(const VideoFormat& video_format = VIDEO_FORMAT_CIF, PictureType ftype = INTRA_PICTURE, unsigned int num_refs = 0, bool set_defaults = false);
+ };
- //! Returns true if we're operating verbosely, false otherwise
- bool Verbose() const
+ //! A simple bounds checking function, very useful in a number of places
+ inline ValueType BChk(const ValueType &num, const ValueType &max)
{
- return m_verbose;
+ if(num < 0) return 0;
+ else if(num >= max) return max-1;
+ else return num;
}
- //! Sets verbosity on or off
- void SetVerbose(bool v)
+ //! Class for encapsulating quantiser data
+ class QuantiserLists
{
- m_verbose = v;
- }
-
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- //This means pointers are copied, not the objects they point to.////
- ////////////////////////////////////////////////////////////////////
+ public:
+ //! Default constructor
+ QuantiserLists();
+ //! Returns 4 times the quantisation factor
+ inline int QuantFactor4( const int index ) const {return m_qflist4[index]; }
-private:
+ //! Returns the intra Picture quantisation offset for non-zero values
+ inline int IntraQuantOffset4( const int index ) const {return m_intra_offset4[index]; }
+ //! Returns the inter Picture quantisation offset for non-zero values
+ inline int InterQuantOffset4( const int index ) const {return m_inter_offset4[index]; }
- //! Code/decode with commentary if true
- bool m_verbose;
+ //! Returns the maximum quantiser index supported
+ inline int MaxQuantIndex() const {return m_max_qindex; }
-};
-//! A simple bounds checking function, very useful in a number of places
-inline ValueType BChk(const ValueType &num, const ValueType &max)
-{
- if(num < 0) return 0;
- else if(num >= max) return max - 1;
- else return num;
-}
-
-//! Class for encapsulating quantiser data
-class QuantiserLists
-{
-public:
- //! Default constructor
- QuantiserLists();
+ private:
+ unsigned int m_max_qindex;
+ OneDArray<int> m_qflist4;
+ OneDArray<int> m_intra_offset4;
+ OneDArray<int> m_inter_offset4;
- //! Returns 4 times the quantisation factor
- inline int QuantFactor4(const int index) const
- {
- return m_qflist4[index];
- }
-
- //! Returns the intra Picture quantisation offset for non-zero values
- inline int IntraQuantOffset4(const int index) const
- {
- return m_intra_offset4[index];
- }
- //! Returns the inter Picture quantisation offset for non-zero values
- inline int InterQuantOffset4(const int index) const
- {
- return m_inter_offset4[index];
- }
-
- //! Returns the maximum quantiser index supported
- inline int MaxQuantIndex() const
- {
- return m_max_qindex;
- }
-
-
-private:
- unsigned int m_max_qindex;
- OneDArray<int> m_qflist4;
- OneDArray<int> m_intra_offset4;
- OneDArray<int> m_inter_offset4;
-
-};
+ };
-//! A constant list of the quantisers being used in Dirac
-static const QuantiserLists dirac_quantiser_lists;
+ //! A constant list of the quantisers being used in Dirac
+ static const QuantiserLists dirac_quantiser_lists;
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common_types.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common_types.h
index ab4fd8998..ef7d7a4a6 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common_types.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/common_types.h
@@ -50,59 +50,53 @@
#ifdef __cplusplus
extern "C" {
#endif
- /*
- * Some basic enumeration types used throughout the codec and by end user ...//
- */
-
- /*! Types of chroma formatting (formatNK=format not known) */
- typedef enum {
- format444, format422, format420, formatNK
- }
- ChromaFormat;
-
- /*! Types of Wavelet filters supported. filterNK - not known) */
- typedef enum
- {
- DD9_7 = 0, /* Deslauriers-Dubuc (9,7) */
- LEGALL5_3, /* LeGall (5,3) */
- DD13_7, /* Deslauriers-Dubuc (13,7) */
- HAAR0, /* Haar, no shift per level*/
- HAAR1, /* Haar, one shift per level*/
- FIDELITY, /* Fidelity wavelet */
- DAUB9_7, /* Integer approximation to Daubechies 97 */
- filterNK
- } WltFilter;
-
- /*! Enumerated type that defines prefiltering types supported by the
- encoder. */
- typedef enum
- {
- NO_PF = 0,
- DIAGLP,
- RECTLP,
- CWM
- } PrefilterType;
-
- static const int NUM_WLT_FILTERS = 8;
-
- /*! Types of picture */
- typedef enum
- {
- INTRA_PICTURE = 0,
+/*
+* Some basic enumeration types used throughout the codec and by end user ...//
+*/
+
+/*! Types of chroma formatting (formatNK=format not known) */
+typedef enum { format444, format422, format420, formatNK } ChromaFormat;
+
+/*! Types of Wavelet filters supported. filterNK - not known) */
+typedef enum
+{
+ DD9_7=0, /* Deslauriers-Dubuc (9,7) */
+ LEGALL5_3, /* LeGall (5,3) */
+ DD13_7, /* Deslauriers-Dubuc (13,7) */
+ HAAR0, /* Haar, no shift per level*/
+ HAAR1, /* Haar, one shift per level*/
+ FIDELITY, /* Fidelity wavelet */
+ DAUB9_7, /* Integer approximation to Daubechies 97 */
+ filterNK
+} WltFilter;
+
+/*! Enumerated type that defines prefiltering types supported by the
+ encoder. */
+typedef enum
+{
+ NO_PF = 0,
+ DIAGLP,
+ RECTLP,
+ CWM
+} PrefilterType;
+
+static const int NUM_WLT_FILTERS = 8;
+
+/*! Types of picture */
+typedef enum {
+ INTRA_PICTURE=0,
INTER_PICTURE
} PictureType;
- /*! Types of referencing */
- typedef enum
- {
- REFERENCE_PICTURE = 0,
+/*! Types of referencing */
+typedef enum {
+ REFERENCE_PICTURE=0,
NON_REFERENCE_PICTURE
- } ReferenceType;
+} ReferenceType;
- /*! Types for video-format */
- typedef enum
- {
- VIDEO_FORMAT_CUSTOM = 0,
+/*! Types for video-format */
+typedef enum {
+ VIDEO_FORMAT_CUSTOM=0,
VIDEO_FORMAT_QSIF525,
VIDEO_FORMAT_QCIF,
VIDEO_FORMAT_SIF525,
@@ -124,96 +118,89 @@ extern "C" {
VIDEO_FORMAT_UHDTV_8K60,
VIDEO_FORMAT_UHDTV_8K50,
VIDEO_FORMAT_UNDEFINED
- } VideoFormat;
-
- /*! Types of Colour primaries */
- typedef enum
- {
- CP_HDTV_COMP_INTERNET = 0,
- CP_SDTV_525,
- CP_SDTV_625,
- CP_DCINEMA,
- CP_UNDEF
- } ColourPrimaries;
-
- /*! Types of Colour Matrices */
- typedef enum
- {
- CM_HDTV_COMP_INTERNET = 0,
- CM_SDTV,
- CM_REVERSIBLE,
- CM_UNDEF
- } ColourMatrix;
-
- /*! Types of Transfer functions */
- typedef enum
- {
- TF_TV = 0,
- TF_EXT_GAMUT,
- TF_LINEAR,
- TF_DCINEMA,
- TF_UNDEF
- } TransferFunction;
-
- /*! Types of Picture-rate */
- typedef enum
- {
- FRAMERATE_CUSTOM = 0,
- FRAMERATE_23p97_FPS,
- FRAMERATE_24_FPS,
- FRAMERATE_25_FPS,
- FRAMERATE_29p97_FPS,
- FRAMERATE_30_FPS,
- FRAMERATE_50_FPS,
- FRAMERATE_59p94_FPS,
- FRAMERATE_60_FPS,
- FRAMERATE_14p98_FPS,
- FRAMERATE_12p5_FPS,
- FRAMERATE_UNDEFINED
- } FrameRateType;
-
- /*! Types of Aspect Ratio */
- typedef enum
- {
- PIXEL_ASPECT_RATIO_CUSTOM = 0,
- PIXEL_ASPECT_RATIO_1_1,
- PIXEL_ASPECT_RATIO_10_11,
- PIXEL_ASPECT_RATIO_12_11,
- PIXEL_ASPECT_RATIO_40_33,
- PIXEL_ASPECT_RATIO_16_11,
- PIXEL_ASPECT_RATIO_4_3,
- PIXEL_ASPECT_RATIO_UNDEFINED
- } PixelAspectRatioType;
-
-
- /*! Types of signal range */
- typedef enum
- {
- SIGNAL_RANGE_CUSTOM = 0,
- SIGNAL_RANGE_8BIT_FULL,
- SIGNAL_RANGE_8BIT_VIDEO,
- SIGNAL_RANGE_10BIT_VIDEO,
- SIGNAL_RANGE_12BIT_VIDEO,
- SIGNAL_RANGE_UNDEFINED
- } SignalRangeType;
-
- /*! Types of motion-vector precision */
- typedef enum
- {
- MV_PRECISION_PIXEL = 0,
- MV_PRECISION_HALF_PIXEL,
- MV_PRECISION_QUARTER_PIXEL,
- MV_PRECISION_EIGHTH_PIXEL,
- MV_PRECISION_UNDEFINED
- } MVPrecisionType;
-
- /*! Type of quantiser modes when spatial partitioning is enabled */
- typedef enum
- {
- QUANT_SINGLE,
- QUANT_MULTIPLE,
- QUANT_UNDEF
- } CodeBlockMode;
+} VideoFormat;
+
+/*! Types of Colour primaries */
+typedef enum {
+ CP_HDTV_COMP_INTERNET=0,
+ CP_SDTV_525,
+ CP_SDTV_625,
+ CP_DCINEMA,
+ CP_UNDEF
+}ColourPrimaries;
+
+/*! Types of Colour Matrices */
+typedef enum {
+ CM_HDTV_COMP_INTERNET=0,
+ CM_SDTV,
+ CM_REVERSIBLE,
+ CM_UNDEF
+}ColourMatrix;
+
+/*! Types of Transfer functions */
+typedef enum {
+ TF_TV=0,
+ TF_EXT_GAMUT,
+ TF_LINEAR,
+ TF_DCINEMA,
+ TF_UNDEF
+} TransferFunction;
+
+/*! Types of Picture-rate */
+typedef enum {
+ FRAMERATE_CUSTOM=0,
+ FRAMERATE_23p97_FPS,
+ FRAMERATE_24_FPS,
+ FRAMERATE_25_FPS,
+ FRAMERATE_29p97_FPS,
+ FRAMERATE_30_FPS,
+ FRAMERATE_50_FPS,
+ FRAMERATE_59p94_FPS,
+ FRAMERATE_60_FPS,
+ FRAMERATE_14p98_FPS,
+ FRAMERATE_12p5_FPS,
+ FRAMERATE_UNDEFINED
+} FrameRateType;
+
+/*! Types of Aspect Ratio */
+typedef enum {
+ PIXEL_ASPECT_RATIO_CUSTOM=0,
+ PIXEL_ASPECT_RATIO_1_1,
+ PIXEL_ASPECT_RATIO_10_11,
+ PIXEL_ASPECT_RATIO_12_11,
+ PIXEL_ASPECT_RATIO_40_33,
+ PIXEL_ASPECT_RATIO_16_11,
+ PIXEL_ASPECT_RATIO_4_3,
+ PIXEL_ASPECT_RATIO_UNDEFINED
+} PixelAspectRatioType;
+
+
+/*! Types of signal range */
+typedef enum {
+ SIGNAL_RANGE_CUSTOM=0,
+ SIGNAL_RANGE_8BIT_FULL,
+ SIGNAL_RANGE_8BIT_VIDEO,
+ SIGNAL_RANGE_10BIT_VIDEO,
+ SIGNAL_RANGE_12BIT_VIDEO,
+ SIGNAL_RANGE_UNDEFINED
+} SignalRangeType;
+
+/*! Types of motion-vector precision */
+typedef enum {
+ MV_PRECISION_PIXEL=0,
+ MV_PRECISION_HALF_PIXEL,
+ MV_PRECISION_QUARTER_PIXEL,
+ MV_PRECISION_EIGHTH_PIXEL,
+ MV_PRECISION_UNDEFINED
+} MVPrecisionType;
+
+/*! Type of quantiser modes when spatial partitioning is enabled */
+typedef enum
+{
+ QUANT_SINGLE,
+ QUANT_MULTIPLE,
+ QUANT_UNDEF
+} CodeBlockMode;
#ifdef __cplusplus
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.cpp
index 9e0b320f5..747c64998 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.cpp
@@ -44,19 +44,19 @@ using namespace dirac;
namespace dirac
{
-void dirac_assert(const char *p_fname, int line_number, const char *p_mess)
+void dirac_assert( const char *p_fname, int line_number, const char *p_mess )
{
- dirac_report(p_fname, line_number, p_mess);
+ dirac_report( p_fname, line_number, p_mess );
// dump core
- abort();
+ abort ();
}
-void dirac_report(const char *p_fname, int line_number, const char *p_mess)
+void dirac_report( const char *p_fname, int line_number, const char *p_mess )
{
std::string errMess("Assertion ");
-
- if(p_mess)
- errMess = errMess + "^ " + std::string(p_mess) + " ^" + " failed";
+
+ if ( p_mess )
+ errMess = errMess + "^ " + std::string(p_mess) + " ^" +" failed";
else
errMess += " failure";
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.h
index f773fa3e7..209447e84 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_assertions.h
@@ -70,10 +70,10 @@ namespace dirac
/*! Print a message to standard error and abort if in debug mode */
-void dirac_assert(const char *p_fname, int line_number, const char *p_mess);
+void dirac_assert( const char *p_fname, int line_number, const char *p_mess);
/*! Print a message to standard error */
-void dirac_report(const char *p_fname, int line_number, const char *p_mess);
+void dirac_report( const char *p_fname, int line_number, const char *p_mess);
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.cpp
index c1741799d..b42e42748 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.cpp
@@ -50,20 +50,20 @@ DiracException::DiracException(
const DiracErrorCode& errorCode,
const string& errorMessage,
const DiracSeverityCode& severityCode)
- : mErrorCode(errorCode),
- mSeverityCode(severityCode),
- mErrorMessage(errorMessage)
+: mErrorCode(errorCode),
+ mSeverityCode(severityCode),
+ mErrorMessage(errorMessage)
{
}
DiracException::DiracException(
const DiracException& src)
- : mErrorCode(src.mErrorCode)
- , mSeverityCode(src.mSeverityCode)
- , mErrorMessage(src.mErrorMessage)
+: mErrorCode(src.mErrorCode)
+, mSeverityCode(src.mSeverityCode)
+, mErrorMessage(src.mErrorMessage)
{
-
+
}
DiracException::~DiracException()
@@ -78,7 +78,7 @@ DiracErrorCode DiracException::GetErrorCode() const
return mErrorCode;
}
-DiracSeverityCode DiracException::GetSeverityCode() const
+ DiracSeverityCode DiracException::GetSeverityCode() const
{
return mSeverityCode;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.h
index 9f417d2b9..44c54cb0d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_exception.h
@@ -48,41 +48,38 @@
#include <iostream> // has an ostringstream
-namespace dirac
-{
+namespace dirac {
-/**
- * Enumeration of Dirac-defined error codes.
- *
- *
- */
-enum DiracErrorCode
-{
- ERR_UNSUPPORTED_STREAM_DATA = 0,
- ERR_END_OF_STREAM,
- ERR_INVALID_VIDEO_FORMAT,
- ERR_INVALID_CHROMA_FORMAT,
- ERR_INVALID_PICTURE_RATE,
- ERR_INVALID_SIGNAL_RANGE,
- ERR_INVALID_PIXEL_ASPECT_RATIO,
- ERR_INVALID_VIDEO_DEPTH,
- ERR_INVALID_MOTION_VECTOR_PRECISION,
- ERR_INVALID_INIT_DATA
-
-};
+ /**
+ * Enumeration of Dirac-defined error codes.
+ *
+ *
+ */
+ enum DiracErrorCode {
+ ERR_UNSUPPORTED_STREAM_DATA=0,
+ ERR_END_OF_STREAM,
+ ERR_INVALID_VIDEO_FORMAT,
+ ERR_INVALID_CHROMA_FORMAT,
+ ERR_INVALID_PICTURE_RATE,
+ ERR_INVALID_SIGNAL_RANGE,
+ ERR_INVALID_PIXEL_ASPECT_RATIO,
+ ERR_INVALID_VIDEO_DEPTH,
+ ERR_INVALID_MOTION_VECTOR_PRECISION,
+ ERR_INVALID_INIT_DATA
+
+ };
-/**
-* Error-severity states
-*/
-enum DiracSeverityCode
-{
- SEVERITY_NO_ERROR = 0,
- SEVERITY_WARNING,
- SEVERITY_PICTURE_ERROR,
- SEVERITY_ACCESSUNIT_ERROR,
- SEVERITY_SEQUENCE_ERROR,
- SEVERITY_TERMINATE
-};
+ /**
+ * Error-severity states
+ */
+ enum DiracSeverityCode {
+ SEVERITY_NO_ERROR=0,
+ SEVERITY_WARNING,
+ SEVERITY_PICTURE_ERROR,
+ SEVERITY_ACCESSUNIT_ERROR,
+ SEVERITY_SEQUENCE_ERROR,
+ SEVERITY_TERMINATE
+ };
/**
* DiracException is the class which should be used for all exceptions
@@ -164,7 +161,7 @@ private:
*/
std::string mErrorMessage;
-
+
// UNIMPLEMENTED METHODS
DiracException& operator=(const DiracException&);
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_types.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_types.h
index d9fd2952b..cc7cd7f54 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_types.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/dirac_types.h
@@ -41,7 +41,7 @@
#include <libdirac_common/common_types.h>
-/*! This file contains common enumerated types used throughout
+/*! This file contains common enumerated types used throughout
the end user interfaces to the encoder and decoder
*/
@@ -55,13 +55,13 @@ extern "C" {
#define DllExport
#endif
- /*
- * Major version corresponds to major version of the software.
- * Minor version corresponds to minor version of the software. Bump
- * this up by one whenever there are major feature changes to the software.
- * Patch version corresponds to changes in the API. It should be
- * bumped up by 1 for every committed change to the API
- */
+/*
+* Major version corresponds to major version of the software.
+* Minor version corresponds to minor version of the software. Bump
+* this up by one whenever there are major feature changes to the software.
+* Patch version corresponds to changes in the API. It should be
+* bumped up by 1 for every committed change to the API
+*/
#define DIRAC_RESEARCH_MAJOR_VERSION 1 /* 0..255 */
#define DIRAC_RESEARCH_MINOR_VERSION 0 /* 0..255 */
#define DIRAC_RESEARCH_PATCH_VERSION 2 /* 0..255 */
@@ -77,122 +77,122 @@ extern "C" {
#define DIRAC_RESEARCH_VERSION_ATLEAST(X, Y, Z) \
(DIRAC_RESEARCH_CURVERSION >= DIRAC_RESEARCH_VERSION(X, Y, Z))
- /*
- * Some basic enumeration types used by end user encoder and decoder ...//
- */
- typedef ChromaFormat dirac_chroma_t;
- typedef PictureType dirac_picture_type_t;
- typedef ReferenceType dirac_reference_type_t;
- typedef WltFilter dirac_wlt_filter_t;
-
- typedef struct
- {
- int numerator;
- int denominator;
- } dirac_rational_t;
-
- typedef dirac_rational_t dirac_frame_rate_t;
- typedef dirac_rational_t dirac_pix_asr_t;
-
- /*! Structure that holds the parase parameters */
- typedef struct
- {
- //! Major version
- unsigned int major_ver;
- //! Minor version
- unsigned int minor_ver;
- //! Profile
- unsigned int profile;
- //! level
- unsigned int level;
- } dirac_parseparams_t;
-
- typedef struct
- {
- unsigned int width;
- unsigned int height;
- unsigned int left_offset;
- unsigned int top_offset;
- } dirac_clean_area_t;
-
- typedef struct
- {
- unsigned int luma_offset;
- unsigned int luma_excursion;
- unsigned int chroma_offset;
- unsigned int chroma_excursion;
- } dirac_signal_range_t;
-
- typedef struct
- {
- float kr;
- float kb;
- } dirac_col_matrix_t;
-
- typedef ColourPrimaries dirac_col_primaries_t;
- typedef TransferFunction dirac_transfer_func_t;
-
- typedef struct
- {
- dirac_col_primaries_t col_primary;
- dirac_col_matrix_t col_matrix;
- dirac_transfer_func_t trans_func;
- } dirac_colour_spec_t;
-
- /*! Structure that holds the source parameters */
- typedef struct
- {
- /*! numper of pixels per line */
- unsigned int width;
- /*! number of lines per frame */
- unsigned int height;
- /*! chroma type */
- dirac_chroma_t chroma;
- /*! numper of pixels of chroma per line */
- unsigned int chroma_width;
- /*! number of lines of chroma per frame */
- unsigned int chroma_height;
- /*! source sampling field: 0 - progressive; 1 - interlaced */
- unsigned int source_sampling;
- /*! top field comes first : 0 - false; 1 - true. Set by Dirac library. */
- int topfieldfirst;
- /*! frame rate */
- dirac_frame_rate_t frame_rate;
- /*! pixel aspect ratio */
- dirac_pix_asr_t pix_asr;
- /* clean area*/
- dirac_clean_area_t clean_area;
- /* signal range*/
- dirac_signal_range_t signal_range;
- /* colour specification*/
- dirac_colour_spec_t colour_spec;
-
- } dirac_sourceparams_t;
-
- /*! Structure that holds the picture parameters */
- typedef struct
- {
- /*! picture type */
- dirac_picture_type_t ptype;
- /*! reference type */
- dirac_reference_type_t rtype;
- /*! picture number in decoded order */
- int pnum;
- } dirac_picparams_t;
-
-
- /*! Structure that holds the frame buffers into which data is written
- (NB we have frame-oriented IO even though we code pictures)*/
- typedef struct
- {
- /*! buffers to hold the luma and chroma data */
- unsigned char *buf[3];
- /*! user data */
- void *id;
- } dirac_framebuf_t;
+/*
+* Some basic enumeration types used by end user encoder and decoder ...//
+*/
+typedef ChromaFormat dirac_chroma_t;
+typedef PictureType dirac_picture_type_t;
+typedef ReferenceType dirac_reference_type_t;
+typedef WltFilter dirac_wlt_filter_t;
+
+typedef struct
+{
+ int numerator;
+ int denominator;
+} dirac_rational_t;
+
+typedef dirac_rational_t dirac_frame_rate_t;
+typedef dirac_rational_t dirac_pix_asr_t;
+
+/*! Structure that holds the parase parameters */
+typedef struct
+{
+ //! Major version
+ unsigned int major_ver;
+ //! Minor version
+ unsigned int minor_ver;
+ //! Profile
+ unsigned int profile;
+ //! level
+ unsigned int level;
+} dirac_parseparams_t;
+
+typedef struct
+{
+ unsigned int width;
+ unsigned int height;
+ unsigned int left_offset;
+ unsigned int top_offset;
+} dirac_clean_area_t;
+
+typedef struct
+{
+ unsigned int luma_offset;
+ unsigned int luma_excursion;
+ unsigned int chroma_offset;
+ unsigned int chroma_excursion;
+} dirac_signal_range_t;
+
+typedef struct
+{
+ float kr;
+ float kb;
+} dirac_col_matrix_t;
+
+typedef ColourPrimaries dirac_col_primaries_t;
+typedef TransferFunction dirac_transfer_func_t;
+
+typedef struct
+{
+ dirac_col_primaries_t col_primary;
+ dirac_col_matrix_t col_matrix;
+ dirac_transfer_func_t trans_func;
+} dirac_colour_spec_t;
+
+/*! Structure that holds the source parameters */
+typedef struct
+{
+ /*! numper of pixels per line */
+ unsigned int width;
+ /*! number of lines per frame */
+ unsigned int height;
+ /*! chroma type */
+ dirac_chroma_t chroma;
+ /*! numper of pixels of chroma per line */
+ unsigned int chroma_width;
+ /*! number of lines of chroma per frame */
+ unsigned int chroma_height;
+ /*! source sampling field: 0 - progressive; 1 - interlaced */
+ unsigned int source_sampling;
+ /*! top field comes first : 0 - false; 1 - true. Set by Dirac library. */
+ int topfieldfirst;
+ /*! frame rate */
+ dirac_frame_rate_t frame_rate;
+ /*! pixel aspect ratio */
+ dirac_pix_asr_t pix_asr;
+ /* clean area*/
+ dirac_clean_area_t clean_area;
+ /* signal range*/
+ dirac_signal_range_t signal_range;
+ /* colour specification*/
+ dirac_colour_spec_t colour_spec;
+
+} dirac_sourceparams_t;
+
+/*! Structure that holds the picture parameters */
+typedef struct
+{
+ /*! picture type */
+ dirac_picture_type_t ptype;
+ /*! reference type */
+ dirac_reference_type_t rtype;
+ /*! picture number in decoded order */
+ int pnum;
+} dirac_picparams_t;
+
+
+/*! Structure that holds the frame buffers into which data is written
+(NB we have frame-oriented IO even though we code pictures)*/
+typedef struct
+{
+ /*! buffers to hold the luma and chroma data */
+ unsigned char *buf[3];
+ /*! user data */
+ void *id;
+} dirac_framebuf_t;
#ifdef __cplusplus
}
#endif
-#endif
+#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.cpp
index 10fb53229..7fe5515c9 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.cpp
@@ -61,36 +61,36 @@ using std::vector;
// MV precision value in the PicturePredParams to instantiate the
// appropriate MotionCompensation sub-class.
void MotionCompensator::CompensatePicture(const PicturePredParams &ppp,
- const AddOrSub direction ,
- const MvData& mv_data,
- Picture* in_pic ,
- Picture* refsptr[2])
+ const AddOrSub direction ,
+ const MvData& mv_data,
+ Picture* in_pic ,
+ Picture* refsptr[2])
{
- switch(ppp.MVPrecision())
+ switch (ppp.MVPrecision())
{
case MV_PRECISION_EIGHTH_PIXEL:
{
MotionCompensator_EighthPixel my_comp(ppp);
- my_comp.CompensatePicture(direction , mv_data, in_pic, refsptr);
+ my_comp.CompensatePicture( direction , mv_data, in_pic, refsptr);
break;
}
case MV_PRECISION_HALF_PIXEL:
{
MotionCompensator_HalfPixel my_comp(ppp);
- my_comp.CompensatePicture(direction , mv_data, in_pic, refsptr);
+ my_comp.CompensatePicture( direction , mv_data, in_pic, refsptr);
break;
}
case MV_PRECISION_PIXEL:
{
MotionCompensator_Pixel my_comp(ppp);
- my_comp.CompensatePicture(direction , mv_data, in_pic, refsptr);
+ my_comp.CompensatePicture( direction , mv_data, in_pic, refsptr);
break;
}
case MV_PRECISION_QUARTER_PIXEL:
default:
{
MotionCompensator_QuarterPixel my_comp(ppp);
- my_comp.CompensatePicture(direction , mv_data, in_pic, refsptr);
+ my_comp.CompensatePicture( direction , mv_data, in_pic, refsptr);
break;
}
}
@@ -103,7 +103,7 @@ void MotionCompensator::CompensatePicture(const PicturePredParams &ppp,
// motion compensation. Creates the necessary arithmetic objects and
// calls ReConfig to create weighting blocks to fit the values within
// m_predparams.
-MotionCompensator::MotionCompensator(const PicturePredParams &ppp):
+MotionCompensator::MotionCompensator( const PicturePredParams &ppp ):
m_predparams(ppp),
luma_or_chroma(true)
{
@@ -128,62 +128,61 @@ MotionCompensator::~MotionCompensator()
}
//Called to perform motion compensated addition/subtraction on an entire picture.
-void MotionCompensator::CompensatePicture(const AddOrSub direction ,
- const MvData& mv_data,
- Picture* my_picture ,
- Picture* refsptr[2])
+void MotionCompensator::CompensatePicture( const AddOrSub direction ,
+ const MvData& mv_data,
+ Picture* my_picture ,
+ Picture* refsptr[2])
{
- m_add_or_sub = direction;
-
- const PictureSort& psort = my_picture->GetPparams().PicSort();
-
- m_cformat = my_picture->GetPparams().CFormat();
-
- if(psort.IsInter())
- {
- //we can motion compensate
-
- const std::vector<int>& refs = my_picture->GetPparams().Refs();
-
- // Now check that references are marked correctly
- if(!refsptr[0]->GetPparams().PicSort().IsRef())
- {
- std::cout << std::endl << "WARNING! Reference picture (number " << refs[0];
- std::cout << ") being used is not marked as a reference. Incorrect output is likely.";
- }
- if(refsptr[0]->GetPparams().PictureNum() != refs[0])
- {
- std::cout << std::endl << "WARNING! Reference picture number 0 ";
- std::cout << "does not agree(" << refsptr[0]->GetPparams().PictureNum() << " and ";
- std::cout << refs[0] << "). Incorrect output is likely.";
- }
-
-
- if(refs.size() > 1)
- {
- if(!refsptr[1]->GetPparams().PicSort().IsRef())
- {
- std::cout << std::endl << "WARNING! Reference picture (number ";
- std::cout << refs[1] << ") being used is not marked as a reference. Incorrect output is likely.";
- }
- if(refsptr[1]->GetPparams().PictureNum() != refs[1])
- {
- std::cout << std::endl << "WARNING! Reference picture number 1 ";
- std::cout << "does not agree(" << refsptr[1]->GetPparams().PictureNum() << " and ";
- std::cout << refs[1] << "). Incorrect output is likely.";
- }
- }
- else
- refsptr[1] = refsptr[0];
-
- luma_or_chroma = true;
- //now do all the components
- CompensateComponent(my_picture , refsptr, mv_data , Y_COMP);
-
- luma_or_chroma = false;
- CompensateComponent(my_picture , refsptr, mv_data , U_COMP);
- CompensateComponent(my_picture , refsptr, mv_data , V_COMP);
- }
+ m_add_or_sub = direction;
+
+ const PictureSort& psort=my_picture->GetPparams().PicSort();
+
+ m_cformat = my_picture->GetPparams().CFormat();
+
+ if (psort.IsInter())
+ {//we can motion compensate
+
+ const std::vector<int>& refs=my_picture->GetPparams().Refs();
+
+ // Now check that references are marked correctly
+ if ( !refsptr[0]->GetPparams().PicSort().IsRef() )
+ {
+ std::cout<<std::endl<<"WARNING! Reference picture (number "<<refs[0];
+ std::cout<<") being used is not marked as a reference. Incorrect output is likely.";
+ }
+ if ( refsptr[0]->GetPparams().PictureNum() != refs[0] )
+ {
+ std::cout<<std::endl<<"WARNING! Reference picture number 0 ";
+ std::cout<<"does not agree("<<refsptr[0]->GetPparams().PictureNum()<<" and ";
+ std::cout<<refs[0]<<"). Incorrect output is likely.";
+ }
+
+
+ if ( refs.size()>1 )
+ {
+ if ( !refsptr[1]->GetPparams().PicSort().IsRef() )
+ {
+ std::cout<<std::endl<<"WARNING! Reference picture (number ";
+ std::cout<<refs[1]<<") being used is not marked as a reference. Incorrect output is likely.";
+ }
+ if ( refsptr[1]->GetPparams().PictureNum() != refs[1])
+ {
+ std::cout<<std::endl<<"WARNING! Reference picture number 1 ";
+ std::cout<<"does not agree("<<refsptr[1]->GetPparams().PictureNum()<<" and ";
+ std::cout<<refs[1]<<"). Incorrect output is likely.";
+ }
+ }
+ else
+ refsptr[1] = refsptr[0];
+
+ luma_or_chroma = true;
+ //now do all the components
+ CompensateComponent( my_picture , refsptr, mv_data , Y_COMP );
+
+ luma_or_chroma = false;
+ CompensateComponent( my_picture , refsptr, mv_data , U_COMP);
+ CompensateComponent( my_picture , refsptr, mv_data , V_COMP);
+ }
}
//--private member functions--//
@@ -195,7 +194,7 @@ void MotionCompensator::CompensatePicture(const AddOrSub direction ,
//blocks.
void MotionCompensator::ReConfig()
{
- if(luma_or_chroma)
+ if (luma_or_chroma)
m_bparams = m_predparams.LumaBParams(2);
else
m_bparams = m_predparams.ChromaBParams(2);
@@ -205,65 +204,65 @@ void MotionCompensator::ReConfig()
// Total shift = shift assuming equal picture weights +
// picture weights precision
- int blocks_per_mb_row = m_predparams.XNumBlocks() / m_predparams.XNumSB();
- int blocks_per_sb_row = blocks_per_mb_row >> 1;
- int mb_xlen = m_bparams.Xblen() * blocks_per_mb_row - (m_bparams.Xblen() - m_bparams.Xbsep()) * (blocks_per_mb_row - 1);
+ int blocks_per_mb_row = m_predparams.XNumBlocks()/m_predparams.XNumSB();
+ int blocks_per_sb_row = blocks_per_mb_row>>1;
+ int mb_xlen = m_bparams.Xblen()*blocks_per_mb_row - (m_bparams.Xblen()-m_bparams.Xbsep())*(blocks_per_mb_row-1);
int mb_ylen = m_bparams.Yblen();
- int mb_xsep = mb_xlen - (m_bparams.Xblen() - m_bparams.Xbsep());
+ int mb_xsep = mb_xlen - (m_bparams.Xblen()-m_bparams.Xbsep());
int mb_ysep = m_bparams.Ybsep();
- int sb_xlen = m_bparams.Xblen() * blocks_per_sb_row - (m_bparams.Xblen() - m_bparams.Xbsep()) * (blocks_per_sb_row - 1);
+ int sb_xlen = m_bparams.Xblen()*blocks_per_sb_row - (m_bparams.Xblen()-m_bparams.Xbsep())*(blocks_per_sb_row-1);
int sb_ylen = m_bparams.Yblen();
int sb_xsep = sb_xlen - (m_bparams.Xblen() - m_bparams.Xbsep());
int sb_ysep = m_bparams.Ybsep();
for(int i = 0; i < 9; i++)
{
- m_block_weights[i].Resize(m_bparams.Yblen() , m_bparams.Xblen());
- m_macro_block_weights[i].Resize(mb_ylen , mb_xlen);
- m_sub_block_weights[i].Resize(sb_ylen , sb_xlen);
+ m_block_weights[i].Resize( m_bparams.Yblen() , m_bparams.Xblen() );
+ m_macro_block_weights[i].Resize( mb_ylen , mb_xlen );
+ m_sub_block_weights[i].Resize( sb_ylen , sb_xlen );
}
// Firstly calculate the non-weighted Weighting blocks. i,e, assuming that
// the picture_weight for each reference picture is 1.
// Calculate non-weighted Block Weights
- CalculateWeights(m_bparams.Xbsep(), m_bparams.Ybsep(), m_block_weights);
+ CalculateWeights( m_bparams.Xbsep(), m_bparams.Ybsep(), m_block_weights );
// Calculate non-weighted "macro" Block Weights
- CalculateWeights(mb_xsep, mb_ysep , m_macro_block_weights);
+ CalculateWeights( mb_xsep, mb_ysep , m_macro_block_weights );
// Calculate non-weighted superblock Weights
- CalculateWeights(sb_xsep, sb_ysep , m_sub_block_weights);
+ CalculateWeights( sb_xsep, sb_ysep , m_sub_block_weights );
}
-void MotionCompensator::CompensateComponent(Picture* pic ,
- Picture* refsptr[2] ,
- const MvData& mv_data ,
- const CompSort cs)
+void MotionCompensator::CompensateComponent( Picture* pic ,
+ Picture* refsptr[2] ,
+ const MvData& mv_data ,
+ const CompSort cs )
{
// Set up references to pictures and references
- PicArray& pic_data_out = pic->Data(cs);
+ PicArray& pic_data_out = pic->Data( cs );
// Size of picture component being motion compensated
- const PicArray& ref1up = refsptr[0]->UpData(cs);
- const PicArray& ref2up = refsptr[1]->UpData(cs);
+ const PicArray& ref1up = refsptr[0]->UpData( cs );
+ const PicArray& ref2up = refsptr[1]->UpData( cs );
// Set up a row of blocks which will contain the MC data, which
// we'll add or subtract to pic_data_out
- TwoDArray<ValueType> pic_data(m_bparams.Yblen(), pic_data_out.LengthX(), 0);
+ TwoDArray<ValueType> pic_data(m_bparams.Yblen(), pic_data_out.LengthX(), 0 );
// Factors to compensate for subsampling of chroma
int xscale_shift = 0;
int yscale_shift = 0;
- if(cs != Y_COMP)
+ if ( cs != Y_COMP )
{
- if(m_cformat == format420)
+ if (m_cformat == format420)
{
xscale_shift = 1;
yscale_shift = 1;
}
- else if(m_cformat == format422)
+ else if (m_cformat == format422)
{
xscale_shift = 1;
yscale_shift = 0;
@@ -271,7 +270,7 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
}
ImageCoords pic_size(pic->GetPparams().Xl(), pic->GetPparams().Yl());
- if(cs != Y_COMP)
+ if ( cs != Y_COMP )
{
pic_size.x = pic->GetPparams().ChromaXl();
pic_size.y = pic->GetPparams().ChromaYl();
@@ -279,14 +278,14 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
// Reference to the relevant DC array
- const TwoDArray<ValueType>& dcarray = mv_data.DC(cs);
+ const TwoDArray<ValueType>& dcarray = mv_data.DC( cs );
// Set up references to the vectors
const int num_refs = pic->GetPparams().Refs().size();
const MvArray* mv_array1;
const MvArray* mv_array2;
mv_array1 = &mv_data.Vectors(1);
- if(num_refs == 2)
+ if (num_refs ==2 )
mv_array2 = &mv_data.Vectors(2);
else
mv_array2 = &mv_data.Vectors(1);
@@ -294,7 +293,7 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
ReConfig();//set all the weighting blocks up
//Blocks are listed left to right, line by line.
- MVector mv1, mv2;
+ MVector mv1,mv2;
PredMode block_mode;
//Coords of the top-left corner of a block
@@ -305,24 +304,24 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
//and add the compensated pixels to the image pointed to by pic_data.
size_t wgt_idx;
- int save_from_row = m_bparams.Ybsep() - m_bparams.Yoffset();
+ int save_from_row = m_bparams.Ybsep()-m_bparams.Yoffset();
bool row_overlap = ((m_bparams.Yblen() - m_bparams.Ybsep()) > 0);
// unpadded picture dimensions
- const int x_end_data = pic_data_out.FirstX() + std::min(pic_data_out.LengthX(), pic_size.x);
- const int y_end_data = pic_data_out.FirstY() + std::min(pic_data_out.LengthY(), pic_size.y);
+ const int x_end_data = pic_data_out.FirstX() + std::min(pic_data_out.LengthX(), pic_size.x );
+ const int y_end_data = pic_data_out.FirstY() + std::min(pic_data_out.LengthY(), pic_size.y );
- const int blocks_per_mb_row = m_predparams.XNumBlocks() / m_predparams.XNumSB();
- const int blocks_per_sb_row = blocks_per_mb_row >> 1;
+ const int blocks_per_mb_row = m_predparams.XNumBlocks()/m_predparams.XNumSB();
+ const int blocks_per_sb_row = blocks_per_mb_row>>1;
// The picture does not contain integral number of blocks. So not all
// blocks need to be processed. Compute the relevant blocks to be
- // processed
- int y_num_blocks = std::min((NUM_USED_BLKS(pic_size.y, m_bparams.Ybsep(), m_bparams.Yblen())),
- m_predparams.YNumBlocks());
- int x_num_blocks = std::min((NUM_USED_BLKS(pic_size.x, m_bparams.Xbsep(), m_bparams.Xblen())),
- m_predparams.XNumBlocks());
+ // processed
+ int y_num_blocks = std::min((NUM_USED_BLKS(pic_size.y,m_bparams.Ybsep(),m_bparams.Yblen())),
+ m_predparams.YNumBlocks());
+ int x_num_blocks = std::min((NUM_USED_BLKS(pic_size.x,m_bparams.Xbsep(),m_bparams.Xblen())),
+ m_predparams.XNumBlocks());
//Loop over all the block rows
pos.y = -m_bparams.Yoffset();
@@ -331,13 +330,13 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
pos.x = -m_bparams.Xoffset();
int xincr, xb_incr = 0;
//loop over all the blocks in a row
- for(int xblock = 0 ; xblock < x_num_blocks; xblock += xb_incr)
+ for(int xblock = 0 ; xblock < x_num_blocks; xblock+=xb_incr)
{
int split_mode = mv_data.SBSplit()[yblock/blocks_per_mb_row][xblock/blocks_per_mb_row];
int blk_x, blk_y = 1;
- switch(split_mode)
+ switch (split_mode)
{
case 0: // processing superblock
blk_x = blocks_per_mb_row;
@@ -352,22 +351,22 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
}
//Decide which weights to use.
- if(pos.x >= 0 && (xblock + blk_x) < x_num_blocks)
+ if (pos.x >=0 && (xblock+blk_x) < x_num_blocks)
{
// block is entirely within picture in x direction
- if(pos.y < 0)
+ if (pos.y < 0)
wgt_idx = 1;
- else if((yblock + blk_y) < y_num_blocks)
+ else if ((yblock+blk_y) < y_num_blocks)
wgt_idx = 4;
else
wgt_idx = 7;
}
- else if(pos.x < 0)
+ else if (pos.x < 0)
{
// left edge of block is outside picture in x direction
- if(pos.y < 0)
+ if (pos.y < 0)
wgt_idx = 0;
- else if((yblock + blk_y) < y_num_blocks)
+ else if ((yblock+blk_y) < y_num_blocks)
wgt_idx = 3;
else
wgt_idx = 6;
@@ -375,9 +374,9 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
else
{
// right edge of block is outside picture in x direction
- if(pos.y < 0)
+ if (pos.y < 0)
wgt_idx = 2;
- else if((yblock + blk_y) < y_num_blocks)
+ else if ((yblock+blk_y) < y_num_blocks)
wgt_idx = 5;
else
wgt_idx = 8;
@@ -388,12 +387,12 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
TwoDArray<ValueType> *wt;
- if(split_mode == 0) //Block part of a MacroBlock
+ if (split_mode == 0) //Block part of a MacroBlock
{
wt = &m_macro_block_weights[wgt_idx];
xb_incr = blocks_per_mb_row;
}
- else if(split_mode == 1) //Block part of a SubBlock
+ else if (split_mode == 1) //Block part of a SubBlock
{
wt = &m_sub_block_weights[wgt_idx];
xb_incr = blocks_per_sb_row;
@@ -424,27 +423,27 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
// Use only the first Ybsep rows since the remaining rows are
// needed for the next row of blocks since we are using overlapped
// blocks motion compensation
- if(m_add_or_sub == SUBTRACT)
+ if (m_add_or_sub == SUBTRACT)
{
int start_y = std::max(pic_data_out.FirstY() , pos.y) ;
- int end_y = std::min(pic_data_out.FirstY() + pos.y + m_bparams.Ybsep() , y_end_data);
+ int end_y = std::min (pic_data_out.FirstY() + pos.y + m_bparams.Ybsep() , y_end_data);
- if(yblock == y_num_blocks - 1)
+ if (yblock == y_num_blocks - 1)
{
end_y = pic_data_out.LengthY();
- if(end_y > y_end_data)
+ if (end_y > y_end_data)
end_y = y_end_data;
}
- for(int i = start_y, pos_y = 0; i < end_y; i++, pos_y++)
+ for ( int i = start_y, pos_y = 0; i < end_y; i++, pos_y++)
{
ValueType *pic_row = pic_data[pos_y];
ValueType *out_row = pic_data_out[i];
- for(int j = pic_data_out.FirstX(); j < x_end_data; ++j)
+ for ( int j =pic_data_out.FirstX(); j < x_end_data; ++j)
{
- out_row[j] -= static_cast<ValueType>((pic_row[j] + 32) >> 6);
+ out_row[j] -= static_cast<ValueType>( (pic_row[j] + 32) >> 6 );
}
// Okay, we've done all the actual blocks. Now if the picture is further padded
@@ -452,7 +451,7 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
// for all the picture lines in the block row. Need only do this when we're
// subtracting.
- for(int j = pic_size.x; j < pic_data_out.LengthX() ; ++j)
+ for (int j=pic_size.x; j<pic_data_out.LengthX() ; ++j )
{
out_row[pic_data_out.FirstX()+j] = 0;
}
@@ -461,28 +460,28 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
else // (m_add_or_sub == ADD)
{
int start_y = std::max(pic_data_out.FirstY() , pos.y) ;
- int end_y = std::min(pic_data_out.FirstY() + pos.y + m_bparams.Ybsep() , pic_data_out.FirstY() + pic_data_out.LengthY());
- if(yblock == (y_num_blocks - 1))
+ int end_y = std::min (pic_data_out.FirstY() + pos.y + m_bparams.Ybsep() , pic_data_out.FirstY() + pic_data_out.LengthY());
+ if (yblock == (y_num_blocks - 1))
{
- end_y += (m_bparams.Yblen() - m_bparams.Ybsep());
- if(end_y > pic_size.y)
+ end_y += (m_bparams.Yblen()-m_bparams.Ybsep());
+ if (end_y > pic_size.y)
end_y = pic_size.y;
}
#if defined (HAVE_MMX)
- CompensateComponentAddAndShift_mmx(start_y, end_y, 6, pic_size,
- pic_data, pic_data_out);
+ CompensateComponentAddAndShift_mmx (start_y, end_y, 6, pic_size,
+ pic_data, pic_data_out);
#else
- for(int i = start_y, pic_y = 0; i < end_y; i++, pic_y++)
+ for ( int i = start_y, pic_y = 0; i < end_y; i++, pic_y++)
{
ValueType *pic_row = pic_data[pic_y];
ValueType *out_row = pic_data_out[i];
- for(int j = 0; j < pic_size.x; j++)
+ for ( int j =0; j < pic_size.x; j++)
{
- out_row[j] += static_cast<ValueType>((pic_row[j] + 32) >> 6);
+ out_row[j] += static_cast<ValueType>( (pic_row[j] + 32) >> 6 );
}
// Pad the remaining pixels of the row with last truepic pixel val
- for(int j = pic_size.x; j < pic_data.LengthX(); j++)
+ for ( int j = pic_size.x; j < pic_data.LengthX(); j++)
{
out_row[j] = out_row[pic_size.x-1];
}
@@ -492,45 +491,45 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
//Increment the block vertical position
pos.y += m_bparams.Ybsep();
- if(row_overlap)
+ if (row_overlap)
{
- // Copy the rows required to motion compensate the next row of
+ // Copy the rows required to motion compensate the next row of
// blocks. This is usually Yblen-Ybsep rows.
- memmove(pic_data[0], pic_data[save_from_row], (m_bparams.Yblen() - save_from_row)*pic_data.LengthX()*sizeof(ValueType));
- memset(pic_data[m_bparams.Yblen() - save_from_row], 0, save_from_row * pic_data.LengthX()*sizeof(ValueType));
+ memmove (pic_data[0], pic_data[save_from_row], (m_bparams.Yblen() - save_from_row)*pic_data.LengthX()*sizeof(ValueType));
+ memset( pic_data[m_bparams.Yblen() - save_from_row], 0, save_from_row*pic_data.LengthX()*sizeof(ValueType) );
save_from_row = m_bparams.Ybsep();
}
else
{
// no row overlap. So reset pic_data to 0.
- memset(pic_data[0], 0, m_bparams.Yblen()*pic_data.LengthX()*sizeof(ValueType));
+ memset( pic_data[0], 0, m_bparams.Yblen()*pic_data.LengthX()*sizeof(ValueType) );
}
}//yblock
- if(m_add_or_sub == SUBTRACT)
+ if ( m_add_or_sub == SUBTRACT)
{
- // Finally, now we've done all the blocks, we must set all padded lines
+ // Finally, now we've done all the blocks, we must set all padded lines
// below the last row equal to 0, if we're subtracting
- for(int y = pic_size.y ; y < pic_data_out.LengthY() ; ++y)
+ for ( int y=pic_size.y ; y<pic_data_out.LengthY() ; ++y )
{
ValueType *out_row = pic_data_out[y];
- for(int x = 0 ; x < pic_data_out.LengthX() ; ++x)
+ for ( int x=0 ; x<pic_data_out.LengthX() ; ++x )
{
out_row[x] = 0;
}
}
}
- else if(m_add_or_sub == ADD)
+ else if ( m_add_or_sub == ADD)
{
// Edge extension
- // Finally, now we've done all the blocks, we must set all padded lines
+ // Finally, now we've done all the blocks, we must set all padded lines
// below the last row equal to same as last row, if we're adding
ValueType *last_row = &pic_data_out[pic_size.y-1][0];
- for(int y = pic_size.y ; y < pic_data_out.LengthY() ; ++y)
+ for ( int y=pic_size.y ; y<pic_data_out.LengthY() ; ++y )
{
ValueType *out_row = pic_data_out[y];
- for(int x = 0 ; x < pic_data_out.LengthX() ; ++x)
+ for ( int x=0 ; x<pic_data_out.LengthX() ; ++x )
{
out_row[x] = last_row[x];
}
@@ -540,34 +539,34 @@ void MotionCompensator::CompensateComponent(Picture* pic ,
}
void MotionCompensator::CompensateBlock(
- TwoDArray<ValueType> &pic_data ,
- const ImageCoords& pos ,
- const ImageCoords& pic_size ,
- PredMode block_mode,
- ValueType dc,
- const PicArray &ref1up_data ,
- const MVector &mv1 ,
- const PicArray &ref2up_data ,
- const MVector &mv2 ,
- const TwoDArray<ValueType>& wt_array)
+ TwoDArray<ValueType> &pic_data ,
+ const ImageCoords& pos ,
+ const ImageCoords& pic_size ,
+ PredMode block_mode,
+ ValueType dc,
+ const PicArray &ref1up_data ,
+ const MVector &mv1 ,
+ const PicArray &ref2up_data ,
+ const MVector &mv2 ,
+ const TwoDArray<ValueType>& wt_array)
{
//Coordinates in the image being written to.
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
- const ImageCoords end_pos(std::min(pos.x + wt_array.LengthX() , pic_size.x) ,
- std::min(pos.y + wt_array.LengthY() , pic_size.y));
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
+ const ImageCoords end_pos( std::min( pos.x + wt_array.LengthX() , pic_size.x ) ,
+ std::min( pos.y + wt_array.LengthY() , pic_size.y ) );
// Check if we are within original picture bounds
- if(start_pos.x >= end_pos.x || start_pos.y >= end_pos.y)
+ if (start_pos.x >= end_pos.x || start_pos.y >= end_pos.y)
return;
- TwoDArray<ValueType> val1(end_pos.y - start_pos.y, end_pos.x - start_pos.x);
- TwoDArray<ValueType> val2(end_pos.y - start_pos.y, end_pos.x - start_pos.x);
+ TwoDArray<ValueType> val1(end_pos.y - start_pos.y, end_pos.x-start_pos.x);
+ TwoDArray<ValueType> val2(end_pos.y - start_pos.y, end_pos.x-start_pos.x);
if(block_mode == REF1_ONLY)
{
BlockPixelPred(val1, pos, pic_size, ref1up_data, mv1);
}
- else if(block_mode == REF2_ONLY)
+ else if (block_mode == REF2_ONLY)
{
BlockPixelPred(val1, pos, pic_size, ref2up_data, mv2);
}
@@ -577,8 +576,7 @@ void MotionCompensator::CompensateBlock(
BlockPixelPred(val2, pos, pic_size, ref2up_data, mv2);
}
else
- {
- //we have a DC block.
+ {//we have a DC block.
DCBlock(val1, dc);
}
/*
@@ -592,9 +590,9 @@ void MotionCompensator::CompensateBlock(
AdjustBlockBySpatialWeights(val1, pos, wt_array);
#if !defined (HAVE_MMX)
- for(int y = 0, py = 0; y < val1.LengthY(); ++y, ++py)
+ for (int y = 0, py=0; y < val1.LengthY(); ++y, ++py)
{
- for(int x = 0, px = start_pos.x; x < val1.LengthX(); ++x, ++px)
+ for (int x = 0, px=start_pos.x; x < val1.LengthX(); ++x, ++px)
{
pic_data[py][px] += val1[y][x];
}
@@ -604,53 +602,53 @@ void MotionCompensator::CompensateBlock(
#endif
}
-void MotionCompensator::DCBlock(TwoDArray<ValueType> &block_data ,
- const ValueType dc)
+void MotionCompensator::DCBlock( TwoDArray<ValueType> &block_data ,
+ const ValueType dc)
{
//Quick process where we can just copy from the double size image.
ValueType *block_curr = &block_data[0][0];
for(int y = 0; y < block_data.LengthY(); ++y)
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr)
+ for(int x=0; x < block_data.LengthX(); ++x, ++block_curr)
{
*block_curr = dc;
}
}
}
-void MotionCompensator::AdjustBlockByRefWeights(
- TwoDArray<ValueType>& val1_block,
- TwoDArray<ValueType>& val2_block,
- PredMode block_mode)
+void MotionCompensator::AdjustBlockByRefWeights (
+ TwoDArray<ValueType>& val1_block,
+ TwoDArray<ValueType>& val2_block,
+ PredMode block_mode)
{
// No need to multiply by reference weights if DC block
- if(block_mode == INTRA)
+ if (block_mode == INTRA)
return;
- if(m_predparams.CustomRefWeights())
+ if (m_predparams.CustomRefWeights())
{
int ref_wt_prec_bias = 1;
- for(int i = m_predparams.PictureWeightsBits() - 1; i > 0; --i)
+ for (int i = m_predparams.PictureWeightsBits()-1; i > 0; --i)
{
ref_wt_prec_bias <<= 1;
}
- if(block_mode != REF1AND2)
+ if (block_mode != REF1AND2)
{
- for(int y = 0; y < val1_block.LengthY(); ++y)
+ for (int y = 0; y < val1_block.LengthY(); ++y)
{
- for(int x = 0; x < val1_block.LengthX(); ++x)
+ for (int x = 0; x < val1_block.LengthX(); ++x)
{
val1_block[y][x] *= (m_predparams.Ref1Weight() +
- m_predparams.Ref2Weight());
+ m_predparams.Ref2Weight());
}
}
}
else
{
- for(int y = 0; y < val1_block.LengthY(); ++y)
+ for (int y = 0; y < val1_block.LengthY(); ++y)
{
- for(int x = 0; x < val1_block.LengthX(); ++x)
+ for (int x = 0; x < val1_block.LengthX(); ++x)
{
val1_block[y][x] *= m_predparams.Ref1Weight();
val2_block[y][x] *= m_predparams.Ref2Weight();
@@ -658,9 +656,9 @@ void MotionCompensator::AdjustBlockByRefWeights(
}
}
}
- for(int y = 0; y < val1_block.LengthY(); ++y)
+ for (int y = 0; y < val1_block.LengthY(); ++y)
{
- for(int x = 0; x < val1_block.LengthX(); ++x)
+ for (int x = 0; x < val1_block.LengthX(); ++x)
{
val1_block[y][x] = (val1_block[y][x] + ref_wt_prec_bias) >> m_predparams.PictureWeightsBits();
}
@@ -669,13 +667,13 @@ void MotionCompensator::AdjustBlockByRefWeights(
else
{
// Default weights
- if(block_mode == REF1AND2)
+ if (block_mode == REF1AND2)
{
- for(int y = 0; y < val1_block.LengthY(); ++y)
+ for (int y = 0; y < val1_block.LengthY(); ++y)
{
- for(int x = 0; x < val1_block.LengthX(); ++x)
+ for (int x = 0; x < val1_block.LengthX(); ++x)
{
- val1_block[y][x] = (val1_block[y][x] + val2_block[y][x] + 1) >> 1;
+ val1_block[y][x] = (val1_block[y][x] + val2_block[y][x] + 1)>>1;
}
}
}
@@ -684,17 +682,17 @@ void MotionCompensator::AdjustBlockByRefWeights(
}
#if !defined (HAVE_MMX)
-void MotionCompensator::AdjustBlockBySpatialWeights(
- TwoDArray<ValueType>& val_block,
- const ImageCoords &pos,
- const TwoDArray<ValueType> &wt_array)
+void MotionCompensator::AdjustBlockBySpatialWeights (
+ TwoDArray<ValueType>& val_block,
+ const ImageCoords &pos,
+ const TwoDArray<ValueType> &wt_array)
{
- ImageCoords start_pos(std::max(0, pos.x), std::max(0, pos.y));
- ImageCoords wt_start(start_pos.x - pos.x, start_pos.y - pos.y);
+ ImageCoords start_pos (std::max(0, pos.x), std::max(0, pos.y));
+ ImageCoords wt_start (start_pos.x - pos.x, start_pos.y - pos.y);
- for(int y = 0, wt_y = wt_start.y; y < val_block.LengthY(); ++y, ++wt_y)
+ for (int y = 0, wt_y=wt_start.y; y < val_block.LengthY(); ++y, ++wt_y)
{
- for(int x = 0, wt_x = wt_start.x; x < val_block.LengthX(); ++x, ++wt_x)
+ for (int x = 0, wt_x=wt_start.x; x < val_block.LengthX(); ++x, ++wt_x)
{
val_block[y][x] *= wt_array[wt_y][wt_x];
}
@@ -702,24 +700,24 @@ void MotionCompensator::AdjustBlockBySpatialWeights(
}
#endif
-void MotionCompensator::CalculateWeights(int xbsep, int ybsep,
- TwoDArray<ValueType>* wts_array)
+void MotionCompensator::CalculateWeights( int xbsep, int ybsep,
+ TwoDArray<ValueType>* wts_array)
{
// Firstly calculate the non-weighted Weighting blocks. i,e, assuming that
// the picture_weight for each reference picture is 1.
// We can create all nine weighting blocks by calculating values
// for four blocks and mirroring them to generate the others.
- CreateBlock(xbsep, ybsep, false , false , wts_array[0]);
- CreateBlock(xbsep, ybsep, false , true , wts_array[3]);
- CreateBlock(xbsep, ybsep, true , false , wts_array[1]);
- CreateBlock(xbsep, ybsep, true , true , wts_array[4]);
+ CreateBlock( xbsep, ybsep, false , false , wts_array[0] );
+ CreateBlock( xbsep, ybsep, false , true , wts_array[3] );
+ CreateBlock( xbsep, ybsep, true , false , wts_array[1] );
+ CreateBlock( xbsep, ybsep, true , true , wts_array[4] );
// Note order of flipping is important.
- FlipX(wts_array[3] , wts_array[5]);
- FlipX(wts_array[0] , wts_array[2]);
- FlipY(wts_array[0] , wts_array[6]);
- FlipX(wts_array[6] , wts_array[8]);
- FlipY(wts_array[1] , wts_array[7]);
+ FlipX( wts_array[3] , wts_array[5] );
+ FlipX( wts_array[0] , wts_array[2] );
+ FlipY( wts_array[0] , wts_array[6] );
+ FlipX( wts_array[6] , wts_array[8] );
+ FlipY( wts_array[1] , wts_array[7] );
}
// Calculates a weighting block.
@@ -734,64 +732,64 @@ void MotionCompensator::CalculateWeights(int xbsep, int ybsep,
// * * *
// * * *
//* * *
-void MotionCompensator::CreateBlock(int xbsep, int ybsep,
- bool FullX , bool FullY ,
- TwoDArray<ValueType>& WeightArray)
+void MotionCompensator::CreateBlock( int xbsep, int ybsep,
+ bool FullX , bool FullY ,
+ TwoDArray<ValueType>& WeightArray)
{
// Create temporary arrays
int xblen = WeightArray.LengthX();
int yblen = WeightArray.LengthY();
- OneDArray<ValueType> HWts(xblen);
- OneDArray<ValueType> VWts(yblen);
+ OneDArray<ValueType> HWts( xblen );
+ OneDArray<ValueType> VWts( yblen );
// Window in the x direction
- int xoffset = (xblen - xbsep) / 2;
- if(xoffset != 1)
+ int xoffset = (xblen - xbsep)/2;
+ if ( xoffset != 1 )
{
- for(int x = 0; x < 2 * xoffset; ++x)
+ for(int x = 0; x < 2*xoffset; ++x)
{
- HWts[x] = 1 + (6 * x + xoffset - 1) / (2 * xoffset - 1);
+ HWts[x] = 1 + (6*x + xoffset-1)/(2*xoffset-1);
HWts[x+xbsep] = 8 - HWts[x];
}// x
}
else
{
- HWts[0] = HWts[1+xbsep] = 3;
- HWts[1] = HWts[xbsep] = 5;
+ HWts[0]=HWts[1+xbsep]=3;
+ HWts[1]=HWts[xbsep]=5;
}
- for(int x = 2 * xoffset; x < xbsep; ++x)
- HWts[x] = 8;
+ for (int x = 2*xoffset; x < xbsep; ++x)
+ HWts[x] = 8;
// Window in the y direction
- int yoffset = (yblen - ybsep) / 2;
- if(yoffset != 1)
+ int yoffset = (yblen - ybsep)/2;
+ if ( yoffset != 1 )
{
- for(int y = 0; y < 2 * yoffset; ++y)
+ for(int y = 0; y < 2*yoffset; ++y)
{
- VWts[y] = 1 + (6 * y + yoffset - 1) / (2 * yoffset - 1);
+ VWts[y] = 1 + (6 *y + yoffset-1)/(2*yoffset-1);
VWts[y+ybsep] = 8 - VWts[y];
}// y
}
else
{
- VWts[0] = VWts[1+ybsep] = 3;
- VWts[1] = VWts[ybsep] = 5;
+ VWts[0]=VWts[1+ybsep]=3;
+ VWts[1]=VWts[ybsep]=5;
}
- for(int y = 2 * yoffset; y < ybsep; ++y)
- VWts[y] = 8;
+ for (int y = 2*yoffset; y < ybsep; ++y)
+ VWts[y] = 8;
// Now reflect or pad, as appropriate
- if(!FullX)
+ if (!FullX)
{
- for(int x = 0; x < 2 * xoffset; ++x)
+ for( int x = 0; x < 2*xoffset; ++x)
HWts[x] = 8;
}
// Reflect or pad, as appropriate
- if(!FullY)
+ if (!FullY)
{
- for(int y = 0 ; y < 2 * yoffset; ++y)
+ for( int y = 0 ; y < 2*yoffset; ++y)
VWts[y] = 8;
}
@@ -805,8 +803,8 @@ void MotionCompensator::CreateBlock(int xbsep, int ybsep,
}
// Flips the values in an array in the x direction.
-void MotionCompensator::FlipX(const TwoDArray<ValueType>& Original ,
- TwoDArray<ValueType>& Flipped)
+void MotionCompensator::FlipX( const TwoDArray<ValueType>& Original ,
+ TwoDArray<ValueType>& Flipped)
{
int yblen = Original.LengthY();
int xblen = Original.LengthX();
@@ -820,8 +818,8 @@ void MotionCompensator::FlipX(const TwoDArray<ValueType>& Original ,
}
// Flips the values in an array in the y direction.
-void MotionCompensator::FlipY(const TwoDArray<ValueType>& Original ,
- TwoDArray<ValueType>& Flipped)
+void MotionCompensator::FlipY( const TwoDArray<ValueType>& Original ,
+ TwoDArray<ValueType>& Flipped)
{
int yblen = Original.LengthY();
int xblen = Original.LengthX();
@@ -841,22 +839,22 @@ void MotionCompensator::FlipY(const TwoDArray<ValueType>& Original ,
// Motion Compesation class that provides pixel precision compensation
-MotionCompensator_Pixel::MotionCompensator_Pixel(const PicturePredParams &ppp) :
- MotionCompensator(ppp)
+MotionCompensator_Pixel::MotionCompensator_Pixel( const PicturePredParams &ppp ) :
+ MotionCompensator( ppp )
{}
void MotionCompensator_Pixel::BlockPixelPred(
- TwoDArray<ValueType> &block_data ,
- const ImageCoords& pos,
- const ImageCoords& pic_size ,
- const PicArray &refup_data ,
- const MVector &mv)
+ TwoDArray<ValueType> &block_data ,
+ const ImageCoords& pos,
+ const ImageCoords& pic_size ,
+ const PicArray &refup_data ,
+ const MVector &mv)
{
//Coordinates in the image being written to.
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
//Where to start in the upconverted image - scaled since ref is upconverted
- const ImageCoords ref_start((start_pos.x + mv.x) << 1 , (start_pos.y + mv.y) << 1);
+ const ImageCoords ref_start( (start_pos.x + mv.x)<<1 , (start_pos.y + mv.y)<<1 );
//An additional stage to make sure the block to be copied does not fall outside
//the reference image.
@@ -868,23 +866,23 @@ void MotionCompensator_Pixel::BlockPixelPred(
//Check if there are going to be any problems copying the block from
//the upvconverted reference image.
- if(ref_start.x < 0)
+ if( ref_start.x < 0 )
do_bounds_checking = true;
- else if(ref_start.x + ((block_data.LengthX() - 1) << 1) >= trueRefXlen)
+ else if( ref_start.x + ((block_data.LengthX() - 1)<<1 ) >= trueRefXlen )
do_bounds_checking = true;
- if(ref_start.y < 0)
+ if( ref_start.y < 0 )
do_bounds_checking = true;
- else if(ref_start.y + ((block_data.LengthY() - 1) << 1) >= trueRefYlen)
+ else if( ref_start.y + ((block_data.LengthY() - 1)<<1 ) >= trueRefYlen)
do_bounds_checking = true;
ValueType *block_curr = &block_data[0][0];
- if(!do_bounds_checking)
+ if( !do_bounds_checking )
{
ValueType *refup_curr = &refup_data[ref_start.y][ref_start.x];
- const int refup_next(2 *(refXlen - block_data.LengthX())); // - go down a row and back up
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ const int refup_next( 2*(refXlen - block_data.LengthX()) ); // - go down a row and back up
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
*block_curr = *refup_curr;
}// x
@@ -894,14 +892,14 @@ void MotionCompensator_Pixel::BlockPixelPred(
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = 0, ry = ref_start.y, by = BChk(ry, trueRefYlen);
- y < block_data.LengthY(); ++y, ry += 2 , by = BChk(ry, trueRefYlen))
+ for( int y=0, ry=ref_start.y, by=BChk(ry,trueRefYlen);
+ y < block_data.LengthY(); ++y, ry+=2 , by=BChk(ry,trueRefYlen) )
{
- for(int x = 0 , rx = ref_start.x , bx = BChk(rx, trueRefXlen);
- x < block_data.LengthX() ; ++x, ++block_curr, rx += 2 , bx = BChk(rx, trueRefXlen))
- {
- *block_curr = refup_data[by][bx];
- }// x
+ for( int x=0 , rx=ref_start.x , bx=BChk(rx,trueRefXlen);
+ x <block_data.LengthX() ; ++x, ++block_curr, rx+=2 , bx=BChk(rx,trueRefXlen) )
+ {
+ *block_curr = refup_data[by][bx];
+ }// x
}// y
}
@@ -909,21 +907,21 @@ void MotionCompensator_Pixel::BlockPixelPred(
// Motion Compesation class that provides half-pixel precision compensation
-MotionCompensator_HalfPixel::MotionCompensator_HalfPixel(const PicturePredParams &ppp) :
- MotionCompensator(ppp)
+MotionCompensator_HalfPixel::MotionCompensator_HalfPixel( const PicturePredParams &ppp ) :
+ MotionCompensator( ppp )
{}
#if !defined (HAVE_MMX)
void MotionCompensator_HalfPixel::BlockPixelPred(
- TwoDArray<ValueType> &block_data ,
- const ImageCoords& pos ,
- const ImageCoords& pic_size ,
- const PicArray &refup_data ,
- const MVector &mv)
+ TwoDArray<ValueType> &block_data ,
+ const ImageCoords& pos ,
+ const ImageCoords& pic_size ,
+ const PicArray &refup_data ,
+ const MVector &mv)
{
//Where to start in the upconverted image
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
- const ImageCoords ref_start((start_pos.x << 1) + mv.x , (start_pos.y << 1) + mv.y);
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
+ const ImageCoords ref_start( ( start_pos.x<<1 ) + mv.x ,( start_pos.y<<1 ) + mv.y );
//An additional stage to make sure the block to be copied does not fall
//outsidethe reference image.
@@ -937,25 +935,25 @@ void MotionCompensator_HalfPixel::BlockPixelPred(
//Check if there are going to be any problems copying the block from
//the upvconverted reference image.
- if(ref_start.x < 0)
+ if( ref_start.x < 0 )
do_bounds_checking = true;
- else if(ref_start.x + ((block_data.LengthX() - 1) << 1) >= trueRefXlen)
+ else if( ref_start.x + ((block_data.LengthX() -1 )<<1 ) >= trueRefXlen )
do_bounds_checking = true;
- if(ref_start.y < 0)
+ if( ref_start.y < 0 )
do_bounds_checking = true;
- else if(ref_start.y + ((block_data.LengthY() - 1) << 1) >= trueRefYlen)
+ else if( ref_start.y + ((block_data.LengthY() - 1 )<<1 ) >= trueRefYlen)
do_bounds_checking = true;
ValueType *block_curr = &block_data[0][0];
- if(!do_bounds_checking)
+ if( !do_bounds_checking )
{
ValueType *refup_curr = &refup_data[ref_start.y][ref_start.x];
- const int refup_next((refXlen - block_data.LengthX()) * 2);// go down 2 rows and back up
+ const int refup_next( (refXlen - block_data.LengthX())*2 );// go down 2 rows and back up
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
*block_curr = refup_curr[0];
}
@@ -964,108 +962,108 @@ void MotionCompensator_HalfPixel::BlockPixelPred(
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = 0, ry = ref_start.y, by = BChk(ry, trueRefYlen);
- y < block_data.LengthY(); ++y, ry += 2 , by = BChk(ry, trueRefYlen))
+ for( int y=0, ry=ref_start.y, by=BChk(ry,trueRefYlen);
+ y<block_data.LengthY(); ++y, ry+=2 , by=BChk(ry,trueRefYlen))
{
- for(int x = 0 , rx = ref_start.x , bx = BChk(rx, trueRefXlen);
- x < block_data.LengthX() ;
- ++x, ++block_curr, rx += 2 , bx = BChk(rx, trueRefXlen))
- {
- *block_curr = refup_data[by][bx];
- }// x
+ for( int x=0 , rx=ref_start.x , bx=BChk(rx,trueRefXlen);
+ x<block_data.LengthX() ;
+ ++x, ++block_curr, rx+=2 , bx=BChk(rx,trueRefXlen))
+ {
+ *block_curr = refup_data[by][bx];
+ }// x
}// y
}
}
#endif
// Motion Compesation class that provides quarter-pixel precision compensation
-MotionCompensator_QuarterPixel::MotionCompensator_QuarterPixel(const PicturePredParams &ppp) :
- MotionCompensator(ppp)
+MotionCompensator_QuarterPixel::MotionCompensator_QuarterPixel( const PicturePredParams &ppp ) :
+ MotionCompensator( ppp )
{}
#if !defined (HAVE_MMX)
void MotionCompensator_QuarterPixel::BlockPixelPred(
- TwoDArray<ValueType> &block_data ,
- const ImageCoords& pos ,
- const ImageCoords& pic_size ,
- const PicArray &refup_data ,
- const MVector &mv)
+ TwoDArray<ValueType> &block_data ,
+ const ImageCoords& pos ,
+ const ImageCoords& pic_size ,
+ const PicArray &refup_data ,
+ const MVector &mv)
{
// Set up the start point in the reference image by rounding the motion vector
// to 1/2 pel accuracy.NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 1 , mv.y >> 1);
+ const MVector roundvec( mv.x>>1 , mv.y>>1 );
//Get the remainder after rounding. NB rmdr values always 0 or 1
- const MVector rmdr(mv.x & 1 , mv.y & 1);
+ const MVector rmdr( mv.x & 1 , mv.y & 1 );
//Where to start in the upconverted image
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
- const ImageCoords ref_start((start_pos.x << 1) + roundvec.x , (start_pos.y << 1) + roundvec.y);
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
+ const ImageCoords ref_start( ( start_pos.x<<1 ) + roundvec.x ,( start_pos.y<<1 ) + roundvec.y );
//An additional stage to make sure the block to be copied does not fall outside
//the reference image.
const int refXlen = refup_data.LengthX();
//const int refYlen = refup_data.LengthY();
- const int trueRefXlen = (pic_size.x << 1) - 1;
- const int trueRefYlen = (pic_size.y << 1) - 1;
+ const int trueRefXlen = (pic_size.x<<1) - 1;
+ const int trueRefYlen = (pic_size.y<<1) - 1;
ValueType *block_curr = &block_data[0][0];
bool do_bounds_checking = false;
//Check if there are going to be any problems copying the block from
//the upvconverted reference image.
- if(ref_start.x < 0)
+ if( ref_start.x < 0 )
do_bounds_checking = true;
- else if(ref_start.x + (block_data.LengthX() << 1) >= trueRefXlen)
+ else if( ref_start.x + (block_data.LengthX()<<1 ) >= trueRefXlen )
do_bounds_checking = true;
- if(ref_start.y < 0)
+ if( ref_start.y < 0 )
do_bounds_checking = true;
- else if(ref_start.y + (block_data.LengthY() << 1) >= trueRefYlen)
+ else if( ref_start.y + (block_data.LengthY()<<1 ) >= trueRefYlen )
do_bounds_checking = true;
- if(!do_bounds_checking)
+ if( !do_bounds_checking )
{
ValueType *refup_curr = &refup_data[ref_start.y][ref_start.x];
- const int refup_next((refXlen - block_data.LengthX()) * 2); //go down 2 rows and back to beginning of block line
- if(rmdr.x == 0 && rmdr.y == 0)
+ const int refup_next( ( refXlen - block_data.LengthX() )*2 ); //go down 2 rows and back to beginning of block line
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
*block_curr = refup_curr[0];
}
}
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
*block_curr = (refup_curr[0] + refup_curr[1] + 1) >> 1;
}
}
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
- *block_curr = (refup_curr[0] + refup_curr[refXlen] + 1) >> 1;
+ *block_curr = ( refup_curr[0] + refup_curr[refXlen] + 1 ) >> 1;
}
}
}
else
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
- *block_curr = (refup_curr[0] + refup_curr[1] +
- refup_curr[refXlen+0] +
- refup_curr[refXlen+1] + 2) >> 2;
+ *block_curr = ( refup_curr[0] + refup_curr[1] +
+ refup_curr[refXlen+0] +
+ refup_curr[refXlen+1] + 2 ) >> 2;
}
}
}
@@ -1075,28 +1073,27 @@ void MotionCompensator_QuarterPixel::BlockPixelPred(
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) *(2 - rmdr.y), //tl
- rmdr.x *(2 - rmdr.y), //tr
+ const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
+ rmdr.x * (2 - rmdr.y), //tr
(2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ rmdr.x * rmdr.y }; //br
- for(int c = 0, uY = ref_start.y, BuY = BChk(uY, trueRefYlen), BuY1 = BChk(uY + 1, trueRefYlen);
- c < block_data.LengthY(); ++c, uY += 2, BuY = BChk(uY, trueRefYlen), BuY1 = BChk(uY + 1, trueRefYlen))
- {
- for(int l = 0, uX = ref_start.x, BuX = BChk(uX, trueRefXlen), BuX1 = BChk(uX + 1, trueRefXlen);
- l < block_data.LengthX(); ++l, uX += 2, BuX = BChk(uX, trueRefXlen), BuX1 = BChk(uX + 1, trueRefXlen))
- {
+ for(int c = 0, uY = ref_start.y,BuY=BChk(uY,trueRefYlen),BuY1=BChk(uY+1,trueRefYlen);
+ c < block_data.LengthY(); ++c, uY += 2,BuY=BChk(uY,trueRefYlen),BuY1=BChk(uY+1,trueRefYlen))
+ {
+ for(int l = 0, uX = ref_start.x,BuX=BChk(uX,trueRefXlen),BuX1=BChk(uX+1,trueRefXlen);
+ l < block_data.LengthX(); ++l, uX += 2,BuX=BChk(uX,trueRefXlen),BuX1=BChk(uX+1,trueRefXlen))
+ {
- block_data[c][l] = (linear_wts[0] * refup_data[BuY][BuX] +
- linear_wts[1] * refup_data[BuY][BuX1] +
- linear_wts[2] * refup_data[BuY1][BuX] +
- linear_wts[3] * refup_data[BuY1][BuX1] +
- 2
+ block_data[c][l] = ( linear_wts[0] * refup_data[BuY][BuX] +
+ linear_wts[1] * refup_data[BuY][BuX1] +
+ linear_wts[2] * refup_data[BuY1][BuX] +
+ linear_wts[3] * refup_data[BuY1][BuX1] +
+ 2
) >> 2;
- }//l
- }//c
+ }//l
+ }//c
}
}
@@ -1104,35 +1101,34 @@ void MotionCompensator_QuarterPixel::BlockPixelPred(
// Motion Compesation class that provides one eighth-pixel precision
// compensation
-MotionCompensator_EighthPixel::MotionCompensator_EighthPixel(const PicturePredParams &ppp) :
- MotionCompensator(ppp)
+MotionCompensator_EighthPixel::MotionCompensator_EighthPixel( const PicturePredParams &ppp ) :
+ MotionCompensator( ppp )
{}
void MotionCompensator_EighthPixel::BlockPixelPred(
- TwoDArray<ValueType> &block_data ,
- const ImageCoords& pos ,
- const ImageCoords& pic_size ,
- const PicArray &refup_data ,
- const MVector &mv)
+ TwoDArray<ValueType> &block_data ,
+ const ImageCoords& pos ,
+ const ImageCoords& pic_size ,
+ const PicArray &refup_data ,
+ const MVector &mv)
{
//Set up the start point in the reference image by rounding the motion vector
//NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 2 , mv.y >> 2);
+ const MVector roundvec( mv.x>>2 , mv.y>>2 );
//Get the remainder after rounding. NB rmdr values always 0,1,2 or 3
- const MVector rmdr(mv.x & 3 , mv.y & 3);
+ const MVector rmdr( mv.x & 3 , mv.y & 3 );
//Where to start in the upconverted image
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
- const ImageCoords ref_start((start_pos.x << 1) + roundvec.x , (start_pos.y << 1) + roundvec.y);
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
+ const ImageCoords ref_start( ( start_pos.x<<1 ) + roundvec.x ,( start_pos.y<<1 ) + roundvec.y );
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (4 - rmdr.x) *(4 - rmdr.y), //tl
- rmdr.x *(4 - rmdr.y), //tr
- (4 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ const ValueType linear_wts[4] = { (4 - rmdr.x) * (4 - rmdr.y), //tl
+ rmdr.x * (4 - rmdr.y), //tr
+ (4 - rmdr.x) * rmdr.y, //bl
+ rmdr.x * rmdr.y }; //br
//An additional stage to make sure the block to be copied does not fall outside
//the reference image.
@@ -1144,74 +1140,74 @@ void MotionCompensator_EighthPixel::BlockPixelPred(
//Check if there are going to be any problems copying the block from
//the upvconverted reference image.
- if(ref_start.x < 0)
+ if( ref_start.x < 0 )
do_bounds_checking = true;
- else if(ref_start.x + (block_data.LengthX() << 1) >= trueRefXlen)
+ else if( ref_start.x + (block_data.LengthX()<<1 ) >= trueRefXlen )
do_bounds_checking = true;
- if(ref_start.y < 0)
+ if( ref_start.y < 0 )
do_bounds_checking = true;
- else if(ref_start.y + (block_data.LengthY() << 1) >= trueRefYlen)
+ else if( ref_start.y + (block_data.LengthY()<<1 ) >= trueRefYlen)
do_bounds_checking = true;
- if(!do_bounds_checking)
+ if( !do_bounds_checking )
{
ValueType *block_curr = &block_data[0][0];
ValueType *refup_curr = &refup_data[ref_start.y][ref_start.x];
- const int refup_next = (refup_data.LengthX() - block_data.LengthX()) * 2; //go down 2 rows and back up
+ const int refup_next = (refup_data.LengthX() - block_data.LengthX() )*2; //go down 2 rows and back up
- if(rmdr.x == 0 && rmdr.y == 0)
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
*block_curr = refup_curr[0];
}
}
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
- *block_curr = (
+ *block_curr = (
linear_wts[0] * refup_curr[0] +
linear_wts[1] * refup_curr[1] +
- 8
- ) >> 4;
+ 8
+ ) >> 4;
}
}
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
- *block_curr = (
- linear_wts[0] * refup_curr[0] +
- linear_wts[2] * refup_curr[refXlen+0] +
- 8
- ) >> 4;
+ *block_curr = (
+ linear_wts[0] * refup_curr[0] +
+ linear_wts[2] * refup_curr[refXlen+0] +
+ 8
+ ) >> 4;
}
}
}
else
{
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
- *block_curr = (
+ *block_curr = (
linear_wts[0] * refup_curr[0] +
linear_wts[1] * refup_curr[1] +
linear_wts[2] * refup_curr[refXlen+0] +
linear_wts[3] * refup_curr[refXlen+1] +
8
- ) >> 4;
+ ) >> 4;
}
}
}
@@ -1220,12 +1216,12 @@ void MotionCompensator_EighthPixel::BlockPixelPred(
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int c = 0, uY = ref_start.y, BuY = BChk(uY, trueRefYlen), BuY1 = BChk(uY + 1, trueRefYlen);
- c < block_data.LengthY(); ++c, uY += 2, BuY = BChk(uY, trueRefYlen), BuY1 = BChk(uY + 1, trueRefYlen))
+ for(int c = 0, uY = ref_start.y,BuY=BChk(uY,trueRefYlen),BuY1=BChk(uY+1,trueRefYlen);
+ c < block_data.LengthY(); ++c, uY += 2,BuY=BChk(uY,trueRefYlen),BuY1=BChk(uY+1,trueRefYlen))
{
- for(int l = 0, uX = ref_start.x, BuX = BChk(uX, trueRefXlen), BuX1 = BChk(uX + 1, trueRefXlen);
- l < block_data.LengthX();
- ++l, uX += 2, BuX = BChk(uX, trueRefXlen), BuX1 = BChk(uX + 1, trueRefXlen))
+ for(int l = 0, uX = ref_start.x,BuX=BChk(uX,trueRefXlen),BuX1=BChk(uX+1,trueRefXlen);
+ l < block_data.LengthX();
+ ++l, uX += 2,BuX=BChk(uX,trueRefXlen),BuX1=BChk(uX+1,trueRefXlen))
{
block_data[c][l] = (
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.h
index d69675abf..7974cc1db 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp.h
@@ -57,243 +57,243 @@
namespace dirac
{
-class PictureBuffer;
-class Picture;
-
-//! Abstract Motion compensator class.
-/*!
- Motion compensator class, for doing motion compensation with two
- references and overlapped blocks, using raised-cosine roll-off.
- This is an abstract class. It must be sub-classed and the
- BlockPixelPred must be defined in the sub-classes.
-*/
-class MotionCompensator
-{
-
-public:
- //! Constructor.
- /*!
- Constructor initialises using codec parameters.
- */
- MotionCompensator(const PicturePredParams &ppp);
- //! Destructor
- virtual ~MotionCompensator();
+ class PictureBuffer;
+ class Picture;
- //! Convenience function to perform motion compensation on a picture
- /*!
- Static function that motion compensates a picture. It uses the
- MV precision value in the PicturePredParams to instantiate the
- appropriate MotionCompensation sub-class.
- \param ppp Picture prediction parameters
- \param direction whether we're subtracting or adding
- \param mv_data the motion vector data
- \param in_pic Pointer to picture being motion compensated
- \param refptr Array of pointers to reference pictures.
- */
- static void CompensatePicture(const PicturePredParams &ppp,
- const AddOrSub direction ,
- const MvData& mv_data,
- Picture* in_pic ,
- Picture* refptr[2]);
-
- //! Compensate a picture
+ //! Abstract Motion compensator class.
/*!
- Perform motion compensated addition/subtraction on a picture using
- parameters
- \param direction whether we're subtracting or adding
- ` \param mv_data the motion vector data
- \param in_pic Pointer to picture being motion compensated
- \param refsptr Array of pointers to reference pictures.
- */
- void CompensatePicture(const AddOrSub direction ,
- const MvData& mv_data,
- Picture* in_pic ,
- Picture* refsptr[2]);
-
-private:
- //private, body-less copy constructor: this class should not be copied
- MotionCompensator(const MotionCompensator& cpy);
- //private, body-less assignment=: this class should not be assigned
- MotionCompensator& operator=(const MotionCompensator& rhs);
-
- //functions
-
- //! Motion-compensate a component
- void CompensateComponent(Picture* pic ,
- Picture* refsptr[2] ,
- const MvData& mv_data , const CompSort cs);
-
- //! Recalculate the weight matrix and store other key block related parameters.
- //! DC-compensate an individual block
- void DCBlock(TwoDArray<ValueType> &block_data ,
- const ValueType dc);
- void ReConfig();
-
- // Calculates a weighting arrays blocks.
- void CalculateWeights(int xbsep, int ybsep, TwoDArray<ValueType>* wt_array);
-
- //! Calculates a weighting block.
- /*!
- Params defines the block parameters so the relevant weighting
- arrays can be created. FullX and FullY refer to whether the
- weight should be adjusted for the edge of an image. eg. 1D
- Weighting shapes in x direction
- FullX true FullX false
- *** ********
- * * *
- * * *
- * * *
- */
- void CreateBlock(int xbsep, int ybsep, bool FullX, bool FullY, TwoDArray<ValueType>& WeightArray);
-
- //! Flips the values in an array in the x direction
- void FlipX(const TwoDArray<ValueType>& Original, TwoDArray<ValueType>& Flipped);
-
- //! Flips the values in an array in the y direction.
- void FlipY(const TwoDArray<ValueType>& Original, TwoDArray<ValueType>& Flipped);
-
- virtual void CompensateBlock(TwoDArray<ValueType>& pic_data ,
- const ImageCoords& pos ,
- const ImageCoords &orig_pic_size,
- PredMode block_mode,
- ValueType dc,
- const PicArray& ref1up_data ,
- const MVector& mv1 ,
- const PicArray& ref2up_data ,
- const MVector& mv2 ,
- const TwoDArray<ValueType>& Weights);
- //! Predict pixels in a block. Pure virtual. SubClasses need to define it
- virtual void BlockPixelPred(TwoDArray<ValueType>& block_data ,
- const ImageCoords& pos,
- const ImageCoords &orig_pic_size,
- const PicArray& refup_data ,
- const MVector& mv) = 0;
-
- // Adjust the block value based on reference weights
- /*
- * Adjust the block value based on reference weights of each
- * reference picture.
- * val1_block - Block predicted from a single reference picture
- * val2_block - Block predicted from second reference picture
- * mode is REF1AND2
- * block_mode - Block prediction mode.
- *
- * On return, val1_block will contain the weight reference weight
- * adjusted block values
+ Motion compensator class, for doing motion compensation with two
+ references and overlapped blocks, using raised-cosine roll-off.
+ This is an abstract class. It must be sub-classed and the
+ BlockPixelPred must be defined in the sub-classes.
*/
- void AdjustBlockByRefWeights(TwoDArray<ValueType>& val1_block,
- TwoDArray<ValueType>& val2_block,
- PredMode block_mode);
-
- // Adjust the block value based spatial weighting matrix
- /*
- * Adjust the block value based on spatial weighting matrix
- * val_block - Predicted block
- * pos - position of top lef corner of block in picture
- * wt_array - spatial weighting matrix
- *
- * On return, val_block will contain the spatial weight adjusted block
- * values
- */
- void AdjustBlockBySpatialWeights(TwoDArray<ValueType>& val_block,
- const ImageCoords &pos,
- const TwoDArray<ValueType> &wt_array);
-protected:
- //variables
-
- //! The codec parameters
- PicturePredParams m_predparams;
-
- //! The chroma format
- ChromaFormat m_cformat;
- bool luma_or_chroma; //true if we're doing luma, false if we're coding chroma
-
- // A marker saying whether we're doing MC addition or subtraction
- AddOrSub m_add_or_sub;
-
- // Block information
- OLBParams m_bparams;
- // Arrays of block weights
- TwoDArray<ValueType>* m_block_weights;
- // Arrays of super block weights
- TwoDArray<ValueType>* m_macro_block_weights;
- // Arrays of sub super block weights
- TwoDArray<ValueType>* m_sub_block_weights;
-};
-
-//! Pixel precision Motion compensator class.
-class MotionCompensator_Pixel : public MotionCompensator
-{
-
-public:
- //! Constructor.
- /*!
- Constructor initialises using codec parameters.
- */
- MotionCompensator_Pixel(const PicturePredParams &ppp);
-
-private:
- //! Motion-compensate a block.
- virtual void BlockPixelPred(TwoDArray<ValueType>& block_data ,
- const ImageCoords& pos,
- const ImageCoords &orig_pic_size,
- const PicArray& refup_data ,
- const MVector& mv);
-};
-
-//! Half Pixel precision Motion compensator class.
-class MotionCompensator_HalfPixel : public MotionCompensator
-{
-public:
- //! Constructor.
- /*!
- Constructor initialises using codec parameters.
- */
- MotionCompensator_HalfPixel(const PicturePredParams &ppp);
-private:
- //! Motion-compensate a block.
- virtual void BlockPixelPred(TwoDArray<ValueType>& block_data ,
- const ImageCoords& pos,
- const ImageCoords &orig_pic_size,
- const PicArray& refup_data ,
- const MVector& mv);
-};
-
-//! Quarter Pixel precision Motion compensator class.
-class MotionCompensator_QuarterPixel : public MotionCompensator
-{
-public:
- //! Constructor.
- /*!
- Constructor initialises using codec parameters.
- */
- MotionCompensator_QuarterPixel(const PicturePredParams &ppp);
-private:
- //! Motion-compensate a block.
- virtual void BlockPixelPred(TwoDArray<ValueType>& block_data ,
- const ImageCoords& pos,
- const ImageCoords &orig_pic_size,
- const PicArray& refup_data ,
- const MVector& mv);
-};
-
-//! Eighth Pixel precision Motion compensator class.
-class MotionCompensator_EighthPixel : public MotionCompensator
-{
-public:
- //! Constructor.
- /*!
- Constructor initialises using codec parameters.
- */
- MotionCompensator_EighthPixel(const PicturePredParams &ppp);
-private:
- //! Motion-compensate a block.
- virtual void BlockPixelPred(TwoDArray<ValueType>& block_data ,
- const ImageCoords& pos,
- const ImageCoords &orig_pic_size,
- const PicArray& refup_data ,
- const MVector& mv);
-};
+ class MotionCompensator
+ {
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor initialises using codec parameters.
+ */
+ MotionCompensator( const PicturePredParams &ppp );
+ //! Destructor
+ virtual ~MotionCompensator();
+
+ //! Convenience function to perform motion compensation on a picture
+ /*!
+ Static function that motion compensates a picture. It uses the
+ MV precision value in the PicturePredParams to instantiate the
+ appropriate MotionCompensation sub-class.
+ \param ppp Picture prediction parameters
+ \param direction whether we're subtracting or adding
+ \param mv_data the motion vector data
+ \param in_pic Pointer to picture being motion compensated
+ \param refptr Array of pointers to reference pictures.
+ */
+ static void CompensatePicture ( const PicturePredParams &ppp,
+ const AddOrSub direction ,
+ const MvData& mv_data,
+ Picture* in_pic ,
+ Picture* refptr[2]);
+
+ //! Compensate a picture
+ /*!
+ Perform motion compensated addition/subtraction on a picture using
+ parameters
+ \param direction whether we're subtracting or adding
+ ` \param mv_data the motion vector data
+ \param in_pic Pointer to picture being motion compensated
+ \param refsptr Array of pointers to reference pictures.
+ */
+ void CompensatePicture( const AddOrSub direction ,
+ const MvData& mv_data,
+ Picture* in_pic ,
+ Picture* refsptr[2] );
+
+ private:
+ //private, body-less copy constructor: this class should not be copied
+ MotionCompensator( const MotionCompensator& cpy );
+ //private, body-less assignment=: this class should not be assigned
+ MotionCompensator& operator=( const MotionCompensator& rhs );
+
+ //functions
+
+ //! Motion-compensate a component
+ void CompensateComponent( Picture* pic ,
+ Picture* refsptr[2] ,
+ const MvData& mv_data , const CompSort cs);
+
+ //! Recalculate the weight matrix and store other key block related parameters.
+ //! DC-compensate an individual block
+ void DCBlock( TwoDArray<ValueType> &block_data ,
+ const ValueType dc);
+ void ReConfig();
+
+ // Calculates a weighting arrays blocks.
+ void CalculateWeights(int xbsep, int ybsep, TwoDArray<ValueType>* wt_array);
+
+ //! Calculates a weighting block.
+ /*!
+ Params defines the block parameters so the relevant weighting
+ arrays can be created. FullX and FullY refer to whether the
+ weight should be adjusted for the edge of an image. eg. 1D
+ Weighting shapes in x direction
+ FullX true FullX false
+ *** ********
+ * * *
+ * * *
+ * * *
+ */
+ void CreateBlock(int xbsep, int ybsep, bool FullX, bool FullY, TwoDArray<ValueType>& WeightArray);
+
+ //! Flips the values in an array in the x direction
+ void FlipX(const TwoDArray<ValueType>& Original, TwoDArray<ValueType>& Flipped);
+
+ //! Flips the values in an array in the y direction.
+ void FlipY(const TwoDArray<ValueType>& Original, TwoDArray<ValueType>& Flipped);
+
+ virtual void CompensateBlock( TwoDArray<ValueType>& pic_data ,
+ const ImageCoords& pos ,
+ const ImageCoords &orig_pic_size,
+ PredMode block_mode,
+ ValueType dc,
+ const PicArray& ref1up_data ,
+ const MVector& mv1 ,
+ const PicArray& ref2up_data ,
+ const MVector& mv2 ,
+ const TwoDArray<ValueType>& Weights );
+ //! Predict pixels in a block. Pure virtual. SubClasses need to define it
+ virtual void BlockPixelPred( TwoDArray<ValueType>& block_data ,
+ const ImageCoords& pos,
+ const ImageCoords &orig_pic_size,
+ const PicArray& refup_data ,
+ const MVector& mv) = 0;
+
+ // Adjust the block value based on reference weights
+ /*
+ * Adjust the block value based on reference weights of each
+ * reference picture.
+ * val1_block - Block predicted from a single reference picture
+ * val2_block - Block predicted from second reference picture
+ * mode is REF1AND2
+ * block_mode - Block prediction mode.
+ *
+ * On return, val1_block will contain the weight reference weight
+ * adjusted block values
+ */
+ void AdjustBlockByRefWeights (TwoDArray<ValueType>& val1_block,
+ TwoDArray<ValueType>& val2_block,
+ PredMode block_mode);
+
+ // Adjust the block value based spatial weighting matrix
+ /*
+ * Adjust the block value based on spatial weighting matrix
+ * val_block - Predicted block
+ * pos - position of top lef corner of block in picture
+ * wt_array - spatial weighting matrix
+ *
+ * On return, val_block will contain the spatial weight adjusted block
+ * values
+ */
+ void AdjustBlockBySpatialWeights (TwoDArray<ValueType>& val_block,
+ const ImageCoords &pos,
+ const TwoDArray<ValueType> &wt_array);
+ protected:
+ //variables
+
+ //! The codec parameters
+ PicturePredParams m_predparams;
+
+ //! The chroma format
+ ChromaFormat m_cformat;
+ bool luma_or_chroma; //true if we're doing luma, false if we're coding chroma
+
+ // A marker saying whether we're doing MC addition or subtraction
+ AddOrSub m_add_or_sub;
+
+ // Block information
+ OLBParams m_bparams;
+ // Arrays of block weights
+ TwoDArray<ValueType>* m_block_weights;
+ // Arrays of super block weights
+ TwoDArray<ValueType>* m_macro_block_weights;
+ // Arrays of sub super block weights
+ TwoDArray<ValueType>* m_sub_block_weights;
+ };
+
+ //! Pixel precision Motion compensator class.
+ class MotionCompensator_Pixel : public MotionCompensator
+ {
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor initialises using codec parameters.
+ */
+ MotionCompensator_Pixel (const PicturePredParams &ppp);
+
+ private:
+ //! Motion-compensate a block.
+ virtual void BlockPixelPred( TwoDArray<ValueType>& block_data ,
+ const ImageCoords& pos,
+ const ImageCoords &orig_pic_size,
+ const PicArray& refup_data ,
+ const MVector& mv);
+ };
+
+ //! Half Pixel precision Motion compensator class.
+ class MotionCompensator_HalfPixel : public MotionCompensator
+ {
+ public:
+ //! Constructor.
+ /*!
+ Constructor initialises using codec parameters.
+ */
+ MotionCompensator_HalfPixel (const PicturePredParams &ppp);
+ private:
+ //! Motion-compensate a block.
+ virtual void BlockPixelPred( TwoDArray<ValueType>& block_data ,
+ const ImageCoords& pos,
+ const ImageCoords &orig_pic_size,
+ const PicArray& refup_data ,
+ const MVector& mv);
+ };
+
+ //! Quarter Pixel precision Motion compensator class.
+ class MotionCompensator_QuarterPixel : public MotionCompensator
+ {
+ public:
+ //! Constructor.
+ /*!
+ Constructor initialises using codec parameters.
+ */
+ MotionCompensator_QuarterPixel (const PicturePredParams &ppp);
+ private:
+ //! Motion-compensate a block.
+ virtual void BlockPixelPred( TwoDArray<ValueType>& block_data ,
+ const ImageCoords& pos,
+ const ImageCoords &orig_pic_size,
+ const PicArray& refup_data ,
+ const MVector& mv);
+ };
+
+ //! Eighth Pixel precision Motion compensator class.
+ class MotionCompensator_EighthPixel : public MotionCompensator
+ {
+ public:
+ //! Constructor.
+ /*!
+ Constructor initialises using codec parameters.
+ */
+ MotionCompensator_EighthPixel (const PicturePredParams &ppp);
+ private:
+ //! Motion-compensate a block.
+ virtual void BlockPixelPred( TwoDArray<ValueType>& block_data ,
+ const ImageCoords& pos,
+ const ImageCoords &orig_pic_size,
+ const PicArray& refup_data ,
+ const MVector& mv);
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.cpp
index e56226a0b..8c1cd0fa7 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.cpp
@@ -44,49 +44,48 @@
using namespace dirac;
inline void check_active_columns(
- int x, int xmax, ValueType act_cols1[4],
- ValueType act_cols2[4], ValueType *row1, ValueType *row2)
+ int x, int xmax, ValueType act_cols1[4],
+ ValueType act_cols2[4], ValueType *row1, ValueType *row2)
{
// check if we need any clipping
- if(x >= 0 && (x + 3) < xmax)
- {
+ if (x >= 0 && (x+3) < xmax) {
// special case, nothing to do
memcpy(act_cols1, &row1[x], 4 * sizeof(ValueType));
memcpy(act_cols2, &row2[x], 4 * sizeof(ValueType));
}
else
{
- act_cols1[0] = row1[BChk(x, xmax)];
- act_cols2[0] = row2[BChk(x, xmax)];
- act_cols1[1] = row1[BChk(x+1, xmax)];
- act_cols2[1] = row2[BChk(x+1, xmax)];
- act_cols1[2] = row1[BChk(x+2, xmax)];
- act_cols2[2] = row2[BChk(x+2, xmax)];
- act_cols1[3] = row1[BChk(x+3, xmax)];
- act_cols2[3] = row2[BChk(x+3, xmax)];
+ act_cols1[0] = row1[BChk(x,xmax)];
+ act_cols2[0] = row2[BChk(x,xmax)];
+ act_cols1[1] = row1[BChk(x+1,xmax)];
+ act_cols2[1] = row2[BChk(x+1,xmax)];
+ act_cols1[2] = row1[BChk(x+2,xmax)];
+ act_cols2[2] = row2[BChk(x+2,xmax)];
+ act_cols1[3] = row1[BChk(x+3,xmax)];
+ act_cols2[3] = row2[BChk(x+3,xmax)];
}
}
-void MotionCompensator_QuarterPixel::BlockPixelPred(
- TwoDArray<ValueType> &block_data ,
- const ImageCoords& pos ,
- const ImageCoords& orig_pic_size ,
- const PicArray &refup_data ,
- const MVector &mv)
+void MotionCompensator_QuarterPixel::BlockPixelPred(
+ TwoDArray<ValueType> &block_data ,
+ const ImageCoords& pos ,
+ const ImageCoords& orig_pic_size ,
+ const PicArray &refup_data ,
+ const MVector &mv)
{
// Set up the start point in the reference image by rounding the motion vector
// to 1/2 pel accuracy.NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 1 , mv.y >> 1);
+ const MVector roundvec( mv.x>>1 , mv.y>>1 );
//Get the remainder after rounding. NB rmdr values always 0 or 1
- const MVector rmdr(mv.x & 1 , mv.y & 1);
+ const MVector rmdr( mv.x & 1 , mv.y & 1 );
//Where to start in the upconverted image
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
// check that we are doing MC within true pic boundaries
- if(start_pos.x >= orig_pic_size.x || start_pos.y >= orig_pic_size.y)
+ if (start_pos.x >= orig_pic_size.x || start_pos.y >= orig_pic_size.y)
return;
- const ImageCoords ref_start((start_pos.x << 1) + roundvec.x , (start_pos.y << 1) + roundvec.y);
+ const ImageCoords ref_start( ( start_pos.x<<1 ) + roundvec.x ,( start_pos.y<<1 ) + roundvec.y );
//An additional stage to make sure the block to be copied does not fall outside
//the reference image.
@@ -99,142 +98,142 @@ void MotionCompensator_QuarterPixel::BlockPixelPred(
bool do_bounds_checking = false;
//Check if there are going to be any problems copying the block from
//the upvconverted reference image.
- if(ref_start.x < 0)
+ if( ref_start.x < 0 )
do_bounds_checking = true;
- else if(ref_start.x + (block_data.LengthX() << 1) >= trueRefXlen)
+ else if( ref_start.x + (block_data.LengthX()<<1 ) >= trueRefXlen )
do_bounds_checking = true;
- if(ref_start.y < 0)
+ if( ref_start.y < 0 )
do_bounds_checking = true;
- else if(ref_start.y + (block_data.LengthY() << 1) >= trueRefYlen)
+ else if( ref_start.y + (block_data.LengthY()<<1 ) >= trueRefYlen)
do_bounds_checking = true;
- if(!do_bounds_checking)
+ if( !do_bounds_checking )
{
- int stopX = (block_data.LengthX() >> 2) << 2;
+ int stopX = (block_data.LengthX()>>2)<<2;
ValueType *refup_curr = &refup_data[ref_start.y][ref_start.x];
- const int refup_next((refXlen - block_data.LengthX()) * 2); //go down 2 rows and back to beginning of block line
- if(rmdr.x == 0 && rmdr.y == 0)
+ const int refup_next( ( refXlen - block_data.LengthX() )*2 ); //go down 2 rows and back to beginning of block line
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
__m64 m1, m2;
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
int x;
- for(x = 0; x < stopX; x += 4, block_curr += 4, refup_curr += 8)
+ for( x=0; x < stopX; x+=4, block_curr+=4, refup_curr+=8 )
{
- m1 = _mm_unpacklo_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
- m2 = _mm_unpackhi_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
+ m1 = _mm_unpacklo_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
+ m2 = _mm_unpackhi_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
// *block_curr = refup_curr[0]
- *(__m64 *)block_curr = _mm_unpacklo_pi16(m1, m2);
+ *(__m64 *)block_curr = _mm_unpacklo_pi16 (m1, m2);
}
// Mopup the last value
- for(x = stopX ; x < block_data.LengthX(); ++x)
+ for ( x=stopX ; x < block_data.LengthX(); ++x)
{
*block_curr = *refup_curr;
++block_curr;
- refup_curr += 2;
+ refup_curr+=2;
}
}
_mm_empty();
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
- __m64 round = _mm_set_pi16(1, 1, 1, 1);
+ __m64 round = _mm_set_pi16 (1, 1, 1, 1);
__m64 m1, m2, m3;
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
int x;
- for(x = 0; x < stopX; x += 4, block_curr += 4, refup_curr += 8)
+ for( x=0; x < stopX; x+=4, block_curr+=4, refup_curr+=8 )
{
- m1 = _mm_unpacklo_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
- m3 = _mm_unpackhi_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
- m2 = _mm_unpackhi_pi16(m1, m3);
- m1 = _mm_unpacklo_pi16(m1, m3);
+ m1 = _mm_unpacklo_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
+ m3 = _mm_unpackhi_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
+ m2 = _mm_unpackhi_pi16 (m1, m3);
+ m1 = _mm_unpacklo_pi16 (m1, m3);
// (refup_curr[0] + refup_curr[1] + 1)>>1
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_add_pi16(m1, round);
- *(__m64 *)block_curr = _mm_srai_pi16(m1, 1);
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_add_pi16 (m1, round);
+ *(__m64 *)block_curr = _mm_srai_pi16 (m1, 1);
}
// Mopup the last value
- for(x = stopX; x < block_data.LengthX(); ++x)
+ for ( x=stopX; x < block_data.LengthX(); ++x)
{
- *block_curr = ((*refup_curr +
- *(refup_curr + 1) + 1
- ) >> 1);
+ *block_curr = (( *refup_curr +
+ *(refup_curr+1) + 1
+ ) >> 1);
++block_curr;
- refup_curr += 2;
+ refup_curr+=2;
}
}
_mm_empty();
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
- __m64 round = _mm_set_pi16(1, 1, 1, 1);
+ __m64 round = _mm_set_pi16 (1, 1, 1, 1);
__m64 m1, m2, m3;
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
int x;
- for(x = 0; x < stopX; x += 4, block_curr += 4, refup_curr += 8)
+ for( x = 0; x < stopX; x+=4, block_curr+=4, refup_curr+=8 )
{
- m1 = _mm_unpacklo_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
- m2 = _mm_unpackhi_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
+ m1 = _mm_unpacklo_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
+ m2 = _mm_unpackhi_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
// m1 now contains r00 r02 r04 r06
- m1 = _mm_unpacklo_pi16(m1, m2);
+ m1 = _mm_unpacklo_pi16 (m1, m2);
- m3 = _mm_unpacklo_pi16(*(__m64 *)(refup_curr + refXlen), *(__m64 *)(refup_curr + refXlen + 4));
- m2 = _mm_unpackhi_pi16(*(__m64 *)(refup_curr + refXlen), *(__m64 *)(refup_curr + refXlen + 4));
+ m3 = _mm_unpacklo_pi16 (*(__m64 *)(refup_curr+refXlen), *(__m64 *)(refup_curr+refXlen+4));
+ m2 = _mm_unpackhi_pi16 (*(__m64 *)(refup_curr+refXlen), *(__m64 *)(refup_curr+refXlen+4));
// m1 now contains r10 r12 r14 r16
- m2 = _mm_unpacklo_pi16(m3, m2);
+ m2 = _mm_unpacklo_pi16 (m3, m2);
- // (refup_curr[0] + (refup_curr+refXlen)[0] + 1)>>1
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_add_pi16(m1, round);
- *(__m64 *)block_curr = _mm_srai_pi16(m1, 1);
+ // (refup_curr[0] + (refup_curr+refXlen)[0] + 1)>>1
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_add_pi16 (m1, round);
+ *(__m64 *)block_curr = _mm_srai_pi16 (m1, 1);
}
- for(x = stopX; x < block_data.LengthX(); ++x)
+ for ( x=stopX; x < block_data.LengthX(); ++x)
{
- *block_curr = ((*refup_curr + *(refup_curr + refXlen) +
- 1
+ *block_curr = (( *refup_curr + *(refup_curr+refXlen) +
+ 1
) >> 1);
++block_curr;
- refup_curr += 2;
+ refup_curr+=2;
}
}
_mm_empty();
}
else
{
- __m64 round = _mm_set_pi16(2, 2, 2, 2);
+ __m64 round = _mm_set_pi16 (2, 2, 2, 2);
__m64 m1, m2, m3;
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
int x;
- for(x = 0; x < stopX; x += 4, block_curr += 4, refup_curr += 8)
+ for( x = 0; x < stopX; x+=4, block_curr+=4, refup_curr+=8 )
{
- m1 = _mm_add_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + refXlen));
- m2 = _mm_add_pi16(*(__m64 *)(refup_curr + 4), *(__m64 *)(refup_curr + refXlen + 4));
- m3 = _mm_unpacklo_pi16(m1, m2);
- m1 = _mm_unpackhi_pi16(m1, m2);
+ m1 = _mm_add_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+refXlen));
+ m2 = _mm_add_pi16 (*(__m64 *)(refup_curr+4), *(__m64 *)(refup_curr+refXlen+4));
+ m3 = _mm_unpacklo_pi16 (m1, m2);
+ m1 = _mm_unpackhi_pi16 (m1, m2);
- m2 = _mm_unpackhi_pi16(m3, m1);
- m1 = _mm_unpacklo_pi16(m3, m1);
+ m2 = _mm_unpackhi_pi16 (m3, m1);
+ m1 = _mm_unpacklo_pi16 (m3, m1);
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_add_pi16(m1, round);
- *(__m64 *)block_curr = _mm_srai_pi16(m1, 2);
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_add_pi16 (m1, round);
+ *(__m64 *)block_curr = _mm_srai_pi16 (m1, 2);
}
- for(x = stopX; x < block_data.LengthX(); ++x)
+ for ( x=stopX; x < block_data.LengthX(); ++x)
{
- *block_curr = ((*refup_curr +
- *(refup_curr + 1) +
- *(refup_curr + refXlen) +
- *(refup_curr + refXlen + 1) +
- 2
+ *block_curr = (( *refup_curr +
+ *(refup_curr+1) +
+ *(refup_curr+refXlen) +
+ *(refup_curr+refXlen+1) +
+ 2
) >> 2);
++block_curr;
- refup_curr += 2;
+ refup_curr+=2;
}
}
_mm_empty();
@@ -245,41 +244,40 @@ void MotionCompensator_QuarterPixel::BlockPixelPred(
// We're 2doing bounds checking because we'll fall off the edge of the reference otherwise.
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) *(2 - rmdr.y), //tl
- rmdr.x *(2 - rmdr.y), //tr
+ const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
+ rmdr.x * (2 - rmdr.y), //tr
(2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ rmdr.x * rmdr.y }; //br
ValueType act_cols1[4], act_cols2[4];
int uX, uY, c, l;
- for(c = 0, uY = ref_start.y; c < block_data.LengthY(); ++c, uY += 2)
- {
- for(l = 0, uX = ref_start.x; l < block_data.LengthX(); ++l, ++block_curr, uX += 2)
- {
- check_active_columns(uX, trueRefXlen, act_cols1, act_cols2, refup_data[BChk(uY, trueRefYlen)], refup_data[BChk(uY+1, trueRefYlen)]);
-
- *block_curr = ((linear_wts[0] * act_cols1[0] +
- linear_wts[1] * act_cols1[1] +
- linear_wts[2] * act_cols2[0] +
- linear_wts[3] * act_cols2[1] +
- 2
+ for(c = 0, uY = ref_start.y; c < block_data.LengthY(); ++c, uY += 2)
+ {
+ for(l = 0, uX=ref_start.x; l < block_data.LengthX(); ++l, ++block_curr, uX += 2)
+ {
+ check_active_columns(uX, trueRefXlen, act_cols1, act_cols2, refup_data[BChk(uY, trueRefYlen)], refup_data[BChk(uY+1, trueRefYlen)]);
+
+ *block_curr = (( linear_wts[0] * act_cols1[0] +
+ linear_wts[1] * act_cols1[1] +
+ linear_wts[2] * act_cols2[0] +
+ linear_wts[3] * act_cols2[1] +
+ 2
) >> 2);
- }//l
- }//c
+ }//l
+ }//c
}
}
-void MotionCompensator_HalfPixel::BlockPixelPred(
- TwoDArray<ValueType> &block_data ,
- const ImageCoords& pos ,
- const ImageCoords& orig_pic_size ,
- const PicArray &refup_data ,
- const MVector &mv)
+void MotionCompensator_HalfPixel::BlockPixelPred(
+ TwoDArray<ValueType> &block_data ,
+ const ImageCoords& pos ,
+ const ImageCoords& orig_pic_size ,
+ const PicArray &refup_data ,
+ const MVector &mv)
{
//Where to start in the upconverted image
- const ImageCoords start_pos(std::max(pos.x, 0) , std::max(pos.y, 0));
- const ImageCoords ref_start((start_pos.x << 1) + mv.x , (start_pos.y << 1) + mv.y);
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
+ const ImageCoords ref_start( ( start_pos.x<<1 ) + mv.x ,( start_pos.y<<1 ) + mv.y );
//An additional stage to make sure the block to be copied does not fall outside
//the reference image.
@@ -293,50 +291,50 @@ void MotionCompensator_HalfPixel::BlockPixelPred(
//Check if there are going to be any problems copying the block from
//the upvconverted reference image.
- if(ref_start.x < 0)
+ if( ref_start.x < 0 )
do_bounds_checking = true;
- else if(ref_start.x + ((block_data.LengthX() - 1) << 1) >= trueRefXlen)
+ else if( ref_start.x + ((block_data.LengthX() - 1 )<<1 ) >= trueRefXlen )
do_bounds_checking = true;
- if(ref_start.y < 0)
+ if( ref_start.y < 0 )
do_bounds_checking = true;
- else if(ref_start.y + ((block_data.LengthY() - 1) << 1) >= trueRefYlen)
+ else if( ref_start.y + ((block_data.LengthY() - 1 )<<1 ) >= trueRefYlen)
do_bounds_checking = true;
ValueType *block_curr = &block_data[0][0];
-
- if(!do_bounds_checking)
- {
+
+ if( !do_bounds_checking )
+ {
ValueType *refup_curr = &refup_data[ref_start.y][ref_start.x];
- const int refup_next((refXlen - block_data.LengthX()) * 2);// go down 2 rows and back up
+ const int refup_next( (refXlen - block_data.LengthX())*2 );// go down 2 rows and back up
#if 1
- int stopX = (block_data.LengthX() >> 2) << 2;
+ int stopX = (block_data.LengthX()>>2)<<2;
{
__m64 m1, m2;
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
int x;
- for(x = 0; x < stopX; x += 4, block_curr += 4, refup_curr += 8)
+ for( x=0; x < stopX; x+=4, block_curr+=4, refup_curr+=8 )
{
- m1 = _mm_unpacklo_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
- m2 = _mm_unpackhi_pi16(*(__m64 *)refup_curr, *(__m64 *)(refup_curr + 4));
- *(__m64 *)block_curr = _mm_unpacklo_pi16(m1, m2);
+ m1 = _mm_unpacklo_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
+ m2 = _mm_unpackhi_pi16 (*(__m64 *)refup_curr, *(__m64 *)(refup_curr+4));
+ *(__m64 *)block_curr = _mm_unpacklo_pi16 (m1, m2);
}
// Mopup the last value
- for(x = stopX ; x < block_data.LengthX(); ++x)
+ for ( x=stopX ; x < block_data.LengthX(); ++x)
{
*block_curr = *refup_curr;
++block_curr;
- refup_curr += 2;
+ refup_curr+=2;
}
}
_mm_empty();
}
#else
- for(int y = 0; y < block_data.LengthY(); ++y, refup_curr += refup_next)
+ for( int y=0; y < block_data.LengthY(); ++y, refup_curr+=refup_next )
{
- for(int x = 0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr += 2)
+ for( int x=0; x < block_data.LengthX(); ++x, ++block_curr, refup_curr+=2 )
{
*block_curr = refup_curr[0];
}
@@ -346,27 +344,27 @@ void MotionCompensator_HalfPixel::BlockPixelPred(
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = 0, ry = ref_start.y, by = BChk(ry, trueRefYlen);
- y < block_data.LengthY();
- ++y, ry += 2, by = BChk(ry, trueRefYlen))
+ for( int y=0, ry=ref_start.y, by=BChk(ry,trueRefYlen);
+ y<block_data.LengthY();
+ ++y, ry+=2,by=BChk(ry,trueRefYlen))
{
- for(int x = 0 , rx = ref_start.x , bx = BChk(rx, trueRefXlen);
- x < block_data.LengthX() ;
- ++x, ++block_curr, rx += 2 , bx = BChk(rx, trueRefXlen))
- {
- *block_curr = refup_data[by][bx];
- }// x
+ for( int x=0 , rx=ref_start.x , bx=BChk(rx,trueRefXlen);
+ x<block_data.LengthX() ;
+ ++x, ++block_curr, rx+=2 , bx=BChk(rx,trueRefXlen))
+ {
+ *block_curr = refup_data[by][bx];
+ }// x
}// y
}
}
-void MotionCompensator::AdjustBlockBySpatialWeights(
- TwoDArray<ValueType>& val_block,
- const ImageCoords &pos,
- const TwoDArray<ValueType> &wt_array)
+void MotionCompensator::AdjustBlockBySpatialWeights (
+ TwoDArray<ValueType>& val_block,
+ const ImageCoords &pos,
+ const TwoDArray<ValueType> &wt_array)
{
- ImageCoords start_pos(std::max(0, pos.x), std::max(0, pos.y));
- ImageCoords wt_start(start_pos.x - pos.x, start_pos.y - pos.y);
+ ImageCoords start_pos (std::max(0, pos.x), std::max(0, pos.y));
+ ImageCoords wt_start (start_pos.x - pos.x, start_pos.y - pos.y);
ValueType *val_curr = &val_block[0][0];
ValueType *wt_curr = &wt_array[wt_start.y][wt_start.x];
@@ -374,21 +372,21 @@ void MotionCompensator::AdjustBlockBySpatialWeights(
// go down at row and back to beginning of weights line
const int wt_next = wt_array.LengthX() - val_block.LengthX();
- const int stopX = (val_block.LengthX() >> 2) << 2;
-
- for(int j = 0; j < val_block.LengthY(); ++j, wt_curr += wt_next)
+ const int stopX = (val_block.LengthX()>>2)<<2;
+
+ for ( int j = 0; j < val_block.LengthY(); ++j, wt_curr += wt_next)
{
- for(int i = 0; i < stopX; i += 4, val_curr += 4, wt_curr += 4)
+ for ( int i = 0; i < stopX; i+=4, val_curr+=4, wt_curr+=4)
{
/*
* NOTE: Using only the low 16 bits of the result of multiplication
* by weights because the result is supposed to fit in 16 bit
* words. For some weights could result in overflow and errors
*/
- __m64 *out = (__m64 *)val_curr;
- *out = _mm_mullo_pi16(*(__m64 *)val_curr, *(__m64 *)wt_curr);
+ __m64 *out = (__m64 *)val_curr;
+ *out = _mm_mullo_pi16 (*(__m64 *)val_curr, *(__m64 *)wt_curr);
}
- for(int i = stopX; i < val_block.LengthX(); ++i, ++val_curr, ++wt_curr)
+ for (int i = stopX; i < val_block.LengthX(); ++i, ++val_curr, ++wt_curr)
{
*val_curr = *val_curr * *wt_curr;
}
@@ -398,75 +396,75 @@ void MotionCompensator::AdjustBlockBySpatialWeights(
namespace dirac
{
-void CompensateComponentAddAndShift_mmx(int start_y, int end_y,
- int weight_bits,
- const ImageCoords& orig_pic_size,
- TwoDArray<ValueType> &comp_data,
- PicArray &pic_data_out)
-{
- if(start_y >= end_y)
- return;
- const int round_val = 1 << (weight_bits - 1);
- int stopX = pic_data_out.FirstX() + ((orig_pic_size.x >> 2) << 2);
- int x_end_truepic_data = pic_data_out.FirstX() + orig_pic_size.x;
- int x_end_data = pic_data_out.FirstX() + pic_data_out.LengthX();
- __m64 mround_val = _mm_set_pi16(round_val, round_val, round_val, round_val);
- ValueType *pic_row = &comp_data[0][comp_data.FirstX()];
- ValueType *out_row = &pic_data_out[start_y][pic_data_out.FirstX()];
- for(int i = start_y; i < end_y; i++)
+ void CompensateComponentAddAndShift_mmx (int start_y, int end_y,
+ int weight_bits,
+ const ImageCoords& orig_pic_size,
+ TwoDArray<ValueType> &comp_data,
+ PicArray &pic_data_out)
{
- for(int j = pic_data_out.FirstX(); j < stopX; j += 4)
- {
- __m64 in1 = _mm_add_pi16(*(__m64 *)pic_row, mround_val);
- in1 = _mm_srai_pi16(in1, weight_bits);
- __m64 *out = (__m64 *)out_row;
- *out = _mm_add_pi16(in1, *out);
- pic_row += 4;
- out_row += 4;
- }
- for(int j = stopX; j < x_end_truepic_data; j++)
+ if (start_y >= end_y)
+ return;
+ const int round_val = 1<<(weight_bits-1);
+ int stopX = pic_data_out.FirstX() + ((orig_pic_size.x>>2)<<2);
+ int x_end_truepic_data = pic_data_out.FirstX() + orig_pic_size.x;
+ int x_end_data = pic_data_out.FirstX() + pic_data_out.LengthX();
+ __m64 mround_val = _mm_set_pi16 (round_val, round_val, round_val, round_val);
+ ValueType *pic_row = &comp_data[0][comp_data.FirstX()];
+ ValueType *out_row = &pic_data_out[start_y][pic_data_out.FirstX()];
+ for ( int i = start_y; i < end_y; i++)
{
- *out_row += static_cast<ValueType>((*pic_row + round_val) >> weight_bits);
- ++out_row;
- ++pic_row;
- }
- // Now pad past the true picture with the last true pic val in
- // current row
- ValueType last_true_val = *(out_row - 1);
- for(int j = x_end_truepic_data; j < x_end_data; ++j)
- {
- *out_row = last_true_val;
- ++out_row;
- ++pic_row;
- }
+ for ( int j = pic_data_out.FirstX(); j < stopX; j+=4)
+ {
+ __m64 in1 = _mm_add_pi16 (*(__m64 *)pic_row, mround_val);
+ in1 = _mm_srai_pi16 (in1, weight_bits);
+ __m64 *out = (__m64 *)out_row;
+ *out = _mm_add_pi16 (in1, *out);
+ pic_row += 4;
+ out_row += 4;
+ }
+ for ( int j =stopX; j < x_end_truepic_data; j++)
+ {
+ *out_row += static_cast<ValueType>( (*pic_row + round_val) >> weight_bits );
+ ++out_row;
+ ++pic_row;
+ }
+ // Now pad past the true picture with the last true pic val in
+ // current row
+ ValueType last_true_val = *(out_row - 1);
+ for ( int j = x_end_truepic_data; j < x_end_data; ++j)
+ {
+ *out_row = last_true_val;
+ ++out_row;
+ ++pic_row;
+ }
+ }
+ _mm_empty();
}
- _mm_empty();
-}
-void AddMCBlock_mmx(const ImageCoords& start_pos,
- TwoDArray<ValueType> &comp_strip,
- TwoDArray<ValueType>& block_data)
-{
- const int stopX = (block_data.LengthX() >> 2) << 2;
+ void AddMCBlock_mmx (const ImageCoords& start_pos,
+ TwoDArray<ValueType> &comp_strip,
+ TwoDArray<ValueType>& block_data)
+ {
+ const int stopX = (block_data.LengthX()>>2)<<2;
- const int comp_next = comp_strip.LengthX() - block_data.LengthX();
- ValueType *comp_curr = &comp_strip[start_pos.y][start_pos.x];
- ValueType *block_curr = &block_data[0][0];
+ const int comp_next = comp_strip.LengthX()-block_data.LengthX();
+ ValueType *comp_curr = &comp_strip[start_pos.y][start_pos.x];
+ ValueType *block_curr = &block_data[0][0];
- for(int j = 0; j < block_data.LengthY(); ++j, comp_curr += comp_next)
- {
- for(int i = 0; i < stopX; i += 4, comp_curr += 4, block_curr += 4)
- {
- __m64 *out = (__m64 *)comp_curr;
- // mc_tmp[y][x] += val
- *out = _mm_add_pi16(*(__m64 *)comp_curr, *(__m64 *)block_curr);
- }
- for(int i = stopX; i < block_data.LengthX(); ++i, ++comp_curr, ++block_curr)
+ for (int j = 0; j < block_data.LengthY(); ++j, comp_curr += comp_next)
{
- *comp_curr += *block_curr;
+ for (int i = 0; i < stopX; i+=4, comp_curr+=4, block_curr+=4)
+ {
+ __m64 *out = (__m64 *)comp_curr;
+ // mc_tmp[y][x] += val
+ *out = _mm_add_pi16 (*(__m64 *)comp_curr, *(__m64 *)block_curr);
+ }
+ for (int i = stopX; i < block_data.LengthX(); ++i, ++comp_curr, ++block_curr)
+ {
+ *comp_curr += *block_curr;
+ }
}
+ _mm_empty();
}
- _mm_empty();
-}
}
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.h
index dcc7f19b9..4be009c61 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mot_comp_mmx.h
@@ -50,13 +50,13 @@
namespace dirac
{
-void CompensateComponentAddAndShift_mmx(int start_y, int end_y,
- int weight_bits,
- const ImageCoords& orig_pic_size,
- TwoDArray<ValueType> &comp_data,
- PicArray &pic_data_out);
-
-void AddMCBlock_mmx(const ImageCoords& start_pos, TwoDArray<ValueType> &comp_strip, TwoDArray<ValueType>& block_data);
+ void CompensateComponentAddAndShift_mmx (int start_y, int end_y,
+ int weight_bits,
+ const ImageCoords& orig_pic_size,
+ TwoDArray<ValueType> &comp_data,
+ PicArray &pic_data_out);
+
+ void AddMCBlock_mmx (const ImageCoords& start_pos, TwoDArray<ValueType> &comp_strip, TwoDArray<ValueType>& block_data);
}
#endif // HAVE_MMX
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.cpp
index 3e1a60fcc..cb48bdbb3 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.cpp
@@ -52,14 +52,14 @@ using namespace std;
//Motion vector and Motion Estimation structures//
//////////////////////////////////////////////////
-MvData::MvData(const PicturePredParams& predparams , const int num_refs):
- m_predparams(predparams),
- m_vectors(Range(1 , num_refs)),
- m_gm_vectors(Range(1 , num_refs)),
- m_modes(predparams.YNumBlocks() , predparams.XNumBlocks()),
- m_dc(3),
- m_sb_split(predparams.YNumSB() , predparams.XNumSB()),
- m_gm_params(Range(1 , num_refs)) //,
+MvData::MvData( const PicturePredParams& predparams , const int num_refs ):
+ m_predparams( predparams ),
+ m_vectors( Range(1 , num_refs) ),
+ m_gm_vectors( Range(1 , num_refs) ),
+ m_modes( predparams.YNumBlocks() , predparams.XNumBlocks() ),
+ m_dc( 3 ),
+ m_sb_split( predparams.YNumSB() , predparams.XNumSB() ),
+ m_gm_params( Range(1 , num_refs) )//,
// m_num_refs(num_refs)
{
InitMvData();
@@ -68,144 +68,140 @@ MvData::MvData(const PicturePredParams& predparams , const int num_refs):
void MvData::InitMvData()
{
// Create the arrays of vectors
- for(int i = m_vectors.First() ; i <= m_vectors.Last() ; ++i)
- {
- m_vectors[i] = new MvArray(Mode().LengthY() , Mode().LengthX());
- m_gm_vectors[i] = new MvArray(Mode().LengthY() , Mode().LengthX());
- }
+ for ( int i=m_vectors.First() ; i<=m_vectors.Last() ; ++i ){
+ m_vectors[i] = new MvArray( Mode().LengthY() , Mode().LengthX() );
+ m_gm_vectors[i] = new MvArray( Mode().LengthY() , Mode().LengthX() );
+ }
// create global motion parameter arrays
- for(int i = m_gm_params.First() ; i <= m_gm_params.Last() ; ++i)
- {
- m_gm_params[i] = new OneDArray<float> (8);
+ for ( int i=m_gm_params.First() ; i<=m_gm_params.Last() ; ++i ){
+ m_gm_params[i] = new OneDArray<float> ( 8 );
}
- // Create the arrays of dc values
- for(int i = 0 ; i < 3 ; ++i)
- m_dc[i] = new TwoDArray<ValueType>(Mode().LengthY() , Mode().LengthX() , 0);
+ // Create the arrays of dc values
+ for ( int i=0 ; i<3 ; ++i )
+ m_dc[i] = new TwoDArray<ValueType>( Mode().LengthY() , Mode().LengthX() , 0);
}
MvData::~MvData()
{
- // Delete the arrays of vectors
- for(int i = m_vectors.First() ; i <= m_vectors.Last() ; ++i)
- {
+ // Delete the arrays of vectors
+ for ( int i=m_vectors.First() ; i<=m_vectors.Last() ; ++i ){
delete m_vectors[i];
delete m_gm_vectors[i];
}
- // delete array of global motion parameters
- for(int i = m_gm_params.First() ; i <= m_gm_params.Last() ; ++i)
- {
- delete m_gm_params[i];
- }
+ // delete array of global motion parameters
+ for ( int i=m_gm_params.First() ; i<=m_gm_params.Last() ; ++i ){
+ delete m_gm_params[i];
+ }
- // Delete the arrays of dc values
- for(int i = 0 ; i < 3 ; ++i)
- delete m_dc[i];
+ // Delete the arrays of dc values
+ for ( int i=0 ; i<3 ; ++i )
+ delete m_dc[i];
}
-MEData::MEData(const PicturePredParams& predparams , const int num_refs):
- MvData(predparams , num_refs),
- m_pred_costs(Range(1 , num_refs)),
- m_intra_costs(predparams.YNumBlocks() , predparams.XNumBlocks(), 0),
- m_bipred_costs(predparams.YNumBlocks() , predparams.XNumBlocks()),
- m_SB_costs(predparams.YNumSB() , predparams.XNumSB()),
- m_lambda_map(predparams.YNumBlocks() , predparams.XNumBlocks()),
- m_inliers(Range(1 , num_refs)),
- m_intra_block_ratio(0.0)
+MEData::MEData(const PicturePredParams& predparams , const int num_refs ):
+ MvData( predparams , num_refs ),
+ m_pred_costs( Range( 1 , num_refs ) ),
+ m_intra_costs( predparams.YNumBlocks() , predparams.XNumBlocks(), 0 ),
+ m_bipred_costs( predparams.YNumBlocks() , predparams.XNumBlocks() ),
+ m_SB_costs( predparams.YNumSB() , predparams.XNumSB() ),
+ m_lambda_map( predparams.YNumBlocks() , predparams.XNumBlocks() ),
+ m_inliers( Range( 1 , num_refs ) ),
+ m_intra_block_ratio(0.0)
{
InitMEData();
}
void MEData::InitMEData()
{
- // Create the arrays of prediction costs
- for(int i = m_pred_costs.First() ; i <= m_pred_costs.Last() ; ++i)
- m_pred_costs[i] = new TwoDArray<MvCostData>(Mode().LengthY() , Mode().LengthX());
+ // Create the arrays of prediction costs
+ for ( int i=m_pred_costs.First() ; i<=m_pred_costs.Last() ; ++i )
+ m_pred_costs[i] = new TwoDArray<MvCostData>( Mode().LengthY() , Mode().LengthX() );
// Create the arrays of vectors
- for(int i = m_inliers.First() ; i <= m_inliers.Last() ; ++i)
- m_inliers[i] = new TwoDArray<int>(Mode().LengthY() , Mode().LengthX());
+ for ( int i=m_inliers.First() ; i<=m_inliers.Last() ; ++i )
+ m_inliers[i] = new TwoDArray<int>( Mode().LengthY() , Mode().LengthX() );
}
-void MEData::SetLambdaMap(const int num_refs , const float lambda)
+void MEData::SetLambdaMap( const int num_refs , const float lambda )
{
- TwoDArray<bool> transition_map1(Mode().LengthY() , Mode().LengthX());
- TwoDArray<bool> transition_map2(Mode().LengthY() , Mode().LengthX());
+ TwoDArray<bool> transition_map1( Mode().LengthY() , Mode().LengthX() );
+ TwoDArray<bool> transition_map2( Mode().LengthY() , Mode().LengthX() );
- FindTransitions(transition_map1 , 1);
+ FindTransitions( transition_map1 , 1 );
- if(num_refs == 1)
+ if ( num_refs==1 )
{
- for(int j = 0 ; j < m_lambda_map.LengthY() ; j++)
+ for ( int j=0 ; j<m_lambda_map.LengthY() ; j++)
{
- for(int i = 0 ; i < m_lambda_map.LengthX() ; i++)
+ for ( int i=0 ; i<m_lambda_map.LengthX() ; i++)
{
- if(transition_map1[j][i])
+ if ( transition_map1[j][i] )
m_lambda_map[j][i] = 0.0;
else
m_lambda_map[j][i] = lambda;
- if(i < 4 || j < 4)
- m_lambda_map[j][i] /= 5.0;
+ if ( i<4 || j<4 )
+ m_lambda_map[j][i] /= 5.0;
}// i
}// j
}
- else if(num_refs > 1)
+ else if ( num_refs > 1 )
{
- FindTransitions(transition_map2 , 2);
+ FindTransitions( transition_map2 , 2 );
- for(int j = 0 ; j < m_lambda_map.LengthY() ; j++)
+ for ( int j=0 ; j<m_lambda_map.LengthY() ; j++)
{
- for(int i = 0 ; i < m_lambda_map.LengthX() ; i++)
+ for ( int i=0 ; i<m_lambda_map.LengthX() ; i++)
{
- if(transition_map1[j][i] && transition_map2[j][i])
+ if ( transition_map1[j][i] && transition_map2[j][i] )
m_lambda_map[j][i] = 0.0;
- else if(transition_map1[j][i] || transition_map2[j][i])
- m_lambda_map[j][i] = lambda / 4.0;
+ else if (transition_map1[j][i] || transition_map2[j][i] )
+ m_lambda_map[j][i] = lambda/4.0;
else
m_lambda_map[j][i] = lambda;
- if(i < 4 || j < 4)
- m_lambda_map[j][i] /= 5.0;
+ if ( i<4 || j<4 )
+ m_lambda_map[j][i] /= 5.0;
}// i
}// j
}
}
-void MEData::SetLambdaMap(const int level , const TwoDArray<float>& l_map , const float wt)
+void MEData::SetLambdaMap( const int level , const TwoDArray<float>& l_map , const float wt )
{
- const int factor = 1 << (2 - level);
+ const int factor = 1<<(2-level);
int xstart , xend , ystart , yend;
-
- for(int j = 0 ; j < m_lambda_map.LengthY() ; ++j)
+
+ for (int j = 0 ; j<m_lambda_map.LengthY() ; ++j )
{
- for(int i = 0 ; i < m_lambda_map.LengthX() ; ++i)
+ for (int i = 0 ; i<m_lambda_map.LengthX() ; ++i )
{
xstart = factor * i;
ystart = factor * j;
- xend = factor * (i + 1);
- yend = factor * (j + 1);
+ xend = factor * ( i + 1 );
+ yend = factor * ( j + 1 );
m_lambda_map[j][i] = l_map[ystart][xstart];
- for(int q = ystart ; q < yend ; ++q)
- for(int p = xstart ; p < xend ; ++p)
- m_lambda_map[j][i] = std::max(l_map[q][p] , m_lambda_map[j][i]);
+ for (int q = ystart ; q<yend ; ++q )
+ for (int p = xstart ; p<xend ; ++p )
+ m_lambda_map[j][i] = std::max( l_map[q][p] , m_lambda_map[j][i] );
- m_lambda_map[j][i] *= wt;
+ m_lambda_map[j][i] *= wt;
}// i
}// j
}
-void MEData::FindTransitions(TwoDArray<bool>& trans_map , const int ref_num)
+void MEData::FindTransitions( TwoDArray<bool>& trans_map , const int ref_num )
{
- const MvArray& mv_array = Vectors(ref_num);
+ const MvArray& mv_array = Vectors( ref_num );
// Start with a statistical approach - determine thresholds later
@@ -219,20 +215,20 @@ void MEData::FindTransitions(TwoDArray<bool>& trans_map , const int ref_num)
double threshold;
// first, mean
- for(int j = 0 ; j < mv_array.LengthY() ; ++j)
- for(int i = 0 ; i < mv_array.LengthX() ; ++i)
- total_cost += PredCosts(ref_num)[j][i].SAD;
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ total_cost += PredCosts( ref_num )[j][i].SAD;
- mean_cost = total_cost /
- static_cast<long double>(mv_array.LengthX() * mv_array.LengthY());
+ mean_cost = total_cost /
+ static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
// next , Standard Deviation
-
- for(int j = 0 ; j < mv_array.LengthY() ; ++j)
+
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
{
- for(int i = 0 ; i < mv_array.LengthX() ; ++i)
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
{
- diff = PredCosts(ref_num)[j][i].SAD - mean_cost;
+ diff = PredCosts( ref_num )[j][i].SAD - mean_cost;
diff *= diff;
sd_cost += diff;
@@ -240,40 +236,40 @@ void MEData::FindTransitions(TwoDArray<bool>& trans_map , const int ref_num)
}// j
// Get the variance ...
- sd_cost /= static_cast<long double>(mv_array.LengthX() * mv_array.LengthY());
+ sd_cost /= static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
// ... and then the SD
- sd_cost = std::sqrt(sd_cost);
+ sd_cost = std::sqrt( sd_cost );
- threshold = mean_cost + 3 * sd_cost;
+ threshold = mean_cost + 3*sd_cost;
// now go through and mark those that go above the threshold
- for(int j = 0 ; j < mv_array.LengthY() ; ++j)
- for(int i = 0 ; i < mv_array.LengthX() ; ++i)
- trans_map[j][i] = (PredCosts(ref_num)[j][i].SAD >= threshold) ? true : false;
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ trans_map[j][i] = ( PredCosts( ref_num )[j][i].SAD >= threshold )? true : false;
// Next look at motion-vector costs
- TwoDArray<double> val_array(mv_array.LengthY() , mv_array.LengthX());
+ TwoDArray<double> val_array( mv_array.LengthY() , mv_array.LengthX() );
// first, mean
total_cost = 0.0;
- for(int i = 0 ; i < mv_array.LengthX() ; ++i)
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
{
val_array[0][i] = 0.0;
val_array[val_array.LastY()][i] = 0.0;
}// i
- for(int j = 1 ; j < mv_array.LengthY() - 1 ; ++j)
+ for ( int j=1 ; j<mv_array.LengthY()-1 ; ++j )
{
val_array[j][0] = 0.0;
val_array[j][val_array.LastX()] = 0.0;
- for(int i = 1 ; i < mv_array.LengthX() - 1 ; ++i)
+ for ( int i=1 ; i<mv_array.LengthX()-1 ; ++i )
{
- val_array[j][i] = 0.0;
- for(int q = -1 ; q <= 1 ; ++q)
- for(int p = -1 ; p <= 1 ; ++p)
- val_array[j][i] = std::max(val_array[j][i] , (double)Norm1(mv_array[j+q][i+p] - mv_array[j][i]));
+ val_array[j][i] =0.0;
+ for (int q=-1 ; q<=1 ; ++q)
+ for (int p=-1 ; p<=1 ; ++p)
+ val_array[j][i] = std::max( val_array[j][i] , (double)Norm1( mv_array[j+q][i+p] - mv_array[j][i] ) );
total_cost += val_array[j][i];
@@ -281,15 +277,15 @@ void MEData::FindTransitions(TwoDArray<bool>& trans_map , const int ref_num)
}// j
- mean_cost = total_cost /
- static_cast<long double>(mv_array.LengthX() * mv_array.LengthY());
+ mean_cost = total_cost /
+ static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
// next , Standard Deviation
sd_cost = 0.0;
-
- for(int j = 1 ; j < mv_array.LengthY() - 1 ; ++j)
+
+ for ( int j=1 ; j<mv_array.LengthY()-1 ; ++j )
{
- for(int i = 1 ; i < mv_array.LengthX() - 1 ; ++i)
+ for ( int i=1 ; i<mv_array.LengthX()-1 ; ++i )
{
diff = val_array[j][i] - mean_cost;
diff *= diff;
@@ -300,39 +296,39 @@ void MEData::FindTransitions(TwoDArray<bool>& trans_map , const int ref_num)
}// j
// Get the variance ...
- sd_cost /= static_cast<long double>(mv_array.LengthX() * mv_array.LengthY());
+ sd_cost /= static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
// ... and then the SD
- sd_cost = std::sqrt(sd_cost);
+ sd_cost = std::sqrt( sd_cost );
- threshold = mean_cost + 3 * sd_cost;
+ threshold = mean_cost + 3*sd_cost;
// now go through and mark those that go above the threshold
- for(int j = 0 ; j < mv_array.LengthY() ; ++j)
- for(int i = 0 ; i < mv_array.LengthX() ; ++i)
- trans_map[j][i] = (val_array[j][i] >= threshold) ? true : false;
-
- bool contains_trans;
-
- for(int j = 0 ; j < mv_array.LengthY() / 4 ; ++j)
- {
- for(int i = 0 ; i < mv_array.LengthX() / 4 ; ++i)
- {
- contains_trans = false;
- for(int q = 4 * j ; q < 4 *(j + 1) ; ++q)
- {
- for(int p = 4 * i ; p < 4 *(i + 1) ; ++p)
- {
- if(trans_map[q][p])
- contains_trans = true;
- }// p
- }// q
- for(int q = 4 * j ; q < 4 *(j + 1) ; ++q)
- for(int p = 4 * i ; p < 4 *(i + 1) ; ++p)
- trans_map[q][p] = contains_trans;
-
- }// i
- }// j
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ trans_map[j][i] = ( val_array[j][i] >= threshold )? true : false;
+
+ bool contains_trans;
+
+ for ( int j=0 ; j<mv_array.LengthY()/4 ; ++j )
+ {
+ for ( int i=0 ; i<mv_array.LengthX()/4 ; ++i )
+ {
+ contains_trans = false;
+ for ( int q=4*j ; q<4*(j+1) ; ++q )
+ {
+ for ( int p=4*i ; p<4*(i+1) ; ++p )
+ {
+ if (trans_map[q][p])
+ contains_trans = true;
+ }// p
+ }// q
+ for ( int q=4*j ; q<4*(j+1) ; ++q )
+ for ( int p=4*i ; p<4*(i+1) ; ++p )
+ trans_map[q][p] = contains_trans;
+
+ }// i
+ }// j
}
@@ -340,41 +336,39 @@ void MEData::FindTransitions(TwoDArray<bool>& trans_map , const int ref_num)
MEData::~MEData()
{
// Delete the arrays of prediction costs
- for(int i = m_pred_costs.First() ; i <= m_pred_costs.Last() ; ++i)
- delete m_pred_costs[i];
+ for ( int i=m_pred_costs.First() ; i<=m_pred_costs.Last() ; ++i )
+ delete m_pred_costs[i];
- for(int i = m_inliers.First() ; i <= m_inliers.Last() ; ++i)
+ for ( int i=m_inliers.First() ; i<=m_inliers.Last() ; ++i )
delete m_inliers[i];
}
-void MEData::DropRef(const int rindex)
-{
+void MEData::DropRef( const int rindex ){
- if(rindex == 2) {}
- else if(rindex == 1)
- {
- // Swap data for reference 1 and reference 2
- // so that reference 2 becomes the new reference 1
+ if (rindex==2){}
+ else if (rindex==1){
+ // Swap data for reference 1 and reference 2
+ // so that reference 2 becomes the new reference 1
- MvArray* ptr = m_vectors[1];
- m_vectors[1] = m_vectors[2];
- m_vectors[2] = ptr;
+ MvArray* ptr = m_vectors[1];
+ m_vectors[1] = m_vectors[2];
+ m_vectors[2] = ptr;
- ptr = m_gm_vectors[1];
- m_gm_vectors[1] = m_gm_vectors[2];
- m_gm_vectors[2] = ptr;
+ ptr = m_gm_vectors[1];
+ m_gm_vectors[1] = m_gm_vectors[2];
+ m_gm_vectors[2] = ptr;
- OneDArray<float>* ptr2 = m_gm_params[1];
- m_gm_params[1] = m_gm_params[2];
- m_gm_params[2] = ptr2;
+ OneDArray<float>* ptr2 = m_gm_params[1];
+ m_gm_params[1] = m_gm_params[2];
+ m_gm_params[2] = ptr2;
- TwoDArray<MvCostData>* ptr3 = m_pred_costs[1];
- m_pred_costs[1] = m_pred_costs[2];
- m_pred_costs[2] = ptr3;
+ TwoDArray<MvCostData>* ptr3 = m_pred_costs[1];
+ m_pred_costs[1] = m_pred_costs[2];
+ m_pred_costs[2] = ptr3;
- TwoDArray<int>* ptr4 = m_inliers[1];
- m_inliers[1] = m_inliers[2];
- m_inliers[2] = ptr4;
+ TwoDArray<int>* ptr4 = m_inliers[1];
+ m_inliers[1] = m_inliers[2];
+ m_inliers[2] = ptr4;
}
}
@@ -420,29 +414,29 @@ istream & operator>> (istream & stream, PredMode & mode)
istream &operator>> (istream & stream, MEData & me_data)
{
stream.ignore(1000, '\n');
-
+
// input reference-independent information
stream >> me_data.SBSplit();
stream >> me_data.SBCosts();
stream >> me_data.Mode();
stream >> me_data.IntraCosts();
- if(me_data.m_pred_costs.Length() > 1)
+ if (me_data.m_pred_costs.Length() > 1)
stream >> me_data.BiPredCosts();
- if(me_data.DC().Length() == 1)
+ if (me_data.DC().Length() == 1)
{
- stream >> me_data.DC(Y_COMP);
+ stream >> me_data.DC( Y_COMP );
}
- else if(me_data.DC().Length() == 3)
+ else if (me_data.DC().Length() == 3)
{
- stream >> me_data.DC(Y_COMP);
- stream >> me_data.DC(U_COMP);
- stream >> me_data.DC(V_COMP);
+ stream >> me_data.DC( Y_COMP );
+ stream >> me_data.DC( U_COMP );
+ stream >> me_data.DC( V_COMP );
}
// input reference information
- for(int i = 1; i <= me_data.m_pred_costs.Length(); ++i)
+ for (int i=1; i<=me_data.m_pred_costs.Length(); ++i)
{
stream >> me_data.Vectors(i);
stream >> me_data.PredCosts(i);
@@ -463,23 +457,23 @@ ostream &operator<< (ostream & stream, MEData & me_data)
stream << endl << me_data.Mode();
stream << endl << me_data.IntraCosts() << endl;
- if(me_data.m_pred_costs.Length() > 1)
+ if (me_data.m_pred_costs.Length() > 1)
stream << me_data.BiPredCosts();
// output component DC values
- if(me_data.DC().Length() == 1)
+ if (me_data.DC().Length() == 1)
{
- stream << endl << me_data.DC(Y_COMP);
+ stream << endl << me_data.DC( Y_COMP );
}
- else if(me_data.DC().Length() == 3)
+ else if (me_data.DC().Length() == 3)
{
- stream << endl << me_data.DC(Y_COMP);
- stream << endl << me_data.DC(U_COMP);
- stream << endl << me_data.DC(V_COMP);
+ stream << endl << me_data.DC( Y_COMP );
+ stream << endl << me_data.DC( U_COMP );
+ stream << endl << me_data.DC( V_COMP );
}
// output reference information
- for(int i = 1; i <= me_data.m_pred_costs.Length(); ++i)
+ for (int i=1; i<=me_data.m_pred_costs.Length(); ++i)
{
stream << endl << me_data.Vectors(i);
stream << endl << me_data.PredCosts(i) << endl;
@@ -487,194 +481,180 @@ ostream &operator<< (ostream & stream, MEData & me_data)
//stream << endl << me_data.GlobalMotionVectors(i) << endl;
//stream << endl << me_data.GlobalMotionInliers(i) << endl;
}
-
+
return stream;
}
-int Median(const int val1, const int val2, const int val3)
+int Median( const int val1, const int val2, const int val3)
{
int tmp;
- tmp = val1;
- tmp += val2;
- tmp += val3;
-
- tmp -= std::max(std::max(val1 , val2) , val3);
- tmp -= std::min(std::min(val1 , val2) , val3);
+ tmp=val1;
+ tmp+=val2;
+ tmp+=val3;
+ tmp -= std::max( std::max( val1 , val2 ) , val3 );
+ tmp -= std::min( std::min( val1 , val2 ) , val3 );
+
return tmp;
}
-MVector MvMedian(const MVector& mv1, const MVector& mv2, const MVector& mv3)
-{
- //takes median of each vector component
+MVector MvMedian(const MVector& mv1,const MVector& mv2,const MVector& mv3) {
+ //takes median of each vector component
MVector tmp_mv;
- tmp_mv.x = mv1.x;
- tmp_mv.x += mv2.x;
- tmp_mv.x += mv3.x;
+ tmp_mv.x=mv1.x;
+ tmp_mv.x+=mv2.x;
+ tmp_mv.x+=mv3.x;
- tmp_mv.x -= std::max(std::max(mv1.x, mv2.x), mv3.x);
- tmp_mv.x -= std::min(std::min(mv1.x, mv2.x), mv3.x);
+ tmp_mv.x-=std::max(std::max(mv1.x,mv2.x),mv3.x);
+ tmp_mv.x-=std::min(std::min(mv1.x,mv2.x),mv3.x);
- tmp_mv.y = mv1.y;
- tmp_mv.y += mv2.y;
- tmp_mv.y += mv3.y;
+ tmp_mv.y=mv1.y;
+ tmp_mv.y+=mv2.y;
+ tmp_mv.y+=mv3.y;
- tmp_mv.y -= std::max(std::max(mv1.y, mv2.y), mv3.y);
- tmp_mv.y -= std::min(std::min(mv1.y, mv2.y), mv3.y);
+ tmp_mv.y-=std::max(std::max(mv1.y,mv2.y),mv3.y);
+ tmp_mv.y-=std::min(std::min(mv1.y,mv2.y),mv3.y);
return tmp_mv;
}
int Median(const std::vector<int>& val_list)
-{
+{
// take the median of up to 4 elements
- switch(val_list.size())
- {
- case 1 :
-
- return val_list[0];
- case 2 : // return the mean
- return ((val_list[0] + val_list[1] + 1) >> 1);
- case 3 :
- return Median(val_list[0], val_list[1], val_list[2]);
- case 4 :
+ switch (val_list.size() )
{
- int med_val(0);
- int max_val(val_list[0]);
- int min_val(val_list[0]);
-
- for(int i = 0; i < 4; ++i)
- {
- med_val += val_list[i];
- max_val = std::max(max_val , val_list[i]);
- min_val = std::min(min_val , val_list[i]);
-
- }// i
+ case 1 :
+
+ return val_list[0];
+ case 2 : // return the mean
+ return ( ( val_list[0] + val_list[1] + 1 )>>1 );
+ case 3 :
+ return Median(val_list[0], val_list[1], val_list[2] );
+ case 4 :
+ {
+ int med_val(0);
+ int max_val(val_list[0]);
+ int min_val(val_list[0]);
- med_val -= (max_val + min_val);
+ for (int i=0; i<4; ++i )
+ {
+ med_val += val_list[i];
+ max_val = std::max( max_val , val_list[i] );
+ min_val = std::min( min_val , val_list[i] );
- return ((med_val + 1) >> 1);
- }
- default :
- return 0;
+ }// i
+
+ med_val -= ( max_val + min_val );
+
+ return ( (med_val + 1)>>1 );
+ }
+ default :
+ return 0;
}
}
-MVector MvMedian(const std::vector<MVector>& vect_list)
-{
+MVector MvMedian(const std::vector<MVector>& vect_list){
//median of 0-4 vectors
-
- if(vect_list.size() == 0)
+
+ if ( vect_list.size() == 0 )
return 0;
- else if(vect_list.size() == 1)
+ else if ( vect_list.size() == 1 )
return vect_list[0];
- else if(vect_list.size() == 2)
- return MvMean(vect_list[0], vect_list[1]);
- else if(vect_list.size() == 3)
- return MvMedian(vect_list[0], vect_list[1], vect_list[2]);
- else if(vect_list.size() == 4)
+ else if ( vect_list.size() == 2 )
+ return MvMean( vect_list[0], vect_list[1] );
+ else if ( vect_list.size() == 3 )
+ return MvMedian(vect_list[0], vect_list[1], vect_list[2] );
+ else if ( vect_list.size() == 4 )
{
- MVector tmp_mv(0);
- MVector max_mv(vect_list[0]);
- MVector min_mv(vect_list[0]);
- for(int i = 0; i < 4; ++i)
- {
- tmp_mv.x += vect_list[i].x;
- max_mv.x = std::max(max_mv.x, vect_list[i].x);
- min_mv.x = std::min(min_mv.x, vect_list[i].x);
-
- tmp_mv.y += vect_list[i].y;
- max_mv.y = std::max(max_mv.y, vect_list[i].y);
- min_mv.y = std::min(min_mv.y, vect_list[i].y);
-
- }// i
-
- tmp_mv.x -= (max_mv.x + min_mv.x);
- tmp_mv.y -= (max_mv.y + min_mv.y);
-
- tmp_mv.x = (tmp_mv.x + 1) >> 1;
- tmp_mv.y = (tmp_mv.y + 1) >> 1;
-
- return tmp_mv;
-
+ MVector tmp_mv(0);
+ MVector max_mv(vect_list[0]);
+ MVector min_mv(vect_list[0]);
+ for (int i=0; i<4; ++i )
+ {
+ tmp_mv.x += vect_list[i].x;
+ max_mv.x=std::max(max_mv.x, vect_list[i].x);
+ min_mv.x=std::min(min_mv.x, vect_list[i].x);
+
+ tmp_mv.y += vect_list[i].y;
+ max_mv.y=std::max(max_mv.y, vect_list[i].y);
+ min_mv.y=std::min(min_mv.y, vect_list[i].y);
+
+ }// i
+
+ tmp_mv.x -= (max_mv.x+min_mv.x);
+ tmp_mv.y -= (max_mv.y+min_mv.y);
+
+ tmp_mv.x = (tmp_mv.x+1)>>1;
+ tmp_mv.y = (tmp_mv.y+1)>>1;
+
+ return tmp_mv;
+
}
else
- {
+ {
MVector median;
- int num_vals = int(vect_list.size());
- if(num_vals > 0)
- {
- int pos = 0;
+ int num_vals=int(vect_list.size());
+ if (num_vals>0) {
+ int pos=0;
std::vector<int> ordered_vals(vect_list.size());
//do x first
- ordered_vals[0] = vect_list[0].x;
- for(int I = 1; I < num_vals; ++I)
- {
- for(int K = 0; K < I; ++K)
- {
- if(vect_list[I].x < ordered_vals[K])
- {
- pos = K;
+ ordered_vals[0]=vect_list[0].x;
+ for (int I=1;I<num_vals;++I){
+ for (int K=0;K<I;++K){
+ if (vect_list[I].x<ordered_vals[K]){
+ pos=K;
break;
}
else
- pos = K + 1;
+ pos=K+1;
}//K
- if(pos == I)
- ordered_vals[I] = vect_list[I].x;
- else
- {
- for(int K = I - 1; K >= pos; --K)
- {
- ordered_vals[K+1] = ordered_vals[K];
+ if (pos==I)
+ ordered_vals[I]=vect_list[I].x;
+ else{
+ for (int K=I-1;K>=pos;--K){
+ ordered_vals[K+1]=ordered_vals[K];
}
- ordered_vals[pos] = vect_list[I].x;
+ ordered_vals[pos]=vect_list[I].x;
}
}//I
- if(vect_list.size() % 2 != 0)
- median.x = ordered_vals[(num_vals-1)/2];
+ if (vect_list.size()%2!=0)
+ median.x=ordered_vals[(num_vals-1)/2];
else
- median.x = (ordered_vals[(num_vals/2)-1] + ordered_vals[num_vals/2] + 1) >> 1;
+ median.x=(ordered_vals[(num_vals/2)-1]+ordered_vals[num_vals/2]+1)>>1;
//now do y
- ordered_vals[0] = vect_list[0].y;
- for(int I = 1; I < num_vals; ++I)
- {
- for(int K = 0; K < I; ++K)
- {
- if(vect_list[I].y < ordered_vals[K])
- {
- pos = K;
+ ordered_vals[0]=vect_list[0].y;
+ for (int I=1;I<num_vals;++I){
+ for (int K=0;K<I;++K){
+ if (vect_list[I].y<ordered_vals[K]){
+ pos=K;
break;
}
else
- pos = K + 1;
+ pos=K+1;
}//K
- if(pos == I)
- ordered_vals[I] = vect_list[I].y;
- else
- {
- for(int K = I - 1; K >= pos; --K)
- {
- ordered_vals[K+1] = ordered_vals[K];
+ if (pos==I)
+ ordered_vals[I]=vect_list[I].y;
+ else{
+ for (int K=I-1;K>=pos;--K){
+ ordered_vals[K+1]=ordered_vals[K];
}
- ordered_vals[pos] = vect_list[I].y;
+ ordered_vals[pos]=vect_list[I].y;
}
}//I
- if(num_vals % 2 != 0)
- median.y = ordered_vals[(num_vals-1)/2];
+ if (num_vals%2!=0)
+ median.y=ordered_vals[(num_vals-1)/2];
else
- median.y = (ordered_vals[(num_vals/2)-1] + ordered_vals[num_vals/2] + 1) >> 1;
+ median.y=(ordered_vals[(num_vals/2)-1]+ordered_vals[num_vals/2]+1)>>1;
}
- else
- {
- median.x = 0;
- median.y = 0;
+ else{
+ median.x=0;
+ median.y=0;
}
return median;
@@ -686,15 +666,15 @@ MVector MvMedian(const std::vector<MVector>& vect_list)
//! Return the unbiased mean of two motion vectors
MVector MvMean(const MVector& mv1, const MVector& mv2)
{
- //takes mean of each vector component
+ //takes mean of each vector component
MVector tmp_mv;
tmp_mv.x = mv1.x;
- tmp_mv.x += mv2.x + 1;
+ tmp_mv.x += mv2.x+1;
tmp_mv.x >>= 1;
tmp_mv.y = mv1.y;
- tmp_mv.y += mv2.y + 1;
+ tmp_mv.y += mv2.y+1;
tmp_mv.y >>= 1;
return tmp_mv;
@@ -703,12 +683,12 @@ MVector MvMean(const MVector& mv1, const MVector& mv2)
//! Return the mean of a set of unsigned integer values
unsigned int GetUMean(std::vector<unsigned int>& values)
{
- unsigned int sum = 0;
- for(unsigned int I = 0; I < values.size(); ++I)
- sum += values[I];
+ unsigned int sum=0;
+ for (unsigned int I=0;I<values.size();++I)
+ sum+=values[I];
- sum += (values.size() >> 1);
- sum /= values.size();
+ sum+=(values.size()>>1);
+ sum/=values.size();
return sum;
}
@@ -716,23 +696,23 @@ unsigned int GetUMean(std::vector<unsigned int>& values)
//! Return the mean of a set of signed integer values
int GetSMean(std::vector<int>& values)
{
- if(values.size() == 0)
+ if (values.size()==0)
return 0;
- int sum = 0;
- for(unsigned int i = 0; i < values.size(); ++i)
- sum += values[i];
- if(sum >= 0)
+ int sum=0;
+ for (unsigned int i=0;i<values.size();++i)
+ sum+=values[i];
+ if ( sum>=0 )
{
- sum += (values.size() >> 1);
- sum /= values.size();
+ sum+=(values.size()>>1);
+ sum/=values.size();
}
else
{
int old_sum = sum;
- sum -= values.size() * old_sum;
- sum += (values.size() >> 1);
- sum /= values.size();
+ sum -= values.size()*old_sum;
+ sum+=(values.size()>>1);
+ sum/=values.size();
sum += old_sum;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.h
index db402cef1..a985bdbd7 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/motion.h
@@ -44,499 +44,404 @@
namespace dirac
{
-////////////////////////////////////////////////////////////////
-//classes and functions for motion estimation and compensation//
-////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////
+ //classes and functions for motion estimation and compensation//
+ ////////////////////////////////////////////////////////////////
-//classes
+ //classes
-//! Horizontal or vertical
-enum MvElement { HORIZONTAL , VERTICAL };
+ //! Horizontal or vertical
+ enum MvElement { HORIZONTAL , VERTICAL };
-//! Motion vector class - just a pair
-template <class T>
-class MotionVector
-{
-public:
+ //! Motion vector class - just a pair
+ template <class T>
+ class MotionVector
+ {
+ public:
- //! Constructor
- MotionVector<T>(T a, T b) : x(a), y(b) {};
- //! Default construct - sets components to 0
- MotionVector<T>() : x(0), y(0) {};
- //! Constructor
- MotionVector<T>(T a) : x(a), y(a) {};
+ //! Constructor
+ MotionVector<T>(T a, T b) : x(a), y(b) {};
+ //! Default construct - sets components to 0
+ MotionVector<T>() : x(0), y(0) {};
+ //! Constructor
+ MotionVector<T>(T a) : x(a), y(a) {};
- //! Addition
- inline MotionVector<T> operator+(const MotionVector<T>& argument) const;
+ //! Addition
+ inline MotionVector<T> operator+(const MotionVector<T>& argument) const;
- //! Subtraction
- inline MotionVector<T> operator-(const MotionVector<T>& argument) const;
+ //! Subtraction
+ inline MotionVector<T> operator-(const MotionVector<T>& argument) const;
- //! Scalar multiplication
- inline MotionVector<T> operator*(const float argument) const;
+ //! Scalar multiplication
+ inline MotionVector<T> operator*(const float argument) const;
- //! Scalar multiplication
- inline MotionVector<T> operator*(const int argument) const;
+ //! Scalar multiplication
+ inline MotionVector<T> operator*(const int argument) const;
- //! Bitshift of each component
- inline MotionVector<T> operator<<(const int argument) const;
+ //! Bitshift of each component
+ inline MotionVector<T> operator<<(const int argument) const;
- //! Bitshift of each component
- inline MotionVector<T> operator>>(const int argument) const;
+ //! Bitshift of each component
+ inline MotionVector<T> operator>>(const int argument) const;
+
+ //! Array-style element access
+ T& operator[](const int pos){return ( ( pos==0) ? x : y );}
- //! Array-style element access
- T& operator[](const int pos)
- {
- return ((pos == 0) ? x : y);
- }
-
- //! Array-style element access.
- const T& operator[](const int pos) const
- {
- return ((pos == 0) ? x : y);
- }
+ //! Array-style element access.
+ const T& operator[](const int pos) const {return ( ( pos==0) ? x : y );}
- //! x and y components
- T x, y;
+ //! x and y components
+ T x,y;
-};
+ };
-template <class T>
-inline MotionVector<T> MotionVector<T>::operator+(const MotionVector<T>& argument) const
-{
- MotionVector<T> temp;
- temp.x = x + argument.x;
- temp.y = y + argument.y;
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator+(const MotionVector<T>& argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x + argument.x;
+ temp.y = y + argument.y;
- return temp;
-}
+ return temp;
+ }
-template <class T>
-inline MotionVector<T> MotionVector<T>::operator-(const MotionVector<T>& argument) const
-{
- MotionVector<T> temp;
- temp.x = x - argument.x;
- temp.y = y - argument.y;
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator-(const MotionVector<T>& argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x-argument.x;
+ temp.y = y-argument.y;
- return temp;
-}
+ return temp;
+ }
-template <class T>
-inline MotionVector<T> MotionVector<T>::operator*(const float argument) const
-{
- MotionVector<T> temp;
- temp.x = x * argument;
- temp.y = y * argument;
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator*(const float argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x*argument;
+ temp.y = y*argument;
- return temp;
-}
+ return temp;
+ }
-template <class T>
-inline MotionVector<T> MotionVector<T>::operator*(const int argument) const
-{
- MotionVector<T> temp;
- temp.x = x * argument;
- temp.y = y * argument;
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator*(const int argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x*argument;
+ temp.y = y*argument;
- return temp;
-}
+ return temp;
+ }
-template <class T>
-inline MotionVector<T> MotionVector<T>::operator<<(const int argument) const
-{
- MotionVector<T> temp;
- temp.x = x << argument;
- temp.y = y << argument;
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator<<(const int argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x<<argument;
+ temp.y = y<<argument;
- return temp;
-}
+ return temp;
+ }
-template <class T>
-inline MotionVector<T> MotionVector<T>::operator>>(const int argument) const
-{
- MotionVector<T> temp;
- temp.x = x >> argument;
- temp.y = y >> argument;
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator>>(const int argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x>>argument;
+ temp.y = y>>argument;
- return temp;
-}
+ return temp;
+ }
-//! Overloaded operator<< for MotionVector class for output to stream
-template <class T>
-std::ostream & operator<< (std::ostream & stream, MotionVector<T> & mv)
-{
- stream << mv.x << " " << mv.y;
+ //! Overloaded operator<< for MotionVector class for output to stream
+ template <class T>
+ std::ostream & operator<< (std::ostream & stream, MotionVector<T> & mv)
+ {
+ stream << mv.x << " " << mv.y;
- return stream;
-}
+ return stream;
+ }
-//! Overloaded operator>> for MotionVector class for input from stream
-template <class T>
-std::istream & operator>> (std::istream & stream, MotionVector<T> & mv)
-{
- stream >> mv.x;
- stream >> mv.y;
+ //! Overloaded operator>> for MotionVector class for input from stream
+ template <class T>
+ std::istream & operator>> (std::istream & stream, MotionVector<T> & mv)
+ {
+ stream >> mv.x;
+ stream >> mv.y;
- return stream;
-}
+ return stream;
+ }
-//! MVector class is a vector of ints
-typedef MotionVector<int> MVector;
+ //! MVector class is a vector of ints
+ typedef MotionVector<int> MVector;
-//! ImageCoords class is a vector of ints
-typedef MotionVector<int> ImageCoords;
+ //! ImageCoords class is a vector of ints
+ typedef MotionVector<int> ImageCoords;
-//! MvArray is a two-D array of MVectors
-typedef TwoDArray<MVector> MvArray;
+ //! MvArray is a two-D array of MVectors
+ typedef TwoDArray<MVector> MvArray;
-//! An array of float-based motion vectors for doing global motion calcs
-typedef TwoDArray< MotionVector<float> > MvFloatArray;
+ //! An array of float-based motion vectors for doing global motion calcs
+ typedef TwoDArray< MotionVector<float> > MvFloatArray;
-//! Class for recording costs derived in motion estimation
-class MvCostData
-{
-public:
- //! Constructor
- MvCostData():
+ //! Class for recording costs derived in motion estimation
+ class MvCostData
+ {
+ public:
+ //! Constructor
+ MvCostData():
SAD(0.0),
mvcost(0.0),
- total(0.0) {}
+ total(0.0){}
- void SetTotal(const float lambda)
- {
- total = SAD + lambda * mvcost;
- }
+ void SetTotal( const float lambda ){total = SAD + lambda*mvcost;}
- //! The Sum of Absolute Differences - easier to compute than Sum-Squared Differences
- float SAD;
+ //! The Sum of Absolute Differences - easier to compute than Sum-Squared Differences
+ float SAD;
- //! The (Lagrangian-weighted) motion vector cost - the difference of a motion vector from its neighbouring vectors
- float mvcost;
+ //! The (Lagrangian-weighted) motion vector cost - the difference of a motion vector from its neighbouring vectors
+ float mvcost;
- //! Total=SAD+mvcost
- float total;
-};
+ //! Total=SAD+mvcost
+ float total;
+ };
-//! Class for all the motion vector data
-/*!
- Motion vector data: the motion vectors themselves, the blocks
- and macroblock modes.
-*/
-class MvData
-{
-public:
- //! Constructor
+ //! Class for all the motion vector data
/*!
- Constructor takes:
- \param predparams Picture prediction parameters
- \param num_refs the number of references being used for the picture
+ Motion vector data: the motion vectors themselves, the blocks
+ and macroblock modes.
*/
- MvData(const PicturePredParams& predparams , const int num_refs);
+ class MvData
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor takes:
+ \param predparams Picture prediction parameters
+ \param num_refs the number of references being used for the picture
+ */
+ MvData( const PicturePredParams& predparams , const int num_refs);
- //! Destructor
- ~MvData();
+ //! Destructor
+ ~MvData();
- //! Return a reference to the local picture prediction params
- PicturePredParams& GetPicPredParams()
- {
- return m_predparams;
- }
+ //! Return a reference to the local picture prediction params
+ PicturePredParams& GetPicPredParams(){return m_predparams;}
- //! Return a reference to the local picture prediction params
- const PicturePredParams& GetPicPredParams() const
- {
- return m_predparams;
- }
+ //! Return a reference to the local picture prediction params
+ const PicturePredParams& GetPicPredParams() const{return m_predparams;}
- //! Get the MVs for a reference
- MvArray& Vectors(const int ref_id)
- {
- return *(m_vectors[ref_id]);
- }
+ //! Get the MVs for a reference
+ MvArray& Vectors(const int ref_id){return *( m_vectors[ref_id] );}
- //! Get the MVs for a reference
- const MvArray& Vectors(const int ref_id) const
- {
- return *(m_vectors[ref_id]);
- }
+ //! Get the MVs for a reference
+ const MvArray& Vectors(const int ref_id) const {return *( m_vectors[ref_id] );}
- //! Get the global MVs for a reference
- MvArray& GlobalMotionVectors(const int ref_id)
- {
- return *(m_gm_vectors[ref_id]);
- }
+ //! Get the global MVs for a reference
+ MvArray& GlobalMotionVectors(const int ref_id){return *( m_gm_vectors[ref_id] );}
- //! Get the global MVs for a reference
- const MvArray& GlobalMotionVectors(const int ref_id) const
- {
- return *(m_gm_vectors[ref_id]);
- }
+ //! Get the global MVs for a reference
+ const MvArray& GlobalMotionVectors(const int ref_id) const {return *( m_gm_vectors[ref_id] );}
- //! Get the DC values for each component
- TwoDArray<ValueType>& DC(CompSort cs)
- {
- return *(m_dc[cs]);
- }
+ //! Get the DC values for each component
+ TwoDArray<ValueType>& DC(CompSort cs){return *( m_dc[cs] );}
- //! Get the DC values for each component
- const TwoDArray<ValueType>& DC(CompSort cs) const
- {
- return *(m_dc[cs]);
- }
+ //! Get the DC values for each component
+ const TwoDArray<ValueType>& DC(CompSort cs) const {return *( m_dc[cs] );}
- //! Get a reference to the vector holding component DC values
- const OneDArray< TwoDArray<ValueType>* >& DC() const
- {
- return m_dc;
- }
+ //! Get a reference to the vector holding component DC values
+ const OneDArray< TwoDArray<ValueType>* >& DC() const {return m_dc;}
- //! Get the block prediction modes
- TwoDArray<PredMode>& Mode()
- {
- return m_modes;
- }
+ //! Get the block prediction modes
+ TwoDArray<PredMode>& Mode(){return m_modes;}
- //! Get the block prediction modes
- const TwoDArray<PredMode>& Mode() const
- {
- return m_modes;
- }
+ //! Get the block prediction modes
+ const TwoDArray<PredMode>& Mode() const {return m_modes;}
- //! Get the SB split level
- TwoDArray<int>& SBSplit()
- {
- return m_sb_split;
- }
+ //! Get the SB split level
+ TwoDArray<int>& SBSplit(){return m_sb_split;}
- //! Get the SB split level
- const TwoDArray<int>& SBSplit() const
- {
- return m_sb_split;
- }
+ //! Get the SB split level
+ const TwoDArray<int>& SBSplit() const{return m_sb_split;}
- //! Get the global motion model parameters
- OneDArray<float>& GlobalMotionParameters(const int ref_id)
- {
- return *(m_gm_params[ref_id]);
- }
+ //! Get the global motion model parameters
+ OneDArray<float>& GlobalMotionParameters(const int ref_id) { return *( m_gm_params[ref_id] ); }
- //! Get the global motion model parameters
- const OneDArray<float>& GlobalMotionParameters(const int ref_id) const
- {
- return *(m_gm_params[ref_id]);
- }
+ //! Get the global motion model parameters
+ const OneDArray<float>& GlobalMotionParameters(const int ref_id) const { return *( m_gm_params[ref_id] ); }
-protected:
- // A local copy of the picture prediction parameters
- PicturePredParams m_predparams;
+ protected:
+ // A local copy of the picture prediction parameters
+ PicturePredParams m_predparams;
- // Initialises the arrays of data
- void InitMvData();
+ // Initialises the arrays of data
+ void InitMvData();
- // The motion vectors
- OneDArray<MvArray*> m_vectors;
+ // The motion vectors
+ OneDArray<MvArray*> m_vectors;
- // The global motion vectors
- OneDArray<MvArray*> m_gm_vectors;
+ // The global motion vectors
+ OneDArray<MvArray*> m_gm_vectors;
- // The block modes
- TwoDArray<PredMode> m_modes;
+ // The block modes
+ TwoDArray<PredMode> m_modes;
- // The DC values
- OneDArray< TwoDArray<ValueType>* > m_dc;
+ // The DC values
+ OneDArray< TwoDArray<ValueType>* > m_dc;
- // The SB split levels
- TwoDArray<int> m_sb_split;
+ // The SB split levels
+ TwoDArray<int> m_sb_split;
- // Global motion model parameters
- OneDArray< OneDArray<float>* > m_gm_params;
+ // Global motion model parameters
+ OneDArray< OneDArray<float>* > m_gm_params;
// // Number of reference frames
// unsigned int m_num_refs;
-};
-
-//! Class for all the motion estimation data
-/*!
- Motion estimation data: derived from MvData class, also
- incorporates costs for blocks and macroblocks
-*/
-
-class MEData: public MvData
-{
-public:
+ };
- //! Constructor
+ //! Class for all the motion estimation data
/*!
- Constructor takes:
- \param predparams the picture prediction parameters
- \param num_refs the number of references being used for the picture
+ Motion estimation data: derived from MvData class, also
+ incorporates costs for blocks and macroblocks
*/
- MEData(const PicturePredParams& predparams , const int num_refs = 2);
- //! Destructor
- ~MEData();
-
- //! drop the data relating to one reference
- void DropRef(int ref_index);
-
- //! Get the block cost structures for each reference
- TwoDArray<MvCostData>& PredCosts(const int ref_id)
+ class MEData: public MvData
{
- return *(m_pred_costs[ref_id]);
- }
+ public:
- //! Get the block cost structures for each reference
- const TwoDArray<MvCostData>& PredCosts(const int ref_id) const
- {
- return *(m_pred_costs[ref_id]);
- }
+ //! Constructor
+ /*!
+ Constructor takes:
+ \param predparams the picture prediction parameters
+ \param num_refs the number of references being used for the picture
+ */
+ MEData( const PicturePredParams& predparams , const int num_refs = 2);
- //! Get the intra costs
- TwoDArray<float>& IntraCosts()
- {
- return m_intra_costs;
- }
+ //! Destructor
+ ~MEData();
+
+ //! drop the data relating to one reference
+ void DropRef( int ref_index );
- //! Get the intra costs
- const TwoDArray<float>& IntraCosts() const
- {
- return m_intra_costs;
- }
+ //! Get the block cost structures for each reference
+ TwoDArray<MvCostData>& PredCosts(const int ref_id){ return *( m_pred_costs[ref_id] ); }
- //! Get the bipred costs
- TwoDArray<MvCostData>& BiPredCosts()
- {
- return m_bipred_costs;
- }
+ //! Get the block cost structures for each reference
+ const TwoDArray<MvCostData>& PredCosts(const int ref_id) const { return *( m_pred_costs[ref_id] ); }
- //! Get the bipred costs
- const TwoDArray<MvCostData>& BiPredCosts() const
- {
- return m_bipred_costs;
- }
+ //! Get the intra costs
+ TwoDArray<float>& IntraCosts(){ return m_intra_costs; }
- //! Get the SB costs
- TwoDArray<float>& SBCosts()
- {
- return m_SB_costs;
- }
+ //! Get the intra costs
+ const TwoDArray<float>& IntraCosts() const { return m_intra_costs; }
- //! Get the SB costs
- const TwoDArray<float>& SBCosts() const
- {
- return m_SB_costs;
- }
+ //! Get the bipred costs
+ TwoDArray<MvCostData>& BiPredCosts(){ return m_bipred_costs; }
- //! Get the proportion of intra blocks
- float IntraBlockRatio() const
- {
- return m_intra_block_ratio;
- }
+ //! Get the bipred costs
+ const TwoDArray<MvCostData>& BiPredCosts() const { return m_bipred_costs; }
- //! Set the intra block ratio
- void SetIntraBlockRatio(const float r)
- {
- m_intra_block_ratio = r;
- }
+ //! Get the SB costs
+ TwoDArray<float>& SBCosts(){ return m_SB_costs; }
- //! Set up the lambda map by detecting motion discontinuities
- void SetLambdaMap(const int num_refs , const float lambda);
+ //! Get the SB costs
+ const TwoDArray<float>& SBCosts() const { return m_SB_costs; }
- //! Set up the lambda map by averaging the lambda map from a lower level
- void SetLambdaMap(const int level , const TwoDArray<float>& l_map , const float wt);
+ //! Get the proportion of intra blocks
+ float IntraBlockRatio() const {return m_intra_block_ratio; }
- //! Get a lambda value for a given block and level
- const TwoDArray<float>& LambdaMap() const
- {
- return m_lambda_map;
- }
+ //! Set the intra block ratio
+ void SetIntraBlockRatio(const float r){ m_intra_block_ratio = r; }
- //! Get the inliers for each reference
- TwoDArray<int>& GlobalMotionInliers(const int ref_id)
- {
- return *(m_inliers[ref_id]);
- }
+ //! Set up the lambda map by detecting motion discontinuities
+ void SetLambdaMap( const int num_refs , const float lambda );
- //! Get the inliers for each reference
- const TwoDArray<int>& GlobalMotionInliers(const int ref_id) const
- {
- return *(m_inliers[ref_id]);
- }
+ //! Set up the lambda map by averaging the lambda map from a lower level
+ void SetLambdaMap( const int level , const TwoDArray<float>& l_map , const float wt );
- //! Overloaded operator<< for outputing to (file) stream
- friend std::ostream &operator<< (std::ostream & stream, MEData & me_data);
+ //! Get a lambda value for a given block and level
+ const TwoDArray<float>& LambdaMap() const { return m_lambda_map; }
- //! Overloaded operator>> for input of data from (file) stream
- friend std::istream &operator>> (std::istream & stream, MEData & me_data);
+ //! Get the inliers for each reference
+ TwoDArray<int>& GlobalMotionInliers(const int ref_id){ return *( m_inliers[ref_id] ); }
-private:
- // Initialises the arrays of data
- void InitMEData();
+ //! Get the inliers for each reference
+ const TwoDArray<int>& GlobalMotionInliers(const int ref_id) const { return *( m_inliers[ref_id] ); }
- // Finds transitions in the motion vectors
- void FindTransitions(TwoDArray<bool>& trans_map , const int ref_num);
+ //! Overloaded operator<< for outputing to (file) stream
+ friend std::ostream &operator<< (std::ostream & stream, MEData & me_data);
- // The costs of predicting each block, for each reference
- OneDArray< TwoDArray<MvCostData>* > m_pred_costs;
+ //! Overloaded operator>> for input of data from (file) stream
+ friend std::istream &operator>> (std::istream & stream, MEData & me_data);
- // The costs of predicting each block by DC
- TwoDArray<float> m_intra_costs;
+ private:
+ // Initialises the arrays of data
+ void InitMEData();
- // The costs of predicting each block bidirectionally
- TwoDArray<MvCostData> m_bipred_costs;
+ // Finds transitions in the motion vectors
+ void FindTransitions( TwoDArray<bool>& trans_map , const int ref_num );
- // The costs for each macroblock as a whole
- TwoDArray<float> m_SB_costs;
+ // The costs of predicting each block, for each reference
+ OneDArray< TwoDArray<MvCostData>* > m_pred_costs;
- // A map of the lambda values to use
- TwoDArray<float> m_lambda_map;
+ // The costs of predicting each block by DC
+ TwoDArray<float> m_intra_costs;
- // Global motion inliers
- OneDArray< TwoDArray<int>* > m_inliers;
+ // The costs of predicting each block bidirectionally
+ TwoDArray<MvCostData> m_bipred_costs;
- // Intra block ratio
- float m_intra_block_ratio;
+ // The costs for each macroblock as a whole
+ TwoDArray<float> m_SB_costs;
-};
+ // A map of the lambda values to use
+ TwoDArray<float> m_lambda_map;
-//motion estimation and coding stuff
+ // Global motion inliers
+ OneDArray< TwoDArray<int>* > m_inliers;
-//! Return the median of 3 integers
-int Median(const int val1, const int val2, const int val3);
+ // Intra block ratio
+ float m_intra_block_ratio;
-//! Return the median of three motion vectors
-MVector MvMedian(const MVector& mv1, const MVector& mv2, const MVector& mv3);
+ };
+ //motion estimation and coding stuff
+
+ //! Return the median of 3 integers
+ int Median( const int val1, const int val2, const int val3);
-//! Return the median of a set of integers
-int Median(const std::vector<int>& val_list);
+ //! Return the median of three motion vectors
+ MVector MvMedian(const MVector& mv1,const MVector& mv2,const MVector& mv3);
-//! Return the median of a set of (up to 4) motion vectors
-MVector MvMedian(const std::vector<MVector>& vect_list);
-//! Return the mean of two motion vectors
-MVector MvMean(const MVector& mv1, const MVector& mv2);
+ //! Return the median of a set of integers
+ int Median(const std::vector<int>& val_list);
-//! Return the squared length of a motion vector
-inline int Norm2(const MVector& mv) //L^2 norm of a motion vector
-{
- return mv.x * mv.x + mv.y * mv.y;
-}
+ //! Return the median of a set of (up to 4) motion vectors
+ MVector MvMedian(const std::vector<MVector>& vect_list);
-//! Return the sum of the lengths of a motion vector's componets
-inline int Norm1(const MVector& mv) //L^1 norm of a motion vector
-{
- return abs(mv.x) + abs(mv.y);
-}
+ //! Return the mean of two motion vectors
+ MVector MvMean(const MVector& mv1, const MVector& mv2);
-//! Return the mean of a set of unsigned integer values
-unsigned int GetUMean(std::vector<unsigned int>& values);
+ //! Return the squared length of a motion vector
+ inline int Norm2(const MVector& mv){//L^2 norm of a motion vector
+ return mv.x*mv.x+mv.y*mv.y;
+ }
-//! Return the mean of a set of signed integer values
-int GetSMean(std::vector<int>& values);
+ //! Return the sum of the lengths of a motion vector's componets
+ inline int Norm1(const MVector& mv){//L^1 norm of a motion vector
+ return abs(mv.x)+abs(mv.y);
+ }
+
+ //! Return the mean of a set of unsigned integer values
+ unsigned int GetUMean(std::vector<unsigned int>& values);
+
+ //! Return the mean of a set of signed integer values
+ int GetSMean(std::vector<int>& values);
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.cpp
index 6de2418dd..d576d6e12 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.cpp
@@ -45,42 +45,42 @@ using namespace dirac;
//public functions//
////////////////////
-// Constructor
+// Constructor
SplitModeCodec::SplitModeCodec(ByteIO* p_byteio,
- size_t number_of_contexts)
- : ArithCodec <MvData> (p_byteio, number_of_contexts)
-{}
+ size_t number_of_contexts)
+ : ArithCodec <MvData> (p_byteio,number_of_contexts)
+{}
-void SplitModeCodec::InitContexts()
-{
+void SplitModeCodec::InitContexts()
+{
}
// Main code function
-void SplitModeCodec::DoWorkCode(MvData& in_data)
+void SplitModeCodec::DoWorkCode( MvData& in_data )
{
- for(m_sb_yp = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp)
+ for (m_sb_yp = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp)
{
- for(m_sb_xp = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp)
+ for (m_sb_xp = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp)
{
CodeVal(in_data);
}//m_sb_xp
}//m_sb_yp
-}
+}
// Main decode function
-void SplitModeCodec::DoWorkDecode(MvData& out_data)
+void SplitModeCodec::DoWorkDecode( MvData& out_data)
{
- for(m_sb_yp = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp)
+ for (m_sb_yp = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp)
{
- for(m_sb_xp = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp)
+ for (m_sb_xp = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp)
{
- DecodeVal(out_data);
+ DecodeVal( out_data );
}//m_sb_xp
}//m_sb_yp
-}
+}
//protected functions//
///////////////////////
@@ -94,34 +94,34 @@ void SplitModeCodec::ResetAll()
//prediction functions
-unsigned int SplitModeCodec::Prediction(const TwoDArray<int> & split_data) const
-{
+unsigned int SplitModeCodec::Prediction(const TwoDArray<int> & split_data ) const
+{
int result = 0;
-
+
std::vector < unsigned int > nbrs;
-
- if(m_sb_xp > 0 && m_sb_yp > 0)
+
+ if (m_sb_xp > 0 && m_sb_yp > 0)
{
- nbrs.push_back(split_data[m_sb_yp-1][m_sb_xp]);
- nbrs.push_back(split_data[m_sb_yp-1][m_sb_xp-1]);
- nbrs.push_back(split_data[m_sb_yp][m_sb_xp-1]);
+ nbrs.push_back( split_data[m_sb_yp-1][m_sb_xp] );
+ nbrs.push_back( split_data[m_sb_yp-1][m_sb_xp-1] );
+ nbrs.push_back( split_data[m_sb_yp][m_sb_xp-1] );
- result = GetUMean(nbrs);
+ result = GetUMean(nbrs);
}
- else if(m_sb_xp > 0 && m_sb_yp == 0)
- result = split_data[m_sb_yp][m_sb_xp-1];
- else if(m_sb_xp == 0 && m_sb_yp > 0)
- result = split_data[m_sb_yp-1][m_sb_xp];
+ else if (m_sb_xp > 0 && m_sb_yp == 0)
+ result = split_data[m_sb_yp][m_sb_xp-1];
+ else if (m_sb_xp == 0 && m_sb_yp > 0)
+ result = split_data[m_sb_yp-1][m_sb_xp];
- return result;
+ return result;
}
void SplitModeCodec::CodeVal(const MvData& in_data)
{
- int val = in_data.SBSplit()[m_sb_yp][m_sb_xp] - Prediction(in_data.SBSplit());
-
- if(val < 0) val += 3; //produce prediction mod 3
+ int val = in_data.SBSplit()[m_sb_yp][m_sb_xp] - Prediction( in_data.SBSplit() );
+
+ if (val < 0) val+=3; //produce prediction mod 3
EncodeUInt(val, SB_SPLIT_BIN1_CTX, SB_SPLIT_BIN2_CTX);
}
@@ -134,96 +134,96 @@ void SplitModeCodec::CodeVal(const MvData& in_data)
void SplitModeCodec::DecodeVal(MvData& out_data)
{
out_data.SBSplit()[m_sb_yp][m_sb_xp] =
- (DecodeUInt(SB_SPLIT_BIN1_CTX, SB_SPLIT_BIN2_CTX) +
- Prediction(out_data.SBSplit())) % 3;
+ (DecodeUInt(SB_SPLIT_BIN1_CTX, SB_SPLIT_BIN2_CTX) +
+ Prediction(out_data.SBSplit())) % 3;
}
/******************************************************************************/
//public functions//
////////////////////
-// Constructor
+// Constructor
PredModeCodec::PredModeCodec(ByteIO* p_byteio,
- size_t number_of_contexts,
- int num_refs)
- : ArithCodec <MvData> (p_byteio, number_of_contexts),
- m_num_refs(num_refs)
-{}
+ size_t number_of_contexts,
+ int num_refs)
+ : ArithCodec <MvData> (p_byteio,number_of_contexts),
+ m_num_refs(num_refs)
+{}
-void PredModeCodec::InitContexts()
-{
+void PredModeCodec::InitContexts()
+{
}
// Main code function
-void PredModeCodec::DoWorkCode(MvData& in_data)
+void PredModeCodec::DoWorkCode( MvData& in_data )
{
- int step, max;
- int split_depth;
+ int step,max;
+ int split_depth;
- for(m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
+ for (m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
{
- for(m_sb_xp = 0, m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp, m_sb_tlb_x += 4)
+ for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
{
- split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
+ split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
- step = 4 >> (split_depth);
- max = (1 << split_depth);
-
- //now do all the block modes and mvs in the mb
- for(m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y + 4; m_b_yp += step)
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
+
+ //now do all the block modes and mvs in the mb
+ for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
{
- for(m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x + 4; m_b_xp += step)
+ for (m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x+4; m_b_xp += step)
{
CodeVal(in_data);
}//m_b_xp
- }//m_b_yp
-
+ }//m_b_yp
+
}//m_sb_xp
- }//m_sb_yp
-}
+ }//m_sb_yp
+}
// Main decode function
-void PredModeCodec::DoWorkDecode(MvData& out_data)
+void PredModeCodec::DoWorkDecode( MvData& out_data)
{
- int step, max;
- int split_depth;
- int xstart, ystart;
+ int step,max;
+ int split_depth;
+ int xstart,ystart;
// Then the prediction mode
- for(m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
+ for (m_sb_yp = 0,m_sb_tlb_y = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp,m_sb_tlb_y += 4)
{
- for(m_sb_xp = 0, m_sb_tlb_x = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp, m_sb_tlb_x += 4)
+ for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
{
- split_depth = out_data.SBSplit()[m_sb_yp][m_sb_xp];
- step = 4 >> (split_depth);
- max = (1 << split_depth);
+ split_depth = out_data.SBSplit()[m_sb_yp][m_sb_xp];
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
//now do all the block mvs in the mb
- for(int j = 0; j < max; ++j)
- {
- for(int i = 0; i < max; ++i)
+ for (int j = 0; j < max; ++j)
+ {
+ for (int i = 0; i < max; ++i)
{
- xstart = m_b_xp = m_sb_tlb_x + i * step;
- ystart = m_b_yp = m_sb_tlb_y + j * step;
-
- DecodeVal(out_data);
+ xstart = m_b_xp = m_sb_tlb_x + i * step;
+ ystart = m_b_yp = m_sb_tlb_y + j * step;
+
+ DecodeVal(out_data);
- // propagate throughout SB
- for(m_b_yp = ystart; m_b_yp < ystart + step; m_b_yp++)
+ // propagate throughout SB
+ for (m_b_yp = ystart; m_b_yp < ystart+step; m_b_yp++)
{
- for(m_b_xp = xstart; m_b_xp < xstart + step; m_b_xp++)
- {
- out_data.Mode()[m_b_yp][m_b_xp] = out_data.Mode()[ystart][xstart];
+ for (m_b_xp = xstart; m_b_xp < xstart+step; m_b_xp++)
+ {
+ out_data.Mode()[m_b_yp][m_b_xp] = out_data.Mode()[ystart][xstart];
}//m_b_xp
}//m_b_yp
- }//i
+ }//i
}//j
}//m_sb_xp
}//m_sb_yp
-}
+}
//protected functions//
///////////////////////
@@ -240,30 +240,30 @@ void PredModeCodec::ResetAll()
unsigned int PredModeCodec::Prediction(const TwoDArray < PredMode > & preddata) const
{
unsigned int result = (unsigned int)(INTRA);
- unsigned int num_ref1_nbrs(0);
- unsigned int num_ref2_nbrs(0);
-
- if(m_b_xp > 0 && m_b_yp > 0)
+ unsigned int num_ref1_nbrs( 0 );
+ unsigned int num_ref2_nbrs( 0 );
+
+ if (m_b_xp > 0 && m_b_yp > 0)
{
- num_ref1_nbrs += ((unsigned int)(preddata[m_b_yp-1][m_b_xp])) & 1;
- num_ref1_nbrs += ((unsigned int)(preddata[m_b_yp-1][m_b_xp-1])) & 1;
- num_ref1_nbrs += ((unsigned int)(preddata[m_b_yp][m_b_xp-1])) & 1;
+ num_ref1_nbrs += ((unsigned int)( preddata[m_b_yp-1][m_b_xp] ) ) & 1;
+ num_ref1_nbrs += ((unsigned int)( preddata[m_b_yp-1][m_b_xp-1] ) ) & 1;
+ num_ref1_nbrs += ((unsigned int)( preddata[m_b_yp][m_b_xp-1] ) ) & 1;
- result = num_ref1_nbrs >> 1;
+ result = num_ref1_nbrs>>1;
- if(m_num_refs == 2)
+ if ( m_num_refs==2)
{
- num_ref2_nbrs += ((unsigned int)(preddata[m_b_yp-1][m_b_xp])) & 2;
- num_ref2_nbrs += ((unsigned int)(preddata[m_b_yp-1][m_b_xp-1])) & 2;
- num_ref2_nbrs += ((unsigned int)(preddata[m_b_yp][m_b_xp-1])) & 2;
+ num_ref2_nbrs += ((unsigned int)( preddata[m_b_yp-1][m_b_xp] ) ) & 2;
+ num_ref2_nbrs += ((unsigned int)( preddata[m_b_yp-1][m_b_xp-1] ) ) & 2;
+ num_ref2_nbrs += ((unsigned int)( preddata[m_b_yp][m_b_xp-1] ) ) & 2;
num_ref2_nbrs >>= 1;
- result ^= ((num_ref2_nbrs >> 1) << 1);
+ result ^= ( (num_ref2_nbrs>>1)<<1 );
}
}
- else if(m_b_xp > 0 && m_b_yp == 0)
- result = (unsigned int)(preddata[0][m_b_xp-1]);
- else if(m_b_xp == 0 && m_b_yp > 0)
- result = (unsigned int)(preddata[m_b_yp-1][0]);
+ else if (m_b_xp > 0 && m_b_yp == 0)
+ result = (unsigned int)( preddata[0][m_b_xp-1] );
+ else if (m_b_xp == 0 && m_b_yp > 0)
+ result = (unsigned int)( preddata[m_b_yp-1][0] );
return result;
}
@@ -273,15 +273,15 @@ void PredModeCodec::CodeVal(const MvData& in_data)
// Xor with the prediction so we predict whether REF1 is used or REF2 is
// used, separately
unsigned int residue = in_data.Mode()[m_b_yp][m_b_xp] ^
- Prediction(in_data.Mode());
+ Prediction( in_data.Mode() );
// Code REF1 part of the prediction residue (ie the first bit)
- EncodeSymbol(residue & 1 , PMODE_BIT0_CTX);
+ EncodeSymbol( residue & 1 , PMODE_BIT0_CTX );
// Code REF2 part of the prediction residue (ie the second bit)
- if(m_num_refs == 2)
+ if (m_num_refs==2)
{
- EncodeSymbol(residue & 2 , PMODE_BIT1_CTX);
+ EncodeSymbol( residue & 2 , PMODE_BIT1_CTX );
}
}
@@ -289,7 +289,7 @@ void PredModeCodec::CodeVal(const MvData& in_data)
//decoding functions//
//////////////////////
-void PredModeCodec::DecodeVal(MvData& out_data)
+void PredModeCodec::DecodeVal( MvData& out_data )
{
// Xor with the prediction so we predict whether REF1 is used or REF2 is
// used, separately
@@ -297,18 +297,18 @@ void PredModeCodec::DecodeVal(MvData& out_data)
// Decode REF1 part of the prediction residue (ie the first bit)
bool bit;
- bit = DecodeSymbol(PMODE_BIT0_CTX);
+ bit = DecodeSymbol( PMODE_BIT0_CTX );
residue = (unsigned int) bit;
// Decode REF2 part of the prediction residue (ie the second bit)
- if(m_num_refs == 2)
+ if (m_num_refs==2)
{
- bit = DecodeSymbol(PMODE_BIT1_CTX);
- residue |= ((unsigned int) bit) << 1;
+ bit = DecodeSymbol( PMODE_BIT1_CTX );
+ residue |= ( (unsigned int) bit ) << 1;
}
out_data.Mode()[m_b_yp][m_b_xp] =
- PredMode(Prediction(out_data.Mode()) ^ residue);
+ PredMode( Prediction( out_data.Mode() ) ^ residue );
}
/******************************************************************************/
@@ -321,9 +321,9 @@ VectorElementCodec::VectorElementCodec(ByteIO* p_byteio,
int ref_id,
MvElement horvert,
size_t number_of_contexts)
- : ArithCodec <MvData> (p_byteio, number_of_contexts),
- m_ref(ref_id),
- m_hv(horvert)
+ : ArithCodec <MvData> (p_byteio,number_of_contexts),
+ m_ref(ref_id),
+ m_hv(horvert)
{}
@@ -332,80 +332,80 @@ void VectorElementCodec::InitContexts()
{}
// Main code function
-void VectorElementCodec::DoWorkCode(MvData& in_data)
+void VectorElementCodec::DoWorkCode( MvData& in_data )
{
- int step, max;
+ int step,max;
int split_depth;
- for(m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
+ for (m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
{
- for(m_sb_xp = 0, m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp, m_sb_tlb_x += 4)
+ for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
{
split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
- step = 4 >> (split_depth);
+ step = 4 >> (split_depth);
max = (1 << split_depth);
-
- //now do all the block modes and mvs in the mb
- for(m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y + 4; m_b_yp += step)
+
+ //now do all the block modes and mvs in the mb
+ for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
{
- for(m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x + 4; m_b_xp += step)
+ for (m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x+4; m_b_xp += step)
{
- if(in_data.Mode()[m_b_yp][m_b_xp] & m_ref)
+ if ( in_data.Mode()[m_b_yp][m_b_xp] & m_ref )
{
CodeVal(in_data);
- }
+ }
}//m_b_xp
- }//m_b_yp
-
+ }//m_b_yp
+
}//m_sb_xp
}//m_sb_yp
-}
+}
// Main decode function
-void VectorElementCodec::DoWorkDecode(MvData& out_data)
+void VectorElementCodec::DoWorkDecode( MvData& out_data)
{
- int step, max;
- int split_depth;
- int xstart, ystart;
+ int step,max;
+ int split_depth;
+ int xstart,ystart;
- for(m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
+ for (m_sb_yp = 0,m_sb_tlb_y = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp,m_sb_tlb_y += 4)
{
- for(m_sb_xp = 0, m_sb_tlb_x = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp, m_sb_tlb_x += 4)
+ for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
{
- split_depth = out_data.SBSplit()[m_sb_yp][m_sb_xp];
- step = 4 >> (split_depth);
- max = (1 << split_depth);
+ split_depth = out_data.SBSplit()[m_sb_yp][m_sb_xp];
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
//now do all the block mvs in the mb
- for(int j = 0; j < max; ++j)
- {
- for(int i = 0; i < max; ++i)
+ for (int j = 0; j < max; ++j)
+ {
+ for (int i = 0; i < max; ++i)
{
- xstart = m_b_xp = m_sb_tlb_x + i * step;
- ystart = m_b_yp = m_sb_tlb_y + j * step;
-
- if(out_data.Mode()[m_b_yp][m_b_xp] & m_ref)
+ xstart = m_b_xp = m_sb_tlb_x + i * step;
+ ystart = m_b_yp = m_sb_tlb_y + j * step;
+
+ if (out_data.Mode()[m_b_yp][m_b_xp] & m_ref)
{
- DecodeVal(out_data);
+ DecodeVal( out_data );
}
-
- // propagate throughout SB
- for(m_b_yp = ystart; m_b_yp < ystart + step; m_b_yp++)
+
+ // propagate throughout SB
+ for (m_b_yp = ystart; m_b_yp < ystart+step; m_b_yp++)
{
- for(m_b_xp = xstart; m_b_xp < xstart + step; m_b_xp++)
- {
- out_data.Vectors(m_ref)[m_b_yp][m_b_xp][m_hv] =
- out_data.Vectors(m_ref)[ystart][xstart][m_hv];
+ for (m_b_xp = xstart; m_b_xp < xstart+step; m_b_xp++)
+ {
+ out_data.Vectors(m_ref)[m_b_yp][m_b_xp][m_hv] =
+ out_data.Vectors(m_ref)[ystart][xstart][m_hv];
}//m_b_xp
}//m_b_yp
- }//i
+ }//i
}//j
}//m_sb_xp
}//m_sb_yp
-}
+}
//protected functions//
///////////////////////
@@ -420,48 +420,48 @@ void VectorElementCodec::ResetAll()
//prediction functions
int VectorElementCodec::Prediction(const MvArray& mvarray,
- const TwoDArray < PredMode > & preddata) const
+ const TwoDArray < PredMode > & preddata) const
{
- std::vector <int> nbrs;
- PredMode pmode;
- int result(0);
-
- if(m_b_xp > 0 && m_b_yp > 0)
+ std::vector <int> nbrs;
+ PredMode pmode;
+ int result( 0 );
+
+ if (m_b_xp > 0 && m_b_yp > 0)
{
- pmode = preddata[m_b_yp-1][m_b_xp];
- if(pmode & m_ref)
- nbrs.push_back(mvarray[m_b_yp-1][m_b_xp][m_hv]);
-
- pmode = preddata[m_b_yp-1][m_b_xp-1];
- if(pmode & m_ref)
- nbrs.push_back(mvarray[m_b_yp-1][m_b_xp-1][m_hv]);
-
- pmode = preddata[m_b_yp][m_b_xp-1];
- if(pmode & m_ref)
+ pmode = preddata[m_b_yp-1][m_b_xp];
+ if (pmode & m_ref)
+ nbrs.push_back(mvarray[m_b_yp-1][m_b_xp][m_hv]);
+
+ pmode = preddata[m_b_yp-1][m_b_xp-1];
+ if (pmode & m_ref)
+ nbrs.push_back(mvarray[m_b_yp-1][m_b_xp-1][m_hv]);
+
+ pmode = preddata[m_b_yp][m_b_xp-1];
+ if (pmode & m_ref)
nbrs.push_back(mvarray[m_b_yp][m_b_xp-1][m_hv]);
-
- if(nbrs.size() > 0)
- result = Median(nbrs);
+
+ if (nbrs.size() > 0)
+ result = Median(nbrs);
}
- else if(m_b_xp > 0 && m_b_yp == 0)
+ else if (m_b_xp > 0 && m_b_yp == 0)
{
- pmode = preddata[0][m_b_xp-1];
- if(pmode & m_ref)
- result = mvarray[0][m_b_xp-1][m_hv];
+ pmode = preddata[0][m_b_xp-1];
+ if (pmode & m_ref)
+ result = mvarray[0][m_b_xp-1][m_hv];
}
- else if(m_b_xp == 0 && m_b_yp > 0)
+ else if (m_b_xp == 0 && m_b_yp > 0)
{
- pmode = preddata[m_b_yp-1][0];
- if(pmode & m_ref)
+ pmode = preddata[m_b_yp-1][0];
+ if (pmode & m_ref)
result = mvarray[m_b_yp-1][0][m_hv];
}
- return result;
+ return result;
}
-void VectorElementCodec::CodeVal(const MvData& in_data)
+void VectorElementCodec::CodeVal(const MvData& in_data )
{
const MvArray& mv_array = in_data.Vectors(m_ref);
- const int pred = Prediction(mv_array , in_data.Mode());
+ const int pred = Prediction( mv_array , in_data.Mode() );
const int val = mv_array[m_b_yp][m_b_xp][m_hv] - pred;
EncodeSInt(val, MV_FBIN1_CTX, MV_FBIN5plus_CTX);
@@ -471,11 +471,11 @@ void VectorElementCodec::CodeVal(const MvData& in_data)
//////////////////////
-void VectorElementCodec::DecodeVal(MvData& out_data)
+void VectorElementCodec::DecodeVal( MvData& out_data )
{
- MvArray& mv_array = out_data.Vectors(m_ref);
- int pred = Prediction(mv_array , out_data.Mode());
- mv_array[m_b_yp][m_b_xp][m_hv] = pred +
+ MvArray& mv_array = out_data.Vectors(m_ref);
+ int pred = Prediction( mv_array , out_data.Mode() );
+ mv_array[m_b_yp][m_b_xp][m_hv] = pred +
DecodeSInt(MV_FBIN1_CTX, MV_FBIN5plus_CTX);
}
@@ -483,95 +483,95 @@ void VectorElementCodec::DecodeVal(MvData& out_data)
/******************************************************************************/
//public functions//
////////////////////
-// Constructor
+// Constructor
DCCodec::DCCodec(ByteIO* p_byteio,
- const CompSort csort,
- size_t number_of_contexts):
- ArithCodec <MvData> (p_byteio, number_of_contexts),
- m_csort(csort)
-{}
+ const CompSort csort,
+ size_t number_of_contexts):
+ArithCodec <MvData> (p_byteio,number_of_contexts),
+m_csort( csort )
+{}
-void DCCodec::InitContexts()
-{
+void DCCodec::InitContexts()
+{
}
// Main code function
-void DCCodec::DoWorkCode(MvData& in_data)
+void DCCodec::DoWorkCode( MvData& in_data )
{
- int step, max;
- int split_depth;
-
- for(m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
+ int step,max;
+ int split_depth;
+
+ for (m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < in_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
{
- for(m_sb_xp = 0, m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp, m_sb_tlb_x += 4)
+ for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < in_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
{
- split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
-
- step = 4 >> (split_depth);
- max = (1 << split_depth);
+ split_depth = in_data.SBSplit()[m_sb_yp][m_sb_xp];
- //now do all the block modes and mvs in the mb
- for(m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y + 4; m_b_yp += step)
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
+
+ //now do all the block modes and mvs in the mb
+ for (m_b_yp = m_sb_tlb_y; m_b_yp < m_sb_tlb_y+4; m_b_yp += step)
{
- for(m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x + 4; m_b_xp += step)
+ for (m_b_xp = m_sb_tlb_x; m_b_xp < m_sb_tlb_x+4; m_b_xp += step)
{
if(in_data.Mode()[m_b_yp][m_b_xp] == INTRA)
{
CodeVal(in_data);
}
}//m_b_xp
- }//m_b_yp
-
+ }//m_b_yp
+
}//m_sb_xp
}//m_sb_yp
-}
+}
// Main decode function
-void DCCodec::DoWorkDecode(MvData& out_data)
+void DCCodec::DoWorkDecode( MvData& out_data)
{
- int step, max;
- int split_depth;
- int xstart, ystart;
+ int step,max;
+ int split_depth;
+ int xstart,ystart;
- for(m_sb_yp = 0, m_sb_tlb_y = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp, m_sb_tlb_y += 4)
+ for (m_sb_yp = 0,m_sb_tlb_y = 0; m_sb_yp < out_data.SBSplit().LengthY(); ++m_sb_yp,m_sb_tlb_y += 4)
{
- for(m_sb_xp = 0, m_sb_tlb_x = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp, m_sb_tlb_x += 4)
+ for (m_sb_xp = 0,m_sb_tlb_x = 0; m_sb_xp < out_data.SBSplit().LengthX(); ++m_sb_xp,m_sb_tlb_x += 4)
{
- //start with split mode
- split_depth = out_data.SBSplit()[m_sb_yp][m_sb_xp];
- step = 4 >> (split_depth);
- max = (1 << split_depth);
+ //start with split mode
+ split_depth = out_data.SBSplit()[m_sb_yp][m_sb_xp];
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
//now do all the block mvs in the mb
- for(int j = 0; j < max; ++j)
- {
- for(int i = 0; i < max; ++i)
+ for (int j = 0; j < max; ++j)
+ {
+ for (int i = 0; i < max; ++i)
{
- xstart = m_b_xp = m_sb_tlb_x + i * step;
- ystart = m_b_yp = m_sb_tlb_y + j * step;
-
+ xstart = m_b_xp = m_sb_tlb_x + i * step;
+ ystart = m_b_yp = m_sb_tlb_y + j * step;
+
if(out_data.Mode()[m_b_yp][m_b_xp] == INTRA)
{
- DecodeVal(out_data);
+ DecodeVal( out_data );
}
-
- // propagate throughout SB
- for(m_b_yp = ystart; m_b_yp < ystart + step; m_b_yp++)
+
+ // propagate throughout SB
+ for (m_b_yp = ystart; m_b_yp < ystart+step; m_b_yp++)
{
- for(m_b_xp = xstart; m_b_xp < xstart + step; m_b_xp++)
- {
- out_data.DC(m_csort)[m_b_yp][m_b_xp] = out_data.DC(m_csort)[ystart][xstart];
+ for (m_b_xp = xstart; m_b_xp < xstart+step; m_b_xp++)
+ {
+ out_data.DC( m_csort )[m_b_yp][m_b_xp] = out_data.DC( m_csort )[ystart][xstart];
}//m_b_xp
}//m_b_yp
- }//i
+ }//i
}//j
}//m_sb_xp
}//m_sb_yp
-}
+}
//protected functions//
///////////////////////
@@ -586,56 +586,56 @@ void DCCodec::ResetAll()
//prediction functions
ValueType DCCodec::Prediction(const TwoDArray < ValueType > & dcdata,
- const TwoDArray < PredMode > & preddata) const
+ const TwoDArray < PredMode > & preddata) const
{
- std::vector < int > nbrs;
+ std::vector < int > nbrs;
PredMode pmode;
- ValueType result = 0;
-
- if(m_b_xp > 0 && m_b_yp > 0)
+ ValueType result = 0;
+
+ if (m_b_xp > 0 && m_b_yp > 0)
{
- pmode = preddata[m_b_yp-1][m_b_xp];
- if(pmode == INTRA)
- nbrs.push_back((int) dcdata[m_b_yp-1][m_b_xp]);
-
- pmode = preddata[m_b_yp-1][m_b_xp-1];
- if(pmode == INTRA)
- nbrs.push_back((int)dcdata[m_b_yp-1][m_b_xp-1]);
-
- pmode = preddata[m_b_yp][m_b_xp-1];
- if(pmode == INTRA)
- nbrs.push_back((int) dcdata[m_b_yp][m_b_xp-1]);
-
- if(nbrs.size() > 0)
- result = ValueType(GetSMean(nbrs));
+ pmode = preddata[m_b_yp-1][m_b_xp];
+ if (pmode == INTRA)
+ nbrs.push_back( (int) dcdata[m_b_yp-1][m_b_xp] );
+
+ pmode = preddata[m_b_yp-1][m_b_xp-1];
+ if (pmode == INTRA)
+ nbrs.push_back((int)dcdata[m_b_yp-1][m_b_xp-1] );
+
+ pmode = preddata[m_b_yp][m_b_xp-1];
+ if (pmode == INTRA)
+ nbrs.push_back( (int) dcdata[m_b_yp][m_b_xp-1] );
+
+ if (nbrs.size() > 0)
+ result = ValueType(GetSMean(nbrs));
}
- else if(m_b_xp > 0 && m_b_yp == 0)
+ else if (m_b_xp > 0 && m_b_yp == 0)
{
- pmode = preddata[0][m_b_xp-1];
- if(pmode == INTRA)
- result = dcdata[0][m_b_xp-1];
+ pmode = preddata[0][m_b_xp-1];
+ if (pmode == INTRA)
+ result = dcdata[0][m_b_xp-1];
}
- else if(m_b_xp == 0 && m_b_yp > 0)
+ else if (m_b_xp == 0 && m_b_yp > 0)
{
- pmode = preddata[m_b_yp-1][0];
- if(pmode == INTRA)
- result = dcdata[m_b_yp-1][0];
+ pmode = preddata[m_b_yp-1][0];
+ if (pmode == INTRA)
+ result = dcdata[m_b_yp-1][0];
}
return result;
}
void DCCodec::CodeVal(const MvData& in_data)
-{
- const int val = in_data.DC(m_csort)[m_b_yp][m_b_xp] -
- Prediction(in_data.DC(m_csort) , in_data.Mode());
+{
+ const int val = in_data.DC( m_csort )[m_b_yp][m_b_xp] -
+ Prediction( in_data.DC(m_csort) , in_data.Mode() );
EncodeSInt(val, DC_FBIN1_CTX, DC_FBIN2plus_CTX);
}
//decoding functions//
//////////////////////
-void DCCodec::DecodeVal(MvData& out_data)
+void DCCodec::DecodeVal( MvData& out_data )
{
- out_data.DC(m_csort)[m_b_yp][m_b_xp] = DecodeSInt(DC_FBIN1_CTX, DC_FBIN2plus_CTX) +
- Prediction(out_data.DC(m_csort), out_data.Mode());
+ out_data.DC( m_csort )[m_b_yp][m_b_xp] = DecodeSInt(DC_FBIN1_CTX, DC_FBIN2plus_CTX) +
+ Prediction(out_data.DC( m_csort ), out_data.Mode());
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.h
index 9e3ce1d47..ed76ac92a 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/mv_codec.h
@@ -54,246 +54,246 @@
namespace dirac
{
-//! Codes and decodes the split mode
-/*!
- Derived from the ArithCodec class, this codes and decodes the split mode
- */
-class SplitModeCodec: public ArithCodec<MvData>
-{
-public:
- //! Constructor
+ //! Codes and decodes the split mode
/*!
- Creates a MvDataCodec object to encode MV data, based on parameters
- \param p_byteio Input/output for the encoded bits
- \param number_of_contexts the number of contexts used
- */
- SplitModeCodec(ByteIO* p_byteio, size_t number_of_contexts);
-
-
+ Derived from the ArithCodec class, this codes and decodes the split mode
+ */
+ class SplitModeCodec: public ArithCodec<MvData>
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a MvDataCodec object to encode MV data, based on parameters
+ \param p_byteio Input/output for the encoded bits
+ \param number_of_contexts the number of contexts used
+ */
+ SplitModeCodec(ByteIO* p_byteio, size_t number_of_contexts);
- //! Initialises the contexts
- void InitContexts();
+
-private:
+ //! Initialises the contexts
+ void InitContexts();
+
+ private:
- // Position of current SB
- int m_sb_xp, m_sb_yp;
+ // Position of current SB
+ int m_sb_xp, m_sb_yp;
-private:
+ private:
- // functions
- //! Private, bodyless copy constructor: class should not be copied
- SplitModeCodec(const SplitModeCodec& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- SplitModeCodec& operator=(const SplitModeCodec& rhs);
+ // functions
+ //! Private, bodyless copy constructor: class should not be copied
+ SplitModeCodec(const SplitModeCodec& cpy);
+ //! Private, bodyless copy operator=: class should not be assigned
+ SplitModeCodec& operator=(const SplitModeCodec& rhs);
- // coding functions
- // Code the SB splitting mode
- void CodeVal(const MvData& in_data);
+ // coding functions
+ // Code the SB splitting mode
+ void CodeVal(const MvData& in_data);
- // decoding functions
- // Decode the SB splitting mode
- void DecodeVal(MvData& out_data);
+ // decoding functions
+ // Decode the SB splitting mode
+ void DecodeVal( MvData& out_data);
- void DoWorkCode(MvData& in_data);
- void DoWorkDecode(MvData& out_data);
+ void DoWorkCode( MvData& in_data );
+ void DoWorkDecode(MvData& out_data);
- // Context stuff
- void ResetAll();
+ // Context stuff
+ void ResetAll();
- //prediction stuff
- unsigned int Prediction(const TwoDArray<int>& mbdata) const;
+ //prediction stuff
+ unsigned int Prediction(const TwoDArray<int>& mbdata) const;
-};
+ };
/******************************************************************************/
-//! Codes and decodes the prediction modes
-/*!
- Derived from the ArithCodec class, this codes and decodes the prediction mode.
- */
-class PredModeCodec: public ArithCodec<MvData>
-{
-public:
- //! Constructor
+ //! Codes and decodes the prediction modes
/*!
- Creates a MvDataCodec object to encode MV data, based on parameters
- \param p_byteio Input/output for the encoded bits
- \param number_of_contexts the number of contexts used
- \param num_refs Number of references
- */
- PredModeCodec(ByteIO* p_byteio, size_t number_of_contexts, const int num_refs);
-
- //! Initialises the contexts
- void InitContexts();
-
-private:
-
- // Position of current block
- int m_b_xp, m_b_yp;
- // Position of current SB
- int m_sb_xp, m_sb_yp;
- // Position of top-left block of current SB
- int m_sb_tlb_x, m_sb_tlb_y;
- // Number of reference pictures
- int m_num_refs;
-
-private:
-
- // functions
- //! Private, bodyless copy constructor: class should not be copied
- PredModeCodec(const PredModeCodec& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- PredModeCodec& operator=(const PredModeCodec& rhs);
-
- // coding functions
- // Code the block prediction mode
- void CodeVal(const MvData& in_data);
-
- // decoding functions
- // Decode the block prediction mode
- void DecodeVal(MvData& out_data);
-
- void DoWorkCode(MvData& in_data);
- void DoWorkDecode(MvData& out_data);
-
- // Context stuff
- void ResetAll();
-
- //prediction stuff
- unsigned int Prediction(const TwoDArray<PredMode>& preddata) const;
-
-};
+ Derived from the ArithCodec class, this codes and decodes the prediction mode.
+ */
+ class PredModeCodec: public ArithCodec<MvData>
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a MvDataCodec object to encode MV data, based on parameters
+ \param p_byteio Input/output for the encoded bits
+ \param number_of_contexts the number of contexts used
+ \param num_refs Number of references
+ */
+ PredModeCodec(ByteIO* p_byteio, size_t number_of_contexts, const int num_refs);
+
+ //! Initialises the contexts
+ void InitContexts();
+
+ private:
+
+ // Position of current block
+ int m_b_xp, m_b_yp;
+ // Position of current SB
+ int m_sb_xp, m_sb_yp;
+ // Position of top-left block of current SB
+ int m_sb_tlb_x, m_sb_tlb_y;
+ // Number of reference pictures
+ int m_num_refs;
+
+ private:
+
+ // functions
+ //! Private, bodyless copy constructor: class should not be copied
+ PredModeCodec(const PredModeCodec& cpy);
+ //! Private, bodyless copy operator=: class should not be assigned
+ PredModeCodec& operator=(const PredModeCodec& rhs);
+
+ // coding functions
+ // Code the block prediction mode
+ void CodeVal(const MvData& in_data);
+
+ // decoding functions
+ // Decode the block prediction mode
+ void DecodeVal(MvData& out_data);
+
+ void DoWorkCode( MvData& in_data );
+ void DoWorkDecode(MvData& out_data);
+
+ // Context stuff
+ void ResetAll();
+
+ //prediction stuff
+ unsigned int Prediction(const TwoDArray<PredMode>& preddata) const;
+
+ };
/******************************************************************************/
-//! Codes and decodes an array of motion vectors
-/*!
- Derived from the ArithCodec class, this codes and decodes a motion vector
- element (vertical or horizontal)
- */
-class VectorElementCodec: public ArithCodec<MvData>
-{
-public:
- //! Constructor
+ //! Codes and decodes an array of motion vectors
/*!
- Creates a MvDataCodec object to encode MV data, based on parameters
- \param p_byteio Input/output for the encoded bits
- \param ref_id The identity of the reference (1 or 2)
- \param horvert The identity of the vector element (horizontal or vertical)
- \param number_of_contexts the number of contexts used
- */
- VectorElementCodec(ByteIO* p_byteio, int ref_id, MvElement horvert,
- size_t number_of_contexts);
-
-
- //! Initialises the contexts
- void InitContexts();
-
-private:
-
- // Position of current block
- int m_b_xp, m_b_yp;
-
- // Position of current SB
- int m_sb_xp, m_sb_yp;
-
- // Position of top-left block of current SB
- int m_sb_tlb_x, m_sb_tlb_y;
-
- // The identity of the reference (1 or 2)
- const int m_ref;
-
- // Whether it's the vertical or horizontal MV element
- const MvElement m_hv;
-
-private:
-
- // functions
- //! Private, bodyless copy constructor: class should not be copied
- VectorElementCodec(const VectorElementCodec& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- VectorElementCodec& operator=(const VectorElementCodec& rhs);
-
- // coding functions
- // Code the motion vector element
- void CodeVal(const MvData& in_data);
-
- // decoding functions
- // Decode the motion vector element
- void DecodeVal(MvData& out_data);
-
- void DoWorkCode(MvData& in_data);
- void DoWorkDecode(MvData& out_data);
-
- // Context stuff
- void ResetAll();
-
- //prediction stuff
- int Prediction(const MvArray& mvarray,
- const TwoDArray<PredMode>& preddata) const;
-
-};
+ Derived from the ArithCodec class, this codes and decodes a motion vector
+ element (vertical or horizontal)
+ */
+ class VectorElementCodec: public ArithCodec<MvData>
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a MvDataCodec object to encode MV data, based on parameters
+ \param p_byteio Input/output for the encoded bits
+ \param ref_id The identity of the reference (1 or 2)
+ \param horvert The identity of the vector element (horizontal or vertical)
+ \param number_of_contexts the number of contexts used
+ */
+ VectorElementCodec(ByteIO* p_byteio, int ref_id, MvElement horvert,
+ size_t number_of_contexts);
+
+
+ //! Initialises the contexts
+ void InitContexts();
+
+ private:
+
+ // Position of current block
+ int m_b_xp, m_b_yp;
+
+ // Position of current SB
+ int m_sb_xp, m_sb_yp;
+
+ // Position of top-left block of current SB
+ int m_sb_tlb_x, m_sb_tlb_y;
+
+ // The identity of the reference (1 or 2)
+ const int m_ref;
+
+ // Whether it's the vertical or horizontal MV element
+ const MvElement m_hv;
+
+ private:
+
+ // functions
+ //! Private, bodyless copy constructor: class should not be copied
+ VectorElementCodec(const VectorElementCodec& cpy);
+ //! Private, bodyless copy operator=: class should not be assigned
+ VectorElementCodec& operator=(const VectorElementCodec& rhs);
+
+ // coding functions
+ // Code the motion vector element
+ void CodeVal(const MvData& in_data);
+
+ // decoding functions
+ // Decode the motion vector element
+ void DecodeVal( MvData& out_data);
+
+ void DoWorkCode( MvData& in_data );
+ void DoWorkDecode(MvData& out_data);
+
+ // Context stuff
+ void ResetAll();
+
+ //prediction stuff
+ int Prediction( const MvArray& mvarray,
+ const TwoDArray<PredMode>& preddata) const;
+
+ };
/******************************************************************************/
-//! Codes and decodes a set of DC values
-/*!
- Derived from the ArithCodec class, this codes and decodes all the DC
- values for a component
- */
-class DCCodec: public ArithCodec<MvData>
-{
-public:
- //! Constructor
+ //! Codes and decodes a set of DC values
/*!
- Creates a MvDataCodec object to encode MV data, based on parameters
- \param p_byteio Input/output for the encoded bits
- \param csort The identity of the component (Y, U or V)
- \param number_of_contexts the number of contexts used
- */
- DCCodec(ByteIO* p_byteio, const CompSort csort, size_t number_of_contexts);
-
- //! Initialises the contexts
- void InitContexts();
-
-private:
-
- // The component being coded
- const CompSort m_csort;
- // Position of current block
- int m_b_xp, m_b_yp;
- // Position of current SB
- int m_sb_xp, m_sb_yp;
- // Position of top-left block of current SB
- int m_sb_tlb_x, m_sb_tlb_y;
-
-private:
-
- // functions
- //! Private, bodyless copy constructor: class should not be copied
- DCCodec(const DCCodec& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- DCCodec& operator=(const DCCodec& rhs);
-
- // coding functions
- // Code the dc value of intra blocks
- void CodeVal(const MvData& in_data);
-
- // decoding functions
- // Decode the dc value of intra blocks
- void DecodeVal(MvData& out_data);
-
- void DoWorkCode(MvData& in_data);
- void DoWorkDecode(MvData& out_data);
-
- // Context stuff
- void ResetAll();
-
- //prediction stuff
- ValueType Prediction(const TwoDArray<ValueType>& dcdata,
- const TwoDArray<PredMode>& preddata) const;
-};
-
+ Derived from the ArithCodec class, this codes and decodes all the DC
+ values for a component
+ */
+ class DCCodec: public ArithCodec<MvData>
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a MvDataCodec object to encode MV data, based on parameters
+ \param p_byteio Input/output for the encoded bits
+ \param csort The identity of the component (Y, U or V)
+ \param number_of_contexts the number of contexts used
+ */
+ DCCodec(ByteIO* p_byteio, const CompSort csort, size_t number_of_contexts);
+
+ //! Initialises the contexts
+ void InitContexts();
+
+ private:
+
+ // The component being coded
+ const CompSort m_csort;
+ // Position of current block
+ int m_b_xp, m_b_yp;
+ // Position of current SB
+ int m_sb_xp, m_sb_yp;
+ // Position of top-left block of current SB
+ int m_sb_tlb_x, m_sb_tlb_y;
+
+ private:
+
+ // functions
+ //! Private, bodyless copy constructor: class should not be copied
+ DCCodec(const DCCodec& cpy);
+ //! Private, bodyless copy operator=: class should not be assigned
+ DCCodec& operator=(const DCCodec& rhs);
+
+ // coding functions
+ // Code the dc value of intra blocks
+ void CodeVal(const MvData& in_data);
+
+ // decoding functions
+ // Decode the dc value of intra blocks
+ void DecodeVal( MvData& out_data);
+
+ void DoWorkCode( MvData& in_data );
+ void DoWorkDecode(MvData& out_data);
+
+ // Context stuff
+ void ResetAll();
+
+ //prediction stuff
+ ValueType Prediction( const TwoDArray<ValueType>& dcdata,
+ const TwoDArray<PredMode>& preddata) const;
+ };
+
}// end namepace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.cpp
index fff71999f..b6e56ebc3 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.cpp
@@ -48,7 +48,7 @@ StreamPicOutput::~StreamPicOutput()
{
}
-StreamPicOutput::StreamPicOutput(std::ostream *op_ptr, const SourceParams& sp) :
+StreamPicOutput::StreamPicOutput (std::ostream *op_ptr, const SourceParams& sp) :
m_sparams(sp),
m_op_pic_ptr(op_ptr)
{
@@ -56,37 +56,37 @@ StreamPicOutput::StreamPicOutput(std::ostream *op_ptr, const SourceParams& sp) :
StreamFrameOutput::StreamFrameOutput(std::ostream *op_str,
const SourceParams& sp) :
- StreamPicOutput(op_str, sp)
+ StreamPicOutput (op_str, sp)
{}
StreamFrameOutput::~StreamFrameOutput()
{
}
-bool StreamFrameOutput::WriteToNextFrame(const Picture& myframe)
+bool StreamFrameOutput::WriteToNextFrame( const Picture& myframe )
{
bool ret_val;
- ret_val = WriteFrameComponent(myframe.Data(Y_COMP), Y_COMP);
- ret_val &= WriteFrameComponent(myframe.Data(U_COMP), U_COMP);
- ret_val &= WriteFrameComponent(myframe.Data(V_COMP), V_COMP);
+ ret_val=WriteFrameComponent(myframe.Data(Y_COMP), Y_COMP );
+ ret_val&=WriteFrameComponent( myframe.Data(U_COMP), U_COMP );
+ ret_val&=WriteFrameComponent( myframe.Data(V_COMP), V_COMP );
return ret_val;
}
-bool StreamFrameOutput::WriteFrameComponent(const PicArray& pic_data , const CompSort& cs)
+bool StreamFrameOutput::WriteFrameComponent( const PicArray& pic_data , const CompSort& cs)
{
- if(!m_op_pic_ptr)
+ if (!m_op_pic_ptr)
{
- std::cerr << std::endl << "Can't open picture data file for writing";
+ std::cerr<<std::endl<<"Can't open picture data file for writing";
return false;
}
//initially set up for 10-bit data input, rounded to 8 bits on file output
//This will throw out any padding to the right and bottom of a frame
- int xl, yl;
- if(cs == Y_COMP)
+ int xl,yl;
+ if (cs == Y_COMP)
{
xl = m_sparams.Xl();
yl = m_sparams.Yl();
@@ -97,18 +97,18 @@ bool StreamFrameOutput::WriteFrameComponent(const PicArray& pic_data , const Com
yl = m_sparams.ChromaHeight();
}
- unsigned char* tempc = new unsigned char[xl];
+ unsigned char* tempc=new unsigned char[xl];
- if(m_op_pic_ptr)
+ if (m_op_pic_ptr)
{
- for(int j = 0 ; j < yl ; ++j)
+ for (int j=0 ; j<yl ;++j)
{
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
- tempc[i] = (unsigned char)(pic_data[j][i] + 128);
+ tempc[i] = (unsigned char) ( pic_data[j][i] + 128 );
}//I
- m_op_pic_ptr->write((char*) tempc, xl);
+ m_op_pic_ptr->write((char*) tempc,xl);
}//J
}
@@ -121,43 +121,43 @@ bool StreamFrameOutput::WriteFrameComponent(const PicArray& pic_data , const Com
}
StreamFieldOutput::StreamFieldOutput(std::ostream *op_str,
- const SourceParams& sp) :
+ const SourceParams& sp) :
StreamPicOutput(op_str, sp),
m_frame_store(NULL)
{
int frame_size = (m_sparams.Xl() * m_sparams.Yl()) +
- 2 * (m_sparams.ChromaWidth() * m_sparams.ChromaHeight());
+ 2 * (m_sparams.ChromaWidth() * m_sparams.ChromaHeight());
m_frame_store = new unsigned char[frame_size];
}
StreamFieldOutput::~StreamFieldOutput()
{
- if(m_frame_store)
+ if (m_frame_store)
delete [] m_frame_store;
}
-bool StreamFieldOutput::WriteToNextFrame(const Picture& myfield)
+bool StreamFieldOutput::WriteToNextFrame( const Picture& myfield )
{
bool ret_val;
- ret_val = WriteFieldComponent(myfield.Data(Y_COMP) , myfield.GetPparams().PictureNum(), Y_COMP);
- ret_val &= WriteFieldComponent(myfield.Data(U_COMP) , myfield.GetPparams().PictureNum(), U_COMP);
- ret_val &= WriteFieldComponent(myfield.Data(V_COMP) , myfield.GetPparams().PictureNum(), V_COMP);
+ ret_val=WriteFieldComponent(myfield.Data(Y_COMP) , myfield.GetPparams().PictureNum(), Y_COMP );
+ ret_val&=WriteFieldComponent(myfield.Data(U_COMP) , myfield.GetPparams().PictureNum(), U_COMP );
+ ret_val&=WriteFieldComponent(myfield.Data(V_COMP) , myfield.GetPparams().PictureNum(), V_COMP );
return ret_val;
}
-bool StreamFieldOutput::WriteFieldComponent(const PicArray& pic_data , int field_num, const CompSort& cs)
+bool StreamFieldOutput::WriteFieldComponent( const PicArray& pic_data , int field_num, const CompSort& cs)
{
- if(!m_op_pic_ptr)
+ if (!m_op_pic_ptr)
{
- std::cerr << std::endl << "Can't open picture data file for writing";
+ std::cerr<<std::endl<<"Can't open picture data file for writing";
return false;
}
unsigned char *comp;
- int xl, yl;
- if(cs == Y_COMP)
+ int xl,yl;
+ if (cs == Y_COMP)
{
xl = m_sparams.Xl();
yl = m_sparams.Yl();
@@ -167,13 +167,13 @@ bool StreamFieldOutput::WriteFieldComponent(const PicArray& pic_data , int field
{
xl = m_sparams.ChromaWidth();
yl = m_sparams.ChromaHeight();
- if(cs == U_COMP)
+ if (cs == U_COMP)
{
comp = m_frame_store + (m_sparams.Xl() * m_sparams.Yl());
}
else
{
- comp = m_frame_store + (m_sparams.Xl() * m_sparams.Yl()) + (xl * yl);
+ comp = m_frame_store + (m_sparams.Xl() * m_sparams.Yl()) + (xl*yl);
}
}
@@ -184,19 +184,19 @@ bool StreamFieldOutput::WriteFieldComponent(const PicArray& pic_data , int field
// Seek offset after writing field to file
int end = 0;
- bool top_field = m_sparams.TopFieldFirst() ? (!(field_num % 2)) :
- (field_num % 2);
+ bool top_field = m_sparams.TopFieldFirst() ? (!(field_num%2)) :
+ (field_num%2);
bool write_to_file = (m_sparams.TopFieldFirst() && !top_field) ||
(!m_sparams.TopFieldFirst() && top_field);
- if(m_sparams.TopFieldFirst())
+ if (m_sparams.TopFieldFirst())
{
- if(top_field)
+ if (top_field)
{
start = 0;
skip = 2 * xl * sizeof(char);
- end = -(xl * yl);
+ end = -(xl*yl);
}
else
{
@@ -207,11 +207,11 @@ bool StreamFieldOutput::WriteFieldComponent(const PicArray& pic_data , int field
}
else
{
- if(!top_field) // i.e. bottom field
+ if (!top_field) // i.e. bottom field
{
start = xl;
skip = 2 * xl * sizeof(char);
- end = -(xl * yl);
+ end = -(xl*yl);
}
else // top field
{
@@ -223,21 +223,21 @@ bool StreamFieldOutput::WriteFieldComponent(const PicArray& pic_data , int field
unsigned char *tempc = comp + start;
- int field_yl = yl >> 1;
+ int field_yl = yl>>1;
int field_xl = xl;
- for(int j = 0 ; j < field_yl ; ++j)
+ for (int j=0 ; j<field_yl ;++j)
{
- for(int i = 0 ; i < field_xl ; ++i)
+ for (int i=0 ; i<field_xl ; ++i)
{
- tempc[i] = (unsigned char)(pic_data[j][i] + 128);
+ tempc[i] = (unsigned char) (pic_data[j][i]+128);
}//I
tempc += skip;
}//J
tempc += end;
- if(write_to_file)
+ if (write_to_file)
{
- m_op_pic_ptr->write((char*) comp, xl * yl);
+ m_op_pic_ptr->write((char*) comp,xl*yl);
m_op_pic_ptr->flush();
return true;
}
@@ -251,7 +251,7 @@ MemoryStreamOutput::MemoryStreamOutput(SourceParams &sp, bool interlace)
m_op_pic_ptr =
new std::ostream(&m_membuf);
- if(interlace)
+ if (interlace)
m_op_pic_str = new StreamFieldOutput(m_op_pic_ptr, sp);
else
m_op_pic_str = new StreamFrameOutput(m_op_pic_ptr, sp);
@@ -263,27 +263,27 @@ MemoryStreamOutput::~MemoryStreamOutput()
delete m_op_pic_ptr;
}
-void MemoryStreamOutput::SetMembufReference(unsigned char *buf, int buf_size)
+void MemoryStreamOutput::SetMembufReference (unsigned char *buf, int buf_size)
{
m_membuf.SetMembufReference(buf, buf_size);
}
FileStreamOutput::FileStreamOutput(const char* output_name,
- const SourceParams& sp, bool interlace)
+ const SourceParams& sp, bool interlace)
{
//picture output
m_op_pic_ptr =
- new std::ofstream(output_name, std::ios::out | std::ios::binary);
+ new std::ofstream(output_name,std::ios::out | std::ios::binary);
- if(!(*m_op_pic_ptr))
+ if (!(*m_op_pic_ptr))
{
std::cerr << std::endl <<
- "Can't open output picture data file for output: " <<
- output_name << std::endl;
+ "Can't open output picture data file for output: " <<
+ output_name<<std::endl;
return;
}
- if(interlace)
+ if (interlace)
m_op_pic_str = new StreamFieldOutput(m_op_pic_ptr, sp);
else
m_op_pic_str = new StreamFrameOutput(m_op_pic_ptr, sp);
@@ -291,7 +291,7 @@ FileStreamOutput::FileStreamOutput(const char* output_name,
FileStreamOutput::~FileStreamOutput()
{
- if(m_op_pic_ptr && *m_op_pic_ptr)
+ if (m_op_pic_ptr && *m_op_pic_ptr)
{
static_cast<std::ofstream *>(m_op_pic_ptr)->close();
delete m_op_pic_ptr;
@@ -303,14 +303,14 @@ FileStreamOutput::~FileStreamOutput()
/**************************************Input***********************************/
-StreamPicInput::StreamPicInput(std::istream *ip_pic_ptr,
- const SourceParams &sparams) :
+StreamPicInput::StreamPicInput (std::istream *ip_pic_ptr,
+ const SourceParams &sparams) :
m_sparams(sparams),
m_ip_pic_ptr(ip_pic_ptr)
{}
-StreamPicInput::~StreamPicInput()
+StreamPicInput::~StreamPicInput ()
{}
bool StreamPicInput::End() const
@@ -318,29 +318,29 @@ bool StreamPicInput::End() const
return m_ip_pic_ptr->eof();
}
-StreamFrameInput::StreamFrameInput(std::istream *ip_pic_ptr,
- const SourceParams &sparams) :
+StreamFrameInput::StreamFrameInput (std::istream *ip_pic_ptr,
+ const SourceParams &sparams) :
StreamPicInput(ip_pic_ptr, sparams)
{}
-StreamFrameInput::~StreamFrameInput()
+StreamFrameInput::~StreamFrameInput ()
{}
void StreamFrameInput::Skip(const int num)
{
- const int num_pels = m_sparams.Xl() * m_sparams.Yl();
+ const int num_pels = m_sparams.Xl()*m_sparams.Yl();
int num_bytes;
const ChromaFormat cf = m_sparams.CFormat();
- if(cf == format420)
- num_bytes = (num_pels * 3) / 2;
- else if(cf == format422)
- num_bytes = num_pels * 2;
+ if ( cf == format420 )
+ num_bytes = (num_pels*3)/2;
+ else if ( cf == format422 )
+ num_bytes = num_pels*2;
else
- num_bytes = num_pels * 3;
+ num_bytes = num_pels*3;
- m_ip_pic_ptr->seekg(num * num_bytes , std::ios::cur);
+ m_ip_pic_ptr->seekg( num*num_bytes , std::ios::cur );
}
bool StreamFrameInput::ReadNextPicture(Picture& myframe)
@@ -350,9 +350,9 @@ bool StreamFrameInput::ReadNextPicture(Picture& myframe)
bool ret_val;
- ret_val = ReadFrameComponent(myframe.Data(Y_COMP) , Y_COMP);
- ret_val &= ReadFrameComponent(myframe.Data(U_COMP) , U_COMP);
- ret_val &= ReadFrameComponent(myframe.Data(V_COMP) , V_COMP);
+ ret_val=ReadFrameComponent( myframe.Data(Y_COMP) , Y_COMP);
+ ret_val&=ReadFrameComponent(myframe.Data(U_COMP) , U_COMP);
+ ret_val&=ReadFrameComponent(myframe.Data(V_COMP) , V_COMP);
return ret_val;
}
@@ -360,29 +360,26 @@ bool StreamFrameInput::ReadNextPicture(Picture& myframe)
bool StreamFrameInput::ReadFrameComponent(PicArray& pic_data, const CompSort& cs)
{
- if(! *m_ip_pic_ptr)
+ if (! *m_ip_pic_ptr)
return false;
- int xl, yl;
- if(cs == Y_COMP)
- {
+ int xl,yl;
+ if (cs == Y_COMP){
xl = m_sparams.Xl();
yl = m_sparams.Yl();
}
- else
- {
- if(m_sparams.CFormat() == format420)
+ else{
+ if (m_sparams.CFormat()==format420)
{
- xl = m_sparams.Xl() / 2;
- yl = m_sparams.Yl() / 2;
+ xl = m_sparams.Xl()/2;
+ yl = m_sparams.Yl()/2;
}
- else if(m_sparams.CFormat() == format422)
+ else if (m_sparams.CFormat() == format422)
{
- xl = m_sparams.Xl() / 2;
+ xl = m_sparams.Xl()/2;
yl = m_sparams.Yl();
}
- else
- {
+ else{
xl = m_sparams.Xl();
yl = m_sparams.Yl();
}
@@ -390,23 +387,22 @@ bool StreamFrameInput::ReadFrameComponent(PicArray& pic_data, const CompSort& cs
unsigned char * temp = new unsigned char[xl];//array big enough for one line
- for(int j = 0 ; j < yl ; ++j)
+ for (int j=0 ; j<yl ; ++j)
{
m_ip_pic_ptr->read((char*) temp, xl);
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
pic_data[j][i] = (ValueType) temp[i];
}//I
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
pic_data[j][i] -= 128;
}//I
//pad the columns on the rhs using the edge value
- for(int i = xl ; i < pic_data.LengthX() ; ++i)
- {
+ for (int i=xl ; i<pic_data.LengthX() ; ++i ){
pic_data[j][i] = pic_data[j][xl-1];
}//I
@@ -415,9 +411,9 @@ bool StreamFrameInput::ReadFrameComponent(PicArray& pic_data, const CompSort& cs
delete [] temp;
//now do the padded lines, using the last true line
- for(int j = yl ; j < pic_data.LengthY() ; ++j)
+ for (int j=yl ; j<pic_data.LengthY() ; ++j )
{
- for(int i = 0 ; i < pic_data.LengthX() ; ++i)
+ for (int i=0 ; i<pic_data.LengthX() ; ++i )
{
pic_data[j][i] = pic_data[yl-1][i];
}//I
@@ -426,17 +422,17 @@ bool StreamFrameInput::ReadFrameComponent(PicArray& pic_data, const CompSort& cs
return true;
}
-StreamFieldInput::StreamFieldInput(std::istream *ip_pic_ptr,
- const SourceParams &sparams) :
+StreamFieldInput::StreamFieldInput (std::istream *ip_pic_ptr,
+ const SourceParams &sparams) :
StreamPicInput(ip_pic_ptr, sparams)
{}
-StreamFieldInput::~StreamFieldInput()
+StreamFieldInput::~StreamFieldInput ()
{}
void StreamFieldInput::Skip(const int num)
{
- REPORTM(num && false, "StreamFieldInput::Skip - Reached unimplemented function");
+ REPORTM (num && false, "StreamFieldInput::Skip - Reached unimplemented function");
}
bool StreamFieldInput::ReadNextPicture(Picture& mypic)
@@ -448,18 +444,18 @@ bool StreamFieldInput::ReadNextPicture(Picture& mypic)
bool ret_val;
- bool is_field1 = ((mypic.GetPparams().PictureNum() % 2) == 0);
- ret_val = ReadFieldComponent(is_field1, mypic.Data(Y_COMP), Y_COMP);
- ret_val &= ReadFieldComponent(is_field1, mypic.Data(U_COMP), U_COMP);
- ret_val &= ReadFieldComponent(is_field1, mypic.Data(V_COMP), V_COMP);
+ bool is_field1 = ((mypic.GetPparams().PictureNum()%2) == 0);
+ ret_val=ReadFieldComponent( is_field1, mypic.Data(Y_COMP), Y_COMP);
+ ret_val&=ReadFieldComponent(is_field1, mypic.Data(U_COMP), U_COMP);
+ ret_val&=ReadFieldComponent(is_field1, mypic.Data(V_COMP), V_COMP);
- int picture_size = m_sparams.Xl() * m_sparams.Yl() +
- 2 * m_sparams.ChromaWidth() * m_sparams.ChromaHeight();
- if(is_field1)
+ int picture_size = m_sparams.Xl()*m_sparams.Yl() +
+ 2*m_sparams.ChromaWidth()*m_sparams.ChromaHeight();
+ if (is_field1)
{
//Seek back to the beginning of frame so that the next field
//from the frame can be read
- m_ip_pic_ptr->seekg(-picture_size, std::ios::cur);
+ m_ip_pic_ptr->seekg (-picture_size, std::ios::cur);
}
return ret_val;
@@ -472,42 +468,39 @@ bool StreamFieldInput::ReadNextFrame(Picture& field1, Picture& field2)
bool ret_val = false;
- ret_val = ReadFieldComponent(field1.Data(Y_COMP), field2.Data(Y_COMP), Y_COMP);
- ret_val &= ReadFieldComponent(field1.Data(U_COMP), field2.Data(U_COMP), U_COMP);
- ret_val &= ReadFieldComponent(field1.Data(V_COMP), field2.Data(V_COMP), V_COMP);
-
+ ret_val=ReadFieldComponent( field1.Data(Y_COMP), field2.Data(Y_COMP), Y_COMP);
+ ret_val&=ReadFieldComponent(field1.Data(U_COMP), field2.Data(U_COMP), U_COMP);
+ ret_val&=ReadFieldComponent(field1.Data(V_COMP), field2.Data(V_COMP), V_COMP);
+
return ret_val;
}
bool StreamFieldInput::ReadFieldComponent(PicArray& pic_data1,
- PicArray& pic_data2,
- const CompSort& cs)
+ PicArray& pic_data2,
+ const CompSort& cs)
{
- if(! *m_ip_pic_ptr)
+ if (! *m_ip_pic_ptr)
return false;
//initially set up for 8-bit file input expanded to 10 bits for array output
- int xl, yl;
- if(cs == Y_COMP)
- {
+ int xl,yl;
+ if (cs == Y_COMP){
xl = m_sparams.Xl();
yl = m_sparams.Yl();
}
- else
- {
- if(m_sparams.CFormat() == format420)
+ else{
+ if (m_sparams.CFormat()==format420)
{
- xl = m_sparams.Xl() / 2;
- yl = m_sparams.Yl() / 2;
+ xl = m_sparams.Xl()/2;
+ yl = m_sparams.Yl()/2;
}
- else if(m_sparams.CFormat() == format422)
+ else if (m_sparams.CFormat() == format422)
{
- xl = m_sparams.Xl() / 2;
+ xl = m_sparams.Xl()/2;
yl = m_sparams.Yl();
}
- else
- {
+ else{
xl = m_sparams.Xl();
yl = m_sparams.Yl();
}
@@ -516,32 +509,31 @@ bool StreamFieldInput::ReadFieldComponent(PicArray& pic_data1,
unsigned char * temp = new unsigned char[xl];//array big enough for one line
ValueType *pic;
- for(int j = 0 ; j < yl ; j++)
+ for (int j=0 ; j<yl ; j++)
{
m_ip_pic_ptr->read((char*) temp, xl);
- if(j % 2 == 0)
+ if (j % 2 == 0)
{
pic = m_sparams.TopFieldFirst() ?
- &pic_data1[j/2][0] : &pic_data2[j/2][0];
+ &pic_data1[j/2][0] : &pic_data2[j/2][0];
}
else
{
pic = m_sparams.TopFieldFirst() ?
- &pic_data2[j/2][0] : &pic_data1[j/2][0];
+ &pic_data2[j/2][0] : &pic_data1[j/2][0];
}
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
pic[i] = (ValueType) temp[i];
}//I
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
pic[i] -= 128;
}//I
//pad the columns on the rhs using the edge value
- for(int i = xl ; i < pic_data1.LengthX() ; ++i)
- {
+ for (int i=xl ; i<pic_data1.LengthX() ; ++i ){
pic[i] = pic[xl-1];
}//I
@@ -550,9 +542,9 @@ bool StreamFieldInput::ReadFieldComponent(PicArray& pic_data1,
delete [] temp;
//now do the padded lines, using the last true line
- for(int j = yl / 2 ; j < pic_data1.LengthY() ; ++j)
+ for (int j=yl/2 ; j<pic_data1.LengthY() ; ++j )
{
- for(int i = 0 ; i < pic_data1.LengthX() ; ++i)
+ for (int i=0 ; i<pic_data1.LengthX() ; ++i )
{
pic_data1[j][i] = pic_data1[yl/2-1][i];
pic_data2[j][i] = pic_data2[yl/2-1][i];
@@ -563,51 +555,48 @@ bool StreamFieldInput::ReadFieldComponent(PicArray& pic_data1,
}
bool StreamFieldInput::ReadFieldComponent(bool is_field1,
- PicArray& pic_data,
- const CompSort& cs)
+ PicArray& pic_data,
+ const CompSort& cs)
{
- if(! *m_ip_pic_ptr)
+ if (! *m_ip_pic_ptr)
return false;
//initially set up for 8-bit file input expanded to 10 bits for array output
- int xl, yl;
- if(cs == Y_COMP)
- {
+ int xl,yl;
+ if (cs == Y_COMP){
xl = m_sparams.Xl();
- yl = m_sparams.Yl() >> 1;
+ yl = m_sparams.Yl()>>1;
}
- else
- {
+ else{
xl = m_sparams.ChromaWidth();
- yl = m_sparams.ChromaHeight() >> 1;
+ yl = m_sparams.ChromaHeight()>>1;
}
unsigned char * pic = new unsigned char[2*xl];//array big enough for two lines - one for each field
int start = 0;
- if((is_field1 && !m_sparams.TopFieldFirst()) ||
- (!is_field1 && m_sparams.TopFieldFirst()))
+ if ((is_field1 && !m_sparams.TopFieldFirst()) ||
+ (!is_field1 && m_sparams.TopFieldFirst()))
{
start = xl;
}
- for(int j = 0 ; j < yl ; j++)
+ for (int j=0 ; j<yl ; j++)
{
- m_ip_pic_ptr->read((char*) pic, 2 * xl);
+ m_ip_pic_ptr->read((char*) pic, 2*xl);
// skip to the start of the field
unsigned char *field = pic + start;
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
pic_data[j][i] = (ValueType) field[i];
}//I
- for(int i = 0 ; i < xl ; ++i)
+ for (int i=0 ; i<xl ; ++i)
{
pic_data[j][i] -= 128;
}
//pad the columns on the rhs using the edge value
- for(int i = xl ; i < pic_data.LengthX() ; ++i)
- {
+ for (int i=xl ; i<pic_data.LengthX() ; ++i ){
pic_data[j][i] = pic_data[j][xl-1];
}//I
@@ -615,9 +604,9 @@ bool StreamFieldInput::ReadFieldComponent(bool is_field1,
delete [] pic;
//now do the padded lines, using the last true line
- for(int j = yl ; j < pic_data.LengthY() ; ++j)
+ for (int j=yl ; j<pic_data.LengthY() ; ++j )
{
- for(int i = 0 ; i < pic_data.LengthX() ; ++i)
+ for (int i=0 ; i<pic_data.LengthX() ; ++i )
{
pic_data[j][i] = pic_data[yl-1][i];
}//I
@@ -632,7 +621,7 @@ MemoryStreamInput::MemoryStreamInput(SourceParams& sparams, bool field_input)
m_ip_pic_ptr =
new std::istream(&m_membuf);
- if(field_input)
+ if (field_input)
m_inp_str = new StreamFieldInput(m_ip_pic_ptr, sparams);
else
m_inp_str = new StreamFrameInput(m_ip_pic_ptr, sparams);
@@ -644,7 +633,7 @@ MemoryStreamInput::~MemoryStreamInput()
delete m_inp_str;
}
-void MemoryStreamInput::SetMembufReference(unsigned char *buf, int buf_size)
+void MemoryStreamInput::SetMembufReference (unsigned char *buf, int buf_size)
{
m_membuf.SetMembufReference(buf, buf_size);
}
@@ -661,14 +650,14 @@ FileStreamInput::FileStreamInput(const char* input_name,
//picture input
m_ip_pic_ptr =
- new std::ifstream(input_name_yuv, std::ios::in | std::ios::binary);
+ new std::ifstream(input_name_yuv,std::ios::in | std::ios::binary);
- if(!(*m_ip_pic_ptr))
- std::cerr << std::endl <<
- "Can't open input picture data file: " <<
- input_name_yuv << std::endl;
+ if (!(*m_ip_pic_ptr))
+ std::cerr << std::endl<<
+ "Can't open input picture data file: " <<
+ input_name_yuv << std::endl;
- if(interlace)
+ if (interlace)
m_inp_str = new StreamFieldInput(m_ip_pic_ptr, sparams);
else
m_inp_str = new StreamFrameInput(m_ip_pic_ptr, sparams);
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.h
index 02bb5f678..375b4c033 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/pic_io.h
@@ -52,500 +52,476 @@
namespace dirac
{
-//////////////////////////////////////////
-//--------------------------------------//
-//- -//
-//-Uncompressed picture file IO wrapper-//
-//- -//
-//--------------------------------------//
-//////////////////////////////////////////
+ //////////////////////////////////////////
+ //--------------------------------------//
+ //- -//
+ //-Uncompressed picture file IO wrapper-//
+ //- -//
+ //--------------------------------------//
+ //////////////////////////////////////////
-// Stream classes for writing/reading frames of uncompressed/decoded data
-// to stream. Streams currently supported are Memory based streams and
-// File based streams. These classes need further restructuring.
-// Anu - 19-11-2004
+ // Stream classes for writing/reading frames of uncompressed/decoded data
+ // to stream. Streams currently supported are Memory based streams and
+ // File based streams. These classes need further restructuring.
+ // Anu - 19-11-2004
-// Subclass these to provide functionality for different file formats and
-// for streaming.
+ // Subclass these to provide functionality for different file formats and
+ // for streaming.
-//! Class for outputting pictures
+ //! Class for outputting pictures
-/*!
- Abstract base class for classes that output frames to stream
-*/
-class StreamPicOutput
-{
-public:
- //! Constructor
/*!
- Constructor, takes
- \param op_ptr the output stream object
- \param sp the source parameters
- */
- StreamPicOutput(std::ostream* op_ptr, const SourceParams& sp);
-
- //! virtual Destructor
- virtual ~StreamPicOutput();
-
- //! Write a picture to the next frame to be output
- virtual bool WriteToNextFrame(const Picture& myframe) = 0;
-
- //! Get the source parameters
- SourceParams& GetSourceParams()
+ Abstract base class for classes that output frames to stream
+ */
+ class StreamPicOutput
{
- return m_sparams;
- }
+ public:
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param op_ptr the output stream object
+ \param sp the source parameters
+ */
+ StreamPicOutput( std::ostream* op_ptr, const SourceParams& sp);
+
+ //! virtual Destructor
+ virtual ~StreamPicOutput();
+
+ //! Write a picture to the next frame to be output
+ virtual bool WriteToNextFrame(const Picture& myframe) = 0;
+
+ //! Get the source parameters
+ SourceParams& GetSourceParams() {return m_sparams;}
+
+ protected:
+ //! Source parameters
+ SourceParams m_sparams;
+ //! Output stream
+ std::ostream* m_op_pic_ptr;
+
+ //! Body-less default Constructor
+ StreamPicOutput();
+ private:
-protected:
- //! Source parameters
- SourceParams m_sparams;
- //! Output stream
- std::ostream* m_op_pic_ptr;
-
- //! Body-less default Constructor
- StreamPicOutput();
-private:
+ };
-};
+ class StreamFrameOutput : public StreamPicOutput
+ {
+ public:
+
+ /*!
+ Constructor, takes
+ \param op_ptr the output stream object
+ \param sp the source parameters
+ */
+ StreamFrameOutput( std::ostream *op_ptr, const SourceParams& sp);
+
+ //! virtual Destructor
+ virtual ~StreamFrameOutput();
+
+ //! Write the next frame to the output
+ bool WriteToNextFrame(const Picture& myframe);
+
+ protected:
+ //! Write a frame component to file
+ bool WriteFrameComponent(const PicArray& pic_data,
+ const CompSort& cs);
+ private:
+ //! Body-less Default Constructor
+ StreamFrameOutput();
+ };
-class StreamFrameOutput : public StreamPicOutput
-{
-public:
+ class StreamFieldOutput : public StreamPicOutput
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param op_ptr the output stream object
+ \param sp the source parameters
+ */
+ StreamFieldOutput( std::ostream *op_ptr, const SourceParams& sp);
+
+ //! virtual Destructor
+ virtual ~StreamFieldOutput();
+
+ //! Write a field to the next frame to be output
+ bool WriteToNextFrame(const Picture& myfield);
+
+ protected:
+ //! Write a field component to file
+ bool WriteFieldComponent(const PicArray& pic_data,
+ int field_num,
+ const CompSort& cs);
+
+ private:
+ //! Body-less Default Constructor
+ StreamFieldOutput();
+ unsigned char *m_frame_store;
+ };
/*!
- Constructor, takes
- \param op_ptr the output stream object
- \param sp the source parameters
- */
- StreamFrameOutput(std::ostream *op_ptr, const SourceParams& sp);
-
- //! virtual Destructor
- virtual ~StreamFrameOutput();
+ Outputs pictures to a memory buffer
+ */
+ class MemoryStreamOutput
+ {
+ public:
+ //! Constructor
+ MemoryStreamOutput(SourceParams &sparams, bool interlace);
- //! Write the next frame to the output
- bool WriteToNextFrame(const Picture& myframe);
+ //! Destructor
+ ~MemoryStreamOutput();
-protected:
- //! Write a frame component to file
- bool WriteFrameComponent(const PicArray& pic_data,
- const CompSort& cs);
-private:
- //! Body-less Default Constructor
- StreamFrameOutput();
-};
+ //! Get source parameters
+ SourceParams& GetSourceParams()
+ { return m_op_pic_str->GetSourceParams();}
-class StreamFieldOutput : public StreamPicOutput
-{
-public:
- //! Constructor
- /*!
- Constructor, takes
- \param op_ptr the output stream object
- \param sp the source parameters
- */
- StreamFieldOutput(std::ostream *op_ptr, const SourceParams& sp);
-
- //! virtual Destructor
- virtual ~StreamFieldOutput();
-
- //! Write a field to the next frame to be output
- bool WriteToNextFrame(const Picture& myfield);
-
-protected:
- //! Write a field component to file
- bool WriteFieldComponent(const PicArray& pic_data,
- int field_num,
- const CompSort& cs);
-
-private:
- //! Body-less Default Constructor
- StreamFieldOutput();
- unsigned char *m_frame_store;
-};
-
-/*!
- Outputs pictures to a memory buffer
-*/
-class MemoryStreamOutput
-{
-public:
- //! Constructor
- MemoryStreamOutput(SourceParams &sparams, bool interlace);
+ StreamPicOutput *GetStream() { return m_op_pic_str; }
+ //! Set the memory buffer to write the data to
+ void SetMembufReference (unsigned char *buf, int buf_size);
- //! Destructor
- ~MemoryStreamOutput();
+ protected:
+ //! Body-less default Constructor
+ MemoryStreamOutput();
+ //! Body-less copy constructor
+ MemoryStreamOutput(const MemoryStreamOutput&);
+ //! Body-less assignment operator
+ MemoryStreamOutput & operator =(const MemoryStreamOutput&);
- //! Get source parameters
- SourceParams& GetSourceParams()
- {
- return m_op_pic_str->GetSourceParams();
- }
+ protected:
- StreamPicOutput *GetStream()
- {
- return m_op_pic_str;
- }
- //! Set the memory buffer to write the data to
- void SetMembufReference(unsigned char *buf, int buf_size);
-
-protected:
- //! Body-less default Constructor
- MemoryStreamOutput();
- //! Body-less copy constructor
- MemoryStreamOutput(const MemoryStreamOutput&);
- //! Body-less assignment operator
- MemoryStreamOutput & operator =(const MemoryStreamOutput&);
-
-protected:
-
- //! local memory buffer
- class OutputMemoryBuffer : public std::streambuf
- {
- public:
- //! Memory buffer constructor
- OutputMemoryBuffer() :
- m_op_buf(0),
- m_op_buf_size(0),
- m_op_idx(0)
- {}
-
- //! Set the buffer variables
- /*! Set the memory buffer variables
- \param buffer buffer to write data to
- \param buffer_size size of output buffer
- */
- void SetMembufReference(unsigned char *buffer, int buffer_size)
- {
- m_op_buf = buffer;
- m_op_buf_size = buffer_size;
- m_op_idx = 0;
- }
-
- protected:
- //! Memory buffer to write data to
- unsigned char *m_op_buf;
- //! Memory buffer size
- int m_op_buf_size;
- //! Index of first available byte in buffer
- int m_op_idx;
-
- //! Write Overflow method to write one char at a time
- virtual int overflow(int c)
- {
- if(c != EOF)
+ //! local memory buffer
+ class OutputMemoryBuffer : public std::streambuf
{
- if(m_op_idx == m_op_buf_size)
- return EOF;
-
- m_op_buf[m_op_idx] = (char)c;
- m_op_idx++;
- }
- return c;
- }
-
- //! xsputn method to write one multiple chars at a time to buffer
- virtual std::streamsize xsputn(const char *s,
- std::streamsize num)
- {
- std::streamsize bytes_left = m_op_buf_size - m_op_idx;
- std::streamsize bytes_written = bytes_left > num
- ? num : bytes_left;
- memcpy(&m_op_buf[m_op_idx], (unsigned char *)s,
- bytes_written);
- m_op_idx += bytes_written;
- return bytes_written;
- }
-
- private:
- //! Body-less copy constructor
- OutputMemoryBuffer(const OutputMemoryBuffer&);
- //! Body-less assignment operator
- OutputMemoryBuffer& operator =(const OutputMemoryBuffer&);
+ public:
+ //! Memory buffer constructor
+ OutputMemoryBuffer () :
+ m_op_buf(0),
+ m_op_buf_size(0),
+ m_op_idx(0)
+ {}
+
+ //! Set the buffer variables
+ /*! Set the memory buffer variables
+ \param buffer buffer to write data to
+ \param buffer_size size of output buffer
+ */
+ void SetMembufReference (unsigned char *buffer, int buffer_size)
+ {
+ m_op_buf = buffer;
+ m_op_buf_size = buffer_size;
+ m_op_idx = 0;
+ }
+
+ protected:
+ //! Memory buffer to write data to
+ unsigned char *m_op_buf;
+ //! Memory buffer size
+ int m_op_buf_size;
+ //! Index of first available byte in buffer
+ int m_op_idx;
+
+ //! Write Overflow method to write one char at a time
+ virtual int overflow (int c)
+ {
+ if ( c != EOF)
+ {
+ if (m_op_idx == m_op_buf_size)
+ return EOF;
+
+ m_op_buf[m_op_idx] = (char)c;
+ m_op_idx++;
+ }
+ return c;
+ }
+
+ //! xsputn method to write one multiple chars at a time to buffer
+ virtual std::streamsize xsputn (const char *s,
+ std::streamsize num)
+ {
+ std::streamsize bytes_left = m_op_buf_size - m_op_idx;
+ std::streamsize bytes_written = bytes_left > num
+ ? num : bytes_left;
+ memcpy (&m_op_buf[m_op_idx], (unsigned char *)s,
+ bytes_written);
+ m_op_idx += bytes_written;
+ return bytes_written;
+ }
+
+ private:
+ //! Body-less copy constructor
+ OutputMemoryBuffer(const OutputMemoryBuffer&);
+ //! Body-less assignment operator
+ OutputMemoryBuffer& operator =(const OutputMemoryBuffer&);
+ };
+
+ private:
+ //! Output stream Memory buffer
+ OutputMemoryBuffer m_membuf;
+ //! Physical Output stream
+ std::ostream* m_op_pic_ptr;
+ //! Pic output Stream
+ StreamPicOutput *m_op_pic_str;
};
-private:
- //! Output stream Memory buffer
- OutputMemoryBuffer m_membuf;
- //! Physical Output stream
- std::ostream* m_op_pic_ptr;
- //! Pic output Stream
- StreamPicOutput *m_op_pic_str;
-};
-
-/*!
- Outputs pictures to a file
-*/
-class FileStreamOutput
-{
-public:
-
- //! Constructor
/*!
- Constructor, takes
- \param output_name the name of the output file
- \param sp the source parameters
- \param interlace the output is interlaced
- */
- FileStreamOutput(const char* output_name,
- const SourceParams& sp, bool interlace);
-
- //! Destructor
- virtual ~FileStreamOutput();
-
- StreamPicOutput *GetStream()
+ Outputs pictures to a file
+ */
+ class FileStreamOutput
{
- return m_op_pic_str;
- }
-private:
- //! Physical Output stream
- std::ostream* m_op_pic_ptr;
- //! Pic output Stream
- StreamPicOutput *m_op_pic_str;
-};
-
-//! Picture input class
-/*!
- Abstract Class for reading picture data from a stream.
- */
-
-class StreamPicInput
-{
-public:
+ public:
+
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param output_name the name of the output file
+ \param sp the source parameters
+ \param interlace the output is interlaced
+ */
+ FileStreamOutput (const char* output_name,
+ const SourceParams& sp, bool interlace);
+
+ //! Destructor
+ virtual ~FileStreamOutput ();
+
+ StreamPicOutput *GetStream() { return m_op_pic_str; }
+ private:
+ //! Physical Output stream
+ std::ostream* m_op_pic_ptr;
+ //! Pic output Stream
+ StreamPicOutput *m_op_pic_str;
+ };
- //! Default Constructor
- StreamPicInput();
- //! Constructor
+ //! Picture input class
/*!
- Constructor, takes
- \param ip_pic_ptr input stream to read from
- \param sparams Source parameters
+ Abstract Class for reading picture data from a stream.
*/
- StreamPicInput(std::istream *ip_pic_ptr, const SourceParams& sparams);
-
- //! Destructor
- virtual ~StreamPicInput();
-
- //! Skip n frames of input
- virtual void Skip(const int n) = 0;
-
- //! Read the next picture frame/field from the file
- virtual bool ReadNextPicture(Picture& mypic) = 0;
- //! Get the source parameters
- SourceParams& GetSourceParams() const
+ class StreamPicInput
{
- return m_sparams;
- }
+ public:
- //! Returns true if we're at the end of the input, false otherwise
- bool End() const ;
+ //! Default Constructor
+ StreamPicInput();
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param ip_pic_ptr input stream to read from
+ \param sparams Source parameters
+ */
+ StreamPicInput(std::istream *ip_pic_ptr, const SourceParams& sparams);
-protected:
+ //! Destructor
+ virtual ~StreamPicInput();
- //! Source parameters
- mutable SourceParams m_sparams;
+ //! Skip n frames of input
+ virtual void Skip( const int n)= 0;
- //! Input stream
- std::istream* m_ip_pic_ptr;
+ //! Read the next picture frame/field from the file
+ virtual bool ReadNextPicture(Picture& mypic) = 0;
-};
+ //! Get the source parameters
+ SourceParams& GetSourceParams() const {return m_sparams;}
-class StreamFrameInput : public StreamPicInput
-{
-public:
+ //! Returns true if we're at the end of the input, false otherwise
+ bool End() const ;
- //! Default Constructor
- StreamFrameInput();
- //! Constructor
- /*!
- Constructor, takes
- \param ip_pic_ptr input stream to read from
- \param sparams Source parameters
- */
- StreamFrameInput(std::istream *ip_pic_ptr, const SourceParams& sparams);
+ protected:
- //! Destructor
- virtual ~StreamFrameInput();
+ //! Source parameters
+ mutable SourceParams m_sparams;
- //! Skip n frames of input
- virtual void Skip(const int n);
+ //! Input stream
+ std::istream* m_ip_pic_ptr;
- //! Read the next frame from the file
- virtual bool ReadNextPicture(Picture& myframe);
+ };
-private:
+ class StreamFrameInput : public StreamPicInput
+ {
+ public:
- //! Read a Frame component from the file
- bool ReadFrameComponent(PicArray& pic_data, const CompSort& cs);
+ //! Default Constructor
+ StreamFrameInput();
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param ip_pic_ptr input stream to read from
+ \param sparams Source parameters
+ */
+ StreamFrameInput(std::istream *ip_pic_ptr, const SourceParams& sparams);
-};
+ //! Destructor
+ virtual ~StreamFrameInput();
-class StreamFieldInput : public StreamPicInput
-{
-public:
+ //! Skip n frames of input
+ virtual void Skip( const int n);
- //! Default Constructor
- StreamFieldInput();
- //! Constructor
- /*!
- Constructor, takes
- \param ip_pic_ptr input stream to read from
- \param sparams Source parameters
- */
- StreamFieldInput(std::istream *ip_pic_ptr, const SourceParams& sparams);
-
- //! Destructor
- virtual ~StreamFieldInput();
-
- //! Skip n frames of input
- virtual void Skip(const int n);
-
- //! Read the next field from the file
- virtual bool ReadNextPicture(Picture& myfield);
-
- //! Read the next frame from the file
- bool ReadNextFrame(Picture& field1, Picture& field2);
-
-protected:
- //! Read both Field components from the file
- bool ReadFieldComponent(PicArray& pic_data1,
- PicArray& pic_data2,
- const CompSort& cs);
-
- //! Read one Field component from the file
- bool ReadFieldComponent(bool is_field1, PicArray& pic_data,
- const CompSort& cs);
-};
-/*!
- Class for reading picture data from memory
- */
-class MemoryStreamInput
-{
-public:
- //! Constructor
- /*! Create a MemoryStreamInput object
- \param sparams Source parameters
- \param field_input Treat input as fields, not frames
- */
- MemoryStreamInput(SourceParams& sparams, bool field_input);
+ //! Read the next frame from the file
+ virtual bool ReadNextPicture(Picture& myframe);
- //! Destructor
- ~MemoryStreamInput();
+ private:
- SourceParams& GetSourceParams()
- {
- return m_inp_str->GetSourceParams();
- }
+ //! Read a Frame component from the file
+ bool ReadFrameComponent(PicArray& pic_data,const CompSort& cs);
- //! Set Memory buffer
- /*! Set the input memory buffer variables
- \param buf Input Buffer to read data from
- \param buf_size Input buffer size
- */
- void SetMembufReference(unsigned char *buf, int buf_size);
+ };
- //! Return the input stream
- StreamPicInput *GetStream()
+ class StreamFieldInput : public StreamPicInput
{
- return m_inp_str;
- }
-protected:
- //! Body-less copy constructor
- MemoryStreamInput(const MemoryStreamInput&);
- //! Body-less assignment operator
- MemoryStreamInput & operator =(const MemoryStreamInput&);
-
-protected:
- //! Class that defines the Input Stream Memory Buffer
- class InputMemoryBuffer : public std::streambuf
+ public:
+
+ //! Default Constructor
+ StreamFieldInput();
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param ip_pic_ptr input stream to read from
+ \param sparams Source parameters
+ */
+ StreamFieldInput(std::istream *ip_pic_ptr, const SourceParams& sparams);
+
+ //! Destructor
+ virtual ~StreamFieldInput();
+
+ //! Skip n frames of input
+ virtual void Skip( const int n);
+
+ //! Read the next field from the file
+ virtual bool ReadNextPicture(Picture& myfield);
+
+ //! Read the next frame from the file
+ bool ReadNextFrame(Picture& field1, Picture& field2);
+
+ protected:
+ //! Read both Field components from the file
+ bool ReadFieldComponent(PicArray& pic_data1,
+ PicArray& pic_data2,
+ const CompSort& cs);
+
+ //! Read one Field component from the file
+ bool ReadFieldComponent(bool is_field1, PicArray& pic_data,
+ const CompSort& cs);
+ };
+ /*!
+ Class for reading picture data from memory
+ */
+ class MemoryStreamInput
{
- public:
- //! Constructor
- InputMemoryBuffer() : m_buffer(0), m_buffer_size(0)
- {
- setg((char *)m_buffer, (char *)m_buffer, (char *)m_buffer);
- }
-
- //! Destructor
- ~InputMemoryBuffer() {}
-
- //! Set Input Memory buffer variables
- /*! Initialises the input memory buffer vars
- \param buffer Input memory buffer
- \param buffer_size Input memory buffer size
- */
- void SetMembufReference(unsigned char *buffer, int buffer_size)
- {
- m_buffer = buffer;
- m_buffer_size = buffer_size;
-
- setg((char *)m_buffer, (char *)m_buffer,
- (char *)(m_buffer + buffer_size));
- }
-
- private:
- //! Body-less copy constructor
- InputMemoryBuffer(const InputMemoryBuffer& inbuf);
- //! Body-less assignment operator
- InputMemoryBuffer& operator = (const InputMemoryBuffer& inbuf);
-
- //! Input memory buffer
- unsigned char *m_buffer;
- //! Input memory buffer size
- int m_buffer_size;
+ public:
+ //! Constructor
+ /*! Create a MemoryStreamInput object
+ \param sparams Source parameters
+ \param field_input Treat input as fields, not frames
+ */
+ MemoryStreamInput(SourceParams& sparams, bool field_input);
+
+ //! Destructor
+ ~MemoryStreamInput();
+
+ SourceParams& GetSourceParams ( )
+ { return m_inp_str->GetSourceParams(); }
+
+ //! Set Memory buffer
+ /*! Set the input memory buffer variables
+ \param buf Input Buffer to read data from
+ \param buf_size Input buffer size
+ */
+ void SetMembufReference (unsigned char *buf, int buf_size);
+
+ //! Return the input stream
+ StreamPicInput *GetStream() { return m_inp_str; }
+ protected:
+ //! Body-less copy constructor
+ MemoryStreamInput(const MemoryStreamInput&);
+ //! Body-less assignment operator
+ MemoryStreamInput & operator =(const MemoryStreamInput&);
+
+ protected:
+ //! Class that defines the Input Stream Memory Buffer
+ class InputMemoryBuffer : public std::streambuf
+ {
+ public:
+ //! Constructor
+ InputMemoryBuffer() : m_buffer(0), m_buffer_size(0)
+ {
+ setg ((char *)m_buffer, (char *)m_buffer, (char *)m_buffer);
+ }
+
+ //! Destructor
+ ~InputMemoryBuffer(){}
+
+ //! Set Input Memory buffer variables
+ /*! Initialises the input memory buffer vars
+ \param buffer Input memory buffer
+ \param buffer_size Input memory buffer size
+ */
+ void SetMembufReference (unsigned char *buffer, int buffer_size)
+ {
+ m_buffer = buffer;
+ m_buffer_size = buffer_size;
+
+ setg ((char *)m_buffer, (char *)m_buffer,
+ (char *)(m_buffer + buffer_size));
+ }
+
+ private:
+ //! Body-less copy constructor
+ InputMemoryBuffer (const InputMemoryBuffer& inbuf);
+ //! Body-less assignment operator
+ InputMemoryBuffer& operator = (const InputMemoryBuffer& inbuf);
+
+ //! Input memory buffer
+ unsigned char *m_buffer;
+ //! Input memory buffer size
+ int m_buffer_size;
+ };
+
+ private:
+ //! Input stream buffer
+ InputMemoryBuffer m_membuf;
+
+ //! Input Stream Object
+ StreamPicInput *m_inp_str;
+
+ //! Input stream
+ std::istream* m_ip_pic_ptr;
};
-private:
- //! Input stream buffer
- InputMemoryBuffer m_membuf;
-
- //! Input Stream Object
- StreamPicInput *m_inp_str;
-
- //! Input stream
- std::istream* m_ip_pic_ptr;
-};
-
-//! Picture input class
-/*!
- Class for reading picture data from a file.
- */
-class FileStreamInput
-{
-public:
-
- //! Constructor
+ //! Picture input class
/*!
- Constructor, takes
- \param input_name the name of the input picture file
- \param sparams the source parameters
- \param interlace input is treated as interlaced
+ Class for reading picture data from a file.
*/
- FileStreamInput(const char* input_name, const SourceParams &sparams, bool interlace);
+ class FileStreamInput
+ {
+ public:
- //! Destructor
- virtual ~FileStreamInput();
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param input_name the name of the input picture file
+ \param sparams the source parameters
+ \param interlace input is treated as interlaced
+ */
+ FileStreamInput (const char* input_name, const SourceParams &sparams, bool interlace);
- SourceParams& GetSourceParams()
- {
- return m_inp_str->GetSourceParams();
- }
+ //! Destructor
+ virtual ~FileStreamInput ();
- //! Return the input stream
- StreamPicInput *GetStream()
- {
- return m_inp_str;
- }
+ SourceParams& GetSourceParams ( )
+ { return m_inp_str->GetSourceParams(); }
+
+ //! Return the input stream
+ StreamPicInput *GetStream() { return m_inp_str; }
-private:
- StreamPicInput *m_inp_str;
+ private:
+ StreamPicInput *m_inp_str;
- //! Input stream
- std::istream* m_ip_pic_ptr;
+ //! Input stream
+ std::istream* m_ip_pic_ptr;
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.cpp
index ba39343a8..ee3da95a3 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.cpp
@@ -50,62 +50,58 @@ using namespace dirac;
//---Picture---//
///////////////
-Picture::Picture(const PictureParams& pp):
+Picture::Picture(const PictureParams& pp):
m_pparams(pp)
{
- for(int c = 0; c < 3; ++c)
- {
+ for (int c=0;c<3;++c){
m_pic_data[c] = NULL;
- m_up_pic_data[c] = NULL;
+ m_up_pic_data[c] = NULL;
}
Init();
}
-Picture::Picture(const Picture& cpy):
+Picture::Picture( const Picture& cpy ):
m_pparams(cpy.m_pparams)
{
//delete data to be overwritten
- for(int c = 0; c < 3; ++c)
- {
+ for (int c=0;c<3;++c){
m_pic_data[c] = NULL;
- m_up_pic_data[c] = NULL;
+ m_up_pic_data[c] = NULL;
}
//now copy the data across
- for(int c = 0; c < 3; ++c)
- {
- m_pic_data[c] = new PicArray(*(cpy.m_pic_data[c]));
- if(cpy.m_up_pic_data[c] != NULL)
- m_up_pic_data[c] = new PicArray(*(cpy.m_up_pic_data[c]));
+ for (int c=0; c<3; ++c ){
+ m_pic_data[c] = new PicArray( *(cpy.m_pic_data[c]) );
+ if (cpy.m_up_pic_data[c] != NULL)
+ m_up_pic_data[c] = new PicArray( *(cpy.m_up_pic_data[c]) );
}
-
+
}
Picture::~Picture()
{
- ClearData();
+ ClearData();
}
Picture& Picture::operator=(const Picture& rhs)
{
- if(&rhs != this)
+ if ( &rhs != this)
{
- m_pparams = rhs.m_pparams;
+ m_pparams=rhs.m_pparams;
// Delete current data
ClearData();
// Copy the data across
- for(int c = 0; c < 3; ++c)
- {
- m_pic_data[c] = new PicArray(*(rhs.m_pic_data[c]));
-
- if(rhs.m_up_pic_data[c] != NULL)
- m_up_pic_data[c] = new PicArray(*(rhs.m_up_pic_data[c]));
- }
+ for (int c=0; c<3; ++c ){
+ m_pic_data[c] = new PicArray( *(rhs.m_pic_data[c]) );
+
+ if (rhs.m_up_pic_data[c] != NULL)
+ m_up_pic_data[c] = new PicArray( *(rhs.m_up_pic_data[c]) );
+ }
}
return *this;
@@ -114,11 +110,10 @@ Picture& Picture::operator=(const Picture& rhs)
void Picture::Fill(ValueType val)
{
- for(int c = 0; c < 3; ++c)
- {
+ for (int c=0; c<3; ++c ){
m_pic_data[c]->Fill(val);
- if(m_up_pic_data[c] != NULL)
- delete m_up_pic_data[c];
+ if (m_up_pic_data[c] != NULL )
+ delete m_up_pic_data[c];
}
}
@@ -131,43 +126,42 @@ void Picture::Init()
//first delete data if we need to
ClearData();
- m_pic_data[0] = new PicArray(m_pparams.Yl() , m_pparams.Xl());
- m_pic_data[0]->SetCSort(Y_COMP);
+ m_pic_data[0]=new PicArray( m_pparams.Yl() , m_pparams.Xl());
+ m_pic_data[0]->SetCSort( Y_COMP );
- m_pic_data[1] = new PicArray(m_pparams.ChromaYl() ,
- m_pparams.ChromaXl());
- m_pic_data[1]->SetCSort(U_COMP);
+ m_pic_data[1] = new PicArray( m_pparams.ChromaYl() ,
+ m_pparams.ChromaXl() );
+ m_pic_data[1]->SetCSort( U_COMP );
- m_pic_data[2] = new PicArray(m_pparams.ChromaYl() ,
- m_pparams.ChromaXl());
- m_pic_data[2]->SetCSort(V_COMP);
+ m_pic_data[2] = new PicArray( m_pparams.ChromaYl() ,
+ m_pparams.ChromaXl() );
+ m_pic_data[2]->SetCSort( V_COMP );
}
PicArray& Picture::UpData(CompSort cs)
{
const int c = (int) cs;
- if(m_up_pic_data[c] != NULL)
+ if (m_up_pic_data[c] != NULL )
return *(m_up_pic_data[c]);
else
- {
- //we have to do the upconversion
-
- m_up_pic_data[c] = new PicArray(2 * m_pic_data[c]->LengthY(),
- 2 * m_pic_data[c]->LengthX());
+ {//we have to do the upconversion
+
+ m_up_pic_data[c] = new PicArray( 2*m_pic_data[c]->LengthY(),
+ 2*m_pic_data[c]->LengthX() );
UpConverter* myupconv;
- if(c > 0)
- myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth() - 1)),
- (1 << (m_pparams.ChromaDepth() - 1)) - 1,
- m_pparams.ChromaXl(), m_pparams.ChromaYl());
+ if (c>0)
+ myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth()-1)),
+ (1 << (m_pparams.ChromaDepth()-1))-1,
+ m_pparams.ChromaXl(), m_pparams.ChromaYl());
else
- myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth() - 1)),
- (1 << (m_pparams.LumaDepth() - 1)) - 1,
- m_pparams.Xl(), m_pparams.Yl());
+ myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth()-1)),
+ (1 << (m_pparams.LumaDepth()-1))-1,
+ m_pparams.Xl(), m_pparams.Yl());
- myupconv->DoUpConverter(*(m_pic_data[c]) , *(m_up_pic_data[c]));
+ myupconv->DoUpConverter( *(m_pic_data[c]) , *(m_up_pic_data[c]) );
- delete myupconv;
+ delete myupconv;
return *(m_up_pic_data[c]);
@@ -178,50 +172,48 @@ const PicArray& Picture::UpData(CompSort cs) const
{
const int c = (int) cs;
- if(m_up_pic_data[c] != NULL)
+ if (m_up_pic_data[c] != NULL)
return *(m_up_pic_data[c]);
else
- {
- //we have to do the upconversion
-
- m_up_pic_data[c] = new PicArray(2 * m_pic_data[c]->LengthY(),
- 2 * m_pic_data[c]->LengthX());
+ {//we have to do the upconversion
+
+ m_up_pic_data[c] = new PicArray( 2*m_pic_data[c]->LengthY(),
+ 2*m_pic_data[c]->LengthX() );
UpConverter* myupconv;
- if(c > 0)
- myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth() - 1)),
- (1 << (m_pparams.ChromaDepth() - 1)) - 1,
- m_pparams.ChromaXl(), m_pparams.ChromaYl());
+ if (c>0)
+ myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth()-1)),
+ (1 << (m_pparams.ChromaDepth()-1))-1,
+ m_pparams.ChromaXl(), m_pparams.ChromaYl());
else
- myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth() - 1)),
- (1 << (m_pparams.LumaDepth() - 1)) - 1,
- m_pparams.Xl(), m_pparams.Yl());
+ myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth()-1)),
+ (1 << (m_pparams.LumaDepth()-1))-1,
+ m_pparams.Xl(), m_pparams.Yl());
- myupconv->DoUpConverter(*(m_pic_data[c]) , *(m_up_pic_data[c]));
+ myupconv->DoUpConverter( *(m_pic_data[c]) , *(m_up_pic_data[c]) );
- delete myupconv;
+ delete myupconv;
return *(m_up_pic_data[c]);
}
}
-void Picture::InitWltData(const int transform_depth)
+void Picture::InitWltData( const int transform_depth )
{
int xpad_len, ypad_len;
- int tx_mul = 1 << transform_depth;
+ int tx_mul = 1<<transform_depth;
- for(int c = 0; c < 3; ++c)
- {
+ for (int c=0; c<3; ++c){
xpad_len = m_pic_data[c]->LengthX();
ypad_len = m_pic_data[c]->LengthY();
- if(xpad_len % tx_mul != 0)
- xpad_len = ((xpad_len / tx_mul) + 1) * tx_mul;
- if(ypad_len % tx_mul != 0)
- ypad_len = ((ypad_len / tx_mul) + 1) * tx_mul;
+ if ( xpad_len%tx_mul != 0 )
+ xpad_len = ( (xpad_len/tx_mul)+1 ) *tx_mul;
+ if ( ypad_len%tx_mul != 0 )
+ ypad_len = ( (ypad_len/tx_mul)+1 ) * tx_mul;
- m_wlt_data[c].Resize(ypad_len, xpad_len);
+ m_wlt_data[c].Resize( ypad_len, xpad_len );
}
}
@@ -233,47 +225,47 @@ void Picture::ClipComponent(PicArray& pic_data, CompSort cs) const
ValueType min_val;
ValueType max_val;
-
+
min_val = (cs == Y_COMP) ?
- -(1 << (m_pparams.LumaDepth() - 1)) :
- -(1 << (m_pparams.ChromaDepth() - 1));
+ -(1 << (m_pparams.LumaDepth()-1) ) :
+ -(1 << (m_pparams.ChromaDepth()-1) );
max_val = (cs == Y_COMP) ?
- (1 << (m_pparams.LumaDepth() - 1)) - 1 :
- (1 << (m_pparams.ChromaDepth() - 1)) - 1;
+ (1 << (m_pparams.LumaDepth()-1) )-1 :
+ (1 << (m_pparams.ChromaDepth()-1) )-1;
#if defined (HAVE_MMX)
{
int qcount = count >> 2;
count = count & 3;
-
+
//__m64 pack_usmax = _mm_set_pi16 (0xffff, 0xffff, 0xffff, 0xffff);
//__m64 pack_smin = _mm_set_pi16 (0x8000, 0x8000, 0x8000, 0x8000);
- __m64 pack_usmax = _mm_set_pi16(-1, -1, -1, -1);
- __m64 pack_smin = _mm_set_pi16(-32768, -32768, -32768, -32768);
- __m64 high_val = _mm_set_pi16(max_val, max_val, max_val, max_val);
- __m64 lo_val = _mm_set_pi16(min_val, min_val, min_val, min_val);
-
- __m64 clip_max = _mm_add_pi16(pack_smin, high_val);
- __m64 clip_min = _mm_add_pi16(pack_smin, lo_val);
-
- __m64 tmp1 = _mm_subs_pu16(pack_usmax, clip_max);
- __m64 tmp2 = _mm_adds_pu16(clip_min, tmp1);
-
- while(qcount--)
+ __m64 pack_usmax = _mm_set_pi16 (-1, -1, -1, -1);
+ __m64 pack_smin = _mm_set_pi16 (-32768, -32768, -32768, -32768);
+ __m64 high_val = _mm_set_pi16 (max_val, max_val, max_val, max_val);
+ __m64 lo_val = _mm_set_pi16 (min_val, min_val, min_val, min_val);
+
+ __m64 clip_max = _mm_add_pi16 (pack_smin, high_val);
+ __m64 clip_min = _mm_add_pi16 (pack_smin, lo_val);
+
+ __m64 tmp1 = _mm_subs_pu16 ( pack_usmax, clip_max);
+ __m64 tmp2 = _mm_adds_pu16 ( clip_min, tmp1 );
+
+ while (qcount--)
{
ValueType *p1 = pic;
- *(__m64 *)p1 = _mm_add_pi16(pack_smin, *(__m64 *)p1);
- *(__m64 *)p1 = _mm_adds_pu16(*(__m64 *)p1, tmp1);
- *(__m64 *)p1 = _mm_subs_pu16(*(__m64 *)p1, tmp2);
- *(__m64 *)p1 = _mm_add_pi16(lo_val, *(__m64 *)p1);
+ *(__m64 *)p1 = _mm_add_pi16 (pack_smin, *(__m64 *)p1);
+ *(__m64 *)p1 = _mm_adds_pu16 (*(__m64 *)p1, tmp1);
+ *(__m64 *)p1 = _mm_subs_pu16 (*(__m64 *)p1, tmp2);
+ *(__m64 *)p1 = _mm_add_pi16 (lo_val, *(__m64 *)p1);
pic += 4;
}
//Mop up remaining pixels
- while(count--)
+ while( count-- )
{
- *pic = std::max(min_val, std::min(max_val , *pic)
- );
+ *pic = std::max( min_val, std::min( max_val , *pic )
+ );
pic++;
}
@@ -283,9 +275,9 @@ void Picture::ClipComponent(PicArray& pic_data, CompSort cs) const
#endif
// NOTE: depending on a contigous chunk of memory being allocated
- while(count--)
+ while (count--)
{
- *pic = std::max(min_val, std::min(max_val, *pic));
+ *pic = std::max( min_val, std::min( max_val, *pic ));
pic++;
}
}
@@ -293,35 +285,31 @@ void Picture::ClipComponent(PicArray& pic_data, CompSort cs) const
void Picture::Clip()
{
//just clips the straight picture data, not the upconverted data
-
- for(int c = 0; c < 3; ++c)
- ClipComponent(*(m_pic_data[c]), (CompSort) c);
+
+ for (int c=0; c<3; ++c)
+ ClipComponent( *(m_pic_data[c]), (CompSort) c);
}
void Picture::ClipUpData()
{
//just clips the upconverted data
- for(int c = 0; c < 3; ++c)
- {
- if(m_up_pic_data[c])
- ClipComponent(*(m_up_pic_data[c]), (CompSort) c);
+ for (int c=0; c<3; ++c){
+ if (m_up_pic_data[c])
+ ClipComponent( *(m_up_pic_data[c]), (CompSort) c );
}
}
void Picture::ClearData()
{
- for(int c = 0; c < 3; ++c)
- {
- if(m_pic_data[c] != NULL)
- {
+ for (int c=0;c<3;++c){
+ if (m_pic_data[c] != NULL){
delete m_pic_data[c];
m_pic_data[c] = NULL;
}
- if(m_up_pic_data[c] != NULL)
- {
+ if (m_up_pic_data[c] != NULL){
delete m_up_pic_data[c];
m_up_pic_data[c] = NULL;
}
@@ -329,16 +317,16 @@ void Picture::ClearData()
}
-void Picture::ReconfigPicture(const PictureParams &pp)
+void Picture::ReconfigPicture(const PictureParams &pp )
{
PictureParams old_pp = m_pparams;
m_pparams = pp;
// HAve picture dimensions or Chroma format changed ?
- if(m_pparams.Xl() == old_pp.Xl() &&
- m_pparams.Yl() == old_pp.Yl() &&
- m_pparams.CFormat() == old_pp.CFormat())
+ if (m_pparams.Xl() == old_pp.Xl() &&
+ m_pparams.Yl() == old_pp.Yl() &&
+ m_pparams.CFormat() == old_pp.CFormat())
return;
// Picture dimensions have changed. Re-initialise
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.h
index efc2b2d03..face2d15d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture.h
@@ -43,129 +43,105 @@
namespace dirac
{
-//! A class for encapsulating all the data relating to a picture.
-/*!
- A class for encapsulating all the data relating to a picture - all the
- component data, including upconverted data.
- */
-class Picture
-{
-
-public:
-
- //! Constructor
+ //! A class for encapsulating all the data relating to a picture.
/*!
- Constructor initialises the picture parameters and the data
+ A class for encapsulating all the data relating to a picture - all the
+ component data, including upconverted data.
*/
- Picture(const PictureParams& pp);
+ class Picture
+ {
- //! Copy constructor. Private as not currently used [may want to implement reference counting later.]
- Picture(const Picture& cpy);
+ public:
- //! Destructor
- virtual ~Picture();
+ //! Constructor
+ /*!
+ Constructor initialises the picture parameters and the data
+ */
+ Picture( const PictureParams& pp );
- //! Assignment =. Private as not currently used [may want to implement reference counting later.]
- Picture& operator=(const Picture& rhs);
+ //! Copy constructor. Private as not currently used [may want to implement reference counting later.]
+ Picture(const Picture& cpy);
- //! Picture Fill
- /*!
- Initialise contents of picture with value provided
- */
- void Fill(ValueType val);
+ //! Destructor
+ virtual ~Picture();
- //gets and sets
- //! Gets the picture parameters
- PictureParams& GetPparams() const
- {
- return m_pparams;
- }
+ //! Assignment =. Private as not currently used [may want to implement reference counting later.]
+ Picture& operator=( const Picture& rhs );
- //! Sets the picture sort
- void SetPictureSort(const PictureSort ps)
- {
- m_pparams.SetPicSort(ps);
- }
+ //! Picture Fill
+ /*!
+ Initialise contents of picture with value provided
+ */
+ void Fill(ValueType val );
- //! Sets the picture type
- void SetPictureType(const PictureType ftype)
- {
- m_pparams.SetPictureType(ftype);
- }
+ //gets and sets
+ //! Gets the picture parameters
+ PictureParams& GetPparams() const {return m_pparams;}
- //! Sets the picture type
- void SetReferenceType(const ReferenceType rtype)
- {
- m_pparams.SetReferenceType(rtype);
- }
+ //! Sets the picture sort
+ void SetPictureSort( const PictureSort ps ){m_pparams.SetPicSort( ps ); }
- //! Reconfigures to the new parameters.
- void ReconfigPicture(const PictureParams &pp);
+ //! Sets the picture type
+ void SetPictureType( const PictureType ftype ){m_pparams.SetPictureType( ftype ); }
- //! Returns a given component
- PicArray& Data(CompSort cs)
- {
- return *m_pic_data[(int) cs];
- }
+ //! Sets the picture type
+ void SetReferenceType( const ReferenceType rtype ){m_pparams.SetReferenceType( rtype ); }
- //! Returns a given component
- const PicArray& Data(CompSort cs) const
- {
- return *m_pic_data[(int) cs];
- }
+ //! Reconfigures to the new parameters.
+ void ReconfigPicture( const PictureParams &pp );
- //! Returns a given upconverted component
- PicArray& UpData(CompSort cs);
+ //! Returns a given component
+ PicArray& Data(CompSort cs){return *m_pic_data[(int) cs];}
- //! Returns a given upconverted component
- const PicArray& UpData(CompSort cs) const;
+ //! Returns a given component
+ const PicArray& Data(CompSort cs) const{return *m_pic_data[(int) cs];}
- //! Returns the wavelet coefficient data
- const CoeffArray& WltData(CompSort c) const
- {
- return m_wlt_data[(int) c];
- }
+ //! Returns a given upconverted component
+ PicArray& UpData(CompSort cs);
- //! Returns the wavelet coefficient data
- CoeffArray& WltData(CompSort c)
- {
- return m_wlt_data[(int) c];
- }
+ //! Returns a given upconverted component
+ const PicArray& UpData(CompSort cs) const;
- //! Initialises the wavelet coefficient data arrays;
- void InitWltData(const int transform_depth);
+ //! Returns the wavelet coefficient data
+ const CoeffArray& WltData( CompSort c ) const { return m_wlt_data[(int) c]; }
- //! Clip the data to prevent overshoot
- /*!
- Clips the data to lie between 0 and (1<<video_depth)-1
- */
- void Clip();
+ //! Returns the wavelet coefficient data
+ CoeffArray& WltData( CompSort c ) { return m_wlt_data[(int) c]; }
- //! Clip the upconverted data to prevent overshoot
- /*!
- Clips the upconverted data to lie between 0 and (1<<video_depth)-1
- */
- void ClipUpData();
+ //! Initialises the wavelet coefficient data arrays;
+ void InitWltData( const int transform_depth );
+
+ //! Clip the data to prevent overshoot
+ /*!
+ Clips the data to lie between 0 and (1<<video_depth)-1
+ */
+ void Clip();
+
+ //! Clip the upconverted data to prevent overshoot
+ /*!
+ Clips the upconverted data to lie between 0 and (1<<video_depth)-1
+ */
+ void ClipUpData();
-protected:
- mutable PictureParams m_pparams;
- PicArray* m_pic_data[3];//the picture data
- mutable PicArray* m_up_pic_data[3];//upconverted data. Mutable because we
- //create them on the fly even in const
- //functions.
+ protected:
+ mutable PictureParams m_pparams;
+ PicArray* m_pic_data[3];//the picture data
+ mutable PicArray* m_up_pic_data[3];//upconverted data. Mutable because we
+ //create them on the fly even in const
+ //functions.
- CoeffArray m_wlt_data[3];// the wavelet coefficient data
+ CoeffArray m_wlt_data[3];// the wavelet coefficient data
- //! Initialises the picture once the picture parameters have been set
- virtual void Init();
+ //! Initialises the picture once the picture parameters have been set
+ virtual void Init();
- //! Delete all the data
- virtual void ClearData();
+ //! Delete all the data
+ virtual void ClearData();
- //! Clip an individual component
- void ClipComponent(PicArray& pic_data, CompSort cs) const;
+ //! Clip an individual component
+ void ClipComponent(PicArray& pic_data, CompSort cs) const;
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.cpp
index 084b5e258..cbd311003 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.cpp
@@ -42,22 +42,21 @@
using namespace dirac;
//Simple constructor for decoder operation
-PictureBuffer::PictureBuffer() {}
+PictureBuffer::PictureBuffer(){}
//Copy constructor. Why anyone would need this I don't know.
PictureBuffer::PictureBuffer(const PictureBuffer& cpy)
-{
+ {
// first delete all frames in the current buffer
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
delete m_pic_data[i];
}//i
// next create new arrays, copying from the initialising buffer
m_pic_data.resize(cpy.m_pic_data.size());
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
- {
- m_pic_data[i] = new Picture(*(cpy.m_pic_data[i]));
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i){
+ m_pic_data[i] = new Picture( *(cpy.m_pic_data[i]) );
}//i
// now copy the map
@@ -69,21 +68,20 @@ PictureBuffer::PictureBuffer(const PictureBuffer& cpy)
}
//Assignment=. Not sure why this would be used either.
-PictureBuffer& PictureBuffer::operator=(const PictureBuffer& rhs)
-{
- if(&rhs != this)
+PictureBuffer& PictureBuffer::operator=(const PictureBuffer& rhs){
+ if (&rhs!=this)
{
// delete all the frames in the lhs buffer
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
delete m_pic_data[i];
}//i
// next create new arrays, copying from the rhs
m_pic_data.resize(rhs.m_pic_data.size());
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- m_pic_data[i] = new Picture(*(rhs.m_pic_data[i]));
+ m_pic_data[i] = new Picture( *(rhs.m_pic_data[i]) );
}//i
// now copy the map
@@ -99,80 +97,76 @@ PictureBuffer& PictureBuffer::operator=(const PictureBuffer& rhs)
//Destructor
PictureBuffer::~PictureBuffer()
{
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ;++i)
delete m_pic_data[i];
}
-Picture& PictureBuffer::GetPicture(const unsigned int pnum)
-{
- //get picture with a given picture number, NOT with a given position in the buffer.
-//If the picture number does not occur, the first picture in the buffer is returned.
+Picture& PictureBuffer::GetPicture( const unsigned int pnum )
+{//get picture with a given picture number, NOT with a given position in the buffer.
+ //If the picture number does not occur, the first picture in the buffer is returned.
- std::map<unsigned int, unsigned int>::iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::iterator it = m_pnum_map.find(pnum);
unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ if (it != m_pnum_map.end())
pos = it->second;
return *(m_pic_data[pos]);
}
-const Picture& PictureBuffer::GetPicture(const unsigned int pnum) const
-{
- //as above, but const version
+const Picture& PictureBuffer::GetPicture( const unsigned int pnum ) const
+{ //as above, but const version
- std::map<unsigned int, unsigned int>::const_iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::const_iterator it = m_pnum_map.find(pnum);
- unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ unsigned int pos=0;
+ if (it != m_pnum_map.end())
pos = it->second;
return *(m_pic_data[pos]);
}
-Picture& PictureBuffer::GetPicture(const unsigned int pnum, bool& is_present)
-{
- //get picture with a given picture number, NOT with a given position in the buffer.
-//If the picture number does not occur, the first picture in the buffer is returned.
+Picture& PictureBuffer::GetPicture( const unsigned int pnum, bool& is_present )
+{//get picture with a given picture number, NOT with a given position in the buffer.
+ //If the picture number does not occur, the first picture in the buffer is returned.
- std::map<unsigned int, unsigned int>::iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::iterator it = m_pnum_map.find(pnum);
unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ if (it != m_pnum_map.end())
{
is_present = true;
pos = it->second;
}
else
- is_present = false;
+ is_present=false;
return *(m_pic_data[pos]);
}
-const Picture& PictureBuffer::GetPicture(const unsigned int pnum, bool& is_present) const
-{
- //as above, but const version
+const Picture& PictureBuffer::GetPicture( const unsigned int pnum, bool& is_present ) const
+{ //as above, but const version
- std::map<unsigned int, unsigned int>::const_iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::const_iterator it = m_pnum_map.find(pnum);
- unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ unsigned int pos=0;
+ if (it != m_pnum_map.end())
{
is_present = true;
pos = it->second;
}
else
- is_present = false;
+ is_present=false;
return *(m_pic_data[pos]);
}
-bool PictureBuffer::IsPictureAvail(const unsigned int pnum) const
+bool PictureBuffer::IsPictureAvail( const unsigned int pnum ) const
{
- std::map<unsigned int, unsigned int>::const_iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::const_iterator it = m_pnum_map.find(pnum);
- if(it != m_pnum_map.end())
+ if (it != m_pnum_map.end())
return true;
else
return false;
@@ -180,22 +174,21 @@ bool PictureBuffer::IsPictureAvail(const unsigned int pnum) const
std::vector<int> PictureBuffer::Members() const
{
- std::vector<int> members(0);
- for(unsigned int i = 0; i < m_pic_data.size(); ++i)
+ std::vector<int> members( 0 );
+ for (unsigned int i=0; i<m_pic_data.size(); ++i )
{
const PictureParams& pparams = m_pic_data[i]->GetPparams();
- members.push_back(pparams.PictureNum());
+ members.push_back( pparams.PictureNum() );
}// i
return members;
}
-void PictureBuffer::PushPicture(const PictureParams& pp)
-{
- // Put a new picture onto the top of the stack
+void PictureBuffer::PushPicture( const PictureParams& pp )
+{// Put a new picture onto the top of the stack
// if picture is present - return
- if(IsPictureAvail(pp.PictureNum()))
+ if (IsPictureAvail(pp.PictureNum()))
return;
// if ( pp.PicSort().IsRef() )
@@ -204,19 +197,19 @@ void PictureBuffer::PushPicture(const PictureParams& pp)
Picture* pptr = new Picture(pp);
// add the picture to the buffer
m_pic_data.push_back(pptr);
-
+
// put the picture number into the index table
- std::pair<unsigned int, unsigned int> temp_pair(pp.PictureNum() , m_pic_data.size() - 1);
+ std::pair<unsigned int,unsigned int> temp_pair(pp.PictureNum() , m_pic_data.size()-1 );
m_pnum_map.insert(temp_pair);
}
-void PictureBuffer::CopyPicture(const Picture& picture)
+void PictureBuffer::CopyPicture( const Picture& picture )
{
PushPicture(picture.GetPparams());
bool is_present;
- Picture & p = GetPicture(picture.GetPparams().PictureNum(), is_present);
+ Picture & p= GetPicture(picture.GetPparams().PictureNum(), is_present);
if(is_present)
p = picture;
}
@@ -225,18 +218,18 @@ void PictureBuffer::ClearSlot(const unsigned int pos)
{
// Clear a slot corresponding to position pos to take more data
- std::pair<unsigned int, unsigned int>* tmp_pair;
+ std::pair<unsigned int,unsigned int>* tmp_pair;
- if(pos < m_pic_data.size())
+ if (pos<m_pic_data.size())
{
delete m_pic_data[pos];
- m_pic_data.erase(m_pic_data.begin() + pos);
+ m_pic_data.erase( m_pic_data.begin()+pos );
- //make a new map
+ //make a new map
m_pnum_map.clear();
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- tmp_pair = new std::pair<unsigned int, unsigned int>(m_pic_data[i]->GetPparams().PictureNum() , i);
+ tmp_pair = new std::pair<unsigned int,unsigned int>( m_pic_data[i]->GetPparams().PictureNum() , i);
m_pnum_map.insert(*tmp_pair);
delete tmp_pair;
}//i
@@ -246,17 +239,15 @@ void PictureBuffer::ClearSlot(const unsigned int pos)
void PictureBuffer::SetRetiredPictureNum(const int show_pnum, const int current_coded_pnum)
{
- if(IsPictureAvail(current_coded_pnum))
+ if ( IsPictureAvail(current_coded_pnum))
{
PictureParams &pparams = GetPicture(current_coded_pnum).GetPparams();
pparams.SetRetiredPictureNum(-1);
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- if(m_pic_data[i]->GetPparams().PicSort().IsRef())
- {
- if((m_pic_data[i]->GetPparams().PictureNum() + m_pic_data[i]->GetPparams().ExpiryTime()) <= show_pnum)
- {
- pparams.SetRetiredPictureNum(m_pic_data[i]->GetPparams().PictureNum());
+ if (m_pic_data[i]->GetPparams().PicSort().IsRef() ){
+ if ( (m_pic_data[i]->GetPparams().PictureNum() + m_pic_data[i]->GetPparams().ExpiryTime() ) <= show_pnum){
+ pparams.SetRetiredPictureNum(m_pic_data[i]->GetPparams().PictureNum());
break;
}
}
@@ -266,9 +257,8 @@ void PictureBuffer::SetRetiredPictureNum(const int show_pnum, const int current_
void PictureBuffer::Remove(const int pnum)
{
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
- {
- if(m_pic_data[i]->GetPparams().PictureNum() == pnum)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i){
+ if ( m_pic_data[i]->GetPparams().PictureNum() == pnum)
ClearSlot(i);
}//i
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.h
index 70c2e4ab2..86613720e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/picture_buffer.h
@@ -46,153 +46,152 @@
namespace dirac
{
-//! Holds pictures both for reference and to overcome reordering delay
-/*!
- The buffer holds pictures in a stack to overcome both reordering due to
- bi-directional prediction and use as references for subsequence motion
- estimation. Pictures, and components of pictures, can be accessed by their
- picture numbers. GOP parameters can be included in the constructors so
- that pictures can be given types (I picture, L1 picture or L2 picture) on
- being pushed onto the stack; alternatively, these parameters can be
- overridden.
-*/
-class PictureBuffer
-{
-public:
- //! Default Constructor
- PictureBuffer();
-
- //! Constructor
- /*!
- Creates a PictureBuffer using the chroma format. Suitable for
- compressing when there are no L2 pictures, or when the temporal
- prediction structure is to be determined on the fly.
-
- \param cf the Chroma format of pictures in the buffer
- \param xlen the luma width of pictures in the buffer
- \param ylen the luma height of pictures in the buffer
- \param luma_depth the video depth of the luma comp in the buffer
- \param chroma_depth the video depth of the chroma comp in the buffer
- \param using_ac True if using Arithmetic coding to code coefficient data
-
- */
- PictureBuffer(ChromaFormat cf,
- const int xlen,
- const int ylen,
- const unsigned int luma_depth,
- const unsigned int chroma_depth,
- bool using_ac);
-
- //! Constructor
- /*!
- Creates a PictureBuffer using the chroma format, the number of L1
- pictures between I pictures and the separation in pictures between L1
- pictures. Suitable for compressing when there is a full GOP structure
- or when the temporal prediction structure is to be determined on
- the fly.
-
- \param cf the Chroma format of pictures in the buffer
- \param numL1 the number of Layer 1 pictures before the next I picture. 0 means that there is only one I picture.
- \param L1sep the number of Layer 2 pictures between Layer 1 pictures
- \param xlen the luma width of pictures in the buffer
- \param ylen the luma height of pictures in the buffer
- \param luma_depth the video depth of the luma comp in the buffer
- \param chroma_depth the video depth of the chroma comp in the buffer
- \param interlace Set true if material is being coded in interlaced mode
- \param using_ac True if using Arithmetic coding to code coefficient data
- */
- PictureBuffer(ChromaFormat cf,
- const int numL1,
- const int L1sep,
- const int xlen,
- const int ylen,
- const unsigned int luma_depth,
- const unsigned int chroma_depth,
- bool interlace,
- bool using_ac);
-
- //! Copy constructor
- /*!
- Copy constructor. Removes the current contents of the pictureture buffer
- and copies in the contents of the initialising buffer.
- */
- PictureBuffer(const PictureBuffer& cpy);
-
- //! Operator=.
- /*!
- Operator=. Assigns all elements of the rhs to the lhs.
- */
- PictureBuffer& operator=(const PictureBuffer& rhs);
-
- //! Destructor
- ~PictureBuffer();
-
- //! Get picture with a given picture number (NOT with a given position in the buffer)
- Picture& GetPicture(const unsigned int pnum);
-
- //! Get picture with a given picture number (NOT with a given position in the buffer)
- const Picture& GetPicture(const unsigned int pnum) const;
-
- //! Get picture with a given picture number, setting a flag to true if it's there
- Picture& GetPicture(const unsigned int pnum, bool& is_present);
-
- //! Get picture with a given picture number, setting a flag to true if it's there
- const Picture& GetPicture(const unsigned int pnum, bool& is_present) const;
-
- //! Return true if picture with the particular picture number is available else return false
- bool IsPictureAvail(const unsigned int pnum) const;
-
- //! Returns a list of member pictures
- std::vector<int> Members() const;
-
- //! Put a new picture into the top of the buffer
- /*!
- Put a new picture into the top of the buffer. Picture parameters
- associated with the picture will be as given by the picture parameter
- object.
- */
- void PushPicture(const PictureParams& pp);
-
- //! Put a copy of a new picture into the buffer
- /*!
- Put a copy of a new picture into the buffer.
- */
- void CopyPicture(const Picture& picture);
-
- //! Sets the reference picture number that will be cleaned
- /*!
- Indicate which picture which has been output and which is no longer
- required for reference. Expiry times are set in each picture's
- picture parameters.
- \param show_pnum picture number in display order that can be output
- \param current_coded_pnum picture number in display order of picture currently being coded
- */
- void SetRetiredPictureNum(const int show_pnum, const int current_coded_pnum);
-
- //! Delete picture
- /*!
- Delete picture.
- \param pnum picture number in display order to be deleted from picture buffer
- */
- void Remove(int pnum);
-
-private:
- //! Clear internal data slot number pos
+ //! Holds pictures both for reference and to overcome reordering delay
/*!
- Clear internal data slot number pos
+ The buffer holds pictures in a stack to overcome both reordering due to
+ bi-directional prediction and use as references for subsequence motion
+ estimation. Pictures, and components of pictures, can be accessed by their
+ picture numbers. GOP parameters can be included in the constructors so
+ that pictures can be given types (I picture, L1 picture or L2 picture) on
+ being pushed onto the stack; alternatively, these parameters can be
+ overridden.
*/
- void ClearSlot(const unsigned int pos);
+ class PictureBuffer{
+ public:
+ //! Default Constructor
+ PictureBuffer();
+
+ //! Constructor
+ /*!
+ Creates a PictureBuffer using the chroma format. Suitable for
+ compressing when there are no L2 pictures, or when the temporal
+ prediction structure is to be determined on the fly.
+
+ \param cf the Chroma format of pictures in the buffer
+ \param xlen the luma width of pictures in the buffer
+ \param ylen the luma height of pictures in the buffer
+ \param luma_depth the video depth of the luma comp in the buffer
+ \param chroma_depth the video depth of the chroma comp in the buffer
+ \param using_ac True if using Arithmetic coding to code coefficient data
+
+ */
+ PictureBuffer(ChromaFormat cf,
+ const int xlen,
+ const int ylen,
+ const unsigned int luma_depth,
+ const unsigned int chroma_depth,
+ bool using_ac);
+
+ //! Constructor
+ /*!
+ Creates a PictureBuffer using the chroma format, the number of L1
+ pictures between I pictures and the separation in pictures between L1
+ pictures. Suitable for compressing when there is a full GOP structure
+ or when the temporal prediction structure is to be determined on
+ the fly.
+
+ \param cf the Chroma format of pictures in the buffer
+ \param numL1 the number of Layer 1 pictures before the next I picture. 0 means that there is only one I picture.
+ \param L1sep the number of Layer 2 pictures between Layer 1 pictures
+ \param xlen the luma width of pictures in the buffer
+ \param ylen the luma height of pictures in the buffer
+ \param luma_depth the video depth of the luma comp in the buffer
+ \param chroma_depth the video depth of the chroma comp in the buffer
+ \param interlace Set true if material is being coded in interlaced mode
+ \param using_ac True if using Arithmetic coding to code coefficient data
+ */
+ PictureBuffer(ChromaFormat cf,
+ const int numL1,
+ const int L1sep,
+ const int xlen,
+ const int ylen,
+ const unsigned int luma_depth,
+ const unsigned int chroma_depth,
+ bool interlace,
+ bool using_ac);
+
+ //! Copy constructor
+ /*!
+ Copy constructor. Removes the current contents of the pictureture buffer
+ and copies in the contents of the initialising buffer.
+ */
+ PictureBuffer(const PictureBuffer& cpy);
+
+ //! Operator=.
+ /*!
+ Operator=. Assigns all elements of the rhs to the lhs.
+ */
+ PictureBuffer& operator=(const PictureBuffer& rhs);
+
+ //! Destructor
+ ~PictureBuffer();
+
+ //! Get picture with a given picture number (NOT with a given position in the buffer)
+ Picture& GetPicture(const unsigned int pnum );
+
+ //! Get picture with a given picture number (NOT with a given position in the buffer)
+ const Picture& GetPicture(const unsigned int pnum) const;
+
+ //! Get picture with a given picture number, setting a flag to true if it's there
+ Picture& GetPicture(const unsigned int pnum, bool& is_present);
+
+ //! Get picture with a given picture number, setting a flag to true if it's there
+ const Picture& GetPicture(const unsigned int pnum, bool& is_present) const;
+
+ //! Return true if picture with the particular picture number is available else return false
+ bool IsPictureAvail(const unsigned int pnum) const;
+
+ //! Returns a list of member pictures
+ std::vector<int> Members() const;
+
+ //! Put a new picture into the top of the buffer
+ /*!
+ Put a new picture into the top of the buffer. Picture parameters
+ associated with the picture will be as given by the picture parameter
+ object.
+ */
+ void PushPicture(const PictureParams& pp);
+
+ //! Put a copy of a new picture into the buffer
+ /*!
+ Put a copy of a new picture into the buffer.
+ */
+ void CopyPicture( const Picture& picture );
+
+ //! Sets the reference picture number that will be cleaned
+ /*!
+ Indicate which picture which has been output and which is no longer
+ required for reference. Expiry times are set in each picture's
+ picture parameters.
+ \param show_pnum picture number in display order that can be output
+ \param current_coded_pnum picture number in display order of picture currently being coded
+ */
+ void SetRetiredPictureNum(const int show_pnum, const int current_coded_pnum);
+
+ //! Delete picture
+ /*!
+ Delete picture.
+ \param pnum picture number in display order to be deleted from picture buffer
+ */
+ void Remove(int pnum);
+
+ private:
+ //! Clear internal data slot number pos
+ /*!
+ Clear internal data slot number pos
+ */
+ void ClearSlot(const unsigned int pos);
// //! the count of the number of reference pictures in the buffer
// int m_ref_count;
- //! the buffer storing all the values
- std::vector<Picture*> m_pic_data;
+ //! the buffer storing all the values
+ std::vector<Picture*> m_pic_data;
- //!the map from picture numbers to position in the buffer
- std::map<unsigned int, unsigned int> m_pnum_map;
+ //!the map from picture numbers to position in the buffer
+ std::map<unsigned int,unsigned int> m_pnum_map;
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.cpp
index c905b794d..5535a66da 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.cpp
@@ -44,7 +44,7 @@ using namespace dirac;
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define CLIP(x,min,max) MAX(MIN(x,max),min)
-UpConverter::UpConverter(int min_val, int max_val, int orig_xlen, int orig_ylen) :
+UpConverter::UpConverter (int min_val, int max_val, int orig_xlen, int orig_ylen) :
m_min_val(min_val),
m_max_val(max_val),
m_orig_xl(orig_xlen),
@@ -55,23 +55,23 @@ UpConverter::UpConverter(int min_val, int max_val, int orig_xlen, int orig_ylen)
void UpConverter::DoUpConverter(const PicArray& pic_data, PicArray& up_data)
{
- m_width_old = std::min(pic_data.LengthX(), m_orig_xl);
- m_height_old = std::min(pic_data.LengthY(), m_orig_yl);
- m_width_new = std::min(2 * m_width_old, up_data.LengthX());
- m_height_new = std::min(2 * m_height_old, up_data.LengthY());
+ m_width_old = std::min (pic_data.LengthX(), m_orig_xl);
+ m_height_old = std::min (pic_data.LengthY(), m_orig_yl);
+ m_width_new = std::min(2*m_width_old, up_data.LengthX());
+ m_height_new = std::min(2*m_height_old, up_data.LengthY());
// Filter params
const int filter_size = 4;
const int filter_shift = 5;
- const short taps[4] = {21, -7, 3, -1};
+ const short taps[4] = {21,-7,3,-1};
//Variables that will be used by the filter calculations
ValueType sum;
int ypos(0);
+
-
- //There are three y loops to cope with the leading edge, middle
+ //There are three y loops to cope with the leading edge, middle
//and trailing edge of each column.
for(int y = 0 ; y < filter_size; ++y , ypos += 2)
@@ -81,14 +81,14 @@ void UpConverter::DoUpConverter(const PicArray& pic_data, PicArray& up_data)
//This means our main loop is in the x direction and
//there is a much greater chance the data we need will
//be in the cache.
- for(int x = 0 , xpos = 0; x < m_width_old; x++ , xpos += 2)
+ for(int x = 0 , xpos = 0; x < m_width_old; x++ , xpos+=2 )
{
// Copy a Pixel from the original image in each even position
up_data[ypos][xpos] = pic_data[y][x];
//Work out the next pixel from filtered values.
//Excuse the complicated ternary stuff but it sorts out the edge
- sum = 1 << (filter_shift - 1);
+ sum = 1 << (filter_shift-1);
sum += (pic_data[y][x] + pic_data[y+1][x]) * taps[0];
sum += (pic_data[(y>=1)?(y-1):0][x] + pic_data[y+2][x]) * taps[1];
sum += (pic_data[(y>=2)?(y-2):0][x] + pic_data[y+3][x]) * taps[2];
@@ -99,38 +99,38 @@ void UpConverter::DoUpConverter(const PicArray& pic_data, PicArray& up_data)
}// x, xpos
// The row loop.
- RowLoop(up_data , ypos, filter_size, filter_shift, taps);
+ RowLoop( up_data , ypos, filter_size, filter_shift, taps );
}// y, ypos
// This loop is like the last one but it deals with the centre
// section of the image and so the ternary operations are dropped
// from the filter section.
for(int y = filter_size; y < m_height_old - filter_size; ++y , ypos += 2)
{
- for(int x = 0 , xpos = 0; x < m_width_old; x++ , xpos += 2)
+ for(int x = 0 , xpos=0; x < m_width_old; x++ , xpos+=2 )
{
up_data[ypos][xpos] = pic_data[y][x];
- sum = 1 << (filter_shift - 1);
-
- for(int t = 0; t < filter_size; ++t)
+ sum = 1 << (filter_shift-1);
+
+ for (int t=0; t<filter_size; ++t)
sum += (pic_data[y-t][x] + pic_data[y+1+t][x]) * taps[t];
sum >>= filter_shift;
up_data[ypos+1][xpos] = CLIP(sum, m_min_val, m_max_val);
}// x,xpos
- RowLoop(up_data , ypos, filter_size, filter_shift, taps);
+ RowLoop( up_data , ypos, filter_size, filter_shift, taps );
- }// y, ypos
+ }// y, ypos
// Another similar loop! - this time we are dealing with
// the trailing edge so the ternary stuff is back in the
- // filter calcs but in the second parameter.
- for(int y = m_height_old - filter_size; y < m_height_old; ++y , ypos += 2)
+ // filter calcs but in the second parameter.
+ for(int y = m_height_old - filter_size; y < m_height_old; ++y , ypos+=2)
{
- for(int x = 0 , xpos = 0 ; x < m_width_old; x++ , xpos += 2)
+ for(int x = 0 , xpos=0 ; x < m_width_old; x++ , xpos+=2)
{
- up_data[ypos][xpos] = pic_data[y][x];
+ up_data[ypos][xpos]=pic_data[y][x];
- sum = 1 << (filter_shift - 1);
+ sum = 1 << (filter_shift-1);
sum += (pic_data[y][x] + pic_data[((y+1)<m_height_old)?(y+1):(m_height_old-1)][x]) * taps[0];
sum += (pic_data[y - 1][x] + pic_data[((y+2)<m_height_old)?(y+2):(m_height_old-1)][x]) * taps[1];
sum += (pic_data[y - 2][x] + pic_data[((y+3)<m_height_old)?(y+3):(m_height_old-1)][x]) * taps[2];
@@ -139,19 +139,19 @@ void UpConverter::DoUpConverter(const PicArray& pic_data, PicArray& up_data)
sum >>= filter_shift;
up_data[ypos+1][xpos] = CLIP(sum, m_min_val, m_max_val);
}//x,xpos
- RowLoop(up_data , ypos, filter_size, filter_shift, taps);
+ RowLoop( up_data , ypos, filter_size, filter_shift, taps );
}//y,ypos
}
-void UpConverter::RowLoop(PicArray&up_data, const int row_num,
- const int filter_size, const int filter_shift, const short taps[4])
+void UpConverter::RowLoop(PicArray&up_data, const int row_num,
+const int filter_size, const int filter_shift, const short taps[4] )
{
- const int dble_size(filter_size << 1);
+ const int dble_size( filter_size<<1 );
//Calculation variable
ValueType sum;
- int ypos;
+ int ypos;
//Leading row Edge
//Note the factor of two difference as we only want to fill in every other
@@ -160,9 +160,9 @@ void UpConverter::RowLoop(PicArray&up_data, const int row_num,
{
ypos = row_num + j;
- for(int x = 0; x < dble_size ; x += 2)
+ for(int x = 0; x < dble_size ; x+=2)
{
- sum = 1 << (filter_shift - 1);
+ sum = 1 << (filter_shift-1);
sum += (up_data[ypos][x] + up_data[ypos][x+2]) * taps[0];
sum += (up_data[ypos][(x>=2)?(x-2):0] + up_data[ypos][x+4]) * taps[1];
sum += (up_data[ypos][(x>=4)?(x-4):0] + up_data[ypos][x+6]) * taps[2];
@@ -173,11 +173,11 @@ void UpConverter::RowLoop(PicArray&up_data, const int row_num,
up_data[ypos][x+1] = CLIP(sum, m_min_val, m_max_val);
}// x
//Middle of row
- for(int x = dble_size; x < m_width_new - dble_size ; x += 2)
+ for(int x = dble_size; x<m_width_new-dble_size ; x+=2 )
{
- sum = 1 << (filter_shift - 1);
-
- for(int t = 0; t < filter_size; ++t)
+ sum = 1 << (filter_shift-1);
+
+ for (int t=0; t<filter_size; ++t)
sum += (up_data[ypos][x-2*t] + up_data[ypos][x+2+2*t]) * taps[t];
@@ -185,9 +185,9 @@ void UpConverter::RowLoop(PicArray&up_data, const int row_num,
up_data[ypos][x+1] = CLIP(sum, m_min_val, m_max_val);
}// x
//Trailing row edge
- for(int x = m_width_new - dble_size ; x < m_width_new ; x += 2)
+ for(int x = m_width_new - dble_size ; x<m_width_new ; x+=2)
{
- sum = 1 << (filter_shift - 1);
+ sum = 1 << (filter_shift-1);
sum += (up_data[ypos][x] + up_data[ypos][(((x+2)<m_width_new)?(x+2):(m_width_new-2))]) * taps[0];
sum += (up_data[ypos][x-2] + up_data[ypos][(((x+4)<m_width_new)?(x+4):(m_width_new-2))]) * taps[1];
sum += (up_data[ypos][x-4] + up_data[ypos][(((x+6)<m_width_new)?(x+6):(m_width_new-2))]) * taps[2];
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.h
index c250692e0..94d81026e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/upconvert.h
@@ -42,56 +42,56 @@
namespace dirac
{
-//Optimised upconversion class - no array resizes.
-//Uses integer math - no floats!
-//
-
-//! Upconversion class
-/*!
- Class to upconvert data by a factor of 2 in both dimensions
- */
-class UpConverter
-{
+ //Optimised upconversion class - no array resizes.
+ //Uses integer math - no floats!
+ //
+
+ //! Upconversion class
+ /*!
+ Class to upconvert data by a factor of 2 in both dimensions
+ */
+ class UpConverter
+ {
-public:
+ public:
- //! Constructor
- UpConverter(int min_val, int max_val, int orig_xlen, int orig_ylen);
+ //! Constructor
+ UpConverter(int min_val, int max_val, int orig_xlen, int orig_ylen);
- //! Destructor
- ~UpConverter() {};
+ //! Destructor
+ ~UpConverter() {};
- //! Upconvert the picture data
- /*!
- Upconvert the picture data, where the parameters are
- \param pic_data is the original data
- \param up_data is the upconverted data
- */
- void DoUpConverter(const PicArray& pic_data, PicArray& up_data);
+ //! Upconvert the picture data
+ /*!
+ Upconvert the picture data, where the parameters are
+ \param pic_data is the original data
+ \param up_data is the upconverted data
+ */
+ void DoUpConverter(const PicArray& pic_data, PicArray& up_data);
-private:
- //! Private body-less copy constructor: class should not be copied
- UpConverter(const UpConverter& cpy);
+ private:
+ //! Private body-less copy constructor: class should not be copied
+ UpConverter(const UpConverter& cpy);
- //! Private body-less assignment: class should not be assigned
- UpConverter& operator=(const UpConverter& rhs);
+ //! Private body-less assignment: class should not be assigned
+ UpConverter& operator=(const UpConverter& rhs);
- //! Applies the filter to a row and its successor
- void RowLoop(PicArray& up_data, const int row_num,
- const int filter_size, const int filter_shift, const short taps[4]);
+ //! Applies the filter to a row and its successor
+ void RowLoop(PicArray& up_data, const int row_num,
+ const int filter_size, const int filter_shift, const short taps[4] );
-private:
- //Variable to keep the loops in check
- int m_width_old, m_height_old;
- int m_width_new, m_height_new;
+ private:
+ //Variable to keep the loops in check
+ int m_width_old, m_height_old;
+ int m_width_new, m_height_new;
- const int m_min_val;
- const int m_max_val;
+ const int m_min_val;
+ const int m_max_val;
- const int m_orig_xl;
- const int m_orig_yl;
-};
+ const int m_orig_xl;
+ const int m_orig_yl;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.cpp
index 6cbf61ad7..683fd3065 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.cpp
@@ -63,7 +63,7 @@ void SetDefaultCodecParameters(CodecParams &cparams,
// Overridden from command line of encoder or in bytestream for decoder.
cparams.SetPictureCodingMode(0);
cparams.SetTopFieldFirst(true);
- switch(cparams.GetVideoFormat())
+ switch (cparams.GetVideoFormat())
{
case VIDEO_FORMAT_QSIF525:
case VIDEO_FORMAT_QCIF:
@@ -98,11 +98,11 @@ void SetDefaultCodecParameters(CodecParams &cparams,
break;
}
- if(ptype == INTER_PICTURE)
+ if (ptype == INTER_PICTURE)
{
- ASSERTM(num_refs > 0 && num_refs < 3, "Number of reference frames should be 1 or 2 fo INTER frames");
+ ASSERTM (num_refs > 0 && num_refs < 3, "Number of reference frames should be 1 or 2 fo INTER frames" );
OLBParams bparams;
- PicturePredParams& predparams = cparams.GetPicPredParams();
+ PicturePredParams& predparams = cparams.GetPicPredParams();
predparams.SetUsingGlobalMotion(false);
SetDefaultBlockParameters(bparams, cparams.GetVideoFormat());
predparams.SetLumaBlockParams(bparams);
@@ -128,7 +128,7 @@ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams)
sparams.SetTopOffset(0);
sparams.SetColourSpecification(1);
- switch(vf)
+ switch (vf)
{
case VIDEO_FORMAT_CUSTOM:
sparams.SetXl(640);
@@ -228,7 +228,7 @@ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams)
sparams.SetXl(1280);
sparams.SetYl(720);
sparams.SetCFormat(format422);
- if(vf == VIDEO_FORMAT_HD_720P50)
+ if (vf == VIDEO_FORMAT_HD_720P50)
sparams.SetFrameRate(FRAMERATE_50_FPS);
else
sparams.SetFrameRate(FRAMERATE_59p94_FPS);
@@ -244,7 +244,7 @@ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams)
sparams.SetXl(1920);
sparams.SetYl(1080);
sparams.SetCFormat(format422);
- switch(vf)
+ switch (vf)
{
case VIDEO_FORMAT_HD_1080I60:
sparams.SetSourceSampling(1);
@@ -294,7 +294,7 @@ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams)
sparams.SetYl(2160);
sparams.SetCFormat(format422);
sparams.SetSourceSampling(0);
- switch(vf)
+ switch (vf)
{
case VIDEO_FORMAT_UHDTV_4K60:
sparams.SetFrameRate(FRAMERATE_59p94_FPS);
@@ -316,7 +316,7 @@ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams)
sparams.SetYl(4320);
sparams.SetCFormat(format422);
sparams.SetSourceSampling(0);
- switch(vf)
+ switch (vf)
{
case VIDEO_FORMAT_UHDTV_8K60:
sparams.SetFrameRate(FRAMERATE_59p94_FPS);
@@ -332,7 +332,7 @@ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams)
sparams.SetCleanHeight(4320);
sparams.SetColourSpecification(3);
break;
- default:
+ default:
errstr << "Unsupported video format " << sparams.GetVideoFormat()
<< std::endl;
DIRAC_THROW_EXCEPTION(
@@ -350,7 +350,7 @@ void SetDefaultEncoderParameters(EncoderParams& encparams)
encparams.GetPicPredParams().SetMVPrecision(MV_PRECISION_HALF_PIXEL);
encparams.SetUsingAC(true);
- switch(encparams.GetVideoFormat())
+ switch (encparams.GetVideoFormat())
{
case VIDEO_FORMAT_4SIF525:
case VIDEO_FORMAT_4CIF:
@@ -397,7 +397,7 @@ void SetDefaultEncoderParameters(EncoderParams& encparams)
void SetDefaultBlockParameters(OLBParams& bparams,
const VideoFormat& video_format)
{
- switch(video_format)
+ switch (video_format)
{
case VIDEO_FORMAT_QCIF:
case VIDEO_FORMAT_QSIF525:
@@ -453,7 +453,7 @@ void SetDefaultBlockParameters(OLBParams& bparams,
void SetDefaultBlockParameters(OLBParams& bparams, int pidx)
{
- switch(pidx)
+ switch (pidx)
{
case 0: // custom - so undefined values
return;
@@ -478,20 +478,20 @@ void SetDefaultBlockParameters(OLBParams& bparams, int pidx)
}
}
-unsigned int BlockParametersIndex(const OLBParams& bparams)
+unsigned int BlockParametersIndex (const OLBParams& bparams)
{
OLBParams bparams_1(8, 8, 4, 4);
OLBParams bparams_2(12, 12, 8, 8);
OLBParams bparams_3(16, 16, 12, 12);
OLBParams bparams_4(24, 24, 16, 16);
- if(bparams == bparams_1)
+ if (bparams == bparams_1)
return 1;
- else if(bparams == bparams_2)
+ else if (bparams == bparams_2)
return 2;
- else if(bparams == bparams_3)
+ else if (bparams == bparams_3)
return 3;
- else if(bparams == bparams_4)
+ else if (bparams == bparams_4)
return 4;
else
return 0;
@@ -500,7 +500,7 @@ unsigned int BlockParametersIndex(const OLBParams& bparams)
void SetDefaultTransformFilter(const PictureType ptype, const VideoFormat video_format,
WltFilter &wf)
{
- switch(video_format)
+ switch (video_format)
{
case VIDEO_FORMAT_QCIF:
case VIDEO_FORMAT_QSIF525:
@@ -524,7 +524,7 @@ void SetDefaultTransformFilter(const PictureType ptype, const VideoFormat video_
case VIDEO_FORMAT_UHDTV_8K60:
case VIDEO_FORMAT_UHDTV_8K50:
default:
- if(ptype == INTRA_PICTURE)
+ if (ptype == INTRA_PICTURE)
wf = DD13_7;
else
wf = DD13_7;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.h
index dde834389..97426a833 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/video_format_defaults.h
@@ -47,56 +47,56 @@
namespace dirac
{
-/**
-* Sets default codec parameters - common to encoder and decoder
-*@param cparams Codec Params objects for setting defaults
-*@param ptype Picture type i,e, INTRA or INTER
-*@param num_refs Number of reference frames
-*/
-void SetDefaultCodecParameters(CodecParams &cparams, PictureType ptype, unsigned int num_refs);
-
-/**
-* Sets default encoder parameters
-*@param encparams Params objects for setting defaults
-*/
-void SetDefaultEncoderParameters(EncoderParams& encparams);
-
-/**
-* Sets default Source parameters
-*@param vf Video Format
-*@param sparams Params object for setting defaults
-*/
-void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams);
+ /**
+ * Sets default codec parameters - common to encoder and decoder
+ *@param cparams Codec Params objects for setting defaults
+ *@param ptype Picture type i,e, INTRA or INTER
+ *@param num_refs Number of reference frames
+ */
+ void SetDefaultCodecParameters (CodecParams &cparams, PictureType ptype, unsigned int num_refs);
+
+ /**
+ * Sets default encoder parameters
+ *@param encparams Params objects for setting defaults
+ */
+ void SetDefaultEncoderParameters(EncoderParams& encparams);
-/**
-* Sets default block parameters
-*@param bparams Params object for setting defaults
-*@param video_format Video format
-*/
-void SetDefaultBlockParameters(OLBParams& bparams,
- const VideoFormat& video_format);
+ /**
+ * Sets default Source parameters
+ *@param vf Video Format
+ *@param sparams Params object for setting defaults
+ */
+ void SetDefaultSourceParameters(const VideoFormat &vf, SourceParams& sparams);
-/**
-* Sets default block parameters
-*@param bparams Params object for setting defaults
-*@param pidx Index into Block Parameters table
-*/
-void SetDefaultBlockParameters(OLBParams& bparams,
- int pidx);
-/**
-* Returns index of block parameters in Defaults table
-*@param bparams Params object for getting index
-*/
-unsigned int BlockParametersIndex(const OLBParams& bparams);
+ /**
+ * Sets default block parameters
+ *@param bparams Params object for setting defaults
+ *@param video_format Video format
+ */
+ void SetDefaultBlockParameters(OLBParams& bparams,
+ const VideoFormat& video_format);
-/**
-* Sets the default Transform filter depending on picture type
-*@param ptype Picture type i.e. intra or inter
-*@param video_format The video format
-*@param wf WltFilter object for getting the default wavelet filter
-*/
-void SetDefaultTransformFilter(const PictureType ptype, const VideoFormat video_format,
- WltFilter &wf);
+ /**
+ * Sets default block parameters
+ *@param bparams Params object for setting defaults
+ *@param pidx Index into Block Parameters table
+ */
+ void SetDefaultBlockParameters(OLBParams& bparams,
+ int pidx);
+ /**
+ * Returns index of block parameters in Defaults table
+ *@param bparams Params object for getting index
+ */
+ unsigned int BlockParametersIndex(const OLBParams& bparams);
+
+ /**
+ * Sets the default Transform filter depending on picture type
+ *@param ptype Picture type i.e. intra or inter
+ *@param video_format The video format
+ *@param wf WltFilter object for getting the default wavelet filter
+ */
+ void SetDefaultTransformFilter( const PictureType ptype, const VideoFormat video_format,
+ WltFilter &wf);
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.cpp
index c4cf6081e..3a946d9c6 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.cpp
@@ -45,33 +45,31 @@ using namespace dirac;
// Default constructor
CodeBlock::CodeBlock()
- :
- m_skipped(false)
-{
- Init(0 , 0 , 0 , 0);
+:
+ m_skipped( false ){
+ Init( 0 , 0 , 0 , 0 );
}
// Constructor
-CodeBlock::CodeBlock(const int xstart ,
- const int ystart ,
- const int xend ,
- const int yend)
- :
- m_skipped(false)
+CodeBlock::CodeBlock( const int xstart ,
+ const int ystart ,
+ const int xend ,
+ const int yend)
+:
+ m_skipped( false )
{
- Init(xstart , ystart , xend , yend);
+ Init( xstart , ystart , xend , yend );
}
// Initialises the code block
-void CodeBlock::Init(const int xstart ,
- const int ystart ,
- const int xend ,
- const int yend)
-{
+void CodeBlock::Init( const int xstart ,
+ const int ystart ,
+ const int xend ,
+ const int yend ){
m_xstart = xstart;
m_xend = xend;
m_ystart = ystart;
- m_yend = yend;
+ m_yend= yend;
m_xl = xend - xstart;
m_yl = yend - ystart;
@@ -79,134 +77,127 @@ void CodeBlock::Init(const int xstart ,
// Default constructor
-Subband::Subband()
-{
+Subband::Subband(){
// this space intentionally left blank
}
// Constructor
-Subband::Subband(int xpos, int ypos, int xlen, int ylen):
- m_xp(xpos),
- m_yp(ypos),
- m_xl(xlen),
- m_yl(ylen),
- m_wt(1.0),
+Subband::Subband(int xpos,int ypos, int xlen, int ylen):
+ m_xp( xpos ),
+ m_yp( ypos ),
+ m_xl( xlen ),
+ m_yl( ylen ),
+ m_wt( 1.0 ),
m_code_block_array(),
- m_skipped(false)
-{
- SetNumBlocks(1 , 1);
+ m_skipped( false ){
+ SetNumBlocks( 1 , 1 );
}
// Constructor
-Subband::Subband(int xpos, int ypos, int xlen, int ylen, int d)
- :
- m_xp(xpos),
- m_yp(ypos),
- m_xl(xlen),
- m_yl(ylen),
- m_wt(1.0),
- m_depth(d),
+Subband::Subband(int xpos,int ypos, int xlen, int ylen, int d)
+ :
+ m_xp( xpos ),
+ m_yp( ypos ),
+ m_xl( xlen ),
+ m_yl( ylen ),
+ m_wt( 1.0 ),
+ m_depth( d ),
m_code_block_array(),
- m_skipped(false)
+ m_skipped( false )
{
- SetNumBlocks(1 , 1);
+ SetNumBlocks( 1 , 1 );
}
-void Subband::SetWt(const float w)
+void Subband::SetWt( const float w )
{
m_wt = w;
}
-void Subband::SetNumBlocks(const int ynum , const int xnum)
-{
- m_code_block_array.Resize(ynum , xnum);
+void Subband::SetNumBlocks( const int ynum , const int xnum){
+ m_code_block_array.Resize( ynum , xnum );
- OneDArray<int> xbounds(xnum + 1);
- OneDArray<int> ybounds(ynum + 1);
+ OneDArray<int> xbounds( xnum + 1 );
+ OneDArray<int> ybounds( ynum + 1 );
- for(int i = 0; i <= xnum ; ++i)
+ for (int i=0; i<=xnum ; ++i)
{
- xbounds[i] = (i * m_xl) / xnum + m_xp;
+ xbounds[i] = ( i * m_xl )/xnum + m_xp;
}// i
- for(int j = 0; j <= ynum ; ++j)
+ for (int j=0; j<=ynum ; ++j)
{
- ybounds[j] = (j * m_yl) / ynum + m_yp;
+ ybounds[j] = ( j * m_yl )/ynum + m_yp;
}// j
- for(int j = 0; j < m_code_block_array.LengthY() ; ++j)
- for(int i = 0; i < m_code_block_array.LengthX() ; ++i)
- m_code_block_array[j][i].Init(xbounds[i] , ybounds[j] ,
- xbounds[i+1] , ybounds[j+1]);
+ for (int j=0; j<m_code_block_array.LengthY() ; ++j)
+ for (int i=0; i<m_code_block_array.LengthX() ; ++i)
+ m_code_block_array[j][i].Init( xbounds[i] , ybounds[j] ,
+ xbounds[i+1] , ybounds[j+1] );
}
//! Destructor
-Subband::~Subband() {}
+Subband::~Subband(){}
//subband list methods
-void SubbandList::Init(const int depth, const int xlen, const int ylen)
-{
- int xl = xlen;
- int yl = ylen;
+void SubbandList::Init(const int depth,const int xlen,const int ylen){
+ int xl=xlen;
+ int yl=ylen;
Clear();
Subband* tmp;
- for(int level = 1; level <= depth; ++level)
- {
- xl /= 2;
- yl /= 2;
+ for (int level = 1; level <= depth; ++level){
+ xl/=2;
+ yl/=2;
/* HH */
- tmp = new Subband(xl , yl , xl , yl , level);
- AddBand(*tmp);
+ tmp=new Subband( xl , yl , xl , yl , level);
+ AddBand( *tmp );
delete tmp;
/* LH */
- tmp = new Subband(0 , yl , xl , yl , level);
- AddBand(*tmp);
+ tmp=new Subband( 0 , yl , xl , yl , level);
+ AddBand( *tmp );
delete tmp;
/* HL */
- tmp = new Subband(xl , 0 , xl , yl , level);
- AddBand(*tmp);
+ tmp=new Subband(xl , 0 , xl , yl , level);
+ AddBand( *tmp );
delete tmp;
- if(level == depth)
- {
+ if (level == depth){
/* LL */
- tmp = new Subband(0 , 0 , xl , yl , level);
- AddBand(*tmp);
+ tmp=new Subband( 0 , 0 , xl , yl , level);
+ AddBand( *tmp );
delete tmp;
}
}
//now set the parent-child relationships
int len = bands.size();
(*this)(len).SetParent(0);
- (*this)(len - 3).SetParent(0);
- (*this)(len - 2).SetParent(0);
- (*this)(len - 1).SetParent(0);
-
- for(int level = 2; level <= depth; ++level)
- {
- //do parent-child relationship for other bands
- (*this)(len - 3 *(level)).SetParent(len - 3 *(level - 1));
- (*this)(len - 3 *(level) + 1).SetParent(len - 3 *(level - 1) + 1);
- (*this)(len - 3 *(level) + 2).SetParent(len - 3 *(level - 1) + 2);
+ (*this)(len-3).SetParent(0);
+ (*this)(len-2).SetParent(0);
+ (*this)(len-1).SetParent(0);
+
+ for (int level = 2; level <= depth; ++level){
+ //do parent-child relationship for other bands
+ (*this)( len-3*(level) ).SetParent( len-3*(level-1) );
+ (*this)(len-3*(level)+1).SetParent(len-3*(level-1)+1);
+ (*this)(len-3*(level)+2).SetParent(len-3*(level-1)+2);
}// level
}
-void CoeffArray::SetBandWeights(const EncoderParams& encparams,
- const PictureParams& pparams,
- const CompSort csort,
- const float cpd_scale_factor)
+void CoeffArray::SetBandWeights (const EncoderParams& encparams,
+ const PictureParams& pparams,
+ const CompSort csort,
+ const float cpd_scale_factor)
{
const WltFilter wltfilter = encparams.TransformFilter();
const bool field_coding = encparams.FieldCoding();
const ChromaFormat cformat = pparams.CFormat();
- const float cpd = encparams.CPD() * cpd_scale_factor;
+ const float cpd = encparams.CPD()*cpd_scale_factor;
const PictureSort psort = pparams.PicSort();
int xlen, ylen, xl, yl, xp, yp;
@@ -217,14 +208,14 @@ void CoeffArray::SetBandWeights(const EncoderParams& encparams,
float chroma_xfac(1.0);
float chroma_yfac(1.0);
- if(csort != Y_COMP)
+ if( csort != Y_COMP)
{
- if(cformat == format422)
+ if( cformat == format422)
{
chroma_xfac = 2.0;
chroma_yfac = 1.0;
}
- else if(cformat == format420)
+ else if( cformat == format420 )
{
chroma_xfac = 2.0;
chroma_yfac = 2.0;
@@ -235,9 +226,9 @@ void CoeffArray::SetBandWeights(const EncoderParams& encparams,
xlen = 2 * m_band_list(1).Xl();
ylen = 2 * m_band_list(1).Yl();
- if(cpd != 0.0)
+ if (cpd != 0.0)
{
- for(int i = 1; i <= m_band_list.Length() ; i++)
+ for( int i = 1; i<=m_band_list.Length() ; i++ )
{
xp = m_band_list(i).Xp();
yp = m_band_list(i).Yp();
@@ -245,50 +236,49 @@ void CoeffArray::SetBandWeights(const EncoderParams& encparams,
yl = m_band_list(i).Yl();
- xfreq = cpd * (float(xp) + (float(xl) / 2.0)) / float(xlen);
- yfreq = cpd * (float(yp) + (float(yl) / 2.0)) / float(ylen);
+ xfreq = cpd * ( float(xp) + (float(xl)/2.0) ) / float(xlen);
+ yfreq = cpd * ( float(yp) + (float(yl)/2.0) ) / float(ylen);
if(field_coding)
- yfreq /= 2.0;
+ yfreq/=2.0;
- temp = PerceptualWeight(xfreq / chroma_xfac , yfreq / chroma_yfac , csort);
+ temp = PerceptualWeight( xfreq/chroma_xfac , yfreq/chroma_yfac , csort );
m_band_list(i).SetWt(temp);
}// i
// Make sure dc is always the lowest weight
- float min_weight = m_band_list(m_band_list.Length()).Wt();
+ float min_weight=m_band_list(m_band_list.Length()).Wt();
- for(int b = 1 ; b <= m_band_list.Length() - 1 ; b++)
- min_weight = ((min_weight > m_band_list(b).Wt()) ? m_band_list(b).Wt() : min_weight);
+ for( int b=1 ; b<=m_band_list.Length()-1 ; b++ )
+ min_weight = ((min_weight>m_band_list(b).Wt()) ? m_band_list(b).Wt() : min_weight);
- m_band_list(m_band_list.Length()).SetWt(min_weight);
+ m_band_list( m_band_list.Length() ).SetWt( min_weight );
// Now normalize weights so that white noise is always weighted the same
// Overall factor to ensure that white noise ends up with the same RMS, whatever the weight
- double overall_factor = 0.0;
+ double overall_factor=0.0;
//fraction of the total number of samples belonging to each subband
double subband_fraction;
- for(int i = 1 ; i <= m_band_list.Length() ; i++)
+ for( int i=1 ; i<=m_band_list.Length() ; i++ )
{
- subband_fraction = 1.0 / ((double) m_band_list(i).Scale() * m_band_list(i).Scale());
- overall_factor += subband_fraction / (m_band_list(i).Wt() * m_band_list(i).Wt());
+ subband_fraction = 1.0/((double) m_band_list(i).Scale() * m_band_list(i).Scale());
+ overall_factor += subband_fraction/( m_band_list(i).Wt() * m_band_list(i).Wt() );
}
- overall_factor = std::sqrt(overall_factor);
+ overall_factor = std::sqrt( overall_factor );
//go through and normalise
- for(int i = m_band_list.Length() ; i > 0 ; i--)
- m_band_list(i).SetWt(m_band_list(i).Wt() * overall_factor);
+ for( int i=m_band_list.Length() ; i>0 ; i-- )
+ m_band_list(i).SetWt( m_band_list(i).Wt() * overall_factor );
}
else
- {
- //cpd=0 so set all weights to 1
+ {//cpd=0 so set all weights to 1
- for(int i = 1 ; i <= m_band_list.Length() ; i++)
- m_band_list(i).SetWt(1.0);
+ for( int i=1 ; i<=m_band_list.Length() ; i++ )
+ m_band_list(i).SetWt( 1.0 );
}
@@ -298,93 +288,92 @@ void CoeffArray::SetBandWeights(const EncoderParams& encparams,
double hfac;
int filt_shift;
- switch(wltfilter)
- {
- case DD9_7 :
- lfac = 1.218660804;
- hfac = 0.780720058;
- filt_shift = 1;
-
- break;
-
- case LEGALL5_3 :
- lfac = 1.179535649;
- hfac = 0.81649658;
- filt_shift = 1;
-
- break;
-
- case DD13_7 :
- lfac = 1.235705971;
- hfac = 0.780719354;
- filt_shift = 1;
-
- break;
-
- case HAAR0 :
- lfac = 1.414213562;
- hfac = 0.707106781;
- filt_shift = 0;
-
- break;
-
- case HAAR1 :
- lfac = 1.414213562;
- hfac = 0.707106781;
- filt_shift = 1;
-
- break;
-
- case DAUB9_7 :
- lfac = 1.149604398;
- hfac = 0.869864452;
- filt_shift = 1;
-
- break;
-
- default:
- lfac = 1.0;
- hfac = 1.0;
- filt_shift = 0;
+ switch (wltfilter){
+ case DD9_7 :
+ lfac = 1.218660804;
+ hfac = 0.780720058;
+ filt_shift = 1;
+
+ break;
+
+ case LEGALL5_3 :
+ lfac = 1.179535649;
+ hfac = 0.81649658;
+ filt_shift = 1;
+
+ break;
+
+ case DD13_7 :
+ lfac = 1.235705971;
+ hfac = 0.780719354;
+ filt_shift = 1;
+
+ break;
+
+ case HAAR0 :
+ lfac = 1.414213562;
+ hfac = 0.707106781;
+ filt_shift = 0;
+
+ break;
+
+ case HAAR1 :
+ lfac = 1.414213562;
+ hfac = 0.707106781;
+ filt_shift = 1;
+
+ break;
+
+ case DAUB9_7 :
+ lfac = 1.149604398;
+ hfac = 0.869864452;
+ filt_shift = 1;
+
+ break;
+
+ default:
+ lfac = 1.0;
+ hfac = 1.0;
+ filt_shift = 0;
}
int idx;
int shift;
- int depth = (m_band_list.Length() - 1) / 3;
+ int depth = (m_band_list.Length()-1)/3;
// Do the DC subband
idx = m_band_list.Length();
- double cf = (1 << (depth * filt_shift)) / std::pow(lfac, 2 * depth) ;
+ double cf = (1<<(depth*filt_shift)) / std::pow(lfac,2*depth ) ;
- m_band_list(idx).SetWt(m_band_list(idx).Wt()*cf);
+ m_band_list(idx).SetWt( m_band_list(idx).Wt()*cf);
// Do the non-DC subbands
- for(int level = 1; level <= depth; level++)
+ for (int level=1; level<=depth; level++)
{
- shift = (depth - level + 1) * filt_shift;
- for(int orient = 3; orient >= 1; --orient)
+ shift = (depth-level+1)*filt_shift;
+ for ( int orient=3;orient>=1; --orient )
{
- idx = 3 * (depth - level) + orient;
+ idx = 3*(depth-level)+orient;
// index into the subband list
- idx = 3 * (depth - level) + orient;
+ idx = 3*(depth-level)+orient;
// Divide through by the weight for the LF subband that was decomposed
// to create this level
- cf = 1.0 / std::pow(lfac, 2 * (depth - level));
+ cf = 1.0/ std::pow(lfac,2*(depth-level) );
- if(m_band_list(idx).Xp() != 0 && m_band_list(idx).Yp() != 0)
+ if ( m_band_list(idx).Xp() != 0 && m_band_list(idx).Yp() != 0)
// HH subband
cf /= (hfac * hfac);
else
// LH or HL subband
cf /= (lfac * hfac);
- cf *= double(1 << shift);
+ cf *= double(1<<shift);
- m_band_list(idx).SetWt(m_band_list(idx).Wt()*cf);
+ m_band_list(idx).SetWt( m_band_list(idx).Wt()*cf );
}// orient
}//level
@@ -394,16 +383,16 @@ void CoeffArray::SetBandWeights(const EncoderParams& encparams,
// Returns a perceptual noise weighting based on extending CCIR 959 values
// assuming a two-d isotropic response. Also has a fudge factor of 20% for chroma
-float CoeffArray::PerceptualWeight(const float xf ,
- const float yf ,
- const CompSort cs)
+float CoeffArray::PerceptualWeight( const float xf ,
+ const float yf ,
+ const CompSort cs )
{
- double freq_sqd(xf * xf + yf * yf);
+ double freq_sqd( xf*xf + yf*yf );
- if(cs != Y_COMP)
+ if ( cs != Y_COMP )
freq_sqd *= 1.2;
- return 0.255 * std::pow(1.0 + 0.2561 * freq_sqd , 0.75) ;
+ return 0.255 * std::pow( 1.0 + 0.2561*freq_sqd , 0.75) ;
}
@@ -415,11 +404,10 @@ float CoeffArray::PerceptualWeight(const float xf ,
//public methods
WaveletTransform::WaveletTransform(int d, WltFilter f)
- : m_depth(d),
- m_filt_sort(f)
+ : m_depth(d),
+ m_filt_sort(f)
{
- switch(m_filt_sort)
- {
+ switch( m_filt_sort ){
case DD9_7 :
m_vhfilter = new VHFilterDD9_7;
@@ -447,61 +435,50 @@ WaveletTransform::WaveletTransform(int d, WltFilter f)
}
//! Destructor
-WaveletTransform::~WaveletTransform()
-{
- delete m_vhfilter;
-}
+WaveletTransform::~WaveletTransform(){ delete m_vhfilter; }
-void WaveletTransform::Transform(const Direction d, PicArray& pic_data, CoeffArray& coeff_data)
-{
+void WaveletTransform::Transform(const Direction d, PicArray& pic_data, CoeffArray& coeff_data) {
- int xl, yl;
+ int xl,yl;
SubbandList& bands = coeff_data.BandList();
- if(d == FORWARD)
- {
- xl = coeff_data.LengthX();
- yl = coeff_data.LengthY();
+ if (d == FORWARD){
+ xl=coeff_data.LengthX();
+ yl=coeff_data.LengthY();
// First copy picture data into coeff_data and pad
- for(int j = 0; j < pic_data.LengthY(); ++j)
- {
- for(int i = 0; i < pic_data.LengthX(); ++i)
- coeff_data[j][i] = CoeffType(pic_data[j][i]);
- for(int i = pic_data.LengthX(); i < coeff_data.LengthX(); ++i)
+ for ( int j=0; j<pic_data.LengthY(); ++j){
+ for ( int i=0; i<pic_data.LengthX(); ++i)
+ coeff_data[j][i] = CoeffType( pic_data[j][i] );
+ for ( int i=pic_data.LengthX(); i<coeff_data.LengthX(); ++i)
coeff_data[j][i] = coeff_data[j][pic_data.LastX()];
}// j
- for(int j = pic_data.LengthY(); j < coeff_data.LengthY(); ++j)
- {
- for(int i = 0; i < coeff_data.LengthX(); ++i)
+ for ( int j=pic_data.LengthY(); j<coeff_data.LengthY(); ++j){
+ for ( int i=0; i<coeff_data.LengthX(); ++i)
coeff_data[j][i] = coeff_data[pic_data.LastY()][i];
}
- for(int l = 1; l <= m_depth; ++l , xl >>= 1 , yl >>= 1)
- {
- m_vhfilter->Split(0, 0, xl, yl, coeff_data);
+ for (int l = 1; l <= m_depth; ++l , xl>>=1 , yl>>=1){
+ m_vhfilter->Split(0,0,xl,yl,coeff_data);
}
- bands.Init(m_depth , coeff_data.LengthX() , coeff_data.LengthY());
+ bands.Init( m_depth , coeff_data.LengthX() , coeff_data.LengthY() );
}
- else
- {
- xl = coeff_data.LengthX() / (1 << (m_depth - 1));
- yl = coeff_data.LengthY() / (1 << (m_depth - 1));
-
- for(int l = 1; l <= m_depth; ++l, xl <<= 1 , yl <<= 1)
- m_vhfilter->Synth(0, 0, xl, yl, coeff_data);
+ else{
+ xl = coeff_data.LengthX()/(1<<(m_depth-1));
+ yl = coeff_data.LengthY()/(1<<(m_depth-1));
+ for (int l = 1; l <= m_depth; ++l, xl<<=1 , yl<<=1 )
+ m_vhfilter->Synth(0,0,xl,yl,coeff_data);
+
//band list now inaccurate, so clear
bands.Clear();
- // Lastly, copy coeff_data back into picture data
- for(int j = 0; j < pic_data.LengthY(); ++j)
- {
- for(int i = 0; i < pic_data.LengthX(); ++i)
- {
- pic_data[j][i] = ValueType(coeff_data[j][i]);
+ // Lastly, copy coeff_data back into picture data
+ for ( int j=0; j<pic_data.LengthY(); ++j){
+ for ( int i=0; i<pic_data.LengthX(); ++i){
+ pic_data[j][i] = ValueType( coeff_data[j][i] );
}// i
}// j
}
@@ -511,35 +488,35 @@ void WaveletTransform::Transform(const Direction d, PicArray& pic_data, CoeffArr
///////////////////////
// NOTEL MMX version is defined in wavelet_utils_mmx.cpp
// the corresponding changes are made in wavelet_utils_mmx.cpp as well
-void VHFilter::Interleave(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+void VHFilter::Interleave( const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- TwoDArray<CoeffType> temp_data(yl , xl);
- const int xl2(xl >> 1);
- const int yl2(yl >> 1);
- const int yend(yp + yl);
+ TwoDArray<CoeffType> temp_data( yl , xl );
+ const int xl2( xl>>1);
+ const int yl2( yl>>1);
+ const int yend( yp + yl );
// Make a temporary copy of the subband
- for(int j = yp; j < yend ; j++)
- memcpy(temp_data[j-yp] , coeff_data[j] + xp , xl * sizeof(CoeffType));
+ for (int j = yp; j<yend ; j++ )
+ memcpy( temp_data[j-yp] , coeff_data[j]+xp , xl * sizeof( CoeffType ) );
// Re-order to interleave
- for(int j = 0, s = yp; j < yl2 ; j++, s += 2)
+ for (int j = 0, s=yp; j<yl2 ; j++, s+=2)
{
- for(int i = 0 , r = xp ; i < xl2 ; i++ , r += 2)
+ for (int i = 0 , r=xp ; i<xl2 ; i++ , r += 2)
coeff_data[s][r] = temp_data[j][i];
- for(int i = xl2, r = xp + 1; i < xl ; i++ , r += 2)
+ for (int i = xl2, r=xp+1; i<xl ; i++ , r += 2)
coeff_data[s][r] = temp_data[j][i];
}// j
- for(int j = yl2, s = yp + 1 ; j < yl ; j++ , s += 2)
+ for (int j = yl2, s=yp+1 ; j<yl ; j++ , s += 2)
{
- for(int i = 0 , r = xp ; i < xl2 ; i++ , r += 2)
+ for (int i = 0 , r=xp ; i<xl2 ; i++ , r += 2)
coeff_data[s][r] = temp_data[j][i];
- for(int i = xl2, r = xp + 1; i < xl ; i++ , r += 2)
+ for (int i = xl2, r=xp+1; i<xl ; i++ , r += 2)
coeff_data[s][r] = temp_data[j][i];
}// j
@@ -548,67 +525,67 @@ void VHFilter::Interleave(const int xp ,
#if !defined(HAVE_MMX)
void VHFilter::ShiftRowLeft(CoeffType *row, int length, int shift)
{
- for(int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i)
row[i] <<= shift;
}
void VHFilter::ShiftRowRight(CoeffType *row, int length, int shift)
{
- const CoeffType halfway(1 << (shift - 1));
- for(int i = 0; i < length; ++i)
- row[i] = ((row[i] + halfway) >> shift);
+ const CoeffType halfway( 1<<(shift-1) );
+ for (int i = 0; i < length; ++i)
+ row[i] = ((row[i]+halfway)>>shift);
}
#endif
-void VHFilter::DeInterleave(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+void VHFilter::DeInterleave( const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- TwoDArray<CoeffType> temp_data(yl , xl);
- const int xl2(xl >> 1);
- const int yl2(yl >> 1);
- const int xend(xp + xl);
- const int yend(yp + yl);
+ TwoDArray<CoeffType> temp_data( yl , xl );
+ const int xl2( xl>>1);
+ const int yl2( yl>>1);
+ const int xend( xp + xl );
+ const int yend( yp + yl );
// Make a temporary copy of the subband
- for(int j = yp; j < yend ; j++)
- memcpy(temp_data[j-yp] , coeff_data[j] + xp , xl * sizeof(CoeffType));
+ for (int j = yp; j<yend ; j++ )
+ memcpy( temp_data[j-yp] , coeff_data[j]+xp , xl * sizeof( CoeffType ) );
// Re-order to de-interleave
- for(int j = yp, s = 0; j < yp + yl2 ; j++, s += 2)
+ for (int j = yp, s=0; j<yp+yl2 ; j++, s+=2)
{
- for(int i = xp , r = 0 ; i < xp + xl2 ; i++ , r += 2)
+ for (int i = xp , r=0 ; i<xp+xl2 ; i++ , r += 2)
coeff_data[j][i] = temp_data[s][r];
- for(int i = xp + xl2, r = 1; i < xend ; i++ , r += 2)
+ for (int i = xp+xl2, r=1; i<xend ; i++ , r += 2)
coeff_data[j][i] = temp_data[s][r];
}// j
- for(int j = yp + yl2, s = 1 ; j < yend ; j++ , s += 2)
+ for (int j = yp+yl2, s=1 ; j<yend ; j++ , s += 2)
{
- for(int i = xp , r = 0 ; i < xp + xl2 ; i++ , r += 2)
+ for (int i = xp , r=0 ; i<xp+xl2 ; i++ , r += 2)
coeff_data[j][i] = temp_data[s][r];
- for(int i = xp + xl2, r = 1; i < xend ; i++ , r += 2)
+ for (int i = xp+xl2, r=1; i<xend ; i++ , r += 2)
coeff_data[j][i] = temp_data[s][r];
}// j
}
-void VHFilterDAUB9_7::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+void VHFilterDAUB9_7::Split (const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
CoeffType* line_data;
// Positional variables
- int i, j, k;
+ int i,j,k;
// Objects to do lifting stages
// (in revese order and type from synthesis)
@@ -617,41 +594,41 @@ void VHFilterDAUB9_7::Split(const int xp ,
const UpdateStep97< 3616 > updateA;
const UpdateStep97< 1817 > updateB;
- //first do horizontal
+ //first do horizontal
- for(j = yp; j < yend; ++j)
+ for (j = yp; j < yend; ++j)
{
// First lifting stage
line_data = coeff_data[j];
// Shift left by one bit to give us more accuracy
ShiftRowLeft(line_data, xl, 1);
- predictA.Filter(line_data[xp+1] , line_data[xp+2] , line_data[xp]);
- predictB.Filter(line_data[xp] , line_data[xp+1] , line_data[xp+1]);
+ predictA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
+ predictB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
- for(k = xp + 3; k < xend - 1; k += 2)
+ for ( k = xp+3; k < xend-1; k+=2)
{
- predictA.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
- predictB.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
+ predictA.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
+ predictB.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
}// i
- predictA.Filter(line_data[xend-1] , line_data[xend-2] , line_data[xend-2]);
- predictB.Filter(line_data[xend-2] , line_data[xend-3] , line_data[xend-1]);
+ predictA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
+ predictB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
- //second lifting stage
+ //second lifting stage
- updateA.Filter(line_data[xp+1] , line_data[xp+2] , line_data[xp]);
- updateB.Filter(line_data[xp] , line_data[xp+1] , line_data[xp+1]);
+ updateA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
+ updateB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
- for(k = xp + 3; k < xend - 1; k += 2)
+ for ( k = xp+3; k < xend-1; k+=2)
{
- updateA.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
- updateB.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
+ updateA.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
+ updateB.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
}// i
- updateA.Filter(line_data[xend-1] , line_data[xend-2] , line_data[xend-2]);
- updateB.Filter(line_data[xend-2] , line_data[xend-3] , line_data[xend-1]);
+ updateA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
+ updateB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
}// j
@@ -660,69 +637,69 @@ void VHFilterDAUB9_7::Split(const int xp ,
// First lifting stage
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predictA.Filter(coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i]);
- predictB.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
+ predictA.Filter( coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i] );
+ predictB.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
}// i
// middle bit
- for(k = yp + 3 ; k < yend - 1 ; k += 2)
+ for ( k = yp+3 ; k<yend-1 ; k+=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predictA.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
- predictB.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
+ predictA.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
+ predictB.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
}// i
}// j
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predictA.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
- predictB.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
+ predictA.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
+ predictB.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
}// i
// Second lifting stage
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- updateA.Filter(coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i]);
- updateB.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
+ updateA.Filter( coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i] );
+ updateB.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
}// i
// middle bit
- for(k = yp + 3 ; k < yend - 1 ; k += 2)
+ for ( k = yp+3 ; k<yend-1 ; k+=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- updateA.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
- updateB.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
+ updateA.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
+ updateB.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
}// i
}// j
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- updateA.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
- updateB.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
+ updateA.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
+ updateB.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
}// i
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp ,yp ,xl ,yl , coeff_data );
}
-void VHFilterDAUB9_7::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+void VHFilterDAUB9_7::Synth (const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- int i, j, k;
+ int i,j,k;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
const PredictStep97< 1817 > predictB;
const PredictStep97< 3616 > predictA;
@@ -732,89 +709,89 @@ void VHFilterDAUB9_7::Synth(const int xp ,
CoeffType* line_data;
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl , yl , coeff_data );
// Next, do the vertical synthesis
// First lifting stage
// Begin with the bottom edge
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predictB.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
- predictA.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
+ predictB.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
+ predictA.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
}// i
// Next, do the middle bit
- for(k = yend - 3 ; k > yp + 1 ; k -= 2)
+ for ( k = yend-3 ; k>yp+1 ; k-=2)
{
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predictB.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
- predictA.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
+ predictB.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
+ predictA.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
}// i
}// j
// Then do the top edge
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predictB.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
- predictA.Filter(coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i]);
+ predictB.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
+ predictA.Filter( coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i] );
}// i
// Second lifting stage
// Begin with the bottom edge
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- updateB.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
- updateA.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
+ updateB.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
+ updateA.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
}// i
// Next, do the middle bit
- for(k = yend - 3 ; k > yp + 1 ; k -= 2)
+ for ( k = yend-3 ; k>yp+1 ; k-=2)
{
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- updateB.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
- updateA.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
+ updateB.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
+ updateA.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
}// i
}// j
// Then do the top edge
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- updateB.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
- updateA.Filter(coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i]);
+ updateB.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
+ updateA.Filter( coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i] );
}// i
// Next do the horizontal synthesis
- for(j = yend - 1; j >= yp ; --j)
+ for (j = yend-1; j >= yp ; --j)
{
// First lifting stage
line_data = coeff_data[j];
- predictB.Filter(line_data[xend-2] , line_data[xend-3] , line_data[xend-1]);
- predictA.Filter(line_data[xend-1] , line_data[xend-2] , line_data[xend-2]);
+ predictB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
+ predictA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
- for(k = xend - 3; k > xp + 1; k -= 2)
+ for ( k = xend-3; k > xp+1; k-=2)
{
- predictB.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
- predictA.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
+ predictB.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
+ predictA.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
}// i
- predictB.Filter(line_data[xp] , line_data[xp+1] , line_data[xp+1]);
- predictA.Filter(line_data[xp+1] , line_data[xp+2] , line_data[xp]);
+ predictB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
+ predictA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
// Second lifting stage
- updateB.Filter(line_data[xend-2] , line_data[xend-3] , line_data[xend-1]);
- updateA.Filter(line_data[xend-1] , line_data[xend-2] , line_data[xend-2]);
+ updateB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
+ updateA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
- for(k = xend - 3; k > xp + 1; k -= 2)
+ for ( k = xend-3; k > xp+1; k-=2)
{
- updateB.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
- updateA.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
+ updateB.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
+ updateA.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
}// i
- updateB.Filter(line_data[xp] , line_data[xp+1] , line_data[xp+1]);
- updateA.Filter(line_data[xp+1] , line_data[xp+2] , line_data[xp]);
+ updateB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
+ updateA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
@@ -826,45 +803,45 @@ void VHFilterDAUB9_7::Synth(const int xp ,
// NOTE: MMX version is defined in wavelet_utils_mmx.cpp
// the corresponding changes are made in wavelet_utils_mmx.cpp as well
void VHFilterLEGALL5_3::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
CoeffType* line_data;
// Positional variables
- int i, j, k;
+ int i,j,k;
// Objects to do lifting stages
// (in revese order and type from synthesis)
const PredictStepShift< 1 > predict;
const UpdateStepShift< 2 > update;
- //first do horizontal
+ //first do horizontal
- for(j = yp; j < yend; ++j)
+ for (j = yp; j < yend; ++j)
{
// First lifting stage
line_data = &coeff_data[j][xp];
// Shift left by one bit to give us more accuracy
ShiftRowLeft(line_data, xl, 1);
- predict.Filter(line_data[1] , line_data[2] , line_data[0]);
- update.Filter(line_data[0] , line_data[1] , line_data[1]);
+ predict.Filter( line_data[1] , line_data[2] , line_data[0] );
+ update.Filter( line_data[0] , line_data[1] , line_data[1] );
- for(k = 3; k < xl - 1; k += 2)
+ for (k = 3; k < xl-1; k+=2)
{
- predict.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
- update.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
+ predict.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
+ update.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
}// i
- predict.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2]);
- update.Filter(line_data[xl-2] , line_data[xl-3] , line_data[xl-1]);
+ predict.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] );
+ update.Filter( line_data[xl-2] , line_data[xl-3] , line_data[xl-1] );
}// j
@@ -873,45 +850,45 @@ void VHFilterLEGALL5_3::Split(const int xp ,
// First lifting stage
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i]);
- update.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
+ predict.Filter( coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i] );
+ update.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
}// i
// middle bit
- for(k = yp + 3 ; k < yend - 1 ; k += 2)
+ for (k = yp+3 ; k<yend-1 ; k+=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
- update.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
+ predict.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
+ update.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
}// i
}// j
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
- update.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
+ predict.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
+ update.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
}// i
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp , yp , xl , yl , coeff_data );
}
// NOTE: MMX version is defined in wavelet_utils_mmx.cpp
// the corresponding changes are made in wavelet_utils_mmx.cpp as well
void VHFilterLEGALL5_3::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- int i, j, k;
+ int i,j,k;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
const PredictStepShift< 2 > predict;
const UpdateStepShift< 1 > update;
@@ -919,50 +896,50 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
CoeffType* line_data;
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl , yl , coeff_data );
// Next, do the vertical synthesis
// First lifting stage
// Begin with the bottom edge
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predict.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
- update.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
+ predict.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
+ update.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
}// i
// Next, do the middle bit
- for(k = yend - 3 ; k > yp + 1 ; k -= 2)
+ for ( k = yend-3 ; k>yp+1 ; k-=2)
{
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predict.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
- update.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
+ predict.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
+ update.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
}// i
}// j
// Then do the top edge
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predict.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
- update.Filter(coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i]);
+ predict.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
+ update.Filter( coeff_data[yp+1][i] , coeff_data[yp+2][i] , coeff_data[yp][i] );
}// i
// Next do the horizontal synthesis
- for(j = yend - 1; j >= yp ; --j)
+ for (j = yend-1; j >= yp ; --j)
{
// First lifting stage
line_data = &coeff_data[j][xp];
- predict.Filter(line_data[xl-2] , line_data[xl-3] , line_data[xl-1]);
- update.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2]);
+ predict.Filter( line_data[xl-2] , line_data[xl-3] , line_data[xl-1] );
+ update.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] );
- for(k = xl - 3; k > 1; k -= 2)
+ for ( k = xl-3; k > 1; k-=2)
{
- predict.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
- update.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
+ predict.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
+ update.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
}// i
- predict.Filter(line_data[0] , line_data[1] , line_data[1]);
- update.Filter(line_data[1] , line_data[2] , line_data[0]);
+ predict.Filter( line_data[0] , line_data[1] , line_data[1] );
+ update.Filter( line_data[1] , line_data[2] , line_data[0] );
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
@@ -973,92 +950,92 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
#endif
void VHFilterDD9_7::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
CoeffType* line_data;
// Positional variables
- int i, j, k;
+ int i,j,k;
- PredictStepFourTap < 4 , 9 , -1 > predict;
+ PredictStepFourTap< 4 , 9 , -1 > predict;
UpdateStepShift< 2 > update;
//first do horizontal
- for(j = yp; j < yend; ++j)
+ for (j = yp; j < yend; ++j)
{
line_data = &coeff_data[j][xp];
// Shift left by one bit to give us more accuracy
ShiftRowLeft(line_data, xl, 1);
// First lifting stage
- predict.Filter(line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4]);
- for(k = 3 ; k < xl - 3 ; k += 2)
+ predict.Filter( line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4] );
+ for (k=3 ; k<xl-3 ; k+=2)
{
- predict.Filter(line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3]);
+ predict.Filter( line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3] );
}// i
- predict.Filter(line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2]);
- predict.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2]);
+ predict.Filter( line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2] );
+ predict.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2] );
//Second lifting stage
- update.Filter(line_data[0] , line_data[1] , line_data[1]);
- for(i = 2 ; i < xl - 1 ; i += 2)
+ update.Filter( line_data[0] , line_data[1] , line_data[1] );
+ for (i=2 ; i<xl-1 ; i+=2 )
{
- update.Filter(line_data[i] , line_data[i-1] , line_data[i+1]);
+ update.Filter( line_data[i] , line_data[i-1] , line_data[i+1] );
}// i
- }// j
+ }// j
// next do vertical
// First lifting stage
// top line
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i]);
+ predict.Filter( coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i] );
}// i
// middle bit
- for(k = yp + 3 ; k < yend - 3 ; k += 2)
+ for ( k = yp+3 ; k<yend-3 ; k+=2)
{
- for(i = xp ; i < xend ; ++i)
+ for ( i = xp ; i<xend ; ++i)
{
- predict.Filter(coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i]);
+ predict.Filter( coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i] );
}// i
}// j
// bottom lines
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i]);
- predict.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i]);
+ predict.Filter( coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i] );
+ predict.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] );
}// i
//Second lifting stage
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
+ update.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
}// i
// middle bit
- for(j = yp + 2 ; j < yend - 1 ; j += 2 , k += 2)
+ for ( j = yp+2 ; j<yend-1 ; j+=2 , k+=2)
{
- for(i = xp ; i < xend ; ++i)
+ for ( i = xp ; i<xend ; ++i)
{
- update.Filter(coeff_data[j][i] , coeff_data[j-1][i] , coeff_data[j+1][i]);
+ update.Filter( coeff_data[j][i] , coeff_data[j-1][i] , coeff_data[j+1][i] );
}// i
}// j
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp , yp , xl , yl , coeff_data );
@@ -1068,85 +1045,85 @@ void VHFilterDD9_7::Split(const int xp ,
// NOTE: MMX version is defined in wavelet_utils_mmx.cpp
// the corresponding changes are made in wavelet_utils_mmx.cpp as well
void VHFilterDD9_7::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- int i, j;
+ int i,j;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
PredictStepShift<2> predict;
- UpdateStepFourTap < 4 , 9 , -1 > update;
+ UpdateStepFourTap< 4 , 9 , -1> update;
CoeffType* line_data;
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl ,yl , coeff_data );
// First, do the vertical synthesis
// First lifting stage
// Middle bit
- for(j = yend - 2 ; j >= yp + 2 ; j -= 2)
+ for ( j=yend-2 ; j>=yp+2 ; j-=2 )
{
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predict.Filter(coeff_data[j][i] , coeff_data[j-1][i] , coeff_data[j+1][i]);
+ predict.Filter( coeff_data[j][i] , coeff_data[j-1][i] , coeff_data[j+1][i] );
}// i
}// j
// top line
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- predict.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
+ predict.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
}// i
// Second lifting stage
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- update.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i]);
- update.Filter(coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i]);
+ update.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] );
+ update.Filter( coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i] );
}// i
// middle bit
- for(j = yend - 5 ; j >= yp + 3 ; j -= 2)
+ for ( j=yend-5 ; j>=yp+3 ; j-=2)
{
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- update.Filter(coeff_data[j][i] , coeff_data[j-1][i] , coeff_data[j+1][i] , coeff_data[j-3][i] , coeff_data[j+3][i]);
+ update.Filter( coeff_data[j][i] , coeff_data[j-1][i] , coeff_data[j+1][i] , coeff_data[j-3][i] , coeff_data[j+3][i] );
}// i
}// k
- for(i = xend - 1 ; i >= xp ; --i)
+ for ( i = xend-1 ; i>=xp ; --i)
{
- update.Filter(coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i]);
+ update.Filter( coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i] );
}// i
// Next do the horizontal synthesis
- for(j = yend - 1; j >= yp; --j)
+ for (j = yend-1; j >= yp; --j)
{
line_data = &coeff_data[j][xp];
// First lifting stage
- for(i = xl - 2 ; i >= 2 ; i -= 2)
+ for (i=xl-2 ; i>=2 ; i-=2)
{
- predict.Filter(line_data[i] , line_data[i-1] , line_data[i+1]);
+ predict.Filter( line_data[i] , line_data[i-1] , line_data[i+1] );
}// i
- predict.Filter(line_data[0] , line_data[1] , line_data[1]);
+ predict.Filter( line_data[0] , line_data[1] , line_data[1] );
// Second lifting stage
- update.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2]);
- update.Filter(line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2]);
- for(i = xl - 5 ; i >= 3 ; i -= 2)
+ update.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2] );
+ update.Filter( line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2] );
+ for (i=xl-5 ; i>=3 ; i-=2)
{
- update.Filter(line_data[i] , line_data[i-1] , line_data[i+1] , line_data[i-3] , line_data[i+3]);
+ update.Filter( line_data[i] , line_data[i-1] , line_data[i+1] , line_data[i-3] , line_data[i+3] );
}// i
- update.Filter(line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4]);
+ update.Filter( line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4] );
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
@@ -1157,50 +1134,50 @@ void VHFilterDD9_7::Synth(const int xp ,
#endif
void VHFilterDD13_7::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
- PredictStepFourTap < 4 , 9 , -1 > predict;
- UpdateStepFourTap < 5 , 9 , -1 > update;
+ PredictStepFourTap< 4 , 9 , -1 > predict;
+ UpdateStepFourTap< 5 , 9 , -1> update;
CoeffType* line_data;
// Positional variables
- int i, j, k;
+ int i,j,k;
- //first do horizontal
+ //first do horizontal
- for(j = yp; j < yend; ++j)
+ for (j = yp; j < yend; ++j)
{
line_data = &coeff_data[j][xp];
// Shift left by one bit to give us more accuracy
ShiftRowLeft(line_data, xl, 1);
// First lifting stage
- predict.Filter(line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4]);
- for(k = 3 ; k < xl - 3 ; k += 2)
+ predict.Filter( line_data[1] , line_data[0] ,line_data[2] , line_data[0] , line_data[4] );
+ for (k=3 ; k<xl-3 ; k+=2)
{
- predict.Filter(line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3]);
+ predict.Filter( line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3] );
}// i
- predict.Filter(line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2]);
- predict.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2]);
+ predict.Filter( line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2] );
+ predict.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2] );
- //second lifting stage
- update.Filter(line_data[0] , line_data[1] , line_data[1] , line_data[3] , line_data[1]);
- update.Filter(line_data[2] , line_data[1] , line_data[3] , line_data[5] , line_data[1]);
- for(k = 4 ; k < xl - 3 ; k += 2)
+ //second lifting stage
+ update.Filter( line_data[0] , line_data[1] , line_data[1] , line_data[3] , line_data[1] );
+ update.Filter( line_data[2] , line_data[1] , line_data[3] , line_data[5] , line_data[1] );
+ for (k=4 ; k<xl-3 ; k+=2)
{
- update.Filter(line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3]);
+ update.Filter( line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3] );
}// i
- update.Filter(line_data[xl-2] , line_data[xl-3] , line_data[xl-1] , line_data[xl-5] , line_data[xl-1]);
+ update.Filter( line_data[xl-2] , line_data[xl-3] , line_data[xl-1] , line_data[xl-5] , line_data[xl-1] );
}// j
// next do vertical
@@ -1208,153 +1185,153 @@ void VHFilterDD13_7::Split(const int xp ,
// First lifting stage
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i]);
+ predict.Filter( coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i] );
}// i
// middle bit
- for(k = yp + 3 ; k < yend - 3 ; k += 2)
+ for ( k = yp+3 ; k<yend-3 ; k+=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i]);
+ predict.Filter( coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i] );
}// i
}// j
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i]);
- predict.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i]);
+ predict.Filter( coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i] );
+ predict.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] );
}// i
// Second lifting stage
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+1][i]);
- update.Filter(coeff_data[yp+2][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+5][i] , coeff_data[yp+1][i]);
+ update.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+1][i] );
+ update.Filter( coeff_data[yp+2][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+5][i] , coeff_data[yp+1][i] );
}// i
// middle bit
- for(k = yp + 4 ; k < yend - 3 ; k += 2)
+ for ( k = yp+4 ; k<yend-3 ; k+=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i]);
+ update.Filter( coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i] );
}// i
}// j
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] , coeff_data[yend-5][i] , coeff_data[yend-1][i]);
+ update.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] , coeff_data[yend-5][i] , coeff_data[yend-1][i] );
}// i
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp , yp , xl , yl , coeff_data );
}
#if !defined(HAVE_MMX)
// NOTE: MMX version is defined in wavelet_utils_mmx.cpp
// the corresponding changes are made in wavelet_utils_mmx.cpp as well
void VHFilterDD13_7::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- int i, j, k;
+ int i,j,k;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
- PredictStepFourTap < 5 , 9 , -1 > predict;
- UpdateStepFourTap < 4 , 9 , -1 > update;
+ PredictStepFourTap< 5 , 9 , -1 > predict;
+ UpdateStepFourTap< 4 , 9 , -1> update;
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl , yl , coeff_data );
// Next, do the vertical synthesis
// First lifting stage
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] , coeff_data[yend-5][i] , coeff_data[yend-1][i]);
+ predict.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] , coeff_data[yend-5][i] , coeff_data[yend-1][i] );
}// i
// middle bit
- for(k = yend - 4 ; k >= yp + 4 ; k -= 2)
+ for ( k = yend-4 ; k>=yp+4 ; k-=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i]);
+ predict.Filter( coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i] );
}// i
}// j
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+2][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+5][i] , coeff_data[yp+1][i]);
- predict.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+1][i]);
+ predict.Filter( coeff_data[yp+2][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+5][i] , coeff_data[yp+1][i] );
+ predict.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] , coeff_data[yp+3][i] , coeff_data[yp+1][i] );
}// i
// Second lifting stage
// bottom edge
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i]);
- update.Filter(coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i]);
+ update.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] );
+ update.Filter( coeff_data[yend-3][i] , coeff_data[yend-4][i] , coeff_data[yend-2][i] , coeff_data[yend-6][i] , coeff_data[yend-2][i] );
}// i
// middle bit
- for(k = yend - 5 ; k >= yp + 3 ; k -= 2)
+ for ( k = yend-5 ; k>=yp+3 ; k-=2)
{
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i]);
+ update.Filter( coeff_data[k][i] , coeff_data[k-1][i] , coeff_data[k+1][i] , coeff_data[k-3][i] , coeff_data[k+3][i] );
}// i
}// j
// top edge - j=xp
- for(i = xp ; i < xend ; ++ i)
+ for ( i = xp ; i<xend ; ++ i)
{
- update.Filter(coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i]);
+ update.Filter( coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] , coeff_data[yp][i] , coeff_data[yp+4][i] );
}// i
// Next do the horizontal synthesis
CoeffType* line_data;
- for(j = yend - 1; j >= yp ; --j)
+ for (j = yend-1; j >= yp ; --j)
{
line_data = &coeff_data[j][xp];
// First lifting stage
- predict.Filter(line_data[xl-2] , line_data[xl-3] , line_data[xl-1] , line_data[xl-5] , line_data[xl-1]);
+ predict.Filter( line_data[xl-2] , line_data[xl-3] , line_data[xl-1] , line_data[xl-5] , line_data[xl-1] );
- for(k = xl - 4 ; k >= 4 ; k -= 2)
+ for (k=xl-4 ; k>=4 ; k-=2)
{
- predict.Filter(line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3]);
+ predict.Filter( line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3] );
}// i
- predict.Filter(line_data[2] , line_data[1] , line_data[3] , line_data[5] , line_data[1]);
- predict.Filter(line_data[0] , line_data[1] , line_data[1] , line_data[3] , line_data[1]);
+ predict.Filter( line_data[2] , line_data[1] , line_data[3] , line_data[5] , line_data[1] );
+ predict.Filter( line_data[0] , line_data[1] , line_data[1] , line_data[3] , line_data[1] );
- //second lifting stage
- update.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2]);
- update.Filter(line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2]);
+ //second lifting stage
+ update.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] , line_data[xl-4] , line_data[xl-2] );
+ update.Filter( line_data[xl-3] , line_data[xl-4] , line_data[xl-2] , line_data[xl-6] , line_data[xl-2] );
- for(k = xl - 5 ; k >= 3 ; k -= 2)
+ for (k=xl-5 ; k>=3 ; k-=2)
{
- update.Filter(line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3]);
+ update.Filter( line_data[k] , line_data[k-1] , line_data[k+1] , line_data[k-3] , line_data[k+3] );
}// i
- update.Filter(line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4]);
+ update.Filter( line_data[1] , line_data[0] , line_data[2] , line_data[0] , line_data[4] );
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
@@ -1363,147 +1340,147 @@ void VHFilterDD13_7::Synth(const int xp ,
#endif
void VHFilterHAAR0::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
// first do Horizontal
- for(int j = yp; j < yend; ++j)
+ for (int j = yp; j < yend; ++j)
{
- for(int i = xp + 1; i < xend; i += 2)
+ for (int i = xp+1; i < xend; i+=2)
{
// odd sample
// x(2n+1) -= x(2n)
coeff_data[j][i] -= coeff_data[j][i-1];
// even sample
// x(2n) += x(2n+1)/2
- coeff_data[j][i-1] += ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j][i-1] += ((coeff_data[j][i]+1)>>1);
}
}
// next do vertical
- for(int j = yp + 1; j < yend; j += 2)
+ for (int j = yp+1; j < yend; j+=2)
{
- for(int i = xp; i < xend; ++i)
+ for (int i = xp; i < xend; ++i)
{
coeff_data[j][i] -= coeff_data[j-1][i];
- coeff_data[j-1][i] += ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j-1][i] += ((coeff_data[j][i]+1)>>1);
}
}
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp , yp , xl , yl , coeff_data );
}
void VHFilterHAAR0::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl , yl , coeff_data );
// First do the vertical
- for(int j = yp + 1; j < yend; j += 2)
+ for (int j = yp+1; j < yend; j+=2)
{
- for(int i = xp; i < xend; ++i)
+ for (int i = xp; i < xend; ++i)
{
- coeff_data[j-1][i] -= ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j-1][i] -= ((coeff_data[j][i]+1)>>1);
coeff_data[j][i] += coeff_data[j-1][i];
}
}
// Next do the horizontal
- for(int j = yp; j < yend; ++j)
+ for (int j = yp; j < yend; ++j)
{
- for(int i = xp + 1; i < xend; i += 2)
+ for (int i = xp+1; i < xend; i+=2)
{
- coeff_data[j][i-1] -= ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j][i-1] -= ((coeff_data[j][i]+1)>>1);
coeff_data[j][i] += coeff_data[j][i-1];
}
}
}
void VHFilterHAAR1::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
CoeffType* line_data;
// first do Horizontal
- for(int j = yp; j < yend; ++j)
+ for (int j = yp; j < yend; ++j)
{
line_data = &(coeff_data[j][xp]);
ShiftRowLeft(line_data, xl, 1);
- for(int i = xp + 1; i < xend; i += 2)
+ for (int i = xp+1; i < xend; i+=2)
{
// odd sample
// x(2n+1) -= x(2n)
coeff_data[j][i] -= coeff_data[j][i-1];
// even sample
// x(2n) += x(2n+1)/2
- coeff_data[j][i-1] += ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j][i-1] += ((coeff_data[j][i]+1)>>1);
}
}
// next do vertical
- for(int j = yp + 1; j < yend; j += 2)
+ for (int j = yp+1; j < yend; j+=2)
{
- for(int i = xp; i < xend; ++i)
+ for (int i = xp; i < xend; ++i)
{
coeff_data[j][i] -= coeff_data[j-1][i];
- coeff_data[j-1][i] += ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j-1][i] += ((coeff_data[j][i]+1)>>1);
}
}
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp , yp , xl , yl , coeff_data );
}
void VHFilterHAAR1::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
CoeffType* line_data;
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl , yl , coeff_data );
// First do the vertical
- for(int j = yp + 1; j < yend; j += 2)
+ for (int j = yp+1; j < yend; j+=2)
{
- for(int i = xp; i < xend; ++i)
+ for (int i = xp; i < xend; ++i)
{
- coeff_data[j-1][i] -= ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j-1][i] -= ((coeff_data[j][i]+1)>>1);
coeff_data[j][i] += coeff_data[j-1][i];
}
}
// Next do the horizontal
- for(int j = yp; j < yend; ++j)
+ for (int j = yp; j < yend; ++j)
{
- for(int i = xp + 1; i < xend; i += 2)
+ for (int i = xp+1; i < xend; i+=2)
{
- coeff_data[j][i-1] -= ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j][i-1] -= ((coeff_data[j][i]+1)>>1);
coeff_data[j][i] += coeff_data[j][i-1];
}
line_data = &coeff_data[j][xp];
@@ -1512,76 +1489,76 @@ void VHFilterHAAR1::Synth(const int xp ,
}
void VHFilterHAAR2::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend = xp + xl;
- const int yend = yp + yl;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
CoeffType* line_data;
// first do Horizontal
- for(int j = yp; j < yend; ++j)
+ for (int j = yp; j < yend; ++j)
{
line_data = &coeff_data[j][xp];
ShiftRowLeft(line_data, xl, 2);
- for(int i = xp + 1; i < xend; i += 2)
+ for (int i = xp+1; i < xend; i+=2)
{
// odd sample
// x(2n+1) -= x(2n)
coeff_data[j][i] -= coeff_data[j][i-1];
// even sample
// x(2n) += x(2n+1)/2
- coeff_data[j][i-1] += ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j][i-1] += ((coeff_data[j][i]+1)>>1);
}
}
// next do vertical
- for(int j = yp + 1; j < yend; j += 2)
+ for (int j = yp+1; j < yend; j+=2)
{
- for(int i = xp; i < xend; ++i)
+ for (int i = xp; i < xend; ++i)
{
coeff_data[j][i] -= coeff_data[j-1][i];
- coeff_data[j-1][i] += ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j-1][i] += ((coeff_data[j][i]+1)>>1);
}
}
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave(xp , yp , xl , yl , coeff_data);
+ DeInterleave( xp , yp , xl , yl , coeff_data );
}
void VHFilterHAAR2::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
CoeffType* line_data;
// Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
- Interleave(xp , yp , xl , yl , coeff_data);
+ Interleave( xp , yp , xl , yl , coeff_data );
// First do the vertical
- for(int j = yp + 1; j < yend; j += 2)
+ for (int j = yp+1; j < yend; j+=2)
{
- for(int i = xp; i < xend; ++i)
+ for (int i = xp; i < xend; ++i)
{
- coeff_data[j-1][i] -= ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j-1][i] -= ((coeff_data[j][i]+1)>>1);
coeff_data[j][i] += coeff_data[j-1][i];
}
}
// Next do the horizontal
- for(int j = yp; j < yend; ++j)
+ for (int j = yp; j < yend; ++j)
{
- for(int i = xp + 1; i < xend; i += 2)
+ for (int i = xp+1; i < xend; i+=2)
{
- coeff_data[j][i-1] -= ((coeff_data[j][i] + 1) >> 1);
+ coeff_data[j][i-1] -= ((coeff_data[j][i]+1)>>1);
coeff_data[j][i] += coeff_data[j][i-1];
}
line_data = &coeff_data[j][xp];
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.h
index 26378bf81..2ca565f3b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils.h
@@ -52,830 +52,680 @@
namespace dirac
{
-class PicArray;
-class Subband;
+ class PicArray;
+ class Subband;
-//! Class for encapsulating metadata concerning a block of coefficients in a subband
-class CodeBlock
-{
+ //! Class for encapsulating metadata concerning a block of coefficients in a subband
+ class CodeBlock
+ {
friend class Subband;
-public:
- //! Constructor
- /*
- Default constructor - sets all dimensions to zero
- */
- CodeBlock();
-
- //! Constructor
- /*
- Initialise the code block
- \param xstart the x-coord of the first coefficient in the block
- \param xend one past the last coefficient, horizontally
- \param ystart the y-coord of the first coefficient in the block
- \param yend one past the last coefficient, vertically
- */
- CodeBlock(const int xstart , const int ystart , const int xend , const int yend);
+ public:
+ //! Constructor
+ /*
+ Default constructor - sets all dimensions to zero
+ */
+ CodeBlock();
- //! Returns the horizontal start of the block
- int Xstart() const
- {
- return m_xstart;
- }
+ //! Constructor
+ /*
+ Initialise the code block
+ \param xstart the x-coord of the first coefficient in the block
+ \param xend one past the last coefficient, horizontally
+ \param ystart the y-coord of the first coefficient in the block
+ \param yend one past the last coefficient, vertically
+ */
+ CodeBlock( const int xstart , const int ystart , const int xend , const int yend);
- //! Returns the vertical start of the block
- int Ystart() const
- {
- return m_ystart;
- }
+ //! Returns the horizontal start of the block
+ int Xstart() const { return m_xstart; }
- //! Returns one past the last coefficient coord, horizontally
- int Xend() const
- {
- return m_xend;
- }
+ //! Returns the vertical start of the block
+ int Ystart() const { return m_ystart; }
- //! Returns one past the last coefficient coord, vertically
- int Yend() const
- {
- return m_yend;
- }
+ //! Returns one past the last coefficient coord, horizontally
+ int Xend() const { return m_xend; }
- //! Returns the width of the code block
- int Xl() const
- {
- return m_xl;
- }
+ //! Returns one past the last coefficient coord, vertically
+ int Yend() const { return m_yend; }
- //! Returns the height of the code block
- int Yl() const
- {
- return m_yl;
- }
+ //! Returns the width of the code block
+ int Xl() const { return m_xl; }
- //! Returns the quantisation index associated to the code block
- int QuantIndex() const
- {
- return m_quantindex;
- }
+ //! Returns the height of the code block
+ int Yl() const { return m_yl; }
- //! Returns true if the code-block is skipped, false if not
- bool Skipped() const
- {
- return m_skipped;
- }
+ //! Returns the quantisation index associated to the code block
+ int QuantIndex() const{ return m_quantindex; }
- //! Sets the quantisation index
- void SetQuantIndex(const int quantindex)
- {
- m_quantindex = quantindex;
- }
+ //! Returns true if the code-block is skipped, false if not
+ bool Skipped() const { return m_skipped; }
- //! Sets whether the code block is skipped or not
- void SetSkip(bool skip)
- {
- m_skipped = skip;
- }
-
-private:
-
- //! Initialise the code block
- /*
- Initialise the code block
- \param xstart the x-coord of the first coefficient in the block
- \param xend one past the last coefficient, horizontally
- \param ystart the y-coord of the first coefficient in the block
- \param yend one past the last coefficient, vertically
- */
- void Init(const int xstart , const int ystart , const int xend , const int yend);
+ //! Sets the quantisation index
+ void SetQuantIndex( const int quantindex ){ m_quantindex = quantindex; }
-private:
+ //! Sets whether the code block is skipped or not
+ void SetSkip( bool skip ){ m_skipped = skip; }
- int m_xstart;
- int m_ystart;
- int m_xend;
- int m_yend;
- int m_xl;
- int m_yl;
+ private:
- int m_quantindex;
+ //! Initialise the code block
+ /*
+ Initialise the code block
+ \param xstart the x-coord of the first coefficient in the block
+ \param xend one past the last coefficient, horizontally
+ \param ystart the y-coord of the first coefficient in the block
+ \param yend one past the last coefficient, vertically
+ */
+ void Init( const int xstart , const int ystart , const int xend , const int yend );
- bool m_skipped;
-};
+ private:
+ int m_xstart;
+ int m_ystart;
+ int m_xend;
+ int m_yend;
+ int m_xl;
+ int m_yl;
-//! Class encapsulating all the metadata relating to a wavelet subband
-class Subband
-{
-public:
-
- //! Default constructor
- Subband();
-
- //! Constructor
- /*!
- The constructor parameters are
- \param xpos the xposition of the subband when packed into a
- big array with all the others
- \param ypos the xposition of the subband
- \param xlen the width of the subband
- \param ylen the height of the subband
- */
- Subband(int xpos, int ypos, int xlen, int ylen);
-
- //! Constructor
- /*!
- The constructor parameters are
- \param xpos the xposition of the subband when packed into a
- big array with all the others
- \param ypos the xposition of the subband
- \param xlen the width of the subband
- \param ylen the height of the subband
- \param d the depth of the subband in the wavelet transform
- */
- Subband(int xpos, int ypos, int xlen, int ylen, int d);
+ int m_quantindex;
- //! Destructor
- ~Subband();
+ bool m_skipped;
+ };
- //Default (shallow) copy constructor and operator= used
- //! Return the width of the subband
- int Xl() const
+ //! Class encapsulating all the metadata relating to a wavelet subband
+ class Subband
{
- return m_xl;
- }
+ public:
- //! Return the horizontal position of the subband
- int Xp() const
- {
- return m_xp;
- }
+ //! Default constructor
+ Subband();
- //! Return the height of the subband
- int Yl() const
- {
- return m_yl;
- }
+ //! Constructor
+ /*!
+ The constructor parameters are
+ \param xpos the xposition of the subband when packed into a
+ big array with all the others
+ \param ypos the xposition of the subband
+ \param xlen the width of the subband
+ \param ylen the height of the subband
+ */
+ Subband(int xpos, int ypos, int xlen, int ylen);
- //! Return the vertical position of the subband
- int Yp() const
- {
- return m_yp;
- }
+ //! Constructor
+ /*!
+ The constructor parameters are
+ \param xpos the xposition of the subband when packed into a
+ big array with all the others
+ \param ypos the xposition of the subband
+ \param xlen the width of the subband
+ \param ylen the height of the subband
+ \param d the depth of the subband in the wavelet transform
+ */
+ Subband(int xpos, int ypos, int xlen, int ylen, int d);
- //! Return the index of the maximum bit of the largest coefficient
- int Max() const
- {
- return m_max_bit;
- }
+ //! Destructor
+ ~Subband();
- //! Return the subband perceptual weight
- double Wt() const
- {
- return m_wt;
- }
+ //Default (shallow) copy constructor and operator= used
- //! Return the depth of the subband in the transform
- int Depth() const
- {
- return m_depth;
- }
+ //! Return the width of the subband
+ int Xl() const {return m_xl;}
- //! Return the scale of the subband, viewed as a subsampled version of the picture
- int Scale() const
- {
- return (1 << m_depth);
- }
+ //! Return the horizontal position of the subband
+ int Xp() const {return m_xp;}
- //! Return a quantisation index
- int QuantIndex() const
- {
- return m_qindex;
- }
+ //! Return the height of the subband
+ int Yl() const {return m_yl;}
- //! Return a flag indicating whether we have separate quantisers for each code block
- bool UsingMultiQuants() const
- {
- return m_multi_quants;
- }
+ //! Return the vertical position of the subband
+ int Yp() const {return m_yp;}
- //! Return the index of the parent subband
- int Parent() const
- {
- return m_parent;
- }
-
- //! Return the indices of any child subbands
- const std::vector<int>& Children() const
- {
- return m_children;
- }
+ //! Return the index of the maximum bit of the largest coefficient
+ int Max() const {return m_max_bit;}
- //! Return the index of a specific child band
- int Child(const int n) const
- {
- return m_children[n];
- }
+ //! Return the subband perceptual weight
+ double Wt() const {return m_wt;}
- //! Return the code blocks
- TwoDArray<CodeBlock>& GetCodeBlocks()
- {
- return m_code_block_array;
- }
+ //! Return the depth of the subband in the transform
+ int Depth() const {return m_depth;}
- //! Return the code blocks
- const TwoDArray<CodeBlock>& GetCodeBlocks() const
- {
- return m_code_block_array;
- }
+ //! Return the scale of the subband, viewed as a subsampled version of the picture
+ int Scale() const {return ( 1<<m_depth );}
- //! Returns true if subband is skipped, false if not
- bool Skipped() const
- {
- return m_skipped;
- }
+ //! Return a quantisation index
+ int QuantIndex() const {return m_qindex;}
- //! Set the perceptual weight
- void SetWt(const float w);
+ //! Return a flag indicating whether we have separate quantisers for each code block
+ bool UsingMultiQuants() const {return m_multi_quants; }
- //! Set the parent index
- void SetParent(const int p)
- {
- m_parent = p;
- }
+ //! Return the index of the parent subband
+ int Parent() const {return m_parent;}
- //! Set the subband depth
- void SetDepth(const int d)
- {
- m_depth = d;
- }
+ //! Return the indices of any child subbands
+ const std::vector<int>& Children() const {return m_children;}
- //! Set the index of the maximum bit of the largest coefficient
- void SetMax(const int m)
- {
- m_max_bit = m;
- };
+ //! Return the index of a specific child band
+ int Child(const int n) const {return m_children[n];}
- //! Set the number of (spatial) quantisers in the subband. Creates code block structure
- void SetNumBlocks(const int ynum , const int xnum);
+ //! Return the code blocks
+ TwoDArray<CodeBlock>& GetCodeBlocks(){ return m_code_block_array; }
- //! Set the quantisation index
- void SetQuantIndex(const int idx)
- {
- m_qindex = idx;
- }
+ //! Return the code blocks
+ const TwoDArray<CodeBlock>& GetCodeBlocks() const { return m_code_block_array; }
- //! Set the number of (spatial) quantisers in the subband. Creates code block structure
- void SetUsingMultiQuants(const bool multi)
- {
- m_multi_quants = multi;
- }
+ //! Returns true if subband is skipped, false if not
+ bool Skipped() const { return m_skipped; }
- //! Set whether the subband is skipped or not
- void SetSkip(const bool skip)
- {
- m_skipped = skip;
- }
+ //! Set the perceptual weight
+ void SetWt( const float w );
-private:
- // subband bounds
- int m_xp , m_yp , m_xl , m_yl;
+ //! Set the parent index
+ void SetParent( const int p ){ m_parent=p; }
- // perceptual weight for quantisation
- double m_wt;
+ //! Set the subband depth
+ void SetDepth( const int d ){ m_depth=d;}
- // depth in the transform
- int m_depth;
+ //! Set the index of the maximum bit of the largest coefficient
+ void SetMax( const int m ){ m_max_bit=m; };
- // quantiser index
- int m_qindex;
+ //! Set the number of (spatial) quantisers in the subband. Creates code block structure
+ void SetNumBlocks( const int ynum , const int xnum );
- // position of parent in a subband list
- int m_parent;
+ //! Set the quantisation index
+ void SetQuantIndex( const int idx){ m_qindex = idx; }
- // positions of children in the subband list
- std::vector<int> m_children;
+ //! Set the number of (spatial) quantisers in the subband. Creates code block structure
+ void SetUsingMultiQuants( const bool multi){ m_multi_quants = multi; }
- // position of the MSB of the largest absolute value
- int m_max_bit;
+ //! Set whether the subband is skipped or not
+ void SetSkip(const bool skip ){ m_skipped = skip; }
- // The code blocks
- TwoDArray<CodeBlock> m_code_block_array;
+ private:
+ // subband bounds
+ int m_xp , m_yp , m_xl , m_yl;
- // A flag indicating whether we're using one qf for each code block
- bool m_multi_quants;
+ // perceptual weight for quantisation
+ double m_wt;
- // Whether the subband is skipped or not
- bool m_skipped;
-};
+ // depth in the transform
+ int m_depth;
-//! A class encapulating all the subbands produced by a transform
-class SubbandList
-{
-public:
- //! Constructor
- SubbandList() {}
+ // quantiser index
+ int m_qindex;
- //! Destructor
- ~SubbandList() {}
+ // position of parent in a subband list
+ int m_parent;
- //Default (shallow) copy constructor and operator= used
- //! Initialise the list
- void Init(const int depth, const int xlen, const int ylen);
+ // positions of children in the subband list
+ std::vector<int> m_children;
- //! Return the length of the subband list
- int Length() const
- {
- return bands.size();
- }
+ // position of the MSB of the largest absolute value
+ int m_max_bit;
- //! Return the subband at position n (1<=n<=length)
- Subband& operator()(const int n)
- {
- return bands[n-1];
- }
+ // The code blocks
+ TwoDArray<CodeBlock> m_code_block_array;
- //! Return the subband at position n (1<=n<=length)
- const Subband& operator()(const int n) const
- {
- return bands[n-1];
- }
+ // A flag indicating whether we're using one qf for each code block
+ bool m_multi_quants;
- //! Add a band to the list
- void AddBand(const Subband& b)
- {
- bands.push_back(b);
- }
+ // Whether the subband is skipped or not
+ bool m_skipped;
+ };
- //! Remove all the bands from the list
- void Clear()
+ //! A class encapulating all the subbands produced by a transform
+ class SubbandList
{
- bands.clear();
- }
+ public:
+ //! Constructor
+ SubbandList(){}
-private:
+ //! Destructor
+ ~SubbandList(){}
- //! Given x and y spatial frequencies in cycles per degree, returns a weighting value
- float PerceptualWeight(const float xf , const float yf , const CompSort cs);
+ //Default (shallow) copy constructor and operator= used
+ //! Initialise the list
+ void Init(const int depth,const int xlen,const int ylen);
-private:
- std::vector<Subband> bands;
-};
+ //! Return the length of the subband list
+ int Length() const {return bands.size();}
-class CoeffArray;
-//! A virtual parent class to do vertical and horizontal splitting with wavelet filters
-class VHFilter
-{
+ //! Return the subband at position n (1<=n<=length)
+ Subband& operator()(const int n){return bands[n-1];}
-public:
+ //! Return the subband at position n (1<=n<=length)
+ const Subband& operator()(const int n) const {return bands[n-1];}
- VHFilter() {}
+ //! Add a band to the list
+ void AddBand(const Subband& b){bands.push_back(b);}
- virtual ~VHFilter() {}
+ //! Remove all the bands from the list
+ void Clear(){bands.clear();}
- //! Split a subband into 4
- virtual void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data) = 0;
+ private:
- //! Create a single band from 4 quadrant bands
- virtual void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data) = 0;
+ //! Given x and y spatial frequencies in cycles per degree, returns a weighting value
+ float PerceptualWeight( const float xf , const float yf , const CompSort cs);
- //! Return the value of the additional bitshift
- virtual int GetShift() const = 0;
-
-protected:
+ private:
+ std::vector<Subband> bands;
+ };
+
+ class CoeffArray;
+ //! A virtual parent class to do vertical and horizontal splitting with wavelet filters
+ class VHFilter
+ {
- //! Interleave data from separate subbands into even and odd positions for in-place calculation - called by Synth
- inline void Interleave(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ public:
+ VHFilter(){}
- //! De-interleave data even and odd positions into separate subbands - called by Split
- inline void DeInterleave(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ virtual ~VHFilter(){}
- //! Shift all vals in Row by 'shift' bits to the left to increase accuracy by 'shift' bits. Used in Analysis stage of filter
- void ShiftRowLeft(CoeffType *row, int length, int shift);
+ //! Split a subband into 4
+ virtual void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data)=0;
- //! Shift all vals in Row by 'shift' bits to the right to counter the shift in the Analysis stage. This function is used in the Synthesis stage
- void ShiftRowRight(CoeffType *row, int length, int shift);
-};
+ //! Create a single band from 4 quadrant bands
+ virtual void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data)=0;
-//! Class to do Daubechies (9,7) filtering operations
-class VHFilterDAUB9_7 : public VHFilter
-{
+ //! Return the value of the additional bitshift
+ virtual int GetShift() const =0;
-public:
+ protected:
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Interleave data from separate subbands into even and odd positions for in-place calculation - called by Synth
+ inline void Interleave( const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data );
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 1;
- }
+ //! De-interleave data even and odd positions into separate subbands - called by Split
+ inline void DeInterleave( const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data );
+ //! Shift all vals in Row by 'shift' bits to the left to increase accuracy by 'shift' bits. Used in Analysis stage of filter
+ void ShiftRowLeft(CoeffType *row, int length, int shift);
-};
+ //! Shift all vals in Row by 'shift' bits to the right to counter the shift in the Analysis stage. This function is used in the Synthesis stage
+ void ShiftRowRight(CoeffType *row, int length, int shift);
+ };
-//! Class to do (5,3) wavelet filtering operations
-class VHFilterLEGALL5_3 : public VHFilter
-{
+ //! Class to do Daubechies (9,7) filtering operations
+ class VHFilterDAUB9_7 : public VHFilter
+ {
-public:
+ public:
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 1;
- }
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 1;}
-#ifdef HAVE_MMX
- inline void HorizSynth(int xp, int xl, int ystart, int yend, CoeffArray &coeff_data);
-#endif
+ };
-};
+ //! Class to do (5,3) wavelet filtering operations
+ class VHFilterLEGALL5_3 : public VHFilter
+ {
-//! A short filter that's actually close to Daubechies (9,7) but with just two lifting steps
-class VHFilterDD9_7 : public VHFilter
-{
+ public:
-public:
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 1;}
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 1;
- }
-};
+#ifdef HAVE_MMX
+ inline void HorizSynth (int xp, int xl, int ystart, int yend, CoeffArray &coeff_data);
+#endif
-//! An extension of DD9_7, with a better low-pass filter but more computation
-class VHFilterDD13_7 : public VHFilter
-{
+ };
-public:
+ //! A short filter that's actually close to Daubechies (9,7) but with just two lifting steps
+ class VHFilterDD9_7 : public VHFilter
+ {
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ public:
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 1;
- }
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
-};
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 1;}
+ };
-//! Class to do Haar wavelet filtering operations
-class VHFilterHAAR0 : public VHFilter
-{
-public:
+ //! An extension of DD9_7, with a better low-pass filter but more computation
+ class VHFilterDD13_7 : public VHFilter
+ {
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ public:
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 0;
- }
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 1;}
-};
+ };
-//! Class to do Haar wavelet filtering operations with a single shift per level
-class VHFilterHAAR1 : public VHFilter
-{
+ //! Class to do Haar wavelet filtering operations
+ class VHFilterHAAR0 : public VHFilter
+ {
-public:
+ public:
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 1;
- }
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 0;}
-};
+ };
-//! Class to do Haar wavelet filtering operations with a double shift per level
-class VHFilterHAAR2 : public VHFilter
-{
+ //! Class to do Haar wavelet filtering operations with a single shift per level
+ class VHFilterHAAR1 : public VHFilter
+ {
-public:
+ public:
- //! Split a subband into 4
- void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Create a single band from 4 quadrant bands
- void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
- //! Return a correction factor to compensate for non-unity power gain of low-pass filter
- double GetLowFactor() const
- {
- return 1.414213562;
- }
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 1;}
- //! Return a correction factor to compensate for non-unity power gain of high-pass filter
- double GetHighFactor() const
- {
- return 0.707106781;
- }
+ };
- //! Return the value of the additional bitshift
- int GetShift() const
- {
- return 2;
- }
-};
+ //! Class to do Haar wavelet filtering operations with a double shift per level
+ class VHFilterHAAR2 : public VHFilter
+ {
+ public:
+ //! Split a subband into 4
+ void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
-// Lifting steps used in the filters
+ //! Create a single band from 4 quadrant bands
+ void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
-//! Class to do two-tap prediction lifting step
-template<int shift>
-class PredictStepShift
-{
+ //! Return a correction factor to compensate for non-unity power gain of low-pass filter
+ double GetLowFactor() const { return 1.414213562;}
-public:
+ //! Return a correction factor to compensate for non-unity power gain of high-pass filter
+ double GetHighFactor() const { return 0.707106781;}
- //! Constructor
- PredictStepShift() {}
+ //! Return the value of the additional bitshift
+ int GetShift() const {return 2;}
- // Assume default copy constructor, assignment= and destructor //
+ };
- //! Do the filtering
- /*
- Do the filtering.
- \param in_val the value being predicted
- \param val1 the first value being used for prediction
- \param val2 the second value being used for prediction
- */
- inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
- {
- in_val -= ((val1 + val2 + (1 << (shift - 1))) >> shift);
- }
-};
-//! Class to do two-tap updating lifting step
-template<int shift>
-class UpdateStepShift
-{
+ // Lifting steps used in the filters
-public:
- //! Constructor
- UpdateStepShift() {}
+ //! Class to do two-tap prediction lifting step
+ template<int shift>
+ class PredictStepShift
+ {
- //! Do the filtering
- /*
- Do the filtering.
- \param in_val the value being updated
- \param val1 the first value being used for updating
- \param val2 the second value being used for updating
- */
- inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
- {
- in_val += ((val1 + val2 + (1 << (shift - 1))) >> shift);
- }
+ public:
-};
+ //! Constructor
+ PredictStepShift(){}
-//! Class to do symmetric four-tap prediction lifting step
-template <int shift , int tap1, int tap2>
-class PredictStepFourTap
-{
-public:
+ // Assume default copy constructor, assignment= and destructor //
- //! Constructor
- PredictStepFourTap() {}
+ //! Do the filtering
+ /*
+ Do the filtering.
+ \param in_val the value being predicted
+ \param val1 the first value being used for prediction
+ \param val2 the second value being used for prediction
+ */
+ inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
+ {
+ in_val -= (( val1 + val2 + (1<<(shift-1)) ) >>shift );
+ }
- // Assume default copy constructor, assignment= and destructor //
+ };
- //! Do the filtering
- inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2 ,
- const CoeffType& val3, const CoeffType& val4) const
- {
- in_val -= (tap1 * (val1 + val2) + tap2 * (val3 + val4) + (1 << (shift - 1))) >> shift;
- }
-};
+ //! Class to do two-tap updating lifting step
+ template<int shift>
+ class UpdateStepShift
+ {
-//! Class to do symmetric four-tap update lifting step
-template <int shift , int tap1 , int tap2>
-class UpdateStepFourTap
-{
+ public:
+ //! Constructor
+ UpdateStepShift(){}
-public:
- //! Constructor
- UpdateStepFourTap() {}
+ //! Do the filtering
+ /*
+ Do the filtering.
+ \param in_val the value being updated
+ \param val1 the first value being used for updating
+ \param val2 the second value being used for updating
+ */
+ inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
+ {
+ in_val += ( ( val1 + val2 + (1<<(shift-1)) ) >>shift );
+ }
+
+ };
- //! Do the filtering
- inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2 ,
- const CoeffType& val3, const CoeffType& val4) const
+ //! Class to do symmetric four-tap prediction lifting step
+ template <int shift , int tap1, int tap2>
+ class PredictStepFourTap
+ {
+ public:
+
+ //! Constructor
+ PredictStepFourTap(){}
+
+ // Assume default copy constructor, assignment= and destructor //
+
+ //! Do the filtering
+ inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2 ,
+ const CoeffType& val3, const CoeffType& val4 ) const
+ {
+ in_val -= ( tap1*( val1 + val2 ) + tap2*( val3 + val4 ) + (1<<(shift-1)))>>shift;
+ }
+ };
+
+ //! Class to do symmetric four-tap update lifting step
+ template <int shift , int tap1 , int tap2>
+ class UpdateStepFourTap
+ {
+
+ public:
+ //! Constructor
+ UpdateStepFourTap(){}
+
+ //! Do the filtering
+ inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2 ,
+ const CoeffType& val3, const CoeffType& val4 ) const
+ {
+ in_val += ( tap1*( val1 + val2 ) + tap2*( val3 + val4 ) + (1<<(shift-1)) )>>shift;
+ }
+ };
+
+ //! Class to do two-tap prediction lifting step for Daubechies (9,7)
+ template <int gain> class PredictStep97
+ {
+ public:
+
+ //! Constructor
+ PredictStep97(){}
+
+ // Assume default copy constructor, assignment= and destructor //
+
+ //! Do the filtering
+ /*
+ Do the filtering.
+ \param in_val the value being predicted
+ \param val1 the first value being used for prediction
+ \param val2 the second value being used for prediction
+ */
+ inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
+ {
+ in_val -= static_cast< CoeffType >( (gain * static_cast< int >( val1 + val2 )) >>12 );
+ }
+ };
+
+ //! Class to do two-tap update lifting step for Daubechies (9,7)
+ template <int gain> class UpdateStep97
+ {
+
+ public:
+ //! Constructor
+ UpdateStep97(){}
+
+ //! Do the filtering
+ /*
+ Do the filtering.
+ \param in_val the value being updated
+ \param val1 the first value being used for updating
+ \param val2 the second value being used for updating
+ */
+ inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
+ {
+ in_val += static_cast< CoeffType >( (gain * static_cast< int >( val1 + val2 )) >>12 );
+ }
+ };
+
+ //! A class for wavelet coefficient data.
+ /*!
+ A class for encapsulating coefficient data, derived from TwoDArray..
+ */
+ class CoeffArray: public TwoDArray<CoeffType>
{
- in_val += (tap1 * (val1 + val2) + tap2 * (val3 + val4) + (1 << (shift - 1))) >> shift;
- }
-};
+ public:
+ //! Default constructor
+ /*!
+ Default constructor creates an empty array.
+ */
+ CoeffArray(): TwoDArray<CoeffType>(){}
-//! Class to do two-tap prediction lifting step for Daubechies (9,7)
-template <int gain> class PredictStep97
-{
-public:
+ //! Constructor.
+ /*!
+ Contructor creates a two-D array, with specified size and colour
+ format.
+ */
+ CoeffArray(int height, int width, CompSort cs=Y_COMP):
+ TwoDArray<CoeffType>(height, width), m_csort(cs){}
- //! Constructor
- PredictStep97() {}
+ //copy constructor and assignment= derived by inheritance
- // Assume default copy constructor, assignment= and destructor //
+ //! Destructor
+ ~CoeffArray(){}
- //! Do the filtering
- /*
- Do the filtering.
- \param in_val the value being predicted
- \param val1 the first value being used for prediction
- \param val2 the second value being used for prediction
- */
- inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
- {
- in_val -= static_cast< CoeffType >((gain * static_cast< int >(val1 + val2)) >> 12);
- }
-};
+ //! Return which component is stored
+ const CompSort& CSort() const {return m_csort;}
-//! Class to do two-tap update lifting step for Daubechies (9,7)
-template <int gain> class UpdateStep97
-{
+ //! Set the type of component being stored
+ void SetCSort(const CompSort cs){ m_csort = cs; }
-public:
- //! Constructor
- UpdateStep97() {}
+ //! Returns the set of subbands
+ SubbandList& BandList(){return m_band_list;}
- //! Do the filtering
- /*
- Do the filtering.
- \param in_val the value being updated
- \param val1 the first value being used for updating
- \param val2 the second value being used for updating
- */
- inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
- {
- in_val += static_cast< CoeffType >((gain * static_cast< int >(val1 + val2)) >> 12);
- }
-};
-
-//! A class for wavelet coefficient data.
-/*!
- A class for encapsulating coefficient data, derived from TwoDArray..
- */
-class CoeffArray: public TwoDArray<CoeffType>
-{
-public:
- //! Default constructor
- /*!
- Default constructor creates an empty array.
- */
- CoeffArray(): TwoDArray<CoeffType>() {}
+ //! Returns the set of subbands
+ const SubbandList& BandList() const {return m_band_list;}
- //! Constructor.
- /*!
- Contructor creates a two-D array, with specified size and colour
- format.
- */
- CoeffArray(int height, int width, CompSort cs = Y_COMP):
- TwoDArray<CoeffType>(height, width), m_csort(cs) {}
+ //! Sets the subband weights
+ /*!
+ Sets perceptual weights for the subbands. Takes into account both perceptual factors
+ (weight noise less at higher spatial frequencies) and the scaling needed for the
+ wavelet transform.
+ */
+ void SetBandWeights (const EncoderParams& encparams,
+ const PictureParams& pparams,
+ const CompSort csort,
+ const float cpd_scale_factor);
- //copy constructor and assignment= derived by inheritance
+ private:
- //! Destructor
- ~CoeffArray() {}
+ CompSort m_csort;
- //! Return which component is stored
- const CompSort& CSort() const
- {
- return m_csort;
- }
+ // The subband list to be used for conventional transform apps
+ SubbandList m_band_list;
- //! Set the type of component being stored
- void SetCSort(const CompSort cs)
- {
- m_csort = cs;
- }
+ private:
- //! Returns the set of subbands
- SubbandList& BandList()
- {
- return m_band_list;
- }
+ //! Given x and y spatial frequencies in cycles per degree, returns a weighting value
+ float PerceptualWeight(float xf,float yf,CompSort cs);
- //! Returns the set of subbands
- const SubbandList& BandList() const
- {
- return m_band_list;
- }
+ };
- //! Sets the subband weights
+ //! A class to do wavelet transforms
/*!
- Sets perceptual weights for the subbands. Takes into account both perceptual factors
- (weight noise less at higher spatial frequencies) and the scaling needed for the
- wavelet transform.
+ A class to do forward and backward wavelet transforms by iteratively splitting or merging the
+ lowest frequency band.
*/
- void SetBandWeights(const EncoderParams& encparams,
- const PictureParams& pparams,
- const CompSort csort,
- const float cpd_scale_factor);
-
-private:
-
- CompSort m_csort;
-
- // The subband list to be used for conventional transform apps
- SubbandList m_band_list;
-
-private:
-
- //! Given x and y spatial frequencies in cycles per degree, returns a weighting value
- float PerceptualWeight(float xf, float yf, CompSort cs);
-
-};
-
-//! A class to do wavelet transforms
-/*!
- A class to do forward and backward wavelet transforms by iteratively splitting or merging the
- lowest frequency band.
-*/
-class WaveletTransform
-{
-public:
- //! Constructor
- WaveletTransform(int d = 4, WltFilter f = DAUB9_7);
+ class WaveletTransform
+ {
+ public:
+ //! Constructor
+ WaveletTransform(int d = 4, WltFilter f = DAUB9_7);
- //! Destructor
- virtual ~WaveletTransform();
+ //! Destructor
+ virtual ~WaveletTransform();
- //! Transforms the data to and from the wavelet domain
- /*!
- Transforms the data to and from the wavelet domain.
- \param d the direction of the transform
- \param pic_data the data to be transformed
- \param coeff_data array that holds the transform coefficient data
- */
- void Transform(const Direction d, PicArray& pic_data, CoeffArray& coeff_data);
+ //! Transforms the data to and from the wavelet domain
+ /*!
+ Transforms the data to and from the wavelet domain.
+ \param d the direction of the transform
+ \param pic_data the data to be transformed
+ \param coeff_data array that holds the transform coefficient data
+ */
+ void Transform(const Direction d, PicArray& pic_data, CoeffArray& coeff_data);
-private:
+ private:
-private:
+ private:
- // Private variables
+ // Private variables
- //! Depth of the transform
- int m_depth;
+ //! Depth of the transform
+ int m_depth;
- //! The (vertical and horizontal) wavelet filter set to be used
- WltFilter m_filt_sort;
+ //! The (vertical and horizontal) wavelet filter set to be used
+ WltFilter m_filt_sort;
- //! A class to do the vertical and horizontal filtering required
- VHFilter* m_vhfilter;
+ //! A class to do the vertical and horizontal filtering required
+ VHFilter* m_vhfilter;
-private:
- // Private functions
- //! Private, bodyless copy constructor: class should not be copied
- WaveletTransform(const WaveletTransform& cpy);
+ private:
+ // Private functions
+ //! Private, bodyless copy constructor: class should not be copied
+ WaveletTransform(const WaveletTransform& cpy);
- //! Private, bodyless copy operator=: class should not be assigned
- WaveletTransform& operator=(const WaveletTransform& rhs);
+ //! Private, bodyless copy operator=: class should not be assigned
+ WaveletTransform& operator=(const WaveletTransform& rhs);
-};
+ };
}// end namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils_mmx.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils_mmx.cpp
index 70d5e511e..0a8953f8d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils_mmx.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_common/wavelet_utils_mmx.cpp
@@ -36,7 +36,7 @@
* or the LGPL.
* ***** END LICENSE BLOCK ***** */
-/*!
+/*!
* MMX version of wavelet transform routines. Note that these routines
* assume that wavelet coefficients, of type CoeffType, are in fact
* shorts. This is set in libdirac_common/common.h. Turning MMX on
@@ -55,76 +55,76 @@ static TwoDArray<CoeffType> t_temp_data;
#if 0
//Attempt1
-inline void Interleave_mmx(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+inline void Interleave_mmx( const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xl2(xl >> 1);
- const int yl2(yl >> 1);
- const int yend(yp + yl);
+ const int xl2( xl>>1);
+ const int yl2( yl>>1);
+ const int yend( yp + yl );
- if(coeff_data.LengthX() > t_temp_data.LengthX() ||
- coeff_data.LengthY() > t_temp_data.LengthY())
+ if (coeff_data.LengthX() > t_temp_data.LengthX() ||
+ coeff_data.LengthY() > t_temp_data.LengthY())
{
t_temp_data.Resize(coeff_data.LengthY(), coeff_data.LengthX());
}
// Make a temporary copy of the subband
- for(int j = yp; j < yend ; j++)
- memcpy(t_temp_data[j-yp] , coeff_data[j] + xp , xl * sizeof(CoeffType));
+ for (int j = yp; j<yend ; j++ )
+ memcpy( t_temp_data[j-yp] , coeff_data[j]+xp , xl * sizeof( CoeffType ) );
- int stopx = (xl2 >> 2) << 2;
+ int stopx = (xl2>>2)<<2;
// Re-order to interleave
- for(int j = 0, s = yp; j < yl2 ; j++, s += 2)
+ for (int j = 0, s=yp; j<yl2 ; j++, s+=2)
{
CoeffType *tmp1 = &t_temp_data[j][0];
CoeffType *out = &coeff_data[s][xp];
- for(int i = 0 , t = xp ; i < xp + stopx ; i += 4 , t += 8)
+ for (int i = 0 , t = xp ; i<xp+stopx ; i+=4 , t+=8)
{
__m64 m1 = *(__m64 *)tmp1;
- __m64 m2 = *(__m64 *)(tmp1 + xl2);
- *(__m64 *)out = _mm_unpacklo_pi16(m1, m2);
- out += 4;
- *(__m64 *)out = _mm_unpackhi_pi16(m1, m2);
- out += 4;
+ __m64 m2 = *(__m64 *)(tmp1+xl2);
+ *(__m64 *)out = _mm_unpacklo_pi16 (m1, m2);
+ out+=4;
+ *(__m64 *)out = _mm_unpackhi_pi16 (m1, m2);
+ out+=4;
tmp1 += 4;
}
- for(int i = xp + stopx , r = 2 * (xp + stopx) ; i < xl2 ; i++ , r += 2)
+ for (int i = xp+stopx , r=2*(xp+stopx) ; i<xl2 ; i++ , r += 2)
{
*out = *tmp1;
++out;
- *out = *(tmp1 + xl2);
+ *out = *(tmp1+xl2);
++out;
++tmp1;
}
- }// j
-
- for(int j = yl2, s = yp + 1 ; j < yl ; j++ , s += 2)
+ }// j
+
+ for (int j = yl2, s=yp+1 ; j<yl ; j++ , s += 2)
{
CoeffType *tmp1 = &t_temp_data[j][0];
//CoeffType *tmp2 = &t_temp_data[j][xl2];
CoeffType *out = &coeff_data[s][xp];
- for(int i = 0 , t = xp; i < stopx ; i += 4 , t += 8)
+ for (int i = 0 , t=xp; i<stopx ; i+=4 , t += 8)
{
__m64 m1 = *(__m64 *)tmp1;
- __m64 m2 = *(__m64 *)(tmp1 + xl2);
- *(__m64 *)out = _mm_unpacklo_pi16(m1, m2);
- out += 4;
- *(__m64 *)out = _mm_unpackhi_pi16(m1, m2);
- out += 4;
+ __m64 m2 = *(__m64 *)(tmp1+xl2);
+ *(__m64 *)out = _mm_unpacklo_pi16 (m1, m2);
+ out+=4;
+ *(__m64 *)out = _mm_unpackhi_pi16 (m1, m2);
+ out+=4;
tmp1 += 4;
}
- for(int i = stopx , r = 2 * (xp + stopx) ; i < xl2 ; i++ , r += 2)
+ for (int i = stopx , r=2*(xp+stopx) ; i<xl2 ; i++ , r += 2)
{
*out = *tmp1;
++out;
- *out = *(tmp1 + xl2);
+ *out = *(tmp1+xl2);
++out;
++tmp1;
}
- }// j
+ }// j
_mm_empty();
}
@@ -132,13 +132,13 @@ inline void Interleave_mmx(const int xp ,
void VHFilter::ShiftRowLeft(CoeffType *row, int length, int shift)
{
- int xstop = length / 4 * 4;
+ int xstop = length/4*4;
CoeffType *shift_row = row;
- for(int i = 0; i < xstop; i += 4, shift_row += 4)
- * (__m64 *)shift_row = _mm_slli_pi16(*(__m64 *)shift_row, shift);
+ for (int i = 0; i < xstop; i+=4, shift_row+=4)
+ *(__m64 *)shift_row = _mm_slli_pi16 (*(__m64 *)shift_row, shift);
// mopup
- for(int i = xstop; i < length; ++i)
+ for (int i = xstop; i < length; ++i)
row[i] <<= shift;
_mm_empty();
@@ -147,123 +147,123 @@ void VHFilter::ShiftRowLeft(CoeffType *row, int length, int shift)
void VHFilter::ShiftRowRight(CoeffType *row, int length, int shift)
{
CoeffType *shift_row = row;
- int round_val = 1 << (shift - 1);
- __m64 mmx_round = _mm_set_pi16(round_val, round_val, round_val, round_val);
+ int round_val = 1<<(shift-1);
+ __m64 mmx_round = _mm_set_pi16( round_val, round_val, round_val, round_val);
- int xstop = length / 4 * 4;
- for(int i = 0; i < xstop; i += 4, shift_row += 4)
+ int xstop = length/4*4;
+ for (int i = 0; i < xstop; i+=4, shift_row+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)shift_row, mmx_round);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)shift_row, mmx_round);
*(__m64 *)shift_row = _mm_srai_pi16(tmp, shift);
}
// mopup
- for(int i = xstop; i < length; ++i)
- row[i] = ((row[i] + round_val) >> shift);
+ for (int i = xstop; i < length; ++i)
+ row[i] = ((row[i]+round_val)>>shift);
_mm_empty();
}
-inline void Interleave_mmx(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+inline void Interleave_mmx( const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- const int xl2(xl >> 1);
- const int yl2(yl >> 1);
- const int yend(yp + yl);
+ const int xl2( xl>>1);
+ const int yl2( yl>>1);
+ const int yend( yp + yl );
- if(coeff_data.LengthX() > t_temp_data.LengthX() ||
- coeff_data.LengthY() > t_temp_data.LengthY())
+ if (coeff_data.LengthX() > t_temp_data.LengthX() ||
+ coeff_data.LengthY() > t_temp_data.LengthY())
{
t_temp_data.Resize(coeff_data.LengthY(), coeff_data.LengthX());
}
// Make a temporary copy of the subband. We are doing a vertical
// interleave while copying
- for(int j = yp, s = 0; j < yp + yl2 ; j++, s += 2)
- memcpy(t_temp_data[s] , coeff_data[j] + xp , xl * sizeof(CoeffType));
- for(int j = yp + yl2, s = 1; j < yend ; j++, s += 2)
- memcpy(t_temp_data[s] , coeff_data[j] + xp , xl * sizeof(CoeffType));
+ for (int j = yp, s=0; j<yp+yl2 ; j++, s+=2 )
+ memcpy( t_temp_data[s] , coeff_data[j]+xp , xl * sizeof( CoeffType ) );
+ for (int j = yp+yl2, s=1; j<yend ; j++, s+=2 )
+ memcpy( t_temp_data[s] , coeff_data[j]+xp , xl * sizeof( CoeffType ) );
- int stopx = (xl2 >> 2) << 2;
+ int stopx = (xl2>>2)<<2;
// Re-order to horizontally interleave
- for(int j = 0, s = yp; j < yl ; j++, ++s)
+ for (int j = 0, s=yp; j<yl ; j++, ++s)
{
CoeffType *tmp1 = &t_temp_data[j][0];
CoeffType *out = &coeff_data[s][xp];
- for(int i = 0 , t = xp ; i < xp + stopx ; i += 4 , t += 8)
+ for (int i = 0 , t = xp ; i<xp+stopx ; i+=4 , t+=8)
{
__m64 m1 = *(__m64 *)tmp1;
- __m64 m2 = *(__m64 *)(tmp1 + xl2);
- *(__m64 *)out = _mm_unpacklo_pi16(m1, m2);
- out += 4;
- *(__m64 *)out = _mm_unpackhi_pi16(m1, m2);
- out += 4;
+ __m64 m2 = *(__m64 *)(tmp1+xl2);
+ *(__m64 *)out = _mm_unpacklo_pi16 (m1, m2);
+ out+=4;
+ *(__m64 *)out = _mm_unpackhi_pi16 (m1, m2);
+ out+=4;
tmp1 += 4;
}
- for(int i = xp + stopx , r = 2 * (xp + stopx) ; i < xl2 ; i++ , r += 2)
+ for (int i = xp+stopx , r=2*(xp+stopx) ; i<xl2 ; i++ , r += 2)
{
*out = *tmp1;
++out;
- *out = *(tmp1 + xl2);
+ *out = *(tmp1+xl2);
++out;
++tmp1;
}
- }// j
-
+ }// j
+
_mm_empty();
}
-void VHFilterDD9_7::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+void VHFilterDD9_7::Synth(const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
int i, j;
- const int xend(xp + xl);
- const int yend(yp + yl);
- const int ymid = yp + yl / 2;
+ const int xend( xp+xl );
+ const int yend( yp+yl );
+ const int ymid = yp+yl/2;
PredictStepShift<2> predict;
- __m64 pred_round = _mm_set_pi16(1 << (2 - 1), 1 << (2 - 1), 1 << (2 - 1), 1 << (2 - 1));
-
- int xstop = xp + ((xl >> 2) << 2);
+ __m64 pred_round = _mm_set_pi16 (1<<(2-1), 1<<(2-1), 1<<(2-1), 1<<(2-1));
+
+ int xstop = xp + ((xl>>2)<<2);
// First lifting stage
// Top edge
CoeffType *in1 = coeff_data[ymid];
CoeffType *in2 = coeff_data[ymid];
CoeffType *out = coeff_data[yp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4 )
{
// tmp = val + val2
- __m64 tmp = _mm_add_pi16(*(__m64 *)in1, *(__m64 *)in2);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)in1, *(__m64 *)in2);
// unbiased rounding tmp = (tmp + 1<<(shift-1))>>shift
tmp = _mm_add_pi16(tmp, pred_round);
tmp = _mm_srai_pi16(tmp, 2);
// in_val -= tmp;
- *(__m64 *)out = _mm_sub_pi16(*(__m64*)out, tmp);
+ *(__m64 *)out = _mm_sub_pi16 (*(__m64*)out, tmp);
out += 4;
in1 += 4;
in2 += 4;
}
// Middle bit
- for(j = 1 ; j < yl / 2 ; ++j)
+ for ( j=1 ; j < yl/2 ; ++j )
{
in1 = coeff_data[ymid+j-1];
in2 = coeff_data[ymid+j];
out = coeff_data[yp+j];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4 )
{
// tmp = val + val2
- __m64 tmp = _mm_add_pi16(*(__m64 *)in1, *(__m64 *)in2);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)in1, *(__m64 *)in2);
// unbiased rounding tmp = (tmp + 1<<(shift-1))>>shift
tmp = _mm_add_pi16(tmp, pred_round);
tmp = _mm_srai_pi16(tmp, 2);
// in_val -= tmp;
- *(__m64 *)out = _mm_sub_pi16(*(__m64*)out, tmp);
+ *(__m64 *)out = _mm_sub_pi16 (*(__m64*)out, tmp);
out += 4;
in1 += 4;
in2 += 4;
@@ -271,261 +271,261 @@ void VHFilterDD9_7::Synth(const int xp ,
}
// Mopup
- if(xstop != xend)
+ if (xstop != xend)
{
- for(i = xstop ; i < xend ; i++)
+ for ( i = xstop ; i < xend ; i++)
{
- predict.Filter(coeff_data[yp][i] , coeff_data[ymid][i] , coeff_data[ymid][i]);
+ predict.Filter( coeff_data[yp][i] , coeff_data[ymid][i] , coeff_data[ymid][i] );
}// i
- for(j = 1 ; j < yl / 2 ; ++j)
+ for ( j=1 ; j < yl/2 ; ++j )
{
- for(i = xstop ; i < xend ; i++)
+ for ( i = xstop ; i < xend ; i++)
{
- predict.Filter(coeff_data[yp+j][i] , coeff_data[ymid+j-1][i] , coeff_data[ymid+j][i]);
+ predict.Filter( coeff_data[yp+j][i] , coeff_data[ymid+j-1][i] , coeff_data[ymid+j][i] );
}// i
}// j
}
-
+
// Second lifting stage
- UpdateStepFourTap < 4 , 9 , -1 > update;
+ UpdateStepFourTap< 4 , 9 , -1> update;
// rounding factor for update step
- __m64 update_round = _mm_set_pi32(1 << (4 - 1), 1 << (4 - 1));
+ __m64 update_round = _mm_set_pi32 (1<<(4-1), 1<<(4-1));
// top edge
in1 = coeff_data[yp];
in2 = coeff_data[yp+1];
CoeffType *in3 = coeff_data[yp];
CoeffType *in4 = coeff_data[yp+2];
out = coeff_data[ymid];
- __m64 tap1 = _mm_set_pi16(9, 9, 9, 9);
- __m64 tap2 = _mm_set_pi16(-1, -1, -1, -1);
-
- for(i = xp ; i < xstop ; i += 4)
+ __m64 tap1 = _mm_set_pi16 (9, 9, 9, 9);
+ __m64 tap2 = _mm_set_pi16 (-1, -1, -1, -1);
+
+ for ( i = xp ; i < xstop ; i+=4 )
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}
- // middle bit
- for(j = 1 ; j < yl / 2 - 2 ; ++j)
- {
+ // middle bit
+ for ( j=1 ; j < yl/2 - 2 ; ++j)
+ {
in1 = coeff_data[yp+j];
in2 = coeff_data[yp+j+1];
in3 = coeff_data[yp+j-1];
in4 = coeff_data[yp+j+2];
out = coeff_data[ymid+j];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
- }// i
- }// k
-
- // bottom edge
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
+ }// i
+ }// k
+
+ // bottom edge
in1 = coeff_data[ymid-2];
in2 = coeff_data[ymid-1];
in3 = coeff_data[ymid-3];
in4 = coeff_data[ymid-1];
out = coeff_data[yend-2];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}
-
+
in1 = coeff_data[ymid-1];
in2 = coeff_data[ymid-1];
in3 = coeff_data[ymid-2];
in4 = coeff_data[ymid-1];
out = coeff_data[yend-1];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}
-
- if(xstop != xend)
+
+ if (xstop != xend)
{
- for(i = xstop ; i < xend ; i++)
+ for ( i = xstop ; i < xend ; i++)
{
- update.Filter(coeff_data[ymid][i] , coeff_data[yp][i], coeff_data[yp+1][i], coeff_data[yp][i], coeff_data[yp+2][i]);
+ update.Filter( coeff_data[ymid][i] , coeff_data[yp][i], coeff_data[yp+1][i], coeff_data[yp][i],coeff_data[yp+2][i]);
}// i
// middle bit
- for(j = 1 ; j < yl / 2 - 2 ; ++j)
+ for ( j=1 ; j < yl/2 - 2 ; ++j)
{
- for(i = xstop ; i < xend ; i++)
+ for ( i = xstop ; i < xend ; i++)
{
- update.Filter(coeff_data[ymid+j][i] , coeff_data[yp+j][i], coeff_data[yp+j+1][i], coeff_data[yp+j-1][i], coeff_data[yp+j+2][i]);
+ update.Filter( coeff_data[ymid+j][i] , coeff_data[yp+j][i], coeff_data[yp+j+1][i], coeff_data[yp+j-1][i],coeff_data[yp+j+2][i]);
}// i
}// k
-
- for(i = xstop ; i < xend ; i++)
+
+ for ( i = xstop ; i < xend ; i++)
{
- update.Filter(coeff_data[yend - 2][i] , coeff_data[ymid-2][i], coeff_data[ymid-1][i], coeff_data[ymid-3][i], coeff_data[ymid-1][i]);
- update.Filter(coeff_data[yend - 1][i] , coeff_data[ymid-1][i], coeff_data[ymid-1][i], coeff_data[ymid-2][i], coeff_data[ymid-1][i]);
+ update.Filter( coeff_data[yend - 2][i] , coeff_data[ymid-2][i], coeff_data[ymid-1][i], coeff_data[ymid-3][i],coeff_data[ymid-1][i]);
+ update.Filter( coeff_data[yend - 1][i] , coeff_data[ymid-1][i], coeff_data[ymid-1][i], coeff_data[ymid-2][i],coeff_data[ymid-1][i]);
}// i
}
// Horizontal sythesis
+
+ const int xmid = xl/2;
+ xstop = xmid %4 ? ((xmid>>2)<<2) + 1 : xmid -3;
- const int xmid = xl / 2;
- xstop = xmid % 4 ? ((xmid >> 2) << 2) + 1 : xmid - 3;
-
- for(j = yp; j < yend; ++j)
+ for (j = yp; j < yend; ++j)
{
- CoeffType *line_data = &coeff_data[j][xp];
+ CoeffType *line_data = &coeff_data[j][xp];
// First lifting stage acts on even samples i.e. the low pass ones
- predict.Filter(line_data[0] , line_data[xmid] , line_data[xmid]);
- for(i = 1 ; i < xmid ; ++i)
+ predict.Filter( line_data[0] , line_data[xmid] , line_data[xmid] );
+ for (i=1 ; i < xmid ; ++i)
{
- predict.Filter(line_data[i] , line_data[xmid+i-1] , line_data[xmid+i]);
+ predict.Filter( line_data[i] , line_data[xmid+i-1] , line_data[xmid+i] );
}
// Second lifting stage
- update.Filter(line_data[xmid] , line_data[0] , line_data[1] , line_data[0] , line_data[2]);
+ update.Filter( line_data[xmid] , line_data[0] , line_data[1] , line_data[0] , line_data[2] );
- for(i = 1 ; i < xmid - 2; ++i)
+ for (i=1 ; i < xmid - 2; ++i)
{
- update.Filter(line_data[xmid+i] , line_data[i] , line_data[i+1] , line_data[i-1] , line_data[i+2]);
- }// i
- update.Filter(line_data[xl-2] , line_data[xmid-2] , line_data[xmid-1] , line_data[xmid-3] , line_data[xmid-1]);
- update.Filter(line_data[xl-1] , line_data[xmid-1] , line_data[xmid-1] , line_data[xmid-2] , line_data[xmid-1]);
-
+ update.Filter( line_data[xmid+i] , line_data[i] , line_data[i+1] , line_data[i-1] , line_data[i+2] );
+ }// i
+ update.Filter( line_data[xl-2] , line_data[xmid-2] , line_data[xmid-1] , line_data[xmid-3] , line_data[xmid-1] );
+ update.Filter( line_data[xl-1] , line_data[xmid-1] , line_data[xmid-1] , line_data[xmid-2] , line_data[xmid-1] );
+
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
}// j
_mm_empty();
- Interleave_mmx(xp , yp , xl , yl , coeff_data);
+ Interleave_mmx( xp , yp , xl ,yl , coeff_data );
}
void VHFilterDD13_7::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- int i, j, k;
+ int i,j,k;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
- PredictStepFourTap < 5 , 9 , -1 > predict;
- __m64 pred_round = _mm_set_pi32(1 << (5 - 1), 1 << (5 - 1));
- UpdateStepFourTap < 4 , 9 , -1 > update;
- __m64 update_round = _mm_set_pi32(1 << (4 - 1), 1 << (4 - 1));
+ PredictStepFourTap< 5 , 9 , -1 > predict;
+ __m64 pred_round = _mm_set_pi32 (1<<(5-1), 1<<(5-1));
+ UpdateStepFourTap< 4 , 9 , -1> update;
+ __m64 update_round = _mm_set_pi32 (1<<(4-1), 1<<(4-1));
// Next, do the vertical synthesis
- int ymid = yp + yl / 2;
+ int ymid = yp + yl/2;
- int xstop = xp + ((xl >> 2) << 2);
+ int xstop = xp + ((xl>>2)<<2);
// First lifting stage - odd samples
// bottom edge
CoeffType *out = coeff_data[ymid-1];
@@ -534,78 +534,78 @@ void VHFilterDD13_7::Synth(const int xp ,
CoeffType *in3 = coeff_data[yend-3];
CoeffType *in4 = coeff_data[yend-1];
- __m64 tap1 = _mm_set_pi16(9, 9, 9, 9);
- __m64 tap2 = _mm_set_pi16(-1, -1, -1, -1);
- for(i = xp ; i < xstop; i += 4)
+ __m64 tap1 = _mm_set_pi16 (9, 9, 9, 9);
+ __m64 tap2 = _mm_set_pi16 (-1, -1, -1, -1);
+ for ( i = xp ; i<xstop; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, pred_round);
- val3 = _mm_add_pi32(val3, pred_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, pred_round);
+ val3 = _mm_add_pi32 (val3, pred_round);
val1 = _mm_srai_pi32(val1, 5);
val3 = _mm_srai_pi32(val3, 5);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_sub_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_sub_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}// i
// middle bit
- for(j = 2 ; j < yl / 2 - 1 ; ++j)
+ for ( j = 2 ; j < yl/2 -1 ; ++j)
{
out = coeff_data[yp+j];
in1 = coeff_data[ymid+j-1];
in2 = coeff_data[ymid+j];
in3 = coeff_data[ymid+j-2];
in4 = coeff_data[ymid+j+1];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, pred_round);
- val3 = _mm_add_pi32(val3, pred_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, pred_round);
+ val3 = _mm_add_pi32 (val3, pred_round);
val1 = _mm_srai_pi32(val1, 5);
val3 = _mm_srai_pi32(val3, 5);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_sub_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_sub_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}// i
}// j
@@ -615,36 +615,36 @@ void VHFilterDD13_7::Synth(const int xp ,
in2 = coeff_data[ymid+1];
in3 = coeff_data[ymid+2];
in4 = coeff_data[ymid];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, pred_round);
- val3 = _mm_add_pi32(val3, pred_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, pred_round);
+ val3 = _mm_add_pi32 (val3, pred_round);
val1 = _mm_srai_pi32(val1, 5);
val3 = _mm_srai_pi32(val3, 5);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_sub_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_sub_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}
out = coeff_data[yp];
@@ -652,61 +652,61 @@ void VHFilterDD13_7::Synth(const int xp ,
in2 = coeff_data[ymid];
in3 = coeff_data[ymid+1];
in4 = coeff_data[ymid];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, pred_round);
- val3 = _mm_add_pi32(val3, pred_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, pred_round);
+ val3 = _mm_add_pi32 (val3, pred_round);
val1 = _mm_srai_pi32(val1, 5);
val3 = _mm_srai_pi32(val3, 5);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_sub_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_sub_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}
- // Mopup
- if(xstop != xend)
+ // Mopup
+ if ( xstop != xend)
{
// Mopup bottom edge
- for(i = xstop ; i < xend ; ++ i)
+ for ( i = xstop ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[ymid-1][i] , coeff_data[yend-2][i] , coeff_data[yend-1][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
+ predict.Filter( coeff_data[ymid-1][i] , coeff_data[yend-2][i] , coeff_data[yend-1][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
}// i
// Mopup middle bit
- for(k = 2 ; k < yl / 2 - 1 ; ++k)
+ for ( k = 2 ; k < yl/2 - 1 ; ++k)
{
- for(i = xstop ; i < xend ; ++ i)
+ for ( i = xstop ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+k][i] , coeff_data[ymid+k-1][i] , coeff_data[ymid+k][i] , coeff_data[ymid+k-2][i] , coeff_data[ymid+k+1][i]);
+ predict.Filter( coeff_data[yp+k][i] , coeff_data[ymid+k-1][i] , coeff_data[ymid+k][i] , coeff_data[ymid+k-2][i] , coeff_data[ymid+k+1][i] );
}// i
}// k
//Mopup top edge
- for(i = xstop ; i < xend ; ++ i)
+ for ( i = xstop ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+1][i] , coeff_data[ymid][i] , coeff_data[ymid+1][i] , coeff_data[ymid+2][i] , coeff_data[ymid][i]);
- predict.Filter(coeff_data[yp][i] , coeff_data[ymid][i] , coeff_data[ymid][i] , coeff_data[ymid+1][i] , coeff_data[ymid][i]);
+ predict.Filter( coeff_data[yp+1][i] , coeff_data[ymid][i] , coeff_data[ymid+1][i] , coeff_data[ymid+2][i] , coeff_data[ymid][i] );
+ predict.Filter( coeff_data[yp][i] , coeff_data[ymid][i] , coeff_data[ymid][i] , coeff_data[ymid+1][i] , coeff_data[ymid][i] );
}// i
@@ -719,77 +719,77 @@ void VHFilterDD13_7::Synth(const int xp ,
in2 = coeff_data[yp+1];
in3 = coeff_data[yp];
in4 = coeff_data[yp+2];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}// i
// middle bit
- for(k = 1 ; k < yl / 2 - 2 ; ++k)
+ for ( k = 1 ; k < yl/2 - 2 ; ++k)
{
out = coeff_data[ymid+k];
in1 = coeff_data[k];
in2 = coeff_data[k+1];
in3 = coeff_data[k-1];
in4 = coeff_data[k+2];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}// i
}// k
@@ -799,36 +799,36 @@ void VHFilterDD13_7::Synth(const int xp ,
in2 = coeff_data[ymid-1];
in3 = coeff_data[ymid-3];
in4 = coeff_data[ymid-1];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}// i
out = coeff_data[yend-1];
@@ -836,96 +836,96 @@ void VHFilterDD13_7::Synth(const int xp ,
in2 = coeff_data[ymid-1];
in3 = coeff_data[ymid-2];
in4 = coeff_data[ymid-1];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i<xstop ; i+=4)
{
__m64 val1, val2, val3, val4, tmp1, tmp2;
val1 = _mm_add_pi16(*(__m64*)in1, *(__m64*)in2);
- tmp1 = _mm_mullo_pi16(val1, tap1);
- tmp2 = _mm_mulhi_pi16(val1, tap1);
- val3 = _mm_unpackhi_pi16(tmp1, tmp2);
- val1 = _mm_unpacklo_pi16(tmp1, tmp2);
+ tmp1 = _mm_mullo_pi16 (val1, tap1);
+ tmp2 = _mm_mulhi_pi16 (val1, tap1);
+ val3 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val1 = _mm_unpacklo_pi16 (tmp1, tmp2);
val2 = _mm_add_pi16(*(__m64*)in3, *(__m64*)in4);
- tmp1 = _mm_mullo_pi16(val2, tap2);
- tmp2 = _mm_mulhi_pi16(val2, tap2);
- val4 = _mm_unpackhi_pi16(tmp1, tmp2);
- val2 = _mm_unpacklo_pi16(tmp1, tmp2);
-
- val1 = _mm_add_pi32(val1, val2);
- val3 = _mm_add_pi32(val3, val4);
- val1 = _mm_add_pi32(val1, update_round);
- val3 = _mm_add_pi32(val3, update_round);
+ tmp1 = _mm_mullo_pi16 (val2, tap2);
+ tmp2 = _mm_mulhi_pi16 (val2, tap2);
+ val4 = _mm_unpackhi_pi16 (tmp1, tmp2);
+ val2 = _mm_unpacklo_pi16 (tmp1, tmp2);
+
+ val1 = _mm_add_pi32 (val1, val2);
+ val3 = _mm_add_pi32 (val3, val4);
+ val1 = _mm_add_pi32 (val1, update_round);
+ val3 = _mm_add_pi32 (val3, update_round);
val1 = _mm_srai_pi32(val1, 4);
val3 = _mm_srai_pi32(val3, 4);
- val1 = _mm_packs_pi32(val1, val3);
-
- *(__m64*)out = _mm_add_pi16(*(__m64*)out, val1);
- in1 += 4;
- in2 += 4;
- in3 += 4;
- in4 += 4;
- out += 4;
+ val1 = _mm_packs_pi32 (val1, val3);
+
+ *(__m64*)out = _mm_add_pi16 (*(__m64*)out,val1);
+ in1 +=4;
+ in2 +=4;
+ in3 +=4;
+ in4 +=4;
+ out +=4;
}// i
+
-
- // Mopup
- if(xstop != xend)
+ // Mopup
+ if ( xstop != xend)
{
// bottom edge
- for(i = xstop ; i < xend ; ++ i)
+ for ( i = xstop ; i<xend ; ++ i)
{
- update.Filter(coeff_data[yend-1][i] , coeff_data[ymid-1][i] , coeff_data[ymid-1][i] , coeff_data[ymid-2][i] , coeff_data[ymid-1][i]);
- update.Filter(coeff_data[yend-2][i] , coeff_data[ymid-2][i] , coeff_data[ymid-1][i] , coeff_data[ymid-3][i] , coeff_data[ymid-1][i]);
+ update.Filter( coeff_data[yend-1][i] , coeff_data[ymid-1][i] , coeff_data[ymid-1][i] , coeff_data[ymid-2][i] , coeff_data[ymid-1][i] );
+ update.Filter( coeff_data[yend-2][i] , coeff_data[ymid-2][i] , coeff_data[ymid-1][i] , coeff_data[ymid-3][i] , coeff_data[ymid-1][i] );
}// i
// middle bit
- for(k = 1 ; k < yl / 2 - 2 ; ++k)
+ for ( k = 1 ; k < yl/2 - 2 ; ++k)
{
- for(i = xstop ; i < xend ; ++ i)
+ for ( i = xstop ; i<xend ; ++ i)
{
- update.Filter(coeff_data[ymid+k][i] , coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] , coeff_data[k+2][i]);
+ update.Filter( coeff_data[ymid+k][i] , coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] , coeff_data[k+2][i] );
}// i
}// j
// top edge - j=xp
- for(i = xstop ; i < xend ; ++ i)
+ for ( i = xstop ; i<xend ; ++ i)
{
- update.Filter(coeff_data[ymid][i] , coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i]);
+ update.Filter( coeff_data[ymid][i] , coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp][i] , coeff_data[yp+2][i] );
}// i
}
// Next do the horizontal synthesis
CoeffType* line_data;
- int xmid = xl / 2;
+ int xmid = xl/2;
- for(j = yp; j < yend ; ++j)
+ for (j = yp; j < yend ; ++j)
{
- line_data = &coeff_data[j][xp];
+ line_data = &coeff_data[j][xp];
// First lifting stage
- predict.Filter(line_data[0] , line_data[xmid] , line_data[xmid] , line_data[xmid+1] , line_data[xmid]);
- predict.Filter(line_data[1] , line_data[xmid] , line_data[xmid+1] , line_data[xmid+2] , line_data[xmid]);
+ predict.Filter( line_data[0] , line_data[xmid] , line_data[xmid] , line_data[xmid+1] , line_data[xmid] );
+ predict.Filter( line_data[1] , line_data[xmid] , line_data[xmid+1] , line_data[xmid+2] , line_data[xmid] );
- for(k = 2 ; k < xmid - 1 ; ++k)
+ for (k=2 ; k < xmid-1 ; ++k)
{
- predict.Filter(line_data[k] , line_data[xmid+k-1] , line_data[xmid+k] , line_data[xmid+k-2] , line_data[xmid+k+1]);
+ predict.Filter( line_data[k] , line_data[xmid+k-1] , line_data[xmid+k] , line_data[xmid+k-2] , line_data[xmid+k+1] );
- }// i
- predict.Filter(line_data[xmid-1] , line_data[xl-2] , line_data[xl-1] , line_data[xl-3] , line_data[xl-1]);
+ }// i
+ predict.Filter( line_data[xmid-1] , line_data[xl-2] , line_data[xl-1] , line_data[xl-3] , line_data[xl-1] );
- //second lifting stage
+ //second lifting stage
- update.Filter(line_data[xmid] , line_data[0] , line_data[1] , line_data[0] , line_data[2]);
- for(k = 1 ; k < xmid - 2 ; ++k)
+ update.Filter( line_data[xmid] , line_data[0] , line_data[1] , line_data[0] , line_data[2] );
+ for (k=1 ; k<xmid-2 ; ++k)
{
- update.Filter(line_data[xmid+k] , line_data[k] , line_data[k+1] , line_data[k-1] , line_data[k+2]);
- }// i
- update.Filter(line_data[xl-2] , line_data[xmid-2] , line_data[xmid-1] , line_data[xmid-3] , line_data[xmid-1]);
- update.Filter(line_data[xl-1] , line_data[xmid-1] , line_data[xmid-1] , line_data[xmid-2] , line_data[xmid-1]);
+ update.Filter( line_data[xmid+k] , line_data[k] , line_data[k+1] , line_data[k-1] , line_data[k+2] );
+ }// i
+ update.Filter( line_data[xl-2] , line_data[xmid-2] , line_data[xmid-1] , line_data[xmid-3] , line_data[xmid-1] );
+ update.Filter( line_data[xl-1] , line_data[xmid-1] , line_data[xmid-1] , line_data[xmid-2] , line_data[xmid-1] );
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
@@ -933,74 +933,74 @@ void VHFilterDD13_7::Synth(const int xp ,
}// j
_mm_empty();
- // Interleave subbands
- Interleave_mmx(xp , yp , xl , yl , coeff_data);
+ // Interleave subbands
+ Interleave_mmx( xp , yp , xl , yl , coeff_data );
}
#if 0
//Opts - Attempt1
void VHFilterLEGALL5_3::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
- int i, j, k;
+ int i,j,k;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
const PredictStepShift< 2 > predict;
const UpdateStepShift< 1 > update;
CoeffType* line_data;
- // Firstly reorder to interleave subbands, so that subsequent calculations
+ // Firstly reorder to interleave subbands, so that subsequent calculations
// can be in-place
- Interleave_mmx(xp , yp , xl , yl , coeff_data);
+ Interleave_mmx( xp , yp , xl , yl , coeff_data );
// Next, do the vertical synthesis
// First lifting stage
- int xstop = (xend >> 2) << 2;
-
+ int xstop = (xend>>2)<<2;
+
// Begin the top edge
CoeffType *row1, *row2, *row3, *row4;
row1 = &coeff_data[yp][xp];
row2 = &coeff_data[yp+1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row2);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row2);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row1 = _mm_sub_pi16(*(__m64*)row1, tmp);
+ *(__m64 *)row1 = _mm_sub_pi16 (*(__m64*)row1, tmp);
row1 += 4;
row2 += 4;
}
// Mopup
- for(i = xstop ; i < xend ; ++i)
+ for ( i = xstop ; i < xend ; ++i)
{
- predict.Filter(coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i]);
+ predict.Filter( coeff_data[yp][i] , coeff_data[yp+1][i] , coeff_data[yp+1][i] );
}// i
// Next, do the middle bit
- for(k = yp + 2 ; k < yend - 2 ; k += 2)
+ for ( k = yp+2 ; k < yend-2 ; k+=2)
{
CoeffType *row1 = &coeff_data[k-2][xp];
CoeffType *row2 = &coeff_data[k-1][xp];
CoeffType *row3 = &coeff_data[k][xp];
CoeffType *row4 = &coeff_data[k+1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row4, *(__m64 *)row2);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row4, *(__m64 *)row2);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row3 = _mm_sub_pi16(*(__m64*)row3, tmp);
+ *(__m64 *)row3 = _mm_sub_pi16 (*(__m64*)row3, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row1, *(__m64 *)row3);
+ tmp = _mm_add_pi16 (*(__m64 *)row1, *(__m64 *)row3);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row2 = _mm_add_pi16(*(__m64*)row2, tmp);
+ *(__m64 *)row2 = _mm_add_pi16 (*(__m64*)row2, tmp);
row1 += 4;
row2 += 4;
row3 += 4;
@@ -1008,32 +1008,32 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
}// i
//Mopup
- for(i = xstop ; i < xend ; ++i)
+ for ( i = xstop ; i < xend ; ++i)
{
- predict.Filter(coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i]);
- update.Filter(coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i]);
+ predict.Filter( coeff_data[k][i] , coeff_data[k+1][i] , coeff_data[k-1][i] );
+ update.Filter( coeff_data[k-1][i] , coeff_data[k-2][i] , coeff_data[k][i] );
}// i
}// j
-
+
// Finally with the bottom edge
row1 = &coeff_data[yend-4][xp];
row2 = &coeff_data[yend-3][xp];
row3 = &coeff_data[yend-2][xp];
row4 = &coeff_data[yend-1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row4);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row4);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row3 = _mm_sub_pi16(*(__m64*)row3, tmp);
+ *(__m64 *)row3 = _mm_sub_pi16 (*(__m64*)row3, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row3, *(__m64 *)row1);
+ tmp = _mm_add_pi16 (*(__m64 *)row3, *(__m64 *)row1);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row2 = _mm_add_pi16(*(__m64*)row2, tmp);
+ *(__m64 *)row2 = _mm_add_pi16 (*(__m64*)row2, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row3, *(__m64 *)row3);
+ tmp = _mm_add_pi16 (*(__m64 *)row3, *(__m64 *)row3);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row4 = _mm_add_pi16(*(__m64*)row4, tmp);
+ *(__m64 *)row4 = _mm_add_pi16 (*(__m64*)row4, tmp);
row1 += 4;
row2 += 4;
@@ -1041,31 +1041,31 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
row4 += 4;
}// i
// mopup
- for(i = xstop ; i < xend ; ++i)
+ for ( i = xstop ; i < xend ; ++i)
{
- predict.Filter(coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i]);
- update.Filter(coeff_data[yend-3][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i]);
- update.Filter(coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i]);
+ predict.Filter( coeff_data[yend-2][i] , coeff_data[yend-3][i] , coeff_data[yend-1][i] );
+ update.Filter( coeff_data[yend-3][i] , coeff_data[yend-2][i] , coeff_data[yend-4][i] );
+ update.Filter( coeff_data[yend-1][i] , coeff_data[yend-2][i] , coeff_data[yend-2][i] );
}// i
// Next do the horizontal synthesis
- for(j = yp; j < yend ; ++j)
+ for (j = yp; j < yend ; ++j)
{
- // First lifting stage
+ // First lifting stage
line_data = &coeff_data[j][xp];
- predict.Filter(line_data[0] , line_data[1] , line_data[1]);
+ predict.Filter( line_data[0] , line_data[1] , line_data[1] );
- for(k = 2; k < xl - 2; k += 2)
- {
- predict.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
- update.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
+ for ( k = 2; k < xl -2; k+=2)
+ {
+ predict.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
+ update.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
}// i
-
- predict.Filter(line_data[xl-2] , line_data[xl-3] , line_data[xl-1]);
- update.Filter(line_data[xl-3] , line_data[xl-2] , line_data[xl-4]);
- update.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2]);
+
+ predict.Filter( line_data[xl-2] , line_data[xl-3] , line_data[xl-1] );
+ update.Filter( line_data[xl-3] , line_data[xl-2] , line_data[xl-4] );
+ update.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] );
}
_mm_empty();
@@ -1075,16 +1075,16 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
#if 0
//Opts Attempt 2
void VHFilterLEGALL5_3::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- PicArray& coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ PicArray& coeff_data)
{
- int i, j, k;
- const int yend(yp + yl);
+ int i,j,k;
+ const int yend( yp+yl );
- const int xl2(xl >> 1);
- const int ymid(yp + (yl >> 1));
+ const int xl2 (xl>>1);
+ const int ymid (yp + (yl>>1));
const PredictStepShift< 2 > predict;
const UpdateStepShift< 1 > update;
@@ -1094,57 +1094,57 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
// Next, do the vertical synthesis
// First lifting stage
- int xstop = (xl >> 2) << 2;
+ int xstop = (xl>>2)<<2;
CoeffType *row1, *row2, *row3, *row4;
// First do the top edge
row1 = &coeff_data[yp][xp];
row2 = &coeff_data[ymid][xp];
- for(i = 0 ; i < xstop ; i += 4)
+ for ( i = 0 ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row2);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row2);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row1 = _mm_sub_pi16(*(__m64*)row1, tmp);
- row1 += 4;
- row2 += 4;
+ *(__m64 *)row1 = _mm_sub_pi16 (*(__m64*)row1, tmp);
+ row1+=4;
+ row2+=4;
}// i
//mopup
- for(i = xstop ; i < xl ; ++i)
+ for ( i = xstop ; i < xl ; ++i)
{
- predict.Filter(*row1 , *row2 , *row2);
+ predict.Filter( *row1 , *row2 , *row2);
++row1;
++row2;
}// i
// Next, do the middle bit
- for(k = 1 ; k < ymid - 1 ; ++k)
+ for ( k = 1 ; k < ymid-1 ; ++k)
{
row1 = &coeff_data[k-1][xp];
row2 = &coeff_data[k][xp];
row3 = &coeff_data[ymid+k-1][xp];
row4 = &coeff_data[ymid+k][xp];
- for(i = 0 ; i < xstop ; i += 4)
+ for ( i = 0 ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row3, *(__m64 *)row4);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row3, *(__m64 *)row4);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row2 = _mm_sub_pi16(*(__m64*)row2, tmp);
+ *(__m64 *)row2 = _mm_sub_pi16 (*(__m64*)row2, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row1);
+ tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row1);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row3 = _mm_add_pi16(*(__m64*)row3, tmp);
-
+ *(__m64 *)row3 = _mm_add_pi16 (*(__m64*)row3, tmp);
+
row1 += 4;
row2 += 4;
row3 += 4;
row4 += 4;
}// i
- for(i = xstop ; i < xl ; ++i)
+ for ( i = xstop ; i < xl ; ++i)
{
- predict.Filter(*row2 , *row4 , *row3);
- update.Filter(*row3 , *row2 , *row1);
+ predict.Filter( *row2 , *row4 , *row3 );
+ update.Filter( *row3 , *row2 , *row1 );
++row1;
++row2;
++row3;
@@ -1158,31 +1158,31 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
row2 = &coeff_data[ymid-1][xp];
row3 = &coeff_data[yend-2][xp];
row4 = &coeff_data[yend-1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i< xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row3, *(__m64 *)row4);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row3, *(__m64 *)row4);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row2 = _mm_sub_pi16(*(__m64*)row2, tmp);
+ *(__m64 *)row2 = _mm_sub_pi16 (*(__m64*)row2, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row1);
+ tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row1);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row3 = _mm_add_pi16(*(__m64*)row3, tmp);
-
- tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row2);
+ *(__m64 *)row3 = _mm_add_pi16 (*(__m64*)row3, tmp);
+
+ tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row2);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row4 = _mm_add_pi16(*(__m64*)row4, tmp);
-
+ *(__m64 *)row4 = _mm_add_pi16 (*(__m64*)row4, tmp);
+
row1 += 4;
row2 += 4;
row3 += 4;
row4 += 4;
}// i
// mopup
- for(i = xstop ; i < xl ; ++i)
+ for ( i = xstop ; i< xl ; ++i)
{
- predict.Filter(*row2 , *row3 , *row4);
- update.Filter(*row3 , *row1 , *row2);
- update.Filter(*row4 , *row2 , *row2);
+ predict.Filter( *row2 , *row3 , *row4 );
+ update.Filter( *row3 , *row1 , *row2 );
+ update.Filter( *row4 , *row2 , *row2 );
++row1;
++row2;
++row3;
@@ -1190,26 +1190,26 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
}// i
// Next do the horizontal synthesis
- xstop = (((xl2 - 2) >> 2) << 2) + 1;
+ xstop = (((xl2 - 2)>>2)<<2) + 1;
//xstop = 1;
- for(j = yp; j < yend ; ++j)
+ for (j = yp; j < yend ; ++j)
{
- // First lifting stage
+ // First lifting stage
line_data = &coeff_data[j][xp];
- predict.Filter(line_data[0] , line_data[xl2] , line_data[xl2]);
+ predict.Filter( line_data[0] , line_data[xl2] , line_data[xl2] );
- for(k = 1; k < xstop; k += 4)
- {
+ for ( k = 1; k < xstop; k+=4)
+ {
//predict.Filter( line_data[k] , line_data[xl2+k] , line_data[xl2+k-1] );
- __m64 m1 = _mm_add_pi16(*(__m64 *)(line_data + xl2 + k), *(__m64 *)(line_data + xl2 + k - 1));
- m1 = _mm_srai_pi16(m1, 2);
- *(__m64 *)(line_data + k) = _mm_sub_pi16(*(__m64 *)(line_data + k), m1);
+ __m64 m1 = _mm_add_pi16 (*(__m64 *)(line_data+xl2+k), *(__m64 *)(line_data+xl2+k-1));
+ m1 = _mm_srai_pi16 (m1, 2);
+ *(__m64 *)(line_data+k) = _mm_sub_pi16 (*(__m64 *)(line_data+k), m1);
//update.Filter( line_data[xl2+k-1] , line_data[k] , line_data[k-1] );
- m1 = _mm_add_pi16(*(__m64 *)(line_data + k), *(__m64 *)(line_data + k - 1));
+ m1 = _mm_add_pi16 (*(__m64 *)(line_data+k), *(__m64 *)(line_data+k-1));
m1 = _mm_srai_pi16(m1, 1);
- *(__m64 *)(line_data + xl2 + k - 1) = _mm_add_pi16(*(__m64*)(line_data + xl2 + k - 1), m1);
-
+ *(__m64 *)(line_data+xl2+k-1) = _mm_add_pi16 (*(__m64*)(line_data+xl2+k-1), m1);
+
row1 += 4;
row2 += 4;
row3 += 4;
@@ -1217,122 +1217,122 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
}// i
- for(k = xstop; k < xl2 - 1; ++k)
- {
- predict.Filter(line_data[k] , line_data[xl2+k] , line_data[xl2+k-1]);
- update.Filter(line_data[xl2+k-1] , line_data[k] , line_data[k-1]);
+ for ( k = xstop; k < xl2-1; ++k)
+ {
+ predict.Filter( line_data[k] , line_data[xl2+k] , line_data[xl2+k-1] );
+ update.Filter( line_data[xl2+k-1] , line_data[k] , line_data[k-1] );
}// i
- predict.Filter(line_data[xl2-1] , line_data[xl-2] , line_data[xl-1]);
- update.Filter(line_data[xl-2] , line_data[xl2-2] , line_data[xl2-1]);
- update.Filter(line_data[xl-1] , line_data[xl2-1] , line_data[xl2-1]);
+ predict.Filter( line_data[xl2-1] , line_data[xl-2] , line_data[xl-1] );
+ update.Filter( line_data[xl-2] , line_data[xl2-2] , line_data[xl2-1] );
+ update.Filter( line_data[xl-1] , line_data[xl2-1] , line_data[xl2-1] );
}
_mm_empty();
-
+
// Finally interleave subbands
- Interleave_mmx(xp , yp , xl , yl , coeff_data);
+ Interleave_mmx( xp , yp , xl , yl , coeff_data );
}
#endif
//Attempt 3
-inline void VHFilterLEGALL5_3::HorizSynth(int xp, int xl, int ystart, int yend, CoeffArray &coeff_data)
+inline void VHFilterLEGALL5_3::HorizSynth (int xp, int xl, int ystart, int yend, CoeffArray &coeff_data)
{
static const PredictStepShift< 2 > predict;
static const UpdateStepShift< 1 > update;
int j, k;
// Next do the horizontal synthesis
- for(j = ystart; j <= yend ; ++j)
+ for (j = ystart; j <= yend ; ++j)
{
- // First lifting stage
+ // First lifting stage
CoeffType *line_data = &coeff_data[j][xp];
- predict.Filter(line_data[0] , line_data[1] , line_data[1]);
+ predict.Filter( line_data[0] , line_data[1] , line_data[1] );
- for(k = 2; k < xl - 2; k += 2)
- {
- predict.Filter(line_data[k] , line_data[k+1] , line_data[k-1]);
- update.Filter(line_data[k-1] , line_data[k-2] , line_data[k]);
+ for ( k = 2; k < xl -2; k+=2)
+ {
+ predict.Filter( line_data[k] , line_data[k+1] , line_data[k-1] );
+ update.Filter( line_data[k-1] , line_data[k-2] , line_data[k] );
}// i
-
- predict.Filter(line_data[xl-2] , line_data[xl-3] , line_data[xl-1]);
- update.Filter(line_data[xl-3] , line_data[xl-2] , line_data[xl-4]);
- update.Filter(line_data[xl-1] , line_data[xl-2] , line_data[xl-2]);
+
+ predict.Filter( line_data[xl-2] , line_data[xl-3] , line_data[xl-1] );
+ update.Filter( line_data[xl-3] , line_data[xl-2] , line_data[xl-4] );
+ update.Filter( line_data[xl-1] , line_data[xl-2] , line_data[xl-2] );
// Shift right by one bit to counter the shift in the analysis stage
ShiftRowRight(line_data, xl, 1);
}
}
void VHFilterLEGALL5_3::Synth(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray &coeff_data)
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray &coeff_data)
{
int i, k;
- const int xend(xp + xl);
- const int yend(yp + yl);
+ const int xend( xp+xl );
+ const int yend( yp+yl );
const PredictStepShift< 2 > predict;
- __m64 pred_round = _mm_set_pi16(1 << (2 - 1), 1 << (2 - 1), 1 << (2 - 1), 1 << (2 - 1));
+ __m64 pred_round = _mm_set_pi16 (1<<(2-1), 1<<(2-1), 1<<(2-1), 1<<(2-1));
const UpdateStepShift< 1 > update;
- __m64 update_round = _mm_set_pi16(1, 1, 1, 1);
+ __m64 update_round = _mm_set_pi16 (1, 1, 1, 1);
int horiz_start = 0;
int horiz_end = 0;
- // Firstly reorder to interleave subbands, so that subsequent calculations
+ // Firstly reorder to interleave subbands, so that subsequent calculations
// can be in-place
- Interleave_mmx(xp , yp , xl , yl , coeff_data);
+ Interleave_mmx( xp , yp , xl , yl , coeff_data );
// Next, do the vertical synthesis
// First lifting stage
- int xstop = (xend >> 2) << 2;
-
+ int xstop = (xend>>2)<<2;
+
// Begin the top edge
CoeffType *row1, *row2, *row3, *row4;
row1 = &coeff_data[yp][xp];
row2 = &coeff_data[yp+1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row2);
- tmp = _mm_add_pi16(tmp, pred_round);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row2);
+ tmp = _mm_add_pi16 (tmp, pred_round);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row1 = _mm_sub_pi16(*(__m64*)row1, tmp);
+ *(__m64 *)row1 = _mm_sub_pi16 (*(__m64*)row1, tmp);
row1 += 4;
row2 += 4;
}
// Mopup
- for(i = xstop ; i < xend ; ++i)
+ for ( i = xstop ; i < xend ; ++i)
{
- predict.Filter(*row1, *row2, *row2);
+ predict.Filter( *row1, *row2, *row2 );
++row1;
++row2;
}// i
// Next, do the middle bit
- for(k = yp + 2 ; k < yend - 2 ; k += 2)
+ for ( k = yp+2 ; k < yend-2 ; k+=2)
{
CoeffType *row1 = &coeff_data[k-2][xp];
CoeffType *row2 = &coeff_data[k-1][xp];
CoeffType *row3 = &coeff_data[k][xp];
CoeffType *row4 = &coeff_data[k+1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row4, *(__m64 *)row2);
- tmp = _mm_add_pi16(tmp, pred_round);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row4, *(__m64 *)row2);
+ tmp = _mm_add_pi16 (tmp, pred_round);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row3 = _mm_sub_pi16(*(__m64*)row3, tmp);
+ *(__m64 *)row3 = _mm_sub_pi16 (*(__m64*)row3, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row1, *(__m64 *)row3);
- tmp = _mm_add_pi16(tmp, update_round);
+ tmp = _mm_add_pi16 (*(__m64 *)row1, *(__m64 *)row3);
+ tmp = _mm_add_pi16 (tmp, update_round);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row2 = _mm_add_pi16(*(__m64*)row2, tmp);
+ *(__m64 *)row2 = _mm_add_pi16 (*(__m64*)row2, tmp);
row1 += 4;
row2 += 4;
row3 += 4;
@@ -1340,10 +1340,10 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
}// i
//Mopup
- for(i = xstop ; i < xend ; ++i)
+ for ( i = xstop ; i < xend ; ++i)
{
- predict.Filter(*row3, *row2, *row4);
- update.Filter(*row2, *row1, *row3);
+ predict.Filter( *row3, *row2, *row4 );
+ update.Filter( *row2, *row1, *row3 );
++row1;
++row2;
++row3;
@@ -1351,32 +1351,32 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
}// i
horiz_end = k - 2;
// Do the horizontal synthesis
- HorizSynth(xp, xl, horiz_start, horiz_end, coeff_data);
+ HorizSynth (xp, xl, horiz_start, horiz_end, coeff_data);
horiz_start = horiz_end + 1;
}// j
-
+
// Finally with the bottom edge
row1 = &coeff_data[yend-4][xp];
row2 = &coeff_data[yend-3][xp];
row3 = &coeff_data[yend-2][xp];
row4 = &coeff_data[yend-1][xp];
- for(i = xp ; i < xstop ; i += 4)
+ for ( i = xp ; i < xstop ; i+=4)
{
- __m64 tmp = _mm_add_pi16(*(__m64 *)row2, *(__m64 *)row4);
- tmp = _mm_add_pi16(tmp, pred_round);
+ __m64 tmp = _mm_add_pi16 (*(__m64 *)row2, *(__m64 *)row4);
+ tmp = _mm_add_pi16 (tmp, pred_round);
tmp = _mm_srai_pi16(tmp, 2);
- *(__m64 *)row3 = _mm_sub_pi16(*(__m64*)row3, tmp);
+ *(__m64 *)row3 = _mm_sub_pi16 (*(__m64*)row3, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row3, *(__m64 *)row1);
- tmp = _mm_add_pi16(tmp, update_round);
+ tmp = _mm_add_pi16 (*(__m64 *)row3, *(__m64 *)row1);
+ tmp = _mm_add_pi16 (tmp, update_round);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row2 = _mm_add_pi16(*(__m64*)row2, tmp);
+ *(__m64 *)row2 = _mm_add_pi16 (*(__m64*)row2, tmp);
- tmp = _mm_add_pi16(*(__m64 *)row3, *(__m64 *)row3);
- tmp = _mm_add_pi16(tmp, update_round);
+ tmp = _mm_add_pi16 (*(__m64 *)row3, *(__m64 *)row3);
+ tmp = _mm_add_pi16 (tmp, update_round);
tmp = _mm_srai_pi16(tmp, 1);
- *(__m64 *)row4 = _mm_add_pi16(*(__m64*)row4, tmp);
+ *(__m64 *)row4 = _mm_add_pi16 (*(__m64*)row4, tmp);
row1 += 4;
row2 += 4;
@@ -1384,11 +1384,11 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
row4 += 4;
}// i
// mopup
- for(i = xstop ; i < xend ; ++i)
+ for ( i = xstop ; i < xend ; ++i)
{
- predict.Filter(*row3, *row2, *row4);
- update.Filter(*row2, *row1, *row3);
- update.Filter(*row4, *row3, *row3);
+ predict.Filter( *row3, *row2, *row4 );
+ update.Filter( *row2, *row1, *row3 );
+ update.Filter( *row4, *row3, *row3 );
++row1;
++row2;
++row3;
@@ -1397,130 +1397,130 @@ void VHFilterLEGALL5_3::Synth(const int xp ,
_mm_empty();
// Last lines of horizontal synthesis
- HorizSynth(xp, xl, horiz_start, yend - 1, coeff_data);
+ HorizSynth (xp, xl, horiz_start, yend-1, coeff_data);
}
-void DeInterleave_mmx(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray &coeff_data)
+void DeInterleave_mmx( const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray &coeff_data)
{
- const int xl2(xl >> 1);
- const int yl2(yl >> 1);
- const int yend(yp + yl);
+ const int xl2( xl>>1);
+ const int yl2( yl>>1);
+ const int yend( yp + yl );
- if(coeff_data.LengthX() > t_temp_data.LengthX() ||
- coeff_data.LengthY() > t_temp_data.LengthY())
+ if (coeff_data.LengthX() > t_temp_data.LengthX() ||
+ coeff_data.LengthY() > t_temp_data.LengthY())
{
t_temp_data.Resize(coeff_data.LengthY(), coeff_data.LengthX());
}
// Make a temporary copy of the subband
- for(int j = yp; j < yend ; j++)
- memcpy(t_temp_data[j-yp] , coeff_data[j] + xp , xl * sizeof(CoeffType));
-
- int stopx = (xl2 >> 2) << 2;
+ for (int j = yp; j<yend ; j++ )
+ memcpy( t_temp_data[j-yp] , coeff_data[j]+xp , xl * sizeof( CoeffType ) );
- for(int j = yp, s = 0; j < (yp + yl2) ; j++, s += 2)
+ int stopx = (xl2>>2)<<2;
+
+ for (int j = yp, s=0; j<(yp+yl2) ; j++, s+=2)
{
CoeffType *tmp1 = &t_temp_data[s][0];
CoeffType *out1 = &coeff_data[j][xp];
CoeffType *out2 = &coeff_data[j][xl2];
int r = xp;
- for(int i = 0; i < xp + stopx ; i += 4 , r += 8)
+ for (int i = 0; i<xp+stopx ; i+=4 , r+=8)
{
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)tmp1, *(__m64 *)(tmp1 + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)tmp1, *(__m64 *)(tmp1 + 4));
- *(__m64 *)out1 = _mm_unpacklo_pi16(m1, m2);
- *(__m64 *)out2 = _mm_unpackhi_pi16(m1, m2);
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)tmp1, *(__m64 *)(tmp1+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)tmp1, *(__m64 *)(tmp1+4));
+ *(__m64 *)out1 = _mm_unpacklo_pi16 (m1, m2);
+ *(__m64 *)out2 = _mm_unpackhi_pi16 (m1, m2);
out1 += 4;
out2 += 4;
- tmp1 += 8;
+ tmp1+=8;
}
//mopup
- for(int i = xp + stopx; i < xp + xl2; ++i, r += 2)
+ for (int i = xp+stopx; i < xp+xl2; ++i, r+=2)
{
coeff_data[j][i] = t_temp_data[s][r];
coeff_data[j][i+xl2] = t_temp_data[s][r+1];
}
- }// j
+ }// j
- for(int j = yl2, s = 1; j < yend ; j++, s += 2)
+ for (int j = yl2, s=1; j< yend ; j++, s+=2)
{
CoeffType *tmp1 = &t_temp_data[s][0];
CoeffType *out1 = &coeff_data[j][xp];
CoeffType *out2 = &coeff_data[j][xl2];
int r = xp;
- for(int i = 0; i < xp + stopx ; i += 4 , r += 8)
+ for (int i = 0; i<xp+stopx ; i+=4 , r+=8)
{
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)tmp1, *(__m64 *)(tmp1 + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)tmp1, *(__m64 *)(tmp1 + 4));
- *(__m64 *)out1 = _mm_unpacklo_pi16(m1, m2);
- *(__m64 *)out2 = _mm_unpackhi_pi16(m1, m2);
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)tmp1, *(__m64 *)(tmp1+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)tmp1, *(__m64 *)(tmp1+4));
+ *(__m64 *)out1 = _mm_unpacklo_pi16 (m1, m2);
+ *(__m64 *)out2 = _mm_unpackhi_pi16 (m1, m2);
out1 += 4;
out2 += 4;
- tmp1 += 8;
+ tmp1+=8;
}
//mopup
- for(int i = xp + stopx; i < xp + xl2; ++i, r += 2)
+ for (int i = xp+stopx; i < xp+xl2; ++i, r+=2)
{
coeff_data[j][i] = t_temp_data[s][r];
coeff_data[j][i+xl2] = t_temp_data[s][r+1];
}
- }// j
+ }// j
_mm_empty();
}
-void VHFilterLEGALL5_3::Split(const int xp ,
- const int yp ,
- const int xl ,
- const int yl ,
- CoeffArray& coeff_data)
+void VHFilterLEGALL5_3::Split(const int xp ,
+ const int yp ,
+ const int xl ,
+ const int yl ,
+ CoeffArray& coeff_data)
{
//version based on integer-like types
//using edge-extension rather than reflection
- const int xend = xp + xl;
- const int yend = yp + yl;
- const int xl2 = xl >> 1;
- const int yl2 = yl >> 1;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
+ const int xl2 = xl>>1;
+ const int yl2 = yl>>1;
- CoeffType* line_data;
+ CoeffType* line_data;
// Positional variables
- int i, j, k;
-
- // Objects to do lifting stages
+ int i,j,k;
+
+ // Objects to do lifting stages
// (in revese order and type from synthesis)
const PredictStepShift< 1 > predict;
- __m64 pred_round = _mm_set_pi16(1, 1, 1, 1);
+ __m64 pred_round = _mm_set_pi16 (1, 1, 1, 1);
const UpdateStepShift< 2 > update;
- __m64 update_round = _mm_set_pi16(1 << (2 - 1), 1 << (2 - 1), 1 << (2 - 1), 1 << (2 - 1));
+ __m64 update_round = _mm_set_pi16 (1<<(2-1), 1<<(2-1), 1<<(2-1), 1<<(2-1));
// Lastly, have to reorder so that subbands are no longer interleaved
- DeInterleave_mmx(xp , yp , xl , yl , coeff_data);
- //first do horizontal
+ DeInterleave_mmx( xp , yp , xl , yl , coeff_data );
+ //first do horizontal
- for(j = yp; j < yend; ++j)
+ for (j = yp; j < yend; ++j)
{
// First lifting stage
line_data = &coeff_data[j][xp];
// Shift left by one bit to give us more accuracy
ShiftRowLeft(line_data, xl, 1);
- predict.Filter(line_data[xp+xl2] , line_data[1] , line_data[0]);
- update.Filter(line_data[0] , line_data[xp+xl2] , line_data[xp+xl2]);
+ predict.Filter( line_data[xp+xl2] , line_data[1] , line_data[0] );
+ update.Filter( line_data[0] , line_data[xp+xl2] , line_data[xp+xl2] );
- for(k = 1; k < xp + xl2 - 1; k += 1)
+ for (k = 1; k < xp+xl2-1; k+=1)
{
- predict.Filter(line_data[xp+xl2+k] , line_data[k+1] , line_data[k]);
- update.Filter(line_data[k] , line_data[xp+xl2+k-1] , line_data[xp+xl2+k]);
+ predict.Filter( line_data[xp+xl2+k] , line_data[k+1] , line_data[k] );
+ update.Filter( line_data[k] , line_data[xp+xl2+k-1] , line_data[xp+xl2+k] );
}// i
-
- predict.Filter(line_data[xl-1] , line_data[xp+xl2-1] , line_data[xp+xl2-1]);
- update.Filter(line_data[xp+xl2-1] , line_data[xl-2] , line_data[xl-1]);
+
+ predict.Filter( line_data[xl-1] , line_data[xp+xl2-1] , line_data[xp+xl2-1] );
+ update.Filter( line_data[xp+xl2-1] , line_data[xl-2] , line_data[xl-1] );
}// j
@@ -1529,54 +1529,54 @@ void VHFilterLEGALL5_3::Split(const int xp ,
// First lifting stage
// top edge - j=xp
- int stopX = (xl >> 2) << 2;
+ int stopX = (xl>>2)<<2;
CoeffType *in_val = &coeff_data[yp+yl2][xp];
CoeffType *val1 = &coeff_data[1][xp];
CoeffType *val2 = &coeff_data[0][xp];
- for(i = xp ; i < (xp + stopX); i += 4)
+ for ( i = xp ; i<(xp+stopX); i+=4)
{
//predict.Filter( coeff_data[yp+yl2][i] , coeff_data[1][i] , coeff_data[0][i] );
- __m64 m1 = _mm_add_pi16(*(__m64 *)val1, *(__m64 *)val2);
- m1 = _mm_add_pi16(m1, pred_round);
+ __m64 m1 = _mm_add_pi16 (*(__m64 *)val1, *(__m64 *)val2);
+ m1 = _mm_add_pi16 (m1, pred_round);
m1 = _mm_srai_pi16(m1, 1);
- *(__m64 *)in_val = _mm_sub_pi16(*(__m64 *)in_val, m1);
+ *(__m64 *)in_val = _mm_sub_pi16 (*(__m64 *)in_val, m1);
//update.Filter( coeff_data[0][i] , coeff_data[yp+yl2][i] , coeff_data[yp+yl2][i] );
- m1 = _mm_add_pi16(*(__m64 *)in_val, *(__m64 *)in_val);
- m1 = _mm_add_pi16(m1, update_round);
+ m1 = _mm_add_pi16 (*(__m64 *)in_val, *(__m64 *)in_val);
+ m1 = _mm_add_pi16 (m1, update_round);
m1 = _mm_srai_pi16(m1, 2);
- *(__m64 *)val2 = _mm_add_pi16(*(__m64 *)val2, m1);
+ *(__m64 *)val2 = _mm_add_pi16 (*(__m64 *)val2, m1);
in_val += 4;
val1 += 4;
val2 += 4;
}// i
// mopup
- for(i = xp + stopX ; i < xend ; ++ i)
+ for ( i = xp+stopX ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+yl2][i] , coeff_data[1][i] , coeff_data[0][i]);
- update.Filter(coeff_data[0][i] , coeff_data[yp+yl2][i] , coeff_data[yp+yl2][i]);
+ predict.Filter( coeff_data[yp+yl2][i] , coeff_data[1][i] , coeff_data[0][i] );
+ update.Filter( coeff_data[0][i] , coeff_data[yp+yl2][i] , coeff_data[yp+yl2][i] );
}// i
// middle bit
- for(k = 1 ; k < yp + yl2 - 1 ; k += 1)
+ for (k = 1 ; k<yp+yl2-1 ; k+=1)
{
CoeffType *in_val = &coeff_data[yp+yl2+k][xp];
CoeffType *in_val2 = &coeff_data[yp+yl2+k-1][xp];
CoeffType *val1 = &coeff_data[k+1][xp];
CoeffType *val2 = &coeff_data[k][xp];
- for(i = xp ; i < xp + stopX ; i += 4)
+ for ( i = xp ; i<xp+stopX ; i+=4)
{
//predict.Filter( coeff_data[yp+yl2+k][i] , coeff_data[k+1][i] , coeff_data[k][i] );
- __m64 m1 = _mm_add_pi16(*(__m64 *)val1, *(__m64 *)val2);
- m1 = _mm_add_pi16(m1, pred_round);
+ __m64 m1 = _mm_add_pi16 (*(__m64 *)val1, *(__m64 *)val2);
+ m1 = _mm_add_pi16 (m1, pred_round);
m1 = _mm_srai_pi16(m1, 1);
- *(__m64 *)in_val = _mm_sub_pi16(*(__m64 *)in_val, m1);
-
+ *(__m64 *)in_val = _mm_sub_pi16 (*(__m64 *)in_val, m1);
+
//update.Filter( coeff_data[k][i] , coeff_data[yp+yl2+k-1][i] , coeff_data[yp+yl2+k][i] );
- m1 = _mm_add_pi16(*(__m64 *)in_val, *(__m64 *)in_val2);
- m1 = _mm_add_pi16(m1, update_round);
+ m1 = _mm_add_pi16 (*(__m64 *)in_val, *(__m64 *)in_val2);
+ m1 = _mm_add_pi16 (m1, update_round);
m1 = _mm_srai_pi16(m1, 2);
- *(__m64 *)val2 = _mm_add_pi16(*(__m64 *)val2, m1);
+ *(__m64 *)val2 = _mm_add_pi16 (*(__m64 *)val2, m1);
in_val += 4;
in_val2 += 4;
@@ -1585,10 +1585,10 @@ void VHFilterLEGALL5_3::Split(const int xp ,
}// i
//mopup
- for(i = xp + stopX ; i < xend ; ++ i)
+ for ( i = xp+stopX ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yp+yl2+k][i] , coeff_data[k+1][i] , coeff_data[k][i]);
- update.Filter(coeff_data[k][i] , coeff_data[yp+yl2+k-1][i] , coeff_data[yp+yl2+k][i]);
+ predict.Filter( coeff_data[yp+yl2+k][i] , coeff_data[k+1][i] , coeff_data[k][i] );
+ update.Filter( coeff_data[k][i] , coeff_data[yp+yl2+k-1][i] , coeff_data[yp+yl2+k][i] );
}// i
}// j
@@ -1596,29 +1596,29 @@ void VHFilterLEGALL5_3::Split(const int xp ,
val2 = &coeff_data[yp+yl2-1][xp];
CoeffType *in_val2 = &coeff_data[yend-2][xp];
// bottom edge
- for(i = xp ; i < xp + stopX ; i += 4)
+ for ( i = xp ; i<xp+stopX ; i+=4)
{
//predict.Filter( coeff_data[yend-1][i] , coeff_data[yp+yl2-1][i] , coeff_data[yp+yl2-1][i] );
- __m64 m1 = _mm_add_pi16(*(__m64 *)val2, *(__m64 *)val2);
- m1 = _mm_add_pi16(m1, pred_round);
+ __m64 m1 = _mm_add_pi16 (*(__m64 *)val2, *(__m64 *)val2);
+ m1 = _mm_add_pi16 (m1, pred_round);
m1 = _mm_srai_pi16(m1, 1);
- *(__m64 *)in_val = _mm_sub_pi16(*(__m64 *)in_val, m1);
-
- //update.Filter( coeff_data[yp+yl2-1][i] , coeff_data[yend-2][i] , coeff_data[yend-1][i] );
- m1 = _mm_add_pi16(*(__m64 *)in_val2, *(__m64 *)in_val);
- m1 = _mm_add_pi16(m1, update_round);
+ *(__m64 *)in_val = _mm_sub_pi16 (*(__m64 *)in_val, m1);
+
+ //update.Filter( coeff_data[yp+yl2-1][i] , coeff_data[yend-2][i] , coeff_data[yend-1][i] );
+ m1 = _mm_add_pi16 (*(__m64 *)in_val2, *(__m64 *)in_val);
+ m1 = _mm_add_pi16 (m1, update_round);
m1 = _mm_srai_pi16(m1, 2);
- *(__m64 *)val2 = _mm_add_pi16(*(__m64 *)val2, m1);
+ *(__m64 *)val2 = _mm_add_pi16 (*(__m64 *)val2, m1);
in_val += 4;
in_val2 += 4;
val2 += 4;
}// i
// mopup
- for(i = xp + stopX ; i < xend ; ++ i)
+ for ( i = xp+stopX ; i<xend ; ++ i)
{
- predict.Filter(coeff_data[yend-1][i] , coeff_data[yp+yl2-1][i] , coeff_data[yp+yl2-1][i]);
- update.Filter(coeff_data[yp+yl2-1][i] , coeff_data[yend-2][i] , coeff_data[yend-1][i]);
+ predict.Filter( coeff_data[yend-1][i] , coeff_data[yp+yl2-1][i] , coeff_data[yp+yl2-1][i] );
+ update.Filter( coeff_data[yp+yl2-1][i] , coeff_data[yend-2][i] , coeff_data[yend-1][i] );
}// i
_mm_empty();
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.cpp
index 3701865e5..3067c241e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.cpp
@@ -53,11 +53,11 @@ using namespace dirac;
using std::vector;
//Constructor
-CompDecompressor::CompDecompressor(DecoderParams& decp, const PictureParams& pp)
- :
+CompDecompressor::CompDecompressor( DecoderParams& decp, const PictureParams& pp)
+:
m_decparams(decp),
m_pparams(pp),
- m_psort(pp.PicSort())
+ m_psort( pp.PicSort() )
{}
@@ -67,103 +67,97 @@ void CompDecompressor::Decompress(ComponentByteIO* p_component_byteio,
{
// Set up the code blocks
- SetupCodeBlocks(bands);
+ SetupCodeBlocks( bands );
- for(int b = bands.Length() ; b >= 1 ; --b)
- {
+ for ( int b=bands.Length() ; b>=1 ; --b ){
// Multiple quantiser are used only if
// a. The global code_block_mode is QUANT_MULTIPLE
// and
// b. More than one code block is present in the subband.
bands(b).SetUsingMultiQuants(
- m_decparams.SpatialPartition() &&
- m_decparams.GetCodeBlockMode() == QUANT_MULTIPLE &&
- (bands(b).GetCodeBlocks().LengthX() > 1 ||
- bands(b).GetCodeBlocks().LengthY() > 1)
- );
+ m_decparams.SpatialPartition() &&
+ m_decparams.GetCodeBlockMode() == QUANT_MULTIPLE &&
+ (bands(b).GetCodeBlocks().LengthX() > 1 ||
+ bands(b).GetCodeBlocks().LengthY() > 1)
+ );
// Read the header data first
SubbandByteIO subband_byteio(bands(b), *p_component_byteio);
subband_byteio.Input();
- if(!bands(b).Skipped())
- {
- if(m_pparams.UsingAC())
- {
+ if ( !bands(b).Skipped() ){
+ if (m_pparams.UsingAC()){
// A pointer to the object(s) we'll be using for coding the bands
BandCodec* bdecoder;
- if(b >= bands.Length() - 3)
- {
- if(m_psort.IsIntra() && b == bands.Length())
- bdecoder = new IntraDCBandCodec(&subband_byteio,
- TOTAL_COEFF_CTXS , bands);
+ if ( b>=bands.Length()-3){
+ if ( m_psort.IsIntra() && b==bands.Length() )
+ bdecoder=new IntraDCBandCodec(&subband_byteio,
+ TOTAL_COEFF_CTXS ,bands);
else
- bdecoder = new LFBandCodec(&subband_byteio ,
- TOTAL_COEFF_CTXS, bands ,
- b, m_psort.IsIntra());
+ bdecoder=new LFBandCodec(&subband_byteio ,
+ TOTAL_COEFF_CTXS, bands ,
+ b, m_psort.IsIntra());
}
else
- bdecoder = new BandCodec(&subband_byteio , TOTAL_COEFF_CTXS ,
- bands , b, m_psort.IsIntra());
+ bdecoder=new BandCodec( &subband_byteio , TOTAL_COEFF_CTXS ,
+ bands , b, m_psort.IsIntra());
bdecoder->Decompress(coeff_data , subband_byteio.GetBandDataLength());
delete bdecoder;
}
- else
- {
+ else{
// A pointer to the object(s) we'll be using for coding the bands
BandVLC* bdecoder;
- if(m_psort.IsIntra() && b == bands.Length())
- bdecoder = new IntraDCBandVLC(&subband_byteio, bands);
+ if ( m_psort.IsIntra() && b==bands.Length() )
+ bdecoder=new IntraDCBandVLC(&subband_byteio, bands);
else
- bdecoder = new BandVLC(&subband_byteio , 0, bands ,
- b, m_psort.IsIntra());
+ bdecoder=new BandVLC( &subband_byteio , 0, bands ,
+ b, m_psort.IsIntra());
bdecoder->Decompress(coeff_data , subband_byteio.GetBandDataLength());
delete bdecoder;
}
}
- else
- {
- SetToVal(coeff_data , bands(b) , 0);
+ else{
+ SetToVal( coeff_data , bands(b) , 0 );
}
}
}
-void CompDecompressor::SetupCodeBlocks(SubbandList& bands)
+void CompDecompressor::SetupCodeBlocks( SubbandList& bands )
{
int xregions;
int yregions;
- for(int band_num = 1; band_num <= bands.Length() ; ++band_num)
+ for (int band_num = 1; band_num<=bands.Length() ; ++band_num)
{
- if(m_decparams.SpatialPartition())
+ if (m_decparams.SpatialPartition())
{
- int level = m_decparams.TransformDepth() - (band_num - 1) / 3;
+ int level = m_decparams.TransformDepth() - (band_num-1)/3;
const CodeBlocks &cb = m_decparams.GetCodeBlocks(level);
xregions = cb.HorizontalCodeBlocks();
yregions = cb.VerticalCodeBlocks();
}
else
{
- xregions = 1;
- yregions = 1;
+ xregions = 1;
+ yregions = 1;
}
- bands(band_num).SetNumBlocks(yregions , xregions);
+ bands( band_num ).SetNumBlocks( yregions ,xregions );
}// band_num
}
-void CompDecompressor::SetToVal(CoeffArray& coeff_data ,
- const Subband& node ,
- CoeffType val)
+void CompDecompressor::SetToVal( CoeffArray& coeff_data ,
+ const Subband& node ,
+ CoeffType val )
{
- for(int j = node.Yp() ; j < node.Yp() + node.Yl() ; ++j)
- for(int i = node.Xp() ; i < node.Xp() + node.Xl() ; ++i)
- coeff_data[j][i] = val;
+ for (int j=node.Yp() ; j<node.Yp()+node.Yl() ; ++j)
+ for (int i=node.Xp() ; i<node.Xp()+node.Xl() ; ++i)
+ coeff_data[j][i]=val;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.h
index 97602c5d3..6468c4ba7 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/comp_decompress.h
@@ -48,81 +48,81 @@
namespace dirac
{
-//! Decompress a picture component
-/*!
- This class decompresses one of the three components (Y, U, or V) of a
- picture according to a given set or parameters. CompDecompressor is used
- by PictureCompressor..
-*/
-class CompDecompressor
-{
-public:
- //! Constructor
- /*!
- Create and initialize a component decompressor with the given
- characteristics.
- \param decp decoding parameters
- \param fp picture parameters
- */
- CompDecompressor(DecoderParams& decp, const PictureParams& fp);
-
//! Decompress a picture component
/*!
- Decompress a PicArray containing a picture component (Y, U, or V).
-
- \param p_component_byteio Bytestream of component data
- \param coeff_data contains the component data to be decompressed
- \param bands the subband metadata
- */
- void Decompress(ComponentByteIO *p_component_byteio,
- CoeffArray& coeff_data,
- SubbandList& bands);
-
-private:
- //! Copy constructor is private and body-less
- /*!
- Copy constructor is private and body-less. This class should not
- be copied.
-
- */
- CompDecompressor(const CompDecompressor& cpy);
-
- //! Assignment = is private and body-less
- /*!
- Assignment = is private and body-less. This class should not be
- assigned.
-
+ This class decompresses one of the three components (Y, U, or V) of a
+ picture according to a given set or parameters. CompDecompressor is used
+ by PictureCompressor..
*/
- CompDecompressor& operator=(const CompDecompressor& rhs);
-
- //! Sets the data of a specific subband node to a given value
- /*!
- Sets the data of a specific subband node to a given value
-
- \param pic_data contains the component data
- \param node subband node
- \param val the value to set
- */
- void SetToVal(CoeffArray& pic_data, const Subband& node, CoeffType val);
-
- //! Set up the code block structures for each subband
- /*!
- Set up the code block structures for each subband
- \param bands the set of all the subbands
- */
- void SetupCodeBlocks(SubbandList& bands);
-
- //! Copy of the decompression parameters provided to the constructor
- DecoderParams& m_decparams;
-
- //! Reference to the picture parameters provided to the constructor
- const PictureParams& m_pparams;
-
- //! Reference to the picture sort
- const PictureSort& m_psort;
-
-
-};
+ class CompDecompressor
+ {
+ public:
+ //! Constructor
+ /*!
+ Create and initialize a component decompressor with the given
+ characteristics.
+ \param decp decoding parameters
+ \param fp picture parameters
+ */
+ CompDecompressor( DecoderParams& decp, const PictureParams& fp);
+
+ //! Decompress a picture component
+ /*!
+ Decompress a PicArray containing a picture component (Y, U, or V).
+
+ \param p_component_byteio Bytestream of component data
+ \param coeff_data contains the component data to be decompressed
+ \param bands the subband metadata
+ */
+ void Decompress(ComponentByteIO *p_component_byteio,
+ CoeffArray& coeff_data,
+ SubbandList& bands);
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+
+ */
+ CompDecompressor(const CompDecompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+
+ */
+ CompDecompressor& operator=(const CompDecompressor& rhs);
+
+ //! Sets the data of a specific subband node to a given value
+ /*!
+ Sets the data of a specific subband node to a given value
+
+ \param pic_data contains the component data
+ \param node subband node
+ \param val the value to set
+ */
+ void SetToVal(CoeffArray& pic_data,const Subband& node,CoeffType val);
+
+ //! Set up the code block structures for each subband
+ /*!
+ Set up the code block structures for each subband
+ \param bands the set of all the subbands
+ */
+ void SetupCodeBlocks( SubbandList& bands );
+
+ //! Copy of the decompression parameters provided to the constructor
+ DecoderParams& m_decparams;
+
+ //! Reference to the picture parameters provided to the constructor
+ const PictureParams& m_pparams;
+
+ //! Reference to the picture sort
+ const PictureSort& m_psort;
+
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/decoder_types.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/decoder_types.h
index 70011df5a..0f04c19be 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/decoder_types.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/decoder_types.h
@@ -43,17 +43,16 @@
#ifdef __cplusplus
extern "C" {
#endif
- /*
- * Different states the parser is in
- */
- typedef enum {
- STATE_BUFFER, /* need more data input */
- STATE_SEQUENCE, /* start of sequence detected */
- STATE_PICTURE_AVAIL, /* decoded frame available */
- STATE_SEQUENCE_END, /* end of sequence detected */
- STATE_INVALID /* invalid state. Stop further processing */
- }
- DecoderState;
+/*
+* Different states the parser is in
+*/
+typedef enum {
+ STATE_BUFFER, /* need more data input */
+ STATE_SEQUENCE, /* start of sequence detected */
+ STATE_PICTURE_AVAIL, /* decoded frame available */
+ STATE_SEQUENCE_END, /* end of sequence detected */
+ STATE_INVALID /* invalid state. Stop further processing */
+ } DecoderState;
#ifdef __cplusplus
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp
index 1cb61ea0a..3940b35fe 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp
@@ -52,9 +52,9 @@ InputStreamBuffer::InputStreamBuffer()
{
m_chunk_buffer = new char[m_buffer_size];
- setg(m_chunk_buffer, //beginning of read area
- m_chunk_buffer, //read position
- m_chunk_buffer); //end position
+ setg (m_chunk_buffer, //beginning of read area
+ m_chunk_buffer, //read position
+ m_chunk_buffer); //end position
}
std::ios::pos_type InputStreamBuffer::Rewind()
@@ -71,7 +71,7 @@ std::ios::pos_type InputStreamBuffer::Seek(std::ios::pos_type bytes, std::ios::s
{
char *new_pos;
- switch(dir)
+ switch (dir)
{
case std::ios::beg:
new_pos = eback() + bytes;
@@ -83,12 +83,12 @@ std::ios::pos_type InputStreamBuffer::Seek(std::ios::pos_type bytes, std::ios::s
new_pos = gptr() + bytes;
break;
}
- if(new_pos > egptr() || new_pos < eback())
+ if (new_pos > egptr() || new_pos < eback())
return -1;
setg(eback(), //start of read
- new_pos, //current read position
- egptr()); //end of stream positon
+ new_pos, //current read position
+ egptr()); //end of stream positon
return 0;
}
@@ -96,44 +96,44 @@ std::ios::pos_type InputStreamBuffer::Seek(std::ios::pos_type bytes, std::ios::s
void InputStreamBuffer::Copy(char *start, int bytes)
{
//std::cerr << "eback=" << m_chunk_buffer - eback()
- // << "gptr=" << gptr() -m_chunk_buffer
- // << "egptr=" << egptr() - m_chunk_buffer << endl;
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
int bytes_left = m_buffer_size - (egptr() - m_chunk_buffer);
- if(bytes_left < bytes)
+ if (bytes_left < bytes)
{
char *temp = new char [m_buffer_size + bytes];
- memcpy(temp, m_chunk_buffer, m_buffer_size);
- setg(temp, temp + (gptr() - m_chunk_buffer), temp + (egptr() - m_chunk_buffer));
+ memcpy (temp, m_chunk_buffer, m_buffer_size);
+ setg (temp, temp+(gptr()-m_chunk_buffer), temp + (egptr() - m_chunk_buffer));
delete [] m_chunk_buffer;
m_chunk_buffer = temp;
}
//std::cerr << "eback=" << m_chunk_buffer - eback()
- // << "gptr=" << gptr() -m_chunk_buffer
- // << "egptr=" << egptr() - m_chunk_buffer << endl;
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
- memcpy(egptr(), start, bytes);
- setg(m_chunk_buffer, gptr(), egptr() + bytes);
+ memcpy (egptr(), start, bytes);
+ setg(m_chunk_buffer, gptr(), egptr()+bytes);
//std::cerr << "eback=" << m_chunk_buffer - eback()
- // << "gptr=" << gptr() -m_chunk_buffer
- // << "egptr=" << egptr() - m_chunk_buffer << endl;
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
}
void InputStreamBuffer::PurgeProcessedData()
{
//std::cerr << "eback=" << m_chunk_buffer - eback()
- // << "gptr=" << gptr() -m_chunk_buffer
- // << "egptr=" << egptr() - m_chunk_buffer << endl;
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
- if(gptr() != m_chunk_buffer)
+ if (gptr() != m_chunk_buffer)
{
- memmove(m_chunk_buffer, gptr(), egptr() - gptr());
- setg(m_chunk_buffer, m_chunk_buffer, m_chunk_buffer + (egptr() - gptr()));
+ memmove (m_chunk_buffer, gptr(), egptr() - gptr());
+ setg(m_chunk_buffer, m_chunk_buffer, m_chunk_buffer+(egptr() - gptr()));
}
//std::cerr << "eback=" << m_chunk_buffer - eback()
- // << "gptr=" << gptr() -m_chunk_buffer
- // << "egptr=" << egptr() - m_chunk_buffer << endl;
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
}
InputStreamBuffer::~InputStreamBuffer()
@@ -159,23 +159,23 @@ DiracParser::~DiracParser()
delete m_decomp;
}
-void DiracParser::SetBuffer(char *start, char *end)
+void DiracParser::SetBuffer (char *start, char *end)
{
- TEST(end > start);
- m_dirac_byte_stream.AddBytes(start, end - start);
+ TEST (end > start);
+ m_dirac_byte_stream.AddBytes(start, end-start);
}
DecoderState DiracParser::Parse()
{
while(true)
{
- ParseUnitByteIO *p_parse_unit = NULL;
- ParseUnitType pu_type = PU_UNDEFINED;
+ ParseUnitByteIO *p_parse_unit=NULL;
+ ParseUnitType pu_type=PU_UNDEFINED;
// look for end-of-sequence flag
- if(m_next_state == STATE_SEQUENCE_END)
+ if(m_next_state==STATE_SEQUENCE_END)
{
- if(!m_decomp)
+ if (!m_decomp)
return STATE_BUFFER;
// look to see if all pictures have been processed
@@ -183,7 +183,7 @@ DecoderState DiracParser::Parse()
{
// if so....delete
delete m_decomp;
- m_decomp = NULL;
+ m_decomp=NULL;
m_next_state = STATE_BUFFER;
return STATE_SEQUENCE_END;
}
@@ -193,12 +193,12 @@ DecoderState DiracParser::Parse()
}
// get next parse unit from stream
- if(m_next_state != STATE_SEQUENCE_END)
+ if(m_next_state!=STATE_SEQUENCE_END)
{
- p_parse_unit = m_dirac_byte_stream.GetNextParseUnit();
- if(p_parse_unit == NULL)
+ p_parse_unit=m_dirac_byte_stream.GetNextParseUnit();
+ if(p_parse_unit==NULL)
return STATE_BUFFER;
- pu_type = p_parse_unit->GetType();
+ pu_type=p_parse_unit->GetType();
}
switch(pu_type)
@@ -207,8 +207,8 @@ DecoderState DiracParser::Parse()
if(!m_decomp)
{
- m_decomp = new SequenceDecompressor(*p_parse_unit, m_verbose);
- m_next_state = STATE_BUFFER;
+ m_decomp = new SequenceDecompressor (*p_parse_unit, m_verbose);
+ m_next_state=STATE_BUFFER;
return STATE_SEQUENCE;
}
@@ -216,41 +216,41 @@ DecoderState DiracParser::Parse()
break;
case PU_CORE_PICTURE:
- {
- if(!m_decomp)
- continue;
-
- const Picture *my_picture = m_decomp->DecompressNextPicture(p_parse_unit);
- if(my_picture)
{
- int picturenum_decoded = my_picture->GetPparams().PictureNum();
- if(picturenum_decoded != m_show_pnum)
+ if (!m_decomp)
+ continue;
+
+ const Picture *my_picture = m_decomp->DecompressNextPicture(p_parse_unit);
+ if (my_picture)
{
- m_show_pnum = my_picture->GetPparams().PictureNum();
- if(m_verbose)
+ int picturenum_decoded = my_picture->GetPparams().PictureNum();
+ if (picturenum_decoded != m_show_pnum)
{
- std::cout << std::endl;
- std::cout << "Picture ";
- std::cout << m_show_pnum << " available";
+ m_show_pnum = my_picture->GetPparams().PictureNum();
+ if (m_verbose)
+ {
+ std::cout << std::endl;
+ std::cout << "Picture ";
+ std::cout<< m_show_pnum << " available";
+ }
+ m_state = STATE_PICTURE_AVAIL;
+ return m_state;
}
- m_state = STATE_PICTURE_AVAIL;
- return m_state;
}
- }
break;
- }
+ }
case PU_END_OF_SEQUENCE:
m_next_state = STATE_SEQUENCE_END;
break;
case PU_AUXILIARY_DATA:
case PU_PADDING_DATA:
- if(m_verbose)
+ if (m_verbose)
std::cerr << "Ignoring Auxiliary/Padding data" << std::endl;
// Ignore auxiliary and padding data and continue parsing
break;
case PU_LOW_DELAY_PICTURE:
- if(m_verbose)
+ if (m_verbose)
std::cerr << "Low delay picture decoding not yet supported" << std::endl;
return STATE_INVALID;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.h
index 4306117ea..1634dd390 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_cppparser.h
@@ -49,141 +49,141 @@
namespace dirac
{
-class SequenceDecompressor;
-class Picture;
+ class SequenceDecompressor;
+ class Picture;
-//! Input Stream Buffer Class.
-class InputStreamBuffer : public std::streambuf
-{
-public:
- //! Constructor
- InputStreamBuffer();
+ //! Input Stream Buffer Class.
+ class InputStreamBuffer : public std::streambuf
+ {
+ public:
+ //! Constructor
+ InputStreamBuffer ();
- //! Destructor
- ~InputStreamBuffer();
+ //! Destructor
+ ~InputStreamBuffer();
- //! Rewind buffer to start of data
- std::ios::pos_type Rewind();
+ //! Rewind buffer to start of data
+ std::ios::pos_type Rewind();
- //! Seek to position specified by bytes offset from pos
- /*!
- Seek takes
- \param bytes offset in bytes
- \param pos the position from which the offset is applied
- */
- std::ios::pos_type Seek(std::ios::pos_type bytes,
- std::ios::seekdir pos = std::ios::cur);
+ //! Seek to position specified by bytes offset from pos
+ /*!
+ Seek takes
+ \param bytes offset in bytes
+ \param pos the position from which the offset is applied
+ */
+ std::ios::pos_type Seek(std::ios::pos_type bytes,
+ std::ios::seekdir pos = std::ios::cur);
- //! Return the current read position in the buffer
- std::ios::pos_type Tell();
+ //! Return the current read position in the buffer
+ std::ios::pos_type Tell();
- //! Copy data into buffer
- /*!
- Copy take
- \param start memory area start
- \param bytes number of bytes to copy starting from start
- */
- void Copy(char *start, int bytes);
-
- //! Delete all processed data from buffer
- void PurgeProcessedData();
-
-private:
-
- //! Private body-less copy constructor
- InputStreamBuffer(const InputStreamBuffer& inbuf);
-
- //! Private body-less assignment operator
- InputStreamBuffer& operator = (const InputStreamBuffer& inbuf);
-
- //! Buffer size
- static const int m_buffer_size = 1232896;
-
- //! Buffere
- char *m_chunk_buffer;
-};
-
-//! Dirac Stream Parser Class
-/*!
- This class is a wrapper around the SequenceDecompressor class. The
- Sequence Decompressor class needs a full picture of data to be available
- to decompress a picture successfully. So, the DiracParser class uses
- the InputStreamBuffer class to store data until a chunk is available
- to be processed and then invokes the SequenceDecompressor functions to
- process data. A chunk of data can be a start of sequence, a picture or
- end of sequence data. The istream used to instantiate the
- SequenceDecompressor object is created using an InputStreamBuffer
- object which is manipulated the DiracParser. This ensures that data is
- always available for processing by the SequenceDecompressor object.
-*/
-class DiracParser
-{
-public:
- //! Constructor
- /*!
- Constructor takes
- \param verbose boolean flag. Set to true for verbose output
- */
- DiracParser(bool verbose = false);
+ //! Copy data into buffer
+ /*!
+ Copy take
+ \param start memory area start
+ \param bytes number of bytes to copy starting from start
+ */
+ void Copy(char *start, int bytes);
- //! Destructor
- ~DiracParser();
+ //! Delete all processed data from buffer
+ void PurgeProcessedData();
- //! Adds bytes to encoder
- /*! SetBuffer takes
- \param start Start of input buffer
- \param end End of input buffer
- */
- void SetBuffer(char *start, char *end);
+ private:
+
+ //! Private body-less copy constructor
+ InputStreamBuffer (const InputStreamBuffer& inbuf);
+
+ //! Private body-less assignment operator
+ InputStreamBuffer& operator = (const InputStreamBuffer& inbuf);
+
+ //! Buffer size
+ static const int m_buffer_size = 1232896;
+
+ //! Buffere
+ char *m_chunk_buffer;
+ };
- //! Parse the data in internal buffer
+ //! Dirac Stream Parser Class
/*!
- Parses the data in the input buffer. This function returns one
- of the following values
- \n STATE_BUFFER : Not enough data in internal buffer to process
- \n STATE_SEQUENCE : Start of sequence detected
- \n STATE_PICTURE_AVAIL : Decoded picture available
- \n STATE_SEQUENCE_END : End of sequence detected
- \n STATE_INVALID : Invalid stream. Stop further processing
+ This class is a wrapper around the SequenceDecompressor class. The
+ Sequence Decompressor class needs a full picture of data to be available
+ to decompress a picture successfully. So, the DiracParser class uses
+ the InputStreamBuffer class to store data until a chunk is available
+ to be processed and then invokes the SequenceDecompressor functions to
+ process data. A chunk of data can be a start of sequence, a picture or
+ end of sequence data. The istream used to instantiate the
+ SequenceDecompressor object is created using an InputStreamBuffer
+ object which is manipulated the DiracParser. This ensures that data is
+ always available for processing by the SequenceDecompressor object.
*/
- DecoderState Parse();
-
- //! Return the parse parameters of the current sequence
- const ParseParams& GetParseParams() const;
-
- //! Return the source parameters of the current sequence
- const SourceParams& GetSourceParams() const;
-
- //! Return the picture parameters of the next picture to be decoded
- const PictureParams* GetNextPictureParams() const;
-
- //! Return the decoded picture
- const Picture* GetNextPicture() const;
-
- //! Return the coding parameters of the current sequence
- const DecoderParams& GetDecoderParams() const;
-
-private:
-
-private:
-
- //! private body-less copy constructor
- DiracParser(const DiracParser &dp);
- //! private body-less assignement constructor
- DiracParser& operator = (const DiracParser &dp);
- //! Current state of parser
- DecoderState m_state;
- //! Next state the parser will enter
- DecoderState m_next_state;
- //! picture number of last picture decoded in display order
- int m_show_pnum;
- //! Sequence decompressor object
- SequenceDecompressor *m_decomp;
- //! verbose flag
- bool m_verbose;
- //! Byte Stream Buffer
- DiracByteStream m_dirac_byte_stream;
-};
+ class DiracParser
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor takes
+ \param verbose boolean flag. Set to true for verbose output
+ */
+ DiracParser(bool verbose = false );
+
+ //! Destructor
+ ~DiracParser();
+
+ //! Adds bytes to encoder
+ /*! SetBuffer takes
+ \param start Start of input buffer
+ \param end End of input buffer
+ */
+ void SetBuffer (char *start, char *end);
+
+ //! Parse the data in internal buffer
+ /*!
+ Parses the data in the input buffer. This function returns one
+ of the following values
+ \n STATE_BUFFER : Not enough data in internal buffer to process
+ \n STATE_SEQUENCE : Start of sequence detected
+ \n STATE_PICTURE_AVAIL : Decoded picture available
+ \n STATE_SEQUENCE_END : End of sequence detected
+ \n STATE_INVALID : Invalid stream. Stop further processing
+ */
+ DecoderState Parse();
+
+ //! Return the parse parameters of the current sequence
+ const ParseParams& GetParseParams() const;
+
+ //! Return the source parameters of the current sequence
+ const SourceParams& GetSourceParams() const;
+
+ //! Return the picture parameters of the next picture to be decoded
+ const PictureParams* GetNextPictureParams() const;
+
+ //! Return the decoded picture
+ const Picture* GetNextPicture() const;
+
+ //! Return the coding parameters of the current sequence
+ const DecoderParams& GetDecoderParams() const;
+
+ private:
+
+ private:
+
+ //! private body-less copy constructor
+ DiracParser (const DiracParser &dp);
+ //! private body-less assignement constructor
+ DiracParser& operator = (const DiracParser &dp);
+ //! Current state of parser
+ DecoderState m_state;
+ //! Next state the parser will enter
+ DecoderState m_next_state;
+ //! picture number of last picture decoded in display order
+ int m_show_pnum;
+ //! Sequence decompressor object
+ SequenceDecompressor *m_decomp;
+ //! verbose flag
+ bool m_verbose;
+ //! Byte Stream Buffer
+ DiracByteStream m_dirac_byte_stream;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.cpp
index eaeb6ab8d..629746634 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.cpp
@@ -52,357 +52,357 @@ using namespace dirac;
extern "C" {
#endif
- extern DllExport dirac_decoder_t *dirac_decoder_init(int verbose)
- {
- dirac_decoder_t* decoder = new dirac_decoder_t;
- memset(decoder, 0, sizeof(dirac_decoder_t));
+extern DllExport dirac_decoder_t *dirac_decoder_init(int verbose)
+{
+ dirac_decoder_t* decoder = new dirac_decoder_t;
+ memset (decoder, 0, sizeof(dirac_decoder_t));
+
+ bool verbosity = verbose > 0 ? true : false;
+ DiracParser *parser = new DiracParser(verbosity);
+ decoder->parser = static_cast<void *>(parser);
+
+ decoder->fbuf = new dirac_framebuf_t;
+ decoder->fbuf->id = NULL;
+ decoder->fbuf->buf[0] = decoder->fbuf->buf[1] = decoder->fbuf->buf[2] = NULL;
+ return decoder;
+}
- bool verbosity = verbose > 0 ? true : false;
- DiracParser *parser = new DiracParser(verbosity);
- decoder->parser = static_cast<void *>(parser);
+extern DllExport void dirac_decoder_close(dirac_decoder_t *decoder)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
- decoder->fbuf = new dirac_framebuf_t;
- decoder->fbuf->id = NULL;
- decoder->fbuf->buf[0] = decoder->fbuf->buf[1] = decoder->fbuf->buf[2] = NULL;
- return decoder;
- }
-
- extern DllExport void dirac_decoder_close(dirac_decoder_t *decoder)
- {
- TEST(decoder != NULL);
- TEST(decoder->parser != NULL);
- DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+ delete parser;
- delete parser;
+ delete decoder->fbuf;
- delete decoder->fbuf;
+ delete decoder;
- delete decoder;
-
- decoder = NULL;
- }
+ decoder = NULL;
+}
- extern DllExport void dirac_buffer(dirac_decoder_t *decoder, unsigned char *start, unsigned char *end)
- {
- TEST(decoder != NULL);
- TEST(decoder->parser != NULL);
- DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+extern DllExport void dirac_buffer (dirac_decoder_t *decoder, unsigned char *start, unsigned char *end)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
- parser->SetBuffer((char *)start, (char *)end);
- }
+ parser->SetBuffer((char *)start, (char *)end);
+}
- static void set_sequence_params(const DiracParser * const parser, dirac_decoder_t *decoder)
+static void set_sequence_params (const DiracParser * const parser, dirac_decoder_t *decoder)
+{
+ TEST (parser != NULL);
+ TEST (decoder != NULL);
+
+ dirac_sourceparams_t *src_params = &decoder->src_params;
+ dirac_parseparams_t *parse_params = &decoder->parse_params;
+ const SourceParams& srcparams = parser->GetSourceParams();
+ const ParseParams& pparams = parser->GetParseParams();
+
+ parse_params->major_ver = pparams.MajorVersion();
+ parse_params->minor_ver = pparams.MinorVersion();
+ parse_params->profile = pparams.Profile();
+ parse_params->level = pparams.Level();
+
+ src_params->width = srcparams.Xl();
+ src_params->height = srcparams.Yl();
+
+ src_params->chroma = (dirac_chroma_t)srcparams.CFormat();
+ src_params->chroma_width = srcparams.ChromaWidth();
+ src_params->chroma_height = srcparams.ChromaHeight();
+
+ // set the source parmeters
+ src_params->source_sampling = srcparams.SourceSampling();
+ src_params->topfieldfirst = srcparams.TopFieldFirst() ? 1 : 0;
+
+ src_params->frame_rate.numerator = srcparams.FrameRate().m_num;
+ src_params->frame_rate.denominator = srcparams.FrameRate().m_denom;
+
+ src_params->pix_asr.numerator = srcparams.PixelAspectRatio().m_num;
+ src_params->pix_asr.denominator = srcparams.PixelAspectRatio().m_denom;
+
+ // clean area
+ src_params->clean_area.width = srcparams.CleanWidth();
+ src_params->clean_area.height = srcparams.CleanHeight();
+ src_params->clean_area.left_offset = srcparams.LeftOffset();
+ src_params->clean_area.top_offset = srcparams.TopOffset();
+
+ // signal range
+ src_params->signal_range.luma_offset = srcparams.LumaOffset();
+ src_params->signal_range.luma_excursion = srcparams.LumaExcursion();
+ src_params->signal_range.chroma_offset = srcparams.ChromaOffset();
+ src_params->signal_range.chroma_excursion = srcparams.ChromaExcursion();
+
+ // Colour specfication
+ src_params->colour_spec.col_primary = srcparams.ColourPrimariesIndex();
+ src_params->colour_spec.trans_func = srcparams.TransferFunctionIndex();
+ switch(srcparams.ColourMatrixIndex())
{
- TEST(parser != NULL);
- TEST(decoder != NULL);
-
- dirac_sourceparams_t *src_params = &decoder->src_params;
- dirac_parseparams_t *parse_params = &decoder->parse_params;
- const SourceParams& srcparams = parser->GetSourceParams();
- const ParseParams& pparams = parser->GetParseParams();
-
- parse_params->major_ver = pparams.MajorVersion();
- parse_params->minor_ver = pparams.MinorVersion();
- parse_params->profile = pparams.Profile();
- parse_params->level = pparams.Level();
-
- src_params->width = srcparams.Xl();
- src_params->height = srcparams.Yl();
-
- src_params->chroma = (dirac_chroma_t)srcparams.CFormat();
- src_params->chroma_width = srcparams.ChromaWidth();
- src_params->chroma_height = srcparams.ChromaHeight();
-
- // set the source parmeters
- src_params->source_sampling = srcparams.SourceSampling();
- src_params->topfieldfirst = srcparams.TopFieldFirst() ? 1 : 0;
-
- src_params->frame_rate.numerator = srcparams.FrameRate().m_num;
- src_params->frame_rate.denominator = srcparams.FrameRate().m_denom;
-
- src_params->pix_asr.numerator = srcparams.PixelAspectRatio().m_num;
- src_params->pix_asr.denominator = srcparams.PixelAspectRatio().m_denom;
-
- // clean area
- src_params->clean_area.width = srcparams.CleanWidth();
- src_params->clean_area.height = srcparams.CleanHeight();
- src_params->clean_area.left_offset = srcparams.LeftOffset();
- src_params->clean_area.top_offset = srcparams.TopOffset();
-
- // signal range
- src_params->signal_range.luma_offset = srcparams.LumaOffset();
- src_params->signal_range.luma_excursion = srcparams.LumaExcursion();
- src_params->signal_range.chroma_offset = srcparams.ChromaOffset();
- src_params->signal_range.chroma_excursion = srcparams.ChromaExcursion();
-
- // Colour specfication
- src_params->colour_spec.col_primary = srcparams.ColourPrimariesIndex();
- src_params->colour_spec.trans_func = srcparams.TransferFunctionIndex();
- switch(srcparams.ColourMatrixIndex())
- {
- case CM_SDTV:
- src_params->colour_spec.col_matrix.kr = 0.299f;
- src_params->colour_spec.col_matrix.kb = 0.114f;
- break;
- case CM_REVERSIBLE:
- src_params->colour_spec.col_matrix.kr = 0.25f;
- src_params->colour_spec.col_matrix.kb = 0.25f;
- break;
- case CM_HDTV_COMP_INTERNET:
- default:
- src_params->colour_spec.col_matrix.kr = 0.2126f;
- src_params->colour_spec.col_matrix.kb = 0.0722f;
- break;
- }
+ case CM_SDTV:
+ src_params->colour_spec.col_matrix.kr = 0.299f;
+ src_params->colour_spec.col_matrix.kb = 0.114f;
+ break;
+ case CM_REVERSIBLE:
+ src_params->colour_spec.col_matrix.kr = 0.25f;
+ src_params->colour_spec.col_matrix.kb = 0.25f;
+ break;
+ case CM_HDTV_COMP_INTERNET:
+ default:
+ src_params->colour_spec.col_matrix.kr = 0.2126f;
+ src_params->colour_spec.col_matrix.kb = 0.0722f;
+ break;
}
+}
- static void set_frame_component(const PicArray& pic_data, const CompSort cs, dirac_decoder_t *decoder)
- {
- TEST(decoder->fbuf != NULL);
- int xl, yl;
+static void set_frame_component (const PicArray& pic_data, const CompSort cs, dirac_decoder_t *decoder)
+{
+ TEST (decoder->fbuf != NULL);
+ int xl, yl;
- unsigned char *buf;
+ unsigned char *buf;
- switch(cs)
- {
- case U_COMP:
- xl = decoder->src_params.chroma_width;
- yl = decoder->src_params.chroma_height;
- buf = decoder->fbuf->buf[1];
- break;
- case V_COMP:
- xl = decoder->src_params.chroma_width;
- yl = decoder->src_params.chroma_height;
- buf = decoder->fbuf->buf[2];
- break;
-
- case Y_COMP:
- default:
- xl = decoder->src_params.width;
- yl = decoder->src_params.height;
- buf = decoder->fbuf->buf[0];
- break;
- }
+ switch (cs)
+ {
+ case U_COMP:
+ xl = decoder->src_params.chroma_width;
+ yl = decoder->src_params.chroma_height;
+ buf = decoder->fbuf->buf[1];
+ break;
+ case V_COMP:
+ xl = decoder->src_params.chroma_width;
+ yl = decoder->src_params.chroma_height;
+ buf = decoder->fbuf->buf[2];
+ break;
+
+ case Y_COMP:
+ default:
+ xl = decoder->src_params.width;
+ yl = decoder->src_params.height;
+ buf = decoder->fbuf->buf[0];
+ break;
+ }
- TEST(buf != NULL);
+ TEST (buf != NULL);
#if defined HAVE_MMX
- int last_idx = (xl >> 3) << 3;
- __m64 tmp = _mm_set_pi16(128, 128, 128, 128);
- for(int j = 0 ; j < yl ; ++j)
+ int last_idx = (xl>>3)<<3;
+ __m64 tmp = _mm_set_pi16(128, 128, 128, 128);
+ for (int j=0 ; j<yl ;++j)
+ {
+ for (int i=0 ; i<last_idx ; i+=8 )
{
- for(int i = 0 ; i < last_idx ; i += 8)
- {
- __m64 pic1 = *(__m64 *)&pic_data[j][i];
- pic1 = _mm_add_pi16(pic1, tmp);
- __m64 pic2 = *(__m64 *)(&pic_data[j][i+4]);
- pic2 = _mm_add_pi16(pic2, tmp);
- __m64 *tmp = (__m64 *)&buf[j*xl+i];
- *tmp = _mm_packs_pu16(pic1, pic2);
- }//i
- }//j
- _mm_empty();
-
- // mop up remaining pixels
- for(int j = 0 ; j < yl ; ++j)
+ __m64 pic1 = *(__m64 *)&pic_data[j][i];
+ pic1 = _mm_add_pi16 (pic1, tmp);
+ __m64 pic2 = *(__m64 *)(&pic_data[j][i+4]);
+ pic2 = _mm_add_pi16 (pic2, tmp);
+ __m64 *tmp = (__m64 *)&buf[j*xl+i];
+ *tmp = _mm_packs_pu16 (pic1, pic2);
+ }//i
+ }//j
+ _mm_empty();
+
+ // mop up remaining pixels
+ for (int j=0 ; j<yl ;++j)
+ {
+ for (int i=last_idx ; i<xl ; i++ )
{
- for(int i = last_idx ; i < xl ; i++)
- {
- buf[j*xl+i] = (unsigned char)(pic_data[j][i] + 128);
- }//i
- }//j
- return;
+ buf[j*xl+i]=(unsigned char) (pic_data[j][i]+128);
+ }//i
+ }//j
+ return;
#else
- for(int j = 0 ; j < yl ; ++j)
+ for (int j=0 ; j<yl ;++j)
+ {
+ for (int i=0 ; i<xl ; ++i)
{
- for(int i = 0 ; i < xl ; ++i)
- {
- buf[j*xl+i] = (unsigned char)(pic_data[j][i] + 128);
- }//i
- }//j
+ buf[j*xl+i]=(unsigned char) (pic_data[j][i]+128);
+ }//i
+ }//j
#endif
- }
+}
- static void set_field_component(const PicArray& pic_data, const CompSort cs, dirac_decoder_t *decoder, unsigned int pic_num)
- {
- TEST(decoder->fbuf != NULL);
- int xl, yl;
+static void set_field_component (const PicArray& pic_data, const CompSort cs, dirac_decoder_t *decoder, unsigned int pic_num)
+{
+ TEST (decoder->fbuf != NULL);
+ int xl, yl;
- unsigned char *buf;
+ unsigned char *buf;
- switch(cs)
- {
- case U_COMP:
- xl = decoder->src_params.chroma_width;
- yl = decoder->src_params.chroma_height;
- buf = decoder->fbuf->buf[1];
- break;
- case V_COMP:
- xl = decoder->src_params.chroma_width;
- yl = decoder->src_params.chroma_height;
- buf = decoder->fbuf->buf[2];
- break;
-
- case Y_COMP:
- default:
- xl = decoder->src_params.width;
- yl = decoder->src_params.height;
- buf = decoder->fbuf->buf[0];
- break;
- }
+ switch (cs)
+ {
+ case U_COMP:
+ xl = decoder->src_params.chroma_width;
+ yl = decoder->src_params.chroma_height;
+ buf = decoder->fbuf->buf[1];
+ break;
+ case V_COMP:
+ xl = decoder->src_params.chroma_width;
+ yl = decoder->src_params.chroma_height;
+ buf = decoder->fbuf->buf[2];
+ break;
+
+ case Y_COMP:
+ default:
+ xl = decoder->src_params.width;
+ yl = decoder->src_params.height;
+ buf = decoder->fbuf->buf[0];
+ break;
+ }
- TEST(buf != NULL);
+ TEST (buf != NULL);
- // Seek offset before writing field to store
- int start = 0;
- // Seek offset between writing fields to store
- int skip = 0;
+ // Seek offset before writing field to store
+ int start = 0;
+ // Seek offset between writing fields to store
+ int skip = 0;
- bool top_field = decoder->src_params.topfieldfirst ? (!(pic_num % 2)) :
- (pic_num % 2);
+ bool top_field = decoder->src_params.topfieldfirst ? (!(pic_num%2)) :
+ (pic_num%2);
- if(top_field) // i.e. top field
- {
- start = 0;
- skip = 2 * xl * sizeof(char);
- }
- else // else bottom field
- {
- start = xl;
- skip = 2 * xl * sizeof(char);
- }
+ if (top_field) // i.e. top field
+ {
+ start = 0;
+ skip = 2 * xl * sizeof(char);
+ }
+ else // else bottom field
+ {
+ start = xl;
+ skip = 2 * xl * sizeof(char);
+ }
- unsigned char *tempc = buf + start;
+ unsigned char *tempc = buf + start;
- int field_yl = yl >> 1;
- int field_xl = xl;
+ int field_yl = yl>>1;
+ int field_xl = xl;
- for(int j = 0 ; j < field_yl ; ++j)
+ for (int j=0 ; j<field_yl ;++j)
+ {
+ for (int i=0 ; i<field_xl ; ++i)
{
- for(int i = 0 ; i < field_xl ; ++i)
- {
- tempc[i] = (unsigned char)(pic_data[j][i] + 128);
- }//I
- tempc += skip;
- }
+ tempc[i] = (unsigned char) (pic_data[j][i]+128);
+ }//I
+ tempc += skip;
}
+}
- static void set_frame_data(const DiracParser * const parser, dirac_decoder_t *decoder)
- {
- TEST(parser != NULL);
- TEST(decoder != NULL);
- TEST(decoder->fbuf != NULL);
- TEST(decoder->state == STATE_PICTURE_AVAIL);
+static void set_frame_data (const DiracParser * const parser, dirac_decoder_t *decoder)
+{
+ TEST (parser != NULL);
+ TEST (decoder != NULL);
+ TEST (decoder->fbuf != NULL);
+ TEST (decoder->state == STATE_PICTURE_AVAIL);
- const Picture* my_picture = parser->GetNextPicture();
+ const Picture* my_picture = parser->GetNextPicture();
- if(my_picture)
- {
- int pic_num = my_picture->GetPparams().PictureNum();
+ if (my_picture)
+ {
+ int pic_num = my_picture->GetPparams().PictureNum();
- if(!parser->GetDecoderParams().FieldCoding())
- {
- set_frame_component(my_picture->Data(Y_COMP), Y_COMP, decoder);
- set_frame_component(my_picture->Data(U_COMP), U_COMP, decoder);
- set_frame_component(my_picture->Data(V_COMP), V_COMP, decoder);
- }
- else
- {
- set_field_component(my_picture->Data(Y_COMP), Y_COMP, decoder, pic_num);
- set_field_component(my_picture->Data(U_COMP), U_COMP, decoder, pic_num);
- set_field_component(my_picture->Data(V_COMP), V_COMP, decoder, pic_num);
- }
+ if (!parser->GetDecoderParams().FieldCoding())
+ {
+ set_frame_component (my_picture->Data(Y_COMP), Y_COMP, decoder);
+ set_frame_component (my_picture->Data(U_COMP), U_COMP, decoder);
+ set_frame_component (my_picture->Data(V_COMP), V_COMP, decoder);
+ }
+ else
+ {
+ set_field_component (my_picture->Data(Y_COMP), Y_COMP, decoder, pic_num);
+ set_field_component (my_picture->Data(U_COMP), U_COMP, decoder, pic_num);
+ set_field_component (my_picture->Data(V_COMP), V_COMP, decoder, pic_num);
}
- return;
}
+ return;
+}
- extern DllExport dirac_decoder_state_t dirac_parse(dirac_decoder_t *decoder)
- {
- TEST(decoder != NULL);
- TEST(decoder->parser != NULL);
- DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+extern DllExport dirac_decoder_state_t dirac_parse (dirac_decoder_t *decoder)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
- unsigned int pic_num;
+ unsigned int pic_num;
- while(true)
+ while(true)
+ {
+ try
{
- try
- {
- decoder->state = parser->Parse();
+ decoder->state = parser->Parse();
- switch(decoder->state)
- {
- case STATE_BUFFER:
- return decoder->state;
- break;
+ switch (decoder->state)
+ {
+ case STATE_BUFFER:
+ return decoder->state;
+ break;
- case STATE_SEQUENCE:
- set_sequence_params(parser, decoder);
- decoder->frame_avail = 0;
- return decoder->state;
- break;
+ case STATE_SEQUENCE:
+ set_sequence_params(parser, decoder);
+ decoder->frame_avail = 0;
+ return decoder->state;
+ break;
- case STATE_PICTURE_AVAIL:
+ case STATE_PICTURE_AVAIL:
+ {
+ const Picture *my_picture = parser->GetNextPicture();
+ if (my_picture)
{
- const Picture *my_picture = parser->GetNextPicture();
- if(my_picture)
+ pic_num = parser->GetNextPicture()->GetPparams().PictureNum();
+ decoder->frame_num = pic_num;
+ set_frame_data (parser, decoder);
+
+ /* A full frame is only available if we're doing
+ * progressive coding or have decoded the second field.
+ * Will only return when a full frame is available
+ */
+ if (!parser->GetDecoderParams().FieldCoding() ||
+ pic_num%2)
{
- pic_num = parser->GetNextPicture()->GetPparams().PictureNum();
+ /* Frame number currently available for display */
decoder->frame_num = pic_num;
- set_frame_data(parser, decoder);
-
- /* A full frame is only available if we're doing
- * progressive coding or have decoded the second field.
- * Will only return when a full frame is available
- */
- if(!parser->GetDecoderParams().FieldCoding() ||
- pic_num % 2)
- {
- /* Frame number currently available for display */
- decoder->frame_num = pic_num;
- if(parser->GetDecoderParams().FieldCoding())
- decoder->frame_num = pic_num >> 1;
- decoder->frame_avail = 1;
- return decoder->state;
- }
+ if (parser->GetDecoderParams().FieldCoding())
+ decoder->frame_num = pic_num>>1;
+ decoder->frame_avail = 1;
+ return decoder->state;
}
- break;
}
+ break;
+ }
- case STATE_INVALID:
- return decoder->state;
- break;
+ case STATE_INVALID:
+ return decoder->state;
+ break;
- case STATE_SEQUENCE_END:
- return decoder->state;
- break;
+ case STATE_SEQUENCE_END:
+ return decoder->state;
+ break;
- default:
- break;
- }
- }//try
- catch(const DiracException& e)
- {
- return STATE_INVALID;
+ default:
+ break;
}
+ }//try
+ catch (const DiracException& e)
+ {
+ return STATE_INVALID;
}
-
- return decoder->state;
}
- extern DllExport void dirac_set_buf(dirac_decoder_t *decoder, unsigned char *buf[3], void *id)
- {
- TEST(decoder != NULL);
- TEST(decoder->fbuf != NULL);
+ return decoder->state;
+}
- decoder->fbuf->buf[0] = buf[0];
- decoder->fbuf->buf[1] = buf[1];
- decoder->fbuf->buf[2] = buf[2];
- decoder->fbuf->id = id;
- }
+extern DllExport void dirac_set_buf (dirac_decoder_t *decoder, unsigned char *buf[3], void *id)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->fbuf != NULL);
+
+ decoder->fbuf->buf[0] = buf[0];
+ decoder->fbuf->buf[1] = buf[1];
+ decoder->fbuf->buf[2] = buf[2];
+ decoder->fbuf->id = id;
+}
#ifdef __cplusplus
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.h
index ba3153eee..75bdcc7c2 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/dirac_parser.h
@@ -44,7 +44,7 @@
/*! \file
\brief C interface to Dirac decoder.
-
+
A set of 'C' functions that define the public interface to the Dirac decoder.
Refer to the the reference decoder source code, decoder/decmain.cpp for
an example of how to use the "C" interface. The pseudocode below gives
@@ -68,9 +68,9 @@
case STATE_SEQUENCE:
handle start of sequence.
- The decoder returns the sequence parameters in the
+ The decoder returns the sequence parameters in the
seq_params member of the decoder handle.
- Allocate space for the frame data buffers and pass
+ Allocate space for the frame data buffers and pass
this to the decoder.
dirac_set_buf (decoder_handle, buf, NULL);
break;
@@ -81,7 +81,7 @@
case STATE_PICTURE_AVAIL:
Handle picture data.
- The decoder sets the fbuf member in the decoder
+ The decoder sets the fbuf member in the decoder
handle to the frame decoded.
break;
@@ -90,7 +90,7 @@
break;
}
} while (data available && decoder state != STATE_INVALID
-
+
Free the decoder resources
dirac_decoder_close(decoder_handle)
\endverbatim
@@ -99,83 +99,83 @@
extern "C" {
#endif
- typedef DecoderState dirac_decoder_state_t;
-
- /*! Structure that holds the information returned by the parser */
- typedef struct
- {
- /*! parser state */
- dirac_decoder_state_t state;
- /*! parse parameters */
- dirac_parseparams_t parse_params;
- /*! source parameters */
- dirac_sourceparams_t src_params;
- /*! frame (NOT picture) number */
- unsigned int frame_num;
- /*! void pointer to internal parser */
- void *parser;
- /*! frame (NOT picture) buffer to hold luma and chroma data */
- dirac_framebuf_t *fbuf;
- /*! boolean flag that indicates if a decoded frame (NOT picture) is available */
- int frame_avail;
- /*! verbose output */
- int verbose;
-
- } dirac_decoder_t;
-
- /*!
- Decoder Init
- Initialise the decoder.
- \param verbose boolean flag to set verbose output
- \return decoder handle
- */
- extern DllExport dirac_decoder_t *dirac_decoder_init(int verbose);
-
- /*!
- Release the decoder resources
- \param decoder Decoder object
- */
- extern DllExport void dirac_decoder_close(dirac_decoder_t *decoder);
-
- /*!
- Parses the data in the input buffer. This function returns the
- following values.
- \n STATE_BUFFER: Not enough data in internal buffer to process
- \n STATE_SEQUENCE: Start of sequence detected. The seq_params member
- in the decoder object is set to the details of the
- next sequence to be processed.
- \n STATE_PICTURE_START: Start of picture detected. The frame_params member
- of the decoder object is set to the details of the
- next frame to be processed.
- \n STATE_PICTURE_AVAIL: Decoded picture available. The frame_aprams member
- of the decoder object is set the the details of
- the decoded frame available. The fbuf member of
- the decoder object has the luma and chroma data of
- the decompressed frame.
- \n STATE_SEQUENCE_END: End of sequence detected.
- \n STATE_INVALID: Invalid stream. Stop further processing.
-
- \param decoder Decoder object
- \return Decoder state
-
- */
- extern DllExport dirac_decoder_state_t dirac_parse(dirac_decoder_t *decoder);
-
- /*!
- Copy data into internal buffer
- \param decoder Decoder object
- \param start Start of data
- \param end End of data
- */
- extern DllExport void dirac_buffer(dirac_decoder_t *decoder, unsigned char *start, unsigned char *end);
-
- /*!
- Set the output buffer into which the decoder copies the decoded data
- \param decoder Decoder object
- \param buf Array of char buffers to hold luma and chroma data
- \param id User data
- */
- extern DllExport void dirac_set_buf(dirac_decoder_t *decoder, unsigned char *buf[3], void *id);
+typedef DecoderState dirac_decoder_state_t;
+
+/*! Structure that holds the information returned by the parser */
+typedef struct
+{
+ /*! parser state */
+ dirac_decoder_state_t state;
+ /*! parse parameters */
+ dirac_parseparams_t parse_params;
+ /*! source parameters */
+ dirac_sourceparams_t src_params;
+ /*! frame (NOT picture) number */
+ unsigned int frame_num;
+ /*! void pointer to internal parser */
+ void *parser;
+ /*! frame (NOT picture) buffer to hold luma and chroma data */
+ dirac_framebuf_t *fbuf;
+ /*! boolean flag that indicates if a decoded frame (NOT picture) is available */
+ int frame_avail;
+ /*! verbose output */
+ int verbose;
+
+} dirac_decoder_t;
+
+/*!
+ Decoder Init
+ Initialise the decoder.
+ \param verbose boolean flag to set verbose output
+ \return decoder handle
+*/
+extern DllExport dirac_decoder_t *dirac_decoder_init(int verbose);
+
+/*!
+ Release the decoder resources
+ \param decoder Decoder object
+*/
+extern DllExport void dirac_decoder_close(dirac_decoder_t *decoder);
+
+/*!
+ Parses the data in the input buffer. This function returns the
+ following values.
+ \n STATE_BUFFER: Not enough data in internal buffer to process
+ \n STATE_SEQUENCE: Start of sequence detected. The seq_params member
+ in the decoder object is set to the details of the
+ next sequence to be processed.
+ \n STATE_PICTURE_START: Start of picture detected. The frame_params member
+ of the decoder object is set to the details of the
+ next frame to be processed.
+ \n STATE_PICTURE_AVAIL: Decoded picture available. The frame_aprams member
+ of the decoder object is set the the details of
+ the decoded frame available. The fbuf member of
+ the decoder object has the luma and chroma data of
+ the decompressed frame.
+ \n STATE_SEQUENCE_END: End of sequence detected.
+ \n STATE_INVALID: Invalid stream. Stop further processing.
+
+ \param decoder Decoder object
+ \return Decoder state
+
+*/
+extern DllExport dirac_decoder_state_t dirac_parse (dirac_decoder_t *decoder);
+
+/*!
+ Copy data into internal buffer
+ \param decoder Decoder object
+ \param start Start of data
+ \param end End of data
+*/
+extern DllExport void dirac_buffer (dirac_decoder_t *decoder, unsigned char *start, unsigned char *end);
+
+/*!
+ Set the output buffer into which the decoder copies the decoded data
+ \param decoder Decoder object
+ \param buf Array of char buffers to hold luma and chroma data
+ \param id User data
+*/
+extern DllExport void dirac_set_buf (dirac_decoder_t *decoder, unsigned char *buf[3], void *id);
#ifdef __cplusplus
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.cpp
index 27f581a8e..fe413551f 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.cpp
@@ -59,9 +59,9 @@ using std::vector;
using std::auto_ptr;
PictureDecompressor::PictureDecompressor(DecoderParams& decp, ChromaFormat cf)
- :
- m_decparams(decp),
- m_cformat(cf)
+:
+m_decparams(decp),
+m_cformat(cf)
{
}
@@ -71,167 +71,158 @@ PictureDecompressor::~PictureDecompressor()
bool PictureDecompressor::Decompress(ParseUnitByteIO& parseunit_byteio,
- PictureBuffer& my_buffer)
+ PictureBuffer& my_buffer)
{
// get current byte position
//int start_pos = parseunit_byteio.GetReadBytePosition();
- try
- {
+ try {
- // read picture data
- PictureByteIO picture_byteio(m_pparams,
- parseunit_byteio);
+ // read picture data
+ PictureByteIO picture_byteio(m_pparams,
+ parseunit_byteio);
- picture_byteio.Input();
+ picture_byteio.Input();
- PictureSort fs;
+ PictureSort fs;
- if(m_pparams.GetPictureType() == INTRA_PICTURE)
- fs.SetIntra();
- else
- fs.SetInter();
+ if (m_pparams.GetPictureType() == INTRA_PICTURE)
+ fs.SetIntra();
+ else
+ fs.SetInter();
- if(m_pparams.GetReferenceType() == REFERENCE_PICTURE)
- fs.SetRef();
- else
- fs.SetNonRef();
+ if (m_pparams.GetReferenceType() == REFERENCE_PICTURE)
+ fs.SetRef();
+ else
+ fs.SetNonRef();
- m_pparams.SetPicSort(fs);
+ m_pparams.SetPicSort(fs);
- if(m_pparams.GetReferenceType() == REFERENCE_PICTURE)
- // Now clean the reference pictures from the buffer
- CleanReferencePictures(my_buffer);
+ if (m_pparams.GetReferenceType() == REFERENCE_PICTURE)
+ // Now clean the reference pictures from the buffer
+ CleanReferencePictures( my_buffer );
- // Check if the picture can be decoded
- if(m_pparams.PicSort().IsInter())
- {
- const std::vector<int>& refs = m_pparams.Refs();
+ // Check if the picture can be decoded
+ if (m_pparams.PicSort().IsInter()){
+ const std::vector<int>& refs = m_pparams.Refs();
- for(unsigned int i = 0; i < refs.size(); ++i)
- if(!my_buffer.IsPictureAvail(refs[i]))
- return false;
- }
+ for (unsigned int i = 0; i < refs.size(); ++i)
+ if ( !my_buffer.IsPictureAvail(refs[i]) )
+ return false;
+ }
- // decode the rest of the picture
-
- if(m_decparams.Verbose())
- {
- std::cout << std::endl << "Decoding picture " << m_pparams.PictureNum() << " in display order";
- if(m_pparams.PicSort().IsInter())
- {
- std::cout << std::endl << "References: " << m_pparams.Refs()[0];
- if(m_pparams.Refs().size() > 1)
- std::cout << " and " << m_pparams.Refs()[1];
- }
- }
+ // decode the rest of the picture
- PictureSort psort = m_pparams.PicSort();
- auto_ptr<MvData> mv_data;
+ if ( m_decparams.Verbose() ){
+ std::cout<<std::endl<<"Decoding picture "<<m_pparams.PictureNum()<<" in display order";
+ if ( m_pparams.PicSort().IsInter() ){
+ std::cout<<std::endl<<"References: "<<m_pparams.Refs()[0];
+ if ( m_pparams.Refs().size()>1 )
+ std::cout<<" and "<<m_pparams.Refs()[1];
+ }
+ }
- if(psort.IsInter())
- //do all the MV stuff
- DecompressMVData(mv_data, picture_byteio);
+ PictureSort psort = m_pparams.PicSort();
+ auto_ptr<MvData> mv_data;
- // Read the transform header
- TransformByteIO transform_byteio(picture_byteio, m_pparams, m_decparams);
- transform_byteio.Input();
+ if ( psort.IsInter() )
+ //do all the MV stuff
+ DecompressMVData( mv_data, picture_byteio );
- if(m_pparams.PicSort().IsIntra() && m_decparams.ZeroTransform())
- {
- DIRAC_THROW_EXCEPTION(
- ERR_UNSUPPORTED_STREAM_DATA,
- "Intra pictures cannot have Zero-Residual",
- SEVERITY_PICTURE_ERROR);
- }
+ // Read the transform header
+ TransformByteIO transform_byteio(picture_byteio, m_pparams, m_decparams);
+ transform_byteio.Input();
- // Add a picture to the buffer to decode into
- PushPicture(my_buffer);
+ if (m_pparams.PicSort().IsIntra() && m_decparams.ZeroTransform()){
+ DIRAC_THROW_EXCEPTION(
+ ERR_UNSUPPORTED_STREAM_DATA,
+ "Intra pictures cannot have Zero-Residual",
+ SEVERITY_PICTURE_ERROR);
+ }
- //Reference to the picture being decoded
- Picture& my_picture = my_buffer.GetPicture(m_pparams.PictureNum());
+ // Add a picture to the buffer to decode into
+ PushPicture(my_buffer);
- if(!m_decparams.ZeroTransform())
- {
- //decode components
- Picture& pic = my_buffer.GetPicture(m_pparams.PictureNum());
+ //Reference to the picture being decoded
+ Picture& my_picture = my_buffer.GetPicture(m_pparams.PictureNum());
- CompDecompressor my_compdecoder(m_decparams , pic.GetPparams());
+ if (!m_decparams.ZeroTransform()){
+ //decode components
+ Picture& pic = my_buffer.GetPicture( m_pparams.PictureNum() );
- PicArray* comp_data[3];
- CoeffArray* coeff_data[3];
+ CompDecompressor my_compdecoder( m_decparams , pic.GetPparams() );
- const int depth(m_decparams.TransformDepth());
- WaveletTransform wtransform(depth, m_decparams.TransformFilter());
+ PicArray* comp_data[3];
+ CoeffArray* coeff_data[3];
- pic.InitWltData(depth);
+ const int depth( m_decparams.TransformDepth() );
+ WaveletTransform wtransform( depth, m_decparams.TransformFilter() );
- for(int c = 0; c < 3; ++c)
- {
- ComponentByteIO component_byteio((CompSort) c, transform_byteio);
- comp_data[c] = &pic.Data((CompSort) c);
- coeff_data[c] = &pic.WltData((CompSort) c);
+ pic.InitWltData( depth );
- SubbandList& bands = coeff_data[c]->BandList();
+ for (int c=0; c<3; ++c){
+ ComponentByteIO component_byteio((CompSort) c, transform_byteio);
+ comp_data[c] = &pic.Data((CompSort) c);
+ coeff_data[c] = &pic.WltData((CompSort) c);
- bands.Init(depth , coeff_data[c]->LengthX() , coeff_data[c]->LengthY());
- my_compdecoder.Decompress(&component_byteio, *(coeff_data[c]), bands);
+ SubbandList& bands = coeff_data[c]->BandList();
- wtransform.Transform(BACKWARD, *(comp_data[c]), *(coeff_data[c]));
- }
+ bands.Init(depth , coeff_data[c]->LengthX() , coeff_data[c]->LengthY());
+ my_compdecoder.Decompress(&component_byteio, *(coeff_data[c]), bands );
+
+ wtransform.Transform(BACKWARD,*(comp_data[c]), *(coeff_data[c]));
}
- else
- my_picture.Fill(0);
+ }
+ else
+ my_picture.Fill(0);
- if(psort.IsInter())
- {
- Picture* my_pic = &my_buffer.GetPicture(m_pparams.PictureNum());
+ if ( psort.IsInter() ){
+ Picture* my_pic = &my_buffer.GetPicture( m_pparams.PictureNum() );
- const std::vector<int>& refs = m_pparams.Refs();
- Picture* ref_pics[2];
+ const std::vector<int>& refs = m_pparams.Refs();
+ Picture* ref_pics[2];
- ref_pics[0] = &my_buffer.GetPicture(refs[0]);
- if(refs.size() > 1)
- ref_pics[1] = &my_buffer.GetPicture(refs[1]);
- else
- ref_pics[1] = ref_pics[0];
+ ref_pics[0] = &my_buffer.GetPicture( refs[0] );
+ if (refs.size()>1)
+ ref_pics[1] = &my_buffer.GetPicture( refs[1] );
+ else
+ ref_pics[1] = ref_pics[0];
- //motion compensate to add the data back in if we don't have an I picture
- MotionCompensator::CompensatePicture(m_decparams.GetPicPredParams() , ADD , *(mv_data.get()) ,
- my_pic, ref_pics);
- }
+ //motion compensate to add the data back in if we don't have an I picture
+ MotionCompensator::CompensatePicture( m_decparams.GetPicPredParams() , ADD , *(mv_data.get()) ,
+ my_pic, ref_pics );
+ }
- my_picture.Clip();
+ my_picture.Clip();
- if(m_decparams.Verbose())
- std::cout << std::endl;
+ if (m_decparams.Verbose())
+ std::cout<<std::endl;
- //exit success
- return true;
+ //exit success
+ return true;
}// try
- catch(const DiracException& e)
- {
+ catch (const DiracException& e) {
// skip picture
throw e;
}
- //exit failure
+ //exit failure
return false;
}
-void PictureDecompressor::CleanReferencePictures(PictureBuffer& my_buffer)
+void PictureDecompressor::CleanReferencePictures( PictureBuffer& my_buffer )
{
- if(m_decparams.Verbose())
- std::cout << std::endl << "Cleaning reference buffer: ";
+ if ( m_decparams.Verbose() )
+ std::cout<<std::endl<<"Cleaning reference buffer: ";
// Do picture buffer cleaning
int retd_pnum = m_pparams.RetiredPictureNum();
- if(retd_pnum >= 0 && my_buffer.IsPictureAvail(retd_pnum) && my_buffer.GetPicture(retd_pnum).GetPparams().PicSort().IsRef())
+ if ( retd_pnum >= 0 && my_buffer.IsPictureAvail(retd_pnum) && my_buffer.GetPicture(retd_pnum).GetPparams().PicSort().IsRef() )
{
my_buffer.Remove(retd_pnum);
- if(m_decparams.Verbose())
- std::cout << retd_pnum << " ";
+ if ( m_decparams.Verbose() )
+ std::cout<<retd_pnum<<" ";
}
}
@@ -242,17 +233,17 @@ void PictureDecompressor::SetMVBlocks()
predparams.SetBlockSizes(olb_params, m_cformat);
// Calculate the number of macro blocks
- int xnum_sb = (m_decparams.Xl() + predparams.LumaBParams(0).Xbsep() - 1) /
- predparams.LumaBParams(0).Xbsep();
- int ynum_sb = (m_decparams.Yl() + predparams.LumaBParams(0).Ybsep() - 1) /
- predparams.LumaBParams(0).Ybsep();
+ int xnum_sb = (m_decparams.Xl()+predparams.LumaBParams(0).Xbsep()-1)/
+ predparams.LumaBParams(0).Xbsep();
+ int ynum_sb = (m_decparams.Yl()+predparams.LumaBParams(0).Ybsep()-1)/
+ predparams.LumaBParams(0).Ybsep();
predparams.SetXNumSB(xnum_sb);
predparams.SetYNumSB(ynum_sb);
// Set the number of blocks
- predparams.SetXNumBlocks(4 * xnum_sb);
- predparams.SetYNumBlocks(4 * ynum_sb);
+ predparams.SetXNumBlocks(4*xnum_sb);
+ predparams.SetYNumBlocks(4*ynum_sb);
// Note that we do not have an integral number of superblocks in a picture
// So it is possible that part of a superblock and some blocks can fall
@@ -273,21 +264,21 @@ void PictureDecompressor::PushPicture(PictureBuffer &my_buffer)
my_buffer.PushPicture(m_pparams);
}
-void PictureDecompressor::DecompressMVData(std::auto_ptr<MvData>& mv_data,
- PictureByteIO& picture_byteio)
+void PictureDecompressor::DecompressMVData( std::auto_ptr<MvData>& mv_data,
+ PictureByteIO& picture_byteio )
{
PicturePredParams& predparams = m_decparams.GetPicPredParams();
- MvDataByteIO mvdata_byteio(picture_byteio, m_pparams, predparams);
+ MvDataByteIO mvdata_byteio (picture_byteio, m_pparams, predparams);
// Read in the picture prediction parameters
mvdata_byteio.Input();
SetMVBlocks();
- mv_data.reset(new MvData(predparams, m_pparams.NumRefs()));
+ mv_data.reset(new MvData( predparams, m_pparams.NumRefs() ));
// decode mv data
- if(m_decparams.Verbose())
- std::cout << std::endl << "Decoding motion data ...";
+ if (m_decparams.Verbose())
+ std::cout<<std::endl<<"Decoding motion data ...";
int num_bits;
@@ -295,88 +286,87 @@ void PictureDecompressor::DecompressMVData(std::auto_ptr<MvData>& mv_data,
mvdata_byteio.SplitModeData()->Input();
// Read the mode data
num_bits = mvdata_byteio.SplitModeData()->DataBlockSize();
- SplitModeCodec smode_decoder(mvdata_byteio.SplitModeData()->DataBlock(), TOTAL_MV_CTXS);
- smode_decoder.Decompress(*(mv_data.get()) , num_bits);
+ SplitModeCodec smode_decoder( mvdata_byteio.SplitModeData()->DataBlock(), TOTAL_MV_CTXS);
+ smode_decoder.Decompress( *(mv_data.get()) , num_bits);
// Read in the prediction mode data header
mvdata_byteio.PredModeData()->Input();
// Read the mode data
num_bits = mvdata_byteio.PredModeData()->DataBlockSize();
- PredModeCodec pmode_decoder(mvdata_byteio.PredModeData()->DataBlock(), TOTAL_MV_CTXS, m_pparams.NumRefs());
- pmode_decoder.Decompress(*(mv_data.get()) , num_bits);
+ PredModeCodec pmode_decoder( mvdata_byteio.PredModeData()->DataBlock(), TOTAL_MV_CTXS, m_pparams.NumRefs());
+ pmode_decoder.Decompress( *(mv_data.get()) , num_bits);
// Read in the MV1 horizontal data header
mvdata_byteio.MV1HorizData()->Input();
// Read the MV1 horizontal data
num_bits = mvdata_byteio.MV1HorizData()->DataBlockSize();
- VectorElementCodec vdecoder1h(mvdata_byteio.MV1HorizData()->DataBlock(), 1,
- HORIZONTAL, TOTAL_MV_CTXS);
- vdecoder1h.Decompress(*(mv_data.get()) , num_bits);
+ VectorElementCodec vdecoder1h( mvdata_byteio.MV1HorizData()->DataBlock(), 1,
+ HORIZONTAL, TOTAL_MV_CTXS);
+ vdecoder1h.Decompress( *(mv_data.get()) , num_bits);
// Read in the MV1 vertical data header
mvdata_byteio.MV1VertData()->Input();
// Read the MV1 data
num_bits = mvdata_byteio.MV1VertData()->DataBlockSize();
- VectorElementCodec vdecoder1v(mvdata_byteio.MV1VertData()->DataBlock(), 1,
- VERTICAL, TOTAL_MV_CTXS);
- vdecoder1v.Decompress(*(mv_data.get()) , num_bits);
+ VectorElementCodec vdecoder1v( mvdata_byteio.MV1VertData()->DataBlock(), 1,
+ VERTICAL, TOTAL_MV_CTXS);
+ vdecoder1v.Decompress( *(mv_data.get()) , num_bits);
- if(m_pparams.NumRefs() > 1)
+ if ( m_pparams.NumRefs()>1 )
{
// Read in the MV2 horizontal data header
mvdata_byteio.MV2HorizData()->Input();
// Read the MV2 horizontal data
num_bits = mvdata_byteio.MV2HorizData()->DataBlockSize();
- VectorElementCodec vdecoder2h(mvdata_byteio.MV2HorizData()->DataBlock(), 2,
- HORIZONTAL, TOTAL_MV_CTXS);
- vdecoder2h.Decompress(*(mv_data.get()) , num_bits);
+ VectorElementCodec vdecoder2h( mvdata_byteio.MV2HorizData()->DataBlock(), 2,
+ HORIZONTAL, TOTAL_MV_CTXS);
+ vdecoder2h.Decompress( *(mv_data.get()) , num_bits);
// Read in the MV2 vertical data header
mvdata_byteio.MV2VertData()->Input();
// Read the MV2 vertical data
num_bits = mvdata_byteio.MV2VertData()->DataBlockSize();
- VectorElementCodec vdecoder2v(mvdata_byteio.MV2VertData()->DataBlock(), 2,
- VERTICAL, TOTAL_MV_CTXS);
- vdecoder2v.Decompress(*(mv_data.get()) , num_bits);
+ VectorElementCodec vdecoder2v( mvdata_byteio.MV2VertData()->DataBlock(), 2,
+ VERTICAL, TOTAL_MV_CTXS);
+ vdecoder2v.Decompress( *(mv_data.get()) , num_bits);
}
// Read in the Y DC data header
mvdata_byteio.YDCData()->Input();
// Read the Y DC data
num_bits = mvdata_byteio.YDCData()->DataBlockSize();
- DCCodec ydc_decoder(mvdata_byteio.YDCData()->DataBlock(), Y_COMP, TOTAL_MV_CTXS);
- ydc_decoder.Decompress(*(mv_data.get()) , num_bits);
+ DCCodec ydc_decoder( mvdata_byteio.YDCData()->DataBlock(), Y_COMP, TOTAL_MV_CTXS);
+ ydc_decoder.Decompress( *(mv_data.get()) , num_bits);
// Read in the U DC data header
mvdata_byteio.UDCData()->Input();
// Read the U DC data
num_bits = mvdata_byteio.UDCData()->DataBlockSize();
- DCCodec udc_decoder(mvdata_byteio.YDCData()->DataBlock(), U_COMP, TOTAL_MV_CTXS);
- udc_decoder.Decompress(*(mv_data.get()) , num_bits);
+ DCCodec udc_decoder( mvdata_byteio.YDCData()->DataBlock(), U_COMP, TOTAL_MV_CTXS);
+ udc_decoder.Decompress( *(mv_data.get()) , num_bits);
// Read in the Y DC data header
mvdata_byteio.YDCData()->Input();
// Read the Y DC data
num_bits = mvdata_byteio.YDCData()->DataBlockSize();
- DCCodec vdc_decoder(mvdata_byteio.VDCData()->DataBlock(), V_COMP, TOTAL_MV_CTXS);
- vdc_decoder.Decompress(*(mv_data.get()) , num_bits);
+ DCCodec vdc_decoder( mvdata_byteio.VDCData()->DataBlock(), V_COMP, TOTAL_MV_CTXS);
+ vdc_decoder.Decompress( *(mv_data.get()) , num_bits);
}
-void PictureDecompressor::InitCoeffData(CoeffArray& coeff_data, const int xl, const int yl)
-{
+void PictureDecompressor::InitCoeffData( CoeffArray& coeff_data, const int xl, const int yl ){
// First set the dimensions up //
int xpad_len = xl;
int ypad_len = yl;
// The pic dimensions must be a multiple of 2^(transform depth)
- int tx_mul = (1 << m_decparams.TransformDepth());
+ int tx_mul = (1<<m_decparams.TransformDepth());
- if(xpad_len % tx_mul != 0)
- xpad_len = ((xpad_len / tx_mul) + 1) * tx_mul;
- if(ypad_len % tx_mul != 0)
- ypad_len = ((ypad_len / tx_mul) + 1) * tx_mul;
+ if ( xpad_len%tx_mul != 0 )
+ xpad_len = ( (xpad_len/tx_mul)+1 ) *tx_mul;
+ if ( ypad_len%tx_mul != 0 )
+ ypad_len = ( (ypad_len/tx_mul)+1 ) * tx_mul;
- coeff_data.Resize(ypad_len, xpad_len);
+ coeff_data.Resize( ypad_len, xpad_len );
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.h
index 20f4a90d3..31efbe5db 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/picture_decompress.h
@@ -50,110 +50,106 @@
namespace dirac
{
-class MvData;
-
-//! Compress a single image picture
-/*!
- This class decompresses a single picture at a time, using parameters
- supplied at its construction. PictureDecompressor is used by
- SequenceDecompressor.
-*/
-class PictureDecompressor
-{
-public:
- //! Constructor
- /*!
- Creates a PictureDecompressor with specific set of parameters the
- control the decompression process. It decodes motion data before
- decoding each component of the picture.
-
- \param decp decoder parameters
- \param cf the chroma format of the picture being decompressed
- */
- PictureDecompressor(DecoderParams& decp, ChromaFormat cf);
-
- //! Destructor
- /*!
- Releases resources.
- */
- ~PictureDecompressor();
-
- //! Decompress the next picture into the buffer
- /*!
- Decompresses the next picture from the stream and place at the end
- of a picture buffer.
- Returns true if able to decode successfully, false otherwise
-
- \param parseunit_byteio Picture info in Dirac-stream format
- \param my_buffer picture buffer into which the picture is placed
- */
- bool Decompress(ParseUnitByteIO& parseunit_byteio,
- PictureBuffer& my_buffer);
-
- //! Returns the picture parameters of the current picture being decoded
- const PictureParams& GetPicParams() const
- {
- return m_pparams;
- }
-
-private:
- //! Copy constructor is private and body-less
- /*!
- Copy constructor is private and body-less. This class should not be copied.
-
- */
- PictureDecompressor(const PictureDecompressor& cpy);
-
- //! Assignment = is private and body-less
+ class MvData;
+
+ //! Compress a single image picture
/*!
- Assignment = is private and body-less. This class should not be
- assigned.
+ This class decompresses a single picture at a time, using parameters
+ supplied at its construction. PictureDecompressor is used by
+ SequenceDecompressor.
*/
- PictureDecompressor& operator=(const PictureDecompressor& rhs);
-
- //! Initialise the padded coefficient data for the IDWT and subband decoding
- void InitCoeffData(CoeffArray& coeff_data, const int xl, const int yl);
-
- //! Removes all the reference pictures in the retired list
- void CleanReferencePictures(PictureBuffer& my_buffer);
-
- //! Decodes component data
- void CompDecompress(TransformByteIO *p_transform_byteio,
- PictureBuffer& my_buffer, int pnum, CompSort cs);
-
- //! Decodes the motion data
- void DecompressMVData(std::auto_ptr<MvData>& mv_data, PictureByteIO& picture_byteio);
-
-
- //! Set the number of superblocks and blocks
- void SetMVBlocks();
-
- //! Add a picture to the picture buffer
- void PushPicture(PictureBuffer &my_buffer);
-
- //Member variables
-
- //! Parameters for the decompression, as provided in constructor
- DecoderParams& m_decparams;
-
- //! Chroma format of the picture being decompressed
- ChromaFormat m_cformat;
-
- //! An indicator which is true if the picture has been skipped, false otherwise
- bool m_skipped;
-
- //! An indicator that is true if we use global motion vectors, false otherwise
- bool m_use_global;
-
- //! An indicator that is true if we use block motion vectors, false otherwise
- bool m_use_block_mv;
-
- //! Prediction mode to use if we only have global motion vectors
- PredMode m_global_pred_mode;
-
- //! Current Picture Parameters
- PictureParams m_pparams;
-};
+ class PictureDecompressor{
+ public:
+ //! Constructor
+ /*!
+ Creates a PictureDecompressor with specific set of parameters the
+ control the decompression process. It decodes motion data before
+ decoding each component of the picture.
+
+ \param decp decoder parameters
+ \param cf the chroma format of the picture being decompressed
+ */
+ PictureDecompressor(DecoderParams& decp, ChromaFormat cf);
+
+ //! Destructor
+ /*!
+ Releases resources.
+ */
+ ~PictureDecompressor();
+
+ //! Decompress the next picture into the buffer
+ /*!
+ Decompresses the next picture from the stream and place at the end
+ of a picture buffer.
+ Returns true if able to decode successfully, false otherwise
+
+ \param parseunit_byteio Picture info in Dirac-stream format
+ \param my_buffer picture buffer into which the picture is placed
+ */
+ bool Decompress(ParseUnitByteIO& parseunit_byteio,
+ PictureBuffer& my_buffer);
+
+ //! Returns the picture parameters of the current picture being decoded
+ const PictureParams& GetPicParams() const{ return m_pparams; }
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not be copied.
+
+ */
+ PictureDecompressor(const PictureDecompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+ */
+ PictureDecompressor& operator=(const PictureDecompressor& rhs);
+
+ //! Initialise the padded coefficient data for the IDWT and subband decoding
+ void InitCoeffData( CoeffArray& coeff_data, const int xl, const int yl );
+
+ //! Removes all the reference pictures in the retired list
+ void CleanReferencePictures( PictureBuffer& my_buffer );
+
+ //! Decodes component data
+ void CompDecompress(TransformByteIO *p_transform_byteio,
+ PictureBuffer& my_buffer,int pnum, CompSort cs);
+
+ //! Decodes the motion data
+ void DecompressMVData( std::auto_ptr<MvData>& mv_data, PictureByteIO& picture_byteio );
+
+
+ //! Set the number of superblocks and blocks
+ void SetMVBlocks();
+
+ //! Add a picture to the picture buffer
+ void PushPicture(PictureBuffer &my_buffer);
+
+ //Member variables
+
+ //! Parameters for the decompression, as provided in constructor
+ DecoderParams& m_decparams;
+
+ //! Chroma format of the picture being decompressed
+ ChromaFormat m_cformat;
+
+ //! An indicator which is true if the picture has been skipped, false otherwise
+ bool m_skipped;
+
+ //! An indicator that is true if we use global motion vectors, false otherwise
+ bool m_use_global;
+
+ //! An indicator that is true if we use block motion vectors, false otherwise
+ bool m_use_block_mv;
+
+ //! Prediction mode to use if we only have global motion vectors
+ PredMode m_global_pred_mode;
+
+ //! Current Picture Parameters
+ PictureParams m_pparams;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.cpp
index 79a8622ea..09421e934 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.cpp
@@ -53,25 +53,25 @@
#include <libdirac_byteio/accessunit_byteio.h>
using namespace dirac;
-SequenceDecompressor::SequenceDecompressor(ParseUnitByteIO& parseunit, bool verbosity)
- :
- m_all_done(false),
- m_current_code_pnum(0),
- m_delay(1),
- m_show_pnum(-1),
- m_highest_pnum(0)
+SequenceDecompressor::SequenceDecompressor(ParseUnitByteIO& parseunit,bool verbosity)
+:
+m_all_done(false),
+m_current_code_pnum(0),
+m_delay(1),
+m_show_pnum(-1),
+m_highest_pnum(0)
{
// read unit
NewAccessUnit(parseunit);
- if(m_decparams.FieldCoding())
+ if ( m_decparams.FieldCoding() )
m_delay = 2;
- m_decparams.SetVerbose(verbosity);
+ m_decparams.SetVerbose( verbosity );
- m_pbuffer = new PictureBuffer();
+ m_pbuffer= new PictureBuffer( );
- m_pdecoder = new PictureDecompressor(m_decparams , m_srcparams.CFormat());
+ m_pdecoder = new PictureDecompressor (m_decparams , m_srcparams.CFormat());
}
@@ -89,7 +89,7 @@ const PictureParams* SequenceDecompressor::GetNextPictureParams() const
void SequenceDecompressor::NewAccessUnit(ParseUnitByteIO& parseunit_byteio)
{
// read sequence header
- SequenceHeaderByteIO seqheader_byteio(parseunit_byteio, m_parse_params, m_srcparams, m_decparams);
+ SequenceHeaderByteIO seqheader_byteio(parseunit_byteio,m_parse_params, m_srcparams, m_decparams);
seqheader_byteio.Input();
}
@@ -103,38 +103,38 @@ const Picture* SequenceDecompressor::DecompressNextPicture(ParseUnitByteIO* p_pa
//the pictures out. It's up to the calling function to do something with the decoded pictures as they
//come out - write them to screen or to file, as required.
- TEST(m_pdecoder != NULL);
+ TEST (m_pdecoder != NULL);
// Remove the last displayed picture from the buffer if it wasn't a reference
- if(m_show_pnum > 0)
+ if ( m_show_pnum>0 )
{
- if(m_decparams.Verbose())
- std::cout << std::endl << "Cleaning display buffer: ";
- if(m_pbuffer->IsPictureAvail(m_show_pnum - 1) &&
- m_pbuffer->GetPicture(m_show_pnum - 1).GetPparams().PicSort().IsNonRef())
+ if ( m_decparams.Verbose() )
+ std::cout<<std::endl<<"Cleaning display buffer: ";
+ if ( m_pbuffer->IsPictureAvail(m_show_pnum-1) &&
+ m_pbuffer->GetPicture(m_show_pnum-1).GetPparams().PicSort().IsNonRef() )
{
- m_pbuffer->Remove(m_show_pnum - 1);
- if(m_decparams.Verbose())
- std::cout << (m_show_pnum - 1) << " ";
+ m_pbuffer->Remove(m_show_pnum-1);
+ if ( m_decparams.Verbose() )
+ std::cout<<(m_show_pnum-1)<<" ";
}
}
- bool new_picture_to_display = false;
+ bool new_picture_to_display=false;
- if(p_parseunit_byteio)
+ if (p_parseunit_byteio)
{
- if(m_decparams.Verbose())
- std::cout << std::endl << "Calling picture decompression function";
- new_picture_to_display = m_pdecoder->Decompress(*p_parseunit_byteio,
- *m_pbuffer);
+ if (m_decparams.Verbose())
+ std::cout<<std::endl<<"Calling picture decompression function";
+ new_picture_to_display = m_pdecoder->Decompress(*p_parseunit_byteio,
+ *m_pbuffer);
}
- if(m_show_pnum < 0 && new_picture_to_display == false)
+ if (m_show_pnum < 0 && new_picture_to_display == false)
return NULL;
- if(m_pbuffer->IsPictureAvail(m_show_pnum + 1))
+ if (m_pbuffer->IsPictureAvail(m_show_pnum+1 ))
++m_show_pnum;
- else if(new_picture_to_display && m_pdecoder->GetPicParams().PicSort().IsNonRef())
+ else if (new_picture_to_display && m_pdecoder->GetPicParams().PicSort().IsNonRef())
{
// if a decoded future non reference frame is available it implies
// that some frames have been skipped because of possible truncation
@@ -144,7 +144,7 @@ const Picture* SequenceDecompressor::DecompressNextPicture(ParseUnitByteIO* p_pa
m_highest_pnum = std::max(m_pdecoder->GetPicParams().PictureNum(), m_highest_pnum);
- if(m_pbuffer->IsPictureAvail(m_show_pnum))
+ if (m_pbuffer->IsPictureAvail(m_show_pnum))
return &m_pbuffer->GetPicture(m_show_pnum);
else
return NULL;
@@ -152,7 +152,7 @@ const Picture* SequenceDecompressor::DecompressNextPicture(ParseUnitByteIO* p_pa
const Picture* SequenceDecompressor::GetNextPicture()
{
- if(m_pbuffer->IsPictureAvail(m_show_pnum))
+ if (m_pbuffer->IsPictureAvail(m_show_pnum))
return &m_pbuffer->GetPicture(m_show_pnum);
else
return NULL;
@@ -160,10 +160,10 @@ const Picture* SequenceDecompressor::GetNextPicture()
bool SequenceDecompressor::Finished()
{
- if(m_show_pnum >= m_highest_pnum)
+ if (m_show_pnum>=m_highest_pnum)
return true;
- if(!m_pbuffer->IsPictureAvail(m_show_pnum + 1))
+ if (!m_pbuffer->IsPictureAvail(m_show_pnum+1 ))
++m_show_pnum;
return false;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.h
index 7dcc01a29..008ffc11d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_decoder/seq_decompress.h
@@ -54,146 +54,136 @@
namespace dirac
{
-class PictureBuffer;
-class Picture;
-class PictureDecompressor;
-
-//! Decompresses a sequence of pictures from a stream.
-/*!
- This class decompresses a sequence of frames, picture by picture.
-*/
-class SequenceDecompressor
-{
-public:
-
- //! Constructor
- /*!
- Initializes the decompressor with an input stream and level of
- output detail.
- \param parseunit First access-unit of new sequence
- \param verbosity when true, increases the amount of information displayed during decompression
- */
- SequenceDecompressor(ParseUnitByteIO& parseunit, bool verbosity);
-
- //! Destructor
- /*!
- Closes files and releases resources.
- */
- ~SequenceDecompressor();
-
- //! Marks beginning of a new AccessUnit
- /*!
- \param parseunit_byteio AccessUnit info in Dirac-stream format
- */
- void NewAccessUnit(ParseUnitByteIO& parseunit_byteio);
+ class PictureBuffer;
+ class Picture;
+ class PictureDecompressor;
-
- //! Decompress the next picture in sequence
- /*!
- This function decodes the next picture in coding order and returns
- the next picture in display order. In general these will differ, and
- because of re-ordering there is a delay which needs to be imposed.
- This creates problems at the start and at the end of the sequence
- which must be dealt with. At the start we just keep outputting
- picture 0. At the end you will need to loop for longer to get all
- the pictures out. It's up to the calling function to do something
- with the decoded pictures as they come out -- write them to screen
- or to file, as required.
-
- \param p_parseunit_byteio Picture information in Dirac-stream format
- \return reference to the next locally decoded picture available for display
- */
- const Picture* DecompressNextPicture(ParseUnitByteIO* p_parseunit_byteio);
-
- //! Get the next picture available for display
- const Picture* GetNextPicture();
-
- //! Get the next picture parameters
- const PictureParams* GetNextPictureParams() const;
- //! Determine if decompression is complete.
- /*!
- Indicates whether or not the last picture in the sequence has been
- decompressed.
- \return true if last picture has been compressed; false if not
- */
- bool Finished();
- //! Interrogates for parse parameters.
+ //! Decompresses a sequence of pictures from a stream.
/*!
- Returns the parse parameters used for this decompression run.
-
- \return parse parameters.
- */
- ParseParams & GetParseParams()
- {
- return m_parse_params;
- }
-
-
- //! Interrogates for source parameters.
- /*!
- Returns the source parameters used for this decompression run.
-
- \return source parameters.
- */
- SourceParams & GetSourceParams()
- {
- return m_srcparams;
- }
-
-
- //! Interrogates for coding parameters.
- /*!
- Returns the decoder parameters used for this decompression run.
-
- \return decoder parameters.
- */
- DecoderParams & GetDecoderParams()
- {
- return m_decparams;
- }
-private:
- //! Copy constructor is private and body-less
- /*!
- Copy constructor is private and body-less. This class should not
- be copied.
-
- */
- SequenceDecompressor(const SequenceDecompressor& cpy);
-
- //! Assignment = is private and body-less
- /*!
- Assignment = is private and body-less. This class should not be
- assigned.
-
+ This class decompresses a sequence of frames, picture by picture.
*/
- SequenceDecompressor& operator=(const SequenceDecompressor& rhs);
-
-
- //Member variables
-
- //! Completion flag, returned via the Finished method
- bool m_all_done;
- //! Parameters for the decompression, as provided in constructor
- DecoderParams m_decparams;
- //! The parse parameters obtained from the stream header
- ParseParams m_parse_params;
- //! The source parameters obtained from the stream header
- SourceParams m_srcparams;
- //! A picture buffer used for local storage of pictures whilst pending re-ordering or being used for reference.
- PictureBuffer* m_pbuffer;
- //! Number of the picture in coded order which is to be decoded
- int m_current_code_pnum;
- //! A delay so that we don't display what we haven't decoded
- int m_delay;
- //! Index, in display order, of the last picture read
- int m_last_picture_read;
- //! Index, in display order of the picture to be displayed next - computed from delay and current_code_pnum
- int m_show_pnum;
- //! Picture decompressor object
- PictureDecompressor *m_pdecoder;
- //! Highest picture-num processed - for tracking end-of-sequence
- int m_highest_pnum;
-};
+ class SequenceDecompressor{
+ public:
+
+ //! Constructor
+ /*!
+ Initializes the decompressor with an input stream and level of
+ output detail.
+ \param parseunit First access-unit of new sequence
+ \param verbosity when true, increases the amount of information displayed during decompression
+ */
+ SequenceDecompressor(ParseUnitByteIO& parseunit, bool verbosity);
+
+ //! Destructor
+ /*!
+ Closes files and releases resources.
+ */
+ ~SequenceDecompressor();
+
+ //! Marks beginning of a new AccessUnit
+ /*!
+ \param parseunit_byteio AccessUnit info in Dirac-stream format
+ */
+ void NewAccessUnit(ParseUnitByteIO& parseunit_byteio);
+
+
+ //! Decompress the next picture in sequence
+ /*!
+ This function decodes the next picture in coding order and returns
+ the next picture in display order. In general these will differ, and
+ because of re-ordering there is a delay which needs to be imposed.
+ This creates problems at the start and at the end of the sequence
+ which must be dealt with. At the start we just keep outputting
+ picture 0. At the end you will need to loop for longer to get all
+ the pictures out. It's up to the calling function to do something
+ with the decoded pictures as they come out -- write them to screen
+ or to file, as required.
+
+ \param p_parseunit_byteio Picture information in Dirac-stream format
+ \return reference to the next locally decoded picture available for display
+ */
+ const Picture* DecompressNextPicture(ParseUnitByteIO* p_parseunit_byteio);
+
+ //! Get the next picture available for display
+ const Picture* GetNextPicture();
+
+ //! Get the next picture parameters
+ const PictureParams* GetNextPictureParams() const;
+ //! Determine if decompression is complete.
+ /*!
+ Indicates whether or not the last picture in the sequence has been
+ decompressed.
+ \return true if last picture has been compressed; false if not
+ */
+ bool Finished();
+ //! Interrogates for parse parameters.
+ /*!
+ Returns the parse parameters used for this decompression run.
+
+ \return parse parameters.
+ */
+ ParseParams & GetParseParams() { return m_parse_params; }
+
+
+ //! Interrogates for source parameters.
+ /*!
+ Returns the source parameters used for this decompression run.
+
+ \return source parameters.
+ */
+ SourceParams & GetSourceParams() { return m_srcparams; }
+
+
+ //! Interrogates for coding parameters.
+ /*!
+ Returns the decoder parameters used for this decompression run.
+
+ \return decoder parameters.
+ */
+ DecoderParams & GetDecoderParams() { return m_decparams; }
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+
+ */
+ SequenceDecompressor(const SequenceDecompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+
+ */
+ SequenceDecompressor& operator=(const SequenceDecompressor& rhs);
+
+
+ //Member variables
+
+ //! Completion flag, returned via the Finished method
+ bool m_all_done;
+ //! Parameters for the decompression, as provided in constructor
+ DecoderParams m_decparams;
+ //! The parse parameters obtained from the stream header
+ ParseParams m_parse_params;
+ //! The source parameters obtained from the stream header
+ SourceParams m_srcparams;
+ //! A picture buffer used for local storage of pictures whilst pending re-ordering or being used for reference.
+ PictureBuffer* m_pbuffer;
+ //! Number of the picture in coded order which is to be decoded
+ int m_current_code_pnum;
+ //! A delay so that we don't display what we haven't decoded
+ int m_delay;
+ //! Index, in display order, of the last picture read
+ int m_last_picture_read;
+ //! Index, in display order of the picture to be displayed next - computed from delay and current_code_pnum
+ int m_show_pnum;
+ //! Picture decompressor object
+ PictureDecompressor *m_pdecoder;
+ //! Highest picture-num processed - for tracking end-of-sequence
+ int m_highest_pnum;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.cpp
index da11d012f..07762d7ec 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.cpp
@@ -55,55 +55,54 @@ using namespace dirac;
#include <vector>
#include <iostream>
-CompCompressor::CompCompressor(EncoderParams& encp, const PictureParams& pp)
- : m_encparams(encp),
- m_pparams(pp),
- m_psort(m_pparams.PicSort()),
- m_cformat(m_pparams.CFormat())
+CompCompressor::CompCompressor( EncoderParams& encp,const PictureParams& pp)
+: m_encparams(encp),
+ m_pparams(pp),
+ m_psort( m_pparams.PicSort() ),
+ m_cformat( m_pparams.CFormat() )
{}
-ComponentByteIO* CompCompressor::Compress(CoeffArray& coeff_data ,
- SubbandList& bands,
- CompSort csort,
- const OneDArray<unsigned int>& estimated_bits)
+ComponentByteIO* CompCompressor::Compress( CoeffArray& coeff_data ,
+ SubbandList& bands,
+ CompSort csort,
+ const OneDArray<unsigned int>& estimated_bits)
{
// Need to transform, select quantisers for each band,
// and then compress each component in turn
- unsigned int num_band_bytes(0);
+ unsigned int num_band_bytes( 0 );
// create byte output
ComponentByteIO *p_component_byteio = new ComponentByteIO(csort);
// Loop over all the bands (from DC to HF) quantising and coding them
- for(int b = bands.Length() ; b >= 1 ; --b)
+ for (int b=bands.Length() ; b>=1 ; --b )
{
// create subband byte io
SubbandByteIO subband_byteio(bands(b));
- if(!bands(b).Skipped())
- {
- // If not skipped ...
- if(m_pparams.UsingAC())
+ if ( !bands(b).Skipped() )
+ { // If not skipped ...
+ if (m_pparams.UsingAC())
{
// A pointer to an object for coding the subband data
BandCodec* bcoder;
- // Pick the right codec according to the picture type and subband
- if(b >= bands.Length() - 3)
+ // Pick the right codec according to the picture type and subband
+ if (b >= bands.Length()-3)
{
- if(m_psort.IsIntra() && b == bands.Length())
- bcoder = new IntraDCBandCodec(&subband_byteio,
- TOTAL_COEFF_CTXS , bands);
+ if ( m_psort.IsIntra() && b == bands.Length() )
+ bcoder=new IntraDCBandCodec(&subband_byteio,
+ TOTAL_COEFF_CTXS , bands );
else
- bcoder = new LFBandCodec(&subband_byteio , TOTAL_COEFF_CTXS,
- bands , b, m_psort.IsIntra());
+ bcoder=new LFBandCodec(&subband_byteio ,TOTAL_COEFF_CTXS,
+ bands , b, m_psort.IsIntra());
}
else
- bcoder = new BandCodec(&subband_byteio , TOTAL_COEFF_CTXS ,
- bands , b, m_psort.IsIntra());
+ bcoder=new BandCodec(&subband_byteio , TOTAL_COEFF_CTXS ,
+ bands , b, m_psort.IsIntra() );
num_band_bytes = bcoder->Compress(coeff_data);
@@ -115,28 +114,27 @@ ComponentByteIO* CompCompressor::Compress(CoeffArray& coeff_data ,
// A pointer to an object for coding the subband data
BandVLC* bcoder;
- if(m_psort.IsIntra() && b == bands.Length())
- bcoder = new IntraDCBandVLC(&subband_byteio, bands);
+ if ( m_psort.IsIntra() && b == bands.Length() )
+ bcoder=new IntraDCBandVLC(&subband_byteio, bands );
else
- bcoder = new BandVLC(&subband_byteio , 0, bands , b,
- m_psort.IsIntra());
+ bcoder=new BandVLC(&subband_byteio , 0, bands , b,
+ m_psort.IsIntra() );
num_band_bytes = bcoder->Compress(coeff_data);
delete bcoder;
}
- // Update the entropy correction factors
- m_encparams.EntropyFactors().Update(b , m_pparams , csort ,
- estimated_bits[b] , 8 * num_band_bytes);
+ // Update the entropy correction factors
+ m_encparams.EntropyFactors().Update(b , m_pparams , csort ,
+ estimated_bits[b] , 8*num_band_bytes);
}
else
- {
- // ... skipped
- SetToVal(coeff_data , bands(b) , 0);
+ { // ... skipped
+ SetToVal( coeff_data , bands(b) , 0 );
}
- // output sub-band data
- p_component_byteio->AddSubband(&subband_byteio);
+ // output sub-band data
+ p_component_byteio->AddSubband(&subband_byteio);
}//b
@@ -144,12 +142,12 @@ ComponentByteIO* CompCompressor::Compress(CoeffArray& coeff_data ,
return p_component_byteio;
}
-void CompCompressor::SetToVal(CoeffArray& coeff_data, const Subband& node, ValueType val)
+void CompCompressor::SetToVal(CoeffArray& coeff_data,const Subband& node,ValueType val)
{
- for(int j = node.Yp() ; j < node.Yp() + node.Yl() ; ++j)
+ for (int j=node.Yp() ; j<node.Yp() + node.Yl() ; ++j)
{
- for(int i = node.Xp(); i < node.Xp() + node.Xl() ; ++i)
+ for (int i=node.Xp(); i<node.Xp() + node.Xl() ; ++i)
{
coeff_data[j][i] = val;
}// i
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.h
index 025531d30..e21150904 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/comp_compress.h
@@ -47,65 +47,65 @@
namespace dirac
{
-class MEData;
-
-//! Compress a picture component
-/*!
- This class compresses one of the three components (Y, U, or V) of a
- picture according to a given set or parameters. CompCompressor is used
- by PictureCompressor.
-*/
-class CompCompressor
-{
-public:
- //! Constructor
- /*!
- Create and initialize a component compressor with the given
- characteristics.
- \param encp encoding parameters
- \param fp picture parameters
- */
- CompCompressor(EncoderParams & encp, const PictureParams& fp);
-
+ class MEData;
+
//! Compress a picture component
/*!
- Compress a PicArray containing a picture component (Y, U, or V).
- \param coeff_data the component data to be compressed
- \param bands Subbands list
- \param csort Chroma format
- \param estimated_bits the list of estimated number of bits in each subband
- \return Picture-component in Dirac-bytestream format
+ This class compresses one of the three components (Y, U, or V) of a
+ picture according to a given set or parameters. CompCompressor is used
+ by PictureCompressor.
*/
- ComponentByteIO* Compress(CoeffArray& coeff_data ,
- SubbandList& bands,
- CompSort csort,
- const OneDArray<unsigned int>& estimated_bits);
-
-private:
- //! Copy constructor is private and body-less. This class should not be copied.
- CompCompressor(const CompCompressor& cpy);
-
- //! Assignment = is private and body-less. This class should not be assigned.
- CompCompressor& operator=(const CompCompressor& rhs);
-
- //! Set a subband to a constant value
- void SetToVal(CoeffArray& coeff_data, const Subband& node, ValueType val);
-
-
-private:
-
- // member variables
- EncoderParams& m_encparams;
-
- const PictureParams& m_pparams;
-
- const PictureSort& m_psort;
-
- const ChromaFormat& m_cformat;
-
- float m_lambda;
-
-};
+ class CompCompressor
+ {
+ public:
+ //! Constructor
+ /*!
+ Create and initialize a component compressor with the given
+ characteristics.
+ \param encp encoding parameters
+ \param fp picture parameters
+ */
+ CompCompressor( EncoderParams & encp, const PictureParams& fp);
+
+ //! Compress a picture component
+ /*!
+ Compress a PicArray containing a picture component (Y, U, or V).
+ \param coeff_data the component data to be compressed
+ \param bands Subbands list
+ \param csort Chroma format
+ \param estimated_bits the list of estimated number of bits in each subband
+ \return Picture-component in Dirac-bytestream format
+ */
+ ComponentByteIO* Compress( CoeffArray& coeff_data ,
+ SubbandList& bands,
+ CompSort csort,
+ const OneDArray<unsigned int>& estimated_bits);
+
+ private:
+ //! Copy constructor is private and body-less. This class should not be copied.
+ CompCompressor(const CompCompressor& cpy);
+
+ //! Assignment = is private and body-less. This class should not be assigned.
+ CompCompressor& operator=(const CompCompressor& rhs);
+
+ //! Set a subband to a constant value
+ void SetToVal(CoeffArray& coeff_data,const Subband& node,ValueType val);
+
+
+ private:
+
+ // member variables
+ EncoderParams& m_encparams;
+
+ const PictureParams& m_pparams;
+
+ const PictureSort& m_psort;
+
+ const ChromaFormat& m_cformat;
+
+ float m_lambda;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.cpp
index 7ca501460..09ba3f570 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.cpp
@@ -57,23 +57,23 @@ using namespace dirac;
using namespace std;
template <class T, class S >
-void copy_2dArray(const TwoDArray<T> & in, S *out)
+void copy_2dArray (const TwoDArray<T> & in, S *out)
{
- for(int j = 0 ; j < in.LengthY() ; ++j)
+ for (int j=0 ; j<in.LengthY() ; ++j)
{
- for(int i = 0 ; i < in.LengthX() ; ++i)
+ for (int i=0 ; i<in.LengthX() ; ++i)
{
// out[j*in.LengthX() + i] = in[j][i];
- *out++ = S(in[j][i]);
+ *out++ = S( in[j][i] );
}// i
}// j
}
-void copy_2dArray(const TwoDArray<PredMode> & in, int *out)
+void copy_2dArray (const TwoDArray<PredMode> & in, int *out)
{
- for(int j = 0 ; j < in.LengthY() ; ++j)
+ for (int j=0 ; j<in.LengthY() ; ++j)
{
- for(int i = 0 ; i < in.LengthX() ; ++i)
+ for (int i=0 ; i<in.LengthX() ; ++i)
{
// out[j*in.LengthX() + i] = in[j][i];
*out++ = in[j][i];
@@ -81,11 +81,11 @@ void copy_2dArray(const TwoDArray<PredMode> & in, int *out)
}// j
}
-void copy_2dArray(const TwoDArray<bool> & in, int *out)
+void copy_2dArray (const TwoDArray<bool> & in, int *out)
{
- for(int j = 0 ; j < in.LengthY() ; ++j)
+ for (int j=0 ; j<in.LengthY() ; ++j)
{
- for(int i = 0 ; i < in.LengthX() ; ++i)
+ for (int i=0 ; i<in.LengthX() ; ++i)
{
// out[j*in.LengthX() + i] = in[j][i];
*out++ = in[j][i];
@@ -93,11 +93,11 @@ void copy_2dArray(const TwoDArray<bool> & in, int *out)
}// j
}
-void copy_mv(const MvArray& mv, dirac_mv_t *dmv)
+void copy_mv ( const MvArray& mv, dirac_mv_t *dmv)
{
- for(int j = 0 ; j < mv.LengthY() ; ++j)
+ for (int j=0 ; j<mv.LengthY() ; ++j)
{
- for(int i = 0 ; i < mv.LengthX() ; ++i)
+ for (int i=0 ; i<mv.LengthX() ; ++i)
{
//dmv[j*mv.LengthX() + i].x = mv[j][i].x;
//dmv[j*mv.LengthX() + i].y = mv[j][i].y;
@@ -108,11 +108,11 @@ void copy_mv(const MvArray& mv, dirac_mv_t *dmv)
}// j
}
-void copy_mv_cost(const TwoDArray<MvCostData> &pc, dirac_mv_cost_t *dpc)
+void copy_mv_cost (const TwoDArray<MvCostData> &pc, dirac_mv_cost_t *dpc)
{
- for(int j = 0 ; j < pc.LengthY() ; ++j)
+ for (int j=0 ; j<pc.LengthY() ; ++j)
{
- for(int i = 0 ; i < pc.LengthX() ; ++i)
+ for (int i=0 ; i<pc.LengthX() ; ++i)
{
//dpc[j*pc.LengthX() + i].SAD = pc[j][i].SAD;
//dpc[j*pc.LengthX() + i].mvcost = pc[j][i].mvcost;
@@ -129,41 +129,41 @@ void copy_mv_cost(const TwoDArray<MvCostData> &pc, dirac_mv_cost_t *dpc)
void alloc_instr_data(dirac_instr_t *instr)
{
instr->sb_split_mode = new int [instr->sb_ylen*instr->sb_xlen];
- memset(instr->sb_split_mode, 0, sizeof(int)*instr->sb_ylen * instr->sb_xlen);
+ memset (instr->sb_split_mode, 0, sizeof(int)*instr->sb_ylen*instr->sb_xlen);
instr->sb_costs = new float [instr->sb_ylen*instr->sb_xlen];
- memset(instr->sb_costs, 0, sizeof(float)*instr->sb_ylen * instr->sb_xlen);
+ memset (instr->sb_costs, 0, sizeof(float)*instr->sb_ylen*instr->sb_xlen);
instr->pred_mode = new int [instr->mv_ylen * instr->mv_xlen];
- memset(instr->pred_mode, 0, sizeof(int)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->pred_mode, 0, sizeof(int)*instr->mv_ylen*instr->mv_xlen);
instr->intra_costs = new float [instr->mv_ylen * instr->mv_xlen];
- memset(instr->intra_costs, 0, sizeof(float)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->intra_costs, 0, sizeof(float)*instr->mv_ylen*instr->mv_xlen);
instr->bipred_costs = new dirac_mv_cost_t [instr->mv_ylen * instr->mv_xlen];
- memset(instr->bipred_costs, 0, sizeof(dirac_mv_cost_t)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->bipred_costs, 0, sizeof(dirac_mv_cost_t)*instr->mv_ylen*instr->mv_xlen);
instr->dc_ycomp = new short [instr->mv_ylen * instr->mv_xlen];
- memset(instr->dc_ycomp, 0, sizeof(short)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->dc_ycomp, 0, sizeof(short)*instr->mv_ylen*instr->mv_xlen);
instr->dc_ucomp = new short [instr->mv_ylen * instr->mv_xlen];
- memset(instr->dc_ucomp, 0, sizeof(short)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->dc_ucomp, 0, sizeof(short)*instr->mv_ylen*instr->mv_xlen);
instr->dc_vcomp = new short [instr->mv_ylen * instr->mv_xlen];
- memset(instr->dc_vcomp, 0, sizeof(short)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->dc_vcomp, 0, sizeof(short)*instr->mv_ylen*instr->mv_xlen);
- for(int i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
instr->mv[i] = new dirac_mv_t[instr->mv_ylen * instr->mv_xlen];
- memset(instr->mv[i], 0,
- sizeof(dirac_mv_t)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->mv[i], 0,
+ sizeof(dirac_mv_t)*instr->mv_ylen*instr->mv_xlen);
}
- for(int i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
instr->pred_costs[i] = new dirac_mv_cost_t[instr->mv_ylen * instr->mv_xlen];
- memset(instr->pred_costs[i], 0,
- sizeof(dirac_mv_cost_t)*instr->mv_ylen * instr->mv_xlen);
+ memset (instr->pred_costs[i], 0,
+ sizeof(dirac_mv_cost_t)*instr->mv_ylen*instr->mv_xlen);
}
}
@@ -172,38 +172,38 @@ void alloc_instr_data(dirac_instr_t *instr)
*/
void dealloc_instr_data(dirac_instr_t *instr)
{
- if(instr->sb_split_mode)
+ if (instr->sb_split_mode)
delete [] instr->sb_split_mode;
- if(instr->sb_costs)
+ if (instr->sb_costs)
delete [] instr->sb_costs;
- if(instr->pred_mode)
+ if (instr->pred_mode)
delete [] instr->pred_mode;
- if(instr->intra_costs)
+ if (instr->intra_costs)
delete [] instr->intra_costs;
- if(instr->bipred_costs)
+ if (instr->bipred_costs)
delete [] instr->bipred_costs;
- if(instr->dc_ycomp)
+ if (instr->dc_ycomp)
delete [] instr->dc_ycomp;
- if(instr->dc_ucomp)
+ if (instr->dc_ucomp)
delete [] instr->dc_ucomp;
- if(instr->dc_vcomp)
+ if (instr->dc_vcomp)
delete [] instr->dc_vcomp;
- for(int i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
- if(instr->mv[i])
+ if (instr->mv[i])
delete [] instr->mv[i];
}
- for(int i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
- if(instr->pred_costs[i])
+ if (instr->pred_costs[i])
delete [] instr->pred_costs[i];
}
}
@@ -229,55 +229,39 @@ public:
int GetEncodedData(dirac_encoder_t *encoder);
// Set the locally decoded frame data in encoder
- int GetDecodedData(dirac_encoder_t *encoder);
+ int GetDecodedData (dirac_encoder_t *encoder);
// Set the instrumentation data in encoder
- void GetInstrumentationData(dirac_encoder_t *encoder);
+ void GetInstrumentationData (dirac_encoder_t *encoder);
// Set the end of sequence infomration in encoder
int GetSequenceEnd(dirac_encoder_t *encoder);
// Set the buffer to hold the locally decoded frame
- void SetDecodeBuffer(unsigned char *buffer, int buffer_size);
+ void SetDecodeBuffer (unsigned char *buffer, int buffer_size);
// Return the encoder parameters
- const EncoderParams& GetEncParams() const
- {
- return m_encparams;
- }
+ const EncoderParams& GetEncParams() const { return m_encparams; }
// Return the source parameters
- const SourceParams& GetSrcParams() const
- {
- return m_srcparams;
- }
+ const SourceParams& GetSrcParams() const { return m_srcparams; }
// Return the pts offset
- int GetPTSOffset() const
- {
- return m_seqcomp->PTSOffset();
- }
+ int GetPTSOffset() const { return m_seqcomp->PTSOffset(); }
// Signal End of Sequence
- void SignalEOS()
- {
- m_eos_signalled = true;
- m_seqcomp->SignalEOS();
- }
+ void SignalEOS() { m_eos_signalled = true; m_seqcomp->SignalEOS(); }
// End of Sequence
- bool EOS()
- {
- return m_eos_signalled == true;
- }
+ bool EOS() { return m_eos_signalled == true; }
private:
// Set the encoder parameters
- void SetEncoderParams(const dirac_encoder_context_t *enc_ctx);
+ void SetEncoderParams (const dirac_encoder_context_t *enc_ctx);
// Set the source parameters
- void SetSourceParams(const dirac_encoder_context_t *enc_ctx);
+ void SetSourceParams (const dirac_encoder_context_t *enc_ctx);
// Get the picture statistics
void GetPictureStats(dirac_encoder_t *encoder);
@@ -327,7 +311,7 @@ private:
// Output destination for compressed data in bitstream format
DiracByteStream m_dirac_byte_stream;
- //Rate Control parameters
+ //Rate Control parameters
// Total Number of bits for a GOP
int m_gop_bits;
@@ -351,13 +335,13 @@ private:
SequenceCompressor constructor. It is called by the
FrameCompressor::Compress function once the frame is successfully compressed
*/
-void DiracEncoder::GetInstrumentationData(dirac_encoder_t *encoder)
+void DiracEncoder::GetInstrumentationData (dirac_encoder_t *encoder)
{
- ASSERT(encoder != NULL);
+ ASSERT (encoder != NULL);
dirac_instr_t *instr = &encoder->instr;
dirac_instr_t old_instr = *instr;
- if(!m_return_instr_data || m_enc_picture == NULL)
+ if (!m_return_instr_data || m_enc_picture == NULL)
return;
const PictureParams& pparams = m_enc_picture->GetPparams();
@@ -369,19 +353,19 @@ void DiracEncoder::GetInstrumentationData(dirac_encoder_t *encoder)
instr->num_refs = 0;
encoder->instr_data_avail = 1;
- if(psort.IsIntra())
+ if (psort.IsIntra())
{
// no MV data for Intra coded data
return;
}
- TESTM(m_enc_medata != NULL, "ME data available");
+ TESTM (m_enc_medata != NULL, "ME data available");
// Reference info
instr->num_refs = pparams.Refs().size();
- ASSERTM(instr->num_refs <= 2, "Max # reference frames is 2");
+ ASSERTM (instr->num_refs <= 2, "Max # reference frames is 2");
- for(int i = 0; i < instr->num_refs; ++i)
+ for (int i=0; i<instr->num_refs; ++i)
instr->refs[i] = pparams.Refs()[i];
// Block separation params
@@ -396,36 +380,36 @@ void DiracEncoder::GetInstrumentationData(dirac_encoder_t *encoder)
instr->mv_ylen = m_enc_medata->Vectors(1).LengthY();
instr->mv_xlen = m_enc_medata->Vectors(1).LengthX();
- if(old_instr.sb_ylen != instr->sb_ylen ||
- old_instr.sb_xlen != instr->sb_xlen ||
- old_instr.mv_ylen != instr->mv_ylen ||
- old_instr.mv_xlen != instr->mv_xlen)
+ if (old_instr.sb_ylen != instr->sb_ylen ||
+ old_instr.sb_xlen != instr->sb_xlen ||
+ old_instr.mv_ylen != instr->mv_ylen ||
+ old_instr.mv_xlen != instr->mv_xlen)
{
dealloc_instr_data(instr);
alloc_instr_data(instr);
}
- copy_2dArray(m_enc_medata->SBSplit(), instr->sb_split_mode);
- copy_2dArray(m_enc_medata->SBCosts(), instr->sb_costs);
- copy_2dArray(m_enc_medata->Mode(), instr->pred_mode);
- copy_2dArray(m_enc_medata->IntraCosts(), instr->intra_costs);
+ copy_2dArray (m_enc_medata->SBSplit(), instr->sb_split_mode);
+ copy_2dArray (m_enc_medata->SBCosts(), instr->sb_costs);
+ copy_2dArray (m_enc_medata->Mode(), instr->pred_mode);
+ copy_2dArray (m_enc_medata->IntraCosts(), instr->intra_costs);
- if(instr->num_refs > 1)
+ if (instr->num_refs > 1)
{
- copy_mv_cost(m_enc_medata->BiPredCosts(), instr->bipred_costs);
+ copy_mv_cost (m_enc_medata->BiPredCosts(), instr->bipred_costs);
}
- copy_2dArray(m_enc_medata->DC(Y_COMP), instr->dc_ycomp);
- if(m_enc_medata->DC().Length() == 3)
+ copy_2dArray (m_enc_medata->DC( Y_COMP ), instr->dc_ycomp);
+ if (m_enc_medata->DC().Length() == 3)
{
- copy_2dArray(m_enc_medata->DC(U_COMP), instr->dc_ucomp);
- copy_2dArray(m_enc_medata->DC(V_COMP), instr->dc_vcomp);
+ copy_2dArray (m_enc_medata->DC( U_COMP ), instr->dc_ucomp);
+ copy_2dArray (m_enc_medata->DC( V_COMP ), instr->dc_vcomp);
}
- for(int i = 1; i <= instr->num_refs; ++i)
+ for (int i=1; i<=instr->num_refs; ++i)
{
- copy_mv(m_enc_medata->Vectors(i), instr->mv[i-1]);
- copy_mv_cost(m_enc_medata->PredCosts(i), instr->pred_costs[i-1]);
+ copy_mv (m_enc_medata->Vectors(i), instr->mv[i-1]);
+ copy_mv_cost (m_enc_medata->PredCosts(i), instr->pred_costs[i-1]);
}
}
@@ -441,16 +425,16 @@ DiracEncoder::DiracEncoder(const dirac_encoder_context_t *enc_ctx,
m_dec_bufsize(0),
m_return_decoded_pictures(enc_ctx->decode_flag > 0),
m_return_instr_data(enc_ctx->instr_flag > 0),
- m_gop_bits(0),
+ m_gop_bits(0),
m_gop_count(0),
m_picture_count(0),
m_eos_signalled(false)
{
// Setup source parameters
- SetSourceParams(enc_ctx);
+ SetSourceParams (enc_ctx);
// Setup encoder parameters
- m_encparams.SetVerbose(verbose);
- SetEncoderParams(enc_ctx);
+ m_encparams.SetVerbose( verbose );
+ SetEncoderParams (enc_ctx);
// Set up the input data stream (uncompressed data)
m_inp_ptr = new MemoryStreamInput(m_srcparams, m_encparams.FieldCoding());
@@ -458,17 +442,17 @@ DiracEncoder::DiracEncoder(const dirac_encoder_context_t *enc_ctx,
m_out_ptr = new MemoryStreamOutput(m_srcparams, m_encparams.FieldCoding());
// initialise the sequence compressor
- if(!m_encparams.FieldCoding())
+ if (!m_encparams.FieldCoding())
{
- m_seqcomp = new FrameSequenceCompressor(m_inp_ptr->GetStream(), m_encparams, m_dirac_byte_stream);
+ m_seqcomp = new FrameSequenceCompressor (m_inp_ptr->GetStream(), m_encparams, m_dirac_byte_stream);
}
else
{
- m_seqcomp = new FieldSequenceCompressor(m_inp_ptr->GetStream(), m_encparams, m_dirac_byte_stream);
+ m_seqcomp = new FieldSequenceCompressor (m_inp_ptr->GetStream(), m_encparams, m_dirac_byte_stream);
}
}
-void DiracEncoder::SetDecodeBuffer(unsigned char *buffer, int buffer_size)
+void DiracEncoder::SetDecodeBuffer (unsigned char *buffer, int buffer_size)
{
m_dec_buf = buffer;
m_dec_bufsize = buffer_size;
@@ -482,29 +466,29 @@ DiracEncoder::~DiracEncoder()
delete m_out_ptr;
}
-void DiracEncoder::SetSourceParams(const dirac_encoder_context_t *enc_ctx)
+void DiracEncoder::SetSourceParams (const dirac_encoder_context_t *enc_ctx)
{
- m_srcparams.SetCFormat(enc_ctx->src_params.chroma);
- m_srcparams.SetXl(enc_ctx->src_params.width);
- m_srcparams.SetYl(enc_ctx->src_params.height);
-
- m_srcparams.SetCleanWidth(m_srcparams.Xl());
- m_srcparams.SetCleanHeight(m_srcparams.Yl());
- m_srcparams.SetLeftOffset(0);
- m_srcparams.SetTopOffset(0);
-
- m_srcparams.SetSourceSampling(enc_ctx->src_params.source_sampling);
- if(m_srcparams.FrameRate().m_num != (unsigned int)enc_ctx->src_params.frame_rate.numerator ||
- m_srcparams.FrameRate().m_denom != (unsigned int)enc_ctx->src_params.frame_rate.denominator)
+ m_srcparams.SetCFormat( enc_ctx->src_params.chroma );
+ m_srcparams.SetXl( enc_ctx->src_params.width );
+ m_srcparams.SetYl( enc_ctx->src_params.height );
+
+ m_srcparams.SetCleanWidth( m_srcparams.Xl() );
+ m_srcparams.SetCleanHeight( m_srcparams.Yl() );
+ m_srcparams.SetLeftOffset( 0 );
+ m_srcparams.SetTopOffset( 0 );
+
+ m_srcparams.SetSourceSampling( enc_ctx->src_params.source_sampling );
+ if (m_srcparams.FrameRate().m_num != (unsigned int)enc_ctx->src_params.frame_rate.numerator ||
+ m_srcparams.FrameRate().m_denom != (unsigned int)enc_ctx->src_params.frame_rate.denominator)
{
- m_srcparams.SetFrameRate(enc_ctx->src_params.frame_rate.numerator,
- enc_ctx->src_params.frame_rate.denominator);
+ m_srcparams.SetFrameRate( enc_ctx->src_params.frame_rate.numerator,
+ enc_ctx->src_params.frame_rate.denominator );
}
- if(m_srcparams.PixelAspectRatio().m_num != (unsigned int)enc_ctx->src_params.pix_asr.numerator ||
- m_srcparams.PixelAspectRatio().m_denom != (unsigned int)enc_ctx->src_params.pix_asr.denominator)
+ if (m_srcparams.PixelAspectRatio().m_num != (unsigned int)enc_ctx->src_params.pix_asr.numerator ||
+ m_srcparams.PixelAspectRatio().m_denom != (unsigned int)enc_ctx->src_params.pix_asr.denominator)
{
- m_srcparams.SetPixelAspectRatio(enc_ctx->src_params.pix_asr.numerator,
- enc_ctx->src_params.pix_asr.denominator);
+ m_srcparams.SetPixelAspectRatio( enc_ctx->src_params.pix_asr.numerator,
+ enc_ctx->src_params.pix_asr.denominator );
}
// TO DO: CLEAN AREA and signal range
// FIXME: Dirac currently support 8BIT_VIDEO only. Accept from command line
@@ -513,18 +497,18 @@ void DiracEncoder::SetSourceParams(const dirac_encoder_context_t *enc_ctx)
}
-void DiracEncoder::SetEncoderParams(const dirac_encoder_context_t *enc_ctx)
+void DiracEncoder::SetEncoderParams (const dirac_encoder_context_t *enc_ctx)
{
- TEST(enc_ctx != NULL);
+ TEST (enc_ctx != NULL);
OLBParams bparams(12, 12, 8, 8);
m_encparams.SetLocalDecode(enc_ctx->decode_flag);
- m_encparams.SetXl(enc_ctx->src_params.width);
- m_encparams.SetYl(enc_ctx->src_params.height);
- m_encparams.SetChromaXl(enc_ctx->src_params.chroma_width);
- m_encparams.SetChromaYl(enc_ctx->src_params.chroma_height);
+ m_encparams.SetXl( enc_ctx->src_params.width );
+ m_encparams.SetYl( enc_ctx->src_params.height );
+ m_encparams.SetChromaXl( enc_ctx->src_params.chroma_width );
+ m_encparams.SetChromaYl( enc_ctx->src_params.chroma_height );
- if(enc_ctx->enc_params.picture_coding_mode > 1)
+ if (enc_ctx->enc_params.picture_coding_mode > 1)
{
std::ostringstream errstr;
@@ -538,19 +522,19 @@ void DiracEncoder::SetEncoderParams(const dirac_encoder_context_t *enc_ctx)
}
m_encparams.SetPictureCodingMode(enc_ctx->enc_params.picture_coding_mode);
- if(m_encparams.FieldCoding())
+ if (m_encparams.FieldCoding())
{
// Change coding dimensions to field dimensions
- m_encparams.SetYl(enc_ctx->src_params.height >> 1);
- m_encparams.SetChromaYl(enc_ctx->src_params.chroma_height >> 1);
+ m_encparams.SetYl( enc_ctx->src_params.height>>1 );
+ m_encparams.SetChromaYl( enc_ctx->src_params.chroma_height >> 1);
}
- unsigned int luma_depth = static_cast<unsigned int>(
- std::log((double)m_srcparams.LumaExcursion()) / std::log(2.0) + 1);
+ unsigned int luma_depth = static_cast<unsigned int> (
+ std::log((double)m_srcparams.LumaExcursion())/std::log(2.0) + 1 );
m_encparams.SetLumaDepth(luma_depth);
- unsigned int chroma_depth = static_cast<unsigned int>(
- std::log((double)m_srcparams.ChromaExcursion()) / std::log(2.0) + 1);
+ unsigned int chroma_depth = static_cast<unsigned int> (
+ std::log((double)m_srcparams.ChromaExcursion())/std::log(2.0) + 1 );
m_encparams.SetChromaDepth(chroma_depth);
m_encparams.SetFullSearch(enc_ctx->enc_params.full_search);
@@ -569,24 +553,24 @@ void DiracEncoder::SetEncoderParams(const dirac_encoder_context_t *enc_ctx)
m_encparams.SetVFactor(0.75f);
m_encparams.GetPicPredParams().SetMVPrecision(enc_ctx->enc_params.mv_precision);
m_encparams.SetUsingAC(enc_ctx->enc_params.using_ac);
- bparams.SetYblen(enc_ctx->enc_params.yblen);
- bparams.SetXblen(enc_ctx->enc_params.xblen);
- bparams.SetYbsep(enc_ctx->enc_params.ybsep);
- bparams.SetXbsep(enc_ctx->enc_params.xbsep);
+ bparams.SetYblen( enc_ctx->enc_params.yblen );
+ bparams.SetXblen( enc_ctx->enc_params.xblen );
+ bparams.SetYbsep( enc_ctx->enc_params.ybsep );
+ bparams.SetXbsep( enc_ctx->enc_params.xbsep );
// Now rationalise the GOP options
// this stuff should really be done in a constructor!
- if(m_encparams.NumL1() < 0)
+ if (m_encparams.NumL1()<0)
{
//don't have a proper GOP
- m_encparams.SetL1Sep(std::max(1 , m_encparams.L1Sep()));
+ m_encparams.SetL1Sep( std::max(1 , m_encparams.L1Sep()) );
}
- else if(m_encparams.NumL1() == 0)
+ else if (m_encparams.NumL1() == 0)
{
//have I-frame only coding
m_encparams.SetL1Sep(0);
}
- m_encparams.GetPicPredParams().SetBlockSizes(bparams , enc_ctx->src_params.chroma);
+ m_encparams.GetPicPredParams().SetBlockSizes( bparams , enc_ctx->src_params.chroma );
// Set transforms parameters
m_encparams.SetIntraTransformFilter(enc_ctx->enc_params.intra_wlt_filter);
@@ -598,53 +582,51 @@ void DiracEncoder::SetEncoderParams(const dirac_encoder_context_t *enc_ctx)
}
-bool DiracEncoder::LoadNextFrame(unsigned char *data, int size)
+bool DiracEncoder::LoadNextFrame (unsigned char *data, int size)
{
- TESTM(m_seqcomp->Finished() != true, "Did not reach end of sequence");
+ TESTM (m_seqcomp->Finished() != true, "Did not reach end of sequence");
m_inp_ptr->SetMembufReference(data, size);
- if(m_seqcomp->LoadNextFrame())
+ if (m_seqcomp->LoadNextFrame())
{
- if(!m_encparams.FieldCoding())
+ if (!m_encparams.FieldCoding())
m_num_loaded_pictures++;
else
- m_num_loaded_pictures += 2;
+ m_num_loaded_pictures+=2;
return true;
}
return false;
}
-int DiracEncoder::CompressNextPicture()
+int DiracEncoder::CompressNextPicture ()
{
- TESTM(m_seqcomp->Finished() != true, "Did not reach end of sequence");
+ TESTM (m_seqcomp->Finished() != true, "Did not reach end of sequence");
- if(!m_num_loaded_pictures)
+ if (!m_num_loaded_pictures)
return 0;
const EncPicture *mypicture = m_seqcomp->CompressNextPicture();
m_decpnum = -1;
- if(mypicture)
- {
+ if (mypicture){
m_enc_picture = m_seqcomp->GetPictureEncoded();
- if(m_enc_picture->GetPparams().PicSort().IsIntra() == false)
+ if (m_enc_picture->GetPparams().PicSort().IsIntra()==false)
m_enc_medata = &m_enc_picture->GetMEData();
- else
- m_enc_medata = NULL;
+ else
+ m_enc_medata = NULL;
- if(m_return_decoded_pictures &&
- mypicture->GetPparams().PictureNum() != m_show_pnum)
- {
+ if (m_return_decoded_pictures &&
+ mypicture->GetPparams().PictureNum() != m_show_pnum){
int ret_val;
m_show_pnum = mypicture->GetPparams().PictureNum();
- TEST(!(m_return_decoded_pictures && !m_dec_buf));
- if(m_return_decoded_pictures && m_dec_buf)
+ TEST (! (m_return_decoded_pictures && !m_dec_buf) );
+ if (m_return_decoded_pictures && m_dec_buf)
{
// write locally decoded picture to decode buffer
m_out_ptr->SetMembufReference(m_dec_buf, m_dec_bufsize);
ret_val = m_out_ptr->GetStream()->WriteToNextFrame(*mypicture);
- if(ret_val)
+ if (ret_val)
{
m_decpnum = m_show_pnum;
m_decpsort = mypicture->GetPparams().PicSort();
@@ -652,8 +634,7 @@ int DiracEncoder::CompressNextPicture()
}
}
}
- else
- {
+ else{
m_enc_picture = NULL;
m_enc_medata = NULL;
}
@@ -661,10 +642,9 @@ int DiracEncoder::CompressNextPicture()
if(!m_dirac_byte_stream.IsUnitAvailable())
return 0;
- if(mypicture)
- {
- m_num_coded_pictures++;
- TESTM(m_enc_picture != 0, "Encoder picture available");
+ if (mypicture){
+ m_num_coded_pictures++;
+ TESTM (m_enc_picture != 0, "Encoder picture available");
}
return 1;
}
@@ -676,35 +656,35 @@ void DiracEncoder::GetPictureStats(dirac_encoder_t *encoder)
DiracByteStats dirac_byte_stats = m_dirac_byte_stream.GetLastUnitStats();
pstats->mv_bits = dirac_byte_stats.GetBitCount(STAT_MV_BYTE_COUNT);
- // pstats->mv_hdr_bits = poutput.MVBytes() * 8;
+ // pstats->mv_hdr_bits = poutput.MVBytes() * 8;
pstats->ycomp_bits = dirac_byte_stats.GetBitCount(STAT_YCOMP_BYTE_COUNT);
- // pstats->ycomp_hdr_bits = poutput.ComponentHeadBytes( Y_COMP ) * 8;
+ // pstats->ycomp_hdr_bits = poutput.ComponentHeadBytes( Y_COMP ) * 8;
pstats->ucomp_bits = dirac_byte_stats.GetBitCount(STAT_UCOMP_BYTE_COUNT);
- // pstats->ucomp_hdr_bits = poutput.ComponentHeadBytes( U_COMP ) * 8;
+ // pstats->ucomp_hdr_bits = poutput.ComponentHeadBytes( U_COMP ) * 8;
pstats->vcomp_bits = dirac_byte_stats.GetBitCount(STAT_VCOMP_BYTE_COUNT);
- // pstats->vcomp_hdr_bits = poutput.ComponentHeadBytes( V_COMP ) * 8;
+ // pstats->vcomp_hdr_bits = poutput.ComponentHeadBytes( V_COMP ) * 8;
pstats->pic_bits = dirac_byte_stats.GetBitCount(STAT_TOTAL_BYTE_COUNT);
- // pstats->pic_hdr_bits = poutput.PictureHeadBytes() * 8;
+ // pstats->pic_hdr_bits = poutput.PictureHeadBytes() * 8;
DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- if(compressor->GetEncParams().Verbose())
+ if (compressor->GetEncParams().Verbose())
{
- std::cout << std::endl << "Number of MV bits=" << pstats->mv_bits;
- std::cout << std::endl << "Number of bits for Y=" << pstats->ycomp_bits;
- std::cout << std::endl << "Number of bits for U=" << pstats->ucomp_bits;
- std::cout << std::endl << "Number of bits for V=" << pstats->vcomp_bits;
- if(m_encparams.FieldCoding())
- std::cout << std::endl << "Total field bits=" << pstats->pic_bits;
+ std::cout<<std::endl<<"Number of MV bits="<<pstats->mv_bits;
+ std::cout<<std::endl<<"Number of bits for Y="<<pstats->ycomp_bits;
+ std::cout<<std::endl<<"Number of bits for U="<<pstats->ucomp_bits;
+ std::cout<<std::endl<<"Number of bits for V="<<pstats->vcomp_bits;
+ if (m_encparams.FieldCoding())
+ std::cout<<std::endl<<"Total field bits="<<pstats->pic_bits;
else
- std::cout << std::endl << "Total frame bits=" << pstats->pic_bits;
+ std::cout<<std::endl<<"Total frame bits="<<pstats->pic_bits;
}
}
-int DiracEncoder::GetEncodedData(dirac_encoder_t *encoder)
+int DiracEncoder::GetEncodedData (dirac_encoder_t *encoder)
{
int size = 0;
dirac_enc_data_t *encdata = &encoder->enc_buf;
@@ -712,14 +692,14 @@ int DiracEncoder::GetEncodedData(dirac_encoder_t *encoder)
string output = m_dirac_byte_stream.GetBytes();
size = output.size();
//std::cout << std::endl << "ParseUnit size=" << size << std::endl;
- if(size > 0)
+ if (size > 0)
{
- if(encdata->size < size)
+ if (encdata->size < size )
{
return -1;
}
- memmove(encdata->buffer, output.c_str(), output.size());
- if(m_enc_picture)
+ memmove (encdata->buffer, output.c_str(), output.size());
+ if (m_enc_picture)
{
// picture data
encoder->enc_pparams.pnum = m_enc_picture->GetPparams().PictureNum();
@@ -727,29 +707,29 @@ int DiracEncoder::GetEncodedData(dirac_encoder_t *encoder)
encoder->enc_pparams.rtype = m_enc_picture->GetPparams().PicSort().IsRef() ? REFERENCE_PICTURE : NON_REFERENCE_PICTURE;
// Get frame statistics
- GetPictureStats(encoder);
- if(m_encparams.Verbose() && encoder->enc_ctx.enc_params.picture_coding_mode == 1)
+ GetPictureStats (encoder);
+ if(m_encparams.Verbose() && encoder->enc_ctx.enc_params.picture_coding_mode==1)
{
- if(encoder->enc_pparams.pnum % 2 == 0)
+ if (encoder->enc_pparams.pnum%2 == 0)
m_field1_stats = encoder->enc_pstats;
else
{
- std::cout << std::endl << std::endl
- << "Frame " << encoder->enc_pparams.pnum / 2;
- std::cout << " stats";
- std::cout << std::endl << "Number of MV bits=";
- std::cout << m_field1_stats.mv_bits + encoder->enc_pstats.mv_bits;
- std::cout << std::endl << "Number of bits for Y=";
- std::cout << m_field1_stats.ycomp_bits + encoder->enc_pstats.ycomp_bits;
- std::cout << std::endl << "Number of bits for U=";
- std::cout << m_field1_stats.ucomp_bits + encoder->enc_pstats.ucomp_bits;
- std::cout << std::endl << "Number of bits for V=";
- std::cout << m_field1_stats.vcomp_bits + encoder->enc_pstats.vcomp_bits;
+ std::cout<<std::endl<<std::endl
+ <<"Frame "<<encoder->enc_pparams.pnum/2;
+ std::cout<< " stats";
+ std::cout<<std::endl<< "Number of MV bits=";
+ std::cout<< m_field1_stats.mv_bits + encoder->enc_pstats.mv_bits;
+ std::cout<< std::endl << "Number of bits for Y=";
+ std::cout<< m_field1_stats.ycomp_bits + encoder->enc_pstats.ycomp_bits;
+ std::cout<< std::endl << "Number of bits for U=";
+ std::cout<< m_field1_stats.ucomp_bits + encoder->enc_pstats.ucomp_bits;
+ std::cout<< std::endl << "Number of bits for V=";
+ std::cout<< m_field1_stats.vcomp_bits + encoder->enc_pstats.vcomp_bits;
std::cout << std::endl << "Total frame bits=";
- std::cout << m_field1_stats.pic_bits + encoder->enc_pstats.pic_bits;
+ std::cout<< m_field1_stats.pic_bits + encoder->enc_pstats.pic_bits;
}
}
- }
+ }
else
{
// Not picture data
@@ -765,51 +745,51 @@ int DiracEncoder::GetEncodedData(dirac_encoder_t *encoder)
encdata->size = 0;
}
- if(m_enc_picture)
+ if (m_enc_picture)
{
- //Rate Control - work out bit rate to date and for current GOP
- // and keep track of frame numbers
- int interlace_factor = m_encparams.FieldCoding() ? 2 : 1;
- int num_L1 = encoder->enc_ctx.enc_params.num_L1;
- int L1_sep = encoder->enc_ctx.enc_params.L1_sep;
-
- // Length of the GOP in pictures - twice as many if fields
- int GOP_pic_length = (num_L1 + 1) * L1_sep * interlace_factor;
+ //Rate Control - work out bit rate to date and for current GOP
+ // and keep track of frame numbers
+ int interlace_factor = m_encparams.FieldCoding() ? 2 : 1;
+ int num_L1 = encoder->enc_ctx.enc_params.num_L1;
+ int L1_sep = encoder->enc_ctx.enc_params.L1_sep;
- int offset;
- if(num_L1 == 0)
- {
- GOP_pic_length = 10;
- offset = 0;
- }
- else
- offset = std::max(L1_sep - 1, 0) * interlace_factor;
+ // Length of the GOP in pictures - twice as many if fields
+ int GOP_pic_length = (num_L1+1)*L1_sep*interlace_factor;
- m_gop_bits += encoder->enc_pstats.pic_bits;
- m_picture_count++;
+ int offset;
+ if (num_L1 == 0)
+ {
+ GOP_pic_length = 10;
+ offset = 0;
+ }
+ else
+ offset = std::max(L1_sep-1,0)*interlace_factor;
- if((m_gop_count == 0 && m_picture_count == GOP_pic_length - offset) ||
- (m_gop_count > 0 && m_picture_count == GOP_pic_length))
- {
- int denominator = encoder->enc_ctx.src_params.frame_rate.denominator;
- int numerator = encoder->enc_ctx.src_params.frame_rate.numerator;
- double frame_rate = (double)numerator / (double)denominator;
+ m_gop_bits += encoder->enc_pstats.pic_bits;
+ m_picture_count++;
- double gop_duration = double(m_picture_count) / interlace_factor / frame_rate;
- double bit_rate = double(m_gop_bits) / gop_duration;
+ if ( (m_gop_count==0 && m_picture_count == GOP_pic_length-offset) ||
+ (m_gop_count>0 && m_picture_count == GOP_pic_length))
+ {
+ int denominator = encoder->enc_ctx.src_params.frame_rate.denominator;
+ int numerator = encoder->enc_ctx.src_params.frame_rate.numerator;
+ double frame_rate = (double)numerator/(double)denominator;
- DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- if(compressor->GetEncParams().Verbose())
- {
- std::cout << std::endl << std::endl << "Bit Rate for GOP number ";
- std::cout << m_gop_count << " is " << bit_rate / 1000.0 << " kbps" << std::endl;
- }
+ double gop_duration = double(m_picture_count)/interlace_factor/frame_rate;
+ double bit_rate = double(m_gop_bits)/gop_duration;
- m_gop_count++;
- m_gop_bits = 0;
- m_picture_count = 0;
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ if (compressor->GetEncParams().Verbose())
+ {
+ std::cout<<std::endl<<std::endl<<"Bit Rate for GOP number ";
+ std::cout<<m_gop_count<<" is "<<bit_rate/1000.0<<" kbps"<<std::endl;
}
- //End of Rate Control
+
+ m_gop_count++;
+ m_gop_bits = 0;
+ m_picture_count = 0;
+ }
+ //End of Rate Control
}
m_dirac_byte_stream.Clear();
@@ -817,12 +797,12 @@ int DiracEncoder::GetEncodedData(dirac_encoder_t *encoder)
return size;
}
-int DiracEncoder::GetDecodedData(dirac_encoder_t *encoder)
+int DiracEncoder::GetDecodedData (dirac_encoder_t *encoder)
{
dirac_picparams_t *pp = &encoder->dec_pparams;
int ret_stat = (m_decpnum != -1);
- if(m_return_decoded_pictures && m_decpnum != -1)
+ if (m_return_decoded_pictures && m_decpnum != -1)
{
pp->ptype = m_decpsort.IsIntra() ? INTRA_PICTURE : INTER_PICTURE;
pp->rtype = m_decpsort.IsRef() ? REFERENCE_PICTURE : NON_REFERENCE_PICTURE;
@@ -845,36 +825,36 @@ void DiracEncoder::GetSequenceStats(dirac_encoder_t *encoder,
sstats->vcomp_bits = dirac_seq_stats.GetBitCount(STAT_VCOMP_BYTE_COUNT);
sstats->bit_rate = int64_t((sstats->seq_bits *
- (double)m_srcparams.FrameRate().m_num) /
- (m_srcparams.FrameRate().m_denom * m_num_coded_pictures));
- if(encoder->enc_ctx.enc_params.picture_coding_mode == 1)
+ (double)m_srcparams.FrameRate().m_num)/
+ (m_srcparams.FrameRate().m_denom * m_num_coded_pictures));
+ if (encoder->enc_ctx.enc_params.picture_coding_mode==1)
sstats->bit_rate *= 2;
DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- if(compressor->GetEncParams().Verbose())
+ if (compressor->GetEncParams().Verbose())
{
- std::cout << std::endl << std::endl << "Total bits for sequence=" << sstats->seq_bits;
- std::cout << std::endl << "Of these: " << std::endl;
- std::cout << std::endl << sstats->ycomp_bits << " were Y, ";
- std::cout << std::endl << sstats->ucomp_bits << " were U, ";
- std::cout << std::endl << sstats->vcomp_bits << " were V, and ";
- std::cout << std::endl << sstats->mv_bits << " were motion vector data.";
+ std::cout<<std::endl<<std::endl<<"Total bits for sequence="<<sstats->seq_bits;
+ std::cout<<std::endl<<"Of these: "<<std::endl;
+ std::cout<<std::endl<<sstats->ycomp_bits <<" were Y, ";
+ std::cout<<std::endl<<sstats->ucomp_bits <<" were U, ";
+ std::cout<<std::endl<<sstats->vcomp_bits<<" were V, and ";
+ std::cout<<std::endl<<sstats->mv_bits<<" were motion vector data.";
}
}
-int DiracEncoder::GetSequenceEnd(dirac_encoder_t *encoder)
+int DiracEncoder::GetSequenceEnd (dirac_encoder_t *encoder)
{
dirac_enc_data_t *encdata = &encoder->enc_buf;
- DiracByteStats dirac_seq_stats = m_seqcomp->EndSequence();
+ DiracByteStats dirac_seq_stats=m_seqcomp->EndSequence();
string output = m_dirac_byte_stream.GetBytes();
int size = output.size();
- if(size > 0)
+ if (size > 0)
{
- if(encdata->size < size)
+ if (encdata->size < size )
{
return -1;
}
- memmove(encdata->buffer, output.c_str(), size);
+ memmove (encdata->buffer, output.c_str(), size);
GetSequenceStats(encoder,
dirac_seq_stats);
encdata->size = size;
@@ -887,61 +867,61 @@ int DiracEncoder::GetSequenceEnd(dirac_encoder_t *encoder)
return size;
}
-static bool InitialiseEncoder(const dirac_encoder_context_t *enc_ctx, bool verbose, dirac_encoder_t *encoder)
+static bool InitialiseEncoder (const dirac_encoder_context_t *enc_ctx, bool verbose, dirac_encoder_t *encoder)
{
- TEST(enc_ctx != NULL);
- TEST(encoder != NULL);
+ TEST (enc_ctx != NULL);
+ TEST (encoder != NULL);
- if(enc_ctx->src_params.width == 0 || enc_ctx->src_params.height == 0)
+ if (enc_ctx->src_params.width == 0 || enc_ctx->src_params.height == 0)
return false;
- if(enc_ctx->src_params.chroma < format444 ||
- enc_ctx->src_params.chroma >= formatNK)
+ if (enc_ctx->src_params.chroma < format444 ||
+ enc_ctx->src_params.chroma >= formatNK)
return false;
- if(!enc_ctx->src_params.frame_rate.numerator ||
- !enc_ctx->src_params.frame_rate.denominator)
+ if (!enc_ctx->src_params.frame_rate.numerator ||
+ !enc_ctx->src_params.frame_rate.denominator)
return false;
- memmove(&encoder->enc_ctx, enc_ctx, sizeof(dirac_encoder_context_t));
+ memmove (&encoder->enc_ctx, enc_ctx, sizeof(dirac_encoder_context_t));
encoder->dec_buf.id = 0;
- switch(enc_ctx->src_params.chroma)
+ switch ( enc_ctx->src_params.chroma )
{
case format420:
- encoder->enc_ctx.src_params.chroma_width = enc_ctx->src_params.width / 2;
- encoder->enc_ctx.src_params.chroma_height = enc_ctx->src_params.height / 2;
- break;
+ encoder->enc_ctx.src_params.chroma_width = enc_ctx->src_params.width/2;
+ encoder->enc_ctx.src_params.chroma_height = enc_ctx->src_params.height/2;
+ break;
case format422:
- encoder->enc_ctx.src_params.chroma_width = enc_ctx->src_params.width / 2;
- encoder->enc_ctx.src_params.chroma_height = enc_ctx->src_params.height;
- break;
+ encoder->enc_ctx.src_params.chroma_width = enc_ctx->src_params.width/2;
+ encoder->enc_ctx.src_params.chroma_height = enc_ctx->src_params.height;
+ break;
case format444:
default:
- encoder->enc_ctx.src_params.chroma_width = enc_ctx->src_params.width;
- encoder->enc_ctx.src_params.chroma_height = enc_ctx->src_params.height;
- break;
+ encoder->enc_ctx.src_params.chroma_width = enc_ctx->src_params.width;
+ encoder->enc_ctx.src_params.chroma_height = enc_ctx->src_params.height;
+ break;
}
try
{
- DiracEncoder *comp = new DiracEncoder(&encoder->enc_ctx, verbose);
+ DiracEncoder *comp = new DiracEncoder (&encoder->enc_ctx, verbose);
encoder->compressor = comp;
- if(encoder->enc_ctx.decode_flag)
+ if (encoder->enc_ctx.decode_flag)
{
- int bufsize = (encoder->enc_ctx.src_params.width * encoder->enc_ctx.src_params.height) + 2 * (encoder->enc_ctx.src_params.chroma_width * encoder->enc_ctx.src_params.chroma_height);
+ int bufsize = (encoder->enc_ctx.src_params.width * encoder->enc_ctx.src_params.height)+ 2*(encoder->enc_ctx.src_params.chroma_width*encoder->enc_ctx.src_params.chroma_height);
encoder->dec_buf.buf[0] = new unsigned char [bufsize];
encoder->dec_buf.buf[1] = encoder->dec_buf.buf[0] +
- (encoder->enc_ctx.src_params.width * encoder->enc_ctx.src_params.height);
+ (encoder->enc_ctx.src_params.width * encoder->enc_ctx.src_params.height);
encoder->dec_buf.buf[2] = encoder->dec_buf.buf[1] +
- (encoder->enc_ctx.src_params.chroma_width * encoder->enc_ctx.src_params.chroma_height);
+ (encoder->enc_ctx.src_params.chroma_width*encoder->enc_ctx.src_params.chroma_height);
- comp->SetDecodeBuffer(encoder->dec_buf.buf[0], bufsize);
+ comp->SetDecodeBuffer (encoder->dec_buf.buf[0], bufsize);
}
}
- catch(...)
+ catch (...)
{
return false;
}
@@ -949,9 +929,9 @@ static bool InitialiseEncoder(const dirac_encoder_context_t *enc_ctx, bool verbo
}
static void SetSourceParameters(dirac_encoder_context_t *enc_ctx,
- const VideoFormat& video_format)
+ const VideoFormat& video_format)
{
- TEST(enc_ctx != NULL);
+ TEST (enc_ctx != NULL);
dirac_sourceparams_t &src_params = enc_ctx->src_params;
// create object containing sequence params
@@ -978,7 +958,7 @@ static void SetSourceParameters(dirac_encoder_context_t *enc_ctx,
static void SetEncoderParameters(dirac_encoder_context_t *enc_ctx,
const VideoFormat& video_format)
{
- TEST(enc_ctx != NULL);
+ TEST (enc_ctx != NULL);
dirac_encparams_t &encparams = enc_ctx->enc_params;
encparams.video_format = static_cast<int>(video_format);
@@ -1033,165 +1013,165 @@ static void SetEncoderParameters(dirac_encoder_context_t *enc_ctx,
extern "C" {
#endif
- extern DllExport void dirac_encoder_context_init(dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset)
- {
- TEST(enc_ctx != NULL);
- memset(enc_ctx, 0, sizeof(dirac_encoder_context_t));
-
- // preset is the video format
- int ps = static_cast<int>(preset);
- VideoFormat video_format(static_cast<VideoFormat>(ps));
- SetSourceParameters(enc_ctx, video_format);
- SetEncoderParameters(enc_ctx, video_format);
- }
+extern DllExport void dirac_encoder_context_init ( dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset)
+{
+ TEST (enc_ctx != NULL);
+ memset (enc_ctx, 0, sizeof(dirac_encoder_context_t));
+
+ // preset is the video format
+ int ps = static_cast<int>(preset);
+ VideoFormat video_format(static_cast<VideoFormat>(ps));
+ SetSourceParameters (enc_ctx, video_format);
+ SetEncoderParameters (enc_ctx, video_format);
+}
- extern DllExport dirac_encoder_t *dirac_encoder_init(const dirac_encoder_context_t *enc_ctx, int verbose)
- {
- /* Allocate for encoder */
- dirac_encoder_t *encoder = new dirac_encoder_t;
+extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose)
+{
+ /* Allocate for encoder */
+ dirac_encoder_t *encoder = new dirac_encoder_t;
- memset(encoder, 0, sizeof(dirac_encoder_t));
- /* initialse the encoder context */
- if(!InitialiseEncoder(enc_ctx, verbose > 0, encoder))
- {
- delete encoder;
- return NULL;
- }
+ memset (encoder, 0, sizeof(dirac_encoder_t));
+ /* initialse the encoder context */
+ if (!InitialiseEncoder(enc_ctx, verbose>0, encoder))
+ {
+ delete encoder;
+ return NULL;
+ }
- encoder->encoded_picture_avail = encoder->decoded_frame_avail = 0;
- encoder->instr_data_avail = 0;
+ encoder->encoded_picture_avail = encoder->decoded_frame_avail = 0;
+ encoder->instr_data_avail = 0;
- return encoder;
- }
+ return encoder;
+}
#if DIRAC_RESEARCH_VERSION_ATLEAST(1,0,2)
- extern DllExport int dirac_encoder_pts_offset(const dirac_encoder_t *encoder)
+extern DllExport int dirac_encoder_pts_offset (const dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ int ret;
+ try
{
- TEST(encoder != NULL);
- TEST(encoder->compressor != NULL);
- DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- int ret;
- try
- {
- ret = compressor->GetPTSOffset();
- }
- catch(...)
- {
- ret = -1;
- }
-
- return ret;
+ ret = compressor->GetPTSOffset();
}
+ catch (...)
+ {
+ ret = -1;
+ }
+
+ return ret;
+}
#endif
- extern DllExport int dirac_encoder_load(dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size)
+extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ int ret_stat = 0;
+ try
{
- TEST(encoder != NULL);
- TEST(encoder->compressor != NULL);
- DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- int ret_stat = 0;
- try
+ if ( compressor->LoadNextFrame (uncdata, uncdata_size))
{
- if(compressor->LoadNextFrame(uncdata, uncdata_size))
- {
- ret_stat = uncdata_size;
- }
- }
- catch(...)
- {
- if(compressor->GetEncParams().Verbose())
- std::cerr << "dirac_encoder_load failed" << std::endl;
- ret_stat = -1;
+ ret_stat = uncdata_size;
}
- return ret_stat;
}
-
- extern DllExport dirac_encoder_state_t
- dirac_encoder_output(dirac_encoder_t *encoder)
+ catch (...)
{
- TEST(encoder != NULL);
- TEST(encoder->compressor != NULL);
- TEST(encoder->enc_buf.size != 0);
- TEST(encoder->enc_buf.buffer != NULL);
- DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- dirac_encoder_state_t ret_stat = ENC_STATE_BUFFER;
+ if (compressor->GetEncParams().Verbose())
+ std::cerr << "dirac_encoder_load failed" << std::endl;
+ ret_stat = -1;
+ }
+ return ret_stat;
+}
- encoder->encoded_picture_avail = 0;
- encoder->decoded_frame_avail = 0;
- encoder->instr_data_avail = 0;
+extern DllExport dirac_encoder_state_t
+ dirac_encoder_output (dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ TEST (encoder->enc_buf.size != 0);
+ TEST (encoder->enc_buf.buffer != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ dirac_encoder_state_t ret_stat = ENC_STATE_BUFFER;
- try
- {
- // Get the next compressed picture
- if(compressor->CompressNextPicture() != 0)
- {
- if(compressor->GetEncodedData(encoder) < 0)
- ret_stat = ENC_STATE_INVALID;
- else
- {
- if(encoder->enc_buf.size > 0)
- {
- ret_stat = ENC_STATE_AVAIL;
- }
+ encoder->encoded_picture_avail = 0;
+ encoder->decoded_frame_avail = 0;
+ encoder->instr_data_avail = 0;
- }
- }
+ try
+ {
+ // Get the next compressed picture
+ if (compressor->CompressNextPicture() != 0)
+ {
+ if (compressor->GetEncodedData (encoder) < 0)
+ ret_stat = ENC_STATE_INVALID;
else
{
- // check if EOS has been signalled by the user app
- if(compressor->EOS())
+ if (encoder->enc_buf.size > 0)
{
- compressor->GetSequenceEnd(encoder);
- encoder->end_of_sequence = 1;
- encoder->enc_pparams.pnum = -1;
- ret_stat = ENC_STATE_EOS;
+ ret_stat = ENC_STATE_AVAIL;
}
+
}
- if(encoder->enc_ctx.decode_flag)
- compressor->GetDecodedData(encoder);
}
- catch(...)
+ else
{
- if(compressor->GetEncParams().Verbose())
- std::cerr << "GetEncodedData failed..." << std::endl;
-
- ret_stat = ENC_STATE_INVALID;
+ // check if EOS has been signalled by the user app
+ if (compressor->EOS())
+ {
+ compressor->GetSequenceEnd (encoder);
+ encoder->end_of_sequence = 1;
+ encoder->enc_pparams.pnum = -1;
+ ret_stat = ENC_STATE_EOS;
+ }
}
- return ret_stat;
+ if (encoder->enc_ctx.decode_flag)
+ compressor->GetDecodedData(encoder);
}
-
- extern DllExport void dirac_encoder_end_sequence(dirac_encoder_t *encoder)
+ catch (...)
{
- TEST(encoder != NULL);
- TEST(encoder->compressor != NULL);
- DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ if (compressor->GetEncParams().Verbose())
+ std::cerr << "GetEncodedData failed..." << std::endl;
- encoder->encoded_picture_avail = 0;
- encoder->decoded_frame_avail = 0;
- encoder->instr_data_avail = 0;
+ ret_stat = ENC_STATE_INVALID;
+ }
+ return ret_stat;
+}
- compressor->SignalEOS();
+extern DllExport void dirac_encoder_end_sequence (dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
- }
+ encoder->encoded_picture_avail = 0;
+ encoder->decoded_frame_avail = 0;
+ encoder->instr_data_avail = 0;
- extern DllExport void dirac_encoder_close(dirac_encoder_t *encoder)
- {
- TEST(encoder != NULL);
- TEST(encoder->compressor != NULL);
+ compressor->SignalEOS();
- delete(DiracEncoder *)(encoder->compressor);
+}
- if(encoder->enc_ctx.instr_flag)
- {
- dealloc_instr_data(&encoder->instr);
- }
+extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
- if(encoder->enc_ctx.decode_flag)
- {
- delete [] encoder->dec_buf.buf[0];
- }
- delete encoder;
+ delete (DiracEncoder *)(encoder->compressor);
+
+ if (encoder->enc_ctx.instr_flag)
+ {
+ dealloc_instr_data(&encoder->instr);
+ }
+
+ if (encoder->enc_ctx.decode_flag)
+ {
+ delete [] encoder->dec_buf.buf[0];
}
+ delete encoder;
+}
#ifdef __cplusplus
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.h
index 4a8c030f9..750c6a51a 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/dirac_encoder.h
@@ -23,7 +23,7 @@
* Contributor(s): Anuradha Suraparaju (Original Author)
* Andrew Kennedy,
* Thomas Davies
-* Myo Tun (Brunel University, myo.tun@brunel.ac.uk)
+* Myo Tun (Brunel University, myo.tun@brunel.ac.uk)
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
@@ -46,7 +46,7 @@
/*! \file
\brief C interface to Dirac Encoder.
-
+
A set of 'C' functions that define the public interface to the Dirac encoder.
Refer to the the reference encoder source code, encoder/encmain.cpp for
an example of how to use the "C" interface. The pseudocode below gives
@@ -75,7 +75,7 @@
// return locally decoded output
enc_ctx.decode_flag = 1;
- // Initialise the encoder with the encoder context.
+ // Initialise the encoder with the encoder context.
// Setting verbose output to false
encoder= dirac_encoder_init(&enc_ctx, false);
@@ -126,7 +126,7 @@
}
if (encoder->decoded_frame_avail)
{
- //locally decoded frame is available in
+ //locally decoded frame is available in
//encoder->dec_buf
//locally decoded frame parameters available
//in encoder->dec_fparams
@@ -152,329 +152,328 @@
extern "C" {
#endif
- /*! Enumerated type that defines encoder state */
- typedef enum
- {
- ENC_STATE_INVALID = -1,
- ENC_STATE_BUFFER,
- ENC_STATE_AVAIL,
- ENC_STATE_EOS
- }
- dirac_encoder_state_t ;
+/*! Enumerated type that defines encoder state */
+typedef enum
+{
+ ENC_STATE_INVALID = -1,
+ ENC_STATE_BUFFER,
+ ENC_STATE_AVAIL,
+ ENC_STATE_EOS
+} dirac_encoder_state_t ;
+
+/*! Enumerated type that defines prefiltering types supported by the
+ encoder. */
+typedef PrefilterType dirac_prefilter_t;
+
+/*! Enumerated type that defines encoder presets that set the encoder and
+ sequence paramters. More presets may be added in future*/
+typedef VideoFormat dirac_encoder_presets_t;
+
+/*! Enumerated type that defines motion vector precisions supported by the
+ encoder.*/
+typedef MVPrecisionType dirac_mvprecision_t;
+/*! Structure that holds the encoder specific parameters */
+typedef struct
+{
+ /*! Lossless coding */
+ int lossless;
+ /*! Quality factor */
+ float qf;
+ /*! Full-search motion estimation */
+ int full_search;
+ /*! Combined component motion estimation */
+ int combined_me;
+ /*! x-range for full search ME */
+ int x_range_me;
+ /*! y-range for full search ME */
+ int y_range_me;
+ /*! The separation between L1 frames */
+ int L1_sep;
+ /*! The number of L1 frames before the next intra frame. Together
+ with L1_sep determines the GOP structure.
+ */
+ int num_L1;
+ /*! Normalised viewing distance parameter, in cycles per degree */
+ float cpd;
+ /*! The width of blocks used for motion compensation */
+ int xblen;
+ /*! The height of blocks used for motion compensation */
+ int yblen;
+ /*! The horizontal separation between blocks. Always <xblen */
+ int xbsep;
+ /*! The vertical separation between blocks. Always <yblen */
+ int ybsep;
+ /*! Video format preset */
+ int video_format;
+ /*! Transform filter for intra frames*/
+ dirac_wlt_filter_t intra_wlt_filter;
+ /*! Transform filter for inter frames*/
+ dirac_wlt_filter_t inter_wlt_filter;
+ /*! Transform depth */
+ unsigned int wlt_depth;
+ /*! Spatial partitioning flag */
+ unsigned int spatial_partition;
+ /*! prefilter indicator */
+ dirac_prefilter_t prefilter;
+ /*! prefilter strength*/
+ unsigned int prefilter_strength;
+ /*! Multiple quantisers flag */
+ unsigned int multi_quants;
+ /*! motion-vector pixel precision */
+ dirac_mvprecision_t mv_precision;
+ /*! target bit rate in kbps */
+ int trate;
+ /*! picture coding mode: 0 - frame coding; 1 - field coding */
+ unsigned int picture_coding_mode;
+ /*! arithmetic coding flag: 0 - vlc coding; 1 - arithmetic coding */
+ int using_ac;
+} dirac_encparams_t;
+
+/*! Structure that holds the parameters that set up the encoder context */
+typedef struct
+{
+ /*! Source parameters */
+ dirac_sourceparams_t src_params;
+ /*! Encoder parameters */
+ dirac_encparams_t enc_params;
+ /*! Return diagnostics info 1-return mv data, 0-no diagnostics returned */
+ int instr_flag;
+ /*! Return locally decoded frames 1-return locally decoded frames,
+ 0-no decoded frames returned */
+ int decode_flag;
+} dirac_encoder_context_t;
+
+/*! Function that creates an encoder context based on a preset value. The
+ values can then be overridden by the user by setting each field separately
+ \param enc_ctx pointer to Encoder context tp be initialised.
+ \param preset Preset to be used to initialise the encoder context
+ \verbatim
+
+ For a full list of video formats presets supported and the default values
+ of the source and encoder parameters. refer to Annex C of the Dirac
+ ByteStream Specification.
+
+ \endverbatim
+*/
+extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
+
+
+/*! Structure that holds the encoded data*/
+typedef struct
+{
+ /*! Buffer to hold encoded. Allocated and managed by library user. */
+ unsigned char *buffer;
+ /*! Buffer size */
+ int size;
+} dirac_enc_data_t;
+
+/*! Structure that holds the statistics about the encoded picture */
+typedef struct
+{
+ /*! Number of motion vector bits */
+ unsigned int mv_bits;
+ /*! Number of used to encode y component */
+ unsigned int ycomp_bits;
+ /*! Number of used to encode u component */
+ unsigned int ucomp_bits;
+ /*! Number of used to encode v component */
+ unsigned int vcomp_bits;
+ /*! Total number of bits used to encode picture */
+ unsigned int pic_bits;
+} dirac_enc_picstats_t;
+
+/*! Structure that holds the statistics about the encoded sequence */
+typedef struct
+{
+ /*! Number of motion vector bits */
+ int64_t mv_bits;
+ /*! Total number of bits used to encode sequence */
+ int64_t seq_bits;
+ /*! Number of used to encode y component */
+ int64_t ycomp_bits;
+ /*! Number of used to encode u component */
+ int64_t ucomp_bits;
+ /*! Number of used to encode v component */
+ int64_t vcomp_bits;
+ /*! Average bit rate for the sequence */
+ int64_t bit_rate;
+} dirac_enc_seqstats_t;
+
+/*! Structure that holds the motion vector information */
+typedef struct
+{
+ /*! X component */
+ int x;
+ /*! Y component */
+ int y;
+} dirac_mv_t;
+
+/*! Structure that holds the motion vector cost information*/
+typedef struct
+{
+ /*! The Sum of Absolute Differences */
+ float SAD;
+ /*! The (Lagrangian-weighted) motion vector cost */
+ float mvcost;
+} dirac_mv_cost_t;
+
+/*! Structure that diagnostics data returned by the encoder */
+typedef struct
+{
+ /*! Frame type */
+ dirac_picture_type_t ptype;
+ /*! Reference type */
+ dirac_reference_type_t rtype;
+ /*! Picture number */
+ int pnum;
+ /*! Number of reference pictures */
+ int num_refs;
+ /*! Array of Reference picture numbers */
+ int refs[2];
+ /*! Block separation in X direction */
+ int xbsep;
+ /*! Block separation in Y direction */
+ int ybsep;
+ /*! MacroBlock length in X direction */
+ int sb_xlen;
+ /*! MacroBlock length in Y direction */
+ int sb_ylen;
+ /*! Motion Vector array length in X direction */
+ int mv_xlen;
+ /*! Motion Vector array length in Y direction */
+ int mv_ylen;
+ /*! Macro-block split mode array - sb_ylen*sb_xlen*/
+ int *sb_split_mode;
+ /*! Macro-block costs array - sb_ylen*sb_xlen*/
+ float *sb_costs;
+ /*! Block prediction mode - mv_xlen*mv_ylen */
+ int *pred_mode;
+ /*! Block intrac costs - mv_xlen*mv_ylen */
+ float *intra_costs;
+ /*! Bi prediction costs - mv_xlen*mv_ylen*2 */
+ dirac_mv_cost_t *bipred_costs;
+ /*! DC values of y_comp */
+ short *dc_ycomp;
+ /*! DC values of u_comp */
+ short *dc_ucomp;
+ /*! DC values of v_comp */
+ short *dc_vcomp;
+ /*! Motion vectors for Reference frames mv_ylen*mv_xlen */
+ dirac_mv_t *mv[2];
+ /*! Predictions costs for Reference frames mv_ylen*mv_xlen */
+ dirac_mv_cost_t *pred_costs[2];
+} dirac_instr_t;
+
+/*! Structure that holds the information returned by the encoder */
+typedef struct
+{
+ /*! Encoder context */
+ dirac_encoder_context_t enc_ctx;
+
+ /*! encoded picture available flag */
+ int encoded_picture_avail;
+
+ /*!
+ encoded output. This buffer must be initialised by the user of the
+ library
+ */
+ dirac_enc_data_t enc_buf;
- /*! Enumerated type that defines prefiltering types supported by the
- encoder. */
- typedef PrefilterType dirac_prefilter_t;
+ /*! encoded picture params */
+ dirac_picparams_t enc_pparams;
- /*! Enumerated type that defines encoder presets that set the encoder and
- sequence paramters. More presets may be added in future*/
- typedef VideoFormat dirac_encoder_presets_t;
+ /*! encoded picture stats */
+ dirac_enc_picstats_t enc_pstats;
- /*! Enumerated type that defines motion vector precisions supported by the
- encoder.*/
- typedef MVPrecisionType dirac_mvprecision_t;
- /*! Structure that holds the encoder specific parameters */
- typedef struct
- {
- /*! Lossless coding */
- int lossless;
- /*! Quality factor */
- float qf;
- /*! Full-search motion estimation */
- int full_search;
- /*! Combined component motion estimation */
- int combined_me;
- /*! x-range for full search ME */
- int x_range_me;
- /*! y-range for full search ME */
- int y_range_me;
- /*! The separation between L1 frames */
- int L1_sep;
- /*! The number of L1 frames before the next intra frame. Together
- with L1_sep determines the GOP structure.
- */
- int num_L1;
- /*! Normalised viewing distance parameter, in cycles per degree */
- float cpd;
- /*! The width of blocks used for motion compensation */
- int xblen;
- /*! The height of blocks used for motion compensation */
- int yblen;
- /*! The horizontal separation between blocks. Always <xblen */
- int xbsep;
- /*! The vertical separation between blocks. Always <yblen */
- int ybsep;
- /*! Video format preset */
- int video_format;
- /*! Transform filter for intra frames*/
- dirac_wlt_filter_t intra_wlt_filter;
- /*! Transform filter for inter frames*/
- dirac_wlt_filter_t inter_wlt_filter;
- /*! Transform depth */
- unsigned int wlt_depth;
- /*! Spatial partitioning flag */
- unsigned int spatial_partition;
- /*! prefilter indicator */
- dirac_prefilter_t prefilter;
- /*! prefilter strength*/
- unsigned int prefilter_strength;
- /*! Multiple quantisers flag */
- unsigned int multi_quants;
- /*! motion-vector pixel precision */
- dirac_mvprecision_t mv_precision;
- /*! target bit rate in kbps */
- int trate;
- /*! picture coding mode: 0 - frame coding; 1 - field coding */
- unsigned int picture_coding_mode;
- /*! arithmetic coding flag: 0 - vlc coding; 1 - arithmetic coding */
- int using_ac;
- } dirac_encparams_t;
-
- /*! Structure that holds the parameters that set up the encoder context */
- typedef struct
- {
- /*! Source parameters */
- dirac_sourceparams_t src_params;
- /*! Encoder parameters */
- dirac_encparams_t enc_params;
- /*! Return diagnostics info 1-return mv data, 0-no diagnostics returned */
- int instr_flag;
- /*! Return locally decoded frames 1-return locally decoded frames,
- 0-no decoded frames returned */
- int decode_flag;
- } dirac_encoder_context_t;
-
- /*! Function that creates an encoder context based on a preset value. The
- values can then be overridden by the user by setting each field separately
- \param enc_ctx pointer to Encoder context tp be initialised.
- \param preset Preset to be used to initialise the encoder context
- \verbatim
-
- For a full list of video formats presets supported and the default values
- of the source and encoder parameters. refer to Annex C of the Dirac
- ByteStream Specification.
-
- \endverbatim
+ /*! encoded sequence stats */
+ dirac_enc_seqstats_t enc_seqstats;
+
+ /*! end of sequence */
+ int end_of_sequence;
+
+ /* locally decoded frame (NB: not picture) available flag.
+ 1 - locally decoded frame available in dec_buf.
+ 0 - locally decoded frame not available.
*/
- extern DllExport void dirac_encoder_context_init(dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
+ int decoded_frame_avail;
+ /*!
+ locally decoded output buffer. This buffer is allocated and managed by
+ the encoder library
+ */
+ dirac_framebuf_t dec_buf;
- /*! Structure that holds the encoded data*/
- typedef struct
- {
- /*! Buffer to hold encoded. Allocated and managed by library user. */
- unsigned char *buffer;
- /*! Buffer size */
- int size;
- } dirac_enc_data_t;
-
- /*! Structure that holds the statistics about the encoded picture */
- typedef struct
- {
- /*! Number of motion vector bits */
- unsigned int mv_bits;
- /*! Number of used to encode y component */
- unsigned int ycomp_bits;
- /*! Number of used to encode u component */
- unsigned int ucomp_bits;
- /*! Number of used to encode v component */
- unsigned int vcomp_bits;
- /*! Total number of bits used to encode picture */
- unsigned int pic_bits;
- } dirac_enc_picstats_t;
-
- /*! Structure that holds the statistics about the encoded sequence */
- typedef struct
- {
- /*! Number of motion vector bits */
- int64_t mv_bits;
- /*! Total number of bits used to encode sequence */
- int64_t seq_bits;
- /*! Number of used to encode y component */
- int64_t ycomp_bits;
- /*! Number of used to encode u component */
- int64_t ucomp_bits;
- /*! Number of used to encode v component */
- int64_t vcomp_bits;
- /*! Average bit rate for the sequence */
- int64_t bit_rate;
- } dirac_enc_seqstats_t;
-
- /*! Structure that holds the motion vector information */
- typedef struct
- {
- /*! X component */
- int x;
- /*! Y component */
- int y;
- } dirac_mv_t;
-
- /*! Structure that holds the motion vector cost information*/
- typedef struct
- {
- /*! The Sum of Absolute Differences */
- float SAD;
- /*! The (Lagrangian-weighted) motion vector cost */
- float mvcost;
- } dirac_mv_cost_t;
-
- /*! Structure that diagnostics data returned by the encoder */
- typedef struct
- {
- /*! Frame type */
- dirac_picture_type_t ptype;
- /*! Reference type */
- dirac_reference_type_t rtype;
- /*! Picture number */
- int pnum;
- /*! Number of reference pictures */
- int num_refs;
- /*! Array of Reference picture numbers */
- int refs[2];
- /*! Block separation in X direction */
- int xbsep;
- /*! Block separation in Y direction */
- int ybsep;
- /*! MacroBlock length in X direction */
- int sb_xlen;
- /*! MacroBlock length in Y direction */
- int sb_ylen;
- /*! Motion Vector array length in X direction */
- int mv_xlen;
- /*! Motion Vector array length in Y direction */
- int mv_ylen;
- /*! Macro-block split mode array - sb_ylen*sb_xlen*/
- int *sb_split_mode;
- /*! Macro-block costs array - sb_ylen*sb_xlen*/
- float *sb_costs;
- /*! Block prediction mode - mv_xlen*mv_ylen */
- int *pred_mode;
- /*! Block intrac costs - mv_xlen*mv_ylen */
- float *intra_costs;
- /*! Bi prediction costs - mv_xlen*mv_ylen*2 */
- dirac_mv_cost_t *bipred_costs;
- /*! DC values of y_comp */
- short *dc_ycomp;
- /*! DC values of u_comp */
- short *dc_ucomp;
- /*! DC values of v_comp */
- short *dc_vcomp;
- /*! Motion vectors for Reference frames mv_ylen*mv_xlen */
- dirac_mv_t *mv[2];
- /*! Predictions costs for Reference frames mv_ylen*mv_xlen */
- dirac_mv_cost_t *pred_costs[2];
- } dirac_instr_t;
-
- /*! Structure that holds the information returned by the encoder */
- typedef struct
- {
- /*! Encoder context */
- dirac_encoder_context_t enc_ctx;
-
- /*! encoded picture available flag */
- int encoded_picture_avail;
-
- /*!
- encoded output. This buffer must be initialised by the user of the
- library
- */
- dirac_enc_data_t enc_buf;
-
- /*! encoded picture params */
- dirac_picparams_t enc_pparams;
-
- /*! encoded picture stats */
- dirac_enc_picstats_t enc_pstats;
-
- /*! encoded sequence stats */
- dirac_enc_seqstats_t enc_seqstats;
-
- /*! end of sequence */
- int end_of_sequence;
-
- /* locally decoded frame (NB: not picture) available flag.
- 1 - locally decoded frame available in dec_buf.
- 0 - locally decoded frame not available.
- */
- int decoded_frame_avail;
-
- /*!
- locally decoded output buffer. This buffer is allocated and managed by
- the encoder library
- */
- dirac_framebuf_t dec_buf;
-
- /*! locally decoded picture params */
- dirac_picparams_t dec_pparams;
-
- /*!
- instrumentation data buffer. This buffer is allocated and managed by
- the encoder library. */
- dirac_instr_t instr;
-
- /*! instrumentation data available flag
- 1 - instrumentation data available in instr
- 0 - linstrumentation data not available.
- */
- int instr_data_avail;
-
- /*! void pointer to internal sequence compressor */
- const void *compressor;
- } dirac_encoder_t;
-
- /*!
- Initialise encoder. Makes a copy of the enc_ctx passed to it.
- \param enc_ctx Parameters to initialise encoder context
- \param verbose boolean flag to set verbose output
- \return encoder Handle to encoder if successful or NULL on failure
+ /*! locally decoded picture params */
+ dirac_picparams_t dec_pparams;
+
+ /*!
+ instrumentation data buffer. This buffer is allocated and managed by
+ the encoder library. */
+ dirac_instr_t instr;
+
+ /*! instrumentation data available flag
+ 1 - instrumentation data available in instr
+ 0 - linstrumentation data not available.
*/
- extern DllExport dirac_encoder_t *dirac_encoder_init(const dirac_encoder_context_t *enc_ctx, int verbose);
+ int instr_data_avail;
+
+ /*! void pointer to internal sequence compressor */
+ const void *compressor;
+} dirac_encoder_t;
+
+/*!
+ Initialise encoder. Makes a copy of the enc_ctx passed to it.
+ \param enc_ctx Parameters to initialise encoder context
+ \param verbose boolean flag to set verbose output
+ \return encoder Handle to encoder if successful or NULL on failure
+*/
+extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
#if DIRAC_RESEARCH_VERSION_ATLEAST(1,0,2)
- /*!
- Query the encoder for the reordering depth.
- \param encoder Encoder Handle
- \return encoder The number of pictures a realtime decoder must wait
- before outputting the first picture in display order;
- or -1 for failure.
- */
- extern DllExport int dirac_encoder_pts_offset(const dirac_encoder_t *encoder);
+/*!
+ Query the encoder for the reordering depth.
+ \param encoder Encoder Handle
+ \return encoder The number of pictures a realtime decoder must wait
+ before outputting the first picture in display order;
+ or -1 for failure.
+*/
+extern DllExport int dirac_encoder_pts_offset (const dirac_encoder_t *encoder);
#endif
- /*!
- Load uncompressed data into the encoder. Expects one full frame of data
- \param encoder Encoder Handle
- \param uncdata Uncompressed data buffer
- \param uncdata_size boolean flag to set verbose output
- \return return status. >0 - successful; -1 failed
- Failure may be due to input data size not matching
- the required frame size.
- */
- extern DllExport int dirac_encoder_load(dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
-
- /*!
- Retrieve an encoded frame from the encoder. Returns the state of the
- encoder. The encoder buffer enc_buf in the encodermust be
- set up with the buffer and buffer_size that will hold the encoded frame
- \param encoder Encoder Handle
- \return ENC_STATE_INVALID - unrecoverable error
- ENC_STATE_BUFFER - load data into encoder
- ENC_STATE_AVAIL - Encoded frame available
- ENC_STATE_EOS - End of Sequence info available
- */
- extern DllExport dirac_encoder_state_t dirac_encoder_output(dirac_encoder_t *encoder);
+/*!
+ Load uncompressed data into the encoder. Expects one full frame of data
+ \param encoder Encoder Handle
+ \param uncdata Uncompressed data buffer
+ \param uncdata_size boolean flag to set verbose output
+ \return return status. >0 - successful; -1 failed
+ Failure may be due to input data size not matching
+ the required frame size.
+*/
+extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
+
+/*!
+ Retrieve an encoded frame from the encoder. Returns the state of the
+ encoder. The encoder buffer enc_buf in the encodermust be
+ set up with the buffer and buffer_size that will hold the encoded frame
+ \param encoder Encoder Handle
+ \return ENC_STATE_INVALID - unrecoverable error
+ ENC_STATE_BUFFER - load data into encoder
+ ENC_STATE_AVAIL - Encoded frame available
+ ENC_STATE_EOS - End of Sequence info available
+*/
+extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
- /*!
- Request the encoder to end the sequence.
- \param encoder Encoder Handle
- */
- extern DllExport void dirac_encoder_end_sequence(dirac_encoder_t *encoder);
+/*!
+ Request the encoder to end the sequence.
+ \param encoder Encoder Handle
+*/
+extern DllExport void dirac_encoder_end_sequence (dirac_encoder_t *encoder);
- /*!
- Free resources held by encoder
- \param encoder Encoder Handle
- */
- extern DllExport void dirac_encoder_close(dirac_encoder_t *encoder);
+/*!
+ Free resources held by encoder
+ \param encoder Encoder Handle
+*/
+extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
#endif
#ifdef __cplusplus
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.cpp
index 2a390e42c..5ad01bbe3 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.cpp
@@ -40,56 +40,49 @@
using namespace dirac;
-EncPicture::EncPicture(const PictureParams& pp):
- Picture(pp),
- m_me_data(NULL),
- m_status(NO_ENC),
- m_complexity(0.0),
- m_norm_complexity(1.0),
+EncPicture::EncPicture( const PictureParams& pp):
+ Picture( pp ),
+ m_me_data( NULL ),
+ m_status( NO_ENC ),
+ m_complexity( 0.0 ),
+ m_norm_complexity( 1.0 ),
m_pred_bias(0.5)
{
- for(int c = 0; c < 3; ++c)
- {
- m_orig_data[c] = new PicArray(m_pic_data[c]->LengthY(), m_pic_data[c]->LengthX());
+ for (int c=0; c<3; ++c ){
+ m_orig_data[c] = new PicArray( m_pic_data[c]->LengthY(), m_pic_data[c]->LengthX() );
m_orig_up_data[c] = NULL;
- m_filt_data[c] = NULL;
- m_filt_up_data[c] = NULL;
+ m_filt_data[c] = NULL;
+ m_filt_up_data[c] = NULL;
}
}
-void EncPicture::ClearData()
-{
+void EncPicture::ClearData(){
Picture::ClearData();
- for(int c = 0; c < 3; ++c)
- {
- if(m_orig_data[c] != NULL)
- {
+ for (int c=0;c<3;++c){
+ if (m_orig_data[c] != NULL){
delete m_orig_data[c];
m_orig_data[c] = NULL;
}
- if(m_orig_up_data[c] != NULL)
- {
+ if (m_orig_up_data[c] != NULL){
delete m_orig_up_data[c];
m_orig_up_data[c] = NULL;
}
- if(m_filt_data[c] != NULL)
- {
+ if (m_filt_data[c] != NULL){
delete m_filt_data[c];
m_filt_data[c] = NULL;
}
- if(m_filt_up_data[c] != NULL)
- {
+ if (m_filt_up_data[c] != NULL){
delete m_filt_up_data[c];
m_filt_up_data[c] = NULL;
}
}
- if(m_me_data != NULL)
+ if ( m_me_data != NULL )
delete m_me_data;
}
@@ -100,40 +93,38 @@ EncPicture::~EncPicture()
void EncPicture::SetOrigData()
{
- for(int c = 0; c < 3 ; ++c)
+ for ( int c=0; c<3 ; ++c )
SetOrigData(c);
}
-void EncPicture::SetOrigData(const int c)
+void EncPicture::SetOrigData( const int c )
{
- if(m_pic_data[c] != NULL)
+ if ( m_pic_data[c] != NULL )
*(m_orig_data[c]) = *(m_pic_data[c]);
}
-void EncPicture::InitMEData(const PicturePredParams& predparams , const int num_refs)
+void EncPicture::InitMEData( const PicturePredParams& predparams , const int num_refs)
{
- if(m_me_data != NULL)
+ if (m_me_data != NULL)
delete m_me_data;
- m_me_data = new MEData(predparams, num_refs);
+ m_me_data=new MEData( predparams, num_refs );
}
-const PicArray& EncPicture::DataForME(bool combined_me) const
-{
+const PicArray& EncPicture::DataForME( bool combined_me ) const{
- if(combined_me)
+ if (combined_me)
return CombinedData();
else
- return OrigData(Y_COMP);
+ return OrigData( Y_COMP );
}
-const PicArray& EncPicture::UpDataForME(bool combined_me) const
-{
+const PicArray& EncPicture::UpDataForME( bool combined_me ) const{
- if(combined_me)
+ if (combined_me)
return UpCombinedData();
else
- return UpOrigData(Y_COMP);
+ return UpOrigData( Y_COMP );
}
@@ -141,27 +132,26 @@ const PicArray& EncPicture::UpOrigData(CompSort cs) const
{
const int c = (int) cs;
- if(m_orig_up_data[c] != NULL)
+ if (m_orig_up_data[c] != NULL)
return *m_orig_up_data[c];
else
- {
- //we have to do the upconversion
+ {//we have to do the upconversion
- m_orig_up_data[c] = new PicArray(2 * m_orig_data[c]->LengthY(),
- 2 * m_orig_data[c]->LengthX());
+ m_orig_up_data[c] = new PicArray( 2*m_orig_data[c]->LengthY(),
+ 2*m_orig_data[c]->LengthX() );
UpConverter* myupconv;
- if(c > 0)
- myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth() - 1)),
- (1 << (m_pparams.ChromaDepth() - 1)) - 1,
- m_pparams.ChromaXl(), m_pparams.ChromaYl());
+ if (c>0)
+ myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth()-1)),
+ (1 << (m_pparams.ChromaDepth()-1))-1,
+ m_pparams.ChromaXl(), m_pparams.ChromaYl());
else
- myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth() - 1)),
- (1 << (m_pparams.LumaDepth() - 1)) - 1,
- m_pparams.Xl(), m_pparams.Yl());
+ myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth()-1)),
+ (1 << (m_pparams.LumaDepth()-1))-1,
+ m_pparams.Xl(), m_pparams.Yl());
- myupconv->DoUpConverter(*(m_orig_data[c]) , *(m_orig_up_data[c]));
+ myupconv->DoUpConverter( *(m_orig_data[c]) , *(m_orig_up_data[c]) );
- delete myupconv;
+ delete myupconv;
return *(m_orig_up_data[c]);
@@ -172,17 +162,16 @@ const PicArray& EncPicture::FiltData(CompSort cs) const
{
const int c = (int) cs;
- if(m_filt_data[c] != NULL)
+ if (m_filt_data[c] != NULL)
return *m_filt_data[c];
else
- {
- //we have to do the filtering
+ {//we have to do the filtering
- if(m_orig_data[c] != NULL)
- m_filt_data[c] = new PicArray(m_orig_data[c]->LengthY(),
- m_orig_data[c]->LengthX());
+ if (m_orig_data[c] != NULL )
+ m_filt_data[c] = new PicArray( m_orig_data[c]->LengthY(),
+ m_orig_data[c]->LengthX() );
- AntiAliasFilter(*(m_filt_data[c]), *(m_orig_data[c]));
+ AntiAliasFilter( *(m_filt_data[c]), *(m_orig_data[c]));
return *(m_filt_data[c]);
@@ -193,76 +182,73 @@ const PicArray& EncPicture::UpFiltData(CompSort cs) const
{
const int c = (int) cs;
- if(m_filt_up_data[c] != NULL)
+ if (m_filt_up_data[c] != NULL)
return *m_filt_up_data[c];
else
- {
- //we have to do the upconversion
+ {//we have to do the upconversion
- const PicArray& filt_data = FiltData(cs);
+ const PicArray& filt_data = FiltData( cs );
- m_filt_up_data[c] = new PicArray(2 * filt_data.LengthY(),
- 2 * filt_data.LengthX());
+ m_filt_up_data[c] = new PicArray( 2*filt_data.LengthY(),
+ 2*filt_data.LengthX() );
UpConverter* myupconv;
- if(c > 0)
- myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth() - 1)),
- (1 << (m_pparams.ChromaDepth() - 1)) - 1,
- m_pparams.ChromaXl(), m_pparams.ChromaYl());
+ if (c>0)
+ myupconv = new UpConverter(-(1 << (m_pparams.ChromaDepth()-1)),
+ (1 << (m_pparams.ChromaDepth()-1))-1,
+ m_pparams.ChromaXl(), m_pparams.ChromaYl());
else
- myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth() - 1)),
- (1 << (m_pparams.LumaDepth() - 1)) - 1,
- m_pparams.Xl(), m_pparams.Yl());
+ myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth()-1)),
+ (1 << (m_pparams.LumaDepth()-1))-1,
+ m_pparams.Xl(), m_pparams.Yl());
- myupconv->DoUpConverter(filt_data , *(m_filt_up_data[c]));
+ myupconv->DoUpConverter( filt_data , *(m_filt_up_data[c]) );
- delete myupconv;
+ delete myupconv;
return *(m_filt_up_data[c]);
}
}
-void EncPicture::AntiAliasFilter(PicArray& out_data, const PicArray& in_data) const
-{
+void EncPicture::AntiAliasFilter( PicArray& out_data, const PicArray& in_data ) const{
//Special case for first row
- for(int i = in_data.FirstX(); i <= in_data.LastX(); ++i)
+ for (int i = in_data.FirstX(); i <= in_data.LastX(); ++i)
{
- out_data[in_data.FirstY()][i] = (3 * in_data[in_data.FirstY()][i] +
- in_data[in_data.FirstY()+1][i] + 2) >> 2;
+ out_data[in_data.FirstY()][i] = (3*in_data[in_data.FirstY()][i] +
+ in_data[in_data.FirstY()+1][i] +2 )>>2;
}
//Middle section
- for(int j = in_data.FirstY() + 1; j < in_data.LastY(); ++j)
+ for (int j = in_data.FirstY()+1; j < in_data.LastY(); ++j)
{
- for(int i = in_data.FirstX(); i <= in_data.LastX(); ++i)
+ for (int i = in_data.FirstX(); i <= in_data.LastX(); ++i)
{
- out_data[j][i] = (in_data[j-1][i] + 2 * in_data[j][i] + in_data[j+1][i] + 2) >> 2;
+ out_data[j][i] = (in_data[j-1][i] + 2*in_data[j][i] + in_data[j+1][i] + 2)>>2;
}
}
//Special case for last row
- for(int i = in_data.FirstX(); i <= in_data.LastX(); ++i)
+ for (int i = in_data.FirstX(); i <= in_data.LastX(); ++i)
{
out_data[in_data.LastY()][i] = (in_data[in_data.LastY()-1][i] +
- 3 * in_data[in_data.LastY()][i] + 2) >> 2;
+ 3*in_data[in_data.LastY()][i] + 2)>>2;
}
}
const PicArray& EncPicture::CombinedData() const
{
- if(m_filt_data[Y_COMP] != NULL)
+ if (m_filt_data[Y_COMP] != NULL)
return *m_filt_data[Y_COMP];
else
- {
- //we have to do the combining
+ {//we have to do the combining
- if(m_orig_data[Y_COMP] != NULL)
- m_filt_data[Y_COMP] = new PicArray(m_orig_data[Y_COMP]->LengthY(),
- m_orig_data[Y_COMP]->LengthX());
+ if (m_orig_data[Y_COMP] != NULL )
+ m_filt_data[Y_COMP] = new PicArray( m_orig_data[Y_COMP]->LengthY(),
+ m_orig_data[Y_COMP]->LengthX() );
- Combine(*(m_filt_data[Y_COMP]), *(m_orig_data[Y_COMP]),
- *(m_orig_data[U_COMP]), *(m_orig_data[V_COMP])
- );
+ Combine( *(m_filt_data[Y_COMP]), *(m_orig_data[Y_COMP]),
+ *(m_orig_data[U_COMP]), *(m_orig_data[V_COMP])
+ );
return *(m_filt_data[Y_COMP]);
@@ -271,24 +257,23 @@ const PicArray& EncPicture::CombinedData() const
const PicArray& EncPicture::UpCombinedData() const
{
- if(m_filt_up_data[Y_COMP] != NULL)
+ if (m_filt_up_data[Y_COMP] != NULL)
return *m_filt_up_data[Y_COMP];
else
- {
- //we have to do the upconversion
+ {//we have to do the upconversion
const PicArray& filt_data = CombinedData();
- m_filt_up_data[Y_COMP] = new PicArray(2 * filt_data.LengthY(),
- 2 * filt_data.LengthX());
+ m_filt_up_data[Y_COMP] = new PicArray( 2*filt_data.LengthY(),
+ 2*filt_data.LengthX() );
UpConverter* myupconv;
- myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth() - 1)),
- (1 << (m_pparams.LumaDepth() - 1)) - 1,
- m_pparams.Xl(), m_pparams.Yl());
+ myupconv = new UpConverter(-(1 << (m_pparams.LumaDepth()-1)),
+ (1 << (m_pparams.LumaDepth()-1))-1,
+ m_pparams.Xl(), m_pparams.Yl());
- myupconv->DoUpConverter(filt_data , *(m_filt_up_data[Y_COMP]));
+ myupconv->DoUpConverter( filt_data , *(m_filt_up_data[Y_COMP]) );
- delete myupconv;
+ delete myupconv;
return *(m_filt_up_data[Y_COMP]);
@@ -297,94 +282,85 @@ const PicArray& EncPicture::UpCombinedData() const
-void EncPicture::Combine(PicArray& comb_data, const PicArray& y_data,
- const PicArray& u_data, const PicArray& v_data) const
+void EncPicture::Combine( PicArray& comb_data, const PicArray& y_data,
+ const PicArray& u_data, const PicArray& v_data ) const
{
- int hcr = y_data.LengthX() / u_data.LengthX();
- int vcr = y_data.LengthY() / u_data.LengthY();
+ int hcr = y_data.LengthX()/u_data.LengthX();
+ int vcr = y_data.LengthY()/u_data.LengthY();
float val, valc, valy;
- if(vcr == 1)
- {
- for(int j = 0; j < comb_data.LengthY(); ++j)
- {
- if(hcr == 1) // 444 format
- {
- for(int i = 0; i < comb_data.LengthX(); ++i)
- {
+ if (vcr==1){
+ for (int j=0; j<comb_data.LengthY(); ++j) {
+ if (hcr==1){// 444 format
+ for (int i=0; i<comb_data.LengthX(); ++i ){
val = float(u_data[j][i]);
- val *= val;
- valc = val;
+ val *= val;
+ valc = val;
- val = float(v_data[j][i]);
- val *= val;
- valc += val;
+ val = float(v_data[j][i]);
+ val *= val;
+ valc += val;
valy = float(y_data[j][i]) + 128.0;
- valy *= valy;
- comb_data[j][i] = ValueType(std::sqrt(valc + valy) - 128.0);
+ valy *= valy;
+ comb_data[j][i] = ValueType( std::sqrt(valc+valy)-128.0 );
}// i
- }
- else // 422 format
- {
- for(int i = 0; i < comb_data.LengthX(); i += 2)
- {
+ }
+ else{ // 422 format
+ for (int i=0; i<comb_data.LengthX(); i+=2 ){
val = float(u_data[j][i>>1]);
- val *= val;
- valc = val;
+ val *= val;
+ valc = val;
- val = float(v_data[j][i>>1]);
- val *= val;
- valc += val;
+ val = float(v_data[j][i>>1]);
+ val *= val;
+ valc += val;
valy = float(y_data[j][i]) + 128.0;
- valy *= valy;
- comb_data[j][i] = ValueType(std::sqrt(valc + valy) - 128.0);
+ valy *= valy;
+ comb_data[j][i] = ValueType( std::sqrt(valc+valy)-128.0 );
- valy = float(y_data[j][i+1]) + 128.0;
- valy *= valy;
+ valy = float(y_data[j][i+1]) + 128.0;
+ valy *= valy;
- comb_data[j][i+1] = ValueType(std::sqrt(valc + valy) - 128.0);
+ comb_data[j][i+1] = ValueType( std::sqrt(valc+valy)-128.0 );
- }// i
- }
+ }// i
+ }
}// j
}
- else // 420 format
- {
- for(int j = 0; j < comb_data.LengthY(); j += 2)
- {
+ else{ // 420 format
+ for (int j=0; j<comb_data.LengthY(); j+=2 ) {
- for(int i = 0; i < comb_data.LengthX(); i += 2)
- {
+ for (int i=0; i<comb_data.LengthX(); i+=2 ){
val = float(u_data[j>>1][i>>1]);
- val *= val;
- valc = val;
+ val *= val;
+ valc = val;
- val = float(v_data[j>>1][i>>1]);
- val *= val;
- valc += val;
+ val = float(v_data[j>>1][i>>1]);
+ val *= val;
+ valc += val;
valy = float(y_data[j][i]) + 128.0;
- valy *= valy;
- comb_data[j][i] = ValueType(std::sqrt(valc + valy) - 128.0);
+ valy *= valy;
+ comb_data[j][i] = ValueType( std::sqrt(valc+valy)-128.0 );
- valy = float(y_data[j][i+1]) + 128.0;
- valy *= valy;
- comb_data[j][i+1] = ValueType(std::sqrt(valc + valy) - 128.0);
+ valy = float(y_data[j][i+1]) + 128.0;
+ valy *= valy;
+ comb_data[j][i+1] = ValueType( std::sqrt(valc+valy)-128.0 );
valy = float(y_data[j+1][i]) + 128.0;
- valy *= valy;
- comb_data[j+1][i] = ValueType(std::sqrt(valc + valy) - 128.0);
+ valy *= valy;
+ comb_data[j+1][i] = ValueType( std::sqrt(valc+valy)-128.0 );
- valy = float(y_data[j+1][i+1]) + 128.0;
- valy *= valy;
- comb_data[j+1][i+1] = ValueType(std::sqrt(valc + valy) - 128.0);
+ valy = float(y_data[j+1][i+1]) + 128.0;
+ valy *= valy;
+ comb_data[j+1][i+1] = ValueType( std::sqrt(valc+valy)-128.0 );
- }// i
+ }// i
}// j
}
@@ -393,16 +369,15 @@ void EncPicture::Combine(PicArray& comb_data, const PicArray& y_data,
}
-void EncPicture::DropRef(int rindex)
-{
+void EncPicture::DropRef( int rindex ){
std::vector<int>& refs = m_pparams.Refs();
- if(rindex == 1 || rindex == 2)
- refs.erase(refs.begin() + rindex - 1);
+ if (rindex==1 || rindex==2 )
+ refs.erase( refs.begin()+rindex-1 );
// Now reconfigure the motion data
- if(m_me_data != NULL)
- m_me_data->DropRef(rindex);
+ if ( m_me_data!=NULL )
+ m_me_data->DropRef( rindex );
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.h
index 6f8b5690d..cbef4f5ce 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_picture.h
@@ -64,34 +64,25 @@ static const unsigned int NO_ENC = 0;
class EncPicture : public Picture
{
public:
- EncPicture(const PictureParams& pp);
+ EncPicture( const PictureParams& pp );
virtual ~EncPicture();
//! Initialise the motion estimation data arrays
- void InitMEData(const PicturePredParams& predparams, const int num_refs);
+ void InitMEData( const PicturePredParams& predparams, const int num_refs);
//! Returns the motion data
- MEData& GetMEData()
- {
- return *m_me_data;
- }
+ MEData& GetMEData(){ return *m_me_data;}
//! Returns the motion data
- const MEData& GetMEData() const
- {
- return *m_me_data;
- }
+ const MEData& GetMEData() const { return *m_me_data;}
//! Drops a reference from the motion vector data
- void DropRef(int rindex);
+ void DropRef( int rindex );
//! Returns a given component of the original data
- const PicArray& OrigData(CompSort c) const
- {
- return *m_orig_data[(int) c];
- }
+ const PicArray& OrigData(CompSort c) const { return *m_orig_data[(int) c];}
//! Returns a given upconverted component of the original data
const PicArray& UpOrigData(CompSort cs) const;
@@ -106,56 +97,26 @@ public:
const PicArray& UpDataForME(bool combined_me) const;
- void UpdateStatus(const unsigned int mask)
- {
- m_status |= mask;
- }
+ void UpdateStatus( const unsigned int mask ){ m_status |= mask; }
- void FlipStatus(const unsigned int mask)
- {
- m_status ^= mask;
- }
+ void FlipStatus( const unsigned int mask){ m_status ^= mask; }
- void SetStatus(const int status)
- {
- m_status = status;
- }
+ void SetStatus( const int status ){ m_status = status; }
- unsigned int GetStatus() const
- {
- return m_status;
- }
+ unsigned int GetStatus() const{ return m_status; }
- double GetComplexity() const
- {
- return m_complexity;
- }
+ double GetComplexity() const {return m_complexity; }
- void SetComplexity(double c)
- {
- m_complexity = c;
- }
+ void SetComplexity(double c){ m_complexity = c; }
- double GetNormComplexity() const
- {
- return m_norm_complexity;
- }
+ double GetNormComplexity() const { return m_norm_complexity; }
- void SetNormComplexity(double c)
- {
- m_norm_complexity = c;
- }
+ void SetNormComplexity( double c ){ m_norm_complexity = c; }
- double GetPredBias() const
- {
- return m_pred_bias;
- }
+ double GetPredBias() const { return m_pred_bias; }
- void SetPredBias(double b)
- {
- m_pred_bias = b;
- }
+ void SetPredBias( double b ){ m_pred_bias = b; }
private:
@@ -163,15 +124,15 @@ private:
virtual void ClearData();
//! Filters a (field) picture vertically to reduce aliasing for motion estimation purposes
- void AntiAliasFilter(PicArray& out_data, const PicArray& in_data) const;
+ void AntiAliasFilter( PicArray& out_data, const PicArray& in_data ) const;
//! Returns an anti-aliased version of the original data
const PicArray& FiltData(CompSort c) const;
const PicArray& CombinedData() const;
const PicArray& UpCombinedData() const;
- void Combine(PicArray& comb_data, const PicArray& y_data,
- const PicArray& u_data, const PicArray& v_data) const;
+ void Combine( PicArray& comb_data, const PicArray& y_data,
+ const PicArray& u_data, const PicArray& v_data ) const;
//! Returns an upconverted anti-aliased version of the original data
const PicArray& UpFiltData(CompSort c) const;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.cpp
index ad6c11016..f64da8a0b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.cpp
@@ -40,22 +40,21 @@
using namespace dirac;
//Simple constructor for decoder operation
-EncQueue::EncQueue() {}
+EncQueue::EncQueue(){}
//Copy constructor. Why anyone would need this I don't know.
EncQueue::EncQueue(const EncQueue& cpy)
-{
+ {
// first delete all frames in the current buffer
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
delete m_pic_data[i];
}//i
// next create new arrays, copying from the initialising buffer
m_pic_data.resize(cpy.m_pic_data.size());
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
- {
- m_pic_data[i] = new EncPicture(*(cpy.m_pic_data[i]));
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i){
+ m_pic_data[i] = new EncPicture( *(cpy.m_pic_data[i]) );
}//i
// now copy the map
@@ -64,21 +63,20 @@ EncQueue::EncQueue(const EncQueue& cpy)
}
//Assignment=. Not sure why this would be used either.
-EncQueue& EncQueue::operator=(const EncQueue& rhs)
-{
- if(&rhs != this)
+EncQueue& EncQueue::operator=(const EncQueue& rhs){
+ if (&rhs!=this)
{
// delete all the frames in the lhs buffer
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
delete m_pic_data[i];
}//i
// next create new arrays, copying from the rhs
m_pic_data.resize(rhs.m_pic_data.size());
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- m_pic_data[i] = new EncPicture(*(rhs.m_pic_data[i]));
+ m_pic_data[i] = new EncPicture( *(rhs.m_pic_data[i]) );
}//i
// now copy the map
@@ -91,80 +89,76 @@ EncQueue& EncQueue::operator=(const EncQueue& rhs)
//Destructor
EncQueue::~EncQueue()
{
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ;++i)
delete m_pic_data[i];
}
-EncPicture& EncQueue::GetPicture(const unsigned int pnum)
-{
- //get picture with a given picture number, NOT with a given position in the buffer.
-//If the picture number does not occur, the first picture in the buffer is returned.
+EncPicture& EncQueue::GetPicture( const unsigned int pnum )
+{//get picture with a given picture number, NOT with a given position in the buffer.
+ //If the picture number does not occur, the first picture in the buffer is returned.
- std::map<unsigned int, unsigned int>::iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::iterator it = m_pnum_map.find(pnum);
unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ if (it != m_pnum_map.end())
pos = it->second;
return *(m_pic_data[pos]);
}
-const EncPicture& EncQueue::GetPicture(const unsigned int pnum) const
-{
- //as above, but const version
+const EncPicture& EncQueue::GetPicture( const unsigned int pnum ) const
+{ //as above, but const version
- std::map<unsigned int, unsigned int>::const_iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::const_iterator it = m_pnum_map.find(pnum);
- unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ unsigned int pos=0;
+ if (it != m_pnum_map.end())
pos = it->second;
return *(m_pic_data[pos]);
}
-EncPicture& EncQueue::GetPicture(const unsigned int pnum, bool& is_present)
-{
- //get picture with a given picture number, NOT with a given position in the buffer.
-//If the picture number does not occur, the first picture in the buffer is returned.
+EncPicture& EncQueue::GetPicture( const unsigned int pnum, bool& is_present )
+{//get picture with a given picture number, NOT with a given position in the buffer.
+ //If the picture number does not occur, the first picture in the buffer is returned.
- std::map<unsigned int, unsigned int>::iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::iterator it = m_pnum_map.find(pnum);
unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ if (it != m_pnum_map.end())
{
is_present = true;
pos = it->second;
}
else
- is_present = false;
+ is_present=false;
return *(m_pic_data[pos]);
}
-const EncPicture& EncQueue::GetPicture(const unsigned int pnum, bool& is_present) const
-{
- //as above, but const version
+const EncPicture& EncQueue::GetPicture( const unsigned int pnum, bool& is_present ) const
+{ //as above, but const version
- std::map<unsigned int, unsigned int>::const_iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::const_iterator it = m_pnum_map.find(pnum);
- unsigned int pos = 0;
- if(it != m_pnum_map.end())
+ unsigned int pos=0;
+ if (it != m_pnum_map.end())
{
is_present = true;
pos = it->second;
}
else
- is_present = false;
+ is_present=false;
return *(m_pic_data[pos]);
}
-bool EncQueue::IsPictureAvail(const unsigned int pnum) const
+bool EncQueue::IsPictureAvail( const unsigned int pnum ) const
{
- std::map<unsigned int, unsigned int>::const_iterator it = m_pnum_map.find(pnum);
+ std::map<unsigned int,unsigned int>::const_iterator it = m_pnum_map.find(pnum);
- if(it != m_pnum_map.end())
+ if (it != m_pnum_map.end())
return true;
else
return false;
@@ -172,22 +166,21 @@ bool EncQueue::IsPictureAvail(const unsigned int pnum) const
std::vector<int> EncQueue::Members() const
{
- std::vector<int> members(0);
- for(unsigned int i = 0; i < m_pic_data.size(); ++i)
+ std::vector<int> members( 0 );
+ for (unsigned int i=0; i<m_pic_data.size(); ++i )
{
const PictureParams& pparams = m_pic_data[i]->GetPparams();
- members.push_back(pparams.PictureNum());
+ members.push_back( pparams.PictureNum() );
}// i
return members;
}
-void EncQueue::PushPicture(const PictureParams& pp)
-{
- // Put a new picture onto the top of the stack
+void EncQueue::PushPicture( const PictureParams& pp )
+{// Put a new picture onto the top of the stack
// if picture is present - return
- if(IsPictureAvail(pp.PictureNum()))
+ if (IsPictureAvail(pp.PictureNum()))
return;
// if ( pp.PicSort().IsRef() )
@@ -198,17 +191,17 @@ void EncQueue::PushPicture(const PictureParams& pp)
m_pic_data.push_back(pptr);
// put the picture number into the index table
- std::pair<unsigned int, unsigned int> temp_pair(pp.PictureNum() , m_pic_data.size() - 1);
+ std::pair<unsigned int,unsigned int> temp_pair(pp.PictureNum() , m_pic_data.size()-1);
m_pnum_map.insert(temp_pair);
}
-void EncQueue::CopyPicture(const EncPicture& picture)
+void EncQueue::CopyPicture( const EncPicture& picture )
{
PushPicture(picture.GetPparams());
bool is_present;
- EncPicture & p = GetPicture(picture.GetPparams().PictureNum(), is_present);
+ EncPicture & p= GetPicture(picture.GetPparams().PictureNum(), is_present);
if(is_present)
p = picture;
}
@@ -217,19 +210,19 @@ void EncQueue::ClearSlot(const unsigned int pos)
{
// Clear a slot corresponding to position pos to take more data
- std::pair<unsigned int, unsigned int>* tmp_pair;
+ std::pair<unsigned int,unsigned int>* tmp_pair;
- if(pos < m_pic_data.size())
+ if (pos<m_pic_data.size())
{
delete m_pic_data[pos];
m_pic_data.erase(m_pic_data.begin() + pos);
- //make a new map
+ //make a new map
m_pnum_map.clear();
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- tmp_pair = new std::pair<unsigned int, unsigned int>(m_pic_data[i]->GetPparams().PictureNum() , i);
+ tmp_pair = new std::pair<unsigned int,unsigned int>( m_pic_data[i]->GetPparams().PictureNum() , i);
m_pnum_map.insert(*tmp_pair);
delete tmp_pair;
}//i
@@ -240,15 +233,15 @@ void EncQueue::ClearSlot(const unsigned int pos)
void EncQueue::SetRetiredPictureNum(const int show_pnum, const int current_coded_pnum)
{
- if(IsPictureAvail(current_coded_pnum))
+ if ( IsPictureAvail(current_coded_pnum))
{
PictureParams &pparams = GetPicture(current_coded_pnum).GetPparams();
pparams.SetRetiredPictureNum(-1);
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- if(m_pic_data[i]->GetPparams().PicSort().IsRef())
+ if (m_pic_data[i]->GetPparams().PicSort().IsRef() )
{
- if((m_pic_data[i]->GetPparams().PictureNum() + m_pic_data[i]->GetPparams().ExpiryTime()) <= show_pnum)
+ if ( (m_pic_data[i]->GetPparams().PictureNum() + m_pic_data[i]->GetPparams().ExpiryTime() ) <= show_pnum)
{
pparams.SetRetiredPictureNum(m_pic_data[i]->GetPparams().PictureNum());
break;
@@ -259,34 +252,31 @@ void EncQueue::SetRetiredPictureNum(const int show_pnum, const int current_coded
}
void EncQueue::CleanAll(const int show_pnum, const int current_coded_pnum)
-{
- // clean out all frames that have expired
- if(IsPictureAvail(current_coded_pnum))
+{// clean out all frames that have expired
+ if (IsPictureAvail(current_coded_pnum))
{
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i)
{
- if((m_pic_data[i]->GetPparams().PictureNum() + m_pic_data[i]->GetPparams().ExpiryTime()) <= show_pnum)
+ if ( (m_pic_data[i]->GetPparams().PictureNum() + m_pic_data[i]->GetPparams().ExpiryTime() ) <= show_pnum)
ClearSlot(i);
}//i
}
}
void EncQueue::CleanRetired(const int show_pnum, const int current_coded_pnum)
-{
- // clean out all frames that have expired
- if(IsPictureAvail(current_coded_pnum))
+{// clean out all frames that have expired
+ if ( IsPictureAvail(current_coded_pnum) )
{
PictureParams &pparams = GetPicture(current_coded_pnum).GetPparams();
// Remove Reference picture specified in retired picture number.
- if(pparams.PicSort().IsRef() && pparams.RetiredPictureNum() >= 0)
+ if (pparams.PicSort().IsRef() && pparams.RetiredPictureNum()>= 0)
Remove(pparams.RetiredPictureNum());
pparams.SetRetiredPictureNum(-1);
// Remove non-reference frames that have expired
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
- {
- if((m_pic_data[i]->GetPparams().PictureNum() +
- m_pic_data[i]->GetPparams().ExpiryTime()) <= show_pnum
- && m_pic_data[i]->GetPparams().PicSort().IsNonRef())
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i){
+ if ( (m_pic_data[i]->GetPparams().PictureNum()+
+ m_pic_data[i]->GetPparams().ExpiryTime() )<=show_pnum
+ && m_pic_data[i]->GetPparams().PicSort().IsNonRef() )
ClearSlot(i);
}//i
}
@@ -294,9 +284,8 @@ void EncQueue::CleanRetired(const int show_pnum, const int current_coded_pnum)
void EncQueue::Remove(const int pnum)
{
- for(size_t i = 0 ; i < m_pic_data.size() ; ++i)
- {
- if(m_pic_data[i]->GetPparams().PictureNum() == pnum)
+ for (size_t i=0 ; i<m_pic_data.size() ; ++i){
+ if ( m_pic_data[i]->GetPparams().PictureNum() == pnum)
ClearSlot(i);
}//i
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.h
index 975a02565..2d282ebce 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/enc_queue.h
@@ -46,180 +46,176 @@
namespace dirac
{
-//! Holds pictures both for reference and to overcome reordering delay
-/*!
- The buffer holds pictures in a stack to overcome both reordering due to
- bi-directional prediction and use as references for subsequence motion
- estimation. Pictures, and components of pictures, can be accessed by their
- picture numbers. GOP parameters can be included in the constructors so
- that pictures can be given types (I picture, L1 picture or L2 picture) on
- being pushed onto the stack; alternatively, these parameters can be
- overridden.
-*/
-class EncQueue
-{
-public:
- //! Default Constructor
- EncQueue();
-
- //! Constructor
- /*!
- Creates a EncQueue using the chroma format. Suitable for
- compressing when there are no L2 pictures, or when the temporal
- prediction structure is to be determined on the fly.
-
- \param cf the Chroma format of pictures in the buffer
- \param xlen the luma width of pictures in the buffer
- \param ylen the luma height of pictures in the buffer
- \param luma_depth the video depth of the luma comp in the buffer
- \param chroma_depth the video depth of the chroma comp in the buffer
- \param using_ac True if using Arithmetic coding to code coefficient data
-
- */
- EncQueue(ChromaFormat cf,
- const int xlen,
- const int ylen,
- const unsigned int luma_depth,
- const unsigned int chroma_depth,
- bool using_ac);
-
- //! Constructor
- /*!
- Creates a EncQueue using the chroma format, the number of L1
- pictures between I pictures and the separation in pictures between L1
- pictures. Suitable for compressing when there is a full GOP structure
- or when the temporal prediction structure is to be determined on
- the fly.
-
- \param cf the Chroma format of pictures in the buffer
- \param numL1 the number of Layer 1 pictures before the next I picture. 0 means that there is only one I picture.
- \param L1sep the number of Layer 2 pictures between Layer 1 pictures
- \param xlen the luma width of pictures in the buffer
- \param ylen the luma height of pictures in the buffer
- \param luma_depth the video depth of the luma comp in the buffer
- \param chroma_depth the video depth of the chroma comp in the buffer
- \param interlace Set true if material is being coded in interlaced mode
- \param using_ac True if using Arithmetic coding to code coefficient data
- */
- EncQueue(ChromaFormat cf,
- const int numL1,
- const int L1sep,
- const int xlen,
- const int ylen,
- const unsigned int luma_depth,
- const unsigned int chroma_depth,
- bool interlace,
- bool using_ac);
-
- //! Copy constructor
- /*!
- Copy constructor. Removes the current contents of the pictureture buffer
- and copies in the contents of the initialising buffer.
- */
- EncQueue(const EncQueue& cpy);
-
- //! Operator=.
+ //! Holds pictures both for reference and to overcome reordering delay
/*!
- Operator=. Assigns all elements of the rhs to the lhs.
+ The buffer holds pictures in a stack to overcome both reordering due to
+ bi-directional prediction and use as references for subsequence motion
+ estimation. Pictures, and components of pictures, can be accessed by their
+ picture numbers. GOP parameters can be included in the constructors so
+ that pictures can be given types (I picture, L1 picture or L2 picture) on
+ being pushed onto the stack; alternatively, these parameters can be
+ overridden.
*/
- EncQueue& operator=(const EncQueue& rhs);
-
- //! Destructor
- ~EncQueue();
-
- //! Get picture with a given picture number (NOT with a given position in the buffer)
- EncPicture& GetPicture(const unsigned int pnum);
-
- //! Get picture with a given picture number (NOT with a given position in the buffer)
- const EncPicture& GetPicture(const unsigned int pnum) const;
-
- //! Get picture with a given picture number, setting a flag to true if it's there
- EncPicture& GetPicture(const unsigned int pnum, bool& is_present);
-
- //! Get picture with a given picture number, setting a flag to true if it's there
- const EncPicture& GetPicture(const unsigned int pnum, bool& is_present) const;
-
- //! Return true if picture with the particular picture number is available else return false
- bool IsPictureAvail(const unsigned int pnum) const;
-
- //! Returns a list of member pictures
- std::vector<int> Members() const;
-
- //! Returns the size of the queue
- int Size() const
- {
- return m_pic_data.size();
- }
-
- //! Put a new picture into the top of the buffer
- /*!
- Put a new picture into the top of the buffer. EncPicture parameters
- associated with the picture will be as given by the picture parameter
- object.
- */
- void PushPicture(const PictureParams& pp);
-
- //! Put a copy of a new picture into the buffer
- /*!
- Put a copy of a new picture into the buffer.
- */
- void CopyPicture(const EncPicture& picture);
-
- //! Sets the reference picture number that will be cleaned
- /*!
- Indicate which picture which has been output and which is no longer
- required for reference. Expiry times are set in each picture's
- picture parameters.
- \param show_pnum picture number in display order that can be output
- \param current_coded_pnum picture number in display order of picture currently being coded
- */
- void SetRetiredPictureNum(const int show_pnum, const int current_coded_pnum);
-
- //! Delete all expired pictures
- /*!
- Delete pictures which have been output and which are no longer
- required for reference. Expiry times are set in each picture's
- picture parameters.
- \param show_pnum picture number in display order that can be output
- \param current_coded_pnum picture number in display order of picture currently being coded
- */
- void CleanAll(const int show_pnum, const int current_coded_pnum);
-
- //! Delete retired reference pictures and expired non-ref pictures
- /*!
- Delete pictures which have been output and retired reference pictures.
- Expiry times are set in each picture's picture parameters.
- \param show_pnum picture number in display order that can be output
- \param current_coded_pnum picture number in display order of picture currently being coded
- */
- void CleanRetired(const int show_pnum, const int current_coded_pnum);
-
- //! Delete picture
- /*!
- Delete picture.
- \param pnum picture number in display order to be deleted from picture buffer
- */
- void Remove(int pnum);
-
-private:
- //! Clear internal data slot number pos
- /*!
- Clear internal data slot number pos
- */
- void ClearSlot(const unsigned int pos);
-
-private:
+ class EncQueue{
+ public:
+ //! Default Constructor
+ EncQueue();
+
+ //! Constructor
+ /*!
+ Creates a EncQueue using the chroma format. Suitable for
+ compressing when there are no L2 pictures, or when the temporal
+ prediction structure is to be determined on the fly.
+
+ \param cf the Chroma format of pictures in the buffer
+ \param xlen the luma width of pictures in the buffer
+ \param ylen the luma height of pictures in the buffer
+ \param luma_depth the video depth of the luma comp in the buffer
+ \param chroma_depth the video depth of the chroma comp in the buffer
+ \param using_ac True if using Arithmetic coding to code coefficient data
+
+ */
+ EncQueue(ChromaFormat cf,
+ const int xlen,
+ const int ylen,
+ const unsigned int luma_depth,
+ const unsigned int chroma_depth,
+ bool using_ac);
+
+ //! Constructor
+ /*!
+ Creates a EncQueue using the chroma format, the number of L1
+ pictures between I pictures and the separation in pictures between L1
+ pictures. Suitable for compressing when there is a full GOP structure
+ or when the temporal prediction structure is to be determined on
+ the fly.
+
+ \param cf the Chroma format of pictures in the buffer
+ \param numL1 the number of Layer 1 pictures before the next I picture. 0 means that there is only one I picture.
+ \param L1sep the number of Layer 2 pictures between Layer 1 pictures
+ \param xlen the luma width of pictures in the buffer
+ \param ylen the luma height of pictures in the buffer
+ \param luma_depth the video depth of the luma comp in the buffer
+ \param chroma_depth the video depth of the chroma comp in the buffer
+ \param interlace Set true if material is being coded in interlaced mode
+ \param using_ac True if using Arithmetic coding to code coefficient data
+ */
+ EncQueue(ChromaFormat cf,
+ const int numL1,
+ const int L1sep,
+ const int xlen,
+ const int ylen,
+ const unsigned int luma_depth,
+ const unsigned int chroma_depth,
+ bool interlace,
+ bool using_ac);
+
+ //! Copy constructor
+ /*!
+ Copy constructor. Removes the current contents of the pictureture buffer
+ and copies in the contents of the initialising buffer.
+ */
+ EncQueue(const EncQueue& cpy);
+
+ //! Operator=.
+ /*!
+ Operator=. Assigns all elements of the rhs to the lhs.
+ */
+ EncQueue& operator=(const EncQueue& rhs);
+
+ //! Destructor
+ ~EncQueue();
+
+ //! Get picture with a given picture number (NOT with a given position in the buffer)
+ EncPicture& GetPicture(const unsigned int pnum );
+
+ //! Get picture with a given picture number (NOT with a given position in the buffer)
+ const EncPicture& GetPicture(const unsigned int pnum) const;
+
+ //! Get picture with a given picture number, setting a flag to true if it's there
+ EncPicture& GetPicture(const unsigned int pnum, bool& is_present);
+
+ //! Get picture with a given picture number, setting a flag to true if it's there
+ const EncPicture& GetPicture(const unsigned int pnum, bool& is_present) const;
+
+ //! Return true if picture with the particular picture number is available else return false
+ bool IsPictureAvail(const unsigned int pnum) const;
+
+ //! Returns a list of member pictures
+ std::vector<int> Members() const;
+
+ //! Returns the size of the queue
+ int Size() const { return m_pic_data.size(); }
+
+ //! Put a new picture into the top of the buffer
+ /*!
+ Put a new picture into the top of the buffer. EncPicture parameters
+ associated with the picture will be as given by the picture parameter
+ object.
+ */
+ void PushPicture(const PictureParams& pp);
+
+ //! Put a copy of a new picture into the buffer
+ /*!
+ Put a copy of a new picture into the buffer.
+ */
+ void CopyPicture( const EncPicture& picture );
+
+ //! Sets the reference picture number that will be cleaned
+ /*!
+ Indicate which picture which has been output and which is no longer
+ required for reference. Expiry times are set in each picture's
+ picture parameters.
+ \param show_pnum picture number in display order that can be output
+ \param current_coded_pnum picture number in display order of picture currently being coded
+ */
+ void SetRetiredPictureNum(const int show_pnum, const int current_coded_pnum);
+
+ //! Delete all expired pictures
+ /*!
+ Delete pictures which have been output and which are no longer
+ required for reference. Expiry times are set in each picture's
+ picture parameters.
+ \param show_pnum picture number in display order that can be output
+ \param current_coded_pnum picture number in display order of picture currently being coded
+ */
+ void CleanAll(const int show_pnum, const int current_coded_pnum);
+
+ //! Delete retired reference pictures and expired non-ref pictures
+ /*!
+ Delete pictures which have been output and retired reference pictures.
+ Expiry times are set in each picture's picture parameters.
+ \param show_pnum picture number in display order that can be output
+ \param current_coded_pnum picture number in display order of picture currently being coded
+ */
+ void CleanRetired(const int show_pnum, const int current_coded_pnum);
+
+ //! Delete picture
+ /*!
+ Delete picture.
+ \param pnum picture number in display order to be deleted from picture buffer
+ */
+ void Remove(int pnum);
+
+ private:
+ //! Clear internal data slot number pos
+ /*!
+ Clear internal data slot number pos
+ */
+ void ClearSlot(const unsigned int pos);
+
+ private:
// //! the count of the number of reference pictures in the buffer
// int m_ref_count;
- //! the buffer storing all the values
- std::vector<EncPicture*> m_pic_data;
+ //! the buffer storing all the values
+ std::vector<EncPicture*> m_pic_data;
- //!the map from picture numbers to position in the buffer
- std::map<unsigned int, unsigned int> m_pnum_map;
+ //!the map from picture numbers to position in the buffer
+ std::map<unsigned int,unsigned int> m_pnum_map;
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.cpp
index 793652033..93c6be9b4 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.cpp
@@ -58,7 +58,7 @@ using namespace dirac;
#include <iostream>
#include <sstream>
-PictureCompressor::PictureCompressor(EncoderParams& encp) :
+PictureCompressor::PictureCompressor( EncoderParams& encp ) :
m_encparams(encp),
m_skipped(false),
m_use_global(false),
@@ -73,110 +73,101 @@ PictureCompressor::~PictureCompressor()
{}
-void PictureCompressor::PixelME(EncQueue& my_buffer , int pnum)
+void PictureCompressor::PixelME( EncQueue& my_buffer , int pnum )
{
- PixelMatcher pix_match(m_encparams);
- pix_match.DoSearch(my_buffer , pnum);
+ PixelMatcher pix_match( m_encparams );
+ pix_match.DoSearch( my_buffer , pnum );
}
-void PictureCompressor::CalcComplexity(EncQueue& my_buffer, int pnum , const OLBParams& olbparams)
+void PictureCompressor::CalcComplexity( EncQueue& my_buffer, int pnum , const OLBParams& olbparams )
{
- EncPicture& my_picture = my_buffer.GetPicture(pnum);
+ EncPicture& my_picture = my_buffer.GetPicture( pnum );
PictureParams& pparams = my_picture.GetPparams();
- if((my_picture.GetStatus()&DONE_PEL_ME) != 0)
- {
+ if ( (my_picture.GetStatus()&DONE_PEL_ME) != 0 ){
MEData& me_data = my_picture.GetMEData();
TwoDArray<MvCostData>* pcosts1;
TwoDArray<MvCostData>* pcosts2;
- pcosts1 = &me_data.PredCosts(1);
- if(pparams.NumRefs() > 1)
- pcosts2 = &me_data.PredCosts(2);
- else
- pcosts2 = pcosts1;
+ pcosts1 = &me_data.PredCosts(1);
+ if (pparams.NumRefs()>1)
+ pcosts2 = &me_data.PredCosts(2);
+ else
+ pcosts2 = pcosts1;
float cost1, cost2, cost;
- double total_cost1 = 0.0;
- double total_cost2 = 0.0;
- double total_cost = 0.0;
-
- int count1 = 0;
- int count = 0;
-
- float cost_threshold = float(olbparams.Xblen() * olbparams.Yblen() * 10);
-
- for(int j = 4; j < pcosts1->LengthY() - 4; ++j)
- {
- for(int i = 4; i < pcosts1->LengthX() - 4; ++i)
- {
- cost1 = (*pcosts1)[j][i].SAD;
- cost2 = (*pcosts2)[j][i].SAD;
- cost = std::min(cost1, cost2);
- total_cost1 += cost1;
- total_cost2 += cost2;
- total_cost += cost;
- if(pparams.NumRefs() > 1 && cost <= cost_threshold)
- {
- ++count;
- if(cost1 <= cost2)
- ++count1;
- }
- }
-
- }
- total_cost1 *= olbparams.Xbsep() * olbparams.Ybsep();
- total_cost1 /= olbparams.Xblen() * olbparams.Yblen();
-
- total_cost2 *= olbparams.Xbsep() * olbparams.Ybsep();
- total_cost2 /= olbparams.Xblen() * olbparams.Yblen();
-
- if(pparams.NumRefs() > 1)
- {
- my_picture.SetPredBias(float(count1) / float(count));
+ double total_cost1 = 0.0;
+ double total_cost2 = 0.0;
+ double total_cost = 0.0;
+
+ int count1=0;int count=0;
+
+ float cost_threshold = float(olbparams.Xblen()*olbparams.Yblen()*10);
+
+ for (int j=4; j<pcosts1->LengthY()-4; ++j){
+ for (int i=4; i<pcosts1->LengthX()-4; ++i){
+ cost1 = (*pcosts1)[j][i].SAD;
+ cost2 = (*pcosts2)[j][i].SAD;
+ cost = std::min(cost1, cost2);
+ total_cost1 += cost1;
+ total_cost2 += cost2;
+ total_cost += cost;
+ if (pparams.NumRefs()>1 && cost<=cost_threshold){
+ ++count;
+ if (cost1<=cost2)
+ ++count1;
+ }
+ }
+
+ }
+ total_cost1 *= olbparams.Xbsep()*olbparams.Ybsep();
+ total_cost1 /= olbparams.Xblen()*olbparams.Yblen();
+
+ total_cost2 *= olbparams.Xbsep()*olbparams.Ybsep();
+ total_cost2 /= olbparams.Xblen()*olbparams.Yblen();
+
+ if (pparams.NumRefs()>1){
+ my_picture.SetPredBias(float(count1)/float(count));
}
- else
- my_picture.SetPredBias(0.5);
+ else
+ my_picture.SetPredBias(0.5);
- total_cost *= olbparams.Xbsep() * olbparams.Ybsep();
- total_cost /= olbparams.Xblen() * olbparams.Yblen();
+ total_cost *= olbparams.Xbsep()*olbparams.Ybsep();
+ total_cost /= olbparams.Xblen()*olbparams.Yblen();
// my_picture.SetComplexity( total_cost );
- my_picture.SetComplexity(total_cost * total_cost);
+ my_picture.SetComplexity( total_cost*total_cost );
}
}
-void PictureCompressor::CalcComplexity2(EncQueue& my_buffer, int pnum)
+void PictureCompressor::CalcComplexity2( EncQueue& my_buffer, int pnum )
{
// to be used after doing motion compensation
- EncPicture& my_picture = my_buffer.GetPicture(pnum);
- const PicArray& pic_data = my_picture.Data(Y_COMP);
+ EncPicture& my_picture = my_buffer.GetPicture( pnum );
+ const PicArray& pic_data = my_picture.Data( Y_COMP );
- if((my_picture.GetStatus()&DONE_MC) != 0)
- {
+ if ( (my_picture.GetStatus()&DONE_MC) != 0 ){
float cost;
- double total_sq_cost = 0.0;
- double total_cost = 0.0;
+ double total_sq_cost = 0.0;
+ double total_cost = 0.0;
- for(int j = 0; j < pic_data.LengthY(); ++j)
- {
- for(int i = 0; i < pic_data.LengthX(); ++i)
- {
- cost = float(pic_data[j][i]);
- total_cost += cost;
- total_sq_cost += cost * cost;
- }
+ for (int j=0; j<pic_data.LengthY(); ++j){
+ for (int i=0; i<pic_data.LengthX(); ++i){
+ cost = float( pic_data[j][i] );
+ total_cost += cost;
+ total_sq_cost += cost*cost;
+ }
- }
+ }
- total_cost /= (pic_data.LengthX() * pic_data.LengthY());
- total_sq_cost /= (pic_data.LengthX() * pic_data.LengthY());
+ total_cost /= ( pic_data.LengthX()*pic_data.LengthY() );
+ total_sq_cost /= ( pic_data.LengthX()*pic_data.LengthY() );
- my_picture.SetComplexity(total_sq_cost - total_cost * total_cost);
+ my_picture.SetComplexity( total_sq_cost - total_cost*total_cost );
}
@@ -184,40 +175,37 @@ void PictureCompressor::CalcComplexity2(EncQueue& my_buffer, int pnum)
-void PictureCompressor::NormaliseComplexity(EncQueue& my_buffer, int pnum)
+void PictureCompressor::NormaliseComplexity( EncQueue& my_buffer, int pnum )
{
- EncPicture& my_picture = my_buffer.GetPicture(pnum);
+ EncPicture& my_picture = my_buffer.GetPicture( pnum );
- if((my_picture.GetStatus()&DONE_PIC_COMPLEXITY) != 0)
- {
+ if ( (my_picture.GetStatus()&DONE_PIC_COMPLEXITY) != 0 ){
- std::vector<int> queue_members = my_buffer.Members();
+ std::vector<int> queue_members = my_buffer.Members();
- double mean_complexity = 0.0;
- int count = 0;
- for(size_t i = 0; i < queue_members.size(); ++ i)
- {
- int n = queue_members[i];
- EncPicture& enc_pic = my_buffer.GetPicture(n);
+ double mean_complexity = 0.0;
+ int count = 0;
+ for (size_t i=0; i<queue_members.size(); ++ i){
+ int n = queue_members[i];
+ EncPicture& enc_pic = my_buffer.GetPicture( n );
- if((enc_pic.GetStatus()&DONE_PIC_COMPLEXITY) != 0
- && enc_pic.GetPparams().PicSort().IsInter()
- && n >= pnum - 10
- && n <= pnum + 10)
- {
- mean_complexity += enc_pic.GetComplexity();
- count++;
- }
+ if ( (enc_pic.GetStatus()&DONE_PIC_COMPLEXITY) != 0
+ && enc_pic.GetPparams().PicSort().IsInter()
+ && n >= pnum - 10
+ && n <= pnum + 10){
+ mean_complexity += enc_pic.GetComplexity();
+ count++;
+ }
- }
- mean_complexity /= count;
- my_picture.SetNormComplexity(my_picture.GetComplexity() / mean_complexity);
+ }
+ mean_complexity /= count;
+ my_picture.SetNormComplexity( my_picture.GetComplexity() / mean_complexity );
}
}
-void PictureCompressor::SubPixelME(EncQueue& my_buffer , int pnum)
+void PictureCompressor::SubPixelME( EncQueue& my_buffer , int pnum )
{
const std::vector<int>& refs = my_buffer.GetPicture(pnum).GetPparams().Refs();
const int num_refs = refs.size();
@@ -227,7 +215,7 @@ void PictureCompressor::SubPixelME(EncQueue& my_buffer , int pnum)
PicturePredParams& predparams = me_data.GetPicPredParams();
float lambda;
- if(pparams.IsBPicture())
+ if ( pparams.IsBPicture())
lambda = m_encparams.L2MELambda();
else
lambda = m_encparams.L1MELambda();
@@ -235,17 +223,17 @@ void PictureCompressor::SubPixelME(EncQueue& my_buffer , int pnum)
//lambda *= my_buffer.GetPicture(pnum).GetNormComplexity();
// Set up the lambda to be used
- me_data.SetLambdaMap(num_refs , lambda);
+ me_data.SetLambdaMap( num_refs , lambda );
m_orig_prec = predparams.MVPrecision();
// Step 2.
// Pixel accurate vectors are then refined to sub-pixel accuracy
- if(m_orig_prec != MV_PRECISION_PIXEL)
+ if (m_orig_prec != MV_PRECISION_PIXEL)
{
- SubpelRefine pelrefine(m_encparams);
- pelrefine.DoSubpel(my_buffer , pnum);
+ SubpelRefine pelrefine( m_encparams );
+ pelrefine.DoSubpel( my_buffer , pnum );
}
else
{
@@ -253,17 +241,17 @@ void PictureCompressor::SubPixelME(EncQueue& my_buffer , int pnum)
// Mutiplying the motion vectors by 2 and setting MV precision to
// HALF_PIXEL to implement pixel accurate motion estimate
MvArray &mv_arr1 = me_data.Vectors(1);
- for(int j = 0; j < mv_arr1.LengthY(); ++j)
+ for (int j = 0; j < mv_arr1.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr1.LengthX(); ++i)
+ for (int i = 0; i < mv_arr1.LengthX(); ++i)
mv_arr1[j][i] = mv_arr1[j][i] << 1;
}
- if(num_refs > 1)
+ if (num_refs > 1)
{
MvArray &mv_arr2 = me_data.Vectors(2);
- for(int j = 0; j < mv_arr2.LengthY(); ++j)
+ for (int j = 0; j < mv_arr2.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr2.LengthX(); ++i)
+ for (int i = 0; i < mv_arr2.LengthX(); ++i)
mv_arr2[j][i] = mv_arr2[j][i] << 1;
}
}
@@ -272,36 +260,36 @@ void PictureCompressor::SubPixelME(EncQueue& my_buffer , int pnum)
}
-void PictureCompressor::ModeDecisionME(EncQueue& my_buffer, int pnum)
+void PictureCompressor::ModeDecisionME( EncQueue& my_buffer, int pnum )
{
MEData& me_data = my_buffer.GetPicture(pnum).GetMEData();
PictureParams& pparams = my_buffer.GetPicture(pnum).GetPparams();
PicturePredParams& predparams = me_data.GetPicPredParams();
- ModeDecider my_mode_dec(m_encparams);
- my_mode_dec.DoModeDecn(my_buffer , pnum);
+ ModeDecider my_mode_dec( m_encparams );
+ my_mode_dec.DoModeDecn( my_buffer , pnum );
const int num_refs = pparams.NumRefs();
- if(m_orig_prec == MV_PRECISION_PIXEL)
+ if (m_orig_prec == MV_PRECISION_PIXEL)
{
// FIXME: HACK HACK
// Divide the motion vectors by 2 to convert back to pixel
// accurate motion vectors and reset MV precision to
// PIXEL accuracy
MvArray &mv_arr1 = me_data.Vectors(1);
- for(int j = 0; j < mv_arr1.LengthY(); ++j)
+ for (int j = 0; j < mv_arr1.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr1.LengthX(); ++i)
+ for (int i = 0; i < mv_arr1.LengthX(); ++i)
mv_arr1[j][i] = mv_arr1[j][i] >> 1;
}
- if(num_refs > 1)
+ if (num_refs > 1)
{
MvArray &mv_arr2 = me_data.Vectors(2);
- for(int j = 0; j < mv_arr2.LengthY(); ++j)
+ for (int j = 0; j < mv_arr2.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr2.LengthX(); ++i)
- mv_arr2[j][i] = mv_arr2[j][i] >> 1;
+ for (int i = 0; i < mv_arr2.LengthX(); ++i)
+ mv_arr2[j][i] = mv_arr2[j][i]>>1;
}
}
predparams.SetMVPrecision(MV_PRECISION_PIXEL);
@@ -309,7 +297,7 @@ void PictureCompressor::ModeDecisionME(EncQueue& my_buffer, int pnum)
}
-void PictureCompressor::IntraModeAnalyse(EncQueue& my_buffer, int pnum)
+void PictureCompressor::IntraModeAnalyse( EncQueue& my_buffer, int pnum )
{
MEData& me_data = my_buffer.GetPicture(pnum).GetMEData();
@@ -317,118 +305,113 @@ void PictureCompressor::IntraModeAnalyse(EncQueue& my_buffer, int pnum)
const TwoDArray<PredMode>& modes = me_data.Mode();
int count_intra = 0;
- for(int j = 0 ; j < modes.LengthY() ; ++j)
+ for ( int j=0 ; j<modes.LengthY() ; ++j )
{
- for(int i = 0 ; i < modes.LengthX() ; ++i)
+ for ( int i=0 ; i<modes.LengthX() ; ++i )
{
- if(modes[j][i] == INTRA)
+ if ( modes[j][i] == INTRA )
count_intra++;
}
}// j
- me_data.SetIntraBlockRatio(static_cast<double>(count_intra) /
- static_cast<double>(modes.LengthX() * modes.LengthY()));
+ me_data.SetIntraBlockRatio(static_cast<double>( count_intra ) /
+ static_cast<double>( modes.LengthX() * modes.LengthY() ) );
}
-void PictureCompressor::MotionCompensate(EncQueue& my_buffer, int pnum,
- AddOrSub dirn)
+void PictureCompressor::MotionCompensate( EncQueue& my_buffer, int pnum,
+ AddOrSub dirn )
{
EncPicture* my_pic = &my_buffer.GetPicture(pnum);
std::vector<int>& my_refs = my_pic->GetPparams().Refs();
Picture* ref_pics[2];
- ref_pics[0] = &my_buffer.GetPicture(my_refs[0]);
- if(my_refs.size() > 1)
- ref_pics[1] = &my_buffer.GetPicture(my_refs[1]);
+ ref_pics[0]=&my_buffer.GetPicture(my_refs[0]);
+ if (my_refs.size()>1)
+ ref_pics[1]=&my_buffer.GetPicture(my_refs[1]);
else
- ref_pics[1] = &my_buffer.GetPicture(my_refs[0]);
+ ref_pics[1]=&my_buffer.GetPicture(my_refs[0]);
PicturePredParams& predparams = my_pic->GetMEData().GetPicPredParams();
- MotionCompensator::CompensatePicture(predparams , dirn ,
- my_pic->GetMEData() , my_pic, ref_pics);
+ MotionCompensator::CompensatePicture( predparams , dirn ,
+ my_pic->GetMEData() , my_pic, ref_pics );
}
-void PictureCompressor::Prefilter(EncQueue& my_buffer, int pnum)
+void PictureCompressor::Prefilter( EncQueue& my_buffer, int pnum )
{
- Picture& my_picture = my_buffer.GetPicture(pnum);
+ Picture& my_picture = my_buffer.GetPicture( pnum );
- for(int c = 0; c < 3; ++c)
- {
- if(m_encparams.Prefilter() == RECTLP)
- LPFilter(my_picture.Data((CompSort) c) , m_encparams.Qf(),
- m_encparams.PrefilterStrength());
+ for (int c=0; c<3; ++c ){
+ if ( m_encparams.Prefilter() == RECTLP )
+ LPFilter( my_picture.Data( (CompSort) c) , m_encparams.Qf(),
+ m_encparams.PrefilterStrength() );
- if(m_encparams.Prefilter() == DIAGLP)
+ if ( m_encparams.Prefilter() == DIAGLP )
// DiagFilter( my_picture.Data( (CompSort) c), 3.0, 5 );
- DiagFilter(my_picture.Data((CompSort) c) , m_encparams.Qf(),
- m_encparams.PrefilterStrength());
+ DiagFilter( my_picture.Data( (CompSort) c) , m_encparams.Qf(),
+ m_encparams.PrefilterStrength() );
}
}
-void PictureCompressor::DoDWT(EncQueue& my_buffer , int pnum, Direction dirn)
+void PictureCompressor::DoDWT( EncQueue& my_buffer , int pnum, Direction dirn )
{
- Picture& my_picture = my_buffer.GetPicture(pnum);
+ Picture& my_picture = my_buffer.GetPicture( pnum );
PictureParams& pparams = my_picture.GetPparams();
const PictureSort& psort = pparams.PicSort();
// Set the wavelet filter
- if(psort.IsIntra())
- {
- m_encparams.SetTransformFilter(m_encparams.IntraTransformFilter());
- m_encparams.SetUsualCodeBlocks(INTRA_PICTURE);
+ if ( psort.IsIntra() ){
+ m_encparams.SetTransformFilter( m_encparams.IntraTransformFilter() );
+ m_encparams.SetUsualCodeBlocks( INTRA_PICTURE );
}
- else
- {
- m_encparams.SetTransformFilter(m_encparams.InterTransformFilter());
- m_encparams.SetUsualCodeBlocks(INTER_PICTURE);
+ else{
+ m_encparams.SetTransformFilter( m_encparams.InterTransformFilter() );
+ m_encparams.SetUsualCodeBlocks( INTER_PICTURE );
}
- const int depth = m_encparams.TransformDepth();
+ const int depth=m_encparams.TransformDepth();
const WltFilter filter = m_encparams.TransformFilter();
- WaveletTransform wtransform(depth, filter);
+ WaveletTransform wtransform( depth, filter );
- if(dirn == FORWARD)
- my_picture.InitWltData(depth);
+ if ( dirn==FORWARD )
+ my_picture.InitWltData( depth );
- for(int c = 0; c < 3; ++c)
- {
+ for (int c=0; c<3; ++c){
- PicArray& comp_data = my_buffer.GetPicture(pnum).Data((CompSort) c);
- CoeffArray& coeff_data = my_buffer.GetPicture(pnum).WltData((CompSort) c);
+ PicArray& comp_data = my_buffer.GetPicture( pnum ).Data((CompSort) c );
+ CoeffArray& coeff_data = my_buffer.GetPicture( pnum ).WltData((CompSort) c );
- wtransform.Transform(dirn , comp_data, coeff_data);
+ wtransform.Transform( dirn , comp_data, coeff_data );
}
}
-void PictureCompressor::CodeResidue(EncQueue& my_buffer ,
- int pnum, PictureByteIO* p_picture_byteio)
+void PictureCompressor::CodeResidue( EncQueue& my_buffer ,
+ int pnum, PictureByteIO* p_picture_byteio )
{
- EncPicture& my_picture = my_buffer.GetPicture(pnum);
+ EncPicture& my_picture = my_buffer.GetPicture( pnum );
PictureParams& pparams = my_picture.GetPparams();
- if(!m_skipped)
- {
+ if ( !m_skipped ){
// If not skipped we continue with the coding ...
- if(m_encparams.Verbose())
- std::cout << std::endl << "Using QF: " << m_encparams.Qf();
+ if (m_encparams.Verbose() )
+ std::cout<<std::endl<<"Using QF: "<<m_encparams.Qf();
//Write Transform Header
TransformByteIO *p_transform_byteio = new TransformByteIO(pparams,
- static_cast<CodecParams&>(m_encparams));
+ static_cast<CodecParams&>(m_encparams));
p_picture_byteio->SetTransformData(p_transform_byteio);
p_transform_byteio->Output();
/* Code component data */
/////////////////////////
- CompCompressor my_compcoder(m_encparams , pparams);
+ CompCompressor my_compcoder(m_encparams , pparams );
- const int depth = m_encparams.TransformDepth();
+ const int depth=m_encparams.TransformDepth();
PicArray* comp_data[3];
CoeffArray* coeff_data[3];
@@ -436,45 +419,41 @@ void PictureCompressor::CodeResidue(EncQueue& my_buffer ,
float lambda[3];
// Construction and definition of objects
- for(int c = 0; c < 3; ++c)
- {
- comp_data[c] = &my_picture.Data((CompSort) c);
- coeff_data[c] = &my_picture.WltData((CompSort) c);
- est_bits[c] = new OneDArray<unsigned int>(Range(1, 3 * depth + 1));
+ for (int c=0;c<3;++c){
+ comp_data[c] = &my_picture.Data((CompSort) c );
+ coeff_data[c] = &my_picture.WltData((CompSort) c );
+ est_bits[c] = new OneDArray<unsigned int>( Range( 1, 3*depth+1 ) );
}// c
/* Do the wavelet transforms and select the component
* quantisers using perceptual weighting
*/
- double cpd_scale;
- if(pparams.PicSort().IsIntra())
- {
- cpd_scale = 1.0;
- }
- else
- {
- float intra_ratio = my_picture.GetMEData().IntraBlockRatio();
+ double cpd_scale;
+ if (pparams.PicSort().IsIntra() ){
+ cpd_scale = 1.0;
+ }
+ else{
+ float intra_ratio = my_picture.GetMEData().IntraBlockRatio();
- cpd_scale = 5.0 * intra_ratio * 1.0 + (1.0 - 5.0 * intra_ratio) * 0.125;
- cpd_scale = std::max(0.125, std::min(1.2, cpd_scale));
- }
- for(int c = 0; c < 3; ++c)
- {
- lambda[c] = GetCompLambda(my_picture, (CompSort) c);
+ cpd_scale = 5.0*intra_ratio*1.0 + (1.0-5.0*intra_ratio)*0.125;
+ cpd_scale = std::max( 0.125, std::min( 1.2, cpd_scale ) );
+ }
+ for (int c=0; c<3; ++c){
+ lambda[c] = GetCompLambda( my_picture, (CompSort) c );
- coeff_data[c]->SetBandWeights(m_encparams , pparams, (CompSort) c, cpd_scale);
+ coeff_data[c]->SetBandWeights( m_encparams , pparams, (CompSort) c, cpd_scale);
SubbandList& bands = coeff_data[c]->BandList();
- SetupCodeBlocks(bands);
- SelectQuantisers(*(coeff_data[c]) , bands , lambda[c],
- *est_bits[c] , m_encparams.GetCodeBlockMode(), pparams, (CompSort) c);
+ SetupCodeBlocks( bands );
+ SelectQuantisers( *(coeff_data[c]) , bands , lambda[c],
+ *est_bits[c] , m_encparams.GetCodeBlockMode(), pparams, (CompSort) c );
- p_transform_byteio->AddComponent(my_compcoder.Compress(
- *(coeff_data[c]), bands, (CompSort) c, *est_bits[c]));
+ p_transform_byteio->AddComponent( my_compcoder.Compress(
+ *(coeff_data[c]), bands, (CompSort) c, *est_bits[c] ) );
}
// Destruction of objects
- for(int c = 0; c < 3; ++c)
+ for (int c=0; c<3; ++c)
delete est_bits[c];
}//?m_skipped
@@ -488,72 +467,70 @@ void PictureCompressor::CodeMVData(EncQueue& my_buffer, int pnum, PictureByteIO*
EncPicture& my_picture = my_buffer.GetPicture(pnum);
PictureParams& pparams = my_picture.GetPparams();
- MvData& mv_data = static_cast<MvData&>(my_picture.GetMEData());
+ MvData& mv_data = static_cast<MvData&> (my_picture.GetMEData());
// If we're using global motion parameters, code them
- if(m_use_global)
- {
- /*
- Code the global motion parameters
- TBC ....
- */
+ if (m_use_global){
+ /*
+ Code the global motion parameters
+ TBC ....
+ */
}
// If we're using block motion vectors, code them
- if(m_use_block_mv)
- {
+ if ( m_use_block_mv ){
MvDataByteIO *mv_byteio = new MvDataByteIO(pparams, mv_data.GetPicPredParams());
pic_byteio->SetMvData(mv_byteio);
- SplitModeCodec smode_coder(mv_byteio->SplitModeData()->DataBlock(), TOTAL_MV_CTXS);
- smode_coder.Compress(mv_data);
+ SplitModeCodec smode_coder( mv_byteio->SplitModeData()->DataBlock(), TOTAL_MV_CTXS);
+ smode_coder.Compress( mv_data );
mv_byteio->SplitModeData()->Output();
- PredModeCodec pmode_coder(mv_byteio->PredModeData()->DataBlock(), TOTAL_MV_CTXS, pparams.NumRefs());
- pmode_coder.Compress(mv_data);
+ PredModeCodec pmode_coder( mv_byteio->PredModeData()->DataBlock(), TOTAL_MV_CTXS, pparams.NumRefs() );
+ pmode_coder.Compress( mv_data );
mv_byteio->PredModeData()->Output();
- VectorElementCodec vcoder1h(mv_byteio->MV1HorizData()->DataBlock(), 1,
- HORIZONTAL, TOTAL_MV_CTXS);
- vcoder1h.Compress(mv_data);
+ VectorElementCodec vcoder1h( mv_byteio->MV1HorizData()->DataBlock(), 1,
+ HORIZONTAL, TOTAL_MV_CTXS);
+ vcoder1h.Compress( mv_data );
mv_byteio->MV1HorizData()->Output();
- VectorElementCodec vcoder1v(mv_byteio->MV1VertData()->DataBlock(), 1,
- VERTICAL, TOTAL_MV_CTXS);
- vcoder1v.Compress(mv_data);
+ VectorElementCodec vcoder1v( mv_byteio->MV1VertData()->DataBlock(), 1,
+ VERTICAL, TOTAL_MV_CTXS);
+ vcoder1v.Compress( mv_data );
mv_byteio->MV1VertData()->Output();
- if(pparams.NumRefs() > 1)
+ if ( pparams.NumRefs()>1 )
{
- VectorElementCodec vcoder2h(mv_byteio->MV2HorizData()->DataBlock(), 2,
- HORIZONTAL, TOTAL_MV_CTXS);
- vcoder2h.Compress(mv_data);
+ VectorElementCodec vcoder2h( mv_byteio->MV2HorizData()->DataBlock(), 2,
+ HORIZONTAL, TOTAL_MV_CTXS);
+ vcoder2h.Compress( mv_data );
mv_byteio->MV2HorizData()->Output();
- VectorElementCodec vcoder2v(mv_byteio->MV2VertData()->DataBlock(), 2,
- VERTICAL, TOTAL_MV_CTXS);
- vcoder2v.Compress(mv_data);
+ VectorElementCodec vcoder2v( mv_byteio->MV2VertData()->DataBlock(), 2,
+ VERTICAL, TOTAL_MV_CTXS);
+ vcoder2v.Compress( mv_data );
mv_byteio->MV2VertData()->Output();
}
- DCCodec ydc_coder(mv_byteio->YDCData()->DataBlock(), Y_COMP, TOTAL_MV_CTXS);
- ydc_coder.Compress(mv_data);
+ DCCodec ydc_coder( mv_byteio->YDCData()->DataBlock(), Y_COMP, TOTAL_MV_CTXS);
+ ydc_coder.Compress( mv_data );
mv_byteio->YDCData()->Output();
- DCCodec udc_coder(mv_byteio->UDCData()->DataBlock(), U_COMP, TOTAL_MV_CTXS);
- udc_coder.Compress(mv_data);
+ DCCodec udc_coder( mv_byteio->UDCData()->DataBlock(), U_COMP, TOTAL_MV_CTXS);
+ udc_coder.Compress( mv_data );
mv_byteio->UDCData()->Output();
- DCCodec vdc_coder(mv_byteio->VDCData()->DataBlock(), V_COMP, TOTAL_MV_CTXS);
- vdc_coder.Compress(mv_data);
+ DCCodec vdc_coder( mv_byteio->VDCData()->DataBlock(), V_COMP, TOTAL_MV_CTXS);
+ vdc_coder.Compress( mv_data );
mv_byteio->VDCData()->Output();
mv_byteio->Output();
}
}
-float PictureCompressor::GetCompLambda(const EncPicture& my_picture,
- const CompSort csort)
+float PictureCompressor::GetCompLambda( const EncPicture& my_picture,
+ const CompSort csort )
{
const PictureParams& pparams = my_picture.GetPparams();
@@ -561,166 +538,157 @@ float PictureCompressor::GetCompLambda(const EncPicture& my_picture,
float lambda;
- if(psort.IsIntra())
- {
- if(m_is_a_cut)
- lambda = m_encparams.L1Lambda() / 8;
- else
+ if ( psort.IsIntra() ){
+ if ( m_is_a_cut )
+ lambda = m_encparams.L1Lambda()/8;
+ else
lambda = m_encparams.ILambda();
}
- else
- {
- double log_intra_lambda = std::log10(m_encparams.ILambda());
- /*
- double picture_lambda = m_encparams.L1Lambda() / my_picture.GetNormComplexity();
- if (pparams.IsBPicture() )
- picture_lambda *= 1.2;
-
- double log_picture_lambda = std::log10( picture_lambda );
- */
+ else{
+ double log_intra_lambda = std::log10( m_encparams.ILambda() );
+/*
+double picture_lambda = m_encparams.L1Lambda() / my_picture.GetNormComplexity();
+if (pparams.IsBPicture() )
+ picture_lambda *= 1.2;
+
+ double log_picture_lambda = std::log10( picture_lambda );
+*/
///*
double log_picture_lambda;
- if(pparams.IsBPicture())
- log_picture_lambda = std::log10(m_encparams.L2Lambda());
+ if (pparams.IsBPicture() )
+ log_picture_lambda= std::log10( m_encparams.L2Lambda() );
else
- log_picture_lambda = std::log10(m_encparams.L1Lambda());
+ log_picture_lambda= std::log10( m_encparams.L1Lambda() );
//*/
float intra_ratio = my_picture.GetMEData().IntraBlockRatio();
- lambda = std::pow(10.0, 3.0 * intra_ratio * log_intra_lambda +
- (1.0 - 3.0 * intra_ratio) * log_picture_lambda);
+ lambda= std::pow(10.0, 3.0*intra_ratio*log_intra_lambda+
+ (1.0-3.0*intra_ratio)*log_picture_lambda );
//lambda /= my_picture.GetNormComplexity();
}
- if(csort == U_COMP)
- lambda *= m_encparams.UFactor();
- if(csort == V_COMP)
- lambda *= m_encparams.VFactor();
+ if (csort == U_COMP)
+ lambda*= m_encparams.UFactor();
+ if (csort == V_COMP)
+ lambda*= m_encparams.VFactor();
return lambda;
}
-void PictureCompressor::SetupCodeBlocks(SubbandList& bands)
+void PictureCompressor::SetupCodeBlocks( SubbandList& bands )
{
int xregions;
int yregions;
- for(int band_num = 1; band_num <= bands.Length() ; ++band_num)
- {
- if(m_encparams.SpatialPartition())
- {
- int level = m_encparams.TransformDepth() - (band_num - 1) / 3;
+ for (int band_num = 1; band_num<=bands.Length() ; ++band_num){
+ if (m_encparams.SpatialPartition()){
+ int level = m_encparams.TransformDepth() - (band_num-1)/3;
const CodeBlocks &cb = m_encparams.GetCodeBlocks(level);
xregions = cb.HorizontalCodeBlocks();
yregions = cb.VerticalCodeBlocks();
}
- else
- {
- xregions = 1;
- yregions = 1;
+ else{
+ xregions = 1;
+ yregions = 1;
}
- bands(band_num).SetNumBlocks(yregions , xregions);
+ bands( band_num ).SetNumBlocks( yregions , xregions );
}// band_num
}
-void PictureCompressor::SelectQuantisers(CoeffArray& coeff_data ,
- SubbandList& bands ,
- const float lambda,
- OneDArray<unsigned int>& est_bits,
- const CodeBlockMode cb_mode,
- const PictureParams& pp,
- const CompSort csort)
+void PictureCompressor::SelectQuantisers( CoeffArray& coeff_data ,
+ SubbandList& bands ,
+ const float lambda,
+ OneDArray<unsigned int>& est_bits,
+ const CodeBlockMode cb_mode,
+ const PictureParams& pp,
+ const CompSort csort )
{
- // Set up the multiquantiser mode
- for(int b = bands.Length() ; b >= 1 ; --b)
- {
+ // Set up the multiquantiser mode
+ for ( int b=bands.Length() ; b>=1 ; --b ){
// Set multiquants flag in the subband only if
// a. Global m_cb_mode flag is set to QUANT_MULTIPLE in encparams
// and
// b. Current subband has more than one block
- if(
+ if (
cb_mode == QUANT_MULTIPLE &&
(bands(b).GetCodeBlocks().LengthX() > 1 ||
- bands(b).GetCodeBlocks().LengthY() > 1)
- )
- bands(b).SetUsingMultiQuants(true);
+ bands(b).GetCodeBlocks().LengthY() > 1)
+ )
+ bands(b).SetUsingMultiQuants( true );
else
- bands(b).SetUsingMultiQuants(false);
+ bands(b).SetUsingMultiQuants( false );
}// b
// Select all the quantizers
- if(!m_encparams.Lossless())
- {
+ if ( !m_encparams.Lossless() ){
// Set quantizers for all bands.
- for(int b = bands.Length() ; b >= 1 ; --b)
- est_bits[b] = SelectMultiQuants(coeff_data , bands , b, lambda,
- pp, csort);
+ for ( int b=bands.Length() ; b>=1 ; --b )
+ est_bits[b] = SelectMultiQuants( coeff_data , bands , b, lambda,
+ pp, csort );
}
- else
- {
- for(int b = bands.Length() ; b >= 1 ; --b)
- {
- bands(b).SetQuantIndex(0);
+ else{
+ for ( int b=bands.Length() ; b>=1 ; --b ){
+ bands(b).SetQuantIndex( 0 );
est_bits[b] = 0;
TwoDArray<CodeBlock>& blocks = bands(b).GetCodeBlocks();
- for(int j = 0; j < blocks.LengthY() ; ++j)
- for(int i = 0; i < blocks.LengthX() ; ++i)
- blocks[j][i].SetQuantIndex(0);
+ for (int j=0; j<blocks.LengthY() ;++j)
+ for (int i=0; i<blocks.LengthX() ;++i)
+ blocks[j][i].SetQuantIndex( 0 );
}// b
}
}
-int PictureCompressor::SelectMultiQuants(CoeffArray& coeff_data , SubbandList& bands ,
- const int band_num , const float lambda, const PictureParams& pp, const CompSort csort)
+int PictureCompressor::SelectMultiQuants( CoeffArray& coeff_data , SubbandList& bands ,
+ const int band_num , const float lambda, const PictureParams& pp, const CompSort csort)
{
- Subband& node(bands(band_num));
+ Subband& node( bands( band_num ) );
// Now select the quantisers //
///////////////////////////////
- QuantChooser qchooser(coeff_data , lambda);
+ QuantChooser qchooser( coeff_data , lambda );
// For the DC band in I pictures, remove the average
- if(band_num == bands.Length() && pp.PicSort().IsIntra())
- AddSubAverage(coeff_data , node.Xl() , node.Yl() , SUBTRACT);
+ if ( band_num == bands.Length() && pp.PicSort().IsIntra() )
+ AddSubAverage( coeff_data , node.Xl() , node.Yl() , SUBTRACT);
// The total estimated bits for the subband
- int band_bits(0);
- qchooser.SetEntropyCorrection(m_encparams.EntropyFactors().Factor(band_num, pp, csort));
- band_bits = qchooser.GetBestQuant(node);
+ int band_bits( 0 );
+ qchooser.SetEntropyCorrection( m_encparams.EntropyFactors().Factor( band_num, pp, csort ) );
+ band_bits = qchooser.GetBestQuant( node );
// Put the DC band average back in if necessary
- if(band_num == bands.Length() && pp.PicSort().IsIntra())
- AddSubAverage(coeff_data , node.Xl() , node.Yl() , ADD);
+ if ( band_num == bands.Length() && pp.PicSort().IsIntra() )
+ AddSubAverage( coeff_data , node.Xl() , node.Yl() , ADD);
- if(band_bits == 0)
- node.SetSkip(true);
+ if ( band_bits == 0 )
+ node.SetSkip( true );
else
- node.SetSkip(false);
+ node.SetSkip( false );
return band_bits;
}
-void PictureCompressor::AddSubAverage(CoeffArray& coeff_data, int xl, int yl ,
- AddOrSub dirn)
+void PictureCompressor::AddSubAverage( CoeffArray& coeff_data, int xl, int yl ,
+ AddOrSub dirn)
{
- ValueType last_val = 0;
+ ValueType last_val=0;
ValueType last_val2;
- if(dirn == SUBTRACT)
+ if ( dirn == SUBTRACT )
{
- for(int j = 0 ; j < yl ; j++)
- {
- for(int i = 0 ; i < xl ; i++)
+ for ( int j=0 ; j<yl ; j++)
{
+ for ( int i=0 ; i<xl ; i++)
+ {
last_val2 = coeff_data[j][i];
coeff_data[j][i] -= last_val;
last_val = last_val2;
@@ -729,9 +697,9 @@ void PictureCompressor::AddSubAverage(CoeffArray& coeff_data, int xl, int yl ,
}
else
{
- for(int j = 0 ; j < yl ; j++)
+ for ( int j=0 ; j<yl ; j++)
{
- for(int i = 0 ; i < xl; i++)
+ for ( int i=0 ; i<xl; i++ )
{
coeff_data[j][i] += last_val;
last_val = coeff_data[j][i];
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.h
index 25da86bbc..84f2d983b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/picture_compress.h
@@ -50,157 +50,151 @@
namespace dirac
{
-class MvData;
-
-//! Compress a single image picture
-/*!
- This class compresses a single picture at a time, using parameters
- supplied at its construction. PictureCompressor is used by
- SequenceCompressor.
-*/
-class PictureCompressor
-{
-public:
- //! Constructor
- /*!
- Creates a FrameEncoder with specific set of parameters the control
- the compression process. It encodes motion data before encoding
- each component of the picture.
- \param encp encoder parameters
- */
- PictureCompressor(EncoderParams& encp);
-
- //! Destructor
- ~PictureCompressor();
-
- //! Do pixel accurate motion estimate
- void PixelME(EncQueue& my_buffer , int pnum);
-
- //! Calculate the complexity of a picture
- void CalcComplexity(EncQueue& my_buffer, int pnum , const OLBParams& olbparams);
- void CalcComplexity2(EncQueue& my_buffer, int pnum);
-
- //! Normalise picture complexity with respect to others in the queue
- void NormaliseComplexity(EncQueue& my_buffer, int pnum);
-
- //! Do subpixel accurate motion vector refinement
- void SubPixelME(EncQueue& my_buffer , int pnum);
-
- //! Do mode decision based on sub-pel vectors
- void ModeDecisionME(EncQueue& my_buffer, int pnum);
-
- //! Detect cuts in the current picture
- void IntraModeAnalyse(EncQueue& my_buffer, int pnum);
-
- //! Does motion compensation on picture pnum (forward or backward)
- void MotionCompensate(EncQueue& my_buffer, int pnum, AddOrSub dirn);
+ class MvData;
- //! Prefilter if required
- void Prefilter(EncQueue& my_buffer, int pnum);
-
- //! Do the DWT on a given picture
- void DoDWT(EncQueue& my_buffer , int pnum, Direction dirn);
-
- //! Compress a specific picture within a group of pictures (GOP)
+ //! Compress a single image picture
/*!
- Compresses a specified picture within a group of pictures.
- \param my_pbuffer picture buffer in which the reference frames resides
- \param pnum picture number to compress
- \param pic_byteio compressed picture in Dirac bytestream format
+ This class compresses a single picture at a time, using parameters
+ supplied at its construction. PictureCompressor is used by
+ SequenceCompressor.
*/
- void CodeResidue(EncQueue& my_pbuffer , int pnum , PictureByteIO* pic_byteio);
-
- //! Compresses the motion vector data
- void CodeMVData(EncQueue& my_buffer, int pnum, PictureByteIO* pic_byteio);
-
- //! Returns true if the picture has been skipped rather than coded normally
- bool IsSkipped()
- {
- return m_skipped;
- }
-
- //! Returns true if Motion estimation data is available
- bool IsMEDataAvail() const
+ class PictureCompressor
{
- return m_medata_avail;
- }
-
- //! Returns the motion estimation data
- const MEData* GetMEData() const;
-
-private:
- //! Copy constructor is private and body-less
- /*!
- Copy constructor is private and body-less. This class should not
- be copied.
- */
- PictureCompressor(const PictureCompressor& cpy);
-
- //! Assignment = is private and body-less
- /*!
- Assignment = is private and body-less. This class should not be
- assigned.
- */
- PictureCompressor& operator=(const PictureCompressor& rhs);
-
- //! Initialise the coefficient data array for holding wavelet coefficients
- void InitCoeffData(CoeffArray& coeff_data, const int xl, const int yl);
-
- //! Returns the value lambda according to picture and component type
- float GetCompLambda(const EncPicture& my_picture,
- const CompSort csort);
-
- void SelectQuantisers(CoeffArray& coeff_data ,
- SubbandList& bands ,
- const float lambda,
- OneDArray<unsigned int>& est_counts,
- const CodeBlockMode cb_mode,
- const PictureParams& pp,
- const CompSort csort);
-
- int SelectMultiQuants(CoeffArray& coeff_data ,
- SubbandList& bands ,
- const int band_num,
- const float lambda,
- const PictureParams& pp,
- const CompSort csort);
-
- void SetupCodeBlocks(SubbandList& bands);
-
-
- void AddSubAverage(CoeffArray& coeff_data, int xl, int yl, AddOrSub dirn);
-
-private:
-
- //member variables
- // a local copy of the encoder params
- EncoderParams& m_encparams;
-
- // True if the picture has been skipped, false otherwise
- bool m_skipped;
-
- // True if we use global motion vectors, false otherwise
- bool m_use_global;
-
- // True if we use block motion vectors, false otherwise
- bool m_use_block_mv;
-
- // Prediction mode to use if we only have global motion vectors
- PredMode m_global_pred_mode;
-
- // A pointer to the current picture motion vector data
- MEData* m_me_data;
-
- // True if motion estimation data is available
- bool m_medata_avail;
-
- // True if we have detected a cut
- bool m_is_a_cut;
-
- // The original MV precision type
- MVPrecisionType m_orig_prec;
+ public:
+ //! Constructor
+ /*!
+ Creates a FrameEncoder with specific set of parameters the control
+ the compression process. It encodes motion data before encoding
+ each component of the picture.
+ \param encp encoder parameters
+ */
+ PictureCompressor( EncoderParams& encp );
+
+ //! Destructor
+ ~PictureCompressor( );
+
+ //! Do pixel accurate motion estimate
+ void PixelME( EncQueue& my_buffer , int pnum );
+
+ //! Calculate the complexity of a picture
+ void CalcComplexity( EncQueue& my_buffer, int pnum , const OLBParams& olbparams );
+ void CalcComplexity2( EncQueue& my_buffer, int pnum );
+
+ //! Normalise picture complexity with respect to others in the queue
+ void NormaliseComplexity( EncQueue& my_buffer, int pnum );
+
+ //! Do subpixel accurate motion vector refinement
+ void SubPixelME( EncQueue& my_buffer , int pnum );
+
+ //! Do mode decision based on sub-pel vectors
+ void ModeDecisionME( EncQueue& my_buffer, int pnum );
+
+ //! Detect cuts in the current picture
+ void IntraModeAnalyse( EncQueue& my_buffer, int pnum );
+
+ //! Does motion compensation on picture pnum (forward or backward)
+ void MotionCompensate( EncQueue& my_buffer, int pnum, AddOrSub dirn );
+
+ //! Prefilter if required
+ void Prefilter( EncQueue& my_buffer, int pnum );
+
+ //! Do the DWT on a given picture
+ void DoDWT( EncQueue& my_buffer , int pnum, Direction dirn );
+
+ //! Compress a specific picture within a group of pictures (GOP)
+ /*!
+ Compresses a specified picture within a group of pictures.
+ \param my_pbuffer picture buffer in which the reference frames resides
+ \param pnum picture number to compress
+ \param pic_byteio compressed picture in Dirac bytestream format
+ */
+ void CodeResidue( EncQueue& my_pbuffer , int pnum , PictureByteIO* pic_byteio);
+
+ //! Compresses the motion vector data
+ void CodeMVData( EncQueue& my_buffer, int pnum, PictureByteIO* pic_byteio);
+
+ //! Returns true if the picture has been skipped rather than coded normally
+ bool IsSkipped(){ return m_skipped; }
+
+ //! Returns true if Motion estimation data is available
+ bool IsMEDataAvail() const { return m_medata_avail; }
+
+ //! Returns the motion estimation data
+ const MEData* GetMEData() const;
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+ */
+ PictureCompressor( const PictureCompressor& cpy );
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+ */
+ PictureCompressor& operator=(const PictureCompressor& rhs);
+
+ //! Initialise the coefficient data array for holding wavelet coefficients
+ void InitCoeffData( CoeffArray& coeff_data, const int xl, const int yl );
+
+ //! Returns the value lambda according to picture and component type
+ float GetCompLambda( const EncPicture& my_picture,
+ const CompSort csort );
+
+ void SelectQuantisers( CoeffArray& coeff_data ,
+ SubbandList& bands ,
+ const float lambda,
+ OneDArray<unsigned int>& est_counts,
+ const CodeBlockMode cb_mode,
+ const PictureParams& pp,
+ const CompSort csort );
+
+ int SelectMultiQuants( CoeffArray& coeff_data ,
+ SubbandList& bands ,
+ const int band_num,
+ const float lambda,
+ const PictureParams& pp,
+ const CompSort csort );
+
+ void SetupCodeBlocks( SubbandList& bands );
+
+
+ void AddSubAverage(CoeffArray& coeff_data,int xl,int yl,AddOrSub dirn);
+
+ private:
+
+ //member variables
+ // a local copy of the encoder params
+ EncoderParams& m_encparams;
+
+ // True if the picture has been skipped, false otherwise
+ bool m_skipped;
-};
+ // True if we use global motion vectors, false otherwise
+ bool m_use_global;
+
+ // True if we use block motion vectors, false otherwise
+ bool m_use_block_mv;
+
+ // Prediction mode to use if we only have global motion vectors
+ PredMode m_global_pred_mode;
+
+ // A pointer to the current picture motion vector data
+ MEData* m_me_data;
+
+ // True if motion estimation data is available
+ bool m_medata_avail;
+
+ // True if we have detected a cut
+ bool m_is_a_cut;
+
+ // The original MV precision type
+ MVPrecisionType m_orig_prec;
+
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.cpp
index d02696f72..7920ed0d1 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.cpp
@@ -40,78 +40,74 @@
using namespace dirac;
-void dirac::CWMFilter(Picture& picture, const int strength)
+void dirac::CWMFilter( Picture& picture, const int strength )
{
- CWMFilterComponent(picture.Data(Y_COMP), strength);
- CWMFilterComponent(picture.Data(U_COMP), strength);
- CWMFilterComponent(picture.Data(V_COMP), strength);
+ CWMFilterComponent( picture.Data(Y_COMP), strength );
+ CWMFilterComponent( picture.Data(U_COMP), strength );
+ CWMFilterComponent( picture.Data(V_COMP), strength );
}
-void dirac::CWMFilterComponent(PicArray& pic_data, const int strength)
+void dirac::CWMFilterComponent( PicArray& pic_data, const int strength )
{
// Do centre-weighted median denoising
- PicArray pic_copy(pic_data);
+ PicArray pic_copy( pic_data );
- const int width(3);
- const int offset((width - 1) / 2);
- const int centre_weight = std::max(1, (width * width + 1) - strength);
- const int list_length = centre_weight + (width * width) - 1;
+ const int width( 3 );
+ const int offset( (width-1)/2 );
+ const int centre_weight = std::max(1, (width*width+1)-strength );
+ const int list_length = centre_weight+(width*width)-1;
ValueType* val_list = new ValueType[list_length];
- for(int j = offset; j < pic_data.LengthY() - offset; ++j)
- {
- for(int i = offset; i < pic_data.LastX() - offset; ++i)
- {
+ for (int j=offset; j<pic_data.LengthY()-offset; ++j){
+ for (int i=offset; i<pic_data.LastX()-offset; ++i){
// Make the value list
- int pos = 0;
- for(; pos < centre_weight - 1; ++pos)
+ int pos=0;
+ for (; pos<centre_weight-1; ++pos)
val_list[pos] = pic_copy[j][i];
- for(int s = -offset; s <= offset; ++s)
- {
- for(int r = -offset; r <= offset; ++r)
- {
- val_list[pos] = pic_copy[j+s][i+r];
+ for (int s=-offset; s<=offset; ++s){
+ for (int r=-offset; r<=offset; ++r){
+ val_list[pos]=pic_copy[j+s][i+r];
pos++;
}// r
}// s
- pic_data[j][i] = Median(val_list, list_length);
+ pic_data[j][i] = Median( val_list, list_length );
}// i
}// j
delete[] val_list;
}
-ValueType dirac::Median(const ValueType* val_list, const int length)
+ValueType dirac::Median( const ValueType* val_list, const int length)
{
- OneDArray<ValueType> ordered_vals(length);
+ OneDArray<ValueType> ordered_vals( length );
// Place the values in order
- int pos = 0;
+ int pos=0;
ordered_vals[0] = val_list[0];
- for(int i = 1 ; i < length ; ++i)
+ for (int i=1 ; i<length ; ++i )
{
- for(int k = 0 ; k < i ; ++k)
+ for (int k=0 ; k<i ; ++k)
{
- if(val_list[i] < ordered_vals[k])
+ if (val_list[i]<ordered_vals[k])
{
- pos = k;
+ pos=k;
break;
}
else
- pos = k + 1;
+ pos=k+1;
}// k
- if(pos == i)
+ if ( pos==i)
ordered_vals[i] = val_list[i];
else
{
- for(int k = i - 1 ; k >= pos ; --k)
+ for (int k=i-1 ; k>=pos ; --k )
{
ordered_vals[k+1] = ordered_vals[k];
}// k
@@ -120,125 +116,125 @@ ValueType dirac::Median(const ValueType* val_list, const int length)
}// i
// return the middle value
- if(length % 2 != 0)
+ if ( length%2!=0 )
return ordered_vals[(length-1)/2];
else
- return (ordered_vals[(length/2)-1] + ordered_vals[length/2] + 1) >> 1;
+ return (ordered_vals[(length/2)-1]+ordered_vals[length/2]+1)>>1;
}
/*************************************************************/
-void VFilter(PicArray& pic_data, const OneDArray<int>& filter, const int bits);
-void HFilter(PicArray& pic_data, const OneDArray<int>& filter, const int bits);
+void VFilter( PicArray& pic_data, const OneDArray<int>& filter, const int bits );
+void HFilter( PicArray& pic_data, const OneDArray<int>& filter, const int bits );
-double sinxoverx(const double val)
+double sinxoverx( const double val )
{
- if(0.0f == val)
+ if ( 0.0f == val )
return 1.0;
else
- return sin(val) / val;
+ return sin(val)/val;
}
-OneDArray<int> MakeLPRectFilter(const float bw, const int bits)
+OneDArray<int> MakeLPRectFilter( const float bw, const int bits )
{
const int tl = 8;
const float pi = 3.1415926535;
- OneDArray<double> double_filter(Range(-tl, tl));
- OneDArray<int> int_filter(Range(-tl, tl));
+ OneDArray<double> double_filter( Range( -tl, tl ) );
+ OneDArray<int> int_filter( Range( -tl, tl) );
// Use the Hanning window
- for(int i = double_filter.First(); i <= double_filter.Last(); ++i)
+ for (int i=double_filter.First(); i<=double_filter.Last(); ++i)
{
- double_filter[i] = cos((pi * i) /
- (double_filter.Length() + 1));
+ double_filter[i] = cos( (pi*i)/
+ (double_filter.Length()+1) );
}
// Apply sinc function
- for(int i = double_filter.First(); i <= double_filter.Last(); ++i)
+ for (int i=double_filter.First(); i<=double_filter.Last(); ++i)
{
- double_filter[i] *= sinxoverx(pi * 1.0 * bw * i);
+ double_filter[i] *= sinxoverx( pi*1.0*bw*i );
}
// Get DC gain = 1<<bits
double sum = 0.0;
- for(int i = double_filter.First(); i <= double_filter.Last(); ++i)
+ for (int i=double_filter.First(); i<=double_filter.Last(); ++i)
sum += double_filter[i];
- for(int i = double_filter.First(); i <= double_filter.Last(); ++i)
+ for (int i=double_filter.First(); i<=double_filter.Last(); ++i)
{
- double_filter[i] *= double(1 << (bits + 4));
+ double_filter[i] *= double(1<<(bits+4));
double_filter[i] /= sum;
}
// Turn the float filter into an integer filter
- for(int i = double_filter.First(); i <= double_filter.Last(); ++i)
+ for (int i=double_filter.First(); i<=double_filter.Last(); ++i)
{
- int_filter[i] = double_filter[i] > 0 ? int(double_filter[i] + 0.5) : -int(-double_filter[i] + 0.5);
- int_filter[i] = (int_filter[i] + 8) >> 4;
+ int_filter[i] = double_filter[i]>0 ? int( double_filter[i]+0.5 ) : -int( -double_filter[i]+0.5 );
+ int_filter[i] = (int_filter[i]+8)>>4;
}
return int_filter;
}
-void dirac::LPFilter(PicArray& pic_data, const float qf, const int strength)
+void dirac::LPFilter( PicArray& pic_data, const float qf, const int strength )
{
- float bw = (std::min(std::max(qf + 3.0f - float(strength), 1.0f), 10.0f)) / 10.0;
+ float bw = (std::min( std::max( qf+3.0f-float(strength), 1.0f ), 10.0f ))/10.0;
// filter with 14-bit accuracy
- OneDArray<int> filter = MakeLPRectFilter(bw, 14);
+ OneDArray<int> filter=MakeLPRectFilter(bw, 14);
- HFilter(pic_data, filter, 14);
- VFilter(pic_data, filter, 14);
+ HFilter( pic_data, filter, 14 );
+ VFilter( pic_data, filter, 14 );
}
-void HFilter(PicArray& pic_data, const OneDArray<int>& filter, const int bits)
+void HFilter( PicArray& pic_data, const OneDArray<int>& filter, const int bits )
{
ValueType* line_data = new ValueType[pic_data.LengthX()];
- const int offset = (1 << (bits - 1));
+ const int offset = (1<<(bits-1));
int sum;
- for(int j = 0; j < pic_data.LengthY(); ++j)
+ for (int j=0; j<pic_data.LengthY(); ++j)
{
// Do the first bit
- for(int i = 0; i < filter.Last(); ++i)
+ for (int i=0; i<filter.Last(); ++i)
{
sum = offset;
- for(int k = filter.Last(); k >= filter.First(); --k)
- sum += filter[k] * pic_data[j][std::max(i-k, 0)];
+ for (int k=filter.Last(); k>=filter.First(); --k)
+ sum += filter[k]*pic_data[j][std::max(i-k,0)];
sum >>= bits;
- sum = std::min(127, std::max(-128, sum));
- line_data[i] = ValueType(sum);
+ sum = std::min( 127, std::max( -128, sum) );
+ line_data[i] = ValueType( sum );
}// i
// Do the middle bit
- for(int i = filter.Last(); i <= pic_data.LastX() + filter.First(); ++i)
+ for (int i=filter.Last(); i<=pic_data.LastX()+filter.First(); ++i)
{
sum = offset;
- for(int k = filter.Last(); k >= filter.First(); --k)
- sum += filter[k] * pic_data[j][i-k];
+ for (int k=filter.Last(); k>=filter.First(); --k)
+ sum += filter[k]*pic_data[j][i-k];
sum >>= bits;
- sum = std::min(127, std::max(-128, sum));
- line_data[i] = ValueType(sum);
+ sum = std::min( 127, std::max( -128, sum) );
+ line_data[i] = ValueType( sum );
}// i
// Do the last bit
- for(int i = pic_data.LastX() + filter.First() + 1; i < pic_data.LengthX(); ++i)
+ for (int i=pic_data.LastX()+filter.First()+1; i<pic_data.LengthX(); ++i)
{
sum = offset;
- for(int k = filter.Last(); k >= filter.First(); --k)
- sum += filter[k] * pic_data[j][std::min(i-k, pic_data.LastX())];
+ for (int k=filter.Last(); k>=filter.First(); --k)
+ sum += filter[k]*pic_data[j][std::min(i-k,pic_data.LastX())];
sum >>= bits;
- sum = std::min(127, std::max(-128, sum));
- line_data[i] = ValueType(sum);
+ sum = std::min( 127, std::max( -128, sum) );
+ line_data[i] = ValueType( sum );
}// i
// Copy data back
- for(int i = 0; i < pic_data.LengthX(); ++i)
+ for (int i=0; i<pic_data.LengthX(); ++i )
pic_data[j][i] = line_data[i];
}// j
@@ -246,57 +242,57 @@ void HFilter(PicArray& pic_data, const OneDArray<int>& filter, const int bits)
delete[] line_data;
}
-void VFilter(PicArray& pic_data, const OneDArray<int>& filter, const int bits)
+void VFilter( PicArray& pic_data, const OneDArray<int>& filter, const int bits )
{
- PicArray tmp_data(pic_data);
- const int offset = (1 << (bits - 1));
+ PicArray tmp_data( pic_data );
+ const int offset = (1<<(bits-1));
int sum;
// Do the first bit
- for(int j = 0; j < filter.Last(); ++j)
+ for (int j=0; j<filter.Last(); ++j)
{
- for(int i = 0; i < pic_data.LengthX(); ++i)
+ for (int i=0; i<pic_data.LengthX(); ++i)
{
sum = offset;
- for(int k = filter.Last(); k >= filter.First(); --k)
- sum += filter[k] * pic_data[std::max(j-k, 0)][i];
+ for (int k=filter.Last(); k>=filter.First(); --k)
+ sum += filter[k]*pic_data[std::max(j-k,0)][i];
sum >>= bits;
- sum = std::min(127, std::max(-128, sum));
- tmp_data[j][i] = ValueType(sum);
+ sum = std::min( 127, std::max( -128, sum) );
+ tmp_data[j][i] = ValueType( sum );
}// i
}// j
// Do the middle bit
- for(int j = filter.Last(); j <= pic_data.LastY() + filter.First(); ++j)
+ for (int j=filter.Last(); j<=pic_data.LastY()+filter.First(); ++j)
{
- for(int i = 0; i < pic_data.LengthX(); ++i)
+ for (int i=0; i<pic_data.LengthX(); ++i)
{
sum = offset;
- for(int k = filter.Last(); k >= filter.First(); --k)
- sum += filter[k] * pic_data[j-k][i];
+ for (int k=filter.Last(); k>=filter.First(); --k)
+ sum += filter[k]*pic_data[j-k][i];
sum >>= bits;
- sum = std::min(127, std::max(-128, sum));
- tmp_data[j][i] = ValueType(sum);
+ sum = std::min( 127, std::max( -128, sum) );
+ tmp_data[j][i] = ValueType( sum );
}// i
}// j
// Do the last bit
- for(int j = pic_data.LastY() + filter.First() + 1; j < pic_data.LengthY(); ++j)
+ for (int j=pic_data.LastY()+filter.First()+1; j<pic_data.LengthY(); ++j)
{
- for(int i = 0; i < pic_data.LengthX(); ++i)
+ for (int i=0; i<pic_data.LengthX(); ++i)
{
sum = offset;
- for(int k = filter.Last(); k >= filter.First(); --k)
- sum += filter[k] * pic_data[std::min(j-k, pic_data.LastY())][i];
+ for (int k=filter.Last(); k>=filter.First(); --k)
+ sum += filter[k]*pic_data[std::min(j-k,pic_data.LastY())][i];
sum >>= bits;
- sum = std::min(127, std::max(-128, sum));
- tmp_data[j][i] = ValueType(sum);
+ sum = std::min( 127, std::max( -128, sum) );
+ tmp_data[j][i] = ValueType( sum );
}// i
}// j
@@ -308,10 +304,10 @@ void VFilter(PicArray& pic_data, const OneDArray<int>& filter, const int bits)
/***************************************************************************/
-ValueType DiagFilterBchkD(const PicArray& pic,
- const int xpos, const int ypos,
- const TwoDArray<int>& filter,
- const int shift)
+ValueType DiagFilterBchkD( const PicArray& pic,
+ const int xpos, const int ypos,
+ const TwoDArray<int>& filter,
+ const int shift)
{
// Half the filter length
const int len2 = 6;
@@ -320,40 +316,37 @@ ValueType DiagFilterBchkD(const PicArray& pic,
const int width = pic.LengthX();
int uplus, uneg, vplus, vneg;
- int val = (1 << (shift - 1));
+ int val = (1<<(shift-1));
// Do 0 position horizontally
- val += filter[0][0] * pic[ypos][xpos];
+ val += filter[0][0]*pic[ypos][xpos];
- for(int i = 1; i <= len2; ++i)
- {
- uplus = xpos + i;
- uplus = (uplus >= width ? width - 1 : uplus);
- uneg = xpos - i;
- uneg = (uneg < 0 ? 0 : uneg);
- val += filter[0][i] * (pic[ypos][uplus] + pic[ypos][uneg]);
+ for (int i=1; i<=len2;++i){
+ uplus = xpos + i;
+ uplus = (uplus>=width ? width-1 : uplus);
+ uneg = xpos - i;
+ uneg = (uneg<0 ? 0 : uneg );
+ val += filter[0][i]*(pic[ypos][uplus]+pic[ypos][uneg] );
}
// Do other positions vertically//
//////////////////////////////////
- for(int j = 1; j <= len2; ++j)
- {
+ for (int j=1; j<=len2;++j){
vplus = ypos + j;
- vplus = (vplus >= height ? height - 1 : vplus);
+ vplus = ( vplus>=height ? height-1 : vplus);
vneg = ypos - j;
- vneg = (vneg < 0 ? 0 : vneg);
+ vneg = (vneg<0 ? 0 : vneg );
// Do 0 position horizontally
- val += filter[j][0] * (pic[vneg][xpos] + pic[vplus][xpos]);
- for(int i = 1; i <= len2; ++i)
- {
+ val += filter[j][0]*(pic[vneg][xpos]+pic[vplus][xpos]);
+ for (int i=1; i<=len2;++i){
uplus = xpos + i;
- uplus = (uplus >= width ? width - 1 : uplus);
+ uplus = (uplus>=width ? width-1 : uplus);
uneg = xpos - i;
- uneg = (uneg < 0 ? 0 : uneg);
- val += filter[j][i] * (pic[vneg][uplus] + pic[vneg][uneg] +
- pic[vplus][uplus] + pic[vplus][uneg]);
+ uneg = (uneg<0 ? 0 : uneg );
+ val += filter[j][i]*(pic[vneg][uplus]+pic[vneg][uneg]+
+ pic[vplus][uplus]+pic[vplus][uneg] );
}
}
@@ -362,43 +355,40 @@ ValueType DiagFilterBchkD(const PicArray& pic,
return ValueType(val);
}
-ValueType DiagFilterD(const PicArray& pic,
- const int xpos, const int ypos,
- const TwoDArray<int>& filter,
- const int shift)
+ValueType DiagFilterD( const PicArray& pic,
+ const int xpos, const int ypos,
+ const TwoDArray<int>& filter,
+ const int shift)
{
// Half the filter length
const int len2 = 6;
int uplus, uneg, vplus, vneg;
- int val = (1 << (shift - 1));
+ int val = (1<<(shift-1));
// Do 0 position horizontally
- val += filter[0][0] * pic[ypos][xpos];
+ val += filter[0][0]*pic[ypos][xpos];
- for(int i = 1; i <= len2; ++i)
- {
- uplus = xpos + i;
- uneg = xpos - i;
- val += filter[0][i] * (pic[ypos][uplus] + pic[ypos][uneg]);
+ for (int i=1; i<=len2;++i){
+ uplus = xpos + i;
+ uneg = xpos - i;
+ val += filter[0][i]*(pic[ypos][uplus]+pic[ypos][uneg] );
}
// Do other positions vertically//
//////////////////////////////////
- for(int j = 1; j <= len2; ++j)
- {
+ for (int j=1; j<=len2;++j){
vplus = ypos + j;
vneg = ypos - j;
// Do 0 position horizontally
- val += filter[j][0] * (pic[vneg][xpos] + pic[vplus][xpos]);
- for(int i = 1; i <= len2; ++i)
- {
+ val += filter[j][0]*(pic[vneg][xpos]+pic[vplus][xpos]);
+ for (int i=1; i<=len2;++i){
uplus = xpos + i;
uneg = xpos - i;
- val += filter[j][i] * (pic[vneg][uplus] + pic[vneg][uneg] +
- pic[vplus][uplus] + pic[vplus][uneg]);
+ val += filter[j][i]*(pic[vneg][uplus]+pic[vneg][uneg]+
+ pic[vplus][uplus]+pic[vplus][uneg] );
}
}
@@ -408,508 +398,127 @@ ValueType DiagFilterD(const PicArray& pic,
}
-TwoDArray<int> GetDiagLPFilter(const float bw)
+TwoDArray<int> GetDiagLPFilter( const float bw )
{
- TwoDArray<int> f(7, 7);
+ TwoDArray<int> f( 7, 7 );
// Bandwidth quantised to range 0.2-1
- int qbf = int(bw * 10.0 + 0.5);
- qbf = std::min(std::max(qbf, 2) , 10);
+ int qbf = int( bw*10.0 + 0.5 );
+ qbf = std::min( std::max( qbf, 2 ) , 10 );
- switch(qbf)
- {
+ switch (qbf){
case 1 :
- f[0][0] = 1651;
- f[0][1] = 1544;
- f[0][2] = 1259;
- f[0][3] = 887;
- f[0][4] = 530;
- f[0][5] = 260;
- f[0][6] = 99;
- f[1][0] = 1544;
- f[1][1] = 1442;
- f[1][2] = 1170;
- f[1][3] = 817;
- f[1][4] = 480;
- f[1][5] = 229;
- f[1][6] = 83;
- f[2][0] = 1259;
- f[2][1] = 1170;
- f[2][2] = 935;
- f[2][3] = 634;
- f[2][4] = 354;
- f[2][5] = 153;
- f[2][6] = 45;
- f[3][0] = 887;
- f[3][1] = 817;
- f[3][2] = 634;
- f[3][3] = 405;
- f[3][4] = 202;
- f[3][5] = 70;
- f[3][6] = 11;
- f[4][0] = 530;
- f[4][1] = 480;
- f[4][2] = 354;
- f[4][3] = 202;
- f[4][4] = 80;
- f[4][5] = 15;
- f[4][6] = 0;
- f[5][0] = 260;
- f[5][1] = 229;
- f[5][2] = 153;
- f[5][3] = 70;
- f[5][4] = 15;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 99;
- f[6][1] = 83;
- f[6][2] = 45;
- f[6][3] = 11;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=1651; f[0][1]=1544; f[0][2]=1259; f[0][3]=887; f[0][4]=530; f[0][5]=260; f[0][6]=99;
+ f[1][0]=1544; f[1][1]=1442; f[1][2]=1170; f[1][3]=817; f[1][4]=480; f[1][5]=229; f[1][6]=83;
+ f[2][0]=1259; f[2][1]=1170; f[2][2]=935; f[2][3]=634; f[2][4]=354; f[2][5]=153; f[2][6]=45;
+ f[3][0]=887; f[3][1]=817; f[3][2]=634; f[3][3]=405; f[3][4]=202; f[3][5]=70; f[3][6]=11;
+ f[4][0]=530; f[4][1]=480; f[4][2]=354; f[4][3]=202; f[4][4]=80; f[4][5]=15; f[4][6]=0;
+ f[5][0]=260; f[5][1]=229; f[5][2]=153; f[5][3]=70; f[5][4]=15; f[5][5]=0; f[5][6]=0;
+ f[6][0]=99; f[6][1]=83; f[6][2]=45; f[6][3]=11; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 2:
- f[0][0] = 2855;
- f[0][1] = 2540;
- f[0][2] = 1775;
- f[0][3] = 947;
- f[0][4] = 364;
- f[0][5] = 89;
- f[0][6] = 10;
- f[1][0] = 2540;
- f[1][1] = 2251;
- f[1][2] = 1551;
- f[1][3] = 804;
- f[1][4] = 290;
- f[1][5] = 59;
- f[1][6] = 1;
- f[2][0] = 1775;
- f[2][1] = 1551;
- f[2][2] = 1020;
- f[2][3] = 475;
- f[2][4] = 130;
- f[2][5] = 3;
- f[2][6] = -10;
- f[3][0] = 947;
- f[3][1] = 804;
- f[3][2] = 475;
- f[3][3] = 165;
- f[3][4] = 5;
- f[3][5] = -22;
- f[3][6] = -6;
- f[4][0] = 364;
- f[4][1] = 290;
- f[4][2] = 130;
- f[4][3] = 5;
- f[4][4] = -28;
- f[4][5] = -10;
- f[4][6] = 0;
- f[5][0] = 89;
- f[5][1] = 59;
- f[5][2] = 3;
- f[5][3] = -22;
- f[5][4] = -10;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 10;
- f[6][1] = 1;
- f[6][2] = -10;
- f[6][3] = -6;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=2855; f[0][1]=2540; f[0][2]=1775; f[0][3]=947; f[0][4]=364; f[0][5]=89; f[0][6]=10;
+ f[1][0]=2540; f[1][1]=2251; f[1][2]=1551; f[1][3]=804; f[1][4]=290; f[1][5]=59; f[1][6]=1;
+ f[2][0]=1775; f[2][1]=1551; f[2][2]=1020; f[2][3]=475; f[2][4]=130; f[2][5]=3; f[2][6]=-10;
+ f[3][0]=947; f[3][1]=804; f[3][2]=475; f[3][3]=165; f[3][4]=5; f[3][5]=-22; f[3][6]=-6;
+ f[4][0]=364; f[4][1]=290; f[4][2]=130; f[4][3]=5; f[4][4]=-28; f[4][5]=-10; f[4][6]=0;
+ f[5][0]=89; f[5][1]=59; f[5][2]=3; f[5][3]=-22; f[5][4]=-10; f[5][5]=0; f[5][6]=0;
+ f[6][0]=10; f[6][1]=1; f[6][2]=-10; f[6][3]=-6; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 3:
- f[0][0] = 5767;
- f[0][1] = 4718;
- f[0][2] = 2498;
- f[0][3] = 745;
- f[0][4] = 72;
- f[0][5] = 5;
- f[0][6] = 23;
- f[1][0] = 4718;
- f[1][1] = 3796;
- f[1][2] = 1875;
- f[1][3] = 423;
- f[1][4] = -58;
- f[1][5] = -41;
- f[1][6] = 7;
- f[2][0] = 2498;
- f[2][1] = 1875;
- f[2][2] = 643;
- f[2][3] = -146;
- f[2][4] = -241;
- f[2][5] = -88;
- f[2][6] = -9;
- f[3][0] = 745;
- f[3][1] = 423;
- f[3][2] = -146;
- f[3][3] = -367;
- f[3][4] = -220;
- f[3][5] = -51;
- f[3][6] = -2;
- f[4][0] = 72;
- f[4][1] = -58;
- f[4][2] = -241;
- f[4][3] = -220;
- f[4][4] = -78;
- f[4][5] = -5;
- f[4][6] = 0;
- f[5][0] = 5;
- f[5][1] = -41;
- f[5][2] = -88;
- f[5][3] = -51;
- f[5][4] = -5;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 23;
- f[6][1] = 7;
- f[6][2] = -9;
- f[6][3] = -2;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=5767; f[0][1]=4718; f[0][2]=2498; f[0][3]=745; f[0][4]=72; f[0][5]=5; f[0][6]=23;
+ f[1][0]=4718; f[1][1]=3796; f[1][2]=1875; f[1][3]=423; f[1][4]=-58; f[1][5]=-41; f[1][6]=7;
+ f[2][0]=2498; f[2][1]=1875; f[2][2]=643; f[2][3]=-146; f[2][4]=-241; f[2][5]=-88; f[2][6]=-9;
+ f[3][0]=745; f[3][1]=423; f[3][2]=-146; f[3][3]=-367; f[3][4]=-220; f[3][5]=-51; f[3][6]=-2;
+ f[4][0]=72; f[4][1]=-58; f[4][2]=-241; f[4][3]=-220; f[4][4]=-78; f[4][5]=-5; f[4][6]=0;
+ f[5][0]=5; f[5][1]=-41; f[5][2]=-88; f[5][3]=-51; f[5][4]=-5; f[5][5]=0; f[5][6]=0;
+ f[6][0]=23; f[6][1]=7; f[6][2]=-9; f[6][3]=-2; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 4:
- f[0][0] = 10534;
- f[0][1] = 7642;
- f[0][2] = 2603;
- f[0][3] = 194;
- f[0][4] = 56;
- f[0][5] = 120;
- f[0][6] = 28;
- f[1][0] = 7642;
- f[1][1] = 5237;
- f[1][2] = 1218;
- f[1][3] = -383;
- f[1][4] = -153;
- f[1][5] = 40;
- f[1][6] = 2;
- f[2][0] = 2603;
- f[2][1] = 1218;
- f[2][2] = -771;
- f[2][3] = -958;
- f[2][4] = -269;
- f[2][5] = -3;
- f[2][6] = -7;
- f[3][0] = 194;
- f[3][1] = -383;
- f[3][2] = -958;
- f[3][3] = -541;
- f[3][4] = -18;
- f[3][5] = 48;
- f[3][6] = 4;
- f[4][0] = 56;
- f[4][1] = -153;
- f[4][2] = -269;
- f[4][3] = -18;
- f[4][4] = 96;
- f[4][5] = 22;
- f[4][6] = 0;
- f[5][0] = 120;
- f[5][1] = 40;
- f[5][2] = -3;
- f[5][3] = 48;
- f[5][4] = 22;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 28;
- f[6][1] = 2;
- f[6][2] = -7;
- f[6][3] = 4;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=10534; f[0][1]=7642; f[0][2]=2603; f[0][3]=194; f[0][4]=56; f[0][5]=120; f[0][6]=28;
+ f[1][0]=7642; f[1][1]=5237; f[1][2]=1218; f[1][3]=-383; f[1][4]=-153; f[1][5]=40; f[1][6]=2;
+ f[2][0]=2603; f[2][1]=1218; f[2][2]=-771; f[2][3]=-958; f[2][4]=-269; f[2][5]=-3; f[2][6]=-7;
+ f[3][0]=194; f[3][1]=-383; f[3][2]=-958; f[3][3]=-541; f[3][4]=-18; f[3][5]=48; f[3][6]=4;
+ f[4][0]=56; f[4][1]=-153; f[4][2]=-269; f[4][3]=-18; f[4][4]=96; f[4][5]=22; f[4][6]=0;
+ f[5][0]=120; f[5][1]=40; f[5][2]=-3; f[5][3]=48; f[5][4]=22; f[5][5]=0; f[5][6]=0;
+ f[6][0]=28; f[6][1]=2; f[6][2]=-7; f[6][3]=4; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 5 :
- f[0][0] = 16421;
- f[0][1] = 10159;
- f[0][2] = 1716;
- f[0][3] = 33;
- f[0][4] = 325;
- f[0][5] = 57;
- f[0][6] = 6;
- f[1][0] = 10159;
- f[1][1] = 5309;
- f[1][2] = -580;
- f[1][3] = -747;
- f[1][4] = 44;
- f[1][5] = -43;
- f[1][6] = -25;
- f[2][0] = 1716;
- f[2][1] = -580;
- f[2][2] = -2310;
- f[2][3] = -763;
- f[2][4] = 100;
- f[2][5] = -19;
- f[2][6] = -12;
- f[3][0] = 33;
- f[3][1] = -747;
- f[3][2] = -763;
- f[3][3] = 308;
- f[3][4] = 326;
- f[3][5] = 27;
- f[3][6] = 1;
- f[4][0] = 325;
- f[4][1] = 44;
- f[4][2] = 100;
- f[4][3] = 326;
- f[4][4] = 84;
- f[4][5] = -14;
- f[4][6] = 0;
- f[5][0] = 57;
- f[5][1] = -43;
- f[5][2] = -19;
- f[5][3] = 27;
- f[5][4] = -14;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 6;
- f[6][1] = -25;
- f[6][2] = -12;
- f[6][3] = 1;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=16421; f[0][1]=10159; f[0][2]=1716; f[0][3]=33; f[0][4]=325; f[0][5]=57; f[0][6]=6;
+ f[1][0]=10159; f[1][1]=5309; f[1][2]=-580; f[1][3]=-747; f[1][4]=44; f[1][5]=-43; f[1][6]=-25;
+ f[2][0]=1716; f[2][1]=-580; f[2][2]=-2310; f[2][3]=-763; f[2][4]=100; f[2][5]=-19; f[2][6]=-12;
+ f[3][0]=33; f[3][1]=-747; f[3][2]=-763; f[3][3]=308; f[3][4]=326; f[3][5]=27; f[3][6]=1;
+ f[4][0]=325; f[4][1]=44; f[4][2]=100; f[4][3]=326; f[4][4]=84; f[4][5]=-14; f[4][6]=0;
+ f[5][0]=57; f[5][1]=-43; f[5][2]=-19; f[5][3]=27; f[5][4]=-14; f[5][5]=0; f[5][6]=0;
+ f[6][0]=6; f[6][1]=-25; f[6][2]=-12; f[6][3]=1; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 6 :
- f[0][0] = 23511;
- f[0][1] = 11883;
- f[0][2] = 566;
- f[0][3] = 524;
- f[0][4] = 231;
- f[0][5] = 18;
- f[0][6] = 41;
- f[1][0] = 11883;
- f[1][1] = 3647;
- f[1][2] = -2496;
- f[1][3] = -361;
- f[1][4] = -96;
- f[1][5] = -97;
- f[1][6] = 1;
- f[2][0] = 566;
- f[2][1] = -2496;
- f[2][2] = -2329;
- f[2][3] = 459;
- f[2][4] = 152;
- f[2][5] = -7;
- f[2][6] = 18;
- f[3][0] = 524;
- f[3][1] = -361;
- f[3][2] = 459;
- f[3][3] = 979;
- f[3][4] = 33;
- f[3][5] = -28;
- f[3][6] = 3;
- f[4][0] = 231;
- f[4][1] = -96;
- f[4][2] = 152;
- f[4][3] = 33;
- f[4][4] = -184;
- f[4][5] = -15;
- f[4][6] = 0;
- f[5][0] = 18;
- f[5][1] = -97;
- f[5][2] = -7;
- f[5][3] = -28;
- f[5][4] = -15;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 41;
- f[6][1] = 1;
- f[6][2] = 18;
- f[6][3] = 3;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=23511; f[0][1]=11883; f[0][2]=566; f[0][3]=524; f[0][4]=231; f[0][5]=18; f[0][6]=41;
+ f[1][0]= 11883; f[1][1]=3647; f[1][2]=-2496; f[1][3]=-361; f[1][4]=-96; f[1][5]=-97; f[1][6]=1;
+ f[2][0]=566; f[2][1]=-2496; f[2][2]=-2329; f[2][3]=459; f[2][4]=152; f[2][5]=-7; f[2][6]=18;
+ f[3][0]=524; f[3][1]=-361; f[3][2]=459; f[3][3]=979; f[3][4]=33; f[3][5]=-28; f[3][6]=3;
+ f[4][0]=231; f[4][1]=-96; f[4][2]=152; f[4][3]=33; f[4][4]=-184; f[4][5]=-15; f[4][6]=0;
+ f[5][0]=18; f[5][1]=-97; f[5][2]=-7; f[5][3]=-28; f[5][4]=-15; f[5][5]=0; f[5][6]=0;
+ f[6][0]=41; f[6][1]=1; f[6][2]=18; f[6][3]=3; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 7 :
- f[0][0] = 32188;
- f[0][1] = 12652;
- f[0][2] = 3;
- f[0][3] = 921;
- f[0][4] = 1;
- f[0][5] = 128;
- f[0][6] = 0;
- f[1][0] = 12652;
- f[1][1] = 295;
- f[1][2] = -3414;
- f[1][3] = -2;
- f[1][4] = -343;
- f[1][5] = -1;
- f[1][6] = -37;
- f[2][0] = 3;
- f[2][1] = -3414;
- f[2][2] = -212;
- f[2][3] = 1273;
- f[2][4] = 1;
- f[2][5] = 98;
- f[2][6] = 0;
- f[3][0] = 921;
- f[3][1] = -2;
- f[3][2] = 1273;
- f[3][3] = 110;
- f[3][4] = -363;
- f[3][5] = 0;
- f[3][6] = -8;
- f[4][0] = 1;
- f[4][1] = -343;
- f[4][2] = 1;
- f[4][3] = -363;
- f[4][4] = -29;
- f[4][5] = 29;
- f[4][6] = 0;
- f[5][0] = 128;
- f[5][1] = -1;
- f[5][2] = 98;
- f[5][3] = 0;
- f[5][4] = 29;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 0;
- f[6][1] = -37;
- f[6][2] = 0;
- f[6][3] = -8;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=32188; f[0][1]=12652; f[0][2]=3; f[0][3]=921; f[0][4]=1; f[0][5]=128; f[0][6]=0;
+ f[1][0]=12652; f[1][1]=295; f[1][2]=-3414; f[1][3]=-2; f[1][4]=-343; f[1][5]=-1; f[1][6]=-37;
+ f[2][0]=3; f[2][1]=-3414; f[2][2]=-212; f[2][3]=1273; f[2][4]=1; f[2][5]=98; f[2][6]=0;
+ f[3][0]=921; f[3][1]=-2; f[3][2]=1273; f[3][3]=110; f[3][4]=-363; f[3][5]=0; f[3][6]=-8;
+ f[4][0]=1; f[4][1]=-343; f[4][2]=1; f[4][3]=-363; f[4][4]=-29; f[4][5]=29; f[4][6]=0;
+ f[5][0]=128; f[5][1]=-1; f[5][2]=98; f[5][3]=0; f[5][4]=29; f[5][5]=0; f[5][6]=0;
+ f[6][0]=0; f[6][1]=-37; f[6][2]=0; f[6][3]=-8; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 8 :
- f[0][0] = 41902;
- f[0][1] = 12084;
- f[0][2] = 435;
- f[0][3] = 610;
- f[0][4] = 188;
- f[0][5] = 34;
- f[0][6] = 37;
- f[1][0] = 12084;
- f[1][1] = -4268;
- f[1][2] = -2715;
- f[1][3] = -286;
- f[1][4] = -144;
- f[1][5] = -84;
- f[1][6] = -2;
- f[2][0] = 435;
- f[2][1] = -2715;
- f[2][2] = 2809;
- f[2][3] = 640;
- f[2][4] = 127;
- f[2][5] = 10;
- f[2][6] = 17;
- f[3][0] = 610;
- f[3][1] = -286;
- f[3][2] = 640;
- f[3][3] = -1250;
- f[3][4] = -45;
- f[3][5] = -26;
- f[3][6] = 2;
- f[4][0] = 188;
- f[4][1] = -144;
- f[4][2] = 127;
- f[4][3] = -45;
- f[4][4] = 259;
- f[4][5] = -8;
- f[4][6] = 0;
- f[5][0] = 34;
- f[5][1] = -84;
- f[5][2] = 10;
- f[5][3] = -26;
- f[5][4] = -8;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 37;
- f[6][1] = -2;
- f[6][2] = 17;
- f[6][3] = 2;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=41902; f[0][1]=12084; f[0][2]=435; f[0][3]=610; f[0][4]=188; f[0][5]=34; f[0][6]=37;
+ f[1][0]=12084; f[1][1]=-4268; f[1][2]=-2715; f[1][3]=-286; f[1][4]=-144; f[1][5]=-84; f[1][6]=-2;
+ f[2][0]=435; f[2][1]=-2715; f[2][2]=2809; f[2][3]=640; f[2][4]=127; f[2][5]=10; f[2][6]=17;
+ f[3][0]=610; f[3][1]=-286; f[3][2]=640; f[3][3]=-1250; f[3][4]=-45; f[3][5]=-26; f[3][6]=2;
+ f[4][0]=188; f[4][1]=-144; f[4][2]=127; f[4][3]=-45; f[4][4]=259; f[4][5]=-8; f[4][6]=0;
+ f[5][0]=34; f[5][1]=-84; f[5][2]=10; f[5][3]=-26; f[5][4]=-8; f[5][5]=0; f[5][6]=0;
+ f[6][0]=37; f[6][1]=-2; f[6][2]=17; f[6][3]=2; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
case 9 :
- f[0][0] = 53098;
- f[0][1] = 10449;
- f[0][2] = 1546;
- f[0][3] = 73;
- f[0][4] = 342;
- f[0][5] = 38;
- f[0][6] = 12;
- f[1][0] = 10449;
- f[1][1] = -9060;
- f[1][2] = -873;
- f[1][3] = -727;
- f[1][4] = 52;
- f[1][5] = -65;
- f[1][6] = -20;
- f[2][0] = 1546;
- f[2][1] = -873;
- f[2][2] = 4261;
- f[2][3] = -627;
- f[2][4] = 137;
- f[2][5] = -27;
- f[2][6] = -7;
- f[3][0] = 73;
- f[3][1] = -727;
- f[3][2] = -627;
- f[3][3] = -804;
- f[3][4] = 328;
- f[3][5] = 14;
- f[3][6] = 2;
- f[4][0] = 342;
- f[4][1] = 52;
- f[4][2] = 137;
- f[4][3] = 328;
- f[4][4] = -83;
- f[4][5] = -20;
- f[4][6] = 0;
- f[5][0] = 38;
- f[5][1] = -65;
- f[5][2] = -27;
- f[5][3] = 14;
- f[5][4] = -20;
- f[5][5] = 0;
- f[5][6] = 0;
- f[6][0] = 12;
- f[6][1] = -20;
- f[6][2] = -7;
- f[6][3] = 2;
- f[6][4] = 0;
- f[6][5] = 0;
- f[6][6] = 0;
+ f[0][0]=53098; f[0][1]=10449; f[0][2]=1546; f[0][3]=73; f[0][4]=342; f[0][5]=38; f[0][6]=12;
+ f[1][0]=10449; f[1][1]=-9060; f[1][2]=-873; f[1][3]=-727; f[1][4]=52; f[1][5]=-65; f[1][6]=-20;
+ f[2][0]=1546; f[2][1]=-873; f[2][2]=4261; f[2][3]=-627; f[2][4]=137; f[2][5]=-27; f[2][6]=-7;
+ f[3][0]=73; f[3][1]=-727; f[3][2]=-627; f[3][3]=-804; f[3][4]=328; f[3][5]=14; f[3][6]=2;
+ f[4][0]=342; f[4][1]=52; f[4][2]=137; f[4][3]=328; f[4][4]=-83; f[4][5]=-20; f[4][6]=0;
+ f[5][0]=38; f[5][1]=-65; f[5][2]=-27; f[5][3]=14; f[5][4]=-20; f[5][5]=0; f[5][6]=0;
+ f[6][0]=12; f[6][1]=-20; f[6][2]=-7; f[6][3]=2; f[6][4]=0; f[6][5]=0; f[6][6]=0;
break;
default:// case 10
- for(int j = 0; j < f.LengthY(); ++j)
- {
- for(int i = 0; i < f.LengthX(); ++i)
- {
+ for (int j=0; j<f.LengthY(); ++j ){
+ for (int i=0; i<f.LengthX(); ++i ){
f[j][i] = 0;
}
}
@@ -923,59 +532,55 @@ TwoDArray<int> GetDiagLPFilter(const float bw)
// Does a diagnonal prefilter
-void dirac::DiagFilter(PicArray& pic_data, const float qf, const int strength)
-{
+void dirac::DiagFilter( PicArray& pic_data, const float qf, const int strength ){
// One quadrant of the filter taps
- float ffactor = (8.0 + strength - 4.0 - qf) / 5.0;
- int factor = std::max(0, std::min(256, int(ffactor * 256.0))) ;
+ float ffactor = (8.0+strength-4.0 - qf )/5.0;
+ int factor = std::max(0, std::min( 256, int( ffactor*256.0 ) ) ) ;
- float bw = (1.0 - ffactor) * 0.6 + 0.4;
+ float bw = (1.0-ffactor)*0.6+0.4;
//std::cout<<std::endl<<"Diagonal prefiltering with bandwidth = "<<bw;
- if(bw > 0.9)
+ if (bw>0.9)
return;
- TwoDArray<int> filter = GetDiagLPFilter(bw);
+ TwoDArray<int> filter = GetDiagLPFilter( bw );
- filter[0][0] = (factor * filter[0][0] + ((1 << 8) - factor) * (1 << 16) + (1 << 7)) >> 8;
+ filter[0][0] = ( factor*filter[0][0] + ( (1<<8)-factor )*(1<<16) + (1<<7) ) >> 8;
- for(int i = 1;
- i < 7;
- ++i)
- filter[0][i] = (factor * filter[0][i] + (1 << 7)) >> 8;
+ for (int i=1;i<7; ++i )
+ filter[0][i] = ( factor*filter[0][i] + (1<<7) ) >> 8;
- for(int j = 1; j < 7; ++j)
- for(int i = 0; i < 7; ++i)
- filter[j][i] = (factor * filter[j][i] + (1 << 7)) >> 8;
+ for (int j=1;j<7; ++j )
+ for (int i=0;i<7; ++i )
+ filter[j][i] = ( factor*filter[j][i] + (1<<7) ) >> 8;
- PicArray tmp_data(pic_data.LengthY(), pic_data.LengthX(), pic_data.CSort());
+ PicArray tmp_data( pic_data.LengthY(), pic_data.LengthX(), pic_data.CSort() );
const int shift = 16;
- for(int j = 0; j < 7; ++j)
- for(int i = 0; i < pic_data.LengthX(); ++i)
- tmp_data[j][i] = DiagFilterBchkD(pic_data, i, j, filter, shift);
+ for (int j=0; j<7;++j)
+ for (int i=0; i<pic_data.LengthX();++i)
+ tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift);
- for(int j = 7; j < pic_data.LengthY() - 7; ++j)
- {
- for(int i = 0; i < 7; ++i)
- tmp_data[j][i] = DiagFilterBchkD(pic_data, i, j, filter, shift);
+ for (int j=7; j<pic_data.LengthY()-7;++j){
+ for (int i=0; i<7;++i)
+ tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift );
- for(int i = 7; i < pic_data.LengthX() - 7; ++i)
- tmp_data[j][i] = DiagFilterD(pic_data, i, j, filter, shift);
+ for (int i=7; i<pic_data.LengthX()-7;++i)
+ tmp_data[j][i] = DiagFilterD( pic_data, i, j, filter, shift );
- for(int i = pic_data.LengthX() - 7; i < pic_data.LengthX(); ++i)
- tmp_data[j][i] = DiagFilterBchkD(pic_data, i, j, filter, shift);
+ for (int i=pic_data.LengthX()-7; i<pic_data.LengthX();++i)
+ tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift );
}
- for(int j = pic_data.LengthY() - 7; j < pic_data.LengthY(); ++j)
- for(int i = 0; i < pic_data.LengthX(); ++i)
- tmp_data[j][i] = DiagFilterBchkD(pic_data, i, j, filter, shift);
+ for (int j=pic_data.LengthY()-7; j<pic_data.LengthY();++j)
+ for (int i=0; i<pic_data.LengthX();++i)
+ tmp_data[j][i] = DiagFilterBchkD( pic_data, i, j, filter, shift );
pic_data = tmp_data;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.h
index 4fb8a975b..2a37c4aaf 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/prefilter.h
@@ -48,20 +48,20 @@ namespace dirac
/*************************************************************/
//! Denoises an input frame
-void CWMFilter(Picture& picture, const int strength);
+void CWMFilter( Picture& picture, const int strength );
-void CWMFilterComponent(PicArray& pic_data, const int strength);
+void CWMFilterComponent( PicArray& pic_data, const int strength );
-ValueType Median(const ValueType* val_list, const int length);
+ValueType Median( const ValueType* val_list, const int length);
/*************************************************************/
//! Denoises a component
-void LPFilter(PicArray& pic_data, const float qf, const int strength);
+void LPFilter( PicArray& pic_data, const float qf, const int strength );
//! Diagonally filters an input component
-void DiagFilter(PicArray& pic_data, const float qf , const int strength);
+void DiagFilter( PicArray& pic_data, const float qf , const int strength );
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.cpp
index d3f0c2893..93934f372 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.cpp
@@ -57,7 +57,7 @@ QualityMonitor::~QualityMonitor()
void QualityMonitor::ResetAll()
{
- for(int i = 0; i < 3 ; ++i)
+ for (int i=0; i<3 ; ++i )
{
m_mse_averageY[i] = 0.0;
m_mse_averageU[i] = 0.0;
@@ -72,102 +72,90 @@ void QualityMonitor::ResetAll()
void QualityMonitor::WriteLog()
{
- const double Ymax = double((1 << m_encparams.LumaDepth()) - 1);
- const double UVmax = double((1 << m_encparams.ChromaDepth()) - 1);
-
- std::cout << std::endl << "Overall mean PSNR values";
- std::cout << std::endl << "------------------------";
- std::cout << std::endl << "Y: ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(Ymax * Ymax / (m_totalmse_averageY / m_allpicture_total)) << std::endl;
- std::cout << std::endl << "U: ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_totalmse_averageU / m_allpicture_total)) << std::endl;
- std::cout << std::endl << "V: ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_totalmse_averageV / m_allpicture_total)) << std::endl;
-
-
- std::cout << std::endl << "Mean PSNR values by picture type and component";
- std::cout << std::endl << "--------------------------------------------";
- std::cout << std::endl;
-
- std::cout << std::endl << " || Y || U || V ||";
- std::cout << std::endl << "=================||===================================================";
- std::cout << std::endl << " Intra || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(Ymax * Ymax / (m_mse_averageY[0] / m_picture_total[0])) << " || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_mse_averageU[0] / m_picture_total[0])) << " || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_mse_averageV[0] / m_picture_total[0])) << " || ";
- std::cout << std::endl << "-----------------||---------------------------------------------------";
- std::cout << std::endl << " Inter Ref || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(Ymax * Ymax / (m_mse_averageY[1] / m_picture_total[1])) << " || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_mse_averageU[1] / m_picture_total[1])) << " || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_mse_averageV[1] / m_picture_total[1])) << " || ";
- std::cout << std::endl << "-----------------||---------------------------------------------------";
- std::cout << std::endl << " Inter Non Ref || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(Ymax * Ymax / (m_mse_averageY[2] / m_picture_total[2])) << " || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_mse_averageU[2] / m_picture_total[2])) << " || ";
- std::cout.width(5);
- std::cout.precision(4);
- std::cout << 10 * std::log10(UVmax * UVmax / (m_mse_averageV[2] / m_picture_total[2])) << " || ";
- std::cout << std::endl << "-----------------||---------------------------------------------------";
+ const double Ymax = double( (1<<m_encparams.LumaDepth())-1 );
+ const double UVmax = double( (1<<m_encparams.ChromaDepth())-1 );
+
+ std::cout<<std::endl<<"Overall mean PSNR values";
+ std::cout<<std::endl<<"------------------------";
+ std::cout<<std::endl<<"Y: ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(Ymax*Ymax/(m_totalmse_averageY/m_allpicture_total))<<std::endl;
+ std::cout<<std::endl<<"U: ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_totalmse_averageU/m_allpicture_total))<<std::endl;
+ std::cout<<std::endl<<"V: ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_totalmse_averageV/m_allpicture_total))<<std::endl;
+
+
+ std::cout<<std::endl<<"Mean PSNR values by picture type and component";
+ std::cout<<std::endl<<"--------------------------------------------";
+ std::cout<<std::endl;
+
+ std::cout<<std::endl<<" || Y || U || V ||";
+ std::cout<<std::endl<<"=================||===================================================";
+ std::cout<<std::endl<<" Intra || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(Ymax*Ymax/(m_mse_averageY[0]/m_picture_total[0]))<<" || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_mse_averageU[0]/m_picture_total[0]))<<" || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_mse_averageV[0]/m_picture_total[0]))<<" || ";
+ std::cout<<std::endl<<"-----------------||---------------------------------------------------";
+ std::cout<<std::endl<<" Inter Ref || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(Ymax*Ymax/(m_mse_averageY[1]/m_picture_total[1]))<<" || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_mse_averageU[1]/m_picture_total[1]))<<" || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_mse_averageV[1]/m_picture_total[1]))<<" || ";
+ std::cout<<std::endl<<"-----------------||---------------------------------------------------";
+ std::cout<<std::endl<<" Inter Non Ref || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(Ymax*Ymax/(m_mse_averageY[2]/m_picture_total[2]))<<" || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_mse_averageU[2]/m_picture_total[2]))<<" || ";
+ std::cout.width(5);std::cout.precision(4);
+ std::cout<<10*std::log10(UVmax*UVmax/(m_mse_averageV[2]/m_picture_total[2]))<<" || ";
+ std::cout<<std::endl<<"-----------------||---------------------------------------------------";
}
-void QualityMonitor::UpdateModel(const EncPicture& enc_picture)
+void QualityMonitor::UpdateModel(const EncPicture& enc_picture )
{
- const double Ymax = double((1 << m_encparams.LumaDepth()) - 1);
- const double UVmax = double((1 << m_encparams.ChromaDepth()) - 1);
+ const double Ymax = double( (1<<m_encparams.LumaDepth())-1 );
+ const double UVmax = double( (1<<m_encparams.ChromaDepth())-1 );
const PictureSort& psort = enc_picture.GetPparams().PicSort();
int idx = psort.IsIntra() ? 0 : (psort.IsRef() ? 1 : 2);
double fmseY, fmseU, fmseV;
- fmseY = QualityVal(enc_picture.Data(Y_COMP) , enc_picture.OrigData(Y_COMP),
- m_encparams.Xl(), m_encparams.Yl());
+ fmseY = QualityVal( enc_picture.Data(Y_COMP) , enc_picture.OrigData(Y_COMP),
+ m_encparams.Xl(), m_encparams.Yl());
m_mse_averageY[idx] += fmseY;
m_totalmse_averageY += fmseY;
- fmseU = QualityVal(enc_picture.Data(U_COMP) , enc_picture.OrigData(U_COMP),
- m_encparams.ChromaXl(),
- m_encparams.ChromaYl());
+ fmseU = QualityVal( enc_picture.Data(U_COMP) , enc_picture.OrigData(U_COMP),
+ m_encparams.ChromaXl(),
+ m_encparams.ChromaYl());
m_mse_averageU[idx] += fmseU;
m_totalmse_averageU += fmseU;
- fmseV = QualityVal(enc_picture.Data(V_COMP) , enc_picture.OrigData(V_COMP),
- m_encparams.ChromaXl(),
- m_encparams.ChromaYl());
+ fmseV = QualityVal( enc_picture.Data(V_COMP) , enc_picture.OrigData(V_COMP),
+ m_encparams.ChromaXl(),
+ m_encparams.ChromaYl());
m_mse_averageV[idx] += fmseV;
m_totalmse_averageV += fmseV;
m_picture_total[idx]++;
m_allpicture_total++;
- if(m_encparams.Verbose())
+ if (m_encparams.Verbose() )
{
- std::cout << std::endl << (!m_encparams.FieldCoding() ? "Frame" : "Field");
- std::cout << " PSNR: Y=" << 10.0 * std::log10(Ymax * Ymax / fmseY);
- std::cout << ", U=" << 10.0 * std::log10(UVmax * UVmax / fmseU);
- std::cout << ", V=" << 10.0 * std::log10(UVmax * UVmax / fmseV);
+ std::cout<<std::endl<< (!m_encparams.FieldCoding() ? "Frame" : "Field");
+ std::cout << " PSNR: Y="<<10.0 * std::log10( Ymax*Ymax / fmseY );
+ std::cout<<", U="<<10.0 * std::log10( UVmax*UVmax / fmseU );
+ std::cout<<", V="<<10.0 * std::log10( UVmax*UVmax / fmseV );
}
}
@@ -179,18 +167,18 @@ double QualityMonitor::QualityVal(const PicArray& coded_data,
{
long double sum_sq_diff = 0.0;
double diff;
- for(int j = 0; j < ylen; ++j)
+ for ( int j=0;j<ylen; ++j )
{
- for(int i = 0; i < xlen; ++i)
+ for ( int i=0;i<xlen; ++i )
{
diff = orig_data[j][i] - coded_data[j][i];
- sum_sq_diff += diff * diff;
+ sum_sq_diff += diff*diff;
}// i
}// j
- sum_sq_diff /= xlen * ylen;
+ sum_sq_diff /= xlen*ylen;
return (double) sum_sq_diff;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.h
index 7c2efc7b3..7f21a944d 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quality_monitor.h
@@ -44,80 +44,80 @@
namespace dirac
{
-//! Class to monitor the quality of pictures and adjust coding parameters appropriately
-class QualityMonitor
-{
-public:
+ //! Class to monitor the quality of pictures and adjust coding parameters appropriately
+ class QualityMonitor
+ {
+ public:
- //! Constructor. Sets up initial Lagrangian values
- /*
- Constructor sets up initial Lagrangian values.
- */
- QualityMonitor(EncoderParams& ep);
+ //! Constructor. Sets up initial Lagrangian values
+ /*
+ Constructor sets up initial Lagrangian values.
+ */
+ QualityMonitor(EncoderParams& ep);
- //! Destructor
- ~QualityMonitor();
+ //! Destructor
+ ~QualityMonitor();
- ////////////////////////////////////////////////////////////
- // //
- // Assumes default copy constructor, assignment = //
- // and destructor //
- ////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////
+ // //
+ // Assumes default copy constructor, assignment = //
+ // and destructor //
+ ////////////////////////////////////////////////////////////
- //! Update the mse factors, returning true if we need to recode
- /*!
- Update the mse factors, returning true if we need to recode
- \param enc_picture the picture being encoded
- */
- void UpdateModel(const EncPicture& enc_picture);
+ //! Update the mse factors, returning true if we need to recode
+ /*!
+ Update the mse factors, returning true if we need to recode
+ \param enc_picture the picture being encoded
+ */
+ void UpdateModel(const EncPicture& enc_picture );
- //! Reset the quality factors (say if there's been a cut)
- void ResetAll();
+ //! Reset the quality factors (say if there's been a cut)
+ void ResetAll();
- //! Write a log of the quality to date
- void WriteLog();
+ //! Write a log of the quality to date
+ void WriteLog();
-private:
- //functions
+ private:
+ //functions
- //! Calculate the quality of coded wrt original picture
- double QualityVal(const PicArray& coded_data ,
- const PicArray& orig_data,
- const int xlen,
- const int ylen);
+ //! Calculate the quality of coded wrt original picture
+ double QualityVal( const PicArray& coded_data ,
+ const PicArray& orig_data,
+ const int xlen,
+ const int ylen);
- //member variables//
- ////////////////////
+ //member variables//
+ ////////////////////
- //! A reference to the encoder parameters
- EncoderParams& m_encparams;
+ //! A reference to the encoder parameters
+ EncoderParams& m_encparams;
- //! The overall average Y mse
- long double m_totalmse_averageY;
+ //! The overall average Y mse
+ long double m_totalmse_averageY;
- //! The overall average U mse
- long double m_totalmse_averageU;
+ //! The overall average U mse
+ long double m_totalmse_averageU;
- //! The overall average V mse
- long double m_totalmse_averageV;
+ //! The overall average V mse
+ long double m_totalmse_averageV;
- //! The total number of pictures coded
- int m_allpicture_total;
+ //! The total number of pictures coded
+ int m_allpicture_total;
- //! The average Y mse for the picture types
- OneDArray<long double> m_mse_averageY;
+ //! The average Y mse for the picture types
+ OneDArray<long double> m_mse_averageY;
- //! The average U mse for the picture types
- OneDArray<long double> m_mse_averageU;
+ //! The average U mse for the picture types
+ OneDArray<long double> m_mse_averageU;
- //! The average V mse for the picture types
- OneDArray<long double> m_mse_averageV;
+ //! The average V mse for the picture types
+ OneDArray<long double> m_mse_averageV;
- //! The number of pictures of each type
- OneDArray<int> m_picture_total;
-};
+ //! The number of pictures of each type
+ OneDArray<int> m_picture_total;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.cpp
index 9708a5166..9f369ffe8 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.cpp
@@ -45,21 +45,21 @@
using namespace dirac;
// Custom 4th power, to speed things up
-static inline double pow4(double x)
+static inline double pow4 (double x)
{
- return x * x * x * x;
+ return x * x * x* x;
}
// Constructor
-QuantChooser::QuantChooser(const CoeffArray& coeff_data,
- const float lambda):
- m_coeff_data(coeff_data),
- m_lambda(lambda),
- m_entropy_correctionfactor(1.0)
+QuantChooser::QuantChooser( const CoeffArray& coeff_data,
+ const float lambda ):
+ m_coeff_data( coeff_data ),
+ m_lambda( lambda ),
+ m_entropy_correctionfactor( 1.0 )
{}
-int QuantChooser::GetBestQuant(Subband& node)
+int QuantChooser::GetBestQuant( Subband& node )
{
// NB : quantiser selection only supports a single quantiser per subband
// Setting MultiQuants=true and using this function will get the same
@@ -71,131 +71,131 @@ int QuantChooser::GetBestQuant(Subband& node)
CoeffType max_val;
// The index of the maximum bit of the largest value
- int max_bit(0);
+ int max_bit( 0 );
- max_val = BlockAbsMax(node);
+ max_val = BlockAbsMax( node );
- if(max_val >= 1)
- max_bit = int(std::floor(std::log(float(max_val)) / std::log(2.0)));
+ if ( max_val>=1 )
+ max_bit = int( std::floor( std::log( float( max_val ) )/std::log( 2.0 ) ) );
else
{
- // Exit saying 'Skip this subband' if there's no data in it
- node.SetSkip(true);
+ // Exit saying 'Skip this subband' if there's no data in it
+ node.SetSkip( true );
return 0;
}
// The number of quantisers to be tested
- int num_quants(4 * max_bit + 5);
+ int num_quants( 4 * max_bit + 5 );
// Set the array sizes
- m_costs.Resize(num_quants);
- m_count0.Resize(num_quants);
- m_count1 = node.Xl() * node.Yl();
- m_countPOS.Resize(num_quants);
- m_countNEG.Resize(num_quants);
- m_error_total.Resize(num_quants);
+ m_costs.Resize( num_quants );
+ m_count0.Resize( num_quants );
+ m_count1=node.Xl()*node.Yl();
+ m_countPOS.Resize( num_quants );
+ m_countNEG.Resize( num_quants );
+ m_error_total.Resize( num_quants );
// Total estimated bits for the subband
- double bit_sum(0.0);
+ double bit_sum( 0.0 );
// Step 1. Do integral bits first
m_bottom_idx = 0;
- m_top_idx = num_quants - 1;
+ m_top_idx = num_quants-1;
m_index_step = 4;
- IntegralErrorCalc(node, 2 , 2);
- LagrangianCalc();
+ IntegralErrorCalc( node, 2 , 2);
+ LagrangianCalc( );
SelectBestQuant();
// Step 2. Do 1/2-bit accuracy next
- m_bottom_idx = std::max(m_min_idx - 2 , 0);
- m_top_idx = std::min(m_min_idx + 2 , num_quants - 1);
+ m_bottom_idx = std::max( m_min_idx - 2 , 0 );
+ m_top_idx = std::min( m_min_idx + 2 , num_quants-1 );
m_index_step = 2;
- NonIntegralErrorCalc(node, 2 , 2);
- LagrangianCalc();
+ NonIntegralErrorCalc( node, 2 , 2);
+ LagrangianCalc( );
SelectBestQuant();
// Step 3. Finally, do 1/4-bit accuracy next
- m_bottom_idx = std::max(m_min_idx - 1 , 0);
- m_top_idx = std::min(m_min_idx + 1 , num_quants - 1);
+ m_bottom_idx = std::max( m_min_idx - 1 , 0 );
+ m_top_idx = std::min( m_min_idx + 1 , num_quants-1 );
m_index_step = 1;
- NonIntegralErrorCalc(node, 1 , 2);
- LagrangianCalc();
+ NonIntegralErrorCalc( node, 1 , 2);
+ LagrangianCalc( );
SelectBestQuant();
bit_sum = m_costs[m_min_idx].ENTROPY * node.Xl() * node.Yl();
- node.SetQuantIndex(m_min_idx);
+ node.SetQuantIndex( m_min_idx );
- TwoDArray<CodeBlock>& block_list(node.GetCodeBlocks());
+ TwoDArray<CodeBlock>& block_list( node.GetCodeBlocks() );
// Set the codeblock quantisers
- for(int j = 0 ; j < block_list.LengthY() ; ++j)
- for(int i = 0 ; i < block_list.LengthX() ; ++i)
- block_list[j][i].SetQuantIndex(m_min_idx);
+ for (int j=0 ; j<block_list.LengthY() ; ++j )
+ for (int i=0 ; i<block_list.LengthX() ; ++i )
+ block_list[j][i].SetQuantIndex( m_min_idx );
// Set the codeblock skip flags
- for(int j = 0 ; j < block_list.LengthY() ; ++j)
- for(int i = 0 ; i < block_list.LengthX() ; ++i)
- SetSkip(block_list[j][i], m_min_idx);
+ for (int j=0 ; j<block_list.LengthY() ; ++j )
+ for (int i=0 ; i<block_list.LengthX() ; ++i )
+ SetSkip( block_list[j][i], m_min_idx );
- return static_cast<int>(bit_sum);
+ return static_cast<int>( bit_sum );
}
-void QuantChooser::IntegralErrorCalc(Subband& node, const int xratio , const int yratio)
+void QuantChooser::IntegralErrorCalc( Subband& node, const int xratio , const int yratio )
{
CoeffType val, quant_val , abs_val;
CalcValueType error;
- m_count1 = ((node.Xl() / xratio) * (node.Yl() / yratio));
- for(int q = m_bottom_idx ; q <= m_top_idx ; q += 4)
+ m_count1 = ( (node.Xl()/xratio)*(node.Yl()/yratio) );
+ for (int q = m_bottom_idx ; q<=m_top_idx ; q+=4 )
{
m_error_total[q] = 0.0;
- m_count0[q] = 0;
+ m_count0[q] =0;
m_countPOS[q] = 0;
m_countNEG[q] = 0;
}
// Work out the error totals and counts for each quantiser
- for(int j = node.Yp(); j < node.Yp() + node.Yl() ; j += yratio)
+ for ( int j=node.Yp(); j<node.Yp()+node.Yl() ; j+=yratio )
{
- for(int i = node.Xp(); i < node.Xp() + node.Xl() ; i += xratio)
+ for ( int i=node.Xp(); i<node.Xp()+node.Xl() ; i+=xratio )
{
val = m_coeff_data[j][i];
abs_val = quant_val = abs(val);
int q = m_bottom_idx;
- for(; q <= m_top_idx ; q += 4)
+ for ( ; q<=m_top_idx ; q+=4 )
{
// Quantiser is 2^(q/4), so we divide by this
- quant_val >>= (q >> 2);
- if(!quant_val)
+ quant_val >>= (q>>2);
+ if (!quant_val)
break;
m_count0[q] += quant_val;
// Multiply back up so that we can quantise again in the next loop step
- quant_val <<= (q >> 2) + 2;
- quant_val += dirac_quantiser_lists.InterQuantOffset4(q) + 2;
+ quant_val <<= (q>>2)+2;
+ quant_val += dirac_quantiser_lists.InterQuantOffset4( q )+2;
quant_val >>= 2;
- if(val > 0)
+ if (val>0)
m_countPOS[q]++;
else
m_countNEG[q]++;
- error = abs_val - quant_val;
+ error = abs_val-quant_val;
// Using the fourth power to measure the error
- m_error_total[q] += pow4(static_cast<double>(error));
+ m_error_total[q] += pow4( static_cast<double>( error ) );
}// q
- double derror = pow4(static_cast<double>(abs_val));
- for(; q <= m_top_idx; q += 4)
+ double derror = pow4 ( static_cast<double>( abs_val ) );
+ for (; q <= m_top_idx; q+= 4)
{
m_error_total[q] += derror;
}
@@ -204,7 +204,7 @@ void QuantChooser::IntegralErrorCalc(Subband& node, const int xratio , const int
}
-void QuantChooser::NonIntegralErrorCalc(Subband& node , const int xratio , const int yratio)
+void QuantChooser::NonIntegralErrorCalc( Subband& node , const int xratio , const int yratio )
{
CoeffType val, abs_val;
@@ -212,51 +212,51 @@ void QuantChooser::NonIntegralErrorCalc(Subband& node , const int xratio , const
CalcValueType quant_val;
CalcValueType error;
- m_count1 = ((node.Xl() / xratio) * (node.Yl() / yratio));
- for(int q = m_bottom_idx ; q <= m_top_idx ; q += m_index_step)
+ m_count1 = ( (node.Xl()/xratio)*(node.Yl()/yratio) );
+ for (int q = m_bottom_idx ; q<=m_top_idx ; q+=m_index_step )
{
m_error_total[q] = 0.0;
- m_count0[q] = 0;
+ m_count0[q] =0;
m_countPOS[q] = 0;
m_countNEG[q] = 0;
}
// Work out the error totals and counts for each quantiser
- for(int j = node.Yp(); j < node.Yp() + node.Yl() ; j += yratio)
+ for ( int j=node.Yp(); j<node.Yp()+node.Yl() ; j+=yratio )
{
- for(int i = node.Xp(); i < node.Xp() + node.Xl() ; i += xratio)
+ for ( int i=node.Xp(); i<node.Xp()+node.Xl() ; i+=xratio )
{
val = m_coeff_data[j][i];
- abs_val = abs(val);
+ abs_val = abs( val );
- int q = m_bottom_idx;
- for(; q <= m_top_idx ; q += m_index_step)
+ int q=m_bottom_idx;
+ for ( ; q<=m_top_idx ; q+=m_index_step )
{
- // Since the quantiser isn't a power of 2 we have to divide each time
- quant_val = static_cast<CalcValueType>(abs_val);
- quant_val <<= 2;
- quant_val /= dirac_quantiser_lists.QuantFactor4(q);
-
- if(!quant_val)
- break;
-
- m_count0[q] += quant_val;
- quant_val *= dirac_quantiser_lists.QuantFactor4(q);
- quant_val += dirac_quantiser_lists.InterQuantOffset4(q) + 2;
- quant_val >>= 2;
-
- if(val > 0)
- m_countPOS[q]++;
- else
- m_countNEG[q]++;
-
- error = abs_val - quant_val;
- m_error_total[q] += pow4(error);
- }// q
- double derror = pow4(abs_val);
- for(; q <= m_top_idx; q += m_index_step)
- m_error_total[q] += derror;
+ // Since the quantiser isn't a power of 2 we have to divide each time
+ quant_val = static_cast<CalcValueType>( abs_val );
+ quant_val <<= 2;
+ quant_val /= dirac_quantiser_lists.QuantFactor4( q );
+
+ if ( !quant_val )
+ break;
+
+ m_count0[q] += quant_val;
+ quant_val *= dirac_quantiser_lists.QuantFactor4( q );
+ quant_val += dirac_quantiser_lists.InterQuantOffset4( q )+2;
+ quant_val >>= 2;
+
+ if ( val>0 )
+ m_countPOS[q]++;
+ else
+ m_countNEG[q]++;
+
+ error = abs_val-quant_val;
+ m_error_total[q] += pow4( error );
+ }// q
+ double derror = pow4( abs_val );
+ for ( ; q <= m_top_idx; q += m_index_step)
+ m_error_total[q] += derror;
}// i
}// j
@@ -267,52 +267,52 @@ void QuantChooser::LagrangianCalc()
{
// probabilities
- double p0, p1;
+ double p0,p1;
double sign_entropy;
- // Do Lagrangian costs calculation
- for(int q = m_bottom_idx ; q <= m_top_idx ; q += m_index_step)
+ // Do Lagrangian costs calculation
+ for ( int q=m_bottom_idx ; q<=m_top_idx ; q += m_index_step )
{
- m_costs[q].Error = m_error_total[q] / double(m_count1);
- m_costs[q].Error = std::sqrt(m_costs[q].Error) / (m_subband_wt * m_subband_wt);
+ m_costs[q].Error = m_error_total[q]/double(m_count1);
+ m_costs[q].Error = std::sqrt( m_costs[q].Error )/( m_subband_wt*m_subband_wt );
// Calculate probabilities and entropy
- p0 = double(m_count0[q]) / double(m_count0[q] + m_count1);
+ p0 = double( m_count0[q] )/ double( m_count0[q]+m_count1 );
p1 = 1.0 - p0;
- if(p0 != 0.0 && p1 != 0.0)
- m_costs[q].ENTROPY = -(p0 * std::log(p0) + p1 * std::log(p1)) / std::log(2.0);
+ if ( p0 != 0.0 && p1 != 0.0)
+ m_costs[q].ENTROPY = -( p0*std::log(p0)+p1*std::log(p1) ) / std::log(2.0);
else
m_costs[q].ENTROPY = 0.0;
- // We want the entropy *per symbol*, not per bit ...
- m_costs[q].ENTROPY *= double(m_count0[q] + m_count1);
+ // We want the entropy *per symbol*, not per bit ...
+ m_costs[q].ENTROPY *= double(m_count0[q]+m_count1);
m_costs[q].ENTROPY /= double(m_count1);
// Now add in the sign entropy
- if(m_countPOS[q] + m_countNEG[q] != 0)
+ if ( m_countPOS[q] + m_countNEG[q] != 0 )
{
- p0 = double(m_countNEG[q]) / double(m_countPOS[q] + m_countNEG[q]);
- p1 = 1.0 - p0;
- if(p0 != 0.0 && p1 != 0.0)
- sign_entropy = -((p0 * std::log(p0) + p1 * std::log(p1)) / std::log(2.0));
+ p0 = double( m_countNEG[q] )/double( m_countPOS[q]+m_countNEG[q] );
+ p1 = 1.0-p0;
+ if ( p0 != 0.0 && p1 != 0.0)
+ sign_entropy = -( (p0*std::log(p0)+p1*std::log(p1) ) / std::log(2.0));
else
sign_entropy = 0.0;
}
else
- sign_entropy = 0.0;
+ sign_entropy = 0.0;
// We want the entropy *per symbol*, not per bit ...
- sign_entropy *= double(m_countNEG[q] + m_countPOS[q]);
+ sign_entropy *= double( m_countNEG[q] + m_countPOS[q] );
sign_entropy /= double(m_count1);
m_costs[q].ENTROPY += sign_entropy;
// Sort out correction factors
m_costs[q].ENTROPY *= m_entropy_correctionfactor;
- m_costs[q].TOTAL = m_costs[q].Error + m_lambda * m_costs[q].ENTROPY;
+ m_costs[q].TOTAL = m_costs[q].Error+m_lambda*m_costs[q].ENTROPY;
}// q
}
@@ -322,40 +322,40 @@ void QuantChooser::SelectBestQuant()
// Selects the best quantiser to use for a subband block
m_min_idx = m_bottom_idx;
- for(int q = m_bottom_idx + m_index_step; q <= m_top_idx ; q += m_index_step)
+ for ( int q=m_bottom_idx + m_index_step; q<=m_top_idx ; q +=m_index_step )
{
- if(m_costs[q].TOTAL < m_costs[m_min_idx].TOTAL)
+ if ( m_costs[q].TOTAL < m_costs[m_min_idx].TOTAL)
m_min_idx = q;
}// q
-
+
}
-void QuantChooser::SetSkip(CodeBlock& cblock , const int qidx)
+void QuantChooser::SetSkip( CodeBlock& cblock , const int qidx)
{
- const int u_threshold = dirac_quantiser_lists.QuantFactor4(qidx);
-
+ const int u_threshold = dirac_quantiser_lists.QuantFactor4( qidx );
+
// Sets the skip flag for a codeblock
bool can_skip = true;
- for(int j = cblock.Ystart(); j < cblock.Yend(); ++j)
+ for (int j=cblock.Ystart(); j<cblock.Yend(); ++j )
{
- for(int i = cblock.Xstart(); i < cblock.Xend(); ++i)
+ for (int i=cblock.Xstart(); i<cblock.Xend(); ++i )
{
- if((std::abs(m_coeff_data[j][i]) << 2) >= u_threshold)
+ if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
can_skip = false;
- }
+ }
}
- cblock.SetSkip(can_skip);
+ cblock.SetSkip( can_skip );
}
-CoeffType QuantChooser::BlockAbsMax(const Subband& node)
+CoeffType QuantChooser::BlockAbsMax( const Subband& node )
{
- int val(0);
+ int val( 0 );
- for(int j = node.Yp() ; j < node.Yp() + node.Yl(); ++j)
+ for (int j=node.Yp() ; j<node.Yp()+node.Yl(); ++j)
{
- for(int i = node.Xp() ; i < node.Xp() + node.Xl(); ++i)
- {
- val = std::max(val , std::abs(m_coeff_data[j][i]));
+ for (int i=node.Xp() ; i<node.Xp()+node.Xl(); ++i)
+ {
+ val = std::max( val , std::abs(m_coeff_data[j][i]) );
}// i
}// j
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.h
index 56c0c18a3..c1d28302c 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/quant_chooser.h
@@ -45,86 +45,83 @@
namespace dirac
{
-//! Choose a quantiser
-/*!
- This class chooses a quantiser or quantisers for a subband
-*/
-class QuantChooser
-{
-public:
-
- //! Constructor
- QuantChooser(const CoeffArray& pic_data , const float lambda);
+ //! Choose a quantiser
+ /*!
+ This class chooses a quantiser or quantisers for a subband
+ */
+ class QuantChooser
+ {
+ public:
- //! Finds the best quantisers for the subband, returning the predicted number of bits needed
- int GetBestQuant(Subband& node);
+ //! Constructor
+ QuantChooser( const CoeffArray& pic_data , const float lambda );
- //! Sets the factor used for correcting the entropy calculation
- void SetEntropyCorrection(const float ecfac)
- {
- m_entropy_correctionfactor = ecfac;
- }
-private:
- //! Copy constructor is private and body-less. This class should not be copied.
- QuantChooser(const QuantChooser& cpy);
+ //! Finds the best quantisers for the subband, returning the predicted number of bits needed
+ int GetBestQuant( Subband& node );
- //! Assignment = is private and body-less. This class should not be assigned.
- QuantChooser& operator=(const QuantChooser& rhs);
+ //! Sets the factor used for correcting the entropy calculation
+ void SetEntropyCorrection( const float ecfac ){ m_entropy_correctionfactor = ecfac; }
+ private:
+ //! Copy constructor is private and body-less. This class should not be copied.
+ QuantChooser(const QuantChooser& cpy);
- //! Calculate errors and entropies for integral-bit quantisers
- void IntegralErrorCalc(Subband& node , const int xratio , const int yratio);
+ //! Assignment = is private and body-less. This class should not be assigned.
+ QuantChooser& operator=(const QuantChooser& rhs);
+
+ //! Calculate errors and entropies for integral-bit quantisers
+ void IntegralErrorCalc( Subband& node , const int xratio , const int yratio );
- //! Calculate errors and entropies for non-integral-bit quantisers
- void NonIntegralErrorCalc(Subband& node, const int xratio, const int yratio);
+ //! Calculate errors and entropies for non-integral-bit quantisers
+ void NonIntegralErrorCalc( Subband& node, const int xratio, const int yratio );
- //! Having got statistics, calculate the Lagrangian costs
- void LagrangianCalc();
+ //! Having got statistics, calculate the Lagrangian costs
+ void LagrangianCalc();
- //! Select the best quantisation index on the basis of the Lagrangian calculations
- void SelectBestQuant();
+ //! Select the best quantisation index on the basis of the Lagrangian calculations
+ void SelectBestQuant();
- CoeffType BlockAbsMax(const Subband& node);
+ CoeffType BlockAbsMax( const Subband& node );
- //! Set the skip flag for a codeblock
- void SetSkip(CodeBlock& cblock , const int qidx);
+ //! Set the skip flag for a codeblock
+ void SetSkip( CodeBlock& cblock , const int qidx);
-private:
- //! The perceptual weighting factor of the subband being tested
- float m_subband_wt;
+ private:
+ //! The perceptual weighting factor of the subband being tested
+ float m_subband_wt;
- //! The smallest quantisation index being tested
- int m_bottom_idx;
- //! The largest quantisation index being tested
- int m_top_idx;
- //! The step we use in jumping through the list of quantisers
- int m_index_step;
+ //! The smallest quantisation index being tested
+ int m_bottom_idx;
+ //! The largest quantisation index being tested
+ int m_top_idx;
+ //! The step we use in jumping through the list of quantisers
+ int m_index_step;
- //! The index of the quantiser with the lowest cost
- int m_min_idx;
+ //! The index of the quantiser with the lowest cost
+ int m_min_idx;
- //! A local reference to the data under consideration
- const CoeffArray& m_coeff_data;
+ //! A local reference to the data under consideration
+ const CoeffArray& m_coeff_data;
- //! The lambda value to be used in the Lagrangian calculation
- const float m_lambda;
+ //! The lambda value to be used in the Lagrangian calculation
+ const float m_lambda;
- //! A value for correcting the crude calculation of the entropy
- float m_entropy_correctionfactor;
+ //! A value for correcting the crude calculation of the entropy
+ float m_entropy_correctionfactor;
- //! An array used to count the number of zeroes
- OneDArray<int> m_count0;
- //! The number of ones (equal to the number of coefficients)
- int m_count1;
- //! An array used to count the number of positive values
- OneDArray<int> m_countPOS;
- //! An array used to count the number of negative values
- OneDArray<int> m_countNEG;
- //! An array used to collate the sum of the perceptually-weighted errors
- OneDArray<double> m_error_total;
- //! An array used to collate the computed costs
- OneDArray<CostType> m_costs;
+ //! An array used to count the number of zeroes
+ OneDArray<int> m_count0;
+ //! The number of ones (equal to the number of coefficients)
+ int m_count1;
+ //! An array used to count the number of positive values
+ OneDArray<int> m_countPOS;
+ //! An array used to count the number of negative values
+ OneDArray<int> m_countNEG;
+ //! An array used to collate the sum of the perceptually-weighted errors
+ OneDArray<double> m_error_total;
+ //! An array used to collate the computed costs
+ OneDArray<CostType> m_costs;
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.cpp
index da4b4bab8..bd5b62346 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.cpp
@@ -89,30 +89,30 @@ FrameComplexity::FrameComplexity():
//Default constructor
RateController::RateController(int trate, SourceParams& srcp, EncoderParams& encp):
- m_qf(encp.Qf()),
- m_I_qf(encp.Qf()),
+ m_qf (encp.Qf()),
+ m_I_qf (encp.Qf()),
m_I_qf_long_term(encp.Qf()),
m_target_rate(trate),
- m_buffer_size(5000 * trate), // for the moment, set buffer size to 5 seconds
- m_buffer_bits((m_buffer_size * 9) / 10), // initial occupancy of 90%
+ m_buffer_size(5000*trate),// for the moment, set buffer size to 5 seconds
+ m_buffer_bits((m_buffer_size*9)/10),// initial occupancy of 90%
m_encparams(encp),
- m_fcount(encp.L1Sep()),
+ m_fcount(encp.L1Sep() ),
m_intra_only(false),
m_L2_complexity_sum(0)
{
SetFrameDistribution();
CalcTotalBits(srcp);
- if(m_intra_only)
+ if (m_intra_only)
m_Iframe_bits = m_total_GOP_bits;
else
{
- m_Iframe_bits = m_total_GOP_bits / 10;
- m_L1frame_bits = (m_Iframe_bits * 3) / m_num_L1frame;
- if(m_encparams.L1Sep() > 1)
- m_L2frame_bits = (m_total_GOP_bits - m_Iframe_bits -
- m_L1frame_bits * m_num_L1frame) /
- (m_encparams.GOPLength() - 1 - m_num_L1frame);
+ m_Iframe_bits = m_total_GOP_bits/10;
+ m_L1frame_bits = (m_Iframe_bits*3)/m_num_L1frame;
+ if (m_encparams.L1Sep()>1)
+ m_L2frame_bits = ( m_total_GOP_bits - m_Iframe_bits -
+ m_L1frame_bits*m_num_L1frame )/
+ (m_encparams.GOPLength()-1-m_num_L1frame);
else
m_L2frame_bits = 0;
@@ -124,7 +124,7 @@ void RateController::SetFrameDistribution()
m_num_L1frame = m_encparams.NumL1();
m_num_Iframe = 1;
- if(m_num_L1frame == 0)
+ if (m_num_L1frame == 0)
{
m_num_Iframe = m_encparams.GOPLength();
m_intra_only = true;
@@ -136,60 +136,60 @@ void RateController::SetFrameDistribution()
void RateController::CalcTotalBits(const SourceParams& sourceparams)
{
const Rational& frame_rate = sourceparams.FrameRate();
- double f_rate = double(frame_rate.m_num) / double(frame_rate.m_denom);
+ double f_rate = double(frame_rate.m_num)/double(frame_rate.m_denom);
int GOP_length = m_encparams.GOPLength();
- m_GOP_duration = GOP_length / f_rate;
- m_total_GOP_bits = (long int)(m_GOP_duration * 1000.0) * m_target_rate; //Unit in bits
+ m_GOP_duration = GOP_length/f_rate;
+ m_total_GOP_bits = (long int)(m_GOP_duration*1000.0)*m_target_rate; //Unit in bits
m_GOP_target = m_total_GOP_bits;
- m_picture_bits = m_total_GOP_bits / GOP_length;
+ m_picture_bits = m_total_GOP_bits/GOP_length;
- if(m_encparams.Verbose())
+ if (m_encparams.Verbose())
{
- std::cout << "\nRate Control Encoding with target bit rate = ";
- std::cout << m_target_rate << " kbps" << std::endl;
+ std::cout<<"\nRate Control Encoding with target bit rate = ";
+ std::cout<<m_target_rate<<" kbps"<< std::endl;
- std::cout << "GOP Length = " << GOP_length << std::endl;
+ std::cout<<"GOP Length = "<<GOP_length<< std::endl;
- std::cout << "Frame Rate = " << f_rate << std::endl;
+ std::cout<<"Frame Rate = "<<f_rate<< std::endl;
- std::cout << "GOP Duration = " << m_GOP_duration << std::endl;
+ std::cout<<"GOP Duration = "<<m_GOP_duration<< std::endl;
- std::cout << "Total Allocated Num. of bits for each GOP = ";
- std::cout << m_total_GOP_bits << " (" << m_picture_bits << " per frame)";
- std::cout << std::endl;
+ std::cout<<"Total Allocated Num. of bits for each GOP = ";
+ std::cout<<m_total_GOP_bits<<" ("<<m_picture_bits<<" per frame)";
+ std::cout<<std::endl;
}
}
void RateController::Report()
{
- std::cout << std::endl;
- std::cout << std::endl << "GOP target is " << m_GOP_target;
- std::cout << std::endl << "Allocated frame bits by type: ";
- std::cout << "I frames - " << m_Iframe_bits;
- std::cout << "; L1/P frames - " << m_L1frame_bits;
- std::cout << "; L2/B frames - " << m_L2frame_bits;
- std::cout << std::endl;
+ std::cout<<std::endl;
+ std::cout<<std::endl<<"GOP target is "<<m_GOP_target;
+ std::cout<<std::endl<<"Allocated frame bits by type: ";
+ std::cout<<"I frames - "<<m_Iframe_bits;
+ std::cout<<"; L1/P frames - "<<m_L1frame_bits;
+ std::cout<<"; L2/B frames - "<<m_L2frame_bits;
+ std::cout<<std::endl;
}
double RateController::TargetSubgroupRate()
{
- long int bits = (m_encparams.L1Sep() - 1) * m_L2frame_bits +
- m_L1frame_bits;
- return (double)(bits) / (1000.0 * m_GOP_duration);
+ long int bits = (m_encparams.L1Sep()-1)*m_L2frame_bits+
+ m_L1frame_bits;
+ return (double)(bits)/(1000.0*m_GOP_duration);
}
double RateController::ProjectedSubgroupRate()
{
- int bits = (m_encparams.L1Sep() - 1) * m_frame_complexity.L2Complexity() +
+ int bits = (m_encparams.L1Sep()-1)*m_frame_complexity.L2Complexity()+
m_frame_complexity.L1Complexity();
- return (double)(bits) / (1000.0 * m_GOP_duration);
+ return (double)(bits)/(1000.0*m_GOP_duration);
}
void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bits)
{
@@ -198,54 +198,53 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
// L2 frame before the next L1 frame i.e. before the start of an L1L2L2
// subgroup
m_fcount--;
- UpdateBuffer(num_bits);
+ UpdateBuffer( num_bits );
// filter tap for adjusting the QF
double target_ratio = 0.9;
int field_factor = m_encparams.FieldCoding() ? 2 : 1;
- double top_size = (1.0 - target_ratio) - 0.5;
- double bottom_size = target_ratio - 0.1;
- double actual_ratio = double(m_buffer_bits) / double(m_buffer_size);
+ double top_size = (1.0 - target_ratio)-0.5;
+ double bottom_size = target_ratio-0.1;
+ double actual_ratio = double(m_buffer_bits)/double(m_buffer_size);
double tap;
- if((pparams.PictureNum() / field_factor) <= 3 * m_encparams.L1Sep())
+ if ((pparams.PictureNum()/field_factor)<=3*m_encparams.L1Sep() )
tap = 1.0;
- else
- {
- if(actual_ratio > target_ratio)
- tap = (actual_ratio - target_ratio) / top_size;
+ else{
+ if (actual_ratio>target_ratio)
+ tap = (actual_ratio-target_ratio)/top_size;
else
- tap = (target_ratio - actual_ratio) / bottom_size;
+ tap = (target_ratio-actual_ratio)/bottom_size;
- tap = std::min(1.0, std::max(tap, 0.25));
+ tap = std::min( 1.0, std::max(tap, 0.25 ));
}
- if(!m_intra_only)
+ if (!m_intra_only)
{
bool emergency_realloc = false;
int target;
// First, do normal coding
- if(pparams.PicSort().IsIntra() == true)
+ if ( pparams.PicSort().IsIntra() == true )
{
target = m_Iframe_bits;
- if(num_bits < target / 2)
+ if (num_bits < target/2 )
emergency_realloc = true;
// Update the statistics
- m_frame_complexity.SetIComplexity(num_bits);
+ m_frame_complexity.SetIComplexity( num_bits );
// We've just coded an intra frame so we need to set qf for
// the next group of L2(B) frames
- m_qf = std::max(tap * m_qf + (1.0 - tap) * m_encparams.Qf(), m_encparams.Qf() - 1.0);
- m_encparams.SetQf(m_qf);
+ m_qf = std::max(tap*m_qf+(1.0-tap)*m_encparams.Qf(), m_encparams.Qf()-1.0);
+ m_encparams.SetQf( m_qf );
- if(pparams.PictureNum() / field_factor == 0)
+ if (pparams.PictureNum()/field_factor==0)
{
// We've just coded the very first frame, which is a special
// case as the two L2 frames which normally follow are missing
@@ -255,47 +254,45 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
}
//Update complexities
- if((pparams.PictureNum() / field_factor) % m_encparams.L1Sep() != 0)
+ if ( (pparams.PictureNum()/field_factor) % m_encparams.L1Sep() !=0 )
{
// Scheduled B/L2 picture
target = m_L2frame_bits;
- if(num_bits < target / 2)
- {
+ if (num_bits < target/2 ){
emergency_realloc = true;
}
m_L2_complexity_sum += num_bits;
}
- else if(pparams.PicSort().IsIntra() == false)
+ else if ( pparams.PicSort().IsIntra() == false )
{
// Scheduled P/L1 picture (if inserted I picture, don't change the complexity)
target = m_L1frame_bits;
- if(num_bits < target / 2 || num_bits > target * 3)
- {
+ if (num_bits < target/2 || num_bits > target*3 ){
emergency_realloc = true;
}
m_frame_complexity.SetL1Complexity(num_bits);
}
- if(m_fcount == 0 || emergency_realloc == true)
+ if ( m_fcount==0 || emergency_realloc==true)
{
- if(emergency_realloc == true && m_encparams.Verbose() == true)
- std::cout << std::endl << "Major mis-prediction of frame bit rate: re-allocating";
+ if (emergency_realloc==true && m_encparams.Verbose()==true )
+ std::cout<<std::endl<<"Major mis-prediction of frame bit rate: re-allocating";
/* We recompute allocations for the next subgroup */
- if(m_encparams.L1Sep() > 1 && m_fcount < m_encparams.L1Sep() - 1)
+ if ( m_encparams.L1Sep()>1 && m_fcount<m_encparams.L1Sep()-1)
{
- m_frame_complexity.SetL2Complexity(m_L2_complexity_sum /
- (m_encparams.L1Sep() - 1 - m_fcount));
+ m_frame_complexity.SetL2Complexity(m_L2_complexity_sum/
+ (m_encparams.L1Sep()-1-m_fcount));
}
- Allocate((pparams.PictureNum() / field_factor));
+ Allocate( (pparams.PictureNum()/field_factor) );
/* We work out what this means for the quality factor and set it*/
@@ -307,29 +304,28 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
// from measured values (complexities)
double prate = ProjectedSubgroupRate();
- if(m_encparams.Verbose() == true)
+ if (m_encparams.Verbose()==true )
{
- std::cout << std::endl << "Target subgroup rate = " << trate;
- std::cout << ", projected subgroup rate = " << prate;
+ std::cout<<std::endl<<"Target subgroup rate = "<<trate;
+ std::cout<<", projected subgroup rate = "<<prate;
}
// Determine K value
- double K = std::pow(prate, 2) * std::pow(10.0, ((double)2 / 5 * (10 - m_qf))) / 16;
+ double K = std::pow(prate, 2)*std::pow(10.0, ((double)2/5*(10-m_qf)))/16;
// Determine a new QF
- double new_qf = 10 - (double)5 / 2 * log10(16 * K / std::pow(trate, 2));
- if((std::abs(m_qf - new_qf) < 0.25 && new_qf > 4.0) || new_qf > 8.0)
+ double new_qf = 10 - (double)5/2*log10(16*K/std::pow(trate, 2));
+ if ( ( std::abs(m_qf-new_qf)<0.25 && new_qf > 4.0 ) || new_qf>8.0)
m_qf = new_qf;
else
- m_qf = tap * new_qf + (1.0 - tap) * m_qf;
+ m_qf = tap*new_qf+(1.0-tap)*m_qf;
- m_qf = ReviewQualityFactor(m_qf , num_bits);
+ m_qf = ReviewQualityFactor( m_qf , num_bits );
- if(m_qf < 8.0)
- {
- if(prate < 2 * trate)
- m_qf = std::max(m_qf, m_encparams.Qf() - 1.0);
+ if ( m_qf<8.0 ){
+ if (prate<2*trate)
+ m_qf = std::max(m_qf,m_encparams.Qf()-1.0);
else
- m_qf = std::max(m_qf, m_encparams.Qf() - 2.0);
+ m_qf = std::max(m_qf,m_encparams.Qf()-2.0);
}
m_encparams.SetQf(m_qf);
@@ -338,7 +334,7 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
/* Resetting */
// Reset the frame counter
- if(m_fcount == 0)
+ if (m_fcount==0)
m_fcount = m_encparams.L1Sep();
// Reset the count of L2 bits
@@ -352,22 +348,22 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
// Target rate
- double trate = double(m_total_GOP_bits) / (1000.0 * m_num_Iframe);
+ double trate = double(m_total_GOP_bits)/(1000.0*m_num_Iframe);
// Projected rate with current QF
- double prate = double(num_bits) / 1000.0;
+ double prate = double(num_bits)/1000.0;
// Determine K value
- double K = std::pow(prate, 2) * std::pow(10.0, ((double)2 / 5 * (10 - m_qf))) / 16;
+ double K = std::pow(prate, 2)*std::pow(10.0, ((double)2/5*(10-m_qf)))/16;
// Determine a new QF
- double new_qf = 10 - (double)5 / 2 * log10(16 * K / std::pow(trate, 2));
+ double new_qf = 10 - (double)5/2*log10(16*K/std::pow(trate, 2));
// Adjust the QF to meet the target
- double abs_delta = std::abs(new_qf - m_qf);
- if(abs_delta > 0.01)
+ double abs_delta = std::abs( new_qf - m_qf );
+ if ( abs_delta>0.01)
{
// Rate of convergence to new QF
double r;
@@ -386,16 +382,16 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
Actual parameters may be adjusted later. Some applications may
require instant lock.
*/
- double lg_diff = std::log(abs_delta / 2.0);
- if(lg_diff < 0.0)
- r = 0.5 * std::exp(-lg_diff * lg_diff / 2.0);
+ double lg_diff = std::log( abs_delta/2.0 );
+ if ( lg_diff< 0.0 )
+ r = 0.5*std::exp(-lg_diff*lg_diff/2.0);
else
- r = 1.0 - 0.5 * std::exp(-lg_diff * lg_diff / 2.0);
+ r = 1.0-0.5*std::exp(-lg_diff*lg_diff/2.0);
r *= 0.75;
- m_qf = r * m_qf + (1.0 - r) * new_qf;
- m_qf = ReviewQualityFactor(m_qf , num_bits);
+ m_qf = r*m_qf + (1.0-r)*new_qf;
+ m_qf = ReviewQualityFactor( m_qf , num_bits );
m_encparams.SetQf(m_qf);
}
@@ -406,31 +402,31 @@ void RateController::CalcNextQualFactor(const PictureParams& pparams, int num_bi
}
-void RateController::UpdateBuffer(const long int num_bits)
+void RateController::UpdateBuffer( const long int num_bits )
{
m_buffer_bits -= num_bits;
m_buffer_bits += m_picture_bits;
- if(m_encparams.Verbose())
+ if (m_encparams.Verbose())
{
- std::cout << std::endl << "Buffer occupancy = " << ((double)m_buffer_bits * 100.0)
- / ((double)m_buffer_size) << "%";
+ std::cout<<std::endl<<"Buffer occupancy = "<<((double)m_buffer_bits*100.0)
+ /((double)m_buffer_size)<<"%";
}
- if(m_buffer_bits < 0)
+ if (m_buffer_bits<0)
{
- if(m_encparams.Verbose())
+ if (m_encparams.Verbose())
{
- std::cout << std::endl << "WARNING: decoder buffer is out of bits - bit rate is too high";
+ std::cout<<std::endl<<"WARNING: decoder buffer is out of bits - bit rate is too high";
}
// m_buffer_bits = 0;
}
- if(m_buffer_bits > m_buffer_size)
+ if (m_buffer_bits>m_buffer_size)
{
- if(m_encparams.Verbose())
+ if (m_encparams.Verbose())
{
- std::cout << std::endl << "WARNING: decoder buffer has overflowed - bit rate is too low. Assuming bit-stuffing.";
+ std::cout<<std::endl<<"WARNING: decoder buffer has overflowed - bit rate is too low. Assuming bit-stuffing.";
}
m_buffer_bits = m_buffer_size;
}
@@ -438,97 +434,97 @@ void RateController::UpdateBuffer(const long int num_bits)
}
-void RateController::Allocate(const int fnum)
+void RateController::Allocate (const int fnum)
{
const int XI = m_frame_complexity.IComplexity();
const int XL1 = m_frame_complexity.L1Complexity();
const int XL2 = m_frame_complexity.L2Complexity();
- double buffer_occ = ((double)m_buffer_bits) / ((double)m_buffer_size);
+ double buffer_occ = ( (double)m_buffer_bits)/((double)m_buffer_size);
- if(!m_intra_only)
+ if ( !m_intra_only)
{
double correction;
- if(buffer_occ < 0.9 && ((fnum + 1) % 4 * m_encparams.L1Sep()) == 0)
+ if (buffer_occ<0.9 && ( (fnum+1) % 4*m_encparams.L1Sep())==0 )
{
// If we're undershooting buffer target, correct slowly
- correction = std::min(0.25, 0.25 * (0.9 - buffer_occ) / 0.9);
- m_GOP_target = (long int)(double(m_total_GOP_bits) * (1.0 - correction));
+ correction = std::min( 0.25, 0.25*(0.9 - buffer_occ )/0.9 );
+ m_GOP_target = ( long int)(double(m_total_GOP_bits)*( 1.0-correction) );
}
- else if(buffer_occ > 0.9 && ((fnum + 1) % m_encparams.L1Sep()) == 0)
+ else if (buffer_occ>0.9 && ((fnum+1) % m_encparams.L1Sep())==0)
{
// If we're overshooting buffer target, correct quickly
- correction = std::min(0.5, 0.5 * (buffer_occ - 0.9) / 0.9);
- m_GOP_target = (long int)(double(m_total_GOP_bits) * (1.0 + correction));
+ correction = std::min( 0.5, 0.5*( buffer_occ - 0.9 )/0.9 );
+ m_GOP_target = ( long int)(double(m_total_GOP_bits)*( 1.0+correction) );
}
}
- const long int min_bits = m_total_GOP_bits / (100 * m_encparams.GOPLength());
+ const long int min_bits = m_total_GOP_bits/(100*m_encparams.GOPLength());
// Allocate intra bits
- m_Iframe_bits = (long int)(m_GOP_target
- / (m_num_Iframe
- + (double)(m_num_L1frame * XL1) / XI
- + (double)(m_num_L2frame * XL2) / XI));
+ m_Iframe_bits = (long int) (m_GOP_target
+ / (m_num_Iframe
+ +(double)(m_num_L1frame*XL1)/XI
+ +(double)(m_num_L2frame*XL2)/XI));
- m_Iframe_bits = std::max(min_bits, m_Iframe_bits);
+ m_Iframe_bits = std::max( min_bits, m_Iframe_bits );
// Allocate L1 bits
- m_L1frame_bits = (long int)(m_GOP_target
- / (m_num_L1frame
- + (double)(m_num_Iframe * XI) / XL1
- + (double)(m_num_L2frame * XL2) / XL1));
+ m_L1frame_bits = (long int) (m_GOP_target
+ / (m_num_L1frame
+ +(double)(m_num_Iframe*XI)/XL1
+ +(double)(m_num_L2frame*XL2)/XL1));
- m_L1frame_bits = std::max(min_bits, m_L1frame_bits);
+ m_L1frame_bits = std::max( min_bits, m_L1frame_bits );
// Allocate L2 bits
- m_L2frame_bits = (long int)(m_GOP_target
- / (m_num_L2frame
- + (double)(m_num_Iframe * XI) / XL2
- + (double)(m_num_L1frame * XL1) / XL2));
+ m_L2frame_bits = (long int) (m_GOP_target
+ / (m_num_L2frame
+ +(double)(m_num_Iframe*XI)/XL2
+ +(double)(m_num_L1frame*XL1)/XL2));
- m_L2frame_bits = std::max(min_bits, m_L2frame_bits);
+ m_L2frame_bits = std::max( min_bits, m_L2frame_bits );
}
-float RateController::ReviewQualityFactor(const float qfac, const long int num_bits)
+float RateController::ReviewQualityFactor( const float qfac, const long int num_bits )
{
- if(num_bits > m_total_GOP_bits / 2)
+ if (num_bits>m_total_GOP_bits/2)
{
// The frame is too big, so reset to a smaller quality factor
- return ClipQualityFactor(qfac - 2);
+ return ClipQualityFactor(qfac-2);
}
else
{
// Keep the quality factor in a sensible range
- return ClipQualityFactor(qfac);
+ return ClipQualityFactor( qfac );
}
}
-float RateController::ClipQualityFactor(const float qfac)
+float RateController::ClipQualityFactor( const float qfac )
{
// Keep the quality factor in a sensible range
- if(!m_intra_only)
- return std::min(std::max(qfac, 0.0f), 16.0f);
+ if ( !m_intra_only )
+ return std::min( std::max(qfac, 0.0f), 16.0f);
else
return std::max(qfac, 0.0f);
}
void RateController::CalcNextIntraQualFactor()
{
- m_I_qf = (m_I_qf + m_qf) / 2.0;
- m_I_qf = ClipQualityFactor(m_I_qf);
+ m_I_qf = (m_I_qf + m_qf)/2.0;
+ m_I_qf = ClipQualityFactor( m_I_qf );
m_encparams.SetQf(m_I_qf);
const double ff = 0.95;
m_I_qf_long_term *= ff;
- m_I_qf_long_term += (1.0 - ff) * m_I_qf;
+ m_I_qf_long_term += ( 1.0 - ff )*m_I_qf;
}
void RateController::SetCutPictureQualFactor()
{
- m_qf = std::min(m_qf , m_I_qf_long_term);
- m_encparams.SetQf(m_qf);
+ m_qf = std::min( m_qf , m_I_qf_long_term );
+ m_encparams.SetQf( m_qf );
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.h
index 7e003e736..a54bb5d95 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/rate_control.h
@@ -49,199 +49,172 @@
namespace dirac
{
-class FrameComplexity
-{
-public:
- //! Default constructor
- FrameComplexity();
-
- //! Return the complexity of I frame
- int IComplexity()
+ class FrameComplexity
{
- return m_XI;
- }
+ public:
+ //! Default constructor
+ FrameComplexity();
- //! Return the complexity of L1 frame
- int L1Complexity()
- {
- return m_XL1;
- }
+ //! Return the complexity of I frame
+ int IComplexity() {return m_XI;}
- //! Return the complexity of L2 frame
- int L2Complexity()
- {
- return m_XL2;
- }
+ //! Return the complexity of L1 frame
+ int L1Complexity() {return m_XL1;}
- //! Set the complexity of I frame
- void SetIComplexity(int cpx)
- {
- m_XI = cpx;
- }
+ //! Return the complexity of L2 frame
+ int L2Complexity() {return m_XL2;}
- //! Set the complexity of L1 frame
- void SetL1Complexity(int cpx)
- {
- m_XL1 = cpx;
- }
+ //! Set the complexity of I frame
+ void SetIComplexity(int cpx) {m_XI = cpx;}
- //! Set the complexity of L2 frame
- void SetL2Complexity(int cpx)
- {
- m_XL2 = cpx;
- }
+ //! Set the complexity of L1 frame
+ void SetL1Complexity(int cpx) {m_XL1 = cpx;}
+ //! Set the complexity of L2 frame
+ void SetL2Complexity(int cpx) {m_XL2 = cpx;}
-private:
- //! Complexity of I frame
- int m_XI;
+ private:
- //! Complexity of L1 frame
- int m_XL1;
+ //! Complexity of I frame
+ int m_XI;
- //! Complexity of L2 frame
- int m_XL2;
-};
+ //! Complexity of L1 frame
+ int m_XL1;
+ //! Complexity of L2 frame
+ int m_XL2;
+ };
-//! A clas for allocation the bits to each and every types of frames in a GOP
-class RateController
-{
-public:
- //! Default constructor
- RateController(int trate, SourceParams& srcp, EncoderParams& encp);
+ //! A clas for allocation the bits to each and every types of frames in a GOP
+ class RateController
+ {
+ public:
+ //! Default constructor
+ RateController(int trate, SourceParams& srcp, EncoderParams& encp);
- //! Calculate the Quality factor of the next frame to encode
- void CalcNextQualFactor(const PictureParams& fparams, int num_bits);
- //! Calculate the Quality factor of the next I frame to encode
- void CalcNextIntraQualFactor();
+ //! Calculate the Quality factor of the next frame to encode
+ void CalcNextQualFactor(const PictureParams& fparams, int num_bits);
- //! Use the long-term average intra quality factor
- void SetCutPictureQualFactor();
+ //! Calculate the Quality factor of the next I frame to encode
+ void CalcNextIntraQualFactor();
- //! Return I frame qf
- double IntraQualFactor()
- {
- return m_I_qf;
- }
+ //! Use the long-term average intra quality factor
+ void SetCutPictureQualFactor();
- //! Return qf
- double QualFactor()
- {
- return m_qf;
- }
+ //! Return I frame qf
+ double IntraQualFactor() {return m_I_qf;}
- //! Report the allocation to picture types
- void Report();
+ //! Return qf
+ double QualFactor() {return m_qf;}
+
+ //! Report the allocation to picture types
+ void Report();
-private:
+ private:
- double TargetSubgroupRate();
+ double TargetSubgroupRate();
- double ProjectedSubgroupRate();
+ double ProjectedSubgroupRate();
- //! Allocate the bits to each type of frame in a GOP
- void Allocate(const int fnum);
+ //! Allocate the bits to each type of frame in a GOP
+ void Allocate(const int fnum);
- //! Calculate the total number of bits in a GOP
- void CalcTotalBits(const SourceParams& sourceparams);
+ //! Calculate the total number of bits in a GOP
+ void CalcTotalBits(const SourceParams& sourceparams);
- //! Set the value of Current IQF
- void SetIntraQualFactor(double value)
- {
- m_I_qf = value;
- }
+ //! Set the value of Current IQF
+ void SetIntraQualFactor(double value){m_I_qf = value;}
- //! Set the number of I, L1 and L2 frames in the GOP
- void SetFrameDistribution();
+ //! Set the number of I, L1 and L2 frames in the GOP
+ void SetFrameDistribution();
- //! Review the quality factor to make sure it's being set sensibly
- float ReviewQualityFactor(const float qfac, const long int num_bits);
+ //! Review the quality factor to make sure it's being set sensibly
+ float ReviewQualityFactor( const float qfac, const long int num_bits );
- //! Clip the quality factor to something sensible
- float ClipQualityFactor(const float qfac);
+ //! Clip the quality factor to something sensible
+ float ClipQualityFactor( const float qfac );
- //! Update the internal decoder buffer model
- void UpdateBuffer(const long int num_bits);
+ //! Update the internal decoder buffer model
+ void UpdateBuffer( const long int num_bits );
-private:
+ private:
- //! Current Quality Factor
- double m_qf;
+ //! Current Quality Factor
+ double m_qf;
- //! I frame Quality Factor
- double m_I_qf;
+ //! I frame Quality Factor
+ double m_I_qf;
- //! Long-term average of I frame Quality Factor
- double m_I_qf_long_term;
+ //! Long-term average of I frame Quality Factor
+ double m_I_qf_long_term;
- //! Target bit rate in kbps
- const int m_target_rate;
+ //! Target bit rate in kbps
+ const int m_target_rate;
- //! Number of bits for I frame
- long int m_Iframe_bits;
+ //! Number of bits for I frame
+ long int m_Iframe_bits;
- //! Number of bits for L1 frame
- long int m_L1frame_bits;
+ //! Number of bits for L1 frame
+ long int m_L1frame_bits;
- //! Number of bits for L2 frame
- long int m_L2frame_bits;
+ //! Number of bits for L2 frame
+ long int m_L2frame_bits;
- //! Number of I frames
- int m_num_Iframe;
+ //! Number of I frames
+ int m_num_Iframe;
- //! Number of L1 frames
- int m_num_L1frame;
+ //! Number of L1 frames
+ int m_num_L1frame;
- //! Number of L2 frames
- int m_num_L2frame;
+ //! Number of L2 frames
+ int m_num_L2frame;
- //! Total Number of bits in a GOP
- long int m_total_GOP_bits;
+ //! Total Number of bits in a GOP
+ long int m_total_GOP_bits;
- //! Mean number of bits in a picture
- long int m_picture_bits;
+ //! Mean number of bits in a picture
+ long int m_picture_bits;
- //! Size of the decoded bit buffer
- const long int m_buffer_size;
+ //! Size of the decoded bit buffer
+ const long int m_buffer_size;
- //! Number of bits in the buffer
- long int m_buffer_bits;
+ //! Number of bits in the buffer
+ long int m_buffer_bits;
- //! The old buffer occupancy
- long int m_old_buffer_bits;
+ //! The old buffer occupancy
+ long int m_old_buffer_bits;
- //! The rate of change of buffer occupancy
- double m_buffer_rate_of_change;
+ //! The rate of change of buffer occupancy
+ double m_buffer_rate_of_change;
- //! The target number of bits for the current GOP
- long int m_GOP_target;
+ //! The target number of bits for the current GOP
+ long int m_GOP_target;
- //! The duration of a GOP
- double m_GOP_duration;
+ //! The duration of a GOP
+ double m_GOP_duration;
- //! A reference to the encoder parameters
- EncoderParams& m_encparams;
+ //! A reference to the encoder parameters
+ EncoderParams& m_encparams;
- //! A class to hold the frame complexity object
- FrameComplexity m_frame_complexity;
+ //! A class to hold the frame complexity object
+ FrameComplexity m_frame_complexity;
- //! A frame counter, giving the position within a subgroup
- int m_fcount;
+ //! A frame counter, giving the position within a subgroup
+ int m_fcount;
- // Indicated whether a sequence is being coded intra only or not
- bool m_intra_only;
+ // Indicated whether a sequence is being coded intra only or not
+ bool m_intra_only;
- // Sum of complexity of L2 frames
- int m_L2_complexity_sum;
+ // Sum of complexity of L2 frames
+ int m_L2_complexity_sum;
-};
+ };
}// namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.cpp
index d01c35e18..da4f73b2b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.cpp
@@ -44,9 +44,9 @@
using namespace dirac;
-SequenceCompressor::SequenceCompressor(StreamPicInput* pin ,
- EncoderParams& encp,
- DiracByteStream& dirac_byte_stream):
+SequenceCompressor::SequenceCompressor( StreamPicInput* pin ,
+ EncoderParams& encp,
+ DiracByteStream& dirac_byte_stream):
m_all_done(false),
m_just_finished(true),
m_srcparams(pin->GetSourceParams()),
@@ -57,66 +57,64 @@ SequenceCompressor::SequenceCompressor(StreamPicInput* pin ,
m_encparams.Xl(),
m_encparams.Yl(),
m_encparams.LumaDepth(),
- m_encparams.ChromaDepth()),
- m_pic_in(pin),
+ m_encparams.ChromaDepth() ),
+ m_pic_in(pin),
m_current_display_pnum(-1),
m_current_code_pnum(0),
- m_show_pnum(-1), m_last_picture_read(-1),
+ m_show_pnum(-1),m_last_picture_read(-1),
m_gop_start_num(0),
m_delay(1),
- m_qmonitor(m_encparams),
- m_pcoder(m_encparams),
+ m_qmonitor( m_encparams ),
+ m_pcoder( m_encparams ),
m_dirac_byte_stream(dirac_byte_stream),
m_eos_signalled(false)
{
// Set up the compression of the sequence
//TBD: put into the constructor for EncoderParams
- m_encparams.SetEntropyFactors(new EntropyCorrector(m_encparams.TransformDepth()));
+ m_encparams.SetEntropyFactors( new EntropyCorrector(m_encparams.TransformDepth()) );
// Set up generic picture parameters
- m_pparams.SetUsingAC(m_encparams.UsingAC());
+ m_pparams.SetUsingAC(m_encparams.UsingAC() );
// Set up a rate controller if rate control being used
- if(m_encparams.TargetRate() != 0)
+ if (m_encparams.TargetRate() != 0)
m_ratecontrol = new RateController(m_encparams.TargetRate(),
m_pic_in->GetSourceParams(), encp);
// Copy in the block parameters in case we want to change them dynamically
m_basic_olb_params2 = &m_predparams.LumaBParams(2);
- m_basic_olb_params1 = new OLBParams(2 * m_predparams.LumaBParams(2).Xblen(),
- 2 * m_predparams.LumaBParams(2).Yblen(),
- 2 * m_predparams.LumaBParams(2).Xbsep(),
- 2 * m_predparams.LumaBParams(2).Ybsep());
+ m_basic_olb_params1 = new OLBParams( 2*m_predparams.LumaBParams(2).Xblen(),
+ 2*m_predparams.LumaBParams(2).Yblen(),
+ 2*m_predparams.LumaBParams(2).Xbsep(),
+ 2*m_predparams.LumaBParams(2).Ybsep() );
- m_basic_olb_params0 = new OLBParams(4 * m_predparams.LumaBParams(2).Xblen(),
- 4 * m_predparams.LumaBParams(2).Yblen(),
- 4 * m_predparams.LumaBParams(2).Xbsep(),
- 4 * m_predparams.LumaBParams(2).Ybsep());
+ m_basic_olb_params0 = new OLBParams( 4*m_predparams.LumaBParams(2).Xblen(),
+ 4*m_predparams.LumaBParams(2).Yblen(),
+ 4*m_predparams.LumaBParams(2).Xbsep(),
+ 4*m_predparams.LumaBParams(2).Ybsep() );
- m_intra_olbp = new OLBParams(2 * m_basic_olb_params2->Xbsep() ,
- 2 * m_basic_olb_params2->Ybsep() ,
- m_basic_olb_params2->Xbsep() ,
- m_basic_olb_params2->Ybsep());
+ m_intra_olbp = new OLBParams( 2*m_basic_olb_params2->Xbsep() ,
+ 2*m_basic_olb_params2->Ybsep() ,
+ m_basic_olb_params2->Xbsep() ,
+ m_basic_olb_params2->Ybsep() );
SetMotionParameters();
}
-void SequenceCompressor::SetMotionParameters()
-{
+void SequenceCompressor::SetMotionParameters(){
- if(m_encparams.TargetRate() != 0)
- {
+ if ( m_encparams.TargetRate() != 0 ){
OLBParams new_olb_params = *m_basic_olb_params2;
- if(m_encparams.Qf() < 2.5)
+ if (m_encparams.Qf()<2.5)
new_olb_params = *m_basic_olb_params1;
- else if(m_encparams.Qf() < 1.5)
+ else if (m_encparams.Qf()<1.5)
new_olb_params = *m_basic_olb_params0;
- m_predparams.SetBlockSizes(new_olb_params , m_srcparams.CFormat());
+ m_predparams.SetBlockSizes( new_olb_params , m_srcparams.CFormat() );
}
@@ -124,13 +122,13 @@ void SequenceCompressor::SetMotionParameters()
int yl = m_encparams.Yl();
// Make sure we have enough macroblocks to cover the pictures
- m_predparams.SetXNumSB((xl + m_predparams.LumaBParams(0).Xbsep() - 1) /
- m_predparams.LumaBParams(0).Xbsep());
- m_predparams.SetYNumSB((yl + m_predparams.LumaBParams(0).Ybsep() - 1) /
- m_predparams.LumaBParams(0).Ybsep());
+ m_predparams.SetXNumSB( (xl+m_predparams.LumaBParams(0).Xbsep()-1)/
+ m_predparams.LumaBParams(0).Xbsep() );
+ m_predparams.SetYNumSB( (yl+m_predparams.LumaBParams(0).Ybsep()-1)/
+ m_predparams.LumaBParams(0).Ybsep() );
- m_predparams.SetXNumBlocks(4 * m_predparams.XNumSB());
- m_predparams.SetYNumBlocks(4 * m_predparams.YNumSB());
+ m_predparams.SetXNumBlocks( 4 * m_predparams.XNumSB() );
+ m_predparams.SetYNumBlocks( 4 * m_predparams.YNumSB() );
}
@@ -140,54 +138,54 @@ SequenceCompressor::~SequenceCompressor()
delete m_basic_olb_params1;
delete m_basic_olb_params0;
- if(m_encparams.Verbose())
+ if ( m_encparams.Verbose())
MakeSequenceReport();
//TBD: put into the destructor for EncoderParams
delete &m_encparams.EntropyFactors();
- if(m_encparams.TargetRate() != 0)
+ if (m_encparams.TargetRate()!=0)
delete m_ratecontrol;
}
bool SequenceCompressor::CanEncode()
{
- const int queue_size = std::max(4 , 2 * m_encparams.L1Sep());
+ const int queue_size = std::max( 4 , 2*m_encparams.L1Sep() );
- if(m_eos_signalled)
+ if (m_eos_signalled)
{
- if(m_encparams.NumL1() > 0)
+ if (m_encparams.NumL1() > 0)
{
- /*
- * Long-GOP sequence
- */
+ /*
+ * Long-GOP sequence
+ */
int field_factor = m_encparams.PictureCodingMode() ? 2 : 1;
- int last_frame_read = m_last_picture_read / field_factor;
- int current_code_fnum = m_current_code_pnum / field_factor;
+ int last_frame_read = m_last_picture_read/field_factor;
+ int current_code_fnum = m_current_code_pnum/field_factor;
- if((last_frame_read >= (current_code_fnum + (last_frame_read % m_encparams.L1Sep()))))
+ if ((last_frame_read >= (current_code_fnum + (last_frame_read%m_encparams.L1Sep()))))
return true;
- /*
- * Encode the remaining picture in the frame buffer. We check if
- * the reference pictures are available and modify the picture sort
- * accordingly.
- */
- if(current_code_fnum <= last_frame_read)
- {
- m_current_display_pnum = m_current_code_pnum;
- return true;
- }
+ /*
+ * Encode the remaining picture in the frame buffer. We check if
+ * the reference pictures are available and modify the picture sort
+ * accordingly.
+ */
+ if (current_code_fnum <= last_frame_read)
+ {
+ m_current_display_pnum = m_current_code_pnum;
+ return true;
+ }
}
else
{
- if(m_last_picture_read >= m_current_display_pnum)
+ if (m_last_picture_read >= m_current_display_pnum)
return true;
}
}
else
{
- if(m_last_picture_read >= m_current_display_pnum + queue_size)
+ if (m_last_picture_read >= m_current_display_pnum + queue_size)
return true;
}
return false;
@@ -209,21 +207,20 @@ const EncPicture* SequenceCompressor::CompressNextPicture()
// m_show_pnum is the index of the picture number that can be shown when current_pnum has been coded.
// Var m_delay is the m_delay caused by reordering (as distinct from buffering)
- TESTM(m_last_picture_read >= 0, "Data loaded before calling CompressNextPicture");
+ TESTM (m_last_picture_read >= 0, "Data loaded before calling CompressNextPicture");
const int field_factor = m_encparams.FieldCoding() ? 2 : 1;
// If we have a scheduled P picture, reset the P separation to normal
- if(m_encparams.L1Sep() != m_L1_sep)
- {
- if((m_current_code_pnum - field_factor) % (m_encparams.L1Sep()*field_factor) == 0)
+ if ( m_encparams.L1Sep()!=m_L1_sep ){
+ if ( (m_current_code_pnum-field_factor) % (m_encparams.L1Sep()*field_factor)==0 )
m_L1_sep = m_encparams.L1Sep();
}
- m_current_display_pnum = CodedToDisplay(m_current_code_pnum);
- m_show_pnum = std::max(m_current_code_pnum - m_delay , 0);
+ m_current_display_pnum = CodedToDisplay( m_current_code_pnum );
+ m_show_pnum = std::max( m_current_code_pnum - m_delay , 0 );
- if(CanEncode())
+ if ( CanEncode() )
{
// Compress the picture//
@@ -231,58 +228,50 @@ const EncPicture* SequenceCompressor::CompressNextPicture()
const std::vector<int>& queue_members = m_enc_pbuffer.Members();
- EncPicture* current_pic = &m_enc_pbuffer.GetPicture(m_current_display_pnum);
+ EncPicture* current_pic = &m_enc_pbuffer.GetPicture( m_current_display_pnum );
PictureParams* current_pp = &current_pic->GetPparams();
// 1. Set the picture type and refs for all the pictures in the queue not already encoded
- for(size_t i = 0; i < queue_members.size(); ++i)
- {
+ for (size_t i=0; i<queue_members.size(); ++i){
int pnum = queue_members[i];
EncPicture& enc_pic = m_enc_pbuffer.GetPicture(pnum);
- if((enc_pic.GetStatus() & DONE_SET_PTYPE) == 0)
- {
+ if ( (enc_pic.GetStatus() & DONE_SET_PTYPE) == 0 ){
PictureParams& pparams = enc_pic.GetPparams();
// only look one subgroup ahead
- if((m_encparams.NumL1() == 0) || pparams.PictureNum() < m_current_display_pnum + m_encparams.L1Sep())
- {
- SetPicTypeAndRefs(pparams);
- enc_pic.UpdateStatus(DONE_SET_PTYPE);
+ if ((m_encparams.NumL1() == 0) || pparams.PictureNum() < m_current_display_pnum + m_encparams.L1Sep() ){
+ SetPicTypeAndRefs( pparams );
+ enc_pic.UpdateStatus( DONE_SET_PTYPE );
}
}
}
/* Do motion estimation and compensation if inter*/
- bool is_a_cut(false);
+ bool is_a_cut( false );
//2. Set up block sizes etc
SetMotionParameters();
// Loop over the whole queue and ...
- for(size_t i = 0; i < queue_members.size(); ++i)
- {
+ for (size_t i=0; i<queue_members.size(); ++i){
int pnum = queue_members[i];
EncPicture& enc_pic = m_enc_pbuffer.GetPicture(pnum);
- if((enc_pic.GetStatus() & DONE_SET_PTYPE) != 0)
- {
+ if ( ( enc_pic.GetStatus() & DONE_SET_PTYPE) != 0 ){
PictureParams& pparams = enc_pic.GetPparams();
- if(pparams.PicSort().IsInter())
- {
- // 3.Initialise motion data
- if((enc_pic.GetStatus() & DONE_ME_INIT) == 0)
- {
- enc_pic.InitMEData(m_predparams , pparams.NumRefs());
- enc_pic.UpdateStatus(DONE_ME_INIT);
+ if ( pparams.PicSort().IsInter() ){
+ // 3.Initialise motion data
+ if ( ( enc_pic.GetStatus() & DONE_ME_INIT) == 0 ){
+ enc_pic.InitMEData( m_predparams , pparams.NumRefs() );
+ enc_pic.UpdateStatus( DONE_ME_INIT );
}
// 4. Do pixel-accurate motion estimation
- if((enc_pic.GetStatus() & DONE_PEL_ME) == 0)
- {
- m_pcoder.PixelME(m_enc_pbuffer, pnum);
- enc_pic.UpdateStatus(DONE_PEL_ME);
- }
+ if ( ( enc_pic.GetStatus() & DONE_PEL_ME) == 0 ){
+ m_pcoder.PixelME( m_enc_pbuffer, pnum );
+ enc_pic.UpdateStatus( DONE_PEL_ME );
+ }
// // 5. Set picture complexity
// if ( (enc_pic.GetStatus() & DONE_PIC_COMPLEXITY ) == 0 ){
@@ -290,7 +279,7 @@ const EncPicture* SequenceCompressor::CompressNextPicture()
// enc_pic.UpdateStatus( DONE_PIC_COMPLEXITY );
// }
- //6. Revise the number of references if one ref is a bad predictor
+ //6. Revise the number of references if one ref is a bad predictor
// if ( (enc_pic.GetStatus() & DONE_PIC_COMPLEXITY)!=0 &&
// pparams.NumRefs()==2){
// if (enc_pic.GetPredBias()>0.8)
@@ -302,165 +291,155 @@ const EncPicture* SequenceCompressor::CompressNextPicture()
}
}
- if(current_pp->PicSort().IsInter())
- {
+ if ( current_pp->PicSort().IsInter() ){
// // 7. Normalise complexity for the current picture
// m_pcoder.NormaliseComplexity( m_enc_pbuffer, m_current_display_pnum );
bool subgroup_reconfig;
- do
- {
+ do{
subgroup_reconfig = false;
//8. Do subpel refinement
- m_pcoder.SubPixelME(m_enc_pbuffer, m_current_display_pnum);
+ m_pcoder.SubPixelME( m_enc_pbuffer, m_current_display_pnum );
//9. Do mode decision
- m_pcoder.ModeDecisionME(m_enc_pbuffer, m_current_display_pnum);
+ m_pcoder.ModeDecisionME( m_enc_pbuffer, m_current_display_pnum );
//10. Work out how many blocks are intra
- m_pcoder.IntraModeAnalyse(m_enc_pbuffer, m_current_display_pnum);
+ m_pcoder.IntraModeAnalyse( m_enc_pbuffer, m_current_display_pnum );
//11. Change the GOP structure to PPP if there are too many intras
- if(m_L1_sep > 1 && current_pic->GetMEData().IntraBlockRatio() > 0.25
- && (m_current_display_pnum % (m_encparams.L1Sep()*field_factor)) == 0)
- {
+ if ( m_L1_sep>1 && current_pic->GetMEData().IntraBlockRatio()>0.25
+ && (m_current_display_pnum % (m_encparams.L1Sep()*field_factor))==0){
subgroup_reconfig = true;
m_L1_sep = 1;
- for(int i = 0; i < field_factor * m_encparams.L1Sep(); ++i)
- {
+ for (int i = 0; i<field_factor*m_encparams.L1Sep(); ++i){
- int pnum = m_current_display_pnum - i + (field_factor - 1);
+ int pnum = m_current_display_pnum-i+(field_factor-1);
EncPicture& enc_pic = m_enc_pbuffer.GetPicture(pnum);
PictureParams& pparams = enc_pic.GetPparams();
- SetPicTypeAndRefs(pparams);
- enc_pic.UpdateStatus(DONE_SET_PTYPE);
+ SetPicTypeAndRefs( pparams );
+ enc_pic.UpdateStatus( DONE_SET_PTYPE );
}
- current_pic->SetStatus(DONE_SET_PTYPE);
+ current_pic->SetStatus( DONE_SET_PTYPE );
// Current picture to code has now changed: recalculate
- m_current_display_pnum = CodedToDisplay(m_current_code_pnum);
- current_pic = &m_enc_pbuffer.GetPicture(m_current_display_pnum);
+ m_current_display_pnum = CodedToDisplay( m_current_code_pnum );
+ current_pic = &m_enc_pbuffer.GetPicture(m_current_display_pnum );
current_pp = &current_pic->GetPparams();
}
- }
- while(subgroup_reconfig == true);
+ }while(subgroup_reconfig==true);
//11. Do cut detection and insert intra pictures
- if(current_pic->GetMEData().IntraBlockRatio() > 0.3333)
- {
+ if ( current_pic->GetMEData().IntraBlockRatio()>0.3333 ){
is_a_cut = true;
- if(m_encparams.L1Sep() > 1 &&
- (m_current_display_pnum % (field_factor * m_encparams.L1Sep())) == 0)
- {
+ if ( m_encparams.L1Sep()>1 &&
+ (m_current_display_pnum % (field_factor*m_encparams.L1Sep())) == 0){
m_gop_start_num = current_pp->PictureNum();//restart the GOP
}
- if(current_pp->PicSort().IsRef()) // Set the picture type to intra
- current_pic->SetPictureSort(PictureSort::IntraRefPictureSort());
+ if ( current_pp->PicSort().IsRef() ) // Set the picture type to intra
+ current_pic->SetPictureSort (PictureSort::IntraRefPictureSort());
else
- current_pic->SetPictureSort(PictureSort::IntraNonRefPictureSort());
+ current_pic->SetPictureSort (PictureSort::IntraNonRefPictureSort());
- if(m_encparams.Verbose())
- std::cout << std::endl << "Cut detected and I-picture inserted!";
+ if ( m_encparams.Verbose() )
+ std::cout<<std::endl<<"Cut detected and I-picture inserted!";
}
- else
- {
- //12. Do motion compensation if not a cut
+ else{
+ //12. Do motion compensation if not a cut
// MEData& me_data = current_pic->GetMEData();
//
// if (me_data.IntraBlockRatio()>0.1)//FIXME: this is broken with adaptive block sizes
// m_predparams.SetBlockSizes(*m_intra_olbp, m_srcparams.CFormat() );
- m_pcoder.MotionCompensate(m_enc_pbuffer, m_current_display_pnum, SUBTRACT);
- current_pic->UpdateStatus(DONE_MC);
+ m_pcoder.MotionCompensate(m_enc_pbuffer, m_current_display_pnum, SUBTRACT );
+ current_pic->UpdateStatus( DONE_MC );
}
}
- if(current_pp->PicSort().IsRef() == true)
- m_enc_pbuffer.SetRetiredPictureNum(m_show_pnum, m_current_display_pnum);
+ if ( current_pp->PicSort().IsRef()==true )
+ m_enc_pbuffer.SetRetiredPictureNum( m_show_pnum, m_current_display_pnum );
// 12. Now code the residual data and motion data
- if(m_encparams.TargetRate() != 0)
- UpdateIntraPicCBRModel(*current_pp, is_a_cut);
+ if (m_encparams.TargetRate() != 0)
+ UpdateIntraPicCBRModel( *current_pp, is_a_cut );
// 13. Write a sequence header if necessary
- if((m_encparams.NumL1() > 0 && current_pp->PicSort().IsRef() == true &&
- current_pp->PicSort().IsIntra() == true && (m_current_display_pnum % m_encparams.L1Sep() == 0)) ||
- (m_encparams.NumL1() == 0 && (m_current_display_pnum % m_encparams.GOPLength()) == 0))
+ if( (m_encparams.NumL1() > 0 && current_pp->PicSort().IsRef()==true &&
+ current_pp->PicSort().IsIntra()==true && (m_current_display_pnum % m_encparams.L1Sep() == 0)) ||
+ (m_encparams.NumL1() == 0 && (m_current_display_pnum % m_encparams.GOPLength())==0))
{
- if(m_encparams.Verbose())
+ if (m_encparams.Verbose())
{
- std::cout << std::endl << std::endl << "GOP start: writing sequence header before picture ";
- std::cout << m_current_display_pnum;
+ std::cout<<std::endl<<std::endl<<"GOP start: writing sequence header before picture ";
+ std::cout<<m_current_display_pnum;
}
SequenceHeaderByteIO *p_seqheader_byteio = new SequenceHeaderByteIO
- (m_pic_in->GetSourceParams(),
- m_encparams);
+ ( m_pic_in->GetSourceParams(),
+ m_encparams);
p_seqheader_byteio->Output();
m_dirac_byte_stream.AddSequenceHeader(p_seqheader_byteio);
}
// 13. Write the picture header.
- PictureByteIO* p_picture_byteio = new PictureByteIO(*current_pp, m_current_display_pnum);
+ PictureByteIO* p_picture_byteio = new PictureByteIO(*current_pp, m_current_display_pnum );
p_picture_byteio->Output();
- if(m_encparams.Verbose())
- {
- if(m_encparams.TargetRate() != 0)
+ if ( m_encparams.Verbose() ){
+ if (m_encparams.TargetRate()!=0 )
m_ratecontrol->Report();
- if(m_encparams.FieldCoding())
- std::cout << std::endl << std::endl << "Compressing field " << m_current_code_pnum << ", ";
+ if (m_encparams.FieldCoding())
+ std::cout<<std::endl<<std::endl<<"Compressing field "<<m_current_code_pnum<<", ";
else
- std::cout << std::endl << std::endl << "Compressing frame " << m_current_code_pnum << ", ";
- std::cout << m_current_display_pnum << " in display order";
-
- if(is_a_cut == true || current_pp->PicSort().IsIntra() == false)
- std::cout << std::endl << current_pic->GetMEData().IntraBlockRatio() * 100.0 << "% of blocks are intra ";
- if(is_a_cut == true)
- std::cout << std::endl << "Cut detected and intra picture inserted.";
-
- std::cout << std::endl << "Picture type is ";
- if(current_pp->PicSort().IsRef())
- std::cout << "REF";
- else std::cout << "NON-REF";
-
- std::cout << " , ";
- if(current_pp->PicSort().IsIntra())
- std::cout << "INTRA";
- else std::cout << "INTER";
-
- if(current_pp->PicSort().IsInter())
- {
- std::cout << std::endl << "References "
- << (m_encparams.FieldCoding() ? "field " : "frame ")
- << current_pp->Refs()[0];
- if(current_pp->Refs().size() > 1)
- std::cout << " and " << current_pp->Refs()[1];
+ std::cout<<std::endl<<std::endl<<"Compressing frame "<<m_current_code_pnum<<", ";
+ std::cout<<m_current_display_pnum<<" in display order";
+
+ if (is_a_cut==true || current_pp->PicSort().IsIntra()==false )
+ std::cout<<std::endl<<current_pic->GetMEData().IntraBlockRatio()*100.0<<"% of blocks are intra ";
+ if (is_a_cut==true)
+ std::cout<<std::endl<<"Cut detected and intra picture inserted.";
+
+ std::cout<<std::endl<<"Picture type is ";
+ if (current_pp->PicSort().IsRef() )
+ std::cout<<"REF";
+ else std::cout<<"NON-REF";
+
+ std::cout<<" , ";
+ if (current_pp->PicSort().IsIntra())
+ std::cout<<"INTRA";
+ else std::cout<<"INTER";
+
+ if ( current_pp->PicSort().IsInter() ){
+ std::cout<<std::endl<<"References "
+ << (m_encparams.FieldCoding() ? "field " : "frame ")
+ << current_pp->Refs()[0];
+ if (current_pp->Refs().size() > 1)
+ std::cout<<" and "<< current_pp->Refs()[1];
}
}
// 14. Code the motion vectors
- if(current_pp->PicSort().IsInter())
+ if ( current_pp->PicSort().IsInter() )
m_pcoder.CodeMVData(m_enc_pbuffer , m_current_display_pnum, p_picture_byteio);
// 15. Do prefiltering on the residue if necessary
- if(m_encparams.Prefilter() != NO_PF)
- m_pcoder.Prefilter(m_enc_pbuffer, m_current_display_pnum);
+ if (m_encparams.Prefilter() != NO_PF )
+ m_pcoder.Prefilter( m_enc_pbuffer, m_current_display_pnum );
// 16. Do the transform on the 3 components
- m_pcoder.DoDWT(m_enc_pbuffer, m_current_display_pnum , FORWARD);
+ m_pcoder.DoDWT( m_enc_pbuffer, m_current_display_pnum , FORWARD);
// 17. Select the quantisers
@@ -474,46 +453,44 @@ const EncPicture* SequenceCompressor::CompressNextPicture()
m_dirac_byte_stream.AddPicture(p_picture_byteio);
// 19. Do the inverse DWT if necessary
- m_pcoder.DoDWT(m_enc_pbuffer, m_current_display_pnum , BACKWARD);
+ m_pcoder.DoDWT( m_enc_pbuffer, m_current_display_pnum , BACKWARD);
// 20. Motion compensate back if necessary
- if(psort.IsInter() && !is_a_cut)
- m_pcoder.MotionCompensate(m_enc_pbuffer, m_current_display_pnum, ADD);
+ if (psort.IsInter() && !is_a_cut )
+ m_pcoder.MotionCompensate(m_enc_pbuffer, m_current_display_pnum, ADD );
// Reset block sizes for next picture
- m_predparams.SetBlockSizes(*m_basic_olb_params2, m_srcparams.CFormat());
+ m_predparams.SetBlockSizes(*m_basic_olb_params2, m_srcparams.CFormat() );
// 21. Clip the data to keep it in range
current_pic->Clip();
// Use the results of encoding to update the CBR model
- if(m_encparams.TargetRate() != 0)
- UpdateCBRModel(*current_pic, p_picture_byteio);
+ if (m_encparams.TargetRate() != 0 )
+ UpdateCBRModel(*current_pic, p_picture_byteio);
// 22. Measure the encoded picture quality
- if(m_encparams.LocalDecode())
- m_qmonitor.UpdateModel(*current_pic);
+ if ( m_encparams.LocalDecode() )
+ m_qmonitor.UpdateModel( *current_pic );
// Increment our position
m_current_code_pnum++;
CleanBuffers();
- current_pic->SetStatus(ALL_ENC);
+ current_pic->SetStatus( ALL_ENC );
}
// Return the latest picture that can be shown
- if(m_enc_pbuffer.GetPicture(m_show_pnum).GetStatus() == ALL_ENC)
- {
- if(m_encparams.Verbose())
- {
- std::cout << std::endl << "Return " <<
- (m_encparams.FieldCoding() ? "field " : "frame ") <<
- m_show_pnum << " in display order";
+ if ( m_enc_pbuffer.GetPicture(m_show_pnum).GetStatus() == ALL_ENC ){
+ if ( m_encparams.Verbose() ){
+ std::cout<<std::endl<<"Return " <<
+ (m_encparams.FieldCoding() ? "field " : "frame ") <<
+ m_show_pnum << " in display order";
}
- return &m_enc_pbuffer.GetPicture(m_show_pnum);
+ return &m_enc_pbuffer.GetPicture(m_show_pnum );
}
else
return NULL;
@@ -524,14 +501,14 @@ const EncPicture* SequenceCompressor::CompressNextPicture()
void SequenceCompressor::CleanBuffers()
{
// If we're not at the beginning, clean the buffer
- if(m_current_code_pnum != 0)
- m_enc_pbuffer.CleanRetired(m_show_pnum, m_current_display_pnum);
+ if ( m_current_code_pnum != 0 )
+ m_enc_pbuffer.CleanRetired( m_show_pnum, m_current_display_pnum );
}
const EncPicture *SequenceCompressor::GetPictureEncoded()
{
- if(m_current_display_pnum >= 0)
- return &m_enc_pbuffer.GetPicture(m_current_display_pnum);
+ if (m_current_display_pnum >= 0)
+ return &m_enc_pbuffer.GetPicture( m_current_display_pnum );
return 0;
}
@@ -540,9 +517,9 @@ DiracByteStats SequenceCompressor::EndSequence()
{
DiracByteStats seq_stats;
- if(m_just_finished)
+ if (m_just_finished)
{
- seq_stats = m_dirac_byte_stream.EndSequence();
+ seq_stats=m_dirac_byte_stream.EndSequence();
m_just_finished = false;
m_all_done = true;
}
@@ -554,23 +531,21 @@ DiracByteStats SequenceCompressor::EndSequence()
void SequenceCompressor::MakeSequenceReport()
{
- if(m_encparams.LocalDecode())
+ if ( m_encparams.LocalDecode() )
m_qmonitor.WriteLog();
- std::cout << std::endl;
+ std::cout<<std::endl;
}
-void SequenceCompressor::UpdateIntraPicCBRModel(const PictureParams& pparams, const bool is_a_cut)
-{
+void SequenceCompressor::UpdateIntraPicCBRModel( const PictureParams& pparams, const bool is_a_cut ){
// For intra pictures we want to update before coding
// especially if they're inserted
- if(pparams.PicSort().IsIntra() && m_current_display_pnum > 0 &&
- m_encparams.NumL1() != 0)
- {
+ if ( pparams.PicSort().IsIntra() && m_current_display_pnum > 0 &&
+ m_encparams.NumL1() != 0){
// Calculate the new QF for encoding the following I picture
- if(is_a_cut)
+ if ( is_a_cut )
m_ratecontrol->SetCutPictureQualFactor();
else
m_ratecontrol->CalcNextIntraQualFactor();
@@ -578,14 +553,14 @@ void SequenceCompressor::UpdateIntraPicCBRModel(const PictureParams& pparams, co
}
FrameSequenceCompressor::FrameSequenceCompressor(
- StreamPicInput* pin ,
- EncoderParams& encp,
- DiracByteStream& dirac_byte_stream):
+ StreamPicInput* pin ,
+ EncoderParams& encp,
+ DiracByteStream& dirac_byte_stream):
SequenceCompressor(pin, encp, dirac_byte_stream)
{
}
-void FrameSequenceCompressor::SetPicTypeAndRefs(PictureParams& pparams)
+void FrameSequenceCompressor::SetPicTypeAndRefs( PictureParams& pparams )
{
// Set the temporal prediction parameters for frame coding
@@ -594,94 +569,88 @@ void FrameSequenceCompressor::SetPicTypeAndRefs(PictureParams& pparams)
const int gop_len = m_encparams.GOPLength();
const int num_L1 = m_encparams.NumL1();
- pparams.SetRetiredPictureNum(-1);
+ pparams.SetRetiredPictureNum( -1 );
pparams.Refs().clear();
- if(num_L1 > 0)
- {
+ if ( num_L1>0 ){
- if(rel_pnum % gop_len == 0)
- {
- if(gop_len > 1)
- pparams.SetPicSort(PictureSort::IntraRefPictureSort());
+ if ( rel_pnum % gop_len == 0){
+ if (gop_len > 1)
+ pparams.SetPicSort( PictureSort::IntraRefPictureSort());
else // I-picture only coding
- pparams.SetPicSort(PictureSort::IntraNonRefPictureSort());
+ pparams.SetPicSort( PictureSort::IntraNonRefPictureSort());
// I picture expires after we've coded the next I picture
- pparams.SetExpiryTime(2 * m_L1_sep);
+ pparams.SetExpiryTime( 2*m_L1_sep );
}
- else if(rel_pnum % m_L1_sep == 0)
- {
- pparams.SetPicSort(PictureSort::InterRefPictureSort());
+ else if (rel_pnum % m_L1_sep == 0){
+ pparams.SetPicSort( PictureSort::InterRefPictureSort());
// Ref the previous I or L1 picture
- pparams.Refs().push_back(pnum - m_L1_sep);
+ pparams.Refs().push_back( pnum - m_L1_sep );
// if we don't have the first L1 picture ...
- if(((rel_pnum - m_L1_sep) % gop_len > 0) && m_L1_sep > 1)
+ if ( ((rel_pnum-m_L1_sep) % gop_len>0) && m_L1_sep>1)
// ... other ref is the prior I/L1 picture but one
- pparams.Refs().push_back(pnum - 2 * m_L1_sep);
+ pparams.Refs().push_back( pnum - 2*m_L1_sep );
// Expires after the next L1 or I picture
- pparams.SetExpiryTime(2 * m_L1_sep);
- if(rel_pnum % m_encparams.L1Sep() == 0)
- pparams.SetExpiryTime(2 * m_encparams.L1Sep());
+ pparams.SetExpiryTime( 2*m_L1_sep );
+ if (rel_pnum % m_encparams.L1Sep() == 0 )
+ pparams.SetExpiryTime(2*m_encparams.L1Sep());
}
- else if((rel_pnum + 1) % m_L1_sep == 0)
- {
- pparams.SetPicSort(PictureSort::InterNonRefPictureSort());
+ else if ((rel_pnum+1) % m_L1_sep == 0){
+ pparams.SetPicSort( PictureSort::InterNonRefPictureSort());
// .. and the previous picture
- pparams.Refs().push_back(pnum - 1);
+ pparams.Refs().push_back(pnum-1);
// Refs are the next I or L1 picture ...
- if(m_enc_pbuffer.IsPictureAvail(pnum + 1))
- pparams.Refs().push_back(pnum + 1);
+ if (m_enc_pbuffer.IsPictureAvail(pnum+1))
+ pparams.Refs().push_back(pnum+1);
- pparams.SetExpiryTime(1);
+ pparams.SetExpiryTime( 1 );
}
- else
- {
- pparams.SetPicSort(PictureSort::InterRefPictureSort());
+ else{
+ pparams.SetPicSort( PictureSort::InterRefPictureSort());
// .. and the previous picture
- pparams.Refs().push_back(pnum - 1);
+ pparams.Refs().push_back(pnum-1);
// Refs are the next I or L1 picture ...
- int next_ref = ((pnum / m_L1_sep) + 1) * m_L1_sep;
- if(m_enc_pbuffer.IsPictureAvail(next_ref))
+ int next_ref = ((pnum/m_L1_sep)+1)*m_L1_sep;
+ if (m_enc_pbuffer.IsPictureAvail(next_ref))
pparams.Refs().push_back(next_ref);
- pparams.SetExpiryTime(2);
+ pparams.SetExpiryTime( 2 );
}
}
- else
- {
- pparams.SetPicSort(PictureSort::IntraNonRefPictureSort());
- pparams.SetExpiryTime(1);
+ else{
+ pparams.SetPicSort( PictureSort::IntraNonRefPictureSort());
+ pparams.SetExpiryTime( 1 );
}
}
bool FrameSequenceCompressor::LoadNextFrame()
{
- PictureParams pp(m_pparams);
- pp.SetPictureNum(m_last_picture_read + 1);
+ PictureParams pp( m_pparams );
+ pp.SetPictureNum( m_last_picture_read+1 );
// Set an initially huge expiry time as we don't know when it will expire yet
- pp.SetExpiryTime(1 << 30);
+ pp.SetExpiryTime(1<<30);
- m_enc_pbuffer.PushPicture(pp);
+ m_enc_pbuffer.PushPicture( pp );
- m_pic_in->ReadNextPicture(m_enc_pbuffer.GetPicture(m_last_picture_read + 1));
+ m_pic_in->ReadNextPicture( m_enc_pbuffer.GetPicture(m_last_picture_read+1) );
// Copy into the original data
- m_enc_pbuffer.GetPicture(m_last_picture_read + 1).SetOrigData();
+ m_enc_pbuffer.GetPicture(m_last_picture_read+1).SetOrigData();
- if(m_encparams.Prefilter() == CWM)
- CWMFilter(m_enc_pbuffer.GetPicture(m_last_picture_read + 1) ,
- m_encparams.PrefilterStrength());
+ if ( m_encparams.Prefilter()==CWM )
+ CWMFilter(m_enc_pbuffer.GetPicture( m_last_picture_read+1 ) ,
+ m_encparams.PrefilterStrength() );
- if(m_pic_in->End())
+ if ( m_pic_in->End() )
{
m_all_done = true;
return false;
@@ -692,45 +661,43 @@ bool FrameSequenceCompressor::LoadNextFrame()
return true;
}
-int FrameSequenceCompressor::CodedToDisplay(const int cnum)
+int FrameSequenceCompressor::CodedToDisplay( const int cnum )
{
int div;
- if(m_L1_sep > 0)
+ if (m_L1_sep>0)
{
// We have L1 and L2 pictures
- if(cnum == 0)
+ if (cnum==0)
return 0;
- else if((cnum - 1) % m_L1_sep == 0)
- {
- //we have L1 or subsequent I pictures
- div = (cnum - 1) / m_L1_sep;
- return cnum + m_L1_sep - 1;
+ else if ((cnum-1)% m_L1_sep==0)
+ {//we have L1 or subsequent I pictures
+ div=(cnum-1)/m_L1_sep;
+ return cnum+m_L1_sep-1;
}
else//we have L2 pictures
- return cnum - 1;
+ return cnum-1;
}
else
- {
- //we just have I-pictures, so no re-ordering
+ {//we just have I-pictures, so no re-ordering
return cnum;
}
}
void FrameSequenceCompressor::UpdateCBRModel(EncPicture& my_frame,
- const PictureByteIO* p_picture_byteio)
+ const PictureByteIO* p_picture_byteio)
{
// Update the quality factor
- m_ratecontrol->CalcNextQualFactor(my_frame.GetPparams(), p_picture_byteio->GetSize() * 8);
+ m_ratecontrol->CalcNextQualFactor(my_frame.GetPparams(), p_picture_byteio->GetSize()*8);
}
FieldSequenceCompressor::FieldSequenceCompressor(
- StreamPicInput* pin ,
- EncoderParams& encp,
- DiracByteStream& dirac_byte_stream):
+ StreamPicInput* pin ,
+ EncoderParams& encp,
+ DiracByteStream& dirac_byte_stream):
SequenceCompressor(pin, encp, dirac_byte_stream)
{
m_delay = 2;
@@ -738,37 +705,34 @@ FieldSequenceCompressor::FieldSequenceCompressor(
bool FieldSequenceCompressor::LoadNextFrame()
{
- PictureParams pp(m_pparams);
- pp.SetExpiryTime(1 << 30);
+ PictureParams pp( m_pparams );
+ pp.SetExpiryTime( 1<<30 );
- int pnum = m_last_picture_read + 1;
+ int pnum = m_last_picture_read+1;
- for(int j = pnum; j <= pnum + 1; ++j)
- {
- pp.SetPictureNum(j);
- m_enc_pbuffer.PushPicture(pp);
+ for (int j=pnum; j<=pnum+1; ++j){
+ pp.SetPictureNum( j );
+ m_enc_pbuffer.PushPicture( pp );
}
StreamFieldInput* field_input = (StreamFieldInput*) m_pic_in;
- field_input->ReadNextFrame(m_enc_pbuffer.GetPicture(pnum), m_enc_pbuffer.GetPicture(pnum + 1));
+ field_input->ReadNextFrame( m_enc_pbuffer.GetPicture( pnum ), m_enc_pbuffer.GetPicture(pnum+1) );
// Copy data across
- for(int j = pnum; j <= pnum + 1; ++j)
- {
- m_enc_pbuffer.GetPicture(j).SetOrigData();
+ for (int j=pnum; j<=pnum+1; ++j){
+ m_enc_pbuffer.GetPicture( j ).SetOrigData();
- if(m_encparams.Prefilter() == CWM)
- CWMFilter(m_enc_pbuffer.GetPicture(j), m_encparams.PrefilterStrength());
+ if ( m_encparams.Prefilter()==CWM )
+ CWMFilter(m_enc_pbuffer.GetPicture( j ), m_encparams.PrefilterStrength() );
}
- if(m_pic_in->End())
- {
+ if ( m_pic_in->End() ){
m_all_done = true;
return false;
}
- m_last_picture_read += 2;
+ m_last_picture_read +=2;
return true;
}
@@ -776,124 +740,113 @@ bool FieldSequenceCompressor::LoadNextFrame()
void FieldSequenceCompressor::PreMotionEstmationFilter(PicArray& comp)
{
//Special case for first row
- for(int i = comp.FirstX(); i <= comp.LastX(); ++i)
+ for (int i = comp.FirstX(); i <= comp.LastX(); ++i)
{
- comp[comp.FirstY()][i] = (3 * comp[comp.FirstY()][i] +
- comp[comp.FirstY()+1][i] + 2) >> 2;
+ comp[comp.FirstY()][i] = (3*comp[comp.FirstY()][i] +
+ comp[comp.FirstY()+1][i] +2 )>>2;
}
//Middle section
- for(int j = comp.FirstY() + 1; j < comp.LastY(); ++j)
+ for (int j = comp.FirstY()+1; j < comp.LastY(); ++j)
{
- for(int i = comp.FirstX(); i <= comp.LastX(); ++i)
+ for (int i = comp.FirstX(); i <= comp.LastX(); ++i)
{
- comp[j][i] = (comp[j-1][i] + 2 * comp[j][i] + comp[j+1][i] + 2) >> 2;
+ comp[j][i] = (comp[j-1][i] + 2*comp[j][i] + comp[j+1][i] + 2)>>2;
}
}
//Special case for last row
- for(int i = comp.FirstX(); i <= comp.LastX(); ++i)
+ for (int i = comp.FirstX(); i <= comp.LastX(); ++i)
{
comp[comp.LastY()][i] = (comp[comp.LastY()-1][i] +
- 3 * comp[comp.LastY()][i] + 2) >> 2;
+ 3*comp[comp.LastY()][i] + 2)>>2;
}
}
-void FieldSequenceCompressor::SetPicTypeAndRefs(PictureParams& pparams)
+void FieldSequenceCompressor::SetPicTypeAndRefs( PictureParams& pparams )
{
// FIXME: won't work with adaptive GOP properly
// Set the temporal prediction parameters for field coding
const int pnum = pparams.PictureNum();
- const int rel_pnum = pparams.PictureNum() - m_gop_start_num;
+ const int rel_pnum = pparams.PictureNum()-m_gop_start_num;
const int gop_len = m_encparams.GOPLength();
const int num_L1 = m_encparams.NumL1();
- pparams.SetRetiredPictureNum(-1);
+ pparams.SetRetiredPictureNum( -1 );
pparams.Refs().clear();
- if(num_L1 > 0)
- {
+ if ( num_L1>0 ){
- if((rel_pnum / 2) % gop_len == 0)
- {
+ if ( (rel_pnum/2) % gop_len == 0){
// Field 1 is Intra Field
- if(gop_len > 1)
- {
- pparams.SetPicSort(PictureSort::IntraRefPictureSort());
+ if (gop_len > 1){
+ pparams.SetPicSort( PictureSort::IntraRefPictureSort());
// I picture expires after we've coded the next L1 picture
- pparams.SetExpiryTime(gop_len * 2);
- pparams.SetExpiryTime(2 * m_L1_sep);
- if(pnum % 2)
- {
- pparams.SetPicSort(PictureSort::InterRefPictureSort());
+ pparams.SetExpiryTime( gop_len * 2);
+ pparams.SetExpiryTime( 2*m_L1_sep );
+ if ( pnum%2){
+ pparams.SetPicSort( PictureSort::InterRefPictureSort());
// Ref the previous I field
- pparams.Refs().push_back(pnum - 1);
+ pparams.Refs().push_back( pnum-1 );
}
}
- else
- {
+ else{
// I-picture only coding
- pparams.SetPicSort(PictureSort::IntraNonRefPictureSort());
- pparams.SetExpiryTime(gop_len);
+ pparams.SetPicSort( PictureSort::IntraNonRefPictureSort());
+ pparams.SetExpiryTime( gop_len );
}
}
- else if((rel_pnum / 2) % m_L1_sep == 0)
- {
+ else if ((rel_pnum/2) % m_L1_sep == 0){
- pparams.SetPicSort(PictureSort::InterRefPictureSort());
+ pparams.SetPicSort( PictureSort::InterRefPictureSort());
- if(pnum % 2)
- {
+ if (pnum%2){
// Field 2
// Ref the first field of same picture
- pparams.Refs().push_back(pnum - 1);
+ pparams.Refs().push_back( pnum - 1);
// Ref the previous field 2 of I or L1 picture
- pparams.Refs().push_back(pnum - m_L1_sep * 2);
+ pparams.Refs().push_back( pnum - m_L1_sep*2 );
}
- else
- {
+ else{
// Field 1
// Ref the field 1 of previous I or L1 picture
- pparams.Refs().push_back(pnum - m_L1_sep * 2);
+ pparams.Refs().push_back( pnum - m_L1_sep*2 );
// Ref the field 2 of previous I or L1 picture
- pparams.Refs().push_back(pnum - m_L1_sep * 2 + 1);
+ pparams.Refs().push_back( pnum - m_L1_sep*2 + 1 );
}
// Expires after the next L1 or I picture
- pparams.SetExpiryTime((m_L1_sep + 1) * 2 - 1);
- if((rel_pnum / 2) % m_encparams.L1Sep() == 0)
- pparams.SetExpiryTime((2 * m_encparams.L1Sep()) + 1 * 2 - 1);
+ pparams.SetExpiryTime( (m_L1_sep+1)*2-1 );
+ if ((rel_pnum/2) % m_encparams.L1Sep() == 0 )
+ pparams.SetExpiryTime((2*m_encparams.L1Sep())+1*2-1);
}
- else if((rel_pnum / 2 + 1) % m_L1_sep == 0)
- {
+ else if ((rel_pnum/2+1) % m_L1_sep == 0){
// Bi-directional non-reference fields.
- if(pnum % 2)
- pparams.SetPicSort(PictureSort::InterNonRefPictureSort());
+ if (pnum%2)
+ pparams.SetPicSort( PictureSort::InterNonRefPictureSort());
else
- pparams.SetPicSort(PictureSort::InterRefPictureSort());
+ pparams.SetPicSort( PictureSort::InterRefPictureSort());
- pparams.Refs().push_back(pnum - 1);
- if(m_enc_pbuffer.IsPictureAvail(pnum + 2))
- pparams.Refs().push_back(pnum + 2);
+ pparams.Refs().push_back(pnum-1);
+ if (m_enc_pbuffer.IsPictureAvail(pnum+2))
+ pparams.Refs().push_back(pnum+2);
- pparams.SetExpiryTime(1);
+ pparams.SetExpiryTime( 1 );
}
- else
- {
+ else{
// Bi-directional reference fields.
- pparams.SetPicSort(PictureSort::InterRefPictureSort());
+ pparams.SetPicSort( PictureSort::InterRefPictureSort());
- pparams.Refs().push_back(pnum - 1);
- int next_ref = (((pnum / 2) / m_L1_sep + 1) * m_L1_sep) * 2 + (pnum % 2);
- if(m_enc_pbuffer.IsPictureAvail(next_ref))
+ pparams.Refs().push_back(pnum-1);
+ int next_ref = (((pnum/2)/m_L1_sep+1)*m_L1_sep)*2+(pnum%2);
+ if (m_enc_pbuffer.IsPictureAvail(next_ref))
pparams.Refs().push_back(next_ref);
- pparams.SetExpiryTime(4);
+ pparams.SetExpiryTime( 4 );
}
}
- else
- {
- pparams.SetPicSort(PictureSort::IntraNonRefPictureSort());
- pparams.SetExpiryTime(2);
+ else{
+ pparams.SetPicSort( PictureSort::IntraNonRefPictureSort());
+ pparams.SetExpiryTime( 2 );
}
}
@@ -901,41 +854,39 @@ FieldSequenceCompressor::~FieldSequenceCompressor()
{
}
-int FieldSequenceCompressor::CodedToDisplay(const int pnum)
+int FieldSequenceCompressor::CodedToDisplay( const int pnum )
{
- // Frame the field pnum belongs to
- int fnum = pnum >> 1;
- if(m_L1_sep > 0)
+ // Frame the field pnum belongs to
+ int fnum = pnum>>1;
+ if (m_L1_sep>0)
{
// We have L1 and L2 frames
- if(fnum == 0)
+ if (fnum==0)
return pnum;
- else if((fnum - 1) % m_L1_sep == 0)
- {
- //we have L1 or subsequent I frames
- return (pnum + (m_L1_sep - 1) * 2);
+ else if ((fnum-1)% m_L1_sep==0)
+ {//we have L1 or subsequent I frames
+ return (pnum+(m_L1_sep-1)*2);
}
else//we have L2 frames
return (pnum - 2);
}
else
- {
- //we just have I-frames, so no re-ordering
+ {//we just have I-frames, so no re-ordering
return (pnum);
}
}
void FieldSequenceCompressor::UpdateCBRModel(EncPicture& my_picture,
- const PictureByteIO* p_picture_byteio)
+ const PictureByteIO* p_picture_byteio)
{
- if(m_current_display_pnum % 2 == 0)
+ if (m_current_display_pnum%2 == 0)
m_field1_bytes = p_picture_byteio->GetSize();
else
m_field2_bytes = p_picture_byteio->GetSize();
// Update the quality factor
- if(my_picture.GetPparams().PictureNum() % 2)
- m_ratecontrol->CalcNextQualFactor(my_picture.GetPparams(), (m_field1_bytes + m_field2_bytes) * 8);
+ if (my_picture.GetPparams().PictureNum()%2)
+ m_ratecontrol->CalcNextQualFactor(my_picture.GetPparams(), (m_field1_bytes+m_field2_bytes)*8);
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.h
index 40e754e71..37f5496be 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_encoder/seq_compress.h
@@ -61,337 +61,327 @@
namespace dirac
{
-//! Compresses a sequence of frames/fields from a stream.
-/*!
- This class compresses a sequence of frames/fields, frame by frame.
- or field by field. It currently uses GOP parameters set in the encoder
- parameters in order to define the temporal prediction structure.
- A version to incorporate non-GOP structures is TBC.
-
- This is an abstract class.
-*/
-class SequenceCompressor
-{
-public:
- //! Constructor
+ //! Compresses a sequence of frames/fields from a stream.
/*!
- Creates a sequence compressor, and prepares to begin compressing
- with the first picture.Sets up picture padding in the picture input if
- necesary
- \param pin an input stream containing a sequence of frames
- \param encp parameters for the encoding process
- \param dirac_byte_stream Output destination for compressed data
- */
- SequenceCompressor(StreamPicInput* pin,
- EncoderParams& encp,
- DiracByteStream& dirac_byte_stream);
+ This class compresses a sequence of frames/fields, frame by frame.
+ or field by field. It currently uses GOP parameters set in the encoder
+ parameters in order to define the temporal prediction structure.
+ A version to incorporate non-GOP structures is TBC.
- //! Destructor
- /*!
- Destructor. Must delete IO objects created by constructor.
+ This is an abstract class.
*/
- virtual ~SequenceCompressor();
+ class SequenceCompressor{
+ public:
+ //! Constructor
+ /*!
+ Creates a sequence compressor, and prepares to begin compressing
+ with the first picture.Sets up picture padding in the picture input if
+ necesary
+ \param pin an input stream containing a sequence of frames
+ \param encp parameters for the encoding process
+ \param dirac_byte_stream Output destination for compressed data
+ */
+ SequenceCompressor(StreamPicInput* pin,
+ EncoderParams& encp,
+ DiracByteStream& dirac_byte_stream);
+
+ //! Destructor
+ /*!
+ Destructor. Must delete IO objects created by constructor.
+ */
+ virtual ~SequenceCompressor();
+
+ //! Load data
+ /*!
+ Load one picture of data into the Sequence Compressor. Sets
+ m_all_done to true if no more data is available to be loaded.
+ Input can be frame or field. So the child class will have to
+ implement this function.
+ \return true - if frame load succeeded.
+ false - otherwise
+ */
+ virtual bool LoadNextFrame() = 0;
+
+ //! Compress the next picture in sequence
+ /*!
+ This function codes the next picture in coding order and returns the
+ next picture in display order. In general these will differ, and
+ because of re-ordering there is a delay which needs to be imposed.
+ This creates problems at the start and at the end of the sequence
+ which must be dealt with. At the start we just keep outputting
+ picture 0. At the end you will need to loop for longer to get all
+ the pictures out. It's up to the calling function to do something
+ with the decoded pictures as they come out -- write them to screen
+ or to file, for example. .
+ If coding is fast enough the compressed version could be watched
+ real-time (with suitable buffering in the calling function to
+ account for encode-time variations).
+
+ NOTE: LoadNextFrame must be called atleast once before invoking this
+ method.
+
+ \return pointer to the next locally decoded picture available for display
+ */
+ const EncPicture *CompressNextPicture();
+
+ //! Set up the appropriate prediction parameters for a picture
+ virtual void SetPicTypeAndRefs( PictureParams& pparams ) = 0;
+
+ //! Return a pointer to the most recent picture encoded
+ const EncPicture *GetPictureEncoded();
+
+ DiracByteStats EndSequence();
+
+ //! Determine if compression is complete.
+ /*!
+ Indicates whether or not the last picture in the sequence has been
+ compressed.
+ \return true if last picture has been compressed; false if not
+ */
+ bool Finished(){return m_all_done;}
+
+ //! Signal end of sequence
+ void SignalEOS() { m_eos_signalled = true; }
+
+ //! The delay required for correct timestamps
+ int PTSOffset(){return m_delay;}
+
+ protected:
+
+ //! Set up the motion block parameters
+ void SetMotionParameters();
+
+ //! Uses the GOP parameters to convert picture numbers in coded order to display order.
+ /*!
+ Uses the GOP parameters to convert picture numbers in coded order
+ to display order. Pure virtual function. The child class will
+ have to define it.
+ \param pnum the picture number in coded order
+ */
+ virtual int CodedToDisplay(const int pnum) = 0;
+
+ //! Make a report to screen on the coding results for the whole sequence
+ void MakeSequenceReport();
+
+ //! Remove unwanted pictures from picture buffers
+ virtual void CleanBuffers();
+
+ //! Update the CBR model based on the data we've compressed.
+ //Purely virtual. The child class will have to define it.
+ virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio) = 0;
+
+ //! Update the parameters to be used in advance of coding an intra frame
+ void UpdateIntraPicCBRModel( const PictureParams& , const bool is_a_cut );
+
+ //! Returns true if the encoder can encode a picture
+ bool CanEncode();
- //! Load data
- /*!
- Load one picture of data into the Sequence Compressor. Sets
- m_all_done to true if no more data is available to be loaded.
- Input can be frame or field. So the child class will have to
- implement this function.
- \return true - if frame load succeeded.
- false - otherwise
- */
- virtual bool LoadNextFrame() = 0;
+ //! Completion flag, returned via the Finished method.
+ bool m_all_done;
- //! Compress the next picture in sequence
- /*!
- This function codes the next picture in coding order and returns the
- next picture in display order. In general these will differ, and
- because of re-ordering there is a delay which needs to be imposed.
- This creates problems at the start and at the end of the sequence
- which must be dealt with. At the start we just keep outputting
- picture 0. At the end you will need to loop for longer to get all
- the pictures out. It's up to the calling function to do something
- with the decoded pictures as they come out -- write them to screen
- or to file, for example. .
- If coding is fast enough the compressed version could be watched
- real-time (with suitable buffering in the calling function to
- account for encode-time variations).
-
- NOTE: LoadNextFrame must be called atleast once before invoking this
- method.
-
- \return pointer to the next locally decoded picture available for display
- */
- const EncPicture *CompressNextPicture();
+ //! Flag indicating whether we've just finished.
+ /*!
+ Flag which is false if we've been all-done for more than one
+ picture, true otherwise (so that we can take actions on finishing
+ once only).
+ */
+ bool m_just_finished;
- //! Set up the appropriate prediction parameters for a picture
- virtual void SetPicTypeAndRefs(PictureParams& pparams) = 0;
+ //! A class to hold the basic block parameters
+ OLBParams* m_basic_olb_params0;
- //! Return a pointer to the most recent picture encoded
- const EncPicture *GetPictureEncoded();
+ //! A class to hold the basic block parameters
+ OLBParams* m_basic_olb_params1;
- DiracByteStats EndSequence();
+ //! A class to hold the basic block parameters
+ const OLBParams* m_basic_olb_params2;
- //! Determine if compression is complete.
- /*!
- Indicates whether or not the last picture in the sequence has been
- compressed.
- \return true if last picture has been compressed; false if not
- */
- bool Finished()
- {
- return m_all_done;
- }
+ //! A class to hold block parameters to use when there are lots of intra blocks
+ OLBParams* m_intra_olbp;
- //! Signal end of sequence
- void SignalEOS()
- {
- m_eos_signalled = true;
- }
+ //! The parameters of the input source
+ SourceParams& m_srcparams;
- //! The delay required for correct timestamps
- int PTSOffset()
- {
- return m_delay;
- }
+ //! The parameters used for encoding.
+ EncoderParams& m_encparams;
-protected:
+ //! The parameters used for ME/MC
+ PicturePredParams& m_predparams;
- //! Set up the motion block parameters
- void SetMotionParameters();
+ //! The L1 separation currently in use
+ int m_L1_sep;
- //! Uses the GOP parameters to convert picture numbers in coded order to display order.
- /*!
- Uses the GOP parameters to convert picture numbers in coded order
- to display order. Pure virtual function. The child class will
- have to define it.
- \param pnum the picture number in coded order
- */
- virtual int CodedToDisplay(const int pnum) = 0;
+ //! Generic picture parameters for initialising pictures
+ PictureParams m_pparams;
- //! Make a report to screen on the coding results for the whole sequence
- void MakeSequenceReport();
+ //! Pointer pointing at the picture input.
+ StreamPicInput* m_pic_in;
- //! Remove unwanted pictures from picture buffers
- virtual void CleanBuffers();
+ //! A picture buffer used for local storage of pictures whilst pending re-ordering or being used for reference.
+ EncQueue m_enc_pbuffer;
- //! Update the CBR model based on the data we've compressed.
- //Purely virtual. The child class will have to define it.
- virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio) = 0;
+ //state variables for CompressNextPicture
- //! Update the parameters to be used in advance of coding an intra frame
- void UpdateIntraPicCBRModel(const PictureParams& , const bool is_a_cut);
+ //! The number of the current picture to be coded, in display order
+ int m_current_display_pnum;
- //! Returns true if the encoder can encode a picture
- bool CanEncode();
+ //! The number of the current picture to be coded, in coded order
+ int m_current_code_pnum;
- //! Completion flag, returned via the Finished method.
- bool m_all_done;
+ //! The number of the picture which should be output for concurrent display or storage
+ int m_show_pnum;
- //! Flag indicating whether we've just finished.
- /*!
- Flag which is false if we've been all-done for more than one
- picture, true otherwise (so that we can take actions on finishing
- once only).
- */
- bool m_just_finished;
-
- //! A class to hold the basic block parameters
- OLBParams* m_basic_olb_params0;
-
- //! A class to hold the basic block parameters
- OLBParams* m_basic_olb_params1;
-
- //! A class to hold the basic block parameters
- const OLBParams* m_basic_olb_params2;
-
- //! A class to hold block parameters to use when there are lots of intra blocks
- OLBParams* m_intra_olbp;
-
- //! The parameters of the input source
- SourceParams& m_srcparams;
-
- //! The parameters used for encoding.
- EncoderParams& m_encparams;
-
- //! The parameters used for ME/MC
- PicturePredParams& m_predparams;
+ //! The index, in display order, of the last picture read
+ int m_last_picture_read;
- //! The L1 separation currently in use
- int m_L1_sep;
+ //! The picture number of the last GOP start
+ int m_gop_start_num;
- //! Generic picture parameters for initialising pictures
- PictureParams m_pparams;
+ //! A delay so that we don't display what we haven't coded
+ int m_delay;
- //! Pointer pointing at the picture input.
- StreamPicInput* m_pic_in;
+ //! A class for monitoring the quality of pictures and adjusting parameters appropriately
+ QualityMonitor m_qmonitor;
- //! A picture buffer used for local storage of pictures whilst pending re-ordering or being used for reference.
- EncQueue m_enc_pbuffer;
+ //! A class for monitoring and controlling bit rate
+ RateController* m_ratecontrol;
- //state variables for CompressNextPicture
+ //! A class to hold the picture compressor object
+ PictureCompressor m_pcoder;
- //! The number of the current picture to be coded, in display order
- int m_current_display_pnum;
+ //! Output destination for compressed data in bitstream format
+ DiracByteStream& m_dirac_byte_stream;
- //! The number of the current picture to be coded, in coded order
- int m_current_code_pnum;
+ //! Flag to check if End of Sequence has been signalled by the end user
+ bool m_eos_signalled;
- //! The number of the picture which should be output for concurrent display or storage
- int m_show_pnum;
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+ */
+ SequenceCompressor(const SequenceCompressor& cpy);
- //! The index, in display order, of the last picture read
- int m_last_picture_read;
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned..
+ */
+ SequenceCompressor& operator=(const SequenceCompressor& rhs);
- //! The picture number of the last GOP start
- int m_gop_start_num;
- //! A delay so that we don't display what we haven't coded
- int m_delay;
+ };
- //! A class for monitoring the quality of pictures and adjusting parameters appropriately
- QualityMonitor m_qmonitor;
-
- //! A class for monitoring and controlling bit rate
- RateController* m_ratecontrol;
-
- //! A class to hold the picture compressor object
- PictureCompressor m_pcoder;
-
- //! Output destination for compressed data in bitstream format
- DiracByteStream& m_dirac_byte_stream;
-
- //! Flag to check if End of Sequence has been signalled by the end user
- bool m_eos_signalled;
-
-private:
- //! Copy constructor is private and body-less
+ //! Compresses a sequence of frames from a stream.
/*!
- Copy constructor is private and body-less. This class should not
- be copied.
+ This class compresses a sequence of frames, frame by frame. It
+ currently uses GOP parameters set in the encoder parameters in order
+ to define the temporal prediction structure. A version to incorporate
+ non-GOP structures is TBC.
*/
- SequenceCompressor(const SequenceCompressor& cpy);
-
- //! Assignment = is private and body-less
- /*!
- Assignment = is private and body-less. This class should not be
- assigned..
- */
- SequenceCompressor& operator=(const SequenceCompressor& rhs);
-
-
-};
-
-//! Compresses a sequence of frames from a stream.
-/*!
- This class compresses a sequence of frames, frame by frame. It
- currently uses GOP parameters set in the encoder parameters in order
- to define the temporal prediction structure. A version to incorporate
- non-GOP structures is TBC.
-*/
-class FrameSequenceCompressor : public SequenceCompressor
-{
-public:
- //! Constructor
- /*!
- Creates a sequence compressor that compresses frames i.e.
- progressive data, and prepares to begin compressing
- with the first frame.Sets up frame padding in the picture input if
- necesary
- \param pin an input stream containing a sequence of frames
- \param encp parameters for the encoding process
- \param dirac_byte_stream Output destination for compressed data
- */
- FrameSequenceCompressor(StreamPicInput* pin,
- EncoderParams& encp,
- DiracByteStream& dirac_byte_stream);
-
- //! Destructor
- /*!
- Destructor. Must delete IO objects created by constructor.
- */
- virtual ~FrameSequenceCompressor() {};
-
- //! Load data
- /*!
- Load one frame of data into the Sequence Compressor. Sets
- m_all_done to true if no more data is available to be loaded.
- \return true - if frame load succeeded.
- false - otherwise
- */
- virtual bool LoadNextFrame();
-
- //! Set up the appropriate prediction parameters for a picture
- virtual void SetPicTypeAndRefs(PictureParams& pparams);
-
-protected:
- virtual int CodedToDisplay(const int pnum);
- virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio);
-
-};
-
-//! Compresses a sequence of fields from a stream.
-/*!
- This class compresses a sequence of fields, field by field. It
- currently uses GOP parameters set in the encoder parameters in order
- to define the temporal prediction structure. A version to incorporate
- non-GOP structures is TBC.
-*/
-class FieldSequenceCompressor : public SequenceCompressor
-{
-public:
- //! Constructor
- /*!
- Creates a sequence compressor that compresses fields i.e.
- interlaced data, and prepares to begin compressing
- with the first field.
- \param pin an input stream containing a sequence of frames
- \param encp parameters for the encoding process
- \param dirac_byte_stream Output destination for compressed data
- */
- FieldSequenceCompressor(StreamPicInput* pin,
- EncoderParams& encp,
- DiracByteStream& dirac_byte_stream);
-
- //! Destructor
- /*!
- Destructor. Must delete IO objects created by constructor.
- */
- virtual ~FieldSequenceCompressor();
-
- //! Load data
- /*!
- Load one frame i.e. two fields of data into the Sequence
- Compressor. Sets m_all_done to true if no more data is available
- to be loaded.
- \return true - if both fields load succeeded.
- false - otherwise
- */
- virtual bool LoadNextFrame();
-
-
- //! Set up the appropriate prediction parameters for a picture
- virtual void SetPicTypeAndRefs(PictureParams& pparams);
+ class FrameSequenceCompressor : public SequenceCompressor
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a sequence compressor that compresses frames i.e.
+ progressive data, and prepares to begin compressing
+ with the first frame.Sets up frame padding in the picture input if
+ necesary
+ \param pin an input stream containing a sequence of frames
+ \param encp parameters for the encoding process
+ \param dirac_byte_stream Output destination for compressed data
+ */
+ FrameSequenceCompressor(StreamPicInput* pin,
+ EncoderParams& encp,
+ DiracByteStream& dirac_byte_stream);
+
+ //! Destructor
+ /*!
+ Destructor. Must delete IO objects created by constructor.
+ */
+ virtual ~FrameSequenceCompressor(){};
+
+ //! Load data
+ /*!
+ Load one frame of data into the Sequence Compressor. Sets
+ m_all_done to true if no more data is available to be loaded.
+ \return true - if frame load succeeded.
+ false - otherwise
+ */
+ virtual bool LoadNextFrame();
+
+ //! Set up the appropriate prediction parameters for a picture
+ virtual void SetPicTypeAndRefs( PictureParams& pparams );
protected:
+ virtual int CodedToDisplay(const int pnum);
+ virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio);
- virtual int CodedToDisplay(const int pnum);
+ };
- virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio);
-private:
- //! Filter fields
+ //! Compresses a sequence of fields from a stream.
/*!
- Low pass filter the components in the fields used in Motion
- Estimation so that ME works better. Using a 1/4 1/2 1/4 filter
+ This class compresses a sequence of fields, field by field. It
+ currently uses GOP parameters set in the encoder parameters in order
+ to define the temporal prediction structure. A version to incorporate
+ non-GOP structures is TBC.
*/
- void PreMotionEstmationFilter(PicArray& comp);
-
- // Field1 bytes
- int m_field1_bytes;
- // Field2 bytes
- int m_field2_bytes;
-};
+ class FieldSequenceCompressor : public SequenceCompressor
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a sequence compressor that compresses fields i.e.
+ interlaced data, and prepares to begin compressing
+ with the first field.
+ \param pin an input stream containing a sequence of frames
+ \param encp parameters for the encoding process
+ \param dirac_byte_stream Output destination for compressed data
+ */
+ FieldSequenceCompressor(StreamPicInput* pin,
+ EncoderParams& encp,
+ DiracByteStream& dirac_byte_stream);
+
+ //! Destructor
+ /*!
+ Destructor. Must delete IO objects created by constructor.
+ */
+ virtual ~FieldSequenceCompressor();
+
+ //! Load data
+ /*!
+ Load one frame i.e. two fields of data into the Sequence
+ Compressor. Sets m_all_done to true if no more data is available
+ to be loaded.
+ \return true - if both fields load succeeded.
+ false - otherwise
+ */
+ virtual bool LoadNextFrame();
+
+
+ //! Set up the appropriate prediction parameters for a picture
+ virtual void SetPicTypeAndRefs( PictureParams& pparams );
+
+ protected:
+
+ virtual int CodedToDisplay(const int pnum);
+
+ virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio);
+ private:
+ //! Filter fields
+ /*!
+ Low pass filter the components in the fields used in Motion
+ Estimation so that ME works better. Using a 1/4 1/2 1/4 filter
+ */
+ void PreMotionEstmationFilter (PicArray& comp);
+
+ // Field1 bytes
+ int m_field1_bytes;
+ // Field2 bytes
+ int m_field2_bytes;
+ };
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.cpp
index f0b63410e..bf5725c6e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.cpp
@@ -45,199 +45,199 @@ using std::vector;
namespace dirac
{
-void AddNewVlist(CandidateList& vect_list, const MVector& mv,
- const int xr , const int yr , const int step)
+void AddNewVlist( CandidateList& vect_list, const MVector& mv,
+ const int xr , const int yr , const int step )
{
- //Creates a new motion vector list in a square region around mv
+ //Creates a new motion vector list in a square region around mv
vector<MVector> tmp_list;
vect_list.push_back(tmp_list);
- int list_num = vect_list.size() - 1;
+ int list_num=vect_list.size()-1;
- MVector tmp_mv(mv);
- AddVect(vect_list , tmp_mv , list_num);
+ MVector tmp_mv( mv );
+ AddVect(vect_list , tmp_mv , list_num );
- for(int i = 1 ; i <= xr ; ++i)
+ for ( int i=1 ; i<=xr ; ++i )
{
- tmp_mv.x = mv.x + i * step;
- AddVect(vect_list , tmp_mv , list_num);
+ tmp_mv.x = mv.x + i*step;
+ AddVect( vect_list , tmp_mv , list_num );
- tmp_mv.x = mv.x - i * step;
- AddVect(vect_list , tmp_mv , list_num);
+ tmp_mv.x = mv.x - i*step;
+ AddVect( vect_list , tmp_mv , list_num );
}
- for(int j = 1 ; j <= yr ; ++j)
+ for ( int j=1 ; j<=yr ; ++j)
{
- for(int i = -xr ; i <= xr ; ++i)
+ for ( int i=-xr ; i<=xr ; ++i)
{
- tmp_mv.x = mv.x + i * step;
- tmp_mv.y = mv.y + j * step;
- AddVect(vect_list, tmp_mv, list_num);
+ tmp_mv.x = mv.x + i*step;
+ tmp_mv.y = mv.y + j*step;
+ AddVect(vect_list,tmp_mv,list_num);
- tmp_mv.y = mv.y - j * step;
- AddVect(vect_list, tmp_mv, list_num);
+ tmp_mv.y = mv.y -j*step;
+ AddVect(vect_list,tmp_mv,list_num);
- }// i
+ }// i
}// j
// If we've not managed to add any element to the list
// remove the list so we don't ever have to check its size
- if(vect_list[list_num].size() == 0)
- vect_list.erase(vect_list.begin() + list_num);
+ if ( vect_list[list_num].size() == 0 )
+ vect_list.erase( vect_list.begin() + list_num );
}
-void AddNewVlist(CandidateList& vect_list , const MVector& mv , const int xr , const int yr)
+void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr)
{
- // Creates a new motion vector list in a square region around mv
-
+ // Creates a new motion vector list in a square region around mv
+
vector<MVector> tmp_list;
vect_list.push_back(tmp_list);
- int list_num = vect_list.size() - 1;
+ int list_num=vect_list.size()-1;
MVector tmp_mv(mv);
- AddVect(vect_list, tmp_mv, list_num);
+ AddVect(vect_list,tmp_mv,list_num);
- for(int i = 1 ; i <= xr ; ++i)
+ for ( int i=1 ; i<=xr ; ++i)
{
tmp_mv.x = mv.x + i;
- AddVect(vect_list , tmp_mv , list_num);
+ AddVect( vect_list , tmp_mv , list_num );
- tmp_mv.x = mv.x - i;
- AddVect(vect_list , tmp_mv , list_num);
+ tmp_mv.x = mv.x - i;
+ AddVect( vect_list , tmp_mv , list_num );
}
- for(int j = 1 ; j <= yr ; ++j)
+ for ( int j=1 ; j<=yr ; ++j)
{
- for(int i = -xr ; i <= xr ; ++i)
+ for ( int i=-xr ; i<=xr ; ++i)
{
tmp_mv.x = mv.x + i;
tmp_mv.y = mv.y + j;
- AddVect(vect_list , tmp_mv , list_num);
+ AddVect( vect_list , tmp_mv , list_num );
- tmp_mv.y = mv.y - j;
- AddVect(vect_list , tmp_mv , list_num);
- }
+ tmp_mv.y = mv.y-j;
+ AddVect( vect_list , tmp_mv , list_num );
+ }
}
// If we've not managed to add any element to the list
// remove the list so we don't ever have to check its size
- if(vect_list[list_num].size() == 0)
- vect_list.erase(vect_list.begin() + list_num);
+ if ( vect_list[list_num].size() == 0 )
+ vect_list.erase( vect_list.begin() + list_num );
}
-void AddNewVlistD(CandidateList& vect_list , const MVector& mv , const int xr , const int yr)
+void AddNewVlistD( CandidateList& vect_list , const MVector& mv , const int xr , const int yr )
{
- //As above, but using a diamond pattern
+ //As above, but using a diamond pattern
vector<MVector> tmp_list;
- vect_list.push_back(tmp_list);
+ vect_list.push_back( tmp_list );
- int list_num = vect_list.size() - 1;
+ int list_num=vect_list.size()-1;
int xlim;
- MVector tmp_mv(mv);
- AddVect(vect_list , tmp_mv , list_num);
+ MVector tmp_mv( mv );
+ AddVect( vect_list , tmp_mv , list_num );
- for(int i = 1 ; i <= xr ; ++i)
+ for ( int i=1 ; i<=xr ; ++i)
{
tmp_mv.x = mv.x + i;
- AddVect(vect_list , tmp_mv , list_num);
+ AddVect( vect_list , tmp_mv , list_num );
- tmp_mv.x = mv.x - i;
- AddVect(vect_list , tmp_mv , list_num);
+ tmp_mv.x = mv.x - i;
+ AddVect( vect_list , tmp_mv , list_num );
}
- for(int j = 1 ; j <= yr ; ++j)
+ for ( int j=1 ; j<=yr ; ++j)
{
- xlim = xr * (yr - std::abs(j)) / yr;
- for(int i = -xlim ; i <= xlim ; ++i)
+ xlim = xr * (yr-std::abs(j)) / yr;
+ for ( int i=-xlim ; i<=xlim ; ++i)
{
tmp_mv.x = mv.x + i;
tmp_mv.y = mv.y + j;
- AddVect(vect_list , tmp_mv , list_num);
+ AddVect( vect_list , tmp_mv , list_num );
tmp_mv.y = mv.y - j;
- AddVect(vect_list , tmp_mv , list_num);
- }
+ AddVect( vect_list , tmp_mv , list_num );
+ }
}
// If we've not managed to add any element to the list
// remove the list so we don't ever have to check its size
- if(vect_list[list_num].size() == 0)
- vect_list.erase(vect_list.begin() + list_num);
+ if ( vect_list[list_num].size() == 0 )
+ vect_list.erase( vect_list.begin() + list_num );
}
-void AddVect(CandidateList& vect_list, const MVector& mv, int list_num)
+void AddVect(CandidateList& vect_list,const MVector& mv,int list_num)
{
- bool is_in_list = false;
-
- size_t lnum = 0;
- size_t i;
+ bool is_in_list=false;
+
+ size_t lnum=0;
+ size_t i;
- while(!is_in_list && lnum < vect_list.size())
+ while( !is_in_list && lnum<vect_list.size() )
{
- i = 0;
- while(!is_in_list && i < vect_list[lnum].size())
- {
- if(vect_list[lnum][i].x == mv.x && vect_list[lnum][i].y == mv.y)
- is_in_list = true;
- ++i;
+ i=0;
+ while( !is_in_list && i<vect_list[lnum].size())
+ {
+ if ( vect_list[lnum][i].x == mv.x && vect_list[lnum][i].y == mv.y )
+ is_in_list=true;
+ ++i;
}
++lnum;
}
- if(!is_in_list)
+ if ( !is_in_list )
vect_list[list_num].push_back(mv);
-
+
}
-BlockMatcher::BlockMatcher(const PicArray& pic_data ,
- const PicArray& ref_data ,
- const OLBParams& bparams ,
- const int precision ,
- const MvArray& mv_array ,
- const TwoDArray< MvCostData >& cost_array):
- m_pic_data(pic_data),
+BlockMatcher::BlockMatcher( const PicArray& pic_data ,
+ const PicArray& ref_data ,
+ const OLBParams& bparams ,
+ const int precision ,
+ const MvArray& mv_array ,
+ const TwoDArray< MvCostData >& cost_array):
+ m_pic_data(pic_data),
m_ref_data(ref_data),
m_mv_array(mv_array),
m_cost_array(cost_array),
- m_peldiff(ref_data , pic_data), //NB: ORDER!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- m_subpeldiff(3),
- m_bparams(bparams),
- m_var_max((pic_data.LengthX() + pic_data.LengthY()) / 216),
- m_var_max_up((pic_data.LengthX() + pic_data.LengthY()) / 27),
- m_precision(precision)
+ m_peldiff( ref_data , pic_data ), //NB: ORDER!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ m_subpeldiff( 3 ),
+ m_bparams( bparams ),
+ m_var_max( (pic_data.LengthX()+pic_data.LengthY() )/216 ),
+ m_var_max_up( (pic_data.LengthX()+pic_data.LengthY() )/27 ),
+ m_precision( precision )
{
- m_subpeldiff[0] = new BlockDiffHalfPel(ref_data, pic_data);
- m_subpeldiff[1] = new BlockDiffQuarterPel(ref_data, pic_data);
- m_subpeldiff[2] = new BlockDiffEighthPel(ref_data, pic_data);
+ m_subpeldiff[0] = new BlockDiffHalfPel( ref_data, pic_data );
+ m_subpeldiff[1] = new BlockDiffQuarterPel( ref_data, pic_data );
+ m_subpeldiff[2] = new BlockDiffEighthPel( ref_data, pic_data );
}
BlockMatcher::~BlockMatcher()
{
- for(int i = 0; i < 3; ++i)
+ for (int i=0; i<3; ++i )
delete m_subpeldiff[i];
}
-ValueType BlockMatcher::GetVar(const MVector& predmv , const MVector& mv) const
+ValueType BlockMatcher::GetVar( const MVector& predmv , const MVector& mv ) const
{
MVector diff;
- diff.x = mv.x - predmv.x;
- diff.y = mv.y - predmv.y;
+ diff.x = mv.x-predmv.x;
+ diff.y = mv.y-predmv.y;
- return Norm1(diff);
+ return Norm1( diff );
}
-
-ValueType BlockMatcher::GetVarUp(const MVector& predmv , const MVector& mv) const
+
+ValueType BlockMatcher::GetVarUp( const MVector& predmv , const MVector& mv ) const
{
MVector diff;
- diff.x = mv.x - predmv.x;
- diff.y = mv.y - predmv.y;
+ diff.x = mv.x-predmv.x;
+ diff.y = mv.y-predmv.y;
- return std::min(Norm1(diff) , Norm1(mv));
-}
+ return std::min( Norm1( diff ) , Norm1( mv ) );
+}
void BlockMatcher::FindBestMatchPel(const int xpos , const int ypos ,
const CandidateList& cand_list,
@@ -245,23 +245,23 @@ void BlockMatcher::FindBestMatchPel(const int xpos , const int ypos ,
const int list_start)
{
BlockDiffParams dparams;
- dparams.SetBlockLimits(m_bparams , m_pic_data , xpos , ypos);
-
+ dparams.SetBlockLimits( m_bparams , m_pic_data , xpos , ypos);
+
//now test against the offsets in the MV list to get the lowest cost//
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
float best_cost = m_cost_array[ypos][xpos].total;
MVector best_mv = m_mv_array[ypos][xpos];
- for(size_t lnum = list_start ; lnum < cand_list.size() ; ++lnum)
+ for ( size_t lnum=list_start ; lnum<cand_list.size() ; ++lnum)
{
- for(size_t i = 0 ; i < cand_list[lnum].size() ; ++i)
+ for (size_t i=0 ; i<cand_list[lnum].size() ; ++i)
{
- m_peldiff.Diff(dparams ,
- cand_list[lnum][i] ,
- best_cost ,
- best_mv);
+ m_peldiff.Diff( dparams ,
+ cand_list[lnum][i] ,
+ best_cost ,
+ best_mv);
}// i
}// num
@@ -270,49 +270,49 @@ void BlockMatcher::FindBestMatchPel(const int xpos , const int ypos ,
m_mv_array[ypos][xpos] = best_mv;
m_cost_array[ypos][xpos].SAD = best_cost;
- m_cost_array[ypos][xpos].mvcost = GetVar(mv_prediction , best_mv);
- m_cost_array[ypos][xpos].SetTotal(0.0);
+ m_cost_array[ypos][xpos].mvcost = GetVar( mv_prediction , best_mv);
+ m_cost_array[ypos][xpos].SetTotal( 0.0 );
}
-void BlockMatcher::FindBestMatchSubp(const int xpos, const int ypos,
- const CandidateList& cand_list,
- const MVector& mv_prediction,
- const float lambda)
+void BlockMatcher::FindBestMatchSubp( const int xpos, const int ypos,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ const float lambda)
{
BlockDiffParams dparams;
- dparams.SetBlockLimits(m_bparams , m_pic_data , xpos , ypos);
+ dparams.SetBlockLimits( m_bparams , m_pic_data , xpos , ypos);
//now test against the offsets in the MV list to get the lowest cost//
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
// Numbers of the lists to do more searching in
- vector<int> list_nums;
+ vector<int> list_nums;
// Costs of the initial vectors in each list
- OneDArray<float> list_costs(cand_list.size());
+ OneDArray<float> list_costs( cand_list.size() );
// First test the first in each of the lists to choose which lists to pursue
- MvCostData best_costs(m_cost_array[ypos][xpos]);
+ MvCostData best_costs( m_cost_array[ypos][xpos] );
best_costs.total = 100000000.0f;
- MVector best_mv(m_mv_array[ypos][xpos]);
+ MVector best_mv( m_mv_array[ypos][xpos] );
MvCostData cand_costs;
MVector cand_mv;
- for(size_t list_num = 0 ; list_num < cand_list.size() ; ++list_num)
+ for (size_t list_num=0 ; list_num<cand_list.size() ; ++list_num )
{
- for(size_t i = 0 ; i < cand_list[list_num].size() ; ++i)
+ for (size_t i=0 ; i<cand_list[list_num].size() ; ++i )
{
cand_mv = cand_list[list_num][i];
- cand_costs.mvcost = GetVarUp(mv_prediction , cand_mv);
-
- m_subpeldiff[m_precision-1]->Diff(dparams,
- cand_mv ,
- cand_costs.mvcost,
- lambda,
- best_costs ,
- best_mv);
+ cand_costs.mvcost = GetVarUp( mv_prediction , cand_mv );
+
+ m_subpeldiff[m_precision-1]->Diff( dparams,
+ cand_mv ,
+ cand_costs.mvcost,
+ lambda,
+ best_costs ,
+ best_mv);
}//
}// list_num
@@ -320,8 +320,8 @@ void BlockMatcher::FindBestMatchSubp(const int xpos, const int ypos,
// Write the results in the arrays //
/////////////////////////////////////
- m_mv_array[ypos][xpos] = best_mv;
- m_cost_array[ypos][xpos] = best_costs;
+ m_mv_array[ypos][xpos] = best_mv;
+ m_cost_array[ypos][xpos] = best_costs;
}
void BlockMatcher::RefineMatchSubp(const int xpos, const int ypos,
@@ -330,31 +330,31 @@ void BlockMatcher::RefineMatchSubp(const int xpos, const int ypos,
{
BlockDiffParams dparams;
- dparams.SetBlockLimits(m_bparams , m_pic_data , xpos , ypos);
+ dparams.SetBlockLimits( m_bparams , m_pic_data , xpos , ypos);
- m_cost_array[ypos][xpos].mvcost = GetVarUp(mv_prediction,
- m_mv_array[ypos][xpos] << m_precision);
- m_cost_array[ypos][xpos].SetTotal(lambda);
+ m_cost_array[ypos][xpos].mvcost = GetVarUp( mv_prediction,
+ m_mv_array[ypos][xpos]<<m_precision );
+ m_cost_array[ypos][xpos].SetTotal( lambda );
// Initialise to the best pixel value
- MvCostData best_costs(m_cost_array[ypos][xpos]);
- MVector pel_mv(m_mv_array[ypos][xpos]);
- MVector best_mv(pel_mv);
+ MvCostData best_costs( m_cost_array[ypos][xpos] );
+ MVector pel_mv( m_mv_array[ypos][xpos] );
+ MVector best_mv( pel_mv );
// If the integer value is good enough, bail out
- if(best_costs.SAD < 2 * dparams.Xl()*dparams.Yl())
+ if ( best_costs.SAD < 2*dparams.Xl()*dparams.Yl() )
{
- m_mv_array[ypos][xpos] = m_mv_array[ypos][xpos] << m_precision;
+ m_mv_array[ypos][xpos] = m_mv_array[ypos][xpos]<<m_precision;
return;
}
// Next, test the predictor. If that's good enough, bail out
MvCostData pred_costs;
pred_costs.mvcost = 0;
- pred_costs.SAD = m_subpeldiff[m_precision-1]->Diff(dparams, mv_prediction);
+ pred_costs.SAD = m_subpeldiff[m_precision-1]->Diff( dparams, mv_prediction);
pred_costs.total = pred_costs.SAD;
- if(pred_costs.SAD < 2 * dparams.Xl()*dparams.Yl())
+ if (pred_costs.SAD<2*dparams.Xl()*dparams.Yl() )
{
m_mv_array[ypos][xpos] = mv_prediction;
m_cost_array[ypos][xpos] = pred_costs;
@@ -366,9 +366,9 @@ void BlockMatcher::RefineMatchSubp(const int xpos, const int ypos,
MvCostData cand_costs;
MVector cand_mv, old_best_mv;
- for(int i = 1; i <= m_precision; ++i)
+ for (int i=1; i<=m_precision; ++i )
{
- best_mv = best_mv << 1;
+ best_mv = best_mv<<1;
MVector temp_best_mv = best_mv;
// Do a neighbourhood of best_mv
@@ -376,83 +376,83 @@ void BlockMatcher::RefineMatchSubp(const int xpos, const int ypos,
// Stage 1 - look at the 4 nearest points
cand_mv.x = best_mv.x - 1;
cand_mv.y = best_mv.y;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
cand_mv.x = best_mv.x + 1;
cand_mv.y = best_mv.y;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
cand_mv.x = best_mv.x;
cand_mv.y = best_mv.y - 1;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
cand_mv.x = best_mv.x;
cand_mv.y = best_mv.y + 1;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
-
- // Stage 2. If we've done better than the original value,
- // look at the other two neighbours
- if(temp_best_mv.x != best_mv.x)
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
+
+ // Stage 2. If we've done better than the original value,
+ // look at the other two neighbours
+ if ( temp_best_mv.x != best_mv.x )
{
MVector new_best_mv = temp_best_mv;
cand_mv.x = new_best_mv.x;
cand_mv.y = new_best_mv.y - 1;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
cand_mv.x = new_best_mv.x;
cand_mv.y = new_best_mv.y + 1;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
}
- else if(temp_best_mv.y != best_mv.y)
+ else if ( temp_best_mv.y != best_mv.y )
{
MVector new_best_mv = temp_best_mv;
cand_mv.x = new_best_mv.x - 1;
cand_mv.y = new_best_mv.y;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
cand_mv.x = new_best_mv.x + 1;
cand_mv.y = new_best_mv.y;
- m_subpeldiff[i-1]->Diff(dparams, cand_mv ,
- GetVarUp(mv_prediction,
- cand_mv << (m_precision - i)) ,
- lambda , best_costs ,
- temp_best_mv);
- }
+ m_subpeldiff[i-1]->Diff( dparams, cand_mv ,
+ GetVarUp( mv_prediction,
+ cand_mv<<(m_precision-i) ) ,
+ lambda , best_costs ,
+ temp_best_mv);
+ }
best_mv = temp_best_mv;
// Bail out if we can't do better than 10% worse than the predictor at
// each stage
- if(best_costs.total > 1.1 * pred_costs.total)
+ if ( best_costs.total>1.1*pred_costs.total )
{
m_mv_array[ypos][xpos] = mv_prediction;
m_cost_array[ypos][xpos] = pred_costs;
- return;
+ return;
}
}//i
@@ -461,8 +461,8 @@ void BlockMatcher::RefineMatchSubp(const int xpos, const int ypos,
// Write the results in the arrays //
/////////////////////////////////////
- m_mv_array[ypos][xpos] = best_mv;
- m_cost_array[ypos][xpos] = best_costs;
+ m_mv_array[ypos][xpos] = best_mv;
+ m_cost_array[ypos][xpos] = best_costs;
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.h
index 3063900e2..2bcb5e2b3 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/block_match.h
@@ -45,166 +45,163 @@
namespace dirac
{
-typedef std::vector< std::vector< MVector > > CandidateList;
-
-//! Add a new motion vector list of neighbours of a vector to the set of lists
-/*
- Add a new motion vector list to the set of lists consisting of the
- square neighbourhood [mv.x-xr,mv.x+xr] by
- [mv.y-yr,mv.y+yr]. Vectors that already occur in previous lists are
- not added.
-*/
-void AddNewVlist(CandidateList& vect_list , const MVector& mv , const int xr , const int yr);
-
-//! Add a new motion vector list to the set of lists for sub-pixel matching
-/*
- Add a new motion vector list to the set of lists consisting of the
- vectors of the form (mv.x+m*step,mv.y+n*step) where m lies between
- -xr and xr and n lies between -yr and yr. Vectors that already occur
- in previous lists are not added.
-*/
-void AddNewVlist(CandidateList& vect_list , const MVector& mv , const int xr , const int yr , const int step);
-
-//! Add a new motion vector list of diagnonal neighbours of a vector to the set of lists
-/*
- Add a new motion vector list to the set of lists consisting of the
- diagonal neighbourhood of height 2yr+1 pixels and width 2xr+1 centred
- on \param mv.
- Vectors that already occur in previous lists are not added.
-*/
-void AddNewVlistD(CandidateList& vect_list , const MVector& mv , const int xr, const int yr);
-
-//! Add a motion vector to the set of motion vector lists
-/*!
- Add a motion vector to the set of motion vector lists, making sure
- it's not a duplicate.
-*/
-void AddVect(CandidateList& vect_list , const MVector& mv , const int list_num);
-
-//! Get the (absolute) variation between two motion vectors
-/*!
- Return the variation between two motion vectors, computed as the sum
- of absolute differences of their components.
-*/
-ValueType GetVar(const MVector& mv1, const MVector& mv2);
-
-//! Get the (absolute) variation between a motion vector and a list of motion vectors
-/*!
- Return the variation between a motion vector and a list of motion
- vectos, computed as the sum of absolute differences between the
- components of the vector and the median vector produced by the list of
- vectors
-*/
-ValueType GetVar(const std::vector<MVector>& pred_list, const MVector& mv);
-
-
-//! Class to do block matching
-
-// Subsumes FindBestMatch and FindBestMatchSubpel
-class BlockMatcher
-{
-public:
- //! Constructor
- /*!
- Constructor
- \param ref_data the reference picture component
- \param pic_data the picture being matched
- \param bparams the (overlapped) block parameters to be used for the matching
- \param precision the number of bits of precision being used for estimation
- \param mv_array the array of vectors we're going to write into
- \param cost_array the array of costs we're going to write into
-
+ typedef std::vector< std::vector< MVector > > CandidateList;
+
+ //! Add a new motion vector list of neighbours of a vector to the set of lists
+ /*
+ Add a new motion vector list to the set of lists consisting of the
+ square neighbourhood [mv.x-xr,mv.x+xr] by
+ [mv.y-yr,mv.y+yr]. Vectors that already occur in previous lists are
+ not added.
*/
- BlockMatcher(const PicArray& ref_data ,
- const PicArray& pic_data ,
- const OLBParams& bparams ,
- const int precision ,
- const MvArray& mv_array ,
- const TwoDArray< MvCostData >& cost_array);
-
- ~BlockMatcher();
-
- //! Find the best matching vector from a list of candidates
- /*!
- Find the best matching vector from a list of candidates.
- \param xpos the horizontal location of the block being matched
- \param ypos the vertical location of the block being matched
- \param cand_list the list of candidate vectors
- \param mv_prediction Prediction used for each block used to control the variation in the motion vector field.
- \param list_start index into the candidate vectors list
+ void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr );
+
+ //! Add a new motion vector list to the set of lists for sub-pixel matching
+ /*
+ Add a new motion vector list to the set of lists consisting of the
+ vectors of the form (mv.x+m*step,mv.y+n*step) where m lies between
+ -xr and xr and n lies between -yr and yr. Vectors that already occur
+ in previous lists are not added.
+ */
+ void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr , const int step );
+
+ //! Add a new motion vector list of diagnonal neighbours of a vector to the set of lists
+ /*
+ Add a new motion vector list to the set of lists consisting of the
+ diagonal neighbourhood of height 2yr+1 pixels and width 2xr+1 centred
+ on \param mv.
+ Vectors that already occur in previous lists are not added.
*/
- void FindBestMatchPel(const int xpos , const int ypos ,
- const CandidateList& cand_list,
- const MVector& mv_prediction,
- const int list_start);
+ void AddNewVlistD( CandidateList& vect_list , const MVector& mv , const int xr, const int yr);
- //! Find the best matching vector from a list of candidates, to sub-pixel accuracy (TBC: merge with FindBestMatch)
+ //! Add a motion vector to the set of motion vector lists
/*!
- Find the best matching vector from a list of candidates.
- \param xpos the horizontal location of the block being matched
- \param ypos the vertical location of the block being matched
- \param cand_list the list of candidate vectors
- \param mv_prediction the prediction for the motion vector
- \param lambda the Lagrangian parameter
+ Add a motion vector to the set of motion vector lists, making sure
+ it's not a duplicate.
*/
- void FindBestMatchSubp(const int xpos, const int ypos,
- const CandidateList& cand_list,
- const MVector& mv_prediction,
- const float lambda);
+ void AddVect( CandidateList& vect_list , const MVector& mv , const int list_num);
- void RefineMatchSubp(const int xpos, const int ypos,
- const MVector& mv_prediction,
- const float lambda);
-
- //! Get a measure of the difference between a motion vector and a prediction
+ //! Get the (absolute) variation between two motion vectors
/*!
- Get a measure of the difference between a motion vector and a prediction
- \param predmv the predicting motion vector
- \param mv the motion vector
+ Return the variation between two motion vectors, computed as the sum
+ of absolute differences of their components.
*/
- ValueType GetVar(const MVector& predmv , const MVector& mv) const;
+ ValueType GetVar(const MVector& mv1,const MVector& mv2);
- //! Get a measure of the difference between a motion vector and a prediction, to 1/8pel accuracy
+ //! Get the (absolute) variation between a motion vector and a list of motion vectors
/*!
- Get a measure of the difference between a motion vector and a prediction, to 1/8pel accuracy
- \param predmv the predicting motion vector
- \param mv the motion vector
+ Return the variation between a motion vector and a list of motion
+ vectos, computed as the sum of absolute differences between the
+ components of the vector and the median vector produced by the list of
+ vectors
*/
- ValueType GetVarUp(const MVector& predmv , const MVector& mv) const;
+ ValueType GetVar(const std::vector<MVector>& pred_list,const MVector& mv);
- void SetPrecision(const int n)
- {
- m_precision = n;
- }
-private:
- // Local copies of the picture and reference
- const PicArray& m_pic_data;
- const PicArray& m_ref_data;
+ //! Class to do block matching
- // Local copy of the motion vector array being populated
- const MvArray& m_mv_array;
-
- // Local copy of the costs being determined through the matching
- const TwoDArray< MvCostData >& m_cost_array;
-
- // Block difference elements. Will choose between them depending
- // on whether we're at the edge of the picture
- PelBlockDiff m_peldiff;
-
- OneDArray<BlockDiffUp* > m_subpeldiff;
-
- // The block parameters we're using
- OLBParams m_bparams;
-
- // The maximum variations allowed in calculating motion vector costs
- const int m_var_max;
- const int m_var_max_up;
-
- // The motion vector precision
- int m_precision;
-
-};
+ // Subsumes FindBestMatch and FindBestMatchSubpel
+ class BlockMatcher
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor
+ \param ref_data the reference picture component
+ \param pic_data the picture being matched
+ \param bparams the (overlapped) block parameters to be used for the matching
+ \param precision the number of bits of precision being used for estimation
+ \param mv_array the array of vectors we're going to write into
+ \param cost_array the array of costs we're going to write into
+
+ */
+ BlockMatcher( const PicArray& ref_data ,
+ const PicArray& pic_data ,
+ const OLBParams& bparams ,
+ const int precision ,
+ const MvArray& mv_array ,
+ const TwoDArray< MvCostData >& cost_array);
+
+ ~BlockMatcher();
+
+ //! Find the best matching vector from a list of candidates
+ /*!
+ Find the best matching vector from a list of candidates.
+ \param xpos the horizontal location of the block being matched
+ \param ypos the vertical location of the block being matched
+ \param cand_list the list of candidate vectors
+ \param mv_prediction Prediction used for each block used to control the variation in the motion vector field.
+ \param list_start index into the candidate vectors list
+ */
+ void FindBestMatchPel( const int xpos , const int ypos ,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ const int list_start);
+
+ //! Find the best matching vector from a list of candidates, to sub-pixel accuracy (TBC: merge with FindBestMatch)
+ /*!
+ Find the best matching vector from a list of candidates.
+ \param xpos the horizontal location of the block being matched
+ \param ypos the vertical location of the block being matched
+ \param cand_list the list of candidate vectors
+ \param mv_prediction the prediction for the motion vector
+ \param lambda the Lagrangian parameter
+ */
+ void FindBestMatchSubp( const int xpos, const int ypos,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ const float lambda);
+
+ void RefineMatchSubp(const int xpos, const int ypos,
+ const MVector& mv_prediction,
+ const float lambda);
+
+ //! Get a measure of the difference between a motion vector and a prediction
+ /*!
+ Get a measure of the difference between a motion vector and a prediction
+ \param predmv the predicting motion vector
+ \param mv the motion vector
+ */
+ ValueType GetVar( const MVector& predmv , const MVector& mv ) const;
+
+ //! Get a measure of the difference between a motion vector and a prediction, to 1/8pel accuracy
+ /*!
+ Get a measure of the difference between a motion vector and a prediction, to 1/8pel accuracy
+ \param predmv the predicting motion vector
+ \param mv the motion vector
+ */
+ ValueType GetVarUp( const MVector& predmv , const MVector& mv ) const;
+
+ void SetPrecision( const int n ){ m_precision = n; }
+
+ private:
+ // Local copies of the picture and reference
+ const PicArray& m_pic_data;
+ const PicArray& m_ref_data;
+
+ // Local copy of the motion vector array being populated
+ const MvArray& m_mv_array;
+
+ // Local copy of the costs being determined through the matching
+ const TwoDArray< MvCostData >& m_cost_array;
+
+ // Block difference elements. Will choose between them depending
+ // on whether we're at the edge of the picture
+ PelBlockDiff m_peldiff;
+
+ OneDArray<BlockDiffUp* > m_subpeldiff;
+
+ // The block parameters we're using
+ OLBParams m_bparams;
+
+ // The maximum variations allowed in calculating motion vector costs
+ const int m_var_max;
+ const int m_var_max_up;
+
+ // The motion vector precision
+ int m_precision;
+
+ };
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.cpp
index 1d37203c0..75bd0739e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.cpp
@@ -20,7 +20,7 @@
* Portions created by the Initial Developer are Copyright (C) 2004.
* All Rights Reserved.
*
-* Contributor(s): Richard Felton (Original Author),
+* Contributor(s): Richard Felton (Original Author),
* Thomas Davies
*
* Alternatively, the contents of this file may be used under the terms of
@@ -51,89 +51,89 @@ DownConverter::DownConverter()
void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
{
//Down-convert by a factor of two.
- m_row_buffer = new ValueType[old_data.LengthX()];
+ m_row_buffer= new ValueType[old_data.LengthX()];
//Variables that will be used by the filter calculations
int sum;
int colpos;
// The area of the picture that will be downconverted
- const int xlen = 2 * new_data.LengthX();
- const int ylen = 2 * new_data.LengthY();
+ const int xlen = 2*new_data.LengthX();
+ const int ylen = 2*new_data.LengthY();
- //There are three y loops to cope with the leading edge, middle
+ //There are three y loops to cope with the leading edge, middle
//and trailing edge of each column.
- colpos = 0;
- for(int y = 0; y < Stage_I_Size * 2 ; y += 2 , colpos++)
+ colpos=0;
+ for( int y=0; y<Stage_I_Size*2 ; y+=2 , colpos++ )
{
// We are filtering each column but doing it bit by bit.
// This means our main loop is in the x direction and
// there is a much greater chance the data we need will
// be in the cache.
- for(int x = 0 ; x < xlen ; x++)
- {
+ for( int x=0 ; x<xlen ; x++ )
+ {
// In down conversion we interpolate every pixel
// so there is no copying.
// Excuse the complicated ternary stuff but it sorts out the edge
- sum = (old_data[y][x] + old_data[y+1][x]) * StageI_I;
- sum += (old_data[((y-1)>=0)?(y-1):0][x] + old_data[y+2][x]) * StageI_II;
- sum += (old_data[((y-2)>=0)?(y-2):0][x] + old_data[y+3][x]) * StageI_III;
- sum += (old_data[((y-3)>=0)?(y-3):0][x] + old_data[y+4][x]) * StageI_IV;
- sum += (old_data[((y-4)>=0)?(y-4):0][x] + old_data[y+5][x]) * StageI_V;
- sum += (old_data[((y-5)>=0)?(y-5):0][x] + old_data[y+6][x]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (old_data[y][x] + old_data[y+1][x])*StageI_I;
+ sum += (old_data[((y-1)>=0)?(y-1):0][x] + old_data[y+2][x])*StageI_II;
+ sum += (old_data[((y-2)>=0)?(y-2):0][x] + old_data[y+3][x])*StageI_III;
+ sum += (old_data[((y-3)>=0)?(y-3):0][x] + old_data[y+4][x])*StageI_IV;
+ sum += (old_data[((y-4)>=0)?(y-4):0][x] + old_data[y+5][x])*StageI_V;
+ sum += (old_data[((y-5)>=0)?(y-5):0][x] + old_data[y+6][x])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
m_row_buffer[x] = sum >> StageI_Shift;
}// x
//Speaking of which - the row loop.
- RowLoop(colpos, new_data);
- }// y
+ RowLoop(colpos,new_data);
+ }// y
// This loop is like the last one but it deals with the center
// section of the image and so the ternary operations are dropped
// from the filter section.
- for(int y = Stage_I_Size * 2 ; y < ylen - Stage_I_Size * 2 ; y += 2 , colpos++)
+ for( int y=Stage_I_Size*2 ; y<ylen-Stage_I_Size*2 ; y+=2 , colpos++ )
{
- for(int x = 0 ; x < xlen ; x++)
+ for( int x=0 ; x<xlen ; x++ )
{
- sum = (old_data[y][x] + old_data[y+1][x]) * StageI_I;
- sum += (old_data[y-1][x] + old_data[y+2][x]) * StageI_II;
- sum += (old_data[y-2][x] + old_data[y+3][x]) * StageI_III;
- sum += (old_data[y-3][x] + old_data[y+4][x]) * StageI_IV;
- sum += (old_data[y-4][x] + old_data[y+5][x]) * StageI_V;
- sum += (old_data[y-5][x] + old_data[y+6][x]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (old_data[y][x] + old_data[y+1][x])*StageI_I;
+ sum += (old_data[y-1][x] + old_data[y+2][x])*StageI_II;
+ sum += (old_data[y-2][x] + old_data[y+3][x])*StageI_III;
+ sum += (old_data[y-3][x] + old_data[y+4][x])*StageI_IV;
+ sum += (old_data[y-4][x] + old_data[y+5][x])*StageI_V;
+ sum += (old_data[y-5][x] + old_data[y+6][x])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
m_row_buffer[x] = sum >> StageI_Shift;
}// x
- RowLoop(colpos , new_data);
+ RowLoop( colpos , new_data );
}// y
// Another similar loop! - this time we are dealing with
// the trailing edge so the ternary stuff is back in the
// filter calcs but in the second parameter.
- for(int y = ylen - (Stage_I_Size * 2) ; y < ylen - 1 ; y += 2 , colpos++)
+ for( int y=ylen-(Stage_I_Size*2) ; y<ylen-1 ; y+=2 , colpos++ )
{
- for(int x = 0; x < xlen ; x++)
+ for( int x=0; x<xlen ; x++ )
{
- sum = (old_data[y][x] + old_data[((y+1)<ylen)?(y+1):(ylen-1)][x]) * StageI_I;
- sum += (old_data[y-1][x] + old_data[((y+2)<ylen)?(y+2):(ylen-1)][x]) * StageI_II;
- sum += (old_data[y-2][x] + old_data[((y+3)<ylen)?(y+3):(ylen-1)][x]) * StageI_III;
- sum += (old_data[y-3][x] + old_data[((y+4)<ylen)?(y+4):(ylen-1)][x]) * StageI_IV;
- sum += (old_data[y-4][x] + old_data[((y+5)<ylen)?(y+5):(ylen-1)][x]) * StageI_V;
- sum += (old_data[y-5][x] + old_data[((y+6)<ylen)?(y+6):(ylen-1)][x]) * StageI_VI;
+ sum = (old_data[y][x] + old_data[((y+1)<ylen)?(y+1):(ylen-1)][x])*StageI_I;
+ sum += (old_data[y-1][x] + old_data[((y+2)<ylen)?(y+2):(ylen-1)][x])*StageI_II;
+ sum += (old_data[y-2][x] + old_data[((y+3)<ylen)?(y+3):(ylen-1)][x])*StageI_III;
+ sum += (old_data[y-3][x] + old_data[((y+4)<ylen)?(y+4):(ylen-1)][x])*StageI_IV;
+ sum += (old_data[y-4][x] + old_data[((y+5)<ylen)?(y+5):(ylen-1)][x])*StageI_V;
+ sum += (old_data[y-5][x] + old_data[((y+6)<ylen)?(y+6):(ylen-1)][x])*StageI_VI;
// Do rounding right
- sum += 1 << (StageI_Shift - 1);
+ sum += 1<<(StageI_Shift-1);
m_row_buffer[x] = sum >> StageI_Shift;
}// x
- RowLoop(colpos , new_data);
+ RowLoop( colpos , new_data );
}// y
@@ -146,56 +146,56 @@ void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
// The loop over the columns is the same every time so lends itself to isolation
// as an individual function.
-void DownConverter::RowLoop(const int colpos , PicArray& new_data)
+void DownConverter::RowLoop( const int colpos , PicArray& new_data)
{
- //Calculation variables
+ //Calculation variables
int sum;
- const int xlen = 2 * new_data.LengthX();
- int linepos = 0;
+ const int xlen = 2*new_data.LengthX();
+ int linepos=0;
- // Leading Column Edge
- // Similar loops to the x case in ByHalf_opto, for explanation look there.
- // Note the factor of two difference as we only want to fill in every other
- // line as the others have already been created by the line loops.
+ // Leading Column Edge
+ // Similar loops to the x case in ByHalf_opto, for explanation look there.
+ // Note the factor of two difference as we only want to fill in every other
+ // line as the others have already been created by the line loops.
- for(int x = 0; x < (2 * Stage_I_Size) ; x += 2 , linepos++)
+ for( int x=0; x<(2*Stage_I_Size) ; x+=2 , linepos++ )
{
- sum = (m_row_buffer[((x)>=0)?(x):0] + m_row_buffer[x+1]) * StageI_I;
- sum += (m_row_buffer[((x-1)>=0)?(x-1):0] + m_row_buffer[x+2]) * StageI_II;
- sum += (m_row_buffer[((x-2)>=0)?(x-2):0] + m_row_buffer[x+3]) * StageI_III;
- sum += (m_row_buffer[((x-3)>=0)?(x-3):0] + m_row_buffer[x+4]) * StageI_IV;
- sum += (m_row_buffer[((x-4)>=0)?(x-4):0] + m_row_buffer[x+5]) * StageI_V;
- sum += (m_row_buffer[((x-5)>=0)?(x-5):0] + m_row_buffer[x+6]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (m_row_buffer[((x)>=0)?(x):0] + m_row_buffer[x+1])*StageI_I;
+ sum += (m_row_buffer[((x-1)>=0)?(x-1):0] + m_row_buffer[x+2])*StageI_II;
+ sum += (m_row_buffer[((x-2)>=0)?(x-2):0] + m_row_buffer[x+3])*StageI_III;
+ sum += (m_row_buffer[((x-3)>=0)?(x-3):0] + m_row_buffer[x+4])*StageI_IV;
+ sum += (m_row_buffer[((x-4)>=0)?(x-4):0] + m_row_buffer[x+5])*StageI_V;
+ sum += (m_row_buffer[((x-5)>=0)?(x-5):0] + m_row_buffer[x+6])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
new_data[colpos][linepos] = sum >> StageI_Shift;
}
- //Middle of column
- for(int x = (2 * Stage_I_Size) ; x < xlen - (2 * Stage_I_Size) ; x += 2 , linepos++)
+ //Middle of column
+ for( int x=(2*Stage_I_Size) ; x<xlen-(2*Stage_I_Size) ; x+=2 , linepos++)
{
- sum = (m_row_buffer[x] + m_row_buffer[x+1]) * StageI_I;
- sum += (m_row_buffer[x-1] + m_row_buffer[x+2]) * StageI_II;
- sum += (m_row_buffer[x-2] + m_row_buffer[x+3]) * StageI_III;
- sum += (m_row_buffer[x-3] + m_row_buffer[x+4]) * StageI_IV;
- sum += (m_row_buffer[x-4] + m_row_buffer[x+5]) * StageI_V;
- sum += (m_row_buffer[x-5] + m_row_buffer[x+6]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (m_row_buffer[x] + m_row_buffer[x+1])*StageI_I;
+ sum += (m_row_buffer[x-1] + m_row_buffer[x+2])*StageI_II;
+ sum += (m_row_buffer[x-2] + m_row_buffer[x+3])*StageI_III;
+ sum += (m_row_buffer[x-3] + m_row_buffer[x+4])*StageI_IV;
+ sum += (m_row_buffer[x-4] + m_row_buffer[x+5])*StageI_V;
+ sum += (m_row_buffer[x-5] + m_row_buffer[x+6])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
new_data[colpos][linepos] = sum >> StageI_Shift;
}
- //Trailing column edge
- for(int x = xlen - (2 * Stage_I_Size) ; x < xlen - 1 ; x += 2 , linepos++)
+ //Trailing column edge
+ for( int x=xlen-(2*Stage_I_Size) ; x< xlen-1 ; x+=2 , linepos++ )
{
- sum = (m_row_buffer[x] + m_row_buffer[((x+1)<xlen)?(x+1):(xlen-1)]) * StageI_I;
- sum += (m_row_buffer[x-1] + m_row_buffer[((x+2)<xlen)?(x+2):(xlen-1)]) * StageI_II;
- sum += (m_row_buffer[x-2] + m_row_buffer[((x+3)<xlen)?(x+3):(xlen-1)]) * StageI_III;
- sum += (m_row_buffer[x-3] + m_row_buffer[((x+4)<xlen)?(x+4):(xlen-1)]) * StageI_IV;
- sum += (m_row_buffer[x-4] + m_row_buffer[((x+5)<xlen)?(x+5):(xlen-1)]) * StageI_V;
- sum += (m_row_buffer[x-5] + m_row_buffer[((x+6)<xlen)?(x+6):(xlen-1)]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (m_row_buffer[x] + m_row_buffer[((x+1)<xlen)?(x+1):(xlen-1)])*StageI_I;
+ sum += (m_row_buffer[x-1] + m_row_buffer[((x+2)<xlen)?(x+2):(xlen-1)])*StageI_II;
+ sum += (m_row_buffer[x-2] + m_row_buffer[((x+3)<xlen)?(x+3):(xlen-1)])*StageI_III;
+ sum += (m_row_buffer[x-3] + m_row_buffer[((x+4)<xlen)?(x+4):(xlen-1)])*StageI_IV;
+ sum += (m_row_buffer[x-4] + m_row_buffer[((x+5)<xlen)?(x+5):(xlen-1)])*StageI_V;
+ sum += (m_row_buffer[x-5] + m_row_buffer[((x+6)<xlen)?(x+6):(xlen-1)])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
new_data[colpos][linepos] = sum >> StageI_Shift;
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.h
index eeb40c21c..bb2bdcf1e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert.h
@@ -43,52 +43,51 @@
namespace dirac
{
-//! A class for fast downconversion of picture data
-/*!
- A class for fast down-conversion of picture data. The picture data is
- downconverted by a factor of two in each dimension, using fast
- filtering techniques. The filter is a half-band filter designed to
- trade off frequency response, ringiness, and aliasing
- */
-class DownConverter
-{
+ //! A class for fast downconversion of picture data
+ /*!
+ A class for fast down-conversion of picture data. The picture data is
+ downconverted by a factor of two in each dimension, using fast
+ filtering techniques. The filter is a half-band filter designed to
+ trade off frequency response, ringiness, and aliasing
+ */
+ class DownConverter{
-public:
+ public:
- //! Constructor
- DownConverter();
- //! Destructor
- ~DownConverter() {};
+ //! Constructor
+ DownConverter();
+ //! Destructor
+ ~DownConverter(){};
- //! A function to do the actual down-conversion
- /*!
- A function to do the actual downconversion.
- \param old_data the picture data to be downconverted
- \param new_data the resulting down-converted data. The array must be of the correct size.
- */
- void DoDownConvert(const PicArray& old_data, PicArray& new_data);
+ //! A function to do the actual down-conversion
+ /*!
+ A function to do the actual downconversion.
+ \param old_data the picture data to be downconverted
+ \param new_data the resulting down-converted data. The array must be of the correct size.
+ */
+ void DoDownConvert(const PicArray& old_data, PicArray& new_data);
-private:
- //Copy constructor
- DownConverter(const DownConverter& cpy);//private, body-less: class should not be copied
- //Assignment=
- DownConverter& operator=(const DownConverter& rhs);//private, body-less: class should not be assigned
+ private:
+ //Copy constructor
+ DownConverter(const DownConverter& cpy);//private, body-less: class should not be copied
+ //Assignment=
+ DownConverter& operator=(const DownConverter& rhs);//private, body-less: class should not be assigned
- //Applies the filter to a single column
- void RowLoop(const int colpos , PicArray& new_data);
+ //Applies the filter to a single column
+ void RowLoop(const int colpos , PicArray& new_data );
- ValueType* m_row_buffer;
+ ValueType* m_row_buffer;
- //Define filter parameters
- static const int Stage_I_Size = 6;
- static const int StageI_I = 86;
- static const int StageI_II = 46;
- static const int StageI_III = 4;
- static const int StageI_IV = -8;
- static const int StageI_V = -4;
- static const int StageI_VI = 4;
- static const int StageI_Shift = 8;
-};
+ //Define filter parameters
+ static const int Stage_I_Size = 6;
+ static const int StageI_I = 86;
+ static const int StageI_II = 46;
+ static const int StageI_III = 4;
+ static const int StageI_IV = -8;
+ static const int StageI_V = -4;
+ static const int StageI_VI = 4;
+ static const int StageI_Shift = 8;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert_mmx.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert_mmx.cpp
index f3d98bb12..efdc261e5 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert_mmx.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/downconvert_mmx.cpp
@@ -41,7 +41,7 @@ using namespace dirac;
#if defined (HAVE_MMX)
#include <mmintrin.h>
-typedef union
+typedef union
{
__m64 m;
int i[2];
@@ -56,64 +56,64 @@ typedef union
m2 = _mm_madd_pi16 (m2, tap); \
*sum1 = _mm_add_pi32 (*sum1, m1); \
*sum2 = _mm_add_pi32 (*sum2, m2); \
-
+
//General function - does some admin and calls the correct function
void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
{
//Down-convert by a factor of two.
- m_row_buffer = new ValueType[old_data.LengthX()];
+ m_row_buffer= new ValueType[old_data.LengthX()];
//Variables that will be used by the filter calculations
int sum;
int colpos;
// The area of the picture that will be downconverted
- const int xlen = 2 * new_data.LengthX();
- const int ylen = 2 * new_data.LengthY();
+ const int xlen = 2*new_data.LengthX();
+ const int ylen = 2*new_data.LengthY();
- //There are three y loops to cope with the leading edge, middle
+ //There are three y loops to cope with the leading edge, middle
//and trailing edge of each column.
- colpos = 0;
+ colpos=0;
static __m64 zero = _mm_set_pi16(0, 0, 0, 0);
- static __m64 tap0 = _mm_set_pi16(0, StageI_I, 0, StageI_I);
- static __m64 tap1 = _mm_set_pi16(0, StageI_II, 0, StageI_II);
- static __m64 tap2 = _mm_set_pi16(0, StageI_III, 0, StageI_III);
- static __m64 tap3 = _mm_set_pi16(0, StageI_IV, 0, StageI_IV);
- static __m64 tap4 = _mm_set_pi16(0, StageI_V, 0, StageI_V);
- static __m64 tap5 = _mm_set_pi16(0, StageI_VI, 0, StageI_VI);
- static __m64 round = _mm_set_pi32(1 << (StageI_Shift - 1), 1 << (StageI_Shift - 1));
+ static __m64 tap0 = _mm_set_pi16 (0, StageI_I, 0, StageI_I);
+ static __m64 tap1 = _mm_set_pi16 (0, StageI_II, 0, StageI_II);
+ static __m64 tap2 = _mm_set_pi16 (0, StageI_III, 0, StageI_III);
+ static __m64 tap3 = _mm_set_pi16 (0, StageI_IV, 0, StageI_IV);
+ static __m64 tap4 = _mm_set_pi16 (0, StageI_V, 0, StageI_V);
+ static __m64 tap5 = _mm_set_pi16 (0, StageI_VI, 0, StageI_VI);
+ static __m64 round = _mm_set_pi32 ( 1<<(StageI_Shift-1), 1<<(StageI_Shift-1));
u_sum sum1, sum2;
__m64 tmp, m1, m2;
- int stopX = (xlen >> 2) << 2;
- for(int y = 0; y < Stage_I_Size * 2 ; y += 2 , colpos++)
+ int stopX = (xlen >> 2)<<2;
+ for( int y=0; y<Stage_I_Size*2 ; y+=2 , colpos++ )
{
// We are filtering each column but doing it bit by bit.
// This means our main loop is in the x direction and
// there is a much greater chance the data we need will
// be in the cache.
- for(int x = 0 ; x < stopX ; x += 4)
- {
+ for( int x=0 ; x<stopX ; x+=4 )
+ {
// In down conversion we interpolate every pixel
// so there is no copying.
// Excuse the complicated ternary stuff but it sorts out the edge
- sum1.m = _mm_set_pi32(0, 0);
- sum2.m = _mm_set_pi32(0, 0);
+ sum1.m = _mm_set_pi32 (0, 0);
+ sum2.m = _mm_set_pi32 (0, 0);
- mmx_add(&old_data[y][x], &old_data[y+1][x], tap0, zero, &sum1.m, &sum2.m);
+ mmx_add (&old_data[y][x], &old_data[y+1][x], tap0, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[((y-1)>=0)?(y-1):0][x] , &old_data[y+2][x], tap1, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[((y-2)>=0)?(y-2):0][x] , &old_data[y+3][x], tap2, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[((y-3)>=0)?(y-3):0][x] , &old_data[y+4][x], tap3, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[((y-4)>=0)?(y-4):0][x] , &old_data[y+5][x], tap4, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[((y-5)>=0)?(y-5):0][x] , &old_data[y+6][x], tap5, zero, &sum1.m, &sum2.m);
- sum1.m = _mm_add_pi32(sum1.m, round);
- sum2.m = _mm_add_pi32(sum2.m, round);
- sum1.m = _mm_srai_pi32(sum1.m, StageI_Shift);
- sum2.m = _mm_srai_pi32(sum2.m, StageI_Shift);
+ sum1.m = _mm_add_pi32 (sum1.m, round);
+ sum2.m = _mm_add_pi32 (sum2.m, round);
+ sum1.m = _mm_srai_pi32 (sum1.m, StageI_Shift);
+ sum2.m = _mm_srai_pi32 (sum2.m, StageI_Shift);
m_row_buffer[x] = sum1.i[0];
m_row_buffer[x+1] = sum1.i[1];
m_row_buffer[x+2] = sum2.i[0];
@@ -121,49 +121,49 @@ void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
}// x
_mm_empty();
- for(int x = stopX ; x < xlen ; x++)
- {
+ for( int x=stopX ; x<xlen ; x++ )
+ {
// In down conversion we interpolate every pixel
// so there is no copying.
// Excuse the complicated ternary stuff but it sorts out the edge
- sum = (old_data[y][x] + old_data[y+1][x]) * StageI_I;
- sum += (old_data[((y-1)>=0)?(y-1):0][x] + old_data[y+2][x]) * StageI_II;
- sum += (old_data[((y-2)>=0)?(y-2):0][x] + old_data[y+3][x]) * StageI_III;
- sum += (old_data[((y-3)>=0)?(y-3):0][x] + old_data[y+4][x]) * StageI_IV;
- sum += (old_data[((y-4)>=0)?(y-4):0][x] + old_data[y+5][x]) * StageI_V;
- sum += (old_data[((y-5)>=0)?(y-5):0][x] + old_data[y+6][x]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (old_data[y][x] + old_data[y+1][x])*StageI_I;
+ sum += (old_data[((y-1)>=0)?(y-1):0][x] + old_data[y+2][x])*StageI_II;
+ sum += (old_data[((y-2)>=0)?(y-2):0][x] + old_data[y+3][x])*StageI_III;
+ sum += (old_data[((y-3)>=0)?(y-3):0][x] + old_data[y+4][x])*StageI_IV;
+ sum += (old_data[((y-4)>=0)?(y-4):0][x] + old_data[y+5][x])*StageI_V;
+ sum += (old_data[((y-5)>=0)?(y-5):0][x] + old_data[y+6][x])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
m_row_buffer[x] = sum >> StageI_Shift;
}// x
//Speaking of which - the row loop.
- RowLoop(colpos, new_data);
- }// y
+ RowLoop(colpos,new_data);
+ }// y
// This loop is like the last one but it deals with the center
// section of the image and so the ternary operations are dropped
// from the filter section.
- for(int y = Stage_I_Size * 2 ; y < ylen - Stage_I_Size * 2 ; y += 2 , colpos++)
+ for( int y=Stage_I_Size*2 ; y<ylen-Stage_I_Size*2 ; y+=2 , colpos++ )
{
- for(int x = 0 ; x < stopX ; x += 4)
- {
+ for( int x=0 ; x<stopX ; x+=4 )
+ {
// In down conversion we interpolate every pixel
// so there is no copying.
// Excuse the complicated ternary stuff but it sorts out the edge
- sum1.m = _mm_set_pi32(0, 0);
- sum2.m = _mm_set_pi32(0, 0);
+ sum1.m = _mm_set_pi32 (0, 0);
+ sum2.m = _mm_set_pi32 (0, 0);
- mmx_add(&old_data[y][x], &old_data[y+1][x], tap0, zero, &sum1.m, &sum2.m);
+ mmx_add (&old_data[y][x], &old_data[y+1][x], tap0, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-1][x] , &old_data[y+2][x], tap1, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-2][x] , &old_data[y+3][x], tap2, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-3][x] , &old_data[y+4][x], tap3, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-4][x] , &old_data[y+5][x], tap4, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-5][x] , &old_data[y+6][x], tap5, zero, &sum1.m, &sum2.m);
- sum1.m = _mm_add_pi32(sum1.m, round);
- sum2.m = _mm_add_pi32(sum2.m, round);
- sum1.m = _mm_srai_pi32(sum1.m, StageI_Shift);
- sum2.m = _mm_srai_pi32(sum2.m, StageI_Shift);
+ sum1.m = _mm_add_pi32 (sum1.m, round);
+ sum2.m = _mm_add_pi32 (sum2.m, round);
+ sum1.m = _mm_srai_pi32 (sum1.m, StageI_Shift);
+ sum2.m = _mm_srai_pi32 (sum2.m, StageI_Shift);
m_row_buffer[x] = sum1.i[0];
m_row_buffer[x+1] = sum1.i[1];
m_row_buffer[x+2] = sum2.i[0];
@@ -171,46 +171,46 @@ void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
}// x
_mm_empty();
- for(int x = stopX ; x < xlen ; x++)
+ for( int x=stopX ; x<xlen ; x++ )
{
- sum = (old_data[y][x] + old_data[y+1][x]) * StageI_I;
- sum += (old_data[y-1][x] + old_data[y+2][x]) * StageI_II;
- sum += (old_data[y-2][x] + old_data[y+3][x]) * StageI_III;
- sum += (old_data[y-3][x] + old_data[y+4][x]) * StageI_IV;
- sum += (old_data[y-4][x] + old_data[y+5][x]) * StageI_V;
- sum += (old_data[y-5][x] + old_data[y+6][x]) * StageI_VI;
- sum += 1 << (StageI_Shift - 1); //do rounding right
+ sum = (old_data[y][x] + old_data[y+1][x])*StageI_I;
+ sum += (old_data[y-1][x] + old_data[y+2][x])*StageI_II;
+ sum += (old_data[y-2][x] + old_data[y+3][x])*StageI_III;
+ sum += (old_data[y-3][x] + old_data[y+4][x])*StageI_IV;
+ sum += (old_data[y-4][x] + old_data[y+5][x])*StageI_V;
+ sum += (old_data[y-5][x] + old_data[y+6][x])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
m_row_buffer[x] = sum >> StageI_Shift;
}// x
- RowLoop(colpos , new_data);
+ RowLoop( colpos , new_data );
}// y
// Another similar loop! - this time we are dealing with
// the trailing edge so the ternary stuff is back in the
// filter calcs but in the second parameter.
- for(int y = ylen - (Stage_I_Size * 2) ; y < ylen - 1 ; y += 2 , colpos++)
+ for( int y=ylen-(Stage_I_Size*2) ; y<ylen-1 ; y+=2 , colpos++ )
{
- for(int x = 0 ; x < stopX ; x += 4)
- {
+ for( int x=0 ; x<stopX ; x+=4 )
+ {
// In down conversion we interpolate every pixel
// so there is no copying.
// Excuse the complicated ternary stuff but it sorts out the edge
- sum1.m = _mm_set_pi32(0, 0);
- sum2.m = _mm_set_pi32(0, 0);
+ sum1.m = _mm_set_pi32 (0, 0);
+ sum2.m = _mm_set_pi32 (0, 0);
- mmx_add(&old_data[y][x], &old_data[((y+1)<ylen)?(y+1):(ylen-1)][x], tap0, zero, &sum1.m, &sum2.m);
+ mmx_add (&old_data[y][x], &old_data[((y+1)<ylen)?(y+1):(ylen-1)][x], tap0, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-1][x] , &old_data[((y+2)<ylen)?(y+2):(ylen-1)][x], tap1, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-2][x] , &old_data[((y+3)<ylen)?(y+3):(ylen-1)][x], tap2, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-3][x] , &old_data[((y+4)<ylen)?(y+4):(ylen-1)][x], tap3, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-4][x] , &old_data[((y+5)<ylen)?(y+5):(ylen-1)][x], tap4, zero, &sum1.m, &sum2.m);
mmx_add(&old_data[y-5][x] , &old_data[((y+6)<ylen)?(y+6):(ylen-1)][x], tap5, zero, &sum1.m, &sum2.m);
- sum1.m = _mm_add_pi32(sum1.m, round);
- sum2.m = _mm_add_pi32(sum2.m, round);
- sum1.m = _mm_srai_pi32(sum1.m, StageI_Shift);
- sum2.m = _mm_srai_pi32(sum2.m, StageI_Shift);
+ sum1.m = _mm_add_pi32 (sum1.m, round);
+ sum2.m = _mm_add_pi32 (sum2.m, round);
+ sum1.m = _mm_srai_pi32 (sum1.m, StageI_Shift);
+ sum2.m = _mm_srai_pi32 (sum2.m, StageI_Shift);
m_row_buffer[x] = sum1.i[0];
m_row_buffer[x+1] = sum1.i[1];
@@ -219,23 +219,23 @@ void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
}// x
_mm_empty();
- for(int x = stopX; x < xlen ; x++)
+ for( int x=stopX; x<xlen ; x++ )
{
- sum = (old_data[y][x] + old_data[((y+1)<ylen)?(y+1):(ylen-1)][x]) * StageI_I;
- sum += (old_data[y-1][x] + old_data[((y+2)<ylen)?(y+2):(ylen-1)][x]) * StageI_II;
- sum += (old_data[y-2][x] + old_data[((y+3)<ylen)?(y+3):(ylen-1)][x]) * StageI_III;
- sum += (old_data[y-3][x] + old_data[((y+4)<ylen)?(y+4):(ylen-1)][x]) * StageI_IV;
- sum += (old_data[y-4][x] + old_data[((y+5)<ylen)?(y+5):(ylen-1)][x]) * StageI_V;
- sum += (old_data[y-5][x] + old_data[((y+6)<ylen)?(y+6):(ylen-1)][x]) * StageI_VI;
+ sum = (old_data[y][x] + old_data[((y+1)<ylen)?(y+1):(ylen-1)][x])*StageI_I;
+ sum += (old_data[y-1][x] + old_data[((y+2)<ylen)?(y+2):(ylen-1)][x])*StageI_II;
+ sum += (old_data[y-2][x] + old_data[((y+3)<ylen)?(y+3):(ylen-1)][x])*StageI_III;
+ sum += (old_data[y-3][x] + old_data[((y+4)<ylen)?(y+4):(ylen-1)][x])*StageI_IV;
+ sum += (old_data[y-4][x] + old_data[((y+5)<ylen)?(y+5):(ylen-1)][x])*StageI_V;
+ sum += (old_data[y-5][x] + old_data[((y+6)<ylen)?(y+6):(ylen-1)][x])*StageI_VI;
// Do rounding right
- sum += 1 << (StageI_Shift - 1);
+ sum += 1<<(StageI_Shift-1);
m_row_buffer[x] = sum >> StageI_Shift;
}// x
- RowLoop(colpos , new_data);
+ RowLoop( colpos , new_data );
}// y
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.cpp
index c411c46d1..a23e705de 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.cpp
@@ -44,8 +44,8 @@ using namespace dirac;
using std::vector;
-ModeDecider::ModeDecider(const EncoderParams& encp):
- m_encparams(encp),
+ModeDecider::ModeDecider( const EncoderParams& encp):
+ m_encparams( encp ),
m_level_factor(3),
m_mode_factor(3),
m_me_data_set(3)
@@ -56,17 +56,17 @@ ModeDecider::ModeDecider(const EncoderParams& encp):
ModeDecider::~ModeDecider()
{
- if(m_psort.IsInter())
+ if (m_psort.IsInter())
{
delete m_me_data_set[0];
delete m_me_data_set[1];
}
}
-void ModeDecider::DoModeDecn(EncQueue& my_buffer, int pic_num)
+void ModeDecider::DoModeDecn( EncQueue& my_buffer, int pic_num )
{
-
- m_predparams = &(my_buffer.GetPicture(pic_num).GetMEData().GetPicPredParams());
+
+ m_predparams = &(my_buffer.GetPicture(pic_num).GetMEData().GetPicPredParams() );
// The following factors normalise costs for sub-SBs and SBs to those of
// blocks, so that the overlap is take into account (e.g. a sub-SB has
@@ -76,28 +76,28 @@ void ModeDecider::DoModeDecn(EncQueue& my_buffer, int pic_num)
// all SAD costs are normalised to the area corresponding to non-overlapping
// 16 blocks of size XBLEN*YBLEN.
- m_level_factor[0] = float(16 * m_predparams->LumaBParams(2).Xblen() * m_predparams->LumaBParams(2).Yblen()) /
- float(m_predparams->LumaBParams(0).Xblen() * m_predparams->LumaBParams(0).Yblen());
+ m_level_factor[0] = float( 16 * m_predparams->LumaBParams(2).Xblen() * m_predparams->LumaBParams(2).Yblen() )/
+ float( m_predparams->LumaBParams(0).Xblen() * m_predparams->LumaBParams(0).Yblen() );
- m_level_factor[1] = float(4 * m_predparams->LumaBParams(2).Xblen() * m_predparams->LumaBParams(2).Yblen()) /
- float(m_predparams->LumaBParams(1).Xblen() * m_predparams->LumaBParams(1).Yblen());
+ m_level_factor[1] = float( 4 * m_predparams->LumaBParams(2).Xblen() * m_predparams->LumaBParams(2).Yblen() )/
+ float( m_predparams->LumaBParams(1).Xblen() * m_predparams->LumaBParams(1).Yblen() );
m_level_factor[2] = 1.0f;
- for(int i = 0 ; i <= 2 ; ++i)
- m_mode_factor[i] = 80.0 * std::pow(0.8 , 2 - i);
+ for (int i=0 ; i<=2 ; ++i)
+ m_mode_factor[i] = 80.0*std::pow(0.8 , 2-i);
- // We've got 'raw' block motion vectors for up to two reference pictures. Now we want
- // to make a decision as to mode. In this initial implementation, this is bottom-up
+ // We've got 'raw' block motion vectors for up to two reference pictures. Now we want
+ // to make a decision as to mode. In this initial implementation, this is bottom-up
// i.e. find mvs for SBs and sub-SBs and see whether it's worthwhile merging.
- int ref1, ref2;
+ int ref1,ref2;
// Initialise //
////////////////
m_psort = my_buffer.GetPicture(pic_num).GetPparams().PicSort();
- if(m_psort.IsInter())
+ if (m_psort.IsInter())
{
// Extract the references
const vector<int>& refs = my_buffer.GetPicture(pic_num).GetPparams().Refs();
@@ -105,46 +105,46 @@ void ModeDecider::DoModeDecn(EncQueue& my_buffer, int pic_num)
ref1 = refs[0];
// The picture we're doing estimation from
- m_pic_data = &(my_buffer.GetPicture(pic_num).DataForME(m_encparams.CombinedME()));
+ m_pic_data = &(my_buffer.GetPicture( pic_num ).DataForME(m_encparams.CombinedME()) );
// Set up the hierarchy of motion vector data objects
- PicturePredParams predparams0 = *m_predparams;
- predparams0.SetXNumBlocks(m_predparams->XNumBlocks() / 4);
- predparams0.SetYNumBlocks(m_predparams->YNumBlocks() / 4);
+ PicturePredParams predparams0 = *m_predparams;
+ predparams0.SetXNumBlocks( m_predparams->XNumBlocks()/4 );
+ predparams0.SetYNumBlocks( m_predparams->YNumBlocks()/4 );
- PicturePredParams predparams1 = *m_predparams;
- predparams1.SetXNumBlocks(m_predparams->XNumBlocks() / 2);
- predparams1.SetYNumBlocks(m_predparams->YNumBlocks() / 2);
+ PicturePredParams predparams1 = *m_predparams;
+ predparams1.SetXNumBlocks( m_predparams->XNumBlocks()/2 );
+ predparams1.SetYNumBlocks( m_predparams->YNumBlocks()/2 );
- m_me_data_set[0] = new MEData(predparams0, num_refs);
- m_me_data_set[1] = new MEData(predparams1, num_refs);
+ m_me_data_set[0] = new MEData( predparams0, num_refs );
+ m_me_data_set[1] = new MEData( predparams1, num_refs );
m_me_data_set[2] = &my_buffer.GetPicture(pic_num).GetMEData();
// Set up the lambdas to use per block
- m_me_data_set[0]->SetLambdaMap(0 , m_me_data_set[2]->LambdaMap() , 1.0 / m_level_factor[0]);
- m_me_data_set[1]->SetLambdaMap(1 , m_me_data_set[2]->LambdaMap() , 1.0 / m_level_factor[1]);
+ m_me_data_set[0]->SetLambdaMap( 0 , m_me_data_set[2]->LambdaMap() , 1.0/m_level_factor[0] );
+ m_me_data_set[1]->SetLambdaMap( 1 , m_me_data_set[2]->LambdaMap() , 1.0/m_level_factor[1] );
// Set up the reference pictures
- m_ref1_updata = &(my_buffer.GetPicture(ref1).UpDataForME(m_encparams.CombinedME()));
+ m_ref1_updata = &(my_buffer.GetPicture( ref1 ).UpDataForME(m_encparams.CombinedME()) );
- if(num_refs > 1)
+ if (num_refs>1)
{
ref2 = refs[1];
- m_ref2_updata = &(my_buffer.GetPicture(ref2).UpDataForME(m_encparams.CombinedME()));
+ m_ref2_updata = &(my_buffer.GetPicture( ref2).UpDataForME(m_encparams.CombinedME()) );
// Create an object for computing bi-directional prediction calculations
- if(m_predparams->MVPrecision() == MV_PRECISION_EIGHTH_PIXEL)
- m_bicheckdiff = new BiBlockEighthPel(*m_ref1_updata ,
- *m_ref2_updata ,
- *m_pic_data);
- else if(m_predparams->MVPrecision() == MV_PRECISION_QUARTER_PIXEL)
- m_bicheckdiff = new BiBlockQuarterPel(*m_ref1_updata ,
+ if ( m_predparams->MVPrecision()==MV_PRECISION_EIGHTH_PIXEL )
+ m_bicheckdiff = new BiBlockEighthPel( *m_ref1_updata ,
*m_ref2_updata ,
- *m_pic_data);
+ *m_pic_data );
+ else if ( m_predparams->MVPrecision()==MV_PRECISION_QUARTER_PIXEL )
+ m_bicheckdiff = new BiBlockQuarterPel( *m_ref1_updata ,
+ *m_ref2_updata ,
+ *m_pic_data );
else
- m_bicheckdiff = new BiBlockHalfPel(*m_ref1_updata ,
- *m_ref2_updata ,
- *m_pic_data);
+ m_bicheckdiff = new BiBlockHalfPel( *m_ref1_updata ,
+ *m_ref2_updata ,
+ *m_pic_data );
}
else
{
@@ -153,34 +153,32 @@ void ModeDecider::DoModeDecn(EncQueue& my_buffer, int pic_num)
// Create an object for doing intra calculations
- m_intradiff = new IntraBlockDiff(*m_pic_data);
+ m_intradiff = new IntraBlockDiff( *m_pic_data );
// Loop over all the superblocks, doing the work //
///////////////////////////////////////////////////
- for(m_ysb_loc = 0 ; m_ysb_loc < m_predparams->YNumSB() ; ++m_ysb_loc)
- {
- for(m_xsb_loc = 0 ; m_xsb_loc < m_predparams->XNumSB(); ++m_xsb_loc)
- {
+ for (m_ysb_loc=0 ; m_ysb_loc<m_predparams->YNumSB() ; ++m_ysb_loc ){
+ for (m_xsb_loc=0 ; m_xsb_loc<m_predparams->XNumSB(); ++m_xsb_loc ){
DoSBDecn();
}//m_xsb_loc
}//m_ysb_loc
delete m_intradiff;
- if(num_refs > 1)
+ if (num_refs>1)
delete m_bicheckdiff;
}
// Finally, although not strictly part of motion estimation,
// we have to assign DC values for
// blocks we're decided are intra.
- SetDC(my_buffer , pic_num);
+ SetDC( my_buffer , pic_num );
}
void ModeDecider::DoSBDecn()
{
- // Does the mode decision for the given SB, in three stages
+ // Does the mode decision for the given SB, in three stages
// Start with 4x4 modes
DoLevelDecn(2);
@@ -190,7 +188,7 @@ void ModeDecider::DoSBDecn()
DoLevelDecn(1);
// Do 1x1 mode if merging worked before
- if(m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc] <= old_best_SB_cost)
+ if ( m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc] <= old_best_SB_cost)
{
old_best_SB_cost = m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc];
DoLevelDecn(0);
@@ -198,7 +196,7 @@ void ModeDecider::DoSBDecn()
}
-void ModeDecider::DoLevelDecn(int level)
+void ModeDecider::DoLevelDecn( int level )
{
// Computes the best costs if we were to
// stick to a decomposition at this level
@@ -208,35 +206,35 @@ void ModeDecider::DoLevelDecn(int level)
// for each constituent is different.
// The limits of the prediction units
- const int xstart = m_xsb_loc << level;
- const int ystart = m_ysb_loc << level;
+ const int xstart = m_xsb_loc <<level;
+ const int ystart = m_ysb_loc <<level;
- const int xend = xstart + (1 << level);
- const int yend = ystart + (1 << level);
+ const int xend = xstart + (1<<level);
+ const int yend = ystart + (1<<level);
// Case 1: prediction modes are all different
float SB_cost = 0.0;
- for(int j = ystart ; j < yend ; ++j)
+ for ( int j=ystart ; j<yend ; ++j)
{
- for(int i = xstart ; i < xend ; ++i)
- {
- if(level < 2)
- DoME(i , j , level);
- SB_cost += DoUnitDecn(i , j , level);
+ for (int i=xstart ; i<xend ; ++i)
+ {
+ if ( level<2 )
+ DoME( i , j , level);
+ SB_cost += DoUnitDecn( i , j ,level );
}// i
}// j
// if we've improved on the best cost, we should propagate data in
// the base level motion vector set
- if(level == 2)
+ if (level == 2)
{
m_me_data_set[2]->SBSplit()[m_ysb_loc][m_xsb_loc] = 2;
m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc] = SB_cost;
}
- if(level < 2 && SB_cost <= m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc])
+ if ( level<2 && SB_cost <= m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc] )
{
m_me_data_set[2]->SBCosts()[m_ysb_loc][m_xsb_loc] = SB_cost;
m_me_data_set[2]->SBSplit()[m_ysb_loc][m_xsb_loc] = level;
@@ -248,23 +246,23 @@ void ModeDecider::DoLevelDecn(int level)
int xblock_end;
int yblock_end;
- for(int j = ystart ; j < yend ; ++j)
+ for ( int j=ystart ; j<yend ; ++j )
{
- yblock_start = j << (2 - level);
- yblock_end = (j + 1) << (2 - level);
- for(int i = xstart ; i < xend ; ++i)
+ yblock_start = j<<(2-level);
+ yblock_end = (j+1)<<(2-level);
+ for ( int i=xstart ; i<xend ; ++i )
{
- xblock_start = i << (2 - level);
- xblock_end = (i + 1) << (2 - level);
+ xblock_start = i<<(2-level);
+ xblock_end = (i+1)<<(2-level);
- for(int v = yblock_start ; v < yblock_end ; ++v)
+ for ( int v=yblock_start ; v<yblock_end ; ++v )
{
- for(int u = xblock_start ; u < xblock_end ; ++u)
+ for ( int u=xblock_start ; u<xblock_end ; ++u )
{
m_me_data_set[2]->Mode()[v][u] = m_me_data_set[level]->Mode()[j][i];
- m_me_data_set[2]->DC(Y_COMP)[v][u] = m_me_data_set[level]->DC(Y_COMP)[j][i];
+ m_me_data_set[2]->DC( Y_COMP )[v][u] = m_me_data_set[level]->DC( Y_COMP )[j][i];
m_me_data_set[2]->Vectors(1)[v][u] = m_me_data_set[level]->Vectors(1)[j][i];
- if(num_refs > 1)
+ if ( num_refs>1 )
m_me_data_set[2]->Vectors(2)[v][u] = m_me_data_set[level]->Vectors(2)[j][i];
}// u
@@ -287,12 +285,12 @@ void ModeDecider::DoME(const int xpos , const int ypos , const int level)
const MEData& guide_data = *(m_me_data_set[level+1]);
// The corresponding location of the guide data
- const int guide_xpos = xpos << 1;
- const int guide_ypos = ypos << 1;
+ const int guide_xpos = xpos<<1;
+ const int guide_ypos = ypos<<1;
// The location of the lowest level vectors
- const int xblock = xpos << (2 - level);
- const int yblock = ypos << (2 - level);
+ const int xblock = xpos << ( 2 - level);
+ const int yblock = ypos << ( 2 - level);
// The list of potential candidate vectors
CandidateList cand_list;
@@ -303,80 +301,77 @@ void ModeDecider::DoME(const int xpos , const int ypos , const int level)
// The predicting motion vector
MVector mv_pred;
- for(int j = 0 ; j < 2 ; ++j)
- for(int i = 0 ; i < 2 ; ++i)
- AddNewVlist(cand_list , guide_data.Vectors(1)[guide_ypos+j][guide_xpos+i] , 0 , 0);
-
- if(xblock > 0 && yblock > 0)
- mv_pred = MvMedian(m_me_data_set[2]->Vectors(1)[yblock][xblock-1] ,
- m_me_data_set[2]->Vectors(1)[yblock-1][xblock-1],
- m_me_data_set[2]->Vectors(1)[yblock-1][xblock]);
- else if(xblock == 0 && yblock > 0)
- mv_pred = MvMean(m_me_data_set[2]->Vectors(1)[yblock-1][xblock],
- m_me_data_set[2]->Vectors(1)[yblock-1][xblock+1]);
- else if(xblock > 0 && yblock == 0)
- mv_pred = MvMean(m_me_data_set[2]->Vectors(1)[yblock][xblock-1],
- m_me_data_set[2]->Vectors(1)[yblock+1][xblock-1]);
- else
- {
+ for ( int j=0 ; j<2 ; ++j )
+ for (int i=0 ; i<2 ; ++i )
+ AddNewVlist( cand_list , guide_data.Vectors(1)[guide_ypos+j][guide_xpos+i] , 0 , 0 );
+
+ if (xblock>0 && yblock>0)
+ mv_pred = MvMedian( m_me_data_set[2]->Vectors(1)[yblock][xblock-1] ,
+ m_me_data_set[2]->Vectors(1)[yblock-1][xblock-1],
+ m_me_data_set[2]->Vectors(1)[yblock-1][xblock]);
+ else if (xblock==0 && yblock>0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(1)[yblock-1][xblock],
+ m_me_data_set[2]->Vectors(1)[yblock-1][xblock+1]);
+ else if (xblock>0 && yblock==0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(1)[yblock][xblock-1],
+ m_me_data_set[2]->Vectors(1)[yblock+1][xblock-1]);
+ else{
mv_pred.x = 0;
mv_pred.y = 0;
}
- BlockMatcher my_bmatch1(*m_pic_data ,
- *m_ref1_updata ,
- m_predparams->LumaBParams(level) ,
- m_predparams->MVPrecision(),
- me_data.Vectors(1) , me_data.PredCosts(1));
+ BlockMatcher my_bmatch1( *m_pic_data ,
+ *m_ref1_updata ,
+ m_predparams->LumaBParams(level) ,
+ m_predparams->MVPrecision(),
+ me_data.Vectors(1) , me_data.PredCosts(1) );
me_data.PredCosts(1)[ypos][xpos].total = 100000000.0f;
- my_bmatch1.FindBestMatchSubp(xpos , ypos , cand_list, mv_pred, lambda);
+ my_bmatch1.FindBestMatchSubp( xpos , ypos , cand_list, mv_pred, lambda );
- if(num_refs > 1)
- {
- //do the same for the other reference
+ if (num_refs>1)
+ {//do the same for the other reference
cand_list.clear();
- for(int j = 0 ; j < 2 ; ++j)
- for(int i = 0 ; i < 2 ; ++i)
- AddNewVlist(cand_list , guide_data.Vectors(2)[guide_ypos+j][guide_xpos+i] , 0 , 0);
-
- if(xblock > 0 && yblock > 0)
- mv_pred = MvMedian(m_me_data_set[2]->Vectors(2)[yblock][xblock-1] ,
- m_me_data_set[2]->Vectors(2)[yblock-1][xblock-1],
- m_me_data_set[2]->Vectors(2)[yblock-1][xblock]);
- else if(xblock == 0 && yblock > 0)
- mv_pred = MvMean(m_me_data_set[2]->Vectors(2)[yblock-1][xblock],
- m_me_data_set[2]->Vectors(2)[yblock-1][xblock+1]);
- else if(xblock > 0 && yblock == 0)
- mv_pred = MvMean(m_me_data_set[2]->Vectors(2)[yblock][xblock-1],
- m_me_data_set[2]->Vectors(2)[yblock+1][xblock-1]);
- else
- {
- mv_pred.x = 0;
- mv_pred.y = 0;
+ for ( int j=0 ; j<2 ; ++j )
+ for (int i=0 ; i<2 ; ++i )
+ AddNewVlist( cand_list , guide_data.Vectors(2)[guide_ypos+j][guide_xpos+i] , 0 , 0 );
+
+ if (xblock>0 && yblock>0)
+ mv_pred = MvMedian( m_me_data_set[2]->Vectors(2)[yblock][xblock-1] ,
+ m_me_data_set[2]->Vectors(2)[yblock-1][xblock-1],
+ m_me_data_set[2]->Vectors(2)[yblock-1][xblock]);
+ else if (xblock==0 && yblock>0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(2)[yblock-1][xblock],
+ m_me_data_set[2]->Vectors(2)[yblock-1][xblock+1]);
+ else if (xblock>0 && yblock==0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(2)[yblock][xblock-1],
+ m_me_data_set[2]->Vectors(2)[yblock+1][xblock-1]);
+ else{
+ mv_pred.x = 0;
+ mv_pred.y = 0;
}
- BlockMatcher my_bmatch2(*m_pic_data ,
- *m_ref2_updata ,
- m_predparams->LumaBParams(level) ,
- m_predparams->MVPrecision(),
- me_data.Vectors(2) , me_data.PredCosts(2));
+ BlockMatcher my_bmatch2( *m_pic_data ,
+ *m_ref2_updata ,
+ m_predparams->LumaBParams(level) ,
+ m_predparams->MVPrecision(),
+ me_data.Vectors(2) , me_data.PredCosts(2) );
me_data.PredCosts(2)[ypos][xpos].total = 100000000.0f;
- my_bmatch2.FindBestMatchSubp(xpos , ypos , cand_list, mv_pred, lambda);
+ my_bmatch2.FindBestMatchSubp( xpos , ypos , cand_list, mv_pred, lambda );
- }
+ }
}
-float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level)
+float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level )
{
// For a given prediction unit (SB, subSB or block) find the best
// mode, given that the REF1 and REF2 motion estimation has
// already been done.
- MEData& me_data = *(m_me_data_set[level]);
+ MEData& me_data = *( m_me_data_set[level] );
// Coords of the top-leftmost block belonging to this unit
// const int xblock = xpos<<(2-level);
@@ -391,9 +386,9 @@ float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level)
BlockDiffParams dparams;
- dparams.SetBlockLimits(m_predparams->LumaBParams(level) , *m_pic_data, xpos , ypos);
+ dparams.SetBlockLimits( m_predparams->LumaBParams( level ) , *m_pic_data, xpos , ypos);
- // First check REF1 costs //
+ // First check REF1 costs //
/**************************/
// mode_cost = ModeCost( xblock , yblock )*m_mode_factor[level];
@@ -402,15 +397,15 @@ float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level)
min_unit_cost = me_data.PredCosts(1)[ypos][xpos].total + mode_cost;
best_SAD_value = me_data.PredCosts(1)[ypos][xpos].SAD;
- if(num_refs > 1)
+ if (num_refs>1)
{
- // Next check REF2 costs //
- /*************************/
+ // Next check REF2 costs //
+ /*************************/
// mode_cost = ModeCost( xblock , yblock )*m_mode_factor[level];
me_data.PredCosts(2)[ypos][xpos].total *= m_level_factor[level];
unit_cost = me_data.PredCosts(2)[ypos][xpos].total + mode_cost;
- if(unit_cost < min_unit_cost)
+ if ( unit_cost<min_unit_cost )
{
me_data.Mode()[ypos][xpos] = REF2_ONLY;
min_unit_cost = unit_cost;
@@ -422,19 +417,19 @@ float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level)
// mode_cost = ModeCost( xpos , ypos )*m_mode_factor[level];
me_data.BiPredCosts()[ypos][xpos].mvcost =
- me_data.PredCosts(1)[ypos][xpos].mvcost +
- me_data.PredCosts(2)[ypos][xpos].mvcost;
+ me_data.PredCosts(1)[ypos][xpos].mvcost+
+ me_data.PredCosts(2)[ypos][xpos].mvcost;
me_data.BiPredCosts()[ypos][xpos].SAD = m_bicheckdiff->Diff(dparams ,
- me_data.Vectors(1)[ypos][xpos] ,
- me_data.Vectors(2)[ypos][xpos]);
+ me_data.Vectors(1)[ypos][xpos] ,
+ me_data.Vectors(2)[ypos][xpos] );
- me_data.BiPredCosts()[ypos][xpos].SetTotal(loc_lambda);
+ me_data.BiPredCosts()[ypos][xpos].SetTotal( loc_lambda );
me_data.BiPredCosts()[ypos][xpos].total *= m_level_factor[level];
unit_cost = me_data.BiPredCosts()[ypos][xpos].total + mode_cost;
- if(unit_cost < min_unit_cost)
+ if ( unit_cost<min_unit_cost )
{
me_data.Mode()[ypos][xpos] = REF1AND2;
min_unit_cost = unit_cost;
@@ -446,17 +441,17 @@ float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level)
// Calculate the cost if we were to code the block as intra //
/************************************************************/
- if(level == 2 && best_SAD_value > 4.0 * m_predparams->LumaBParams(level).Xblen()*
- m_predparams->LumaBParams(level).Yblen())
+ if ( level==2 && best_SAD_value> 4.0*m_predparams->LumaBParams( level ).Xblen()*
+ m_predparams->LumaBParams( level ).Yblen() )
{
// mode_cost = ModeCost( xblock , yblock ) * m_mode_factor[level];
- me_data.IntraCosts()[ypos][xpos] = m_intradiff->Diff(dparams , me_data.DC(Y_COMP)[ypos][xpos]);
-// me_data.IntraCosts()[ypos][xpos] += loc_lambda *
+ me_data.IntraCosts()[ypos][xpos] = m_intradiff->Diff( dparams , me_data.DC( Y_COMP )[ypos][xpos] );
+// me_data.IntraCosts()[ypos][xpos] += loc_lambda *
// GetDCVar( me_data.DC( Y_COMP )[ypos][xpos] , GetDCPred( xblock , yblock ) );
me_data.IntraCosts()[ypos][xpos] *= m_level_factor[level];
unit_cost = me_data.IntraCosts()[ypos][xpos] + mode_cost;
- if(unit_cost < min_unit_cost && me_data.IntraCosts()[ypos][xpos] < 0.85 * best_SAD_value)
+ if ( unit_cost<min_unit_cost && me_data.IntraCosts()[ypos][xpos]<0.85*best_SAD_value)
{
me_data.Mode()[ypos][xpos] = INTRA;
min_unit_cost = unit_cost;
@@ -466,16 +461,16 @@ float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level)
return min_unit_cost;
}
-ValueType ModeDecider::GetDCPred(int xblock , int yblock)
+ValueType ModeDecider::GetDCPred( int xblock , int yblock )
{
ValueType dc_pred = 0;
- if(xblock > 0 && m_me_data_set[2]->Mode()[yblock][xblock-1] == INTRA)
+ if ( xblock>0 && m_me_data_set[2]->Mode()[yblock][xblock-1] == INTRA )
{
- dc_pred = m_me_data_set[2]->DC(Y_COMP)[yblock][xblock-1];
- if(yblock > 0 && m_me_data_set[2]->Mode()[yblock-1][xblock] == INTRA)
+ dc_pred = m_me_data_set[2]->DC( Y_COMP )[yblock][xblock-1];
+ if ( yblock>0 && m_me_data_set[2]->Mode()[yblock-1][xblock] == INTRA )
{
- dc_pred += m_me_data_set[2]->DC(Y_COMP)[yblock-1][xblock];
+ dc_pred += m_me_data_set[2]->DC( Y_COMP )[yblock-1][xblock];
dc_pred >>= 1;
}
}
@@ -489,95 +484,90 @@ float ModeDecider::ModeCost(const int xindex , const int yindex)
// First, get a prediction for the mode
unsigned int mode_predictor = (unsigned int)(REF1_ONLY);
- const TwoDArray<PredMode>& preddata(m_me_data_set[2]->Mode());
+ const TwoDArray<PredMode>& preddata( m_me_data_set[2]->Mode() );
- unsigned int num_ref1_nbrs(0);
- unsigned int num_ref2_nbrs(0);
+ unsigned int num_ref1_nbrs( 0 );
+ unsigned int num_ref2_nbrs( 0 );
- if(xindex > 0 && yindex > 0)
+ if (xindex > 0 && yindex > 0)
{
- num_ref1_nbrs += ((unsigned int)(preddata[yindex-1][xindex])) & 1;
- num_ref1_nbrs += ((unsigned int)(preddata[yindex-1][xindex-1])) & 1;
- num_ref1_nbrs += ((unsigned int)(preddata[yindex][xindex-1])) & 1;
+ num_ref1_nbrs += ((unsigned int)( preddata[yindex-1][xindex] ) ) & 1;
+ num_ref1_nbrs += ((unsigned int)( preddata[yindex-1][xindex-1] ) ) & 1;
+ num_ref1_nbrs += ((unsigned int)( preddata[yindex][xindex-1] ) ) & 1;
- mode_predictor = num_ref1_nbrs >> 1;
+ mode_predictor = num_ref1_nbrs>>1;
- num_ref2_nbrs += ((unsigned int)(preddata[yindex-1][xindex])) & 2;
- num_ref2_nbrs += ((unsigned int)(preddata[yindex-1][xindex-1])) & 2;
- num_ref2_nbrs += ((unsigned int)(preddata[yindex][xindex-1])) & 2;
+ num_ref2_nbrs += ((unsigned int)( preddata[yindex-1][xindex] ) ) & 2;
+ num_ref2_nbrs += ((unsigned int)( preddata[yindex-1][xindex-1] ) ) & 2;
+ num_ref2_nbrs += ((unsigned int)( preddata[yindex][xindex-1] ) ) & 2;
num_ref2_nbrs >>= 1;
- mode_predictor ^= ((num_ref2_nbrs >> 1) << 1);
+ mode_predictor ^= ( (num_ref2_nbrs>>1)<<1 );
}
- else if(xindex > 0 && yindex == 0)
- mode_predictor = (unsigned int)(preddata[0][xindex-1]);
- else if(xindex == 0 && yindex > 0)
- mode_predictor = (unsigned int)(preddata[yindex-1][0]);
+ else if (xindex > 0 && yindex == 0)
+ mode_predictor = (unsigned int)( preddata[0][xindex-1] );
+ else if (xindex == 0 && yindex > 0)
+ mode_predictor = (unsigned int)( preddata[yindex-1][0] );
- unsigned int var = (mode_predictor & 1) + ((mode_predictor >> 1) & 1);
+ unsigned int var = (mode_predictor & 1)+((mode_predictor>>1) &1);
- return var * m_me_data_set[2]->LambdaMap()[yindex][xindex];
+ return var*m_me_data_set[2]->LambdaMap()[yindex][xindex];
}
-float ModeDecider::GetDCVar(const ValueType dc_val , const ValueType dc_pred)
+float ModeDecider::GetDCVar( const ValueType dc_val , const ValueType dc_pred)
{
- return 4.0 * std::abs(static_cast<float>(dc_val - dc_pred));
+ return 4.0*std::abs( static_cast<float>( dc_val - dc_pred ) );
}
ValueType ModeDecider::GetBlockDC(const PicArray& pic_data,
- int xunit , int yunit , int split, CompSort cs)
+ int xunit , int yunit , int split, CompSort cs)
{
BlockDiffParams dparams;
- if(cs != Y_COMP)
- dparams.SetBlockLimits(m_predparams->ChromaBParams(split) ,
- pic_data, xunit , yunit);
+ if ( cs!=Y_COMP )
+ dparams.SetBlockLimits( m_predparams->ChromaBParams( split ) ,
+ pic_data, xunit , yunit);
else
- dparams.SetBlockLimits(m_predparams->LumaBParams(split) ,
- pic_data, xunit , yunit);
+ dparams.SetBlockLimits( m_predparams->LumaBParams( split ) ,
+ pic_data, xunit , yunit);
- IntraBlockDiff intradiff(pic_data);
+ IntraBlockDiff intradiff( pic_data );
- return intradiff.CalcDC(dparams);
+ return intradiff.CalcDC( dparams );
}
-void ModeDecider::SetDC(const PicArray& pic_data , MEData& me_data , CompSort cs)
+void ModeDecider::SetDC( const PicArray& pic_data , MEData& me_data , CompSort cs )
{
- TwoDArray<ValueType>& dcarray = me_data.DC(cs);
- TwoDArray<ValueType> temp_dcarray(dcarray.LengthY(), dcarray.LengthX());
+ TwoDArray<ValueType>& dcarray = me_data.DC( cs );
+ TwoDArray<ValueType> temp_dcarray (dcarray.LengthY(), dcarray.LengthX() );
- for(int y = 0 ; y < dcarray.LengthY() ; ++y)
- {
- for(int x = 0 ; x < dcarray.LengthX() ; ++x)
- {
- temp_dcarray[y][x] = GetBlockDC(pic_data , x , y , 2, cs);
+ for ( int y=0 ; y<dcarray.LengthY() ; ++y ){
+ for ( int x=0 ; x<dcarray.LengthX() ; ++x ){
+ temp_dcarray[y][x] = GetBlockDC( pic_data , x , y , 2, cs );
}
}
- for(int x = 0 ; x < dcarray.LengthX() ; ++x)
- {
+ for ( int x=0 ; x<dcarray.LengthX() ; ++x ){
dcarray[0][x] = temp_dcarray[0][x];
}
- for(int y = 1 ; y < dcarray.LengthY() - 1 ; ++y)
- {
+ for ( int y=1 ; y<dcarray.LengthY()-1 ; ++y ){
dcarray[y][0] = temp_dcarray[y][0];
- for(int x = 1 ; x < dcarray.LengthX() - 1 ; ++x)
- {
- dcarray[y][x] = (temp_dcarray[y-1][x-1] + 3 * temp_dcarray[y-1][x] + temp_dcarray[y-1][x+1] +
- 3 * temp_dcarray[y][x-1] + 3 * temp_dcarray[y][x+1] +
- temp_dcarray[y+1][x-1] + 3 * temp_dcarray[y+1][x] + temp_dcarray[y+1][x+1] + 8) >> 4;
- }
+ for ( int x=1 ; x<dcarray.LengthX()-1 ; ++x ){
+ dcarray[y][x] = (temp_dcarray[y-1][x-1]+3*temp_dcarray[y-1][x]+temp_dcarray[y-1][x+1]+
+ 3*temp_dcarray[y][x-1]+ 3*temp_dcarray[y][x+1]+
+ temp_dcarray[y+1][x-1]+3*temp_dcarray[y+1][x]+temp_dcarray[y+1][x+1]+8 )>>4;
+ }
dcarray[y][dcarray.LastX()] = temp_dcarray[y][dcarray.LastX()];
}
}
-void ModeDecider::SetDC(EncQueue& my_buffer , int pic_num)
+void ModeDecider::SetDC( EncQueue& my_buffer , int pic_num )
{
MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
- SetDC(my_buffer.GetPicture(pic_num).OrigData(Y_COMP) , me_data , Y_COMP);
- SetDC(my_buffer.GetPicture(pic_num).OrigData(U_COMP) , me_data , U_COMP);
- SetDC(my_buffer.GetPicture(pic_num).OrigData(V_COMP) , me_data , V_COMP);
+ SetDC( my_buffer.GetPicture( pic_num ).OrigData(Y_COMP) , me_data , Y_COMP );
+ SetDC( my_buffer.GetPicture( pic_num ).OrigData(U_COMP) , me_data , U_COMP );
+ SetDC( my_buffer.GetPicture( pic_num ).OrigData(V_COMP) , me_data , V_COMP );
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.h
index fd0df3339..08f4b6e00 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_mode_decn.h
@@ -43,124 +43,124 @@
namespace dirac
{
-class EncQueue;
-
-//! Decides between superblock and block prediction modes.
-/*!
- Loops over all the superblocks and decides on the best modes. A
- superblock is a square of 16 blocks. There are three possible
- splitting levels:
- level 0 means the superblock is considered as a single block;
- level 1 means the superblock is considered as 4 larger blocks,
- termed sub-superblocks;
- level 0 means the superblock is split right down to blocks.
-
- In deciding which modes
- to adopt, the ModeDecider object calculates costs for all
- permutations, doing motion estimation for the level 1 and level 0
- modes as these have not been calculated before.
- The process of decision for each is as follows. For each SB, we loop
- over the levels, and call DoLevelDecn. DoLevelDecn does motion
- estimation if it's necessary. Then it assumes that we don't have a
- common block mode and calls DoUnitDecn which finds the best mode for
- each unit in the SB at that level, individually. When we've got a
- best cost for that level we go up to the next one.
- */
-class ModeDecider
-{
+ class EncQueue;
-public:
- //! Constructor
+ //! Decides between superblock and block prediction modes.
/*!
- The constructor creates arrays for handling the motion vector data
- at splitting levels 0 and 1, as motion
- estimation must be performed for these levels.
+ Loops over all the superblocks and decides on the best modes. A
+ superblock is a square of 16 blocks. There are three possible
+ splitting levels:
+ level 0 means the superblock is considered as a single block;
+ level 1 means the superblock is considered as 4 larger blocks,
+ termed sub-superblocks;
+ level 0 means the superblock is split right down to blocks.
+
+ In deciding which modes
+ to adopt, the ModeDecider object calculates costs for all
+ permutations, doing motion estimation for the level 1 and level 0
+ modes as these have not been calculated before.
+ The process of decision for each is as follows. For each SB, we loop
+ over the levels, and call DoLevelDecn. DoLevelDecn does motion
+ estimation if it's necessary. Then it assumes that we don't have a
+ common block mode and calls DoUnitDecn which finds the best mode for
+ each unit in the SB at that level, individually. When we've got a
+ best cost for that level we go up to the next one.
*/
- ModeDecider(const EncoderParams& encp);
+ class ModeDecider
+ {
- //! Destructor
- /*!
- The destructor destroys the classes created in the constructor
- */
- ~ModeDecider();
+ public:
+ //! Constructor
+ /*!
+ The constructor creates arrays for handling the motion vector data
+ at splitting levels 0 and 1, as motion
+ estimation must be performed for these levels.
+ */
+ ModeDecider(const EncoderParams& encp );
- //! Does the actual mode decision
- /*!
- Does the mode decision
- \param my_buffer the buffer of all the relevant frames
- \param pic_num the picture number for which motion estimation is being done
- */
- void DoModeDecn(EncQueue& my_buffer , int pic_num);
+ //! Destructor
+ /*!
+ The destructor destroys the classes created in the constructor
+ */
+ ~ModeDecider();
+
+ //! Does the actual mode decision
+ /*!
+ Does the mode decision
+ \param my_buffer the buffer of all the relevant frames
+ \param pic_num the picture number for which motion estimation is being done
+ */
+ void DoModeDecn( EncQueue& my_buffer , int pic_num );
-private:
- ModeDecider(const ModeDecider& cpy); //private, body-less copy constructor: this class should not be copied
- ModeDecider& operator=(const ModeDecider& rhs); //private, body-less assignment=: this class should not be assigned
+ private:
+ ModeDecider( const ModeDecider& cpy );//private, body-less copy constructor: this class should not be copied
+ ModeDecider& operator=( const ModeDecider& rhs );//private, body-less assignment=: this class should not be assigned
- //functions
- void DoSBDecn(); //called by do_mode_decn for each SB
+ //functions
+ void DoSBDecn(); //called by do_mode_decn for each SB
- //! Make a mode decision given a particular level of decomposition
- void DoLevelDecn(int level);
+ //! Make a mode decision given a particular level of decomposition
+ void DoLevelDecn( int level );
- //! Decide on a mode for a given prediction unit (block, sub-SB or SB)
- float DoUnitDecn(const int xpos , const int ypos , const int level);
+ //! Decide on a mode for a given prediction unit (block, sub-SB or SB)
+ float DoUnitDecn( const int xpos , const int ypos , const int level );
- //! Do motion estimation for a prediction unit at a given level
- void DoME(const int xpos , const int ypos , const int level);
+ //! Do motion estimation for a prediction unit at a given level
+ void DoME( const int xpos , const int ypos , const int level );
- //! Return a measure of the cost of coding a given mode
- float ModeCost(const int xindex , const int yindex);
+ //! Return a measure of the cost of coding a given mode
+ float ModeCost( const int xindex , const int yindex );
- //! Get a prediction for the dc value of a block
- ValueType GetDCPred(int xblock , int yblock);
+ //! Get a prediction for the dc value of a block
+ ValueType GetDCPred( int xblock , int yblock );
- //! Get a measure of DC value variance
- float GetDCVar(const ValueType dc_val , const ValueType dc_pred);
+ //! Get a measure of DC value variance
+ float GetDCVar( const ValueType dc_val , const ValueType dc_pred);
- //! Go through all the intra blocks and extract the chroma dc values to be coded
- void SetDC(EncQueue& my_buffer, int pic_num);
+ //! Go through all the intra blocks and extract the chroma dc values to be coded
+ void SetDC( EncQueue& my_buffer, int pic_num);
- //! Called by previous fn for each component
- void SetDC(const PicArray& pic_data, MEData& me_data, CompSort cs);
+ //! Called by previous fn for each component
+ void SetDC(const PicArray& pic_data, MEData& me_data,CompSort cs);
- //! Called by previous fn for each block
- ValueType GetBlockDC(const PicArray& pic_data, int xloc, int yloc, int split, CompSort cs);
+ //! Called by previous fn for each block
+ ValueType GetBlockDC(const PicArray& pic_data, int xloc,int yloc,int split, CompSort cs);
- // Member data
- PictureSort m_psort;
+ // Member data
+ PictureSort m_psort;
- //! A local reference to the encoder parameters
- const EncoderParams& m_encparams;
+ //! A local reference to the encoder parameters
+ const EncoderParams& m_encparams;
- //! A local pointer to the picture prediction params
- const PicturePredParams* m_predparams;
+ //! A local pointer to the picture prediction params
+ const PicturePredParams* m_predparams;
- //! The Lagrangian parameter for motion estimation
- float m_lambda;
+ //! The Lagrangian parameter for motion estimation
+ float m_lambda;
- //! Correction factor for comparing SAD costs for different SB splittings
- OneDArray<float> m_level_factor;
+ //! Correction factor for comparing SAD costs for different SB splittings
+ OneDArray<float> m_level_factor;
- //! Correction factor for comparing mode costs for different SB splittings
- OneDArray<float> m_mode_factor;
+ //! Correction factor for comparing mode costs for different SB splittings
+ OneDArray<float> m_mode_factor;
- //! Motion vector data for each level of splitting
- OneDArray< MEData* > m_me_data_set;
+ //! Motion vector data for each level of splitting
+ OneDArray< MEData* > m_me_data_set;
- const PicArray* m_pic_data;
- const PicArray* m_ref1_updata;
- const PicArray* m_ref2_updata;
- int num_refs;
+ const PicArray* m_pic_data;
+ const PicArray* m_ref1_updata;
+ const PicArray* m_ref2_updata;
+ int num_refs;
- IntraBlockDiff* m_intradiff;
- BiBlockDiff* m_bicheckdiff;
+ IntraBlockDiff* m_intradiff;
+ BiBlockDiff* m_bicheckdiff;
- //position variables, used in all the mode decisions
- int m_xsb_loc, m_ysb_loc; //coords of the current SB
+ //position variables, used in all the mode decisions
+ int m_xsb_loc,m_ysb_loc; //coords of the current SB
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.cpp
index 9d204f638..51376808b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.cpp
@@ -62,23 +62,23 @@ SubpelRefine::SubpelRefine(const EncoderParams& encp):
}
-void SubpelRefine::DoSubpel(EncQueue& my_buffer, int pic_num)
+void SubpelRefine::DoSubpel( EncQueue& my_buffer,int pic_num )
{
- m_predparams = &(my_buffer.GetPicture(pic_num).GetMEData().GetPicPredParams());
+ m_predparams = &(my_buffer.GetPicture(pic_num).GetMEData().GetPicPredParams() );
//main loop for the subpel refinement
- int ref1, ref2;
+ int ref1,ref2;
const PictureSort psort = my_buffer.GetPicture(pic_num).GetPparams().PicSort();
- if(psort.IsInter())
+ if (psort.IsInter())
{
// Get the references
const vector<int>& refs = my_buffer.GetPicture(pic_num).GetPparams().Refs();
int num_refs = refs.size();
ref1 = refs[0];
- if(num_refs > 1)
+ if (num_refs>1)
ref2 = refs[1];
else
ref2 = ref1;
@@ -87,19 +87,19 @@ void SubpelRefine::DoSubpel(EncQueue& my_buffer, int pic_num)
const PicArray& refup1_data = my_buffer.GetPicture(ref1).UpDataForME(m_encparams.CombinedME());
const PicArray& refup2_data = my_buffer.GetPicture(ref2).UpDataForME(m_encparams.CombinedME());
- MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
+ MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
// Now match the pictures
- MatchPic(pic_data , refup1_data , me_data , 1);
+ MatchPic( pic_data , refup1_data , me_data ,1 );
- if(ref1 != ref2)
- MatchPic(pic_data , refup2_data , me_data , 2);
+ if (ref1 != ref2 )
+ MatchPic( pic_data , refup2_data , me_data ,2 );
}
}
void SubpelRefine::MatchPic(const PicArray& pic_data , const PicArray& refup_data , MEData& me_data ,
- int ref_id)
+ int ref_id)
{
// Match a picture against a single reference. Loop over all the blocks
// doing the matching
@@ -108,66 +108,64 @@ void SubpelRefine::MatchPic(const PicArray& pic_data , const PicArray& refup_dat
////////////////////
// Provide aliases for the appropriate motion vector data components
- MvArray& mv_array = me_data.Vectors(ref_id);
- TwoDArray<MvCostData>& pred_costs = me_data.PredCosts(ref_id);
+ MvArray& mv_array = me_data.Vectors( ref_id );
+ TwoDArray<MvCostData>& pred_costs = me_data.PredCosts( ref_id );
// Provide a block matching object to do the work
- BlockMatcher my_bmatch(pic_data , refup_data , m_predparams->LumaBParams(2) ,
- m_predparams->MVPrecision() , mv_array , pred_costs);
+ BlockMatcher my_bmatch( pic_data , refup_data , m_predparams->LumaBParams(2) ,
+ m_predparams->MVPrecision() , mv_array , pred_costs );
// Do the work //
/////////////////
// Loop over all the blocks, doing the work
- for(int yblock = 0 ; yblock < m_predparams->YNumBlocks() ; ++yblock)
- {
- for(int xblock = 0 ; xblock < m_predparams->XNumBlocks() ; ++xblock)
- {
- DoBlock(xblock , yblock , my_bmatch , me_data , ref_id);
+ for (int yblock=0 ; yblock<m_predparams->YNumBlocks() ; ++yblock){
+ for (int xblock=0 ; xblock<m_predparams->XNumBlocks() ; ++xblock){
+ DoBlock(xblock , yblock , my_bmatch , me_data , ref_id );
}// xblock
}// yblock
}
void SubpelRefine::DoBlock(const int xblock , const int yblock ,
- BlockMatcher& my_bmatch, MEData& me_data , const int ref_id)
+ BlockMatcher& my_bmatch, MEData& me_data , const int ref_id )
{
// For each block, home into the sub-pixel vector
// Provide aliases for the appropriate motion vector data components
- MvArray& mv_array = me_data.Vectors(ref_id);
+ MvArray& mv_array = me_data.Vectors( ref_id );
- const MVector mv_pred = GetPred(xblock , yblock , mv_array);
+ const MVector mv_pred = GetPred( xblock , yblock , mv_array );
const float loc_lambda = me_data.LambdaMap()[yblock][xblock];
- my_bmatch.RefineMatchSubp(xblock , yblock , mv_pred, loc_lambda);
+ my_bmatch.RefineMatchSubp( xblock , yblock , mv_pred, loc_lambda );
}
-MVector SubpelRefine::GetPred(int xblock, int yblock, const MvArray& mvarray)
+MVector SubpelRefine::GetPred(int xblock,int yblock,const MvArray& mvarray)
{
MVector mv_pred;
ImageCoords n_coords;
vector<MVector> neighbours;
- if(xblock > 0 && yblock > 0 && xblock < mvarray.LastX())
+ if (xblock>0 && yblock>0 && xblock<mvarray.LastX())
{
- for(int i = 0 ; i < m_nshift.Length() ; ++i)
+ for (int i=0 ; i<m_nshift.Length() ; ++i)
{
- n_coords.x = xblock + m_nshift[i].x;
- n_coords.y = yblock + m_nshift[i].y;
+ n_coords.x = xblock+m_nshift[i].x;
+ n_coords.y = yblock+m_nshift[i].y;
neighbours.push_back(mvarray[n_coords.y][n_coords.x]);
}// i
}
else
{
- for(int i = 0 ; i < m_nshift.Length(); ++i)
+ for (int i=0 ; i<m_nshift.Length(); ++i )
{
- n_coords.x = xblock + m_nshift[i].x;
- n_coords.y = yblock + m_nshift[i].y;
- if(n_coords.x >= 0 && n_coords.y >= 0 && n_coords.x < mvarray.LengthX() && n_coords.y < mvarray.LengthY())
+ n_coords.x = xblock+m_nshift[i].x;
+ n_coords.y = yblock+m_nshift[i].y;
+ if (n_coords.x>=0 && n_coords.y>=0 && n_coords.x<mvarray.LengthX() && n_coords.y<mvarray.LengthY())
neighbours.push_back(mvarray[n_coords.y][n_coords.x]);
}// i
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.h
index 7038f90d2..bd5724928 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_subpel.h
@@ -44,71 +44,71 @@
namespace dirac
{
-class EncQueue;
-class MvData;
-class PicArray;
-
-//! The SubpelRefine class takes pixel-accurate motion vectors and refines them to 1/8-pixel accuracy
-/*!
- The SubpelRefine class takes pixel-accurate motion vectors and refines
- them to 1/8-pixel accuracy. It uses references upconverted by a factor
- of 2 in each dimension, with the remaining precision gained by doing
- linear interpolation between values on-the-fly.
- */
-class SubpelRefine
-{
-public:
- //! Constructor
+ class EncQueue;
+ class MvData;
+ class PicArray;
+
+ //! The SubpelRefine class takes pixel-accurate motion vectors and refines them to 1/8-pixel accuracy
/*!
- The constructor initialises the encoder parameters.
- \param encp the parameters used for controlling ME/MC
+ The SubpelRefine class takes pixel-accurate motion vectors and refines
+ them to 1/8-pixel accuracy. It uses references upconverted by a factor
+ of 2 in each dimension, with the remaining precision gained by doing
+ linear interpolation between values on-the-fly.
*/
- SubpelRefine(const EncoderParams& encp);
+ class SubpelRefine
+ {
+ public:
+ //! Constructor
+ /*!
+ The constructor initialises the encoder parameters.
+ \param encp the parameters used for controlling ME/MC
+ */
+ SubpelRefine(const EncoderParams& encp);
- //! Destructor
- ~SubpelRefine() {}
+ //! Destructor
+ ~SubpelRefine(){}
- //! Does the actual sub-pixel refinement
- /*!
- Does the actual sub-pixel refinement.
- \param my_buffer the buffer of pictures being used
- \param pic_num the picture number on which motion estimation is being performed
- */
- void DoSubpel(EncQueue& my_buffer , int pic_num);
+ //! Does the actual sub-pixel refinement
+ /*!
+ Does the actual sub-pixel refinement.
+ \param my_buffer the buffer of pictures being used
+ \param pic_num the picture number on which motion estimation is being performed
+ */
+ void DoSubpel( EncQueue& my_buffer , int pic_num );
-private:
- //! Private, body-less copy constructor: this class should not be copied
- SubpelRefine(const SubpelRefine& cpy);
+ private:
+ //! Private, body-less copy constructor: this class should not be copied
+ SubpelRefine( const SubpelRefine& cpy );
- //! Private, body-less assignment=: this class should not be assigned
- SubpelRefine& operator=(const SubpelRefine& rhs);
+ //! Private, body-less assignment=: this class should not be assigned
+ SubpelRefine& operator=( const SubpelRefine& rhs );
- //! Match a picture from its (upconverted) reference, and record the block mvs
- void MatchPic(const PicArray& pic_data , const PicArray& refup_data , MEData& me_data ,
- int ref_id);
+ //! Match a picture from its (upconverted) reference, and record the block mvs
+ void MatchPic(const PicArray& pic_data , const PicArray& refup_data , MEData& me_data ,
+ int ref_id);
- //! Match an individual block
- void DoBlock(const int xblock , const int yblock ,
- BlockMatcher& my_bmatch, MEData& me_data , const int ref_id);
+ //! Match an individual block
+ void DoBlock( const int xblock , const int yblock ,
+ BlockMatcher& my_bmatch, MEData& me_data , const int ref_id );
- //! Get a prediction for a block MV from the neighbouring blocks
- MVector GetPred(int xblock , int yblock , const MvArray& mvarray);
+ //! Get a prediction for a block MV from the neighbouring blocks
+ MVector GetPred( int xblock , int yblock , const MvArray& mvarray );
- //member variables
+ //member variables
- //! Local reference to the encoder params
- const EncoderParams& m_encparams;
+ //! Local reference to the encoder params
+ const EncoderParams& m_encparams;
- //! A local pointer to the encoder params
- const PicturePredParams* m_predparams;
+ //! A local pointer to the encoder params
+ const PicturePredParams* m_predparams;
- //! The list of candidate vectors being tested
- CandidateList m_cand_list;
+ //! The list of candidate vectors being tested
+ CandidateList m_cand_list;
- //! The relative coords of the set of neighbours used to generate MV predictions
- OneDArray<ImageCoords> m_nshift;
+ //! The relative coords of the set of neighbours used to generate MV predictions
+ OneDArray<ImageCoords> m_nshift;
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.cpp
index 05e9216df..007334151 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.cpp
@@ -20,7 +20,7 @@
* Portions created by the Initial Developer are Copyright (C) 2004.
* All Rights Reserved.
*
-* Contributor(s): Thomas Davies (Original Author),
+* Contributor(s): Thomas Davies (Original Author),
* Peter Meerwald (pmeerw@users.sourceforge.net)
* Steve Bearcroft (bearcrsw@users.sourceforge.net)
*
@@ -55,25 +55,25 @@ using namespace dirac;
#include <algorithm>
//#define INTRA_HAAR
-void BlockDiffParams::SetBlockLimits(const OLBParams& bparams ,
- const PicArray& m_pic_data ,
- const int xbpos , const int ybpos)
+void BlockDiffParams::SetBlockLimits( const OLBParams& bparams ,
+ const PicArray& m_pic_data ,
+ const int xbpos , const int ybpos)
{
const int loc_xp = xbpos * bparams.Xbsep() - bparams.Xoffset();
const int loc_yp = ybpos * bparams.Ybsep() - bparams.Yoffset();
- m_xp = std::max(loc_xp , 0);
- m_yp = std::max(loc_yp , 0);
+ m_xp=std::max( loc_xp , 0 );
+ m_yp=std::max( loc_yp , 0 );
m_xl = bparams.Xblen() - m_xp + loc_xp;
m_yl = bparams.Yblen() - m_yp + loc_yp;
- //constrain block lengths to fall within the picture
- m_xl = ((m_xp + m_xl - 1) > m_pic_data.LastX()) ? (m_pic_data.LastX() + 1 - m_xp) : m_xl;
- m_yl = ((m_yp + m_yl - 1) > m_pic_data.LastY()) ? (m_pic_data.LastY() + 1 - m_yp) : m_yl;
+ //constrain block lengths to fall within the picture
+ m_xl = ( ( m_xp + m_xl - 1) > m_pic_data.LastX() ) ? ( m_pic_data.LastX() + 1 - m_xp ): m_xl;
+ m_yl = ( ( m_yp + m_yl - 1) > m_pic_data.LastY() ) ? ( m_pic_data.LastY() + 1 - m_yp ) : m_yl;
- m_xend = m_xp + m_xl;
- m_yend = m_yp + m_yl;
+ m_xend = m_xp+m_xl;
+ m_yend = m_yp+m_yl;
}
@@ -81,92 +81,92 @@ void BlockDiffParams::SetBlockLimits(const OLBParams& bparams ,
// Constructors ...
-BlockDiff::BlockDiff(const PicArray& ref, const PicArray& pic) :
- m_pic_data(pic),
- m_ref_data(ref)
+BlockDiff::BlockDiff(const PicArray& ref,const PicArray& pic) :
+ m_pic_data( pic ),
+ m_ref_data( ref )
{}
-PelBlockDiff::PelBlockDiff(const PicArray& ref , const PicArray& pic) :
- BlockDiff(ref , pic)
+PelBlockDiff::PelBlockDiff( const PicArray& ref , const PicArray& pic ) :
+ BlockDiff( ref , pic )
{}
-IntraBlockDiff::IntraBlockDiff(const PicArray& pic) :
- m_pic_data(pic)
+IntraBlockDiff::IntraBlockDiff( const PicArray& pic ) :
+ m_pic_data( pic )
{}
-BiBlockDiff::BiBlockDiff(const PicArray& ref1 , const PicArray& ref2 ,
- const PicArray& pic) :
- m_pic_data(pic),
- m_ref_data1(ref1),
- m_ref_data2(ref2)
+BiBlockDiff::BiBlockDiff( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic) :
+ m_pic_data( pic ),
+ m_ref_data1( ref1 ),
+ m_ref_data2( ref2 )
{}
-BlockDiffUp::BlockDiffUp(const PicArray& ref , const PicArray& pic):
- BlockDiff(ref , pic)
+BlockDiffUp::BlockDiffUp( const PicArray& ref , const PicArray& pic ):
+ BlockDiff( ref , pic )
{}
-BlockDiffHalfPel::BlockDiffHalfPel(const PicArray& ref , const PicArray& pic) :
- BlockDiffUp(ref , pic)
+BlockDiffHalfPel::BlockDiffHalfPel( const PicArray& ref , const PicArray& pic ) :
+ BlockDiffUp( ref , pic )
{}
-BlockDiffQuarterPel::BlockDiffQuarterPel(const PicArray& ref , const PicArray& pic) :
- BlockDiffUp(ref , pic)
+BlockDiffQuarterPel::BlockDiffQuarterPel( const PicArray& ref , const PicArray& pic ) :
+ BlockDiffUp( ref , pic )
{}
-BlockDiffEighthPel::BlockDiffEighthPel(const PicArray& ref , const PicArray& pic) :
- BlockDiffUp(ref , pic)
+BlockDiffEighthPel::BlockDiffEighthPel( const PicArray& ref , const PicArray& pic ) :
+ BlockDiffUp( ref , pic )
{}
-BiBlockHalfPel::BiBlockHalfPel(const PicArray& ref1 , const PicArray& ref2 ,
- const PicArray& pic):
- BiBlockDiff(ref1 , ref2 , pic)
+BiBlockHalfPel::BiBlockHalfPel( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic ):
+ BiBlockDiff( ref1 , ref2 , pic)
{}
-BiBlockQuarterPel::BiBlockQuarterPel(const PicArray& ref1 , const PicArray& ref2 ,
- const PicArray& pic):
- BiBlockDiff(ref1 , ref2 , pic)
+BiBlockQuarterPel::BiBlockQuarterPel( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic ):
+ BiBlockDiff( ref1 , ref2 , pic)
{}
-BiBlockEighthPel::BiBlockEighthPel(const PicArray& ref1 , const PicArray& ref2 ,
- const PicArray& pic):
- BiBlockDiff(ref1 , ref2 , pic)
+BiBlockEighthPel::BiBlockEighthPel( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic ):
+ BiBlockDiff( ref1 , ref2 , pic)
{}
// Difference functions ...
-float PelBlockDiff::Diff(const BlockDiffParams& dparams, const MVector& mv)
+float PelBlockDiff::Diff( const BlockDiffParams& dparams, const MVector& mv )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
return 0;
}
- CalcValueType sum(0);
+ CalcValueType sum( 0 );
- const ImageCoords ref_start(dparams.Xp() + mv.x , dparams.Yp() + mv.y);
- const ImageCoords ref_stop(dparams.Xend() + mv.x , dparams.Yend() + mv.y);
+ const ImageCoords ref_start( dparams.Xp()+mv.x , dparams.Yp()+mv.y );
+ const ImageCoords ref_stop( dparams.Xend()+mv.x , dparams.Yend()+mv.y );
+
+ bool bounds_check( false );
- bool bounds_check(false);
-
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined(HAVE_MMX)
return static_cast<float>(simple_block_diff_mmx_4(dparams, mv, m_pic_data, m_ref_data, INT_MAX));
#else
- ValueType diff;
- for(int j = dparams.Yp() ; j < dparams.Yp() + dparams.Yl() ; ++j)
- {
- for(int i = dparams.Xp() ; i < dparams.Xp() + dparams.Xl() ; ++i)
+ ValueType diff;
+ for ( int j=dparams.Yp() ; j<dparams.Yp()+dparams.Yl() ; ++j )
+ {
+ for(int i=dparams.Xp() ; i< dparams.Xp()+dparams.Xl() ; ++i )
{
- diff = m_pic_data[j][i] - m_ref_data[j+mv.y][i+mv.x];
- sum += std::abs(diff);
+ diff = m_pic_data[j][i]-m_ref_data[j+mv.y][i+mv.x];
+ sum += std::abs( diff );
}// i
}// j
#endif /* HAVE_MMX */
@@ -176,73 +176,73 @@ float PelBlockDiff::Diff(const BlockDiffParams& dparams, const MVector& mv)
#if defined (HAVE_MMX)
return static_cast<float>(bchk_simple_block_diff_mmx_4(dparams, mv, m_pic_data, m_ref_data, INT_MAX));
#else
- ValueType diff;
- for(int j = dparams.Yp() ; j < dparams.Yp() + dparams.Yl() ; ++j)
- {
- for(int i = dparams.Xp() ; i < dparams.Xp() + dparams.Xl() ; ++i)
+ ValueType diff;
+ for ( int j=dparams.Yp() ; j < dparams.Yp()+dparams.Yl() ; ++j )
+ {
+ for( int i=dparams.Xp() ; i < dparams.Xp()+dparams.Xl() ; ++i )
{
diff = m_pic_data[j][i] - m_ref_data[BChk(j+mv.y , m_ref_data.LengthY())][BChk(i+mv.x , m_ref_data.LengthX())];
- sum += std::abs(diff);
+ sum += std::abs( diff );
}// i
}// j
#endif /* HAVE_MMX */
}
-
- return static_cast<float>(sum);
+
+ return static_cast<float>( sum );
}
-void PelBlockDiff::Diff(const BlockDiffParams& dparams,
- const MVector& mv,
- float& best_sum,
- MVector& best_mv)
+void PelBlockDiff::Diff( const BlockDiffParams& dparams,
+ const MVector& mv,
+ float& best_sum,
+ MVector& best_mv )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
return;
}
- CalcValueType sum(0);
+ CalcValueType sum( 0 );
- const ImageCoords ref_start(dparams.Xp() + mv.x , dparams.Yp() + mv.y);
- const ImageCoords ref_stop(dparams.Xend() + mv.x , dparams.Yend() + mv.y);
+ const ImageCoords ref_start( dparams.Xp()+mv.x , dparams.Yp()+mv.y );
+ const ImageCoords ref_stop( dparams.Xend()+mv.x , dparams.Yend()+mv.y );
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
sum = simple_block_diff_mmx_4(dparams, mv, m_pic_data, m_ref_data, static_cast<int>(best_sum));
- if(sum < best_sum)
+ if (sum < best_sum)
{
- best_sum = sum;
- best_mv = mv;
+ best_sum = sum;
+ best_mv = mv;
}
- return;
+ return;
#else
- ValueType diff;
+ ValueType diff;
ValueType *pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // - go down a row and back along
-
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() ); // - go down a row and back along
+
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += pic_next)
+ for( int y=dparams.Yl(); y>0; --y, pic_curr+=pic_next, ref_curr+=pic_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ++ref_curr)
+ for( int x=dparams.Xl(); x>0; --x, ++pic_curr, ++ref_curr )
{
- diff = (*pic_curr) - (*ref_curr);
- sum += std::abs(diff);
+ diff = (*pic_curr)-(*ref_curr);
+ sum += std::abs( diff );
}// x
- if(sum >= best_sum)
+ if ( sum>=best_sum )
return;
}// y
@@ -251,25 +251,25 @@ void PelBlockDiff::Diff(const BlockDiffParams& dparams,
else
{
#if defined (HAVE_MMX)
- sum = (bchk_simple_block_diff_mmx_4(dparams, mv, m_pic_data, m_ref_data, static_cast<int>(best_sum)));
- if(sum < best_sum)
+ sum = (bchk_simple_block_diff_mmx_4(dparams, mv, m_pic_data, m_ref_data, static_cast<int>(best_sum)));
+ if (sum < best_sum)
{
best_sum = sum;
best_mv = mv;
}
return;
#else
- ValueType diff;
- for(int j = dparams.Yp() ; j < dparams.Yend() ; ++j)
- {
- for(int i = dparams.Xp() ; i < dparams.Xend() ; ++i)
+ ValueType diff;
+ for ( int j=dparams.Yp() ; j<dparams.Yend() ; ++j )
+ {
+ for( int i=dparams.Xp() ; i<dparams.Xend() ; ++i )
{
diff = m_pic_data[j][i] - m_ref_data[BChk(j+mv.y , m_ref_data.LengthY())][BChk(i+mv.x , m_ref_data.LengthX())];
- sum += std::abs(diff);
+ sum += std::abs( diff );
}// i
- if(sum >= best_sum)
+ if ( sum>=best_sum )
return;
}// j
@@ -278,31 +278,30 @@ void PelBlockDiff::Diff(const BlockDiffParams& dparams,
best_sum = sum;
best_mv = mv;
-
+
}
-ValueType IntraBlockDiff::CalcDC(const BlockDiffParams& dparams)
-{
+ValueType IntraBlockDiff::CalcDC( const BlockDiffParams& dparams ){
- CalcValueType int_dc(0);
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ CalcValueType int_dc( 0 );
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
return 0;
}
- for(int j = dparams.Yp() ; j < dparams.Yp() + dparams.Yl() ; ++j)
- for(int i = dparams.Xp(); i < dparams.Xp() + dparams.Xl() ; ++i)
- int_dc += static_cast<int>(m_pic_data[j][i]);
+ for ( int j=dparams.Yp() ; j<dparams.Yp()+dparams.Yl() ; ++j)
+ for(int i=dparams.Xp(); i<dparams.Xp()+dparams.Xl() ; ++i )
+ int_dc += static_cast<int>( m_pic_data[j][i] );
- int_dc /= (dparams.Xl() * dparams.Yl());
+ int_dc /= ( dparams.Xl() * dparams.Yl() );
- return static_cast<ValueType>(int_dc);
+ return static_cast<ValueType>( int_dc );
}
#ifdef INTRA_HAAR
-float IntraBlockDiff::Diff(const BlockDiffParams& dparams , ValueType& dc_val)
+float IntraBlockDiff::Diff( const BlockDiffParams& dparams , ValueType& dc_val )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
dc_val = 0;
return 0;
@@ -311,72 +310,70 @@ float IntraBlockDiff::Diff(const BlockDiffParams& dparams , ValueType& dc_val)
dc_val = CalcDC(dparams);
// Now compute the resulting SAD
- ValueType dc(dc_val);
- CalcValueType intra_cost(0);
-
- for(int j = dparams.Yp(); j < dparams.Yend() ; j += 2)
- {
- for(int i = dparams.Xp() ; i < dparams.Xend() ; i += 2)
- {
- intra_cost += std::abs(m_pic_data[j][i]
- + m_pic_data[j][i+1]
- + m_pic_data[j+1][i]
- + m_pic_data[j+1][i+1]
- - 4 * dc);
- intra_cost += std::abs(m_pic_data[j][i]
- + m_pic_data[j][i+1]
- - m_pic_data[j+1][i]
- - m_pic_data[j+1][i+1]);
- intra_cost += std::abs(m_pic_data[j][i]
- - m_pic_data[j][i+1]
- + m_pic_data[j+1][i]
- - m_pic_data[j+1][i+1]);
- intra_cost += std::abs(m_pic_data[j][i]
- - m_pic_data[j][i+1]
- - m_pic_data[j+1][i]
- + m_pic_data[j+1][i+1]);
+ ValueType dc( dc_val );
+ CalcValueType intra_cost( 0 );
+
+ for (int j=dparams.Yp(); j<dparams.Yend() ; j+=2){
+ for( int i=dparams.Xp() ; i<dparams.Xend() ;i+=2 ){
+ intra_cost += std::abs( m_pic_data[j][i]
+ + m_pic_data[j][i+1]
+ + m_pic_data[j+1][i]
+ + m_pic_data[j+1][i+1]
+ - 4*dc );
+ intra_cost += std::abs( m_pic_data[j][i]
+ + m_pic_data[j][i+1]
+ - m_pic_data[j+1][i]
+ - m_pic_data[j+1][i+1] );
+ intra_cost += std::abs( m_pic_data[j][i]
+ - m_pic_data[j][i+1]
+ + m_pic_data[j+1][i]
+ - m_pic_data[j+1][i+1] );
+ intra_cost += std::abs( m_pic_data[j][i]
+ - m_pic_data[j][i+1]
+ - m_pic_data[j+1][i]
+ + m_pic_data[j+1][i+1] );
}
}
-
- return static_cast<float>(intra_cost);
+
+ return static_cast<float>( intra_cost );
}
#else
-float IntraBlockDiff::Diff(const BlockDiffParams& dparams , ValueType& dc_val)
+float IntraBlockDiff::Diff( const BlockDiffParams& dparams , ValueType& dc_val )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
dc_val = 0;
return 0;
}
- //computes the cost if block is predicted by its dc component
+ //computes the cost if block is predicted by its dc component
#if defined(HAVE_MMX)
CalcValueType intra_cost =
- simple_intra_block_diff_mmx_4(dparams, m_pic_data, dc_val);
+ simple_intra_block_diff_mmx_4 (dparams, m_pic_data, dc_val);
#ifdef DIRAC_DEBUG
- CalcValueType int_dc(0);
+ CalcValueType int_dc( 0 );
ValueType non_mmx_dc(0);
- for(int j = dparams.Yp() ; j < dparams.Yp() + dparams.Yl() ; ++j)
- for(int i = dparams.Xp(); i < dparams.Xp() + dparams.Xl() ; ++i)
- int_dc += static_cast<int>(m_pic_data[j][i]);
+ for ( int j=dparams.Yp() ; j<dparams.Yp()+dparams.Yl() ; ++j)
+ for(int i=dparams.Xp(); i<dparams.Xp()+dparams.Xl() ; ++i )
+ int_dc += static_cast<int>( m_pic_data[j][i] );
- int_dc /= (dparams.Xl() * dparams.Yl());
+ int_dc /= ( dparams.Xl() * dparams.Yl() );
- non_mmx_dc = static_cast<ValueType>(int_dc);
+ non_mmx_dc = static_cast<ValueType>( int_dc );
// Now compute the resulting SAD
- ValueType dc(non_mmx_dc);
- CalcValueType non_mmx_intra_cost(0);
+ ValueType dc( non_mmx_dc );
+ CalcValueType non_mmx_intra_cost( 0 );
- for(int j = dparams.Yp(); j < dparams.Yend() ; ++j)
- for(int i = dparams.Xp() ; i < dparams.Xend() ; ++i)
- non_mmx_intra_cost += std::abs(m_pic_data[j][i] - dc);
+ for (int j=dparams.Yp(); j<dparams.Yend() ; ++j)
+ for( int i=dparams.Xp() ; i<dparams.Xend() ;++i )
+ non_mmx_intra_cost += std::abs( m_pic_data[j][i] - dc );
- if(non_mmx_dc != dc_val || non_mmx_intra_cost != intra_cost)
+ if (non_mmx_dc != dc_val || non_mmx_intra_cost != intra_cost)
{
std::cerr << "MMX vals: dc=" << dc_val;
std::cerr << " cost=" << intra_cost << std::endl;
@@ -385,76 +382,76 @@ float IntraBlockDiff::Diff(const BlockDiffParams& dparams , ValueType& dc_val)
std::cerr << " cost=" << non_mmx_intra_cost << std::endl;
}
#endif
- return static_cast<float>(intra_cost);
+ return static_cast<float>( intra_cost );
#else
-CalcValueType int_dc(0);
-
-for(int j = dparams.Yp() ; j < dparams.Yp() + dparams.Yl() ; ++j)
- for(int i = dparams.Xp(); i < dparams.Xp() + dparams.Xl() ; ++i)
- int_dc += static_cast<int>(m_pic_data[j][i]);
-
-int_dc /= (dparams.Xl() * dparams.Yl());
+ CalcValueType int_dc( 0 );
-dc_val = static_cast<ValueType>(int_dc);
+ for ( int j=dparams.Yp() ; j<dparams.Yp()+dparams.Yl() ; ++j)
+ for(int i=dparams.Xp(); i<dparams.Xp()+dparams.Xl() ; ++i )
+ int_dc += static_cast<int>( m_pic_data[j][i] );
-// Now compute the resulting SAD
-ValueType dc(dc_val);
-CalcValueType intra_cost(0);
+ int_dc /= ( dparams.Xl() * dparams.Yl() );
-for(int j = dparams.Yp(); j < dparams.Yend() ; ++j)
- for(int i = dparams.Xp() ; i < dparams.Xend() ; ++i)
- intra_cost += std::abs(m_pic_data[j][i] - dc);
+ dc_val = static_cast<ValueType>( int_dc );
-return static_cast<float>(intra_cost);
+ // Now compute the resulting SAD
+ ValueType dc( dc_val );
+ CalcValueType intra_cost( 0 );
+
+ for (int j=dparams.Yp(); j<dparams.Yend() ; ++j)
+ for( int i=dparams.Xp() ; i<dparams.Xend() ;++i )
+ intra_cost += std::abs( m_pic_data[j][i] - dc );
+
+ return static_cast<float>( intra_cost );
#endif //HAVE_MMX
}
#endif
-float BlockDiffHalfPel::Diff(const BlockDiffParams& dparams ,
- const MVector& mv)
+float BlockDiffHalfPel::Diff( const BlockDiffParams& dparams ,
+ const MVector& mv )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
return 0;
}
- //Where to start in the upconverted image
- const ImageCoords ref_start((dparams.Xp() << 1) + mv.x , (dparams.Yp() << 1) + mv.y);
- const ImageCoords ref_stop(ref_start.x + (dparams.Xl() << 1) , ref_start.y + (dparams.Yl() << 1));
+ //Where to start in the upconverted image
+ const ImageCoords ref_start( ( dparams.Xp()<<1 ) + mv.x ,( dparams.Yp()<<1 ) + mv.y );
+ const ImageCoords ref_stop( ref_start.x+(dparams.Xl()<<1) , ref_start.y+(dparams.Yl()<<1));
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- float sum(0);
+ float sum( 0 );
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
- MVector rmdr(0, 0);
+ MVector rmdr(0,0);
const ImageCoords start_pos(dparams.Xp(), dparams.Yp());
const ImageCoords end_pos(dparams.Xp() + dparams.Xl(), dparams.Yp() + dparams.Yl());
- sum = simple_block_diff_up_mmx_4(m_pic_data, m_ref_data,
- start_pos, end_pos,
- ref_start, ref_stop,
- rmdr,
- sum,
- static_cast<float>(INT_MAX));
+ sum = simple_block_diff_up_mmx_4 (m_pic_data, m_ref_data,
+ start_pos, end_pos,
+ ref_start, ref_stop,
+ rmdr,
+ sum,
+ static_cast<float>(INT_MAX));
#else
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- sum += std::abs(*ref_curr - *pic_curr);
+ sum += std::abs( *ref_curr - *pic_curr );
}// x
}// y
#endif
@@ -464,17 +461,17 @@ float BlockDiffHalfPel::Diff(const BlockDiffParams& dparams ,
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
- for(int y = dparams.Yl(), ry = ref_start.y, by = BChk(ry, m_ref_data.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data.LengthY()))
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
+ for( int y=dparams.Yl(), ry=ref_start.y, by=BChk(ry,m_ref_data.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data.LengthY()))
{
- for(int x = dparams.Xl() , rx = ref_start.x , bx = BChk(rx, m_ref_data.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , bx = BChk(rx, m_ref_data.LengthX()))
- {
- sum += std::abs(m_ref_data[by][bx] - *pic_curr);
- }// x
+ for( int x=dparams.Xl() , rx=ref_start.x , bx=BChk(rx,m_ref_data.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , bx=BChk(rx,m_ref_data.LengthX()))
+ {
+ sum += std::abs( m_ref_data[by][bx] -*pic_curr);
+ }// x
}// y
}
@@ -483,63 +480,63 @@ float BlockDiffHalfPel::Diff(const BlockDiffParams& dparams ,
}
-void BlockDiffHalfPel::Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv)
+void BlockDiffHalfPel::Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return;
+ return;
}
//Where to start in the upconverted image
- const ImageCoords ref_start((dparams.Xp() << 1) + mv.x , (dparams.Yp() << 1) + mv.y);
- const ImageCoords ref_stop(ref_start.x + (dparams.Xl() << 1) , ref_start.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start( ( dparams.Xp()<<1 ) + mv.x ,( dparams.Yp()<<1 ) + mv.y );
+ const ImageCoords ref_stop( ref_start.x+(dparams.Xl()<<1) , ref_start.y+(dparams.Yl()<<1));
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- const float start_val(mvcost * lambda);
- float sum(start_val);
+ const float start_val( mvcost*lambda );
+ float sum( start_val );
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
-
+
const ImageCoords start_pos(dparams.Xp(), dparams.Yp());
const ImageCoords end_pos(dparams.Xp() + dparams.Xl(), dparams.Yp() + dparams.Yl());
- MVector rmdr(0, 0);
- sum = simple_block_diff_up_mmx_4(m_pic_data, m_ref_data,
- start_pos, end_pos,
- ref_start, ref_stop,
- rmdr,
- sum,
- best_costs.total);
- if(sum >= best_costs.total)
+ MVector rmdr(0,0);
+ sum = simple_block_diff_up_mmx_4 (m_pic_data, m_ref_data,
+ start_pos, end_pos,
+ ref_start, ref_stop,
+ rmdr,
+ sum,
+ best_costs.total);
+ if ( sum>=best_costs.total )
return;
#else
- ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- sum += std::abs(*ref_curr - *pic_curr);
+ sum += std::abs( *ref_curr - *pic_curr );
}// x
- if(sum >= best_costs.total)
+ if ( sum>=best_costs.total )
return;
}// y
@@ -548,20 +545,20 @@ void BlockDiffHalfPel::Diff(const BlockDiffParams& dparams,
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
- for(int y = dparams.Yl(), ry = ref_start.y, by = BChk(ry, m_ref_data.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data.LengthY()))
+ ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
+ for( int y=dparams.Yl(), ry=ref_start.y, by=BChk(ry,m_ref_data.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data.LengthY()))
{
- for(int x = dparams.Xl() , rx = ref_start.x , bx = BChk(rx, m_ref_data.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , bx = BChk(rx, m_ref_data.LengthX()))
- {
- sum += std::abs(m_ref_data[by][bx] - *pic_curr);
- }// x
-
- if(sum >= best_costs.total)
+ for( int x=dparams.Xl() , rx=ref_start.x , bx=BChk(rx,m_ref_data.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , bx=BChk(rx,m_ref_data.LengthX()))
+ {
+ sum += std::abs( m_ref_data[by][bx] -*pic_curr);
+ }// x
+
+ if ( sum>=best_costs.total )
return;
}// y
@@ -574,109 +571,109 @@ void BlockDiffHalfPel::Diff(const BlockDiffParams& dparams,
best_costs.SAD = sum - start_val;
}
-float BlockDiffQuarterPel::Diff(const BlockDiffParams& dparams , const MVector& mv)
+float BlockDiffQuarterPel::Diff( const BlockDiffParams& dparams , const MVector& mv )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return 0;
+ return 0;
}
- // Set up the start point in the reference image by rounding the motion vector
+ // Set up the start point in the reference image by rounding the motion vector
// to 1/2 pel accuracy.NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 1 , mv.y >> 1);
+ const MVector roundvec( mv.x>>1 , mv.y>>1 );
//Get the remainder after rounding. NB rmdr values always 0 or 1
- const MVector rmdr(mv.x & 1 , mv.y & 1);
+ const MVector rmdr( mv.x & 1 , mv.y & 1 );
//Where to start in the upconverted image
- const ImageCoords ref_start((dparams.Xp() << 1) + roundvec.x , (dparams.Yp() << 1) + roundvec.y);
- const ImageCoords ref_stop(ref_start.x + (dparams.Xl() << 1) , ref_start.y + (dparams.Yl() << 1));
- bool bounds_check(false);
-
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ const ImageCoords ref_start( ( dparams.Xp()<<1 ) + roundvec.x ,( dparams.Yp()<<1 ) + roundvec.y );
+ const ImageCoords ref_stop( ref_start.x+(dparams.Xl()<<1) , ref_start.y+(dparams.Yl()<<1));
+ bool bounds_check( false );
+
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- float sum(0.0f);
- CalcValueType temp;
+ float sum( 0.0f );
+ CalcValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
const ImageCoords start_pos(dparams.Xp(), dparams.Yp());
const ImageCoords end_pos(dparams.Xp() + dparams.Xl(), dparams.Yp() + dparams.Yl());
-
- sum = simple_block_diff_up_mmx_4(m_pic_data, m_ref_data,
- start_pos, end_pos,
- ref_start, ref_stop,
- rmdr,
- sum,
- static_cast<float>(INT_MAX));
+
+ sum = simple_block_diff_up_mmx_4 (m_pic_data, m_ref_data,
+ start_pos, end_pos,
+ ref_start, ref_stop,
+ rmdr,
+ sum,
+ static_cast<float>(INT_MAX));
#else
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
- if(rmdr.x == 0 && rmdr.y == 0)
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- sum += std::abs(*ref_curr - *pic_curr);
+ sum += std::abs( *ref_curr - *pic_curr );
}// x
}// y
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
- sum += std::abs(temp - *pic_curr);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( temp - *pic_curr );
}// x
}// y
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[m_ref_data.LengthX()]) +
- 1
- ) >> 1;
- sum += std::abs(temp - *pic_curr);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[m_ref_data.LengthX()] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( temp - *pic_curr );
}// x
}// y
}
else
{
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[m_ref_data.LengthX()+0]) +
- CalcValueType(ref_curr[m_ref_data.LengthX()+1]) +
- 2
- ) >> 2;
- sum += std::abs(temp - *pic_curr);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[m_ref_data.LengthX()+0] ) +
+ CalcValueType( ref_curr[m_ref_data.LengthX()+1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( temp - *pic_curr );
}// x
}// y
}
@@ -686,30 +683,29 @@ float BlockDiffQuarterPel::Diff(const BlockDiffParams& dparams , const MVector&
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- // weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) *(2 - rmdr.y), //tl
- rmdr.x *(2 - rmdr.y), //tr
+ // weights for doing linear interpolation, calculated from the remainder values
+ const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
+ rmdr.x * (2 - rmdr.y), //tr
(2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ rmdr.x * rmdr.y }; //br
- const int refXlen(m_ref_data.LengthX());
- const int refYlen(m_ref_data.LengthY());
+ const int refXlen( m_ref_data.LengthX() );
+ const int refYlen( m_ref_data.LengthY() );
- for(int y = dparams.Yp(), uY = ref_start.y, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen);
- y < dparams.Yend(); ++y, uY += 2, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen))
+ for(int y = dparams.Yp(), uY = ref_start.y,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen);
+ y < dparams.Yend(); ++y, uY += 2,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen))
{
- for(int x = dparams.Xp(), uX = ref_start.x, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen);
- x < dparams.Xend(); ++x, uX += 2, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen))
+ for(int x = dparams.Xp(), uX = ref_start.x,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen);
+ x < dparams.Xend(); ++x, uX += 2,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen))
{
-
- temp = (linear_wts[0] * CalcValueType(m_ref_data[BuY][BuX]) +
- linear_wts[1] * CalcValueType(m_ref_data[BuY][BuX1]) +
- linear_wts[2] * CalcValueType(m_ref_data[BuY1][BuX]) +
- linear_wts[3] * CalcValueType(m_ref_data[BuY1][BuX1]) +
- 2
- ) >> 2;
- sum += std::abs(temp - m_pic_data[y][x]);
+
+ temp = ( linear_wts[0] * CalcValueType( m_ref_data[BuY][BuX] ) +
+ linear_wts[1] * CalcValueType( m_ref_data[BuY][BuX1] ) +
+ linear_wts[2] * CalcValueType( m_ref_data[BuY1][BuX] )+
+ linear_wts[3] * CalcValueType( m_ref_data[BuY1][BuX1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( temp - m_pic_data[y][x] );
}// x
}// y
@@ -719,127 +715,127 @@ float BlockDiffQuarterPel::Diff(const BlockDiffParams& dparams , const MVector&
}
-void BlockDiffQuarterPel::Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv)
+void BlockDiffQuarterPel::Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv)
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return;
+ return;
}
// Set up the start point in the reference image by rounding the motion vector
// to 1/2 pel accuracy.NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 1 , mv.y >> 1);
+ const MVector roundvec( mv.x>>1 , mv.y>>1 );
//Get the remainder after rounding. NB rmdr values always 0 or 1
- const MVector rmdr(mv.x & 1 , mv.y & 1);
+ const MVector rmdr( mv.x & 1 , mv.y & 1 );
//Where to start in the upconverted image
- const ImageCoords ref_start((dparams.Xp() << 1) + roundvec.x , (dparams.Yp() << 1) + roundvec.y);
- const ImageCoords ref_stop(ref_start.x + (dparams.Xl() << 1) , ref_start.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start( ( dparams.Xp()<<1 ) + roundvec.x ,( dparams.Yp()<<1 ) + roundvec.y );
+ const ImageCoords ref_stop( ref_start.x+(dparams.Xl()<<1) , ref_start.y+(dparams.Yl()<<1));
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- const float start_val(mvcost * lambda);
- float sum(start_val);
+ const float start_val( mvcost*lambda );
+ float sum( start_val );
CalcValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
const ImageCoords start_pos(dparams.Xp(), dparams.Yp());
const ImageCoords end_pos(dparams.Xp() + dparams.Xl(), dparams.Yp() + dparams.Yl());
-
- sum = simple_block_diff_up_mmx_4(m_pic_data, m_ref_data,
- start_pos, end_pos,
- ref_start, ref_stop,
- rmdr,
- sum,
- best_costs.total);
-
- if(sum >= best_costs.total)
+
+ sum = simple_block_diff_up_mmx_4 (m_pic_data, m_ref_data,
+ start_pos, end_pos,
+ ref_start, ref_stop,
+ rmdr,
+ sum,
+ best_costs.total);
+
+ if ( sum>=best_costs.total )
return;
#else
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- if(rmdr.x == 0 && rmdr.y == 0)
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- sum += std::abs(*ref_curr - *pic_curr);
+ sum += std::abs( *ref_curr - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
- sum += std::abs(temp - *pic_curr);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( temp - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[m_ref_data.LengthX()]) +
- 1
- ) >> 1;
- sum += std::abs(temp - *pic_curr);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[m_ref_data.LengthX()] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( temp - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[m_ref_data.LengthX()+0]) +
- CalcValueType(ref_curr[m_ref_data.LengthX()+1]) +
- 2
- ) >> 2;
- sum += std::abs(temp - *pic_curr);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[m_ref_data.LengthX()+0] ) +
+ CalcValueType( ref_curr[m_ref_data.LengthX()+1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( temp - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
@@ -851,33 +847,32 @@ void BlockDiffQuarterPel::Diff(const BlockDiffParams& dparams,
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- // weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (2 - rmdr.x) *(2 - rmdr.y), //tl
- rmdr.x *(2 - rmdr.y), //tr
+ // weights for doing linear interpolation, calculated from the remainder values
+ const ValueType linear_wts[4] = { (2 - rmdr.x) * (2 - rmdr.y), //tl
+ rmdr.x * (2 - rmdr.y), //tr
(2 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ rmdr.x * rmdr.y }; //br
- const int refXlen(m_ref_data.LengthX());
- const int refYlen(m_ref_data.LengthY());
+ const int refXlen( m_ref_data.LengthX() );
+ const int refYlen( m_ref_data.LengthY() );
- for(int y = dparams.Yp(), uY = ref_start.y, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen);
- y < dparams.Yend(); ++y, uY += 2, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen))
+ for(int y = dparams.Yp(), uY = ref_start.y,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen);
+ y < dparams.Yend(); ++y, uY += 2,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen))
{
- for(int x = dparams.Xp(), uX = ref_start.x, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen);
- x < dparams.Xend(); ++x, uX += 2, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen))
+ for(int x = dparams.Xp(), uX = ref_start.x,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen);
+ x < dparams.Xend(); ++x, uX += 2,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen))
{
-
- temp = (linear_wts[0] * CalcValueType(m_ref_data[BuY][BuX]) +
- linear_wts[1] * CalcValueType(m_ref_data[BuY][BuX1]) +
- linear_wts[2] * CalcValueType(m_ref_data[BuY1][BuX]) +
- linear_wts[3] * CalcValueType(m_ref_data[BuY1][BuX1]) +
- 2
- ) >> 2;
- sum += std::abs(temp - m_pic_data[y][x]);
+
+ temp = ( linear_wts[0] * CalcValueType( m_ref_data[BuY][BuX] ) +
+ linear_wts[1] * CalcValueType( m_ref_data[BuY][BuX1] ) +
+ linear_wts[2] * CalcValueType( m_ref_data[BuY1][BuX] )+
+ linear_wts[3] * CalcValueType( m_ref_data[BuY1][BuX1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( temp - m_pic_data[y][x] );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
@@ -892,101 +887,100 @@ void BlockDiffQuarterPel::Diff(const BlockDiffParams& dparams,
best_costs.SAD = sum - start_val;
}
-float BlockDiffEighthPel::Diff(const BlockDiffParams& dparams , const MVector& mv)
+float BlockDiffEighthPel::Diff( const BlockDiffParams& dparams , const MVector& mv )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return 0;
+ return 0;
}
- //Set up the start point in the reference image by rounding the motion vector
+ //Set up the start point in the reference image by rounding the motion vector
//NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 2 , mv.y >> 2);
+ const MVector roundvec( mv.x>>2 , mv.y>>2 );
//Get the remainder after rounding. NB rmdr values always 0,1,2 or 3
- const MVector rmdr(mv.x & 3 , mv.y & 3);
+ const MVector rmdr( mv.x & 3 , mv.y & 3 );
//Where to start in the upconverted image
- const ImageCoords ref_start((dparams.Xp() << 1) + roundvec.x , (dparams.Yp() << 1) + roundvec.y);
- const ImageCoords ref_stop(ref_start.x + (dparams.Xl() << 1) , ref_start.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start( ( dparams.Xp()<<1 ) + roundvec.x ,( dparams.Yp()<<1 ) + roundvec.y );
+ const ImageCoords ref_stop( ref_start.x+(dparams.Xl()<<1) , ref_start.y+(dparams.Yl()<<1));
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (4 - rmdr.x) *(4 - rmdr.y), //tl
- rmdr.x *(4 - rmdr.y), //tr
+ const ValueType linear_wts[4] = { (4 - rmdr.x) * (4 - rmdr.y), //tl
+ rmdr.x * (4 - rmdr.y), //tr
(4 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ rmdr.x * rmdr.y }; //br
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- float sum(0.0f);
+ float sum( 0.0f );
CalcValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- if(rmdr.x == 0 && rmdr.y == 0)
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- sum += CalcValueType(std::abs(ref_curr[0] - *pic_curr));
+ sum += CalcValueType( std::abs( ref_curr[0] - *pic_curr ) );
}// x
}// y
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = ((linear_wts[0] * CalcValueType(ref_curr[0]) +
- linear_wts[1] * CalcValueType(ref_curr[1]) +
- 8
+ temp = (( linear_wts[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts[1] * CalcValueType( ref_curr[1] ) +
+ 8
) >> 4);
- sum += std::abs(temp - *pic_curr);
+ sum += std::abs( temp - *pic_curr );
}// x
}// y
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = ((linear_wts[0] * CalcValueType(ref_curr[0]) +
- linear_wts[2] * CalcValueType(ref_curr[m_ref_data.LengthX()+0]) +
- 8
- ) >> 4);
- sum += std::abs(temp - *pic_curr);
+ temp = (( linear_wts[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts[2] * CalcValueType( ref_curr[m_ref_data.LengthX()+0] ) +
+ 8
+ ) >> 4);
+ sum += std::abs( temp - *pic_curr );
}// x
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = ((linear_wts[0] * CalcValueType(ref_curr[0]) +
- linear_wts[1] * CalcValueType(ref_curr[1]) +
- linear_wts[2] * CalcValueType(ref_curr[m_ref_data.LengthX()+0]) +
- linear_wts[3] * CalcValueType(ref_curr[m_ref_data.LengthX()+1]) +
- 8
+ temp = (( linear_wts[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts[1] * CalcValueType( ref_curr[1] ) +
+ linear_wts[2] * CalcValueType( ref_curr[m_ref_data.LengthX()+0] ) +
+ linear_wts[3] * CalcValueType( ref_curr[m_ref_data.LengthX()+1] ) +
+ 8
) >> 4);
- sum += std::abs(temp - *pic_curr);
+ sum += std::abs( temp - *pic_curr );
}// x
}// y
}
@@ -994,23 +988,23 @@ float BlockDiffEighthPel::Diff(const BlockDiffParams& dparams , const MVector& m
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- const int refXlen(m_ref_data.LengthX());
- const int refYlen(m_ref_data.LengthY());
+ const int refXlen( m_ref_data.LengthX() );
+ const int refYlen( m_ref_data.LengthY() );
- for(int y = dparams.Yp(), uY = ref_start.y, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen);
- y < dparams.Yend(); ++y, uY += 2, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen))
+ for(int y = dparams.Yp(), uY = ref_start.y,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen);
+ y < dparams.Yend(); ++y, uY += 2,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen))
{
- for(int x = dparams.Xp(), uX = ref_start.x, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen);
- x < dparams.Xend(); ++x, uX += 2, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen))
+ for(int x = dparams.Xp(), uX = ref_start.x,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen);
+ x < dparams.Xend(); ++x, uX += 2,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen))
{
-
- temp = (linear_wts[0] * CalcValueType(m_ref_data[BuY][BuX]) +
- linear_wts[1] * CalcValueType(m_ref_data[BuY][BuX1]) +
- linear_wts[2] * CalcValueType(m_ref_data[BuY1][BuX]) +
- linear_wts[3] * CalcValueType(m_ref_data[BuY1][BuX1]) +
- 8
- ) >> 4;
- sum += std::abs(temp - m_pic_data[y][x]);
+
+ temp = ( linear_wts[0] * CalcValueType( m_ref_data[BuY][BuX] ) +
+ linear_wts[1] * CalcValueType( m_ref_data[BuY][BuX1] ) +
+ linear_wts[2] * CalcValueType( m_ref_data[BuY1][BuX] )+
+ linear_wts[3] * CalcValueType( m_ref_data[BuY1][BuX1] ) +
+ 8
+ ) >> 4;
+ sum += std::abs( temp - m_pic_data[y][x] );
}// x
}// y
@@ -1019,122 +1013,121 @@ float BlockDiffEighthPel::Diff(const BlockDiffParams& dparams , const MVector& m
return sum;
}
-void BlockDiffEighthPel::Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv)
+void BlockDiffEighthPel::Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv)
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return;
+ return;
}
//Set up the start point in the reference image by rounding the motion vector
//NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec(mv.x >> 2 , mv.y >> 2);
+ const MVector roundvec( mv.x>>2 , mv.y>>2 );
//Get the remainder after rounding. NB rmdr values always 0,1,2 or 3
- const MVector rmdr(mv.x & 3 , mv.y & 3);
+ const MVector rmdr( mv.x & 3 , mv.y & 3 );
//Where to start in the upconverted image
- const ImageCoords ref_start((dparams.Xp() << 1) + roundvec.x , (dparams.Yp() << 1) + roundvec.y);
- const ImageCoords ref_stop(ref_start.x + (dparams.Xl() << 1) , ref_start.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start( ( dparams.Xp()<<1 ) + roundvec.x ,( dparams.Yp()<<1 ) + roundvec.y );
+ const ImageCoords ref_stop( ref_start.x+(dparams.Xl()<<1) , ref_start.y+(dparams.Yl()<<1));
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts[4] = { (4 - rmdr.x) *(4 - rmdr.y), //tl
- rmdr.x *(4 - rmdr.y), //tr
+ const ValueType linear_wts[4] = { (4 - rmdr.x) * (4 - rmdr.y), //tl
+ rmdr.x * (4 - rmdr.y), //tr
(4 - rmdr.x) * rmdr.y, //bl
- rmdr.x * rmdr.y
- }; //br
+ rmdr.x * rmdr.y }; //br
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start.x < 0 ||
- ref_stop.x >= m_ref_data.LengthX() ||
- ref_start.y < 0 ||
- ref_stop.y >= m_ref_data.LengthY())
+ if ( ref_start.x<0 ||
+ ref_stop.x >= m_ref_data.LengthX() ||
+ ref_start.y<0 ||
+ ref_stop.y >= m_ref_data.LengthY() )
bounds_check = true;
- const float start_val(mvcost * lambda);
- float sum(start_val);
+ const float start_val( mvcost*lambda );
+ float sum( start_val );
CalcValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
ValueType *ref_curr = &m_ref_data[ref_start.y][ref_start.x];
- const int ref_next((m_ref_data.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- if(rmdr.x == 0 && rmdr.y == 0)
+ if( rmdr.x == 0 && rmdr.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- sum += CalcValueType(std::abs(ref_curr[0] - *pic_curr));
+ sum += CalcValueType( std::abs( ref_curr[0] - *pic_curr ) );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
}
- else if(rmdr.y == 0)
+ else if( rmdr.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = ((linear_wts[0] * CalcValueType(ref_curr[0]) +
- linear_wts[1] * CalcValueType(ref_curr[1]) +
- 8
+ temp = (( linear_wts[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts[1] * CalcValueType( ref_curr[1] ) +
+ 8
) >> 4);
- sum += std::abs(temp - *pic_curr);
+ sum += std::abs( temp - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
}
- else if(rmdr.x == 0)
+ else if( rmdr.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = ((linear_wts[0] * CalcValueType(ref_curr[0]) +
- linear_wts[2] * CalcValueType(ref_curr[m_ref_data.LengthX()+0]) +
- 8
- ) >> 4);
- sum += std::abs(temp - *pic_curr);
+ temp = (( linear_wts[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts[2] * CalcValueType( ref_curr[m_ref_data.LengthX()+0] ) +
+ 8
+ ) >> 4);
+ sum += std::abs( temp - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2 )
{
- temp = ((linear_wts[0] * CalcValueType(ref_curr[0]) +
- linear_wts[1] * CalcValueType(ref_curr[1]) +
- linear_wts[2] * CalcValueType(ref_curr[m_ref_data.LengthX()+0]) +
- linear_wts[3] * CalcValueType(ref_curr[m_ref_data.LengthX()+1]) +
- 8
+ temp = (( linear_wts[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts[1] * CalcValueType( ref_curr[1] ) +
+ linear_wts[2] * CalcValueType( ref_curr[m_ref_data.LengthX()+0] ) +
+ linear_wts[3] * CalcValueType( ref_curr[m_ref_data.LengthX()+1] ) +
+ 8
) >> 4);
- sum += std::abs(temp - *pic_curr);
+ sum += std::abs( temp - *pic_curr );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
@@ -1143,26 +1136,26 @@ void BlockDiffEighthPel::Diff(const BlockDiffParams& dparams,
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- const int refXlen(m_ref_data.LengthX());
- const int refYlen(m_ref_data.LengthY());
+ const int refXlen( m_ref_data.LengthX() );
+ const int refYlen( m_ref_data.LengthY() );
- for(int y = dparams.Yp(), uY = ref_start.y, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen);
- y < dparams.Yend(); ++y, uY += 2, BuY = BChk(uY, refYlen), BuY1 = BChk(uY + 1, refYlen))
+ for(int y = dparams.Yp(), uY = ref_start.y,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen);
+ y < dparams.Yend(); ++y, uY += 2,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen))
{
- for(int x = dparams.Xp(), uX = ref_start.x, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen);
- x < dparams.Xend(); ++x, uX += 2, BuX = BChk(uX, refXlen), BuX1 = BChk(uX + 1, refXlen))
+ for(int x = dparams.Xp(), uX = ref_start.x,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen);
+ x < dparams.Xend(); ++x, uX += 2,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen))
{
-
- temp = (linear_wts[0] * CalcValueType(m_ref_data[BuY][BuX]) +
- linear_wts[1] * CalcValueType(m_ref_data[BuY][BuX1]) +
- linear_wts[2] * CalcValueType(m_ref_data[BuY1][BuX]) +
- linear_wts[3] * CalcValueType(m_ref_data[BuY1][BuX1]) +
- 8
- ) >> 4;
- sum += std::abs(temp - m_pic_data[y][x]);
+
+ temp = ( linear_wts[0] * CalcValueType( m_ref_data[BuY][BuX] ) +
+ linear_wts[1] * CalcValueType( m_ref_data[BuY][BuX1] ) +
+ linear_wts[2] * CalcValueType( m_ref_data[BuY1][BuX] )+
+ linear_wts[3] * CalcValueType( m_ref_data[BuY1][BuX1] ) +
+ 8
+ ) >> 4;
+ sum += std::abs( temp - m_pic_data[y][x] );
}// x
-
- if(sum >= best_costs.total)
+
+ if ( sum>=best_costs.total )
return;
}// y
@@ -1176,47 +1169,47 @@ void BlockDiffEighthPel::Diff(const BlockDiffParams& dparams,
best_costs.SAD = sum - start_val;
}
-float BiBlockHalfPel::Diff(const BlockDiffParams& dparams ,
- const MVector& mv1 ,
- const MVector& mv2)
+float BiBlockHalfPel::Diff( const BlockDiffParams& dparams ,
+ const MVector& mv1 ,
+ const MVector& mv2 )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return 0;
+ return 0;
}
// First create a difference array, and subtract the reference 1 data into it
- TwoDArray<ValueType> diff_array(dparams.Yl() , dparams.Xl());
+ TwoDArray<ValueType> diff_array( dparams.Yl() , dparams.Xl() );
//Where to start in the upconverted images
- const ImageCoords ref_start1((dparams.Xp() << 1) + mv1.x , (dparams.Yp() << 1) + mv1.y);
- const ImageCoords ref_stop1(ref_start1.x + (dparams.Xl() << 1) , ref_start1.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start1( ( dparams.Xp()<<1 ) + mv1.x ,( dparams.Yp()<<1 ) + mv1.y );
+ const ImageCoords ref_stop1( ref_start1.x+(dparams.Xl()<<1) , ref_start1.y+(dparams.Yl()<<1));
- const ImageCoords ref_start2((dparams.Xp() << 1) + mv2.x , (dparams.Yp() << 1) + mv2.y);
- const ImageCoords ref_stop2(ref_start2.x + (dparams.Xl() << 1) , ref_start2.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start2( ( dparams.Xp()<<1 ) + mv2.x ,( dparams.Yp()<<1 ) + mv2.y );
+ const ImageCoords ref_stop2( ref_start2.x+(dparams.Xl()<<1) , ref_start2.y+(dparams.Yl()<<1));
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
ValueType* diff_curr = &diff_array[0][0];
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start1.x < 0 ||
- ref_stop1.x >= m_ref_data1.LengthX() ||
- ref_start1.y < 0 ||
- ref_stop1.y >= m_ref_data1.LengthY())
+ if ( ref_start1.x<0 ||
+ ref_stop1.x >= m_ref_data1.LengthX() ||
+ ref_start1.y<0 ||
+ ref_stop1.y >= m_ref_data1.LengthY() )
bounds_check = true;
- if(!bounds_check)
+ if ( !bounds_check )
{
ValueType *ref_curr = &m_ref_data1[ref_start1.y][ref_start1.x];
- const int ref_next((m_ref_data1.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data1.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next)
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- *diff_curr = ((*pic_curr) << 1) - *ref_curr;
+ *diff_curr = ( (*pic_curr)<<1 ) - *ref_curr;
}// x
}// y
@@ -1225,16 +1218,16 @@ float BiBlockHalfPel::Diff(const BlockDiffParams& dparams ,
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = dparams.Yl(), ry = ref_start1.y, by = BChk(ry, m_ref_data1.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data1.LengthY()))
+ for( int y=dparams.Yl(), ry=ref_start1.y, by=BChk(ry,m_ref_data1.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data1.LengthY()))
{
- for(int x = dparams.Xl() , rx = ref_start1.x , bx = BChk(rx, m_ref_data1.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , ++diff_curr, bx = BChk(rx, m_ref_data1.LengthX()))
- {
- *diff_curr = ((*pic_curr) << 1) - m_ref_data1[by][bx];
- }// x
+ for( int x=dparams.Xl() , rx=ref_start1.x , bx=BChk(rx,m_ref_data1.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , ++diff_curr, bx=BChk(rx,m_ref_data1.LengthX()))
+ {
+ *diff_curr = ( (*pic_curr)<<1 ) - m_ref_data1[by][bx];
+ }// x
}// y
}
@@ -1243,28 +1236,28 @@ float BiBlockHalfPel::Diff(const BlockDiffParams& dparams ,
bounds_check = false;
- if(ref_start2.x < 0 ||
- ref_stop2.x >= m_ref_data2.LengthX() ||
- ref_start2.y < 0 ||
- ref_stop2.y >= m_ref_data2.LengthY())
+ if ( ref_start2.x<0 ||
+ ref_stop2.x >= m_ref_data2.LengthX() ||
+ ref_start2.y<0 ||
+ ref_stop2.y >= m_ref_data2.LengthY() )
bounds_check = true;
- float sum(0);
+ float sum( 0 );
diff_curr = &diff_array[0][0];
ValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
ValueType *ref_curr = &m_ref_data2[ref_start2.y][ref_start2.x];
- const int ref_next((m_ref_data2.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data2.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next)
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (*diff_curr - *ref_curr) >> 1;
- sum += std::abs(temp);
+ temp = (*diff_curr - *ref_curr )>>1;
+ sum += std::abs( temp );
}// x
}// y
@@ -1273,17 +1266,17 @@ float BiBlockHalfPel::Diff(const BlockDiffParams& dparams ,
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = dparams.Yl(), ry = ref_start2.y, by = BChk(ry, m_ref_data2.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data2.LengthY()))
+ for( int y=dparams.Yl(), ry=ref_start2.y, by=BChk(ry,m_ref_data2.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data2.LengthY()))
{
- for(int x = dparams.Xl() , rx = ref_start2.x , bx = BChk(rx, m_ref_data2.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , ++diff_curr, bx = BChk(rx, m_ref_data2.LengthX()))
- {
- temp = (*diff_curr - m_ref_data2[by][bx]) >> 1;
- sum += std::abs(temp);
- }// x
+ for( int x=dparams.Xl() , rx=ref_start2.x , bx=BChk(rx,m_ref_data2.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , ++diff_curr, bx=BChk(rx,m_ref_data2.LengthX()))
+ {
+ temp = (*diff_curr - m_ref_data2[by][bx] )>>1;
+ sum += std::abs( temp );
+ }// x
}// y
}
@@ -1292,116 +1285,116 @@ float BiBlockHalfPel::Diff(const BlockDiffParams& dparams ,
}
-float BiBlockQuarterPel::Diff(const BlockDiffParams& dparams ,
- const MVector& mv1 ,
- const MVector& mv2)
+float BiBlockQuarterPel::Diff( const BlockDiffParams& dparams ,
+ const MVector& mv1 ,
+ const MVector& mv2 )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return 0;
+ return 0;
}
// First create a difference array, and subtract the reference 1 data into it
- TwoDArray<ValueType> diff_array(dparams.Yl() , dparams.Xl());
+ TwoDArray<ValueType> diff_array( dparams.Yl() , dparams.Xl() );
- // Set up the start point in the reference images by rounding the motion vectors
+ // Set up the start point in the reference images by rounding the motion vectors
// to 1/2 pel accuracy.NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec1(mv1.x >> 1 , mv1.y >> 1);
- const MVector roundvec2(mv2.x >> 1 , mv2.y >> 1);
+ const MVector roundvec1 ( mv1.x>>1 , mv1.y>>1 );
+ const MVector roundvec2 ( mv2.x>>1 , mv2.y>>1 );
- //Get the remainders after rounding. NB rmdr values always 0 or 1
- const MVector rmdr1(mv1.x & 1 , mv1.y & 1);
- const MVector rmdr2(mv2.x & 1 , mv2.y & 1);
+ //Get the remainders after rounding. NB rmdr values always 0 or 1
+ const MVector rmdr1( mv1.x & 1 , mv1.y & 1 );
+ const MVector rmdr2( mv2.x & 1 , mv2.y & 1 );
//Where to start in the upconverted images
- const ImageCoords ref_start1((dparams.Xp() << 1) + roundvec1.x , (dparams.Yp() << 1) + roundvec1.y);
- const ImageCoords ref_stop1(ref_start1.x + (dparams.Xl() << 1) , ref_start1.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start1( ( dparams.Xp()<<1 ) + roundvec1.x ,( dparams.Yp()<<1 ) + roundvec1.y );
+ const ImageCoords ref_stop1( ref_start1.x+(dparams.Xl()<<1) , ref_start1.y+(dparams.Yl()<<1));
- const ImageCoords ref_start2((dparams.Xp() << 1) + roundvec2.x , (dparams.Yp() << 1) + roundvec2.y);
- const ImageCoords ref_stop2(ref_start2.x + (dparams.Xl() << 1) , ref_start2.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start2( ( dparams.Xp()<<1 ) + roundvec2.x ,( dparams.Yp()<<1 ) + roundvec2.y );
+ const ImageCoords ref_stop2( ref_start2.x+(dparams.Xl()<<1) , ref_start2.y+(dparams.Yl()<<1));
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
ValueType* diff_curr = &diff_array[0][0];
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start1.x < 0 ||
- ref_stop1.x >= m_ref_data1.LengthX() ||
- ref_start1.y < 0 ||
- ref_stop1.y >= m_ref_data1.LengthY())
+ if ( ref_start1.x<0 ||
+ ref_stop1.x >= m_ref_data1.LengthX() ||
+ ref_start1.y<0 ||
+ ref_stop1.y >= m_ref_data1.LengthY() )
bounds_check = true;
ValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
const ImageCoords start_pos(dparams.Xp(), dparams.Yp());
const ImageCoords end_pos(dparams.Xp() + dparams.Xl(), dparams.Yp() + dparams.Yl());
-
- simple_biblock_diff_pic_mmx_4(m_pic_data, m_ref_data1, diff_array,
- start_pos, end_pos,
- ref_start1, ref_stop1,
- rmdr1);
+
+ simple_biblock_diff_pic_mmx_4 (m_pic_data, m_ref_data1, diff_array,
+ start_pos, end_pos,
+ ref_start1, ref_stop1,
+ rmdr1);
#else
ValueType *ref_curr = &m_ref_data1[ref_start1.y][ref_start1.x];
- const int ref_next((m_ref_data1.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data1.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- if(rmdr1.x == 0 && rmdr1.y == 0)
+ if( rmdr1.x == 0 && rmdr1.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- *diff_curr = ((*pic_curr) << 1) - *ref_curr;
+ *diff_curr = ( (*pic_curr)<<1 ) - *ref_curr;
}// x
}// y
}
- else if(rmdr1.y == 0)
+ else if( rmdr1.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
- *diff_curr = ((*pic_curr) << 1) - temp;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
}// x
}// y
}
- else if(rmdr1.x == 0)
+ else if( rmdr1.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[m_ref_data1.LengthX()]) +
- 1
- ) >> 1;
- *diff_curr = ((*pic_curr) << 1) - temp;
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[m_ref_data1.LengthX()] ) +
+ 1
+ ) >> 1;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
}// x
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[m_ref_data1.LengthX()+0]) +
- CalcValueType(ref_curr[m_ref_data1.LengthX()+1]) +
- 2
- ) >> 2;
- *diff_curr = ((*pic_curr) << 1) - temp;
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[m_ref_data1.LengthX()+0] ) +
+ CalcValueType( ref_curr[m_ref_data1.LengthX()+1] ) +
+ 2
+ ) >> 2;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
}// x
}// y
}
@@ -1410,29 +1403,28 @@ float BiBlockQuarterPel::Diff(const BlockDiffParams& dparams ,
}
else
{
- const ValueType linear_wts[4] = { (2 - rmdr1.x) *(2 - rmdr1.y), //tl
- rmdr1.x *(2 - rmdr1.y), //tr
+ const ValueType linear_wts[4] = { (2 - rmdr1.x) * (2 - rmdr1.y), //tl
+ rmdr1.x * (2 - rmdr1.y), //tr
(2 - rmdr1.x) * rmdr1.y, //bl
- rmdr1.x * rmdr1.y
- }; //br
+ rmdr1.x * rmdr1.y }; //br
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = dparams.Yl(), ry = ref_start1.y, by = BChk(ry, m_ref_data1.LengthY()), by1 = BChk(ry + 1, m_ref_data1.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data1.LengthY()), by1 = BChk(ry + 1, m_ref_data1.LengthY()))
+ for( int y=dparams.Yl(), ry=ref_start1.y, by=BChk(ry,m_ref_data1.LengthY()), by1=BChk(ry+1,m_ref_data1.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data1.LengthY()), by1=BChk(ry+1,m_ref_data1.LengthY()) )
{
- for(int x = dparams.Xl() , rx = ref_start1.x , bx = BChk(rx, m_ref_data1.LengthX()), bx1 = BChk(rx + 1, m_ref_data1.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , ++diff_curr, bx = BChk(rx, m_ref_data1.LengthX()), bx1 = BChk(rx + 1, m_ref_data1.LengthX()))
- {
- temp = (linear_wts[0] * CalcValueType(m_ref_data1[by][bx]) +
- linear_wts[1] * CalcValueType(m_ref_data1[by][bx1]) +
- linear_wts[2] * CalcValueType(m_ref_data1[by1][bx]) +
- linear_wts[3] * CalcValueType(m_ref_data1[by1][bx1]) +
- 2
- ) >> 2;
- *diff_curr = ((*pic_curr) << 1) - temp;
- }// x
+ for( int x=dparams.Xl() , rx=ref_start1.x , bx=BChk(rx,m_ref_data1.LengthX()), bx1=BChk(rx+1,m_ref_data1.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , ++diff_curr, bx=BChk(rx,m_ref_data1.LengthX()), bx1=BChk(rx+1,m_ref_data1.LengthX()))
+ {
+ temp = ( linear_wts[0] * CalcValueType( m_ref_data1[by][bx] ) +
+ linear_wts[1] * CalcValueType( m_ref_data1[by][bx1] ) +
+ linear_wts[2] * CalcValueType( m_ref_data1[by1][bx] )+
+ linear_wts[3] * CalcValueType( m_ref_data1[by1][bx1] ) +
+ 2
+ ) >> 2;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
+ }// x
}// y
}
@@ -1440,80 +1432,80 @@ float BiBlockQuarterPel::Diff(const BlockDiffParams& dparams ,
bounds_check = false;
- if(ref_start2.x < 0 ||
- ref_stop2.x >= m_ref_data2.LengthX() ||
- ref_start2.y < 0 ||
- ref_stop2.y >= m_ref_data2.LengthY())
+ if ( ref_start2.x<0 ||
+ ref_stop2.x >= m_ref_data2.LengthX() ||
+ ref_start2.y<0 ||
+ ref_stop2.y >= m_ref_data2.LengthY() )
bounds_check = true;
- float sum(0);
+ float sum( 0 );
diff_curr = &diff_array[0][0];
- if(!bounds_check)
+ if ( !bounds_check )
{
#if defined (HAVE_MMX)
- sum = static_cast<float>(simple_biblock_diff_up_mmx_4(diff_array,
- m_ref_data2,
- ref_start2, ref_stop2,
- rmdr2));
+ sum = static_cast<float>( simple_biblock_diff_up_mmx_4 (diff_array,
+ m_ref_data2,
+ ref_start2, ref_stop2,
+ rmdr2) );
#else
ValueType *ref_curr = &m_ref_data2[ref_start2.y][ref_start2.x];
- const int ref_next((m_ref_data2.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
- if(rmdr2.x == 0 && rmdr2.y == 0)
+ const int ref_next( (m_ref_data2.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
+ if( rmdr2.x == 0 && rmdr2.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- sum += std::abs((*diff_curr - *ref_curr) >> 1);
+ sum += std::abs( (*diff_curr - *ref_curr)>>1 );
}// x
}// y
}
- else if(rmdr2.y == 0)
+ else if( rmdr2.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
- sum += std::abs((*diff_curr - temp) >> 1);
+ sum += std::abs( (*diff_curr - temp)>>1 );
}// x
}// y
}
- else if(rmdr2.x == 0)
+ else if( rmdr2.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[m_ref_data2.LengthX()]) +
- 1
- ) >> 1;
- sum += std::abs((*diff_curr - temp) >> 1);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[m_ref_data2.LengthX()] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( (*diff_curr - temp)>>1 );
}// x
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[m_ref_data2.LengthX()+0]) +
- CalcValueType(ref_curr[m_ref_data2.LengthX()+1]) +
- 2
- ) >> 2;
- sum += std::abs((*diff_curr - temp) >> 1);
+ temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[m_ref_data2.LengthX()+0] ) +
+ CalcValueType( ref_curr[m_ref_data2.LengthX()+1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( (*diff_curr - temp)>>1 );
}// x
}// y
}
@@ -1521,29 +1513,28 @@ float BiBlockQuarterPel::Diff(const BlockDiffParams& dparams ,
}
else
{
- const ValueType linear_wts[4] = { (2 - rmdr2.x) *(2 - rmdr2.y), //tl
- rmdr2.x *(2 - rmdr2.y), //tr
+ const ValueType linear_wts[4] = { (2 - rmdr2.x) * (2 - rmdr2.y), //tl
+ rmdr2.x * (2 - rmdr2.y), //tr
(2 - rmdr2.x) * rmdr2.y, //bl
- rmdr2.x * rmdr2.y
- }; //br
+ rmdr2.x * rmdr2.y }; //br
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = dparams.Yl(), ry = ref_start2.y, by = BChk(ry, m_ref_data2.LengthY()), by1 = BChk(ry + 1, m_ref_data2.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data2.LengthY()), by1 = BChk(ry + 1, m_ref_data2.LengthY()))
+ for( int y=dparams.Yl(), ry=ref_start2.y, by=BChk(ry,m_ref_data2.LengthY()),by1=BChk(ry+1,m_ref_data2.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data2.LengthY()),by1=BChk(ry+1,m_ref_data2.LengthY()))
{
- for(int x = dparams.Xl() , rx = ref_start2.x , bx = BChk(rx, m_ref_data2.LengthX()), bx1 = BChk(rx + 1, m_ref_data2.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , ++diff_curr, bx = BChk(rx, m_ref_data2.LengthX()), bx1 = BChk(rx + 1, m_ref_data2.LengthX()))
- {
- temp = (linear_wts[0] * CalcValueType(m_ref_data2[by][bx]) +
- linear_wts[1] * CalcValueType(m_ref_data2[by][bx1]) +
- linear_wts[2] * CalcValueType(m_ref_data2[by1][bx]) +
- linear_wts[3] * CalcValueType(m_ref_data2[by1][bx1]) +
- 2
- ) >> 2;
- sum += std::abs((*diff_curr - temp) >> 1);
- }// x
+ for( int x=dparams.Xl() , rx=ref_start2.x , bx=BChk(rx,m_ref_data2.LengthX()), bx1=BChk(rx+1,m_ref_data2.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , ++diff_curr, bx=BChk(rx,m_ref_data2.LengthX()), bx1=BChk(rx+1,m_ref_data2.LengthX()))
+ {
+ temp = ( linear_wts[0] * CalcValueType( m_ref_data2[by][bx] ) +
+ linear_wts[1] * CalcValueType( m_ref_data2[by][bx1] ) +
+ linear_wts[2] * CalcValueType( m_ref_data2[by1][bx] )+
+ linear_wts[3] * CalcValueType( m_ref_data2[by1][bx1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( (*diff_curr - temp)>>1 );
+ }// x
}// y
}
@@ -1551,119 +1542,117 @@ float BiBlockQuarterPel::Diff(const BlockDiffParams& dparams ,
}
-float BiBlockEighthPel::Diff(const BlockDiffParams& dparams ,
+float BiBlockEighthPel::Diff( const BlockDiffParams& dparams ,
const MVector& mv1 ,
- const MVector& mv2)
+ const MVector& mv2 )
{
- if(dparams.Xl() <= 0 || dparams.Yl() <= 0)
+ if (dparams.Xl() <= 0 || dparams.Yl() <= 0)
{
- return 0;
+ return 0;
}
// First create a difference array, and subtract the reference 1 data into it
- TwoDArray<ValueType> diff_array(dparams.Yl() , dparams.Xl());
+ TwoDArray<ValueType> diff_array( dparams.Yl() , dparams.Xl() );
- // Set up the start point in the reference images by rounding the motion vectors
+ // Set up the start point in the reference images by rounding the motion vectors
// to 1/2 pel accuracy.NB: bit shift rounds negative values DOWN, as required
- const MVector roundvec1(mv1.x >> 2 , mv1.y >> 2);
- const MVector roundvec2(mv2.x >> 2 , mv2.y >> 2);
+ const MVector roundvec1 ( mv1.x>>2 , mv1.y>>2 );
+ const MVector roundvec2 ( mv2.x>>2 , mv2.y>>2 );
- //Get the remainders after rounding. NB rmdr values always 0-3
- const MVector rmdr1(mv1.x & 3 , mv1.y & 3);
- const MVector rmdr2(mv2.x & 3 , mv2.y & 3);
+ //Get the remainders after rounding. NB rmdr values always 0-3
+ const MVector rmdr1( mv1.x & 3 , mv1.y & 3 );
+ const MVector rmdr2( mv2.x & 3 , mv2.y & 3 );
//weights for doing linear interpolation, calculated from the remainder values
- const ValueType linear_wts1[4] = { (4 - rmdr1.x) *(4 - rmdr1.y), //tl
- rmdr1.x *(4 - rmdr1.y), //tr
- (4 - rmdr1.x) * rmdr1.y, //bl
- rmdr1.x * rmdr1.y
- }; //br
- const ValueType linear_wts2[4] = { (4 - rmdr2.x) *(4 - rmdr2.y), //tl
- rmdr2.x *(4 - rmdr2.y), //tr
- (4 - rmdr2.x) * rmdr2.y, //bl
- rmdr2.x * rmdr2.y
- }; //br
+ const ValueType linear_wts1[4] = { (4 - rmdr1.x) * (4 - rmdr1.y), //tl
+ rmdr1.x * (4 - rmdr1.y), //tr
+ (4 - rmdr1.x) * rmdr1.y, //bl
+ rmdr1.x * rmdr1.y }; //br
+ const ValueType linear_wts2[4] = { (4 - rmdr2.x) * (4 - rmdr2.y), //tl
+ rmdr2.x * (4 - rmdr2.y), //tr
+ (4 - rmdr2.x) * rmdr2.y, //bl
+ rmdr2.x * rmdr2.y }; //br
//Where to start in the upconverted images
- const ImageCoords ref_start1((dparams.Xp() << 1) + roundvec1.x , (dparams.Yp() << 1) + roundvec1.y);
- const ImageCoords ref_stop1(ref_start1.x + (dparams.Xl() << 1) , ref_start1.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start1( ( dparams.Xp()<<1 ) + roundvec1.x ,( dparams.Yp()<<1 ) + roundvec1.y );
+ const ImageCoords ref_stop1( ref_start1.x+(dparams.Xl()<<1) , ref_start1.y+(dparams.Yl()<<1));
- const ImageCoords ref_start2((dparams.Xp() << 1) + roundvec2.x , (dparams.Yp() << 1) + roundvec2.y);
- const ImageCoords ref_stop2(ref_start2.x + (dparams.Xl() << 1) , ref_start2.y + (dparams.Yl() << 1));
+ const ImageCoords ref_start2( ( dparams.Xp()<<1 ) + roundvec2.x ,( dparams.Yp()<<1 ) + roundvec2.y );
+ const ImageCoords ref_stop2( ref_start2.x+(dparams.Xl()<<1) , ref_start2.y+(dparams.Yl()<<1));
ValueType* pic_curr = &m_pic_data[dparams.Yp()][dparams.Xp()];
- const int pic_next(m_pic_data.LengthX() - dparams.Xl()); // go down a row and back up
+ const int pic_next( m_pic_data.LengthX() - dparams.Xl() );// go down a row and back up
ValueType* diff_curr = &diff_array[0][0];
- bool bounds_check(false);
+ bool bounds_check( false );
- if(ref_start1.x < 0 ||
- ref_stop1.x >= m_ref_data1.LengthX() ||
- ref_start1.y < 0 ||
- ref_stop1.y >= m_ref_data1.LengthY())
+ if ( ref_start1.x<0 ||
+ ref_stop1.x >= m_ref_data1.LengthX() ||
+ ref_start1.y<0 ||
+ ref_stop1.y >= m_ref_data1.LengthY() )
bounds_check = true;
ValueType temp;
- if(!bounds_check)
+ if ( !bounds_check )
{
ValueType *ref_curr = &m_ref_data1[ref_start1.y][ref_start1.x];
- const int ref_next((m_ref_data1.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data1.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- if(rmdr1.x == 0 && rmdr1.y == 0)
+ if( rmdr1.x == 0 && rmdr1.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- *diff_curr = ((*pic_curr) << 1) - *ref_curr;
+ *diff_curr = ( (*pic_curr)<<1 ) - *ref_curr;
}// x
}// y
}
- else if(rmdr1.y == 0)
+ else if( rmdr1.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = ((linear_wts1[0] * CalcValueType(ref_curr[0]) +
- linear_wts1[1] * CalcValueType(ref_curr[1]) +
- 8
+ temp = (( linear_wts1[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts1[1] * CalcValueType( ref_curr[1] ) +
+ 8
) >> 4);
- *diff_curr = ((*pic_curr) << 1) - temp;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
}// x
}// y
}
- else if(rmdr1.x == 0)
+ else if( rmdr1.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = ((linear_wts1[0] * CalcValueType(ref_curr[0]) +
- linear_wts1[2] * CalcValueType(ref_curr[m_ref_data1.LengthX()+0]) +
- 8
- ) >> 4);
+ temp = (( linear_wts1[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts1[2] * CalcValueType( ref_curr[m_ref_data1.LengthX()+0] ) +
+ 8
+ ) >> 4);
- *diff_curr = ((*pic_curr) << 1) - temp;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
}// x
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = ((linear_wts1[0] * CalcValueType(ref_curr[0]) +
- linear_wts1[1] * CalcValueType(ref_curr[1]) +
- linear_wts1[2] * CalcValueType(ref_curr[m_ref_data1.LengthX()+0]) +
- linear_wts1[3] * CalcValueType(ref_curr[m_ref_data1.LengthX()+1]) +
- 8
+ temp = (( linear_wts1[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts1[1] * CalcValueType( ref_curr[1] ) +
+ linear_wts1[2] * CalcValueType( ref_curr[m_ref_data1.LengthX()+0] ) +
+ linear_wts1[3] * CalcValueType( ref_curr[m_ref_data1.LengthX()+1] ) +
+ 8
) >> 4);
- *diff_curr = ((*pic_curr) << 1) - temp;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
}// x
}// y
}
@@ -1673,22 +1662,22 @@ float BiBlockEighthPel::Diff(const BlockDiffParams& dparams ,
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = dparams.Yl(), ry = ref_start1.y, by = BChk(ry, m_ref_data1.LengthY()), by1 = BChk(ry + 1, m_ref_data1.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data1.LengthY()), by1 = BChk(ry + 1, m_ref_data1.LengthY()))
+ for( int y=dparams.Yl(), ry=ref_start1.y, by=BChk(ry,m_ref_data1.LengthY()), by1=BChk(ry+1,m_ref_data1.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data1.LengthY()), by1=BChk(ry+1,m_ref_data1.LengthY()) )
{
- for(int x = dparams.Xl() , rx = ref_start1.x , bx = BChk(rx, m_ref_data1.LengthX()), bx1 = BChk(rx + 1, m_ref_data1.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , ++diff_curr, bx = BChk(rx, m_ref_data1.LengthX()), bx1 = BChk(rx + 1, m_ref_data1.LengthX()))
- {
- temp = (linear_wts1[0] * CalcValueType(m_ref_data1[by][bx]) +
- linear_wts1[1] * CalcValueType(m_ref_data1[by][bx1]) +
- linear_wts1[2] * CalcValueType(m_ref_data1[by1][bx]) +
- linear_wts1[3] * CalcValueType(m_ref_data1[by1][bx1]) +
- 8
- ) >> 4;
- *diff_curr = ((*pic_curr) << 1) - temp;
- }// x
+ for( int x=dparams.Xl() , rx=ref_start1.x , bx=BChk(rx,m_ref_data1.LengthX()), bx1=BChk(rx+1,m_ref_data1.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , ++diff_curr, bx=BChk(rx,m_ref_data1.LengthX()), bx1=BChk(rx+1,m_ref_data1.LengthX()))
+ {
+ temp = ( linear_wts1[0] * CalcValueType( m_ref_data1[by][bx] ) +
+ linear_wts1[1] * CalcValueType( m_ref_data1[by][bx1] ) +
+ linear_wts1[2] * CalcValueType( m_ref_data1[by1][bx] )+
+ linear_wts1[3] * CalcValueType( m_ref_data1[by1][bx1] ) +
+ 8
+ ) >> 4;
+ *diff_curr = ( (*pic_curr)<<1 ) - temp;
+ }// x
}// y
}
@@ -1696,74 +1685,74 @@ float BiBlockEighthPel::Diff(const BlockDiffParams& dparams ,
bounds_check = false;
- if(ref_start2.x < 0 ||
- ref_stop2.x >= m_ref_data2.LengthX() ||
- ref_start2.y < 0 ||
- ref_stop2.y >= m_ref_data2.LengthY())
+ if ( ref_start2.x<0 ||
+ ref_stop2.x >= m_ref_data2.LengthX() ||
+ ref_start2.y<0 ||
+ ref_stop2.y >= m_ref_data2.LengthY() )
bounds_check = true;
- float sum(0);
+ float sum( 0 );
diff_curr = &diff_array[0][0];
- if(!bounds_check)
+ if ( !bounds_check )
{
ValueType *ref_curr = &m_ref_data2[ref_start2.y][ref_start2.x];
- const int ref_next((m_ref_data2.LengthX() - dparams.Xl()) * 2);// go down 2 rows and back up
+ const int ref_next( (m_ref_data2.LengthX() - dparams.Xl())*2 );// go down 2 rows and back up
- if(rmdr2.x == 0 && rmdr2.y == 0)
+ if( rmdr2.x == 0 && rmdr2.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- sum += std::abs((*diff_curr - *ref_curr) >> 1);
+ sum += std::abs( (*diff_curr - *ref_curr)>>1 );
}// x
}// y
}
- else if(rmdr2.y == 0)
+ else if( rmdr2.y == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = ((linear_wts2[0] * CalcValueType(ref_curr[0]) +
- linear_wts2[1] * CalcValueType(ref_curr[1]) +
- 8
+ temp = (( linear_wts2[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts2[1] * CalcValueType( ref_curr[1] ) +
+ 8
) >> 4);
- sum += std::abs((*diff_curr - temp) >> 1);
+ sum += std::abs( (*diff_curr - temp)>>1 );
}// x
}// y
}
- else if(rmdr2.x == 0)
+ else if( rmdr2.x == 0 )
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = ((linear_wts2[0] * CalcValueType(ref_curr[0]) +
- linear_wts2[2] * CalcValueType(ref_curr[m_ref_data2.LengthX()+0]) +
- 8
- ) >> 4);
+ temp = (( linear_wts2[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts2[2] * CalcValueType( ref_curr[m_ref_data2.LengthX()+0] ) +
+ 8
+ ) >> 4);
- sum += std::abs((*diff_curr - temp) >> 1);
+ sum += std::abs( (*diff_curr - temp)>>1 );
}// x
}// y
}
else
{
- for(int y = dparams.Yl(); y > 0; --y, pic_curr += pic_next, ref_curr += ref_next)
+ for( int y=dparams.Yl(); y > 0; --y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- for(int x = dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr += 2, ++diff_curr)
+ for( int x=dparams.Xl(); x > 0; --x, ++pic_curr, ref_curr+=2, ++diff_curr )
{
- temp = ((linear_wts2[0] * CalcValueType(ref_curr[0]) +
- linear_wts2[1] * CalcValueType(ref_curr[1]) +
- linear_wts2[2] * CalcValueType(ref_curr[m_ref_data2.LengthX()+0]) +
- linear_wts2[3] * CalcValueType(ref_curr[m_ref_data2.LengthX()+1]) +
- 8
+ temp = (( linear_wts2[0] * CalcValueType( ref_curr[0] ) +
+ linear_wts2[1] * CalcValueType( ref_curr[1] ) +
+ linear_wts2[2] * CalcValueType( ref_curr[m_ref_data2.LengthX()+0] ) +
+ linear_wts2[3] * CalcValueType( ref_curr[m_ref_data2.LengthX()+1] ) +
+ 8
) >> 4);
- sum += std::abs((*diff_curr - temp) >> 1);
+ sum += std::abs( (*diff_curr - temp)>>1 );
}// x
}// y
}
@@ -1772,22 +1761,22 @@ float BiBlockEighthPel::Diff(const BlockDiffParams& dparams ,
else
{
// We're doing bounds checking because we'll fall off the edge of the reference otherwise.
- for(int y = dparams.Yl(), ry = ref_start1.y, by = BChk(ry, m_ref_data2.LengthY()), by1 = BChk(ry + 1, m_ref_data2.LengthY());
- y > 0;
- --y, pic_curr += pic_next, ry += 2 , by = BChk(ry, m_ref_data2.LengthY()), by1 = BChk(ry + 1, m_ref_data2.LengthY()))
+ for( int y=dparams.Yl(), ry=ref_start1.y, by=BChk(ry,m_ref_data2.LengthY()),by1=BChk(ry+1,m_ref_data2.LengthY());
+ y>0;
+ --y, pic_curr+=pic_next, ry+=2 , by=BChk(ry,m_ref_data2.LengthY()),by1=BChk(ry+1,m_ref_data2.LengthY()))
{
- for(int x = dparams.Xl() , rx = ref_start1.x , bx = BChk(rx, m_ref_data2.LengthX()), bx1 = BChk(rx + 1, m_ref_data2.LengthX());
- x > 0 ;
- --x, ++pic_curr, rx += 2 , ++diff_curr, bx = BChk(rx, m_ref_data2.LengthX()), bx1 = BChk(rx + 1, m_ref_data2.LengthX()))
- {
- temp = (linear_wts2[0] * CalcValueType(m_ref_data2[by][bx]) +
- linear_wts2[1] * CalcValueType(m_ref_data2[by][bx1]) +
- linear_wts2[2] * CalcValueType(m_ref_data2[by1][bx]) +
- linear_wts2[3] * CalcValueType(m_ref_data2[by1][bx1]) +
- 8
- ) >> 4;
- sum += std::abs((*diff_curr - temp) >> 1);
- }// x
+ for( int x=dparams.Xl() , rx=ref_start1.x , bx=BChk(rx,m_ref_data2.LengthX()), bx1=BChk(rx+1,m_ref_data2.LengthX());
+ x>0 ;
+ --x, ++pic_curr, rx+=2 , ++diff_curr, bx=BChk(rx,m_ref_data2.LengthX()), bx1=BChk(rx+1,m_ref_data2.LengthX()))
+ {
+ temp = ( linear_wts2[0] * CalcValueType( m_ref_data2[by][bx] ) +
+ linear_wts2[1] * CalcValueType( m_ref_data2[by][bx1] ) +
+ linear_wts2[2] * CalcValueType( m_ref_data2[by1][bx] )+
+ linear_wts2[3] * CalcValueType( m_ref_data2[by1][bx1] ) +
+ 8
+ ) >> 4;
+ sum += std::abs( (*diff_curr - temp)>>1 );
+ }// x
}// y
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.h
index 17bdb9a6f..51c464b7b 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils.h
@@ -44,532 +44,514 @@
namespace dirac
{
-///////////////////////////////////
-//Utilities for motion estimation//
-//-------------------------------//
-///////////////////////////////////
+ ///////////////////////////////////
+ //Utilities for motion estimation//
+ //-------------------------------//
+ ///////////////////////////////////
-//! A class encapsulating parameters for calculating a block difference value (a single instance of matching)
-class BlockDiffParams
-{
+ //! A class encapsulating parameters for calculating a block difference value (a single instance of matching)
+ class BlockDiffParams
+ {
-public:
- //! Constructor
- BlockDiffParams() {}
+ public:
+ //! Constructor
+ BlockDiffParams(){}
- //! Constructor
- BlockDiffParams(const int x_p , const int y_p , const int x_l , const int y_l):
- m_xp(x_p),
- m_yp(y_p),
- m_xl(x_l),
- m_yl(y_l),
- m_xend(x_l + x_p),
- m_yend(y_l + y_p)
- {}
+ //! Constructor
+ BlockDiffParams( const int x_p , const int y_p , const int x_l , const int y_l):
+ m_xp(x_p),
+ m_yp(y_p),
+ m_xl(x_l),
+ m_yl(y_l),
+ m_xend(x_l+x_p),
+ m_yend(y_l+y_p)
+ {}
- ////////////////////////////////////////////////////////////////////
- //NB: Assume default copy constructor, assignment = and destructor//
- ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
- // Sets ...
+ // Sets ...
- //! Set the limits of the block to fit in a picture
+ //! Set the limits of the block to fit in a picture
+
+ void SetBlockLimits( const OLBParams& bparams ,
+ const PicArray& pic_data ,
+ const int xbpos , const int ybpos);
- void SetBlockLimits(const OLBParams& bparams ,
- const PicArray& pic_data ,
- const int xbpos , const int ybpos);
+ // ... and gets
- // ... and gets
+ //! Return the x-position of the top-left block corner
+ int Xp() const {return m_xp;}
- //! Return the x-position of the top-left block corner
- int Xp() const
- {
- return m_xp;
- }
+ //! Return the y-position of the top-left block corner
+ int Yp() const {return m_yp;}
- //! Return the y-position of the top-left block corner
- int Yp() const
- {
- return m_yp;
- }
+ //! Return the block width
+ int Xl() const {return m_xl;}
- //! Return the block width
- int Xl() const
- {
- return m_xl;
- }
+ //! Return the block height
+ int Yl() const {return m_yl;}
- //! Return the block height
- int Yl() const
- {
- return m_yl;
- }
+ //! Return the block horizontal endpoint
+ int Xend() const {return m_xend;}
- //! Return the block horizontal endpoint
- int Xend() const
- {
- return m_xend;
- }
+ //! Return the block vertical endpoint
+ int Yend() const {return m_yend;}
- //! Return the block vertical endpoint
- int Yend() const
- {
- return m_yend;
- }
-
-private:
-
- int m_xp;
- int m_yp;
- int m_xl;
- int m_yl;
- int m_xend;
- int m_yend;
-};
-
-//////////////////////////////////////////////////
-//----Different difference classes, so that-----//
-//bounds-checking need only be done as necessary//
-//////////////////////////////////////////////////
-
-//! An abstract class for doing block difference calculations
-class BlockDiff
-{
-public:
- //! Constructor, initialising the reference and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref the reference picture
- \param pic the picture being matched
- */
- BlockDiff(const PicArray& ref , const PicArray& pic);
-
- //! Destructor
- virtual ~BlockDiff() {}
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv the motion vector being used
- */
- virtual float Diff(const BlockDiffParams& dparams , const MVector& mv) = 0;
-
-protected:
-
- const PicArray& m_pic_data;
- const PicArray& m_ref_data;
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BlockDiff(const BlockDiff& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BlockDiff& operator=(const BlockDiff& rhs);
-};
-
-//! A class for doing block differences to pixel accuracy, inherited from BlockDiff
-class PelBlockDiff: public BlockDiff
-{
-public:
- //! Constructor, initialising the reference and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref the reference picture
- \param pic the picture being matched
- */
- PelBlockDiff(const PicArray& ref , const PicArray& pic);
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv the motion vector being used
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv);
-
- //! Do the difference, overwriting the best MV so far if appropriate
- /*!
- Do the difference, overwriting the best MV so far if appropriate,
- and bailing out if we do worse
- \param dparams block parameters
- \param mv the motion vector being used
- \param best_sum the best SAD value obtain yet
- \param best_mv the MV giving the best SAD value so far
- */
- void Diff(const BlockDiffParams& dparams ,
- const MVector& mv ,
- float& best_sum ,
- MVector& best_mv);
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- PelBlockDiff(const PelBlockDiff& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- PelBlockDiff& operator=(const PelBlockDiff& rhs);
-};
-
-
-//! A class for calculating the difference between a block and its DC value (average)
-class IntraBlockDiff
-{
-public:
- //! Constructor, initialising the picture data
- /*
- Constructor, initialising the picture data
- \param pic the picture being matched
- */
- IntraBlockDiff(const PicArray& pic);
-
- //! Do the difference, calculating the DC value and returning SAD
- /*!
- Do the difference, calculating the DC value and returning SAD
- \param dparams block parameters
- \param dc_val DC value
- */
- float Diff(const BlockDiffParams& dparams , ValueType& dc_val);
-
- //! Calculate a DC value
- ValueType CalcDC(const BlockDiffParams& dparams);
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- IntraBlockDiff(const IntraBlockDiff& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- IntraBlockDiff& operator=(const IntraBlockDiff& rhs);
-
- const PicArray& m_pic_data;
-};
-
-//! A virtual class for bi-directional differences
-class BiBlockDiff
-{
-public:
- //! Constructor, initialising the references and picture data
- /*
- Constructor, initialising the references and picture data
- \param ref1 the first reference picture
- \param ref2 the second reference picture
- \param pic the picture being matched
- */
- BiBlockDiff(const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
-
- //! Virtual destructor
- virtual ~BiBlockDiff() {}
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv1 the motion vector being used for reference 1
- \param mv2 the motion vector being used for reference 2
- */
- virtual float Diff(const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2) = 0;
-
-protected:
- const PicArray& m_pic_data;
- const PicArray& m_ref_data1;
- const PicArray& m_ref_data2;
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BiBlockDiff(const BiBlockDiff& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BiBlockDiff& operator=(const BiBlockDiff& rhs);
-};
-
-// Classes where the reference is upconverted //
-////////////////////////////////////////////////
-//! A virtual class for doing differences with sub-pixel vectors
-class BlockDiffUp: public BlockDiff
-{
+ private:
-public:
-
- //! Constructor, initialising the reference and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref the reference picture
- \param pic the picture being matched
- */
- BlockDiffUp(const PicArray& ref , const PicArray& pic);
-
- //! Destructor
- virtual ~BlockDiffUp() {}
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv the motion vector being used
- */
- virtual float Diff(const BlockDiffParams& dparams , const MVector& mv) = 0;
-
- //! Do the actual difference, overwriting the best MV so far if appropriate
- /*!
- Do the actual difference, overwriting the best MV so far if appropriate,
- and bailing out if we do worse
- \param dparams block parameters
- \param mv the motion vector being used
- \param mvcost the (prediction) cost of the motion vector mv
- \param lambda the weighting to be given to mvcost
- \param best_costs the best Lagrangian costs obtained yet
- \param best_mv the MV giving the best Lagrangian costs so far
- */
- virtual void Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv) = 0;
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BlockDiffUp(const BlockDiffUp& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BlockDiffUp& operator=(const BlockDiffUp& rhs);
-};
-
-//! A class for doing differences with half-pixel accurate vectors
-class BlockDiffHalfPel: public BlockDiffUp
-{
+ int m_xp;
+ int m_yp;
+ int m_xl;
+ int m_yl;
+ int m_xend;
+ int m_yend;
+ };
-public:
- //! Constructor, initialising the reference and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref the reference picture
- \param pic the picture being matched
- */
- BlockDiffHalfPel(const PicArray& ref , const PicArray& pic);
-
- //! Destructor
- ~BlockDiffHalfPel() {}
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv the motion vector being used
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv);
-
- //! Do the actual difference, overwriting the best MV so far if appropriate
- /*!
- Do the actual difference, overwriting the best MV so far if appropriate,
- and bailing out if we do worse
- \param dparams block parameters
- \param mv the motion vector being used
- \param mvcost the (prediction) cost of the motion vector mv
- \param lambda the weighting to be given to mvcost
- \param best_costs the best Lagrangian costs obtained yet
- \param best_mv the MV giving the best Lagrangian costs so far
- */
- void Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv);
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BlockDiffHalfPel(const BlockDiffHalfPel& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BlockDiffHalfPel& operator=(const BlockDiffHalfPel& rhs);
-
-};
-
-//! A class for doing differences with quarter-pixel accurate vectors
-class BlockDiffQuarterPel: public BlockDiffUp
-{
-public:
- //! Constructor, initialising the reference and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref the reference picture
- \param pic the picture being matched
- */
- BlockDiffQuarterPel(const PicArray& ref , const PicArray& pic);
-
- //! Destructor
- ~BlockDiffQuarterPel() {}
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv the motion vector being used
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv);
-
- //! Do the actual difference, overwriting the best MV so far if appropriate
- /*!
- Do the actual difference, overwriting the best MV so far if appropriate,
- and bailing out if we do worse
- \param dparams block parameters
- \param mv the motion vector being used
- \param mvcost the (prediction) cost of the motion vector mv
- \param lambda the weighting to be given to mvcost
- \param best_costs the best Lagrangian costs obtained yet
- \param best_mv the MV giving the best Lagrangian costs so far
- */
- void Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv);
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BlockDiffQuarterPel(const BlockDiffQuarterPel& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BlockDiffQuarterPel& operator=(const BlockDiffQuarterPel& rhs);
-};
-
-//! A class for doing differences with eighth-pixel accurate vectors
-class BlockDiffEighthPel: public BlockDiffUp
-{
-public:
- //! Constructor, initialising the reference and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref the reference picture
- \param pic the picture being matched
- */
- BlockDiffEighthPel(const PicArray& ref , const PicArray& pic);
-
- //! Destructor
- ~BlockDiffEighthPel() {}
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv the motion vector being used
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv);
-
- //! Do the actual difference, overwriting the best MV so far if appropriate
- /*!
- Do the actual difference, overwriting the best MV so far if appropriate,
- and bailing out if we do worse
- \param dparams block parameters
- \param mv the motion vector being used
- \param mvcost the (prediction) cost of the motion vector mv
- \param lambda the weighting to be given to mvcost
- \param best_costs the best Lagrangian costs obtained yet
- \param best_mv the MV giving the best Lagrangian costs so far
- */
- void Diff(const BlockDiffParams& dparams,
- const MVector& mv ,
- const float mvcost,
- const float lambda,
- MvCostData& best_costs ,
- MVector& best_mv);
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BlockDiffEighthPel(const BlockDiffEighthPel& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BlockDiffEighthPel& operator=(const BlockDiffEighthPel& rhs);
-};
-
-//! A class for computing a bidirection difference for half-pel vectors
-class BiBlockHalfPel: public BiBlockDiff
-{
-public:
- //! Constructor, initialising the references and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref1 the first reference picture
- \param ref2 the second reference picture
- \param pic the picture being matched
- */
- BiBlockHalfPel(const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv1 the motion vector being used for reference 1
- \param mv2 the motion vector being used for reference 2
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2);
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BiBlockHalfPel(const BiBlockHalfPel& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BiBlockHalfPel& operator=(const BiBlockHalfPel& rhs);
-};
-
-//! A class for computing a bidirection difference for quarter-pel vectors
-class BiBlockQuarterPel: public BiBlockDiff
-{
-public:
- //! Constructor, initialising the references and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref1 the first reference picture
- \param ref2 the second reference picture
- \param pic the picture being matched
- */
- BiBlockQuarterPel(const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv1 the motion vector being used for reference 1
- \param mv2 the motion vector being used for reference 2
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2);
-
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BiBlockQuarterPel(const BiBlockQuarterPel& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BiBlockQuarterPel& operator=(const BiBlockQuarterPel& rhs);
-};
-
-//! A class for computing a bidirection difference for eighth-pel vectors
-class BiBlockEighthPel: public BiBlockDiff
-{
-public:
- //! Constructor, initialising the references and picture data
- /*
- Constructor, initialising the reference and picture data
- \param ref1 the first reference picture
- \param ref2 the second reference picture
- \param pic the picture being matched
- */
- BiBlockEighthPel(const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
-
- //! Do the difference, returning SAD
- /*!
- Do the difference, returning SAD
- \param dparams block parameters
- \param mv1 the motion vector being used for reference 1
- \param mv2 the motion vector being used for reference 2
- */
- float Diff(const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2);
-private:
- //! Private, bodyless copy-constructor: class should not be copied
- BiBlockEighthPel(const BiBlockEighthPel& cpy);
-
- //! Private, bodyless assignment=: class should not be assigned
- BiBlockEighthPel& operator=(const BiBlockEighthPel& rhs);
-};
+ //////////////////////////////////////////////////
+ //----Different difference classes, so that-----//
+ //bounds-checking need only be done as necessary//
+ //////////////////////////////////////////////////
+
+ //! An abstract class for doing block difference calculations
+ class BlockDiff
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiff( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ virtual ~BlockDiff(){}
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv the motion vector being used
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv )=0;
+
+ protected:
+
+ const PicArray& m_pic_data;
+ const PicArray& m_ref_data;
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiff( const BlockDiff& cpy );
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiff& operator=( const BlockDiff& rhs );
+ };
+
+ //! A class for doing block differences to pixel accuracy, inherited from BlockDiff
+ class PelBlockDiff: public BlockDiff
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ PelBlockDiff( const PicArray& ref , const PicArray& pic );
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ //! Do the difference, overwriting the best MV so far if appropriate
+ /*!
+ Do the difference, overwriting the best MV so far if appropriate,
+ and bailing out if we do worse
+ \param dparams block parameters
+ \param mv the motion vector being used
+ \param best_sum the best SAD value obtain yet
+ \param best_mv the MV giving the best SAD value so far
+ */
+ void Diff( const BlockDiffParams& dparams ,
+ const MVector& mv ,
+ float& best_sum ,
+ MVector& best_mv );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ PelBlockDiff(const PelBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ PelBlockDiff& operator=(const PelBlockDiff& rhs);
+ };
+
+
+ //! A class for calculating the difference between a block and its DC value (average)
+ class IntraBlockDiff
+ {
+ public:
+ //! Constructor, initialising the picture data
+ /*
+ Constructor, initialising the picture data
+ \param pic the picture being matched
+ */
+ IntraBlockDiff( const PicArray& pic );
+
+ //! Do the difference, calculating the DC value and returning SAD
+ /*!
+ Do the difference, calculating the DC value and returning SAD
+ \param dparams block parameters
+ \param dc_val DC value
+ */
+ float Diff( const BlockDiffParams& dparams , ValueType& dc_val );
+
+ //! Calculate a DC value
+ ValueType CalcDC( const BlockDiffParams& dparams);
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ IntraBlockDiff(const IntraBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ IntraBlockDiff& operator=(const IntraBlockDiff& rhs);
+
+ const PicArray& m_pic_data;
+ };
+
+ //! A virtual class for bi-directional differences
+ class BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the references and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
+
+ //! Virtual destructor
+ virtual ~BiBlockDiff( ) {}
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 )=0;
+
+ protected:
+ const PicArray& m_pic_data;
+ const PicArray& m_ref_data1;
+ const PicArray& m_ref_data2;
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBlockDiff(const BiBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBlockDiff& operator=(const BiBlockDiff& rhs);
+ };
+
+ // Classes where the reference is upconverted //
+ ////////////////////////////////////////////////
+ //! A virtual class for doing differences with sub-pixel vectors
+ class BlockDiffUp: public BlockDiff
+ {
+
+ public:
+
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiffUp( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ virtual ~BlockDiffUp(){}
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv the motion vector being used
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv )=0;
+
+ //! Do the actual difference, overwriting the best MV so far if appropriate
+ /*!
+ Do the actual difference, overwriting the best MV so far if appropriate,
+ and bailing out if we do worse
+ \param dparams block parameters
+ \param mv the motion vector being used
+ \param mvcost the (prediction) cost of the motion vector mv
+ \param lambda the weighting to be given to mvcost
+ \param best_costs the best Lagrangian costs obtained yet
+ \param best_mv the MV giving the best Lagrangian costs so far
+ */
+ virtual void Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv)=0;
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiffUp(const BlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiffUp& operator=(const BlockDiffUp& rhs);
+ };
+
+ //! A class for doing differences with half-pixel accurate vectors
+ class BlockDiffHalfPel: public BlockDiffUp
+ {
+
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiffHalfPel( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ ~BlockDiffHalfPel(){}
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ //! Do the actual difference, overwriting the best MV so far if appropriate
+ /*!
+ Do the actual difference, overwriting the best MV so far if appropriate,
+ and bailing out if we do worse
+ \param dparams block parameters
+ \param mv the motion vector being used
+ \param mvcost the (prediction) cost of the motion vector mv
+ \param lambda the weighting to be given to mvcost
+ \param best_costs the best Lagrangian costs obtained yet
+ \param best_mv the MV giving the best Lagrangian costs so far
+ */
+ void Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv);
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiffHalfPel(const BlockDiffHalfPel& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiffHalfPel& operator=(const BlockDiffHalfPel& rhs);
+
+ };
+
+ //! A class for doing differences with quarter-pixel accurate vectors
+ class BlockDiffQuarterPel: public BlockDiffUp
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiffQuarterPel( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ ~BlockDiffQuarterPel(){}
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ //! Do the actual difference, overwriting the best MV so far if appropriate
+ /*!
+ Do the actual difference, overwriting the best MV so far if appropriate,
+ and bailing out if we do worse
+ \param dparams block parameters
+ \param mv the motion vector being used
+ \param mvcost the (prediction) cost of the motion vector mv
+ \param lambda the weighting to be given to mvcost
+ \param best_costs the best Lagrangian costs obtained yet
+ \param best_mv the MV giving the best Lagrangian costs so far
+ */
+ void Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv);
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiffQuarterPel(const BlockDiffQuarterPel& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiffQuarterPel& operator=(const BlockDiffQuarterPel& rhs);
+ };
+
+ //! A class for doing differences with eighth-pixel accurate vectors
+ class BlockDiffEighthPel: public BlockDiffUp
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiffEighthPel( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ ~BlockDiffEighthPel(){}
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ //! Do the actual difference, overwriting the best MV so far if appropriate
+ /*!
+ Do the actual difference, overwriting the best MV so far if appropriate,
+ and bailing out if we do worse
+ \param dparams block parameters
+ \param mv the motion vector being used
+ \param mvcost the (prediction) cost of the motion vector mv
+ \param lambda the weighting to be given to mvcost
+ \param best_costs the best Lagrangian costs obtained yet
+ \param best_mv the MV giving the best Lagrangian costs so far
+ */
+ void Diff( const BlockDiffParams& dparams,
+ const MVector& mv ,
+ const float mvcost,
+ const float lambda,
+ MvCostData& best_costs ,
+ MVector& best_mv);
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiffEighthPel(const BlockDiffEighthPel& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiffEighthPel& operator=(const BlockDiffEighthPel& rhs);
+ };
+
+ //! A class for computing a bidirection difference for half-pel vectors
+ class BiBlockHalfPel: public BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBlockHalfPel( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBlockHalfPel(const BiBlockHalfPel& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBlockHalfPel& operator=(const BiBlockHalfPel& rhs);
+ };
+
+ //! A class for computing a bidirection difference for quarter-pel vectors
+ class BiBlockQuarterPel: public BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBlockQuarterPel( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBlockQuarterPel(const BiBlockQuarterPel& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBlockQuarterPel& operator=(const BiBlockQuarterPel& rhs);
+ };
+
+ //! A class for computing a bidirection difference for eighth-pel vectors
+ class BiBlockEighthPel: public BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBlockEighthPel( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
+
+ //! Do the difference, returning SAD
+ /*!
+ Do the difference, returning SAD
+ \param dparams block parameters
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBlockEighthPel(const BiBlockEighthPel& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBlockEighthPel& operator=(const BiBlockEighthPel& rhs);
+ };
} // namespace dirac
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.cpp
index b3c1d1836..692b9c148 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.cpp
@@ -43,1093 +43,1092 @@ using namespace dirac;
namespace dirac
{
-typedef union
-{
- int i[2];
- short h[4];
- __m64 m;
-} u_mmx_val;
-
-CalcValueType simple_block_diff_mmx_4(
- const BlockDiffParams& dparams, const MVector& mv,
- const PicArray& pic_data, const PicArray& ref_data,
- CalcValueType i_best_sum)
-{
- u_mmx_val u_sum;
-
- u_sum.i[0] = u_sum.i[1] = 0;
-
- ValueType *src = &(pic_data[dparams.Yp()][dparams.Xp()]);
- ValueType *refd = &(ref_data[dparams.Yp()+mv.y][dparams.Xp()+mv.x]);
-
- int height = dparams.Yl();
- int width = dparams.Xl();
- int stopX = (width >> 2) << 2;
- int pic_next = (pic_data.LengthX() - width);
- int ref_next = (ref_data.LengthX() - width);
- CalcValueType mop_sum = 0;
- for(int j = 0; j < height; j++)
+ typedef union
{
- for(int i = 0; i < stopX; i += 4)
- {
- // pic - ref
- __m64 pic = _mm_sub_pi16(*(__m64 *)src, *(__m64 *)refd);
- // abs (pic - ref)
- __m64 ref = _mm_srai_pi16(pic, 15);
- pic = _mm_xor_si64(pic, ref);
- pic = _mm_sub_pi16(pic, ref);
- // sum += abs(pic -ref)
- ref = _mm_xor_si64(ref, ref);
- ref = _mm_unpackhi_pi16(pic, ref);
- pic = _mm_unpacklo_pi16(pic, pic);
- pic = _mm_srai_pi32(pic, 16);
- pic = _mm_add_pi32(pic, ref);
- u_sum.m = _mm_add_pi32(u_sum.m, pic);
- src += 4;
- refd += 4;
- }
- for(int i = stopX; i < width; i++)
- {
- mop_sum += std::abs(*src - *refd);
- src++;
- refd++;
- }
- if((u_sum.i[0] + u_sum.i[1] + mop_sum) >= i_best_sum)
- {
- _mm_empty();
- return i_best_sum;
- }
- src += pic_next;
- refd += ref_next;
- }
- _mm_empty();
-
- return u_sum.i[0] + u_sum.i[1] + mop_sum;
-}
-
-
-CalcValueType simple_intra_block_diff_mmx_4(
- const BlockDiffParams& dparams,
- const PicArray& pic_data, ValueType &dc_val)
-{
- __m64 tmp = _mm_set_pi16(0, 0, 0, 0);
- u_mmx_val u_sum;
- u_sum.i[0] = u_sum.i[1] = 0;
-
- ValueType *src = &(pic_data[dparams.Yp()][dparams.Xp()]);
-
- int height = dparams.Yl();
- int width = dparams.Xl();
- int stopX = (width >> 2) << 2;
- int pic_next = (pic_data.LengthX() - width);
- CalcValueType mop_sum = 0;
- for(int j = 0; j < height; j++)
+ int i[2];
+ short h[4];
+ __m64 m;
+ } u_mmx_val;
+
+ CalcValueType simple_block_diff_mmx_4 (
+ const BlockDiffParams& dparams, const MVector& mv,
+ const PicArray& pic_data, const PicArray& ref_data,
+ CalcValueType i_best_sum)
{
- for(int i = 0; i < stopX; i += 4)
- {
- __m64 pic = *(__m64 *)src;
- // sum += (pic)
- tmp = _mm_xor_si64(tmp, tmp);
- tmp = _mm_unpackhi_pi16(pic, tmp);
- tmp = _mm_slli_pi32(tmp, 16);
- tmp = _mm_srai_pi32(tmp, 16);
- pic = _mm_unpacklo_pi16(pic, pic);
- pic = _mm_srai_pi32(pic, 16);
- pic = _mm_add_pi32(pic, tmp);
- u_sum.m = _mm_add_pi32(u_sum.m, pic);
- src += 4;
- }
- // Mop up
- for(int i = stopX; i < width; ++i)
- {
- mop_sum += *src;
- src++;
- }
- src += pic_next;
- }
+ u_mmx_val u_sum;
- CalcValueType int_dc = (u_sum.i[0] + u_sum.i[1] + mop_sum) / (width * height);
+ u_sum.i[0] = u_sum.i[1] = 0;
- dc_val = static_cast<ValueType>(int_dc);
+ ValueType *src = &(pic_data[dparams.Yp()][dparams.Xp()]);
+ ValueType *refd = &(ref_data[dparams.Yp()+mv.y][dparams.Xp()+mv.x]);
- // Now compute the resulting SAD
- __m64 dc = _mm_set_pi16(dc_val, dc_val , dc_val , dc_val);
- u_sum.m = _mm_xor_si64(u_sum.m, u_sum.m); // initialise sum to 0
- mop_sum = 0;
-
- src = &(pic_data[dparams.Yp()][dparams.Xp()]);
- for(int j = 0; j < height; ++j)
- {
- for(int i = 0; i < stopX; i += 4)
+ int height = dparams.Yl();
+ int width = dparams.Xl();
+ int stopX = (width>>2)<<2;
+ int pic_next = (pic_data.LengthX() - width);
+ int ref_next = (ref_data.LengthX() - width);
+ CalcValueType mop_sum = 0;
+ for (int j = 0; j < height; j++)
{
- __m64 pic = *(__m64 *)src;
- // pic - dc
- pic = _mm_sub_pi16(pic, dc);
- // abs (pic - dc)
- tmp = _mm_srai_pi16(pic, 15);
- pic = _mm_xor_si64(pic, tmp);
- pic = _mm_sub_pi16(pic, tmp);
- // sum += abs(pic -dc)
- tmp = _mm_xor_si64(tmp, tmp);
- tmp = _mm_unpackhi_pi16(pic, tmp);
- pic = _mm_unpacklo_pi16(pic, pic);
- pic = _mm_srai_pi32(pic, 16);
- pic = _mm_add_pi32(pic, tmp);
- u_sum.m = _mm_add_pi32(u_sum.m, pic);
- src += 4;
- }
- // Mop up
- for(int i = stopX; i < width; ++i)
- {
- mop_sum += std::abs(*src - dc_val);
- src++;
- }
- src += pic_next;
- }
- CalcValueType intra_cost = u_sum.i[0] + u_sum.i[1] + mop_sum;
- _mm_empty();
-
- return intra_cost;
-
-}
-
-/*
-* NOTE: we are not doing any bounds checks here. This function must
-* be invoked only when the reference images start and stop fall
-* withing bounds
-*/
-float simple_block_diff_up_mmx_4(
- const PicArray& pic_data, const PicArray& ref_data,
- const ImageCoords& start_pos, const ImageCoords& end_pos,
- const ImageCoords& ref_start, const ImageCoords& ref_stop,
- const MVector& rmdr, float cost_so_far,
- float best_total_cost_so_far)
-{
- ValueType *pic_curr = &pic_data[start_pos.y][start_pos.x];
- ValueType *ref_curr = &ref_data[ref_start.y][ref_start.x];
-
- const int width = end_pos.x - start_pos.x;
- int height = end_pos.y - start_pos.y;
- const int ref_stride = ref_data.LengthX();
-
- // go down a row and back up
- const int pic_next = pic_data.LengthX() - width;
- // go down 2 rows and back up
- const int ref_next = ref_data.LengthX() * 2 - width * 2;
-
- REPORTM(ref_start.x >= 0 && ref_stop.x < ref_data.LengthX() &&
- ref_start.y >= 0 && ref_stop.y < ref_data.LengthY(),
- "Reference image coordinates within bounds");
-
- CalcValueType sum = 0;
- CalcValueType mop_sum(0);
- int stopX = (width >> 2) << 2;
- __m64 m_sum = _mm_set_pi16(0, 0, 0, 0);
- u_mmx_val u_sum;
- if(rmdr.x == 0 && rmdr.y == 0)
- {
- //std::cerr << "Inmmx routine rmdr.x = rmdr.y = 0" << std::endl;
-#if 1
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
- {
- m_sum = _mm_xor_si64(m_sum, m_sum);
- mop_sum = 0;
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, ref_curr += 8)
+ for (int i = 0; i < stopX; i+=4)
{
- __m64 pic = *(__m64 *)pic_curr;
- __m64 ref = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 ref2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- ref = _mm_unpacklo_pi16(ref, ref2);
- // ref - pic
- pic = _mm_sub_pi16(pic, ref);
- // abs (ref - pic)
- ref = _mm_srai_pi16(pic, 15);
+ // pic - ref
+ __m64 pic = _mm_sub_pi16 (*(__m64 *)src, *(__m64 *)refd);
+ // abs (pic - ref)
+ __m64 ref = _mm_srai_pi16(pic, 15);
pic = _mm_xor_si64(pic, ref);
- pic = _mm_sub_pi16(pic, ref);
- // sum += abs(ref -pic)
- /**
- * Since we are re-initialising m_sum with every loop
- * maybe we don't need the following since overflow may
- * not occur
+ pic = _mm_sub_pi16 (pic, ref);
+ // sum += abs(pic -ref)
ref = _mm_xor_si64(ref, ref);
ref = _mm_unpackhi_pi16(pic, ref);
pic = _mm_unpacklo_pi16(pic, pic);
pic = _mm_srai_pi32 (pic, 16);
pic = _mm_add_pi32 (pic, ref);
- m_sum = _mm_add_pi32 (m_sum, pic);
- **/
- m_sum = _mm_add_pi16(m_sum, pic);
+ u_sum.m = _mm_add_pi32 (u_sum.m, pic);
+ src += 4;
+ refd += 4;
}
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ref_curr += 2)
+ for (int i = stopX; i < width; i++)
{
- mop_sum += std::abs(*ref_curr - *pic_curr);
+ mop_sum += std::abs(*src - *refd);
+ src++;
+ refd++;
}
- u_sum.m = m_sum;
- //sum += (u_sum.i[0] + u_sum.i[1] + mop_sum);
- sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
- _mm_empty();
- if((sum + cost_so_far) >= best_total_cost_so_far)
+ if ((u_sum.i[0] + u_sum.i[1] + mop_sum) >= i_best_sum)
{
- return best_total_cost_so_far;
+ _mm_empty();
+ return i_best_sum;
}
+ src += pic_next;
+ refd += ref_next;
}
_mm_empty();
- return sum + cost_so_far;
-#else
- float sum = cost_so_far;
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ref_curr += 2)
- {
- sum += std::abs(*ref_curr - *pic_curr);
- }// x
- if(sum >= best_total_cost_so_far)
- return best_total_cost_so_far;
+ return u_sum.i[0] + u_sum.i[1] + mop_sum;
+ }
- }// y
- return sum;
-#endif
- }
- else if(rmdr.y == 0)
+ CalcValueType simple_intra_block_diff_mmx_4 (
+ const BlockDiffParams& dparams,
+ const PicArray& pic_data, ValueType &dc_val)
{
-#if 1
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
+ __m64 tmp = _mm_set_pi16(0, 0, 0, 0);
+ u_mmx_val u_sum;
+ u_sum.i[0] = u_sum.i[1] = 0;
+
+ ValueType *src = &(pic_data[dparams.Yp()][dparams.Xp()]);
+
+ int height = dparams.Yl();
+ int width = dparams.Xl();
+ int stopX = (width>>2)<<2;
+ int pic_next = (pic_data.LengthX() - width);
+ CalcValueType mop_sum = 0;
+ for (int j = 0; j < height; j++)
{
- m_sum = _mm_xor_si64(m_sum, m_sum);
- mop_sum = 0;
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, ref_curr += 8)
+ for (int i = 0; i < stopX; i+=4)
{
- // Load ref
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- // m3 = words 0 2 4 6 of ref_curr
- __m64 m3 = _mm_unpacklo_pi16(m1, m2);
- // m2 = words 1 3 5 7 of ref_curr
- m2 = _mm_unpackhi_pi16(m1, m2);
- // (ref_curr[0] + ref_curr[1] + 1)>>1
- m3 = _mm_add_pi16(m3, m2);
- m3 = _mm_add_pi16(m3, m_one);
- m3 = _mm_srai_pi16(m3, 1);
- // ref - pic
- m1 = _mm_sub_pi16(*(__m64 *)pic_curr, m3);
- // abs (ref - pic)
- m3 = _mm_srai_pi16(m1, 15);
- m1 = _mm_xor_si64(m1, m3);
- m1 = _mm_sub_pi16(m1, m3);
- // sum += abs(ref -pic)
- /**
- * Since we are re-initialising m_sum with every loop
- * maybe we don't need the following since overflow may
- * not occur
- ref = _mm_xor_si64(ref, ref);
- ref = _mm_unpackhi_pi16(pic, ref);
+ __m64 pic = *(__m64 *)src;
+ // sum += (pic)
+ tmp = _mm_xor_si64(tmp, tmp);
+ tmp = _mm_unpackhi_pi16(pic, tmp);
+ tmp = _mm_slli_pi32 (tmp, 16);
+ tmp = _mm_srai_pi32 (tmp, 16);
pic = _mm_unpacklo_pi16(pic, pic);
pic = _mm_srai_pi32 (pic, 16);
- pic = _mm_add_pi32 (pic, ref);
- m_sum = _mm_add_pi32 (m_sum, pic);
- **/
- m_sum = _mm_add_pi16(m_sum, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ref_curr += 2)
- {
- CalcValueType temp = (ref_curr[0] + ref_curr[1] + 1) >> 1;
- mop_sum += std::abs(temp - *pic_curr);
+ pic = _mm_add_pi32 (pic, tmp);
+ u_sum.m = _mm_add_pi32 (u_sum.m, pic);
+ src += 4;
}
- u_sum.m = m_sum;
- //sum += (u_sum.i[0] + u_sum.i[1] + mop_sum);
- sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
- _mm_empty();
- if((sum + cost_so_far) >= best_total_cost_so_far)
+ // Mop up
+ for (int i = stopX; i < width; ++i)
{
- return best_total_cost_so_far;
+ mop_sum += *src;
+ src++;
}
+ src += pic_next;
}
- _mm_empty();
- return sum + cost_so_far;
-#else
- //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ref_curr += 2)
- {
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
- sum += std::abs(temp - *pic_curr);
- }// x
- if((sum + cost_so_far) >= best_total_cost_so_far)
- return best_total_cost_so_far;
+ CalcValueType int_dc = (u_sum.i[0] + u_sum.i[1] + mop_sum)/(width*height);
- }// y
- return sum + cost_so_far;
-#endif
- }
- else if(rmdr.x == 0)
- {
-#if 1
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
- {
- m_sum = _mm_xor_si64(m_sum, m_sum);
- mop_sum = 0;
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, ref_curr += 8)
- {
- // Load ref
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- // m1 = words 0 2 4 6 of ref_curr
- m1 = _mm_unpacklo_pi16(m1, m2);
- // m2 = words 0 2 4 6 of ref_curr+ref_stride
- m2 = _mm_unpacklo_pi16(*(__m64 *)(ref_curr + ref_stride), *(__m64 *)(ref_curr + ref_stride + 4));
- __m64 m3 = _mm_unpackhi_pi16(*(__m64 *)(ref_curr + ref_stride), *(__m64 *)(ref_curr + ref_stride + 4));
- m2 = _mm_unpacklo_pi16(m2, m3);
+ dc_val = static_cast<ValueType>( int_dc );
- // (ref_curr[0] + ref_curr[ref_stride] + 1)>>1
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_add_pi16(m1, m_one);
- m1 = _mm_srai_pi16(m1, 1);
- // ref - pic
- m1 = _mm_sub_pi16(*(__m64 *)pic_curr, m1);
- // abs (ref - pic)
- m3 = _mm_srai_pi16(m1, 15);
- m1 = _mm_xor_si64(m1, m3);
- m1 = _mm_sub_pi16(m1, m3);
- // sum += abs(ref -pic)
- m_sum = _mm_add_pi16(m_sum, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ref_curr += 2)
+ // Now compute the resulting SAD
+ __m64 dc = _mm_set_pi16 ( dc_val, dc_val , dc_val , dc_val);
+ u_sum.m = _mm_xor_si64(u_sum.m, u_sum.m); // initialise sum to 0
+ mop_sum = 0;
+
+ src = &(pic_data[dparams.Yp()][dparams.Xp()]);
+ for (int j = 0; j < height; ++j)
+ {
+ for (int i = 0; i < stopX; i+=4)
{
- CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride] + 1) >> 1;
- mop_sum += std::abs(temp - *pic_curr);
+ __m64 pic = *(__m64 *)src;
+ // pic - dc
+ pic = _mm_sub_pi16 (pic, dc);
+ // abs (pic - dc)
+ tmp = _mm_srai_pi16(pic, 15);
+ pic = _mm_xor_si64(pic, tmp);
+ pic = _mm_sub_pi16 (pic, tmp);
+ // sum += abs(pic -dc)
+ tmp = _mm_xor_si64(tmp, tmp);
+ tmp = _mm_unpackhi_pi16(pic, tmp);
+ pic = _mm_unpacklo_pi16(pic, pic);
+ pic = _mm_srai_pi32 (pic, 16);
+ pic = _mm_add_pi32 (pic, tmp);
+ u_sum.m = _mm_add_pi32 (u_sum.m, pic);
+ src += 4;
}
- u_sum.m = m_sum;
- //sum += (u_sum.i[0] + u_sum.i[1] + mop_sum);
- sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
- _mm_empty();
- if((sum + cost_so_far) >= best_total_cost_so_far)
+ // Mop up
+ for (int i = stopX; i < width; ++i)
{
- return best_total_cost_so_far;
+ mop_sum += std::abs(*src - dc_val);
+ src++;
}
+ src += pic_next;
}
+ CalcValueType intra_cost = u_sum.i[0] + u_sum.i[1] + mop_sum;
_mm_empty();
- return sum + cost_so_far;
-#else
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ref_curr += 2)
- {
- CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride] + 1) >> 1;
- sum += std::abs(temp - *pic_curr);
- }// x
- if((sum + cost_so_far) >= best_total_cost_so_far)
- return best_total_cost_so_far;
+ return intra_cost;
- }// y
- return sum + cost_so_far;
-#endif
}
- else
+
+ /*
+ * NOTE: we are not doing any bounds checks here. This function must
+ * be invoked only when the reference images start and stop fall
+ * withing bounds
+ */
+ float simple_block_diff_up_mmx_4(
+ const PicArray& pic_data, const PicArray& ref_data,
+ const ImageCoords& start_pos, const ImageCoords& end_pos,
+ const ImageCoords& ref_start, const ImageCoords& ref_stop,
+ const MVector& rmdr, float cost_so_far,
+ float best_total_cost_so_far)
{
-#if 1
- __m64 m_two = _mm_set_pi32(2, 2);
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- // processing four pic_data values at a time
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
+ ValueType *pic_curr = &pic_data[start_pos.y][start_pos.x];
+ ValueType *ref_curr = &ref_data[ref_start.y][ref_start.x];
+
+ const int width = end_pos.x - start_pos.x;
+ int height = end_pos.y - start_pos.y;
+ const int ref_stride = ref_data.LengthX();
+
+ // go down a row and back up
+ const int pic_next = pic_data.LengthX() - width;
+ // go down 2 rows and back up
+ const int ref_next = ref_data.LengthX()*2 - width*2;
+
+ REPORTM (ref_start.x>=0 && ref_stop.x < ref_data.LengthX() &&
+ ref_start.y>=0 && ref_stop.y < ref_data.LengthY(),
+ "Reference image coordinates within bounds");
+
+ CalcValueType sum = 0;
+ CalcValueType mop_sum(0);
+ int stopX = (width>>2)<<2;
+ __m64 m_sum = _mm_set_pi16(0, 0, 0, 0);
+ u_mmx_val u_sum;
+ if (rmdr.x == 0 && rmdr.y == 0 )
{
- m_sum = _mm_xor_si64(m_sum, m_sum);
- mop_sum = 0;
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, ref_curr += 8)
+ //std::cerr << "Inmmx routine rmdr.x = rmdr.y = 0" << std::endl;
+#if 1
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
{
- // Load ref
- // m1 = words 0 1 2 3 of line 0 ref_curr
- __m64 m1 = *(__m64 *)ref_curr;
- // m1 = words 0 1 2 3 of line 1 of ref_curr
- __m64 m2 = *(__m64 *)(ref_curr + ref_stride);
- // (ref_curr[0] + ref_curr[1] +
- // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_madd_pi16(m1, m_one);
- m1 = _mm_add_pi32(m1, m_two);
- m1 = _mm_srai_pi32(m1, 2);
-
-
- // m2 = words 4 5 6 7 of line 0 ref_curr
- __m64 m3 = *(__m64 *)(ref_curr + 4);
- // m1 = words 4 5 6 7 of line 1 of ref_curr
- m2 = *(__m64 *)(ref_curr + 4 + ref_stride);
- // (ref_curr[0] + ref_curr[1] +
- // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
- m3 = _mm_add_pi16(m3, m2);
- m3 = _mm_madd_pi16(m3, m_one);
- m3 = _mm_add_pi32(m3, m_two);
- m3 = _mm_srai_pi32(m3, 2);
-
- m1 = _mm_packs_pi32(m1, m3);
-
- // load first four values pic_data
- m2 = *(__m64 *)pic_curr;
-
- // ref - pic
- m1 = _mm_sub_pi16(m1, m2);
- // abs (ref - pic)
- m2 = _mm_srai_pi16(m1, 15);
- m1 = _mm_xor_si64(m1, m2);
- m1 = _mm_sub_pi16(m1, m2);
- // sum += abs(ref -pic)
- m_sum = _mm_add_pi16(m_sum, m1);
+ m_sum = _mm_xor_si64 (m_sum, m_sum);
+ mop_sum= 0;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, ref_curr+=8 )
+ {
+ __m64 pic = *(__m64 *)pic_curr;
+ __m64 ref = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 ref2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ ref = _mm_unpacklo_pi16 ( ref, ref2);
+ // ref - pic
+ pic = _mm_sub_pi16 (pic, ref);
+ // abs (ref - pic)
+ ref = _mm_srai_pi16(pic, 15);
+ pic = _mm_xor_si64(pic, ref);
+ pic = _mm_sub_pi16 (pic, ref);
+ // sum += abs(ref -pic)
+ /**
+ * Since we are re-initialising m_sum with every loop
+ * maybe we don't need the following since overflow may
+ * not occur
+ ref = _mm_xor_si64(ref, ref);
+ ref = _mm_unpackhi_pi16(pic, ref);
+ pic = _mm_unpacklo_pi16(pic, pic);
+ pic = _mm_srai_pi32 (pic, 16);
+ pic = _mm_add_pi32 (pic, ref);
+ m_sum = _mm_add_pi32 (m_sum, pic);
+ **/
+ m_sum = _mm_add_pi16 (m_sum, pic);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr,ref_curr+=2)
+ {
+ mop_sum += std::abs (*ref_curr - *pic_curr);
+ }
+ u_sum.m = m_sum;
+ //sum += (u_sum.i[0] + u_sum.i[1] + mop_sum);
+ sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
+ _mm_empty();
+ if ((sum + cost_so_far )>= best_total_cost_so_far)
+ {
+ return best_total_cost_so_far;
+ }
}
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ref_curr += 2)
+ _mm_empty();
+ return sum + cost_so_far;
+#else
+ float sum = cost_so_far;
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
+ {
+ for( int x=0; x < width; ++x, ++pic_curr, ref_curr+=2 )
+ {
+ sum += std::abs( *ref_curr - *pic_curr );
+ }// x
+
+ if ( sum>= best_total_cost_so_far)
+ return best_total_cost_so_far;
+
+ }// y
+ return sum;
+#endif
+
+ }
+ else if( rmdr.y == 0 )
+ {
+#if 1
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[1] +
- ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >> 2;
- mop_sum += std::abs(temp - *pic_curr);
+ m_sum = _mm_xor_si64 (m_sum, m_sum);
+ mop_sum= 0;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ // m3 = words 0 2 4 6 of ref_curr
+ __m64 m3 = _mm_unpacklo_pi16 ( m1, m2);
+ // m2 = words 1 3 5 7 of ref_curr
+ m2 = _mm_unpackhi_pi16 ( m1, m2);
+ // (ref_curr[0] + ref_curr[1] + 1)>>1
+ m3 = _mm_add_pi16 (m3, m2);
+ m3 = _mm_add_pi16 (m3, m_one);
+ m3 = _mm_srai_pi16 (m3, 1);
+ // ref - pic
+ m1 = _mm_sub_pi16 (*(__m64 *)pic_curr, m3);
+ // abs (ref - pic)
+ m3 = _mm_srai_pi16(m1, 15);
+ m1 = _mm_xor_si64(m1, m3);
+ m1 = _mm_sub_pi16 (m1, m3);
+ // sum += abs(ref -pic)
+ /**
+ * Since we are re-initialising m_sum with every loop
+ * maybe we don't need the following since overflow may
+ * not occur
+ ref = _mm_xor_si64(ref, ref);
+ ref = _mm_unpackhi_pi16(pic, ref);
+ pic = _mm_unpacklo_pi16(pic, pic);
+ pic = _mm_srai_pi32 (pic, 16);
+ pic = _mm_add_pi32 (pic, ref);
+ m_sum = _mm_add_pi32 (m_sum, pic);
+ **/
+ m_sum = _mm_add_pi16 (m_sum, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr,ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[1]+1)>>1;
+ mop_sum += std::abs (temp - *pic_curr);
+ }
+ u_sum.m = m_sum;
+ //sum += (u_sum.i[0] + u_sum.i[1] + mop_sum);
+ sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
+ _mm_empty();
+ if ((sum + cost_so_far )>= best_total_cost_so_far)
+ {
+ return best_total_cost_so_far;
+ }
}
- u_sum.m = m_sum;
- sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
_mm_empty();
- if((sum + cost_so_far) >= best_total_cost_so_far)
+ return sum + cost_so_far;
+#else
+ //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- return best_total_cost_so_far;
- }
+ for( int x=0; x < width; ++x, ++pic_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( temp - *pic_curr );
+ }// x
+
+ if ( (sum+cost_so_far)>=best_total_cost_so_far)
+ return best_total_cost_so_far;
+
+ }// y
+ return sum+cost_so_far;
+#endif
}
- _mm_empty();
- return sum + cost_so_far;
+ else if( rmdr.x == 0 )
+ {
+#if 1
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
+ {
+ m_sum = _mm_xor_si64 (m_sum, m_sum);
+ mop_sum= 0;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ // m1 = words 0 2 4 6 of ref_curr
+ m1 = _mm_unpacklo_pi16 ( m1, m2);
+ // m2 = words 0 2 4 6 of ref_curr+ref_stride
+ m2 = _mm_unpacklo_pi16 (*(__m64 *)(ref_curr+ref_stride), *(__m64 *)(ref_curr+ref_stride+4));
+ __m64 m3 = _mm_unpackhi_pi16 (*(__m64 *)(ref_curr+ref_stride), *(__m64 *)(ref_curr+ref_stride+4));
+ m2 = _mm_unpacklo_pi16 (m2, m3);
+
+ // (ref_curr[0] + ref_curr[ref_stride] + 1)>>1
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_add_pi16 (m1, m_one);
+ m1 = _mm_srai_pi16 (m1, 1);
+ // ref - pic
+ m1 = _mm_sub_pi16 (*(__m64 *)pic_curr, m1);
+ // abs (ref - pic)
+ m3 = _mm_srai_pi16(m1, 15);
+ m1 = _mm_xor_si64(m1, m3);
+ m1 = _mm_sub_pi16 (m1, m3);
+ // sum += abs(ref -pic)
+ m_sum = _mm_add_pi16 (m_sum, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr,ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride]+1)>>1;
+ mop_sum += std::abs (temp - *pic_curr);
+ }
+ u_sum.m = m_sum;
+ //sum += (u_sum.i[0] + u_sum.i[1] + mop_sum);
+ sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
+ _mm_empty();
+ if ((sum + cost_so_far )>= best_total_cost_so_far)
+ {
+ return best_total_cost_so_far;
+ }
+ }
+ _mm_empty();
+ return sum + cost_so_far;
#else
- //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
+ {
+ for( int x=0; x < width; ++x, ++pic_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride]+1)>>1;
+ sum += std::abs (temp - *pic_curr);
+ }// x
+
+ if ( (sum+cost_so_far)>=best_total_cost_so_far)
+ return best_total_cost_so_far;
+
+ }// y
+ return sum+cost_so_far;
+#endif
+ }
+ else
{
- for(int x = 0; x < width; ++x, ++pic_curr, ref_curr += 2)
+#if 1
+ __m64 m_two = _mm_set_pi32(2, 2);
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ // processing four pic_data values at a time
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[ref_stride]) +
- CalcValueType(ref_curr[ref_stride+1]) +
- 2
- ) >> 2;
- sum += std::abs(temp - *pic_curr);
- }// x
-
- if((sum + cost_so_far) >= best_total_cost_so_far)
- return best_total_cost_so_far;
-
- }// y
- return sum + cost_so_far;
+ m_sum = _mm_xor_si64 (m_sum, m_sum);
+ mop_sum= 0;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ // m1 = words 0 1 2 3 of line 0 ref_curr
+ __m64 m1 = *(__m64 *)ref_curr;
+ // m1 = words 0 1 2 3 of line 1 of ref_curr
+ __m64 m2 = *(__m64 *)(ref_curr+ref_stride);
+ // (ref_curr[0] + ref_curr[1] +
+ // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_madd_pi16 (m1, m_one);
+ m1 = _mm_add_pi32 (m1, m_two);
+ m1 = _mm_srai_pi32 (m1, 2);
+
+
+ // m2 = words 4 5 6 7 of line 0 ref_curr
+ __m64 m3 = *(__m64 *)(ref_curr+4);
+ // m1 = words 4 5 6 7 of line 1 of ref_curr
+ m2 = *(__m64 *)(ref_curr+4+ref_stride);
+ // (ref_curr[0] + ref_curr[1] +
+ // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
+ m3 = _mm_add_pi16 (m3, m2);
+ m3 = _mm_madd_pi16 (m3, m_one);
+ m3 = _mm_add_pi32 (m3, m_two);
+ m3 = _mm_srai_pi32 (m3, 2);
+
+ m1 = _mm_packs_pi32 (m1, m3);
+
+ // load first four values pic_data
+ m2 = *(__m64 *)pic_curr;
+
+ // ref - pic
+ m1 = _mm_sub_pi16 (m1, m2);
+ // abs (ref - pic)
+ m2 = _mm_srai_pi16(m1, 15);
+ m1 = _mm_xor_si64(m1, m2);
+ m1 = _mm_sub_pi16(m1, m2);
+ // sum += abs(ref -pic)
+ m_sum = _mm_add_pi16 (m_sum, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr,ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[1] +
+ ref_curr[ref_stride] + ref_curr[ref_stride+1]+2)>>2;
+ mop_sum += std::abs (temp - *pic_curr);
+ }
+ u_sum.m = m_sum;
+ sum += (u_sum.h[0] + u_sum.h[1] + u_sum.h[2] + u_sum.h[3] + mop_sum);
+ _mm_empty();
+ if ((sum + cost_so_far )>= best_total_cost_so_far)
+ {
+ return best_total_cost_so_far;
+ }
+ }
+ _mm_empty();
+ return sum + cost_so_far;
+#else
+ //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
+ {
+ for( int x=0; x < width; ++x, ++pic_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[ref_stride] ) +
+ CalcValueType( ref_curr[ref_stride+1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( temp - *pic_curr );
+ }// x
+
+ if ( (sum+cost_so_far)>=best_total_cost_so_far)
+ return best_total_cost_so_far;
+
+ }// y
+ return sum+cost_so_far;
#endif
- }
+ }
return cost_so_far;
-}
+ }
-/*
-* NOTE: we are not doing any bounds checks here. This function must
-* be invoked only when the reference images start and stop fall
-* withing bounds
-*/
-void simple_biblock_diff_pic_mmx_4(
- const PicArray& pic_data, const PicArray& ref_data,
- TwoDArray<ValueType>& diff,
- const ImageCoords& start_pos, const ImageCoords& end_pos,
- const ImageCoords& ref_start, const ImageCoords& ref_stop,
- const MVector& rmdr)
-{
- ValueType *pic_curr = &pic_data[start_pos.y][start_pos.x];
- ValueType *ref_curr = &ref_data[ref_start.y][ref_start.x];
- ValueType *diff_curr = &diff[0][0];
+ /*
+ * NOTE: we are not doing any bounds checks here. This function must
+ * be invoked only when the reference images start and stop fall
+ * withing bounds
+ */
+ void simple_biblock_diff_pic_mmx_4(
+ const PicArray& pic_data, const PicArray& ref_data,
+ TwoDArray<ValueType>& diff,
+ const ImageCoords& start_pos, const ImageCoords& end_pos,
+ const ImageCoords& ref_start, const ImageCoords& ref_stop,
+ const MVector& rmdr)
+ {
+ ValueType *pic_curr = &pic_data[start_pos.y][start_pos.x];
+ ValueType *ref_curr = &ref_data[ref_start.y][ref_start.x];
+ ValueType *diff_curr = &diff[0][0];
- const int width = end_pos.x - start_pos.x;
- int height = end_pos.y - start_pos.y;
- const int ref_stride = ref_data.LengthX();
+ const int width = end_pos.x - start_pos.x;
+ int height = end_pos.y - start_pos.y;
+ const int ref_stride = ref_data.LengthX();
- // go down a row and back up
- const int pic_next = pic_data.LengthX() - width;
- // go down 2 rows and back up
- const int ref_next = ref_data.LengthX() * 2 - width * 2;
+ // go down a row and back up
+ const int pic_next = pic_data.LengthX() - width;
+ // go down 2 rows and back up
+ const int ref_next = ref_data.LengthX()*2 - width*2;
- REPORTM(ref_start.x >= 0 && ref_stop.x < ref_data.LengthX() &&
- ref_start.y >= 0 && ref_stop.y < ref_data.LengthY(),
- "Reference image coordinates withing bounds");
+ REPORTM (ref_start.x>=0 && ref_stop.x < ref_data.LengthX() &&
+ ref_start.y>=0 && ref_stop.y < ref_data.LengthY(),
+ "Reference image coordinates withing bounds");
- int stopX = (width >> 2) << 2;
- if(rmdr.x == 0 && rmdr.y == 0)
- {
- //std::cerr << "Inmmx routine rmdr.x = rmdr.y = 0" << std::endl;
-#if 1
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
+ int stopX = (width>>2)<<2;
+ if (rmdr.x == 0 && rmdr.y == 0 )
{
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, ref_curr += 8, diff_curr += 4)
- {
- __m64 pic = *(__m64 *)pic_curr;
- // pic << 1
- pic = _mm_slli_pi16(pic, 1);
- // load ref
- __m64 ref = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 ref2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- ref = _mm_unpacklo_pi16(ref, ref2);
- // pic<<1 - ref
- *(__m64 *)diff_curr = _mm_sub_pi16(pic, ref);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+ //std::cerr << "Inmmx routine rmdr.x = rmdr.y = 0" << std::endl;
+#if 1
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next)
{
- *diff_curr = ((*pic_curr) << 1) - *ref_curr;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, ref_curr+=8, diff_curr += 4 )
+ {
+ __m64 pic = *(__m64 *)pic_curr;
+ // pic << 1
+ pic = _mm_slli_pi16(pic, 1);
+ // load ref
+ __m64 ref = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 ref2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ ref = _mm_unpacklo_pi16 ( ref, ref2);
+ // pic<<1 - ref
+ *(__m64 *)diff_curr = _mm_sub_pi16 (pic, ref);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2)
+ {
+ *diff_curr = ((*pic_curr)<<1) - *ref_curr;
+ }
}
- }
#else
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- *diff_curr = ((*pic_curr) << 1) - *ref_curr;
- }// x
- }// y
+ for( int x=0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2 )
+ {
+ *diff_curr = ((*pic_curr)<<1) - *ref_curr;
+ }// x
+ }// y
#endif
- }
- else if(rmdr.y == 0)
- {
-#if 1
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
+ }
+ else if( rmdr.y == 0 )
{
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, diff_curr += 4, ref_curr += 8)
- {
- // Load ref
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- // m3 = words 0 2 4 6 of ref_curr
- __m64 m3 = _mm_unpacklo_pi16(m1, m2);
- // m2 = words 1 3 5 7 of ref_curr
- m2 = _mm_unpackhi_pi16(m1, m2);
- // (ref_curr[0] + ref_curr[1] + 1)>>1
- m3 = _mm_add_pi16(m3, m2);
- m3 = _mm_add_pi16(m3, m_one);
- m3 = _mm_srai_pi16(m3, 1);
- // pic << 1
- m1 = _mm_slli_pi16(*(__m64 *)pic_curr, 1);
- // diff = pic - ref
- *(__m64 *)diff_curr = _mm_sub_pi16(m1, m3);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+#if 1
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[1] + 1) >> 1;
- *diff_curr = ((*pic_curr) << 1) - temp;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, diff_curr += 4, ref_curr+=8 )
+ {
+ // Load ref
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ // m3 = words 0 2 4 6 of ref_curr
+ __m64 m3 = _mm_unpacklo_pi16 ( m1, m2);
+ // m2 = words 1 3 5 7 of ref_curr
+ m2 = _mm_unpackhi_pi16 ( m1, m2);
+ // (ref_curr[0] + ref_curr[1] + 1)>>1
+ m3 = _mm_add_pi16 (m3, m2);
+ m3 = _mm_add_pi16 (m3, m_one);
+ m3 = _mm_srai_pi16 (m3, 1);
+ // pic << 1
+ m1 = _mm_slli_pi16(*(__m64 *)pic_curr, 1);
+ // diff = pic - ref
+ *(__m64 *)diff_curr = _mm_sub_pi16 (m1, m3);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[1]+1)>>1;
+ *diff_curr = ((*pic_curr)<<1) - temp;
+ }
}
- }
#else
- //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+ //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
- *diff_curr = ((*pic_curr) << 1) - temp;
- }// x
-
- }// y
+ for( int x=0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
+ *diff_curr = ((*pic_curr)<<1) - temp;
+ }// x
+
+ }// y
#endif
- }
- else if(rmdr.x == 0)
- {
-#if 1
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
+ }
+ else if( rmdr.x == 0 )
{
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, diff_curr += 4, ref_curr += 8)
- {
- // Load ref
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- // m1 = words 0 2 4 6 of ref_curr
- m1 = _mm_unpacklo_pi16(m1, m2);
- // m2 = words 0 2 4 6 of ref_curr+ref_stride
- m2 = _mm_unpacklo_pi16(*(__m64 *)(ref_curr + ref_stride), *(__m64 *)(ref_curr + ref_stride + 4));
- __m64 m3 = _mm_unpackhi_pi16(*(__m64 *)(ref_curr + ref_stride), *(__m64 *)(ref_curr + ref_stride + 4));
- m2 = _mm_unpacklo_pi16(m2, m3);
-
- // (ref_curr[0] + ref_curr[ref_stride] + 1)>>1
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_add_pi16(m1, m_one);
- m1 = _mm_srai_pi16(m1, 1);
- // pic << 1
- m2 = _mm_slli_pi16(*(__m64 *)pic_curr, 1);
- // diff = pic<<1 - ref)
- *(__m64 *)diff_curr = _mm_sub_pi16(m2, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+#if 1
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride] + 1) >> 1;
- *diff_curr = ((*pic_curr) << 1) - temp;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, diff_curr +=4, ref_curr+=8 )
+ {
+ // Load ref
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ // m1 = words 0 2 4 6 of ref_curr
+ m1 = _mm_unpacklo_pi16 ( m1, m2);
+ // m2 = words 0 2 4 6 of ref_curr+ref_stride
+ m2 = _mm_unpacklo_pi16 (*(__m64 *)(ref_curr+ref_stride), *(__m64 *)(ref_curr+ref_stride+4));
+ __m64 m3 = _mm_unpackhi_pi16 (*(__m64 *)(ref_curr+ref_stride), *(__m64 *)(ref_curr+ref_stride+4));
+ m2 = _mm_unpacklo_pi16 (m2, m3);
+
+ // (ref_curr[0] + ref_curr[ref_stride] + 1)>>1
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_add_pi16 (m1, m_one);
+ m1 = _mm_srai_pi16 (m1, 1);
+ // pic << 1
+ m2 = _mm_slli_pi16 (*(__m64 *)pic_curr, 1);
+ // diff = pic<<1 - ref)
+ *(__m64 *)diff_curr = _mm_sub_pi16(m2, m1 );
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride]+1)>>1;
+ *diff_curr = ((*pic_curr)<<1) - temp;
+ }
}
- }
#else
- //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+ //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
- *diff_curr = ((*pic_curr) << 1) - temp;
- }// x
- }// y
+ for( int x=0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
+ *diff_curr = ((*pic_curr)<<1) - temp;
+ }// x
+ }// y
#endif
- }
- else
- {
-#if 1
- __m64 m_two = _mm_set_pi32(2, 2);
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- // processing four pic_data values at a time
- for(int y = 0; y < height; y++, pic_curr += pic_next, ref_curr += ref_next)
+ }
+ else
{
- for(int x = 0; x < stopX; x += 4, pic_curr += 4, diff_curr += 4, ref_curr += 8)
- {
- // Load ref
- // m1 = words 0 1 2 3 of line 0 ref_curr
- __m64 m1 = *(__m64 *)ref_curr;
- // m1 = words 0 1 2 3 of line 1 of ref_curr
- __m64 m2 = *(__m64 *)(ref_curr + ref_stride);
- // (ref_curr[0] + ref_curr[1] +
- // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_madd_pi16(m1, m_one);
- m1 = _mm_add_pi32(m1, m_two);
- m1 = _mm_srai_pi32(m1, 2);
-
- // m2 = words 4 5 6 7 of line 0 ref_curr
- __m64 m3 = *(__m64 *)(ref_curr + 4);
- // m1 = words 4 5 6 7 of line 1 of ref_curr
- m2 = *(__m64 *)(ref_curr + 4 + ref_stride);
- // (ref_curr[0] + ref_curr[1] +
- // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
- m3 = _mm_add_pi16(m3, m2);
- m3 = _mm_madd_pi16(m3, m_one);
- m3 = _mm_add_pi32(m3, m_two);
- m3 = _mm_srai_pi32(m3, 2);
-
- m1 = _mm_packs_pi32(m1, m3);
-
- // load first four values pic_data and <<1
- m2 = _mm_slli_pi16(*(__m64 *)pic_curr, 1);
-
- // pic<<1 - ref
- *(__m64 *)diff_curr = _mm_sub_pi16(m2, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+#if 1
+ __m64 m_two = _mm_set_pi32(2, 2);
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ // processing four pic_data values at a time
+ for( int y=0; y < height; y++, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[1] +
- ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >> 2;
- *diff_curr = ((*pic_curr) << 1) - temp;
+ for( int x=0; x < stopX; x+=4, pic_curr+=4, diff_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ // m1 = words 0 1 2 3 of line 0 ref_curr
+ __m64 m1 = *(__m64 *)ref_curr;
+ // m1 = words 0 1 2 3 of line 1 of ref_curr
+ __m64 m2 = *(__m64 *)(ref_curr+ref_stride);
+ // (ref_curr[0] + ref_curr[1] +
+ // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_madd_pi16 (m1, m_one);
+ m1 = _mm_add_pi32 (m1, m_two);
+ m1 = _mm_srai_pi32 (m1, 2);
+
+ // m2 = words 4 5 6 7 of line 0 ref_curr
+ __m64 m3 = *(__m64 *)(ref_curr+4);
+ // m1 = words 4 5 6 7 of line 1 of ref_curr
+ m2 = *(__m64 *)(ref_curr+4+ref_stride);
+ // (ref_curr[0] + ref_curr[1] +
+ // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
+ m3 = _mm_add_pi16 (m3, m2);
+ m3 = _mm_madd_pi16 (m3, m_one);
+ m3 = _mm_add_pi32 (m3, m_two);
+ m3 = _mm_srai_pi32 (m3, 2);
+
+ m1 = _mm_packs_pi32 (m1, m3);
+
+ // load first four values pic_data and <<1
+ m2 = _mm_slli_pi16 (*(__m64 *)pic_curr, 1);
+
+ // pic<<1 - ref
+ *(__m64 *)diff_curr = _mm_sub_pi16 (m2, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++pic_curr,++diff_curr, ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[1] +
+ ref_curr[ref_stride] + ref_curr[ref_stride+1]+2)>>2;
+ *diff_curr = ((*pic_curr)<<1) - temp;
+ }
}
- }
#else
- //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, pic_curr += pic_next, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr += 2)
+ //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, pic_curr+=pic_next, ref_curr+=ref_next )
{
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[ref_stride]) +
- CalcValueType(ref_curr[ref_stride+1]) +
- 2
- ) >> 2;
- *diff_curr = ((*pic_curr) << 1) - temp;
- }// x
-
- }// y
+ for( int x=0; x < width; ++x, ++pic_curr, ++diff_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[ref_stride] ) +
+ CalcValueType( ref_curr[ref_stride+1] ) +
+ 2
+ ) >> 2;
+ *diff_curr = ((*pic_curr)<<1) - temp;
+ }// x
+
+ }// y
#endif
- }
+ }
_mm_empty();
return;
-}
+ }
-/*
-* NOTE: we are not doing any bounds checks here. This function must
-* be invoked only when the reference images start and stop fall
-* withing bounds
-*/
-CalcValueType simple_biblock_diff_up_mmx_4(
- const TwoDArray<ValueType>& diff_data, const PicArray& ref_data,
- const ImageCoords& ref_start, const ImageCoords& ref_stop,
- const MVector& rmdr)
-{
- ValueType *diff_curr = &diff_data[0][0];
- ValueType *ref_curr = &ref_data[ref_start.y][ref_start.x];
+ /*
+ * NOTE: we are not doing any bounds checks here. This function must
+ * be invoked only when the reference images start and stop fall
+ * withing bounds
+ */
+ CalcValueType simple_biblock_diff_up_mmx_4(
+ const TwoDArray<ValueType>& diff_data, const PicArray& ref_data,
+ const ImageCoords& ref_start, const ImageCoords& ref_stop,
+ const MVector& rmdr)
+ {
+ ValueType *diff_curr = &diff_data[0][0];
+ ValueType *ref_curr = &ref_data[ref_start.y][ref_start.x];
- const int width = diff_data.LengthX();
- int height = diff_data.LengthY();
- const int ref_stride = ref_data.LengthX();
+ const int width = diff_data.LengthX();
+ int height = diff_data.LengthY();
+ const int ref_stride = ref_data.LengthX();
- // go down 2 rows and back up
- const int ref_next = ref_data.LengthX() * 2 - width * 2;
+ // go down 2 rows and back up
+ const int ref_next = ref_data.LengthX()*2 - width*2;
- REPORTM(ref_start.x >= 0 && ref_stop.x < ref_data.LengthX() &&
- ref_start.y >= 0 && ref_stop.y < ref_data.LengthY(),
- "Reference image coordinates withing bounds");
+ REPORTM (ref_start.x>=0 && ref_stop.x < ref_data.LengthX() &&
+ ref_start.y>=0 && ref_stop.y < ref_data.LengthY(),
+ "Reference image coordinates withing bounds");
- CalcValueType mop_sum(0);
- int stopX = (width >> 2) << 2;
- __m64 m_sum = _mm_set_pi16(0, 0, 0, 0);
- u_mmx_val u_sum;
- if(rmdr.x == 0 && rmdr.y == 0)
- {
- //std::cerr << "Inmmx routine rmdr.x = rmdr.y = 0" << std::endl;
-#if 1
- for(int y = 0; y < height; y++, ref_curr += ref_next)
+ CalcValueType mop_sum(0);
+ int stopX = (width>>2)<<2;
+ __m64 m_sum = _mm_set_pi16(0, 0, 0, 0);
+ u_mmx_val u_sum;
+ if (rmdr.x == 0 && rmdr.y == 0 )
{
- for(int x = 0; x < stopX; x += 4, diff_curr += 4, ref_curr += 8)
- {
- u_mmx_val diff = *(u_mmx_val *)diff_curr;
- __m64 ref = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 ref2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- ref = _mm_unpacklo_pi16(ref, ref2);
- // diff - ref
- diff.m = _mm_sub_pi16(diff.m, ref);
- // (diff - ref)>>1
- diff.m = _mm_srai_pi16(diff.m, 1);
- // abs (diff - ref)
- ref = _mm_srai_pi16(diff.m, 15);
- diff.m = _mm_xor_si64(diff.m, ref);
- diff.m = _mm_sub_pi16(diff.m, ref);
- // sum += abs(ref -pic)
- ref = _mm_xor_si64(ref, ref);
- ref = _mm_unpackhi_pi16(diff.m, ref);
- diff.m = _mm_unpacklo_pi16(diff.m, diff.m);
- diff.m = _mm_srai_pi32(diff.m, 16);
- diff.m = _mm_add_pi32(diff.m, ref);
- m_sum = _mm_add_pi32(m_sum, diff.m);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++diff_curr, ref_curr += 2)
+ //std::cerr << "Inmmx routine rmdr.x = rmdr.y = 0" << std::endl;
+#if 1
+ for( int y=0; y < height; y++, ref_curr+=ref_next )
{
- mop_sum += std::abs((*diff_curr - *ref_curr) >> 1);
+ for( int x=0; x < stopX; x+=4, diff_curr+=4, ref_curr+=8 )
+ {
+ u_mmx_val diff = *(u_mmx_val *)diff_curr;
+ __m64 ref = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 ref2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ ref = _mm_unpacklo_pi16 ( ref, ref2);
+ // diff - ref
+ diff.m = _mm_sub_pi16 (diff.m, ref);
+ // (diff - ref)>>1
+ diff.m = _mm_srai_pi16 (diff.m, 1);
+ // abs (diff - ref)
+ ref = _mm_srai_pi16(diff.m, 15);
+ diff.m = _mm_xor_si64(diff.m, ref);
+ diff.m = _mm_sub_pi16 (diff.m, ref);
+ // sum += abs(ref -pic)
+ ref = _mm_xor_si64(ref, ref);
+ ref = _mm_unpackhi_pi16(diff.m, ref);
+ diff.m = _mm_unpacklo_pi16(diff.m, diff.m);
+ diff.m = _mm_srai_pi32 (diff.m, 16);
+ diff.m = _mm_add_pi32 (diff.m, ref);
+ m_sum = _mm_add_pi32 (m_sum, diff.m);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++diff_curr,ref_curr+=2)
+ {
+ mop_sum += std::abs ((*diff_curr - *ref_curr)>>1);
+ }
}
- }
- u_sum.m = m_sum;
- _mm_empty();
- return u_sum.i[0] + u_sum.i[1] + mop_sum;
+ u_sum.m = m_sum;
+ _mm_empty();
+ return u_sum.i[0] + u_sum.i[1] + mop_sum;
#else
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++diff_curr, ref_curr += 2)
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, ref_curr+=ref_next )
{
- sum += std::abs((*diff_curr - *ref_curr) >> 1);
- }// x
-
- }// y
- return sum;
+ for( int x=0; x < width; ++x, ++diff_curr, ref_curr+=2 )
+ {
+ sum += std::abs( (*diff_curr - *ref_curr)>>1 );
+ }// x
+
+ }// y
+ return sum;
#endif
- }
- else if(rmdr.y == 0)
- {
-#if 1
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- for(int y = 0; y < height; y++, ref_curr += ref_next)
+ }
+ else if( rmdr.y == 0 )
{
- for(int x = 0; x < stopX; x += 4, diff_curr += 4, ref_curr += 8)
- {
- // Load ref
- __m64 m1 = _mm_unpacklo_pi16(((u_mmx_val *)ref_curr)->m, ((u_mmx_val *)(ref_curr + 4))->m);
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- // m3 = words 0 2 4 6 of ref_curr
- __m64 m3 = _mm_unpacklo_pi16(m1, m2);
- // m2 = words 1 3 5 7 of ref_curr
- m2 = _mm_unpackhi_pi16(m1, m2);
- // (ref_curr[0] + ref_curr[1] + 1)>>1
- m3 = _mm_add_pi16(m3, m2);
- m3 = _mm_add_pi16(m3, m_one);
- m3 = _mm_srai_pi16(m3, 1);
- // diff - pic
- m1 = _mm_sub_pi16(*(__m64 *)diff_curr, m3);
- // (diff - pic)>>1
- m1 = _mm_srai_pi16(m1, 1);
- // abs (diff-ref)>>1
- m3 = _mm_srai_pi16(m1, 15);
- m1 = _mm_xor_si64(m1, m3);
- m1 = _mm_sub_pi16(m1, m3);
- // sum += abs(diff-ref)>>1
- m2 = _mm_xor_si64(m2, m2);
- m2 = _mm_unpackhi_pi16(m1, m2);
- m1 = _mm_unpacklo_pi16(m1, m1);
- m1 = _mm_srai_pi32(m1, 16);
- m1 = _mm_add_pi32(m1, m2);
- m_sum = _mm_add_pi32(m_sum, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++diff_curr, ref_curr += 2)
+#if 1
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ for( int y=0; y < height; y++, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[1] + 1) >> 1;
- mop_sum += std::abs((*diff_curr - temp) >> 1);
+ for( int x=0; x < stopX; x+=4, diff_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ __m64 m1 = _mm_unpacklo_pi16 (((u_mmx_val *)ref_curr)->m, ((u_mmx_val *)(ref_curr+4))->m);
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ // m3 = words 0 2 4 6 of ref_curr
+ __m64 m3 = _mm_unpacklo_pi16 ( m1, m2);
+ // m2 = words 1 3 5 7 of ref_curr
+ m2 = _mm_unpackhi_pi16 ( m1, m2);
+ // (ref_curr[0] + ref_curr[1] + 1)>>1
+ m3 = _mm_add_pi16 (m3, m2);
+ m3 = _mm_add_pi16 (m3, m_one);
+ m3 = _mm_srai_pi16 (m3, 1);
+ // diff - pic
+ m1 = _mm_sub_pi16 (*(__m64 *)diff_curr, m3);
+ // (diff - pic)>>1
+ m1 = _mm_srai_pi16 (m1, 1);
+ // abs (diff-ref)>>1
+ m3 = _mm_srai_pi16(m1, 15);
+ m1 = _mm_xor_si64(m1, m3);
+ m1 = _mm_sub_pi16 (m1, m3);
+ // sum += abs(diff-ref)>>1
+ m2 = _mm_xor_si64(m2, m2);
+ m2 = _mm_unpackhi_pi16(m1, m2);
+ m1 = _mm_unpacklo_pi16(m1, m1);
+ m1 = _mm_srai_pi32 (m1, 16);
+ m1 = _mm_add_pi32 (m1, m2);
+ m_sum = _mm_add_pi32 (m_sum, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++diff_curr,ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[1]+1)>>1;
+ mop_sum += std::abs ((*diff_curr - temp)>>1);
+ }
}
- }
- u_sum.m = m_sum;
- _mm_empty();
- return (u_sum.i[0] + u_sum.i[1] + mop_sum);
+ u_sum.m = m_sum;
+ _mm_empty();
+ return (u_sum.i[0] + u_sum.i[1] + mop_sum);
#else
- //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++diff_curr, ref_curr += 2)
+ //std::cerr << "Inmmx routine rmdr.y == 0" << std::endl;
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, ref_curr+=ref_next )
{
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- 1
- ) >> 1;
- sum += std::abs((*diff_curr - temp) >> 1);
- }// x
- }// y
- return sum;
+ for( int x=0; x < width; ++x, ++diff_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ 1
+ ) >> 1;
+ sum += std::abs( (*diff_curr - temp)>>1 );
+ }// x
+ }// y
+ return sum;
#endif
- }
- else if(rmdr.x == 0)
- {
-#if 1
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- for(int y = 0; y < height; y++, ref_curr += ref_next)
+ }
+ else if( rmdr.x == 0 )
{
- for(int x = 0; x < stopX; x += 4, diff_curr += 4, ref_curr += 8)
- {
- // Load ref
- __m64 m1 = _mm_unpacklo_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- __m64 m2 = _mm_unpackhi_pi16(*(__m64 *)ref_curr, *(__m64 *)(ref_curr + 4));
- // m1 = words 0 2 4 6 of ref_curr
- m1 = _mm_unpacklo_pi16(m1, m2);
- // m2 = words 0 2 4 6 of ref_curr+ref_stride
- m2 = _mm_unpacklo_pi16(*(__m64 *)(ref_curr + ref_stride), *(__m64 *)(ref_curr + ref_stride + 4));
- __m64 m3 = _mm_unpackhi_pi16(*(__m64 *)(ref_curr + ref_stride), *(__m64 *)(ref_curr + ref_stride + 4));
- m2 = _mm_unpacklo_pi16(m2, m3);
-
- // (ref_curr[0] + ref_curr[ref_stride] + 1)>>1
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_add_pi16(m1, m_one);
- m1 = _mm_srai_pi16(m1, 1);
- // diff - ref
- m1 = _mm_sub_pi16(*(__m64 *)diff_curr, m1);
- // (diff - ref)>>1
- m1 = _mm_srai_pi16(m1, 1);
- // abs ((diff - pic)>>1)
- m3 = _mm_srai_pi16(m1, 15);
- m1 = _mm_xor_si64(m1, m3);
- m1 = _mm_sub_pi16(m1, m3);
- // sum += abs(ref -pic)
- m2 = _mm_xor_si64(m2, m2);
- m2 = _mm_unpackhi_pi16(m1, m2);
- m1 = _mm_unpacklo_pi16(m1, m1);
- m1 = _mm_srai_pi32(m1, 16);
- m1 = _mm_add_pi32(m1, m2);
- m_sum = _mm_add_pi32(m_sum, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++diff_curr, ref_curr += 2)
+#if 1
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ for( int y=0; y < height; y++, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride] + 1) >> 1;
- mop_sum += std::abs((*diff_curr - temp) >> 1);
+ for( int x=0; x < stopX; x+=4, diff_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ __m64 m1 = _mm_unpacklo_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ __m64 m2 = _mm_unpackhi_pi16 (*(__m64 *)ref_curr, *(__m64 *)(ref_curr+4));
+ // m1 = words 0 2 4 6 of ref_curr
+ m1 = _mm_unpacklo_pi16 ( m1, m2);
+ // m2 = words 0 2 4 6 of ref_curr+ref_stride
+ m2 = _mm_unpacklo_pi16 (*(__m64 *)(ref_curr+ref_stride), *(__m64 *)(ref_curr+ref_stride+4));
+ __m64 m3 = _mm_unpackhi_pi16 (*(__m64 *)(ref_curr+ref_stride), *(__m64 *)(ref_curr+ref_stride+4));
+ m2 = _mm_unpacklo_pi16 (m2, m3);
+
+ // (ref_curr[0] + ref_curr[ref_stride] + 1)>>1
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_add_pi16 (m1, m_one);
+ m1 = _mm_srai_pi16 (m1, 1);
+ // diff - ref
+ m1 = _mm_sub_pi16 (*(__m64 *)diff_curr, m1);
+ // (diff - ref)>>1
+ m1 = _mm_srai_pi16 (m1, 1);
+ // abs ((diff - pic)>>1)
+ m3 = _mm_srai_pi16(m1, 15);
+ m1 = _mm_xor_si64(m1, m3);
+ m1 = _mm_sub_pi16 (m1, m3);
+ // sum += abs(ref -pic)
+ m2 = _mm_xor_si64(m2, m2);
+ m2 = _mm_unpackhi_pi16(m1, m2);
+ m1 = _mm_unpacklo_pi16(m1, m1);
+ m1 = _mm_srai_pi32 (m1, 16);
+ m1 = _mm_add_pi32 (m1, m2);
+ m_sum = _mm_add_pi32 (m_sum, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++diff_curr,ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride]+1)>>1;
+ mop_sum += std::abs ( (*diff_curr - temp)>>1 );
+ }
}
- }
- u_sum.m = m_sum;
- _mm_empty();
- return (u_sum.i[0] + u_sum.i[1] + mop_sum);
+ u_sum.m = m_sum;
+ _mm_empty();
+ return (u_sum.i[0] + u_sum.i[1] + mop_sum);
#else
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++diff_curr, ref_curr += 2)
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride] + 1) >> 1;
- sum += std::abs((*diff_curr - temp) >> 1);
- }// x
- }// y
- return sum;
+ for( int x=0; x < width; ++x, ++diff_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[ref_stride]+1)>>1;
+ sum += std::abs ( (*diff_curr - temp)>>1 );
+ }// x
+ }// y
+ return sum;
#endif
- }
- else
- {
-#if 1
- __m64 m_two = _mm_set_pi32(2, 2);
- __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
- // processing four pic_data values at a time
- for(int y = 0; y < height; y++, ref_curr += ref_next)
+ }
+ else
{
- for(int x = 0; x < stopX; x += 4, diff_curr += 4, ref_curr += 8)
- {
- // Load ref
- // m1 = words 0 1 2 3 of line 0 ref_curr
- __m64 m1 = *(__m64 *)ref_curr;
- // m1 = words 0 1 2 3 of line 1 of ref_curr
- __m64 m2 = *(__m64 *)(ref_curr + ref_stride);
- // (ref_curr[0] + ref_curr[1] +
- // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
- m1 = _mm_add_pi16(m1, m2);
- m1 = _mm_madd_pi16(m1, m_one);
- m1 = _mm_add_pi32(m1, m_two);
- m1 = _mm_srai_pi32(m1, 2);
-
- // m2 = words 4 5 6 7 of line 0 ref_curr
- __m64 m3 = *(__m64 *)(ref_curr + 4);
- // m1 = words 4 5 6 7 of line 1 of ref_curr
- m2 = *(__m64 *)(ref_curr + 4 + ref_stride);
- // (ref_curr[0] + ref_curr[1] +
- // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
- m3 = _mm_add_pi16(m3, m2);
- m3 = _mm_madd_pi16(m3, m_one);
- m3 = _mm_add_pi32(m3, m_two);
- m3 = _mm_srai_pi32(m3, 2);
- m1 = _mm_packs_pi32(m1, m3);
-
- // load first four values pic_data
- m2 = *(__m64 *)diff_curr;
-
- // diff - ref
- m1 = _mm_sub_pi16(m2, m1);
- // (diff - ref)>>1
- m1 = _mm_srai_pi16(m1, 1);
- // abs (diff - ref)>>1
- m2 = _mm_srai_pi16(m1, 15);
- m1 = _mm_xor_si64(m1, m2);
- m1 = _mm_sub_pi16(m1, m2);
- // sum += abs(ref -pic)>>1
- m1 = _mm_madd_pi16(m1, m_one);
- m_sum = _mm_add_pi32(m_sum, m1);
- }
- // mopup;
- for(int x = stopX; x < width; ++x, ++diff_curr, ref_curr += 2)
+#if 1
+ __m64 m_two = _mm_set_pi32(2, 2);
+ __m64 m_one = _mm_set_pi16(1, 1, 1, 1);
+ // processing four pic_data values at a time
+ for( int y=0; y < height; y++, ref_curr+=ref_next )
{
- CalcValueType temp = (ref_curr[0] + ref_curr[1] +
- ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >> 2;
- mop_sum += std::abs((*diff_curr - temp) >> 1);
+ for( int x=0; x < stopX; x+=4, diff_curr+=4, ref_curr+=8 )
+ {
+ // Load ref
+ // m1 = words 0 1 2 3 of line 0 ref_curr
+ __m64 m1 = *(__m64 *)ref_curr;
+ // m1 = words 0 1 2 3 of line 1 of ref_curr
+ __m64 m2 = *(__m64 *)(ref_curr+ref_stride);
+ // (ref_curr[0] + ref_curr[1] +
+ // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
+ m1 = _mm_add_pi16 (m1, m2);
+ m1 = _mm_madd_pi16 (m1, m_one);
+ m1 = _mm_add_pi32 (m1, m_two);
+ m1 = _mm_srai_pi32 (m1, 2);
+
+ // m2 = words 4 5 6 7 of line 0 ref_curr
+ __m64 m3 = *(__m64 *)(ref_curr+4);
+ // m1 = words 4 5 6 7 of line 1 of ref_curr
+ m2 = *(__m64 *)(ref_curr+4+ref_stride);
+ // (ref_curr[0] + ref_curr[1] +
+ // ref_curr[ref_stride] + ref_curr[ref_stride+1] + 2) >>2
+ m3 = _mm_add_pi16 (m3, m2);
+ m3 = _mm_madd_pi16 (m3, m_one);
+ m3 = _mm_add_pi32 (m3, m_two);
+ m3 = _mm_srai_pi32 (m3, 2);
+ m1 = _mm_packs_pi32 (m1, m3);
+
+ // load first four values pic_data
+ m2 = *(__m64 *)diff_curr;
+
+ // diff - ref
+ m1 = _mm_sub_pi16 (m2, m1);
+ // (diff - ref)>>1
+ m1 = _mm_srai_pi16 (m1, 1);
+ // abs (diff - ref)>>1
+ m2 = _mm_srai_pi16(m1, 15);
+ m1 = _mm_xor_si64(m1, m2);
+ m1 = _mm_sub_pi16(m1, m2);
+ // sum += abs(ref -pic)>>1
+ m1 = _mm_madd_pi16(m1, m_one);
+ m_sum = _mm_add_pi32 (m_sum, m1);
+ }
+ // mopup;
+ for (int x = stopX; x < width; ++x, ++diff_curr,ref_curr+=2)
+ {
+ CalcValueType temp = (ref_curr[0] + ref_curr[1] +
+ ref_curr[ref_stride] + ref_curr[ref_stride+1]+2)>>2;
+ mop_sum += std::abs ( (*diff_curr - temp)>>1 );
+ }
}
- }
- u_sum.m = m_sum;
- _mm_empty();
- return (u_sum.i[0] + u_sum.i[1] + mop_sum);
+ u_sum.m = m_sum;
+ _mm_empty();
+ return (u_sum.i[0] + u_sum.i[1] + mop_sum);
#else
- CalcValueType sum(0);
- for(int y = 0; y < height; ++y, ref_curr += ref_next)
- {
- for(int x = 0; x < width; ++x, ++diff_curr, ref_curr += 2)
+ CalcValueType sum(0);
+ for( int y=0; y < height; ++y, ref_curr+=ref_next )
{
- CalcValueType temp = (CalcValueType(ref_curr[0]) +
- CalcValueType(ref_curr[1]) +
- CalcValueType(ref_curr[ref_stride]) +
- CalcValueType(ref_curr[ref_stride+1]) +
- 2
- ) >> 2;
- sum += std::abs((*diff_curr - temp) >> 1);
- }// x
- }// y
- return sum;
+ for( int x=0; x < width; ++x, ++diff_curr, ref_curr+=2 )
+ {
+ CalcValueType temp = ( CalcValueType( ref_curr[0] ) +
+ CalcValueType( ref_curr[1] ) +
+ CalcValueType( ref_curr[ref_stride] ) +
+ CalcValueType( ref_curr[ref_stride+1] ) +
+ 2
+ ) >> 2;
+ sum += std::abs( (*diff_curr - temp)>>1 );
+ }// x
+ }// y
+ return sum;
#endif
- }
+ }
return 0;
-}
-
-inline void check_active_columns(
- int x, int xmax, ValueType act_cols1[4], ValueType *row1)
-{
- // check if we need any clipping
- if(x >= 0 && (x + 3) < xmax)
- {
- // special case, nothing to do
- memcpy(act_cols1, &row1[x], 4 * sizeof(ValueType));
}
- else if(x < 0)
+
+ inline void check_active_columns(
+ int x, int xmax, ValueType act_cols1[4],ValueType *row1)
{
- act_cols1[0] = row1[0];
- //act_cols1[1] = (x + 1) < 0 ? row1[0] : row1[x+1];
- //act_cols1[2] = (x + 2) < 0 ? row1[0] : row1[x+2];
- //act_cols1[3] = (x + 3) < 0 ? row1[0] : row1[x+3];
- for(int i = 1; i < 4; ++i)
+ // check if we need any clipping
+ if (x >= 0 && (x+3) < xmax) {
+ // special case, nothing to do
+ memcpy(act_cols1, &row1[x], 4 * sizeof(ValueType));
+ }
+ else if (x < 0)
{
- act_cols1[i] = (x + i) < 0 ? row1[0] : row1[x+i];
+ act_cols1[0] = row1[0];
+ //act_cols1[1] = (x + 1) < 0 ? row1[0] : row1[x+1];
+ //act_cols1[2] = (x + 2) < 0 ? row1[0] : row1[x+2];
+ //act_cols1[3] = (x + 3) < 0 ? row1[0] : row1[x+3];
+ for (int i = 1; i < 4; ++i)
+ {
+ act_cols1[i] = (x + i) < 0 ? row1[0] : row1[x+i];
+ }
}
- }
- else
- {
- for(int i = 0; i < 3; ++i)
+ else
{
- act_cols1[i] = (x + i) < xmax ? row1[x+i] : row1[xmax-1];
+ for (int i = 0; i < 3; ++i)
+ {
+ act_cols1[i] = (x + i) < xmax ? row1[x+i] : row1[xmax-1];
+ }
+ act_cols1[3] = row1[xmax-1];
}
- act_cols1[3] = row1[xmax-1];
}
-}
-
-CalcValueType bchk_simple_block_diff_mmx_4(
- const BlockDiffParams& dparams, const MVector& mv,
- const PicArray& pic_data, const PicArray& ref_data,
- CalcValueType i_best_sum)
-{
- u_mmx_val u_sum;
- u_mmx_val u_ref;
- u_sum.i[0] = u_sum.i[1] = 0;
-
- ValueType *src = &(pic_data[dparams.Yp()][dparams.Xp()]);
- ImageCoords ref_start(dparams.Xp() + mv.x, dparams.Yp() + mv.y);
-
- int height = dparams.Yl();
- int width = dparams.Xl();
- int stopX = (width >> 2) << 2;
- int pic_next = (pic_data.LengthX() - width);
- CalcValueType mop_sum = 0;
- for(int j = 0; j < height; j++)
+
+ CalcValueType bchk_simple_block_diff_mmx_4 (
+ const BlockDiffParams& dparams, const MVector& mv,
+ const PicArray& pic_data, const PicArray& ref_data,
+ CalcValueType i_best_sum)
{
- for(int i = 0; i < stopX; i += 4)
- {
- check_active_columns(ref_start.x + i, ref_data.LengthX(), u_ref.h, ref_data[BChk(ref_start.y+j, ref_data.LengthY())]);
- // pic - ref
- __m64 pic = _mm_sub_pi16(*(__m64 *)src, u_ref.m);
- // abs (pic - ref)
- u_ref.m = _mm_srai_pi16(pic, 15);
- pic = _mm_xor_si64(pic, u_ref.m);
- pic = _mm_sub_pi16(pic, u_ref.m);
- // sum += abs(pic -ref)
- u_ref.m = _mm_xor_si64(u_ref.m, u_ref.m);
- u_ref.m = _mm_unpackhi_pi16(pic, u_ref.m);
- pic = _mm_unpacklo_pi16(pic, pic);
- pic = _mm_srai_pi32(pic, 16);
- pic = _mm_add_pi32(pic, u_ref.m);
- u_sum.m = _mm_add_pi32(u_sum.m, pic);
- src += 4;
- }
- for(int i = stopX; i < width; i++)
+ u_mmx_val u_sum;
+ u_mmx_val u_ref;
+ u_sum.i[0] = u_sum.i[1]= 0;
+
+ ValueType *src = &(pic_data[dparams.Yp()][dparams.Xp()]);
+ ImageCoords ref_start(dparams.Xp()+mv.x, dparams.Yp()+mv.y);
+
+ int height = dparams.Yl();
+ int width = dparams.Xl();
+ int stopX = (width>>2)<<2;
+ int pic_next = (pic_data.LengthX() - width);
+ CalcValueType mop_sum = 0;
+ for (int j = 0; j < height; j++)
{
- mop_sum += std::abs(*src -
- ref_data[BChk(j+ref_start.y , ref_data.LengthY())][BChk(i+ref_start.x , ref_data.LengthX())]);
- src++;
- }
- if((u_sum.i[0] + u_sum.i[1] + mop_sum) >= i_best_sum)
- {
- _mm_empty();
- return i_best_sum;
+ for (int i = 0; i < stopX; i+=4)
+ {
+ check_active_columns(ref_start.x+i, ref_data.LengthX(), u_ref.h, ref_data[BChk(ref_start.y+j, ref_data.LengthY())]);
+ // pic - ref
+ __m64 pic = _mm_sub_pi16 (*(__m64 *)src, u_ref.m);
+ // abs (pic - ref)
+ u_ref.m = _mm_srai_pi16(pic, 15);
+ pic = _mm_xor_si64(pic, u_ref.m);
+ pic = _mm_sub_pi16 (pic, u_ref.m);
+ // sum += abs(pic -ref)
+ u_ref.m = _mm_xor_si64(u_ref.m, u_ref.m);
+ u_ref.m = _mm_unpackhi_pi16(pic, u_ref.m);
+ pic = _mm_unpacklo_pi16(pic, pic);
+ pic = _mm_srai_pi32 (pic, 16);
+ pic = _mm_add_pi32 (pic, u_ref.m);
+ u_sum.m = _mm_add_pi32 (u_sum.m, pic);
+ src += 4;
+ }
+ for (int i = stopX; i < width; i++)
+ {
+ mop_sum += std::abs(*src -
+ ref_data[BChk(j+ref_start.y , ref_data.LengthY())][BChk(i+ref_start.x , ref_data.LengthX())]);
+ src++;
+ }
+ if ((u_sum.i[0] + u_sum.i[1] + mop_sum) >= i_best_sum)
+ {
+ _mm_empty();
+ return i_best_sum;
+ }
+ src += pic_next;
}
- src += pic_next;
- }
- _mm_empty();
+ _mm_empty();
- return u_sum.i[0] + u_sum.i[1] + mop_sum;
-}
+ return u_sum.i[0] + u_sum.i[1] + mop_sum;
+ }
}
#endif
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.h
index 8d702dd6a..855fc4a75 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/me_utils_mmx.h
@@ -48,33 +48,33 @@
namespace dirac
{
-CalcValueType simple_block_diff_mmx_4(const BlockDiffParams& dparams, const MVector& mv, const PicArray& pic_data, const PicArray& ref_data, CalcValueType i_best_sum);
-CalcValueType simple_intra_block_diff_mmx_4(const BlockDiffParams& dparams, const PicArray& pic_data, ValueType &dc_val);
+ CalcValueType simple_block_diff_mmx_4(const BlockDiffParams& dparams, const MVector& mv, const PicArray& pic_data, const PicArray& ref_data, CalcValueType i_best_sum);
+ CalcValueType simple_intra_block_diff_mmx_4 ( const BlockDiffParams& dparams, const PicArray& pic_data, ValueType &dc_val);
-CalcValueType bchk_simple_block_diff_mmx_4(
- const BlockDiffParams& dparams, const MVector& mv,
- const PicArray& pic_data, const PicArray& ref_data,
- CalcValueType i_best_sum);
+ CalcValueType bchk_simple_block_diff_mmx_4 (
+ const BlockDiffParams& dparams, const MVector& mv,
+ const PicArray& pic_data, const PicArray& ref_data,
+ CalcValueType i_best_sum);
-float simple_block_diff_up_mmx_4(
- const PicArray& pic_data, const PicArray& ref_data,
- const ImageCoords& start_pos, const ImageCoords& end_pos,
- const ImageCoords& ref_start, const ImageCoords& ref_stop,
- const MVector& rmdr, float cost_so_far,
- float best_cost_so_far);
+ float simple_block_diff_up_mmx_4(
+ const PicArray& pic_data, const PicArray& ref_data,
+ const ImageCoords& start_pos, const ImageCoords& end_pos,
+ const ImageCoords& ref_start, const ImageCoords& ref_stop,
+ const MVector& rmdr, float cost_so_far,
+ float best_cost_so_far);
-void simple_biblock_diff_pic_mmx_4(
- const PicArray& pic_data, const PicArray& ref_data,
- TwoDArray<ValueType>& diff,
- const ImageCoords& start_pos, const ImageCoords& end_pos,
- const ImageCoords& ref_start, const ImageCoords& ref_stop,
- const MVector& rmdr);
+ void simple_biblock_diff_pic_mmx_4(
+ const PicArray& pic_data, const PicArray& ref_data,
+ TwoDArray<ValueType>& diff,
+ const ImageCoords& start_pos, const ImageCoords& end_pos,
+ const ImageCoords& ref_start, const ImageCoords& ref_stop,
+ const MVector& rmdr);
-CalcValueType simple_biblock_diff_up_mmx_4(
- const TwoDArray<ValueType>& diff_data, const PicArray& ref_data,
- const ImageCoords& ref_start, const ImageCoords& ref_stop,
- const MVector& rmdr);
+ CalcValueType simple_biblock_diff_up_mmx_4(
+ const TwoDArray<ValueType>& diff_data, const PicArray& ref_data,
+ const ImageCoords& ref_start, const ImageCoords& ref_stop,
+ const MVector& rmdr);
}
#endif /* HAVE_MMX */
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.cpp
index 48d7f9e10..bdde41891 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.cpp
@@ -46,44 +46,44 @@ using namespace dirac;
#include <cmath>
#include <vector>
-MotionEstimator::MotionEstimator(const EncoderParams& encp):
- m_encparams(encp)
+MotionEstimator::MotionEstimator( const EncoderParams& encp ):
+ m_encparams( encp )
{}
-void MotionEstimator::DoME(EncQueue& my_buffer, int pic_num)
+void MotionEstimator::DoME( EncQueue& my_buffer, int pic_num )
{
- MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
+ MEData& me_data = my_buffer.GetPicture( pic_num ).GetMEData();
const PictureParams& pparams = my_buffer.GetPicture(pic_num).GetPparams();
- // Step 1.
- //Initial search gives vectors for each reference accurate to 1 pixel
+ // Step 1.
+ //Initial search gives vectors for each reference accurate to 1 pixel
- PixelMatcher pix_match(m_encparams);
- pix_match.DoSearch(my_buffer , pic_num);
+ PixelMatcher pix_match( m_encparams );
+ pix_match.DoSearch( my_buffer , pic_num );
float lambda;
// Get the references
const std::vector<int>& refs = my_buffer.GetPicture(pic_num).GetPparams().Refs();
const int num_refs = refs.size();
- if(pparams.IsBPicture())
+ if ( pparams.IsBPicture())
lambda = m_encparams.L2MELambda();
else
lambda = m_encparams.L1MELambda();
// Set up the lambda to be used
- me_data.SetLambdaMap(num_refs , lambda);
+ me_data.SetLambdaMap( num_refs , lambda );
MVPrecisionType orig_prec = m_encparams.GetPicPredParams().MVPrecision();
- // Step 2.
+ // Step 2.
// Pixel accurate vectors are then refined to sub-pixel accuracy
- if(orig_prec != MV_PRECISION_PIXEL)
+ if (orig_prec != MV_PRECISION_PIXEL)
{
- SubpelRefine pelrefine(m_encparams);
- pelrefine.DoSubpel(my_buffer , pic_num);
+ SubpelRefine pelrefine( m_encparams );
+ pelrefine.DoSubpel( my_buffer , pic_num );
}
else
{
@@ -91,17 +91,17 @@ void MotionEstimator::DoME(EncQueue& my_buffer, int pic_num)
// Mutiplying the motion vectors by 2 and setting MV precision to
// HALF_PIXEL to implement pixel accurate motion estimate
MvArray &mv_arr1 = me_data.Vectors(1);
- for(int j = 0; j < mv_arr1.LengthY(); ++j)
+ for (int j = 0; j < mv_arr1.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr1.LengthX(); ++i)
+ for (int i = 0; i < mv_arr1.LengthX(); ++i)
mv_arr1[j][i] = mv_arr1[j][i] << 1;
}
- if(num_refs > 1)
+ if (num_refs > 1)
{
MvArray &mv_arr2 = me_data.Vectors(2);
- for(int j = 0; j < mv_arr2.LengthY(); ++j)
+ for (int j = 0; j < mv_arr2.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr2.LengthX(); ++i)
+ for (int i = 0; i < mv_arr2.LengthX(); ++i)
mv_arr2[j][i] = mv_arr2[j][i] << 1;
}
}
@@ -109,31 +109,31 @@ void MotionEstimator::DoME(EncQueue& my_buffer, int pic_num)
}
// Step3.
- // We now have to decide how each superblock should be split
+ // We now have to decide how each superblock should be split
// and which references should be used, and so on.
- ModeDecider my_mode_dec(m_encparams);
- my_mode_dec.DoModeDecn(my_buffer , pic_num);
-
- if(orig_prec == MV_PRECISION_PIXEL)
+ ModeDecider my_mode_dec( m_encparams );
+ my_mode_dec.DoModeDecn( my_buffer , pic_num );
+
+ if (orig_prec == MV_PRECISION_PIXEL)
{
// FIXME: HACK HACK
// Divide the motion vectors by 2 to convert back to pixel
// accurate motion vectors and reset MV precision to
- // PIXEL accuracy
+ // PIXEL accuracy
MvArray &mv_arr1 = me_data.Vectors(1);
- for(int j = 0; j < mv_arr1.LengthY(); ++j)
+ for (int j = 0; j < mv_arr1.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr1.LengthX(); ++i)
+ for (int i = 0; i < mv_arr1.LengthX(); ++i)
mv_arr1[j][i] = mv_arr1[j][i] >> 1;
}
- if(num_refs > 1)
+ if (num_refs > 1)
{
MvArray &mv_arr2 = me_data.Vectors(2);
- for(int j = 0; j < mv_arr2.LengthY(); ++j)
+ for (int j = 0; j < mv_arr2.LengthY(); ++j)
{
- for(int i = 0; i < mv_arr2.LengthX(); ++i)
- mv_arr2[j][i] = mv_arr2[j][i] >> 1;
+ for (int i = 0; i < mv_arr2.LengthX(); ++i)
+ mv_arr2[j][i] = mv_arr2[j][i]>>1;
}
}
m_encparams.GetPicPredParams().SetMVPrecision(MV_PRECISION_PIXEL);
@@ -143,40 +143,40 @@ void MotionEstimator::DoME(EncQueue& my_buffer, int pic_num)
// we have to assign DC values for chroma components for
// blocks we're decided are intra.
- SetChromaDC(my_buffer , pic_num);
+ SetChromaDC( my_buffer , pic_num );
//return false;
}
ValueType MotionEstimator::GetChromaBlockDC(const PicArray& pic_data,
- int xunit , int yunit , int split)
+ int xunit , int yunit , int split)
{
BlockDiffParams dparams;
- dparams.SetBlockLimits(m_encparams.GetPicPredParams().ChromaBParams(split) ,
- pic_data, xunit , yunit);
+ dparams.SetBlockLimits( m_encparams.GetPicPredParams().ChromaBParams( split ) ,
+ pic_data, xunit , yunit);
ValueType dc;
- IntraBlockDiff intradiff(pic_data);
+ IntraBlockDiff intradiff( pic_data );
- intradiff.Diff(dparams , dc);
+ intradiff.Diff( dparams , dc );
return dc;
}
-void MotionEstimator::SetChromaDC(const PicArray& pic_data , MEData& me_data , CompSort csort)
+void MotionEstimator::SetChromaDC( const PicArray& pic_data , MEData& me_data , CompSort csort )
{
// Lower limit of block coords in SB
- int xtl, ytl;
+ int xtl,ytl;
// Upper limit of block coords in SB
- int xbr, ybr;
+ int xbr,ybr;
- // Ditto, for subSBs
- int xsubSBtl, ysubSBtl;
- int xsubSBbr, ysubSBbr;
+ // Ditto, for subSBs
+ int xsubSBtl,ysubSBtl;
+ int xsubSBbr,ysubSBbr;
- TwoDArray<ValueType>& dcarray = me_data.DC(csort);
+ TwoDArray<ValueType>& dcarray = me_data.DC( csort );
ValueType dc = 0;
@@ -189,58 +189,58 @@ void MotionEstimator::SetChromaDC(const PicArray& pic_data , MEData& me_data , C
int level;
- for(int ysb = 0 ; ysb < me_data.SBSplit().LengthY() ; ++ysb)
+ for ( int ysb=0 ; ysb<me_data.SBSplit().LengthY() ; ++ysb )
{
- for(int xsb = 0 ; xsb < me_data.SBSplit().LengthX() ; ++xsb)
+ for ( int xsb=0 ; xsb<me_data.SBSplit().LengthX() ; ++xsb )
{
level = me_data.SBSplit()[ysb][xsb];
- xtl = xsb << 2;
- ytl = ysb << 2;
- xbr = xtl + 4;
- ybr = ytl + 4;
+ xtl = xsb<<2;
+ ytl = ysb<<2;
+ xbr = xtl+4;
+ ybr = ytl+4;
- xsubSBtl = xsb << 1;
- ysubSBtl = ysb << 1;
- xsubSBbr = xsubSBtl + 2;
- ysubSBbr = ysubSBtl + 2;
+ xsubSBtl = xsb<<1;
+ ysubSBtl = ysb<<1;
+ xsubSBbr = xsubSBtl+2;
+ ysubSBbr = ysubSBtl+2;
- for(int j = 0 ; j < (1 << level) ; ++j)
+ for (int j = 0 ; j<(1<<level) ;++j)
{
- for(int i = 0 ; i < (1 << level) ; ++i)
- {
- xunit = (xsb << level) + i;
- yunit = (ysb << level) + j;
+ for (int i = 0 ; i<(1<<level) ;++i)
+ {
+ xunit = ( xsb<<level ) + i;
+ yunit = ( ysb<<level ) + j;
- xstart = xunit << (2 - level);
- ystart = yunit << (2 - level);
+ xstart = xunit<<( 2-level );
+ ystart = yunit<<( 2-level );
- xend = xstart + (1 << (2 - level));
- yend = ystart + (1 << (2 - level));
+ xend = xstart + ( 1<<( 2-level ) );
+ yend = ystart + ( 1<<( 2-level ) );
- if(me_data.Mode()[ystart][xstart] == INTRA)
- // Get the DC value for the unit
- dc = GetChromaBlockDC(pic_data , xunit , yunit , level);
+ if ( me_data.Mode()[ystart][xstart] == INTRA )
+ // Get the DC value for the unit
+ dc = GetChromaBlockDC( pic_data , xunit , yunit , level );
- // Copy it into the corresponding blocks
- for(int q = ystart ; q < yend ; ++q)
- for(int p = xstart ; p < xend ; ++p)
- dcarray[q][p] = dc;
+ // Copy it into the corresponding blocks
+ for ( int q=ystart ; q< yend ; ++q )
+ for ( int p=xstart ; p< xend ; ++p )
+ dcarray[q][p] = dc;
- }// i
- }// j
+ }// i
+ }// j
}// xsb
}// ysb
}
-void MotionEstimator::SetChromaDC(EncQueue& my_buffer , int pic_num)
+void MotionEstimator::SetChromaDC( EncQueue& my_buffer , int pic_num )
{
- MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
- SetChromaDC(my_buffer.GetPicture(pic_num).OrigData(U_COMP) , me_data , U_COMP);
- SetChromaDC(my_buffer.GetPicture(pic_num).OrigData(V_COMP) , me_data , V_COMP);
+ MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
+ SetChromaDC( my_buffer.GetPicture( pic_num ).OrigData(U_COMP) , me_data , U_COMP );
+ SetChromaDC( my_buffer.GetPicture( pic_num ).OrigData(V_COMP) , me_data , V_COMP );
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.h
index 18b07b448..10129dd3e 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/motion_estimate.h
@@ -43,63 +43,62 @@
namespace dirac
{
-class EncQueue;
-
-
-//! Class to handle the whole motion estimation process.
-/*!
-
- Class to handle the whole motion estimation process, which works in
- three stages.
-
- First a pixel-accurate estimate is formed by looking at the current
- picture data and the data from the reference picture(s). Motion vectors
- are found for every block.
-
- Second, these pixel-accurate motion vectors are refined to sub-pixel
- accuracy. This means some sort of upconversion needs to be applied to
- the reference. This can be done by actually upconverting the reference
- to create a bigger picture or by doing some interpolation of values
- on the fly.
-
- Third, mode decisions have to be made. This means choosing which (if
- any) reference to use for each block, and whether to use the same
- motion vectors for groups of blocks together. A 2x2 group of blocks is
- called a sub-MB and a 4x4 group of blocks is a MB (Macroblock). All
- the MV data is organised by MB.
-*/
-class MotionEstimator
-{
-public:
- //! Constructor
- MotionEstimator(const EncoderParams& encp);
- //! Destructor
- ~MotionEstimator() {}
-
- //! Do the motion estimation
- void DoME(EncQueue& my_buffer , int pic_num);
-
-private:
- //! Copy constructor: private, body-less - class should not be copied
- MotionEstimator(const MotionEstimator& cpy);
-
- //! Assignment= : //private, body-less - class should not be assigned
- MotionEstimator& operator=(const MotionEstimator& rhs);
-
- //! Go through all the intra blocks and extract the chroma dc values to be coded
- void SetChromaDC(EncQueue& my_buffer, int pic_num);
-
- //! Called by previous fn for each component
- void SetChromaDC(const PicArray& pic_data, MEData& me_data, CompSort csort);
-
- //! Called by previous fn for each block
- ValueType GetChromaBlockDC(const PicArray& pic_data, int xloc, int yloc, int split);
-
- // Member variables
-
- //! A local reference to the encoder parameters
- const EncoderParams& m_encparams;
-};
+ class EncQueue;
+
+
+ //! Class to handle the whole motion estimation process.
+ /*!
+
+ Class to handle the whole motion estimation process, which works in
+ three stages.
+
+ First a pixel-accurate estimate is formed by looking at the current
+ picture data and the data from the reference picture(s). Motion vectors
+ are found for every block.
+
+ Second, these pixel-accurate motion vectors are refined to sub-pixel
+ accuracy. This means some sort of upconversion needs to be applied to
+ the reference. This can be done by actually upconverting the reference
+ to create a bigger picture or by doing some interpolation of values
+ on the fly.
+
+ Third, mode decisions have to be made. This means choosing which (if
+ any) reference to use for each block, and whether to use the same
+ motion vectors for groups of blocks together. A 2x2 group of blocks is
+ called a sub-MB and a 4x4 group of blocks is a MB (Macroblock). All
+ the MV data is organised by MB.
+ */
+ class MotionEstimator{
+ public:
+ //! Constructor
+ MotionEstimator( const EncoderParams& encp );
+ //! Destructor
+ ~MotionEstimator(){}
+
+ //! Do the motion estimation
+ void DoME( EncQueue& my_buffer , int pic_num );
+
+ private:
+ //! Copy constructor: private, body-less - class should not be copied
+ MotionEstimator( const MotionEstimator& cpy );
+
+ //! Assignment= : //private, body-less - class should not be assigned
+ MotionEstimator& operator=( const MotionEstimator& rhs );
+
+ //! Go through all the intra blocks and extract the chroma dc values to be coded
+ void SetChromaDC( EncQueue& my_buffer, int pic_num);
+
+ //! Called by previous fn for each component
+ void SetChromaDC(const PicArray& pic_data, MEData& me_data,CompSort csort);
+
+ //! Called by previous fn for each block
+ ValueType GetChromaBlockDC(const PicArray& pic_data, int xloc,int yloc,int split);
+
+ // Member variables
+
+ //! A local reference to the encoder parameters
+ const EncoderParams& m_encparams;
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.cpp b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.cpp
index 652f75fad..7ac7f74ed 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.cpp
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.cpp
@@ -51,34 +51,34 @@ using namespace dirac;
using std::vector;
using std::log;
-PixelMatcher::PixelMatcher(const EncoderParams& encp):
+PixelMatcher::PixelMatcher( const EncoderParams& encp):
m_encparams(encp)
{}
-void PixelMatcher::DoSearch(EncQueue& my_buffer, int pic_num)
+void PixelMatcher::DoSearch( EncQueue& my_buffer, int pic_num )
{
- m_predparams = &(my_buffer.GetPicture(pic_num).GetMEData().GetPicPredParams());
+ m_predparams = &(my_buffer.GetPicture(pic_num).GetMEData().GetPicPredParams() );
//does an initial search using hierarchical matching to get guide vectors
// Picture numbers of references
- int ref1, ref2;
+ int ref1,ref2;
// Use the luminance only for motion estimating
- const PicArray& pic_data = my_buffer.GetPicture(pic_num).DataForME(m_encparams.CombinedME());
+ const PicArray& pic_data = my_buffer.GetPicture( pic_num ).DataForME(m_encparams.CombinedME());
- const vector<int>& refs = my_buffer.GetPicture(pic_num).GetPparams().Refs();
+ const vector<int>& refs = my_buffer.GetPicture( pic_num ).GetPparams().Refs();
ref1 = refs[0];
- if(refs.size() > 1)
+ if (refs.size()>1)
ref2 = refs[1];
else
ref2 = ref1;
// Record temporal distances
- m_tdiff[0] = std::abs(ref1 - pic_num);
- m_tdiff[1] = std::abs(ref2 - pic_num);
+ m_tdiff[0] = std::abs( ref1 - pic_num );
+ m_tdiff[1] = std::abs( ref2 - pic_num );
// Obtain C++ references to the reference picture luma components
const PicArray& ref1_data = my_buffer.GetPicture(ref1).DataForME(m_encparams.CombinedME());
@@ -88,70 +88,70 @@ void PixelMatcher::DoSearch(EncQueue& my_buffer, int pic_num)
m_psort = my_buffer.GetPicture(pic_num).GetPparams().PicSort();
- if(m_encparams.FullSearch() == false)
+ if ( m_encparams.FullSearch() == false )
{
// Set the number of downconversion levels - not too many or we run out of picture!
- m_depth = (int) std::min(log(((double) pic_data.LengthX()) / 12.0) / log(2.0) ,
- log(((double) pic_data.LengthY()) / 12.0) / log(2.0));
+ m_depth = ( int) std::min( log(((double) pic_data.LengthX())/12.0)/log(2.0) ,
+ log(((double) pic_data.LengthY())/12.0)/log(2.0) );
// These arrays will contain the downconverted picture and MvData hierarchy
- OneDArray<PicArray*> ref1_down(Range(1 , m_depth));
- OneDArray<PicArray*> ref2_down(Range(1 , m_depth));
- OneDArray<PicArray*> pic_down(Range(1 , m_depth));
- OneDArray<MEData*> me_data_set(Range(1 , m_depth));
+ OneDArray<PicArray*> ref1_down( Range( 1 , m_depth ) );
+ OneDArray<PicArray*> ref2_down( Range( 1 , m_depth ) );
+ OneDArray<PicArray*> pic_down( Range( 1 , m_depth ) );
+ OneDArray<MEData*> me_data_set( Range( 1 , m_depth ) );
// Populate the hierarchies
- MakePicHierarchy(pic_data , pic_down);
- MakePicHierarchy(ref1_data , ref1_down);
- if(ref1 != ref2)
- MakePicHierarchy(ref2_data , ref2_down);
+ MakePicHierarchy( pic_data , pic_down );
+ MakePicHierarchy( ref1_data , ref1_down );
+ if (ref1 != ref2)
+ MakePicHierarchy( ref2_data , ref2_down );
- MakeMEDataHierarchy(pic_down , me_data_set);
+ MakeMEDataHierarchy( pic_down , me_data_set );
- // Now do the work! //
+ // Now do the work! //
//////////////////////
// Start with motion estimating at the very lowest level
m_level = m_depth;
- MatchPic(*(pic_down[m_depth]) , *(ref1_down[m_depth]) , *(me_data_set[m_depth]) ,
- *(me_data_set[m_depth]) , 1);
- if(ref1 != ref2)
- MatchPic(*(pic_down[m_depth]) , *(ref2_down[m_depth]) , *(me_data_set[m_depth]) ,
- *(me_data_set[m_depth]) , 2);
+ MatchPic( *(pic_down[m_depth]) , *(ref1_down[m_depth]) , *(me_data_set[m_depth]) ,
+ *(me_data_set[m_depth]) , 1 );
+ if ( ref1 != ref2 )
+ MatchPic( *(pic_down[m_depth]) , *(ref2_down[m_depth]) , *(me_data_set[m_depth]) ,
+ *(me_data_set[m_depth]) , 2 );
- // Do the intervening levels - here we can have a genuine set of guide vectors
- for(m_level = m_depth - 1 ; m_level >= 1 ; --m_level)
+ // Do the intervening levels - here we can have a genuine set of guide vectors
+ for ( m_level=m_depth-1 ; m_level>=1 ; --m_level )
{
- MatchPic(*(pic_down[m_level]) , *(ref1_down[m_level]) , *(me_data_set[m_level]) ,
- *(me_data_set[m_level+1]) , 1);
- if(ref1 != ref2)
- MatchPic(*(pic_down[m_level]) , *(ref2_down[m_level]) , *(me_data_set[m_level]) ,
- *(me_data_set[m_level+1]) , 2);
+ MatchPic( *(pic_down[m_level]) , *(ref1_down[m_level]) , *(me_data_set[m_level]) ,
+ *(me_data_set[m_level+1]) , 1 );
+ if (ref1!=ref2)
+ MatchPic( *(pic_down[m_level]) , *(ref2_down[m_level]) , *(me_data_set[m_level]) ,
+ *(me_data_set[m_level+1]) , 2 );
}// level
// Finally, do the top level, with the pictures themselves
m_level = 0;
- MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
- MatchPic(pic_data , ref1_data, me_data , *(me_data_set[1]) , 1);
- if(ref1 != ref2)
- MatchPic(pic_data , ref2_data , me_data , *(me_data_set[1]) , 2);
+ MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
+ MatchPic( pic_data , ref1_data, me_data , *(me_data_set[1]) , 1 );
+ if ( ref1 != ref2 )
+ MatchPic( pic_data , ref2_data , me_data , *(me_data_set[1]) , 2 );
// Now we're finished, tidy everything up ...
- TidyPics(pic_down);
- TidyPics(ref1_down);
- if(ref1 != ref2)
- TidyPics(ref2_down);
- TidyMEData(me_data_set);
+ TidyPics( pic_down );
+ TidyPics( ref1_down );
+ if (ref1 != ref2)
+ TidyPics( ref2_down );
+ TidyMEData( me_data_set );
}
else
{
m_depth = 0;
m_level = 0;
- MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
- MatchPic(pic_data , ref1_data, me_data , me_data , 1);
- if(ref1 != ref2)
- MatchPic(pic_data , ref2_data , me_data , me_data , 2);
+ MEData& me_data = my_buffer.GetPicture(pic_num).GetMEData();
+ MatchPic( pic_data , ref1_data, me_data , me_data , 1 );
+ if ( ref1 != ref2 )
+ MatchPic( pic_data , ref2_data , me_data , me_data , 2 );
}
}
@@ -164,26 +164,26 @@ void PixelMatcher::MakePicHierarchy(const PicArray& data ,
// Allocate
int scale_factor = 1;
- for(int i = 1 ; i <= m_depth; ++i)
+ for (int i=1 ; i<=m_depth;++i)
{
// Dimensions of pic_down[i] will be shrunk by a factor 2**i
- scale_factor *= 2;
- down_data[i] = new PicArray(data.LengthY() / scale_factor , data.LengthX() / scale_factor);
+ scale_factor*=2;
+ down_data[i] = new PicArray( data.LengthY()/scale_factor , data.LengthX()/scale_factor);
}
//do all the downconversions
- if(m_depth > 0)
+ if (m_depth>0)
{
- mydcon.DoDownConvert(data , *(down_data[1]));
+ mydcon.DoDownConvert( data , *(down_data[1]) );
- for(int i = 1 ; i < m_depth ; ++i)
- mydcon.DoDownConvert(*(down_data[i]) , *(down_data[i+1]));
+ for (int i=1 ; i<m_depth ; ++i)
+ mydcon.DoDownConvert( *(down_data[i]) , *(down_data[i+1]) );
}
}
void PixelMatcher::MakeMEDataHierarchy(const OneDArray< PicArray*>& down_data,
- OneDArray< MEData* >& me_data_set)
+ OneDArray< MEData* >& me_data_set )
{
int xnumblocks , ynumblocks;
@@ -199,38 +199,38 @@ void PixelMatcher::MakeMEDataHierarchy(const OneDArray< PicArray*>& down_data,
PicturePredParams predparams = *m_predparams;
predparams.SetXNumSB(0);
predparams.SetYNumSB(0);
- for(int i = 1 ; i <= m_depth; ++i)
+ for (int i=1 ; i<=m_depth;++i)
{
- xnumblocks = xnumblocks >> 1;
- ynumblocks = ynumblocks >> 1;
+ xnumblocks = xnumblocks>>1;
+ ynumblocks = ynumblocks>>1;
- if((down_data[i]->LengthX()) % bparams.Xbsep() != 0)
+ if (( down_data[i]->LengthX() )%bparams.Xbsep() != 0)
xnumblocks++;
- if((down_data[i]->LengthY()) % bparams.Ybsep() != 0)
+ if (( down_data[i]->LengthY() )%bparams.Ybsep() != 0)
ynumblocks++;
- predparams.SetXNumBlocks(xnumblocks);
- predparams.SetYNumBlocks(ynumblocks);
+ predparams.SetXNumBlocks( xnumblocks );
+ predparams.SetYNumBlocks( ynumblocks );
- me_data_set[i] = new MEData(predparams, 2);
+ me_data_set[i] = new MEData( predparams, 2 );
}// i
}
-void PixelMatcher::TidyPics(OneDArray< PicArray*>& down_data)
+void PixelMatcher::TidyPics( OneDArray< PicArray*>& down_data )
{
- for(int i = 1 ; i <= m_depth ; ++i)
+ for (int i=1 ; i <= m_depth ; ++i)
{
delete down_data[i];
}// i
}
-void PixelMatcher::TidyMEData(OneDArray< MEData*>& me_data_set)
+void PixelMatcher::TidyMEData( OneDArray< MEData*>& me_data_set )
{
- for(int i = 1 ; i <= m_depth ; ++i)
+ for (int i=1 ; i <= m_depth ; ++i)
{
delete me_data_set[i];
}// i
@@ -246,17 +246,17 @@ void PixelMatcher::MatchPic(const PicArray& pic_data , const PicArray& ref_data
// Initialisation //
////////////////////
- m_big_xr = std::min(m_tdiff[ref_id-1], 3) * m_encparams.XRangeME();
- m_big_yr = std::min(m_tdiff[ref_id-1], 3) * m_encparams.YRangeME();
+ m_big_xr = std::min( m_tdiff[ref_id-1], 3 )*m_encparams.XRangeME();
+ m_big_yr = std::min( m_tdiff[ref_id-1], 3 )*m_encparams.YRangeME();
// Set the search ranges according to the level
- if(m_encparams.FullSearch() == false)
+ if ( m_encparams.FullSearch() == false )
{
m_cost_mean = 0.0;
m_cost_mean_sq = 0.0;
- m_xr = std::min(m_level + 1, 5);
- m_yr = std::min(m_level + 1, 5);
+ m_xr = std::min( m_level+1, 5);
+ m_yr = std::min( m_level+1, 5);
}
else
{
@@ -266,14 +266,14 @@ void PixelMatcher::MatchPic(const PicArray& pic_data , const PicArray& ref_data
// Provide aliases for the appropriate motion vector data components
- MvArray& mv_array = me_data.Vectors(ref_id);
- const MvArray& guide_array = guide_data.Vectors(ref_id);
- TwoDArray<MvCostData>& pred_costs = me_data.PredCosts(ref_id);
+ MvArray& mv_array = me_data.Vectors( ref_id );
+ const MvArray& guide_array = guide_data.Vectors( ref_id );
+ TwoDArray<MvCostData>& pred_costs = me_data.PredCosts( ref_id );
// Initialise the arrays
- for(int y = 0; y < mv_array.LengthY(); ++y)
+ for (int y=0; y<mv_array.LengthY(); ++y)
{
- for(int x = 0; x < mv_array.LengthX(); ++x)
+ for (int x=0; x<mv_array.LengthX(); ++x)
{
mv_array[y][x].x = 0;
mv_array[y][x].y = 0;
@@ -282,9 +282,9 @@ void PixelMatcher::MatchPic(const PicArray& pic_data , const PicArray& ref_data
}// y
// Provide a block matching object to do the work
- BlockMatcher my_bmatch(pic_data , ref_data ,
- m_predparams->LumaBParams(2) , m_predparams->MVPrecision() ,
- mv_array , pred_costs);
+ BlockMatcher my_bmatch( pic_data , ref_data ,
+ m_predparams->LumaBParams(2) , m_predparams->MVPrecision() ,
+ mv_array , pred_costs );
// Do the work - loop over all the blocks, finding the best match //
////////////////////////////////////////////////////////////////////
@@ -299,9 +299,9 @@ void PixelMatcher::MatchPic(const PicArray& pic_data , const PicArray& ref_data
// Make a zero-based list that is always used
m_cand_list.clear();
- MVector zero_mv(0 , 0);
+ MVector zero_mv( 0 , 0 );
- AddNewVlist(m_cand_list , zero_mv , m_xr , m_yr);
+ AddNewVlist( m_cand_list , zero_mv , m_xr , m_yr);
// Now loop over the blocks and find the best matches.
// The loop is unrolled because predictions are different at picture edges.
@@ -316,34 +316,34 @@ void PixelMatcher::MatchPic(const PicArray& pic_data , const PicArray& ref_data
DoBlock(0, 0 , guide_array , my_bmatch);
// The rest of the first row
- for(int xpos = 1 ; xpos < mv_array.LengthX() ; ++xpos)
+ for ( int xpos=1 ; xpos<mv_array.LengthX() ; ++xpos )
{
m_mv_prediction = mv_array[0][xpos-1];
DoBlock(xpos, 0 , guide_array , my_bmatch);
}// xpos
// All the remaining rows except the last
- for(int ypos = 1 ; ypos < mv_array.LengthY() ; ++ypos)
+ for ( int ypos=1 ; ypos<mv_array.LengthY() ; ++ypos )
{
// The first element of each row
m_mv_prediction = mv_array[ypos-1][0];
- DoBlock(0, ypos , guide_array , my_bmatch);
+ DoBlock(0, ypos , guide_array , my_bmatch );
- // The middle elements of each row
- for(int xpos = 1 ; xpos < mv_array.LastX() ; ++xpos)
+ // The middle elements of each row
+ for ( int xpos=1 ; xpos<mv_array.LastX() ; ++xpos )
{
- m_mv_prediction = MvMedian(mv_array[ypos][xpos-1],
- mv_array[ypos-1][xpos],
- mv_array[ypos-1][xpos+1]);
- DoBlock(xpos, ypos , guide_array , my_bmatch);
+ m_mv_prediction = MvMedian( mv_array[ypos][xpos-1],
+ mv_array[ypos-1][xpos],
+ mv_array[ypos-1][xpos+1]);
+ DoBlock(xpos, ypos , guide_array , my_bmatch );
}// xpos
- // The last element in each row
- m_mv_prediction = MvMean(mv_array[ypos-1][ mv_array.LastX()],
- mv_array[ypos][ mv_array.LastX()-1 ]);
- DoBlock(mv_array.LastX() , ypos , guide_array , my_bmatch);
+ // The last element in each row
+ m_mv_prediction = MvMean( mv_array[ypos-1][ mv_array.LastX() ],
+ mv_array[ypos][ mv_array.LastX()-1 ]);
+ DoBlock(mv_array.LastX() , ypos , guide_array , my_bmatch );
}//ypos
}
@@ -355,26 +355,26 @@ void PixelMatcher::DoBlock(const int xpos, const int ypos ,
// Find the best match for each block ...
// Use guide from lower down if one exists
- if(m_level < m_depth)
+ if ( m_level<m_depth )
{
- int xdown = BChk(xpos >> 1, guide_array.LengthX());
- int ydown = BChk(ypos >> 1, guide_array.LengthY());
- AddNewVlist(m_cand_list , guide_array[ydown][xdown] * 2 , m_xr , m_yr);
+ int xdown = BChk(xpos>>1, guide_array.LengthX());
+ int ydown = BChk(ypos>>1, guide_array.LengthY());
+ AddNewVlist( m_cand_list , guide_array[ydown][xdown] * 2 , m_xr , m_yr );
}
// use the spatial prediction, also, as a guide
- if(m_encparams.FullSearch() == false)
- AddNewVlist(m_cand_list , m_mv_prediction , m_xr , m_yr);
+ if (m_encparams.FullSearch()==false )
+ AddNewVlist( m_cand_list , m_mv_prediction , m_xr , m_yr );
else
- AddNewVlist(m_cand_list , m_mv_prediction , 1 , 1);
+ AddNewVlist( m_cand_list , m_mv_prediction , 1 , 1);
// Find the best motion vector //
/////////////////////////////////
- block_match.FindBestMatchPel(xpos , ypos , m_cand_list, m_mv_prediction, 0);
+ block_match.FindBestMatchPel( xpos , ypos , m_cand_list, m_mv_prediction, 0 );
// Reset the lists ready for the next block (don't erase the first sublist as
// this is a neighbourhood of zero, which we always look at)
- m_cand_list.erase(m_cand_list.begin() + 1 , m_cand_list.end());
+ m_cand_list.erase( m_cand_list.begin()+1 , m_cand_list.end() );
}
diff --git a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.h b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.h
index 15a9f61ae..f860882fb 100644
--- a/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.h
+++ b/src/filters/parser/DiracSplitter/libdirac/libdirac_motionest/pixel_match.h
@@ -57,100 +57,100 @@
#include <libdirac_motionest/block_match.h>
namespace dirac
{
-class EncQueue;
-class MvData;
-class EncoderParams;
-class PicArray;
+ class EncQueue;
+ class MvData;
+ class EncoderParams;
+ class PicArray;
-class PixelMatcher
-{
-public:
-
- //! Constructor
- PixelMatcher(const EncoderParams& encp);
-
- //! Do the actual search
- /* Do the searching.
-
- \param my_buffer the buffer of pictures from which pictures are taken
- \param pic_num the number of the picture for which motion is to be estimated
- \param mv_data class in which the measured motion vectors are stored, together with costs
-
- */
- void DoSearch(EncQueue& my_buffer, int pic_num);
-
-private:
-
- // Member variables
-
- //! Local reference to the encoder params
- const EncoderParams& m_encparams;
+ class PixelMatcher
+ {
+ public:
- //! Local reference to the picture pred params
- const PicturePredParams* m_predparams;
+ //! Constructor
+ PixelMatcher( const EncoderParams& encp);
- // the depth of the hierarchical match
- int m_depth;
+ //! Do the actual search
+ /* Do the searching.
- // the level we're at (from 0 to depth)
- int m_level;
+ \param my_buffer the buffer of pictures from which pictures are taken
+ \param pic_num the number of the picture for which motion is to be estimated
+ \param mv_data class in which the measured motion vectors are stored, together with costs
+
+ */
+ void DoSearch( EncQueue& my_buffer, int pic_num );
- // the search-range sizes for the hierarchical match
- int m_xr, m_yr;
+ private:
- // the search-range sizes for when hierarchical match fails
- int m_big_xr, m_big_yr;
+ // Member variables
- // the temporal distances to the reference pictures
- int m_tdiff[2];
+ //! Local reference to the encoder params
+ const EncoderParams& m_encparams;
- // the picture sort - I, L1 or L2
- PictureSort m_psort;
+ //! Local reference to the picture pred params
+ const PicturePredParams* m_predparams;
- // list of candidate vectors for checking
- CandidateList m_cand_list;
+ // the depth of the hierarchical match
+ int m_depth;
- // Prediction used for each block. This is derived from neighbouring blocks
- // and is used to control the variation in the motion vector field.
- MVector m_mv_prediction;
+ // the level we're at (from 0 to depth)
+ int m_level;
- // The value used in computing block cost means with a simple recursive filter
- double m_rho;
+ // the search-range sizes for the hierarchical match
+ int m_xr, m_yr;
+
+ // the search-range sizes for when hierarchical match fails
+ int m_big_xr, m_big_yr;
+
+ // the temporal distances to the reference pictures
+ int m_tdiff[2];
- // The mean of the block cost
- double m_cost_mean;
+ // the picture sort - I, L1 or L2
+ PictureSort m_psort;
- // The mean of the square of the block cost
- double m_cost_mean_sq;
+ // list of candidate vectors for checking
+ CandidateList m_cand_list;
-private:
+ // Prediction used for each block. This is derived from neighbouring blocks
+ // and is used to control the variation in the motion vector field.
+ MVector m_mv_prediction;
+
+ // The value used in computing block cost means with a simple recursive filter
+ double m_rho;
+
+ // The mean of the block cost
+ double m_cost_mean;
+
+ // The mean of the square of the block cost
+ double m_cost_mean_sq;
+
+ private:
- // Functions
+ // Functions
- //! Make down-converted pictures
- void MakePicHierarchy(const PicArray& data, OneDArray< PicArray* >& down_data);
+ //! Make down-converted pictures
+ void MakePicHierarchy(const PicArray& data, OneDArray< PicArray* >& down_data);
- //! Make a hierarchy of MvData structures
- void MakeMEDataHierarchy(const OneDArray< PicArray*>& down_data,
- OneDArray< MEData* >& me_data_set);
+ //! Make a hierarchy of MvData structures
+ void MakeMEDataHierarchy(const OneDArray< PicArray*>& down_data,
+ OneDArray< MEData* >& me_data_set );
- //! Tidy up the allocations made in building the picture hirearchy
- void TidyPics(OneDArray< PicArray*>& down_data);
+ //! Tidy up the allocations made in building the picture hirearchy
+ void TidyPics( OneDArray< PicArray*>& down_data );
- //! Tidy up the allocations made in building the MV data hirearchy
- void TidyMEData(OneDArray< MEData*>& me_data_set);
+ //! Tidy up the allocations made in building the MV data hirearchy
+ void TidyMEData( OneDArray< MEData*>& me_data_set );
- //! Match the picture data
- void MatchPic(const PicArray& ref_data , const PicArray& pic_data , MEData& me_data ,
- const MvData& guide_data, const int ref_id);
+ //! Match the picture data
+ void MatchPic(const PicArray& ref_data , const PicArray& pic_data , MEData& me_data ,
+ const MvData& guide_data, const int ref_id);
- //! Do a given block
- void DoBlock(const int xpos, const int ypos ,
- const MvArray& guide_array,
- BlockMatcher& block_match);
+ //! Do a given block
+ void DoBlock(const int xpos, const int ypos ,
+ const MvArray& guide_array,
+ BlockMatcher& block_match);
-};
+ };
} // namespace dirac
diff --git a/src/filters/parser/DiracSplitter/resource.h b/src/filters/parser/DiracSplitter/resource.h
index 2436d0286..bdcfbe8c4 100644
--- a/src/filters/parser/DiracSplitter/resource.h
+++ b/src/filters/parser/DiracSplitter/resource.h
@@ -4,7 +4,7 @@
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/DiracSplitter/stdafx.cpp b/src/filters/parser/DiracSplitter/stdafx.cpp
index 58d59d65a..8d2e22fce 100644
--- a/src/filters/parser/DiracSplitter/stdafx.cpp
+++ b/src/filters/parser/DiracSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/DiracSplitter/stdafx.h b/src/filters/parser/DiracSplitter/stdafx.h
index 5a1eb906e..b76a35484 100644
--- a/src/filters/parser/DiracSplitter/stdafx.h
+++ b/src/filters/parser/DiracSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -62,18 +62,18 @@ using namespace dirac;
// === Imported from Dirac library
#define isFrameStartCode(c) ((c) == 0x00 || (c) == 0x0C || (c) == 0x08 || (c) == 0x0D || (c) == 0x0E || (c) == 0x09 || (c) == 0x0A || (c) == 0x10)
-const unsigned int START_CODE_PREFIX = 0x42424344; //BBCD
-const unsigned int START_CODE_PREFIX_BYTE0 =
- (START_CODE_PREFIX >> 24) & 0xFF;
-const unsigned int START_CODE_PREFIX_BYTE1 =
- (START_CODE_PREFIX >> 16) & 0xFF;
-const unsigned int START_CODE_PREFIX_BYTE2 =
- (START_CODE_PREFIX >> 8) & 0xFF;
-const unsigned int START_CODE_PREFIX_BYTE3 =
- START_CODE_PREFIX & 0xFF;
-
-//! Access unit start code
-const unsigned char AU_START_CODE = 0x00;
-//! Sequence end code
-const unsigned char SEQ_END_CODE = 0x10;
+ const unsigned int START_CODE_PREFIX = 0x42424344; //BBCD
+ const unsigned int START_CODE_PREFIX_BYTE0 =
+ (START_CODE_PREFIX >> 24) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE1 =
+ (START_CODE_PREFIX >> 16) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE2 =
+ (START_CODE_PREFIX >> 8) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE3 =
+ START_CODE_PREFIX & 0xFF;
+
+ //! Access unit start code
+ const unsigned char AU_START_CODE = 0x00;
+ //! Sequence end code
+ const unsigned char SEQ_END_CODE = 0x10;
diff --git a/src/filters/parser/FLVSplitter/FLVSplitter.cpp b/src/filters/parser/FLVSplitter/FLVSplitter.cpp
index a90d373bf..98fdbcbef 100644
--- a/src/filters/parser/FLVSplitter/FLVSplitter.cpp
+++ b/src/filters/parser/FLVSplitter/FLVSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,49 +30,49 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_FLV},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_FLV},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut2[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CFLVSplitterFilter), L"MPC - FLV Splitter (Gabest)", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CFLVSourceFilter), L"MPC - FLV Source (Gabest)", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CFLVSplitterFilter), L"MPC - FLV Splitter (Gabest)", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CFLVSourceFilter), L"MPC - FLV Source (Gabest)", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFLVSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CFLVSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFLVSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CFLVSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".flv"));
+ DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".flv"));
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_FLV, _T("0,4,,464C5601"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_FLV, _T("0,4,,464C5601"), NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_FLV);
+ UnRegisterSourceFilter(MEDIASUBTYPE_FLV);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -86,705 +86,659 @@ CFilterApp theApp;
//
CFLVSplitterFilter::CFLVSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CFLVSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CFLVSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
bool CFLVSplitterFilter::ReadTag(Tag& t)
{
- if(m_pFile->GetRemaining() < 15)
- return false;
+ if(m_pFile->GetRemaining() < 15)
+ return false;
- t.PreviousTagSize = (UINT32)m_pFile->BitRead(32);
- t.TagType = (BYTE)m_pFile->BitRead(8);
- t.DataSize = (UINT32)m_pFile->BitRead(24);
- t.TimeStamp = (UINT32)m_pFile->BitRead(24);
- t.TimeStamp |= (UINT32)m_pFile->BitRead(8) << 24;
- t.StreamID = (UINT32)m_pFile->BitRead(24);
+ t.PreviousTagSize = (UINT32)m_pFile->BitRead(32);
+ t.TagType = (BYTE)m_pFile->BitRead(8);
+ t.DataSize = (UINT32)m_pFile->BitRead(24);
+ t.TimeStamp = (UINT32)m_pFile->BitRead(24);
+ t.TimeStamp |= (UINT32)m_pFile->BitRead(8) << 24;
+ t.StreamID = (UINT32)m_pFile->BitRead(24);
- return m_pFile->GetRemaining() >= t.DataSize;
+ return m_pFile->GetRemaining() >= t.DataSize;
}
bool CFLVSplitterFilter::ReadTag(AudioTag& at)
{
- if(!m_pFile->GetRemaining())
- return false;
+ if(!m_pFile->GetRemaining())
+ return false;
- at.SoundFormat = (BYTE)m_pFile->BitRead(4);
- at.SoundRate = (BYTE)m_pFile->BitRead(2);
- at.SoundSize = (BYTE)m_pFile->BitRead(1);
- at.SoundType = (BYTE)m_pFile->BitRead(1);
+ at.SoundFormat = (BYTE)m_pFile->BitRead(4);
+ at.SoundRate = (BYTE)m_pFile->BitRead(2);
+ at.SoundSize = (BYTE)m_pFile->BitRead(1);
+ at.SoundType = (BYTE)m_pFile->BitRead(1);
- return true;
+ return true;
}
bool CFLVSplitterFilter::ReadTag(VideoTag& vt)
{
- if(!m_pFile->GetRemaining())
- return false;
+ if(!m_pFile->GetRemaining())
+ return false;
- vt.FrameType = (BYTE)m_pFile->BitRead(4);
- vt.CodecID = (BYTE)m_pFile->BitRead(4);
+ vt.FrameType = (BYTE)m_pFile->BitRead(4);
+ vt.CodecID = (BYTE)m_pFile->BitRead(4);
- return true;
+ return true;
}
#ifndef NOVIDEOTWEAK
bool CFLVSplitterFilter::ReadTag(VideoTweak& vt)
{
- if(!m_pFile->GetRemaining())
- return false;
+ if(!m_pFile->GetRemaining())
+ return false;
- vt.x = (BYTE)m_pFile->BitRead(4);
- vt.y = (BYTE)m_pFile->BitRead(4);
+ vt.x = (BYTE)m_pFile->BitRead(4);
+ vt.y = (BYTE)m_pFile->BitRead(4);
- return true;
+ return true;
}
#endif
bool CFLVSplitterFilter::Sync(__int64& pos)
{
- m_pFile->Seek(pos);
-
- while(m_pFile->GetRemaining() >= 15)
- {
- __int64 limit = m_pFile->GetRemaining();
- while(true)
- {
- BYTE b = m_pFile->BitRead(8);
- if(b == 8 || b == 9) break;
- if(--limit < 15) return false;
- }
-
- pos = m_pFile->GetPos() - 5;
- m_pFile->Seek(pos);
-
- Tag ct;
- if(ReadTag(ct))
- {
- __int64 next = m_pFile->GetPos() + ct.DataSize;
- if(next == m_pFile->GetLength() - 4)
- {
- m_pFile->Seek(pos);
- return true;
- }
- else if(next <= m_pFile->GetLength() - 19)
- {
- m_pFile->Seek(next);
- Tag nt;
- if(ReadTag(nt) && (nt.TagType == 8 || nt.TagType == 9 || nt.TagType == 18))
- {
- if((nt.PreviousTagSize == ct.DataSize + 11) ||
- (m_IgnorePrevSizes &&
- nt.TimeStamp >= ct.TimeStamp &&
- nt.TimeStamp - ct.TimeStamp <= 1000))
- {
- m_pFile->Seek(pos);
- return true;
- }
- }
- }
- }
-
- m_pFile->Seek(pos + 5);
- }
-
- return false;
+ m_pFile->Seek(pos);
+
+ while(m_pFile->GetRemaining() >= 15)
+ {
+ __int64 limit = m_pFile->GetRemaining();
+ while (true) {
+ BYTE b = m_pFile->BitRead(8);
+ if (b == 8 || b == 9) break;
+ if (--limit < 15) return false;
+ }
+
+ pos = m_pFile->GetPos() - 5;
+ m_pFile->Seek(pos);
+
+ Tag ct;
+ if (ReadTag(ct)) {
+ __int64 next = m_pFile->GetPos() + ct.DataSize;
+ if(next == m_pFile->GetLength() - 4) {
+ m_pFile->Seek(pos);
+ return true;
+ }
+ else if (next <= m_pFile->GetLength() - 19) {
+ m_pFile->Seek(next);
+ Tag nt;
+ if (ReadTag(nt) && (nt.TagType == 8 || nt.TagType == 9 || nt.TagType == 18)) {
+ if ((nt.PreviousTagSize == ct.DataSize + 11) ||
+ (m_IgnorePrevSizes &&
+ nt.TimeStamp >= ct.TimeStamp &&
+ nt.TimeStamp - ct.TimeStamp <= 1000))
+ {
+ m_pFile->Seek(pos);
+ return true;
+ }
+ }
+ }
+ }
+
+ m_pFile->Seek(pos + 5);
+ }
+
+ return false;
}
HRESULT CFLVSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
- m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- if(m_pFile->BitRead(24) != 'FLV' || m_pFile->BitRead(8) != 1)
- return E_FAIL;
-
- EXECUTE_ASSERT(m_pFile->BitRead(5) == 0); // TypeFlagsReserved
- bool fTypeFlagsAudio = !!m_pFile->BitRead(1);
- EXECUTE_ASSERT(m_pFile->BitRead(1) == 0); // TypeFlagsReserved
- bool fTypeFlagsVideo = !!m_pFile->BitRead(1);
- m_DataOffset = (UINT32)m_pFile->BitRead(32);
-
- // doh, these flags aren't always telling the truth
- fTypeFlagsAudio = fTypeFlagsVideo = true;
-
- Tag t;
- AudioTag at;
- VideoTag vt;
-
- UINT32 prevTagSize = 0;
- m_IgnorePrevSizes = false;
-
- m_pFile->Seek(m_DataOffset);
-
- for(int i = 0; ReadTag(t) && (fTypeFlagsVideo || fTypeFlagsAudio) && i < 100; i++)
- {
- UINT64 next = m_pFile->GetPos() + t.DataSize;
-
- CStringW name;
-
- CMediaType mt;
- mt.SetSampleSize(1);
- mt.subtype = GUID_NULL;
-
- if(i != 0 && t.PreviousTagSize != prevTagSize)
- {
- m_IgnorePrevSizes = true;
- }
- prevTagSize = t.DataSize + 11;
-
- if(t.TagType == 8 && t.DataSize != 0 && fTypeFlagsAudio)
- {
- UNREFERENCED_PARAMETER(at);
- AudioTag at;
- name = L"Audio";
-
- if(ReadTag(at))
- {
- int dataSize = t.DataSize - 1;
-
- fTypeFlagsAudio = false;
-
- mt.majortype = MEDIATYPE_Audio;
- mt.formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->nSamplesPerSec = 44100 * (1 << at.SoundRate) / 8;
- wfe->wBitsPerSample = 8 * (at.SoundSize + 1);
- wfe->nChannels = 1 * (at.SoundType + 1);
-
- switch(at.SoundFormat)
- {
- case 0: // FLV_CODECID_PCM_BE
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_PCM);
- break;
- case 1: // FLV_CODECID_ADPCM
- mt.subtype = FOURCCMap(MAKEFOURCC('A', 'S', 'W', 'F'));
- break;
- case 2: // FLV_CODECID_MP3
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
-
- {
- CBaseSplitterFileEx::mpahdr h;
- CMediaType mt2;
- if(m_pFile->Read(h, 4, false, &mt2))
- mt = mt2;
- }
- break;
- case 3 : // FLV_CODECID_PCM_LE
- // ToDo
- break;
- case 4 : // unknown
- break;
- case 5 : // FLV_CODECID_NELLYMOSER_8HZ_MONO
- mt.subtype = FOURCCMap(MAKEFOURCC('N', 'E', 'L', 'L'));
- wfe->nSamplesPerSec = 8000;
- break;
- case 6 : // FLV_CODECID_NELLYMOSER
- mt.subtype = FOURCCMap(MAKEFOURCC('N', 'E', 'L', 'L'));
- break;
- case 10: // FLV_CODECID_AAC
- {
- if(dataSize < 1 || m_pFile->BitRead(8) != 0) // packet type 0 == aac header
- {
- fTypeFlagsAudio = true;
- break;
- }
-
- const int sampleRates[] =
- {
- 96000, 88200, 64000, 48000, 44100, 32000, 24000,
- 22050, 16000, 12000, 11025, 8000, 7350
- };
- const int channels[] =
- {
- 0, 1, 2, 3, 4, 5, 6, 8
- };
-
- __int64 configOffset = m_pFile->GetPos();
- UINT32 configSize = dataSize - 1;
- if(configSize < 2) break;
-
- // Might break depending on the AAC profile, see ff_mpeg4audio_get_config in ffmpeg's mpeg4audio.c
- m_pFile->BitRead(5);
- int iSampleRate = m_pFile->BitRead(4);
- int iChannels = m_pFile->BitRead(4);
- if(iSampleRate > 12 || iChannels > 7) break;
-
- wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + configSize);
- memset(wfe, 0, mt.FormatLength());
- wfe->nSamplesPerSec = sampleRates[iSampleRate];
- wfe->wBitsPerSample = 16;
- wfe->nChannels = channels[iChannels];
- wfe->cbSize = configSize;
-
- m_pFile->Seek(configOffset);
- m_pFile->ByteRead((BYTE*)(wfe + 1), configSize);
-
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
- }
-
- }
- }
- }
- else if(t.TagType == 9 && t.DataSize != 0 && fTypeFlagsVideo)
- {
- UNREFERENCED_PARAMETER(vt);
- VideoTag vt;
- if(ReadTag(vt) && vt.FrameType == 1)
- {
- int dataSize = t.DataSize - 1;
-
- fTypeFlagsVideo = false;
- name = L"Video";
-
- mt.majortype = MEDIATYPE_Video;
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
-
- BITMAPINFOHEADER* bih = &vih->bmiHeader;
-
- int w, h, arx, ary;
-
- switch(vt.CodecID)
- {
- case 2: // H.263
- if(m_pFile->BitRead(17) != 1) break;
-
- m_pFile->BitRead(13); // Version (5), TemporalReference (8)
-
- switch(BYTE PictureSize = (BYTE)m_pFile->BitRead(3)) // w00t
- {
- case 0:
- case 1:
- vih->bmiHeader.biWidth = (WORD)m_pFile->BitRead(8 * (PictureSize + 1));
- vih->bmiHeader.biHeight = (WORD)m_pFile->BitRead(8 * (PictureSize + 1));
- break;
- case 2:
- case 3:
- case 4:
- vih->bmiHeader.biWidth = 704 / PictureSize;
- vih->bmiHeader.biHeight = 576 / PictureSize;
- break;
- case 5:
- case 6:
- PictureSize -= 3;
- vih->bmiHeader.biWidth = 640 / PictureSize;
- vih->bmiHeader.biHeight = 480 / PictureSize;
- break;
- }
-
- if(!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) break;
-
- mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = '1VLF');
-
- break;
-
- case 5: // VP6 with alpha
- m_pFile->BitRead(24);
- case 4: // VP6
- {
-#ifdef NOVIDEOTWEAK
- m_pFile->BitRead(8);
-#else
- VideoTweak fudge;
- ReadTag(fudge);
-#endif
-
- if(m_pFile->BitRead(1))
- {
- // Delta (inter) frame
- fTypeFlagsVideo = true;
- break;
- }
- m_pFile->BitRead(6);
- bool fSeparatedCoeff = !!m_pFile->BitRead(1);
- m_pFile->BitRead(5);
- int filterHeader = m_pFile->BitRead(2);
- m_pFile->BitRead(1);
- if(fSeparatedCoeff || !filterHeader)
- {
- m_pFile->BitRead(16);
- }
-
- h = m_pFile->BitRead(8) * 16;
- w = m_pFile->BitRead(8) * 16;
-
- ary = m_pFile->BitRead(8) * 16;
- arx = m_pFile->BitRead(8) * 16;
-
- if(arx && arx != w || ary && ary != h)
- {
- VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
- memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
- vih2->dwPictAspectRatioX = arx;
- vih2->dwPictAspectRatioY = ary;
- bih = &vih2->bmiHeader;
- mt.formattype = FORMAT_VideoInfo2;
- vih = (VIDEOINFOHEADER *)vih2;
- }
-
- bih->biWidth = w;
- bih->biHeight = h;
-#ifndef NOVIDEOTWEAK
- SetRect(&vih->rcSource, 0, 0, w - fudge.x, h - fudge.y);
- SetRect(&vih->rcTarget, 0, 0, w - fudge.x, h - fudge.y);
-#endif
-
- mt.subtype = FOURCCMap(bih->biCompression = '4VLF');
-
- break;
- }
- case 7: // H.264
- {
- if(dataSize < 4 || m_pFile->BitRead(8) != 0) // packet type 0 == avc header
- {
- fTypeFlagsVideo = true;
- break;
- }
- m_pFile->BitRead(24); // composition time
-
- __int64 headerOffset = m_pFile->GetPos();
- UINT32 headerSize = dataSize - 4;
- BYTE *headerData = DNew BYTE[headerSize];
-
- m_pFile->ByteRead(headerData, headerSize);
-
- m_pFile->Seek(headerOffset + 9);
-
- mt.formattype = FORMAT_MPEG2Video;
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + headerSize);
- memset(vih, 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- vih->dwFlags = (headerData[4] & 0x03) + 1; // nal length size
-
- vih->dwProfile = (BYTE)m_pFile->BitRead(8);
- m_pFile->BitRead(8);
- vih->dwLevel = (BYTE)m_pFile->BitRead(8);
- m_pFile->UExpGolombRead(); // seq_parameter_set_id
- if(vih->dwProfile >= 100) // high profile
- {
- if(m_pFile->UExpGolombRead() == 3) // chroma_format_idc
- m_pFile->BitRead(1); // residue_transform_flag
- m_pFile->UExpGolombRead(); // bit_depth_luma_minus8
- m_pFile->UExpGolombRead(); // bit_depth_chroma_minus8
- m_pFile->BitRead(1); // qpprime_y_zero_transform_bypass_flag
- if(m_pFile->BitRead(1)) // seq_scaling_matrix_present_flag
- for(int i = 0; i < 8; i++)
- if(m_pFile->BitRead(1)) // seq_scaling_list_present_flag
- for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j)
- next = (next + m_pFile->SExpGolombRead() + 256) & 255;
- }
- m_pFile->UExpGolombRead(); // log2_max_frame_num_minus4
- UINT64 pic_order_cnt_type = m_pFile->UExpGolombRead();
- if(pic_order_cnt_type == 0)
- {
- m_pFile->UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
- }
- else if(pic_order_cnt_type == 1)
- {
- m_pFile->BitRead(1); // delta_pic_order_always_zero_flag
- m_pFile->SExpGolombRead(); // offset_for_non_ref_pic
- m_pFile->SExpGolombRead(); // offset_for_top_to_bottom_field
- UINT64 num_ref_frames_in_pic_order_cnt_cycle = m_pFile->UExpGolombRead();
- for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
- m_pFile->SExpGolombRead(); // offset_for_ref_frame[i]
- }
- m_pFile->UExpGolombRead(); // num_ref_frames
- m_pFile->BitRead(1); // gaps_in_frame_num_value_allowed_flag
- UINT64 pic_width_in_mbs_minus1 = m_pFile->UExpGolombRead();
- UINT64 pic_height_in_map_units_minus1 = m_pFile->UExpGolombRead();
- BYTE frame_mbs_only_flag = (BYTE)m_pFile->BitRead(1);
- vih->hdr.bmiHeader.biWidth = vih->hdr.dwPictAspectRatioX = (LONG)((pic_width_in_mbs_minus1 + 1) * 16);
- vih->hdr.bmiHeader.biHeight = vih->hdr.dwPictAspectRatioY = (LONG)((2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16);
-
- BYTE* src = (BYTE*)headerData + 5;
- BYTE* dst = (BYTE*)vih->dwSequenceHeader;
- BYTE* src_end = (BYTE*)headerData + headerSize;
- BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + headerSize;
- int spsCount = *(src++) & 0x1F;
- int ppsCount = -1;
-
- vih->cbSequenceHeader = 0;
-
- while(src < src_end - 1)
- {
- if(spsCount == 0 && ppsCount == -1)
- {
- ppsCount = *(src++);
- continue;
- }
-
- if(spsCount > 0) spsCount--;
- else if(ppsCount > 0) ppsCount--;
- else break;
-
- int len = ((src[0] << 8) | src[1]) + 2;
- if(src + len > src_end || dst + len > dst_end)
- {
- ASSERT(0);
- break;
- }
- memcpy(dst, src, len);
- src += len;
- dst += len;
- vih->cbSequenceHeader += len;
- }
-
- delete[] headerData;
-
- mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = '1CVA');
-
- break;
- }
- default:
- fTypeFlagsVideo = true;
- }
- }
- }
-
- if(mt.subtype != GUID_NULL)
- {
- CAtlArray<CMediaType> mts;
- mts.Add(mt);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
- EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(t.TagType, pPinOut)));
- }
-
- m_pFile->Seek(next);
- }
-
- if(m_pFile->IsRandomAccess())
- {
- __int64 pos = max(m_DataOffset, m_pFile->GetLength() - 256 * 1024);
-
- if(Sync(pos))
- {
- Tag t;
- AudioTag at;
- VideoTag vt;
-
- while(ReadTag(t))
- {
- UINT64 next = m_pFile->GetPos() + t.DataSize;
-
- if(t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt))
- {
- m_rtDuration = max(m_rtDuration, 10000i64 * t.TimeStamp);
- }
-
- m_pFile->Seek(next);
- }
- }
- }
-
- m_rtNewStop = m_rtStop = m_rtDuration;
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ if(m_pFile->BitRead(24) != 'FLV' || m_pFile->BitRead(8) != 1)
+ return E_FAIL;
+
+ EXECUTE_ASSERT(m_pFile->BitRead(5) == 0); // TypeFlagsReserved
+ bool fTypeFlagsAudio = !!m_pFile->BitRead(1);
+ EXECUTE_ASSERT(m_pFile->BitRead(1) == 0); // TypeFlagsReserved
+ bool fTypeFlagsVideo = !!m_pFile->BitRead(1);
+ m_DataOffset = (UINT32)m_pFile->BitRead(32);
+
+ // doh, these flags aren't always telling the truth
+ fTypeFlagsAudio = fTypeFlagsVideo = true;
+
+ Tag t;
+ AudioTag at;
+ VideoTag vt;
+
+ UINT32 prevTagSize = 0;
+ m_IgnorePrevSizes = false;
+
+ m_pFile->Seek(m_DataOffset);
+
+ for(int i = 0; ReadTag(t) && (fTypeFlagsVideo || fTypeFlagsAudio) && i < 100; i++)
+ {
+ UINT64 next = m_pFile->GetPos() + t.DataSize;
+
+ CStringW name;
+
+ CMediaType mt;
+ mt.SetSampleSize(1);
+ mt.subtype = GUID_NULL;
+
+ if (i != 0 && t.PreviousTagSize != prevTagSize) {
+ m_IgnorePrevSizes = true;
+ }
+ prevTagSize = t.DataSize + 11;
+
+ if(t.TagType == 8 && t.DataSize != 0 && fTypeFlagsAudio)
+ {
+ UNREFERENCED_PARAMETER(at);
+ AudioTag at;
+ name = L"Audio";
+
+ if(ReadTag(at))
+ {
+ int dataSize = t.DataSize - 1;
+
+ fTypeFlagsAudio = false;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->nSamplesPerSec = 44100*(1<<at.SoundRate)/8;
+ wfe->wBitsPerSample = 8*(at.SoundSize+1);
+ wfe->nChannels = 1*(at.SoundType+1);
+
+ switch(at.SoundFormat)
+ {
+ case 0: // FLV_CODECID_PCM_BE
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_PCM);
+ break;
+ case 1: // FLV_CODECID_ADPCM
+ mt.subtype = FOURCCMap(MAKEFOURCC('A','S','W','F'));
+ break;
+ case 2: // FLV_CODECID_MP3
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
+
+ {
+ CBaseSplitterFileEx::mpahdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, 4, false, &mt2))
+ mt = mt2;
+ }
+ break;
+ case 3 : // FLV_CODECID_PCM_LE
+ // ToDo
+ break;
+ case 4 : // unknown
+ break;
+ case 5 : // FLV_CODECID_NELLYMOSER_8HZ_MONO
+ mt.subtype = FOURCCMap(MAKEFOURCC('N','E','L','L'));
+ wfe->nSamplesPerSec = 8000;
+ break;
+ case 6 : // FLV_CODECID_NELLYMOSER
+ mt.subtype = FOURCCMap(MAKEFOURCC('N','E','L','L'));
+ break;
+ case 10: { // FLV_CODECID_AAC
+ if (dataSize < 1 || m_pFile->BitRead(8) != 0) { // packet type 0 == aac header
+ fTypeFlagsAudio = true;
+ break;
+ }
+
+ const int sampleRates[] = {
+ 96000, 88200, 64000, 48000, 44100, 32000, 24000,
+ 22050, 16000, 12000, 11025, 8000, 7350
+ };
+ const int channels[] = {
+ 0, 1, 2, 3, 4, 5, 6, 8
+ };
+
+ __int64 configOffset = m_pFile->GetPos();
+ UINT32 configSize = dataSize - 1;
+ if (configSize < 2) break;
+
+ // Might break depending on the AAC profile, see ff_mpeg4audio_get_config in ffmpeg's mpeg4audio.c
+ m_pFile->BitRead(5);
+ int iSampleRate = m_pFile->BitRead(4);
+ int iChannels = m_pFile->BitRead(4);
+ if (iSampleRate > 12 || iChannels > 7) break;
+
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + configSize);
+ memset(wfe, 0, mt.FormatLength());
+ wfe->nSamplesPerSec = sampleRates[iSampleRate];
+ wfe->wBitsPerSample = 16;
+ wfe->nChannels = channels[iChannels];
+ wfe->cbSize = configSize;
+
+ m_pFile->Seek(configOffset);
+ m_pFile->ByteRead((BYTE*)(wfe+1), configSize);
+
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
+ }
+
+ }
+ }
+ }
+ else if(t.TagType == 9 && t.DataSize != 0 && fTypeFlagsVideo)
+ {
+ UNREFERENCED_PARAMETER(vt);
+ VideoTag vt;
+ if(ReadTag(vt) && vt.FrameType == 1)
+ {
+ int dataSize = t.DataSize - 1;
+
+ fTypeFlagsVideo = false;
+ name = L"Video";
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+
+ BITMAPINFOHEADER* bih = &vih->bmiHeader;
+
+ int w, h, arx, ary;
+
+ switch(vt.CodecID)
+ {
+ case 2: // H.263
+ if(m_pFile->BitRead(17) != 1) break;
+
+ m_pFile->BitRead(13); // Version (5), TemporalReference (8)
+
+ switch(BYTE PictureSize = (BYTE)m_pFile->BitRead(3)) // w00t
+ {
+ case 0: case 1:
+ vih->bmiHeader.biWidth = (WORD)m_pFile->BitRead(8*(PictureSize+1));
+ vih->bmiHeader.biHeight = (WORD)m_pFile->BitRead(8*(PictureSize+1));
+ break;
+ case 2: case 3: case 4:
+ vih->bmiHeader.biWidth = 704 / PictureSize;
+ vih->bmiHeader.biHeight = 576 / PictureSize;
+ break;
+ case 5: case 6:
+ PictureSize -= 3;
+ vih->bmiHeader.biWidth = 640 / PictureSize;
+ vih->bmiHeader.biHeight = 480 / PictureSize;
+ break;
+ }
+
+ if(!vih->bmiHeader.biWidth || !vih->bmiHeader.biHeight) break;
+
+ mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = '1VLF');
+
+ break;
+
+ case 5: // VP6 with alpha
+ m_pFile->BitRead(24);
+ case 4: { // VP6
+ #ifdef NOVIDEOTWEAK
+ m_pFile->BitRead(8);
+ #else
+ VideoTweak fudge;
+ ReadTag(fudge);
+ #endif
+
+ if (m_pFile->BitRead(1)) {
+ // Delta (inter) frame
+ fTypeFlagsVideo = true;
+ break;
+ }
+ m_pFile->BitRead(6);
+ bool fSeparatedCoeff = !!m_pFile->BitRead(1);
+ m_pFile->BitRead(5);
+ int filterHeader = m_pFile->BitRead(2);
+ m_pFile->BitRead(1);
+ if (fSeparatedCoeff || !filterHeader) {
+ m_pFile->BitRead(16);
+ }
+
+ h = m_pFile->BitRead(8) * 16;
+ w = m_pFile->BitRead(8) * 16;
+
+ ary = m_pFile->BitRead(8) * 16;
+ arx = m_pFile->BitRead(8) * 16;
+
+ if(arx && arx != w || ary && ary != h) {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
+ memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
+ vih2->dwPictAspectRatioX = arx;
+ vih2->dwPictAspectRatioY = ary;
+ bih = &vih2->bmiHeader;
+ mt.formattype = FORMAT_VideoInfo2;
+ vih = (VIDEOINFOHEADER *)vih2;
+ }
+
+ bih->biWidth = w;
+ bih->biHeight = h;
+ #ifndef NOVIDEOTWEAK
+ SetRect(&vih->rcSource, 0, 0, w - fudge.x, h - fudge.y);
+ SetRect(&vih->rcTarget, 0, 0, w - fudge.x, h - fudge.y);
+ #endif
+
+ mt.subtype = FOURCCMap(bih->biCompression = '4VLF');
+
+ break;
+ }
+ case 7: { // H.264
+ if (dataSize < 4 || m_pFile->BitRead(8) != 0) { // packet type 0 == avc header
+ fTypeFlagsVideo = true;
+ break;
+ }
+ m_pFile->BitRead(24); // composition time
+
+ __int64 headerOffset = m_pFile->GetPos();
+ UINT32 headerSize = dataSize - 4;
+ BYTE *headerData = DNew BYTE[headerSize];
+
+ m_pFile->ByteRead(headerData, headerSize);
+
+ m_pFile->Seek(headerOffset + 9);
+
+ mt.formattype = FORMAT_MPEG2Video;
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + headerSize);
+ memset(vih, 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ vih->dwFlags = (headerData[4] & 0x03) + 1; // nal length size
+
+ vih->dwProfile = (BYTE)m_pFile->BitRead(8);
+ m_pFile->BitRead(8);
+ vih->dwLevel = (BYTE)m_pFile->BitRead(8);
+ m_pFile->UExpGolombRead(); // seq_parameter_set_id
+ if(vih->dwProfile >= 100) { // high profile
+ if(m_pFile->UExpGolombRead() == 3) // chroma_format_idc
+ m_pFile->BitRead(1); // residue_transform_flag
+ m_pFile->UExpGolombRead(); // bit_depth_luma_minus8
+ m_pFile->UExpGolombRead(); // bit_depth_chroma_minus8
+ m_pFile->BitRead(1); // qpprime_y_zero_transform_bypass_flag
+ if(m_pFile->BitRead(1)) // seq_scaling_matrix_present_flag
+ for(int i = 0; i < 8; i++)
+ if(m_pFile->BitRead(1)) // seq_scaling_list_present_flag
+ for(int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j)
+ next = (next + m_pFile->SExpGolombRead() + 256) & 255;
+ }
+ m_pFile->UExpGolombRead(); // log2_max_frame_num_minus4
+ UINT64 pic_order_cnt_type = m_pFile->UExpGolombRead();
+ if(pic_order_cnt_type == 0) {
+ m_pFile->UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
+ }
+ else if(pic_order_cnt_type == 1) {
+ m_pFile->BitRead(1); // delta_pic_order_always_zero_flag
+ m_pFile->SExpGolombRead(); // offset_for_non_ref_pic
+ m_pFile->SExpGolombRead(); // offset_for_top_to_bottom_field
+ UINT64 num_ref_frames_in_pic_order_cnt_cycle = m_pFile->UExpGolombRead();
+ for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
+ m_pFile->SExpGolombRead(); // offset_for_ref_frame[i]
+ }
+ m_pFile->UExpGolombRead(); // num_ref_frames
+ m_pFile->BitRead(1); // gaps_in_frame_num_value_allowed_flag
+ UINT64 pic_width_in_mbs_minus1 = m_pFile->UExpGolombRead();
+ UINT64 pic_height_in_map_units_minus1 = m_pFile->UExpGolombRead();
+ BYTE frame_mbs_only_flag = (BYTE)m_pFile->BitRead(1);
+ vih->hdr.bmiHeader.biWidth = vih->hdr.dwPictAspectRatioX = (LONG)((pic_width_in_mbs_minus1 + 1) * 16);
+ vih->hdr.bmiHeader.biHeight = vih->hdr.dwPictAspectRatioY = (LONG)((2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16);
+
+ BYTE* src = (BYTE*)headerData + 5;
+ BYTE* dst = (BYTE*)vih->dwSequenceHeader;
+ BYTE* src_end = (BYTE*)headerData + headerSize;
+ BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + headerSize;
+ int spsCount = *(src++) & 0x1F;
+ int ppsCount = -1;
+
+ vih->cbSequenceHeader = 0;
+
+ while (src < src_end - 1) {
+ if (spsCount == 0 && ppsCount == -1) {
+ ppsCount = *(src++);
+ continue;
+ }
+
+ if (spsCount > 0) spsCount--;
+ else if (ppsCount > 0) ppsCount--;
+ else break;
+
+ int len = ((src[0] << 8) | src[1]) + 2;
+ if(src + len > src_end || dst + len > dst_end) {ASSERT(0); break;}
+ memcpy(dst, src, len);
+ src += len;
+ dst += len;
+ vih->cbSequenceHeader += len;
+ }
+
+ delete[] headerData;
+
+ mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = '1CVA');
+
+ break;
+ }
+ default:
+ fTypeFlagsVideo = true;
+ }
+ }
+ }
+
+ if(mt.subtype != GUID_NULL)
+ {
+ CAtlArray<CMediaType> mts;
+ mts.Add(mt);
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(t.TagType, pPinOut)));
+ }
+
+ m_pFile->Seek(next);
+ }
+
+ if(m_pFile->IsRandomAccess())
+ {
+ __int64 pos = max(m_DataOffset, m_pFile->GetLength() - 256 * 1024);
+
+ if(Sync(pos))
+ {
+ Tag t;
+ AudioTag at;
+ VideoTag vt;
+
+ while(ReadTag(t))
+ {
+ UINT64 next = m_pFile->GetPos() + t.DataSize;
+
+ if(t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt))
+ {
+ m_rtDuration = max(m_rtDuration, 10000i64 * t.TimeStamp);
+ }
+
+ m_pFile->Seek(next);
+ }
+ }
+ }
+
+ m_rtNewStop = m_rtStop = m_rtDuration;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CFLVSplitterFilter::DemuxInit()
{
- return true;
+ return true;
}
void CFLVSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(!m_rtDuration || rt <= 0)
- {
- m_pFile->Seek(m_DataOffset);
- }
- else if(!m_IgnorePrevSizes)
- {
- NormalSeek(rt);
- }
- else
- {
- AlternateSeek(rt);
- }
+ if(!m_rtDuration || rt <= 0) {
+ m_pFile->Seek(m_DataOffset);
+ }
+ else if (!m_IgnorePrevSizes) {
+ NormalSeek(rt);
+ }
+ else {
+ AlternateSeek(rt);
+ }
}
void CFLVSplitterFilter::NormalSeek(REFERENCE_TIME rt)
{
- bool fAudio = !!GetOutputPin(8);
- bool fVideo = !!GetOutputPin(9);
-
- __int64 pos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - m_DataOffset);
-
- if(!Sync(pos))
- {
- ASSERT(0);
- m_pFile->Seek(m_DataOffset);
- return;
- }
-
- Tag t;
- AudioTag at;
- VideoTag vt;
-
- while(ReadTag(t))
- {
- if(10000i64 * t.TimeStamp >= rt)
- {
- m_pFile->Seek(m_pFile->GetPos() - 15);
- break;
- }
-
- m_pFile->Seek(m_pFile->GetPos() + t.DataSize);
- }
-
- while(m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t))
- {
- UINT64 prev = m_pFile->GetPos() - 15 - t.PreviousTagSize - 4;
-
- if(10000i64 * t.TimeStamp <= rt)
- {
- if(t.TagType == 8 && ReadTag(at))
- {
- fAudio = false;
- }
- else if(t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1)
- {
- fVideo = false;
- }
- }
-
- m_pFile->Seek(prev);
- }
-
- if(fAudio || fVideo)
- {
- ASSERT(0);
- m_pFile->Seek(m_DataOffset);
- }
+ bool fAudio = !!GetOutputPin(8);
+ bool fVideo = !!GetOutputPin(9);
+
+ __int64 pos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - m_DataOffset);
+
+ if(!Sync(pos))
+ {
+ ASSERT(0);
+ m_pFile->Seek(m_DataOffset);
+ return;
+ }
+
+ Tag t;
+ AudioTag at;
+ VideoTag vt;
+
+ while(ReadTag(t))
+ {
+ if(10000i64 * t.TimeStamp >= rt)
+ {
+ m_pFile->Seek(m_pFile->GetPos() - 15);
+ break;
+ }
+
+ m_pFile->Seek(m_pFile->GetPos() + t.DataSize);
+ }
+
+ while(m_pFile->GetPos() >= m_DataOffset && (fAudio || fVideo) && ReadTag(t))
+ {
+ UINT64 prev = m_pFile->GetPos() - 15 - t.PreviousTagSize - 4;
+
+ if(10000i64 * t.TimeStamp <= rt)
+ {
+ if(t.TagType == 8 && ReadTag(at))
+ {
+ fAudio = false;
+ }
+ else if(t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1)
+ {
+ fVideo = false;
+ }
+ }
+
+ m_pFile->Seek(prev);
+ }
+
+ if(fAudio || fVideo)
+ {
+ ASSERT(0);
+ m_pFile->Seek(m_DataOffset);
+ }
}
void CFLVSplitterFilter::AlternateSeek(REFERENCE_TIME rt)
{
- bool hasAudio = !!GetOutputPin(8);
- bool hasVideo = !!GetOutputPin(9);
-
- __int64 estimPos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - m_DataOffset);
- __int64 seekBack = 256 * 1024;
-
- while(true)
- {
- bool foundAudio = false;
- bool foundVideo = false;
- __int64 bestPos;
-
- estimPos = max(estimPos - seekBack, m_DataOffset);
- seekBack *= 2;
-
- if(Sync(estimPos))
- {
- Tag t;
- AudioTag at;
- VideoTag vt;
-
- while(ReadTag(t) && t.TimeStamp * 10000i64 < rt)
- {
- __int64 cur = m_pFile->GetPos() - 15;
- __int64 next = cur + 15 + t.DataSize;
-
- if(hasAudio && t.TagType == 8 && ReadTag(at))
- {
- foundAudio = true;
- if(!hasVideo) bestPos = cur;
- }
- else if(hasVideo && t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1)
- {
- foundVideo = true;
- bestPos = cur;
- }
-
- m_pFile->Seek(next);
- }
- }
-
- if((hasAudio && !foundAudio) || (hasVideo && !foundVideo))
- {
- if(estimPos == m_DataOffset)
- {
- m_pFile->Seek(m_DataOffset);
- return;
- }
- }
- else
- {
- m_pFile->Seek(bestPos);
- return;
- }
- }
+ bool hasAudio = !!GetOutputPin(8);
+ bool hasVideo = !!GetOutputPin(9);
+
+ __int64 estimPos = m_DataOffset + 1.0 * rt / m_rtDuration * (m_pFile->GetLength() - m_DataOffset);
+ __int64 seekBack = 256 * 1024;
+
+ while (true) {
+ bool foundAudio = false;
+ bool foundVideo = false;
+ __int64 bestPos;
+
+ estimPos = max(estimPos - seekBack, m_DataOffset);
+ seekBack *= 2;
+
+ if (Sync(estimPos)) {
+ Tag t;
+ AudioTag at;
+ VideoTag vt;
+
+ while (ReadTag(t) && t.TimeStamp * 10000i64 < rt) {
+ __int64 cur = m_pFile->GetPos() - 15;
+ __int64 next = cur + 15 + t.DataSize;
+
+ if (hasAudio && t.TagType == 8 && ReadTag(at)) {
+ foundAudio = true;
+ if (!hasVideo) bestPos = cur;
+ }
+ else if (hasVideo && t.TagType == 9 && ReadTag(vt) && vt.FrameType == 1) {
+ foundVideo = true;
+ bestPos = cur;
+ }
+
+ m_pFile->Seek(next);
+ }
+ }
+
+ if ((hasAudio && !foundAudio) || (hasVideo && !foundVideo)) {
+ if (estimPos == m_DataOffset) {
+ m_pFile->Seek(m_DataOffset);
+ return;
+ }
+ }
+ else {
+ m_pFile->Seek(bestPos);
+ return;
+ }
+ }
}
bool CFLVSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
-
- CAutoPtr<Packet> p;
-
- Tag t;
- AudioTag at;
- VideoTag vt;
-
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining())
- {
- if(!ReadTag(t)) break;
-
- __int64 next = m_pFile->GetPos() + t.DataSize;
-
- if((t.DataSize > 0) && (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt)))
- {
- UINT32 tsOffset = 0;
- if(t.TagType == 9 && vt.FrameType == 5) goto NextTag; // video info/command frame
- if(t.TagType == 9 && vt.CodecID == 4) m_pFile->BitRead(8);
- if(t.TagType == 9 && vt.CodecID == 5) m_pFile->BitRead(32);
- if(t.TagType == 9 && vt.CodecID == 7)
- {
- if(m_pFile->BitRead(8) != 1) goto NextTag;
- // Tag timestamps specify decode time, this is the display time offset
- tsOffset = m_pFile->BitRead(24);
- tsOffset = (tsOffset + 0xff800000) ^ 0xff800000; // sign extension
- }
- if(t.TagType == 8 && at.SoundFormat == 10)
- {
- if(m_pFile->BitRead(8) != 1) goto NextTag;
- }
- __int64 dataSize = next - m_pFile->GetPos();
- if(dataSize <= 0) goto NextTag;
- p.Attach(DNew Packet());
- p->TrackNumber = t.TagType;
- p->rtStart = 10000i64 * (t.TimeStamp + tsOffset);
- p->rtStop = p->rtStart + 1;
- p->bSyncPoint = t.TagType == 9 ? vt.FrameType == 1 : true;
- p->SetCount(dataSize);
- m_pFile->ByteRead(p->GetData(), p->GetCount());
- hr = DeliverPacket(p);
- }
+ HRESULT hr = S_OK;
+
+ CAutoPtr<Packet> p;
+
+ Tag t;
+ AudioTag at;
+ VideoTag vt;
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining())
+ {
+ if(!ReadTag(t)) break;
+
+ __int64 next = m_pFile->GetPos() + t.DataSize;
+
+ if((t.DataSize > 0) && (t.TagType == 8 && ReadTag(at) || t.TagType == 9 && ReadTag(vt)))
+ {
+ UINT32 tsOffset = 0;
+ if(t.TagType == 9 && vt.FrameType == 5) goto NextTag; // video info/command frame
+ if(t.TagType == 9 && vt.CodecID == 4) m_pFile->BitRead(8);
+ if(t.TagType == 9 && vt.CodecID == 5) m_pFile->BitRead(32);
+ if(t.TagType == 9 && vt.CodecID == 7) {
+ if (m_pFile->BitRead(8) != 1) goto NextTag;
+ // Tag timestamps specify decode time, this is the display time offset
+ tsOffset = m_pFile->BitRead(24);
+ tsOffset = (tsOffset + 0xff800000) ^ 0xff800000; // sign extension
+ }
+ if(t.TagType == 8 && at.SoundFormat == 10) {
+ if (m_pFile->BitRead(8) != 1) goto NextTag;
+ }
+ __int64 dataSize = next - m_pFile->GetPos();
+ if (dataSize <= 0) goto NextTag;
+ p.Attach(DNew Packet());
+ p->TrackNumber = t.TagType;
+ p->rtStart = 10000i64 * (t.TimeStamp + tsOffset);
+ p->rtStop = p->rtStart + 1;
+ p->bSyncPoint = t.TagType == 9 ? vt.FrameType == 1 : true;
+ p->SetCount(dataSize);
+ m_pFile->ByteRead(p->GetData(), p->GetCount());
+ hr = DeliverPacket(p);
+ }
NextTag:
- m_pFile->Seek(next);
- }
+ m_pFile->Seek(next);
+ }
- return true;
+ return true;
}
//
@@ -792,10 +746,10 @@ NextTag:
//
CFLVSourceFilter::CFLVSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CFLVSplitterFilter(pUnk, phr)
+ : CFLVSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
diff --git a/src/filters/parser/FLVSplitter/FLVSplitter.h b/src/filters/parser/FLVSplitter/FLVSplitter.h
index 3b3b98c40..62ab89abc 100644
--- a/src/filters/parser/FLVSplitter/FLVSplitter.h
+++ b/src/filters/parser/FLVSplitter/FLVSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,68 +27,68 @@
[uuid("47E792CF-0BBE-4F7A-859C-194B0768650A")]
class CFLVSplitterFilter : public CBaseSplitterFilter
{
- UINT32 m_DataOffset;
- bool m_IgnorePrevSizes;
-
- bool Sync(__int64& pos);
-
- struct VideoTweak
- {
- BYTE x;
- BYTE y;
- };
-
- bool ReadTag(VideoTweak& t);
-
- struct Tag
- {
- UINT32 PreviousTagSize;
- BYTE TagType;
- UINT32 DataSize;
- UINT32 TimeStamp;
- UINT32 StreamID;
- };
-
- bool ReadTag(Tag& t);
-
- struct AudioTag
- {
- BYTE SoundFormat;
- BYTE SoundRate;
- BYTE SoundSize;
- BYTE SoundType;
- };
-
- bool ReadTag(AudioTag& at);
-
- struct VideoTag
- {
- BYTE FrameType;
- BYTE CodecID;
- };
-
- bool ReadTag(VideoTag& vt);
-
- void NormalSeek(REFERENCE_TIME rt);
- void AlternateSeek(REFERENCE_TIME rt);
+ UINT32 m_DataOffset;
+ bool m_IgnorePrevSizes;
+
+ bool Sync(__int64& pos);
+
+ struct VideoTweak
+ {
+ BYTE x;
+ BYTE y;
+ };
+
+ bool ReadTag(VideoTweak& t);
+
+ struct Tag
+ {
+ UINT32 PreviousTagSize;
+ BYTE TagType;
+ UINT32 DataSize;
+ UINT32 TimeStamp;
+ UINT32 StreamID;
+ };
+
+ bool ReadTag(Tag& t);
+
+ struct AudioTag
+ {
+ BYTE SoundFormat;
+ BYTE SoundRate;
+ BYTE SoundSize;
+ BYTE SoundType;
+ };
+
+ bool ReadTag(AudioTag& at);
+
+ struct VideoTag
+ {
+ BYTE FrameType;
+ BYTE CodecID;
+ };
+
+ bool ReadTag(VideoTag& vt);
+
+ void NormalSeek(REFERENCE_TIME rt);
+ void AlternateSeek(REFERENCE_TIME rt);
protected:
- CAutoPtr<CBaseSplitterFileEx> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CBaseSplitterFileEx> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CFLVSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CFLVSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
[uuid("C9ECE7B3-1D8E-41F5-9F24-B255DF16C087")]
class CFLVSourceFilter : public CFLVSplitterFilter
{
public:
- CFLVSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CFLVSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
#include "../../transform/BaseVideoFilter/BaseVideoFilter.h"
diff --git a/src/filters/parser/FLVSplitter/resource.h b/src/filters/parser/FLVSplitter/resource.h
index 1e1d455b0..cf17d77a9 100644
--- a/src/filters/parser/FLVSplitter/resource.h
+++ b/src/filters/parser/FLVSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by FLVSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/FLVSplitter/stdafx.cpp b/src/filters/parser/FLVSplitter/stdafx.cpp
index eb61fa0cc..d6ab481ba 100644
--- a/src/filters/parser/FLVSplitter/stdafx.cpp
+++ b/src/filters/parser/FLVSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/FLVSplitter/stdafx.h b/src/filters/parser/FLVSplitter/stdafx.h
index 089cf8fa0..e8beccd47 100644
--- a/src/filters/parser/FLVSplitter/stdafx.h
+++ b/src/filters/parser/FLVSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.cpp
index 0a1aaf518..1e46bbcee 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.cpp
@@ -40,7 +40,7 @@
#define AP4_ADTS_SYNC_MASK 0xFFF6 /* 12 sync bits plus 2 layer bits */
#define AP4_ADTS_SYNC_PATTERN 0xFFF0 /* 12 sync bits=1 layer=0 */
-const unsigned long
+const unsigned long
AP4_AdtsSamplingFrequencyTable[16] =
{
96000,
@@ -67,15 +67,15 @@ AP4_AdtsSamplingFrequencyTable[16] =
AP4_AdtsHeader::AP4_AdtsHeader(const AP4_UI08* bytes)
{
// fixed part
- m_Id = (bytes[1] & 0x08) >> 3;
+ m_Id = ( bytes[1] & 0x08) >> 3;
m_ProtectionAbsent = bytes[1] & 0x01;
- m_ProfileObjectType = (bytes[2] & 0xC0) >> 6;
- m_SamplingFrequencyIndex = (bytes[2] & 0x3C) >> 2;
- m_ChannelConfiguration = ((bytes[2] & 0x01) << 2) |
+ m_ProfileObjectType = ( bytes[2] & 0xC0) >> 6;
+ m_SamplingFrequencyIndex = ( bytes[2] & 0x3C) >> 2;
+ m_ChannelConfiguration = ((bytes[2] & 0x01) << 2) |
((bytes[3] & 0xC0) >> 6);
// variable part
m_FrameLength = ((unsigned int)(bytes[3] & 0x03) << 11) |
- ((unsigned int)(bytes[4]) << 3) |
+ ((unsigned int)(bytes[4] ) << 3) |
((unsigned int)(bytes[5] & 0xE0) >> 5);
m_RawDataBlocks = bytes[6] & 0x03;
}
@@ -89,15 +89,12 @@ AP4_AdtsHeader::AP4_AdtsHeader(const AP4_UI08* bytes)
bool
AP4_AdtsHeader::MatchFixed(unsigned char* a, unsigned char* b)
{
- if(a[0] == b[0] &&
- a[1] == b[1] &&
- a[2] == b[2] &&
- (a[3] & 0xF0) == (b[3] & 0xF0))
- {
+ if (a[0] == b[0] &&
+ a[1] == b[1] &&
+ a[2] == b[2] &&
+ (a[3] & 0xF0) == (b[3] & 0xF0)) {
return true;
- }
- else
- {
+ } else {
return false;
}
}
@@ -109,14 +106,12 @@ AP4_Result
AP4_AdtsHeader::Check()
{
// check that the sampling frequency index is valid
- if(m_SamplingFrequencyIndex >= 0xD)
- {
+ if (m_SamplingFrequencyIndex >= 0xD) {
return AP4_FAILURE;
}
/* MPEG2 does not use all profiles */
- if(m_Id == 1 && m_ProfileObjectType == 3)
- {
+ if (m_Id == 1 && m_ProfileObjectType == 3) {
return AP4_FAILURE;
}
@@ -152,7 +147,7 @@ AP4_AdtsParser::Reset()
| AP4_AdtsParser::Feed
+----------------------------------------------------------------------*/
AP4_Result
-AP4_AdtsParser::Feed(const AP4_UI08* buffer,
+AP4_AdtsParser::Feed(const AP4_UI08* buffer,
AP4_Size* buffer_size,
AP4_Flags flags)
{
@@ -162,19 +157,18 @@ AP4_AdtsParser::Feed(const AP4_UI08* buffer,
m_Bits.m_Flags = flags;
/* possible shortcut */
- if(buffer == NULL ||
- buffer_size == NULL ||
- *buffer_size == 0)
- {
+ if (buffer == NULL ||
+ buffer_size == NULL ||
+ *buffer_size == 0) {
return AP4_SUCCESS;
}
/* see how much data we can write */
free_space = m_Bits.GetBytesFree();
- if(*buffer_size > free_space) *buffer_size = free_space;
+ if (*buffer_size > free_space) *buffer_size = free_space;
/* write the data */
- return m_Bits.WriteBytes(buffer, *buffer_size);
+ return m_Bits.WriteBytes(buffer, *buffer_size);
}
/*----------------------------------------------------------------------+
@@ -183,30 +177,26 @@ AP4_AdtsParser::Feed(const AP4_UI08* buffer,
AP4_Result
AP4_AdtsParser::FindHeader(AP4_UI08* header)
{
- int available = m_Bits.GetBytesAvailable();
- unsigned int sync = 0;
- long nbr_skipped_bytes = 0;
-
- /* look for the sync pattern */
- while(available-- >= AP4_ADTS_HEADER_SIZE)
- {
- sync = (m_Bits.ReadByte() << 8) | m_Bits.PeekByte();
-
- if((sync & AP4_ADTS_SYNC_MASK) == AP4_ADTS_SYNC_PATTERN)
- {
- /* found a sync pattern, read the rest of the header */
- header[0] = (sync >> 8) & 0xFF;
- m_Bits.ReadBytes(&header[1], AP4_ADTS_HEADER_SIZE - 1);
-
- return AP4_SUCCESS;
- }
- else
- {
- ++ nbr_skipped_bytes;
- }
- }
-
- return AP4_ERROR_NOT_ENOUGH_DATA;
+ int available = m_Bits.GetBytesAvailable();
+ unsigned int sync = 0;
+ long nbr_skipped_bytes = 0;
+
+ /* look for the sync pattern */
+ while (available-- >= AP4_ADTS_HEADER_SIZE) {
+ sync = (m_Bits.ReadByte() << 8) | m_Bits.PeekByte();
+
+ if ((sync & AP4_ADTS_SYNC_MASK) == AP4_ADTS_SYNC_PATTERN) {
+ /* found a sync pattern, read the rest of the header */
+ header[0] = (sync >> 8) & 0xFF;
+ m_Bits.ReadBytes(&header[1], AP4_ADTS_HEADER_SIZE-1);
+
+ return AP4_SUCCESS;
+ } else {
+ ++ nbr_skipped_bytes;
+ }
+ }
+
+ return AP4_ERROR_NOT_ENOUGH_DATA;
}
/*----------------------------------------------------------------------+
@@ -221,85 +211,77 @@ AP4_AdtsParser::FindFrame(AP4_AacFrame& frame)
/* align to the start of the next byte */
m_Bits.ByteAlign();
-
+
/* find a frame header */
result = FindHeader(raw_header);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
/* parse the header */
AP4_AdtsHeader adts_header(raw_header);
/* check the header */
result = adts_header.Check();
- if(AP4_FAILED(result)) goto fail;
-
+ if (AP4_FAILED(result)) goto fail;
+
/* check that we have enough data to peek at the next header */
available = AP4_ADTS_HEADER_SIZE + m_Bits.GetBytesAvailable();
- if(m_Bits.m_Flags & AP4_BITSTREAM_FLAG_EOS)
- {
+ if (m_Bits.m_Flags & AP4_BITSTREAM_FLAG_EOS) {
/* we're at the end of the stream, we only need the entire frame */
- if(available < adts_header.m_FrameLength)
- {
+ if (available < adts_header.m_FrameLength) {
return AP4_ERROR_NOT_ENOUGH_DATA;
- }
- }
- else
- {
+ }
+ } else {
/* peek at the header of the next frame */
unsigned char peek_raw_header[AP4_ADTS_HEADER_SIZE];
- if(available < adts_header.m_FrameLength + AP4_ADTS_HEADER_SIZE)
- {
+ if (available < adts_header.m_FrameLength+AP4_ADTS_HEADER_SIZE) {
return AP4_ERROR_NOT_ENOUGH_DATA;
- }
- m_Bits.SkipBytes(adts_header.m_FrameLength - AP4_ADTS_HEADER_SIZE);
+ }
+ m_Bits.SkipBytes(adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE);
m_Bits.PeekBytes(peek_raw_header, AP4_ADTS_HEADER_SIZE);
- m_Bits.SkipBytes(-((int)adts_header.m_FrameLength - AP4_ADTS_HEADER_SIZE));
+ m_Bits.SkipBytes(-((int)adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE));
/* check the header */
AP4_AdtsHeader peek_adts_header(peek_raw_header);
result = peek_adts_header.Check();
- if(AP4_FAILED(result)) goto fail;
+ if (AP4_FAILED(result)) goto fail;
/* check that the fixed part of this header is the same as the */
/* fixed part of the previous header */
- if(!AP4_AdtsHeader::MatchFixed(peek_raw_header, raw_header))
- {
+ if (!AP4_AdtsHeader::MatchFixed(peek_raw_header, raw_header)) {
goto fail;
}
}
/* fill in the frame info */
- frame.m_Info.m_Standard = (adts_header.m_Id == 1 ?
- AP4_AAC_STANDARD_MPEG2 :
- AP4_AAC_STANDARD_MPEG4);
- switch(adts_header.m_ProfileObjectType)
- {
- case 0:
- frame.m_Info.m_Profile = AP4_AAC_PROFILE_MAIN;
- break;
-
- case 1:
- frame.m_Info.m_Profile = AP4_AAC_PROFILE_LC;
- break;
-
- case 2:
- frame.m_Info.m_Profile = AP4_AAC_PROFILE_SSR;
- break;
-
- case 3:
- frame.m_Info.m_Profile = AP4_AAC_PROFILE_LTP;
+ frame.m_Info.m_Standard = (adts_header.m_Id == 1 ?
+ AP4_AAC_STANDARD_MPEG2 :
+ AP4_AAC_STANDARD_MPEG4);
+ switch (adts_header.m_ProfileObjectType) {
+ case 0:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_MAIN;
+ break;
+
+ case 1:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_LC;
+ break;
+
+ case 2:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_SSR;
+ break;
+
+ case 3:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_LTP;
}
- frame.m_Info.m_FrameLength = adts_header.m_FrameLength - AP4_ADTS_HEADER_SIZE;
+ frame.m_Info.m_FrameLength = adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE;
frame.m_Info.m_ChannelConfiguration = adts_header.m_ChannelConfiguration;
frame.m_Info.m_SamplingFrequencyIndex = adts_header.m_SamplingFrequencyIndex;
frame.m_Info.m_SamplingFrequency = AP4_AdtsSamplingFrequencyTable[adts_header.m_SamplingFrequencyIndex];
/* skip crc if present */
- if(adts_header.m_ProtectionAbsent == 0)
- {
+ if (adts_header.m_ProtectionAbsent == 0) {
m_Bits.SkipBits(16);
- }
+ }
/* set the frame source */
frame.m_Source = &m_Bits;
@@ -319,7 +301,7 @@ fail:
AP4_Size
AP4_AdtsParser::GetBytesFree()
{
- return (m_Bits.GetBytesFree());
+ return (m_Bits.GetBytesFree());
}
@@ -327,10 +309,10 @@ AP4_AdtsParser::GetBytesFree()
/*----------------------------------------------------------------------+
| AP4_AdtsParser::GetBytesAvailable
+----------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_AdtsParser::GetBytesAvailable()
{
- return (m_Bits.GetBytesAvailable());
+ return (m_Bits.GetBytesAvailable());
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.h b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.h
index 8b5b4e8da..1db5f27b4 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AdtsParser.h
@@ -43,12 +43,11 @@ extern const unsigned long AP4_AdtsSamplingFrequencyTable[16];
/*----------------------------------------------------------------------
| types
+---------------------------------------------------------------------*/
-class AP4_AdtsHeader
-{
+class AP4_AdtsHeader {
public:
// constructor
AP4_AdtsHeader(const AP4_UI08* bytes);
-
+
// methods
AP4_Result Check();
@@ -69,38 +68,33 @@ public:
static bool MatchFixed(unsigned char* a, unsigned char* b);
};
-typedef enum
-{
+typedef enum {
AP4_AAC_STANDARD_MPEG2,
AP4_AAC_STANDARD_MPEG4
} AP4_AacStandard;
-typedef enum
-{
+typedef enum {
AP4_AAC_PROFILE_MAIN,
AP4_AAC_PROFILE_LC,
AP4_AAC_PROFILE_SSR,
AP4_AAC_PROFILE_LTP
} AP4_AacProfile;
-typedef struct
-{
+typedef struct {
AP4_AacStandard m_Standard;
AP4_AacProfile m_Profile;
unsigned int m_SamplingFrequencyIndex;
unsigned long m_SamplingFrequency;
unsigned int m_ChannelConfiguration;
- unsigned int m_FrameLength;
+ unsigned int m_FrameLength;
} AP4_AacFrameInfo;
-typedef struct
-{
+typedef struct {
AP4_BitStream* m_Source;
AP4_AacFrameInfo m_Info;
} AP4_AacFrame;
-class AP4_AdtsParser
-{
+class AP4_AdtsParser {
public:
// constructor and destructor
AP4_AdtsParser();
@@ -108,7 +102,7 @@ public:
// methods
AP4_Result Reset();
- AP4_Result Feed(const AP4_UI08* buffer,
+ AP4_Result Feed(const AP4_UI08* buffer,
AP4_Size* buffer_size,
AP4_Flags flags = 0);
AP4_Result FindFrame(AP4_AacFrame& frame);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.cpp
index 3d7608c39..ad568459d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.cpp
@@ -38,46 +38,26 @@
const char*
AP4_AvcParser::NaluTypeName(unsigned int nalu_type)
{
- switch(nalu_type)
- {
- case 0:
- return "Unspecified";
- case 1:
- return "Coded slice of a non-IDR picture";
- case 2:
- return "Coded slice data partition A";
- case 3:
- return "Coded slice data partition B";
- case 4:
- return "Coded slice data partition C";
- case 5:
- return "Coded slice of an IDR picture";
- case 6:
- return "Supplemental enhancement information (SEI)";
- case 7:
- return "Sequence parameter set";
- case 8:
- return "Picture parameter set";
- case 9:
- return "Access unit delimiter";
- case 10:
- return "End of sequence";
- case 11:
- return "End of stream";
- case 12:
- return "Filler data";
- case 13:
- return "Sequence parameter set extension";
- case 14:
- return "Prefix NAL unit in scalable extension";
- case 15:
- return "Subset sequence parameter set";
- case 19:
- return "Coded slice of an auxiliary coded picture without partitioning";
- case 20:
- return "Coded slice in scalable extension";
- default:
- return NULL;
+ switch (nalu_type) {
+ case 0: return "Unspecified";
+ case 1: return "Coded slice of a non-IDR picture";
+ case 2: return "Coded slice data partition A";
+ case 3: return "Coded slice data partition B";
+ case 4: return "Coded slice data partition C";
+ case 5: return "Coded slice of an IDR picture";
+ case 6: return "Supplemental enhancement information (SEI)";
+ case 7: return "Sequence parameter set";
+ case 8: return "Picture parameter set";
+ case 9: return "Access unit delimiter";
+ case 10: return "End of sequence";
+ case 11: return "End of stream";
+ case 12: return "Filler data";
+ case 13: return "Sequence parameter set extension";
+ case 14: return "Prefix NAL unit in scalable extension";
+ case 15: return "Subset sequence parameter set";
+ case 19: return "Coded slice of an auxiliary coded picture without partitioning";
+ case 20: return "Coded slice in scalable extension";
+ default: return NULL;
}
}
@@ -87,26 +67,16 @@ AP4_AvcParser::NaluTypeName(unsigned int nalu_type)
const char*
AP4_AvcParser::PrimaryPicTypeName(unsigned int primary_pic_type)
{
- switch(primary_pic_type)
- {
- case 0:
- return "I";
- case 1:
- return "I, P";
- case 2:
- return "I, P, B";
- case 3:
- return "SI";
- case 4:
- return "SI, SP";
- case 5:
- return "I, SI";
- case 6:
- return "I, SI, P, SP";
- case 7:
- return "I, SI, P, SP, B";
- default:
- return NULL;
+ switch (primary_pic_type) {
+ case 0: return "I";
+ case 1: return "I, P";
+ case 2: return "I, P, B";
+ case 3: return "SI";
+ case 4: return "SI, SP";
+ case 5: return "I, SI";
+ case 6: return "I, SI, P, SP";
+ case 7: return "I, SI, P, SP, B";
+ default: return NULL;
}
}
@@ -116,30 +86,18 @@ AP4_AvcParser::PrimaryPicTypeName(unsigned int primary_pic_type)
const char*
AP4_AvcParser::SliceTypeName(unsigned int slice_type)
{
- switch(slice_type)
- {
- case 0:
- return "P";
- case 1:
- return "B";
- case 2:
- return "I";
- case 3:
- return "SP";
- case 4:
- return "SI";
- case 5:
- return "P";
- case 6:
- return "B";
- case 7:
- return "I";
- case 8:
- return "SP";
- case 9:
- return "SI";
- default:
- return NULL;
+ switch (slice_type) {
+ case 0: return "P";
+ case 1: return "B";
+ case 2: return "I";
+ case 3: return "SP";
+ case 4: return "SI";
+ case 5: return "P";
+ case 6: return "B";
+ case 7: return "I";
+ case 8: return "SP";
+ case 9: return "SI";
+ default: return NULL;
}
}
@@ -155,9 +113,9 @@ AP4_AvcParser::AP4_AvcParser() :
/*----------------------------------------------------------------------
| AP4_AvcParser::Feed
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_AvcParser::Feed(const void* data,
- AP4_Size data_size,
+AP4_Result
+AP4_AvcParser::Feed(const void* data,
+ AP4_Size data_size,
AP4_Size& bytes_consumed,
const AP4_DataBuffer*& nalu,
bool is_eos)
@@ -165,113 +123,95 @@ AP4_AvcParser::Feed(const void* data,
// default return values
nalu = NULL;
bytes_consumed = 0;
-
+
// iterate the state machine
unsigned int data_offset;
unsigned int payload_start = 0;
unsigned int payload_end = 0;
bool found_nalu = false;
- for(data_offset = 0; data_offset < data_size && !found_nalu; data_offset++)
- {
+ for (data_offset=0; data_offset<data_size && !found_nalu; data_offset++) {
unsigned char byte = ((const unsigned char*)data)[data_offset];
- switch(m_State)
- {
- case STATE_RESET:
- if(byte == 0)
- {
- m_State = STATE_START_CODE_1;
- }
- break;
-
- case STATE_START_CODE_1:
- if(byte == 0)
- {
- m_State = STATE_START_CODE_2;
- }
- else
- {
- m_State = STATE_RESET;
- }
- break;
-
- case STATE_START_CODE_2:
- if(byte == 0) break;
- if(byte == 1)
- {
- m_State = STATE_START_NALU;
- }
- else
- {
- m_State = STATE_RESET;
- }
- break;
-
- case STATE_START_NALU:
- m_Buffer.SetDataSize(0);
- m_ZeroTrail = 0;
- payload_start = payload_end = data_offset;
- m_State = STATE_IN_NALU;
- // FALLTHROUGH
-
- case STATE_IN_NALU:
- if(byte == 0)
- {
- m_ZeroTrail++;
+ switch (m_State) {
+ case STATE_RESET:
+ if (byte == 0) {
+ m_State = STATE_START_CODE_1;
+ }
+ break;
+
+ case STATE_START_CODE_1:
+ if (byte == 0) {
+ m_State = STATE_START_CODE_2;
+ } else {
+ m_State = STATE_RESET;
+ }
break;
- }
- if(m_ZeroTrail >= 2)
- {
- if(byte == 1)
- {
- found_nalu = true;
+
+ case STATE_START_CODE_2:
+ if (byte == 0) break;
+ if (byte == 1) {
m_State = STATE_START_NALU;
+ } else {
+ m_State = STATE_RESET;
}
- else
- {
- payload_end += m_ZeroTrail + 1;
+ break;
+
+ case STATE_START_NALU:
+ m_Buffer.SetDataSize(0);
+ m_ZeroTrail = 0;
+ payload_start = payload_end = data_offset;
+ m_State = STATE_IN_NALU;
+ // FALLTHROUGH
+
+ case STATE_IN_NALU:
+ if (byte == 0) {
+ m_ZeroTrail++;
+ break;
+ }
+ if (m_ZeroTrail >= 2) {
+ if (byte == 1) {
+ found_nalu = true;
+ m_State = STATE_START_NALU;
+ } else {
+ payload_end += m_ZeroTrail+1;
+ }
+ } else {
+ payload_end += m_ZeroTrail+1;
}
- }
- else
- {
- payload_end += m_ZeroTrail + 1;
- }
- m_ZeroTrail = 0;
- break;
+ m_ZeroTrail = 0;
+ break;
}
}
- if(is_eos && m_State == STATE_IN_NALU && data_offset == data_size)
- {
+ if (is_eos && m_State == STATE_IN_NALU && data_offset == data_size) {
found_nalu = true;
m_ZeroTrail = 0;
m_State = STATE_RESET;
}
- if(payload_end > payload_start)
- {
+ if (payload_end > payload_start) {
AP4_Size current_payload_size = m_Buffer.GetDataSize();
- m_Buffer.SetDataSize(m_Buffer.GetDataSize() + (payload_end - payload_start));
- AP4_CopyMemory(((unsigned char *)m_Buffer.UseData()) + current_payload_size,
- ((const unsigned char*)data) + payload_start,
- payload_end - payload_start);
+ m_Buffer.SetDataSize(m_Buffer.GetDataSize()+(payload_end-payload_start));
+ AP4_CopyMemory(((unsigned char *)m_Buffer.UseData())+current_payload_size,
+ ((const unsigned char*)data)+payload_start,
+ payload_end-payload_start);
}
-
+
// compute how many bytes we have consumed
bytes_consumed = data_offset;
-
+
// return the NALU if we found one
- if(found_nalu) nalu = &m_Buffer;
-
+ if (found_nalu) nalu = &m_Buffer;
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AvcParser::Reset
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_AvcParser::Reset()
{
m_State = STATE_RESET;
m_ZeroTrail = 0;
m_Buffer.SetDataSize(0);
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.h b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.h
index 3f9aac33f..ffb626c94 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4AvcParser.h
@@ -39,15 +39,14 @@
/*----------------------------------------------------------------------
| AP4_AvcParser
+---------------------------------------------------------------------*/
-class AP4_AvcParser
-{
+class AP4_AvcParser {
public:
static const char* NaluTypeName(unsigned int nalu_type);
static const char* PrimaryPicTypeName(unsigned int primary_pic_type);
static const char* SliceTypeName(unsigned int slice_type);
-
+
AP4_AvcParser();
-
+
/**
* Feed some data to the parser and look for the next NAL Unit.
*
@@ -57,34 +56,33 @@ public:
* @param bytes_consumed: Number of bytes from the data buffer that were
* consumed and stored by the parser.
* @param nalu: Reference to a pointer to a buffer object that contains
- * a NAL unit found in the previously fed data, or a NULL pointer if no
+ * a NAL unit found in the previously fed data, or a NULL pointer if no
* NAL unit can be found so far.
* @param eos: Boolean flag that indicates if this buffer is the last
* buffer in the stream/file (End Of Stream).
*
* @result: AP4_SUCCESS is the call succeeds, or an error code if it
* fails.
- *
+ *
* The caller must not feed the same data twice. When this method
* returns, the caller should inspect the value of bytes_consumed and
* advance the input stream source accordingly, such that the next
* buffer passed to this method will be exactly bytes_consumed bytes
* after what was passed in this call.
*/
- AP4_Result Feed(const void* data,
- AP4_Size data_size,
+ AP4_Result Feed(const void* data,
+ AP4_Size data_size,
AP4_Size& bytes_consumed,
const AP4_DataBuffer*& nalu,
- bool eos = false);
-
+ bool eos=false);
+
/**
* Reset the state of the parser (for example, to parse a new stream).
*/
AP4_Result Reset();
-
+
private:
- enum
- {
+ enum {
STATE_RESET,
STATE_START_CODE_1,
STATE_START_CODE_2,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.cpp
index 57a1d8afe..0e1ebd596 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.cpp
@@ -72,11 +72,11 @@ AP4_BitStream::Reset()
/*----------------------------------------------------------------------
| AP4_BitStream::ByteAlign
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_BitStream::ByteAlign()
{
unsigned int to_flush = m_BitsCached & 7;
- if(to_flush > 0) SkipBits(to_flush);
+ if (to_flush > 0) SkipBits(to_flush);
return AP4_SUCCESS;
}
@@ -87,11 +87,11 @@ AP4_BitStream::ByteAlign()
AP4_Size
AP4_BitStream::GetContiguousBytesFree()
{
- return
+ return
(m_In < m_Out) ?
(m_Out - m_In - 1) :
(m_Out == 0 ? (AP4_BITSTREAM_BUFFER_SIZE - m_In - 1) :
- (AP4_BITSTREAM_BUFFER_SIZE - m_In));
+ (AP4_BITSTREAM_BUFFER_SIZE - m_In));
}
/*----------------------------------------------------------------------
@@ -100,9 +100,9 @@ AP4_BitStream::GetContiguousBytesFree()
AP4_Size
AP4_BitStream::GetBytesFree()
{
- return
- (m_In < m_Out) ?
- (m_Out - m_In - 1) :
+ return
+ (m_In < m_Out) ?
+ (m_Out - m_In - 1) :
(AP4_BITSTREAM_BUFFER_SIZE + (m_Out - m_In) - 1);
}
@@ -110,38 +110,33 @@ AP4_BitStream::GetBytesFree()
| AP4_BitStream::WriteBytes
+----------------------------------------------------------------------*/
AP4_Result
-AP4_BitStream::WriteBytes(const AP4_UI08* bytes,
+AP4_BitStream::WriteBytes(const AP4_UI08* bytes,
AP4_Size byte_count)
{
/* check parameters */
- if(byte_count == 0) return AP4_SUCCESS;
- if(bytes == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ if (byte_count == 0) return AP4_SUCCESS;
+ if (bytes == NULL) return AP4_ERROR_INVALID_PARAMETERS;
/* check that we have enough space */
- if(GetBytesFree() < byte_count)
- {
+ if (GetBytesFree() < byte_count) {
return AP4_FAILURE;
}
/* write the bytes */
- if(m_In < m_Out)
- {
- AP4_CopyMemory(m_Buffer + m_In, bytes, byte_count);
+ if (m_In < m_Out) {
+ AP4_CopyMemory(m_Buffer+m_In, bytes, byte_count);
AP4_BITSTREAM_POINTER_ADD(m_In, byte_count);
- }
- else
- {
+ } else {
unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_In;
- if(chunk > byte_count) chunk = byte_count;
+ if (chunk > byte_count) chunk = byte_count;
- AP4_CopyMemory(m_Buffer + m_In, bytes, chunk);
+ AP4_CopyMemory(m_Buffer+m_In, bytes, chunk);
AP4_BITSTREAM_POINTER_ADD(m_In, chunk);
- if(chunk != byte_count)
- {
- AP4_CopyMemory(m_Buffer + m_In,
- bytes + chunk, byte_count - chunk);
- AP4_BITSTREAM_POINTER_ADD(m_In, byte_count - chunk);
+ if (chunk != byte_count) {
+ AP4_CopyMemory(m_Buffer+m_In,
+ bytes+chunk, byte_count-chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_In, byte_count-chunk);
}
}
@@ -154,8 +149,8 @@ AP4_BitStream::WriteBytes(const AP4_UI08* bytes,
AP4_Size
AP4_BitStream::GetContiguousBytesAvailable()
{
- return
- (m_Out <= m_In) ?
+ return
+ (m_Out <= m_In) ?
(m_In - m_Out) :
(AP4_BITSTREAM_BUFFER_SIZE - m_Out);
}
@@ -166,8 +161,8 @@ AP4_BitStream::GetContiguousBytesAvailable()
AP4_Size
AP4_BitStream::GetBytesAvailable()
{
- return
- (m_Out <= m_In) ?
+ return
+ (m_Out <= m_In) ?
(m_In - m_Out) :
(m_In + (AP4_BITSTREAM_BUFFER_SIZE - m_Out));
}
@@ -176,105 +171,90 @@ AP4_BitStream::GetBytesAvailable()
| AP4_BitStream::ReadBytes
+----------------------------------------------------------------------*/
AP4_Result
-AP4_BitStream::ReadBytes(AP4_UI08* bytes,
+AP4_BitStream::ReadBytes(AP4_UI08* bytes,
AP4_Size byte_count)
{
- if(byte_count == 0 || bytes == NULL)
- {
- return AP4_ERROR_INVALID_PARAMETERS;
- }
-
- /* Gets bytes from the cache */
- ByteAlign();
- while(m_BitsCached > 0 && byte_count > 0)
- {
- *bytes = ReadBits(8);
- ++ bytes;
- -- byte_count;
- }
-
- /* Get other bytes */
- if(byte_count > 0)
- {
- if(m_Out < m_In)
- {
- AP4_CopyMemory(bytes, m_Buffer + m_Out, byte_count);
- AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count);
- }
- else
- {
- unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_Out;
- if(chunk >= byte_count) chunk = byte_count;
-
- AP4_CopyMemory(bytes, m_Buffer + m_Out, chunk);
- AP4_BITSTREAM_POINTER_ADD(m_Out, chunk);
-
- if(chunk != byte_count)
- {
- AP4_CopyMemory(bytes + chunk,
- m_Buffer + m_Out,
- byte_count - chunk);
- AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count - chunk);
- }
- }
- }
-
- return AP4_SUCCESS;
+ if (byte_count == 0 || bytes == NULL) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ /* Gets bytes from the cache */
+ ByteAlign();
+ while (m_BitsCached > 0 && byte_count > 0) {
+ *bytes = ReadBits(8);
+ ++ bytes;
+ -- byte_count;
+ }
+
+ /* Get other bytes */
+ if (byte_count > 0) {
+ if (m_Out < m_In) {
+ AP4_CopyMemory(bytes, m_Buffer + m_Out, byte_count);
+ AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count);
+ } else {
+ unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_Out;
+ if (chunk >= byte_count) chunk = byte_count;
+
+ AP4_CopyMemory(bytes, m_Buffer+m_Out, chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_Out, chunk);
+
+ if (chunk != byte_count) {
+ AP4_CopyMemory(bytes+chunk,
+ m_Buffer+m_Out,
+ byte_count-chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count-chunk);
+ }
+ }
+ }
+
+ return AP4_SUCCESS;
}
/*----------------------------------------------------------------------+
| AP4_BitStream::PeekBytes
+----------------------------------------------------------------------*/
AP4_Result
-AP4_BitStream::PeekBytes(AP4_UI08* bytes,
+AP4_BitStream::PeekBytes(AP4_UI08* bytes,
AP4_Size byte_count)
{
- int bits_cached_byte;
-
- if(byte_count == 0 || bytes == NULL)
- {
- return AP4_ERROR_INVALID_PARAMETERS;
- }
-
- /* Gets bytes from the cache */
- bits_cached_byte = m_BitsCached & ~7;
- while(bits_cached_byte > 0 && byte_count > 0)
- {
- *bytes = (m_Cache >> bits_cached_byte) & 0xFF;
- ++ bytes;
- -- byte_count;
- bits_cached_byte -= 8;
- }
-
- /* Get other bytes */
- if(byte_count > 0)
- {
- if(m_In > m_Out)
- {
- AP4_CopyMemory(bytes, m_Buffer + m_Out, byte_count);
- }
- else
- {
- unsigned int out = m_Out;
- unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - out;
- if(chunk >= byte_count)
- {
- chunk = byte_count;
- }
-
- AP4_CopyMemory(bytes, m_Buffer + out, chunk);
- AP4_BITSTREAM_POINTER_ADD(out, chunk);
-
- if(chunk != byte_count)
- {
- AP4_CopyMemory(bytes + chunk,
- m_Buffer + out,
- byte_count - chunk);
- }
- }
- }
-
- return AP4_SUCCESS;
+ int bits_cached_byte;
+
+ if (byte_count == 0 || bytes == NULL) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ /* Gets bytes from the cache */
+ bits_cached_byte = m_BitsCached & ~7;
+ while (bits_cached_byte > 0 && byte_count > 0) {
+ *bytes = (m_Cache >> bits_cached_byte) & 0xFF;
+ ++ bytes;
+ -- byte_count;
+ bits_cached_byte -= 8;
+ }
+
+ /* Get other bytes */
+ if (byte_count > 0) {
+ if (m_In > m_Out) {
+ AP4_CopyMemory(bytes, m_Buffer + m_Out, byte_count);
+ } else {
+ unsigned int out = m_Out;
+ unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - out;
+ if (chunk >= byte_count) {
+ chunk = byte_count;
+ }
+
+ AP4_CopyMemory(bytes, m_Buffer+out, chunk);
+ AP4_BITSTREAM_POINTER_ADD(out, chunk);
+
+ if (chunk != byte_count) {
+ AP4_CopyMemory(bytes+chunk,
+ m_Buffer+out,
+ byte_count-chunk);
+ }
+ }
+ }
+
+ return AP4_SUCCESS;
}
/*----------------------------------------------------------------------+
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h
index 5697e86d9..c0bb0566e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4BitStream.h
@@ -40,7 +40,7 @@
+---------------------------------------------------------------------*/
const int AP4_ERROR_BASE_BITSTREAM = -10000;
-// the max frame size we can handle
+// the max frame size we can handle
const unsigned int AP4_BITSTREAM_BUFFER_SIZE = 8192;
// flags
@@ -100,7 +100,7 @@ private:
// methods
AP4_BitsWord ReadCache() const;
};
-
+
/*----------------------------------------------------------------------
| macros
+---------------------------------------------------------------------*/
@@ -121,31 +121,28 @@ private:
inline AP4_BitsWord
AP4_BitStream::ReadCache() const
{
- unsigned int pos = m_Out;
- AP4_BitsWord cache;
+ unsigned int pos = m_Out;
+ AP4_BitsWord cache;
#if AP4_WORD_BITS != 32
#error unsupported word size /* 64 and other word size not yet implemented */
#endif
- if(pos <= AP4_BITSTREAM_BUFFER_SIZE - AP4_WORD_BYTES)
- {
- unsigned char* out_ptr = &m_Buffer[pos];
- cache = (((AP4_BitsWord) out_ptr[0]) << 24)
- | (((AP4_BitsWord) out_ptr[1]) << 16)
- | (((AP4_BitsWord) out_ptr[2]) << 8)
- | (((AP4_BitsWord) out_ptr[3]));
- }
- else
- {
- unsigned char* buf_ptr = m_Buffer;
- cache = (((AP4_BitsWord) buf_ptr[ pos ]) << 24)
- | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET(pos, 1)]) << 16)
- | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET(pos, 2)]) << 8)
- | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET(pos, 3)]));
- }
-
- return cache;
+ if (pos <= AP4_BITSTREAM_BUFFER_SIZE - AP4_WORD_BYTES) {
+ unsigned char* out_ptr = &m_Buffer[pos];
+ cache = (((AP4_BitsWord) out_ptr[0]) << 24)
+ | (((AP4_BitsWord) out_ptr[1]) << 16)
+ | (((AP4_BitsWord) out_ptr[2]) << 8)
+ | (((AP4_BitsWord) out_ptr[3]) );
+ } else {
+ unsigned char* buf_ptr = m_Buffer;
+ cache = (((AP4_BitsWord) buf_ptr[ pos ]) << 24)
+ | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 1)]) << 16)
+ | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 2)]) << 8)
+ | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 3)]) );
+ }
+
+ return cache;
}
/*----------------------------------------------------------------------
@@ -155,14 +152,11 @@ inline AP4_UI32
AP4_BitStream::ReadBits(unsigned int n)
{
AP4_BitsWord result;
- if(m_BitsCached >= n)
- {
+ if (m_BitsCached >= n) {
/* we have enough bits in the cache to satisfy the request */
m_BitsCached -= n;
result = (m_Cache >> m_BitsCached) & AP4_BIT_MASK(n);
- }
- else
- {
+ } else {
/* not enough bits in the cache */
AP4_BitsWord word;
@@ -192,8 +186,7 @@ inline int
AP4_BitStream::ReadBit()
{
AP4_BitsWord result;
- if(m_BitsCached == 0)
- {
+ if (m_BitsCached == 0) {
/* the cache is empty */
/* read the next word into the cache */
@@ -203,9 +196,7 @@ AP4_BitStream::ReadBit()
/* return the first bit */
result = m_Cache >> (AP4_WORD_BITS - 1);
- }
- else
- {
+ } else {
/* get the bit from the cache */
result = (m_Cache >> (--m_BitsCached)) & 1;
}
@@ -218,21 +209,18 @@ AP4_BitStream::ReadBit()
inline AP4_UI32
AP4_BitStream::PeekBits(unsigned int n)
{
- /* we have enough bits in the cache to satisfy the request */
- if(m_BitsCached >= n)
- {
- return (m_Cache >> (m_BitsCached - n)) & AP4_BIT_MASK(n);
- }
- else
- {
- /* not enough bits in the cache, read the next word */
- AP4_BitsWord word = ReadCache();
-
- /* combine the new word and the cache, and update the state */
- AP4_BitsWord cache = m_Cache & AP4_BIT_MASK(m_BitsCached);
- n -= m_BitsCached;
- return (word >> (AP4_WORD_BITS - n)) | (cache << n);
- }
+ /* we have enough bits in the cache to satisfy the request */
+ if (m_BitsCached >= n) {
+ return (m_Cache >> (m_BitsCached - n)) & AP4_BIT_MASK(n);
+ } else {
+ /* not enough bits in the cache, read the next word */
+ AP4_BitsWord word = ReadCache();
+
+ /* combine the new word and the cache, and update the state */
+ AP4_BitsWord cache = m_Cache & AP4_BIT_MASK(m_BitsCached);
+ n -= m_BitsCached;
+ return (word >> (AP4_WORD_BITS - n)) | (cache << n);
+ }
}
/*----------------------------------------------------------------------
@@ -241,20 +229,17 @@ AP4_BitStream::PeekBits(unsigned int n)
inline int
AP4_BitStream::PeekBit()
{
- /* the cache is empty */
- if(m_BitsCached == 0)
- {
- /* read the next word into the cache */
- AP4_BitsWord cache = ReadCache();
-
- /* return the first bit */
- return cache >> (AP4_WORD_BITS - 1);
- }
- else
- {
- /* get the bit from the cache */
- return (m_Cache >> (m_BitsCached - 1)) & 1;
- }
+ /* the cache is empty */
+ if (m_BitsCached == 0) {
+ /* read the next word into the cache */
+ AP4_BitsWord cache = ReadCache();
+
+ /* return the first bit */
+ return cache >> (AP4_WORD_BITS - 1);
+ } else {
+ /* get the bit from the cache */
+ return (m_Cache >> (m_BitsCached-1)) & 1;
+ }
}
/*----------------------------------------------------------------------
@@ -263,30 +248,23 @@ AP4_BitStream::PeekBit()
inline void
AP4_BitStream::SkipBits(unsigned int n)
{
- if(n <= m_BitsCached)
- {
- m_BitsCached -= n;
- }
- else
- {
- n -= m_BitsCached;
- while(n >= AP4_WORD_BITS)
- {
- m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
- n -= AP4_WORD_BITS;
- }
- if(n)
- {
- m_Cache = ReadCache();
- m_BitsCached = AP4_WORD_BITS - n;
- m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
- }
- else
- {
- m_BitsCached = 0;
- m_Cache = 0;
- }
- }
+ if (n <= m_BitsCached) {
+ m_BitsCached -= n;
+ } else {
+ n -= m_BitsCached;
+ while (n >= AP4_WORD_BITS) {
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ n -= AP4_WORD_BITS;
+ }
+ if (n) {
+ m_Cache = ReadCache();
+ m_BitsCached = AP4_WORD_BITS-n;
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ } else {
+ m_BitsCached = 0;
+ m_Cache = 0;
+ }
+ }
}
/*----------------------------------------------------------------------
@@ -295,16 +273,13 @@ AP4_BitStream::SkipBits(unsigned int n)
inline void
AP4_BitStream::SkipBit()
{
- if(m_BitsCached == 0)
- {
- m_Cache = ReadCache();
- m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
- m_BitsCached = AP4_WORD_BITS - 1;
- }
- else
- {
- --m_BitsCached;
- }
+ if (m_BitsCached == 0) {
+ m_Cache = ReadCache();
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ m_BitsCached = AP4_WORD_BITS - 1;
+ } else {
+ --m_BitsCached;
+ }
}
/*----------------------------------------------------------------------
@@ -313,8 +288,8 @@ AP4_BitStream::SkipBit()
inline AP4_UI08
AP4_BitStream::ReadByte()
{
- SkipBits(m_BitsCached & 7);
- return ReadBits(8);
+ SkipBits(m_BitsCached & 7);
+ return ReadBits(8);
}
/*----------------------------------------------------------------------
@@ -323,11 +298,11 @@ AP4_BitStream::ReadByte()
inline AP4_UI08
AP4_BitStream::PeekByte()
{
- int extra_bits = m_BitsCached & 7;
- int data = PeekBits(extra_bits + 8);
- int byte = data & 0xFF;
+ int extra_bits = m_BitsCached & 7;
+ int data = PeekBits(extra_bits + 8);
+ int byte = data & 0xFF;
- return byte;
+ return byte;
}
#endif // _AP4_BIT_STREAM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.cpp
index b08f13cf7..a054f0c97 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.cpp
@@ -40,9 +40,9 @@
const unsigned int AP4_AAC_MAX_SAMPLING_FREQUENCY_INDEX = 12;
static const unsigned int AP4_AacSamplingFreqTable[13] =
{
- 96000, 88200, 64000, 48000,
- 44100, 32000, 24000, 22050,
- 16000, 12000, 11025, 8000,
+ 96000, 88200, 64000, 48000,
+ 44100, 32000, 24000, 22050,
+ 16000, 12000, 11025, 8000,
7350
};
@@ -53,30 +53,25 @@ class AP4_Mp4AudioDsiParser
{
public:
AP4_Mp4AudioDsiParser(const AP4_UI08* data, AP4_Size data_size) :
- m_Data(data, data_size),
+ m_Data(data, data_size),
m_Position(0) {}
-
- AP4_Size BitsLeft()
- {
- return 8 * m_Data.GetDataSize() - m_Position;
- }
- AP4_UI32 ReadBits(unsigned int n)
- {
+
+ AP4_Size BitsLeft() { return 8*m_Data.GetDataSize()-m_Position; }
+ AP4_UI32 ReadBits(unsigned int n) {
AP4_UI32 result = 0;
const AP4_UI08* data = m_Data.GetData();
- while(n)
- {
- unsigned int bits_avail = 8 - (m_Position % 8);
+ while (n) {
+ unsigned int bits_avail = 8-(m_Position%8);
unsigned int chunk_size = bits_avail >= n ? n : bits_avail;
- unsigned int chunk_bits = (((unsigned int)(data[m_Position/8])) >> (bits_avail - chunk_size)) & ((1 << chunk_size) - 1);
+ unsigned int chunk_bits = (((unsigned int)(data[m_Position/8]))>>(bits_avail-chunk_size))&((1<<chunk_size)-1);
result = (result << chunk_size) | chunk_bits;
n -= chunk_size;
m_Position += chunk_size;
}
-
+
return result;
}
-
+
private:
AP4_DataBuffer m_Data;
unsigned int m_Position;
@@ -117,14 +112,13 @@ AP4_Mp4AudioDecoderConfig::Reset()
AP4_Result
AP4_Mp4AudioDecoderConfig::ParseAudioObjectType(AP4_Mp4AudioDsiParser& parser, AP4_UI08& object_type)
{
- if(parser.BitsLeft() < 5) return AP4_ERROR_INVALID_FORMAT;
+ if (parser.BitsLeft() < 5) return AP4_ERROR_INVALID_FORMAT;
object_type = (AP4_UI08)parser.ReadBits(5);
- if((int)object_type == 31)
- {
- if(parser.BitsLeft() < 6) return AP4_ERROR_INVALID_FORMAT;
- object_type = (AP4_UI08)(32 + parser.ReadBits(6));
- }
- return AP4_SUCCESS;
+ if ((int)object_type == 31) {
+ if (parser.BitsLeft() < 6) return AP4_ERROR_INVALID_FORMAT;
+ object_type = (AP4_UI08)(32 + parser.ReadBits(6));
+ }
+ return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
@@ -133,24 +127,20 @@ AP4_Mp4AudioDecoderConfig::ParseAudioObjectType(AP4_Mp4AudioDsiParser& parser, A
AP4_Result
AP4_Mp4AudioDecoderConfig::ParseGASpecificInfo(AP4_Mp4AudioDsiParser& parser)
{
- if(parser.BitsLeft() < 2) return AP4_ERROR_INVALID_FORMAT;
- m_FrameLengthFlag = (parser.ReadBits(1) == 1);
- m_DependsOnCoreCoder = (parser.ReadBits(1) == 1);
- if(m_DependsOnCoreCoder)
- {
- if(parser.BitsLeft() < 14) return AP4_ERROR_INVALID_FORMAT;
- m_CoreCoderDelay = parser.ReadBits(14);
- }
- else
- {
+ if (parser.BitsLeft() < 2) return AP4_ERROR_INVALID_FORMAT;
+ m_FrameLengthFlag = (parser.ReadBits(1) == 1);
+ m_DependsOnCoreCoder = (parser.ReadBits(1) == 1);
+ if (m_DependsOnCoreCoder) {
+ if (parser.BitsLeft() < 14) return AP4_ERROR_INVALID_FORMAT;
+ m_CoreCoderDelay = parser.ReadBits(14);
+ } else {
m_CoreCoderDelay = 0;
}
- if(parser.BitsLeft() < 1) return AP4_ERROR_INVALID_FORMAT;
- parser.ReadBits(1); /* extensionFlag */
- if(m_ChannelConfiguration == CHANNEL_CONFIG_NONE)
- {
- /*program_config_element (); */
- }
+ if (parser.BitsLeft() < 1) return AP4_ERROR_INVALID_FORMAT;
+ parser.ReadBits(1); /* extensionFlag */
+ if (m_ChannelConfiguration == CHANNEL_CONFIG_NONE) {
+ /*program_config_element (); */
+ }
return AP4_SUCCESS;
}
@@ -159,30 +149,23 @@ AP4_Mp4AudioDecoderConfig::ParseGASpecificInfo(AP4_Mp4AudioDsiParser& parser)
| AP4_Mp4AudioDecoderConfig::ParseSamplingFrequency
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Mp4AudioDecoderConfig::ParseSamplingFrequency(AP4_Mp4AudioDsiParser& parser,
- unsigned int& sampling_frequency_index,
- unsigned int& sampling_frequency)
+AP4_Mp4AudioDecoderConfig::ParseSamplingFrequency(AP4_Mp4AudioDsiParser& parser,
+ unsigned int& sampling_frequency_index,
+ unsigned int& sampling_frequency)
{
- if(parser.BitsLeft() < 4)
- {
+ if (parser.BitsLeft() < 4) {
return AP4_ERROR_INVALID_FORMAT;
}
sampling_frequency_index = parser.ReadBits(4);
- if(sampling_frequency_index == 0xF)
- {
- if(parser.BitsLeft() < 24)
- {
+ if (sampling_frequency_index == 0xF) {
+ if (parser.BitsLeft() < 24) {
return AP4_ERROR_INVALID_FORMAT;
}
sampling_frequency = parser.ReadBits(24);
- }
- else if(sampling_frequency_index <= AP4_AAC_MAX_SAMPLING_FREQUENCY_INDEX)
- {
+ } else if (sampling_frequency_index <= AP4_AAC_MAX_SAMPLING_FREQUENCY_INDEX) {
sampling_frequency = AP4_AacSamplingFreqTable[sampling_frequency_index];
- }
- else
- {
+ } else {
sampling_frequency = 0;
return AP4_ERROR_INVALID_FORMAT;
}
@@ -194,7 +177,7 @@ AP4_Mp4AudioDecoderConfig::ParseSamplingFrequency(AP4_Mp4AudioDsiParser& parser,
| AP4_Mp4AudioDecoderConfig::Parse
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Mp4AudioDecoderConfig::Parse(const unsigned char* data,
+AP4_Mp4AudioDecoderConfig::Parse(const unsigned char* data,
AP4_Size data_size)
{
AP4_Result result;
@@ -202,73 +185,65 @@ AP4_Mp4AudioDecoderConfig::Parse(const unsigned char* data,
// default config
Reset();
-
+
// parse the audio object type
- result = ParseAudioObjectType(bits, m_ObjectType);
- if(AP4_FAILED(result)) return result;
+ result = ParseAudioObjectType(bits, m_ObjectType);
+ if (AP4_FAILED(result)) return result;
// parse the sampling frequency
- result = ParseSamplingFrequency(bits,
- m_SamplingFrequencyIndex,
+ result = ParseSamplingFrequency(bits,
+ m_SamplingFrequencyIndex,
m_SamplingFrequency);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
- if(bits.BitsLeft() < 4)
- {
+ if (bits.BitsLeft() < 4) {
return AP4_ERROR_INVALID_FORMAT;
}
- m_ChannelConfiguration = (ChannelConfiguration)bits.ReadBits(4);
+ m_ChannelConfiguration = (ChannelConfiguration)bits.ReadBits(4);
m_ChannelCount = (unsigned int)m_ChannelConfiguration;
- if(m_ChannelCount == 7)
- {
+ if (m_ChannelCount == 7) {
m_ChannelCount = 8;
- }
- else if(m_ChannelCount > 7)
- {
+ } else if (m_ChannelCount > 7) {
m_ChannelCount = 0;
}
-
- if(m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR ||
- m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_PS)
- {
- m_Extension.m_ObjectType = AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR;
- m_Extension.m_SbrPresent = true;
+
+ if (m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR ||
+ m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_PS) {
+ m_Extension.m_ObjectType = AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR;
+ m_Extension.m_SbrPresent = true;
m_Extension.m_PsPresent = m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_PS;
- result = ParseSamplingFrequency(bits,
- m_Extension.m_SamplingFrequencyIndex,
+ result = ParseSamplingFrequency(bits,
+ m_Extension.m_SamplingFrequencyIndex,
m_Extension.m_SamplingFrequency);
- if(AP4_FAILED(result)) return result;
- result = ParseAudioObjectType(bits, m_ObjectType);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ result = ParseAudioObjectType(bits, m_ObjectType);
+ if (AP4_FAILED(result)) return result;
+ } else {
m_Extension.m_ObjectType = 0;
m_Extension.m_SamplingFrequency = 0;
m_Extension.m_SamplingFrequencyIndex = 0;
m_Extension.m_SbrPresent = false;
m_Extension.m_PsPresent = false;
}
-
- switch(m_ObjectType)
- {
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_MAIN:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SSR:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LTP:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SCALABLE:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_TWINVQ:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LC:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LTP:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_SCALABLE:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LD:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_TWINVQ:
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_BSAC:
- result = ParseGASpecificInfo(bits);
- break;
-
- default:
- return AP4_ERROR_NOT_SUPPORTED;
+
+ switch (m_ObjectType) {
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_MAIN:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SSR:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LTP:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SCALABLE:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_TWINVQ:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LC:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LTP:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_SCALABLE:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LD:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_TWINVQ:
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_BSAC:
+ result = ParseGASpecificInfo(bits);
+ break;
+
+ default:
+ return AP4_ERROR_NOT_SUPPORTED;
}
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.h b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.h
index 337c125a8..eeb629069 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Codecs/Ap4Mp4AudioInfo.h
@@ -44,14 +44,12 @@ class AP4_Mp4AudioDsiParser;
* DecoderConfigDescriptor descriptor carried in the sample description
* for the audio samples. See 14496-1, subpart 2, p 2.6.6 for details.
*/
-class AP4_Mp4AudioDecoderConfig
-{
+class AP4_Mp4AudioDecoderConfig {
public:
/**
* Channel configuration for multichannel audio buffers.
*/
- typedef enum
- {
+ typedef enum {
CHANNEL_CONFIG_NONE = 0, /**< No channel (not used) */
CHANNEL_CONFIG_MONO = 1, /**< Mono (single audio channel) */
CHANNEL_CONFIG_STEREO = 2, /**< Stereo (Two audio channels) */
@@ -65,17 +63,17 @@ public:
// constructor
AP4_Mp4AudioDecoderConfig();
-
+
/**
* Parser a DecoderSpecificInfo buffer
*/
AP4_Result Parse(const AP4_UI08* data, AP4_Size data_size);
-
+
/**
* Reset all members to default values (0)
*/
void Reset();
-
+
// members
AP4_UI08 m_ObjectType; /**< Type identifier for the audio data */
unsigned int m_SamplingFrequencyIndex; /**< Index of the sampling frequency in the sampling frequency table */
@@ -86,19 +84,18 @@ public:
bool m_DependsOnCoreCoder; /**< Depends on Core Coder */
unsigned int m_CoreCoderDelay; /**< Core Code delay */
/** Extension details */
- struct
- {
+ struct {
bool m_SbrPresent; /**< SBR is present */
bool m_PsPresent; /**< PS is present */
AP4_UI08 m_ObjectType; /**< Extension object type */
unsigned int m_SamplingFrequencyIndex; /**< Sampling frequency index of the extension */
unsigned int m_SamplingFrequency; /**< Sampling frequency of the extension */
} m_Extension;
-
+
private:
AP4_Result ParseAudioObjectType(AP4_Mp4AudioDsiParser& parser, AP4_UI08& object_type);
AP4_Result ParseGASpecificInfo(AP4_Mp4AudioDsiParser& parser);
- AP4_Result ParseSamplingFrequency(AP4_Mp4AudioDsiParser& parser,
+ AP4_Result ParseSamplingFrequency(AP4_Mp4AudioDsiParser& parser,
unsigned int& sampling_frequency_index,
unsigned int& sampling_frequency);
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4.h
index b7648bca3..aa81266d4 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4.h
@@ -25,7 +25,7 @@
| 02111-1307, USA.
|
****************************************************************/
-/**
+/**
* @file
* @brief Top Level include file
*
@@ -37,23 +37,23 @@
*
* @section intro_sec Introduction
* Bento4/AP4 is a C++ class library designed to read and write ISO-MP4 files.
-* This format is defined in ISO/IEC 14496-12, 14496-14 and 14496-15.
-* The format is a derivative of the Apple Quicktime file format.
-* Because of that, Bento4 can be used to read and write a number of Quicktime files
+* This format is defined in ISO/IEC 14496-12, 14496-14 and 14496-15.
+* The format is a derivative of the Apple Quicktime file format.
+* Because of that, Bento4 can be used to read and write a number of Quicktime files
* as well, even though some Quicktime specific features are not supported.
* In addition, Bento4 supports a number of extensions as defined in various
* other specifications. This includes some support for ISMA Encrytion and
-* Decryption as defined in the ISMA E&A specification (http://www.isma.tv),
+* Decryption as defined in the ISMA E&A specification (http://www.isma.tv),
* OMA 2.0 PDCF Encryption and Decryption as defined in the OMA 2.0 PDCF
* specification (http://www.openmobilealliance.org) and iTunes compatible
* metadata.
* The SDK includes a number of command line tools, built using the class library,
* that serve as general purpose tools as well as examples of how to use the API.
-*
+*
* The SDK is designed to be cross-platform. The code is very portable; it can
* be compiled with any sufficiently modern C++ compiler. The code does not rely
* on any external library; all the code necessary to compile the SDK and its
-* tools is included in the standard distribution. The standard distribution
+* tools is included in the standard distribution. The standard distribution
* contains makefiles for unix-like operating systems, including Linux, project
* files for Microsoft Visual Studio, and an XCode project for MacOS X. There is
* also support for building the library with the SCons build system.
@@ -71,9 +71,9 @@
* will create the SDK directory structure as described above.
*
* @subsection build_linux Linux
-* Go to Build/Targets/x86-unknown-linux or Build/Targets/<target-name>
+* Go to Build/Targets/x86-unknown-linux or Build/Targets/<target-name>
* for any linux-based target, and use the 'make'
-* command to build the library and tools, or 'make sdk' to build the SDK
+* command to build the library and tools, or 'make sdk' to build the SDK
* directory structure.
*
* @subsection build_cygwin Cygwin
@@ -85,37 +85,37 @@
*
* @subsection build_scons Using SCons
* There is experimental support for building the SDK using the python-based
-* SCons tool (http://www.scons.org). The top level configuration is located
+* SCons tool (http://www.scons.org). The top level configuration is located
* at the root of the SDK, and will output all the object files and binaries
* to a sub-directory under Build/SCons/Targets/<target-name>/<config-name>.
*
* @subsection build_others Other Platforms
* Other plaftorms can be built by adapting the makefiles for the generic
-* gcc-based configurations.
+* gcc-based configurations.
*
* @section mp4_structure Structure of an MP4 file
*
* An MP4 file consists of a tree of atoms (also known as boxes). The atoms
* contain the information about the different media tracks for the file, as
* well as other information, such as metadata.
-* The Bento4 class library parses files an constructs an in-memory representation
+* The Bento4 class library parses files an constructs an in-memory representation
* of the atoms, and provides an API that is an abstraction layer for the
* way the information is actually encoded in those atoms.
*
* @section reading Reading Files
*
* The class #AP4_File represents all the information about an MP4 file.
-* Internally, a tree of #AP4_Atom objects plus other helper objects holds
+* Internally, a tree of #AP4_Atom objects plus other helper objects holds
* the actual information.
-* To create an instance of the class, the caller must pass a reference to
+* To create an instance of the class, the caller must pass a reference to
* an #AP4_ByteStream object that represents the file data storage. The SDK
-* includes two subclasses of the abstract #AP4_ByteStream class:
+* includes two subclasses of the abstract #AP4_ByteStream class:
* #AP4_FileByteStream for reading/writing disk-based files and
* #AP4_MemoryByteStream for working with in-memory file images.
* Once you have created an #AP4_File object, you can get to the media data by
* accessing the #AP4_Track objects of its #AP4_Movie (see #AP4_File::GetMovie).
* The #AP4_Track exposes the necessary methods for you to get the
-* #AP4_SampleDescription (typically to initialize your decoder) and to get the
+* #AP4_SampleDescription (typically to initialize your decoder) and to get the
* #AP4_Sample objects from the track.
* These #AP4_Sample objects give you the meta information you need (such as
* timestamps) as well as the sample data that they point to.
@@ -124,16 +124,16 @@
* base class for a visitor of the tree of #AP4_Atom objects. The SDK includes
* an concrete subclass, #AP4_PrintInspector, can be used to print out a text
* representation of the atoms as they are visited. See the Mp4Dump command line
-* application for an example.
-*
+* application for an example.
+*
* @section writing Writing Files
*
* To create a new MP4 file, you first create an #AP4_SyntheticSampleTable
* sample table for each track in your file. You specify the sample description
* for the media samples in each track by calling #AP4_SyntheticSampleTable::AddSampleDescription
* with the description for the samples of that track. Samples can then be added
-* to the sample table with the #AP4_SyntheticSampleTable::AddSample method.
-* Once all the samples of all the tracks have been added to the sample tables,
+* to the sample table with the #AP4_SyntheticSampleTable::AddSample method.
+* Once all the samples of all the tracks have been added to the sample tables,
* you can create an #AP4_Movie, and an #AP4_Track from each sample table, add the track
* to the movie, and finally create an #AP4_File from the movie object.
* Finally, the #AP4_File object can be serialized to a byte stream (such as an
@@ -141,20 +141,20 @@
* See the Aac2Mp4 application for an example.
*
* @section tracks Tracks
-*
+*
* The #AP4_Movie object of an #AP4_File has a list of #AP4_Track objects. Each
-* #AP4_Track represents a media track in the file. From this object, you can
+* #AP4_Track represents a media track in the file. From this object, you can
* obtain the type, duration, etc.. of the tracks. This object also provides
* access to the media samples in the track. Tracks are made up of media samples,
* stored in an 'mdat' atom (media data) and a sample table that provides all the
* information about the individual samples, such as size, timestamps, sample
-* description, etc... Media samples are represented by #AP4_Sample objects.
-* You can obtain a track's samples by calling the #AP4_Track::GetSample method.
+* description, etc... Media samples are represented by #AP4_Sample objects.
+* You can obtain a track's samples by calling the #AP4_Track::GetSample method.
* You can also directly read the payload of a media sample by calling the
* #AP4_Track::ReadSample method if you want to bypass the intermediate step of
* going through an #AP4_Sample object.
* The information about the samples in a track is represented by subclasses of
-* the #AP4_SampleDescription class. The sample descriptions contain information
+* the #AP4_SampleDescription class. The sample descriptions contain information
* about media-specific parameters, such as video resolution, audio sampling rates
* and others.
* See the Mp4Info and Mp42Aac command line applications as examples.
@@ -164,15 +164,15 @@
* @subsection factory Custom Atoms
*
* The SDK has built-in support for most of the standard atom types as defined
-* in the spec. But an application may want to extend the library to support
+* in the spec. But an application may want to extend the library to support
* non-standard atom type, such as custom atoms whose definition is proprietary.
* The base class for all atoms is #AP4_Atom. Instances of subclasses of this class
-* are created by the #AP4_AtomFactory object. The factory knows about all the
-* #AP4_Atom subclasses included in the SDK, and maintains a list of
+* are created by the #AP4_AtomFactory object. The factory knows about all the
+* #AP4_Atom subclasses included in the SDK, and maintains a list of
* #AP4_AtomFactory::TypeHandler type handlers. When the factory encounters an atom
* that is not one of the built-in atom type, it calls all the registered type
-* handlers, in turn, until one of them accept to handle the type and create the
-* corresponding atom. The custom atoms must be implemented as subclasses of
+* handlers, in turn, until one of them accept to handle the type and create the
+* corresponding atom. The custom atoms must be implemented as subclasses of
* #AP4_Atom and override at least the #AP4_Atom::WriteFields method. The custom
* atoms should also override #AP4_Atom::InspectFields if they want to provide
* meaningful information when inspected.
@@ -180,7 +180,7 @@
* @subsection tranformations Transformations
* The SDK provides support for transforming MP4 files. Transformations are useful
* to perform tasks such as editing (removing or adding atoms) and encryption or
-* decryption. When the atom tree for the file changes, the entire file needs to
+* decryption. When the atom tree for the file changes, the entire file needs to
* change, because in most cases, the size of the 'moov' atom will change, and
* thus change the offset of the media samples in the 'mdat' atom.
* To facilitate this operation, the class #AP4_Processor provides the base
@@ -192,18 +192,18 @@
* of #AP4_Processor may create such an #AP4_Processor::TrackHandler subclass instance
* when is #AP4_Processor::CreateTrackHandler is called for one of the tracks in the
* file.
-* See the sample applications Mp4Edit, Mp4Encrpt and Mp4Decrypt as examples.
+* See the sample applications Mp4Edit, Mp4Encrpt and Mp4Decrypt as examples.
*
* @subsection encryption Encryption and Decryption
*
* The SDK has support for encrypting and decrypting tracks as specified by the
-* ISMA Encryption and Authentication specification as well as OMA 2.0 and 2.1 DCF and PDCF.
+* ISMA Encryption and Authentication specification as well as OMA 2.0 and 2.1 DCF and PDCF.
* The supporting classes found in Ap4IsmaCryp.h and AP4_OmaDcf.h provide a subclass
-* of #AP4_Processor for encrypting or decrypting entire files.
+* of #AP4_Processor for encrypting or decrypting entire files.
* The class #AP4_IsmaCipher and #AP4_OmaDcfSampleDecrypter implement the generic
* #AP4_SampleDecrypter interface that provides support for decrypting individual samples.
-* The parameters necessary to instantiate an #AP4_IsmaCipher or an #AP4_OmaDcfSampleDecrypter
-* can be retrieved from an encrypted track by accessing the track's sample descriptions,
+* The parameters necessary to instantiate an #AP4_IsmaCipher or an #AP4_OmaDcfSampleDecrypter
+* can be retrieved from an encrypted track by accessing the track's sample descriptions,
* which are instances of the #AP4_ProtectedSampleDescription class. A more general factory
* method, #AP4_SampleDecrypter::Create can be called, passing an instance of
* #AP4_ProtectedSampleDescription and the cipher key, and the correct concrete class will
@@ -213,7 +213,7 @@
*
* For files that contain hint tracks, the SDK provides support for generating
* RTP packets that can be used to stream the media using the RTP and RTSP protocols.
-* See the application Mp4RtpHintInfo for an example of how to generate the create
+* See the application Mp4RtpHintInfo for an example of how to generate the create
* RTP packets from a file and generate the SDP information for the RTSP protocol.
*/
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.cpp
index a7b671d39..99828d98b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - 8bdl Atoms
+| AP4 - 8bdl Atoms
|
| Copyright 2002-2009 Axiomatic Systems, LLC
|
@@ -25,7 +25,7 @@
| 02111-1307, USA.
|
****************************************************************/
-
+
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
@@ -44,7 +44,7 @@ AP4_8bdlAtom::AP4_8bdlAtom(AP4_UI32 encoding,
AP4_UI32 encoding_version,
const AP4_Byte* data,
AP4_Size data_size) :
- AP4_Atom(AP4_ATOM_TYPE_8BDL, (AP4_UI32)(AP4_ATOM_HEADER_SIZE + 8 + data_size)),
+ AP4_Atom(AP4_ATOM_TYPE_8BDL, (AP4_UI32)(AP4_ATOM_HEADER_SIZE+8+data_size)),
m_Encoding(encoding),
m_EncodingVersion(encoding_version),
m_BundleData(data, data_size)
@@ -58,12 +58,9 @@ AP4_8bdlAtom*
AP4_8bdlAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
// make sure we have enough data
- if(size < AP4_ATOM_HEADER_SIZE + 8)
- {
+ if (size < AP4_ATOM_HEADER_SIZE+8) {
return NULL;
- }
- else
- {
+ } else {
return new AP4_8bdlAtom(size, stream);
}
}
@@ -74,7 +71,7 @@ AP4_8bdlAtom::Create(AP4_Size size, AP4_ByteStream& stream)
AP4_8bdlAtom::AP4_8bdlAtom(AP4_Size size,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_8BDL, (AP4_UI32)(size)),
- m_BundleData(size - AP4_ATOM_HEADER_SIZE - 8)
+ m_BundleData(size-AP4_ATOM_HEADER_SIZE-8)
{
stream.ReadUI32(m_Encoding);
stream.ReadUI32(m_EncodingVersion);
@@ -92,15 +89,15 @@ AP4_8bdlAtom::WriteFields(AP4_ByteStream& stream)
// encoding
result = stream.WriteUI32(m_Encoding);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// encoding version
result = stream.WriteUI32(m_EncodingVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// bundle_data
result = stream.Write(m_BundleData.GetData(), m_BundleData.GetDataSize());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return result;
}
@@ -115,14 +112,11 @@ AP4_8bdlAtom::InspectFields(AP4_AtomInspector& inspector)
AP4_FormatFourChars(enc, m_Encoding);
inspector.AddField("encoding", enc);
inspector.AddField("encoding_version", m_EncodingVersion);
- if(m_Encoding == AP4_8BDL_XML_DATA_ENCODING)
- {
+ if (m_Encoding == AP4_8BDL_XML_DATA_ENCODING) {
// we, in fact have an xml string
AP4_String xml((const char*)m_BundleData.GetData(), m_BundleData.GetDataSize());
inspector.AddField("bundle_data", xml.GetChars());
- }
- else
- {
+ } else {
inspector.AddField("bundle_data", m_BundleData.GetData(), m_BundleData.GetDataSize());
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.h
index 6845c7b22..3c3cadd2e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap48bdlAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - 8bdl Atoms
+| AP4 - 8bdl Atoms
|
| Copyright 2002-2009 Axiomatic Systems, LLC
|
@@ -25,10 +25,10 @@
| 02111-1307, USA.
|
****************************************************************/
-
-#ifndef _AP4_8BDL_ATOM_H_
-#define _AP4_8BDL_ATOM_H_
-
+
+ #ifndef _AP4_8BDL_ATOM_H_
+ #define _AP4_8BDL_ATOM_H_
+
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
@@ -39,7 +39,7 @@
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_8BDL_XML_DATA_ENCODING = AP4_ATOM_TYPE('x', 'm', 'l', ' ');
+const AP4_UI32 AP4_8BDL_XML_DATA_ENCODING = AP4_ATOM_TYPE('x','m','l',' ');
/*----------------------------------------------------------------------
| AP4_8bdlAtom
@@ -51,7 +51,7 @@ public:
// virtual constructor
static AP4_8bdlAtom* Create(AP4_Size size, AP4_ByteStream& stream);
-
+
// constructors
AP4_8bdlAtom(AP4_UI32 encoding,
AP4_UI32 encoding_version,
@@ -63,18 +63,9 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI32 GetEncoding()
- {
- return m_Encoding;
- }
- AP4_UI32 GetEncodingVersion()
- {
- return m_EncodingVersion;
- }
- const AP4_DataBuffer& GetBundleData()
- {
- return m_BundleData;
- }
+ AP4_UI32 GetEncoding() { return m_Encoding; }
+ AP4_UI32 GetEncodingVersion() { return m_EncodingVersion; }
+ const AP4_DataBuffer& GetBundleData() { return m_BundleData; }
private:
// methods
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Array.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Array.h
index ebbd42748..b62bac22c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Array.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Array.h
@@ -26,7 +26,7 @@
|
****************************************************************/
/**
- * @file
+ * @file
* @brief Arrays
*/
@@ -51,28 +51,19 @@ const int AP4_ARRAY_INITIAL_COUNT = 64;
/*----------------------------------------------------------------------
| AP4_Array
+---------------------------------------------------------------------*/
-template <typename T>
-class AP4_Array
+template <typename T>
+class AP4_Array
{
public:
// methods
- AP4_Array(): m_AllocatedCount(0), m_ItemCount(0), m_Items(0) {}
- AP4_Array(const T* items, AP4_Size count);
+ AP4_Array(): m_AllocatedCount(0), m_ItemCount(0), m_Items(0) {}
+ AP4_Array(const T* items, AP4_Size count);
virtual ~AP4_Array();
- AP4_Cardinal ItemCount() const
- {
- return m_ItemCount;
- }
+ AP4_Cardinal ItemCount() const { return m_ItemCount; }
AP4_Result Append(const T& item);
AP4_Result RemoveLast();
- T& operator[](unsigned long idx)
- {
- return m_Items[idx];
- }
- const T& operator[](unsigned long idx) const
- {
- return m_Items[idx];
- }
+ T& operator[](unsigned long idx) { return m_Items[idx]; }
+ const T& operator[](unsigned long idx) const { return m_Items[idx]; }
AP4_Result Clear();
AP4_Result EnsureCapacity(AP4_Cardinal count);
AP4_Result SetItemCount(AP4_Cardinal item_count);
@@ -93,9 +84,8 @@ AP4_Array<T>::AP4_Array(const T* items, AP4_Size count) :
m_ItemCount(count),
m_Items((T*)::operator new(count*sizeof(T)))
{
- for(unsigned int i = 0; i < count; i++)
- {
- new((void*)&m_Items[i]) T(items[i]);
+ for (unsigned int i=0; i<count; i++) {
+ new ((void*)&m_Items[i]) T(items[i]);
}
}
@@ -117,8 +107,7 @@ AP4_Result
AP4_Array<T>::Clear()
{
// destroy all items
- for(AP4_Ordinal i = 0; i < m_ItemCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_ItemCount; i++) {
m_Items[i].~T();
}
@@ -135,19 +124,16 @@ AP4_Result
AP4_Array<T>::EnsureCapacity(AP4_Cardinal count)
{
// check if we already have enough
- if(count <= m_AllocatedCount) return AP4_SUCCESS;
+ if (count <= m_AllocatedCount) return AP4_SUCCESS;
// (re)allocate the items
- T* new_items = (T*) ::operator new(count * sizeof(T));
- if(new_items == NULL)
- {
+ T* new_items = (T*) ::operator new (count*sizeof(T));
+ if (new_items == NULL) {
return AP4_ERROR_OUT_OF_MEMORY;
}
- if(m_ItemCount && m_Items)
- {
- for(unsigned int i = 0; i < m_ItemCount; i++)
- {
- new((void*)&new_items[i]) T(m_Items[i]);
+ if (m_ItemCount && m_Items) {
+ for (unsigned int i=0; i<m_ItemCount; i++) {
+ new ((void*)&new_items[i]) T(m_Items[i]);
m_Items[i].~T();
}
::operator delete((void*)m_Items);
@@ -162,32 +148,29 @@ AP4_Array<T>::EnsureCapacity(AP4_Cardinal count)
| AP4_Array<T>::SetItemCount
+---------------------------------------------------------------------*/
template <typename T>
-AP4_Result
+AP4_Result
AP4_Array<T>::SetItemCount(AP4_Cardinal item_count)
{
// shortcut
- if(item_count == m_ItemCount) return AP4_SUCCESS;
-
+ if (item_count == m_ItemCount) return AP4_SUCCESS;
+
// check for a reduction in the number of items
- if(item_count < m_ItemCount)
- {
+ if (item_count < m_ItemCount) {
// destruct the items that are no longer needed
- for(unsigned int i = item_count; i < m_ItemCount; i++)
- {
+ for (unsigned int i=item_count; i<m_ItemCount; i++) {
m_Items[i].~T();
}
m_ItemCount = item_count;
return AP4_SUCCESS;
}
-
+
// grow the list
AP4_Result result = EnsureCapacity(item_count);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// construct the new items
- for(unsigned int i = m_ItemCount; i < item_count; i++)
- {
- new((void*)&m_Items[i]) T();
+ for (unsigned int i=m_ItemCount; i<item_count; i++) {
+ new ((void*)&m_Items[i]) T();
}
m_ItemCount = item_count;
return AP4_SUCCESS;
@@ -200,13 +183,10 @@ template <typename T>
AP4_Result
AP4_Array<T>::RemoveLast()
{
- if(m_ItemCount)
- {
+ if (m_ItemCount) {
m_Items[--m_ItemCount].~T();
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_OUT_OF_RANGE;
}
}
@@ -219,21 +199,20 @@ AP4_Result
AP4_Array<T>::Append(const T& item)
{
// ensure that we have enough space
- if(m_AllocatedCount < m_ItemCount + 1)
- {
+ if (m_AllocatedCount < m_ItemCount+1) {
// try double the size, with a minimum
- unsigned long new_count = m_AllocatedCount ? 2 * m_AllocatedCount : AP4_ARRAY_INITIAL_COUNT;
+ unsigned long new_count = m_AllocatedCount?2*m_AllocatedCount:AP4_ARRAY_INITIAL_COUNT;
// if that's still not enough, just ask for what we need
- if(new_count < m_ItemCount + 1) new_count = m_ItemCount + 1;
-
+ if (new_count < m_ItemCount+1) new_count = m_ItemCount+1;
+
// reserve the space
AP4_Result result = EnsureCapacity(new_count);
- if(result != AP4_SUCCESS) return result;
+ if (result != AP4_SUCCESS) return result;
}
-
+
// store the item
- new((void*)&m_Items[m_ItemCount++]) T(item);
+ new ((void*)&m_Items[m_ItemCount++]) T(item);
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.cpp
index a8876c1a8..a9bd81e6b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Atoms
+| AP4 - Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -57,16 +57,16 @@ AP4_Atom::Type
AP4_Atom::TypeFromString(const char* s)
{
// convert the name into an atom type
- return ((AP4_UI32)s[0]) << 24 |
- ((AP4_UI32)s[1]) << 16 |
- ((AP4_UI32)s[2]) << 8 |
+ return ((AP4_UI32)s[0])<<24 |
+ ((AP4_UI32)s[1])<<16 |
+ ((AP4_UI32)s[2])<< 8 |
((AP4_UI32)s[3]);
}
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
-AP4_Atom::AP4_Atom(Type type, AP4_UI32 size /* = AP4_ATOM_HEADER_SIZE */) :
+AP4_Atom::AP4_Atom(Type type, AP4_UI32 size /* = AP4_ATOM_HEADER_SIZE */) :
m_Type(type),
m_Size32(size),
m_Size64(0),
@@ -80,7 +80,7 @@ AP4_Atom::AP4_Atom(Type type, AP4_UI32 size /* = AP4_ATOM_HEADER_SIZE */) :
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
-AP4_Atom::AP4_Atom(Type type, AP4_UI64 size, bool force_64) :
+AP4_Atom::AP4_Atom(Type type, AP4_UI64 size, bool force_64) :
m_Type(type),
m_Size32(0),
m_Size64(0),
@@ -95,9 +95,9 @@ AP4_Atom::AP4_Atom(Type type, AP4_UI64 size, bool force_64) :
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
-AP4_Atom::AP4_Atom(Type type,
- AP4_UI32 size,
- AP4_UI32 version,
+AP4_Atom::AP4_Atom(Type type,
+ AP4_UI32 size,
+ AP4_UI32 version,
AP4_UI32 flags) :
m_Type(type),
m_Size32(size),
@@ -112,10 +112,10 @@ AP4_Atom::AP4_Atom(Type type,
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
-AP4_Atom::AP4_Atom(Type type,
+AP4_Atom::AP4_Atom(Type type,
AP4_UI64 size,
bool force_64,
- AP4_UI32 version,
+ AP4_UI32 version,
AP4_UI32 flags) :
m_Type(type),
m_Size32(0),
@@ -132,14 +132,14 @@ AP4_Atom::AP4_Atom(Type type,
| AP4_Atom::ReadFullHeader
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Atom::ReadFullHeader(AP4_ByteStream& stream,
- AP4_UI32& version,
+AP4_Atom::ReadFullHeader(AP4_ByteStream& stream,
+ AP4_UI32& version,
AP4_UI32& flags)
{
AP4_UI32 header;
AP4_CHECK(stream.ReadUI32(header));
- version = (header >> 24) & 0x000000FF;
- flags = (header) & 0x00FFFFFF;
+ version = (header>>24)&0x000000FF;
+ flags = (header )&0x00FFFFFF;
return AP4_SUCCESS;
}
@@ -150,22 +150,17 @@ AP4_Atom::ReadFullHeader(AP4_ByteStream& stream,
void
AP4_Atom::SetSize(AP4_UI64 size, bool force_64)
{
- if(!force_64)
- {
+ if (!force_64) {
// see if we need to implicitely force 64-bit encoding
- if(m_Size32 == 1 && m_Size64 <= 0xFFFFFFFF)
- {
+ if (m_Size32 == 1 && m_Size64 <= 0xFFFFFFFF) {
// we have a forced 64-bit encoding
force_64 = true;
}
}
- if((size >> 32) == 0 && !force_64)
- {
+ if ((size >> 32) == 0 && !force_64) {
m_Size32 = (AP4_UI32)size;
m_Size64 = 0;
- }
- else
- {
+ } else {
m_Size32 = 1;
m_Size64 = size;
}
@@ -177,7 +172,7 @@ AP4_Atom::SetSize(AP4_UI64 size, bool force_64)
AP4_Size
AP4_Atom::GetHeaderSize() const
{
- return (m_IsFull ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE) + (m_Size32 == 1 ? 8 : 0);
+ return (m_IsFull ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE)+(m_Size32==1?8:0);
}
/*----------------------------------------------------------------------
@@ -190,26 +185,24 @@ AP4_Atom::WriteHeader(AP4_ByteStream& stream)
// write the size
result = stream.WriteUI32(m_Size32);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the type
result = stream.WriteUI32(m_Type);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// handle 64-bit sizes
- if(m_Size32 == 1)
- {
+ if (m_Size32 == 1) {
result = stream.WriteUI64(m_Size64);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// for full atoms, write version and flags
- if(m_IsFull)
- {
+ if (m_IsFull) {
result = stream.WriteUI08(m_Version);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI24(m_Flags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
@@ -230,23 +223,21 @@ AP4_Atom::Write(AP4_ByteStream& stream)
// write the header
result = WriteHeader(stream);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the fields
result = WriteFields(stream);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
#if defined(AP4_DEBUG)
AP4_Position after;
stream.Tell(after);
AP4_UI64 atom_size = GetSize();
- if(after - before != atom_size)
- {
+ if (after-before != atom_size) {
AP4_Debug("ERROR: atom size mismatch (declared size=%d, actual size=%d)\n",
- (AP4_UI32)atom_size, (AP4_UI32)(after - before));
+ (AP4_UI32)atom_size, (AP4_UI32)(after-before));
AP4_Atom* atom = this;
- while(atom)
- {
+ while (atom) {
char name[7];
name[0] = '[';
AP4_FormatFourCharsPrintable(&name[1], atom->GetType());
@@ -255,7 +246,7 @@ AP4_Atom::Write(AP4_ByteStream& stream)
AP4_Debug(" while writing %s\n", name);
atom = AP4_DYNAMIC_CAST(AP4_Atom, atom->GetParent());
}
- AP4_ASSERT(after - before == atom_size);
+ AP4_ASSERT(after-before == atom_size);
}
#endif
@@ -289,32 +280,26 @@ AP4_Atom::InspectHeader(AP4_AtomInspector& inspector)
name[6] = '\0';
char header[128];
char extra[32] = "";
- if(m_IsFull)
- {
- if(m_Version && m_Flags)
- {
- AP4_FormatString(extra, sizeof(extra),
+ if (m_IsFull) {
+ if (m_Version && m_Flags) {
+ AP4_FormatString(extra, sizeof(extra),
", version=%d, flags=%x",
m_Version,
m_Flags);
- }
- else if(m_Version)
- {
- AP4_FormatString(extra, sizeof(extra),
+ } else if (m_Version) {
+ AP4_FormatString(extra, sizeof(extra),
", version=%d",
m_Version);
- }
- else if(m_Flags)
- {
- AP4_FormatString(extra, sizeof(extra),
+ } else if (m_Flags) {
+ AP4_FormatString(extra, sizeof(extra),
", flags=%x",
m_Flags);
}
}
- AP4_FormatString(header, sizeof(header),
- "size=%ld+%lld%s",
- GetHeaderSize(),
- GetSize() - GetHeaderSize(),
+ AP4_FormatString(header, sizeof(header),
+ "size=%ld+%lld%s",
+ GetHeaderSize(),
+ GetSize()-GetHeaderSize(),
extra);
inspector.StartElement(name, header);
@@ -325,14 +310,11 @@ AP4_Atom::InspectHeader(AP4_AtomInspector& inspector)
| AP4_Atom::Detach
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Atom::Detach()
+AP4_Atom::Detach()
{
- if(m_Parent)
- {
+ if (m_Parent) {
return m_Parent->RemoveChild(this);
- }
- else
- {
+ } else {
return AP4_SUCCESS;
}
}
@@ -344,21 +326,21 @@ AP4_Atom*
AP4_Atom::Clone()
{
AP4_Atom* clone = NULL;
-
+
// check the size (refuse to clone atoms that are too large)
AP4_LargeSize size = GetSize();
- if(size > AP4_ATOM_MAX_CLONE_SIZE) return NULL;
+ if (size > AP4_ATOM_MAX_CLONE_SIZE) return NULL;
// create a memory byte stream to which we can serialize
AP4_MemoryByteStream* mbs = new AP4_MemoryByteStream((AP4_Size)GetSize());
-
+
// serialize to memory
- if(AP4_FAILED(Write(*mbs))) goto end;
-
+ if (AP4_FAILED(Write(*mbs))) goto end;
+
// create the clone for the serialized form
mbs->Seek(0);
AP4_DefaultAtomFactory::Instance.CreateAtomFromStream(*mbs, clone);
-
+
end:
// release the memory stream
mbs->Release();
@@ -369,41 +351,35 @@ end:
/*----------------------------------------------------------------------
| AP4_UnknownAtom::AP4_UnknownAtom
+---------------------------------------------------------------------*/
-AP4_UnknownAtom::AP4_UnknownAtom(Type type,
+AP4_UnknownAtom::AP4_UnknownAtom(Type type,
AP4_UI64 size,
- AP4_ByteStream& stream) :
+ AP4_ByteStream& stream) :
AP4_Atom(type, size),
m_SourceStream(&stream)
{
- if(size <= AP4_UNKNOWN_ATOM_MAX_LOCAL_PAYLOAD_SIZE &&
- type != AP4_ATOM_TYPE_MDAT)
- {
+ if (size <= AP4_UNKNOWN_ATOM_MAX_LOCAL_PAYLOAD_SIZE &&
+ type != AP4_ATOM_TYPE_MDAT) {
m_SourcePosition = 0;
m_SourceStream = NULL;
- AP4_UI32 payload_size = (AP4_UI32)size - GetHeaderSize();
+ AP4_UI32 payload_size = (AP4_UI32)size-GetHeaderSize();
m_Payload.SetDataSize(payload_size);
stream.Read(m_Payload.UseData(), payload_size);
return;
}
-
+
// store source stream position
stream.Tell(m_SourcePosition);
// clamp to the file size
AP4_UI64 file_size;
- if(AP4_SUCCEEDED(stream.GetSize(file_size)))
- {
- if(m_SourcePosition - GetHeaderSize() + size > file_size)
- {
- if(m_Size32 == 1)
- {
+ if (AP4_SUCCEEDED(stream.GetSize(file_size))) {
+ if (m_SourcePosition-GetHeaderSize()+size > file_size) {
+ if (m_Size32 == 1) {
// size is encoded as a large size
- m_Size64 = file_size - m_SourcePosition;
- }
- else
- {
+ m_Size64 = file_size-m_SourcePosition;
+ } else {
AP4_ASSERT(size <= 0xFFFFFFFF);
- m_Size32 = (AP4_UI32)(file_size - m_SourcePosition);
+ m_Size32 = (AP4_UI32)(file_size-m_SourcePosition);
}
}
}
@@ -415,10 +391,10 @@ AP4_UnknownAtom::AP4_UnknownAtom(Type type,
/*----------------------------------------------------------------------
| AP4_UnknownAtom::AP4_UnknownAtom
+---------------------------------------------------------------------*/
-AP4_UnknownAtom::AP4_UnknownAtom(Type type,
+AP4_UnknownAtom::AP4_UnknownAtom(Type type,
const AP4_UI08* payload,
AP4_Size payload_size) :
- AP4_Atom(type, AP4_ATOM_HEADER_SIZE + payload_size, false),
+ AP4_Atom(type, AP4_ATOM_HEADER_SIZE+payload_size, false),
m_SourceStream(NULL),
m_SourcePosition(0)
{
@@ -436,8 +412,7 @@ AP4_UnknownAtom::AP4_UnknownAtom(const AP4_UnknownAtom& other) :
{
m_Size32 = other.m_Size32;
m_Size64 = other.m_Size64;
- if(m_SourceStream)
- {
+ if (m_SourceStream) {
m_SourceStream->AddReference();
}
}
@@ -448,8 +423,7 @@ AP4_UnknownAtom::AP4_UnknownAtom(const AP4_UnknownAtom& other) :
AP4_UnknownAtom::~AP4_UnknownAtom()
{
// release the source stream reference
- if(m_SourceStream)
- {
+ if (m_SourceStream) {
m_SourceStream->Release();
}
}
@@ -463,23 +437,22 @@ AP4_UnknownAtom::WriteFields(AP4_ByteStream& stream)
AP4_Result result;
// if we don't have a source, write from the buffered payload
- if(m_SourceStream == NULL)
- {
+ if (m_SourceStream == NULL) {
return stream.Write(m_Payload.GetData(), m_Payload.GetDataSize());
}
-
+
// remember the source position
AP4_Position position;
m_SourceStream->Tell(position);
// seek into the source at the stored offset
result = m_SourceStream->Seek(m_SourcePosition);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// copy the source stream to the output
- AP4_UI64 payload_size = GetSize() - GetHeaderSize();
+ AP4_UI64 payload_size = GetSize()-GetHeaderSize();
result = m_SourceStream->CopyTo(stream, payload_size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// restore the original stream position
m_SourceStream->Seek(position);
@@ -490,7 +463,7 @@ AP4_UnknownAtom::WriteFields(AP4_ByteStream& stream)
/*----------------------------------------------------------------------
| AP4_UnknownAtom::Clone
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_UnknownAtom::Clone()
{
return new AP4_UnknownAtom(*this);
@@ -503,18 +476,18 @@ AP4_NullTerminatedStringAtom::AP4_NullTerminatedStringAtom(AP4_Atom::Type type,
AP4_Atom(type, AP4_ATOM_HEADER_SIZE),
m_Value(value)
{
- m_Size32 += m_Value.GetLength() + 1;
+ m_Size32 += m_Value.GetLength()+1;
}
/*----------------------------------------------------------------------
| AP4_NullTerminatedStringAtom::AP4_NullTerminatedStringAtom
+---------------------------------------------------------------------*/
-AP4_NullTerminatedStringAtom::AP4_NullTerminatedStringAtom(AP4_Atom::Type type,
- AP4_UI64 size,
- AP4_ByteStream& stream) :
+AP4_NullTerminatedStringAtom::AP4_NullTerminatedStringAtom(AP4_Atom::Type type,
+ AP4_UI64 size,
+ AP4_ByteStream& stream) :
AP4_Atom(type, size)
{
- AP4_Size str_size = (AP4_Size)size - AP4_ATOM_HEADER_SIZE;
+ AP4_Size str_size = (AP4_Size)size-AP4_ATOM_HEADER_SIZE;
char* str = new char[str_size];
stream.Read(str, str_size);
str[str_size-1] = '\0'; // force null-termination
@@ -527,14 +500,13 @@ AP4_NullTerminatedStringAtom::AP4_NullTerminatedStringAtom(AP4_Atom::Type type,
AP4_Result
AP4_NullTerminatedStringAtom::WriteFields(AP4_ByteStream& stream)
{
- if(m_Size32 > AP4_ATOM_HEADER_SIZE)
- {
- AP4_Result result = stream.Write(m_Value.GetChars(), m_Value.GetLength() + 1);
- if(AP4_FAILED(result)) return result;
+ if (m_Size32 > AP4_ATOM_HEADER_SIZE) {
+ AP4_Result result = stream.Write(m_Value.GetChars(), m_Value.GetLength()+1);
+ if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
- AP4_Size padding = m_Size32 - (AP4_ATOM_HEADER_SIZE + m_Value.GetLength() + 1);
- while(padding--) stream.WriteUI08(0);
+ AP4_Size padding = m_Size32-(AP4_ATOM_HEADER_SIZE+m_Value.GetLength()+1);
+ while (padding--) stream.WriteUI08(0);
}
return AP4_SUCCESS;
@@ -566,39 +538,30 @@ AP4_Result
AP4_AtomParent::AddChild(AP4_Atom* child, int position)
{
// check that the child does not already have a parent
- if(child->GetParent() != NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ if (child->GetParent() != NULL) return AP4_ERROR_INVALID_PARAMETERS;
// attach the child
AP4_Result result;
- if(position == -1)
- {
+ if (position == -1) {
// insert at the tail
result = m_Children.Add(child);
- }
- else if(position == 0)
- {
+ } else if (position == 0) {
// insert at the head
result = m_Children.Insert(NULL, child);
- }
- else
- {
+ } else {
// insert after <n-1>
AP4_List<AP4_Atom>::Item* insertion_point = m_Children.FirstItem();
unsigned int count = position;
- while(insertion_point && --count)
- {
+ while (insertion_point && --count) {
insertion_point = insertion_point->GetNext();
}
- if(insertion_point)
- {
+ if (insertion_point) {
result = m_Children.Insert(insertion_point, child);
- }
- else
- {
+ } else {
result = AP4_ERROR_OUT_OF_RANGE;
}
}
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// notify the child of its parent
child->SetParent(this);
@@ -616,11 +579,11 @@ AP4_Result
AP4_AtomParent::RemoveChild(AP4_Atom* child)
{
// check that this is our child
- if(child->GetParent() != this) return AP4_ERROR_INVALID_PARAMETERS;
+ if (child->GetParent() != this) return AP4_ERROR_INVALID_PARAMETERS;
// remove the child
AP4_Result result = m_Children.Remove(child);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// notify that child that it is orphaned
child->SetParent(NULL);
@@ -639,11 +602,11 @@ AP4_AtomParent::DeleteChild(AP4_Atom::Type type, AP4_Ordinal index /* = 0 */)
{
// find the child
AP4_Atom* child = GetChild(type, index);
- if(child == NULL) return AP4_FAILURE;
+ if (child == NULL) return AP4_FAILURE;
// remove the child
AP4_Result result = RemoveChild(child);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// delete the child
delete child;
@@ -659,12 +622,9 @@ AP4_AtomParent::GetChild(AP4_Atom::Type type, AP4_Ordinal index /* = 0 */) const
{
AP4_Atom* atom;
AP4_Result result = m_Children.Find(AP4_AtomFinder(type, index), atom);
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
return atom;
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -675,17 +635,14 @@ AP4_AtomParent::GetChild(AP4_Atom::Type type, AP4_Ordinal index /* = 0 */) const
AP4_Atom*
AP4_AtomParent::GetChild(const AP4_UI08* uuid, AP4_Ordinal index /* = 0 */) const
{
- for(AP4_List<AP4_Atom>::Item* item = m_Children.FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = m_Children.FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_UUID)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_UUID) {
AP4_UuidAtom* uuid_atom = AP4_DYNAMIC_CAST(AP4_UuidAtom, atom);
- if(AP4_CompareMemory(uuid_atom->GetUuid(), uuid, 16) == 0)
- {
- if(index == 0) return atom;
+ if (AP4_CompareMemory(uuid_atom->GetUuid(), uuid, 16) == 0) {
+ if (index == 0) return atom;
--index;
}
}
@@ -697,7 +654,7 @@ AP4_AtomParent::GetChild(const AP4_UI08* uuid, AP4_Ordinal index /* = 0 */) cons
| AP4_AtomParent::FindChild
+---------------------------------------------------------------------*/
AP4_Atom*
-AP4_AtomParent::FindChild(const char* path,
+AP4_AtomParent::FindChild(const char* path,
bool auto_create,
bool auto_create_full)
{
@@ -705,83 +662,58 @@ AP4_AtomParent::FindChild(const char* path,
AP4_AtomParent* parent = this;
// walk the path
- while(path[0] && path[1] && path[2] && path[3])
- {
+ while (path[0] && path[1] && path[2] && path[3]) {
// we have 4 valid chars
const char* tail;
int index = 0;
- if(path[4] == '\0')
- {
+ if (path[4] == '\0') {
tail = NULL;
- }
- else if(path[4] == '/')
- {
+ } else if (path[4] == '/') {
// separator
tail = &path[5];
- }
- else if(path[4] == '[')
- {
+ } else if (path[4] == '[') {
const char* x = &path[5];
- while(*x >= '0' && *x <= '9')
- {
- index = 10 * index + (*x++ - '0');
+ while (*x >= '0' && *x <= '9') {
+ index = 10*index+(*x++ - '0');
}
- if(x[0] == ']')
- {
- if(x[1] == '\0')
- {
+ if (x[0] == ']') {
+ if (x[1] == '\0') {
tail = NULL;
+ } else {
+ tail = x+2;
}
- else
- {
- tail = x + 2;
- }
- }
- else
- {
+ } else {
// malformed path
return NULL;
}
- }
- else
- {
+ } else {
// malformed path
return NULL;
}
// look for this atom in the current list
- AP4_Atom::Type type = AP4_ATOM_TYPE(path[0], path[1], path[2], path[3]);
+ AP4_Atom::Type type = AP4_ATOM_TYPE(path[0], path[1], path[2], path[3]);
AP4_Atom* atom = parent->GetChild(type, index);
- if(atom == NULL)
- {
+ if (atom == NULL) {
// not found
- if(auto_create && (index == 0))
- {
- if(auto_create_full)
- {
+ if (auto_create && (index == 0)) {
+ if (auto_create_full) {
atom = new AP4_ContainerAtom(type, (AP4_UI32)0, (AP4_UI32)0);
- }
- else
- {
+ } else {
atom = new AP4_ContainerAtom(type);
}
parent->AddChild(atom);
- }
- else
- {
+ } else {
return NULL;
}
}
- if(tail)
- {
+ if (tail) {
path = tail;
// if this atom is an atom parent, recurse
parent = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(parent == NULL) return NULL;
- }
- else
- {
+ if (parent == NULL) return NULL;
+ } else {
return atom;
}
}
@@ -793,7 +725,7 @@ AP4_AtomParent::FindChild(const char* path,
/*----------------------------------------------------------------------
| AP4_AtomListWriter::Action
+---------------------------------------------------------------------*/
-const unsigned int AP4_ATOM_LIST_WRITER_MAX_PADDING = 1024;
+const unsigned int AP4_ATOM_LIST_WRITER_MAX_PADDING=1024;
AP4_Result
AP4_AtomListWriter::Action(AP4_Atom* atom) const
@@ -806,21 +738,16 @@ AP4_AtomListWriter::Action(AP4_Atom* atom) const
AP4_Position after;
m_Stream.Tell(after);
- AP4_UI64 bytes_written = after - before;
+ AP4_UI64 bytes_written = after-before;
AP4_ASSERT(bytes_written <= atom->GetSize());
- if(bytes_written < atom->GetSize())
- {
+ if (bytes_written < atom->GetSize()) {
AP4_Debug("WARNING: atom serialized to fewer bytes than declared size\n");
- AP4_UI64 padding = atom->GetSize() - bytes_written;
- if(padding > AP4_ATOM_LIST_WRITER_MAX_PADDING)
- {
+ AP4_UI64 padding = atom->GetSize()-bytes_written;
+ if (padding > AP4_ATOM_LIST_WRITER_MAX_PADDING) {
AP4_Debug("WARNING: padding would be too large\n");
return AP4_FAILURE;
- }
- else
- {
- for(unsigned int i = 0; i < padding; i++)
- {
+ } else {
+ for (unsigned int i=0; i<padding; i++) {
m_Stream.WriteUI08(0);
}
}
@@ -835,19 +762,18 @@ AP4_AtomListWriter::Action(AP4_Atom* atom) const
static void
AP4_MakePrefixString(unsigned int indent, char* prefix, AP4_Size size)
{
- if(size == 0) return;
- if(indent >= size - 1) indent = size - 1;
- for(unsigned int i = 0; i < indent; i++)
- {
+ if (size == 0) return;
+ if (indent >= size-1) indent = size-1;
+ for (unsigned int i=0; i<indent; i++) {
prefix[i] = ' ';
}
- prefix[indent] = '\0';
+ prefix[indent] = '\0';
}
/*----------------------------------------------------------------------
| AP4_PrintInspector::AP4_PrintInspector
+---------------------------------------------------------------------*/
-AP4_PrintInspector::AP4_PrintInspector(AP4_ByteStream& stream, AP4_Cardinal indent) :
+ AP4_PrintInspector::AP4_PrintInspector(AP4_ByteStream& stream, AP4_Cardinal indent) :
m_Stream(&stream),
m_Indent(indent)
{
@@ -872,8 +798,7 @@ AP4_PrintInspector::StartElement(const char* name, const char* info)
AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
m_Stream->WriteString(prefix);
m_Stream->WriteString(name);
- if(info)
- {
+ if (info) {
m_Stream->Write(" ", 1);
m_Stream->WriteString(info);
}
@@ -900,7 +825,7 @@ AP4_PrintInspector::AddField(const char* name, const char* value, FormatHint)
char prefix[256];
AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
m_Stream->WriteString(prefix);
-
+
m_Stream->WriteString(name);
m_Stream->WriteString(" = ");
m_Stream->WriteString(value);
@@ -918,8 +843,8 @@ AP4_PrintInspector::AddField(const char* name, AP4_UI64 value, FormatHint hint)
m_Stream->WriteString(prefix);
char str[32];
- AP4_FormatString(str, sizeof(str),
- hint == HINT_HEX ? "%llx" : "%lld",
+ AP4_FormatString(str, sizeof(str),
+ hint == HINT_HEX ? "%llx":"%lld",
value);
m_Stream->WriteString(name);
m_Stream->WriteString(" = ");
@@ -938,8 +863,8 @@ AP4_PrintInspector::AddFieldF(const char* name, float value, FormatHint /*hint*/
m_Stream->WriteString(prefix);
char str[32];
- AP4_FormatString(str, sizeof(str),
- "%f",
+ AP4_FormatString(str, sizeof(str),
+ "%f",
value);
m_Stream->WriteString(name);
m_Stream->WriteString(" = ");
@@ -951,8 +876,8 @@ AP4_PrintInspector::AddFieldF(const char* name, float value, FormatHint /*hint*/
| AP4_PrintInspector::AddField
+---------------------------------------------------------------------*/
void
-AP4_PrintInspector::AddField(const char* name,
- const unsigned char* bytes,
+AP4_PrintInspector::AddField(const char* name,
+ const unsigned char* bytes,
AP4_Size byte_count,
FormatHint /* hint */)
{
@@ -964,10 +889,9 @@ AP4_PrintInspector::AddField(const char* name,
m_Stream->WriteString(" = [");
unsigned int offset = 1;
char byte[4];
- for(unsigned int i = 0; i < byte_count; i++)
- {
+ for (unsigned int i=0; i<byte_count; i++) {
AP4_FormatString(byte, 4, " %02x", bytes[i]);
- m_Stream->Write(&byte[offset], 3 - offset);
+ m_Stream->Write(&byte[offset], 3-offset);
offset = 0;
}
m_Stream->Write("]\n", 2);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.h
index 9685547ac..7301821a3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Atom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Atoms
+| AP4 - Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -26,7 +26,7 @@
|
****************************************************************/
/**
-* @file
+* @file
* @brief Atoms
*/
@@ -72,14 +72,12 @@ class AP4_AtomParent;
+---------------------------------------------------------------------*/
/**
* Class used in a visitor pattern to walk all the atoms in a tree of
- * #AP4_Atom objects.
+ * #AP4_Atom objects.
*/
-class AP4_AtomInspector
-{
+class AP4_AtomInspector {
public:
// types
- typedef enum
- {
+ typedef enum {
HINT_NONE = 0,
HINT_HEX = 1,
HINT_BOOLEAN = 2
@@ -90,45 +88,35 @@ public:
virtual ~AP4_AtomInspector() {}
// methods
- void SetVerbosity(AP4_Ordinal verbosity)
- {
- m_Verbosity = verbosity;
- }
- AP4_Ordinal GetVerbosity()
- {
- return m_Verbosity;
- }
-
+ void SetVerbosity(AP4_Ordinal verbosity) { m_Verbosity = verbosity; }
+ AP4_Ordinal GetVerbosity() { return m_Verbosity; }
+
// virtual methods
- virtual void StartElement(const char* /* name */,
+ virtual void StartElement(const char* /* name */,
const char* /* extra = NULL */) {}
virtual void EndElement() {}
- virtual void AddField(const char* /* name */,
- AP4_UI64 /* value */,
- FormatHint hint = HINT_NONE)
- {
+ virtual void AddField(const char* /* name */,
+ AP4_UI64 /* value */,
+ FormatHint hint = HINT_NONE) {
(void)hint; // gcc warning
}
- virtual void AddFieldF(const char* /* name */,
- float /* value */,
- FormatHint hint = HINT_NONE)
- {
+ virtual void AddFieldF(const char* /* name */,
+ float /* value */,
+ FormatHint hint = HINT_NONE) {
(void)hint; // gcc warning
}
- virtual void AddField(const char* /* name */,
- const char* /* value */,
- FormatHint hint = HINT_NONE)
- {
- (void)hint; // gcc warning
+ virtual void AddField(const char* /* name */,
+ const char* /* value */,
+ FormatHint hint = HINT_NONE) {
+ (void)hint; // gcc warning
}
- virtual void AddField(const char* /* name */,
- const unsigned char* /* bytes */,
- AP4_Size /* byte_count */,
- FormatHint hint = HINT_NONE)
- {
- (void)hint; // gcc warning
+ virtual void AddField(const char* /* name */,
+ const unsigned char* /* bytes */,
+ AP4_Size /* byte_count */,
+ FormatHint hint = HINT_NONE) {
+ (void)hint; // gcc warning
}
-
+
protected:
AP4_Ordinal m_Verbosity;
};
@@ -136,10 +124,9 @@ protected:
/*----------------------------------------------------------------------
| AP4_PrintInspector
+---------------------------------------------------------------------*/
-class AP4_PrintInspector : public AP4_AtomInspector
-{
+class AP4_PrintInspector : public AP4_AtomInspector {
public:
- AP4_PrintInspector(AP4_ByteStream& stream, AP4_Cardinal indent = 0);
+ AP4_PrintInspector(AP4_ByteStream& stream, AP4_Cardinal indent=0);
~AP4_PrintInspector();
// methods
@@ -162,18 +149,17 @@ private:
/**
* Abstract base class for all atom types.
*/
-class AP4_Atom
-{
+class AP4_Atom {
public:
- AP4_IMPLEMENT_DYNAMIC_CAST(AP4_Atom)
+ AP4_IMPLEMENT_DYNAMIC_CAST(AP4_Atom)
- // types
+ // types
typedef AP4_UI32 Type;
// class methods
static Type TypeFromString(const char* four_cc);
- static AP4_Result ReadFullHeader(AP4_ByteStream& stream,
- AP4_UI32& version,
+ static AP4_Result ReadFullHeader(AP4_ByteStream& stream,
+ AP4_UI32& version,
AP4_UI32& flags);
// constructors
@@ -185,87 +171,55 @@ public:
/**
* Create a simple atom with a specified type and 64-bit size.
*/
- explicit AP4_Atom(Type type, AP4_UI64 size, bool force_64 = false);
+ explicit AP4_Atom(Type type, AP4_UI64 size, bool force_64=false);
/**
* Create a full atom with a specified type, 32-bit size, version and flags.
*/
- explicit AP4_Atom(Type type,
+ explicit AP4_Atom(Type type,
AP4_UI32 size,
- AP4_UI32 version,
+ AP4_UI32 version,
AP4_UI32 flags);
/**
* Create a full atom with a specified type, 64-bit size, version and flags.
*/
- explicit AP4_Atom(Type type,
+ explicit AP4_Atom(Type type,
AP4_UI64 size,
bool force_64,
- AP4_UI32 version,
+ AP4_UI32 version,
AP4_UI32 flags);
// destructor
virtual ~AP4_Atom() {}
-
+
// methods
- AP4_UI32 GetFlags() const
- {
- return m_Flags;
- }
- void SetFlags(AP4_UI32 flags)
- {
- m_Flags = flags;
- }
- Type GetType() const
- {
- return m_Type;
- }
- void SetType(Type type)
- {
- m_Type = type;
- }
+ AP4_UI32 GetFlags() const { return m_Flags; }
+ void SetFlags(AP4_UI32 flags) { m_Flags = flags; }
+ Type GetType() const { return m_Type; }
+ void SetType(Type type) { m_Type = type; }
virtual AP4_Size GetHeaderSize() const;
- AP4_UI64 GetSize() const
- {
- return m_Size32 == 1 ? m_Size64 : m_Size32;
- }
+ AP4_UI64 GetSize() const { return m_Size32 == 1?m_Size64:m_Size32; }
void SetSize(AP4_UI64 size, bool force_64 = false);
- AP4_UI32 GetSize32() const
- {
- return m_Size32;
- }
- void SetSize32(AP4_UI32 size)
- {
- m_Size32 = size;
- }
- AP4_UI64 GetSize64() const
- {
- return m_Size64;
- }
- void SetSize64(AP4_UI64 size)
- {
- m_Size64 = size;
- }
+ AP4_UI32 GetSize32() const { return m_Size32; }
+ void SetSize32(AP4_UI32 size) { m_Size32 = size; }
+ AP4_UI64 GetSize64() const { return m_Size64; }
+ void SetSize64(AP4_UI64 size) { m_Size64 = size; }
virtual AP4_Result Write(AP4_ByteStream& stream);
virtual AP4_Result WriteHeader(AP4_ByteStream& stream);
virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
virtual AP4_Result InspectHeader(AP4_AtomInspector& inspector);
- virtual AP4_Result InspectFields(AP4_AtomInspector& /* inspector */)
- {
- return AP4_SUCCESS;
+ virtual AP4_Result InspectFields(AP4_AtomInspector& /* inspector */) {
+ return AP4_SUCCESS;
}
// parent/child relationship methods
- virtual AP4_Result SetParent(AP4_AtomParent* parent)
- {
+ virtual AP4_Result SetParent(AP4_AtomParent* parent) {
m_Parent = parent;
return AP4_SUCCESS;
}
- virtual AP4_AtomParent* GetParent()
- {
- return m_Parent;
- }
+ virtual AP4_AtomParent* GetParent() { return m_Parent; }
virtual AP4_Result Detach();
/**
@@ -274,15 +228,15 @@ public:
* the atom cannot be cloned.
* Override this if your want to make an atom cloneable in a more
* efficient way than the default implementation.
- */
+ */
virtual AP4_Atom* Clone();
-protected:
+ protected:
// members
Type m_Type;
- AP4_UI32 m_Size32;
+ AP4_UI32 m_Size32;
AP4_UI64 m_Size64; // this is 0 if m_Size is not 1 (encoded in 32-bits)
- // and non-zero only if m_Size is 1 (encoded in 64-bits)
+ // and non-zero only if m_Size is 1 (encoded in 64-bits)
bool m_IsFull;
AP4_UI32 m_Version;
AP4_UI32 m_Flags;
@@ -296,23 +250,19 @@ protected:
* Base class for containers of atoms.
* This class also implements the logic for finding descendents by name.
*/
-class AP4_AtomParent
-{
+class AP4_AtomParent {
public:
AP4_IMPLEMENT_DYNAMIC_CAST(AP4_AtomParent)
// base methods
virtual ~AP4_AtomParent();
- AP4_List<AP4_Atom>& GetChildren()
- {
- return m_Children;
- }
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
virtual AP4_Result AddChild(AP4_Atom* child, int position = -1);
virtual AP4_Result RemoveChild(AP4_Atom* child);
virtual AP4_Result DeleteChild(AP4_Atom::Type type, AP4_Ordinal index = 0);
virtual AP4_Atom* GetChild(AP4_Atom::Type type, AP4_Ordinal index = 0) const;
virtual AP4_Atom* GetChild(const AP4_UI08* uuid, AP4_Ordinal index = 0) const;
- virtual AP4_Atom* FindChild(const char* path,
+ virtual AP4_Atom* FindChild(const char* path,
bool auto_create = false,
bool auto_create_full = false);
@@ -331,18 +281,17 @@ protected:
+---------------------------------------------------------------------*/
/**
* Class that represents atoms for which there is no specific support.
- * Instances of this class keep a reference to the stream from which
+ * Instances of this class keep a reference to the stream from which
* the atom is parsed, so that it can read the atom's payload when it
* is serialized.
- * If the atom is small, its payload is actually read and stored in
+ * If the atom is small, its payload is actually read and stored in
* a data buffer, so no reference to the source stream is kept
*/
-class AP4_UnknownAtom : public AP4_Atom
-{
+class AP4_UnknownAtom : public AP4_Atom {
public:
// constructor and destructor
- AP4_UnknownAtom(AP4_Atom::Type type,
- AP4_UI64 size,
+ AP4_UnknownAtom(AP4_Atom::Type type,
+ AP4_UI64 size,
AP4_ByteStream& stream);
AP4_UnknownAtom(AP4_Atom::Type type, const AP4_UI08* payload, AP4_Size payload_size);
AP4_UnknownAtom(const AP4_UnknownAtom& other);
@@ -376,11 +325,8 @@ public:
AP4_NullTerminatedStringAtom(AP4_Atom::Type type, const char* value);
// accessors
- const AP4_String& GetValue()
- {
- return m_Value;
- }
-
+ const AP4_String& GetValue() { return m_Value; }
+
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
@@ -393,133 +339,133 @@ private:
/*----------------------------------------------------------------------
| atom types
+---------------------------------------------------------------------*/
-const AP4_Atom::Type AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u', 'd', 't', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_URL = AP4_ATOM_TYPE('u', 'r', 'l', ' ');
-const AP4_Atom::Type AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t', 'r', 'a', 'k');
-const AP4_Atom::Type AP4_ATOM_TYPE_TRAF = AP4_ATOM_TYPE('t', 'r', 'a', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t', 'k', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_TFHD = AP4_ATOM_TYPE('t', 'f', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_TRUN = AP4_ATOM_TYPE('t', 'r', 'u', 'n');
-const AP4_Atom::Type AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s', 't', 't', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s', 't', 's', 'z');
-const AP4_Atom::Type AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s', 't', 's', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s', 't', 's', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s', 't', 's', 'c');
-const AP4_Atom::Type AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s', 't', 'c', 'o');
-const AP4_Atom::Type AP4_ATOM_TYPE_CO64 = AP4_ATOM_TYPE('c', 'o', '6', '4');
-const AP4_Atom::Type AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s', 't', 'b', 'l');
-const AP4_Atom::Type AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s', 'i', 'n', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s', 'c', 'h', 'm');
-const AP4_Atom::Type AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s', 'c', 'h', 'i');
-const AP4_Atom::Type AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m', 'v', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_MEHD = AP4_ATOM_TYPE('m', 'e', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m', 'p', '4', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m', 'p', '4', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_MP4V = AP4_ATOM_TYPE('m', 'p', '4', 'v');
-const AP4_Atom::Type AP4_ATOM_TYPE_AVC1 = AP4_ATOM_TYPE('a', 'v', 'c', '1');
-const AP4_Atom::Type AP4_ATOM_TYPE_ALAC = AP4_ATOM_TYPE('a', 'l', 'a', 'c');
-const AP4_Atom::Type AP4_ATOM_TYPE_ENCA = AP4_ATOM_TYPE('e', 'n', 'c', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_ENCV = AP4_ATOM_TYPE('e', 'n', 'c', 'v');
-const AP4_Atom::Type AP4_ATOM_TYPE_MOOV = AP4_ATOM_TYPE('m', 'o', 'o', 'v');
-const AP4_Atom::Type AP4_ATOM_TYPE_MOOF = AP4_ATOM_TYPE('m', 'o', 'o', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_MVEX = AP4_ATOM_TYPE('m', 'v', 'e', 'x');
-const AP4_Atom::Type AP4_ATOM_TYPE_TREX = AP4_ATOM_TYPE('t', 'r', 'e', 'x');
-const AP4_Atom::Type AP4_ATOM_TYPE_MINF = AP4_ATOM_TYPE('m', 'i', 'n', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_META = AP4_ATOM_TYPE('m', 'e', 't', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_MDHD = AP4_ATOM_TYPE('m', 'd', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_MFHD = AP4_ATOM_TYPE('m', 'f', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_ILST = AP4_ATOM_TYPE('i', 'l', 's', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_HDLR = AP4_ATOM_TYPE('h', 'd', 'l', 'r');
-const AP4_Atom::Type AP4_ATOM_TYPE_FTYP = AP4_ATOM_TYPE('f', 't', 'y', 'p');
-const AP4_Atom::Type AP4_ATOM_TYPE_IODS = AP4_ATOM_TYPE('i', 'o', 'd', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_ESDS = AP4_ATOM_TYPE('e', 's', 'd', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_EDTS = AP4_ATOM_TYPE('e', 'd', 't', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_DRMS = AP4_ATOM_TYPE('d', 'r', 'm', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_DRMI = AP4_ATOM_TYPE('d', 'r', 'm', 'i');
-const AP4_Atom::Type AP4_ATOM_TYPE_DREF = AP4_ATOM_TYPE('d', 'r', 'e', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_DINF = AP4_ATOM_TYPE('d', 'i', 'n', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_CTTS = AP4_ATOM_TYPE('c', 't', 't', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_MDIA = AP4_ATOM_TYPE('m', 'd', 'i', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_ELST = AP4_ATOM_TYPE('e', 'l', 's', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_VMHD = AP4_ATOM_TYPE('v', 'm', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_SMHD = AP4_ATOM_TYPE('s', 'm', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_NMHD = AP4_ATOM_TYPE('n', 'm', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_HMHD = AP4_ATOM_TYPE('h', 'm', 'h', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_FRMA = AP4_ATOM_TYPE('f', 'r', 'm', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_MDAT = AP4_ATOM_TYPE('m', 'd', 'a', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_FREE = AP4_ATOM_TYPE('f', 'r', 'e', 'e');
-const AP4_Atom::Type AP4_ATOM_TYPE_TIMS = AP4_ATOM_TYPE('t', 'i', 'm', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_RTP_ = AP4_ATOM_TYPE('r', 't', 'p', ' ');
-const AP4_Atom::Type AP4_ATOM_TYPE_HNTI = AP4_ATOM_TYPE('h', 'n', 't', 'i');
-const AP4_Atom::Type AP4_ATOM_TYPE_SDP_ = AP4_ATOM_TYPE('s', 'd', 'p', ' ');
-const AP4_Atom::Type AP4_ATOM_TYPE_IKMS = AP4_ATOM_TYPE('i', 'K', 'M', 'S');
-const AP4_Atom::Type AP4_ATOM_TYPE_ISFM = AP4_ATOM_TYPE('i', 'S', 'F', 'M');
-const AP4_Atom::Type AP4_ATOM_TYPE_ISLT = AP4_ATOM_TYPE('i', 'S', 'L', 'T');
-const AP4_Atom::Type AP4_ATOM_TYPE_TREF = AP4_ATOM_TYPE('t', 'r', 'e', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_HINT = AP4_ATOM_TYPE('h', 'i', 'n', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_CDSC = AP4_ATOM_TYPE('c', 'd', 's', 'c');
-const AP4_Atom::Type AP4_ATOM_TYPE_MPOD = AP4_ATOM_TYPE('m', 'p', 'o', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_IPIR = AP4_ATOM_TYPE('i', 'p', 'i', 'r');
-const AP4_Atom::Type AP4_ATOM_TYPE_CHAP = AP4_ATOM_TYPE('c', 'h', 'a', 'p');
-const AP4_Atom::Type AP4_ATOM_TYPE_ALIS = AP4_ATOM_TYPE('a', 'l', 'i', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_SYNC = AP4_ATOM_TYPE('s', 'y', 'n', 'c');
-const AP4_Atom::Type AP4_ATOM_TYPE_DPND = AP4_ATOM_TYPE('d', 'p', 'n', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_ODRM = AP4_ATOM_TYPE('o', 'd', 'r', 'm');
-const AP4_Atom::Type AP4_ATOM_TYPE_ODKM = AP4_ATOM_TYPE('o', 'd', 'k', 'm');
-const AP4_Atom::Type AP4_ATOM_TYPE_OHDR = AP4_ATOM_TYPE('o', 'h', 'd', 'r');
-const AP4_Atom::Type AP4_ATOM_TYPE_ODDA = AP4_ATOM_TYPE('o', 'd', 'd', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_ODHE = AP4_ATOM_TYPE('o', 'd', 'h', 'e');
-const AP4_Atom::Type AP4_ATOM_TYPE_ODAF = AP4_ATOM_TYPE('o', 'd', 'a', 'f');
-const AP4_Atom::Type AP4_ATOM_TYPE_GRPI = AP4_ATOM_TYPE('g', 'r', 'p', 'i');
-const AP4_Atom::Type AP4_ATOM_TYPE_IPRO = AP4_ATOM_TYPE('i', 'p', 'r', 'o');
-const AP4_Atom::Type AP4_ATOM_TYPE_MDRI = AP4_ATOM_TYPE('m', 'd', 'r', 'i');
-const AP4_Atom::Type AP4_ATOM_TYPE_AVCC = AP4_ATOM_TYPE('a', 'v', 'c', 'C');
-const AP4_Atom::Type AP4_ATOM_TYPE_WAVE = AP4_ATOM_TYPE('w', 'a', 'v', 'e');
-const AP4_Atom::Type AP4_ATOM_TYPE_WIDE = AP4_ATOM_TYPE('w', 'i', 'd', 'e');
-const AP4_Atom::Type AP4_ATOM_TYPE_UUID = AP4_ATOM_TYPE('u', 'u', 'i', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_8ID_ = AP4_ATOM_TYPE('8', 'i', 'd', ' ');
-const AP4_Atom::Type AP4_ATOM_TYPE_8BDL = AP4_ATOM_TYPE('8', 'b', 'd', 'l');
-const AP4_Atom::Type AP4_ATOM_TYPE_AC_3 = AP4_ATOM_TYPE('a', 'c', '-', '3');
-const AP4_Atom::Type AP4_ATOM_TYPE_EC_3 = AP4_ATOM_TYPE('e', 'c', '-', '3');
-const AP4_Atom::Type AP4_ATOM_TYPE_MFRA = AP4_ATOM_TYPE('m', 'f', 'r', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_TFRA = AP4_ATOM_TYPE('t', 'f', 'r', 'a');
-const AP4_Atom::Type AP4_ATOM_TYPE_MFRO = AP4_ATOM_TYPE('m', 'f', 'r', 'o');
+const AP4_Atom::Type AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u','d','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_URL = AP4_ATOM_TYPE('u','r','l',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t','r','a','k');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRAF = AP4_ATOM_TYPE('t','r','a','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t','k','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_TFHD = AP4_ATOM_TYPE('t','f','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRUN = AP4_ATOM_TYPE('t','r','u','n');
+const AP4_Atom::Type AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s','t','s','z');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s','t','s','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s','t','s','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s','t','s','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s','t','c','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_CO64 = AP4_ATOM_TYPE('c','o','6','4');
+const AP4_Atom::Type AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s','t','b','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s','c','h','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s','c','h','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m','v','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_MEHD = AP4_ATOM_TYPE('m','e','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m','p','4','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m','p','4','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4V = AP4_ATOM_TYPE('m','p','4','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_AVC1 = AP4_ATOM_TYPE('a','v','c','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_ALAC = AP4_ATOM_TYPE('a','l','a','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCA = AP4_ATOM_TYPE('e','n','c','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCV = AP4_ATOM_TYPE('e','n','c','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MOOV = AP4_ATOM_TYPE('m','o','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MOOF = AP4_ATOM_TYPE('m','o','o','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_MVEX = AP4_ATOM_TYPE('m','v','e','x');
+const AP4_Atom::Type AP4_ATOM_TYPE_TREX = AP4_ATOM_TYPE('t','r','e','x');
+const AP4_Atom::Type AP4_ATOM_TYPE_MINF = AP4_ATOM_TYPE('m','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_META = AP4_ATOM_TYPE('m','e','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDHD = AP4_ATOM_TYPE('m','d','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_MFHD = AP4_ATOM_TYPE('m','f','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_ILST = AP4_ATOM_TYPE('i','l','s','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_HDLR = AP4_ATOM_TYPE('h','d','l','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTYP = AP4_ATOM_TYPE('f','t','y','p');
+const AP4_Atom::Type AP4_ATOM_TYPE_IODS = AP4_ATOM_TYPE('i','o','d','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_ESDS = AP4_ATOM_TYPE('e','s','d','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_EDTS = AP4_ATOM_TYPE('e','d','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DRMS = AP4_ATOM_TYPE('d','r','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DRMI = AP4_ATOM_TYPE('d','r','m','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_DREF = AP4_ATOM_TYPE('d','r','e','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_DINF = AP4_ATOM_TYPE('d','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_CTTS = AP4_ATOM_TYPE('c','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDIA = AP4_ATOM_TYPE('m','d','i','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_ELST = AP4_ATOM_TYPE('e','l','s','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_VMHD = AP4_ATOM_TYPE('v','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SMHD = AP4_ATOM_TYPE('s','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_NMHD = AP4_ATOM_TYPE('n','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_HMHD = AP4_ATOM_TYPE('h','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_FRMA = AP4_ATOM_TYPE('f','r','m','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDAT = AP4_ATOM_TYPE('m','d','a','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_FREE = AP4_ATOM_TYPE('f','r','e','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_TIMS = AP4_ATOM_TYPE('t','i','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_RTP_ = AP4_ATOM_TYPE('r','t','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_HNTI = AP4_ATOM_TYPE('h','n','t','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_SDP_ = AP4_ATOM_TYPE('s','d','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_IKMS = AP4_ATOM_TYPE('i','K','M','S');
+const AP4_Atom::Type AP4_ATOM_TYPE_ISFM = AP4_ATOM_TYPE('i','S','F','M');
+const AP4_Atom::Type AP4_ATOM_TYPE_ISLT = AP4_ATOM_TYPE('i','S','L','T');
+const AP4_Atom::Type AP4_ATOM_TYPE_TREF = AP4_ATOM_TYPE('t','r','e','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_CDSC = AP4_ATOM_TYPE('c','d','s','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_MPOD = AP4_ATOM_TYPE('m','p','o','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_IPIR = AP4_ATOM_TYPE('i','p','i','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_CHAP = AP4_ATOM_TYPE('c','h','a','p');
+const AP4_Atom::Type AP4_ATOM_TYPE_ALIS = AP4_ATOM_TYPE('a','l','i','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_SYNC = AP4_ATOM_TYPE('s','y','n','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_DPND = AP4_ATOM_TYPE('d','p','n','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_ODRM = AP4_ATOM_TYPE('o','d','r','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_ODKM = AP4_ATOM_TYPE('o','d','k','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_OHDR = AP4_ATOM_TYPE('o','h','d','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_ODDA = AP4_ATOM_TYPE('o','d','d','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_ODHE = AP4_ATOM_TYPE('o','d','h','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_ODAF = AP4_ATOM_TYPE('o','d','a','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_GRPI = AP4_ATOM_TYPE('g','r','p','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_IPRO = AP4_ATOM_TYPE('i','p','r','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDRI = AP4_ATOM_TYPE('m','d','r','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_AVCC = AP4_ATOM_TYPE('a','v','c','C');
+const AP4_Atom::Type AP4_ATOM_TYPE_WAVE = AP4_ATOM_TYPE('w','a','v','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_WIDE = AP4_ATOM_TYPE('w','i','d','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_UUID = AP4_ATOM_TYPE('u','u','i','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_8ID_ = AP4_ATOM_TYPE('8','i','d',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_8BDL = AP4_ATOM_TYPE('8','b','d','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_AC_3 = AP4_ATOM_TYPE('a','c','-','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_EC_3 = AP4_ATOM_TYPE('e','c','-','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_MFRA = AP4_ATOM_TYPE('m','f','r','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_TFRA = AP4_ATOM_TYPE('t','f','r','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MFRO = AP4_ATOM_TYPE('m','f','r','o');
// ==> Start patch MPC
-const AP4_Atom::Type AP4_ATOM_TYPE_FTAB = AP4_ATOM_TYPE('f', 't', 'a', 'b');
-const AP4_Atom::Type AP4_ATOM_TYPE_CHPL = AP4_ATOM_TYPE('c', 'h', 'p', 'l');
-const AP4_Atom::Type AP4_ATOM_TYPE_SAC3 = AP4_ATOM_TYPE('s', 'a', 'c', '3');
-const AP4_Atom::Type AP4_ATOM_TYPE_DTSC = AP4_ATOM_TYPE('d', 't', 's', 'c');
-const AP4_Atom::Type AP4_ATOM_TYPE_NAM = AP4_ATOM_TYPE(169, 'n', 'a', 'm');
-
-const AP4_Atom::Type AP4_ATOM_TYPE_ART = AP4_ATOM_TYPE(169, 'A', 'R', 'T');
-const AP4_Atom::Type AP4_ATOM_TYPE_WRT = AP4_ATOM_TYPE(169, 'w', 'r', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_ALB = AP4_ATOM_TYPE(169, 'a', 'l', 'b');
-const AP4_Atom::Type AP4_ATOM_TYPE_DAY = AP4_ATOM_TYPE(169, 'd', 'a', 'y');
-const AP4_Atom::Type AP4_ATOM_TYPE_TOO = AP4_ATOM_TYPE(169, 't', 'o', 'o');
-const AP4_Atom::Type AP4_ATOM_TYPE_CMT = AP4_ATOM_TYPE(169, 'c', 'm', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_GEN = AP4_ATOM_TYPE(169, 'g', 'e', 'n');
-
-const AP4_Atom::Type AP4_ATOM_TYPE_TEXT = AP4_ATOM_TYPE('t', 'e', 'x', 't');
-const AP4_Atom::Type AP4_ATOM_TYPE_TX3G = AP4_ATOM_TYPE('t', 'x', '3', 'g');
-const AP4_Atom::Type AP4_ATOM_TYPE_CVID = AP4_ATOM_TYPE('c', 'v', 'i', 'd');
-const AP4_Atom::Type AP4_ATOM_TYPE_SVQ1 = AP4_ATOM_TYPE('S', 'V', 'Q', '1');
-const AP4_Atom::Type AP4_ATOM_TYPE_SVQ2 = AP4_ATOM_TYPE('S', 'V', 'Q', '2');
-const AP4_Atom::Type AP4_ATOM_TYPE_SVQ3 = AP4_ATOM_TYPE('S', 'V', 'Q', '3');
-const AP4_Atom::Type AP4_ATOM_TYPE_H263 = AP4_ATOM_TYPE('h', '2', '6', '3');
-const AP4_Atom::Type AP4_ATOM_TYPE_S263 = AP4_ATOM_TYPE('s', '2', '6', '3');
-
-const AP4_Atom::Type AP4_ATOM_TYPE_SAMR = AP4_ATOM_TYPE('s', 'a', 'm', 'r');
-const AP4_Atom::Type AP4_ATOM_TYPE__MP3 = AP4_ATOM_TYPE('.', 'm', 'p', '3');
-const AP4_Atom::Type AP4_ATOM_TYPE_IMA4 = AP4_ATOM_TYPE('i', 'm', 'a', '4');
-const AP4_Atom::Type AP4_ATOM_TYPE_QDMC = AP4_ATOM_TYPE('Q', 'D', 'M', 'C');
-const AP4_Atom::Type AP4_ATOM_TYPE_QDM2 = AP4_ATOM_TYPE('Q', 'D', 'M', '2');
-const AP4_Atom::Type AP4_ATOM_TYPE_TWOS = AP4_ATOM_TYPE('t', 'w', 'o', 's');
-const AP4_Atom::Type AP4_ATOM_TYPE_SOWT = AP4_ATOM_TYPE('s', 'o', 'w', 't');
-
-const AP4_Atom::Type AP4_ATOM_TYPE_CMOV = AP4_ATOM_TYPE('c', 'm', 'o', 'v');
-const AP4_Atom::Type AP4_ATOM_TYPE_DCOM = AP4_ATOM_TYPE('d', 'c', 'o', 'm');
-const AP4_Atom::Type AP4_ATOM_TYPE_CMVD = AP4_ATOM_TYPE('c', 'm', 'v', 'd');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTAB = AP4_ATOM_TYPE('f','t','a','b');
+const AP4_Atom::Type AP4_ATOM_TYPE_CHPL = AP4_ATOM_TYPE('c','h','p','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_SAC3 = AP4_ATOM_TYPE('s','a','c','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_DTSC = AP4_ATOM_TYPE('d','t','s','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_NAM = AP4_ATOM_TYPE(169,'n','a','m');
+
+const AP4_Atom::Type AP4_ATOM_TYPE_ART = AP4_ATOM_TYPE(169,'A','R','T');
+const AP4_Atom::Type AP4_ATOM_TYPE_WRT = AP4_ATOM_TYPE(169,'w','r','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_ALB = AP4_ATOM_TYPE(169,'a','l','b');
+const AP4_Atom::Type AP4_ATOM_TYPE_DAY = AP4_ATOM_TYPE(169,'d','a','y');
+const AP4_Atom::Type AP4_ATOM_TYPE_TOO = AP4_ATOM_TYPE(169,'t','o','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMT = AP4_ATOM_TYPE(169,'c','m','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_GEN = AP4_ATOM_TYPE(169,'g','e','n');
+
+const AP4_Atom::Type AP4_ATOM_TYPE_TEXT = AP4_ATOM_TYPE('t','e','x','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_TX3G = AP4_ATOM_TYPE('t','x','3','g');
+const AP4_Atom::Type AP4_ATOM_TYPE_CVID = AP4_ATOM_TYPE('c','v','i','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ1 = AP4_ATOM_TYPE('S','V','Q','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ2 = AP4_ATOM_TYPE('S','V','Q','2');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ3 = AP4_ATOM_TYPE('S','V','Q','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_H263 = AP4_ATOM_TYPE('h','2','6','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_S263 = AP4_ATOM_TYPE('s','2','6','3');
+
+const AP4_Atom::Type AP4_ATOM_TYPE_SAMR = AP4_ATOM_TYPE('s','a','m','r');
+const AP4_Atom::Type AP4_ATOM_TYPE__MP3 = AP4_ATOM_TYPE('.','m','p','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_IMA4 = AP4_ATOM_TYPE('i','m','a','4');
+const AP4_Atom::Type AP4_ATOM_TYPE_QDMC = AP4_ATOM_TYPE('Q','D','M','C');
+const AP4_Atom::Type AP4_ATOM_TYPE_QDM2 = AP4_ATOM_TYPE('Q','D','M','2');
+const AP4_Atom::Type AP4_ATOM_TYPE_TWOS = AP4_ATOM_TYPE('t','w','o','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_SOWT = AP4_ATOM_TYPE('s','o','w','t');
+
+const AP4_Atom::Type AP4_ATOM_TYPE_CMOV = AP4_ATOM_TYPE('c','m','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_DCOM = AP4_ATOM_TYPE('d','c','o','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMVD = AP4_ATOM_TYPE('c','m','v','d');
// <== End patch MPC
@@ -528,16 +474,15 @@ const AP4_Atom::Type AP4_ATOM_TYPE_CMVD = AP4_ATOM_TYPE('c', 'm', 'v', 'd');
+---------------------------------------------------------------------*/
class AP4_AtomListInspector : public AP4_List<AP4_Atom>::Item::Operator
{
-public:
+ public:
AP4_AtomListInspector(AP4_AtomInspector& inspector) :
m_Inspector(inspector) {}
- AP4_Result Action(AP4_Atom* atom) const
- {
+ AP4_Result Action(AP4_Atom* atom) const {
atom->Inspect(m_Inspector);
return AP4_SUCCESS;
}
-private:
+ private:
AP4_AtomInspector& m_Inspector;
};
@@ -546,12 +491,12 @@ private:
+---------------------------------------------------------------------*/
class AP4_AtomListWriter : public AP4_List<AP4_Atom>::Item::Operator
{
-public:
+ public:
AP4_AtomListWriter(AP4_ByteStream& stream) :
m_Stream(stream) {}
AP4_Result Action(AP4_Atom* atom) const;
-private:
+ private:
AP4_ByteStream& m_Stream;
};
@@ -560,28 +505,21 @@ private:
+---------------------------------------------------------------------*/
class AP4_AtomFinder : public AP4_List<AP4_Atom>::Item::Finder
{
-public:
- AP4_AtomFinder(AP4_Atom::Type type, AP4_Ordinal index = 0) :
- m_Type(type), m_Index(index) {}
- AP4_Result Test(AP4_Atom* atom) const
- {
- if(atom->GetType() == m_Type)
- {
- if(m_Index-- == 0)
- {
+ public:
+ AP4_AtomFinder(AP4_Atom::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Atom* atom) const {
+ if (atom->GetType() == m_Type) {
+ if (m_Index-- == 0) {
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_FAILURE;
}
- }
- else
- {
+ } else {
return AP4_FAILURE;
}
}
-private:
+ private:
AP4_Atom::Type m_Type;
mutable AP4_Ordinal m_Index;
};
@@ -589,14 +527,12 @@ private:
/*----------------------------------------------------------------------
| AP4_AtomSizeAdder
+---------------------------------------------------------------------*/
-class AP4_AtomSizeAdder : public AP4_List<AP4_Atom>::Item::Operator
-{
+class AP4_AtomSizeAdder : public AP4_List<AP4_Atom>::Item::Operator {
public:
AP4_AtomSizeAdder(AP4_UI64& size) : m_Size(size) {}
private:
- AP4_Result Action(AP4_Atom* atom) const
- {
+ AP4_Result Action(AP4_Atom* atom) const {
m_Size += atom->GetSize();
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.cpp
index 97527d3d7..04158c4aa 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.cpp
@@ -125,18 +125,17 @@ AP4_AtomFactory::RemoveTypeHandler(TypeHandler* handler)
| AP4_AtomFactory::CreateAtomFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
AP4_Atom*& atom)
{
AP4_LargeSize stream_size = 0;
AP4_Position stream_position = 0;
AP4_LargeSize bytes_available = (AP4_LargeSize)(-1);
- if(AP4_SUCCEEDED(stream.GetSize(stream_size)) &&
- stream_size != 0 &&
- AP4_SUCCEEDED(stream.Tell(stream_position)) &&
- stream_position <= stream_size)
- {
- bytes_available = stream_size - stream_position;
+ if (AP4_SUCCEEDED(stream.GetSize(stream_size)) &&
+ stream_size != 0 &&
+ AP4_SUCCEEDED(stream.Tell(stream_position)) &&
+ stream_position <= stream_size) {
+ bytes_available = stream_size-stream_position;
}
return CreateAtomFromStream(stream, bytes_available, atom);
}
@@ -145,7 +144,7 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
| AP4_AtomFactory::CreateAtomFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
AP4_LargeSize& bytes_available,
AP4_Atom*& atom)
{
@@ -155,7 +154,7 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
atom = NULL;
// check that there are enough bytes for at least a header
- if(bytes_available < 8) return AP4_ERROR_EOS;
+ if (bytes_available < 8) return AP4_ERROR_EOS;
// remember current stream offset
AP4_Position start;
@@ -164,8 +163,7 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
// read atom size
AP4_UI32 size_32;
result = stream.ReadUI32(size_32);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
stream.Seek(start);
return result;
}
@@ -174,8 +172,7 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
// read atom type
AP4_Atom::Type type;
result = stream.ReadUI32(type);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
stream.Seek(start);
return result;
}
@@ -183,524 +180,499 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
// handle special size values
bool atom_is_large = false;
bool force_64 = false;
- if(size == 0)
- {
+ if (size == 0) {
// atom extends to end of file
AP4_LargeSize stream_size = 0;
stream.GetSize(stream_size);
- if(stream_size >= start)
- {
+ if (stream_size >= start) {
size = stream_size - start;
}
- }
- else if(size == 1)
- {
+ } else if (size == 1) {
// 64-bit size
atom_is_large = true;
- if(bytes_available < 16)
- {
+ if (bytes_available < 16) {
stream.Seek(start);
return AP4_ERROR_INVALID_FORMAT;
}
stream.ReadUI64(size);
- if(size <= 0xFFFFFFFF)
- {
+ if (size <= 0xFFFFFFFF) {
force_64 = true;
}
}
// check the size
- if((size > 0 && size < 8) || size > bytes_available)
- {
+ if ((size > 0 && size < 8) || size > bytes_available) {
stream.Seek(start);
return AP4_ERROR_INVALID_FORMAT;
}
// create the atom
- if(GetContext() == AP4_ATOM_TYPE_STSD)
- {
+ if (GetContext() == AP4_ATOM_TYPE_STSD) {
// sample entry
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
- switch(type)
- {
- case AP4_ATOM_TYPE_MP4A:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ switch (type) {
+ case AP4_ATOM_TYPE_MP4A:
atom = new AP4_Mp4aSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_MP4V:
+ case AP4_ATOM_TYPE_MP4V:
atom = new AP4_Mp4vSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_MP4S:
+ case AP4_ATOM_TYPE_MP4S:
atom = new AP4_Mp4sSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_ENCA:
+ case AP4_ATOM_TYPE_ENCA:
atom = new AP4_EncaSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_ENCV:
+ case AP4_ATOM_TYPE_ENCV:
atom = new AP4_EncvSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_DRMS:
+ case AP4_ATOM_TYPE_DRMS:
atom = new AP4_DrmsSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_DRMI:
+ case AP4_ATOM_TYPE_DRMI:
atom = new AP4_DrmiSampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_AVC1:
+ case AP4_ATOM_TYPE_AVC1:
atom = new AP4_Avc1SampleEntry(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_ALAC:
- // ==> Start patch MPC
+ case AP4_ATOM_TYPE_ALAC:
+ // ==> Start patch MPC
// case AP4_ATOM_TYPE_AC_3:
- // <== End patch MPC
- case AP4_ATOM_TYPE_EC_3:
+ // <== End patch MPC
+ case AP4_ATOM_TYPE_EC_3:
atom = new AP4_AudioSampleEntry(type, size_32, stream, *this);
break;
- // ==> Start patch MPC
- case AP4_ATOM_TYPE_TEXT:
- atom = new AP4_TextSampleEntry((unsigned long)size, stream, *this);
- break;
-
- case AP4_ATOM_TYPE_TX3G:
- atom = new AP4_Tx3gSampleEntry((unsigned long)size, stream, *this);
- break;
-
- case AP4_ATOM_TYPE_FTAB:
- atom = new AP4_FtabAtom((unsigned long)size, stream);
- break;
-
- case AP4_ATOM_TYPE_CHPL:
- atom = new AP4_ChplAtom((unsigned long)size, stream);
- break;
-
- case AP4_ATOM_TYPE_CVID:
- case AP4_ATOM_TYPE_SVQ1:
- case AP4_ATOM_TYPE_SVQ2:
- case AP4_ATOM_TYPE_SVQ3:
- case AP4_ATOM_TYPE_H263:
- case AP4_ATOM_TYPE_S263:
- atom = new AP4_VisualSampleEntry(type, (unsigned long)size, stream, *this);
- break;
-
- case AP4_ATOM_TYPE_SAMR:
- case AP4_ATOM_TYPE__MP3:
- case AP4_ATOM_TYPE_IMA4:
- case AP4_ATOM_TYPE_QDMC:
- case AP4_ATOM_TYPE_QDM2:
- case AP4_ATOM_TYPE_TWOS:
- case AP4_ATOM_TYPE_SOWT:
- atom = new AP4_AudioSampleEntry(type, (unsigned long)size, stream, *this);
- break;
-
- case AP4_ATOM_TYPE_AC_3: // AC3-in-MP4 from ISO Standard
- case AP4_ATOM_TYPE_SAC3: // AC3-in-MP4 from Nero Stuff >.<
- atom = new AP4_AC3SampleEntry(type, (unsigned long)size, stream, *this);
- break;
- // <== End patch MPC
-
- case AP4_ATOM_TYPE_RTP_:
+ // ==> Start patch MPC
+ case AP4_ATOM_TYPE_TEXT:
+ atom = new AP4_TextSampleEntry((unsigned long)size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_TX3G:
+ atom = new AP4_Tx3gSampleEntry((unsigned long)size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_FTAB:
+ atom = new AP4_FtabAtom((unsigned long)size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CHPL:
+ atom = new AP4_ChplAtom((unsigned long)size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CVID:
+ case AP4_ATOM_TYPE_SVQ1:
+ case AP4_ATOM_TYPE_SVQ2:
+ case AP4_ATOM_TYPE_SVQ3:
+ case AP4_ATOM_TYPE_H263:
+ case AP4_ATOM_TYPE_S263:
+ atom = new AP4_VisualSampleEntry(type, (unsigned long)size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_SAMR:
+ case AP4_ATOM_TYPE__MP3:
+ case AP4_ATOM_TYPE_IMA4:
+ case AP4_ATOM_TYPE_QDMC:
+ case AP4_ATOM_TYPE_QDM2:
+ case AP4_ATOM_TYPE_TWOS:
+ case AP4_ATOM_TYPE_SOWT:
+ atom = new AP4_AudioSampleEntry(type, (unsigned long)size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_AC_3: // AC3-in-MP4 from ISO Standard
+ case AP4_ATOM_TYPE_SAC3: // AC3-in-MP4 from Nero Stuff >.<
+ atom = new AP4_AC3SampleEntry(type, (unsigned long)size, stream, *this);
+ break;
+ // <== End patch MPC
+
+ case AP4_ATOM_TYPE_RTP_:
atom = new AP4_RtpHintSampleEntry(size_32, stream, *this);
break;
- default:
- {
- // try all the external type handlers
- AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
- while(handler_item)
+ default:
{
- TypeHandler* handler = handler_item->GetData();
- if(AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom)))
- {
- break;
+ // try all the external type handlers
+ AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
+ while (handler_item) {
+ TypeHandler* handler = handler_item->GetData();
+ if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {
+ break;
+ }
+ handler_item = handler_item->GetNext();
}
- handler_item = handler_item->GetNext();
+
+ // no custom handler, create a generic entry
+ atom = new AP4_UnknownSampleEntry(type, (AP4_Size)size, stream);
}
-
- // no custom handler, create a generic entry
- atom = new AP4_UnknownSampleEntry(type, (AP4_Size)size, stream);
- }
- break;
+ break;
}
- }
- else
- {
+ } else {
// regular atom
- switch(type)
- {
- case AP4_ATOM_TYPE_MOOV:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ switch (type) {
+ case AP4_ATOM_TYPE_MOOV:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_MoovAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_MVHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_MVHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_MvhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_MEHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_MEHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_MehdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_MFHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_MFHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_MfhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_TRAK:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_TRAK:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TrakAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_TREX:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_TREX:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TrexAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_HDLR:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_HDLR:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_HdlrAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_TKHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_TKHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TkhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_TFHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_TFHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TfhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_TRUN:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_TRUN:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TrunAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_TFRA:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_TFRA:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TfraAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_MFRO:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_MFRO:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_MfroAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_MDHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_MDHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_MdhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_STSD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_STSD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_StsdAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_STSC:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_STSC:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_StscAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_STCO:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_STCO:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_StcoAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_CO64:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_CO64:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_Co64Atom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_STSZ:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_STSZ:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_StszAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_STTS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_STTS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_SttsAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_CTTS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_CTTS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_CttsAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_STSS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_STSS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_StssAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_IODS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_IODS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_IodsAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_ESDS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_ESDS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_EsdsAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_AVCC:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_AVCC:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_AvccAtom::Create(size_32, stream);
break;
-
-#if !defined(AP4_CONFIG_MINI_BUILD)
- case AP4_ATOM_TYPE_UUID:
- {
- AP4_UI08 uuid[16];
- result = stream.Read(uuid, 16);
- if(AP4_FAILED(result)) return result;
-
- if(AP4_CompareMemory(uuid, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 16) == 0)
- {
- atom = AP4_PiffTrackEncryptionAtom::Create((AP4_Size)size, stream);
- }
- else if(AP4_CompareMemory(uuid, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 16) == 0)
- {
- atom = AP4_PiffSampleEncryptionAtom::Create((AP4_Size)size, stream);
- }
- else
- {
- atom = new AP4_UnknownUuidAtom(size, uuid, stream);
- }
- break;
- }
-
- case AP4_ATOM_TYPE_8ID_:
+
+ #if !defined(AP4_CONFIG_MINI_BUILD)
+ case AP4_ATOM_TYPE_UUID: {
+ AP4_UI08 uuid[16];
+ result = stream.Read(uuid, 16);
+ if (AP4_FAILED(result)) return result;
+
+ if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 16) == 0) {
+ atom = AP4_PiffTrackEncryptionAtom::Create((AP4_Size)size, stream);
+ } else if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 16) == 0) {
+ atom = AP4_PiffSampleEncryptionAtom::Create((AP4_Size)size, stream);
+ } else {
+ atom = new AP4_UnknownUuidAtom(size, uuid, stream);
+ }
+ break;
+ }
+
+ case AP4_ATOM_TYPE_8ID_:
atom = new AP4_NullTerminatedStringAtom(type, size, stream);
break;
- case AP4_ATOM_TYPE_8BDL:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_8BDL:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_8bdlAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_DREF:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_DREF:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_DrefAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_URL:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_URL:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_UrlAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_ELST:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_ELST:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_ElstAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_VMHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_VMHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_VmhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_SMHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_SMHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_SmhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_NMHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_NMHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_NmhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_HMHD:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_HMHD:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_HmhdAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_FRMA:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_FRMA:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_FrmaAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_SCHM:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_SCHM:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_SchmAtom::Create(size_32, &m_ContextStack, stream);
break;
- case AP4_ATOM_TYPE_FTYP:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_FTYP:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_FtypAtom::Create(size_32, stream);
break;
-
- case AP4_ATOM_TYPE_TIMS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+
+ case AP4_ATOM_TYPE_TIMS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TimsAtom::Create(size_32, stream);
break;
-
- case AP4_ATOM_TYPE_SDP_:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+
+ case AP4_ATOM_TYPE_SDP_:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_SdpAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_IKMS:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_IKMS:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_IkmsAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_ISFM:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_ISFM:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_IsfmAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_ISLT:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_ISLT:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_IsltAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_ODHE:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_ODHE:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_OdheAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_OHDR:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_OHDR:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_OhdrAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_ODDA:
+ case AP4_ATOM_TYPE_ODDA:
atom = AP4_OddaAtom::Create(size, stream);
break;
- case AP4_ATOM_TYPE_ODAF:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_ODAF:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_OdafAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_GRPI:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_GRPI:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_GrpiAtom::Create(size_32, stream);
break;
- case AP4_ATOM_TYPE_IPRO:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_IPRO:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_IproAtom::Create(size_32, stream, *this);
break;
- case AP4_ATOM_TYPE_RTP_:
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_ATOM_TYPE_RTP_:
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_RtpAtom::Create(size_32, stream);
break;
- // track ref types
- case AP4_ATOM_TYPE_HINT:
- case AP4_ATOM_TYPE_CDSC:
- case AP4_ATOM_TYPE_SYNC:
- case AP4_ATOM_TYPE_MPOD:
- case AP4_ATOM_TYPE_DPND:
- case AP4_ATOM_TYPE_IPIR:
- case AP4_ATOM_TYPE_ALIS:
- case AP4_ATOM_TYPE_CHAP:
- if(GetContext() == AP4_ATOM_TYPE_TREF)
- {
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ // track ref types
+ case AP4_ATOM_TYPE_HINT:
+ case AP4_ATOM_TYPE_CDSC:
+ case AP4_ATOM_TYPE_SYNC:
+ case AP4_ATOM_TYPE_MPOD:
+ case AP4_ATOM_TYPE_DPND:
+ case AP4_ATOM_TYPE_IPIR:
+ case AP4_ATOM_TYPE_ALIS:
+ case AP4_ATOM_TYPE_CHAP:
+ if (GetContext() == AP4_ATOM_TYPE_TREF) {
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_TrefTypeAtom::Create(type, size_32, stream);
}
break;
-#endif // AP4_CONFIG_MINI_BUILD
-
- // container atoms
- case AP4_ATOM_TYPE_MOOF:
- case AP4_ATOM_TYPE_MVEX:
- case AP4_ATOM_TYPE_TRAF:
- case AP4_ATOM_TYPE_TREF:
- case AP4_ATOM_TYPE_MFRA:
- case AP4_ATOM_TYPE_HNTI:
- case AP4_ATOM_TYPE_STBL:
- case AP4_ATOM_TYPE_MDIA:
- case AP4_ATOM_TYPE_DINF:
- case AP4_ATOM_TYPE_MINF:
- case AP4_ATOM_TYPE_SCHI:
- case AP4_ATOM_TYPE_SINF:
- case AP4_ATOM_TYPE_UDTA:
- case AP4_ATOM_TYPE_ILST:
- case AP4_ATOM_TYPE_EDTS:
- case AP4_ATOM_TYPE_MDRI:
- case AP4_ATOM_TYPE_WAVE:
-
- // ==> Start patch MPC
- case AP4_ATOM_TYPE_ART:
- case AP4_ATOM_TYPE_WRT:
- case AP4_ATOM_TYPE_ALB:
- case AP4_ATOM_TYPE_DAY:
- case AP4_ATOM_TYPE_TOO:
- case AP4_ATOM_TYPE_CMT:
- case AP4_ATOM_TYPE_GEN:
- case AP4_ATOM_TYPE_CMOV:
- // <== End patch MPC
-
- if(atom_is_large) return AP4_ERROR_INVALID_FORMAT;
+ #endif // AP4_CONFIG_MINI_BUILD
+
+ // container atoms
+ case AP4_ATOM_TYPE_MOOF:
+ case AP4_ATOM_TYPE_MVEX:
+ case AP4_ATOM_TYPE_TRAF:
+ case AP4_ATOM_TYPE_TREF:
+ case AP4_ATOM_TYPE_MFRA:
+ case AP4_ATOM_TYPE_HNTI:
+ case AP4_ATOM_TYPE_STBL:
+ case AP4_ATOM_TYPE_MDIA:
+ case AP4_ATOM_TYPE_DINF:
+ case AP4_ATOM_TYPE_MINF:
+ case AP4_ATOM_TYPE_SCHI:
+ case AP4_ATOM_TYPE_SINF:
+ case AP4_ATOM_TYPE_UDTA:
+ case AP4_ATOM_TYPE_ILST:
+ case AP4_ATOM_TYPE_EDTS:
+ case AP4_ATOM_TYPE_MDRI:
+ case AP4_ATOM_TYPE_WAVE:
+
+ // ==> Start patch MPC
+ case AP4_ATOM_TYPE_ART:
+ case AP4_ATOM_TYPE_WRT:
+ case AP4_ATOM_TYPE_ALB:
+ case AP4_ATOM_TYPE_DAY:
+ case AP4_ATOM_TYPE_TOO:
+ case AP4_ATOM_TYPE_CMT:
+ case AP4_ATOM_TYPE_GEN:
+ case AP4_ATOM_TYPE_CMOV:
+ // <== End patch MPC
+
+ if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_ContainerAtom::Create(type, size, false, force_64, stream, *this);
break;
- // full container atoms
- case AP4_ATOM_TYPE_META:
- case AP4_ATOM_TYPE_ODRM:
- case AP4_ATOM_TYPE_ODKM:
+ // full container atoms
+ case AP4_ATOM_TYPE_META:
+ case AP4_ATOM_TYPE_ODRM:
+ case AP4_ATOM_TYPE_ODKM:
atom = AP4_ContainerAtom::Create(type, size, true, force_64, stream, *this);
break;
- case AP4_ATOM_TYPE_FREE:
- case AP4_ATOM_TYPE_WIDE:
- case AP4_ATOM_TYPE_MDAT:
+ case AP4_ATOM_TYPE_FREE:
+ case AP4_ATOM_TYPE_WIDE:
+ case AP4_ATOM_TYPE_MDAT:
// generic atoms
break;
-
- // ==> Start patch MPC
- case AP4_ATOM_TYPE_DCOM:
- atom = AP4_DcomAtom::Create((unsigned long)size, stream);
- break;
- case AP4_ATOM_TYPE_CMVD:
- atom = AP4_CmvdAtom::Create((unsigned long)size, stream, *this);
- break;
- // <== End patch MPC
-
- default:
+
+ // ==> Start patch MPC
+ case AP4_ATOM_TYPE_DCOM:
+ atom = AP4_DcomAtom::Create((unsigned long)size, stream);
+ break;
+ case AP4_ATOM_TYPE_CMVD:
+ atom = AP4_CmvdAtom::Create((unsigned long)size, stream, *this);
+ break;
+ // <== End patch MPC
+
+ default:
// try all the external type handlers
- {
- AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
- while(handler_item)
{
- TypeHandler* handler = handler_item->GetData();
- if(AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom)))
- {
- break;
+ AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
+ while (handler_item) {
+ TypeHandler* handler = handler_item->GetData();
+ if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {
+ break;
+ }
+ handler_item = handler_item->GetNext();
}
- handler_item = handler_item->GetNext();
- }
- break;
- }
+ break;
+ }
}
}
-
+
// if we failed to create an atom, use a generic version
- if(atom == NULL)
- {
+ if (atom == NULL) {
unsigned int payload_offset = 8;
- if(atom_is_large) payload_offset += 8;
- stream.Seek(start + payload_offset);
+ if (atom_is_large) payload_offset += 8;
+ stream.Seek(start+payload_offset);
atom = new AP4_UnknownAtom(type, size, stream);
}
// special case: if the atom is poorly encoded and has a 64-bit
// size header but an actual size that fits on 32-bit, adjust the
// object to reflect that.
- if(force_64)
- {
+ if (force_64) {
atom->SetSize32(1);
atom->SetSize64(size);
}
@@ -709,14 +681,13 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
bytes_available -= size;
// skip to the end of the atom
- result = stream.Seek(start + size);
- if(AP4_FAILED(result))
- {
+ result = stream.Seek(start+size);
+ if (AP4_FAILED(result)) {
delete atom;
atom = NULL;
return result;
}
-
+
return AP4_SUCCESS;
}
@@ -724,18 +695,17 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
| AP4_AtomFactory::CreateAtomsFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
+AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
AP4_AtomParent& atoms)
{
AP4_LargeSize stream_size = 0;
AP4_Position stream_position = 0;
AP4_LargeSize bytes_available = (AP4_LargeSize)(-1);
- if(AP4_SUCCEEDED(stream.GetSize(stream_size)) &&
- stream_size != 0 &&
- AP4_SUCCEEDED(stream.Tell(stream_position)) &&
- stream_position <= stream_size)
- {
- bytes_available = stream_size - stream_position;
+ if (AP4_SUCCEEDED(stream.GetSize(stream_size)) &&
+ stream_size != 0 &&
+ AP4_SUCCEEDED(stream.Tell(stream_position)) &&
+ stream_position <= stream_size) {
+ bytes_available = stream_size-stream_position;
}
return CreateAtomsFromStream(stream, bytes_available, atoms);
}
@@ -744,22 +714,19 @@ AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
| AP4_AtomFactory::CreateAtomsFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
+AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
AP4_LargeSize bytes_available,
AP4_AtomParent& atoms)
{
AP4_Result result;
- do
- {
+ do {
AP4_Atom* atom = NULL;
result = CreateAtomFromStream(stream, bytes_available, atom);
- if(AP4_SUCCEEDED(result) && atom != NULL)
- {
+ if (AP4_SUCCEEDED(result) && atom != NULL) {
atoms.AddChild(atom);
}
- }
- while(AP4_SUCCEEDED(result));
-
+ } while (AP4_SUCCEEDED(result));
+
return AP4_SUCCESS;
}
@@ -767,7 +734,7 @@ AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
| AP4_AtomFactory::PushContext
+---------------------------------------------------------------------*/
void
-AP4_AtomFactory::PushContext(AP4_Atom::Type context)
+AP4_AtomFactory::PushContext(AP4_Atom::Type context)
{
m_ContextStack.Append(context);
}
@@ -776,7 +743,7 @@ AP4_AtomFactory::PushContext(AP4_Atom::Type context)
| AP4_AtomFactory::PopContext
+---------------------------------------------------------------------*/
void
-AP4_AtomFactory::PopContext()
+AP4_AtomFactory::PopContext()
{
m_ContextStack.RemoveLast();
}
@@ -785,10 +752,10 @@ AP4_AtomFactory::PopContext()
| AP4_AtomFactory::GetContext
+---------------------------------------------------------------------*/
AP4_Atom::Type
-AP4_AtomFactory::GetContext(AP4_Ordinal depth)
+AP4_AtomFactory::GetContext(AP4_Ordinal depth)
{
AP4_Ordinal available = m_ContextStack.ItemCount();
- if(depth >= available) return 0;
+ if (depth >= available) return 0;
return m_ContextStack[available-depth-1];
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.h
index 8f2ac116a..3c7486a7c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomFactory.h
@@ -44,19 +44,17 @@ class AP4_ByteStream;
/*----------------------------------------------------------------------
| AP4_AtomFactory
+---------------------------------------------------------------------*/
-class AP4_AtomFactory
-{
-public:
+class AP4_AtomFactory {
+ public:
// types
- class TypeHandler
- {
- public:
- virtual ~TypeHandler() {};
- virtual AP4_Result CreateAtom(AP4_Atom::Type type,
- AP4_UI32 size,
- AP4_ByteStream& stream,
- AP4_Atom::Type context,
- AP4_Atom*& atom) = 0;
+ class TypeHandler {
+ public:
+ virtual ~TypeHandler() {};
+ virtual AP4_Result CreateAtom(AP4_Atom::Type type,
+ AP4_UI32 size,
+ AP4_ByteStream& stream,
+ AP4_Atom::Type context,
+ AP4_Atom*& atom) = 0;
};
// constructor
@@ -82,7 +80,7 @@ public:
// context
void PushContext(AP4_Atom::Type context);
void PopContext();
- AP4_Atom::Type GetContext(AP4_Ordinal depth = 0);
+ AP4_Atom::Type GetContext(AP4_Ordinal depth=0);
private:
// members
@@ -93,8 +91,7 @@ private:
/*----------------------------------------------------------------------
| AP4_DefaultAtomFactory
+---------------------------------------------------------------------*/
-class AP4_DefaultAtomFactory : public AP4_AtomFactory
-{
+class AP4_DefaultAtomFactory : public AP4_AtomFactory {
public:
// class members
static AP4_DefaultAtomFactory Instance;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp
index cd4eb4c7f..732ca2ef2 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp
@@ -49,8 +49,8 @@
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::AP4_AtomSampleTable
+---------------------------------------------------------------------*/
-AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
- AP4_ByteStream& sample_stream) :
+AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
+ AP4_ByteStream& sample_stream) :
m_SampleStream(sample_stream)
{
m_StscAtom = AP4_DYNAMIC_CAST(AP4_StscAtom, stbl->GetChild(AP4_ATOM_TYPE_STSC));
@@ -65,44 +65,44 @@ AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
// keep a reference to the sample stream
m_SampleStream.AddReference();
- // ==> Start patch MPC
- if(m_StsdAtom && m_StszAtom && m_StscAtom && m_SttsAtom
- && m_StszAtom->m_SampleSize == 1)
- {
- // fix mov files
- for(AP4_List<AP4_Atom>::Item* item = m_StsdAtom->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
- AP4_Atom* atom = item->GetData();
-
- if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
- {
- AP4_UI32 SamplesPerPacket = ase->GetSamplesPerPacket();
- AP4_UI32 BytesPerFrame = ase->GetBytesPerFrame();
-
- if(SamplesPerPacket > 0 && BytesPerFrame > 0)
- {
- for(int i = 0, j = m_StscAtom->m_Entries.ItemCount(); i < j; i++)
- {
- AP4_StscTableEntry& e = m_StscAtom->m_Entries[i];
- AP4_ASSERT(e.m_SamplesPerChunk % SamplesPerPacket == 0);
- e.m_SamplesPerChunk = e.m_SamplesPerChunk / SamplesPerPacket;
- e.m_FirstSample = (e.m_FirstSample - 1) / SamplesPerPacket + 1;
- }
-
- AP4_ASSERT(m_StszAtom->m_SampleCount % SamplesPerPacket == 0);
- m_StszAtom->m_SampleCount = m_StszAtom->m_SampleCount / SamplesPerPacket;
- m_StszAtom->m_SampleSize = BytesPerFrame;
-
- AP4_ASSERT(m_SttsAtom->m_Entries.ItemCount() == 1);
- m_SttsAtom->m_Entries[0].m_SampleCount = m_StszAtom->m_SampleCount;
- m_SttsAtom->m_Entries[0].m_SampleDuration = SamplesPerPacket;
- }
- }
- }
- }
- // <== End patch MPC
+ // ==> Start patch MPC
+ if(m_StsdAtom && m_StszAtom && m_StscAtom && m_SttsAtom
+ && m_StszAtom->m_SampleSize == 1)
+ {
+ // fix mov files
+ for(AP4_List<AP4_Atom>::Item* item = m_StsdAtom->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+
+ if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
+ {
+ AP4_UI32 SamplesPerPacket = ase->GetSamplesPerPacket();
+ AP4_UI32 BytesPerFrame = ase->GetBytesPerFrame();
+
+ if(SamplesPerPacket > 0 && BytesPerFrame > 0)
+ {
+ for(int i = 0, j = m_StscAtom->m_Entries.ItemCount(); i < j; i++)
+ {
+ AP4_StscTableEntry& e = m_StscAtom->m_Entries[i];
+ AP4_ASSERT(e.m_SamplesPerChunk % SamplesPerPacket == 0);
+ e.m_SamplesPerChunk = e.m_SamplesPerChunk / SamplesPerPacket;
+ e.m_FirstSample = (e.m_FirstSample-1) / SamplesPerPacket + 1;
+ }
+
+ AP4_ASSERT(m_StszAtom->m_SampleCount % SamplesPerPacket == 0);
+ m_StszAtom->m_SampleCount = m_StszAtom->m_SampleCount / SamplesPerPacket;
+ m_StszAtom->m_SampleSize = BytesPerFrame;
+
+ AP4_ASSERT(m_SttsAtom->m_Entries.ItemCount() == 1);
+ m_SttsAtom->m_Entries[0].m_SampleCount = m_StszAtom->m_SampleCount;
+ m_SttsAtom->m_Entries[0].m_SampleDuration = SamplesPerPacket;
+ }
+ }
+ }
+ }
+ // <== End patch MPC
}
@@ -118,14 +118,13 @@ AP4_AtomSampleTable::~AP4_AtomSampleTable()
| AP4_AtomSampleTable::GetSample
+---------------------------------------------------------------------*/
AP4_Result
-AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
+AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
AP4_Sample& sample)
{
AP4_Result result;
// check that we have a chunk offset table
- if(m_StcoAtom == NULL && m_Co64Atom == NULL)
- {
+ if (m_StcoAtom == NULL && m_Co64Atom == NULL) {
return AP4_ERROR_INVALID_FORMAT;
}
@@ -135,69 +134,59 @@ AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
// find out in which chunk this sample is located
AP4_Ordinal chunk, skip, desc;
result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// check that the result is within bounds
- if(skip > index) return AP4_ERROR_INTERNAL;
+ if (skip > index) return AP4_ERROR_INTERNAL;
// get the atom offset for this chunk
AP4_UI64 offset;
- if(m_StcoAtom)
- {
+ if (m_StcoAtom) {
AP4_UI32 offset_32;
result = m_StcoAtom->GetChunkOffset(chunk, offset_32);
offset = offset_32;
- }
- else
- {
+ } else {
result = m_Co64Atom->GetChunkOffset(chunk, offset);
}
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// compute the additional offset inside the chunk
- for(unsigned int i = index - skip; i < index; i++)
- {
+ for (unsigned int i = index-skip; i < index; i++) {
AP4_Size size;
- result = m_StszAtom->GetSampleSize(i, size);
- if(AP4_FAILED(result)) return result;
+ result = m_StszAtom->GetSampleSize(i, size);
+ if (AP4_FAILED(result)) return result;
offset += size;
}
// set the description index
- sample.SetDescriptionIndex(desc - 1); // adjust for 0-based indexes
+ sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes
// set the dts and cts
AP4_UI32 cts_offset = 0;
AP4_UI64 dts = 0;
AP4_UI32 duration = 0;
result = m_SttsAtom->GetDts(index, dts, &duration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
sample.SetDuration(duration);
sample.SetDts(dts);
- if(m_CttsAtom == NULL)
- {
+ if (m_CttsAtom == NULL) {
sample.SetCts(dts);
- }
- else
- {
- result = m_CttsAtom->GetCtsOffset(index, cts_offset);
- if(AP4_FAILED(result)) return result;
+ } else {
+ result = m_CttsAtom->GetCtsOffset(index, cts_offset);
+ if (AP4_FAILED(result)) return result;
sample.SetCtsDelta(cts_offset);
- }
+ }
// set the size
AP4_Size sample_size;
result = m_StszAtom->GetSampleSize(index, sample_size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
sample.SetSize(sample_size);
// set the sync flag
- if(m_StssAtom == NULL)
- {
+ if (m_StssAtom == NULL) {
sample.SetSync(true);
- }
- else
- {
+ } else {
sample.SetSync(m_StssAtom->IsSampleSync(index));
}
@@ -241,26 +230,26 @@ AP4_AtomSampleTable::GetSampleDescriptionCount()
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSampleChunkPosition
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_AtomSampleTable::GetSampleChunkPosition(AP4_Ordinal sample_index,
- AP4_Ordinal& chunk_index,
- AP4_Ordinal& position_in_chunk)
+AP4_Result
+AP4_AtomSampleTable::GetSampleChunkPosition(AP4_Ordinal sample_index,
+ AP4_Ordinal& chunk_index,
+ AP4_Ordinal& position_in_chunk)
{
// default values
chunk_index = 0;
position_in_chunk = 0;
-
+
AP4_Ordinal sample_description_index;
- return GetChunkForSample(sample_index,
- chunk_index,
- position_in_chunk,
+ return GetChunkForSample(sample_index,
+ chunk_index,
+ position_in_chunk,
sample_description_index);
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetChunkForSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_AtomSampleTable::GetChunkForSample(AP4_Ordinal sample_index,
AP4_Ordinal& chunk_index,
AP4_Ordinal& position_in_chunk,
@@ -272,50 +261,42 @@ AP4_AtomSampleTable::GetChunkForSample(AP4_Ordinal sample_index,
sample_description_index = 0;
// check that we an stsc atom
- if(m_StscAtom == NULL) return AP4_ERROR_INVALID_STATE;
-
+ if (m_StscAtom == NULL) return AP4_ERROR_INVALID_STATE;
+
// get the chunk info from the stsc atom
AP4_Ordinal chunk = 0;
- AP4_Result result = m_StscAtom->GetChunkForSample(sample_index + 1, // the atom API is 1-based
- chunk,
- position_in_chunk,
- sample_description_index);
- if(AP4_FAILED(result)) return result;
- if(chunk == 0) return AP4_ERROR_INTERNAL;
+ AP4_Result result = m_StscAtom->GetChunkForSample(sample_index+1, // the atom API is 1-based
+ chunk,
+ position_in_chunk,
+ sample_description_index);
+ if (AP4_FAILED(result)) return result;
+ if (chunk == 0) return AP4_ERROR_INTERNAL;
// the atom sample and chunk indexes are 1-based, so we need to translate
- chunk_index = chunk - 1;
-
+ chunk_index = chunk-1;
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetChunkOffset
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk_index,
+AP4_Result
+AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk_index,
AP4_Position& offset)
{
- if(m_StcoAtom)
- {
+ if (m_StcoAtom) {
AP4_UI32 offset_32;
- AP4_Result result = m_StcoAtom->GetChunkOffset(chunk_index + 1, offset_32);
- if(AP4_SUCCEEDED(result))
- {
+ AP4_Result result = m_StcoAtom->GetChunkOffset(chunk_index+1, offset_32);
+ if (AP4_SUCCEEDED(result)) {
offset = offset_32;
- }
- else
- {
+ } else {
offset = 0;
}
return result;
- }
- else if(m_Co64Atom)
- {
- return m_Co64Atom->GetChunkOffset(chunk_index + 1, offset);
- }
- else
- {
+ } else if (m_Co64Atom) {
+ return m_Co64Atom->GetChunkOffset(chunk_index+1, offset);
+ } else {
offset = 0;
return AP4_FAILURE;
}
@@ -324,21 +305,16 @@ AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk_index,
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::SetChunkOffset
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk_index,
+AP4_Result
+AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk_index,
AP4_Position offset)
{
- if(m_StcoAtom)
- {
- if((offset >> 32) != 0) return AP4_ERROR_OUT_OF_RANGE;
- return m_StcoAtom->SetChunkOffset(chunk_index + 1, (AP4_UI32)offset);
- }
- else if(m_Co64Atom)
- {
- return m_Co64Atom->SetChunkOffset(chunk_index + 1, offset);
- }
- else
- {
+ if (m_StcoAtom) {
+ if ((offset >> 32) != 0) return AP4_ERROR_OUT_OF_RANGE;
+ return m_StcoAtom->SetChunkOffset(chunk_index+1, (AP4_UI32)offset);
+ } else if (m_Co64Atom) {
+ return m_Co64Atom->SetChunkOffset(chunk_index+1, offset);
+ } else {
return AP4_FAILURE;
}
}
@@ -346,53 +322,47 @@ AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk_index,
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::SetSampleSize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_AtomSampleTable::SetSampleSize(AP4_Ordinal sample_index, AP4_Size size)
{
- return m_StszAtom ? m_StszAtom->SetSampleSize(sample_index + 1, size) : AP4_FAILURE;
+ return m_StszAtom ? m_StszAtom->SetSampleSize(sample_index+1, size) : AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSampleIndexForTimeStamp
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_AtomSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 ts,
- AP4_Ordinal& sample_index)
+AP4_Result
+AP4_AtomSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 ts,
+ AP4_Ordinal& sample_index)
{
- return m_SttsAtom ? m_SttsAtom->GetSampleIndexForTimeStamp(ts, sample_index)
- : AP4_FAILURE;
+ return m_SttsAtom ? m_SttsAtom->GetSampleIndexForTimeStamp(ts, sample_index)
+ : AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetNearestSyncSampleIndex
+---------------------------------------------------------------------*/
-AP4_Ordinal
+AP4_Ordinal
AP4_AtomSampleTable::GetNearestSyncSampleIndex(AP4_Ordinal sample_index, bool before)
{
// if we don't have an stss table, all samples match
- if(m_StssAtom == NULL) return sample_index;
-
+ if (m_StssAtom == NULL) return sample_index;
+
sample_index += 1; // the table is 1-based
AP4_Cardinal entry_count = m_StssAtom->GetEntries().ItemCount();
- if(before)
- {
- AP4_Ordinal cursor = 0;
- for(unsigned int i = 0; i < entry_count; i++)
- {
- if(m_StssAtom->GetEntries()[i] >= sample_index) return cursor;
- if(m_StssAtom->GetEntries()[i]) cursor = m_StssAtom->GetEntries()[i] - 1;
+ if (before) {
+ AP4_Ordinal cursor = 0;
+ for (unsigned int i=0; i<entry_count; i++) {
+ if (m_StssAtom->GetEntries()[i] >= sample_index) return cursor;
+ if (m_StssAtom->GetEntries()[i]) cursor = m_StssAtom->GetEntries()[i]-1;
}
// not found?
return cursor;
- }
- else
- {
- for(unsigned int i = 0; i < entry_count; i++)
- {
- if(m_StssAtom->GetEntries()[i] >= sample_index)
- {
- return m_StssAtom->GetEntries()[i] ? m_StssAtom->GetEntries()[i] - 1 : sample_index - 1;
+ } else {
+ for (unsigned int i=0; i<entry_count; i++) {
+ if (m_StssAtom->GetEntries()[i] >= sample_index) {
+ return m_StssAtom->GetEntries()[i]?m_StssAtom->GetEntries()[i]-1:sample_index-1;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.h
index e90bd9cc1..aaecbf917 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AtomSampleTable.h
@@ -54,10 +54,10 @@ class AP4_Co64Atom;
+---------------------------------------------------------------------*/
class AP4_AtomSampleTable : public AP4_SampleTable
{
-public:
+ public:
// methods
- AP4_AtomSampleTable(AP4_ContainerAtom* stbl_atom,
- AP4_ByteStream& sample_stream);
+ AP4_AtomSampleTable(AP4_ContainerAtom* stbl_atom,
+ AP4_ByteStream& sample_stream);
virtual ~AP4_AtomSampleTable();
// AP4_SampleTable methods
@@ -65,11 +65,11 @@ public:
virtual AP4_Cardinal GetSampleCount();
virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal sd_index);
virtual AP4_Cardinal GetSampleDescriptionCount();
- virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
- AP4_Ordinal& chunk_index,
- AP4_Ordinal& position_in_chunk);
+ virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
+ AP4_Ordinal& chunk_index,
+ AP4_Ordinal& position_in_chunk);
virtual AP4_Result GetSampleIndexForTimeStamp(AP4_UI64 ts, AP4_Ordinal& sample_index);
- virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before = true);
+ virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before=true);
// local methods
virtual AP4_Result GetChunkForSample(AP4_Ordinal sample_index,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.cpp
index bca60cfe2..ac227203d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - avcC Atoms
+| AP4 - avcC Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,22 +45,14 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_AvccAtom)
const char*
AP4_AvccAtom::GetProfileName(AP4_UI08 profile)
{
- switch(profile)
- {
- case AP4_AVC_PROFILE_BASELINE:
- return "Baseline";
- case AP4_AVC_PROFILE_MAIN:
- return "Main";
- case AP4_AVC_PROFILE_EXTENDED:
- return "Extended";
- case AP4_AVC_PROFILE_HIGH:
- return "High";
- case AP4_AVC_PROFILE_HIGH_10:
- return "High 10";
- case AP4_AVC_PROFILE_HIGH_422:
- return "High 4:2:2";
- case AP4_AVC_PROFILE_HIGH_444:
- return "High 4:4:4";
+ switch (profile) {
+ case AP4_AVC_PROFILE_BASELINE: return "Baseline";
+ case AP4_AVC_PROFILE_MAIN: return "Main";
+ case AP4_AVC_PROFILE_EXTENDED: return "Extended";
+ case AP4_AVC_PROFILE_HIGH: return "High";
+ case AP4_AVC_PROFILE_HIGH_10: return "High 10";
+ case AP4_AVC_PROFILE_HIGH_422: return "High 4:2:2";
+ case AP4_AVC_PROFILE_HIGH_444: return "High 4:4:4";
}
return NULL;
@@ -69,39 +61,36 @@ AP4_AvccAtom::GetProfileName(AP4_UI08 profile)
/*----------------------------------------------------------------------
| AP4_AvccAtom::Create
+---------------------------------------------------------------------*/
-AP4_AvccAtom*
+AP4_AvccAtom*
AP4_AvccAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
// read the raw bytes in a buffer
- unsigned int payload_size = size - AP4_ATOM_HEADER_SIZE;
+ unsigned int payload_size = size-AP4_ATOM_HEADER_SIZE;
AP4_DataBuffer payload_data(payload_size);
AP4_Result result = stream.Read(payload_data.UseData(), payload_size);
- if(AP4_FAILED(result)) return NULL;
-
+ if (AP4_FAILED(result)) return NULL;
+
// check the version
const AP4_UI08* payload = payload_data.GetData();
- if(payload[0] != 1)
- {
+ if (payload[0] != 1) {
return NULL;
}
// check the size
- if(payload_size < 6) return NULL;
- unsigned int num_seq_params = payload[5] & 31;
+ if (payload_size < 6) return NULL;
+ unsigned int num_seq_params = payload[5]&31;
unsigned int cursor = 6;
- for(unsigned int i = 0; i < num_seq_params; i++)
- {
- if(cursor + 2 > payload_size) return NULL;
- cursor += 2 + AP4_BytesToInt16BE(&payload[cursor]);
- if(cursor > payload_size) return NULL;
+ for (unsigned int i=0; i<num_seq_params; i++) {
+ if (cursor+2 > payload_size) return NULL;
+ cursor += 2+AP4_BytesToInt16BE(&payload[cursor]);
+ if (cursor > payload_size) return NULL;
}
unsigned int num_pic_params = payload[cursor++];
- if(cursor > payload_size) return NULL;
- for(unsigned int i = 0; i < num_pic_params; i++)
- {
- if(cursor + 2 > payload_size) return NULL;
- cursor += 2 + AP4_BytesToInt16BE(&payload[cursor]);
- if(cursor > payload_size) return NULL;
+ if (cursor > payload_size) return NULL;
+ for (unsigned int i=0; i<num_pic_params; i++) {
+ if (cursor+2 > payload_size) return NULL;
+ cursor += 2+AP4_BytesToInt16BE(&payload[cursor]);
+ if (cursor > payload_size) return NULL;
}
return new AP4_AvccAtom(size, payload);
}
@@ -135,14 +124,12 @@ AP4_AvccAtom::AP4_AvccAtom(const AP4_AvccAtom& other) :
{
// deep copy of the parameters
unsigned int i = 0;
- for(i = 0; i < other.m_SequenceParameters.ItemCount(); i++)
- {
+ for (i=0; i<other.m_SequenceParameters.ItemCount(); i++) {
m_SequenceParameters.Append(other.m_SequenceParameters[i]);
}
- for(i = 0; i < other.m_PictureParameters.ItemCount(); i++)
- {
+ for (i=0; i<other.m_PictureParameters.ItemCount(); i++) {
m_PictureParameters.Append(other.m_PictureParameters[i]);
- }
+ }
}
/*----------------------------------------------------------------------
@@ -152,7 +139,7 @@ AP4_AvccAtom::AP4_AvccAtom(AP4_UI32 size, const AP4_UI08* payload) :
AP4_Atom(AP4_ATOM_TYPE_AVCC, size)
{
// make a copy of our configuration bytes
- unsigned int payload_size = size - AP4_ATOM_HEADER_SIZE;
+ unsigned int payload_size = size-AP4_ATOM_HEADER_SIZE;
m_RawBytes.SetData(payload, payload_size);
// parse the payload
@@ -160,25 +147,23 @@ AP4_AvccAtom::AP4_AvccAtom(AP4_UI32 size, const AP4_UI08* payload) :
m_Profile = payload[1];
m_ProfileCompatibility = payload[2];
m_Level = payload[3];
- m_NaluLengthSize = 1 + (payload[4] & 3);
- AP4_UI08 num_seq_params = payload[5] & 31;
+ m_NaluLengthSize = 1+(payload[4]&3);
+ AP4_UI08 num_seq_params = payload[5]&31;
m_SequenceParameters.EnsureCapacity(num_seq_params);
unsigned int cursor = 6;
- for(unsigned int i = 0; i < num_seq_params; i++)
- {
+ for (unsigned int i=0; i<num_seq_params; i++) {
m_SequenceParameters.Append(AP4_DataBuffer());
AP4_UI16 param_length = AP4_BytesToInt16BE(&payload[cursor]);
- m_SequenceParameters[i].SetData(&payload[cursor] + 2, param_length);
- cursor += 2 + param_length;
+ m_SequenceParameters[i].SetData(&payload[cursor]+2, param_length);
+ cursor += 2+param_length;
}
AP4_UI08 num_pic_params = payload[cursor++];
m_PictureParameters.EnsureCapacity(num_pic_params);
- for(unsigned int i = 0; i < num_pic_params; i++)
- {
+ for (unsigned int i=0; i<num_pic_params; i++) {
m_PictureParameters.Append(AP4_DataBuffer());
AP4_UI16 param_length = AP4_BytesToInt16BE(&payload[cursor]);
- m_PictureParameters[i].SetData(&payload[cursor] + 2, param_length);
- cursor += 2 + param_length;
+ m_PictureParameters[i].SetData(&payload[cursor]+2, param_length);
+ cursor += 2+param_length;
}
}
@@ -186,11 +171,11 @@ AP4_AvccAtom::AP4_AvccAtom(AP4_UI32 size, const AP4_UI08* payload) :
/*----------------------------------------------------------------------
| AP4_AvccAtom::AP4_AvccAtom
+---------------------------------------------------------------------*/
-AP4_AvccAtom::AP4_AvccAtom(AP4_UI08 profile,
- AP4_UI08 level,
- AP4_UI08 profile_compatibility,
- AP4_UI08 length_size,
- const AP4_Array<AP4_DataBuffer>& sequence_parameters,
+AP4_AvccAtom::AP4_AvccAtom(AP4_UI08 profile,
+ AP4_UI08 level,
+ AP4_UI08 profile_compatibility,
+ AP4_UI08 length_size,
+ const AP4_Array<AP4_DataBuffer>& sequence_parameters,
const AP4_Array<AP4_DataBuffer>& picture_parameters) :
AP4_Atom(AP4_ATOM_TYPE_AVCC, AP4_ATOM_HEADER_SIZE),
m_ConfigurationVersion(1),
@@ -201,14 +186,12 @@ AP4_AvccAtom::AP4_AvccAtom(AP4_UI08 profile,
{
// deep copy of the parameters
unsigned int i = 0;
- for(i = 0; i < sequence_parameters.ItemCount(); i++)
- {
+ for (i=0; i<sequence_parameters.ItemCount(); i++) {
m_SequenceParameters.Append(sequence_parameters[i]);
}
- for(i = 0; i < picture_parameters.ItemCount(); i++)
- {
+ for (i=0; i<picture_parameters.ItemCount(); i++) {
m_PictureParameters.Append(picture_parameters[i]);
- }
+ }
// compute the raw bytes
UpdateRawBytes();
@@ -224,15 +207,13 @@ void
AP4_AvccAtom::UpdateRawBytes()
{
// compute the payload size
- unsigned int payload_size = 6;
- for(unsigned int i = 0; i < m_SequenceParameters.ItemCount(); i++)
- {
- payload_size += 2 + m_SequenceParameters[i].GetDataSize();
+ unsigned int payload_size = 6;
+ for (unsigned int i=0; i<m_SequenceParameters.ItemCount(); i++) {
+ payload_size += 2+m_SequenceParameters[i].GetDataSize();
}
++payload_size;
- for(unsigned int i = 0; i < m_PictureParameters.ItemCount(); i++)
- {
- payload_size += 2 + m_PictureParameters[i].GetDataSize();
+ for (unsigned int i=0; i<m_PictureParameters.ItemCount(); i++) {
+ payload_size += 2+m_PictureParameters[i].GetDataSize();
}
m_RawBytes.SetDataSize(payload_size);
AP4_UI08* payload = m_RawBytes.UseData();
@@ -241,11 +222,10 @@ AP4_AvccAtom::UpdateRawBytes()
payload[1] = m_Profile;
payload[2] = m_ProfileCompatibility;
payload[3] = m_Level;
- payload[4] = 0xFC | (m_NaluLengthSize - 1);
+ payload[4] = 0xFC | (m_NaluLengthSize-1);
payload[5] = 0xE0 | m_SequenceParameters.ItemCount();
unsigned int cursor = 6;
- for(unsigned int i = 0; i < m_SequenceParameters.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_SequenceParameters.ItemCount(); i++) {
AP4_UI16 param_length = (AP4_UI16)m_SequenceParameters[i].GetDataSize();
AP4_BytesFromUInt16BE(&payload[cursor], param_length);
cursor += 2;
@@ -253,8 +233,7 @@ AP4_AvccAtom::UpdateRawBytes()
cursor += param_length;
}
payload[cursor++] = m_PictureParameters.ItemCount();
- for(unsigned int i = 0; i < m_PictureParameters.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_PictureParameters.ItemCount(); i++) {
AP4_UI16 param_length = (AP4_UI16)m_PictureParameters[i].GetDataSize();
AP4_BytesFromUInt16BE(&payload[cursor], param_length);
cursor += 2;
@@ -280,23 +259,18 @@ AP4_AvccAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("Configuration Version", m_ConfigurationVersion);
const char* profile_name = GetProfileName(m_Profile);
- if(profile_name)
- {
+ if (profile_name) {
inspector.AddField("Profile", profile_name);
- }
- else
- {
+ } else {
inspector.AddField("Profile", m_Profile);
}
inspector.AddField("Profile Compatibility", m_ProfileCompatibility, AP4_AtomInspector::HINT_HEX);
inspector.AddField("Level", m_Level);
inspector.AddField("NALU Length Size", m_NaluLengthSize);
- for(unsigned int i = 0; i < m_SequenceParameters.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_SequenceParameters.ItemCount(); i++) {
inspector.AddField("Sequence Parameter", m_SequenceParameters[i].GetData(), m_SequenceParameters[i].GetDataSize());
}
- for(unsigned int i = 0; i < m_SequenceParameters.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_SequenceParameters.ItemCount(); i++) {
inspector.AddField("Picture Parameter", m_PictureParameters[i].GetData(), m_PictureParameters[i].GetDataSize());
}
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.h
index c2c790759..b3b300853 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4AvcCAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - avcC Atoms
+| AP4 - avcC Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -68,50 +68,26 @@ public:
const AP4_Array<AP4_DataBuffer>& sequence_parameters,
const AP4_Array<AP4_DataBuffer>& picture_parameters);
AP4_AvccAtom(const AP4_AvccAtom& other); // copy construtor
-
+
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI08 GetConfigurationVersion() const
- {
- return m_ConfigurationVersion;
- }
- AP4_UI08 GetProfile() const
- {
- return m_Profile;
- }
- AP4_UI08 GetLevel() const
- {
- return m_Level;
- }
- AP4_UI08 GetProfileCompatibility() const
- {
- return m_ProfileCompatibility;
- }
- AP4_UI08 GetNaluLengthSize() const
- {
- return m_NaluLengthSize;
- }
- AP4_Array<AP4_DataBuffer>& GetSequenceParameters()
- {
- return m_SequenceParameters;
- }
- AP4_Array<AP4_DataBuffer>& GetPictureParameters()
- {
- return m_PictureParameters;
- }
- const AP4_DataBuffer& GetRawBytes() const
- {
- return m_RawBytes;
- }
+ AP4_UI08 GetConfigurationVersion() const { return m_ConfigurationVersion; }
+ AP4_UI08 GetProfile() const { return m_Profile; }
+ AP4_UI08 GetLevel() const { return m_Level; }
+ AP4_UI08 GetProfileCompatibility() const { return m_ProfileCompatibility; }
+ AP4_UI08 GetNaluLengthSize() const { return m_NaluLengthSize; }
+ AP4_Array<AP4_DataBuffer>& GetSequenceParameters() { return m_SequenceParameters; }
+ AP4_Array<AP4_DataBuffer>& GetPictureParameters() { return m_PictureParameters; }
+ const AP4_DataBuffer& GetRawBytes() const { return m_RawBytes; }
private:
// methods
AP4_AvccAtom(AP4_UI32 size, const AP4_UI08* payload);
void UpdateRawBytes();
-
+
// members
AP4_UI08 m_ConfigurationVersion;
AP4_UI08 m_Profile;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.cpp
index 462eaf88a..e5c33d319 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.cpp
@@ -22,7 +22,7 @@
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-| 02111-1307, USA.
+| 02111-1307, USA.
|
****************************************************************/
@@ -46,22 +46,21 @@ AP4_Result
AP4_ByteStream::Read(void* buffer, AP4_Size bytes_to_read)
{
// shortcut
- if(bytes_to_read == 0) return AP4_SUCCESS;
-
+ if (bytes_to_read == 0) return AP4_SUCCESS;
+
// read until failure
AP4_Size bytes_read;
- while(bytes_to_read)
- {
+ while (bytes_to_read) {
AP4_Result result = ReadPartial(buffer, bytes_to_read, bytes_read);
- if(AP4_FAILED(result)) return result;
- if(bytes_read == 0) return AP4_ERROR_INTERNAL;
+ if (AP4_FAILED(result)) return result;
+ if (bytes_read == 0) return AP4_ERROR_INTERNAL;
AP4_ASSERT(bytes_read <= bytes_to_read);
bytes_to_read -= bytes_read;
- buffer = (void*)(((AP4_Byte*)buffer) + bytes_read);
+ buffer = (void*)(((AP4_Byte*)buffer)+bytes_read);
}
-
+
return AP4_SUCCESS;
-}
+}
/*----------------------------------------------------------------------
| AP4_Stream::Write
@@ -70,20 +69,19 @@ AP4_Result
AP4_ByteStream::Write(const void* buffer, AP4_Size bytes_to_write)
{
// shortcut
- if(bytes_to_write == 0) return AP4_SUCCESS;
-
+ if (bytes_to_write == 0) return AP4_SUCCESS;
+
// write until failure
AP4_Size bytes_written;
- while(bytes_to_write)
- {
+ while (bytes_to_write) {
AP4_Result result = WritePartial(buffer, bytes_to_write, bytes_written);
- if(AP4_FAILED(result)) return result;
- if(bytes_written == 0) return AP4_ERROR_INTERNAL;
+ if (AP4_FAILED(result)) return result;
+ if (bytes_written == 0) return AP4_ERROR_INTERNAL;
AP4_ASSERT(bytes_written <= bytes_to_write);
bytes_to_write -= bytes_written;
- buffer = (const void*)(((const AP4_Byte*)buffer) + bytes_written);
+ buffer = (const void*)(((const AP4_Byte*)buffer)+bytes_written);
}
-
+
return AP4_SUCCESS;
}
@@ -96,7 +94,7 @@ AP4_ByteStream::WriteString(const char* buffer)
AP4_Size string_length = static_cast<AP4_Size>(strlen(buffer));
// shortcut
- if((buffer == NULL) || (string_length == 0)) return AP4_SUCCESS;
+ if ((buffer == NULL) || (string_length == 0)) return AP4_SUCCESS;
// write the string
return Write((const void*)buffer, string_length);
@@ -197,15 +195,14 @@ AP4_ByteStream::ReadUI64(AP4_UI64& value)
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 8);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt64BE(buffer);
-
+
return AP4_SUCCESS;
}
@@ -220,15 +217,14 @@ AP4_ByteStream::ReadDouble(double& value)
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 8);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToDoubleBE(buffer);
-
+
return AP4_SUCCESS;
}
@@ -243,15 +239,14 @@ AP4_ByteStream::ReadUI32(AP4_UI32& value)
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 4);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt32BE(buffer);
-
+
return AP4_SUCCESS;
}
@@ -266,15 +261,14 @@ AP4_ByteStream::ReadUI24(AP4_UI32& value)
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 3);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt24BE(buffer);
-
+
return AP4_SUCCESS;
}
@@ -289,15 +283,14 @@ AP4_ByteStream::ReadUI16(AP4_UI16& value)
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 2);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt16BE(buffer);
-
+
return AP4_SUCCESS;
}
@@ -312,15 +305,14 @@ AP4_ByteStream::ReadUI08(AP4_UI08& value)
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 1);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = buffer[0];
-
+
return AP4_SUCCESS;
}
@@ -330,23 +322,19 @@ AP4_ByteStream::ReadUI08(AP4_UI08& value)
AP4_Result
AP4_ByteStream::ReadString(char* buffer, AP4_Size size)
{
- if(buffer == NULL || size == 0)
- {
+ if (buffer == NULL || size == 0) {
return AP4_ERROR_INVALID_PARAMETERS;
}
AP4_Size bytes_read = 0;
- while(bytes_read < size - 1)
- {
+ while (bytes_read < size-1) {
AP4_Result result;
result = Read(&buffer[bytes_read], 1);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
buffer[bytes_read] = '\0';
return result;
}
- if(buffer[bytes_read] == '\0')
- {
+ if (buffer[bytes_read] == '\0') {
// end of string
return AP4_SUCCESS;
}
@@ -365,31 +353,26 @@ AP4_Result
AP4_ByteStream::CopyTo(AP4_ByteStream& stream, AP4_LargeSize size)
{
unsigned char buffer[AP4_BYTE_STREAM_COPY_BUFFER_SIZE];
- while(size)
- {
+ while (size) {
AP4_Size bytes_read;
AP4_Size bytes_to_read;
AP4_Result result;
// decide how much to read
- if(size >= sizeof(buffer))
- {
+ if (size >= sizeof(buffer)) {
bytes_to_read = sizeof(buffer);
- }
- else
- {
+ } else {
bytes_to_read = (AP4_Size)size;
}
// read up to one buffer full
result = ReadPartial(buffer, bytes_to_read, bytes_read);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// copy to destination
- if(bytes_read != 0)
- {
+ if (bytes_read != 0) {
result = stream.Write(buffer, bytes_read);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// update the size
@@ -402,8 +385,8 @@ AP4_ByteStream::CopyTo(AP4_ByteStream& stream, AP4_LargeSize size)
/*----------------------------------------------------------------------
| AP4_SubStream::AP4_SubStream
+---------------------------------------------------------------------*/
-AP4_SubStream::AP4_SubStream(AP4_ByteStream& container,
- AP4_Position offset,
+AP4_SubStream::AP4_SubStream(AP4_ByteStream& container,
+ AP4_Position offset,
AP4_LargeSize size) :
m_Container(container),
m_Offset(offset),
@@ -425,44 +408,39 @@ AP4_SubStream::~AP4_SubStream()
/*----------------------------------------------------------------------
| AP4_SubStream::ReadPartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_SubStream::ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+AP4_Result
+AP4_SubStream::ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read)
{
// default values
bytes_read = 0;
// shortcut
- if(bytes_to_read == 0)
- {
+ if (bytes_to_read == 0) {
return AP4_SUCCESS;
}
// clamp to range
- if(m_Position + bytes_to_read > m_Size)
- {
+ if (m_Position+bytes_to_read > m_Size) {
bytes_to_read = (AP4_Size)(m_Size - m_Position);
}
// check for end of substream
- if(bytes_to_read == 0)
- {
+ if (bytes_to_read == 0) {
return AP4_ERROR_EOS;
}
// seek inside container
AP4_Result result;
- result = m_Container.Seek(m_Offset + m_Position);
- if(AP4_FAILED(result))
- {
+ result = m_Container.Seek(m_Offset+m_Position);
+ if (AP4_FAILED(result)) {
return result;
}
// read from the container
result = m_Container.ReadPartial(buffer, bytes_to_read, bytes_read);
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
m_Position += bytes_read;
}
return result;
@@ -471,41 +449,37 @@ AP4_SubStream::ReadPartial(void* buffer,
/*----------------------------------------------------------------------
| AP4_SubStream::WritePartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_SubStream::WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+AP4_Result
+AP4_SubStream::WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written)
{
// default values
bytes_written = 0;
// shortcut
- if(bytes_to_write == 0)
- {
+ if (bytes_to_write == 0) {
return AP4_SUCCESS;
}
// clamp to range
- if(m_Position + bytes_to_write > m_Size)
- {
+ if (m_Position+bytes_to_write > m_Size) {
bytes_to_write = (AP4_Size)(m_Size - m_Position);
}
// check for en of substream
- if(bytes_to_write == 0)
- {
+ if (bytes_to_write == 0) {
return AP4_ERROR_EOS;
}
// seek inside container
AP4_Result result;
- result = m_Container.Seek(m_Offset + m_Position);
- if(AP4_FAILED(result)) return result;
+ result = m_Container.Seek(m_Offset+m_Position);
+ if (AP4_FAILED(result)) return result;
// write to container
result = m_Container.WritePartial(buffer, bytes_to_write, bytes_written);
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
m_Position += bytes_written;
}
return result;
@@ -514,11 +488,11 @@ AP4_SubStream::WritePartial(const void* buffer,
/*----------------------------------------------------------------------
| AP4_SubStream::Seek
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_SubStream::Seek(AP4_Position position)
{
- if(position == m_Position) return AP4_SUCCESS;
- if(position > m_Size) return AP4_FAILURE;
+ if (position == m_Position) return AP4_SUCCESS;
+ if (position > m_Size) return AP4_FAILURE;
m_Position = position;
return AP4_SUCCESS;
}
@@ -538,8 +512,7 @@ AP4_SubStream::AddReference()
void
AP4_SubStream::Release()
{
- if(--m_ReferenceCount == 0)
- {
+ if (--m_ReferenceCount == 0) {
delete this;
}
}
@@ -584,8 +557,7 @@ AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_DataBuffer& data_buffer) :
+---------------------------------------------------------------------*/
AP4_MemoryByteStream::~AP4_MemoryByteStream()
{
- if(m_BufferIsLocal)
- {
+ if (m_BufferIsLocal) {
delete m_Buffer;
}
}
@@ -593,34 +565,31 @@ AP4_MemoryByteStream::~AP4_MemoryByteStream()
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::ReadPartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_MemoryByteStream::ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+AP4_Result
+AP4_MemoryByteStream::ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read)
{
// default values
bytes_read = 0;
// shortcut
- if(bytes_to_read == 0)
- {
+ if (bytes_to_read == 0) {
return AP4_SUCCESS;
}
// clamp to range
- if(m_Position + bytes_to_read > m_Buffer->GetDataSize())
- {
+ if (m_Position+bytes_to_read > m_Buffer->GetDataSize()) {
bytes_to_read = (AP4_Size)(m_Buffer->GetDataSize() - m_Position);
}
// check for end of stream
- if(bytes_to_read == 0)
- {
+ if (bytes_to_read == 0) {
return AP4_ERROR_EOS;
}
// read from the memory
- AP4_CopyMemory(buffer, m_Buffer->GetData() + m_Position, bytes_to_read);
+ AP4_CopyMemory(buffer, m_Buffer->GetData()+m_Position, bytes_to_read);
m_Position += bytes_to_read;
bytes_read = bytes_to_read;
@@ -631,50 +600,43 @@ AP4_MemoryByteStream::ReadPartial(void* buffer,
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::WritePartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_MemoryByteStream::WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+AP4_Result
+AP4_MemoryByteStream::WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written)
{
// default values
bytes_written = 0;
// shortcut
- if(bytes_to_write == 0)
- {
+ if (bytes_to_write == 0) {
return AP4_SUCCESS;
}
// check that we don't exceed the max
- if(m_Position + bytes_to_write > (AP4_Position)AP4_MEMORY_BYTE_STREAM_MAX_SIZE)
- {
+ if (m_Position+bytes_to_write > (AP4_Position)AP4_MEMORY_BYTE_STREAM_MAX_SIZE) {
return AP4_ERROR_OUT_OF_RANGE;
}
// reserve space in the buffer
- AP4_Result result = m_Buffer->Reserve((AP4_Size)(m_Position + bytes_to_write));
- if(AP4_SUCCEEDED(result))
- {
- m_Buffer->SetDataSize((AP4_Size)(m_Position + bytes_to_write));
- }
- else
- {
+ AP4_Result result = m_Buffer->Reserve((AP4_Size)(m_Position+bytes_to_write));
+ if (AP4_SUCCEEDED(result)) {
+ m_Buffer->SetDataSize((AP4_Size)(m_Position+bytes_to_write));
+ } else {
// failed to reserve, most likely caused by a buffer that has
// external storage
- if(m_Position + bytes_to_write > m_Buffer->GetDataSize())
- {
+ if (m_Position+bytes_to_write > m_Buffer->GetDataSize()) {
bytes_to_write = (AP4_Size)(m_Buffer->GetDataSize() - m_Position);
}
- }
+ }
// check for en of stream
- if(bytes_to_write == 0)
- {
+ if (bytes_to_write == 0) {
return AP4_ERROR_EOS;
}
// write to memory
- AP4_CopyMemory((void*)(m_Buffer->UseData() + m_Position), buffer, bytes_to_write);
+ AP4_CopyMemory((void*)(m_Buffer->UseData()+m_Position), buffer, bytes_to_write);
m_Position += bytes_to_write;
bytes_written = bytes_to_write;
@@ -685,10 +647,10 @@ AP4_MemoryByteStream::WritePartial(const void* buffer,
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::Seek
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MemoryByteStream::Seek(AP4_Position position)
{
- if(position > m_Buffer->GetDataSize()) return AP4_FAILURE;
+ if (position > m_Buffer->GetDataSize()) return AP4_FAILURE;
m_Position = position;
return AP4_SUCCESS;
}
@@ -708,8 +670,7 @@ AP4_MemoryByteStream::AddReference()
void
AP4_MemoryByteStream::Release()
{
- if(--m_ReferenceCount == 0)
- {
+ if (--m_ReferenceCount == 0) {
delete this;
}
}
@@ -717,9 +678,9 @@ AP4_MemoryByteStream::Release()
/*----------------------------------------------------------------------
| AP4_BufferedInputStream::AP4_BufferedInputStream
+---------------------------------------------------------------------*/
-AP4_BufferedInputStream::AP4_BufferedInputStream(AP4_ByteStream& source,
- AP4_Size buffer_size,
- AP4_Size seek_as_read_threshold) :
+AP4_BufferedInputStream::AP4_BufferedInputStream(AP4_ByteStream& source,
+ AP4_Size buffer_size,
+ AP4_Size seek_as_read_threshold) :
m_Buffer(buffer_size),
m_BufferPosition(0),
m_Source(source),
@@ -733,77 +694,73 @@ AP4_BufferedInputStream::AP4_BufferedInputStream(AP4_ByteStream& source,
/*----------------------------------------------------------------------
| AP4_BufferedInputStream::Refill
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_BufferedInputStream::Refill()
{
m_BufferPosition = 0;
AP4_Size bytes_read = 0;
- AP4_Result result = m_Source.ReadPartial(m_Buffer.UseData(),
- m_Buffer.GetBufferSize(),
- bytes_read);
- if(AP4_FAILED(result))
- {
+ AP4_Result result = m_Source.ReadPartial(m_Buffer.UseData(),
+ m_Buffer.GetBufferSize(),
+ bytes_read);
+ if (AP4_FAILED(result)) {
m_Buffer.SetDataSize(0);
return result;
}
assert(bytes_read);
m_Buffer.SetDataSize(bytes_read);
m_SourcePosition += bytes_read;
-
+
return AP4_SUCCESS;
-}
+}
/*----------------------------------------------------------------------
| AP4_BufferedInputStream::ReadPartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_BufferedInputStream::ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+AP4_Result
+AP4_BufferedInputStream::ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read)
{
// check for shortcut
- if(bytes_to_read == 0)
- {
+ if (bytes_to_read == 0) {
bytes_read = 0;
return AP4_SUCCESS;
}
-
+
// compute how much data is available in the buffer
assert(m_BufferPosition <= m_Buffer.GetDataSize());
- AP4_Size available = m_Buffer.GetDataSize() - m_BufferPosition;
-
+ AP4_Size available = m_Buffer.GetDataSize()-m_BufferPosition;
+
// refill the buffer if it is empty
- if(available == 0)
- {
+ if (available == 0) {
AP4_Result result = Refill();
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
bytes_read = 0;
return result;
}
assert(m_BufferPosition == 0);
assert(m_Buffer.GetDataSize() != 0);
- available = m_Buffer.GetDataSize() - m_BufferPosition;
+ available = m_Buffer.GetDataSize()-m_BufferPosition;
}
-
+
// clamp the number of bytes to read to what's available
- if(bytes_to_read > available) bytes_to_read = available;
+ if (bytes_to_read > available) bytes_to_read = available;
bytes_read = bytes_to_read;
-
+
// copy the buffered data
- AP4_CopyMemory(buffer, m_Buffer.GetData() + m_BufferPosition, bytes_to_read);
+ AP4_CopyMemory(buffer, m_Buffer.GetData()+m_BufferPosition, bytes_to_read);
m_BufferPosition += bytes_to_read;
assert(m_BufferPosition <= m_Buffer.GetDataSize());
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_BufferedInputStream::WritePartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_BufferedInputStream::WritePartial(const void* /*buffer*/,
- AP4_Size /*bytes_to_write*/,
+AP4_Result
+AP4_BufferedInputStream::WritePartial(const void* /*buffer*/,
+ AP4_Size /*bytes_to_write*/,
AP4_Size& /*bytes_written*/)
{
return AP4_ERROR_NOT_SUPPORTED;
@@ -812,30 +769,26 @@ AP4_BufferedInputStream::WritePartial(const void* /*buffer*/,
/*----------------------------------------------------------------------
| AP4_BufferedInputStream::Seek
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_BufferedInputStream::Seek(AP4_Position position)
{
assert(m_SourcePosition >= m_Buffer.GetDataSize());
assert(m_BufferPosition <= m_Buffer.GetDataSize());
- if(position < m_SourcePosition - m_Buffer.GetDataSize() ||
- position > m_SourcePosition)
- {
+ if (position < m_SourcePosition-m_Buffer.GetDataSize() ||
+ position > m_SourcePosition) {
// out of buffer
m_BufferPosition = 0;
m_Buffer.SetDataSize(0);
-
+
// seek in the source
- if(position > m_SourcePosition && (position - m_SourcePosition <= m_SeekAsReadThreshold))
- {
+ if (position > m_SourcePosition && (position-m_SourcePosition <= m_SeekAsReadThreshold)) {
char* discard = new char[4096];
- AP4_Size to_skip = (AP4_Size)(position - m_SourcePosition);
- while(to_skip)
- {
+ AP4_Size to_skip = (AP4_Size)(position-m_SourcePosition);
+ while (to_skip) {
AP4_Size chunk = 4096;
- if(chunk > to_skip) chunk = to_skip;
+ if (chunk > to_skip) chunk = to_skip;
AP4_Result result = m_Source.Read(discard, chunk);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
delete[] discard;
return result;
}
@@ -844,29 +797,27 @@ AP4_BufferedInputStream::Seek(AP4_Position position)
}
delete[] discard;
return AP4_SUCCESS;
- }
- else
- {
+ } else {
m_SourcePosition = position;
return m_Source.Seek(position);
}
}
-
+
// compute the buffer position
- m_BufferPosition = (AP4_Size)(position - (m_SourcePosition - m_Buffer.GetDataSize()));
-
+ m_BufferPosition = (AP4_Size)(position-(m_SourcePosition-m_Buffer.GetDataSize()));
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_BufferedInputStream::Tell
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_BufferedInputStream::Tell(AP4_Position& position)
{
assert(m_SourcePosition >= m_Buffer.GetDataSize());
assert(m_BufferPosition <= m_Buffer.GetDataSize());
- position = m_SourcePosition - m_Buffer.GetDataSize() + m_BufferPosition;
+ position = m_SourcePosition-m_Buffer.GetDataSize()+m_BufferPosition;
return AP4_SUCCESS;
}
@@ -885,8 +836,7 @@ AP4_BufferedInputStream::AddReference()
void
AP4_BufferedInputStream::Release()
{
- if(--m_ReferenceCount == 0)
- {
+ if (--m_ReferenceCount == 0) {
delete this;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.h
index 2d69d54d7..3eaf2d803 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ByteStream.h
@@ -42,10 +42,10 @@
+---------------------------------------------------------------------*/
class AP4_ByteStream : public AP4_Referenceable
{
-public:
+ public:
// methods
- virtual AP4_Result ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+ virtual AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read) = 0;
AP4_Result Read(void* buffer, AP4_Size bytes_to_read);
AP4_Result ReadDouble(double& value);
@@ -55,8 +55,8 @@ public:
AP4_Result ReadUI16(AP4_UI16& value);
AP4_Result ReadUI08(AP4_UI08& value);
AP4_Result ReadString(char* buffer, AP4_Size size);
- virtual AP4_Result WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+ virtual AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written) = 0;
AP4_Result Write(const void* buffer, AP4_Size bytes_to_write);
AP4_Result WriteString(const char* string_buffer);
@@ -70,10 +70,7 @@ public:
virtual AP4_Result Tell(AP4_Position& position) = 0;
virtual AP4_Result GetSize(AP4_LargeSize& size) = 0;
virtual AP4_Result CopyTo(AP4_ByteStream& stream, AP4_LargeSize size);
- virtual AP4_Result Flush()
- {
- return AP4_SUCCESS;
- }
+ virtual AP4_Result Flush() { return AP4_SUCCESS; }
};
/*----------------------------------------------------------------------
@@ -81,26 +78,24 @@ public:
+---------------------------------------------------------------------*/
class AP4_SubStream : public AP4_ByteStream
{
-public:
- AP4_SubStream(AP4_ByteStream& container,
- AP4_Position position,
+ public:
+ AP4_SubStream(AP4_ByteStream& container,
+ AP4_Position position,
AP4_LargeSize size);
// AP4_ByteStream methods
- AP4_Result ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+ AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read);
- AP4_Result WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+ AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written);
AP4_Result Seek(AP4_Position position);
- AP4_Result Tell(AP4_Position& position)
- {
+ AP4_Result Tell(AP4_Position& position) {
position = m_Position;
return AP4_SUCCESS;
}
- AP4_Result GetSize(AP4_LargeSize& size)
- {
+ AP4_Result GetSize(AP4_LargeSize& size) {
size = m_Size;
return AP4_SUCCESS;
}
@@ -109,10 +104,10 @@ public:
void AddReference();
void Release();
-protected:
+ protected:
virtual ~AP4_SubStream();
-private:
+ private:
AP4_ByteStream& m_Container;
AP4_Position m_Offset;
AP4_LargeSize m_Size;
@@ -131,20 +126,18 @@ public:
AP4_MemoryByteStream(AP4_DataBuffer& data_buffer); // data is read/written from/to supplied buffer
// AP4_ByteStream methods
- AP4_Result ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+ AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read);
- AP4_Result WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+ AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written);
AP4_Result Seek(AP4_Position position);
- AP4_Result Tell(AP4_Position& position)
- {
+ AP4_Result Tell(AP4_Position& position) {
position = m_Position;
return AP4_SUCCESS;
}
- AP4_Result GetSize(AP4_LargeSize& size)
- {
+ AP4_Result GetSize(AP4_LargeSize& size) {
size = m_Buffer->GetDataSize();
return AP4_SUCCESS;
}
@@ -154,18 +147,9 @@ public:
void Release();
// methods
- const AP4_UI08* GetData()
- {
- return m_Buffer->GetData();
- }
- AP4_UI08* UseData()
- {
- return m_Buffer->UseData();
- }
- AP4_Size GetDataSize()
- {
- return m_Buffer->GetDataSize();
- }
+ const AP4_UI08* GetData() { return m_Buffer->GetData(); }
+ AP4_UI08* UseData() { return m_Buffer->UseData(); }
+ AP4_Size GetDataSize() { return m_Buffer->GetDataSize(); }
protected:
virtual ~AP4_MemoryByteStream();
@@ -183,35 +167,29 @@ private:
class AP4_BufferedInputStream : public AP4_ByteStream
{
public:
- AP4_BufferedInputStream(AP4_ByteStream& source,
- AP4_Size buffer_size = 4096,
- AP4_Size seek_as_read_threshold = 1024 * 128);
+ AP4_BufferedInputStream(AP4_ByteStream& source,
+ AP4_Size buffer_size=4096,
+ AP4_Size seek_as_read_threshold=1024*128);
// AP4_ByteStream methods
- AP4_Result ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+ AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read);
- AP4_Result WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+ AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written);
AP4_Result Seek(AP4_Position position);
AP4_Result Tell(AP4_Position& position);
- AP4_Result GetSize(AP4_LargeSize& size)
- {
- return m_Source.GetSize(size);
- }
+ AP4_Result GetSize(AP4_LargeSize& size) { return m_Source.GetSize(size); }
// AP4_Referenceable methods
void AddReference();
void Release();
protected:
- ~AP4_BufferedInputStream()
- {
- m_Source.Release();
- }
+ ~AP4_BufferedInputStream() { m_Source.Release(); }
AP4_Result Refill();
-
+
private:
AP4_DataBuffer m_Buffer;
AP4_Size m_BufferPosition;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.cpp
index 87864cf2c..2c5c195a3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.cpp
@@ -38,34 +38,34 @@
AP4_ChplAtom::AP4_ChplAtom(AP4_UI32 size,
AP4_ByteStream& stream)
- : AP4_Atom(AP4_ATOM_TYPE_CHPL, size)
+ : AP4_Atom(AP4_ATOM_TYPE_CHPL, size)
{
- size -= AP4_FULL_ATOM_HEADER_SIZE;
+ size -= AP4_FULL_ATOM_HEADER_SIZE;
- stream.ReadUI32(m_Reserved);
+ stream.ReadUI32(m_Reserved);
- AP4_UI08 cnt = 0;
- stream.ReadUI08(cnt);
+ AP4_UI08 cnt = 0;
+ stream.ReadUI08(cnt);
- size -= 5;
+ size -= 5;
- while(size > 0 && cnt-- > 0)
- {
- AP4_Chapter chapter;
+ while(size > 0 && cnt-- > 0)
+ {
+ AP4_Chapter chapter;
- // time
- stream.ReadUI64(chapter.Time);
+ // time
+ stream.ReadUI64(chapter.Time);
- // name
- AP4_UI08 len = 0;
- char buff[256];
- stream.ReadUI08(len);
- stream.Read(buff, len);
- buff[len] = 0;
- chapter.Name = buff;
+ // name
+ AP4_UI08 len = 0;
+ char buff[256];
+ stream.ReadUI08(len);
+ stream.Read(buff, len);
+ buff[len] = 0;
+ chapter.Name = buff;
- m_Chapters.Append(chapter);
+ m_Chapters.Append(chapter);
- size -= 8 + 1 + len;
- }
+ size -= 8+1+len;
+ }
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.h
index fad2ef2a2..d1fa4327b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ChplAtom.h
@@ -43,30 +43,20 @@
class AP4_ChplAtom : public AP4_Atom
{
public:
- AP4_ChplAtom(AP4_UI32 size,
+ AP4_ChplAtom(AP4_UI32 size,
AP4_ByteStream& stream);
- AP4_Result WriteFields(AP4_ByteStream& stream)
- {
- return AP4_FAILURE;
- }
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
- struct AP4_Chapter
- {
- AP4_UI64 Time;
- AP4_String Name;
- };
+ struct AP4_Chapter {AP4_UI64 Time; AP4_String Name;};
- AP4_Array<AP4_Chapter>& GetChapters()
- {
- return m_Chapters;
- }
+ AP4_Array<AP4_Chapter>& GetChapters() { return m_Chapters; }
private:
- // members
- AP4_UI32 m_Reserved;
- AP4_Array<AP4_Chapter> m_Chapters;
+ // members
+ AP4_UI32 m_Reserved;
+ AP4_Array<AP4_Chapter> m_Chapters;
};
#endif // _AP4_CHPL_ATOM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.cpp
index 539587bcc..8b4760524 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - cmvd Atoms
+| AP4 - cmvd Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
@@ -34,10 +34,10 @@
#include "Ap4AtomFactory.h"
#include "Ap4ContainerAtom.h"
-AP4_CmvdAtom*
-AP4_CmvdAtom::Create(AP4_Size size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory)
-{
- return new AP4_CmvdAtom(size, stream, atom_factory);
+AP4_CmvdAtom*
+AP4_CmvdAtom::Create(AP4_Size size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory)
+{
+ return new AP4_CmvdAtom(size, stream, atom_factory);
}
/*----------------------------------------------------------------------
@@ -48,26 +48,26 @@ AP4_CmvdAtom::AP4_CmvdAtom(AP4_Size size,
AP4_AtomFactory& atom_factory) :
AP4_ContainerAtom(AP4_ATOM_TYPE_CMVD)
{
- size -= AP4_ATOM_HEADER_SIZE;
+ size -= AP4_ATOM_HEADER_SIZE;
stream.ReadUI32(m_MovieResourceSize);
- size -= 4;
+ size -= 4;
- m_Data.SetDataSize(size);
- stream.Read(m_Data.UseData(), size);
+ m_Data.SetDataSize(size);
+ stream.Read(m_Data.UseData(), size);
- /*
- // read children
- AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
- while (entry_count--) {
- AP4_Atom* atom;
- while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
- bytes_available,
- atom,
- this))) {
- m_Children.Add(atom);
- }
+/*
+ // read children
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom,
+ this))) {
+ m_Children.Add(atom);
}
- */
+ }
+*/
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.h
index 9d768fc88..51e2ca843 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CmvdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - cmvd Atoms
+| AP4 - cmvd Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
@@ -46,31 +46,22 @@
class AP4_CmvdAtom : public AP4_ContainerAtom
{
public:
- // class methods
- static AP4_CmvdAtom* Create(AP4_Size size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory);
+ // class methods
+ static AP4_CmvdAtom* Create(AP4_Size size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory);
- // methods
+ // methods
AP4_CmvdAtom(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
- virtual AP4_Result WriteFields(AP4_ByteStream& stream)
- {
- return AP4_FAILURE;
- }
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
- AP4_UI32 GetMovieResourceSize() const
- {
- return m_MovieResourceSize;
- }
- const AP4_DataBuffer& GetDataBuffer()
- {
- return m_Data;
- }
+ AP4_UI32 GetMovieResourceSize() const { return m_MovieResourceSize; }
+ const AP4_DataBuffer& GetDataBuffer() { return m_Data; }
private:
- AP4_UI32 m_MovieResourceSize;
- AP4_DataBuffer m_Data;
+ AP4_UI32 m_MovieResourceSize;
+ AP4_DataBuffer m_Data;
};
#endif // _AP4_CMVD_ATOM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.cpp
index df097449c..3dea98337 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - co64 Atoms
+| AP4 - co64 Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_Co64Atom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_Co64Atom(size, version, flags, stream);
}
@@ -55,32 +55,30 @@ AP4_Co64Atom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_Co64Atom::AP4_Co64Atom
+---------------------------------------------------------------------*/
AP4_Co64Atom::AP4_Co64Atom(AP4_UI64* entries, AP4_UI32 entry_count) :
- AP4_Atom(AP4_ATOM_TYPE_CO64,
- AP4_FULL_ATOM_HEADER_SIZE + 4 + entry_count * 8,
- 0, 0),
- m_Entries(new AP4_UI64[entry_count]),
- m_EntryCount(entry_count)
+AP4_Atom(AP4_ATOM_TYPE_CO64,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*8,
+ 0, 0),
+ m_Entries(new AP4_UI64[entry_count]),
+ m_EntryCount(entry_count)
{
- AP4_CopyMemory(m_Entries, entries, m_EntryCount * 8);
+ AP4_CopyMemory(m_Entries, entries, m_EntryCount*8);
}
/*----------------------------------------------------------------------
| AP4_Co64Atom::AP4_Co64Atom
+---------------------------------------------------------------------*/
-AP4_Co64Atom::AP4_Co64Atom(AP4_UI32 size,
+AP4_Co64Atom::AP4_Co64Atom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_CO64, size, version, flags)
{
stream.ReadUI32(m_EntryCount);
- if(m_EntryCount > (size - AP4_FULL_ATOM_HEADER_SIZE - 4) / 8)
- {
- m_EntryCount = (size - AP4_FULL_ATOM_HEADER_SIZE - 4) / 8;
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8;
}
m_Entries = new AP4_UI64[m_EntryCount];
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
stream.ReadUI64(m_Entries[i]);
}
}
@@ -100,8 +98,7 @@ AP4_Result
AP4_Co64Atom::GetChunkOffset(AP4_Ordinal chunk, AP4_UI64& chunk_offset)
{
// check the bounds
- if(chunk > m_EntryCount || chunk == 0)
- {
+ if (chunk > m_EntryCount || chunk == 0) {
return AP4_ERROR_OUT_OF_RANGE;
}
@@ -118,8 +115,7 @@ AP4_Result
AP4_Co64Atom::SetChunkOffset(AP4_Ordinal chunk, AP4_UI64 chunk_offset)
{
// check the bounds
- if(chunk > m_EntryCount || chunk == 0)
- {
+ if (chunk > m_EntryCount || chunk == 0) {
return AP4_ERROR_OUT_OF_RANGE;
}
@@ -135,8 +131,7 @@ AP4_Co64Atom::SetChunkOffset(AP4_Ordinal chunk, AP4_UI64 chunk_offset)
AP4_Result
AP4_Co64Atom::AdjustChunkOffsets(AP4_SI64 delta)
{
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
m_Entries[i] += delta;
}
@@ -153,13 +148,12 @@ AP4_Co64Atom::WriteFields(AP4_ByteStream& stream)
// entry count
result = stream.WriteUI32(m_EntryCount);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// entries
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
result = stream.WriteUI64(m_Entries[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return result;
@@ -172,11 +166,9 @@ AP4_Result
AP4_Co64Atom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry_count", m_EntryCount);
- if(inspector.GetVerbosity() >= 1)
- {
+ if (inspector.GetVerbosity() >= 1) {
char header[32];
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
AP4_FormatString(header, sizeof(header), "entry %8d", i);
inspector.AddField(header, m_Entries[i]);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.h
index eb79a09e5..bdfeb4736 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Co64Atom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - co64 Atoms
+| AP4 - co64 Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -51,21 +51,15 @@ public:
~AP4_Co64Atom();
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_Cardinal GetChunkCount()
- {
- return m_EntryCount;
- }
- AP4_UI64* GetChunkOffsets()
- {
- return m_Entries;
- }
+ AP4_Cardinal GetChunkCount() { return m_EntryCount; }
+ AP4_UI64* GetChunkOffsets() { return m_Entries; }
AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_UI64& chunk_offset);
AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_UI64 chunk_offset);
AP4_Result AdjustChunkOffsets(AP4_SI64 delta);
private:
// methods
- AP4_Co64Atom(AP4_UI32 size,
+ AP4_Co64Atom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.cpp
index 0e9a4b0c8..1dc6958f5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.cpp
@@ -66,7 +66,7 @@ AP4_UnknownCommand::AP4_UnknownCommand(AP4_ByteStream& stream,
AP4_Command(tag, header_size, payload_size)
{
m_Data.SetDataSize(payload_size);
- stream.Read(m_Data.UseData(), payload_size);
+ stream.Read(m_Data.UseData(), payload_size);
}
/*----------------------------------------------------------------------
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.h
index aff51bd2f..50cf8d736 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Command.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Commands
+| AP4 - Commands
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -52,8 +52,8 @@ const AP4_UI08 AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_EXECUTE = 0x08;
+---------------------------------------------------------------------*/
class AP4_Command : public AP4_Expandable
{
-public:
- AP4_IMPLEMENT_DYNAMIC_CAST(AP4_Command)
+ public:
+ AP4_IMPLEMENT_DYNAMIC_CAST(AP4_Command)
// constructor
AP4_Command(AP4_UI08 tag, AP4_Size header_size, AP4_Size payload_size) :
@@ -63,10 +63,7 @@ public:
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// methods
- AP4_UI08 GetTag()
- {
- return (AP4_UI08)m_ClassId;
- }
+ AP4_UI08 GetTag() { return (AP4_UI08)m_ClassId; }
};
/*----------------------------------------------------------------------
@@ -76,11 +73,11 @@ class AP4_UnknownCommand : public AP4_Command
{
public:
// contrusctor
- AP4_UnknownCommand(AP4_ByteStream& stream,
+ AP4_UnknownCommand(AP4_ByteStream& stream,
AP4_UI08 tag,
AP4_Size header_size,
AP4_Size payload_size);
-
+
// AP4_Expandable methods
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.cpp
index 1b66191fc..f41312bda 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.cpp
@@ -38,8 +38,8 @@
| AP4_CommandFactory::CreateCommandFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_CommandFactory::CreateCommandFromStream(AP4_ByteStream& stream,
- AP4_Command*& command)
+AP4_CommandFactory::CreateCommandFromStream(AP4_ByteStream& stream,
+ AP4_Command*& command)
{
AP4_Result result;
@@ -53,45 +53,40 @@ AP4_CommandFactory::CreateCommandFromStream(AP4_ByteStream& stream,
// read descriptor tag
unsigned char tag;
result = stream.ReadUI08(tag);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
stream.Seek(offset);
return result;
}
-
+
// read descriptor size
unsigned long payload_size = 0;
unsigned int header_size = 1;
unsigned int max = 4;
unsigned char ext = 0;
- do
- {
+ do {
header_size++;
result = stream.ReadUI08(ext);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
stream.Seek(offset);
return result;
}
- payload_size = (payload_size << 7) + (ext & 0x7F);
- }
- while(--max && (ext & 0x80));
+ payload_size = (payload_size<<7) + (ext&0x7F);
+ } while (--max && (ext&0x80));
// create the command
- switch(tag)
- {
- case AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE:
- case AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE:
+ switch (tag) {
+ case AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE:
+ case AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE:
command = new AP4_DescriptorUpdateCommand(stream, tag, header_size, payload_size);
break;
- default:
+ default:
command = new AP4_UnknownCommand(stream, tag, header_size, payload_size);
break;
}
// skip to the end of the descriptor
- stream.Seek(offset + header_size + payload_size);
+ stream.Seek(offset+header_size+payload_size);
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.h
index 34bd347a2..133b35020 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CommandFactory.h
@@ -43,12 +43,12 @@ class AP4_ByteStream;
/*----------------------------------------------------------------------
| AP4_CommandFactory
+---------------------------------------------------------------------*/
-class AP4_CommandFactory
+class AP4_CommandFactory
{
-public:
+ public:
// class methods
static AP4_Result CreateCommandFromStream(AP4_ByteStream& stream,
- AP4_Command*& command);
+ AP4_Command*& command);
};
#endif // _AP4_COMMAND_FACTORY_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.cpp
index 7677a2005..deee12653 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.cpp
@@ -44,47 +44,41 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_ContainerAtom)
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
AP4_ContainerAtom*
-AP4_ContainerAtom::Create(Type type,
+AP4_ContainerAtom::Create(Type type,
AP4_UI64 size,
bool is_full,
bool force_64,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
- if(is_full)
- {
+ if (is_full) {
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
-
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+
// special case for 'meta' atoms, because Apple sometimes creates them as
// regular (non-full) atoms. This is bogus, but we can try to detect it
- if(type == AP4_ATOM_TYPE_META)
- {
- AP4_UI32 phantom_size = (version << 24) | flags;
- if(phantom_size >= 8 && size >= 16)
- {
+ if (type == AP4_ATOM_TYPE_META) {
+ AP4_UI32 phantom_size = (version<<24)|flags;
+ if (phantom_size >= 8 && size >= 16) {
// version+flags looks like a size. read the next 4 bytes just
// to be sure it is a hdlr atom
AP4_UI32 peek;
- if(AP4_FAILED(stream.ReadUI32(peek))) return NULL;
- if(peek == AP4_ATOM_TYPE_HDLR)
- {
+ if (AP4_FAILED(stream.ReadUI32(peek))) return NULL;
+ if (peek == AP4_ATOM_TYPE_HDLR) {
// rewind the stream by 8 bytes
AP4_Position position;
stream.Tell(position);
- stream.Seek(position - 8);
-
+ stream.Seek(position-8);
+
// create a non-full container
return new AP4_ContainerAtom(type, size, force_64, stream, atom_factory);
}
}
}
-
+
return new AP4_ContainerAtom(type, size, force_64, version, flags, stream, atom_factory);
- }
- else
- {
+ } else {
return new AP4_ContainerAtom(type, size, force_64, stream, atom_factory);
}
}
@@ -116,10 +110,10 @@ AP4_ContainerAtom::AP4_ContainerAtom(Type type, AP4_UI64 size, bool force_64) :
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
-AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
AP4_UI64 size,
bool force_64,
- AP4_UI32 version,
+ AP4_UI32 version,
AP4_UI32 flags) :
AP4_Atom(type, size, force_64, version, flags)
{
@@ -129,20 +123,20 @@ AP4_ContainerAtom::AP4_ContainerAtom(Type type,
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
-AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
AP4_UI64 size,
bool force_64,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
AP4_Atom(type, size, force_64)
{
- ReadChildren(atom_factory, stream, size - GetHeaderSize());
+ ReadChildren(atom_factory, stream, size-GetHeaderSize());
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
-AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
AP4_UI64 size,
bool force_64,
AP4_UI32 version,
@@ -151,30 +145,26 @@ AP4_ContainerAtom::AP4_ContainerAtom(Type type,
AP4_AtomFactory& atom_factory) :
AP4_Atom(type, size, force_64, version, flags)
{
- ReadChildren(atom_factory, stream, size - GetHeaderSize());
+ ReadChildren(atom_factory, stream, size-GetHeaderSize());
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::Clone
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_ContainerAtom::Clone()
{
AP4_ContainerAtom* clone;
- if(m_IsFull)
- {
+ if (m_IsFull) {
clone = new AP4_ContainerAtom(m_Type, m_Version, m_Flags);
- }
- else
- {
+ } else {
clone = new AP4_ContainerAtom(m_Type);
}
AP4_List<AP4_Atom>::Item* child_item = m_Children.FirstItem();
- while(child_item)
- {
+ while (child_item) {
AP4_Atom* child_clone = child_item->GetData()->Clone();
- if(child_clone) clone->AddChild(child_clone);
+ if (child_clone) clone->AddChild(child_clone);
child_item = child_item->GetNext();
}
@@ -186,7 +176,7 @@ AP4_ContainerAtom::Clone()
+---------------------------------------------------------------------*/
void
AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
- AP4_ByteStream& stream,
+ AP4_ByteStream& stream,
AP4_UI64 size)
{
AP4_Atom* atom;
@@ -195,9 +185,8 @@ AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
// save and switch the factory's context
atom_factory.PushContext(m_Type);
- while(AP4_SUCCEEDED(
- atom_factory.CreateAtomFromStream(stream, bytes_available, atom)))
- {
+ while (AP4_SUCCEEDED(
+ atom_factory.CreateAtomFromStream(stream, bytes_available, atom))) {
atom->SetParent(this);
m_Children.Add(atom);
}
@@ -249,7 +238,7 @@ AP4_ContainerAtom::OnChildChanged(AP4_Atom*)
SetSize(size);
// update our parent
- if(m_Parent) m_Parent->OnChildChanged(this);
+ if (m_Parent) m_Parent->OnChildChanged(this);
}
/*----------------------------------------------------------------------
@@ -259,10 +248,10 @@ void
AP4_ContainerAtom::OnChildAdded(AP4_Atom* child)
{
// update our size
- SetSize(GetSize() + child->GetSize());
+ SetSize(GetSize()+child->GetSize());
// update our parent
- if(m_Parent) m_Parent->OnChildChanged(this);
+ if (m_Parent) m_Parent->OnChildChanged(this);
}
/*----------------------------------------------------------------------
@@ -272,8 +261,8 @@ void
AP4_ContainerAtom::OnChildRemoved(AP4_Atom* child)
{
// update our size
- SetSize(GetSize() - child->GetSize());
+ SetSize(GetSize()-child->GetSize());
// update our parent
- if(m_Parent) m_Parent->OnChildChanged(this);
+ if (m_Parent) m_Parent->OnChildChanged(this);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.h
index e23fabfa6..b19e18637 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ContainerAtom.h
@@ -45,14 +45,14 @@ class AP4_AtomFactory;
/*----------------------------------------------------------------------
| AP4_ContainerAtom
+---------------------------------------------------------------------*/
-class AP4_ContainerAtom : public AP4_Atom, public AP4_AtomParent
+class AP4_ContainerAtom : public AP4_Atom, public AP4_AtomParent
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_ContainerAtom, AP4_Atom, AP4_AtomParent)
// class methods
- static AP4_ContainerAtom* Create(Type type,
- AP4_UI64 size,
+ static AP4_ContainerAtom* Create(Type type,
+ AP4_UI64 size,
bool is_full,
bool force_64,
AP4_ByteStream& stream,
@@ -60,13 +60,10 @@ public:
// methods
explicit AP4_ContainerAtom(Type type);
- explicit AP4_ContainerAtom(Type type, AP4_UI32 version, AP4_UI32 flags);
+ explicit AP4_ContainerAtom(Type type, AP4_UI32 version, AP4_UI32 flags);
explicit AP4_ContainerAtom(Type type, AP4_UI64 size, bool force_64);
explicit AP4_ContainerAtom(Type type, AP4_UI64 size, bool force_64, AP4_UI32 version, AP4_UI32 flags);
- AP4_List<AP4_Atom>& GetChildren()
- {
- return m_Children;
- }
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result InspectChildren(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
@@ -79,22 +76,22 @@ public:
protected:
// constructors
- AP4_ContainerAtom(Type type,
- AP4_UI64 size,
+ AP4_ContainerAtom(Type type,
+ AP4_UI64 size,
bool force_64,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
- AP4_ContainerAtom(Type type,
- AP4_UI64 size,
+ AP4_ContainerAtom(Type type,
+ AP4_UI64 size,
bool force_64,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
// methods
void ReadChildren(AP4_AtomFactory& atom_factory,
- AP4_ByteStream& stream,
+ AP4_ByteStream& stream,
AP4_UI64 size);
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.cpp
index b483be5b3..fc431825a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ctts Atoms
+| AP4 - ctts Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_CttsAtom::Create(AP4_UI32 size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_CttsAtom(size, version, flags, stream);
}
@@ -55,7 +55,7 @@ AP4_CttsAtom::Create(AP4_UI32 size, AP4_ByteStream& stream)
| AP4_CttsAtom::AP4_CttsAtom
+---------------------------------------------------------------------*/
AP4_CttsAtom::AP4_CttsAtom() :
- AP4_Atom(AP4_ATOM_TYPE_CTTS, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0)
+ AP4_Atom(AP4_ATOM_TYPE_CTTS, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0)
{
m_LookupCache.sample = 0;
m_LookupCache.entry_index = 0;
@@ -64,7 +64,7 @@ AP4_CttsAtom::AP4_CttsAtom() :
/*----------------------------------------------------------------------
| AP4_CttsAtom::AP4_CttsAtom
+---------------------------------------------------------------------*/
-AP4_CttsAtom::AP4_CttsAtom(AP4_UI32 size,
+AP4_CttsAtom::AP4_CttsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -77,16 +77,14 @@ AP4_CttsAtom::AP4_CttsAtom(AP4_UI32 size,
stream.ReadUI32(entry_count);
m_Entries.SetItemCount(entry_count);
unsigned char* buffer = new unsigned char[entry_count*8];
- AP4_Result result = stream.Read(buffer, entry_count * 8);
- if(AP4_FAILED(result))
- {
+ AP4_Result result = stream.Read(buffer, entry_count*8);
+ if (AP4_FAILED(result)) {
delete[] buffer;
return;
}
//bool use_quicktime_format = false;
//AP4_SI32 quicktime_min_offset = 0;
- for(unsigned i = 0; i < entry_count; i++)
- {
+ for (unsigned i=0; i<entry_count; i++) {
m_Entries[i].m_SampleCount = AP4_BytesToUInt32BE(&buffer[i*8 ]);
AP4_UI32 offset = AP4_BytesToUInt32BE(&buffer[i*8+4]);
//if (offset & 0x80000000) {
@@ -97,7 +95,7 @@ AP4_CttsAtom::AP4_CttsAtom(AP4_UI32 size,
m_Entries[i].m_SampleOffset = offset;
}
delete[] buffer;
-
+
// in the quicktime format, the offsets can be positive or negative, so
// we need to adjust for them here
//if (use_quicktime_format) {
@@ -126,27 +124,24 @@ AP4_CttsAtom::GetCtsOffset(AP4_Ordinal sample, AP4_UI32& cts_offset)
{
// default value
cts_offset = 0;
-
+
// sample indexes start at 1
- if(sample == 0) return AP4_ERROR_OUT_OF_RANGE;
-
+ if (sample == 0) return AP4_ERROR_OUT_OF_RANGE;
+
// check the lookup cache
AP4_Ordinal lookup_start = 0;
AP4_Ordinal sample_start = 0;
- if(sample >= m_LookupCache.sample)
- {
+ if (sample >= m_LookupCache.sample) {
// start from the cached entry
lookup_start = m_LookupCache.entry_index;
sample_start = m_LookupCache.sample;
}
- for(AP4_Ordinal i = lookup_start; i < m_Entries.ItemCount(); i++)
- {
+ for (AP4_Ordinal i = lookup_start; i < m_Entries.ItemCount(); i++) {
AP4_CttsTableEntry& entry = m_Entries[i];
// check if we have reached the sample
- if(sample <= sample_start + entry.m_SampleCount)
- {
+ if (sample <= sample_start+entry.m_SampleCount) {
// we are within the sample range for the current entry
cts_offset = entry.m_SampleOffset;
@@ -158,7 +153,7 @@ AP4_CttsAtom::GetCtsOffset(AP4_Ordinal sample, AP4_UI32& cts_offset)
}
// update the upper bound
- sample_start += entry.m_SampleCount;
+ sample_start += entry.m_SampleCount;
}
// sample is greater than the number of samples
@@ -176,18 +171,17 @@ AP4_CttsAtom::WriteFields(AP4_ByteStream& stream)
// write the entry count
AP4_Cardinal entry_count = m_Entries.ItemCount();
result = stream.WriteUI32(entry_count);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the entries
- for(AP4_Ordinal i = 0; i < entry_count; i++)
- {
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
// sample count
result = stream.WriteUI32(m_Entries[i].m_SampleCount);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// time offset
result = stream.WriteUI32(m_Entries[i].m_SampleOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
@@ -201,15 +195,13 @@ AP4_CttsAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry_count", m_Entries.ItemCount());
- if(inspector.GetVerbosity() >= 2)
- {
+ if (inspector.GetVerbosity() >= 2) {
char header[32];
char value[64];
- for(AP4_Ordinal i = 0; i < m_Entries.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<m_Entries.ItemCount(); i++) {
AP4_FormatString(header, sizeof(header), "entry %8d", i);
- AP4_FormatString(value, sizeof(value), "count=%d, offset=%d",
- m_Entries[i].m_SampleCount,
+ AP4_FormatString(value, sizeof(value), "count=%d, offset=%d",
+ m_Entries[i].m_SampleCount,
m_Entries[i].m_SampleOffset);
inspector.AddField(header, value);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.h
index d853a5d99..0f86c8399 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4CttsAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ctts Atoms
+| AP4 - ctts Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -44,11 +44,10 @@ class AP4_ByteStream;
/*----------------------------------------------------------------------
| AP4_CttsTableEntry
+---------------------------------------------------------------------*/
-class AP4_CttsTableEntry
-{
-public:
- AP4_CttsTableEntry() :
- m_SampleCount(0),
+class AP4_CttsTableEntry {
+ public:
+ AP4_CttsTableEntry() :
+ m_SampleCount(0),
m_SampleOffset(0) {}
AP4_CttsTableEntry(AP4_UI32 sample_count,
AP4_UI32 sample_offset) :
@@ -72,7 +71,7 @@ public:
// constructor
AP4_CttsAtom();
-
+
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
@@ -81,15 +80,14 @@ public:
private:
// methods
- AP4_CttsAtom(AP4_UI32 size,
+ AP4_CttsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
// members
AP4_Array<AP4_CttsTableEntry> m_Entries;
- struct
- {
+ struct {
AP4_Ordinal sample;
AP4_Ordinal entry_index;
} m_LookupCache;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.cpp
index a82f2d57c..5cd837d3c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.cpp
@@ -64,8 +64,7 @@ AP4_DataBuffer::AP4_DataBuffer(const void* data, AP4_Size data_size) :
m_BufferSize(data_size),
m_DataSize(data_size)
{
- if(data && data_size)
- {
+ if (data && data_size) {
m_Buffer = new AP4_Byte[data_size];
AP4_CopyMemory(m_Buffer, data, data_size);
}
@@ -89,8 +88,7 @@ AP4_DataBuffer::AP4_DataBuffer(const AP4_DataBuffer& other) :
+---------------------------------------------------------------------*/
AP4_DataBuffer::~AP4_DataBuffer()
{
- if(m_BufferIsLocal)
- {
+ if (m_BufferIsLocal) {
delete[] m_Buffer;
}
}
@@ -101,11 +99,11 @@ AP4_DataBuffer::~AP4_DataBuffer()
AP4_Result
AP4_DataBuffer::Reserve(AP4_Size size)
{
- if(size <= m_BufferSize) return AP4_SUCCESS;
+ if (size <= m_BufferSize) return AP4_SUCCESS;
// try doubling the buffer to accomodate for the new size
- AP4_Size new_size = m_BufferSize * 2 + 1024;
- if(new_size < size) new_size = size;
+ AP4_Size new_size = m_BufferSize*2+1024;
+ if (new_size < size) new_size = size;
return SetBufferSize(new_size);
}
@@ -115,8 +113,7 @@ AP4_DataBuffer::Reserve(AP4_Size size)
AP4_Result
AP4_DataBuffer::SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size)
{
- if(m_BufferIsLocal)
- {
+ if (m_BufferIsLocal) {
// destroy the local buffer
delete[] m_Buffer;
}
@@ -135,14 +132,11 @@ AP4_DataBuffer::SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size)
AP4_Result
AP4_DataBuffer::SetBufferSize(AP4_Size buffer_size)
{
- if(m_BufferIsLocal)
- {
+ if (m_BufferIsLocal) {
return ReallocateBuffer(buffer_size);
- }
- else
- {
+ } else {
return AP4_FAILURE; // you cannot change the
- // buffer management mode
+ // buffer management mode
}
}
@@ -152,15 +146,11 @@ AP4_DataBuffer::SetBufferSize(AP4_Size buffer_size)
AP4_Result
AP4_DataBuffer::SetDataSize(AP4_Size size)
{
- if(size > m_BufferSize)
- {
- if(m_BufferIsLocal)
- {
+ if (size > m_BufferSize) {
+ if (m_BufferIsLocal) {
AP4_Result result = ReallocateBuffer(size);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
return AP4_FAILURE;
}
}
@@ -174,15 +164,11 @@ AP4_DataBuffer::SetDataSize(AP4_Size size)
AP4_Result
AP4_DataBuffer::SetData(const AP4_Byte* data, AP4_Size size)
{
- if(size > m_BufferSize)
- {
- if(m_BufferIsLocal)
- {
+ if (size > m_BufferSize) {
+ if (m_BufferIsLocal) {
AP4_Result result = ReallocateBuffer(size);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
return AP4_FAILURE;
}
}
@@ -200,16 +186,15 @@ AP4_Result
AP4_DataBuffer::ReallocateBuffer(AP4_Size size)
{
// check that the existing data fits
- if(m_DataSize > size) return AP4_FAILURE;
+ if (m_DataSize > size) return AP4_FAILURE;
// allocate a new buffer
AP4_Byte* new_buffer = new AP4_Byte[size];
// copy the contents of the previous buffer ,is any
- if(m_Buffer && m_DataSize)
- {
- AP4_CopyMemory(new_buffer, m_Buffer, m_DataSize);
- }
+ if (m_Buffer && m_DataSize) {
+ AP4_CopyMemory(new_buffer, m_Buffer, m_DataSize);
+ }
// destroy the previous buffer
delete[] m_Buffer;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.h
index 4ecdac62b..64e89f981 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DataBuffer.h
@@ -37,11 +37,11 @@
/*----------------------------------------------------------------------
| AP4_DataBuffer
+---------------------------------------------------------------------*/
-class AP4_DataBuffer
+class AP4_DataBuffer
{
-public:
+ public:
// constructors & destructor
- AP4_DataBuffer();
+ AP4_DataBuffer();
AP4_DataBuffer(AP4_Size size);
AP4_DataBuffer(const void* data, AP4_Size data_size);
AP4_DataBuffer(const AP4_DataBuffer& other);
@@ -50,31 +50,19 @@ public:
// data buffer handling methods
AP4_Result SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size);
AP4_Result SetBufferSize(AP4_Size buffer_size);
- AP4_Size GetBufferSize() const
- {
- return m_BufferSize;
- }
+ AP4_Size GetBufferSize() const { return m_BufferSize; }
// data handling methods
- const AP4_Byte* GetData() const
- {
- return m_Buffer;
- }
- AP4_Byte* UseData()
- {
- return m_Buffer;
- };
- AP4_Size GetDataSize() const
- {
- return m_DataSize;
- }
+ const AP4_Byte* GetData() const { return m_Buffer; }
+ AP4_Byte* UseData() { return m_Buffer; };
+ AP4_Size GetDataSize() const { return m_DataSize; }
AP4_Result SetDataSize(AP4_Size size);
AP4_Result SetData(const AP4_Byte* data, AP4_Size data_size);
// memory management
AP4_Result Reserve(AP4_Size size);
-protected:
+ protected:
// members
bool m_BufferIsLocal;
AP4_Byte* m_Buffer;
@@ -88,6 +76,6 @@ private:
// forbid this
AP4_DataBuffer& operator=(const AP4_DataBuffer& other);
};
-
+
#endif // _AP4_DATA_BUFFER_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.cpp
index 688e6fc4c..9d0bcb0dc 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.cpp
@@ -36,18 +36,18 @@
| AP4_DcomAtom::AP4_DcomAtom
+---------------------------------------------------------------------*/
-AP4_DcomAtom*
-AP4_DcomAtom::Create(AP4_Size size, AP4_ByteStream& stream)
-{
- return new AP4_DcomAtom(size, stream);
-}
+AP4_DcomAtom*
+AP4_DcomAtom::Create(AP4_Size size, AP4_ByteStream& stream)
+{
+ return new AP4_DcomAtom(size, stream);
+}
AP4_DcomAtom::AP4_DcomAtom(AP4_Size size,
AP4_ByteStream& stream)
- : AP4_Atom(AP4_ATOM_TYPE_DCOM)
+ : AP4_Atom(AP4_ATOM_TYPE_DCOM)
{
- size -= AP4_ATOM_HEADER_SIZE;
+ size -= AP4_ATOM_HEADER_SIZE;
stream.ReadUI32(m_CompressorSubType);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.h
index 20b82f342..4f0e1e8a8 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DcomAtom.h
@@ -40,25 +40,19 @@
class AP4_DcomAtom : public AP4_Atom
{
public:
- // class methods
- static AP4_DcomAtom* Create(AP4_Size size, AP4_ByteStream& stream);
-
- // methods
- AP4_DcomAtom(AP4_Size size,
+ // class methods
+ static AP4_DcomAtom* Create(AP4_Size size, AP4_ByteStream& stream);
+
+ // methods
+ AP4_DcomAtom(AP4_Size size,
AP4_ByteStream& stream);
- AP4_Result WriteFields(AP4_ByteStream& stream)
- {
- return AP4_FAILURE;
- }
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
- AP4_Atom::Type GetCompressorSubType() const
- {
- return m_CompressorSubType;
- }
+ AP4_Atom::Type GetCompressorSubType() const { return m_CompressorSubType; }
private:
- AP4_Atom::Type m_CompressorSubType;
+ AP4_Atom::Type m_CompressorSubType;
};
#endif // _AP4_DCOM_ATOM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Debug.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Debug.cpp
index 98925d01c..ee09ae84d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Debug.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Debug.cpp
@@ -58,7 +58,7 @@ void
AP4_Debug(const char* format, ...)
{
va_list args;
-
+
va_start(args, format);
char buffer[AP4_DEBUG_MAX_BUFFER];
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
index 787abad31..45b348f2d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
@@ -58,8 +58,7 @@ AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
m_MaxBitrate(max_bitrate),
m_AverageBitrate(avg_bitrate)
{
- if(dsi)
- {
+ if (dsi) {
m_SubDescriptors.Add(dsi);
m_PayloadSize += dsi->GetSize();
m_HeaderSize = MinHeaderSize(m_PayloadSize);
@@ -71,8 +70,8 @@ AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
+---------------------------------------------------------------------*/
AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
- AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG,
- header_size,
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG,
+ header_size,
payload_size)
{
// record the start position
@@ -83,19 +82,18 @@ AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
stream.ReadUI08(m_ObjectTypeIndication);
unsigned char bits;
stream.ReadUI08(bits);
- m_StreamType = (bits >> 2) & 0x3F;
- m_UpStream = bits & 2 ? true : false;
+ m_StreamType = (bits>>2)&0x3F;
+ m_UpStream = bits&2 ? true:false;
stream.ReadUI24(m_BufferSize);
stream.ReadUI32(m_MaxBitrate);
stream.ReadUI32(m_AverageBitrate);
// read other descriptors
- AP4_SubStream* substream = new AP4_SubStream(stream, start + 13, payload_size - 13);
+ AP4_SubStream* substream = new AP4_SubStream(stream, start+13, payload_size-13);
AP4_Descriptor* descriptor = NULL;
- while(AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
- descriptor)
- == AP4_SUCCESS)
- {
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
m_SubDescriptors.Add(descriptor);
}
substream->Release();
@@ -116,7 +114,7 @@ AP4_Result
AP4_DecoderConfigDescriptor::WriteFields(AP4_ByteStream& stream)
{
stream.WriteUI08(m_ObjectTypeIndication);
- AP4_UI08 bits = (m_StreamType << 2) | (m_UpStream ? 2 : 0) | 1;
+ AP4_UI08 bits = (m_StreamType<<2) | (m_UpStream? 2 : 0) | 1;
stream.WriteUI08(bits);
stream.WriteUI24(m_BufferSize);
stream.WriteUI32(m_MaxBitrate);
@@ -134,9 +132,9 @@ AP4_Result
AP4_DecoderConfigDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(),
- m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),
+ m_PayloadSize);
inspector.StartElement("[DecoderConfig]", info);
inspector.AddField("stream_type", m_StreamType);
inspector.AddField("object_type", m_ObjectTypeIndication);
@@ -161,17 +159,14 @@ AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor() const
{
// find the decoder specific info
AP4_Descriptor* descriptor = NULL;
- AP4_Result result =
+ AP4_Result result =
m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO),
descriptor);
-
+
// return it
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
return AP4_DYNAMIC_CAST(AP4_DecoderSpecificInfoDescriptor, descriptor);
- }
- else
- {
+ } else {
return NULL;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
index 2b3298407..831bbf9e5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - DecoderConfig Descriptor
+| AP4 - DecoderConfig Descriptor
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -52,7 +52,7 @@ const AP4_UI08 AP4_DESCRIPTOR_TAG_DECODER_CONFIG = 0x04;
+---------------------------------------------------------------------*/
class AP4_DecoderConfigDescriptor : public AP4_Descriptor
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_DecoderConfigDescriptor, AP4_Descriptor)
// methods
@@ -62,38 +62,25 @@ public:
AP4_UI32 max_bitrate,
AP4_UI32 avg_bitrate,
AP4_DecoderSpecificInfoDescriptor* dsi);
- AP4_DecoderConfigDescriptor(AP4_ByteStream& stream,
+ AP4_DecoderConfigDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size);
virtual ~AP4_DecoderConfigDescriptor();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
-
+
// accessors
virtual const AP4_DecoderSpecificInfoDescriptor*
- GetDecoderSpecificInfoDescriptor() const;
- virtual AP4_UI08 GetObjectTypeIndication() const
- {
- return m_ObjectTypeIndication;
- }
- virtual AP4_UI08 GetStreamType() const
- {
- return m_StreamType;
- }
- virtual AP4_UI32 GetBufferSize() const
- {
- return m_BufferSize;
+ GetDecoderSpecificInfoDescriptor() const;
+ virtual AP4_UI08 GetObjectTypeIndication() const {
+ return m_ObjectTypeIndication;
}
- virtual AP4_UI32 GetMaxBitrate() const
- {
- return m_MaxBitrate;
- }
- virtual AP4_UI32 GetAvgBitrate() const
- {
- return m_AverageBitrate;
- }
-
-private:
+ virtual AP4_UI08 GetStreamType() const { return m_StreamType; }
+ virtual AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ virtual AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ virtual AP4_UI32 GetAvgBitrate() const { return m_AverageBitrate; }
+
+ private:
// members
AP4_UI08 m_StreamType;
AP4_UI08 m_ObjectTypeIndication;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
index 68892c1c5..8c755964f 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
@@ -45,8 +45,8 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_DecoderSpecificInfoDescriptor)
+---------------------------------------------------------------------*/
AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
const AP4_DataBuffer& data) :
- AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
- MinHeaderSize(data.GetDataSize()),
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
+ MinHeaderSize(data.GetDataSize()),
data.GetDataSize()),
m_Info(data)
{
@@ -57,11 +57,11 @@ AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
+---------------------------------------------------------------------*/
AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
- AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
header_size, payload_size)
{
m_Info.SetDataSize(payload_size);
- stream.Read(m_Info.UseData(), payload_size);
+ stream.Read(m_Info.UseData(), payload_size);
}
/*----------------------------------------------------------------------
@@ -78,8 +78,7 @@ AP4_Result
AP4_DecoderSpecificInfoDescriptor::WriteFields(AP4_ByteStream& stream)
{
// write the info buffer
- if(m_PayloadSize && m_Info.GetDataSize())
- {
+ if (m_PayloadSize && m_Info.GetDataSize()) {
stream.Write(m_Info.GetData(), m_Info.GetDataSize());
}
@@ -93,10 +92,9 @@ AP4_Result
AP4_DecoderSpecificInfoDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char* info = new char[m_Info.GetDataSize()*3+1];
- for(unsigned int i = 0; i < m_Info.GetDataSize(); i++)
- {
- AP4_FormatString(&info[i*3], 4, "%02x ", m_Info.UseData()[i]);
- }
+ for (unsigned int i=0; i<m_Info.GetDataSize(); i++) {
+ AP4_FormatString(&info[i*3], 4, "%02x ", m_Info.UseData()[i]);
+ }
info[m_Info.GetDataSize()*3] = '\0';
inspector.AddField("[DecoderSpecificInfo]", info);
delete[] info;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
index b20648053..8f0611c12 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - DecoderSpecificInfo Descriptor
+| AP4 - DecoderSpecificInfo Descriptor
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -57,16 +57,13 @@ public:
// methods
AP4_DecoderSpecificInfoDescriptor(const AP4_DataBuffer& data);
- AP4_DecoderSpecificInfoDescriptor(AP4_ByteStream& stream,
+ AP4_DecoderSpecificInfoDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size);
virtual ~AP4_DecoderSpecificInfoDescriptor();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
- virtual const AP4_DataBuffer& GetDecoderSpecificInfo() const
- {
- return m_Info;
- }
+ virtual const AP4_DataBuffer& GetDecoderSpecificInfo() const { return m_Info; }
private:
// members
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.cpp
index 699c7f9f3..38fb28988 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.cpp
@@ -61,13 +61,13 @@ AP4_Descriptor::Inspect(AP4_AtomInspector& inspector)
| AP4_UnknownDescriptor::AP4_UnknownDescriptor
+---------------------------------------------------------------------*/
AP4_UnknownDescriptor::AP4_UnknownDescriptor(AP4_ByteStream& stream,
- AP4_UI08 tag,
- AP4_Size header_size,
- AP4_Size payload_size) :
+ AP4_UI08 tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_Descriptor(tag, header_size, payload_size)
{
m_Data.SetDataSize(payload_size);
- stream.Read(m_Data.UseData(), payload_size);
+ stream.Read(m_Data.UseData(), payload_size);
}
/*----------------------------------------------------------------------
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.h
index d66daa2bb..7fe0717a1 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Descriptor.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Descriptors
+| AP4 - Descriptors
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -47,9 +47,9 @@ class AP4_AtomInspector;
+---------------------------------------------------------------------*/
class AP4_Descriptor : public AP4_Expandable
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST(AP4_Descriptor)
-
+
// constructor
AP4_Descriptor(AP4_UI08 tag, AP4_Size header_size, AP4_Size payload_size) :
AP4_Expandable(tag, CLASS_ID_SIZE_08, header_size, payload_size) {}
@@ -58,10 +58,7 @@ public:
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// methods
- AP4_UI08 GetTag()
- {
- return (AP4_UI08)m_ClassId;
- }
+ AP4_UI08 GetTag() { return (AP4_UI08)m_ClassId; }
};
/*----------------------------------------------------------------------
@@ -71,14 +68,14 @@ class AP4_UnknownDescriptor : public AP4_Descriptor
{
public:
// contrusctor
- AP4_UnknownDescriptor(AP4_ByteStream& stream,
+ AP4_UnknownDescriptor(AP4_ByteStream& stream,
AP4_UI08 tag,
AP4_Size header_size,
AP4_Size payload_size);
-
+
// AP4_Expandable methods
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
private:
// members
AP4_DataBuffer m_Data;
@@ -89,14 +86,13 @@ private:
+---------------------------------------------------------------------*/
class AP4_DescriptorFinder : public AP4_List<AP4_Descriptor>::Item::Finder
{
-public:
+ public:
AP4_DescriptorFinder(AP4_UI08 tag) : m_Tag(tag) {}
- AP4_Result Test(AP4_Descriptor* descriptor) const
- {
+ AP4_Result Test(AP4_Descriptor* descriptor) const {
return descriptor->GetTag() == m_Tag ? AP4_SUCCESS : AP4_FAILURE;
}
-
-private:
+
+ private:
AP4_UI08 m_Tag;
};
@@ -107,9 +103,8 @@ class AP4_DescriptorListWriter : public AP4_List<AP4_Descriptor>::Item::Operator
{
public:
AP4_DescriptorListWriter(AP4_ByteStream& stream) :
- m_Stream(stream) {}
- AP4_Result Action(AP4_Descriptor* descriptor) const
- {
+ m_Stream(stream) {}
+ AP4_Result Action(AP4_Descriptor* descriptor) const {
return descriptor->Write(m_Stream);
}
@@ -122,16 +117,15 @@ private:
+---------------------------------------------------------------------*/
class AP4_DescriptorListInspector : public AP4_List<AP4_Descriptor>::Item::Operator
{
-public:
+ public:
AP4_DescriptorListInspector(AP4_AtomInspector& inspector) :
m_Inspector(inspector) {}
- AP4_Result Action(AP4_Descriptor* descriptor) const
- {
+ AP4_Result Action(AP4_Descriptor* descriptor) const {
descriptor->Inspect(m_Inspector);
return AP4_SUCCESS;
}
-private:
+ private:
AP4_AtomInspector& m_Inspector;
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp
index a36f16f60..331a2bc23 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp
@@ -42,8 +42,8 @@
| AP4_DescriptorFactory::CreateDescriptorFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream,
- AP4_Descriptor*& descriptor)
+AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream,
+ AP4_Descriptor*& descriptor)
{
AP4_Result result;
@@ -57,83 +57,78 @@ AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream,
// read descriptor tag
unsigned char tag;
result = stream.ReadUI08(tag);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
stream.Seek(offset);
return result;
}
-
+
// read descriptor size
unsigned long payload_size = 0;
unsigned int header_size = 1;
unsigned int max = 4;
unsigned char ext = 0;
- do
- {
+ do {
header_size++;
result = stream.ReadUI08(ext);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
stream.Seek(offset);
return result;
}
- payload_size = (payload_size << 7) + (ext & 0x7F);
- }
- while(--max && (ext & 0x80));
+ payload_size = (payload_size<<7) + (ext&0x7F);
+ } while (--max && (ext&0x80));
// create the descriptor
- switch(tag)
- {
- case AP4_DESCRIPTOR_TAG_OD:
- case AP4_DESCRIPTOR_TAG_MP4_OD:
+ switch (tag) {
+ case AP4_DESCRIPTOR_TAG_OD:
+ case AP4_DESCRIPTOR_TAG_MP4_OD:
descriptor = new AP4_ObjectDescriptor(stream, tag, header_size, payload_size);
break;
- case AP4_DESCRIPTOR_TAG_IOD:
- case AP4_DESCRIPTOR_TAG_MP4_IOD:
+ case AP4_DESCRIPTOR_TAG_IOD:
+ case AP4_DESCRIPTOR_TAG_MP4_IOD:
descriptor = new AP4_InitialObjectDescriptor(stream, tag, header_size, payload_size);
break;
- case AP4_DESCRIPTOR_TAG_ES_ID_INC:
+ case AP4_DESCRIPTOR_TAG_ES_ID_INC:
descriptor = new AP4_EsIdIncDescriptor(stream, header_size, payload_size);
break;
- case AP4_DESCRIPTOR_TAG_ES_ID_REF:
+ case AP4_DESCRIPTOR_TAG_ES_ID_REF:
descriptor = new AP4_EsIdRefDescriptor(stream, header_size, payload_size);
break;
-
- case AP4_DESCRIPTOR_TAG_ES:
+
+ case AP4_DESCRIPTOR_TAG_ES:
descriptor = new AP4_EsDescriptor(stream, header_size, payload_size);
break;
- case AP4_DESCRIPTOR_TAG_DECODER_CONFIG:
+ case AP4_DESCRIPTOR_TAG_DECODER_CONFIG:
descriptor = new AP4_DecoderConfigDescriptor(stream, header_size, payload_size);
break;
- case AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO:
- descriptor = new AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size);
- break;
-
- case AP4_DESCRIPTOR_TAG_SL_CONFIG:
- if(payload_size != 1) return AP4_ERROR_INVALID_FORMAT;
+ case AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO:
+ descriptor = new AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_SL_CONFIG:
+ if (payload_size != 1) return AP4_ERROR_INVALID_FORMAT;
descriptor = new AP4_SLConfigDescriptor(header_size);
break;
- case AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR_POINTER:
+ case AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR_POINTER:
descriptor = new AP4_IpmpDescriptorPointer(stream, header_size, payload_size);
break;
-
- case AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR:
+
+ case AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR:
descriptor = new AP4_IpmpDescriptor(stream, header_size, payload_size);
break;
- default:
+ default:
descriptor = new AP4_UnknownDescriptor(stream, tag, header_size, payload_size);
break;
}
// skip to the end of the descriptor
- stream.Seek(offset + header_size + payload_size);
+ stream.Seek(offset+header_size+payload_size);
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.h
index f76b2fbf5..9fe8bd0c8 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DescriptorFactory.h
@@ -43,12 +43,12 @@ class AP4_Descriptor;
/*----------------------------------------------------------------------
| AP4_DescriptorFactory
+---------------------------------------------------------------------*/
-class AP4_DescriptorFactory
+class AP4_DescriptorFactory
{
-public:
+ public:
// class methods
static AP4_Result CreateDescriptorFromStream(AP4_ByteStream& stream,
- AP4_Descriptor*& descriptor);
+ AP4_Descriptor*& descriptor);
};
#endif // _AP4_DESCRIPTOR_FACTORY_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.cpp
index f8fd54bc1..df83ecc1e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - dref Atoms
+| AP4 - dref Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -37,15 +37,15 @@
/*----------------------------------------------------------------------
| AP4_DrefAtom::Create
+---------------------------------------------------------------------*/
-AP4_DrefAtom*
+AP4_DrefAtom*
AP4_DrefAtom::Create(AP4_UI32 size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_DrefAtom(size, version, flags, stream, atom_factory);
}
@@ -56,8 +56,7 @@ AP4_DrefAtom::AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count) :
AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, (AP4_UI32)0, (AP4_UI32)0)
{
m_Size32 += 4;
- for(unsigned i = 0; i < refs_count; i++)
- {
+ for (unsigned i=0; i<refs_count; i++) {
m_Children.Add(refs[i]);
m_Size32 += (AP4_UI32)refs[i]->GetSize();
}
@@ -78,14 +77,12 @@ AP4_DrefAtom::AP4_DrefAtom(AP4_UI32 size,
stream.ReadUI32(entry_count);
// read children
- AP4_LargeSize bytes_available = size - AP4_FULL_ATOM_HEADER_SIZE - 4;
- while(entry_count--)
- {
- AP4_Atom* atom;
- while(AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
- bytes_available,
- atom)))
- {
+ AP4_LargeSize bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom))) {
m_Children.Add(atom);
}
}
@@ -101,7 +98,7 @@ AP4_DrefAtom::WriteFields(AP4_ByteStream& stream)
// write the number of entries
result = stream.WriteUI32(m_Children.ItemCount());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the children
return m_Children.Apply(AP4_AtomListWriter(stream));
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.h
index 8a248bc93..092e959db 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4DrefAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - dref Atoms
+| AP4 - dref Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.cpp
index 2d8f4ff81..73a2c0920 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - elst Atoms
+| AP4 - elst Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -40,15 +40,15 @@ AP4_ElstAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 1) return NULL;
return new AP4_ElstAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_ElstAtom::AP4_ElstAtom
+---------------------------------------------------------------------*/
-AP4_ElstAtom::AP4_ElstAtom(AP4_UI32 size,
+AP4_ElstAtom::AP4_ElstAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -57,12 +57,10 @@ AP4_ElstAtom::AP4_ElstAtom(AP4_UI32 size,
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
m_Entries.EnsureCapacity(entry_count);
- for(AP4_UI32 i = 0; i < entry_count; i++)
- {
+ for (AP4_UI32 i=0; i<entry_count; i++) {
AP4_UI16 media_rate;
AP4_UI16 zero;
- if(version == 0)
- {
+ if (version == 0) {
AP4_UI32 segment_duration;
AP4_UI32 media_time;
stream.ReadUI32(segment_duration);
@@ -70,9 +68,7 @@ AP4_ElstAtom::AP4_ElstAtom(AP4_UI32 size,
stream.ReadUI16(media_rate);
stream.ReadUI16(zero);
m_Entries.Append(AP4_ElstEntry(segment_duration, media_time, media_rate));
- }
- else
- {
+ } else {
AP4_UI64 segment_duration;
AP4_UI64 media_time;
stream.ReadUI64(segment_duration);
@@ -91,29 +87,25 @@ AP4_Result
AP4_ElstAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
result = stream.WriteUI32(m_Entries.ItemCount());
- if(AP4_FAILED(result)) return result;
- for(AP4_Ordinal i = 0; i < m_Entries.ItemCount(); i++)
- {
- if(m_Version == 0)
- {
+ if (AP4_FAILED(result)) return result;
+ for (AP4_Ordinal i=0; i<m_Entries.ItemCount(); i++) {
+ if (m_Version == 0) {
result = stream.WriteUI32((AP4_UI32)m_Entries[i].m_SegmentDuration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_Entries[i].m_MediaTime);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
result = stream.WriteUI64(m_Entries[i].m_SegmentDuration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_Entries[i].m_MediaTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
result = stream.WriteUI16(m_Entries[i].m_MediaRate);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(0);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
@@ -126,8 +118,7 @@ AP4_Result
AP4_ElstAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry count", m_Entries.ItemCount());
- for(AP4_Ordinal i = 0; i < m_Entries.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<m_Entries.ItemCount(); i++) {
inspector.AddField("entry/segment duration", (AP4_UI32)m_Entries[i].m_SegmentDuration);
inspector.AddField("entry/media time", (AP4_SI32)m_Entries[i].m_MediaTime);
inspector.AddField("entry/media rate", (AP4_UI16)m_Entries[i].m_MediaRate);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.h
index 7c1c76670..d613bf6bd 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ElstAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - elst Atoms
+| AP4 - elst Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -44,13 +44,12 @@ class AP4_ByteStream;
/*----------------------------------------------------------------------
| AP4_ElstAtom
+---------------------------------------------------------------------*/
-class AP4_ElstEntry
-{
+class AP4_ElstEntry {
public:
AP4_ElstEntry(AP4_UI64 segment_duration = 0, AP4_SI64 media_time = 0, AP4_UI16 media_rate = 1) :
- m_SegmentDuration(segment_duration),
- m_MediaTime(media_time),
- m_MediaRate(media_rate) {}
+ m_SegmentDuration(segment_duration),
+ m_MediaTime(media_time),
+ m_MediaRate(media_rate) {}
AP4_UI64 m_SegmentDuration;
AP4_SI64 m_MediaTime;
@@ -66,12 +65,12 @@ public:
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
private:
// methods
- AP4_ElstAtom(AP4_UI32 size,
- AP4_UI32 version,
- AP4_UI32 flags,
+ AP4_ElstAtom(AP4_UI32 size,
+ AP4_UI32 version,
+ AP4_UI32 flags,
AP4_ByteStream& stream);
// members
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.cpp
index 04bff732d..065d6f513 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.cpp
@@ -46,7 +46,7 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_EsIdRefDescriptor)
| AP4_EsDescriptor::AP4_EsDescriptor
+---------------------------------------------------------------------*/
AP4_EsDescriptor::AP4_EsDescriptor(AP4_UI16 es_id) :
- AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, 2, 2 + 1),
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, 2, 2+1),
m_EsId(es_id),
m_OcrEsId(0),
m_Flags(0),
@@ -58,7 +58,7 @@ AP4_EsDescriptor::AP4_EsDescriptor(AP4_UI16 es_id) :
/*----------------------------------------------------------------------
| AP4_EsDescriptor::AP4_EsDescriptor
+---------------------------------------------------------------------*/
-AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
+AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, header_size, payload_size)
@@ -70,25 +70,19 @@ AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
stream.ReadUI16(m_EsId);
unsigned char bits;
stream.ReadUI08(bits);
- m_Flags = (bits >> 5) & 7;
- m_StreamPriority = bits & 0x1F;
- if(m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY)
- {
+ m_Flags = (bits>>5)&7;
+ m_StreamPriority = bits&0x1F;
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
stream.ReadUI16(m_DependsOn);
- }
- else
- {
+ } else {
m_DependsOn = 0;
}
- if(m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL)
- {
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
unsigned char url_length;
stream.ReadUI08(url_length);
- if(url_length)
- {
+ if (url_length) {
char* url = new char[url_length+1];
- if(url)
- {
+ if (url) {
stream.Read(url, url_length);
url[url_length] = '\0';
m_Url = url;
@@ -96,25 +90,21 @@ AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
}
}
}
- if(m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL)
- {
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
stream.ReadUI16(m_OcrEsId);
- }
- else
- {
+ } else {
m_OcrEsId = 0;
}
// read other descriptors
AP4_Position offset;
stream.Tell(offset);
- AP4_SubStream* substream = new AP4_SubStream(stream, offset,
- payload_size - AP4_Size(offset - start));
+ AP4_SubStream* substream = new AP4_SubStream(stream, offset,
+ payload_size-AP4_Size(offset-start));
AP4_Descriptor* descriptor = NULL;
- while(AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
- descriptor)
- == AP4_SUCCESS)
- {
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
m_SubDescriptors.Add(descriptor);
}
substream->Release();
@@ -138,32 +128,29 @@ AP4_EsDescriptor::WriteFields(AP4_ByteStream& stream)
// es id
result = stream.WriteUI16(m_EsId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// flags and other bits
- AP4_UI08 bits = m_StreamPriority | (AP4_UI08)(m_Flags << 5);
+ AP4_UI08 bits = m_StreamPriority | (AP4_UI08)(m_Flags<<5);
result = stream.WriteUI08(bits);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// optional fields
- if(m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY)
- {
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
result = stream.WriteUI16(m_DependsOn);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL)
- {
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
result = stream.WriteUI08((AP4_UI08)m_Url.GetLength());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteString(m_Url.GetChars());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(0);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM)
- {
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM) {
result = stream.WriteUI16(m_OcrEsId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// write the sub descriptors
@@ -179,8 +166,8 @@ AP4_Result
AP4_EsDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[ESDescriptor]", info);
inspector.AddField("es_id", m_EsId);
inspector.AddField("stream_priority", m_StreamPriority);
@@ -213,17 +200,14 @@ AP4_EsDescriptor::GetDecoderConfigDescriptor() const
{
// find the decoder config descriptor
AP4_Descriptor* descriptor = NULL;
- AP4_Result result =
+ AP4_Result result =
m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_CONFIG),
descriptor);
-
+
// return it
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
return AP4_DYNAMIC_CAST(AP4_DecoderConfigDescriptor, descriptor);
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -240,9 +224,9 @@ AP4_EsIdIncDescriptor::AP4_EsIdIncDescriptor(AP4_UI32 track_id) :
/*----------------------------------------------------------------------
| AP4_EsIdIncDescriptor::AP4_EsIdIncDescriptor
+---------------------------------------------------------------------*/
-AP4_EsIdIncDescriptor::AP4_EsIdIncDescriptor(AP4_ByteStream& stream,
- AP4_Size header_size,
- AP4_Size payload_size) :
+AP4_EsIdIncDescriptor::AP4_EsIdIncDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES_ID_INC, header_size, payload_size)
{
// read the track id
@@ -266,12 +250,12 @@ AP4_Result
AP4_EsIdIncDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[ES_ID_Inc]", info);
inspector.AddField("track_id", m_TrackId);
inspector.EndElement();
-
+
return AP4_SUCCESS;
}
@@ -287,9 +271,9 @@ AP4_EsIdRefDescriptor::AP4_EsIdRefDescriptor(AP4_UI16 ref_index) :
/*----------------------------------------------------------------------
| AP4_EsIdRefDescriptor::AP4_EsIdRefDescriptor
+---------------------------------------------------------------------*/
-AP4_EsIdRefDescriptor::AP4_EsIdRefDescriptor(AP4_ByteStream& stream,
- AP4_Size header_size,
- AP4_Size payload_size) :
+AP4_EsIdRefDescriptor::AP4_EsIdRefDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES_ID_REF, header_size, payload_size)
{
// read the ref index
@@ -313,11 +297,11 @@ AP4_Result
AP4_EsIdRefDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[ES_ID_Ref]", info);
inspector.AddField("ref_index", m_RefIndex);
inspector.EndElement();
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.h
index 584d79a60..d971e7e05 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsDescriptor.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ES Descriptor
+| AP4 - ES Descriptor
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -58,21 +58,21 @@ const int AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM = 4;
+---------------------------------------------------------------------*/
class AP4_EsDescriptor : public AP4_Descriptor
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_EsDescriptor, AP4_Descriptor)
// methods
AP4_EsDescriptor(AP4_UI16 es_id);
- AP4_EsDescriptor(AP4_ByteStream& stream,
- AP4_Size header_size,
+ AP4_EsDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
AP4_Size payload_size);
~AP4_EsDescriptor();
virtual AP4_Result AddSubDescriptor(AP4_Descriptor* descriptor);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
- virtual const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor() const;
+ virtual const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor() const;
-private:
+ private:
// members
unsigned short m_EsId;
unsigned short m_OcrEsId;
@@ -88,24 +88,21 @@ private:
+---------------------------------------------------------------------*/
class AP4_EsIdIncDescriptor : public AP4_Descriptor
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_EsIdIncDescriptor, AP4_Descriptor)
// methods
AP4_EsIdIncDescriptor(AP4_UI32 track_id);
- AP4_EsIdIncDescriptor(AP4_ByteStream& stream,
- AP4_Size header_size,
+ AP4_EsIdIncDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
AP4_Size payload_size);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
- AP4_UI32 GetTrackId() const
- {
- return m_TrackId;
- }
-
-private:
+ AP4_UI32 GetTrackId() const { return m_TrackId; }
+
+ private:
// members
AP4_UI32 m_TrackId;
};
@@ -115,24 +112,21 @@ private:
+---------------------------------------------------------------------*/
class AP4_EsIdRefDescriptor : public AP4_Descriptor
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_EsIdRefDescriptor, AP4_Descriptor)
// methods
AP4_EsIdRefDescriptor(AP4_UI16 ref_index);
- AP4_EsIdRefDescriptor(AP4_ByteStream& stream,
- AP4_Size header_size,
+ AP4_EsIdRefDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
AP4_Size payload_size);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
- AP4_UI16 GetRefIndex() const
- {
- return m_RefIndex;
- }
-
-private:
+ AP4_UI16 GetRefIndex() const { return m_RefIndex; }
+
+ private:
// members
AP4_UI16 m_RefIndex;
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.cpp
index c2937eef6..b03e73a91 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - esds Atoms
+| AP4 - esds Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_EsdsAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_EsdsAtom(size, version, flags, stream);
}
@@ -58,13 +58,13 @@ AP4_EsdsAtom::AP4_EsdsAtom(AP4_EsDescriptor* descriptor) :
AP4_Atom(AP4_ATOM_TYPE_ESDS, AP4_FULL_ATOM_HEADER_SIZE, 0, 0),
m_EsDescriptor(descriptor)
{
- if(m_EsDescriptor) m_Size32 += m_EsDescriptor->GetSize();
+ if (m_EsDescriptor) m_Size32 += m_EsDescriptor->GetSize();
}
/*----------------------------------------------------------------------
| AP4_EsdsAtom::AP4_EsdsAtom
+---------------------------------------------------------------------*/
-AP4_EsdsAtom::AP4_EsdsAtom(AP4_UI32 size,
+AP4_EsdsAtom::AP4_EsdsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -72,13 +72,10 @@ AP4_EsdsAtom::AP4_EsdsAtom(AP4_UI32 size,
{
// read descriptor
AP4_Descriptor* descriptor = NULL;
- if(AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor)
- == AP4_SUCCESS)
- {
+ if (AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor)
+ == AP4_SUCCESS) {
m_EsDescriptor = AP4_DYNAMIC_CAST(AP4_EsDescriptor, descriptor);
- }
- else
- {
+ } else {
m_EsDescriptor = NULL;
}
}
@@ -98,7 +95,7 @@ AP4_Result
AP4_EsdsAtom::WriteFields(AP4_ByteStream& stream)
{
// write the es descriptor
- if(m_EsDescriptor) return m_EsDescriptor->Write(stream);
+ if (m_EsDescriptor) return m_EsDescriptor->Write(stream);
return AP4_SUCCESS;
}
@@ -110,8 +107,7 @@ AP4_Result
AP4_EsdsAtom::InspectFields(AP4_AtomInspector& inspector)
{
// inspect descriptor
- if(m_EsDescriptor)
- {
+ if (m_EsDescriptor) {
m_EsDescriptor->Inspect(inspector);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.h
index 2eeff20a8..962f9e2c3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4EsdsAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - esds Atoms
+| AP4 - esds Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -54,17 +54,14 @@ public:
// methods
AP4_EsdsAtom(AP4_EsDescriptor* descriptor);
- ~AP4_EsdsAtom();
+ ~AP4_EsdsAtom();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
- const AP4_EsDescriptor* GetEsDescriptor() const
- {
- return m_EsDescriptor;
- }
+ const AP4_EsDescriptor* GetEsDescriptor() const { return m_EsDescriptor; }
private:
// methods
- AP4_EsdsAtom(AP4_UI32 size,
+ AP4_EsdsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.cpp
index d6a5d1373..a0fa39601 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.cpp
@@ -42,23 +42,23 @@ AP4_Expandable::MinHeaderSize(AP4_Size payload_size)
{
// compute how many bytes are needed to encode the payload size
// plus tag
- return 2 + (payload_size / 128);
+ return 2+(payload_size/128);
}
/*----------------------------------------------------------------------
| AP4_Expandable::AP4_Expandable
+---------------------------------------------------------------------*/
AP4_Expandable::AP4_Expandable(AP4_UI32 class_id,
- ClassIdSize class_id_size,
- AP4_Size header_size,
+ ClassIdSize class_id_size,
+ AP4_Size header_size,
AP4_Size payload_size) :
m_ClassId(class_id),
m_ClassIdSize(class_id_size),
m_HeaderSize(header_size),
m_PayloadSize(payload_size)
{
- AP4_ASSERT(header_size >= 1 + 1);
- AP4_ASSERT(header_size <= 1 + 4);
+ AP4_ASSERT(header_size >= 1+1);
+ AP4_ASSERT(header_size <= 1+4);
}
/*----------------------------------------------------------------------
@@ -70,38 +70,36 @@ AP4_Expandable::Write(AP4_ByteStream& stream)
AP4_Result result;
// write the class id
- switch(m_ClassIdSize)
- {
- case CLASS_ID_SIZE_08:
- result = stream.WriteUI08((AP4_UI08)m_ClassId);
- if(AP4_FAILED(result)) return result;
- break;
-
- default:
- return AP4_ERROR_INTERNAL;
+ switch (m_ClassIdSize) {
+ case CLASS_ID_SIZE_08:
+ result = stream.WriteUI08((AP4_UI08)m_ClassId);
+ if (AP4_FAILED(result)) return result;
+ break;
+
+ default:
+ return AP4_ERROR_INTERNAL;
}
-
+
// write the size
- AP4_ASSERT(m_HeaderSize - 1 <= 8);
+ AP4_ASSERT(m_HeaderSize-1 <= 8);
AP4_ASSERT(m_HeaderSize >= 2);
unsigned int size = m_PayloadSize;
unsigned char bytes[8];
// last bytes of the encoded size
- bytes[m_HeaderSize-2] = size & 0x7F;
+ bytes[m_HeaderSize-2] = size&0x7F;
// leading bytes of the encoded size
- for(int i = m_HeaderSize - 3; i >= 0; i--)
- {
+ for (int i=m_HeaderSize-3; i>=0; i--) {
// move to the next 7 bits
size >>= 7;
// output a byte with a top bit marker
- bytes[i] = (size & 0x7F) | 0x80;
+ bytes[i] = (size&0x7F) | 0x80;
}
- result = stream.Write(bytes, m_HeaderSize - 1);
- if(AP4_FAILED(result)) return result;
+ result = stream.Write(bytes, m_HeaderSize-1);
+ if (AP4_FAILED(result)) return result;
// write the fields
WriteFields(stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.h
index beba263f0..63949eeb5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Expandable.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Expandable base class
+| AP4 - Expandable base class
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,39 +46,29 @@ class AP4_AtomInspector;
+---------------------------------------------------------------------*/
class AP4_Expandable
{
-public:
+ public:
// types
- enum ClassIdSize
- {
+ enum ClassIdSize {
CLASS_ID_SIZE_08
};
-
+
// class methods
static AP4_Size MinHeaderSize(AP4_Size payload_size);
// methods
- AP4_Expandable(AP4_UI32 class_id,
- ClassIdSize class_id_size,
- AP4_Size header_size,
+ AP4_Expandable(AP4_UI32 class_id,
+ ClassIdSize class_id_size,
+ AP4_Size header_size,
AP4_Size payload_size);
virtual ~AP4_Expandable() {}
- AP4_UI32 GetClassId()
- {
- return m_ClassId;
- }
- AP4_Size GetSize()
- {
- return m_PayloadSize + m_HeaderSize;
- }
- AP4_Size GetHeaderSize()
- {
- return m_HeaderSize;
- }
+ AP4_UI32 GetClassId() { return m_ClassId; }
+ AP4_Size GetSize() { return m_PayloadSize+m_HeaderSize; }
+ AP4_Size GetHeaderSize() { return m_HeaderSize; }
virtual AP4_Result Write(AP4_ByteStream& stream);
virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
-protected:
+ protected:
// members
AP4_UI32 m_ClassId;
ClassIdSize m_ClassIdSize;
@@ -89,17 +79,17 @@ protected:
/*----------------------------------------------------------------------
| AP4_UnknownExpandable
+---------------------------------------------------------------------*/
-class AP4_UnknownExpandable : public AP4_Expandable
+class AP4_UnknownExpandable : public AP4_Expandable
{
public:
// methods
- AP4_UnknownExpandable(AP4_ByteStream& stream,
+ AP4_UnknownExpandable(AP4_ByteStream& stream,
AP4_UI32 class_id,
ClassIdSize class_id_size,
AP4_Size header_size,
AP4_Size payload_size);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
private:
// members
AP4_DataBuffer m_Data;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.cpp
index d8bfe3ddc..baedd893a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.cpp
@@ -53,7 +53,7 @@ AP4_File::AP4_File(AP4_Movie* movie) :
/*----------------------------------------------------------------------
| AP4_File::AP4_File
+---------------------------------------------------------------------*/
-AP4_File::AP4_File(AP4_ByteStream& stream,
+AP4_File::AP4_File(AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory,
bool moov_only) :
m_Movie(NULL),
@@ -65,30 +65,28 @@ AP4_File::AP4_File(AP4_ByteStream& stream,
AP4_Atom* atom;
AP4_Position stream_position;
bool keep_parsing = true;
- while(keep_parsing &&
- AP4_SUCCEEDED(stream.Tell(stream_position)) &&
- AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom)))
- {
+ while (keep_parsing &&
+ AP4_SUCCEEDED(stream.Tell(stream_position)) &&
+ AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
AddChild(atom);
- switch(atom->GetType())
- {
- case AP4_ATOM_TYPE_MOOV:
- m_Movie = new AP4_Movie(AP4_DYNAMIC_CAST(AP4_MoovAtom, atom), stream, false);
- if(moov_only) keep_parsing = false;
- break;
+ switch (atom->GetType()) {
+ case AP4_ATOM_TYPE_MOOV:
+ m_Movie = new AP4_Movie(AP4_DYNAMIC_CAST(AP4_MoovAtom, atom), stream, false);
+ if (moov_only) keep_parsing = false;
+ break;
- case AP4_ATOM_TYPE_FTYP:
- m_FileType = AP4_DYNAMIC_CAST(AP4_FtypAtom, atom);
- break;
+ case AP4_ATOM_TYPE_FTYP:
+ m_FileType = AP4_DYNAMIC_CAST(AP4_FtypAtom, atom);
+ break;
- case AP4_ATOM_TYPE_MDAT:
- // see if we are before the moov atom
- if(m_Movie == NULL) m_MoovIsBeforeMdat = false;
- break;
+ case AP4_ATOM_TYPE_MDAT:
+ // see if we are before the moov atom
+ if (m_Movie == NULL) m_MoovIsBeforeMdat = false;
+ break;
}
}
}
-
+
/*----------------------------------------------------------------------
| AP4_File::~AP4_File
+---------------------------------------------------------------------*/
@@ -105,7 +103,7 @@ AP4_Result
AP4_File::Inspect(AP4_AtomInspector& inspector)
{
// dump the moov atom first
- if(m_Movie) m_Movie->Inspect(inspector);
+ if (m_Movie) m_Movie->Inspect(inspector);
// dump the other atoms
m_Children.Apply(AP4_AtomListInspector(inspector));
@@ -122,17 +120,16 @@ AP4_File::SetFileType(AP4_UI32 major_brand,
AP4_UI32* compatible_brands,
AP4_Cardinal compatible_brand_count)
{
- if(m_FileType)
- {
+ if (m_FileType) {
RemoveChild(m_FileType);
delete m_FileType;
}
- m_FileType = new AP4_FtypAtom(major_brand,
+ m_FileType = new AP4_FtypAtom(major_brand,
minor_version,
compatible_brands,
compatible_brand_count);
AddChild(m_FileType, 0);
-
+
return AP4_SUCCESS;
}
@@ -142,8 +139,7 @@ AP4_File::SetFileType(AP4_UI32 major_brand,
const AP4_MetaData*
AP4_File::GetMetaData()
{
- if(m_MetaData == NULL)
- {
+ if (m_MetaData == NULL) {
m_MetaData = new AP4_MetaData(this);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.h
index 94364e968..180c31819 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4File.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - File
+| AP4 - File
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -48,20 +48,20 @@ class AP4_MetaData;
/*----------------------------------------------------------------------
| file type/brands
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_FILE_BRAND_QT__ = AP4_ATOM_TYPE('q', 't', ' ', ' ');
-const AP4_UI32 AP4_FILE_BRAND_ISOM = AP4_ATOM_TYPE('i', 's', 'o', 'm');
-const AP4_UI32 AP4_FILE_BRAND_MP41 = AP4_ATOM_TYPE('m', 'p', '4', '1');
-const AP4_UI32 AP4_FILE_BRAND_MP42 = AP4_ATOM_TYPE('m', 'p', '4', '2');
-const AP4_UI32 AP4_FILE_BRAND_3GP1 = AP4_ATOM_TYPE('3', 'g', 'p', '1');
-const AP4_UI32 AP4_FILE_BRAND_3GP2 = AP4_ATOM_TYPE('3', 'g', 'p', '2');
-const AP4_UI32 AP4_FILE_BRAND_3GP3 = AP4_ATOM_TYPE('3', 'g', 'p', '3');
-const AP4_UI32 AP4_FILE_BRAND_3GP4 = AP4_ATOM_TYPE('3', 'g', 'p', '4');
-const AP4_UI32 AP4_FILE_BRAND_3GP5 = AP4_ATOM_TYPE('3', 'g', 'p', '5');
-const AP4_UI32 AP4_FILE_BRAND_3G2A = AP4_ATOM_TYPE('3', 'g', '2', 'a');
-const AP4_UI32 AP4_FILE_BRAND_MMP4 = AP4_ATOM_TYPE('m', 'm', 'p', '4');
-const AP4_UI32 AP4_FILE_BRAND_M4A_ = AP4_ATOM_TYPE('M', '4', 'A', ' ');
-const AP4_UI32 AP4_FILE_BRAND_M4P_ = AP4_ATOM_TYPE('M', '4', 'P', ' ');
-const AP4_UI32 AP4_FILE_BRAND_MJP2 = AP4_ATOM_TYPE('m', 'j', 'p', '2');
+const AP4_UI32 AP4_FILE_BRAND_QT__ = AP4_ATOM_TYPE('q','t',' ',' ');
+const AP4_UI32 AP4_FILE_BRAND_ISOM = AP4_ATOM_TYPE('i','s','o','m');
+const AP4_UI32 AP4_FILE_BRAND_MP41 = AP4_ATOM_TYPE('m','p','4','1');
+const AP4_UI32 AP4_FILE_BRAND_MP42 = AP4_ATOM_TYPE('m','p','4','2');
+const AP4_UI32 AP4_FILE_BRAND_3GP1 = AP4_ATOM_TYPE('3','g','p','1');
+const AP4_UI32 AP4_FILE_BRAND_3GP2 = AP4_ATOM_TYPE('3','g','p','2');
+const AP4_UI32 AP4_FILE_BRAND_3GP3 = AP4_ATOM_TYPE('3','g','p','3');
+const AP4_UI32 AP4_FILE_BRAND_3GP4 = AP4_ATOM_TYPE('3','g','p','4');
+const AP4_UI32 AP4_FILE_BRAND_3GP5 = AP4_ATOM_TYPE('3','g','p','5');
+const AP4_UI32 AP4_FILE_BRAND_3G2A = AP4_ATOM_TYPE('3','g','2','a');
+const AP4_UI32 AP4_FILE_BRAND_MMP4 = AP4_ATOM_TYPE('m','m','p','4');
+const AP4_UI32 AP4_FILE_BRAND_M4A_ = AP4_ATOM_TYPE('M','4','A',' ');
+const AP4_UI32 AP4_FILE_BRAND_M4P_ = AP4_ATOM_TYPE('M','4','P',' ');
+const AP4_UI32 AP4_FILE_BRAND_MJP2 = AP4_ATOM_TYPE('m','j','p','2');
/*----------------------------------------------------------------------
| AP4_File
@@ -71,8 +71,7 @@ const AP4_UI32 AP4_FILE_BRAND_MJP2 = AP4_ATOM_TYPE('m', 'j', 'p', '2');
* The AP4_File object is the top level object for MP4 Files.
*/
-class AP4_File : public AP4_AtomParent
-{
+class AP4_File : public AP4_AtomParent {
public:
// constructors and destructor
/**
@@ -87,64 +86,52 @@ public:
* @param factory the atom factory that will be used to parse the stream
* @param moov_only indicates whether parsing of the atoms should stop
* when the moov atom is found or if all atoms should be parsed until the
- * end of the file.
+ * end of the file.
*/
- AP4_File(AP4_ByteStream& stream,
+ AP4_File(AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory = AP4_DefaultAtomFactory::Instance,
bool moov_only = false);
/**
- * Destroys the AP4_File instance
+ * Destroys the AP4_File instance
*/
virtual ~AP4_File();
-
+
/**
* Get the top level atoms of the file
*/
- AP4_List<AP4_Atom>& GetTopLevelAtoms()
- {
- return m_Children;
- }
+ AP4_List<AP4_Atom>& GetTopLevelAtoms() { return m_Children; }
- /**
+ /**
* Get the AP4_Movie object of this file
*/
- AP4_Movie* GetMovie()
- {
- return m_Movie;
- }
-
+ AP4_Movie* GetMovie() { return m_Movie; }
+
/**
* Get the file type atom of this file
*/
- AP4_FtypAtom* GetFileType()
- {
- return m_FileType;
- }
+ AP4_FtypAtom* GetFileType() { return m_FileType; }
/**
- * Set the file type. Will internally create an AP4_Ftyp atom
- * and attach it to the file
+ * Set the file type. Will internally create an AP4_Ftyp atom
+ * and attach it to the file
*/
AP4_Result SetFileType(AP4_UI32 major_brand,
AP4_UI32 minor_version,
AP4_UI32* compatible_brands = NULL,
AP4_Cardinal compatible_brand_count = 0);
- /**
+ /**
* Ask whether the moov atom appears before the first mdat atom
*/
- bool IsMoovBeforeMdat() const
- {
- return m_MoovIsBeforeMdat;
- }
-
- /**
+ bool IsMoovBeforeMdat() const { return m_MoovIsBeforeMdat; }
+
+ /**
* Get the file's metadata description
*/
const AP4_MetaData* GetMetaData();
-
+
/**
* Inspect the content of the file with an AP4_AtomInspector
*/
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileByteStream.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileByteStream.h
index 4a43e008c..f7d82706e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileByteStream.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileByteStream.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - FileByteStream
+| AP4 - FileByteStream
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -43,8 +43,7 @@ class AP4_FileByteStream: public AP4_ByteStream
{
public:
// types
- typedef enum
- {
+ typedef enum {
STREAM_MODE_READ = 0,
STREAM_MODE_WRITE = 1,
STREAM_MODE_READ_WRITE = 2
@@ -61,10 +60,10 @@ public:
* it cannot
*/
static AP4_Result Create(const char* name, Mode mode, AP4_ByteStream*& stream);
-
+
// constructors
AP4_FileByteStream(AP4_ByteStream* delegate) : m_Delegate(delegate) {}
-
+
#if !defined(AP4_CONFIG_NO_EXCEPTIONS)
/**
* @deprecated
@@ -73,49 +72,28 @@ public:
#endif
// AP4_ByteStream methods
- AP4_Result ReadPartial(void* buffer,
- AP4_Size bytesToRead,
- AP4_Size& bytesRead)
- {
+ AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytesToRead,
+ AP4_Size& bytesRead) {
return m_Delegate->ReadPartial(buffer, bytesToRead, bytesRead);
}
- AP4_Result WritePartial(const void* buffer,
- AP4_Size bytesToWrite,
- AP4_Size& bytesWritten)
- {
+ AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytesToWrite,
+ AP4_Size& bytesWritten) {
return m_Delegate->WritePartial(buffer, bytesToWrite, bytesWritten);
}
- AP4_Result Seek(AP4_Position position)
- {
- return m_Delegate->Seek(position);
- }
- AP4_Result Tell(AP4_Position& position)
- {
- return m_Delegate->Tell(position);
- }
- AP4_Result GetSize(AP4_LargeSize& size)
- {
- return m_Delegate->GetSize(size);
- }
- AP4_Result Flush()
- {
- return m_Delegate->Flush();
- }
+ AP4_Result Seek(AP4_Position position) { return m_Delegate->Seek(position); }
+ AP4_Result Tell(AP4_Position& position) { return m_Delegate->Tell(position); }
+ AP4_Result GetSize(AP4_LargeSize& size) { return m_Delegate->GetSize(size); }
+ AP4_Result Flush() { return m_Delegate->Flush(); }
// AP4_Referenceable methods
- void AddReference()
- {
- m_Delegate->AddReference();
- }
- void Release()
- {
- m_Delegate->Release();
- }
+ void AddReference() { m_Delegate->AddReference(); }
+ void Release() { m_Delegate->Release(); }
protected:
// methods
- virtual ~AP4_FileByteStream()
- {
+ virtual ~AP4_FileByteStream() {
delete m_Delegate;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.cpp
index fdb90f82a..626763539 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.cpp
@@ -42,10 +42,9 @@ AP4_Result
AP4_FileCopier::Write(AP4_File& file, AP4_ByteStream& stream)
{
// write the top-level atoms
- for(AP4_List<AP4_Atom>::Item* item = file.GetTopLevelAtoms().FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = file.GetTopLevelAtoms().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
atom->Write(stream);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.h
index d6be4c3ff..320177eaf 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileCopier.h
@@ -43,8 +43,7 @@ class AP4_File;
/*----------------------------------------------------------------------
| AP4_FileCopier
+---------------------------------------------------------------------*/
-class AP4_FileCopier
-{
+class AP4_FileCopier {
public:
// class methods
static AP4_Result Write(AP4_File& file, AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.cpp
index 48ce0bcc1..c7e8090cc 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.cpp
@@ -50,90 +50,84 @@ AP4_FileWriter::Write(AP4_File& file, AP4_ByteStream& stream, Interleaving /* in
AP4_FtypAtom* file_type = file.GetFileType();
// write the ftyp atom (always first)
- if(file_type) file_type->Write(stream);
+ if (file_type) file_type->Write(stream);
// write the top-level atoms, except for ftyp, moov and mdat
- for(AP4_List<AP4_Atom>::Item* atom_item = file.GetChildren().FirstItem();
- atom_item;
- atom_item = atom_item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* atom_item = file.GetChildren().FirstItem();
+ atom_item;
+ atom_item = atom_item->GetNext()) {
AP4_Atom* atom = atom_item->GetData();
- if(atom->GetType() != AP4_ATOM_TYPE_MDAT &&
- atom->GetType() != AP4_ATOM_TYPE_FTYP &&
- atom->GetType() != AP4_ATOM_TYPE_MOOV)
- {
+ if (atom->GetType() != AP4_ATOM_TYPE_MDAT &&
+ atom->GetType() != AP4_ATOM_TYPE_FTYP &&
+ atom->GetType() != AP4_ATOM_TYPE_MOOV) {
atom->Write(stream);
}
}
-
+
// get the movie object (and stop if there isn't any)
AP4_Movie* movie = file.GetMovie();
- if(movie == NULL) return AP4_SUCCESS;
+ if (movie == NULL) return AP4_SUCCESS;
// see how much we've written so far
AP4_Position position;
stream.Tell(position);
-
+
// backup and recompute all the chunk offsets
- unsigned int t = 0;
+ unsigned int t=0;
AP4_Result result = AP4_SUCCESS;
AP4_UI64 mdat_size = AP4_ATOM_HEADER_SIZE;
- AP4_UI64 mdat_position = position + movie->GetMoovAtom()->GetSize();
+ AP4_UI64 mdat_position = position+movie->GetMoovAtom()->GetSize();
AP4_Array<AP4_Array<AP4_UI64>*> trak_chunk_offsets_backup;
AP4_Array<AP4_UI64> chunk_offsets;
- for(AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
- track_item;
- track_item = track_item->GetNext())
- {
+ for (AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
+ track_item;
+ track_item = track_item->GetNext()) {
AP4_Track* track = track_item->GetData();
AP4_TrakAtom* trak = track->GetTrakAtom();
-
+
// backup the chunk offsets
AP4_Array<AP4_UI64>* chunk_offsets_backup = new AP4_Array<AP4_UI64>();
trak_chunk_offsets_backup.Append(chunk_offsets_backup);
result = trak->GetChunkOffsets(*chunk_offsets_backup);
- if(AP4_FAILED(result)) goto end;
+ if (AP4_FAILED(result)) goto end;
// allocate space for the new chunk offsets
chunk_offsets.SetItemCount(chunk_offsets_backup->ItemCount());
-
+
// compute the new chunk offsets
AP4_Cardinal sample_count = track->GetSampleCount();
AP4_SampleTable* sample_table = track->GetSampleTable();
AP4_Sample sample;
- for(AP4_Ordinal i = 0; i < sample_count; i++)
- {
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
AP4_Ordinal chunk_index = 0;
AP4_Ordinal position_in_chunk = 0;
sample_table->GetSampleChunkPosition(i, chunk_index, position_in_chunk);
sample_table->GetSample(i, sample);
- if(position_in_chunk == 0)
- {
+ if (position_in_chunk == 0) {
// this sample is the first sample in a chunk, so this is the start of a chunk
- if(chunk_index >= chunk_offsets.ItemCount()) return AP4_ERROR_INTERNAL;
- chunk_offsets[chunk_index] = mdat_position + mdat_size;
+ if (chunk_index >= chunk_offsets.ItemCount()) return AP4_ERROR_INTERNAL;
+ chunk_offsets[chunk_index] = mdat_position+mdat_size;
}
mdat_size += sample.GetSize();
- }
+ }
result = trak->SetChunkOffsets(chunk_offsets);
}
-
+
// write the moov atom
movie->GetMoovAtom()->Write(stream);
-
+
// create and write the media data (mdat)
// FIXME: this only supports 32-bit mdat size
stream.WriteUI32((AP4_UI32)mdat_size);
stream.WriteUI32(AP4_ATOM_TYPE_MDAT);
-
+
// write all tracks and restore the chunk offsets to their backed-up values
- for(AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
- track_item;
- track_item = track_item->GetNext(), ++t)
- {
+ for (AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
+ track_item;
+ track_item = track_item->GetNext(), ++t) {
AP4_Track* track = track_item->GetData();
AP4_TrakAtom* trak = track->GetTrakAtom();
-
+
// restore the backed-up chunk offsets
result = trak->SetChunkOffsets(*trak_chunk_offsets_backup[t]);
@@ -141,18 +135,16 @@ AP4_FileWriter::Write(AP4_File& file, AP4_ByteStream& stream, Interleaving /* in
AP4_Cardinal sample_count = track->GetSampleCount();
AP4_Sample sample;
AP4_DataBuffer sample_data;
- for(AP4_Ordinal i = 0; i < sample_count; i++)
- {
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
track->ReadSample(i, sample, sample_data);
stream.Write(sample_data.GetData(), sample_data.GetDataSize());
}
}
end:
- for(unsigned int i = 0; i < trak_chunk_offsets_backup.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<trak_chunk_offsets_backup.ItemCount(); i++) {
delete trak_chunk_offsets_backup[i];
}
-
+
return result;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.h
index d5d34dd20..4c5c75391 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FileWriter.h
@@ -43,20 +43,18 @@ class AP4_File;
/*----------------------------------------------------------------------
| AP4_FileWriter
+---------------------------------------------------------------------*/
-class AP4_FileWriter
-{
+class AP4_FileWriter {
public:
// types
- typedef enum
- {
+ typedef enum {
INTERLEAVING_SEQUENTIAL
} Interleaving;
-
+
// class methods
- static AP4_Result Write(AP4_File& file,
- AP4_ByteStream& stream,
+ static AP4_Result Write(AP4_File& file,
+ AP4_ByteStream& stream,
Interleaving interleaving = INTERLEAVING_SEQUENTIAL);
-
+
private:
// don't instantiate this class
AP4_FileWriter() {}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.cpp
index b77e00bf7..ce862f388 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.cpp
@@ -41,50 +41,46 @@
/*----------------------------------------------------------------------
| AP4_FragmentSampleTable::AP4_FragmentSampleTable
+---------------------------------------------------------------------*/
-AP4_FragmentSampleTable::AP4_FragmentSampleTable(AP4_ContainerAtom* traf,
- AP4_TrexAtom* trex,
- AP4_ByteStream* sample_stream,
- AP4_Position moof_offset,
- AP4_Position mdat_payload_offset,
- AP4_UI64 dts_origin)
+AP4_FragmentSampleTable::AP4_FragmentSampleTable(AP4_ContainerAtom* traf,
+ AP4_TrexAtom* trex,
+ AP4_ByteStream* sample_stream,
+ AP4_Position moof_offset,
+ AP4_Position mdat_payload_offset,
+ AP4_UI64 dts_origin)
{
AP4_TfhdAtom* tfhd = AP4_DYNAMIC_CAST(AP4_TfhdAtom, traf->GetChild(AP4_ATOM_TYPE_TFHD));
- if(tfhd == NULL) return;
-
+ if (tfhd == NULL) return;
+
// count all the samples and reserve space for them
unsigned int sample_count = 0;
- for(AP4_List<AP4_Atom>::Item* item = traf->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = traf->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TRUN)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRUN) {
AP4_TrunAtom* trun = AP4_DYNAMIC_CAST(AP4_TrunAtom, atom);
sample_count += trun->GetEntries().ItemCount();
}
- }
+ }
m_Samples.EnsureCapacity(sample_count);
-
+
// process all the trun atoms
- for(AP4_List<AP4_Atom>::Item* item = traf->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = traf->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TRUN)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRUN) {
AP4_TrunAtom* trun = AP4_DYNAMIC_CAST(AP4_TrunAtom, atom);
- AP4_Result result = AddTrun(trun,
- tfhd,
- trex,
- sample_stream,
+ AP4_Result result = AddTrun(trun,
+ tfhd,
+ trex,
+ sample_stream,
moof_offset,
mdat_payload_offset,
dts_origin);
- if(AP4_FAILED(result)) return;
+ if (AP4_FAILED(result)) return;
}
- }
+ }
}
/*----------------------------------------------------------------------
@@ -98,8 +94,8 @@ AP4_FragmentSampleTable::~AP4_FragmentSampleTable()
| AP4_FragmentSampleTable::AddTrun
+---------------------------------------------------------------------*/
AP4_Result
-AP4_FragmentSampleTable::AddTrun(AP4_TrunAtom* trun,
- AP4_TfhdAtom* tfhd,
+AP4_FragmentSampleTable::AddTrun(AP4_TrunAtom* trun,
+ AP4_TfhdAtom* tfhd,
AP4_TrexAtom* trex,
AP4_ByteStream* sample_stream,
AP4_Position moof_offset,
@@ -108,155 +104,120 @@ AP4_FragmentSampleTable::AddTrun(AP4_TrunAtom* trun,
{
AP4_Flags tfhd_flags = tfhd->GetFlags();
AP4_Flags trun_flags = trun->GetFlags();
-
+
// update the number of samples
unsigned int start = m_Samples.ItemCount();
m_Samples.SetItemCount(start + trun->GetEntries().ItemCount());
-
+
// base data offset
AP4_Position data_offset = 0;
- if(tfhd_flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT)
- {
+ if (tfhd_flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT) {
data_offset = tfhd->GetBaseDataOffset();
- }
- else
- {
+ } else {
data_offset = moof_offset;
}
- if(trun_flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT)
- {
+ if (trun_flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT) {
data_offset += trun->GetDataOffset();
- }
+ }
// MS hack
- if(data_offset == moof_offset)
- {
+ if (data_offset == moof_offset) {
data_offset = payload_offset;
- }
- else
- {
+ } else {
payload_offset = data_offset;
}
-
+
// sample description index
AP4_UI32 sample_description_index = 0;
- if(tfhd_flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT)
- {
+ if (tfhd_flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT) {
sample_description_index = tfhd->GetSampleDescriptionIndex();
- }
- else if(trex)
- {
+ } else if (trex) {
sample_description_index = trex->GetDefaultSampleDescriptionIndex();
- }
-
+ }
+
// default sample size
AP4_UI32 default_sample_size = 0;
- if(tfhd_flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT)
- {
+ if (tfhd_flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT) {
default_sample_size = tfhd->GetDefaultSampleSize();
- }
- else if(trex)
- {
+ } else if (trex) {
default_sample_size = trex->GetDefaultSampleSize();
}
-
+
// default sample duration
AP4_UI32 default_sample_duration = 0;
- if(tfhd_flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT)
- {
+ if (tfhd_flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT) {
default_sample_duration = tfhd->GetDefaultSampleDuration();
- }
- else if(trex)
- {
+ } else if (trex) {
default_sample_duration = trex->GetDefaultSampleDuration();
}
-
+
// default sample flags
AP4_UI32 default_sample_flags = 0;
- if(tfhd_flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT)
- {
+ if (tfhd_flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT) {
default_sample_flags = tfhd->GetDefaultSampleFlags();
- }
- else if(trex)
- {
+ } else if (trex) {
default_sample_flags = trex->GetDefaultSampleFlags();
}
// parse all trun entries to setup the samples
AP4_UI64 dts = dts_origin;
- for(unsigned int i = 0; i < trun->GetEntries().ItemCount(); i++)
- {
+ for (unsigned int i=0; i<trun->GetEntries().ItemCount(); i++) {
const AP4_TrunAtom::Entry& entry = trun->GetEntries()[i];
AP4_Sample& sample = m_Samples[start+i];
-
+
// sample size
- if(trun_flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT)
- {
+ if (trun_flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT) {
sample.SetSize(entry.sample_size);
- }
- else
- {
+ } else {
sample.SetSize(default_sample_size);
}
payload_offset += sample.GetSize(); // update the payload offset
-
+
// sample duration
- if(trun_flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT)
- {
+ if (trun_flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) {
sample.SetDuration(entry.sample_duration);
- }
- else
- {
+ } else {
sample.SetDuration(default_sample_duration);
}
// sample flags
AP4_UI32 sample_flags = default_sample_flags;
- if(i == 0 && (trun_flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT))
- {
+ if (i==0 && (trun_flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT)) {
sample_flags = trun->GetFirstSampleFlags();
- }
- else if(trun_flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT)
- {
+ } else if (trun_flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT) {
sample_flags = entry.sample_flags;
}
- if((sample_flags & AP4_FRAG_FLAG_SAMPLE_IS_DIFFERENCE) == 0)
- {
+ if ((sample_flags & AP4_FRAG_FLAG_SAMPLE_IS_DIFFERENCE) == 0) {
sample.SetSync(true);
- }
- else
- {
+ } else {
sample.SetSync(false);
}
-
+
// sample description index
sample.SetDescriptionIndex(sample_description_index);
-
+
// data stream
- if(sample_stream) sample.SetDataStream(*sample_stream);
-
+ if (sample_stream) sample.SetDataStream(*sample_stream);
+
// data offset
sample.SetOffset(data_offset);
data_offset += sample.GetSize();
-
+
// dts and cts
sample.SetDts(dts);
- if(trun_flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT)
- {
- sample.SetCts(dts + entry.sample_composition_time_offset);
- }
- else
- {
+ if (trun_flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT) {
+ sample.SetCts(dts+entry.sample_composition_time_offset);
+ } else {
sample.SetCts(dts);
}
-
+
// update the counters
dts += sample.GetDuration();
m_Duration += sample.GetDuration();
}
-
+
// update the dts
dts_origin = dts;
-
+
return AP4_SUCCESS;
}
@@ -264,10 +225,10 @@ AP4_FragmentSampleTable::AddTrun(AP4_TrunAtom* trun,
| AP4_FragmentSampleTable::GetSample
+---------------------------------------------------------------------*/
AP4_Result
-AP4_FragmentSampleTable::GetSample(AP4_Ordinal index,
+AP4_FragmentSampleTable::GetSample(AP4_Ordinal index,
AP4_Sample& sample)
{
- if(index >= m_Samples.ItemCount()) return AP4_ERROR_OUT_OF_RANGE;
+ if (index >= m_Samples.ItemCount()) return AP4_ERROR_OUT_OF_RANGE;
// copy the sample
sample = m_Samples[index];
@@ -305,23 +266,23 @@ AP4_FragmentSampleTable::GetSampleDescriptionCount()
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSampleChunkPosition
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_FragmentSampleTable::GetSampleChunkPosition(AP4_Ordinal sample_index,
- AP4_Ordinal& chunk_index,
- AP4_Ordinal& position_in_chunk)
+AP4_Result
+AP4_FragmentSampleTable::GetSampleChunkPosition(AP4_Ordinal sample_index,
+ AP4_Ordinal& chunk_index,
+ AP4_Ordinal& position_in_chunk)
{
chunk_index = 0;
position_in_chunk = sample_index;
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_FragmentSampleTable::GetSampleIndexForTimeStamp
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_FragmentSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /*ts*/,
- AP4_Ordinal& sample_index)
+AP4_Result
+AP4_FragmentSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /*ts*/,
+ AP4_Ordinal& sample_index)
{
sample_index = 0; // FIXME
return AP4_SUCCESS;
@@ -330,7 +291,7 @@ AP4_FragmentSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /*ts*/,
/*----------------------------------------------------------------------
| AP4_FragmentSampleTable::GetNearestSyncSampleIndex
+---------------------------------------------------------------------*/
-AP4_Ordinal
+AP4_Ordinal
AP4_FragmentSampleTable::GetNearestSyncSampleIndex(AP4_Ordinal /*sample_index*/, bool /*before*/)
{
return 0; // FIXME
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.h
index 3c16eb60a..0c626bcb5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FragmentSampleTable.h
@@ -50,14 +50,14 @@ class AP4_TfhdAtom;
+---------------------------------------------------------------------*/
class AP4_FragmentSampleTable : public AP4_SampleTable
{
-public:
+ public:
// methods
- AP4_FragmentSampleTable(AP4_ContainerAtom* traf,
- AP4_TrexAtom* trex,
- AP4_ByteStream* sample_stream,
- AP4_Position moof_offset,
- AP4_Position mdat_payload_offset, // hack because MS doesn't implement the spec correctly
- AP4_UI64 dts_origin = 0);
+ AP4_FragmentSampleTable(AP4_ContainerAtom* traf,
+ AP4_TrexAtom* trex,
+ AP4_ByteStream* sample_stream,
+ AP4_Position moof_offset,
+ AP4_Position mdat_payload_offset, // hack because MS doesn't implement the spec correctly
+ AP4_UI64 dts_origin=0);
virtual ~AP4_FragmentSampleTable();
// AP4_SampleTable methods
@@ -65,28 +65,25 @@ public:
virtual AP4_Cardinal GetSampleCount();
virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal sd_index);
virtual AP4_Cardinal GetSampleDescriptionCount();
- virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
- AP4_Ordinal& chunk_index,
- AP4_Ordinal& position_in_chunk);
+ virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
+ AP4_Ordinal& chunk_index,
+ AP4_Ordinal& position_in_chunk);
virtual AP4_Result GetSampleIndexForTimeStamp(AP4_UI64 ts, AP4_Ordinal& sample_index);
- virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before = true);
+ virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before=true);
// methods
- AP4_UI64 GetDuration()
- {
- return m_Duration;
- }
-
+ AP4_UI64 GetDuration() { return m_Duration; }
+
private:
// members
AP4_TrunAtom* m_TrunAtom;
AP4_Array<AP4_Sample> m_Samples;
AP4_UI64 m_Duration;
-
+
// methods
- AP4_Result AddTrun(AP4_TrunAtom* trun,
- AP4_TfhdAtom* tfhd,
- AP4_TrexAtom* trex,
+ AP4_Result AddTrun(AP4_TrunAtom* trun,
+ AP4_TfhdAtom* tfhd,
+ AP4_TrexAtom* trex,
AP4_ByteStream* sample_stream,
AP4_Position moof_offset,
AP4_Position& payload_offset,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.cpp
index 8b8fbef11..cfaef69b3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - frma Atoms
+| AP4 - frma Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -37,7 +37,7 @@
| AP4_FrmaAtom::AP4_FrmaAtom
+---------------------------------------------------------------------*/
AP4_FrmaAtom::AP4_FrmaAtom(AP4_UI32 original_format) :
- AP4_Atom(AP4_ATOM_TYPE_FRMA, AP4_ATOM_HEADER_SIZE + 4),
+ AP4_Atom(AP4_ATOM_TYPE_FRMA, AP4_ATOM_HEADER_SIZE+4),
m_OriginalFormat(original_format)
{
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.h
index 3542ab234..c6ea77a08 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FrmaAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - frma Atoms
+| AP4 - frma Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -47,21 +47,17 @@ class AP4_FrmaAtom : public AP4_Atom
{
public:
// class methods
- static AP4_FrmaAtom* Create(AP4_Size size, AP4_ByteStream& stream)
- {
+ static AP4_FrmaAtom* Create(AP4_Size size, AP4_ByteStream& stream) {
return new AP4_FrmaAtom(size, stream);
}
- // constructors
+ // constructors
AP4_FrmaAtom(AP4_UI32 original_format);
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI32 GetOriginalFormat()
- {
- return m_OriginalFormat;
- }
+ AP4_UI32 GetOriginalFormat() { return m_OriginalFormat; }
private:
// methods
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.cpp
index 96cfe24b4..287238ebd 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.cpp
@@ -38,27 +38,27 @@
AP4_FtabAtom::AP4_FtabAtom(AP4_Size size,
AP4_ByteStream& stream)
- : AP4_Atom(AP4_ATOM_TYPE_FTAB)
+ : AP4_Atom(AP4_ATOM_TYPE_FTAB)
{
- AP4_UI16 entryCount;
+ AP4_UI16 entryCount;
stream.ReadUI16(entryCount);
- m_FontRecords.EnsureCapacity(entryCount);
+ m_FontRecords.EnsureCapacity(entryCount);
- while(entryCount--)
- {
- AP4_Tx3gFontRecord fontRecord;
+ while(entryCount--)
+ {
+ AP4_Tx3gFontRecord fontRecord;
- stream.ReadUI16(fontRecord.Id);
+ stream.ReadUI16(fontRecord.Id);
- AP4_UI08 len;
- stream.ReadUI08(len);
+ AP4_UI08 len;
+ stream.ReadUI08(len);
- char buff[256];
- stream.ReadString(buff, len + 1);
+ char buff[256];
+ stream.ReadString(buff, len+1);
- fontRecord.Name = buff;
+ fontRecord.Name = buff;
- m_FontRecords.Append(fontRecord);
- }
+ m_FontRecords.Append(fontRecord);
+ }
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.h
index 78b2b65ae..0845347d5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtabAtom.h
@@ -42,43 +42,37 @@
class AP4_FtabAtom : public AP4_Atom
{
public:
- AP4_FtabAtom(AP4_Size size,
+ AP4_FtabAtom(AP4_Size size,
AP4_ByteStream& stream);
- AP4_Result WriteFields(AP4_ByteStream& stream)
- {
- return AP4_FAILURE;
- }
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
- struct AP4_Tx3gFontRecord
- {
- AP4_UI16 Id;
- AP4_String Name;
- };
+ struct AP4_Tx3gFontRecord
+ {
+ AP4_UI16 Id;
+ AP4_String Name;
+ };
- AP4_Array<AP4_Tx3gFontRecord>& GetFontRecords()
- {
- return m_FontRecords;
- }
+ AP4_Array<AP4_Tx3gFontRecord>& GetFontRecords() { return m_FontRecords; }
- AP4_Result LookupFont(AP4_UI16 Id, AP4_String& Name)
- {
- for(unsigned long i = 0; i < m_FontRecords.ItemCount(); i++)
- {
- if(m_FontRecords[i].Id == Id)
- {
- Name = m_FontRecords[i].Name;
- return AP4_SUCCESS;
- }
- }
+ AP4_Result LookupFont(AP4_UI16 Id, AP4_String& Name)
+ {
+ for(unsigned long i = 0; i < m_FontRecords.ItemCount(); i++)
+ {
+ if(m_FontRecords[i].Id == Id)
+ {
+ Name = m_FontRecords[i].Name;
+ return AP4_SUCCESS;
+ }
+ }
- return AP4_FAILURE;
- }
+ return AP4_FAILURE;
+ }
private:
- // members
- AP4_Array<AP4_Tx3gFontRecord> m_FontRecords;
+ // members
+ AP4_Array<AP4_Tx3gFontRecord> m_FontRecords;
};
#endif // _AP4_FTAB_ATOM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.cpp
index 511827cca..8bd20f0cc 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ftyp Atoms
+| AP4 - ftyp Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -47,8 +47,7 @@ AP4_FtypAtom::AP4_FtypAtom(AP4_UI32 size, AP4_ByteStream& stream) :
stream.ReadUI32(m_MajorBrand);
stream.ReadUI32(m_MinorVersion);
size -= 16;
- while(size)
- {
+ while (size) {
AP4_UI32 compatible_brand;
stream.ReadUI32(compatible_brand);
m_CompatibleBrands.Append(compatible_brand);
@@ -63,7 +62,7 @@ AP4_FtypAtom::AP4_FtypAtom(AP4_UI32 major_brand,
AP4_UI32 minor_version,
AP4_UI32* compatible_brands,
AP4_Cardinal compatible_brand_count) :
- AP4_Atom(AP4_ATOM_TYPE_FTYP, AP4_ATOM_HEADER_SIZE + 8 + 4 * compatible_brand_count),
+ AP4_Atom(AP4_ATOM_TYPE_FTYP, AP4_ATOM_HEADER_SIZE+8+4*compatible_brand_count),
m_MajorBrand(major_brand),
m_MinorVersion(minor_version),
m_CompatibleBrands(compatible_brands, compatible_brand_count)
@@ -76,9 +75,8 @@ AP4_FtypAtom::AP4_FtypAtom(AP4_UI32 major_brand,
bool
AP4_FtypAtom::HasCompatibleBrand(AP4_UI32 brand)
{
- for(unsigned int i = 0; i < m_CompatibleBrands.ItemCount(); i++)
- {
- if(m_CompatibleBrands[i] == brand) return true;
+ for (unsigned int i=0; i<m_CompatibleBrands.ItemCount(); i++) {
+ if (m_CompatibleBrands[i] == brand) return true;
}
return false;
@@ -91,21 +89,20 @@ AP4_Result
AP4_FtypAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
// major brand
result = stream.WriteUI32(m_MajorBrand);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// minor version
result = stream.WriteUI32(m_MinorVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// compatible brands
AP4_Cardinal compat_brand_count = m_CompatibleBrands.ItemCount();
- for(AP4_Ordinal i = 0; i < compat_brand_count; i++)
- {
+ for (AP4_Ordinal i=0; i<compat_brand_count; i++) {
result = stream.WriteUI32(m_CompatibleBrands[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return result;
@@ -123,8 +120,7 @@ AP4_FtypAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("minor_version", m_MinorVersion, AP4_AtomInspector::HINT_HEX);
// compatible brands
- for(unsigned int i = 0; i < m_CompatibleBrands.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_CompatibleBrands.ItemCount(); i++) {
AP4_UI32 cb = m_CompatibleBrands[i];
AP4_FormatFourChars(name, cb);
inspector.AddField("compatible_brand", name);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.h
index 8e9149476..fe6e2c0f4 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4FtypAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ftyp Atoms
+| AP4 - ftyp Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -44,7 +44,7 @@ class AP4_ByteStream;
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_FTYP_BRAND_ISOM = AP4_ATOM_TYPE('i', 's', 'o', 'm');
+const AP4_UI32 AP4_FTYP_BRAND_ISOM = AP4_ATOM_TYPE('i','s','o','m');
/*----------------------------------------------------------------------
| AP4_FtypAtom
@@ -55,8 +55,7 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_FtypAtom, AP4_Atom)
// class methods
- static AP4_FtypAtom* Create(AP4_Size size, AP4_ByteStream& stream)
- {
+ static AP4_FtypAtom* Create(AP4_Size size, AP4_ByteStream& stream) {
return new AP4_FtypAtom(size, stream);
}
@@ -67,19 +66,12 @@ public:
AP4_Cardinal compatible_brand_count = 0);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// accessors
- AP4_UI32 GetMajorBrand()
- {
- return m_MajorBrand;
- }
- AP4_UI32 GetMinorVersion()
- {
- return m_MinorVersion;
- }
- AP4_Array<AP4_UI32>& GetCompatibleBrands()
- {
- return m_CompatibleBrands;
+ AP4_UI32 GetMajorBrand() { return m_MajorBrand; }
+ AP4_UI32 GetMinorVersion() { return m_MinorVersion; }
+ AP4_Array<AP4_UI32>& GetCompatibleBrands() {
+ return m_CompatibleBrands;
}
bool HasCompatibleBrand(AP4_UI32 brand);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.cpp
index d839d8511..f75764a14 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ohdr Atoms
+| AP4 - ohdr Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,15 +45,15 @@ AP4_GrpiAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_GrpiAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_GrpiAtom::AP4_GrpiAtom
+---------------------------------------------------------------------*/
-AP4_GrpiAtom::AP4_GrpiAtom(AP4_UI08 key_encryption_method,
+AP4_GrpiAtom::AP4_GrpiAtom(AP4_UI08 key_encryption_method,
const char* group_id,
const AP4_UI08* group_key,
AP4_Size group_key_length) :
@@ -62,13 +62,13 @@ AP4_GrpiAtom::AP4_GrpiAtom(AP4_UI08 key_encryption_method,
m_GroupId(group_id),
m_GroupKey(group_key, group_key_length)
{
- m_Size32 += 2 + 1 + 2 + m_GroupId.GetLength() + group_key_length;
+ m_Size32 += 2+1+2+m_GroupId.GetLength()+group_key_length;
}
/*----------------------------------------------------------------------
| AP4_GrpiAtom::AP4_GrpiAtom
+---------------------------------------------------------------------*/
-AP4_GrpiAtom::AP4_GrpiAtom(AP4_UI32 size,
+AP4_GrpiAtom::AP4_GrpiAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -80,7 +80,7 @@ AP4_GrpiAtom::AP4_GrpiAtom(AP4_UI32 size,
// encryption method
stream.ReadUI08(m_KeyEncryptionMethod);
-
+
// group key length
AP4_UI16 group_key_length = 0;
stream.ReadUI16(group_key_length);
@@ -107,7 +107,7 @@ AP4_GrpiAtom::WriteFields(AP4_ByteStream& stream)
AP4_CHECK(stream.WriteUI16((AP4_UI16)m_GroupKey.GetDataSize()));
AP4_CHECK(stream.Write(m_GroupId.GetChars(), m_GroupId.GetLength()));
AP4_CHECK(stream.Write(m_GroupKey.GetData(), m_GroupKey.GetDataSize()));
-
+
return AP4_SUCCESS;
}
@@ -119,15 +119,15 @@ AP4_GrpiAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("key encryption method", m_KeyEncryptionMethod);
inspector.AddField("group id", m_GroupId.GetChars());
- inspector.AddField("group key", m_GroupKey.GetData(),
- m_GroupKey.GetDataSize());
+ inspector.AddField("group key", m_GroupKey.GetData(),
+ m_GroupKey.GetDataSize());
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_GrpiAtom::Clone
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_GrpiAtom::Clone()
{
return new AP4_GrpiAtom(m_KeyEncryptionMethod,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.h
index 9ac2868cd..80aeae6c2 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4GrpiAtom.h
@@ -46,47 +46,35 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_GrpiAtom, AP4_Atom)
// class methods
- static AP4_GrpiAtom* Create(AP4_Size size,
+ static AP4_GrpiAtom* Create(AP4_Size size,
AP4_ByteStream& stream);
// constructor
- AP4_GrpiAtom(AP4_UI08 key_encryption_method,
+ AP4_GrpiAtom(AP4_UI08 key_encryption_method,
const char* group_id,
const AP4_UI08* group_key,
AP4_Size group_key_length);
-
+
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Atom* Clone();
// accessors
- AP4_UI08 GetKeyEncryptionMethod() const
- {
- return m_KeyEncryptionMethod;
- }
- void SetKeyEncryptionMethod(AP4_UI08 encryption_method)
- {
- m_KeyEncryptionMethod = encryption_method;
- }
- const AP4_String& GetGroupId() const
- {
- return m_GroupId;
- }
- const AP4_DataBuffer& GetGroupKey() const
- {
- return m_GroupKey;
- }
-
+ AP4_UI08 GetKeyEncryptionMethod() const { return m_KeyEncryptionMethod; }
+ void SetKeyEncryptionMethod(AP4_UI08 encryption_method) { m_KeyEncryptionMethod = encryption_method; }
+ const AP4_String& GetGroupId() const { return m_GroupId; }
+ const AP4_DataBuffer& GetGroupKey() const { return m_GroupKey; }
+
private:
// methods
- AP4_GrpiAtom(AP4_UI32 size,
+ AP4_GrpiAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
// members
- AP4_UI08 m_KeyEncryptionMethod;
+ AP4_UI08 m_KeyEncryptionMethod;
AP4_String m_GroupId;
AP4_DataBuffer m_GroupKey;
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.cpp
index c8150ccb7..9a25e3ed3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - hdlr Atoms
+| AP4 - hdlr Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_HdlrAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_HdlrAtom(size, version, flags, stream);
}
@@ -59,14 +59,14 @@ AP4_HdlrAtom::AP4_HdlrAtom(AP4_Atom::Type hdlr_type, const char* hdlr_name) :
m_HandlerType(hdlr_type),
m_HandlerName(hdlr_name)
{
- m_Size32 += 20 + m_HandlerName.GetLength() + 1;
+ m_Size32 += 20+m_HandlerName.GetLength()+1;
m_Reserved[0] = m_Reserved[1] = m_Reserved[2] = 0;
}
/*----------------------------------------------------------------------
| AP4_HdlrAtom::AP4_HdlrAtom
+---------------------------------------------------------------------*/
-AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size,
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -78,22 +78,19 @@ AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size,
stream.ReadUI32(m_Reserved[0]);
stream.ReadUI32(m_Reserved[1]);
stream.ReadUI32(m_Reserved[2]);
-
+
// read the name unless it is empty
- int name_size = size - (AP4_FULL_ATOM_HEADER_SIZE + 20);
- if(name_size == 0) return;
+ int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);
+ if (name_size == 0) return;
char* name = new char[name_size+1];
stream.Read(name, name_size);
name[name_size] = '\0'; // force a null termination
// handle a special case: the Quicktime files have a pascal
// string here, but ISO MP4 files have a C string.
// we try to detect a pascal encoding and correct it.
- if(name[0] == name_size - 1)
- {
- m_HandlerName = name + 1;
- }
- else
- {
+ if (name[0] == name_size-1) {
+ m_HandlerName = name+1;
+ } else {
m_HandlerName = name;
}
delete[] name;
@@ -109,29 +106,27 @@ AP4_HdlrAtom::WriteFields(AP4_ByteStream& stream)
// write the data
result = stream.WriteUI32(0); // predefined
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_HandlerType);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Reserved[0]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Reserved[1]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Reserved[2]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
AP4_UI08 name_size = (AP4_UI08)m_HandlerName.GetLength();
- if(AP4_FULL_ATOM_HEADER_SIZE + 20 + name_size > m_Size32)
- {
- name_size = m_Size32 - AP4_FULL_ATOM_HEADER_SIZE + 20;
+ if (AP4_FULL_ATOM_HEADER_SIZE+20+name_size > m_Size32) {
+ name_size = m_Size32-AP4_FULL_ATOM_HEADER_SIZE+20;
}
- if(name_size)
- {
+ if (name_size) {
result = stream.Write(m_HandlerName.GetChars(), name_size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// pad with zeros if necessary
- AP4_Size padding = m_Size32 - (AP4_FULL_ATOM_HEADER_SIZE + 20 + name_size);
- while(padding--) stream.WriteUI08(0);
+ AP4_Size padding = m_Size32-(AP4_FULL_ATOM_HEADER_SIZE+20+name_size);
+ while (padding--) stream.WriteUI08(0);
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.h
index 63080dbcb..c5b1bf135 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HdlrAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - hdlr Atoms
+| AP4 - hdlr Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -43,17 +43,17 @@ class AP4_ByteStream;
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_HANDLER_TYPE_SOUN = AP4_ATOM_TYPE('s', 'o', 'u', 'n');
-const AP4_UI32 AP4_HANDLER_TYPE_VIDE = AP4_ATOM_TYPE('v', 'i', 'd', 'e');
-const AP4_UI32 AP4_HANDLER_TYPE_HINT = AP4_ATOM_TYPE('h', 'i', 'n', 't');
-const AP4_UI32 AP4_HANDLER_TYPE_MDIR = AP4_ATOM_TYPE('m', 'd', 'i', 'r');
-const AP4_UI32 AP4_HANDLER_TYPE_TEXT = AP4_ATOM_TYPE('t', 'e', 'x', 't');
-const AP4_UI32 AP4_HANDLER_TYPE_TX3G = AP4_ATOM_TYPE('t', 'x', '3', 'g');
-const AP4_UI32 AP4_HANDLER_TYPE_JPEG = AP4_ATOM_TYPE('j', 'p', 'e', 'g');
-const AP4_UI32 AP4_HANDLER_TYPE_ODSM = AP4_ATOM_TYPE('o', 'd', 's', 'm');
-const AP4_UI32 AP4_HANDLER_TYPE_SDSM = AP4_ATOM_TYPE('s', 'd', 's', 'm');
+const AP4_UI32 AP4_HANDLER_TYPE_SOUN = AP4_ATOM_TYPE('s','o','u','n');
+const AP4_UI32 AP4_HANDLER_TYPE_VIDE = AP4_ATOM_TYPE('v','i','d','e');
+const AP4_UI32 AP4_HANDLER_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+const AP4_UI32 AP4_HANDLER_TYPE_MDIR = AP4_ATOM_TYPE('m','d','i','r');
+const AP4_UI32 AP4_HANDLER_TYPE_TEXT = AP4_ATOM_TYPE('t','e','x','t');
+const AP4_UI32 AP4_HANDLER_TYPE_TX3G = AP4_ATOM_TYPE('t','x','3','g');
+const AP4_UI32 AP4_HANDLER_TYPE_JPEG = AP4_ATOM_TYPE('j','p','e','g');
+const AP4_UI32 AP4_HANDLER_TYPE_ODSM = AP4_ATOM_TYPE('o','d','s','m');
+const AP4_UI32 AP4_HANDLER_TYPE_SDSM = AP4_ATOM_TYPE('s','d','s','m');
// ==> Start patch MPC
-const AP4_UI32 AP4_HANDLER_TYPE_SUBP = AP4_ATOM_TYPE('s', 'u', 'b', 'p');
+const AP4_UI32 AP4_HANDLER_TYPE_SUBP = AP4_ATOM_TYPE('s','u','b','p');
// <== End patch MPC
/*----------------------------------------------------------------------
@@ -72,18 +72,12 @@ public:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI32 GetHandlerType()
- {
- return m_HandlerType;
- }
- AP4_String GetHandlerName()
- {
- return m_HandlerName;
- }
+ AP4_UI32 GetHandlerType() { return m_HandlerType; }
+ AP4_String GetHandlerName() { return m_HandlerName; }
private:
// methods
- AP4_HdlrAtom(AP4_UI32 size,
+ AP4_HdlrAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.cpp
index 626e18d32..3e35131cb 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.cpp
@@ -45,9 +45,9 @@
/*----------------------------------------------------------------------
| AP4_HintTrackReader::AP4_HintTrackReader
+---------------------------------------------------------------------*/
-AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
- AP4_Movie& movie,
- AP4_UI32 ssrc) :
+AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
+ AP4_Movie& movie,
+ AP4_UI32 ssrc) :
m_HintTrack(hint_track),
m_MediaTrack(NULL),
m_MediaTimeScale(0),
@@ -62,8 +62,7 @@ AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
// get the media track
AP4_TrakAtom* hint_trak_atom = hint_track.GetTrakAtom();
AP4_Atom* atom = hint_trak_atom->FindChild("tref/hint");
- if(atom != NULL)
- {
+ if (atom != NULL) {
AP4_UI32 media_track_id = ((AP4_TrefTypeAtom*) atom)->GetTrackIds()[0];
m_MediaTrack = movie.GetTrack(media_track_id);
@@ -82,15 +81,13 @@ AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
// rtp time scale
atom = hint_trak_atom->FindChild("mdia/minf/stbl/rtp /tims");
- if(atom)
- {
+ if (atom) {
AP4_TimsAtom* tims = (AP4_TimsAtom*)atom;
m_RtpTimeScale = tims->GetTimeScale();
}
// generate a random ssrc if = 0
- if(m_Ssrc == 0)
- {
+ if (m_Ssrc == 0) {
m_Ssrc = rand();
}
@@ -102,23 +99,22 @@ AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
| AP4_HintTrackReader::Create
+---------------------------------------------------------------------*/
AP4_Result
-AP4_HintTrackReader::Create(AP4_Track& hint_track,
- AP4_Movie& movie,
+AP4_HintTrackReader::Create(AP4_Track& hint_track,
+ AP4_Movie& movie,
AP4_UI32 ssrc,
AP4_HintTrackReader*& reader)
{
// default value
reader = NULL;
-
+
// check the type
- if(hint_track.GetType() != AP4_Track::TYPE_HINT)
- {
+ if (hint_track.GetType() != AP4_Track::TYPE_HINT) {
return AP4_ERROR_INVALID_TRACK_TYPE;
}
-
+
// create a new object
reader = new AP4_HintTrackReader(hint_track, movie, ssrc);
-
+
return AP4_SUCCESS;
}
@@ -138,7 +134,7 @@ AP4_HintTrackReader::GetRtpSample(AP4_Ordinal index)
{
// get the sample
AP4_Result result = m_HintTrack.GetSample(index, m_CurrentHintSample);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// renew the sample data
delete m_RtpSampleData;
@@ -162,7 +158,7 @@ AP4_HintTrackReader::GetRtpSample(AP4_Ordinal index)
AP4_UI32
AP4_HintTrackReader::GetCurrentTimeStampMs()
{
- return (AP4_UI32)AP4_ConvertTime(m_CurrentHintSample.GetCts(),
+ return (AP4_UI32)AP4_ConvertTime(m_CurrentHintSample.GetCts(),
m_HintTrack.GetMediaTimeScale(),
1000);
}
@@ -184,10 +180,10 @@ AP4_Result
AP4_HintTrackReader::GetSdpText(AP4_String& sdp_text)
{
AP4_Atom* sdp_atom = m_HintTrack.GetTrakAtom()->FindChild("udta/hnti/sdp ");
- if(sdp_atom == NULL) return AP4_FAILURE;
+ if (sdp_atom == NULL) return AP4_FAILURE;
// C cast is OK because we know the type of the atom
- sdp_text = ((AP4_SdpAtom*) sdp_atom)->GetSdpText();
+ sdp_text = ((AP4_SdpAtom*) sdp_atom)->GetSdpText();
return AP4_SUCCESS;
}
@@ -195,17 +191,17 @@ AP4_HintTrackReader::GetSdpText(AP4_String& sdp_text)
| AP4_HintTrackReader::SeekToTimeStampMs
+---------------------------------------------------------------------*/
AP4_Result
-AP4_HintTrackReader::SeekToTimeStampMs(AP4_UI32 desired_ts_ms,
+AP4_HintTrackReader::SeekToTimeStampMs(AP4_UI32 desired_ts_ms,
AP4_UI32& actual_ts_ms)
{
// get the sample index
AP4_Cardinal index;
AP4_Result result = m_HintTrack.GetSampleIndexForTimeStampMs(desired_ts_ms, index);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// get the current sample based on the index and renew the sample data
result = GetRtpSample(index);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// set the actual ts
actual_ts_ms = GetCurrentTimeStampMs();
@@ -216,28 +212,27 @@ AP4_HintTrackReader::SeekToTimeStampMs(AP4_UI32 desired_ts_ms,
| AP4_HintTrackReader::GetNextPacket
+---------------------------------------------------------------------*/
AP4_Result
-AP4_HintTrackReader::GetNextPacket(AP4_DataBuffer& packet_data,
+AP4_HintTrackReader::GetNextPacket(AP4_DataBuffer& packet_data,
AP4_UI32& ts_ms)
{
AP4_Result result = AP4_SUCCESS;
// get the next rtp sample if needed
AP4_List<AP4_RtpPacket>* packets = &m_RtpSampleData->GetPackets();
- while(m_PacketIndex == packets->ItemCount()) // while: handle the 0 packet case
- {
+ while (m_PacketIndex == packets->ItemCount()) { // while: handle the 0 packet case
result = GetRtpSample(++m_SampleIndex);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
packets = &m_RtpSampleData->GetPackets();
}
// get the packet
AP4_RtpPacket* packet;
result = packets->Get(m_PacketIndex++, packet);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// build it
result = BuildRtpPacket(packet, packet_data);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// set the time stamp
ts_ms = GetCurrentTimeStampMs();
@@ -249,15 +244,15 @@ AP4_HintTrackReader::GetNextPacket(AP4_DataBuffer& packet_data,
| AP4_HintTrackReader::BuildRtpPacket
+---------------------------------------------------------------------*/
AP4_Result
-AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet,
+AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet,
AP4_DataBuffer& packet_data)
{
// set the data size
AP4_Result result = packet_data.SetDataSize(packet->GetConstructedDataSize());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// now write
- AP4_ByteStream* stream = new AP4_MemoryByteStream(packet_data);
+ AP4_ByteStream* stream = new AP4_MemoryByteStream(packet_data);
// header + ssrc
stream->WriteUI08(0x80 | (packet->GetPBit() << 5) | (packet->GetXBit() << 4));
@@ -266,33 +261,31 @@ AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet,
stream->WriteUI32(m_RtpTimeStampStart + (AP4_UI32)m_CurrentHintSample.GetCts() + packet->GetTimeStampOffset());
stream->WriteUI32(m_Ssrc);
- AP4_List<AP4_RtpConstructor>::Item* constructors_it
- = packet->GetConstructors().FirstItem();
- while(constructors_it != NULL)
- {
+ AP4_List<AP4_RtpConstructor>::Item* constructors_it
+ = packet->GetConstructors().FirstItem();
+ while (constructors_it != NULL) {
AP4_RtpConstructor* constructor = constructors_it->GetData();
// add data to the packet according to the constructor
- switch(constructor->GetType())
- {
- case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
- // nothing to do here
- break;
- case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
- result = WriteImmediateRtpData(
- (AP4_ImmediateRtpConstructor*) constructor, stream);
- if(AP4_FAILED(result)) return result;
- break;
- case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
- result = WriteSampleRtpData(
- (AP4_SampleRtpConstructor*) constructor, stream);
- if(AP4_FAILED(result)) return result;
- break;
- case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
- return AP4_ERROR_NOT_SUPPORTED;
- default:
- // unknown constructor type
- return AP4_FAILURE;
+ switch (constructor->GetType()) {
+ case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
+ // nothing to do here
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
+ result = WriteImmediateRtpData(
+ (AP4_ImmediateRtpConstructor*) constructor, stream);
+ if (AP4_FAILED(result)) return result;
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
+ result = WriteSampleRtpData(
+ (AP4_SampleRtpConstructor*) constructor, stream);
+ if (AP4_FAILED(result)) return result;
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
+ return AP4_ERROR_NOT_SUPPORTED;
+ default:
+ // unknown constructor type
+ return AP4_FAILURE;
}
// iterate
@@ -309,8 +302,8 @@ AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet,
| AP4_HintTrackReader::WriteImmediateRtpData
+---------------------------------------------------------------------*/
AP4_Result
-AP4_HintTrackReader::WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
- AP4_ByteStream* data_stream)
+AP4_HintTrackReader::WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
+ AP4_ByteStream* data_stream)
{
const AP4_DataBuffer& data_buffer = constructor->GetData();
return data_stream->Write(data_buffer.GetData(), data_buffer.GetDataSize());
@@ -320,30 +313,27 @@ AP4_HintTrackReader::WriteImmediateRtpData(AP4_ImmediateRtpConstructor* construc
| AP4_HintTrackReader::WriteSampleRtpData
+---------------------------------------------------------------------*/
AP4_Result
-AP4_HintTrackReader::WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
+AP4_HintTrackReader::WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
AP4_ByteStream* data_stream)
{
AP4_Track* referenced_track = NULL;
- if(constructor->GetTrackRefIndex() == 0xFF)
- {
+ if (constructor->GetTrackRefIndex() == 0xFF) {
// data is in the hint track
referenced_track = &m_HintTrack;
- }
- else
- {
+ } else {
// check if we have a media track
- if(m_MediaTrack == NULL) return AP4_FAILURE;
+ if (m_MediaTrack == NULL) return AP4_FAILURE;
referenced_track = m_MediaTrack;
}
// write the sample data
AP4_Sample sample;
- AP4_Result result = referenced_track->GetSample(constructor->GetSampleNum() - 1, // adjust
- sample);
+ AP4_Result result = referenced_track->GetSample(constructor->GetSampleNum()-1, // adjust
+ sample);
AP4_DataBuffer buffer(constructor->GetLength());
result = sample.ReadData(
- buffer, constructor->GetLength(), constructor->GetSampleOffset());
- if(AP4_FAILED(result)) return result;
+ buffer, constructor->GetLength(), constructor->GetSampleOffset());
+ if (AP4_FAILED(result)) return result;
// write the data
return data_stream->Write(buffer.GetData(), buffer.GetDataSize());
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.h
index 0f4e0ef3e..71b2aebaa 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HintTrackReader.h
@@ -54,34 +54,31 @@ class AP4_HintTrackReader
{
public:
// constructor and destructor
- static AP4_Result Create(AP4_Track& hint_track,
- AP4_Movie& movie,
+ static AP4_Result Create(AP4_Track& hint_track,
+ AP4_Movie& movie,
AP4_UI32 ssrc, // if 0, a random value is chosen
AP4_HintTrackReader*& reader);
~AP4_HintTrackReader();
// methods
- AP4_Result GetNextPacket(AP4_DataBuffer& packet,
+ AP4_Result GetNextPacket(AP4_DataBuffer& packet,
AP4_UI32& ts_ms);
AP4_Result SeekToTimeStampMs(AP4_UI32 desired_ts_ms,
AP4_UI32& actual_ts_ms);
AP4_UI32 GetCurrentTimeStampMs();
AP4_Result Rewind();
AP4_Result GetSdpText(AP4_String& sdp);
- AP4_Track* GetMediaTrack()
- {
- return m_MediaTrack;
- }
-
+ AP4_Track* GetMediaTrack() { return m_MediaTrack; }
+
private:
// use the factory instead of the constructor
- AP4_HintTrackReader(AP4_Track& hint_track,
- AP4_Movie& movie,
+ AP4_HintTrackReader(AP4_Track& hint_track,
+ AP4_Movie& movie,
AP4_UI32 ssrc);
-
+
// methods
AP4_Result GetRtpSample(AP4_Ordinal index);
- AP4_Result BuildRtpPacket(AP4_RtpPacket* packet,
+ AP4_Result BuildRtpPacket(AP4_RtpPacket* packet,
AP4_DataBuffer& packet_data);
AP4_Result WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
AP4_ByteStream* data_stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.cpp
index 5fcdab9da..4864e260a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - hmhd Atoms
+| AP4 - hmhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,15 +41,15 @@ AP4_HmhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_HmhdAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_HmhdAtom::AP4_HmhdAtom
+---------------------------------------------------------------------*/
-AP4_HmhdAtom::AP4_HmhdAtom(AP4_UI32 size,
+AP4_HmhdAtom::AP4_HmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -72,23 +72,23 @@ AP4_HmhdAtom::WriteFields(AP4_ByteStream& stream)
// max pdu size
result = stream.WriteUI16(m_MaxPduSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// avg pdu size
result = stream.WriteUI16(m_AvgPduSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// max bitrate
result = stream.WriteUI32(m_MaxBitrate);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// avg bitrate
result = stream.WriteUI32(m_AvgBitrate);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// reserved
result = stream.WriteUI32(m_Reserved);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.h
index 69e68efa0..c26417dc7 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4HmhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - hmhd Atoms
+| AP4 - hmhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -55,7 +55,7 @@ public:
private:
// methods
- AP4_HmhdAtom(AP4_UI32 size,
+ AP4_HmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.cpp
index 4910f51cd..8e2df2fb2 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - iKMS Atoms
+| AP4 - iKMS Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,8 +45,8 @@ AP4_IkmsAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 1) return NULL;
return new AP4_IkmsAtom(size, version, flags, stream);
}
@@ -61,32 +61,28 @@ AP4_IkmsAtom::AP4_IkmsAtom(const char* kms_uri,
m_KmsId(kms_id),
m_KmsVersion(kms_version)
{
- m_Size32 += m_KmsUri.GetLength() + 1;
+ m_Size32 += m_KmsUri.GetLength()+1;
}
/*----------------------------------------------------------------------
| AP4_IkmsAtom::AP4_IkmsAtom
+---------------------------------------------------------------------*/
-AP4_IkmsAtom::AP4_IkmsAtom(AP4_UI32 size,
+AP4_IkmsAtom::AP4_IkmsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_IKMS, size, version, flags)
{
- AP4_Size string_size = size - AP4_FULL_ATOM_HEADER_SIZE;
- if(m_Version == 1 && string_size >= 8)
- {
+ AP4_Size string_size = size-AP4_FULL_ATOM_HEADER_SIZE;
+ if (m_Version == 1 && string_size >= 8) {
string_size -= 8;
stream.ReadUI32(m_KmsId);
stream.ReadUI32(m_KmsVersion);
- }
- else
- {
+ } else {
m_KmsId = 0;
m_KmsVersion = 0;
}
- if(string_size)
- {
+ if (string_size) {
char* str = new char[string_size];
stream.Read(str, string_size);
str[string_size-1] = '\0'; // force null-termination
@@ -98,7 +94,7 @@ AP4_IkmsAtom::AP4_IkmsAtom(AP4_UI32 size,
/*----------------------------------------------------------------------
| AP4_IkmsAtom::Clone
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_IkmsAtom::Clone()
{
return new AP4_IkmsAtom(m_KmsUri.GetChars(), m_KmsId, m_KmsVersion);
@@ -111,21 +107,20 @@ AP4_Result
AP4_IkmsAtom::WriteFields(AP4_ByteStream& stream)
{
// handler version 1
- if(m_Version == 1)
- {
+ if (m_Version == 1) {
stream.WriteUI32(m_KmsId);
stream.WriteUI32(m_KmsVersion);
}
// kms uri
- AP4_Result result = stream.Write(m_KmsUri.GetChars(), m_KmsUri.GetLength() + 1);
- if(AP4_FAILED(result)) return result;
+ AP4_Result result = stream.Write(m_KmsUri.GetChars(), m_KmsUri.GetLength()+1);
+ if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
- AP4_Size padding = m_Size32 - (AP4_FULL_ATOM_HEADER_SIZE + m_KmsUri.GetLength() + 1);
- if(m_Version == 1) padding -= 8;
- while(padding--) stream.WriteUI08(0);
-
+ AP4_Size padding = m_Size32-(AP4_FULL_ATOM_HEADER_SIZE+m_KmsUri.GetLength()+1);
+ if (m_Version == 1) padding-=8;
+ while (padding--) stream.WriteUI08(0);
+
return AP4_SUCCESS;
}
@@ -135,8 +130,7 @@ AP4_IkmsAtom::WriteFields(AP4_ByteStream& stream)
AP4_Result
AP4_IkmsAtom::InspectFields(AP4_AtomInspector& inspector)
{
- if(m_Version == 1)
- {
+ if (m_Version == 1) {
char id[5];
AP4_FormatFourChars(id, m_KmsId);
inspector.AddField("kms_id", id);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.h
index 2e2756757..7097b84bd 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IkmsAtom.h
@@ -56,22 +56,13 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- const AP4_String& GetKmsUri()
- {
- return m_KmsUri;
- }
- AP4_UI32 GetKmsId()
- {
- return m_KmsId;
- }
- AP4_UI32 GetKmsVersion()
- {
- return m_KmsVersion;
- }
+ const AP4_String& GetKmsUri() { return m_KmsUri; }
+ AP4_UI32 GetKmsId() { return m_KmsId; }
+ AP4_UI32 GetKmsVersion() { return m_KmsVersion; }
private:
// methods
- AP4_IkmsAtom(AP4_UI32 size,
+ AP4_IkmsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Interfaces.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Interfaces.h
index 462bfe2d8..56502dab6 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Interfaces.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Interfaces.h
@@ -60,7 +60,7 @@ public:
+---------------------------------------------------------------------*/
class AP4_Referenceable
{
-public:
+ public:
// methods
virtual ~AP4_Referenceable() {}
virtual void AddReference() = 0;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.cpp
index 2d6822540..4baab3ce7 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.cpp
@@ -46,8 +46,8 @@ AP4_IodsAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_IodsAtom(size, version, flags, stream);
}
@@ -58,13 +58,13 @@ AP4_IodsAtom::AP4_IodsAtom(AP4_ObjectDescriptor* descriptor) :
AP4_Atom(AP4_ATOM_TYPE_IODS, AP4_FULL_ATOM_HEADER_SIZE, 0, 0),
m_ObjectDescriptor(descriptor)
{
- if(m_ObjectDescriptor) m_Size32 += m_ObjectDescriptor->GetSize();
+ if (m_ObjectDescriptor) m_Size32 += m_ObjectDescriptor->GetSize();
}
/*----------------------------------------------------------------------
| AP4_IodsAtom::AP4_IodsAtom
+---------------------------------------------------------------------*/
-AP4_IodsAtom::AP4_IodsAtom(AP4_UI32 size,
+AP4_IodsAtom::AP4_IodsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -72,13 +72,10 @@ AP4_IodsAtom::AP4_IodsAtom(AP4_UI32 size,
{
// read the descriptor
AP4_Descriptor* descriptor = NULL;
- if(AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor) == AP4_SUCCESS)
- {
+ if (AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor) == AP4_SUCCESS) {
m_ObjectDescriptor = AP4_DYNAMIC_CAST(AP4_ObjectDescriptor, descriptor);
- if(m_ObjectDescriptor == NULL) delete descriptor;
- }
- else
- {
+ if (m_ObjectDescriptor == NULL) delete descriptor;
+ } else {
m_ObjectDescriptor = NULL;
}
}
@@ -98,7 +95,7 @@ AP4_Result
AP4_IodsAtom::WriteFields(AP4_ByteStream& stream)
{
// write the es descriptor
- if(m_ObjectDescriptor) return m_ObjectDescriptor->Write(stream);
+ if (m_ObjectDescriptor) return m_ObjectDescriptor->Write(stream);
return AP4_SUCCESS;
}
@@ -110,8 +107,7 @@ AP4_Result
AP4_IodsAtom::InspectFields(AP4_AtomInspector& inspector)
{
// inspect descriptor
- if(m_ObjectDescriptor)
- {
+ if (m_ObjectDescriptor) {
m_ObjectDescriptor->Inspect(inspector);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.h
index fb7c1a67a..41c6c4cf0 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IodsAtom.h
@@ -54,17 +54,14 @@ public:
// methods
AP4_IodsAtom(AP4_ObjectDescriptor* descriptor); // ownership of 'descriptor' is transfered
- ~AP4_IodsAtom();
+ ~AP4_IodsAtom();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
- const AP4_ObjectDescriptor* GetObjectDescriptor() const
- {
- return m_ObjectDescriptor;
- }
-
+ const AP4_ObjectDescriptor* GetObjectDescriptor() const { return m_ObjectDescriptor; }
+
private:
// methods
- AP4_IodsAtom(AP4_UI32 size,
+ AP4_IodsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.cpp
index 2d2256d4b..c3e057ae1 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.cpp
@@ -52,14 +52,13 @@ AP4_IpmpDescriptorPointer::AP4_IpmpDescriptorPointer(AP4_UI08 descriptor_id) :
/*----------------------------------------------------------------------
| AP4_IpmpDescriptorPointer::AP4_IpmpDescriptorPointer
+---------------------------------------------------------------------*/
-AP4_IpmpDescriptorPointer::AP4_IpmpDescriptorPointer(AP4_ByteStream& stream,
- AP4_Size header_size,
- AP4_Size payload_size) :
+AP4_IpmpDescriptorPointer::AP4_IpmpDescriptorPointer(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR_POINTER, header_size, payload_size)
{
stream.ReadUI08(m_DescriptorId);
- if(m_DescriptorId == 0xFF && payload_size >= 5)
- {
+ if (m_DescriptorId == 0xFF && payload_size >= 5) {
stream.ReadUI16(m_DescriptorIdEx);
stream.ReadUI16(m_EsId);
}
@@ -72,8 +71,7 @@ AP4_Result
AP4_IpmpDescriptorPointer::WriteFields(AP4_ByteStream& stream)
{
stream.WriteUI08(m_DescriptorId);
- if(m_DescriptorId == 0xFF)
- {
+ if (m_DescriptorId == 0xFF) {
stream.WriteUI16(m_DescriptorIdEx);
stream.WriteUI16(m_EsId);
}
@@ -87,12 +85,11 @@ AP4_Result
AP4_IpmpDescriptorPointer::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[IPMP_DescriptorPointer]", info);
inspector.AddField("IPMP_DescriptorID", m_DescriptorId);
- if(m_DescriptorId == 0xFF)
- {
+ if (m_DescriptorId == 0xFF) {
inspector.AddField("IPMP_DescriptorIDEx", m_DescriptorIdEx);
inspector.AddField("IPMP_ES_ID", m_EsId);
}
@@ -119,7 +116,7 @@ AP4_IpmpDescriptor::AP4_IpmpDescriptor(AP4_UI08 descriptor_id, AP4_UI16 ipmps_ty
/*----------------------------------------------------------------------
| AP4_IpmpDescriptor::AP4_IpmpDescriptor
+---------------------------------------------------------------------*/
-AP4_IpmpDescriptor::AP4_IpmpDescriptor(AP4_ByteStream& stream,
+AP4_IpmpDescriptor::AP4_IpmpDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR, header_size, payload_size),
@@ -130,40 +127,31 @@ AP4_IpmpDescriptor::AP4_IpmpDescriptor(AP4_ByteStream& stream,
stream.ReadUI08(m_DescriptorId);
stream.ReadUI16(m_IpmpsType);
AP4_SetMemory(m_ToolId, 0, sizeof(m_ToolId));
- if(m_DescriptorId == 0xFF && m_IpmpsType == 0xFFFF)
- {
- AP4_Size fields_size = 3 + 3;
+ if (m_DescriptorId == 0xFF && m_IpmpsType == 0xFFFF) {
+ AP4_Size fields_size = 3+3;
stream.ReadUI16(m_DescriptorIdEx);
stream.Read(m_ToolId, 16);
stream.ReadUI08(m_ControlPointCode);
- if(m_ControlPointCode > 0)
- {
+ if (m_ControlPointCode > 0) {
stream.ReadUI08(m_SequenceCode);
++fields_size;
}
- if(fields_size < payload_size)
- {
- m_Data.SetDataSize(payload_size - fields_size);
- stream.Read(m_Data.UseData(), payload_size - fields_size);
+ if (fields_size < payload_size) {
+ m_Data.SetDataSize(payload_size-fields_size);
+ stream.Read(m_Data.UseData(), payload_size-fields_size);
}
- }
- else if(m_IpmpsType == 0)
- {
- if(payload_size > 3)
- {
+ } else if (m_IpmpsType == 0) {
+ if (payload_size > 3) {
char* buffer = new char[1+payload_size-3];
buffer[payload_size-3] = '\0';
- stream.Read(buffer, payload_size - 3);
- m_Url.Assign(buffer, payload_size - 3);
+ stream.Read(buffer, payload_size-3);
+ m_Url.Assign(buffer, payload_size-3);
delete[] buffer;
}
- }
- else
- {
- if(payload_size > 3)
- {
- m_Data.SetDataSize(payload_size - 3);
- stream.Read(m_Data.UseData(), payload_size - 3);
+ } else {
+ if (payload_size > 3) {
+ m_Data.SetDataSize(payload_size-3);
+ stream.Read(m_Data.UseData(), payload_size-3);
}
}
}
@@ -187,29 +175,22 @@ AP4_IpmpDescriptor::WriteFields(AP4_ByteStream& stream)
{
stream.WriteUI08(m_DescriptorId);
stream.WriteUI16(m_IpmpsType);
- if(m_DescriptorId == 0xFF && m_IpmpsType == 0xFFFF)
- {
+ if (m_DescriptorId == 0xFF && m_IpmpsType == 0xFFFF) {
stream.WriteUI16(m_DescriptorIdEx);
stream.Write(m_ToolId, 16);
stream.WriteUI08(m_ControlPointCode);
- if(m_ControlPointCode > 0)
- {
+ if (m_ControlPointCode > 0) {
stream.WriteUI08(m_SequenceCode);
}
- if(m_Data.GetDataSize())
- {
+ if (m_Data.GetDataSize()) {
stream.Write(m_Data.GetData(), m_Data.GetDataSize());
}
- }
- else if(m_IpmpsType == 0)
- {
- stream.Write(m_Url.GetChars(), m_Url.GetLength() + 1);
- }
- else
- {
+ } else if (m_IpmpsType == 0) {
+ stream.Write(m_Url.GetChars(), m_Url.GetLength()+1);
+ } else {
stream.Write(m_Data.GetData(), m_Data.GetDataSize());
}
-
+
return AP4_SUCCESS;
}
@@ -220,27 +201,21 @@ AP4_Result
AP4_IpmpDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[IPMP_Descriptor]", info);
inspector.AddField("IPMP_DescriptorID", m_DescriptorId);
inspector.AddField("IPMPS_Type", m_IpmpsType, AP4_AtomInspector::HINT_HEX);
- if(m_DescriptorId == 0xFF && m_IpmpsType == 0xFFFF)
- {
+ if (m_DescriptorId == 0xFF && m_IpmpsType == 0xFFFF) {
inspector.AddField("IPMP_DescriptorIDEx", m_DescriptorIdEx);
inspector.AddField("IPMP_ToolID", (const unsigned char*)(&m_ToolId[0]), 16, AP4_AtomInspector::HINT_HEX);
inspector.AddField("controlPointCode", m_ControlPointCode);
- if(m_ControlPointCode > 0)
- {
+ if (m_ControlPointCode > 0) {
inspector.AddField("sequenceCode", m_SequenceCode);
}
- }
- else if(m_IpmpsType == 0)
- {
+ } else if (m_IpmpsType == 0) {
inspector.AddField("URL", m_Url.GetChars());
- }
- else
- {
+ } else {
inspector.AddField("data size", m_Data.GetDataSize());
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.h
index c5c121f70..52370af6d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Ipmp.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - IPMP
+| AP4 - IPMP
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,96 +45,63 @@ const AP4_UI08 AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR = 0x0B;
/*----------------------------------------------------------------------
| AP4_IpmpDescriptorPointer
+---------------------------------------------------------------------*/
-class AP4_IpmpDescriptorPointer : public AP4_Descriptor
+class AP4_IpmpDescriptorPointer : public AP4_Descriptor
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_IpmpDescriptorPointer, AP4_Descriptor)
// methods
AP4_IpmpDescriptorPointer(AP4_UI08 descriptor_id);
- AP4_IpmpDescriptorPointer(AP4_ByteStream& stream,
- AP4_Size header_size,
+ AP4_IpmpDescriptorPointer(AP4_ByteStream& stream,
+ AP4_Size header_size,
AP4_Size payload_size);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
- AP4_UI08 GetDescriptorId() const
- {
- return m_DescriptorId;
- }
- AP4_UI16 GetDescriptorIdEx() const
- {
- return m_DescriptorIdEx;
- }
- AP4_UI16 GetEsId() const
- {
- return m_EsId;
- }
+ AP4_UI08 GetDescriptorId() const { return m_DescriptorId; }
+ AP4_UI16 GetDescriptorIdEx() const { return m_DescriptorIdEx; }
+ AP4_UI16 GetEsId() const { return m_EsId; }
private:
// members
- AP4_UI08 m_DescriptorId;
- AP4_UI16 m_DescriptorIdEx;
- AP4_UI16 m_EsId;
+ AP4_UI08 m_DescriptorId;
+ AP4_UI16 m_DescriptorIdEx;
+ AP4_UI16 m_EsId;
};
/*----------------------------------------------------------------------
| AP4_IpmpDescriptor
+---------------------------------------------------------------------*/
-class AP4_IpmpDescriptor : public AP4_Descriptor
-{
+class AP4_IpmpDescriptor : public AP4_Descriptor
+{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_IpmpDescriptor, AP4_Descriptor)
// methods
AP4_IpmpDescriptor(AP4_UI08 descriptor_id, AP4_UI16 ipmps_type);
- AP4_IpmpDescriptor(AP4_ByteStream& stream,
- AP4_Size header_size,
+ AP4_IpmpDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
AP4_Size payload_size);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
- AP4_UI08 GetDescriptorId() const
- {
- return m_DescriptorId;
- }
- AP4_UI16 GetIpmpsType() const
- {
- return m_IpmpsType;
- }
- AP4_UI16 GetDescriptorIdEx() const
- {
- return m_DescriptorIdEx;
- }
- const AP4_UI08* GetToolId() const
- {
- return m_ToolId;
- }
- AP4_UI08 GetControlPointCode() const
- {
- return m_ControlPointCode;
- }
- AP4_UI08 GetSequenceCode() const
- {
- return m_SequenceCode;
- }
- const AP4_String& GetUrl() const
- {
- return m_Url;
- }
- const AP4_DataBuffer& GetData() const
- {
- return m_Data;
- }
+ AP4_UI08 GetDescriptorId() const { return m_DescriptorId; }
+ AP4_UI16 GetIpmpsType() const { return m_IpmpsType; }
+ AP4_UI16 GetDescriptorIdEx() const { return m_DescriptorIdEx; }
+ const AP4_UI08* GetToolId() const { return m_ToolId; }
+ AP4_UI08 GetControlPointCode() const { return m_ControlPointCode; }
+ AP4_UI08 GetSequenceCode() const { return m_SequenceCode; }
+ const AP4_String& GetUrl() const { return m_Url; }
+ const AP4_DataBuffer& GetData() const { return m_Data; }
void SetData(const unsigned char* data, AP4_Size data_size);
-
+
private:
// members
- AP4_UI08 m_DescriptorId;
+ AP4_UI08 m_DescriptorId;
AP4_UI16 m_IpmpsType;
- AP4_UI16 m_DescriptorIdEx;
+ AP4_UI16 m_DescriptorIdEx;
AP4_UI08 m_ToolId[16];
AP4_UI08 m_ControlPointCode;
AP4_UI08 m_SequenceCode;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.cpp
index 861ed9597..bf85194b1 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ipro Atoms
+| AP4 - ipro Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -40,14 +40,14 @@
| AP4_IproAtom::Create
+---------------------------------------------------------------------*/
AP4_IproAtom*
-AP4_IproAtom::Create(AP4_Size size,
- AP4_ByteStream& stream,
+AP4_IproAtom::Create(AP4_Size size,
+ AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_IproAtom(size, version, flags, stream, atom_factory);
}
@@ -66,14 +66,12 @@ AP4_IproAtom::AP4_IproAtom(AP4_UI32 size,
stream.ReadUI16(entry_count);
// read all entries
- AP4_LargeSize bytes_available = size - AP4_FULL_ATOM_HEADER_SIZE - 2;
- for(unsigned int i = 0; i < entry_count; i++)
- {
+ AP4_LargeSize bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-2;
+ for (unsigned int i=0; i<entry_count; i++) {
AP4_Atom* atom;
- if(AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
- bytes_available,
- atom)))
- {
+ if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom))) {
atom->SetParent(this);
m_Children.Add(atom);
}
@@ -90,7 +88,7 @@ AP4_IproAtom::WriteFields(AP4_ByteStream& stream)
// entry count
result = stream.WriteUI16(m_Children.ItemCount());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// entries
return m_Children.Apply(AP4_AtomListWriter(stream));
@@ -103,7 +101,7 @@ AP4_Result
AP4_IproAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry-count", m_Children.ItemCount());
-
+
// inspect children
m_Children.Apply(AP4_AtomListInspector(inspector));
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.h
index a47724f37..a5c7d0d7f 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IproAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ipro Atoms
+| AP4 - ipro Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.cpp
index 6f573852e..8cd839eae 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - iSFM Atoms
+| AP4 - iSFM Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,8 +45,8 @@ AP4_IsfmAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_IsfmAtom(size, version, flags, stream);
}
@@ -56,7 +56,7 @@ AP4_IsfmAtom::Create(AP4_Size size, AP4_ByteStream& stream)
AP4_IsfmAtom::AP4_IsfmAtom(bool selective_encryption,
AP4_UI08 key_length_indicator,
AP4_UI08 iv_length) :
- AP4_Atom(AP4_ATOM_TYPE_ISFM, AP4_FULL_ATOM_HEADER_SIZE + 3, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_ISFM, AP4_FULL_ATOM_HEADER_SIZE+3, 0, 0),
m_SelectiveEncryption(selective_encryption),
m_KeyIndicatorLength(key_length_indicator),
m_IvLength(iv_length)
@@ -66,7 +66,7 @@ AP4_IsfmAtom::AP4_IsfmAtom(bool selective_encryption,
/*----------------------------------------------------------------------
| AP4_IsfmAtom::AP4_IsfmAtom
+---------------------------------------------------------------------*/
-AP4_IsfmAtom::AP4_IsfmAtom(AP4_UI32 size,
+AP4_IsfmAtom::AP4_IsfmAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -74,7 +74,7 @@ AP4_IsfmAtom::AP4_IsfmAtom(AP4_UI32 size,
{
AP4_UI08 s;
stream.ReadUI08(s);
- m_SelectiveEncryption = ((s & 0x80) != 0);
+ m_SelectiveEncryption = ((s&0x80) != 0);
stream.ReadUI08(m_KeyIndicatorLength);
stream.ReadUI08(m_IvLength);
}
@@ -82,11 +82,11 @@ AP4_IsfmAtom::AP4_IsfmAtom(AP4_UI32 size,
/*----------------------------------------------------------------------
| AP4_IsfmAtom::Clone
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_IsfmAtom::Clone()
{
- return new AP4_IsfmAtom(m_SelectiveEncryption,
- m_KeyIndicatorLength,
+ return new AP4_IsfmAtom(m_SelectiveEncryption,
+ m_KeyIndicatorLength,
m_IvLength);
}
@@ -100,15 +100,15 @@ AP4_IsfmAtom::WriteFields(AP4_ByteStream& stream)
// selective encryption
result = stream.WriteUI08(m_SelectiveEncryption ? 0x80 : 0);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// key indicator length
result = stream.WriteUI08(m_KeyIndicatorLength);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// IV length
result = stream.WriteUI08(m_IvLength);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.h
index a1070e6aa..be6ab8382 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsfmAtom.h
@@ -55,22 +55,13 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- bool GetSelectiveEncryption()
- {
- return m_SelectiveEncryption;
- }
- AP4_UI08 GetKeyIndicatorLength()
- {
- return m_KeyIndicatorLength;
- }
- AP4_UI08 GetIvLength()
- {
- return m_IvLength;
- }
+ bool GetSelectiveEncryption() { return m_SelectiveEncryption; }
+ AP4_UI08 GetKeyIndicatorLength() { return m_KeyIndicatorLength; }
+ AP4_UI08 GetIvLength() { return m_IvLength; }
private:
// methods
- AP4_IsfmAtom(AP4_UI32 size,
+ AP4_IsfmAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.cpp
index e10bec51e..686e68e00 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - iSLT Atom
+| AP4 - iSLT Atom
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,10 +41,9 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_IsltAtom)
| AP4_IsltAtom::AP4_IsltAtom
+---------------------------------------------------------------------*/
AP4_IsltAtom::AP4_IsltAtom(const AP4_UI08* salt) :
- AP4_Atom(AP4_ATOM_TYPE_ISLT, AP4_ATOM_HEADER_SIZE + 8)
+ AP4_Atom(AP4_ATOM_TYPE_ISLT, AP4_ATOM_HEADER_SIZE+8)
{
- for(unsigned int i = 0; i < 8; i++)
- {
+ for (unsigned int i=0; i<8; i++) {
m_Salt[i] = salt[i];
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.h
index bafe15018..949251acb 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsltAtom.h
@@ -44,9 +44,8 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_IsltAtom, AP4_Atom)
// class methods
- static AP4_IsltAtom* Create(AP4_Size size, AP4_ByteStream& stream)
- {
- if(size != AP4_ATOM_HEADER_SIZE + 8) return NULL;
+ static AP4_IsltAtom* Create(AP4_Size size, AP4_ByteStream& stream) {
+ if (size != AP4_ATOM_HEADER_SIZE+8) return NULL;
return new AP4_IsltAtom(size, stream);
}
@@ -56,10 +55,7 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- const AP4_UI08* GetSalt()
- {
- return m_Salt;
- }
+ const AP4_UI08* GetSalt() { return m_Salt; }
private:
// methods
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.cpp
index 9ceffbc55..569ca4951 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.cpp
@@ -47,15 +47,14 @@
| AP4_IsmaCipher::CreateSampleDecrypter
+---------------------------------------------------------------------*/
AP4_Result
-AP4_IsmaCipher::CreateSampleDecrypter(AP4_ProtectedSampleDescription* sample_description,
- const AP4_UI08* key,
+AP4_IsmaCipher::CreateSampleDecrypter(AP4_ProtectedSampleDescription* sample_description,
+ const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_IsmaCipher*& decrypter)
{
// check parameters
- if(key == NULL || block_cipher_factory == NULL)
- {
+ if (key == NULL || block_cipher_factory == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
decrypter = NULL;
@@ -63,26 +62,26 @@ AP4_IsmaCipher::CreateSampleDecrypter(AP4_ProtectedSampleDescription* sample_des
// create the cipher
AP4_BlockCipher* block_cipher = NULL;
AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
// get the scheme info atom
AP4_ContainerAtom* schi = sample_description->GetSchemeInfo()->GetSchiAtom();
- if(schi == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (schi == NULL) return AP4_ERROR_INVALID_FORMAT;
// get the cipher params
AP4_IsfmAtom* isfm = AP4_DYNAMIC_CAST(AP4_IsfmAtom, schi->FindChild("iSFM"));
- if(isfm == NULL) return AP4_ERROR_INVALID_FORMAT;
-
+ if (isfm == NULL) return AP4_ERROR_INVALID_FORMAT;
+
// get the salt
AP4_IsltAtom* salt = AP4_DYNAMIC_CAST(AP4_IsltAtom, schi->FindChild("iSLT"));
// instantiate the decrypter
- decrypter = new AP4_IsmaCipher(block_cipher,
- salt ? salt->GetSalt() : NULL,
+ decrypter = new AP4_IsmaCipher(block_cipher,
+ salt?salt->GetSalt():NULL,
isfm->GetIvLength(),
isfm->GetKeyIndicatorLength(),
isfm->GetSelectiveEncryption());
@@ -92,10 +91,10 @@ AP4_IsmaCipher::CreateSampleDecrypter(AP4_ProtectedSampleDescription* sample_des
/*----------------------------------------------------------------------
| AP4_IsmaCrypCipher::AP4_IsmaCipher
+---------------------------------------------------------------------*/
-AP4_IsmaCipher::AP4_IsmaCipher(AP4_BlockCipher* block_cipher,
- const AP4_UI08* salt,
- AP4_UI08 iv_length,
- AP4_UI08 key_indicator_length,
+AP4_IsmaCipher::AP4_IsmaCipher(AP4_BlockCipher* block_cipher,
+ const AP4_UI08* salt,
+ AP4_UI08 iv_length,
+ AP4_UI08 key_indicator_length,
bool selective_encryption) :
m_IvLength(iv_length),
m_KeyIndicatorLength(key_indicator_length),
@@ -105,19 +104,16 @@ AP4_IsmaCipher::AP4_IsmaCipher(AP4_BlockCipher* block_cipher,
// left-align the salt
unsigned char salt_128[AP4_CIPHER_BLOCK_SIZE];
- unsigned int i = 0;
- if(salt)
- {
- for(; i < 8; i++)
- {
+ unsigned int i=0;
+ if (salt) {
+ for (; i<8; i++) {
salt_128[i] = salt[i];
}
}
- for(; i < AP4_CIPHER_BLOCK_SIZE; i++)
- {
+ for (; i<AP4_CIPHER_BLOCK_SIZE; i++) {
salt_128[i] = 0;
}
-
+
// create a cipher
m_Cipher = new AP4_CtrStreamCipher(block_cipher, salt_128, iv_length);
}
@@ -133,21 +129,20 @@ AP4_IsmaCipher::~AP4_IsmaCipher()
/*----------------------------------------------------------------------
| AP4_IsmaCipher::GetDecryptedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_IsmaCipher::GetDecryptedSampleSize(AP4_Sample& sample)
{
AP4_Size isma_header_size = m_KeyIndicatorLength + m_IvLength;
- if(m_SelectiveEncryption)
- {
+ if (m_SelectiveEncryption) {
++isma_header_size;
}
- return sample.GetSize() - isma_header_size;
+ return sample.GetSize()-isma_header_size;
}
/*----------------------------------------------------------------------
| AP4_IsmaCipher::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_IsmaCipher::DecryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out,
const AP4_UI08* /*iv*/)
@@ -157,57 +152,50 @@ AP4_IsmaCipher::DecryptSampleData(AP4_DataBuffer& data_in,
AP4_Size in_size = data_in.GetDataSize();
AP4_Size header_size;
- // default to 0 output
+ // default to 0 output
data_out.SetDataSize(0);
// check the selective encryption flag
- if(in_size < 1) return AP4_ERROR_INVALID_FORMAT;
- if(m_SelectiveEncryption)
- {
- is_encrypted = ((in[0] & 0x80) != 0);
+ if (in_size < 1) return AP4_ERROR_INVALID_FORMAT;
+ if (m_SelectiveEncryption) {
+ is_encrypted = ((in[0]&0x80)!=0);
in++;
}
// check the header size
- header_size = (m_SelectiveEncryption ? 1 : 0) +
- (is_encrypted ? m_KeyIndicatorLength + m_IvLength : 0);
- if(header_size > in_size) return AP4_ERROR_INVALID_FORMAT;
+ header_size = (m_SelectiveEncryption?1:0)+
+ (is_encrypted?m_KeyIndicatorLength+m_IvLength:0);
+ if (header_size > in_size) return AP4_ERROR_INVALID_FORMAT;
// process the sample data
- AP4_Size payload_size = in_size - header_size;
+ AP4_Size payload_size = in_size-header_size;
data_out.SetDataSize(payload_size);
AP4_UI08* out = data_out.UseData();
- if(is_encrypted)
- {
+ if (is_encrypted) {
// get the IV
const AP4_UI08* iv = in;
in += m_IvLength;
// get the key indicator (we only support up to 32 bits)
unsigned int to_read = m_KeyIndicatorLength;
- while(to_read > 4)
- {
+ while (to_read > 4) {
// skip anything above 4 bytes
to_read--;
in++;
}
AP4_UI32 key_indicator = 0;
- while(to_read--)
- {
- key_indicator = (key_indicator << 8) | *in++;
+ while (to_read--) {
+ key_indicator = (key_indicator<<8) | *in++;
header_size++;
}
// we only support key indicator = 0 for now... (TODO)
- if(key_indicator != 0)
- {
+ if (key_indicator != 0) {
return AP4_ERROR_NOT_SUPPORTED;
}
m_Cipher->SetIV(iv);
m_Cipher->ProcessBuffer(in, payload_size, out);
- }
- else
- {
+ } else {
AP4_CopyMemory(out, in, payload_size);
}
@@ -217,14 +205,14 @@ AP4_IsmaCipher::DecryptSampleData(AP4_DataBuffer& data_in,
/*----------------------------------------------------------------------
| AP4_IsmaCipher::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_IsmaCipher::EncryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out,
AP4_UI32 iv)
{
// setup the buffers
const unsigned char* in = data_in.GetData();
- data_out.SetDataSize(data_in.GetDataSize() + 4);
+ data_out.SetDataSize(data_in.GetDataSize()+4);
unsigned char* out = data_out.UseData();
// IV on 4 bytes
@@ -233,7 +221,7 @@ AP4_IsmaCipher::EncryptSampleData(AP4_DataBuffer& data_in,
// encrypt the payload
m_Cipher->SetIV(out);
AP4_Size data_size = data_in.GetDataSize();
- m_Cipher->ProcessBuffer(in, data_size, out + 4);
+ m_Cipher->ProcessBuffer(in, data_size, out+4);
return AP4_SUCCESS;
}
@@ -242,7 +230,7 @@ AP4_IsmaCipher::EncryptSampleData(AP4_DataBuffer& data_in,
| AP4_IsmaTrackDecrypter::Create
+---------------------------------------------------------------------*/
AP4_Result
-AP4_IsmaTrackDecrypter::Create(const AP4_UI08* key,
+AP4_IsmaTrackDecrypter::Create(const AP4_UI08* key,
AP4_Size key_size,
AP4_ProtectedSampleDescription* sample_description,
AP4_SampleEntry* sample_entry,
@@ -253,15 +241,15 @@ AP4_IsmaTrackDecrypter::Create(const AP4_UI08* key,
AP4_IsmaCipher* cipher = NULL;
decrypter = NULL;
AP4_Result result = AP4_IsmaCipher::CreateSampleDecrypter(sample_description,
- key,
- key_size,
- block_cipher_factory,
- cipher);
- if(AP4_FAILED(result)) return result;
+ key,
+ key_size,
+ block_cipher_factory,
+ cipher);
+ if (AP4_FAILED(result)) return result;
// instanciate the object
- decrypter = new AP4_IsmaTrackDecrypter(cipher,
- sample_entry,
+ decrypter = new AP4_IsmaTrackDecrypter(cipher,
+ sample_entry,
sample_description->GetOriginalFormat());
return AP4_SUCCESS;
}
@@ -270,8 +258,8 @@ AP4_IsmaTrackDecrypter::Create(const AP4_UI08* key,
| AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter
+---------------------------------------------------------------------*/
AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter(AP4_IsmaCipher* cipher,
- AP4_SampleEntry* sample_entry,
- AP4_UI32 original_format) :
+ AP4_SampleEntry* sample_entry,
+ AP4_UI32 original_format) :
m_Cipher(cipher),
m_SampleEntry(sample_entry),
m_OriginalFormat(original_format)
@@ -289,7 +277,7 @@ AP4_IsmaTrackDecrypter::~AP4_IsmaTrackDecrypter()
/*----------------------------------------------------------------------
| AP4_IsmaTrackDecrypter::GetProcessedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_IsmaTrackDecrypter::GetProcessedSampleSize(AP4_Sample& sample)
{
return m_Cipher->GetDecryptedSampleSize(sample);
@@ -298,7 +286,7 @@ AP4_IsmaTrackDecrypter::GetProcessedSampleSize(AP4_Sample& sample)
/*----------------------------------------------------------------------
| AP4_IsmaTrackDecrypter::ProcessTrack
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_IsmaTrackDecrypter::ProcessTrack()
{
m_SampleEntry->SetType(m_OriginalFormat);
@@ -309,7 +297,7 @@ AP4_IsmaTrackDecrypter::ProcessTrack()
/*----------------------------------------------------------------------
| AP4_IsmaDecrypter::ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_IsmaTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out)
{
@@ -319,8 +307,7 @@ AP4_IsmaTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
/*----------------------------------------------------------------------
| AP4_IsmaTrackEncrypter
+---------------------------------------------------------------------*/
-class AP4_IsmaTrackEncrypter : public AP4_Processor::TrackHandler
-{
+class AP4_IsmaTrackEncrypter : public AP4_Processor::TrackHandler {
public:
// constructor
AP4_IsmaTrackEncrypter(const char* kms_uri,
@@ -374,16 +361,16 @@ AP4_IsmaTrackEncrypter::~AP4_IsmaTrackEncrypter()
/*----------------------------------------------------------------------
| AP4_IsmaTrackEncrypter::GetProcessedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_IsmaTrackEncrypter::GetProcessedSampleSize(AP4_Sample& sample)
{
- return sample.GetSize() + 4; //fixed header size for now
+ return sample.GetSize()+4; //fixed header size for now
}
/*----------------------------------------------------------------------
| AP4_IsmaTrackEncrypter::ProcessTrack
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_IsmaTrackEncrypter::ProcessTrack()
{
// sinf container
@@ -391,16 +378,16 @@ AP4_IsmaTrackEncrypter::ProcessTrack()
// original format
AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType());
-
+
// scheme
AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_PROTECTION_SCHEME_TYPE_IAEC, 1);
-
+
// scheme info
AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI);
AP4_IkmsAtom* ikms = new AP4_IkmsAtom(m_KmsUri.GetChars());
- AP4_IsfmAtom* isfm = new AP4_IsfmAtom(m_Cipher->GetSelectiveEncryption(),
- m_Cipher->GetKeyIndicatorLength(),
- m_Cipher->GetIvLength());
+ AP4_IsfmAtom* isfm = new AP4_IsfmAtom(m_Cipher->GetSelectiveEncryption(),
+ m_Cipher->GetKeyIndicatorLength(),
+ m_Cipher->GetIvLength());
AP4_IsltAtom* islt = new AP4_IsltAtom(m_Cipher->GetCipher()->GetIV());
// populate the schi container
@@ -418,21 +405,21 @@ AP4_IsmaTrackEncrypter::ProcessTrack()
// change the atom type of the sample description
m_SampleEntry->SetType(m_Format);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_IsmaTrackEncrypter::ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_IsmaTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out)
{
AP4_Result result = m_Cipher->EncryptSampleData(data_in, data_out, m_Counter);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
- m_Counter += (data_in.GetDataSize() + AP4_CIPHER_BLOCK_SIZE - 1) / AP4_CIPHER_BLOCK_SIZE;
+ m_Counter += (data_in.GetDataSize()+AP4_CIPHER_BLOCK_SIZE-1)/AP4_CIPHER_BLOCK_SIZE;
return AP4_SUCCESS;
}
@@ -440,15 +427,12 @@ AP4_IsmaTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
| AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor
+---------------------------------------------------------------------*/
AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor(const char* kms_uri,
- AP4_BlockCipherFactory* block_cipher_factory) :
+ AP4_BlockCipherFactory* block_cipher_factory) :
m_KmsUri(kms_uri)
{
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -456,72 +440,66 @@ AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor(const char*
/*----------------------------------------------------------------------
| AP4_IsmaEncryptingProcessor:CreateTrackHandler
+---------------------------------------------------------------------*/
-AP4_Processor::TrackHandler*
+AP4_Processor::TrackHandler*
AP4_IsmaEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// find the stsd atom
AP4_StsdAtom* stsd = AP4_DYNAMIC_CAST(AP4_StsdAtom, trak->FindChild("mdia/minf/stbl/stsd"));
// avoid tracks with no stsd atom (should not happen)
- if(stsd == NULL) return NULL;
+ if (stsd == NULL) return NULL;
// only look at the first sample description
AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
- if(entry == NULL) return NULL;
-
+ if (entry == NULL) return NULL;
+
// create a handler for this track if we have a key for it and we know
// how to map the type
const AP4_UI08* key;
const AP4_UI08* salt;
AP4_UI32 format = 0;
- if(AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, salt)))
- {
- switch(entry->GetType())
- {
- case AP4_ATOM_TYPE_MP4A:
- format = AP4_ATOM_TYPE_ENCA;
- break;
-
- case AP4_ATOM_TYPE_MP4V:
- case AP4_ATOM_TYPE_AVC1:
- format = AP4_ATOM_TYPE_ENCV;
- break;
-
- default:
- {
- // try to find if this is audio or video
- AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, trak->FindChild("mdia/hdlr"));
- if(hdlr)
- {
- switch(hdlr->GetHandlerType())
- {
- case AP4_HANDLER_TYPE_SOUN:
- format = AP4_ATOM_TYPE_ENCA;
- break;
-
- case AP4_HANDLER_TYPE_VIDE:
- format = AP4_ATOM_TYPE_ENCV;
- break;
+ if (AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, salt))) {
+ switch (entry->GetType()) {
+ case AP4_ATOM_TYPE_MP4A:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ case AP4_ATOM_TYPE_AVC1:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+
+ default: {
+ // try to find if this is audio or video
+ AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, trak->FindChild("mdia/hdlr"));
+ if (hdlr) {
+ switch (hdlr->GetHandlerType()) {
+ case AP4_HANDLER_TYPE_SOUN:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_HANDLER_TYPE_VIDE:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+ }
}
+ break;
}
- break;
- }
}
- if(format)
- {
+ if (format) {
// create the block cipher
AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = m_BlockCipherFactory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- AP4_CIPHER_BLOCK_SIZE,
- block_cipher);
- if(AP4_FAILED(result)) return NULL;
+ AP4_Result result = m_BlockCipherFactory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ AP4_CIPHER_BLOCK_SIZE,
+ block_cipher);
+ if (AP4_FAILED(result)) return NULL;
// create the encrypter
- return new AP4_IsmaTrackEncrypter(m_KmsUri.GetChars(),
- block_cipher,
- salt,
+ return new AP4_IsmaTrackEncrypter(m_KmsUri.GetChars(),
+ block_cipher,
+ salt,
entry,
format);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.h
index 703d3268d..34cde13d8 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4IsmaCryp.h
@@ -49,7 +49,7 @@ class AP4_IsfmAtom;
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_IAEC = AP4_ATOM_TYPE('i', 'A', 'E', 'C');
+const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_IAEC = AP4_ATOM_TYPE('i','A','E','C');
/*----------------------------------------------------------------------
| AP4_IsmaCipher
@@ -59,18 +59,18 @@ class AP4_IsmaCipher : public AP4_SampleDecrypter
public:
// factory
static AP4_Result CreateSampleDecrypter(AP4_ProtectedSampleDescription* sample_description,
- const AP4_UI08* key,
+ const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_IsmaCipher*& decrypter);
// constructor and destructor
- AP4_IsmaCipher(AP4_BlockCipher* block_cipher,
+ AP4_IsmaCipher(AP4_BlockCipher* block_cipher,
const AP4_UI08* salt,
AP4_UI08 iv_length,
AP4_UI08 key_indicator_length,
bool selective_encryption);
- ~AP4_IsmaCipher();
+ ~AP4_IsmaCipher();
AP4_Result EncryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out,
AP4_UI32 offset);
@@ -78,22 +78,10 @@ public:
AP4_DataBuffer& data_out,
const AP4_UI08* iv = NULL);
AP4_Size GetDecryptedSampleSize(AP4_Sample& sample);
- AP4_CtrStreamCipher* GetCipher()
- {
- return m_Cipher;
- }
- AP4_UI08 GetIvLength()
- {
- return m_IvLength;
- }
- AP4_UI08 GetKeyIndicatorLength()
- {
- return m_KeyIndicatorLength;
- }
- bool GetSelectiveEncryption()
- {
- return m_SelectiveEncryption;
- }
+ AP4_CtrStreamCipher* GetCipher() { return m_Cipher; }
+ AP4_UI08 GetIvLength() { return m_IvLength; }
+ AP4_UI08 GetKeyIndicatorLength() { return m_KeyIndicatorLength; }
+ bool GetSelectiveEncryption(){ return m_SelectiveEncryption;}
private:
// members
@@ -106,11 +94,10 @@ private:
/*----------------------------------------------------------------------
| AP4_IsmaTrackDecrypter
+---------------------------------------------------------------------*/
-class AP4_IsmaTrackDecrypter : public AP4_Processor::TrackHandler
-{
+class AP4_IsmaTrackDecrypter : public AP4_Processor::TrackHandler {
public:
// construction
- static AP4_Result Create(const AP4_UI08* key,
+ static AP4_Result Create(const AP4_UI08* key,
AP4_Size key_size,
AP4_ProtectedSampleDescription* sample_description,
AP4_SampleEntry* sample_entry,
@@ -148,10 +135,7 @@ public:
AP4_BlockCipherFactory* block_cipher_factory = NULL);
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
// methods
virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.cpp
index d77329f0c..e8c32b558 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.cpp
@@ -48,8 +48,7 @@ AP4_LinearReader::AP4_LinearReader(AP4_Movie& movie, AP4_Size max_buffer) :
+---------------------------------------------------------------------*/
AP4_LinearReader::~AP4_LinearReader()
{
- for(unsigned int i = 0; i < m_Trackers.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_Trackers.ItemCount(); i++) {
delete m_Trackers[i];
}
}
@@ -57,16 +56,16 @@ AP4_LinearReader::~AP4_LinearReader()
/*----------------------------------------------------------------------
| AP4_LinearReader::EnableTrack
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_LinearReader::EnableTrack(AP4_UI32 track_id)
{
// check if we don't already have this
- if(FindTracker(track_id)) return AP4_SUCCESS;
+ if (FindTracker(track_id)) return AP4_SUCCESS;
// find the track in the movie
AP4_Track* track = m_Movie.GetTrack(track_id);
- if(track == NULL) return AP4_ERROR_NO_SUCH_ITEM;
-
+ if (track == NULL) return AP4_ERROR_NO_SUCH_ITEM;
+
// create a new entry for the track
return m_Trackers.Append(new Tracker(track));
}
@@ -74,32 +73,30 @@ AP4_LinearReader::EnableTrack(AP4_UI32 track_id)
/*----------------------------------------------------------------------
| AP4_LinearReader::SetSampleIndex
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_LinearReader::SetSampleIndex(AP4_UI32 track_id, AP4_UI32 sample_index)
{
Tracker* tracker = FindTracker(track_id);
- if(tracker == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ if (tracker == NULL) return AP4_ERROR_INVALID_PARAMETERS;
assert(tracker->m_Track);
delete tracker->m_NextSample;
tracker->m_NextSample = NULL;
- if(sample_index >= tracker->m_Track->GetSampleCount())
- {
+ if (sample_index >= tracker->m_Track->GetSampleCount()) {
return AP4_ERROR_OUT_OF_RANGE;
}
tracker->m_Eos = false;
tracker->m_NextSampleIndex = sample_index;
-
+
// empty any queued samples
- for(AP4_List<SampleBuffer>::Item* item = tracker->m_Samples.FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<SampleBuffer>::Item* item = tracker->m_Samples.FirstItem();
+ item;
+ item = item->GetNext()) {
SampleBuffer* buffer = item->GetData();
m_BufferFullness -= buffer->m_Sample->GetSize();
delete buffer;
}
tracker->m_Samples.Clear();
-
+
return AP4_SUCCESS;
}
@@ -110,30 +107,25 @@ AP4_Result
AP4_LinearReader::Advance()
{
// first, check if we have space to advance
- if(m_BufferFullness >= m_MaxBufferFullness)
- {
+ if (m_BufferFullness >= m_MaxBufferFullness) {
return AP4_ERROR_NOT_ENOUGH_SPACE;
}
-
+
AP4_UI64 min_offset = (AP4_UI64)(-1);
Tracker* next_tracker = NULL;
- for(unsigned int i = 0; i < m_Trackers.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<m_Trackers.ItemCount(); i++) {
Tracker* tracker = m_Trackers[i];
- if(tracker->m_Eos) continue;
-
+ if (tracker->m_Eos) continue;
+
// get the next sample unless we have it already
- if(tracker->m_NextSample == NULL)
- {
- if(tracker->m_NextSampleIndex >= tracker->m_Track->GetSampleCount())
- {
+ if (tracker->m_NextSample == NULL) {
+ if (tracker->m_NextSampleIndex >= tracker->m_Track->GetSampleCount()) {
tracker->m_Eos = true;
continue;
}
tracker->m_NextSample = new AP4_Sample();
AP4_Result result = tracker->m_Track->GetSample(tracker->m_NextSampleIndex, *tracker->m_NextSample);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
tracker->m_Eos = true;
delete tracker->m_NextSample;
tracker->m_NextSample = NULL;
@@ -141,49 +133,45 @@ AP4_LinearReader::Advance()
}
}
assert(tracker->m_NextSample);
-
+
AP4_UI64 offset = tracker->m_NextSample->GetOffset();
- if(offset < min_offset)
- {
+ if (offset < min_offset) {
min_offset = offset;
next_tracker = tracker;
}
}
-
- if(next_tracker)
- {
+
+ if (next_tracker) {
// read the sample into a buffer
assert(next_tracker->m_NextSample);
SampleBuffer* buffer = new SampleBuffer(next_tracker->m_NextSample);
AP4_Result result = buffer->m_Sample->ReadData(buffer->m_Data);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// add the buffer to the queue
next_tracker->m_Samples.Add(buffer);
m_BufferFullness += next_tracker->m_NextSample->GetSize();
- if(m_BufferFullness > m_BufferFullnessPeak)
- {
+ if (m_BufferFullness > m_BufferFullnessPeak) {
m_BufferFullnessPeak = m_BufferFullness;
}
next_tracker->m_NextSample = NULL;
next_tracker->m_NextSampleIndex++;
return AP4_SUCCESS;
- }
-
- return AP4_ERROR_EOS;
+ }
+
+ return AP4_ERROR_EOS;
}
/*----------------------------------------------------------------------
| AP4_LinearReader::PopSample
+---------------------------------------------------------------------*/
bool
-AP4_LinearReader::PopSample(Tracker* tracker,
- AP4_Sample& sample,
+AP4_LinearReader::PopSample(Tracker* tracker,
+ AP4_Sample& sample,
AP4_DataBuffer& sample_data)
{
SampleBuffer* head = NULL;
- if(AP4_SUCCEEDED(tracker->m_Samples.PopHead(head)))
- {
+ if (AP4_SUCCEEDED(tracker->m_Samples.PopHead(head))) {
assert(head->m_Sample);
sample = *head->m_Sample;
sample_data.SetData(head->m_Data.GetData(), head->m_Data.GetDataSize());
@@ -192,89 +180,81 @@ AP4_LinearReader::PopSample(Tracker* tracker,
delete head;
return true;
}
-
+
return false;
}
/*----------------------------------------------------------------------
| AP4_LinearReader::ReadNextSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_LinearReader::ReadNextSample(AP4_UI32 track_id,
AP4_Sample& sample,
AP4_DataBuffer& sample_data)
{
- if(m_Trackers.ItemCount() == 0)
- {
+ if (m_Trackers.ItemCount() == 0) {
return AP4_ERROR_NO_SUCH_ITEM;
}
-
+
// look for a sample from a specific track
Tracker* tracker = FindTracker(track_id);
- if(tracker == NULL) return AP4_ERROR_INVALID_PARAMETERS;
- for(;;)
- {
- if(tracker->m_Eos) return AP4_ERROR_EOS;
+ if (tracker == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ for(;;) {
+ if (tracker->m_Eos) return AP4_ERROR_EOS;
// pop a sample if we can
- if(PopSample(tracker, sample, sample_data)) return AP4_SUCCESS;
+ if (PopSample(tracker, sample, sample_data)) return AP4_SUCCESS;
AP4_Result result = Advance();
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
-
+
return AP4_ERROR_EOS;
}
/*----------------------------------------------------------------------
| AP4_LinearReader::ReadNextSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_LinearReader::ReadNextSample(AP4_Sample& sample,
AP4_DataBuffer& sample_data,
AP4_UI32& track_id)
{
- if(m_Trackers.ItemCount() == 0)
- {
+ if (m_Trackers.ItemCount() == 0) {
track_id = 0;
return AP4_ERROR_NO_SUCH_ITEM;
}
-
+
// return the oldest buffered sample, if any
AP4_UI64 min_offset = (AP4_UI64)(-1);
Tracker* next_tracker = NULL;
- for(;;)
- {
- for(unsigned int i = 0; i < m_Trackers.ItemCount(); i++)
- {
+ for (;;) {
+ for (unsigned int i=0; i<m_Trackers.ItemCount(); i++) {
Tracker* tracker = m_Trackers[i];
- if(tracker->m_Eos) continue;
-
+ if (tracker->m_Eos) continue;
+
AP4_List<SampleBuffer>::Item* item = tracker->m_Samples.FirstItem();
- if(item)
- {
+ if (item) {
AP4_UI64 offset = item->GetData()->m_Sample->GetOffset();
- if(offset < min_offset)
- {
+ if (offset < min_offset) {
min_offset = offset;
next_tracker = tracker;
}
}
}
-
+
// return the sample if we have found a tracker
- if(next_tracker)
- {
+ if (next_tracker) {
PopSample(next_tracker, sample, sample_data);
track_id = next_tracker->m_Track->GetId();
return AP4_SUCCESS;
}
-
+
// nothing found, read one more sample
AP4_Result result = Advance();
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
-
+
return AP4_ERROR_EOS;
}
@@ -284,11 +264,10 @@ AP4_LinearReader::ReadNextSample(AP4_Sample& sample,
AP4_LinearReader::Tracker*
AP4_LinearReader::FindTracker(AP4_UI32 track_id)
{
- for(unsigned int i = 0; i < m_Trackers.ItemCount(); i++)
- {
- if(m_Trackers[i]->m_Track->GetId() == track_id) return m_Trackers[i];
+ for (unsigned int i=0; i<m_Trackers.ItemCount(); i++) {
+ if (m_Trackers[i]->m_Track->GetId() == track_id) return m_Trackers[i];
}
-
+
// not found
return NULL;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.h
index d5dec5cb3..7ebeff4f7 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4LinearReader.h
@@ -48,81 +48,69 @@ class AP4_Track;
const unsigned int AP4_LINEAR_READER_INITIALIZED = 1;
const unsigned int AP4_LINEAR_READER_FLAG_EOS = 2;
-const unsigned int AP4_LINEAR_READER_DEFAULT_BUFFER_SIZE = 4096 * 1024;
+const unsigned int AP4_LINEAR_READER_DEFAULT_BUFFER_SIZE = 4096*1024;
/*----------------------------------------------------------------------
| AP4_LinearReader
+---------------------------------------------------------------------*/
-class AP4_LinearReader
-{
+class AP4_LinearReader {
public:
- AP4_LinearReader(AP4_Movie& movie, AP4_Size max_buffer = AP4_LINEAR_READER_DEFAULT_BUFFER_SIZE);
- ~AP4_LinearReader();
-
+ AP4_LinearReader(AP4_Movie& movie, AP4_Size max_buffer=AP4_LINEAR_READER_DEFAULT_BUFFER_SIZE);
+ ~AP4_LinearReader();
+
AP4_Result EnableTrack(AP4_UI32 track_id);
/**
* Read the next sample in storage order, from any track.
* track_id is updated to reflect the track from which the sample was read.
*/
- AP4_Result ReadNextSample(AP4_Sample& sample,
+ AP4_Result ReadNextSample(AP4_Sample& sample,
AP4_DataBuffer& sample_data,
AP4_UI32& track_id);
/**
* Read the next sample in storage order from a specific track.
*/
AP4_Result ReadNextSample(AP4_UI32 track_id,
- AP4_Sample& sample,
+ AP4_Sample& sample,
AP4_DataBuffer& sample_data);
-
+
AP4_Result SetSampleIndex(AP4_UI32 track_id, AP4_UI32 sample_index);
-
+
// accessors
- AP4_Size GetBufferFullness()
- {
- return m_BufferFullness;
- }
-
+ AP4_Size GetBufferFullness() { return m_BufferFullness; }
+
private:
- class SampleBuffer
- {
+ class SampleBuffer {
public:
SampleBuffer(AP4_Sample* sample) : m_Sample(sample) {}
- ~SampleBuffer()
- {
- delete m_Sample;
- }
+ ~SampleBuffer() { delete m_Sample; }
AP4_Sample* m_Sample;
AP4_DataBuffer m_Data;
};
- class Tracker
- {
+ class Tracker {
public:
Tracker(AP4_Track* track) :
m_Eos(false),
- m_Track(track),
+ m_Track(track),
m_NextSample(NULL),
m_NextSampleIndex(0) {}
- Tracker(const Tracker& other) :
+ Tracker(const Tracker& other) :
m_Eos(other.m_Eos),
m_Track(other.m_Track),
m_NextSample(NULL),
m_NextSampleIndex(other.m_NextSampleIndex) {} // don't copy samples
- ~Tracker()
- {
- m_Samples.DeleteReferences();
- }
+ ~Tracker() { m_Samples.DeleteReferences(); }
bool m_Eos;
AP4_Track* m_Track;
AP4_Sample* m_NextSample;
AP4_Ordinal m_NextSampleIndex;
AP4_List<SampleBuffer> m_Samples;
};
-
+
// methods
Tracker* FindTracker(AP4_UI32 track_id);
AP4_Result Advance();
bool PopSample(Tracker* tracker, AP4_Sample& sample, AP4_DataBuffer& sample_data);
-
+
// members
AP4_Movie& m_Movie;
AP4_Array<Tracker*> m_Trackers;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4List.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4List.h
index 84891b743..d6a28cc63 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4List.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4List.h
@@ -43,16 +43,16 @@ template <typename T> class AP4_List;
/*----------------------------------------------------------------------
| AP4_List
+---------------------------------------------------------------------*/
-template <typename T>
-class AP4_List
+template <typename T>
+class AP4_List
{
public:
// types
- class Item
+ class Item
{
public:
// types
- class Operator
+ class Operator
{
public:
// methods
@@ -60,7 +60,7 @@ public:
virtual AP4_Result Action(T* data) const = 0;
};
- class Finder
+ class Finder
{
public:
// methods
@@ -70,19 +70,10 @@ public:
// methods
Item(T* data) : m_Data(data), m_Next(0), m_Prev(0) {}
- ~Item() {}
- Item* GetNext()
- {
- return m_Next;
- }
- Item* GetPrev()
- {
- return m_Prev;
- }
- T* GetData()
- {
- return m_Data;
- }
+ ~Item() {}
+ Item* GetNext() { return m_Next; }
+ Item* GetPrev() { return m_Prev; }
+ T* GetData() { return m_Data; }
private:
// members
@@ -95,7 +86,7 @@ public:
};
// methods
- AP4_List<T>(): m_ItemCount(0), m_Head(0), m_Tail(0) {}
+ AP4_List<T>(): m_ItemCount(0), m_Head(0), m_Tail(0) {}
virtual ~AP4_List<T>();
AP4_Result Clear();
AP4_Result Add(T* data);
@@ -111,29 +102,20 @@ public:
AP4_Result Find(const typename Item::Finder& finder, T*& data) const;
AP4_Result ReverseFind(const typename Item::Finder& finder, T*& data) const;
AP4_Result DeleteReferences();
- AP4_Cardinal ItemCount() const
- {
- return m_ItemCount;
- }
- Item* FirstItem() const
- {
- return m_Head;
- }
- Item* LastItem() const
- {
- return m_Tail;
- }
-
+ AP4_Cardinal ItemCount() const { return m_ItemCount; }
+ Item* FirstItem() const { return m_Head; }
+ Item* LastItem() const { return m_Tail; }
+
protected:
// members
AP4_Cardinal m_ItemCount;
Item* m_Head;
Item* m_Tail;
-
+
private:
- // these cannot be used
+ // these cannot be used
AP4_List<T>(const AP4_List<T>&);
- AP4_List<T>& operator=(const AP4_List<T>&);
+ AP4_List<T>& operator=(const AP4_List<T>&);
};
/*----------------------------------------------------------------------
@@ -154,19 +136,18 @@ AP4_Result
AP4_List<T>::Clear()
{
Item* item = m_Head;
-
- while(item)
- {
+
+ while (item) {
Item* next = item->m_Next;
delete item;
item = next;
}
m_ItemCount = 0;
m_Head = m_Tail = NULL;
-
+
return AP4_SUCCESS;
}
-
+
/*----------------------------------------------------------------------
| AP4_List<T>::Add
+---------------------------------------------------------------------*/
@@ -186,15 +167,12 @@ AP4_Result
AP4_List<T>::Add(Item* item)
{
// add element at the tail
- if(m_Tail)
- {
+ if (m_Tail) {
item->m_Prev = m_Tail;
item->m_Next = NULL;
m_Tail->m_Next = item;
m_Tail = item;
- }
- else
- {
+ } else {
m_Head = item;
m_Tail = item;
item->m_Next = NULL;
@@ -203,7 +181,7 @@ AP4_List<T>::Add(Item* item)
// one more item in the list now
m_ItemCount++;
-
+
return AP4_SUCCESS;
}
@@ -216,38 +194,27 @@ AP4_List<T>::Remove(T* data)
{
Item* item = m_Head;
- while(item)
- {
- if(item->m_Data == data)
- {
+ while (item) {
+ if (item->m_Data == data) {
// delete item
- if(item->m_Prev)
- {
+ if (item->m_Prev) {
// item is not the head
- if(item->m_Next)
- {
+ if (item->m_Next) {
// item is not the tail
item->m_Next->m_Prev = item->m_Prev;
item->m_Prev->m_Next = item->m_Next;
- }
- else
- {
+ } else {
// item is the tail
m_Tail = item->m_Prev;
m_Tail->m_Next = NULL;
}
- }
- else
- {
+ } else {
// item is the head
m_Head = item->m_Next;
- if(m_Head)
- {
+ if (m_Head) {
// item is not the tail
m_Head->m_Prev = NULL;
- }
- else
- {
+ } else {
// item is also the tail
m_Tail = NULL;
}
@@ -263,7 +230,7 @@ AP4_List<T>::Remove(T* data)
}
item = item->m_Next;
}
-
+
return AP4_ERROR_NO_SUCH_ITEM;
}
@@ -276,36 +243,27 @@ AP4_List<T>::Insert(Item* where, T* data)
{
Item* item = new Item(data);
- if(where == NULL)
- {
+ if (where == NULL) {
// insert as the head
- if(m_Head)
- {
+ if (m_Head) {
// replace the current head
item->m_Prev = NULL;
item->m_Next = m_Head;
m_Head->m_Prev = item;
m_Head = item;
- }
- else
- {
+ } else {
// this item becomes the head and tail
m_Head = item;
m_Tail = item;
item->m_Next = NULL;
item->m_Prev = NULL;
}
- }
- else
- {
+ } else {
// insert after the 'where' item
- if(where == m_Tail)
- {
+ if (where == m_Tail) {
// add the item at the end
return Add(item);
- }
- else
- {
+ } else {
// update the links
item->m_Prev = where;
item->m_Next = where->m_Next;
@@ -329,14 +287,11 @@ AP4_List<T>::Get(AP4_Ordinal idx, T*& data) const
{
Item* item = m_Head;
- if(idx < m_ItemCount)
- {
- while(idx--) item = item->m_Next;
+ if (idx < m_ItemCount) {
+ while (idx--) item = item->m_Next;
data = item->m_Data;
return AP4_SUCCESS;
- }
- else
- {
+ } else {
data = NULL;
return AP4_ERROR_NO_SUCH_ITEM;
}
@@ -350,8 +305,7 @@ AP4_Result
AP4_List<T>::PopHead(T*& data)
{
// check that we have at least one item
- if(m_Head == NULL)
- {
+ if (m_Head == NULL) {
return AP4_ERROR_LIST_EMPTY;
}
@@ -359,12 +313,9 @@ AP4_List<T>::PopHead(T*& data)
data = m_Head->m_Data;
Item* head = m_Head;
m_Head = m_Head->m_Next;
- if(m_Head)
- {
+ if (m_Head) {
m_Head->m_Prev = NULL;
- }
- else
- {
+ } else {
m_Tail = NULL;
}
@@ -373,7 +324,7 @@ AP4_List<T>::PopHead(T*& data)
// one less item in the list now
m_ItemCount--;
-
+
return AP4_SUCCESS;
}
@@ -381,14 +332,13 @@ AP4_List<T>::PopHead(T*& data)
| AP4_List<T>::Apply
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::Apply(const typename Item::Operator& op) const
{
Item* item = m_Head;
-
- while(item)
- {
+
+ while (item) {
op.Action(item->m_Data);
item = item->m_Next;
}
@@ -400,17 +350,16 @@ AP4_List<T>::Apply(const typename Item::Operator& op) const
| AP4_List<T>::ApplyUntilFailure
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::ApplyUntilFailure(const typename Item::Operator& op) const
{
Item* item = m_Head;
-
- while(item)
- {
+
+ while (item) {
AP4_Result result;
result = op.Action(item->m_Data);
- if(result != AP4_SUCCESS) return result;
+ if (result != AP4_SUCCESS) return result;
item = item->m_Next;
}
@@ -421,17 +370,16 @@ AP4_List<T>::ApplyUntilFailure(const typename Item::Operator& op) const
| AP4_List<T>::ApplyUntilSuccess
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::ApplyUntilSuccess(const typename Item::Operator& op) const
{
Item* item = m_Head;
-
- while(item)
- {
+
+ while (item) {
AP4_Result result;
result = op.Action(item->m_Data);
- if(result == AP4_SUCCESS) return AP4_SUCCESS;
+ if (result == AP4_SUCCESS) return AP4_SUCCESS;
item = item->m_Next;
}
@@ -442,16 +390,14 @@ AP4_List<T>::ApplyUntilSuccess(const typename Item::Operator& op) const
| AP4_List<T>::ReverseApply
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::ReverseApply(const typename Item::Operator& op) const
{
Item* item = m_Tail;
-
- while(item)
- {
- if(op.Action(item->m_Data) != AP4_SUCCESS)
- {
+
+ while (item) {
+ if (op.Action(item->m_Data) != AP4_SUCCESS) {
return AP4_ERROR_LIST_OPERATION_ABORTED;
}
item = item->m_Prev;
@@ -464,16 +410,14 @@ AP4_List<T>::ReverseApply(const typename Item::Operator& op) const
| AP4_List<T>::Find
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::Find(const typename Item::Finder& finder, T*& data) const
{
Item* item = m_Head;
-
- while(item)
- {
- if(finder.Test(item->m_Data) == AP4_SUCCESS)
- {
+
+ while (item) {
+ if (finder.Test(item->m_Data) == AP4_SUCCESS) {
data = item->m_Data;
return AP4_SUCCESS;
}
@@ -488,16 +432,14 @@ AP4_List<T>::Find(const typename Item::Finder& finder, T*& data) const
| AP4_List<T>::ReverseFind
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::ReverseFind(const typename Item::Finder& finder, T*& data) const
{
Item* item = m_Tail;
-
- while(item)
- {
- if(finder.Test(item->m_Data) == AP4_SUCCESS)
- {
+
+ while (item) {
+ if (finder.Test(item->m_Data) == AP4_SUCCESS) {
data = item->m_Data;
return AP4_SUCCESS;
}
@@ -512,14 +454,13 @@ AP4_List<T>::ReverseFind(const typename Item::Finder& finder, T*& data) const
| AP4_List<T>::DeleteReferences
+---------------------------------------------------------------------*/
template <typename T>
-inline
+inline
AP4_Result
AP4_List<T>::DeleteReferences()
{
Item* item = m_Head;
-
- while(item)
- {
+
+ while (item) {
Item* next = item->m_Next;
delete item->m_Data;
delete item;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.cpp
index 86b197237..c4464f5df 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.cpp
@@ -60,12 +60,12 @@ class AP4_MarlinIpmpAtomTypeHandler : public AP4_AtomFactory::TypeHandler
public:
// constructor
AP4_MarlinIpmpAtomTypeHandler(AP4_AtomFactory* atom_factory) :
- m_AtomFactory(atom_factory) {}
- virtual AP4_Result CreateAtom(AP4_Atom::Type type,
- AP4_UI32 size,
- AP4_ByteStream& stream,
- AP4_Atom::Type context,
- AP4_Atom*& atom);
+ m_AtomFactory(atom_factory) {}
+ virtual AP4_Result CreateAtom(AP4_Atom::Type type,
+ AP4_UI32 size,
+ AP4_ByteStream& stream,
+ AP4_Atom::Type context,
+ AP4_Atom*& atom);
private:
// members
@@ -82,8 +82,7 @@ public:
static AP4_MarlinIpmpAtomFactory Instance;
// constructor
- AP4_MarlinIpmpAtomFactory()
- {
+ AP4_MarlinIpmpAtomFactory() {
AddTypeHandler(new AP4_MarlinIpmpAtomTypeHandler(this));
}
};
@@ -96,25 +95,24 @@ AP4_MarlinIpmpAtomFactory AP4_MarlinIpmpAtomFactory::Instance;
/*----------------------------------------------------------------------
| AP4_MarlinIpmpAtomTypeHandler::CreateAtom
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MarlinIpmpAtomTypeHandler::CreateAtom(AP4_Atom::Type type,
- AP4_UI32 size,
- AP4_ByteStream& stream,
- AP4_Atom::Type /*context*/,
- AP4_Atom*& atom)
+ AP4_UI32 size,
+ AP4_ByteStream& stream,
+ AP4_Atom::Type /*context*/,
+ AP4_Atom*& atom)
{
- switch(type)
- {
- case AP4_ATOM_TYPE_SATR:
- atom = AP4_ContainerAtom::Create(type, size, false, false, stream, *m_AtomFactory);
- break;
-
- case AP4_ATOM_TYPE_STYP:
- atom = new AP4_NullTerminatedStringAtom(type, size, stream);
- break;
+ switch (type) {
+ case AP4_ATOM_TYPE_SATR:
+ atom = AP4_ContainerAtom::Create(type, size, false, false, stream, *m_AtomFactory);
+ break;
+
+ case AP4_ATOM_TYPE_STYP:
+ atom = new AP4_NullTerminatedStringAtom(type, size, stream);
+ break;
- default:
- atom = NULL;
+ default:
+ atom = NULL;
}
return atom ? AP4_SUCCESS : AP4_FAILURE;
@@ -123,254 +121,222 @@ AP4_MarlinIpmpAtomTypeHandler::CreateAtom(AP4_Atom::Type type,
/*----------------------------------------------------------------------
| AP4_MarlinIpmpParser:Parse
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_MarlinIpmpParser::Parse(AP4_AtomParent& top_level,
+AP4_Result
+AP4_MarlinIpmpParser::Parse(AP4_AtomParent& top_level,
AP4_ByteStream& stream,
AP4_List<SinfEntry>& sinf_entries,
bool remove_od_data)
{
// check the file type
AP4_FtypAtom* ftyp = AP4_DYNAMIC_CAST(AP4_FtypAtom, top_level.GetChild(AP4_ATOM_TYPE_FTYP));
- if(ftyp == NULL ||
- (ftyp->GetMajorBrand() != AP4_MARLIN_BRAND_MGSV && !ftyp->HasCompatibleBrand(AP4_MARLIN_BRAND_MGSV)))
- {
+ if (ftyp == NULL ||
+ (ftyp->GetMajorBrand() != AP4_MARLIN_BRAND_MGSV && !ftyp->HasCompatibleBrand(AP4_MARLIN_BRAND_MGSV))) {
return AP4_ERROR_INVALID_FORMAT;
}
-
+
// check the initial object descriptor and get the OD Track ID
AP4_IodsAtom* iods = AP4_DYNAMIC_CAST(AP4_IodsAtom, top_level.FindChild("moov/iods"));
AP4_UI32 od_track_id = 0;
- if(iods == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (iods == NULL) return AP4_ERROR_INVALID_FORMAT;
const AP4_ObjectDescriptor* od = iods->GetObjectDescriptor();
- if(od == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (od == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_EsIdIncDescriptor* es_id_inc = AP4_DYNAMIC_CAST(AP4_EsIdIncDescriptor, od->FindSubDescriptor(AP4_DESCRIPTOR_TAG_ES_ID_INC));
- if(es_id_inc == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (es_id_inc == NULL) return AP4_ERROR_INVALID_FORMAT;
od_track_id = es_id_inc->GetTrackId();
-
+
// find the track pointed to by the descriptor
AP4_MoovAtom* moov = AP4_DYNAMIC_CAST(AP4_MoovAtom, top_level.GetChild(AP4_ATOM_TYPE_MOOV));
- if(moov == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (moov == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_TrakAtom* od_trak = NULL;
- for(AP4_List<AP4_TrakAtom>::Item* trak_item = moov->GetTrakAtoms().FirstItem();
- trak_item;
- trak_item = trak_item->GetNext())
- {
+ for (AP4_List<AP4_TrakAtom>::Item* trak_item = moov->GetTrakAtoms().FirstItem();
+ trak_item;
+ trak_item = trak_item->GetNext()) {
AP4_TrakAtom* trak = trak_item->GetData();
- if(trak)
- {
- if(trak->GetId() == od_track_id)
- {
+ if (trak) {
+ if (trak->GetId() == od_track_id) {
od_trak = trak;
- }
- else
- {
+ } else {
sinf_entries.Add(new SinfEntry(trak->GetId(), NULL));
}
}
}
- // check that we have found the OD track
- if(od_trak == NULL) return AP4_ERROR_INVALID_FORMAT;
+ // check that we have found the OD track
+ if (od_trak == NULL) return AP4_ERROR_INVALID_FORMAT;
// look for the 'mpod' trak references
AP4_TrefTypeAtom* track_references;
track_references = AP4_DYNAMIC_CAST(AP4_TrefTypeAtom, od_trak->FindChild("tref/mpod"));
- if(track_references == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (track_references == NULL) return AP4_ERROR_INVALID_FORMAT;
// create an AP4_Track object from the trak atom and check that it has samples
AP4_Track* od_track = new AP4_Track(*od_trak, stream, 0);
- if(od_track->GetSampleCount() < 1)
- {
+ if (od_track->GetSampleCount() < 1) {
delete od_track;
return AP4_ERROR_INVALID_FORMAT;
}
-
+
// get the first sample (in this version, we only look at a single OD command)
AP4_Sample od_sample;
AP4_Result result = od_track->GetSample(0, od_sample);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
delete od_track;
return AP4_ERROR_INVALID_FORMAT;
}
-
+
// adapt the sample data into a byte stream for parsing
AP4_DataBuffer sample_data;
od_sample.ReadData(sample_data);
AP4_MemoryByteStream* sample_stream = new AP4_MemoryByteStream(sample_data);
-
- // look for one ObjectDescriptorUpdate command and
+
+ // look for one ObjectDescriptorUpdate command and
// one IPMP_DescriptorUpdate command
AP4_DescriptorUpdateCommand* od_update = NULL;
AP4_DescriptorUpdateCommand* ipmp_update = NULL;
- do
- {
+ do {
AP4_Command* command = NULL;
result = AP4_CommandFactory::CreateCommandFromStream(*sample_stream, command);
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
// found a command in the sample, check the type
- switch(command->GetTag())
- {
- case AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE:
- if(od_update == NULL)
- {
+ switch (command->GetTag()) {
+ case AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE:
+ if (od_update == NULL) {
od_update = AP4_DYNAMIC_CAST(AP4_DescriptorUpdateCommand, command);
}
break;
-
- case AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE:
- if(ipmp_update == NULL)
- {
+
+ case AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE:
+ if (ipmp_update == NULL) {
ipmp_update = AP4_DYNAMIC_CAST(AP4_DescriptorUpdateCommand, command);
}
break;
- default:
+ default:
break;
}
}
- }
- while(AP4_SUCCEEDED(result));
+ } while (AP4_SUCCEEDED(result));
sample_stream->Release();
sample_stream = NULL;
-
+
// check that we have what we need
- if(od_update == NULL || ipmp_update == NULL)
- {
+ if (od_update == NULL || ipmp_update == NULL) {
delete od_track;
return AP4_ERROR_INVALID_FORMAT;
}
-
+
// process all the object descriptors in the od update
- for(AP4_List<AP4_Descriptor>::Item* od_item = od_update->GetDescriptors().FirstItem();
- od_item;
- od_item = od_item->GetNext())
- {
+ for (AP4_List<AP4_Descriptor>::Item* od_item = od_update->GetDescriptors().FirstItem();
+ od_item;
+ od_item = od_item->GetNext()) {
od = AP4_DYNAMIC_CAST(AP4_ObjectDescriptor, od_item->GetData());
- if(od == NULL) continue;
+ if (od == NULL) continue;
// find which track this od references
AP4_EsIdRefDescriptor* es_id_ref;
es_id_ref = AP4_DYNAMIC_CAST(AP4_EsIdRefDescriptor, od->FindSubDescriptor(AP4_DESCRIPTOR_TAG_ES_ID_REF));
- if(es_id_ref == NULL ||
- es_id_ref->GetRefIndex() > track_references->GetTrackIds().ItemCount() ||
- es_id_ref->GetRefIndex() == 0)
- {
+ if (es_id_ref == NULL ||
+ es_id_ref->GetRefIndex() > track_references->GetTrackIds().ItemCount() ||
+ es_id_ref->GetRefIndex() == 0) {
continue;
}
AP4_UI32 track_id = track_references->GetTrackIds()[es_id_ref->GetRefIndex()-1];
SinfEntry* sinf_entry = NULL;
- for(AP4_List<SinfEntry>::Item* sinf_entry_item = sinf_entries.FirstItem();
- sinf_entry_item;
- sinf_entry_item = sinf_entry_item->GetNext())
- {
+ for (AP4_List<SinfEntry>::Item* sinf_entry_item = sinf_entries.FirstItem();
+ sinf_entry_item;
+ sinf_entry_item = sinf_entry_item->GetNext()) {
sinf_entry = sinf_entry_item->GetData();
- if(sinf_entry->m_TrackId == track_id)
- {
+ if (sinf_entry->m_TrackId == track_id) {
break; // match
- }
- else
- {
+ } else {
sinf_entry = NULL; // no match
}
}
- if(sinf_entry == NULL) continue; // no matching entry
- if(sinf_entry->m_Sinf != NULL) continue; // entry already populated
-
+ if (sinf_entry == NULL) continue; // no matching entry
+ if (sinf_entry->m_Sinf != NULL) continue; // entry already populated
+
// see what ipmp descriptor this od points to
AP4_IpmpDescriptorPointer* ipmpd_pointer;
ipmpd_pointer = AP4_DYNAMIC_CAST(AP4_IpmpDescriptorPointer, od->FindSubDescriptor(AP4_DESCRIPTOR_TAG_IPMP_DESCRIPTOR_POINTER));
- if(ipmpd_pointer == NULL) continue; // no pointer
+ if (ipmpd_pointer == NULL) continue; // no pointer
// find the ipmp descriptor referenced by the pointer
AP4_IpmpDescriptor* ipmpd = NULL;
- for(AP4_List<AP4_Descriptor>::Item* ipmpd_item = ipmp_update->GetDescriptors().FirstItem();
- ipmpd_item;
- ipmpd_item = ipmpd_item->GetNext())
- {
+ for (AP4_List<AP4_Descriptor>::Item* ipmpd_item = ipmp_update->GetDescriptors().FirstItem();
+ ipmpd_item;
+ ipmpd_item = ipmpd_item->GetNext()) {
// check that this descriptor is of the right type
ipmpd = AP4_DYNAMIC_CAST(AP4_IpmpDescriptor, ipmpd_item->GetData());
- if(ipmpd == NULL || ipmpd->GetIpmpsType() != AP4_MARLIN_IPMPS_TYPE_MGSV) continue;
-
+ if (ipmpd == NULL || ipmpd->GetIpmpsType() != AP4_MARLIN_IPMPS_TYPE_MGSV) continue;
+
// check the descriptor id
- if(ipmpd->GetDescriptorId() == ipmpd_pointer->GetDescriptorId())
- {
+ if (ipmpd->GetDescriptorId() == ipmpd_pointer->GetDescriptorId()) {
break; // match
- }
- else
- {
+ } else {
ipmpd = NULL; // no match
}
}
- if(ipmpd == NULL) continue; // no matching entry
-
+ if (ipmpd == NULL) continue; // no matching entry
+
// parse the ipmp data into one or more 'sinf' atoms, and keep the one with the
// right type
AP4_MemoryByteStream* data = new AP4_MemoryByteStream(ipmpd->GetData().GetData(),
- ipmpd->GetData().GetDataSize());
+ ipmpd->GetData().GetDataSize());
AP4_LargeSize bytes_available = ipmpd->GetData().GetDataSize();
- do
- {
+ do {
AP4_Atom* atom = NULL;
-
+
// setup the factory with a context so we can instantiate a 'schm'
// atom with a slightly different format than the standard 'schm'
AP4_AtomFactory* factory = &AP4_MarlinIpmpAtomFactory::Instance;
- factory->PushContext(AP4_ATOM_TYPE('m', 'r', 'l', 'n'));
-
- // parse the next atom in the stream
+ factory->PushContext(AP4_ATOM_TYPE('m','r','l','n'));
+
+ // parse the next atom in the stream
result = factory->CreateAtomFromStream(*data, bytes_available, atom);
factory->PopContext();
- if(AP4_FAILED(result) || atom == NULL) break;
-
+ if (AP4_FAILED(result) || atom == NULL) break;
+
// check that what we have parsed is indeed an 'sinf' of the right type
- if(atom->GetType() == AP4_ATOM_TYPE_SINF)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_SINF) {
AP4_ContainerAtom* sinf = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
AP4_SchmAtom* schm = AP4_DYNAMIC_CAST(AP4_SchmAtom, sinf->FindChild("schm"));
- if((schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC &&
- schm->GetSchemeVersion() == 0x0100) ||
- (schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK &&
- schm->GetSchemeVersion() == 0x0100))
- {
+ if ((schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC &&
+ schm->GetSchemeVersion() == 0x0100) ||
+ (schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK &&
+ schm->GetSchemeVersion() == 0x0100)) {
// store the sinf in the entry for that track
sinf_entry->m_Sinf = sinf;
break;
}
}
delete atom;
- }
- while(AP4_SUCCEEDED(result));
- data->Release();
+ } while (AP4_SUCCEEDED(result));
+ data->Release();
}
-
+
// get rid of entries that have no SINF
- for(AP4_List<SinfEntry>::Item* sinf_entry_item = sinf_entries.FirstItem();
- sinf_entry_item;
- sinf_entry_item = sinf_entry_item->GetNext())
- {
+ for (AP4_List<SinfEntry>::Item* sinf_entry_item = sinf_entries.FirstItem();
+ sinf_entry_item;
+ sinf_entry_item = sinf_entry_item->GetNext()) {
SinfEntry* sinf_entry = sinf_entry_item->GetData();
- if(sinf_entry->m_Sinf == NULL)
- {
+ if (sinf_entry->m_Sinf == NULL) {
sinf_entries.Remove(sinf_entry);
sinf_entry_item = sinf_entries.FirstItem();
continue;
}
}
-
+
// remove the iods atom and the OD track if required
- if(remove_od_data)
- {
+ if (remove_od_data) {
od_trak->Detach();
delete od_trak;
iods->Detach();
delete iods;
}
-
+
// cleanup
delete od_track;
-
+
return AP4_SUCCESS;
}
@@ -379,20 +345,15 @@ AP4_MarlinIpmpParser::Parse(AP4_AtomParent& top_level,
+---------------------------------------------------------------------*/
AP4_MarlinIpmpDecryptingProcessor::AP4_MarlinIpmpDecryptingProcessor(
const AP4_ProtectionKeyMap* key_map, /* = NULL */
- AP4_BlockCipherFactory* block_cipher_factory /* = NULL */)
-{
- if(key_map)
- {
+ AP4_BlockCipherFactory* block_cipher_factory /* = NULL */){
+ if (key_map) {
// copy the keys
m_KeyMap.SetKeys(*key_map);
}
-
- if(block_cipher_factory == NULL)
- {
+
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -408,10 +369,10 @@ AP4_MarlinIpmpDecryptingProcessor::~AP4_MarlinIpmpDecryptingProcessor()
/*----------------------------------------------------------------------
| AP4_MarlinIpmpDecryptingProcessor:Initialize
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_MarlinIpmpDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
- AP4_ByteStream& stream,
- ProgressListener* /*listener*/)
+AP4_Result
+AP4_MarlinIpmpDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
+ AP4_ByteStream& stream,
+ ProgressListener* /*listener*/)
{
return AP4_MarlinIpmpParser::Parse(top_level, stream, m_SinfEntries, true);
}
@@ -419,44 +380,35 @@ AP4_MarlinIpmpDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
/*----------------------------------------------------------------------
| AP4_MarlinIpmpDecryptingProcessor:CreateTrackHandler
+---------------------------------------------------------------------*/
-AP4_Processor::TrackHandler*
+AP4_Processor::TrackHandler*
AP4_MarlinIpmpDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// look for this track in the list of entries
AP4_MarlinIpmpParser::SinfEntry* sinf_entry = NULL;
- for(AP4_List<AP4_MarlinIpmpParser::SinfEntry>::Item* sinf_entry_item = m_SinfEntries.FirstItem();
- sinf_entry_item;
- sinf_entry_item = sinf_entry_item->GetNext())
- {
+ for (AP4_List<AP4_MarlinIpmpParser::SinfEntry>::Item* sinf_entry_item = m_SinfEntries.FirstItem();
+ sinf_entry_item;
+ sinf_entry_item = sinf_entry_item->GetNext()) {
sinf_entry = sinf_entry_item->GetData();
- if(sinf_entry->m_TrackId == trak->GetId())
- {
+ if (sinf_entry->m_TrackId == trak->GetId()) {
break; // match
- }
- else
- {
+ } else {
sinf_entry = NULL; // no match
}
}
- if(sinf_entry == NULL) return NULL; // no matching entry
+ if (sinf_entry == NULL) return NULL; // no matching entry
AP4_ContainerAtom* sinf = sinf_entry->m_Sinf;
-
+
// check the scheme
bool use_group_key;
AP4_SchmAtom* schm = AP4_DYNAMIC_CAST(AP4_SchmAtom, sinf->GetChild(AP4_ATOM_TYPE_SCHM));
- if(schm == NULL) return NULL; // no schm
- if(schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC &&
- schm->GetSchemeVersion() == 0x0100)
- {
+ if (schm == NULL) return NULL; // no schm
+ if (schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC &&
+ schm->GetSchemeVersion() == 0x0100) {
use_group_key = false;
- }
- else if(schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK &&
- schm->GetSchemeVersion() == 0x0100)
- {
+ } else if (schm->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK &&
+ schm->GetSchemeVersion() == 0x0100) {
use_group_key = true;
- }
- else
- {
+ } else {
// unsupported scheme
return NULL;
}
@@ -464,32 +416,29 @@ AP4_MarlinIpmpDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
// find the key
const AP4_UI08* key = NULL;
AP4_DataBuffer unwrapped_key;
- if(use_group_key)
- {
+ if (use_group_key) {
const AP4_UI08* group_key = m_KeyMap.GetKey(0);
- if(group_key == NULL) return NULL; // no group key
+ if (group_key == NULL) return NULL; // no group key
AP4_ContainerAtom* schi = AP4_DYNAMIC_CAST(AP4_ContainerAtom, sinf->GetChild(AP4_ATOM_TYPE_SCHI));
- if(schi == NULL) return NULL; // no schi
+ if (schi == NULL) return NULL; // no schi
AP4_Atom* gkey = schi->GetChild(AP4_ATOM_TYPE_GKEY);
- if(gkey == NULL) return NULL; // no gkey
+ if (gkey == NULL) return NULL; // no gkey
AP4_MemoryByteStream* gkey_data = new AP4_MemoryByteStream();
gkey->WriteFields(*gkey_data);
AP4_AesKeyUnwrap(group_key, gkey_data->GetData(), gkey_data->GetDataSize(), unwrapped_key);
key = unwrapped_key.GetData();
- gkey_data->Release();
- }
- else
- {
+ gkey_data->Release();
+ } else {
key = m_KeyMap.GetKey(sinf_entry->m_TrackId);
}
- if(key == NULL) return NULL;
+ if (key == NULL) return NULL;
// create the decrypter
AP4_MarlinIpmpTrackDecrypter* decrypter = NULL;
AP4_Result result = AP4_MarlinIpmpTrackDecrypter::Create(*m_BlockCipherFactory,
- key, decrypter);
- if(AP4_FAILED(result)) return NULL;
-
+ key, decrypter);
+ if (AP4_FAILED(result)) return NULL;
+
return decrypter;
}
@@ -503,22 +452,22 @@ AP4_MarlinIpmpTrackDecrypter::Create(AP4_BlockCipherFactory& cipher_facto
{
// default value
decrypter = NULL;
-
+
// create a block cipher for the decrypter
AP4_BlockCipher* block_cipher = NULL;
AP4_Result result = cipher_factory.Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::DECRYPT,
- key,
- AP4_AES_BLOCK_SIZE,
- block_cipher);
- if(AP4_FAILED(result)) return result;
-
+ AP4_BlockCipher::DECRYPT,
+ key,
+ AP4_AES_BLOCK_SIZE,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
+
// create a CBC cipher
AP4_CbcStreamCipher* cbc_cipher = new AP4_CbcStreamCipher(block_cipher, AP4_StreamCipher::DECRYPT);
-
+
// create the track decrypter
decrypter = new AP4_MarlinIpmpTrackDecrypter(cbc_cipher);
-
+
return AP4_SUCCESS;
}
@@ -533,72 +482,69 @@ AP4_MarlinIpmpTrackDecrypter::~AP4_MarlinIpmpTrackDecrypter()
/*----------------------------------------------------------------------
| AP4_MarlinIpmpTrackDecrypter:GetProcessedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_MarlinIpmpTrackDecrypter::GetProcessedSampleSize(AP4_Sample& sample)
{
// with CBC, we need to decrypt the last block to know what the padding was
- AP4_Size encrypted_size = sample.GetSize() - AP4_AES_BLOCK_SIZE;
+ AP4_Size encrypted_size = sample.GetSize()-AP4_AES_BLOCK_SIZE;
AP4_DataBuffer encrypted;
AP4_DataBuffer decrypted;
AP4_Size decrypted_size = AP4_CIPHER_BLOCK_SIZE;
- if(sample.GetSize() < 2 * AP4_CIPHER_BLOCK_SIZE)
- {
+ if (sample.GetSize() < 2*AP4_CIPHER_BLOCK_SIZE) {
return 0;
}
- AP4_Size offset = sample.GetSize() - 2 * AP4_CIPHER_BLOCK_SIZE;
- if(AP4_FAILED(sample.ReadData(encrypted, 2 * AP4_CIPHER_BLOCK_SIZE, offset)))
- {
+ AP4_Size offset = sample.GetSize()-2*AP4_CIPHER_BLOCK_SIZE;
+ if (AP4_FAILED(sample.ReadData(encrypted, 2*AP4_CIPHER_BLOCK_SIZE, offset))) {
return 0;
}
decrypted.Reserve(decrypted_size);
m_Cipher->SetIV(encrypted.GetData());
- if(AP4_FAILED(m_Cipher->ProcessBuffer(encrypted.GetData() + AP4_CIPHER_BLOCK_SIZE,
- AP4_CIPHER_BLOCK_SIZE,
- decrypted.UseData(),
- &decrypted_size,
- true)))
- {
+ if (AP4_FAILED(m_Cipher->ProcessBuffer(encrypted.GetData()+AP4_CIPHER_BLOCK_SIZE,
+ AP4_CIPHER_BLOCK_SIZE,
+ decrypted.UseData(),
+ &decrypted_size,
+ true))) {
return 0;
}
- unsigned int padding_size = AP4_CIPHER_BLOCK_SIZE - decrypted_size;
- return encrypted_size - padding_size;
+ unsigned int padding_size = AP4_CIPHER_BLOCK_SIZE-decrypted_size;
+ return encrypted_size-padding_size;
}
/*----------------------------------------------------------------------
| AP4_MarlinIpmpTrackDecrypter:ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MarlinIpmpTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out)
+ AP4_DataBuffer& data_out)
{
AP4_Result result;
-
+
const AP4_UI08* in = data_in.GetData();
AP4_Size in_size = data_in.GetDataSize();
- // default to 0 output
+ // default to 0 output
data_out.SetDataSize(0);
// check that we have at least the minimum size
- if(in_size < 2 * AP4_AES_BLOCK_SIZE) return AP4_ERROR_INVALID_FORMAT;
+ if (in_size < 2*AP4_AES_BLOCK_SIZE) return AP4_ERROR_INVALID_FORMAT;
// process the sample data
- AP4_Size out_size = in_size - AP4_AES_BLOCK_SIZE; // worst case
+ AP4_Size out_size = in_size-AP4_AES_BLOCK_SIZE; // worst case
data_out.SetDataSize(out_size);
AP4_UI08* out = data_out.UseData();
// decrypt the data
m_Cipher->SetIV(in);
- result = m_Cipher->ProcessBuffer(in + AP4_AES_BLOCK_SIZE,
- in_size - AP4_AES_BLOCK_SIZE,
+ result = m_Cipher->ProcessBuffer(in+AP4_AES_BLOCK_SIZE,
+ in_size-AP4_AES_BLOCK_SIZE,
out,
&out_size,
true);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// update the payload size
data_out.SetDataSize(out_size);
-
+
return AP4_SUCCESS;
}
@@ -611,18 +557,14 @@ AP4_MarlinIpmpEncryptingProcessor::AP4_MarlinIpmpEncryptingProcessor(
AP4_BlockCipherFactory* block_cipher_factory /* = NULL */) :
m_UseGroupKey(use_group_key)
{
- if(key_map)
- {
+ if (key_map) {
// copy the keys
m_KeyMap.SetKeys(*key_map);
}
-
- if(block_cipher_factory == NULL)
- {
+
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -630,7 +572,7 @@ AP4_MarlinIpmpEncryptingProcessor::AP4_MarlinIpmpEncryptingProcessor(
/*----------------------------------------------------------------------
| AP4_MarlinIpmpEncryptingProcessor::Initialize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MarlinIpmpEncryptingProcessor::Initialize(
AP4_AtomParent& top_level,
AP4_ByteStream& /*stream*/,
@@ -638,84 +580,75 @@ AP4_MarlinIpmpEncryptingProcessor::Initialize(
{
// get the moov atom
AP4_MoovAtom* moov = AP4_DYNAMIC_CAST(AP4_MoovAtom, top_level.GetChild(AP4_ATOM_TYPE_MOOV));
- if(moov == NULL) return AP4_ERROR_INVALID_FORMAT;
-
+ if (moov == NULL) return AP4_ERROR_INVALID_FORMAT;
+
// deal with the file type
AP4_FtypAtom* ftyp = AP4_DYNAMIC_CAST(AP4_FtypAtom, top_level.GetChild(AP4_ATOM_TYPE_FTYP));
- if(ftyp)
- {
+ if (ftyp) {
// remove the atom, it will be replaced with a new one
top_level.RemoveChild(ftyp);
-
+
// keep the existing brand and compatible brands
AP4_Array<AP4_UI32> compatible_brands;
- compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount() + 1);
- for(unsigned int i = 0; i < ftyp->GetCompatibleBrands().ItemCount(); i++)
- {
+ compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount()+1);
+ for (unsigned int i=0; i<ftyp->GetCompatibleBrands().ItemCount(); i++) {
compatible_brands.Append(ftyp->GetCompatibleBrands()[i]);
}
-
+
// add the MGSV compatible brand if it is not already there
- if(!ftyp->HasCompatibleBrand(AP4_MARLIN_BRAND_MGSV))
- {
+ if (!ftyp->HasCompatibleBrand(AP4_MARLIN_BRAND_MGSV)) {
compatible_brands.Append(AP4_MARLIN_BRAND_MGSV);
}
// create a replacement for the major brand
AP4_FtypAtom* new_ftyp = new AP4_FtypAtom(AP4_MARLIN_BRAND_MGSV,
- 0x13c078c, //AP4_MARLIN_BRAND_MGSV_MAJOR_VERSION,
- &compatible_brands[0],
- compatible_brands.ItemCount());
+ 0x13c078c, //AP4_MARLIN_BRAND_MGSV_MAJOR_VERSION,
+ &compatible_brands[0],
+ compatible_brands.ItemCount());
delete ftyp;
ftyp = new_ftyp;
- }
- else
- {
+ } else {
AP4_UI32 isom = AP4_FTYP_BRAND_ISOM;
ftyp = new AP4_FtypAtom(AP4_MARLIN_BRAND_MGSV, 0, &isom, 1);
}
-
+
// insert the ftyp atom as the first child
top_level.AddChild(ftyp, 0);
// create and 'mpod' track reference atom
AP4_TrefTypeAtom* mpod = new AP4_TrefTypeAtom(AP4_ATOM_TYPE_MPOD);
-
+
// look for an available track ID, starting at 1
unsigned int od_track_id = 0;
unsigned int od_track_position = 0;
- for(AP4_List<AP4_TrakAtom>::Item* trak_item = moov->GetTrakAtoms().FirstItem();
- trak_item;
- trak_item = trak_item->GetNext())
- {
+ for (AP4_List<AP4_TrakAtom>::Item* trak_item = moov->GetTrakAtoms().FirstItem();
+ trak_item;
+ trak_item = trak_item->GetNext()) {
AP4_TrakAtom* trak = trak_item->GetData();
- if(trak)
- {
+ if (trak) {
od_track_position++;
- if(trak->GetId() >= od_track_id)
- {
- od_track_id = trak->GetId() + 1;
+ if (trak->GetId() >= od_track_id) {
+ od_track_id = trak->GetId()+1;
}
-
+
// if the track is encrypted, reference it in the mpod
- if(m_KeyMap.GetKey(trak->GetId()))
- {
+ if (m_KeyMap.GetKey(trak->GetId())) {
mpod->AddTrackId(trak->GetId());
}
-
+
//m_SinfEntries.Add(new SinfEntry(trak->GetId(), NULL));
- }
+ }
}
-
+
// check that there was at least one track in the file
- if(od_track_id == 0) return AP4_ERROR_INVALID_FORMAT;
-
+ if (od_track_id == 0) return AP4_ERROR_INVALID_FORMAT;
+
// create an initial object descriptor
- AP4_InitialObjectDescriptor* iod =
+ AP4_InitialObjectDescriptor* iod =
// FIXME: get real values from the property map
new AP4_InitialObjectDescriptor(AP4_DESCRIPTOR_TAG_MP4_IOD,
1022, // object descriptor id
- false,
+ false,
0xFE, // OD profile level (0xFE = No OD profile specified)
0xFF, // scene profile level
0xFE, // audio profile level
@@ -725,183 +658,160 @@ AP4_MarlinIpmpEncryptingProcessor::Initialize(
// create an ES_ID_Inc subdescriptor and add it to the initial object descriptor
AP4_EsIdIncDescriptor* es_id_inc = new AP4_EsIdIncDescriptor(od_track_id);
iod->AddSubDescriptor(es_id_inc);
-
+
// create an iods atom to hold the initial object descriptor
AP4_IodsAtom* iods = new AP4_IodsAtom(iod);
-
+
// add the iods atom to the moov atom (try to put it just after mvhd)
int iods_position = 0;
int item_position = 0;
- for(AP4_List<AP4_Atom>::Item* moov_item = moov->GetChildren().FirstItem();
- moov_item;
- moov_item = moov_item->GetNext())
- {
- ++item_position;
- if(moov_item->GetData()->GetType() == AP4_ATOM_TYPE_MVHD)
- {
+ for (AP4_List<AP4_Atom>::Item* moov_item = moov->GetChildren().FirstItem();
+ moov_item;
+ moov_item = moov_item->GetNext()) {
+ ++item_position;
+ if (moov_item->GetData()->GetType() == AP4_ATOM_TYPE_MVHD) {
iods_position = item_position;
break;
- }
+ }
}
AP4_Result result = moov->AddChild(iods, iods_position);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
delete iods;
return result;
}
-
+
// create a sample table for the OD track
AP4_SyntheticSampleTable* od_sample_table = new AP4_SyntheticSampleTable();
-
- // create the sample description for the OD track
+
+ // create the sample description for the OD track
AP4_MpegSystemSampleDescription* od_sample_description;
od_sample_description = new AP4_MpegSystemSampleDescription(AP4_STREAM_TYPE_OD,
- AP4_OTI_MPEG4_SYSTEM,
- NULL,
- 32768, // buffer size
- 1024, // max bitrate
- 512); // avg bitrate
+ AP4_OTI_MPEG4_SYSTEM,
+ NULL,
+ 32768, // buffer size
+ 1024, // max bitrate
+ 512); // avg bitrate
od_sample_table->AddSampleDescription(od_sample_description, true);
-
- // create the OD descriptor update
+
+ // create the OD descriptor update
AP4_DescriptorUpdateCommand od_update(AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE);
- for(unsigned int i = 0; i < mpod->GetTrackIds().ItemCount(); i++)
- {
- AP4_ObjectDescriptor* od = new AP4_ObjectDescriptor(AP4_DESCRIPTOR_TAG_MP4_OD, 256 + i); // descriptor id = 256+i
- od->AddSubDescriptor(new AP4_EsIdRefDescriptor(i + 1)); // index into mpod (1-based)
- od->AddSubDescriptor(new AP4_IpmpDescriptorPointer(i + 1)); // descriptor id = i+1
+ for (unsigned int i=0; i<mpod->GetTrackIds().ItemCount(); i++) {
+ AP4_ObjectDescriptor* od = new AP4_ObjectDescriptor(AP4_DESCRIPTOR_TAG_MP4_OD, 256+i); // descriptor id = 256+i
+ od->AddSubDescriptor(new AP4_EsIdRefDescriptor(i+1)); // index into mpod (1-based)
+ od->AddSubDescriptor(new AP4_IpmpDescriptorPointer(i+1)); // descriptor id = i+1
od_update.AddDescriptor(od);
}
-
- // create the IPMP descriptor update
+
+ // create the IPMP descriptor update
AP4_DescriptorUpdateCommand ipmp_update(AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE);
- for(unsigned int i = 0; i < mpod->GetTrackIds().ItemCount(); i++)
- {
+ for (unsigned int i=0; i<mpod->GetTrackIds().ItemCount(); i++) {
// create the ipmp descriptor
- AP4_IpmpDescriptor* ipmp_descriptor = new AP4_IpmpDescriptor(i + 1, AP4_MARLIN_IPMPS_TYPE_MGSV);
+ AP4_IpmpDescriptor* ipmp_descriptor = new AP4_IpmpDescriptor(i+1, AP4_MARLIN_IPMPS_TYPE_MGSV);
// create the sinf container
AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF);
// add the scheme type atom
- sinf->AddChild(new AP4_SchmAtom(m_UseGroupKey ?
- AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK :
- AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC,
+ sinf->AddChild(new AP4_SchmAtom(m_UseGroupKey?
+ AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK:
+ AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC,
0x0100, NULL, true));
// create the 'schi' container
AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI);
- // add the content ID
+ // add the content ID
const char* content_id = m_PropertyMap.GetProperty(mpod->GetTrackIds()[i], "ContentId");
- if(content_id)
- {
+ if (content_id) {
// add the content ID (8id_)
schi->AddChild(new AP4_NullTerminatedStringAtom(AP4_ATOM_TYPE_8ID_, content_id));
}
-
+
// add the signed attributes, if any
const char* signed_attributes = m_PropertyMap.GetProperty(mpod->GetTrackIds()[i], "SignedAttributes");
- if(signed_attributes)
- {
+ if (signed_attributes) {
// decode the hex-encoded data
- unsigned int size = (unsigned int)AP4_StringLength(signed_attributes) / 2;
+ unsigned int size = (unsigned int)AP4_StringLength(signed_attributes)/2;
AP4_DataBuffer attributes_atoms;
attributes_atoms.SetDataSize(size);
- if(AP4_SUCCEEDED(AP4_ParseHex(signed_attributes, attributes_atoms.UseData(), size)))
- {
+ if (AP4_SUCCEEDED(AP4_ParseHex(signed_attributes, attributes_atoms.UseData(), size))) {
// parse all the atoms encoded in the data and add them to the 'schi' container
- AP4_MemoryByteStream* mbs = new AP4_MemoryByteStream(attributes_atoms.GetData(),
- attributes_atoms.GetDataSize());
- do
- {
+ AP4_MemoryByteStream* mbs = new AP4_MemoryByteStream(attributes_atoms.GetData(),
+ attributes_atoms.GetDataSize());
+ do {
AP4_Atom* atom = NULL;
result = AP4_DefaultAtomFactory::Instance.CreateAtomFromStream(*mbs, atom);
- if(AP4_SUCCEEDED(result) && atom)
- {
+ if (AP4_SUCCEEDED(result) && atom) {
schi->AddChild(atom);
}
- }
- while(AP4_SUCCEEDED(result));
+ } while (AP4_SUCCEEDED(result));
mbs->Release();
}
}
-
+
// find what the track type is (necessary for the next step) and the key
const AP4_UI08* key;
unsigned int key_size = 0;
AP4_Track::Type track_type = AP4_Track::TYPE_UNKNOWN;
- for(AP4_List<AP4_TrakAtom>::Item* trak_item = moov->GetTrakAtoms().FirstItem();
- trak_item;
- trak_item = trak_item->GetNext())
- {
+ for (AP4_List<AP4_TrakAtom>::Item* trak_item = moov->GetTrakAtoms().FirstItem();
+ trak_item;
+ trak_item = trak_item->GetNext()) {
AP4_TrakAtom* trak = trak_item->GetData();
- if(trak->GetId() == mpod->GetTrackIds()[i])
- {
+ if (trak->GetId() == mpod->GetTrackIds()[i]) {
// find the handler type
AP4_Atom* sub = trak->FindChild("mdia/hdlr");
- if(sub)
- {
+ if (sub) {
AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, sub);
- if(hdlr)
- {
+ if (hdlr) {
AP4_UI32 type = hdlr->GetHandlerType();
- if(type == AP4_HANDLER_TYPE_SOUN)
- {
+ if (type == AP4_HANDLER_TYPE_SOUN) {
track_type = AP4_Track::TYPE_AUDIO;
- }
- else if(type == AP4_HANDLER_TYPE_VIDE)
- {
+ } else if (type == AP4_HANDLER_TYPE_VIDE) {
track_type = AP4_Track::TYPE_VIDEO;
}
}
}
-
+
// find the key
const AP4_UI08* iv = NULL;
- if(AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv)))
- {
+ if (AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv))) {
key_size = 16;
}
break;
}
}
-
+
// group key
- if(m_UseGroupKey)
- {
+ if (m_UseGroupKey) {
// find the group key
const AP4_UI08* iv = NULL;
const AP4_UI08* group_key;
- if(AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(0, group_key, iv)))
- {
+ if (AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(0, group_key, iv))) {
AP4_DataBuffer wrapped_key;
result = AP4_AesKeyWrap(group_key, key, key_size, wrapped_key);
- if(AP4_FAILED(result)) return result;
- AP4_UnknownAtom* gkey = new AP4_UnknownAtom(AP4_ATOM_TYPE_GKEY,
- wrapped_key.GetData(),
- wrapped_key.GetDataSize());
+ if (AP4_FAILED(result)) return result;
+ AP4_UnknownAtom* gkey = new AP4_UnknownAtom(AP4_ATOM_TYPE_GKEY,
+ wrapped_key.GetData(),
+ wrapped_key.GetDataSize());
schi->AddChild(gkey);
}
}
-
+
// create and add the secure attributes (satr)
- if(track_type != AP4_Track::TYPE_UNKNOWN && key != NULL && key_size != 0)
- {
+ if (track_type != AP4_Track::TYPE_UNKNOWN && key != NULL && key_size != 0) {
AP4_ContainerAtom* satr = new AP4_ContainerAtom(AP4_ATOM_TYPE_SATR);
- switch(track_type)
- {
- case AP4_Track::TYPE_AUDIO:
- satr->AddChild(new AP4_NullTerminatedStringAtom(AP4_ATOM_TYPE_STYP, AP4_MARLIN_IPMP_STYP_AUDIO));
- break;
- case AP4_Track::TYPE_VIDEO:
- satr->AddChild(new AP4_NullTerminatedStringAtom(AP4_ATOM_TYPE_STYP, AP4_MARLIN_IPMP_STYP_VIDEO));
- break;
- default:
- break;
+ switch (track_type) {
+ case AP4_Track::TYPE_AUDIO:
+ satr->AddChild(new AP4_NullTerminatedStringAtom(AP4_ATOM_TYPE_STYP, AP4_MARLIN_IPMP_STYP_AUDIO));
+ break;
+ case AP4_Track::TYPE_VIDEO:
+ satr->AddChild(new AP4_NullTerminatedStringAtom(AP4_ATOM_TYPE_STYP, AP4_MARLIN_IPMP_STYP_VIDEO));
+ break;
+ default:
+ break;
}
-
+
// compute the hmac
AP4_MemoryByteStream* mbs = new AP4_MemoryByteStream();
satr->Write(*mbs);
@@ -911,74 +821,73 @@ AP4_MarlinIpmpEncryptingProcessor::Initialize(
AP4_DataBuffer hmac_value;
digester->Final(hmac_value);
AP4_Atom* hmac = new AP4_UnknownAtom(AP4_ATOM_TYPE_HMAC, hmac_value.GetData(), hmac_value.GetDataSize());
-
+
schi->AddChild(satr);
schi->AddChild(hmac);
-
+
mbs->Release();
}
-
+
sinf->AddChild(schi);
-
+
// serialize the sinf atom to a buffer and set it as the ipmp data
AP4_MemoryByteStream* sinf_data = new AP4_MemoryByteStream((AP4_Size)sinf->GetSize());
sinf->Write(*sinf_data);
ipmp_descriptor->SetData(sinf_data->GetData(), sinf_data->GetDataSize());
sinf_data->Release();
-
+
ipmp_update.AddDescriptor(ipmp_descriptor);
}
-
+
// add the sample with the descriptors and updates
AP4_MemoryByteStream* sample_data = new AP4_MemoryByteStream();
od_update.Write(*sample_data);
ipmp_update.Write(*sample_data);
od_sample_table->AddSample(*sample_data, 0, sample_data->GetDataSize(), 0, 0, 0, 0, true);
-
+
// create the OD track
AP4_TrakAtom* od_track = new AP4_TrakAtom(od_sample_table,
- AP4_HANDLER_TYPE_ODSM,
- "Bento4 Marlin OD Handler",
- od_track_id,
- 0, 0,
- 1, 1000, 1, 0, "und",
- 0, 0);
-
- // add an entry in the processor's stream table to indicate that the
+ AP4_HANDLER_TYPE_ODSM,
+ "Bento4 Marlin OD Handler",
+ od_track_id,
+ 0, 0,
+ 1, 1000, 1, 0, "und",
+ 0, 0);
+
+ // add an entry in the processor's stream table to indicate that the
// media data for the OD track is not in the file stream, but in our
// memory stream.
m_ExternalTrackData.Add(new ExternalTrackData(od_track_id, sample_data));
sample_data->Release();
-
+
// add a tref track reference atom
AP4_ContainerAtom* tref = new AP4_ContainerAtom(AP4_ATOM_TYPE_TREF);
tref->AddChild(mpod);
od_track->AddChild(tref, 1); // add after 'tkhd'
-
+
// add the track to the moov atoms (just after the last track)
moov->AddChild(od_track, od_track_position);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MarlinIpmpEncryptingProcessor::CreateTrackHandler
+---------------------------------------------------------------------*/
-AP4_Processor::TrackHandler*
+AP4_Processor::TrackHandler*
AP4_MarlinIpmpEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// create a handler for this track if we have a key for it
const AP4_UI08* key;
const AP4_UI08* iv;
- if(AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv)))
- {
+ if (AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv))) {
// create the track handler
AP4_MarlinIpmpTrackEncrypter* handler = NULL;
AP4_Result result = AP4_MarlinIpmpTrackEncrypter::Create(*m_BlockCipherFactory, key, iv, handler);
- if(AP4_FAILED(result)) return NULL;
+ if (AP4_FAILED(result)) return NULL;
return handler;
}
-
+
// not encrypted
return NULL;
}
@@ -994,34 +903,34 @@ AP4_MarlinIpmpTrackEncrypter::Create(AP4_BlockCipherFactory& cipher_facto
{
// default value
encrypter = NULL;
-
+
// create a block cipher
AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = cipher_factory.Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- AP4_AES_BLOCK_SIZE,
- block_cipher);
- if(AP4_FAILED(result)) return result;
+ AP4_Result result = cipher_factory.Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ AP4_AES_BLOCK_SIZE,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
// create a CBC cipher
AP4_CbcStreamCipher* cbc_cipher = new AP4_CbcStreamCipher(block_cipher, AP4_StreamCipher::ENCRYPT);
-
+
// create the track encrypter
encrypter = new AP4_MarlinIpmpTrackEncrypter(cbc_cipher, iv);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MarlinIpmpTrackEncrypter::AP4_MarlinIpmpTrackEncrypter
+---------------------------------------------------------------------*/
-AP4_MarlinIpmpTrackEncrypter::AP4_MarlinIpmpTrackEncrypter(AP4_StreamCipher* cipher,
- const AP4_UI08* iv) :
+AP4_MarlinIpmpTrackEncrypter::AP4_MarlinIpmpTrackEncrypter(AP4_StreamCipher* cipher,
+ const AP4_UI08* iv) :
m_Cipher(cipher)
{
// copy the IV
- AP4_CopyMemory(m_IV, iv, AP4_AES_BLOCK_SIZE);
+ AP4_CopyMemory(m_IV, iv, AP4_AES_BLOCK_SIZE);
}
/*----------------------------------------------------------------------
@@ -1035,47 +944,47 @@ AP4_MarlinIpmpTrackEncrypter::~AP4_MarlinIpmpTrackEncrypter()
/*----------------------------------------------------------------------
| AP4_MarlinIpmpTrackEncrypter:GetProcessedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_MarlinIpmpTrackEncrypter::GetProcessedSampleSize(AP4_Sample& sample)
{
- return AP4_CIPHER_BLOCK_SIZE * (2 + (sample.GetSize() / AP4_CIPHER_BLOCK_SIZE));
+ return AP4_CIPHER_BLOCK_SIZE*(2+(sample.GetSize()/AP4_CIPHER_BLOCK_SIZE));
}
/*----------------------------------------------------------------------
| AP4_MarlinIpmpTrackEncrypter:ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MarlinIpmpTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out)
+ AP4_DataBuffer& data_out)
{
AP4_Result result;
-
+
const AP4_UI08* in = data_in.GetData();
AP4_Size in_size = data_in.GetDataSize();
- // default to 0 output
+ // default to 0 output
data_out.SetDataSize(0);
// process the sample data
- AP4_Size out_size = AP4_CIPHER_BLOCK_SIZE * (2 + (in_size / AP4_CIPHER_BLOCK_SIZE));
+ AP4_Size out_size = AP4_CIPHER_BLOCK_SIZE*(2+(in_size/AP4_CIPHER_BLOCK_SIZE));
data_out.SetDataSize(out_size);
AP4_UI08* out = data_out.UseData();
// write the IV
AP4_CopyMemory(out, m_IV, AP4_CIPHER_BLOCK_SIZE);
out_size -= AP4_CIPHER_BLOCK_SIZE;
-
+
// encrypt the data
m_Cipher->SetIV(m_IV);
- result = m_Cipher->ProcessBuffer(in,
- in_size,
- out + AP4_AES_BLOCK_SIZE,
+ result = m_Cipher->ProcessBuffer(in,
+ in_size,
+ out+AP4_AES_BLOCK_SIZE,
&out_size,
true);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// update the payload size
- data_out.SetDataSize(out_size + AP4_AES_BLOCK_SIZE);
-
+ data_out.SetDataSize(out_size+AP4_AES_BLOCK_SIZE);
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.h
index 52601c529..7e1b428d6 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Marlin.h
@@ -47,15 +47,15 @@
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_MARLIN_BRAND_MGSV = AP4_ATOM_TYPE('M', 'G', 'S', 'V');
+const AP4_UI32 AP4_MARLIN_BRAND_MGSV = AP4_ATOM_TYPE('M','G','S','V');
const AP4_UI16 AP4_MARLIN_IPMPS_TYPE_MGSV = 0xA551;
-const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC = AP4_ATOM_TYPE('A', 'C', 'B', 'C');
-const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK = AP4_ATOM_TYPE('A', 'C', 'G', 'K');
+const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACBC = AP4_ATOM_TYPE('A','C','B','C');
+const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_MARLIN_ACGK = AP4_ATOM_TYPE('A','C','G','K');
-const AP4_Atom::Type AP4_ATOM_TYPE_SATR = AP4_ATOM_TYPE('s', 'a', 't', 'r');
-const AP4_Atom::Type AP4_ATOM_TYPE_STYP = AP4_ATOM_TYPE('s', 't', 'y', 'p');
-const AP4_Atom::Type AP4_ATOM_TYPE_HMAC = AP4_ATOM_TYPE('h', 'm', 'a', 'c');
-const AP4_Atom::Type AP4_ATOM_TYPE_GKEY = AP4_ATOM_TYPE('g', 'k', 'e', 'y');
+const AP4_Atom::Type AP4_ATOM_TYPE_SATR = AP4_ATOM_TYPE('s','a','t','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_STYP = AP4_ATOM_TYPE('s','t','y','p');
+const AP4_Atom::Type AP4_ATOM_TYPE_HMAC = AP4_ATOM_TYPE('h','m','a','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_GKEY = AP4_ATOM_TYPE('g','k','e','y');
const char* const AP4_MARLIN_IPMP_STYP_VIDEO = "urn:marlin:organization:sne:content-type:video";
const char* const AP4_MARLIN_IPMP_STYP_AUDIO = "urn:marlin:organization:sne:content-type:audio";
@@ -67,24 +67,20 @@ class AP4_MarlinIpmpParser
{
public:
// types
- struct SinfEntry
- {
- SinfEntry(AP4_UI32 track_id, AP4_ContainerAtom* sinf) :
- m_TrackId(track_id), m_Sinf(sinf) {}
- ~SinfEntry()
- {
- delete m_Sinf;
- }
+ struct SinfEntry {
+ SinfEntry(AP4_UI32 track_id, AP4_ContainerAtom* sinf) :
+ m_TrackId(track_id), m_Sinf(sinf) {}
+ ~SinfEntry() { delete m_Sinf; }
AP4_UI32 m_TrackId;
AP4_ContainerAtom* m_Sinf;
};
-
+
// methods
- static AP4_Result Parse(AP4_AtomParent& top_level,
+ static AP4_Result Parse(AP4_AtomParent& top_level,
AP4_ByteStream& stream,
AP4_List<SinfEntry>& sinf_entries,
- bool remove_od_data = false);
-
+ bool remove_od_data=false);
+
private:
AP4_MarlinIpmpParser() {} // this class can't be instantiated
};
@@ -99,12 +95,9 @@ public:
AP4_MarlinIpmpDecryptingProcessor(const AP4_ProtectionKeyMap* key_map = NULL,
AP4_BlockCipherFactory* block_cipher_factory = NULL);
~AP4_MarlinIpmpDecryptingProcessor();
-
+
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
// methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level,
@@ -113,7 +106,7 @@ public:
virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
private:
-
+
// members
AP4_BlockCipherFactory* m_BlockCipherFactory;
AP4_ProtectionKeyMap m_KeyMap;
@@ -130,10 +123,10 @@ public:
static AP4_Result Create(AP4_BlockCipherFactory& cipher_factory,
const AP4_UI08* key,
AP4_MarlinIpmpTrackDecrypter*& decrypter);
-
+
// destructor
~AP4_MarlinIpmpTrackDecrypter();
-
+
// AP4_Processor::TrackHandler methods
virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
@@ -160,14 +153,8 @@ public:
AP4_BlockCipherFactory* block_cipher_factory = NULL);
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
- AP4_TrackPropertyMap& GetPropertyMap()
- {
- return m_PropertyMap;
- }
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
+ AP4_TrackPropertyMap& GetPropertyMap() { return m_PropertyMap; }
// AP4_Processor methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level,
@@ -194,10 +181,10 @@ public:
const AP4_UI08* key,
const AP4_UI08* iv,
AP4_MarlinIpmpTrackEncrypter*& encrypter);
-
+
// destructor
~AP4_MarlinIpmpTrackEncrypter();
-
+
// AP4_Processor::TrackHandler methods
virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.cpp
index 5ec6b401e..78bab0b3c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mdhd Atoms
+| AP4 - mdhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_MdhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 1) return NULL;
return new AP4_MdhdAtom(size, version, flags, stream);
}
@@ -59,7 +59,7 @@ AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI32 creation_time,
AP4_UI32 time_scale,
AP4_UI64 duration,
const char* language) :
- AP4_Atom(AP4_ATOM_TYPE_MDHD, AP4_FULL_ATOM_HEADER_SIZE + 20, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, AP4_FULL_ATOM_HEADER_SIZE+20, 0, 0),
m_CreationTime(creation_time),
m_ModificationTime(modification_time),
m_TimeScale(time_scale),
@@ -71,14 +71,13 @@ AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI32 creation_time,
/*----------------------------------------------------------------------
| AP4_MdhdAtom::AP4_MdhdAtom
+---------------------------------------------------------------------*/
-AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI32 size,
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_MDHD, size, version, flags)
{
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
AP4_UI32 creation_time;
stream.ReadUI32(creation_time);
m_CreationTime = creation_time;
@@ -89,27 +88,22 @@ AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI32 size,
AP4_UI32 duration;
stream.ReadUI32(duration);
m_Duration = duration;
- }
- else
- {
+ } else {
stream.ReadUI64(m_CreationTime);
stream.ReadUI64(m_ModificationTime);
stream.ReadUI32(m_TimeScale);
stream.ReadUI64(m_Duration);
}
-
+
unsigned char lang[2];
stream.Read(lang, 2);
- char l0 = ((lang[0] >> 2) & 0x1F);
- char l1 = (((lang[0] & 0x3) << 3) | ((lang[1] >> 5) & 0x7));
- char l2 = ((lang[1] & 0x1F));
- if(l0 && l1 && l2)
- {
- char lang_str[3] = {l0 + 0x60, l1 + 0x60, l2 + 0x60};
+ char l0 = ((lang[0]>>2)&0x1F);
+ char l1 = (((lang[0]&0x3)<<3) | ((lang[1]>>5)&0x7));
+ char l2 = ((lang[1]&0x1F));
+ if (l0 && l1 && l2) {
+ char lang_str[3] = {l0+0x60, l1+0x60, l2+0x60};
m_Language.Assign(lang_str, 3);
- }
- else
- {
+ } else {
m_Language.Assign("```", 3);
}
}
@@ -122,37 +116,34 @@ AP4_MdhdAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
result = stream.WriteUI32((AP4_UI32)m_CreationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TimeScale);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_Duration);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
result = stream.WriteUI64(m_CreationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_ModificationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TimeScale);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_Duration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// write the language
- AP4_UI08 l0 = m_Language[0] - 0x60;
- AP4_UI08 l1 = m_Language[1] - 0x60;
- AP4_UI08 l2 = m_Language[2] - 0x60;
- result = stream.WriteUI08(l0 << 2 | l1 >> 3);
- if(AP4_FAILED(result)) return result;
- result = stream.WriteUI08(l1 << 5 | l2);
- if(AP4_FAILED(result)) return result;
+ AP4_UI08 l0 = m_Language[0]-0x60;
+ AP4_UI08 l1 = m_Language[1]-0x60;
+ AP4_UI08 l2 = m_Language[2]-0x60;
+ result = stream.WriteUI08(l0<<2 | l1>>3);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(l1<<5 | l2);
+ if (AP4_FAILED(result)) return result;
// pre-defined
return stream.WriteUI16(0);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.h
index 4627a5fa8..f61ba9f6a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MdhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mdhd Atoms
+| AP4 - mdhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -62,30 +62,15 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
AP4_UI32 GetDurationMs();
- AP4_UI64 GetDuration()
- {
- return m_Duration;
- }
- void SetDuration(AP4_UI64 duration)
- {
- m_Duration = duration;
- }
- AP4_UI32 GetTimeScale()
- {
- return m_TimeScale;
- }
- void SetTimeScale(AP4_UI32 timescale)
- {
- m_TimeScale = timescale;
- }
- const AP4_String& GetLanguage()
- {
- return m_Language;
- }
+ AP4_UI64 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI64 duration) { m_Duration = duration; }
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ void SetTimeScale(AP4_UI32 timescale) { m_TimeScale = timescale; }
+ const AP4_String& GetLanguage() { return m_Language; }
private:
// methods
- AP4_MdhdAtom(AP4_UI32 size,
+ AP4_MdhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.cpp
index 3d25a7b52..cf4ae40ca 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mehd Atoms
+| AP4 - mehd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_MehdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 1) return NULL;
return new AP4_MehdAtom(size, version, flags, stream);
}
@@ -55,11 +55,10 @@ AP4_MehdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_MehdAtom::AP4_MehdAtom
+---------------------------------------------------------------------*/
AP4_MehdAtom::AP4_MehdAtom(AP4_UI64 duration) :
- AP4_Atom(AP4_ATOM_TYPE_MEHD, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_MEHD, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0),
m_Duration(duration)
{
- if(duration > 0xFFFFFFFF)
- {
+ if (duration > 0xFFFFFFFF) {
m_Version = 1;
m_Size32 += 4;
}
@@ -68,20 +67,17 @@ AP4_MehdAtom::AP4_MehdAtom(AP4_UI64 duration) :
/*----------------------------------------------------------------------
| AP4_MehdAtom::AP4_MehdAtom
+---------------------------------------------------------------------*/
-AP4_MehdAtom::AP4_MehdAtom(AP4_UI32 size,
+AP4_MehdAtom::AP4_MehdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_MEHD, size, version, flags)
{
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
AP4_UI32 duration;
stream.ReadUI32(duration);
m_Duration = duration;
- }
- else
- {
+ } else {
stream.ReadUI64(m_Duration);
}
}
@@ -92,12 +88,9 @@ AP4_MehdAtom::AP4_MehdAtom(AP4_UI32 size,
AP4_Result
AP4_MehdAtom::WriteFields(AP4_ByteStream& stream)
{
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
return stream.WriteUI32((AP4_UI32)m_Duration);
- }
- else
- {
+ } else {
return stream.WriteUI64(m_Duration);
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.h
index 211da83ca..5d0052920 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MehdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mehd Atoms
+| AP4 - mehd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -50,21 +50,15 @@ public:
AP4_MehdAtom(AP4_UI64 duration);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI64 GetDuration()
- {
- return m_Duration;
- }
- void SetDuration(AP4_UI64 duration)
- {
- m_Duration = duration;
- }
+ AP4_UI64 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI64 duration) { m_Duration = duration;}
private:
// methods
- AP4_MehdAtom(AP4_UI32 size,
+ AP4_MehdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
- AP4_ByteStream& stream);
+ AP4_ByteStream& stream);
// members
AP4_UI64 m_Duration;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.cpp
index e2fe2a4c2..62294f74a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mfhd Atoms
+| AP4 - mfhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_MfhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 0) return NULL;
return new AP4_MfhdAtom(size, version, flags, stream);
}
@@ -55,7 +55,7 @@ AP4_MfhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_MfhdAtom::AP4_MfhdAtom
+---------------------------------------------------------------------*/
AP4_MfhdAtom::AP4_MfhdAtom(AP4_UI32 sequence_number) :
- AP4_Atom(AP4_ATOM_TYPE_MFHD, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_MFHD, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0),
m_SequenceNumber(sequence_number)
{
}
@@ -63,7 +63,7 @@ AP4_MfhdAtom::AP4_MfhdAtom(AP4_UI32 sequence_number) :
/*----------------------------------------------------------------------
| AP4_MfhdAtom::AP4_MfhdAtom
+---------------------------------------------------------------------*/
-AP4_MfhdAtom::AP4_MfhdAtom(AP4_UI32 size,
+AP4_MfhdAtom::AP4_MfhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.h
index 619cac1cd..ecdaacb0d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mfhd Atoms
+| AP4 - mfhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -50,18 +50,12 @@ public:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI32 GetSequenceNumber()
- {
- return m_SequenceNumber;
- }
- void SetSequenceNumber(AP4_UI32 sequence_number)
- {
- m_SequenceNumber = sequence_number;
- }
+ AP4_UI32 GetSequenceNumber() { return m_SequenceNumber; }
+ void SetSequenceNumber(AP4_UI32 sequence_number) { m_SequenceNumber = sequence_number; }
private:
// methods
- AP4_MfhdAtom(AP4_UI32 size,
+ AP4_MfhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.cpp
index d9de9a6fe..7000bb529 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tfra Atoms
+| AP4 - tfra Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -36,14 +36,14 @@
/*----------------------------------------------------------------------
| AP4_MfroAtom::Create
+---------------------------------------------------------------------*/
-AP4_MfroAtom*
+AP4_MfroAtom*
AP4_MfroAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version = 0;
AP4_UI32 flags = 0;
AP4_Result result = ReadFullHeader(stream, version, flags);
- if(AP4_FAILED(result)) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(result)) return NULL;
+ if (version != 0) return NULL;
return new AP4_MfroAtom(size, version, flags, stream);
}
@@ -51,7 +51,7 @@ AP4_MfroAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_MfroAtom::AP4_MfroAtom
+---------------------------------------------------------------------*/
AP4_MfroAtom::AP4_MfroAtom(AP4_UI32 mfra_size) :
- AP4_Atom(AP4_ATOM_TYPE_MFRO, AP4_FULL_ATOM_HEADER_SIZE + 4),
+ AP4_Atom(AP4_ATOM_TYPE_MFRO, AP4_FULL_ATOM_HEADER_SIZE+4),
m_MfraSize(mfra_size)
{
}
@@ -59,9 +59,9 @@ AP4_MfroAtom::AP4_MfroAtom(AP4_UI32 mfra_size) :
/*----------------------------------------------------------------------
| AP4_MfroAtom::AP4_MfroAtom
+---------------------------------------------------------------------*/
-AP4_MfroAtom::AP4_MfroAtom(AP4_UI32 size,
- AP4_UI32 version,
- AP4_UI32 flags,
+AP4_MfroAtom::AP4_MfroAtom(AP4_UI32 size,
+ AP4_UI32 version,
+ AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_MFRO, size, version, flags)
{
@@ -84,6 +84,6 @@ AP4_Result
AP4_MfroAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("mfra_size", m_MfraSize);
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.h
index 53992aa30..82ab1d867 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MfroAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mfro Atoms
+| AP4 - mfro Atoms
|
| Copyright 2002-2009 Axiomatic Systems, LLC
|
@@ -49,8 +49,8 @@ class AP4_MfroAtom : public AP4_Atom
public:
// class methods
static AP4_MfroAtom* Create(AP4_Size size, AP4_ByteStream& stream);
-
- // constructors
+
+ // constructors
AP4_MfroAtom(AP4_UI32 mfra_size);
// methods
@@ -58,11 +58,8 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI32 GetMfraSize()
- {
- return m_MfraSize;
- }
-
+ AP4_UI32 GetMfraSize() { return m_MfraSize; }
+
private:
// methods
AP4_MfroAtom(AP4_UI32 size, AP4_UI32 version, AP4_UI32 flags, AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.cpp
index b1f771e44..a50080cf1 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - moov Atoms
+| AP4 - moov Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -53,13 +53,10 @@ public:
AP4_TrakAtomCollector(AP4_List<AP4_TrakAtom>* track_atoms) :
m_TrakAtoms(track_atoms) {}
- AP4_Result Action(AP4_Atom* atom) const
- {
- if(atom->GetType() == AP4_ATOM_TYPE_TRAK)
- {
+ AP4_Result Action(AP4_Atom* atom) const {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
AP4_TrakAtom* trak = AP4_DYNAMIC_CAST(AP4_TrakAtom, atom);
- if(trak)
- {
+ if (trak) {
m_TrakAtoms->Add(trak);
}
}
@@ -88,98 +85,97 @@ AP4_MoovAtom::AP4_MoovAtom(AP4_UI32 size,
AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV, size, false, stream, atom_factory),
m_TimeScale(0)
{
- // ==> Start patch MPC
- if(AP4_ContainerAtom* cmov = dynamic_cast<AP4_ContainerAtom*>(GetChild(AP4_ATOM_TYPE_CMOV)))
- {
- AP4_DcomAtom* dcom = dynamic_cast<AP4_DcomAtom*>(cmov->GetChild(AP4_ATOM_TYPE_DCOM));
- AP4_CmvdAtom* cmvd = dynamic_cast<AP4_CmvdAtom*>(cmov->GetChild(AP4_ATOM_TYPE_CMVD));
- if(dcom && dcom->GetCompressorSubType() == AP4_ATOM_TYPE('z', 'l', 'i', 'b') && cmvd)
- {
- const AP4_DataBuffer& data = cmvd->GetDataBuffer();
-
- z_stream d_stream;
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- int res;
-
- if(Z_OK == (res = inflateInit(&d_stream)))
- {
- d_stream.next_in = (Bytef*)data.GetData();
- d_stream.avail_in = data.GetDataSize();
-
- unsigned char* dst = NULL;
- int n = 0;
-
- do
- {
- dst = (unsigned char*)realloc(dst, ++n * 1000);
- d_stream.next_out = &dst[(n-1)*1000];
- d_stream.avail_out = 1000;
-
- if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
- {
- free(dst);
- dst = NULL;
- break;
- }
- }
- while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
-
- inflateEnd(&d_stream);
-
- if(dst)
- {
- AP4_ByteStream* s = new AP4_MemoryByteStream(dst, d_stream.total_out);
- ReadChildren(atom_factory, *s, d_stream.total_out);
- s->Release();
- free(dst);
- }
-
- if(AP4_MoovAtom* moov = dynamic_cast<AP4_MoovAtom*>(GetChild(AP4_ATOM_TYPE_MOOV)))
- {
- AP4_List<AP4_Atom> Children;
-
- for(AP4_List<AP4_Atom>::Item* item = moov->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
- Children.Add(item->GetData());
- }
-
- for(AP4_List<AP4_Atom>::Item* item = Children.FirstItem();
- item;
- item = item->GetNext())
- {
- AP4_Atom* atom = item->GetData();
- atom->Detach();
- atom->SetParent(this);
- m_Children.Add(atom);
- }
-
- moov->Detach();
- delete moov;
- }
- }
- }
- }
- // <== End patch MPC
-
- // collect all trak atoms
- m_Children.Apply(AP4_TrakAtomCollector(&m_TrakAtoms));
+ // ==> Start patch MPC
+ if(AP4_ContainerAtom* cmov = dynamic_cast<AP4_ContainerAtom*>(GetChild(AP4_ATOM_TYPE_CMOV)))
+ {
+ AP4_DcomAtom* dcom = dynamic_cast<AP4_DcomAtom*>(cmov->GetChild(AP4_ATOM_TYPE_DCOM));
+ AP4_CmvdAtom* cmvd = dynamic_cast<AP4_CmvdAtom*>(cmov->GetChild(AP4_ATOM_TYPE_CMVD));
+ if(dcom && dcom->GetCompressorSubType() == AP4_ATOM_TYPE('z','l','i','b') && cmvd)
+ {
+ const AP4_DataBuffer& data = cmvd->GetDataBuffer();
+
+ z_stream d_stream;
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ int res;
+
+ if(Z_OK == (res = inflateInit(&d_stream)))
+ {
+ d_stream.next_in = (Bytef*)data.GetData();
+ d_stream.avail_in = data.GetDataSize();
+
+ unsigned char* dst = NULL;
+ int n = 0;
+
+ do
+ {
+ dst = (unsigned char*)realloc(dst, ++n*1000);
+ d_stream.next_out = &dst[(n-1)*1000];
+ d_stream.avail_out = 1000;
+
+ if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ dst = NULL;
+ break;
+ }
+ }
+ while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+
+ inflateEnd(&d_stream);
+
+ if(dst)
+ {
+ AP4_ByteStream* s = new AP4_MemoryByteStream(dst, d_stream.total_out);
+ ReadChildren(atom_factory, *s, d_stream.total_out);
+ s->Release();
+ free(dst);
+ }
+
+ if(AP4_MoovAtom* moov = dynamic_cast<AP4_MoovAtom*>(GetChild(AP4_ATOM_TYPE_MOOV)))
+ {
+ AP4_List<AP4_Atom> Children;
+
+ for(AP4_List<AP4_Atom>::Item* item = moov->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ Children.Add(item->GetData());
+ }
+
+ for(AP4_List<AP4_Atom>::Item* item = Children.FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+ atom->Detach();
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+
+ moov->Detach();
+ delete moov;
+ }
+ }
+ }
+ }
+ // <== End patch MPC
+
+ // collect all trak atoms
+ m_Children.Apply(AP4_TrakAtomCollector(&m_TrakAtoms));
}
/*----------------------------------------------------------------------
| AP4_MoovAtom::AdjustChunkOffsets
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MoovAtom::AdjustChunkOffsets(AP4_SI64 offset)
{
- for(AP4_List<AP4_TrakAtom>::Item* item = m_TrakAtoms.FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_TrakAtom>::Item* item = m_TrakAtoms.FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_TrakAtom* trak = item->GetData();
trak->AdjustChunkOffsets(offset);
}
@@ -194,11 +190,9 @@ void
AP4_MoovAtom::OnChildAdded(AP4_Atom* atom)
{
// keep the atom in the list of trak atoms
- if(atom->GetType() == AP4_ATOM_TYPE_TRAK)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
AP4_TrakAtom* trak = AP4_DYNAMIC_CAST(AP4_TrakAtom, atom);
- if(trak)
- {
+ if (trak) {
m_TrakAtoms.Add(trak);
}
}
@@ -214,11 +208,9 @@ void
AP4_MoovAtom::OnChildRemoved(AP4_Atom* atom)
{
// remove the atom from the list of trak atoms
- if(atom->GetType() == AP4_ATOM_TYPE_TRAK)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
AP4_TrakAtom* trak = AP4_DYNAMIC_CAST(AP4_TrakAtom, atom);
- if(trak)
- {
+ if (trak) {
m_TrakAtoms.Remove(trak);
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.h
index 8506e0a25..f06b2a137 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MoovAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - moov Atoms
+| AP4 - moov Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -52,23 +52,20 @@ public:
// class methods
static AP4_MoovAtom* Create(AP4_Size size,
AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory)
- {
+ AP4_AtomFactory& atom_factory) {
return new AP4_MoovAtom(size, stream, atom_factory);
}
// methods
AP4_MoovAtom();
- AP4_List<AP4_TrakAtom>& GetTrakAtoms()
- {
+ AP4_List<AP4_TrakAtom>& GetTrakAtoms() {
return m_TrakAtoms;
}
- AP4_UI32 GetTimeScale()
- {
+ AP4_UI32 GetTimeScale() {
return m_TimeScale;
}
AP4_Result AdjustChunkOffsets(AP4_SI64 offset);
-
+
// AP4_AtomParent methods
void OnChildAdded(AP4_Atom* atom);
void OnChildRemoved(AP4_Atom* atom);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.cpp
index bd6e24251..57c8c3c50 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.cpp
@@ -45,8 +45,7 @@ class AP4_TrackFinderById : public AP4_List<AP4_Track>::Item::Finder
{
public:
AP4_TrackFinderById(AP4_UI32 track_id) : m_TrackId(track_id) {}
- AP4_Result Test(AP4_Track* track) const
- {
+ AP4_Result Test(AP4_Track* track) const {
return track->GetId() == m_TrackId ? AP4_SUCCESS : AP4_FAILURE;
}
private:
@@ -59,16 +58,12 @@ private:
class AP4_TrackFinderByType : public AP4_List<AP4_Track>::Item::Finder
{
public:
- AP4_TrackFinderByType(AP4_Track::Type type, AP4_Ordinal index = 0) :
- m_Type(type), m_Index(index) {}
- AP4_Result Test(AP4_Track* track) const
- {
- if(track->GetType() == m_Type && m_Index-- == 0)
- {
+ AP4_TrackFinderByType(AP4_Track::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Track* track) const {
+ if (track->GetType() == m_Type && m_Index-- == 0) {
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_FAILURE;
}
}
@@ -84,9 +79,9 @@ AP4_Movie::AP4_Movie(AP4_UI32 time_scale) :
m_MoovAtomIsOwned(true)
{
m_MoovAtom = new AP4_MoovAtom();
- m_MvhdAtom = new AP4_MvhdAtom(0, 0,
- time_scale,
- 0,
+ m_MvhdAtom = new AP4_MvhdAtom(0, 0,
+ time_scale,
+ 0,
0x00010000,
0x0100);
m_MoovAtom->AddChild(m_MvhdAtom);
@@ -100,17 +95,14 @@ AP4_Movie::AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& sample_stream, bool tra
m_MoovAtomIsOwned(transfer_moov_ownership)
{
// ignore null atoms
- if(moov == NULL) return;
+ if (moov == NULL) return;
// get the time scale
AP4_UI32 time_scale;
m_MvhdAtom = AP4_DYNAMIC_CAST(AP4_MvhdAtom, moov->GetChild(AP4_ATOM_TYPE_MVHD));
- if(m_MvhdAtom)
- {
+ if (m_MvhdAtom) {
time_scale = m_MvhdAtom->GetTimeScale();
- }
- else
- {
+ } else {
time_scale = 0;
}
@@ -118,23 +110,22 @@ AP4_Movie::AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& sample_stream, bool tra
AP4_List<AP4_TrakAtom>* trak_atoms;
trak_atoms = &moov->GetTrakAtoms();
AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem();
- while(item)
- {
- AP4_Track* track = new AP4_Track(*item->GetData(),
+ while (item) {
+ AP4_Track* track = new AP4_Track(*item->GetData(),
sample_stream,
time_scale);
m_Tracks.Add(track);
item = item->GetNext();
}
}
-
+
/*----------------------------------------------------------------------
| AP4_Movie::~AP4_Movie
+---------------------------------------------------------------------*/
AP4_Movie::~AP4_Movie()
{
m_Tracks.DeleteReferences();
- if(m_MoovAtomIsOwned) delete m_MoovAtom;
+ if (m_MoovAtomIsOwned) delete m_MoovAtom;
}
/*----------------------------------------------------------------------
@@ -154,12 +145,9 @@ AP4_Track*
AP4_Movie::GetTrack(AP4_UI32 track_id)
{
AP4_Track* track = NULL;
- if(AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderById(track_id), track)))
- {
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderById(track_id), track))) {
return track;
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -171,12 +159,9 @@ AP4_Track*
AP4_Movie::GetTrack(AP4_Track::Type track_type, AP4_Ordinal index)
{
AP4_Track* track = NULL;
- if(AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderByType(track_type, index), track)))
- {
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderByType(track_type, index), track))) {
return track;
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -188,14 +173,12 @@ AP4_Result
AP4_Movie::AddTrack(AP4_Track* track)
{
// assign an ID to the track unless it already has one
- if(track->GetId() == 0)
- {
- track->SetId(m_Tracks.ItemCount() + 1);
+ if (track->GetId() == 0) {
+ track->SetId(m_Tracks.ItemCount()+1);
}
// if we don't have a time scale, use the one from the track
- if(m_MvhdAtom->GetTimeScale() == 0)
- {
+ if (m_MvhdAtom->GetTimeScale() == 0) {
m_MvhdAtom->SetTimeScale(track->GetMediaTimeScale());
}
@@ -203,11 +186,10 @@ AP4_Movie::AddTrack(AP4_Track* track)
track->SetMovieTimeScale(m_MvhdAtom->GetTimeScale());
// update the movie duration
- if(m_MvhdAtom->GetDuration() < track->GetDuration())
- {
+ if (m_MvhdAtom->GetDuration() < track->GetDuration()) {
m_MvhdAtom->SetDuration(track->GetDuration());
}
-
+
// attach the track as a child
track->Attach(m_MoovAtom);
m_Tracks.Add(track);
@@ -221,12 +203,9 @@ AP4_Movie::AddTrack(AP4_Track* track)
AP4_UI32
AP4_Movie::GetTimeScale()
{
- if(m_MvhdAtom)
- {
+ if (m_MvhdAtom) {
return m_MvhdAtom->GetTimeScale();
- }
- else
- {
+ } else {
return 0;
}
}
@@ -237,12 +216,9 @@ AP4_Movie::GetTimeScale()
AP4_UI64
AP4_Movie::GetDuration()
{
- if(m_MvhdAtom)
- {
+ if (m_MvhdAtom) {
return m_MvhdAtom->GetDuration();
- }
- else
- {
+ } else {
return 0;
}
}
@@ -253,12 +229,9 @@ AP4_Movie::GetDuration()
AP4_UI32
AP4_Movie::GetDurationMs()
{
- if(m_MvhdAtom)
- {
+ if (m_MvhdAtom) {
return m_MvhdAtom->GetDurationMs();
- }
- else
- {
+ } else {
return 0;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.h
index 8cea28a26..80d6cdb19 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Movie.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Movie
+| AP4 - Movie
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -48,8 +48,7 @@ class AP4_MetaData;
/*----------------------------------------------------------------------
| AP4_Movie
+---------------------------------------------------------------------*/
-class AP4_Movie
-{
+class AP4_Movie {
public:
// methods
AP4_Movie(AP4_UI32 time_scale = 0);
@@ -57,25 +56,16 @@ public:
virtual ~AP4_Movie();
AP4_Result Inspect(AP4_AtomInspector& inspector);
- AP4_MoovAtom* GetMoovAtom()
- {
- return m_MoovAtom;
- }
- AP4_MvhdAtom* GetMvhdAtom()
- {
- return m_MvhdAtom;
- }
- AP4_List<AP4_Track>& GetTracks()
- {
- return m_Tracks;
- }
+ AP4_MoovAtom* GetMoovAtom() { return m_MoovAtom;}
+ AP4_MvhdAtom* GetMvhdAtom() { return m_MvhdAtom;}
+ AP4_List<AP4_Track>& GetTracks() { return m_Tracks; }
AP4_Track* GetTrack(AP4_UI32 track_id);
AP4_Track* GetTrack(AP4_Track::Type type, AP4_Ordinal index = 0);
AP4_Result AddTrack(AP4_Track* track);
AP4_UI32 GetTimeScale();
AP4_UI64 GetDuration();
AP4_UI32 GetDurationMs();
-
+
private:
// members
AP4_MoovAtom* m_MoovAtom;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.cpp
index 4d982d409..d85bc008b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.cpp
@@ -47,7 +47,7 @@ AP4_MovieFragment::AP4_MovieFragment(AP4_ContainerAtom* moof) :
m_MoofAtom(moof),
m_MfhdAtom(NULL)
{
- if(moof) m_MfhdAtom = AP4_DYNAMIC_CAST(AP4_MfhdAtom, moof->GetChild(AP4_ATOM_TYPE_MFHD));
+ if (moof) m_MfhdAtom = AP4_DYNAMIC_CAST(AP4_MfhdAtom, moof->GetChild(AP4_ATOM_TYPE_MFHD));
}
/*----------------------------------------------------------------------
@@ -64,7 +64,7 @@ AP4_MovieFragment::~AP4_MovieFragment()
AP4_UI32
AP4_MovieFragment::GetSequenceNumber()
{
- return m_MfhdAtom ? m_MfhdAtom->GetSequenceNumber() : 0;
+ return m_MfhdAtom?m_MfhdAtom->GetSequenceNumber():0;
}
/*----------------------------------------------------------------------
@@ -75,51 +75,44 @@ AP4_MovieFragment::GetTrackIds(AP4_Array<AP4_UI32>& ids)
{
ids.Clear();
ids.EnsureCapacity(m_MoofAtom->GetChildren().ItemCount());
-
- for(AP4_List<AP4_Atom>::Item* item = m_MoofAtom->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+
+ for (AP4_List<AP4_Atom>::Item* item = m_MoofAtom->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TRAF)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAF) {
AP4_ContainerAtom* traf = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(traf)
- {
+ if (traf) {
AP4_TfhdAtom* tfhd = AP4_DYNAMIC_CAST(AP4_TfhdAtom, traf->GetChild(AP4_ATOM_TYPE_TFHD));
- if(tfhd) ids.Append(tfhd->GetTrackId());
+ if (tfhd) ids.Append(tfhd->GetTrackId());
}
}
}
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MovieFragment::GetTrafAtom
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MovieFragment::GetTrafAtom(AP4_UI32 track_id, AP4_ContainerAtom*& traf)
{
- for(AP4_List<AP4_Atom>::Item* item = m_MoofAtom->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = m_MoofAtom->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TRAF)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAF) {
traf = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(traf)
- {
+ if (traf) {
AP4_TfhdAtom* tfhd = AP4_DYNAMIC_CAST(AP4_TfhdAtom, traf->GetChild(AP4_ATOM_TYPE_TFHD));
- if(tfhd && tfhd->GetTrackId() == track_id)
- {
+ if (tfhd && tfhd->GetTrackId() == track_id) {
return AP4_SUCCESS;
}
}
}
}
-
+
// not found
traf = NULL;
return AP4_ERROR_NO_SUCH_ITEM;
@@ -128,9 +121,9 @@ AP4_MovieFragment::GetTrafAtom(AP4_UI32 track_id, AP4_ContainerAtom*& traf)
/*----------------------------------------------------------------------
| AP4_MovieFragment::CreateSampleTable
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MovieFragment::CreateSampleTable(AP4_MoovAtom* moov,
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_ByteStream* sample_stream,
AP4_Position moof_offset,
AP4_Position mdat_payload_offset,
@@ -138,54 +131,49 @@ AP4_MovieFragment::CreateSampleTable(AP4_MoovAtom* moov,
{
// default value
sample_table = NULL;
-
+
// find a trex for this track, if any
AP4_ContainerAtom* mvex = NULL;
AP4_TrexAtom* trex = NULL;
- if(moov)
- {
+ if (moov) {
mvex = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->GetChild(AP4_ATOM_TYPE_MVEX));
}
- if(mvex)
- {
- for(AP4_List<AP4_Atom>::Item* item = mvex->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ if (mvex) {
+ for (AP4_List<AP4_Atom>::Item* item = mvex->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() == AP4_ATOM_TYPE_TREX)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_TREX) {
trex = AP4_DYNAMIC_CAST(AP4_TrexAtom, atom);
- if(trex && trex->GetTrackId() == track_id) break;
+ if (trex && trex->GetTrackId() == track_id) break;
trex = NULL;
}
}
}
AP4_ContainerAtom* traf = NULL;
- if(AP4_SUCCEEDED(GetTrafAtom(track_id, traf)))
- {
- sample_table = new AP4_FragmentSampleTable(traf,
- trex,
- sample_stream,
- moof_offset,
- mdat_payload_offset);
+ if (AP4_SUCCEEDED(GetTrafAtom(track_id, traf))) {
+ sample_table = new AP4_FragmentSampleTable(traf,
+ trex,
+ sample_stream,
+ moof_offset,
+ mdat_payload_offset);
return AP4_SUCCESS;
}
-
+
return AP4_ERROR_NO_SUCH_ITEM;
}
/*----------------------------------------------------------------------
| AP4_MovieFragment::CreateSampleTable
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MovieFragment::CreateSampleTable(AP4_Movie* movie,
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_ByteStream* sample_stream,
AP4_Position moof_offset,
AP4_Position mdat_payload_offset,
AP4_FragmentSampleTable*& sample_table)
{
- AP4_MoovAtom* moov = movie ? movie->GetMoovAtom() : NULL;
+ AP4_MoovAtom* moov = movie?movie->GetMoovAtom():NULL;
return CreateSampleTable(moov, track_id, sample_stream, moof_offset, mdat_payload_offset, sample_table);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.h
index 92b2c6de3..6ff5aae9a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MovieFragment.h
@@ -53,38 +53,31 @@ const AP4_UI32 AP4_FRAG_FLAG_SAMPLE_IS_DIFFERENCE = 0x00010000;
/*----------------------------------------------------------------------
| AP4_MovieFragment
+---------------------------------------------------------------------*/
-class AP4_MovieFragment
-{
+class AP4_MovieFragment {
public:
// this constructor transfers the ownership of the moof atom to the
// newly constructed object
AP4_MovieFragment(AP4_ContainerAtom* moof);
virtual ~AP4_MovieFragment();
- AP4_ContainerAtom* GetMoofAtom()
- {
- return m_MoofAtom;
- }
- AP4_MfhdAtom* GetMfhdAtom()
- {
- return m_MfhdAtom;
- }
+ AP4_ContainerAtom* GetMoofAtom() { return m_MoofAtom;}
+ AP4_MfhdAtom* GetMfhdAtom() { return m_MfhdAtom;}
AP4_UI32 GetSequenceNumber();
AP4_Result GetTrackIds(AP4_Array<AP4_UI32>& ids);
AP4_Result GetTrafAtom(AP4_UI32 track_id, AP4_ContainerAtom*& traf);
AP4_Result CreateSampleTable(AP4_MoovAtom* moov,
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_ByteStream* sample_stream,
AP4_Position moof_offset,
AP4_Position mdat_payload_offset, // hack because MS doesn't implement the spec properly
AP4_FragmentSampleTable*& sample_table);
AP4_Result CreateSampleTable(AP4_Movie* movie,
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_ByteStream* sample_stream,
AP4_Position moof_offset,
AP4_Position mdat_payload_offset, // hack because MS doesn't implement the spec properly
AP4_FragmentSampleTable*& sample_table);
-
+
private:
// members
AP4_ContainerAtom* m_MoofAtom;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.cpp
index 8078a6d05..dbb5f5982 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.cpp
@@ -43,30 +43,30 @@ const unsigned int AP4_MPEG2TS_PACKET_PAYLOAD_SIZE = 184;
const unsigned int AP4_MPEG2TS_SYNC_BYTE = 0x47;
const unsigned int AP4_MPEG2TS_PCR_ADAPTATION_SIZE = 6;
-static unsigned char const StuffingBytes[AP4_MPEG2TS_PACKET_SIZE] =
+static unsigned char const StuffingBytes[AP4_MPEG2TS_PACKET_SIZE] =
{
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
@@ -77,36 +77,21 @@ static unsigned char const StuffingBytes[AP4_MPEG2TS_PACKET_SIZE] =
static unsigned int
GetSamplingFrequencyIndex(unsigned int sampling_frequency)
{
- switch(sampling_frequency)
- {
- case 96000:
- return 0;
- case 88200:
- return 1;
- case 64000:
- return 2;
- case 48000:
- return 3;
- case 44100:
- return 4;
- case 32000:
- return 5;
- case 24000:
- return 6;
- case 22050:
- return 7;
- case 16000:
- return 8;
- case 12000:
- return 9;
- case 11025:
- return 10;
- case 8000:
- return 11;
- case 7350:
- return 12;
- default:
- return 0;
+ switch (sampling_frequency) {
+ case 96000: return 0;
+ case 88200: return 1;
+ case 64000: return 2;
+ case 48000: return 3;
+ case 44100: return 4;
+ case 32000: return 5;
+ case 24000: return 6;
+ case 22050: return 7;
+ case 16000: return 8;
+ case 12000: return 9;
+ case 11025: return 10;
+ case 8000: return 11;
+ case 7350: return 12;
+ default: return 0;
}
}
@@ -114,49 +99,48 @@ GetSamplingFrequencyIndex(unsigned int sampling_frequency)
| MakeAdtsHeader
+---------------------------------------------------------------------*/
static void
-MakeAdtsHeader(unsigned char bits[7],
+MakeAdtsHeader(unsigned char bits[7],
unsigned int frame_size,
unsigned int sampling_frequency_index,
unsigned int channel_configuration)
{
- bits[0] = 0xFF;
- bits[1] = 0xF1; // 0xF9 (MPEG2)
- bits[2] = 0x40 | (sampling_frequency_index << 2) | (channel_configuration >> 2);
- bits[3] = ((channel_configuration & 0x3) << 6) | ((frame_size + 7) >> 11);
- bits[4] = ((frame_size + 7) >> 3) & 0xFF;
- bits[5] = (((frame_size + 7) << 5) & 0xFF) | 0x1F;
- bits[6] = 0xFC;
-
- /*
- 0: syncword 12 always: '111111111111'
- 12: ID 1 0: MPEG-4, 1: MPEG-2
- 13: layer 2 always: '00'
- 15: protection_absent 1
- 16: profile 2
- 18: sampling_frequency_index 4
- 22: private_bit 1
- 23: channel_configuration 3
- 26: original/copy 1
- 27: home 1
- 28: emphasis 2 only if ID == 0
-
- ADTS Variable header: these can change from frame to frame
- 28: copyright_identification_bit 1
- 29: copyright_identification_start 1
- 30: aac_frame_length 13 length of the frame including header (in bytes)
- 43: adts_buffer_fullness 11 0x7FF indicates VBR
- 54: no_raw_data_blocks_in_frame 2
- ADTS Error check
- crc_check 16 only if protection_absent == 0
+ bits[0] = 0xFF;
+ bits[1] = 0xF1; // 0xF9 (MPEG2)
+ bits[2] = 0x40 | (sampling_frequency_index << 2) | (channel_configuration >> 2);
+ bits[3] = ((channel_configuration&0x3)<<6) | ((frame_size+7) >> 11);
+ bits[4] = ((frame_size+7) >> 3)&0xFF;
+ bits[5] = (((frame_size+7) << 5)&0xFF) | 0x1F;
+ bits[6] = 0xFC;
+
+ /*
+ 0: syncword 12 always: '111111111111'
+ 12: ID 1 0: MPEG-4, 1: MPEG-2
+ 13: layer 2 always: '00'
+ 15: protection_absent 1
+ 16: profile 2
+ 18: sampling_frequency_index 4
+ 22: private_bit 1
+ 23: channel_configuration 3
+ 26: original/copy 1
+ 27: home 1
+ 28: emphasis 2 only if ID == 0
+
+ ADTS Variable header: these can change from frame to frame
+ 28: copyright_identification_bit 1
+ 29: copyright_identification_start 1
+ 30: aac_frame_length 13 length of the frame including header (in bytes)
+ 43: adts_buffer_fullness 11 0x7FF indicates VBR
+ 54: no_raw_data_blocks_in_frame 2
+ ADTS Error check
+ crc_check 16 only if protection_absent == 0
*/
}
/*----------------------------------------------------------------------
| CRC_Table
+---------------------------------------------------------------------*/
-static AP4_UI32
-const CRC_Table[256] =
-{
+static AP4_UI32
+const CRC_Table[256] = {
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
@@ -209,12 +193,11 @@ static AP4_UI32
ComputeCRC(const unsigned char* data, unsigned int data_size)
{
AP4_UI32 crc = 0xFFFFFFFF;
-
- for(unsigned int i = 0; i < data_size; i++)
- {
+
+ for (unsigned int i=0; i<data_size; i++) {
crc = (crc << 8) ^ CRC_Table[((crc >> 24) ^ *data++) & 0xFF];
}
-
+
return crc;
}
@@ -222,242 +205,226 @@ ComputeCRC(const unsigned char* data, unsigned int data_size)
| AP4_Mpeg2TsWriter::Stream::WritePacketHeader
+---------------------------------------------------------------------*/
void
-AP4_Mpeg2TsWriter::Stream::WritePacketHeader(bool payload_start,
- unsigned int& payload_size,
- bool with_pcr,
- AP4_UI64 pcr,
- AP4_ByteStream& output)
+AP4_Mpeg2TsWriter::Stream::WritePacketHeader(bool payload_start,
+ unsigned int& payload_size,
+ bool with_pcr,
+ AP4_UI64 pcr,
+ AP4_ByteStream& output)
{
unsigned char header[4];
header[0] = AP4_MPEG2TS_SYNC_BYTE;
- header[1] = ((payload_start ? 1 : 0) << 6) | (m_PID >> 8);
+ header[1] = ((payload_start?1:0)<<6) | (m_PID >> 8);
header[2] = m_PID & 0xFF;
-
+
unsigned int adaptation_field_size = 0;
- if(with_pcr) adaptation_field_size += 2 + AP4_MPEG2TS_PCR_ADAPTATION_SIZE;
-
+ if (with_pcr) adaptation_field_size += 2+AP4_MPEG2TS_PCR_ADAPTATION_SIZE;
+
// clamp the payload size
- if(payload_size + adaptation_field_size > AP4_MPEG2TS_PACKET_PAYLOAD_SIZE)
- {
- payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE - adaptation_field_size;
+ if (payload_size+adaptation_field_size > AP4_MPEG2TS_PACKET_PAYLOAD_SIZE) {
+ payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE-adaptation_field_size;
}
-
+
// adjust the adaptation field to include stuffing if necessary
- if(adaptation_field_size + payload_size < AP4_MPEG2TS_PACKET_PAYLOAD_SIZE)
- {
- adaptation_field_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE - payload_size;
+ if (adaptation_field_size+payload_size < AP4_MPEG2TS_PACKET_PAYLOAD_SIZE) {
+ adaptation_field_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE-payload_size;
}
-
- if(adaptation_field_size == 0)
- {
+
+ if (adaptation_field_size == 0) {
// no adaptation field
- header[3] = (1 << 4) | ((m_ContinuityCounter++) & 0x0F);
+ header[3] = (1<<4) | ((m_ContinuityCounter++)&0x0F);
output.Write(header, 4);
- }
- else
- {
+ } else {
// adaptation field present
- header[3] = (3 << 4) | ((m_ContinuityCounter++) & 0x0F);
+ header[3] = (3<<4) | ((m_ContinuityCounter++)&0x0F);
output.Write(header, 4);
-
- if(adaptation_field_size == 1)
- {
+
+ if (adaptation_field_size == 1) {
// just one byte (stuffing)
output.WriteUI08(0);
- }
- else
- {
+ } else {
// two or more bytes (stuffing and/or PCR)
- output.WriteUI08(adaptation_field_size - 1);
- output.WriteUI08(with_pcr ? (1 << 4) : 0);
+ output.WriteUI08(adaptation_field_size-1);
+ output.WriteUI08(with_pcr?(1<<4):0);
unsigned int pcr_size = 0;
- if(with_pcr)
- {
+ if (with_pcr) {
pcr_size = AP4_MPEG2TS_PCR_ADAPTATION_SIZE;
- AP4_UI64 pcr_base = pcr / 300;
- AP4_UI32 pcr_ext = (AP4_UI32)(pcr % 300);
+ AP4_UI64 pcr_base = pcr/300;
+ AP4_UI32 pcr_ext = (AP4_UI32)(pcr%300);
AP4_BitWriter writer(pcr_size);
- writer.Write((AP4_UI32)(pcr_base >> 32), 1);
+ writer.Write((AP4_UI32)(pcr_base>>32), 1);
writer.Write((AP4_UI32)pcr_base, 32);
writer.Write(0x3F, 6);
writer.Write(pcr_ext, 9);
output.Write(writer.GetData(), pcr_size);
- }
- if(adaptation_field_size > 2)
- {
- output.Write(StuffingBytes, adaptation_field_size - pcr_size - 2);
+ }
+ if (adaptation_field_size > 2) {
+ output.Write(StuffingBytes, adaptation_field_size-pcr_size-2);
}
}
}
-}
+}
/*----------------------------------------------------------------------
| AP4_Mpeg2TsWriter::SampleStream::WritePES
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Mpeg2TsWriter::SampleStream::WritePES(const unsigned char* data,
- unsigned int data_size,
- AP4_UI64 dts,
- bool with_dts,
- AP4_UI64 pts,
- bool with_pcr,
- AP4_ByteStream& output)
+AP4_Mpeg2TsWriter::SampleStream::WritePES(const unsigned char* data,
+ unsigned int data_size,
+ AP4_UI64 dts,
+ bool with_dts,
+ AP4_UI64 pts,
+ bool with_pcr,
+ AP4_ByteStream& output)
{
- unsigned int pes_header_size = 14 + (with_dts ? 5 : 0);
+ unsigned int pes_header_size = 14+(with_dts?5:0);
AP4_BitWriter pes_header(pes_header_size);
-
+
pes_header.Write(0x000001, 24); // packet_start_code_prefix
pes_header.Write(m_StreamId, 8); // stream_id
- pes_header.Write(m_StreamId == AP4_MPEG2_TS_DEFAULT_STREAM_ID_VIDEO ? 0 : (data_size + pes_header_size - 6), 16); // PES_packet_length
+ pes_header.Write(m_StreamId == AP4_MPEG2_TS_DEFAULT_STREAM_ID_VIDEO?0:(data_size+pes_header_size-6), 16); // PES_packet_length
pes_header.Write(2, 2); // '01'
pes_header.Write(0, 2); // PES_scrambling_control
pes_header.Write(0, 1); // PES_priority
pes_header.Write(1, 1); // data_alignment_indicator
pes_header.Write(0, 1); // copyright
pes_header.Write(0, 1); // original_or_copy
- pes_header.Write(with_dts ? 3 : 2, 2); // PTS_DTS_flags
+ pes_header.Write(with_dts?3:2, 2); // PTS_DTS_flags
pes_header.Write(0, 1); // ESCR_flag
pes_header.Write(0, 1); // ES_rate_flag
pes_header.Write(0, 1); // DSM_trick_mode_flag
pes_header.Write(0, 1); // additional_copy_info_flag
pes_header.Write(0, 1); // PES_CRC_flag
pes_header.Write(0, 1); // PES_extension_flag
- pes_header.Write(pes_header_size - 9, 8); // PES_header_data_length
-
- pes_header.Write(with_dts ? 3 : 2, 4); // '0010' or '0011'
- pes_header.Write((AP4_UI32)(pts >> 30), 3); // PTS[32..30]
+ pes_header.Write(pes_header_size-9, 8);// PES_header_data_length
+
+ pes_header.Write(with_dts?3:2, 4); // '0010' or '0011'
+ pes_header.Write((AP4_UI32)(pts>>30), 3); // PTS[32..30]
pes_header.Write(1, 1); // marker_bit
- pes_header.Write((AP4_UI32)(pts >> 15), 15); // PTS[29..15]
+ pes_header.Write((AP4_UI32)(pts>>15), 15); // PTS[29..15]
pes_header.Write(1, 1); // marker_bit
pes_header.Write((AP4_UI32)pts, 15); // PTS[14..0]
pes_header.Write(1, 1); // market_bit
-
- if(with_dts)
- {
+
+ if (with_dts) {
pes_header.Write(1, 4); // '0001'
- pes_header.Write((AP4_UI32)(dts >> 30), 3); // DTS[32..30]
+ pes_header.Write((AP4_UI32)(dts>>30), 3); // DTS[32..30]
pes_header.Write(1, 1); // marker_bit
- pes_header.Write((AP4_UI32)(dts >> 15), 15); // DTS[29..15]
+ pes_header.Write((AP4_UI32)(dts>>15), 15); // DTS[29..15]
pes_header.Write(1, 1); // marker_bit
pes_header.Write((AP4_UI32)dts, 15); // DTS[14..0]
pes_header.Write(1, 1); // market_bit
}
-
+
bool first_packet = true;
data_size += pes_header_size; // add size of PES header
- while(data_size)
- {
+ while (data_size) {
unsigned int payload_size = data_size;
- if(payload_size > AP4_MPEG2TS_PACKET_PAYLOAD_SIZE) payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE;
-
- if(first_packet)
- {
- WritePacketHeader(first_packet, payload_size, with_pcr, (with_dts ? dts : pts) * 300, output);
+ if (payload_size > AP4_MPEG2TS_PACKET_PAYLOAD_SIZE) payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE;
+
+ if (first_packet) {
+ WritePacketHeader(first_packet, payload_size, with_pcr, (with_dts?dts:pts)*300, output);
first_packet = false;
output.Write(pes_header.GetData(), pes_header_size);
- output.Write(data, payload_size - pes_header_size);
- data += payload_size - pes_header_size;
- }
- else
- {
+ output.Write(data, payload_size-pes_header_size);
+ data += payload_size-pes_header_size;
+ } else {
WritePacketHeader(first_packet, payload_size, false, 0, output);
output.Write(data, payload_size);
data += payload_size;
}
data_size -= payload_size;
}
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Mpeg2TsAudioSampleStream
+---------------------------------------------------------------------*/
-class AP4_Mpeg2TsAudioSampleStream : public AP4_Mpeg2TsWriter::SampleStream
+class AP4_Mpeg2TsAudioSampleStream : public AP4_Mpeg2TsWriter::SampleStream
{
public:
- static AP4_Result Create(AP4_UI16 pid,
- AP4_UI32 timescale,
+ static AP4_Result Create(AP4_UI16 pid,
+ AP4_UI32 timescale,
AP4_Mpeg2TsWriter::SampleStream*& stream);
- AP4_Result WriteSample(AP4_Sample& sample,
+ AP4_Result WriteSample(AP4_Sample& sample,
AP4_SampleDescription* sample_description,
- bool with_pcr,
+ bool with_pcr,
AP4_ByteStream& output);
-
+
private:
- AP4_Mpeg2TsAudioSampleStream(AP4_UI16 pid, AP4_UI32 timescale) :
- AP4_Mpeg2TsWriter::SampleStream(pid,
- AP4_MPEG2_TS_DEFAULT_STREAM_ID_AUDIO,
- AP4_MPEG2_STREAM_TYPE_ISO_IEC_13818_7,
- timescale) {}
+ AP4_Mpeg2TsAudioSampleStream(AP4_UI16 pid, AP4_UI32 timescale) :
+ AP4_Mpeg2TsWriter::SampleStream(pid,
+ AP4_MPEG2_TS_DEFAULT_STREAM_ID_AUDIO,
+ AP4_MPEG2_STREAM_TYPE_ISO_IEC_13818_7,
+ timescale) {}
};
/*----------------------------------------------------------------------
| AP4_Mpeg2TsAudioSampleStream::Create
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_Mpeg2TsAudioSampleStream::Create(AP4_UI16 pid,
- AP4_UI32 timescale,
+AP4_Result
+AP4_Mpeg2TsAudioSampleStream::Create(AP4_UI16 pid,
+ AP4_UI32 timescale,
AP4_Mpeg2TsWriter::SampleStream*& stream)
{
stream = new AP4_Mpeg2TsAudioSampleStream(pid, timescale);
return AP4_SUCCESS;
}
-
+
/*----------------------------------------------------------------------
| AP4_Mpeg2TsAudioSampleStream::WriteSample
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Mpeg2TsAudioSampleStream::WriteSample(AP4_Sample& sample,
- AP4_SampleDescription* sample_description,
- bool with_pcr,
- AP4_ByteStream& output)
+AP4_Mpeg2TsAudioSampleStream::WriteSample(AP4_Sample& sample,
+ AP4_SampleDescription* sample_description,
+ bool with_pcr,
+ AP4_ByteStream& output)
{
// check the sample description
AP4_MpegAudioSampleDescription* audio_desc = AP4_DYNAMIC_CAST(AP4_MpegAudioSampleDescription, sample_description);
- if(audio_desc == NULL) return AP4_ERROR_NOT_SUPPORTED;
- if(audio_desc->GetMpeg4AudioObjectType() != AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC) return AP4_ERROR_NOT_SUPPORTED;
+ if (audio_desc == NULL) return AP4_ERROR_NOT_SUPPORTED;
+ if (audio_desc->GetMpeg4AudioObjectType() != AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC) return AP4_ERROR_NOT_SUPPORTED;
unsigned int sampling_frequency_index = GetSamplingFrequencyIndex(audio_desc->GetSampleRate());
unsigned int channel_configuration = audio_desc->GetChannelCount();
AP4_DataBuffer data;
- if(AP4_SUCCEEDED(sample.ReadData(data)))
- {
+ if (AP4_SUCCEEDED(sample.ReadData(data))) {
unsigned char* buffer = new unsigned char[7+sample.GetSize()];
MakeAdtsHeader(buffer, sample.GetSize(), sampling_frequency_index, channel_configuration);
- AP4_CopyMemory(buffer + 7, data.GetData(), data.GetDataSize());
+ AP4_CopyMemory(buffer+7, data.GetData(), data.GetDataSize());
AP4_UI64 ts = AP4_ConvertTime(sample.GetDts(), m_TimeScale, 90000);
- WritePES(buffer, 7 + sample.GetSize(), ts, false, ts, with_pcr, output);
+ WritePES(buffer, 7+sample.GetSize(), ts, false, ts, with_pcr, output);
delete[] buffer;
}
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Mpeg2TsVideoSampleStream
+---------------------------------------------------------------------*/
-class AP4_Mpeg2TsVideoSampleStream : public AP4_Mpeg2TsWriter::SampleStream
+class AP4_Mpeg2TsVideoSampleStream : public AP4_Mpeg2TsWriter::SampleStream
{
public:
- static AP4_Result Create(AP4_UI16 pid,
- AP4_UI32 timescale,
+ static AP4_Result Create(AP4_UI16 pid,
+ AP4_UI32 timescale,
AP4_Mpeg2TsWriter::SampleStream*& stream);
- AP4_Result WriteSample(AP4_Sample& sample,
+ AP4_Result WriteSample(AP4_Sample& sample,
AP4_SampleDescription* sample_description,
- bool with_pcr,
+ bool with_pcr,
AP4_ByteStream& output);
-
+
private:
AP4_Mpeg2TsVideoSampleStream(AP4_UI16 pid, AP4_UI32 timescale) :
- AP4_Mpeg2TsWriter::SampleStream(pid,
- AP4_MPEG2_TS_DEFAULT_STREAM_ID_VIDEO,
+ AP4_Mpeg2TsWriter::SampleStream(pid,
+ AP4_MPEG2_TS_DEFAULT_STREAM_ID_VIDEO,
AP4_MPEG2_STREAM_TYPE_AVC,
timescale),
- m_SampleDescriptionIndex(-1),
- m_NaluLengthSize(0) {}
-
+ m_SampleDescriptionIndex(-1),
+ m_NaluLengthSize(0) {}
+
int m_SampleDescriptionIndex;
AP4_DataBuffer m_Prefix;
unsigned int m_NaluLengthSize;
@@ -467,12 +434,12 @@ private:
| AP4_Mpeg2TsVideoSampleStream::AP4_Mpeg2TsVideoSampleStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Mpeg2TsVideoSampleStream::Create(AP4_UI16 pid,
- AP4_UI32 timescale,
+AP4_Mpeg2TsVideoSampleStream::Create(AP4_UI16 pid,
+ AP4_UI32 timescale,
AP4_Mpeg2TsWriter::SampleStream*& stream)
{
// create the stream object
- stream = new AP4_Mpeg2TsVideoSampleStream(pid, timescale);
+ stream = new AP4_Mpeg2TsVideoSampleStream(pid, timescale);
return AP4_SUCCESS;
}
@@ -480,40 +447,37 @@ AP4_Mpeg2TsVideoSampleStream::Create(AP4_UI16 pid,
| AP4_Mpeg2TsVideoSampleStream::WriteSample
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Mpeg2TsVideoSampleStream::WriteSample(AP4_Sample& sample,
- AP4_SampleDescription* sample_description,
- bool with_pcr,
- AP4_ByteStream& output)
+AP4_Mpeg2TsVideoSampleStream::WriteSample(AP4_Sample& sample,
+ AP4_SampleDescription* sample_description,
+ bool with_pcr,
+ AP4_ByteStream& output)
{
// check the sample description
AP4_AvcSampleDescription* avc_desc = AP4_DYNAMIC_CAST(AP4_AvcSampleDescription, sample_description);
- if(avc_desc == NULL) return AP4_ERROR_NOT_SUPPORTED;
-
- if((int)sample.GetDescriptionIndex() != m_SampleDescriptionIndex)
- {
+ if (avc_desc == NULL) return AP4_ERROR_NOT_SUPPORTED;
+
+ if ((int)sample.GetDescriptionIndex() != m_SampleDescriptionIndex) {
m_SampleDescriptionIndex = sample.GetDescriptionIndex();
// make the SPS/PPS prefix
m_NaluLengthSize = avc_desc->GetNaluLengthSize();
m_Prefix.SetDataSize(0);
- for(unsigned int i = 0; i < avc_desc->GetSequenceParameters().ItemCount(); i++)
- {
+ for (unsigned int i=0; i<avc_desc->GetSequenceParameters().ItemCount(); i++) {
AP4_DataBuffer& buffer = avc_desc->GetSequenceParameters()[i];
unsigned int prefix_size = m_Prefix.GetDataSize();
- m_Prefix.SetDataSize(prefix_size + 4 + buffer.GetDataSize());
- unsigned char* p = m_Prefix.UseData() + prefix_size;
+ m_Prefix.SetDataSize(prefix_size+4+buffer.GetDataSize());
+ unsigned char* p = m_Prefix.UseData()+prefix_size;
*p++ = 0;
*p++ = 0;
*p++ = 0;
*p++ = 1;
AP4_CopyMemory(p, buffer.GetData(), buffer.GetDataSize());
}
- for(unsigned int i = 0; i < avc_desc->GetPictureParameters().ItemCount(); i++)
- {
+ for (unsigned int i=0; i<avc_desc->GetPictureParameters().ItemCount(); i++) {
AP4_DataBuffer& buffer = avc_desc->GetPictureParameters()[i];
unsigned int prefix_size = m_Prefix.GetDataSize();
- m_Prefix.SetDataSize(prefix_size + 4 + buffer.GetDataSize());
- unsigned char* p = m_Prefix.UseData() + prefix_size;
+ m_Prefix.SetDataSize(prefix_size+4+buffer.GetDataSize());
+ unsigned char* p = m_Prefix.UseData()+prefix_size;
*p++ = 0;
*p++ = 0;
*p++ = 0;
@@ -521,16 +485,16 @@ AP4_Mpeg2TsVideoSampleStream::WriteSample(AP4_Sample& sample,
AP4_CopyMemory(p, buffer.GetData(), buffer.GetDataSize());
}
}
-
+
// read the sample data
AP4_DataBuffer sample_data;
AP4_CHECK(sample.ReadData(sample_data));
-
+
// allocate a buffer for the PES packet
AP4_DataBuffer pes_data;
- pes_data.SetDataSize(6 + m_Prefix.GetDataSize());
+ pes_data.SetDataSize(6+m_Prefix.GetDataSize());
unsigned char* pes_buffer = pes_data.UseData();
-
+
// start of access unit
pes_buffer[0] = 0;
pes_buffer[1] = 0;
@@ -538,62 +502,54 @@ AP4_Mpeg2TsVideoSampleStream::WriteSample(AP4_Sample& sample,
pes_buffer[3] = 1;
pes_buffer[4] = 9; // NAL type = Access Unit Delimiter;
pes_buffer[5] = 0xE0; // Slice types = ANY
-
+
// copy the prefix
- AP4_CopyMemory(pes_buffer + 6, m_Prefix.GetData(), m_Prefix.GetDataSize());
-
+ AP4_CopyMemory(pes_buffer+6, m_Prefix.GetData(), m_Prefix.GetDataSize());
+
// write the NAL units
const unsigned char* data = sample_data.GetData();
unsigned int data_size = sample_data.GetDataSize();
-
- while(data_size)
- {
+
+ while (data_size) {
// sanity check
- if(data_size < m_NaluLengthSize) break;
-
+ if (data_size < m_NaluLengthSize) break;
+
// get the next NAL unit
AP4_UI32 nalu_size;
- if(m_NaluLengthSize == 1)
- {
+ if (m_NaluLengthSize == 1) {
nalu_size = *data++;
data_size--;
- }
- else if(m_NaluLengthSize == 2)
- {
+ } else if (m_NaluLengthSize == 2) {
nalu_size = AP4_BytesToInt16BE(data);
data += 2;
data_size -= 2;
- }
- else if(m_NaluLengthSize == 4)
- {
+ } else if (m_NaluLengthSize == 4) {
nalu_size = AP4_BytesToInt32BE(data);
data += 4;
data_size -= 4;
- }
- else
- {
+ } else {
break;
}
- if(nalu_size > data_size) break;
-
+ if (nalu_size > data_size) break;
+
// add a start code before the NAL unit
- unsigned int offset = pes_data.GetDataSize();
- pes_data.SetDataSize(offset + 3 + nalu_size);
- pes_buffer = pes_data.UseData() + offset;
+ unsigned int offset = pes_data.GetDataSize();
+ pes_data.SetDataSize(offset+3+nalu_size);
+ pes_buffer = pes_data.UseData()+offset;
pes_buffer[0] = 0;
pes_buffer[1] = 0;
pes_buffer[2] = 1;
- AP4_CopyMemory(pes_buffer + 3, data, nalu_size);
-
+ AP4_CopyMemory(pes_buffer+3, data, nalu_size);
+
// move to the next NAL unit
data += nalu_size;
data_size -= nalu_size;
- }
-
+ }
+
// compute the timestamp
AP4_UI64 dts = AP4_ConvertTime(sample.GetDts(), m_TimeScale, 90000);
AP4_UI64 pts = AP4_ConvertTime(sample.GetCts(), m_TimeScale, 90000);
-
+
// write the packet
return WritePES(pes_data.GetData(), pes_data.GetDataSize(), dts, true, pts, with_pcr, output);
}
@@ -629,9 +585,9 @@ AP4_Mpeg2TsWriter::WritePAT(AP4_ByteStream& output)
{
unsigned int payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE;
m_PAT->WritePacketHeader(true, payload_size, false, 0, output);
-
+
AP4_BitWriter writer(1024);
-
+
writer.Write(0, 8); // pointer
writer.Write(0, 8); // table_id
writer.Write(1, 1); // section_syntax_indicator
@@ -647,12 +603,12 @@ AP4_Mpeg2TsWriter::WritePAT(AP4_ByteStream& output)
writer.Write(1, 16); // program number
writer.Write(7, 3); // reserved
writer.Write(m_PMT->GetPID(), 13); // program_map_PID
- writer.Write(ComputeCRC(writer.GetData() + 1, 17 - 1 - 4), 32);
-
+ writer.Write(ComputeCRC(writer.GetData()+1, 17-1-4), 32);
+
output.Write(writer.GetData(), 17);
-
- output.Write(StuffingBytes, AP4_MPEG2TS_PACKET_PAYLOAD_SIZE - 17);
-
+
+ output.Write(StuffingBytes, AP4_MPEG2TS_PACKET_PAYLOAD_SIZE-17);
+
return AP4_SUCCESS;
}
@@ -663,25 +619,22 @@ AP4_Result
AP4_Mpeg2TsWriter::WritePMT(AP4_ByteStream& output)
{
// check that we have at least one media stream
- if(m_Audio == NULL && m_Video == NULL)
- {
+ if (m_Audio == NULL && m_Video == NULL) {
return AP4_ERROR_INVALID_STATE;
}
-
+
unsigned int payload_size = AP4_MPEG2TS_PACKET_PAYLOAD_SIZE;
m_PMT->WritePacketHeader(true, payload_size, false, 0, output);
-
+
AP4_BitWriter writer(1024);
-
+
unsigned int section_length = 13;
unsigned int pcr_pid = 0;
- if(m_Audio)
- {
+ if (m_Audio) {
section_length += 5;
pcr_pid = m_Audio->GetPID();
- }
- if(m_Video)
- {
+ }
+ if (m_Video) {
section_length += 5;
pcr_pid = m_Video->GetPID();
}
@@ -702,46 +655,44 @@ AP4_Mpeg2TsWriter::WritePMT(AP4_ByteStream& output)
writer.Write(pcr_pid, 13); // PCD_PID
writer.Write(0xF, 4); // reserved
writer.Write(0, 12); // program_info_length
-
- if(m_Audio)
- {
- writer.Write(m_Audio->m_StreamType, 8); // stream_type
+
+ if (m_Audio) {
+ writer.Write(m_Audio->m_StreamType, 8); // stream_type
writer.Write(0x7, 3); // reserved
writer.Write(m_Audio->GetPID(), 13); // elementary_PID
writer.Write(0xF, 4); // reserved
writer.Write(0, 12); // ES_info_length
}
-
- if(m_Video)
- {
+
+ if (m_Video) {
writer.Write(m_Video->m_StreamType, 8); // stream_type
writer.Write(0x7, 3); // reserved
writer.Write(m_Video->GetPID(), 13); // elementary_PID
writer.Write(0xF, 4); // reserved
writer.Write(0, 12); // ES_info_length
}
-
- writer.Write(ComputeCRC(writer.GetData() + 1, section_length - 1), 32); // CRC
-
- output.Write(writer.GetData(), section_length + 4);
- output.Write(StuffingBytes, AP4_MPEG2TS_PACKET_PAYLOAD_SIZE - (section_length + 4));
-
+
+ writer.Write(ComputeCRC(writer.GetData()+1, section_length-1), 32); // CRC
+
+ output.Write(writer.GetData(), section_length+4);
+ output.Write(StuffingBytes, AP4_MPEG2TS_PACKET_PAYLOAD_SIZE-(section_length+4));
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Mpeg2TsWriter::SetAudioStream
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Mpeg2TsWriter::SetAudioStream(AP4_UI32 timescale, SampleStream*& stream)
{
// default
stream = NULL;
-
+
AP4_Result result = AP4_Mpeg2TsAudioSampleStream::Create(AP4_MPEG2_TS_DEFAULT_PID_AUDIO,
- timescale,
- m_Audio);
- if(AP4_FAILED(result)) return result;
+ timescale,
+ m_Audio);
+ if (AP4_FAILED(result)) return result;
stream = m_Audio;
return AP4_SUCCESS;
}
@@ -749,16 +700,16 @@ AP4_Mpeg2TsWriter::SetAudioStream(AP4_UI32 timescale, SampleStream*& stream)
/*----------------------------------------------------------------------
| AP4_Mpeg2TsWriter::SetVideoStream
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Mpeg2TsWriter::SetVideoStream(AP4_UI32 timescale, SampleStream*& stream)
{
// default
stream = NULL;
-
- AP4_Result result = AP4_Mpeg2TsVideoSampleStream::Create(AP4_MPEG2_TS_DEFAULT_PID_VIDEO,
- timescale,
- m_Video);
- if(AP4_FAILED(result)) return result;
+
+ AP4_Result result = AP4_Mpeg2TsVideoSampleStream::Create(AP4_MPEG2_TS_DEFAULT_PID_VIDEO,
+ timescale,
+ m_Video);
+ if (AP4_FAILED(result)) return result;
stream = m_Video;
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.h
index c0173aa78..0f898b952 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Mpeg2Ts.h
@@ -57,7 +57,7 @@ const AP4_UI08 AP4_MPEG2_STREAM_TYPE_AVC = 0x1B;
| AP4_Mpeg2TsWriter
+---------------------------------------------------------------------*/
/**
- * This class is a simple implementation of a converter that can
+ * This class is a simple implementation of a converter that can
* convert MP4 audio and video access units into an MPEG2 transport
* stream.
* It currently only supports one audio tracks with MPEG4 AAC LC, and one
@@ -67,70 +67,59 @@ class AP4_Mpeg2TsWriter
{
public:
// classes
- class Stream
- {
+ class Stream {
public:
Stream(AP4_UI16 pid) : m_PID(pid), m_ContinuityCounter(0) {}
virtual ~Stream() {}
-
- AP4_UI16 GetPID()
- {
- return m_PID;
- }
- void WritePacketHeader(bool payload_start,
+
+ AP4_UI16 GetPID() { return m_PID; }
+ void WritePacketHeader(bool payload_start,
unsigned int& payload_size,
bool with_pcr,
AP4_UI64 pcr,
AP4_ByteStream& output);
-
+
private:
unsigned int m_PID;
unsigned int m_ContinuityCounter;
};
-
- class SampleStream : public Stream
- {
+
+ class SampleStream : public Stream {
public:
SampleStream(AP4_UI16 pid, AP4_UI16 stream_id, AP4_UI08 stream_type, AP4_UI32 timescale) :
- Stream(pid),
+ Stream(pid),
m_StreamId(stream_id),
m_StreamType(stream_type),
m_TimeScale(timescale) {}
-
- virtual AP4_Result WritePES(const unsigned char* data,
- unsigned int data_size,
- AP4_UI64 dts,
- bool with_dts,
- AP4_UI64 pts,
- bool with_pcr,
+
+ virtual AP4_Result WritePES(const unsigned char* data,
+ unsigned int data_size,
+ AP4_UI64 dts,
+ bool with_dts,
+ AP4_UI64 pts,
+ bool with_pcr,
AP4_ByteStream& output);
- virtual AP4_Result WriteSample(AP4_Sample& sample,
+ virtual AP4_Result WriteSample(AP4_Sample& sample,
AP4_SampleDescription* sample_description,
- bool with_pcr,
+ bool with_pcr,
AP4_ByteStream& output) = 0;
-
+
unsigned int m_StreamId;
AP4_UI08 m_StreamType;
AP4_UI32 m_TimeScale;
};
-
+
// constructor
AP4_Mpeg2TsWriter();
~AP4_Mpeg2TsWriter();
-
- Stream* GetPAT()
- {
- return m_PAT;
- }
- Stream* GetPMT()
- {
- return m_PMT;
- }
+
+ Stream* GetPAT() { return m_PAT; }
+ Stream* GetPMT() { return m_PMT; }
AP4_Result WritePAT(AP4_ByteStream& output);
AP4_Result WritePMT(AP4_ByteStream& output);
AP4_Result SetAudioStream(AP4_UI32 timescale, SampleStream*& stream);
AP4_Result SetVideoStream(AP4_UI32 timescale, SampleStream*& stream);
-
+
private:
Stream* m_PAT;
Stream* m_PMT;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.cpp
index 66fd9f82a..3a4e3059a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mvhd Atoms
+| AP4 - mvhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_MvhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 1) return NULL;
return new AP4_MvhdAtom(size, version, flags, stream);
}
@@ -60,7 +60,7 @@ AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 creation_time,
AP4_UI32 duration,
AP4_UI32 rate,
AP4_UI16 volume) :
- AP4_Atom(AP4_ATOM_TYPE_MVHD, AP4_FULL_ATOM_HEADER_SIZE + 96, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, AP4_FULL_ATOM_HEADER_SIZE+96, 0, 0),
m_CreationTime(creation_time),
m_ModificationTime(modification_time),
m_TimeScale(time_scale),
@@ -87,14 +87,13 @@ AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 creation_time,
/*----------------------------------------------------------------------
| AP4_MvhdAtom::AP4_MvhdAtom
+---------------------------------------------------------------------*/
-AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 size,
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_MVHD, size, version, flags)
{
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
AP4_UI32 creation_time;
stream.ReadUI32(creation_time);
m_CreationTime = creation_time;
@@ -105,9 +104,7 @@ AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 size,
AP4_UI32 duration;
stream.ReadUI32(duration);
m_Duration = duration;
- }
- else
- {
+ } else {
stream.ReadUI64(m_CreationTime);
stream.ReadUI64(m_ModificationTime);
stream.ReadUI32(m_TimeScale);
@@ -118,8 +115,7 @@ AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 size,
stream.ReadUI16(m_Volume);
stream.Read(m_Reserved1, sizeof(m_Reserved1));
stream.Read(m_Reserved2, sizeof(m_Reserved2));
- for(int i = 0; i < 9; i++)
- {
+ for (int i=0; i<9; i++) {
stream.ReadUI32(m_Matrix[i]);
}
stream.Read(m_Predefined, sizeof(m_Predefined));
@@ -133,51 +129,47 @@ AP4_Result
AP4_MvhdAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
- if(m_Version == 0)
- {
+
+ if (m_Version == 0) {
result = stream.WriteUI32((AP4_UI32)m_CreationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TimeScale);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_Duration);
- }
- else
- {
+ } else {
result = stream.WriteUI64(m_CreationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_ModificationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TimeScale);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_Duration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// rate & volume
result = stream.WriteUI32(m_Rate);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_Volume);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// reserved
result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// matrix
- for(int i = 0; i < 9; i++)
- {
+ for (int i=0; i<9; i++) {
result = stream.WriteUI32(m_Matrix[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// pre-defined
result = stream.Write(m_Predefined, sizeof(m_Predefined));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// next track id
return stream.WriteUI32(m_NextTrackId);
@@ -189,12 +181,9 @@ AP4_MvhdAtom::WriteFields(AP4_ByteStream& stream)
AP4_UI32
AP4_MvhdAtom::GetDurationMs()
{
- if(m_TimeScale)
- {
+ if (m_TimeScale) {
return (AP4_UI32)AP4_ConvertTime(m_Duration, m_TimeScale, 1000);
- }
- else
- {
+ } else {
return 0;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.h
index 1c8bf6c83..b3d4de11d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4MvhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - mvhd Atoms
+| AP4 - mvhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -55,31 +55,21 @@ public:
AP4_UI16 volume);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI64 GetDuration()
- {
- return m_Duration;
- }
- void SetDuration(AP4_UI64 duration)
- {
- m_Duration = duration;
- }
+ AP4_UI64 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI64 duration) { m_Duration = duration;}
AP4_UI32 GetDurationMs();
- AP4_UI32 GetTimeScale()
- {
- return m_TimeScale;
- }
- AP4_Result SetTimeScale(AP4_UI32 time_scale)
- {
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ AP4_Result SetTimeScale(AP4_UI32 time_scale) {
m_TimeScale = time_scale;
return AP4_SUCCESS;
}
private:
// methods
- AP4_MvhdAtom(AP4_UI32 size,
+ AP4_MvhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
- AP4_ByteStream& stream);
+ AP4_ByteStream& stream);
// members
AP4_UI64 m_CreationTime;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.cpp
index aba085197..d6a660962 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - nmhd Atoms
+| AP4 - nmhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,8 +41,8 @@ AP4_NmhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_NmhdAtom(size, version, flags, stream);
}
@@ -57,7 +57,7 @@ AP4_NmhdAtom::AP4_NmhdAtom() :
/*----------------------------------------------------------------------
| AP4_NmhdAtom::AP4_NmhdAtom
+---------------------------------------------------------------------*/
-AP4_NmhdAtom::AP4_NmhdAtom(AP4_UI32 size,
+AP4_NmhdAtom::AP4_NmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& /* stream */) :
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.h
index f566db625..8c2efd336 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4NmhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - nmhd Atoms
+| AP4 - nmhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -49,7 +49,7 @@ public:
private:
// methods
- AP4_NmhdAtom(AP4_UI32 size,
+ AP4_NmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.cpp
index a3a73f023..1b74261d9 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.cpp
@@ -44,8 +44,8 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_DescriptorUpdateCommand)
| AP4_ObjectDescriptor::AP4_ObjectDescriptor
+---------------------------------------------------------------------*/
AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_UI08 tag,
- AP4_Size header_size,
- AP4_Size payload_size) :
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_Descriptor(tag, header_size, payload_size),
m_UrlFlag(false)
{
@@ -55,7 +55,7 @@ AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_UI08 tag,
| AP4_ObjectDescriptor::AP4_ObjectDescriptor
+---------------------------------------------------------------------*/
AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_UI08 tag, AP4_UI16 id) :
- AP4_Descriptor(tag, 3, 2),
+ AP4_Descriptor(tag, 3, 2),
m_ObjectDescriptorId(id),
m_UrlFlag(false)
{
@@ -64,10 +64,10 @@ AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_UI08 tag, AP4_UI16 id) :
/*----------------------------------------------------------------------
| AP4_ObjectDescriptor::AP4_ObjectDescriptor
+---------------------------------------------------------------------*/
-AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_ByteStream& stream,
- AP4_UI08 tag,
- AP4_Size header_size,
- AP4_Size payload_size) :
+AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_ByteStream& stream,
+ AP4_UI08 tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_Descriptor(tag, header_size, payload_size)
{
AP4_Position start;
@@ -76,11 +76,10 @@ AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_ByteStream& stream,
// read descriptor fields
unsigned short bits;
stream.ReadUI16(bits);
- m_ObjectDescriptorId = (bits >> 6);
- m_UrlFlag = ((bits & (1 << 5)) != 0);
-
- if(m_UrlFlag)
- {
+ m_ObjectDescriptorId = (bits>>6);
+ m_UrlFlag = ((bits&(1<<5))!=0);
+
+ if (m_UrlFlag) {
unsigned char url_length;
stream.ReadUI08(url_length);
char url[256];
@@ -92,13 +91,12 @@ AP4_ObjectDescriptor::AP4_ObjectDescriptor(AP4_ByteStream& stream,
// read other descriptors
AP4_Position offset;
stream.Tell(offset);
- AP4_SubStream* substream = new AP4_SubStream(stream, offset,
- payload_size - AP4_Size(offset - start));
+ AP4_SubStream* substream = new AP4_SubStream(stream, offset,
+ payload_size-AP4_Size(offset-start));
AP4_Descriptor* descriptor = NULL;
- while(AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
- descriptor)
- == AP4_SUCCESS)
- {
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
m_SubDescriptors.Add(descriptor);
}
substream->Release();
@@ -115,13 +113,13 @@ AP4_ObjectDescriptor::~AP4_ObjectDescriptor()
/*----------------------------------------------------------------------
| AP4_ObjectDescriptor::FindSubDescriptor
+---------------------------------------------------------------------*/
-AP4_Descriptor*
+AP4_Descriptor*
AP4_ObjectDescriptor::FindSubDescriptor(AP4_UI08 tag) const
{
AP4_Descriptor* descriptor = NULL;
AP4_Result result = m_SubDescriptors.Find(AP4_DescriptorFinder(tag), descriptor);
- if(AP4_FAILED(result)) return NULL;
-
+ if (AP4_FAILED(result)) return NULL;
+
return descriptor;
}
@@ -134,17 +132,16 @@ AP4_ObjectDescriptor::WriteFields(AP4_ByteStream& stream)
AP4_Result result;
// id and flag
- unsigned short bits = (m_ObjectDescriptorId << 6) | (m_UrlFlag ? (1 << 5) : 0) | 0x1F;
+ unsigned short bits = (m_ObjectDescriptorId<<6)|(m_UrlFlag?(1<<5):0)|0x1F;
result = stream.WriteUI16(bits);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// optional url
- if(m_UrlFlag)
- {
+ if (m_UrlFlag) {
stream.WriteUI08((AP4_UI08)m_Url.GetLength());
stream.Write(m_Url.GetChars(), m_Url.GetLength());
}
-
+
// write the sub descriptors
m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
@@ -158,15 +155,14 @@ AP4_Result
AP4_ObjectDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[ObjectDescriptor]", info);
inspector.AddField("id", m_ObjectDescriptorId);
- if(m_UrlFlag)
- {
+ if (m_UrlFlag) {
inspector.AddField("url", m_Url.GetChars());
}
-
+
// inspect children
m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
@@ -187,8 +183,8 @@ AP4_ObjectDescriptor::AddSubDescriptor(AP4_Descriptor* descriptor)
// check that the header is still large enough to encode the payload
// length
unsigned int min_header_size = MinHeaderSize(m_PayloadSize);
- if(min_header_size > m_HeaderSize) m_HeaderSize = min_header_size;
-
+ if (min_header_size > m_HeaderSize) m_HeaderSize = min_header_size;
+
return AP4_SUCCESS;
}
@@ -218,10 +214,10 @@ AP4_InitialObjectDescriptor::AP4_InitialObjectDescriptor(
/*----------------------------------------------------------------------
| AP4_InitialObjectDescriptor::AP4_InitialObjectDescriptor
+---------------------------------------------------------------------*/
-AP4_InitialObjectDescriptor::AP4_InitialObjectDescriptor(AP4_ByteStream& stream,
- AP4_UI08 tag,
- AP4_Size header_size,
- AP4_Size payload_size) :
+AP4_InitialObjectDescriptor::AP4_InitialObjectDescriptor(AP4_ByteStream& stream,
+ AP4_UI08 tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
AP4_ObjectDescriptor(tag, header_size, payload_size),
m_OdProfileLevelIndication(0),
m_SceneProfileLevelIndication(0),
@@ -235,38 +231,34 @@ AP4_InitialObjectDescriptor::AP4_InitialObjectDescriptor(AP4_ByteStream& stream,
// read descriptor fields
unsigned short bits;
stream.ReadUI16(bits);
- m_ObjectDescriptorId = (bits >> 6);
- m_UrlFlag = ((bits & (1 << 5)) != 0);
- m_IncludeInlineProfileLevelFlag = ((bits & (1 << 4)) != 0);
-
- if(m_UrlFlag)
- {
+ m_ObjectDescriptorId = (bits>>6);
+ m_UrlFlag = ((bits&(1<<5))!=0);
+ m_IncludeInlineProfileLevelFlag = ((bits&(1<<4))!=0);
+
+ if (m_UrlFlag) {
unsigned char url_length;
stream.ReadUI08(url_length);
char url[256];
stream.Read(url, url_length);
url[url_length] = '\0';
m_Url = url;
+ } else {
+ stream.ReadUI08(m_OdProfileLevelIndication);
+ stream.ReadUI08(m_SceneProfileLevelIndication);
+ stream.ReadUI08(m_AudioProfileLevelIndication);
+ stream.ReadUI08(m_VisualProfileLevelIndication);
+ stream.ReadUI08(m_GraphicsProfileLevelIndication);
}
- else
- {
- stream.ReadUI08(m_OdProfileLevelIndication);
- stream.ReadUI08(m_SceneProfileLevelIndication);
- stream.ReadUI08(m_AudioProfileLevelIndication);
- stream.ReadUI08(m_VisualProfileLevelIndication);
- stream.ReadUI08(m_GraphicsProfileLevelIndication);
- }
-
+
// read other descriptors
AP4_Position offset;
stream.Tell(offset);
- AP4_SubStream* substream = new AP4_SubStream(stream, offset,
- payload_size - AP4_Size(offset - start));
+ AP4_SubStream* substream = new AP4_SubStream(stream, offset,
+ payload_size-AP4_Size(offset-start));
AP4_Descriptor* descriptor = NULL;
- while(AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
- descriptor)
- == AP4_SUCCESS)
- {
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
m_SubDescriptors.Add(descriptor);
}
substream->Release();
@@ -281,28 +273,25 @@ AP4_InitialObjectDescriptor::WriteFields(AP4_ByteStream& stream)
AP4_Result result;
// id and flags
- unsigned short bits = (m_ObjectDescriptorId << 6) |
- (m_UrlFlag ? (1 << 5) : 0) |
- (m_IncludeInlineProfileLevelFlag ? (1 << 4) : 0) |
+ unsigned short bits = (m_ObjectDescriptorId<<6) |
+ (m_UrlFlag?(1<<5):0) |
+ (m_IncludeInlineProfileLevelFlag?(1<<4):0)|
0xF;
result = stream.WriteUI16(bits);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// optional url
- if(m_UrlFlag)
- {
+ if (m_UrlFlag) {
stream.WriteUI08((AP4_UI08)m_Url.GetLength());
stream.Write(m_Url.GetChars(), m_Url.GetLength());
+ } else {
+ stream.WriteUI08(m_OdProfileLevelIndication);
+ stream.WriteUI08(m_SceneProfileLevelIndication);
+ stream.WriteUI08(m_AudioProfileLevelIndication);
+ stream.WriteUI08(m_VisualProfileLevelIndication);
+ stream.WriteUI08(m_GraphicsProfileLevelIndication);
}
- else
- {
- stream.WriteUI08(m_OdProfileLevelIndication);
- stream.WriteUI08(m_SceneProfileLevelIndication);
- stream.WriteUI08(m_AudioProfileLevelIndication);
- stream.WriteUI08(m_VisualProfileLevelIndication);
- stream.WriteUI08(m_GraphicsProfileLevelIndication);
- }
-
+
// write the sub descriptors
m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
@@ -316,26 +305,23 @@ AP4_Result
AP4_InitialObjectDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
inspector.StartElement("[InitialObjectDescriptor]", info);
inspector.AddField("id", m_ObjectDescriptorId);
- if(m_UrlFlag)
- {
+ if (m_UrlFlag) {
inspector.AddField("url", m_Url.GetChars());
- }
- else
- {
- inspector.AddField("include inline profile level flag",
- m_IncludeInlineProfileLevelFlag,
+ } else {
+ inspector.AddField("include inline profile level flag",
+ m_IncludeInlineProfileLevelFlag,
AP4_AtomInspector::HINT_BOOLEAN);
- inspector.AddField("OD profile level", m_OdProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
- inspector.AddField("scene profile level", m_SceneProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
- inspector.AddField("audio profile level", m_AudioProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
- inspector.AddField("visual profile level", m_VisualProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
- inspector.AddField("graphics profile level", m_GraphicsProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
+ inspector.AddField("OD profile level", m_OdProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
+ inspector.AddField("scene profile level", m_SceneProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
+ inspector.AddField("audio profile level", m_AudioProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
+ inspector.AddField("visual profile level", m_VisualProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
+ inspector.AddField("graphics profile level", m_GraphicsProfileLevelIndication, AP4_AtomInspector::HINT_HEX);
}
-
+
// inspect children
m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
@@ -356,7 +342,7 @@ AP4_DescriptorUpdateCommand::AP4_DescriptorUpdateCommand(AP4_UI08 tag) :
| AP4_DescriptorUpdateCommand::AP4_DescriptorUpdateCommand
+---------------------------------------------------------------------*/
AP4_DescriptorUpdateCommand::AP4_DescriptorUpdateCommand(
- AP4_ByteStream& stream,
+ AP4_ByteStream& stream,
AP4_UI08 tag,
AP4_Size header_size,
AP4_Size payload_size) :
@@ -365,11 +351,10 @@ AP4_DescriptorUpdateCommand::AP4_DescriptorUpdateCommand(
// read the descriptors
AP4_Position offset;
stream.Tell(offset);
- AP4_SubStream* substream = new AP4_SubStream(stream, offset,
- payload_size);
+ AP4_SubStream* substream = new AP4_SubStream(stream, offset,
+ payload_size);
AP4_Descriptor* descriptor = NULL;
- while(AP4_DescriptorFactory::CreateDescriptorFromStream(*substream, descriptor) == AP4_SUCCESS)
- {
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream, descriptor) == AP4_SUCCESS) {
m_Descriptors.Add(descriptor);
}
substream->Release();
@@ -402,23 +387,22 @@ AP4_Result
AP4_DescriptorUpdateCommand::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
- AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
- GetHeaderSize(), m_PayloadSize);
- switch(GetTag())
- {
- case AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE:
- inspector.StartElement("[ObjectDescriptorUpdate]", info);
- break;
-
- case AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE:
- inspector.StartElement("[IPMP_DescriptorUpdate]", info);
- break;
-
- default:
- inspector.StartElement("[DescriptorUpdate]", info);
- break;
+ AP4_FormatString(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
+ switch (GetTag()) {
+ case AP4_COMMAND_TAG_OBJECT_DESCRIPTOR_UPDATE:
+ inspector.StartElement("[ObjectDescriptorUpdate]", info);
+ break;
+
+ case AP4_COMMAND_TAG_IPMP_DESCRIPTOR_UPDATE:
+ inspector.StartElement("[IPMP_DescriptorUpdate]", info);
+ break;
+
+ default:
+ inspector.StartElement("[DescriptorUpdate]", info);
+ break;
}
-
+
// inspect children
m_Descriptors.Apply(AP4_DescriptorListInspector(inspector));
@@ -439,7 +423,7 @@ AP4_DescriptorUpdateCommand::AddDescriptor(AP4_Descriptor* descriptor)
// check that the header is still large enough to encode the payload
// length
unsigned int min_header_size = MinHeaderSize(m_PayloadSize);
- if(min_header_size > m_HeaderSize) m_HeaderSize = min_header_size;
+ if (min_header_size > m_HeaderSize) m_HeaderSize = min_header_size;
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.h
index f71d0b8e5..8b29c609c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4ObjectDescriptor.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - Object Descriptor
+| AP4 - Object Descriptor
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -55,45 +55,36 @@ const AP4_UI08 AP4_DESCRIPTOR_TAG_MP4_IOD = 0x10;
+---------------------------------------------------------------------*/
class AP4_ObjectDescriptor : public AP4_Descriptor
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_ObjectDescriptor, AP4_Descriptor)
// methods
- AP4_ObjectDescriptor(AP4_ByteStream& stream,
+ AP4_ObjectDescriptor(AP4_ByteStream& stream,
AP4_UI08 tag,
- AP4_Size header_size,
+ AP4_Size header_size,
AP4_Size payload_size);
AP4_ObjectDescriptor(AP4_UI08 tag, AP4_UI16 id);
virtual ~AP4_ObjectDescriptor();
-
+
/**
- * Add a sub-descriptor.
+ * Add a sub-descriptor.
* Ownership of the sub-descriptor object is transfered.
- */
+ */
virtual AP4_Result AddSubDescriptor(AP4_Descriptor* descriptor);
-
+
virtual AP4_Descriptor* FindSubDescriptor(AP4_UI08 tag) const;
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
- AP4_UI16 GetObjectDescriptorId() const
- {
- return m_ObjectDescriptorId;
- }
- bool GetUrlFlag() const
- {
- return m_UrlFlag;
- }
- const AP4_String& GetUrl() const
- {
- return m_Url;
- }
+ AP4_UI16 GetObjectDescriptorId() const { return m_ObjectDescriptorId; }
+ bool GetUrlFlag() const { return m_UrlFlag; }
+ const AP4_String& GetUrl() const { return m_Url;}
-protected:
+ protected:
// constructor
AP4_ObjectDescriptor(AP4_UI08 tag, AP4_Size header_size, AP4_Size payload_size);
-
+
// members
AP4_UI16 m_ObjectDescriptorId;
bool m_UrlFlag;
@@ -106,11 +97,11 @@ protected:
+---------------------------------------------------------------------*/
class AP4_InitialObjectDescriptor : public AP4_ObjectDescriptor
{
-public:
+ public:
// methods
- AP4_InitialObjectDescriptor(AP4_ByteStream& stream,
+ AP4_InitialObjectDescriptor(AP4_ByteStream& stream,
AP4_UI08 tag,
- AP4_Size header_size,
+ AP4_Size header_size,
AP4_Size payload_size);
AP4_InitialObjectDescriptor(AP4_UI08 tag, // should be AP4_DESCRIPTOR_TAG_IOD or AP4_DESCRIPTOR_TAG_MP4_IOD
AP4_UI16 object_descriptor_id,
@@ -123,41 +114,23 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
-
+
// accessors
- bool GetIncludeProfileLevelFlag() const
- {
- return m_IncludeInlineProfileLevelFlag;
- }
- AP4_UI08 GetOdProfileLevelIndication() const
- {
- return m_OdProfileLevelIndication;
- }
- AP4_UI08 GetSceneProfileLevelIndication() const
- {
- return m_SceneProfileLevelIndication;
- }
- AP4_UI08 GetAudioProfileLevelIndication() const
- {
- return m_AudioProfileLevelIndication;
- }
- AP4_UI08 GetVisualProfileLevelIndication() const
- {
- return m_VisualProfileLevelIndication;
- }
- AP4_UI08 GetGraphicsProfileLevelIndication() const
- {
- return m_GraphicsProfileLevelIndication;
- }
-
-private:
+ bool GetIncludeProfileLevelFlag() const { return m_IncludeInlineProfileLevelFlag; }
+ AP4_UI08 GetOdProfileLevelIndication() const { return m_OdProfileLevelIndication; }
+ AP4_UI08 GetSceneProfileLevelIndication() const { return m_SceneProfileLevelIndication; }
+ AP4_UI08 GetAudioProfileLevelIndication() const { return m_AudioProfileLevelIndication; }
+ AP4_UI08 GetVisualProfileLevelIndication() const { return m_VisualProfileLevelIndication; }
+ AP4_UI08 GetGraphicsProfileLevelIndication() const { return m_GraphicsProfileLevelIndication; }
+
+ private:
// members
bool m_IncludeInlineProfileLevelFlag;
- AP4_UI08 m_OdProfileLevelIndication;
- AP4_UI08 m_SceneProfileLevelIndication;
- AP4_UI08 m_AudioProfileLevelIndication;
- AP4_UI08 m_VisualProfileLevelIndication;
- AP4_UI08 m_GraphicsProfileLevelIndication;
+ AP4_UI08 m_OdProfileLevelIndication;
+ AP4_UI08 m_SceneProfileLevelIndication;
+ AP4_UI08 m_AudioProfileLevelIndication;
+ AP4_UI08 m_VisualProfileLevelIndication;
+ AP4_UI08 m_GraphicsProfileLevelIndication;
};
/*----------------------------------------------------------------------
@@ -169,14 +142,14 @@ private:
*/
class AP4_DescriptorUpdateCommand : public AP4_Command
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_DescriptorUpdateCommand, AP4_Command)
// methods
AP4_DescriptorUpdateCommand(AP4_UI08 tag);
- AP4_DescriptorUpdateCommand(AP4_ByteStream& stream,
+ AP4_DescriptorUpdateCommand(AP4_ByteStream& stream,
AP4_UI08 tag,
- AP4_Size header_size,
+ AP4_Size header_size,
AP4_Size payload_size);
virtual ~AP4_DescriptorUpdateCommand();
virtual AP4_Result AddDescriptor(AP4_Descriptor* descriptor);
@@ -184,12 +157,9 @@ public:
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
- const AP4_List<AP4_Descriptor>& GetDescriptors()
- {
- return m_Descriptors;
- }
-
-protected:
+ const AP4_List<AP4_Descriptor>& GetDescriptors() { return m_Descriptors; }
+
+ protected:
// members
mutable AP4_List<AP4_Descriptor> m_Descriptors;
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.cpp
index 8b4d8cea8..28805ecef 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - odaf Atoms
+| AP4 - odaf Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,8 +45,8 @@ AP4_OdafAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_OdafAtom(size, version, flags, stream);
}
@@ -56,7 +56,7 @@ AP4_OdafAtom::Create(AP4_Size size, AP4_ByteStream& stream)
AP4_OdafAtom::AP4_OdafAtom(bool selective_encryption,
AP4_UI08 key_length_indicator,
AP4_UI08 iv_length) :
- AP4_Atom(AP4_ATOM_TYPE_ODAF, AP4_FULL_ATOM_HEADER_SIZE + 3, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_ODAF, AP4_FULL_ATOM_HEADER_SIZE+3, 0, 0),
m_SelectiveEncryption(selective_encryption),
m_KeyIndicatorLength(key_length_indicator),
m_IvLength(iv_length)
@@ -66,7 +66,7 @@ AP4_OdafAtom::AP4_OdafAtom(bool selective_encryption,
/*----------------------------------------------------------------------
| AP4_OdafAtom::AP4_OdafAtom
+---------------------------------------------------------------------*/
-AP4_OdafAtom::AP4_OdafAtom(AP4_UI32 size,
+AP4_OdafAtom::AP4_OdafAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -74,7 +74,7 @@ AP4_OdafAtom::AP4_OdafAtom(AP4_UI32 size,
{
AP4_UI08 s;
stream.ReadUI08(s);
- m_SelectiveEncryption = ((s & 0x80) != 0);
+ m_SelectiveEncryption = ((s&0x80) != 0);
stream.ReadUI08(m_KeyIndicatorLength);
stream.ReadUI08(m_IvLength);
}
@@ -89,15 +89,15 @@ AP4_OdafAtom::WriteFields(AP4_ByteStream& stream)
// selective encryption
result = stream.WriteUI08(m_SelectiveEncryption ? 0x80 : 0);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// key indicator length
result = stream.WriteUI08(m_KeyIndicatorLength);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// IV length
result = stream.WriteUI08(m_IvLength);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.h
index 669ab6efe..22ba860ee 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdafAtom.h
@@ -54,22 +54,13 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- bool GetSelectiveEncryption()
- {
- return m_SelectiveEncryption;
- }
- AP4_UI08 GetKeyIndicatorLength()
- {
- return m_KeyIndicatorLength;
- }
- AP4_UI08 GetIvLength()
- {
- return m_IvLength;
- }
+ bool GetSelectiveEncryption() { return m_SelectiveEncryption; }
+ AP4_UI08 GetKeyIndicatorLength() { return m_KeyIndicatorLength; }
+ AP4_UI08 GetIvLength() { return m_IvLength; }
private:
// methods
- AP4_OdafAtom(AP4_UI32 size,
+ AP4_OdafAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.cpp
index 57c50c464..d7a08796a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - odda Atoms
+| AP4 - odda Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,20 +41,20 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_OddaAtom)
| AP4_OddaAtom::Create
+---------------------------------------------------------------------*/
AP4_OddaAtom*
-AP4_OddaAtom::Create(AP4_UI64 size,
+AP4_OddaAtom::Create(AP4_UI64 size,
AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_OddaAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_OddaAtom::AP4_OddaAtom
+---------------------------------------------------------------------*/
-AP4_OddaAtom::AP4_OddaAtom(AP4_UI64 size,
+AP4_OddaAtom::AP4_OddaAtom(AP4_UI64 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -64,14 +64,14 @@ AP4_OddaAtom::AP4_OddaAtom(AP4_UI64 size,
stream.ReadUI64(m_EncryptedDataLength);
// get the source stream position
- AP4_Position position;
+ AP4_Position position;
stream.Tell(position);
// create a substream to represent the payload
m_EncryptedPayload = new AP4_SubStream(stream, position, m_EncryptedDataLength);
-
+
// seek to the end
- stream.Seek(position + m_EncryptedDataLength);
+ stream.Seek(position+m_EncryptedDataLength);
}
/*----------------------------------------------------------------------
@@ -82,10 +82,10 @@ AP4_OddaAtom::AP4_OddaAtom(AP4_ByteStream& encrypted_payload) :
{
// encrypted data length
encrypted_payload.GetSize(m_EncryptedDataLength);
-
- // update our size
- SetSize(AP4_FULL_ATOM_HEADER_SIZE_64 + 8 + m_EncryptedDataLength, true);
-
+
+ // update our size
+ SetSize(AP4_FULL_ATOM_HEADER_SIZE_64+8+m_EncryptedDataLength, true);
+
// keep a reference to the encrypted payload
m_EncryptedPayload = &encrypted_payload;
m_EncryptedPayload->AddReference();
@@ -96,7 +96,7 @@ AP4_OddaAtom::AP4_OddaAtom(AP4_ByteStream& encrypted_payload) :
+---------------------------------------------------------------------*/
AP4_OddaAtom::~AP4_OddaAtom()
{
- if(m_EncryptedPayload) m_EncryptedPayload->Release();
+ if (m_EncryptedPayload) m_EncryptedPayload->Release();
}
@@ -107,18 +107,17 @@ AP4_Result
AP4_OddaAtom::SetEncryptedPayload(AP4_ByteStream& stream, AP4_LargeSize length)
{
// keep a reference to the stream
- if(m_EncryptedPayload)
- {
+ if (m_EncryptedPayload) {
m_EncryptedPayload->Release();
}
m_EncryptedPayload = &stream;
m_EncryptedPayload->AddReference();
-
+
// update the size
m_EncryptedDataLength = length;
SetSize(AP4_FULL_ATOM_HEADER_SIZE_64 + 8 + length, true);
- if(m_Parent) m_Parent->OnChildChanged(this);
-
+ if (m_Parent) m_Parent->OnChildChanged(this);
+
return AP4_SUCCESS;
}
@@ -131,8 +130,8 @@ AP4_OddaAtom::SetEncryptedPayload(AP4_ByteStream& stream)
// the new encrypted data length is the size of the stream
AP4_LargeSize length;
AP4_Result result = stream.GetSize(length);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
return SetEncryptedPayload(stream, length);
}
@@ -147,8 +146,7 @@ AP4_OddaAtom::WriteFields(AP4_ByteStream& stream)
// check that we have a source stream
// and a normal size
- if(m_EncryptedPayload == NULL || GetSize() < 8)
- {
+ if (m_EncryptedPayload == NULL || GetSize() < 8) {
return AP4_FAILURE;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.h
index 9acde6c14..58a402ce5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OddaAtom.h
@@ -45,24 +45,21 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_OddaAtom, AP4_Atom)
// class methods
- static AP4_OddaAtom* Create(AP4_UI64 size,
+ static AP4_OddaAtom* Create(AP4_UI64 size,
AP4_ByteStream& stream);
// constructor
AP4_OddaAtom(AP4_ByteStream& encrypted_payload);
-
+
// destructor
~AP4_OddaAtom();
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// accessors
- AP4_UI64 GetEncryptedDataLength()
- {
- return m_EncryptedDataLength;
- }
+ AP4_UI64 GetEncryptedDataLength() { return m_EncryptedDataLength; }
/**
* Sets the encrypted payload stream (and releases any existing stream references)
@@ -73,14 +70,11 @@ public:
/**
* Returns a reference to the encrypted payload stream (does not increment the reference counter)
*/
- AP4_ByteStream& GetEncryptedPayload()
- {
- return *m_EncryptedPayload;
- }
+ AP4_ByteStream& GetEncryptedPayload() { return *m_EncryptedPayload; }
private:
// methods
- AP4_OddaAtom(AP4_UI64 size,
+ AP4_OddaAtom(AP4_UI64 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.cpp
index 69c70ac2f..f4e2bf5c8 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - odhe Atoms
+| AP4 - odhe Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -42,21 +42,21 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_OdheAtom)
| AP4_OdheAtom::Create
+---------------------------------------------------------------------*/
AP4_OdheAtom*
-AP4_OdheAtom::Create(AP4_Size size,
+AP4_OdheAtom::Create(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_OdheAtom(size, version, flags, stream, atom_factory);
}
/*----------------------------------------------------------------------
| AP4_OdheAtom::AP4_OdheAtom
+---------------------------------------------------------------------*/
-AP4_OdheAtom::AP4_OdheAtom(AP4_UI32 size,
+AP4_OdheAtom::AP4_OdheAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream,
@@ -71,7 +71,7 @@ AP4_OdheAtom::AP4_OdheAtom(AP4_UI32 size,
m_ContentType.Assign(content_type, content_type_length);
// read the children
- AP4_Size bytes_available = size - (AP4_FULL_ATOM_HEADER_SIZE + 1 + content_type_length);
+ AP4_Size bytes_available = size-(AP4_FULL_ATOM_HEADER_SIZE+1+content_type_length);
ReadChildren(atom_factory, stream, bytes_available);
}
@@ -83,7 +83,7 @@ AP4_OdheAtom::AP4_OdheAtom(const char* content_type,
AP4_ContainerAtom(AP4_ATOM_TYPE_ODHE, (AP4_UI32)0, (AP4_UI32)0),
m_ContentType(content_type)
{
- m_Size32 += 1 + m_ContentType.GetLength();
+ m_Size32 += 1+m_ContentType.GetLength();
AddChild(ohdr);
}
@@ -95,8 +95,7 @@ AP4_OdheAtom::WriteFields(AP4_ByteStream& stream)
{
// write the content type
AP4_CHECK(stream.WriteUI08((AP4_UI08)m_ContentType.GetLength()));
- if(m_ContentType.GetLength())
- {
+ if (m_ContentType.GetLength()) {
AP4_CHECK(stream.Write(m_ContentType.GetChars(), m_ContentType.GetLength()));
}
@@ -121,11 +120,11 @@ void
AP4_OdheAtom::OnChildChanged(AP4_Atom*)
{
// remcompute our size
- AP4_UI64 size = GetHeaderSize() + 1 + m_ContentType.GetLength();
+ AP4_UI64 size = GetHeaderSize()+1+m_ContentType.GetLength();
m_Children.Apply(AP4_AtomSizeAdder(size));
SetSize(size);
// update our parent
- if(m_Parent) m_Parent->OnChildChanged(this);
+ if (m_Parent) m_Parent->OnChildChanged(this);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.h
index a3e944805..44477ae13 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OdheAtom.h
@@ -51,8 +51,8 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_OdheAtom, AP4_ContainerAtom)
// class methods
- static AP4_OdheAtom* Create(AP4_Size size,
- AP4_ByteStream& stream,
+ static AP4_OdheAtom* Create(AP4_Size size,
+ AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
// constructor
@@ -60,23 +60,20 @@ public:
* @param: ohdr ohdr atom passed with transfer of ownership semantics
*/
AP4_OdheAtom(const char* content_type, AP4_OhdrAtom* ohdr);
-
+
// AP4_Atom methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// AP4_AtomParent methods
virtual void OnChildChanged(AP4_Atom* child);
-
+
// methods
- const AP4_String& GetContentType()
- {
- return m_ContentType;
- }
-
+ const AP4_String& GetContentType() { return m_ContentType; }
+
private:
// methods
- AP4_OdheAtom(AP4_UI32 size,
+ AP4_OdheAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.cpp
index eea8b08c5..f74e0d8f5 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - ohdr Atoms
+| AP4 - ohdr Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,21 +41,21 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_OhdrAtom)
| AP4_OhdrAtom::Create
+---------------------------------------------------------------------*/
AP4_OhdrAtom*
-AP4_OhdrAtom::Create(AP4_Size size,
+AP4_OhdrAtom::Create(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_OhdrAtom(size, version, flags, stream, atom_factory);
}
/*----------------------------------------------------------------------
| AP4_OhdrAtom::AP4_OhdrAtom
+---------------------------------------------------------------------*/
-AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI08 encryption_method,
+AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI08 encryption_method,
AP4_UI08 padding_scheme,
AP4_UI64 plaintext_length,
const char* content_id,
@@ -70,13 +70,13 @@ AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI08 encryption_method,
m_RightsIssuerUrl(rights_issuer_url),
m_TextualHeaders(textual_headers, textual_headers_size)
{
- m_Size32 += 1 + 1 + 8 + 2 + 2 + 2 + m_ContentId.GetLength() + m_RightsIssuerUrl.GetLength() + textual_headers_size;
+ m_Size32 += 1+1+8+2+2+2+m_ContentId.GetLength()+m_RightsIssuerUrl.GetLength()+textual_headers_size;
}
/*----------------------------------------------------------------------
| AP4_OhdrAtom::AP4_OhdrAtom
+---------------------------------------------------------------------*/
-AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI32 size,
+AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream,
@@ -85,7 +85,7 @@ AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI32 size,
{
// encryption method
stream.ReadUI08(m_EncryptionMethod);
-
+
// padding scheme
stream.ReadUI08(m_PaddingScheme);
@@ -119,10 +119,9 @@ AP4_OhdrAtom::AP4_OhdrAtom(AP4_UI32 size,
delete[] buffer;
// read the children
- AP4_Size bytes_used = AP4_FULL_ATOM_HEADER_SIZE + 1 + 1 + 8 + 2 + 2 + 2 + content_id_length + rights_issuer_url_length + textual_headers_length;
- if(bytes_used <= size)
- {
- ReadChildren(atom_factory, stream, size - bytes_used);
+ AP4_Size bytes_used = AP4_FULL_ATOM_HEADER_SIZE+1+1+8+2+2+2+content_id_length+rights_issuer_url_length+textual_headers_length;
+ if (bytes_used <= size) {
+ ReadChildren(atom_factory, stream, size-bytes_used);
}
}
@@ -154,24 +153,21 @@ AP4_OhdrAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("encryption_method", m_EncryptionMethod);
inspector.AddField("padding_scheme", m_PaddingScheme);
- inspector.AddField("plaintext_length", (AP4_UI32)m_PlaintextLength);
+ inspector.AddField("plaintext_length", (AP4_UI32)m_PlaintextLength);
inspector.AddField("content_id", m_ContentId.GetChars());
inspector.AddField("rights_issuer_url", m_RightsIssuerUrl.GetChars());
{
- AP4_DataBuffer output_buffer;
+ AP4_DataBuffer output_buffer;
AP4_Result result;
- result = output_buffer.Reserve(1 + m_TextualHeaders.GetDataSize());
- if(AP4_FAILED(result))
- {
- inspector.AddField("textual_headers",
- m_TextualHeaders.UseData(),
- m_TextualHeaders.GetDataSize(),
- AP4_AtomInspector::HINT_HEX);
- }
- else
- {
+ result = output_buffer.Reserve(1+m_TextualHeaders.GetDataSize());
+ if (AP4_FAILED(result)) {
+ inspector.AddField("textual_headers",
+ m_TextualHeaders.UseData(),
+ m_TextualHeaders.GetDataSize(),
+ AP4_AtomInspector::HINT_HEX);
+ } else {
AP4_Size data_len = m_TextualHeaders.GetDataSize();
AP4_Byte* textual_headers_string;
AP4_Byte* curr;
@@ -179,16 +175,14 @@ AP4_OhdrAtom::InspectFields(AP4_AtomInspector& inspector)
output_buffer.SetData((const AP4_Byte*)m_TextualHeaders.GetData(), m_TextualHeaders.GetDataSize());
curr = textual_headers_string = output_buffer.UseData();
textual_headers_string[m_TextualHeaders.GetDataSize()] = '\0';
- while(curr < textual_headers_string + data_len)
- {
- if('\0' == *curr)
- {
+ while(curr < textual_headers_string+data_len) {
+ if ('\0' == *curr) {
*curr = '\n';
}
curr++;
}
inspector.AddField("textual_headers", (const char*) textual_headers_string);
- }
+ }
}
return InspectChildren(inspector);
@@ -197,7 +191,7 @@ AP4_OhdrAtom::InspectFields(AP4_AtomInspector& inspector)
/*----------------------------------------------------------------------
| AP4_OhdrAtom::Clone
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_OhdrAtom::Clone()
{
AP4_OhdrAtom* clone;
@@ -210,10 +204,9 @@ AP4_OhdrAtom::Clone()
m_TextualHeaders.GetDataSize());
AP4_List<AP4_Atom>::Item* child_item = m_Children.FirstItem();
- while(child_item)
- {
+ while (child_item) {
AP4_Atom* child_clone = child_item->GetData()->Clone();
- if(child_clone) clone->AddChild(child_clone);
+ if (child_clone) clone->AddChild(child_clone);
child_item = child_item->GetNext();
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.h
index a06905216..afee7f5fb 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OhdrAtom.h
@@ -56,12 +56,12 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_OhdrAtom, AP4_ContainerAtom)
// class methods
- static AP4_OhdrAtom* Create(AP4_Size size,
- AP4_ByteStream& stream,
+ static AP4_OhdrAtom* Create(AP4_Size size,
+ AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
// constructor
- AP4_OhdrAtom(AP4_UI08 encryption_method,
+ AP4_OhdrAtom(AP4_UI08 encryption_method,
AP4_UI08 padding_scheme,
AP4_UI64 plaintext_length,
const char* content_id,
@@ -75,49 +75,25 @@ public:
virtual AP4_Atom* Clone();
// accessors
- AP4_UI08 GetEncryptionMethod() const
- {
- return m_EncryptionMethod;
- }
- void SetEncryptionMethod(AP4_UI08 encryption_method)
- {
- m_EncryptionMethod = encryption_method;
- }
- AP4_UI08 GetPaddingScheme() const
- {
- return m_PaddingScheme;
- }
- void SetPaddingScheme(AP4_UI08 padding_scheme)
- {
- m_PaddingScheme = padding_scheme;
- }
- AP4_UI64 GetPlaintextLength() const
- {
- return m_PlaintextLength;
- }
- const AP4_String& GetContentId() const
- {
- return m_ContentId;
- }
- const AP4_String& GetRightsIssuerUrl() const
- {
- return m_RightsIssuerUrl;
- }
- const AP4_DataBuffer& GetTextualHeaders() const
- {
- return m_TextualHeaders;
- }
+ AP4_UI08 GetEncryptionMethod() const { return m_EncryptionMethod; }
+ void SetEncryptionMethod(AP4_UI08 encryption_method) { m_EncryptionMethod = encryption_method; }
+ AP4_UI08 GetPaddingScheme() const { return m_PaddingScheme; }
+ void SetPaddingScheme(AP4_UI08 padding_scheme) { m_PaddingScheme = padding_scheme; }
+ AP4_UI64 GetPlaintextLength() const { return m_PlaintextLength; }
+ const AP4_String& GetContentId() const { return m_ContentId; }
+ const AP4_String& GetRightsIssuerUrl() const { return m_RightsIssuerUrl; }
+ const AP4_DataBuffer& GetTextualHeaders() const { return m_TextualHeaders; }
private:
// methods
- AP4_OhdrAtom(AP4_UI32 size,
+ AP4_OhdrAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
// members
- AP4_UI08 m_EncryptionMethod;
+ AP4_UI08 m_EncryptionMethod;
AP4_UI08 m_PaddingScheme;
AP4_UI64 m_PlaintextLength;
AP4_String m_ContentId;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.cpp
index bfd3a32c8..a224ab14d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.cpp
@@ -53,48 +53,45 @@
| AP4_OmaDcfAtomDecrypter::DecryptAtoms
+---------------------------------------------------------------------*/
AP4_Result
-AP4_OmaDcfAtomDecrypter::DecryptAtoms(AP4_AtomParent& atoms,
+AP4_OmaDcfAtomDecrypter::DecryptAtoms(AP4_AtomParent& atoms,
AP4_Processor::ProgressListener* /*listener*/,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_ProtectionKeyMap& key_map)
{
unsigned int index = 1;
- for(AP4_List<AP4_Atom>::Item* item = atoms.GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = atoms.GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom->GetType() != AP4_ATOM_TYPE_ODRM) continue;
+ if (atom->GetType() != AP4_ATOM_TYPE_ODRM) continue;
// check that we have the key
const AP4_UI08* key = key_map.GetKey(index++);
- if(key == NULL) return AP4_ERROR_INVALID_PARAMETERS;
-
+ if (key == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+
// check that we have all the atoms we need
AP4_ContainerAtom* odrm = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(odrm == NULL) continue; // not enough info
+ if (odrm == NULL) continue; // not enough info
AP4_OdheAtom* odhe = AP4_DYNAMIC_CAST(AP4_OdheAtom, odrm->GetChild(AP4_ATOM_TYPE_ODHE));
- if(odhe == NULL) continue; // not enough info
+ if (odhe == NULL) continue; // not enough info
AP4_OddaAtom* odda = AP4_DYNAMIC_CAST(AP4_OddaAtom, odrm->GetChild(AP4_ATOM_TYPE_ODDA));
- if(odda == NULL) continue; // not enough info
+ if (odda == NULL) continue; // not enough info
AP4_OhdrAtom* ohdr = AP4_DYNAMIC_CAST(AP4_OhdrAtom, odhe->GetChild(AP4_ATOM_TYPE_OHDR));
- if(ohdr == NULL) continue; // not enough info
+ if (ohdr == NULL) continue; // not enough info
// do nothing if the atom is not encrypted
- if(ohdr->GetEncryptionMethod() == AP4_OMA_DCF_ENCRYPTION_METHOD_NULL)
- {
+ if (ohdr->GetEncryptionMethod() == AP4_OMA_DCF_ENCRYPTION_METHOD_NULL) {
continue;
}
-
+
// create the byte stream
AP4_ByteStream* cipher_stream = NULL;
- AP4_Result result = CreateDecryptingStream(*odrm,
- key,
- 16,
- block_cipher_factory,
- cipher_stream);
- if(AP4_SUCCEEDED(result))
- {
+ AP4_Result result = CreateDecryptingStream(*odrm,
+ key,
+ 16,
+ block_cipher_factory,
+ cipher_stream);
+ if (AP4_SUCCEEDED(result)) {
// replace the odda atom's payload with the decrypted stream
odda->SetEncryptedPayload(*cipher_stream, ohdr->GetPlaintextLength());
cipher_stream->Release();
@@ -111,7 +108,7 @@ AP4_OmaDcfAtomDecrypter::DecryptAtoms(AP4_AtomParent& atoms,
/*----------------------------------------------------------------------
| AP4_OmaDcfAtomDecrypter::CreateDecryptingStream
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
AP4_ContainerAtom& odrm,
const AP4_UI08* key,
@@ -121,111 +118,105 @@ AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
{
// default return values
stream = NULL;
-
+
AP4_OdheAtom* odhe = AP4_DYNAMIC_CAST(AP4_OdheAtom, odrm.GetChild(AP4_ATOM_TYPE_ODHE));
- if(odhe == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (odhe == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_OddaAtom* odda = AP4_DYNAMIC_CAST(AP4_OddaAtom, odrm.GetChild(AP4_ATOM_TYPE_ODDA));
- if(odda == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (odda == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_OhdrAtom* ohdr = AP4_DYNAMIC_CAST(AP4_OhdrAtom, odhe->GetChild(AP4_ATOM_TYPE_OHDR));
- if(ohdr == NULL) return AP4_ERROR_INVALID_FORMAT;
-
+ if (ohdr == NULL) return AP4_ERROR_INVALID_FORMAT;
+
// shortcut for non-encrypted files
- if(ohdr->GetEncryptionMethod() == AP4_OMA_DCF_ENCRYPTION_METHOD_NULL)
- {
+ if (ohdr->GetEncryptionMethod() == AP4_OMA_DCF_ENCRYPTION_METHOD_NULL) {
stream = &odda->GetEncryptedPayload();
stream->AddReference();
return AP4_SUCCESS;
}
-
+
// if this is part of a group, use the group key to obtain the content
// key (note that the field called GroupKey in the spec is actually not
// the group key but the content key encrypted with the group key...
AP4_GrpiAtom* grpi = AP4_DYNAMIC_CAST(AP4_GrpiAtom, ohdr->GetChild(AP4_ATOM_TYPE_GRPI));
AP4_UI08* key_buffer = NULL;
- if(grpi)
- {
+ if (grpi) {
// sanity check on the encrypted key size
- if(grpi->GetGroupKey().GetDataSize() < 32)
- {
+ if (grpi->GetGroupKey().GetDataSize() < 32) {
return AP4_ERROR_INVALID_FORMAT;
}
-
+
// create a block cipher to decrypt the content key
AP4_BlockCipher* block_cipher = NULL;
AP4_Result result;
-
+
// create a stream cipher from the block cipher
- AP4_StreamCipher* stream_cipher = NULL;
- switch(ohdr->GetEncryptionMethod())
- {
- case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC:
- result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::DECRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
- stream_cipher = new AP4_CbcStreamCipher(block_cipher, AP4_CbcStreamCipher::DECRYPT);
- break;
-
- case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR:
- result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
- stream_cipher = new AP4_CtrStreamCipher(block_cipher, NULL, 16);
- break;
-
- default:
- return AP4_ERROR_NOT_SUPPORTED;
+ AP4_StreamCipher* stream_cipher = NULL;
+ switch (ohdr->GetEncryptionMethod()) {
+ case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC:
+ result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::DECRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
+ stream_cipher = new AP4_CbcStreamCipher(block_cipher, AP4_CbcStreamCipher::DECRYPT);
+ break;
+
+ case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR:
+ result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
+ stream_cipher = new AP4_CtrStreamCipher(block_cipher, NULL, 16);
+ break;
+
+ default:
+ return AP4_ERROR_NOT_SUPPORTED;
}
// set the IV
stream_cipher->SetIV(grpi->GetGroupKey().GetData());
-
+
// decrypt the content key
AP4_Size key_buffer_size = grpi->GetGroupKey().GetDataSize(); // worst case
key_buffer = new AP4_UI08[key_buffer_size];
- result = stream_cipher->ProcessBuffer(grpi->GetGroupKey().GetData() + 16,
- grpi->GetGroupKey().GetDataSize() - 16,
- key_buffer,
- &key_buffer_size,
+ result = stream_cipher->ProcessBuffer(grpi->GetGroupKey().GetData()+16,
+ grpi->GetGroupKey().GetDataSize()-16,
+ key_buffer,
+ &key_buffer_size,
true);
delete stream_cipher; // this will also delete the block cipher
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
delete[] key_buffer;
return result;
}
-
+
// point to the new key value
key = key_buffer;
key_size = key_buffer_size;
}
-
+
AP4_OmaDcfCipherMode mode;
- switch(ohdr->GetEncryptionMethod())
- {
- case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC:
- mode = AP4_OMA_DCF_CIPHER_MODE_CBC;
- break;
- case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR:
- mode = AP4_OMA_DCF_CIPHER_MODE_CTR;
- break;
- default:
- return AP4_ERROR_NOT_SUPPORTED;
+ switch (ohdr->GetEncryptionMethod()) {
+ case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC:
+ mode = AP4_OMA_DCF_CIPHER_MODE_CBC;
+ break;
+ case AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR:
+ mode = AP4_OMA_DCF_CIPHER_MODE_CTR;
+ break;
+ default:
+ return AP4_ERROR_NOT_SUPPORTED;
}
-
+
AP4_Result result;
result = CreateDecryptingStream(mode,
- odda->GetEncryptedPayload(),
- ohdr->GetPlaintextLength(),
- key, key_size,
+ odda->GetEncryptedPayload(),
+ ohdr->GetPlaintextLength(),
+ key, key_size,
block_cipher_factory,
stream);
-
+
// cleanup
delete[] key_buffer;
@@ -235,7 +226,7 @@ AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
/*----------------------------------------------------------------------
| AP4_OmaDcfAtomDecrypter::CreateDecryptingStream
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
AP4_OmaDcfCipherMode mode,
AP4_ByteStream& encrypted_stream,
@@ -243,52 +234,45 @@ AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
- AP4_ByteStream*& stream)
+ AP4_ByteStream*& stream)
{
// default return value
stream = NULL;
-
+
// get the encrypted size (includes IV and padding)
AP4_LargeSize encrypted_size = 0;
AP4_Result result = encrypted_stream.GetSize(encrypted_size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// check that the encrypted size is consistent with the cipher mode
AP4_DecryptingStream::CipherMode cipher_mode;
- if(mode == AP4_OMA_DCF_CIPHER_MODE_CBC)
- {
+ if (mode == AP4_OMA_DCF_CIPHER_MODE_CBC) {
// we need at least 16 bytes of IV and 32 bytes of data+padding
// we also need a multiple of the block size
- if(encrypted_size < 48 || ((encrypted_size % 16) != 0))
- {
+ if (encrypted_size < 48 || ((encrypted_size % 16) != 0)) {
return AP4_ERROR_INVALID_FORMAT;
}
cipher_mode = AP4_DecryptingStream::CIPHER_MODE_CBC;
- }
- else if(mode == AP4_OMA_DCF_CIPHER_MODE_CTR)
- {
+ } else if (mode == AP4_OMA_DCF_CIPHER_MODE_CTR) {
// we need at least 16 bytes of IV
- if(encrypted_size < 16)
- {
+ if (encrypted_size < 16) {
return AP4_ERROR_INVALID_FORMAT;
}
cipher_mode = AP4_DecryptingStream::CIPHER_MODE_CTR;
- }
- else
- {
+ } else {
return AP4_ERROR_NOT_SUPPORTED;
}
// read the IV
AP4_UI08 iv[16];
result = encrypted_stream.Seek(0);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = encrypted_stream.Read(iv, 16);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// create a sub stream with just the encrypted payload without the IV
- AP4_ByteStream* sub_stream = new AP4_SubStream(encrypted_stream, 16, encrypted_size - 16);
-
+ AP4_ByteStream* sub_stream = new AP4_SubStream(encrypted_stream, 16, encrypted_size-16);
+
// create the decrypting cipher
result = AP4_DecryptingStream::Create(cipher_mode,
*sub_stream,
@@ -302,7 +286,7 @@ AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
// we don't keep our own reference to the sub stream
sub_stream->Release();
-
+
return result;
}
@@ -310,89 +294,80 @@ AP4_OmaDcfAtomDecrypter::CreateDecryptingStream(
| AP4_OmaDcfSampleDecrypter::Create
+---------------------------------------------------------------------*/
AP4_Result
-AP4_OmaDcfSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
- const AP4_UI08* key,
+AP4_OmaDcfSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
+ const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_OmaDcfSampleDecrypter*& cipher)
{
// check the parameters
- if(key == NULL || block_cipher_factory == NULL)
- {
+ if (key == NULL || block_cipher_factory == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
-
+
// default return value
cipher = NULL;
// get the scheme info atom
AP4_ContainerAtom* schi = sample_description->GetSchemeInfo()->GetSchiAtom();
- if(schi == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (schi == NULL) return AP4_ERROR_INVALID_FORMAT;
// get and check the cipher params
- // NOTE: we only support an IV Length less than or equal to the cipher block size,
+ // NOTE: we only support an IV Length less than or equal to the cipher block size,
// and we don't know how to deal with a key indicator length != 0
AP4_OdafAtom* odaf = AP4_DYNAMIC_CAST(AP4_OdafAtom, schi->FindChild("odkm/odaf"));
- if(odaf)
- {
- if(odaf->GetIvLength() > AP4_CIPHER_BLOCK_SIZE) return AP4_ERROR_INVALID_FORMAT;
- if(odaf->GetKeyIndicatorLength() != 0) return AP4_ERROR_INVALID_FORMAT;
+ if (odaf) {
+ if (odaf->GetIvLength() > AP4_CIPHER_BLOCK_SIZE) return AP4_ERROR_INVALID_FORMAT;
+ if (odaf->GetKeyIndicatorLength() != 0) return AP4_ERROR_INVALID_FORMAT;
}
// check the scheme details and create the cipher
AP4_OhdrAtom* ohdr = AP4_DYNAMIC_CAST(AP4_OhdrAtom, schi->FindChild("odkm/ohdr"));
- if(ohdr == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (ohdr == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_UI08 encryption_method = ohdr->GetEncryptionMethod();
- if(encryption_method == AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC)
- {
+ if (encryption_method == AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC) {
// in CBC mode, we only support IVs of the same size as the cipher block size
- if(odaf->GetIvLength() != AP4_CIPHER_BLOCK_SIZE) return AP4_ERROR_INVALID_FORMAT;
+ if (odaf->GetIvLength() != AP4_CIPHER_BLOCK_SIZE) return AP4_ERROR_INVALID_FORMAT;
// require RFC_2630 padding
- if(ohdr->GetPaddingScheme() != AP4_OMA_DCF_PADDING_SCHEME_RFC_2630)
- {
+ if (ohdr->GetPaddingScheme() != AP4_OMA_DCF_PADDING_SCHEME_RFC_2630) {
return AP4_ERROR_NOT_SUPPORTED;
}
// create the block cipher
AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::DECRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
+ AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::DECRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
// create the cipher
- cipher = new AP4_OmaDcfCbcSampleDecrypter(block_cipher,
- odaf->GetSelectiveEncryption());
+ cipher = new AP4_OmaDcfCbcSampleDecrypter(block_cipher,
+ odaf->GetSelectiveEncryption());
return AP4_SUCCESS;
- }
- else if(encryption_method == AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR)
- {
+ } else if (encryption_method == AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR) {
// require NONE padding
- if(ohdr->GetPaddingScheme() != AP4_OMA_DCF_PADDING_SCHEME_NONE)
- {
+ if (ohdr->GetPaddingScheme() != AP4_OMA_DCF_PADDING_SCHEME_NONE) {
return AP4_ERROR_INVALID_FORMAT;
}
// create the block cipher
AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
+ AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
// create the cipher
- cipher = new AP4_OmaDcfCtrSampleDecrypter(block_cipher,
- odaf->GetIvLength(),
- odaf->GetSelectiveEncryption());
+ cipher = new AP4_OmaDcfCtrSampleDecrypter(block_cipher,
+ odaf->GetIvLength(),
+ odaf->GetSelectiveEncryption());
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_NOT_SUPPORTED;
}
}
@@ -420,48 +395,44 @@ AP4_OmaDcfCtrSampleDecrypter::~AP4_OmaDcfCtrSampleDecrypter()
/*----------------------------------------------------------------------
| AP4_OmaDcfCtrSampleDecrypter::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfCtrSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out,
- const AP4_UI08* /*iv*/)
-{
+ AP4_DataBuffer& data_out,
+ const AP4_UI08* /*iv*/)
+{
bool is_encrypted = true;
const unsigned char* in = data_in.GetData();
AP4_Size in_size = data_in.GetDataSize();
- // default to 0 output
+ // default to 0 output
AP4_CHECK(data_out.SetDataSize(0));
// check the selective encryption flag
- if(m_SelectiveEncryption)
- {
- if(in_size < 1) return AP4_ERROR_INVALID_FORMAT;
- is_encrypted = ((in[0] & 0x80) != 0);
+ if (m_SelectiveEncryption) {
+ if (in_size < 1) return AP4_ERROR_INVALID_FORMAT;
+ is_encrypted = ((in[0]&0x80)!=0);
in++;
}
// check the size
- unsigned int header_size = (m_SelectiveEncryption ? 1 : 0) + (is_encrypted ? m_IvLength : 0);
- if(header_size > in_size) return AP4_ERROR_INVALID_FORMAT;
+ unsigned int header_size = (m_SelectiveEncryption?1:0)+(is_encrypted?m_IvLength:0);
+ if (header_size > in_size) return AP4_ERROR_INVALID_FORMAT;
// process the sample data
- AP4_Size payload_size = in_size - header_size;
+ AP4_Size payload_size = in_size-header_size;
AP4_CHECK(data_out.Reserve(payload_size));
unsigned char* out = data_out.UseData();
- if(is_encrypted)
- {
+ if (is_encrypted) {
// set the IV
m_Cipher->SetIV(in);
- AP4_CHECK(m_Cipher->ProcessBuffer(in + m_IvLength,
- payload_size,
+ AP4_CHECK(m_Cipher->ProcessBuffer(in+m_IvLength,
+ payload_size,
out));
- }
- else
- {
+ } else {
AP4_CopyMemory(out, in, payload_size);
}
AP4_CHECK(data_out.SetDataSize(payload_size));
-
+
return AP4_SUCCESS;
}
@@ -471,26 +442,23 @@ AP4_OmaDcfCtrSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
AP4_Size
AP4_OmaDcfCtrSampleDecrypter::GetDecryptedSampleSize(AP4_Sample& sample)
{
- if(m_Cipher == NULL) return 0;
+ if (m_Cipher == NULL) return 0;
// decide if this sample is encrypted or not
bool is_encrypted;
- if(m_SelectiveEncryption)
- {
+ if (m_SelectiveEncryption) {
// read the first byte to see if the sample is encrypted or not
AP4_Byte h;
AP4_DataBuffer peek_buffer;
peek_buffer.SetBuffer(&h, 1);
sample.ReadData(peek_buffer, 1);
- is_encrypted = ((h & 0x80) != 0);
- }
- else
- {
+ is_encrypted = ((h&0x80)!=0);
+ } else {
is_encrypted = true;
}
- AP4_Size crypto_header_size = (m_SelectiveEncryption ? 1 : 0) + (is_encrypted ? m_IvLength : 0);
- return sample.GetSize() - crypto_header_size;
+ AP4_Size crypto_header_size = (m_SelectiveEncryption?1:0)+(is_encrypted?m_IvLength:0);
+ return sample.GetSize()-crypto_header_size;
}
/*----------------------------------------------------------------------
@@ -515,37 +483,35 @@ AP4_OmaDcfCbcSampleDecrypter::~AP4_OmaDcfCbcSampleDecrypter()
/*----------------------------------------------------------------------
| AP4_OmaDbcCbcSampleDecrypter::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out,
- const AP4_UI08* /*iv*/)
-{
+ AP4_DataBuffer& data_out,
+ const AP4_UI08* /*iv*/)
+{
bool is_encrypted = true;
const unsigned char* in = data_in.GetData();
AP4_Size in_size = data_in.GetDataSize();
AP4_Size out_size;
- // default to 0 output
+ // default to 0 output
AP4_CHECK(data_out.SetDataSize(0));
// check the selective encryption flag
- if(m_SelectiveEncryption)
- {
- if(in_size < 1) return AP4_ERROR_INVALID_FORMAT;
- is_encrypted = ((in[0] & 0x80) != 0);
+ if (m_SelectiveEncryption) {
+ if (in_size < 1) return AP4_ERROR_INVALID_FORMAT;
+ is_encrypted = ((in[0]&0x80)!=0);
in++;
}
// check the size
- unsigned int header_size = (m_SelectiveEncryption ? 1 : 0) + (is_encrypted ? m_IvLength : 0);
- if(header_size > in_size) return AP4_ERROR_INVALID_FORMAT;
+ unsigned int header_size = (m_SelectiveEncryption?1:0)+(is_encrypted?m_IvLength:0);
+ if (header_size > in_size) return AP4_ERROR_INVALID_FORMAT;
// process the sample data
- unsigned int payload_size = in_size - header_size;
+ unsigned int payload_size = in_size-header_size;
data_out.Reserve(payload_size);
unsigned char* out = data_out.UseData();
- if(is_encrypted)
- {
+ if (is_encrypted) {
// get the IV
const AP4_UI08* iv = (const AP4_UI08*)in;
in += AP4_CIPHER_BLOCK_SIZE;
@@ -553,9 +519,7 @@ AP4_OmaDcfCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
m_Cipher->SetIV(iv);
out_size = payload_size;
AP4_CHECK(m_Cipher->ProcessBuffer(in, payload_size, out, &out_size, true));
- }
- else
- {
+ } else {
AP4_CopyMemory(out, in, payload_size);
out_size = payload_size;
}
@@ -571,57 +535,48 @@ AP4_OmaDcfCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
AP4_Size
AP4_OmaDcfCbcSampleDecrypter::GetDecryptedSampleSize(AP4_Sample& sample)
{
- if(m_Cipher == NULL) return 0;
+ if (m_Cipher == NULL) return 0;
// decide if this sample is encrypted or not
bool is_encrypted;
- if(m_SelectiveEncryption)
- {
+ if (m_SelectiveEncryption) {
// read the first byte to see if the sample is encrypted or not
AP4_Byte h;
AP4_DataBuffer peek_buffer;
peek_buffer.SetBuffer(&h, 1);
sample.ReadData(peek_buffer, 1);
- is_encrypted = ((h & 0x80) != 0);
- }
- else
- {
+ is_encrypted = ((h&0x80)!=0);
+ } else {
is_encrypted = true;
}
- if(is_encrypted)
- {
+ if (is_encrypted) {
// with CBC, we need to decrypt the last block to know what the padding was
- AP4_Size crypto_header_size = (m_SelectiveEncryption ? 1 : 0) + m_IvLength;
- AP4_Size encrypted_size = sample.GetSize() - crypto_header_size;
+ AP4_Size crypto_header_size = (m_SelectiveEncryption?1:0)+m_IvLength;
+ AP4_Size encrypted_size = sample.GetSize()-crypto_header_size;
AP4_DataBuffer encrypted;
AP4_DataBuffer decrypted;
AP4_Size decrypted_size = AP4_CIPHER_BLOCK_SIZE;
- if(sample.GetSize() < crypto_header_size + AP4_CIPHER_BLOCK_SIZE)
- {
+ if (sample.GetSize() < crypto_header_size+AP4_CIPHER_BLOCK_SIZE) {
return 0;
}
- AP4_Size offset = sample.GetSize() - 2 * AP4_CIPHER_BLOCK_SIZE;
- if(AP4_FAILED(sample.ReadData(encrypted, 2 * AP4_CIPHER_BLOCK_SIZE, offset)))
- {
+ AP4_Size offset = sample.GetSize()-2*AP4_CIPHER_BLOCK_SIZE;
+ if (AP4_FAILED(sample.ReadData(encrypted, 2*AP4_CIPHER_BLOCK_SIZE, offset))) {
return 0;
}
decrypted.Reserve(decrypted_size);
m_Cipher->SetIV(encrypted.GetData());
- if(AP4_FAILED(m_Cipher->ProcessBuffer(encrypted.GetData() + AP4_CIPHER_BLOCK_SIZE,
- AP4_CIPHER_BLOCK_SIZE,
- decrypted.UseData(),
- &decrypted_size,
- true)))
- {
+ if (AP4_FAILED(m_Cipher->ProcessBuffer(encrypted.GetData()+AP4_CIPHER_BLOCK_SIZE,
+ AP4_CIPHER_BLOCK_SIZE,
+ decrypted.UseData(),
+ &decrypted_size,
+ true))) {
return 0;
}
- unsigned int padding_size = AP4_CIPHER_BLOCK_SIZE - decrypted_size;
- return encrypted_size - padding_size;
- }
- else
- {
- return sample.GetSize() - (m_SelectiveEncryption ? 1 : 0);
+ unsigned int padding_size = AP4_CIPHER_BLOCK_SIZE-decrypted_size;
+ return encrypted_size-padding_size;
+ } else {
+ return sample.GetSize()-(m_SelectiveEncryption?1:0);
}
}
@@ -631,16 +586,13 @@ AP4_OmaDcfCbcSampleDecrypter::GetDecryptedSampleSize(AP4_Sample& sample)
AP4_OmaDcfSampleEncrypter::AP4_OmaDcfSampleEncrypter(const AP4_UI08* salt)
{
// left-align the salt
- unsigned int i = 0;
- if(salt)
- {
- for(; i < 8; i++)
- {
+ unsigned int i=0;
+ if (salt) {
+ for (; i<8; i++) {
m_Salt[i] = salt[i];
}
}
- for(; i < sizeof(m_Salt) / sizeof(m_Salt[0]); i++)
- {
+ for (; i<sizeof(m_Salt)/sizeof(m_Salt[0]); i++) {
m_Salt[i] = 0;
}
}
@@ -649,8 +601,8 @@ AP4_OmaDcfSampleEncrypter::AP4_OmaDcfSampleEncrypter(const AP4_UI08* salt)
| AP4_OmaDcfCtrSampleEncrypter::AP4_OmaDcfCtrSampleEncrypter
+---------------------------------------------------------------------*/
AP4_OmaDcfCtrSampleEncrypter::AP4_OmaDcfCtrSampleEncrypter(AP4_BlockCipher* block_cipher,
- const AP4_UI08* salt) :
- AP4_OmaDcfSampleEncrypter(salt)
+ const AP4_UI08* salt) :
+ AP4_OmaDcfSampleEncrypter(salt)
{
m_Cipher = new AP4_CtrStreamCipher(block_cipher, m_Salt, 8);
}
@@ -666,15 +618,15 @@ AP4_OmaDcfCtrSampleEncrypter::~AP4_OmaDcfCtrSampleEncrypter()
/*----------------------------------------------------------------------
| AP4_OmaDcfCtrSampleEncrypter::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfCtrSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out,
- AP4_UI64 counter,
- bool /*skip_encryption*/)
+ AP4_DataBuffer& data_out,
+ AP4_UI64 counter,
+ bool /*skip_encryption*/)
{
// setup the buffers
const unsigned char* in = data_in.GetData();
- AP4_CHECK(data_out.SetDataSize(data_in.GetDataSize() + AP4_CIPHER_BLOCK_SIZE + 1));
+ AP4_CHECK(data_out.SetDataSize(data_in.GetDataSize()+AP4_CIPHER_BLOCK_SIZE+1));
unsigned char* out = data_out.UseData();
// selective encryption flag
@@ -688,8 +640,8 @@ AP4_OmaDcfCtrSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
// encrypt the payload
AP4_Size data_size = data_in.GetDataSize();
- m_Cipher->SetIV(out + 8);
- m_Cipher->ProcessBuffer(in, data_size, out + AP4_CIPHER_BLOCK_SIZE);
+ m_Cipher->SetIV(out+8);
+ m_Cipher->ProcessBuffer(in, data_size, out+AP4_CIPHER_BLOCK_SIZE);
return AP4_SUCCESS;
}
@@ -697,18 +649,18 @@ AP4_OmaDcfCtrSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
/*----------------------------------------------------------------------
| AP4_OmaDcfCtrSampleEncrypter::GetEncryptedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_OmaDcfCtrSampleEncrypter::GetEncryptedSampleSize(AP4_Sample& sample)
{
- return sample.GetSize() + AP4_CIPHER_BLOCK_SIZE + 1;
+ return sample.GetSize()+AP4_CIPHER_BLOCK_SIZE+1;
}
/*----------------------------------------------------------------------
| AP4_OmaDcfCbcSampleEncrypter::AP4_OmaDcfCbcSampleEncrypter
+---------------------------------------------------------------------*/
AP4_OmaDcfCbcSampleEncrypter::AP4_OmaDcfCbcSampleEncrypter(AP4_BlockCipher* block_cipher,
- const AP4_UI08* salt) :
- AP4_OmaDcfSampleEncrypter(salt)
+ const AP4_UI08* salt) :
+ AP4_OmaDcfSampleEncrypter(salt)
{
m_Cipher = new AP4_CbcStreamCipher(block_cipher, AP4_CbcStreamCipher::ENCRYPT);
}
@@ -724,17 +676,17 @@ AP4_OmaDcfCbcSampleEncrypter::~AP4_OmaDcfCbcSampleEncrypter()
/*----------------------------------------------------------------------
| AP4_OmaDcfCbcSampleEncrypter::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfCbcSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out,
- AP4_UI64 counter,
- bool /*skip_encryption*/)
+ AP4_DataBuffer& data_out,
+ AP4_UI64 counter,
+ bool /*skip_encryption*/)
{
// make sure there is enough space in the output buffer
- data_out.Reserve(data_in.GetDataSize() + 2 * AP4_CIPHER_BLOCK_SIZE + 1);
+ data_out.Reserve(data_in.GetDataSize()+2*AP4_CIPHER_BLOCK_SIZE+1);
// setup the buffers
- AP4_Size out_size = data_in.GetDataSize() + AP4_CIPHER_BLOCK_SIZE;
+ AP4_Size out_size = data_in.GetDataSize()+AP4_CIPHER_BLOCK_SIZE;
unsigned char* out = data_out.UseData();
// selective encryption flag
@@ -748,12 +700,12 @@ AP4_OmaDcfCbcSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
// encrypt the payload
m_Cipher->SetIV(out);
- m_Cipher->ProcessBuffer(data_in.GetData(),
+ m_Cipher->ProcessBuffer(data_in.GetData(),
data_in.GetDataSize(),
- out + AP4_CIPHER_BLOCK_SIZE,
+ out+AP4_CIPHER_BLOCK_SIZE,
&out_size,
true);
- AP4_CHECK(data_out.SetDataSize(out_size + AP4_CIPHER_BLOCK_SIZE + 1));
+ AP4_CHECK(data_out.SetDataSize(out_size+AP4_CIPHER_BLOCK_SIZE+1));
return AP4_SUCCESS;
}
@@ -765,8 +717,8 @@ AP4_Size
AP4_OmaDcfCbcSampleEncrypter::GetEncryptedSampleSize(AP4_Sample& sample)
{
AP4_Size sample_size = sample.GetSize();
- AP4_Size padding_size = AP4_CIPHER_BLOCK_SIZE - (sample_size % AP4_CIPHER_BLOCK_SIZE);
- return sample_size + padding_size + AP4_CIPHER_BLOCK_SIZE + 1;
+ AP4_Size padding_size = AP4_CIPHER_BLOCK_SIZE-(sample_size%AP4_CIPHER_BLOCK_SIZE);
+ return sample_size+padding_size+AP4_CIPHER_BLOCK_SIZE+1;
}
/*----------------------------------------------------------------------
@@ -782,29 +734,27 @@ AP4_OmaDcfTrackDecrypter::Create(
AP4_OmaDcfTrackDecrypter*& decrypter)
{
// check and set defaults
- if(key == NULL)
- {
+ if (key == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
block_cipher_factory = &AP4_DefaultBlockCipherFactory::Instance;
}
decrypter = NULL;
// create the cipher
AP4_OmaDcfSampleDecrypter* cipher = NULL;
- AP4_Result result = AP4_OmaDcfSampleDecrypter::Create(sample_description,
- key,
- key_size,
- block_cipher_factory,
- cipher);
- if(AP4_FAILED(result)) return result;
+ AP4_Result result = AP4_OmaDcfSampleDecrypter::Create(sample_description,
+ key,
+ key_size,
+ block_cipher_factory,
+ cipher);
+ if (AP4_FAILED(result)) return result;
// instantiate the object
- decrypter = new AP4_OmaDcfTrackDecrypter(cipher,
- sample_entry,
- sample_description->GetOriginalFormat());
+ decrypter = new AP4_OmaDcfTrackDecrypter(cipher,
+ sample_entry,
+ sample_description->GetOriginalFormat());
return AP4_SUCCESS;
}
@@ -812,8 +762,8 @@ AP4_OmaDcfTrackDecrypter::Create(
| AP4_OmaDcfTrackDecrypter::AP4_OmaDcfTrackDecrypter
+---------------------------------------------------------------------*/
AP4_OmaDcfTrackDecrypter::AP4_OmaDcfTrackDecrypter(AP4_OmaDcfSampleDecrypter* cipher,
- AP4_SampleEntry* sample_entry,
- AP4_UI32 original_format) :
+ AP4_SampleEntry* sample_entry,
+ AP4_UI32 original_format) :
m_Cipher(cipher),
m_SampleEntry(sample_entry),
m_OriginalFormat(original_format)
@@ -831,17 +781,17 @@ AP4_OmaDcfTrackDecrypter::~AP4_OmaDcfTrackDecrypter()
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackDecrypter::GetProcessedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_OmaDcfTrackDecrypter::GetProcessedSampleSize(AP4_Sample& sample)
{
- if(m_Cipher == NULL) return 0;
+ if (m_Cipher == NULL) return 0;
return m_Cipher->GetDecryptedSampleSize(sample);
}
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackDecrypter::ProcessTrack
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfTrackDecrypter::ProcessTrack()
{
m_SampleEntry->SetType(m_OriginalFormat);
@@ -852,7 +802,7 @@ AP4_OmaDcfTrackDecrypter::ProcessTrack()
/*----------------------------------------------------------------------
| AP4_OmaDcfDecrypter::ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out)
{
@@ -862,8 +812,7 @@ AP4_OmaDcfTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackEncrypter
+---------------------------------------------------------------------*/
-class AP4_OmaDcfTrackEncrypter : public AP4_Processor::TrackHandler
-{
+class AP4_OmaDcfTrackEncrypter : public AP4_Processor::TrackHandler {
public:
// constructor
AP4_OmaDcfTrackEncrypter(AP4_OmaDcfCipherMode cipher_mode,
@@ -873,7 +822,7 @@ public:
AP4_UI32 format,
const char* content_id,
const char* rights_issuer_url,
- const AP4_Byte* textual_headers,
+ const AP4_Byte* textual_headers,
AP4_Size textual_headers_size);
virtual ~AP4_OmaDcfTrackEncrypter();
@@ -907,7 +856,7 @@ AP4_OmaDcfTrackEncrypter::AP4_OmaDcfTrackEncrypter(
AP4_UI32 format,
const char* content_id,
const char* rights_issuer_url,
- const AP4_Byte* textual_headers,
+ const AP4_Byte* textual_headers,
AP4_Size textual_headers_size) :
m_SampleEntry(sample_entry),
m_Format(format),
@@ -917,14 +866,11 @@ AP4_OmaDcfTrackEncrypter::AP4_OmaDcfTrackEncrypter(
m_Counter(0)
{
// instantiate the cipher (fixed params for now)
- if(cipher_mode == AP4_OMA_DCF_CIPHER_MODE_CBC)
- {
+ if (cipher_mode == AP4_OMA_DCF_CIPHER_MODE_CBC) {
m_Cipher = new AP4_OmaDcfCbcSampleEncrypter(block_cipher, salt);
m_CipherMode = AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC;
m_CipherPadding = AP4_OMA_DCF_PADDING_SCHEME_RFC_2630;
- }
- else
- {
+ } else {
m_Cipher = new AP4_OmaDcfCtrSampleEncrypter(block_cipher, salt);
m_CipherMode = AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR;
m_CipherPadding = AP4_OMA_DCF_PADDING_SCHEME_NONE;
@@ -942,7 +888,7 @@ AP4_OmaDcfTrackEncrypter::~AP4_OmaDcfTrackEncrypter()
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackEncrypter::GetProcessedSampleSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_OmaDcfTrackEncrypter::GetProcessedSampleSize(AP4_Sample& sample)
{
return m_Cipher->GetEncryptedSampleSize(sample);
@@ -951,7 +897,7 @@ AP4_OmaDcfTrackEncrypter::GetProcessedSampleSize(AP4_Sample& sample)
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackEncrypter::ProcessTrack
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfTrackEncrypter::ProcessTrack()
{
// sinf container
@@ -959,20 +905,20 @@ AP4_OmaDcfTrackEncrypter::ProcessTrack()
// original format
AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType());
-
+
// scheme info
AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI);
AP4_OdafAtom* odaf = new AP4_OdafAtom(true, 0, AP4_CIPHER_BLOCK_SIZE);
AP4_OhdrAtom* ohdr = new AP4_OhdrAtom(m_CipherMode,
- m_CipherPadding,
- 0,
- m_ContentId.GetChars(),
- m_RightsIssuerUrl.GetChars(),
- m_TextualHeaders.GetData(),
- m_TextualHeaders.GetDataSize());
+ m_CipherPadding,
+ 0,
+ m_ContentId.GetChars(),
+ m_RightsIssuerUrl.GetChars(),
+ m_TextualHeaders.GetData(),
+ m_TextualHeaders.GetDataSize());
AP4_ContainerAtom* odkm = new AP4_ContainerAtom(AP4_ATOM_TYPE_ODKM, (AP4_UI32)0, (AP4_UI32)0);
- AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_PROTECTION_SCHEME_TYPE_OMA,
- AP4_PROTECTION_SCHEME_VERSION_OMA_20);
+ AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_PROTECTION_SCHEME_TYPE_OMA,
+ AP4_PROTECTION_SCHEME_VERSION_OMA_20);
odkm->AddChild(odaf);
odkm->AddChild(ohdr);
@@ -989,24 +935,24 @@ AP4_OmaDcfTrackEncrypter::ProcessTrack()
// change the atom type of the sample description
m_SampleEntry->SetType(m_Format);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackEncrypter::ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out)
{
- AP4_Result result = m_Cipher->EncryptSampleData(data_in,
- data_out,
- m_Counter,
- false);
- if(AP4_FAILED(result)) return result;
+ AP4_Result result = m_Cipher->EncryptSampleData(data_in,
+ data_out,
+ m_Counter,
+ false);
+ if (AP4_FAILED(result)) return result;
- m_Counter += (data_in.GetDataSize() + AP4_CIPHER_BLOCK_SIZE - 1) / AP4_CIPHER_BLOCK_SIZE;
+ m_Counter += (data_in.GetDataSize()+AP4_CIPHER_BLOCK_SIZE-1)/AP4_CIPHER_BLOCK_SIZE;
return AP4_SUCCESS;
}
@@ -1017,18 +963,14 @@ AP4_OmaDcfDecryptingProcessor::AP4_OmaDcfDecryptingProcessor(
const AP4_ProtectionKeyMap* key_map /* = NULL */,
AP4_BlockCipherFactory* block_cipher_factory /* = NULL */)
{
- if(key_map)
- {
+ if (key_map) {
// copy the keys
m_KeyMap.SetKeys(*key_map);
}
-
- if(block_cipher_factory == NULL)
- {
+
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -1036,26 +978,20 @@ AP4_OmaDcfDecryptingProcessor::AP4_OmaDcfDecryptingProcessor(
/*----------------------------------------------------------------------
| AP4_OmaDcfDecryptingProcessor:Initialize
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_OmaDcfDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
- AP4_ByteStream& /* stream */,
- ProgressListener* listener)
+AP4_Result
+AP4_OmaDcfDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
+ AP4_ByteStream& /* stream */,
+ ProgressListener* listener)
{
// decide which processor to instantiate based on the file type
AP4_FtypAtom* ftyp = AP4_DYNAMIC_CAST(AP4_FtypAtom, top_level.GetChild(AP4_ATOM_TYPE_FTYP));
- if(ftyp)
- {
- if(ftyp->GetMajorBrand() == AP4_OMA_DCF_BRAND_ODCF || ftyp->HasCompatibleBrand(AP4_OMA_DCF_BRAND_ODCF))
- {
+ if (ftyp) {
+ if (ftyp->GetMajorBrand() == AP4_OMA_DCF_BRAND_ODCF || ftyp->HasCompatibleBrand(AP4_OMA_DCF_BRAND_ODCF)) {
return AP4_OmaDcfAtomDecrypter::DecryptAtoms(top_level, listener, m_BlockCipherFactory, m_KeyMap);
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_FORMAT;
}
- }
- else
- {
+ } else {
return AP4_SUCCESS;
}
}
@@ -1064,15 +1000,12 @@ AP4_OmaDcfDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
| AP4_OmaDcfEncryptingProcessor:AP4_OmaDcfEncryptingProcessor
+---------------------------------------------------------------------*/
AP4_OmaDcfEncryptingProcessor::AP4_OmaDcfEncryptingProcessor(AP4_OmaDcfCipherMode cipher_mode,
- AP4_BlockCipherFactory* block_cipher_factory) :
+ AP4_BlockCipherFactory* block_cipher_factory) :
m_CipherMode(cipher_mode)
{
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -1080,45 +1013,40 @@ AP4_OmaDcfEncryptingProcessor::AP4_OmaDcfEncryptingProcessor(AP4_OmaDcfCipherMod
/*----------------------------------------------------------------------
| AP4_OmaDcfEncryptingProcessor::Initialize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_OmaDcfEncryptingProcessor::Initialize(AP4_AtomParent& top_level,
- AP4_ByteStream& /*stream*/,
- AP4_Processor::ProgressListener* /*listener*/)
+ AP4_ByteStream& /*stream*/,
+ AP4_Processor::ProgressListener* /*listener*/)
{
AP4_FtypAtom* ftyp = AP4_DYNAMIC_CAST(AP4_FtypAtom, top_level.GetChild(AP4_ATOM_TYPE_FTYP));
- if(ftyp)
- {
+ if (ftyp) {
// remove the atom, it will be replaced with a new one
top_level.RemoveChild(ftyp);
-
+
// keep the existing brand and compatible brands
AP4_Array<AP4_UI32> compatible_brands;
- compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount() + 1);
- for(unsigned int i = 0; i < ftyp->GetCompatibleBrands().ItemCount(); i++)
- {
+ compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount()+1);
+ for (unsigned int i=0; i<ftyp->GetCompatibleBrands().ItemCount(); i++) {
compatible_brands.Append(ftyp->GetCompatibleBrands()[i]);
}
-
+
// add the OMA compatible brand if it is not already there
- if(!ftyp->HasCompatibleBrand(AP4_OMA_DCF_BRAND_OPF2))
- {
+ if (!ftyp->HasCompatibleBrand(AP4_OMA_DCF_BRAND_OPF2)) {
compatible_brands.Append(AP4_OMA_DCF_BRAND_OPF2);
}
// create a replacement
AP4_FtypAtom* new_ftyp = new AP4_FtypAtom(ftyp->GetMajorBrand(),
- ftyp->GetMinorVersion(),
- &compatible_brands[0],
- compatible_brands.ItemCount());
+ ftyp->GetMinorVersion(),
+ &compatible_brands[0],
+ compatible_brands.ItemCount());
delete ftyp;
ftyp = new_ftyp;
- }
- else
- {
+ } else {
AP4_UI32 opf2 = AP4_OMA_DCF_BRAND_OPF2;
ftyp = new AP4_FtypAtom(AP4_FTYP_BRAND_ISOM, 0, &opf2, 1);
}
-
+
// insert the ftyp atom as the first child
return top_level.AddChild(ftyp, 0);
}
@@ -1126,79 +1054,73 @@ AP4_OmaDcfEncryptingProcessor::Initialize(AP4_AtomParent& top_l
/*----------------------------------------------------------------------
| AP4_OmaDcfEncryptingProcessor:CreateTrackHandler
+---------------------------------------------------------------------*/
-AP4_Processor::TrackHandler*
+AP4_Processor::TrackHandler*
AP4_OmaDcfEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// find the stsd atom
AP4_StsdAtom* stsd = AP4_DYNAMIC_CAST(AP4_StsdAtom, trak->FindChild("mdia/minf/stbl/stsd"));
// avoid tracks with no stsd atom (should not happen)
- if(stsd == NULL) return NULL;
+ if (stsd == NULL) return NULL;
// only look at the first sample description
AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
- if(entry == NULL) return NULL;
-
+ if (entry == NULL) return NULL;
+
// create a handler for this track if we have a key for it and we know
// how to map the type
const AP4_UI08* key;
const AP4_UI08* iv;
AP4_UI32 format = 0;
- if(AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv)))
- {
- switch(entry->GetType())
- {
- case AP4_ATOM_TYPE_MP4A:
- format = AP4_ATOM_TYPE_ENCA;
- break;
-
- case AP4_ATOM_TYPE_MP4V:
- case AP4_ATOM_TYPE_AVC1:
- format = AP4_ATOM_TYPE_ENCV;
- break;
-
- default:
- {
- // try to find if this is audio or video
- AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, trak->FindChild("mdia/hdlr"));
- if(hdlr)
- {
- switch(hdlr->GetHandlerType())
- {
- case AP4_HANDLER_TYPE_SOUN:
- format = AP4_ATOM_TYPE_ENCA;
- break;
-
- case AP4_HANDLER_TYPE_VIDE:
- format = AP4_ATOM_TYPE_ENCV;
- break;
+ if (AP4_SUCCEEDED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv))) {
+ switch (entry->GetType()) {
+ case AP4_ATOM_TYPE_MP4A:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ case AP4_ATOM_TYPE_AVC1:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+
+ default: {
+ // try to find if this is audio or video
+ AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, trak->FindChild("mdia/hdlr"));
+ if (hdlr) {
+ switch (hdlr->GetHandlerType()) {
+ case AP4_HANDLER_TYPE_SOUN:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_HANDLER_TYPE_VIDE:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+ }
}
+ break;
}
- break;
}
- }
- if(format)
- {
+ if (format) {
const char* content_id = m_PropertyMap.GetProperty(trak->GetId(), "ContentId");
const char* rights_issuer_url = m_PropertyMap.GetProperty(trak->GetId(), "RightsIssuerUrl");
AP4_DataBuffer textual_headers;
AP4_Result result = m_PropertyMap.GetTextualHeaders(trak->GetId(), textual_headers);
- if(AP4_FAILED(result)) textual_headers.SetDataSize(0);
-
+ if (AP4_FAILED(result)) textual_headers.SetDataSize(0);
+
// create the block cipher
AP4_BlockCipher* block_cipher = NULL;
- result = m_BlockCipherFactory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- AP4_CIPHER_BLOCK_SIZE,
+ result = m_BlockCipherFactory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ AP4_CIPHER_BLOCK_SIZE,
block_cipher);
- if(AP4_FAILED(result)) return NULL;
- return new AP4_OmaDcfTrackEncrypter(m_CipherMode,
- block_cipher,
- iv,
- entry,
- format,
- content_id,
+ if (AP4_FAILED(result)) return NULL;
+ return new AP4_OmaDcfTrackEncrypter(m_CipherMode,
+ block_cipher,
+ iv,
+ entry,
+ format,
+ content_id,
rights_issuer_url,
textual_headers.GetData(),
textual_headers.GetDataSize());
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.h
index 038296c5c..806f6f0db 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4OmaDcf.h
@@ -51,13 +51,12 @@ class AP4_CtrStreamCipher;
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_OMA = AP4_ATOM_TYPE('o', 'd', 'k', 'm');
+const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_OMA = AP4_ATOM_TYPE('o','d','k','m');
const AP4_UI32 AP4_PROTECTION_SCHEME_VERSION_OMA_20 = 0x00000200;
-const AP4_UI32 AP4_OMA_DCF_BRAND_ODCF = AP4_ATOM_TYPE('o', 'd', 'c', 'f');
-const AP4_UI32 AP4_OMA_DCF_BRAND_OPF2 = AP4_ATOM_TYPE('o', 'p', 'f', '2');
+const AP4_UI32 AP4_OMA_DCF_BRAND_ODCF = AP4_ATOM_TYPE('o','d','c','f');
+const AP4_UI32 AP4_OMA_DCF_BRAND_OPF2 = AP4_ATOM_TYPE('o','p','f','2');
-typedef enum
-{
+typedef enum {
AP4_OMA_DCF_CIPHER_MODE_CTR,
AP4_OMA_DCF_CIPHER_MODE_CBC
} AP4_OmaDcfCipherMode;
@@ -65,11 +64,10 @@ typedef enum
/*----------------------------------------------------------------------
| AP4_OmaDcfAtomDecrypter
+---------------------------------------------------------------------*/
-class AP4_OmaDcfAtomDecrypter
-{
+class AP4_OmaDcfAtomDecrypter {
public:
// class methods
- static AP4_Result DecryptAtoms(AP4_AtomParent& atoms,
+ static AP4_Result DecryptAtoms(AP4_AtomParent& atoms,
AP4_Processor::ProgressListener* listener,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_ProtectionKeyMap& key_map);
@@ -77,22 +75,22 @@ public:
// Returns a byte stream that will produce the decrypted data found
// in the 'odda' child atom of an 'odrm' atom
static AP4_Result CreateDecryptingStream(AP4_ContainerAtom& odrm_atom,
- const AP4_UI08* key,
- AP4_Size key_size,
- AP4_BlockCipherFactory* block_cipher_factory,
- AP4_ByteStream*& stream);
+ const AP4_UI08* key,
+ AP4_Size key_size,
+ AP4_BlockCipherFactory* block_cipher_factory,
+ AP4_ByteStream*& stream);
// Returns a byte stream that will produce the decrypted data from
// an encrypted stream where the IV follows the encrypted bytes.
- // This method is normally not called directly: most callers will call
+ // This method is normally not called directly: most callers will call
// the stream factory that takes an 'odrm' atom as an input parameter
static AP4_Result CreateDecryptingStream(AP4_OmaDcfCipherMode mode,
- AP4_ByteStream& encrypted_stream,
- AP4_LargeSize cleartext_size,
- const AP4_UI08* key,
- AP4_Size key_size,
- AP4_BlockCipherFactory* block_cipher_factory,
- AP4_ByteStream*& stream);
+ AP4_ByteStream& encrypted_stream,
+ AP4_LargeSize cleartext_size,
+ const AP4_UI08* key,
+ AP4_Size key_size,
+ AP4_BlockCipherFactory* block_cipher_factory,
+ AP4_ByteStream*& stream);
};
/*----------------------------------------------------------------------
@@ -102,8 +100,8 @@ class AP4_OmaDcfSampleDecrypter : public AP4_SampleDecrypter
{
public:
// factory
- static AP4_Result Create(AP4_ProtectedSampleDescription* sample_description,
- const AP4_UI08* key,
+ static AP4_Result Create(AP4_ProtectedSampleDescription* sample_description,
+ const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_OmaDcfSampleDecrypter*& cipher);
@@ -168,8 +166,7 @@ private:
/*----------------------------------------------------------------------
| AP4_OmaDcfTrackDecrypter
+---------------------------------------------------------------------*/
-class AP4_OmaDcfTrackDecrypter : public AP4_Processor::TrackHandler
-{
+class AP4_OmaDcfTrackDecrypter : public AP4_Processor::TrackHandler {
public:
// constructor
static AP4_Result Create(const AP4_UI08* key,
@@ -265,12 +262,12 @@ private:
// members
AP4_CbcStreamCipher* m_Cipher;
};
-
+
/*----------------------------------------------------------------------
| AP4_OmaDcfDecryptingProcessor
+---------------------------------------------------------------------*/
/**
- * Use for DCF only, not PDCF. For PDCF, use the
+ * Use for DCF only, not PDCF. For PDCF, use the
* AP4_StandardDecryptingProcessor class
*/
class AP4_OmaDcfDecryptingProcessor : public AP4_Processor
@@ -281,10 +278,7 @@ public:
AP4_BlockCipherFactory* block_cipher_factory = NULL);
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
// methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level,
@@ -308,14 +302,8 @@ public:
AP4_BlockCipherFactory* block_cipher_factory = NULL);
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
- AP4_TrackPropertyMap& GetPropertyMap()
- {
- return m_PropertyMap;
- }
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
+ AP4_TrackPropertyMap& GetPropertyMap() { return m_PropertyMap; }
// AP4_Processor methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.cpp
index a400b4073..f442658ff 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.cpp
@@ -49,12 +49,10 @@
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-AP4_UI08 const AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM[16] =
-{
+AP4_UI08 const AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM[16] = {
0x89, 0x74, 0xdb, 0xce, 0x7b, 0xe7, 0x4c, 0x51, 0x84, 0xf9, 0x71, 0x48, 0xf9, 0x88, 0x25, 0x54
};
-AP4_UI08 const AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM[16] =
-{
+AP4_UI08 const AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM[16] = {
0xA2, 0x39, 0x4F, 0x52, 0x5A, 0x9B, 0x4f, 0x14, 0xA2, 0x44, 0x6C, 0x42, 0x7C, 0x64, 0x8D, 0xF4
};
@@ -69,9 +67,9 @@ AP4_PiffCtrSampleEncrypter::AP4_PiffCtrSampleEncrypter(AP4_BlockCipher* block_ci
/*----------------------------------------------------------------------
| AP4_PiffCtrSampleEncrypter::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffCtrSampleEncrypter::EncryptSampleData(AP4_DataBuffer& /*data_in */,
- AP4_DataBuffer& /*data_out*/)
+ AP4_DataBuffer& /*data_out*/)
{
return AP4_ERROR_NOT_SUPPORTED; // FIXME: not implemented yet
}
@@ -87,9 +85,9 @@ AP4_PiffCtrSampleEncrypter::~AP4_PiffCtrSampleEncrypter()
/*----------------------------------------------------------------------
| AP4_PiffAvcCtrSampleEncrypter::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffAvcCtrSampleEncrypter::EncryptSampleData(AP4_DataBuffer& /*data_in */,
- AP4_DataBuffer& /*data_out*/)
+ AP4_DataBuffer& /*data_out*/)
{
return AP4_ERROR_NOT_SUPPORTED; // FIXME: not implemented yet
}
@@ -105,9 +103,9 @@ AP4_PiffCbcSampleEncrypter::AP4_PiffCbcSampleEncrypter(AP4_BlockCipher* block_ci
/*----------------------------------------------------------------------
| AP4_PiffCbcSampleEncrypter::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffCbcSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out)
+ AP4_DataBuffer& data_out)
{
// the output has the same size as the input
data_out.SetDataSize(data_in.GetDataSize());
@@ -115,28 +113,26 @@ AP4_PiffCbcSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
// setup direct pointers to the buffers
const AP4_UI08* in = data_in.GetData();
AP4_UI08* out = data_out.UseData();
-
+
// setup the IV
m_Cipher->SetIV(m_Iv);
// process the sample data
- unsigned int block_count = data_in.GetDataSize() / 16;
- if(block_count)
- {
+ unsigned int block_count = data_in.GetDataSize()/16;
+ if (block_count) {
AP4_Size out_size = data_out.GetDataSize();
- AP4_Result result = m_Cipher->ProcessBuffer(in, block_count * 16, out, &out_size, false);
- if(AP4_FAILED(result)) return result;
- in += block_count * 16;
- out += block_count * 16;
-
+ AP4_Result result = m_Cipher->ProcessBuffer(in, block_count*16, out, &out_size, false);
+ if (AP4_FAILED(result)) return result;
+ in += block_count*16;
+ out += block_count*16;
+
// update the IV (last cipherblock emitted)
- AP4_CopyMemory(m_Iv, out - 16, 16);
+ AP4_CopyMemory(m_Iv, out-16, 16);
}
-
+
// any partial block at the end remains in the clear
- unsigned int partial = data_in.GetDataSize() % 16;
- if(partial)
- {
+ unsigned int partial = data_in.GetDataSize()%16;
+ if (partial) {
AP4_CopyMemory(out, in, partial);
}
return AP4_SUCCESS;
@@ -153,66 +149,62 @@ AP4_PiffCbcSampleEncrypter::~AP4_PiffCbcSampleEncrypter()
/*----------------------------------------------------------------------
| AP4_PiffAvcCbcSampleEncrypter::EncryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffAvcCbcSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out)
-{
+ AP4_DataBuffer& data_out)
+{
// the output has the same size as the input
data_out.SetDataSize(data_in.GetDataSize());
// check some basics
- if(data_in.GetDataSize() == 0) return AP4_SUCCESS;
+ if (data_in.GetDataSize() == 0) return AP4_SUCCESS;
// setup direct pointers to the buffers
const AP4_UI08* in = data_in.GetData();
AP4_UI08* out = data_out.UseData();
-
+
// setup the IV
m_Cipher->SetIV(m_Iv);
// process the sample data, one NALU at a time
- const AP4_UI08* in_end = data_in.GetData() + data_in.GetDataSize();
- while((AP4_Size)(in_end - in) > 1 + m_NaluLengthSize)
- {
+ const AP4_UI08* in_end = data_in.GetData()+data_in.GetDataSize();
+ while ((AP4_Size)(in_end-in) > 1+m_NaluLengthSize) {
unsigned int nalu_length;
- switch(m_NaluLengthSize)
- {
- case 1:
- nalu_length = *in;
- break;
-
- case 2:
- nalu_length = AP4_BytesToUInt16BE(in);
- break;
-
- case 4:
- nalu_length = AP4_BytesToUInt32BE(in);
- break;
-
- default:
- return AP4_ERROR_INVALID_FORMAT;
+ switch (m_NaluLengthSize) {
+ case 1:
+ nalu_length = *in;
+ break;
+
+ case 2:
+ nalu_length = AP4_BytesToUInt16BE(in);
+ break;
+
+ case 4:
+ nalu_length = AP4_BytesToUInt32BE(in);
+ break;
+
+ default:
+ return AP4_ERROR_INVALID_FORMAT;
}
- unsigned int chunk_size = m_NaluLengthSize + nalu_length;
- unsigned int cleartext_size = chunk_size % 16;
- unsigned int block_count = chunk_size / 16;
- if(cleartext_size < m_NaluLengthSize + 1)
- {
+ unsigned int chunk_size = m_NaluLengthSize+nalu_length;
+ unsigned int cleartext_size = chunk_size%16;
+ unsigned int block_count = chunk_size/16;
+ if (cleartext_size < m_NaluLengthSize+1) {
AP4_ASSERT(block_count);
--block_count;
cleartext_size += 16;
}
-
+
// copy the cleartext portion
AP4_CopyMemory(out, in, cleartext_size);
-
+
// encrypt the rest
- if(block_count)
- {
- AP4_Size out_size = block_count * 16;
- m_Cipher->ProcessBuffer(in + cleartext_size, block_count * 16, out + cleartext_size, &out_size, false);
+ if (block_count) {
+ AP4_Size out_size = block_count*16;
+ m_Cipher->ProcessBuffer(in+cleartext_size, block_count*16, out+cleartext_size, &out_size, false);
}
-
+
// move the pointers
in += chunk_size;
out += chunk_size;
@@ -223,8 +215,7 @@ AP4_PiffAvcCbcSampleEncrypter::EncryptSampleData(AP4_DataBuffer& data_in,
/*----------------------------------------------------------------------
| AP4_PiffTrackEncrypter
+---------------------------------------------------------------------*/
-class AP4_PiffTrackEncrypter : public AP4_Processor::TrackHandler
-{
+class AP4_PiffTrackEncrypter : public AP4_Processor::TrackHandler {
public:
// constructor
AP4_PiffTrackEncrypter(AP4_UI32 default_algorithm_id,
@@ -268,7 +259,7 @@ AP4_PiffTrackEncrypter::AP4_PiffTrackEncrypter(
/*----------------------------------------------------------------------
| AP4_PiffTrackEncrypter::ProcessTrack
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffTrackEncrypter::ProcessTrack()
{
// sinf container
@@ -276,17 +267,17 @@ AP4_PiffTrackEncrypter::ProcessTrack()
// original format
AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType());
-
+
// scheme info
AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI);
- AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_PROTECTION_SCHEME_TYPE_PIFF,
- AP4_PROTECTION_SCHEME_VERSION_PIFF_10);
- AP4_PiffTrackEncryptionAtom* piff_enc =
- new AP4_PiffTrackEncryptionAtom(m_DefaultAlgorithmId,
- m_DefaultIvSize,
+ AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_PROTECTION_SCHEME_TYPE_PIFF,
+ AP4_PROTECTION_SCHEME_VERSION_PIFF_10);
+ AP4_PiffTrackEncryptionAtom* piff_enc =
+ new AP4_PiffTrackEncryptionAtom(m_DefaultAlgorithmId,
+ m_DefaultIvSize,
m_DefaultKid);
schi->AddChild(piff_enc);
-
+
// populate the sinf container
sinf->AddChild(frma);
sinf->AddChild(schm);
@@ -297,14 +288,14 @@ AP4_PiffTrackEncrypter::ProcessTrack()
// change the atom type of the sample description
m_SampleEntry->SetType(m_Format);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffTrackEncrypter::ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out)
{
@@ -314,8 +305,7 @@ AP4_PiffTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
/*----------------------------------------------------------------------
| AP4_PiffFragmentEncrypter
+---------------------------------------------------------------------*/
-class AP4_PiffFragmentEncrypter : public AP4_Processor::FragmentHandler
-{
+class AP4_PiffFragmentEncrypter : public AP4_Processor::FragmentHandler {
public:
// constructor
AP4_PiffFragmentEncrypter(AP4_ContainerAtom* traf,
@@ -339,7 +329,7 @@ private:
| AP4_PiffFragmentEncrypter::AP4_PiffFragmentEncrypter
+---------------------------------------------------------------------*/
AP4_PiffFragmentEncrypter::AP4_PiffFragmentEncrypter(AP4_ContainerAtom* traf,
- AP4_PiffEncryptingProcessor::Encrypter* encrypter) :
+ AP4_PiffEncryptingProcessor::Encrypter* encrypter) :
m_Traf(traf),
m_SampleEncryptionAtom(NULL),
m_Encrypter(encrypter),
@@ -350,39 +340,36 @@ AP4_PiffFragmentEncrypter::AP4_PiffFragmentEncrypter(AP4_ContainerAtom*
/*----------------------------------------------------------------------
| AP4_PiffFragmentEncrypter::ProcessFragment
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffFragmentEncrypter::ProcessFragment()
{
// count the number of samples and create IVs
unsigned int sample_count = 0;
- for(AP4_List<AP4_Atom>::Item* item = m_Traf->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ for (AP4_List<AP4_Atom>::Item* item = m_Traf->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* child = item->GetData();
- if(child->GetType() == AP4_ATOM_TYPE_TRUN)
- {
+ if (child->GetType() == AP4_ATOM_TYPE_TRUN) {
AP4_TrunAtom* trun = AP4_DYNAMIC_CAST(AP4_TrunAtom, child);
- if(trun)
- {
+ if (trun) {
sample_count += trun->GetEntries().ItemCount();
}
}
}
-
+
// create a sample encryption atom
m_SampleEncryptionAtom = new AP4_PiffSampleEncryptionAtom(sample_count);
// add the atom to the traf container
m_Traf->AddChild(m_SampleEncryptionAtom);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffFragmentEncrypter::FinishFragment
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffFragmentEncrypter::FinishFragment()
{
return AP4_SUCCESS;
@@ -391,13 +378,13 @@ AP4_PiffFragmentEncrypter::FinishFragment()
/*----------------------------------------------------------------------
| AP4_PiffFragmentEncrypter::ProcessSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffFragmentEncrypter::ProcessSample(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out)
+ AP4_DataBuffer& data_out)
{
// store the IV for this sample
m_SampleEncryptionAtom->SetIv(m_IvIndex++, m_Encrypter->m_SampleEncrypter->GetIv());
-
+
// encrypt the sample
AP4_Result result = m_Encrypter->m_SampleEncrypter->EncryptSampleData(data_in, data_out);
return result;
@@ -407,16 +394,13 @@ AP4_PiffFragmentEncrypter::ProcessSample(AP4_DataBuffer& data_in,
| AP4_PiffEncryptingProcessor:AP4_PiffEncryptingProcessor
+---------------------------------------------------------------------*/
AP4_PiffEncryptingProcessor::AP4_PiffEncryptingProcessor(AP4_PiffCipherMode cipher_mode,
- AP4_BlockCipherFactory* block_cipher_factory) :
+ AP4_BlockCipherFactory* block_cipher_factory) :
m_CipherMode(cipher_mode)
{
// create a block cipher factory if none is given
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -432,45 +416,40 @@ AP4_PiffEncryptingProcessor::~AP4_PiffEncryptingProcessor()
/*----------------------------------------------------------------------
| AP4_PiffEncryptingProcessor::Initialize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffEncryptingProcessor::Initialize(AP4_AtomParent& top_level,
AP4_ByteStream& /*stream*/,
AP4_Processor::ProgressListener* /*listener*/)
{
AP4_FtypAtom* ftyp = AP4_DYNAMIC_CAST(AP4_FtypAtom, top_level.GetChild(AP4_ATOM_TYPE_FTYP));
- if(ftyp)
- {
+ if (ftyp) {
// remove the atom, it will be replaced with a new one
top_level.RemoveChild(ftyp);
-
+
// keep the existing brand and compatible brands
AP4_Array<AP4_UI32> compatible_brands;
- compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount() + 1);
- for(unsigned int i = 0; i < ftyp->GetCompatibleBrands().ItemCount(); i++)
- {
+ compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount()+1);
+ for (unsigned int i=0; i<ftyp->GetCompatibleBrands().ItemCount(); i++) {
compatible_brands.Append(ftyp->GetCompatibleBrands()[i]);
}
-
+
// add the OMA compatible brand if it is not already there
- if(!ftyp->HasCompatibleBrand(AP4_PIFF_BRAND))
- {
+ if (!ftyp->HasCompatibleBrand(AP4_PIFF_BRAND)) {
compatible_brands.Append(AP4_PIFF_BRAND);
}
// create a replacement
AP4_FtypAtom* new_ftyp = new AP4_FtypAtom(ftyp->GetMajorBrand(),
- ftyp->GetMinorVersion(),
- &compatible_brands[0],
- compatible_brands.ItemCount());
+ ftyp->GetMinorVersion(),
+ &compatible_brands[0],
+ compatible_brands.ItemCount());
delete ftyp;
ftyp = new_ftyp;
- }
- else
- {
+ } else {
AP4_UI32 piff = AP4_PIFF_BRAND;
ftyp = new AP4_FtypAtom(AP4_FTYP_BRAND_ISOM, 0, &piff, 1);
}
-
+
// insert the ftyp atom as the first child
return top_level.AddChild(ftyp, 0);
}
@@ -478,116 +457,103 @@ AP4_PiffEncryptingProcessor::Initialize(AP4_AtomParent& top_lev
/*----------------------------------------------------------------------
| AP4_PiffEncryptingProcessor:CreateTrackHandler
+---------------------------------------------------------------------*/
-AP4_Processor::TrackHandler*
+AP4_Processor::TrackHandler*
AP4_PiffEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// find the stsd atom
AP4_StsdAtom* stsd = AP4_DYNAMIC_CAST(AP4_StsdAtom, trak->FindChild("mdia/minf/stbl/stsd"));
// avoid tracks with no stsd atom (should not happen)
- if(stsd == NULL) return NULL;
+ if (stsd == NULL) return NULL;
// only look at the first sample description
AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
- if(entry == NULL) return NULL;
-
+ if (entry == NULL) return NULL;
+
// create a handler for this track if we have a key for it and we know
// how to map the type
const AP4_UI08* key;
const AP4_UI08* iv;
- if(AP4_FAILED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv)))
- {
+ if (AP4_FAILED(m_KeyMap.GetKeyAndIv(trak->GetId(), key, iv))) {
return NULL;
}
-
+
AP4_UI32 format = 0;
- switch(entry->GetType())
- {
- case AP4_ATOM_TYPE_MP4A:
- format = AP4_ATOM_TYPE_ENCA;
- break;
-
- case AP4_ATOM_TYPE_MP4V:
- case AP4_ATOM_TYPE_AVC1:
- format = AP4_ATOM_TYPE_ENCV;
- break;
-
- default:
- {
- // try to find if this is audio or video
- AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, trak->FindChild("mdia/hdlr"));
- if(hdlr)
- {
- switch(hdlr->GetHandlerType())
- {
- case AP4_HANDLER_TYPE_SOUN:
- format = AP4_ATOM_TYPE_ENCA;
- break;
+ switch (entry->GetType()) {
+ case AP4_ATOM_TYPE_MP4A:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
- case AP4_HANDLER_TYPE_VIDE:
- format = AP4_ATOM_TYPE_ENCV;
- break;
+ case AP4_ATOM_TYPE_MP4V:
+ case AP4_ATOM_TYPE_AVC1:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+
+ default: {
+ // try to find if this is audio or video
+ AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, trak->FindChild("mdia/hdlr"));
+ if (hdlr) {
+ switch (hdlr->GetHandlerType()) {
+ case AP4_HANDLER_TYPE_SOUN:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_HANDLER_TYPE_VIDE:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+ }
}
+ break;
}
- break;
}
- }
- if(format == 0) return NULL;
-
+ if (format == 0) return NULL;
+
// get the track properties
- AP4_UI08 kid[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ AP4_UI08 kid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const char* kid_hex = m_PropertyMap.GetProperty(trak->GetId(), "KID");
- if(kid_hex && AP4_StringLength(kid_hex) == 32)
- {
+ if (kid_hex && AP4_StringLength(kid_hex) == 32) {
AP4_ParseHex(kid_hex, kid, 16);
}
-
+
// create the encrypter
AP4_Processor::TrackHandler* track_encrypter;
- track_encrypter = new AP4_PiffTrackEncrypter(m_CipherMode == AP4_PIFF_CIPHER_MODE_CBC ? AP4_PIFF_ALGORITHM_ID_CBC : AP4_PIFF_ALGORITHM_ID_CTR,
- 16,
- kid,
- entry,
- format);
-
+ track_encrypter = new AP4_PiffTrackEncrypter(m_CipherMode == AP4_PIFF_CIPHER_MODE_CBC?AP4_PIFF_ALGORITHM_ID_CBC:AP4_PIFF_ALGORITHM_ID_CTR,
+ 16,
+ kid,
+ entry,
+ format);
+
// create a block cipher
AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = m_BlockCipherFactory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- 16,
- block_cipher);
- if(AP4_FAILED(result)) return NULL;
-
+ AP4_Result result = m_BlockCipherFactory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ 16,
+ block_cipher);
+ if (AP4_FAILED(result)) return NULL;
+
// add a new cipher state for this track
AP4_PiffSampleEncrypter* sample_encrypter = NULL;
- switch(m_CipherMode)
- {
- case AP4_PIFF_CIPHER_MODE_CBC:
- if(entry->GetType() == AP4_ATOM_TYPE_AVC1)
- {
- AP4_AvccAtom* avcc = AP4_DYNAMIC_CAST(AP4_AvccAtom, entry->GetChild(AP4_ATOM_TYPE_AVCC));
- if(avcc == NULL) return NULL;
- sample_encrypter = new AP4_PiffAvcCbcSampleEncrypter(block_cipher, avcc->GetNaluLengthSize());
- }
- else
- {
- sample_encrypter = new AP4_PiffCbcSampleEncrypter(block_cipher);
- }
- break;
-
- case AP4_PIFF_CIPHER_MODE_CTR:
- if(entry->GetType() == AP4_ATOM_TYPE_AVC1)
- {
- AP4_AvccAtom* avcc = AP4_DYNAMIC_CAST(AP4_AvccAtom, entry->GetChild(AP4_ATOM_TYPE_AVCC));
- if(avcc == NULL) return NULL;
- sample_encrypter = new AP4_PiffAvcCtrSampleEncrypter(block_cipher, avcc->GetNaluLengthSize());
- }
- else
- {
- sample_encrypter = new AP4_PiffCtrSampleEncrypter(block_cipher);
- }
- break;
+ switch (m_CipherMode) {
+ case AP4_PIFF_CIPHER_MODE_CBC:
+ if (entry->GetType() == AP4_ATOM_TYPE_AVC1) {
+ AP4_AvccAtom* avcc = AP4_DYNAMIC_CAST(AP4_AvccAtom, entry->GetChild(AP4_ATOM_TYPE_AVCC));
+ if (avcc == NULL) return NULL;
+ sample_encrypter = new AP4_PiffAvcCbcSampleEncrypter(block_cipher, avcc->GetNaluLengthSize());
+ } else {
+ sample_encrypter = new AP4_PiffCbcSampleEncrypter(block_cipher);
+ }
+ break;
+
+ case AP4_PIFF_CIPHER_MODE_CTR:
+ if (entry->GetType() == AP4_ATOM_TYPE_AVC1) {
+ AP4_AvccAtom* avcc = AP4_DYNAMIC_CAST(AP4_AvccAtom, entry->GetChild(AP4_ATOM_TYPE_AVCC));
+ if (avcc == NULL) return NULL;
+ sample_encrypter = new AP4_PiffAvcCtrSampleEncrypter(block_cipher, avcc->GetNaluLengthSize());
+ } else {
+ sample_encrypter = new AP4_PiffCtrSampleEncrypter(block_cipher);
+ }
+ break;
}
sample_encrypter->SetIv(iv);
m_Encrypters.Add(new Encrypter(trak->GetId(), sample_encrypter));
@@ -598,184 +564,160 @@ AP4_PiffEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
/*----------------------------------------------------------------------
| AP4_PiffEncryptingProcessor:CreateFragmentHandler
+---------------------------------------------------------------------*/
-AP4_Processor::FragmentHandler*
+AP4_Processor::FragmentHandler*
AP4_PiffEncryptingProcessor::CreateFragmentHandler(AP4_ContainerAtom* traf)
{
// get the traf header (tfhd) for this track fragment so we can get the track ID
AP4_TfhdAtom* tfhd = AP4_DYNAMIC_CAST(AP4_TfhdAtom, traf->GetChild(AP4_ATOM_TYPE_TFHD));
- if(tfhd == NULL) return NULL;
-
+ if (tfhd == NULL) return NULL;
+
// lookup the encrypter for this track
Encrypter* encrypter = NULL;
- for(AP4_List<Encrypter>::Item* item = m_Encrypters.FirstItem();
- item;
- item = item->GetNext())
- {
- if(item->GetData()->m_TrackId == tfhd->GetTrackId())
- {
+ for (AP4_List<Encrypter>::Item* item = m_Encrypters.FirstItem();
+ item;
+ item = item->GetNext()) {
+ if (item->GetData()->m_TrackId == tfhd->GetTrackId()) {
encrypter = item->GetData();
break;
}
}
- if(encrypter == NULL) return NULL;
+ if (encrypter == NULL) return NULL;
return new AP4_PiffFragmentEncrypter(traf, encrypter);
}
/*----------------------------------------------------------------------
| AP4_PiffSampleDecrypter::Create
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_PiffSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
+AP4_Result
+AP4_PiffSampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
AP4_ContainerAtom* traf,
- const AP4_UI08* key,
+ const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_PiffSampleDecrypter*& decrypter)
{
// check the parameters
- if(key == NULL || block_cipher_factory == NULL)
- {
+ if (key == NULL || block_cipher_factory == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
// default return value
decrypter = NULL;
-
- // check the sample description
- if(sample_description->GetSchemeType() != AP4_PROTECTION_SCHEME_TYPE_PIFF)
- {
+
+ // check the sample description
+ if (sample_description->GetSchemeType() != AP4_PROTECTION_SCHEME_TYPE_PIFF) {
return AP4_ERROR_INVALID_PARAMETERS;
}
-
+
// get the scheme info atom
AP4_ContainerAtom* schi = sample_description->GetSchemeInfo()->GetSchiAtom();
- if(schi == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (schi == NULL) return AP4_ERROR_INVALID_FORMAT;
// look for a track encryption atom
- AP4_PiffTrackEncryptionAtom* track_encryption_atom =
+ AP4_PiffTrackEncryptionAtom* track_encryption_atom =
AP4_DYNAMIC_CAST(AP4_PiffTrackEncryptionAtom, schi->GetChild(AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM));
-
+
// look for a sample encryption atom
AP4_PiffSampleEncryptionAtom* sample_encryption_atom = NULL;
- if(traf)
- {
+ if (traf) {
sample_encryption_atom = AP4_DYNAMIC_CAST(AP4_PiffSampleEncryptionAtom, traf->GetChild(AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM));
- if(sample_encryption_atom == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (sample_encryption_atom == NULL) return AP4_ERROR_INVALID_FORMAT;
}
// create the block cipher needed to decrypt the samples
AP4_UI32 algorithm_id;
unsigned int iv_size;
- if(sample_encryption_atom &&
- sample_encryption_atom->GetFlags() & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS)
- {
+ if (sample_encryption_atom &&
+ sample_encryption_atom->GetFlags() & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS) {
algorithm_id = sample_encryption_atom->GetAlgorithmId();
iv_size = sample_encryption_atom->GetIvSize();
- }
- else
- {
- if(track_encryption_atom == NULL) return AP4_ERROR_INVALID_FORMAT;
+ } else {
+ if (track_encryption_atom == NULL) return AP4_ERROR_INVALID_FORMAT;
algorithm_id = track_encryption_atom->GetDefaultAlgorithmId();
iv_size = track_encryption_atom->GetDefaultIvSize();
}
- switch(algorithm_id)
- {
- case AP4_PIFF_ALGORITHM_ID_NONE:
- decrypter = new AP4_PiffNullSampleDecrypter();
- break;
-
- case AP4_PIFF_ALGORITHM_ID_CTR:
- if(iv_size != 8 && iv_size != 16)
- {
- return AP4_ERROR_INVALID_FORMAT;
- }
- else
- {
- // create the block cipher
- AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::ENCRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
-
- // create the decrypter
- if(sample_description->GetOriginalFormat() == AP4_ATOM_TYPE_AVC1)
- {
- AP4_AvcSampleDescription* avc_desc = AP4_DYNAMIC_CAST(AP4_AvcSampleDescription, sample_description->GetOriginalSampleDescription());
- if(avc_desc == NULL)
- {
- return AP4_ERROR_INVALID_FORMAT;
+ switch (algorithm_id) {
+ case AP4_PIFF_ALGORITHM_ID_NONE:
+ decrypter = new AP4_PiffNullSampleDecrypter();
+ break;
+
+ case AP4_PIFF_ALGORITHM_ID_CTR:
+ if (iv_size != 8 && iv_size != 16) {
+ return AP4_ERROR_INVALID_FORMAT;
+ } else {
+ // create the block cipher
+ AP4_BlockCipher* block_cipher = NULL;
+ AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::ENCRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
+
+ // create the decrypter
+ if (sample_description->GetOriginalFormat() == AP4_ATOM_TYPE_AVC1) {
+ AP4_AvcSampleDescription* avc_desc = AP4_DYNAMIC_CAST(AP4_AvcSampleDescription, sample_description->GetOriginalSampleDescription());
+ if (avc_desc == NULL) {
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+ decrypter = new AP4_PiffAvcCbcSampleDecrypter(block_cipher,
+ sample_encryption_atom,
+ avc_desc->GetNaluLengthSize());
+
+ } else {
+ decrypter = new AP4_PiffCbcSampleDecrypter(block_cipher,
+ sample_encryption_atom);
}
- decrypter = new AP4_PiffAvcCbcSampleDecrypter(block_cipher,
- sample_encryption_atom,
- avc_desc->GetNaluLengthSize());
-
}
- else
- {
- decrypter = new AP4_PiffCbcSampleDecrypter(block_cipher,
- sample_encryption_atom);
- }
- }
- break;
-
- case AP4_PIFF_ALGORITHM_ID_CBC:
- if(iv_size != 16)
- {
- return AP4_ERROR_INVALID_FORMAT;
- }
- else
- {
- // create the block cipher
- AP4_BlockCipher* block_cipher = NULL;
- AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- AP4_BlockCipher::DECRYPT,
- key,
- key_size,
- block_cipher);
- if(AP4_FAILED(result)) return result;
-
- // create the decrypter
- if(sample_description->GetOriginalFormat() == AP4_ATOM_TYPE_AVC1)
- {
- AP4_AvcSampleDescription* avc_desc = AP4_DYNAMIC_CAST(AP4_AvcSampleDescription, sample_description->GetOriginalSampleDescription());
- if(avc_desc == NULL)
- {
- return AP4_ERROR_INVALID_FORMAT;
+ break;
+
+ case AP4_PIFF_ALGORITHM_ID_CBC:
+ if (iv_size != 16) {
+ return AP4_ERROR_INVALID_FORMAT;
+ } else {
+ // create the block cipher
+ AP4_BlockCipher* block_cipher = NULL;
+ AP4_Result result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
+ AP4_BlockCipher::DECRYPT,
+ key,
+ key_size,
+ block_cipher);
+ if (AP4_FAILED(result)) return result;
+
+ // create the decrypter
+ if (sample_description->GetOriginalFormat() == AP4_ATOM_TYPE_AVC1) {
+ AP4_AvcSampleDescription* avc_desc = AP4_DYNAMIC_CAST(AP4_AvcSampleDescription, sample_description->GetOriginalSampleDescription());
+ if (avc_desc == NULL) {
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+ decrypter = new AP4_PiffAvcCbcSampleDecrypter(block_cipher,
+ sample_encryption_atom,
+ avc_desc->GetNaluLengthSize());
+ } else {
+ decrypter = new AP4_PiffCbcSampleDecrypter(block_cipher,
+ sample_encryption_atom);
}
- decrypter = new AP4_PiffAvcCbcSampleDecrypter(block_cipher,
- sample_encryption_atom,
- avc_desc->GetNaluLengthSize());
}
- else
- {
- decrypter = new AP4_PiffCbcSampleDecrypter(block_cipher,
- sample_encryption_atom);
- }
- }
- break;
-
- default:
- return AP4_ERROR_NOT_SUPPORTED;
+ break;
+
+ default:
+ return AP4_ERROR_NOT_SUPPORTED;
}
return AP4_SUCCESS;
}
-
+
/*----------------------------------------------------------------------
| AP4_PiffSampleDecrypter::SetSampleIndex
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffSampleDecrypter::SetSampleIndex(AP4_Ordinal sample_index)
{
- if(sample_index < m_SampleEncryptionAtom->GetIvCount())
- {
+ if (sample_index < m_SampleEncryptionAtom->GetIvCount()) {
return AP4_ERROR_OUT_OF_RANGE;
}
m_SampleIndex = sample_index;
-
+
return AP4_SUCCESS;
}
@@ -803,10 +745,10 @@ AP4_PiffCtrSampleDecrypter::~AP4_PiffCtrSampleDecrypter()
/*----------------------------------------------------------------------
| AP4_PiffCtrSampleDecrypter::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffCtrSampleDecrypter::DecryptSampleData(AP4_DataBuffer& /*data_in */,
- AP4_DataBuffer& /*data_out*/,
- const AP4_UI08* /*iv */)
+ AP4_DataBuffer& /*data_out*/,
+ const AP4_UI08* /*iv */)
{
return AP4_ERROR_NOT_SUPPORTED; // FIXME: not implemented yet
}
@@ -814,10 +756,10 @@ AP4_PiffCtrSampleDecrypter::DecryptSampleData(AP4_DataBuffer& /*data_in */,
/*----------------------------------------------------------------------
| AP4_PiffAvcCtrSampleDecrypter::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffAvcCtrSampleDecrypter::DecryptSampleData(AP4_DataBuffer& /*data_in */,
- AP4_DataBuffer& /*data_out*/,
- const AP4_UI08* /*iv */)
+ AP4_DataBuffer& /*data_out*/,
+ const AP4_UI08* /*iv */)
{
return AP4_ERROR_NOT_SUPPORTED; // FIXME: not implemented yet
}
@@ -844,10 +786,10 @@ AP4_PiffCbcSampleDecrypter::~AP4_PiffCbcSampleDecrypter()
/*----------------------------------------------------------------------
| AP4_PiffCbcSampleDecrypter::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out,
- const AP4_UI08* iv)
+ AP4_DataBuffer& data_out,
+ const AP4_UI08* iv)
{
// the output has the same size as the input
data_out.SetDataSize(data_in.GetDataSize());
@@ -857,46 +799,43 @@ AP4_PiffCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
AP4_UI08* out = data_out.UseData();
// setup the IV
- if(iv == NULL)
- {
- if(m_SampleEncryptionAtom == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ if (iv == NULL) {
+ if (m_SampleEncryptionAtom == NULL) return AP4_ERROR_INVALID_PARAMETERS;
iv = m_SampleEncryptionAtom->GetIv(m_SampleIndex);
- if(iv == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (iv == NULL) return AP4_ERROR_INVALID_FORMAT;
}
m_Cipher->SetIV(iv);
-
+
// process the sample data
- unsigned int block_count = data_in.GetDataSize() / 16;
- if(block_count)
- {
+ unsigned int block_count = data_in.GetDataSize()/16;
+ if (block_count) {
AP4_Size out_size = data_out.GetDataSize();
- AP4_Result result = m_Cipher->ProcessBuffer(in, block_count * 16, out, &out_size, false);
- if(AP4_FAILED(result)) return result;
- AP4_ASSERT(out_size == block_count * 16);
- in += block_count * 16;
- out += block_count * 16;
+ AP4_Result result = m_Cipher->ProcessBuffer(in, block_count*16, out, &out_size, false);
+ if (AP4_FAILED(result)) return result;
+ AP4_ASSERT(out_size == block_count*16);
+ in += block_count*16;
+ out += block_count*16;
}
-
+
// any partial block at the end remains in the clear
- unsigned int partial = data_in.GetDataSize() % 16;
- if(partial)
- {
+ unsigned int partial = data_in.GetDataSize()%16;
+ if (partial) {
AP4_CopyMemory(out, in, partial);
}
-
+
// move on to the next sample
++m_SampleIndex;
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffAvcCbcSampleDecrypter::DecryptSampleData
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffAvcCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out,
- const AP4_UI08* iv)
+ AP4_DataBuffer& data_out,
+ const AP4_UI08* iv)
{
// the output has the same size as the input
data_out.SetDataSize(data_in.GetDataSize());
@@ -906,103 +845,98 @@ AP4_PiffAvcCbcSampleDecrypter::DecryptSampleData(AP4_DataBuffer& data_in,
AP4_UI08* out = data_out.UseData();
// setup the IV
- if(iv == NULL)
- {
- if(m_SampleEncryptionAtom == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ if (iv == NULL) {
+ if (m_SampleEncryptionAtom == NULL) return AP4_ERROR_INVALID_PARAMETERS;
iv = m_SampleEncryptionAtom->GetIv(m_SampleIndex);
- if(iv == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (iv == NULL) return AP4_ERROR_INVALID_FORMAT;
}
m_Cipher->SetIV(iv);
// process the sample data, one NALU at a time
- const AP4_UI08* in_end = data_in.GetData() + data_in.GetDataSize();
- while((AP4_Size)(in_end - in) > 1 + m_NaluLengthSize)
- {
+ const AP4_UI08* in_end = data_in.GetData()+data_in.GetDataSize();
+ while ((AP4_Size)(in_end-in) > 1+m_NaluLengthSize) {
unsigned int nalu_length;
- switch(m_NaluLengthSize)
- {
- case 1:
- nalu_length = *in;
- break;
-
- case 2:
- nalu_length = AP4_BytesToUInt16BE(in);
- break;
-
- case 4:
- nalu_length = AP4_BytesToUInt32BE(in);
- break;
-
- default:
- return AP4_ERROR_INVALID_FORMAT;
+ switch (m_NaluLengthSize) {
+ case 1:
+ nalu_length = *in;
+ break;
+
+ case 2:
+ nalu_length = AP4_BytesToUInt16BE(in);
+ break;
+
+ case 4:
+ nalu_length = AP4_BytesToUInt32BE(in);
+ break;
+
+ default:
+ return AP4_ERROR_INVALID_FORMAT;
}
- unsigned int chunk_size = m_NaluLengthSize + nalu_length;
- unsigned int cleartext_size = chunk_size % 16;
- unsigned int block_count = chunk_size / 16;
- if(cleartext_size < m_NaluLengthSize + 1)
- {
+ unsigned int chunk_size = m_NaluLengthSize+nalu_length;
+ unsigned int cleartext_size = chunk_size%16;
+ unsigned int block_count = chunk_size/16;
+ if (cleartext_size < m_NaluLengthSize+1) {
AP4_ASSERT(block_count);
--block_count;
cleartext_size += 16;
}
-
+
// copy the cleartext portion
AP4_CopyMemory(out, in, cleartext_size);
-
+
// encrypt the rest
- if(block_count)
- {
- AP4_Size out_size = block_count * 16;
- m_Cipher->ProcessBuffer(in + cleartext_size, block_count * 16, out + cleartext_size, &out_size, false);
+ if (block_count) {
+ AP4_Size out_size = block_count*16;
+ m_Cipher->ProcessBuffer(in+cleartext_size, block_count*16, out+cleartext_size, &out_size, false);
}
-
+
// move the pointers
in += chunk_size;
out += chunk_size;
}
-
+
// move on to the next sample
++m_SampleIndex;
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffTrackEncryptionAtom::Create
+---------------------------------------------------------------------*/
-AP4_PiffTrackEncryptionAtom*
+AP4_PiffTrackEncryptionAtom*
AP4_PiffTrackEncryptionAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version = 0;
AP4_UI32 flags = 0;
AP4_Result result = ReadFullHeader(stream, version, flags);
- if(AP4_FAILED(result)) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(result)) return NULL;
+ if (version != 0) return NULL;
return new AP4_PiffTrackEncryptionAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_PiffTrackEncryptionAtom::AP4_PiffTrackEncryptionAtom
+---------------------------------------------------------------------*/
-AP4_PiffTrackEncryptionAtom::AP4_PiffTrackEncryptionAtom(AP4_UI32 size,
- AP4_UI32 version,
- AP4_UI32 flags,
- AP4_ByteStream& stream) :
+AP4_PiffTrackEncryptionAtom::AP4_PiffTrackEncryptionAtom(AP4_UI32 size,
+ AP4_UI32 version,
+ AP4_UI32 flags,
+ AP4_ByteStream& stream) :
AP4_UuidAtom(size, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, version, flags)
{
stream.ReadUI24(m_DefaultAlgorithmId);
stream.ReadUI08(m_DefaultIvSize);
- stream.Read(m_DefaultKid, 16);
+ stream.Read (m_DefaultKid, 16);
}
/*----------------------------------------------------------------------
| AP4_PiffTrackEncryptionAtom::AP4_PiffTrackEncryptionAtom
+---------------------------------------------------------------------*/
AP4_PiffTrackEncryptionAtom::AP4_PiffTrackEncryptionAtom(AP4_UI32 default_algorithm_id,
- AP4_UI08 default_iv_size,
- const AP4_UI08* default_kid) :
- AP4_UuidAtom(AP4_FULL_UUID_ATOM_HEADER_SIZE + 20, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 0, 0),
+ AP4_UI08 default_iv_size,
+ const AP4_UI08* default_kid) :
+ AP4_UuidAtom(AP4_FULL_UUID_ATOM_HEADER_SIZE+20, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 0, 0),
m_DefaultAlgorithmId(default_algorithm_id),
m_DefaultIvSize(default_iv_size)
{
@@ -1012,31 +946,31 @@ AP4_PiffTrackEncryptionAtom::AP4_PiffTrackEncryptionAtom(AP4_UI32 default
/*----------------------------------------------------------------------
| AP4_PiffTrackEncryptionAtom::InspectFields
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffTrackEncryptionAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("default_AlgorithmID", m_DefaultAlgorithmId);
inspector.AddField("default_IV_size", m_DefaultIvSize);
inspector.AddField("default_KID", m_DefaultKid, 16);
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffTrackEncryptionAtom::WriteFields
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffTrackEncryptionAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
- // write the fields
+
+ // write the fields
result = stream.WriteUI24(m_DefaultAlgorithmId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(m_DefaultIvSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Write(m_DefaultKid, 16);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
@@ -1044,50 +978,45 @@ AP4_PiffTrackEncryptionAtom::WriteFields(AP4_ByteStream& stream)
/*----------------------------------------------------------------------
| AP4_PiffSampleEncryptionAtom::Create
+---------------------------------------------------------------------*/
-AP4_PiffSampleEncryptionAtom*
+AP4_PiffSampleEncryptionAtom*
AP4_PiffSampleEncryptionAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version = 0;
AP4_UI32 flags = 0;
AP4_Result result = ReadFullHeader(stream, version, flags);
- if(AP4_FAILED(result)) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(result)) return NULL;
+ if (version != 0) return NULL;
return new AP4_PiffSampleEncryptionAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom
+---------------------------------------------------------------------*/
-AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_UI32 size,
- AP4_UI32 version,
- AP4_UI32 flags,
- AP4_ByteStream& stream) :
+AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_UI32 size,
+ AP4_UI32 version,
+ AP4_UI32 flags,
+ AP4_ByteStream& stream) :
AP4_UuidAtom(size, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, version, flags)
{
- if(flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS)
- {
+ if (flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS) {
stream.ReadUI24(m_AlgorithmId);
stream.ReadUI08(m_IvSize);
- stream.Read(m_Kid, 16);
- }
- else
- {
+ stream.Read (m_Kid, 16);
+ } else {
m_AlgorithmId = 0;
m_IvSize = 0;
AP4_SetMemory(m_Kid, 0, 16);
}
-
+
stream.ReadUI32(m_IvCount);
// NOTE: the problem here is that we don't know the IV size when flags==0
// So what we do is read the whole atom and assume that there's nothing
// else after the table.
- AP4_Size payload_size = size - GetHeaderSize() - 4;
- if((flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS) == 0)
- {
- if(m_IvCount)
- {
- m_IvSize = (AP4_UI08)(payload_size / m_IvCount);
+ AP4_Size payload_size = size-GetHeaderSize()-4;
+ if ((flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS) == 0) {
+ if (m_IvCount) {
+ m_IvSize = (AP4_UI08)(payload_size/m_IvCount);
}
}
m_Ivs.SetDataSize(payload_size);
@@ -1098,7 +1027,7 @@ AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_UI32 size,
| AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom
+---------------------------------------------------------------------*/
AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_Cardinal sample_count) :
- AP4_UuidAtom(AP4_FULL_UUID_ATOM_HEADER_SIZE + 4 + sample_count * 16, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 0, 0),
+ AP4_UuidAtom(AP4_FULL_UUID_ATOM_HEADER_SIZE+4+sample_count*16, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 0, 0),
m_AlgorithmId(0),
m_IvSize(16),
m_IvCount(sample_count)
@@ -1106,7 +1035,7 @@ AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_Cardinal sample_c
AP4_SetMemory(m_Kid, 0, 16);
// initialize the IVs to 0s
- m_Ivs.SetDataSize(sample_count * m_IvSize);
+ m_Ivs.SetDataSize(sample_count*m_IvSize);
AP4_SetMemory(m_Ivs.UseData(), 0, m_Ivs.GetDataSize());
}
@@ -1114,10 +1043,10 @@ AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_Cardinal sample_c
| AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom
+---------------------------------------------------------------------*/
AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_UI32 algorithm_id,
- AP4_UI08 iv_size,
- const AP4_UI08* kid,
- AP4_Cardinal sample_count) :
- AP4_UuidAtom(AP4_FULL_UUID_ATOM_HEADER_SIZE + 20 + 4, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 0,
+ AP4_UI08 iv_size,
+ const AP4_UI08* kid,
+ AP4_Cardinal sample_count) :
+ AP4_UuidAtom(AP4_FULL_UUID_ATOM_HEADER_SIZE+20+4, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 0,
AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS),
m_AlgorithmId(algorithm_id),
m_IvSize(iv_size),
@@ -1126,7 +1055,7 @@ AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_UI32 algor
AP4_CopyMemory(m_Kid, kid, 16);
// initialize the IVs to 0s
- m_Ivs.SetDataSize(sample_count * m_IvSize);
+ m_Ivs.SetDataSize(sample_count*m_IvSize);
AP4_SetMemory(m_Ivs.UseData(), 0, m_Ivs.GetDataSize());
}
@@ -1136,86 +1065,80 @@ AP4_PiffSampleEncryptionAtom::AP4_PiffSampleEncryptionAtom(AP4_UI32 algor
const AP4_UI08*
AP4_PiffSampleEncryptionAtom::GetIv(AP4_Ordinal indx)
{
- if(m_IvSize == 0) return NULL;
- unsigned int offset = indx * m_IvSize;
- if(offset + m_IvSize > m_Ivs.GetDataSize()) return NULL;
- return m_Ivs.GetData() + offset;
+ if (m_IvSize == 0) return NULL;
+ unsigned int offset = indx*m_IvSize;
+ if (offset+m_IvSize > m_Ivs.GetDataSize()) return NULL;
+ return m_Ivs.GetData()+offset;
}
/*----------------------------------------------------------------------
| AP4_PiffSampleEncryptionAtom::SetIv
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffSampleEncryptionAtom::SetIv(AP4_Ordinal indx, const AP4_UI08* iv)
{
- if(m_IvSize == 0) return AP4_ERROR_INVALID_STATE;
- if(indx >= m_IvCount)
- {
+ if (m_IvSize == 0) return AP4_ERROR_INVALID_STATE;
+ if (indx >= m_IvCount) {
return AP4_ERROR_OUT_OF_RANGE;
}
- AP4_CopyMemory(m_Ivs.UseData() + indx * m_IvSize, iv, m_IvSize);
-
+ AP4_CopyMemory(m_Ivs.UseData()+indx*m_IvSize, iv, m_IvSize);
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffSampleEncryptionAtom::InspectFields
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffSampleEncryptionAtom::InspectFields(AP4_AtomInspector& inspector)
{
- if(m_Flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS)
- {
+ if (m_Flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS) {
inspector.AddField("AlgorithmID", m_AlgorithmId);
inspector.AddField("IV_size", m_IvSize);
inspector.AddField("KID", m_Kid, 16);
}
-
- if(m_IvSize > 0 && m_IvSize <= 16 && inspector.GetVerbosity() >= 1)
- {
- unsigned int sample_count = m_Ivs.GetDataSize() / m_IvSize;
- for(unsigned int i = 0; i < sample_count; i++)
- {
+
+ if (m_IvSize > 0 && m_IvSize <= 16 && inspector.GetVerbosity() >= 1) {
+ unsigned int sample_count = m_Ivs.GetDataSize()/m_IvSize;
+ for (unsigned int i=0; i<sample_count; i++) {
char header[32];
char hex[33];
hex[32] = '\0';
- AP4_FormatString(header, sizeof(header), "IV %4d", i);
- AP4_FormatHex(m_Ivs.GetData() + i * m_IvSize, m_IvSize, hex);
+ AP4_FormatString(header, sizeof(header), "IV %4d", i);
+ AP4_FormatHex(m_Ivs.GetData()+i*m_IvSize, m_IvSize, hex);
inspector.AddField(header, hex);
}
}
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_PiffSampleEncryptionAtom::WriteFields
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_PiffSampleEncryptionAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
// optional fields
- if(m_Flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS)
- {
+ if (m_Flags & AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS) {
result = stream.WriteUI24(m_AlgorithmId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(m_IvSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Write(m_Kid, 16);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
-
+
// IVs
result = stream.WriteUI32(m_IvCount);
- if(AP4_FAILED(result)) return result;
- if(m_Ivs.GetDataSize())
- {
+ if (AP4_FAILED(result)) return result;
+ if (m_Ivs.GetDataSize()) {
stream.Write(m_Ivs.GetData(), m_Ivs.GetDataSize());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.h
index 3724befbc..73ad5659c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Piff.h
@@ -52,24 +52,23 @@ class AP4_PiffSampleEncryptionAtom;
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_PIFF = AP4_ATOM_TYPE('p', 'i', 'f', 'f');
+const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_PIFF = AP4_ATOM_TYPE('p','i','f','f');
const AP4_UI32 AP4_PROTECTION_SCHEME_VERSION_PIFF_10 = 0x00010000;
-const AP4_UI32 AP4_PIFF_BRAND = AP4_ATOM_TYPE('p', 'i', 'f', 'f');
-const AP4_UI32 AP4_PIFF_ALGORITHM_ID_NONE = 0;
-const AP4_UI32 AP4_PIFF_ALGORITHM_ID_CTR = 1;
-const AP4_UI32 AP4_PIFF_ALGORITHM_ID_CBC = 2;
+const AP4_UI32 AP4_PIFF_BRAND = AP4_ATOM_TYPE('p','i','f','f');
+const AP4_UI32 AP4_PIFF_ALGORITHM_ID_NONE = 0;
+const AP4_UI32 AP4_PIFF_ALGORITHM_ID_CTR = 1;
+const AP4_UI32 AP4_PIFF_ALGORITHM_ID_CBC = 2;
extern AP4_UI08 const AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM[16];
extern AP4_UI08 const AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM[16];
const unsigned int AP4_PIFF_SAMPLE_ENCRYPTION_FLAG_OVERRIDE_TRACK_ENCRYPTION_DEFAULTS = 1;
-typedef enum
-{
+typedef enum {
AP4_PIFF_CIPHER_MODE_CTR,
AP4_PIFF_CIPHER_MODE_CBC
} AP4_PiffCipherMode;
-
+
/*----------------------------------------------------------------------
| AP4_PiffSampleEncrypter
+---------------------------------------------------------------------*/
@@ -77,25 +76,16 @@ class AP4_PiffSampleEncrypter
{
public:
// constructor and destructor
- AP4_PiffSampleEncrypter()
- {
- AP4_SetMemory(m_Iv, 0, 16);
- };
+ AP4_PiffSampleEncrypter() { AP4_SetMemory(m_Iv, 0, 16); };
virtual ~AP4_PiffSampleEncrypter() {}
// methods
virtual AP4_Result EncryptSampleData(AP4_DataBuffer& data_in,
- AP4_DataBuffer& data_out) = 0;
-
- void SetIv(const AP4_UI08* iv)
- {
- AP4_CopyMemory(m_Iv, iv, 16);
- }
- const AP4_UI08* GetIv()
- {
- return m_Iv;
- }
+ AP4_DataBuffer& data_out) = 0;
+ void SetIv(const AP4_UI08* iv) { AP4_CopyMemory(m_Iv, iv, 16); }
+ const AP4_UI08* GetIv() { return m_Iv; }
+
protected:
AP4_UI08 m_Iv[16];
};
@@ -113,7 +103,7 @@ public:
// methods
virtual AP4_Result EncryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out);
-
+
protected:
// members
AP4_CtrStreamCipher* m_Cipher;
@@ -134,7 +124,7 @@ public:
// methods
virtual AP4_Result EncryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out);
-
+
private:
// members
AP4_Size m_NaluLengthSize;
@@ -187,15 +177,11 @@ class AP4_PiffEncryptingProcessor : public AP4_Processor
{
public:
// types
- struct Encrypter
- {
+ struct Encrypter {
Encrypter(AP4_UI32 track_id, AP4_PiffSampleEncrypter* sample_encrypter) :
m_TrackId(track_id),
m_SampleEncrypter(sample_encrypter) {}
- Encrypter()
- {
- delete m_SampleEncrypter;
- }
+ Encrypter() { delete m_SampleEncrypter; }
AP4_UI32 m_TrackId;
AP4_PiffSampleEncrypter* m_SampleEncrypter;
};
@@ -206,14 +192,8 @@ public:
~AP4_PiffEncryptingProcessor();
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
- AP4_TrackPropertyMap& GetPropertyMap()
- {
- return m_PropertyMap;
- }
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
+ AP4_TrackPropertyMap& GetPropertyMap() { return m_PropertyMap; }
// AP4_Processor methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level,
@@ -221,8 +201,8 @@ public:
AP4_Processor::ProgressListener* listener = NULL);
virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
virtual AP4_Processor::FragmentHandler* CreateFragmentHandler(AP4_ContainerAtom* traf);
-
-protected:
+
+protected:
// members
AP4_PiffCipherMode m_CipherMode;
AP4_BlockCipherFactory* m_BlockCipherFactory;
@@ -238,9 +218,9 @@ class AP4_PiffSampleDecrypter : public AP4_SampleDecrypter
{
public:
// factory
- static AP4_Result Create(AP4_ProtectedSampleDescription* sample_description,
+ static AP4_Result Create(AP4_ProtectedSampleDescription* sample_description,
AP4_ContainerAtom* traf,
- const AP4_UI08* key,
+ const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_PiffSampleDecrypter*& decrypter);
@@ -264,12 +244,11 @@ class AP4_PiffNullSampleDecrypter : public AP4_PiffSampleDecrypter
public:
// constructor
AP4_PiffNullSampleDecrypter() : AP4_PiffSampleDecrypter(NULL) {}
-
+
// methods
virtual AP4_Result DecryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out,
- const AP4_UI08* /*iv = NULL*/)
- {
+ const AP4_UI08* /*iv = NULL*/) {
data_out.SetData(data_in.GetData(), data_in.GetDataSize());
return AP4_SUCCESS;
}
@@ -373,8 +352,8 @@ class AP4_PiffTrackEncryptionAtom : public AP4_UuidAtom
{
public:
// class methods
- static AP4_PiffTrackEncryptionAtom* Create(AP4_Size size,
- AP4_ByteStream& stream);
+ static AP4_PiffTrackEncryptionAtom* Create(AP4_Size size,
+ AP4_ByteStream& stream);
// constructors
AP4_PiffTrackEncryptionAtom(AP4_UI32 default_algorithm_id,
@@ -386,22 +365,13 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI32 GetDefaultAlgorithmId()
- {
- return m_DefaultAlgorithmId;
- }
- AP4_UI08 GetDefaultIvSize()
- {
- return m_DefaultIvSize;
- }
- const AP4_UI08* GetDefaultKid()
- {
- return m_DefaultKid;
- }
+ AP4_UI32 GetDefaultAlgorithmId() { return m_DefaultAlgorithmId; }
+ AP4_UI08 GetDefaultIvSize() { return m_DefaultIvSize; }
+ const AP4_UI08* GetDefaultKid() { return m_DefaultKid; }
private:
// methods
- AP4_PiffTrackEncryptionAtom(AP4_UI32 size,
+ AP4_PiffTrackEncryptionAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
@@ -419,8 +389,8 @@ class AP4_PiffSampleEncryptionAtom : public AP4_UuidAtom
{
public:
// class methods
- static AP4_PiffSampleEncryptionAtom* Create(AP4_Size size,
- AP4_ByteStream& stream);
+ static AP4_PiffSampleEncryptionAtom* Create(AP4_Size size,
+ AP4_ByteStream& stream);
// constructors
AP4_PiffSampleEncryptionAtom(AP4_Cardinal sample_count);
@@ -434,29 +404,17 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI32 GetAlgorithmId()
- {
- return m_AlgorithmId;
- }
- AP4_UI08 GetIvSize()
- {
- return m_IvSize;
- }
+ AP4_UI32 GetAlgorithmId() { return m_AlgorithmId; }
+ AP4_UI08 GetIvSize() { return m_IvSize; }
AP4_Result SetIvSize(AP4_UI08 iv_size);
- const AP4_UI08* GetKid()
- {
- return m_Kid;
- }
- AP4_Cardinal GetIvCount()
- {
- return m_IvCount;
- }
+ const AP4_UI08* GetKid() { return m_Kid; }
+ AP4_Cardinal GetIvCount() { return m_IvCount; }
const AP4_UI08* GetIv(AP4_Ordinal indx);
AP4_Result SetIv(AP4_Ordinal indx, const AP4_UI08* iv);
private:
// methods
- AP4_PiffSampleEncryptionAtom(AP4_UI32 size,
+ AP4_PiffSampleEncryptionAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.cpp
index 433209466..129989b1e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.cpp
@@ -46,12 +46,11 @@
/*----------------------------------------------------------------------
| types
+---------------------------------------------------------------------*/
-struct AP4_SampleLocator
-{
- AP4_SampleLocator() :
- m_TrakIndex(0),
- m_SampleTable(NULL),
- m_SampleIndex(0),
+struct AP4_SampleLocator {
+ AP4_SampleLocator() :
+ m_TrakIndex(0),
+ m_SampleTable(NULL),
+ m_SampleIndex(0),
m_ChunkIndex(0) {}
AP4_Ordinal m_TrakIndex;
AP4_AtomSampleTable* m_SampleTable;
@@ -60,16 +59,14 @@ struct AP4_SampleLocator
AP4_Sample m_Sample;
};
-struct AP4_SampleCursor
-{
+struct AP4_SampleCursor {
AP4_SampleCursor() : m_EndReached(false) {}
AP4_SampleLocator m_Locator;
bool m_EndReached;
};
-struct AP4_MoofLocator
-{
- AP4_MoofLocator(AP4_ContainerAtom* moof, AP4_UI64 offset) :
+struct AP4_MoofLocator {
+ AP4_MoofLocator(AP4_ContainerAtom* moof, AP4_UI64 offset) :
m_Moof(moof),
m_Offset(offset) {}
AP4_ContainerAtom* m_Moof;
@@ -80,147 +77,132 @@ struct AP4_MoofLocator
| AP4_Processor::ProcessFragments
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Processor::ProcessFragments(AP4_MoovAtom* moov,
- AP4_List<AP4_MoofLocator>& moofs,
+AP4_Processor::ProcessFragments(AP4_MoovAtom* moov,
+ AP4_List<AP4_MoofLocator>& moofs,
AP4_ContainerAtom* mfra,
- AP4_ByteStream& input,
+ AP4_ByteStream& input,
AP4_ByteStream& output)
{
- // FIXME: this only works for non-changing moofs
-
- for(AP4_List<AP4_MoofLocator>::Item* item = moofs.FirstItem();
- item;
- item = item->GetNext())
- {
+ // FIXME: this only works for non-changing moofs
+
+ for (AP4_List<AP4_MoofLocator>::Item* item = moofs.FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_MoofLocator* locator = item->GetData();
AP4_ContainerAtom* moof = locator->m_Moof;
AP4_UI64 moof_offset = locator->m_Offset;
- AP4_UI64 mdat_payload_offset = moof_offset + moof->GetSize() + 8;
+ AP4_UI64 mdat_payload_offset = moof_offset+moof->GetSize()+8;
AP4_MovieFragment* fragment = new AP4_MovieFragment(moof);
AP4_Sample sample;
AP4_DataBuffer sample_data_in;
AP4_DataBuffer sample_data_out;
AP4_Result result;
-
+
// process all the traf atoms
AP4_Array<AP4_Processor::FragmentHandler*> handlers;
- for(; AP4_Atom* atom = moof->GetChild(AP4_ATOM_TYPE_TRAF, handlers.ItemCount());)
- {
+ for (;AP4_Atom* atom = moof->GetChild(AP4_ATOM_TYPE_TRAF, handlers.ItemCount());) {
AP4_ContainerAtom* traf = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
AP4_Processor::FragmentHandler* handler = CreateFragmentHandler(traf);
- if(handler) result = handler->ProcessFragment();
+ if (handler) result = handler->ProcessFragment();
handlers.Append(handler);
}
-
+
// write the moof
AP4_UI64 moof_out_start = 0;
output.Tell(moof_out_start);
bool moof_has_changed = false;
moof->Write(output);
-
+
// process all track runs
- for(unsigned int i = 0; i < handlers.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<handlers.ItemCount(); i++) {
AP4_FragmentSampleTable* sample_table = NULL;
AP4_Processor::FragmentHandler* handler = handlers[i];
// get the track ID
AP4_ContainerAtom* traf = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moof->GetChild(AP4_ATOM_TYPE_TRAF, i));
AP4_TfhdAtom* tfhd = AP4_DYNAMIC_CAST(AP4_TfhdAtom, traf->GetChild(AP4_ATOM_TYPE_TFHD, i));
-
+
// create a sample table object so we can read the sample data
result = fragment->CreateSampleTable(moov, tfhd->GetTrackId(), &input, moof_offset, mdat_payload_offset, sample_table);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// compute the mdat size
AP4_UI64 mdat_size = 0;
- for(unsigned int j = 0; j < sample_table->GetSampleCount(); j++)
- {
+ for (unsigned int j=0; j<sample_table->GetSampleCount(); j++) {
result = sample_table->GetSample(j, sample);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
mdat_size += sample.GetSize();
}
-
+
// write an mdat header
- if(mdat_size > 0xFFFFFFFF - 8)
- {
+ if (mdat_size > 0xFFFFFFFF-8) {
// we don't support large mdat fragments
return AP4_ERROR_OUT_OF_RANGE;
}
- if(mdat_size)
- {
- output.WriteUI32((AP4_UI32)(8 + mdat_size));
+ if (mdat_size) {
+ output.WriteUI32((AP4_UI32)(8+mdat_size));
output.WriteUI32(AP4_ATOM_TYPE_MDAT);
}
-
+
#if defined(AP4_DEBUG)
AP4_Position before;
output.Tell(before);
#endif
-
+
// write the mdat
- for(unsigned int j = 0; j < sample_table->GetSampleCount(); j++)
- {
+ for (unsigned int j=0; j<sample_table->GetSampleCount(); j++) {
result = sample_table->GetSample(j, sample);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
sample.ReadData(sample_data_in);
-
+
// process the sample data
- if(handler)
- {
+ if (handler) {
result = handler->ProcessSample(sample_data_in, sample_data_out);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the sample data
result = output.Write(sample_data_out.GetData(), sample_data_out.GetDataSize());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// give the handler a chance to update the atoms
result = handler->FinishFragment();
- if(AP4_SUCCEEDED(result)) moof_has_changed = true;
- }
- else
- {
+ if (AP4_SUCCEEDED(result)) moof_has_changed = true;
+ } else {
// write the sample data (unmodified)
result = output.Write(sample_data_in.GetData(), sample_data_in.GetDataSize());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
}
-
+
#if defined(AP4_DEBUG)
AP4_Position after;
output.Tell(after);
- AP4_ASSERT(after - before == mdat_size);
+ AP4_ASSERT(after-before == mdat_size);
#endif
delete sample_table;
}
-
+
// update the moof if needed
AP4_UI64 mdat_out_end = 0;
output.Tell(mdat_out_end);
- if(moof_has_changed)
- {
+ if (moof_has_changed) {
output.Seek(moof_out_start);
moof->Write(output);
output.Seek(mdat_out_end);
}
-
+
// update the mfra if we have one
- if(mfra)
- {
- for(AP4_List<AP4_Atom>::Item* mfra_item = mfra->GetChildren().FirstItem();
- mfra_item;
- mfra_item = mfra_item->GetNext())
- {
- if(mfra_item->GetData()->GetType() != AP4_ATOM_TYPE_TFRA) continue;
+ if (mfra) {
+ for (AP4_List<AP4_Atom>::Item* mfra_item = mfra->GetChildren().FirstItem();
+ mfra_item;
+ mfra_item = mfra_item->GetNext()) {
+ if (mfra_item->GetData()->GetType() != AP4_ATOM_TYPE_TFRA) continue;
AP4_TfraAtom* tfra = AP4_DYNAMIC_CAST(AP4_TfraAtom, mfra_item->GetData());
- if(tfra == NULL) continue;
+ if (tfra == NULL) continue;
AP4_Array<AP4_TfraAtom::Entry>& entries = tfra->GetEntries();
AP4_Cardinal entry_count = entries.ItemCount();
- for(unsigned int i = 0; i < entry_count; i++)
- {
- if(entries[i].m_MoofOffset == locator->m_Offset)
- {
+ for (unsigned int i=0; i<entry_count; i++) {
+ if (entries[i].m_MoofOffset == locator->m_Offset) {
entries[i].m_MoofOffset = moof_out_start;
}
}
@@ -229,7 +211,7 @@ AP4_Processor::ProcessFragments(AP4_MoovAtom* moov,
delete fragment;
}
-
+
return AP4_SUCCESS;
}
@@ -237,7 +219,7 @@ AP4_Processor::ProcessFragments(AP4_MoovAtom* moov,
| AP4_Processor::Process
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Processor::Process(AP4_ByteStream& input,
+AP4_Processor::Process(AP4_ByteStream& input,
AP4_ByteStream& output,
ProgressListener* listener,
AP4_AtomFactory& atom_factory)
@@ -251,29 +233,20 @@ AP4_Processor::Process(AP4_ByteStream& input,
AP4_ContainerAtom* mfra = NULL;
AP4_List<AP4_MoofLocator> moofs;
AP4_UI64 stream_offset = 0;
- for(AP4_Atom* atom = NULL;
+ for (AP4_Atom* atom = NULL;
AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(input, atom));
- input.Tell(stream_offset))
- {
- if(atom->GetType() == AP4_ATOM_TYPE_MDAT)
- {
+ input.Tell(stream_offset)) {
+ if (atom->GetType() == AP4_ATOM_TYPE_MDAT) {
continue;
- }
- else if(atom->GetType() == AP4_ATOM_TYPE_MOOV)
- {
+ } else if (atom->GetType() == AP4_ATOM_TYPE_MOOV) {
moov = (AP4_MoovAtom*)atom;
- }
- else if(atom->GetType() == AP4_ATOM_TYPE_MOOF)
- {
+ } else if (atom->GetType() == AP4_ATOM_TYPE_MOOF) {
AP4_ContainerAtom* moof = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(moof)
- {
+ if (moof) {
moofs.Add(new AP4_MoofLocator(moof, stream_offset));
}
continue;
- }
- else if(atom->GetType() == AP4_ATOM_TYPE_MFRA)
- {
+ } else if (atom->GetType() == AP4_ATOM_TYPE_MFRA) {
mfra = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
continue;
}
@@ -282,7 +255,7 @@ AP4_Processor::Process(AP4_ByteStream& input,
// initialize the processor
AP4_Result result = Initialize(top_level, input);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// process the tracks if we have a moov atom
AP4_Array<AP4_SampleLocator> locators;
@@ -291,75 +264,64 @@ AP4_Processor::Process(AP4_ByteStream& input,
AP4_LargeSize mdat_payload_size = 0;
TrackHandler** handlers = NULL;
AP4_SampleCursor* cursors = NULL;
- if(moov)
- {
+ if (moov) {
// build an array of track sample locators
trak_atoms = &moov->GetTrakAtoms();
track_count = trak_atoms->ItemCount();
cursors = new AP4_SampleCursor[track_count];
handlers = new TrackHandler*[track_count];
- for(AP4_Ordinal i = 0; i < track_count; i++)
- {
+ for (AP4_Ordinal i=0; i<track_count; i++) {
handlers[i] = NULL;
}
-
+
unsigned int index = 0;
- for(AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem(); item; item = item->GetNext())
- {
+ for (AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem(); item; item=item->GetNext()) {
AP4_TrakAtom* trak = item->GetData();
// find the stsd atom
AP4_ContainerAtom* stbl = AP4_DYNAMIC_CAST(AP4_ContainerAtom, trak->FindChild("mdia/minf/stbl"));
- if(stbl == NULL) continue;
-
+ if (stbl == NULL) continue;
+
// see if there's an external data source for this track
AP4_ByteStream* trak_data_stream = &input;
- for(AP4_List<ExternalTrackData>::Item* ditem = m_ExternalTrackData.FirstItem(); ditem; ditem = ditem->GetNext())
- {
+ for (AP4_List<ExternalTrackData>::Item* ditem = m_ExternalTrackData.FirstItem(); ditem; ditem=ditem->GetNext()) {
ExternalTrackData* tdata = ditem->GetData();
- if(tdata->m_TrackId == trak->GetId())
- {
+ if (tdata->m_TrackId == trak->GetId()) {
trak_data_stream = tdata->m_MediaData;
break;
}
}
- // create the track handler
+ // create the track handler
handlers[index] = CreateTrackHandler(trak);
cursors[index].m_Locator.m_TrakIndex = index;
cursors[index].m_Locator.m_SampleTable = new AP4_AtomSampleTable(stbl, *trak_data_stream);
cursors[index].m_Locator.m_SampleIndex = 0;
cursors[index].m_Locator.m_ChunkIndex = 0;
- if(cursors[index].m_Locator.m_SampleTable->GetSampleCount())
- {
+ if (cursors[index].m_Locator.m_SampleTable->GetSampleCount()) {
cursors[index].m_Locator.m_SampleTable->GetSample(0, cursors[index].m_Locator.m_Sample);
- }
- else
- {
+ } else {
cursors[index].m_EndReached = true;
}
- index++;
+ index++;
}
// figure out the layout of the chunks
- for(;;)
- {
+ for (;;) {
// see which is the next sample to write
AP4_UI64 min_offset = (AP4_UI64)(-1);
int cursor = -1;
- for(unsigned int i = 0; i < track_count; i++)
- {
- if(!cursors[i].m_EndReached &&
- cursors[i].m_Locator.m_Sample.GetOffset() <= min_offset)
- {
+ for (unsigned int i=0; i<track_count; i++) {
+ if (!cursors[i].m_EndReached &&
+ cursors[i].m_Locator.m_Sample.GetOffset() <= min_offset) {
min_offset = cursors[i].m_Locator.m_Sample.GetOffset();
cursor = i;
}
}
// stop if all cursors are exhausted
- if(cursor == -1) break;
+ if (cursor == -1) break;
// append this locator to the layout list
AP4_SampleLocator& locator = cursors[cursor].m_Locator;
@@ -367,19 +329,16 @@ AP4_Processor::Process(AP4_ByteStream& input,
// move the cursor to the next sample
locator.m_SampleIndex++;
- if(locator.m_SampleIndex == locator.m_SampleTable->GetSampleCount())
- {
+ if (locator.m_SampleIndex == locator.m_SampleTable->GetSampleCount()) {
// mark this track as completed
cursors[cursor].m_EndReached = true;
- }
- else
- {
+ } else {
// get the next sample info
locator.m_SampleTable->GetSample(locator.m_SampleIndex, locator.m_Sample);
AP4_Ordinal skip, sdesc;
locator.m_SampleTable->GetChunkForSample(locator.m_SampleIndex,
- locator.m_ChunkIndex,
- skip, sdesc);
+ locator.m_ChunkIndex,
+ skip, sdesc);
}
}
@@ -388,28 +347,23 @@ AP4_Processor::Process(AP4_ByteStream& input,
int current_chunk = -1;
AP4_Position current_chunk_offset = 0;
AP4_Size current_chunk_size = 0;
- for(AP4_Ordinal i = 0; i < locators.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<locators.ItemCount(); i++) {
AP4_SampleLocator& locator = locators[i];
- if((int)locator.m_TrakIndex != current_track ||
- (int)locator.m_ChunkIndex != current_chunk)
- {
+ if ((int)locator.m_TrakIndex != current_track ||
+ (int)locator.m_ChunkIndex != current_chunk) {
// start a new chunk for this track
current_chunk_offset += current_chunk_size;
current_chunk_size = 0;
current_track = locator.m_TrakIndex;
current_chunk = locator.m_ChunkIndex;
locator.m_SampleTable->SetChunkOffset(locator.m_ChunkIndex, current_chunk_offset);
- }
+ }
AP4_Size sample_size;
TrackHandler* handler = handlers[locator.m_TrakIndex];
- if(handler)
- {
+ if (handler) {
sample_size = handler->GetProcessedSampleSize(locator.m_Sample);
locator.m_SampleTable->SetSampleSize(locator.m_SampleIndex, sample_size);
- }
- else
- {
+ } else {
sample_size = locator.m_Sample.GetSize();
}
current_chunk_size += sample_size;
@@ -417,10 +371,9 @@ AP4_Processor::Process(AP4_ByteStream& input,
}
// process the tracks (ex: sample descriptions processing)
- for(AP4_Ordinal i = 0; i < track_count; i++)
- {
+ for (AP4_Ordinal i=0; i<track_count; i++) {
TrackHandler* handler = handlers[i];
- if(handler) handler->ProcessTrack();
+ if (handler) handler->ProcessTrack();
}
}
@@ -433,78 +386,65 @@ AP4_Processor::Process(AP4_ByteStream& input,
// see if we need a 64-bit or 32-bit mdat
AP4_Size mdat_header_size = AP4_ATOM_HEADER_SIZE;
- if(mdat_payload_size + mdat_header_size > 0xFFFFFFFF)
- {
+ if (mdat_payload_size+mdat_header_size > 0xFFFFFFFF) {
// we need a 64-bit size
mdat_header_size += 8;
}
-
+
// adjust the chunk offsets
- for(AP4_Ordinal i = 0; i < track_count; i++)
- {
+ for (AP4_Ordinal i=0; i<track_count; i++) {
AP4_TrakAtom* trak;
trak_atoms->Get(i, trak);
- trak->AdjustChunkOffsets(atoms_size + mdat_header_size);
+ trak->AdjustChunkOffsets(atoms_size+mdat_header_size);
}
// write all atoms
top_level.GetChildren().Apply(AP4_AtomListWriter(output));
// write mdat header
- if(mdat_payload_size)
- {
- if(mdat_header_size == AP4_ATOM_HEADER_SIZE)
- {
+ if (mdat_payload_size) {
+ if (mdat_header_size == AP4_ATOM_HEADER_SIZE) {
// 32-bit size
- output.WriteUI32((AP4_UI32)(mdat_header_size + mdat_payload_size));
+ output.WriteUI32((AP4_UI32)(mdat_header_size+mdat_payload_size));
output.WriteUI32(AP4_ATOM_TYPE_MDAT);
- }
- else
- {
+ } else {
// 64-bit size
output.WriteUI32(1);
output.WriteUI32(AP4_ATOM_TYPE_MDAT);
- output.WriteUI64(mdat_header_size + mdat_payload_size);
+ output.WriteUI64(mdat_header_size+mdat_payload_size);
}
}
-
+
#if defined(AP4_DEBUG)
AP4_Position before;
output.Tell(before);
#endif
// write the samples
- if(moov)
- {
+ if (moov) {
AP4_Sample sample;
AP4_DataBuffer data_in;
AP4_DataBuffer data_out;
- for(unsigned int i = 0; i < locators.ItemCount(); i++)
- {
+ for (unsigned int i=0; i<locators.ItemCount(); i++) {
AP4_SampleLocator& locator = locators[i];
locator.m_Sample.ReadData(data_in);
TrackHandler* handler = handlers[locator.m_TrakIndex];
- if(handler)
- {
+ if (handler) {
result = handler->ProcessSample(data_in, data_out);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
output.Write(data_out.GetData(), data_out.GetDataSize());
- }
- else
- {
- output.Write(data_in.GetData(), data_in.GetDataSize());
+ } else {
+ output.Write(data_in.GetData(), data_in.GetDataSize());
}
// notify the progress listener
- if(listener)
- {
- listener->OnProgress(i + 1, locators.ItemCount());
+ if (listener) {
+ listener->OnProgress(i+1, locators.ItemCount());
}
}
// cleanup
- for(AP4_Ordinal i = 0; i < track_count; i++)
- {
+ for (AP4_Ordinal i=0; i<track_count; i++) {
delete cursors[i].m_Locator.m_SampleTable;
delete handlers[i];
}
@@ -515,30 +455,29 @@ AP4_Processor::Process(AP4_ByteStream& input,
#if defined(AP4_DEBUG)
AP4_Position after;
output.Tell(after);
- AP4_ASSERT(after - before == mdat_payload_size);
+ AP4_ASSERT(after-before == mdat_payload_size);
#endif
// process the fragments, if any
result = ProcessFragments(moov, moofs, mfra, input, output);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// write the mfra atom at the end if we have one
- if(mfra)
- {
+ if (mfra) {
mfra->Write(output);
}
-
+
// cleanup
moofs.DeleteReferences();
delete mfra;
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Processor:Initialize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Processor::Initialize(AP4_AtomParent& /* top_level */,
AP4_ByteStream& /* stream */,
ProgressListener* /* listener */)
@@ -550,9 +489,9 @@ AP4_Processor::Initialize(AP4_AtomParent& /* top_level */,
/*----------------------------------------------------------------------
| AP4_Processor:Finalize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Processor::Finalize(AP4_AtomParent& /* top_level */,
- ProgressListener* /* listener */)
+ ProgressListener* /* listener */ )
{
// default implementation: do nothing
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.h
index 0cac374ae..2e7b4186d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Processor.h
@@ -50,40 +50,37 @@ struct AP4_MoofLocator;
/*----------------------------------------------------------------------
| AP4_Processor
+---------------------------------------------------------------------*/
-class AP4_Processor
-{
+class AP4_Processor {
public:
/**
* Abstract class that defines the interface implemented by progress
* listeners. A progress listener is called during the AP4_Processor::Process()
* method to notify of progres information.
*/
- class ProgressListener
- {
+ class ProgressListener {
public:
virtual ~ProgressListener() {}
/**
* This method is called during the call to AP4_Processor::Process() to
- * notify of the progress of the operation. If this method returns an
+ * notify of the progress of the operation. If this method returns an
* error result, processing is aborted.
* @param step Ordinal of the current progress step.
* @param total Total number of steps.
- * @return A result code. If this method returns AP4_SUCCESS, the
+ * @return A result code. If this method returns AP4_SUCCESS, the
* processing continues. If an error code is returned, the processing
* is aborted.
*/
- virtual AP4_Result OnProgress(unsigned int step,
+ virtual AP4_Result OnProgress(unsigned int step,
unsigned int total) = 0;
};
/**
* Abstract class that defines the interface implemented by concrete
- * track handlers. A track handler is responsible for processing a
+ * track handlers. A track handler is responsible for processing a
* track and its media samples.
*/
- class TrackHandler
- {
+ class TrackHandler {
public:
/**
* Default destructor.
@@ -94,20 +91,14 @@ public:
* A track handler may override this method if it needs to modify
* the track atoms before processing the track samples.
*/
- virtual AP4_Result ProcessTrack()
- {
- return AP4_SUCCESS;
- }
+ virtual AP4_Result ProcessTrack() { return AP4_SUCCESS; }
/**
* Returns the size of a sample after processing.
* @param sample Sample of which the processed size is requested.
* @return Size of the sample data after processing.
*/
- virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample)
- {
- return sample.GetSize();
- }
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample) { return sample.GetSize(); }
/**
* Process the data of one sample.
@@ -121,11 +112,10 @@ public:
/**
* Abstract class that defines the interface implemented by concrete
- * fragment handlers. A fragment handler is responsible for processing a
+ * fragment handlers. A fragment handler is responsible for processing a
* fragment and its media samples.
*/
- class FragmentHandler
- {
+ class FragmentHandler {
public:
/**
* Default destructor.
@@ -136,30 +126,21 @@ public:
* A fragment handler may override this method if it needs to modify
* the fragment atoms before processing the fragment samples.
*/
- virtual AP4_Result ProcessFragment()
- {
- return AP4_SUCCESS;
- }
+ virtual AP4_Result ProcessFragment() { return AP4_SUCCESS; }
/**
* A fragment handler may override this method if it needs to modify
* the fragment atoms after processing the fragment samples.
* NOTE: this method MUST NOT change the size of any of the atoms.
*/
- virtual AP4_Result FinishFragment()
- {
- return AP4_ERROR_NOT_SUPPORTED;
- }
+ virtual AP4_Result FinishFragment() { return AP4_ERROR_NOT_SUPPORTED; }
/**
* Returns the size of a sample after processing.
* @param sample Sample of which the processed size is requested.
* @return Size of the sample data after processing.
*/
- virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample)
- {
- return sample.GetSize();
- }
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample) { return sample.GetSize(); }
/**
* Process the data of one sample.
@@ -174,10 +155,7 @@ public:
/**
* Default destructor
*/
- virtual ~AP4_Processor()
- {
- m_ExternalTrackData.DeleteReferences();
- }
+ virtual ~AP4_Processor() { m_ExternalTrackData.DeleteReferences(); }
/**
* Process the input stream into an output stream.
@@ -185,13 +163,13 @@ public:
* @param output Output stream to which the processed input
* will be written.
* @param listener Pointer to a listener, or NULL. The listener
- * will be called one or more times before this method returns,
+ * will be called one or more times before this method returns,
* with progress information.
*/
- AP4_Result Process(AP4_ByteStream& input,
+ AP4_Result Process(AP4_ByteStream& input,
AP4_ByteStream& output,
ProgressListener* listener = NULL,
- AP4_AtomFactory& atom_factory =
+ AP4_AtomFactory& atom_factory =
AP4_DefaultAtomFactory::Instance);
/**
@@ -199,7 +177,7 @@ public:
* It is called just after the input stream has been parsed into
* an atom tree, before the processing of the tracks.
* @param top_level Container atom containing all the atoms parsed
- * from the input stream. Note that this atom does not actually
+ * from the input stream. Note that this atom does not actually
* exist in the file; it is a synthetised container created for the
* purpose of holding together all the input's top-level atoms.
*/
@@ -218,52 +196,41 @@ public:
* This method can be overridden by concrete subclasses.
* It is called once for each track in the input file.
* @param track Pointer to the track for which a handler should be
- * created.
- * @return A pointer to a track handler, or NULL if no handler
+ * created.
+ * @return A pointer to a track handler, or NULL if no handler
* needs to be created for that track.
*/
- virtual TrackHandler* CreateTrackHandler(AP4_TrakAtom* /*trak*/)
- {
- return NULL;
- }
+ virtual TrackHandler* CreateTrackHandler(AP4_TrakAtom* /*trak*/) { return NULL; }
/**
* This method can be overridden by concrete subclasses.
* It is called once for each fragment in the input file.
* @param track Pointer to the fragment for which a handler should be
- * created.
- * @return A pointer to a fragment handler, or NULL if no handler
+ * created.
+ * @return A pointer to a fragment handler, or NULL if no handler
* needs to be created for that fragment.
*/
- virtual FragmentHandler* CreateFragmentHandler(AP4_ContainerAtom* /*traf*/)
- {
- return NULL;
- }
-
+ virtual FragmentHandler* CreateFragmentHandler(AP4_ContainerAtom* /*traf*/) { return NULL; }
+
protected:
- class ExternalTrackData
- {
+ class ExternalTrackData {
public:
ExternalTrackData(unsigned int track_id, AP4_ByteStream* media_data) :
- m_TrackId(track_id), m_MediaData(media_data)
- {
+ m_TrackId(track_id), m_MediaData(media_data) {
media_data->AddReference();
}
- ~ExternalTrackData()
- {
- m_MediaData->Release();
- }
+ ~ExternalTrackData() { m_MediaData->Release(); }
unsigned int m_TrackId;
AP4_ByteStream* m_MediaData;
};
- AP4_Result ProcessFragments(AP4_MoovAtom* moov,
- AP4_List<AP4_MoofLocator>& moofs,
+ AP4_Result ProcessFragments(AP4_MoovAtom* moov,
+ AP4_List<AP4_MoofLocator>& moofs,
AP4_ContainerAtom* mfra,
- AP4_ByteStream& input,
+ AP4_ByteStream& input,
AP4_ByteStream& output);
-
-
+
+
AP4_List<ExternalTrackData> m_ExternalTrackData;
};
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.cpp
index d7b6a7f14..cf918b3f9 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.cpp
@@ -57,9 +57,9 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_ProtectedSampleDescription)
| AP4_EncaSampleEntry::AP4_EncaSampleEntry
+---------------------------------------------------------------------*/
AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_UI32 type,
- AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_AudioSampleEntry(type, size, stream, atom_factory)
{
}
@@ -68,8 +68,8 @@ AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_UI32 type,
| AP4_EncaSampleEntry::AP4_EncaSampleEntry
+---------------------------------------------------------------------*/
AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_AudioSampleEntry(AP4_ATOM_TYPE_ENCA, size, stream, atom_factory)
{
}
@@ -89,34 +89,30 @@ AP4_EncaSampleEntry::ToSampleDescription()
// get the scheme info
AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
- AP4_UI32 original_format = frma ? frma->GetOriginalFormat() : AP4_ATOM_TYPE_MP4A;
- if(schm)
- {
+ AP4_UI32 original_format = frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4A;
+ if (schm) {
// create the original sample description
return new AP4_ProtectedSampleDescription(
- m_Type,
- ToTargetSampleDescription(original_format),
- original_format,
- schm->GetSchemeType(),
- schm->GetSchemeVersion(),
- schm->GetSchemeUri().GetChars(),
- schi);
- }
- else if(schi)
- {
+ m_Type,
+ ToTargetSampleDescription(original_format),
+ original_format,
+ schm->GetSchemeType(),
+ schm->GetSchemeVersion(),
+ schm->GetSchemeUri().GetChars(),
+ schi);
+ } else if (schi) {
// try to see if we can guess the protection scheme from the 'schi' contents
AP4_Atom* odkm = schi->GetChild(AP4_ATOM_TYPE_ODKM);
- if(odkm)
- {
+ if (odkm) {
// create the original sample description
return new AP4_ProtectedSampleDescription(
- m_Type,
- ToTargetSampleDescription(original_format),
- original_format,
- AP4_PROTECTION_SCHEME_TYPE_OMA,
- AP4_PROTECTION_SCHEME_VERSION_OMA_20,
- NULL,
- schi);
+ m_Type,
+ ToTargetSampleDescription(original_format),
+ original_format,
+ AP4_PROTECTION_SCHEME_TYPE_OMA,
+ AP4_PROTECTION_SCHEME_VERSION_OMA_20,
+ NULL,
+ schi);
}
}
@@ -130,33 +126,29 @@ AP4_EncaSampleEntry::ToSampleDescription()
AP4_SampleDescription*
AP4_EncaSampleEntry::ToTargetSampleDescription(AP4_UI32 format)
{
- switch(format)
- {
- case AP4_ATOM_TYPE_MP4A:
- {
- AP4_EsdsAtom* esds = AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS));
- if(esds == NULL)
- {
- // check if this is a quicktime style sample description
- if(m_QtVersion > 0)
- {
- esds = AP4_DYNAMIC_CAST(AP4_EsdsAtom, FindChild("wave/esds"));
+ switch (format) {
+ case AP4_ATOM_TYPE_MP4A: {
+ AP4_EsdsAtom* esds = AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS));
+ if (esds == NULL) {
+ // check if this is a quicktime style sample description
+ if (m_QtVersion > 0) {
+ esds = AP4_DYNAMIC_CAST(AP4_EsdsAtom, FindChild("wave/esds"));
+ }
}
+ return new AP4_MpegAudioSampleDescription(
+ GetSampleRate(),
+ GetSampleSize(),
+ GetChannelCount(),
+ esds);
}
- return new AP4_MpegAudioSampleDescription(
- GetSampleRate(),
- GetSampleSize(),
- GetChannelCount(),
- esds);
- }
-
- default:
- return new AP4_GenericAudioSampleDescription(
- format,
- GetSampleRate(),
- GetSampleSize(),
- GetChannelCount(),
- this);
+
+ default:
+ return new AP4_GenericAudioSampleDescription(
+ format,
+ GetSampleRate(),
+ GetSampleSize(),
+ GetChannelCount(),
+ this);
}
}
@@ -164,9 +156,9 @@ AP4_EncaSampleEntry::ToTargetSampleDescription(AP4_UI32 format)
| AP4_EncvSampleEntry::AP4_EncvSampleEntry
+---------------------------------------------------------------------*/
AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_UI32 type,
- AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_VisualSampleEntry(type, size, stream, atom_factory)
{
}
@@ -175,8 +167,8 @@ AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_UI32 type,
| AP4_EncvSampleEntry::AP4_EncvSampleEntry
+---------------------------------------------------------------------*/
AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_VisualSampleEntry(AP4_ATOM_TYPE_ENCV, size, stream, atom_factory)
{
}
@@ -196,34 +188,30 @@ AP4_EncvSampleEntry::ToSampleDescription()
// get the scheme info
AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
- AP4_UI32 original_format = frma ? frma->GetOriginalFormat() : AP4_ATOM_TYPE_MP4V;
- if(schm)
- {
+ AP4_UI32 original_format = frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4V;
+ if (schm) {
// create the sample description
return new AP4_ProtectedSampleDescription(
- m_Type,
- ToTargetSampleDescription(original_format),
- original_format,
- schm->GetSchemeType(),
- schm->GetSchemeVersion(),
- schm->GetSchemeUri().GetChars(),
- schi);
- }
- else if(schi)
- {
+ m_Type,
+ ToTargetSampleDescription(original_format),
+ original_format,
+ schm->GetSchemeType(),
+ schm->GetSchemeVersion(),
+ schm->GetSchemeUri().GetChars(),
+ schi);
+ } else if (schi) {
// try to see if we can guess the protection scheme from the 'schi' contents
AP4_Atom* odkm = schi->GetChild(AP4_ATOM_TYPE_ODKM);
- if(odkm)
- {
+ if (odkm) {
// create the original sample description
return new AP4_ProtectedSampleDescription(
- m_Type,
- ToTargetSampleDescription(original_format),
- original_format,
- AP4_PROTECTION_SCHEME_TYPE_OMA,
- AP4_PROTECTION_SCHEME_VERSION_OMA_20,
- NULL,
- schi);
+ m_Type,
+ ToTargetSampleDescription(original_format),
+ original_format,
+ AP4_PROTECTION_SCHEME_TYPE_OMA,
+ AP4_PROTECTION_SCHEME_VERSION_OMA_20,
+ NULL,
+ schi);
}
}
@@ -238,32 +226,31 @@ AP4_EncvSampleEntry::ToSampleDescription()
AP4_SampleDescription*
AP4_EncvSampleEntry::ToTargetSampleDescription(AP4_UI32 format)
{
- switch(format)
- {
- case AP4_ATOM_TYPE_AVC1:
- return new AP4_AvcSampleDescription(
- m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
- this);
-
- case AP4_ATOM_TYPE_MP4V:
- return new AP4_MpegVideoSampleDescription(
- m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
- AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
-
- default:
- return new AP4_GenericVideoSampleDescription(
- format,
- m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
- this);
+ switch (format) {
+ case AP4_ATOM_TYPE_AVC1:
+ return new AP4_AvcSampleDescription(
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
+ this);
+
+ case AP4_ATOM_TYPE_MP4V:
+ return new AP4_MpegVideoSampleDescription(
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
+ AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
+
+ default:
+ return new AP4_GenericVideoSampleDescription(
+ format,
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
+ this);
}
}
@@ -271,8 +258,8 @@ AP4_EncvSampleEntry::ToTargetSampleDescription(AP4_UI32 format)
| AP4_DrmsSampleEntry::AP4_DrmsSampleEntry
+---------------------------------------------------------------------*/
AP4_DrmsSampleEntry::AP4_DrmsSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_EncaSampleEntry(AP4_ATOM_TYPE_DRMS, size, stream, atom_factory)
{
}
@@ -281,8 +268,8 @@ AP4_DrmsSampleEntry::AP4_DrmsSampleEntry(AP4_Size size,
| AP4_DrmiSampleEntry::AP4_DrmiSampleEntry
+---------------------------------------------------------------------*/
AP4_DrmiSampleEntry::AP4_DrmiSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_EncvSampleEntry(AP4_ATOM_TYPE_DRMI, size, stream, atom_factory)
{
}
@@ -300,12 +287,9 @@ AP4_ProtectionSchemeInfo::~AP4_ProtectionSchemeInfo()
+---------------------------------------------------------------------*/
AP4_ProtectionSchemeInfo::AP4_ProtectionSchemeInfo(AP4_ContainerAtom* schi)
{
- if(schi)
- {
+ if (schi) {
m_SchiAtom = (AP4_ContainerAtom*)schi->Clone();
- }
- else
- {
+ } else {
m_SchiAtom = NULL;
}
}
@@ -328,16 +312,13 @@ AP4_ProtectionKeyMap::~AP4_ProtectionKeyMap()
/*----------------------------------------------------------------------
| AP4_ProtectionKeyMap::SetKey
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_ProtectionKeyMap::SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* iv)
{
KeyEntry* entry = GetEntry(track_id);
- if(entry == NULL)
- {
+ if (entry == NULL) {
m_KeyEntries.Add(new KeyEntry(track_id, key, iv));
- }
- else
- {
+ } else {
entry->SetKey(key, iv);
}
@@ -347,12 +328,11 @@ AP4_ProtectionKeyMap::SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_U
/*----------------------------------------------------------------------
| AP4_ProtectionKeyMap::SetKey
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_ProtectionKeyMap::SetKeys(const AP4_ProtectionKeyMap& key_map)
{
AP4_List<KeyEntry>::Item* item = key_map.m_KeyEntries.FirstItem();
- while(item)
- {
+ while (item) {
KeyEntry* entry = item->GetData();
m_KeyEntries.Add(new KeyEntry(entry->m_TrackId,
entry->m_Key,
@@ -365,20 +345,17 @@ AP4_ProtectionKeyMap::SetKeys(const AP4_ProtectionKeyMap& key_map)
/*----------------------------------------------------------------------
| AP4_ProtectionKeyMap::GetKeyIv
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_ProtectionKeyMap::GetKeyAndIv(AP4_UI32 track_id,
- const AP4_UI08*& key,
+AP4_Result
+AP4_ProtectionKeyMap::GetKeyAndIv(AP4_UI32 track_id,
+ const AP4_UI08*& key,
const AP4_UI08*& iv)
{
KeyEntry* entry = GetEntry(track_id);
- if(entry)
- {
+ if (entry) {
key = entry->m_Key;
iv = entry->m_IV;
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_NO_SUCH_ITEM;
}
}
@@ -386,16 +363,13 @@ AP4_ProtectionKeyMap::GetKeyAndIv(AP4_UI32 track_id,
/*----------------------------------------------------------------------
| AP4_ProtectionKeyMap::GetKey
+---------------------------------------------------------------------*/
-const AP4_UI08*
+const AP4_UI08*
AP4_ProtectionKeyMap::GetKey(AP4_UI32 track_id) const
{
KeyEntry* entry = GetEntry(track_id);
- if(entry)
- {
+ if (entry) {
return entry->m_Key;
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -407,10 +381,9 @@ AP4_ProtectionKeyMap::KeyEntry*
AP4_ProtectionKeyMap::GetEntry(AP4_UI32 track_id) const
{
AP4_List<KeyEntry>::Item* item = m_KeyEntries.FirstItem();
- while(item)
- {
+ while (item) {
KeyEntry* entry = (KeyEntry*)item->GetData();
- if(entry->m_TrackId == track_id) return entry;
+ if (entry->m_TrackId == track_id) return entry;
item = item->GetNext();
}
@@ -420,9 +393,9 @@ AP4_ProtectionKeyMap::GetEntry(AP4_UI32 track_id) const
/*----------------------------------------------------------------------
| AP4_ProtectionKeyMap::KeyEntry::KeyEntry
+---------------------------------------------------------------------*/
-AP4_ProtectionKeyMap::KeyEntry::KeyEntry(AP4_UI32 track_id,
- const AP4_UI08* key,
- const AP4_UI08* iv /* = NULL */) :
+AP4_ProtectionKeyMap::KeyEntry::KeyEntry(AP4_UI32 track_id,
+ const AP4_UI08* key,
+ const AP4_UI08* iv /* = NULL */) :
m_TrackId(track_id)
{
SetKey(key, iv);
@@ -435,12 +408,9 @@ void
AP4_ProtectionKeyMap::KeyEntry::SetKey(const AP4_UI08* key, const AP4_UI08* iv)
{
AP4_CopyMemory(m_Key, key, sizeof(m_Key));
- if(iv)
- {
+ if (iv) {
AP4_CopyMemory(m_IV, iv, sizeof(m_IV));
- }
- else
- {
+ } else {
AP4_SetMemory(m_IV, 0, sizeof(m_IV));
}
}
@@ -457,8 +427,8 @@ AP4_TrackPropertyMap::~AP4_TrackPropertyMap()
| AP4_TrackPropertyMap::SetProperty
+---------------------------------------------------------------------*/
AP4_Result
-AP4_TrackPropertyMap::SetProperty(AP4_UI32 track_id,
- const char* name,
+AP4_TrackPropertyMap::SetProperty(AP4_UI32 track_id,
+ const char* name,
const char* value)
{
return m_Entries.Add(new Entry(track_id, name, value));
@@ -467,12 +437,11 @@ AP4_TrackPropertyMap::SetProperty(AP4_UI32 track_id,
/*----------------------------------------------------------------------
| AP4_TrackPropertyMap::SetProperties
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_TrackPropertyMap::SetProperties(const AP4_TrackPropertyMap& properties)
{
AP4_List<Entry>::Item* item = properties.m_Entries.FirstItem();
- while(item)
- {
+ while (item) {
Entry* entry = item->GetData();
m_Entries.Add(new Entry(entry->m_TrackId,
entry->m_Name.GetChars(),
@@ -489,12 +458,10 @@ const char*
AP4_TrackPropertyMap::GetProperty(AP4_UI32 track_id, const char* name)
{
AP4_List<Entry>::Item* item = m_Entries.FirstItem();
- while(item)
- {
+ while (item) {
Entry* entry = item->GetData();
- if(entry->m_TrackId == track_id &&
- AP4_CompareStrings(entry->m_Name.GetChars(), name) == 0)
- {
+ if (entry->m_TrackId == track_id &&
+ AP4_CompareStrings(entry->m_Name.GetChars(), name) == 0) {
return entry->m_Value.GetChars();
}
item = item->GetNext();
@@ -507,76 +474,69 @@ AP4_TrackPropertyMap::GetProperty(AP4_UI32 track_id, const char* name)
/*----------------------------------------------------------------------
| AP4_TrackPropertyMap::GetTextualHeaders
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_TrackPropertyMap::GetTextualHeaders(AP4_UI32 track_id, AP4_DataBuffer& textual_headers)
{
AP4_Size buffer_size = 0;
AP4_Result result = AP4_SUCCESS;
AP4_Byte* data_buffer;
-
+
// get the size needed for the textual headers
AP4_List<Entry>::Item* item = m_Entries.FirstItem();
- while(item)
- {
+ while (item) {
Entry* entry = item->GetData();
- if(entry->m_TrackId == track_id)
- {
+ if (entry->m_TrackId == track_id) {
const char* name = entry->m_Name.GetChars();
- if(AP4_CompareStrings(name, "ContentId") != 0 &&
- AP4_CompareStrings(name, "RightsIssuerUrl") != 0 &&
- AP4_CompareStrings(name, "KID") != 0)
- {
- buffer_size += (entry->m_Name.GetLength() +
+ if (AP4_CompareStrings(name, "ContentId") != 0 &&
+ AP4_CompareStrings(name, "RightsIssuerUrl") != 0 &&
+ AP4_CompareStrings(name, "KID") != 0) {
+ buffer_size += (entry->m_Name.GetLength() +
entry->m_Value.GetLength() +
- 2); // colon + nul
-
- }
+ 2); // colon + nul
+
+ }
}
- item = item->GetNext();
+ item = item->GetNext();
}
-
+
result = textual_headers.SetDataSize(buffer_size);
AP4_CHECK(result);
-
+
data_buffer = textual_headers.UseData();
-
+
// set the textual headers
item = m_Entries.FirstItem();
- while(item)
- {
+ while (item) {
Entry* entry = item->GetData();
- if(entry->m_TrackId == track_id)
- {
+ if (entry->m_TrackId == track_id) {
const char* name = entry->m_Name.GetChars();
const char* value = NULL;
AP4_Size name_len = 0;
AP4_Size value_len = 0;
-
- if(AP4_CompareStrings(name, "ContentId") != 0 &&
- AP4_CompareStrings(name, "RightsIssuerUrl") != 0 &&
- AP4_CompareStrings(name, "KID") != 0)
- {
+
+ if (AP4_CompareStrings(name, "ContentId") != 0 &&
+ AP4_CompareStrings(name, "RightsIssuerUrl") != 0 &&
+ AP4_CompareStrings(name, "KID") != 0) {
name_len = entry->m_Name.GetLength();
value = entry->m_Value.GetChars();
- value_len = entry->m_Value.GetLength();
-
+ value_len = entry->m_Value.GetLength();
+
// format is name:value\0
- if(name && value)
- {
+ if (name && value) {
AP4_CopyMemory(data_buffer, name, name_len);
data_buffer[name_len] = ':';
- data_buffer += (1 + name_len);
+ data_buffer += (1+name_len);
AP4_CopyMemory(data_buffer, value, value_len);
data_buffer[value_len] = '\0';
- data_buffer += (1 + value_len);
- }
- }
- }
- item = item->GetNext();
+ data_buffer += (1+value_len);
+ }
+ }
+ }
+ item = item->GetNext();
}
-
+
// success path
- return AP4_SUCCESS;
+ return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
@@ -608,7 +568,7 @@ AP4_ProtectedSampleDescription::AP4_ProtectedSampleDescription(
AP4_ProtectedSampleDescription::~AP4_ProtectedSampleDescription()
{
delete m_SchemeInfo;
- if(m_OriginalSampleDescriptionIsOwned) delete m_OriginalSampleDescription;
+ if (m_OriginalSampleDescriptionIsOwned) delete m_OriginalSampleDescription;
}
/*----------------------------------------------------------------------
@@ -618,33 +578,32 @@ AP4_Atom*
AP4_ProtectedSampleDescription::ToAtom() const
{
// construct the atom for the original sample description
- if(m_OriginalSampleDescription == NULL) return NULL;
+ if (m_OriginalSampleDescription == NULL) return NULL;
AP4_Atom* atom = m_OriginalSampleDescription->ToAtom();
-
+
// switch the atom type
atom->SetType(m_Format);
// check that the constructed atom is a container
AP4_ContainerAtom* container = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(container == NULL) return atom; // not a container ?? return now.
-
+ if (container == NULL) return atom; // not a container ?? return now.
+
// create the sinf atom
AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF);
-
+
// create and add a frma atom
AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_OriginalFormat);
sinf->AddChild(frma);
-
+
// create and add a schm atom
AP4_SchmAtom* schm = new AP4_SchmAtom(m_SchemeType, m_SchemeVersion, m_SchemeUri.GetChars());
sinf->AddChild(schm);
// add the schi atom
- if(m_SchemeInfo && m_SchemeInfo->GetSchiAtom())
- {
+ if (m_SchemeInfo && m_SchemeInfo->GetSchiAtom()) {
sinf->AddChild(m_SchemeInfo->GetSchiAtom()->Clone());
}
-
+
// add the sinf to the returned atom
container->AddChild(sinf);
@@ -654,61 +613,56 @@ AP4_ProtectedSampleDescription::ToAtom() const
/*----------------------------------------------------------------------
| AP4_SampleDecrypter:Create
+---------------------------------------------------------------------*/
-AP4_SampleDecrypter*
+AP4_SampleDecrypter*
AP4_SampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory)
{
- if(sample_description == NULL || key == NULL) return NULL;
+ if (sample_description == NULL || key == NULL) return NULL;
// select the block cipher factory
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
block_cipher_factory = &AP4_DefaultBlockCipherFactory::Instance;
}
- switch(sample_description->GetSchemeType())
- {
- case AP4_PROTECTION_SCHEME_TYPE_OMA:
- {
- AP4_OmaDcfSampleDecrypter* decrypter = NULL;
- AP4_Result result = AP4_OmaDcfSampleDecrypter::Create(sample_description,
- key,
- key_size,
- block_cipher_factory,
- decrypter);
- if(AP4_FAILED(result)) return NULL;
- return decrypter;
- }
-
- case AP4_PROTECTION_SCHEME_TYPE_IAEC:
- {
- AP4_IsmaCipher* decrypter = NULL;
- AP4_Result result = AP4_IsmaCipher::CreateSampleDecrypter(sample_description,
- key,
- key_size,
- block_cipher_factory,
- decrypter);
- if(AP4_FAILED(result)) return NULL;
- return decrypter;
- }
+ switch(sample_description->GetSchemeType()) {
+ case AP4_PROTECTION_SCHEME_TYPE_OMA: {
+ AP4_OmaDcfSampleDecrypter* decrypter = NULL;
+ AP4_Result result = AP4_OmaDcfSampleDecrypter::Create(sample_description,
+ key,
+ key_size,
+ block_cipher_factory,
+ decrypter);
+ if (AP4_FAILED(result)) return NULL;
+ return decrypter;
+ }
- case AP4_PROTECTION_SCHEME_TYPE_PIFF:
- {
- AP4_PiffSampleDecrypter* decrypter = NULL;
- AP4_Result result = AP4_PiffSampleDecrypter::Create(sample_description,
- NULL,
- key,
- key_size,
- block_cipher_factory,
- decrypter);
- if(AP4_FAILED(result)) return NULL;
- return decrypter;
- }
+ case AP4_PROTECTION_SCHEME_TYPE_IAEC: {
+ AP4_IsmaCipher* decrypter = NULL;
+ AP4_Result result = AP4_IsmaCipher::CreateSampleDecrypter(sample_description,
+ key,
+ key_size,
+ block_cipher_factory,
+ decrypter);
+ if (AP4_FAILED(result)) return NULL;
+ return decrypter;
+ }
- default:
- return NULL;
+ case AP4_PROTECTION_SCHEME_TYPE_PIFF: {
+ AP4_PiffSampleDecrypter* decrypter = NULL;
+ AP4_Result result = AP4_PiffSampleDecrypter::Create(sample_description,
+ NULL,
+ key,
+ key_size,
+ block_cipher_factory,
+ decrypter);
+ if (AP4_FAILED(result)) return NULL;
+ return decrypter;
+ }
+
+ default:
+ return NULL;
}
return NULL;
@@ -717,38 +671,35 @@ AP4_SampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
/*----------------------------------------------------------------------
| AP4_SampleDecrypter:Create
+---------------------------------------------------------------------*/
-AP4_SampleDecrypter*
+AP4_SampleDecrypter*
AP4_SampleDecrypter::Create(AP4_ProtectedSampleDescription* sample_description,
AP4_ContainerAtom* traf,
const AP4_UI08* key,
AP4_Size key_size,
AP4_BlockCipherFactory* block_cipher_factory)
{
- if(sample_description == NULL || traf == NULL || key == NULL) return NULL;
+ if (sample_description == NULL || traf == NULL || key == NULL) return NULL;
// select the block cipher factory
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
block_cipher_factory = &AP4_DefaultBlockCipherFactory::Instance;
}
- switch(sample_description->GetSchemeType())
- {
- case AP4_PROTECTION_SCHEME_TYPE_PIFF:
- {
- AP4_PiffSampleDecrypter* decrypter = NULL;
- AP4_Result result = AP4_PiffSampleDecrypter::Create(sample_description,
- traf,
- key,
- key_size,
- block_cipher_factory,
- decrypter);
- if(AP4_FAILED(result)) return NULL;
- return decrypter;
- }
+ switch(sample_description->GetSchemeType()) {
+ case AP4_PROTECTION_SCHEME_TYPE_PIFF: {
+ AP4_PiffSampleDecrypter* decrypter = NULL;
+ AP4_Result result = AP4_PiffSampleDecrypter::Create(sample_description,
+ traf,
+ key,
+ key_size,
+ block_cipher_factory,
+ decrypter);
+ if (AP4_FAILED(result)) return NULL;
+ return decrypter;
+ }
- default:
- return NULL;
+ default:
+ return NULL;
}
return NULL;
@@ -761,18 +712,14 @@ AP4_StandardDecryptingProcessor::AP4_StandardDecryptingProcessor(
const AP4_ProtectionKeyMap* key_map /* = NULL */,
AP4_BlockCipherFactory* block_cipher_factory /* = NULL */)
{
- if(key_map)
- {
+ if (key_map) {
// copy the keys
m_KeyMap.SetKeys(*key_map);
}
-
- if(block_cipher_factory == NULL)
- {
+
+ if (block_cipher_factory == NULL) {
m_BlockCipherFactory = &AP4_DefaultBlockCipherFactory::Instance;
- }
- else
- {
+ } else {
m_BlockCipherFactory = block_cipher_factory;
}
}
@@ -780,28 +727,25 @@ AP4_StandardDecryptingProcessor::AP4_StandardDecryptingProcessor(
/*----------------------------------------------------------------------
| AP4_StandardDecryptingProcessor:Initialize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_StandardDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
- AP4_ByteStream& /*stream*/,
- ProgressListener* /*listener*/)
+ AP4_ByteStream& /*stream*/,
+ ProgressListener* /*listener*/)
{
AP4_FtypAtom* ftyp = AP4_DYNAMIC_CAST(AP4_FtypAtom, top_level.GetChild(AP4_ATOM_TYPE_FTYP));
- if(ftyp)
- {
+ if (ftyp) {
// remove the atom, it will be replaced with a new one
top_level.RemoveChild(ftyp);
-
+
// keep the existing brand and compatible brands except for the ones we want to remove
AP4_Array<AP4_UI32> compatible_brands;
compatible_brands.EnsureCapacity(ftyp->GetCompatibleBrands().ItemCount());
- for(unsigned int i = 0; i < ftyp->GetCompatibleBrands().ItemCount(); i++)
- {
- if(ftyp->GetCompatibleBrands()[i] != AP4_OMA_DCF_BRAND_OPF2)
- {
+ for (unsigned int i=0; i<ftyp->GetCompatibleBrands().ItemCount(); i++) {
+ if (ftyp->GetCompatibleBrands()[i] != AP4_OMA_DCF_BRAND_OPF2) {
compatible_brands.Append(ftyp->GetCompatibleBrands()[i]);
}
}
-
+
// create a replacement for the major brand
top_level.AddChild(new AP4_FtypAtom(ftyp->GetMajorBrand(),
ftyp->GetMinorVersion(),
@@ -809,63 +753,57 @@ AP4_StandardDecryptingProcessor::Initialize(AP4_AtomParent& top_level,
compatible_brands.ItemCount()), 0);
delete ftyp;
}
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_StandardDecryptingProcessor:CreateTrackHandler
+---------------------------------------------------------------------*/
-AP4_Processor::TrackHandler*
+AP4_Processor::TrackHandler*
AP4_StandardDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// find the stsd atom
AP4_StsdAtom* stsd = AP4_DYNAMIC_CAST(AP4_StsdAtom, trak->FindChild("mdia/minf/stbl/stsd"));
// avoid tracks with no stsd atom (should not happen)
- if(stsd == NULL) return NULL;
+ if (stsd == NULL) return NULL;
// we only look at the first sample description
AP4_SampleDescription* desc = stsd->GetSampleDescription(0);
AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
- if(desc == NULL || entry == NULL) return NULL;
- if(desc->GetType() == AP4_SampleDescription::TYPE_PROTECTED)
- {
+ if (desc == NULL || entry == NULL) return NULL;
+ if (desc->GetType() == AP4_SampleDescription::TYPE_PROTECTED) {
// create a handler for this track
- AP4_ProtectedSampleDescription* protected_desc =
+ AP4_ProtectedSampleDescription* protected_desc =
static_cast<AP4_ProtectedSampleDescription*>(desc);
- if(protected_desc->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_OMA)
- {
+ if (protected_desc->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_OMA) {
const AP4_UI08* key = m_KeyMap.GetKey(trak->GetId());
- if(key)
- {
+ if (key) {
AP4_OmaDcfTrackDecrypter* handler = NULL;
- AP4_Result result = AP4_OmaDcfTrackDecrypter::Create(key,
- AP4_CIPHER_BLOCK_SIZE,
- protected_desc,
- entry,
- m_BlockCipherFactory,
- handler);
- if(AP4_FAILED(result)) return NULL;
+ AP4_Result result = AP4_OmaDcfTrackDecrypter::Create(key,
+ AP4_CIPHER_BLOCK_SIZE,
+ protected_desc,
+ entry,
+ m_BlockCipherFactory,
+ handler);
+ if (AP4_FAILED(result)) return NULL;
return handler;
}
- }
- else if(protected_desc->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_IAEC)
- {
+ } else if (protected_desc->GetSchemeType() == AP4_PROTECTION_SCHEME_TYPE_IAEC) {
const AP4_UI08* key = m_KeyMap.GetKey(trak->GetId());
- if(key)
- {
+ if (key) {
AP4_IsmaTrackDecrypter* handler = NULL;
- AP4_Result result = AP4_IsmaTrackDecrypter::Create(key,
- AP4_CIPHER_BLOCK_SIZE,
- protected_desc,
- entry,
- m_BlockCipherFactory,
- handler);
- if(AP4_FAILED(result)) return NULL;
+ AP4_Result result = AP4_IsmaTrackDecrypter::Create(key,
+ AP4_CIPHER_BLOCK_SIZE,
+ protected_desc,
+ entry,
+ m_BlockCipherFactory,
+ handler);
+ if (AP4_FAILED(result)) return NULL;
return handler;
}
- }
+ }
}
return NULL;
@@ -889,39 +827,36 @@ AP4_DecryptingStream::Create(CipherMode mode,
stream = NULL;
// default cipher settings
- if(block_cipher_factory == NULL)
- {
+ if (block_cipher_factory == NULL) {
block_cipher_factory = &AP4_DefaultBlockCipherFactory::Instance;
}
-
+
// get the encrypted size (includes padding)
AP4_LargeSize encrypted_size = 0;
AP4_Result result = encrypted_stream.GetSize(encrypted_size);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// check IV
- if(iv == NULL || iv_size != 16) return AP4_ERROR_INVALID_PARAMETERS;
-
+ if (iv == NULL || iv_size != 16) return AP4_ERROR_INVALID_PARAMETERS;
+
// check that the encrypted size is consistent with the cipher mode
- if(mode == CIPHER_MODE_CBC)
- {
+ if (mode == CIPHER_MODE_CBC) {
// we need at least 32 bytes of data+padding
// we also need a multiple of the block size
- if(encrypted_size < 32 || ((encrypted_size % 16) != 0))
- {
+ if (encrypted_size < 32 || ((encrypted_size % 16) != 0)) {
return AP4_ERROR_INVALID_FORMAT;
}
}
-
+
// create the stream cipher
AP4_BlockCipher* block_cipher;
result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
- (mode == CIPHER_MODE_CTR ?
+ (mode == CIPHER_MODE_CTR ?
AP4_BlockCipher::ENCRYPT :
AP4_BlockCipher::DECRYPT),
key, key_size, block_cipher);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// keep a reference to the source stream
encrypted_stream.AddReference();
@@ -937,24 +872,23 @@ AP4_DecryptingStream::Create(CipherMode mode,
dec_stream->m_BufferFullness = 0;
dec_stream->m_BufferOffset = 0;
dec_stream->m_ReferenceCount = 1;
-
+
// create the cipher according to the mode
- switch(mode)
- {
- case CIPHER_MODE_CBC:
- dec_stream->m_StreamCipher = new AP4_CbcStreamCipher(block_cipher,
- AP4_StreamCipher::DECRYPT);
- break;
- case CIPHER_MODE_CTR:
- dec_stream->m_StreamCipher = new AP4_CtrStreamCipher(block_cipher,
- NULL,
- AP4_CIPHER_BLOCK_SIZE);
- break;
- default:
- // should never occur
- AP4_ASSERT(0);
+ switch (mode) {
+ case CIPHER_MODE_CBC:
+ dec_stream->m_StreamCipher = new AP4_CbcStreamCipher(block_cipher,
+ AP4_StreamCipher::DECRYPT);
+ break;
+ case CIPHER_MODE_CTR:
+ dec_stream->m_StreamCipher = new AP4_CtrStreamCipher(block_cipher,
+ NULL,
+ AP4_CIPHER_BLOCK_SIZE);
+ break;
+ default:
+ // should never occur
+ AP4_ASSERT(0);
}
-
+
// set the IV
dec_stream->m_StreamCipher->SetIV(iv);
@@ -973,7 +907,7 @@ AP4_DecryptingStream::~AP4_DecryptingStream()
/*----------------------------------------------------------------------
| AP4_DecryptingStream::AddReference
+---------------------------------------------------------------------*/
-void
+void
AP4_DecryptingStream::AddReference()
{
++m_ReferenceCount;
@@ -982,40 +916,37 @@ AP4_DecryptingStream::AddReference()
/*----------------------------------------------------------------------
| AP4_DecryptingStream::Release
+---------------------------------------------------------------------*/
-void
+void
AP4_DecryptingStream::Release()
{
- if(--m_ReferenceCount == 0) delete this;
+ if (--m_ReferenceCount == 0) delete this;
}
/*----------------------------------------------------------------------
| AP4_DecryptingStream::ReadPartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_DecryptingStream::ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+AP4_Result
+AP4_DecryptingStream::ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read)
{
bytes_read = 0;
// never read more than what's available
- AP4_LargeSize available = m_CleartextSize - m_CleartextPosition;
- if(available < bytes_to_read)
- {
- if(available == 0)
- {
+ AP4_LargeSize available = m_CleartextSize-m_CleartextPosition;
+ if (available < bytes_to_read) {
+ if (available == 0) {
return AP4_ERROR_EOS;
}
bytes_to_read = (AP4_Size)available;
}
-
- if(m_BufferFullness)
- {
+
+ if (m_BufferFullness) {
// we have some leftovers
AP4_Size chunk = bytes_to_read;
- if(chunk > m_BufferFullness) chunk = m_BufferFullness;
+ if (chunk > m_BufferFullness) chunk = m_BufferFullness;
AP4_CopyMemory(buffer, &m_Buffer[m_BufferOffset], chunk);
- buffer = (char*)buffer + chunk;
+ buffer = (char*)buffer+chunk;
m_CleartextPosition += chunk;
available -= chunk;
bytes_to_read -= chunk;
@@ -1027,45 +958,36 @@ AP4_DecryptingStream::ReadPartial(void* buffer,
// seek to the right place in the input
m_EncryptedStream->Seek(m_EncryptedPosition);
- while(bytes_to_read)
- {
+ while (bytes_to_read) {
// read from the source
AP4_UI08 encrypted[16];
AP4_Size encrypted_read = 0;
AP4_Result result = m_EncryptedStream->ReadPartial(encrypted, 16, encrypted_read);
- if(result == AP4_ERROR_EOS)
- {
- if(bytes_read == 0)
- {
+ if (result == AP4_ERROR_EOS) {
+ if (bytes_read == 0) {
return AP4_ERROR_EOS;
- }
- else
- {
+ } else {
return AP4_SUCCESS;
}
- }
- else if(result != AP4_SUCCESS)
- {
+ } else if (result != AP4_SUCCESS) {
return result;
- }
- else
- {
+ } else {
m_EncryptedPosition += encrypted_read;
}
bool is_last_buffer = (m_EncryptedPosition >= m_EncryptedSize);
AP4_Size buffer_size = 16;
- result = m_StreamCipher->ProcessBuffer(encrypted,
- encrypted_read,
- m_Buffer,
+ result = m_StreamCipher->ProcessBuffer(encrypted,
+ encrypted_read,
+ m_Buffer,
&buffer_size,
is_last_buffer);
m_BufferOffset = 0;
m_BufferFullness = buffer_size;
AP4_Size chunk = bytes_to_read;
- if(chunk > m_BufferFullness) chunk = m_BufferFullness;
+ if (chunk > m_BufferFullness) chunk = m_BufferFullness;
AP4_CopyMemory(buffer, &m_Buffer[m_BufferOffset], chunk);
- buffer = (char*)buffer + chunk;
+ buffer = (char*)buffer+chunk;
m_CleartextPosition += chunk;
available -= chunk;
bytes_to_read -= chunk;
@@ -1080,9 +1002,9 @@ AP4_DecryptingStream::ReadPartial(void* buffer,
/*----------------------------------------------------------------------
| AP4_DecryptingStream::WritePartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_DecryptingStream::WritePartial(const void* /* buffer */,
- AP4_Size /* bytes_to_write */,
+AP4_Result
+AP4_DecryptingStream::WritePartial(const void* /* buffer */,
+ AP4_Size /* bytes_to_write */,
AP4_Size& /* bytes_written */)
{
return AP4_ERROR_NOT_SUPPORTED;
@@ -1091,47 +1013,45 @@ AP4_DecryptingStream::WritePartial(const void* /* buffer */,
/*----------------------------------------------------------------------
| AP4_DecryptingStream::Seek
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_DecryptingStream::Seek(AP4_Position position)
{
AP4_Cardinal preroll = 0;
-
+
// check bounds
- if(position > m_CleartextSize)
- {
+ if (position > m_CleartextSize) {
return AP4_ERROR_INVALID_PARAMETERS;
}
-
+
// try to put the stream cipher at the right offset
AP4_CHECK(m_StreamCipher->SetStreamOffset(position, &preroll));
// seek in the source stream
- AP4_CHECK(m_EncryptedStream->Seek(position - preroll));
-
+ AP4_CHECK(m_EncryptedStream->Seek(position-preroll));
+
// if we need to, process the preroll bytes
- if(preroll > 0)
- {
+ if (preroll > 0) {
AP4_Size out_size = 0;
AP4_UI08 buffer[2*AP4_CIPHER_BLOCK_SIZE]; // bigger than preroll
AP4_CHECK(m_EncryptedStream->Read(buffer, preroll));
AP4_CHECK(m_StreamCipher->ProcessBuffer(buffer, preroll, buffer, &out_size));
- AP4_ASSERT(out_size == 0); // we're just feeding prerolled bytes,
- // there can be no output
+ AP4_ASSERT(out_size == 0); // we're just feeding prerolled bytes,
+ // there can be no output
}
-
+
// update the counters
m_CleartextPosition = position;
m_EncryptedPosition = position;
m_BufferFullness = 0;
m_BufferOffset = 0;
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DecryptingStream::Tell
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_DecryptingStream::Tell(AP4_Position& position)
{
position = m_CleartextPosition;
@@ -1141,7 +1061,7 @@ AP4_DecryptingStream::Tell(AP4_Position& position)
/*----------------------------------------------------------------------
| AP4_DecryptingStream::GetSize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_DecryptingStream::GetSize(AP4_LargeSize& size)
{
size = m_CleartextSize;
@@ -1168,25 +1088,24 @@ AP4_EncryptingStream::Create(CipherMode mode,
// get the cleartext size
AP4_LargeSize cleartext_size = 0;
AP4_Result result = cleartext_stream.GetSize(cleartext_size);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// check IV
- if(iv == NULL || iv_size != 16) return AP4_ERROR_INVALID_PARAMETERS;
-
+ if (iv == NULL || iv_size != 16) return AP4_ERROR_INVALID_PARAMETERS;
+
// compute the encrypted size
AP4_LargeSize encrypted_size = cleartext_size;
- if(mode == CIPHER_MODE_CBC)
- {
- encrypted_size += (16 - (cleartext_size % 16)); // with padding
+ if (mode == CIPHER_MODE_CBC) {
+ encrypted_size += (16-(cleartext_size%16)); // with padding
}
-
+
// create the stream cipher
AP4_BlockCipher* block_cipher;
result = block_cipher_factory->Create(AP4_BlockCipher::AES_128,
AP4_BlockCipher::ENCRYPT,
key, key_size, block_cipher);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// keep a reference to the source stream
cleartext_stream.AddReference();
@@ -1204,30 +1123,28 @@ AP4_EncryptingStream::Create(CipherMode mode,
enc_stream->m_ReferenceCount = 1;
// deal with the prepended IV if required
- if(prepend_iv)
- {
+ if (prepend_iv) {
enc_stream->m_EncryptedSize += 16;
enc_stream->m_BufferFullness = 16;
AP4_CopyMemory(enc_stream->m_Buffer, iv, 16);
}
-
+
// create the cipher according to the mode
- switch(mode)
- {
- case CIPHER_MODE_CBC:
- enc_stream->m_StreamCipher = new AP4_CbcStreamCipher(block_cipher,
- AP4_StreamCipher::ENCRYPT);
- break;
- case CIPHER_MODE_CTR:
- enc_stream->m_StreamCipher = new AP4_CtrStreamCipher(block_cipher,
- NULL,
- AP4_CIPHER_BLOCK_SIZE);
- break;
- default:
- // should never occur
- AP4_ASSERT(0);
+ switch (mode) {
+ case CIPHER_MODE_CBC:
+ enc_stream->m_StreamCipher = new AP4_CbcStreamCipher(block_cipher,
+ AP4_StreamCipher::ENCRYPT);
+ break;
+ case CIPHER_MODE_CTR:
+ enc_stream->m_StreamCipher = new AP4_CtrStreamCipher(block_cipher,
+ NULL,
+ AP4_CIPHER_BLOCK_SIZE);
+ break;
+ default:
+ // should never occur
+ AP4_ASSERT(0);
}
-
+
// set the IV
enc_stream->m_StreamCipher->SetIV(iv);
@@ -1246,7 +1163,7 @@ AP4_EncryptingStream::~AP4_EncryptingStream()
/*----------------------------------------------------------------------
| AP4_EncryptingStream::AddReference
+---------------------------------------------------------------------*/
-void
+void
AP4_EncryptingStream::AddReference()
{
++m_ReferenceCount;
@@ -1255,37 +1172,35 @@ AP4_EncryptingStream::AddReference()
/*----------------------------------------------------------------------
| AP4_EncryptingStream::Release
+---------------------------------------------------------------------*/
-void
+void
AP4_EncryptingStream::Release()
{
- if(--m_ReferenceCount == 0) delete this;
+ if (--m_ReferenceCount == 0) delete this;
}
/*----------------------------------------------------------------------
| AP4_EncryptingStream::ReadPartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_EncryptingStream::ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+AP4_Result
+AP4_EncryptingStream::ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read)
{
bytes_read = 0;
// never read more than what's available
- AP4_LargeSize available = m_EncryptedSize - m_EncryptedPosition;
- if(available < bytes_to_read)
- {
- if(available == 0) return AP4_ERROR_EOS;
+ AP4_LargeSize available = m_EncryptedSize-m_EncryptedPosition;
+ if (available < bytes_to_read) {
+ if (available == 0) return AP4_ERROR_EOS;
bytes_to_read = (AP4_Size)available;
}
-
- if(m_BufferFullness)
- {
+
+ if (m_BufferFullness) {
// we have some leftovers
AP4_Size chunk = bytes_to_read;
- if(chunk > m_BufferFullness) chunk = m_BufferFullness;
+ if (chunk > m_BufferFullness) chunk = m_BufferFullness;
AP4_CopyMemory(buffer, &m_Buffer[m_BufferOffset], chunk);
- buffer = (char*)buffer + chunk;
+ buffer = (char*)buffer+chunk;
m_EncryptedPosition += chunk;
available -= chunk;
bytes_to_read -= chunk;
@@ -1297,47 +1212,37 @@ AP4_EncryptingStream::ReadPartial(void* buffer,
// seek to the right place in the input
m_CleartextStream->Seek(m_CleartextPosition);
- while(bytes_to_read)
- {
+ while (bytes_to_read) {
// read from the source
AP4_UI08 cleartext[16];
AP4_Size cleartext_read = 0;
AP4_Result result = m_CleartextStream->ReadPartial(cleartext, 16, cleartext_read);
- if(result == AP4_ERROR_EOS)
- {
- if(bytes_read == 0)
- {
+ if (result == AP4_ERROR_EOS) {
+ if (bytes_read == 0) {
return AP4_ERROR_EOS;
- }
- else
- {
+ } else {
return AP4_SUCCESS;
}
- }
- else if(result != AP4_SUCCESS)
- {
+ } else if (result != AP4_SUCCESS) {
return result;
- }
- else
- {
+ } else {
m_CleartextPosition += cleartext_read;
}
bool is_last_buffer = (m_CleartextPosition >= m_CleartextSize);
AP4_Size buffer_size = 32; // enough for one block plus one block padding
- result = m_StreamCipher->ProcessBuffer(cleartext,
- cleartext_read,
- m_Buffer,
+ result = m_StreamCipher->ProcessBuffer(cleartext,
+ cleartext_read,
+ m_Buffer,
&buffer_size,
is_last_buffer);
m_BufferOffset = 0;
m_BufferFullness = buffer_size;
AP4_Size chunk = bytes_to_read;
- if(chunk > m_BufferFullness) chunk = m_BufferFullness;
- if(chunk)
- {
+ if (chunk > m_BufferFullness) chunk = m_BufferFullness;
+ if (chunk) {
AP4_CopyMemory(buffer, &m_Buffer[m_BufferOffset], chunk);
- buffer = (char*)buffer + chunk;
+ buffer = (char*)buffer+chunk;
m_EncryptedPosition += chunk;
available -= chunk;
bytes_to_read -= chunk;
@@ -1353,9 +1258,9 @@ AP4_EncryptingStream::ReadPartial(void* buffer,
/*----------------------------------------------------------------------
| AP4_EncryptingStream::WritePartial
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_EncryptingStream::WritePartial(const void* /* buffer */,
- AP4_Size /* bytes_to_write */,
+AP4_Result
+AP4_EncryptingStream::WritePartial(const void* /* buffer */,
+ AP4_Size /* bytes_to_write */,
AP4_Size& /* bytes_written */)
{
return AP4_ERROR_NOT_SUPPORTED;
@@ -1364,15 +1269,12 @@ AP4_EncryptingStream::WritePartial(const void* /* buffer */,
/*----------------------------------------------------------------------
| AP4_EncryptingStream::Seek
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_EncryptingStream::Seek(AP4_Position position)
{
- if(position == m_EncryptedPosition)
- {
+ if (position == m_EncryptedPosition) {
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_NOT_SUPPORTED;
}
}
@@ -1380,7 +1282,7 @@ AP4_EncryptingStream::Seek(AP4_Position position)
/*----------------------------------------------------------------------
| AP4_EncryptingStream::Tell
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_EncryptingStream::Tell(AP4_Position& position)
{
position = m_EncryptedPosition;
@@ -1390,7 +1292,7 @@ AP4_EncryptingStream::Tell(AP4_Position& position)
/*----------------------------------------------------------------------
| AP4_EncryptingStream::GetSize
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_EncryptingStream::GetSize(AP4_LargeSize& size)
{
size = m_EncryptedSize;
@@ -1415,21 +1317,19 @@ AP4_DefaultBlockCipherFactory::Create(AP4_BlockCipher::CipherType type,
// setup default return vaule
cipher = NULL;
- switch(type)
- {
- case AP4_BlockCipher::AES_128:
- // check cipher parameters
- if(key == NULL || key_size != AP4_AES_BLOCK_SIZE)
- {
- return AP4_ERROR_INVALID_PARAMETERS;
- }
+ switch (type) {
+ case AP4_BlockCipher::AES_128:
+ // check cipher parameters
+ if (key == NULL || key_size != AP4_AES_BLOCK_SIZE) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
- // create the cipher
- cipher = new AP4_AesBlockCipher(key, direction);
- return AP4_SUCCESS;
+ // create the cipher
+ cipher = new AP4_AesBlockCipher(key, direction);
+ return AP4_SUCCESS;
- default:
- // not supported
- return AP4_ERROR_NOT_SUPPORTED;
+ default:
+ // not supported
+ return AP4_ERROR_NOT_SUPPORTED;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.h
index a7ff9f678..1979193ad 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Protection.h
@@ -50,7 +50,7 @@ class AP4_StreamCipher;
// this is fixed for now
const unsigned int AP4_PROTECTION_KEY_LENGTH = 16;
-const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_ITUNES = AP4_ATOM_TYPE('i', 't', 'u', 'n');
+const AP4_UI32 AP4_PROTECTION_SCHEME_TYPE_ITUNES = AP4_ATOM_TYPE('i','t','u','n');
/*----------------------------------------------------------------------
| AP4_EncaSampleEntry
@@ -71,7 +71,7 @@ public:
AP4_SampleDescription* ToSampleDescription();
// this method is used as a factory by the ISMACryp classes
- // NOTE: this should be named ToSampleDescription, but C++ has a
+ // NOTE: this should be named ToSampleDescription, but C++ has a
// problem with that because the base class does not have this
// overloaded method, but has another other one by that name
virtual AP4_SampleDescription* ToTargetSampleDescription(AP4_UI32 format);
@@ -96,7 +96,7 @@ public:
AP4_SampleDescription* ToSampleDescription();
// this method is used as a factory by the ISMACryp classes
- // NOTE: this should be named ToSampleDescription, but C++ has a
+ // NOTE: this should be named ToSampleDescription, but C++ has a
// problem with that because the base class does not have this
// overloaded method, but has another other one by that name
virtual AP4_SampleDescription* ToTargetSampleDescription(AP4_UI32 format);
@@ -144,8 +144,7 @@ public:
private:
// types
- class KeyEntry
- {
+ class KeyEntry {
public:
KeyEntry(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* iv = NULL);
void SetKey(const AP4_UI08* key, const AP4_UI08* iv);
@@ -172,18 +171,17 @@ public:
AP4_Result SetProperties(const AP4_TrackPropertyMap& properties);
const char* GetProperty(AP4_UI32 track_id, const char* name);
AP4_Result GetTextualHeaders(AP4_UI32 track_id, AP4_DataBuffer& buffer);
-
+
// destructor
virtual ~AP4_TrackPropertyMap();
private:
// types
- class Entry
- {
+ class Entry {
public:
Entry(AP4_UI32 track_id, const char* name, const char* value) :
- m_TrackId(track_id), m_Name(name), m_Value(value) {}
+ m_TrackId(track_id), m_Name(name), m_Value(value) {}
AP4_UI32 m_TrackId;
AP4_String m_Name;
AP4_String m_Value;
@@ -204,10 +202,7 @@ public:
virtual ~AP4_ProtectionSchemeInfo();
// accessors
- AP4_ContainerAtom* GetSchiAtom()
- {
- return m_SchiAtom;
- }
+ AP4_ContainerAtom* GetSchiAtom() { return m_SchiAtom; }
protected:
AP4_ContainerAtom* m_SchiAtom;
@@ -229,33 +224,19 @@ public:
AP4_UI32 scheme_version,
const char* scheme_uri,
AP4_ContainerAtom* schi_atom, // will be cloned
- bool transfer_ownership_of_original = true);
+ bool transfer_ownership_of_original=true);
~AP4_ProtectedSampleDescription();
-
+
// accessors
- AP4_SampleDescription* GetOriginalSampleDescription()
- {
+ AP4_SampleDescription* GetOriginalSampleDescription() {
return m_OriginalSampleDescription;
}
- AP4_UI32 GetOriginalFormat() const
- {
- return m_OriginalFormat;
- }
- AP4_UI32 GetSchemeType() const
- {
- return m_SchemeType;
- }
- AP4_UI32 GetSchemeVersion() const
- {
- return m_SchemeVersion;
- }
- const AP4_String& GetSchemeUri() const
- {
- return m_SchemeUri;
- }
- AP4_ProtectionSchemeInfo* GetSchemeInfo() const
- {
- return m_SchemeInfo;
+ AP4_UI32 GetOriginalFormat() const { return m_OriginalFormat; }
+ AP4_UI32 GetSchemeType() const { return m_SchemeType; }
+ AP4_UI32 GetSchemeVersion() const { return m_SchemeVersion; }
+ const AP4_String& GetSchemeUri() const { return m_SchemeUri; }
+ AP4_ProtectionSchemeInfo* GetSchemeInfo() const {
+ return m_SchemeInfo;
}
// implementation of abstract base class methods
@@ -279,20 +260,18 @@ class AP4_BlockCipher
{
public:
// types
- typedef enum
- {
+ typedef enum {
ENCRYPT,
DECRYPT
} CipherDirection;
- typedef enum
- {
+ typedef enum {
AES_128
} CipherType;
// constructor and destructor
virtual ~AP4_BlockCipher() {}
-
+
// methods
virtual AP4_Result ProcessBlock(const AP4_UI08* block_in, AP4_UI08* block_out) = 0;
};
@@ -356,14 +335,8 @@ public:
virtual ~AP4_SampleDecrypter() {}
// methods
- virtual AP4_Size GetDecryptedSampleSize(AP4_Sample& sample)
- {
- return sample.GetSize();
- }
- virtual AP4_Result SetSampleIndex(AP4_Ordinal /*index*/)
- {
- return AP4_SUCCESS;
- }
+ virtual AP4_Size GetDecryptedSampleSize(AP4_Sample& sample) { return sample.GetSize(); }
+ virtual AP4_Result SetSampleIndex(AP4_Ordinal /*index*/) { return AP4_SUCCESS; }
virtual AP4_Result DecryptSampleData(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out,
const AP4_UI08* iv = NULL) = 0;
@@ -380,11 +353,8 @@ public:
AP4_BlockCipherFactory* block_cipher_factory = NULL);
// accessors
- AP4_ProtectionKeyMap& GetKeyMap()
- {
- return m_KeyMap;
- }
-
+ AP4_ProtectionKeyMap& GetKeyMap() { return m_KeyMap; }
+
// methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level,
AP4_ByteStream& stream,
@@ -400,11 +370,9 @@ private:
/*----------------------------------------------------------------------
| AP4_DecryptingStream
+---------------------------------------------------------------------*/
-class AP4_DecryptingStream : public AP4_ByteStream
-{
+class AP4_DecryptingStream : public AP4_ByteStream {
public:
- typedef enum
- {
+ typedef enum {
CIPHER_MODE_CTR,
CIPHER_MODE_CBC
} CipherMode;
@@ -420,11 +388,11 @@ public:
AP4_ByteStream*& stream);
// AP4_ByteStream methods
- virtual AP4_Result ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+ virtual AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read);
- virtual AP4_Result WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+ virtual AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written);
virtual AP4_Result Seek(AP4_Position position);
virtual AP4_Result Tell(AP4_Position& position);
@@ -456,11 +424,9 @@ private:
/*----------------------------------------------------------------------
| AP4_EncryptingStream
+---------------------------------------------------------------------*/
-class AP4_EncryptingStream : public AP4_ByteStream
-{
+class AP4_EncryptingStream : public AP4_ByteStream {
public:
- typedef enum
- {
+ typedef enum {
CIPHER_MODE_CTR,
CIPHER_MODE_CBC
} CipherMode;
@@ -476,11 +442,11 @@ public:
AP4_ByteStream*& stream);
// AP4_ByteStream methods
- virtual AP4_Result ReadPartial(void* buffer,
- AP4_Size bytes_to_read,
+ virtual AP4_Result ReadPartial(void* buffer,
+ AP4_Size bytes_to_read,
AP4_Size& bytes_read);
- virtual AP4_Result WritePartial(const void* buffer,
- AP4_Size bytes_to_write,
+ virtual AP4_Result WritePartial(const void* buffer,
+ AP4_Size bytes_to_write,
AP4_Size& bytes_written);
virtual AP4_Result Seek(AP4_Position position);
virtual AP4_Result Tell(AP4_Position& position);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Results.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Results.cpp
index 6dbd42fd8..1bb2c5cd8 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Results.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Results.cpp
@@ -39,55 +39,30 @@
const char*
AP4_ResultText(int result)
{
- switch(result)
- {
- case AP4_SUCCESS:
- return "AP4_SUCCESS";
- case AP4_FAILURE:
- return "AP4_FAILURE";
- case AP4_ERROR_OUT_OF_MEMORY:
- return "AP4_ERROR_OUT_OF_MEMORY";
- case AP4_ERROR_INVALID_PARAMETERS:
- return "AP4_ERROR_INVALID_PARAMETERS";
- case AP4_ERROR_NO_SUCH_FILE:
- return "AP4_ERROR_NO_SUCH_FILE";
- case AP4_ERROR_PERMISSION_DENIED:
- return "AP4_ERROR_PERMISSION_DENIED";
- case AP4_ERROR_CANNOT_OPEN_FILE:
- return "AP4_ERROR_CANNOT_OPEN_FILE";
- case AP4_ERROR_EOS:
- return "AP4_ERROR_EOS";
- case AP4_ERROR_WRITE_FAILED:
- return "AP4_ERROR_WRITE_FAILED";
- case AP4_ERROR_READ_FAILED:
- return "AP4_ERROR_READ_FAILED";
- case AP4_ERROR_INVALID_FORMAT:
- return "AP4_ERROR_INVALID_FORMAT";
- case AP4_ERROR_NO_SUCH_ITEM:
- return "AP4_ERROR_NO_SUCH_ITEM";
- case AP4_ERROR_OUT_OF_RANGE:
- return "AP4_ERROR_OUT_OF_RANGE";
- case AP4_ERROR_INTERNAL:
- return "AP4_ERROR_INTERNAL";
- case AP4_ERROR_INVALID_STATE:
- return "AP4_ERROR_INVALID_STATE";
- case AP4_ERROR_LIST_EMPTY:
- return "AP4_ERROR_LIST_EMPTY";
- case AP4_ERROR_LIST_OPERATION_ABORTED:
- return "AP4_ERROR_LIST_OPERATION_ABORTED";
- case AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE:
- return "AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE";
- case AP4_ERROR_NOT_SUPPORTED:
- return "AP4_ERROR_NOT_SUPPORTED";
- case AP4_ERROR_INVALID_TRACK_TYPE:
- return "AP4_ERROR_INVALID_TRACK_TYPE";
- case AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA:
- return "AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA";
- case AP4_ERROR_BUFFER_TOO_SMALL:
- return "AP4_ERROR_BUFFER_TOO_SMALL";
- case AP4_ERROR_NOT_ENOUGH_DATA:
- return "AP4_ERROR_NOT_ENOUGH_DATA";
- default:
- return "UNKNOWN";
+ switch (result) {
+ case AP4_SUCCESS: return "AP4_SUCCESS";
+ case AP4_FAILURE: return "AP4_FAILURE";
+ case AP4_ERROR_OUT_OF_MEMORY: return "AP4_ERROR_OUT_OF_MEMORY";
+ case AP4_ERROR_INVALID_PARAMETERS: return "AP4_ERROR_INVALID_PARAMETERS";
+ case AP4_ERROR_NO_SUCH_FILE: return "AP4_ERROR_NO_SUCH_FILE";
+ case AP4_ERROR_PERMISSION_DENIED: return "AP4_ERROR_PERMISSION_DENIED";
+ case AP4_ERROR_CANNOT_OPEN_FILE: return "AP4_ERROR_CANNOT_OPEN_FILE";
+ case AP4_ERROR_EOS: return "AP4_ERROR_EOS";
+ case AP4_ERROR_WRITE_FAILED: return "AP4_ERROR_WRITE_FAILED";
+ case AP4_ERROR_READ_FAILED: return "AP4_ERROR_READ_FAILED";
+ case AP4_ERROR_INVALID_FORMAT: return "AP4_ERROR_INVALID_FORMAT";
+ case AP4_ERROR_NO_SUCH_ITEM: return "AP4_ERROR_NO_SUCH_ITEM";
+ case AP4_ERROR_OUT_OF_RANGE: return "AP4_ERROR_OUT_OF_RANGE";
+ case AP4_ERROR_INTERNAL: return "AP4_ERROR_INTERNAL";
+ case AP4_ERROR_INVALID_STATE: return "AP4_ERROR_INVALID_STATE";
+ case AP4_ERROR_LIST_EMPTY: return "AP4_ERROR_LIST_EMPTY";
+ case AP4_ERROR_LIST_OPERATION_ABORTED: return "AP4_ERROR_LIST_OPERATION_ABORTED";
+ case AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE: return "AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE";
+ case AP4_ERROR_NOT_SUPPORTED: return "AP4_ERROR_NOT_SUPPORTED";
+ case AP4_ERROR_INVALID_TRACK_TYPE: return "AP4_ERROR_INVALID_TRACK_TYPE";
+ case AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA: return "AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA";
+ case AP4_ERROR_BUFFER_TOO_SMALL: return "AP4_ERROR_BUFFER_TOO_SMALL";
+ case AP4_ERROR_NOT_ENOUGH_DATA: return "AP4_ERROR_NOT_ENOUGH_DATA";
+ default: return "UNKNOWN";
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.cpp
index 5308cf363..ad46363cd 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - sdp Atoms
+| AP4 - sdp Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -44,9 +44,8 @@ AP4_RtpAtom::AP4_RtpAtom(AP4_UI32 size, AP4_ByteStream& stream) :
stream.ReadUI32(m_DescriptionFormat);
// sdptext
- int str_size = size - (AP4_ATOM_HEADER_SIZE + 4);
- if(str_size)
- {
+ int str_size = size-(AP4_ATOM_HEADER_SIZE+4);
+ if (str_size) {
char* str = new char[str_size+1];
stream.Read(str, str_size);
str[str_size] = '\0'; // force null-termination
@@ -65,16 +64,16 @@ AP4_RtpAtom::WriteFields(AP4_ByteStream& stream)
// description format
result = stream.WriteUI32(m_DescriptionFormat);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// sdp text
result = stream.Write(m_SdpText.GetChars(), m_SdpText.GetLength());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
- AP4_Size padding = m_Size32 - (AP4_ATOM_HEADER_SIZE + 4 + m_SdpText.GetLength());
- while(padding--) stream.WriteUI08(0);
-
+ AP4_Size padding = m_Size32-(AP4_ATOM_HEADER_SIZE+4+m_SdpText.GetLength());
+ while (padding--) stream.WriteUI08(0);
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.h
index 1f30eebdc..596d96cfc 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - rtp Atoms
+| AP4 - rtp Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -49,16 +49,12 @@ class AP4_RtpAtom : public AP4_Atom
{
public:
// class methods
- static AP4_RtpAtom* Create(AP4_Size size, AP4_ByteStream& stream)
- {
+ static AP4_RtpAtom* Create(AP4_Size size, AP4_ByteStream& stream) {
return new AP4_RtpAtom(size, stream);
}
// methods
- const AP4_String& GetSdpText()
- {
- return m_SdpText;
- }
+ const AP4_String& GetSdpText() { return m_SdpText; }
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.cpp
index 71b1f915a..3f9f19c0e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.cpp
@@ -38,8 +38,7 @@
AP4_RtpSampleData::~AP4_RtpSampleData()
{
AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
- while(it != NULL)
- {
+ while (it != NULL) {
it->GetData()->Release();
it = it->GetNext();
}
@@ -56,22 +55,20 @@ AP4_RtpSampleData::AP4_RtpSampleData(AP4_ByteStream& stream, AP4_UI32 size)
AP4_UI16 packet_count;
stream.ReadUI16(packet_count);
-
+
AP4_UI16 reserved;
stream.ReadUI16(reserved); // later, check that reserved is 0
// packets
- for(AP4_UI16 i = 0; i < packet_count; i++)
- {
+ for (AP4_UI16 i=0; i<packet_count; i++) {
AP4_RtpPacket* packet = new AP4_RtpPacket(stream);
m_Packets.Add(packet);
}
// extra data
stream.Tell(extra_data_start);
- AP4_Size extra_data_size = size - (AP4_UI32)(extra_data_start - start);
- if(extra_data_size != 0)
- {
+ AP4_Size extra_data_size = size - (AP4_UI32)(extra_data_start-start);
+ if (extra_data_size != 0) {
m_ExtraData.SetDataSize(extra_data_size);
stream.Read(m_ExtraData.UseData(), extra_data_size);
}
@@ -88,8 +85,7 @@ AP4_RtpSampleData::GetSize()
// packets
AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
- while(it != NULL)
- {
+ while (it != NULL) {
result = it->GetData()->GetSize();
it = it->GetNext();
}
@@ -114,23 +110,22 @@ AP4_RtpSampleData::ToByteStream()
// write in it
AP4_Result result = stream->WriteUI16(static_cast<AP4_UI16>(m_Packets.ItemCount()));
- if(AP4_FAILED(result)) goto bail;
+ if (AP4_FAILED(result)) goto bail;
result = stream->WriteUI16(0); // reserved
- if(AP4_FAILED(result)) goto bail;
+ if (AP4_FAILED(result)) goto bail;
{
AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
- while(it != NULL)
- {
+ while (it != NULL) {
result = it->GetData()->Write(*stream);
- if(AP4_FAILED(result)) goto bail;
+ if (AP4_FAILED(result)) goto bail;
it = it->GetNext();
}
}
result = stream->Write(m_ExtraData.GetData(), m_ExtraData.GetDataSize());
- if(AP4_FAILED(result)) goto bail;
+ if (AP4_FAILED(result)) goto bail;
// return
return stream;
@@ -154,14 +149,14 @@ AP4_RtpSampleData::AddPacket(AP4_RtpPacket* packet)
/*----------------------------------------------------------------------
| AP4_RtpPacket::AP4_RtpPacket
+---------------------------------------------------------------------*/
-AP4_RtpPacket::AP4_RtpPacket(int relative_time,
- bool p_bit,
- bool x_bit,
- bool m_bit,
- AP4_UI08 payload_type,
- AP4_UI16 sequence_seed,
+AP4_RtpPacket::AP4_RtpPacket(int relative_time,
+ bool p_bit,
+ bool x_bit,
+ bool m_bit,
+ AP4_UI08 payload_type,
+ AP4_UI16 sequence_seed,
int time_stamp_offset /* = 0 */,
- bool bframe_flag /* = false */,
+ bool bframe_flag /* = false */,
bool repeat_flag /* = false */) :
m_ReferenceCount(1),
m_RelativeTime(relative_time),
@@ -216,36 +211,31 @@ AP4_RtpPacket::AP4_RtpPacket(AP4_ByteStream& stream) :
stream.ReadUI16(constructor_count);
// parse the packet extra data
- if(extra_flag)
- {
+ if (extra_flag) {
// read the length
AP4_UI32 extra_length;
stream.ReadUI32(extra_length);
- // check it
- if(extra_length < 4) return;
+ // check it
+ if (extra_length < 4) return;
// now read the entries
extra_length -= 4;
- while(extra_length > 0)
- {
+ while (extra_length > 0) {
AP4_UI32 entry_length;
AP4_UI32 entry_tag;
stream.ReadUI32(entry_length);
stream.ReadUI32(entry_tag);
// check the entry
- if(entry_length < 8) return;
+ if (entry_length < 8) return;
// parse the single entry that's currently defined in the spec
- if(entry_tag == AP4_ATOM_TYPE('r', 't', 'p', 'o') && entry_length == 12)
- {
+ if (entry_tag == AP4_ATOM_TYPE('r','t','p','o') && entry_length == 12) {
AP4_UI32 time_stamp_offset;
stream.ReadUI32(time_stamp_offset);
m_TimeStampOffset = time_stamp_offset;
- }
- else
- {
+ } else {
// ignore it
AP4_Position cur_pos;
stream.Tell(cur_pos);
@@ -257,8 +247,7 @@ AP4_RtpPacket::AP4_RtpPacket(AP4_ByteStream& stream) :
}
// constructors
- for(AP4_UI16 i = 0; i < constructor_count; i++)
- {
+ for (AP4_UI16 i=0; i<constructor_count; i++) {
AP4_RtpConstructor* constructor = NULL;
AP4_RtpConstructorFactory::CreateConstructorFromStream(stream, constructor);
m_Constructors.Add(constructor);
@@ -271,8 +260,7 @@ AP4_RtpPacket::AP4_RtpPacket(AP4_ByteStream& stream) :
AP4_RtpPacket::~AP4_RtpPacket()
{
AP4_List<AP4_RtpConstructor>::Item* it = m_Constructors.FirstItem();
- while(it != NULL)
- {
+ while (it != NULL) {
it->GetData()->Release();
it = it->GetNext();
}
@@ -293,8 +281,7 @@ AP4_RtpPacket::AddReference()
void
AP4_RtpPacket::Release()
{
- if(--m_ReferenceCount == 0)
- {
+ if (--m_ReferenceCount == 0) {
delete this;
}
}
@@ -305,7 +292,7 @@ AP4_RtpPacket::Release()
AP4_Size
AP4_RtpPacket::GetSize()
{
- AP4_Size result = 12 + (m_TimeStampOffset != 0) ? 16 : 0;
+ AP4_Size result = 12 + (m_TimeStampOffset != 0)?16:0;
result += m_Constructors.ItemCount() * AP4_RTP_CONSTRUCTOR_SIZE;
return result;
}
@@ -314,60 +301,58 @@ AP4_RtpPacket::GetSize()
| AP4_RtpPacket::Write
+---------------------------------------------------------------------*/
AP4_Result
-AP4_RtpPacket::Write(AP4_ByteStream& stream)
+AP4_RtpPacket::Write(AP4_ByteStream& stream)
{
// check the payload type
- if(m_PayloadType > 128) return AP4_FAILURE;
+ if (m_PayloadType > 128) return AP4_FAILURE;
// now write
AP4_Result result = stream.WriteUI32(m_RelativeTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(0x80 | m_PBit << 5 | m_XBit << 4);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(m_MBit << 7 | m_PayloadType);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_SequenceSeed);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(0);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// deal with extra flag
bool extra_flag = m_TimeStampOffset != 0;
- result = stream.WriteUI08(0x00 | extra_flag << 2
- | m_BFrameFlag << 1
- | m_RepeatFlag << 0);
- if(AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(0x00 | extra_flag << 2
+ | m_BFrameFlag << 1
+ | m_RepeatFlag << 0);
+ if (AP4_FAILED(result)) return result;
// constructor count
result = stream.WriteUI16(static_cast<AP4_UI16>(m_Constructors.ItemCount()));
// write extra data
- if(extra_flag)
- {
+ if (extra_flag) {
// extra_length
result = stream.WriteUI32(16); // 4 (extra_length) + 12 (rtpo atom)
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// rtpo atom
result = stream.WriteUI32(12); // size
- if(AP4_FAILED(result)) return result;
- result = stream.WriteUI32(AP4_ATOM_TYPE('r', 't', 'p', 'o'));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(AP4_ATOM_TYPE('r','t','p','o'));
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TimeStampOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// constructors
AP4_List<AP4_RtpConstructor>::Item* it = m_Constructors.FirstItem();
- while(it != NULL)
- {
+ while (it != NULL) {
result = it->GetData()->Write(stream);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
it = it->GetNext();
}
return result;
@@ -377,7 +362,7 @@ AP4_RtpPacket::Write(AP4_ByteStream& stream)
| AP4_RtpPacket::AddConstructor
+---------------------------------------------------------------------*/
AP4_Result
-AP4_RtpPacket::AddConstructor(AP4_RtpConstructor* constructor)
+AP4_RtpPacket::AddConstructor(AP4_RtpConstructor* constructor)
{
constructor->AddReference();
return m_Constructors.Add(constructor);
@@ -393,10 +378,9 @@ AP4_RtpPacket::GetConstructedDataSize()
AP4_Size size = 12;
// constructed data from constructors
- AP4_List<AP4_RtpConstructor>::Item* constructors_it
- = m_Constructors.FirstItem();
- while(constructors_it != NULL)
- {
+ AP4_List<AP4_RtpConstructor>::Item* constructors_it
+ = m_Constructors.FirstItem();
+ while (constructors_it != NULL) {
size += constructors_it->GetData()->GetConstructedDataSize();
constructors_it = constructors_it->GetNext();
}
@@ -420,8 +404,7 @@ AP4_RtpConstructor::AddReference()
void
AP4_RtpConstructor::Release()
{
- if(--m_ReferenceCount == 0)
- {
+ if (--m_ReferenceCount == 0) {
delete this;
}
}
@@ -432,7 +415,7 @@ AP4_Result
AP4_RtpConstructor::Write(AP4_ByteStream& stream)
{
AP4_Result result = stream.WriteUI08(m_Type);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return DoWrite(stream);
}
@@ -445,7 +428,7 @@ AP4_NoopRtpConstructor::AP4_NoopRtpConstructor(AP4_ByteStream& stream) :
{
AP4_Position cur_offset;
stream.Tell(cur_offset);
- stream.Seek(cur_offset + 15);
+ stream.Seek(cur_offset+15);
}
/*----------------------------------------------------------------------
@@ -483,7 +466,7 @@ AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor(AP4_ByteStream& stream)
stream.Read(m_Data.UseData(), data_size);
// reposition the stream
- stream.Seek(cur_offset + 15);
+ stream.Seek(cur_offset+15);
}
@@ -494,26 +477,26 @@ AP4_Result
AP4_ImmediateRtpConstructor::DoWrite(AP4_ByteStream& stream)
{
// first check that the data is not too large
- if(m_Data.GetDataSize() > 14) return AP4_FAILURE;
+ if (m_Data.GetDataSize() > 14) return AP4_FAILURE;
// now write
AP4_Result result = stream.WriteUI08(static_cast<AP4_UI08>(m_Data.GetDataSize()));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Write(m_Data.GetData(), m_Data.GetDataSize());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// pad
AP4_Byte pad[14];
- return stream.Write(pad, sizeof(pad) - m_Data.GetDataSize());
+ return stream.Write(pad, sizeof(pad)-m_Data.GetDataSize());
}
/*----------------------------------------------------------------------
| AP4_SampleRtpConstructor::AP4_SampleRtpConstructor
+---------------------------------------------------------------------*/
-AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_UI08 track_ref_index,
- AP4_UI16 length,
- AP4_UI32 sample_num,
- AP4_UI32 sample_offset) :
+AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_num,
+ AP4_UI32 sample_offset) :
AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE),
m_TrackRefIndex(track_ref_index),
m_Length(length),
@@ -538,7 +521,7 @@ AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_ByteStream& stream) :
stream.ReadUI32(m_SampleOffset);
// reposition the stream
- stream.Seek(cur_offset + 15);
+ stream.Seek(cur_offset+15);
}
/*----------------------------------------------------------------------
| AP4_SampleRtpConstructor::DoWrite
@@ -547,19 +530,19 @@ AP4_Result
AP4_SampleRtpConstructor::DoWrite(AP4_ByteStream& stream)
{
AP4_Result result = stream.WriteUI08(m_TrackRefIndex);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_Length);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_SampleNum);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_SampleOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(1); // bytes per block
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return stream.WriteUI16(1); // samples per block
}
@@ -567,10 +550,10 @@ AP4_SampleRtpConstructor::DoWrite(AP4_ByteStream& stream)
/*----------------------------------------------------------------------
| AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor
+---------------------------------------------------------------------*/
-AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_UI08 track_ref_index,
- AP4_UI16 length,
- AP4_UI32 sample_desc_index,
- AP4_UI32 sample_desc_offset) :
+AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_desc_index,
+ AP4_UI32 sample_desc_offset) :
AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC),
m_TrackRefIndex(track_ref_index),
m_Length(length),
@@ -595,7 +578,7 @@ AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_ByteStream& strea
stream.ReadUI32(m_SampleDescOffset);
// reposition the stream
- stream.Seek(cur_offset + 15);
+ stream.Seek(cur_offset+15);
}
/*----------------------------------------------------------------------
@@ -605,16 +588,16 @@ AP4_Result
AP4_SampleDescRtpConstructor::DoWrite(AP4_ByteStream& stream)
{
AP4_Result result = stream.WriteUI08(m_TrackRefIndex);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_Length);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_SampleDescIndex);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_SampleDescOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return stream.WriteUI32(0); // reserved
}
@@ -623,31 +606,30 @@ AP4_SampleDescRtpConstructor::DoWrite(AP4_ByteStream& stream)
| AP4_RtpConstructorFactory::CreateConstructorFromStream
+---------------------------------------------------------------------*/
AP4_Result
-AP4_RtpConstructorFactory::CreateConstructorFromStream(AP4_ByteStream& stream,
- AP4_RtpConstructor*& constructor)
+AP4_RtpConstructorFactory::CreateConstructorFromStream(AP4_ByteStream& stream,
+ AP4_RtpConstructor*& constructor)
{
// read the first byte (type)
AP4_RtpConstructor::Type type;
AP4_Result result = stream.ReadUI08(type);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// now create the right constructor
- switch(type)
- {
- case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
- constructor = new AP4_NoopRtpConstructor(stream);
- break;
- case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
- constructor = new AP4_ImmediateRtpConstructor(stream);
- break;
- case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
- constructor = new AP4_SampleRtpConstructor(stream);
- break;
- case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
- constructor = new AP4_SampleDescRtpConstructor(stream);
- break;
- default:
- return AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE;
+ switch(type) {
+ case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
+ constructor = new AP4_NoopRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
+ constructor = new AP4_ImmediateRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
+ constructor = new AP4_SampleRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
+ constructor = new AP4_SampleDescRtpConstructor(stream);
+ break;
+ default:
+ return AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE;
}
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.h
index 7972c119f..f747c8212 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4RtpHint.h
@@ -59,14 +59,12 @@ public:
virtual AP4_Result AddPacket(AP4_RtpPacket* packet);
virtual AP4_Size GetSize();
virtual AP4_ByteStream* ToByteStream();
-
+
// accessors
- AP4_List<AP4_RtpPacket>& GetPackets()
- {
+ AP4_List<AP4_RtpPacket>& GetPackets() {
return m_Packets;
}
- const AP4_DataBuffer& GetExtraData() const
- {
+ const AP4_DataBuffer& GetExtraData() const {
return m_ExtraData;
}
@@ -104,52 +102,24 @@ public:
// Referenceable methods
void AddReference();
void Release();
-
+
// Accessors
- int GetRelativeTime() const
- {
- return m_RelativeTime;
- }
- bool GetPBit() const
- {
- return m_PBit;
- }
- bool GetXBit() const
- {
- return m_XBit;
- }
- bool GetMBit() const
- {
- return m_MBit;
- }
- AP4_UI08 GetPayloadType() const
- {
- return m_PayloadType;
- }
- AP4_UI16 GetSequenceSeed() const
- {
- return m_SequenceSeed;
- }
- int GetTimeStampOffset() const
- {
- return m_TimeStampOffset;
- }
- bool GetBFrameFlag() const
- {
- return m_BFrameFlag;
- }
- bool GetRepeatFlag() const
- {
- return m_RepeatFlag;
- }
- AP4_List<AP4_RtpConstructor>& GetConstructors()
- {
+ int GetRelativeTime() const { return m_RelativeTime; }
+ bool GetPBit() const { return m_PBit; }
+ bool GetXBit() const { return m_XBit; }
+ bool GetMBit() const { return m_MBit; }
+ AP4_UI08 GetPayloadType() const { return m_PayloadType; }
+ AP4_UI16 GetSequenceSeed() const { return m_SequenceSeed; }
+ int GetTimeStampOffset() const { return m_TimeStampOffset; }
+ bool GetBFrameFlag() const { return m_BFrameFlag; }
+ bool GetRepeatFlag() const { return m_RepeatFlag; }
+ AP4_List<AP4_RtpConstructor>& GetConstructors() {
return m_Constructors;
}
private:
// members
- AP4_Cardinal m_ReferenceCount;
+ AP4_Cardinal m_ReferenceCount;
int m_RelativeTime;
bool m_PBit;
bool m_XBit;
@@ -175,10 +145,7 @@ public:
AP4_RtpConstructor(Type type) : m_ReferenceCount(1), m_Type(type) {}
// methods
- Type GetType() const
- {
- return m_Type;
- }
+ Type GetType() const { return m_Type; }
AP4_Result Write(AP4_ByteStream& stream);
virtual AP4_Size GetConstructedDataSize() = 0;
@@ -220,10 +187,7 @@ public:
AP4_NoopRtpConstructor() : AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_NOOP) {}
// methods
- virtual AP4_Size GetConstructedDataSize()
- {
- return 0;
- }
+ virtual AP4_Size GetConstructedDataSize() { return 0; }
protected:
// methods
@@ -239,18 +203,12 @@ public:
// constructor
AP4_ImmediateRtpConstructor(AP4_ByteStream& stream);
AP4_ImmediateRtpConstructor(const AP4_DataBuffer& data);
-
+
// accessors
- const AP4_DataBuffer& GetData() const
- {
- return m_Data;
- }
+ const AP4_DataBuffer& GetData() const { return m_Data; }
// methods
- virtual AP4_Size GetConstructedDataSize()
- {
- return m_Data.GetDataSize();
- }
+ virtual AP4_Size GetConstructedDataSize() { return m_Data.GetDataSize(); }
protected:
// methods
@@ -272,30 +230,15 @@ public:
AP4_UI16 length,
AP4_UI32 sample_num,
AP4_UI32 sample_offset);
-
+
// accessors
- AP4_UI08 GetTrackRefIndex() const
- {
- return m_TrackRefIndex;
- }
- AP4_UI16 GetLength() const
- {
- return m_Length;
- }
- AP4_UI32 GetSampleNum() const
- {
- return m_SampleNum;
- }
- AP4_UI32 GetSampleOffset() const
- {
- return m_SampleOffset;
- }
+ AP4_UI08 GetTrackRefIndex() const { return m_TrackRefIndex; }
+ AP4_UI16 GetLength() const { return m_Length; }
+ AP4_UI32 GetSampleNum() const { return m_SampleNum; }
+ AP4_UI32 GetSampleOffset() const { return m_SampleOffset; }
// methods
- virtual AP4_Size GetConstructedDataSize()
- {
- return m_Length;
- }
+ virtual AP4_Size GetConstructedDataSize() { return m_Length; }
protected:
// methods
@@ -322,29 +265,14 @@ public:
AP4_UI32 sample_desc_offset);
// accessors
- AP4_UI08 GetTrackRefIndex() const
- {
- return m_TrackRefIndex;
- }
- AP4_UI16 GetLength() const
- {
- return m_Length;
- }
- AP4_UI32 GetSampleDescIndex() const
- {
- return m_SampleDescIndex;
- }
- AP4_UI32 GetSampleDescOffset() const
- {
- return m_SampleDescOffset;
- }
+ AP4_UI08 GetTrackRefIndex() const { return m_TrackRefIndex; }
+ AP4_UI16 GetLength() const { return m_Length; }
+ AP4_UI32 GetSampleDescIndex() const { return m_SampleDescIndex; }
+ AP4_UI32 GetSampleDescOffset() const { return m_SampleDescOffset; }
// methods
- virtual AP4_Size GetConstructedDataSize()
- {
- return m_Length;
- }
-
+ virtual AP4_Size GetConstructedDataSize() { return m_Length; }
+
protected:
// methods
virtual AP4_Result DoWrite(AP4_ByteStream& stream);
@@ -359,11 +287,11 @@ protected:
/*----------------------------------------------------------------------
| AP4_RtpConstructorFactory
+---------------------------------------------------------------------*/
-class AP4_RtpConstructorFactory
+class AP4_RtpConstructorFactory
{
public:
static AP4_Result CreateConstructorFromStream(AP4_ByteStream& stream,
- AP4_RtpConstructor*& constructor);
+ AP4_RtpConstructor*& constructor);
};
#endif // _AP4_RTP_HINT_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
index 38a01ce36..7b791c3e4 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - SLConfig Descriptor
+| AP4 - SLConfig Descriptor
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h
index 66820e6a3..73a26ec9b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - SLConfig Descriptor
+| AP4 - SLConfig Descriptor
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -43,7 +43,7 @@ const AP4_UI08 AP4_DESCRIPTOR_TAG_SL_CONFIG = 0x06;
/*----------------------------------------------------------------------
| AP4_SLConfigDescriptor
+---------------------------------------------------------------------*/
-class AP4_SLConfigDescriptor : public AP4_Descriptor
+class AP4_SLConfigDescriptor : public AP4_Descriptor
{
public:
// methods
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.cpp
index d0a15aa55..060084044 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.cpp
@@ -135,21 +135,21 @@ AP4_Result
AP4_Sample::ReadData(AP4_DataBuffer& data, AP4_Size size, AP4_Size offset)
{
// check that we have a stream
- if(m_DataStream == NULL) return AP4_FAILURE;
+ if (m_DataStream == NULL) return AP4_FAILURE;
// shortcut
- if(size == 0) return AP4_SUCCESS;
+ if (size == 0) return AP4_SUCCESS;
// check the size
- if(m_Size < size + offset) return AP4_FAILURE;
+ if (m_Size < size+offset) return AP4_FAILURE;
// set the buffer size
AP4_Result result = data.SetDataSize(size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// get the data from the stream
- result = m_DataStream->Seek(m_Offset + offset);
- if(AP4_FAILED(result)) return result;
+ result = m_DataStream->Seek(m_Offset+offset);
+ if (AP4_FAILED(result)) return result;
return m_DataStream->Read(data.UseData(), size);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.h
index 0af63fbac..ba5a0235f 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Sample.h
@@ -43,7 +43,7 @@ class AP4_DataBuffer;
/*----------------------------------------------------------------------
| AP4_Sample DO NOT DERIVE FROM THIS CLASS
+---------------------------------------------------------------------*/
-class AP4_Sample
+class AP4_Sample
{
public:
/**
@@ -55,19 +55,19 @@ public:
* Copy constructor
*/
AP4_Sample(const AP4_Sample& other);
-
+
/**
* Construct an AP4_Sample referencing a data stream
*
- * @param data_stream The byte stream that contains the sample data.
- * The sample object added to the track will keep a reference to that byte
+ * @param data_stream The byte stream that contains the sample data.
+ * The sample object added to the track will keep a reference to that byte
* stream
* @param offset Position of the first byte of sample data within the stream
* @param size Size in bytes of the sample data
- * @param description_index Index of the sample description that applies to
+ * @param description_index Index of the sample description that applies to
* this sample
* @param dts Decoding timestamp of the sample
- * @param cts_delta Difference between the CTS (composition/display timestamp) and the
+ * @param cts_delta Difference between the CTS (composition/display timestamp) and the
* DTS (decoding timestamp), in the timescale of the media.
* @param sync_flag Boolean flag indicating whether this is a sync sample
* or not
@@ -80,7 +80,7 @@ public:
AP4_UI64 dts,
AP4_UI32 cts_delta,
bool sync_flag);
-
+
~AP4_Sample(); // not virtual on purpose: do not derive from it
// operators
@@ -88,119 +88,71 @@ public:
// methods
AP4_Result ReadData(AP4_DataBuffer& data);
- AP4_Result ReadData(AP4_DataBuffer& data,
- AP4_Size size,
+ AP4_Result ReadData(AP4_DataBuffer& data,
+ AP4_Size size,
AP4_Size offset = 0);
// sample properties accessors
AP4_ByteStream* GetDataStream();
void SetDataStream(AP4_ByteStream& stream);
- AP4_Position GetOffset() const
- {
- return m_Offset;
- }
- void SetOffset(AP4_Position offset)
- {
- m_Offset = offset;
- }
- AP4_Size GetSize()
- {
- return m_Size;
- }
- void SetSize(AP4_Size size)
- {
- m_Size = size;
- }
- AP4_Ordinal GetDescriptionIndex() const
- {
- return m_DescriptionIndex;
- }
- void SetDescriptionIndex(AP4_Ordinal index)
- {
- m_DescriptionIndex = index;
- }
-
+ AP4_Position GetOffset() const { return m_Offset; }
+ void SetOffset(AP4_Position offset) { m_Offset = offset; }
+ AP4_Size GetSize() { return m_Size; }
+ void SetSize(AP4_Size size) { m_Size = size; }
+ AP4_Ordinal GetDescriptionIndex() const { return m_DescriptionIndex; }
+ void SetDescriptionIndex(AP4_Ordinal index) { m_DescriptionIndex = index; }
+
/**
* Get the DTS (Decoding Time Stamp) of the sample in the timescale of the media
*/
- AP4_UI64 GetDts() const
- {
- return m_Dts;
- }
+ AP4_UI64 GetDts() const { return m_Dts; }
/**
* Set the DTS (Decoding Time Stamp) of the sample in the timescale of the media
*/
- void SetDts(AP4_UI64 dts)
- {
- m_Dts = dts;
- }
+ void SetDts(AP4_UI64 dts) { m_Dts = dts; }
/**
* Get the CTS (Composition Time Stamp) of the sample in the timescale of the media
*/
- AP4_UI64 GetCts() const
- {
- return m_Dts + m_CtsDelta;
- }
+ AP4_UI64 GetCts() const { return m_Dts+m_CtsDelta; }
/**
* Set the CTS (Composition Time Stamp) of the sample in the timescale of the media
*/
- void SetCts(AP4_UI64 cts)
- {
- m_CtsDelta = (cts > m_Dts) ? (AP4_UI32)(cts - m_Dts) : 0;
- }
+ void SetCts(AP4_UI64 cts) { m_CtsDelta = (cts > m_Dts) ? (AP4_UI32)(cts-m_Dts) : 0; }
/**
* Get the CTS Delta (difference between the CTS (Composition Time Stamp) and DTS (Decoding Time Stamp)
* of the sample in the timescale of the media.
*/
- AP4_UI32 GetCtsDelta() const
- {
- return m_CtsDelta;
- }
+ AP4_UI32 GetCtsDelta() const { return m_CtsDelta; }
/**
* Set the CTS Delta (difference between the CTS (Composition Time Stamp) and DTS (Decoding Time Stamp)
* of the sample in the timescale of the media.
*/
- void SetCtsDelta(AP4_UI32 delta)
- {
- m_CtsDelta = (AP4_SI32)delta;
- }
+ void SetCtsDelta(AP4_UI32 delta) { m_CtsDelta = (AP4_SI32)delta; }
/**
* Get the duration of the sample in the timescale of the media
*/
- AP4_UI32 GetDuration() const
- {
- return m_Duration;
- }
+ AP4_UI32 GetDuration() const { return m_Duration; }
/**
* Set the duration of the sample in the timescale of the media
*/
- void SetDuration(AP4_UI32 duration)
- {
- m_Duration = duration;
- }
+ void SetDuration(AP4_UI32 duration) { m_Duration = duration; }
/**
* Return whether the sample is a sync (random-access point) sample or not.
*/
- bool IsSync() const
- {
- return m_IsSync;
- }
+ bool IsSync() const { return m_IsSync; }
/**
* Set whether the sample is a sync (random-access point) sample or not.
*/
- void SetSync(bool is_sync)
- {
- m_IsSync = is_sync;
- }
+ void SetSync(bool is_sync) { m_IsSync = is_sync; }
protected:
AP4_ByteStream* m_DataStream;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.cpp
index f7a0b1698..e301d0cf4 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.cpp
@@ -56,70 +56,38 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_AvcSampleDescription)
const char*
AP4_GetFormatName(AP4_UI32 format)
{
- switch(format)
- {
- case AP4_SAMPLE_FORMAT_MP4A:
- return "MPEG-4 Audio";
- case AP4_SAMPLE_FORMAT_MP4V:
- return "MPEG-4 Video";
- case AP4_SAMPLE_FORMAT_MP4S:
- return "MPEG-4 Systems";
- case AP4_SAMPLE_FORMAT_ALAC:
- return "Apple Lossless Audio";
- case AP4_SAMPLE_FORMAT_AVC1:
- return "H.264";
- case AP4_SAMPLE_FORMAT_OVC1:
- return "VC-1";
- case AP4_SAMPLE_FORMAT_OWMA:
- return "WMA";
- case AP4_SAMPLE_FORMAT_AC_3:
- return "Dolby Digital (AC-3)";
- case AP4_SAMPLE_FORMAT_EC_3:
- return "Dolby Digital Plus (Enhanced AC-3)";
- case AP4_SAMPLE_FORMAT_AVCP:
- return "Advanced Video Coding Parameters";
- case AP4_SAMPLE_FORMAT_DRAC:
- return "Dirac";
- case AP4_SAMPLE_FORMAT_DRA1:
- return "DRA Audio";
- case AP4_SAMPLE_FORMAT_G726:
- return "G726";
- case AP4_SAMPLE_FORMAT_MJP2:
- return "Motion JPEG 2000";
- case AP4_SAMPLE_FORMAT_OKSD:
- return "OMA Keys";
- case AP4_SAMPLE_FORMAT_RAW_:
- return "Uncompressed Audio";
- case AP4_SAMPLE_FORMAT_RTP_:
- return "RTP Hints";
- case AP4_SAMPLE_FORMAT_S263:
- return "H.263";
- case AP4_SAMPLE_FORMAT_SAMR:
- return "Narrowband AMR";
- case AP4_SAMPLE_FORMAT_SAWB:
- return "Wideband AMR";
- case AP4_SAMPLE_FORMAT_SAWP:
- return "Extended AMR";
- case AP4_SAMPLE_FORMAT_SEVC:
- return "EVRC Voice";
- case AP4_SAMPLE_FORMAT_SQCP:
- return "13K Voice";
- case AP4_SAMPLE_FORMAT_SRTP:
- return "SRTP Hints";
- case AP4_SAMPLE_FORMAT_SSMV:
- return "SMV Voice";
- case AP4_SAMPLE_FORMAT_TEXT:
- return "Textual Metadata";
- case AP4_SAMPLE_FORMAT_TWOS:
- return "Uncompressed 16-bit Audio";
- case AP4_SAMPLE_FORMAT_TX3G:
- return "Timed Text";
- case AP4_SAMPLE_FORMAT_VC_1:
- return "SMPTE VC-1";
- case AP4_SAMPLE_FORMAT_XML_:
- return "XML Metadata";
- default:
- return NULL;
+ switch (format) {
+ case AP4_SAMPLE_FORMAT_MP4A: return "MPEG-4 Audio";
+ case AP4_SAMPLE_FORMAT_MP4V: return "MPEG-4 Video";
+ case AP4_SAMPLE_FORMAT_MP4S: return "MPEG-4 Systems";
+ case AP4_SAMPLE_FORMAT_ALAC: return "Apple Lossless Audio";
+ case AP4_SAMPLE_FORMAT_AVC1: return "H.264";
+ case AP4_SAMPLE_FORMAT_OVC1: return "VC-1";
+ case AP4_SAMPLE_FORMAT_OWMA: return "WMA";
+ case AP4_SAMPLE_FORMAT_AC_3: return "Dolby Digital (AC-3)";
+ case AP4_SAMPLE_FORMAT_EC_3: return "Dolby Digital Plus (Enhanced AC-3)";
+ case AP4_SAMPLE_FORMAT_AVCP: return "Advanced Video Coding Parameters";
+ case AP4_SAMPLE_FORMAT_DRAC: return "Dirac";
+ case AP4_SAMPLE_FORMAT_DRA1: return "DRA Audio";
+ case AP4_SAMPLE_FORMAT_G726: return "G726";
+ case AP4_SAMPLE_FORMAT_MJP2: return "Motion JPEG 2000";
+ case AP4_SAMPLE_FORMAT_OKSD: return "OMA Keys";
+ case AP4_SAMPLE_FORMAT_RAW_: return "Uncompressed Audio";
+ case AP4_SAMPLE_FORMAT_RTP_: return "RTP Hints";
+ case AP4_SAMPLE_FORMAT_S263: return "H.263";
+ case AP4_SAMPLE_FORMAT_SAMR: return "Narrowband AMR";
+ case AP4_SAMPLE_FORMAT_SAWB: return "Wideband AMR";
+ case AP4_SAMPLE_FORMAT_SAWP: return "Extended AMR";
+ case AP4_SAMPLE_FORMAT_SEVC: return "EVRC Voice";
+ case AP4_SAMPLE_FORMAT_SQCP: return "13K Voice";
+ case AP4_SAMPLE_FORMAT_SRTP: return "SRTP Hints";
+ case AP4_SAMPLE_FORMAT_SSMV: return "SMV Voice";
+ case AP4_SAMPLE_FORMAT_TEXT: return "Textual Metadata";
+ case AP4_SAMPLE_FORMAT_TWOS: return "Uncompressed 16-bit Audio";
+ case AP4_SAMPLE_FORMAT_TX3G: return "Timed Text";
+ case AP4_SAMPLE_FORMAT_VC_1: return "SMPTE VC-1";
+ case AP4_SAMPLE_FORMAT_XML_: return "XML Metadata";
+ default: return NULL;
}
}
@@ -127,21 +95,18 @@ AP4_GetFormatName(AP4_UI32 format)
| AP4_SampleDescription::AP4_SampleDescription
+---------------------------------------------------------------------*/
AP4_SampleDescription::AP4_SampleDescription(Type type,
- AP4_UI32 format,
- AP4_AtomParent* details) :
+ AP4_UI32 format,
+ AP4_AtomParent* details) :
m_Type(type), m_Format(format)
{
- if(details)
- {
- for(AP4_List<AP4_Atom>::Item* item = details->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
+ if (details) {
+ for (AP4_List<AP4_Atom>::Item* item = details->GetChildren().FirstItem();
+ item;
+ item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
- if(atom)
- {
+ if (atom) {
AP4_Atom* clone = atom->Clone();
- if(clone) m_Details.AddChild(clone);
+ if (clone) m_Details.AddChild(clone);
}
}
}
@@ -153,27 +118,24 @@ AP4_SampleDescription::AP4_SampleDescription(Type type,
AP4_SampleDescription*
AP4_SampleDescription::Clone(AP4_Result* result)
{
- if(result) *result = AP4_SUCCESS;
+ if (result) *result = AP4_SUCCESS;
AP4_Atom* atom = ToAtom();
- if(atom == NULL)
- {
- if(result) *result = AP4_FAILURE;
+ if (atom == NULL) {
+ if (result) *result = AP4_FAILURE;
return NULL;
}
AP4_SampleEntry* sample_entry = AP4_DYNAMIC_CAST(AP4_SampleEntry, atom);
- if(sample_entry == NULL)
- {
- if(result) *result = AP4_ERROR_INTERNAL;
+ if (sample_entry == NULL) {
+ if (result) *result = AP4_ERROR_INTERNAL;
delete atom;
return NULL;
}
-
+
AP4_SampleDescription* clone = sample_entry->ToSampleDescription();
- if(clone == NULL)
- {
- if(result) *result = AP4_ERROR_INTERNAL;
+ if (clone == NULL) {
+ if (result) *result = AP4_ERROR_INTERNAL;
}
-
+
delete atom;
return clone;
}
@@ -191,8 +153,8 @@ AP4_SampleDescription::ToAtom() const
| AP4_UnknownSampleDescription::AP4_UnknownSampleDescription
+---------------------------------------------------------------------*/
AP4_UnknownSampleDescription::AP4_UnknownSampleDescription(AP4_Atom* atom) :
- AP4_SampleDescription(AP4_SampleDescription::TYPE_UNKNOWN,
- atom->GetType(),
+ AP4_SampleDescription(AP4_SampleDescription::TYPE_UNKNOWN,
+ atom->GetType(),
NULL),
m_Atom(atom->Clone())
{
@@ -213,53 +175,48 @@ AP4_SampleDescription*
AP4_UnknownSampleDescription::Clone(AP4_Result* result)
{
AP4_Atom* atom_clone = NULL;
- if(m_Atom)
- {
+ if (m_Atom) {
atom_clone = m_Atom->Clone();
- if(atom_clone == NULL)
- {
- if(result) *result = AP4_FAILURE;
+ if (atom_clone == NULL) {
+ if (result) *result = AP4_FAILURE;
return NULL;
}
}
- if(result) *result = AP4_SUCCESS;
+ if (result) *result = AP4_SUCCESS;
return new AP4_UnknownSampleDescription(atom_clone);
}
/*----------------------------------------------------------------------
| AP4_UnknownSampleDescription::ToAtom
+---------------------------------------------------------------------*/
-AP4_Atom*
+AP4_Atom*
AP4_UnknownSampleDescription::ToAtom() const
{
- if(m_Atom)
- {
+ if (m_Atom) {
return m_Atom->Clone();
- }
- else
- {
+ } else {
return NULL;
}
}
-
+
/*----------------------------------------------------------------------
| AP4_AvcSampleDescription::AP4_AvcSampleDescription
+---------------------------------------------------------------------*/
AP4_AvcSampleDescription::AP4_AvcSampleDescription(AP4_UI16 width,
- AP4_UI16 height,
- AP4_UI16 depth,
- const char* compressor_name,
- AP4_UI08 profile,
- AP4_UI08 level,
- AP4_UI08 profile_compatibility,
- AP4_UI08 length_size,
- const AP4_Array<AP4_DataBuffer>& sequence_parameters,
- const AP4_Array<AP4_DataBuffer>& picture_parameters) :
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_UI08 profile,
+ AP4_UI08 level,
+ AP4_UI08 profile_compatibility,
+ AP4_UI08 length_size,
+ const AP4_Array<AP4_DataBuffer>& sequence_parameters,
+ const AP4_Array<AP4_DataBuffer>& picture_parameters) :
AP4_SampleDescription(TYPE_AVC, AP4_SAMPLE_FORMAT_AVC1, NULL),
AP4_VideoSampleDescription(width, height, depth, compressor_name)
{
- m_AvccAtom = new AP4_AvccAtom(profile,
- level,
+ m_AvccAtom = new AP4_AvccAtom(profile,
+ level,
profile_compatibility,
length_size,
sequence_parameters,
@@ -271,19 +228,16 @@ AP4_AvcSampleDescription::AP4_AvcSampleDescription(AP4_UI16 width,
| AP4_AvcSampleDescription::AP4_AvcSampleDescription
+---------------------------------------------------------------------*/
AP4_AvcSampleDescription::AP4_AvcSampleDescription(AP4_UI16 width,
- AP4_UI16 height,
- AP4_UI16 depth,
- const char* compressor_name,
- const AP4_AvccAtom* avcc) :
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_AvccAtom* avcc) :
AP4_SampleDescription(TYPE_AVC, AP4_SAMPLE_FORMAT_AVC1, NULL),
AP4_VideoSampleDescription(width, height, depth, compressor_name)
{
- if(avcc)
- {
+ if (avcc) {
m_AvccAtom = new AP4_AvccAtom(*avcc);
- }
- else
- {
+ } else {
// should never happen
m_AvccAtom = new AP4_AvccAtom();
}
@@ -294,21 +248,18 @@ AP4_AvcSampleDescription::AP4_AvcSampleDescription(AP4_UI16 width,
| AP4_AvcSampleDescription::AP4_AvcSampleDescription
+---------------------------------------------------------------------*/
AP4_AvcSampleDescription::AP4_AvcSampleDescription(AP4_UI16 width,
- AP4_UI16 height,
- AP4_UI16 depth,
- const char* compressor_name,
- AP4_AtomParent* details) :
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_AtomParent* details) :
AP4_SampleDescription(TYPE_AVC, AP4_SAMPLE_FORMAT_AVC1, details),
AP4_VideoSampleDescription(width, height, depth, compressor_name),
m_AvccAtom(NULL)
{
AP4_AvccAtom* avcc = AP4_DYNAMIC_CAST(AP4_AvccAtom, details->GetChild(AP4_ATOM_TYPE_AVCC));
- if(avcc)
- {
+ if (avcc) {
m_AvccAtom = new AP4_AvccAtom(*avcc);
- }
- else
- {
+ } else {
// shoud never happen
m_AvccAtom = new AP4_AvccAtom();
}
@@ -321,10 +272,10 @@ AP4_AvcSampleDescription::AP4_AvcSampleDescription(AP4_UI16 width,
AP4_Atom*
AP4_AvcSampleDescription::ToAtom() const
{
- return new AP4_Avc1SampleEntry(m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
+ return new AP4_Avc1SampleEntry(m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
*m_AvccAtom);
}
@@ -332,7 +283,7 @@ AP4_AvcSampleDescription::ToAtom() const
| AP4_MpegSampleDescription::AP4_MpegSampleDescription
+---------------------------------------------------------------------*/
AP4_MpegSampleDescription::AP4_MpegSampleDescription(AP4_UI32 format,
- AP4_EsdsAtom* esds) :
+ AP4_EsdsAtom* esds) :
AP4_SampleDescription(TYPE_MPEG, format, NULL),
m_StreamType(0),
m_ObjectTypeId(0),
@@ -340,17 +291,15 @@ AP4_MpegSampleDescription::AP4_MpegSampleDescription(AP4_UI32 format,
m_MaxBitrate(0),
m_AvgBitrate(0)
{
- if(esds)
- {
+ if (esds) {
// get the es descriptor
const AP4_EsDescriptor* es_desc = esds->GetEsDescriptor();
- if(es_desc == NULL) return;
+ if (es_desc == NULL) return;
// get the decoder config descriptor
const AP4_DecoderConfigDescriptor* dc_desc =
es_desc->GetDecoderConfigDescriptor();
- if(dc_desc)
- {
+ if (dc_desc) {
m_StreamType = dc_desc->GetStreamType();
m_ObjectTypeId = dc_desc->GetObjectTypeIndication();
m_BufferSize = dc_desc->GetBufferSize();
@@ -358,8 +307,7 @@ AP4_MpegSampleDescription::AP4_MpegSampleDescription(AP4_UI32 format,
m_AvgBitrate = dc_desc->GetAvgBitrate();
const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
dc_desc->GetDecoderSpecificInfoDescriptor();
- if(dsi_desc != NULL)
- {
+ if (dsi_desc != NULL) {
m_DecoderInfo.SetData(dsi_desc->GetDecoderSpecificInfo().GetData(),
dsi_desc->GetDecoderSpecificInfo().GetDataSize());
}
@@ -385,8 +333,7 @@ AP4_MpegSampleDescription::AP4_MpegSampleDescription(
m_MaxBitrate(max_bitrate),
m_AvgBitrate(avg_bitrate)
{
- if(decoder_info != NULL)
- {
+ if (decoder_info != NULL) {
m_DecoderInfo.SetData(decoder_info->GetData(), decoder_info->GetDataSize());
}
}
@@ -394,31 +341,28 @@ AP4_MpegSampleDescription::AP4_MpegSampleDescription(
/*----------------------------------------------------------------------
| AP4_MpegSampleDescription::CreateEsDescriptor
+---------------------------------------------------------------------*/
-AP4_EsDescriptor*
+AP4_EsDescriptor*
AP4_MpegSampleDescription::CreateEsDescriptor() const
{
AP4_EsDescriptor* desc = new AP4_EsDescriptor(0);
AP4_DecoderSpecificInfoDescriptor* dsi_desc;
- if(m_DecoderInfo.GetDataSize() != 0)
- {
+ if (m_DecoderInfo.GetDataSize() != 0) {
dsi_desc = new AP4_DecoderSpecificInfoDescriptor(m_DecoderInfo);
- }
- else
- {
+ } else {
dsi_desc = NULL;
}
- AP4_DecoderConfigDescriptor* decoder_config =
+ AP4_DecoderConfigDescriptor* decoder_config =
new AP4_DecoderConfigDescriptor(m_StreamType,
- m_ObjectTypeId,
- m_BufferSize,
- m_MaxBitrate,
- m_AvgBitrate,
- dsi_desc);
+ m_ObjectTypeId,
+ m_BufferSize,
+ m_MaxBitrate,
+ m_AvgBitrate,
+ dsi_desc);
desc->AddSubDescriptor(decoder_config);
-
+
// add a fixed SL Config
desc->AddSubDescriptor(new AP4_SLConfigDescriptor());
-
+
return desc;
}
@@ -486,8 +430,8 @@ AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription(
AP4_UI32 avg_bitrate) :
AP4_MpegSampleDescription(AP4_ATOM_TYPE_MP4A,
AP4_STREAM_TYPE_AUDIO,
- oti,
- decoder_info, buffer_size,
+ oti,
+ decoder_info, buffer_size,
max_bitrate, avg_bitrate),
AP4_AudioSampleDescription(sample_rate, sample_size, channel_count)
{
@@ -499,7 +443,7 @@ AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription(
AP4_Atom*
AP4_MpegAudioSampleDescription::ToAtom() const
{
- return new AP4_Mp4aSampleEntry(m_SampleRate << 16,
+ return new AP4_Mp4aSampleEntry(m_SampleRate<<16,
m_SampleSize,
m_ChannelCount,
CreateEsDescriptor());
@@ -511,20 +455,16 @@ AP4_MpegAudioSampleDescription::ToAtom() const
AP4_MpegAudioSampleDescription::Mpeg4AudioObjectType
AP4_MpegAudioSampleDescription::GetMpeg4AudioObjectType() const
{
- if(m_ObjectTypeId == AP4_OTI_MPEG4_AUDIO &&
- m_DecoderInfo.GetDataSize() >= 1)
- {
- AP4_UI08 type = m_DecoderInfo.GetData()[0] >> 3;
- if(type == 31)
- {
- if(m_DecoderInfo.GetDataSize() < 2) return 0;
- type = 32 + (((m_DecoderInfo.GetData()[0] & 0x07) << 3) |
- ((m_DecoderInfo.GetData()[1] & 0xE0) >> 5));
+ if (m_ObjectTypeId == AP4_OTI_MPEG4_AUDIO &&
+ m_DecoderInfo.GetDataSize() >= 1) {
+ AP4_UI08 type = m_DecoderInfo.GetData()[0]>>3;
+ if (type == 31) {
+ if (m_DecoderInfo.GetDataSize() < 2) return 0;
+ type = 32+(((m_DecoderInfo.GetData()[0]&0x07)<<3) |
+ ((m_DecoderInfo.GetData()[1]&0xE0)>>5));
}
return type;
- }
- else
- {
+ } else {
return 0;
}
}
@@ -538,7 +478,7 @@ AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription(
AP4_UI16 depth,
const char* compressor_name,
AP4_EsdsAtom* esds) :
-
+
AP4_MpegSampleDescription(AP4_ATOM_TYPE_MP4V, esds),
AP4_VideoSampleDescription(width, height, depth, compressor_name)
{
@@ -557,7 +497,7 @@ AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription(
AP4_UI32 buffer_size,
AP4_UI32 max_bitrate,
AP4_UI32 avg_bitrate) :
- AP4_MpegSampleDescription(AP4_ATOM_TYPE_MP4V,
+ AP4_MpegSampleDescription(AP4_ATOM_TYPE_MP4V,
AP4_STREAM_TYPE_VISUAL,
oti,
decoder_info,
@@ -584,164 +524,95 @@ AP4_MpegVideoSampleDescription::ToAtom() const
/*----------------------------------------------------------------------
| AP4_MpegSampleDescription::GetStreamTypeString
+---------------------------------------------------------------------*/
-const char*
+const char*
AP4_MpegSampleDescription::GetStreamTypeString(StreamType type)
{
- switch(type)
- {
- case AP4_STREAM_TYPE_FORBIDDEN:
- return "INVALID";
- case AP4_STREAM_TYPE_OD:
- return "Object Descriptor";
- case AP4_STREAM_TYPE_CR:
- return "CR";
- case AP4_STREAM_TYPE_BIFS:
- return "BIFS";
- case AP4_STREAM_TYPE_VISUAL:
- return "Visual";
- case AP4_STREAM_TYPE_AUDIO:
- return "Audio";
- case AP4_STREAM_TYPE_MPEG7:
- return "MPEG-7";
- case AP4_STREAM_TYPE_IPMP:
- return "IPMP";
- case AP4_STREAM_TYPE_OCI:
- return "OCI";
- case AP4_STREAM_TYPE_MPEGJ:
- return "MPEG-J";
- default:
- return "UNKNOWN";
+ switch (type) {
+ case AP4_STREAM_TYPE_FORBIDDEN: return "INVALID";
+ case AP4_STREAM_TYPE_OD: return "Object Descriptor";
+ case AP4_STREAM_TYPE_CR: return "CR";
+ case AP4_STREAM_TYPE_BIFS: return "BIFS";
+ case AP4_STREAM_TYPE_VISUAL: return "Visual";
+ case AP4_STREAM_TYPE_AUDIO: return "Audio";
+ case AP4_STREAM_TYPE_MPEG7: return "MPEG-7";
+ case AP4_STREAM_TYPE_IPMP: return "IPMP";
+ case AP4_STREAM_TYPE_OCI: return "OCI";
+ case AP4_STREAM_TYPE_MPEGJ: return "MPEG-J";
+ default: return "UNKNOWN";
}
}
/*----------------------------------------------------------------------
| AP4_MpegSampleDescription::GetObjectTypeString
+---------------------------------------------------------------------*/
-const char*
+const char*
AP4_MpegSampleDescription::GetObjectTypeString(OTI oti)
{
- switch(oti)
- {
- case AP4_OTI_MPEG4_SYSTEM:
- return "MPEG-4 System";
- case AP4_OTI_MPEG4_SYSTEM_COR:
- return "MPEG-4 System COR";
- case AP4_OTI_MPEG4_VISUAL:
- return "MPEG-4 Video";
- case AP4_OTI_MPEG4_AUDIO:
- return "MPEG-4 Audio";
- case AP4_OTI_MPEG2_VISUAL_SIMPLE:
- return "MPEG-2 Video Simple Profile";
- case AP4_OTI_MPEG2_VISUAL_MAIN:
- return "MPEG-2 Video Main Profile";
- case AP4_OTI_MPEG2_VISUAL_SNR:
- return "MPEG-2 Video SNR";
- case AP4_OTI_MPEG2_VISUAL_SPATIAL:
- return "MPEG-2 Video Spatial";
- case AP4_OTI_MPEG2_VISUAL_HIGH:
- return "MPEG-2 Video High";
- case AP4_OTI_MPEG2_VISUAL_422:
- return "MPEG-2 Video 4:2:2";
- case AP4_OTI_MPEG2_AAC_AUDIO_MAIN:
- return "MPEG-2 Audio AAC Main Profile";
- case AP4_OTI_MPEG2_AAC_AUDIO_LC:
- return "MPEG-2 Audio AAC Low Complexity";
- case AP4_OTI_MPEG2_AAC_AUDIO_SSRP:
- return "MPEG-2 Audio AAC SSRP";
- case AP4_OTI_MPEG2_PART3_AUDIO:
- return "MPEG-2 Audio Part-3";
- case AP4_OTI_MPEG1_VISUAL:
- return "MPEG-1 Video";
- case AP4_OTI_MPEG1_AUDIO:
- return "MPEG-1 Audio";
- case AP4_OTI_JPEG:
- return "JPEG";
- default:
- return "UNKNOWN";
+ switch (oti) {
+ case AP4_OTI_MPEG4_SYSTEM: return "MPEG-4 System";
+ case AP4_OTI_MPEG4_SYSTEM_COR: return "MPEG-4 System COR";
+ case AP4_OTI_MPEG4_VISUAL: return "MPEG-4 Video";
+ case AP4_OTI_MPEG4_AUDIO: return "MPEG-4 Audio";
+ case AP4_OTI_MPEG2_VISUAL_SIMPLE: return "MPEG-2 Video Simple Profile";
+ case AP4_OTI_MPEG2_VISUAL_MAIN: return "MPEG-2 Video Main Profile";
+ case AP4_OTI_MPEG2_VISUAL_SNR: return "MPEG-2 Video SNR";
+ case AP4_OTI_MPEG2_VISUAL_SPATIAL: return "MPEG-2 Video Spatial";
+ case AP4_OTI_MPEG2_VISUAL_HIGH: return "MPEG-2 Video High";
+ case AP4_OTI_MPEG2_VISUAL_422: return "MPEG-2 Video 4:2:2";
+ case AP4_OTI_MPEG2_AAC_AUDIO_MAIN: return "MPEG-2 Audio AAC Main Profile";
+ case AP4_OTI_MPEG2_AAC_AUDIO_LC: return "MPEG-2 Audio AAC Low Complexity";
+ case AP4_OTI_MPEG2_AAC_AUDIO_SSRP: return "MPEG-2 Audio AAC SSRP";
+ case AP4_OTI_MPEG2_PART3_AUDIO: return "MPEG-2 Audio Part-3";
+ case AP4_OTI_MPEG1_VISUAL: return "MPEG-1 Video";
+ case AP4_OTI_MPEG1_AUDIO: return "MPEG-1 Audio";
+ case AP4_OTI_JPEG: return "JPEG";
+ default: return "UNKNOWN";
}
}
/*----------------------------------------------------------------------
| AP4_MpegAudioSampleDescription::GetMpeg4AudioObjectTypeString
+---------------------------------------------------------------------*/
-const char*
+const char*
AP4_MpegAudioSampleDescription::GetMpeg4AudioObjectTypeString(Mpeg4AudioObjectType type)
{
- switch(type)
- {
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_MAIN:
- return "AAC Main Profile";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC:
- return "AAC Low Complexity";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SSR:
- return "AAC Scalable Sample Rate";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LTP:
- return "AAC Long Term Predictor";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR:
- return "Spectral Band Replication";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SCALABLE:
- return "AAC Scalable";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_TWINVQ:
- return "Twin VQ";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_CELP:
- return "CELP";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_HVXC:
- return "HVXC";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_TTSI:
- return "TTSI";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_MAIN_SYNTHETIC:
- return "Main Synthetic";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_WAVETABLE_SYNTHESIS:
- return "Wavetable Synthesis";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_GENERAL_MIDI:
- return "General MIDI";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ALGORITHMIC_SYNTHESIS:
- return "Algorithmic Synthesis";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LC:
- return "Error Resilient AAC Low Complexity";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LTP:
- return "Error Resilient AAC Long Term Prediction";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_SCALABLE:
- return "Error Resilient AAC Scalable";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_TWINVQ:
- return "Error Resilient Twin VQ";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_BSAC:
- return "Error Resilient Bit Sliced Arithmetic Coding";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LD:
- return "Error Resilient AAC Low Delay";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_CELP:
- return "Error Resilient CELP";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_HVXC:
- return "Error Resilient HVXC";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_HILN:
- return "Error Resilient HILN";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_PARAMETRIC:
- return "Error Resilient Parametric";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_SSC:
- return "SSC";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_MPEG_SURROUND:
- return "MPEG Surround";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_LAYER_1:
- return "MPEG Layer 1";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_LAYER_2:
- return "MPEG Layer 2";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_LAYER_3:
- return "MPEG Layer 3";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_DST:
- return "Direct Stream Transfer";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ALS:
- return "ALS Lossless Coding";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_SLS:
- return "SLS Scalable Lossless Coding";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_SLS_NON_CORE:
- return "SLS Scalable Lossless Coding (Non Core)";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_ELD:
- return "Error Resilient AAC ELD";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_SMR_SIMPLE:
- return "SMR Simple";
- case AP4_MPEG4_AUDIO_OBJECT_TYPE_SMR_MAIN:
- return "SMR Main";
- default:
- return "UNKNOWN";
+ switch (type) {
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_MAIN: return "AAC Main Profile";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC: return "AAC Low Complexity";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SSR: return "AAC Scalable Sample Rate";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LTP: return "AAC Long Term Predictor";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR: return "Spectral Band Replication";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_SCALABLE: return "AAC Scalable";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_TWINVQ: return "Twin VQ";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_CELP: return "CELP";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_HVXC: return "HVXC";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_TTSI: return "TTSI";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_MAIN_SYNTHETIC: return "Main Synthetic";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_WAVETABLE_SYNTHESIS: return "Wavetable Synthesis";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_GENERAL_MIDI: return "General MIDI";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ALGORITHMIC_SYNTHESIS: return "Algorithmic Synthesis";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LC: return "Error Resilient AAC Low Complexity";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LTP: return "Error Resilient AAC Long Term Prediction";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_SCALABLE: return "Error Resilient AAC Scalable";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_TWINVQ: return "Error Resilient Twin VQ";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_BSAC: return "Error Resilient Bit Sliced Arithmetic Coding";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_LD: return "Error Resilient AAC Low Delay";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_CELP: return "Error Resilient CELP";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_HVXC: return "Error Resilient HVXC";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_HILN: return "Error Resilient HILN";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_PARAMETRIC: return "Error Resilient Parametric";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_SSC: return "SSC";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_MPEG_SURROUND: return "MPEG Surround";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_LAYER_1: return "MPEG Layer 1";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_LAYER_2: return "MPEG Layer 2";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_LAYER_3: return "MPEG Layer 3";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_DST: return "Direct Stream Transfer";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ALS: return "ALS Lossless Coding";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_SLS: return "SLS Scalable Lossless Coding";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_SLS_NON_CORE: return "SLS Scalable Lossless Coding (Non Core)";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_AAC_ELD: return "Error Resilient AAC ELD";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_SMR_SIMPLE: return "SMR Simple";
+ case AP4_MPEG4_AUDIO_OBJECT_TYPE_SMR_MAIN: return "SMR Main";
+ default: return "UNKNOWN";
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.h
index d38be6658..9e60cad7d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleDescription.h
@@ -88,12 +88,11 @@ AP4_GetFormatName(AP4_UI32 format);
+---------------------------------------------------------------------*/
class AP4_SampleDescription
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST(AP4_SampleDescription)
// type constants of the sample description
- enum Type
- {
+ enum Type {
TYPE_UNKNOWN = 0x00,
TYPE_MPEG = 0x01,
TYPE_PROTECTED = 0x02,
@@ -101,30 +100,21 @@ public:
};
// constructors & destructor
- AP4_SampleDescription(Type type,
- AP4_UI32 format,
+ AP4_SampleDescription(Type type,
+ AP4_UI32 format,
AP4_AtomParent* details);
virtual ~AP4_SampleDescription() {}
virtual AP4_SampleDescription* Clone(AP4_Result* result = NULL);
-
+
// accessors
- Type GetType() const
- {
- return m_Type;
- }
- AP4_UI32 GetFormat() const
- {
- return m_Format;
- }
- AP4_AtomParent& GetDetails()
- {
- return m_Details;
- }
-
+ Type GetType() const { return m_Type; }
+ AP4_UI32 GetFormat() const { return m_Format; }
+ AP4_AtomParent& GetDetails() { return m_Details; }
+
// factories
virtual AP4_Atom* ToAtom() const;
-protected:
+ protected:
Type m_Type;
AP4_UI32 m_Format;
AP4_AtomParent m_Details;
@@ -143,14 +133,11 @@ public:
~AP4_UnknownSampleDescription();
virtual AP4_SampleDescription* Clone(AP4_Result* result);
- virtual AP4_Atom* ToAtom() const;
-
+ virtual AP4_Atom* ToAtom() const;
+
// accessor
- const AP4_Atom* GetAtom()
- {
- return m_Atom;
- }
-
+ const AP4_Atom* GetAtom() { return m_Atom; }
+
private:
AP4_Atom* m_Atom;
};
@@ -167,23 +154,14 @@ public:
AP4_AudioSampleDescription(unsigned int sample_rate,
unsigned int sample_size,
unsigned int channel_count) :
- m_SampleRate(sample_rate),
- m_SampleSize(sample_size),
- m_ChannelCount(channel_count) {}
+ m_SampleRate(sample_rate),
+ m_SampleSize(sample_size),
+ m_ChannelCount(channel_count) {}
// accessors
- AP4_UI32 GetSampleRate()
- {
- return m_SampleRate;
- }
- AP4_UI16 GetSampleSize()
- {
- return m_SampleSize;
- }
- AP4_UI16 GetChannelCount()
- {
- return m_ChannelCount;
- }
+ AP4_UI32 GetSampleRate() { return m_SampleRate; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
protected:
// members
@@ -205,28 +183,16 @@ public:
AP4_UI16 height,
AP4_UI16 depth,
const char* compressor_name) :
- m_Width(width),
- m_Height(height),
- m_Depth(depth),
- m_CompressorName(compressor_name) {}
+ m_Width(width),
+ m_Height(height),
+ m_Depth(depth),
+ m_CompressorName(compressor_name) {}
// accessors
- AP4_UI16 GetWidth()
- {
- return m_Width;
- }
- AP4_UI16 GetHeight()
- {
- return m_Height;
- }
- AP4_UI16 GetDepth()
- {
- return m_Depth;
- }
- const char* GetCompressorName()
- {
- return m_CompressorName.GetChars();
- }
+ AP4_UI16 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.GetChars(); }
protected:
// members
@@ -240,7 +206,7 @@ protected:
| AP4_GenericAudioSampleDescription
+---------------------------------------------------------------------*/
class AP4_GenericAudioSampleDescription : public AP4_SampleDescription,
- public AP4_AudioSampleDescription
+ public AP4_AudioSampleDescription
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_GenericAudioSampleDescription, AP4_SampleDescription, AP4_AudioSampleDescription)
@@ -259,7 +225,7 @@ public:
| AP4_GenericVideoSampleDescription
+---------------------------------------------------------------------*/
class AP4_GenericVideoSampleDescription : public AP4_SampleDescription,
- public AP4_VideoSampleDescription
+ public AP4_VideoSampleDescription
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_GenericVideoSampleDescription, AP4_SampleDescription, AP4_VideoSampleDescription)
@@ -271,15 +237,15 @@ public:
AP4_UI16 depth,
const char* compressor_name,
AP4_AtomParent* details) :
- AP4_SampleDescription(TYPE_UNKNOWN, format, details),
- AP4_VideoSampleDescription(width, height, depth, compressor_name) {}
+ AP4_SampleDescription(TYPE_UNKNOWN, format, details),
+ AP4_VideoSampleDescription(width, height, depth, compressor_name) {}
};
/*----------------------------------------------------------------------
| AP4_AvcSampleDescription
+---------------------------------------------------------------------*/
class AP4_AvcSampleDescription : public AP4_SampleDescription,
- public AP4_VideoSampleDescription
+ public AP4_VideoSampleDescription
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_AvcSampleDescription, AP4_SampleDescription, AP4_VideoSampleDescription)
@@ -290,7 +256,7 @@ public:
AP4_UI16 depth,
const char* compressor_name,
const AP4_AvccAtom* avcc);
-
+
AP4_AvcSampleDescription(AP4_UI16 width,
AP4_UI16 height,
AP4_UI16 depth,
@@ -307,47 +273,22 @@ public:
AP4_UI08 nalu_length_size,
const AP4_Array<AP4_DataBuffer>& sequence_parameters,
const AP4_Array<AP4_DataBuffer>& picture_parameters);
-
+
// accessors
- AP4_UI08 GetConfigurationVersion() const
- {
- return m_AvccAtom->GetConfigurationVersion();
- }
- AP4_UI08 GetProfile() const
- {
- return m_AvccAtom->GetProfile();
- }
- AP4_UI08 GetLevel() const
- {
- return m_AvccAtom->GetLevel();
- }
- AP4_UI08 GetProfileCompatibility() const
- {
- return m_AvccAtom->GetProfileCompatibility();
- }
- AP4_UI08 GetNaluLengthSize() const
- {
- return m_AvccAtom->GetNaluLengthSize();
- }
- AP4_Array<AP4_DataBuffer>& GetSequenceParameters()
- {
- return m_AvccAtom->GetSequenceParameters();
- }
- AP4_Array<AP4_DataBuffer>& GetPictureParameters()
- {
- return m_AvccAtom->GetPictureParameters();
- }
- const AP4_DataBuffer& GetRawBytes() const
- {
- return m_AvccAtom->GetRawBytes();
- }
-
+ AP4_UI08 GetConfigurationVersion() const { return m_AvccAtom->GetConfigurationVersion(); }
+ AP4_UI08 GetProfile() const { return m_AvccAtom->GetProfile(); }
+ AP4_UI08 GetLevel() const { return m_AvccAtom->GetLevel(); }
+ AP4_UI08 GetProfileCompatibility() const { return m_AvccAtom->GetProfileCompatibility(); }
+ AP4_UI08 GetNaluLengthSize() const { return m_AvccAtom->GetNaluLengthSize(); }
+ AP4_Array<AP4_DataBuffer>& GetSequenceParameters() {return m_AvccAtom->GetSequenceParameters(); }
+ AP4_Array<AP4_DataBuffer>& GetPictureParameters() { return m_AvccAtom->GetPictureParameters(); }
+ const AP4_DataBuffer& GetRawBytes() const { return m_AvccAtom->GetRawBytes(); }
+
// inherited from AP4_SampleDescription
virtual AP4_Atom* ToAtom() const;
-
+
// static methods
- static const char* GetProfileName(AP4_UI08 profile)
- {
+ static const char* GetProfileName(AP4_UI08 profile) {
return AP4_AvccAtom::GetProfileName(profile);
}
@@ -360,13 +301,13 @@ private:
+---------------------------------------------------------------------*/
class AP4_MpegSampleDescription : public AP4_SampleDescription
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_MpegSampleDescription, AP4_SampleDescription)
// types
typedef AP4_UI08 StreamType;
typedef AP4_UI08 OTI;
-
+
// class methods
static const char* GetStreamTypeString(StreamType type);
static const char* GetObjectTypeString(OTI oti);
@@ -381,37 +322,19 @@ public:
AP4_UI32 buffer_size,
AP4_UI32 max_bitrate,
AP4_UI32 avg_bitrate);
-
+
// accessors
- AP4_Byte GetStreamType() const
- {
- return m_StreamType;
- }
- AP4_Byte GetObjectTypeId() const
- {
- return m_ObjectTypeId;
- }
- AP4_UI32 GetBufferSize() const
- {
- return m_BufferSize;
- }
- AP4_UI32 GetMaxBitrate() const
- {
- return m_MaxBitrate;
- }
- AP4_UI32 GetAvgBitrate() const
- {
- return m_AvgBitrate;
- }
- const AP4_DataBuffer& GetDecoderInfo() const
- {
- return m_DecoderInfo;
- }
+ AP4_Byte GetStreamType() const { return m_StreamType; }
+ AP4_Byte GetObjectTypeId() const { return m_ObjectTypeId; }
+ AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ AP4_UI32 GetAvgBitrate() const { return m_AvgBitrate; }
+ const AP4_DataBuffer& GetDecoderInfo() const { return m_DecoderInfo; }
// methods
AP4_EsDescriptor* CreateEsDescriptor() const;
-protected:
+ protected:
// members
AP4_UI32 m_Format;
StreamType m_StreamType;
@@ -447,23 +370,23 @@ public:
| AP4_MpegAudioSampleDescription
+---------------------------------------------------------------------*/
class AP4_MpegAudioSampleDescription : public AP4_MpegSampleDescription,
- public AP4_AudioSampleDescription
+ public AP4_AudioSampleDescription
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_MpegAudioSampleDescription, AP4_MpegSampleDescription, AP4_AudioSampleDescription)
// types
typedef AP4_UI08 Mpeg4AudioObjectType;
-
+
// class methods
static const char* GetMpeg4AudioObjectTypeString(Mpeg4AudioObjectType type);
-
+
// constructor
AP4_MpegAudioSampleDescription(unsigned int sample_rate,
unsigned int sample_size,
unsigned int channel_count,
AP4_EsdsAtom* esds);
-
+
AP4_MpegAudioSampleDescription(OTI oti,
unsigned int sample_rate,
unsigned int sample_size,
@@ -477,8 +400,8 @@ public:
AP4_Atom* ToAtom() const;
/**
- * For sample descriptions of MPEG-4 audio tracks (i.e GetObjectTypeId()
- * returns AP4_OTI_MPEG4_AUDIO), this method returns the MPEG4 Audio Object
+ * For sample descriptions of MPEG-4 audio tracks (i.e GetObjectTypeId()
+ * returns AP4_OTI_MPEG4_AUDIO), this method returns the MPEG4 Audio Object
* Type. For other sample descriptions, this method returns 0.
*/
Mpeg4AudioObjectType GetMpeg4AudioObjectType() const;
@@ -488,7 +411,7 @@ public:
| AP4_MpegVideoSampleDescription
+---------------------------------------------------------------------*/
class AP4_MpegVideoSampleDescription : public AP4_MpegSampleDescription,
- public AP4_VideoSampleDescription
+ public AP4_VideoSampleDescription
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_MpegVideoSampleDescription, AP4_MpegSampleDescription, AP4_VideoSampleDescription)
@@ -499,7 +422,7 @@ public:
AP4_UI16 depth,
const char* compressor_name,
AP4_EsdsAtom* esds);
-
+
AP4_MpegVideoSampleDescription(OTI oti,
AP4_UI16 width,
AP4_UI16 height,
@@ -519,7 +442,7 @@ public:
+---------------------------------------------------------------------*/
const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_FORBIDDEN = 0x00;
const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_OD = 0x01;
-const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_CR = 0x02;
+const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_CR = 0x02;
const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_BIFS = 0x03;
const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_VISUAL = 0x04;
const AP4_MpegSampleDescription::StreamType AP4_STREAM_TYPE_AUDIO = 0x05;
@@ -587,8 +510,8 @@ const AP4_UI08 AP4_MPEG4_AUDIO_OBJECT_TYPE_SMR_SIMPLE = 40; /**< SMR
const AP4_UI08 AP4_MPEG4_AUDIO_OBJECT_TYPE_SMR_MAIN = 41; /**< SMR Main */
// ==> Start patch MPC
-const AP4_MpegSampleDescription::OTI AP4_NERO_VOBSUB = 0xE0;
-// <== End patch MPC
+const AP4_MpegSampleDescription::OTI AP4_NERO_VOBSUB = 0xE0;
+// <== End patch MPC
#endif // _AP4_SAMPLE_DESCRIPTION_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.cpp
index ee975ab08..086401b01 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.cpp
@@ -93,11 +93,10 @@ AP4_SampleEntry::Read(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory)
// read children atoms (ex: esds and maybe others)
// NOTE: not all sample entries have children atoms
- AP4_Size payload_size = (AP4_Size)(GetSize() - GetHeaderSize());
+ AP4_Size payload_size = (AP4_Size)(GetSize()-GetHeaderSize());
AP4_Size fields_size = GetFieldsSize();
- if(payload_size > fields_size)
- {
- ReadChildren(atom_factory, stream, payload_size - fields_size);
+ if (payload_size > fields_size) {
+ ReadChildren(atom_factory, stream, payload_size-fields_size);
}
}
@@ -129,15 +128,15 @@ AP4_Result
AP4_SampleEntry::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
// reserved1
result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// data reference index
result = stream.WriteUI16(m_DataReferenceIndex);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
return result;
}
@@ -151,11 +150,11 @@ AP4_SampleEntry::Write(AP4_ByteStream& stream)
// write the header
result = WriteHeader(stream);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the fields
result = WriteFields(stream);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the children atoms
return m_Children.Apply(AP4_AtomListWriter(stream));
@@ -200,12 +199,12 @@ void
AP4_SampleEntry::OnChildChanged(AP4_Atom*)
{
// recompute our size
- AP4_UI64 size = GetHeaderSize() + GetFieldsSize();
+ AP4_UI64 size = GetHeaderSize()+GetFieldsSize();
m_Children.Apply(AP4_AtomSizeAdder(size));
m_Size32 = (AP4_UI32)size;
// update our parent
- if(m_Parent) m_Parent->OnChildChanged(this);
+ if (m_Parent) m_Parent->OnChildChanged(this);
}
/*----------------------------------------------------------------------
@@ -220,14 +219,13 @@ AP4_SampleEntry::ToSampleDescription()
/*----------------------------------------------------------------------
| AP4_UnknownSampleEntry::AP4_UnknownSampleEntry
+---------------------------------------------------------------------*/
-AP4_UnknownSampleEntry::AP4_UnknownSampleEntry(AP4_Atom::Type type,
- AP4_Size size,
- AP4_ByteStream& stream) :
+AP4_UnknownSampleEntry::AP4_UnknownSampleEntry(AP4_Atom::Type type,
+ AP4_Size size,
+ AP4_ByteStream& stream) :
AP4_SampleEntry(type, size)
{
- if(size > AP4_ATOM_HEADER_SIZE + AP4_SampleEntry::GetFieldsSize())
- {
- m_Payload.SetDataSize(size - (AP4_ATOM_HEADER_SIZE + AP4_SampleEntry::GetFieldsSize()));
+ if (size > AP4_ATOM_HEADER_SIZE+AP4_SampleEntry::GetFieldsSize()) {
+ m_Payload.SetDataSize(size-(AP4_ATOM_HEADER_SIZE+AP4_SampleEntry::GetFieldsSize()));
ReadFields(stream);
}
}
@@ -235,7 +233,7 @@ AP4_UnknownSampleEntry::AP4_UnknownSampleEntry(AP4_Atom::Type type,
/*----------------------------------------------------------------------
| AP4_UnknownSampleEntry::ToSampleDescription
+---------------------------------------------------------------------*/
-AP4_SampleDescription*
+AP4_SampleDescription*
AP4_UnknownSampleEntry::ToSampleDescription()
{
return new AP4_UnknownSampleDescription(this);
@@ -244,10 +242,10 @@ AP4_UnknownSampleEntry::ToSampleDescription()
/*----------------------------------------------------------------------
| AP4_UnknownSampleEntry::GetFieldsSize
+---------------------------------------------------------------------*/
-AP4_Size
+AP4_Size
AP4_UnknownSampleEntry::GetFieldsSize()
{
- return AP4_SampleEntry::GetFieldsSize() + m_Payload.GetDataSize();
+ return AP4_SampleEntry::GetFieldsSize()+m_Payload.GetDataSize();
}
/*----------------------------------------------------------------------
@@ -258,8 +256,8 @@ AP4_UnknownSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// read the payload
return stream.Read(m_Payload.UseData(), m_Payload.GetDataSize());
}
@@ -271,11 +269,11 @@ AP4_Result
AP4_UnknownSampleEntry::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
// write the fields of the base class
result = AP4_SampleEntry::WriteFields(stream);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// write the payload
return stream.Write(m_Payload.GetData(), m_Payload.GetDataSize());
}
@@ -288,7 +286,7 @@ AP4_MpegSystemSampleEntry::AP4_MpegSystemSampleEntry(
AP4_EsDescriptor* descriptor) :
AP4_SampleEntry(type)
{
- if(descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+ if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
}
/*----------------------------------------------------------------------
@@ -310,7 +308,7 @@ AP4_SampleDescription*
AP4_MpegSystemSampleEntry::ToSampleDescription()
{
return new AP4_MpegSystemSampleDescription(
- AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
+ AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
}
/*----------------------------------------------------------------------
@@ -325,8 +323,8 @@ AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor) :
| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
+---------------------------------------------------------------------*/
AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_MpegSystemSampleEntry(AP4_ATOM_TYPE_MP4S, size, stream, atom_factory)
{
}
@@ -339,16 +337,16 @@ AP4_Mp4sSampleEntry::ToSampleDescription()
{
// create a sample description
return new AP4_MpegSystemSampleDescription(
- AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
+ AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
}
/*----------------------------------------------------------------------
| AP4_AudioSampleEntry::AP4_AudioSampleEntry
+---------------------------------------------------------------------*/
AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
- AP4_UI32 sample_rate,
- AP4_UI16 sample_size,
- AP4_UI16 channel_count) :
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count) :
AP4_SampleEntry(format),
m_QtVersion(0),
m_QtRevision(0),
@@ -369,7 +367,7 @@ AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
m_QtV2BitsPerChannel(0),
m_QtV2FormatSpecificFlags(0),
m_QtV2BytesPerAudioPacket(0),
- m_QtV2LPCMFramesPerAudioPacket(0)
+ m_QtV2LPCMFramesPerAudioPacket(0)
{
m_Size32 += 20;
}
@@ -378,30 +376,27 @@ AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
| AP4_AudioSampleEntry::AP4_AudioSampleEntry
+---------------------------------------------------------------------*/
AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
- AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_SampleEntry(format, size)
{
Read(stream, atom_factory);
}
-
+
/*----------------------------------------------------------------------
| AP4_AudioSampleEntry::GetFieldsSize
+---------------------------------------------------------------------*/
AP4_Size
AP4_AudioSampleEntry::GetFieldsSize()
{
- AP4_Size size = AP4_SampleEntry::GetFieldsSize() + 20;
- if(m_QtVersion == 1)
- {
+ AP4_Size size = AP4_SampleEntry::GetFieldsSize()+20;
+ if (m_QtVersion == 1) {
size += 16;
+ } else if (m_QtVersion == 2) {
+ size += 36+m_QtV2Extension.GetDataSize();
}
- else if(m_QtVersion == 2)
- {
- size += 36 + m_QtV2Extension.GetDataSize();
- }
-
+
return size;
}
@@ -411,13 +406,10 @@ AP4_AudioSampleEntry::GetFieldsSize()
AP4_UI32
AP4_AudioSampleEntry::GetSampleRate()
{
- if(m_QtVersion == 2)
- {
+ if (m_QtVersion == 2) {
return (AP4_UI32)(m_QtV2SampleRate64);
- }
- else
- {
- return m_SampleRate >> 16;
+ } else {
+ return m_SampleRate>>16;
}
}
@@ -427,12 +419,9 @@ AP4_AudioSampleEntry::GetSampleRate()
AP4_UI16
AP4_AudioSampleEntry::GetChannelCount()
{
- if(m_QtVersion == 2)
- {
+ if (m_QtVersion == 2) {
return m_QtV2ChannelCount;
- }
- else
- {
+ } else {
return m_ChannelCount;
}
}
@@ -445,7 +434,7 @@ AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
- if(result < 0) return result;
+ if (result < 0) return result;
// read the fields of this class
stream.ReadUI16(m_QtVersion);
@@ -458,15 +447,12 @@ AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
stream.ReadUI32(m_SampleRate);
// if this is a QT V1 entry, read the extension
- if(m_QtVersion == 1)
- {
+ if (m_QtVersion == 1) {
stream.ReadUI32(m_QtV1SamplesPerPacket);
stream.ReadUI32(m_QtV1BytesPerPacket);
stream.ReadUI32(m_QtV1BytesPerFrame);
stream.ReadUI32(m_QtV1BytesPerSample);
- }
- else if(m_QtVersion == 2)
- {
+ } else if (m_QtVersion == 2) {
stream.ReadUI32(m_QtV2StructSize);
stream.ReadDouble(m_QtV2SampleRate64);
stream.ReadUI32(m_QtV2ChannelCount);
@@ -475,19 +461,16 @@ AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
stream.ReadUI32(m_QtV2FormatSpecificFlags);
stream.ReadUI32(m_QtV2BytesPerAudioPacket);
stream.ReadUI32(m_QtV2LPCMFramesPerAudioPacket);
- if(m_QtV2StructSize > 72)
- {
- unsigned int ext_size = m_QtV2StructSize - 72;
+ if (m_QtV2StructSize > 72) {
+ unsigned int ext_size = m_QtV2StructSize-72;
m_QtV2Extension.SetDataSize(ext_size);
stream.Read(m_QtV2Extension.UseData(), ext_size);
}
m_QtV1SamplesPerPacket =
- m_QtV1BytesPerPacket =
- m_QtV1BytesPerFrame =
- m_QtV1BytesPerSample = 0;
- }
- else
- {
+ m_QtV1BytesPerPacket =
+ m_QtV1BytesPerFrame =
+ m_QtV1BytesPerSample = 0;
+ } else {
m_QtV1SamplesPerPacket = 0;
m_QtV1BytesPerPacket = 0;
m_QtV1BytesPerFrame = 0;
@@ -501,7 +484,7 @@ AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
m_QtV2BytesPerAudioPacket = 0;
m_QtV2LPCMFramesPerAudioPacket = 0;
}
-
+
return AP4_SUCCESS;
}
@@ -512,55 +495,52 @@ AP4_Result
AP4_AudioSampleEntry::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
// write the fields of the base class
result = AP4_SampleEntry::WriteFields(stream);
// QT version
result = stream.WriteUI16(m_QtVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// QT revision
result = stream.WriteUI16(m_QtRevision);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// QT vendor
result = stream.WriteUI32(m_QtVendor);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// channel count
result = stream.WriteUI16(m_ChannelCount);
- if(AP4_FAILED(result)) return result;
-
- // sample size
+ if (AP4_FAILED(result)) return result;
+
+ // sample size
result = stream.WriteUI16(m_SampleSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// QT compression ID
result = stream.WriteUI16(m_QtCompressionId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// QT packet size
result = stream.WriteUI16(m_QtPacketSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// sample rate
result = stream.WriteUI32(m_SampleRate);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
- if(m_QtVersion == 1)
- {
+ if (m_QtVersion == 1) {
result = stream.WriteUI32(m_QtV1SamplesPerPacket);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_QtV1BytesPerPacket);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_QtV1BytesPerFrame);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_QtV1BytesPerSample);
- if(AP4_FAILED(result)) return result;
- }
- else if(m_QtVersion == 2)
- {
+ if (AP4_FAILED(result)) return result;
+ } else if (m_QtVersion == 2) {
stream.WriteUI32(m_QtV2StructSize);
stream.WriteDouble(m_QtV2SampleRate64);
stream.WriteUI32(m_QtV2ChannelCount);
@@ -569,13 +549,12 @@ AP4_AudioSampleEntry::WriteFields(AP4_ByteStream& stream)
stream.WriteUI32(m_QtV2FormatSpecificFlags);
stream.WriteUI32(m_QtV2BytesPerAudioPacket);
stream.WriteUI32(m_QtV2LPCMFramesPerAudioPacket);
- if(m_QtV2Extension.GetDataSize())
- {
+ if (m_QtV2Extension.GetDataSize()) {
stream.Write(m_QtV2Extension.GetData(),
m_QtV2Extension.GetDataSize());
}
}
-
+
return result;
}
@@ -592,11 +571,10 @@ AP4_AudioSampleEntry::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("channel_count", GetChannelCount());
inspector.AddField("sample_size", GetSampleSize());
inspector.AddField("sample_rate", GetSampleRate());
- if(m_QtVersion)
- {
+ if (m_QtVersion) {
inspector.AddField("qt_version", m_QtVersion);
}
-
+
return AP4_SUCCESS;
}
@@ -608,11 +586,11 @@ AP4_AudioSampleEntry::ToSampleDescription()
{
// create a sample description
return new AP4_GenericAudioSampleDescription(
- m_Type,
- GetSampleRate(),
- GetSampleSize(),
- GetChannelCount(),
- this);
+ m_Type,
+ GetSampleRate(),
+ GetSampleSize(),
+ GetChannelCount(),
+ this);
}
/*----------------------------------------------------------------------
@@ -620,13 +598,13 @@ AP4_AudioSampleEntry::ToSampleDescription()
+---------------------------------------------------------------------*/
AP4_MpegAudioSampleEntry::AP4_MpegAudioSampleEntry(
AP4_UI32 type,
- AP4_UI32 sample_rate,
+ AP4_UI32 sample_rate,
AP4_UI16 sample_size,
AP4_UI16 channel_count,
AP4_EsDescriptor* descriptor) :
AP4_AudioSampleEntry(type, sample_rate, sample_size, channel_count)
{
- if(descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+ if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
}
/*----------------------------------------------------------------------
@@ -649,32 +627,30 @@ AP4_MpegAudioSampleEntry::ToSampleDescription()
{
// find the esds atom
AP4_EsdsAtom* esds = AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS));
- if(esds == NULL)
- {
+ if (esds == NULL) {
// check if this is a quicktime style sample description
- if(m_QtVersion > 0)
- {
+ if (m_QtVersion > 0) {
esds = AP4_DYNAMIC_CAST(AP4_EsdsAtom, FindChild("wave/esds"));
}
}
-
+
// create a sample description
return new AP4_MpegAudioSampleDescription(GetSampleRate(),
- GetSampleSize(),
- GetChannelCount(),
- esds);
+ GetSampleSize(),
+ GetChannelCount(),
+ esds);
}
/*----------------------------------------------------------------------
| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
+---------------------------------------------------------------------*/
-AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
- AP4_UI16 sample_size,
- AP4_UI16 channel_count,
- AP4_EsDescriptor* descriptor) :
- AP4_MpegAudioSampleEntry(AP4_ATOM_TYPE_MP4A,
- sample_rate,
- sample_size,
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor) :
+ AP4_MpegAudioSampleEntry(AP4_ATOM_TYPE_MP4A,
+ sample_rate,
+ sample_size,
channel_count,
descriptor)
{
@@ -684,8 +660,8 @@ AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
+---------------------------------------------------------------------*/
AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_MpegAudioSampleEntry(AP4_ATOM_TYPE_MP4A, size, stream, atom_factory)
{
}
@@ -694,7 +670,7 @@ AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_Size size,
| AP4_VisualSampleEntry::AP4_VisualSampleEntry
+---------------------------------------------------------------------*/
AP4_VisualSampleEntry::AP4_VisualSampleEntry(
- AP4_Atom::Type format,
+ AP4_Atom::Type format,
AP4_UI16 width,
AP4_UI16 height,
AP4_UI16 depth,
@@ -720,9 +696,9 @@ AP4_VisualSampleEntry::AP4_VisualSampleEntry(
| AP4_VisualSampleEntry::AP4_VisualSampleEntry
+---------------------------------------------------------------------*/
AP4_VisualSampleEntry::AP4_VisualSampleEntry(AP4_Atom::Type format,
- AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_SampleEntry(format, size)
{
Read(stream, atom_factory);
@@ -734,7 +710,7 @@ AP4_VisualSampleEntry::AP4_VisualSampleEntry(AP4_Atom::Type format,
AP4_Size
AP4_VisualSampleEntry::GetFieldsSize()
{
- return AP4_SampleEntry::GetFieldsSize() + 70;
+ return AP4_SampleEntry::GetFieldsSize()+70;
}
/*----------------------------------------------------------------------
@@ -745,7 +721,7 @@ AP4_VisualSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
- if(result < 0) return result;
+ if (result < 0) return result;
// read fields from this class
stream.ReadUI16(m_Predefined1);
@@ -761,8 +737,7 @@ AP4_VisualSampleEntry::ReadFields(AP4_ByteStream& stream)
char compressor_name[33];
stream.Read(compressor_name, 32);
int name_length = compressor_name[0];
- if(name_length < 32)
- {
+ if (name_length < 32) {
compressor_name[name_length+1] = 0; // force null termination
m_CompressorName = &compressor_name[1];
}
@@ -780,71 +755,69 @@ AP4_Result
AP4_VisualSampleEntry::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
// write the fields of the base class
result = AP4_SampleEntry::WriteFields(stream);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// predefined1
result = stream.WriteUI16(m_Predefined1);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// reserved2
result = stream.WriteUI16(m_Reserved2);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// predefined2
result = stream.Write(m_Predefined2, sizeof(m_Predefined2));
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// width
result = stream.WriteUI16(m_Width);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// height
result = stream.WriteUI16(m_Height);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// horizontal resolution
result = stream.WriteUI32(m_HorizResolution);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// vertical resolution
result = stream.WriteUI32(m_VertResolution);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// reserved3
result = stream.WriteUI32(m_Reserved3);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// frame count
result = stream.WriteUI16(m_FrameCount);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// compressor name
unsigned char compressor_name[32];
unsigned int name_length = m_CompressorName.GetLength();
- if(name_length > 31) name_length = 31;
+ if (name_length > 31) name_length = 31;
compressor_name[0] = name_length;
- for(unsigned int i = 0; i < name_length; i++)
- {
+ for (unsigned int i=0; i<name_length; i++) {
compressor_name[i+1] = m_CompressorName[i];
}
- for(unsigned int i = name_length + 1; i < 32; i++)
- {
+ for (unsigned int i=name_length+1; i<32; i++) {
compressor_name[i] = 0;
}
result = stream.Write(compressor_name, 32);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// depth
result = stream.WriteUI16(m_Depth);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// predefined3
result = stream.WriteUI16(m_Predefined3);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
return result;
}
@@ -873,12 +846,12 @@ AP4_VisualSampleEntry::ToSampleDescription()
{
// create a sample description
return new AP4_GenericVideoSampleDescription(
- m_Type,
- m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
- this);
+ m_Type,
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
+ this);
}
/*----------------------------------------------------------------------
@@ -891,13 +864,13 @@ AP4_MpegVideoSampleEntry::AP4_MpegVideoSampleEntry(
AP4_UI16 depth,
const char* compressor_name,
AP4_EsDescriptor* descriptor) :
- AP4_VisualSampleEntry(type,
- width,
- height,
- depth,
+ AP4_VisualSampleEntry(type,
+ width,
+ height,
+ depth,
compressor_name)
{
- if(descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+ if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
}
/*----------------------------------------------------------------------
@@ -920,25 +893,25 @@ AP4_MpegVideoSampleEntry::ToSampleDescription()
{
// create a sample description
return new AP4_MpegVideoSampleDescription(
- m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
- AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
+ AP4_DYNAMIC_CAST(AP4_EsdsAtom, GetChild(AP4_ATOM_TYPE_ESDS)));
}
/*----------------------------------------------------------------------
| AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry
+---------------------------------------------------------------------*/
AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_UI16 width,
- AP4_UI16 height,
- AP4_UI16 depth,
- const char* compressor_name,
- AP4_EsDescriptor* descriptor) :
- AP4_MpegVideoSampleEntry(AP4_ATOM_TYPE_MP4V,
- width,
- height,
- depth,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_MpegVideoSampleEntry(AP4_ATOM_TYPE_MP4V,
+ width,
+ height,
+ depth,
compressor_name,
descriptor)
{
@@ -948,8 +921,8 @@ AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_UI16 width,
| AP4_Mp4vSampleEntry::AP4_Mp4aSampleEntry
+---------------------------------------------------------------------*/
AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_MpegVideoSampleEntry(AP4_ATOM_TYPE_MP4V, size, stream, atom_factory)
{
}
@@ -958,25 +931,25 @@ AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_Size size,
| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
+---------------------------------------------------------------------*/
AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_UI16 width,
- AP4_UI16 height,
- AP4_UI16 depth,
- const char* compressor_name,
- const AP4_AvccAtom& avcc) :
- AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1,
- width,
- height,
- depth,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_AvccAtom& avcc) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1,
+ width,
+ height,
+ depth,
compressor_name)
{
- AddChild(new AP4_AvccAtom(avcc));
+ AddChild(new AP4_AvccAtom(avcc));
}
/*----------------------------------------------------------------------
| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
+---------------------------------------------------------------------*/
AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1, size, stream, atom_factory)
{
}
@@ -988,20 +961,20 @@ AP4_SampleDescription*
AP4_Avc1SampleEntry::ToSampleDescription()
{
return new AP4_AvcSampleDescription(
- m_Width,
- m_Height,
- m_Depth,
- m_CompressorName.GetChars(),
- AP4_DYNAMIC_CAST(AP4_AvccAtom, GetChild(AP4_ATOM_TYPE_AVCC)));
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.GetChars(),
+ AP4_DYNAMIC_CAST(AP4_AvccAtom, GetChild(AP4_ATOM_TYPE_AVCC)));
}
/*----------------------------------------------------------------------
| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
+---------------------------------------------------------------------*/
AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
- AP4_UI16 highest_compatible_version,
- AP4_UI32 max_packet_size,
- AP4_UI32 timescale):
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale):
AP4_SampleEntry(AP4_ATOM_TYPE_RTP_),
m_HintTrackVersion(hint_track_version),
m_HighestCompatibleVersion(highest_compatible_version),
@@ -1015,8 +988,8 @@ AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
+---------------------------------------------------------------------*/
AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory):
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
AP4_SampleEntry(AP4_ATOM_TYPE_RTP_, size)
{
Read(stream, atom_factory);
@@ -1028,7 +1001,7 @@ AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_Size size,
AP4_Size
AP4_RtpHintSampleEntry::GetFieldsSize()
{
- return AP4_SampleEntry::GetFieldsSize() + 8;
+ return AP4_SampleEntry::GetFieldsSize()+8;
}
/*----------------------------------------------------------------------
@@ -1039,15 +1012,15 @@ AP4_RtpHintSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
- if(result < 0) return result;
+ if (result < 0) return result;
// data
result = stream.ReadUI16(m_HintTrackVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_HighestCompatibleVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI32(m_MaxPacketSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
@@ -1060,15 +1033,15 @@ AP4_RtpHintSampleEntry::WriteFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::WriteFields(stream);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// data
result = stream.WriteUI16(m_HintTrackVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_HighestCompatibleVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_MaxPacketSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return result;
}
@@ -1081,12 +1054,12 @@ AP4_RtpHintSampleEntry::InspectFields(AP4_AtomInspector& inspector)
{
// sample entry
AP4_SampleEntry::InspectFields(inspector);
-
+
// fields
inspector.AddField("hint_track_version", m_HintTrackVersion);
inspector.AddField("highest_compatible_version", m_HighestCompatibleVersion);
inspector.AddField("max_packet_size", m_MaxPacketSize);
-
+
return AP4_SUCCESS;
}
@@ -1095,8 +1068,8 @@ AP4_RtpHintSampleEntry::InspectFields(AP4_AtomInspector& inspector)
| AP4_TextSampleEntry::AP4_TextSampleEntry
+---------------------------------------------------------------------*/
AP4_TextSampleEntry::AP4_TextSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory):
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
AP4_SampleEntry(AP4_ATOM_TYPE_TEXT, size)
{
// read fields
@@ -1106,7 +1079,7 @@ AP4_TextSampleEntry::AP4_TextSampleEntry(AP4_Size size,
/*----------------------------------------------------------------------
| AP4_TextSampleEntry::~AP4_TextSampleEntry
+---------------------------------------------------------------------*/
-AP4_TextSampleEntry::~AP4_TextSampleEntry()
+AP4_TextSampleEntry::~AP4_TextSampleEntry()
{
}
@@ -1118,37 +1091,37 @@ AP4_TextSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
- if(result < 0) return result;
+ if (result < 0) return result;
// data
result = stream.ReadUI32(m_Description.DisplayFlags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI32(m_Description.TextJustification);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Read(&m_Description.BackgroundColor, 4);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Top);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Left);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Bottom);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Right);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.StartChar);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.EndChar);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.Ascent);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.Font.Id);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI08(m_Description.Style.Font.Face);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI08(m_Description.Style.Font.Size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Read(&m_Description.Style.Font.Color, 4);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// TODO: stream.ReadString(); -> m_Description.DefaultFontName
@@ -1163,8 +1136,8 @@ AP4_TextSampleEntry::WriteFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::WriteFields(stream);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// TODO: data
return result;
@@ -1178,9 +1151,9 @@ AP4_TextSampleEntry::InspectFields(AP4_AtomInspector& inspector)
{
// sample entry
AP4_SampleEntry::InspectFields(inspector);
-
+
// TODO: fields
-
+
return AP4_SUCCESS;
}
@@ -1188,8 +1161,8 @@ AP4_TextSampleEntry::InspectFields(AP4_AtomInspector& inspector)
| AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry
+---------------------------------------------------------------------*/
AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory):
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
AP4_SampleEntry(AP4_ATOM_TYPE_TX3G, size)
{
// read fields
@@ -1197,13 +1170,13 @@ AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry(AP4_Size size,
ReadFields(stream);
// read children atoms (fdat? blnk?)
- ReadChildren(atom_factory, stream, size - AP4_ATOM_HEADER_SIZE - fields_size);
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
}
/*----------------------------------------------------------------------
| AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry
+---------------------------------------------------------------------*/
-AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry()
+AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry()
{
}
@@ -1213,7 +1186,7 @@ AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry()
AP4_Size
AP4_Tx3gSampleEntry::GetFieldsSize()
{
- return AP4_SampleEntry::GetFieldsSize() + 4 + 1 + 1 + 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 1 + 1 + 4;
+ return AP4_SampleEntry::GetFieldsSize()+4+1+1+4+2+2+2+2+2+2+2+1+1+4;
}
/*----------------------------------------------------------------------
@@ -1224,37 +1197,37 @@ AP4_Tx3gSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
- if(result < 0) return result;
+ if (result < 0) return result;
// data
result = stream.ReadUI32(m_Description.DisplayFlags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI08(m_Description.HorizontalJustification);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI08(m_Description.VerticalJustification);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Read(&m_Description.BackgroundColor, 4);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Top);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Left);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Bottom);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.TextBox.Right);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.StartChar);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.EndChar);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI16(m_Description.Style.Font.Id);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI08(m_Description.Style.Font.Face);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.ReadUI08(m_Description.Style.Font.Size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.Read(&m_Description.Style.Font.Color, 4);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
@@ -1267,8 +1240,8 @@ AP4_Tx3gSampleEntry::WriteFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::WriteFields(stream);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// TODO: data
return result;
@@ -1282,9 +1255,9 @@ AP4_Tx3gSampleEntry::InspectFields(AP4_AtomInspector& inspector)
{
// sample entry
AP4_SampleEntry::InspectFields(inspector);
-
+
// TODO: fields
-
+
return AP4_SUCCESS;
}
@@ -1292,24 +1265,24 @@ AP4_Tx3gSampleEntry::InspectFields(AP4_AtomInspector& inspector)
| AP4_Tx3gSampleEntry::GetFontNameById
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Tx3gSampleEntry::GetFontNameById(AP4_Ordinal Id, AP4_String& Name)
{
- if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(GetChild(AP4_ATOM_TYPE_FTAB)))
- {
- AP4_Array<AP4_FtabAtom::AP4_Tx3gFontRecord> FontRecords = ftab->GetFontRecords();
-
- for(int i = 0, j = FontRecords.ItemCount(); i < j; i++)
- {
- if(Id == FontRecords[i].Id)
- {
- Name = FontRecords[i].Name;
- return AP4_SUCCESS;
- }
- }
- }
+ if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(GetChild(AP4_ATOM_TYPE_FTAB)))
+ {
+ AP4_Array<AP4_FtabAtom::AP4_Tx3gFontRecord> FontRecords = ftab->GetFontRecords();
- return AP4_FAILURE;
+ for(int i = 0, j = FontRecords.ItemCount(); i < j; i++)
+ {
+ if(Id == FontRecords[i].Id)
+ {
+ Name = FontRecords[i].Name;
+ return AP4_SUCCESS;
+ }
+ }
+ }
+
+ return AP4_FAILURE;
}
@@ -1319,18 +1292,18 @@ AP4_Tx3gSampleEntry::GetFontNameById(AP4_Ordinal Id, AP4_String& Name)
| AP4_AC3SampleEntry::AP4_AC3SampleEntry
+---------------------------------------------------------------------*/
AP4_AC3SampleEntry::AP4_AC3SampleEntry(AP4_Atom::Type format,
- AP4_UI32 sample_rate,
- AP4_UI16 sample_size,
- AP4_UI16 channel_count) :
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count) :
AP4_AudioSampleEntry(format, sample_rate, sample_size, channel_count)
{
}
AP4_AC3SampleEntry::AP4_AC3SampleEntry(AP4_Atom::Type format,
- AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory) :
- AP4_AudioSampleEntry(format, size, stream, atom_factory)
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_AudioSampleEntry(format, size, stream, atom_factory)
{
}
@@ -1342,70 +1315,68 @@ AP4_Result
AP4_AC3SampleEntry::ReadFields(AP4_ByteStream& stream)
{
- AP4_AudioSampleEntry::ReadFields(stream);
-
- // SampleSize field from AudioSampleEntry shall be ignored
- m_SampleSize = 0;
-
- // AC3SpecificBox
-
- // BoxHeader.Size, BoxHeader.Type
- char junk[8];
- stream.Read(junk, 8);
-
- AP4_UI32 data;
- stream.ReadUI24(data);
-
- // fscod
- switch((data >> 22) & 0x3)
- {
- case 0:
- m_SampleRate = 48000;
- break;
- case 1:
- m_SampleRate = 44100;
- break;
- case 2:
- m_SampleRate = 32000;
- break;
- }
-
- m_SampleRate <<= 16;
-
- // acmod
- switch((data >> 11) & 0x7)
- {
- case 1:
- m_ChannelCount = 1;
- break;
- case 0:
- case 2:
- m_ChannelCount = 2;
- break;
- case 3:
- case 4:
- m_ChannelCount = 3;
- break;
- case 5:
- case 6:
- m_ChannelCount = 4;
- break;
- case 7:
- m_ChannelCount = 5;
- break;
- }
-
- // lfeon
- if(((data >> 10) & 0x1) == 1)
- m_ChannelCount++;
-
- return AP4_SUCCESS;
+ AP4_AudioSampleEntry::ReadFields(stream);
+
+ // SampleSize field from AudioSampleEntry shall be ignored
+ m_SampleSize = 0;
+
+ // AC3SpecificBox
+
+ // BoxHeader.Size, BoxHeader.Type
+ char junk[8];
+ stream.Read(junk, 8);
+
+ AP4_UI32 data;
+ stream.ReadUI24(data);
+
+ // fscod
+ switch ((data>>22) & 0x3) {
+ case 0:
+ m_SampleRate = 48000;
+ break;
+ case 1:
+ m_SampleRate = 44100;
+ break;
+ case 2:
+ m_SampleRate = 32000;
+ break;
+ }
+
+ m_SampleRate <<= 16;
+
+ // acmod
+ switch ((data>>11) & 0x7) {
+ case 1:
+ m_ChannelCount = 1;
+ break;
+ case 0:
+ case 2:
+ m_ChannelCount = 2;
+ break;
+ case 3:
+ case 4:
+ m_ChannelCount = 3;
+ break;
+ case 5:
+ case 6:
+ m_ChannelCount = 4;
+ break;
+ case 7:
+ m_ChannelCount = 5;
+ break;
+ }
+
+ // lfeon
+ if (((data>>10) & 0x1) == 1)
+ m_ChannelCount++;
+
+ return AP4_SUCCESS;
}
AP4_Size
AP4_AC3SampleEntry::GetFieldsSize()
{
- return AP4_AudioSampleEntry::GetFieldsSize() + 11;
+ return AP4_AudioSampleEntry::GetFieldsSize() + 11;
}
// <== End patch MPC \ No newline at end of file
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.h
index 90d40cb22..f11a3506c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleEntry.h
@@ -50,21 +50,18 @@ class AP4_AvccAtom;
+---------------------------------------------------------------------*/
class AP4_SampleEntry : public AP4_ContainerAtom
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_SampleEntry, AP4_ContainerAtom)
// methods
AP4_SampleEntry(AP4_Atom::Type format, AP4_UI16 data_ref_index = 1);
- AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_SampleEntry(AP4_Atom::Type format,
AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
virtual ~AP4_SampleEntry() {}
-
- AP4_UI16 GetDataReferenceIndex()
- {
- return m_DataReferenceIndex;
- }
+
+ AP4_UI16 GetDataReferenceIndex() { return m_DataReferenceIndex; }
virtual AP4_Result Write(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
virtual AP4_SampleDescription* ToSampleDescription();
@@ -72,7 +69,7 @@ public:
// AP4_AtomParent methods
virtual void OnChildChanged(AP4_Atom* child);
-protected:
+ protected:
// constructor
AP4_SampleEntry(AP4_Atom::Type format, AP4_Size size);
@@ -93,20 +90,17 @@ protected:
+---------------------------------------------------------------------*/
class AP4_UnknownSampleEntry : public AP4_SampleEntry
{
-public:
+ public:
// this constructor takes ownership of the atom passed to it
AP4_UnknownSampleEntry(AP4_Atom::Type type, AP4_Size size, AP4_ByteStream& stream);
-
+
// AP4_SampleEntry methods
virtual AP4_SampleDescription* ToSampleDescription();
// accessors
- const AP4_DataBuffer& GetPayload()
- {
- return m_Payload;
- }
-
-protected:
+ const AP4_DataBuffer& GetPayload() { return m_Payload; }
+
+ protected:
// methods
virtual AP4_Size GetFieldsSize();
virtual AP4_Result ReadFields(AP4_ByteStream& stream);
@@ -134,21 +128,12 @@ public:
// accessors
AP4_UI32 GetSampleRate();
- AP4_UI16 GetSampleSize()
- {
- return m_SampleSize;
- }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
AP4_UI16 GetChannelCount();
- // ==> Start patch MPC
- AP4_UI32 GetBytesPerFrame()
- {
- return m_QtV1BytesPerFrame;
- };
- AP4_UI32 GetSamplesPerPacket()
- {
- return m_QtV1SamplesPerPacket;
- }
- // <== End patch MPC
+ // ==> Start patch MPC
+ AP4_UI32 GetBytesPerFrame() { return m_QtV1BytesPerFrame; };
+ AP4_UI32 GetSamplesPerPacket(){ return m_QtV1SamplesPerPacket; }
+ // <== End patch MPC
// methods
AP4_SampleDescription* ToSampleDescription();
@@ -164,17 +149,17 @@ protected:
AP4_UI16 m_QtVersion; // 0, 1 or 2
AP4_UI16 m_QtRevision; // 0
AP4_UI32 m_QtVendor; // 0
- AP4_UI16 m_ChannelCount;
- AP4_UI16 m_SampleSize;
+ AP4_UI16 m_ChannelCount;
+ AP4_UI16 m_SampleSize;
AP4_UI16 m_QtCompressionId; // 0 or -2
AP4_UI16 m_QtPacketSize; // always 0
- AP4_UI32 m_SampleRate; // 16.16 fixed point
-
+ AP4_UI32 m_SampleRate; // 16.16 fixed point
+
AP4_UI32 m_QtV1SamplesPerPacket;
AP4_UI32 m_QtV1BytesPerPacket;
AP4_UI32 m_QtV1BytesPerFrame;
AP4_UI32 m_QtV1BytesPerSample;
-
+
AP4_UI32 m_QtV2StructSize;
double m_QtV2SampleRate64;
AP4_UI32 m_QtV2ChannelCount;
@@ -193,7 +178,7 @@ class AP4_VisualSampleEntry : public AP4_SampleEntry
{
public:
// methods
- AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
AP4_UI16 width,
AP4_UI16 height,
AP4_UI16 depth,
@@ -204,30 +189,12 @@ public:
AP4_AtomFactory& atom_factory);
// accessors
- AP4_UI16 GetWidth()
- {
- return m_Width;
- }
- AP4_UI16 GetHeight()
- {
- return m_Height;
- }
- AP4_UI16 GetHorizResolution()
- {
- return m_HorizResolution;
- }
- AP4_UI16 GetVertResolution()
- {
- return m_VertResolution;
- }
- AP4_UI16 GetDepth()
- {
- return m_Depth;
- }
- const char* GetCompressorName()
- {
- return m_CompressorName.GetChars();
- }
+ AP4_UI16 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetHorizResolution(){ return m_HorizResolution; }
+ AP4_UI16 GetVertResolution() { return m_VertResolution; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.GetChars(); }
// methods
AP4_SampleDescription* ToSampleDescription();
@@ -249,7 +216,7 @@ protected:
AP4_UI32 m_VertResolution; // = 0x00480000 (72 dpi)
AP4_UI32 m_Reserved3; // = 0
AP4_UI16 m_FrameCount; // = 1
- AP4_String m_CompressorName;
+ AP4_String m_CompressorName;
AP4_UI16 m_Depth; // = 0x0018
AP4_UI16 m_Predefined3; // = 0xFFFF
};
@@ -280,7 +247,7 @@ class AP4_MpegAudioSampleEntry : public AP4_AudioSampleEntry
public:
// constructors
AP4_MpegAudioSampleEntry(AP4_UI32 type,
- AP4_UI32 sample_rate,
+ AP4_UI32 sample_rate,
AP4_UI16 sample_size,
AP4_UI16 channel_count,
AP4_EsDescriptor* descriptor);
@@ -320,7 +287,7 @@ public:
+---------------------------------------------------------------------*/
class AP4_Mp4sSampleEntry : public AP4_MpegSystemSampleEntry
{
-public:
+ public:
// constructors
AP4_Mp4sSampleEntry(AP4_Size size,
AP4_ByteStream& stream,
@@ -336,12 +303,12 @@ public:
+---------------------------------------------------------------------*/
class AP4_Mp4aSampleEntry : public AP4_MpegAudioSampleEntry
{
-public:
+ public:
// constructors
AP4_Mp4aSampleEntry(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
- AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
AP4_UI16 sample_size,
AP4_UI16 channel_count,
AP4_EsDescriptor* descriptor);
@@ -352,7 +319,7 @@ public:
+---------------------------------------------------------------------*/
class AP4_Mp4vSampleEntry : public AP4_MpegVideoSampleEntry
{
-public:
+ public:
// constructors
AP4_Mp4vSampleEntry(AP4_Size size,
AP4_ByteStream& stream,
@@ -361,7 +328,7 @@ public:
AP4_UI16 height,
AP4_UI16 depth,
const char* compressor_name,
- AP4_EsDescriptor* descriptor);
+ AP4_EsDescriptor* descriptor);
};
/*----------------------------------------------------------------------
@@ -379,7 +346,7 @@ public:
AP4_UI16 depth,
const char* compressor_name,
const AP4_AvccAtom& avcc);
-
+
// inherited from AP4_SampleEntry
virtual AP4_SampleDescription* ToSampleDescription();
};
@@ -398,7 +365,7 @@ public:
AP4_RtpHintSampleEntry(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
-
+
protected:
// methods
virtual AP4_Size GetFieldsSize();
@@ -421,36 +388,21 @@ class AP4_TextSampleEntry : public AP4_SampleEntry
public:
// methods
AP4_TextSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory);
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
virtual ~AP4_TextSampleEntry();
-
- struct AP4_TextDescription
- {
- AP4_UI32 DisplayFlags;
- AP4_UI32 TextJustification;
- AP4_UI32 BackgroundColor;
- struct
- {
- AP4_UI16 Top, Left, Bottom, Right;
- } TextBox;
- struct
- {
- AP4_UI16 StartChar, EndChar, Ascent;
- struct
- {
- AP4_UI16 Id;
- AP4_UI08 Face, Size;
- AP4_UI32 Color;
- } Font;
- } Style;
- AP4_String DefaultFontName;
- };
-
- const AP4_TextDescription& GetDescription() const
- {
- return m_Description;
- };
+
+ struct AP4_TextDescription
+ {
+ AP4_UI32 DisplayFlags;
+ AP4_UI32 TextJustification;
+ AP4_UI32 BackgroundColor;
+ struct {AP4_UI16 Top, Left, Bottom, Right;} TextBox;
+ struct {AP4_UI16 StartChar, EndChar, Ascent; struct {AP4_UI16 Id; AP4_UI08 Face, Size; AP4_UI32 Color;} Font;} Style;
+ AP4_String DefaultFontName;
+ };
+
+ const AP4_TextDescription& GetDescription() const { return m_Description; };
protected:
// methods
@@ -459,7 +411,7 @@ protected:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
// members
- AP4_TextDescription m_Description;
+ AP4_TextDescription m_Description;
};
/*----------------------------------------------------------------------
@@ -470,38 +422,23 @@ class AP4_Tx3gSampleEntry : public AP4_SampleEntry
public:
// methods
AP4_Tx3gSampleEntry(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory);
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
virtual ~AP4_Tx3gSampleEntry();
+
+ struct AP4_Tx3gDescription
+ {
+ AP4_UI32 DisplayFlags;
+ AP4_UI08 HorizontalJustification;
+ AP4_UI08 VerticalJustification;
+ AP4_UI32 BackgroundColor;
+ struct {AP4_UI16 Top, Left, Bottom, Right;} TextBox;
+ struct {AP4_UI16 StartChar, EndChar; struct {AP4_UI16 Id; AP4_UI08 Face, Size; AP4_UI32 Color;} Font;} Style;
+ };
- struct AP4_Tx3gDescription
- {
- AP4_UI32 DisplayFlags;
- AP4_UI08 HorizontalJustification;
- AP4_UI08 VerticalJustification;
- AP4_UI32 BackgroundColor;
- struct
- {
- AP4_UI16 Top, Left, Bottom, Right;
- } TextBox;
- struct
- {
- AP4_UI16 StartChar, EndChar;
- struct
- {
- AP4_UI16 Id;
- AP4_UI08 Face, Size;
- AP4_UI32 Color;
- } Font;
- } Style;
- };
-
- const AP4_Tx3gDescription& GetDescription() const
- {
- return m_Description;
- };
-
- AP4_Result GetFontNameById(AP4_Ordinal Id, AP4_String& Name);
+ const AP4_Tx3gDescription& GetDescription() const { return m_Description; };
+
+ AP4_Result GetFontNameById(AP4_Ordinal Id, AP4_String& Name);
protected:
// methods
@@ -511,7 +448,7 @@ protected:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
// members
- AP4_Tx3gDescription m_Description;
+ AP4_Tx3gDescription m_Description;
};
@@ -521,20 +458,20 @@ protected:
+---------------------------------------------------------------------*/
class AP4_AC3SampleEntry : public AP4_AudioSampleEntry
{
-public:
+ public:
// constructors
AP4_AC3SampleEntry(AP4_Atom::Type format,
- AP4_UI32 sample_rate,
+ AP4_UI32 sample_rate,
AP4_UI16 sample_size,
AP4_UI16 channel_count);
AP4_AC3SampleEntry(AP4_Atom::Type format,
- AP4_Size size,
+ AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
protected:
- virtual AP4_Size GetFieldsSize();
+ virtual AP4_Size GetFieldsSize();
virtual AP4_Result ReadFields(AP4_ByteStream& stream);
};
// <== End patch MPC
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.cpp
index d0dfb7e29..a641c6a2d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.cpp
@@ -42,7 +42,7 @@ AP4_TrackSampleSource::AP4_TrackSampleSource(AP4_Track* track) :
m_SampleIndex(0)
{
}
-
+
/*----------------------------------------------------------------------
| AP4_TrackSampleSource
+---------------------------------------------------------------------*/
@@ -55,7 +55,7 @@ AP4_TrackSampleSource::GetTimeScale()
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::GetDurationMs
+---------------------------------------------------------------------*/
-AP4_UI32
+AP4_UI32
AP4_TrackSampleSource::GetDurationMs()
{
return m_Track->GetDurationMs();
@@ -64,7 +64,7 @@ AP4_TrackSampleSource::GetDurationMs()
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::GetTrackId
+---------------------------------------------------------------------*/
-AP4_UI32
+AP4_UI32
AP4_TrackSampleSource::GetTrackId()
{
return m_Track->GetId();
@@ -73,18 +73,18 @@ AP4_TrackSampleSource::GetTrackId()
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::ReadNextSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_TrackSampleSource::ReadNextSample(AP4_Sample& sample, AP4_DataBuffer& buffer)
{
AP4_Result result = m_Track->ReadSample(m_SampleIndex, sample, buffer);
- if(AP4_SUCCEEDED(result)) ++m_SampleIndex;
+ if (AP4_SUCCEEDED(result)) ++m_SampleIndex;
return result;
}
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::GetNearestSyncSampleIndex
+---------------------------------------------------------------------*/
-AP4_Ordinal
+AP4_Ordinal
AP4_TrackSampleSource::GetNearestSyncSampleIndex(AP4_Ordinal indx, bool before)
{
return m_Track->GetNearestSyncSampleIndex(indx, before);
@@ -93,7 +93,7 @@ AP4_TrackSampleSource::GetNearestSyncSampleIndex(AP4_Ordinal indx, bool before)
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::GetSampleIndexForTimeStampMs
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_TrackSampleSource::GetSampleIndexForTimeStampMs(AP4_UI32 timestamp, AP4_Ordinal& indx)
{
return m_Track->GetSampleIndexForTimeStampMs(timestamp, indx);
@@ -102,21 +102,21 @@ AP4_TrackSampleSource::GetSampleIndexForTimeStampMs(AP4_UI32 timestamp, AP4_Ordi
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::SetSampleIndex
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_TrackSampleSource::SetSampleIndex(AP4_Ordinal indx)
{
- if(indx >= m_Track->GetSampleCount()) return AP4_ERROR_OUT_OF_RANGE;
+ if (indx >= m_Track->GetSampleCount()) return AP4_ERROR_OUT_OF_RANGE;
m_SampleIndex = indx;
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::GetSampleDescription
+---------------------------------------------------------------------*/
-AP4_SampleDescription*
+AP4_SampleDescription*
AP4_TrackSampleSource::GetSampleDescription(AP4_Ordinal indx)
{
return m_Track->GetSampleDescription(indx);
}
-
+
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.h
index 9cdc0178b..3f2cd94d2 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleSource.h
@@ -49,12 +49,12 @@ class AP4_SampleSource
{
public:
virtual ~AP4_SampleSource() {}
-
+
/**
* Return the timscale of the sample's media
*/
virtual AP4_UI32 GetTimeScale() = 0;
-
+
/**
* Return the duration in milliseconds
*/
@@ -65,27 +65,27 @@ public:
* no track ID associated with it.
*/
virtual AP4_UI32 GetTrackId() = 0;
-
+
/**
* Read the next sample from the source
*/
virtual AP4_Result ReadNextSample(AP4_Sample& sample, AP4_DataBuffer& buffer) = 0;
-
+
/**
* Return the index of the nearest sync sample from a given sample index.
*/
- virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal indx, bool before = true) = 0;
-
+ virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal indx, bool before=true) = 0;
+
/**
* Return the sample index given a timestamp in milliseconds
*/
virtual AP4_Result GetSampleIndexForTimeStampMs(AP4_UI32 timestamp, AP4_Ordinal& indx) = 0;
-
+
/**
* Seek to a specific sample index.
*/
virtual AP4_Result SetSampleIndex(AP4_Ordinal indx) = 0;
-
+
/**
* Return a sample description by index.
* Returns NULL if there is no sample description with the requested index.
@@ -99,17 +99,17 @@ public:
class AP4_TrackSampleSource : public AP4_SampleSource
{
public:
- AP4_TrackSampleSource(AP4_Track* track);
-
+ AP4_TrackSampleSource(AP4_Track* track);
+
virtual AP4_UI32 GetTimeScale();
virtual AP4_UI32 GetDurationMs();
virtual AP4_UI32 GetTrackId();
virtual AP4_Result ReadNextSample(AP4_Sample& sample, AP4_DataBuffer& buffer);
- virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal indx, bool before = true);
+ virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal indx, bool before=true);
virtual AP4_Result GetSampleIndexForTimeStampMs(AP4_UI32 timestamp, AP4_Ordinal& indx);
virtual AP4_Result SetSampleIndex(AP4_Ordinal indx);
virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal indx);
-
+
private:
AP4_Track* m_Track;
AP4_Ordinal m_SampleIndex;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.cpp
index 743ca6f84..3f892d2a9 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.cpp
@@ -44,7 +44,7 @@
/*----------------------------------------------------------------------
| AP4_SampleTable::GenerateStblAtom
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
{
// create the stbl container
@@ -64,10 +64,10 @@ AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
// create the stss atom
AP4_StssAtom* stss = new AP4_StssAtom();
-
+
// declare the ctts atom (may be created later)
AP4_CttsAtom* ctts = NULL;
-
+
// start chunk table
AP4_Ordinal current_chunk_index = 0;
AP4_Size current_chunk_size = 0;
@@ -83,69 +83,61 @@ AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
// process all the samples
bool all_samples_are_sync = false;
AP4_Cardinal sample_count = GetSampleCount();
- for(AP4_Ordinal i = 0; i < sample_count; i++)
- {
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
AP4_Sample sample;
GetSample(i, sample);
-
+
// update DTS table
AP4_UI32 new_duration = sample.GetDuration();
- if(new_duration != current_duration && current_duration_run != 0)
- {
+ if (new_duration != current_duration && current_duration_run != 0) {
// emit a new stts entry
stts->AddEntry(current_duration_run, current_duration);
-
+
// reset the run count
current_duration_run = 0;
- }
+ }
++current_duration_run;
current_duration = new_duration;
-
+
// update CTS table
AP4_UI32 new_cts_delta = sample.GetCtsDelta();
- if(new_cts_delta != current_cts_delta && current_cts_delta_run != 0)
- {
+ if (new_cts_delta != current_cts_delta && current_cts_delta_run != 0) {
// create a ctts atom if we don't have one
- if(ctts == NULL) ctts = new AP4_CttsAtom();
-
+ if (ctts == NULL) ctts = new AP4_CttsAtom();
+
//emit a new ctts entry
ctts->AddEntry(current_cts_delta_run, current_cts_delta);
-
+
// reset the run count
current_cts_delta_run = 0;
}
++current_cts_delta_run;
current_cts_delta = new_cts_delta;
-
+
// add an entry into the stsz atom
stsz->AddEntry(sample.GetSize());
-
+
// update the sync sample table
- if(sample.IsSync())
- {
- stss->AddEntry(i + 1);
- if(i == 0) all_samples_are_sync = true;
- }
- else
- {
+ if (sample.IsSync()) {
+ stss->AddEntry(i+1);
+ if (i==0) all_samples_are_sync = true;
+ } else {
all_samples_are_sync = false;
}
-
+
// see in which chunk this sample is
AP4_Ordinal chunk_index = 0;
AP4_Ordinal position_in_chunk = 0;
AP4_Result result = GetSampleChunkPosition(i, chunk_index, position_in_chunk);
- if(AP4_SUCCEEDED(result))
- {
- if(chunk_index != current_chunk_index && current_samples_in_chunk != 0)
- {
+ if (AP4_SUCCEEDED(result)) {
+ if (chunk_index != current_chunk_index && current_samples_in_chunk != 0) {
// new chunk
chunk_offsets.Append(current_chunk_offset);
current_chunk_offset += current_chunk_size;
- stsc->AddEntry(1,
+ stsc->AddEntry(1,
current_samples_in_chunk,
- current_sample_description_index + 1);
+ current_sample_description_index+1);
current_samples_in_chunk = 0;
current_chunk_size = 0;
@@ -155,32 +147,30 @@ AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
// store the sample description index
current_sample_description_index = sample.GetDescriptionIndex();
-
+
// adjust the current chunk info
current_chunk_size += sample.GetSize();
- ++current_samples_in_chunk;
+ ++current_samples_in_chunk;
}
// finish the stts table
stts->AddEntry(current_duration_run, current_duration);
// finish the ctts table if we have one
- if(ctts)
- {
+ if (ctts) {
AP4_ASSERT(current_cts_delta_run != 0);
-
+
// add a ctts entry
ctts->AddEntry(current_cts_delta_run, current_cts_delta);
- }
-
+ }
+
// process any unfinished chunk
- if(current_samples_in_chunk != 0)
- {
+ if (current_samples_in_chunk != 0) {
// new chunk
chunk_offsets.Append(current_chunk_offset);
- stsc->AddEntry(1,
+ stsc->AddEntry(1,
current_samples_in_chunk,
- current_sample_description_index + 1);
+ current_sample_description_index+1);
}
// attach the children of stbl
@@ -188,24 +178,19 @@ AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
stbl->AddChild(stsz);
stbl->AddChild(stsc);
stbl->AddChild(stts);
- if(ctts) stbl->AddChild(ctts);
- if(!all_samples_are_sync && stss->GetEntries().ItemCount() != 0)
- {
+ if (ctts) stbl->AddChild(ctts);
+ if (!all_samples_are_sync && stss->GetEntries().ItemCount() != 0) {
stbl->AddChild(stss);
- }
- else
- {
+ } else {
delete stss;
}
-
+
// see if we need a co64 or an stco atom
AP4_Size chunk_count = chunk_offsets.ItemCount();
- if(current_chunk_offset <= 0xFFFFFFFF)
- {
+ if (current_chunk_offset <= 0xFFFFFFFF) {
// make an array of 32-bit entries
AP4_UI32* chunk_offsets_32 = new AP4_UI32[chunk_count];
- for(unsigned int i = 0; i < chunk_count; i++)
- {
+ for (unsigned int i=0; i<chunk_count; i++) {
chunk_offsets_32[i] = (AP4_UI32)chunk_offsets[i];
}
// create the stco atom
@@ -213,9 +198,7 @@ AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
stbl->AddChild(stco);
delete[] chunk_offsets_32;
- }
- else
- {
+ } else {
// create the co64 atom
AP4_Co64Atom* co64 = new AP4_Co64Atom(&chunk_offsets[0], chunk_count);
stbl->AddChild(co64);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.h
index 67c3b843a..45a6c7bb0 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SampleTable.h
@@ -44,8 +44,7 @@ class AP4_SampleDescription;
/*----------------------------------------------------------------------
| AP4_SampleTable
+---------------------------------------------------------------------*/
-class AP4_SampleTable
-{
+class AP4_SampleTable {
public:
// constructors and destructor
virtual ~AP4_SampleTable() {};
@@ -54,14 +53,14 @@ public:
virtual AP4_Result GenerateStblAtom(AP4_ContainerAtom*& stbl);
virtual AP4_Result GetSample(AP4_Ordinal sample_index, AP4_Sample& sample) = 0;
virtual AP4_Cardinal GetSampleCount() = 0;
- virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
- AP4_Ordinal& chunk_index,
- AP4_Ordinal& position_in_chunk) = 0;
+ virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
+ AP4_Ordinal& chunk_index,
+ AP4_Ordinal& position_in_chunk) = 0;
virtual AP4_Cardinal GetSampleDescriptionCount() = 0;
virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index) = 0;
virtual AP4_Result GetSampleIndexForTimeStamp(AP4_UI64 ts,
- AP4_Ordinal& index) = 0;
- virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before = true) = 0;
+ AP4_Ordinal& index) = 0;
+ virtual AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before=true) = 0;
};
#endif // _AP4_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.cpp
index 5916a14a9..767e59368 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - schm Atoms
+| AP4 - schm Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -42,29 +42,27 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_SchmAtom)
| AP4_SchmAtom::Create
+---------------------------------------------------------------------*/
AP4_SchmAtom*
-AP4_SchmAtom::Create(AP4_Size size,
+AP4_SchmAtom::Create(AP4_Size size,
AP4_Array<AP4_Atom::Type>* context,
AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
- if(size < AP4_FULL_ATOM_HEADER_SIZE + 6) return NULL;
-
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
+ if (size < AP4_FULL_ATOM_HEADER_SIZE+6) return NULL;
+
// check the context to see if this is a short form atom or not
bool short_form = false;
- if(size < AP4_FULL_ATOM_HEADER_SIZE + 8) short_form = true;
- if(context)
- {
+ if (size < AP4_FULL_ATOM_HEADER_SIZE+8) short_form = true;
+ if (context) {
AP4_Size context_depth = context->ItemCount();
- if(context_depth >= 2 &&
- (*context)[context_depth-2] == AP4_ATOM_TYPE('m', 'r', 'l', 'n'))
- {
+ if (context_depth >= 2 &&
+ (*context)[context_depth-2] == AP4_ATOM_TYPE('m','r','l','n')) {
short_form = true;
}
}
-
+
return new AP4_SchmAtom(size, version, flags, short_form, stream);
}
@@ -75,23 +73,22 @@ AP4_SchmAtom::AP4_SchmAtom(AP4_UI32 scheme_type,
AP4_UI32 scheme_version,
const char* scheme_uri,
bool short_form) :
- AP4_Atom(AP4_ATOM_TYPE_SCHM, AP4_FULL_ATOM_HEADER_SIZE + 4 + (short_form ? 2 : 4), 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_SCHM, AP4_FULL_ATOM_HEADER_SIZE+4+(short_form?2:4), 0, 0),
m_AtomHasShortForm(short_form),
m_SchemeType(scheme_type),
m_SchemeVersion(scheme_version)
{
- if(scheme_uri)
- {
+ if (scheme_uri) {
m_SchemeUri = scheme_uri;
m_Flags = 1;
- m_Size32 += m_SchemeUri.GetLength() + 1;
+ m_Size32 += m_SchemeUri.GetLength()+1;
}
}
/*----------------------------------------------------------------------
| AP4_SchmAtom::AP4_SchmAtom
+---------------------------------------------------------------------*/
-AP4_SchmAtom::AP4_SchmAtom(AP4_UI32 size,
+AP4_SchmAtom::AP4_SchmAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
bool short_form,
@@ -100,21 +97,16 @@ AP4_SchmAtom::AP4_SchmAtom(AP4_UI32 size,
m_AtomHasShortForm(short_form)
{
stream.ReadUI32(m_SchemeType);
- if(short_form)
- {
+ if (short_form) {
AP4_UI16 short_version;
stream.ReadUI16(short_version);
m_SchemeVersion = short_version;
- }
- else
- {
+ } else {
stream.ReadUI32(m_SchemeVersion);
}
- if(m_Flags & 1)
- {
- int str_size = size - (AP4_FULL_ATOM_HEADER_SIZE + 8);
- if(str_size > 0)
- {
+ if (m_Flags & 1) {
+ int str_size = size-(AP4_FULL_ATOM_HEADER_SIZE+8);
+ if (str_size > 0) {
char* str = new char[str_size];
stream.Read(str, str_size);
str[str_size-1] = '\0'; // force null-termination
@@ -134,30 +126,26 @@ AP4_SchmAtom::WriteFields(AP4_ByteStream& stream)
// scheme type
result = stream.WriteUI32(m_SchemeType);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// scheme version
- if(m_AtomHasShortForm)
- {
+ if (m_AtomHasShortForm) {
result = stream.WriteUI16((AP4_UI16)m_SchemeVersion);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
result = stream.WriteUI32(m_SchemeVersion);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
-
+
// uri if needed
- if(m_Flags & 1)
- {
- result = stream.Write(m_SchemeUri.GetChars(), m_SchemeUri.GetLength() + 1);
- if(AP4_FAILED(result)) return result;
+ if (m_Flags & 1) {
+ result = stream.Write(m_SchemeUri.GetChars(), m_SchemeUri.GetLength()+1);
+ if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
- AP4_Size fields_size = 4 + (m_AtomHasShortForm ? 2 : 4);
- AP4_Size padding = m_Size32 - (AP4_FULL_ATOM_HEADER_SIZE + fields_size + m_SchemeUri.GetLength() + 1);
- while(padding--) stream.WriteUI08(0);
+ AP4_Size fields_size = 4+(m_AtomHasShortForm?2:4);
+ AP4_Size padding = m_Size32-(AP4_FULL_ATOM_HEADER_SIZE+fields_size+m_SchemeUri.GetLength()+1);
+ while (padding--) stream.WriteUI08(0);
}
return result;
@@ -172,17 +160,13 @@ AP4_SchmAtom::InspectFields(AP4_AtomInspector& inspector)
char st[5];
AP4_FormatFourChars(st, m_SchemeType);
inspector.AddField("scheme_type", st);
- if(m_AtomHasShortForm)
- {
+ if (m_AtomHasShortForm) {
inspector.AddField("scheme_version (short)", m_SchemeVersion);
- }
- else
- {
+ } else {
inspector.AddField("scheme_version", m_SchemeVersion);
}
- if(m_Flags & 1)
- {
- inspector.AddField("scheme_uri", m_SchemeUri.GetChars());
+ if (m_Flags & 1) {
+ inspector.AddField("scheme_uri", m_SchemeUri.GetChars());
}
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.h
index fa60f9d62..3b2a065db 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SchmAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - schm Atoms
+| AP4 - schm Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -51,7 +51,7 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_SchmAtom, AP4_Atom)
// class methods
- static AP4_SchmAtom* Create(AP4_Size size,
+ static AP4_SchmAtom* Create(AP4_Size size,
AP4_Array<AP4_Atom::Type>* context,
AP4_ByteStream& stream);
@@ -66,22 +66,13 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI32 GetSchemeType()
- {
- return m_SchemeType;
- }
- AP4_UI32 GetSchemeVersion()
- {
- return m_SchemeVersion;
- }
- AP4_String& GetSchemeUri()
- {
- return m_SchemeUri;
- }
+ AP4_UI32 GetSchemeType() { return m_SchemeType; }
+ AP4_UI32 GetSchemeVersion() { return m_SchemeVersion; }
+ AP4_String& GetSchemeUri() { return m_SchemeUri; }
private:
// methods
- AP4_SchmAtom(AP4_UI32 size,
+ AP4_SchmAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
bool short_form,
@@ -89,7 +80,7 @@ private:
// members
bool m_AtomHasShortForm; // for versions of this where the version
- // field is only 16 bits
+ // field is only 16 bits
AP4_UI32 m_SchemeType;
AP4_UI32 m_SchemeVersion;
AP4_String m_SchemeUri;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.cpp
index 88abc8f93..56237781e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - sdp Atoms
+| AP4 - sdp Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,7 +41,7 @@ AP4_SdpAtom::AP4_SdpAtom(const char* sdp_text) :
AP4_Atom(AP4_ATOM_TYPE_SDP_, AP4_ATOM_HEADER_SIZE),
m_SdpText(sdp_text)
{
- m_Size32 += m_SdpText.GetLength() + 1;
+ m_Size32 += m_SdpText.GetLength()+1;
}
/*----------------------------------------------------------------------
@@ -51,9 +51,8 @@ AP4_SdpAtom::AP4_SdpAtom(AP4_UI32 size, AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_SDP_, size)
{
// sdptext
- AP4_Size str_size = size - AP4_ATOM_HEADER_SIZE;
- if(str_size > 0)
- {
+ AP4_Size str_size = size-AP4_ATOM_HEADER_SIZE;
+ if (str_size > 0) {
char* str = new char[str_size+1];
stream.Read(str, str_size);
str[str_size] = '\0'; // force null-termination
@@ -70,12 +69,12 @@ AP4_SdpAtom::WriteFields(AP4_ByteStream& stream)
{
// sdptext
AP4_Result result = stream.Write(m_SdpText.GetChars(), m_SdpText.GetLength());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
- AP4_Size padding = m_Size32 - (AP4_ATOM_HEADER_SIZE + m_SdpText.GetLength());
- while(padding--) stream.WriteUI08(0);
-
+ AP4_Size padding = m_Size32-(AP4_ATOM_HEADER_SIZE+m_SdpText.GetLength());
+ while (padding--) stream.WriteUI08(0);
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.h
index 0c8ea9a1f..421a73b12 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SdpAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - sdp Atoms
+| AP4 - sdp Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -48,8 +48,7 @@ class AP4_SdpAtom : public AP4_Atom
{
public:
// class methods
- static AP4_SdpAtom* Create(AP4_Size size, AP4_ByteStream& stream)
- {
+ static AP4_SdpAtom* Create(AP4_Size size, AP4_ByteStream& stream) {
return new AP4_SdpAtom(size, stream);
}
@@ -57,7 +56,7 @@ public:
AP4_SdpAtom(const char* sdp_text);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// accessors
const AP4_String& GetSdpText() const;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.cpp
index ee7adb9d1..88052ced1 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - smhd Atoms
+| AP4 - smhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,8 +41,8 @@ AP4_SmhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_SmhdAtom(size, version, flags, stream);
}
@@ -50,7 +50,7 @@ AP4_SmhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_SmhdAtom::AP4_SmhdAtom
+---------------------------------------------------------------------*/
AP4_SmhdAtom::AP4_SmhdAtom(AP4_UI16 balance) :
- AP4_Atom(AP4_ATOM_TYPE_SMHD, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_SMHD, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0),
m_Balance(balance)
{
m_Reserved = 0;
@@ -59,7 +59,7 @@ AP4_SmhdAtom::AP4_SmhdAtom(AP4_UI16 balance) :
/*----------------------------------------------------------------------
| AP4_SmhdAtom::AP4_SmhdAtom
+---------------------------------------------------------------------*/
-AP4_SmhdAtom::AP4_SmhdAtom(AP4_UI32 size,
+AP4_SmhdAtom::AP4_SmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -79,11 +79,11 @@ AP4_SmhdAtom::WriteFields(AP4_ByteStream& stream)
// balance
result = stream.WriteUI16(m_Balance);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// reserved
result = stream.WriteUI16(m_Reserved);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.h
index 1cf71d987..8d6269b5b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SmhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - smhd Atoms
+| AP4 - smhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -51,7 +51,7 @@ public:
private:
// methods
- AP4_SmhdAtom(AP4_UI32 size,
+ AP4_SmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.cpp
index 397da3850..4ed8fe1f3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stco Atoms
+| AP4 - stco Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_StcoAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_StcoAtom(size, version, flags, stream);
}
@@ -55,39 +55,36 @@ AP4_StcoAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_StcoAtom::AP4_StcoAtom
+---------------------------------------------------------------------*/
AP4_StcoAtom::AP4_StcoAtom(AP4_UI32* entries, AP4_UI32 entry_count) :
- AP4_Atom(AP4_ATOM_TYPE_STCO,
- AP4_FULL_ATOM_HEADER_SIZE + 4 + entry_count * 4,
- 0, 0),
- m_Entries(new AP4_UI32[entry_count]),
- m_EntryCount(entry_count)
+AP4_Atom(AP4_ATOM_TYPE_STCO,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*4,
+ 0, 0),
+ m_Entries(new AP4_UI32[entry_count]),
+ m_EntryCount(entry_count)
{
- AP4_CopyMemory(m_Entries, entries, m_EntryCount * 4);
+ AP4_CopyMemory(m_Entries, entries, m_EntryCount*4);
}
/*----------------------------------------------------------------------
| AP4_StcoAtom::AP4_StcoAtom
+---------------------------------------------------------------------*/
-AP4_StcoAtom::AP4_StcoAtom(AP4_UI32 size,
+AP4_StcoAtom::AP4_StcoAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_STCO, size, version, flags)
{
stream.ReadUI32(m_EntryCount);
- if(m_EntryCount > (size - AP4_FULL_ATOM_HEADER_SIZE - 4) / 4)
- {
- m_EntryCount = (size - AP4_FULL_ATOM_HEADER_SIZE - 4) / 4;
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4;
}
m_Entries = new AP4_UI32[m_EntryCount];
unsigned char* buffer = new unsigned char[m_EntryCount*4];
- AP4_Result result = stream.Read(buffer, m_EntryCount * 4);
- if(AP4_FAILED(result))
- {
+ AP4_Result result = stream.Read(buffer, m_EntryCount*4);
+ if (AP4_FAILED(result)) {
delete[] buffer;
return;
}
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
m_Entries[i] = AP4_BytesToUInt32BE(&buffer[i*4]);
}
delete[] buffer;
@@ -108,8 +105,7 @@ AP4_Result
AP4_StcoAtom::GetChunkOffset(AP4_Ordinal chunk, AP4_UI32& chunk_offset)
{
// check the bounds
- if(chunk > m_EntryCount || chunk == 0)
- {
+ if (chunk > m_EntryCount || chunk == 0) {
return AP4_ERROR_OUT_OF_RANGE;
}
@@ -126,8 +122,7 @@ AP4_Result
AP4_StcoAtom::SetChunkOffset(AP4_Ordinal chunk, AP4_UI32 chunk_offset)
{
// check the bounds
- if(chunk > m_EntryCount || chunk == 0)
- {
+ if (chunk > m_EntryCount || chunk == 0) {
return AP4_ERROR_OUT_OF_RANGE;
}
@@ -143,8 +138,7 @@ AP4_StcoAtom::SetChunkOffset(AP4_Ordinal chunk, AP4_UI32 chunk_offset)
AP4_Result
AP4_StcoAtom::AdjustChunkOffsets(int delta)
{
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
m_Entries[i] += delta;
}
@@ -161,13 +155,12 @@ AP4_StcoAtom::WriteFields(AP4_ByteStream& stream)
// entry count
result = stream.WriteUI32(m_EntryCount);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// entries
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
result = stream.WriteUI32(m_Entries[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return result;
@@ -180,15 +173,13 @@ AP4_Result
AP4_StcoAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry_count", m_EntryCount);
- if(inspector.GetVerbosity() >= 1)
- {
+ if (inspector.GetVerbosity() >= 1) {
char header[32];
- for(AP4_Ordinal i = 0; i < m_EntryCount; i++)
- {
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
AP4_FormatString(header, sizeof(header), "entry %8d", i);
inspector.AddField(header, m_Entries[i]);
}
}
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.h
index 2a4777250..7fdaea4cc 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StcoAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stco Atoms
+| AP4 - stco Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -51,21 +51,15 @@ public:
~AP4_StcoAtom();
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_Cardinal GetChunkCount()
- {
- return m_EntryCount;
- }
- AP4_UI32* GetChunkOffsets()
- {
- return m_Entries;
- }
+ AP4_Cardinal GetChunkCount() { return m_EntryCount; }
+ AP4_UI32* GetChunkOffsets() { return m_Entries; }
AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_UI32& chunk_offset);
AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_UI32 chunk_offset);
AP4_Result AdjustChunkOffsets(int delta);
-
+
private:
// methods
- AP4_StcoAtom(AP4_UI32 size,
+ AP4_StcoAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.cpp
index f3a3f77d2..f93422416 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.cpp
@@ -46,24 +46,22 @@ AP4_String::AP4_String() : m_Chars(&EmptyString), m_Length(0) {}
/*----------------------------------------------------------------------
| AP4_String::AP4_String
+---------------------------------------------------------------------*/
-AP4_String::AP4_String(const char* s)
-{
- if(s == NULL)
- {
+AP4_String::AP4_String(const char* s) {
+ if (s == NULL) {
m_Chars = &EmptyString;
m_Length = 0;
return;
}
m_Length = (AP4_Size)AP4_StringLength(s);
m_Chars = new char[m_Length+1];
- AP4_CopyMemory(m_Chars, s, m_Length + 1);
+ AP4_CopyMemory(m_Chars, s, m_Length+1);
}
/*----------------------------------------------------------------------
| AP4_String::AP4_String
+---------------------------------------------------------------------*/
AP4_String::AP4_String(const char* s, AP4_Size size) :
- m_Chars(new char[size+1]),
+ m_Chars(new char[size+1]),
m_Length(size)
{
m_Chars[size] = 0;
@@ -73,29 +71,27 @@ AP4_String::AP4_String(const char* s, AP4_Size size) :
/*----------------------------------------------------------------------
| AP4_String::AP4_String
+---------------------------------------------------------------------*/
-AP4_String::AP4_String(const AP4_String& s)
-{
+AP4_String::AP4_String(const AP4_String& s) {
m_Length = s.m_Length;
m_Chars = new char[m_Length+1];
- AP4_CopyMemory(m_Chars, s.m_Chars, m_Length + 1);
+ AP4_CopyMemory(m_Chars, s.m_Chars, m_Length+1);
}
/*----------------------------------------------------------------------
| AP4_String::AP4_String
+---------------------------------------------------------------------*/
-AP4_String::AP4_String(AP4_Size size)
-{
+AP4_String::AP4_String(AP4_Size size) {
m_Length = size;
m_Chars = new char[m_Length+1];
- for(unsigned int i = 0; i < size + 1; i++) m_Chars[i] = 0;
+ for (unsigned int i=0; i<size+1; i++) m_Chars[i] = 0;
}
/*----------------------------------------------------------------------
| AP4_String::~AP4_String
+---------------------------------------------------------------------*/
-AP4_String::~AP4_String()
+AP4_String::~AP4_String()
{
- if(m_Chars != &EmptyString) delete[] m_Chars;
+ if (m_Chars != &EmptyString) delete[] m_Chars;
}
/*----------------------------------------------------------------------
@@ -104,11 +100,11 @@ AP4_String::~AP4_String()
const AP4_String&
AP4_String::operator=(const AP4_String& s)
{
- if(&s == this) return s;
- if(m_Chars != &EmptyString) delete[] m_Chars;
+ if (&s == this) return s;
+ if (m_Chars != &EmptyString) delete[] m_Chars;
m_Length = s.m_Length;
m_Chars = new char[m_Length+1];
- AP4_CopyMemory(m_Chars, s.m_Chars, m_Length + 1);
+ AP4_CopyMemory(m_Chars, s.m_Chars, m_Length+1);
return *this;
}
@@ -119,14 +115,11 @@ AP4_String::operator=(const AP4_String& s)
const AP4_String&
AP4_String::operator=(const char* s)
{
- if(s == NULL)
- {
- if(m_Chars != &EmptyString) delete[] m_Chars;
+ if (s == NULL) {
+ if (m_Chars != &EmptyString) delete[] m_Chars;
m_Chars = &EmptyString;
m_Length = 0;
- }
- else
- {
+ } else {
Assign(s, (AP4_Size)AP4_StringLength(s));
}
@@ -139,10 +132,9 @@ AP4_String::operator=(const char* s)
bool
AP4_String::operator==(const AP4_String& s) const
{
- if(m_Length != s.m_Length) return false;
- for(unsigned int i = 0; i < m_Length; i++)
- {
- if(m_Chars[i] != s.m_Chars[i]) return false;
+ if (m_Length != s.m_Length) return false;
+ for (unsigned int i=0; i<m_Length; i++) {
+ if (m_Chars[i] != s.m_Chars[i]) return false;
}
return true;
}
@@ -155,10 +147,9 @@ bool
AP4_String::operator==(const char* s) const
{
AP4_Size s_length = (AP4_Size)AP4_StringLength(s);
- if(m_Length != s_length) return false;
- for(unsigned int i = 0; i < s_length; i++)
- {
- if(m_Chars[i] != s[i]) return false;
+ if (m_Length != s_length) return false;
+ for (unsigned int i=0; i<s_length; i++) {
+ if (m_Chars[i] != s[i]) return false;
}
return true;
}
@@ -169,7 +160,7 @@ AP4_String::operator==(const char* s) const
void
AP4_String::Assign(const char* s, AP4_Size size)
{
- if(m_Chars != &EmptyString) delete[] m_Chars;
+ if (m_Chars != &EmptyString) delete[] m_Chars;
m_Length = size;
m_Chars = new char[m_Length+1];
AP4_CopyMemory(m_Chars, s, m_Length);
@@ -183,9 +174,8 @@ int
AP4_String::Find(char c, unsigned int start) const
{
const char* chars = GetChars();
- for(unsigned int i = start; i < m_Length; i++)
- {
- if(chars[i] == c) return i;
+ for (unsigned int i=start; i<m_Length; i++) {
+ if (chars[i] == c) return i;
}
return -1;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.h
index 0461075bd..f1d81ef06 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4String.h
@@ -54,37 +54,21 @@ public:
// operators
const AP4_String& operator=(const AP4_String& s);
const AP4_String& operator=(const char* s);
- char operator[](unsigned int index) const
- {
+ char operator[](unsigned int index) const {
return m_Chars[index];
}
bool operator==(const AP4_String& s) const;
- bool operator!=(const AP4_String& s) const
- {
- return !(*this == s);
- }
+ bool operator!=(const AP4_String& s) const { return !(*this == s); }
bool operator==(const char* s) const;
- bool operator!=(const char* s) const
- {
- return !(*this == s);
- }
+ bool operator!=(const char* s) const { return !(*this == s); }
// methods
- AP4_Size GetLength() const
- {
- return m_Length;
- }
- const char* GetChars() const
- {
- return m_Chars;
- }
- char* UseChars()
- {
- return m_Chars;
- }
+ AP4_Size GetLength() const { return m_Length; }
+ const char* GetChars() const { return m_Chars; }
+ char* UseChars() { return m_Chars; }
void Assign(const char* chars, AP4_Size size);
int Find(char c, unsigned int start = 0) const;
-
+
private:
// class members
static char EmptyString;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.cpp
index ad4e10c52..7e108f285 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.cpp
@@ -1,6 +1,6 @@
-/*****************************************************************
+ /*****************************************************************
|
-| AP4 - stsc Atoms
+| AP4 - stsc Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -24,7 +24,7 @@
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
-****************************************************************/
+ ****************************************************************/
/*----------------------------------------------------------------------
| includes
@@ -46,8 +46,8 @@ AP4_StscAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_StscAtom(size, version, flags, stream);
}
@@ -55,7 +55,7 @@ AP4_StscAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_StscAtom::AP4_StscAtom
+---------------------------------------------------------------------*/
AP4_StscAtom::AP4_StscAtom() :
- AP4_Atom(AP4_ATOM_TYPE_STSC, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_STSC, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0),
m_CachedChunkGroup(0)
{
}
@@ -63,7 +63,7 @@ AP4_StscAtom::AP4_StscAtom() :
/*----------------------------------------------------------------------
| AP4_StscAtom::AP4_StscAtom
+---------------------------------------------------------------------*/
-AP4_StscAtom::AP4_StscAtom(AP4_UI32 size,
+AP4_StscAtom::AP4_StscAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -75,21 +75,18 @@ AP4_StscAtom::AP4_StscAtom(AP4_UI32 size,
stream.ReadUI32(entry_count);
m_Entries.SetItemCount(entry_count);
unsigned char* buffer = new unsigned char[entry_count*12];
- AP4_Result result = stream.Read(buffer, entry_count * 12);
- if(AP4_FAILED(result))
- {
+ AP4_Result result = stream.Read(buffer, entry_count*12);
+ if (AP4_FAILED(result)) {
delete[] buffer;
return;
}
- for(unsigned int i = 0; i < entry_count; i++)
- {
+ for (unsigned int i=0; i<entry_count; i++) {
AP4_UI32 first_chunk = AP4_BytesToUInt32BE(&buffer[i*12 ]);
AP4_UI32 samples_per_chunk = AP4_BytesToUInt32BE(&buffer[i*12+4]);
AP4_UI32 sample_description_index = AP4_BytesToUInt32BE(&buffer[i*12+8]);
- if(i)
- {
- AP4_Ordinal prev = i - 1;
- m_Entries[prev].m_ChunkCount = first_chunk - m_Entries[prev].m_FirstChunk;
+ if (i) {
+ AP4_Ordinal prev = i-1;
+ m_Entries[prev].m_ChunkCount = first_chunk-m_Entries[prev].m_FirstChunk;
first_sample += m_Entries[prev].m_ChunkCount * m_Entries[prev].m_SamplesPerChunk;
}
m_Entries[i].m_ChunkCount = 0; // not known yet
@@ -114,14 +111,13 @@ AP4_StscAtom::WriteFields(AP4_ByteStream& stream)
result = stream.WriteUI32(entry_count);
// entries
- for(AP4_Ordinal i = 0; i < entry_count; i++)
- {
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
stream.WriteUI32(m_Entries[i].m_FirstChunk);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
stream.WriteUI32(m_Entries[i].m_SamplesPerChunk);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
stream.WriteUI32(m_Entries[i].m_SampleDescriptionIndex);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return result;
@@ -130,7 +126,7 @@ AP4_StscAtom::WriteFields(AP4_ByteStream& stream)
/*----------------------------------------------------------------------
| AP4_StscAtom::AddEntry
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_StscAtom::AddEntry(AP4_Cardinal chunk_count,
AP4_Cardinal samples_per_chunk,
AP4_Ordinal sample_description_index)
@@ -138,18 +134,15 @@ AP4_StscAtom::AddEntry(AP4_Cardinal chunk_count,
AP4_Ordinal first_chunk;
AP4_Ordinal first_sample;
AP4_Cardinal entry_count = m_Entries.ItemCount();
- if(entry_count == 0)
- {
+ if (entry_count == 0) {
// first entry
first_chunk = 1;
first_sample = 1;
- }
- else
- {
- first_chunk = m_Entries[entry_count-1].m_FirstChunk +
+ } else {
+ first_chunk = m_Entries[entry_count-1].m_FirstChunk+
m_Entries[entry_count-1].m_ChunkCount;
- first_sample = m_Entries[entry_count-1].m_FirstSample +
- m_Entries[entry_count-1].m_ChunkCount *
+ first_sample = m_Entries[entry_count-1].m_FirstSample+
+ m_Entries[entry_count-1].m_ChunkCount*
m_Entries[entry_count-1].m_SamplesPerChunk;
}
m_Entries.Append(AP4_StscTableEntry(first_chunk, first_sample, chunk_count, samples_per_chunk, sample_description_index));
@@ -175,35 +168,26 @@ AP4_StscAtom::GetChunkForSample(AP4_Ordinal sample,
// decide whether to start the search from the cached index
// or from the start
AP4_Ordinal group;
- if(m_CachedChunkGroup < m_Entries.ItemCount() &&
- m_Entries[m_CachedChunkGroup].m_FirstSample <= sample)
- {
+ if (m_CachedChunkGroup < m_Entries.ItemCount() &&
+ m_Entries[m_CachedChunkGroup].m_FirstSample <= sample) {
group = m_CachedChunkGroup;
- }
- else
- {
+ } else {
group = 0;
}
// find which group of chunk contains this one
- while(group < m_Entries.ItemCount())
- {
- AP4_Cardinal sample_count =
- m_Entries[group].m_ChunkCount * m_Entries[group].m_SamplesPerChunk;
- if(sample_count == 0)
- {
+ while (group < m_Entries.ItemCount()) {
+ AP4_Cardinal sample_count =
+ m_Entries[group].m_ChunkCount*m_Entries[group].m_SamplesPerChunk;
+ if (sample_count == 0) {
// unlimited samples in this group (last group)
- if(m_Entries[group].m_FirstSample > sample)
- {
+ if (m_Entries[group].m_FirstSample > sample) {
// something is wrong
return AP4_ERROR_INVALID_FORMAT;
}
- }
- else
- {
+ } else {
// normal group
- if(m_Entries[group].m_FirstSample + sample_count <= sample)
- {
+ if (m_Entries[group].m_FirstSample + sample_count <= sample) {
// the sample is not in this group
group++;
continue;
@@ -211,18 +195,17 @@ AP4_StscAtom::GetChunkForSample(AP4_Ordinal sample,
}
// the sample is in this group
- if(m_Entries[group].m_SamplesPerChunk == 0)
- {
+ if (m_Entries[group].m_SamplesPerChunk == 0) {
// something is wrong
return AP4_ERROR_INVALID_FORMAT;
}
- unsigned int chunk_offset =
- ((sample - m_Entries[group].m_FirstSample) /
- m_Entries[group].m_SamplesPerChunk);
+ unsigned int chunk_offset =
+ ((sample-m_Entries[group].m_FirstSample) /
+ m_Entries[group].m_SamplesPerChunk);
chunk = m_Entries[group].m_FirstChunk + chunk_offset;
skip = sample -
- (m_Entries[group].m_FirstSample +
- m_Entries[group].m_SamplesPerChunk * chunk_offset);
+ (m_Entries[group].m_FirstSample +
+ m_Entries[group].m_SamplesPerChunk*chunk_offset);
sample_description_index = m_Entries[group].m_SampleDescriptionIndex;
// cache the result (to accelerate finding the right group
@@ -248,24 +231,22 @@ AP4_StscAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("entry_count", m_Entries.ItemCount());
// dump table entries
- if(inspector.GetVerbosity() >= 1)
- {
+ if (inspector.GetVerbosity() >= 1) {
char header[32];
char value[256];
- for(unsigned int i = 0; i < m_Entries.ItemCount(); i++)
- {
- AP4_FormatString(header, sizeof(header), "entry %8d", i);
- AP4_FormatString(value, sizeof(value),
- "first_chunk=%d, first_sample*=%d, chunk_count*=%d, samples_per_chunk=%d, sample_desc_index=%d",
- m_Entries[i].m_FirstChunk,
- m_Entries[i].m_FirstSample,
- m_Entries[i].m_ChunkCount,
- m_Entries[i].m_SamplesPerChunk,
- m_Entries[i].m_SampleDescriptionIndex);
+ for (unsigned int i=0; i<m_Entries.ItemCount(); i++) {
+ AP4_FormatString(header, sizeof(header), "entry %8d", i);
+ AP4_FormatString(value, sizeof(value),
+ "first_chunk=%d, first_sample*=%d, chunk_count*=%d, samples_per_chunk=%d, sample_desc_index=%d",
+ m_Entries[i].m_FirstChunk,
+ m_Entries[i].m_FirstSample,
+ m_Entries[i].m_ChunkCount,
+ m_Entries[i].m_SamplesPerChunk,
+ m_Entries[i].m_SampleDescriptionIndex);
inspector.AddField(header, value);
}
}
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.h
index c0acf224a..23def43b7 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StscAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stsc Atoms
+| AP4 - stsc Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -39,14 +39,13 @@
/*----------------------------------------------------------------------
| AP4_StscTableEntry
+---------------------------------------------------------------------*/
-class AP4_StscTableEntry
-{
-public:
- AP4_StscTableEntry() :
- m_FirstChunk(0),
+class AP4_StscTableEntry {
+ public:
+ AP4_StscTableEntry() :
+ m_FirstChunk(0),
m_FirstSample(0),
m_ChunkCount(0),
- m_SamplesPerChunk(0),
+ m_SamplesPerChunk(0),
m_SampleDescriptionIndex(0) {}
AP4_StscTableEntry(AP4_Ordinal first_chunk,
AP4_Ordinal first_sample,
@@ -81,7 +80,7 @@ class AP4_StscAtom : public AP4_Atom
{
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_StscAtom, AP4_Atom)
-
+
// class methods
static AP4_StscAtom* Create(AP4_Size size, AP4_ByteStream& stream);
@@ -97,14 +96,14 @@ public:
AP4_Ordinal sample_description_index);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- // ==> Start patch MPC
- // FIXME
- friend class AP4_AtomSampleTable;
- // <== End patch MPC
+ // ==> Start patch MPC
+ // FIXME
+ friend class AP4_AtomSampleTable;
+ // <== End patch MPC
private:
// methods
- AP4_StscAtom(AP4_UI32 size,
+ AP4_StscAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.cpp
index 766b1ca7a..3ce86da1b 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stsd Atoms
+| AP4 - stsd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,14 +45,14 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_StsdAtom)
| AP4_StsdAtom::Create
+---------------------------------------------------------------------*/
AP4_StsdAtom*
-AP4_StsdAtom::Create(AP4_Size size,
- AP4_ByteStream& stream,
+AP4_StsdAtom::Create(AP4_Size size,
+ AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_StsdAtom(size, version, flags, stream, atom_factory);
}
@@ -65,8 +65,7 @@ AP4_StsdAtom::AP4_StsdAtom(AP4_SampleTable* sample_table) :
m_Size32 += 4;
AP4_Cardinal sample_description_count = sample_table->GetSampleDescriptionCount();
m_SampleDescriptions.EnsureCapacity(sample_description_count);
- for(AP4_Ordinal i = 0; i < sample_description_count; i++)
- {
+ for (AP4_Ordinal i=0; i<sample_description_count; i++) {
// clear the cache entry
m_SampleDescriptions.Append(NULL);
@@ -98,14 +97,12 @@ AP4_StsdAtom::AP4_StsdAtom(AP4_UI32 size,
atom_factory.PushContext(m_Type);
// read all entries
- AP4_LargeSize bytes_available = size - AP4_FULL_ATOM_HEADER_SIZE - 4;
- for(unsigned int i = 0; i < entry_count; i++)
- {
+ AP4_LargeSize bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ for (unsigned int i=0; i<entry_count; i++) {
AP4_Atom* atom;
- if(AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
- bytes_available,
- atom)))
- {
+ if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom))) {
atom->SetParent(this);
m_Children.Add(atom);
}
@@ -116,8 +113,7 @@ AP4_StsdAtom::AP4_StsdAtom(AP4_UI32 size,
// initialize the sample description cache
m_SampleDescriptions.EnsureCapacity(m_Children.ItemCount());
- for(AP4_Ordinal i = 0; i < m_Children.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<m_Children.ItemCount(); i++) {
m_SampleDescriptions.Append(NULL);
}
}
@@ -127,8 +123,7 @@ AP4_StsdAtom::AP4_StsdAtom(AP4_UI32 size,
+---------------------------------------------------------------------*/
AP4_StsdAtom::~AP4_StsdAtom()
{
- for(AP4_Ordinal i = 0; i < m_SampleDescriptions.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<m_SampleDescriptions.ItemCount(); i++) {
delete m_SampleDescriptions[i];
}
}
@@ -143,7 +138,7 @@ AP4_StsdAtom::WriteFields(AP4_ByteStream& stream)
// entry count
result = stream.WriteUI32(m_Children.ItemCount());
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// entries
return m_Children.Apply(AP4_AtomListWriter(stream));
@@ -156,12 +151,12 @@ void
AP4_StsdAtom::OnChildChanged(AP4_Atom*)
{
// remcompute our size
- AP4_UI64 size = GetHeaderSize() + 4;
+ AP4_UI64 size = GetHeaderSize()+4;
m_Children.Apply(AP4_AtomSizeAdder(size));
m_Size32 = (AP4_UI32)size;
// update our parent
- if(m_Parent) m_Parent->OnChildChanged(this);
+ if (m_Parent) m_Parent->OnChildChanged(this);
}
/*----------------------------------------------------------------------
@@ -171,21 +166,18 @@ AP4_SampleDescription*
AP4_StsdAtom::GetSampleDescription(AP4_Ordinal index)
{
// check index
- if(index >= m_Children.ItemCount()) return NULL;
+ if (index >= m_Children.ItemCount()) return NULL;
// return the description if we already have it in the internal table
- if(m_SampleDescriptions[index]) return m_SampleDescriptions[index];
+ if (m_SampleDescriptions[index]) return m_SampleDescriptions[index];
// create and cache a sample description for this entry
AP4_Atom* entry;
m_Children.Get(index, entry);
AP4_SampleEntry* sample_entry = AP4_DYNAMIC_CAST(AP4_SampleEntry, entry);
- if(sample_entry == NULL)
- {
+ if (sample_entry == NULL) {
m_SampleDescriptions[index] = new AP4_UnknownSampleDescription(entry);
- }
- else
- {
+ } else {
m_SampleDescriptions[index] = sample_entry->ToSampleDescription();
}
return m_SampleDescriptions[index];
@@ -198,7 +190,7 @@ AP4_SampleEntry*
AP4_StsdAtom::GetSampleEntry(AP4_Ordinal index)
{
// check index
- if(index >= m_Children.ItemCount()) return NULL;
+ if (index >= m_Children.ItemCount()) return NULL;
// return the sample entry
AP4_Atom* entry;
@@ -222,7 +214,7 @@ AP4_Result
AP4_StsdAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry-count", m_Children.ItemCount());
-
+
// inspect children
m_Children.Apply(AP4_AtomListInspector(inspector));
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.h
index b47948d25..8a5013a72 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StsdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stsd Atoms
+| AP4 - stsd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.cpp
index 76a348249..23d06f82d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stss Atoms
+| AP4 - stss Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_StssAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_StssAtom(size, version, flags, stream);
}
@@ -55,14 +55,14 @@ AP4_StssAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_StssAtom::AP4_StssAtom
+---------------------------------------------------------------------*/
AP4_StssAtom::AP4_StssAtom() :
- AP4_Atom(AP4_ATOM_TYPE_STSS, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0)
+ AP4_Atom(AP4_ATOM_TYPE_STSS, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0)
{
}
/*----------------------------------------------------------------------
| AP4_StssAtom::AP4_StssAtom
+---------------------------------------------------------------------*/
-AP4_StssAtom::AP4_StssAtom(AP4_UI32 size,
+AP4_StssAtom::AP4_StssAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -71,11 +71,9 @@ AP4_StssAtom::AP4_StssAtom(AP4_UI32 size,
{
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
- while(entry_count--)
- {
+ while (entry_count--) {
AP4_UI32 entry_sample_index;
- if(stream.ReadUI32(entry_sample_index) == AP4_SUCCESS)
- {
+ if (stream.ReadUI32(entry_sample_index) == AP4_SUCCESS) {
m_Entries.Append(entry_sample_index);
}
}
@@ -92,13 +90,12 @@ AP4_StssAtom::WriteFields(AP4_ByteStream& stream)
// entry count
AP4_Cardinal entry_count = m_Entries.ItemCount();
result = stream.WriteUI32(entry_count);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// entries
- for(AP4_Ordinal i = 0; i < entry_count; i++)
- {
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
result = stream.WriteUI32(m_Entries[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return result;
@@ -112,7 +109,7 @@ AP4_StssAtom::AddEntry(AP4_UI32 sample)
{
m_Entries.Append(sample);
m_Size32 += 4;
-
+
return AP4_SUCCESS;
}
@@ -125,24 +122,21 @@ AP4_StssAtom::IsSampleSync(AP4_Ordinal sample)
unsigned int entry_index = 0;
// check bounds
- if(sample == 0 || m_Entries.ItemCount() == 0) return false;
+ if (sample == 0 || m_Entries.ItemCount() == 0) return false;
// see if we can start from the cached index
- if(m_Entries[m_LookupCache] <= sample)
- {
+ if (m_Entries[m_LookupCache] <= sample) {
entry_index = m_LookupCache;
}
// do a linear search
- while(entry_index < m_Entries.ItemCount() &&
- m_Entries[entry_index] <= sample)
- {
- if(m_Entries[entry_index] == sample)
- {
+ while (entry_index < m_Entries.ItemCount() &&
+ m_Entries[entry_index] <= sample) {
+ if (m_Entries[entry_index] == sample) {
m_LookupCache = entry_index;
return true;
}
- entry_index++;
+ entry_index++;
}
return false;
@@ -158,4 +152,4 @@ AP4_StssAtom::InspectFields(AP4_AtomInspector& inspector)
return AP4_SUCCESS;
}
-
+
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.h
index ccc4bf795..0384cb6a3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StssAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stss Atoms
+| AP4 - stss Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -48,13 +48,10 @@ public:
// constructor
AP4_StssAtom();
-
+
// methods
// methods
- const AP4_Array<AP4_UI32>& GetEntries()
- {
- return m_Entries;
- }
+ const AP4_Array<AP4_UI32>& GetEntries() { return m_Entries; }
AP4_Result AddEntry(AP4_UI32 sample);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual bool IsSampleSync(AP4_Ordinal sample);
@@ -62,11 +59,11 @@ public:
private:
// methods
- AP4_StssAtom(AP4_UI32 size,
+ AP4_StssAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
-
+
// members
AP4_Array<AP4_UI32> m_Entries;
AP4_Ordinal m_LookupCache;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.cpp
index 19f116346..97dfc9f91 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stsz Atoms
+| AP4 - stsz Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_StszAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_StszAtom(size, version, flags, stream);
}
@@ -55,7 +55,7 @@ AP4_StszAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_StszAtom::AP4_StszAtom
+---------------------------------------------------------------------*/
AP4_StszAtom::AP4_StszAtom() :
- AP4_Atom(AP4_ATOM_TYPE_STSZ, AP4_FULL_ATOM_HEADER_SIZE + 8, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, AP4_FULL_ATOM_HEADER_SIZE+8, 0, 0),
m_SampleSize(0),
m_SampleCount(0)
{
@@ -64,7 +64,7 @@ AP4_StszAtom::AP4_StszAtom() :
/*----------------------------------------------------------------------
| AP4_StszAtom::AP4_StszAtom
+---------------------------------------------------------------------*/
-AP4_StszAtom::AP4_StszAtom(AP4_UI32 size,
+AP4_StszAtom::AP4_StszAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -72,19 +72,16 @@ AP4_StszAtom::AP4_StszAtom(AP4_UI32 size,
{
stream.ReadUI32(m_SampleSize);
stream.ReadUI32(m_SampleCount);
- if(m_SampleSize == 0) // means that the samples have different sizes
- {
+ if (m_SampleSize == 0) { // means that the samples have different sizes
unsigned long sample_count = m_SampleCount;
m_Entries.SetItemCount(sample_count);
unsigned char* buffer = new unsigned char[sample_count*4];
- AP4_Result result = stream.Read(buffer, sample_count * 4);
- if(AP4_FAILED(result))
- {
+ AP4_Result result = stream.Read(buffer, sample_count*4);
+ if (AP4_FAILED(result)) {
delete[] buffer;
return;
}
- for(unsigned int i = 0; i < sample_count; i++)
- {
+ for (unsigned int i=0; i<sample_count; i++) {
m_Entries[i] = AP4_BytesToUInt32BE(&buffer[i*4]);
}
delete[] buffer;
@@ -101,19 +98,17 @@ AP4_StszAtom::WriteFields(AP4_ByteStream& stream)
// sample size
result = stream.WriteUI32(m_SampleSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// sample count
result = stream.WriteUI32(m_SampleCount);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// entries if needed (the samples have different sizes)
- if(m_SampleSize == 0)
- {
- for(AP4_UI32 i = 0; i < m_SampleCount; i++)
- {
+ if (m_SampleSize == 0) {
+ for (AP4_UI32 i=0; i<m_SampleCount; i++) {
result = stream.WriteUI32(m_Entries[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
}
@@ -136,20 +131,14 @@ AP4_Result
AP4_StszAtom::GetSampleSize(AP4_Ordinal sample, AP4_Size& sample_size)
{
// check the sample index
- if(sample > m_SampleCount || sample == 0)
- {
+ if (sample > m_SampleCount || sample == 0) {
sample_size = 0;
return AP4_ERROR_OUT_OF_RANGE;
- }
- else
- {
+ } else {
// find the size
- if(m_SampleSize != 0) // constant size
- {
+ if (m_SampleSize != 0) { // constant size
sample_size = m_SampleSize;
- }
- else
- {
+ } else {
sample_size = m_Entries[sample - 1];
}
return AP4_SUCCESS;
@@ -163,33 +152,23 @@ AP4_Result
AP4_StszAtom::SetSampleSize(AP4_Ordinal sample, AP4_Size sample_size)
{
// check the sample index
- if(sample > m_SampleCount || sample == 0)
- {
+ if (sample > m_SampleCount || sample == 0) {
return AP4_ERROR_OUT_OF_RANGE;
- }
- else
- {
- if(m_Entries.ItemCount() == 0)
- {
+ } else {
+ if (m_Entries.ItemCount() == 0) {
// all samples must have the same size
- if(sample_size != m_SampleSize)
- {
+ if (sample_size != m_SampleSize) {
// not the same
- if(sample == 1)
- {
+ if (sample == 1) {
// if this is the first sample, update the global size
m_SampleSize = sample_size;
return AP4_SUCCESS;
- }
- else
- {
+ } else {
// can't have different sizes
return AP4_ERROR_INVALID_PARAMETERS;
}
}
- }
- else
- {
+ } else {
// each sample has a different size
m_Entries[sample - 1] = sample_size;
}
@@ -201,7 +180,7 @@ AP4_StszAtom::SetSampleSize(AP4_Ordinal sample, AP4_Size sample_size)
/*----------------------------------------------------------------------
| AP4_StszAtom::AddEntry
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_StszAtom::AddEntry(AP4_UI32 size)
{
m_Entries.Append(size);
@@ -220,11 +199,9 @@ AP4_StszAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("sample_size", m_SampleSize);
inspector.AddField("sample_count", m_Entries.ItemCount());
- if(inspector.GetVerbosity() >= 2)
- {
+ if (inspector.GetVerbosity() >= 2) {
char header[32];
- for(AP4_Ordinal i = 0; i < m_Entries.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<m_Entries.ItemCount(); i++) {
AP4_FormatString(header, sizeof(header), "entry %8d", i);
inspector.AddField(header, m_Entries[i]);
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.h
index 70d480c46..70bfa9309 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4StszAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stsz Atoms
+| AP4 - stsz Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -51,7 +51,7 @@ public:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_UI32 GetSampleCount();
- virtual AP4_Result GetSampleSize(AP4_Ordinal sample,
+ virtual AP4_Result GetSampleSize(AP4_Ordinal sample,
AP4_Size& sample_size);
/**
* Set the sample size.
@@ -63,18 +63,18 @@ public:
* the global size, and calling with sample>1 will check that
* the value of sample_size is the same as the global size m_SampleSize.
*/
- virtual AP4_Result SetSampleSize(AP4_Ordinal sample,
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample,
AP4_Size sample_size);
virtual AP4_Result AddEntry(AP4_UI32 size);
- // ==> Start patch MPC
- // FIXME
- friend class AP4_AtomSampleTable;
- // <== End patch MPC
+ // ==> Start patch MPC
+ // FIXME
+ friend class AP4_AtomSampleTable;
+ // <== End patch MPC
private:
// methods
- AP4_StszAtom(AP4_UI32 size,
+ AP4_StszAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.cpp
index 4db29e8e6..15a8d8418 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stts Atoms
+| AP4 - stts Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_SttsAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_SttsAtom(size, version, flags, stream);
}
@@ -55,7 +55,7 @@ AP4_SttsAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_SttsAtom::AP4_SttsAtom
+---------------------------------------------------------------------*/
AP4_SttsAtom::AP4_SttsAtom() :
- AP4_Atom(AP4_ATOM_TYPE_STTS, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0)
+ AP4_Atom(AP4_ATOM_TYPE_STTS, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0)
{
m_LookupCache.entry_index = 0;
m_LookupCache.sample = 0;
@@ -65,7 +65,7 @@ AP4_SttsAtom::AP4_SttsAtom() :
/*----------------------------------------------------------------------
| AP4_SttsAtom::AP4_SttsAtom
+---------------------------------------------------------------------*/
-AP4_SttsAtom::AP4_SttsAtom(AP4_UI32 size,
+AP4_SttsAtom::AP4_SttsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -77,13 +77,11 @@ AP4_SttsAtom::AP4_SttsAtom(AP4_UI32 size,
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
- while(entry_count--)
- {
+ while (entry_count--) {
AP4_UI32 sample_count;
AP4_UI32 sample_duration;
- if(stream.ReadUI32(sample_count) == AP4_SUCCESS &&
- stream.ReadUI32(sample_duration) == AP4_SUCCESS)
- {
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_duration) == AP4_SUCCESS) {
m_Entries.Append(AP4_SttsTableEntry(sample_count,
sample_duration));
}
@@ -98,17 +96,16 @@ AP4_SttsAtom::GetDts(AP4_Ordinal sample, AP4_UI64& dts, AP4_UI32* duration)
{
// default value
dts = 0;
- if(duration) *duration = 0;
-
+ if (duration) *duration = 0;
+
// sample indexes start at 1
- if(sample == 0) return AP4_ERROR_OUT_OF_RANGE;
+ if (sample == 0) return AP4_ERROR_OUT_OF_RANGE;
// check the lookup cache
AP4_Ordinal lookup_start = 0;
AP4_Ordinal sample_start = 0;
AP4_UI64 dts_start = 0;
- if(sample >= m_LookupCache.sample)
- {
+ if (sample >= m_LookupCache.sample) {
// start from the cached entry
lookup_start = m_LookupCache.entry_index;
sample_start = m_LookupCache.sample;
@@ -116,28 +113,26 @@ AP4_SttsAtom::GetDts(AP4_Ordinal sample, AP4_UI64& dts, AP4_UI32* duration)
}
// look from the last known point
- for(AP4_Ordinal i = lookup_start; i < m_Entries.ItemCount(); i++)
- {
+ for (AP4_Ordinal i = lookup_start; i < m_Entries.ItemCount(); i++) {
AP4_SttsTableEntry& entry = m_Entries[i];
// check if we have reached the sample
- if(sample <= sample_start + entry.m_SampleCount)
- {
+ if (sample <= sample_start+entry.m_SampleCount) {
// we are within the sample range for the current entry
- dts = dts_start + (AP4_UI64)(sample - 1 - sample_start) * (AP4_UI64)entry.m_SampleDuration;
- if(duration) *duration = entry.m_SampleDuration;
-
+ dts = dts_start + (AP4_UI64)(sample-1 - sample_start) * (AP4_UI64)entry.m_SampleDuration;
+ if (duration) *duration = entry.m_SampleDuration;
+
// update the lookup cache
m_LookupCache.entry_index = i;
m_LookupCache.sample = sample_start;
m_LookupCache.dts = dts_start;
-
+
return AP4_SUCCESS;
}
-
+
// update the sample and dts bases
sample_start += entry.m_SampleCount;
- dts_start += entry.m_SampleCount * entry.m_SampleDuration;
+ dts_start += entry.m_SampleCount*entry.m_SampleDuration;
}
// sample is greater than the number of samples
@@ -167,18 +162,17 @@ AP4_SttsAtom::WriteFields(AP4_ByteStream& stream)
// write the entry count
AP4_Cardinal entry_count = m_Entries.ItemCount();
result = stream.WriteUI32(entry_count);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the entries
- for(AP4_Ordinal i = 0; i < entry_count; i++)
- {
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
// sample count
result = stream.WriteUI32(m_Entries[i].m_SampleCount);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// time offset
result = stream.WriteUI32(m_Entries[i].m_SampleDuration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
@@ -188,24 +182,22 @@ AP4_SttsAtom::WriteFields(AP4_ByteStream& stream)
| AP4_SttsAtom::GetSampleIndexForTimeStamp
+---------------------------------------------------------------------*/
AP4_Result
-AP4_SttsAtom::GetSampleIndexForTimeStamp(AP4_UI64 ts,
- AP4_Ordinal& sample_index)
+AP4_SttsAtom::GetSampleIndexForTimeStamp(AP4_UI64 ts,
+ AP4_Ordinal& sample_index)
{
// init
AP4_Cardinal entry_count = m_Entries.ItemCount();
AP4_UI64 accumulated = 0;
sample_index = 0;
-
- for(AP4_Ordinal i = 0; i < entry_count; i++)
- {
- AP4_UI64 next_accumulated =
+
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ AP4_UI64 next_accumulated =
accumulated +
- (AP4_UI64)m_Entries[i].m_SampleCount *
+ (AP4_UI64)m_Entries[i].m_SampleCount *
(AP4_UI64)m_Entries[i].m_SampleDuration;
-
+
// check if the ts is in the range of this entry
- if(ts < next_accumulated)
- {
+ if (ts < next_accumulated) {
sample_index += (AP4_UI32)((ts - accumulated) / m_Entries[i].m_SampleDuration);
return AP4_SUCCESS;
}
@@ -227,17 +219,15 @@ AP4_SttsAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry_count", m_Entries.ItemCount());
- if(inspector.GetVerbosity() >= 1)
- {
+ if (inspector.GetVerbosity() >= 1) {
char header[32];
char value[256];
- for(AP4_Ordinal i = 0; i < m_Entries.ItemCount(); i++)
- {
+ for (AP4_Ordinal i=0; i<m_Entries.ItemCount(); i++) {
AP4_FormatString(header, sizeof(header), "entry %8d", i);
- AP4_FormatString(value, sizeof(value),
- "sample_count=%d, sample_duration=%d",
- m_Entries[i].m_SampleCount,
- m_Entries[i].m_SampleDuration);
+ AP4_FormatString(value, sizeof(value),
+ "sample_count=%d, sample_duration=%d",
+ m_Entries[i].m_SampleCount,
+ m_Entries[i].m_SampleDuration);
inspector.AddField(header, value);
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.h
index 4f9784c85..def7acc37 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SttsAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - stts Atoms
+| AP4 - stts Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -38,11 +38,10 @@
/*----------------------------------------------------------------------
| AP4_SttsTableEntry
+---------------------------------------------------------------------*/
-class AP4_SttsTableEntry
-{
-public:
- AP4_SttsTableEntry() :
- m_SampleCount(0),
+class AP4_SttsTableEntry {
+ public:
+ AP4_SttsTableEntry() :
+ m_SampleCount(0),
m_SampleDuration(0) {}
AP4_SttsTableEntry(AP4_UI32 sample_count,
AP4_UI32 sample_duration) :
@@ -69,26 +68,25 @@ public:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result GetDts(AP4_Ordinal sample, AP4_UI64& dts, AP4_UI32* duration = NULL);
virtual AP4_Result AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration);
- virtual AP4_Result GetSampleIndexForTimeStamp(AP4_UI64 ts,
- AP4_Ordinal& sample_index);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_UI64 ts,
+ AP4_Ordinal& sample_index);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- // ==> Start patch MPC
- // FIXME
- friend class AP4_AtomSampleTable;
- // <== End patch MPC
+ // ==> Start patch MPC
+ // FIXME
+ friend class AP4_AtomSampleTable;
+ // <== End patch MPC
private:
// methods
- AP4_SttsAtom(AP4_UI32 size,
+ AP4_SttsAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
// members
AP4_Array<AP4_SttsTableEntry> m_Entries;
- struct
- {
+ struct {
AP4_Ordinal entry_index;
AP4_Ordinal sample;
AP4_UI64 dts;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
index 492c045c2..b2926e4ac 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
@@ -38,7 +38,7 @@
| AP4_SyntheticSampleTable::AP4_SyntheticSampleTable()
+---------------------------------------------------------------------*/
AP4_SyntheticSampleTable::AP4_SyntheticSampleTable(AP4_Cardinal chunk_size) :
- m_ChunkSize(chunk_size ? chunk_size : AP4_SYNTHETIC_SAMPLE_TABLE_DEFAULT_CHUNK_SIZE)
+ m_ChunkSize(chunk_size?chunk_size:AP4_SYNTHETIC_SAMPLE_TABLE_DEFAULT_CHUNK_SIZE)
{
m_LookupCache.m_Sample = 0;
m_LookupCache.m_Chunk = 0;
@@ -58,7 +58,7 @@ AP4_SyntheticSampleTable::~AP4_SyntheticSampleTable()
AP4_Result
AP4_SyntheticSampleTable::GetSample(AP4_Ordinal sample_index, AP4_Sample& sample)
{
- if(sample_index >= m_Samples.ItemCount()) return AP4_ERROR_OUT_OF_RANGE;
+ if (sample_index >= m_Samples.ItemCount()) return AP4_ERROR_OUT_OF_RANGE;
sample = m_Samples[sample_index];
return AP4_SUCCESS;
@@ -67,7 +67,7 @@ AP4_SyntheticSampleTable::GetSample(AP4_Ordinal sample_index, AP4_Sample& sample
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetSampleCount
+---------------------------------------------------------------------*/
-AP4_Cardinal
+AP4_Cardinal
AP4_SyntheticSampleTable::GetSampleCount()
{
return m_Samples.ItemCount();
@@ -76,48 +76,45 @@ AP4_SyntheticSampleTable::GetSampleCount()
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetSampleChunkPosition
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_SyntheticSampleTable::GetSampleChunkPosition(
- AP4_Ordinal sample_index,
+ AP4_Ordinal sample_index,
AP4_Ordinal& chunk_index,
AP4_Ordinal& position_in_chunk)
{
// default values
chunk_index = 0;
position_in_chunk = 0;
-
+
// check parameters
- if(sample_index >= m_Samples.ItemCount()) return AP4_ERROR_OUT_OF_RANGE;
-
- // look for the chunk
+ if (sample_index >= m_Samples.ItemCount()) return AP4_ERROR_OUT_OF_RANGE;
+
+ // look for the chunk
AP4_Ordinal sample_cursor = 0;
AP4_Ordinal chunk_cursor = 0;
- if(sample_index >= m_LookupCache.m_Sample)
- {
+ if (sample_index >= m_LookupCache.m_Sample) {
sample_cursor = m_LookupCache.m_Sample;
chunk_cursor = m_LookupCache.m_Chunk;
}
- for(;
- chunk_cursor < m_SamplesInChunk.ItemCount();
- sample_cursor += m_SamplesInChunk[chunk_cursor++])
- {
- if(sample_cursor + m_SamplesInChunk[chunk_cursor] > sample_index)
- {
+ for (;
+ chunk_cursor < m_SamplesInChunk.ItemCount();
+ sample_cursor += m_SamplesInChunk[chunk_cursor++]) {
+ if (sample_cursor+m_SamplesInChunk[chunk_cursor] > sample_index) {
chunk_index = chunk_cursor;
- position_in_chunk = sample_index - sample_cursor;
+ position_in_chunk = sample_index-sample_cursor;
m_LookupCache.m_Sample = sample_cursor;
m_LookupCache.m_Chunk = chunk_cursor;
return AP4_SUCCESS;
}
}
-
+
return AP4_ERROR_OUT_OF_RANGE;
}
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetSampleDescriptionCount
+---------------------------------------------------------------------*/
-AP4_Cardinal
+AP4_Cardinal
AP4_SyntheticSampleTable::GetSampleDescriptionCount()
{
return m_SampleDescriptions.ItemCount();
@@ -126,16 +123,13 @@ AP4_SyntheticSampleTable::GetSampleDescriptionCount()
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetSampleDescription
+---------------------------------------------------------------------*/
-AP4_SampleDescription*
+AP4_SampleDescription*
AP4_SyntheticSampleTable::GetSampleDescription(AP4_Ordinal index)
{
SampleDescriptionHolder* holder;
- if(AP4_SUCCEEDED(m_SampleDescriptions.Get(index, holder)))
- {
+ if (AP4_SUCCEEDED(m_SampleDescriptions.Get(index, holder))) {
return holder->m_SampleDescription;
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -143,9 +137,9 @@ AP4_SyntheticSampleTable::GetSampleDescription(AP4_Ordinal index)
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::AddSampleDescription
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_SyntheticSampleTable::AddSampleDescription(AP4_SampleDescription* description,
- bool transfer_ownership)
+ bool transfer_ownership)
{
return m_SampleDescriptions.Add(new SampleDescriptionHolder(description, transfer_ownership));
}
@@ -153,7 +147,7 @@ AP4_SyntheticSampleTable::AddSampleDescription(AP4_SampleDescription* descriptio
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::AddSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_SyntheticSampleTable::AddSample(AP4_ByteStream& data_stream,
AP4_Position offset,
AP4_Size size,
@@ -164,50 +158,38 @@ AP4_SyntheticSampleTable::AddSample(AP4_ByteStream& data_stream,
bool sync)
{
// decide if we need to start a new chunk or increment the last one
- if(m_SamplesInChunk.ItemCount() == 0 ||
- m_SamplesInChunk[m_SamplesInChunk.ItemCount()-1] >= m_ChunkSize ||
- m_Samples.ItemCount() == 0 ||
- m_Samples[m_Samples.ItemCount()-1].GetDescriptionIndex() != description_index)
- {
+ if (m_SamplesInChunk.ItemCount() == 0 ||
+ m_SamplesInChunk[m_SamplesInChunk.ItemCount()-1] >= m_ChunkSize ||
+ m_Samples.ItemCount() == 0 ||
+ m_Samples[m_Samples.ItemCount()-1].GetDescriptionIndex() != description_index) {
m_SamplesInChunk.Append(1);
- }
- else
- {
+ } else {
++m_SamplesInChunk[m_SamplesInChunk.ItemCount()-1];
}
-
+
// compute the timestamps
- if(m_Samples.ItemCount() > 0)
- {
+ if (m_Samples.ItemCount() > 0) {
AP4_Sample* prev_sample = &m_Samples[m_Samples.ItemCount()-1];
- if(dts == 0)
- {
- if(prev_sample->GetDuration() == 0)
- {
+ if (dts == 0) {
+ if (prev_sample->GetDuration() == 0) {
// can't compute the DTS for this sample
return AP4_ERROR_INVALID_PARAMETERS;
}
- dts = prev_sample->GetDts() + prev_sample->GetDuration();
- }
- else
- {
- if(prev_sample->GetDuration() == 0)
- {
+ dts = prev_sample->GetDts()+prev_sample->GetDuration();
+ } else {
+ if (prev_sample->GetDuration() == 0) {
// update the previous sample
- if(dts <= prev_sample->GetDts()) return AP4_ERROR_INVALID_PARAMETERS;
- prev_sample->SetDuration((AP4_UI32)(dts - prev_sample->GetDts()));
- }
- else
- {
- if(dts != prev_sample->GetDts() + prev_sample->GetDuration())
- {
+ if (dts <= prev_sample->GetDts()) return AP4_ERROR_INVALID_PARAMETERS;
+ prev_sample->SetDuration((AP4_UI32)(dts-prev_sample->GetDts()));
+ } else {
+ if (dts != prev_sample->GetDts()+prev_sample->GetDuration()) {
// mismatch
return AP4_ERROR_INVALID_PARAMETERS;
}
}
}
}
-
+
// add the sample to the table
AP4_Sample sample(data_stream, offset, size, duration, description_index, dts, cts_delta, sync);
return m_Samples.Append(sample);
@@ -216,9 +198,9 @@ AP4_SyntheticSampleTable::AddSample(AP4_ByteStream& data_stream,
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetSampleIndexForTimeStamp
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_SyntheticSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /* ts */,
- AP4_Ordinal& /* index */)
+AP4_Result
+AP4_SyntheticSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /* ts */,
+ AP4_Ordinal& /* index */)
{
return AP4_ERROR_NOT_SUPPORTED;
}
@@ -226,24 +208,19 @@ AP4_SyntheticSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /* ts */,
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetNearestSyncSampleIndex
+---------------------------------------------------------------------*/
-AP4_Ordinal
+AP4_Ordinal
AP4_SyntheticSampleTable::GetNearestSyncSampleIndex(AP4_Ordinal sample_index, bool before)
{
- if(before)
- {
- for(int i = sample_index; i >= 0; i--)
- {
- if(m_Samples[i].IsSync()) return i;
+ if (before) {
+ for (int i=sample_index; i>=0; i--) {
+ if (m_Samples[i].IsSync()) return i;
}
// not found?
return 0;
- }
- else
- {
+ } else {
AP4_Cardinal entry_count = m_Samples.ItemCount();
- for(unsigned int i = sample_index; i < entry_count; i++)
- {
- if(m_Samples[i].IsSync()) return i;
+ for (unsigned int i=sample_index; i<entry_count; i++) {
+ if (m_Samples[i].IsSync()) return i;
}
// not found?
return m_Samples.ItemCount();
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h
index 9f9ba4d6b..e54d9074d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h
@@ -53,18 +53,18 @@ const AP4_Cardinal AP4_SYNTHETIC_SAMPLE_TABLE_DEFAULT_CHUNK_SIZE = 10;
+---------------------------------------------------------------------*/
class AP4_SyntheticSampleTable : public AP4_SampleTable
{
-public:
+ public:
// methods
- AP4_SyntheticSampleTable(AP4_Cardinal chunk_size
- = AP4_SYNTHETIC_SAMPLE_TABLE_DEFAULT_CHUNK_SIZE);
+ AP4_SyntheticSampleTable(AP4_Cardinal chunk_size
+ = AP4_SYNTHETIC_SAMPLE_TABLE_DEFAULT_CHUNK_SIZE);
virtual ~AP4_SyntheticSampleTable();
// AP4_SampleTable methods
virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
virtual AP4_Cardinal GetSampleCount();
- virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
- AP4_Ordinal& chunk_index,
- AP4_Ordinal& position_in_chunk);
+ virtual AP4_Result GetSampleChunkPosition(AP4_Ordinal sample_index,
+ AP4_Ordinal& chunk_index,
+ AP4_Ordinal& position_in_chunk);
virtual AP4_Cardinal GetSampleDescriptionCount();
virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
virtual AP4_Result GetSampleIndexForTimeStamp(AP4_UI64 ts, AP4_Ordinal& index);
@@ -72,19 +72,19 @@ public:
// methods
/**
- * Add a sample description to the sample table.
+ * Add a sample description to the sample table.
* Each added sample description will have the next available index, starting at 0
*
* @param description Pointer to the sample description to add
* @param transfer_ownership Boolean flag indicating whether the ownership of the
* sample description object is transfered to the sample table object (true by default).
- * If true, the sample table object will own the sample description object, and will
- * delete it when it is itself deleted. If false, the ownership remains with the caller,
+ * If true, the sample table object will own the sample description object, and will
+ * delete it when it is itself deleted. If false, the ownership remains with the caller,
* and only a referencing pointer is kept, thus the caller must ensure that the object
* is not deleted before the sample table is deleted.
*/
virtual AP4_Result AddSampleDescription(AP4_SampleDescription* description,
- bool transfer_ownership = true);
+ bool transfer_ownership=true);
/**
* Add a sample to the sample table, where the sample duration is given
@@ -97,16 +97,16 @@ public:
* value can be 0 if the duration is not known. In that case, the next sample
* added to the table MUST have a non-zero value for the DTS (decoding timestamp),
* which will allow the actual duration of this sample to be computed.
- * @param description_index Index of the sample description that applies to
+ * @param description_index Index of the sample description that applies to
* this sample (typically 0).
* @param dts DTS (decoding timestamp) of the sample. If this value is 0, and there
- * already are samples in the table, the DTS of the sample will be automatically
+ * already are samples in the table, the DTS of the sample will be automatically
* computed based on the DTS and duration of the preceding sample. If this value is
- * not equal to the DTS+duration of the preceding sample, the duration of the
+ * not equal to the DTS+duration of the preceding sample, the duration of the
* preceding sample is automatically adjusted, unless it has a non-zero value, in which
* case AP4_ERROR_INVALID_PARAMETERS is returned.
* The DTS of the first sample in the table MUST always be 0.
- * @param cts_delta Difference between the CTS (composition/display timestamp) and DTS
+ * @param cts_delta Difference between the CTS (composition/display timestamp) and DTS
* (decoding timestamp) of the sample (in the timescale of the media)
* @param sync Boolean flag indicating whether this is a sync sample or not.
*/
@@ -121,26 +121,21 @@ public:
private:
// classes
- class SampleDescriptionHolder
- {
+ class SampleDescriptionHolder {
public:
SampleDescriptionHolder(AP4_SampleDescription* description, bool is_owned) :
m_SampleDescription(description), m_IsOwned(is_owned) {}
- ~SampleDescriptionHolder()
- {
- if(m_IsOwned) delete m_SampleDescription;
- }
+ ~SampleDescriptionHolder() { if (m_IsOwned) delete m_SampleDescription; }
AP4_SampleDescription* m_SampleDescription;
bool m_IsOwned;
};
-
+
// members
AP4_Array<AP4_Sample> m_Samples;
AP4_List<SampleDescriptionHolder> m_SampleDescriptions;
AP4_Cardinal m_ChunkSize;
AP4_Array<AP4_UI32> m_SamplesInChunk;
- struct
- {
+ struct {
AP4_Ordinal m_Sample;
AP4_Ordinal m_Chunk;
} m_LookupCache;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.cpp
index 7daa6af08..678e6ccb3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tfhd Atoms
+| AP4 - tfhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,31 +45,31 @@ AP4_TfhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 0) return NULL;
- if(size != ComputeSize(flags)) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 0) return NULL;
+ if (size != ComputeSize(flags)) return NULL;
return new AP4_TfhdAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_TfhdAtom::ComputeSize
+---------------------------------------------------------------------*/
-AP4_UI32
+AP4_UI32
AP4_TfhdAtom::ComputeSize(AP4_UI32 flags)
{
- AP4_UI32 size = AP4_FULL_ATOM_HEADER_SIZE + 4;
- if(flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT) size += 8;
- if(flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT) size += 4;
- if(flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT) size += 4;
- if(flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT) size += 4;
- if(flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT) size += 4;
+ AP4_UI32 size = AP4_FULL_ATOM_HEADER_SIZE+4;
+ if (flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT) size += 8;
+ if (flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT) size += 4;
+ if (flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT) size += 4;
+ if (flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT) size += 4;
+ if (flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT) size += 4;
return size;
}
/*----------------------------------------------------------------------
| AP4_TfhdAtom::AP4_TfhdAtom
+---------------------------------------------------------------------*/
-AP4_TfhdAtom::AP4_TfhdAtom(AP4_UI32 flags,
+AP4_TfhdAtom::AP4_TfhdAtom(AP4_UI32 flags,
AP4_UI32 track_id,
AP4_UI64 base_data_offset,
AP4_UI32 sample_description_index,
@@ -89,31 +89,26 @@ AP4_TfhdAtom::AP4_TfhdAtom(AP4_UI32 flags,
/*----------------------------------------------------------------------
| AP4_TfhdAtom::AP4_TfhdAtom
+---------------------------------------------------------------------*/
-AP4_TfhdAtom::AP4_TfhdAtom(AP4_UI32 size,
+AP4_TfhdAtom::AP4_TfhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_TFHD, size, version, flags)
{
stream.ReadUI32(m_TrackId);
- if(flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT)
- {
+ if (flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT) {
stream.ReadUI64(m_BaseDataOffset);
}
- if(flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT)
- {
+ if (flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT) {
stream.ReadUI32(m_SampleDescriptionIndex);
}
- if(flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT)
- {
+ if (flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT) {
stream.ReadUI32(m_DefaultSampleDuration);
}
- if(flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT)
- {
+ if (flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT) {
stream.ReadUI32(m_DefaultSampleSize);
}
- if(flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT)
- {
+ if (flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT) {
stream.ReadUI32(m_DefaultSampleFlags);
}
}
@@ -125,35 +120,30 @@ AP4_Result
AP4_TfhdAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
result = stream.WriteUI32(m_TrackId);
- if(AP4_FAILED(result)) return result;
- if(m_Flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT)
- {
+ if (AP4_FAILED(result)) return result;
+ if (m_Flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT) {
result = stream.WriteUI64(m_BaseDataOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT) {
result = stream.WriteUI32(m_SampleDescriptionIndex);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT) {
stream.WriteUI32(m_DefaultSampleDuration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT) {
stream.WriteUI32(m_DefaultSampleSize);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT) {
stream.WriteUI32(m_DefaultSampleFlags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
-
+
return AP4_SUCCESS;
}
@@ -164,25 +154,20 @@ AP4_Result
AP4_TfhdAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("track ID", m_TrackId);
- if(m_Flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_BASE_DATA_OFFSET_PRESENT) {
inspector.AddField("base data offset", m_BaseDataOffset);
}
- if(m_Flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_SAMPLE_DESCRIPTION_INDEX_PRESENT) {
inspector.AddField("sample description index", m_SampleDescriptionIndex);
}
- if(m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_DURATION_PRESENT) {
inspector.AddField("default sample duration", m_DefaultSampleDuration);
}
- if(m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT)
- {
+ if (m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_SIZE_PRESENT) {
inspector.AddField("default sample size", m_DefaultSampleSize);
}
- if(m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT)
- {
- inspector.AddField("default sample flags", m_DefaultSampleFlags, AP4_AtomInspector::HINT_HEX);
+ if (m_Flags & AP4_TFHD_FLAG_DEFAULT_SAMPLE_FLAGS_PRESENT) {
+ inspector.AddField("default sample flags", m_DefaultSampleFlags, AP4_AtomInspector::HINT_HEX );
}
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.h
index 6fba18062..db0d3f777 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tfhd Atoms
+| AP4 - tfhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -57,7 +57,7 @@ public:
static AP4_UI32 ComputeSize(AP4_UI32 flags);
// methods
- AP4_TfhdAtom(AP4_UI32 flags,
+ AP4_TfhdAtom(AP4_UI32 flags,
AP4_UI32 track_id,
AP4_UI64 base_data_offset,
AP4_UI32 sample_description_index,
@@ -67,58 +67,22 @@ public:
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI32 GetTrackId()
- {
- return m_TrackId;
- }
- void SetTrackId(AP4_UI32 track_id)
- {
- m_TrackId = track_id;
- }
- AP4_UI64 GetBaseDataOffset()
- {
- return m_BaseDataOffset;
- }
- void SetBaseDataOffset(AP4_UI64 offset)
- {
- m_BaseDataOffset = offset;
- }
- AP4_UI32 GetSampleDescriptionIndex()
- {
- return m_SampleDescriptionIndex;
- }
- void SetSampleDescriptionIndex(AP4_UI32 indx)
- {
- m_SampleDescriptionIndex = indx;
- }
- AP4_UI32 GetDefaultSampleDuration()
- {
- return m_DefaultSampleDuration;
- }
- void SetDefaultSampleDuration(AP4_UI32 duration)
- {
- m_DefaultSampleDuration = duration;
- }
- AP4_UI32 GetDefaultSampleSize()
- {
- return m_DefaultSampleSize;
- }
- void SetDefaultSampleSize(AP4_UI32 size)
- {
- m_DefaultSampleSize = size;
- }
- AP4_UI32 GetDefaultSampleFlags()
- {
- return m_DefaultSampleFlags;
- }
- void SetDefaultSampleFlags(AP4_UI32 flags)
- {
- m_DefaultSampleFlags = flags;
- }
+ AP4_UI32 GetTrackId() { return m_TrackId; }
+ void SetTrackId(AP4_UI32 track_id) { m_TrackId = track_id; }
+ AP4_UI64 GetBaseDataOffset() { return m_BaseDataOffset; }
+ void SetBaseDataOffset(AP4_UI64 offset) { m_BaseDataOffset = offset; }
+ AP4_UI32 GetSampleDescriptionIndex() { return m_SampleDescriptionIndex; }
+ void SetSampleDescriptionIndex(AP4_UI32 indx) { m_SampleDescriptionIndex = indx; }
+ AP4_UI32 GetDefaultSampleDuration() { return m_DefaultSampleDuration; }
+ void SetDefaultSampleDuration(AP4_UI32 duration) { m_DefaultSampleDuration = duration; }
+ AP4_UI32 GetDefaultSampleSize() { return m_DefaultSampleSize; }
+ void SetDefaultSampleSize(AP4_UI32 size) { m_DefaultSampleSize = size; }
+ AP4_UI32 GetDefaultSampleFlags() { return m_DefaultSampleFlags; }
+ void SetDefaultSampleFlags(AP4_UI32 flags) { m_DefaultSampleFlags = flags; }
private:
// methods
- AP4_TfhdAtom(AP4_UI32 size,
+ AP4_TfhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.cpp
index 2aa930892..1c5437128 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tfra Atoms
+| AP4 - tfra Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -36,14 +36,14 @@
/*----------------------------------------------------------------------
| AP4_TfraAtom::Create
+---------------------------------------------------------------------*/
-AP4_TfraAtom*
+AP4_TfraAtom*
AP4_TfraAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version = 0;
AP4_UI32 flags = 0;
AP4_Result result = ReadFullHeader(stream, version, flags);
- if(AP4_FAILED(result)) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(result)) return NULL;
+ if (version > 1) return NULL;
return new AP4_TfraAtom(size, version, flags, stream);
}
@@ -51,37 +51,33 @@ AP4_TfraAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_TfraAtom::AP4_TfraAtom
+---------------------------------------------------------------------*/
AP4_TfraAtom::AP4_TfraAtom() :
- AP4_Atom(AP4_ATOM_TYPE_TFRA, AP4_FULL_ATOM_HEADER_SIZE + 4 + 4 + 4)
+ AP4_Atom(AP4_ATOM_TYPE_TFRA, AP4_FULL_ATOM_HEADER_SIZE+4+4+4)
{
}
/*----------------------------------------------------------------------
| AP4_TfraAtom::AP4_TfraAtom
+---------------------------------------------------------------------*/
-AP4_TfraAtom::AP4_TfraAtom(AP4_UI32 size,
- AP4_UI32 version,
- AP4_UI32 flags,
+AP4_TfraAtom::AP4_TfraAtom(AP4_UI32 size,
+ AP4_UI32 version,
+ AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_TFRA, size, version, flags)
{
stream.ReadUI32(m_TrackId);
AP4_UI32 fields = 0;
stream.ReadUI32(fields);
- m_LengthSizeOfTrafNumber = (fields >> 4) & 3;
- m_LengthSizeOfTrunNumber = (fields >> 2) & 3;
- m_LengthSizeOfSampleNumber = (fields) & 3;
+ m_LengthSizeOfTrafNumber = (fields>>4)&3;
+ m_LengthSizeOfTrunNumber = (fields>>2)&3;
+ m_LengthSizeOfSampleNumber = (fields )&3;
AP4_UI32 entry_count = 0;
stream.ReadUI32(entry_count);
m_Entries.SetItemCount(entry_count);
- for(unsigned int i = 0; i < entry_count; i++)
- {
- if(version == 1)
- {
+ for (unsigned int i=0; i<entry_count; i++) {
+ if (version == 1) {
stream.ReadUI64(m_Entries[i].m_Time);
stream.ReadUI64(m_Entries[i].m_MoofOffset);
- }
- else
- {
+ } else {
AP4_UI32 time = 0;
AP4_UI32 moof_offset = 0;
stream.ReadUI32(time);
@@ -89,101 +85,86 @@ AP4_TfraAtom::AP4_TfraAtom(AP4_UI32 size,
m_Entries[i].m_Time = time;
m_Entries[i].m_MoofOffset = moof_offset;
}
- switch(m_LengthSizeOfTrafNumber)
- {
- case 0:
- {
- AP4_UI08 traf_number;
- stream.ReadUI08(traf_number);
- m_Entries[i].m_TrafNumber = traf_number;
- break;
- }
- case 1:
- {
- AP4_UI16 traf_number;
- stream.ReadUI16(traf_number);
- m_Entries[i].m_TrafNumber = traf_number;
- break;
- }
- case 2:
- {
- AP4_UI32 traf_number;
- stream.ReadUI24(traf_number);
- m_Entries[i].m_TrafNumber = traf_number;
- break;
- }
- case 3:
- {
- AP4_UI32 traf_number;
- stream.ReadUI32(traf_number);
- m_Entries[i].m_TrafNumber = traf_number;
- break;
- }
- }
-
- switch(m_LengthSizeOfTrunNumber)
- {
- case 0:
- {
- AP4_UI08 trun_number;
- stream.ReadUI08(trun_number);
- m_Entries[i].m_TrunNumber = trun_number;
- break;
- }
- case 1:
- {
- AP4_UI16 trun_number;
- stream.ReadUI16(trun_number);
- m_Entries[i].m_TrunNumber = trun_number;
- break;
- }
- case 2:
- {
- AP4_UI32 trun_number;
- stream.ReadUI24(trun_number);
- m_Entries[i].m_TrunNumber = trun_number;
- break;
- }
- case 3:
- {
- AP4_UI32 trun_number;
- stream.ReadUI32(trun_number);
- m_Entries[i].m_TrunNumber = trun_number;
- break;
- }
- }
-
- switch(m_LengthSizeOfSampleNumber)
- {
- case 0:
- {
- AP4_UI08 sample_number;
- stream.ReadUI08(sample_number);
- m_Entries[i].m_SampleNumber = sample_number;
- break;
- }
- case 1:
- {
- AP4_UI16 sample_number;
- stream.ReadUI16(sample_number);
- m_Entries[i].m_SampleNumber = sample_number;
- break;
- }
- case 2:
- {
- AP4_UI32 sample_number;
- stream.ReadUI24(sample_number);
- m_Entries[i].m_SampleNumber = sample_number;
- break;
- }
- case 3:
- {
- AP4_UI32 sample_number;
- stream.ReadUI32(sample_number);
- m_Entries[i].m_SampleNumber = sample_number;
- break;
+ switch (m_LengthSizeOfTrafNumber) {
+ case 0: {
+ AP4_UI08 traf_number;
+ stream.ReadUI08(traf_number);
+ m_Entries[i].m_TrafNumber = traf_number;
+ break;
+ }
+ case 1: {
+ AP4_UI16 traf_number;
+ stream.ReadUI16(traf_number);
+ m_Entries[i].m_TrafNumber = traf_number;
+ break;
+ }
+ case 2: {
+ AP4_UI32 traf_number;
+ stream.ReadUI24(traf_number);
+ m_Entries[i].m_TrafNumber = traf_number;
+ break;
+ }
+ case 3: {
+ AP4_UI32 traf_number;
+ stream.ReadUI32(traf_number);
+ m_Entries[i].m_TrafNumber = traf_number;
+ break;
+ }
}
+
+ switch (m_LengthSizeOfTrunNumber) {
+ case 0: {
+ AP4_UI08 trun_number;
+ stream.ReadUI08(trun_number);
+ m_Entries[i].m_TrunNumber = trun_number;
+ break;
+ }
+ case 1: {
+ AP4_UI16 trun_number;
+ stream.ReadUI16(trun_number);
+ m_Entries[i].m_TrunNumber = trun_number;
+ break;
+ }
+ case 2: {
+ AP4_UI32 trun_number;
+ stream.ReadUI24(trun_number);
+ m_Entries[i].m_TrunNumber = trun_number;
+ break;
+ }
+ case 3: {
+ AP4_UI32 trun_number;
+ stream.ReadUI32(trun_number);
+ m_Entries[i].m_TrunNumber = trun_number;
+ break;
+ }
}
+
+ switch (m_LengthSizeOfSampleNumber) {
+ case 0: {
+ AP4_UI08 sample_number;
+ stream.ReadUI08(sample_number);
+ m_Entries[i].m_SampleNumber = sample_number;
+ break;
+ }
+ case 1: {
+ AP4_UI16 sample_number;
+ stream.ReadUI16(sample_number);
+ m_Entries[i].m_SampleNumber = sample_number;
+ break;
+ }
+ case 2: {
+ AP4_UI32 sample_number;
+ stream.ReadUI24(sample_number);
+ m_Entries[i].m_SampleNumber = sample_number;
+ break;
+ }
+ case 3: {
+ AP4_UI32 sample_number;
+ stream.ReadUI32(sample_number);
+ m_Entries[i].m_SampleNumber = sample_number;
+ break;
+ }
+ }
}
}
@@ -196,100 +177,93 @@ AP4_TfraAtom::WriteFields(AP4_ByteStream& stream)
AP4_Result result;
result = stream.WriteUI32(m_TrackId);
- if(AP4_FAILED(result)) return result;
- AP4_UI32 fields = (m_LengthSizeOfTrafNumber << 4) |
- (m_LengthSizeOfTrunNumber << 2) |
- (m_LengthSizeOfSampleNumber);
+ if (AP4_FAILED(result)) return result;
+ AP4_UI32 fields = (m_LengthSizeOfTrafNumber<<4)|
+ (m_LengthSizeOfTrunNumber<<2)|
+ (m_LengthSizeOfSampleNumber );
result = stream.WriteUI32(fields);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Entries.ItemCount());
- for(unsigned int i = 0; i < m_Entries.ItemCount(); i++)
- {
- if(m_Version == 1)
- {
+ for (unsigned int i=0; i<m_Entries.ItemCount(); i++) {
+ if (m_Version == 1) {
result = stream.WriteUI64(m_Entries[i].m_Time);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_Entries[i].m_MoofOffset);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
result = stream.WriteUI32((AP4_UI32)m_Entries[i].m_Time);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_Entries[i].m_MoofOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- switch(m_LengthSizeOfTrafNumber)
- {
- case 0:
- result = stream.WriteUI08((AP4_UI08)m_Entries[i].m_TrafNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ switch (m_LengthSizeOfTrafNumber) {
+ case 0:
+ result = stream.WriteUI08((AP4_UI08)m_Entries[i].m_TrafNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 1:
- result = stream.WriteUI16((AP4_UI16)m_Entries[i].m_TrafNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 1:
+ result = stream.WriteUI16((AP4_UI16)m_Entries[i].m_TrafNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 2:
- result = stream.WriteUI24(m_Entries[i].m_TrafNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 2:
+ result = stream.WriteUI24(m_Entries[i].m_TrafNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 3:
- result = stream.WriteUI32(m_Entries[i].m_TrafNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 3:
+ result = stream.WriteUI32(m_Entries[i].m_TrafNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
}
+
+ switch (m_LengthSizeOfTrunNumber) {
+ case 0:
+ result = stream.WriteUI08((AP4_UI08)m_Entries[i].m_TrunNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- switch(m_LengthSizeOfTrunNumber)
- {
- case 0:
- result = stream.WriteUI08((AP4_UI08)m_Entries[i].m_TrunNumber);
- if(AP4_FAILED(result)) return result;
- break;
-
- case 1:
- result = stream.WriteUI16((AP4_UI16)m_Entries[i].m_TrunNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 1:
+ result = stream.WriteUI16((AP4_UI16)m_Entries[i].m_TrunNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 2:
- result = stream.WriteUI24(m_Entries[i].m_TrunNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 2:
+ result = stream.WriteUI24(m_Entries[i].m_TrunNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 3:
- result = stream.WriteUI32(m_Entries[i].m_TrunNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 3:
+ result = stream.WriteUI32(m_Entries[i].m_TrunNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
}
- switch(m_LengthSizeOfSampleNumber)
- {
- case 0:
- result = stream.WriteUI08((AP4_UI08)m_Entries[i].m_SampleNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ switch (m_LengthSizeOfSampleNumber) {
+ case 0:
+ result = stream.WriteUI08((AP4_UI08)m_Entries[i].m_SampleNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 1:
- result = stream.WriteUI16((AP4_UI16)m_Entries[i].m_SampleNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 1:
+ result = stream.WriteUI16((AP4_UI16)m_Entries[i].m_SampleNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 2:
- result = stream.WriteUI24(m_Entries[i].m_SampleNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 2:
+ result = stream.WriteUI24(m_Entries[i].m_SampleNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
- case 3:
- result = stream.WriteUI32(m_Entries[i].m_SampleNumber);
- if(AP4_FAILED(result)) return result;
- break;
+ case 3:
+ result = stream.WriteUI32(m_Entries[i].m_SampleNumber);
+ if (AP4_FAILED(result)) return result;
+ break;
}
}
-
+
return AP4_SUCCESS;
}
@@ -304,14 +278,12 @@ AP4_TfraAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("length_size_of_trun_num", m_LengthSizeOfTrunNumber);
inspector.AddField("length_size_of_sample_num", m_LengthSizeOfSampleNumber);
inspector.AddField("entry count", m_Entries.ItemCount());
- if(inspector.GetVerbosity() >= 1)
- {
- for(unsigned int i = 0; i < m_Entries.ItemCount(); i++)
- {
+ if (inspector.GetVerbosity() >= 1) {
+ for (unsigned int i=0; i<m_Entries.ItemCount(); i++) {
char name[16];
char value[256];
AP4_FormatString(name, sizeof(name), "[%04d]", i);
- AP4_FormatString(value, sizeof(value),
+ AP4_FormatString(value, sizeof(value),
"time=%lld, moof_offset=%lld, traf_number=%d, trun_number=%d, sample_number=%d",
m_Entries[i].m_Time,
m_Entries[i].m_MoofOffset,
@@ -321,6 +293,6 @@ AP4_TfraAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField(name, value);
}
}
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.h
index 22a3c0df7..fc5f78495 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TfraAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tfra Atoms
+| AP4 - tfra Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -48,8 +48,7 @@ class AP4_TfraAtom : public AP4_Atom
{
public:
// types
- struct Entry
- {
+ struct Entry {
Entry() : m_Time(0), m_MoofOffset(0), m_TrafNumber(0), m_TrunNumber(0), m_SampleNumber(0) {}
AP4_UI64 m_Time;
AP4_UI64 m_MoofOffset;
@@ -57,11 +56,11 @@ public:
AP4_UI32 m_TrunNumber;
AP4_UI32 m_SampleNumber;
};
-
+
// class methods
static AP4_TfraAtom* Create(AP4_Size size, AP4_ByteStream& stream);
-
- // constructors
+
+ // constructors
AP4_TfraAtom();
// methods
@@ -69,10 +68,7 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_Array<Entry>& GetEntries()
- {
- return m_Entries;
- }
+ AP4_Array<Entry>& GetEntries() { return m_Entries; }
private:
// methods
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.cpp
index fb05c36d7..f6f446e7d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tims Atoms
+| AP4 - tims Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -38,7 +38,7 @@
| AP4_TimsAtom::AP4_TimsAtom
+---------------------------------------------------------------------*/
AP4_TimsAtom::AP4_TimsAtom(AP4_UI32 timescale) :
- AP4_Atom(AP4_ATOM_TYPE_TIMS, AP4_ATOM_HEADER_SIZE + 4),
+ AP4_Atom(AP4_ATOM_TYPE_TIMS, AP4_ATOM_HEADER_SIZE+4),
m_TimeScale(timescale)
{
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.h
index 6f47d45df..3a78bdc2a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TimsAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tims Atoms
+| AP4 - tims Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,8 +41,7 @@ class AP4_TimsAtom : public AP4_Atom
{
public:
// class methods
- static AP4_TimsAtom* Create(AP4_Size size, AP4_ByteStream& stream)
- {
+ static AP4_TimsAtom* Create(AP4_Size size, AP4_ByteStream& stream) {
return new AP4_TimsAtom(size, stream);
}
@@ -52,10 +51,7 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- virtual AP4_UI32 GetTimeScale()
- {
- return m_TimeScale;
- }
+ virtual AP4_UI32 GetTimeScale() { return m_TimeScale; }
private:
// methods
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.cpp
index f106b58f4..6060ac049 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tkhd Atoms
+| AP4 - tkhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_TkhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 1) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 1) return NULL;
return new AP4_TkhdAtom(size, version, flags, stream);
}
@@ -61,7 +61,7 @@ AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 creation_time,
AP4_UI16 volume,
AP4_UI32 width,
AP4_UI32 height) :
- AP4_Atom(AP4_ATOM_TYPE_TKHD, AP4_FULL_ATOM_HEADER_SIZE + 80, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, AP4_FULL_ATOM_HEADER_SIZE+80, 0, 0),
m_CreationTime(creation_time),
m_ModificationTime(modification_time),
m_TrackId(track_id),
@@ -93,14 +93,13 @@ AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 creation_time,
/*----------------------------------------------------------------------
| AP4_TkhdAtom::AP4_TkhdAtom
+---------------------------------------------------------------------*/
-AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 size,
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_TKHD, size, version, flags)
{
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
// we only deal with version 0 for now
AP4_UI32 creation_time;
stream.ReadUI32(creation_time);
@@ -113,9 +112,7 @@ AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 size,
AP4_UI32 duration;
stream.ReadUI32(duration);
m_Duration = duration;
- }
- else
- {
+ } else {
stream.ReadUI64(m_CreationTime);
stream.ReadUI64(m_ModificationTime);
stream.ReadUI32(m_TrackId);
@@ -128,8 +125,7 @@ AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 size,
stream.ReadUI16(m_AlternateGroup);
stream.ReadUI16(m_Volume);
stream.ReadUI16(m_Reserved3);
- for(int i = 0; i < 9; i++)
- {
+ for (int i=0; i<9; i++) {
stream.ReadUI32(m_Matrix[i]);
}
stream.ReadUI32(m_Width);
@@ -145,60 +141,56 @@ AP4_TkhdAtom::WriteFields(AP4_ByteStream& stream)
AP4_Result result;
// creation/modification time, track id, reserved1 & duration
- if(m_Version == 0)
- {
+ if (m_Version == 0) {
result = stream.WriteUI32((AP4_UI32)m_CreationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TrackId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Reserved1);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32((AP4_UI32)m_Duration);
- if(AP4_FAILED(result)) return result;
- }
- else
- {
+ if (AP4_FAILED(result)) return result;
+ } else {
result = stream.WriteUI64(m_CreationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_ModificationTime);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_TrackId);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Reserved1);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI64(m_Duration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// reserved2
result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// layer, alternate group & volume
result = stream.WriteUI16(m_Layer);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_AlternateGroup);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI16(m_Volume);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// reserved3
result = stream.WriteUI16(m_Reserved3);
// matrix
- for(int i = 0; i < 9; i++)
- {
+ for (int i=0; i<9; i++) {
result = stream.WriteUI32(m_Matrix[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
// width & height
result = stream.WriteUI32(m_Width);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI32(m_Height);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return result;
}
@@ -212,8 +204,8 @@ AP4_TkhdAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("enabled", ((m_Flags & AP4_TKHD_FLAG_TRACK_ENABLED) ? 1 : 0), AP4_AtomInspector::HINT_BOOLEAN);
inspector.AddField("id", m_TrackId);
inspector.AddField("duration", m_Duration);
- inspector.AddFieldF("width", (float)m_Width / 65536.0f);
- inspector.AddFieldF("height", (float)m_Height / 65536.0f);
-
+ inspector.AddFieldF("width", (float)m_Width/65536.0f);
+ inspector.AddFieldF("height", (float)m_Height/65536.0f);
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.h
index a703638d7..d0d0f7b68 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TkhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tkhd Atoms
+| AP4 - tkhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -61,53 +61,28 @@ public:
AP4_UI64 duration,
AP4_UI16 volume,
AP4_UI32 width,
- AP4_UI32 height);
+ AP4_UI32 height);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
- AP4_UI64 GetDuration()
- {
- return m_Duration;
- }
- void SetDuration(AP4_UI64 duration)
- {
- m_Duration = duration;
- }
- AP4_UI32 GetTrackId()
- {
- return m_TrackId;
- }
- void SetTrackId(AP4_UI32 track_id)
- {
- m_TrackId = track_id;
- }
+ AP4_UI64 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI64 duration) { m_Duration = duration; }
+ AP4_UI32 GetTrackId() { return m_TrackId; }
+ void SetTrackId(AP4_UI32 track_id) { m_TrackId = track_id; }
- void GetTranslation(float& x, float& y)
- {
+ void GetTranslation(float& x, float& y) {
x = (float)(*(int*)&m_Matrix[6]) / 65536;
y = (float)(*(int*)&m_Matrix[7]) / 65536;
}
- AP4_UI32 GetWidth()
- {
- return m_Width;
- }
- void SetWidth(AP4_UI32 width)
- {
- m_Width = width;
- }
- AP4_UI32 GetHeight()
- {
- return m_Height;
- }
- void SetHeight(AP4_UI32 height)
- {
- m_Height = height;
- }
+ AP4_UI32 GetWidth() { return m_Width; }
+ void SetWidth(AP4_UI32 width) { m_Width = width; }
+ AP4_UI32 GetHeight() { return m_Height; }
+ void SetHeight(AP4_UI32 height) { m_Height = height; }
-private:
+ private:
// methods
- AP4_TkhdAtom(AP4_UI32 size,
+ AP4_TkhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.cpp
index 810750582..9dc915571 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.cpp
@@ -49,7 +49,7 @@
+---------------------------------------------------------------------*/
AP4_Track::AP4_Track(Type type,
AP4_SampleTable* sample_table,
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_UI32 movie_time_scale,
AP4_UI64 track_duration,
AP4_UI32 media_time_scale,
@@ -61,66 +61,65 @@ AP4_Track::AP4_Track(Type type,
m_Type(type),
m_SampleTable(sample_table),
m_SampleTableIsOwned(true),
- m_MovieTimeScale(movie_time_scale ?
- movie_time_scale :
+ m_MovieTimeScale(movie_time_scale ?
+ movie_time_scale :
AP4_TRACK_DEFAULT_MOVIE_TIMESCALE)
{
// compute the default volume value
unsigned int volume = 0;
- if(type == TYPE_AUDIO) volume = 0x100;
+ if (type == TYPE_AUDIO) volume = 0x100;
// compute the handler type and name
AP4_Atom::Type hdlr_type;
const char* hdlr_name;
- switch(type)
- {
- case TYPE_AUDIO:
- hdlr_type = AP4_HANDLER_TYPE_SOUN;
- hdlr_name = "Bento4 Sound Handler";
- break;
-
- case TYPE_VIDEO:
- hdlr_type = AP4_HANDLER_TYPE_VIDE;
- hdlr_name = "Bento4 Video Handler";
- break;
-
- case TYPE_HINT:
- hdlr_type = AP4_HANDLER_TYPE_HINT;
- hdlr_name = "Bento4 Hint Handler";
- break;
-
- case TYPE_TEXT:
- hdlr_type = AP4_HANDLER_TYPE_TEXT;
- hdlr_name = "Bento4 Text Handler";
- break;
-
- default:
- hdlr_type = 0;
- hdlr_name = NULL;
- break;
+ switch (type) {
+ case TYPE_AUDIO:
+ hdlr_type = AP4_HANDLER_TYPE_SOUN;
+ hdlr_name = "Bento4 Sound Handler";
+ break;
+
+ case TYPE_VIDEO:
+ hdlr_type = AP4_HANDLER_TYPE_VIDE;
+ hdlr_name = "Bento4 Video Handler";
+ break;
+
+ case TYPE_HINT:
+ hdlr_type = AP4_HANDLER_TYPE_HINT;
+ hdlr_name = "Bento4 Hint Handler";
+ break;
+
+ case TYPE_TEXT:
+ hdlr_type = AP4_HANDLER_TYPE_TEXT;
+ hdlr_name = "Bento4 Text Handler";
+ break;
+
+ default:
+ hdlr_type = 0;
+ hdlr_name = NULL;
+ break;
}
// create a trak atom
m_TrakAtom = new AP4_TrakAtom(sample_table,
- hdlr_type,
+ hdlr_type,
hdlr_name,
- track_id,
- 0,
- 0,
+ track_id,
+ 0,
+ 0,
track_duration,
media_time_scale,
media_duration,
- volume,
+ volume,
language,
- width,
+ width,
height);
}
/*----------------------------------------------------------------------
| AP4_Track::AP4_Track
+---------------------------------------------------------------------*/
-AP4_Track::AP4_Track(AP4_TrakAtom& atom,
- AP4_ByteStream& sample_stream,
+AP4_Track::AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
AP4_UI32 movie_time_scale) :
m_TrakAtom(&atom),
m_TrakAtomIsOwned(false),
@@ -131,51 +130,35 @@ AP4_Track::AP4_Track(AP4_TrakAtom& atom,
{
// find the handler type
AP4_Atom* sub = atom.FindChild("mdia/hdlr");
- if(sub)
- {
+ if (sub) {
AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, sub);
- if(hdlr)
- {
+ if (hdlr) {
AP4_UI32 type = hdlr->GetHandlerType();
- if(type == AP4_HANDLER_TYPE_SOUN)
- {
+ if (type == AP4_HANDLER_TYPE_SOUN) {
m_Type = TYPE_AUDIO;
- }
- else if(type == AP4_HANDLER_TYPE_VIDE)
- {
+ } else if (type == AP4_HANDLER_TYPE_VIDE) {
m_Type = TYPE_VIDEO;
- }
- else if(type == AP4_HANDLER_TYPE_HINT)
- {
+ } else if (type == AP4_HANDLER_TYPE_HINT) {
m_Type = TYPE_HINT;
- }
- else if(type == AP4_HANDLER_TYPE_ODSM ||
- type == AP4_HANDLER_TYPE_SDSM)
- {
+ } else if (type == AP4_HANDLER_TYPE_ODSM ||
+ type == AP4_HANDLER_TYPE_SDSM) {
m_Type = TYPE_SYSTEM;
- }
- else if(type == AP4_HANDLER_TYPE_TEXT ||
- type == AP4_HANDLER_TYPE_TX3G)
- {
+ } else if (type == AP4_HANDLER_TYPE_TEXT ||
+ type == AP4_HANDLER_TYPE_TX3G) {
m_Type = TYPE_TEXT;
- }
- else if(type == AP4_HANDLER_TYPE_JPEG)
- {
+ } else if (type == AP4_HANDLER_TYPE_JPEG) {
m_Type = TYPE_JPEG;
- // ==> Start patch MPC
- }
- else if(type == AP4_HANDLER_TYPE_SUBP)
- {
- m_Type = TYPE_SUBP;
- // <== End patch MPC
- }
+ // ==> Start patch MPC
+ } else if (type == AP4_HANDLER_TYPE_SUBP) {
+ m_Type = TYPE_SUBP;
+ // <== End patch MPC
+ }
}
}
// create a facade for the stbl atom
AP4_ContainerAtom* stbl = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom.FindChild("mdia/minf/stbl"));
- if(stbl)
- {
+ if (stbl) {
m_SampleTable = new AP4_AtomSampleTable(stbl, sample_stream);
}
}
@@ -185,33 +168,31 @@ AP4_Track::AP4_Track(AP4_TrakAtom& atom,
+---------------------------------------------------------------------*/
AP4_Track::~AP4_Track()
{
- if(m_TrakAtomIsOwned) delete m_TrakAtom;
- if(m_SampleTableIsOwned) delete m_SampleTable;
+ if (m_TrakAtomIsOwned) delete m_TrakAtom;
+ if (m_SampleTableIsOwned) delete m_SampleTable;
}
/*----------------------------------------------------------------------
| AP4_Track::Clone
+---------------------------------------------------------------------*/
-AP4_Track*
+AP4_Track*
AP4_Track::Clone(AP4_Result* result)
{
AP4_SyntheticSampleTable* sample_table = new AP4_SyntheticSampleTable();
-
+
// default return value
- if(result) *result = AP4_SUCCESS;
-
+ if (result) *result = AP4_SUCCESS;
+
// add clones of the sample descriptions to the new sample table
- for(unsigned int i = 0; ; i++)
- {
+ for (unsigned int i=0; ;i++) {
AP4_SampleDescription* sample_description = GetSampleDescription(i);
- if(sample_description == NULL) break;
+ if (sample_description == NULL) break;
sample_table->AddSampleDescription(sample_description->Clone());
}
AP4_Sample sample;
AP4_Ordinal index = 0;
- while(AP4_SUCCEEDED(GetSample(index, sample)))
- {
+ while (AP4_SUCCEEDED(GetSample(index, sample))) {
AP4_ByteStream* data_stream;
data_stream = sample.GetDataStream();
sample_table->AddSample(*data_stream,
@@ -224,8 +205,8 @@ AP4_Track::Clone(AP4_Result* result)
sample.IsSync());
AP4_RELEASE(data_stream); // release our ref, the table has kept its own ref.
index++;
- }
-
+ }
+
// create the cloned track
AP4_Track* clone = new AP4_Track(GetType(),
sample_table,
@@ -237,7 +218,7 @@ AP4_Track::Clone(AP4_Result* result)
GetTrackLanguage().GetChars(),
GetWidth(),
GetHeight());
-
+
return clone;
}
@@ -247,7 +228,7 @@ AP4_Track::Clone(AP4_Result* result)
AP4_Result
AP4_Track::Attach(AP4_MoovAtom* moov)
{
- if(!m_TrakAtomIsOwned) return AP4_ERROR_INTERNAL;
+ if (!m_TrakAtomIsOwned) return AP4_ERROR_INTERNAL;
moov->AddChild(m_TrakAtom);
m_TrakAtomIsOwned = false;
@@ -260,11 +241,9 @@ AP4_Track::Attach(AP4_MoovAtom* moov)
AP4_UI32
AP4_Track::GetFlags()
{
- if(m_TrakAtom)
- {
+ if (m_TrakAtom) {
AP4_TkhdAtom* tkhd = AP4_DYNAMIC_CAST(AP4_TkhdAtom, m_TrakAtom->FindChild("tkhd"));
- if(tkhd)
- {
+ if (tkhd) {
return tkhd->GetFlags();
}
}
@@ -277,11 +256,9 @@ AP4_Track::GetFlags()
AP4_Result
AP4_Track::SetFlags(AP4_UI32 flags)
{
- if(m_TrakAtom)
- {
+ if (m_TrakAtom) {
AP4_TkhdAtom* tkhd = AP4_DYNAMIC_CAST(AP4_TkhdAtom, m_TrakAtom->FindChild("tkhd"));
- if(tkhd)
- {
+ if (tkhd) {
tkhd->SetFlags(flags);
return AP4_SUCCESS;
}
@@ -295,11 +272,9 @@ AP4_Track::SetFlags(AP4_UI32 flags)
AP4_UI32
AP4_Track::GetHandlerType()
{
- if(m_TrakAtom)
- {
+ if (m_TrakAtom) {
AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, m_TrakAtom->FindChild("mdia/hdlr"));
- if(hdlr)
- {
+ if (hdlr) {
return hdlr->GetHandlerType();
}
}
@@ -376,7 +351,7 @@ AP4_Track::GetSampleCount()
/*----------------------------------------------------------------------
| AP4_Track::GetSample
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Track::GetSample(AP4_Ordinal index, AP4_Sample& sample)
{
// delegate to the sample table
@@ -396,8 +371,8 @@ AP4_Track::GetSampleDescription(AP4_Ordinal index)
/*----------------------------------------------------------------------
| AP4_Track::ReadSample
+---------------------------------------------------------------------*/
-AP4_Result
-AP4_Track::ReadSample(AP4_Ordinal index,
+AP4_Result
+AP4_Track::ReadSample(AP4_Ordinal index,
AP4_Sample& sample,
AP4_DataBuffer& data)
{
@@ -405,7 +380,7 @@ AP4_Track::ReadSample(AP4_Ordinal index,
// get the sample
result = GetSample(index, sample);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// read the data
return sample.ReadData(data);
@@ -414,7 +389,7 @@ AP4_Track::ReadSample(AP4_Ordinal index,
/*----------------------------------------------------------------------
| AP4_Track::GetSampleIndexForTimeStampMs
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_Track::GetSampleIndexForTimeStampMs(AP4_UI32 ts_ms, AP4_Ordinal& index)
{
// convert the ts in the timescale of the track's media
@@ -426,10 +401,10 @@ AP4_Track::GetSampleIndexForTimeStampMs(AP4_UI32 ts_ms, AP4_Ordinal& index)
/*----------------------------------------------------------------------
| AP4_Track::GetNearestSyncSampleIndex
+---------------------------------------------------------------------*/
-AP4_Ordinal
+AP4_Ordinal
AP4_Track::GetNearestSyncSampleIndex(AP4_Ordinal index, bool before /* = true */)
{
- if(m_SampleTable == NULL) return index;
+ if (m_SampleTable == NULL) return index;
return m_SampleTable->GetNearestSyncSampleIndex(index, before);
}
@@ -440,13 +415,13 @@ AP4_Result
AP4_Track::SetMovieTimeScale(AP4_UI32 time_scale)
{
// check that we can convert
- if(m_MovieTimeScale == 0) return AP4_FAILURE;
+ if (m_MovieTimeScale == 0) return AP4_FAILURE;
// convert from one time scale to the other
- m_TrakAtom->SetDuration(AP4_ConvertTime(m_TrakAtom->GetDuration(),
+ m_TrakAtom->SetDuration(AP4_ConvertTime(m_TrakAtom->GetDuration(),
m_MovieTimeScale,
time_scale));
-
+
// keep the new movie timescale
m_MovieTimeScale = time_scale;
@@ -459,7 +434,7 @@ AP4_Track::SetMovieTimeScale(AP4_UI32 time_scale)
AP4_UI32
AP4_Track::GetMediaTimeScale()
{
- return m_TrakAtom ? m_TrakAtom->GetMediaTimeScale() : 0;
+ return m_TrakAtom?m_TrakAtom->GetMediaTimeScale():0;
}
/*----------------------------------------------------------------------
@@ -468,7 +443,7 @@ AP4_Track::GetMediaTimeScale()
AP4_UI64
AP4_Track::GetMediaDuration()
{
- return m_TrakAtom ? m_TrakAtom->GetMediaDuration() : 0;
+ return m_TrakAtom?m_TrakAtom->GetMediaDuration():0;
}
/*----------------------------------------------------------------------
@@ -477,8 +452,7 @@ AP4_Track::GetMediaDuration()
const AP4_String
AP4_Track::GetTrackName()
{
- if(AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, m_TrakAtom->FindChild("mdia/hdlr")))
- {
+ if (AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, m_TrakAtom->FindChild("mdia/hdlr"))) {
return hdlr->GetHandlerName();
}
return NULL;
@@ -490,8 +464,7 @@ AP4_Track::GetTrackName()
const AP4_String
AP4_Track::GetTrackLanguage()
{
- if(AP4_MdhdAtom* mdhd = AP4_DYNAMIC_CAST(AP4_MdhdAtom, m_TrakAtom->FindChild("mdia/mdhd")))
- {
+ if (AP4_MdhdAtom* mdhd = AP4_DYNAMIC_CAST(AP4_MdhdAtom, m_TrakAtom->FindChild("mdia/mdhd"))) {
return mdhd->GetLanguage();
}
return NULL;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.h
index 33836d607..12b48560c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Track.h
@@ -63,12 +63,10 @@ const AP4_UI32 AP4_TRACK_FLAG_IN_PREVIEW = 0x0004;
/*----------------------------------------------------------------------
| AP4_Track
+---------------------------------------------------------------------*/
-class AP4_Track
-{
-public:
+class AP4_Track {
+ public:
// types
- typedef enum
- {
+ typedef enum {
TYPE_UNKNOWN = 0,
TYPE_AUDIO = 1,
TYPE_VIDEO = 2,
@@ -77,15 +75,15 @@ public:
TYPE_TEXT = 5,
TYPE_JPEG = 6,
TYPE_RTP = 7,
- // ==> Start patch MPC
- TYPE_SUBP = 8
- // <== End patch MPC
+ // ==> Start patch MPC
+ TYPE_SUBP = 8
+ // <== End patch MPC
} Type;
// methods
AP4_Track(Type type,
AP4_SampleTable* sample_table, // ownership is transfered to the AP4_Track object
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_UI32 movie_time_scale, // 0 = use default
AP4_UI64 track_duration, // in the movie timescale
AP4_UI32 media_time_scale,
@@ -93,24 +91,21 @@ public:
const char* language,
AP4_UI32 width, // in 16.16 fixed point
AP4_UI32 height); // in 16.16 fixed point
- AP4_Track(AP4_TrakAtom& atom,
+ AP4_Track(AP4_TrakAtom& atom,
AP4_ByteStream& sample_stream,
AP4_UI32 movie_time_scale);
virtual ~AP4_Track();
-
- /**
- * Clone a track. This is useful if you want to create a track from
- * a non-synthetic track (parsed from a file for example) and
+
+ /**
+ * Clone a track. This is useful if you want to create a track from
+ * a non-synthetic track (parsed from a file for example) and
* write it out
*/
AP4_Track* Clone(AP4_Result* result = NULL);
-
+
AP4_UI32 GetFlags();
AP4_Result SetFlags(AP4_UI32 flags);
- AP4_Track::Type GetType()
- {
- return m_Type;
- }
+ AP4_Track::Type GetType() { return m_Type; }
AP4_UI32 GetHandlerType();
AP4_UI64 GetDuration(); // in the timescale of the movie
AP4_UI32 GetDurationMs(); // in milliseconds
@@ -118,35 +113,26 @@ public:
AP4_UI32 GetHeight(); // in 16.16 fixed point
AP4_Cardinal GetSampleCount();
AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
- AP4_Result ReadSample(AP4_Ordinal index,
+ AP4_Result ReadSample(AP4_Ordinal index,
AP4_Sample& sample,
AP4_DataBuffer& data);
- AP4_Result GetSampleIndexForTimeStampMs(AP4_UI32 ts_ms,
- AP4_Ordinal& index);
- AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before = true);
+ AP4_Result GetSampleIndexForTimeStampMs(AP4_UI32 ts_ms,
+ AP4_Ordinal& index);
+ AP4_Ordinal GetNearestSyncSampleIndex(AP4_Ordinal index, bool before=true);
AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
- AP4_SampleTable* GetSampleTable()
- {
- return m_SampleTable;
- }
+ AP4_SampleTable* GetSampleTable() { return m_SampleTable; }
AP4_UI32 GetId();
AP4_Result SetId(AP4_UI32 track_id);
- AP4_TrakAtom* GetTrakAtom()
- {
- return m_TrakAtom;
- }
+ AP4_TrakAtom* GetTrakAtom() { return m_TrakAtom; }
AP4_Result SetMovieTimeScale(AP4_UI32 time_scale);
- AP4_UI32 GetMovieTimeScale()
- {
- return m_MovieTimeScale;
- }
+ AP4_UI32 GetMovieTimeScale() { return m_MovieTimeScale; }
AP4_UI32 GetMediaTimeScale();
AP4_UI64 GetMediaDuration(); // in the timescale of the media
const AP4_String GetTrackName();
const AP4_String GetTrackLanguage();
AP4_Result Attach(AP4_MoovAtom* moov);
-protected:
+ protected:
// members
AP4_TrakAtom* m_TrakAtom;
bool m_TrakAtomIsOwned;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.cpp
index b35a76284..57202f92e 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - trak Atoms
+| AP4 - trak Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -55,7 +55,7 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_TrakAtom)
+---------------------------------------------------------------------*/
AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
AP4_Atom::Type hdlr_type,
- const char* hdlr_name,
+ const char* hdlr_name,
AP4_UI32 track_id,
AP4_UI32 creation_time,
AP4_UI32 modification_time,
@@ -71,12 +71,12 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
AP4_Result result;
// create a tkhd atom
- m_TkhdAtom = new AP4_TkhdAtom(creation_time,
- modification_time,
+ m_TkhdAtom = new AP4_TkhdAtom(creation_time,
+ modification_time,
track_id,
- track_duration,
- volume,
- width,
+ track_duration,
+ volume,
+ width,
height);
// create an edts
@@ -87,24 +87,23 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
// create a hdlr atom for the mdia atom
AP4_HdlrAtom* hdlr = new AP4_HdlrAtom(hdlr_type, hdlr_name);
- // create a minf atom
+ // create a minf atom
AP4_ContainerAtom* minf = new AP4_ContainerAtom(AP4_ATOM_TYPE_MINF);
// create a media header atom for minf (vmhd, smhd, hmhd or nmhd)
AP4_Atom* minf_header;
- switch(hdlr_type)
- {
- case AP4_HANDLER_TYPE_VIDE:
- minf_header = new AP4_VmhdAtom(0, 0, 0, 0);
- break;
-
- case AP4_HANDLER_TYPE_SOUN:
- minf_header = new AP4_SmhdAtom(0);
- break;
-
- default:
- minf_header = new AP4_NmhdAtom();
- break;
+ switch (hdlr_type) {
+ case AP4_HANDLER_TYPE_VIDE:
+ minf_header = new AP4_VmhdAtom(0, 0, 0, 0);
+ break;
+
+ case AP4_HANDLER_TYPE_SOUN:
+ minf_header = new AP4_SmhdAtom(0);
+ break;
+
+ default:
+ minf_header = new AP4_NmhdAtom();
+ break;
}
// create a dinf atom for minf
@@ -119,15 +118,15 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
// create a stbl atom for minf
AP4_ContainerAtom* stbl;
result = sample_table->GenerateStblAtom(stbl);
- if(AP4_FAILED(result)) stbl = NULL;
-
+ if (AP4_FAILED(result)) stbl = NULL;
+
// populate the dinf atom
dinf->AddChild(dref);
// populate the minf atom
minf->AddChild(minf_header);
minf->AddChild(dinf);
- if(stbl) minf->AddChild(stbl);
+ if (stbl) minf->AddChild(stbl);
// create a mdhd atom for the mdia atom
m_MdhdAtom = new AP4_MdhdAtom(creation_time,
@@ -164,7 +163,7 @@ AP4_TrakAtom::AP4_TrakAtom(AP4_UI32 size,
AP4_UI32
AP4_TrakAtom::GetId()
{
- return m_TkhdAtom ? m_TkhdAtom->GetTrackId() : 0;
+ return m_TkhdAtom?m_TkhdAtom->GetTrackId():0;
}
/*----------------------------------------------------------------------
@@ -173,13 +172,10 @@ AP4_TrakAtom::GetId()
AP4_Result
AP4_TrakAtom::SetId(AP4_UI32 id)
{
- if(m_TkhdAtom)
- {
- m_TkhdAtom->SetTrackId(id);
+ if (m_TkhdAtom) {
+ m_TkhdAtom->SetTrackId(id);
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -190,7 +186,7 @@ AP4_TrakAtom::SetId(AP4_UI32 id)
AP4_UI32
AP4_TrakAtom::GetMediaTimeScale()
{
- return m_MdhdAtom ? m_MdhdAtom->GetTimeScale() : 0;
+ return m_MdhdAtom?m_MdhdAtom->GetTimeScale():0;
}
/*----------------------------------------------------------------------
@@ -199,13 +195,10 @@ AP4_TrakAtom::GetMediaTimeScale()
AP4_Result
AP4_TrakAtom::SetMediaTimeScale(AP4_UI32 timescale)
{
- if(m_MdhdAtom)
- {
- m_MdhdAtom->SetTimeScale(timescale);
+ if (m_MdhdAtom) {
+ m_MdhdAtom->SetTimeScale(timescale);
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -216,7 +209,7 @@ AP4_TrakAtom::SetMediaTimeScale(AP4_UI32 timescale)
AP4_UI64
AP4_TrakAtom::GetDuration()
{
- return m_TkhdAtom ? m_TkhdAtom->GetDuration() : 0;
+ return m_TkhdAtom?m_TkhdAtom->GetDuration():0;
}
/*----------------------------------------------------------------------
@@ -225,13 +218,10 @@ AP4_TrakAtom::GetDuration()
AP4_Result
AP4_TrakAtom::SetDuration(AP4_UI64 duration)
{
- if(m_TkhdAtom)
- {
+ if (m_TkhdAtom) {
m_TkhdAtom->SetDuration(duration);
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -242,7 +232,7 @@ AP4_TrakAtom::SetDuration(AP4_UI64 duration)
AP4_UI64
AP4_TrakAtom::GetMediaDuration()
{
- return m_MdhdAtom ? m_MdhdAtom->GetDuration() : 0;
+ return m_MdhdAtom?m_MdhdAtom->GetDuration():0;
}
/*----------------------------------------------------------------------
@@ -251,13 +241,10 @@ AP4_TrakAtom::GetMediaDuration()
AP4_Result
AP4_TrakAtom::SetMediaDuration(AP4_UI32 duration)
{
- if(m_MdhdAtom)
- {
+ if (m_MdhdAtom) {
m_MdhdAtom->SetDuration(duration);
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -268,7 +255,7 @@ AP4_TrakAtom::SetMediaDuration(AP4_UI32 duration)
AP4_UI32
AP4_TrakAtom::GetWidth()
{
- return m_TkhdAtom ? m_TkhdAtom->GetWidth() : 0;
+ return m_TkhdAtom?m_TkhdAtom->GetWidth():0;
}
/*----------------------------------------------------------------------
@@ -277,13 +264,10 @@ AP4_TrakAtom::GetWidth()
AP4_Result
AP4_TrakAtom::SetWidth(AP4_UI32 width)
{
- if(m_TkhdAtom)
- {
+ if (m_TkhdAtom) {
m_TkhdAtom->SetWidth(width);
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -294,7 +278,7 @@ AP4_TrakAtom::SetWidth(AP4_UI32 width)
AP4_UI32
AP4_TrakAtom::GetHeight()
{
- return m_TkhdAtom ? m_TkhdAtom->GetHeight() : 0;
+ return m_TkhdAtom?m_TkhdAtom->GetHeight():0;
}
/*----------------------------------------------------------------------
@@ -303,13 +287,10 @@ AP4_TrakAtom::GetHeight()
AP4_Result
AP4_TrakAtom::SetHeight(AP4_UI32 height)
{
- if(m_TkhdAtom)
- {
+ if (m_TkhdAtom) {
m_TkhdAtom->SetHeight(height);
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -317,22 +298,17 @@ AP4_TrakAtom::SetHeight(AP4_UI32 height)
/*----------------------------------------------------------------------
| AP4_TrakAtom::AdjustChunkOffsets
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_TrakAtom::AdjustChunkOffsets(AP4_SI64 delta)
{
AP4_Atom* atom;
- if((atom = FindChild("mdia/minf/stbl/stco")))
- {
+ if ((atom = FindChild("mdia/minf/stbl/stco"))) {
AP4_StcoAtom* stco = AP4_DYNAMIC_CAST(AP4_StcoAtom, atom);
return stco->AdjustChunkOffsets((int)delta);
- }
- else if((atom = FindChild("mdia/minf/stbl/co64")))
- {
+ } else if ((atom = FindChild("mdia/minf/stbl/co64"))) {
AP4_Co64Atom* co64 = AP4_DYNAMIC_CAST(AP4_Co64Atom, atom);
return co64->AdjustChunkOffsets(delta);
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -344,34 +320,27 @@ AP4_Result
AP4_TrakAtom::GetChunkOffsets(AP4_Array<AP4_UI64>& chunk_offsets)
{
AP4_Atom* atom;
- if((atom = FindChild("mdia/minf/stbl/stco")))
- {
+ if ((atom = FindChild("mdia/minf/stbl/stco"))) {
AP4_StcoAtom* stco = AP4_DYNAMIC_CAST(AP4_StcoAtom, atom);
- if(stco == NULL) return AP4_ERROR_INTERNAL;
+ if (stco == NULL) return AP4_ERROR_INTERNAL;
AP4_Cardinal stco_chunk_count = stco->GetChunkCount();
const AP4_UI32* stco_chunk_offsets = stco->GetChunkOffsets();
chunk_offsets.SetItemCount(stco_chunk_count);
- for(unsigned int i = 0; i < stco_chunk_count; i++)
- {
+ for (unsigned int i=0; i<stco_chunk_count; i++) {
chunk_offsets[i] = stco_chunk_offsets[i];
}
return AP4_SUCCESS;
- }
- else if((atom = FindChild("mdia/minf/stbl/co64")))
- {
+ } else if ((atom = FindChild("mdia/minf/stbl/co64"))) {
AP4_Co64Atom* co64 = AP4_DYNAMIC_CAST(AP4_Co64Atom, atom);
- if(co64 == NULL) return AP4_ERROR_INTERNAL;
+ if (co64 == NULL) return AP4_ERROR_INTERNAL;
AP4_Cardinal co64_chunk_count = co64->GetChunkCount();
const AP4_UI64* co64_chunk_offsets = co64->GetChunkOffsets();
chunk_offsets.SetItemCount(co64_chunk_count);
- for(unsigned int i = 0; i < co64_chunk_count; i++)
- {
+ for (unsigned int i=0; i<co64_chunk_count; i++) {
chunk_offsets[i] = co64_chunk_offsets[i];
}
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
@@ -383,40 +352,31 @@ AP4_Result
AP4_TrakAtom::SetChunkOffsets(const AP4_Array<AP4_UI64>& chunk_offsets)
{
AP4_Atom* atom;
- if((atom = FindChild("mdia/minf/stbl/stco")))
- {
+ if ((atom = FindChild("mdia/minf/stbl/stco"))) {
AP4_StcoAtom* stco = AP4_DYNAMIC_CAST(AP4_StcoAtom, atom);
- if(stco == NULL) return AP4_ERROR_INTERNAL;
+ if (stco == NULL) return AP4_ERROR_INTERNAL;
AP4_Cardinal stco_chunk_count = stco->GetChunkCount();
AP4_UI32* stco_chunk_offsets = stco->GetChunkOffsets();
- if(stco_chunk_count > chunk_offsets.ItemCount())
- {
+ if (stco_chunk_count > chunk_offsets.ItemCount()) {
return AP4_ERROR_OUT_OF_RANGE;
}
- for(unsigned int i = 0; i < stco_chunk_count; i++)
- {
+ for (unsigned int i=0; i<stco_chunk_count; i++) {
stco_chunk_offsets[i] = (AP4_UI32)chunk_offsets[i];
}
return AP4_SUCCESS;
- }
- else if((atom = FindChild("mdia/minf/stbl/co64")))
- {
+ } else if ((atom = FindChild("mdia/minf/stbl/co64"))) {
AP4_Co64Atom* co64 = AP4_DYNAMIC_CAST(AP4_Co64Atom, atom);
- if(co64 == NULL) return AP4_ERROR_INTERNAL;
+ if (co64 == NULL) return AP4_ERROR_INTERNAL;
AP4_Cardinal co64_chunk_count = co64->GetChunkCount();
AP4_UI64* co64_chunk_offsets = co64->GetChunkOffsets();
- if(co64_chunk_count > chunk_offsets.ItemCount())
- {
+ if (co64_chunk_count > chunk_offsets.ItemCount()) {
return AP4_ERROR_OUT_OF_RANGE;
}
- for(unsigned int i = 0; i < co64_chunk_count; i++)
- {
+ for (unsigned int i=0; i<co64_chunk_count; i++) {
co64_chunk_offsets[i] = chunk_offsets[i];
}
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_ERROR_INVALID_STATE;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.h
index 8aa57336f..8006375ee 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrakAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - trak Atoms
+| AP4 - trak Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -48,14 +48,13 @@ class AP4_SampleTable;
+---------------------------------------------------------------------*/
class AP4_TrakAtom : public AP4_ContainerAtom
{
-public:
+ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_TrakAtom, AP4_ContainerAtom)
// class methods
- static AP4_TrakAtom* Create(AP4_Size size,
- AP4_ByteStream& stream,
- AP4_AtomFactory& atom_factory)
- {
+ static AP4_TrakAtom* Create(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) {
return new AP4_TrakAtom(size, stream, atom_factory);
}
@@ -63,7 +62,7 @@ public:
AP4_TrakAtom(AP4_SampleTable* sample_table,
AP4_Atom::Type hdlr_type,
const char* hdlr_name,
- AP4_UI32 track_id,
+ AP4_UI32 track_id,
AP4_UI32 creation_time,
AP4_UI32 modification_time,
AP4_UI64 track_duration,
@@ -73,10 +72,7 @@ public:
const char* language,
AP4_UI32 width,
AP4_UI32 heigh);
- AP4_TkhdAtom* GetTkhdAtom()
- {
- return m_TkhdAtom;
- }
+ AP4_TkhdAtom* GetTkhdAtom() { return m_TkhdAtom; }
AP4_Result AdjustChunkOffsets(AP4_SI64 delta);
AP4_Result GetChunkOffsets(AP4_Array<AP4_UI64>& chunk_offsets);
AP4_Result SetChunkOffsets(const AP4_Array<AP4_UI64>& chunk_offsets);
@@ -92,8 +88,8 @@ public:
AP4_Result SetWidth(AP4_UI32 width);
AP4_UI32 GetHeight();
AP4_Result SetHeight(AP4_UI32 height);
-
-private:
+
+ private:
// methods
AP4_TrakAtom(AP4_UI32 size,
AP4_ByteStream& stream,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp
index aa97f3d45..bac78fd4c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tref type Atoms
+| AP4 - tref type Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -47,16 +47,15 @@ AP4_TrefTypeAtom::AP4_TrefTypeAtom(AP4_Atom::Type type) :
/*----------------------------------------------------------------------
| AP4_TrefTypeAtom::AP4_TrefTypeAtom
+---------------------------------------------------------------------*/
-AP4_TrefTypeAtom::AP4_TrefTypeAtom(AP4_Atom::Type type,
- AP4_UI32 size,
+AP4_TrefTypeAtom::AP4_TrefTypeAtom(AP4_Atom::Type type,
+ AP4_UI32 size,
AP4_ByteStream& stream) :
AP4_Atom(type, size)
{
AP4_Size data_size = size - 8; // size and atom type
-
+
// read the track ids
- while(data_size >= 4)
- {
+ while (data_size >= 4) {
AP4_UI32 track_id;
stream.ReadUI32(track_id);
m_TrackIds.Append(track_id);
@@ -71,8 +70,7 @@ AP4_Result
AP4_TrefTypeAtom::AddTrackId(AP4_UI32 track_id)
{
AP4_Result result = m_TrackIds.Append(track_id);
- if(AP4_SUCCEEDED(result))
- {
+ if (AP4_SUCCEEDED(result)) {
m_Size32 += 4;
}
return result;
@@ -87,10 +85,9 @@ AP4_TrefTypeAtom::WriteFields(AP4_ByteStream& stream)
AP4_Result result = AP4_SUCCESS;
AP4_Size track_id_count = m_TrackIds.ItemCount();
- for(AP4_Ordinal i = 0; i < track_id_count; i++)
- {
+ for (AP4_Ordinal i=0; i<track_id_count; i++) {
result = stream.WriteUI32(m_TrackIds[i]);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
@@ -103,9 +100,8 @@ AP4_Result
AP4_TrefTypeAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("track_id_count", m_TrackIds.ItemCount());
- for(AP4_Ordinal i = 0; i < m_TrackIds.ItemCount(); i++)
- {
- inspector.AddField("track id ", m_TrackIds[i]);
+ for (AP4_Ordinal i=0; i<m_TrackIds.ItemCount(); i++) {
+ inspector.AddField("track id ", m_TrackIds[i]);
}
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.h
index 129e03250..438f03f53 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrefTypeAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - tref type Atoms
+| AP4 - tref type Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -44,27 +44,23 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_TrefTypeAtom, AP4_Atom)
// class methods
- static AP4_TrefTypeAtom* Create(AP4_Atom::Type type,
- AP4_UI32 size,
- AP4_ByteStream& stream)
- {
+ static AP4_TrefTypeAtom* Create(AP4_Atom::Type type,
+ AP4_UI32 size,
+ AP4_ByteStream& stream) {
return new AP4_TrefTypeAtom(type, size, stream);
}
// contructor
AP4_TrefTypeAtom(AP4_Atom::Type type);
-
+
// methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
AP4_Result AddTrackId(AP4_UI32 track_id);
// accessors
- const AP4_Array<AP4_UI32>& GetTrackIds()
- {
- return m_TrackIds;
- }
-
+ const AP4_Array<AP4_UI32>& GetTrackIds() { return m_TrackIds; }
+
private:
// methods
AP4_TrefTypeAtom(AP4_Atom::Type type, AP4_UI32 size, AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.cpp
index 7e0a8effc..6745e764a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - trex Atoms
+| AP4 - trex Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -46,8 +46,8 @@ AP4_TrexAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_TrexAtom(size, version, flags, stream);
}
@@ -59,7 +59,7 @@ AP4_TrexAtom::AP4_TrexAtom(AP4_UI32 track_id,
AP4_UI32 default_sample_duration,
AP4_UI32 default_sample_size,
AP4_UI32 default_sample_flags) :
- AP4_Atom(AP4_ATOM_TYPE_TREX, AP4_FULL_ATOM_HEADER_SIZE + 20, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_TREX, AP4_FULL_ATOM_HEADER_SIZE+20, 0, 0),
m_TrackId(track_id),
m_DefaultSampleDescriptionIndex(default_sample_description_index),
m_DefaultSampleDuration(default_sample_duration),
@@ -71,7 +71,7 @@ AP4_TrexAtom::AP4_TrexAtom(AP4_UI32 track_id,
/*----------------------------------------------------------------------
| AP4_TrexAtom::AP4_TrexAtom
+---------------------------------------------------------------------*/
-AP4_TrexAtom::AP4_TrexAtom(AP4_UI32 size,
+AP4_TrexAtom::AP4_TrexAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.h
index a8b19126f..42cf1fa2d 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrexAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - trex Atoms
+| AP4 - trex Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -61,40 +61,25 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_UI32 GetTrackId()
- {
- return m_TrackId;
- }
- AP4_UI32 GetDefaultSampleDescriptionIndex()
- {
- return m_DefaultSampleDescriptionIndex;
- }
- AP4_UI32 GetDefaultSampleDuration()
- {
- return m_DefaultSampleDuration;
- }
- AP4_UI32 GetDefaultSampleSize()
- {
- return m_DefaultSampleSize;
- }
- AP4_UI32 GetDefaultSampleFlags()
- {
- return m_DefaultSampleFlags;
- }
+ AP4_UI32 GetTrackId() { return m_TrackId; }
+ AP4_UI32 GetDefaultSampleDescriptionIndex() { return m_DefaultSampleDescriptionIndex; }
+ AP4_UI32 GetDefaultSampleDuration() { return m_DefaultSampleDuration; }
+ AP4_UI32 GetDefaultSampleSize() { return m_DefaultSampleSize; }
+ AP4_UI32 GetDefaultSampleFlags() { return m_DefaultSampleFlags; }
private:
// methods
- AP4_TrexAtom(AP4_UI32 size,
+ AP4_TrexAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
- AP4_ByteStream& stream);
+ AP4_ByteStream& stream);
// members
- AP4_UI32 m_TrackId;
- AP4_UI32 m_DefaultSampleDescriptionIndex;
- AP4_UI32 m_DefaultSampleDuration;
- AP4_UI32 m_DefaultSampleSize;
- AP4_UI32 m_DefaultSampleFlags;
+ AP4_UI32 m_TrackId;
+ AP4_UI32 m_DefaultSampleDescriptionIndex;
+ AP4_UI32 m_DefaultSampleDuration;
+ AP4_UI32 m_DefaultSampleSize;
+ AP4_UI32 m_DefaultSampleFlags;
};
#endif // _AP4_TREX_ATOM_H_
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.cpp
index 56ee52726..e7d4ffc71 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - trun Atoms
+| AP4 - trun Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -45,22 +45,21 @@ AP4_TrunAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version > 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version > 0) return NULL;
return new AP4_TrunAtom(size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_TrunAtom::ComputeRecordFieldsCount
+---------------------------------------------------------------------*/
-unsigned int
+unsigned int
AP4_TrunAtom::ComputeRecordFieldsCount(AP4_UI32 flags)
{
// count the number of bits set to 1 in the second byte of the flags
unsigned int count = 0;
- for(unsigned int i = 0; i < 8; i++)
- {
- if(flags & (1 << (i + 8))) ++count;
+ for (unsigned int i=0; i<8; i++) {
+ if (flags & (1<<(i+8))) ++count;
}
return count;
}
@@ -68,14 +67,13 @@ AP4_TrunAtom::ComputeRecordFieldsCount(AP4_UI32 flags)
/*----------------------------------------------------------------------
| AP4_TrunAtom::ComputeOptionalFieldsCount
+---------------------------------------------------------------------*/
-unsigned int
+unsigned int
AP4_TrunAtom::ComputeOptionalFieldsCount(AP4_UI32 flags)
{
// count the number of bits set to 1 in the LSB of the flags
unsigned int count = 0;
- for(unsigned int i = 0; i < 8; i++)
- {
- if(flags & (1 << i)) ++count;
+ for (unsigned int i=0; i<8; i++) {
+ if (flags & (1<<i)) ++count;
}
return count;
}
@@ -83,20 +81,20 @@ AP4_TrunAtom::ComputeOptionalFieldsCount(AP4_UI32 flags)
/*----------------------------------------------------------------------
| AP4_TrunAtom::AP4_TrunAtom
+---------------------------------------------------------------------*/
-AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 flags,
+AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 flags,
AP4_SI32 data_offset,
AP4_UI32 first_sample_flags) :
- AP4_Atom(AP4_ATOM_TYPE_TRUN, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, flags),
+ AP4_Atom(AP4_ATOM_TYPE_TRUN, AP4_FULL_ATOM_HEADER_SIZE+4, 0, flags),
m_DataOffset(data_offset),
m_FirstSampleFlags(first_sample_flags)
{
- m_Size32 += 4 * ComputeOptionalFieldsCount(flags);
+ m_Size32 += 4*ComputeOptionalFieldsCount(flags);
}
/*----------------------------------------------------------------------
| AP4_TrunAtom::AP4_TrunAtom
+---------------------------------------------------------------------*/
-AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 size,
+AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -107,54 +105,45 @@ AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 size,
// read optional fields
int optional_fields_count = (int)ComputeOptionalFieldsCount(flags);
- if(flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT)
- {
+ if (flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT) {
AP4_UI32 offset = 0;
stream.ReadUI32(offset);
m_DataOffset = (AP4_SI32)offset;
--optional_fields_count;
}
- if(flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT)
- {
+ if (flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT) {
stream.ReadUI32(m_FirstSampleFlags);
--optional_fields_count;
}
-
- // discard unknown optional fields
- for(int i = 0; i < optional_fields_count; i++)
- {
+
+ // discard unknown optional fields
+ for (int i=0; i<optional_fields_count; i++) {
AP4_UI32 discard;
stream.ReadUI32(discard);
}
-
+
int record_fields_count = (int)ComputeRecordFieldsCount(flags);
m_Entries.SetItemCount(sample_count);
- for(unsigned int i = 0; i < sample_count; i++)
- {
- if(flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT)
- {
+ for (unsigned int i=0; i<sample_count; i++) {
+ if (flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) {
stream.ReadUI32(m_Entries[i].sample_duration);
--record_fields_count;
}
- if(flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT)
- {
+ if (flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT) {
stream.ReadUI32(m_Entries[i].sample_size);
--record_fields_count;
}
- if(flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT)
- {
+ if (flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT) {
stream.ReadUI32(m_Entries[i].sample_flags);
--record_fields_count;
}
- if(flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT)
- {
+ if (flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT) {
stream.ReadUI32(m_Entries[i].sample_composition_time_offset);
--record_fields_count;
}
-
- // skip unknown fields
- for(int j = 0; j < record_fields_count; j++)
- {
+
+ // skip unknown fields
+ for (int j=0;j<record_fields_count; j++) {
AP4_UI32 discard;
stream.ReadUI32(discard);
}
@@ -168,44 +157,37 @@ AP4_Result
AP4_TrunAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
-
+
result = stream.WriteUI32(m_Entries.ItemCount());
- if(AP4_FAILED(result)) return result;
- if(m_Flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT)
- {
+ if (AP4_FAILED(result)) return result;
+ if (m_Flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT) {
result = stream.WriteUI32((AP4_UI32)m_DataOffset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT) {
result = stream.WriteUI32(m_FirstSampleFlags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
AP4_UI32 sample_count = m_Entries.ItemCount();
- for(unsigned int i = 0; i < sample_count; i++)
- {
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT)
- {
+ for (unsigned int i=0; i<sample_count; i++) {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) {
result = stream.WriteUI32(m_Entries[i].sample_duration);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT) {
result = stream.WriteUI32(m_Entries[i].sample_size);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT) {
result = stream.WriteUI32(m_Entries[i].sample_flags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT) {
stream.WriteUI32(m_Entries[i].sample_composition_time_offset);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
}
-
+
return AP4_SUCCESS;
}
@@ -216,19 +198,15 @@ AP4_Result
AP4_TrunAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("sample count", m_Entries.ItemCount());
- if(m_Flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT) {
inspector.AddField("data offset", m_DataOffset);
}
- if(m_Flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT) {
inspector.AddField("first sample flags", m_FirstSampleFlags, AP4_AtomInspector::HINT_HEX);
}
- if(inspector.GetVerbosity() >= 1)
- {
- AP4_UI32 sample_count = m_Entries.ItemCount();
- for(unsigned int i = 0; i < sample_count; i++)
- {
+ if (inspector.GetVerbosity() >= 1) {
+ AP4_UI32 sample_count = m_Entries.ItemCount();
+ for (unsigned int i=0; i<sample_count; i++) {
char header[32];
AP4_FormatString(header, sizeof(header), "entry %04d", i);
char v0[32];
@@ -239,23 +217,19 @@ AP4_TrunAtom::InspectFields(AP4_AtomInspector& inspector)
const char* s1 = "";
const char* s2 = "";
const char* s3 = "";
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) {
AP4_FormatString(v0, sizeof(v0), "sample duration:%d", m_Entries[i].sample_duration);
s0 = v0;
}
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT) {
AP4_FormatString(v1, sizeof(v1), "sample size:%d", m_Entries[i].sample_size);
s1 = v1;
}
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT) {
AP4_FormatString(v2, sizeof(v2), "sample flags:%x", m_Entries[i].sample_flags);
s2 = v2;
}
- if(m_Flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT)
- {
+ if (m_Flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT) {
AP4_FormatString(v3, sizeof(v3), "sample composition time offset:%d", m_Entries[i].sample_composition_time_offset);
s3 = v3;
}
@@ -264,6 +238,6 @@ AP4_TrunAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField(header, value);
}
}
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.h
index fe4c43700..9bdc382b3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4TrunAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - trun Atoms
+| AP4 - trun Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -54,44 +54,34 @@ public:
AP4_IMPLEMENT_DYNAMIC_CAST(AP4_TrunAtom)
// types
- struct Entry
- {
+ struct Entry {
Entry() : sample_duration(0), sample_size(0), sample_flags(0), sample_composition_time_offset(0) {}
AP4_UI32 sample_duration;
AP4_UI32 sample_size;
AP4_UI32 sample_flags;
AP4_UI32 sample_composition_time_offset;
};
-
+
// class methods
static AP4_TrunAtom* Create(AP4_Size size, AP4_ByteStream& stream);
static unsigned int ComputeOptionalFieldsCount(AP4_UI32 flags);
static unsigned int ComputeRecordFieldsCount(AP4_UI32 flags);
// methods
- AP4_TrunAtom(AP4_UI32 flags,
+ AP4_TrunAtom(AP4_UI32 flags,
AP4_SI32 data_offset,
AP4_UI32 first_sample_flags);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- AP4_SI32 GetDataOffset()
- {
- return m_DataOffset;
- }
- AP4_UI32 GetFirstSampleFlags()
- {
- return m_FirstSampleFlags;
- }
- const AP4_Array<Entry>& GetEntries()
- {
- return m_Entries;
- }
-
+ AP4_SI32 GetDataOffset() { return m_DataOffset; }
+ AP4_UI32 GetFirstSampleFlags() { return m_FirstSampleFlags; }
+ const AP4_Array<Entry>& GetEntries() { return m_Entries; }
+
private:
// methods
- AP4_TrunAtom(AP4_UI32 size,
+ AP4_TrunAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Types.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Types.h
index 0d42b8043..86409c337 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Types.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Types.h
@@ -52,22 +52,21 @@ typedef unsigned long AP4_Size;
// the rest depends on whether the platform supports 64-bit integers
#if defined(AP4_CONFIG_HAVE_INT64)
-// we have 64-bit integers
-typedef AP4_CONFIG_INT64_TYPE AP4_SI64;
-typedef unsigned AP4_CONFIG_INT64_TYPE AP4_UI64;
-typedef unsigned AP4_CONFIG_INT64_TYPE AP4_LargeSize;
-typedef AP4_CONFIG_INT64_TYPE AP4_Offset;
-typedef unsigned AP4_CONFIG_INT64_TYPE AP4_Position;
+ // we have 64-bit integers
+ typedef AP4_CONFIG_INT64_TYPE AP4_SI64;
+ typedef unsigned AP4_CONFIG_INT64_TYPE AP4_UI64;
+ typedef unsigned AP4_CONFIG_INT64_TYPE AP4_LargeSize;
+ typedef AP4_CONFIG_INT64_TYPE AP4_Offset;
+ typedef unsigned AP4_CONFIG_INT64_TYPE AP4_Position;
#else
-// use only 32-bit integers
-typedef struct
-{
- AP4_UI32 hi;
- AP4_UI32 lo;
-} AP4_UI64, AP4_SI64;
-typedef unsigned long AP4_LargeSize;
-typedef long AP4_Offset;
-typedef unsigned long AP4_Position;
+ // use only 32-bit integers
+ typedef struct {
+ AP4_UI32 hi;
+ AP4_UI32 lo;
+ } AP4_UI64, AP4_SI64;
+ typedef unsigned long AP4_LargeSize;
+ typedef long AP4_Offset;
+ typedef unsigned long AP4_Position;
#endif
#ifndef NULL
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.cpp
index 0989e8d58..8659d9837 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - url Atoms
+| AP4 - url Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -41,8 +41,8 @@ AP4_UrlAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_UrlAtom(size, version, flags, stream);
}
@@ -57,18 +57,16 @@ AP4_UrlAtom::AP4_UrlAtom() :
/*----------------------------------------------------------------------
| AP4_UrlAtom::AP4_UrlAtom
+---------------------------------------------------------------------*/
-AP4_UrlAtom::AP4_UrlAtom(AP4_UI32 size,
+AP4_UrlAtom::AP4_UrlAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_URL, size, version, flags)
{
- if((m_Flags & 1) == 0)
- {
+ if ((m_Flags & 1) == 0) {
// not self contained
- AP4_Size str_size = size - AP4_FULL_ATOM_HEADER_SIZE;
- if(str_size > 0)
- {
+ AP4_Size str_size = size-AP4_FULL_ATOM_HEADER_SIZE;
+ if (str_size > 0) {
char* str = new char[str_size];
stream.Read(str, str_size);
str[str_size-1] = '\0'; // force null-termination
@@ -84,22 +82,18 @@ AP4_UrlAtom::AP4_UrlAtom(AP4_UI32 size,
AP4_Result
AP4_UrlAtom::WriteFields(AP4_ByteStream& stream)
{
- if(m_Flags & 1)
- {
+ if (m_Flags & 1) {
// local ref (self contained)
return AP4_SUCCESS;
- }
- else
- {
+ } else {
// url (not self contained)
- if(m_Size32 > AP4_FULL_ATOM_HEADER_SIZE)
- {
- AP4_Result result = stream.Write(m_Url.GetChars(), m_Url.GetLength() + 1);
- if(AP4_FAILED(result)) return result;
+ if (m_Size32 > AP4_FULL_ATOM_HEADER_SIZE) {
+ AP4_Result result = stream.Write(m_Url.GetChars(), m_Url.GetLength()+1);
+ if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
- AP4_Size padding = m_Size32 - (AP4_FULL_ATOM_HEADER_SIZE + m_Url.GetLength() + 1);
- while(padding--) stream.WriteUI08(0);
+ AP4_Size padding = m_Size32-(AP4_FULL_ATOM_HEADER_SIZE+m_Url.GetLength()+1);
+ while (padding--) stream.WriteUI08(0);
}
return AP4_SUCCESS;
}
@@ -111,12 +105,9 @@ AP4_UrlAtom::WriteFields(AP4_ByteStream& stream)
AP4_Result
AP4_UrlAtom::InspectFields(AP4_AtomInspector& inspector)
{
- if(m_Flags & 1)
- {
+ if (m_Flags & 1) {
inspector.AddField("location", "[local to file]");
- }
- else
- {
+ } else {
inspector.AddField("location", m_Url.GetChars());
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.h
index 001dc8ef6..3e354f70c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UrlAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - url Atoms
+| AP4 - url Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -51,7 +51,7 @@ public:
private:
// methods
- AP4_UrlAtom(AP4_UI32 size,
+ AP4_UrlAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.cpp
index b7a8d81dd..ef7834a3c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.cpp
@@ -40,7 +40,7 @@ AP4_BytesToDoubleBE(const unsigned char* bytes)
AP4_UI64 i_value = AP4_BytesToUInt64BE(bytes);
void* v_value = reinterpret_cast<void*>(&i_value);
double* d_value = reinterpret_cast<double*>(v_value);
-
+
return *d_value;
}
@@ -50,15 +50,15 @@ AP4_BytesToDoubleBE(const unsigned char* bytes)
AP4_UI64
AP4_BytesToUInt64BE(const unsigned char* bytes)
{
- return
- (((AP4_UI64)bytes[0]) << 56) |
- (((AP4_UI64)bytes[1]) << 48) |
- (((AP4_UI64)bytes[2]) << 40) |
- (((AP4_UI64)bytes[3]) << 32) |
- (((AP4_UI64)bytes[4]) << 24) |
- (((AP4_UI64)bytes[5]) << 16) |
- (((AP4_UI64)bytes[6]) << 8) |
- (((AP4_UI64)bytes[7]));
+ return
+ ( ((AP4_UI64)bytes[0])<<56 ) |
+ ( ((AP4_UI64)bytes[1])<<48 ) |
+ ( ((AP4_UI64)bytes[2])<<40 ) |
+ ( ((AP4_UI64)bytes[3])<<32 ) |
+ ( ((AP4_UI64)bytes[4])<<24 ) |
+ ( ((AP4_UI64)bytes[5])<<16 ) |
+ ( ((AP4_UI64)bytes[6])<<8 ) |
+ ( ((AP4_UI64)bytes[7]) );
}
/*----------------------------------------------------------------------
@@ -69,7 +69,7 @@ AP4_BytesFromDoubleBE(unsigned char* bytes, double value)
{
void* v_value = reinterpret_cast<void*>(&value);
AP4_UI64* i_value = reinterpret_cast<AP4_UI64*>(v_value);
-
+
AP4_BytesFromUInt64BE(bytes, *i_value);
}
@@ -86,7 +86,7 @@ AP4_BytesFromUInt64BE(unsigned char* bytes, AP4_UI64 value)
bytes[4] = (unsigned char)(value >> 24);
bytes[5] = (unsigned char)(value >> 16);
bytes[6] = (unsigned char)(value >> 8);
- bytes[7] = (unsigned char)(value);
+ bytes[7] = (unsigned char)(value );
}
/*----------------------------------------------------------------------
@@ -95,33 +95,32 @@ AP4_BytesFromUInt64BE(unsigned char* bytes, AP4_UI64 value)
AP4_UI32
AP4_DurationMsFromUnits(AP4_UI64 units, AP4_UI32 units_per_second)
{
- if(units_per_second == 0) return 0;
- return (AP4_UI32)(((double)units * 1000.0) / (double)units_per_second);
+ if (units_per_second == 0) return 0;
+ return (AP4_UI32)(((double)units*1000.0)/(double)units_per_second);
}
/*----------------------------------------------------------------------
| AP4_ConvertTime
+---------------------------------------------------------------------*/
-AP4_UI64
+AP4_UI64
AP4_ConvertTime(AP4_UI64 time_value,
AP4_UI32 from_time_scale,
AP4_UI32 to_time_scale)
{
- if(from_time_scale == 0) return 0;
- double ratio = (double)to_time_scale / (double)from_time_scale;
- return ((AP4_UI64)((double)time_value * ratio));
+ if (from_time_scale == 0) return 0;
+ double ratio = (double)to_time_scale/(double)from_time_scale;
+ return ((AP4_UI64)((double)time_value*ratio));
}
/*----------------------------------------------------------------------
| AP4_FormatFourChars
+---------------------------------------------------------------------*/
void
-AP4_FormatFourChars(char* str, AP4_UI32 value)
-{
+AP4_FormatFourChars(char* str, AP4_UI32 value) {
str[0] = (value >> 24) & 0xFF;
str[1] = (value >> 16) & 0xFF;
str[2] = (value >> 8) & 0xFF;
- str[3] = (value) & 0xFF;
+ str[3] = (value ) & 0xFF;
str[4] = '\0';
}
@@ -129,13 +128,10 @@ AP4_FormatFourChars(char* str, AP4_UI32 value)
| AP4_FormatFourCharsPrintable
+---------------------------------------------------------------------*/
void
-AP4_FormatFourCharsPrintable(char* str, AP4_UI32 value)
-{
+AP4_FormatFourCharsPrintable(char* str, AP4_UI32 value) {
AP4_FormatFourChars(str, value);
- for(int i = 0; i < 4; i++)
- {
- if(str[i] < ' ' || str[i] >= 127)
- {
+ for (int i=0; i<4; i++) {
+ if (str[i]<' ' || str[i] >= 127) {
str[i] = '.';
}
}
@@ -149,18 +145,14 @@ AP4_SplitArgs(char* arg, char*& arg0, char*& arg1)
{
arg0 = arg;
char* c = arg;
- while(*c != 0 && *c != ':')
- {
+ while (*c != 0 && *c != ':') {
c++;
}
- if(*c == ':')
- {
+ if (*c == ':') {
*c++ = '\0';
arg1 = c;
return AP4_SUCCESS;
- }
- else
- {
+ } else {
return AP4_FAILURE;
}
}
@@ -172,7 +164,7 @@ AP4_Result
AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2)
{
AP4_Result result = AP4_SplitArgs(arg, arg0, arg1);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SplitArgs(arg1, arg1, arg2);
}
@@ -182,48 +174,24 @@ AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2)
unsigned char
AP4_HexNibble(char c)
{
- switch(c)
- {
- case '0':
- return 0;
- case '1':
- return 1;
- case '2':
- return 2;
- case '3':
- return 3;
- case '4':
- return 4;
- case '5':
- return 5;
- case '6':
- return 6;
- case '7':
- return 7;
- case '8':
- return 8;
- case '9':
- return 9;
- case 'a':
- case 'A':
- return 10;
- case 'b':
- case 'B':
- return 11;
- case 'c':
- case 'C':
- return 12;
- case 'd':
- case 'D':
- return 13;
- case 'e':
- case 'E':
- return 14;
- case 'f':
- case 'F':
- return 15;
- default:
- return 0;
+ switch (c) {
+ case '0': return 0;
+ case '1': return 1;
+ case '2': return 2;
+ case '3': return 3;
+ case '4': return 4;
+ case '5': return 5;
+ case '6': return 6;
+ case '7': return 7;
+ case '8': return 8;
+ case '9': return 9;
+ case 'a': case 'A': return 10;
+ case 'b': case 'B': return 11;
+ case 'c': case 'C': return 12;
+ case 'd': case 'D': return 13;
+ case 'e': case 'E': return 14;
+ case 'f': case 'F': return 15;
+ default: return 0;
}
}
@@ -231,18 +199,13 @@ AP4_HexNibble(char c)
| AP4_NibbleHex
+---------------------------------------------------------------------*/
char
-AP4_NibbleHex(unsigned int nibble)
+AP4_NibbleHex(unsigned int nibble)
{
- if(nibble < 10)
- {
- return '0' + nibble;
- }
- else if(nibble < 16)
- {
- return 'A' + (nibble - 10);
- }
- else
- {
+ if (nibble < 10) {
+ return '0'+nibble;
+ } else if (nibble < 16) {
+ return 'A'+(nibble-10);
+ } else {
return ' ';
}
}
@@ -253,9 +216,8 @@ AP4_NibbleHex(unsigned int nibble)
AP4_Result
AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count)
{
- if(AP4_StringLength(hex) != 2 * count) return AP4_ERROR_INVALID_PARAMETERS;
- for(unsigned int i = 0; i < count; i++)
- {
+ if (AP4_StringLength(hex) != 2*count) return AP4_ERROR_INVALID_PARAMETERS;
+ for (unsigned int i=0; i<count; i++) {
bytes[i] = (AP4_HexNibble(hex[2*i]) << 4) | (AP4_HexNibble(hex[2*i+1]));
}
return AP4_SUCCESS;
@@ -267,37 +229,32 @@ AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count)
AP4_Result
AP4_FormatHex(const AP4_UI08* data, unsigned int data_size, char* hex)
{
- for(unsigned int i = 0; i < data_size; i++)
- {
- *hex++ = AP4_NibbleHex(data[i] >> 4);
- *hex++ = AP4_NibbleHex(data[i] & 0x0F);
+ for (unsigned int i=0; i<data_size; i++) {
+ *hex++ = AP4_NibbleHex(data[i]>>4);
+ *hex++ = AP4_NibbleHex(data[i]&0x0F);
}
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_BitWriter::Write
+---------------------------------------------------------------------*/
-void
+void
AP4_BitWriter::Write(AP4_UI32 bits, unsigned int bit_count)
{
unsigned char* data = m_Data;
- if(m_BitCount + bit_count > m_DataSize * 8) return;
- data += m_BitCount / 8;
- unsigned int space = 8 - (m_BitCount % 8);
- while(bit_count)
- {
- unsigned int mask = bit_count == 32 ? 0xFFFFFFFF : ((1 << bit_count) - 1);
- if(bit_count <= space)
- {
- *data |= ((bits & mask) << (space - bit_count));
+ if (m_BitCount+bit_count > m_DataSize*8) return;
+ data += m_BitCount/8;
+ unsigned int space = 8-(m_BitCount%8);
+ while (bit_count) {
+ unsigned int mask = bit_count==32 ? 0xFFFFFFFF : ((1<<bit_count)-1);
+ if (bit_count <= space) {
+ *data |= ((bits&mask) << (space-bit_count));
m_BitCount += bit_count;
return;
- }
- else
- {
- *data |= ((bits & mask) >> (bit_count - space));
+ } else {
+ *data |= ((bits&mask) >> (bit_count-space));
++data;
m_BitCount += space;
bit_count -= space;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.h
index df3f9c228..e2d3b6c93 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4Utils.h
@@ -51,11 +51,11 @@ void AP4_BytesFromUInt64BE(unsigned char* bytes, AP4_UI64 value);
inline AP4_UI32
AP4_BytesToUInt32BE(const unsigned char* bytes)
{
- return
- (((AP4_UI32)bytes[0]) << 24) |
- (((AP4_UI32)bytes[1]) << 16) |
- (((AP4_UI32)bytes[2]) << 8) |
- (((AP4_UI32)bytes[3]));
+ return
+ ( ((AP4_UI32)bytes[0])<<24 ) |
+ ( ((AP4_UI32)bytes[1])<<16 ) |
+ ( ((AP4_UI32)bytes[2])<<8 ) |
+ ( ((AP4_UI32)bytes[3]) );
}
/*----------------------------------------------------------------------
@@ -73,10 +73,10 @@ AP4_BytesToInt32BE(const unsigned char* bytes)
inline AP4_UI32
AP4_BytesToUInt24BE(const unsigned char* bytes)
{
- return
- (((AP4_UI32)bytes[0]) << 16) |
- (((AP4_UI32)bytes[1]) << 8) |
- (((AP4_UI32)bytes[2]));
+ return
+ ( ((AP4_UI32)bytes[0])<<16 ) |
+ ( ((AP4_UI32)bytes[1])<<8 ) |
+ ( ((AP4_UI32)bytes[2]) );
}
/*----------------------------------------------------------------------
@@ -85,9 +85,9 @@ AP4_BytesToUInt24BE(const unsigned char* bytes)
inline AP4_UI16
AP4_BytesToUInt16BE(const unsigned char* bytes)
{
- return
- (((AP4_UI16)bytes[0]) << 8) |
- (((AP4_UI16)bytes[1]));
+ return
+ ( ((AP4_UI16)bytes[0])<<8 ) |
+ ( ((AP4_UI16)bytes[1]) );
}
/*----------------------------------------------------------------------
@@ -108,7 +108,7 @@ AP4_BytesFromUInt32BE(unsigned char* bytes, AP4_UI32 value)
bytes[0] = (unsigned char)(value >> 24);
bytes[1] = (unsigned char)(value >> 16);
bytes[2] = (unsigned char)(value >> 8);
- bytes[3] = (unsigned char)(value);
+ bytes[3] = (unsigned char)(value );
}
/*----------------------------------------------------------------------
@@ -119,7 +119,7 @@ AP4_BytesFromUInt24BE(unsigned char* bytes, AP4_UI32 value)
{
bytes[0] = (unsigned char)(value >> 16);
bytes[1] = (unsigned char)(value >> 8);
- bytes[2] = (unsigned char)(value);
+ bytes[2] = (unsigned char)(value );
}
/*----------------------------------------------------------------------
@@ -129,7 +129,7 @@ inline void
AP4_BytesFromUInt16BE(unsigned char* bytes, AP4_UI16 value)
{
bytes[0] = (unsigned char)(value >> 8);
- bytes[1] = (unsigned char)(value);
+ bytes[1] = (unsigned char)(value );
}
/*----------------------------------------------------------------------
@@ -187,34 +187,21 @@ AP4_SplitArgs(char* arg, char*& arg0, char*& arg1);
class AP4_BitWriter
{
public:
- AP4_BitWriter(AP4_Size size) : m_DataSize(size), m_BitCount(0)
- {
- if(size)
- {
+ AP4_BitWriter(AP4_Size size) : m_DataSize(size), m_BitCount(0) {
+ if (size) {
m_Data = new unsigned char[size];
AP4_SetMemory(m_Data, 0, size);
- }
- else
- {
+ } else {
m_Data = NULL;
}
}
- ~AP4_BitWriter()
- {
- delete m_Data;
- }
-
+ ~AP4_BitWriter() { delete m_Data; }
+
void Write(AP4_UI32 bits, unsigned int bit_count);
-
- unsigned int GetBitCount()
- {
- return m_BitCount;
- }
- const unsigned char* GetData()
- {
- return m_Data;
- }
-
+
+ unsigned int GetBitCount() { return m_BitCount; }
+ const unsigned char* GetData() { return m_Data; }
+
private:
unsigned char* m_Data;
unsigned int m_DataSize;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.cpp
index 27981438d..e71eced66 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - UUID Atoms
+| AP4 - UUID Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -36,7 +36,7 @@
/*----------------------------------------------------------------------
| AP4_UuidAtom::AP4_UuidAtom
+---------------------------------------------------------------------*/
-AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid) :
+AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid) :
AP4_Atom(AP4_ATOM_TYPE_UUID, size)
{
AP4_CopyMemory(m_Uuid, uuid, 16);
@@ -45,7 +45,7 @@ AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid) :
/*----------------------------------------------------------------------
| AP4_UuidAtom::AP4_UuidAtom
+---------------------------------------------------------------------*/
-AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid, AP4_UI32 version, AP4_UI32 flags) :
+AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid, AP4_UI32 version, AP4_UI32 flags) :
AP4_Atom(AP4_ATOM_TYPE_UUID, size, false, version, flags)
{
AP4_CopyMemory(m_Uuid, uuid, 16);
@@ -54,11 +54,10 @@ AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid, AP4_UI32 version
/*----------------------------------------------------------------------
| AP4_UuidAtom::AP4_UuidAtom
+---------------------------------------------------------------------*/
-AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, bool is_full, AP4_ByteStream& stream) :
+AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, bool is_full, AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_UUID, size)
{
- if(is_full)
- {
+ if (is_full) {
m_IsFull = true;
ReadFullHeader(stream, m_Version, m_Flags);
}
@@ -70,7 +69,7 @@ AP4_UuidAtom::AP4_UuidAtom(AP4_UI64 size, bool is_full, AP4_ByteStream& stream)
AP4_Size
AP4_UuidAtom::GetHeaderSize() const
{
- return (m_IsFull ? AP4_FULL_UUID_ATOM_HEADER_SIZE : AP4_UUID_ATOM_HEADER_SIZE) + (m_Size32 == 1 ? 8 : 0);
+ return (m_IsFull ? AP4_FULL_UUID_ATOM_HEADER_SIZE : AP4_UUID_ATOM_HEADER_SIZE)+(m_Size32==1?8:0);
}
/*----------------------------------------------------------------------
@@ -83,30 +82,28 @@ AP4_UuidAtom::WriteHeader(AP4_ByteStream& stream)
// write the size
result = stream.WriteUI32(m_Size32);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// write the type
result = stream.WriteUI32(m_Type);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// handle 64-bit sizes
- if(m_Size32 == 1)
- {
+ if (m_Size32 == 1) {
result = stream.WriteUI64(m_Size64);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
- // write the extended type
+ // write the extended type
result = stream.Write(m_Uuid, 16);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// for full atoms, write version and flags
- if(m_IsFull)
- {
+ if (m_IsFull) {
result = stream.WriteUI08(m_Version);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
result = stream.WriteUI24(m_Flags);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
@@ -121,13 +118,12 @@ AP4_UuidAtom::InspectHeader(AP4_AtomInspector& inspector)
char uuid[37];
uuid[36] = '\0';
char* dst = uuid;
- for(unsigned int i = 0; i < 16; i++)
- {
- *dst++ = AP4_NibbleHex(m_Uuid[i] >> 4);
- *dst++ = AP4_NibbleHex(m_Uuid[i] & 0x0F);
- if(i == 5 || i == 7 || i == 9 || i == 11) *dst++ = '-';
+ for (unsigned int i=0; i<16; i++) {
+ *dst++ = AP4_NibbleHex(m_Uuid[i]>>4);
+ *dst++ = AP4_NibbleHex(m_Uuid[i]&0x0F);
+ if (i == 5 || i == 7 || i == 9 || i == 11) *dst++ = '-';
}
-
+
// write atom name
char name[7];
name[0] = '[';
@@ -136,33 +132,27 @@ AP4_UuidAtom::InspectHeader(AP4_AtomInspector& inspector)
name[6] = '\0';
char header[128];
char extra[32] = "";
- if(m_IsFull)
- {
- if(m_Version && m_Flags)
- {
- AP4_FormatString(extra, sizeof(extra),
+ if (m_IsFull) {
+ if (m_Version && m_Flags) {
+ AP4_FormatString(extra, sizeof(extra),
", version=%d, flags=%x",
m_Version,
m_Flags);
- }
- else if(m_Version)
- {
- AP4_FormatString(extra, sizeof(extra),
+ } else if (m_Version) {
+ AP4_FormatString(extra, sizeof(extra),
", version=%d",
m_Version);
- }
- else if(m_Flags)
- {
- AP4_FormatString(extra, sizeof(extra),
+ } else if (m_Flags) {
+ AP4_FormatString(extra, sizeof(extra),
", flags=%x",
m_Flags);
}
}
- AP4_FormatString(header, sizeof(header),
- "{%s} size=%ld+%lld%s",
+ AP4_FormatString(header, sizeof(header),
+ "{%s} size=%ld+%lld%s",
uuid,
- GetHeaderSize(),
- GetSize() - GetHeaderSize(),
+ GetHeaderSize(),
+ GetSize()-GetHeaderSize(),
extra);
inspector.StartElement(name, header);
@@ -172,22 +162,22 @@ AP4_UuidAtom::InspectHeader(AP4_AtomInspector& inspector)
/*----------------------------------------------------------------------
| AP4_UnknownUuidAtom::AP4_UnknownUuidAtom
+---------------------------------------------------------------------*/
-AP4_UnknownUuidAtom::AP4_UnknownUuidAtom(AP4_UI64 size, AP4_ByteStream& stream) :
+AP4_UnknownUuidAtom::AP4_UnknownUuidAtom(AP4_UI64 size, AP4_ByteStream& stream) :
AP4_UuidAtom(size, false, stream)
{
// store the data
- m_Data.SetDataSize((AP4_Size)size - GetHeaderSize());
+ m_Data.SetDataSize((AP4_Size)size-GetHeaderSize());
stream.Read(m_Data.UseData(), m_Data.GetDataSize());
}
/*----------------------------------------------------------------------
| AP4_UnknownUuidAtom::AP4_UnknownUuidAtom
+---------------------------------------------------------------------*/
-AP4_UnknownUuidAtom::AP4_UnknownUuidAtom(AP4_UI64 size, const AP4_UI08* uuid, AP4_ByteStream& stream) :
+AP4_UnknownUuidAtom::AP4_UnknownUuidAtom(AP4_UI64 size, const AP4_UI08* uuid, AP4_ByteStream& stream) :
AP4_UuidAtom(size, uuid)
{
// store the data
- m_Data.SetDataSize((AP4_Size)size - GetHeaderSize());
+ m_Data.SetDataSize((AP4_Size)size-GetHeaderSize());
stream.Read(m_Data.UseData(), m_Data.GetDataSize());
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.h
index 763fd53cd..2c425193a 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4UuidAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - UUID Atoms
+| AP4 - UUID Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -26,7 +26,7 @@
|
****************************************************************/
/**
-* @file
+* @file
* @brief UUID Atoms
*/
@@ -42,8 +42,8 @@
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-const AP4_UI32 AP4_UUID_ATOM_HEADER_SIZE = AP4_ATOM_HEADER_SIZE + 16;
-const AP4_UI32 AP4_FULL_UUID_ATOM_HEADER_SIZE = AP4_FULL_ATOM_HEADER_SIZE + 16;
+const AP4_UI32 AP4_UUID_ATOM_HEADER_SIZE = AP4_ATOM_HEADER_SIZE+16;
+const AP4_UI32 AP4_FULL_UUID_ATOM_HEADER_SIZE = AP4_FULL_ATOM_HEADER_SIZE+16;
/*----------------------------------------------------------------------
| AP4_UuidAtom
@@ -51,8 +51,7 @@ const AP4_UI32 AP4_FULL_UUID_ATOM_HEADER_SIZE = AP4_FULL_ATOM_HEADER_SIZE + 16;
/**
* Base class for uuid atoms.
*/
-class AP4_UuidAtom : public AP4_Atom
-{
+class AP4_UuidAtom : public AP4_Atom {
public:
// constructor and destructor
virtual ~AP4_UuidAtom() {};
@@ -63,11 +62,8 @@ public:
virtual AP4_Result InspectHeader(AP4_AtomInspector& inspector);
// accessors
- const AP4_UI08* GetUuid()
- {
- return m_Uuid;
- }
-
+ const AP4_UI08* GetUuid() { return m_Uuid; }
+
protected:
// members
AP4_UuidAtom(AP4_UI64 size, const AP4_UI08* uuid);
@@ -82,8 +78,7 @@ protected:
/**
* Unknown uuid atoms.
*/
-class AP4_UnknownUuidAtom : public AP4_UuidAtom
-{
+class AP4_UnknownUuidAtom : public AP4_UuidAtom {
public:
// constructors
AP4_UnknownUuidAtom(AP4_UI64 size, AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.cpp
index fc48d1ceb..0aaf37c72 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - vmhd Atoms
+| AP4 - vmhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -42,8 +42,8 @@ AP4_VmhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_VmhdAtom(size, version, flags, stream);
}
@@ -51,7 +51,7 @@ AP4_VmhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
| AP4_VmhdAtom::AP4_VmhdAtom
+---------------------------------------------------------------------*/
AP4_VmhdAtom::AP4_VmhdAtom(AP4_UI16 graphics_mode, AP4_UI16 r, AP4_UI16 g, AP4_UI16 b) :
- AP4_Atom(AP4_ATOM_TYPE_VMHD, AP4_FULL_ATOM_HEADER_SIZE + 8, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_VMHD, AP4_FULL_ATOM_HEADER_SIZE+8, 0, 0),
m_GraphicsMode(graphics_mode)
{
m_OpColor[0] = r;
@@ -62,7 +62,7 @@ AP4_VmhdAtom::AP4_VmhdAtom(AP4_UI16 graphics_mode, AP4_UI16 r, AP4_UI16 g, AP4_U
/*----------------------------------------------------------------------
| AP4_VmhdAtom::AP4_VmhdAtom
+---------------------------------------------------------------------*/
-AP4_VmhdAtom::AP4_VmhdAtom(AP4_UI32 size,
+AP4_VmhdAtom::AP4_VmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
@@ -82,11 +82,11 @@ AP4_VmhdAtom::WriteFields(AP4_ByteStream& stream)
// graphics mode
result = stream.WriteUI16(m_GraphicsMode);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// op color
result = stream.Write(m_OpColor, sizeof(m_OpColor));
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
@@ -100,7 +100,7 @@ AP4_VmhdAtom::InspectFields(AP4_AtomInspector& inspector)
inspector.AddField("graphics_mode", m_GraphicsMode);
char formatted[16];
AP4_FormatString(formatted, sizeof(formatted), "%04x,%04x,%04x",
- m_OpColor[0], m_OpColor[1], m_OpColor[2]);
+ m_OpColor[0], m_OpColor[1], m_OpColor[2]);
inspector.AddField("op_color", formatted);
return AP4_SUCCESS;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.h b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.h
index ba9f82da8..6fed056e3 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Core/Ap4VmhdAtom.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - vmhd Atoms
+| AP4 - vmhd Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -50,7 +50,7 @@ public:
private:
// methods
- AP4_VmhdAtom(AP4_UI32 size,
+ AP4_VmhdAtom(AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
index e084cb96d..ef0619901 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
@@ -11,23 +11,23 @@ All rights reserved.
LICENSE TERMS
-The free distribution and use of this software in both source and binary
+The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
-1. distributions of this source code include the above copyright
+1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
-3. the copyright holder's name is not used to endorse products
-built using this software without specific written permission.
+3. the copyright holder's name is not used to endorse products
+built using this software without specific written permission.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
-in respect of its properties, including, but not limited to, correctness
+in respect of its properties, including, but not limited to, correctness
and fitness for purpose.
-------------------------------------------------------------------------
Issue Date: 29/07/2002
@@ -46,8 +46,7 @@ typedef AP4_UI32 aes_32t;
typedef AP4_UI08 aes_08t;
typedef unsigned int aes_rval;
struct aes_ctx // the AES context for encryption
-{
- aes_32t k_sch[4*AP4_AES_BLOCK_SIZE]; // the encryption key schedule
+{ aes_32t k_sch[4*AP4_AES_BLOCK_SIZE]; // the encryption key schedule
aes_32t n_rnd; // the number of cipher rounds
aes_32t n_blk; // the number of bytes in the state
};
@@ -69,21 +68,21 @@ struct aes_ctx // the AES context for encryption
/* START OF CONFIGURATION OPTIONS
USE OF DEFINES
-
- Later in this section there are a number of defines that control the
- operation of the code. In each section, the purpose of each define is
- explained so that the relevant form can be included or excluded by
- setting either 1's or 0's respectively on the branches of the related
+
+ Later in this section there are a number of defines that control the
+ operation of the code. In each section, the purpose of each define is
+ explained so that the relevant form can be included or excluded by
+ setting either 1's or 0's respectively on the branches of the related
#if clauses.
*/
/* 1. BYTE ORDER IN 32-BIT WORDS
- To obtain the highest speed on processors with 32-bit words, this code
+ To obtain the highest speed on processors with 32-bit words, this code
needs to determine the order in which bytes are packed into such words.
- The following block of code is an attempt to capture the most obvious
- ways in which various environemnts define byte order. It may well fail,
- in which case the definitions will need to be set by editing at the
+ The following block of code is an attempt to capture the most obvious
+ ways in which various environemnts define byte order. It may well fail,
+ in which case the definitions will need to be set by editing at the
points marked **** EDIT HERE IF NECESSARY **** below.
*/
#define AES_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
@@ -105,27 +104,27 @@ struct aes_ctx // the AES context for encryption
/* 2. BYTE ORDER WITHIN 32 BIT WORDS
- The fundamental data processing units in Rijndael are 8-bit bytes. The
- input, output and key input are all enumerated arrays of bytes in which
- bytes are numbered starting at zero and increasing to one less than the
- number of bytes in the array in question. This enumeration is only used
- for naming bytes and does not imply any adjacency or order relationship
- from one byte to another. When these inputs and outputs are considered
- as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
- byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
- In this implementation bits are numbered from 0 to 7 starting at the
+ The fundamental data processing units in Rijndael are 8-bit bytes. The
+ input, output and key input are all enumerated arrays of bytes in which
+ bytes are numbered starting at zero and increasing to one less than the
+ number of bytes in the array in question. This enumeration is only used
+ for naming bytes and does not imply any adjacency or order relationship
+ from one byte to another. When these inputs and outputs are considered
+ as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
+ byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
+ In this implementation bits are numbered from 0 to 7 starting at the
numerically least significant end of each byte (bit n represents 2^n).
- However, Rijndael can be implemented more efficiently using 32-bit
+ However, Rijndael can be implemented more efficiently using 32-bit
words by packing bytes into words so that bytes 4*n to 4*n+3 are placed
- into word[n]. While in principle these bytes can be assembled into words
- in any positions, this implementation only supports the two formats in
+ into word[n]. While in principle these bytes can be assembled into words
+ in any positions, this implementation only supports the two formats in
which bytes in adjacent positions within words also have adjacent byte
- numbers. This order is called big-endian if the lowest numbered bytes
- in words have the highest numeric significance and little-endian if the
- opposite applies.
-
- This code can work in either order irrespective of the order used by the
+ numbers. This order is called big-endian if the lowest numbered bytes
+ in words have the highest numeric significance and little-endian if the
+ opposite applies.
+
+ This code can work in either order irrespective of the order used by the
machine on which it runs. Normally the internal byte order will be set
to the order of the processor on which the code is to be run but this
define can be used to reverse this in special situations
@@ -138,20 +137,20 @@ struct aes_ctx // the AES context for encryption
#define INTERNAL_BYTE_ORDER AES_BIG_ENDIAN
#endif
-/* 3. FAST INPUT/OUTPUT OPERATIONS.
+/* 3. FAST INPUT/OUTPUT OPERATIONS.
- On some machines it is possible to improve speed by transferring the
- bytes in the input and output arrays to and from the internal 32-bit
- variables by addressing these arrays as if they are arrays of 32-bit
- words. On some machines this will always be possible but there may
- be a large performance penalty if the byte arrays are not aligned on
- the normal word boundaries. On other machines this technique will
+ On some machines it is possible to improve speed by transferring the
+ bytes in the input and output arrays to and from the internal 32-bit
+ variables by addressing these arrays as if they are arrays of 32-bit
+ words. On some machines this will always be possible but there may
+ be a large performance penalty if the byte arrays are not aligned on
+ the normal word boundaries. On other machines this technique will
lead to memory access errors when such 32-bit word accesses are not
- properly aligned. The option SAFE_IO avoids such problems but will
- often be slower on those machines that support misaligned access
- (especially so if care is taken to align the input and output byte
- arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
- assumed that access to byte arrays as if they are arrays of 32-bit
+ properly aligned. The option SAFE_IO avoids such problems but will
+ often be slower on those machines that support misaligned access
+ (especially so if care is taken to align the input and output byte
+ arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
+ assumed that access to byte arrays as if they are arrays of 32-bit
words will not cause problems when such accesses are misaligned.
*/
#if 1
@@ -161,12 +160,12 @@ struct aes_ctx // the AES context for encryption
/* 4. LOOP UNROLLING
The code for encryption and decrytpion cycles through a number of rounds
- that can be implemented either in a loop or by expanding the code into a
+ that can be implemented either in a loop or by expanding the code into a
long sequence of instructions, the latter producing a larger program but
one that will often be much faster. The latter is called loop unrolling.
There are also potential speed advantages in expanding two iterations in
a loop with half the number of iterations, which is called partial loop
- unrolling. The following options allow partial or full loop unrolling
+ unrolling. The following options allow partial or full loop unrolling
to be set independently for encryption and decryption
*/
#if 0
@@ -187,8 +186,8 @@ struct aes_ctx // the AES context for encryption
/* 5. FIXED OR DYNAMIC TABLES
- When this section is included the tables used by the code are comipled
- statically into the binary file. Otherwise they are computed once when
+ When this section is included the tables used by the code are comipled
+ statically into the binary file. Otherwise they are computed once when
the code is first used.
*/
#if 1
@@ -197,7 +196,7 @@ struct aes_ctx // the AES context for encryption
/* 6. FAST FINITE FIELD OPERATIONS
- If this section is included, tables are used to provide faster finite
+ If this section is included, tables are used to provide faster finite
field arithmetic (this has no effect if FIXED_TABLES is defined).
*/
#if 1
@@ -206,8 +205,8 @@ struct aes_ctx // the AES context for encryption
/* 7. INTERNAL STATE VARIABLE FORMAT
- The internal state of Rijndael is stored in a number of local 32-bit
- word varaibles which can be defined either as an array or as individual
+ The internal state of Rijndael is stored in a number of local 32-bit
+ word varaibles which can be defined either as an array or as individual
names variables. Include this section if you want to store these local
variables in arrays. Otherwise individual local variables will be used.
*/
@@ -217,10 +216,10 @@ struct aes_ctx // the AES context for encryption
/* In this implementation the columns of the state array are each held in
32-bit words. The state array can be held in various ways: in an array
- of words, in a number of individual word variables or in a number of
+ of words, in a number of individual word variables or in a number of
processor registers. The following define maps a variable name x and
a column number c to the way the state array variable is to be held.
- The first define below maps the state into an array x[c] whereas the
+ The first define below maps the state into an array x[c] whereas the
second form maps the state into a number of individual variables x0,
x1, etc. Another form could map individual state colums to machine
register names.
@@ -246,16 +245,16 @@ struct aes_ctx // the AES context for encryption
This cipher proceeds by repeating in a number of cycles known as 'rounds'
which are implemented by a round function which can optionally be speeded
- up using tables. The basic tables are each 256 32-bit words, with either
+ up using tables. The basic tables are each 256 32-bit words, with either
one or four tables being required for each round function depending on
how much speed is required. The encryption and decryption round functions
are different and the last encryption and decrytpion round functions are
different again making four different round functions in all.
This means that:
- 1. Normal encryption and decryption rounds can each use either 0, 1
+ 1. Normal encryption and decryption rounds can each use either 0, 1
or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
- 2. The last encryption and decryption rounds can also use either 0, 1
+ 2. The last encryption and decryption rounds can also use either 0, 1
or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
Include or exclude the appropriate definitions below to set the number
@@ -295,7 +294,7 @@ struct aes_ctx // the AES context for encryption
#endif
/* The decryption key schedule can be speeded up with tables in the same
- way that the round functions can. Include or exclude the following
+ way that the round functions can. Include or exclude the following
defines to set this requirement.
*/
#if 1
@@ -317,7 +316,7 @@ struct aes_ctx // the AES context for encryption
#if defined(BLOCK_SIZE) && ((BLOCK_SIZE & 3) || BLOCK_SIZE < 16 || BLOCK_SIZE > 32)
#error An illegal block size has been specified.
-#endif
+#endif
#if !defined(BLOCK_SIZE)
#define RC_LENGTH 29
@@ -332,7 +331,7 @@ struct aes_ctx // the AES context for encryption
#define LAST_ENC_ROUND NO_TABLES
#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES
#undef LAST_ENC_ROUND
-#define LAST_ENC_ROUND ONE_TABLE
+#define LAST_ENC_ROUND ONE_TABLE
#endif
#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE
@@ -345,7 +344,7 @@ struct aes_ctx // the AES context for encryption
#define LAST_DEC_ROUND NO_TABLES
#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES
#undef LAST_DEC_ROUND
-#define LAST_DEC_ROUND ONE_TABLE
+#define LAST_DEC_ROUND ONE_TABLE
#endif
#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE
@@ -355,11 +354,11 @@ struct aes_ctx // the AES context for encryption
/* upr(x,n): rotates bytes within words by n positions, moving bytes to
higher index positions with wrap around into low positions
- ups(x,n): moves bytes by n positions to higher index positions in
+ ups(x,n): moves bytes by n positions to higher index positions in
words but without wrap around
bval(x,n): extracts a byte from a word
- NOTE: The definitions given here are intended only for use with
+ NOTE: The definitions given here are intended only for use with
unsigned variables and with shift counts that are compile
time constants
*/
@@ -401,7 +400,7 @@ struct aes_ctx // the AES context for encryption
#if !defined(_MSC_VER)
#define _lrotl(x,n) ((((aes_32t)(x)) << n) | (((aes_32t)(x)) >> (32 - n)))
#endif
-#define bswap_32(x) ((_lrotl((x),8) & 0x00ff00ff) | (_lrotl((x),24) & 0xff00ff00))
+#define bswap_32(x) ((_lrotl((x),8) & 0x00ff00ff) | (_lrotl((x),24) & 0xff00ff00))
#endif
#define word_in(x) bswap_32(*(aes_32t*)(x))
@@ -424,9 +423,9 @@ struct aes_ctx // the AES context for encryption
give improved performance if a fast 32-bit multiply is not available. Note
that a temporary variable u needs to be defined where FFmulX is used.
-#define FFmulX(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
+#define FFmulX(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
#define m4 (0x01010101 * BPOLY)
-#define FFmulX(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
+#define FFmulX(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
*/
/* Work out which tables are needed for the different options */
@@ -651,7 +650,7 @@ void gen_tabs(void);
/*----------------------------------------------------------------------
| tables
+---------------------------------------------------------------------*/
-#if defined(FIXED_TABLES) || !defined(FF_TABLES)
+#if defined(FIXED_TABLES) || !defined(FF_TABLES)
/* finite field arithmetic operations */
@@ -773,7 +772,7 @@ void gen_tabs(void);
#define h0(x) (x)
-/* These defines are used to ensure tables are generated in the
+/* These defines are used to ensure tables are generated in the
right format depending on the internal byte order required
*/
@@ -831,16 +830,16 @@ static const aes_08t inv_s_box[256] = { isb_data(h0) };
static const aes_32t ft_tab[256] = { sb_data(u0) };
#endif
#ifdef FT4_SET
-static const aes_32t ft_tab[4][256] =
-{ { sb_data(u0) }, { sb_data(u1) }, { sb_data(u2) }, { sb_data(u3) } };
+static const aes_32t ft_tab[4][256] =
+ { { sb_data(u0) }, { sb_data(u1) }, { sb_data(u2) }, { sb_data(u3) } };
#endif
#ifdef FL1_SET
static const aes_32t fl_tab[256] = { sb_data(w0) };
#endif
#ifdef FL4_SET
-static const aes_32t fl_tab[4][256] =
-{ { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+static const aes_32t fl_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
#endif
#ifdef IT1_SET
@@ -848,15 +847,15 @@ static const aes_32t it_tab[256] = { isb_data(v0) };
#endif
#ifdef IT4_SET
static const aes_32t it_tab[4][256] =
-{ { isb_data(v0) }, { isb_data(v1) }, { isb_data(v2) }, { isb_data(v3) } };
+ { { isb_data(v0) }, { isb_data(v1) }, { isb_data(v2) }, { isb_data(v3) } };
#endif
#ifdef IL1_SET
static const aes_32t il_tab[256] = { isb_data(w0) };
#endif
#ifdef IL4_SET
-static const aes_32t il_tab[4][256] =
-{ { isb_data(w0) }, { isb_data(w1) }, { isb_data(w2) }, { isb_data(w3) } };
+static const aes_32t il_tab[4][256] =
+ { { isb_data(w0) }, { isb_data(w1) }, { isb_data(w2) }, { isb_data(w3) } };
#endif
#ifdef LS1_SET
@@ -864,15 +863,15 @@ static const aes_32t ls_tab[256] = { sb_data(w0) };
#endif
#ifdef LS4_SET
static const aes_32t ls_tab[4][256] =
-{ { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
#endif
#ifdef IM1_SET
static const aes_32t im_tab[256] = { mm_data(v0) };
#endif
#ifdef IM4_SET
-static const aes_32t im_tab[4][256] =
-{ { mm_data(v0) }, { mm_data(v1) }, { mm_data(v2) }, { mm_data(v3) } };
+static const aes_32t im_tab[4][256] =
+ { { mm_data(v0) }, { mm_data(v1) }, { mm_data(v2) }, { mm_data(v3) } };
#endif
#else /* dynamic table generation */
@@ -936,8 +935,8 @@ aes_32t im_tab[4][256];
/* Generate the tables for the dynamic table option
- It will generally be sensible to use tables to compute finite
- field multiplies and inverses but where memory is scarse this
+ It will generally be sensible to use tables to compute finite
+ field multiplies and inverses but where memory is scarse this
code might sometimes be better. But it only has effect during
initialisation so its pretty unimportant in overall terms.
*/
@@ -948,9 +947,8 @@ aes_32t im_tab[4][256];
*/
static aes_08t hibit(const aes_32t x)
-{
- aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
-
+{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
+
r |= (r >> 2);
r |= (r >> 4);
return (r + 1) >> 1;
@@ -959,8 +957,7 @@ static aes_08t hibit(const aes_32t x)
/* return the inverse of the finite field element x */
static aes_08t fi(const aes_08t x)
-{
- aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
+{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
if(x < 2) return x;
@@ -969,21 +966,15 @@ static aes_08t fi(const aes_08t x)
if(!n1) return v1;
while(n2 >= n1)
- {
- n2 /= n1;
- p2 ^= p1 * n2;
- v2 ^= v1 * n2;
- n2 = hibit(p2);
+ {
+ n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2);
}
-
+
if(!n2) return v2;
while(n1 >= n2)
- {
- n1 /= n2;
- p1 ^= p2 * n1;
- v1 ^= v2 * n1;
- n1 = hibit(p1);
+ {
+ n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1);
}
}
}
@@ -1011,8 +1002,7 @@ static aes_08t fi(const aes_08t x)
(w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8)))
void gen_tabs(void)
-{
- aes_32t i, w;
+{ aes_32t i, w;
#if defined(FF_TABLES)
@@ -1023,16 +1013,15 @@ void gen_tabs(void)
root is 0x03, used here to generate the tables
*/
- i = 0;
- w = 1;
+ i = 0; w = 1;
do
- {
+ {
pow[i] = (aes_08t)w;
pow[i + 255] = (aes_08t)w;
log[w] = (aes_08t)i++;
- w ^= (w << 1) ^(w & 0x80 ? WPOLY : 0);
+ w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0);
}
- while(w != 1);
+ while (w != 1);
#endif
@@ -1043,8 +1032,7 @@ void gen_tabs(void)
}
for(i = 0; i < 256; ++i)
- {
- aes_08t b;
+ { aes_08t b;
b = fwd_affine(fi((aes_08t)i));
w = bytes2word(f2(b), b, b, f3(b));
@@ -1058,9 +1046,9 @@ void gen_tabs(void)
#endif
#ifdef FT4_SET
ft_tab[0][i] = w;
- ft_tab[1][i] = upr(w, 1);
- ft_tab[2][i] = upr(w, 2);
- ft_tab[3][i] = upr(w, 3);
+ ft_tab[1][i] = upr(w,1);
+ ft_tab[2][i] = upr(w,2);
+ ft_tab[3][i] = upr(w,3);
#endif
w = bytes2word(b, 0, 0, 0);
@@ -1069,9 +1057,9 @@ void gen_tabs(void)
#endif
#ifdef FL4_SET
fl_tab[0][i] = w;
- fl_tab[1][i] = upr(w, 1);
- fl_tab[2][i] = upr(w, 2);
- fl_tab[3][i] = upr(w, 3);
+ fl_tab[1][i] = upr(w,1);
+ fl_tab[2][i] = upr(w,2);
+ fl_tab[3][i] = upr(w,3);
#endif
#ifdef LS1_SET /* table for key schedule if fl_tab above is */
@@ -1079,9 +1067,9 @@ void gen_tabs(void)
#endif
#ifdef LS4_SET
ls_tab[0][i] = w;
- ls_tab[1][i] = upr(w, 1);
- ls_tab[2][i] = upr(w, 2);
- ls_tab[3][i] = upr(w, 3);
+ ls_tab[1][i] = upr(w,1);
+ ls_tab[2][i] = upr(w,2);
+ ls_tab[3][i] = upr(w,3);
#endif
b = fi(inv_affine((aes_08t)i));
@@ -1092,9 +1080,9 @@ void gen_tabs(void)
#endif
#ifdef IM4_SET
im_tab[0][b] = w;
- im_tab[1][b] = upr(w, 1);
- im_tab[2][b] = upr(w, 2);
- im_tab[3][b] = upr(w, 3);
+ im_tab[1][b] = upr(w,1);
+ im_tab[2][b] = upr(w,2);
+ im_tab[3][b] = upr(w,3);
#endif
#ifdef ISB_SET
@@ -1105,9 +1093,9 @@ void gen_tabs(void)
#endif
#ifdef IT4_SET
it_tab[0][i] = w;
- it_tab[1][i] = upr(w, 1);
- it_tab[2][i] = upr(w, 2);
- it_tab[3][i] = upr(w, 3);
+ it_tab[1][i] = upr(w,1);
+ it_tab[2][i] = upr(w,2);
+ it_tab[3][i] = upr(w,3);
#endif
w = bytes2word(b, 0, 0, 0);
#ifdef IL1_SET /* tables for last decryption round */
@@ -1115,9 +1103,9 @@ void gen_tabs(void)
#endif
#ifdef IL4_SET
il_tab[0][i] = w;
- il_tab[1][i] = upr(w, 1);
- il_tab[2][i] = upr(w, 2);
- il_tab[3][i] = upr(w, 3);
+ il_tab[1][i] = upr(w,1);
+ il_tab[2][i] = upr(w,2);
+ il_tab[3][i] = upr(w,3);
#endif
}
@@ -1137,10 +1125,9 @@ static aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
if(!tab_init) gen_tabs();
#endif
- if((blen & 7) || blen < 16 || blen > 32)
- {
- cx->n_blk = 0;
- return aes_bad;
+ if((blen & 7) || blen < 16 || blen > 32)
+ {
+ cx->n_blk = 0; return aes_bad;
}
cx->n_blk = blen;
@@ -1154,10 +1141,10 @@ static aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
This corresponds to bit lengths of 128, 192 and 256 bits, and
to Nk values of 4, 6 and 8 respectively.
- The following macros implement a single cycle in the key
- schedule generation process. The number of cycles needed
+ The following macros implement a single cycle in the key
+ schedule generation process. The number of cycles needed
for each cx->n_col and nk value is:
-
+
nk = 4 5 6 7 8
------------------------------
cx->n_col = 4 10 9 8 7 7
@@ -1200,8 +1187,7 @@ static aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
#if defined(ENCRYPTION_KEY_SCHEDULE)
static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
-{
- aes_32t ss[8];
+{ aes_32t ss[8];
#if !defined(FIXED_TABLES)
if(!tab_init) gen_tabs();
@@ -1212,10 +1198,10 @@ static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes
#else
cx->n_blk = BLOCK_SIZE;
#endif
-
+
cx->n_blk = (cx->n_blk & ~3) | 1;
- cx->k_sch[0] = ss[0] = word_in(in_key);
+ cx->k_sch[0] = ss[0] = word_in(in_key );
cx->k_sch[1] = ss[1] = word_in(in_key + 4);
cx->k_sch[2] = ss[2] = word_in(in_key + 8);
cx->k_sch[3] = ss[3] = word_in(in_key + 12);
@@ -1224,79 +1210,53 @@ static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes
switch(klen)
{
- case 16:
- ke4(cx->k_sch, 0);
- ke4(cx->k_sch, 1);
- ke4(cx->k_sch, 2);
- ke4(cx->k_sch, 3);
- ke4(cx->k_sch, 4);
- ke4(cx->k_sch, 5);
- ke4(cx->k_sch, 6);
- ke4(cx->k_sch, 7);
- ke4(cx->k_sch, 8);
- kel4(cx->k_sch, 9);
- cx->n_rnd = 10;
- break;
- case 24:
- cx->k_sch[4] = ss[4] = word_in(in_key + 16);
- cx->k_sch[5] = ss[5] = word_in(in_key + 20);
- ke6(cx->k_sch, 0);
- ke6(cx->k_sch, 1);
- ke6(cx->k_sch, 2);
- ke6(cx->k_sch, 3);
- ke6(cx->k_sch, 4);
- ke6(cx->k_sch, 5);
- ke6(cx->k_sch, 6);
- kel6(cx->k_sch, 7);
- cx->n_rnd = 12;
- break;
- case 32:
- cx->k_sch[4] = ss[4] = word_in(in_key + 16);
- cx->k_sch[5] = ss[5] = word_in(in_key + 20);
- cx->k_sch[6] = ss[6] = word_in(in_key + 24);
- cx->k_sch[7] = ss[7] = word_in(in_key + 28);
- ke8(cx->k_sch, 0);
- ke8(cx->k_sch, 1);
- ke8(cx->k_sch, 2);
- ke8(cx->k_sch, 3);
- ke8(cx->k_sch, 4);
- ke8(cx->k_sch, 5);
- kel8(cx->k_sch, 6);
- cx->n_rnd = 14;
- break;
- default:
- cx->n_rnd = 0;
- return aes_bad;
+ case 16: ke4(cx->k_sch, 0); ke4(cx->k_sch, 1);
+ ke4(cx->k_sch, 2); ke4(cx->k_sch, 3);
+ ke4(cx->k_sch, 4); ke4(cx->k_sch, 5);
+ ke4(cx->k_sch, 6); ke4(cx->k_sch, 7);
+ ke4(cx->k_sch, 8); kel4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ ke6(cx->k_sch, 0); ke6(cx->k_sch, 1);
+ ke6(cx->k_sch, 2); ke6(cx->k_sch, 3);
+ ke6(cx->k_sch, 4); ke6(cx->k_sch, 5);
+ ke6(cx->k_sch, 6); kel6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ ke8(cx->k_sch, 0); ke8(cx->k_sch, 1);
+ ke8(cx->k_sch, 2); ke8(cx->k_sch, 3);
+ ke8(cx->k_sch, 4); ke8(cx->k_sch, 5);
+ kel8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
}
#else
- {
- aes_32t i, l;
+ { aes_32t i, l;
cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
switch(klen)
{
- case 16:
- for(i = 0; i < l; ++i)
- ke4(cx->k_sch, i);
- break;
- case 24:
- cx->k_sch[4] = ss[4] = word_in(in_key + 16);
- cx->k_sch[5] = ss[5] = word_in(in_key + 20);
- for(i = 0; i < l; ++i)
- ke6(cx->k_sch, i);
- break;
- case 32:
- cx->k_sch[4] = ss[4] = word_in(in_key + 16);
- cx->k_sch[5] = ss[5] = word_in(in_key + 20);
- cx->k_sch[6] = ss[6] = word_in(in_key + 24);
- cx->k_sch[7] = ss[7] = word_in(in_key + 28);
- for(i = 0; i < l; ++i)
- ke8(cx->k_sch, i);
- break;
- default:
- cx->n_rnd = 0;
- return aes_bad;
+ case 16: for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
}
}
#endif
@@ -1394,8 +1354,7 @@ static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes
}
static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
-{
- aes_32t ss[8];
+{ aes_32t ss[8];
d_vars
#if !defined(FIXED_TABLES)
@@ -1410,7 +1369,7 @@ static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes
cx->n_blk = (cx->n_blk & ~3) | 2;
- cx->k_sch[0] = ss[0] = word_in(in_key);
+ cx->k_sch[0] = ss[0] = word_in(in_key );
cx->k_sch[1] = ss[1] = word_in(in_key + 4);
cx->k_sch[2] = ss[2] = word_in(in_key + 8);
cx->k_sch[3] = ss[3] = word_in(in_key + 12);
@@ -1419,79 +1378,54 @@ static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes
switch(klen)
{
- case 16:
- kdf4(cx->k_sch, 0);
- kd4(cx->k_sch, 1);
- kd4(cx->k_sch, 2);
- kd4(cx->k_sch, 3);
- kd4(cx->k_sch, 4);
- kd4(cx->k_sch, 5);
- kd4(cx->k_sch, 6);
- kd4(cx->k_sch, 7);
- kd4(cx->k_sch, 8);
- kdl4(cx->k_sch, 9);
- cx->n_rnd = 10;
- break;
- case 24:
- cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
- cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
- kdf6(cx->k_sch, 0);
- kd6(cx->k_sch, 1);
- kd6(cx->k_sch, 2);
- kd6(cx->k_sch, 3);
- kd6(cx->k_sch, 4);
- kd6(cx->k_sch, 5);
- kd6(cx->k_sch, 6);
- kdl6(cx->k_sch, 7);
- cx->n_rnd = 12;
- break;
- case 32:
- cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
- cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
- cx->k_sch[6] = ff(ss[6] = word_in(in_key + 24));
- cx->k_sch[7] = ff(ss[7] = word_in(in_key + 28));
- kdf8(cx->k_sch, 0);
- kd8(cx->k_sch, 1);
- kd8(cx->k_sch, 2);
- kd8(cx->k_sch, 3);
- kd8(cx->k_sch, 4);
- kd8(cx->k_sch, 5);
- kdl8(cx->k_sch, 6);
- cx->n_rnd = 14;
- break;
- default:
- cx->n_rnd = 0;
- return aes_bad;
+ case 16: kdf4(cx->k_sch, 0); kd4(cx->k_sch, 1);
+ kd4(cx->k_sch, 2); kd4(cx->k_sch, 3);
+ kd4(cx->k_sch, 4); kd4(cx->k_sch, 5);
+ kd4(cx->k_sch, 6); kd4(cx->k_sch, 7);
+ kd4(cx->k_sch, 8); kdl4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ kdf6(cx->k_sch, 0); kd6(cx->k_sch, 1);
+ kd6(cx->k_sch, 2); kd6(cx->k_sch, 3);
+ kd6(cx->k_sch, 4); kd6(cx->k_sch, 5);
+ kd6(cx->k_sch, 6); kdl6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ cx->k_sch[6] = ff(ss[6] = word_in(in_key + 24));
+ cx->k_sch[7] = ff(ss[7] = word_in(in_key + 28));
+ kdf8(cx->k_sch, 0); kd8(cx->k_sch, 1);
+ kd8(cx->k_sch, 2); kd8(cx->k_sch, 3);
+ kd8(cx->k_sch, 4); kd8(cx->k_sch, 5);
+ kdl8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
}
#else
- {
- aes_32t i, l;
+ { aes_32t i, l;
cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
switch(klen)
{
- case 16:
- for(i = 0; i < l; ++i)
- ke4(cx->k_sch, i);
- break;
- case 24:
- cx->k_sch[4] = ss[4] = word_in(in_key + 16);
- cx->k_sch[5] = ss[5] = word_in(in_key + 20);
- for(i = 0; i < l; ++i)
- ke6(cx->k_sch, i);
- break;
- case 32:
- cx->k_sch[4] = ss[4] = word_in(in_key + 16);
- cx->k_sch[5] = ss[5] = word_in(in_key + 20);
- cx->k_sch[6] = ss[6] = word_in(in_key + 24);
- cx->k_sch[7] = ss[7] = word_in(in_key + 28);
- for(i = 0; i < l; ++i)
- ke8(cx->k_sch, i);
- break;
- default:
- cx->n_rnd = 0;
- return aes_bad;
+ case 16:
+ for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
}
#if (DEC_ROUND != NO_TABLES)
for(i = nc; i < nc * cx->n_rnd; ++i)
@@ -1519,10 +1453,10 @@ static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes
#define locals(y,x) x[4],y[4]
#else
#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
-/*
- the following defines prevent the compiler requiring the declaration
- of generated but unused variables in the fwd_var and inv_var macros
-*/
+ /*
+ the following defines prevent the compiler requiring the declaration
+ of generated but unused variables in the fwd_var and inv_var macros
+ */
#define b04 unused
#define b05 unused
#define b06 unused
@@ -1633,18 +1567,18 @@ switch(nc) \
#if defined(ENCRYPTION)
/* I am grateful to Frank Yellin for the following construction
- (and that for decryption) which, given the column (c) of the
- output state variable, gives the input state variables which
+ (and that for decryption) which, given the column (c) of the
+ output state variable, gives the input state variables which
are needed in its computation for each row (r) of the state.
- For the fixed block size options, compilers should be able to
- reduce this complex expression (and the equivalent one for
- decryption) to a static variable reference at compile time.
+ For the fixed block size options, compilers should be able to
+ reduce this complex expression (and the equivalent one for
+ decryption) to a static variable reference at compile time.
But for variable block size code, there will be some limbs on
which conditional clauses will be returned.
*/
-/* y = output word, x = input word, r = row, c = column for r = 0,
+/* y = output word, x = input word, r = row, c = column for r = 0,
1, 2 and 3 = column accessed for row r.
*/
@@ -1707,14 +1641,13 @@ switch(nc) \
#endif
static aes_rval aes_enc_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
-{
- aes_32t locals(b0, b1);
+{ aes_32t locals(b0, b1);
const aes_32t *kp = cx->k_sch;
dec_fmvars /* declare variables for fwd_mcol() if needed */
if(!(cx->n_blk & 1)) return aes_bad;
- state_in(b0, in_blk, kp);
+ state_in(b0, in_blk, kp);
#if (ENC_UNROLL == FULL)
@@ -1722,45 +1655,40 @@ static aes_rval aes_enc_blk(const unsigned char in_blk[], unsigned char out_blk[
switch(cx->n_rnd)
{
- case 14:
- round(fwd_rnd, b1, b0, kp - 4 * nc);
- round(fwd_rnd, b0, b1, kp - 3 * nc);
- case 12:
- round(fwd_rnd, b1, b0, kp - 2 * nc);
- round(fwd_rnd, b0, b1, kp - nc);
- case 10:
- round(fwd_rnd, b1, b0, kp);
- round(fwd_rnd, b0, b1, kp + nc);
- round(fwd_rnd, b1, b0, kp + 2 * nc);
- round(fwd_rnd, b0, b1, kp + 3 * nc);
- round(fwd_rnd, b1, b0, kp + 4 * nc);
- round(fwd_rnd, b0, b1, kp + 5 * nc);
- round(fwd_rnd, b1, b0, kp + 6 * nc);
- round(fwd_rnd, b0, b1, kp + 7 * nc);
- round(fwd_rnd, b1, b0, kp + 8 * nc);
- round(fwd_lrnd, b0, b1, kp + 9 * nc);
+ case 14: round(fwd_rnd, b1, b0, kp - 4 * nc);
+ round(fwd_rnd, b0, b1, kp - 3 * nc);
+ case 12: round(fwd_rnd, b1, b0, kp - 2 * nc);
+ round(fwd_rnd, b0, b1, kp - nc);
+ case 10: round(fwd_rnd, b1, b0, kp );
+ round(fwd_rnd, b0, b1, kp + nc);
+ round(fwd_rnd, b1, b0, kp + 2 * nc);
+ round(fwd_rnd, b0, b1, kp + 3 * nc);
+ round(fwd_rnd, b1, b0, kp + 4 * nc);
+ round(fwd_rnd, b0, b1, kp + 5 * nc);
+ round(fwd_rnd, b1, b0, kp + 6 * nc);
+ round(fwd_rnd, b0, b1, kp + 7 * nc);
+ round(fwd_rnd, b1, b0, kp + 8 * nc);
+ round(fwd_lrnd, b0, b1, kp + 9 * nc);
}
#else
-
+
#if (ENC_UNROLL == PARTIAL)
- {
- aes_32t rnd;
+ { aes_32t rnd;
for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
{
kp += nc;
- round(fwd_rnd, b1, b0, kp);
+ round(fwd_rnd, b1, b0, kp);
kp += nc;
- round(fwd_rnd, b0, b1, kp);
+ round(fwd_rnd, b0, b1, kp);
}
kp += nc;
round(fwd_rnd, b1, b0, kp);
#else
- {
- aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
{
kp += nc;
- round(fwd_rnd, p1, p0, kp);
+ round(fwd_rnd, p1, p0, kp);
pt = p0, p0 = p1, p1 = pt;
}
#endif
@@ -1836,8 +1764,7 @@ static aes_rval aes_enc_blk(const unsigned char in_blk[], unsigned char out_blk[
#endif
static aes_rval aes_dec_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
-{
- aes_32t locals(b0, b1);
+{ aes_32t locals(b0, b1);
const aes_32t *kp = cx->k_sch + nc * cx->n_rnd;
dec_imvars /* declare variables for inv_mcol() if needed */
@@ -1850,45 +1777,40 @@ static aes_rval aes_dec_blk(const unsigned char in_blk[], unsigned char out_blk[
kp = cx->k_sch + 9 * nc;
switch(cx->n_rnd)
{
- case 14:
- round(inv_rnd, b1, b0, kp + 4 * nc);
- round(inv_rnd, b0, b1, kp + 3 * nc);
- case 12:
- round(inv_rnd, b1, b0, kp + 2 * nc);
- round(inv_rnd, b0, b1, kp + nc);
- case 10:
- round(inv_rnd, b1, b0, kp);
- round(inv_rnd, b0, b1, kp - nc);
- round(inv_rnd, b1, b0, kp - 2 * nc);
- round(inv_rnd, b0, b1, kp - 3 * nc);
- round(inv_rnd, b1, b0, kp - 4 * nc);
- round(inv_rnd, b0, b1, kp - 5 * nc);
- round(inv_rnd, b1, b0, kp - 6 * nc);
- round(inv_rnd, b0, b1, kp - 7 * nc);
- round(inv_rnd, b1, b0, kp - 8 * nc);
- round(inv_lrnd, b0, b1, kp - 9 * nc);
+ case 14: round(inv_rnd, b1, b0, kp + 4 * nc);
+ round(inv_rnd, b0, b1, kp + 3 * nc);
+ case 12: round(inv_rnd, b1, b0, kp + 2 * nc);
+ round(inv_rnd, b0, b1, kp + nc );
+ case 10: round(inv_rnd, b1, b0, kp );
+ round(inv_rnd, b0, b1, kp - nc);
+ round(inv_rnd, b1, b0, kp - 2 * nc);
+ round(inv_rnd, b0, b1, kp - 3 * nc);
+ round(inv_rnd, b1, b0, kp - 4 * nc);
+ round(inv_rnd, b0, b1, kp - 5 * nc);
+ round(inv_rnd, b1, b0, kp - 6 * nc);
+ round(inv_rnd, b0, b1, kp - 7 * nc);
+ round(inv_rnd, b1, b0, kp - 8 * nc);
+ round(inv_lrnd, b0, b1, kp - 9 * nc);
}
#else
-
+
#if (DEC_UNROLL == PARTIAL)
- {
- aes_32t rnd;
+ { aes_32t rnd;
for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
{
- kp -= nc;
- round(inv_rnd, b1, b0, kp);
- kp -= nc;
- round(inv_rnd, b0, b1, kp);
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+ kp -= nc;
+ round(inv_rnd, b0, b1, kp);
}
kp -= nc;
round(inv_rnd, b1, b0, kp);
#else
- {
- aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
{
kp -= nc;
- round(inv_rnd, p1, p0, kp);
+ round(inv_rnd, p1, p0, kp);
pt = p0, p0 = p1, p1 = pt;
}
#endif
@@ -1907,16 +1829,13 @@ static aes_rval aes_dec_blk(const unsigned char in_blk[], unsigned char out_blk[
| AP4_AesBlockCipher::AP4_AesBlockCipher
+---------------------------------------------------------------------*/
AP4_AesBlockCipher::AP4_AesBlockCipher(const AP4_UI08* key,
-CipherDirection direction) :
+ CipherDirection direction) :
m_Direction(direction)
{
m_Context = new aes_ctx;
- if(direction == AP4_BlockCipher::ENCRYPT)
- {
+ if (direction == AP4_BlockCipher::ENCRYPT) {
aes_enc_key(key, AP4_AES_KEY_LENGTH, m_Context);
- }
- else
- {
+ } else {
aes_dec_key(key, AP4_AES_KEY_LENGTH, m_Context);
}
}
@@ -1932,17 +1851,14 @@ AP4_AesBlockCipher::~AP4_AesBlockCipher()
/*----------------------------------------------------------------------
| AP4_AesBlockCipher::EncryptBlock
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_AesBlockCipher::ProcessBlock(const AP4_UI08* block_in,
-AP4_UI08* block_out)
+ AP4_UI08* block_out)
{
aes_rval result;
- if(m_Direction == AP4_BlockCipher::ENCRYPT)
- {
+ if (m_Direction == AP4_BlockCipher::ENCRYPT) {
result = aes_enc_blk(block_in, block_out, m_Context);
- }
- else
- {
+ } else {
result = aes_dec_blk(block_in, block_out, m_Context);
}
return result == aes_good ? AP4_SUCCESS : AP4_FAILURE;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h
index 724e57ebe..353cf6473 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h
@@ -11,23 +11,23 @@
LICENSE TERMS
- The free distribution and use of this software in both source and binary
+ The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
- 1. distributions of this source code include the above copyright
+ 1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
+ 3. the copyright holder's name is not used to endorse products
+ built using this software without specific written permission.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
+ in respect of its properties, including, but not limited to, correctness
and fitness for purpose.
-------------------------------------------------------------------------
Issue Date: 29/07/2002
@@ -61,13 +61,13 @@ class AP4_AesBlockCipher : public AP4_BlockCipher
{
public:
// constructor and destructor
- AP4_AesBlockCipher(const AP4_UI08* key,
+ AP4_AesBlockCipher(const AP4_UI08* key,
AP4_BlockCipher::CipherDirection direction);
- ~AP4_AesBlockCipher();
-
- // AP4_AesBlockCipher methods
- virtual AP4_Result ProcessBlock(const AP4_UI08* input,
- AP4_UI08* output);
+ ~AP4_AesBlockCipher();
+
+ // AP4_AesBlockCipher methods
+ virtual AP4_Result ProcessBlock(const AP4_UI08* input,
+ AP4_UI08* output);
private:
// members
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.cpp
index 8d9e81759..387f69453 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.cpp
@@ -28,7 +28,7 @@
/*
Portions of this code are based on the code of LibTomCrypt
- that was released into public domain by Tom St Denis.
+ that was released into public domain by Tom St Denis.
*/
/*----------------------------------------------------------------------
@@ -42,21 +42,20 @@
+---------------------------------------------------------------------*/
#define AP4_SHA256_BLOCK_SIZE 64
-static const AP4_UI32 AP4_Sha256_K[64] =
-{
- 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
- 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
- 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
- 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
- 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
- 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
- 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
- 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
- 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
- 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
- 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
- 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
- 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
+static const AP4_UI32 AP4_Sha256_K[64] = {
+ 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
+ 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
+ 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
+ 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
+ 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
+ 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
+ 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
+ 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
+ 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
+ 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
+ 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
+ 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
+ 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
};
/*----------------------------------------------------------------------
@@ -67,20 +66,20 @@ class AP4_DigestSha256
public:
AP4_DigestSha256();
virtual ~AP4_DigestSha256() {}
-
+
// AP4_Hmac methods
virtual AP4_Result Update(const AP4_UI08* data, AP4_Size data_size);
virtual AP4_Result Final(AP4_DataBuffer& digest);
-
+
private:
// methods
void CompressBlock(const AP4_UI08* block);
-
+
// members
- AP4_UI64 m_Length;
+ AP4_UI64 m_Length;
AP4_UI32 m_Pending;
- AP4_UI32 m_State[8];
- AP4_UI08 m_Buffer[64];
+ AP4_UI32 m_State[8];
+ AP4_UI08 m_Buffer[64];
};
/*----------------------------------------------------------------------
@@ -97,14 +96,13 @@ class AP4_HmacSha256 : public AP4_Hmac
{
public:
AP4_HmacSha256(const AP4_UI08* key, AP4_Size key_size);
-
+
// AP4_Hmac methods
- virtual AP4_Result Update(const AP4_UI08* data, AP4_Size data_size)
- {
+ virtual AP4_Result Update(const AP4_UI08* data, AP4_Size data_size) {
return m_InnerDigest.Update(data, data_size);
}
virtual AP4_Result Final(AP4_DataBuffer& buffer);
-
+
private:
AP4_DigestSha256 m_InnerDigest;
AP4_DigestSha256 m_OuterDigest;
@@ -117,14 +115,14 @@ AP4_DigestSha256::AP4_DigestSha256() :
m_Length(0),
m_Pending(0)
{
- m_State[0] = 0x6A09E667UL;
- m_State[1] = 0xBB67AE85UL;
- m_State[2] = 0x3C6EF372UL;
- m_State[3] = 0xA54FF53AUL;
- m_State[4] = 0x510E527FUL;
- m_State[5] = 0x9B05688CUL;
- m_State[6] = 0x1F83D9ABUL;
- m_State[7] = 0x5BE0CD19UL;
+ m_State[0] = 0x6A09E667UL;
+ m_State[1] = 0xBB67AE85UL;
+ m_State[2] = 0x3C6EF372UL;
+ m_State[3] = 0xA54FF53AUL;
+ m_State[4] = 0x510E527FUL;
+ m_State[5] = 0x9B05688CUL;
+ m_State[6] = 0x1F83D9ABUL;
+ m_State[7] = 0x5BE0CD19UL;
}
/*----------------------------------------------------------------------
@@ -134,7 +132,7 @@ AP4_DigestSha256::AP4_DigestSha256() :
( ((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \
((unsigned long) (x) << (unsigned long) (32 - ((y) & 31)))) & 0xFFFFFFFFUL)
#define AP4_Sha256_Ch(x,y,z) (z ^ (x & (y ^ z)))
-#define AP4_Sha256_Maj(x,y,z) (((x | y) & z) | (x & y))
+#define AP4_Sha256_Maj(x,y,z) (((x | y) & z) | (x & y))
#define AP4_Sha256_S(x, n) AP4_Sha256_RORc((x), (n))
#define AP4_Sha256_R(x, n) (((x)&0xFFFFFFFFUL)>>(n))
#define AP4_Sha256_Sigma0(x) (AP4_Sha256_S(x, 2) ^ AP4_Sha256_S(x, 13) ^ AP4_Sha256_S(x, 22))
@@ -148,50 +146,38 @@ AP4_DigestSha256::AP4_DigestSha256() :
void
AP4_DigestSha256::CompressBlock(const AP4_UI08* block)
{
- AP4_UI32 S[8], W[64];
+ AP4_UI32 S[8], W[64];
- /* copy the state into S */
- for(unsigned int i = 0; i < 8; i++)
- {
- S[i] = m_State[i];
- }
+ /* copy the state into S */
+ for (unsigned int i = 0; i < 8; i++) {
+ S[i] = m_State[i];
+ }
- /* copy the 512-bit block into W[0..15] */
- for(unsigned int i = 0; i < 16; i++)
- {
- W[i] = AP4_BytesToUInt32BE(&block[4*i]);
+ /* copy the 512-bit block into W[0..15] */
+ for (unsigned int i = 0; i < 16; i++) {
+ W[i] = AP4_BytesToUInt32BE(&block[4*i]);
}
-
- /* fill W[16..63] */
- for(unsigned int i = 16; i < AP4_SHA256_BLOCK_SIZE; i++)
- {
- W[i] = AP4_Sha256_Gamma1(W[i-2]) + W[i-7] + AP4_Sha256_Gamma0(W[i-15]) + W[i-16];
- }
-
- /* compress */
- AP4_UI32 t, t0, t1;
- for(unsigned int i = 0; i < AP4_SHA256_BLOCK_SIZE; ++i)
- {
+
+ /* fill W[16..63] */
+ for (unsigned int i = 16; i < AP4_SHA256_BLOCK_SIZE; i++) {
+ W[i] = AP4_Sha256_Gamma1(W[i-2]) + W[i-7] + AP4_Sha256_Gamma0(W[i-15]) + W[i-16];
+ }
+
+ /* compress */
+ AP4_UI32 t, t0, t1;
+ for (unsigned int i = 0; i < AP4_SHA256_BLOCK_SIZE; ++i) {
t0 = S[7] + AP4_Sha256_Sigma1(S[4]) + AP4_Sha256_Ch(S[4], S[5], S[6]) + AP4_Sha256_K[i] + W[i];
t1 = AP4_Sha256_Sigma0(S[0]) + AP4_Sha256_Maj(S[0], S[1], S[2]);
S[3] += t0;
S[7] = t0 + t1;
- t = S[7];
- S[7] = S[6];
- S[6] = S[5];
- S[5] = S[4];
- S[4] = S[3];
- S[3] = S[2];
- S[2] = S[1];
- S[1] = S[0];
- S[0] = t;
- }
-
- /* feedback */
- for(unsigned int i = 0; i < 8; i++)
- {
- m_State[i] = m_State[i] + S[i];
- }
+ t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
+ S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;
+ }
+
+ /* feedback */
+ for (unsigned int i = 0; i < 8; i++) {
+ m_State[i] = m_State[i] + S[i];
+ }
}
@@ -201,35 +187,29 @@ AP4_DigestSha256::CompressBlock(const AP4_UI08* block)
AP4_Result
AP4_DigestSha256::Update(const AP4_UI08* data, AP4_Size data_size)
{
- while(data_size > 0)
- {
- if(m_Pending == 0 && data_size >= AP4_SHA256_BLOCK_SIZE)
- {
- CompressBlock(data);
- m_Length += AP4_SHA256_BLOCK_SIZE * 8;
- data += AP4_SHA256_BLOCK_SIZE;
- data_size -= AP4_SHA256_BLOCK_SIZE;
- }
- else
- {
- unsigned int chunk = data_size;
- if(chunk > (AP4_SHA256_BLOCK_SIZE - m_Pending))
- {
+ while (data_size > 0) {
+ if (m_Pending == 0 && data_size >= AP4_SHA256_BLOCK_SIZE) {
+ CompressBlock(data);
+ m_Length += AP4_SHA256_BLOCK_SIZE * 8;
+ data += AP4_SHA256_BLOCK_SIZE;
+ data_size -= AP4_SHA256_BLOCK_SIZE;
+ } else {
+ unsigned int chunk = data_size;
+ if (chunk > (AP4_SHA256_BLOCK_SIZE - m_Pending)) {
chunk = AP4_SHA256_BLOCK_SIZE - m_Pending;
}
- AP4_CopyMemory(&m_Buffer[m_Pending], data, chunk);
- m_Pending += chunk;
- data += chunk;
- data_size -= chunk;
- if(m_Pending == AP4_SHA256_BLOCK_SIZE)
- {
- CompressBlock(m_Buffer);
- m_Length += 8 * AP4_SHA256_BLOCK_SIZE;
- m_Pending = 0;
- }
- }
- }
-
+ AP4_CopyMemory(&m_Buffer[m_Pending], data, chunk);
+ m_Pending += chunk;
+ data += chunk;
+ data_size -= chunk;
+ if (m_Pending == AP4_SHA256_BLOCK_SIZE) {
+ CompressBlock(m_Buffer);
+ m_Length += 8 * AP4_SHA256_BLOCK_SIZE;
+ m_Pending = 0;
+ }
+ }
+ }
+
return AP4_SUCCESS;
}
@@ -240,46 +220,42 @@ AP4_DigestSha256::Update(const AP4_UI08* data, AP4_Size data_size)
AP4_Result
AP4_DigestSha256::Final(AP4_DataBuffer& digest)
{
- /* increase the length of the message */
- m_Length += m_Pending * 8;
-
- /* append the '1' bit */
- m_Buffer[m_Pending++] = 0x80;
-
- /* if the length is currently above 56 bytes we append zeros
- * then compress. Then we can fall back to padding zeros and length
- * encoding like normal.
- */
- if(m_Pending > 56)
- {
- while(m_Pending < 64)
- {
- m_Buffer[m_Pending++] = 0;
- }
- CompressBlock(m_Buffer);
- m_Pending = 0;
- }
-
- /* pad upto 56 bytes of zeroes */
- while(m_Pending < 56)
- {
- m_Buffer[m_Pending++] = 0;
- }
-
- /* store length */
- AP4_BytesFromUInt64BE(&m_Buffer[56], m_Length);
- CompressBlock(m_Buffer);
-
- /* copy output */
+ /* increase the length of the message */
+ m_Length += m_Pending * 8;
+
+ /* append the '1' bit */
+ m_Buffer[m_Pending++] = 0x80;
+
+ /* if the length is currently above 56 bytes we append zeros
+ * then compress. Then we can fall back to padding zeros and length
+ * encoding like normal.
+ */
+ if (m_Pending > 56) {
+ while (m_Pending < 64) {
+ m_Buffer[m_Pending++] = 0;
+ }
+ CompressBlock(m_Buffer);
+ m_Pending = 0;
+ }
+
+ /* pad upto 56 bytes of zeroes */
+ while (m_Pending < 56) {
+ m_Buffer[m_Pending++] = 0;
+ }
+
+ /* store length */
+ AP4_BytesFromUInt64BE(&m_Buffer[56], m_Length);
+ CompressBlock(m_Buffer);
+
+ /* copy output */
digest.SetDataSize(32);
AP4_UI08* out = digest.UseData();
- for(unsigned int i = 0; i < 8; i++)
- {
- AP4_BytesFromUInt32BE(out, m_State[i]);
+ for (unsigned int i = 0; i < 8; i++) {
+ AP4_BytesFromUInt32BE(out, m_State[i]);
out += 4;
}
-
- return AP4_SUCCESS;
+
+ return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
@@ -287,12 +263,11 @@ AP4_DigestSha256::Final(AP4_DataBuffer& digest)
+---------------------------------------------------------------------*/
AP4_HmacSha256::AP4_HmacSha256(const AP4_UI08* key, AP4_Size key_size)
{
- AP4_UI08 workspace[AP4_SHA256_BLOCK_SIZE];
-
+ AP4_UI08 workspace[AP4_SHA256_BLOCK_SIZE];
+
/* if the key is larger than the block size, use a digest of the key */
AP4_DataBuffer hk;
- if(key_size > AP4_SHA256_BLOCK_SIZE)
- {
+ if (key_size > AP4_SHA256_BLOCK_SIZE) {
AP4_DigestSha256 kdigest;
kdigest.Update(key, key_size);
kdigest.Final(hk);
@@ -301,29 +276,25 @@ AP4_HmacSha256::AP4_HmacSha256(const AP4_UI08* key, AP4_Size key_size)
}
/* compute key XOR ipad */
- for(unsigned int i = 0; i < key_size; i++)
- {
- workspace[i] = key[i] ^ 0x36;
+ for (unsigned int i = 0; i < key_size; i++) {
+ workspace[i] = key[i] ^ 0x36;
}
- for(unsigned int i = key_size; i < AP4_SHA256_BLOCK_SIZE; i++)
- {
- workspace[i] = 0x36;
+ for (unsigned int i = key_size; i < AP4_SHA256_BLOCK_SIZE; i++) {
+ workspace[i] = 0x36;
}
-
- /* start the inner digest with (key XOR ipad) */
+
+ /* start the inner digest with (key XOR ipad) */
m_InnerDigest.Update(workspace, AP4_SHA256_BLOCK_SIZE);
/* compute key XOR opad */
- for(unsigned int i = 0; i < key_size; i++)
- {
- workspace[i] = key[i] ^ 0x5c;
+ for (unsigned int i = 0; i < key_size; i++) {
+ workspace[i] = key[i] ^ 0x5c;
}
- for(unsigned int i = key_size; i < AP4_SHA256_BLOCK_SIZE; i++)
- {
- workspace[i] = 0x5c;
+ for (unsigned int i = key_size; i < AP4_SHA256_BLOCK_SIZE; i++) {
+ workspace[i] = 0x5c;
}
-
- /* start the outer digest with (key XOR opad) */
+
+ /* start the outer digest with (key XOR opad) */
m_OuterDigest.Update(workspace, AP4_SHA256_BLOCK_SIZE);
}
@@ -337,7 +308,7 @@ AP4_HmacSha256::Final(AP4_DataBuffer& mac)
AP4_DataBuffer inner;
m_InnerDigest.Final(inner);
m_OuterDigest.Update(inner.GetData(), inner.GetDataSize());
-
+
/* return the value of the outer digest */
return m_OuterDigest.Final(mac);
}
@@ -346,19 +317,14 @@ AP4_HmacSha256::Final(AP4_DataBuffer& mac)
| AP4_Hmac::Create
+---------------------------------------------------------------------*/
AP4_Result
-AP4_Hmac::Create(Algorithm algorithm,
+AP4_Hmac::Create(Algorithm algorithm,
const AP4_UI08* key,
AP4_Size key_size,
AP4_Hmac*& hmac)
{
- switch(algorithm)
- {
- case SHA256:
- hmac = new AP4_HmacSha256(key, key_size);
- return AP4_SUCCESS;
- default:
- hmac = NULL;
- return AP4_ERROR_NOT_SUPPORTED;
+ switch (algorithm) {
+ case SHA256: hmac = new AP4_HmacSha256(key, key_size); return AP4_SUCCESS;
+ default: hmac = NULL; return AP4_ERROR_NOT_SUPPORTED;
}
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.h b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.h
index e8fe8d0c6..22957a0d4 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4Hmac.h
@@ -43,17 +43,16 @@ class AP4_Hmac
{
public:
// types
- typedef enum
- {
+ typedef enum {
SHA256
} Algorithm;
-
+
// class methods
- static AP4_Result Create(Algorithm algorithm,
+ static AP4_Result Create(Algorithm algorithm,
const AP4_UI08* key,
AP4_Size key_size,
AP4_Hmac*& hmac);
-
+
// methods
virtual ~AP4_Hmac() {}
virtual AP4_Result Update(const AP4_UI08* data, AP4_Size data_size) = 0;
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.cpp
index 9ab357126..3cc37f5ce 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.cpp
@@ -28,7 +28,7 @@
/*
Portions of this code are based on the code of LibTomCrypt
- that was released into public domain by Tom St Denis.
+ that was released into public domain by Tom St Denis.
*/
/*----------------------------------------------------------------------
@@ -46,59 +46,56 @@
| AP4_AesKeyWrap
+---------------------------------------------------------------------*/
AP4_Result
-AP4_AesKeyWrap(const AP4_UI08* kek,
- const AP4_UI08* cleartext_key,
+AP4_AesKeyWrap(const AP4_UI08* kek,
+ const AP4_UI08* cleartext_key,
AP4_Size cleartext_key_size,
AP4_DataBuffer& wrapped_key)
{
// check parameters
- if(cleartext_key_size % 8)
- {
+ if (cleartext_key_size % 8) {
// not a multiple of 64 bits
return AP4_ERROR_INVALID_PARAMETERS;
}
-
+
// the output size is (n+1)*64 bits
// where n is the number of 64-bit blocks
// of the cleartext key
- unsigned int n = cleartext_key_size / 8;
- wrapped_key.SetDataSize((n + 1) * 8);
-
+ unsigned int n = cleartext_key_size/8;
+ wrapped_key.SetDataSize((n+1)*8);
+
// Step 1. Initialize variables.
// Set A = IV, an initial value (0xA6)
// For i = 1 to n
// R[i] = P[i]
AP4_UI08* a = (AP4_UI08*)wrapped_key.UseData();
AP4_SetMemory(a, 0xA6, 8);
- AP4_UI08* r = a + 8;
+ AP4_UI08* r = a+8;
AP4_CopyMemory(r, cleartext_key, cleartext_key_size);
-
+
// Step 2. Calculate intermediate values.
// For j = 0 to 5
// For i=1 to n
// B = AES(K, A | R[i])
// A = MSB(64, B) ^ t where t = (n*j)+i
- // R[i] = LSB(64, B)
+ // R[i] = LSB(64, B)
AP4_AesBlockCipher block_cipher(kek, AP4_BlockCipher::ENCRYPT);
- for(unsigned int j = 0; j <= 5; j++)
- {
- r = a + 8;
- for(unsigned int i = 1; i <= n; i++)
- {
+ for (unsigned int j=0; j <= 5; j++) {
+ r = a + 8;
+ for (unsigned int i=1; i<=n; i++) {
AP4_UI08 workspace[16];
AP4_UI08 b[16];
AP4_CopyMemory(workspace, a, 8);
AP4_CopyMemory(&workspace[8], r, 8);
block_cipher.ProcessBlock(workspace, b);
AP4_CopyMemory(a, b, 8);
- a[7] ^= n * j + i;
+ a[7] ^= n*j+i;
AP4_CopyMemory(r, &b[8], 8);
r += 8;
- }
- }
-
+ }
+ }
+
// Step 3. Output the results.
- // (Nothing to do here since we've worked in-place
+ // (Nothing to do here since we've worked in-place
return AP4_SUCCESS;
}
@@ -112,25 +109,24 @@ AP4_AesKeyUnwrap(const AP4_UI08* kek,
AP4_DataBuffer& cleartext_key)
{
// check parameters
- if((wrapped_key_size % 8) || (wrapped_key_size < 24))
- {
+ if ((wrapped_key_size % 8) || (wrapped_key_size < 24)) {
// not a multiple of 64 bits or too small
return AP4_ERROR_INVALID_PARAMETERS;
}
-
+
// setup the output buffer
- unsigned int n = (wrapped_key_size / 8) - 1;
- cleartext_key.SetDataSize(n * 8);
-
+ unsigned int n = (wrapped_key_size/8)-1;
+ cleartext_key.SetDataSize(n*8);
+
// Step 1. Initialize variables.
// Set A = C[0]
// For i = 1 to n
// R[i] = C[i]
- AP4_UI08 a[8];
+ AP4_UI08 a[8];
AP4_CopyMemory(a, wrapped_key, 8);
AP4_UI08* r = (AP4_UI08*)cleartext_key.UseData();
- AP4_CopyMemory(r, wrapped_key + 8, 8 * n);
-
+ AP4_CopyMemory(r, wrapped_key+8, 8*n);
+
// Step 2. Compute intermediate values.
// For j = 5 to 0
// For i = n to 1
@@ -138,15 +134,13 @@ AP4_AesKeyUnwrap(const AP4_UI08* kek,
// A = MSB(64, B)
// R[i] = LSB(64, B)
AP4_AesBlockCipher block_cipher(kek, AP4_BlockCipher::DECRYPT);
- for(int j = 5; j >= 0; j--)
- {
- r = (AP4_UI08*)cleartext_key.UseData() + (n - 1) * 8;
- for(int i = n; i >= 1; i--)
- {
+ for (int j=5; j>=0; j--) {
+ r = (AP4_UI08*)cleartext_key.UseData()+(n-1)*8;
+ for (int i=n; i>=1; i--) {
AP4_UI08 workspace[16];
AP4_UI08 b[16];
AP4_CopyMemory(workspace, a, 8);
- workspace[7] ^= (n * j) + i;
+ workspace[7] ^= (n*j)+i;
AP4_CopyMemory(&workspace[8], r, 8);
block_cipher.ProcessBlock(workspace, b);
AP4_CopyMemory(a, b, 8);
@@ -154,7 +148,7 @@ AP4_AesKeyUnwrap(const AP4_UI08* kek,
r -= 8;
}
}
-
+
// Step 3. Output results.
// If A is an appropriate initial value (see 2.2.3),
// Then
@@ -162,14 +156,12 @@ AP4_AesKeyUnwrap(const AP4_UI08* kek,
// P[i] = R[i]
// Else
// Return an error
- for(unsigned int i = 0; i < 8; i++)
- {
- if(a[i] != 0xA6)
- {
+ for (unsigned int i=0; i<8; i++) {
+ if (a[i] != 0xA6) {
cleartext_key.SetDataSize(0);
return AP4_ERROR_INVALID_FORMAT;
}
- }
+ }
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.h b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.h
index 95ba65711..d0db038e9 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4KeyWrap.h
@@ -39,11 +39,11 @@
/*----------------------------------------------------------------------
| functions
+---------------------------------------------------------------------*/
-AP4_Result AP4_AesKeyWrap(const AP4_UI08* kek,
- const AP4_UI08* cleartext_key,
+AP4_Result AP4_AesKeyWrap(const AP4_UI08* kek,
+ const AP4_UI08* cleartext_key,
AP4_Size cleartext_key_size,
AP4_DataBuffer& wrapped_key);
-
+
AP4_Result AP4_AesKeyUnwrap(const AP4_UI08* kek,
const AP4_UI08* wrapped_key,
AP4_Size wrapped_key_size,
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp
index cbb7d9f57..0b9320f5c 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp
@@ -36,22 +36,19 @@
| AP4_CtrStreamCipher::AP4_CtrStreamCipher
+---------------------------------------------------------------------*/
AP4_CtrStreamCipher::AP4_CtrStreamCipher(AP4_BlockCipher* block_cipher,
- const AP4_UI08* salt,
- AP4_Size counter_size) :
+ const AP4_UI08* salt,
+ AP4_Size counter_size) :
m_StreamOffset(0),
m_CounterSize(counter_size),
m_BlockCipher(block_cipher)
{
- if(m_CounterSize > 16) m_CounterSize = 16;
+ if (m_CounterSize > 16) m_CounterSize = 16;
// use the salt to initialize the base counter
- if(salt)
- {
+ if (salt) {
// initialize the base counter with a salting key
AP4_CopyMemory(m_BaseCounter, salt, AP4_CIPHER_BLOCK_SIZE);
- }
- else
- {
+ } else {
// initialize the base counter with zeros
AP4_SetMemory(m_BaseCounter, 0, AP4_CIPHER_BLOCK_SIZE);
}
@@ -75,13 +72,10 @@ AP4_CtrStreamCipher::~AP4_CtrStreamCipher()
AP4_Result
AP4_CtrStreamCipher::SetIV(const AP4_UI08* counter)
{
- if(counter)
- {
+ if (counter) {
AP4_CopyMemory(&m_BaseCounter[AP4_CIPHER_BLOCK_SIZE-m_CounterSize],
counter, m_CounterSize);
- }
- else
- {
+ } else {
AP4_SetMemory(&m_BaseCounter[AP4_CIPHER_BLOCK_SIZE-m_CounterSize],
0, m_CounterSize);
}
@@ -98,19 +92,18 @@ AP4_CtrStreamCipher::SetStreamOffset(AP4_UI64 offset,
AP4_Cardinal* preroll)
{
// do nothing if we're already at that offset
- if(offset == m_StreamOffset) return AP4_SUCCESS;
+ if (offset == m_StreamOffset) return AP4_SUCCESS;
// update the offset
m_StreamOffset = offset;
// update the key stream if necessary
- if(m_StreamOffset & 0xF)
- {
+ if (m_StreamOffset & 0xF) {
UpdateKeyStream();
}
-
- if(preroll != NULL) *preroll = 0;
-
+
+ if (preroll != NULL) *preroll = 0;
+
return AP4_SUCCESS;
}
@@ -121,25 +114,23 @@ void
AP4_CtrStreamCipher::UpdateKeyStream()
{
// setup counter offset bytes
- AP4_UI64 counter_offset = m_StreamOffset / AP4_CIPHER_BLOCK_SIZE;
+ AP4_UI64 counter_offset = m_StreamOffset/AP4_CIPHER_BLOCK_SIZE;
AP4_UI08 counter_offset_bytes[8];
AP4_BytesFromUInt64BE(counter_offset_bytes, counter_offset);
-
+
// compute the new counter
AP4_UI08 counter_block[AP4_CIPHER_BLOCK_SIZE];
unsigned int carry = 0;
- for(unsigned int i = 0; i < m_CounterSize; i++)
- {
- unsigned int o = AP4_CIPHER_BLOCK_SIZE - 1 - i;
+ for (unsigned int i=0; i<m_CounterSize; i++) {
+ unsigned int o = AP4_CIPHER_BLOCK_SIZE-1-i;
unsigned int x = m_BaseCounter[o];
- unsigned int y = (i < 8) ? counter_offset_bytes[7-i] : 0;
- unsigned int sum = x + y + carry;
- counter_block[o] = (AP4_UI08)(sum & 0xFF);
- carry = ((sum >= 0x100) ? 1 : 0);
+ unsigned int y = (i<8)?counter_offset_bytes[7-i]:0;
+ unsigned int sum = x+y+carry;
+ counter_block[o] = (AP4_UI08)(sum&0xFF);
+ carry = ((sum >= 0x100)?1:0);
}
- for(unsigned int i = m_CounterSize; i < AP4_CIPHER_BLOCK_SIZE; i++)
- {
- unsigned int o = AP4_CIPHER_BLOCK_SIZE - 1 - i;
+ for (unsigned int i=m_CounterSize; i<AP4_CIPHER_BLOCK_SIZE; i++) {
+ unsigned int o = AP4_CIPHER_BLOCK_SIZE-1-i;
counter_block[o] = m_BaseCounter[o];
}
@@ -151,44 +142,40 @@ AP4_CtrStreamCipher::UpdateKeyStream()
| AP4_CtrStreamCipher::ProcessBuffer
+---------------------------------------------------------------------*/
AP4_Result
-AP4_CtrStreamCipher::ProcessBuffer(const AP4_UI08* in,
+AP4_CtrStreamCipher::ProcessBuffer(const AP4_UI08* in,
AP4_Size in_size,
- AP4_UI08* out,
+ AP4_UI08* out,
AP4_Size* out_size /* = NULL */,
bool /* is_last_buffer */)
{
- if(m_BlockCipher == NULL) return AP4_ERROR_INVALID_STATE;
-
- if(out_size != NULL && *out_size < in_size)
- {
+ if (m_BlockCipher == NULL) return AP4_ERROR_INVALID_STATE;
+
+ if (out_size != NULL && *out_size < in_size) {
return AP4_ERROR_BUFFER_TOO_SMALL;
}
- // in CTR mode, the output is the same size as the input
- if(out_size != NULL) *out_size = in_size;
+ // in CTR mode, the output is the same size as the input
+ if (out_size != NULL) *out_size = in_size;
// process all the bytes in the buffer
- while(in_size)
- {
+ while (in_size) {
// compute the number of bytes available in this chunk
- AP4_UI32 index = (AP4_UI32)(m_StreamOffset & (AP4_CIPHER_BLOCK_SIZE - 1));
+ AP4_UI32 index = (AP4_UI32)(m_StreamOffset & (AP4_CIPHER_BLOCK_SIZE-1));
AP4_UI32 chunk;
// update the key stream if we are on a boundary
- if(index == 0)
- {
+ if (index == 0) {
UpdateKeyStream();
chunk = AP4_CIPHER_BLOCK_SIZE;
}
// compute the number of bytes remaining in the chunk
chunk = AP4_CIPHER_BLOCK_SIZE - index;
- if(chunk > in_size) chunk = in_size;
+ if (chunk > in_size) chunk = in_size;
// encrypt/decrypt the chunk
AP4_UI08* x = &m_XBlock[index];
- for(AP4_UI32 i = 0; i < chunk; i++)
- {
+ for (AP4_UI32 i = 0; i < chunk; i++) {
*out++ = *in++ ^ *x++;
}
@@ -196,7 +183,7 @@ AP4_CtrStreamCipher::ProcessBuffer(const AP4_UI08* in,
m_StreamOffset += chunk;
in_size -= chunk;
}
-
+
return AP4_SUCCESS;
}
@@ -204,7 +191,7 @@ AP4_CtrStreamCipher::ProcessBuffer(const AP4_UI08* in,
| AP4_CbcStreamCipher::AP4_CbcStreamCipher
+---------------------------------------------------------------------*/
AP4_CbcStreamCipher::AP4_CbcStreamCipher(AP4_BlockCipher* block_cipher,
- CipherDirection direction) :
+ CipherDirection direction) :
m_Direction(direction),
m_StreamOffset(0),
m_OutputSkip(0),
@@ -247,43 +234,38 @@ AP4_CbcStreamCipher::SetStreamOffset(AP4_UI64 offset,
AP4_Cardinal* preroll)
{
// does not make sense for encryption
- if(m_Direction == AP4_StreamCipher::ENCRYPT) return AP4_ERROR_NOT_SUPPORTED;
-
+ if (m_Direction == AP4_StreamCipher::ENCRYPT) return AP4_ERROR_NOT_SUPPORTED;
+
// check params
- if(preroll == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+ if (preroll == NULL) return AP4_ERROR_INVALID_PARAMETERS;
// reset the end of stream flag
m_Eos = false;
-
+
// special cases
- if(offset == 0)
- {
+ if (offset == 0) {
*preroll = 0;
return SetIV(m_Iv);
}
- if(offset == m_StreamOffset)
- {
+ if (offset == m_StreamOffset) {
*preroll = m_PrerollByteCount;
- m_OutputSkip = (AP4_Size)(offset % AP4_CIPHER_BLOCK_SIZE);
+ m_OutputSkip = (AP4_Size)(offset%AP4_CIPHER_BLOCK_SIZE);
return AP4_SUCCESS;
}
// other cases
- if(offset < AP4_CIPHER_BLOCK_SIZE)
- {
+ if (offset < AP4_CIPHER_BLOCK_SIZE) {
// reset the IV to the output block cache
AP4_CopyMemory(m_OutBlockCache, m_Iv, AP4_CIPHER_BLOCK_SIZE);
m_PrerollByteCount = (AP4_Cardinal) offset;
+ } else {
+ m_PrerollByteCount = (AP4_Cardinal) ((offset%AP4_CIPHER_BLOCK_SIZE)
+ + AP4_CIPHER_BLOCK_SIZE);
}
- else
- {
- m_PrerollByteCount = (AP4_Cardinal)((offset % AP4_CIPHER_BLOCK_SIZE)
- + AP4_CIPHER_BLOCK_SIZE);
- }
-
+
*preroll = m_PrerollByteCount;
m_StreamOffset = offset;
- m_OutputSkip = (AP4_Size)(offset % AP4_CIPHER_BLOCK_SIZE);
+ m_OutputSkip = (AP4_Size)(offset%AP4_CIPHER_BLOCK_SIZE);
return AP4_SUCCESS;
}
@@ -292,71 +274,60 @@ AP4_CbcStreamCipher::SetStreamOffset(AP4_UI64 offset,
| AP4_CbcStreamCipher::ProcessBuffer
+---------------------------------------------------------------------*/
AP4_Result
-AP4_CbcStreamCipher::ProcessBuffer(const AP4_UI08* in,
+AP4_CbcStreamCipher::ProcessBuffer(const AP4_UI08* in,
AP4_Size in_size,
- AP4_UI08* out,
+ AP4_UI08* out,
AP4_Size* out_size,
bool is_last_buffer /* = false */)
{
// check the parameters
- if(out_size == NULL) return AP4_ERROR_INVALID_PARAMETERS;
-
+ if (out_size == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+
// check the state
- if(m_BlockCipher == NULL || m_Eos)
- {
+ if (m_BlockCipher == NULL || m_Eos) {
*out_size = 0;
return AP4_ERROR_INVALID_STATE;
}
- if(is_last_buffer) m_Eos = true;
-
+ if (is_last_buffer) m_Eos = true;
+
// if there was a previous call to SetStreamOffset that set m_PrerollByteCount,
- // we require that this call provides the at least entire preroll data
- if(m_PrerollByteCount)
- {
- if(in_size < m_PrerollByteCount)
- {
+ // we require that this call provides the at least entire preroll data
+ if (m_PrerollByteCount) {
+ if (in_size < m_PrerollByteCount) {
*out_size = 0;
return AP4_ERROR_NOT_ENOUGH_DATA;
}
}
// compute how many blocks we span
- AP4_UI64 start_block = m_StreamOffset / AP4_CIPHER_BLOCK_SIZE;
- AP4_UI64 end_block = (m_StreamOffset + in_size - m_PrerollByteCount) / AP4_CIPHER_BLOCK_SIZE;
- AP4_UI32 blocks_needed = (AP4_UI32)(end_block - start_block);
+ AP4_UI64 start_block = m_StreamOffset/AP4_CIPHER_BLOCK_SIZE;
+ AP4_UI64 end_block = (m_StreamOffset+in_size-m_PrerollByteCount)/AP4_CIPHER_BLOCK_SIZE;
+ AP4_UI32 blocks_needed = (AP4_UI32)(end_block-start_block);
- if(m_Direction == ENCRYPT)
- {
+ if (m_Direction == ENCRYPT) {
// compute how many blocks we will need to produce
unsigned int padded_in_size = in_size;
AP4_UI08 pad_byte = 0;
- if(is_last_buffer)
- {
+ if (is_last_buffer) {
++blocks_needed;
- pad_byte = AP4_CIPHER_BLOCK_SIZE - (AP4_UI08)((m_StreamOffset + in_size) % AP4_CIPHER_BLOCK_SIZE);
+ pad_byte = AP4_CIPHER_BLOCK_SIZE-(AP4_UI08)((m_StreamOffset+in_size)%AP4_CIPHER_BLOCK_SIZE);
padded_in_size += pad_byte;
}
- if(*out_size < blocks_needed * AP4_CIPHER_BLOCK_SIZE)
- {
- *out_size = blocks_needed * AP4_CIPHER_BLOCK_SIZE;
+ if (*out_size < blocks_needed*AP4_CIPHER_BLOCK_SIZE) {
+ *out_size = blocks_needed*AP4_CIPHER_BLOCK_SIZE;
return AP4_ERROR_BUFFER_TOO_SMALL;
}
- *out_size = blocks_needed * AP4_CIPHER_BLOCK_SIZE;
+ *out_size = blocks_needed*AP4_CIPHER_BLOCK_SIZE;
- unsigned int position = (unsigned int)(m_StreamOffset % AP4_CIPHER_BLOCK_SIZE);
+ unsigned int position = (unsigned int)(m_StreamOffset%AP4_CIPHER_BLOCK_SIZE);
m_StreamOffset += in_size;
- for(unsigned int x = 0; x < padded_in_size; x++)
- {
- if(x < in_size)
- {
+ for (unsigned int x=0; x<padded_in_size; x++) {
+ if (x < in_size) {
m_InBlockCache[position] = in[x] ^ m_OutBlockCache[position];
+ } else {
+ m_InBlockCache[position] = pad_byte ^ m_OutBlockCache[position];
}
- else
- {
- m_InBlockCache[position] = pad_byte ^ m_OutBlockCache[position];
- }
- if(++position == AP4_CIPHER_BLOCK_SIZE)
- {
+ if (++position == AP4_CIPHER_BLOCK_SIZE) {
// encrypt and emit a block
m_BlockCipher->ProcessBlock(m_InBlockCache, m_OutBlockCache);
AP4_CopyMemory(out, m_OutBlockCache, AP4_CIPHER_BLOCK_SIZE);
@@ -364,27 +335,21 @@ AP4_CbcStreamCipher::ProcessBuffer(const AP4_UI08* in,
position = 0;
}
}
- }
- else
- {
+ } else {
// compute how many blocks we may produce
- AP4_Size bytes_produced = blocks_needed * AP4_CIPHER_BLOCK_SIZE;
- if(bytes_produced > m_OutputSkip)
- {
+ AP4_Size bytes_produced = blocks_needed*AP4_CIPHER_BLOCK_SIZE;
+ if (bytes_produced > m_OutputSkip) {
bytes_produced -= m_OutputSkip;
}
- if(*out_size < bytes_produced)
- {
+ if (*out_size < bytes_produced) {
*out_size = bytes_produced;
return AP4_ERROR_BUFFER_TOO_SMALL;
}
*out_size = bytes_produced;
-
- // if we've just been seeked (SetStreamOffset),
- if(m_PrerollByteCount > 0)
- {
- if(m_PrerollByteCount >= AP4_CIPHER_BLOCK_SIZE)
- {
+
+ // if we've just been seeked (SetStreamOffset),
+ if (m_PrerollByteCount > 0) {
+ if (m_PrerollByteCount >= AP4_CIPHER_BLOCK_SIZE) {
// fill the outblock cache with the first 16 bytes
AP4_CopyMemory(m_OutBlockCache, in, AP4_CIPHER_BLOCK_SIZE);
in += AP4_CIPHER_BLOCK_SIZE;
@@ -393,10 +358,9 @@ AP4_CbcStreamCipher::ProcessBuffer(const AP4_UI08* in,
}
AP4_ASSERT(m_PrerollByteCount < 16);
-
+
// fill m_InBlockCache with the input for the remaining m_PrerollByteCount
- if(m_PrerollByteCount)
- {
+ if (m_PrerollByteCount) {
AP4_CopyMemory(m_InBlockCache, in, m_PrerollByteCount);
in += m_PrerollByteCount;
in_size -= m_PrerollByteCount;
@@ -404,49 +368,43 @@ AP4_CbcStreamCipher::ProcessBuffer(const AP4_UI08* in,
}
}
- unsigned int position = (unsigned int)(m_StreamOffset % AP4_CIPHER_BLOCK_SIZE);
+ unsigned int position = (unsigned int)(m_StreamOffset%AP4_CIPHER_BLOCK_SIZE);
m_StreamOffset += in_size;
- for(unsigned int x = 0; x < in_size; x++)
- {
+ for (unsigned int x=0; x<in_size; x++) {
m_InBlockCache[position] = in[x];
- if(++position == AP4_CIPHER_BLOCK_SIZE)
- {
+ if (++position == AP4_CIPHER_BLOCK_SIZE) {
// decrypt a block
AP4_UI08 out_block[AP4_CIPHER_BLOCK_SIZE];
m_BlockCipher->ProcessBlock(m_InBlockCache, out_block);
- for(unsigned int y = 0; y < AP4_CIPHER_BLOCK_SIZE; y++)
- {
+ for (unsigned int y=0; y<AP4_CIPHER_BLOCK_SIZE; y++) {
out_block[y] ^= m_OutBlockCache[y];
}
AP4_CopyMemory(m_OutBlockCache, m_InBlockCache, AP4_CIPHER_BLOCK_SIZE);
-
+
// emit the block (or partial block) to the out buffer
- unsigned int out_chunk = AP4_CIPHER_BLOCK_SIZE - m_OutputSkip;
- AP4_CopyMemory(out, out_block + m_OutputSkip, out_chunk);
+ unsigned int out_chunk = AP4_CIPHER_BLOCK_SIZE-m_OutputSkip;
+ AP4_CopyMemory(out, out_block+m_OutputSkip, out_chunk);
out += out_chunk;
position = 0;
m_OutputSkip = 0;
}
}
- if(is_last_buffer && m_Direction == DECRYPT)
- {
+ if (is_last_buffer && m_Direction == DECRYPT) {
// check that we have fed an integral number of blocks
- if(m_StreamOffset % AP4_CIPHER_BLOCK_SIZE != 0)
- {
+ if (m_StreamOffset%AP4_CIPHER_BLOCK_SIZE != 0) {
*out_size = 0;
return AP4_ERROR_INVALID_PARAMETERS;
}
// remove the padding
AP4_UI08 pad_byte = out[-1];
- if(pad_byte == 0 || pad_byte > AP4_CIPHER_BLOCK_SIZE)
- {
+ if (pad_byte == 0 || pad_byte > AP4_CIPHER_BLOCK_SIZE) {
*out_size = 0;
return AP4_ERROR_INVALID_FORMAT;
}
*out_size -= pad_byte;
}
}
-
+
return AP4_SUCCESS;
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.h b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.h
index ca4893d16..9fcec8136 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/Crypto/Ap4StreamCipher.h
@@ -39,7 +39,7 @@
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
-// we only support this for now
+// we only support this for now
const unsigned int AP4_CIPHER_BLOCK_SIZE = 16;
/*----------------------------------------------------------------------
@@ -49,29 +49,28 @@ class AP4_StreamCipher
{
public:
// types
- typedef enum
- {
+ typedef enum {
ENCRYPT,
DECRYPT
} CipherDirection;
-
+
// methods
virtual ~AP4_StreamCipher() {}
-
+
virtual AP4_UI64 GetStreamOffset() = 0;
-
+
virtual AP4_Result ProcessBuffer(const AP4_UI08* in,
AP4_Size in_size,
AP4_UI08* out,
AP4_Size* out_size,
bool is_last_buffer = false) = 0;
-
+
// preroll gives the number of bytes you have to preroll your input and feed
- // it through ProcessBuffer (in one shot) in order to be able to spit out
+ // it through ProcessBuffer (in one shot) in order to be able to spit out
// the output at the given offset
virtual AP4_Result SetStreamOffset(AP4_UI64 offset,
AP4_Cardinal* preroll) = 0;
-
+
virtual AP4_Result SetIV(const AP4_UI08* iv) = 0;
virtual const AP4_UI08* GetIV() = 0;
};
@@ -83,35 +82,29 @@ public:
class AP4_CtrStreamCipher : public AP4_StreamCipher
{
public:
- // methods
+ // methods
/**
* The block cipher is passed with transfer of ownership (it will
* be destroyed when this object is destroyed).
*/
- AP4_CtrStreamCipher(AP4_BlockCipher* block_cipher,
+ AP4_CtrStreamCipher(AP4_BlockCipher* block_cipher,
const AP4_UI08* salt,
AP4_Size counter_size);
~AP4_CtrStreamCipher();
-
+
// AP4_StreamCipher implementation
virtual AP4_Result SetStreamOffset(AP4_UI64 offset,
- AP4_Cardinal* preroll = NULL);
- virtual AP4_UI64 GetStreamOffset()
- {
- return m_StreamOffset;
- }
+ AP4_Cardinal* preroll = NULL);
+ virtual AP4_UI64 GetStreamOffset() { return m_StreamOffset; }
virtual AP4_Result ProcessBuffer(const AP4_UI08* in,
AP4_Size in_size,
AP4_UI08* out,
AP4_Size* out_size = NULL,
bool is_last_buffer = false);
-
+
virtual AP4_Result SetIV(const AP4_UI08* iv);
- virtual const AP4_UI08* GetIV()
- {
- return m_BaseCounter;
- }
+ virtual const AP4_UI08* GetIV() { return m_BaseCounter; }
private:
// methods
@@ -140,24 +133,18 @@ public:
*/
AP4_CbcStreamCipher(AP4_BlockCipher* block_cipher, CipherDirection direction);
~AP4_CbcStreamCipher();
-
+
// AP4_StreamCipher implementation
virtual AP4_Result SetStreamOffset(AP4_UI64 offset,
AP4_Cardinal* preroll);
- virtual AP4_UI64 GetStreamOffset()
- {
- return m_StreamOffset;
- }
+ virtual AP4_UI64 GetStreamOffset() { return m_StreamOffset; }
virtual AP4_Result ProcessBuffer(const AP4_UI08* in,
AP4_Size in_size,
AP4_UI08* out,
AP4_Size* out_size,
bool is_last_buffer = false);
virtual AP4_Result SetIV(const AP4_UI08* iv);
- virtual const AP4_UI08* GetIV()
- {
- return m_Iv;
- };
+ virtual const AP4_UI08* GetIV() { return m_Iv; };
private:
// members
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp b/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp
index 0a00e3ecb..5f97839d9 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp
+++ b/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.cpp
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - MetaData
+| AP4 - MetaData
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -50,8 +50,7 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_DataAtom)
/*----------------------------------------------------------------------
| metadata keys
+---------------------------------------------------------------------*/
-static const AP4_MetaData::KeyInfo AP4_MetaData_KeyInfos [] =
-{
+static const AP4_MetaData::KeyInfo AP4_MetaData_KeyInfos [] = {
{"Name", "Name", AP4_ATOM_TYPE_cNAM, AP4_MetaData::Value::TYPE_STRING_UTF_8},
{"Artist", "Artist", AP4_ATOM_TYPE_cART, AP4_MetaData::Value::TYPE_STRING_UTF_8},
{"AlbumArtist", "Album Artist", AP4_ATOM_TYPE_aART, AP4_MetaData::Value::TYPE_STRING_UTF_8},
@@ -98,13 +97,13 @@ static const AP4_MetaData::KeyInfo AP4_MetaData_KeyInfos [] =
{"Author", "Author", AP4_ATOM_TYPE_AUTH, AP4_MetaData::Value::TYPE_STRING_UTF_8},
};
AP4_Array<AP4_MetaData::KeyInfo> AP4_MetaData::KeyInfos(
- AP4_MetaData_KeyInfos,
- sizeof(AP4_MetaData_KeyInfos) / sizeof(KeyInfo));
+ AP4_MetaData_KeyInfos,
+ sizeof(AP4_MetaData_KeyInfos)/sizeof(KeyInfo));
/*----------------------------------------------------------------------
| genre IDs
+---------------------------------------------------------------------*/
-static const char* const Ap4Id3Genres[] =
+static const char* const Ap4Id3Genres[] =
{
"Blues",
"Classic Rock",
@@ -235,8 +234,7 @@ static const char* const Ap4Id3Genres[] =
};
static const char*
-Ap4StikNames[] =
-{
+Ap4StikNames[] = {
"Movie", // 0
"Normal", // 1
"Audiobook", // 2
@@ -246,7 +244,7 @@ Ap4StikNames[] =
"Music Video", // 6
"?", // 7
"?", // 8
- "Short Film", // 9
+ "Short Film", // 9
"TV Show", // 10
"Booklet", // 11
"?", // 12
@@ -287,8 +285,7 @@ const AP4_Size AP4_DATA_ATOM_MAX_SIZE = 0x40000000;
/*----------------------------------------------------------------------
| 3GPP localized string atoms
+---------------------------------------------------------------------*/
-const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypes[] =
-{
+const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypes[] = {
AP4_ATOM_TYPE_TITL,
AP4_ATOM_TYPE_DSCP,
AP4_ATOM_TYPE_CPRT,
@@ -296,17 +293,15 @@ const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypes[] =
AP4_ATOM_TYPE_AUTH,
AP4_ATOM_TYPE_GNRE
};
-const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypeList =
-{
+const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypeList = {
_3gppLocalizedStringTypes,
- sizeof(_3gppLocalizedStringTypes) / sizeof(_3gppLocalizedStringTypes[0])
+ sizeof(_3gppLocalizedStringTypes)/sizeof(_3gppLocalizedStringTypes[0])
};
/*----------------------------------------------------------------------
| other 3GPP atoms
+---------------------------------------------------------------------*/
-const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::_3gppOtherTypes[] =
-{
+const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::_3gppOtherTypes[] = {
AP4_ATOM_TYPE_RTNG,
AP4_ATOM_TYPE_CLSF,
AP4_ATOM_TYPE_KYWD,
@@ -314,32 +309,29 @@ const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::_3gppOtherTypes[] =
AP4_ATOM_TYPE_ALBM,
AP4_ATOM_TYPE_YRRC,
};
-const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::_3gppOtherTypeList =
-{
+const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::_3gppOtherTypeList = {
_3gppOtherTypes,
- sizeof(_3gppOtherTypes) / sizeof(_3gppOtherTypes[0])
+ sizeof(_3gppOtherTypes)/sizeof(_3gppOtherTypes[0])
};
/*----------------------------------------------------------------------
| DCF string atoms
+---------------------------------------------------------------------*/
-const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::DcfStringTypes[] =
-{
+const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::DcfStringTypes[] = {
AP4_ATOM_TYPE_ICNU,
AP4_ATOM_TYPE_INFU,
AP4_ATOM_TYPE_CVRU,
AP4_ATOM_TYPE_LRCU
};
-const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::DcfStringTypeList =
-{
+const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::DcfStringTypeList = {
DcfStringTypes,
- sizeof(DcfStringTypes) / sizeof(DcfStringTypes[0])
+ sizeof(DcfStringTypes)/sizeof(DcfStringTypes[0])
};
/*----------------------------------------------------------------------
| atom type lists
+---------------------------------------------------------------------*/
-const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::IlstTypes[] =
+const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::IlstTypes[] =
{
AP4_ATOM_TYPE_dddd,
AP4_ATOM_TYPE_cNAM,
@@ -388,16 +380,15 @@ const AP4_Atom::Type AP4_MetaDataAtomTypeHandler::IlstTypes[] =
AP4_ATOM_TYPE_SOCO,
AP4_ATOM_TYPE_SOSN
};
-const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::IlstTypeList =
-{
+const AP4_MetaDataAtomTypeHandler::TypeList AP4_MetaDataAtomTypeHandler::IlstTypeList = {
IlstTypes,
- sizeof(IlstTypes) / sizeof(IlstTypes[0])
+ sizeof(IlstTypes)/sizeof(IlstTypes[0])
};
/*----------------------------------------------------------------------
| AP4_MetaDataAtomTypeHandler::CreateAtom
+---------------------------------------------------------------------*/
-AP4_Result
+AP4_Result
AP4_MetaDataAtomTypeHandler::CreateAtom(AP4_Atom::Type type,
AP4_UI32 size,
AP4_ByteStream& stream,
@@ -406,46 +397,31 @@ AP4_MetaDataAtomTypeHandler::CreateAtom(AP4_Atom::Type type,
{
atom = NULL;
- if(context == AP4_ATOM_TYPE_ILST)
- {
- if(IsTypeInList(type, IlstTypeList))
- {
+ if (context == AP4_ATOM_TYPE_ILST) {
+ if (IsTypeInList(type, IlstTypeList)) {
m_AtomFactory->PushContext(type);
atom = AP4_ContainerAtom::Create(type, size, false, false, stream, *m_AtomFactory);
m_AtomFactory->PopContext();
}
- }
- else if(type == AP4_ATOM_TYPE_DATA)
- {
- if(IsTypeInList(context, IlstTypeList))
- {
+ } else if (type == AP4_ATOM_TYPE_DATA) {
+ if (IsTypeInList(context, IlstTypeList)) {
atom = new AP4_DataAtom(size, stream);
}
- }
- else if(context == AP4_ATOM_TYPE_dddd)
- {
- if(type == AP4_ATOM_TYPE_MEAN || type == AP4_ATOM_TYPE_NAME)
- {
+ } else if (context == AP4_ATOM_TYPE_dddd) {
+ if (type == AP4_ATOM_TYPE_MEAN || type == AP4_ATOM_TYPE_NAME) {
atom = new AP4_MetaDataStringAtom(type, size, stream);
}
- }
- else if(context == AP4_ATOM_TYPE_UDTA)
- {
- if(IsTypeInList(type, _3gppLocalizedStringTypeList))
- {
+ } else if (context == AP4_ATOM_TYPE_UDTA) {
+ if (IsTypeInList(type, _3gppLocalizedStringTypeList)) {
atom = AP4_3GppLocalizedStringAtom::Create(type, size, stream);
- }
- else if(IsTypeInList(type, DcfStringTypeList))
- {
+ } else if (IsTypeInList(type, DcfStringTypeList)) {
atom = AP4_DcfStringAtom::Create(type, size, stream);
- }
- else if(type == AP4_ATOM_TYPE_DCFD)
- {
+ } else if (type == AP4_ATOM_TYPE_DCFD) {
atom = AP4_DcfdAtom::Create(size, stream);
}
}
- return atom ? AP4_SUCCESS : AP4_FAILURE;
+ return atom?AP4_SUCCESS:AP4_FAILURE;
}
/*----------------------------------------------------------------------
@@ -454,9 +430,8 @@ AP4_MetaDataAtomTypeHandler::CreateAtom(AP4_Atom::Type type,
bool
AP4_MetaDataAtomTypeHandler::IsTypeInList(AP4_Atom::Type type, const AP4_MetaDataAtomTypeHandler::TypeList& list)
{
- for(unsigned int i = 0; i < list.m_Size; i++)
- {
- if(type == list.m_Types[i]) return true;
+ for (unsigned int i=0; i<list.m_Size; i++) {
+ if (type == list.m_Types[i]) return true;
}
return false;
}
@@ -470,37 +445,30 @@ AP4_MetaData::AP4_MetaData(AP4_File* file)
AP4_Movie* movie = file->GetMovie();
// handle the movie's metadata if there is a movie in the file
- if(movie)
- {
+ if (movie) {
AP4_MoovAtom* moov = movie->GetMoovAtom();
- if(moov == NULL) return;
+ if (moov == NULL) return;
ParseMoov(moov);
- }
- else
- {
+ } else {
// if we don't have a movie, try to show metadata from a udta atom
AP4_List<AP4_Atom>& top_level_atoms = file->GetTopLevelAtoms();
-
+
AP4_List<AP4_Atom>::Item* atom_item = top_level_atoms.FirstItem();
- while(atom_item)
- {
+ while (atom_item) {
AP4_ContainerAtom* container = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom_item->GetData());
- if(container)
- {
+ if (container) {
// look for a udta in a DCF layout
AP4_Atom* udta = container->FindChild("odhe/udta");
- if(udta)
- {
+ if (udta) {
AP4_ContainerAtom* udta_container = AP4_DYNAMIC_CAST(AP4_ContainerAtom, udta);
- if(udta_container)
- {
+ if (udta_container) {
ParseUdta(udta_container, "dcf");
}
}
}
atom_item = atom_item->GetNext();
}
- }
+ }
}
/*----------------------------------------------------------------------
@@ -511,23 +479,21 @@ AP4_MetaData::ParseMoov(AP4_MoovAtom* moov)
{
// look for a 'meta' atom with 'hdlr' type 'mdir'
AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, moov->FindChild("udta/meta/hdlr"));
- if(hdlr == NULL || hdlr->GetHandlerType() != AP4_HANDLER_TYPE_MDIR) return AP4_ERROR_NO_SUCH_ITEM;
+ if (hdlr == NULL || hdlr->GetHandlerType() != AP4_HANDLER_TYPE_MDIR) return AP4_ERROR_NO_SUCH_ITEM;
// get the list of entries
AP4_ContainerAtom* ilst = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->FindChild("udta/meta/ilst"));
- if(ilst == NULL) return AP4_ERROR_NO_SUCH_ITEM;
-
+ if (ilst == NULL) return AP4_ERROR_NO_SUCH_ITEM;
+
AP4_List<AP4_Atom>::Item* ilst_item = ilst->GetChildren().FirstItem();
- while(ilst_item)
- {
- AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, ilst_item->GetData());
- if(entry_atom)
- {
+ while (ilst_item) {
+ AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, ilst_item->GetData());
+ if (entry_atom) {
AddIlstEntries(entry_atom, "meta");
}
ilst_item = ilst_item->GetNext();
}
-
+
return AP4_SUCCESS;
}
@@ -538,35 +504,30 @@ AP4_Result
AP4_MetaData::ParseUdta(AP4_ContainerAtom* udta, const char* namespc)
{
// check that the atom is indeed a 'udta' atom
- if(udta->GetType() != AP4_ATOM_TYPE_UDTA)
- {
+ if (udta->GetType() != AP4_ATOM_TYPE_UDTA) {
return AP4_ERROR_INVALID_PARAMETERS;
}
-
+
AP4_List<AP4_Atom>::Item* udta_item = udta->GetChildren().FirstItem();
- for(; udta_item; udta_item = udta_item->GetNext())
- {
- AP4_3GppLocalizedStringAtom* _3gpp_atom = AP4_DYNAMIC_CAST(AP4_3GppLocalizedStringAtom, udta_item->GetData());
- if(_3gpp_atom)
- {
+ for (; udta_item; udta_item = udta_item->GetNext()) {
+ AP4_3GppLocalizedStringAtom* _3gpp_atom = AP4_DYNAMIC_CAST(AP4_3GppLocalizedStringAtom, udta_item->GetData());
+ if (_3gpp_atom) {
Add3GppEntry(_3gpp_atom, namespc);
continue;
- }
-
+ }
+
AP4_DcfStringAtom* dcfs_atom = AP4_DYNAMIC_CAST(AP4_DcfStringAtom, udta_item->GetData());
- if(dcfs_atom)
- {
+ if (dcfs_atom) {
AddDcfStringEntry(dcfs_atom, namespc);
continue;
- }
+ }
AP4_DcfdAtom* dcfd_atom = AP4_DYNAMIC_CAST(AP4_DcfdAtom, udta_item->GetData());
- if(dcfd_atom)
- {
+ if (dcfd_atom) {
AddDcfdEntry(dcfd_atom, namespc);
}
}
-
+
return AP4_SUCCESS;
}
@@ -588,24 +549,21 @@ AP4_MetaData::ResolveKeyName(AP4_Atom::Type atom_type, AP4_String& value)
char four_cc[5];
// look for a match in the key infos
- for(unsigned int i = 0;
- i < sizeof(AP4_MetaData_KeyInfos) / sizeof(AP4_MetaData_KeyInfos[0]);
- i++)
- {
- if(AP4_MetaData_KeyInfos[i].four_cc == atom_type)
- {
+ for (unsigned int i=0;
+ i<sizeof(AP4_MetaData_KeyInfos)/sizeof(AP4_MetaData_KeyInfos[0]);
+ i++) {
+ if (AP4_MetaData_KeyInfos[i].four_cc == atom_type) {
key_name = AP4_MetaData_KeyInfos[i].name;
break;
}
}
- if(key_name == NULL)
- {
+ if (key_name == NULL) {
// this key was not found in the key infos, create a name for it
AP4_FormatFourChars(four_cc, (AP4_UI32)atom_type);
key_name = four_cc;
}
value = key_name;
-
+
return AP4_SUCCESS;
}
@@ -617,27 +575,24 @@ AP4_MetaData::AddIlstEntries(AP4_ContainerAtom* atom, const char* namespc)
{
AP4_MetaData::Value* value = NULL;
- if(atom->GetType() == AP4_ATOM_TYPE_dddd)
- {
+ if (atom->GetType() == AP4_ATOM_TYPE_dddd) {
// look for the namespace
AP4_MetaDataStringAtom* mean = static_cast<AP4_MetaDataStringAtom*>(atom->GetChild(AP4_ATOM_TYPE_MEAN));
- if(mean == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (mean == NULL) return AP4_ERROR_INVALID_FORMAT;
// look for the name
AP4_MetaDataStringAtom* name = static_cast<AP4_MetaDataStringAtom*>(atom->GetChild(AP4_ATOM_TYPE_NAME));
- if(name == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (name == NULL) return AP4_ERROR_INVALID_FORMAT;
// get the value
AP4_DataAtom* data_atom = static_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA));
value = new AP4_AtomMetaDataValue(data_atom, atom->GetType());
- if(value == NULL) return AP4_ERROR_INVALID_FORMAT;
-
+ if (value == NULL) return AP4_ERROR_INVALID_FORMAT;
+
return m_Entries.Add(new Entry(name->GetValue().GetChars(),
mean->GetValue().GetChars(),
value));
- }
- else
- {
+ } else {
const char* key_name = NULL;
char four_cc[5];
@@ -647,11 +602,9 @@ AP4_MetaData::AddIlstEntries(AP4_ContainerAtom* atom, const char* namespc)
// add one entry for each data atom
AP4_List<AP4_Atom>::Item* data_item = atom->GetChildren().FirstItem();
- while(data_item)
- {
+ while (data_item) {
AP4_Atom* item_atom = data_item->GetData();
- if(item_atom->GetType() == AP4_ATOM_TYPE_DATA)
- {
+ if (item_atom->GetType() == AP4_ATOM_TYPE_DATA) {
AP4_DataAtom* data_atom = static_cast<AP4_DataAtom*>(item_atom);
value = new AP4_AtomMetaDataValue(data_atom, atom->GetType());
m_Entries.Add(new Entry(key_name, namespc, value));
@@ -671,16 +624,15 @@ AP4_MetaData::Add3GppEntry(AP4_3GppLocalizedStringAtom* atom, const char* namesp
{
AP4_String key_name;
ResolveKeyName(atom->GetType(), key_name);
-
+
const char* language = NULL;
- if(atom->GetLanguage()[0])
- {
+ if (atom->GetLanguage()[0]) {
language = atom->GetLanguage();
}
AP4_MetaData::Value* value = new AP4_StringMetaDataValue(atom->GetValue().GetChars(),
- language);
+ language);
m_Entries.Add(new Entry(key_name.GetChars(), namespc, value));
-
+
return AP4_SUCCESS;
}
@@ -692,10 +644,10 @@ AP4_MetaData::AddDcfStringEntry(AP4_DcfStringAtom* atom, const char* namespc)
{
AP4_String key_name;
ResolveKeyName(atom->GetType(), key_name);
-
+
AP4_MetaData::Value* value = new AP4_StringMetaDataValue(atom->GetValue().GetChars());
m_Entries.Add(new Entry(key_name.GetChars(), namespc, value));
-
+
return AP4_SUCCESS;
}
@@ -707,45 +659,44 @@ AP4_MetaData::AddDcfdEntry(AP4_DcfdAtom* atom, const char* namespc)
{
AP4_String key_name;
ResolveKeyName(atom->GetType(), key_name);
-
- AP4_MetaData::Value* value = new AP4_IntegerMetaDataValue(AP4_MetaData::Value::TYPE_INT_32_BE,
- atom->GetDuration());
+
+ AP4_MetaData::Value* value = new AP4_IntegerMetaDataValue(AP4_MetaData::Value::TYPE_INT_32_BE,
+ atom->GetDuration());
m_Entries.Add(new Entry(key_name.GetChars(), namespc, value));
-
+
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MetaData::Value::MapDataTypeToCategory
+---------------------------------------------------------------------*/
-AP4_MetaData::Value::TypeCategory
+AP4_MetaData::Value::TypeCategory
AP4_MetaData::Value::MapTypeToCategory(Type type)
{
- switch(type)
- {
- case AP4_MetaData::Value::TYPE_INT_08_BE:
- case AP4_MetaData::Value::TYPE_INT_16_BE:
- case AP4_MetaData::Value::TYPE_INT_32_BE:
- return AP4_MetaData::Value::TYPE_CATEGORY_INTEGER;
-
- case AP4_MetaData::Value::TYPE_STRING_UTF_8:
- case AP4_MetaData::Value::TYPE_STRING_UTF_16:
- case AP4_MetaData::Value::TYPE_STRING_PASCAL:
- return AP4_MetaData::Value::TYPE_CATEGORY_STRING;
-
- case AP4_MetaData::Value::TYPE_FLOAT_32_BE:
- case AP4_MetaData::Value::TYPE_FLOAT_64_BE:
- return AP4_MetaData::Value::TYPE_CATEGORY_FLOAT;
-
- default:
- return AP4_MetaData::Value::TYPE_CATEGORY_BINARY;
+ switch (type) {
+ case AP4_MetaData::Value::TYPE_INT_08_BE:
+ case AP4_MetaData::Value::TYPE_INT_16_BE:
+ case AP4_MetaData::Value::TYPE_INT_32_BE:
+ return AP4_MetaData::Value::TYPE_CATEGORY_INTEGER;
+
+ case AP4_MetaData::Value::TYPE_STRING_UTF_8:
+ case AP4_MetaData::Value::TYPE_STRING_UTF_16:
+ case AP4_MetaData::Value::TYPE_STRING_PASCAL:
+ return AP4_MetaData::Value::TYPE_CATEGORY_STRING;
+
+ case AP4_MetaData::Value::TYPE_FLOAT_32_BE:
+ case AP4_MetaData::Value::TYPE_FLOAT_64_BE:
+ return AP4_MetaData::Value::TYPE_CATEGORY_FLOAT;
+
+ default:
+ return AP4_MetaData::Value::TYPE_CATEGORY_BINARY;
}
}
/*----------------------------------------------------------------------
| AP4_MetaData::Value::GetTypeCategory
+---------------------------------------------------------------------*/
-AP4_MetaData::Value::TypeCategory
+AP4_MetaData::Value::TypeCategory
AP4_MetaData::Value::GetTypeCategory() const
{
return MapTypeToCategory(m_Type);
@@ -758,89 +709,75 @@ AP4_Result
AP4_MetaData::Entry::ToAtom(AP4_Atom*& atom) const
{
atom = NULL;
-
- if(m_Value == NULL)
- {
+
+ if (m_Value == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
-
- if(m_Key.GetNamespace() == "meta")
- {
+
+ if (m_Key.GetNamespace() == "meta") {
// convert the name into an atom type
- if(m_Key.GetName().GetLength() != 4)
- {
+ if (m_Key.GetName().GetLength() != 4) {
// the name is not in the right format
return AP4_ERROR_INVALID_PARAMETERS;
}
- AP4_Atom::Type atom_type = AP4_Atom::TypeFromString(m_Key.GetName().GetChars());
-
+ AP4_Atom::Type atom_type = AP4_Atom::TypeFromString(m_Key.GetName().GetChars());
+
// create a container atom for the data
AP4_ContainerAtom* container = new AP4_ContainerAtom(atom_type);
// add the data atom
AP4_DataAtom* data = new AP4_DataAtom(*m_Value);
container->AddChild(data);
-
+
atom = container;
return AP4_SUCCESS;
- }
- else if(m_Key.GetNamespace() == "dcf")
- {
+ } else if (m_Key.GetNamespace() == "dcf") {
// convert the name into an atom type
- if(m_Key.GetName().GetLength() != 4)
- {
+ if (m_Key.GetName().GetLength() != 4) {
// the name is not in the right format
return AP4_ERROR_INVALID_PARAMETERS;
}
- AP4_Atom::Type atom_type = AP4_Atom::TypeFromString(m_Key.GetName().GetChars());
+ AP4_Atom::Type atom_type = AP4_Atom::TypeFromString(m_Key.GetName().GetChars());
- if(AP4_MetaDataAtomTypeHandler::IsTypeInList(atom_type,
- AP4_MetaDataAtomTypeHandler::DcfStringTypeList))
- {
+ if (AP4_MetaDataAtomTypeHandler::IsTypeInList(atom_type,
+ AP4_MetaDataAtomTypeHandler::DcfStringTypeList)) {
AP4_String atom_value = m_Value->ToString();
atom = new AP4_DcfStringAtom(atom_type, atom_value.GetChars());
return AP4_SUCCESS;
- }
- else if(AP4_MetaDataAtomTypeHandler::IsTypeInList(atom_type,
- AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypeList))
- {
+ } else if (AP4_MetaDataAtomTypeHandler::IsTypeInList(atom_type,
+ AP4_MetaDataAtomTypeHandler::_3gppLocalizedStringTypeList)) {
AP4_String atom_value = m_Value->ToString();
const char* language = "eng"; // default
- if(m_Value->GetLanguage().GetLength() != 0)
- {
+ if (m_Value->GetLanguage().GetLength() != 0) {
language = m_Value->GetLanguage().GetChars();
}
atom = new AP4_3GppLocalizedStringAtom(atom_type, language, atom_value.GetChars());
return AP4_SUCCESS;
- }
- else if(atom_type == AP4_ATOM_TYPE_DCFD)
- {
+ } else if (atom_type == AP4_ATOM_TYPE_DCFD) {
atom = new AP4_DcfdAtom(m_Value->ToInteger());
return AP4_SUCCESS;
}
-
- // not supported
- return AP4_ERROR_NOT_SUPPORTED;
- }
- else
- {
+
+ // not supported
+ return AP4_ERROR_NOT_SUPPORTED;
+ } else {
// create a '----' atom
AP4_ContainerAtom* container = new AP4_ContainerAtom(AP4_ATOM_TYPE_dddd);
-
+
// add a 'mean' string
container->AddChild(new AP4_MetaDataStringAtom(AP4_ATOM_TYPE_MEAN, m_Key.GetNamespace().GetChars()));
-
+
// add a 'name' string
container->AddChild(new AP4_MetaDataStringAtom(AP4_ATOM_TYPE_NAME, m_Key.GetName().GetChars()));
// add the data atom
AP4_DataAtom* data = new AP4_DataAtom(*m_Value);
container->AddChild(data);
-
+
atom = container;
return AP4_SUCCESS;
}
-
+
return AP4_ERROR_NOT_SUPPORTED;
}
@@ -850,36 +787,30 @@ AP4_MetaData::Entry::ToAtom(AP4_Atom*& atom) const
AP4_ContainerAtom*
AP4_MetaData::Entry::FindInIlst(AP4_ContainerAtom* ilst) const
{
- if(m_Key.GetNamespace() == "meta")
- {
+ if (m_Key.GetNamespace() == "meta") {
AP4_Atom::Type atom_type = AP4_Atom::TypeFromString(m_Key.GetName().GetChars());
return AP4_DYNAMIC_CAST(AP4_ContainerAtom, ilst->GetChild(atom_type));
- }
- else
- {
+ } else {
AP4_List<AP4_Atom>::Item* ilst_item = ilst->GetChildren().FirstItem();
- while(ilst_item)
- {
- AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, ilst_item->GetData());
- if(entry_atom)
- {
+ while (ilst_item) {
+ AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, ilst_item->GetData());
+ if (entry_atom) {
AP4_MetaDataStringAtom* mean = static_cast<AP4_MetaDataStringAtom*>(entry_atom->GetChild(AP4_ATOM_TYPE_MEAN));
AP4_MetaDataStringAtom* name = static_cast<AP4_MetaDataStringAtom*>(entry_atom->GetChild(AP4_ATOM_TYPE_NAME));
- if(mean && name &&
- mean->GetValue() == m_Key.GetNamespace() &&
- name->GetValue() == m_Key.GetName())
- {
+ if (mean && name &&
+ mean->GetValue() == m_Key.GetNamespace() &&
+ name->GetValue() == m_Key.GetName()) {
return entry_atom;
}
}
ilst_item = ilst_item->GetNext();
}
}
-
+
// not found
return NULL;
}
-
+
/*----------------------------------------------------------------------
| AP4_MetaData::Entry::AddToFileIlst
+---------------------------------------------------------------------*/
@@ -887,69 +818,61 @@ AP4_Result
AP4_MetaData::Entry::AddToFileIlst(AP4_File& file, AP4_Ordinal index)
{
// check that we have a correct entry
- if(m_Value == NULL) return AP4_ERROR_INVALID_STATE;
+ if (m_Value == NULL) return AP4_ERROR_INVALID_STATE;
// convert the entry into an atom
AP4_Atom* atom;
AP4_Result result = ToAtom(atom);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
AP4_ContainerAtom* entry_atom = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
- if(entry_atom == NULL)
- {
+ if (entry_atom == NULL) {
return AP4_ERROR_INVALID_FORMAT;
}
// look for the 'moov'
AP4_Movie* movie = file.GetMovie();
- if(movie == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (movie == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_MoovAtom* moov = movie->GetMoovAtom();
- if(moov == NULL) return AP4_ERROR_INVALID_FORMAT;
-
- // look for 'udta', and create if it does not exist
+ if (moov == NULL) return AP4_ERROR_INVALID_FORMAT;
+
+ // look for 'udta', and create if it does not exist
AP4_ContainerAtom* udta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->FindChild("udta", true));
- if(udta == NULL) return AP4_ERROR_INTERNAL;
-
+ if (udta == NULL) return AP4_ERROR_INTERNAL;
+
// look for 'meta', and create if it does not exist ('meta' is a FULL atom)
AP4_ContainerAtom* meta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, udta->FindChild("meta", true, true));
- if(meta == NULL) return AP4_ERROR_INTERNAL;
+ if (meta == NULL) return AP4_ERROR_INTERNAL;
// look for a 'hdlr' atom type 'mdir'
AP4_HdlrAtom* hdlr = AP4_DYNAMIC_CAST(AP4_HdlrAtom, meta->FindChild("hdlr"));
- if(hdlr == NULL)
- {
+ if (hdlr == NULL) {
hdlr = new AP4_HdlrAtom(AP4_HANDLER_TYPE_MDIR, "");
meta->AddChild(hdlr);
- }
- else
- {
- if(hdlr->GetHandlerType() != AP4_HANDLER_TYPE_MDIR)
- {
+ } else {
+ if (hdlr->GetHandlerType() != AP4_HANDLER_TYPE_MDIR) {
return AP4_ERROR_INVALID_FORMAT;
}
}
// get/create the list of entries
AP4_ContainerAtom* ilst = AP4_DYNAMIC_CAST(AP4_ContainerAtom, meta->FindChild("ilst", true));
- if(ilst == NULL) return AP4_ERROR_INTERNAL;
-
+ if (ilst == NULL) return AP4_ERROR_INTERNAL;
+
// look if there is already a container for this entry
AP4_ContainerAtom* existing = FindInIlst(ilst);
- if(existing == NULL)
- {
+ if (existing == NULL) {
// just add the one we have
ilst->AddChild(entry_atom);
- }
- else
- {
+ } else {
// add the entry's data to the existing entry
AP4_DataAtom* data_atom = AP4_DYNAMIC_CAST(AP4_DataAtom, entry_atom->GetChild(AP4_ATOM_TYPE_DATA));
- if(data_atom == NULL) return AP4_ERROR_INTERNAL;
+ if (data_atom == NULL) return AP4_ERROR_INTERNAL;
entry_atom->RemoveChild(data_atom);
existing->AddChild(data_atom, index);
delete entry_atom;
}
-
- return AP4_SUCCESS;
+
+ return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
@@ -959,20 +882,20 @@ AP4_Result
AP4_MetaData::Entry::AddToFileDcf(AP4_File& file, AP4_Ordinal index)
{
// check that we have a correct entry
- if(m_Value == NULL) return AP4_ERROR_INVALID_STATE;
-
+ if (m_Value == NULL) return AP4_ERROR_INVALID_STATE;
+
// look for 'odrm/odhe'
AP4_ContainerAtom* odhe = AP4_DYNAMIC_CAST(AP4_ContainerAtom, file.FindChild("odrm/odhe"));
- if(odhe == NULL) return AP4_ERROR_NO_SUCH_ITEM;
+ if (odhe == NULL) return AP4_ERROR_NO_SUCH_ITEM;
// get/create the list of entries
AP4_ContainerAtom* udta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, odhe->FindChild("udta", true));
- if(udta == NULL) return AP4_ERROR_INTERNAL;
-
+ if (udta == NULL) return AP4_ERROR_INTERNAL;
+
// convert the entry into an atom
AP4_Atom* data_atom;
AP4_Result result = ToAtom(data_atom);
- if(AP4_FAILED(result)) return result;
+ if (AP4_FAILED(result)) return result;
// add the entry's data to the container
return udta->AddChild(data_atom, index);
@@ -985,19 +908,14 @@ AP4_Result
AP4_MetaData::Entry::AddToFile(AP4_File& file, AP4_Ordinal index)
{
// check that we have a correct entry
- if(m_Value == NULL) return AP4_ERROR_INVALID_STATE;
-
+ if (m_Value == NULL) return AP4_ERROR_INVALID_STATE;
+
// check the namespace of the key to know where to add the atom
- if(m_Key.GetNamespace() == "meta")
- {
+ if (m_Key.GetNamespace() == "meta") {
return AddToFileIlst(file, index);
- }
- else if(m_Key.GetNamespace() == "dcf")
- {
+ } else if (m_Key.GetNamespace() == "dcf") {
return AddToFileDcf(file, index);
- }
- else
- {
+ } else {
// custom namespace
return AddToFileIlst(file, index);
}
@@ -1011,29 +929,28 @@ AP4_MetaData::Entry::RemoveFromFileIlst(AP4_File& file, AP4_Ordinal index)
{
// look for the 'moov'
AP4_Movie* movie = file.GetMovie();
- if(movie == NULL) return AP4_ERROR_INVALID_FORMAT;
+ if (movie == NULL) return AP4_ERROR_INVALID_FORMAT;
AP4_MoovAtom* moov = movie->GetMoovAtom();
- if(moov == NULL) return AP4_ERROR_INVALID_FORMAT;
-
+ if (moov == NULL) return AP4_ERROR_INVALID_FORMAT;
+
// look for 'udta/meta/ilst'
AP4_ContainerAtom* ilst = AP4_DYNAMIC_CAST(AP4_ContainerAtom, moov->FindChild("udta/meta/ilst"));
- if(ilst == NULL) return AP4_ERROR_NO_SUCH_ITEM;
-
+ if (ilst == NULL) return AP4_ERROR_NO_SUCH_ITEM;
+
// look if there is already a container for this entry
AP4_ContainerAtom* existing = FindInIlst(ilst);
- if(existing == NULL) return AP4_ERROR_NO_SUCH_ITEM;
-
+ if (existing == NULL) return AP4_ERROR_NO_SUCH_ITEM;
+
// remove the data atom in the entry
AP4_Result result = existing->DeleteChild(AP4_ATOM_TYPE_DATA, index);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
// if the entry is empty, remove it
- if(existing->GetChildren().ItemCount() == 0)
- {
+ if (existing->GetChildren().ItemCount() == 0) {
ilst->RemoveChild(existing);
delete existing;
}
-
+
return AP4_SUCCESS;
}
@@ -1045,13 +962,13 @@ AP4_MetaData::Entry::RemoveFromFileDcf(AP4_File& file, AP4_Ordinal index)
{
// look for 'odrm/odhe/udta'
AP4_ContainerAtom* udta = AP4_DYNAMIC_CAST(AP4_ContainerAtom, file.FindChild("odrm/odhe/udta"));
- if(udta == NULL) return AP4_ERROR_NO_SUCH_ITEM;
-
+ if (udta == NULL) return AP4_ERROR_NO_SUCH_ITEM;
+
// remove the data atom in the entry
AP4_UI32 type = AP4_BytesToUInt32BE((const unsigned char*)m_Key.GetName().GetChars());
AP4_Result result = udta->DeleteChild(type, index);
- if(AP4_FAILED(result)) return result;
-
+ if (AP4_FAILED(result)) return result;
+
return AP4_SUCCESS;
}
@@ -1062,16 +979,11 @@ AP4_Result
AP4_MetaData::Entry::RemoveFromFile(AP4_File& file, AP4_Ordinal index)
{
// check the namespace of the key to know where to add the atom
- if(m_Key.GetNamespace() == "meta")
- {
+ if (m_Key.GetNamespace() == "meta") {
return RemoveFromFileIlst(file, index);
- }
- else if(m_Key.GetNamespace() == "dcf")
- {
+ } else if (m_Key.GetNamespace() == "dcf") {
return RemoveFromFileDcf(file, index);
- }
- else
- {
+ } else {
// unsupported namespace
return AP4_ERROR_NOT_SUPPORTED;
}
@@ -1166,151 +1078,121 @@ AP4_BinaryMetaDataValue::ToInteger() const
| AP4_AtomMetaDataValue::AP4_AtomMetaDataValue
+---------------------------------------------------------------------*/
AP4_AtomMetaDataValue::AP4_AtomMetaDataValue(AP4_DataAtom* atom,
- AP4_UI32 parent_type) :
+ AP4_UI32 parent_type) :
Value(atom->GetValueType()),
m_DataAtom(atom)
{
- switch(parent_type)
- {
- case AP4_ATOM_TYPE_GNRE:
- m_Meaning = MEANING_ID3_GENRE;
- break;
-
- case AP4_ATOM_TYPE_CPIL:
- m_Meaning = MEANING_BOOLEAN;
- break;
+ switch (parent_type) {
+ case AP4_ATOM_TYPE_GNRE:
+ m_Meaning = MEANING_ID3_GENRE;
+ break;
- case AP4_ATOM_TYPE_PGAP:
- case AP4_ATOM_TYPE_PCST:
- m_Meaning = MEANING_BOOLEAN;
- break;
+ case AP4_ATOM_TYPE_CPIL:
+ m_Meaning = MEANING_BOOLEAN;
+ break;
- case AP4_ATOM_TYPE_STIK:
- m_Meaning = MEANING_FILE_KIND;
- break;
+ case AP4_ATOM_TYPE_PGAP:
+ case AP4_ATOM_TYPE_PCST:
+ m_Meaning = MEANING_BOOLEAN;
+ break;
- case AP4_ATOM_TYPE_PURL:
- case AP4_ATOM_TYPE_EGID:
- m_Meaning = MEANING_BINARY_ENCODED_CHARS;
- break;
+ case AP4_ATOM_TYPE_STIK:
+ m_Meaning = MEANING_FILE_KIND;
+ break;
- default:
- break;
+ case AP4_ATOM_TYPE_PURL:
+ case AP4_ATOM_TYPE_EGID:
+ m_Meaning = MEANING_BINARY_ENCODED_CHARS;
+ break;
+
+ default:
+ break;
}
}
/*----------------------------------------------------------------------
| AP4_AtomMetaDataValue::ToString
+---------------------------------------------------------------------*/
-AP4_String
+AP4_String
AP4_AtomMetaDataValue::ToString() const
{
char string[256] = "";
AP4_MetaData::Value::Type value_type = m_DataAtom->GetValueType();
- switch(AP4_MetaData::Value::MapTypeToCategory(value_type))
- {
- case AP4_MetaData::Value::TYPE_CATEGORY_INTEGER:
- {
- long value;
- if(AP4_SUCCEEDED(m_DataAtom->LoadInteger(value)))
- {
- if(m_Meaning == MEANING_BOOLEAN)
- {
- if(value)
- {
- return "True";
- }
- else
- {
- return "False";
- }
- }
- else if(m_Meaning == MEANING_FILE_KIND)
+ switch (AP4_MetaData::Value::MapTypeToCategory(value_type)) {
+ case AP4_MetaData::Value::TYPE_CATEGORY_INTEGER:
{
- if(value >= 0 && ((unsigned int)value) <= sizeof(Ap4StikNames) / sizeof(Ap4StikNames[0]))
- {
- AP4_FormatString(string, sizeof(string), "(%ld) %s", value, Ap4StikNames[value]);
- }
- else
- {
- return "Unknown";
+ long value;
+ if (AP4_SUCCEEDED(m_DataAtom->LoadInteger(value))) {
+ if (m_Meaning == MEANING_BOOLEAN) {
+ if (value) {
+ return "True";
+ } else {
+ return "False";
+ }
+ } else if (m_Meaning == MEANING_FILE_KIND) {
+ if (value >= 0 && ((unsigned int)value) <= sizeof(Ap4StikNames)/sizeof(Ap4StikNames[0])) {
+ AP4_FormatString(string, sizeof(string), "(%ld) %s", value, Ap4StikNames[value]);
+ } else {
+ return "Unknown";
+ }
+ } else {
+ AP4_FormatString(string, sizeof(string), "%ld", value);
+ }
}
+ return AP4_String((const char*)string);
+ break;
}
- else
- {
- AP4_FormatString(string, sizeof(string), "%ld", value);
- }
- }
- return AP4_String((const char*)string);
- break;
- }
-
- case AP4_MetaData::Value::TYPE_CATEGORY_STRING:
- {
- AP4_String* category_string;
- if(AP4_SUCCEEDED(m_DataAtom->LoadString(category_string)))
- {
- AP4_String result(*category_string);
- delete category_string;
- return result;
- }
- break;
- }
- case AP4_MetaData::Value::TYPE_CATEGORY_BINARY:
- {
- AP4_DataBuffer data;
- if(AP4_SUCCEEDED(m_DataAtom->LoadBytes(data)))
- {
- if(m_Meaning == MEANING_ID3_GENRE && data.GetDataSize() == 2)
+ case AP4_MetaData::Value::TYPE_CATEGORY_STRING:
{
- unsigned int genre = (data.GetData()[0]) * 256 + data.GetData()[1];
- if(genre >= 1 && genre <= sizeof(Ap4Id3Genres) / sizeof(Ap4Id3Genres[0]))
- {
- AP4_FormatString(string, sizeof(string), "(%d) %s", genre, Ap4Id3Genres[genre-1]);
- return AP4_String((const char*)string);
- }
- else
- {
- return "Unknown";
+ AP4_String* category_string;
+ if (AP4_SUCCEEDED(m_DataAtom->LoadString(category_string))) {
+ AP4_String result(*category_string);
+ delete category_string;
+ return result;
}
+ break;
}
- else if(m_Meaning == MEANING_BINARY_ENCODED_CHARS)
- {
- AP4_String result;
- result.Assign((const char*)data.GetData(), data.GetDataSize());
- return result;
- }
- else
+
+ case AP4_MetaData::Value::TYPE_CATEGORY_BINARY:
{
- unsigned int dump_length = data.GetDataSize();
- bool truncate = false;
- if(dump_length > 16)
- {
- dump_length = 16;
- truncate = true;
- }
- char* out = string;
- for(unsigned int i = 0; i < dump_length; i++)
- {
- AP4_FormatString(out, sizeof(string) - (out - string), "%02x ", data.GetData()[i]);
- out += 3;
- }
- if(truncate)
- {
- *out++ = '.';
- *out++ = '.';
- *out++ = '.';
- *out++ = ' ';
+ AP4_DataBuffer data;
+ if (AP4_SUCCEEDED(m_DataAtom->LoadBytes(data))) {
+ if (m_Meaning == MEANING_ID3_GENRE && data.GetDataSize() == 2) {
+ unsigned int genre = (data.GetData()[0])*256+data.GetData()[1];
+ if (genre >= 1 && genre <= sizeof(Ap4Id3Genres)/sizeof(Ap4Id3Genres[0])) {
+ AP4_FormatString(string, sizeof(string), "(%d) %s", genre, Ap4Id3Genres[genre-1]);
+ return AP4_String((const char*)string);
+ } else {
+ return "Unknown";
+ }
+ } else if (m_Meaning == MEANING_BINARY_ENCODED_CHARS) {
+ AP4_String result;
+ result.Assign((const char*)data.GetData(), data.GetDataSize());
+ return result;
+ } else {
+ unsigned int dump_length = data.GetDataSize();
+ bool truncate = false;
+ if (dump_length > 16) {
+ dump_length = 16;
+ truncate = true;
+ }
+ char* out = string;
+ for (unsigned int i=0; i<dump_length; i++) {
+ AP4_FormatString(out, sizeof(string)-(out-string), "%02x ", data.GetData()[i]);
+ out += 3;
+ }
+ if (truncate) {
+ *out++='.'; *out++='.'; *out++='.'; *out++=' ';
+ }
+ AP4_FormatString(out, sizeof(string)-(out-string), "[%ld bytes]", data.GetDataSize());
+ }
}
- AP4_FormatString(out, sizeof(string) - (out - string), "[%ld bytes]", data.GetDataSize());
+ return AP4_String(string);
}
- }
- return AP4_String(string);
- }
- default:
- return AP4_String();
+ default:
+ return AP4_String();
}
return AP4_String();
@@ -1328,16 +1210,13 @@ AP4_AtomMetaDataValue::ToBytes(AP4_DataBuffer& bytes) const
/*----------------------------------------------------------------------
| AP4_AtomMetaDataValue::ToInteger
+---------------------------------------------------------------------*/
-long
+long
AP4_AtomMetaDataValue::ToInteger() const
{
long value;
- if(AP4_SUCCEEDED(m_DataAtom->LoadInteger(value)))
- {
+ if (AP4_SUCCEEDED(m_DataAtom->LoadInteger(value))) {
return value;
- }
- else
- {
+ } else {
return 0;
}
}
@@ -1352,81 +1231,70 @@ AP4_DataAtom::AP4_DataAtom(const AP4_MetaData::Value& value) :
AP4_MemoryByteStream* memory = new AP4_MemoryByteStream(256);
AP4_Size payload_size = 8;
m_Source = memory;
-
- switch(value.GetType())
- {
- case AP4_MetaData::Value::TYPE_STRING_UTF_8:
- {
- m_DataType = DATA_TYPE_STRING_UTF_8;
- AP4_String string_value = value.ToString();
- if(string_value.GetLength())
- {
- memory->Write(string_value.GetChars(), string_value.GetLength());
+
+ switch (value.GetType()) {
+ case AP4_MetaData::Value::TYPE_STRING_UTF_8: {
+ m_DataType = DATA_TYPE_STRING_UTF_8;
+ AP4_String string_value = value.ToString();
+ if (string_value.GetLength()) {
+ memory->Write(string_value.GetChars(), string_value.GetLength());
+ }
+ payload_size += string_value.GetLength();
+ break;
+ }
+
+ case AP4_MetaData::Value::TYPE_INT_08_BE: {
+ m_DataType = DATA_TYPE_SIGNED_INT_BE;
+ AP4_UI08 int_value = (AP4_UI08)value.ToInteger();
+ memory->Write(&int_value, 1);
+ payload_size += 1;
+ break;
+ }
+
+ case AP4_MetaData::Value::TYPE_INT_16_BE: {
+ m_DataType = DATA_TYPE_SIGNED_INT_BE;
+ AP4_UI16 int_value = (AP4_UI16)value.ToInteger();
+ memory->Write(&int_value, 2);
+ payload_size += 2;
+ break;
}
- payload_size += string_value.GetLength();
- break;
- }
-
- case AP4_MetaData::Value::TYPE_INT_08_BE:
- {
- m_DataType = DATA_TYPE_SIGNED_INT_BE;
- AP4_UI08 int_value = (AP4_UI08)value.ToInteger();
- memory->Write(&int_value, 1);
- payload_size += 1;
- break;
- }
-
- case AP4_MetaData::Value::TYPE_INT_16_BE:
- {
- m_DataType = DATA_TYPE_SIGNED_INT_BE;
- AP4_UI16 int_value = (AP4_UI16)value.ToInteger();
- memory->Write(&int_value, 2);
- payload_size += 2;
- break;
- }
- case AP4_MetaData::Value::TYPE_INT_32_BE:
- {
- m_DataType = DATA_TYPE_SIGNED_INT_BE;
- AP4_UI32 int_value = (AP4_UI32)value.ToInteger();
- memory->Write(&int_value, 4);
- payload_size += 4;
- break;
- }
+ case AP4_MetaData::Value::TYPE_INT_32_BE: {
+ m_DataType = DATA_TYPE_SIGNED_INT_BE;
+ AP4_UI32 int_value = (AP4_UI32)value.ToInteger();
+ memory->Write(&int_value, 4);
+ payload_size += 4;
+ break;
+ }
- case AP4_MetaData::Value::TYPE_JPEG:
- m_DataType = DATA_TYPE_JPEG;
- // FALLTHROUGH
- case AP4_MetaData::Value::TYPE_GIF:
- if(m_DataType == DATA_TYPE_BINARY) m_DataType = DATA_TYPE_GIF;
- // FALLTHROUGH
- case AP4_MetaData::Value::TYPE_BINARY:
- {
- AP4_DataBuffer buffer;
- value.ToBytes(buffer);
- if(buffer.GetDataSize())
- {
- memory->Write(buffer.GetData(), buffer.GetDataSize());
+ case AP4_MetaData::Value::TYPE_JPEG:
+ m_DataType = DATA_TYPE_JPEG;
+ // FALLTHROUGH
+ case AP4_MetaData::Value::TYPE_GIF:
+ if (m_DataType == DATA_TYPE_BINARY) m_DataType = DATA_TYPE_GIF;
+ // FALLTHROUGH
+ case AP4_MetaData::Value::TYPE_BINARY: {
+ AP4_DataBuffer buffer;
+ value.ToBytes(buffer);
+ if (buffer.GetDataSize()) {
+ memory->Write(buffer.GetData(), buffer.GetDataSize());
+ }
+ payload_size += buffer.GetDataSize();
+ break;
}
- payload_size += buffer.GetDataSize();
- break;
- }
- default:
- break;
+ default:
+ break;
}
-
+
const AP4_String& language = value.GetLanguage();
- if(language == "en")
- {
+ if (language == "en") {
m_DataLang = LANGUAGE_ENGLISH;
- }
- else
- {
+ } else {
// default
m_DataLang = LANGUAGE_ENGLISH;
}
-
+
m_Size32 += payload_size;
}
@@ -1436,18 +1304,16 @@ AP4_DataAtom::AP4_DataAtom(const AP4_MetaData::Value& value) :
AP4_DataAtom::AP4_DataAtom(AP4_UI32 size, AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_DATA, size)
{
- if(size < AP4_ATOM_HEADER_SIZE + 8) return;
+ if (size < AP4_ATOM_HEADER_SIZE+8) return;
AP4_UI32 i;
- stream.ReadUI32(i);
- m_DataType = (DataType)i;
- stream.ReadUI32(i);
- m_DataLang = (DataLang)i;
+ stream.ReadUI32(i); m_DataType = (DataType)i;
+ stream.ReadUI32(i); m_DataLang = (DataLang)i;
// the stream for the data is a substream of this source
AP4_Position data_offset;
stream.Tell(data_offset);
- AP4_Size data_size = size - AP4_ATOM_HEADER_SIZE - 8;
+ AP4_Size data_size = size-AP4_ATOM_HEADER_SIZE-8;
m_Source = new AP4_SubStream(stream, data_offset, data_size);
}
@@ -1465,44 +1331,38 @@ AP4_DataAtom::~AP4_DataAtom()
AP4_MetaData::Value::Type
AP4_DataAtom::GetValueType()
{
- switch(m_DataType)
- {
- case DATA_TYPE_BINARY:
- return AP4_MetaData::Value::TYPE_BINARY;
-
- case DATA_TYPE_SIGNED_INT_BE:
- switch(m_Size32 - 16)
- {
- case 1:
- return AP4_MetaData::Value::TYPE_INT_08_BE;
- case 2:
- return AP4_MetaData::Value::TYPE_INT_16_BE;
- case 4:
- return AP4_MetaData::Value::TYPE_INT_32_BE;
- default:
+ switch (m_DataType) {
+ case DATA_TYPE_BINARY:
return AP4_MetaData::Value::TYPE_BINARY;
- }
- break;
-
- case DATA_TYPE_STRING_UTF_8:
- return AP4_MetaData::Value::TYPE_STRING_UTF_8;
-
- case DATA_TYPE_STRING_UTF_16:
- return AP4_MetaData::Value::TYPE_STRING_UTF_16;
-
- case DATA_TYPE_STRING_PASCAL:
- return AP4_MetaData::Value::TYPE_STRING_PASCAL;
-
- case DATA_TYPE_GIF:
- return AP4_MetaData::Value::TYPE_GIF;
- case DATA_TYPE_JPEG:
- return AP4_MetaData::Value::TYPE_JPEG;
+ case DATA_TYPE_SIGNED_INT_BE:
+ switch (m_Size32-16) {
+ case 1: return AP4_MetaData::Value::TYPE_INT_08_BE;
+ case 2: return AP4_MetaData::Value::TYPE_INT_16_BE;
+ case 4: return AP4_MetaData::Value::TYPE_INT_32_BE;
+ default: return AP4_MetaData::Value::TYPE_BINARY;
+ }
+ break;
+
+ case DATA_TYPE_STRING_UTF_8:
+ return AP4_MetaData::Value::TYPE_STRING_UTF_8;
+
+ case DATA_TYPE_STRING_UTF_16:
+ return AP4_MetaData::Value::TYPE_STRING_UTF_16;
+
+ case DATA_TYPE_STRING_PASCAL:
+ return AP4_MetaData::Value::TYPE_STRING_PASCAL;
+
+ case DATA_TYPE_GIF:
+ return AP4_MetaData::Value::TYPE_GIF;
+
+ case DATA_TYPE_JPEG:
+ return AP4_MetaData::Value::TYPE_JPEG;
- default:
- return AP4_MetaData::Value::TYPE_BINARY;
+ default:
+ return AP4_MetaData::Value::TYPE_BINARY;
}
-
+
return AP4_MetaData::Value::TYPE_BINARY;
}
@@ -1514,8 +1374,7 @@ AP4_DataAtom::WriteFields(AP4_ByteStream& stream)
{
stream.WriteUI32(m_DataType);
stream.WriteUI32(m_DataLang);
- if(m_Source)
- {
+ if (m_Source) {
AP4_LargeSize size = 0;
m_Source->GetSize(size);
m_Source->Seek(0);
@@ -1533,20 +1392,15 @@ AP4_DataAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("type", m_DataType);
inspector.AddField("lang", m_DataLang);
- if(m_DataType == DATA_TYPE_STRING_UTF_8)
- {
+ if (m_DataType == DATA_TYPE_STRING_UTF_8) {
AP4_String* str;
- if(AP4_SUCCEEDED(LoadString(str)))
- {
+ if (AP4_SUCCEEDED(LoadString(str))) {
inspector.AddField("value", str->GetChars());
delete str;
}
- }
- else if(m_DataType == DATA_TYPE_SIGNED_INT_BE)
- {
+ } else if (m_DataType == DATA_TYPE_SIGNED_INT_BE) {
long value;
- if(AP4_SUCCEEDED(LoadInteger(value)))
- {
+ if (AP4_SUCCEEDED(LoadInteger(value))) {
inspector.AddField("value", value);
}
}
@@ -1560,24 +1414,20 @@ AP4_DataAtom::InspectFields(AP4_AtomInspector& inspector)
AP4_Result
AP4_DataAtom::LoadString(AP4_String*& string)
{
- if(m_Source == NULL)
- {
+ if (m_Source == NULL) {
string = new AP4_String();
return AP4_SUCCESS;
- }
- else
- {
+ } else {
// create a string with enough capactiy for the data
AP4_LargeSize size = 0;
m_Source->GetSize(size);
- if(size > AP4_DATA_ATOM_MAX_SIZE) return AP4_ERROR_OUT_OF_RANGE;
+ if (size > AP4_DATA_ATOM_MAX_SIZE) return AP4_ERROR_OUT_OF_RANGE;
string = new AP4_String((AP4_Size)size);
// read from the start of the stream
m_Source->Seek(0);
AP4_Result result = m_Source->Read(string->UseChars(), (AP4_Size)size);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
delete string;
string = NULL;
}
@@ -1592,19 +1442,17 @@ AP4_DataAtom::LoadString(AP4_String*& string)
AP4_Result
AP4_DataAtom::LoadBytes(AP4_DataBuffer& bytes)
{
- if(m_Source == NULL)
- {
+ if (m_Source == NULL) {
bytes.SetDataSize(0);
return AP4_SUCCESS;
}
AP4_LargeSize size = 0;
m_Source->GetSize(size);
- if(size > AP4_DATA_ATOM_MAX_SIZE) return AP4_ERROR_OUT_OF_RANGE;
+ if (size > AP4_DATA_ATOM_MAX_SIZE) return AP4_ERROR_OUT_OF_RANGE;
bytes.SetDataSize((AP4_Size)size);
m_Source->Seek(0);
AP4_Result result = m_Source->Read(bytes.UseData(), (AP4_Size)size);
- if(AP4_FAILED(result))
- {
+ if (AP4_FAILED(result)) {
bytes.SetDataSize(0);
}
return result;
@@ -1614,36 +1462,25 @@ AP4_DataAtom::LoadBytes(AP4_DataBuffer& bytes)
| AP4_DataAtom::LoadInteger
+---------------------------------------------------------------------*/
AP4_Result
-AP4_DataAtom::LoadInteger(long& value)
+AP4_DataAtom::LoadInteger(long& value)
{
AP4_Result result = AP4_FAILURE;
value = 0;
- if(m_Source == NULL) return AP4_SUCCESS;
+ if (m_Source == NULL) return AP4_SUCCESS;
AP4_LargeSize size = 0;
m_Source->GetSize(size);
- if(size > 4)
- {
+ if (size > 4) {
return AP4_ERROR_OUT_OF_RANGE;
}
unsigned char bytes[4];
m_Source->Seek(0);
m_Source->Read(bytes, (AP4_Size)size);
result = AP4_SUCCESS;
- switch(size)
- {
- case 1:
- value = bytes[0];
- break;
- case 2:
- value = AP4_BytesToInt16BE(bytes);
- break;
- case 4:
- value = AP4_BytesToInt32BE(bytes);
- break;
- default:
- value = 0;
- result = AP4_ERROR_INVALID_FORMAT;
- break;
+ switch (size) {
+ case 1: value = bytes[0]; break;
+ case 2: value = AP4_BytesToInt16BE(bytes); break;
+ case 4: value = AP4_BytesToInt32BE(bytes); break;
+ default: value = 0; result = AP4_ERROR_INVALID_FORMAT; break;
}
return result;
}
@@ -1655,7 +1492,7 @@ AP4_MetaDataStringAtom::AP4_MetaDataStringAtom(Type type, const char* value) :
AP4_Atom(type, AP4_ATOM_HEADER_SIZE),
m_Value(value)
{
- m_Size32 += 4 + m_Value.GetLength();
+ m_Size32 += 4+m_Value.GetLength();
}
/*----------------------------------------------------------------------
@@ -1663,7 +1500,7 @@ AP4_MetaDataStringAtom::AP4_MetaDataStringAtom(Type type, const char* value) :
+---------------------------------------------------------------------*/
AP4_MetaDataStringAtom::AP4_MetaDataStringAtom(Type type, AP4_UI32 size, AP4_ByteStream& stream) :
AP4_Atom(type, size),
- m_Value((AP4_Size)(size - AP4_ATOM_HEADER_SIZE - 4))
+ m_Value((AP4_Size)(size-AP4_ATOM_HEADER_SIZE-4))
{
stream.ReadUI32(m_Reserved);
stream.Read(m_Value.UseChars(), m_Value.GetLength());
@@ -1693,55 +1530,54 @@ AP4_MetaDataStringAtom::InspectFields(AP4_AtomInspector& inspector)
| AP4_3GppLocalizedStringAtom::Create
+---------------------------------------------------------------------*/
AP4_3GppLocalizedStringAtom*
-AP4_3GppLocalizedStringAtom::Create(Type type, AP4_UI32 size, AP4_ByteStream& stream)
+AP4_3GppLocalizedStringAtom::Create(Type type, AP4_UI32 size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_3GppLocalizedStringAtom(type, size, version, flags, stream);
}
/*----------------------------------------------------------------------
| AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom
+---------------------------------------------------------------------*/
-AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom(Type type,
- const char* language,
- const char* value) :
- AP4_Atom(type, AP4_FULL_ATOM_HEADER_SIZE + 2, 0, 0),
+AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom(Type type,
+ const char* language,
+ const char* value) :
+ AP4_Atom(type, AP4_FULL_ATOM_HEADER_SIZE+2, 0, 0),
m_Value(value)
{
m_Language[0] = language[0];
m_Language[1] = language[1];
m_Language[2] = language[2];
m_Language[3] = language[3];
-
- m_Size32 += m_Value.GetLength() + 1;
+
+ m_Size32 += m_Value.GetLength()+1;
}
/*----------------------------------------------------------------------
| AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom
+---------------------------------------------------------------------*/
-AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom(Type type,
- AP4_UI32 size,
- AP4_UI32 version,
- AP4_UI32 flags,
- AP4_ByteStream& stream) :
+AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom(Type type,
+ AP4_UI32 size,
+ AP4_UI32 version,
+ AP4_UI32 flags,
+ AP4_ByteStream& stream) :
AP4_Atom(type, size, version, flags)
{
// read the language code
AP4_UI16 packed_language;
stream.ReadUI16(packed_language);
- m_Language[0] = 0x60 + ((packed_language >> 10) & 0x1F);
- m_Language[1] = 0x60 + ((packed_language >> 5) & 0x1F);
- m_Language[2] = 0x60 + ((packed_language) & 0x1F);
+ m_Language[0] = 0x60+((packed_language>>10)&0x1F);
+ m_Language[1] = 0x60+((packed_language>> 5)&0x1F);
+ m_Language[2] = 0x60+((packed_language )&0x1F);
m_Language[3] = '\0';
-
+
// read the value (should be a NULL-terminated string, but we'll
// allow for strings that are not terminated)
- if(size > AP4_FULL_ATOM_HEADER_SIZE + 2)
- {
- AP4_UI32 value_size = size - (AP4_FULL_ATOM_HEADER_SIZE + 2);
+ if (size > AP4_FULL_ATOM_HEADER_SIZE+2) {
+ AP4_UI32 value_size = size-(AP4_FULL_ATOM_HEADER_SIZE+2);
char* value = new char[value_size];
stream.Read(value, value_size);
m_Value.Assign(value, value_size);
@@ -1755,20 +1591,18 @@ AP4_3GppLocalizedStringAtom::AP4_3GppLocalizedStringAtom(Type type,
AP4_Result
AP4_3GppLocalizedStringAtom::WriteFields(AP4_ByteStream& stream)
{
- AP4_UI16 packed_language = ((m_Language[0] - 0x60) << 10) |
- ((m_Language[1] - 0x60) << 5) |
- ((m_Language[2] - 0x60));
+ AP4_UI16 packed_language = ((m_Language[0]-0x60)<<10) |
+ ((m_Language[1]-0x60)<< 5) |
+ ((m_Language[2]-0x60));
stream.WriteUI16(packed_language);
- AP4_Size payload_size = (AP4_UI32)GetSize() - GetHeaderSize();
- if(payload_size < 2) return AP4_ERROR_INVALID_FORMAT;
- AP4_Size value_size = m_Value.GetLength() + 1;
- if(value_size > payload_size - 2)
- {
- value_size = payload_size - 2;
+ AP4_Size payload_size = (AP4_UI32)GetSize()-GetHeaderSize();
+ if (payload_size < 2) return AP4_ERROR_INVALID_FORMAT;
+ AP4_Size value_size = m_Value.GetLength()+1;
+ if (value_size > payload_size-2) {
+ value_size = payload_size-2;
}
stream.Write(m_Value.GetChars(), value_size);
- for(unsigned int i = value_size; i < payload_size - 2; i++)
- {
+ for (unsigned int i=value_size; i<payload_size-2; i++) {
stream.WriteUI08(0);
}
return AP4_SUCCESS;
@@ -1789,12 +1623,12 @@ AP4_3GppLocalizedStringAtom::InspectFields(AP4_AtomInspector& inspector)
| AP4_DcfStringAtom::Create
+---------------------------------------------------------------------*/
AP4_DcfStringAtom*
-AP4_DcfStringAtom::Create(Type type, AP4_UI32 size, AP4_ByteStream& stream)
+AP4_DcfStringAtom::Create(Type type, AP4_UI32 size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
return new AP4_DcfStringAtom(type, size, version, flags, stream);
}
@@ -1811,16 +1645,15 @@ AP4_DcfStringAtom::AP4_DcfStringAtom(Type type, const char* value) :
/*----------------------------------------------------------------------
| AP4_DcfStringAtom::AP4_DcfStringAtom
+---------------------------------------------------------------------*/
-AP4_DcfStringAtom::AP4_DcfStringAtom(Type type,
- AP4_UI32 size,
+AP4_DcfStringAtom::AP4_DcfStringAtom(Type type,
+ AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
AP4_Atom(type, size, version, flags)
{
- if(size > AP4_FULL_ATOM_HEADER_SIZE)
- {
- AP4_UI32 value_size = size - (AP4_FULL_ATOM_HEADER_SIZE);
+ if (size > AP4_FULL_ATOM_HEADER_SIZE) {
+ AP4_UI32 value_size = size-(AP4_FULL_ATOM_HEADER_SIZE);
char* value = new char[value_size];
stream.Read(value, value_size);
m_Value.Assign(value, value_size);
@@ -1834,7 +1667,7 @@ AP4_DcfStringAtom::AP4_DcfStringAtom(Type type,
AP4_Result
AP4_DcfStringAtom::WriteFields(AP4_ByteStream& stream)
{
- if(m_Value.GetLength()) stream.Write(m_Value.GetChars(), m_Value.GetLength());
+ if (m_Value.GetLength()) stream.Write(m_Value.GetChars(), m_Value.GetLength());
return AP4_SUCCESS;
}
@@ -1852,13 +1685,13 @@ AP4_DcfStringAtom::InspectFields(AP4_AtomInspector& inspector)
| AP4_DcfdAtom::Create
+---------------------------------------------------------------------*/
AP4_DcfdAtom*
-AP4_DcfdAtom::Create(AP4_UI32 size, AP4_ByteStream& stream)
+AP4_DcfdAtom::Create(AP4_UI32 size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
- if(AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
- if(version != 0) return NULL;
- if(size != AP4_FULL_ATOM_HEADER_SIZE + 4) return NULL;
+ if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
+ if (version != 0) return NULL;
+ if (size != AP4_FULL_ATOM_HEADER_SIZE+4) return NULL;
return new AP4_DcfdAtom(version, flags, stream);
}
@@ -1868,7 +1701,7 @@ AP4_DcfdAtom::Create(AP4_UI32 size, AP4_ByteStream& stream)
AP4_DcfdAtom::AP4_DcfdAtom(AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream) :
- AP4_Atom(AP4_ATOM_TYPE_DCFD, AP4_FULL_ATOM_HEADER_SIZE + 4, version, flags)
+ AP4_Atom(AP4_ATOM_TYPE_DCFD, AP4_FULL_ATOM_HEADER_SIZE+4, version, flags)
{
stream.ReadUI32(m_Duration);
}
@@ -1877,7 +1710,7 @@ AP4_DcfdAtom::AP4_DcfdAtom(AP4_UI32 version,
| AP4_DcfdAtom::AP4_DcfdAtom
+---------------------------------------------------------------------*/
AP4_DcfdAtom::AP4_DcfdAtom(AP4_UI32 duration) :
- AP4_Atom(AP4_ATOM_TYPE_DCFD, AP4_FULL_ATOM_HEADER_SIZE + 4, 0, 0),
+ AP4_Atom(AP4_ATOM_TYPE_DCFD, AP4_FULL_ATOM_HEADER_SIZE+4, 0, 0),
m_Duration(duration)
{
}
diff --git a/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.h b/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.h
index b8d488b7b..491365f11 100644
--- a/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.h
+++ b/src/filters/parser/MP4Splitter/AP4/Source/MetaData/Ap4MetaData.h
@@ -1,6 +1,6 @@
/*****************************************************************
|
-| AP4 - MetaData
+| AP4 - MetaData
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
@@ -53,98 +53,90 @@ class AP4_DcfdAtom;
/*----------------------------------------------------------------------
| metadata keys
+---------------------------------------------------------------------*/
-const AP4_Atom::Type AP4_ATOM_TYPE_DATA = AP4_ATOM_TYPE('d', 'a', 't', 'a'); // data
-const AP4_Atom::Type AP4_ATOM_TYPE_MEAN = AP4_ATOM_TYPE('m', 'e', 'a', 'n'); // namespace
-const AP4_Atom::Type AP4_ATOM_TYPE_NAME = AP4_ATOM_TYPE('n', 'a', 'm', 'e'); // name
-const AP4_Atom::Type AP4_ATOM_TYPE_dddd = AP4_ATOM_TYPE('-', '-', '-', '-'); // free form
-const AP4_Atom::Type AP4_ATOM_TYPE_cNAM = AP4_ATOM_TYPE(0xA9, 'n', 'a', 'm'); // name
-const AP4_Atom::Type AP4_ATOM_TYPE_cART = AP4_ATOM_TYPE(0xA9, 'A', 'R', 'T'); // artist
-const AP4_Atom::Type AP4_ATOM_TYPE_cCOM = AP4_ATOM_TYPE(0xA9, 'c', 'o', 'm'); // composer
-const AP4_Atom::Type AP4_ATOM_TYPE_cWRT = AP4_ATOM_TYPE(0xA9, 'w', 'r', 't'); // writer
-const AP4_Atom::Type AP4_ATOM_TYPE_cALB = AP4_ATOM_TYPE(0xA9, 'a', 'l', 'b'); // album
-const AP4_Atom::Type AP4_ATOM_TYPE_cGEN = AP4_ATOM_TYPE(0xA9, 'g', 'e', 'n'); // genre
-const AP4_Atom::Type AP4_ATOM_TYPE_cGRP = AP4_ATOM_TYPE(0xA9, 'g', 'r', 'p'); // group
-const AP4_Atom::Type AP4_ATOM_TYPE_cDAY = AP4_ATOM_TYPE(0xA9, 'd', 'a', 'y'); // date
-const AP4_Atom::Type AP4_ATOM_TYPE_cTOO = AP4_ATOM_TYPE(0xA9, 't', 'o', 'o'); // tool
-const AP4_Atom::Type AP4_ATOM_TYPE_cCMT = AP4_ATOM_TYPE(0xA9, 'c', 'm', 't'); // comment
-const AP4_Atom::Type AP4_ATOM_TYPE_cLYR = AP4_ATOM_TYPE(0xA9, 'l', 'y', 'r'); // lyrics
-const AP4_Atom::Type AP4_ATOM_TYPE_TRKN = AP4_ATOM_TYPE('t', 'r', 'k', 'n'); // track#
-const AP4_Atom::Type AP4_ATOM_TYPE_DISK = AP4_ATOM_TYPE('d', 'i', 's', 'k'); // disk#
-const AP4_Atom::Type AP4_ATOM_TYPE_COVR = AP4_ATOM_TYPE('c', 'o', 'v', 'r'); // cover art
-const AP4_Atom::Type AP4_ATOM_TYPE_DESC = AP4_ATOM_TYPE('d', 'e', 's', 'c'); // description
-const AP4_Atom::Type AP4_ATOM_TYPE_CPIL = AP4_ATOM_TYPE('c', 'p', 'i', 'l'); // compilation?
-const AP4_Atom::Type AP4_ATOM_TYPE_TMPO = AP4_ATOM_TYPE('t', 'm', 'p', 'o'); // tempo
-const AP4_Atom::Type AP4_ATOM_TYPE_apID = AP4_ATOM_TYPE('a', 'p', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_cnID = AP4_ATOM_TYPE('c', 'n', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_cmID = AP4_ATOM_TYPE('c', 'm', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_atID = AP4_ATOM_TYPE('a', 't', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_plID = AP4_ATOM_TYPE('p', 'l', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_geID = AP4_ATOM_TYPE('g', 'e', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_sfID = AP4_ATOM_TYPE('s', 'f', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_akID = AP4_ATOM_TYPE('a', 'k', 'I', 'D');
-const AP4_Atom::Type AP4_ATOM_TYPE_aART = AP4_ATOM_TYPE('a', 'A', 'R', 'T');
-const AP4_Atom::Type AP4_ATOM_TYPE_TVNN = AP4_ATOM_TYPE('t', 'v', 'n', 'n'); // TV network
-const AP4_Atom::Type AP4_ATOM_TYPE_TVSH = AP4_ATOM_TYPE('t', 'v', 's', 'h'); // TV show
-const AP4_Atom::Type AP4_ATOM_TYPE_TVEN = AP4_ATOM_TYPE('t', 'v', 'e', 'n'); // TV episode name
-const AP4_Atom::Type AP4_ATOM_TYPE_TVSN = AP4_ATOM_TYPE('t', 'v', 's', 'n'); // TV show season #
-const AP4_Atom::Type AP4_ATOM_TYPE_TVES = AP4_ATOM_TYPE('t', 'v', 'e', 's'); // TV show episode #
-const AP4_Atom::Type AP4_ATOM_TYPE_STIK = AP4_ATOM_TYPE('s', 't', 'i', 'k');
-const AP4_Atom::Type AP4_ATOM_TYPE_PCST = AP4_ATOM_TYPE('p', 'c', 's', 't'); // Podcast?
-const AP4_Atom::Type AP4_ATOM_TYPE_PURD = AP4_ATOM_TYPE('p', 'u', 'r', 'd'); //
-const AP4_Atom::Type AP4_ATOM_TYPE_PURL = AP4_ATOM_TYPE('p', 'u', 'r', 'l'); // Podcast URL (binary)
-const AP4_Atom::Type AP4_ATOM_TYPE_EGID = AP4_ATOM_TYPE('e', 'g', 'i', 'd'); //
-const AP4_Atom::Type AP4_ATOM_TYPE_PGAP = AP4_ATOM_TYPE('p', 'g', 'a', 'p'); // Gapless Playback
-const AP4_Atom::Type AP4_ATOM_TYPE_CATG = AP4_ATOM_TYPE('c', 'a', 't', 'g'); // Category
-const AP4_Atom::Type AP4_ATOM_TYPE_KEYW = AP4_ATOM_TYPE('k', 'e', 'y', 'w'); // Keywords
-const AP4_Atom::Type AP4_ATOM_TYPE_SONM = AP4_ATOM_TYPE('s', 'o', 'n', 'm'); // Sort-Order: Name
-const AP4_Atom::Type AP4_ATOM_TYPE_SOAL = AP4_ATOM_TYPE('s', 'o', 'a', 'l'); // Sort-Order: Album
-const AP4_Atom::Type AP4_ATOM_TYPE_SOAR = AP4_ATOM_TYPE('s', 'o', 'a', 'r'); // Sort-Order: Artist
-const AP4_Atom::Type AP4_ATOM_TYPE_SOAA = AP4_ATOM_TYPE('s', 'o', 'a', 'a'); // Sort-Order: Album Artist
-const AP4_Atom::Type AP4_ATOM_TYPE_SOCO = AP4_ATOM_TYPE('s', 'o', 'c', 'o'); // Sort-Order: Composer
-const AP4_Atom::Type AP4_ATOM_TYPE_SOSN = AP4_ATOM_TYPE('s', 'o', 's', 'n'); // Sort-Order: Show
-
-const AP4_Atom::Type AP4_ATOM_TYPE_TITL = AP4_ATOM_TYPE('t', 'i', 't', 'l'); // 3GPP: title
-const AP4_Atom::Type AP4_ATOM_TYPE_DSCP = AP4_ATOM_TYPE('d', 's', 'c', 'p'); // 3GPP: description
-const AP4_Atom::Type AP4_ATOM_TYPE_CPRT = AP4_ATOM_TYPE('c', 'p', 'r', 't'); // 3GPP, ISO or ILST: copyright
-const AP4_Atom::Type AP4_ATOM_TYPE_PERF = AP4_ATOM_TYPE('p', 'e', 'r', 'f'); // 3GPP: performer
-const AP4_Atom::Type AP4_ATOM_TYPE_AUTH = AP4_ATOM_TYPE('a', 'u', 't', 'h'); // 3GPP: author
-const AP4_Atom::Type AP4_ATOM_TYPE_GNRE = AP4_ATOM_TYPE('g', 'n', 'r', 'e'); // 3GPP or ILST: genre (in 3GPP -> string, in ILST -> ID3v1 index + 1)
-const AP4_Atom::Type AP4_ATOM_TYPE_RTNG = AP4_ATOM_TYPE('r', 't', 'n', 'g'); // 3GPP or ILST: rating
-const AP4_Atom::Type AP4_ATOM_TYPE_CLSF = AP4_ATOM_TYPE('c', 'l', 's', 'f'); // 3GPP: classification
-const AP4_Atom::Type AP4_ATOM_TYPE_KYWD = AP4_ATOM_TYPE('k', 'y', 'w', 'd'); // 3GPP: keywords
-const AP4_Atom::Type AP4_ATOM_TYPE_LOCI = AP4_ATOM_TYPE('l', 'o', 'c', 'i'); // 3GPP: location information
-const AP4_Atom::Type AP4_ATOM_TYPE_ALBM = AP4_ATOM_TYPE('a', 'l', 'b', 'm'); // 3GPP: album title and track number
-const AP4_Atom::Type AP4_ATOM_TYPE_YRRC = AP4_ATOM_TYPE('y', 'r', 'r', 'c'); // 3GPP: recording year
-const AP4_Atom::Type AP4_ATOM_TYPE_TSEL = AP4_ATOM_TYPE('t', 's', 'e', 'l'); // 3GPP: track selection
-
-const AP4_Atom::Type AP4_ATOM_TYPE_ICNU = AP4_ATOM_TYPE('i', 'c', 'n', 'u'); // DCF: icon URI (OMA DCF 2.1)
-const AP4_Atom::Type AP4_ATOM_TYPE_INFU = AP4_ATOM_TYPE('i', 'n', 'f', 'u'); // DCF: info URI (OMA DCF 2.1)
-const AP4_Atom::Type AP4_ATOM_TYPE_CVRU = AP4_ATOM_TYPE('c', 'v', 'r', 'u'); // DCF: cover art URI (OMA DCF 2.1)
-const AP4_Atom::Type AP4_ATOM_TYPE_LRCU = AP4_ATOM_TYPE('l', 'r', 'c', 'u'); // DCF: lyrics URI (OMA DCF 2.1)
-const AP4_Atom::Type AP4_ATOM_TYPE_DCFD = AP4_ATOM_TYPE('d', 'c', 'f', 'D'); // DCF: duration (OMarlin)
+const AP4_Atom::Type AP4_ATOM_TYPE_DATA = AP4_ATOM_TYPE('d','a','t','a'); // data
+const AP4_Atom::Type AP4_ATOM_TYPE_MEAN = AP4_ATOM_TYPE('m','e','a','n'); // namespace
+const AP4_Atom::Type AP4_ATOM_TYPE_NAME = AP4_ATOM_TYPE('n','a','m','e'); // name
+const AP4_Atom::Type AP4_ATOM_TYPE_dddd = AP4_ATOM_TYPE('-','-','-','-'); // free form
+const AP4_Atom::Type AP4_ATOM_TYPE_cNAM = AP4_ATOM_TYPE(0xA9,'n','a','m'); // name
+const AP4_Atom::Type AP4_ATOM_TYPE_cART = AP4_ATOM_TYPE(0xA9,'A','R','T'); // artist
+const AP4_Atom::Type AP4_ATOM_TYPE_cCOM = AP4_ATOM_TYPE(0xA9,'c','o','m'); // composer
+const AP4_Atom::Type AP4_ATOM_TYPE_cWRT = AP4_ATOM_TYPE(0xA9,'w','r','t'); // writer
+const AP4_Atom::Type AP4_ATOM_TYPE_cALB = AP4_ATOM_TYPE(0xA9,'a','l','b'); // album
+const AP4_Atom::Type AP4_ATOM_TYPE_cGEN = AP4_ATOM_TYPE(0xA9,'g','e','n'); // genre
+const AP4_Atom::Type AP4_ATOM_TYPE_cGRP = AP4_ATOM_TYPE(0xA9,'g','r','p'); // group
+const AP4_Atom::Type AP4_ATOM_TYPE_cDAY = AP4_ATOM_TYPE(0xA9,'d','a','y'); // date
+const AP4_Atom::Type AP4_ATOM_TYPE_cTOO = AP4_ATOM_TYPE(0xA9,'t','o','o'); // tool
+const AP4_Atom::Type AP4_ATOM_TYPE_cCMT = AP4_ATOM_TYPE(0xA9,'c','m','t'); // comment
+const AP4_Atom::Type AP4_ATOM_TYPE_cLYR = AP4_ATOM_TYPE(0xA9,'l','y','r'); // lyrics
+const AP4_Atom::Type AP4_ATOM_TYPE_TRKN = AP4_ATOM_TYPE('t','r','k','n'); // track#
+const AP4_Atom::Type AP4_ATOM_TYPE_DISK = AP4_ATOM_TYPE('d','i','s','k'); // disk#
+const AP4_Atom::Type AP4_ATOM_TYPE_COVR = AP4_ATOM_TYPE('c','o','v','r'); // cover art
+const AP4_Atom::Type AP4_ATOM_TYPE_DESC = AP4_ATOM_TYPE('d','e','s','c'); // description
+const AP4_Atom::Type AP4_ATOM_TYPE_CPIL = AP4_ATOM_TYPE('c','p','i','l'); // compilation?
+const AP4_Atom::Type AP4_ATOM_TYPE_TMPO = AP4_ATOM_TYPE('t','m','p','o'); // tempo
+const AP4_Atom::Type AP4_ATOM_TYPE_apID = AP4_ATOM_TYPE('a','p','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_cnID = AP4_ATOM_TYPE('c','n','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_cmID = AP4_ATOM_TYPE('c','m','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_atID = AP4_ATOM_TYPE('a','t','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_plID = AP4_ATOM_TYPE('p','l','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_geID = AP4_ATOM_TYPE('g','e','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_sfID = AP4_ATOM_TYPE('s','f','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_akID = AP4_ATOM_TYPE('a','k','I','D');
+const AP4_Atom::Type AP4_ATOM_TYPE_aART = AP4_ATOM_TYPE('a','A','R','T');
+const AP4_Atom::Type AP4_ATOM_TYPE_TVNN = AP4_ATOM_TYPE('t','v','n','n'); // TV network
+const AP4_Atom::Type AP4_ATOM_TYPE_TVSH = AP4_ATOM_TYPE('t','v','s','h'); // TV show
+const AP4_Atom::Type AP4_ATOM_TYPE_TVEN = AP4_ATOM_TYPE('t','v','e','n'); // TV episode name
+const AP4_Atom::Type AP4_ATOM_TYPE_TVSN = AP4_ATOM_TYPE('t','v','s','n'); // TV show season #
+const AP4_Atom::Type AP4_ATOM_TYPE_TVES = AP4_ATOM_TYPE('t','v','e','s'); // TV show episode #
+const AP4_Atom::Type AP4_ATOM_TYPE_STIK = AP4_ATOM_TYPE('s','t','i','k');
+const AP4_Atom::Type AP4_ATOM_TYPE_PCST = AP4_ATOM_TYPE('p','c','s','t'); // Podcast?
+const AP4_Atom::Type AP4_ATOM_TYPE_PURD = AP4_ATOM_TYPE('p','u','r','d'); //
+const AP4_Atom::Type AP4_ATOM_TYPE_PURL = AP4_ATOM_TYPE('p','u','r','l'); // Podcast URL (binary)
+const AP4_Atom::Type AP4_ATOM_TYPE_EGID = AP4_ATOM_TYPE('e','g','i','d'); //
+const AP4_Atom::Type AP4_ATOM_TYPE_PGAP = AP4_ATOM_TYPE('p','g','a','p'); // Gapless Playback
+const AP4_Atom::Type AP4_ATOM_TYPE_CATG = AP4_ATOM_TYPE('c','a','t','g'); // Category
+const AP4_Atom::Type AP4_ATOM_TYPE_KEYW = AP4_ATOM_TYPE('k','e','y','w'); // Keywords
+const AP4_Atom::Type AP4_ATOM_TYPE_SONM = AP4_ATOM_TYPE('s','o','n','m'); // Sort-Order: Name
+const AP4_Atom::Type AP4_ATOM_TYPE_SOAL = AP4_ATOM_TYPE('s','o','a','l'); // Sort-Order: Album
+const AP4_Atom::Type AP4_ATOM_TYPE_SOAR = AP4_ATOM_TYPE('s','o','a','r'); // Sort-Order: Artist
+const AP4_Atom::Type AP4_ATOM_TYPE_SOAA = AP4_ATOM_TYPE('s','o','a','a'); // Sort-Order: Album Artist
+const AP4_Atom::Type AP4_ATOM_TYPE_SOCO = AP4_ATOM_TYPE('s','o','c','o'); // Sort-Order: Composer
+const AP4_Atom::Type AP4_ATOM_TYPE_SOSN = AP4_ATOM_TYPE('s','o','s','n'); // Sort-Order: Show
+
+const AP4_Atom::Type AP4_ATOM_TYPE_TITL = AP4_ATOM_TYPE('t','i','t','l'); // 3GPP: title
+const AP4_Atom::Type AP4_ATOM_TYPE_DSCP = AP4_ATOM_TYPE('d','s','c','p'); // 3GPP: description
+const AP4_Atom::Type AP4_ATOM_TYPE_CPRT = AP4_ATOM_TYPE('c','p','r','t'); // 3GPP, ISO or ILST: copyright
+const AP4_Atom::Type AP4_ATOM_TYPE_PERF = AP4_ATOM_TYPE('p','e','r','f'); // 3GPP: performer
+const AP4_Atom::Type AP4_ATOM_TYPE_AUTH = AP4_ATOM_TYPE('a','u','t','h'); // 3GPP: author
+const AP4_Atom::Type AP4_ATOM_TYPE_GNRE = AP4_ATOM_TYPE('g','n','r','e'); // 3GPP or ILST: genre (in 3GPP -> string, in ILST -> ID3v1 index + 1)
+const AP4_Atom::Type AP4_ATOM_TYPE_RTNG = AP4_ATOM_TYPE('r','t','n','g'); // 3GPP or ILST: rating
+const AP4_Atom::Type AP4_ATOM_TYPE_CLSF = AP4_ATOM_TYPE('c','l','s','f'); // 3GPP: classification
+const AP4_Atom::Type AP4_ATOM_TYPE_KYWD = AP4_ATOM_TYPE('k','y','w','d'); // 3GPP: keywords
+const AP4_Atom::Type AP4_ATOM_TYPE_LOCI = AP4_ATOM_TYPE('l','o','c','i'); // 3GPP: location information
+const AP4_Atom::Type AP4_ATOM_TYPE_ALBM = AP4_ATOM_TYPE('a','l','b','m'); // 3GPP: album title and track number
+const AP4_Atom::Type AP4_ATOM_TYPE_YRRC = AP4_ATOM_TYPE('y','r','r','c'); // 3GPP: recording year
+const AP4_Atom::Type AP4_ATOM_TYPE_TSEL = AP4_ATOM_TYPE('t','s','e','l'); // 3GPP: track selection
+
+const AP4_Atom::Type AP4_ATOM_TYPE_ICNU = AP4_ATOM_TYPE('i','c','n','u'); // DCF: icon URI (OMA DCF 2.1)
+const AP4_Atom::Type AP4_ATOM_TYPE_INFU = AP4_ATOM_TYPE('i','n','f','u'); // DCF: info URI (OMA DCF 2.1)
+const AP4_Atom::Type AP4_ATOM_TYPE_CVRU = AP4_ATOM_TYPE('c','v','r','u'); // DCF: cover art URI (OMA DCF 2.1)
+const AP4_Atom::Type AP4_ATOM_TYPE_LRCU = AP4_ATOM_TYPE('l','r','c','u'); // DCF: lyrics URI (OMA DCF 2.1)
+const AP4_Atom::Type AP4_ATOM_TYPE_DCFD = AP4_ATOM_TYPE('d','c','f','D'); // DCF: duration (OMarlin)
/*----------------------------------------------------------------------
| AP4_MetaData
+---------------------------------------------------------------------*/
-class AP4_MetaData
-{
+class AP4_MetaData {
public:
- class Key
- {
+ class Key {
public:
// constructors
Key(const char* name, const char* ns) :
- m_Name(name), m_Namespace(ns) {}
+ m_Name(name), m_Namespace(ns) {}
// methods
- const AP4_String& GetNamespace() const
- {
- return m_Namespace;
- }
- const AP4_String& GetName() const
- {
- return m_Name;
- }
+ const AP4_String& GetNamespace() const { return m_Namespace; }
+ const AP4_String& GetName() const { return m_Name; }
private:
// members
@@ -152,12 +144,10 @@ public:
const AP4_String m_Namespace;
};
- class Value
- {
+ class Value {
public:
- // types
- typedef enum
- {
+ // types
+ typedef enum {
TYPE_BINARY,
TYPE_STRING_UTF_8,
TYPE_STRING_UTF_16,
@@ -171,55 +161,41 @@ public:
TYPE_FLOAT_64_BE
} Type;
- typedef enum
- {
+ typedef enum {
TYPE_CATEGORY_STRING,
TYPE_CATEGORY_BINARY,
TYPE_CATEGORY_INTEGER,
TYPE_CATEGORY_FLOAT
} TypeCategory;
- typedef enum
- {
+ typedef enum {
MEANING_UNKNOWN,
MEANING_ID3_GENRE,
MEANING_BOOLEAN,
MEANING_FILE_KIND,
MEANING_BINARY_ENCODED_CHARS
} Meaning;
-
+
// destructor
virtual ~Value() {}
// methods
- Type GetType() const
- {
- return m_Type;
- }
+ Type GetType() const { return m_Type; }
TypeCategory GetTypeCategory() const;
- Meaning GetMeaning() const
- {
- return m_Meaning;
- }
- const AP4_String& GetLanguage() const
- {
- return m_Language;
- }
- void SetLanguage(const char* language)
- {
- m_Language = language;
- }
+ Meaning GetMeaning() const { return m_Meaning; }
+ const AP4_String& GetLanguage() const { return m_Language; }
+ void SetLanguage(const char* language) { m_Language = language; }
virtual AP4_String ToString() const = 0;
virtual AP4_Result ToBytes(AP4_DataBuffer& bytes) const = 0;
virtual long ToInteger() const = 0;
-
+
protected:
// class methods
static TypeCategory MapTypeToCategory(Type type);
-
+
// constructor
- Value(Type type,
- Meaning meaning = MEANING_UNKNOWN,
+ Value(Type type,
+ Meaning meaning = MEANING_UNKNOWN,
const char* language = NULL) :
m_Type(type), m_Meaning(meaning), m_Language(language) {}
@@ -228,9 +204,8 @@ public:
Meaning m_Meaning;
AP4_String m_Language;
};
-
- class KeyInfo
- {
+
+ class KeyInfo {
public:
// members
const char* name;
@@ -239,18 +214,14 @@ public:
Value::Type value_type;
};
- class Entry
- {
+ class Entry {
public:
// constructor
Entry(const char* name, const char* ns, Value* value) :
- m_Key(name, ns), m_Value(value) {}
+ m_Key(name, ns), m_Value(value) {}
// destructor
- ~Entry()
- {
- delete m_Value;
- }
+ ~Entry() { delete m_Value; }
// methods
AP4_Result AddToFile(AP4_File& file, AP4_Ordinal index = 0);
@@ -264,7 +235,7 @@ public:
// members
Key m_Key;
- Value* m_Value;
+ Value* m_Value;
};
// class members
@@ -272,19 +243,16 @@ public:
// constructor
AP4_MetaData(AP4_File* file);
-
+
// methods
AP4_Result ParseMoov(AP4_MoovAtom* moov);
AP4_Result ParseUdta(AP4_ContainerAtom* udta, const char* namespc);
-
+
// destructor
~AP4_MetaData();
// accessors
- const AP4_List<Entry>& GetEntries() const
- {
- return m_Entries;
- }
+ const AP4_List<Entry>& GetEntries() const { return m_Entries; }
// methods
AP4_Result ResolveKeyName(AP4_Atom::Type atom_type, AP4_String& value);
@@ -292,7 +260,7 @@ public:
AP4_Result Add3GppEntry(AP4_3GppLocalizedStringAtom* atom, const char* namespc);
AP4_Result AddDcfStringEntry(AP4_DcfStringAtom* atom, const char* namespc);
AP4_Result AddDcfdEntry(AP4_DcfdAtom* atom, const char* namespc);
-
+
private:
// members
AP4_List<Entry> m_Entries;
@@ -306,7 +274,7 @@ class AP4_MetaDataAtomTypeHandler : public AP4_AtomFactory::TypeHandler
public:
// constructor
AP4_MetaDataAtomTypeHandler(AP4_AtomFactory* atom_factory) :
- m_AtomFactory(atom_factory) {}
+ m_AtomFactory(atom_factory) {}
virtual AP4_Result CreateAtom(AP4_Atom::Type type,
AP4_UI32 size,
AP4_ByteStream& stream,
@@ -314,12 +282,11 @@ public:
AP4_Atom*& atom);
// types
- struct TypeList
- {
+ struct TypeList {
const AP4_Atom::Type* m_Types;
AP4_Size m_Size;
};
-
+
// class constants
static const AP4_Atom::Type IlstTypes[];
static const TypeList IlstTypeList;
@@ -329,7 +296,7 @@ public:
static const TypeList _3gppOtherTypeList;
static const AP4_Atom::Type DcfStringTypes[];
static const TypeList DcfStringTypeList;
-
+
// class methods
static bool IsTypeInList(AP4_Atom::Type type, const TypeList& list);
@@ -354,9 +321,9 @@ public:
protected:
// constructor
- AP4_MetaDataTag(AP4_UI32 data_type,
+ AP4_MetaDataTag(AP4_UI32 data_type,
AP4_UI32 data_lang,
- AP4_Size size,
+ AP4_Size size,
AP4_ByteStream& stream);
};
@@ -371,29 +338,23 @@ public:
// factory method
static AP4_3GppLocalizedStringAtom* Create(Type type, AP4_UI32 size, AP4_ByteStream& stream);
-
+
// constructor
AP4_3GppLocalizedStringAtom(Type type, const char* language, const char* value);
- AP4_3GppLocalizedStringAtom(Type type,
- AP4_UI32 size,
+ AP4_3GppLocalizedStringAtom(Type type,
+ AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
-
+
// AP4_Atom methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// methods
- const char* GetLanguage() const
- {
- return m_Language;
- }
- const AP4_String& GetValue() const
- {
- return m_Value;
- }
-
+ const char* GetLanguage() const { return m_Language; }
+ const AP4_String& GetValue() const { return m_Value; }
+
private:
// members
char m_Language[4];
@@ -410,25 +371,22 @@ public:
// factory method
static AP4_DcfStringAtom* Create(Type type, AP4_UI32 size, AP4_ByteStream& stream);
-
+
// constructor
AP4_DcfStringAtom(Type type, const char* value);
- AP4_DcfStringAtom(Type type,
- AP4_UI32 size,
+ AP4_DcfStringAtom(Type type,
+ AP4_UI32 size,
AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
-
+
// AP4_Atom methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// methods
- const AP4_String& GetValue() const
- {
- return m_Value;
- }
-
+ const AP4_String& GetValue() const { return m_Value; }
+
private:
// members
AP4_String m_Value;
@@ -444,23 +402,20 @@ public:
// factory method
static AP4_DcfdAtom* Create(AP4_UI32 size, AP4_ByteStream& stream);
-
+
// constructors
AP4_DcfdAtom(AP4_UI32 version,
AP4_UI32 flags,
AP4_ByteStream& stream);
AP4_DcfdAtom(AP4_UI32 duration);
-
+
// AP4_Atom methods
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
-
+
// methods
- AP4_UI32 GetDuration() const
- {
- return m_Duration;
- }
-
+ AP4_UI32 GetDuration() const { return m_Duration; }
+
private:
// members
AP4_UI32 m_Duration;
@@ -481,10 +436,7 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// methods
- const AP4_String& GetValue()
- {
- return m_Value;
- }
+ const AP4_String& GetValue() { return m_Value; }
private:
// members
@@ -500,8 +452,7 @@ class AP4_DataAtom : public AP4_Atom
public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_DataAtom, AP4_Atom)
- typedef enum
- {
+ typedef enum {
DATA_TYPE_BINARY = 0,
DATA_TYPE_STRING_UTF_8 = 1,
DATA_TYPE_STRING_UTF_16 = 2,
@@ -513,8 +464,7 @@ public:
DATA_TYPE_FLOAT_64_BE = 23
} DataType;
- typedef enum
- {
+ typedef enum {
LANGUAGE_ENGLISH = 0
} DataLang;
@@ -530,16 +480,10 @@ public:
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// accessors
- DataType GetDataType()
- {
- return m_DataType;
- }
- DataLang GetDataLang()
- {
- return m_DataLang;
- }
+ DataType GetDataType() { return m_DataType; }
+ DataLang GetDataLang() { return m_DataLang; }
AP4_MetaData::Value::Type GetValueType();
-
+
// methods
AP4_Result LoadString(AP4_String*& string);
AP4_Result LoadBytes(AP4_DataBuffer& bytes);
@@ -555,19 +499,18 @@ private:
/*----------------------------------------------------------------------
| AP4_StringMetaDataValue
+---------------------------------------------------------------------*/
-class AP4_StringMetaDataValue : public AP4_MetaData::Value
-{
+class AP4_StringMetaDataValue : public AP4_MetaData::Value {
public:
// constructor
- AP4_StringMetaDataValue(const char* value, const char* language = NULL) :
- Value(TYPE_STRING_UTF_8, MEANING_UNKNOWN, language),
+ AP4_StringMetaDataValue(const char* value, const char* language=NULL) :
+ Value(TYPE_STRING_UTF_8, MEANING_UNKNOWN, language),
m_Value(value) {}
// AP4_MetaData::Value methods
virtual AP4_String ToString() const;
virtual AP4_Result ToBytes(AP4_DataBuffer& bytes) const;
virtual long ToInteger() const;
-
+
private:
// members
AP4_String m_Value;
@@ -576,8 +519,7 @@ private:
/*----------------------------------------------------------------------
| AP4_IntegerMetaDataValue
+---------------------------------------------------------------------*/
-class AP4_IntegerMetaDataValue : public AP4_MetaData::Value
-{
+class AP4_IntegerMetaDataValue : public AP4_MetaData::Value {
public:
// constructor
AP4_IntegerMetaDataValue(Type type, long value) :
@@ -587,7 +529,7 @@ public:
virtual AP4_String ToString() const;
virtual AP4_Result ToBytes(AP4_DataBuffer& bytes) const;
virtual long ToInteger() const;
-
+
private:
// members
long m_Value;
@@ -596,8 +538,7 @@ private:
/*----------------------------------------------------------------------
| AP4_BinaryMetaDataValue
+---------------------------------------------------------------------*/
-class AP4_BinaryMetaDataValue : public AP4_MetaData::Value
-{
+class AP4_BinaryMetaDataValue : public AP4_MetaData::Value {
public:
// constructor
AP4_BinaryMetaDataValue(Type type, const AP4_UI08* data, AP4_Size size) :
@@ -607,7 +548,7 @@ public:
virtual AP4_String ToString() const;
virtual AP4_Result ToBytes(AP4_DataBuffer& bytes) const;
virtual long ToInteger() const;
-
+
private:
// members
AP4_DataBuffer m_Value;
diff --git a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp
index c77a070b0..2721e811d 100644
--- a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp
+++ b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.cpp
@@ -1,54 +1,54 @@
#include "stdafx.h"
#include "Ap4AsyncReaderStream.h"
-AP4_AsyncReaderStream::AP4_AsyncReaderStream(CBaseSplitterFile* pFile)
- : m_refs(1)
- , m_pFile(pFile)
+AP4_AsyncReaderStream::AP4_AsyncReaderStream(CBaseSplitterFile* pFile)
+ : m_refs(1)
+ , m_pFile(pFile)
{
- ASSERT(pFile);
+ ASSERT(pFile);
}
AP4_AsyncReaderStream::~AP4_AsyncReaderStream()
{
- ASSERT(m_refs == 0);
+ ASSERT(m_refs == 0);
}
void AP4_AsyncReaderStream::AddReference()
{
- ASSERT(m_refs > 0);
- ++m_refs;
+ ASSERT(m_refs > 0);
+ ++m_refs;
}
void AP4_AsyncReaderStream::Release()
{
- ASSERT(m_refs > 0);
- if(--m_refs == 0) delete this;
+ ASSERT(m_refs > 0);
+ if(--m_refs == 0) delete this;
}
AP4_Result AP4_AsyncReaderStream::ReadPartial(void* buffer, AP4_Size bytesToRead, AP4_Size& bytesRead)
{
- AP4_Size bytesAvail = (AP4_Size)m_pFile->GetRemaining();
+ AP4_Size bytesAvail = (AP4_Size)m_pFile->GetRemaining();
- if(bytesAvail < bytesToRead)
- {
- bytesRead = bytesAvail;
- bytesToRead = bytesAvail;
- }
+ if(bytesAvail < bytesToRead)
+ {
+ bytesRead = bytesAvail;
+ bytesToRead = bytesAvail;
+ }
- if(bytesAvail == 0)
- {
- return AP4_ERROR_EOS;
- }
+ if(bytesAvail == 0)
+ {
+ return AP4_ERROR_EOS;
+ }
- if(FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead)))
- {
- bytesRead = 0;
- return AP4_ERROR_READ_FAILED;
- }
+ if(FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead)))
+ {
+ bytesRead = 0;
+ return AP4_ERROR_READ_FAILED;
+ }
- bytesRead = bytesToRead;
+ bytesRead = bytesToRead;
- return AP4_SUCCESS;
+ return AP4_SUCCESS;
}
AP4_Result AP4_AsyncReaderStream::WritePartial(const void* buffer, AP4_Size bytesToWrite, AP4_Size& bytesWritten)
@@ -58,18 +58,18 @@ AP4_Result AP4_AsyncReaderStream::WritePartial(const void* buffer, AP4_Size byte
AP4_Result AP4_AsyncReaderStream::Seek(AP4_Position offset)
{
- m_pFile->Seek(offset);
- return m_pFile->GetPos() == offset ? AP4_SUCCESS : AP4_FAILURE;
+ m_pFile->Seek(offset);
+ return m_pFile->GetPos() == offset ? AP4_SUCCESS : AP4_FAILURE;
}
AP4_Result AP4_AsyncReaderStream::Tell(AP4_Position& offset)
{
- offset = (AP4_Offset)m_pFile->GetPos();
- return AP4_SUCCESS;
+ offset = (AP4_Offset)m_pFile->GetPos();
+ return AP4_SUCCESS;
}
AP4_Result AP4_AsyncReaderStream::GetSize(AP4_LargeSize& size)
{
- size = m_pFile->GetLength();
- return AP4_SUCCESS;
+ size = m_pFile->GetLength();
+ return AP4_SUCCESS;
} \ No newline at end of file
diff --git a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.h b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.h
index 0c8512ee9..28e5f1c06 100644
--- a/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.h
+++ b/src/filters/parser/MP4Splitter/Ap4AsyncReaderStream.h
@@ -16,19 +16,19 @@
class AP4_AsyncReaderStream : public AP4_ByteStream
{
- int m_refs;
- CBaseSplitterFile* m_pFile;
+ int m_refs;
+ CBaseSplitterFile* m_pFile;
public:
- AP4_AsyncReaderStream(CBaseSplitterFile* pFile);
- virtual ~AP4_AsyncReaderStream();
+ AP4_AsyncReaderStream(CBaseSplitterFile* pFile);
+ virtual ~AP4_AsyncReaderStream();
- void AddReference();
- void Release();
+ void AddReference();
+ void Release();
- virtual AP4_Result ReadPartial(void* buffer, AP4_Size bytesToRead, AP4_Size& bytesRead);
- virtual AP4_Result WritePartial(const void* buffer, AP4_Size bytesToWrite, AP4_Size& bytesWritten);
- virtual AP4_Result Seek(AP4_Position offset);
- virtual AP4_Result Tell(AP4_Position& offset);
- virtual AP4_Result GetSize(AP4_LargeSize& size);
+ virtual AP4_Result ReadPartial(void* buffer, AP4_Size bytesToRead, AP4_Size& bytesRead);
+ virtual AP4_Result WritePartial(const void* buffer, AP4_Size bytesToWrite, AP4_Size& bytesWritten);
+ virtual AP4_Result Seek(AP4_Position offset);
+ virtual AP4_Result Tell(AP4_Position& offset);
+ virtual AP4_Result GetSize(AP4_LargeSize& size);
}; \ No newline at end of file
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.cpp b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
index 394dea364..cd5f370cf 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.cpp
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -41,61 +41,61 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MP4},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MP4},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMP4SplitterFilter), L"MPC - MP4 Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMP4SourceFilter), L"MPC - MP4 Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMPEG4VideoSplitterFilter), L"MPC - MPEG4 Video Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMPEG4VideoSourceFilter), L"MPC - MPEG4 Video Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMP4SplitterFilter), L"MPC - MP4 Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMP4SourceFilter), L"MPC - MP4 Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMPEG4VideoSplitterFilter), L"MPC - MPEG4 Video Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMPEG4VideoSourceFilter), L"MPC - MPEG4 Video Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMP4SplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMP4SourceFilter>, NULL, &sudFilter[1]},
- {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CMPEG4VideoSplitterFilter>, NULL, &sudFilter[2]},
- {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CMPEG4VideoSourceFilter>, NULL, &sudFilter[3]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMP4SplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMP4SourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CMPEG4VideoSplitterFilter>, NULL, &sudFilter[2]},
+ {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CMPEG4VideoSourceFilter>, NULL, &sudFilter[3]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".mp4"));
- DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".mov"));
+ DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".mp4"));
+ DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".mov"));
- CAtlList<CString> chkbytes;
+ CAtlList<CString> chkbytes;
- // mp4
- chkbytes.AddTail(_T("4,4,,66747970")); // ftyp
- chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov
- chkbytes.AddTail(_T("4,4,,6d646174")); // mdat
- chkbytes.AddTail(_T("4,4,,736b6970")); // skip
- chkbytes.AddTail(_T("4,12,ffffffff00000000ffffffff,77696465027fe3706d646174")); // wide ? mdat
+ // mp4
+ chkbytes.AddTail(_T("4,4,,66747970")); // ftyp
+ chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov
+ chkbytes.AddTail(_T("4,4,,6d646174")); // mdat
+ chkbytes.AddTail(_T("4,4,,736b6970")); // skip
+ chkbytes.AddTail(_T("4,12,ffffffff00000000ffffffff,77696465027fe3706d646174")); // wide ? mdat
- // mpeg4 video
- chkbytes.AddTail(_T("3,3,,000001"));
+ // mpeg4 video
+ chkbytes.AddTail(_T("3,3,,000001"));
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MP4, chkbytes, NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MP4, chkbytes, NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_MP4);
+ UnRegisterSourceFilter(MEDIASUBTYPE_MP4);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -104,15 +104,15 @@ CFilterApp theApp;
#endif
-AP4_Result GetDataBuffer(AP4_Atom* atom, AP4_DataBuffer& db)
+AP4_Result GetDataBuffer (AP4_Atom* atom, AP4_DataBuffer& db)
{
- AP4_MemoryByteStream* mbs = new AP4_MemoryByteStream(db);
- AP4_Result res;
+ AP4_MemoryByteStream* mbs = new AP4_MemoryByteStream(db);
+ AP4_Result res;
- res = atom->Write(*mbs);
- mbs->Release(); // Release delete the object!
+ res = atom->Write (*mbs);
+ mbs->Release(); // Release delete the object!
- return res;
+ return res;
}
@@ -121,7 +121,7 @@ AP4_Result GetDataBuffer(AP4_Atom* atom, AP4_DataBuffer& db)
//
CMP4SplitterFilter::CMP4SplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CMP4SplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CMP4SplitterFilter"), pUnk, phr, __uuidof(this))
{
}
@@ -131,1191 +131,1145 @@ CMP4SplitterFilter::~CMP4SplitterFilter()
HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_trackpos.RemoveAll();
-
- m_pFile.Free();
- m_pFile.Attach(DNew CMP4SplitterFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- m_framesize.SetSize(640, 480);
-
- if(AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie())
- {
- for(AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
- item;
- item = item->GetNext())
- {
- AP4_Track* track = item->GetData();
-
- if(track->GetType() != AP4_Track::TYPE_VIDEO
- && track->GetType() != AP4_Track::TYPE_AUDIO
- && track->GetType() != AP4_Track::TYPE_TEXT
- && track->GetType() != AP4_Track::TYPE_SUBP)
- continue;
-
- AP4_Sample sample;
-
- if(!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF)
- continue;
-
- CStringW TrackName = UTF8To16(track->GetTrackName().GetChars());
- CStringA TrackLanguage = track->GetTrackLanguage().GetChars();
-
- CAtlArray<CMediaType> mts;
-
- CMediaType mt;
- mt.SetSampleSize(1);
-
- VIDEOINFOHEADER* vih = NULL;
- WAVEFORMATEX* wfe = NULL;
-
- AP4_DataBuffer empty;
-
- if(AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex()))
- {
- AP4_MpegSampleDescription* mpeg_desc = NULL;
-
- if(desc->GetType() == AP4_SampleDescription::TYPE_MPEG)
- {
- mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
- }
- else if(desc->GetType() == AP4_SampleDescription::TYPE_PROTECTED)
- {
- AP4_ProtectedSampleDescription* isma_desc = dynamic_cast<AP4_ProtectedSampleDescription*>(desc);
- mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(isma_desc->GetOriginalSampleDescription());
- }
-
- if(AP4_MpegVideoSampleDescription* video_desc =
- dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc))
- {
- const AP4_DataBuffer& di = video_desc->GetDecoderInfo();
- //if(!di) di = &empty;
-
- mt.majortype = MEDIATYPE_Video;
- mt.formattype = FORMAT_VideoInfo;
- vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + di.GetDataSize());
- memset(vih, 0, mt.FormatLength());
- vih->dwBitRate = video_desc->GetAvgBitrate() / 8;
- vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
- vih->bmiHeader.biWidth = (LONG)video_desc->GetWidth();
- vih->bmiHeader.biHeight = (LONG)video_desc->GetHeight();
- memcpy(vih + 1, di.GetData(), di.GetDataSize());
-
- switch(video_desc->GetObjectTypeId())
- {
- case AP4_OTI_MPEG4_VISUAL:
- mt.subtype = FOURCCMap('v4pm');
- mt.formattype = FORMAT_MPEG2Video;
- {
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + di.GetDataSize());
- memset(vih, 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biWidth = (LONG)video_desc->GetWidth();
- vih->hdr.bmiHeader.biHeight = (LONG)video_desc->GetHeight();
- vih->hdr.bmiHeader.biCompression = 'v4pm';
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- vih->hdr.dwPictAspectRatioX = vih->hdr.bmiHeader.biWidth;
- vih->hdr.dwPictAspectRatioY = vih->hdr.bmiHeader.biHeight;
- vih->cbSequenceHeader = di.GetDataSize();
- memcpy(vih->dwSequenceHeader, di.GetData(), di.GetDataSize());
- mts.Add(mt);
- mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = 'V4PM');
- mts.Add(mt);
- }
- break;
- case AP4_OTI_MPEG2_VISUAL_SIMPLE:
- case AP4_OTI_MPEG2_VISUAL_MAIN:
- case AP4_OTI_MPEG2_VISUAL_SNR:
- case AP4_OTI_MPEG2_VISUAL_SPATIAL:
- case AP4_OTI_MPEG2_VISUAL_HIGH:
- case AP4_OTI_MPEG2_VISUAL_422:
- mt.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
- {
- m_pFile->Seek(sample.GetOffset());
- CBaseSplitterFileEx::seqhdr h;
- CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2))
- mt = mt2;
- }
- mts.Add(mt);
- break;
- case AP4_OTI_MPEG1_VISUAL: // ???
- mt.subtype = MEDIASUBTYPE_MPEG1Payload;
- {
- m_pFile->Seek(sample.GetOffset());
- CBaseSplitterFileEx::seqhdr h;
- CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), &mt2))
- mt = mt2;
- }
- mts.Add(mt);
- break;
- }
-
- if(mt.subtype == GUID_NULL)
- {
- TRACE(_T("Unknown video OBI: %02x\n"), video_desc->GetObjectTypeId());
- }
- }
- else if(AP4_MpegAudioSampleDescription* audio_desc =
- dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc))
- {
- const AP4_DataBuffer& di = audio_desc->GetDecoderInfo();
- //if(!di) di = &empty;
-
- mt.majortype = MEDIATYPE_Audio;
- mt.formattype = FORMAT_WaveFormatEx;
-
- wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + di.GetDataSize());
- memset(wfe, 0, mt.FormatLength());
- wfe->nSamplesPerSec = audio_desc->GetSampleRate();
- wfe->nAvgBytesPerSec = audio_desc->GetAvgBitrate() / 8;
- wfe->nChannels = audio_desc->GetChannelCount();
- wfe->wBitsPerSample = audio_desc->GetSampleSize();
- wfe->cbSize = (WORD)di.GetDataSize();
- memcpy(wfe + 1, di.GetData(), di.GetDataSize());
-
- switch(audio_desc->GetObjectTypeId())
- {
- case AP4_OTI_MPEG4_AUDIO:
- case AP4_OTI_MPEG2_AAC_AUDIO_MAIN: // ???
- case AP4_OTI_MPEG2_AAC_AUDIO_LC: // ???
- case AP4_OTI_MPEG2_AAC_AUDIO_SSRP: // ???
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
- if(wfe->cbSize >= 2) wfe->nChannels = (((BYTE*)(wfe + 1))[1] >> 3) & 0xf;
- mts.Add(mt);
- break;
- case AP4_OTI_MPEG2_PART3_AUDIO: // ???
- case AP4_OTI_MPEG1_AUDIO:
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
- {
- m_pFile->Seek(sample.GetOffset());
- CBaseSplitterFileEx::mpahdr h;
- CMediaType mt2;
- if(m_pFile->Read(h, sample.GetSize(), false, &mt2))
- mt = mt2;
- }
- mts.Add(mt);
- break;
- }
-
- if(mt.subtype == GUID_NULL)
- {
- TRACE(_T("Unknown audio OBI: %02x\n"), audio_desc->GetObjectTypeId());
- }
- }
- else if(AP4_MpegSystemSampleDescription* system_desc =
- dynamic_cast<AP4_MpegSystemSampleDescription*>(desc))
- {
- const AP4_DataBuffer& di = system_desc->GetDecoderInfo();
- //if(!di) di = &empty;
-
- switch(system_desc->GetObjectTypeId())
- {
- case AP4_NERO_VOBSUB:
- if(di.GetDataSize() >= 16 * 4)
- {
- CSize size(720, 576);
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD)))
- {
- size.cx = tkhd->GetWidth() >> 16;
- size.cy = tkhd->GetHeight() >> 16;
- }
-
- const AP4_Byte* pal = di.GetData();
- CAtlList<CStringA> sl;
- for(int i = 0; i < 16 * 4; i += 4)
- {
- BYTE y = (pal[i+1] - 16) * 255 / 219;
- BYTE u = pal[i+2];
- BYTE v = pal[i+3];
- BYTE r = (BYTE)min(max(1.0 * y + 1.4022 * (v - 128), 0), 255);
- BYTE g = (BYTE)min(max(1.0 * y - 0.3456 * (u - 128) - 0.7145 * (v - 128), 0), 255);
- BYTE b = (BYTE)min(max(1.0 * y + 1.7710 * (u - 128), 0) , 255);
- CStringA str;
- str.Format("%02x%02x%02x", r, g, b);
- sl.AddTail(str);
- }
-
- CStringA hdr;
- hdr.Format(
- "# VobSub index file, v7 (do not modify this line!)\n"
- "size: %dx%d\n"
- "palette: %s\n",
- size.cx, size.cy,
- Implode(sl, ','));
-
- mt.majortype = MEDIATYPE_Subtitle;
- mt.subtype = MEDIASUBTYPE_VOBSUB;
- mt.formattype = FORMAT_SubtitleInfo;
- SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength());
- memset(si, 0, mt.FormatLength());
- si->dwOffset = sizeof(SUBTITLEINFO);
- strcpy_s(si->IsoLang, countof(si->IsoLang), CStringA(TrackLanguage));
- wcscpy_s(si->TrackName, countof(si->TrackName), TrackName);
- memcpy(si + 1, (LPCSTR)hdr, hdr.GetLength());
- mts.Add(mt);
- }
- break;
- }
-
- if(mt.subtype == GUID_NULL)
- {
- TRACE(_T("Unknown audio OBI: %02x\n"), system_desc->GetObjectTypeId());
- }
- }
- else if(desc->GetType() == AP4_SampleDescription::TYPE_AVC)
- {
- AP4_AvcSampleDescription* avc1 = dynamic_cast<AP4_AvcSampleDescription*>(desc);
-
- const AP4_DataBuffer& di = avc1->GetRawBytes();
-
- const AP4_Byte* data = di.GetData();
- AP4_Size size = di.GetDataSize();
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap('1cva');
- mt.formattype = FORMAT_MPEG2Video;
-
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + size - 7);
- memset(vih, 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biWidth = (LONG)avc1->GetWidth();
- vih->hdr.bmiHeader.biHeight = (LONG)avc1->GetHeight();
- vih->hdr.bmiHeader.biCompression = '1cva';
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- vih->hdr.dwPictAspectRatioX = vih->hdr.bmiHeader.biWidth;
- vih->hdr.dwPictAspectRatioY = vih->hdr.bmiHeader.biHeight;
- if(item->GetData()->GetSampleCount() > 1)
- vih->hdr.AvgTimePerFrame = MulDiv(item->GetData()->GetDurationMs(), 10000, item->GetData()->GetSampleCount() - 1);
- vih->dwProfile = data[1];
- vih->dwLevel = data[3];
- vih->dwFlags = (data[4] & 3) + 1;
-
- vih->cbSequenceHeader = 0;
-
- BYTE* src = (BYTE*)data + 5;
- BYTE* dst = (BYTE*)vih->dwSequenceHeader;
-
- BYTE* src_end = (BYTE*)data + size;
- BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + size;
-
- for(int i = 0; i < 2; i++)
- {
- for(int n = *src++ & 0x1f; n > 0; n--)
- {
- int len = ((src[0] << 8) | src[1]) + 2;
- if(src + len > src_end || dst + len > dst_end)
- {
- ASSERT(0);
- break;
- }
- memcpy(dst, src, len);
- src += len;
- dst += len;
- vih->cbSequenceHeader += len;
- }
- }
-
- mts.Add(mt);
-
- mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = '1CVA');
- mts.Add(mt);
- }
- }
- if(AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
- track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd")))
- {
-
- for(AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
- AP4_Atom* atom = item->GetData();
- AP4_DataBuffer db;
-
- GetDataBuffer(atom, db);
-
- AP4_Atom::Type type = atom->GetType();
-
- if((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
- {
- type &= 0xffff;
- }
- else if(type == AP4_ATOM_TYPE__MP3)
- {
- type = 0x0055;
- }
- else if((type == AP4_ATOM_TYPE_AC_3) || (type == AP4_ATOM_TYPE_SAC3))
- {
- type = 0x2000;
- }
- else
- {
- type =
- ((type >> 24) & 0x000000ff) |
- ((type >> 8) & 0x0000ff00) |
- ((type << 8) & 0x00ff0000) |
- ((type << 24) & 0xff000000);
- }
-
- if(AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom))
- {
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap(type);
- mt.formattype = FORMAT_VideoInfo;
- vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + db.GetDataSize());
- memset(vih, 0, mt.FormatLength());
- vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
- vih->bmiHeader.biWidth = (LONG)vse->GetWidth();
- vih->bmiHeader.biHeight = (LONG)vse->GetHeight();
- vih->bmiHeader.biCompression = type;
- memcpy(vih + 1, db.GetData(), db.GetDataSize());
- mts.Add(mt);
-
- char buff[5];
- memcpy(buff, &type, 4);
- buff[4] = 0;
-
- strlwr((char*)&buff);
- AP4_Atom::Type typelwr = *(AP4_Atom::Type*)buff;
-
- if(typelwr != type)
- {
- mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typelwr);
- mts.Add(mt);
- }
-
- strupr((char*)&buff);
- AP4_Atom::Type typeupr = *(AP4_Atom::Type*)buff;
-
- if(typeupr != type)
- {
- mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typeupr);
- mts.Add(mt);
- }
-
- break;
- }
- else if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
- {
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = FOURCCMap(type);
- mt.formattype = FORMAT_WaveFormatEx;
- wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + db.GetDataSize());
- memset(wfe, 0, mt.FormatLength());
- if(!(type & 0xffff0000)) wfe->wFormatTag = (WORD)type;
- wfe->nSamplesPerSec = ase->GetSampleRate();
- wfe->nChannels = ase->GetChannelCount();
- wfe->wBitsPerSample = ase->GetSampleSize();
- wfe->nBlockAlign = ase->GetBytesPerFrame();
- wfe->cbSize = db.GetDataSize();
- memcpy(wfe + 1, db.GetData(), db.GetDataSize());
- mts.Add(mt);
- break;
- }
-
- else if(dynamic_cast<AP4_TextSampleEntry*>(atom)
- || dynamic_cast<AP4_Tx3gSampleEntry*>(atom))
- {
- mt.majortype = MEDIATYPE_Subtitle;
- mt.subtype = MEDIASUBTYPE_ASS2;
- mt.formattype = FORMAT_SubtitleInfo;
- CStringA hdr;
- hdr.Format(
- "[Script Info]\n"
- "ScriptType: v4.00++\n"
- "ScaledBorderAndShadow: yes\n"
- "PlayResX: %d\n"
- "PlayResY: %d\n"
- "[V4++ Styles]\n"
- "Style: Text,Arial,12,&H00ffffff,&H0000ffff,&H00000000,&H80000000,0,0,0,0,100,100,0,0.00,3,0,0,2,0,0,0,0,1,1\n",
- // "Style: Text,Arial,12,&H00ffffff,&H0000ffff,&H00000000,&H80000000,0,0,0,0,100,100,0,0.00,1,0,0,2,0,0,0,0,1,1\n",
- m_framesize.cx,
- m_framesize.cy);
- SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength());
- memset(si, 0, mt.FormatLength());
- si->dwOffset = sizeof(SUBTITLEINFO);
- strcpy_s(si->IsoLang, countof(si->IsoLang), CStringA(TrackLanguage));
- wcscpy_s(si->TrackName, countof(si->TrackName), TrackName);
- memcpy(si + 1, (LPCSTR)hdr, hdr.GetLength());
- mts.Add(mt);
- }
-
- }
- }
-
- if(mts.IsEmpty()) continue;
-
- REFERENCE_TIME rtDuration = 10000i64 * track->GetDurationMs();
- if(m_rtDuration < rtDuration) m_rtDuration = rtDuration;
-
- DWORD id = track->GetId();
-
- CStringW name, lang;
- name.Format(L"Output %d", id);
-
- if(!TrackName.IsEmpty())
- {
- name = TrackName;
- }
-
- if(!TrackLanguage.IsEmpty())
- {
- if(TrackLanguage != L"und") name += " (" + TrackLanguage + ")";
- }
-
- for(int i = 0, j = mts.GetCount(); i < j; i++)
- {
- BITMAPINFOHEADER bih;
- if(ExtractBIH(&mts[i], &bih))
- {
- m_framesize.cx = bih.biWidth;
- m_framesize.cy = abs(bih.biHeight);
- }
- }
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
-
- if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName);
- if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
-
- EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
-
- m_trackpos[id] = trackpos();
-
- if(mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2)
- {
- LPCWSTR postfix = L" (plain text)";
-
- mts[0].subtype = MEDIASUBTYPE_UTF8;
-
- SUBTITLEINFO* si = (SUBTITLEINFO*)mts[0].ReallocFormatBuffer(sizeof(SUBTITLEINFO));
- wcscat(si->TrackName, postfix);
-
- id ^= 0x80402010; // FIXME: until fixing, let's hope there won't be another track like this...
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
-
- if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName + postfix);
- if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
-
- EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
- }
- }
-
- if(AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl")))
- {
- AP4_Array<AP4_ChplAtom::AP4_Chapter>& chapters = chpl->GetChapters();
-
- for(AP4_Cardinal i = 0; i < chapters.ItemCount(); i++)
- {
- AP4_ChplAtom::AP4_Chapter& chapter = chapters[i];
- ChapAppend(chapter.Time, UTF8To16(ConvertMBCS(chapter.Name.GetChars(), ANSI_CHARSET, CP_UTF8))); // this is b0rked, thx to nero :P
- }
-
- ChapSort();
- }
-
- if(AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst")))
- {
- CStringW title, artist, writer, album, year, appl, desc, gen, track;
-
- for(AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
- item;
- item = item->GetNext())
- {
- if(AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData()))
- {
- if(AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA)))
- {
- // TODO : BENTOMIGRATION
- //const AP4_DataBuffer* db = data->GetData();
-
- //if(atom->GetType() == AP4_ATOM_TYPE_TRKN)
- //{
- // if(db->GetDataSize() >= 4)
- // {
- // unsigned short n = (db->GetData()[2] << 8) | db->GetData()[3];
- // if(n > 0 && n < 100) track.Format(L"%02d", n);
- // else if(n >= 100) track.Format(L"%d", n);
- // }
- //}
- //else
- //{
- // CStringW str = UTF8To16(CStringA((LPCSTR)db->GetData(), db->GetDataSize()));
-
- // switch(atom->GetType())
- // {
- // case AP4_ATOM_TYPE_NAM: title = str; break;
- // case AP4_ATOM_TYPE_ART: artist = str; break;
- // case AP4_ATOM_TYPE_WRT: writer = str; break;
- // case AP4_ATOM_TYPE_ALB: album = str; break;
- // case AP4_ATOM_TYPE_DAY: year = str; break;
- // case AP4_ATOM_TYPE_TOO: appl = str; break;
- // case AP4_ATOM_TYPE_CMT: desc = str; break;
- // case AP4_ATOM_TYPE_GEN: gen = str; break;
- // }
- //}
- }
- }
- }
-
- if(!title.IsEmpty())
- {
- if(!track.IsEmpty()) title = track + L" - " + title;
- if(!album.IsEmpty()) title = album + L" - " + title;
- if(!year.IsEmpty()) title += L" - " + year;
- if(!gen.IsEmpty()) title += L" - " + gen;
- SetProperty(L"TITL", title);
- }
-
- if(!artist.IsEmpty()) SetProperty(L"AUTH", artist);
- else if(!writer.IsEmpty()) SetProperty(L"AUTH", writer);
-
- if(!appl.IsEmpty()) SetProperty(L"APPL", appl);
-
- if(!desc.IsEmpty()) SetProperty(L"DESC", desc);
- }
- }
-
- m_rtNewStop = m_rtStop = m_rtDuration;
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_trackpos.RemoveAll();
+
+ m_pFile.Free();
+ m_pFile.Attach(DNew CMP4SplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ m_framesize.SetSize(640, 480);
+
+ if(AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie())
+ {
+ for(AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Track* track = item->GetData();
+
+ if(track->GetType() != AP4_Track::TYPE_VIDEO
+ && track->GetType() != AP4_Track::TYPE_AUDIO
+ && track->GetType() != AP4_Track::TYPE_TEXT
+ && track->GetType() != AP4_Track::TYPE_SUBP)
+ continue;
+
+ AP4_Sample sample;
+
+ if(!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF)
+ continue;
+
+ CStringW TrackName = UTF8To16(track->GetTrackName().GetChars());
+ CStringA TrackLanguage = track->GetTrackLanguage().GetChars();
+
+ CAtlArray<CMediaType> mts;
+
+ CMediaType mt;
+ mt.SetSampleSize(1);
+
+ VIDEOINFOHEADER* vih = NULL;
+ WAVEFORMATEX* wfe = NULL;
+
+ AP4_DataBuffer empty;
+
+ if(AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex()))
+ {
+ AP4_MpegSampleDescription* mpeg_desc = NULL;
+
+ if(desc->GetType() == AP4_SampleDescription::TYPE_MPEG)
+ {
+ mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
+ }
+ else if(desc->GetType() == AP4_SampleDescription::TYPE_PROTECTED)
+ {
+ AP4_ProtectedSampleDescription* isma_desc = dynamic_cast<AP4_ProtectedSampleDescription*>(desc);
+ mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(isma_desc->GetOriginalSampleDescription());
+ }
+
+ if(AP4_MpegVideoSampleDescription* video_desc =
+ dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc))
+ {
+ const AP4_DataBuffer& di = video_desc->GetDecoderInfo();
+ //if(!di) di = &empty;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.formattype = FORMAT_VideoInfo;
+ vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + di.GetDataSize());
+ memset(vih, 0, mt.FormatLength());
+ vih->dwBitRate = video_desc->GetAvgBitrate()/8;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = (LONG)video_desc->GetWidth();
+ vih->bmiHeader.biHeight = (LONG)video_desc->GetHeight();
+ memcpy(vih + 1, di.GetData(), di.GetDataSize());
+
+ switch(video_desc->GetObjectTypeId())
+ {
+ case AP4_OTI_MPEG4_VISUAL:
+ mt.subtype = FOURCCMap('v4pm');
+ mt.formattype = FORMAT_MPEG2Video;
+ {
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + di.GetDataSize());
+ memset(vih, 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = (LONG)video_desc->GetWidth();
+ vih->hdr.bmiHeader.biHeight = (LONG)video_desc->GetHeight();
+ vih->hdr.bmiHeader.biCompression = 'v4pm';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ vih->hdr.dwPictAspectRatioX = vih->hdr.bmiHeader.biWidth;
+ vih->hdr.dwPictAspectRatioY = vih->hdr.bmiHeader.biHeight;
+ vih->cbSequenceHeader = di.GetDataSize();
+ memcpy(vih->dwSequenceHeader, di.GetData(), di.GetDataSize());
+ mts.Add(mt);
+ mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = 'V4PM');
+ mts.Add(mt);
+ }
+ break;
+ case AP4_OTI_MPEG2_VISUAL_SIMPLE:
+ case AP4_OTI_MPEG2_VISUAL_MAIN:
+ case AP4_OTI_MPEG2_VISUAL_SNR:
+ case AP4_OTI_MPEG2_VISUAL_SPATIAL:
+ case AP4_OTI_MPEG2_VISUAL_HIGH:
+ case AP4_OTI_MPEG2_VISUAL_422:
+ mt.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
+ {
+ m_pFile->Seek(sample.GetOffset());
+ CBaseSplitterFileEx::seqhdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, sample.GetSize(), &mt2))
+ mt = mt2;
+ }
+ mts.Add(mt);
+ break;
+ case AP4_OTI_MPEG1_VISUAL: // ???
+ mt.subtype = MEDIASUBTYPE_MPEG1Payload;
+ {
+ m_pFile->Seek(sample.GetOffset());
+ CBaseSplitterFileEx::seqhdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, sample.GetSize(), &mt2))
+ mt = mt2;
+ }
+ mts.Add(mt);
+ break;
+ }
+
+ if(mt.subtype == GUID_NULL)
+ {
+ TRACE(_T("Unknown video OBI: %02x\n"), video_desc->GetObjectTypeId());
+ }
+ }
+ else if(AP4_MpegAudioSampleDescription* audio_desc =
+ dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc))
+ {
+ const AP4_DataBuffer& di = audio_desc->GetDecoderInfo();
+ //if(!di) di = &empty;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + di.GetDataSize());
+ memset(wfe, 0, mt.FormatLength());
+ wfe->nSamplesPerSec = audio_desc->GetSampleRate();
+ wfe->nAvgBytesPerSec = audio_desc->GetAvgBitrate()/8;
+ wfe->nChannels = audio_desc->GetChannelCount();
+ wfe->wBitsPerSample = audio_desc->GetSampleSize();
+ wfe->cbSize = (WORD)di.GetDataSize();
+ memcpy(wfe + 1, di.GetData(), di.GetDataSize());
+
+ switch(audio_desc->GetObjectTypeId())
+ {
+ case AP4_OTI_MPEG4_AUDIO:
+ case AP4_OTI_MPEG2_AAC_AUDIO_MAIN: // ???
+ case AP4_OTI_MPEG2_AAC_AUDIO_LC: // ???
+ case AP4_OTI_MPEG2_AAC_AUDIO_SSRP: // ???
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
+ if(wfe->cbSize >= 2) wfe->nChannels = (((BYTE*)(wfe+1))[1]>>3) & 0xf;
+ mts.Add(mt);
+ break;
+ case AP4_OTI_MPEG2_PART3_AUDIO: // ???
+ case AP4_OTI_MPEG1_AUDIO:
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
+ {
+ m_pFile->Seek(sample.GetOffset());
+ CBaseSplitterFileEx::mpahdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, sample.GetSize(), false, &mt2))
+ mt = mt2;
+ }
+ mts.Add(mt);
+ break;
+ }
+
+ if(mt.subtype == GUID_NULL)
+ {
+ TRACE(_T("Unknown audio OBI: %02x\n"), audio_desc->GetObjectTypeId());
+ }
+ }
+ else if(AP4_MpegSystemSampleDescription* system_desc =
+ dynamic_cast<AP4_MpegSystemSampleDescription*>(desc))
+ {
+ const AP4_DataBuffer& di = system_desc->GetDecoderInfo();
+ //if(!di) di = &empty;
+
+ switch(system_desc->GetObjectTypeId())
+ {
+ case AP4_NERO_VOBSUB:
+ if(di.GetDataSize() >= 16*4)
+ {
+ CSize size(720, 576);
+ if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD)))
+ {
+ size.cx = tkhd->GetWidth()>>16;
+ size.cy = tkhd->GetHeight()>>16;
+ }
+
+ const AP4_Byte* pal = di.GetData();
+ CAtlList<CStringA> sl;
+ for(int i = 0; i < 16*4; i += 4)
+ {
+ BYTE y = (pal[i+1]-16)*255/219;
+ BYTE u = pal[i+2];
+ BYTE v = pal[i+3];
+ BYTE r = (BYTE)min(max(1.0*y + 1.4022*(v-128), 0), 255);
+ BYTE g = (BYTE)min(max(1.0*y - 0.3456*(u-128) - 0.7145*(v-128), 0), 255);
+ BYTE b = (BYTE)min(max(1.0*y + 1.7710*(u-128), 0) , 255);
+ CStringA str;
+ str.Format("%02x%02x%02x", r, g, b);
+ sl.AddTail(str);
+ }
+
+ CStringA hdr;
+ hdr.Format(
+ "# VobSub index file, v7 (do not modify this line!)\n"
+ "size: %dx%d\n"
+ "palette: %s\n",
+ size.cx, size.cy,
+ Implode(sl, ','));
+
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.subtype = MEDIASUBTYPE_VOBSUB;
+ mt.formattype = FORMAT_SubtitleInfo;
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength());
+ memset(si, 0, mt.FormatLength());
+ si->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy_s(si->IsoLang, countof(si->IsoLang), CStringA(TrackLanguage));
+ wcscpy_s(si->TrackName, countof(si->TrackName), TrackName);
+ memcpy(si + 1, (LPCSTR)hdr, hdr.GetLength());
+ mts.Add(mt);
+ }
+ break;
+ }
+
+ if(mt.subtype == GUID_NULL)
+ {
+ TRACE(_T("Unknown audio OBI: %02x\n"), system_desc->GetObjectTypeId());
+ }
+ }
+ else if(desc->GetType() == AP4_SampleDescription::TYPE_AVC)
+ {
+ AP4_AvcSampleDescription* avc1 = dynamic_cast<AP4_AvcSampleDescription*>(desc);
+
+ const AP4_DataBuffer& di = avc1->GetRawBytes();
+
+ const AP4_Byte* data = di.GetData();
+ AP4_Size size = di.GetDataSize();
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap('1cva');
+ mt.formattype = FORMAT_MPEG2Video;
+
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + size - 7);
+ memset(vih, 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = (LONG)avc1->GetWidth();
+ vih->hdr.bmiHeader.biHeight = (LONG)avc1->GetHeight();
+ vih->hdr.bmiHeader.biCompression = '1cva';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ vih->hdr.dwPictAspectRatioX = vih->hdr.bmiHeader.biWidth;
+ vih->hdr.dwPictAspectRatioY = vih->hdr.bmiHeader.biHeight;
+ if (item->GetData()->GetSampleCount() > 1)
+ vih->hdr.AvgTimePerFrame = MulDiv(item->GetData()->GetDurationMs(), 10000, item->GetData()->GetSampleCount()-1);
+ vih->dwProfile = data[1];
+ vih->dwLevel = data[3];
+ vih->dwFlags = (data[4] & 3) + 1;
+
+ vih->cbSequenceHeader = 0;
+
+ BYTE* src = (BYTE*)data + 5;
+ BYTE* dst = (BYTE*)vih->dwSequenceHeader;
+
+ BYTE* src_end = (BYTE*)data + size;
+ BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + size;
+
+ for(int i = 0; i < 2; i++)
+ {
+ for(int n = *src++ & 0x1f; n > 0; n--)
+ {
+ int len = ((src[0] << 8) | src[1]) + 2;
+ if(src + len > src_end || dst + len > dst_end) {ASSERT(0); break;}
+ memcpy(dst, src, len);
+ src += len;
+ dst += len;
+ vih->cbSequenceHeader += len;
+ }
+ }
+
+ mts.Add(mt);
+
+ mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = '1CVA');
+ mts.Add(mt);
+ }
+ }
+ if(AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd")))
+ {
+
+ for(AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+ AP4_DataBuffer db;
+
+ GetDataBuffer (atom, db);
+
+ AP4_Atom::Type type = atom->GetType();
+
+ if((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
+ {
+ type &= 0xffff;
+ }
+ else if(type == AP4_ATOM_TYPE__MP3)
+ {
+ type = 0x0055;
+ }
+ else if((type == AP4_ATOM_TYPE_AC_3) || (type == AP4_ATOM_TYPE_SAC3))
+ {
+ type = 0x2000;
+ }
+ else
+ {
+ type =
+ ((type >> 24) & 0x000000ff) |
+ ((type >> 8) & 0x0000ff00) |
+ ((type << 8) & 0x00ff0000) |
+ ((type << 24) & 0xff000000);
+ }
+
+ if(AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom))
+ {
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(type);
+ mt.formattype = FORMAT_VideoInfo;
+ vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER)+db.GetDataSize());
+ memset(vih, 0, mt.FormatLength());
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = (LONG)vse->GetWidth();
+ vih->bmiHeader.biHeight = (LONG)vse->GetHeight();
+ vih->bmiHeader.biCompression = type;
+ memcpy(vih+1, db.GetData(), db.GetDataSize());
+ mts.Add(mt);
+
+ char buff[5];
+ memcpy(buff, &type, 4);
+ buff[4] = 0;
+
+ strlwr((char*)&buff);
+ AP4_Atom::Type typelwr = *(AP4_Atom::Type*)buff;
+
+ if(typelwr != type)
+ {
+ mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typelwr);
+ mts.Add(mt);
+ }
+
+ strupr((char*)&buff);
+ AP4_Atom::Type typeupr = *(AP4_Atom::Type*)buff;
+
+ if(typeupr != type)
+ {
+ mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typeupr);
+ mts.Add(mt);
+ }
+
+ break;
+ }
+ else if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
+ {
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = FOURCCMap(type);
+ mt.formattype = FORMAT_WaveFormatEx;
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + db.GetDataSize());
+ memset(wfe, 0, mt.FormatLength());
+ if(!(type & 0xffff0000)) wfe->wFormatTag = (WORD)type;
+ wfe->nSamplesPerSec = ase->GetSampleRate();
+ wfe->nChannels = ase->GetChannelCount();
+ wfe->wBitsPerSample = ase->GetSampleSize();
+ wfe->nBlockAlign = ase->GetBytesPerFrame();
+ wfe->cbSize = db.GetDataSize();
+ memcpy(wfe+1, db.GetData(), db.GetDataSize());
+ mts.Add(mt);
+ break;
+ }
+
+ else if(dynamic_cast<AP4_TextSampleEntry*>(atom)
+ || dynamic_cast<AP4_Tx3gSampleEntry*>(atom))
+ {
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.subtype = MEDIASUBTYPE_ASS2;
+ mt.formattype = FORMAT_SubtitleInfo;
+ CStringA hdr;
+ hdr.Format(
+ "[Script Info]\n"
+ "ScriptType: v4.00++\n"
+ "ScaledBorderAndShadow: yes\n"
+ "PlayResX: %d\n"
+ "PlayResY: %d\n"
+ "[V4++ Styles]\n"
+ "Style: Text,Arial,12,&H00ffffff,&H0000ffff,&H00000000,&H80000000,0,0,0,0,100,100,0,0.00,3,0,0,2,0,0,0,0,1,1\n",
+ // "Style: Text,Arial,12,&H00ffffff,&H0000ffff,&H00000000,&H80000000,0,0,0,0,100,100,0,0.00,1,0,0,2,0,0,0,0,1,1\n",
+ m_framesize.cx,
+ m_framesize.cy);
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength());
+ memset(si, 0, mt.FormatLength());
+ si->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy_s(si->IsoLang, countof(si->IsoLang), CStringA(TrackLanguage));
+ wcscpy_s(si->TrackName, countof(si->TrackName), TrackName);
+ memcpy(si + 1, (LPCSTR)hdr, hdr.GetLength());
+ mts.Add(mt);
+ }
+
+ }
+ }
+
+ if(mts.IsEmpty()) continue;
+
+ REFERENCE_TIME rtDuration = 10000i64 * track->GetDurationMs();
+ if(m_rtDuration < rtDuration) m_rtDuration = rtDuration;
+
+ DWORD id = track->GetId();
+
+ CStringW name, lang;
+ name.Format(L"Output %d", id);
+
+ if(!TrackName.IsEmpty())
+ {
+ name = TrackName;
+ }
+
+ if(!TrackLanguage.IsEmpty())
+ {
+ if(TrackLanguage != L"und") name += " (" + TrackLanguage + ")";
+ }
+
+ for(int i = 0, j = mts.GetCount(); i < j; i++)
+ {
+ BITMAPINFOHEADER bih;
+ if(ExtractBIH(&mts[i], &bih))
+ {
+ m_framesize.cx = bih.biWidth;
+ m_framesize.cy = abs(bih.biHeight);
+ }
+ }
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name, this, this, &hr));
+
+ if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName);
+ if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
+
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
+
+ m_trackpos[id] = trackpos();
+
+ if(mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2)
+ {
+ LPCWSTR postfix = L" (plain text)";
+
+ mts[0].subtype = MEDIASUBTYPE_UTF8;
+
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mts[0].ReallocFormatBuffer(sizeof(SUBTITLEINFO));
+ wcscat(si->TrackName, postfix);
+
+ id ^= 0x80402010; // FIXME: until fixing, let's hope there won't be another track like this...
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
+
+ if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName + postfix);
+ if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
+
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
+ }
+ }
+
+ if(AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl")))
+ {
+ AP4_Array<AP4_ChplAtom::AP4_Chapter>& chapters = chpl->GetChapters();
+
+ for(AP4_Cardinal i = 0; i < chapters.ItemCount(); i++)
+ {
+ AP4_ChplAtom::AP4_Chapter& chapter = chapters[i];
+ ChapAppend(chapter.Time, UTF8To16(ConvertMBCS(chapter.Name.GetChars(), ANSI_CHARSET, CP_UTF8))); // this is b0rked, thx to nero :P
+ }
+
+ ChapSort();
+ }
+
+ if(AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst")))
+ {
+ CStringW title, artist, writer, album, year, appl, desc, gen, track;
+
+ for(AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ if(AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData()))
+ {
+ if(AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA)))
+ {
+ // TODO : BENTOMIGRATION
+ //const AP4_DataBuffer* db = data->GetData();
+
+ //if(atom->GetType() == AP4_ATOM_TYPE_TRKN)
+ //{
+ // if(db->GetDataSize() >= 4)
+ // {
+ // unsigned short n = (db->GetData()[2] << 8) | db->GetData()[3];
+ // if(n > 0 && n < 100) track.Format(L"%02d", n);
+ // else if(n >= 100) track.Format(L"%d", n);
+ // }
+ //}
+ //else
+ //{
+ // CStringW str = UTF8To16(CStringA((LPCSTR)db->GetData(), db->GetDataSize()));
+
+ // switch(atom->GetType())
+ // {
+ // case AP4_ATOM_TYPE_NAM: title = str; break;
+ // case AP4_ATOM_TYPE_ART: artist = str; break;
+ // case AP4_ATOM_TYPE_WRT: writer = str; break;
+ // case AP4_ATOM_TYPE_ALB: album = str; break;
+ // case AP4_ATOM_TYPE_DAY: year = str; break;
+ // case AP4_ATOM_TYPE_TOO: appl = str; break;
+ // case AP4_ATOM_TYPE_CMT: desc = str; break;
+ // case AP4_ATOM_TYPE_GEN: gen = str; break;
+ // }
+ //}
+ }
+ }
+ }
+
+ if(!title.IsEmpty())
+ {
+ if(!track.IsEmpty()) title = track + L" - " + title;
+ if(!album.IsEmpty()) title = album + L" - " + title;
+ if(!year.IsEmpty()) title += L" - " + year;
+ if(!gen.IsEmpty()) title += L" - " + gen;
+ SetProperty(L"TITL", title);
+ }
+
+ if(!artist.IsEmpty()) SetProperty(L"AUTH", artist);
+ else if(!writer.IsEmpty()) SetProperty(L"AUTH", writer);
+
+ if(!appl.IsEmpty()) SetProperty(L"APPL", appl);
+
+ if(!desc.IsEmpty()) SetProperty(L"DESC", desc);
+ }
+ }
+
+ m_rtNewStop = m_rtStop = m_rtDuration;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CMP4SplitterFilter::DemuxInit()
{
- AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
- POSITION pos = m_trackpos.GetStartPosition();
- while(pos)
- {
- CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
- pPair->m_value.index = 0;
- pPair->m_value.ts = 0;
+ pPair->m_value.index = 0;
+ pPair->m_value.ts = 0;
- AP4_Track* track = movie->GetTrack(pPair->m_key);
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
- AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(0, sample)))
- pPair->m_value.ts = sample.GetCts();
- }
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(0, sample)))
+ pPair->m_value.ts = sample.GetCts();
+ }
- return true;
+ return true;
}
void CMP4SplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- REFERENCE_TIME ts = (rt / 10000);
-
- AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
-
- POSITION pos = m_trackpos.GetStartPosition();
- while(pos)
- {
- CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
-
- AP4_Track* track = movie->GetTrack(pPair->m_key);
-
- if(AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index)))
- pPair->m_value.index = 0;
-
- AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample)))
- pPair->m_value.ts = sample.GetCts();
-
- // FIXME: slow search & stss->m_Entries is private
-
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
- {
- const AP4_Array<AP4_UI32>& Entries = stss->GetEntries();
- if(Entries.ItemCount() > 0)
- {
- AP4_Cardinal i = -1;
- while(++i < Entries.ItemCount() && Entries[i] - 1 <= pPair->m_value.index);
- if(i > 0) i--;
- pPair->m_value.index = Entries[i] - 1;
- }
- }
- }
+ REFERENCE_TIME ts = (rt / 10000);
+
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
+
+ if(AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index)))
+ pPair->m_value.index = 0;
+
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample)))
+ pPair->m_value.ts = sample.GetCts();
+
+ // FIXME: slow search & stss->m_Entries is private
+
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ const AP4_Array<AP4_UI32>& Entries = stss->GetEntries();
+ if(Entries.ItemCount() > 0)
+ {
+ AP4_Cardinal i = -1;
+ while(++i < Entries.ItemCount() && Entries[i]-1 <= pPair->m_value.index);
+ if(i > 0) i--;
+ pPair->m_value.index = Entries[i]-1;
+ }
+ }
+ }
}
-struct SSACharacter
-{
- CString pre, post;
- WCHAR c;
-};
+struct SSACharacter {CString pre, post; WCHAR c;};
static CStringW ConvertTX3GToSSA(
- CStringW str,
- const AP4_Tx3gSampleEntry::AP4_Tx3gDescription& desc,
- CStringW font,
- const AP4_Byte* mods,
- int size,
- CSize framesize,
- CPoint translation,
- int durationms,
- CRect& rbox)
+ CStringW str,
+ const AP4_Tx3gSampleEntry::AP4_Tx3gDescription& desc,
+ CStringW font,
+ const AP4_Byte* mods,
+ int size,
+ CSize framesize,
+ CPoint translation,
+ int durationms,
+ CRect& rbox)
{
- int str_len = str.GetLength();
-
- SSACharacter* chars = DNew SSACharacter[str_len];
- for(int i = 0; i < str_len; i++) chars[i].c = str[i];
- str.Empty();
-
- //
-
- rbox.SetRect(desc.TextBox.Left, desc.TextBox.Top, desc.TextBox.Right, desc.TextBox.Bottom);
-
- int align = 2;
- signed char h = (signed char)desc.HorizontalJustification;
- signed char v = (signed char)desc.VerticalJustification;
- if(h == 0 && v < 0) align = 1;
- else if(h > 0 && v < 0) align = 2;
- else if(h < 0 && v < 0) align = 3;
- else if(h == 0 && v > 0) align = 4;
- else if(h > 0 && v > 0) align = 5;
- else if(h < 0 && v > 0) align = 6;
- else if(h == 0 && v == 0) align = 7;
- else if(h > 0 && v == 0) align = 8;
- else if(h < 0 && v == 0) align = 9;
- str.Format(L"{\\an%d}%s", align, CStringW(str));
-
- if(!font.CompareNoCase(L"serif")) font = L"Times New Roman";
- else if(!font.CompareNoCase(L"sans-serif")) font = L"Arial";
- else if(!font.CompareNoCase(L"monospace")) font = L"Courier New";
- str.Format(L"{\\fn%s}%s", font, CStringW(str));
-
- const AP4_Byte* fclr = (const AP4_Byte*)&desc.Style.Font.Color;
-
- CStringW font_color;
- font_color.Format(L"{\\1c%02x%02x%02x\\1a%02x}", fclr[2], fclr[1], fclr[0], 255 - fclr[3]);
- str = font_color + str;
-
- str.Format(L"%s{\\2c%02x%02x%02x\\2a%02x}", CString(str), fclr[2], fclr[1], fclr[0], 255 - fclr[3]);
-
- CStringW font_size;
- font_size.Format(L"{\\fs%d}", desc.Style.Font.Size);
- str = font_size + str;
-
- CStringW font_flags;
- font_flags.Format(L"{\\b%d\\i%d\\u%d}",
- (desc.Style.Font.Face & 1) ? 1 : 0,
- (desc.Style.Font.Face & 2) ? 1 : 0,
- (desc.Style.Font.Face & 4) ? 1 : 0);
- str = font_flags + str;
-
- //
-
- const AP4_Byte* hclr = (const AP4_Byte*)&desc.BackgroundColor;
-
- while(size > 8)
- {
- DWORD tag_size = (mods[0] << 24) | (mods[1] << 16) | (mods[2] << 8) | (mods[3]);
- mods += 4;
- DWORD tag = (mods[0] << 24) | (mods[1] << 16) | (mods[2] << 8) | (mods[3]);
- mods += 4;
-
- size -= tag_size;
- tag_size -= 8;
- const AP4_Byte* next = mods + tag_size;
-
- if(tag == 'styl')
- {
- WORD styl_count = (mods[0] << 8) | (mods[1]);
- mods += 2;
-
- while(styl_count-- > 0)
- {
- WORD start = (mods[0] << 8) | (mods[1]);
- mods += 2;
- WORD end = (mods[0] << 8) | (mods[1]);
- mods += 2;
- WORD font_id = (mods[0] << 8) | (mods[1]);
- mods += 2;
- WORD flags = mods[0];
- mods += 1;
- WORD size = mods[0];
- mods += 1;
- const AP4_Byte* color = mods;
- mods += 4;
-
- if(end > str_len) end = str_len;
-
- if(start < end)
- {
- CStringW s;
-
- s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", color[2], color[1], color[0], 255 - color[3]);
- chars[start].pre += s;
- chars[end-1].post += font_color;
-
- s.Format(L"{\\fs%d}", size);
- chars[start].pre += s;
- chars[end-1].post += font_size;
-
- s.Format(L"{\\b%d\\i%d\\u%d}", (flags & 1) ? 1 : 0, (flags & 2) ? 1 : 0, (flags & 4) ? 1 : 0);
- chars[start].pre += s;
- chars[end-1].post += font_flags;
- }
- }
- }
- else if(tag == 'hclr')
- {
- hclr = mods;
- }
- else if(tag == 'hlit')
- {
- WORD start = (mods[0] << 8) | (mods[1]);
- mods += 2;
- WORD end = (mods[0] << 8) | (mods[1]);
- mods += 2;
-
- if(end > str_len) end = str_len;
-
- if(start < end)
- {
- CStringW s;
-
- s.Format(L"{\\3c%02x%02x%02x\\3a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
- chars[start].pre += s;
- chars[end-1].post += font_color;
-
- chars[start].pre += L"{\\bord0.1}";
- chars[end-1].post += L"{\\bord}";
- }
- }
- else if(tag == 'blnk')
- {
- WORD start = (mods[0] << 8) | (mods[1]);
- mods += 2;
- WORD end = (mods[0] << 8) | (mods[1]);
- mods += 2;
-
- if(end > str_len) end = str_len;
-
- if(start < end)
- {
- // cheap...
-
- for(int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha)
- {
- CStringW s;
- s.Format(L"{\\t(%d, %d, \\alpha&H%02x&)}", i, i + 750, alpha);
- chars[start].pre += s;
- }
-
- chars[end-1].post += L"{\\alpha}";
- }
- }
- else if(tag == 'tbox')
- {
- rbox.top = (mods[0] << 8) | (mods[1]);
- mods += 2;
- rbox.left = (mods[0] << 8) | (mods[1]);
- mods += 2;
- rbox.bottom = (mods[0] << 8) | (mods[1]);
- mods += 2;
- rbox.right = (mods[0] << 8) | (mods[1]);
- mods += 2;
- }
- else if(tag == 'krok' && !(desc.DisplayFlags & 0x800))
- {
- DWORD start_time = (mods[0] << 24) | (mods[1] << 16) | (mods[2] << 8) | (mods[3]);
- mods += 4;
- WORD krok_count = (mods[0] << 8) | (mods[1]);
- mods += 2;
-
- while(krok_count-- > 0)
- {
- DWORD end_time = (mods[0] << 24) | (mods[1] << 16) | (mods[2] << 8) | (mods[3]);
- mods += 4;
- WORD start = (mods[0] << 8) | (mods[1]);
- mods += 2;
- WORD end = (mods[0] << 8) | (mods[1]);
- mods += 2;
-
- if(end > str_len) end = str_len;
-
- if(start < end)
- {
- CStringW s;
-
- s.Format(L"{\\kt%d\\kf%d}", start_time / 10, (end_time - start_time) / 10);
- chars[start].pre += s;
- s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
- chars[start].pre += s;
- chars[end-1].post += L"{\\kt}" + font_color;
- }
-
- start_time = end_time;
- }
- }
-
- mods = next;
- }
-
- // continous karaoke
-
- if(desc.DisplayFlags & 0x800)
- {
- CStringW s;
-
- s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
- str += s;
-
- int breaks = 0;
-
- for(int i = 0, j = 0; i <= str_len; i++)
- {
- if(chars[i].c == '\n' /*|| chars[i].c == ' '*/)
- {
- breaks++;
- }
- }
-
- if(str_len > breaks)
- {
- float dur = (float)max(durationms - 500, 0) / 10;
-
- for(int i = 0, j = 0; i <= str_len; i++)
- {
- if(i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/)
- {
- s.Format(L"{\\kf%d}", (int)(dur *(i - j) / (str_len - breaks)));
- chars[j].pre += s;
- j = i + 1;
- }
- }
- }
- }
-
- //
-
- for(int i = 0; i < str_len; i++)
- {
- str += chars[i].pre;
- str += chars[i].c;
- if(desc.DisplayFlags & 0x20000) str += L"\\N";
- str += chars[i].post;
- }
-
- delete [] chars;
-
- //
-
- if(rbox.IsRectEmpty()) rbox.SetRect(0, 0, framesize.cx, framesize.cy);
- rbox.OffsetRect(translation);
-
- CRect rbox2 = rbox;
- rbox2.DeflateRect(2, 2);
-
- CRect r(0, 0, 0, 0);
- if(rbox2.Height() > 0)
- {
- r.top = rbox2.top;
- r.bottom = framesize.cy - rbox2.bottom;
- }
- if(rbox2.Width() > 0)
- {
- r.left = rbox2.left;
- r.right = framesize.cx - rbox2.right;
- }
-
- CStringW hdr;
- hdr.Format(L"0,0,Text,,%d,%d,%d,%d,,{\\clip(%d,%d,%d,%d)}",
- r.left, r.right, r.top, r.bottom,
- rbox.left, rbox.top, rbox.right, rbox.bottom);
-
- //
-
- return hdr + str;
+ int str_len = str.GetLength();
+
+ SSACharacter* chars = DNew SSACharacter[str_len];
+ for(int i = 0; i < str_len; i++) chars[i].c = str[i];
+ str.Empty();
+
+ //
+
+ rbox.SetRect(desc.TextBox.Left, desc.TextBox.Top, desc.TextBox.Right, desc.TextBox.Bottom);
+
+ int align = 2;
+ signed char h = (signed char)desc.HorizontalJustification;
+ signed char v = (signed char)desc.VerticalJustification;
+ if(h == 0 && v < 0) align = 1;
+ else if(h > 0 && v < 0) align = 2;
+ else if(h < 0 && v < 0) align = 3;
+ else if(h == 0 && v > 0) align = 4;
+ else if(h > 0 && v > 0) align = 5;
+ else if(h < 0 && v > 0) align = 6;
+ else if(h == 0 && v == 0) align = 7;
+ else if(h > 0 && v == 0) align = 8;
+ else if(h < 0 && v == 0) align = 9;
+ str.Format(L"{\\an%d}%s", align, CStringW(str));
+
+ if(!font.CompareNoCase(L"serif")) font = L"Times New Roman";
+ else if(!font.CompareNoCase(L"sans-serif")) font = L"Arial";
+ else if(!font.CompareNoCase(L"monospace")) font = L"Courier New";
+ str.Format(L"{\\fn%s}%s", font, CStringW(str));
+
+ const AP4_Byte* fclr = (const AP4_Byte*)&desc.Style.Font.Color;
+
+ CStringW font_color;
+ font_color.Format(L"{\\1c%02x%02x%02x\\1a%02x}", fclr[2], fclr[1], fclr[0], 255 - fclr[3]);
+ str = font_color + str;
+
+ str.Format(L"%s{\\2c%02x%02x%02x\\2a%02x}", CString(str), fclr[2], fclr[1], fclr[0], 255 - fclr[3]);
+
+ CStringW font_size;
+ font_size.Format(L"{\\fs%d}", desc.Style.Font.Size);
+ str = font_size + str;
+
+ CStringW font_flags;
+ font_flags.Format(L"{\\b%d\\i%d\\u%d}",
+ (desc.Style.Font.Face&1) ? 1 : 0,
+ (desc.Style.Font.Face&2) ? 1 : 0,
+ (desc.Style.Font.Face&4) ? 1 : 0);
+ str = font_flags + str;
+
+ //
+
+ const AP4_Byte* hclr = (const AP4_Byte*)&desc.BackgroundColor;
+
+ while(size > 8)
+ {
+ DWORD tag_size = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+ DWORD tag = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+
+ size -= tag_size;
+ tag_size -= 8;
+ const AP4_Byte* next = mods + tag_size;
+
+ if(tag == 'styl')
+ {
+ WORD styl_count = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ while(styl_count-- > 0)
+ {
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD font_id = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD flags = mods[0]; mods += 1;
+ WORD size = mods[0]; mods += 1;
+ const AP4_Byte* color = mods; mods += 4;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ CStringW s;
+
+ s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", color[2], color[1], color[0], 255 - color[3]);
+ chars[start].pre += s;
+ chars[end-1].post += font_color;
+
+ s.Format(L"{\\fs%d}", size);
+ chars[start].pre += s;
+ chars[end-1].post += font_size;
+
+ s.Format(L"{\\b%d\\i%d\\u%d}", (flags&1) ? 1 : 0, (flags&2) ? 1 : 0, (flags&4) ? 1 : 0);
+ chars[start].pre += s;
+ chars[end-1].post += font_flags;
+ }
+ }
+ }
+ else if(tag == 'hclr')
+ {
+ hclr = mods;
+ }
+ else if(tag == 'hlit')
+ {
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ CStringW s;
+
+ s.Format(L"{\\3c%02x%02x%02x\\3a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
+ chars[start].pre += s;
+ chars[end-1].post += font_color;
+
+ chars[start].pre += L"{\\bord0.1}";
+ chars[end-1].post += L"{\\bord}";
+ }
+ }
+ else if(tag == 'blnk')
+ {
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ // cheap...
+
+ for(int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha)
+ {
+ CStringW s;
+ s.Format(L"{\\t(%d, %d, \\alpha&H%02x&)}", i, i + 750, alpha);
+ chars[start].pre += s;
+ }
+
+ chars[end-1].post += L"{\\alpha}";
+ }
+ }
+ else if(tag == 'tbox')
+ {
+ rbox.top = (mods[0]<<8)|(mods[1]); mods += 2;
+ rbox.left = (mods[0]<<8)|(mods[1]); mods += 2;
+ rbox.bottom = (mods[0]<<8)|(mods[1]); mods += 2;
+ rbox.right = (mods[0]<<8)|(mods[1]); mods += 2;
+ }
+ else if(tag == 'krok' && !(desc.DisplayFlags & 0x800))
+ {
+ DWORD start_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+ WORD krok_count = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ while(krok_count-- > 0)
+ {
+ DWORD end_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ CStringW s;
+
+ s.Format(L"{\\kt%d\\kf%d}", start_time/10, (end_time - start_time)/10);
+ chars[start].pre += s;
+ s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
+ chars[start].pre += s;
+ chars[end-1].post += L"{\\kt}" + font_color;
+ }
+
+ start_time = end_time;
+ }
+ }
+
+ mods = next;
+ }
+
+ // continous karaoke
+
+ if(desc.DisplayFlags & 0x800)
+ {
+ CStringW s;
+
+ s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
+ str += s;
+
+ int breaks = 0;
+
+ for(int i = 0, j = 0; i <= str_len; i++)
+ {
+ if(chars[i].c == '\n' /*|| chars[i].c == ' '*/)
+ {
+ breaks++;
+ }
+ }
+
+ if(str_len > breaks)
+ {
+ float dur = (float)max(durationms - 500, 0) / 10;
+
+ for(int i = 0, j = 0; i <= str_len; i++)
+ {
+ if(i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/)
+ {
+ s.Format(L"{\\kf%d}", (int)(dur * (i - j) / (str_len - breaks)));
+ chars[j].pre += s;
+ j = i+1;
+ }
+ }
+ }
+ }
+
+ //
+
+ for(int i = 0; i < str_len; i++)
+ {
+ str += chars[i].pre;
+ str += chars[i].c;
+ if(desc.DisplayFlags & 0x20000) str += L"\\N";
+ str += chars[i].post;
+ }
+
+ delete [] chars;
+
+ //
+
+ if(rbox.IsRectEmpty()) rbox.SetRect(0, 0, framesize.cx, framesize.cy);
+ rbox.OffsetRect(translation);
+
+ CRect rbox2 = rbox;
+ rbox2.DeflateRect(2, 2);
+
+ CRect r(0,0,0,0);
+ if(rbox2.Height() > 0) {r.top = rbox2.top; r.bottom = framesize.cy - rbox2.bottom;}
+ if(rbox2.Width() > 0) {r.left = rbox2.left; r.right = framesize.cx - rbox2.right;}
+
+ CStringW hdr;
+ hdr.Format(L"0,0,Text,,%d,%d,%d,%d,,{\\clip(%d,%d,%d,%d)}",
+ r.left, r.right, r.top, r.bottom,
+ rbox.left, rbox.top, rbox.right, rbox.bottom);
+
+ //
+
+ return hdr + str;
}
bool CMP4SplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
- while(SUCCEEDED(hr) && !CheckRequest(NULL))
- {
- CAtlMap<AP4_Ordinal, trackpos>::CPair* pPairNext = NULL;
- REFERENCE_TIME rtNext = 0;
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ CAtlMap<AP4_Ordinal, trackpos>::CPair* pPairNext = NULL;
+ REFERENCE_TIME rtNext = 0;
- POSITION pos = m_trackpos.GetStartPosition();
- while(pos)
- {
- CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
- AP4_Track* track = movie->GetTrack(pPair->m_key);
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
- CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
- if(!pPin->IsConnected()) continue;
+ CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
+ if(!pPin->IsConnected()) continue;
- REFERENCE_TIME rt = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * pPair->m_value.ts);
+ REFERENCE_TIME rt = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * pPair->m_value.ts);
- if(pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext))
- {
- pPairNext = pPair;
- rtNext = rt;
- }
- }
+ if(pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext))
+ {
+ pPairNext = pPair;
+ rtNext = rt;
+ }
+ }
- if(!pPairNext) break;
+ if(!pPairNext) break;
- AP4_Track* track = movie->GetTrack(pPairNext->m_key);
+ AP4_Track* track = movie->GetTrack(pPairNext->m_key);
- CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
+ CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
- AP4_Sample sample;
- AP4_DataBuffer data;
+ AP4_Sample sample;
+ AP4_DataBuffer data;
- if(pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data)))
- {
- const CMediaType& mt = pPin->CurrentMediaType();
+ if(pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data)))
+ {
+ const CMediaType& mt = pPin->CurrentMediaType();
- CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = (DWORD)track->GetId();
- p->rtStart = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
- p->rtStop = p->rtStart + (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
- p->bSyncPoint = TRUE;
+ CAutoPtr<Packet> p(DNew Packet());
+ p->TrackNumber = (DWORD)track->GetId();
+ p->rtStart = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
+ p->rtStop = p->rtStart + (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
+ p->bSyncPoint = TRUE;
- // FIXME: slow search & stss->m_Entries is private
+ // FIXME: slow search & stss->m_Entries is private
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
- {
- if(stss->GetEntries().ItemCount() > 0)
- {
- p->bSyncPoint = FALSE;
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ if(stss->GetEntries().ItemCount() > 0)
+ {
+ p->bSyncPoint = FALSE;
- AP4_Cardinal i = -1;
- while(++i < stss->GetEntries().ItemCount())
- if(stss->GetEntries()[i] - 1 == pPairNext->m_value.index)
- p->bSyncPoint = TRUE;
- }
- }
+ AP4_Cardinal i = -1;
+ while(++i < stss->GetEntries().ItemCount())
+ if(stss->GetEntries()[i]-1 == pPairNext->m_value.index)
+ p->bSyncPoint = TRUE;
+ }
+ }
- //
+ //
- if(track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1)
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ if(track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- int nBlockAlign = 1200;
+ int nBlockAlign = 1200;
- if(wfe->nBlockAlign > 1)
- {
- nBlockAlign = wfe->nBlockAlign;
- pPairNext->m_value.index -= pPairNext->m_value.index % wfe->nBlockAlign;
- }
+ if(wfe->nBlockAlign > 1)
+ {
+ nBlockAlign = wfe->nBlockAlign;
+ pPairNext->m_value.index -= pPairNext->m_value.index % wfe->nBlockAlign;
+ }
// p->rtStop = p->rtStart;
- AP4_UI32 nAP4SampleDuration = 0;
+ AP4_UI32 nAP4SampleDuration = 0;
- int fFirst = true;
+ int fFirst = true;
- while(AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data)))
- {
- AP4_Size size = data.GetDataSize();
- const AP4_Byte* ptr = data.GetData();
- for(int i = 0; i < size; i++) p->Add(ptr[i]);
+ while(AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data)))
+ {
+ AP4_Size size = data.GetDataSize();
+ const AP4_Byte* ptr = data.GetData();
+ for(int i = 0; i < size; i++) p->Add(ptr[i]);
//int x = p->GetCount();
//if (x>4 && p->GetAt(x-4)==0x91 && p->GetAt(x-3)==0x11 && p->GetAt(x-2)==0x19 && p->GetAt(x-1)==0x90)
// printf("gotcha");
- if(fFirst)
- {
- p->rtStart = p->rtStop = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
- fFirst = false;
- }
- nAP4SampleDuration += sample.GetDuration();
-
- if(pPairNext->m_value.index + 1 >= track->GetSampleCount() || p->GetCount() >= nBlockAlign)
- break;
-
- pPairNext->m_value.index++;
- }
-
- p->rtStop = p->rtStart + (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * nAP4SampleDuration);
- }
- else if(track->GetType() == AP4_Track::TYPE_TEXT)
- {
- CStringA dlgln_bkg, dlgln_plaintext;
-
- const AP4_Byte* ptr = data.GetData();
- AP4_Size avail = data.GetDataSize();
-
- if(avail > 2)
- {
- AP4_UI16 size = (ptr[0] << 8) | ptr[1];
-
- if(size <= avail - 2)
- {
- CStringA str;
-
- if(size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff)
- {
- CStringW wstr = CStringW((LPCWSTR)&ptr[2], size / 2);
- for(int i = 0; i < wstr.GetLength(); i++) wstr.SetAt(i, ((WORD)wstr[i] >> 8) | ((WORD)wstr[i] << 8));
- str = UTF16To8(wstr);
- }
- else
- {
- str = CStringA((LPCSTR)&ptr[2], size);
- }
-
- CStringA dlgln = str;
-
- if(mt.subtype == MEDIASUBTYPE_ASS2)
- {
- AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex());
-
- dlgln = "0,0,Text,,0000,0000,0000,0000,," + str;
- dlgln_plaintext = str;
-
- CPoint translation(0, 0);
- if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD)))
- {
- float x, y;
- tkhd->GetTranslation(x, y);
- translation.SetPoint((int)x, (int)y);
- }
- }
-
- dlgln.Replace("\r", "");
- dlgln.Replace("\n", "\\N");
-
- p->SetData((LPCSTR)dlgln, dlgln.GetLength());
- }
- }
-
- if(!dlgln_bkg.IsEmpty())
- {
- CAutoPtr<Packet> p2(DNew Packet());
- p2->TrackNumber = p->TrackNumber;
- p2->rtStart = p->rtStart;
- p2->rtStop = p->rtStop;
- p2->bSyncPoint = p->bSyncPoint;
- p2->SetData((LPCSTR)dlgln_bkg, dlgln_bkg.GetLength());
- hr = DeliverPacket(p2);
- }
-
- if(!dlgln_plaintext.IsEmpty())
- {
- CAutoPtr<Packet> p2(DNew Packet());
- p2->TrackNumber = p->TrackNumber ^ 0x80402010;
- p2->rtStart = p->rtStart;
- p2->rtStop = p->rtStop;
- p2->bSyncPoint = p->bSyncPoint;
- p2->SetData((LPCSTR)dlgln_plaintext, dlgln_plaintext.GetLength());
- hr = DeliverPacket(p2);
- }
- }
- else
- {
- p->SetData(data.GetData(), data.GetDataSize());
- }
-
- hr = DeliverPacket(p);
- }
-
- {
- AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample)))
- pPairNext->m_value.ts = sample.GetCts();
- }
-
- }
-
- return true;
+ if(fFirst) {p->rtStart = p->rtStop = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts()); fFirst = false;}
+ nAP4SampleDuration += sample.GetDuration();
+
+ if(pPairNext->m_value.index+1 >= track->GetSampleCount() || p->GetCount() >= nBlockAlign)
+ break;
+
+ pPairNext->m_value.index++;
+ }
+
+ p->rtStop = p->rtStart + (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * nAP4SampleDuration);
+ }
+ else if(track->GetType() == AP4_Track::TYPE_TEXT)
+ {
+ CStringA dlgln_bkg, dlgln_plaintext;
+
+ const AP4_Byte* ptr = data.GetData();
+ AP4_Size avail = data.GetDataSize();
+
+ if(avail > 2)
+ {
+ AP4_UI16 size = (ptr[0] << 8) | ptr[1];
+
+ if(size <= avail-2)
+ {
+ CStringA str;
+
+ if(size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff)
+ {
+ CStringW wstr = CStringW((LPCWSTR)&ptr[2], size/2);
+ for(int i = 0; i < wstr.GetLength(); i++) wstr.SetAt(i, ((WORD)wstr[i] >> 8) | ((WORD)wstr[i] << 8));
+ str = UTF16To8(wstr);
+ }
+ else
+ {
+ str = CStringA((LPCSTR)&ptr[2], size);
+ }
+
+ CStringA dlgln = str;
+
+ if(mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex());
+
+ dlgln = "0,0,Text,,0000,0000,0000,0000,," + str;
+ dlgln_plaintext = str;
+
+ CPoint translation(0, 0);
+ if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD)))
+ {
+ float x, y;
+ tkhd->GetTranslation(x, y);
+ translation.SetPoint((int)x, (int)y);
+ }
+ }
+
+ dlgln.Replace("\r", "");
+ dlgln.Replace("\n", "\\N");
+
+ p->SetData((LPCSTR)dlgln, dlgln.GetLength());
+ }
+ }
+
+ if(!dlgln_bkg.IsEmpty())
+ {
+ CAutoPtr<Packet> p2(DNew Packet());
+ p2->TrackNumber = p->TrackNumber;
+ p2->rtStart = p->rtStart;
+ p2->rtStop = p->rtStop;
+ p2->bSyncPoint = p->bSyncPoint;
+ p2->SetData((LPCSTR)dlgln_bkg, dlgln_bkg.GetLength());
+ hr = DeliverPacket(p2);
+ }
+
+ if(!dlgln_plaintext.IsEmpty())
+ {
+ CAutoPtr<Packet> p2(DNew Packet());
+ p2->TrackNumber = p->TrackNumber ^ 0x80402010;
+ p2->rtStart = p->rtStart;
+ p2->rtStop = p->rtStop;
+ p2->bSyncPoint = p->bSyncPoint;
+ p2->SetData((LPCSTR)dlgln_plaintext, dlgln_plaintext.GetLength());
+ hr = DeliverPacket(p2);
+ }
+ }
+ else
+ {
+ p->SetData(data.GetData(), data.GetDataSize());
+ }
+
+ hr = DeliverPacket(p);
+ }
+
+ {
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample)))
+ pPairNext->m_value.ts = sample.GetCts();
+ }
+
+ }
+
+ return true;
}
// IKeyFrameInfo
STDMETHODIMP CMP4SplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- CheckPointer(m_pFile, E_UNEXPECTED);
+ CheckPointer(m_pFile, E_UNEXPECTED);
- if(!m_pFile) return E_UNEXPECTED;
+ if(!m_pFile) return E_UNEXPECTED;
- AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
- POSITION pos = m_trackpos.GetStartPosition();
- while(pos)
- {
- CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
- AP4_Track* track = movie->GetTrack(pPair->m_key);
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(track->GetType() != AP4_Track::TYPE_VIDEO)
- continue;
+ if(track->GetType() != AP4_Track::TYPE_VIDEO)
+ continue;
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
- {
- nKFs = stss->GetEntries().ItemCount();
- return S_OK;
- }
- }
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ nKFs = stss->GetEntries().ItemCount();
+ return S_OK;
+ }
+ }
- return E_FAIL;
+ return E_FAIL;
}
STDMETHODIMP CMP4SplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
- CheckPointer(m_pFile, E_UNEXPECTED);
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+ CheckPointer(m_pFile, E_UNEXPECTED);
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
- if(!m_pFile) return E_UNEXPECTED;
+ if(!m_pFile) return E_UNEXPECTED;
- AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
- POSITION pos = m_trackpos.GetStartPosition();
- while(pos)
- {
- CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<AP4_Ordinal, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
- AP4_Track* track = movie->GetTrack(pPair->m_key);
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
- if(track->GetType() != AP4_Track::TYPE_VIDEO)
- continue;
+ if(track->GetType() != AP4_Track::TYPE_VIDEO)
+ continue;
- if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
- {
- nKFs = 0;
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ nKFs = 0;
- for(AP4_Cardinal i = 0; i < stss->GetEntries().ItemCount(); i++)
- {
- AP4_Sample sample;
- if(AP4_SUCCEEDED(track->GetSample(stss->GetEntries()[i] - 1, sample)))
- pKFs[nKFs++] = 10000000i64 * sample.GetCts() / track->GetMediaTimeScale();
- }
+ for(AP4_Cardinal i = 0; i < stss->GetEntries().ItemCount(); i++)
+ {
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(stss->GetEntries()[i]-1, sample)))
+ pKFs[nKFs++] = 10000000i64 * sample.GetCts() / track->GetMediaTimeScale();
+ }
- return S_OK;
- }
- }
+ return S_OK;
+ }
+ }
- return E_FAIL;
+ return E_FAIL;
}
//
@@ -1323,10 +1277,10 @@ STDMETHODIMP CMP4SplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIM
//
CMP4SourceFilter::CMP4SourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CMP4SplitterFilter(pUnk, phr)
+ : CMP4SplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -1334,315 +1288,291 @@ CMP4SourceFilter::CMP4SourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
CMPEG4VideoSplitterFilter::CMPEG4VideoSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CMPEG4VideoSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CMPEG4VideoSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
void CMPEG4VideoSplitterFilter::SkipUserData()
{
- m_pFile->BitByteAlign();
- while(m_pFile->BitRead(32, true) == 0x000001b2)
- while(m_pFile->BitRead(24, true) != 0x000001)
- m_pFile->BitRead(8);
+ m_pFile->BitByteAlign();
+ while(m_pFile->BitRead(32, true) == 0x000001b2)
+ while(m_pFile->BitRead(24, true) != 0x000001)
+ m_pFile->BitRead(8);
}
HRESULT CMPEG4VideoSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
- m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- // TODO
-
- DWORD width = 0;
- DWORD height = 0;
- BYTE parx = 1;
- BYTE pary = 1;
- REFERENCE_TIME atpf = 400000;
-
- if(m_pFile->BitRead(24, true) != 0x000001)
- return E_FAIL;
-
- BYTE id;
- while(m_pFile->NextMpegStartCode(id, 1024 - m_pFile->GetPos()))
- {
- if(id == 0xb5)
- {
- BYTE is_visual_object_identifier = (BYTE)m_pFile->BitRead(1);
-
- if(is_visual_object_identifier)
- {
- BYTE visual_object_verid = (BYTE)m_pFile->BitRead(4);
- BYTE visual_object_priority = (BYTE)m_pFile->BitRead(3);
- }
-
- BYTE visual_object_type = (BYTE)m_pFile->BitRead(4);
-
- if(visual_object_type == 1 || visual_object_type == 2)
- {
- BYTE video_signal_type = (BYTE)m_pFile->BitRead(1);
-
- if(video_signal_type)
- {
- BYTE video_format = (BYTE)m_pFile->BitRead(3);
- BYTE video_range = (BYTE)m_pFile->BitRead(1);
- BYTE colour_description = (BYTE)m_pFile->BitRead(1);
-
- if(colour_description)
- {
- BYTE colour_primaries = (BYTE)m_pFile->BitRead(8);
- BYTE transfer_characteristics = (BYTE)m_pFile->BitRead(8);
- BYTE matrix_coefficients = (BYTE)m_pFile->BitRead(8);
- }
- }
- }
-
- SkipUserData();
-
- if(visual_object_type == 1)
- {
- if(m_pFile->BitRead(24) != 0x000001)
- break;
-
- BYTE video_object_start_code = (BYTE)m_pFile->BitRead(8);
- if(video_object_start_code < 0x00 || video_object_start_code > 0x1f)
- break;
-
- if(m_pFile->BitRead(24) != 0x000001)
- break;
-
- BYTE video_object_layer_start_code = (DWORD)m_pFile->BitRead(8);
- if(video_object_layer_start_code < 0x20 || video_object_layer_start_code > 0x2f)
- break;
-
- BYTE random_accessible_vol = (BYTE)m_pFile->BitRead(1);
- BYTE video_object_type_indication = (BYTE)m_pFile->BitRead(8);
-
- if(video_object_type_indication == 0x12) // Fine Granularity Scalable
- break; // huh
-
- BYTE is_object_layer_identifier = (BYTE)m_pFile->BitRead(1);
-
- BYTE video_object_layer_verid = 0;
-
- if(is_object_layer_identifier)
- {
- video_object_layer_verid = (BYTE)m_pFile->BitRead(4);
- BYTE video_object_layer_priority = (BYTE)m_pFile->BitRead(3);
- }
-
- BYTE aspect_ratio_info = (BYTE)m_pFile->BitRead(4);
-
- switch(aspect_ratio_info)
- {
- default:
- ASSERT(0);
- break;
- case 1:
- parx = 1;
- pary = 1;
- break;
- case 2:
- parx = 12;
- pary = 11;
- break;
- case 3:
- parx = 10;
- pary = 11;
- break;
- case 4:
- parx = 16;
- pary = 11;
- break;
- case 5:
- parx = 40;
- pary = 33;
- break;
- case 15:
- parx = (BYTE)m_pFile->BitRead(8);
- pary = (BYTE)m_pFile->BitRead(8);
- break;
- }
-
- BYTE vol_control_parameters = (BYTE)m_pFile->BitRead(1);
-
- if(vol_control_parameters)
- {
- BYTE chroma_format = (BYTE)m_pFile->BitRead(2);
- BYTE low_delay = (BYTE)m_pFile->BitRead(1);
- BYTE vbv_parameters = (BYTE)m_pFile->BitRead(1);
-
- if(vbv_parameters)
- {
- WORD first_half_bit_rate = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) break;
- WORD latter_half_bit_rate = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) break;
- WORD first_half_vbv_buffer_size = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) break;
-
- BYTE latter_half_vbv_buffer_size = (BYTE)m_pFile->BitRead(3);
- WORD first_half_vbv_occupancy = (WORD)m_pFile->BitRead(11);
- if(!m_pFile->BitRead(1)) break;
- WORD latter_half_vbv_occupancy = (WORD)m_pFile->BitRead(15);
- if(!m_pFile->BitRead(1)) break;
- }
- }
-
- BYTE video_object_layer_shape = (BYTE)m_pFile->BitRead(2);
-
- if(video_object_layer_shape == 3 && video_object_layer_verid != 1)
- {
- BYTE video_object_layer_shape_extension = (BYTE)m_pFile->BitRead(4);
- }
-
- if(!m_pFile->BitRead(1)) break;
- WORD vop_time_increment_resolution = (WORD)m_pFile->BitRead(16);
- if(!m_pFile->BitRead(1)) break;
- BYTE fixed_vop_rate = (BYTE)m_pFile->BitRead(1);
-
- if(fixed_vop_rate)
- {
- int bits = 0;
- for(WORD i = vop_time_increment_resolution; i; i /= 2)
- bits++;
-
- WORD fixed_vop_time_increment = m_pFile->BitRead(bits);
-
- if(fixed_vop_time_increment)
- {
- atpf = 10000000i64 * fixed_vop_time_increment / vop_time_increment_resolution;
- }
- }
-
- if(video_object_layer_shape != 2)
- {
- if(video_object_layer_shape == 0)
- {
- if(!m_pFile->BitRead(1)) break;
- width = (WORD)m_pFile->BitRead(13);
- if(!m_pFile->BitRead(1)) break;
- height = (WORD)m_pFile->BitRead(13);
- if(!m_pFile->BitRead(1)) break;
- }
-
- BYTE interlaced = (BYTE)m_pFile->BitRead(1);
- BYTE obmc_disable = (BYTE)m_pFile->BitRead(1);
-
- // ...
- }
- }
- }
- else if(id == 0xb6)
- {
- m_seqhdrsize = m_pFile->GetPos() - 4;
- }
- }
-
- if(!width || !height)
- return E_FAIL;
-
- CAtlArray<CMediaType> mts;
-
- CMediaType mt;
- mt.SetSampleSize(1);
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap('v4pm');
- mt.formattype = FORMAT_MPEG2Video;
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + m_seqhdrsize);
- memset(vih, 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biWidth = width;
- vih->hdr.bmiHeader.biHeight = height;
- vih->hdr.bmiHeader.biCompression = 'v4pm';
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- vih->hdr.AvgTimePerFrame = atpf;
- vih->hdr.dwPictAspectRatioX = width * parx;
- vih->hdr.dwPictAspectRatioY = height * pary;
- vih->cbSequenceHeader = m_seqhdrsize;
- m_pFile->Seek(0);
- m_pFile->ByteRead((BYTE*)vih->dwSequenceHeader, m_seqhdrsize);
- mts.Add(mt);
- mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = 'V4PM');
- mts.Add(mt);
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
- EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(0, pPinOut)));
-
- m_rtNewStop = m_rtStop = m_rtDuration;
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pFile.Attach(DNew CBaseSplitterFileEx(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ // TODO
+
+ DWORD width = 0;
+ DWORD height = 0;
+ BYTE parx = 1;
+ BYTE pary = 1;
+ REFERENCE_TIME atpf = 400000;
+
+ if(m_pFile->BitRead(24, true) != 0x000001)
+ return E_FAIL;
+
+ BYTE id;
+ while(m_pFile->NextMpegStartCode(id, 1024 - m_pFile->GetPos()))
+ {
+ if(id == 0xb5)
+ {
+ BYTE is_visual_object_identifier = (BYTE)m_pFile->BitRead(1);
+
+ if(is_visual_object_identifier)
+ {
+ BYTE visual_object_verid = (BYTE)m_pFile->BitRead(4);
+ BYTE visual_object_priority = (BYTE)m_pFile->BitRead(3);
+ }
+
+ BYTE visual_object_type = (BYTE)m_pFile->BitRead(4);
+
+ if(visual_object_type == 1 || visual_object_type == 2)
+ {
+ BYTE video_signal_type = (BYTE)m_pFile->BitRead(1);
+
+ if(video_signal_type)
+ {
+ BYTE video_format = (BYTE)m_pFile->BitRead(3);
+ BYTE video_range = (BYTE)m_pFile->BitRead(1);
+ BYTE colour_description = (BYTE)m_pFile->BitRead(1);
+
+ if(colour_description)
+ {
+ BYTE colour_primaries = (BYTE)m_pFile->BitRead(8);
+ BYTE transfer_characteristics = (BYTE)m_pFile->BitRead(8);
+ BYTE matrix_coefficients = (BYTE)m_pFile->BitRead(8);
+ }
+ }
+ }
+
+ SkipUserData();
+
+ if(visual_object_type == 1)
+ {
+ if(m_pFile->BitRead(24) != 0x000001)
+ break;
+
+ BYTE video_object_start_code = (BYTE)m_pFile->BitRead(8);
+ if(video_object_start_code < 0x00 || video_object_start_code > 0x1f)
+ break;
+
+ if(m_pFile->BitRead(24) != 0x000001)
+ break;
+
+ BYTE video_object_layer_start_code = (DWORD)m_pFile->BitRead(8);
+ if(video_object_layer_start_code < 0x20 || video_object_layer_start_code > 0x2f)
+ break;
+
+ BYTE random_accessible_vol = (BYTE)m_pFile->BitRead(1);
+ BYTE video_object_type_indication = (BYTE)m_pFile->BitRead(8);
+
+ if(video_object_type_indication == 0x12) // Fine Granularity Scalable
+ break; // huh
+
+ BYTE is_object_layer_identifier = (BYTE)m_pFile->BitRead(1);
+
+ BYTE video_object_layer_verid = 0;
+
+ if(is_object_layer_identifier)
+ {
+ video_object_layer_verid = (BYTE)m_pFile->BitRead(4);
+ BYTE video_object_layer_priority = (BYTE)m_pFile->BitRead(3);
+ }
+
+ BYTE aspect_ratio_info = (BYTE)m_pFile->BitRead(4);
+
+ switch(aspect_ratio_info)
+ {
+ default: ASSERT(0); break;
+ case 1: parx = 1; pary = 1; break;
+ case 2: parx = 12; pary = 11; break;
+ case 3: parx = 10; pary = 11; break;
+ case 4: parx = 16; pary = 11; break;
+ case 5: parx = 40; pary = 33; break;
+ case 15: parx = (BYTE)m_pFile->BitRead(8); pary = (BYTE)m_pFile->BitRead(8); break;
+ }
+
+ BYTE vol_control_parameters = (BYTE)m_pFile->BitRead(1);
+
+ if(vol_control_parameters)
+ {
+ BYTE chroma_format = (BYTE)m_pFile->BitRead(2);
+ BYTE low_delay = (BYTE)m_pFile->BitRead(1);
+ BYTE vbv_parameters = (BYTE)m_pFile->BitRead(1);
+
+ if(vbv_parameters)
+ {
+ WORD first_half_bit_rate = (WORD)m_pFile->BitRead(15);
+ if(!m_pFile->BitRead(1)) break;
+ WORD latter_half_bit_rate = (WORD)m_pFile->BitRead(15);
+ if(!m_pFile->BitRead(1)) break;
+ WORD first_half_vbv_buffer_size = (WORD)m_pFile->BitRead(15);
+ if(!m_pFile->BitRead(1)) break;
+
+ BYTE latter_half_vbv_buffer_size = (BYTE)m_pFile->BitRead(3);
+ WORD first_half_vbv_occupancy = (WORD)m_pFile->BitRead(11);
+ if(!m_pFile->BitRead(1)) break;
+ WORD latter_half_vbv_occupancy = (WORD)m_pFile->BitRead(15);
+ if(!m_pFile->BitRead(1)) break;
+ }
+ }
+
+ BYTE video_object_layer_shape = (BYTE)m_pFile->BitRead(2);
+
+ if(video_object_layer_shape == 3 && video_object_layer_verid != 1)
+ {
+ BYTE video_object_layer_shape_extension = (BYTE)m_pFile->BitRead(4);
+ }
+
+ if(!m_pFile->BitRead(1)) break;
+ WORD vop_time_increment_resolution = (WORD)m_pFile->BitRead(16);
+ if(!m_pFile->BitRead(1)) break;
+ BYTE fixed_vop_rate = (BYTE)m_pFile->BitRead(1);
+
+ if(fixed_vop_rate)
+ {
+ int bits = 0;
+ for(WORD i = vop_time_increment_resolution; i; i /= 2)
+ bits++;
+
+ WORD fixed_vop_time_increment = m_pFile->BitRead(bits);
+
+ if(fixed_vop_time_increment)
+ {
+ atpf = 10000000i64 * fixed_vop_time_increment / vop_time_increment_resolution;
+ }
+ }
+
+ if(video_object_layer_shape != 2)
+ {
+ if(video_object_layer_shape == 0)
+ {
+ if(!m_pFile->BitRead(1)) break;
+ width = (WORD)m_pFile->BitRead(13);
+ if(!m_pFile->BitRead(1)) break;
+ height = (WORD)m_pFile->BitRead(13);
+ if(!m_pFile->BitRead(1)) break;
+ }
+
+ BYTE interlaced = (BYTE)m_pFile->BitRead(1);
+ BYTE obmc_disable = (BYTE)m_pFile->BitRead(1);
+
+ // ...
+ }
+ }
+ }
+ else if(id == 0xb6)
+ {
+ m_seqhdrsize = m_pFile->GetPos() - 4;
+ }
+ }
+
+ if(!width || !height)
+ return E_FAIL;
+
+ CAtlArray<CMediaType> mts;
+
+ CMediaType mt;
+ mt.SetSampleSize(1);
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap('v4pm');
+ mt.formattype = FORMAT_MPEG2Video;
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + m_seqhdrsize);
+ memset(vih, 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = width;
+ vih->hdr.bmiHeader.biHeight = height;
+ vih->hdr.bmiHeader.biCompression = 'v4pm';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ vih->hdr.AvgTimePerFrame = atpf;
+ vih->hdr.dwPictAspectRatioX = width*parx;
+ vih->hdr.dwPictAspectRatioY = height*pary;
+ vih->cbSequenceHeader = m_seqhdrsize;
+ m_pFile->Seek(0);
+ m_pFile->ByteRead((BYTE*)vih->dwSequenceHeader, m_seqhdrsize);
+ mts.Add(mt);
+ mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = 'V4PM');
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(0, pPinOut)));
+
+ m_rtNewStop = m_rtStop = m_rtDuration;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CMPEG4VideoSplitterFilter::DemuxInit()
{
- return true;
+ return true;
}
void CMPEG4VideoSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- ASSERT(rt == 0);
+ ASSERT(rt == 0);
- m_pFile->Seek(m_seqhdrsize);
+ m_pFile->Seek(m_seqhdrsize);
}
bool CMPEG4VideoSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
-
- CAutoPtr<Packet> p;
-
- REFERENCE_TIME rt = 0;
- REFERENCE_TIME atpf = ((MPEG2VIDEOINFO*)GetOutputPin(0)->CurrentMediaType().Format())->hdr.AvgTimePerFrame;
-
- DWORD sync = ~0;
-
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining())
- {
- for(int i = 0; i < 65536; i++) // don't call CheckRequest so often
- {
- bool eof = !m_pFile->GetRemaining();
-
- if(p && !p->IsEmpty() && (m_pFile->BitRead(32, true) == 0x000001b6 || eof))
- {
- hr = DeliverPacket(p);
- }
-
- if(eof) break;
-
- if(!p)
- {
- p.Attach(DNew Packet());
- p->SetCount(0, 1024);
- p->TrackNumber = 0;
- p->rtStart = rt;
- p->rtStop = rt + atpf;
- p->bSyncPoint = FALSE;
- rt += atpf;
- // rt = Packet::INVALID_TIME;
- }
-
- BYTE b;
- m_pFile->ByteRead(&b, 1);
- p->Add(b);
- }
- }
-
- return true;
+ HRESULT hr = S_OK;
+
+ CAutoPtr<Packet> p;
+
+ REFERENCE_TIME rt = 0;
+ REFERENCE_TIME atpf = ((MPEG2VIDEOINFO*)GetOutputPin(0)->CurrentMediaType().Format())->hdr.AvgTimePerFrame;
+
+ DWORD sync = ~0;
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetRemaining())
+ {
+ for(int i = 0; i < 65536; i++) // don't call CheckRequest so often
+ {
+ bool eof = !m_pFile->GetRemaining();
+
+ if(p && !p->IsEmpty() && (m_pFile->BitRead(32, true) == 0x000001b6 || eof))
+ {
+ hr = DeliverPacket(p);
+ }
+
+ if(eof) break;
+
+ if(!p)
+ {
+ p.Attach(DNew Packet());
+ p->SetCount(0, 1024);
+ p->TrackNumber = 0;
+ p->rtStart = rt;
+ p->rtStop = rt + atpf;
+ p->bSyncPoint = FALSE;
+ rt += atpf;
+ // rt = Packet::INVALID_TIME;
+ }
+
+ BYTE b;
+ m_pFile->ByteRead(&b, 1);
+ p->Add(b);
+ }
+ }
+
+ return true;
}
//
@@ -1650,8 +1580,8 @@ bool CMPEG4VideoSplitterFilter::DemuxLoop()
//
CMPEG4VideoSourceFilter::CMPEG4VideoSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CMPEG4VideoSplitterFilter(pUnk, phr)
+ : CMPEG4VideoSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
diff --git a/src/filters/parser/MP4Splitter/MP4Splitter.h b/src/filters/parser/MP4Splitter/MP4Splitter.h
index eca140155..e7b36dc04 100644
--- a/src/filters/parser/MP4Splitter/MP4Splitter.h
+++ b/src/filters/parser/MP4Splitter/MP4Splitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,37 +29,33 @@
[uuid("61F47056-E400-43d3-AF1E-AB7DFFD4C4AD")]
class CMP4SplitterFilter : public CBaseSplitterFilter
{
- struct trackpos
- {
- unsigned int /*AP4_Ordinal*/ index;
- unsigned __int64 /*AP4_TimeStamp*/ ts;
- };
- CAtlMap<unsigned int, trackpos> m_trackpos;
- CSize m_framesize;
+ struct trackpos {unsigned int /*AP4_Ordinal*/ index; unsigned __int64 /*AP4_TimeStamp*/ ts;};
+ CAtlMap<unsigned int, trackpos> m_trackpos;
+ CSize m_framesize;
protected:
- CAutoPtr<CMP4SplitterFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CMP4SplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CMP4SplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CMP4SplitterFilter();
+ CMP4SplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CMP4SplitterFilter();
- // IKeyFrameInfo
+ // IKeyFrameInfo
- STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
};
[uuid("3CCC052E-BDEE-408a-BEA7-90914EF2964B")]
class CMP4SourceFilter : public CMP4SplitterFilter
{
public:
- CMP4SourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CMP4SourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
// for raw mpeg4 elementary streams:
@@ -67,25 +63,25 @@ public:
[uuid("D3D9D58B-45B5-48AB-B199-B8C40560AEC7")]
class CMPEG4VideoSplitterFilter : public CBaseSplitterFilter
{
- __int64 m_seqhdrsize;
- int NextStartCode();
- void SkipUserData();
+ __int64 m_seqhdrsize;
+ int NextStartCode();
+ void SkipUserData();
protected:
- CAutoPtr<CBaseSplitterFileEx> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CBaseSplitterFileEx> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CMPEG4VideoSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CMPEG4VideoSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
[uuid("E2B98EEA-EE55-4E9B-A8C1-6E5288DF785A")]
class CMPEG4VideoSourceFilter : public CMPEG4VideoSplitterFilter
{
public:
- CMPEG4VideoSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CMPEG4VideoSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp b/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp
index d498e104c..c28950291 100644
--- a/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp
+++ b/src/filters/parser/MP4Splitter/MP4SplitterFile.cpp
@@ -2,39 +2,39 @@
#include "MP4SplitterFile.h"
#include "Ap4AsyncReaderStream.h"
-CMP4SplitterFile::CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr)
- : CBaseSplitterFileEx(pReader, hr, DEFAULT_CACHE_LENGTH, false)
- , m_pAp4File(NULL)
+CMP4SplitterFile::CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr)
+ : CBaseSplitterFileEx(pReader, hr, DEFAULT_CACHE_LENGTH, false)
+ , m_pAp4File(NULL)
{
- if(FAILED(hr)) return;
+ if(FAILED(hr)) return;
- hr = Init();
+ hr = Init();
}
CMP4SplitterFile::~CMP4SplitterFile()
{
- delete(AP4_File*)m_pAp4File;
+ delete (AP4_File*)m_pAp4File;
}
void* /* AP4_Movie* */ CMP4SplitterFile::GetMovie()
{
- ASSERT(m_pAp4File);
- return m_pAp4File ? ((AP4_File*)m_pAp4File)->GetMovie() : NULL;
+ ASSERT(m_pAp4File);
+ return m_pAp4File ? ((AP4_File*)m_pAp4File)->GetMovie() : NULL;
}
HRESULT CMP4SplitterFile::Init()
{
- Seek(0);
+ Seek(0);
- delete(AP4_File*)m_pAp4File;
+ delete (AP4_File*)m_pAp4File;
- AP4_ByteStream* stream = DNew AP4_AsyncReaderStream(this);
+ AP4_ByteStream* stream = DNew AP4_AsyncReaderStream(this);
- m_pAp4File = DNew AP4_File(*stream);
+ m_pAp4File = DNew AP4_File(*stream);
+
+ AP4_Movie* movie = ((AP4_File*)m_pAp4File)->GetMovie();
- AP4_Movie* movie = ((AP4_File*)m_pAp4File)->GetMovie();
+ stream->Release();
- stream->Release();
-
- return movie ? S_OK : E_FAIL;
+ return movie ? S_OK : E_FAIL;
}
diff --git a/src/filters/parser/MP4Splitter/MP4SplitterFile.h b/src/filters/parser/MP4Splitter/MP4SplitterFile.h
index ac8377c88..ef1557b9f 100644
--- a/src/filters/parser/MP4Splitter/MP4SplitterFile.h
+++ b/src/filters/parser/MP4Splitter/MP4SplitterFile.h
@@ -5,13 +5,13 @@
class CMP4SplitterFile : public CBaseSplitterFileEx
{
- void* /* AP4_File* */ m_pAp4File;
+ void* /* AP4_File* */ m_pAp4File;
- HRESULT Init();
+ HRESULT Init();
public:
- CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr);
- virtual ~CMP4SplitterFile();
+ CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr);
+ virtual ~CMP4SplitterFile();
- void* /* AP4_Movie* */ GetMovie();
+ void* /* AP4_Movie* */ GetMovie();
};
diff --git a/src/filters/parser/MP4Splitter/resource.h b/src/filters/parser/MP4Splitter/resource.h
index 42227a3a6..f9afd652d 100644
--- a/src/filters/parser/MP4Splitter/resource.h
+++ b/src/filters/parser/MP4Splitter/resource.h
@@ -3,7 +3,7 @@
// Used by MP4Splitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/MP4Splitter/stdafx.cpp b/src/filters/parser/MP4Splitter/stdafx.cpp
index 13a771bb8..ae7410104 100644
--- a/src/filters/parser/MP4Splitter/stdafx.cpp
+++ b/src/filters/parser/MP4Splitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MP4Splitter/stdafx.h b/src/filters/parser/MP4Splitter/stdafx.h
index 089cf8fa0..e8beccd47 100644
--- a/src/filters/parser/MP4Splitter/stdafx.h
+++ b/src/filters/parser/MP4Splitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp
index 8f65f751b..620b2cc2a 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp
+++ b/src/filters/parser/MatroskaSplitter/MatroskaFile.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,15 +29,15 @@
static void LOG(LPCTSTR fmt, ...)
{
- va_list args;
- va_start(args, fmt);
- if(FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at")))
- {
- fseek(f, 0, 2);
- _vftprintf(f, fmt, args);
- fclose(f);
- }
- va_end(args);
+ va_list args;
+ va_start(args, fmt);
+ if(FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at")))
+ {
+ fseek(f, 0, 2);
+ _vftprintf(f, fmt, args);
+ fclose(f);
+ }
+ va_end(args);
}
using namespace MatroskaReader;
@@ -52,1245 +52,888 @@ using namespace MatroskaReader;
{ \
switch(pMN->m_id) \
{ \
-
+
#define EndChunk \
} \
} \
while(pMN->Next()); \
\
return S_OK; \
-
+
static void bswap(BYTE* s, int len)
{
- for(BYTE* d = s + len - 1; s < d; s++, d--)
- *s ^= *d, *d ^= *s, *s ^= *d;
+ for(BYTE* d = s + len-1; s < d; s++, d--)
+ *s ^= *d, *d ^= *s, *s ^= *d;
}
//
// CMatroskaFile
//
-CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
- , m_rtOffset(0)
+CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
+ , m_rtOffset(0)
{
- if(FAILED(hr)) return;
- hr = Init();
+ if(FAILED(hr)) return;
+ hr = Init();
}
HRESULT CMatroskaFile::Init()
{
- DWORD dw;
- if(FAILED(Read(dw)) || dw != 0x1A45DFA3)
- return E_FAIL;
+ DWORD dw;
+ if(FAILED(Read(dw)) || dw != 0x1A45DFA3)
+ return E_FAIL;
- CMatroskaNode Root(this);
- if(FAILED(Parse(&Root)))
- return E_FAIL;
+ CMatroskaNode Root(this);
+ if(FAILED(Parse(&Root)))
+ return E_FAIL;
- CAutoPtr<CMatroskaNode> pSegment, pCluster;
- if((pSegment = Root.Child(0x18538067))
- && (pCluster = pSegment->Child(0x1F43B675)))
- {
- Cluster c0;
- c0.ParseTimeCode(pCluster);
- m_rtOffset = m_segment.GetRefTime(c0.TimeCode);
- }
+ CAutoPtr<CMatroskaNode> pSegment, pCluster;
+ if((pSegment = Root.Child(0x18538067))
+ && (pCluster = pSegment->Child(0x1F43B675)))
+ {
+ Cluster c0;
+ c0.ParseTimeCode(pCluster);
+ m_rtOffset = m_segment.GetRefTime(c0.TimeCode);
+ }
- return S_OK;
+ return S_OK;
}
template <class T>
HRESULT CMatroskaFile::Read(T& var)
{
- HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
- if(S_OK == hr) bswap((BYTE*)&var, sizeof(var));
- return hr;
+ HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
+ if(S_OK == hr) bswap((BYTE*)&var, sizeof(var));
+ return hr;
}
HRESULT CMatroskaFile::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x1A45DFA3:
- m_ebml.Parse(pMN);
- if(m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION)
- return E_FAIL;
- break;
-case 0x18538067:
- if(m_segment.SegmentInfo.SegmentUID.IsEmpty()) m_segment.ParseMinimal(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x1A45DFA3:
+ m_ebml.Parse(pMN);
+ if(m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION)
+ return E_FAIL;
+ break;
+ case 0x18538067: if(m_segment.SegmentInfo.SegmentUID.IsEmpty()) m_segment.ParseMinimal(pMN); break;
+ EndChunk
}
//
HRESULT EBML::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x4286:
- EBMLVersion.Parse(pMN);
- break;
-case 0x42F7:
- EBMLReadVersion.Parse(pMN);
- break;
-case 0x42F2:
- EBMLMaxIDLength.Parse(pMN);
- break;
-case 0x42F3:
- EBMLMaxSizeLength.Parse(pMN);
- break;
-case 0x4282:
- DocType.Parse(pMN);
- break;
-case 0x4287:
- DocTypeVersion.Parse(pMN);
- break;
-case 0x4285:
- DocTypeReadVersion.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x4286: EBMLVersion.Parse(pMN); break;
+ case 0x42F7: EBMLReadVersion.Parse(pMN); break;
+ case 0x42F2: EBMLMaxIDLength.Parse(pMN); break;
+ case 0x42F3: EBMLMaxSizeLength.Parse(pMN); break;
+ case 0x4282: DocType.Parse(pMN); break;
+ case 0x4287: DocTypeVersion.Parse(pMN); break;
+ case 0x4285: DocTypeReadVersion.Parse(pMN); break;
+ EndChunk
}
HRESULT Segment::Parse(CMatroskaNode* pMN0)
{
- pos = pMN0->GetPos();
-
- BeginChunk
-case 0x1549A966:
- SegmentInfo.Parse(pMN);
- break;
-case 0x114D9B74:
- MetaSeekInfo.Parse(pMN);
- break;
-case 0x1654AE6B:
- Tracks.Parse(pMN);
- break;
-case 0x1F43B675:
- Clusters.Parse(pMN);
- break;
-case 0x1C53BB6B:
- Cues.Parse(pMN);
- break;
-case 0x1941A469:
- Attachments.Parse(pMN);
- break;
-case 0x1043A770:
- Chapters.Parse(pMN);
- break;
+ pos = pMN0->GetPos();
+
+ BeginChunk
+ case 0x1549A966: SegmentInfo.Parse(pMN); break;
+ case 0x114D9B74: MetaSeekInfo.Parse(pMN); break;
+ case 0x1654AE6B: Tracks.Parse(pMN); break;
+ case 0x1F43B675: Clusters.Parse(pMN); break;
+ case 0x1C53BB6B: Cues.Parse(pMN); break;
+ case 0x1941A469: Attachments.Parse(pMN); break;
+ case 0x1043A770: Chapters.Parse(pMN); break;
// case 0x1254C367: Tags.Parse(pMN); break;
- EndChunk
+ EndChunk
}
HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0)
{
- CheckPointer(pMN0, E_POINTER);
-
- pos = pMN0->GetPos();
- len = pMN0->m_len;
-
- CAutoPtr<CMatroskaNode> pMN = pMN0->Child();
- if(!pMN) return S_FALSE;
-
- int n = 0;
-
- do
- {
- switch(pMN->m_id)
- {
- case 0x1549A966:
- SegmentInfo.Parse(pMN);
- n++;
- break;
- case 0x114D9B74:
- MetaSeekInfo.Parse(pMN);
- n++;
- break;
- case 0x1654AE6B:
- Tracks.Parse(pMN);
- n++;
- break;
- case 0x1C53BB6B:
- Cues.Parse(pMN);
- break;
- }
- }
- while(n < 3 && pMN->Next());
-
- if(!pMN->IsRandomAccess())
- {
- return S_OK;
- }
-
- while(MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos()))
- {
- pMN->SeekTo(pos);
- pMN->Parse();
- if(pMN->m_id != 0x114D9B74)
- {
- ASSERT(0);
- break;
- }
- MetaSeekInfo.Parse(pMN);
- }
-
- if(n == 3)
- {
- if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false)))
- {
- do
- {
- Cues.Parse(pMN);
- }
- while(pMN->Next(true));
- }
-
- if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false)))
- {
- do
- {
- Chapters.Parse(pMN); /*BIG UGLY HACK:*/
- break;
- }
- while(pMN->Next(true));
- }
-
- if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false)))
- {
- do
- {
- Attachments.Parse(pMN); /*BIG UGLY HACK:*/
- break;
- }
- while(pMN->Next(true));
- }
- }
-
- return S_OK;
+ CheckPointer(pMN0, E_POINTER);
+
+ pos = pMN0->GetPos();
+ len = pMN0->m_len;
+
+ CAutoPtr<CMatroskaNode> pMN = pMN0->Child();
+ if(!pMN) return S_FALSE;
+
+ int n = 0;
+
+ do
+ {
+ switch(pMN->m_id)
+ {
+ case 0x1549A966: SegmentInfo.Parse(pMN); n++; break;
+ case 0x114D9B74: MetaSeekInfo.Parse(pMN); n++; break;
+ case 0x1654AE6B: Tracks.Parse(pMN); n++; break;
+ case 0x1C53BB6B: Cues.Parse(pMN); break;
+ }
+ }
+ while(n < 3 && pMN->Next());
+
+ if(!pMN->IsRandomAccess())
+ {
+ return S_OK;
+ }
+
+ while(MatroskaReader::QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos()))
+ {
+ pMN->SeekTo(pos);
+ pMN->Parse();
+ if(pMN->m_id != 0x114D9B74) {ASSERT(0); break;}
+ MetaSeekInfo.Parse(pMN);
+ }
+
+ if(n == 3)
+ {
+ if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false)))
+ {
+ do {Cues.Parse(pMN);} while(pMN->Next(true));
+ }
+
+ if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false)))
+ {
+ do {Chapters.Parse(pMN); /*BIG UGLY HACK:*/ break;} while(pMN->Next(true));
+ }
+
+ if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false)))
+ {
+ do {Attachments.Parse(pMN); /*BIG UGLY HACK:*/ break;} while (pMN->Next(true));
+ }
+ }
+
+ return S_OK;
}
UINT64 Segment::GetMasterTrack()
{
- UINT64 TrackNumber = 0, AltTrackNumber = 0;
-
- POSITION pos1 = Tracks.GetHeadPosition();
- while(pos1 && TrackNumber == 0)
- {
- Track* pT = Tracks.GetNext(pos1);
+ UINT64 TrackNumber = 0, AltTrackNumber = 0;
- POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2 && TrackNumber == 0)
- {
- TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
-
- if(pTE->TrackType == TrackEntry::TypeVideo)
- {
- TrackNumber = pTE->TrackNumber;
- break;
- }
- else if(pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0)
- {
- AltTrackNumber = pTE->TrackNumber;
- }
- }
- }
+ POSITION pos1 = Tracks.GetHeadPosition();
+ while(pos1 && TrackNumber == 0)
+ {
+ Track* pT = Tracks.GetNext(pos1);
+
+ POSITION pos2 = pT->TrackEntries.GetHeadPosition();
+ while(pos2 && TrackNumber == 0)
+ {
+ TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
+
+ if(pTE->TrackType == TrackEntry::TypeVideo)
+ {
+ TrackNumber = pTE->TrackNumber;
+ break;
+ }
+ else if(pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0)
+ {
+ AltTrackNumber = pTE->TrackNumber;
+ }
+ }
+ }
- if(TrackNumber == 0) TrackNumber = AltTrackNumber;
- if(TrackNumber == 0) TrackNumber = 1;
+ if(TrackNumber == 0) TrackNumber = AltTrackNumber;
+ if(TrackNumber == 0) TrackNumber = 1;
- return TrackNumber;
+ return TrackNumber;
}
ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id)
{
- if(ChapterUID == id)
- return(this);
+ if(ChapterUID == id)
+ return(this);
- POSITION pos = ChapterAtoms.GetHeadPosition();
- while(pos)
- {
- ChapterAtom* ca = ChapterAtoms.GetNext(pos)->FindChapterAtom(id);
- if(ca) return ca;
- }
+ POSITION pos = ChapterAtoms.GetHeadPosition();
+ while(pos)
+ {
+ ChapterAtom* ca = ChapterAtoms.GetNext(pos)->FindChapterAtom(id);
+ if(ca) return ca;
+ }
- return(NULL);
+ return(NULL);
}
ChapterAtom* Segment::FindChapterAtom(UINT64 id, int nEditionEntry)
{
- POSITION pos1 = Chapters.GetHeadPosition();
- while(pos1)
- {
- Chapter* c = Chapters.GetNext(pos1);
-
- POSITION pos2 = c->EditionEntries.GetHeadPosition();
- while(pos2)
- {
- EditionEntry* ee = c->EditionEntries.GetNext(pos2);
-
- if(nEditionEntry-- == 0)
- {
- return id == 0 ? ee : ee->FindChapterAtom(id);
- }
- }
- }
+ POSITION pos1 = Chapters.GetHeadPosition();
+ while(pos1)
+ {
+ Chapter* c = Chapters.GetNext(pos1);
+
+ POSITION pos2 = c->EditionEntries.GetHeadPosition();
+ while(pos2)
+ {
+ EditionEntry* ee = c->EditionEntries.GetNext(pos2);
+
+ if(nEditionEntry-- == 0)
+ {
+ return id == 0 ? ee : ee->FindChapterAtom(id);
+ }
+ }
+ }
- return(NULL);
+ return(NULL);
}
HRESULT Info::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x73A4:
- SegmentUID.Parse(pMN);
- break;
-case 0x7384:
- SegmentFilename.Parse(pMN);
- break;
-case 0x3CB923:
- PrevUID.Parse(pMN);
- break;
-case 0x3C83AB:
- PrevFilename.Parse(pMN);
- break;
-case 0x3EB923:
- NextUID.Parse(pMN);
- break;
-case 0x3E83BB:
- NextFilename.Parse(pMN);
- break;
-case 0x2AD7B1:
- TimeCodeScale.Parse(pMN);
- break;
-case 0x4489:
- Duration.Parse(pMN);
- break;
-case 0x4461:
- DateUTC.Parse(pMN);
- break;
-case 0x7BA9:
- Title.Parse(pMN);
- break;
-case 0x4D80:
- MuxingApp.Parse(pMN);
- break;
-case 0x5741:
- WritingApp.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x73A4: SegmentUID.Parse(pMN); break;
+ case 0x7384: SegmentFilename.Parse(pMN); break;
+ case 0x3CB923: PrevUID.Parse(pMN); break;
+ case 0x3C83AB: PrevFilename.Parse(pMN); break;
+ case 0x3EB923: NextUID.Parse(pMN); break;
+ case 0x3E83BB: NextFilename.Parse(pMN); break;
+ case 0x2AD7B1: TimeCodeScale.Parse(pMN); break;
+ case 0x4489: Duration.Parse(pMN); break;
+ case 0x4461: DateUTC.Parse(pMN); break;
+ case 0x7BA9: Title.Parse(pMN); break;
+ case 0x4D80: MuxingApp.Parse(pMN); break;
+ case 0x5741: WritingApp.Parse(pMN); break;
+ EndChunk
}
HRESULT Seek::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x4DBB:
- SeekHeads.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x4DBB: SeekHeads.Parse(pMN); break;
+ EndChunk
}
HRESULT SeekHead::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x53AB:
- SeekID.Parse(pMN);
- break;
-case 0x53AC:
- SeekPosition.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x53AB: SeekID.Parse(pMN); break;
+ case 0x53AC: SeekPosition.Parse(pMN); break;
+ EndChunk
}
HRESULT Track::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xAE:
- TrackEntries.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xAE: TrackEntries.Parse(pMN); break;
+ EndChunk
}
HRESULT TrackEntry::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xD7:
- TrackNumber.Parse(pMN);
- break;
-case 0x73C5:
- TrackUID.Parse(pMN);
- break;
-case 0x83:
- TrackType.Parse(pMN);
- break;
-case 0xB9:
- FlagEnabled.Parse(pMN);
- break;
-case 0x88:
- FlagDefault.Parse(pMN);
- break;
-case 0x9C:
- FlagLacing.Parse(pMN);
- break;
-case 0x6DE7:
- MinCache.Parse(pMN);
- break;
-case 0x6DF8:
- MaxCache.Parse(pMN);
- break;
-case 0x536E:
- Name.Parse(pMN);
- break;
-case 0x22B59C:
- Language.Parse(pMN);
- break;
-case 0x86:
- CodecID.Parse(pMN);
- break;
-case 0x63A2:
- CodecPrivate.Parse(pMN);
- break;
-case 0x258688:
- CodecName.Parse(pMN);
- break;
-case 0x3A9697:
- CodecSettings.Parse(pMN);
- break;
-case 0x3B4040:
- CodecInfoURL.Parse(pMN);
- break;
-case 0x26B240:
- CodecDownloadURL.Parse(pMN);
- break;
-case 0xAA:
- CodecDecodeAll.Parse(pMN);
- break;
-case 0x6FAB:
- TrackOverlay.Parse(pMN);
- break;
-case 0x23E383:
-case 0x2383E3:
- DefaultDuration.Parse(pMN);
- break;
-case 0x23314F:
- TrackTimecodeScale.Parse(pMN);
- break;
-case 0xE0:
- if(S_OK == v.Parse(pMN)) DescType |= DescVideo;
- break;
-case 0xE1:
- if(S_OK == a.Parse(pMN)) DescType |= DescAudio;
- break;
-case 0x6D80:
- ces.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xD7: TrackNumber.Parse(pMN); break;
+ case 0x73C5: TrackUID.Parse(pMN); break;
+ case 0x83: TrackType.Parse(pMN); break;
+ case 0xB9: FlagEnabled.Parse(pMN); break;
+ case 0x88: FlagDefault.Parse(pMN); break;
+ case 0x9C: FlagLacing.Parse(pMN); break;
+ case 0x6DE7: MinCache.Parse(pMN); break;
+ case 0x6DF8: MaxCache.Parse(pMN); break;
+ case 0x536E: Name.Parse(pMN); break;
+ case 0x22B59C: Language.Parse(pMN); break;
+ case 0x86: CodecID.Parse(pMN); break;
+ case 0x63A2: CodecPrivate.Parse(pMN); break;
+ case 0x258688: CodecName.Parse(pMN); break;
+ case 0x3A9697: CodecSettings.Parse(pMN); break;
+ case 0x3B4040: CodecInfoURL.Parse(pMN); break;
+ case 0x26B240: CodecDownloadURL.Parse(pMN); break;
+ case 0xAA: CodecDecodeAll.Parse(pMN); break;
+ case 0x6FAB: TrackOverlay.Parse(pMN); break;
+ case 0x23E383: case 0x2383E3: DefaultDuration.Parse(pMN); break;
+ case 0x23314F: TrackTimecodeScale.Parse(pMN); break;
+ case 0xE0: if(S_OK == v.Parse(pMN)) DescType |= DescVideo; break;
+ case 0xE1: if(S_OK == a.Parse(pMN)) DescType |= DescAudio; break;
+ case 0x6D80: ces.Parse(pMN); break;
+ EndChunk
}
static int cesort(const void* a, const void* b)
{
- UINT64 ce1 = (static_cast<ContentEncoding*>(const_cast<void *>(a)))->ContentEncodingOrder;
- UINT64 ce2 = (static_cast<ContentEncoding*>(const_cast<void *>(b)))->ContentEncodingOrder;
+ UINT64 ce1 = (static_cast<ContentEncoding*>(const_cast<void *>(a)))->ContentEncodingOrder;
+ UINT64 ce2 = (static_cast<ContentEncoding*>(const_cast<void *>(b)))->ContentEncodingOrder;
- return (int)ce1 - (int)ce2;
-//return static_cast<int>(ce1) - static_cast<int>(ce2);
+ return (int)ce1 - (int)ce2;
+//return static_cast<int>(ce1) - static_cast<int>(ce2);
}
bool TrackEntry::Expand(CBinary& data, UINT64 Scope)
{
- if(ces.ce.GetCount() == 0) return(true);
-
- CAtlArray<ContentEncoding*> cearray;
- POSITION pos = ces.ce.GetHeadPosition();
- while(pos) cearray.Add(ces.ce.GetNext(pos));
- qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
-
- for(int i = cearray.GetCount() - 1; i >= 0; i--)
- {
- ContentEncoding* ce = cearray[i];
+ if(ces.ce.GetCount() == 0) return(true);
- if(!(ce->ContentEncodingScope & Scope))
- continue;
+ CAtlArray<ContentEncoding*> cearray;
+ POSITION pos = ces.ce.GetHeadPosition();
+ while(pos) cearray.Add(ces.ce.GetNext(pos));
+ qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
- if(ce->ContentEncodingType == ContentEncoding::Compression)
- {
- if(!data.Decompress(ce->cc))
- return(false);
- }
- else if(ce->ContentEncodingType == ContentEncoding::Encryption)
- {
- // TODO
- return(false);
- }
- }
+ for(int i = cearray.GetCount()-1; i >= 0; i--)
+ {
+ ContentEncoding* ce = cearray[i];
+
+ if(!(ce->ContentEncodingScope & Scope))
+ continue;
+
+ if(ce->ContentEncodingType == ContentEncoding::Compression)
+ {
+ if(!data.Decompress(ce->cc))
+ return(false);
+ }
+ else if(ce->ContentEncodingType == ContentEncoding::Encryption)
+ {
+ // TODO
+ return(false);
+ }
+ }
- return(true);
+ return(true);
}
HRESULT Video::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x9A:
- FlagInterlaced.Parse(pMN);
- break;
-case 0x53B8:
- StereoMode.Parse(pMN);
- break;
-case 0xB0:
- PixelWidth.Parse(pMN);
- break;
-case 0xBA:
- PixelHeight.Parse(pMN);
- break;
-case 0x54B0:
- DisplayWidth.Parse(pMN);
- break;
-case 0x54BA:
- DisplayHeight.Parse(pMN);
- break;
-case 0x54B2:
- DisplayUnit.Parse(pMN);
- break;
-case 0x54B3:
- AspectRatioType.Parse(pMN);
- break;
-case 0x2EB524:
- ColourSpace.Parse(pMN);
- break;
-case 0x2FB523:
- GammaValue.Parse(pMN);
- break;
-case 0x2383E3:
- FramePerSec.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x9A: FlagInterlaced.Parse(pMN); break;
+ case 0x53B8: StereoMode.Parse(pMN); break;
+ case 0xB0: PixelWidth.Parse(pMN); break;
+ case 0xBA: PixelHeight.Parse(pMN); break;
+ case 0x54B0: DisplayWidth.Parse(pMN); break;
+ case 0x54BA: DisplayHeight.Parse(pMN); break;
+ case 0x54B2: DisplayUnit.Parse(pMN); break;
+ case 0x54B3: AspectRatioType.Parse(pMN); break;
+ case 0x2EB524: ColourSpace.Parse(pMN); break;
+ case 0x2FB523: GammaValue.Parse(pMN); break;
+ case 0x2383E3: FramePerSec.Parse(pMN); break;
+ EndChunk
}
HRESULT Audio::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xB5:
- SamplingFrequency.Parse(pMN);
- break;
-case 0x78B5:
- OutputSamplingFrequency.Parse(pMN);
- break;
-case 0x9F:
- Channels.Parse(pMN);
- break;
-case 0x7D7B:
- ChannelPositions.Parse(pMN);
- break;
-case 0x6264:
- BitDepth.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xB5: SamplingFrequency.Parse(pMN); break;
+ case 0x78B5: OutputSamplingFrequency.Parse(pMN); break;
+ case 0x9F: Channels.Parse(pMN); break;
+ case 0x7D7B: ChannelPositions.Parse(pMN); break;
+ case 0x6264: BitDepth.Parse(pMN); break;
+ EndChunk
}
HRESULT ContentEncodings::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x6240:
- ce.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x6240: ce.Parse(pMN); break;
+ EndChunk
}
HRESULT ContentEncoding::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x5031:
- ContentEncodingOrder.Parse(pMN);
- break;
-case 0x5032:
- ContentEncodingScope.Parse(pMN);
- break;
-case 0x5033:
- ContentEncodingType.Parse(pMN);
- break;
-case 0x5034:
- cc.Parse(pMN);
- break;
-case 0x5035:
- ce.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x5031: ContentEncodingOrder.Parse(pMN); break;
+ case 0x5032: ContentEncodingScope.Parse(pMN); break;
+ case 0x5033: ContentEncodingType.Parse(pMN); break;
+ case 0x5034: cc.Parse(pMN); break;
+ case 0x5035: ce.Parse(pMN); break;
+ EndChunk
}
HRESULT ContentCompression::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x4254:
- ContentCompAlgo.Parse(pMN);
- break;
-case 0x4255:
- ContentCompSettings.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x4254: ContentCompAlgo.Parse(pMN); break;
+ case 0x4255: ContentCompSettings.Parse(pMN); break;
+ EndChunk
}
HRESULT ContentEncryption::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x47e1:
- ContentEncAlgo.Parse(pMN);
- break;
-case 0x47e2:
- ContentEncKeyID.Parse(pMN);
- break;
-case 0x47e3:
- ContentSignature.Parse(pMN);
- break;
-case 0x47e4:
- ContentSigKeyID.Parse(pMN);
- break;
-case 0x47e5:
- ContentSigAlgo.Parse(pMN);
- break;
-case 0x47e6:
- ContentSigHashAlgo.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x47e1: ContentEncAlgo.Parse(pMN); break;
+ case 0x47e2: ContentEncKeyID.Parse(pMN); break;
+ case 0x47e3: ContentSignature.Parse(pMN); break;
+ case 0x47e4: ContentSigKeyID.Parse(pMN); break;
+ case 0x47e5: ContentSigAlgo.Parse(pMN); break;
+ case 0x47e6: ContentSigHashAlgo.Parse(pMN); break;
+ EndChunk
}
HRESULT Cluster::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xE7:
- TimeCode.Parse(pMN);
- break;
-case 0xA7:
- Position.Parse(pMN);
- break;
-case 0xAB:
- PrevSize.Parse(pMN);
- break;
-case 0xA0:
- BlockGroups.Parse(pMN, true);
- break;
-case 0xA3:
- SimpleBlocks.Parse(pMN, true);
- break;
- EndChunk
+ BeginChunk
+ case 0xE7: TimeCode.Parse(pMN); break;
+ case 0xA7: Position.Parse(pMN); break;
+ case 0xAB: PrevSize.Parse(pMN); break;
+ case 0xA0: BlockGroups.Parse(pMN, true); break;
+ case 0xA3: SimpleBlocks.Parse(pMN, true); break;
+ EndChunk
}
HRESULT Cluster::ParseTimeCode(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xE7:
- TimeCode.Parse(pMN);
- return S_OK;
- EndChunk
+ BeginChunk
+ case 0xE7: TimeCode.Parse(pMN); return S_OK;
+ EndChunk
}
HRESULT BlockGroup::Parse(CMatroskaNode* pMN0, bool fFull)
{
- BeginChunk
-case 0xA1:
- Block.Parse(pMN, fFull);
- break;
-case 0xA2: /* TODO: multiple virt blocks? */
- ;
- break;
-case 0x9B:
- BlockDuration.Parse(pMN);
- break;
-case 0xFA:
- ReferencePriority.Parse(pMN);
- break;
-case 0xFB:
- ReferenceBlock.Parse(pMN);
- break;
-case 0xFD:
- ReferenceVirtual.Parse(pMN);
- break;
-case 0xA4:
- CodecState.Parse(pMN);
- break;
-case 0xE8:
- TimeSlices.Parse(pMN);
- break;
-case 0x75A1:
- if(fFull) ba.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xA1: Block.Parse(pMN, fFull); break;
+ case 0xA2: /* TODO: multiple virt blocks? */; break;
+ case 0x9B: BlockDuration.Parse(pMN); break;
+ case 0xFA: ReferencePriority.Parse(pMN); break;
+ case 0xFB: ReferenceBlock.Parse(pMN); break;
+ case 0xFD: ReferenceVirtual.Parse(pMN); break;
+ case 0xA4: CodecState.Parse(pMN); break;
+ case 0xE8: TimeSlices.Parse(pMN); break;
+ case 0x75A1: if(fFull) ba.Parse(pMN); break;
+ EndChunk
}
HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
{
- pMN->SeekTo(pMN->m_start);
-
- TrackNumber.Parse(pMN);
- CShort s;
- s.Parse(pMN);
- TimeCode.Set(s);
- Lacing.Parse(pMN);
-
- if(!fFull) return S_OK;
-
- CAtlList<MatroskaReader::QWORD> lens;
- MatroskaReader::QWORD tlen = 0;
- MatroskaReader::QWORD FrameSize;
- BYTE FramesInLaceLessOne;
-
- switch((Lacing & 0x06) >> 1)
- {
- case 0:
- // No lacing
- lens.AddTail((pMN->m_start + pMN->m_len) - (pMN->GetPos() + tlen));
- break;
- case 1:
- // Xiph lacing
- BYTE n;
- pMN->Read(n);
- while(n-- > 0)
- {
- BYTE b;
- MatroskaReader::QWORD len = 0;
- do
- {
- pMN->Read(b);
- len += b;
- }
- while(b == 0xff);
- lens.AddTail(len);
- tlen += len;
- }
- lens.AddTail((pMN->m_start + pMN->m_len) - (pMN->GetPos() + tlen));
- break;
- case 2:
- // Fixed-size lacing
- pMN->Read(FramesInLaceLessOne);
- FramesInLaceLessOne++;
- FrameSize = ((pMN->m_start + pMN->m_len) - (pMN->GetPos() + tlen)) / FramesInLaceLessOne;
- while(FramesInLaceLessOne-- > 0)
- lens.AddTail(FrameSize);
- break;
- case 3:
- // EBML lacing
- pMN->Read(FramesInLaceLessOne);
-
- CLength FirstFrameSize;
- FirstFrameSize.Parse(pMN);
- lens.AddTail(FirstFrameSize);
- FramesInLaceLessOne--;
- tlen = FirstFrameSize;
-
- CSignedLength DiffSize;
- FrameSize = FirstFrameSize;
- while(FramesInLaceLessOne--)
- {
- DiffSize.Parse(pMN);
- FrameSize += DiffSize;
- lens.AddTail(FrameSize);
- tlen += FrameSize;
- }
- lens.AddTail((pMN->m_start + pMN->m_len) - (pMN->GetPos() + tlen));
- break;
- }
-
- POSITION pos = lens.GetHeadPosition();
- while(pos)
- {
- MatroskaReader::QWORD len = lens.GetNext(pos);
- CAutoPtr<CBinary> p(DNew CBinary());
- p->SetCount((INT_PTR)len);
- pMN->Read(p->GetData(), len);
- BlockData.AddTail(p);
- }
-
- return S_OK;
+ pMN->SeekTo(pMN->m_start);
+
+ TrackNumber.Parse(pMN);
+ CShort s; s.Parse(pMN); TimeCode.Set(s);
+ Lacing.Parse(pMN);
+
+ if(!fFull) return S_OK;
+
+ CAtlList<MatroskaReader::QWORD> lens;
+ MatroskaReader::QWORD tlen = 0;
+ MatroskaReader::QWORD FrameSize;
+ BYTE FramesInLaceLessOne;
+
+ switch((Lacing & 0x06) >> 1)
+ {
+ case 0:
+ // No lacing
+ lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
+ break;
+ case 1:
+ // Xiph lacing
+ BYTE n;
+ pMN->Read(n);
+ while(n-- > 0)
+ {
+ BYTE b;
+ MatroskaReader::QWORD len = 0;
+ do {pMN->Read(b); len += b;} while(b == 0xff);
+ lens.AddTail(len);
+ tlen += len;
+ }
+ lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
+ break;
+ case 2:
+ // Fixed-size lacing
+ pMN->Read(FramesInLaceLessOne);
+ FramesInLaceLessOne++;
+ FrameSize = ((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen)) / FramesInLaceLessOne;
+ while(FramesInLaceLessOne-- > 0)
+ lens.AddTail(FrameSize);
+ break;
+ case 3:
+ // EBML lacing
+ pMN->Read(FramesInLaceLessOne);
+
+ CLength FirstFrameSize;
+ FirstFrameSize.Parse(pMN);
+ lens.AddTail(FirstFrameSize);
+ FramesInLaceLessOne--;
+ tlen = FirstFrameSize;
+
+ CSignedLength DiffSize;
+ FrameSize = FirstFrameSize;
+ while(FramesInLaceLessOne--)
+ {
+ DiffSize.Parse(pMN);
+ FrameSize += DiffSize;
+ lens.AddTail(FrameSize);
+ tlen += FrameSize;
+ }
+ lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
+ break;
+ }
+
+ POSITION pos = lens.GetHeadPosition();
+ while(pos)
+ {
+ MatroskaReader::QWORD len = lens.GetNext(pos);
+ CAutoPtr<CBinary> p(DNew CBinary());
+ p->SetCount((INT_PTR)len);
+ pMN->Read(p->GetData(), len);
+ BlockData.AddTail(p);
+ }
+
+ return S_OK;
}
HRESULT BlockAdditions::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xA6:
- bm.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xA6: bm.Parse(pMN); break;
+ EndChunk
}
HRESULT BlockMore::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xEE:
- BlockAddID.Parse(pMN);
- break;
-case 0xA5:
- BlockAdditional.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xEE: BlockAddID.Parse(pMN); break;
+ case 0xA5: BlockAdditional.Parse(pMN); break;
+ EndChunk
}
HRESULT TimeSlice::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xCC:
- LaceNumber.Parse(pMN);
- break;
-case 0xCD:
- FrameNumber.Parse(pMN);
- break;
-case 0xCE:
- Delay.Parse(pMN);
- break;
-case 0xCF:
- Duration.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xCC: LaceNumber.Parse(pMN); break;
+ case 0xCD: FrameNumber.Parse(pMN); break;
+ case 0xCE: Delay.Parse(pMN); break;
+ case 0xCF: Duration.Parse(pMN); break;
+ EndChunk
}
HRESULT Cue::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xBB:
- CuePoints.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xBB: CuePoints.Parse(pMN); break;
+ EndChunk
}
HRESULT CuePoint::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xB3:
- CueTime.Parse(pMN);
- break;
-case 0xB7:
- CueTrackPositions.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xB3: CueTime.Parse(pMN); break;
+ case 0xB7: CueTrackPositions.Parse(pMN); break;
+ EndChunk
}
HRESULT CueTrackPosition::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xF7:
- CueTrack.Parse(pMN);
- break;
-case 0xF1:
- CueClusterPosition.Parse(pMN);
- break;
-case 0x5387:
- CueBlockNumber.Parse(pMN);
- break;
-case 0xEA:
- CueCodecState.Parse(pMN);
- break;
-case 0xDB:
- CueReferences.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xF7: CueTrack.Parse(pMN); break;
+ case 0xF1: CueClusterPosition.Parse(pMN); break;
+ case 0x5387: CueBlockNumber.Parse(pMN); break;
+ case 0xEA: CueCodecState.Parse(pMN); break;
+ case 0xDB: CueReferences.Parse(pMN); break;
+ EndChunk
}
HRESULT CueReference::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x96:
- CueRefTime.Parse(pMN);
- break;
-case 0x97:
- CueRefCluster.Parse(pMN);
- break;
-case 0x535F:
- CueRefNumber.Parse(pMN);
- break;
-case 0xEB:
- CueRefCodecState.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x96: CueRefTime.Parse(pMN); break;
+ case 0x97: CueRefCluster.Parse(pMN); break;
+ case 0x535F: CueRefNumber.Parse(pMN); break;
+ case 0xEB: CueRefCodecState.Parse(pMN); break;
+ EndChunk
}
HRESULT Attachment::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x61A7:
- AttachedFiles.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x61A7: AttachedFiles.Parse(pMN); break;
+ EndChunk
}
HRESULT AttachedFile::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x467E:
- FileDescription.Parse(pMN);
- break;
-case 0x466E:
- FileName.Parse(pMN);
- break;
-case 0x4660:
- FileMimeType.Parse(pMN);
- break;
-case 0x465C: // binary
- FileDataLen = (INT_PTR)pMN->m_len;
- FileDataPos = pMN->m_start;
- break;
-case 0x46AE:
- FileUID.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x467E: FileDescription.Parse(pMN); break;
+ case 0x466E: FileName.Parse(pMN); break;
+ case 0x4660: FileMimeType.Parse(pMN); break;
+ case 0x465C: // binary
+ FileDataLen = (INT_PTR)pMN->m_len;
+ FileDataPos = pMN->m_start;
+ break;
+ case 0x46AE: FileUID.Parse(pMN); break;
+ EndChunk
}
HRESULT Chapter::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x45B9:
- EditionEntries.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x45B9: EditionEntries.Parse(pMN); break;
+ EndChunk
}
HRESULT EditionEntry::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0xB6:
- ChapterAtoms.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0xB6: ChapterAtoms.Parse(pMN); break;
+ EndChunk
}
HRESULT ChapterAtom::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x73C4:
- ChapterUID.Parse(pMN);
- break;
-case 0x91:
- ChapterTimeStart.Parse(pMN);
- break;
-case 0x92:
- ChapterTimeEnd.Parse(pMN);
- break;
-// case 0x8F: // TODO
-case 0x80:
- ChapterDisplays.Parse(pMN);
- break;
-case 0xB6:
- ChapterAtoms.Parse(pMN);
- break;
-case 0x98:
- ChapterFlagHidden.Parse(pMN);
- break;
-case 0x4598:
- ChapterFlagEnabled.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x73C4: ChapterUID.Parse(pMN); break;
+ case 0x91: ChapterTimeStart.Parse(pMN); break;
+ case 0x92: ChapterTimeEnd.Parse(pMN); break;
+// case 0x8F: // TODO
+ case 0x80: ChapterDisplays.Parse(pMN); break;
+ case 0xB6: ChapterAtoms.Parse(pMN); break;
+ case 0x98: ChapterFlagHidden.Parse(pMN); break;
+ case 0x4598: ChapterFlagEnabled.Parse(pMN); break;
+ EndChunk
}
HRESULT ChapterDisplay::Parse(CMatroskaNode* pMN0)
{
- BeginChunk
-case 0x85:
- ChapString.Parse(pMN);
- break;
-case 0x437C:
- ChapLanguage.Parse(pMN);
- break;
-case 0x437E:
- ChapCountry.Parse(pMN);
- break;
- EndChunk
+ BeginChunk
+ case 0x85: ChapString.Parse(pMN); break;
+ case 0x437C: ChapLanguage.Parse(pMN); break;
+ case 0x437E: ChapCountry.Parse(pMN); break;
+ EndChunk
}
//
HRESULT CBinary::Parse(CMatroskaNode* pMN)
{
- ASSERT(pMN->m_len <= INT_MAX);
- SetCount((INT_PTR)pMN->m_len);
- return pMN->Read(GetData(), pMN->m_len);
+ ASSERT(pMN->m_len <= INT_MAX);
+ SetCount((INT_PTR)pMN->m_len);
+ return pMN->Read(GetData(), pMN->m_len);
}
bool CBinary::Compress(ContentCompression& cc)
{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB)
- {
- int res;
- z_stream c_stream;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- if(Z_OK != (res = deflateInit(&c_stream, 9)))
- return(false);
-
- c_stream.next_in = GetData();
- c_stream.avail_in = GetCount();
-
- BYTE* dst = NULL;
- int n = 0;
- do
- {
- dst = (BYTE*)realloc(dst, ++n * 10);
- c_stream.next_out = &dst[(n-1)*10];
- c_stream.avail_out = 10;
- if(Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res)
- {
- free(dst);
- return(false);
- }
- }
- while(0 == c_stream.avail_out && Z_STREAM_END != res);
-
- deflateEnd(&c_stream);
-
- SetCount(c_stream.total_out);
- memcpy(GetData(), dst, GetCount());
-
- free(dst);
-
- return(true);
- }
+ if(cc.ContentCompAlgo == ContentCompression::ZLIB)
+ {
+ int res;
+ z_stream c_stream;
+
+ c_stream.zalloc = (alloc_func)0;
+ c_stream.zfree = (free_func)0;
+ c_stream.opaque = (voidpf)0;
+
+ if(Z_OK != (res = deflateInit(&c_stream, 9)))
+ return(false);
+
+ c_stream.next_in = GetData();
+ c_stream.avail_in = GetCount();
+
+ BYTE* dst = NULL;
+ int n = 0;
+ do
+ {
+ dst = (BYTE*)realloc(dst, ++n*10);
+ c_stream.next_out = &dst[(n-1)*10];
+ c_stream.avail_out = 10;
+ if(Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ return(false);
+ }
+ }
+ while(0 == c_stream.avail_out && Z_STREAM_END != res);
+
+ deflateEnd(&c_stream);
+
+ SetCount(c_stream.total_out);
+ memcpy(GetData(), dst, GetCount());
+
+ free(dst);
+
+ return(true);
+ }
- return(false);
+ return(false);
}
bool CBinary::Decompress(ContentCompression& cc)
{
- if(cc.ContentCompAlgo == ContentCompression::ZLIB)
- {
- int res;
- z_stream d_stream;
-
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- if(Z_OK != (res = inflateInit(&d_stream)))
- return(false);
-
- d_stream.next_in = GetData();
- d_stream.avail_in = GetCount();
-
- BYTE* dst = NULL;
- int n = 0;
- do
- {
- dst = (unsigned char *)realloc(dst, ++n * 1000);
- d_stream.next_out = &dst[(n-1)*1000];
- d_stream.avail_out = 1000;
- if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
- {
- free(dst);
- return(false);
- }
- }
- while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
-
- inflateEnd(&d_stream);
-
- SetCount(d_stream.total_out);
- memcpy(GetData(), dst, GetCount());
-
- free(dst);
-
- return(true);
- }
- else if(cc.ContentCompAlgo == ContentCompression::HDRSTRIP)
- {
- InsertArrayAt(0, &cc.ContentCompSettings);
- }
+ if(cc.ContentCompAlgo == ContentCompression::ZLIB)
+ {
+ int res;
+ z_stream d_stream;
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ if(Z_OK != (res = inflateInit(&d_stream)))
+ return(false);
+
+ d_stream.next_in = GetData();
+ d_stream.avail_in = GetCount();
+
+ BYTE* dst = NULL;
+ int n = 0;
+ do
+ {
+ dst = (unsigned char *)realloc(dst, ++n*1000);
+ d_stream.next_out = &dst[(n-1)*1000];
+ d_stream.avail_out = 1000;
+ if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ return(false);
+ }
+ }
+ while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+
+ inflateEnd(&d_stream);
+
+ SetCount(d_stream.total_out);
+ memcpy(GetData(), dst, GetCount());
+
+ free(dst);
+
+ return(true);
+ }
+ else if(cc.ContentCompAlgo == ContentCompression::HDRSTRIP)
+ {
+ InsertArrayAt(0, &cc.ContentCompSettings);
+ }
- return(false);
+ return(false);
}
HRESULT CANSI::Parse(CMatroskaNode* pMN)
{
- Empty();
+ Empty();
- MatroskaReader::QWORD len = pMN->m_len;
- CHAR c;
- while(len-- > 0 && SUCCEEDED(pMN->Read(c)))
- *this += c;
+ MatroskaReader::QWORD len = pMN->m_len;
+ CHAR c;
+ while(len-- > 0 && SUCCEEDED(pMN->Read(c)))
+ *this += c;
- return(len == -1 ? S_OK : E_FAIL);
+ return(len == -1 ? S_OK : E_FAIL);
}
HRESULT CUTF8::Parse(CMatroskaNode* pMN)
{
- Empty();
- CAutoVectorPtr<BYTE> buff;
- if(!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len))
- return E_FAIL;
- buff[pMN->m_len] = 0;
- CStringW::operator = (UTF8To16((LPCSTR)(BYTE*)buff));
- return S_OK;
+ Empty();
+ CAutoVectorPtr<BYTE> buff;
+ if(!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len))
+ return E_FAIL;
+ buff[pMN->m_len] = 0;
+ CStringW::operator = (UTF8To16((LPCSTR)(BYTE*)buff));
+ return S_OK;
}
HRESULT CUInt::Parse(CMatroskaNode* pMN)
{
- m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++)
- {
- m_val <<= 8;
- HRESULT hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
- m_fValid = true;
- return S_OK;
+ m_val = 0;
+ for(int i = 0; i < (int)pMN->m_len; i++)
+ {
+ m_val <<= 8;
+ HRESULT hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+ m_fValid = true;
+ return S_OK;
}
HRESULT CInt::Parse(CMatroskaNode* pMN)
{
- m_val = 0;
- for(int i = 0; i < (int)pMN->m_len; i++)
- {
- HRESULT hr = pMN->Read(*((BYTE*)&m_val + 7 - i));
- if(FAILED(hr)) return hr;
- }
- m_val >>= (8 - pMN->m_len) * 8;
- m_fValid = true;
- return S_OK;
+ m_val = 0;
+ for(int i = 0; i < (int)pMN->m_len; i++)
+ {
+ HRESULT hr = pMN->Read(*((BYTE*)&m_val+7-i));
+ if(FAILED(hr)) return hr;
+ }
+ m_val >>= (8-pMN->m_len)*8;
+ m_fValid = true;
+ return S_OK;
}
HRESULT CFloat::Parse(CMatroskaNode* pMN)
{
- HRESULT hr = E_FAIL;
- m_val = 0;
+ HRESULT hr = E_FAIL;
+ m_val = 0;
- if(pMN->m_len == 4)
- {
- float val = 0;
- hr = pMN->Read(val);
- m_val = val;
- }
- else if(pMN->m_len == 8)
- {
- hr = pMN->Read(m_val);
- }
- if(SUCCEEDED(hr))
- m_fValid = true;
- return hr;
+ if(pMN->m_len == 4)
+ {
+ float val = 0;
+ hr = pMN->Read(val);
+ m_val = val;
+ } else if(pMN->m_len == 8) {
+ hr = pMN->Read(m_val);
+ }
+ if(SUCCEEDED(hr))
+ m_fValid = true;
+ return hr;
}
template<class T, class BASE>
HRESULT CSimpleVar<T, BASE>::Parse(CMatroskaNode* pMN)
{
- m_val = 0;
- m_fValid = true;
- return pMN->Read(m_val);
+ m_val = 0;
+ m_fValid = true;
+ return pMN->Read(m_val);
}
HRESULT CID::Parse(CMatroskaNode* pMN)
{
- m_val = 0;
-
- BYTE b = 0;
- HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) return hr;
-
- int nMoreBytes = 0;
-
- if((b & 0x80) == 0x80)
- {
- m_val = b & 0xff;
- nMoreBytes = 0;
- }
- else if((b & 0xc0) == 0x40)
- {
- m_val = b & 0x7f;
- nMoreBytes = 1;
- }
- else if((b & 0xe0) == 0x20)
- {
- m_val = b & 0x3f;
- nMoreBytes = 2;
- }
- else if((b & 0xf0) == 0x10)
- {
- m_val = b & 0x1f;
- nMoreBytes = 3;
- }
- else return E_FAIL;
-
- while(nMoreBytes-- > 0)
- {
- m_val <<= 8;
- hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
-
- m_fValid = true;
-
- return S_OK;
+ m_val = 0;
+
+ BYTE b = 0;
+ HRESULT hr = pMN->Read(b);
+ if(FAILED(hr)) return hr;
+
+ int nMoreBytes = 0;
+
+ if((b&0x80) == 0x80) {m_val = b&0xff; nMoreBytes = 0;}
+ else if((b&0xc0) == 0x40) {m_val = b&0x7f; nMoreBytes = 1;}
+ else if((b&0xe0) == 0x20) {m_val = b&0x3f; nMoreBytes = 2;}
+ else if((b&0xf0) == 0x10) {m_val = b&0x1f; nMoreBytes = 3;}
+ else return E_FAIL;
+
+ while(nMoreBytes-- > 0)
+ {
+ m_val <<= 8;
+ hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+
+ m_fValid = true;
+
+ return S_OK;
}
HRESULT CLength::Parse(CMatroskaNode* pMN)
{
- m_val = 0;
-
- BYTE b = 0;
- HRESULT hr = pMN->Read(b);
- if(FAILED(hr)) return hr;
-
- int nMoreBytes = 0, nMoreBytesTmp = 0;
-
- if((b & 0x80) == 0x80)
- {
- m_val = b & 0x7f;
- nMoreBytes = 0;
- }
- else if((b & 0xc0) == 0x40)
- {
- m_val = b & 0x3f;
- nMoreBytes = 1;
- }
- else if((b & 0xe0) == 0x20)
- {
- m_val = b & 0x1f;
- nMoreBytes = 2;
- }
- else if((b & 0xf0) == 0x10)
- {
- m_val = b & 0x0f;
- nMoreBytes = 3;
- }
- else if((b & 0xf8) == 0x08)
- {
- m_val = b & 0x07;
- nMoreBytes = 4;
- }
- else if((b & 0xfc) == 0x04)
- {
- m_val = b & 0x03;
- nMoreBytes = 5;
- }
- else if((b & 0xfe) == 0x02)
- {
- m_val = b & 0x01;
- nMoreBytes = 6;
- }
- else if((b & 0xff) == 0x01)
- {
- m_val = b & 0x00;
- nMoreBytes = 7;
- }
- else return E_FAIL;
-
- nMoreBytesTmp = nMoreBytes;
-
- MatroskaReader::QWORD UnknownSize = (1i64 << (7 * (nMoreBytes + 1))) - 1;
-
- while(nMoreBytes-- > 0)
- {
- m_val <<= 8;
- hr = pMN->Read(*(BYTE*)&m_val);
- if(FAILED(hr)) return hr;
- }
-
- if(m_val == UnknownSize)
- {
- m_val = pMN->GetLength() - pMN->GetPos();
- TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
- }
-
- if(m_fSigned)
- m_val -= (UnknownSize >> 1);
-
- m_fValid = true;
-
- return S_OK;
+ m_val = 0;
+
+ BYTE b = 0;
+ HRESULT hr = pMN->Read(b);
+ if(FAILED(hr)) return hr;
+
+ int nMoreBytes = 0, nMoreBytesTmp = 0;
+
+ if((b&0x80) == 0x80) {m_val = b&0x7f; nMoreBytes = 0;}
+ else if((b&0xc0) == 0x40) {m_val = b&0x3f; nMoreBytes = 1;}
+ else if((b&0xe0) == 0x20) {m_val = b&0x1f; nMoreBytes = 2;}
+ else if((b&0xf0) == 0x10) {m_val = b&0x0f; nMoreBytes = 3;}
+ else if((b&0xf8) == 0x08) {m_val = b&0x07; nMoreBytes = 4;}
+ else if((b&0xfc) == 0x04) {m_val = b&0x03; nMoreBytes = 5;}
+ else if((b&0xfe) == 0x02) {m_val = b&0x01; nMoreBytes = 6;}
+ else if((b&0xff) == 0x01) {m_val = b&0x00; nMoreBytes = 7;}
+ else return E_FAIL;
+
+ nMoreBytesTmp = nMoreBytes;
+
+ MatroskaReader::QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
+
+ while(nMoreBytes-- > 0)
+ {
+ m_val <<= 8;
+ hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+
+ if(m_val == UnknownSize)
+ {
+ m_val = pMN->GetLength() - pMN->GetPos();
+ TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
+ }
+
+ if(m_fSigned)
+ m_val -= (UnknownSize >> 1);
+
+ m_fValid = true;
+
+ return S_OK;
}
/*
HRESULT CSignedLength::Parse(CMatroskaNode* pMN)
@@ -1343,232 +986,214 @@ HRESULT CSignedLength::Parse(CMatroskaNode* pMN)
template<class T>
HRESULT CNode<T>::Parse(CMatroskaNode* pMN)
{
- CAutoPtr<T> p(DNew T());
- HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN))) return hr;
- AddTail(p);
- return S_OK;
+ CAutoPtr<T> p(DNew T());
+ HRESULT hr = E_OUTOFMEMORY;
+ if(!p || FAILED(hr = p->Parse(pMN))) return hr;
+ AddTail(p);
+ return S_OK;
}
HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull)
{
- CAutoPtr<BlockGroup> p(DNew BlockGroup());
- HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
- AddTail(p);
- return S_OK;
+ CAutoPtr<BlockGroup> p(DNew BlockGroup());
+ HRESULT hr = E_OUTOFMEMORY;
+ if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
+ AddTail(p);
+ return S_OK;
}
HRESULT CSimpleBlockNode::Parse(CMatroskaNode* pMN, bool fFull)
{
- CAutoPtr<SimpleBlock> p(DNew SimpleBlock());
- HRESULT hr = E_OUTOFMEMORY;
- if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
- AddTail(p);
- return S_OK;
+ CAutoPtr<SimpleBlock> p(DNew SimpleBlock());
+ HRESULT hr = E_OUTOFMEMORY;
+ if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
+ AddTail(p);
+ return S_OK;
}
///////////////////////////////
CMatroskaNode::CMatroskaNode(CMatroskaFile* pMF)
- : m_pMF(pMF)
- , m_pParent(NULL)
+ : m_pMF(pMF)
+ , m_pParent(NULL)
{
- ASSERT(m_pMF);
- m_start = m_filepos = 0;
- m_len.Set(m_pMF ? m_pMF->GetLength() : 0);
+ ASSERT(m_pMF);
+ m_start = m_filepos = 0;
+ m_len.Set(m_pMF ? m_pMF->GetLength() : 0);
}
CMatroskaNode::CMatroskaNode(CMatroskaNode* pParent)
- : m_pMF(pParent->m_pMF)
- , m_pParent(pParent)
+ : m_pMF(pParent->m_pMF)
+ , m_pParent(pParent)
{
- Parse();
+ Parse();
}
HRESULT CMatroskaNode::Parse()
{
- m_filepos = GetPos();
- if(FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this)))
- return E_FAIL;
- m_start = GetPos();
- return S_OK;
+ m_filepos = GetPos();
+ if(FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this)))
+ return E_FAIL;
+ m_start = GetPos();
+ return S_OK;
}
CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch)
{
- if(m_len == 0) return CAutoPtr<CMatroskaNode>();
- SeekTo(m_start);
- CAutoPtr<CMatroskaNode> pMN(DNew CMatroskaNode(this));
- if(id && !pMN->Find(id, fSearch)) pMN.Free();
- return pMN;
+ if(m_len == 0) return CAutoPtr<CMatroskaNode>();
+ SeekTo(m_start);
+ CAutoPtr<CMatroskaNode> pMN(DNew CMatroskaNode(this));
+ if(id && !pMN->Find(id, fSearch)) pMN.Free();
+ return pMN;
}
bool CMatroskaNode::Next(bool fSame)
{
- if(!m_pParent)
- return(false);
+ if(!m_pParent)
+ return(false);
- CID id = m_id;
+ CID id = m_id;
- while(m_start + m_len < m_pParent->m_start + m_pParent->m_len)
- {
- SeekTo(m_start + m_len);
+ while(m_start+m_len < m_pParent->m_start+m_pParent->m_len)
+ {
+ SeekTo(m_start+m_len);
- if(FAILED(Parse()))
- {
- if(!Resync())
- return(false);
- }
+ if(FAILED(Parse()))
+ {
+ if(!Resync())
+ return(false);
+ }
- if(!fSame || m_id == id)
- return(true);
- }
+ if(!fSame || m_id == id)
+ return(true);
+ }
- return(false);
+ return(false);
}
bool CMatroskaNode::Find(DWORD id, bool fSearch)
{
- MatroskaReader::QWORD pos = m_pParent && m_pParent->m_id == 0x18538067 /*segment?*/
- ? FindPos(id)
- : 0;
+ MatroskaReader::QWORD pos = m_pParent && m_pParent->m_id == 0x18538067 /*segment?*/
+ ? FindPos(id)
+ : 0;
- if(pos)
- {
- SeekTo(pos);
- Parse();
- }
- else if(fSearch)
- {
- while(m_id != id && Next());
- }
+ if(pos)
+ {
+ SeekTo(pos);
+ Parse();
+ }
+ else if(fSearch)
+ {
+ while(m_id != id && Next());
+ }
- return(m_id == id);
+ return(m_id == id);
}
-void CMatroskaNode::SeekTo(MatroskaReader::QWORD pos)
-{
- m_pMF->Seek(pos);
-}
-MatroskaReader::QWORD CMatroskaNode::GetPos()
-{
- return m_pMF->GetPos();
-}
-MatroskaReader::QWORD CMatroskaNode::GetLength()
-{
- return m_pMF->GetLength();
-}
-template <class T>
-HRESULT CMatroskaNode::Read(T& var)
-{
- return m_pMF->Read(var);
-}
-HRESULT CMatroskaNode::Read(BYTE* pData, MatroskaReader::QWORD len)
-{
- return m_pMF->ByteRead(pData, len);
-}
+void CMatroskaNode::SeekTo(MatroskaReader::QWORD pos) {m_pMF->Seek(pos);}
+MatroskaReader::QWORD CMatroskaNode::GetPos() {return m_pMF->GetPos();}
+MatroskaReader::QWORD CMatroskaNode::GetLength() {return m_pMF->GetLength();}
+template <class T>
+HRESULT CMatroskaNode::Read(T& var) {return m_pMF->Read(var);}
+HRESULT CMatroskaNode::Read(BYTE* pData, MatroskaReader::QWORD len) {return m_pMF->ByteRead(pData, len);}
MatroskaReader::QWORD CMatroskaNode::FindPos(DWORD id, MatroskaReader::QWORD start)
{
- Segment& sm = m_pMF->m_segment;
+ Segment& sm = m_pMF->m_segment;
- POSITION pos = sm.MetaSeekInfo.GetHeadPosition();
- while(pos)
- {
- Seek* s = sm.MetaSeekInfo.GetNext(pos);
-
- POSITION pos2 = s->SeekHeads.GetHeadPosition();
- while(pos2)
- {
- SeekHead* sh = s->SeekHeads.GetNext(pos2);
- if(sh->SeekID == id && sh->SeekPosition + sm.pos >= start)
- return sh->SeekPosition + sm.pos;
- }
- }
+ POSITION pos = sm.MetaSeekInfo.GetHeadPosition();
+ while(pos)
+ {
+ Seek* s = sm.MetaSeekInfo.GetNext(pos);
+
+ POSITION pos2 = s->SeekHeads.GetHeadPosition();
+ while(pos2)
+ {
+ SeekHead* sh = s->SeekHeads.GetNext(pos2);
+ if(sh->SeekID == id && sh->SeekPosition+sm.pos >= start)
+ return sh->SeekPosition+sm.pos;
+ }
+ }
- return 0;
+ return 0;
}
CAutoPtr<CMatroskaNode> CMatroskaNode::Copy()
{
- CAutoPtr<CMatroskaNode> pNewNode(DNew CMatroskaNode(m_pMF));
- pNewNode->m_pParent = m_pParent;
- pNewNode->m_id.Set(m_id);
- pNewNode->m_len.Set(m_len);
- pNewNode->m_filepos = m_filepos;
- pNewNode->m_start = m_start;
- return(pNewNode);
+ CAutoPtr<CMatroskaNode> pNewNode(DNew CMatroskaNode(m_pMF));
+ pNewNode->m_pParent = m_pParent;
+ pNewNode->m_id.Set(m_id);
+ pNewNode->m_len.Set(m_len);
+ pNewNode->m_filepos = m_filepos;
+ pNewNode->m_start = m_start;
+ return(pNewNode);
}
CAutoPtr<CMatroskaNode> CMatroskaNode::GetFirstBlock()
{
- CAutoPtr<CMatroskaNode> pNode = Child();
- do
- {
- if(pNode->m_id == 0xA0 || pNode->m_id == 0xA3) return pNode;
- }
- while(pNode->Next());
- return CAutoPtr<CMatroskaNode>();
+ CAutoPtr<CMatroskaNode> pNode = Child();
+ do {if(pNode->m_id == 0xA0 || pNode->m_id == 0xA3) return pNode;}
+ while(pNode->Next());
+ return CAutoPtr<CMatroskaNode>();
}
bool CMatroskaNode::NextBlock()
{
- if(!m_pParent)
- return(false);
+ if(!m_pParent)
+ return(false);
- CID id = m_id;
+ CID id = m_id;
- while(m_start + m_len < m_pParent->m_start + m_pParent->m_len)
- {
- SeekTo(m_start + m_len);
+ while(m_start+m_len < m_pParent->m_start+m_pParent->m_len)
+ {
+ SeekTo(m_start+m_len);
- if(FAILED(Parse()))
- {
- if(!Resync())
- return(false);
- }
+ if(FAILED(Parse()))
+ {
+ if(!Resync())
+ return(false);
+ }
- if(m_id == 0xA0 || m_id == 0xA3)
- return(true);
- }
+ if(m_id == 0xA0 || m_id == 0xA3)
+ return(true);
+ }
- return(false);
+ return(false);
}
bool CMatroskaNode::Resync()
{
- if(m_pParent->m_id == 0x18538067) /*segment?*/
- {
- SeekTo(m_filepos);
+ if(m_pParent->m_id == 0x18538067) /*segment?*/
+ {
+ SeekTo(m_filepos);
- for(BYTE b = 0; S_OK == Read(b); b = 0)
- {
- if((b & 0xf0) != 0x10)
- continue;
+ for(BYTE b = 0; S_OK == Read(b); b = 0)
+ {
+ if((b&0xf0) != 0x10)
+ continue;
DWORD dw = b;
- Read((BYTE*)&dw + 1, 3);
- bswap((BYTE*)&dw, 4);
-
- switch(dw)
- {
- case 0x1549A966: // SegmentInfo
- case 0x114D9B74: // MetaSeekInfo
- case 0x1654AE6B: // Tracks
- case 0x1F43B675: // Clusters
- case 0x1C53BB6B: // Cues
- case 0x1941A469: // Attachments
- case 0x1043A770: // Chapters
- case 0x1254C367: // Tags
- SeekTo(GetPos() - 4);
- return(SUCCEEDED(Parse()));
- default:
- SeekTo(GetPos() - 3);
- break;
- }
- }
- }
-
- return(false);
+ Read((BYTE*)&dw+1, 3);
+ bswap((BYTE*)&dw, 4);
+
+ switch(dw)
+ {
+ case 0x1549A966: // SegmentInfo
+ case 0x114D9B74: // MetaSeekInfo
+ case 0x1654AE6B: // Tracks
+ case 0x1F43B675: // Clusters
+ case 0x1C53BB6B: // Cues
+ case 0x1941A469: // Attachments
+ case 0x1043A770: // Chapters
+ case 0x1254C367: // Tags
+ SeekTo(GetPos()-4);
+ return(SUCCEEDED(Parse()));
+ default:
+ SeekTo(GetPos()-3);
+ break;
+ }
+ }
+ }
+
+ return(false);
}
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaFile.h b/src/filters/parser/MatroskaSplitter/MatroskaFile.h
index fd3a0420d..d1106ee24 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaFile.h
+++ b/src/filters/parser/MatroskaSplitter/MatroskaFile.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,568 +27,449 @@
namespace MatroskaReader
{
-class CMatroskaNode;
-
-typedef unsigned __int64 QWORD;
-
-class CANSI : public CStringA
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-class CUTF8 : public CStringW
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-template<class T, class BASE>
-class CSimpleVar
-{
-protected:
- T m_val;
- bool m_fValid;
-public:
- CSimpleVar(T val = 0) : m_val(val), m_fValid(false) {}
- BASE& operator = (const BASE& v)
- {
- m_val = v.m_val;
- m_fValid = true;
- return(*this);
- }
- BASE& operator = (T val)
- {
- m_val = val;
- m_fValid = true;
- return(*this);
- }
- operator T() const
- {
- return m_val;
- }
- BASE& Set(T val)
- {
- m_val = val;
- m_fValid = true;
- return(*(BASE*)this);
- }
- bool IsValid() const
- {
- return m_fValid;
- }
- virtual HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class CUInt : public CSimpleVar<UINT64, CUInt>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-class CInt : public CSimpleVar<INT64, CInt>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-class CByte : public CSimpleVar<BYTE, CByte> {};
-class CShort : public CSimpleVar<short, CShort> {};
-class CFloat : public CSimpleVar<double, CFloat>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-class CID : public CSimpleVar<DWORD, CID>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-class CLength : public CSimpleVar<UINT64, CLength>
-{
- bool m_fSigned;
-public:
- CLength(bool fSigned = false) : m_fSigned(fSigned) {} HRESULT Parse(CMatroskaNode* pMN);
-};
-class CSignedLength : public CLength
-{
-public:
- CSignedLength() : CLength(true) {}};
-
-class ContentCompression;
-
-class CBinary : public CAtlArray<BYTE>
-{
-public:
- CBinary& operator = (const CBinary& b)
- {
- Copy(b);
- return(*this);
- }
- CStringA ToString()
- {
- return CStringA((LPCSTR)GetData(), GetCount());
- }
- bool Compress(ContentCompression& cc), Decompress(ContentCompression& cc);
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-template<class T>
-class CNode : public CAutoPtrList<T>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class EBML
-{
-public:
- CUInt EBMLVersion, EBMLReadVersion;
- CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
- CANSI DocType;
- CUInt DocTypeVersion, DocTypeReadVersion;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Info
-{
-public:
- CBinary SegmentUID, PrevUID, NextUID;
- CUTF8 SegmentFilename, PrevFilename, NextFilename;
- CUInt TimeCodeScale; // [ns], default: 1.000.000
- CFloat Duration;
- CInt DateUTC;
- CUTF8 Title, MuxingApp, WritingApp;
-
- Info()
- {
- TimeCodeScale.Set(1000000ui64);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class SeekHead
-{
-public:
- CID SeekID;
- CUInt SeekPosition;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Seek
-{
-public:
- CNode<SeekHead> SeekHeads;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class TimeSlice
-{
-public:
- CUInt LaceNumber, FrameNumber;
- CUInt Delay, Duration;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class SimpleBlock
-{
-public:
- CLength TrackNumber;
- CInt TimeCode;
- CByte Lacing;
- CAutoPtrList<CBinary> BlockData;
-
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
-};
-
-class BlockMore
-{
-public:
- CInt BlockAddID;
- CBinary BlockAdditional;
-
- BlockMore()
- {
- BlockAddID.Set(1);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class BlockAdditions
-{
-public:
- CNode<BlockMore> bm;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class BlockGroup
-{
-public:
- SimpleBlock Block;
+ class CMatroskaNode;
+
+ typedef unsigned __int64 QWORD;
+
+ class CANSI : public CStringA {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CUTF8 : public CStringW {public: HRESULT Parse(CMatroskaNode* pMN);};
+
+ template<class T, class BASE>
+ class CSimpleVar
+ {
+ protected:
+ T m_val;
+ bool m_fValid;
+ public:
+ CSimpleVar(T val = 0) : m_val(val), m_fValid(false) {}
+ BASE& operator = (const BASE& v) {m_val = v.m_val; m_fValid = true; return(*this);}
+ BASE& operator = (T val) {m_val = val; m_fValid = true; return(*this);}
+ operator T() const {return m_val;}
+ BASE& Set(T val) {m_val = val; m_fValid = true; return(*(BASE*)this);}
+ bool IsValid() const {return m_fValid;}
+ virtual HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CUInt : public CSimpleVar<UINT64, CUInt> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CInt : public CSimpleVar<INT64, CInt> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CByte : public CSimpleVar<BYTE, CByte> {};
+ class CShort : public CSimpleVar<short, CShort> {};
+ class CFloat : public CSimpleVar<double, CFloat> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CID : public CSimpleVar<DWORD, CID> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CLength : public CSimpleVar<UINT64, CLength> {bool m_fSigned; public: CLength(bool fSigned = false) : m_fSigned(fSigned) {} HRESULT Parse(CMatroskaNode* pMN);};
+ class CSignedLength : public CLength {public: CSignedLength() : CLength(true) {}};
+
+ class ContentCompression;
+
+ class CBinary : public CAtlArray<BYTE>
+ {
+ public:
+ CBinary& operator = (const CBinary& b) {Copy(b); return(*this);}
+ CStringA ToString() {return CStringA((LPCSTR)GetData(), GetCount());}
+ bool Compress(ContentCompression& cc), Decompress(ContentCompression& cc);
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ template<class T>
+ class CNode : public CAutoPtrList<T> {public: HRESULT Parse(CMatroskaNode* pMN);};
+
+ class EBML
+ {
+ public:
+ CUInt EBMLVersion, EBMLReadVersion;
+ CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
+ CANSI DocType;
+ CUInt DocTypeVersion, DocTypeReadVersion;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Info
+ {
+ public:
+ CBinary SegmentUID, PrevUID, NextUID;
+ CUTF8 SegmentFilename, PrevFilename, NextFilename;
+ CUInt TimeCodeScale; // [ns], default: 1.000.000
+ CFloat Duration;
+ CInt DateUTC;
+ CUTF8 Title, MuxingApp, WritingApp;
+
+ Info() {TimeCodeScale.Set(1000000ui64);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class SeekHead
+ {
+ public:
+ CID SeekID;
+ CUInt SeekPosition;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Seek
+ {
+ public:
+ CNode<SeekHead> SeekHeads;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class TimeSlice
+ {
+ public:
+ CUInt LaceNumber, FrameNumber;
+ CUInt Delay, Duration;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class SimpleBlock
+ {
+ public:
+ CLength TrackNumber;
+ CInt TimeCode;
+ CByte Lacing;
+ CAutoPtrList<CBinary> BlockData;
+
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class BlockMore
+ {
+ public:
+ CInt BlockAddID;
+ CBinary BlockAdditional;
+
+ BlockMore() {BlockAddID.Set(1);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class BlockAdditions
+ {
+ public:
+ CNode<BlockMore> bm;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class BlockGroup
+ {
+ public:
+ SimpleBlock Block;
// BlockVirtual
- CUInt BlockDuration;
- CUInt ReferencePriority;
- CInt ReferenceBlock;
- CInt ReferenceVirtual;
- CBinary CodecState;
- CNode<TimeSlice> TimeSlices;
- BlockAdditions ba;
-
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
-};
-
-class CBlockGroupNode : public CNode<BlockGroup>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
-};
-
-class CSimpleBlockNode : public CNode<SimpleBlock>
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN, bool fFull);
-};
-
-class Cluster
-{
-public:
- CUInt TimeCode, Position, PrevSize;
- CBlockGroupNode BlockGroups;
- CSimpleBlockNode SimpleBlocks;
-
- HRESULT Parse(CMatroskaNode* pMN);
- HRESULT ParseTimeCode(CMatroskaNode* pMN);
-};
-
-class Video
-{
-public:
- CUInt FlagInterlaced, StereoMode;
- CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
- CUInt AspectRatioType;
- CUInt ColourSpace;
- CFloat GammaValue;
- CFloat FramePerSec;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Audio
-{
-public:
- CFloat SamplingFrequency;
- CFloat OutputSamplingFrequency;
- CUInt Channels;
- CBinary ChannelPositions;
- CUInt BitDepth;
-
- Audio()
- {
- SamplingFrequency.Set(8000.0);
- Channels.Set(1);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class ContentCompression
-{
-public:
- CUInt ContentCompAlgo;
- enum {ZLIB, BZLIB, LZO1X, HDRSTRIP};
- CBinary ContentCompSettings;
-
- ContentCompression()
- {
- ContentCompAlgo.Set(ZLIB);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class ContentEncryption
-{
-public:
- CUInt ContentEncAlgo;
- enum {UNKE, DES, THREEDES, TWOFISH, BLOWFISH, AES};
- CBinary ContentEncKeyID, ContentSignature, ContentSigKeyID;
- CUInt ContentSigAlgo;
- enum {UNKS, RSA};
- CUInt ContentSigHashAlgo;
- enum {UNKSH, SHA1_160, MD5};
-
- ContentEncryption()
- {
- ContentEncAlgo.Set(0);
- ContentSigAlgo.Set(0);
- ContentSigHashAlgo.Set(0);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class ContentEncoding
-{
-public:
- CUInt ContentEncodingOrder;
- CUInt ContentEncodingScope;
- enum {AllFrameContents = 1, TracksPrivateData = 2};
- CUInt ContentEncodingType;
- enum {Compression, Encryption};
- ContentCompression cc;
- ContentEncryption ce;
-
- ContentEncoding()
- {
- ContentEncodingOrder.Set(0);
- ContentEncodingScope.Set(AllFrameContents);
- ContentEncodingType.Set(Compression);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class ContentEncodings
-{
-public:
- CNode<ContentEncoding> ce;
-
- ContentEncodings() {}
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class TrackEntry
-{
-public:
- enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
- CUInt TrackNumber, TrackUID, TrackType;
- CUInt FlagEnabled, FlagDefault, FlagLacing;
- CUInt MinCache, MaxCache;
- CUTF8 Name;
- CANSI Language;
- CBinary CodecID;
- CBinary CodecPrivate;
- CUTF8 CodecName;
- CUTF8 CodecSettings;
- CANSI CodecInfoURL;
- CANSI CodecDownloadURL;
- CUInt CodecDecodeAll;
- CUInt TrackOverlay;
- CUInt DefaultDuration;
- CFloat TrackTimecodeScale;
- enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
- int DescType;
- Video v;
- Audio a;
- ContentEncodings ces;
- TrackEntry()
- {
- DescType = NoDesc;
- FlagEnabled.Set(1);
- FlagDefault.Set(1);
- FlagLacing.Set(1);
- }
- HRESULT Parse(CMatroskaNode* pMN);
-
- bool Expand(CBinary& data, UINT64 Scope);
-};
-
-class Track
-{
-public:
- CNode<TrackEntry> TrackEntries;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class CueReference
-{
-public:
- CUInt CueRefTime, CueRefCluster, CueRefNumber, CueRefCodecState;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class CueTrackPosition
-{
-public:
- CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
- CNode<CueReference> CueReferences;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class CuePoint
-{
-public:
- CUInt CueTime;
- CNode<CueTrackPosition> CueTrackPositions;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Cue
-{
-public:
- CNode<CuePoint> CuePoints;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class AttachedFile
-{
-public:
- CUTF8 FileDescription;
- CUTF8 FileName;
- CANSI FileMimeType;
- QWORD FileDataPos, FileDataLen; // BYTE* FileData
- CUInt FileUID;
-
- AttachedFile()
- {
- FileDataPos = FileDataLen = 0;
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Attachment
-{
-public:
- CNode<AttachedFile> AttachedFiles;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class ChapterDisplay
-{
-public:
- CUTF8 ChapString;
- CANSI ChapLanguage;
- CANSI ChapCountry;
-
- ChapterDisplay()
- {
- ChapLanguage.CStringA::operator = ("eng");
- }
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class ChapterAtom
-{
-public:
- CUInt ChapterUID;
- CUInt ChapterTimeStart, ChapterTimeEnd, ChapterFlagHidden, ChapterFlagEnabled;
+ CUInt BlockDuration;
+ CUInt ReferencePriority;
+ CInt ReferenceBlock;
+ CInt ReferenceVirtual;
+ CBinary CodecState;
+ CNode<TimeSlice> TimeSlices;
+ BlockAdditions ba;
+
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class CBlockGroupNode : public CNode<BlockGroup>
+ {
+ public:
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class CSimpleBlockNode : public CNode<SimpleBlock>
+ {
+ public:
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class Cluster
+ {
+ public:
+ CUInt TimeCode, Position, PrevSize;
+ CBlockGroupNode BlockGroups;
+ CSimpleBlockNode SimpleBlocks;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ HRESULT ParseTimeCode(CMatroskaNode* pMN);
+ };
+
+ class Video
+ {
+ public:
+ CUInt FlagInterlaced, StereoMode;
+ CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
+ CUInt AspectRatioType;
+ CUInt ColourSpace;
+ CFloat GammaValue;
+ CFloat FramePerSec;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Audio
+ {
+ public:
+ CFloat SamplingFrequency;
+ CFloat OutputSamplingFrequency;
+ CUInt Channels;
+ CBinary ChannelPositions;
+ CUInt BitDepth;
+
+ Audio() {SamplingFrequency.Set(8000.0); Channels.Set(1);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentCompression
+ {
+ public:
+ CUInt ContentCompAlgo; enum {ZLIB, BZLIB, LZO1X, HDRSTRIP};
+ CBinary ContentCompSettings;
+
+ ContentCompression() {ContentCompAlgo.Set(ZLIB);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentEncryption
+ {
+ public:
+ CUInt ContentEncAlgo; enum {UNKE, DES, THREEDES, TWOFISH, BLOWFISH, AES};
+ CBinary ContentEncKeyID, ContentSignature, ContentSigKeyID;
+ CUInt ContentSigAlgo; enum {UNKS, RSA};
+ CUInt ContentSigHashAlgo; enum {UNKSH, SHA1_160, MD5};
+
+ ContentEncryption() {ContentEncAlgo.Set(0); ContentSigAlgo.Set(0); ContentSigHashAlgo.Set(0);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentEncoding
+ {
+ public:
+ CUInt ContentEncodingOrder;
+ CUInt ContentEncodingScope; enum {AllFrameContents = 1, TracksPrivateData = 2};
+ CUInt ContentEncodingType; enum {Compression, Encryption};
+ ContentCompression cc;
+ ContentEncryption ce;
+
+ ContentEncoding() {ContentEncodingOrder.Set(0); ContentEncodingScope.Set(AllFrameContents); ContentEncodingType.Set(Compression);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentEncodings
+ {
+ public:
+ CNode<ContentEncoding> ce;
+
+ ContentEncodings() {}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class TrackEntry
+ {
+ public:
+ enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
+ CUInt TrackNumber, TrackUID, TrackType;
+ CUInt FlagEnabled, FlagDefault, FlagLacing;
+ CUInt MinCache, MaxCache;
+ CUTF8 Name;
+ CANSI Language;
+ CBinary CodecID;
+ CBinary CodecPrivate;
+ CUTF8 CodecName;
+ CUTF8 CodecSettings;
+ CANSI CodecInfoURL;
+ CANSI CodecDownloadURL;
+ CUInt CodecDecodeAll;
+ CUInt TrackOverlay;
+ CUInt DefaultDuration;
+ CFloat TrackTimecodeScale;
+ enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
+ int DescType;
+ Video v;
+ Audio a;
+ ContentEncodings ces;
+ TrackEntry() {DescType = NoDesc; FlagEnabled.Set(1); FlagDefault.Set(1); FlagLacing.Set(1); }
+ HRESULT Parse(CMatroskaNode* pMN);
+
+ bool Expand(CBinary& data, UINT64 Scope);
+ };
+
+ class Track
+ {
+ public:
+ CNode<TrackEntry> TrackEntries;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CueReference
+ {
+ public:
+ CUInt CueRefTime, CueRefCluster, CueRefNumber, CueRefCodecState;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CueTrackPosition
+ {
+ public:
+ CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
+ CNode<CueReference> CueReferences;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CuePoint
+ {
+ public:
+ CUInt CueTime;
+ CNode<CueTrackPosition> CueTrackPositions;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Cue
+ {
+ public:
+ CNode<CuePoint> CuePoints;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class AttachedFile
+ {
+ public:
+ CUTF8 FileDescription;
+ CUTF8 FileName;
+ CANSI FileMimeType;
+ QWORD FileDataPos, FileDataLen; // BYTE* FileData
+ CUInt FileUID;
+
+ AttachedFile() {FileDataPos = FileDataLen = 0;}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Attachment
+ {
+ public:
+ CNode<AttachedFile> AttachedFiles;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ChapterDisplay
+ {
+ public:
+ CUTF8 ChapString;
+ CANSI ChapLanguage;
+ CANSI ChapCountry;
+
+ ChapterDisplay() {ChapLanguage.CStringA::operator = ("eng");}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ChapterAtom
+ {
+ public:
+ CUInt ChapterUID;
+ CUInt ChapterTimeStart, ChapterTimeEnd, ChapterFlagHidden, ChapterFlagEnabled;
// CNode<CUInt> ChapterTracks; // TODO
- CNode<ChapterDisplay> ChapterDisplays;
- CNode<ChapterAtom> ChapterAtoms;
-
- ChapterAtom()
- {
- ChapterUID.Set(rand());
- ChapterFlagHidden.Set(0);
- ChapterFlagEnabled.Set(1);
- }
- HRESULT Parse(CMatroskaNode* pMN);
- ChapterAtom* FindChapterAtom(UINT64 id);
-};
-
-class EditionEntry : public ChapterAtom
-{
-public:
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Chapter
-{
-public:
- CNode<EditionEntry> EditionEntries;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class Segment
-{
-public:
- QWORD pos, len;
- Info SegmentInfo;
- CNode<Seek> MetaSeekInfo;
- CNode<Cluster> Clusters;
- CNode<Track> Tracks;
- CNode<Cue> Cues;
- CNode<Attachment> Attachments;
- CNode<Chapter> Chapters;
- // TODO: Chapters
- // TODO: Tags
-
- HRESULT Parse(CMatroskaNode* pMN);
- HRESULT ParseMinimal(CMatroskaNode* pMN);
-
- UINT64 GetMasterTrack();
-
- REFERENCE_TIME GetRefTime(INT64 t) const
- {
- return t * (REFERENCE_TIME)(SegmentInfo.TimeCodeScale) / 100;
- }
- ChapterAtom* FindChapterAtom(UINT64 id, int nEditionEntry = 0);
-};
-
-class CMatroskaFile : public CBaseSplitterFile
-{
-public:
- CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- virtual ~CMatroskaFile() {}
-
- HRESULT Init();
-
- //using CBaseSplitterFile::Read;
- template <class T> HRESULT Read(T& var);
-
- EBML m_ebml;
- Segment m_segment;
- REFERENCE_TIME m_rtOffset;
-
- HRESULT Parse(CMatroskaNode* pMN);
-};
-
-class CMatroskaNode
-{
- CMatroskaNode* m_pParent;
- CMatroskaFile* m_pMF;
-
- bool Resync();
-
-public:
- CID m_id;
- CLength m_len;
- QWORD m_filepos, m_start;
-
- HRESULT Parse();
-
-public:
- CMatroskaNode(CMatroskaFile* pMF); // creates the root
- CMatroskaNode(CMatroskaNode* pParent);
-
- CMatroskaNode* Parent()
- {
- return m_pParent;
- }
- CAutoPtr<CMatroskaNode> Child(DWORD id = 0, bool fSearch = true);
- bool Next(bool fSame = false);
- bool Find(DWORD id, bool fSearch = true);
-
- QWORD FindPos(DWORD id, QWORD start = 0);
-
- void SeekTo(QWORD pos);
- QWORD GetPos(), GetLength();
- template <class T> HRESULT Read(T& var);
- HRESULT Read(BYTE* pData, QWORD len);
-
- CAutoPtr<CMatroskaNode> Copy();
-
- CAutoPtr<CMatroskaNode> GetFirstBlock();
- bool NextBlock();
-
- bool IsRandomAccess()
- {
- return m_pMF->IsRandomAccess();
- }
-};
+ CNode<ChapterDisplay> ChapterDisplays;
+ CNode<ChapterAtom> ChapterAtoms;
+
+ ChapterAtom() {ChapterUID.Set(rand());ChapterFlagHidden.Set(0);ChapterFlagEnabled.Set(1);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ ChapterAtom* FindChapterAtom(UINT64 id);
+ };
+
+ class EditionEntry : public ChapterAtom
+ {
+ public:
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Chapter
+ {
+ public:
+ CNode<EditionEntry> EditionEntries;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Segment
+ {
+ public:
+ QWORD pos, len;
+ Info SegmentInfo;
+ CNode<Seek> MetaSeekInfo;
+ CNode<Cluster> Clusters;
+ CNode<Track> Tracks;
+ CNode<Cue> Cues;
+ CNode<Attachment> Attachments;
+ CNode<Chapter> Chapters;
+ // TODO: Chapters
+ // TODO: Tags
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ HRESULT ParseMinimal(CMatroskaNode* pMN);
+
+ UINT64 GetMasterTrack();
+
+ REFERENCE_TIME GetRefTime(INT64 t) const {return t*(REFERENCE_TIME)(SegmentInfo.TimeCodeScale)/100;}
+ ChapterAtom* FindChapterAtom(UINT64 id, int nEditionEntry = 0);
+ };
+
+ class CMatroskaFile : public CBaseSplitterFile
+ {
+ public:
+ CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ virtual ~CMatroskaFile() {}
+
+ HRESULT Init();
+
+ //using CBaseSplitterFile::Read;
+ template <class T> HRESULT Read(T& var);
+
+ EBML m_ebml;
+ Segment m_segment;
+ REFERENCE_TIME m_rtOffset;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CMatroskaNode
+ {
+ CMatroskaNode* m_pParent;
+ CMatroskaFile* m_pMF;
+
+ bool Resync();
+
+ public:
+ CID m_id;
+ CLength m_len;
+ QWORD m_filepos, m_start;
+
+ HRESULT Parse();
+
+ public:
+ CMatroskaNode(CMatroskaFile* pMF); // creates the root
+ CMatroskaNode(CMatroskaNode* pParent);
+
+ CMatroskaNode* Parent() {return m_pParent;}
+ CAutoPtr<CMatroskaNode> Child(DWORD id = 0, bool fSearch = true);
+ bool Next(bool fSame = false);
+ bool Find(DWORD id, bool fSearch = true);
+
+ QWORD FindPos(DWORD id, QWORD start = 0);
+
+ void SeekTo(QWORD pos);
+ QWORD GetPos(), GetLength();
+ template <class T> HRESULT Read(T& var);
+ HRESULT Read(BYTE* pData, QWORD len);
+
+ CAutoPtr<CMatroskaNode> Copy();
+
+ CAutoPtr<CMatroskaNode> GetFirstBlock();
+ bool NextBlock();
+
+ bool IsRandomAccess() {return m_pMF->IsRandomAccess();}
+ };
}
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
index e07e8121c..3922eda99 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
+++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -32,9 +32,9 @@ using namespace MatroskaReader;
#ifdef REGISTER_FILTER
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
-{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -45,34 +45,34 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMatroskaSplitterFilter), L"MPC - Matroska Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMatroskaSourceFilter), L"MPC - Matroska Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMatroskaSplitterFilter), L"MPC - Matroska Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMatroskaSourceFilter), L"MPC - Matroska Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMatroskaSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMatroskaSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- RegisterSourceFilter(
- __uuidof(CMatroskaSourceFilter),
- MEDIASUBTYPE_Matroska,
- _T("0,4,,1A45DFA3"),
- _T(".mkv"), _T(".mka"), _T(".mks"), NULL);
+ RegisterSourceFilter(
+ __uuidof(CMatroskaSourceFilter),
+ MEDIASUBTYPE_Matroska,
+ _T("0,4,,1A45DFA3"),
+ _T(".mkv"), _T(".mka"), _T(".mks"), NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_Matroska);
+ UnRegisterSourceFilter(MEDIASUBTYPE_Matroska);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -86,7 +86,7 @@ CFilterApp theApp;
//
CMatroskaSplitterFilter::CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CMatroskaSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CMatroskaSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
@@ -96,1023 +96,1001 @@ CMatroskaSplitterFilter::~CMatroskaSplitterFilter()
STDMETHODIMP CMatroskaSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- QI(ITrackInfo)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(ITrackInfo)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
#include <vector>
HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
- m_pTrackEntryMap.RemoveAll();
- m_pOrderedTrackArray.RemoveAll();
-
- CAtlArray<CMatroskaSplitterOutputPin*> pinOut;
- CAtlArray<TrackEntry*> pinOutTE;
-
- m_pFile.Attach(DNew CMatroskaFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- int iVideo = 1, iAudio = 1, iSubtitle = 1;
-
- POSITION pos = m_pFile->m_segment.Tracks.GetHeadPosition();
- while(pos)
- {
- Track* pT = m_pFile->m_segment.Tracks.GetNext(pos);
-
- POSITION pos2 = pT->TrackEntries.GetHeadPosition();
- while(pos2)
- {
- TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
-
- bool isSub = false;
-
- if(!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData))
- continue;
-
- CStringA CodecID = pTE->CodecID.ToString();
-
- CStringW Name;
- Name.Format(L"Output %I64d", (UINT64)pTE->TrackNumber);
-
- CMediaType mt;
- CAtlArray<CMediaType> mts;
-
- mt.SetSampleSize(1);
-
- if(pTE->TrackType == TrackEntry::TypeVideo)
- {
- Name.Format(L"Video %d", iVideo++);
-
- mt.majortype = MEDIATYPE_Video;
-
- if(CodecID == "V_MS/VFW/FOURCC")
- {
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount() - sizeof(BITMAPINFOHEADER));
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(&pvih->bmiHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- mt.subtype = FOURCCMap(pvih->bmiHeader.biCompression);
- switch(pvih->bmiHeader.biCompression)
- {
- case BI_RGB:
- case BI_BITFIELDS:
- mt.subtype =
- pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
- pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
- pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
- pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
- pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
- pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
- MEDIASUBTYPE_NULL;
- break;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pTrackEntryMap.RemoveAll();
+ m_pOrderedTrackArray.RemoveAll();
+
+ CAtlArray<CMatroskaSplitterOutputPin*> pinOut;
+ CAtlArray<TrackEntry*> pinOutTE;
+
+ m_pFile.Attach(DNew CMatroskaFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ int iVideo = 1, iAudio = 1, iSubtitle = 1;
+
+ POSITION pos = m_pFile->m_segment.Tracks.GetHeadPosition();
+ while(pos)
+ {
+ Track* pT = m_pFile->m_segment.Tracks.GetNext(pos);
+
+ POSITION pos2 = pT->TrackEntries.GetHeadPosition();
+ while(pos2)
+ {
+ TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
+
+ bool isSub = false;
+
+ if(!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData))
+ continue;
+
+ CStringA CodecID = pTE->CodecID.ToString();
+
+ CStringW Name;
+ Name.Format(L"Output %I64d", (UINT64)pTE->TrackNumber);
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ mt.SetSampleSize(1);
+
+ if(pTE->TrackType == TrackEntry::TypeVideo)
+ {
+ Name.Format(L"Video %d", iVideo++);
+
+ mt.majortype = MEDIATYPE_Video;
+
+ if(CodecID == "V_MS/VFW/FOURCC")
+ {
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount() - sizeof(BITMAPINFOHEADER));
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(&pvih->bmiHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ mt.subtype = FOURCCMap(pvih->bmiHeader.biCompression);
+ switch(pvih->bmiHeader.biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
// case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
- }
- mts.Add(mt);
- }
- else if(CodecID == "V_UNCOMPRESSED")
- {
- }
- else if(CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6)
- {
- BYTE sps = pTE->CodecPrivate[5] & 0x1f;
-
- std::vector<BYTE> avcC;
- for(int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++)
- avcC.push_back(pTE->CodecPrivate[i]);
-
- std::vector<BYTE> sh;
-
- unsigned jj = 6;
-
- while(sps--)
- {
- if(jj + 2 > avcC.size())
- goto avcfail;
- unsigned spslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
- if(jj + 2 + spslen > avcC.size())
- goto avcfail;
- unsigned cur = sh.size();
- sh.resize(cur + spslen + 2, 0);
- std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + spslen, sh.begin() + cur);
- jj += 2 + spslen;
- }
-
- if(jj + 1 > avcC.size())
- continue;
-
- unsigned pps = avcC[jj++];
-
- while(pps--)
- {
- if(jj + 2 > avcC.size())
- goto avcfail;
- unsigned ppslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
- if(jj + 2 + ppslen > avcC.size())
- goto avcfail;
- unsigned cur = sh.size();
- sh.resize(cur + ppslen + 2, 0);
- std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + ppslen, sh.begin() + cur);
- jj += 2 + ppslen;
- }
-
- goto avcsuccess;
+ }
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_UNCOMPRESSED")
+ {
+ }
+ else if(CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6)
+ {
+ BYTE sps = pTE->CodecPrivate[5] & 0x1f;
+
+ std::vector<BYTE> avcC;
+ for(int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++)
+ avcC.push_back(pTE->CodecPrivate[i]);
+
+ std::vector<BYTE> sh;
+
+ unsigned jj = 6;
+
+ while (sps--) {
+ if (jj + 2 > avcC.size())
+ goto avcfail;
+ unsigned spslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
+ if (jj + 2 + spslen > avcC.size())
+ goto avcfail;
+ unsigned cur = sh.size();
+ sh.resize(cur + spslen + 2, 0);
+ std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + spslen,sh.begin() + cur);
+ jj += 2 + spslen;
+ }
+
+ if (jj + 1 > avcC.size())
+ continue;
+
+ unsigned pps = avcC[jj++];
+
+ while (pps--) {
+ if (jj + 2 > avcC.size())
+ goto avcfail;
+ unsigned ppslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
+ if (jj + 2 + ppslen > avcC.size())
+ goto avcfail;
+ unsigned cur = sh.size();
+ sh.resize(cur + ppslen + 2, 0);
+ std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + ppslen, sh.begin() + cur);
+ jj += 2 + ppslen;
+ }
+
+ goto avcsuccess;
avcfail:
- continue;
+ continue;
avcsuccess:
- CAtlArray<BYTE> data;
- data.SetCount(sh.size());
- std::copy(sh.begin(), sh.end(), data.GetData());
-
- mt.subtype = FOURCCMap('1CVA');
- mt.formattype = FORMAT_MPEG2Video;
- MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + data.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
- pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- pm2vi->hdr.bmiHeader.biCompression = '1CVA';
- pm2vi->hdr.bmiHeader.biPlanes = 1;
- pm2vi->hdr.bmiHeader.biBitCount = 24;
- pm2vi->dwProfile = pTE->CodecPrivate[1];
- pm2vi->dwLevel = pTE->CodecPrivate[3];
- pm2vi->dwFlags = (pTE->CodecPrivate[4] & 3) + 1;
- BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
- memcpy(pSequenceHeader, data.GetData(), data.GetCount());
- pm2vi->cbSequenceHeader = data.GetCount();
- mts.Add(mt);
- }
- else if(CodecID.Find("V_MPEG4/") == 0)
- {
- mt.subtype = FOURCCMap('V4PM');
- mt.formattype = FORMAT_MPEG2Video;
- MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
- pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- pm2vi->hdr.bmiHeader.biCompression = 'V4PM';
- pm2vi->hdr.bmiHeader.biPlanes = 1;
- pm2vi->hdr.bmiHeader.biBitCount = 24;
- BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
- memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- pm2vi->cbSequenceHeader = pTE->CodecPrivate.GetCount();
- mts.Add(mt);
- }
- else if(CodecID.Find("V_REAL/RV") == 0)
- {
- mt.subtype = FOURCCMap('00VR' + ((CodecID[9] - 0x30) << 16));
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
- pvih->bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- pvih->bmiHeader.biCompression = mt.subtype.Data1;
- mts.Add(mt);
- }
- else if(CodecID == "V_DIRAC")
- {
- mt.subtype = MEDIASUBTYPE_DiracVideo;
- mt.formattype = FORMAT_DiracVideoInfo;
- DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- dvih->hdr.bmiHeader.biSize = sizeof(dvih->hdr.bmiHeader);
- dvih->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
- dvih->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
- dvih->hdr.dwPictAspectRatioX = dvih->hdr.bmiHeader.biWidth;
- dvih->hdr.dwPictAspectRatioY = dvih->hdr.bmiHeader.biHeight;
-
- BYTE* pSequenceHeader = (BYTE*)dvih->dwSequenceHeader;
- memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- dvih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
-
- mts.Add(mt);
- }
- else if(CodecID == "V_MPEG2")
- {
- BYTE* seqhdr = pTE->CodecPrivate.GetData();
- DWORD len = pTE->CodecPrivate.GetCount();
- int w = pTE->v.PixelWidth;
- int h = pTE->v.PixelHeight;
-
- if(MakeMPEG2MediaType(mt, seqhdr, len, w, h))
- mts.Add(mt);
- }
- else if(CodecID == "V_THEORA")
- {
- BYTE* thdr = pTE->CodecPrivate.GetData() + 3;
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap('OEHT');
- mt.formattype = FORMAT_MPEG2_VIDEO;
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(sizeof(MPEG2VIDEOINFO) + pTE->CodecPrivate.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biWidth = *(WORD*)&thdr[10] >> 4;
- vih->hdr.bmiHeader.biHeight = *(WORD*)&thdr[12] >> 4;
- vih->hdr.bmiHeader.biCompression = 'OEHT';
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- int nFpsNum = (thdr[22] << 24) | (thdr[23] << 16) | (thdr[24] << 8) | thdr[25];
- int nFpsDenum = (thdr[26] << 24) | (thdr[27] << 16) | (thdr[28] << 8) | thdr[29];
- if(nFpsNum) vih->hdr.AvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * nFpsDenum / nFpsNum);
- vih->hdr.dwPictAspectRatioX = (thdr[14] << 16) | (thdr[15] << 8) | thdr[16];
- vih->hdr.dwPictAspectRatioY = (thdr[17] << 16) | (thdr[18] << 8) | thdr[19];
- mt.bFixedSizeSamples = 0;
-
- vih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
- memcpy(&vih->dwSequenceHeader, pTE->CodecPrivate.GetData(), vih->cbSequenceHeader);
-
- mts.Add(mt);
- }
- /*
- else if(CodecID == "V_DSHOW/MPEG1VIDEO") // V_MPEG1
- {
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = MEDIASUBTYPE_MPEG1Payload;
- mt.formattype = FORMAT_MPEGVideo;
- MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
- memcpy(pm1vi, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- mt.SetSampleSize(pm1vi->hdr.bmiHeader.biWidth*pm1vi->hdr.bmiHeader.biHeight*4);
- mts.Add(mt);
- }
- */
- REFERENCE_TIME AvgTimePerFrame = 0;
+ CAtlArray<BYTE> data;
+ data.SetCount(sh.size());
+ std::copy(sh.begin(), sh.end(), data.GetData());
+
+ mt.subtype = FOURCCMap('1CVA');
+ mt.formattype = FORMAT_MPEG2Video;
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + data.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
+ pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ pm2vi->hdr.bmiHeader.biCompression = '1CVA';
+ pm2vi->hdr.bmiHeader.biPlanes = 1;
+ pm2vi->hdr.bmiHeader.biBitCount = 24;
+ pm2vi->dwProfile = pTE->CodecPrivate[1];
+ pm2vi->dwLevel = pTE->CodecPrivate[3];
+ pm2vi->dwFlags = (pTE->CodecPrivate[4] & 3) + 1;
+ BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
+ memcpy(pSequenceHeader, data.GetData(), data.GetCount());
+ pm2vi->cbSequenceHeader = data.GetCount();
+ mts.Add(mt);
+ }
+ else if(CodecID.Find("V_MPEG4/") == 0)
+ {
+ mt.subtype = FOURCCMap('V4PM');
+ mt.formattype = FORMAT_MPEG2Video;
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
+ pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ pm2vi->hdr.bmiHeader.biCompression = 'V4PM';
+ pm2vi->hdr.bmiHeader.biPlanes = 1;
+ pm2vi->hdr.bmiHeader.biBitCount = 24;
+ BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
+ memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ pm2vi->cbSequenceHeader = pTE->CodecPrivate.GetCount();
+ mts.Add(mt);
+ }
+ else if(CodecID.Find("V_REAL/RV") == 0)
+ {
+ mt.subtype = FOURCCMap('00VR' + ((CodecID[9]-0x30)<<16));
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ pvih->bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ pvih->bmiHeader.biCompression = mt.subtype.Data1;
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_DIRAC")
+ {
+ mt.subtype = MEDIASUBTYPE_DiracVideo;
+ mt.formattype = FORMAT_DiracVideoInfo;
+ DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ dvih->hdr.bmiHeader.biSize = sizeof(dvih->hdr.bmiHeader);
+ dvih->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ dvih->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ dvih->hdr.dwPictAspectRatioX = dvih->hdr.bmiHeader.biWidth;
+ dvih->hdr.dwPictAspectRatioY = dvih->hdr.bmiHeader.biHeight;
+
+ BYTE* pSequenceHeader = (BYTE*)dvih->dwSequenceHeader;
+ memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ dvih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
+
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_MPEG2")
+ {
+ BYTE* seqhdr = pTE->CodecPrivate.GetData();
+ DWORD len = pTE->CodecPrivate.GetCount();
+ int w = pTE->v.PixelWidth;
+ int h = pTE->v.PixelHeight;
+
+ if(MakeMPEG2MediaType(mt, seqhdr, len, w, h))
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_THEORA")
+ {
+ BYTE* thdr = pTE->CodecPrivate.GetData() + 3;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap('OEHT');
+ mt.formattype = FORMAT_MPEG2_VIDEO;
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(sizeof(MPEG2VIDEOINFO) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = *(WORD*)&thdr[10] >> 4;
+ vih->hdr.bmiHeader.biHeight = *(WORD*)&thdr[12] >> 4;
+ vih->hdr.bmiHeader.biCompression = 'OEHT';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ int nFpsNum = (thdr[22]<<24)|(thdr[23]<<16)|(thdr[24]<<8)|thdr[25];
+ int nFpsDenum = (thdr[26]<<24)|(thdr[27]<<16)|(thdr[28]<<8)|thdr[29];
+ if(nFpsNum) vih->hdr.AvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * nFpsDenum / nFpsNum);
+ vih->hdr.dwPictAspectRatioX = (thdr[14]<<16)|(thdr[15]<<8)|thdr[16];
+ vih->hdr.dwPictAspectRatioY = (thdr[17]<<16)|(thdr[18]<<8)|thdr[19];
+ mt.bFixedSizeSamples = 0;
+
+ vih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
+ memcpy (&vih->dwSequenceHeader, pTE->CodecPrivate.GetData(), vih->cbSequenceHeader);
+
+ mts.Add(mt);
+ }
+/*
+ else if(CodecID == "V_DSHOW/MPEG1VIDEO") // V_MPEG1
+ {
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_MPEG1Payload;
+ mt.formattype = FORMAT_MPEGVideo;
+ MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
+ memcpy(pm1vi, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ mt.SetSampleSize(pm1vi->hdr.bmiHeader.biWidth*pm1vi->hdr.bmiHeader.biHeight*4);
+ mts.Add(mt);
+ }
+*/
+ REFERENCE_TIME AvgTimePerFrame = 0;
if(pTE->v.FramePerSec > 0)
- AvgTimePerFrame = (REFERENCE_TIME)(10000000i64 / pTE->v.FramePerSec);
- else if(pTE->DefaultDuration > 0)
- AvgTimePerFrame = (REFERENCE_TIME)pTE->DefaultDuration / 100;
-
- if(AvgTimePerFrame)
- {
- for(int i = 0; i < mts.GetCount(); i++)
- {
- if(mts[i].formattype == FORMAT_VideoInfo
- || mts[i].formattype == FORMAT_VideoInfo2
- || mts[i].formattype == FORMAT_MPEG2Video)
- {
- ((VIDEOINFOHEADER*)mts[i].Format())->AvgTimePerFrame = AvgTimePerFrame;
- }
- }
- }
-
- if(pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0)
- {
- for(int i = 0; i < mts.GetCount(); i++)
- {
- if(mts[i].formattype == FORMAT_VideoInfo)
- {
- DWORD vih1 = FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
- DWORD vih2 = FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader);
- DWORD bmi = mts[i].FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
- mt.formattype = FORMAT_VideoInfo2;
- mt.AllocFormatBuffer(vih2 + bmi);
- memcpy(mt.Format(), mts[i].Format(), vih1);
- memset(mt.Format() + vih1, 0, vih2 - vih1);
- memcpy(mt.Format() + vih2, mts[i].Format() + vih1, bmi);
- ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
- ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
- mts.InsertAt(i++, mt);
- }
- else if(mts[i].formattype == FORMAT_MPEG2Video)
- {
- ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
- ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
- }
- }
- }
- }
- else if(pTE->TrackType == TrackEntry::TypeAudio)
- {
- Name.Format(L"Audio %d", iAudio++);
-
- mt.majortype = MEDIATYPE_Audio;
- mt.formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, mt.FormatLength());
- wfe->nChannels = (WORD)pTE->a.Channels;
- wfe->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- wfe->wBitsPerSample = (WORD)pTE->a.BitDepth;
- wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
- wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
- mt.SetSampleSize(256000);
-
- static CAtlMap<CStringA, int, CStringElementTraits<CStringA> > id2ft;
-
- if(id2ft.IsEmpty())
- {
- id2ft["A_MPEG/L3"] = WAVE_FORMAT_MP3;
- id2ft["A_MPEG/L2"] = WAVE_FORMAT_MPEG;
- id2ft["A_AC3"] = WAVE_FORMAT_DOLBY_AC3;
- id2ft["A_DTS"] = WAVE_FORMAT_DVD_DTS;
- id2ft["A_EAC3"] = WAVE_FORMAT_DOLBY_AC3;
- id2ft["A_PCM/INT/LIT"] = WAVE_FORMAT_PCM;
- id2ft["A_PCM/FLOAT/IEEE"] = WAVE_FORMAT_IEEE_FLOAT;
- id2ft["A_AAC"] = -WAVE_FORMAT_AAC;
- id2ft["A_FLAC"] = -WAVE_FORMAT_FLAC;
- id2ft["A_WAVPACK4"] = -WAVE_FORMAT_WAVPACK4;
- id2ft["A_TTA1"] = WAVE_FORMAT_TTA1;
- id2ft["A_TRUEHD"] = WAVE_FORMAT_DOLBY_AC3;
- id2ft["A_MLP"] = WAVE_FORMAT_DOLBY_AC3;
- }
-
- int wFormatTag;
- if(id2ft.Lookup(CodecID, wFormatTag))
- {
- if(wFormatTag < 0)
- {
- wFormatTag = -wFormatTag;
- wfe->cbSize = pTE->CodecPrivate.GetCount();
- wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
- memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- }
-
- mt.subtype = FOURCCMap(wfe->wFormatTag = wFormatTag);
- mts.Add(mt);
-
- if(wFormatTag == WAVE_FORMAT_FLAC)
- {
- mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
- mts.InsertAt(0, mt);
- }
- }
- else if(CodecID == "A_VORBIS")
- {
- BYTE* p = pTE->CodecPrivate.GetData();
- CAtlArray<int> sizes;
- for(BYTE n = *p++; n > 0; n--)
- {
- int size = 0;
- do
- {
- size += *p;
- }
- while(*p++ == 0xff);
- sizes.Add(size);
- }
-
- int totalsize = 0;
- for(int i = 0; i < sizes.GetCount(); i++)
- totalsize += sizes[i];
-
- sizes.Add(pTE->CodecPrivate.GetCount() - (p - pTE->CodecPrivate.GetData()) - totalsize);
- totalsize += sizes[sizes.GetCount()-1];
-
- if(sizes.GetCount() == 3)
- {
- mt.subtype = MEDIASUBTYPE_Vorbis2;
- mt.formattype = FORMAT_VorbisFormat2;
- VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + totalsize);
- memset(pvf2, 0, mt.FormatLength());
- pvf2->Channels = (WORD)pTE->a.Channels;
- pvf2->SamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- pvf2->BitsPerSample = (DWORD)pTE->a.BitDepth;
- BYTE* p2 = mt.Format() + sizeof(VORBISFORMAT2);
- for(int i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++)
- memcpy(p2, p, pvf2->HeaderSize[i] = sizes[i]);
-
- mts.Add(mt);
- }
-
- mt.subtype = MEDIASUBTYPE_Vorbis;
- mt.formattype = FORMAT_VorbisFormat;
- VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
- memset(vf, 0, mt.FormatLength());
- vf->nChannels = (WORD)pTE->a.Channels;
- vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
- vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = -1;
- mts.Add(mt);
- }
- else if(CodecID == "A_MS/ACM")
- {
- wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
- memcpy(wfe, (WAVEFORMATEX*)pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- mt.subtype = FOURCCMap(wfe->wFormatTag);
- mts.Add(mt);
- }
- else if(CodecID.Find("A_AAC/") == 0)
- {
- mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
- wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
- wfe->cbSize = 2;
-
- int profile;
-
- if(CodecID.Find("/MAIN") > 0) profile = 0;
- else if(CodecID.Find("/SBR") > 0) profile = -1;
- else if(CodecID.Find("/LC") > 0) profile = 1;
- else if(CodecID.Find("/SSR") > 0) profile = 2;
- else if(CodecID.Find("/LTP") > 0) profile = 3;
- else continue;
-
- WORD cbSize = MakeAACInitData((BYTE*)(wfe + 1), profile, wfe->nSamplesPerSec, pTE->a.Channels);
-
- mts.Add(mt);
-
- if(profile < 0)
- {
- wfe->cbSize = cbSize;
- wfe->nSamplesPerSec *= 2;
- wfe->nAvgBytesPerSec *= 2;
-
- mts.InsertAt(0, mt);
- }
- }
- else if(CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11)
- {
- mt.subtype = FOURCCMap((DWORD)CodecID[7] | ((DWORD)CodecID[8] << 8) | ((DWORD)CodecID[9] << 16) | ((DWORD)CodecID[10] << 24));
- mt.bTemporalCompression = TRUE;
- wfe->cbSize = pTE->CodecPrivate.GetCount();
- wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
- memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
- wfe->cbSize = 0; // IMPORTANT: this is screwed, but cbSize has to be 0 and the extra data from codec priv must be after WAVEFORMATEX
- mts.Add(mt);
- }
- }
- else if(pTE->TrackType == TrackEntry::TypeSubtitle)
- {
- if(iSubtitle == 1) InstallFonts();
-
- Name.Format(L"Subtitle %d", iSubtitle++);
-
- mt.SetSampleSize(1);
-
- if(CodecID == "S_TEXT/ASCII")
- {
- mt.majortype = MEDIATYPE_Text;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mts.Add(mt);
- isSub = true;
- }
- else
- {
- mt.majortype = MEDIATYPE_Subtitle;
- mt.formattype = FORMAT_SubtitleInfo;
- SUBTITLEINFO* psi = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + pTE->CodecPrivate.GetCount());
- memset(psi, 0, mt.FormatLength());
- strncpy(psi->IsoLang, pTE->Language, countof(psi->IsoLang) - 1);
- wcsncpy(psi->TrackName, pTE->Name, countof(psi->TrackName) - 1);
- memcpy(mt.pbFormat + (psi->dwOffset = sizeof(SUBTITLEINFO)), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
-
- mt.subtype =
- CodecID == "S_TEXT/UTF8" ? MEDIASUBTYPE_UTF8 :
- CodecID == "S_TEXT/SSA" || CodecID == "S_SSA" ? MEDIASUBTYPE_SSA :
- CodecID == "S_TEXT/ASS" || CodecID == "S_ASS" ? MEDIASUBTYPE_ASS :
- CodecID == "S_TEXT/SSF" || CodecID == "S_SSF" ? MEDIASUBTYPE_SSF :
- CodecID == "S_TEXT/USF" || CodecID == "S_USF" ? MEDIASUBTYPE_USF :
- CodecID == "S_VOBSUB" ? MEDIASUBTYPE_VOBSUB :
- MEDIASUBTYPE_NULL;
-
- if(mt.subtype != MEDIASUBTYPE_NULL)
- {
- mts.Add(mt);
- isSub = true;
- }
- }
- }
-
- if(mts.IsEmpty())
- {
- TRACE(_T("CMatroskaSourceFilter: Unsupported TrackType %s (%I64d)\n"), CString(CodecID), (UINT64)pTE->TrackType);
- continue;
- }
-
- Name = CStringW(pTE->Language.IsEmpty() ? L"English" : CStringW(ISO6392ToLanguage(pTE->Language)))
- + (pTE->Name.IsEmpty() ? L"" : L", " + pTE->Name)
- + (L" (" + Name + L")");
-
- HRESULT hr;
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration / 100, mts, Name, this, this, &hr));
- if(!pTE->Name.IsEmpty()) pPinOut->SetProperty(L"NAME", pTE->Name);
- if(pTE->Language.GetLength() == 3) pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
-
- if(!isSub)
- {
- pinOut.InsertAt((iVideo + iAudio - 3), DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration / 100, mts, Name, this, this, &hr), 1);
- pinOutTE.InsertAt((iVideo + iAudio - 3), pTE, 1);
- }
- else
- {
- pinOut.Add(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration / 100, mts, Name, this, this, &hr));
- pinOutTE.Add(pTE);
- }
-
- }
- }
-
- for(int i = 0; i < pinOut.GetCount(); i++)
- {
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- pPinOut.Attach(pinOut[i]);
- TrackEntry* pTE = pinOutTE[i];
-
- AddOutputPin((DWORD)pTE->TrackNumber, pPinOut);
- m_pTrackEntryMap[(DWORD)pTE->TrackNumber] = pTE;
- m_pOrderedTrackArray.Add(pTE);
- }
-
-
- Info& info = m_pFile->m_segment.SegmentInfo;
-
- if(m_pFile->IsRandomAccess())
- {
- m_rtDuration = (REFERENCE_TIME)(info.Duration * info.TimeCodeScale / 100);
- }
-
- m_rtNewStop = m_rtStop = m_rtDuration;
+ AvgTimePerFrame = (REFERENCE_TIME)(10000000i64 / pTE->v.FramePerSec);
+ else if(pTE->DefaultDuration > 0)
+ AvgTimePerFrame = (REFERENCE_TIME)pTE->DefaultDuration / 100;
+
+ if(AvgTimePerFrame)
+ {
+ for(int i = 0; i < mts.GetCount(); i++)
+ {
+ if(mts[i].formattype == FORMAT_VideoInfo
+ || mts[i].formattype == FORMAT_VideoInfo2
+ || mts[i].formattype == FORMAT_MPEG2Video)
+ {
+ ((VIDEOINFOHEADER*)mts[i].Format())->AvgTimePerFrame = AvgTimePerFrame;
+ }
+ }
+ }
+
+ if(pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0)
+ {
+ for(int i = 0; i < mts.GetCount(); i++)
+ {
+ if(mts[i].formattype == FORMAT_VideoInfo)
+ {
+ DWORD vih1 = FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
+ DWORD vih2 = FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader);
+ DWORD bmi = mts[i].FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
+ mt.formattype = FORMAT_VideoInfo2;
+ mt.AllocFormatBuffer(vih2 + bmi);
+ memcpy(mt.Format(), mts[i].Format(), vih1);
+ memset(mt.Format() + vih1, 0, vih2 - vih1);
+ memcpy(mt.Format() + vih2, mts[i].Format() + vih1, bmi);
+ ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
+ ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
+ mts.InsertAt(i++, mt);
+ }
+ else if(mts[i].formattype == FORMAT_MPEG2Video)
+ {
+ ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
+ ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
+ }
+ }
+ }
+ }
+ else if(pTE->TrackType == TrackEntry::TypeAudio)
+ {
+ Name.Format(L"Audio %d", iAudio++);
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, mt.FormatLength());
+ wfe->nChannels = (WORD)pTE->a.Channels;
+ wfe->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
+ wfe->wBitsPerSample = (WORD)pTE->a.BitDepth;
+ wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
+ mt.SetSampleSize(256000);
+
+ static CAtlMap<CStringA, int, CStringElementTraits<CStringA> > id2ft;
+
+ if(id2ft.IsEmpty())
+ {
+ id2ft["A_MPEG/L3"] = WAVE_FORMAT_MP3;
+ id2ft["A_MPEG/L2"] = WAVE_FORMAT_MPEG;
+ id2ft["A_AC3"] = WAVE_FORMAT_DOLBY_AC3;
+ id2ft["A_DTS"] = WAVE_FORMAT_DVD_DTS;
+ id2ft["A_EAC3"] = WAVE_FORMAT_DOLBY_AC3;
+ id2ft["A_PCM/INT/LIT"] = WAVE_FORMAT_PCM;
+ id2ft["A_PCM/FLOAT/IEEE"] = WAVE_FORMAT_IEEE_FLOAT;
+ id2ft["A_AAC"] = -WAVE_FORMAT_AAC;
+ id2ft["A_FLAC"] = -WAVE_FORMAT_FLAC;
+ id2ft["A_WAVPACK4"] = -WAVE_FORMAT_WAVPACK4;
+ id2ft["A_TTA1"] = WAVE_FORMAT_TTA1;
+ id2ft["A_TRUEHD"] = WAVE_FORMAT_DOLBY_AC3;
+ id2ft["A_MLP"] = WAVE_FORMAT_DOLBY_AC3;
+ }
+
+ int wFormatTag;
+ if(id2ft.Lookup(CodecID, wFormatTag))
+ {
+ if(wFormatTag < 0)
+ {
+ wFormatTag = -wFormatTag;
+ wfe->cbSize = pTE->CodecPrivate.GetCount();
+ wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
+ memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ }
+
+ mt.subtype = FOURCCMap(wfe->wFormatTag = wFormatTag);
+ mts.Add(mt);
+
+ if(wFormatTag == WAVE_FORMAT_FLAC)
+ {
+ mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(CodecID == "A_VORBIS")
+ {
+ BYTE* p = pTE->CodecPrivate.GetData();
+ CAtlArray<int> sizes;
+ for(BYTE n = *p++; n > 0; n--)
+ {
+ int size = 0;
+ do {size += *p;} while(*p++ == 0xff);
+ sizes.Add(size);
+ }
+
+ int totalsize = 0;
+ for(int i = 0; i < sizes.GetCount(); i++)
+ totalsize += sizes[i];
+
+ sizes.Add(pTE->CodecPrivate.GetCount() - (p - pTE->CodecPrivate.GetData()) - totalsize);
+ totalsize += sizes[sizes.GetCount()-1];
+
+ if(sizes.GetCount() == 3)
+ {
+ mt.subtype = MEDIASUBTYPE_Vorbis2;
+ mt.formattype = FORMAT_VorbisFormat2;
+ VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + totalsize);
+ memset(pvf2, 0, mt.FormatLength());
+ pvf2->Channels = (WORD)pTE->a.Channels;
+ pvf2->SamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
+ pvf2->BitsPerSample = (DWORD)pTE->a.BitDepth;
+ BYTE* p2 = mt.Format() + sizeof(VORBISFORMAT2);
+ for(int i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++)
+ memcpy(p2, p, pvf2->HeaderSize[i] = sizes[i]);
+
+ mts.Add(mt);
+ }
+
+ mt.subtype = MEDIASUBTYPE_Vorbis;
+ mt.formattype = FORMAT_VorbisFormat;
+ VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
+ memset(vf, 0, mt.FormatLength());
+ vf->nChannels = (WORD)pTE->a.Channels;
+ vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
+ vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = -1;
+ mts.Add(mt);
+ }
+ else if(CodecID == "A_MS/ACM")
+ {
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
+ memcpy(wfe, (WAVEFORMATEX*)pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ mt.subtype = FOURCCMap(wfe->wFormatTag);
+ mts.Add(mt);
+ }
+ else if(CodecID.Find("A_AAC/") == 0)
+ {
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
+ wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
+ wfe->cbSize = 2;
+
+ int profile;
+
+ if(CodecID.Find("/MAIN") > 0) profile = 0;
+ else if(CodecID.Find("/SBR") > 0) profile = -1;
+ else if(CodecID.Find("/LC") > 0) profile = 1;
+ else if(CodecID.Find("/SSR") > 0) profile = 2;
+ else if(CodecID.Find("/LTP") > 0) profile = 3;
+ else continue;
+
+ WORD cbSize = MakeAACInitData((BYTE*)(wfe + 1), profile, wfe->nSamplesPerSec, pTE->a.Channels);
+
+ mts.Add(mt);
+
+ if(profile < 0)
+ {
+ wfe->cbSize = cbSize;
+ wfe->nSamplesPerSec *= 2;
+ wfe->nAvgBytesPerSec *= 2;
+
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11)
+ {
+ mt.subtype = FOURCCMap((DWORD)CodecID[7]|((DWORD)CodecID[8]<<8)|((DWORD)CodecID[9]<<16)|((DWORD)CodecID[10]<<24));
+ mt.bTemporalCompression = TRUE;
+ wfe->cbSize = pTE->CodecPrivate.GetCount();
+ wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
+ memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ wfe->cbSize = 0; // IMPORTANT: this is screwed, but cbSize has to be 0 and the extra data from codec priv must be after WAVEFORMATEX
+ mts.Add(mt);
+ }
+ }
+ else if(pTE->TrackType == TrackEntry::TypeSubtitle)
+ {
+ if(iSubtitle == 1) InstallFonts();
+
+ Name.Format(L"Subtitle %d", iSubtitle++);
+
+ mt.SetSampleSize(1);
+
+ if(CodecID == "S_TEXT/ASCII")
+ {
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mts.Add(mt);
+ isSub = true;
+ }
+ else
+ {
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.formattype = FORMAT_SubtitleInfo;
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + pTE->CodecPrivate.GetCount());
+ memset(psi, 0, mt.FormatLength());
+ strncpy(psi->IsoLang, pTE->Language, countof(psi->IsoLang)-1);
+ wcsncpy(psi->TrackName, pTE->Name, countof(psi->TrackName)-1);
+ memcpy(mt.pbFormat + (psi->dwOffset = sizeof(SUBTITLEINFO)), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+
+ mt.subtype =
+ CodecID == "S_TEXT/UTF8" ? MEDIASUBTYPE_UTF8 :
+ CodecID == "S_TEXT/SSA" || CodecID == "S_SSA" ? MEDIASUBTYPE_SSA :
+ CodecID == "S_TEXT/ASS" || CodecID == "S_ASS" ? MEDIASUBTYPE_ASS :
+ CodecID == "S_TEXT/SSF" || CodecID == "S_SSF" ? MEDIASUBTYPE_SSF :
+ CodecID == "S_TEXT/USF" || CodecID == "S_USF" ? MEDIASUBTYPE_USF :
+ CodecID == "S_VOBSUB" ? MEDIASUBTYPE_VOBSUB :
+ MEDIASUBTYPE_NULL;
+
+ if(mt.subtype != MEDIASUBTYPE_NULL) {
+ mts.Add(mt);
+ isSub = true;
+ }
+ }
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("CMatroskaSourceFilter: Unsupported TrackType %s (%I64d)\n"), CString(CodecID), (UINT64)pTE->TrackType);
+ continue;
+ }
+
+ Name = CStringW(pTE->Language.IsEmpty() ? L"English" : CStringW(ISO6392ToLanguage(pTE->Language)))
+ + (pTE->Name.IsEmpty() ? L"" : L", " + pTE->Name)
+ + (L" (" + Name + L")");
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
+ if(!pTE->Name.IsEmpty()) pPinOut->SetProperty(L"NAME", pTE->Name);
+ if(pTE->Language.GetLength() == 3) pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
+
+ if (!isSub) {
+ pinOut.InsertAt((iVideo+iAudio-3),DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr),1);
+ pinOutTE.InsertAt((iVideo+iAudio-3),pTE,1);
+ } else {
+ pinOut.Add(DNew CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
+ pinOutTE.Add(pTE);
+ }
+
+ }
+ }
+
+ for(int i = 0; i < pinOut.GetCount(); i++) {
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut;
+ pPinOut.Attach(pinOut[i]);
+ TrackEntry* pTE = pinOutTE[i];
+
+ AddOutputPin((DWORD)pTE->TrackNumber, pPinOut);
+ m_pTrackEntryMap[(DWORD)pTE->TrackNumber] = pTE;
+ m_pOrderedTrackArray.Add(pTE);
+ }
+
+
+ Info& info = m_pFile->m_segment.SegmentInfo;
+
+ if(m_pFile->IsRandomAccess())
+ {
+ m_rtDuration = (REFERENCE_TIME)(info.Duration * info.TimeCodeScale / 100);
+ }
+
+ m_rtNewStop = m_rtStop = m_rtDuration;
#ifdef DEBUG
- /*
- for(int i = 1, j = GetChapterCount(CHAPTER_ROOT_ID); i <= j; i++)
- {
- UINT id = GetChapterId(CHAPTER_ROOT_ID, i);
- struct ChapterElement ce;
- BOOL b = GetChapterInfo(id, &ce);
- BSTR bstr = GetChapterStringInfo(id, "eng", "");
- if(bstr) ::SysFreeString(bstr);
- }
- */
+ /*
+ for(int i = 1, j = GetChapterCount(CHAPTER_ROOT_ID); i <= j; i++)
+ {
+ UINT id = GetChapterId(CHAPTER_ROOT_ID, i);
+ struct ChapterElement ce;
+ BOOL b = GetChapterInfo(id, &ce);
+ BSTR bstr = GetChapterStringInfo(id, "eng", "");
+ if(bstr) ::SysFreeString(bstr);
+ }
+ */
#endif
- SetProperty(L"TITL", info.Title);
- // TODO
+ SetProperty(L"TITL", info.Title);
+ // TODO
- // resources
+ // resources
- {
- POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos)
- {
- Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
+ {
+ POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
+ while(pos)
+ {
+ Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
- POSITION pos = pA->AttachedFiles.GetHeadPosition();
- while(pos)
- {
- AttachedFile* pF = pA->AttachedFiles.GetNext(pos);
+ POSITION pos = pA->AttachedFiles.GetHeadPosition();
+ while(pos)
+ {
+ AttachedFile* pF = pA->AttachedFiles.GetNext(pos);
- CAtlArray<BYTE> pData;
- pData.SetCount(pF->FileDataLen);
- m_pFile->Seek(pF->FileDataPos);
- if(SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount())))
- ResAppend(pF->FileName, pF->FileDescription, CStringW(pF->FileMimeType), pData.GetData(), pData.GetCount());
- }
- }
- }
+ CAtlArray<BYTE> pData;
+ pData.SetCount(pF->FileDataLen);
+ m_pFile->Seek(pF->FileDataPos);
+ if(SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount())))
+ ResAppend(pF->FileName, pF->FileDescription, CStringW(pF->FileMimeType), pData.GetData(), pData.GetCount());
+ }
+ }
+ }
- // chapters
+ // chapters
- if(ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0))
- {
- CStringA str;
- str.ReleaseBufferSetLength(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, str.GetBuffer(3), 3));
- CStringA ChapLanguage = CStringA(ISO6391To6392(str));
- if(ChapLanguage.GetLength() < 3) ChapLanguage = "eng";
+ if(ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0))
+ {
+ CStringA str;
+ str.ReleaseBufferSetLength(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, str.GetBuffer(3), 3));
+ CStringA ChapLanguage = CStringA(ISO6391To6392(str));
+ if(ChapLanguage.GetLength() < 3) ChapLanguage = "eng";
- SetupChapters(ChapLanguage, caroot);
- }
+ SetupChapters(ChapLanguage, caroot);
+ }
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
void CMatroskaSplitterFilter::SetupChapters(LPCSTR lng, ChapterAtom* parent, int level)
{
- CStringW tabs('+', level);
+ CStringW tabs('+', level);
- if(!tabs.IsEmpty()) tabs += ' ';
+ if(!tabs.IsEmpty()) tabs += ' ';
- POSITION pos = parent->ChapterAtoms.GetHeadPosition();
- while(pos)
- {
- // ChapUID zero not allow by Matroska specs
- UINT64 ChapUID = parent->ChapterAtoms.GetNext(pos)->ChapterUID;
- ChapterAtom* ca = (ChapUID == 0) ? NULL : m_pFile->m_segment.FindChapterAtom(ChapUID);
+ POSITION pos = parent->ChapterAtoms.GetHeadPosition();
+ while(pos)
+ {
+ // ChapUID zero not allow by Matroska specs
+ UINT64 ChapUID = parent->ChapterAtoms.GetNext(pos)->ChapterUID;
+ ChapterAtom* ca = (ChapUID == 0) ? NULL : m_pFile->m_segment.FindChapterAtom(ChapUID);
- if(ca)
- {
- CStringW name, first;
+ if(ca)
+ {
+ CStringW name, first;
- POSITION pos = ca->ChapterDisplays.GetHeadPosition();
- while(pos)
- {
- ChapterDisplay* cd = ca->ChapterDisplays.GetNext(pos);
- if(first.IsEmpty()) first = cd->ChapString;
- if(cd->ChapLanguage == lng) name = cd->ChapString;
- }
+ POSITION pos = ca->ChapterDisplays.GetHeadPosition();
+ while(pos)
+ {
+ ChapterDisplay* cd = ca->ChapterDisplays.GetNext(pos);
+ if(first.IsEmpty()) first = cd->ChapString;
+ if(cd->ChapLanguage == lng) name = cd->ChapString;
+ }
- name = tabs + (!name.IsEmpty() ? name : first);
+ name = tabs + (!name.IsEmpty() ? name : first);
- ChapAppend(ca->ChapterTimeStart / 100 - m_pFile->m_rtOffset, name);
+ ChapAppend(ca->ChapterTimeStart / 100 - m_pFile->m_rtOffset, name);
- if(!ca->ChapterAtoms.IsEmpty())
- {
- SetupChapters(lng, ca, level + 1);
- }
- }
- }
+ if(!ca->ChapterAtoms.IsEmpty())
+ {
+ SetupChapters(lng, ca, level+1);
+ }
+ }
+ }
}
void CMatroskaSplitterFilter::InstallFonts()
{
- POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
- while(pos)
- {
- Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
-
- POSITION p2 = pA->AttachedFiles.GetHeadPosition();
- while(p2)
- {
- AttachedFile* pF = pA->AttachedFiles.GetNext(p2);
-
- if(pF->FileMimeType == "application/x-truetype-font")
- {
- // assume this is a font resource
-
- if(BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen])
- {
- m_pFile->Seek(pF->FileDataPos);
-
- if(SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen)))
- m_fontinst.InstallFont(pData, (UINT)pF->FileDataLen);
-
- delete [] pData;
- }
- }
- }
- }
+ POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
+ while(pos)
+ {
+ Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
+
+ POSITION p2 = pA->AttachedFiles.GetHeadPosition();
+ while(p2)
+ {
+ AttachedFile* pF = pA->AttachedFiles.GetNext(p2);
+
+ if(pF->FileMimeType == "application/x-truetype-font")
+ {
+ // assume this is a font resource
+
+ if(BYTE* pData = DNew BYTE[(UINT)pF->FileDataLen])
+ {
+ m_pFile->Seek(pF->FileDataPos);
+
+ if(SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen)))
+ m_fontinst.InstallFont(pData, (UINT)pF->FileDataLen);
+
+ delete [] pData;
+ }
+ }
+ }
+ }
}
void CMatroskaSplitterFilter::SendVorbisHeaderSample()
{
- HRESULT hr;
-
- POSITION pos = m_pTrackEntryMap.GetStartPosition();
- while(pos)
- {
- DWORD TrackNumber = 0;
- TrackEntry* pTE = NULL;
- m_pTrackEntryMap.GetNextAssoc(pos, TrackNumber, pTE);
-
- CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNumber);
-
- if(!(pTE && pPin && pPin->IsConnected()))
- continue;
-
- if(pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
- && pTE->CodecPrivate.GetCount() > 0)
- {
- BYTE* ptr = pTE->CodecPrivate.GetData();
-
- CAtlList<int> sizes;
- long last = 0;
- for(BYTE n = *ptr++; n > 0; n--)
- {
- int size = 0;
- do
- {
- size += *ptr;
- }
- while(*ptr++ == 0xff);
- sizes.AddTail(size);
- last += size;
- }
- sizes.AddTail(pTE->CodecPrivate.GetCount() - (ptr - pTE->CodecPrivate.GetData()) - last);
-
- hr = S_OK;
-
- POSITION pos = sizes.GetHeadPosition();
- while(pos && SUCCEEDED(hr))
- {
- long len = sizes.GetNext(pos);
-
- CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = (DWORD)pTE->TrackNumber;
- p->rtStart = 0;
- p->rtStop = 1;
- p->bSyncPoint = FALSE;
-
- p->SetData(ptr, len);
- ptr += len;
-
- hr = DeliverPacket(p);
- }
-
- if(FAILED(hr))
- TRACE(_T("ERROR: Vorbis initialization failed for stream %I64d\n"), TrackNumber);
- }
- }
+ HRESULT hr;
+
+ POSITION pos = m_pTrackEntryMap.GetStartPosition();
+ while(pos)
+ {
+ DWORD TrackNumber = 0;
+ TrackEntry* pTE = NULL;
+ m_pTrackEntryMap.GetNextAssoc(pos, TrackNumber, pTE);
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNumber);
+
+ if(!(pTE && pPin && pPin->IsConnected()))
+ continue;
+
+ if(pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
+ && pTE->CodecPrivate.GetCount() > 0)
+ {
+ BYTE* ptr = pTE->CodecPrivate.GetData();
+
+ CAtlList<int> sizes;
+ long last = 0;
+ for(BYTE n = *ptr++; n > 0; n--)
+ {
+ int size = 0;
+ do {size += *ptr;} while(*ptr++ == 0xff);
+ sizes.AddTail(size);
+ last += size;
+ }
+ sizes.AddTail(pTE->CodecPrivate.GetCount() - (ptr - pTE->CodecPrivate.GetData()) - last);
+
+ hr = S_OK;
+
+ POSITION pos = sizes.GetHeadPosition();
+ while(pos && SUCCEEDED(hr))
+ {
+ long len = sizes.GetNext(pos);
+
+ CAutoPtr<Packet> p(DNew Packet());
+ p->TrackNumber = (DWORD)pTE->TrackNumber;
+ p->rtStart = 0; p->rtStop = 1;
+ p->bSyncPoint = FALSE;
+
+ p->SetData(ptr, len);
+ ptr += len;
+
+ hr = DeliverPacket(p);
+ }
+
+ if(FAILED(hr))
+ TRACE(_T("ERROR: Vorbis initialization failed for stream %I64d\n"), TrackNumber);
+ }
+ }
}
bool CMatroskaSplitterFilter::DemuxInit()
{
- CMatroskaNode Root(m_pFile);
- if(!m_pFile
- || !(m_pSegment = Root.Child(0x18538067))
- || !(m_pCluster = m_pSegment->Child(0x1F43B675)))
- return(false);
+ CMatroskaNode Root(m_pFile);
+ if(!m_pFile
+ || !(m_pSegment = Root.Child(0x18538067))
+ || !(m_pCluster = m_pSegment->Child(0x1F43B675)))
+ return(false);
- // reindex if needed
+ // reindex if needed
- if(m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0)
- {
- m_nOpenProgress = 0;
- m_pFile->m_segment.SegmentInfo.Duration.Set(0);
+ if(m_pFile->IsRandomAccess() && m_pFile->m_segment.Cues.GetCount() == 0)
+ {
+ m_nOpenProgress = 0;
+ m_pFile->m_segment.SegmentInfo.Duration.Set(0);
- UINT64 TrackNumber = m_pFile->m_segment.GetMasterTrack();
+ UINT64 TrackNumber = m_pFile->m_segment.GetMasterTrack();
- CAutoPtr<Cue> pCue(DNew Cue());
+ CAutoPtr<Cue> pCue(DNew Cue());
- do
- {
- Cluster c;
- c.ParseTimeCode(m_pCluster);
+ do
+ {
+ Cluster c;
+ c.ParseTimeCode(m_pCluster);
- m_pFile->m_segment.SegmentInfo.Duration.Set((float)c.TimeCode - m_pFile->m_rtOffset / 10000);
+ m_pFile->m_segment.SegmentInfo.Duration.Set((float)c.TimeCode - m_pFile->m_rtOffset/10000);
- CAutoPtr<CuePoint> pCuePoint(DNew CuePoint());
- CAutoPtr<CueTrackPosition> pCueTrackPosition(DNew CueTrackPosition());
- pCuePoint->CueTime.Set(c.TimeCode);
- pCueTrackPosition->CueTrack.Set(TrackNumber);
- pCueTrackPosition->CueClusterPosition.Set(m_pCluster->m_filepos - m_pSegment->m_start);
- pCuePoint->CueTrackPositions.AddTail(pCueTrackPosition);
- pCue->CuePoints.AddTail(pCuePoint);
+ CAutoPtr<CuePoint> pCuePoint(DNew CuePoint());
+ CAutoPtr<CueTrackPosition> pCueTrackPosition(DNew CueTrackPosition());
+ pCuePoint->CueTime.Set(c.TimeCode);
+ pCueTrackPosition->CueTrack.Set(TrackNumber);
+ pCueTrackPosition->CueClusterPosition.Set(m_pCluster->m_filepos - m_pSegment->m_start);
+ pCuePoint->CueTrackPositions.AddTail(pCueTrackPosition);
+ pCue->CuePoints.AddTail(pCuePoint);
- m_nOpenProgress = m_pFile->GetPos() * 100 / m_pFile->GetLength();
+ m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
- DWORD cmd;
- if(CheckRequest(&cmd))
- {
- if(cmd == CMD_EXIT) m_fAbort = true;
- else Reply(S_OK);
- }
- }
- while(!m_fAbort && m_pCluster->Next(true));
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
+ while(!m_fAbort && m_pCluster->Next(true));
- m_nOpenProgress = 100;
+ m_nOpenProgress = 100;
- if(!m_fAbort) m_pFile->m_segment.Cues.AddTail(pCue);
+ if(!m_fAbort) m_pFile->m_segment.Cues.AddTail(pCue);
- m_fAbort = false;
- }
+ m_fAbort = false;
+ }
- m_pCluster.Free();
- m_pBlock.Free();
+ m_pCluster.Free();
+ m_pBlock.Free();
- return(true);
+ return(true);
}
void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- m_pCluster = m_pSegment->Child(0x1F43B675);
- m_pBlock.Free();
-
- if(rt > 0)
- {
- rt += m_pFile->m_rtOffset;
-
- MatroskaReader::QWORD lastCueClusterPosition = -1;
-
- Segment& s = m_pFile->m_segment;
-
- UINT64 TrackNumber = s.GetMasterTrack();
-
- POSITION pos1 = s.Cues.GetHeadPosition();
- while(pos1)
- {
- Cue* pCue = s.Cues.GetNext(pos1);
-
- POSITION pos2 = pCue->CuePoints.GetTailPosition();
- while(pos2)
- {
- CuePoint* pCuePoint = pCue->CuePoints.GetPrev(pos2);
-
- if(rt < s.GetRefTime(pCuePoint->CueTime))
- continue;
-
- POSITION pos3 = pCuePoint->CueTrackPositions.GetHeadPosition();
- while(pos3)
- {
- CueTrackPosition* pCueTrackPositions = pCuePoint->CueTrackPositions.GetNext(pos3);
-
- if(TrackNumber != pCueTrackPositions->CueTrack)
- continue;
-
- if(lastCueClusterPosition == pCueTrackPositions->CueClusterPosition)
- continue;
-
- lastCueClusterPosition = pCueTrackPositions->CueClusterPosition;
-
- m_pCluster->SeekTo(m_pSegment->m_start + pCueTrackPositions->CueClusterPosition);
- m_pCluster->Parse();
-
- bool fFoundKeyFrame = false;
- /*
- if(pCueTrackPositions->CueBlockNumber > 0)
- {
- // TODO: CueBlockNumber only tells the block num of the track and not for all mixed in the cluster
- m_nLastBlock = (int)pCueTrackPositions->CueBlockNumber;
- fFoundKeyFrame = true;
- }
- else
- */
- {
- Cluster c;
- c.ParseTimeCode(m_pCluster);
-
- if(CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock())
- {
- bool fPassedCueTime = false;
-
- do
- {
- CBlockGroupNode bgn;
-
- if(pBlock->m_id == 0xA0)
- {
- bgn.Parse(pBlock, true);
- }
- else if(pBlock->m_id == 0xA3)
- {
- CAutoPtr<BlockGroup> bg(DNew BlockGroup());
- bg->Block.Parse(pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
- bgn.AddTail(bg);
- }
-
- POSITION pos4 = bgn.GetHeadPosition();
- while(!fPassedCueTime && pos4)
- {
- BlockGroup* bg = bgn.GetNext(pos4);
-
- if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
- || rt + 5000000i64 < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)) // allow 500ms difference between tracks, just in case intreleaving wasn't that much precise
- {
- fPassedCueTime = true;
- }
- else if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid())
- {
- fFoundKeyFrame = true;
- m_pBlock = pBlock->Copy();
- }
- }
- }
- while(!fPassedCueTime && pBlock->NextBlock());
- }
- }
-
- if(fFoundKeyFrame)
- pos1 = pos2 = pos3 = NULL;
- }
- }
- }
-
- if(!m_pBlock)
- {
- m_pCluster = m_pSegment->Child(0x1F43B675);
- }
- }
+ m_pCluster = m_pSegment->Child(0x1F43B675);
+ m_pBlock.Free();
+
+ if(rt > 0)
+ {
+ rt += m_pFile->m_rtOffset;
+
+ MatroskaReader::QWORD lastCueClusterPosition = -1;
+
+ Segment& s = m_pFile->m_segment;
+
+ UINT64 TrackNumber = s.GetMasterTrack();
+
+ POSITION pos1 = s.Cues.GetHeadPosition();
+ while(pos1)
+ {
+ Cue* pCue = s.Cues.GetNext(pos1);
+
+ POSITION pos2 = pCue->CuePoints.GetTailPosition();
+ while(pos2)
+ {
+ CuePoint* pCuePoint = pCue->CuePoints.GetPrev(pos2);
+
+ if(rt < s.GetRefTime(pCuePoint->CueTime))
+ continue;
+
+ POSITION pos3 = pCuePoint->CueTrackPositions.GetHeadPosition();
+ while(pos3)
+ {
+ CueTrackPosition* pCueTrackPositions = pCuePoint->CueTrackPositions.GetNext(pos3);
+
+ if(TrackNumber != pCueTrackPositions->CueTrack)
+ continue;
+
+ if(lastCueClusterPosition == pCueTrackPositions->CueClusterPosition)
+ continue;
+
+ lastCueClusterPosition = pCueTrackPositions->CueClusterPosition;
+
+ m_pCluster->SeekTo(m_pSegment->m_start + pCueTrackPositions->CueClusterPosition);
+ m_pCluster->Parse();
+
+ bool fFoundKeyFrame = false;
+/*
+ if(pCueTrackPositions->CueBlockNumber > 0)
+ {
+ // TODO: CueBlockNumber only tells the block num of the track and not for all mixed in the cluster
+ m_nLastBlock = (int)pCueTrackPositions->CueBlockNumber;
+ fFoundKeyFrame = true;
+ }
+ else
+*/
+ {
+ Cluster c;
+ c.ParseTimeCode(m_pCluster);
+
+ if(CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock())
+ {
+ bool fPassedCueTime = false;
+
+ do
+ {
+ CBlockGroupNode bgn;
+
+ if(pBlock->m_id == 0xA0)
+ {
+ bgn.Parse(pBlock, true);
+ }
+ else if(pBlock->m_id == 0xA3)
+ {
+ CAutoPtr<BlockGroup> bg(DNew BlockGroup());
+ bg->Block.Parse(pBlock, true);
+ if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
+ bgn.AddTail(bg);
+ }
+
+ POSITION pos4 = bgn.GetHeadPosition();
+ while(!fPassedCueTime && pos4)
+ {
+ BlockGroup* bg = bgn.GetNext(pos4);
+
+ if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
+ || rt + 5000000i64 < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)) // allow 500ms difference between tracks, just in case intreleaving wasn't that much precise
+ {
+ fPassedCueTime = true;
+ }
+ else if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid())
+ {
+ fFoundKeyFrame = true;
+ m_pBlock = pBlock->Copy();
+ }
+ }
+ }
+ while(!fPassedCueTime && pBlock->NextBlock());
+ }
+ }
+
+ if(fFoundKeyFrame)
+ pos1 = pos2 = pos3 = NULL;
+ }
+ }
+ }
+
+ if(!m_pBlock)
+ {
+ m_pCluster = m_pSegment->Child(0x1F43B675);
+ }
+ }
}
bool CMatroskaSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
-
- SendVorbisHeaderSample(); // HACK: init vorbis decoder with the headers
-
- do
- {
- Cluster c;
- c.ParseTimeCode(m_pCluster);
-
- if(!m_pBlock) m_pBlock = m_pCluster->GetFirstBlock();
- if(!m_pBlock) continue;
-
- do
- {
- CBlockGroupNode bgn;
-
- if(m_pBlock->m_id == 0xA0)
- {
- bgn.Parse(m_pBlock, true);
- }
- else if(m_pBlock->m_id == 0xA3)
- {
- CAutoPtr<BlockGroup> bg(DNew BlockGroup());
- bg->Block.Parse(m_pBlock, true);
- if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
- bgn.AddTail(bg);
- }
-
- while(bgn.GetCount() && SUCCEEDED(hr))
- {
- CAutoPtr<MatroskaPacket> p(DNew MatroskaPacket());
- p->bg = bgn.RemoveHead();
-
- p->bSyncPoint = !p->bg->ReferenceBlock.IsValid();
- p->TrackNumber = (DWORD)p->bg->Block.TrackNumber;
-
- TrackEntry* pTE = m_pTrackEntryMap[p->TrackNumber];
- if(!pTE) continue;
-
- p->rtStart = m_pFile->m_segment.GetRefTime((REFERENCE_TIME)c.TimeCode + p->bg->Block.TimeCode);
- p->rtStop = p->rtStart + (p->bg->BlockDuration.IsValid() ? m_pFile->m_segment.GetRefTime(p->bg->BlockDuration) : 1);
-
- // Fix subtitle with duration = 0
- if(pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid())
- {
- p->bg->BlockDuration.Set(1); // just setting it to be valid
- p->rtStop = p->rtStart;
- }
-
- POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos)
- {
- CBinary* pb = p->bg->Block.BlockData.GetNext(pos);
- pTE->Expand(*pb, ContentEncoding::AllFrameContents);
- }
-
- // HACK
- p->rtStart -= m_pFile->m_rtOffset;
- p->rtStop -= m_pFile->m_rtOffset;
-
- hr = DeliverPacket(p);
- }
- }
- while(m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
-
- m_pBlock.Free();
- }
- while(m_pFile->GetPos() < m_pFile->m_segment.pos + m_pFile->m_segment.len
- && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
-
- m_pCluster.Free();
-
- return(true);
+ HRESULT hr = S_OK;
+
+ SendVorbisHeaderSample(); // HACK: init vorbis decoder with the headers
+
+ do
+ {
+ Cluster c;
+ c.ParseTimeCode(m_pCluster);
+
+ if(!m_pBlock) m_pBlock = m_pCluster->GetFirstBlock();
+ if(!m_pBlock) continue;
+
+ do
+ {
+ CBlockGroupNode bgn;
+
+ if(m_pBlock->m_id == 0xA0)
+ {
+ bgn.Parse(m_pBlock, true);
+ }
+ else if(m_pBlock->m_id == 0xA3)
+ {
+ CAutoPtr<BlockGroup> bg(DNew BlockGroup());
+ bg->Block.Parse(m_pBlock, true);
+ if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
+ bgn.AddTail(bg);
+ }
+
+ while(bgn.GetCount() && SUCCEEDED(hr))
+ {
+ CAutoPtr<MatroskaPacket> p(DNew MatroskaPacket());
+ p->bg = bgn.RemoveHead();
+
+ p->bSyncPoint = !p->bg->ReferenceBlock.IsValid();
+ p->TrackNumber = (DWORD)p->bg->Block.TrackNumber;
+
+ TrackEntry* pTE = m_pTrackEntryMap[p->TrackNumber];
+ if(!pTE) continue;
+
+ p->rtStart = m_pFile->m_segment.GetRefTime((REFERENCE_TIME)c.TimeCode + p->bg->Block.TimeCode);
+ p->rtStop = p->rtStart + (p->bg->BlockDuration.IsValid() ? m_pFile->m_segment.GetRefTime(p->bg->BlockDuration) : 1);
+
+ // Fix subtitle with duration = 0
+ if(pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid())
+ {
+ p->bg->BlockDuration.Set(1); // just setting it to be valid
+ p->rtStop = p->rtStart;
+ }
+
+ POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* pb = p->bg->Block.BlockData.GetNext(pos);
+ pTE->Expand(*pb, ContentEncoding::AllFrameContents);
+ }
+
+ // HACK
+ p->rtStart -= m_pFile->m_rtOffset;
+ p->rtStop -= m_pFile->m_rtOffset;
+
+ hr = DeliverPacket(p);
+ }
+ }
+ while(m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
+
+ m_pBlock.Free();
+ }
+ while(m_pFile->GetPos() < m_pFile->m_segment.pos + m_pFile->m_segment.len
+ && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
+
+ m_pCluster.Free();
+
+ return(true);
}
// IKeyFrameInfo
STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) return E_UNEXPECTED;
+ if(!m_pFile) return E_UNEXPECTED;
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- nKFs = 0;
+ nKFs = 0;
- POSITION pos = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos) nKFs += m_pFile->m_segment.Cues.GetNext(pos)->CuePoints.GetCount();
+ POSITION pos = m_pFile->m_segment.Cues.GetHeadPosition();
+ while(pos) nKFs += m_pFile->m_segment.Cues.GetNext(pos)->CuePoints.GetCount();
- return hr;
+ return hr;
}
STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) return E_UNEXPECTED;
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
- UINT nKFsTmp = 0;
+ UINT nKFsTmp = 0;
- POSITION pos1 = m_pFile->m_segment.Cues.GetHeadPosition();
- while(pos1 && nKFsTmp < nKFs)
- {
- Cue* pCue = m_pFile->m_segment.Cues.GetNext(pos1);
+ POSITION pos1 = m_pFile->m_segment.Cues.GetHeadPosition();
+ while(pos1 && nKFsTmp < nKFs)
+ {
+ Cue* pCue = m_pFile->m_segment.Cues.GetNext(pos1);
- POSITION pos2 = pCue->CuePoints.GetHeadPosition();
- while(pos2 && nKFsTmp < nKFs)
- pKFs[nKFsTmp++] = m_pFile->m_segment.GetRefTime(pCue->CuePoints.GetNext(pos2)->CueTime);
- }
+ POSITION pos2 = pCue->CuePoints.GetHeadPosition();
+ while(pos2 && nKFsTmp < nKFs)
+ pKFs[nKFsTmp++] = m_pFile->m_segment.GetRefTime(pCue->CuePoints.GetNext(pos2)->CueTime);
+ }
- nKFs = nKFsTmp;
+ nKFs = nKFsTmp;
- return S_OK;
+ return S_OK;
}
//
@@ -1120,10 +1098,10 @@ STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENC
//
CMatroskaSourceFilter::CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CMatroskaSplitterFilter(pUnk, phr)
+ : CMatroskaSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -1131,12 +1109,12 @@ CMatroskaSourceFilter::CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
CMatroskaSplitterOutputPin::CMatroskaSplitterOutputPin(
- int nMinCache, REFERENCE_TIME rtDefaultDuration,
- CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
- , m_nMinCache(nMinCache), m_rtDefaultDuration(rtDefaultDuration)
+ int nMinCache, REFERENCE_TIME rtDefaultDuration,
+ CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ , m_nMinCache(nMinCache), m_rtDefaultDuration(rtDefaultDuration)
{
- m_nMinCache = 1;//max(m_nMinCache, 1);
+ m_nMinCache = 1;//max(m_nMinCache, 1);
}
CMatroskaSplitterOutputPin::~CMatroskaSplitterOutputPin()
@@ -1145,268 +1123,264 @@ CMatroskaSplitterOutputPin::~CMatroskaSplitterOutputPin()
HRESULT CMatroskaSplitterOutputPin::DeliverEndFlush()
{
- {
- CAutoLock cAutoLock(&m_csQueue);
- m_packets.RemoveAll();
- m_rob.RemoveAll();
- m_tos.RemoveAll();
- }
-
- return __super::DeliverEndFlush();
+ {
+ CAutoLock cAutoLock(&m_csQueue);
+ m_packets.RemoveAll();
+ m_rob.RemoveAll();
+ m_tos.RemoveAll();
+ }
+
+ return __super::DeliverEndFlush();
}
HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream()
{
- CAutoLock cAutoLock(&m_csQueue);
+ CAutoLock cAutoLock(&m_csQueue);
- // send out the last remaining packets from the queue
+ // send out the last remaining packets from the queue
- while(m_rob.GetCount())
- {
- MatroskaPacket* mp = m_rob.RemoveHead();
- if(m_rob.GetCount() && !mp->bg->BlockDuration.IsValid())
- mp->rtStop = m_rob.GetHead()->rtStart;
- else if(m_rob.GetCount() == 0 && m_rtDefaultDuration > 0)
- mp->rtStop = mp->rtStart + m_rtDefaultDuration;
+ while(m_rob.GetCount())
+ {
+ MatroskaPacket* mp = m_rob.RemoveHead();
+ if(m_rob.GetCount() && !mp->bg->BlockDuration.IsValid())
+ mp->rtStop = m_rob.GetHead()->rtStart;
+ else if(m_rob.GetCount() == 0 && m_rtDefaultDuration > 0)
+ mp->rtStop = mp->rtStart + m_rtDefaultDuration;
- timeoverride to = {mp->rtStart, mp->rtStop};
- m_tos.AddTail(to);
- }
+ timeoverride to = {mp->rtStart, mp->rtStop};
+ m_tos.AddTail(to);
+ }
- while(m_packets.GetCount())
- {
- HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) return hr;
- }
+ while(m_packets.GetCount())
+ {
+ HRESULT hr = DeliverBlock(m_packets.RemoveHead());
+ if(hr != S_OK) return hr;
+ }
- return __super::DeliverEndOfStream();
+ return __super::DeliverEndOfStream();
}
HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
- MatroskaPacket* mp = dynamic_cast<MatroskaPacket*>(p.m_p);
- if(!mp) return __super::DeliverPacket(p);
-
- // don't try to understand what's happening here, it's magic
-
- CAutoLock cAutoLock(&m_csQueue);
-
- CAutoPtr<MatroskaPacket> p2;
- p.Detach();
- p2.Attach(mp);
- m_packets.AddTail(p2);
-
- POSITION pos = m_rob.GetTailPosition();
- for(int i = m_nMinCache - 1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; i--)
- m_rob.GetPrev(pos);
-
- if(!pos) m_rob.AddHead(mp);
- else m_rob.InsertAfter(pos, mp);
-
- mp = NULL;
-
- if(m_rob.GetCount() == m_nMinCache + 1)
- {
- ASSERT(m_nMinCache > 0);
- pos = m_rob.GetHeadPosition();
- MatroskaPacket* mp1 = m_rob.GetNext(pos);
- MatroskaPacket* mp2 = m_rob.GetNext(pos);
- if(!mp1->bg->BlockDuration.IsValid())
- {
- mp1->bg->BlockDuration.Set(1); // just to set it valid
-
- if(mp1->rtStart >= mp2->rtStart)
- {
- /* CString str;
- str.Format(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
- AfxMessageBox(str);
- */
- // TRACE(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
- }
- else
- {
- mp1->rtStop = mp2->rtStart;
- }
- }
- }
-
- while(m_packets.GetCount())
- {
- mp = m_packets.GetHead();
- if(!mp->bg->BlockDuration.IsValid()) break;
-
- mp = m_rob.RemoveHead();
- timeoverride to = {mp->rtStart, mp->rtStop};
- m_tos.AddTail(to);
-
- HRESULT hr = DeliverBlock(m_packets.RemoveHead());
- if(hr != S_OK) return hr;
- }
-
- return S_OK;
+ MatroskaPacket* mp = dynamic_cast<MatroskaPacket*>(p.m_p);
+ if(!mp) return __super::DeliverPacket(p);
+
+ // don't try to understand what's happening here, it's magic
+
+ CAutoLock cAutoLock(&m_csQueue);
+
+ CAutoPtr<MatroskaPacket> p2;
+ p.Detach();
+ p2.Attach(mp);
+ m_packets.AddTail(p2);
+
+ POSITION pos = m_rob.GetTailPosition();
+ for(int i = m_nMinCache-1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; i--)
+ m_rob.GetPrev(pos);
+
+ if(!pos) m_rob.AddHead(mp);
+ else m_rob.InsertAfter(pos, mp);
+
+ mp = NULL;
+
+ if(m_rob.GetCount() == m_nMinCache+1)
+ {
+ ASSERT(m_nMinCache > 0);
+ pos = m_rob.GetHeadPosition();
+ MatroskaPacket* mp1 = m_rob.GetNext(pos);
+ MatroskaPacket* mp2 = m_rob.GetNext(pos);
+ if(!mp1->bg->BlockDuration.IsValid())
+ {
+ mp1->bg->BlockDuration.Set(1); // just to set it valid
+
+ if(mp1->rtStart >= mp2->rtStart)
+ {
+/* CString str;
+ str.Format(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
+ AfxMessageBox(str);
+*/
+ // TRACE(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
+ }
+ else
+ {
+ mp1->rtStop = mp2->rtStart;
+ }
+ }
+ }
+
+ while(m_packets.GetCount())
+ {
+ mp = m_packets.GetHead();
+ if(!mp->bg->BlockDuration.IsValid()) break;
+
+ mp = m_rob.RemoveHead();
+ timeoverride to = {mp->rtStart, mp->rtStop};
+ m_tos.AddTail(to);
+
+ HRESULT hr = DeliverBlock(m_packets.RemoveHead());
+ if(hr != S_OK) return hr;
+ }
+
+ return S_OK;
}
HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
{
- HRESULT hr = S_FALSE;
+ HRESULT hr = S_FALSE;
- if(m_tos.GetCount())
- {
- timeoverride to = m_tos.RemoveHead();
+ if(m_tos.GetCount())
+ {
+ timeoverride to = m_tos.RemoveHead();
// if(p->TrackNumber == 2)
- TRACE(_T("(track=%d) %I64d, %I64d -> %I64d, %I64d (buffcnt=%d)\n"),
- p->TrackNumber, p->rtStart, p->rtStop, to.rtStart, to.rtStop,
- QueueCount());
- /**/
- p->rtStart = to.rtStart;
- p->rtStop = to.rtStop;
- }
-
- REFERENCE_TIME
- rtStart = p->rtStart,
- rtDelta = (p->rtStop - p->rtStart) / p->bg->Block.BlockData.GetCount(),
- rtStop = p->rtStart + rtDelta;
-
- POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
- while(pos)
- {
- CAutoPtr<Packet> tmp(DNew Packet());
- tmp->TrackNumber = p->TrackNumber;
- tmp->bDiscontinuity = p->bDiscontinuity;
- tmp->bSyncPoint = p->bSyncPoint;
- tmp->rtStart = rtStart;
- tmp->rtStop = rtStop;
- tmp->Copy(*p->bg->Block.BlockData.GetNext(pos));
- if(S_OK != (hr = DeliverPacket(tmp))) break;
-
- rtStart += rtDelta;
- rtStop += rtDelta;
-
- p->bSyncPoint = false;
- p->bDiscontinuity = false;
- }
-
- if(m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4))
- {
- POSITION pos = p->bg->ba.bm.GetHeadPosition();
- while(pos)
- {
- const BlockMore* bm = p->bg->ba.bm.GetNext(pos);
- CAutoPtr<Packet> tmp(DNew Packet());
- tmp->TrackNumber = p->TrackNumber;
- tmp->bDiscontinuity = false;
- tmp->bSyncPoint = false;
- tmp->rtStart = p->rtStart;
- tmp->rtStop = p->rtStop;
- tmp->Copy(bm->BlockAdditional);
- if(S_OK != (hr = DeliverPacket(tmp))) break;
- }
- }
-
- return hr;
+ TRACE(_T("(track=%d) %I64d, %I64d -> %I64d, %I64d (buffcnt=%d)\n"),
+ p->TrackNumber, p->rtStart, p->rtStop, to.rtStart, to.rtStop,
+ QueueCount());
+/**/
+ p->rtStart = to.rtStart;
+ p->rtStop = to.rtStop;
+ }
+
+ REFERENCE_TIME
+ rtStart = p->rtStart,
+ rtDelta = (p->rtStop - p->rtStart) / p->bg->Block.BlockData.GetCount(),
+ rtStop = p->rtStart + rtDelta;
+
+ POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CAutoPtr<Packet> tmp(DNew Packet());
+ tmp->TrackNumber = p->TrackNumber;
+ tmp->bDiscontinuity = p->bDiscontinuity;
+ tmp->bSyncPoint = p->bSyncPoint;
+ tmp->rtStart = rtStart;
+ tmp->rtStop = rtStop;
+ tmp->Copy(*p->bg->Block.BlockData.GetNext(pos));
+ if(S_OK != (hr = DeliverPacket(tmp))) break;
+
+ rtStart += rtDelta;
+ rtStop += rtDelta;
+
+ p->bSyncPoint = false;
+ p->bDiscontinuity = false;
+ }
+
+ if(m_mt.subtype == FOURCCMap(WAVE_FORMAT_WAVPACK4))
+ {
+ POSITION pos = p->bg->ba.bm.GetHeadPosition();
+ while(pos)
+ {
+ const BlockMore* bm = p->bg->ba.bm.GetNext(pos);
+ CAutoPtr<Packet> tmp(DNew Packet());
+ tmp->TrackNumber = p->TrackNumber;
+ tmp->bDiscontinuity = false;
+ tmp->bSyncPoint = false;
+ tmp->rtStart = p->rtStart;
+ tmp->rtStop = p->rtStop;
+ tmp->Copy(bm->BlockAdditional);
+ if(S_OK != (hr = DeliverPacket(tmp))) break;
+ }
+ }
+
+ return hr;
}
// ITrackInfo
TrackEntry* CMatroskaSplitterFilter::GetTrackEntryAt(UINT aTrackIdx)
{
- if(aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount())
- return NULL;
- return m_pOrderedTrackArray[aTrackIdx];
+ if(aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount())
+ return NULL;
+ return m_pOrderedTrackArray[aTrackIdx];
}
STDMETHODIMP_(UINT) CMatroskaSplitterFilter::GetTrackCount()
-{
- return m_pTrackEntryMap.GetCount();
+{
+ return m_pTrackEntryMap.GetCount();
}
STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return FALSE;
-
- pStructureToFill->FlagDefault = !!pTE->FlagDefault;
- pStructureToFill->FlagLacing = !!pTE->FlagLacing;
- strncpy(pStructureToFill->Language, pTE->Language, 3);
- if(pStructureToFill->Language[0] == '\0')
- strncpy(pStructureToFill->Language, "eng", 3);
- pStructureToFill->Language[3] = '\0';
- pStructureToFill->MaxCache = (UINT)pTE->MaxCache;
- pStructureToFill->MinCache = (UINT)pTE->MinCache;
- pStructureToFill->Type = (BYTE)pTE->TrackType;
- return TRUE;
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return FALSE;
+
+ pStructureToFill->FlagDefault = !!pTE->FlagDefault;
+ pStructureToFill->FlagLacing = !!pTE->FlagLacing;
+ strncpy(pStructureToFill->Language, pTE->Language, 3);
+ if(pStructureToFill->Language[0] == '\0')
+ strncpy(pStructureToFill->Language, "eng", 3);
+ pStructureToFill->Language[3] = '\0';
+ pStructureToFill->MaxCache = (UINT)pTE->MaxCache;
+ pStructureToFill->MinCache = (UINT)pTE->MinCache;
+ pStructureToFill->Type = (BYTE)pTE->TrackType;
+ return TRUE;
}
STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return FALSE;
-
- if(pTE->TrackType == TrackEntry::TypeVideo)
- {
- TrackExtendedInfoVideo* pTEIV = (TrackExtendedInfoVideo*)pStructureToFill;
- pTEIV->AspectRatioType = (BYTE)pTE->v.AspectRatioType;
- pTEIV->DisplayUnit = (BYTE)pTE->v.DisplayUnit;
- pTEIV->DisplayWidth = (UINT)pTE->v.DisplayWidth;
- pTEIV->DisplayHeight = (UINT)pTE->v.DisplayHeight;
- pTEIV->Interlaced = !!pTE->v.FlagInterlaced;
- pTEIV->PixelWidth = (UINT)pTE->v.PixelWidth;
- pTEIV->PixelHeight = (UINT)pTE->v.PixelHeight;
- }
- else if(pTE->TrackType == TrackEntry::TypeAudio)
- {
- TrackExtendedInfoAudio* pTEIA = (TrackExtendedInfoAudio*)pStructureToFill;
- pTEIA->BitDepth = (UINT)pTE->a.BitDepth;
- pTEIA->Channels = (UINT)pTE->a.Channels;
- pTEIA->OutputSamplingFrequency = pTE->a.OutputSamplingFrequency;
- pTEIA->SamplingFreq = pTE->a.SamplingFrequency;
- }
- else
- {
- return FALSE;
- }
-
- return TRUE;
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return FALSE;
+
+ if(pTE->TrackType == TrackEntry::TypeVideo)
+ {
+ TrackExtendedInfoVideo* pTEIV = (TrackExtendedInfoVideo*)pStructureToFill;
+ pTEIV->AspectRatioType = (BYTE)pTE->v.AspectRatioType;
+ pTEIV->DisplayUnit = (BYTE)pTE->v.DisplayUnit;
+ pTEIV->DisplayWidth = (UINT)pTE->v.DisplayWidth;
+ pTEIV->DisplayHeight = (UINT)pTE->v.DisplayHeight;
+ pTEIV->Interlaced = !!pTE->v.FlagInterlaced;
+ pTEIV->PixelWidth = (UINT)pTE->v.PixelWidth;
+ pTEIV->PixelHeight = (UINT)pTE->v.PixelHeight;
+ } else if(pTE->TrackType == TrackEntry::TypeAudio) {
+ TrackExtendedInfoAudio* pTEIA = (TrackExtendedInfoAudio*)pStructureToFill;
+ pTEIA->BitDepth = (UINT)pTE->a.BitDepth;
+ pTEIA->Channels = (UINT)pTE->a.Channels;
+ pTEIA->OutputSamplingFrequency = pTE->a.OutputSamplingFrequency;
+ pTEIA->SamplingFreq = pTE->a.SamplingFrequency;
+ } else {
+ return FALSE;
+ }
+
+ return TRUE;
}
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->Name.AllocSysString();
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->Name.AllocSysString();
}
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecID.ToString().AllocSysString();
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecID.ToString().AllocSysString();
}
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecName.AllocSysString();
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecName.AllocSysString();
}
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecInfoURL.AllocSysString();
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecInfoURL.AllocSysString();
}
STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecDownloadURL(UINT aTrackIdx)
{
- TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
- if(pTE == NULL)
- return NULL;
- return pTE->CodecDownloadURL.AllocSysString();
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecDownloadURL.AllocSysString();
}
diff --git a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h
index 5c9d44a58..05eb7d814 100644
--- a/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h
+++ b/src/filters/parser/MatroskaSplitter/MatroskaSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,98 +30,92 @@
class MatroskaPacket : public Packet
{
protected:
- int GetDataSize()
- {
- int size = 0;
- POSITION pos = bg->Block.BlockData.GetHeadPosition();
- while(pos)
- {
- size += bg->Block.BlockData.GetNext(pos)->GetCount();
- }
- return size;
- }
+ int GetDataSize()
+ {
+ int size = 0;
+ POSITION pos = bg->Block.BlockData.GetHeadPosition();
+ while(pos) {size += bg->Block.BlockData.GetNext(pos)->GetCount();}
+ return size;
+ }
public:
- CAutoPtr<MatroskaReader::BlockGroup> bg;
+ CAutoPtr<MatroskaReader::BlockGroup> bg;
};
class CMatroskaSplitterOutputPin : public CBaseSplitterOutputPin
{
- HRESULT DeliverBlock(MatroskaPacket* p);
+ HRESULT DeliverBlock(MatroskaPacket* p);
- int m_nMinCache;
- REFERENCE_TIME m_rtDefaultDuration;
+ int m_nMinCache;
+ REFERENCE_TIME m_rtDefaultDuration;
- CCritSec m_csQueue;
- CAutoPtrList<MatroskaPacket> m_packets;
- CAtlList<MatroskaPacket*> m_rob;
+ CCritSec m_csQueue;
+ CAutoPtrList<MatroskaPacket> m_packets;
+ CAtlList<MatroskaPacket*> m_rob;
- typedef struct
- {
- REFERENCE_TIME rtStart, rtStop;
- } timeoverride;
- CAtlList<timeoverride> m_tos;
+ typedef struct {REFERENCE_TIME rtStart, rtStop;} timeoverride;
+ CAtlList<timeoverride> m_tos;
protected:
- HRESULT DeliverPacket(CAutoPtr<Packet> p);
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
public:
- CMatroskaSplitterOutputPin(
- int nMinCache, REFERENCE_TIME rtDefaultDuration,
- CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CMatroskaSplitterOutputPin();
+ CMatroskaSplitterOutputPin(
+ int nMinCache, REFERENCE_TIME rtDefaultDuration,
+ CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMatroskaSplitterOutputPin();
- HRESULT DeliverEndFlush();
- HRESULT DeliverEndOfStream();
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverEndOfStream();
};
[uuid("149D2E01-C32E-4939-80F6-C07B81015A7A")]
class CMatroskaSplitterFilter : public CBaseSplitterFilter, public ITrackInfo
{
- void SetupChapters(LPCSTR lng, MatroskaReader::ChapterAtom* parent, int level = 0);
- void InstallFonts();
- void SendVorbisHeaderSample();
+ void SetupChapters(LPCSTR lng, MatroskaReader::ChapterAtom* parent, int level = 0);
+ void InstallFonts();
+ void SendVorbisHeaderSample();
- CAutoPtr<MatroskaReader::CMatroskaNode> m_pSegment, m_pCluster, m_pBlock;
+ CAutoPtr<MatroskaReader::CMatroskaNode> m_pSegment, m_pCluster, m_pBlock;
protected:
- CAutoPtr<MatroskaReader::CMatroskaFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<MatroskaReader::CMatroskaFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- CAtlMap<DWORD, MatroskaReader::TrackEntry*> m_pTrackEntryMap;
- CAtlArray<MatroskaReader::TrackEntry* > m_pOrderedTrackArray;
- MatroskaReader::TrackEntry* GetTrackEntryAt(UINT aTrackIdx);
+ CAtlMap<DWORD, MatroskaReader::TrackEntry*> m_pTrackEntryMap;
+ CAtlArray<MatroskaReader::TrackEntry* > m_pOrderedTrackArray;
+ MatroskaReader::TrackEntry* GetTrackEntryAt(UINT aTrackIdx);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CMatroskaSplitterFilter();
+ CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CMatroskaSplitterFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IKeyFrameInfo
+ // IKeyFrameInfo
- STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+ STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
- // ITrackInfo
+ // ITrackInfo
- STDMETHODIMP_(UINT) GetTrackCount();
- STDMETHODIMP_(BOOL) GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill);
- STDMETHODIMP_(BOOL) GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill);
- STDMETHODIMP_(BSTR) GetTrackName(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecID(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecName(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecInfoURL(UINT aTrackIdx);
- STDMETHODIMP_(BSTR) GetTrackCodecDownloadURL(UINT aTrackIdx);
+ STDMETHODIMP_(UINT) GetTrackCount();
+ STDMETHODIMP_(BOOL) GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill);
+ STDMETHODIMP_(BOOL) GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill);
+ STDMETHODIMP_(BSTR) GetTrackName(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecID(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecName(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecInfoURL(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecDownloadURL(UINT aTrackIdx);
};
[uuid("0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4")]
class CMatroskaSourceFilter : public CMatroskaSplitterFilter
{
public:
- CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/MatroskaSplitter/resource.h b/src/filters/parser/MatroskaSplitter/resource.h
index dc322a964..1cd7111d9 100644
--- a/src/filters/parser/MatroskaSplitter/resource.h
+++ b/src/filters/parser/MatroskaSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by MatroskaSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/MatroskaSplitter/stdafx.cpp b/src/filters/parser/MatroskaSplitter/stdafx.cpp
index 0378caf4c..c3b346d99 100644
--- a/src/filters/parser/MatroskaSplitter/stdafx.cpp
+++ b/src/filters/parser/MatroskaSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MatroskaSplitter/stdafx.h b/src/filters/parser/MatroskaSplitter/stdafx.h
index ec6ed9d77..5f53f59b5 100644
--- a/src/filters/parser/MatroskaSplitter/stdafx.h
+++ b/src/filters/parser/MatroskaSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.cpp b/src/filters/parser/MpaSplitter/MpaSplitter.cpp
index 19321de65..bf0e20e91 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitter.cpp
+++ b/src/filters/parser/MpaSplitter/MpaSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,44 +28,44 @@
#ifdef REGISTER_FILTER
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
-{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
};
const AMOVIESETUP_PIN sudpPins[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMpaSplitterFilter), L"MPC - Mpa Splitter", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMpaSourceFilter), L"MPC - Mpa Source", MERIT_NORMAL + 1, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMpaSplitterFilter), L"MPC - Mpa Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMpaSourceFilter), L"MPC - Mpa Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpaSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpaSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpaSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpaSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- CAtlList<CString> chkbytes;
- chkbytes.AddTail(_T("0,2,FFE0,FFE0"));
- chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000"));
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG1Audio, chkbytes, NULL);
+ CAtlList<CString> chkbytes;
+ chkbytes.AddTail(_T("0,2,FFE0,FFE0"));
+ chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000"));
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG1Audio, chkbytes, NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -79,7 +79,7 @@ CFilterApp theApp;
//
CMpaSplitterFilter::CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CMpaSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CMpaSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
@@ -87,113 +87,105 @@ STDMETHODIMP CMpaSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void**
{
CheckPointer(ppv, E_POINTER);
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
+ CheckPointer(pAsyncReader, E_POINTER);
- HRESULT hr = E_FAIL;
+ HRESULT hr = E_FAIL;
- m_pFile.Free();
+ m_pFile.Free();
- m_pFile.Attach(DNew CMpaSplitterFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
+ m_pFile.Attach(DNew CMpaSplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
- CAtlArray<CMediaType> mts;
- mts.Add(m_pFile->GetMediaType());
+ CAtlArray<CMediaType> mts;
+ mts.Add(m_pFile->GetMediaType());
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
- AddOutputPin(0, pPinOut);
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
+ AddOutputPin(0, pPinOut);
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetDuration();
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetDuration();
- CStringW str, title;
- if(m_pFile->m_tags.Lookup('TIT2', str)) title = str;
- if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) title += L" (" + str + L")";
- if(!title.IsEmpty()) SetProperty(L"TITL", title);
- if(m_pFile->m_tags.Lookup('TPE1', str)) SetProperty(L"AUTH", str);
- if(m_pFile->m_tags.Lookup('TCOP', str)) SetProperty(L"CPYR", str);
- if(m_pFile->m_tags.Lookup('COMM', str)) SetProperty(L"DESC", str);
+ CStringW str, title;
+ if(m_pFile->m_tags.Lookup('TIT2', str)) title = str;
+ if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) title += L" (" + str + L")";
+ if(!title.IsEmpty()) SetProperty(L"TITL", title);
+ if(m_pFile->m_tags.Lookup('TPE1', str)) SetProperty(L"AUTH", str);
+ if(m_pFile->m_tags.Lookup('TCOP', str)) SetProperty(L"CPYR", str);
+ if(m_pFile->m_tags.Lookup('COMM', str)) SetProperty(L"DESC", str);
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
STDMETHODIMP CMpaSplitterFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
- *pDuration = m_pFile->GetDuration();
+ *pDuration = m_pFile->GetDuration();
- return S_OK;
+ return S_OK;
}
bool CMpaSplitterFilter::DemuxInit()
{
- if(!m_pFile) return(false);
+ if(!m_pFile) return(false);
- // TODO
+ // TODO
- return(true);
+ return(true);
}
void CMpaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- __int64 startpos = m_pFile->GetStartPos();
- __int64 endpos = m_pFile->GetEndPos();
-
- if(rt <= 0 || m_pFile->GetDuration() <= 0)
- {
- m_pFile->Seek(startpos);
- m_rtStart = 0;
- }
- else
- {
- m_pFile->Seek(startpos + (__int64)((1.0 * rt / m_pFile->GetDuration()) *(endpos - startpos)));
- m_rtStart = rt;
- }
+ __int64 startpos = m_pFile->GetStartPos();
+ __int64 endpos = m_pFile->GetEndPos();
+
+ if(rt <= 0 || m_pFile->GetDuration() <= 0)
+ {
+ m_pFile->Seek(startpos);
+ m_rtStart = 0;
+ }
+ else
+ {
+ m_pFile->Seek(startpos + (__int64)((1.0 * rt / m_pFile->GetDuration()) * (endpos - startpos)));
+ m_rtStart = rt;
+ }
}
bool CMpaSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- int FrameSize;
- REFERENCE_TIME rtDuration;
+ int FrameSize;
+ REFERENCE_TIME rtDuration;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9)
- {
- if(!m_pFile->Sync(FrameSize, rtDuration))
- {
- Sleep(1);
- continue;
- }
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9)
+ {
+ if(!m_pFile->Sync(FrameSize, rtDuration)) {Sleep(1); continue;}
- CAutoPtr<Packet> p(DNew Packet());
- p->SetCount(FrameSize);
- m_pFile->ByteRead(p->GetData(), FrameSize);
+ CAutoPtr<Packet> p(DNew Packet());
+ p->SetCount(FrameSize);
+ m_pFile->ByteRead(p->GetData(), FrameSize);
- p->TrackNumber = 0;
- p->rtStart = m_rtStart;
- p->rtStop = m_rtStart + rtDuration;
- p->bSyncPoint = TRUE;
+ p->TrackNumber = 0;
+ p->rtStart = m_rtStart;
+ p->rtStop = m_rtStart + rtDuration;
+ p->bSyncPoint = TRUE;
- hr = DeliverPacket(p);
+ hr = DeliverPacket(p);
- m_rtStart += rtDuration;
- }
+ m_rtStart += rtDuration;
+ }
- return(true);
+ return(true);
}
//
@@ -201,8 +193,8 @@ bool CMpaSplitterFilter::DemuxLoop()
//
CMpaSourceFilter::CMpaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CMpaSplitterFilter(pUnk, phr)
+ : CMpaSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
diff --git a/src/filters/parser/MpaSplitter/MpaSplitter.h b/src/filters/parser/MpaSplitter/MpaSplitter.h
index f3658dcdd..c2ce4c934 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitter.h
+++ b/src/filters/parser/MpaSplitter/MpaSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,22 +27,22 @@
[uuid("0E9D4BF7-CBCB-46C7-BD80-4EF223A3DC2B")]
class CMpaSplitterFilter : public CBaseSplitterFilter
{
- REFERENCE_TIME m_rtStart;
+ REFERENCE_TIME m_rtStart;
protected:
- CAutoPtr<CMpaSplitterFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CMpaSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
};
@@ -50,5 +50,5 @@ public:
class CMpaSourceFilter : public CMpaSplitterFilter
{
public:
- CMpaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CMpaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
}; \ No newline at end of file
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
index 507fc5894..1590eee37 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
+++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,322 +28,322 @@
//
-static const LPCTSTR s_genre[] =
+static const LPCTSTR s_genre[] =
{
- _T("Blues"), _T("Classic Rock"), _T("Country"), _T("Dance"),
- _T("Disco"), _T("Funk"), _T("Grunge"), _T("Hip-Hop"),
- _T("Jazz"), _T("Metal"), _T("New Age"), _T("Oldies"),
- _T("Other"), _T("Pop"), _T("R&B"), _T("Rap"),
- _T("Reggae"), _T("Rock"), _T("Techno"), _T("Industrial"),
- _T("Alternative"), _T("Ska"), _T("Death Metal"), _T("Pranks"),
- _T("Soundtrack"), _T("Euro-Techno"), _T("Ambient"), _T("Trip-Hop"),
- _T("Vocal"), _T("Jazz+Funk"), _T("Fusion"), _T("Trance"),
- _T("Classical"), _T("Instrumental"), _T("Acid"), _T("House"),
- _T("Game"), _T("Sound Clip"), _T("Gospel"), _T("Noise"),
- _T("Alternative Rock"), _T("Bass"), _T("Soul"), _T("Punk"),
- _T("Space"), _T("Meditative"), _T("Instrumental Pop"), _T("Instrumental Rock"),
- _T("Ethnic"), _T("Gothic"), _T("Darkwave"), _T("Techno-Industrial"),
- _T("Electronic"), _T("Pop-Folk"), _T("Eurodance"), _T("Dream"),
- _T("Southern Rock"), _T("Comedy"), _T("Cult"), _T("Gangsta"),
- _T("Top 40"), _T("Christian Rap"), _T("Pop/Funk"), _T("Jungle"),
- _T("Native US"), _T("Cabaret"), _T("New Wave"), _T("Psychadelic"),
- _T("Rave"), _T("Showtunes"), _T("Trailer"), _T("Lo-Fi"),
- _T("Tribal"), _T("Acid Punk"), _T("Acid Jazz"), _T("Polka"),
- _T("Retro"), _T("Musical"), _T("Rock & Roll"), _T("Hard Rock"),
- _T("Folk"), _T("Folk-Rock"), _T("National Folk"), _T("Swing"),
- _T("Fast Fusion"), _T("Bebob"), _T("Latin"), _T("Revival"),
- _T("Celtic"), _T("Bluegrass"), _T("Avantgarde"), _T("Gothic Rock"),
- _T("Progressive Rock"), _T("Psychedelic Rock"), _T("Symphonic Rock"), _T("Slow Rock"),
- _T("Big Band"), _T("Chorus"), _T("Easy Listening"), _T("Acoustic"),
- _T("Humour"), _T("Speech"), _T("Chanson"), _T("Opera"),
- _T("Chamber Music"), _T("Sonata"), _T("Symphony"), _T("Booty Bass"),
- _T("Primus"), _T("Porn Groove"), _T("Satire"), _T("Slow Jam"),
- _T("Club"), _T("Tango"), _T("Samba"), _T("Folklore"),
- _T("Ballad"), _T("Power Ballad"), _T("Rhytmic Soul"), _T("Freestyle"),
- _T("Duet"), _T("Punk Rock"), _T("Drum Solo"), _T("Acapella"),
- _T("Euro-House"), _T("Dance Hall"), _T("Goa"), _T("Drum & Bass"),
- _T("Club-House"), _T("Hardcore"), _T("Terror"), _T("Indie"),
- _T("BritPop"), _T("Negerpunk"), _T("Polsk Punk"), _T("Beat"),
- _T("Christian Gangsta"), _T("Heavy Metal"), _T("Black Metal"),
- _T("Crossover"), _T("Contemporary C"), _T("Christian Rock"), _T("Merengue"), _T("Salsa"),
- _T("Thrash Metal"), _T("Anime"), _T("JPop"), _T("SynthPop"),
+ _T("Blues"), _T("Classic Rock"), _T("Country"), _T("Dance"),
+ _T("Disco"), _T("Funk"), _T("Grunge"), _T("Hip-Hop"),
+ _T("Jazz"), _T("Metal"), _T("New Age"), _T("Oldies"),
+ _T("Other"), _T("Pop"), _T("R&B"), _T("Rap"),
+ _T("Reggae"), _T("Rock"), _T("Techno"), _T("Industrial"),
+ _T("Alternative"), _T("Ska"), _T("Death Metal"), _T("Pranks"),
+ _T("Soundtrack"), _T("Euro-Techno"), _T("Ambient"), _T("Trip-Hop"),
+ _T("Vocal"), _T("Jazz+Funk"), _T("Fusion"), _T("Trance"),
+ _T("Classical"), _T("Instrumental"), _T("Acid"), _T("House"),
+ _T("Game"), _T("Sound Clip"), _T("Gospel"), _T("Noise"),
+ _T("Alternative Rock"), _T("Bass"), _T("Soul"), _T("Punk"),
+ _T("Space"), _T("Meditative"), _T("Instrumental Pop"), _T("Instrumental Rock"),
+ _T("Ethnic"), _T("Gothic"), _T("Darkwave"), _T("Techno-Industrial"),
+ _T("Electronic"), _T("Pop-Folk"), _T("Eurodance"), _T("Dream"),
+ _T("Southern Rock"), _T("Comedy"), _T("Cult"), _T("Gangsta"),
+ _T("Top 40"), _T("Christian Rap"), _T("Pop/Funk"), _T("Jungle"),
+ _T("Native US"), _T("Cabaret"), _T("New Wave"), _T("Psychadelic"),
+ _T("Rave"), _T("Showtunes"), _T("Trailer"), _T("Lo-Fi"),
+ _T("Tribal"), _T("Acid Punk"), _T("Acid Jazz"), _T("Polka"),
+ _T("Retro"), _T("Musical"), _T("Rock & Roll"), _T("Hard Rock"),
+ _T("Folk"), _T("Folk-Rock"), _T("National Folk"), _T("Swing"),
+ _T("Fast Fusion"), _T("Bebob"), _T("Latin"), _T("Revival"),
+ _T("Celtic"), _T("Bluegrass"), _T("Avantgarde"), _T("Gothic Rock"),
+ _T("Progressive Rock"), _T("Psychedelic Rock"), _T("Symphonic Rock"), _T("Slow Rock"),
+ _T("Big Band"), _T("Chorus"), _T("Easy Listening"), _T("Acoustic"),
+ _T("Humour"), _T("Speech"), _T("Chanson"), _T("Opera"),
+ _T("Chamber Music"), _T("Sonata"), _T("Symphony"), _T("Booty Bass"),
+ _T("Primus"), _T("Porn Groove"), _T("Satire"), _T("Slow Jam"),
+ _T("Club"), _T("Tango"), _T("Samba"), _T("Folklore"),
+ _T("Ballad"), _T("Power Ballad"), _T("Rhytmic Soul"), _T("Freestyle"),
+ _T("Duet"), _T("Punk Rock"), _T("Drum Solo"), _T("Acapella"),
+ _T("Euro-House"), _T("Dance Hall"), _T("Goa"), _T("Drum & Bass"),
+ _T("Club-House"), _T("Hardcore"), _T("Terror"), _T("Indie"),
+ _T("BritPop"), _T("Negerpunk"), _T("Polsk Punk"), _T("Beat"),
+ _T("Christian Gangsta"), _T("Heavy Metal"), _T("Black Metal"),
+ _T("Crossover"), _T("Contemporary C"), _T("Christian Rock"), _T("Merengue"), _T("Salsa"),
+ _T("Thrash Metal"), _T("Anime"), _T("JPop"), _T("SynthPop"),
};
//
CMpaSplitterFile::CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
- , m_mode(none)
- , m_rtDuration(0)
- , m_startpos(0)
- , m_endpos(0)
- , m_totalbps(0)
+ : CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
+ , m_mode(none)
+ , m_rtDuration(0)
+ , m_startpos(0)
+ , m_endpos(0)
+ , m_totalbps(0)
{
- if(SUCCEEDED(hr)) hr = Init();
+ if(SUCCEEDED(hr)) hr = Init();
}
HRESULT CMpaSplitterFile::Init()
{
- m_startpos = 0;
- m_endpos = GetLength();
-
- Seek(0);
-
- if(BitRead(24, true) == 0x000001)
- return E_FAIL;
-
- if(m_endpos > 128 && IsRandomAccess())
- {
- Seek(m_endpos - 128);
-
- if(BitRead(24) == 'TAG')
- {
- m_endpos -= 128;
-
- CStringA str;
-
- // title
- ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
- m_tags['TIT2'] = CStringW(str).Trim();
-
- // artist
- ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
- m_tags['TPE1'] = CStringW(str).Trim();
-
- // album
- ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
- m_tags['TALB'] = CStringW(str).Trim();
-
- // year
- ByteRead((BYTE*)str.GetBufferSetLength(4), 4);
- m_tags['TYER'] = CStringW(str).Trim();
-
- // comment
- ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
- m_tags['COMM'] = CStringW(str).Trim();
-
- // track
- LPCSTR s = str;
- if(s[28] == 0 && s[29] != 0)
- m_tags['TRCK'].Format(L"%d", s[29]);
-
- // genre
- BYTE genre = (BYTE)BitRead(8);
- if(genre < countof(s_genre))
- m_tags['TCON'] = CStringW(s_genre[genre]);
- }
- }
-
- Seek(0);
-
- while(BitRead(24, true) == 'ID3')
- {
- BitRead(24);
-
- BYTE major = (BYTE)BitRead(8);
- BYTE revision = (BYTE)BitRead(8);
-
- BYTE flags = (BYTE)BitRead(8);
- DWORD size = 0;
- if(BitRead(1) != 0) return E_FAIL;
- size |= BitRead(7) << 21;
- if(BitRead(1) != 0) return E_FAIL;
- size |= BitRead(7) << 14;
- if(BitRead(1) != 0) return E_FAIL;
- size |= BitRead(7) << 7;
- if(BitRead(1) != 0) return E_FAIL;
- size |= BitRead(7);
-
- m_startpos = GetPos() + size;
-
- // TODO: read extended header
-
- if(major <= 4)
- {
- __int64 pos = GetPos();
-
- while(pos < m_startpos)
- {
- Seek(pos);
-
- DWORD tag = (DWORD)BitRead(32);
- DWORD size = 0;
- size |= BitRead(8) << 24;
- size |= BitRead(8) << 16;
- size |= BitRead(8) << 8;
- size |= BitRead(8);
- WORD flags = (WORD)BitRead(16);
-
- pos += 4 + 4 + 2 + size;
-
- if(!size || pos >= m_startpos)
- break;
-
- if(tag == 'TIT2'
- || tag == 'TPE1'
- || tag == 'TALB'
- || tag == 'TYER'
- || tag == 'COMM'
- || tag == 'TRCK')
- {
- BYTE encoding = (BYTE)BitRead(8);
- size--;
-
- WORD bom = (WORD)BitRead(16, true);
-
- CStringA str;
- CStringW wstr;
-
- if(encoding > 0 && size >= 2 && bom == 0xfffe)
- {
- BitRead(16);
- size = (size - 2) / 2;
- ByteRead((BYTE*)wstr.GetBufferSetLength(size), size * 2);
- m_tags[tag] = wstr.Trim();
- }
- else if(encoding > 0 && size >= 2 && bom == 0xfeff)
- {
- BitRead(16);
- size = (size - 2) / 2;
- ByteRead((BYTE*)wstr.GetBufferSetLength(size), size * 2);
- for(int i = 0, j = wstr.GetLength(); i < j; i++) wstr.SetAt(i, (wstr[i] << 8) | (wstr[i] >> 8));
- m_tags[tag] = wstr.Trim();
- }
- else
- {
- ByteRead((BYTE*)str.GetBufferSetLength(size), size);
- m_tags[tag] = (encoding > 0 ? UTF8To16(str) : CStringW(str)).Trim();
- }
- }
- }
- }
-
- Seek(m_startpos);
-
- for(int i = 0; i < (1 << 20) && m_startpos < m_endpos && BitRead(8, true) == 0; i++)
- BitRead(8), m_startpos++;
- }
-
- __int64 searchlen = min(m_endpos - m_startpos, m_startpos > 0 ? 0x200 : 7);
-
- __int64 startpos;
-
- Seek(m_startpos);
-
- if(m_mode == none && Read(m_mpahdr, searchlen, true, &m_mt))
- {
- m_mode = mpa;
-
- startpos = GetPos() - 4;
-
- // make sure the first frame is followed by another of the same kind (validates m_mpahdr basically)
- Seek(startpos + m_mpahdr.FrameSize);
- if(!Sync(4)) m_mode = none;
- }
-
- Seek(m_startpos);
-
- if(m_mode == none && Read(m_aachdr, searchlen, &m_mt))
- {
- m_mode = mp4a;
-
- startpos = GetPos() - (m_aachdr.fcrc ? 7 : 9);
-
- // make sure the first frame is followed by another of the same kind (validates m_aachdr basically)
- Seek(startpos + m_aachdr.aac_frame_length);
- if(!Sync(9)) m_mode = none;
- }
-
- if(m_mode == none)
- return E_FAIL;
-
- m_startpos = startpos;
-
- int FrameSize;
- REFERENCE_TIME rtFrameDur, rtPrevDur = -1;
- clock_t start = clock();
- int i = 0;
- while(Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC)
- {
- TRACE(_T("%I64d\n"), m_rtDuration);
- Seek(GetPos() + FrameSize);
- i = rtPrevDur == m_rtDuration ? i + 1 : 0;
- if(i == 10) break;
- rtPrevDur = m_rtDuration;
- }
-
- return S_OK;
+ m_startpos = 0;
+ m_endpos = GetLength();
+
+ Seek(0);
+
+ if(BitRead(24, true) == 0x000001)
+ return E_FAIL;
+
+ if(m_endpos > 128 && IsRandomAccess())
+ {
+ Seek(m_endpos - 128);
+
+ if(BitRead(24) == 'TAG')
+ {
+ m_endpos -= 128;
+
+ CStringA str;
+
+ // title
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['TIT2'] = CStringW(str).Trim();
+
+ // artist
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['TPE1'] = CStringW(str).Trim();
+
+ // album
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['TALB'] = CStringW(str).Trim();
+
+ // year
+ ByteRead((BYTE*)str.GetBufferSetLength(4), 4);
+ m_tags['TYER'] = CStringW(str).Trim();
+
+ // comment
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['COMM'] = CStringW(str).Trim();
+
+ // track
+ LPCSTR s = str;
+ if(s[28] == 0 && s[29] != 0)
+ m_tags['TRCK'].Format(L"%d", s[29]);
+
+ // genre
+ BYTE genre = (BYTE)BitRead(8);
+ if(genre < countof(s_genre))
+ m_tags['TCON'] = CStringW(s_genre[genre]);
+ }
+ }
+
+ Seek(0);
+
+ while(BitRead(24, true) == 'ID3')
+ {
+ BitRead(24);
+
+ BYTE major = (BYTE)BitRead(8);
+ BYTE revision = (BYTE)BitRead(8);
+
+ BYTE flags = (BYTE)BitRead(8);
+ DWORD size = 0;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7) << 21;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7) << 14;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7) << 7;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7);
+
+ m_startpos = GetPos() + size;
+
+ // TODO: read extended header
+
+ if(major <= 4)
+ {
+ __int64 pos = GetPos();
+
+ while(pos < m_startpos)
+ {
+ Seek(pos);
+
+ DWORD tag = (DWORD)BitRead(32);
+ DWORD size = 0;
+ size |= BitRead(8) << 24;
+ size |= BitRead(8) << 16;
+ size |= BitRead(8) << 8;
+ size |= BitRead(8);
+ WORD flags = (WORD)BitRead(16);
+
+ pos += 4+4+2+size;
+
+ if(!size || pos >= m_startpos)
+ break;
+
+ if(tag == 'TIT2'
+ || tag == 'TPE1'
+ || tag == 'TALB'
+ || tag == 'TYER'
+ || tag == 'COMM'
+ || tag == 'TRCK')
+ {
+ BYTE encoding = (BYTE)BitRead(8);
+ size--;
+
+ WORD bom = (WORD)BitRead(16, true);
+
+ CStringA str;
+ CStringW wstr;
+
+ if(encoding > 0 && size >= 2 && bom == 0xfffe)
+ {
+ BitRead(16);
+ size = (size - 2) / 2;
+ ByteRead((BYTE*)wstr.GetBufferSetLength(size), size*2);
+ m_tags[tag] = wstr.Trim();
+ }
+ else if(encoding > 0 && size >= 2 && bom == 0xfeff)
+ {
+ BitRead(16);
+ size = (size - 2) / 2;
+ ByteRead((BYTE*)wstr.GetBufferSetLength(size), size*2);
+ for(int i = 0, j = wstr.GetLength(); i < j; i++) wstr.SetAt(i, (wstr[i]<<8)|(wstr[i]>>8));
+ m_tags[tag] = wstr.Trim();
+ }
+ else
+ {
+ ByteRead((BYTE*)str.GetBufferSetLength(size), size);
+ m_tags[tag] = (encoding > 0 ? UTF8To16(str) : CStringW(str)).Trim();
+ }
+ }
+ }
+ }
+
+ Seek(m_startpos);
+
+ for(int i = 0; i < (1<<20) && m_startpos < m_endpos && BitRead(8, true) == 0; i++)
+ BitRead(8), m_startpos++;
+ }
+
+ __int64 searchlen = min(m_endpos - m_startpos, m_startpos > 0 ? 0x200 : 7);
+
+ __int64 startpos;
+
+ Seek(m_startpos);
+
+ if(m_mode == none && Read(m_mpahdr, searchlen, true, &m_mt))
+ {
+ m_mode = mpa;
+
+ startpos = GetPos() - 4;
+
+ // make sure the first frame is followed by another of the same kind (validates m_mpahdr basically)
+ Seek(startpos + m_mpahdr.FrameSize);
+ if(!Sync(4)) m_mode = none;
+ }
+
+ Seek(m_startpos);
+
+ if(m_mode == none && Read(m_aachdr, searchlen, &m_mt))
+ {
+ m_mode = mp4a;
+
+ startpos = GetPos() - (m_aachdr.fcrc?7:9);
+
+ // make sure the first frame is followed by another of the same kind (validates m_aachdr basically)
+ Seek(startpos + m_aachdr.aac_frame_length);
+ if(!Sync(9)) m_mode = none;
+ }
+
+ if(m_mode == none)
+ return E_FAIL;
+
+ m_startpos = startpos;
+
+ int FrameSize;
+ REFERENCE_TIME rtFrameDur, rtPrevDur = -1;
+ clock_t start = clock();
+ int i = 0;
+ while(Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC)
+ {
+ TRACE(_T("%I64d\n"), m_rtDuration);
+ Seek(GetPos() + FrameSize);
+ i = rtPrevDur == m_rtDuration ? i+1 : 0;
+ if(i == 10) break;
+ rtPrevDur = m_rtDuration;
+ }
+
+ return S_OK;
}
bool CMpaSplitterFile::Sync(int limit)
{
- int FrameSize;
- REFERENCE_TIME rtDuration;
- return Sync(FrameSize, rtDuration, limit);
+ int FrameSize;
+ REFERENCE_TIME rtDuration;
+ return Sync(FrameSize, rtDuration, limit);
}
bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limit)
{
- __int64 endpos = min(m_endpos, GetPos() + limit);
-
- if(m_mode == mpa)
- {
- while(GetPos() <= endpos - 4)
- {
- mpahdr h;
-
- if(Read(h, endpos - GetPos(), true)
- && m_mpahdr.version == h.version
- && m_mpahdr.layer == h.layer
- && m_mpahdr.channels == h.channels)
- {
- Seek(GetPos() - 4);
- AdjustDuration(h.nBytesPerSec);
-
- FrameSize = h.FrameSize;
- rtDuration = h.rtDuration;
-
- return true;
- }
- }
- }
- else if(m_mode == mp4a)
- {
- while(GetPos() <= endpos - 9)
- {
- aachdr h;
-
- if(Read(h, endpos - GetPos())
- && m_aachdr.version == h.version
- && m_aachdr.layer == h.layer
- && m_aachdr.channels == h.channels)
- {
- Seek(GetPos() - (h.fcrc ? 7 : 9));
- AdjustDuration(h.nBytesPerSec);
- Seek(GetPos() + (h.fcrc ? 7 : 9));
-
- FrameSize = h.FrameSize;
- rtDuration = h.rtDuration;
-
- return true;
- }
- }
- }
-
- return false;
+ __int64 endpos = min(m_endpos, GetPos() + limit);
+
+ if(m_mode == mpa)
+ {
+ while(GetPos() <= endpos - 4)
+ {
+ mpahdr h;
+
+ if(Read(h, endpos - GetPos(), true)
+ && m_mpahdr.version == h.version
+ && m_mpahdr.layer == h.layer
+ && m_mpahdr.channels == h.channels)
+ {
+ Seek(GetPos() - 4);
+ AdjustDuration(h.nBytesPerSec);
+
+ FrameSize = h.FrameSize;
+ rtDuration = h.rtDuration;
+
+ return true;
+ }
+ }
+ }
+ else if(m_mode == mp4a)
+ {
+ while(GetPos() <= endpos - 9)
+ {
+ aachdr h;
+
+ if(Read(h, endpos - GetPos())
+ && m_aachdr.version == h.version
+ && m_aachdr.layer == h.layer
+ && m_aachdr.channels == h.channels)
+ {
+ Seek(GetPos() - (h.fcrc?7:9));
+ AdjustDuration(h.nBytesPerSec);
+ Seek(GetPos() + (h.fcrc?7:9));
+
+ FrameSize = h.FrameSize;
+ rtDuration = h.rtDuration;
+
+ return true;
+ }
+ }
+ }
+
+ return false;
}
void CMpaSplitterFile::AdjustDuration(int nBytesPerSec)
{
- ASSERT(nBytesPerSec);
-
- int rValue;
- if(!m_pos2bps.Lookup(GetPos(), rValue))
- {
- m_totalbps += nBytesPerSec;
- if(!m_totalbps) return;
- m_pos2bps.SetAt(GetPos(), nBytesPerSec);
- __int64 avgbps = m_totalbps / m_pos2bps.GetCount();
- m_rtDuration = 10000000i64 * (m_endpos - m_startpos) / avgbps;
- }
+ ASSERT(nBytesPerSec);
+
+ int rValue;
+ if(!m_pos2bps.Lookup(GetPos(), rValue))
+ {
+ m_totalbps += nBytesPerSec;
+ if(!m_totalbps) return;
+ m_pos2bps.SetAt(GetPos(), nBytesPerSec);
+ __int64 avgbps = m_totalbps / m_pos2bps.GetCount();
+ m_rtDuration = 10000000i64 * (m_endpos - m_startpos) / avgbps;
+ }
}
diff --git a/src/filters/parser/MpaSplitter/MpaSplitterFile.h b/src/filters/parser/MpaSplitter/MpaSplitterFile.h
index cf392e48d..ee2e0d799 100644
--- a/src/filters/parser/MpaSplitter/MpaSplitterFile.h
+++ b/src/filters/parser/MpaSplitter/MpaSplitterFile.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,44 +25,32 @@
class CMpaSplitterFile : public CBaseSplitterFileEx
{
- CMediaType m_mt;
- REFERENCE_TIME m_rtDuration;
+ CMediaType m_mt;
+ REFERENCE_TIME m_rtDuration;
- enum {none, mpa, mp4a} m_mode;
+ enum {none, mpa, mp4a} m_mode;
- mpahdr m_mpahdr;
- aachdr m_aachdr;
- __int64 m_startpos, m_endpos;
+ mpahdr m_mpahdr;
+ aachdr m_aachdr;
+ __int64 m_startpos, m_endpos;
- __int64 m_totalbps;
- CRBMap<__int64, int> m_pos2bps;
+ __int64 m_totalbps;
+ CRBMap<__int64, int> m_pos2bps;
- HRESULT Init();
- void AdjustDuration(int nBytesPerSec);
+ HRESULT Init();
+ void AdjustDuration(int nBytesPerSec);
public:
- CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- CAtlMap<DWORD, CStringW> m_tags;
+ CAtlMap<DWORD, CStringW> m_tags;
- const CMediaType& GetMediaType()
- {
- return m_mt;
- }
- REFERENCE_TIME GetDuration()
- {
- return IsRandomAccess() ? m_rtDuration : 0;
- }
+ const CMediaType& GetMediaType() {return m_mt;}
+ REFERENCE_TIME GetDuration() {return IsRandomAccess() ? m_rtDuration : 0;}
- __int64 GetStartPos()
- {
- return m_startpos;
- }
- __int64 GetEndPos()
- {
- return m_endpos;
- }
+ __int64 GetStartPos() {return m_startpos;}
+ __int64 GetEndPos() {return m_endpos;}
- bool Sync(int limit = 0x2000);
- bool Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limit = 0x2000);
+ bool Sync(int limit = 0x2000);
+ bool Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limit = 0x2000);
};
diff --git a/src/filters/parser/MpaSplitter/resource.h b/src/filters/parser/MpaSplitter/resource.h
index 35d6f689e..c2fcfb22b 100644
--- a/src/filters/parser/MpaSplitter/resource.h
+++ b/src/filters/parser/MpaSplitter/resource.h
@@ -4,7 +4,7 @@
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/MpaSplitter/stdafx.cpp b/src/filters/parser/MpaSplitter/stdafx.cpp
index 9f8db70c3..845bd92b0 100644
--- a/src/filters/parser/MpaSplitter/stdafx.cpp
+++ b/src/filters/parser/MpaSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MpaSplitter/stdafx.h b/src/filters/parser/MpaSplitter/stdafx.h
index 2dff0522c..32d2f51d8 100644
--- a/src/filters/parser/MpaSplitter/stdafx.h
+++ b/src/filters/parser/MpaSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
index 52021c8af..732f23068 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* (C) 2003-2006 Gabest
* (C) 2006-2010 see AUTHORS
* http://www.gabest.org
@@ -7,15 +7,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,12 +33,12 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System},
// {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1VideoCD}, // cdxa filter should take care of this
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PROGRAM},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_TRANSPORT},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PVA},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PROGRAM},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_TRANSPORT},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PVA},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -49,33 +49,33 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMpegSplitterFilter), L"MPC - Mpeg Splitter (Gabest)", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CMpegSourceFilter), L"MPC - Mpeg Source (Gabest)", MERIT_UNLIKELY, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMpegSplitterFilter), L"MPC - Mpeg Splitter (Gabest)", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMpegSourceFilter), L"MPC - Mpeg Source (Gabest)", MERIT_UNLIKELY, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpegSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpegSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpegSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpegSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".ts"));
+ DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".ts"));
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG1System, _T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB"), NULL);
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_PROGRAM, _T("0,5,FFFFFFFFC0,000001BA40"), NULL);
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_PVA, _T("0,8,fffffc00ffe00000,4156000055000000"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG1System, _T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_PROGRAM, _T("0,5,FFFFFFFFC0,000001BA40"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_PVA, _T("0,8,fffffc00ffe00000,4156000055000000"), NULL);
- CAtlList<CString> chkbytes;
- chkbytes.AddTail(_T("0,1,,47,188,1,,47,376,1,,47"));
- chkbytes.AddTail(_T("4,1,,47,196,1,,47,388,1,,47"));
- chkbytes.AddTail(_T("0,4,,54467263,1660,1,,47")); // TFrc
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_TRANSPORT, chkbytes, NULL);
+ CAtlList<CString> chkbytes;
+ chkbytes.AddTail(_T("0,1,,47,188,1,,47,376,1,,47"));
+ chkbytes.AddTail(_T("4,1,,47,196,1,,47,388,1,,47"));
+ chkbytes.AddTail(_T("0,4,,54467263,1660,1,,47")); // TFrc
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_TRANSPORT, chkbytes, NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
@@ -83,7 +83,7 @@ STDAPI DllUnregisterServer()
// UnRegisterSourceFilter(MEDIASUBTYPE_MPEG1System);
// UnRegisterSourceFilter(MEDIASUBTYPE_MPEG2_PROGRAM);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -97,8 +97,8 @@ CFilterApp theApp;
//
CMpegSplitterFilter::CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
- : CBaseSplitterFilter(NAME("CMpegSplitterFilter"), pUnk, phr, clsid)
- , m_pPipoBimbo(false)
+ : CBaseSplitterFilter(NAME("CMpegSplitterFilter"), pUnk, phr, clsid)
+ , m_pPipoBimbo(false)
{
}
@@ -106,1050 +106,1014 @@ STDMETHODIMP CMpegSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void*
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IAMStreamSelect)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IAMStreamSelect)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
STDMETHODIMP CMpegSplitterFilter::GetClassID(CLSID* pClsID)
{
- CheckPointer(pClsID, E_POINTER);
-
- if(m_pPipoBimbo)
- {
- memcpy(pClsID, &CLSID_WMAsfReader, sizeof(GUID));
- return S_OK;
- }
- else
- return __super::GetClassID(pClsID);
+ CheckPointer (pClsID, E_POINTER);
+
+ if (m_pPipoBimbo)
+ {
+ memcpy (pClsID, &CLSID_WMAsfReader, sizeof (GUID));
+ return S_OK;
+ }
+ else
+ return __super::GetClassID(pClsID);
}
void CMpegSplitterFilter::ReadClipInfo(LPCOLESTR pszFileName)
{
- if(wcslen(pszFileName) > 0)
- {
- WCHAR Drive[_MAX_DRIVE];
- WCHAR Dir[_MAX_PATH];
- WCHAR Filename[_MAX_PATH];
- WCHAR Ext[_MAX_EXT];
-
- if(_wsplitpath_s(pszFileName, Drive, countof(Drive), Dir, countof(Dir), Filename, countof(Filename), Ext, countof(Ext)) == 0)
- {
- CString strClipInfo;
-
- if(Drive[0])
- strClipInfo.Format(_T("%s\\%s\\..\\CLIPINF\\%s.clpi"), Drive, Dir, Filename);
- else
- strClipInfo.Format(_T("%s\\..\\CLIPINF\\%s.clpi"), Dir, Filename);
-
- m_ClipInfo.ReadInfo(strClipInfo);
- }
- }
+ if (wcslen (pszFileName) > 0)
+ {
+ WCHAR Drive[_MAX_DRIVE];
+ WCHAR Dir[_MAX_PATH];
+ WCHAR Filename[_MAX_PATH];
+ WCHAR Ext[_MAX_EXT];
+
+ if (_wsplitpath_s (pszFileName, Drive, countof(Drive), Dir, countof(Dir), Filename, countof(Filename), Ext, countof(Ext)) == 0)
+ {
+ CString strClipInfo;
+
+ if (Drive[0])
+ strClipInfo.Format (_T("%s\\%s\\..\\CLIPINF\\%s.clpi"), Drive, Dir, Filename);
+ else
+ strClipInfo.Format (_T("%s\\..\\CLIPINF\\%s.clpi"), Dir, Filename);
+
+ m_ClipInfo.ReadInfo (strClipInfo);
+ }
+ }
}
STDMETHODIMP CMpegSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- HRESULT hr;
-
- return __super::Load(pszFileName, pmt);
+ HRESULT hr;
+
+ return __super::Load (pszFileName, pmt);
}
HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
{
- HRESULT hr;
- BYTE b;
-
- if(m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es)
- {
- if(!m_pFile->NextMpegStartCode(b))
- return S_FALSE;
-
- if(b == 0xba) // program stream header
- {
- CMpegSplitterFile::pshdr h;
- if(!m_pFile->Read(h))
- return S_FALSE;
- }
- else if(b == 0xbb) // program stream system header
- {
- CMpegSplitterFile::pssyshdr h;
- if(!m_pFile->Read(h))
- return S_FALSE;
- }
+ HRESULT hr;
+ BYTE b;
+
+ if(m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es)
+ {
+ if(!m_pFile->NextMpegStartCode(b))
+ return S_FALSE;
+
+ if(b == 0xba) // program stream header
+ {
+ CMpegSplitterFile::pshdr h;
+ if(!m_pFile->Read(h))
+ return S_FALSE;
+ }
+ else if(b == 0xbb) // program stream system header
+ {
+ CMpegSplitterFile::pssyshdr h;
+ if(!m_pFile->Read(h))
+ return S_FALSE;
+ }
#if (EVO_SUPPORT == 0)
- else if(b >= 0xbd && b < 0xf0) // pes packet
+ else if(b >= 0xbd && b < 0xf0) // pes packet
#else
- else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
+ else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
#endif
- {
- CMpegSplitterFile::peshdr h;
-
- if(!m_pFile->Read(h, b) || !h.len) return S_FALSE;
-
- if(h.type == CMpegSplitterFile::mpeg2 && h.scrambling)
- {
- ASSERT(0);
- return E_FAIL;
- }
-
- __int64 pos = m_pFile->GetPos();
-
- DWORD TrackNumber = m_pFile->AddStream(0, b, h.len);
-
- if(GetOutputPin(TrackNumber))
- {
- CAutoPtr<Packet> p(DNew Packet());
-
- p->TrackNumber = TrackNumber;
- p->bSyncPoint = !!h.fpts;
- p->bAppendable = !h.fpts;
- p->rtStart = h.fpts ? (h.pts - rtStartOffset) : Packet::INVALID_TIME;
- p->rtStop = p->rtStart + 1;
- p->SetCount(h.len - (size_t)(m_pFile->GetPos() - pos));
-
- m_pFile->ByteRead(p->GetData(), h.len - (m_pFile->GetPos() - pos));
-
- hr = DeliverPacket(p);
- }
- m_pFile->Seek(pos + h.len);
- }
- }
- else if(m_pFile->m_type == CMpegSplitterFile::ts)
- {
- CMpegSplitterFile::trhdr h;
-
- if(!m_pFile->Read(h))
- return S_FALSE;
-
-
- __int64 pos = m_pFile->GetPos();
-
- if(h.payload && h.payloadstart)
- m_pFile->UpdatePrograms(h);
-
- if(h.payload && h.pid >= 16 && h.pid < 0x1fff && !h.scrambling)
- {
- DWORD TrackNumber = h.pid;
-
- CMpegSplitterFile::peshdr h2;
-
- if(h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) // pes packet
- {
- if(h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling)
- {
- ASSERT(0);
- return E_FAIL;
- }
- TrackNumber = m_pFile->AddStream(h.pid, b, h.bytes - (DWORD)(m_pFile->GetPos() - pos));
- }
-
- if(GetOutputPin(TrackNumber))
- {
- CAutoPtr<Packet> p(DNew Packet());
-
- p->TrackNumber = TrackNumber;
- p->bSyncPoint = !!h2.fpts;
- p->bAppendable = !h2.fpts;
-
- if(h.fPCR)
- {
- CRefTime rtNow;
- StreamTime(rtNow);
- TRACE("Now=%S PCR=%S\n", ReftimeToString(rtNow.m_time), ReftimeToString(h.PCR));
- }
- if(h2.fpts && h.pid == 241)
- {
- TRACE("Sub=%S\n", ReftimeToString(h2.pts - rtStartOffset));
- }
-
- p->rtStart = h2.fpts ? (h2.pts - rtStartOffset) : Packet::INVALID_TIME;
- p->rtStop = p->rtStart + 1;
- p->SetCount(h.bytes - (size_t)(m_pFile->GetPos() - pos));
-
- int nBytes = int(h.bytes - (m_pFile->GetPos() - pos));
- m_pFile->ByteRead(p->GetData(), nBytes);
-
- hr = DeliverPacket(p);
- }
- }
-
- m_pFile->Seek(h.next);
- }
- else if(m_pFile->m_type == CMpegSplitterFile::pva)
- {
- CMpegSplitterFile::pvahdr h;
- if(!m_pFile->Read(h))
- return S_FALSE;
-
- DWORD TrackNumber = h.streamid;
-
- __int64 pos = m_pFile->GetPos();
-
- if(GetOutputPin(TrackNumber))
- {
- CAutoPtr<Packet> p(DNew Packet());
-
- p->TrackNumber = TrackNumber;
- p->bSyncPoint = !!h.fpts;
- p->bAppendable = !h.fpts;
- p->rtStart = h.fpts ? (h.pts - rtStartOffset) : Packet::INVALID_TIME;
- p->rtStop = p->rtStart + 1;
- p->SetCount(h.length);
-
- m_pFile->ByteRead(p->GetData(), h.length);
- hr = DeliverPacket(p);
- }
-
- m_pFile->Seek(pos + h.length);
- }
-
- return S_OK;
+ {
+ CMpegSplitterFile::peshdr h;
+
+ if(!m_pFile->Read(h, b) || !h.len) return S_FALSE;
+
+ if(h.type == CMpegSplitterFile::mpeg2 && h.scrambling)
+ {
+ ASSERT(0);
+ return E_FAIL;
+ }
+
+ __int64 pos = m_pFile->GetPos();
+
+ DWORD TrackNumber = m_pFile->AddStream(0, b, h.len);
+
+ if(GetOutputPin(TrackNumber))
+ {
+ CAutoPtr<Packet> p(DNew Packet());
+
+ p->TrackNumber = TrackNumber;
+ p->bSyncPoint = !!h.fpts;
+ p->bAppendable = !h.fpts;
+ p->rtStart = h.fpts ? (h.pts - rtStartOffset) : Packet::INVALID_TIME;
+ p->rtStop = p->rtStart+1;
+ p->SetCount(h.len - (size_t)(m_pFile->GetPos() - pos));
+
+ m_pFile->ByteRead(p->GetData(), h.len - (m_pFile->GetPos() - pos));
+
+ hr = DeliverPacket(p);
+ }
+ m_pFile->Seek(pos + h.len);
+ }
+ }
+ else if(m_pFile->m_type == CMpegSplitterFile::ts)
+ {
+ CMpegSplitterFile::trhdr h;
+
+ if(!m_pFile->Read(h))
+ return S_FALSE;
+
+
+ __int64 pos = m_pFile->GetPos();
+
+ if(h.payload && h.payloadstart)
+ m_pFile->UpdatePrograms(h);
+
+ if(h.payload && h.pid >= 16 && h.pid < 0x1fff && !h.scrambling)
+ {
+ DWORD TrackNumber = h.pid;
+
+ CMpegSplitterFile::peshdr h2;
+
+ if(h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) // pes packet
+ {
+ if(h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling)
+ {
+ ASSERT(0);
+ return E_FAIL;
+ }
+ TrackNumber = m_pFile->AddStream(h.pid, b, h.bytes - (DWORD)(m_pFile->GetPos() - pos));
+ }
+
+ if(GetOutputPin(TrackNumber))
+ {
+ CAutoPtr<Packet> p(DNew Packet());
+
+ p->TrackNumber = TrackNumber;
+ p->bSyncPoint = !!h2.fpts;
+ p->bAppendable = !h2.fpts;
+
+ if (h.fPCR)
+ {
+ CRefTime rtNow;
+ StreamTime(rtNow);
+ TRACE ("Now=%S PCR=%S\n", ReftimeToString(rtNow.m_time), ReftimeToString(h.PCR));
+ }
+ if (h2.fpts && h.pid == 241)
+ {
+ TRACE ("Sub=%S\n", ReftimeToString(h2.pts - rtStartOffset));
+ }
+
+ p->rtStart = h2.fpts ? (h2.pts - rtStartOffset) : Packet::INVALID_TIME;
+ p->rtStop = p->rtStart+1;
+ p->SetCount(h.bytes - (size_t)(m_pFile->GetPos() - pos));
+
+ int nBytes = int(h.bytes - (m_pFile->GetPos() - pos));
+ m_pFile->ByteRead(p->GetData(), nBytes);
+
+ hr = DeliverPacket(p);
+ }
+ }
+
+ m_pFile->Seek(h.next);
+ }
+ else if(m_pFile->m_type == CMpegSplitterFile::pva)
+ {
+ CMpegSplitterFile::pvahdr h;
+ if(!m_pFile->Read(h))
+ return S_FALSE;
+
+ DWORD TrackNumber = h.streamid;
+
+ __int64 pos = m_pFile->GetPos();
+
+ if(GetOutputPin(TrackNumber))
+ {
+ CAutoPtr<Packet> p(DNew Packet());
+
+ p->TrackNumber = TrackNumber;
+ p->bSyncPoint = !!h.fpts;
+ p->bAppendable = !h.fpts;
+ p->rtStart = h.fpts ? (h.pts - rtStartOffset) : Packet::INVALID_TIME;
+ p->rtStop = p->rtStart+1;
+ p->SetCount(h.length);
+
+ m_pFile->ByteRead(p->GetData(), h.length);
+ hr = DeliverPacket(p);
+ }
+
+ m_pFile->Seek(pos + h.length);
+ }
+
+ return S_OK;
}
//
HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
-
- ReadClipInfo(GetPartFilename(pAsyncReader));
- m_pFile.Attach(DNew CMpegSplitterFile(pAsyncReader, hr, m_ClipInfo.IsHdmv(), m_ClipInfo));
-
- if(!m_pFile) return E_OUTOFMEMORY;
-
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- // Create
- if(m_ClipInfo.IsHdmv())
- {
- for(int i = 0; i < m_ClipInfo.GetStreamNumber(); i++)
- {
- CHdmvClipInfo::Stream* stream = m_ClipInfo.GetStreamByIndex(i);
- if(stream->m_Type == PRESENTATION_GRAPHICS_STREAM)
- {
- m_pFile->AddHdmvPGStream(stream->m_PID, stream->m_LanguageCode);
- }
- }
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- for(int i = 0; i < countof(m_pFile->m_streams); i++)
- {
- POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos)
- {
- CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
-
- CAtlArray<CMediaType> mts;
- mts.Add(s.mt);
-
- CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMpegSplitterOutputPin(mts, name, this, this, &hr));
- if(i == CMpegSplitterFile::subpic)
- (static_cast<CMpegSplitterOutputPin*>(pPinOut.m_p))->SetMaxShift(_I64_MAX);
- if(S_OK == AddOutputPin(s, pPinOut))
- break;
- }
- }
-
- if(m_pFile->IsRandomAccess() && m_pFile->m_rate)
- {
- m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64 * m_pFile->GetLength() / m_pFile->m_rate;
- }
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ ReadClipInfo (GetPartFilename(pAsyncReader));
+ m_pFile.Attach(DNew CMpegSplitterFile(pAsyncReader, hr, m_ClipInfo.IsHdmv(), m_ClipInfo));
+
+ if(!m_pFile) return E_OUTOFMEMORY;
+
+ if(FAILED(hr))
+ {
+ m_pFile.Free();
+ return hr;
+ }
+
+ // Create
+ if (m_ClipInfo.IsHdmv())
+ {
+ for (int i=0; i<m_ClipInfo.GetStreamNumber(); i++)
+ {
+ CHdmvClipInfo::Stream* stream = m_ClipInfo.GetStreamByIndex (i);
+ if (stream->m_Type == PRESENTATION_GRAPHICS_STREAM)
+ {
+ m_pFile->AddHdmvPGStream (stream->m_PID, stream->m_LanguageCode);
+ }
+ }
+ }
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ for(int i = 0; i < countof(m_pFile->m_streams); i++)
+ {
+ POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
+ while(pos)
+ {
+ CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(s.mt);
+
+ CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMpegSplitterOutputPin(mts, name, this, this, &hr));
+ if (i == CMpegSplitterFile::subpic)
+ (static_cast<CMpegSplitterOutputPin*>(pPinOut.m_p))->SetMaxShift (_I64_MAX);
+ if(S_OK == AddOutputPin(s, pPinOut))
+ break;
+ }
+ }
+
+ if(m_pFile->IsRandomAccess() && m_pFile->m_rate)
+ {
+ m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64 * m_pFile->GetLength() / m_pFile->m_rate;
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CMpegSplitterFilter::DemuxInit()
{
- if(!m_pFile) return(false);
+ if(!m_pFile) return(false);
- m_rtStartOffset = 0;
+ m_rtStartOffset = 0;
- return(true);
+ return(true);
}
void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- CAtlList<CMpegSplitterFile::stream>* pMasterStream = m_pFile->GetMasterStream();
-
- if(!pMasterStream)
- {
- ASSERT(0);
- return;
- }
-
- if(m_pFile->IsStreaming())
- {
- m_pFile->Seek(max(0, m_pFile->GetLength() - 100 * 1024));
- m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead());
- return;
- }
-
- REFERENCE_TIME rtPreroll = 10000000;
-
- if(rt <= rtPreroll || m_rtDuration <= 0)
- {
- m_pFile->Seek(0);
- }
- else
- {
- __int64 len = m_pFile->GetLength();
- __int64 seekpos = (__int64)(1.0 * rt / m_rtDuration * len);
- __int64 minseekpos = _I64_MAX;
-
- REFERENCE_TIME rtmax = rt - rtPreroll;
- REFERENCE_TIME rtmin = rtmax - 5000000;
-
- if(m_rtStartOffset == 0)
- for(int i = 0; i < countof(m_pFile->m_streams) - 1; i++)
- {
- POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos)
- {
- DWORD TrackNum = m_pFile->m_streams[i].GetNext(pos);
-
- CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNum);
- if(pPin && pPin->IsConnected())
- {
- m_pFile->Seek(seekpos);
-
- REFERENCE_TIME pdt = _I64_MIN;
-
- for(int j = 0; j < 10; j++)
- {
- REFERENCE_TIME rt = m_pFile->NextPTS(TrackNum);
-
- if(rt < 0) break;
-
- REFERENCE_TIME dt = rt - rtmax;
- if(dt > 0 && dt == pdt) dt = 10000000i64;
-
-
- if(rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0)
- {
- minseekpos = min(minseekpos, m_pFile->GetPos());
- break;
- }
-
- m_pFile->Seek(m_pFile->GetPos() - (__int64)(1.0 * dt / m_rtDuration * len));
-
- pdt = dt;
- }
- }
- }
- }
-
- if(minseekpos != _I64_MAX)
- {
- seekpos = minseekpos;
- }
- else
- {
- // this file is probably screwed up, try plan B, seek simply by bitrate
-
- rt -= rtPreroll;
- seekpos = (__int64)(1.0 * rt / m_rtDuration * len);
- m_pFile->Seek(seekpos);
- m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead()) - rt;
- }
-
- m_pFile->Seek(seekpos);
- }
+ CAtlList<CMpegSplitterFile::stream>* pMasterStream = m_pFile->GetMasterStream();
+
+ if(!pMasterStream)
+ {
+ ASSERT(0);
+ return;
+ }
+
+ if(m_pFile->IsStreaming())
+ {
+ m_pFile->Seek(max(0, m_pFile->GetLength() - 100*1024));
+ m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead());
+ return;
+ }
+
+ REFERENCE_TIME rtPreroll = 10000000;
+
+ if(rt <= rtPreroll || m_rtDuration <= 0)
+ {
+ m_pFile->Seek(0);
+ }
+ else
+ {
+ __int64 len = m_pFile->GetLength();
+ __int64 seekpos = (__int64)(1.0*rt/m_rtDuration*len);
+ __int64 minseekpos = _I64_MAX;
+
+ REFERENCE_TIME rtmax = rt - rtPreroll;
+ REFERENCE_TIME rtmin = rtmax - 5000000;
+
+ if(m_rtStartOffset == 0)
+ for(int i = 0; i < countof(m_pFile->m_streams)-1; i++)
+ {
+ POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
+ while(pos)
+ {
+ DWORD TrackNum = m_pFile->m_streams[i].GetNext(pos);
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNum);
+ if(pPin && pPin->IsConnected())
+ {
+ m_pFile->Seek(seekpos);
+
+ REFERENCE_TIME pdt = _I64_MIN;
+
+ for(int j = 0; j < 10; j++)
+ {
+ REFERENCE_TIME rt = m_pFile->NextPTS(TrackNum);
+
+ if(rt < 0) break;
+
+ REFERENCE_TIME dt = rt - rtmax;
+ if(dt > 0 && dt == pdt) dt = 10000000i64;
+
+
+ if(rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0)
+ {
+ minseekpos = min(minseekpos, m_pFile->GetPos());
+ break;
+ }
+
+ m_pFile->Seek(m_pFile->GetPos() - (__int64)(1.0*dt/m_rtDuration*len));
+
+ pdt = dt;
+ }
+ }
+ }
+ }
+
+ if(minseekpos != _I64_MAX)
+ {
+ seekpos = minseekpos;
+ }
+ else
+ {
+ // this file is probably screwed up, try plan B, seek simply by bitrate
+
+ rt -= rtPreroll;
+ seekpos = (__int64)(1.0*rt/m_rtDuration*len);
+ m_pFile->Seek(seekpos);
+ m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead()) - rt;
+ }
+
+ m_pFile->Seek(seekpos);
+ }
}
bool CMpegSplitterFilter::DemuxLoop()
{
- REFERENCE_TIME rtStartOffset = m_rtStartOffset ? m_rtStartOffset : m_pFile->m_rtMin;
+ REFERENCE_TIME rtStartOffset = m_rtStartOffset ? m_rtStartOffset : m_pFile->m_rtMin;
- HRESULT hr = S_OK;
- while(SUCCEEDED(hr) && !CheckRequest(NULL))
- {
- if((hr = m_pFile->HasMoreData(1024 * 500)) == S_OK)
- if((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE)
- Sleep(1);
- }
+ HRESULT hr = S_OK;
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ if((hr = m_pFile->HasMoreData(1024*500)) == S_OK)
+ if((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE)
+ Sleep(1);
+ }
- return(true);
+ return(true);
}
bool CMpegSplitterFilter::BuildPlaylist(LPCTSTR pszFileName, CAtlList<CHdmvClipInfo::PlaylistItem>& Items)
{
- REFERENCE_TIME rtDuration;
- return SUCCEEDED(m_ClipInfo.ReadPlaylist(pszFileName, rtDuration, Items)) ? true : false;
+ REFERENCE_TIME rtDuration;
+ return SUCCEEDED (m_ClipInfo.ReadPlaylist (pszFileName, rtDuration, Items)) ? true : false;
}
// IAMStreamSelect
STDMETHODIMP CMpegSplitterFilter::Count(DWORD* pcStreams)
{
- CheckPointer(pcStreams, E_POINTER);
+ CheckPointer(pcStreams, E_POINTER);
- *pcStreams = 0;
+ *pcStreams = 0;
- for(int i = 0; i < countof(m_pFile->m_streams); i++)
- (*pcStreams) += m_pFile->m_streams[i].GetCount();
+ for(int i = 0; i < countof(m_pFile->m_streams); i++)
+ (*pcStreams) += m_pFile->m_streams[i].GetCount();
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE))
- return E_NOTIMPL;
-
- for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)
- {
- int cnt = m_pFile->m_streams[i].GetCount();
-
- if(lIndex >= j && lIndex < j + cnt)
- {
- lIndex -= j;
-
- POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
- if(!pos) return E_UNEXPECTED;
-
- CMpegSplitterFile::stream& to = m_pFile->m_streams[i].GetAt(pos);
-
- pos = m_pFile->m_streams[i].GetHeadPosition();
- while(pos)
- {
- CMpegSplitterFile::stream& from = m_pFile->m_streams[i].GetNext(pos);
- if(!GetOutputPin(from)) continue;
-
- HRESULT hr;
- if(FAILED(hr = RenameOutputPin(from, to, &to.mt)))
- return hr;
-
- // Don't rename other pin for Hdmv!
- int iProgram;
- const CHdmvClipInfo::Stream *pClipInfo;
- const CMpegSplitterFile::program* p = m_pFile->FindProgram(to.pid, iProgram, pClipInfo);
-
- if(p != NULL && !m_ClipInfo.IsHdmv() && !m_pFile->IsHdmv())
- {
- for(int k = 0; k < countof(m_pFile->m_streams); k++)
- {
- if(k == i) continue;
-
- pos = m_pFile->m_streams[k].GetHeadPosition();
- while(pos)
- {
- CMpegSplitterFile::stream& from = m_pFile->m_streams[k].GetNext(pos);
- if(!GetOutputPin(from)) continue;
-
- for(int l = 0; l < countof(p->streams); l++)
- {
- if(const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->streams[l].pid))
- {
- if(from != *s)
- hr = RenameOutputPin(from, *s, &s->mt);
- break;
- }
- }
- }
- }
- }
-
- return S_OK;
- }
- }
-
- j += cnt;
- }
-
- return S_FALSE;
+ if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE))
+ return E_NOTIMPL;
+
+ for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)
+ {
+ int cnt = m_pFile->m_streams[i].GetCount();
+
+ if(lIndex >= j && lIndex < j+cnt)
+ {
+ lIndex -= j;
+
+ POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
+ if(!pos) return E_UNEXPECTED;
+
+ CMpegSplitterFile::stream& to = m_pFile->m_streams[i].GetAt(pos);
+
+ pos = m_pFile->m_streams[i].GetHeadPosition();
+ while(pos)
+ {
+ CMpegSplitterFile::stream& from = m_pFile->m_streams[i].GetNext(pos);
+ if(!GetOutputPin(from)) continue;
+
+ HRESULT hr;
+ if(FAILED(hr = RenameOutputPin(from, to, &to.mt)))
+ return hr;
+
+ // Don't rename other pin for Hdmv!
+ int iProgram;
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const CMpegSplitterFile::program* p = m_pFile->FindProgram(to.pid, iProgram, pClipInfo);
+
+ if(p!=NULL && !m_ClipInfo.IsHdmv() && !m_pFile->IsHdmv())
+ {
+ for(int k = 0; k < countof(m_pFile->m_streams); k++)
+ {
+ if(k == i) continue;
+
+ pos = m_pFile->m_streams[k].GetHeadPosition();
+ while(pos)
+ {
+ CMpegSplitterFile::stream& from = m_pFile->m_streams[k].GetNext(pos);
+ if(!GetOutputPin(from)) continue;
+
+ for(int l = 0; l < countof(p->streams); l++)
+ {
+ if(const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->streams[l].pid))
+ {
+ if(from != *s)
+ hr = RenameOutputPin(from, *s, &s->mt);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return S_OK;
+ }
+ }
+
+ j += cnt;
+ }
+
+ return S_FALSE;
}
template <typename t_CType>
t_CType GetFormatHelper(t_CType &_pInfo, const CMediaType *_pFormat)
{
- ASSERT(_pFormat->cbFormat >= sizeof(*_pInfo));
- _pInfo = (t_CType)_pFormat->pbFormat;
- return _pInfo;
+ ASSERT(_pFormat->cbFormat >= sizeof(*_pInfo));
+ _pInfo = (t_CType)_pFormat->pbFormat;
+ return _pInfo;
}
static int GetHighestBitSet32(unsigned long _Value)
{
- unsigned long Ret;
- unsigned char bNonZero = _BitScanReverse(&Ret, _Value);
- if(bNonZero)
- return Ret;
- else
- return -1;
+ unsigned long Ret;
+ unsigned char bNonZero = _BitScanReverse(&Ret, _Value);
+ if (bNonZero)
+ return Ret;
+ else
+ return -1;
}
CString FormatBitrate(double _Bitrate)
{
- CString Temp;
- if(_Bitrate > 20000000) // More than 2 mbit
- Temp.Format(L"%.2f mbit/s", double(_Bitrate) / 1000000.0);
- else
- Temp.Format(L"%.1f kbit/s", double(_Bitrate) / 1000.0);
+ CString Temp;
+ if (_Bitrate > 20000000) // More than 2 mbit
+ Temp.Format(L"%.2f mbit/s", double(_Bitrate)/1000000.0);
+ else
+ Temp.Format(L"%.1f kbit/s", double(_Bitrate)/1000.0);
- return Temp;
+ return Temp;
}
-CString FormatString(const wchar_t *pszFormat, ...)
+CString FormatString(const wchar_t *pszFormat, ... )
{
- CString Temp;
- ATLASSERT(AtlIsValidString(pszFormat));
+ CString Temp;
+ ATLASSERT( AtlIsValidString( pszFormat ) );
- va_list argList;
- va_start(argList, pszFormat);
- Temp.FormatV(pszFormat, argList);
- va_end(argList);
+ va_list argList;
+ va_start( argList, pszFormat );
+ Temp.FormatV( pszFormat, argList );
+ va_end( argList );
- return Temp;
+ return Temp;
}
LONGLONG GetMediaTypeQuality(const CMediaType *_pMediaType, int _PresentationFormat)
{
- if(_pMediaType->formattype == FORMAT_WaveFormatEx)
- {
- __int64 Ret = 0;
-
- const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
- int TypePriority = 0;
-
- if(_pMediaType->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
- {
- TypePriority = 12;
- }
- else if(_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
- {
- TypePriority = 12;
- }
- else
- {
- if(_PresentationFormat == AUDIO_STREAM_DTS_HD_MASTER_AUDIO)
- TypePriority = 12;
- else if(_PresentationFormat == AUDIO_STREAM_DTS_HD)
- TypePriority = 11;
- else if(_PresentationFormat == AUDIO_STREAM_AC3_TRUE_HD)
- TypePriority = 12;
- else if(_PresentationFormat == AUDIO_STREAM_AC3_PLUS)
- TypePriority = 10;
- else
- {
- switch(pInfo->wFormatTag)
- {
- case WAVE_FORMAT_PS2_PCM:
- {
- TypePriority = 12;
- }
- break;
- case WAVE_FORMAT_PS2_ADPCM:
- {
- TypePriority = 4;
- }
- break;
- case WAVE_FORMAT_DVD_DTS:
- {
- TypePriority = 9;
- }
- break;
- case WAVE_FORMAT_DOLBY_AC3:
- {
- TypePriority = 8;
- }
- break;
- case WAVE_FORMAT_AAC:
- {
- TypePriority = 7;
- }
- break;
- case WAVE_FORMAT_MP3:
- {
- TypePriority = 6;
- }
- break;
- case WAVE_FORMAT_MPEG:
- {
- TypePriority = 5;
- }
- break;
- }
- }
- }
-
- Ret += __int64(TypePriority) * 100000000i64 * 1000000000i64;
-
- Ret += __int64(pInfo->nChannels) * 1000000i64 * 1000000000i64;
- Ret += __int64(pInfo->nSamplesPerSec) * 10i64 * 1000000000i64;
- Ret += __int64(pInfo->wBitsPerSample) * 10000000i64;
- Ret += __int64(pInfo->nAvgBytesPerSec);
-
- return Ret;
- }
-
- return 0;
+ if (_pMediaType->formattype == FORMAT_WaveFormatEx)
+ {
+ __int64 Ret = 0;
+
+ const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
+ int TypePriority = 0;
+
+ if (_pMediaType->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ TypePriority = 12;
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
+ {
+ TypePriority = 12;
+ }
+ else
+ {
+ if (_PresentationFormat == AUDIO_STREAM_DTS_HD_MASTER_AUDIO)
+ TypePriority = 12;
+ else if (_PresentationFormat == AUDIO_STREAM_DTS_HD)
+ TypePriority = 11;
+ else if (_PresentationFormat == AUDIO_STREAM_AC3_TRUE_HD)
+ TypePriority = 12;
+ else if (_PresentationFormat == AUDIO_STREAM_AC3_PLUS)
+ TypePriority = 10;
+ else
+ {
+ switch (pInfo->wFormatTag)
+ {
+ case WAVE_FORMAT_PS2_PCM:
+ {
+ TypePriority = 12;
+ }
+ break;
+ case WAVE_FORMAT_PS2_ADPCM:
+ {
+ TypePriority = 4;
+ }
+ break;
+ case WAVE_FORMAT_DVD_DTS:
+ {
+ TypePriority = 9;
+ }
+ break;
+ case WAVE_FORMAT_DOLBY_AC3:
+ {
+ TypePriority = 8;
+ }
+ break;
+ case WAVE_FORMAT_AAC:
+ {
+ TypePriority = 7;
+ }
+ break;
+ case WAVE_FORMAT_MP3:
+ {
+ TypePriority = 6;
+ }
+ break;
+ case WAVE_FORMAT_MPEG:
+ {
+ TypePriority = 5;
+ }
+ break;
+ }
+ }
+ }
+
+ Ret += __int64(TypePriority) * 100000000i64 * 1000000000i64;
+
+ Ret += __int64(pInfo->nChannels) * 1000000i64 * 1000000000i64;
+ Ret += __int64(pInfo->nSamplesPerSec) * 10i64 * 1000000000i64;
+ Ret += __int64(pInfo->wBitsPerSample) * 10000000i64;
+ Ret += __int64(pInfo->nAvgBytesPerSec);
+
+ return Ret;
+ }
+
+ return 0;
}
bool CMpegSplitterFile::stream::operator < (const stream &_Other) const
{
- if(mt.majortype == MEDIATYPE_Audio && _Other.mt.majortype == MEDIATYPE_Audio)
- {
- int iProgram0;
- const CHdmvClipInfo::Stream *pClipInfo0;
- const CMpegSplitterFile::program * pProgram0 = m_pFile->FindProgram(pid, iProgram0, pClipInfo0);
- int StreamType0 = pClipInfo0 ? pClipInfo0->m_Type : pProgram0 ? pProgram0->streams[iProgram0].type : 0;
- int iProgram1;
- const CHdmvClipInfo::Stream *pClipInfo1;
- const CMpegSplitterFile::program * pProgram1 = m_pFile->FindProgram(_Other.pid, iProgram1, pClipInfo1);
- int StreamType1 = pClipInfo1 ? pClipInfo1->m_Type : pProgram1 ? pProgram1->streams[iProgram1].type : 0;
-
- if(mt.formattype == FORMAT_WaveFormatEx && _Other.mt.formattype != FORMAT_WaveFormatEx)
- return true;
- if(mt.formattype != FORMAT_WaveFormatEx && _Other.mt.formattype == FORMAT_WaveFormatEx)
- return false;
-
- LONGLONG Quality0 = GetMediaTypeQuality(&mt, StreamType0);
- LONGLONG Quality1 = GetMediaTypeQuality(&_Other.mt, StreamType1);
- if(Quality0 > Quality1)
- return true;
- if(Quality0 < Quality1)
- return false;
- }
- DWORD DefaultFirst = *this;
- DWORD DefaultSecond = _Other;
- return DefaultFirst < DefaultSecond;
+ if (mt.majortype == MEDIATYPE_Audio && _Other.mt.majortype == MEDIATYPE_Audio)
+ {
+ int iProgram0;
+ const CHdmvClipInfo::Stream *pClipInfo0;
+ const CMpegSplitterFile::program * pProgram0 = m_pFile->FindProgram(pid, iProgram0, pClipInfo0);
+ int StreamType0 = pClipInfo0 ? pClipInfo0->m_Type : pProgram0 ? pProgram0->streams[iProgram0].type : 0;
+ int iProgram1;
+ const CHdmvClipInfo::Stream *pClipInfo1;
+ const CMpegSplitterFile::program * pProgram1 = m_pFile->FindProgram(_Other.pid, iProgram1, pClipInfo1);
+ int StreamType1 = pClipInfo1 ? pClipInfo1->m_Type : pProgram1 ? pProgram1->streams[iProgram1].type : 0;
+
+ if (mt.formattype == FORMAT_WaveFormatEx && _Other.mt.formattype != FORMAT_WaveFormatEx)
+ return true;
+ if (mt.formattype != FORMAT_WaveFormatEx && _Other.mt.formattype == FORMAT_WaveFormatEx)
+ return false;
+
+ LONGLONG Quality0 = GetMediaTypeQuality(&mt, StreamType0);
+ LONGLONG Quality1 = GetMediaTypeQuality(&_Other.mt, StreamType1);
+ if (Quality0 > Quality1)
+ return true;
+ if (Quality0 < Quality1)
+ return false;
+ }
+ DWORD DefaultFirst = *this;
+ DWORD DefaultSecond = _Other;
+ return DefaultFirst < DefaultSecond;
}
CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Stream *pClipInfo, int _PresentationType)
{
- const WCHAR *pPresentationDesc = NULL;
-
- if(pClipInfo)
- pPresentationDesc = StreamTypeToName(pClipInfo->m_Type);
- else
- pPresentationDesc = StreamTypeToName((PES_STREAM_TYPE)_PresentationType);
-
- CString MajorType;
- CAtlList<CString> Infos;
-
- if(_pMediaType->majortype == MEDIATYPE_Video)
- {
- MajorType = "Video";
-
- if(pClipInfo)
- {
- CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
-
- if(!name.IsEmpty())
- Infos.AddTail(name);
- }
-
- const VIDEOINFOHEADER *pVideoInfo = NULL;
- const VIDEOINFOHEADER2 *pVideoInfo2 = NULL;
-
- if(_pMediaType->formattype == FORMAT_MPEGVideo)
- {
- Infos.AddTail(L"MPEG");
-
- const MPEG1VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- pVideoInfo = &pInfo->hdr;
-
- }
- else if(_pMediaType->formattype == FORMAT_MPEG2_VIDEO)
- {
- const MPEG2VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- pVideoInfo2 = &pInfo->hdr;
-
- bool bIsAVC = false;
-
- if(pInfo->hdr.bmiHeader.biCompression == '1CVA')
- {
- bIsAVC = true;
- Infos.AddTail(L"AVC (H.264)");
- }
- else if(pInfo->hdr.bmiHeader.biCompression == 0)
- Infos.AddTail(L"MPEG2");
- else
- {
- WCHAR Temp[5];
- memset(Temp, 0, sizeof(Temp));
- Temp[0] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[1] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[2] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[3] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Infos.AddTail(Temp);
- }
-
- switch(pInfo->dwProfile)
- {
- case AM_MPEG2Profile_Simple:
- Infos.AddTail(L"Simple Profile");
- break;
- case AM_MPEG2Profile_Main:
- Infos.AddTail(L"Main Profile");
- break;
- case AM_MPEG2Profile_SNRScalable:
- Infos.AddTail(L"SNR Scalable Profile");
- break;
- case AM_MPEG2Profile_SpatiallyScalable:
- Infos.AddTail(L"Spatially Scalable Profile");
- break;
- case AM_MPEG2Profile_High:
- Infos.AddTail(L"High Profile");
- break;
- default:
- if(pInfo->dwProfile)
- {
- if(bIsAVC)
- {
- switch(pInfo->dwProfile)
- {
- case 44:
- Infos.AddTail(L"CAVLC Profile");
- break;
- case 66:
- Infos.AddTail(L"Baseline Profile");
- break;
- case 77:
- Infos.AddTail(L"Main Profile");
- break;
- case 88:
- Infos.AddTail(L"Extended Profile");
- break;
- case 100:
- Infos.AddTail(L"High Profile");
- break;
- case 110:
- Infos.AddTail(L"High 10 Profile");
- break;
- case 122:
- Infos.AddTail(L"High 4:2:2 Profile");
- break;
- case 244:
- Infos.AddTail(L"High 4:4:4 Profile");
- break;
-
- default:
- Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
- break;
- }
- }
- else
- Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
- }
- break;
- }
-
- switch(pInfo->dwLevel)
- {
- case AM_MPEG2Level_Low:
- Infos.AddTail(L"Low Level");
- break;
- case AM_MPEG2Level_Main:
- Infos.AddTail(L"Main Level");
- break;
- case AM_MPEG2Level_High1440:
- Infos.AddTail(L"High1440 Level");
- break;
- case AM_MPEG2Level_High:
- Infos.AddTail(L"High Level");
- break;
- default:
- if(pInfo->dwLevel)
- {
- if(bIsAVC)
- Infos.AddTail(FormatString(L"Level %1.1f", double(pInfo->dwLevel) / 10.0));
- else
- Infos.AddTail(FormatString(L"Level %d", pInfo->dwLevel));
- }
- break;
- }
- }
- else if(_pMediaType->formattype == FORMAT_VIDEOINFO2)
- {
- const VIDEOINFOHEADER2 *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- pVideoInfo2 = pInfo;
- bool bIsVC1 = false;
-
- DWORD CodecType = pInfo->bmiHeader.biCompression;
- if(CodecType == '1CVW')
- {
- bIsVC1 = true;
- Infos.AddTail(L"VC-1");
- }
- else if(CodecType)
- {
- WCHAR Temp[5];
- memset(Temp, 0, sizeof(Temp));
- Temp[0] = (CodecType >> 0) & 0xFF;
- Temp[1] = (CodecType >> 0) & 0xFF;
- Temp[2] = (CodecType >> 0) & 0xFF;
- Temp[3] = (CodecType >> 0) & 0xFF;
- Infos.AddTail(Temp);
- }
- }
- else if(_pMediaType->subtype == MEDIASUBTYPE_DVD_SUBPICTURE)
- {
- Infos.AddTail(L"DVD Sub Picture");
- }
- else if(_pMediaType->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
- {
- Infos.AddTail(L"SVCD Sub Picture");
- }
- else if(_pMediaType->subtype == MEDIASUBTYPE_CVD_SUBPICTURE)
- {
- Infos.AddTail(L"CVD Sub Picture");
- }
-
- if(pVideoInfo2)
- {
- if(pVideoInfo2->bmiHeader.biWidth && pVideoInfo2->bmiHeader.biHeight)
- Infos.AddTail(FormatString(L"%dx%d", pVideoInfo2->bmiHeader.biWidth, pVideoInfo2->bmiHeader.biHeight));
- if(pVideoInfo2->AvgTimePerFrame)
- Infos.AddTail(FormatString(L"%.3f fps", 10000000.0 / double(pVideoInfo2->AvgTimePerFrame)));
- if(pVideoInfo2->dwBitRate)
- Infos.AddTail(FormatBitrate(pVideoInfo2->dwBitRate));
- }
- else if(pVideoInfo)
- {
- if(pVideoInfo->bmiHeader.biWidth && pVideoInfo->bmiHeader.biHeight)
- Infos.AddTail(FormatString(L"%dx%d", pVideoInfo->bmiHeader.biWidth, pVideoInfo->bmiHeader.biHeight));
- if(pVideoInfo->AvgTimePerFrame)
- Infos.AddTail(FormatString(L"%.3f fps", 10000000.0 / double(pVideoInfo->AvgTimePerFrame)));
- if(pVideoInfo->dwBitRate)
- Infos.AddTail(FormatBitrate(pVideoInfo->dwBitRate));
- }
-
- }
- else if(_pMediaType->majortype == MEDIATYPE_Audio)
- {
- MajorType = "Audio";
- if(pClipInfo)
- {
- CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
- if(!name.IsEmpty())
- Infos.AddTail(name);
- }
- if(_pMediaType->formattype == FORMAT_WaveFormatEx)
- {
- const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- if(_pMediaType->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
- {
- Infos.AddTail(L"DVD LPCM");
- }
- else if(_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
- {
- const WAVEFORMATEX_HDMV_LPCM *pInfoHDMV = GetFormatHelper(pInfoHDMV, _pMediaType);
- Infos.AddTail(L"HDMV LPCM");
- }
- else
- {
- switch(pInfo->wFormatTag)
- {
- case WAVE_FORMAT_PS2_PCM:
- {
- Infos.AddTail(L"PS2 PCM");
- }
- break;
- case WAVE_FORMAT_PS2_ADPCM:
- {
- Infos.AddTail(L"PS2 ADPCM");
- }
- break;
- case WAVE_FORMAT_DVD_DTS:
- {
- if(pPresentationDesc)
- Infos.AddTail(pPresentationDesc);
- else
- Infos.AddTail(L"DTS");
- }
- break;
- case WAVE_FORMAT_DOLBY_AC3:
- {
- if(pPresentationDesc)
- Infos.AddTail(pPresentationDesc);
- else
- Infos.AddTail(L"Dolby Digital");
- }
- break;
- case WAVE_FORMAT_AAC:
- {
- Infos.AddTail(L"AAC");
- }
- break;
- case WAVE_FORMAT_MP3:
- {
- Infos.AddTail(L"MP3");
- }
- break;
- case WAVE_FORMAT_MPEG:
- {
- const MPEG1WAVEFORMAT* pInfoMPEG1 = GetFormatHelper(pInfoMPEG1, _pMediaType);
-
- int layer = GetHighestBitSet32(pInfoMPEG1->fwHeadLayer) + 1;
- Infos.AddTail(FormatString(L"MPEG1 - Layer %d", layer));
- }
- break;
- }
- }
-
- if(pClipInfo && (pClipInfo->m_SampleRate == BDVM_SampleRate_48_192 || pClipInfo->m_SampleRate == BDVM_SampleRate_48_96))
- {
- switch(pClipInfo->m_SampleRate)
- {
- case BDVM_SampleRate_48_192:
- Infos.AddTail(FormatString(L"192(48) kHz"));
- break;
- case BDVM_SampleRate_48_96:
- Infos.AddTail(FormatString(L"96(48) kHz"));
- break;
- }
- }
- else if(pInfo->nSamplesPerSec)
- Infos.AddTail(FormatString(L"%.1f kHz", double(pInfo->nSamplesPerSec) / 1000.0));
- if(pInfo->nChannels)
- Infos.AddTail(FormatString(L"%d chn", pInfo->nChannels));
- if(pInfo->wBitsPerSample)
- Infos.AddTail(FormatString(L"%d bit", pInfo->wBitsPerSample));
- if(pInfo->nAvgBytesPerSec)
- Infos.AddTail(FormatBitrate(pInfo->nAvgBytesPerSec * 8));
-
- }
- }
- else if(_pMediaType->majortype == MEDIATYPE_Subtitle)
- {
- MajorType = "Subtitle";
-
- if(pPresentationDesc)
- Infos.AddTail(pPresentationDesc);
-
- if(_pMediaType->cbFormat == sizeof(SUBTITLEINFO))
- {
- const SUBTITLEINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
- CString name = ISO6392ToLanguage(pInfo->IsoLang);
-
- if(pInfo->TrackName[0])
- Infos.AddHead(pInfo->TrackName);
- if(!name.IsEmpty())
- Infos.AddHead(name);
- }
- else
- {
- if(pClipInfo)
- {
- CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
- if(!name.IsEmpty())
- Infos.AddHead(name);
- }
- }
- }
-
- if(!Infos.IsEmpty())
- {
- CString Ret;
-
- Ret += MajorType;
- Ret += " - ";
-
- bool bFirst = true;
-
- for(POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos))
- {
- CString& String = Infos.GetAt(pos);
-
- if(bFirst)
- Ret += String;
- else
- Ret += L", " + String;
-
- bFirst = false;
- }
-
- return Ret;
- }
- return CString();
+ const WCHAR *pPresentationDesc = NULL;
+
+ if (pClipInfo)
+ pPresentationDesc = StreamTypeToName(pClipInfo->m_Type);
+ else
+ pPresentationDesc = StreamTypeToName((PES_STREAM_TYPE)_PresentationType);
+
+ CString MajorType;
+ CAtlList<CString> Infos;
+
+ if (_pMediaType->majortype == MEDIATYPE_Video)
+ {
+ MajorType = "Video";
+
+ if (pClipInfo)
+ {
+ CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
+
+ if (!name.IsEmpty())
+ Infos.AddTail(name);
+ }
+
+ const VIDEOINFOHEADER *pVideoInfo = NULL;
+ const VIDEOINFOHEADER2 *pVideoInfo2 = NULL;
+
+ if (_pMediaType->formattype == FORMAT_MPEGVideo)
+ {
+ Infos.AddTail(L"MPEG");
+
+ const MPEG1VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ pVideoInfo = &pInfo->hdr;
+
+ }
+ else if (_pMediaType->formattype == FORMAT_MPEG2_VIDEO)
+ {
+ const MPEG2VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ pVideoInfo2 = &pInfo->hdr;
+
+ bool bIsAVC = false;
+
+ if (pInfo->hdr.bmiHeader.biCompression == '1CVA')
+ {
+ bIsAVC = true;
+ Infos.AddTail(L"AVC (H.264)");
+ }
+ else if (pInfo->hdr.bmiHeader.biCompression == 0)
+ Infos.AddTail(L"MPEG2");
+ else
+ {
+ WCHAR Temp[5];
+ memset(Temp, 0, sizeof(Temp));
+ Temp[0] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[1] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[2] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[3] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Infos.AddTail(Temp);
+ }
+
+ switch (pInfo->dwProfile)
+ {
+ case AM_MPEG2Profile_Simple: Infos.AddTail(L"Simple Profile"); break;
+ case AM_MPEG2Profile_Main: Infos.AddTail(L"Main Profile"); break;
+ case AM_MPEG2Profile_SNRScalable: Infos.AddTail(L"SNR Scalable Profile"); break;
+ case AM_MPEG2Profile_SpatiallyScalable: Infos.AddTail(L"Spatially Scalable Profile"); break;
+ case AM_MPEG2Profile_High: Infos.AddTail(L"High Profile"); break;
+ default:
+ if (pInfo->dwProfile)
+ {
+ if (bIsAVC)
+ {
+ switch (pInfo->dwProfile)
+ {
+ case 44: Infos.AddTail(L"CAVLC Profile"); break;
+ case 66: Infos.AddTail(L"Baseline Profile"); break;
+ case 77: Infos.AddTail(L"Main Profile"); break;
+ case 88: Infos.AddTail(L"Extended Profile"); break;
+ case 100: Infos.AddTail(L"High Profile"); break;
+ case 110: Infos.AddTail(L"High 10 Profile"); break;
+ case 122: Infos.AddTail(L"High 4:2:2 Profile"); break;
+ case 244: Infos.AddTail(L"High 4:4:4 Profile"); break;
+
+ default: Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile)); break;
+ }
+ }
+ else
+ Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
+ }
+ break;
+ }
+
+ switch (pInfo->dwLevel)
+ {
+ case AM_MPEG2Level_Low: Infos.AddTail(L"Low Level"); break;
+ case AM_MPEG2Level_Main: Infos.AddTail(L"Main Level"); break;
+ case AM_MPEG2Level_High1440: Infos.AddTail(L"High1440 Level"); break;
+ case AM_MPEG2Level_High: Infos.AddTail(L"High Level"); break;
+ default:
+ if (pInfo->dwLevel)
+ {
+ if (bIsAVC)
+ Infos.AddTail(FormatString(L"Level %1.1f", double(pInfo->dwLevel)/10.0));
+ else
+ Infos.AddTail(FormatString(L"Level %d", pInfo->dwLevel));
+ }
+ break;
+ }
+ }
+ else if (_pMediaType->formattype == FORMAT_VIDEOINFO2)
+ {
+ const VIDEOINFOHEADER2 *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ pVideoInfo2 = pInfo;
+ bool bIsVC1 = false;
+
+ DWORD CodecType = pInfo->bmiHeader.biCompression;
+ if (CodecType == '1CVW')
+ {
+ bIsVC1 = true;
+ Infos.AddTail(L"VC-1");
+ }
+ else if (CodecType)
+ {
+ WCHAR Temp[5];
+ memset(Temp, 0, sizeof(Temp));
+ Temp[0] = (CodecType >> 0) & 0xFF;
+ Temp[1] = (CodecType >> 0) & 0xFF;
+ Temp[2] = (CodecType >> 0) & 0xFF;
+ Temp[3] = (CodecType >> 0) & 0xFF;
+ Infos.AddTail(Temp);
+ }
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_DVD_SUBPICTURE)
+ {
+ Infos.AddTail(L"DVD Sub Picture");
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
+ {
+ Infos.AddTail(L"SVCD Sub Picture");
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_CVD_SUBPICTURE)
+ {
+ Infos.AddTail(L"CVD Sub Picture");
+ }
+
+ if (pVideoInfo2)
+ {
+ if (pVideoInfo2->bmiHeader.biWidth && pVideoInfo2->bmiHeader.biHeight)
+ Infos.AddTail(FormatString(L"%dx%d", pVideoInfo2->bmiHeader.biWidth, pVideoInfo2->bmiHeader.biHeight));
+ if (pVideoInfo2->AvgTimePerFrame)
+ Infos.AddTail(FormatString(L"%.3f fps", 10000000.0/double(pVideoInfo2->AvgTimePerFrame)));
+ if (pVideoInfo2->dwBitRate)
+ Infos.AddTail(FormatBitrate(pVideoInfo2->dwBitRate));
+ }
+ else if (pVideoInfo)
+ {
+ if (pVideoInfo->bmiHeader.biWidth && pVideoInfo->bmiHeader.biHeight)
+ Infos.AddTail(FormatString(L"%dx%d", pVideoInfo->bmiHeader.biWidth, pVideoInfo->bmiHeader.biHeight));
+ if (pVideoInfo->AvgTimePerFrame)
+ Infos.AddTail(FormatString(L"%.3f fps", 10000000.0/double(pVideoInfo->AvgTimePerFrame)));
+ if (pVideoInfo->dwBitRate)
+ Infos.AddTail(FormatBitrate(pVideoInfo->dwBitRate));
+ }
+
+ }
+ else if (_pMediaType->majortype == MEDIATYPE_Audio)
+ {
+ MajorType = "Audio";
+ if (pClipInfo)
+ {
+ CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
+ if (!name.IsEmpty())
+ Infos.AddTail(name);
+ }
+ if (_pMediaType->formattype == FORMAT_WaveFormatEx)
+ {
+ const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ if (_pMediaType->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ Infos.AddTail(L"DVD LPCM");
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
+ {
+ const WAVEFORMATEX_HDMV_LPCM *pInfoHDMV = GetFormatHelper(pInfoHDMV, _pMediaType);
+ Infos.AddTail(L"HDMV LPCM");
+ }
+ else
+ {
+ switch (pInfo->wFormatTag)
+ {
+ case WAVE_FORMAT_PS2_PCM:
+ {
+ Infos.AddTail(L"PS2 PCM");
+ }
+ break;
+ case WAVE_FORMAT_PS2_ADPCM:
+ {
+ Infos.AddTail(L"PS2 ADPCM");
+ }
+ break;
+ case WAVE_FORMAT_DVD_DTS:
+ {
+ if (pPresentationDesc)
+ Infos.AddTail(pPresentationDesc);
+ else
+ Infos.AddTail(L"DTS");
+ }
+ break;
+ case WAVE_FORMAT_DOLBY_AC3:
+ {
+ if (pPresentationDesc)
+ Infos.AddTail(pPresentationDesc);
+ else
+ Infos.AddTail(L"Dolby Digital");
+ }
+ break;
+ case WAVE_FORMAT_AAC:
+ {
+ Infos.AddTail(L"AAC");
+ }
+ break;
+ case WAVE_FORMAT_MP3:
+ {
+ Infos.AddTail(L"MP3");
+ }
+ break;
+ case WAVE_FORMAT_MPEG:
+ {
+ const MPEG1WAVEFORMAT* pInfoMPEG1 = GetFormatHelper(pInfoMPEG1, _pMediaType);
+
+ int layer = GetHighestBitSet32(pInfoMPEG1->fwHeadLayer) + 1;
+ Infos.AddTail(FormatString(L"MPEG1 - Layer %d", layer));
+ }
+ break;
+ }
+ }
+
+ if (pClipInfo && (pClipInfo->m_SampleRate == BDVM_SampleRate_48_192 || pClipInfo->m_SampleRate == BDVM_SampleRate_48_96))
+ {
+ switch (pClipInfo->m_SampleRate)
+ {
+ case BDVM_SampleRate_48_192:
+ Infos.AddTail(FormatString(L"192(48) kHz"));
+ break;
+ case BDVM_SampleRate_48_96:
+ Infos.AddTail(FormatString(L"96(48) kHz"));
+ break;
+ }
+ }
+ else if (pInfo->nSamplesPerSec)
+ Infos.AddTail(FormatString(L"%.1f kHz", double(pInfo->nSamplesPerSec)/1000.0));
+ if (pInfo->nChannels)
+ Infos.AddTail(FormatString(L"%d chn", pInfo->nChannels));
+ if (pInfo->wBitsPerSample)
+ Infos.AddTail(FormatString(L"%d bit", pInfo->wBitsPerSample));
+ if (pInfo->nAvgBytesPerSec)
+ Infos.AddTail(FormatBitrate(pInfo->nAvgBytesPerSec * 8));
+
+ }
+ }
+ else if (_pMediaType->majortype == MEDIATYPE_Subtitle)
+ {
+ MajorType = "Subtitle";
+
+ if (pPresentationDesc)
+ Infos.AddTail(pPresentationDesc);
+
+ if (_pMediaType->cbFormat == sizeof(SUBTITLEINFO))
+ {
+ const SUBTITLEINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
+ CString name = ISO6392ToLanguage(pInfo->IsoLang);
+
+ if (pInfo->TrackName[0])
+ Infos.AddHead(pInfo->TrackName);
+ if (!name.IsEmpty())
+ Infos.AddHead(name);
+ }
+ else
+ {
+ if (pClipInfo)
+ {
+ CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
+ if (!name.IsEmpty())
+ Infos.AddHead(name);
+ }
+ }
+ }
+
+ if (!Infos.IsEmpty())
+ {
+ CString Ret;
+
+ Ret += MajorType;
+ Ret += " - ";
+
+ bool bFirst = true;
+
+ for(POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos))
+ {
+ CString& String = Infos.GetAt(pos);
+
+ if (bFirst)
+ Ret += String;
+ else
+ Ret += L", " + String;
+
+ bFirst = false;
+ }
+
+ return Ret;
+ }
+ return CString();
}
STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
{
- for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)
- {
- int cnt = m_pFile->m_streams[i].GetCount();
-
- if(lIndex >= j && lIndex < j + cnt)
- {
- lIndex -= j;
-
- POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
- if(!pos) return E_UNEXPECTED;
-
- CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetAt(pos);
- CHdmvClipInfo::Stream* pStream = m_ClipInfo.FindStream(s.pid);
-
- if(ppmt) *ppmt = CreateMediaType(&s.mt);
- if(pdwFlags) *pdwFlags = GetOutputPin(s) ? (AMSTREAMSELECTINFO_ENABLED | AMSTREAMSELECTINFO_EXCLUSIVE) : 0;
- if(plcid) *plcid = pStream ? pStream->m_LCID : 0;
- if(pdwGroup) *pdwGroup = i;
- if(ppObject) *ppObject = NULL;
- if(ppUnk) *ppUnk = NULL;
-
-
- if(ppszName)
- {
- CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
-
- CStringW str;
-
- if(i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID)
- {
- str = _T("No subtitles");
- *plcid = LCID_NOSUBTITLES;
- }
- else
- {
- int iProgram;
- const CHdmvClipInfo::Stream *pClipInfo;
- const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
- const wchar_t *pStreamName = NULL;
- int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
- pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
-
- CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType);
-
- if(!FormatDesc.IsEmpty())
- str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- else if(pStreamName)
- str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- else
- str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
- }
-
- *ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength() + 1) * sizeof(WCHAR));
- if(*ppszName == NULL) return E_OUTOFMEMORY;
-
- wcscpy_s(*ppszName, str.GetLength() + 1, str);
- }
- }
-
- j += cnt;
- }
-
- return S_OK;
+ for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)
+ {
+ int cnt = m_pFile->m_streams[i].GetCount();
+
+ if(lIndex >= j && lIndex < j+cnt)
+ {
+ lIndex -= j;
+
+ POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
+ if(!pos) return E_UNEXPECTED;
+
+ CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetAt(pos);
+ CHdmvClipInfo::Stream* pStream = m_ClipInfo.FindStream (s.pid);
+
+ if(ppmt) *ppmt = CreateMediaType(&s.mt);
+ if(pdwFlags) *pdwFlags = GetOutputPin(s) ? (AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE) : 0;
+ if(plcid) *plcid = pStream ? pStream->m_LCID : 0;
+ if(pdwGroup) *pdwGroup = i;
+ if(ppObject) *ppObject = NULL;
+ if(ppUnk) *ppUnk = NULL;
+
+
+ if(ppszName)
+ {
+ CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
+
+ CStringW str;
+
+ if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID)
+ {
+ str = _T("No subtitles");
+ *plcid = LCID_NOSUBTITLES;
+ }
+ else
+ {
+ int iProgram;
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
+ const wchar_t *pStreamName = NULL;
+ int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
+ pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
+
+ CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType);
+
+ if (!FormatDesc.IsEmpty())
+ str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ else if (pStreamName)
+ str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ else
+ str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ }
+
+ *ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
+ if(*ppszName == NULL) return E_OUTOFMEMORY;
+
+ wcscpy_s(*ppszName, str.GetLength()+1, str);
+ }
+ }
+
+ j += cnt;
+ }
+
+ return S_OK;
}
//
@@ -1157,9 +1121,9 @@ STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD*
//
CMpegSourceFilter::CMpegSourceFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
- : CMpegSplitterFilter(pUnk, phr, clsid)
+ : CMpegSplitterFilter(pUnk, phr, clsid)
{
- m_pInput.Free();
+ m_pInput.Free();
}
//
@@ -1167,9 +1131,9 @@ CMpegSourceFilter::CMpegSourceFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID&
//
CMpegSplitterOutputPin::CMpegSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
- , m_fHasAccessUnitDelimiters(false)
- , m_rtMaxShift(50000000)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ , m_fHasAccessUnitDelimiters(false)
+ , m_rtMaxShift(50000000)
{
}
@@ -1179,460 +1143,456 @@ CMpegSplitterOutputPin::~CMpegSplitterOutputPin()
HRESULT CMpegSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- {
- CAutoLock cAutoLock(this);
- m_rtPrev = Packet::INVALID_TIME;
- m_rtOffset = 0;
- }
+ {
+ CAutoLock cAutoLock(this);
+ m_rtPrev = Packet::INVALID_TIME;
+ m_rtOffset = 0;
+ }
- return __super::DeliverNewSegment(tStart, tStop, dRate);
+ return __super::DeliverNewSegment(tStart, tStop, dRate);
}
HRESULT CMpegSplitterOutputPin::DeliverEndFlush()
{
- {
- CAutoLock cAutoLock(this);
- m_p.Free();
- m_pl.RemoveAll();
- }
+ {
+ CAutoLock cAutoLock(this);
+ m_p.Free();
+ m_pl.RemoveAll();
+ }
- return __super::DeliverEndFlush();
+ return __super::DeliverEndFlush();
}
HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
- CAutoLock cAutoLock(this);
-
- if(p->rtStart != Packet::INVALID_TIME)
- {
- REFERENCE_TIME rt = p->rtStart + m_rtOffset;
-
- // Filter invalid PTS (if too different from previous packet)
- if(m_rtPrev != Packet::INVALID_TIME)
- if(_abs64(rt - m_rtPrev) > m_rtMaxShift)
- m_rtOffset += m_rtPrev - rt;
-
- p->rtStart += m_rtOffset;
- p->rtStop += m_rtOffset;
-
- m_rtPrev = p->rtStart;
- }
-
-
- if(p->pmt)
- {
- if(*((CMediaType *)p->pmt) != m_mt)
- SetMediaType((CMediaType*)p->pmt);
- }
-
-
- if(m_mt.subtype == MEDIASUBTYPE_AAC) // special code for aac, the currently available decoders only like whole frame samples
- {
- if(m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0))
- m_p.Free();
-
- if(!m_p)
- {
- BYTE* base = p->GetData();
- BYTE* s = base;
- BYTE* e = s + p->GetCount();
-
- for(; s < e; s++)
- {
- if(*s != 0xff) continue;
-
- if(s == e - 1 || (s[1] & 0xf6) == 0xf0)
- {
- memmove(base, s, e - s);
- p->SetCount(e - s);
- m_p = p;
- break;
- }
- }
- }
- else
- {
- m_p->Append(*p);
- }
-
- while(m_p && m_p->GetCount() > 9)
- {
- BYTE* base = m_p->GetData();
- BYTE* s = base;
- BYTE* e = s + m_p->GetCount();
- int len = ((s[3] & 3) << 11) | (s[4] << 3) | (s[5] >> 5);
- bool crc = !(s[1] & 1);
- s += 7;
- len -= 7;
- if(crc) s += 2, len -= 2;
-
- if(e - s < len)
- {
- break;
- }
-
- if(len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1] & 0xf6) != 0xf0))
- {
- m_p.Free();
- break;
- }
-
- CAutoPtr<Packet> p2(DNew Packet());
-
- p2->TrackNumber = m_p->TrackNumber;
- p2->bDiscontinuity |= m_p->bDiscontinuity;
- m_p->bDiscontinuity = false;
-
- p2->bSyncPoint = m_p->rtStart != Packet::INVALID_TIME;
- p2->rtStart = m_p->rtStart;
- m_p->rtStart = Packet::INVALID_TIME;
-
- p2->rtStop = m_p->rtStop;
- m_p->rtStop = Packet::INVALID_TIME;
- p2->pmt = m_p->pmt;
- m_p->pmt = NULL;
- p2->SetData(s, len);
-
- s += len;
- memmove(base, s, e - s);
- m_p->SetCount(e - s);
-
- HRESULT hr = __super::DeliverPacket(p2);
- if(hr != S_OK) return hr;
- }
-
- if(m_p && p)
- {
- if(!m_p->bDiscontinuity) m_p->bDiscontinuity = p->bDiscontinuity;
- if(!m_p->bSyncPoint) m_p->bSyncPoint = p->bSyncPoint;
- if(m_p->rtStart == Packet::INVALID_TIME) m_p->rtStart = p->rtStart, m_p->rtStop = p->rtStop;
- if(m_p->pmt) DeleteMediaType(m_p->pmt);
-
- m_p->pmt = p->pmt;
- p->pmt = NULL;
- }
-
- return S_OK;
- }
- else if(m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva')) // just like aac, this has to be starting nalus, more can be packed together
- {
- if(!m_p)
- {
- m_p.Attach(DNew Packet());
- m_p->TrackNumber = p->TrackNumber;
- m_p->bDiscontinuity = p->bDiscontinuity;
- p->bDiscontinuity = FALSE;
-
- m_p->bSyncPoint = p->bSyncPoint;
- p->bSyncPoint = FALSE;
-
- m_p->rtStart = p->rtStart;
- p->rtStart = Packet::INVALID_TIME;
-
- m_p->rtStop = p->rtStop;
- p->rtStop = Packet::INVALID_TIME;
- }
-
- m_p->Append(*p);
-
- BYTE* start = m_p->GetData();
- BYTE* end = start + m_p->GetCount();
-
- while(start <= end - 4 && *(DWORD*)start != 0x01000000) start++;
-
- while(start <= end - 4)
- {
- BYTE* next = start + 1;
-
- while(next <= end - 4 && *(DWORD*)next != 0x01000000) next++;
-
- if(next >= end - 4) break;
-
- int size = next - start;
-
- CH264Nalu Nalu;
- Nalu.SetBuffer(start, size, 0);
-
- CAutoPtr<Packet> p2;
-
- while(Nalu.ReadNext())
- {
- DWORD dwNalLength =
- ((Nalu.GetDataLength() >> 24) & 0x000000ff) |
- ((Nalu.GetDataLength() >> 8) & 0x0000ff00) |
- ((Nalu.GetDataLength() << 8) & 0x00ff0000) |
- ((Nalu.GetDataLength() << 24) & 0xff000000);
-
- CAutoPtr<Packet> p3(DNew Packet());
-
- p3->SetCount(Nalu.GetDataLength() + sizeof(dwNalLength));
- memcpy(p3->GetData(), &dwNalLength, sizeof(dwNalLength));
- memcpy(p3->GetData() + sizeof(dwNalLength), Nalu.GetDataBuffer(), Nalu.GetDataLength());
-
- if(p2 == NULL)
- p2 = p3;
- else
- p2->Append(*p3);
- }
-
- p2->TrackNumber = m_p->TrackNumber;
- p2->bDiscontinuity = m_p->bDiscontinuity;
- m_p->bDiscontinuity = FALSE;
-
- p2->bSyncPoint = m_p->bSyncPoint;
- m_p->bSyncPoint = FALSE;
-
- p2->rtStart = m_p->rtStart;
- m_p->rtStart = Packet::INVALID_TIME;
- p2->rtStop = m_p->rtStop;
- m_p->rtStop = Packet::INVALID_TIME;
-
- p2->pmt = m_p->pmt;
- m_p->pmt = NULL;
-
- m_pl.AddTail(p2);
-
- if(p->rtStart != Packet::INVALID_TIME)
- {
- m_p->rtStart = p->rtStart;
- m_p->rtStop = p->rtStop;
- p->rtStart = Packet::INVALID_TIME;
- }
- if(p->bDiscontinuity)
- {
- m_p->bDiscontinuity = p->bDiscontinuity;
- p->bDiscontinuity = FALSE;
- }
- if(p->bSyncPoint)
- {
- m_p->bSyncPoint = p->bSyncPoint;
- p->bSyncPoint = FALSE;
- }
- if(m_p->pmt)
- DeleteMediaType(m_p->pmt);
-
- m_p->pmt = p->pmt;
- p->pmt = NULL;
-
- start = next;
- }
- if(start > m_p->GetData())
- {
- m_p->RemoveAt(0, start - m_p->GetData());
- }
-
- for(POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos))
- {
- if(pos == m_pl.GetHeadPosition())
- continue;
-
- Packet* pPacket = m_pl.GetAt(pos);
- BYTE* pData = pPacket->GetData();
-
- if((pData[4] & 0x1f) == 0x09) m_fHasAccessUnitDelimiters = true;
-
- if((pData[4] & 0x1f) == 0x09 || !m_fHasAccessUnitDelimiters && pPacket->rtStart != Packet::INVALID_TIME)
- {
- p = m_pl.RemoveHead();
-
- while(pos != m_pl.GetHeadPosition())
- {
- CAutoPtr<Packet> p2 = m_pl.RemoveHead();
- p->Append(*p2);
- }
-
- HRESULT hr = __super::DeliverPacket(p);
- if(hr != S_OK) return hr;
- }
- }
-
- return S_OK;
- }
- else if(m_mt.subtype == FOURCCMap('1CVW') || m_mt.subtype == FOURCCMap('1cvw')) // just like aac, this has to be starting nalus, more can be packed together
- {
- if(!m_p)
- {
- m_p.Attach(DNew Packet());
- m_p->TrackNumber = p->TrackNumber;
- m_p->bDiscontinuity = p->bDiscontinuity;
- p->bDiscontinuity = FALSE;
-
- m_p->bSyncPoint = p->bSyncPoint;
- p->bSyncPoint = FALSE;
-
- m_p->rtStart = p->rtStart;
- p->rtStart = Packet::INVALID_TIME;
-
- m_p->rtStop = p->rtStop;
- p->rtStop = Packet::INVALID_TIME;
- }
-
- m_p->Append(*p);
-
- BYTE* start = m_p->GetData();
- BYTE* end = start + m_p->GetCount();
-
- bool bSeqFound = false;
- while(start <= end - 4)
- {
- if(*(DWORD*)start == 0x0D010000)
- {
- bSeqFound = true;
- break;
- }
- else if(*(DWORD*)start == 0x0F010000)
- break;
- start++;
- }
-
- while(start <= end - 4)
- {
- BYTE* next = start + 1;
-
- while(next <= end - 4)
- {
- if(*(DWORD*)next == 0x0D010000)
- {
- if(bSeqFound) break;
- bSeqFound = true;
- }
- else if(*(DWORD*)next == 0x0F010000)
- break;
- next++;
- }
-
- if(next >= end - 4) break;
-
- int size = next - start - 4;
-
-
- CAutoPtr<Packet> p2(DNew Packet());
- p2->TrackNumber = m_p->TrackNumber;
- p2->bDiscontinuity = m_p->bDiscontinuity;
- m_p->bDiscontinuity = FALSE;
-
- p2->bSyncPoint = m_p->bSyncPoint;
- m_p->bSyncPoint = FALSE;
-
- p2->rtStart = m_p->rtStart;
- m_p->rtStart = Packet::INVALID_TIME;
-
- p2->rtStop = m_p->rtStop;
- m_p->rtStop = Packet::INVALID_TIME;
-
- p2->pmt = m_p->pmt;
- m_p->pmt = NULL;
-
- p2->SetData(start, next - start);
-
- HRESULT hr = __super::DeliverPacket(p2);
- if(hr != S_OK) return hr;
-
- if(p->rtStart != Packet::INVALID_TIME)
- {
- m_p->rtStart = p->rtStart;
- m_p->rtStop = p->rtStop;
- p->rtStart = Packet::INVALID_TIME;
- }
- if(p->bDiscontinuity)
- {
- m_p->bDiscontinuity = p->bDiscontinuity;
- p->bDiscontinuity = FALSE;
- }
- if(p->bSyncPoint)
- {
- m_p->bSyncPoint = p->bSyncPoint;
- p->bSyncPoint = FALSE;
- }
- if(m_p->pmt)
- DeleteMediaType(m_p->pmt);
-
- m_p->pmt = p->pmt;
- p->pmt = NULL;
-
- start = next;
- bSeqFound = (*(DWORD*)start == 0x0D010000);
- }
-
- if(start > m_p->GetData())
- {
- m_p->RemoveAt(0, start - m_p->GetData());
- }
-
- return S_OK;
- }
- else if(m_mt.subtype == MEDIASUBTYPE_DTS || m_mt.subtype == MEDIASUBTYPE_WAVE_DTS) // DTS HD MA data is causing trouble, lets just remove it
- {
+ CAutoLock cAutoLock(this);
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ REFERENCE_TIME rt = p->rtStart + m_rtOffset;
+
+ // Filter invalid PTS (if too different from previous packet)
+ if(m_rtPrev != Packet::INVALID_TIME)
+ if(_abs64(rt - m_rtPrev) > m_rtMaxShift)
+ m_rtOffset += m_rtPrev - rt;
+
+ p->rtStart += m_rtOffset;
+ p->rtStop += m_rtOffset;
+
+ m_rtPrev = p->rtStart;
+ }
+
+
+ if (p->pmt)
+ {
+ if (*((CMediaType *)p->pmt) != m_mt)
+ SetMediaType ((CMediaType*)p->pmt);
+ }
+
+
+ if(m_mt.subtype == MEDIASUBTYPE_AAC) // special code for aac, the currently available decoders only like whole frame samples
+ {
+ if(m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0))
+ m_p.Free();
+
+ if(!m_p)
+ {
+ BYTE* base = p->GetData();
+ BYTE* s = base;
+ BYTE* e = s + p->GetCount();
+
+ for(; s < e; s++)
+ {
+ if(*s != 0xff) continue;
+
+ if(s == e-1 || (s[1]&0xf6) == 0xf0)
+ {
+ memmove(base, s, e - s);
+ p->SetCount(e - s);
+ m_p = p;
+ break;
+ }
+ }
+ }
+ else
+ {
+ m_p->Append(*p);
+ }
+
+ while(m_p && m_p->GetCount() > 9)
+ {
+ BYTE* base = m_p->GetData();
+ BYTE* s = base;
+ BYTE* e = s + m_p->GetCount();
+ int len = ((s[3]&3)<<11)|(s[4]<<3)|(s[5]>>5);
+ bool crc = !(s[1]&1);
+ s += 7; len -= 7;
+ if(crc) s += 2, len -= 2;
+
+ if(e - s < len)
+ {
+ break;
+ }
+
+ if(len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1]&0xf6) != 0xf0))
+ {
+ m_p.Free();
+ break;
+ }
+
+ CAutoPtr<Packet> p2(DNew Packet());
+
+ p2->TrackNumber = m_p->TrackNumber;
+ p2->bDiscontinuity |= m_p->bDiscontinuity;
+ m_p->bDiscontinuity = false;
+
+ p2->bSyncPoint = m_p->rtStart != Packet::INVALID_TIME;
+ p2->rtStart = m_p->rtStart;
+ m_p->rtStart = Packet::INVALID_TIME;
+
+ p2->rtStop = m_p->rtStop;
+ m_p->rtStop = Packet::INVALID_TIME;
+ p2->pmt = m_p->pmt; m_p->pmt = NULL;
+ p2->SetData(s, len);
+
+ s += len;
+ memmove(base, s, e - s);
+ m_p->SetCount(e - s);
+
+ HRESULT hr = __super::DeliverPacket(p2);
+ if(hr != S_OK) return hr;
+ }
+
+ if(m_p && p)
+ {
+ if(!m_p->bDiscontinuity) m_p->bDiscontinuity = p->bDiscontinuity;
+ if(!m_p->bSyncPoint) m_p->bSyncPoint = p->bSyncPoint;
+ if(m_p->rtStart == Packet::INVALID_TIME) m_p->rtStart = p->rtStart, m_p->rtStop = p->rtStop;
+ if(m_p->pmt) DeleteMediaType(m_p->pmt);
+
+ m_p->pmt = p->pmt;
+ p->pmt = NULL;
+ }
+
+ return S_OK;
+ }
+ else if(m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva')) // just like aac, this has to be starting nalus, more can be packed together
+ {
+ if(!m_p)
+ {
+ m_p.Attach(DNew Packet());
+ m_p->TrackNumber = p->TrackNumber;
+ m_p->bDiscontinuity = p->bDiscontinuity;
+ p->bDiscontinuity = FALSE;
+
+ m_p->bSyncPoint = p->bSyncPoint;
+ p->bSyncPoint = FALSE;
+
+ m_p->rtStart = p->rtStart;
+ p->rtStart = Packet::INVALID_TIME;
+
+ m_p->rtStop = p->rtStop;
+ p->rtStop = Packet::INVALID_TIME;
+ }
+
+ m_p->Append(*p);
+
+ BYTE* start = m_p->GetData();
+ BYTE* end = start + m_p->GetCount();
+
+ while(start <= end-4 && *(DWORD*)start != 0x01000000) start++;
+
+ while(start <= end-4)
+ {
+ BYTE* next = start+1;
+
+ while(next <= end-4 && *(DWORD*)next != 0x01000000) next++;
+
+ if(next >= end-4) break;
+
+ int size = next - start;
+
+ CH264Nalu Nalu;
+ Nalu.SetBuffer (start, size, 0);
+
+ CAutoPtr<Packet> p2;
+
+ while (Nalu.ReadNext())
+ {
+ DWORD dwNalLength =
+ ((Nalu.GetDataLength() >> 24) & 0x000000ff) |
+ ((Nalu.GetDataLength() >> 8) & 0x0000ff00) |
+ ((Nalu.GetDataLength() << 8) & 0x00ff0000) |
+ ((Nalu.GetDataLength() << 24) & 0xff000000);
+
+ CAutoPtr<Packet> p3(DNew Packet());
+
+ p3->SetCount (Nalu.GetDataLength()+sizeof(dwNalLength));
+ memcpy (p3->GetData(), &dwNalLength, sizeof(dwNalLength));
+ memcpy (p3->GetData()+sizeof(dwNalLength), Nalu.GetDataBuffer(), Nalu.GetDataLength());
+
+ if (p2 == NULL)
+ p2 = p3;
+ else
+ p2->Append(*p3);
+ }
+
+ p2->TrackNumber = m_p->TrackNumber;
+ p2->bDiscontinuity = m_p->bDiscontinuity;
+ m_p->bDiscontinuity = FALSE;
+
+ p2->bSyncPoint = m_p->bSyncPoint;
+ m_p->bSyncPoint = FALSE;
+
+ p2->rtStart = m_p->rtStart; m_p->rtStart = Packet::INVALID_TIME;
+ p2->rtStop = m_p->rtStop;
+ m_p->rtStop = Packet::INVALID_TIME;
+
+ p2->pmt = m_p->pmt; m_p->pmt = NULL;
+
+ m_pl.AddTail(p2);
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ m_p->rtStart = p->rtStart;
+ m_p->rtStop = p->rtStop;
+ p->rtStart = Packet::INVALID_TIME;
+ }
+ if(p->bDiscontinuity)
+ {
+ m_p->bDiscontinuity = p->bDiscontinuity;
+ p->bDiscontinuity = FALSE;
+ }
+ if(p->bSyncPoint)
+ {
+ m_p->bSyncPoint = p->bSyncPoint;
+ p->bSyncPoint = FALSE;
+ }
+ if(m_p->pmt)
+ DeleteMediaType(m_p->pmt);
+
+ m_p->pmt = p->pmt;
+ p->pmt = NULL;
+
+ start = next;
+ }
+ if(start > m_p->GetData())
+ {
+ m_p->RemoveAt(0, start - m_p->GetData());
+ }
+
+ for(POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos))
+ {
+ if(pos == m_pl.GetHeadPosition())
+ continue;
+
+ Packet* pPacket = m_pl.GetAt(pos);
+ BYTE* pData = pPacket->GetData();
+
+ if((pData[4]&0x1f) == 0x09) m_fHasAccessUnitDelimiters = true;
+
+ if((pData[4]&0x1f) == 0x09 || !m_fHasAccessUnitDelimiters && pPacket->rtStart != Packet::INVALID_TIME)
+ {
+ p = m_pl.RemoveHead();
+
+ while(pos != m_pl.GetHeadPosition())
+ {
+ CAutoPtr<Packet> p2 = m_pl.RemoveHead();
+ p->Append(*p2);
+ }
+
+ HRESULT hr = __super::DeliverPacket(p);
+ if(hr != S_OK) return hr;
+ }
+ }
+
+ return S_OK;
+ }
+ else if(m_mt.subtype == FOURCCMap('1CVW') || m_mt.subtype == FOURCCMap('1cvw')) // just like aac, this has to be starting nalus, more can be packed together
+ {
+ if(!m_p)
+ {
+ m_p.Attach(DNew Packet());
+ m_p->TrackNumber = p->TrackNumber;
+ m_p->bDiscontinuity = p->bDiscontinuity;
+ p->bDiscontinuity = FALSE;
+
+ m_p->bSyncPoint = p->bSyncPoint;
+ p->bSyncPoint = FALSE;
+
+ m_p->rtStart = p->rtStart;
+ p->rtStart = Packet::INVALID_TIME;
+
+ m_p->rtStop = p->rtStop;
+ p->rtStop = Packet::INVALID_TIME;
+ }
+
+ m_p->Append(*p);
+
+ BYTE* start = m_p->GetData();
+ BYTE* end = start + m_p->GetCount();
+
+ bool bSeqFound = false;
+ while(start <= end-4)
+ {
+ if (*(DWORD*)start == 0x0D010000)
+ {
+ bSeqFound = true;
+ break;
+ }
+ else if (*(DWORD*)start == 0x0F010000)
+ break;
+ start++;
+ }
+
+ while(start <= end-4)
+ {
+ BYTE* next = start+1;
+
+ while(next <= end-4)
+ {
+ if (*(DWORD*)next == 0x0D010000)
+ {
+ if (bSeqFound) break;
+ bSeqFound = true;
+ }
+ else if (*(DWORD*)next == 0x0F010000)
+ break;
+ next++;
+ }
+
+ if(next >= end-4) break;
+
+ int size = next - start - 4;
+
+
+ CAutoPtr<Packet> p2(DNew Packet());
+ p2->TrackNumber = m_p->TrackNumber;
+ p2->bDiscontinuity = m_p->bDiscontinuity;
+ m_p->bDiscontinuity = FALSE;
+
+ p2->bSyncPoint = m_p->bSyncPoint;
+ m_p->bSyncPoint = FALSE;
+
+ p2->rtStart = m_p->rtStart;
+ m_p->rtStart = Packet::INVALID_TIME;
+
+ p2->rtStop = m_p->rtStop;
+ m_p->rtStop = Packet::INVALID_TIME;
+
+ p2->pmt = m_p->pmt;
+ m_p->pmt = NULL;
+
+ p2->SetData(start, next - start);
+
+ HRESULT hr = __super::DeliverPacket(p2);
+ if(hr != S_OK) return hr;
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ m_p->rtStart = p->rtStart;
+ m_p->rtStop = p->rtStop;
+ p->rtStart = Packet::INVALID_TIME;
+ }
+ if(p->bDiscontinuity)
+ {
+ m_p->bDiscontinuity = p->bDiscontinuity;
+ p->bDiscontinuity = FALSE;
+ }
+ if(p->bSyncPoint)
+ {
+ m_p->bSyncPoint = p->bSyncPoint;
+ p->bSyncPoint = FALSE;
+ }
+ if(m_p->pmt)
+ DeleteMediaType(m_p->pmt);
+
+ m_p->pmt = p->pmt;
+ p->pmt = NULL;
+
+ start = next;
+ bSeqFound = (*(DWORD*)start == 0x0D010000);
+ }
+
+ if(start > m_p->GetData())
+ {
+ m_p->RemoveAt(0, start - m_p->GetData());
+ }
+
+ return S_OK;
+ }
+ else if (m_mt.subtype == MEDIASUBTYPE_DTS || m_mt.subtype == MEDIASUBTYPE_WAVE_DTS) // DTS HD MA data is causing trouble, lets just remove it
+ {
#if 0
- BYTE* start = p->GetData();
- BYTE* end = start + p->GetCount();
- if(end - start < 4 && !p->pmt)
- return S_OK; // Should be invalid packet
-
- BYTE* hdr = start;
-
-
- int Type;
- // 16 bits big endian bitstream
- if(hdr[0] == 0x7f && hdr[1] == 0xfe &&
- hdr[2] == 0x80 && hdr[3] == 0x01)
- Type = 16 + 32;
-
- // 16 bits low endian bitstream
- else if(hdr[0] == 0xfe && hdr[1] == 0x7f &&
- hdr[2] == 0x01 && hdr[3] == 0x80)
- Type = 16;
-
- // 14 bits big endian bitstream
- else if(hdr[0] == 0x1f && hdr[1] == 0xff &&
- hdr[2] == 0xe8 && hdr[3] == 0x00 &&
- hdr[4] == 0x07 && (hdr[5] & 0xf0) == 0xf0)
- Type = 14 + 32;
-
- // 14 bits low endian bitstream
- else if(hdr[0] == 0xff && hdr[1] == 0x1f &&
- hdr[2] == 0x00 && hdr[3] == 0xe8 &&
- (hdr[4] & 0xf0) == 0xf0 && hdr[5] == 0x07)
- Type = 14;
-
- // no sync
- else if(!p->pmt)
- {
- return S_OK;
- }
+ BYTE* start = p->GetData();
+ BYTE* end = start + p->GetCount();
+ if (end - start < 4 && !p->pmt)
+ return S_OK; // Should be invalid packet
+
+ BYTE* hdr = start;
+
+
+ int Type;
+ // 16 bits big endian bitstream
+ if (hdr[0] == 0x7f && hdr[1] == 0xfe &&
+ hdr[2] == 0x80 && hdr[3] == 0x01)
+ Type = 16 + 32;
+
+ // 16 bits low endian bitstream
+ else if (hdr[0] == 0xfe && hdr[1] == 0x7f &&
+ hdr[2] == 0x01 && hdr[3] == 0x80)
+ Type = 16;
+
+ // 14 bits big endian bitstream
+ else if (hdr[0] == 0x1f && hdr[1] == 0xff &&
+ hdr[2] == 0xe8 && hdr[3] == 0x00 &&
+ hdr[4] == 0x07 && (hdr[5] & 0xf0) == 0xf0)
+ Type = 14 + 32;
+
+ // 14 bits low endian bitstream
+ else if (hdr[0] == 0xff && hdr[1] == 0x1f &&
+ hdr[2] == 0x00 && hdr[3] == 0xe8 &&
+ (hdr[4] & 0xf0) == 0xf0 && hdr[5] == 0x07)
+ Type = 14;
+
+ // no sync
+ else if (!p->pmt)
+ {
+ return S_OK;
+ }
#endif
- }
- else if(m_mt.subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
- {
- BYTE* start = p->GetData();
- p->SetData(start + 4, p->GetCount() - 4);
- }
- else
- {
- m_p.Free();
- m_pl.RemoveAll();
- }
-
- return __super::DeliverPacket(p);
+ }
+ else if (m_mt.subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
+ {
+ BYTE* start = p->GetData();
+ p->SetData(start + 4, p->GetCount() - 4);
+ }
+ else
+ {
+ m_p.Free();
+ m_pl.RemoveAll();
+ }
+
+ return __super::DeliverPacket(p);
}
STDMETHODIMP CMpegSplitterOutputPin::Connect(IPin* pReceivePin, const AM_MEDIA_TYPE* pmt)
{
- HRESULT hr;
- PIN_INFO PinInfo;
- GUID FilterClsid;
-
- if(SUCCEEDED(pReceivePin->QueryPinInfo(&PinInfo)))
- {
- if(SUCCEEDED(PinInfo.pFilter->GetClassID(&FilterClsid)) && (FilterClsid == CLSID_DMOWrapperFilter))
- (static_cast<CMpegSplitterFilter*>(m_pFilter))->SetPipo(true);
- PinInfo.pFilter->Release();
- }
-
- hr = __super::Connect(pReceivePin, pmt);
- (static_cast<CMpegSplitterFilter*>(m_pFilter))->SetPipo(false);
- return hr;
+ HRESULT hr;
+ PIN_INFO PinInfo;
+ GUID FilterClsid;
+
+ if (SUCCEEDED (pReceivePin->QueryPinInfo (&PinInfo)))
+ {
+ if (SUCCEEDED (PinInfo.pFilter->GetClassID(&FilterClsid)) && (FilterClsid == CLSID_DMOWrapperFilter))
+ (static_cast<CMpegSplitterFilter*>(m_pFilter))->SetPipo(true);
+ PinInfo.pFilter->Release();
+ }
+
+ hr = __super::Connect (pReceivePin, pmt);
+ (static_cast<CMpegSplitterFilter*>(m_pFilter))->SetPipo(false);
+ return hr;
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.h b/src/filters/parser/MpegSplitter/MpegSplitter.h
index c99aa20a5..fb20de487 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.h
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,66 +27,60 @@
[uuid("DC257063-045F-4BE2-BD5B-E12279C464F0")]
class CMpegSplitterFilter : public CBaseSplitterFilter, public IAMStreamSelect
{
- REFERENCE_TIME m_rtStartOffset;
- bool m_pPipoBimbo;
- CHdmvClipInfo m_ClipInfo;
+ REFERENCE_TIME m_rtStartOffset;
+ bool m_pPipoBimbo;
+ CHdmvClipInfo m_ClipInfo;
protected:
- CAutoPtr<CMpegSplitterFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- void ReadClipInfo(LPCOLESTR pszFileName);
+ CAutoPtr<CMpegSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ void ReadClipInfo(LPCOLESTR pszFileName);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
- bool BuildPlaylist(LPCTSTR pszFileName, CAtlList<CHdmvClipInfo::PlaylistItem>& files);
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+ bool BuildPlaylist(LPCTSTR pszFileName, CAtlList<CHdmvClipInfo::PlaylistItem>& files);
- HRESULT DemuxNextPacket(REFERENCE_TIME rtStartOffset);
+ HRESULT DemuxNextPacket(REFERENCE_TIME rtStartOffset);
public:
- CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid = __uuidof(CMpegSplitterFilter));
- void SetPipo(bool bPipo)
- {
- m_pPipoBimbo = bPipo;
- };
+ CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid = __uuidof(CMpegSplitterFilter));
+ void SetPipo(bool bPipo) { m_pPipoBimbo = bPipo; };
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- STDMETHODIMP GetClassID(CLSID* pClsID);
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetClassID(CLSID* pClsID);
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- // IAMStreamSelect
+ // IAMStreamSelect
- STDMETHODIMP Count(DWORD* pcStreams);
- STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
- STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
+ STDMETHODIMP Count(DWORD* pcStreams);
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+ STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
};
[uuid("1365BE7A-C86A-473C-9A41-C0A6E82C9FA3")]
class CMpegSourceFilter : public CMpegSplitterFilter
{
public:
- CMpegSourceFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid = __uuidof(CMpegSourceFilter));
+ CMpegSourceFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid = __uuidof(CMpegSourceFilter));
};
class CMpegSplitterOutputPin : public CBaseSplitterOutputPin, protected CCritSec
{
- CAutoPtr<Packet> m_p;
- CAutoPtrList<Packet> m_pl;
- REFERENCE_TIME m_rtPrev, m_rtOffset, m_rtMaxShift;
- bool m_fHasAccessUnitDelimiters;
+ CAutoPtr<Packet> m_p;
+ CAutoPtrList<Packet> m_pl;
+ REFERENCE_TIME m_rtPrev, m_rtOffset, m_rtMaxShift;
+ bool m_fHasAccessUnitDelimiters;
protected:
- HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- HRESULT DeliverPacket(CAutoPtr<Packet> p);
- HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
+ HRESULT DeliverEndFlush();
public:
- CMpegSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CMpegSplitterOutputPin();
- STDMETHODIMP Connect(IPin* pReceivePin, const AM_MEDIA_TYPE* pmt);
- void SetMaxShift(REFERENCE_TIME rtMaxShift)
- {
- m_rtMaxShift = rtMaxShift;
- };
+ CMpegSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMpegSplitterOutputPin();
+ STDMETHODIMP Connect(IPin* pReceivePin, const AM_MEDIA_TYPE* pmt);
+ void SetMaxShift(REFERENCE_TIME rtMaxShift) { m_rtMaxShift = rtMaxShift; };
};
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
index 07ef13d37..a955a54f7 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,789 +30,777 @@
#define ISVALIDPID(pid) (pid >= 0x10 && pid < 0x1fff)
CMpegSplitterFile::CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bool bIsHdmv, CHdmvClipInfo &ClipInfo)
- : CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false, true)
- , m_type(us)
- , m_rate(0)
- , m_rtMin(0), m_rtMax(0)
- , m_posMin(0), m_posMax(0)
- , m_bIsHdmv(bIsHdmv)
- , m_ClipInfo(ClipInfo)
+ : CBaseSplitterFileEx(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false, true)
+ , m_type(us)
+ , m_rate(0)
+ , m_rtMin(0), m_rtMax(0)
+ , m_posMin(0), m_posMax(0)
+ , m_bIsHdmv(bIsHdmv)
+ , m_ClipInfo(ClipInfo)
{
- // Ugly code : to support BRD seamless playback, CMultiFiles need to update m_rtPTSOffset variable
- // each time a new part is open...
- CComQIPtr<ISyncReader> pReader = pAsyncReader;
- if(pReader) pReader->SetPTSOffset(&m_rtPTSOffset);
+ // Ugly code : to support BRD seamless playback, CMultiFiles need to update m_rtPTSOffset variable
+ // each time a new part is open...
+ CComQIPtr<ISyncReader> pReader = pAsyncReader;
+ if (pReader) pReader->SetPTSOffset (&m_rtPTSOffset);
- if(SUCCEEDED(hr)) hr = Init();
+ if(SUCCEEDED(hr)) hr = Init();
}
HRESULT CMpegSplitterFile::Init()
{
- HRESULT hr;
-
- // get the type first
-
- m_type = us;
-
- Seek(0);
-
- if(m_type == us)
- {
- if(BitRead(32, true) == 'TFrc') Seek(0x67c);
- int cnt = 0, limit = 4;
- for(trhdr h; cnt < limit && Read(h); cnt++) Seek(h.next);
- if(cnt >= limit) m_type = ts;
- }
-
- Seek(0);
-
- if(m_type == us)
- {
- int cnt = 0, limit = 4;
- for(pvahdr h; cnt < limit && Read(h); cnt++) Seek(GetPos() + h.length);
- if(cnt >= limit) m_type = pva;
- }
-
- Seek(0);
-
- if(m_type == us)
- {
- BYTE b;
- for(int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++)
- {
- if(b == 0xba)
- {
- pshdr h;
- if(Read(h))
- {
- m_type = ps;
- m_rate = int(h.bitrate / 8);
- break;
- }
- }
- else if((b & 0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
- || (b & 0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
- // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
- || b == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
- {
- peshdr h;
- if(Read(h, b) && BitRead(24, true) == 0x000001)
- m_type = es;
- }
- }
- }
-
- Seek(0);
-
- if(m_type == us)
- return E_FAIL;
-
- // min/max pts & bitrate
- m_rtMin = m_posMin = _I64_MAX;
- m_rtMax = m_posMax = 0;
-
- if(IsRandomAccess() || IsStreaming())
- {
- if(IsStreaming())
- {
- for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024 * 100, 100); i++);
- }
-
- CAtlList<__int64> fps;
- for(int i = 0, j = 5; i <= j; i++)
- fps.AddTail(i * GetLength() / j);
-
- for(__int64 pfp = 0; fps.GetCount();)
- {
- __int64 fp = fps.RemoveHead();
- fp = min(GetLength() - MEGABYTE / 8, fp);
- fp = max(pfp, fp);
- __int64 nfp = fp + (pfp == 0 ? 5 * MEGABYTE : MEGABYTE / 8);
- if(FAILED(hr = SearchStreams(fp, nfp)))
- return hr;
- pfp = nfp;
- }
- }
- else
- {
- if(FAILED(hr = SearchStreams(0, MEGABYTE / 8)))
- return hr;
- }
-
- if(m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0)
- return E_FAIL;
-
- int indicated_rate = m_rate;
- int detected_rate = int(10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin));
- // normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
- // (update: also allowing +/-50k/s)
- if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50 * 1024)
- m_rate = detected_rate;
- else ; // TODO: in this case disable seeking, or try doing something less drastical...
-
- if(m_streams[video].GetCount())
- {
- if(!m_bIsHdmv && m_streams[subpic].GetCount())
- {
+ HRESULT hr;
+
+ // get the type first
+
+ m_type = us;
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ if(BitRead(32, true) == 'TFrc') Seek(0x67c);
+ int cnt = 0, limit = 4;
+ for(trhdr h; cnt < limit && Read(h); cnt++) Seek(h.next);
+ if(cnt >= limit) m_type = ts;
+ }
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ int cnt = 0, limit = 4;
+ for(pvahdr h; cnt < limit && Read(h); cnt++) Seek(GetPos() + h.length);
+ if(cnt >= limit) m_type = pva;
+ }
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ BYTE b;
+ for(int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++)
+ {
+ if(b == 0xba)
+ {
+ pshdr h;
+ if(Read(h))
+ {
+ m_type = ps;
+ m_rate = int(h.bitrate/8);
+ break;
+ }
+ }
+ else if((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
+ || (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
+ // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ || b == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ {
+ peshdr h;
+ if(Read(h, b) && BitRead(24, true) == 0x000001)
+ m_type = es;
+ }
+ }
+ }
+
+ Seek(0);
+
+ if(m_type == us)
+ return E_FAIL;
+
+ // min/max pts & bitrate
+ m_rtMin = m_posMin = _I64_MAX;
+ m_rtMax = m_posMax = 0;
+
+ if(IsRandomAccess() || IsStreaming())
+ {
+ if(IsStreaming())
+ {
+ for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++);
+ }
+
+ CAtlList<__int64> fps;
+ for(int i = 0, j = 5; i <= j; i++)
+ fps.AddTail(i*GetLength()/j);
+
+ for(__int64 pfp = 0; fps.GetCount(); )
+ {
+ __int64 fp = fps.RemoveHead();
+ fp = min(GetLength() - MEGABYTE/8, fp);
+ fp = max(pfp, fp);
+ __int64 nfp = fp + (pfp == 0 ? 5*MEGABYTE : MEGABYTE/8);
+ if(FAILED(hr = SearchStreams(fp, nfp)))
+ return hr;
+ pfp = nfp;
+ }
+ }
+ else
+ {
+ if(FAILED(hr = SearchStreams(0, MEGABYTE/8)))
+ return hr;
+ }
+
+ if(m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0)
+ return E_FAIL;
+
+ int indicated_rate = m_rate;
+ int detected_rate = int(10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin));
+ // normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
+ // (update: also allowing +/-50k/s)
+ if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024)
+ m_rate = detected_rate;
+ else ; // TODO: in this case disable seeking, or try doing something less drastical...
+
+ if(m_streams[video].GetCount())
+ {
+ if (!m_bIsHdmv && m_streams[subpic].GetCount())
+ {
#ifndef DEBUG
- stream s;
- s.mt.majortype = m_streams[subpic].GetHead().mt.majortype;
- s.mt.subtype = m_streams[subpic].GetHead().mt.subtype;
- s.mt.formattype = m_streams[subpic].GetHead().mt.formattype;
- m_streams[subpic].Insert(s, this);
+ stream s;
+ s.mt.majortype = m_streams[subpic].GetHead().mt.majortype;
+ s.mt.subtype = m_streams[subpic].GetHead().mt.subtype;
+ s.mt.formattype = m_streams[subpic].GetHead().mt.formattype;
+ m_streams[subpic].Insert(s, this);
#endif
- }
- else
- {
- // Add fake stream for "No subtitle"
- AddHdmvPGStream(NO_SUBTITLE_PID, "---");
- }
- }
+ }
+ else
+ {
+ // Add fake stream for "No subtitle"
+ AddHdmvPGStream (NO_SUBTITLE_PID, "---");
+ }
+ }
- Seek(0);
+ Seek(0);
- return S_OK;
+ return S_OK;
}
void CMpegSplitterFile::OnComplete()
{
- __int64 pos = GetPos();
-
- if(SUCCEEDED(SearchStreams(GetLength() - 500 * 1024, GetLength())))
- {
- int indicated_rate = m_rate;
- int detected_rate = int(m_rtMax > m_rtMin ? 10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin) : 0);
- // normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
- // (update: also allowing +/-50k/s)
- if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50 * 1024)
- m_rate = detected_rate;
- else ; // TODO: in this case disable seeking, or try doing something less drastical...
- }
-
- Seek(pos);
+ __int64 pos = GetPos();
+
+ if(SUCCEEDED(SearchStreams(GetLength() - 500*1024, GetLength())))
+ {
+ int indicated_rate = m_rate;
+ int detected_rate = int(m_rtMax > m_rtMin ? 10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin) : 0);
+ // normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
+ // (update: also allowing +/-50k/s)
+ if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1 || abs(detected_rate - indicated_rate) < 50*1024)
+ m_rate = detected_rate;
+ else ; // TODO: in this case disable seeking, or try doing something less drastical...
+ }
+
+ Seek(pos);
}
REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum)
{
- REFERENCE_TIME rt = -1;
- __int64 rtpos = -1;
+ REFERENCE_TIME rt = -1;
+ __int64 rtpos = -1;
- BYTE b;
+ BYTE b;
- while(GetRemaining())
- {
- if(m_type == ps || m_type == es)
- {
- if(!NextMpegStartCode(b)) // continue;
- {
- ASSERT(0);
- break;
- }
+ while(GetRemaining())
+ {
+ if(m_type == ps || m_type == es)
+ {
+ if(!NextMpegStartCode(b)) // continue;
+ {
+ ASSERT(0);
+ break;
+ }
- rtpos = GetPos() - 4;
+ rtpos = GetPos()-4;
#if (EVO_SUPPORT == 0)
- if(b >= 0xbd && b < 0xf0)
+ if(b >= 0xbd && b < 0xf0)
#else
- if((b >= 0xbd && b < 0xf0) || (b == 0xfd))
+ if((b >= 0xbd && b < 0xf0) || (b == 0xfd))
#endif
- {
- peshdr h;
- if(!Read(h, b) || !h.len) continue;
-
- __int64 pos = GetPos();
-
- if(h.fpts && AddStream(0, b, h.len) == TrackNum)
- {
- ASSERT(h.pts >= m_rtMin && h.pts <= m_rtMax);
- rt = h.pts;
- break;
- }
-
- Seek(pos + h.len);
- }
- }
- else if(m_type == ts)
- {
- trhdr h;
- if(!Read(h)) continue;
-
- rtpos = GetPos() - 4;
-
- if(h.payload && h.payloadstart && ISVALIDPID(h.pid))
- {
- peshdr h2;
- if(NextMpegStartCode(b, 4) && Read(h2, b)) // pes packet
- {
- if(h2.fpts && AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - rtpos)) == TrackNum))
- {
- ASSERT(h2.pts >= m_rtMin && h2.pts <= m_rtMax);
- rt = h2.pts;
- break;
- }
- }
- }
-
- Seek(h.next);
- }
- else if(m_type == pva)
- {
- pvahdr h;
- if(!Read(h)) continue;
-
- if(h.fpts)
- {
- rt = h.pts;
- break;
- }
- }
- }
-
- if(rtpos >= 0) Seek(rtpos);
- if(rt >= 0) rt -= m_rtMin;
-
- return rt;
+ {
+ peshdr h;
+ if(!Read(h, b) || !h.len) continue;
+
+ __int64 pos = GetPos();
+
+ if(h.fpts && AddStream(0, b, h.len) == TrackNum)
+ {
+ ASSERT(h.pts >= m_rtMin && h.pts <= m_rtMax);
+ rt = h.pts;
+ break;
+ }
+
+ Seek(pos + h.len);
+ }
+ }
+ else if(m_type == ts)
+ {
+ trhdr h;
+ if(!Read(h)) continue;
+
+ rtpos = GetPos()-4;
+
+ if(h.payload && h.payloadstart && ISVALIDPID(h.pid))
+ {
+ peshdr h2;
+ if(NextMpegStartCode(b, 4) && Read(h2, b)) // pes packet
+ {
+ if(h2.fpts && AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - rtpos)) == TrackNum))
+ {
+ ASSERT(h2.pts >= m_rtMin && h2.pts <= m_rtMax);
+ rt = h2.pts;
+ break;
+ }
+ }
+ }
+
+ Seek(h.next);
+ }
+ else if(m_type == pva)
+ {
+ pvahdr h;
+ if(!Read(h)) continue;
+
+ if(h.fpts)
+ {
+ rt = h.pts;
+ break;
+ }
+ }
+ }
+
+ if(rtpos >= 0) Seek(rtpos);
+ if(rt >= 0) rt -= m_rtMin;
+
+ return rt;
}
HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop)
{
- Seek(start);
- stop = min(stop, GetLength());
-
- while(GetPos() < stop)
- {
- BYTE b;
-
- if(m_type == ps || m_type == es)
- {
- if(!NextMpegStartCode(b)) continue;
-
- if(b == 0xba) // program stream header
- {
- pshdr h;
- if(!Read(h)) continue;
- }
- else if(b == 0xbb) // program stream system header
- {
- pssyshdr h;
- if(!Read(h)) continue;
- }
+ Seek(start);
+ stop = min(stop, GetLength());
+
+ while(GetPos() < stop)
+ {
+ BYTE b;
+
+ if(m_type == ps || m_type == es)
+ {
+ if(!NextMpegStartCode(b)) continue;
+
+ if(b == 0xba) // program stream header
+ {
+ pshdr h;
+ if(!Read(h)) continue;
+ }
+ else if(b == 0xbb) // program stream system header
+ {
+ pssyshdr h;
+ if(!Read(h)) continue;
+ }
#if (EVO_SUPPORT == 0)
- else if(b >= 0xbd && b < 0xf0) // pes packet
+ else if(b >= 0xbd && b < 0xf0) // pes packet
#else
- else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
+ else if((b >= 0xbd && b < 0xf0) || (b == 0xfd)) // pes packet
#endif
- {
- peshdr h;
- if(!Read(h, b)) continue;
-
- if(h.type == mpeg2 && h.scrambling)
- {
- ASSERT(0);
- return E_FAIL;
- }
-
- if(h.fpts)
- {
- if(m_rtMin == _I64_MAX)
- {
- m_rtMin = h.pts;
- m_posMin = GetPos();
- }
- if(m_rtMin < h.pts && m_rtMax < h.pts)
- {
- m_rtMax = h.pts;
- m_posMax = GetPos();
- }
- }
-
- __int64 pos = GetPos();
- AddStream(0, b, h.len);
- if(h.len) Seek(pos + h.len);
- }
- }
- else if(m_type == ts)
- {
- trhdr h;
- if(!Read(h)) continue;
-
- __int64 pos = GetPos();
-
- if(h.payload && h.payloadstart)
- UpdatePrograms(h);
-
- if(h.payload && ISVALIDPID(h.pid))
- {
- peshdr h2;
- if(h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) // pes packet
- {
- if(h2.type == mpeg2 && h2.scrambling)
- {
- ASSERT(0);
- return E_FAIL;
- }
-
- if(h2.fpts)
- {
- if(m_rtMin == _I64_MAX)
- {
- m_rtMin = h2.pts;
- m_posMin = GetPos();
- }
-
- if(m_rtMin < h2.pts && m_rtMax < h2.pts)
- {
- m_rtMax = h2.pts;
- m_posMax = GetPos();
- }
- }
- }
- else
- b = 0;
-
- AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - pos)));
- }
-
- Seek(h.next);
- }
- else if(m_type == pva)
- {
- pvahdr h;
- if(!Read(h)) continue;
-
- if(h.fpts)
- {
- if(m_rtMin == _I64_MAX)
- {
- m_rtMin = h.pts;
- m_posMin = GetPos();
- }
-
- if(m_rtMin < h.pts && m_rtMax < h.pts)
- {
- m_rtMax = h.pts;
- m_posMax = GetPos();
- }
- }
-
- __int64 pos = GetPos();
-
- if(h.streamid == 1)
- AddStream(h.streamid, 0xe0, h.length);
- else if(h.streamid == 2)
- AddStream(h.streamid, 0xc0, h.length);
-
- if(h.length)
- Seek(pos + h.length);
- }
- }
-
- return S_OK;
+ {
+ peshdr h;
+ if(!Read(h, b)) continue;
+
+ if(h.type == mpeg2 && h.scrambling) {ASSERT(0); return E_FAIL;}
+
+ if(h.fpts)
+ {
+ if(m_rtMin == _I64_MAX) {m_rtMin = h.pts; m_posMin = GetPos();}
+ if(m_rtMin < h.pts && m_rtMax < h.pts) {m_rtMax = h.pts; m_posMax = GetPos();}
+ }
+
+ __int64 pos = GetPos();
+ AddStream(0, b, h.len);
+ if(h.len) Seek(pos + h.len);
+ }
+ }
+ else if(m_type == ts)
+ {
+ trhdr h;
+ if(!Read(h)) continue;
+
+ __int64 pos = GetPos();
+
+ if(h.payload && h.payloadstart)
+ UpdatePrograms(h);
+
+ if(h.payload && ISVALIDPID(h.pid))
+ {
+ peshdr h2;
+ if(h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) // pes packet
+ {
+ if(h2.type == mpeg2 && h2.scrambling)
+ {
+ ASSERT(0);
+ return E_FAIL;
+ }
+
+ if(h2.fpts)
+ {
+ if(m_rtMin == _I64_MAX)
+ {
+ m_rtMin = h2.pts;
+ m_posMin = GetPos();
+ }
+
+ if(m_rtMin < h2.pts && m_rtMax < h2.pts)
+ {
+ m_rtMax = h2.pts;
+ m_posMax = GetPos();
+ }
+ }
+ }
+ else
+ b = 0;
+
+ AddStream(h.pid, b, DWORD(h.bytes - (GetPos() - pos)));
+ }
+
+ Seek(h.next);
+ }
+ else if(m_type == pva)
+ {
+ pvahdr h;
+ if(!Read(h)) continue;
+
+ if(h.fpts)
+ {
+ if(m_rtMin == _I64_MAX)
+ {
+ m_rtMin = h.pts;
+ m_posMin = GetPos();
+ }
+
+ if(m_rtMin < h.pts && m_rtMax < h.pts)
+ {
+ m_rtMax = h.pts;
+ m_posMax = GetPos();
+ }
+ }
+
+ __int64 pos = GetPos();
+
+ if(h.streamid == 1)
+ AddStream(h.streamid, 0xe0, h.length);
+ else if(h.streamid == 2)
+ AddStream(h.streamid, 0xc0, h.length);
+
+ if(h.length)
+ Seek(pos + h.length);
+ }
+ }
+
+ return S_OK;
}
DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
{
- if(pid)
- {
- if(pesid) m_pid2pes[pid] = pesid;
- else m_pid2pes.Lookup(pid, pesid);
- }
+ if(pid)
+ {
+ if(pesid) m_pid2pes[pid] = pesid;
+ else m_pid2pes.Lookup(pid, pesid);
+ }
- stream s;
- s.pid = pid;
- s.pesid = pesid;
+ stream s;
+ s.pid = pid;
+ s.pesid = pesid;
- int type = unknown;
+ int type = unknown;
- if(pesid >= 0xe0 && pesid < 0xf0) // mpeg video
- {
- __int64 pos = GetPos();
+ if(pesid >= 0xe0 && pesid < 0xf0) // mpeg video
+ {
+ __int64 pos = GetPos();
- if(type == unknown)
- {
- CMpegSplitterFile::seqhdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
- type = video;
- }
+ if(type == unknown)
+ {
+ CMpegSplitterFile::seqhdr h;
+ if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
+ type = video;
+ }
- Seek(pos);
+ Seek(pos);
- if(type == unknown)
- {
+ if(type == unknown)
+ {
// CMpegSplitterFile::avchdr h; <= PPS and SPS can be present on differents packets !
- if(!m_streams[video].Find(s) && Read(avch, len, &s.mt))
- type = video;
- }
- }
- else if(pesid >= 0xc0 && pesid < 0xe0) // mpeg audio
- {
- __int64 pos = GetPos();
-
- if(type == unknown)
- {
- CMpegSplitterFile::mpahdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt))
- type = audio;
- }
-
- Seek(pos);
-
- if(type == unknown)
- {
- CMpegSplitterFile::aachdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
- type = audio;
- }
- }
- else if(pesid == 0xbd || pesid == 0xfd) // private stream 1
- {
- if(s.pid)
- {
- if(!m_streams[audio].Find(s) && !m_streams[video].Find(s))
- {
- __int64 pos = GetPos();
-
- // AC3
- if(type == unknown)
- {
- CMpegSplitterFile::ac3hdr h;
- if(Read(h, len, &s.mt))
- type = audio;
- }
-
- // DTS
- Seek(pos);
- if(type == unknown)
- {
- CMpegSplitterFile::dtshdr h;
- if(Read(h, len, &s.mt))
- type = audio;
- }
-
- // VC1
- Seek(pos);
- if(type == unknown)
- {
- CMpegSplitterFile::vc1hdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
- type = video;
- }
-
- // DVB subtitles
- Seek(pos);
- if(type == unknown)
- {
- CMpegSplitterFile::dvbsub h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
- type = subpic;
- }
-
- int iProgram;
- const CHdmvClipInfo::Stream *pClipInfo;
- const program* pProgram = FindProgram(s.pid, iProgram, pClipInfo);
- if((type == unknown) && (pProgram != NULL))
- {
- PES_STREAM_TYPE StreamType = INVALID;
-
- Seek(pos);
- StreamType = pProgram->streams[iProgram].type;
-
- switch(StreamType)
- {
- case AUDIO_STREAM_LPCM :
- {
- CMpegSplitterFile::hdmvlpcmhdr h;
- if(!m_streams[audio].Find(s) && Read(h, &s.mt))
- type = audio;
- }
- break;
- case PRESENTATION_GRAPHICS_STREAM :
- {
- CMpegSplitterFile::hdmvsubhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt, pClipInfo ? pClipInfo->m_LanguageCode : NULL))
- {
- m_bIsHdmv = true;
- type = subpic;
- }
- }
- break;
- }
- }
- }
- }
+ if(!m_streams[video].Find(s) && Read(avch, len, &s.mt))
+ type = video;
+ }
+ }
+ else if(pesid >= 0xc0 && pesid < 0xe0) // mpeg audio
+ {
+ __int64 pos = GetPos();
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::mpahdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt))
+ type = audio;
+ }
+
+ Seek(pos);
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::aachdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ }
+ else if(pesid == 0xbd || pesid == 0xfd) // private stream 1
+ {
+ if(s.pid)
+ {
+ if(!m_streams[audio].Find(s) && !m_streams[video].Find(s))
+ {
+ __int64 pos = GetPos();
+
+ // AC3
+ if(type == unknown)
+ {
+ CMpegSplitterFile::ac3hdr h;
+ if(Read(h, len, &s.mt))
+ type = audio;
+ }
+
+ // DTS
+ Seek(pos);
+ if(type == unknown)
+ {
+ CMpegSplitterFile::dtshdr h;
+ if(Read(h, len, &s.mt))
+ type = audio;
+ }
+
+ // VC1
+ Seek(pos);
+ if(type == unknown)
+ {
+ CMpegSplitterFile::vc1hdr h;
+ if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
+ type = video;
+ }
+
+ // DVB subtitles
+ Seek(pos);
+ if(type == unknown)
+ {
+ CMpegSplitterFile::dvbsub h;
+ if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
+ type = subpic;
+ }
+
+ int iProgram;
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const program* pProgram = FindProgram (s.pid, iProgram, pClipInfo);
+ if((type == unknown) && (pProgram != NULL))
+ {
+ PES_STREAM_TYPE StreamType = INVALID;
+
+ Seek(pos);
+ StreamType = pProgram->streams[iProgram].type;
+
+ switch (StreamType)
+ {
+ case AUDIO_STREAM_LPCM :
+ {
+ CMpegSplitterFile::hdmvlpcmhdr h;
+ if(!m_streams[audio].Find(s) && Read(h, &s.mt))
+ type = audio;
+ }
+ break;
+ case PRESENTATION_GRAPHICS_STREAM :
+ {
+ CMpegSplitterFile::hdmvsubhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt, pClipInfo ? pClipInfo->m_LanguageCode : NULL))
+ {
+ m_bIsHdmv = true;
+ type = subpic;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
#if (EVO_SUPPORT != 0)
- else if(pesid == 0xfd) // TODO EVO SUPPORT
- {
- CMpegSplitterFile::vc1hdr h;
- if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
- type = video;
- }
+ else if (pesid == 0xfd) // TODO EVO SUPPORT
+ {
+ CMpegSplitterFile::vc1hdr h;
+ if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
+ type = video;
+ }
#endif
- else
- {
- BYTE b = (BYTE)BitRead(8, true);
- WORD w = (WORD)BitRead(16, true);
- DWORD dw = (DWORD)BitRead(32, true);
-
- if(b >= 0x80 && b < 0x88 || w == 0x0b77) // ac3
- {
- s.ps1id = (b >= 0x80 && b < 0x88) ? (BYTE)(BitRead(32) >> 24) : 0x80;
-
- CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
- type = audio;
- }
- else if(b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) // dts
- {
- s.ps1id = (b >= 0x88 && b < 0x90) ? (BYTE)(BitRead(32) >> 24) : 0x88;
-
- CMpegSplitterFile::dtshdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
- type = audio;
- }
- else if(b >= 0xa0 && b < 0xa8) // lpcm
- {
- s.ps1id = (b >= 0xa0 && b < 0xa8) ? (BYTE)(BitRead(32) >> 24) : 0xa0;
-
- CMpegSplitterFile::lpcmhdr h;
- if(Read(h, &s.mt) && !m_streams[audio].Find(s)) // note the reversed order, the header should be stripped always even if it's not a new stream
- type = audio;
- }
- else if(b >= 0x20 && b < 0x40) // DVD subpic
- {
- s.ps1id = (BYTE)BitRead(8);
-
- CMpegSplitterFile::dvdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
- type = subpic;
- }
- else if(b >= 0x70 && b < 0x80) // SVCD subpic
- {
- s.ps1id = (BYTE)BitRead(8);
-
- CMpegSplitterFile::svcdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
- type = subpic;
- }
- else if(b >= 0x00 && b < 0x10) // CVD subpic
- {
- s.ps1id = (BYTE)BitRead(8);
-
- CMpegSplitterFile::cvdspuhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
- type = subpic;
- }
- else if(w == 0xffa0 || w == 0xffa1) // ps2-mpg audio
- {
- s.ps1id = (BYTE)BitRead(8);
- s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0xa000 | track id
-
- CMpegSplitterFile::ps2audhdr h;
- if(!m_streams[audio].Find(s) && Read(h, &s.mt))
- type = audio;
- }
- else if(w == 0xff90) // ps2-mpg ac3 or subtitles
- {
- s.ps1id = (BYTE)BitRead(8);
- s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
-
- w = (WORD)BitRead(16, true);
-
- if(w == 0x0b77)
- {
- CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
- type = audio;
- }
- else if(w == 0x0000) // usually zero...
- {
- CMpegSplitterFile::ps2subhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
- type = subpic;
- }
- }
+ else
+ {
+ BYTE b = (BYTE)BitRead(8, true);
+ WORD w = (WORD)BitRead(16, true);
+ DWORD dw = (DWORD)BitRead(32, true);
+
+ if(b >= 0x80 && b < 0x88 || w == 0x0b77) // ac3
+ {
+ s.ps1id = (b >= 0x80 && b < 0x88) ? (BYTE)(BitRead(32) >> 24) : 0x80;
+
+ CMpegSplitterFile::ac3hdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ else if(b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) // dts
+ {
+ s.ps1id = (b >= 0x88 && b < 0x90) ? (BYTE)(BitRead(32) >> 24) : 0x88;
+
+ CMpegSplitterFile::dtshdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ else if(b >= 0xa0 && b < 0xa8) // lpcm
+ {
+ s.ps1id = (b >= 0xa0 && b < 0xa8) ? (BYTE)(BitRead(32) >> 24) : 0xa0;
+
+ CMpegSplitterFile::lpcmhdr h;
+ if(Read(h, &s.mt) && !m_streams[audio].Find(s)) // note the reversed order, the header should be stripped always even if it's not a new stream
+ type = audio;
+ }
+ else if(b >= 0x20 && b < 0x40) // DVD subpic
+ {
+ s.ps1id = (BYTE)BitRead(8);
+
+ CMpegSplitterFile::dvdspuhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ else if(b >= 0x70 && b < 0x80) // SVCD subpic
+ {
+ s.ps1id = (BYTE)BitRead(8);
+
+ CMpegSplitterFile::svcdspuhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ else if(b >= 0x00 && b < 0x10) // CVD subpic
+ {
+ s.ps1id = (BYTE)BitRead(8);
+
+ CMpegSplitterFile::cvdspuhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ else if(w == 0xffa0 || w == 0xffa1) // ps2-mpg audio
+ {
+ s.ps1id = (BYTE)BitRead(8);
+ s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0xa000 | track id
+
+ CMpegSplitterFile::ps2audhdr h;
+ if(!m_streams[audio].Find(s) && Read(h, &s.mt))
+ type = audio;
+ }
+ else if(w == 0xff90) // ps2-mpg ac3 or subtitles
+ {
+ s.ps1id = (BYTE)BitRead(8);
+ s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
+
+ w = (WORD)BitRead(16, true);
+
+ if(w == 0x0b77)
+ {
+ CMpegSplitterFile::ac3hdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ else if(w == 0x0000) // usually zero...
+ {
+ CMpegSplitterFile::ps2subhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ }
#if (EVO_SUPPORT != 0)
- else if(b >= 0xc0 && b < 0xc8) // dolby digital +
- {
- s.ps1id = (BYTE)BitRead(8);
- s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
-
- w = (WORD)BitRead(16, true);
-
- if(w == 0x0b77)
- {
- CMpegSplitterFile::ac3hdr h;
- if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
- type = audio;
- }
- }
+ else if(b >= 0xc0 && b < 0xc8) // dolby digital +
+ {
+ s.ps1id = (BYTE)BitRead(8);
+ s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
+
+ w = (WORD)BitRead(16, true);
+
+ if(w == 0x0b77)
+ {
+ CMpegSplitterFile::ac3hdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ }
#endif
- }
- }
- else if(pesid == 0xbe) // padding
- {
- }
- else if(pesid == 0xbf) // private stream 2
- {
- }
-
- if(type != unknown && !m_streams[type].Find(s))
- {
- if(s.pid)
- {
- for(int i = 0; i < unknown; i++)
- {
- if(m_streams[i].Find(s))
- {
- /*ASSERT(0);*/
- return s;
- }
- }
- }
-
- m_streams[type].Insert(s, this);
- }
-
- return s;
+ }
+ }
+ else if(pesid == 0xbe) // padding
+ {
+ }
+ else if(pesid == 0xbf) // private stream 2
+ {
+ }
+
+ if(type != unknown && !m_streams[type].Find(s))
+ {
+ if(s.pid)
+ {
+ for(int i = 0; i < unknown; i++)
+ {
+ if(m_streams[i].Find(s))
+ {
+ /*ASSERT(0);*/
+ return s;
+ }
+ }
+ }
+
+ m_streams[type].Insert(s, this);
+ }
+
+ return s;
}
void CMpegSplitterFile::AddHdmvPGStream(WORD pid, const char* language_code)
{
- stream s;
+ stream s;
- s.pid = pid;
- s.pesid = 0xbd;
+ s.pid = pid;
+ s.pesid = 0xbd;
- CMpegSplitterFile::hdmvsubhdr h;
- if(!m_streams[subpic].Find(s) && Read(h, &s.mt, language_code))
- {
- m_streams[subpic].Insert(s, this);
- }
+ CMpegSplitterFile::hdmvsubhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt, language_code))
+ {
+ m_streams[subpic].Insert(s, this);
+ }
}
CAtlList<CMpegSplitterFile::stream>* CMpegSplitterFile::GetMasterStream()
{
- return
- !m_streams[video].IsEmpty() ? &m_streams[video] :
- !m_streams[audio].IsEmpty() ? &m_streams[audio] :
- !m_streams[subpic].IsEmpty() ? &m_streams[subpic] :
- NULL;
+ return
+ !m_streams[video].IsEmpty() ? &m_streams[video] :
+ !m_streams[audio].IsEmpty() ? &m_streams[audio] :
+ !m_streams[subpic].IsEmpty() ? &m_streams[subpic] :
+ NULL;
}
void CMpegSplitterFile::UpdatePrograms(const trhdr& h)
{
- CAutoLock cAutoLock(&m_csProps);
-
- if(h.pid == 0)
- {
- trsechdr h2;
- if(Read(h2) && h2.table_id == 0)
- {
- CAtlMap<WORD, bool> newprograms;
-
- int len = h2.section_length;
- len -= 5 + 4;
-
- for(int i = len / 4; i > 0; i--)
- {
- WORD program_number = (WORD)BitRead(16);
- BYTE reserved = (BYTE)BitRead(3);
- WORD pid = (WORD)BitRead(13);
- if(program_number != 0)
- {
- m_programs[pid].program_number = program_number;
- newprograms[program_number] = true;
- }
- }
-
- POSITION pos = m_programs.GetStartPosition();
- while(pos)
- {
- const CAtlMap<WORD, program>::CPair* pPair = m_programs.GetNext(pos);
-
- if(!newprograms.Lookup(pPair->m_value.program_number))
- {
- m_programs.RemoveKey(pPair->m_key);
- }
- }
- }
- }
- else if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid))
- {
- trsechdr h2;
- if(Read(h2) && h2.table_id == 2)
- {
- memset(pPair->m_value.streams, 0, sizeof(pPair->m_value.streams));
-
- int len = h2.section_length;
- len -= 5 + 4;
-
- BYTE reserved1 = (BYTE)BitRead(3);
- WORD PCR_PID = (WORD)BitRead(13);
- BYTE reserved2 = (BYTE)BitRead(4);
- WORD program_info_length = (WORD)BitRead(12);
-
- len -= 4 + program_info_length;
-
- while(program_info_length-- > 0)
- BitRead(8);
-
- for(int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++)
- {
- BYTE stream_type = (BYTE)BitRead(8);
- BYTE nreserved1 = (BYTE)BitRead(3);
- WORD pid = (WORD)BitRead(13);
- BYTE nreserved2 = (BYTE)BitRead(4);
- WORD ES_info_length = (WORD)BitRead(12);
-
- len -= 5 + ES_info_length;
-
- while(ES_info_length-- > 0)
- BitRead(8);
-
- pPair->m_value.streams[i].pid = pid;
- pPair->m_value.streams[i].type = (PES_STREAM_TYPE)stream_type;
- }
- }
- }
+ CAutoLock cAutoLock(&m_csProps);
+
+ if(h.pid == 0)
+ {
+ trsechdr h2;
+ if(Read(h2) && h2.table_id == 0)
+ {
+ CAtlMap<WORD, bool> newprograms;
+
+ int len = h2.section_length;
+ len -= 5+4;
+
+ for(int i = len/4; i > 0; i--)
+ {
+ WORD program_number = (WORD)BitRead(16);
+ BYTE reserved = (BYTE)BitRead(3);
+ WORD pid = (WORD)BitRead(13);
+ if(program_number != 0)
+ {
+ m_programs[pid].program_number = program_number;
+ newprograms[program_number] = true;
+ }
+ }
+
+ POSITION pos = m_programs.GetStartPosition();
+ while(pos)
+ {
+ const CAtlMap<WORD, program>::CPair* pPair = m_programs.GetNext(pos);
+
+ if(!newprograms.Lookup(pPair->m_value.program_number))
+ {
+ m_programs.RemoveKey(pPair->m_key);
+ }
+ }
+ }
+ }
+ else if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid))
+ {
+ trsechdr h2;
+ if(Read(h2) && h2.table_id == 2)
+ {
+ memset(pPair->m_value.streams, 0, sizeof(pPair->m_value.streams));
+
+ int len = h2.section_length;
+ len -= 5+4;
+
+ BYTE reserved1 = (BYTE)BitRead(3);
+ WORD PCR_PID = (WORD)BitRead(13);
+ BYTE reserved2 = (BYTE)BitRead(4);
+ WORD program_info_length = (WORD)BitRead(12);
+
+ len -= 4+program_info_length;
+
+ while(program_info_length-- > 0)
+ BitRead(8);
+
+ for(int i = 0; i < countof(pPair->m_value.streams) && len >= 5; i++)
+ {
+ BYTE stream_type = (BYTE)BitRead(8);
+ BYTE nreserved1 = (BYTE)BitRead(3);
+ WORD pid = (WORD)BitRead(13);
+ BYTE nreserved2 = (BYTE)BitRead(4);
+ WORD ES_info_length = (WORD)BitRead(12);
+
+ len -= 5+ES_info_length;
+
+ while(ES_info_length-- > 0)
+ BitRead(8);
+
+ pPair->m_value.streams[i].pid = pid;
+ pPair->m_value.streams[i].type = (PES_STREAM_TYPE)stream_type;
+ }
+ }
+ }
}
uint32 SwapLE(const uint32 &_Value)
{
- return (_Value & 0xFF) << 24 | ((_Value >> 8) & 0xFF) << 16 | ((_Value >> 16) & 0xFF) << 8 | ((_Value >> 24) & 0xFF) << 0;
+ return (_Value & 0xFF) << 24 | ((_Value>>8) & 0xFF) << 16 | ((_Value>>16) & 0xFF) << 8 | ((_Value>>24) & 0xFF) << 0;
}
uint16 SwapLE(const uint16 &_Value)
{
- return (_Value & 0xFF) << 8 | ((_Value >> 8) & 0xFF) << 0;
+ return (_Value & 0xFF) << 8 | ((_Value>>8) & 0xFF) << 0;
}
const CMpegSplitterFile::program* CMpegSplitterFile::FindProgram(WORD pid, int &iStream, const CHdmvClipInfo::Stream * &_pClipInfo)
{
- _pClipInfo = m_ClipInfo.FindStream(pid);
+ _pClipInfo = m_ClipInfo.FindStream(pid);
- iStream = -1;
+ iStream = -1;
- POSITION pos = m_programs.GetStartPosition();
+ POSITION pos = m_programs.GetStartPosition();
- while(pos)
- {
- program* p = &m_programs.GetNextValue(pos);
+ while(pos)
+ {
+ program* p = &m_programs.GetNextValue(pos);
- for(int i = 0; i < countof(p->streams); i++)
- {
- if(p->streams[i].pid == pid)
- {
- iStream = i;
- return p;
- }
- }
- }
+ for(int i = 0; i < countof(p->streams); i++)
+ {
+ if(p->streams[i].pid == pid)
+ {
+ iStream = i;
+ return p;
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
diff --git a/src/filters/parser/MpegSplitter/MpegSplitterFile.h b/src/filters/parser/MpegSplitter/MpegSplitterFile.h
index 237beb3e6..d9bee0f42 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitterFile.h
+++ b/src/filters/parser/MpegSplitter/MpegSplitterFile.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,122 +30,103 @@
class CMpegSplitterFile : public CBaseSplitterFileEx
{
- CAtlMap<WORD, BYTE> m_pid2pes;
- CMpegSplitterFile::avchdr avch;
- bool m_bIsHdmv;
+ CAtlMap<WORD, BYTE> m_pid2pes;
+ CMpegSplitterFile::avchdr avch;
+ bool m_bIsHdmv;
- HRESULT Init();
+ HRESULT Init();
- void OnComplete();
+ void OnComplete();
public:
- CHdmvClipInfo &m_ClipInfo;
- CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bool bIsHdmv, CHdmvClipInfo &ClipInfo);
-
- REFERENCE_TIME NextPTS(DWORD TrackNum);
-
- CCritSec m_csProps;
-
- enum {us, ps, ts, es, pva} m_type;
-
- REFERENCE_TIME m_rtMin, m_rtMax;
- __int64 m_posMin, m_posMax;
- int m_rate; // byte/sec
-
- struct stream
- {
- CMpegSplitterFile *m_pFile;
- CMediaType mt;
- WORD pid;
- BYTE pesid, ps1id;
- bool operator < (const stream &_Other) const;
- struct stream()
- {
- pid = pesid = ps1id = 0;
- }
- operator DWORD() const
- {
- return pid ? pid : ((pesid << 8) | ps1id);
- }
- bool operator == (const struct stream& s) const
- {
- return (DWORD) * this == (DWORD)s;
- }
- };
-
- enum {video, audio, subpic, unknown};
-
- class CStreamList : public CAtlList<stream>
- {
- public:
- void Insert(stream& s, CMpegSplitterFile *_pFile)
- {
- s.m_pFile = _pFile;
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
- {
- stream& s2 = GetAt(pos);
- if(s < s2)
- {
- InsertBefore(pos, s);
- return;
- }
- }
-
- AddTail(s);
- }
-
- static CStringW ToString(int type)
- {
- return
- type == video ? L"Video" :
- type == audio ? L"Audio" :
- type == subpic ? L"Subtitle" :
- L"Unknown";
- }
-
- const stream* FindStream(int pid)
- {
- for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
- {
- const stream& s = GetAt(pos);
- if(s.pid == pid) return &s;
- }
-
- return NULL;
- }
-
- } m_streams[unknown];
-
- HRESULT SearchStreams(__int64 start, __int64 stop);
- DWORD AddStream(WORD pid, BYTE pesid, DWORD len);
- void AddHdmvPGStream(WORD pid, const char* language_code);
- CAtlList<stream>* GetMasterStream();
- bool IsHdmv()
- {
- return m_bIsHdmv;
- };
-
- struct program
- {
- WORD program_number;
- struct stream
- {
- WORD pid;
- PES_STREAM_TYPE type;
-
- };
- stream streams[64];
- struct program()
- {
- memset(this, 0, sizeof(*this));
- }
- };
-
- CAtlMap<WORD, program> m_programs;
-
- void UpdatePrograms(const trhdr& h);
- const program* FindProgram(WORD pid, int &iStream, const CHdmvClipInfo::Stream * &_pClipInfo);
-
-
+ CHdmvClipInfo &m_ClipInfo;
+ CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, bool bIsHdmv, CHdmvClipInfo &ClipInfo);
+
+ REFERENCE_TIME NextPTS(DWORD TrackNum);
+
+ CCritSec m_csProps;
+
+ enum {us, ps, ts, es, pva} m_type;
+
+ REFERENCE_TIME m_rtMin, m_rtMax;
+ __int64 m_posMin, m_posMax;
+ int m_rate; // byte/sec
+
+ struct stream
+ {
+ CMpegSplitterFile *m_pFile;
+ CMediaType mt;
+ WORD pid;
+ BYTE pesid, ps1id;
+ bool operator < (const stream &_Other) const;
+ struct stream() {pid = pesid = ps1id = 0;}
+ operator DWORD() const {return pid ? pid : ((pesid<<8)|ps1id);}
+ bool operator == (const struct stream& s) const {return (DWORD)*this == (DWORD)s;}
+ };
+
+ enum {video, audio, subpic, unknown};
+
+ class CStreamList : public CAtlList<stream>
+ {
+ public:
+ void Insert(stream& s, CMpegSplitterFile *_pFile)
+ {
+ s.m_pFile = _pFile;
+ for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
+ {
+ stream& s2 = GetAt(pos);
+ if(s < s2) {InsertBefore(pos, s); return;}
+ }
+
+ AddTail(s);
+ }
+
+ static CStringW ToString(int type)
+ {
+ return
+ type == video ? L"Video" :
+ type == audio ? L"Audio" :
+ type == subpic ? L"Subtitle" :
+ L"Unknown";
+ }
+
+ const stream* FindStream(int pid)
+ {
+ for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
+ {
+ const stream& s = GetAt(pos);
+ if(s.pid == pid) return &s;
+ }
+
+ return NULL;
+ }
+
+ } m_streams[unknown];
+
+ HRESULT SearchStreams(__int64 start, __int64 stop);
+ DWORD AddStream(WORD pid, BYTE pesid, DWORD len);
+ void AddHdmvPGStream(WORD pid, const char* language_code);
+ CAtlList<stream>* GetMasterStream();
+ bool IsHdmv() { return m_bIsHdmv; };
+
+ struct program
+ {
+ WORD program_number;
+ struct stream
+ {
+ WORD pid;
+ PES_STREAM_TYPE type;
+
+ };
+ stream streams[64];
+ struct program() {memset(this, 0, sizeof(*this));}
+ };
+
+ CAtlMap<WORD, program> m_programs;
+
+ void UpdatePrograms(const trhdr& h);
+ const program* FindProgram(WORD pid, int &iStream, const CHdmvClipInfo::Stream * &_pClipInfo);
+
+
};
diff --git a/src/filters/parser/MpegSplitter/resource.h b/src/filters/parser/MpegSplitter/resource.h
index 51170d5ba..1ae4564c5 100644
--- a/src/filters/parser/MpegSplitter/resource.h
+++ b/src/filters/parser/MpegSplitter/resource.h
@@ -4,7 +4,7 @@
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/MpegSplitter/stdafx.cpp b/src/filters/parser/MpegSplitter/stdafx.cpp
index e1ec5adac..4284c08d9 100644
--- a/src/filters/parser/MpegSplitter/stdafx.cpp
+++ b/src/filters/parser/MpegSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/MpegSplitter/stdafx.h b/src/filters/parser/MpegSplitter/stdafx.h
index c0b16b75c..aefacf4f0 100644
--- a/src/filters/parser/MpegSplitter/stdafx.h
+++ b/src/filters/parser/MpegSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/NutSplitter/NutFile.cpp b/src/filters/parser/NutSplitter/NutFile.cpp
index 519558e33..dc72f1de8 100644
--- a/src/filters/parser/NutSplitter/NutFile.cpp
+++ b/src/filters/parser/NutSplitter/NutFile.cpp
@@ -2,126 +2,122 @@
#include "NutFile.h"
CNutFile::CNutFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) return;
- hr = Init();
+ if(FAILED(hr)) return;
+ hr = Init();
}
HRESULT CNutFile::Init()
{
- Seek(0);
-
- if(BitRead(64) != NUTM)
- return E_FAIL;
-
- m_streams.RemoveAll();
-
- Seek(0);
-
- while(GetRemaining())
- {
- frame_header fh;
- fh.checksum_flag = 1;
-
- UINT64 id = 0;
-
- if(BitRead(1, true) == 0
- || (id = BitRead(64)) == NUTK)
- break;
-
- packet_header ph;
- Read(ph);
-
- if(id == NUTM)
- {
- Read(m_mh);
- }
- else if(id == NUTS)
- {
- CAutoPtr<stream_header> sh(DNew stream_header());
- Read(*sh);
- if(sh->stream_class == SC_VIDEO) Read(sh->vsh);
- else if(sh->stream_class == SC_AUDIO) Read(sh->ash);
- // else if(sh->stream_class == SC_SUBTITLE) ; // nothing to do
- m_streams.AddTail(sh);
- }
- else if(id == NUTX)
- {
- index_header ih;
- Read(ih);
- }
- else if(id == NUTI)
- {
- info_header ih;
- Read(ih);
- }
- else if(id == 0) // frame
- {
- ASSERT(0);
- break;
- }
-
- if(fh.checksum_flag)
- {
- Seek(ph.pos + ph.fptr - 4);
- ph.checksum = (UINT32)BitRead(32);
- }
-
- Seek(ph.pos + ph.fptr);
- }
-
- Seek(0);
-
- return m_streams.GetCount() ? S_OK : E_FAIL;
+ Seek(0);
+
+ if(BitRead(64) != NUTM)
+ return E_FAIL;
+
+ m_streams.RemoveAll();
+
+ Seek(0);
+
+ while(GetRemaining())
+ {
+ frame_header fh;
+ fh.checksum_flag = 1;
+
+ UINT64 id = 0;
+
+ if(BitRead(1, true) == 0
+ || (id = BitRead(64)) == NUTK)
+ break;
+
+ packet_header ph;
+ Read(ph);
+
+ if(id == NUTM)
+ {
+ Read(m_mh);
+ }
+ else if(id == NUTS)
+ {
+ CAutoPtr<stream_header> sh(DNew stream_header());
+ Read(*sh);
+ if(sh->stream_class == SC_VIDEO) Read(sh->vsh);
+ else if(sh->stream_class == SC_AUDIO) Read(sh->ash);
+ // else if(sh->stream_class == SC_SUBTITLE) ; // nothing to do
+ m_streams.AddTail(sh);
+ }
+ else if(id == NUTX)
+ {
+ index_header ih;
+ Read(ih);
+ }
+ else if(id == NUTI)
+ {
+ info_header ih;
+ Read(ih);
+ }
+ else if(id == 0) // frame
+ {
+ ASSERT(0);
+ break;
+ }
+
+ if(fh.checksum_flag)
+ {
+ Seek(ph.pos + ph.fptr - 4);
+ ph.checksum = (UINT32)BitRead(32);
+ }
+
+ Seek(ph.pos + ph.fptr);
+ }
+
+ Seek(0);
+
+ return m_streams.GetCount() ? S_OK : E_FAIL;
}
void CNutFile::Read(vint& vi)
{
- vi = 0;
- bool more;
- do
- {
- more = !!BitRead(1);
- vi = (vi << 7) | BitRead(7);
- }
- while(more);
+ vi = 0;
+ bool more;
+ do {more = !!BitRead(1); vi = (vi << 7) | BitRead(7);}
+ while(more);
}
void CNutFile::Read(svint& svi)
{
- vint vi;
- Read(vi);
- vi++;
- if(vi & 1) svi = -((svint)vi >> 1);
- else svi = ((svint)vi >> 1);
+ vint vi;
+ Read(vi);
+ vi++;
+ if(vi&1) svi = -((svint)vi>>1);
+ else svi = ((svint)vi>>1);
}
void CNutFile::Read(binary& b)
{
- vint len;
- Read(len);
- b.SetCount((INT_PTR)len);
- for(BYTE* buff = b.GetData(); len-- > 0; *buff++ = (BYTE)BitRead(8));
+ vint len;
+ Read(len);
+ b.SetCount((INT_PTR)len);
+ for(BYTE* buff = b.GetData(); len-- > 0; *buff++ = (BYTE)BitRead(8));
}
void CNutFile::Read(packet_header& ph)
{
- ph.pos = GetPos();
- Read(ph.fptr);
- Read(ph.bptr);
+ ph.pos = GetPos();
+ Read(ph.fptr);
+ Read(ph.bptr);
}
void CNutFile::Read(main_header& mh)
{
- Read(mh.version);
- Read(mh.stream_count);
+ Read(mh.version);
+ Read(mh.stream_count);
}
void CNutFile::Read(stream_header& sh)
{
- Read(sh.stream_id);
- Read(sh.stream_class);
+ Read(sh.stream_id);
+ Read(sh.stream_class);
Read(sh.fourcc);
Read(sh.average_bitrate);
Read(sh.language_code);
@@ -132,64 +128,64 @@ void CNutFile::Read(stream_header& sh)
sh.fixed_fps = BitRead(1);
sh.index_flag = BitRead(1);
sh.reserved = BitRead(6);
- while(1)
- {
- CAutoPtr<codec_specific> p(DNew codec_specific());
- Read(p->type);
- if(p->type == 0) break;
- Read(p->data);
- sh.cs.AddTail(p);
- }
+ while(1)
+ {
+ CAutoPtr<codec_specific> p(DNew codec_specific());
+ Read(p->type);
+ if(p->type == 0) break;
+ Read(p->data);
+ sh.cs.AddTail(p);
+ }
}
void CNutFile::Read(video_stream_header& vsh)
{
- Read(vsh.width);
- Read(vsh.height);
- Read(vsh.sample_width);
- Read(vsh.sample_height);
- Read(vsh.colorspace_type);
+ Read(vsh.width);
+ Read(vsh.height);
+ Read(vsh.sample_width);
+ Read(vsh.sample_height);
+ Read(vsh.colorspace_type);
}
void CNutFile::Read(audio_stream_header& ash)
{
- Read(ash.samplerate_mul);
- Read(ash.channel_count);
+ Read(ash.samplerate_mul);
+ Read(ash.channel_count);
}
void CNutFile::Read(index_header& ih)
{
- Read(ih.stream_id);
-
- vint len;
- Read(len);
- ih.ie.SetCount((INT_PTR)len);
- for(index_entry* p = ih.ie.GetData(); len-- > 0;)
- {
- Read(p->timestamp);
- Read(p->position);
- }
+ Read(ih.stream_id);
+
+ vint len;
+ Read(len);
+ ih.ie.SetCount((INT_PTR)len);
+ for(index_entry* p = ih.ie.GetData(); len-- > 0;)
+ {
+ Read(p->timestamp);
+ Read(p->position);
+ }
}
void CNutFile::Read(info_header& ih)
{
- // TODO
- /*
- for(;;){
- id v
- if(id==0) break
- name= info_table[id][0]
- type= info_table[id][1]
- if(type==NULL)
- type b
- if(name==NULL)
- name b
- if(type=="v")
- value v
- else if(type=="s")
- value s
- else
- value b
- }
- */
+ // TODO
+/*
+ for(;;){
+ id v
+ if(id==0) break
+ name= info_table[id][0]
+ type= info_table[id][1]
+ if(type==NULL)
+ type b
+ if(name==NULL)
+ name b
+ if(type=="v")
+ value v
+ else if(type=="s")
+ value s
+ else
+ value b
+ }
+*/
}
diff --git a/src/filters/parser/NutSplitter/NutFile.h b/src/filters/parser/NutSplitter/NutFile.h
index a3c5d163d..ab2a0a7e1 100644
--- a/src/filters/parser/NutSplitter/NutFile.h
+++ b/src/filters/parser/NutSplitter/NutFile.h
@@ -4,125 +4,121 @@
class CNutFile : public CBaseSplitterFile
{
- HRESULT Init();
+ HRESULT Init();
public:
#pragma pack(push, 1)
- typedef UINT64 vint;
- typedef INT64 svint;
- typedef CAtlArray<BYTE> binary;
- typedef CAtlArray<BYTE> string;
-
- struct packet_header
- {
- __int64 pos;
- vint fptr, bptr;
- UINT32 checksum;
- };
-
- struct main_header
- {
- vint version;
- vint stream_count;
- };
-
- struct codec_specific
- {
- vint type;
- binary data;
- };
-
- struct video_stream_header
- {
- vint width, height;
- vint sample_width, sample_height;
- vint colorspace_type;
- };
-
- struct audio_stream_header
- {
- vint samplerate_mul;
- vint channel_count;
- };
-
- struct stream_header
- {
+ typedef UINT64 vint;
+ typedef INT64 svint;
+ typedef CAtlArray<BYTE> binary;
+ typedef CAtlArray<BYTE> string;
+
+ struct packet_header
+ {
+ __int64 pos;
+ vint fptr, bptr;
+ UINT32 checksum;
+ };
+
+ struct main_header
+ {
+ vint version;
+ vint stream_count;
+ };
+
+ struct codec_specific
+ {
+ vint type;
+ binary data;
+ };
+
+ struct video_stream_header
+ {
+ vint width, height;
+ vint sample_width, sample_height;
+ vint colorspace_type;
+ };
+
+ struct audio_stream_header
+ {
+ vint samplerate_mul;
+ vint channel_count;
+ };
+
+ struct stream_header
+ {
+ vint stream_id;
+ vint stream_class;
+ string fourcc;
+ vint average_bitrate;
+ string language_code;
+ vint time_base_nom;
+ vint time_base_denom;
+ vint msb_timestamp_shift;
+ vint shuffle_type;
+ int fixed_fps:1;
+ int index_flag:1;
+ int reserved:6;
+ CAutoPtrList<codec_specific> cs;
+ union {video_stream_header vsh; audio_stream_header ash;};
+ vint msb_timestamp;
+ };
+
+ struct frame_header
+ {
+ BYTE zero_bit:1;
+ BYTE priority:2;
+ BYTE checksum_flag:1;
+ BYTE msb_timestamp_flag:2;
+ BYTE subpacket_type:2;
+ BYTE reserved:1;
+ };
+
+ struct index_entry
+ {
+ vint timestamp;
+ vint position;
+ };
+
+ struct index_header
+ {
vint stream_id;
- vint stream_class;
- string fourcc;
- vint average_bitrate;
- string language_code;
- vint time_base_nom;
- vint time_base_denom;
- vint msb_timestamp_shift;
- vint shuffle_type;
- int fixed_fps: 1;
- int index_flag: 1;
- int reserved: 6;
- CAutoPtrList<codec_specific> cs;
- union
- {
- video_stream_header vsh;
- audio_stream_header ash;
- };
- vint msb_timestamp;
- };
-
- struct frame_header
- {
- BYTE zero_bit: 1;
- BYTE priority: 2;
- BYTE checksum_flag: 1;
- BYTE msb_timestamp_flag: 2;
- BYTE subpacket_type: 2;
- BYTE reserved: 1;
- };
-
- struct index_entry
- {
- vint timestamp;
- vint position;
- };
-
- struct index_header
- {
- vint stream_id;
- CAtlArray<index_entry> ie;
- };
+ CAtlArray<index_entry> ie;
+ };
- struct info_header
- {
- // TODO
- vint dummy;
- };
+ struct info_header
+ {
+ // TODO
+ vint dummy;
+ };
#pragma pack(pop)
-#define NUTM 0xF9526A624E55544Dui64
-#define NUTS 0xD667773F4E555453ui64
-#define NUTK 0xCB8630874E55544Bui64
-#define NUTX 0xEBFCDE0E4E555458ui64
-#define NUTI 0xA37B64354E555449ui64
-
- enum {SC_VIDEO = 0, SC_AUDIO = 32, SC_SUBTITLE = 64};
-
- void Read(vint& v);
- void Read(svint& sv);
- void Read(binary& b);
- void Read(packet_header& ph);
- void Read(main_header& mh);
- void Read(stream_header& sh);
- void Read(video_stream_header& vsh);
- void Read(audio_stream_header& ash);
- void Read(index_header& ih);
- void Read(info_header& ih);
+ #define NUTM 0xF9526A624E55544Dui64
+ #define NUTS 0xD667773F4E555453ui64
+ #define NUTK 0xCB8630874E55544Bui64
+ #define NUTX 0xEBFCDE0E4E555458ui64
+ #define NUTI 0xA37B64354E555449ui64
+
+ enum {SC_VIDEO = 0, SC_AUDIO = 32, SC_SUBTITLE = 64};
+
+ void Read(vint& v);
+ void Read(svint& sv);
+ void Read(binary& b);
+ void Read(packet_header& ph);
+ void Read(main_header& mh);
+ void Read(stream_header& sh);
+ void Read(video_stream_header& vsh);
+ void Read(audio_stream_header& ash);
+ void Read(index_header& ih);
+ void Read(info_header& ih);
public:
- CNutFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ CNutFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- main_header m_mh;
- CAutoPtrList<stream_header> m_streams;
+ main_header m_mh;
+ CAutoPtrList<stream_header> m_streams;
};
diff --git a/src/filters/parser/NutSplitter/NutSplitter.cpp b/src/filters/parser/NutSplitter/NutSplitter.cpp
index 723c38d3b..56b1f81c1 100644
--- a/src/filters/parser/NutSplitter/NutSplitter.cpp
+++ b/src/filters/parser/NutSplitter/NutSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,8 +28,8 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_Nut},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Nut},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -40,30 +40,30 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CNutSplitterFilter), L"MPC - Nut Splitter", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CNutSourceFilter), L"MPC - Nut Source", MERIT_NORMAL + 1, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CNutSplitterFilter), L"MPC - Nut Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CNutSourceFilter), L"MPC - Nut Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CNutSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CNutSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CNutSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CNutSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_Nut, _T("0,8,,F9526A624E55544D"), _T(".nut"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_Nut, _T("0,8,,F9526A624E55544D"), _T(".nut"), NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_Nut);
+ UnRegisterSourceFilter(MEDIASUBTYPE_Nut);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -77,261 +77,253 @@ CFilterApp theApp;
//
CNutSplitterFilter::CNutSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CNutSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CNutSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
HRESULT CNutSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
-
- m_pFile.Attach(DNew CNutFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- // pins
-
- POSITION pos = m_pFile->m_streams.GetHeadPosition();
- while(pos)
- {
- CNutFile::stream_header* sh = m_pFile->m_streams.GetNext(pos);
-
- CAtlArray<CMediaType> mts;
- CMediaType mt;
-
- if(sh->stream_class == CNutFile::SC_VIDEO)
- {
- CNutFile::video_stream_header& vsh = sh->vsh;
-
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap(*(DWORD*)sh->fourcc.GetData());
- mt.formattype = FORMAT_VideoInfo;
-
- VIDEOINFOHEADER vih;
- memset(&vih, 0, sizeof(vih));
- vih.dwBitRate = (DWORD)sh->average_bitrate;
- vih.AvgTimePerFrame = 10000000i64 * sh->time_base_nom / sh->time_base_denom;
- vih.bmiHeader.biSize = sizeof(vih.bmiHeader);
- vih.bmiHeader.biCompression = mt.subtype.Data1;
- vih.bmiHeader.biWidth = (LONG)vsh.width;
- vih.bmiHeader.biHeight = (LONG)vsh.height;
- mt.SetFormat((BYTE*)&vih, sizeof(vih));
-
- mts.Add(mt);
-
- if(vsh.sample_width && vsh.sample_height)
- {
- VIDEOINFOHEADER2 vih2;
- memset(&vih2, 0, sizeof(vih2));
- vih2.dwBitRate = vih.dwBitRate;
- vih2.AvgTimePerFrame = vih.AvgTimePerFrame;
- vih2.dwPictAspectRatioX = (DWORD)vsh.sample_width;
- vih2.dwPictAspectRatioY = (DWORD)vsh.sample_height;
- vih2.bmiHeader = vih.bmiHeader;
- mt.SetFormat((BYTE*)&vih2, sizeof(vih2));
-
- mts.InsertAt(0, mt);
- }
- }
- else if(sh->stream_class == CNutFile::SC_AUDIO)
- {
- CNutFile::audio_stream_header& ash = sh->ash;
- // TODO
- }
- else if(sh->stream_class == CNutFile::SC_SUBTITLE)
- {
- // TODO
- }
-
- if(mts.GetCount() > 0)
- {
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
- AddOutputPin((DWORD)sh->stream_id, pPinOut);
- }
- }
-
- // TODO
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(DNew CNutFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ // pins
+
+ POSITION pos = m_pFile->m_streams.GetHeadPosition();
+ while(pos)
+ {
+ CNutFile::stream_header* sh = m_pFile->m_streams.GetNext(pos);
+
+ CAtlArray<CMediaType> mts;
+ CMediaType mt;
+
+ if(sh->stream_class == CNutFile::SC_VIDEO)
+ {
+ CNutFile::video_stream_header& vsh = sh->vsh;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(*(DWORD*)sh->fourcc.GetData());
+ mt.formattype = FORMAT_VideoInfo;
+
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.dwBitRate = (DWORD)sh->average_bitrate;
+ vih.AvgTimePerFrame = 10000000i64 * sh->time_base_nom / sh->time_base_denom;
+ vih.bmiHeader.biSize = sizeof(vih.bmiHeader);
+ vih.bmiHeader.biCompression = mt.subtype.Data1;
+ vih.bmiHeader.biWidth = (LONG)vsh.width;
+ vih.bmiHeader.biHeight = (LONG)vsh.height;
+ mt.SetFormat((BYTE*)&vih, sizeof(vih));
+
+ mts.Add(mt);
+
+ if(vsh.sample_width && vsh.sample_height)
+ {
+ VIDEOINFOHEADER2 vih2;
+ memset(&vih2, 0, sizeof(vih2));
+ vih2.dwBitRate = vih.dwBitRate;
+ vih2.AvgTimePerFrame = vih.AvgTimePerFrame;
+ vih2.dwPictAspectRatioX = (DWORD)vsh.sample_width;
+ vih2.dwPictAspectRatioY = (DWORD)vsh.sample_height;
+ vih2.bmiHeader = vih.bmiHeader;
+ mt.SetFormat((BYTE*)&vih2, sizeof(vih2));
+
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(sh->stream_class == CNutFile::SC_AUDIO)
+ {
+ CNutFile::audio_stream_header& ash = sh->ash;
+ // TODO
+ }
+ else if(sh->stream_class == CNutFile::SC_SUBTITLE)
+ {
+ // TODO
+ }
+
+ if(mts.GetCount() > 0)
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ AddOutputPin((DWORD)sh->stream_id, pPinOut);
+ }
+ }
+
+ // TODO
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CNutSplitterFilter::DemuxInit()
{
- if(!m_pFile) return(false);
- m_pFile->Seek(0);
- return(true);
+ if(!m_pFile) return(false);
+ m_pFile->Seek(0);
+ return(true);
}
void CNutSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- POSITION pos = m_pFile->m_streams.GetHeadPosition();
- while(pos) m_pFile->m_streams.GetNext(pos)->msb_timestamp = 0;
+ POSITION pos = m_pFile->m_streams.GetHeadPosition();
+ while(pos) m_pFile->m_streams.GetNext(pos)->msb_timestamp = 0;
if(rt <= 0)
- {
- m_pFile->Seek(0);
- }
- else
- {
- m_pFile->Seek(0);
- // TODO
- }
+ {
+ m_pFile->Seek(0);
+ }
+ else
+ {
+ m_pFile->Seek(0);
+ // TODO
+ }
}
bool CNutSplitterFilter::DemuxLoop()
{
- bool fKeyFrame = false;
-
- while(!CheckRequest(NULL) && m_pFile->GetRemaining())
- {
- CNutFile::frame_header fh;
- fh.checksum_flag = 1;
-
- UINT64 id = 0;
-
- if(m_pFile->BitRead(1, true) == 0)
- {
- fh.zero_bit = m_pFile->BitRead(1);
- fh.priority = m_pFile->BitRead(2);
- fh.checksum_flag = m_pFile->BitRead(1);
- fh.msb_timestamp_flag = m_pFile->BitRead(1);
- fh.subpacket_type = m_pFile->BitRead(2);
- fh.reserved = m_pFile->BitRead(1);
- }
- else
- {
- if((id = m_pFile->BitRead(64)) == NUTK)
- {
- fKeyFrame = true;
- continue;
- }
- }
-
- CNutFile::packet_header ph;
- m_pFile->Read(ph);
-
- if(id == 0)
- {
- CNutFile::vint stream_id;
- m_pFile->Read(stream_id);
-
- CNutFile::stream_header* sh = NULL;
-
- POSITION pos = m_pFile->m_streams.GetHeadPosition();
- while(pos)
- {
- CNutFile::stream_header* tmp = m_pFile->m_streams.GetNext(pos);
- if(tmp->stream_id == stream_id)
- {
- sh = tmp;
- break;
- }
- }
-
- if(sh)
- {
- if(fh.msb_timestamp_flag)
- m_pFile->Read(sh->msb_timestamp);
-
- CNutFile::svint lsb_timestamp = 0;
- m_pFile->Read(lsb_timestamp);
-
- TRACE(_T("[%I64d]: %I64d:%I64d\n"), stream_id, sh->msb_timestamp, lsb_timestamp);
-
- CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = (DWORD)stream_id;
- p->bSyncPoint = fKeyFrame;
- p->rtStart = 10000i64 * ((sh->msb_timestamp << sh->msb_timestamp_shift) + lsb_timestamp)
- * sh->time_base_nom / sh->time_base_denom;
- p->rtStop = p->rtStart + 1;
-
- fKeyFrame = false;
-
- CNutFile::vint len = ph.fptr - (m_pFile->GetPos() - ph.pos);
- if(fh.checksum_flag) len -= 4;
-
- if(fh.subpacket_type == 1)
- {
- p->SetCount(len);
- m_pFile->ByteRead(p->GetData(), p->GetCount());
-
- if(FAILED(DeliverPacket(p)))
- break;
- }
- else
- {
- // TODO
- /*
- vint subpacket_count;
- Read(subpacket_count);
-
- if(fh.subpacket_type & 1)
- {
- CArray<vint> keyframe_run;
- keyframe_run.SetSize(subpacket_count);
- for(int i = 0; i < subpacket_count; i++)
- Read(keyframe_run[i]);
- }
-
- CArray<vint> timestamp_diff;
- timestamp_diff.SetSize(subpacket_count);
- CArray<vint> timestamp_diff_run;
- timestamp_diff_run.SetSize(subpacket_count);
- for(int i = 0; i < subpacket_count; i++)
- {
- Read(timestamp_diff[i]);
- if(timestamp_diff[i] & 1)
- Read(timestamp_diff_run[i]);
- }
-
- if(fh.subpacket_type & 2)
- {
- CArray<string> subpacket_size_diff;
- for(int i = 0; i < subpacket_count-1; i++)
- {
- Read(subpacket_size_diff[i]);
- }
- }
-
- for(int i = 0; i < subpacket_count; i++)
- {
- }
- */
- }
- }
- }
-
- if(fh.checksum_flag)
- {
- m_pFile->Seek(ph.pos + ph.fptr - 4);
- ph.checksum = (UINT32)m_pFile->BitRead(32);
- }
-
- m_pFile->Seek(ph.pos + ph.fptr);
- }
-
- return(true);
+ bool fKeyFrame = false;
+
+ while(!CheckRequest(NULL) && m_pFile->GetRemaining())
+ {
+ CNutFile::frame_header fh;
+ fh.checksum_flag = 1;
+
+ UINT64 id = 0;
+
+ if(m_pFile->BitRead(1, true) == 0)
+ {
+ fh.zero_bit = m_pFile->BitRead(1);
+ fh.priority = m_pFile->BitRead(2);
+ fh.checksum_flag = m_pFile->BitRead(1);
+ fh.msb_timestamp_flag = m_pFile->BitRead(1);
+ fh.subpacket_type = m_pFile->BitRead(2);
+ fh.reserved = m_pFile->BitRead(1);
+ }
+ else
+ {
+ if((id = m_pFile->BitRead(64)) == NUTK)
+ {
+ fKeyFrame = true;
+ continue;
+ }
+ }
+
+ CNutFile::packet_header ph;
+ m_pFile->Read(ph);
+
+ if(id == 0)
+ {
+ CNutFile::vint stream_id;
+ m_pFile->Read(stream_id);
+
+ CNutFile::stream_header* sh = NULL;
+
+ POSITION pos = m_pFile->m_streams.GetHeadPosition();
+ while(pos)
+ {
+ CNutFile::stream_header* tmp = m_pFile->m_streams.GetNext(pos);
+ if(tmp->stream_id == stream_id) {sh = tmp; break;}
+ }
+
+ if(sh)
+ {
+ if(fh.msb_timestamp_flag)
+ m_pFile->Read(sh->msb_timestamp);
+
+ CNutFile::svint lsb_timestamp = 0;
+ m_pFile->Read(lsb_timestamp);
+
+TRACE(_T("[%I64d]: %I64d:%I64d\n"), stream_id, sh->msb_timestamp, lsb_timestamp);
+
+ CAutoPtr<Packet> p(DNew Packet());
+ p->TrackNumber = (DWORD)stream_id;
+ p->bSyncPoint = fKeyFrame;
+ p->rtStart = 10000i64 * ((sh->msb_timestamp << sh->msb_timestamp_shift) + lsb_timestamp)
+ * sh->time_base_nom / sh->time_base_denom;
+ p->rtStop = p->rtStart+1;
+
+ fKeyFrame = false;
+
+ CNutFile::vint len = ph.fptr - (m_pFile->GetPos() - ph.pos);
+ if(fh.checksum_flag) len -= 4;
+
+ if(fh.subpacket_type == 1)
+ {
+ p->SetCount(len);
+ m_pFile->ByteRead(p->GetData(), p->GetCount());
+
+ if(FAILED(DeliverPacket(p)))
+ break;
+ }
+ else
+ {
+ // TODO
+/*
+ vint subpacket_count;
+ Read(subpacket_count);
+
+ if(fh.subpacket_type & 1)
+ {
+ CArray<vint> keyframe_run;
+ keyframe_run.SetSize(subpacket_count);
+ for(int i = 0; i < subpacket_count; i++)
+ Read(keyframe_run[i]);
+ }
+
+ CArray<vint> timestamp_diff;
+ timestamp_diff.SetSize(subpacket_count);
+ CArray<vint> timestamp_diff_run;
+ timestamp_diff_run.SetSize(subpacket_count);
+ for(int i = 0; i < subpacket_count; i++)
+ {
+ Read(timestamp_diff[i]);
+ if(timestamp_diff[i] & 1)
+ Read(timestamp_diff_run[i]);
+ }
+
+ if(fh.subpacket_type & 2)
+ {
+ CArray<string> subpacket_size_diff;
+ for(int i = 0; i < subpacket_count-1; i++)
+ {
+ Read(subpacket_size_diff[i]);
+ }
+ }
+
+ for(int i = 0; i < subpacket_count; i++)
+ {
+ }
+*/
+ }
+ }
+ }
+
+ if(fh.checksum_flag)
+ {
+ m_pFile->Seek(ph.pos + ph.fptr - 4);
+ ph.checksum = (UINT32)m_pFile->BitRead(32);
+ }
+
+ m_pFile->Seek(ph.pos + ph.fptr);
+ }
+
+ return(true);
}
// IMediaSeeking
STDMETHODIMP CNutSplitterFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- *pDuration = m_rtDuration;
- return S_OK;
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = m_rtDuration;
+ return S_OK;
}
//
@@ -339,8 +331,8 @@ STDMETHODIMP CNutSplitterFilter::GetDuration(LONGLONG* pDuration)
//
CNutSourceFilter::CNutSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CNutSplitterFilter(pUnk, phr)
+ : CNutSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
diff --git a/src/filters/parser/NutSplitter/NutSplitter.h b/src/filters/parser/NutSplitter/NutSplitter.h
index 14d6ac51e..3eb99904d 100644
--- a/src/filters/parser/NutSplitter/NutSplitter.h
+++ b/src/filters/parser/NutSplitter/NutSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,31 +25,31 @@
#include "NutFile.h"
// {5EB7173E-AA71-4a54-BDD1-1CA57D20405F}
-DEFINE_GUID(MEDIASUBTYPE_Nut,
- 0x5eb7173e, 0xaa71, 0x4a54, 0xbd, 0xd1, 0x1c, 0xa5, 0x7d, 0x20, 0x40, 0x5f);
+DEFINE_GUID(MEDIASUBTYPE_Nut,
+0x5eb7173e, 0xaa71, 0x4a54, 0xbd, 0xd1, 0x1c, 0xa5, 0x7d, 0x20, 0x40, 0x5f);
[uuid("90514D6A-76B7-4405-88A8-B4B1EF6061C6")]
class CNutSplitterFilter : public CBaseSplitterFilter
{
- CAutoPtr<CNutFile> m_pFile;
+ CAutoPtr<CNutFile> m_pFile;
protected:
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CNutSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CNutSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- // IMediaSeeking
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ // IMediaSeeking
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
};
[uuid("918B5A9F-DFED-4532-83A9-9B16D83ED73F")]
class CNutSourceFilter : public CNutSplitterFilter
{
public:
- CNutSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CNutSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/NutSplitter/resource.h b/src/filters/parser/NutSplitter/resource.h
index 02fc84368..80ef35412 100644
--- a/src/filters/parser/NutSplitter/resource.h
+++ b/src/filters/parser/NutSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by NutSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/NutSplitter/stdafx.cpp b/src/filters/parser/NutSplitter/stdafx.cpp
index e1ec5adac..4284c08d9 100644
--- a/src/filters/parser/NutSplitter/stdafx.cpp
+++ b/src/filters/parser/NutSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/NutSplitter/stdafx.h b/src/filters/parser/NutSplitter/stdafx.h
index 0c8bbfda0..e3ebbbb58 100644
--- a/src/filters/parser/NutSplitter/stdafx.h
+++ b/src/filters/parser/NutSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/OggSplitter/OggFile.cpp b/src/filters/parser/OggSplitter/OggFile.cpp
index 2bf8ffd25..e8a3a6d1f 100644
--- a/src/filters/parser/OggSplitter/OggFile.cpp
+++ b/src/filters/parser/OggSplitter/OggFile.cpp
@@ -2,81 +2,76 @@
#include "./oggfile.h"
COggFile::COggFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
+ : CBaseSplitterFile(pAsyncReader, hr, DEFAULT_CACHE_LENGTH, false)
{
- if(FAILED(hr)) return;
- hr = Init();
+ if(FAILED(hr)) return;
+ hr = Init();
}
HRESULT COggFile::Init()
{
- Seek(0);
- if(!Sync()) return E_FAIL;
+ Seek(0);
+ if(!Sync()) return E_FAIL;
- return S_OK;
+ return S_OK;
}
bool COggFile::Sync(HANDLE hBreak)
{
- __int64 start = GetPos();
+ __int64 start = GetPos();
- DWORD dw;
- for(__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
- i < j && S_OK == ByteRead((BYTE*)&dw, sizeof(dw))
- && ((i & 0xffff) || !hBreak || WaitForSingleObject(hBreak, 0) != WAIT_OBJECT_0);
- i++, Seek(start + i))
- {
- if(dw == 'SggO')
- {
- Seek(start + i);
- return(true);
- }
- }
+ DWORD dw;
+ for(__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
+ i < j && S_OK == ByteRead((BYTE*)&dw, sizeof(dw))
+ && ((i&0xffff) || !hBreak || WaitForSingleObject(hBreak, 0) != WAIT_OBJECT_0);
+ i++, Seek(start + i))
+ {
+ if(dw == 'SggO')
+ {
+ Seek(start + i);
+ return(true);
+ }
+ }
- Seek(start);
+ Seek(start);
- return(false);
+ return(false);
}
bool COggFile::Read(OggPageHeader& hdr, HANDLE hBreak)
{
- return Sync(hBreak) && S_OK == ByteRead((BYTE*)&hdr, sizeof(hdr)) && hdr.capture_pattern == 'SggO';
+ return Sync(hBreak) && S_OK == ByteRead((BYTE*)&hdr, sizeof(hdr)) && hdr.capture_pattern == 'SggO';
}
bool COggFile::Read(OggPage& page, bool fFull, HANDLE hBreak)
{
- memset(&page.m_hdr, 0, sizeof(page.m_hdr));
- page.m_lens.RemoveAll();
- page.SetCount(0);
+ memset(&page.m_hdr, 0, sizeof(page.m_hdr));
+ page.m_lens.RemoveAll();
+ page.SetCount(0);
- if(!Read(page.m_hdr, hBreak))
- return(false);
+ if(!Read(page.m_hdr, hBreak))
+ return(false);
- int pagelen = 0, packetlen = 0;
- for(BYTE i = 0; i < page.m_hdr.number_page_segments; i++)
- {
- BYTE b;
+ int pagelen = 0, packetlen = 0;
+ for(BYTE i = 0; i < page.m_hdr.number_page_segments; i++)
+ {
+ BYTE b;
if(S_OK != ByteRead(&b, 1)) return(false);
- packetlen += b;
- if(1/*b < 0xff*/)
- {
- page.m_lens.AddTail(packetlen);
- pagelen += packetlen;
- packetlen = 0;
- }
- }
+ packetlen += b;
+ if(1/*b < 0xff*/) {page.m_lens.AddTail(packetlen); pagelen += packetlen; packetlen = 0;}
+ }
- if(fFull)
- {
- page.SetCount(pagelen);
- if(S_OK != ByteRead(page.GetData(), page.GetCount()))
- return(false);
- }
- else
- {
- Seek(GetPos() + pagelen);
- page.m_lens.RemoveAll();
- }
+ if(fFull)
+ {
+ page.SetCount(pagelen);
+ if(S_OK != ByteRead(page.GetData(), page.GetCount()))
+ return(false);
+ }
+ else
+ {
+ Seek(GetPos() + pagelen);
+ page.m_lens.RemoveAll();
+ }
- return(true);
+ return(true);
}
diff --git a/src/filters/parser/OggSplitter/OggFile.h b/src/filters/parser/OggSplitter/OggFile.h
index 1c748daf1..f37f01c0c 100644
--- a/src/filters/parser/OggSplitter/OggFile.h
+++ b/src/filters/parser/OggSplitter/OggFile.h
@@ -6,78 +6,70 @@
struct OggPageHeader
{
- DWORD capture_pattern;
- BYTE stream_structure_version;
- BYTE header_type_flag;
- enum {continued = 1, first = 2, last = 4};
- __int64 granule_position;
- DWORD bitstream_serial_number;
- DWORD page_sequence_number;
- DWORD CRC_checksum;
- BYTE number_page_segments;
+ DWORD capture_pattern;
+ BYTE stream_structure_version;
+ BYTE header_type_flag; enum {continued=1, first=2, last=4};
+ __int64 granule_position;
+ DWORD bitstream_serial_number;
+ DWORD page_sequence_number;
+ DWORD CRC_checksum;
+ BYTE number_page_segments;
};
struct OggVorbisIdHeader
{
- DWORD vorbis_version;
- BYTE audio_channels;
- DWORD audio_sample_rate;
- DWORD bitrate_maximum;
- DWORD bitrate_nominal;
- DWORD bitrate_minimum;
- BYTE blocksize_0: 4;
- BYTE blocksize_1: 4;
- BYTE framing_flag;
+ DWORD vorbis_version;
+ BYTE audio_channels;
+ DWORD audio_sample_rate;
+ DWORD bitrate_maximum;
+ DWORD bitrate_nominal;
+ DWORD bitrate_minimum;
+ BYTE blocksize_0:4;
+ BYTE blocksize_1:4;
+ BYTE framing_flag;
};
struct OggVideoHeader
{
- DWORD w, h;
+ DWORD w, h;
};
struct OggAudioHeader
{
- WORD nChannels, nBlockAlign;
- DWORD nAvgBytesPerSec;
+ WORD nChannels, nBlockAlign;
+ DWORD nAvgBytesPerSec;
};
struct OggStreamHeader
{
- char streamtype[8], subtype[4];
- DWORD size;
- __int64 time_unit, samples_per_unit;
- DWORD default_len;
+ char streamtype[8], subtype[4];
+ DWORD size;
+ __int64 time_unit, samples_per_unit;
+ DWORD default_len;
DWORD buffersize;
- WORD bps;
- WORD alignmentfix1;
- union
- {
- OggVideoHeader v;
- OggAudioHeader a;
- };
- DWORD alignmentfix2;
+ WORD bps;
+ WORD alignmentfix1;
+ union {OggVideoHeader v; OggAudioHeader a;};
+ DWORD alignmentfix2;
};
#pragma pack(pop)
class OggPage : public CAtlArray<BYTE>
{
public:
- OggPageHeader m_hdr;
- CAtlList<int> m_lens;
- OggPage()
- {
- memset(&m_hdr, 0, sizeof(m_hdr));
- }
+ OggPageHeader m_hdr;
+ CAtlList<int> m_lens;
+ OggPage() {memset(&m_hdr, 0, sizeof(m_hdr));}
};
class COggFile : public CBaseSplitterFile
{
- HRESULT Init();
+ HRESULT Init();
public:
- COggFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ COggFile(IAsyncReader* pAsyncReader, HRESULT& hr);
- bool Sync(HANDLE hBreak = NULL);
- bool Read(OggPageHeader& hdr, HANDLE hBreak = NULL);
- bool Read(OggPage& page, bool fFull = true, HANDLE hBreak = NULL);
+ bool Sync(HANDLE hBreak = NULL);
+ bool Read(OggPageHeader& hdr, HANDLE hBreak = NULL);
+ bool Read(OggPage& page, bool fFull = true, HANDLE hBreak = NULL);
};
diff --git a/src/filters/parser/OggSplitter/OggSplitter.cpp b/src/filters/parser/OggSplitter/OggSplitter.cpp
index 90cc25a2d..9dbb2e456 100644
--- a/src/filters/parser/OggSplitter/OggSplitter.cpp
+++ b/src/filters/parser/OggSplitter/OggSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -40,7 +40,7 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -51,34 +51,34 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(COggSplitterFilter), L"MPC - Ogg Splitter", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(COggSourceFilter), L"MPC - Ogg Source", MERIT_NORMAL + 1, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(COggSplitterFilter), L"MPC - Ogg Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(COggSourceFilter), L"MPC - Ogg Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<COggSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<COggSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<COggSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<COggSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- RegisterSourceFilter(
- CLSID_AsyncReader,
- MEDIASUBTYPE_Ogg,
- _T("0,4,,4F676753"), // OggS
- _T(".ogg"), _T(".ogm"), NULL);
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Ogg,
+ _T("0,4,,4F676753"), // OggS
+ _T(".ogg"), _T(".ogm"), NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_Ogg);
+ UnRegisterSourceFilter(MEDIASUBTYPE_Ogg);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -93,56 +93,42 @@ CFilterApp theApp;
class bitstream
{
- BYTE* m_p;
- int m_len, m_pos;
+ BYTE* m_p;
+ int m_len, m_pos;
public:
- bitstream(BYTE* p, int len, bool rev = false) : m_p(p), m_len(len * 8)
- {
- m_pos = !rev ? 0 : len * 8;
- }
- bool hasbits(int cnt)
- {
- int pos = m_pos + cnt;
- return(pos >= 0 && pos < m_len);
- }
- unsigned int showbits(int cnt) // a bit unclean, but works and can read backwards too! :P
- {
- if(!hasbits(cnt))
- {
- ASSERT(0);
- return 0;
- }
- unsigned int ret = 0, off = 0;
- BYTE* p = m_p;
- if(cnt < 0)
- {
- p += (m_pos + cnt) >> 3;
- off = (m_pos + cnt) & 7;
- cnt = abs(cnt);
- ret = (*p++&(~0 << off))>>off; off = 8 - off; cnt -= off;
- }
- else
- {
- p += m_pos >> 3;
- off = m_pos & 7;
- ret = (*p++ >> off) & ((1 << min(cnt, 8)) - 1);
- off = 0;
- cnt -= 8 - off;
- }
- while(cnt > 0)
- {
- ret |= (*p++&((1 << min(cnt, 8)) - 1)) << off;
- off += 8;
- cnt -= 8;
- }
- return ret;
- }
- unsigned int getbits(int cnt)
- {
- unsigned int ret = showbits(cnt);
- m_pos += cnt;
- return ret;
- }
+ bitstream(BYTE* p, int len, bool rev = false) : m_p(p), m_len(len*8) {m_pos = !rev ? 0 : len*8;}
+ bool hasbits(int cnt)
+ {
+ int pos = m_pos+cnt;
+ return(pos >= 0 && pos < m_len);
+ }
+ unsigned int showbits(int cnt) // a bit unclean, but works and can read backwards too! :P
+ {
+ if(!hasbits(cnt)) {ASSERT(0); return 0;}
+ unsigned int ret = 0, off = 0;
+ BYTE* p = m_p;
+ if(cnt < 0)
+ {
+ p += (m_pos+cnt)>>3;
+ off = (m_pos+cnt)&7;
+ cnt = abs(cnt);
+ ret = (*p++&(~0<<off))>>off; off = 8 - off; cnt -= off;
+ }
+ else
+ {
+ p += m_pos>>3;
+ off = m_pos&7;
+ ret = (*p++>>off)&((1<<min(cnt,8))-1); off = 0; cnt -= 8 - off;
+ }
+ while(cnt > 0) {ret |= (*p++&((1<<min(cnt,8))-1)) << off; off += 8; cnt -= 8;}
+ return ret;
+ }
+ unsigned int getbits(int cnt)
+ {
+ unsigned int ret = showbits(cnt);
+ m_pos += cnt;
+ return ret;
+ }
};
//
@@ -150,7 +136,7 @@ public:
//
COggSplitterFilter::COggSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("COggSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("COggSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
@@ -160,437 +146,417 @@ COggSplitterFilter::~COggSplitterFilter()
HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
-
- m_pFile.Attach(DNew COggFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = 0;
-
- m_rtDuration = 0;
-
- m_pFile->Seek(0);
- OggPage page;
- for(int i = 0, nWaitForMore = 0; m_pFile->Read(page); i++)
- {
- BYTE* p = page.GetData();
-
- if(!(page.m_hdr.header_type_flag & OggPageHeader::continued))
- {
- BYTE type = *p++;
-
- CStringW name;
- name.Format(L"Stream %d", i);
-
- HRESULT hr;
-
- if(type >= 0x80 && type <= 0x82 && !memcmp(p, "theora", 6))
- {
- if(type == 0x80)
- {
- name.Format(L"Theora %d", i);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- pPinOut.Attach(DNew COggTheoraOutputPin(page.GetData(), name, this, this, &hr));
- AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
- nWaitForMore++;
- }
- }
- else if(type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first))
- {
- CAutoPtr<CBaseSplitterOutputPin> pPinOut;
-
- if(!memcmp(p, "vorbis", 6))
- {
- name.Format(L"Vorbis %d", i);
- pPinOut.Attach(DNew COggVorbisOutputPin((OggVorbisIdHeader*)(p + 6), name, this, this, &hr));
- nWaitForMore++;
- }
- else if(!memcmp(p, "video", 5))
- {
- name.Format(L"Video %d", i);
- pPinOut.Attach(DNew COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- }
- else if(!memcmp(p, "audio", 5))
- {
- name.Format(L"Audio %d", i);
- pPinOut.Attach(DNew COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- }
- else if(!memcmp(p, "text", 4))
- {
- name.Format(L"Text %d", i);
- pPinOut.Attach(DNew COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
- }
- else if(!memcmp(p, "Direct Show Samples embedded in Ogg", 35))
- {
- name.Format(L"DirectShow %d", i);
- pPinOut.Attach(DNew COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p + 35 + sizeof(GUID)), name, this, this, &hr));
- }
-
- AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
- }
- else if(type == 3 && !memcmp(p, "vorbis", 6))
- {
- if(COggSplitterOutputPin* pOggPin =
- dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
- {
- pOggPin->AddComment(p + 6, page.GetCount() - 6 - 1);
- }
- }
- else if(type == 0x7F && page.GetCount() > 12 && *(long*)(p + 8) == 0x43614C66) // Flac
- {
- // Ogg Flac : method 1
- CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- name.Format(L"Flac %d", i);
- pPinOut.Attach(DNew COggFlacOutputPin(p + 12, page.GetCount() - 14, name, this, this, &hr));
- AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
- }
- else if(*(long*)(p - 1) == 0x43614C66)
- {
- //bFlac = true;
- //nWaitForMore++;
- if(m_pFile->Read(page))
- {
- CAutoPtr<CBaseSplitterOutputPin> pPinOut;
- name.Format(L"Flac %d", i);
- p = page.GetData();
- pPinOut.Attach(DNew COggFlacOutputPin(p, page.GetCount(), name, this, this, &hr));
- AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
- }
- }
- else if(!(type & 1) && nWaitForMore == 0)
- {
- break;
- }
- }
-
- if(COggTheoraOutputPin* p = dynamic_cast<COggTheoraOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
- {
- p->UnpackInitPage(page);
- if(p->IsInitialized()) nWaitForMore--;
- }
-
- if(COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
- {
- p->UnpackInitPage(page);
- if(p->IsInitialized()) nWaitForMore--;
- }
- }
-
- if(m_pOutputs.IsEmpty())
- return E_FAIL;
-
- if(m_pFile->IsRandomAccess())
- {
- m_pFile->Seek(max(m_pFile->GetLength() - 65536, 0));
-
- OggPage page;
- while(m_pFile->Read(page))
- {
- COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin || page.m_hdr.granule_position == -1) continue;
- REFERENCE_TIME rt = pOggPin->GetRefTime(page.m_hdr.granule_position);
- m_rtDuration = max(rt, m_rtDuration);
- }
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration;
-
- // comments
-
- {
- CAtlMap<CStringW, CStringW, CStringElementTraits<CStringW> > tagmap;
- tagmap[L"TITLE"] = L"TITL";
- tagmap[L"ARTIST"] = L"AUTH"; // not quite
- tagmap[L"COPYRIGHT"] = L"CPYR";
- tagmap[L"DESCRIPTION"] = L"DESC";
-
- POSITION pos2 = tagmap.GetStartPosition();
- while(pos2)
- {
- CStringW oggtag, dsmtag;
- tagmap.GetNextAssoc(pos2, oggtag, dsmtag);
-
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos)
- {
- COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
- if(!pOggPin) continue;
-
- CStringW value = pOggPin->GetComment(oggtag);
- if(!value.IsEmpty())
- {
- SetProperty(dsmtag, value);
- break;
- }
- }
- }
-
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos && !ChapGetCount())
- {
- COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
- if(!pOggPin) continue;
-
- for(int i = 1; pOggPin; i++)
- {
- CStringW key;
- key.Format(L"CHAPTER%02d", i);
- CStringW time = pOggPin->GetComment(key);
- if(time.IsEmpty()) break;
- key.Format(L"CHAPTER%02dNAME", i);
- CStringW name = pOggPin->GetComment(key);
- if(name.IsEmpty()) name.Format(L"Chapter %d", i);
- int h, m, s, ms;
- WCHAR c;
- if(7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) break;
- REFERENCE_TIME rt = ((((REFERENCE_TIME)h * 60 + m) * 60 + s) * 1000 + ms) * 10000;
- ChapAppend(rt, name);
- }
- }
- }
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(DNew COggFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = 0;
+
+ m_rtDuration = 0;
+
+ m_pFile->Seek(0);
+ OggPage page;
+ for(int i = 0, nWaitForMore = 0; m_pFile->Read(page); i++)
+ {
+ BYTE* p = page.GetData();
+
+ if(!(page.m_hdr.header_type_flag & OggPageHeader::continued))
+ {
+ BYTE type = *p++;
+
+ CStringW name;
+ name.Format(L"Stream %d", i);
+
+ HRESULT hr;
+
+ if(type >= 0x80 && type <= 0x82 && !memcmp(p, "theora", 6))
+ {
+ if(type == 0x80)
+ {
+ name.Format(L"Theora %d", i);
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut;
+ pPinOut.Attach(DNew COggTheoraOutputPin(page.GetData(), name, this, this, &hr));
+ AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
+ nWaitForMore++;
+ }
+ }
+ else if(type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first))
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut;
+
+ if(!memcmp(p, "vorbis", 6))
+ {
+ name.Format(L"Vorbis %d", i);
+ pPinOut.Attach(DNew COggVorbisOutputPin((OggVorbisIdHeader*)(p+6), name, this, this, &hr));
+ nWaitForMore++;
+ }
+ else if(!memcmp(p, "video", 5))
+ {
+ name.Format(L"Video %d", i);
+ pPinOut.Attach(DNew COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ }
+ else if(!memcmp(p, "audio", 5))
+ {
+ name.Format(L"Audio %d", i);
+ pPinOut.Attach(DNew COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ }
+ else if(!memcmp(p, "text", 4))
+ {
+ name.Format(L"Text %d", i);
+ pPinOut.Attach(DNew COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ }
+ else if(!memcmp(p, "Direct Show Samples embedded in Ogg", 35))
+ {
+ name.Format(L"DirectShow %d", i);
+ pPinOut.Attach(DNew COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p+35+sizeof(GUID)), name, this, this, &hr));
+ }
+
+ AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
+ }
+ else if(type == 3 && !memcmp(p, "vorbis", 6))
+ {
+ if(COggSplitterOutputPin* pOggPin =
+ dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ {
+ pOggPin->AddComment(p+6, page.GetCount()-6-1);
+ }
+ }
+ else if(type == 0x7F && page.GetCount()>12 && *(long*)(p+8) == 0x43614C66) // Flac
+ {
+ // Ogg Flac : method 1
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut;
+ name.Format(L"Flac %d", i);
+ pPinOut.Attach(DNew COggFlacOutputPin(p+12, page.GetCount()-14, name, this, this, &hr));
+ AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
+ }
+ else if (*(long*)(p-1) == 0x43614C66)
+ {
+ //bFlac = true;
+ //nWaitForMore++;
+ if (m_pFile->Read(page))
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut;
+ name.Format(L"Flac %d", i);
+ p = page.GetData();
+ pPinOut.Attach(DNew COggFlacOutputPin(p, page.GetCount(), name, this, this, &hr));
+ AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
+ }
+ }
+ else if(!(type&1) && nWaitForMore == 0)
+ {
+ break;
+ }
+ }
+
+ if(COggTheoraOutputPin* p = dynamic_cast<COggTheoraOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ {
+ p->UnpackInitPage(page);
+ if(p->IsInitialized()) nWaitForMore--;
+ }
+
+ if(COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ {
+ p->UnpackInitPage(page);
+ if(p->IsInitialized()) nWaitForMore--;
+ }
+ }
+
+ if(m_pOutputs.IsEmpty())
+ return E_FAIL;
+
+ if(m_pFile->IsRandomAccess())
+ {
+ m_pFile->Seek(max(m_pFile->GetLength()-65536, 0));
+
+ OggPage page;
+ while(m_pFile->Read(page))
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
+ if(!pOggPin || page.m_hdr.granule_position == -1) continue;
+ REFERENCE_TIME rt = pOggPin->GetRefTime(page.m_hdr.granule_position);
+ m_rtDuration = max(rt, m_rtDuration);
+ }
+ }
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration;
+
+ // comments
+
+ {
+ CAtlMap<CStringW, CStringW, CStringElementTraits<CStringW> > tagmap;
+ tagmap[L"TITLE"] = L"TITL";
+ tagmap[L"ARTIST"] = L"AUTH"; // not quite
+ tagmap[L"COPYRIGHT"] = L"CPYR";
+ tagmap[L"DESCRIPTION"] = L"DESC";
+
+ POSITION pos2 = tagmap.GetStartPosition();
+ while(pos2)
+ {
+ CStringW oggtag, dsmtag;
+ tagmap.GetNextAssoc(pos2, oggtag, dsmtag);
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos)
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
+ if(!pOggPin) continue;
+
+ CStringW value = pOggPin->GetComment(oggtag);
+ if(!value.IsEmpty())
+ {
+ SetProperty(dsmtag, value);
+ break;
+ }
+ }
+ }
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos && !ChapGetCount())
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
+ if(!pOggPin) continue;
+
+ for(int i = 1; pOggPin; i++)
+ {
+ CStringW key;
+ key.Format(L"CHAPTER%02d", i);
+ CStringW time = pOggPin->GetComment(key);
+ if(time.IsEmpty()) break;
+ key.Format(L"CHAPTER%02dNAME", i);
+ CStringW name = pOggPin->GetComment(key);
+ if(name.IsEmpty()) name.Format(L"Chapter %d", i);
+ int h, m, s, ms;
+ WCHAR c;
+ if(7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) break;
+ REFERENCE_TIME rt = ((((REFERENCE_TIME)h*60+m)*60+s)*1000+ms)*10000;
+ ChapAppend(rt, name);
+ }
+ }
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool COggSplitterFilter::DemuxInit()
{
- if(!m_pFile) return(false);
+ if(!m_pFile) return(false);
- return(true);
+ return(true);
}
void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0)
- {
- m_pFile->Seek(0);
- }
- else if(m_rtDuration > 0)
- {
- // oh, the horror...
-
- __int64 len = m_pFile->GetLength();
- __int64 startpos = len * rt / m_rtDuration;
- __int64 diff = 0;
-
- REFERENCE_TIME rtMinDiff = _I64_MAX;
-
- while(1)
- {
- __int64 endpos = startpos;
- REFERENCE_TIME rtPos = -1;
-
- OggPage page;
- m_pFile->Seek(startpos);
- while(m_pFile->Read(page, false))
- {
- if(page.m_hdr.granule_position == -1) continue;
-
- COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin)
- {
- ASSERT(0);
- continue;
- }
-
- rtPos = pOggPin->GetRefTime(page.m_hdr.granule_position);
- endpos = m_pFile->GetPos();
-
- break;
- }
-
- __int64 rtDiff = rtPos - rt;
-
- if(rtDiff < 0)
- {
- rtDiff = -rtDiff;
-
- if(rtDiff < 1000000 || rtDiff >= rtMinDiff)
- {
- m_pFile->Seek(startpos);
- break;
- }
-
- rtMinDiff = rtDiff;
- }
-
- __int64 newpos = startpos;
-
- if(rtPos < rt && rtPos < m_rtDuration)
- {
- newpos = startpos + (__int64)((1.0 * (rt - rtPos) / (m_rtDuration - rtPos)) * (len - startpos)) + 1024;
- if(newpos < endpos) newpos = endpos + 1024;
- }
- else if(rtPos > rt && rtPos > 0)
- {
- newpos = startpos - (__int64)((1.0 * (rtPos - rt) / (rtPos - 0)) * (startpos - 0)) - 1024;
- if(newpos >= startpos) newpos = startpos - 1024;
- }
- else if(rtPos == rt)
- {
- m_pFile->Seek(startpos);
- break;
- }
- else
- {
- ASSERT(0);
- m_pFile->Seek(0);
- break;
- }
-
- diff = newpos - startpos;
-
- startpos = max(min(newpos, len), 0);
- }
-
- m_pFile->Seek(startpos);
-
- POSITION pos = m_pOutputs.GetHeadPosition();
- while(pos)
- {
- COggSplitterOutputPin* pPin = dynamic_cast<COggSplitterOutputPin*>(static_cast<CBaseSplitterOutputPin*>(m_pOutputs.GetNext(pos)));
-
- if(!dynamic_cast<COggVideoOutputPin*>(pPin) && !dynamic_cast<COggTheoraOutputPin*>(pPin))
- continue;
-
- bool fKeyFrameFound = false, fSkipKeyFrame = true;
- __int64 endpos = _I64_MAX;
-
- while(!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0)
- {
- OggPage page;
- while(!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page))
- {
- if(page.m_hdr.granule_position == -1)
- continue;
-
- if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
- continue;
-
- if(pPin->GetRefTime(page.m_hdr.granule_position) > rt)
- break;
-
- if(!fKeyFrameFound)
- {
- pPin->UnpackPage(page);
-
- CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket())
- {
- if(p->bSyncPoint)
- {
- fKeyFrameFound = true;
- fSkipKeyFrame = p->fSkip;
- }
- }
-
- if(fKeyFrameFound) break;
- }
- else
- {
- pPin->UnpackPage(page);
-
- CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket())
- {
- if(!p->fSkip)
- {
- fSkipKeyFrame = false;
- break;
- }
- }
- }
- }
-
- if(!(fKeyFrameFound && !fSkipKeyFrame))
- {
- endpos = startpos;
- startpos = max(startpos - 10 * 65536, 0);
- }
-
- m_pFile->Seek(startpos);
- }
+ if(rt <= 0 )
+ {
+ m_pFile->Seek(0);
+ }
+ else if(m_rtDuration > 0)
+ {
+ // oh, the horror...
+
+ __int64 len = m_pFile->GetLength();
+ __int64 startpos = len * rt/m_rtDuration;
+ __int64 diff = 0;
+
+ REFERENCE_TIME rtMinDiff = _I64_MAX;
+
+ while(1)
+ {
+ __int64 endpos = startpos;
+ REFERENCE_TIME rtPos = -1;
+
+ OggPage page;
+ m_pFile->Seek(startpos);
+ while(m_pFile->Read(page, false))
+ {
+ if(page.m_hdr.granule_position == -1) continue;
+
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
+ if(!pOggPin) {ASSERT(0); continue;}
+
+ rtPos = pOggPin->GetRefTime(page.m_hdr.granule_position);
+ endpos = m_pFile->GetPos();
+
+ break;
+ }
+
+ __int64 rtDiff = rtPos - rt;
+
+ if(rtDiff < 0)
+ {
+ rtDiff = -rtDiff;
+
+ if(rtDiff < 1000000 || rtDiff >= rtMinDiff)
+ {
+ m_pFile->Seek(startpos);
+ break;
+ }
+
+ rtMinDiff = rtDiff;
+ }
+
+ __int64 newpos = startpos;
+
+ if(rtPos < rt && rtPos < m_rtDuration)
+ {
+ newpos = startpos + (__int64)((1.0*(rt - rtPos)/(m_rtDuration - rtPos)) * (len - startpos)) + 1024;
+ if(newpos < endpos) newpos = endpos + 1024;
+ }
+ else if(rtPos > rt && rtPos > 0)
+ {
+ newpos = startpos - (__int64)((1.0*(rtPos - rt)/(rtPos - 0)) * (startpos - 0)) - 1024;
+ if(newpos >= startpos) newpos = startpos - 1024;
+ }
+ else if(rtPos == rt)
+ {
+ m_pFile->Seek(startpos);
+ break;
+ }
+ else
+ {
+ ASSERT(0);
+ m_pFile->Seek(0);
+ break;
+ }
+
+ diff = newpos - startpos;
+
+ startpos = max(min(newpos, len), 0);
+ }
+
+ m_pFile->Seek(startpos);
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos)
+ {
+ COggSplitterOutputPin* pPin = dynamic_cast<COggSplitterOutputPin*>(static_cast<CBaseSplitterOutputPin*>(m_pOutputs.GetNext(pos)));
+
+ if(!dynamic_cast<COggVideoOutputPin*>(pPin) && !dynamic_cast<COggTheoraOutputPin*>(pPin))
+ continue;
+
+ bool fKeyFrameFound = false, fSkipKeyFrame = true;
+ __int64 endpos = _I64_MAX;
+
+ while(!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0)
+ {
+ OggPage page;
+ while(!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page))
+ {
+ if(page.m_hdr.granule_position == -1)
+ continue;
+
+ if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ continue;
+
+ if(pPin->GetRefTime(page.m_hdr.granule_position) > rt)
+ break;
+
+ if(!fKeyFrameFound)
+ {
+ pPin->UnpackPage(page);
+
+ CAutoPtr<OggPacket> p;
+ while(p = pPin->GetPacket())
+ {
+ if(p->bSyncPoint)
+ {
+ fKeyFrameFound = true;
+ fSkipKeyFrame = p->fSkip;
+ }
+ }
+
+ if(fKeyFrameFound) break;
+ }
+ else
+ {
+ pPin->UnpackPage(page);
+
+ CAutoPtr<OggPacket> p;
+ while(p = pPin->GetPacket())
+ {
+ if(!p->fSkip)
+ {
+ fSkipKeyFrame = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if(!(fKeyFrameFound && !fSkipKeyFrame)) {endpos = startpos; startpos = max(startpos - 10*65536, 0);}
+
+ m_pFile->Seek(startpos);
+ }
#ifdef DEBUG
- // verify kf
+ // verify kf
- {
- fKeyFrameFound = false;
+ {
+ fKeyFrameFound = false;
- OggPage page;
- while(!fKeyFrameFound && m_pFile->Read(page))
- {
- if(page.m_hdr.granule_position == -1) continue;
+ OggPage page;
+ while(!fKeyFrameFound && m_pFile->Read(page))
+ {
+ if(page.m_hdr.granule_position == -1) continue;
- if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
- continue;
+ if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ continue;
- REFERENCE_TIME rtPos = pPin->GetRefTime(page.m_hdr.granule_position);
- if(rtPos > rt)
- break;
+ REFERENCE_TIME rtPos = pPin->GetRefTime(page.m_hdr.granule_position);
+ if(rtPos > rt)
+ break;
- pPin->UnpackPage(page);
+ pPin->UnpackPage(page);
- CAutoPtr<OggPacket> p;
- while(p = pPin->GetPacket())
- {
- if(p->bSyncPoint)
- {
- fKeyFrameFound = true;
- break;
- }
- }
- }
+ CAutoPtr<OggPacket> p;
+ while(p = pPin->GetPacket())
+ {
+ if(p->bSyncPoint)
+ {
+ fKeyFrameFound = true;
+ break;
+ }
+ }
+ }
- ASSERT(fKeyFrameFound);
+ ASSERT(fKeyFrameFound);
- m_pFile->Seek(startpos);
- }
+ m_pFile->Seek(startpos);
+ }
#endif
- break;
- }
- }
+ break;
+ }
+ }
}
bool COggSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
-
- OggPage page;
- while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle()))
- {
- COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
- if(!pOggPin)
- {
- ASSERT(0);
- continue;
- }
- if(!pOggPin->IsConnected()) continue;
- if(FAILED(hr = pOggPin->UnpackPage(page)))
- {
- ASSERT(0);
- break;
- }
- CAutoPtr<OggPacket> p;
- while(!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket()))
- {
- if(!p->fSkip)
- hr = DeliverPacket(p);
- }
- }
-
- return(true);
+ HRESULT hr = S_OK;
+
+ OggPage page;
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle()))
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
+ if(!pOggPin) {ASSERT(0); continue;}
+ if(!pOggPin->IsConnected()) continue;
+ if(FAILED(hr = pOggPin->UnpackPage(page))) {ASSERT(0); break;}
+ CAutoPtr<OggPacket> p;
+ while(!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket()))
+ {
+ if(!p->fSkip)
+ hr = DeliverPacket(p);
+ }
+ }
+
+ return(true);
}
//
@@ -598,10 +564,10 @@ bool COggSplitterFilter::DemuxLoop()
//
COggSourceFilter::COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : COggSplitterFilter(pUnk, phr)
+ : COggSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -609,190 +575,190 @@ COggSourceFilter::COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
COggSplitterOutputPin::COggSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(pName, pFilter, pLock, phr)
+ : CBaseSplitterOutputPin(pName, pFilter, pLock, phr)
{
- ResetState(-1);
+ ResetState(-1);
}
void COggSplitterOutputPin::AddComment(BYTE* p, int len)
{
- bitstream bs(p, len);
- bs.getbits(bs.getbits(32) * 8);
- for(int n = bs.getbits(32); n-- > 0;)
- {
- CStringA str;
- for(int len = bs.getbits(32); len-- > 0;)
- str += (CHAR)bs.getbits(8);
-
- CAtlList<CStringA> sl;
- Explode(str, sl, '=', 2);
- if(sl.GetCount() == 2)
- {
- CAutoPtr<CComment> p(DNew CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
-
- if(p->m_key == L"LANGUAGE")
- {
- CString lang = ISO6392ToLanguage(sl.GetTail()), iso6392 = LanguageToISO6392(CString(p->m_value));
-
- if(p->m_value.GetLength() == 3 && !lang.IsEmpty())
- {
- SetName(CStringW(lang));
- SetProperty(L"LANG", p->m_value);
- }
- else if(!iso6392.IsEmpty())
- {
- SetName(p->m_value);
- SetProperty(L"LANG", CStringW(iso6392));
- }
- else
- {
- SetName(p->m_value);
- SetProperty(L"NAME", p->m_value);
- }
- }
-
- m_pComments.AddTail(p);
- }
- }
- ASSERT(bs.getbits(1) == 1);
+ bitstream bs(p, len);
+ bs.getbits(bs.getbits(32)*8);
+ for(int n = bs.getbits(32); n-- > 0; )
+ {
+ CStringA str;
+ for(int len = bs.getbits(32); len-- > 0; )
+ str += (CHAR)bs.getbits(8);
+
+ CAtlList<CStringA> sl;
+ Explode(str, sl, '=', 2);
+ if(sl.GetCount() == 2)
+ {
+ CAutoPtr<CComment> p(DNew CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
+
+ if(p->m_key == L"LANGUAGE")
+ {
+ CString lang = ISO6392ToLanguage(sl.GetTail()), iso6392 = LanguageToISO6392(CString(p->m_value));
+
+ if(p->m_value.GetLength() == 3 && !lang.IsEmpty())
+ {
+ SetName(CStringW(lang));
+ SetProperty(L"LANG", p->m_value);
+ }
+ else if(!iso6392.IsEmpty())
+ {
+ SetName(p->m_value);
+ SetProperty(L"LANG", CStringW(iso6392));
+ }
+ else
+ {
+ SetName(p->m_value);
+ SetProperty(L"NAME", p->m_value);
+ }
+ }
+
+ m_pComments.AddTail(p);
+ }
+ }
+ ASSERT(bs.getbits(1) == 1);
}
CStringW COggSplitterOutputPin::GetComment(CStringW key)
{
- key.MakeUpper();
- CAtlList<CStringW> sl;
- POSITION pos = m_pComments.GetHeadPosition();
- while(pos)
- {
- CComment* p = m_pComments.GetNext(pos);
- if(key == p->m_key) sl.AddTail(p->m_value);
- }
- return Implode(sl, ';');
+ key.MakeUpper();
+ CAtlList<CStringW> sl;
+ POSITION pos = m_pComments.GetHeadPosition();
+ while(pos)
+ {
+ CComment* p = m_pComments.GetNext(pos);
+ if(key == p->m_key) sl.AddTail(p->m_value);
+ }
+ return Implode(sl, ';');
}
void COggSplitterOutputPin::ResetState(DWORD seqnum)
{
- CAutoLock csAutoLock(&m_csPackets);
- m_packets.RemoveAll();
- m_lastpacket.Free();
- m_lastseqnum = seqnum;
- m_rtLast = 0;
- m_fSkip = true;
+ CAutoLock csAutoLock(&m_csPackets);
+ m_packets.RemoveAll();
+ m_lastpacket.Free();
+ m_lastseqnum = seqnum;
+ m_rtLast = 0;
+ m_fSkip = true;
}
HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
{
- if(m_lastseqnum != page.m_hdr.page_sequence_number - 1)
- {
- ResetState(page.m_hdr.page_sequence_number);
- return S_FALSE; // FIXME
- }
- else
- {
- m_lastseqnum = page.m_hdr.page_sequence_number;
- }
+ if(m_lastseqnum != page.m_hdr.page_sequence_number-1)
+ {
+ ResetState(page.m_hdr.page_sequence_number);
+ return S_FALSE; // FIXME
+ }
+ else
+ {
+ m_lastseqnum = page.m_hdr.page_sequence_number;
+ }
- POSITION first = page.m_lens.GetHeadPosition();
- while(first && page.m_lens.GetAt(first) == 255) page.m_lens.GetNext(first);
- if(!first) first = page.m_lens.GetTailPosition();
+ POSITION first = page.m_lens.GetHeadPosition();
+ while(first && page.m_lens.GetAt(first) == 255) page.m_lens.GetNext(first);
+ if(!first) first = page.m_lens.GetTailPosition();
- POSITION last = page.m_lens.GetTailPosition();
- while(last && page.m_lens.GetAt(last) == 255) page.m_lens.GetPrev(last);
- if(!last) last = page.m_lens.GetTailPosition();
+ POSITION last = page.m_lens.GetTailPosition();
+ while(last && page.m_lens.GetAt(last) == 255) page.m_lens.GetPrev(last);
+ if(!last) last = page.m_lens.GetTailPosition();
- BYTE* pData = page.GetData();
+ BYTE* pData = page.GetData();
- int i = 0, j = 0, len = 0;
+ int i = 0, j = 0, len = 0;
for(POSITION pos = page.m_lens.GetHeadPosition(); pos; page.m_lens.GetNext(pos))
- {
- len = page.m_lens.GetAt(pos);
- j += len;
-
- if(len < 255 || pos == page.m_lens.GetTailPosition())
- {
- if(first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued))
- {
+ {
+ len = page.m_lens.GetAt(pos);
+ j += len;
+
+ if(len < 255 || pos == page.m_lens.GetTailPosition())
+ {
+ if(first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued))
+ {
// ASSERT(m_lastpacket);
- if(m_lastpacket)
- {
- int size = m_lastpacket->GetCount();
- m_lastpacket->SetCount(size + j - i);
- memcpy(m_lastpacket->GetData() + size, pData + i, j - i);
-
- CAutoLock csAutoLock(&m_csPackets);
-
- if(len < 255) m_packets.AddTail(m_lastpacket);
- }
- }
- else
- {
- CAutoPtr<OggPacket> p(DNew OggPacket());
-
- if(last == pos && page.m_hdr.granule_position != -1)
- {
- p->bDiscontinuity = m_fSkip;
- REFERENCE_TIME rtLast = m_rtLast;
- m_rtLast = GetRefTime(page.m_hdr.granule_position);
-// some bad encodings have a +/-1 frame difference from the normal timeline,
-// but these seem to cancel eachother out nicely so we can just ignore them
+ if(m_lastpacket)
+ {
+ int size = m_lastpacket->GetCount();
+ m_lastpacket->SetCount(size + j-i);
+ memcpy(m_lastpacket->GetData() + size, pData + i, j-i);
+
+ CAutoLock csAutoLock(&m_csPackets);
+
+ if(len < 255) m_packets.AddTail(m_lastpacket);
+ }
+ }
+ else
+ {
+ CAutoPtr<OggPacket> p(DNew OggPacket());
+
+ if(last == pos && page.m_hdr.granule_position != -1)
+ {
+ p->bDiscontinuity = m_fSkip;
+REFERENCE_TIME rtLast = m_rtLast;
+ m_rtLast = GetRefTime(page.m_hdr.granule_position);
+// some bad encodings have a +/-1 frame difference from the normal timeline,
+// but these seem to cancel eachother out nicely so we can just ignore them
// to make it play a bit more smooth.
- if(abs(rtLast - m_rtLast) == GetRefTime(1)) m_rtLast = rtLast; // FIXME
- m_fSkip = false;
- }
+if(abs(rtLast - m_rtLast) == GetRefTime(1)) m_rtLast = rtLast; // FIXME
+ m_fSkip = false;
+ }
- p->TrackNumber = page.m_hdr.bitstream_serial_number;
+ p->TrackNumber = page.m_hdr.bitstream_serial_number;
- if(S_OK == UnpackPacket(p, pData + i, j - i))
- {
+ if(S_OK == UnpackPacket(p, pData + i, j-i))
+ {
//if(p->TrackNumber == 1)
-//TRACE(_T("[%d]: %d, %I64d -> %I64d (skip=%d, disc=%d, sync=%d)\n"),
+//TRACE(_T("[%d]: %d, %I64d -> %I64d (skip=%d, disc=%d, sync=%d)\n"),
// (int)p->TrackNumber, p->GetCount(), p->rtStart, p->rtStop,
// (int)m_fSkip, (int)p->bDiscontinuity, (int)p->bSyncPoint);
- if(p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64 * 60)
- {
- CAutoLock csAutoLock(&m_csPackets);
+ if(p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64*60)
+ {
+ CAutoLock csAutoLock(&m_csPackets);
- m_rtLast = p->rtStop;
- p->fSkip = m_fSkip;
+ m_rtLast = p->rtStop;
+ p->fSkip = m_fSkip;
- if(len < 255) m_packets.AddTail(p);
- else m_lastpacket = p;
- }
- else
- {
- ASSERT(0);
- }
- }
- }
+ if(len < 255) m_packets.AddTail(p);
+ else m_lastpacket = p;
+ }
+ else
+ {
+ ASSERT(0);
+ }
+ }
+ }
- i = j;
- }
- }
+ i = j;
+ }
+ }
- return S_OK;
+ return S_OK;
}
CAutoPtr<OggPacket> COggSplitterOutputPin::GetPacket()
{
- CAutoPtr<OggPacket> p;
- CAutoLock csAutoLock(&m_csPackets);
- if(m_packets.GetCount()) p = m_packets.RemoveHead();
- return p;
+ CAutoPtr<OggPacket> p;
+ CAutoLock csAutoLock(&m_csPackets);
+ if(m_packets.GetCount()) p = m_packets.RemoveHead();
+ return p;
}
HRESULT COggSplitterOutputPin::DeliverEndFlush()
{
- ResetState();
- return __super::DeliverEndFlush();
+ ResetState();
+ return __super::DeliverEndFlush();
}
HRESULT COggSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- ResetState();
- return __super::DeliverNewSegment(tStart, tStop, dRate);
+ ResetState();
+ return __super::DeliverNewSegment(tStart, tStop, dRate);
}
//
@@ -800,155 +766,151 @@ HRESULT COggSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENC
//
COggVorbisOutputPin::COggVorbisOutputPin(OggVorbisIdHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
{
- m_audio_sample_rate = h->audio_sample_rate;
- m_blocksize[0] = 1 << h->blocksize_0;
- m_blocksize[1] = 1 << h->blocksize_1;
- m_lastblocksize = 0;
-
- CMediaType mt;
-
- mt.InitMediaType();
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = MEDIASUBTYPE_Vorbis;
- mt.formattype = FORMAT_VorbisFormat;
- VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
- memset(mt.Format(), 0, mt.FormatLength());
- vf->nChannels = h->audio_channels;
- vf->nSamplesPerSec = h->audio_sample_rate;
- vf->nAvgBitsPerSec = h->bitrate_nominal;
- vf->nMinBitsPerSec = h->bitrate_minimum;
- vf->nMaxBitsPerSec = h->bitrate_maximum;
- vf->fQuality = -1;
- mt.SetSampleSize(8192);
- m_mts.Add(mt);
-
- mt.InitMediaType();
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = MEDIASUBTYPE_Vorbis2;
- mt.formattype = FORMAT_VorbisFormat2;
- VORBISFORMAT2* vf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2));
- memset(mt.Format(), 0, mt.FormatLength());
- vf2->Channels = h->audio_channels;
- vf2->SamplesPerSec = h->audio_sample_rate;
- mt.SetSampleSize(8192);
- m_mts.InsertAt(0, mt);
+ m_audio_sample_rate = h->audio_sample_rate;
+ m_blocksize[0] = 1<<h->blocksize_0;
+ m_blocksize[1] = 1<<h->blocksize_1;
+ m_lastblocksize = 0;
+
+ CMediaType mt;
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_Vorbis;
+ mt.formattype = FORMAT_VorbisFormat;
+ VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
+ memset(mt.Format(), 0, mt.FormatLength());
+ vf->nChannels = h->audio_channels;
+ vf->nSamplesPerSec = h->audio_sample_rate;
+ vf->nAvgBitsPerSec = h->bitrate_nominal;
+ vf->nMinBitsPerSec = h->bitrate_minimum;
+ vf->nMaxBitsPerSec = h->bitrate_maximum;
+ vf->fQuality = -1;
+ mt.SetSampleSize(8192);
+ m_mts.Add(mt);
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_Vorbis2;
+ mt.formattype = FORMAT_VorbisFormat2;
+ VORBISFORMAT2* vf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2));
+ memset(mt.Format(), 0, mt.FormatLength());
+ vf2->Channels = h->audio_channels;
+ vf2->SamplesPerSec = h->audio_sample_rate;
+ mt.SetSampleSize(8192);
+ m_mts.InsertAt(0, mt);
}
HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page)
{
- HRESULT hr = __super::UnpackPage(page);
-
- while(m_packets.GetCount())
- {
- Packet* p = m_packets.GetHead();
-
- if(p->GetCount() >= 6 && p->GetAt(0) == 0x05)
- {
- // yeah, right, we are going to be parsing this backwards! :P
- bitstream bs(p->GetData(), p->GetCount(), true);
- while(bs.hasbits(-1) && bs.getbits(-1) != 1);
- for(int cnt = 0; bs.hasbits(-8 - 16 - 16 - 1 - 6); cnt++)
- {
- unsigned int modes = bs.showbits(-6) + 1;
-
- unsigned int mapping = bs.getbits(-8);
- unsigned int transformtype = bs.getbits(-16);
- unsigned int windowtype = bs.getbits(-16);
- unsigned int blockflag = bs.getbits(-1);
-
- if(transformtype != 0 || windowtype != 0)
- {
- ASSERT(modes == cnt);
- break;
- }
-
- m_blockflags.InsertAt(0, !!blockflag);
- }
- }
-
- int cnt = m_initpackets.GetCount();
- if(cnt <= 3)
- {
- ASSERT(p->GetCount() >= 6 && p->GetAt(0) == 1 + cnt * 2);
- VORBISFORMAT2* vf2 = (VORBISFORMAT2*)m_mts[0].Format();
- vf2->HeaderSize[cnt] = p->GetCount();
- int len = m_mts[0].FormatLength();
- memcpy(
- m_mts[0].ReallocFormatBuffer(len + p->GetCount()) + len,
- p->GetData(), p->GetCount());
- }
-
- m_initpackets.AddTail(m_packets.RemoveHead());
- }
-
- return hr;
+ HRESULT hr = __super::UnpackPage(page);
+
+ while(m_packets.GetCount())
+ {
+ Packet* p = m_packets.GetHead();
+
+ if(p->GetCount() >= 6 && p->GetAt(0) == 0x05)
+ {
+ // yeah, right, we are going to be parsing this backwards! :P
+ bitstream bs(p->GetData(), p->GetCount(), true);
+ while(bs.hasbits(-1) && bs.getbits(-1) != 1);
+ for(int cnt = 0; bs.hasbits(-8-16-16-1-6); cnt++)
+ {
+ unsigned int modes = bs.showbits(-6)+1;
+
+ unsigned int mapping = bs.getbits(-8);
+ unsigned int transformtype = bs.getbits(-16);
+ unsigned int windowtype = bs.getbits(-16);
+ unsigned int blockflag = bs.getbits(-1);
+
+ if(transformtype != 0 || windowtype != 0)
+ {
+ ASSERT(modes == cnt);
+ break;
+ }
+
+ m_blockflags.InsertAt(0, !!blockflag);
+ }
+ }
+
+ int cnt = m_initpackets.GetCount();
+ if(cnt <= 3)
+ {
+ ASSERT(p->GetCount() >= 6 && p->GetAt(0) == 1+cnt*2);
+ VORBISFORMAT2* vf2 = (VORBISFORMAT2*)m_mts[0].Format();
+ vf2->HeaderSize[cnt] = p->GetCount();
+ int len = m_mts[0].FormatLength();
+ memcpy(
+ m_mts[0].ReallocFormatBuffer(len + p->GetCount()) + len,
+ p->GetData(), p->GetCount());
+ }
+
+ m_initpackets.AddTail(m_packets.RemoveHead());
+ }
+
+ return hr;
}
REFERENCE_TIME COggVorbisOutputPin::GetRefTime(__int64 granule_position)
{
- REFERENCE_TIME rt = granule_position * 10000000 / m_audio_sample_rate;
- return rt;
+ REFERENCE_TIME rt = granule_position * 10000000 / m_audio_sample_rate;
+ return rt;
}
HRESULT COggVorbisOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- if(len > 0 && m_blockflags.GetCount())
- {
- bitstream bs(pData, len);
- if(bs.getbits(1) == 0)
- {
- int x = m_blockflags.GetCount() - 1, n = 0;
- while(x)
- {
- n++;
- x >>= 1;
- }
- DWORD blocksize = m_blocksize[m_blockflags[bs.getbits(n)] ? 1 : 0];
- if(m_lastblocksize) m_rtLast += GetRefTime((m_lastblocksize + blocksize) >> 2);
- m_lastblocksize = blocksize;
- }
- }
-
- p->bSyncPoint = TRUE;
- p->rtStart = m_rtLast;
- p->rtStop = m_rtLast + 1;
- p->SetData(pData, len);
-
- return S_OK;
+ if(len > 0 && m_blockflags.GetCount())
+ {
+ bitstream bs(pData, len);
+ if(bs.getbits(1) == 0)
+ {
+ int x = m_blockflags.GetCount()-1, n = 0;
+ while(x) {n++; x >>= 1;}
+ DWORD blocksize = m_blocksize[m_blockflags[bs.getbits(n)]?1:0];
+ if(m_lastblocksize) m_rtLast += GetRefTime((m_lastblocksize + blocksize) >> 2);
+ m_lastblocksize = blocksize;
+ }
+ }
+
+ p->bSyncPoint = TRUE;
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast+1;
+ p->SetData(pData, len);
+
+ return S_OK;
}
HRESULT COggVorbisOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
{
- if(p->GetCount() > 0 && (p->GetAt(0) & 1))
- return S_OK;
+ if(p->GetCount() > 0 && (p->GetAt(0)&1))
+ return S_OK;
- return __super::DeliverPacket(p);
+ return __super::DeliverPacket(p);
}
HRESULT COggVorbisOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
-
- m_lastblocksize = 0;
-
- if(m_mt.subtype == MEDIASUBTYPE_Vorbis)
- {
- POSITION pos = m_initpackets.GetHeadPosition();
- while(pos)
- {
- Packet* pi = m_initpackets.GetNext(pos);
- CAutoPtr<OggPacket> p(DNew OggPacket());
- p->TrackNumber = pi->TrackNumber;
- p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
- p->rtStart = p->rtStop = 0;
- p->Copy(*pi);
- __super::DeliverPacket(p);
- }
- }
-
- return hr;
+ HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
+
+ m_lastblocksize = 0;
+
+ if(m_mt.subtype == MEDIASUBTYPE_Vorbis)
+ {
+ POSITION pos = m_initpackets.GetHeadPosition();
+ while(pos)
+ {
+ Packet* pi = m_initpackets.GetNext(pos);
+ CAutoPtr<OggPacket> p(DNew OggPacket());
+ p->TrackNumber = pi->TrackNumber;
+ p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
+ p->rtStart = p->rtStop = 0;
+ p->Copy(*pi);
+ __super::DeliverPacket(p);
+ }
+ }
+
+ return hr;
}
//
@@ -956,161 +918,157 @@ HRESULT COggVorbisOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_
//
COggFlacOutputPin::COggFlacOutputPin(BYTE* h, int nCount, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
{
- CGolombBuffer Buffer(h, nCount);
-
- Buffer.BitRead(1); // Last-metadata-block flag
-
- if(Buffer.BitRead(7) != 0) // Should be a STREAMINFO block
- {
- if(phr) *phr = VFW_E_INVALID_FILE_FORMAT;
- return;
- }
-
- Buffer.BitRead(24); // Length (in bytes) of metadata to follow
- Buffer.ReadShort(); // m_nMinBlocksize
- Buffer.ReadShort(); // m_nMaxBlocksize
- Buffer.BitRead(24); // m_nMinFrameSize
- Buffer.BitRead(24); // m_nMaxFrameSize
- m_nSamplesPerSec = (int)Buffer.BitRead(20);
- m_nChannels = (int)Buffer.BitRead(3) + 1;
- m_wBitsPerSample = (WORD)Buffer.BitRead(5) + 1;
- Buffer.BitRead(36); // m_i64TotalNumSamples
- m_nAvgBytesPerSec = (m_nChannels * (m_wBitsPerSample >> 3)) * m_nSamplesPerSec;
-
- CMediaType mt;
-
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
- mt.formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->wFormatTag = WAVE_FORMAT_FLAC;
- wfe->nSamplesPerSec = m_nSamplesPerSec;
- wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
- wfe->nChannels = m_nChannels;
- wfe->nBlockAlign = 1;
- wfe->wBitsPerSample = m_wBitsPerSample;
-
- m_mts.InsertAt(0, mt);
- *phr = S_OK;
+ CGolombBuffer Buffer(h, nCount);
+
+ Buffer.BitRead(1); // Last-metadata-block flag
+
+ if (Buffer.BitRead(7) != 0) // Should be a STREAMINFO block
+ {
+ if(phr) *phr = VFW_E_INVALID_FILE_FORMAT;
+ return;
+ }
+
+ Buffer.BitRead(24); // Length (in bytes) of metadata to follow
+ Buffer.ReadShort(); // m_nMinBlocksize
+ Buffer.ReadShort(); // m_nMaxBlocksize
+ Buffer.BitRead(24); // m_nMinFrameSize
+ Buffer.BitRead(24); // m_nMaxFrameSize
+ m_nSamplesPerSec = (int)Buffer.BitRead(20);
+ m_nChannels = (int)Buffer.BitRead(3) + 1;
+ m_wBitsPerSample = (WORD)Buffer.BitRead(5) + 1;
+ Buffer.BitRead(36); // m_i64TotalNumSamples
+ m_nAvgBytesPerSec = (m_nChannels * (m_wBitsPerSample >> 3)) * m_nSamplesPerSec;
+
+ CMediaType mt;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_FLAC;
+ wfe->nSamplesPerSec = m_nSamplesPerSec;
+ wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
+ wfe->nChannels = m_nChannels;
+ wfe->nBlockAlign = 1;
+ wfe->wBitsPerSample = m_wBitsPerSample;
+
+ m_mts.InsertAt(0, mt);
+ *phr = S_OK;
}
REFERENCE_TIME COggFlacOutputPin::GetRefTime(__int64 granule_position)
{
- REFERENCE_TIME rt = (granule_position * UNITS) / m_nSamplesPerSec;
- return rt;
+ REFERENCE_TIME rt = (granule_position * UNITS) / m_nSamplesPerSec;
+ return rt;
}
HRESULT COggFlacOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- if(pData[0] != 0xFF || (pData[1] & 0xFE) != 0xF8)
- {
- return S_FALSE;
- }
+ if (pData[0] != 0xFF || (pData[1] & 0xFE) != 0xF8)
+ {
+ return S_FALSE;
+ }
- p->bSyncPoint = TRUE;
- p->rtStart = m_rtLast;
- p->rtStop = m_rtLast + 1; // TODO : find packet duration !
- p->SetData(pData, len);
+ p->bSyncPoint = TRUE;
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast+1; // TODO : find packet duration !
+ p->SetData(pData, len);
- return S_OK;
+ return S_OK;
}
HRESULT COggFlacOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
{
- if(p->GetCount() > 0 && (p->GetAt(0) & 1))
- return S_OK;
+ if(p->GetCount() > 0 && (p->GetAt(0)&1))
+ return S_OK;
- return __super::DeliverPacket(p);
+ return __super::DeliverPacket(p);
}
HRESULT COggFlacOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
-
- m_lastblocksize = 0;
-
- if(m_mt.subtype == MEDIASUBTYPE_FLAC_FRAMED)
- {
- POSITION pos = m_initpackets.GetHeadPosition();
- while(pos)
- {
- Packet* pi = m_initpackets.GetNext(pos);
- CAutoPtr<OggPacket> p(DNew OggPacket());
- p->TrackNumber = pi->TrackNumber;
- p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
- p->rtStart = p->rtStop = 0;
- p->Copy(*pi);
- __super::DeliverPacket(p);
- }
- }
-
- return hr;
+ HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
+
+ m_lastblocksize = 0;
+
+ if(m_mt.subtype == MEDIASUBTYPE_FLAC_FRAMED)
+ {
+ POSITION pos = m_initpackets.GetHeadPosition();
+ while(pos)
+ {
+ Packet* pi = m_initpackets.GetNext(pos);
+ CAutoPtr<OggPacket> p(DNew OggPacket());
+ p->TrackNumber = pi->TrackNumber;
+ p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
+ p->rtStart = p->rtStop = 0;
+ p->Copy(*pi);
+ __super::DeliverPacket(p);
+ }
+ }
+
+ return hr;
}
//
// COggDirectShowOutputPin
//
COggDirectShowOutputPin::COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
{
- CMediaType mt;
- memcpy((AM_MEDIA_TYPE*)&mt, pmt, FIELD_OFFSET(AM_MEDIA_TYPE, pUnk));
- mt.SetFormat((BYTE*)(pmt + 1), pmt->cbFormat);
- mt.SetSampleSize(1);
- if(mt.majortype == MEDIATYPE_Video) // TODO: find samples for audio and find out what to return in GetRefTime...
- m_mts.Add(mt);
+ CMediaType mt;
+ memcpy((AM_MEDIA_TYPE*)&mt, pmt, FIELD_OFFSET(AM_MEDIA_TYPE, pUnk));
+ mt.SetFormat((BYTE*)(pmt+1), pmt->cbFormat);
+ mt.SetSampleSize(1);
+ if(mt.majortype == MEDIATYPE_Video) // TODO: find samples for audio and find out what to return in GetRefTime...
+ m_mts.Add(mt);
}
REFERENCE_TIME COggDirectShowOutputPin::GetRefTime(__int64 granule_position)
{
- REFERENCE_TIME rt = 0;
-
- if(m_mt.majortype == MEDIATYPE_Video)
- {
- rt = granule_position * ((VIDEOINFOHEADER*)m_mt.Format())->AvgTimePerFrame;
- }
- else if(m_mt.majortype == MEDIATYPE_Audio)
- {
- rt = granule_position; // ((WAVEFORMATEX*)m_mt.Format())-> // TODO
- }
-
- return rt;
+ REFERENCE_TIME rt = 0;
+
+ if(m_mt.majortype == MEDIATYPE_Video)
+ {
+ rt = granule_position * ((VIDEOINFOHEADER*)m_mt.Format())->AvgTimePerFrame;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Audio)
+ {
+ rt = granule_position; // ((WAVEFORMATEX*)m_mt.Format())-> // TODO
+ }
+
+ return rt;
}
HRESULT COggDirectShowOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- int i = 0;
+ int i = 0;
- BYTE hdr = pData[i++];
+ BYTE hdr = pData[i++];
- if(!(hdr & 1))
- {
- // TODO: verify if this was still present in the old format (haven't found one sample yet)
- BYTE nLenBytes = (hdr >> 6) | ((hdr & 2) << 1);
- __int64 Length = 0;
- for(int j = 0; j < nLenBytes; j++)
- Length |= (__int64)pData[i++] << (j << 3);
+ if(!(hdr&1))
+ {
+ // TODO: verify if this was still present in the old format (haven't found one sample yet)
+ BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
+ __int64 Length = 0;
+ for(int j = 0; j < nLenBytes; j++)
+ Length |= (__int64)pData[i++] << (j << 3);
- if(len < i)
- {
- ASSERT(0);
- return E_FAIL;
- }
+ if(len < i) {ASSERT(0); return E_FAIL;}
- p->bSyncPoint = !!(hdr & 8);
- p->rtStart = m_rtLast;
- p->rtStop = m_rtLast + (nLenBytes ? GetRefTime(Length) : GetRefTime(1));
- p->SetData(&pData[i], len - i);
+ p->bSyncPoint = !!(hdr&8);
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast + (nLenBytes ? GetRefTime(Length) : GetRefTime(1));
+ p->SetData(&pData[i], len - i);
- return S_OK;
- }
+ return S_OK;
+ }
- return S_FALSE;
+ return S_FALSE;
}
//
@@ -1118,46 +1076,42 @@ HRESULT COggDirectShowOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pDat
//
COggStreamOutputPin::COggStreamOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
{
- m_time_unit = h->time_unit;
- m_samples_per_unit = h->samples_per_unit;
- m_default_len = h->default_len;
+ m_time_unit = h->time_unit;
+ m_samples_per_unit = h->samples_per_unit;
+ m_default_len = h->default_len;
}
REFERENCE_TIME COggStreamOutputPin::GetRefTime(__int64 granule_position)
{
- return granule_position * m_time_unit / m_samples_per_unit;
+ return granule_position * m_time_unit / m_samples_per_unit;
}
HRESULT COggStreamOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- int i = 0;
+ int i = 0;
- BYTE hdr = pData[i++];
+ BYTE hdr = pData[i++];
- if(!(hdr & 1))
- {
- BYTE nLenBytes = (hdr >> 6) | ((hdr & 2) << 1);
- __int64 Length = 0;
- for(int j = 0; j < nLenBytes; j++)
- Length |= (__int64)pData[i++] << (j << 3);
+ if(!(hdr&1))
+ {
+ BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
+ __int64 Length = 0;
+ for(int j = 0; j < nLenBytes; j++)
+ Length |= (__int64)pData[i++] << (j << 3);
- if(len < i)
- {
- ASSERT(0);
- return E_FAIL;
- }
+ if(len < i) {ASSERT(0); return E_FAIL;}
- p->bSyncPoint = !!(hdr & 8);
- p->rtStart = m_rtLast;
- p->rtStop = m_rtLast + (nLenBytes ? GetRefTime(Length) : GetRefTime(m_default_len));
- p->SetData(&pData[i], len - i);
+ p->bSyncPoint = !!(hdr&8);
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast + (nLenBytes ? GetRefTime(Length) : GetRefTime(m_default_len));
+ p->SetData(&pData[i], len - i);
- return S_OK;
- }
+ return S_OK;
+ }
- return S_FALSE;
+ return S_FALSE;
}
//
@@ -1165,45 +1119,39 @@ HRESULT COggStreamOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, i
//
COggVideoOutputPin::COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
+ : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
{
- int extra = (int)h->size - sizeof(OggStreamHeader);
- extra = max(extra, 0);
-
- CMediaType mt;
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap(MAKEFOURCC(h->subtype[0], h->subtype[1], h->subtype[2], h->subtype[3]));
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + extra);
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), h + 1, extra);
- pvih->AvgTimePerFrame = h->time_unit / h->samples_per_unit;
- pvih->bmiHeader.biWidth = h->v.w;
- pvih->bmiHeader.biHeight = h->v.h;
- pvih->bmiHeader.biBitCount = (WORD)h->bps;
- pvih->bmiHeader.biCompression = mt.subtype.Data1;
- switch(pvih->bmiHeader.biCompression)
- {
- case BI_RGB:
- case BI_BITFIELDS:
- mt.subtype =
- pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
- pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
- pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
- pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
- pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
- pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_RGB32 :
- MEDIASUBTYPE_NULL;
- break;
- case BI_RLE8:
- mt.subtype = MEDIASUBTYPE_RGB8;
- break;
- case BI_RLE4:
- mt.subtype = MEDIASUBTYPE_RGB4;
- break;
- }
- mt.SetSampleSize(max(h->buffersize, 1));
- m_mts.Add(mt);
+ int extra = (int)h->size - sizeof(OggStreamHeader);
+ extra = max(extra, 0);
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(MAKEFOURCC(h->subtype[0],h->subtype[1],h->subtype[2],h->subtype[3]));
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + extra);
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), h+1, extra);
+ pvih->AvgTimePerFrame = h->time_unit / h->samples_per_unit;
+ pvih->bmiHeader.biWidth = h->v.w;
+ pvih->bmiHeader.biHeight = h->v.h;
+ pvih->bmiHeader.biBitCount = (WORD)h->bps;
+ pvih->bmiHeader.biCompression = mt.subtype.Data1;
+ switch(pvih->bmiHeader.biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_RGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
+ case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
+ case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
+ }
+ mt.SetSampleSize(max(h->buffersize, 1));
+ m_mts.Add(mt);
}
//
@@ -1211,27 +1159,27 @@ COggVideoOutputPin::COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseF
//
COggAudioOutputPin::COggAudioOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
+ : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
{
- int extra = (int)h->size - sizeof(OggStreamHeader);
- extra = max(extra, 0);
-
- CMediaType mt;
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = FOURCCMap(strtol(CStringA(h->subtype, 4), NULL, 16));
- mt.formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + extra);
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(mt.Format() + sizeof(WAVEFORMATEX), h + 1, extra);
- wfe->cbSize = extra;
- wfe->wFormatTag = (WORD)mt.subtype.Data1;
- wfe->nChannels = h->a.nChannels;
- wfe->nSamplesPerSec = (DWORD)(10000000i64 * h->samples_per_unit / h->time_unit);
- wfe->wBitsPerSample = (WORD)h->bps;
- wfe->nAvgBytesPerSec = h->a.nAvgBytesPerSec; // TODO: verify for PCM
- wfe->nBlockAlign = h->a.nBlockAlign; // TODO: verify for PCM
- mt.SetSampleSize(max(h->buffersize, 1));
- m_mts.Add(mt);
+ int extra = (int)h->size - sizeof(OggStreamHeader);
+ extra = max(extra, 0);
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = FOURCCMap(strtol(CStringA(h->subtype, 4), NULL, 16));
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + extra);
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(mt.Format() + sizeof(WAVEFORMATEX), h+1, extra);
+ wfe->cbSize = extra;
+ wfe->wFormatTag = (WORD)mt.subtype.Data1;
+ wfe->nChannels = h->a.nChannels;
+ wfe->nSamplesPerSec = (DWORD)(10000000i64 * h->samples_per_unit / h->time_unit);
+ wfe->wBitsPerSample = (WORD)h->bps;
+ wfe->nAvgBytesPerSec = h->a.nAvgBytesPerSec; // TODO: verify for PCM
+ wfe->nBlockAlign = h->a.nBlockAlign; // TODO: verify for PCM
+ mt.SetSampleSize(max(h->buffersize, 1));
+ m_mts.Add(mt);
}
//
@@ -1239,75 +1187,75 @@ COggAudioOutputPin::COggAudioOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseF
//
COggTextOutputPin::COggTextOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
+ : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
{
- CMediaType mt;
- mt.majortype = MEDIATYPE_Text;
- mt.subtype = MEDIASUBTYPE_NULL;
- mt.formattype = FORMAT_None;
- mt.SetSampleSize(1);
- m_mts.Add(mt);
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(1);
+ m_mts.Add(mt);
}
// COggTheoraOutputPin
COggTheoraOutputPin::COggTheoraOutputPin(BYTE* p, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
{
- CMediaType mt;
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = FOURCCMap('OEHT');
- mt.formattype = FORMAT_MPEG2_VIDEO;
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(sizeof(MPEG2VIDEOINFO));
- memset(mt.Format(), 0, mt.FormatLength());
- vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
- vih->hdr.bmiHeader.biWidth = *(WORD*)&p[10] >> 4;
- vih->hdr.bmiHeader.biHeight = *(WORD*)&p[12] >> 4;
- vih->hdr.bmiHeader.biCompression = 'OEHT';
- vih->hdr.bmiHeader.biPlanes = 1;
- vih->hdr.bmiHeader.biBitCount = 24;
- m_nFpsNum = (p[22] << 24) | (p[23] << 16) | (p[24] << 8) | p[25];
- m_nFpsDenum = (p[26] << 24) | (p[27] << 16) | (p[28] << 8) | p[29];
- if(m_nFpsNum)
- {
- m_rtAvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * m_nFpsDenum / m_nFpsNum);
- vih->hdr.AvgTimePerFrame = m_rtAvgTimePerFrame;
- }
- vih->hdr.dwPictAspectRatioX = (p[14] << 16) | (p[15] << 8) | p[16];
- vih->hdr.dwPictAspectRatioY = (p[17] << 16) | (p[18] << 8) | p[19];
-
- m_KfgShift = (((p[40] << 8) + p[41]) & 0x3E0) >> 5;
- m_nIndexOffset = TH_VERSION_CHECK(p[7], p[8], p[9], 3, 2, 1);
-
- if(m_KfgShift == 0) m_KfgShift = 6; // Is it really default value ?
-
- mt.bFixedSizeSamples = 0;
- m_mts.Add(mt);
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap('OEHT');
+ mt.formattype = FORMAT_MPEG2_VIDEO;
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(sizeof(MPEG2VIDEOINFO));
+ memset(mt.Format(), 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = *(WORD*)&p[10] >> 4;
+ vih->hdr.bmiHeader.biHeight = *(WORD*)&p[12] >> 4;
+ vih->hdr.bmiHeader.biCompression = 'OEHT';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ m_nFpsNum = (p[22]<<24)|(p[23]<<16)|(p[24]<<8)|p[25];
+ m_nFpsDenum = (p[26]<<24)|(p[27]<<16)|(p[28]<<8)|p[29];
+ if(m_nFpsNum)
+ {
+ m_rtAvgTimePerFrame = (REFERENCE_TIME)(10000000.0 * m_nFpsDenum / m_nFpsNum);
+ vih->hdr.AvgTimePerFrame = m_rtAvgTimePerFrame;
+ }
+ vih->hdr.dwPictAspectRatioX = (p[14]<<16)|(p[15]<<8)|p[16];
+ vih->hdr.dwPictAspectRatioY = (p[17]<<16)|(p[18]<<8)|p[19];
+
+ m_KfgShift = (((p[40]<<8)+p[41]) &0x3E0) >> 5;
+ m_nIndexOffset = TH_VERSION_CHECK(p[7],p[8],p[9],3,2,1);
+
+ if (m_KfgShift == 0) m_KfgShift = 6; // Is it really default value ?
+
+ mt.bFixedSizeSamples = 0;
+ m_mts.Add(mt);
}
HRESULT COggTheoraOutputPin::UnpackInitPage(OggPage& page)
{
- HRESULT hr = __super::UnpackPage(page);
-
- while(m_packets.GetCount())
- {
- Packet* p = m_packets.GetHead();
-
- CMediaType& mt = m_mts[0];
- int size = p->GetCount();
- ASSERT(size <= 0xffff);
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.ReallocFormatBuffer(
- FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) +
- ((MPEG2VIDEOINFO*)mt.Format())->cbSequenceHeader +
- 2 + size);
- *(WORD*)((BYTE*)vih->dwSequenceHeader + vih->cbSequenceHeader) = (size >> 8) | (size << 8);
- memcpy((BYTE*)vih->dwSequenceHeader + vih->cbSequenceHeader + 2, p->GetData(), size);
- vih->cbSequenceHeader += 2 + size;
-
- m_initpackets.AddTail(m_packets.RemoveHead());
- }
-
- return hr;
+ HRESULT hr = __super::UnpackPage(page);
+
+ while(m_packets.GetCount())
+ {
+ Packet* p = m_packets.GetHead();
+
+ CMediaType& mt = m_mts[0];
+ int size = p->GetCount();
+ ASSERT(size <= 0xffff);
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.ReallocFormatBuffer(
+ FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) +
+ ((MPEG2VIDEOINFO*)mt.Format())->cbSequenceHeader +
+ 2 + size);
+ *(WORD*)((BYTE*)vih->dwSequenceHeader + vih->cbSequenceHeader) = (size>>8)|(size<<8);
+ memcpy((BYTE*)vih->dwSequenceHeader + vih->cbSequenceHeader + 2, p->GetData(), size);
+ vih->cbSequenceHeader += 2 + size;
+
+ m_initpackets.AddTail(m_packets.RemoveHead());
+ }
+
+ return hr;
}
REFERENCE_TIME COggTheoraOutputPin::GetRefTime(__int64 granule_position)
@@ -1315,28 +1263,28 @@ REFERENCE_TIME COggTheoraOutputPin::GetRefTime(__int64 granule_position)
LONGLONG iframe;
LONGLONG pframe;
- iframe = granule_position >> m_KfgShift;
- pframe = granule_position - (iframe << m_KfgShift);
+ iframe=granule_position>>m_KfgShift;
+ pframe=granule_position-(iframe<<m_KfgShift);
/*3.2.0 streams store the frame index in the granule position.
3.2.1 and later store the frame count.
We return the index, so adjust the value if we have a 3.2.1 or later
stream.*/
- REFERENCE_TIME rt = 0;
- rt = (iframe + pframe - m_nIndexOffset) * m_rtAvgTimePerFrame;
- return rt;
+ REFERENCE_TIME rt = 0;
+ rt = (iframe+pframe-m_nIndexOffset) * m_rtAvgTimePerFrame;
+ return rt;
}
HRESULT COggTheoraOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
{
- p->bSyncPoint = len > 0 ? !(*pData & 0x40) : TRUE;
- p->rtStart = m_rtLast;
- p->rtStop = m_rtLast + 1;
- p->SetData(pData, len);
+ p->bSyncPoint = len > 0 ? !(*pData & 0x40) : TRUE;
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast+1;
+ p->SetData(pData, len);
- if(!(*pData & 0x80) && m_mt.majortype == MEDIATYPE_Video)
- p->rtStop = p->rtStart + ((MPEG2VIDEOINFO*)m_mt.Format())->hdr.AvgTimePerFrame;
+ if(!(*pData & 0x80) && m_mt.majortype == MEDIATYPE_Video)
+ p->rtStop = p->rtStart + ((MPEG2VIDEOINFO*)m_mt.Format())->hdr.AvgTimePerFrame;
- return S_OK;
+ return S_OK;
}
diff --git a/src/filters/parser/OggSplitter/OggSplitter.h b/src/filters/parser/OggSplitter/OggSplitter.h
index 2a27b24fb..b033f76bb 100644
--- a/src/filters/parser/OggSplitter/OggSplitter.h
+++ b/src/filters/parser/OggSplitter/OggSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,183 +29,168 @@
class OggPacket : public Packet
{
public:
- OggPacket()
- {
- fSkip = false;
- }
- bool fSkip;
+ OggPacket() {fSkip = false;}
+ bool fSkip;
};
class COggSplitterOutputPin : public CBaseSplitterOutputPin
{
- class CComment
- {
- public:
- CStringW m_key, m_value;
- CComment(CStringW key, CStringW value) : m_key(key), m_value(value)
- {
- m_key.MakeUpper();
- }
- };
-
- CAutoPtrList<CComment> m_pComments;
+ class CComment
+ {
+ public:
+ CStringW m_key, m_value;
+ CComment(CStringW key, CStringW value) : m_key(key), m_value(value) {m_key.MakeUpper();}
+ };
+
+ CAutoPtrList<CComment> m_pComments;
protected:
- CCritSec m_csPackets;
- CAutoPtrList<OggPacket> m_packets;
- CAutoPtr<OggPacket> m_lastpacket;
- int m_lastseqnum;
- REFERENCE_TIME m_rtLast;
- bool m_fSkip;
+ CCritSec m_csPackets;
+ CAutoPtrList<OggPacket> m_packets;
+ CAutoPtr<OggPacket> m_lastpacket;
+ int m_lastseqnum;
+ REFERENCE_TIME m_rtLast;
+ bool m_fSkip;
- void ResetState(DWORD seqnum = -1);
+ void ResetState(DWORD seqnum = -1);
public:
- COggSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
-
- void AddComment(BYTE* p, int len);
- CStringW GetComment(CStringW key);
+ COggSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- HRESULT UnpackPage(OggPage& page);
- virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len) = 0;
- virtual REFERENCE_TIME GetRefTime(__int64 granule_position) = 0;
- CAutoPtr<OggPacket> GetPacket();
+ void AddComment(BYTE* p, int len);
+ CStringW GetComment(CStringW key);
- HRESULT DeliverEndFlush();
+ HRESULT UnpackPage(OggPage& page);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len) = 0;
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position) = 0;
+ CAutoPtr<OggPacket> GetPacket();
+
+ HRESULT DeliverEndFlush();
HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
};
class COggVorbisOutputPin : public COggSplitterOutputPin
{
- CAutoPtrList<OggPacket> m_initpackets;
+ CAutoPtrList<OggPacket> m_initpackets;
- DWORD m_audio_sample_rate;
- DWORD m_blocksize[2], m_lastblocksize;
- CAtlArray<bool> m_blockflags;
+ DWORD m_audio_sample_rate;
+ DWORD m_blocksize[2], m_lastblocksize;
+ CAtlArray<bool> m_blockflags;
- virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
- virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
- HRESULT DeliverPacket(CAutoPtr<OggPacket> p);
+ HRESULT DeliverPacket(CAutoPtr<OggPacket> p);
HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
public:
- COggVorbisOutputPin(OggVorbisIdHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggVorbisOutputPin(OggVorbisIdHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- HRESULT UnpackInitPage(OggPage& page);
- bool IsInitialized()
- {
- return m_initpackets.GetCount() >= 3;
- }
+ HRESULT UnpackInitPage(OggPage& page);
+ bool IsInitialized() {return m_initpackets.GetCount() >= 3;}
};
class COggFlacOutputPin : public COggSplitterOutputPin
{
- CAutoPtrList<OggPacket> m_initpackets;
+ CAutoPtrList<OggPacket> m_initpackets;
- int m_nSamplesPerSec;
- int m_nChannels;
- WORD m_wBitsPerSample;
- int m_nAvgBytesPerSec;
+ int m_nSamplesPerSec;
+ int m_nChannels;
+ WORD m_wBitsPerSample;
+ int m_nAvgBytesPerSec;
- DWORD m_blocksize[2], m_lastblocksize;
- CAtlArray<bool> m_blockflags;
+ DWORD m_blocksize[2], m_lastblocksize;
+ CAtlArray<bool> m_blockflags;
- virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
- virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
- HRESULT DeliverPacket(CAutoPtr<OggPacket> p);
+ HRESULT DeliverPacket(CAutoPtr<OggPacket> p);
HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
public:
- COggFlacOutputPin(BYTE* h, int nCount, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggFlacOutputPin(BYTE* h, int nCount, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- bool IsInitialized()
- {
- return m_initpackets.GetCount() >= 3;
- }
+ bool IsInitialized() {return m_initpackets.GetCount() >= 3;}
};
class COggDirectShowOutputPin : public COggSplitterOutputPin
{
- virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
- virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
public:
- COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
};
class COggStreamOutputPin : public COggSplitterOutputPin
{
- __int64 m_time_unit, m_samples_per_unit;
- DWORD m_default_len;
+ __int64 m_time_unit, m_samples_per_unit;
+ DWORD m_default_len;
- virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
- virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
public:
- COggStreamOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggStreamOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
};
class COggVideoOutputPin : public COggStreamOutputPin
{
public:
- COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
};
class COggAudioOutputPin : public COggStreamOutputPin
{
public:
- COggAudioOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggAudioOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
};
class COggTextOutputPin : public COggStreamOutputPin
{
public:
- COggTextOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggTextOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
};
class COggTheoraOutputPin : public COggSplitterOutputPin
{
- CAutoPtrList<OggPacket> m_initpackets;
- LONGLONG m_KfgShift;
- int m_nIndexOffset;
- int m_nFpsNum;
- int m_nFpsDenum;
- REFERENCE_TIME m_rtAvgTimePerFrame;
+ CAutoPtrList<OggPacket> m_initpackets;
+ LONGLONG m_KfgShift;
+ int m_nIndexOffset;
+ int m_nFpsNum;
+ int m_nFpsDenum;
+ REFERENCE_TIME m_rtAvgTimePerFrame;
- virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
- virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
public:
- COggTheoraOutputPin(BYTE* p, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ COggTheoraOutputPin(BYTE* p, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- HRESULT UnpackInitPage(OggPage& page);
- bool IsInitialized()
- {
- return m_initpackets.GetCount() >= 3;
- }
+ HRESULT UnpackInitPage(OggPage& page);
+ bool IsInitialized() {return m_initpackets.GetCount() >= 3;}
};
[uuid("9FF48807-E133-40AA-826F-9B2959E5232D")]
class COggSplitterFilter : public CBaseSplitterFilter
{
protected:
- CAutoPtr<COggFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<COggFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- COggSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~COggSplitterFilter();
+ COggSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~COggSplitterFilter();
};
[uuid("6D3688CE-3E9D-42F4-92CA-8A11119D25CD")]
class COggSourceFilter : public COggSplitterFilter
{
public:
- COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/OggSplitter/resource.h b/src/filters/parser/OggSplitter/resource.h
index 0284bfbd3..3bf040c0b 100644
--- a/src/filters/parser/OggSplitter/resource.h
+++ b/src/filters/parser/OggSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by OggSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/OggSplitter/stdafx.cpp b/src/filters/parser/OggSplitter/stdafx.cpp
index 421a0e678..804db5e5a 100644
--- a/src/filters/parser/OggSplitter/stdafx.cpp
+++ b/src/filters/parser/OggSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/OggSplitter/stdafx.h b/src/filters/parser/OggSplitter/stdafx.h
index 1f7c00018..0910f1e05 100644
--- a/src/filters/parser/OggSplitter/stdafx.h
+++ b/src/filters/parser/OggSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp
index 306fc133b..e133b8435 100644
--- a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp
+++ b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -38,49 +38,45 @@
template<typename T>
static void bswap(T& var)
{
- BYTE* s = (BYTE*)&var;
- for(BYTE* d = s + sizeof(var) - 1; s < d; s++, d--)
- *s ^= *d, *d ^= *s, *s ^= *d;
+ BYTE* s = (BYTE*)&var;
+ for(BYTE* d = s + sizeof(var)-1; s < d; s++, d--)
+ *s ^= *d, *d ^= *s, *s ^= *d;
}
void rvinfo::bswap()
{
- ::bswap(dwSize);
- ::bswap(w);
- ::bswap(h);
- ::bswap(bpp);
- ::bswap(unk1);
- ::bswap(fps);
- ::bswap(type1);
- ::bswap(type2);
+ ::bswap(dwSize);
+ ::bswap(w); ::bswap(h); ::bswap(bpp);
+ ::bswap(unk1); ::bswap(fps);
+ ::bswap(type1); ::bswap(type2);
}
void rainfo::bswap()
{
- ::bswap(version1);
- ::bswap(version2);
- ::bswap(header_size);
- ::bswap(flavor);
- ::bswap(coded_frame_size);
- ::bswap(sub_packet_h);
- ::bswap(frame_size);
- ::bswap(sub_packet_size);
+ ::bswap(version1);
+ ::bswap(version2);
+ ::bswap(header_size);
+ ::bswap(flavor);
+ ::bswap(coded_frame_size);
+ ::bswap(sub_packet_h);
+ ::bswap(frame_size);
+ ::bswap(sub_packet_size);
}
void rainfo4::bswap()
{
- __super::bswap();
- ::bswap(sample_rate);
- ::bswap(sample_size);
- ::bswap(channels);
+ __super::bswap();
+ ::bswap(sample_rate);
+ ::bswap(sample_size);
+ ::bswap(channels);
}
void rainfo5::bswap()
{
- __super::bswap();
- ::bswap(sample_rate);
- ::bswap(sample_size);
- ::bswap(channels);
+ __super::bswap();
+ ::bswap(sample_rate);
+ ::bswap(sample_size);
+ ::bswap(channels);
}
using namespace RMFF;
@@ -89,7 +85,7 @@ using namespace RMFF;
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -100,15 +96,15 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RV20},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RV30},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RV40},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RV41},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV20},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV30},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV40},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV41},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut2[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins2[] =
@@ -119,20 +115,20 @@ const AMOVIESETUP_PIN sudpPins2[] =
const AMOVIESETUP_MEDIATYPE sudPinTypesIn3[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_14_4},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_28_8},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_ATRC},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_COOK},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DNET},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_SIPR},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_AAC},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_RAAC},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_RACP},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_14_4},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_28_8},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_ATRC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_COOK},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DNET},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_SIPR},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_RAAC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_RACP},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut3[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
};
const AMOVIESETUP_PIN sudpPins3[] =
@@ -143,16 +139,16 @@ const AMOVIESETUP_PIN sudpPins3[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CRealMediaSplitterFilter), L"MPC - RealMedia Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CRealMediaSourceFilter), L"MPC - RealMedia Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CRealVideoDecoder), L"MPC - RealVideo Decoder", MERIT_NORMAL, countof(sudpPins2), sudpPins2, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CRealAudioDecoder), L"MPC - RealAudio Decoder", MERIT_NORMAL, countof(sudpPins3), sudpPins3, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRealMediaSplitterFilter), L"MPC - RealMedia Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRealMediaSourceFilter), L"MPC - RealMedia Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRealVideoDecoder), L"MPC - RealVideo Decoder", MERIT_NORMAL, countof(sudpPins2), sudpPins2, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRealAudioDecoder), L"MPC - RealAudio Decoder", MERIT_NORMAL, countof(sudpPins3), sudpPins3, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CRealMediaSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CRealMediaSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CRealMediaSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CRealMediaSourceFilter>, NULL, &sudFilter[1]},
{sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CRealVideoDecoder>, NULL, &sudFilter[2]},
{sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CRealAudioDecoder>, NULL, &sudFilter[3]},
};
@@ -161,16 +157,16 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_RealMedia, _T("0,4,,2E524D46"), _T(".rm"), _T(".rmvb"), _T(".ram"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_RealMedia, _T("0,4,,2E524D46"), _T(".rm"), _T(".rmvb"), _T(".ram"), NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_RealMedia);
+ UnRegisterSourceFilter(MEDIASUBTYPE_RealMedia);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -184,7 +180,7 @@ CFilterApp theApp;
//
CRealMediaSplitterFilter::CRealMediaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CRealMediaSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CRealMediaSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
@@ -194,592 +190,549 @@ CRealMediaSplitterFilter::~CRealMediaSplitterFilter()
HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- {
- DWORD dw;
- if(FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.')
- return E_FAIL;
- }
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
-
- m_pFile.Attach(DNew CRMFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = 0;
-
- m_rtStop = 10000i64 * m_pFile->m_p.tDuration;
-
- POSITION pos = m_pFile->m_mps.GetHeadPosition();
- while(pos)
- {
- MediaProperies* pmp = m_pFile->m_mps.GetNext(pos);
-
- CStringW name;
- name.Format(L"Output %02d", pmp->stream);
- if(!pmp->name.IsEmpty()) name += L" (" + CStringW(pmp->name) + L")";
-
- CAtlArray<CMediaType> mts;
-
- CMediaType mt;
- mt.SetSampleSize(max(pmp->maxPacketSize * 16/**/, 1));
-
- if(pmp->mime == "video/x-pn-realvideo")
- {
- mt.majortype = MEDIATYPE_Video;
- mt.formattype = FORMAT_VideoInfo;
-
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pmp->typeSpecData.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(pvih + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
-
- rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
- rvi.bswap();
-
- ASSERT(rvi.dwSize >= FIELD_OFFSET(rvinfo, morewh));
- ASSERT(rvi.fcc1 == 'ODIV');
-
- mt.subtype = FOURCCMap(rvi.fcc2);
- if(rvi.fps > 0x10000) pvih->AvgTimePerFrame = REFERENCE_TIME(10000000i64 / ((float)rvi.fps / 0x10000));
- pvih->dwBitRate = pmp->avgBitRate;
- pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
- pvih->bmiHeader.biWidth = rvi.w;
- pvih->bmiHeader.biHeight = rvi.h;
- pvih->bmiHeader.biPlanes = 3;
- pvih->bmiHeader.biBitCount = rvi.bpp;
- pvih->bmiHeader.biCompression = rvi.fcc2;
- pvih->bmiHeader.biSizeImage = rvi.w * rvi.h * 3 / 2;
-
- mts.Add(mt);
-
- if(pmp->width > 0 && pmp->height > 0)
- {
- BITMAPINFOHEADER bmi = pvih->bmiHeader;
- mt.formattype = FORMAT_VideoInfo2;
- VIDEOINFOHEADER2* pvih2 = (VIDEOINFOHEADER2*)mt.ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2) + pmp->typeSpecData.GetCount());
- memset(mt.Format() + FIELD_OFFSET(VIDEOINFOHEADER2, dwInterlaceFlags), 0, mt.FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER2, dwInterlaceFlags));
- memcpy(pvih2 + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
- pvih2->bmiHeader = bmi;
- pvih2->bmiHeader.biWidth = (DWORD)pmp->width;
- pvih2->bmiHeader.biHeight = (DWORD)pmp->height;
- pvih2->dwPictAspectRatioX = rvi.w;
- pvih2->dwPictAspectRatioY = rvi.h;
-
- mts.InsertAt(0, mt);
- }
- }
- else if(pmp->mime == "audio/x-pn-realaudio")
- {
- mt.majortype = MEDIATYPE_Audio;
- mt.formattype = FORMAT_WaveFormatEx;
- mt.bTemporalCompression = 1;
-
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + pmp->typeSpecData.GetCount());
- memset(mt.Format(), 0, mt.FormatLength());
- memcpy(pwfe + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
-
- union
- {
- DWORD fcc;
- char fccstr[5];
- };
-
- fcc = 0;
- fccstr[4] = 0;
-
- BYTE* fmt = pmp->typeSpecData.GetData();
- for(int i = 0; i < pmp->typeSpecData.GetCount() - 4; i++, fmt++)
- {
- if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a')
- break;
- }
-
- rainfo rai = *(rainfo*)fmt;
- rai.bswap();
-
- BYTE* extra = NULL;
-
- if(rai.version2 == 4)
- {
- rainfo4 rai4 = *(rainfo4*)fmt;
- rai4.bswap();
- pwfe->nChannels = rai4.channels;
- pwfe->wBitsPerSample = rai4.sample_size;
- pwfe->nSamplesPerSec = rai4.sample_rate;
- pwfe->nBlockAlign = rai4.frame_size;
- BYTE* p = (BYTE*)((rainfo4*)fmt + 1);
- int len = *p++;
- p += len;
- len = *p++;
- ASSERT(len == 4);
- if(len == 4)
- fcc = MAKEFOURCC(p[0], p[1], p[2], p[3]);
- extra = p + len + 3;
- }
- else if(rai.version2 == 5)
- {
- rainfo5 rai5 = *(rainfo5*)fmt;
- rai5.bswap();
- pwfe->nChannels = rai5.channels;
- pwfe->wBitsPerSample = rai5.sample_size;
- pwfe->nSamplesPerSec = rai5.sample_rate;
- pwfe->nBlockAlign = rai5.frame_size;
- fcc = rai5.fourcc3;
- extra = fmt + sizeof(rainfo5) + 4;
- }
- else
- {
- continue;
- }
-
- _strupr(fccstr);
-
- mt.subtype = FOURCCMap(fcc);
-
- bswap(fcc);
-
- switch(fcc)
- {
- case '14_4':
- pwfe->wFormatTag = WAVE_FORMAT_14_4;
- break;
- case '28_8':
- pwfe->wFormatTag = WAVE_FORMAT_28_8;
- break;
- case 'ATRC':
- pwfe->wFormatTag = WAVE_FORMAT_ATRC;
- break;
- case 'COOK':
- pwfe->wFormatTag = WAVE_FORMAT_COOK;
- break;
- case 'DNET':
- pwfe->wFormatTag = WAVE_FORMAT_DNET;
- break;
- case 'SIPR':
- pwfe->wFormatTag = WAVE_FORMAT_SIPR;
- break;
- case 'RAAC':
- pwfe->wFormatTag = WAVE_FORMAT_RAAC;
- break;
- case 'RACP':
- pwfe->wFormatTag = WAVE_FORMAT_RACP;
- break;
- }
-
- if(pwfe->wFormatTag)
- {
- mts.Add(mt);
-
- if(fcc == 'DNET')
- {
- mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3);
- mts.InsertAt(0, mt);
- }
- else if(fcc == 'RAAC' || fcc == 'RACP')
- {
- mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_AAC);
- int extralen = *(DWORD*)extra;
- extra += 4;
- ::bswap(extralen);
- ASSERT(*extra == 2); // always 2? why? what does it mean?
- if(*extra == 2)
- {
- extra++;
- extralen--;
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + extralen);
- pwfe->cbSize = extralen;
- memcpy(pwfe + 1, extra, extralen);
- }
- else
- {
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
- pwfe->cbSize = MakeAACInitData((BYTE*)(pwfe + 1), 0, pwfe->nSamplesPerSec, pwfe->nChannels);
- }
- mts.InsertAt(0, mt);
- }
- }
- }
- else if(pmp->mime == "logical-fileinfo")
- {
- CAtlMap<CStringA, CStringA, CStringElementTraits<CStringA> > lfi;
- CStringA key, value;
-
- BYTE* p = pmp->typeSpecData.GetData();
- BYTE* end = p + pmp->typeSpecData.GetCount();
- p += 8;
-
- DWORD cnt = p <= end - 4 ? *(DWORD*)p : 0;
- bswap(cnt);
- p += 4;
-
- if(cnt > 0xffff) // different format?
- {
- p += 2;
- cnt = p <= end - 4 ? *(DWORD*)p : 0;
- bswap(cnt);
- p += 4;
- }
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ {
+ DWORD dw;
+ if(FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.')
+ return E_FAIL;
+ }
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(DNew CRMFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = 0;
+
+ m_rtStop = 10000i64*m_pFile->m_p.tDuration;
+
+ POSITION pos = m_pFile->m_mps.GetHeadPosition();
+ while(pos)
+ {
+ MediaProperies* pmp = m_pFile->m_mps.GetNext(pos);
+
+ CStringW name;
+ name.Format(L"Output %02d", pmp->stream);
+ if(!pmp->name.IsEmpty()) name += L" (" + CStringW(pmp->name) + L")";
+
+ CAtlArray<CMediaType> mts;
+
+ CMediaType mt;
+ mt.SetSampleSize(max(pmp->maxPacketSize*16/**/, 1));
+
+ if(pmp->mime == "video/x-pn-realvideo")
+ {
+ mt.majortype = MEDIATYPE_Video;
+ mt.formattype = FORMAT_VideoInfo;
+
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pmp->typeSpecData.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(pvih + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
+
+ rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
+ rvi.bswap();
+
+ ASSERT(rvi.dwSize >= FIELD_OFFSET(rvinfo, morewh));
+ ASSERT(rvi.fcc1 == 'ODIV');
+
+ mt.subtype = FOURCCMap(rvi.fcc2);
+ if(rvi.fps > 0x10000) pvih->AvgTimePerFrame = REFERENCE_TIME(10000000i64 / ((float)rvi.fps/0x10000));
+ pvih->dwBitRate = pmp->avgBitRate;
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ pvih->bmiHeader.biWidth = rvi.w;
+ pvih->bmiHeader.biHeight = rvi.h;
+ pvih->bmiHeader.biPlanes = 3;
+ pvih->bmiHeader.biBitCount = rvi.bpp;
+ pvih->bmiHeader.biCompression = rvi.fcc2;
+ pvih->bmiHeader.biSizeImage = rvi.w*rvi.h*3/2;
+
+ mts.Add(mt);
+
+ if(pmp->width > 0 && pmp->height > 0)
+ {
+ BITMAPINFOHEADER bmi = pvih->bmiHeader;
+ mt.formattype = FORMAT_VideoInfo2;
+ VIDEOINFOHEADER2* pvih2 = (VIDEOINFOHEADER2*)mt.ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2) + pmp->typeSpecData.GetCount());
+ memset(mt.Format() + FIELD_OFFSET(VIDEOINFOHEADER2, dwInterlaceFlags), 0, mt.FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER2, dwInterlaceFlags));
+ memcpy(pvih2 + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
+ pvih2->bmiHeader = bmi;
+ pvih2->bmiHeader.biWidth = (DWORD)pmp->width;
+ pvih2->bmiHeader.biHeight = (DWORD)pmp->height;
+ pvih2->dwPictAspectRatioX = rvi.w;
+ pvih2->dwPictAspectRatioY = rvi.h;
+
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(pmp->mime == "audio/x-pn-realaudio")
+ {
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+ mt.bTemporalCompression = 1;
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + pmp->typeSpecData.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(pwfe + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
+
+ union {
+ DWORD fcc;
+ char fccstr[5];
+ };
+
+ fcc = 0;
+ fccstr[4] = 0;
+
+ BYTE* fmt = pmp->typeSpecData.GetData();
+ for(int i = 0; i < pmp->typeSpecData.GetCount()-4; i++, fmt++)
+ {
+ if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a')
+ break;
+ }
+
+ rainfo rai = *(rainfo*)fmt;
+ rai.bswap();
+
+ BYTE* extra = NULL;
+
+ if(rai.version2 == 4)
+ {
+ rainfo4 rai4 = *(rainfo4*)fmt;
+ rai4.bswap();
+ pwfe->nChannels = rai4.channels;
+ pwfe->wBitsPerSample = rai4.sample_size;
+ pwfe->nSamplesPerSec = rai4.sample_rate;
+ pwfe->nBlockAlign = rai4.frame_size;
+ BYTE* p = (BYTE*)((rainfo4*)fmt+1);
+ int len = *p++; p += len; len = *p++; ASSERT(len == 4);
+ if(len == 4)
+ fcc = MAKEFOURCC(p[0],p[1],p[2],p[3]);
+ extra = p + len + 3;
+ }
+ else if(rai.version2 == 5)
+ {
+ rainfo5 rai5 = *(rainfo5*)fmt;
+ rai5.bswap();
+ pwfe->nChannels = rai5.channels;
+ pwfe->wBitsPerSample = rai5.sample_size;
+ pwfe->nSamplesPerSec = rai5.sample_rate;
+ pwfe->nBlockAlign = rai5.frame_size;
+ fcc = rai5.fourcc3;
+ extra = fmt + sizeof(rainfo5) + 4;
+ }
+ else
+ {
+ continue;
+ }
+
+ _strupr(fccstr);
+
+ mt.subtype = FOURCCMap(fcc);
+
+ bswap(fcc);
+
+ switch(fcc)
+ {
+ case '14_4': pwfe->wFormatTag = WAVE_FORMAT_14_4; break;
+ case '28_8': pwfe->wFormatTag = WAVE_FORMAT_28_8; break;
+ case 'ATRC': pwfe->wFormatTag = WAVE_FORMAT_ATRC; break;
+ case 'COOK': pwfe->wFormatTag = WAVE_FORMAT_COOK; break;
+ case 'DNET': pwfe->wFormatTag = WAVE_FORMAT_DNET; break;
+ case 'SIPR': pwfe->wFormatTag = WAVE_FORMAT_SIPR; break;
+ case 'RAAC': pwfe->wFormatTag = WAVE_FORMAT_RAAC; break;
+ case 'RACP': pwfe->wFormatTag = WAVE_FORMAT_RACP; break;
+ }
+
+ if(pwfe->wFormatTag)
+ {
+ mts.Add(mt);
+
+ if(fcc == 'DNET')
+ {
+ mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3);
+ mts.InsertAt(0, mt);
+ }
+ else if(fcc == 'RAAC' || fcc == 'RACP')
+ {
+ mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_AAC);
+ int extralen = *(DWORD*)extra; extra += 4;
+ ::bswap(extralen);
+ ASSERT(*extra == 2); // always 2? why? what does it mean?
+ if(*extra == 2)
+ {
+ extra++; extralen--;
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + extralen);
+ pwfe->cbSize = extralen;
+ memcpy(pwfe + 1, extra, extralen);
+ }
+ else
+ {
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
+ pwfe->cbSize = MakeAACInitData((BYTE*)(pwfe+1), 0, pwfe->nSamplesPerSec, pwfe->nChannels);
+ }
+ mts.InsertAt(0, mt);
+ }
+ }
+ }
+ else if(pmp->mime == "logical-fileinfo")
+ {
+ CAtlMap<CStringA, CStringA, CStringElementTraits<CStringA> > lfi;
+ CStringA key, value;
+
+ BYTE* p = pmp->typeSpecData.GetData();
+ BYTE* end = p + pmp->typeSpecData.GetCount();
+ p += 8;
+
+ DWORD cnt = p <= end-4 ? *(DWORD*)p : 0; bswap(cnt); p += 4;
+
+ if(cnt > 0xffff) // different format?
+ {
+ p += 2;
+ cnt = p <= end-4 ? *(DWORD*)p : 0; bswap(cnt); p += 4;
+ }
+
+ while(p < end-4 && cnt-- > 0)
+ {
+ BYTE* base = p;
+ DWORD len = *(DWORD*)p; bswap(len); p += 4;
+ if(base + len > end) break;
+
+ p++;
+ WORD keylen = *(WORD*)p; bswap(keylen); p += 2;
+ memcpy(key.GetBufferSetLength(keylen), p, keylen);
+ p += keylen;
+
+ p+=4;
+ WORD valuelen = *(WORD*)p; bswap(valuelen); p += 2;
+ memcpy(value.GetBufferSetLength(valuelen), p, valuelen);
+ p += valuelen;
+
+ ASSERT(p == base + len);
+ p = base + len;
+
+ lfi[key] = value;
+ }
+
+ POSITION pos = lfi.GetStartPosition();
+ while(pos)
+ {
+ lfi.GetNextAssoc(pos, key, value);
+
+ int n;
+ if(key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
+ && (n = strtol(key.Mid(7), NULL, 10)) > 0)
+ {
+ int h, m, s, ms;
+ char c;
+ if(7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms))
+ continue;
+
+ key.Format("CHAPTER%02dNAME", n);
+ if(!lfi.Lookup(key, value) || value.IsEmpty())
+ value.Format("Chapter %d", n);
+
+ ChapAppend(
+ ((((REFERENCE_TIME)h*60+m)*60+s)*1000+ms)*10000,
+ CStringW(CString(value)));
+ }
+ }
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("Unsupported RealMedia stream (%d): %s\n"), pmp->stream, CString(pmp->mime));
+ continue;
+ }
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
+ if(SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut)))
+ {
+ if(!m_rtStop)
+ m_pFile->m_p.tDuration = max(m_pFile->m_p.tDuration, pmp->tDuration);
+ }
+ }
+
+ pos = m_pFile->m_subs.GetHeadPosition();
+ for(DWORD stream = 0; pos; stream++)
+ {
+ CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
+
+ CStringW name;
+ name.Format(L"Subtitle %02d", stream);
+ if(!s.name.IsEmpty()) name += L" (" + CStringW(CString(s.name)) + L")";
+
+ CMediaType mt;
+ mt.SetSampleSize(1);
+ mt.majortype = MEDIATYPE_Text;
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(mt);
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
+ AddOutputPin((DWORD)~stream, pPinOut);
+ }
+
+ m_rtDuration = m_rtNewStop = m_rtStop = 10000i64*m_pFile->m_p.tDuration;
+
+ SetProperty(L"TITL", CStringW(m_pFile->m_cd.title));
+ SetProperty(L"AUTH", CStringW(m_pFile->m_cd.author));
+ SetProperty(L"CPYR", CStringW(m_pFile->m_cd.copyright));
+ SetProperty(L"DESC", CStringW(m_pFile->m_cd.comment));
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
- while(p < end - 4 && cnt-- > 0)
- {
- BYTE* base = p;
- DWORD len = *(DWORD*)p;
- bswap(len);
- p += 4;
- if(base + len > end) break;
-
- p++;
- WORD keylen = *(WORD*)p;
- bswap(keylen);
- p += 2;
- memcpy(key.GetBufferSetLength(keylen), p, keylen);
- p += keylen;
-
- p += 4;
- WORD valuelen = *(WORD*)p;
- bswap(valuelen);
- p += 2;
- memcpy(value.GetBufferSetLength(valuelen), p, valuelen);
- p += valuelen;
-
- ASSERT(p == base + len);
- p = base + len;
-
- lfi[key] = value;
- }
+bool CRealMediaSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
- POSITION pos = lfi.GetStartPosition();
- while(pos)
- {
- lfi.GetNextAssoc(pos, key, value);
-
- int n;
- if(key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength() - 4
- && (n = strtol(key.Mid(7), NULL, 10)) > 0)
- {
- int h, m, s, ms;
- char c;
- if(7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms))
- continue;
-
- key.Format("CHAPTER%02dNAME", n);
- if(!lfi.Lookup(key, value) || value.IsEmpty())
- value.Format("Chapter %d", n);
-
- ChapAppend(
- ((((REFERENCE_TIME)h * 60 + m) * 60 + s) * 1000 + ms) * 10000,
- CStringW(CString(value)));
- }
- }
- }
+ // reindex if needed
- if(mts.IsEmpty())
- {
- TRACE(_T("Unsupported RealMedia stream (%d): %s\n"), pmp->stream, CString(pmp->mime));
- continue;
- }
+ if(m_pFile->m_irs.GetCount() == 0)
+ {
+ m_nOpenProgress = 0;
+ m_rtDuration = 0;
- HRESULT hr;
+ int stream = m_pFile->GetMasterStream();
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
- if(SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut)))
- {
- if(!m_rtStop)
- m_pFile->m_p.tDuration = max(m_pFile->m_p.tDuration, pmp->tDuration);
- }
- }
+ UINT32 tLastStart = -1;
+ UINT32 nPacket = 0;
- pos = m_pFile->m_subs.GetHeadPosition();
- for(DWORD stream = 0; pos; stream++)
- {
- CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
+ POSITION pos = m_pFile->m_dcs.GetHeadPosition();
+ while(pos && !m_fAbort)
+ {
+ DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
- CStringW name;
- name.Format(L"Subtitle %02d", stream);
- if(!s.name.IsEmpty()) name += L" (" + CStringW(CString(s.name)) + L")";
+ m_pFile->Seek(pdc->pos);
- CMediaType mt;
- mt.SetSampleSize(1);
- mt.majortype = MEDIATYPE_Text;
+ for(UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++)
+ {
+ UINT64 filepos = m_pFile->GetPos();
- CAtlArray<CMediaType> mts;
- mts.Add(mt);
+ HRESULT hr;
- HRESULT hr;
+ MediaPacketHeader mph;
+ if(S_OK != (hr = m_pFile->Read(mph, false)))
+ break;
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
- AddOutputPin((DWORD)~stream, pPinOut);
- }
+ m_rtDuration = max((__int64)(10000i64*mph.tStart), m_rtDuration);
- m_rtDuration = m_rtNewStop = m_rtStop = 10000i64 * m_pFile->m_p.tDuration;
+ if(mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart)
+ {
+ CAutoPtr<IndexRecord> pir(DNew IndexRecord);
+ pir->tStart = mph.tStart;
+ pir->ptrFilePos = (UINT32)filepos;
+ pir->packet = nPacket;
+ m_pFile->m_irs.AddTail(pir);
- SetProperty(L"TITL", CStringW(m_pFile->m_cd.title));
- SetProperty(L"AUTH", CStringW(m_pFile->m_cd.author));
- SetProperty(L"CPYR", CStringW(m_pFile->m_cd.copyright));
- SetProperty(L"DESC", CStringW(m_pFile->m_cd.comment));
+ tLastStart = mph.tStart;
+ }
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
-}
+ m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
-bool CRealMediaSplitterFilter::DemuxInit()
-{
- if(!m_pFile) return(false);
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
+ }
- // reindex if needed
+ m_nOpenProgress = 100;
- if(m_pFile->m_irs.GetCount() == 0)
- {
- m_nOpenProgress = 0;
- m_rtDuration = 0;
+ if(m_fAbort) m_pFile->m_irs.RemoveAll();
- int stream = m_pFile->GetMasterStream();
+ m_fAbort = false;
+ }
- UINT32 tLastStart = -1;
- UINT32 nPacket = 0;
+ m_seekpos = NULL;
+ m_seekpacket = 0;
+ m_seekfilepos = 0;
- POSITION pos = m_pFile->m_dcs.GetHeadPosition();
- while(pos && !m_fAbort)
- {
- DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
+ return(true);
+}
- m_pFile->Seek(pdc->pos);
+void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ if(rt <= 0)
+ {
+ m_seekpos = m_pFile->m_dcs.GetHeadPosition();
+ m_seekpacket = 0;
+ m_seekfilepos = m_pFile->m_dcs.GetHead()->pos;
+ }
+ else
+ {
+ m_seekpos = NULL;
+
+ POSITION pos = m_pFile->m_irs.GetTailPosition();
+ while(pos && !m_seekpos)
+ {
+ IndexRecord* pir = m_pFile->m_irs.GetPrev(pos);
+ if(pir->tStart <= rt/10000)
+ {
+ m_seekpacket = pir->packet;
+
+ pos = m_pFile->m_dcs.GetTailPosition();
+ while(pos && !m_seekpos)
+ {
+ POSITION tmp = pos;
+
+ DataChunk* pdc = m_pFile->m_dcs.GetPrev(pos);
+
+ if(pdc->pos <= pir->ptrFilePos)
+ {
+ m_seekpos = tmp;
+ m_seekfilepos = pir->ptrFilePos;
+
+ POSITION pos = m_pFile->m_dcs.GetHeadPosition();
+ while(pos != m_seekpos)
+ {
+ m_seekpacket -= m_pFile->m_dcs.GetNext(pos)->nPackets;
+ }
+ }
+ }
+
+ // search the closest keyframe to the seek time (commented out 'cause rm seems to index all of its keyframes...)
+/*
+ if(m_seekpos)
+ {
+ DataChunk* pdc = m_pFile->m_dcs.GetAt(m_seekpos);
+
+ m_pFile->Seek(m_seekfilepos);
+
+ REFERENCE_TIME seektime = -1;
+ UINT32 seekstream = -1;
+
+ for(UINT32 i = m_seekpacket; i < pdc->nPackets; i++)
+ {
+ UINT64 filepos = m_pFile->GetPos();
+
+ MediaPacketHeader mph;
+ if(S_OK != m_pFile->Read(mph, false))
+ break;
+
+ if(seekstream == -1) seekstream = mph.stream;
+ if(seekstream != mph.stream) continue;
+
+ if(seektime == 10000i64*mph.tStart) continue;
+ if(rt < 10000i64*mph.tStart) break;
+
+ if((mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG))
+ {
+ m_seekpacket = i;
+ m_seekfilepos = filepos;
+ seektime = 10000i64*mph.tStart;
+ }
+ }
+ }
+*/
+ }
+ }
+
+ if(!m_seekpos)
+ {
+ m_seekpos = m_pFile->m_dcs.GetHeadPosition();
+ m_seekpacket = 0;
+ m_seekfilepos = m_pFile->m_dcs.GetAt(m_seekpos)->pos;
+ }
+ }
+}
- for(UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++)
- {
- UINT64 filepos = m_pFile->GetPos();
+bool CRealMediaSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+ POSITION pos;
- HRESULT hr;
+ pos = m_pFile->m_subs.GetHeadPosition();
+ for(DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++)
+ {
+ CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
- MediaPacketHeader mph;
- if(S_OK != (hr = m_pFile->Read(mph, false)))
- break;
+ CAutoPtr<Packet> p(DNew Packet);
- m_rtDuration = max((__int64)(10000i64 * mph.tStart), m_rtDuration);
+ p->TrackNumber = ~stream;
+ p->bSyncPoint = TRUE;
+ p->rtStart = 0;
+ p->rtStop = 1;
- if(mph.stream == stream && (mph.flags & MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart)
- {
- CAutoPtr<IndexRecord> pir(DNew IndexRecord);
- pir->tStart = mph.tStart;
- pir->ptrFilePos = (UINT32)filepos;
- pir->packet = nPacket;
- m_pFile->m_irs.AddTail(pir);
+ p->SetCount((4+1) + (2+4+(s.name.GetLength()+1)*2) + (2+4+s.data.GetLength()));
+ BYTE* ptr = p->GetData();
- tLastStart = mph.tStart;
- }
+ strcpy((char*)ptr, "GAB2"); ptr += 4+1;
- m_nOpenProgress = m_pFile->GetPos() * 100 / m_pFile->GetLength();
+ *(WORD*)ptr = 2; ptr += 2;
+ *(DWORD*)ptr = (s.name.GetLength()+1)*2; ptr += 4;
+ wcscpy((WCHAR*)ptr, CStringW(s.name)); ptr += (s.name.GetLength()+1)*2;
- DWORD cmd;
- if(CheckRequest(&cmd))
- {
- if(cmd == CMD_EXIT) m_fAbort = true;
- else Reply(S_OK);
- }
- }
- }
+ *(WORD*)ptr = 4; ptr += 2;
+ *(DWORD*)ptr = s.data.GetLength(); ptr += 4;
+ memcpy((char*)ptr, s.data, s.data.GetLength()); ptr += s.name.GetLength();
- m_nOpenProgress = 100;
+ hr = DeliverPacket(p);
+ }
- if(m_fAbort) m_pFile->m_irs.RemoveAll();
+ pos = m_seekpos;
+ while(pos && SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
- m_fAbort = false;
- }
+ m_pFile->Seek(m_seekfilepos > 0 ? m_seekfilepos : pdc->pos);
- m_seekpos = NULL;
- m_seekpacket = 0;
- m_seekfilepos = 0;
+ for(UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++)
+ {
+ MediaPacketHeader mph;
+ if(S_OK != (hr = m_pFile->Read(mph)))
+ break;
- return(true);
-}
+ CAutoPtr<Packet> p(DNew Packet);
+ p->TrackNumber = mph.stream;
+ p->bSyncPoint = !!(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG);
+ p->rtStart = 10000i64*(mph.tStart);
+ p->rtStop = p->rtStart+1;
+ p->Copy(mph.pData);
+ hr = DeliverPacket(p);
+ }
-void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
-{
- if(rt <= 0)
- {
- m_seekpos = m_pFile->m_dcs.GetHeadPosition();
- m_seekpacket = 0;
- m_seekfilepos = m_pFile->m_dcs.GetHead()->pos;
- }
- else
- {
- m_seekpos = NULL;
-
- POSITION pos = m_pFile->m_irs.GetTailPosition();
- while(pos && !m_seekpos)
- {
- IndexRecord* pir = m_pFile->m_irs.GetPrev(pos);
- if(pir->tStart <= rt / 10000)
- {
- m_seekpacket = pir->packet;
-
- pos = m_pFile->m_dcs.GetTailPosition();
- while(pos && !m_seekpos)
- {
- POSITION tmp = pos;
-
- DataChunk* pdc = m_pFile->m_dcs.GetPrev(pos);
-
- if(pdc->pos <= pir->ptrFilePos)
- {
- m_seekpos = tmp;
- m_seekfilepos = pir->ptrFilePos;
-
- POSITION pos = m_pFile->m_dcs.GetHeadPosition();
- while(pos != m_seekpos)
- {
- m_seekpacket -= m_pFile->m_dcs.GetNext(pos)->nPackets;
- }
- }
- }
-
- // search the closest keyframe to the seek time (commented out 'cause rm seems to index all of its keyframes...)
- /*
- if(m_seekpos)
- {
- DataChunk* pdc = m_pFile->m_dcs.GetAt(m_seekpos);
-
- m_pFile->Seek(m_seekfilepos);
-
- REFERENCE_TIME seektime = -1;
- UINT32 seekstream = -1;
-
- for(UINT32 i = m_seekpacket; i < pdc->nPackets; i++)
- {
- UINT64 filepos = m_pFile->GetPos();
-
- MediaPacketHeader mph;
- if(S_OK != m_pFile->Read(mph, false))
- break;
-
- if(seekstream == -1) seekstream = mph.stream;
- if(seekstream != mph.stream) continue;
-
- if(seektime == 10000i64*mph.tStart) continue;
- if(rt < 10000i64*mph.tStart) break;
-
- if((mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG))
- {
- m_seekpacket = i;
- m_seekfilepos = filepos;
- seektime = 10000i64*mph.tStart;
- }
- }
- }
- */
- }
- }
-
- if(!m_seekpos)
- {
- m_seekpos = m_pFile->m_dcs.GetHeadPosition();
- m_seekpacket = 0;
- m_seekfilepos = m_pFile->m_dcs.GetAt(m_seekpos)->pos;
- }
- }
-}
+ m_seekpacket = 0;
+ m_seekfilepos = 0;
+ }
-bool CRealMediaSplitterFilter::DemuxLoop()
-{
- HRESULT hr = S_OK;
- POSITION pos;
-
- pos = m_pFile->m_subs.GetHeadPosition();
- for(DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++)
- {
- CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
-
- CAutoPtr<Packet> p(DNew Packet);
-
- p->TrackNumber = ~stream;
- p->bSyncPoint = TRUE;
- p->rtStart = 0;
- p->rtStop = 1;
-
- p->SetCount((4 + 1) + (2 + 4 + (s.name.GetLength() + 1) * 2) + (2 + 4 + s.data.GetLength()));
- BYTE* ptr = p->GetData();
-
- strcpy((char*)ptr, "GAB2");
- ptr += 4 + 1;
-
- *(WORD*)ptr = 2;
- ptr += 2;
- *(DWORD*)ptr = (s.name.GetLength() + 1) * 2;
- ptr += 4;
- wcscpy((WCHAR*)ptr, CStringW(s.name));
- ptr += (s.name.GetLength() + 1) * 2;
-
- *(WORD*)ptr = 4;
- ptr += 2;
- *(DWORD*)ptr = s.data.GetLength();
- ptr += 4;
- memcpy((char*)ptr, s.data, s.data.GetLength());
- ptr += s.name.GetLength();
-
- hr = DeliverPacket(p);
- }
-
- pos = m_seekpos;
- while(pos && SUCCEEDED(hr) && !CheckRequest(NULL))
- {
- DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
-
- m_pFile->Seek(m_seekfilepos > 0 ? m_seekfilepos : pdc->pos);
-
- for(UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++)
- {
- MediaPacketHeader mph;
- if(S_OK != (hr = m_pFile->Read(mph)))
- break;
-
- CAutoPtr<Packet> p(DNew Packet);
- p->TrackNumber = mph.stream;
- p->bSyncPoint = !!(mph.flags & MediaPacketHeader::PN_KEYFRAME_FLAG);
- p->rtStart = 10000i64 * (mph.tStart);
- p->rtStop = p->rtStart + 1;
- p->Copy(mph.pData);
- hr = DeliverPacket(p);
- }
-
- m_seekpacket = 0;
- m_seekfilepos = 0;
- }
-
- return(true);
+ return(true);
}
// IKeyFrameInfo
STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
{
- if(!m_pFile) return E_UNEXPECTED;
- nKFs = m_pFile->m_irs.GetCount();
- return S_OK;
+ if(!m_pFile) return E_UNEXPECTED;
+ nKFs = m_pFile->m_irs.GetCount();
+ return S_OK;
}
STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
{
- CheckPointer(pFormat, E_POINTER);
- CheckPointer(pKFs, E_POINTER);
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
- if(!m_pFile) return E_UNEXPECTED;
- if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
- UINT nKFsTmp = 0;
- POSITION pos = m_pFile->m_irs.GetHeadPosition();
- for(int i = 0; pos && nKFsTmp < nKFs; i++)
- pKFs[nKFsTmp++] = 10000i64 * m_pFile->m_irs.GetNext(pos)->tStart;
- nKFs = nKFsTmp;
+ UINT nKFsTmp = 0;
+ POSITION pos = m_pFile->m_irs.GetHeadPosition();
+ for(int i = 0; pos && nKFsTmp < nKFs; i++)
+ pKFs[nKFsTmp++] = 10000i64*m_pFile->m_irs.GetNext(pos)->tStart;
+ nKFs = nKFsTmp;
- return S_OK;
+ return S_OK;
}
//
@@ -787,7 +740,7 @@ STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFEREN
//
CRealMediaSplitterOutputPin::CRealMediaSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
{
}
@@ -797,230 +750,218 @@ CRealMediaSplitterOutputPin::~CRealMediaSplitterOutputPin()
HRESULT CRealMediaSplitterOutputPin::DeliverEndFlush()
{
- {
- CAutoLock cAutoLock(&m_csQueue);
- m_segments.Clear();
- }
+ {
+ CAutoLock cAutoLock(&m_csQueue);
+ m_segments.Clear();
+ }
- return __super::DeliverEndFlush();
+ return __super::DeliverEndFlush();
}
HRESULT CRealMediaSplitterOutputPin::DeliverSegments()
{
- HRESULT hr;
-
- if(m_segments.GetCount() == 0)
- {
- m_segments.Clear();
- return S_OK;
- }
-
- CAutoPtr<Packet> p(DNew Packet());
-
- p->TrackNumber = -1;
- p->bDiscontinuity = m_segments.fDiscontinuity;
- p->bSyncPoint = m_segments.fSyncPoint;
- p->rtStart = m_segments.rtStart;
- p->rtStop = m_segments.rtStart + 1;
-
- DWORD len = 0, total = 0;
- POSITION pos = m_segments.GetHeadPosition();
- while(pos)
- {
- segment* s = m_segments.GetNext(pos);
- len = max(len, s->offset + s->data.GetCount());
- total += s->data.GetCount();
- }
- ASSERT(len == total);
- len += 1 + 2 * 4 * (!m_segments.fMerged ? m_segments.GetCount() : 1);
-
- p->SetCount(len);
-
- BYTE* pData = p->GetData();
-
- *pData++ = m_segments.fMerged ? 0 : m_segments.GetCount() - 1;
-
- if(m_segments.fMerged)
- {
- *((DWORD*)pData) = 1;
- pData += 4;
- *((DWORD*)pData) = 0;
- pData += 4;
- }
- else
- {
- pos = m_segments.GetHeadPosition();
- while(pos)
- {
- *((DWORD*)pData) = 1;
- pData += 4;
- *((DWORD*)pData) = m_segments.GetNext(pos)->offset;
- pData += 4;
- }
- }
-
- pos = m_segments.GetHeadPosition();
- while(pos)
- {
- segment* s = m_segments.GetNext(pos);
- memcpy(pData + s->offset, s->data.GetData(), s->data.GetCount());
- }
-
- hr = __super::DeliverPacket(p);
-
- m_segments.Clear();
-
- return hr;
+ HRESULT hr;
+
+ if(m_segments.GetCount() == 0)
+ {
+ m_segments.Clear();
+ return S_OK;
+ }
+
+ CAutoPtr<Packet> p(DNew Packet());
+
+ p->TrackNumber = -1;
+ p->bDiscontinuity = m_segments.fDiscontinuity;
+ p->bSyncPoint = m_segments.fSyncPoint;
+ p->rtStart = m_segments.rtStart;
+ p->rtStop = m_segments.rtStart+1;
+
+ DWORD len = 0, total = 0;
+ POSITION pos = m_segments.GetHeadPosition();
+ while(pos)
+ {
+ segment* s = m_segments.GetNext(pos);
+ len = max(len, s->offset + s->data.GetCount());
+ total += s->data.GetCount();
+ }
+ ASSERT(len == total);
+ len += 1 + 2*4*(!m_segments.fMerged ? m_segments.GetCount() : 1);
+
+ p->SetCount(len);
+
+ BYTE* pData = p->GetData();
+
+ *pData++ = m_segments.fMerged ? 0 : m_segments.GetCount()-1;
+
+ if(m_segments.fMerged)
+ {
+ *((DWORD*)pData) = 1; pData += 4;
+ *((DWORD*)pData) = 0; pData += 4;
+ }
+ else
+ {
+ pos = m_segments.GetHeadPosition();
+ while(pos)
+ {
+ *((DWORD*)pData) = 1; pData += 4;
+ *((DWORD*)pData) = m_segments.GetNext(pos)->offset; pData += 4;
+ }
+ }
+
+ pos = m_segments.GetHeadPosition();
+ while(pos)
+ {
+ segment* s = m_segments.GetNext(pos);
+ memcpy(pData + s->offset, s->data.GetData(), s->data.GetCount());
+ }
+
+ hr = __super::DeliverPacket(p);
+
+ m_segments.Clear();
+
+ return hr;
}
HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
{
- HRESULT hr = S_OK;
-
- ASSERT(p->rtStart < p->rtStop);
-
- if(m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
- {
- WORD* s = (WORD*)p->GetData();
- WORD* e = s + p->GetCount() / 2;
- while(s < e) bswap(*s++);
- }
-
- if(m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
- || m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40
- || m_mt.subtype == MEDIASUBTYPE_RV41)
- {
- CAutoLock cAutoLock(&m_csQueue);
-
- int len = p->GetCount();
- BYTE* pIn = p->GetData();
- BYTE* pInOrg = pIn;
-
- if(m_segments.rtStart != p->rtStart)
- {
- if(S_OK != (hr = DeliverSegments()))
- return hr;
- }
-
- if(!m_segments.fDiscontinuity && p->bDiscontinuity)
- m_segments.fDiscontinuity = true;
- m_segments.fSyncPoint = !!p->bSyncPoint;
- m_segments.rtStart = p->rtStart;
-
- while(pIn - pInOrg < len)
- {
- BYTE hdr = *pIn++, subseq = 0, seqnum = 0;
- DWORD packetlen = 0, packetoffset = 0;
-
- if((hdr & 0xc0) == 0x40)
- {
- pIn++;
- packetlen = len - (pIn - pInOrg);
- }
- else
- {
- if((hdr & 0x40) == 0)
- subseq = (*pIn++) & 0x7f;
-
-#define GetWORD(var) \
+ HRESULT hr = S_OK;
+
+ ASSERT(p->rtStart < p->rtStop);
+
+ if(m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ {
+ WORD* s = (WORD*)p->GetData();
+ WORD* e = s + p->GetCount()/2;
+ while(s < e) bswap(*s++);
+ }
+
+ if(m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
+ || m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40
+ || m_mt.subtype == MEDIASUBTYPE_RV41)
+ {
+ CAutoLock cAutoLock(&m_csQueue);
+
+ int len = p->GetCount();
+ BYTE* pIn = p->GetData();
+ BYTE* pInOrg = pIn;
+
+ if(m_segments.rtStart != p->rtStart)
+ {
+ if(S_OK != (hr = DeliverSegments()))
+ return hr;
+ }
+
+ if(!m_segments.fDiscontinuity && p->bDiscontinuity)
+ m_segments.fDiscontinuity = true;
+ m_segments.fSyncPoint = !!p->bSyncPoint;
+ m_segments.rtStart = p->rtStart;
+
+ while(pIn - pInOrg < len)
+ {
+ BYTE hdr = *pIn++, subseq = 0, seqnum = 0;
+ DWORD packetlen = 0, packetoffset = 0;
+
+ if((hdr&0xc0) == 0x40)
+ {
+ pIn++;
+ packetlen = len - (pIn - pInOrg);
+ }
+ else
+ {
+ if((hdr&0x40) == 0)
+ subseq = (*pIn++)&0x7f;
+
+ #define GetWORD(var) \
var = (var<<8)|(*pIn++); \
var = (var<<8)|(*pIn++); \
-
- GetWORD(packetlen);
- if(packetlen & 0x8000) m_segments.fMerged = true;
- if((packetlen & 0x4000) == 0)
- {
- GetWORD(packetlen);
- packetlen &= 0x3fffffff;
- }
- else packetlen &= 0x3fff;
-
- GetWORD(packetoffset);
- if((packetoffset & 0x4000) == 0)
- {
- GetWORD(packetoffset);
- packetoffset &= 0x3fffffff;
- }
- else packetoffset &= 0x3fff;
-
-#undef GetWORD
-
- if((hdr & 0xc0) == 0xc0)
- m_segments.rtStart = 10000i64 * packetoffset - m_rtStart, packetoffset = 0;
- else if((hdr & 0xc0) == 0x80)
- packetoffset = packetlen - packetoffset;
-
- seqnum = *pIn++;
- }
- int len2 = min(len - (pIn - pInOrg), packetlen - packetoffset);
+ GetWORD(packetlen);
+ if(packetlen&0x8000) m_segments.fMerged = true;
+ if((packetlen&0x4000) == 0) {GetWORD(packetlen); packetlen &= 0x3fffffff;}
+ else packetlen &= 0x3fff;
- CAutoPtr<segment> s(DNew segment);
- s->offset = packetoffset;
- s->data.SetCount(len2);
- memcpy(s->data.GetData(), pIn, len2);
- m_segments.AddTail(s);
+ GetWORD(packetoffset);
+ if((packetoffset&0x4000) == 0) {GetWORD(packetoffset); packetoffset &= 0x3fffffff;}
+ else packetoffset &= 0x3fff;
- pIn += len2;
+ #undef GetWORD
- if((hdr & 0x80) || packetoffset + len2 >= packetlen)
- {
- if(S_OK != (hr = DeliverSegments()))
- return hr;
- }
- }
- }
- else if(m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
- || m_mt.subtype == MEDIASUBTYPE_AAC)
- {
- BYTE* ptr = p->GetData() + 2;
-
- CAtlList<WORD> sizes;
- int total = 0;
- int remaining = p->GetCount() - 2;
- int expected = *(ptr - 1) >> 4;
-
- while(total < remaining)
- {
- int size = (ptr[0] << 8) | (ptr[1]);
- sizes.AddTail(size);
- total += size;
- ptr += 2;
- remaining -= 2;
- expected--;
- }
-
- ASSERT(total == remaining);
- ASSERT(expected == 0);
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
- REFERENCE_TIME rtDur = 10240000000i64 / wfe->nSamplesPerSec * (wfe->cbSize > 2 ? 2 : 1);
- REFERENCE_TIME rtStart = p->rtStart;
- BOOL bDiscontinuity = p->bDiscontinuity;
-
- POSITION pos = sizes.GetHeadPosition();
- while(pos)
- {
- WORD size = sizes.GetNext(pos);
-
- CAutoPtr<Packet> p(DNew Packet);
- p->bDiscontinuity = bDiscontinuity;
- p->bSyncPoint = true;
- p->rtStart = rtStart;
- p->rtStop = rtStart += rtDur;
- p->SetData(ptr, size);
- ptr += size;
- bDiscontinuity = false;
- if(S_OK != (hr = __super::DeliverPacket(p)))
- break;
- }
- }
- else
- {
- hr = __super::DeliverPacket(p);
- }
-
- return hr;
+ if((hdr&0xc0) == 0xc0)
+ m_segments.rtStart = 10000i64*packetoffset - m_rtStart, packetoffset = 0;
+ else if((hdr&0xc0) == 0x80)
+ packetoffset = packetlen - packetoffset;
+
+ seqnum = *pIn++;
+ }
+
+ int len2 = min(len - (pIn - pInOrg), packetlen - packetoffset);
+
+ CAutoPtr<segment> s(DNew segment);
+ s->offset = packetoffset;
+ s->data.SetCount(len2);
+ memcpy(s->data.GetData(), pIn, len2);
+ m_segments.AddTail(s);
+
+ pIn += len2;
+
+ if((hdr&0x80) || packetoffset+len2 >= packetlen)
+ {
+ if(S_OK != (hr = DeliverSegments()))
+ return hr;
+ }
+ }
+ }
+ else if(m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
+ || m_mt.subtype == MEDIASUBTYPE_AAC)
+ {
+ BYTE* ptr = p->GetData()+2;
+
+ CAtlList<WORD> sizes;
+ int total = 0;
+ int remaining = p->GetCount()-2;
+ int expected = *(ptr-1)>>4;
+
+ while(total < remaining)
+ {
+ int size = (ptr[0]<<8)|(ptr[1]);
+ sizes.AddTail(size);
+ total += size;
+ ptr += 2;
+ remaining -= 2;
+ expected--;
+ }
+
+ ASSERT(total == remaining);
+ ASSERT(expected == 0);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ REFERENCE_TIME rtDur = 10240000000i64/wfe->nSamplesPerSec * (wfe->cbSize>2?2:1);
+ REFERENCE_TIME rtStart = p->rtStart;
+ BOOL bDiscontinuity = p->bDiscontinuity;
+
+ POSITION pos = sizes.GetHeadPosition();
+ while(pos)
+ {
+ WORD size = sizes.GetNext(pos);
+
+ CAutoPtr<Packet> p(DNew Packet);
+ p->bDiscontinuity = bDiscontinuity;
+ p->bSyncPoint = true;
+ p->rtStart = rtStart;
+ p->rtStop = rtStart += rtDur;
+ p->SetData(ptr, size);
+ ptr += size;
+ bDiscontinuity = false;
+ if(S_OK != (hr = __super::DeliverPacket(p)))
+ break;
+ }
+ }
+ else
+ {
+ hr = __super::DeliverPacket(p);
+ }
+
+ return hr;
}
//
@@ -1028,10 +969,10 @@ HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
//
CRealMediaSourceFilter::CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CRealMediaSplitterFilter(pUnk, phr)
+ : CRealMediaSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -1039,488 +980,468 @@ CRealMediaSourceFilter::CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
CRMFile::CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr)
- : CBaseSplitterFile(pAsyncReader, hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
{
- if(FAILED(hr)) return;
- hr = Init();
+ if(FAILED(hr)) return;
+ hr = Init();
}
-template<typename T>
+template<typename T>
HRESULT CRMFile::Read(T& var)
{
- HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
- bswap(var);
- return hr;
+ HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
+ bswap(var);
+ return hr;
}
HRESULT CRMFile::Read(ChunkHdr& hdr)
{
- memset(&hdr, 0, sizeof(hdr));
- HRESULT hr;
- if(S_OK != (hr = Read(hdr.object_id))
- || S_OK != (hr = Read(hdr.size))
- || S_OK != (hr = Read(hdr.object_version)))
- return hr;
- return S_OK;
+ memset(&hdr, 0, sizeof(hdr));
+ HRESULT hr;
+ if(S_OK != (hr = Read(hdr.object_id))
+ || S_OK != (hr = Read(hdr.size))
+ || S_OK != (hr = Read(hdr.object_version)))
+ return hr;
+ return S_OK;
}
HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull)
{
- memset(&mph, 0, FIELD_OFFSET(MediaPacketHeader, pData));
- mph.stream = -1;
-
- HRESULT hr;
-
- UINT16 object_version;
- if(S_OK != (hr = Read(object_version))) return hr;
- if(object_version != 0 && object_version != 1) return S_OK;
-
- UINT8 flags;
- if(S_OK != (hr = Read(mph.len))
- || S_OK != (hr = Read(mph.stream))
- || S_OK != (hr = Read(mph.tStart))
- || S_OK != (hr = Read(mph.reserved))
- || S_OK != (hr = Read(flags)))
- return hr;
- mph.flags = (MediaPacketHeader::flag_t)flags;
-
- LONG len = mph.len;
- len -= sizeof(object_version);
- len -= FIELD_OFFSET(MediaPacketHeader, flags);
- len -= sizeof(flags);
- ASSERT(len >= 0);
- len = max(len, 0);
-
- if(fFull)
- {
- mph.pData.SetCount(len);
- if(mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len)))
- return hr;
- }
- else
- {
- Seek(GetPos() + len);
- }
-
- return S_OK;
+ memset(&mph, 0, FIELD_OFFSET(MediaPacketHeader, pData));
+ mph.stream = -1;
+
+ HRESULT hr;
+
+ UINT16 object_version;
+ if(S_OK != (hr = Read(object_version))) return hr;
+ if(object_version != 0 && object_version != 1) return S_OK;
+
+ UINT8 flags;
+ if(S_OK != (hr = Read(mph.len))
+ || S_OK != (hr = Read(mph.stream))
+ || S_OK != (hr = Read(mph.tStart))
+ || S_OK != (hr = Read(mph.reserved))
+ || S_OK != (hr = Read(flags)))
+ return hr;
+ mph.flags = (MediaPacketHeader::flag_t)flags;
+
+ LONG len = mph.len;
+ len -= sizeof(object_version);
+ len -= FIELD_OFFSET(MediaPacketHeader, flags);
+ len -= sizeof(flags);
+ ASSERT(len >= 0);
+ len = max(len, 0);
+
+ if(fFull)
+ {
+ mph.pData.SetCount(len);
+ if(mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len)))
+ return hr;
+ }
+ else
+ {
+ Seek(GetPos() + len);
+ }
+
+ return S_OK;
}
HRESULT CRMFile::Init()
{
- Seek(0);
-
- bool fFirstChunk = true;
-
- HRESULT hr;
-
- ChunkHdr hdr;
- while(GetRemaining() && S_OK == (hr = Read(hdr)))
- {
- __int64 pos = GetPos() - sizeof(hdr);
-
- if(fFirstChunk && hdr.object_id != '.RMF')
- return E_FAIL;
-
- fFirstChunk = false;
-
- if(pos + hdr.size > GetLength() && hdr.object_id != 'DATA') // truncated?
- break;
-
- if(hdr.object_id == 0x2E7261FD) // '.ra+0xFD'
- return E_FAIL;
-
- if(hdr.object_version == 0)
- {
- switch(hdr.object_id)
- {
- case '.RMF':
- if(S_OK != (hr = Read(m_fh.version))) return hr;
- if(hdr.size == 0x10)
- {
- WORD w = 0;
- if(S_OK != (hr = Read(w))) return hr;
- m_fh.nHeaders = w;
- }
- else if(S_OK != (hr = Read(m_fh.nHeaders))) return hr;
- break;
- case 'CONT':
- UINT16 slen;
- if(S_OK != (hr = Read(slen))) return hr;
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) return hr;
- if(S_OK != (hr = Read(slen))) return hr;
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) return hr;
- if(S_OK != (hr = Read(slen))) return hr;
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) return hr;
- if(S_OK != (hr = Read(slen))) return hr;
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) return hr;
- break;
- case 'PROP':
- if(S_OK != (hr = Read(m_p.maxBitRate))) return hr;
- if(S_OK != (hr = Read(m_p.avgBitRate))) return hr;
- if(S_OK != (hr = Read(m_p.maxPacketSize))) return hr;
- if(S_OK != (hr = Read(m_p.avgPacketSize))) return hr;
- if(S_OK != (hr = Read(m_p.nPackets))) return hr;
- if(S_OK != (hr = Read(m_p.tDuration))) return hr;
- if(S_OK != (hr = Read(m_p.tPreroll))) return hr;
- if(S_OK != (hr = Read(m_p.ptrIndex))) return hr;
- if(S_OK != (hr = Read(m_p.ptrData))) return hr;
- if(S_OK != (hr = Read(m_p.nStreams))) return hr;
- UINT16 flags;
- if(S_OK != (hr = Read(flags))) return hr;
- m_p.flags = (Properies::flags_t)flags;
- break;
- case 'MDPR':
- {
- CAutoPtr<MediaProperies> mp(DNew MediaProperies);
- if(S_OK != (hr = Read(mp->stream))) return hr;
- if(S_OK != (hr = Read(mp->maxBitRate))) return hr;
- if(S_OK != (hr = Read(mp->avgBitRate))) return hr;
- if(S_OK != (hr = Read(mp->maxPacketSize))) return hr;
- if(S_OK != (hr = Read(mp->avgPacketSize))) return hr;
- if(S_OK != (hr = Read(mp->tStart))) return hr;
- if(S_OK != (hr = Read(mp->tPreroll))) return hr;
- if(S_OK != (hr = Read(mp->tDuration))) return hr;
- UINT8 slen;
- if(S_OK != (hr = Read(slen))) return hr;
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) return hr;
- if(S_OK != (hr = Read(slen))) return hr;
- if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) return hr;
- UINT32 tsdlen;
- if(S_OK != (hr = Read(tsdlen))) return hr;
- mp->typeSpecData.SetCount(tsdlen);
- if(tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) return hr;
- mp->width = mp->height = 0;
- mp->interlaced = mp->top_field_first = false;
- m_mps.AddTail(mp);
- break;
- }
- case 'DATA':
- {
- CAutoPtr<DataChunk> dc(DNew DataChunk);
- if(S_OK != (hr = Read(dc->nPackets))) return hr;
- if(S_OK != (hr = Read(dc->ptrNext))) return hr;
- dc->pos = GetPos();
- m_dcs.AddTail(dc);
+ Seek(0);
+
+ bool fFirstChunk = true;
+
+ HRESULT hr;
+
+ ChunkHdr hdr;
+ while(GetRemaining() && S_OK == (hr = Read(hdr)))
+ {
+ __int64 pos = GetPos() - sizeof(hdr);
+
+ if(fFirstChunk && hdr.object_id != '.RMF')
+ return E_FAIL;
+
+ fFirstChunk = false;
+
+ if(pos + hdr.size > GetLength() && hdr.object_id != 'DATA') // truncated?
+ break;
+
+ if(hdr.object_id == 0x2E7261FD) // '.ra+0xFD'
+ return E_FAIL;
+
+ if(hdr.object_version == 0)
+ {
+ switch(hdr.object_id)
+ {
+ case '.RMF':
+ if(S_OK != (hr = Read(m_fh.version))) return hr;
+ if(hdr.size == 0x10) {WORD w = 0; if(S_OK != (hr = Read(w))) return hr; m_fh.nHeaders = w;}
+ else if(S_OK != (hr = Read(m_fh.nHeaders))) return hr;
+ break;
+ case 'CONT':
+ UINT16 slen;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) return hr;
+ break;
+ case 'PROP':
+ if(S_OK != (hr = Read(m_p.maxBitRate))) return hr;
+ if(S_OK != (hr = Read(m_p.avgBitRate))) return hr;
+ if(S_OK != (hr = Read(m_p.maxPacketSize))) return hr;
+ if(S_OK != (hr = Read(m_p.avgPacketSize))) return hr;
+ if(S_OK != (hr = Read(m_p.nPackets))) return hr;
+ if(S_OK != (hr = Read(m_p.tDuration))) return hr;
+ if(S_OK != (hr = Read(m_p.tPreroll))) return hr;
+ if(S_OK != (hr = Read(m_p.ptrIndex))) return hr;
+ if(S_OK != (hr = Read(m_p.ptrData))) return hr;
+ if(S_OK != (hr = Read(m_p.nStreams))) return hr;
+ UINT16 flags;
+ if(S_OK != (hr = Read(flags))) return hr;
+ m_p.flags = (Properies::flags_t)flags;
+ break;
+ case 'MDPR':
+ {
+ CAutoPtr<MediaProperies> mp(DNew MediaProperies);
+ if(S_OK != (hr = Read(mp->stream))) return hr;
+ if(S_OK != (hr = Read(mp->maxBitRate))) return hr;
+ if(S_OK != (hr = Read(mp->avgBitRate))) return hr;
+ if(S_OK != (hr = Read(mp->maxPacketSize))) return hr;
+ if(S_OK != (hr = Read(mp->avgPacketSize))) return hr;
+ if(S_OK != (hr = Read(mp->tStart))) return hr;
+ if(S_OK != (hr = Read(mp->tPreroll))) return hr;
+ if(S_OK != (hr = Read(mp->tDuration))) return hr;
+ UINT8 slen;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) return hr;
+ UINT32 tsdlen;
+ if(S_OK != (hr = Read(tsdlen))) return hr;
+ mp->typeSpecData.SetCount(tsdlen);
+ if(tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) return hr;
+ mp->width = mp->height = 0;
+ mp->interlaced = mp->top_field_first = false;
+ m_mps.AddTail(mp);
+ break;
+ }
+ case 'DATA':
+ {
+ CAutoPtr<DataChunk> dc(DNew DataChunk);
+ if(S_OK != (hr = Read(dc->nPackets))) return hr;
+ if(S_OK != (hr = Read(dc->ptrNext))) return hr;
+ dc->pos = GetPos();
+ m_dcs.AddTail(dc);
GetDimensions();
- break;
- }
- case 'INDX':
- {
- IndexChunkHeader ich;
- if(S_OK != (hr = Read(ich.nIndices))) return hr;
- if(S_OK != (hr = Read(ich.stream))) return hr;
- if(S_OK != (hr = Read(ich.ptrNext))) return hr;
- int stream = GetMasterStream();
- while(ich.nIndices-- > 0)
- {
- UINT16 object_version;
- if(S_OK != (hr = Read(object_version))) return hr;
- if(object_version == 0)
- {
- CAutoPtr<IndexRecord> ir(DNew IndexRecord);
- if(S_OK != (hr = Read(ir->tStart))) return hr;
- if(S_OK != (hr = Read(ir->ptrFilePos))) return hr;
- if(S_OK != (hr = Read(ir->packet))) return hr;
- if(ich.stream == stream) m_irs.AddTail(ir);
- }
- }
- break;
- }
- case '.SUB':
- if(hdr.size > sizeof(hdr))
- {
- int size = hdr.size - sizeof(hdr);
- CAutoVectorPtr<char> buff;
- if(!buff.Allocate(size)) return E_OUTOFMEMORY;
- char* p = buff;
- if(S_OK != (hr = ByteRead((BYTE*)p, size))) return hr;
- for(char* end = p + size; p < end;)
- {
- subtitle s;
- s.name = p;
- p += s.name.GetLength() + 1;
- CStringA len(p);
- p += len.GetLength() + 1;
- s.data = CStringA(p, strtol(len, NULL, 10));
- p += s.data.GetLength();
- m_subs.AddTail(s);
- }
- }
- break;
- }
- }
-
- if(hdr.object_id == 'CONT' && BitRead(32, true) == 'DATA')
- {
- hdr.size = GetPos() - pos;
- }
-
- ASSERT(hdr.object_id == 'DATA'
- || GetPos() == pos + hdr.size
- || GetPos() == pos + sizeof(hdr));
-
- pos += hdr.size;
- if(pos > GetPos())
- Seek(pos);
- }
-
- return S_OK;
+ break;
+ }
+ case 'INDX':
+ {
+ IndexChunkHeader ich;
+ if(S_OK != (hr = Read(ich.nIndices))) return hr;
+ if(S_OK != (hr = Read(ich.stream))) return hr;
+ if(S_OK != (hr = Read(ich.ptrNext))) return hr;
+ int stream = GetMasterStream();
+ while(ich.nIndices-- > 0)
+ {
+ UINT16 object_version;
+ if(S_OK != (hr = Read(object_version))) return hr;
+ if(object_version == 0)
+ {
+ CAutoPtr<IndexRecord> ir(DNew IndexRecord);
+ if(S_OK != (hr = Read(ir->tStart))) return hr;
+ if(S_OK != (hr = Read(ir->ptrFilePos))) return hr;
+ if(S_OK != (hr = Read(ir->packet))) return hr;
+ if(ich.stream == stream) m_irs.AddTail(ir);
+ }
+ }
+ break;
+ }
+ case '.SUB':
+ if(hdr.size > sizeof(hdr))
+ {
+ int size = hdr.size - sizeof(hdr);
+ CAutoVectorPtr<char> buff;
+ if(!buff.Allocate(size)) return E_OUTOFMEMORY;
+ char* p = buff;
+ if(S_OK != (hr = ByteRead((BYTE*)p, size))) return hr;
+ for(char* end = p + size; p < end; )
+ {
+ subtitle s;
+ s.name = p; p += s.name.GetLength()+1;
+ CStringA len(p); p += len.GetLength()+1;
+ s.data = CStringA(p, strtol(len, NULL, 10)); p += s.data.GetLength();
+ m_subs.AddTail(s);
+ }
+ }
+ break;
+ }
+ }
+
+ if(hdr.object_id == 'CONT' && BitRead(32, true) == 'DATA')
+ {
+ hdr.size = GetPos() - pos;
+ }
+
+ ASSERT(hdr.object_id == 'DATA'
+ || GetPos() == pos + hdr.size
+ || GetPos() == pos + sizeof(hdr));
+
+ pos += hdr.size;
+ if(pos > GetPos())
+ Seek(pos);
+ }
+
+ return S_OK;
}
#define GetBits(n) GetBits2(n, p, bit_offset, bit_buffer)
unsigned int GetBits2(int n, unsigned char*& p, unsigned int& bit_offset, unsigned int& bit_buffer)
{
- unsigned int ret = ((unsigned int)bit_buffer >> (32 - (n)));
-
- bit_offset += n;
- bit_buffer <<= n;
- if(bit_offset > (32 - 16))
- {
- p += bit_offset >> 3;
- bit_offset &= 7;
- bit_buffer = (unsigned int)p[0] << 24;
- bit_buffer |= (unsigned int)p[1] << 16;
- bit_buffer |= (unsigned int)p[2] << 8;
- bit_buffer |= (unsigned int)p[3];
- bit_buffer <<= bit_offset;
- }
-
- return ret;
+ unsigned int ret = ((unsigned int)bit_buffer >> (32-(n)));
+
+ bit_offset += n;
+ bit_buffer <<= n;
+ if(bit_offset > (32-16))
+ {
+ p += bit_offset >> 3;
+ bit_offset &= 7;
+ bit_buffer = (unsigned int)p[0] << 24;
+ bit_buffer |= (unsigned int)p[1] << 16;
+ bit_buffer |= (unsigned int)p[2] << 8;
+ bit_buffer |= (unsigned int)p[3];
+ bit_buffer <<= bit_offset;
+ }
+
+ return ret;
}
void GetDimensions(unsigned char* p, unsigned int* wi, unsigned int* hi)
{
- unsigned int w, h, c;
-
- const unsigned int cw[8] = {160, 176, 240, 320, 352, 640, 704, 0};
- const unsigned int ch1[8] = {120, 132, 144, 240, 288, 480, 0, 0};
- const unsigned int ch2[4] = {180, 360, 576, 0};
-
- unsigned int bit_offset = 0;
- unsigned int bit_buffer = *(unsigned int*)p;
- bswap(bit_buffer);
-
- GetBits(13);
-
- GetBits(13);
-
- w = cw[GetBits(3)];
- if(w == 0)
- {
- do
- {
- c = GetBits(8);
- w += (c << 2);
- }
- while(c == 255);
- }
-
- c = GetBits(3);
-
- h = ch1[c];
- if(h == 0)
- {
- c = ((c << 1) | GetBits(1)) & 3;
-
- h = ch2[c];
- if(h == 0)
- {
- do
- {
- c = GetBits(8);
- h += (c << 2);
- }
- while(c == 255);
- }
- }
-
- *wi = w;
- *hi = h;
+ unsigned int w, h, c;
+
+ const unsigned int cw[8] = {160, 176, 240, 320, 352, 640, 704, 0};
+ const unsigned int ch1[8] = {120, 132, 144, 240, 288, 480, 0, 0};
+ const unsigned int ch2[4] = {180, 360, 576, 0};
+
+ unsigned int bit_offset = 0;
+ unsigned int bit_buffer = *(unsigned int*)p;
+ bswap(bit_buffer);
+
+ GetBits(13);
+
+ GetBits(13);
+
+ w = cw[GetBits(3)];
+ if(w == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ w += (c << 2);
+ }
+ while(c == 255);
+ }
+
+ c = GetBits(3);
+
+ h = ch1[c];
+ if(h == 0)
+ {
+ c = ((c << 1) | GetBits(1)) & 3;
+
+ h = ch2[c];
+ if(h == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ h += (c << 2);
+ }
+ while(c == 255);
+ }
+ }
+
+ *wi = w;
+ *hi = h;
}
-void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi,
- bool *interlaced, bool *top_field_first, bool *repeat_field)
-{
- unsigned int w, h, c;
-
- const unsigned int cw[8] = {160, 176, 240, 320, 352, 640, 704, 0};
- const unsigned int ch1[8] = {120, 132, 144, 240, 288, 480, 0, 0};
- const unsigned int ch2[4] = {180, 360, 576, 0};
-
- unsigned int bit_offset = 0;
- unsigned int bit_buffer = *(unsigned int*)p;
- bswap(bit_buffer);
-
- GetBits(9);
-
- *interlaced = false;
- *top_field_first = false;
- *repeat_field = false;
- c = GetBits(1);
- if(c)
- {
- c = GetBits(1);
- if(c)
- *interlaced = true;
- c = GetBits(1);
- if(c)
- *top_field_first = true;
- c = GetBits(1);
- if(c)
- *repeat_field = true;
-
- c = GetBits(1);
- c = GetBits(1);
- if(c)
- GetBits(2);
- }
-
- GetBits(16);
-
- w = cw[GetBits(3)];
- if(w == 0)
- {
- do
- {
- c = GetBits(8);
- w += (c << 2);
- }
- while(c == 255);
- }
-
- c = GetBits(3);
-
- h = ch1[c];
- if(h == 0)
- {
- c = ((c << 1) | GetBits(1)) & 3;
-
- h = ch2[c];
- if(h == 0)
- {
- do
- {
- c = GetBits(8);
- h += (c << 2);
- }
- while(c == 255);
- }
- }
-
- *wi = w;
- *hi = h;
+void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi,
+ bool *interlaced, bool *top_field_first, bool *repeat_field)
+{
+ unsigned int w, h, c;
+
+ const unsigned int cw[8] = {160, 176, 240, 320, 352, 640, 704, 0};
+ const unsigned int ch1[8] = {120, 132, 144, 240, 288, 480, 0, 0};
+ const unsigned int ch2[4] = {180, 360, 576, 0};
+
+ unsigned int bit_offset = 0;
+ unsigned int bit_buffer = *(unsigned int*)p;
+ bswap(bit_buffer);
+
+ GetBits(9);
+
+ *interlaced = false;
+ *top_field_first = false;
+ *repeat_field = false;
+ c = GetBits(1);
+ if (c)
+ {
+ c = GetBits(1);
+ if (c)
+ *interlaced = true;
+ c = GetBits(1);
+ if (c)
+ *top_field_first = true;
+ c = GetBits(1);
+ if (c)
+ *repeat_field = true;
+
+ c = GetBits(1);
+ c = GetBits(1);
+ if (c)
+ GetBits(2);
+ }
+
+ GetBits(16);
+
+ w = cw[GetBits(3)];
+ if(w == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ w += (c << 2);
+ }
+ while(c == 255);
+ }
+
+ c = GetBits(3);
+
+ h = ch1[c];
+ if(h == 0)
+ {
+ c = ((c << 1) | GetBits(1)) & 3;
+
+ h = ch2[c];
+ if(h == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ h += (c << 2);
+ }
+ while(c == 255);
+ }
+ }
+
+ *wi = w;
+ *hi = h;
}
void CRMFile::GetDimensions()
{
- POSITION pos = m_mps.GetHeadPosition();
- while(pos)
- {
- UINT64 filepos = GetPos();
-
- MediaProperies* pmp = m_mps.GetNext(pos);
- if(pmp->mime == "video/x-pn-realvideo")
- {
- pmp->width = pmp->height = 0;
-
- rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
- rvi.bswap();
-
- if(rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR')
- continue;
-
- MediaPacketHeader mph;
- while(S_OK == Read(mph))
- {
- if(mph.stream != pmp->stream || mph.len == 0
- || !(mph.flags & MediaPacketHeader::PN_KEYFRAME_FLAG))
- continue;
-
- BYTE* p = mph.pData.GetData();
- BYTE* p0 = p;
- int len = mph.pData.GetCount();
-
- BYTE hdr = *p++;
- DWORD packetlen = 0, packetoffset = 0;
-
- if((hdr & 0xc0) == 0x40)
- {
- packetlen = len - (++p - p0);
- }
- else
- {
- if((hdr & 0x40) == 0) p++;
-
-#define GetWORD(var) \
+ POSITION pos = m_mps.GetHeadPosition();
+ while(pos)
+ {
+ UINT64 filepos = GetPos();
+
+ MediaProperies* pmp = m_mps.GetNext(pos);
+ if(pmp->mime == "video/x-pn-realvideo")
+ {
+ pmp->width = pmp->height = 0;
+
+ rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
+ rvi.bswap();
+
+ if(rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR')
+ continue;
+
+ MediaPacketHeader mph;
+ while(S_OK == Read(mph))
+ {
+ if(mph.stream != pmp->stream || mph.len == 0
+ || !(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG))
+ continue;
+
+ BYTE* p = mph.pData.GetData();
+ BYTE* p0 = p;
+ int len = mph.pData.GetCount();
+
+ BYTE hdr = *p++;
+ DWORD packetlen = 0, packetoffset = 0;
+
+ if((hdr&0xc0) == 0x40)
+ {
+ packetlen = len - (++p - p0);
+ }
+ else
+ {
+ if((hdr&0x40) == 0) p++;
+
+ #define GetWORD(var) \
var = (var<<8)|(*p++); \
var = (var<<8)|(*p++); \
-
- GetWORD(packetlen);
- if((packetlen & 0x4000) == 0)
- {
- GetWORD(packetlen);
- packetlen &= 0x3fffffff;
- }
- else packetlen &= 0x3fff;
-
- GetWORD(packetoffset);
- if((packetoffset & 0x4000) == 0)
- {
- GetWORD(packetoffset);
- packetoffset &= 0x3fffffff;
- }
- else packetoffset &= 0x3fff;
-
-#undef GetWORD
-
- if((hdr & 0xc0) == 0xc0) packetoffset = 0;
- else if((hdr & 0xc0) == 0x80) packetoffset = packetlen - packetoffset;
-
- p++;
- }
-
- len = min(len - (p - p0), packetlen - packetoffset);
-
- if(len > 0)
- {
- bool repeat_field;
- if(rvi.fcc2 == '14VR') ::GetDimensions_X10(p, &pmp->width, &pmp->height, &pmp->interlaced, &pmp->top_field_first, &repeat_field);
- else ::GetDimensions(p, &pmp->width, &pmp->height);
-
- if(rvi.w == pmp->width && rvi.h == pmp->height)
- pmp->width = pmp->height = 0;
-
- break;
- }
- }
- }
- Seek(filepos);
- }
+ GetWORD(packetlen);
+ if((packetlen&0x4000) == 0) {GetWORD(packetlen); packetlen &= 0x3fffffff;}
+ else packetlen &= 0x3fff;
+
+ GetWORD(packetoffset);
+ if((packetoffset&0x4000) == 0) {GetWORD(packetoffset); packetoffset &= 0x3fffffff;}
+ else packetoffset &= 0x3fff;
+
+ #undef GetWORD
+
+ if((hdr&0xc0) == 0xc0) packetoffset = 0;
+ else if((hdr&0xc0) == 0x80) packetoffset = packetlen - packetoffset;
+
+ p++;
+ }
+
+ len = min(len - (p - p0), packetlen - packetoffset);
+
+ if(len > 0)
+ {
+ bool repeat_field;
+ if(rvi.fcc2 == '14VR') ::GetDimensions_X10(p, &pmp->width, &pmp->height, &pmp->interlaced, &pmp->top_field_first, &repeat_field);
+ else ::GetDimensions(p, &pmp->width, &pmp->height);
+
+ if(rvi.w == pmp->width && rvi.h == pmp->height)
+ pmp->width = pmp->height = 0;
+
+ break;
+ }
+ }
+ }
+
+ Seek(filepos);
+ }
}
int CRMFile::GetMasterStream()
{
- int s1 = -1, s2 = -1;
+ int s1 = -1, s2 = -1;
- POSITION pos = m_mps.GetHeadPosition();
- while(pos)
- {
- MediaProperies* pmp = m_mps.GetNext(pos);
- if(pmp->mime == "video/x-pn-realvideo")
- {
- s1 = pmp->stream;
- break;
- }
- else if(pmp->mime == "audio/x-pn-realaudio" && s2 == -1) s2 = pmp->stream;
- }
+ POSITION pos = m_mps.GetHeadPosition();
+ while(pos)
+ {
+ MediaProperies* pmp = m_mps.GetNext(pos);
+ if(pmp->mime == "video/x-pn-realvideo") {s1 = pmp->stream; break;}
+ else if(pmp->mime == "audio/x-pn-realaudio" && s2 == -1) s2 = pmp->stream;
+ }
- if(s1 == -1)
- s1 = s2;
+ if(s1 == -1)
+ s1 = s2;
- return s1;
+ return s1;
}
@@ -1531,443 +1452,421 @@ int CRMFile::GetMasterStream()
//
CRealVideoDecoder::CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseVideoFilter(NAME("CRealVideoDecoder"), lpunk, phr, __uuidof(this))
- , m_hDrvDll(NULL)
- , m_dwCookie(0)
- , m_lastBuffSizeDim(0)
+ : CBaseVideoFilter(NAME("CRealVideoDecoder"), lpunk, phr, __uuidof(this))
+ , m_hDrvDll(NULL)
+ , m_dwCookie(0)
+ , m_lastBuffSizeDim(0)
{
}
CRealVideoDecoder::~CRealVideoDecoder()
{
- if(m_hDrvDll) FreeLibrary(m_hDrvDll);
+ if(m_hDrvDll) FreeLibrary(m_hDrvDll);
}
HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt)
{
- FreeRV();
-
- HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
-
- rvinfo rvi = *(rvinfo*)(pmt->Format() + (pmt->formattype == FORMAT_VideoInfo ? sizeof(VIDEOINFOHEADER) : sizeof(VIDEOINFOHEADER2)));
- rvi.bswap();
-
-#pragma pack(push, 1)
- struct
- {
- WORD unk1, w, h, unk3;
- DWORD unk2, subformat, unk5, format;
- } i =
- {11, rvi.w, rvi.h, 0, 0, rvi.type1, 1, rvi.type2};
-#pragma pack(pop)
-
- if(FAILED(hr = RVInit(&i, &m_dwCookie)))
- return hr;
-
- if(rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002)
- {
- int nWidthHeight = (1 + ((rvi.type1 >> 16) & 7));
- UINT32* pWH = DNew UINT32[nWidthHeight*2];
- pWH[0] = rvi.w;
- pWH[1] = rvi.h;
- for(int i = 2; i < nWidthHeight * 2; i++)
- pWH[i] = rvi.morewh[i-2] * 4;
-#pragma pack(push, 1)
- struct
- {
- UINT32 data1;
- UINT32 data2;
- UINT32* dimensions;
- } cmsg_data =
- {0x24, nWidthHeight, pWH};
-#pragma pack(pop)
- hr = RVCustomMessage(&cmsg_data, m_dwCookie);
- delete [] pWH;
- }
-
- return hr;
+ FreeRV();
+
+ HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
+
+ rvinfo rvi = *(rvinfo*)(pmt->Format() + (pmt->formattype == FORMAT_VideoInfo ? sizeof(VIDEOINFOHEADER) : sizeof(VIDEOINFOHEADER2)));
+ rvi.bswap();
+
+ #pragma pack(push, 1)
+ struct {WORD unk1, w, h, unk3; DWORD unk2, subformat, unk5, format;} i =
+ {11, rvi.w, rvi.h, 0, 0, rvi.type1, 1, rvi.type2};
+ #pragma pack(pop)
+
+ if(FAILED(hr = RVInit(&i, &m_dwCookie)))
+ return hr;
+
+ if(rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002)
+ {
+ int nWidthHeight = (1+((rvi.type1>>16)&7));
+ UINT32* pWH = DNew UINT32[nWidthHeight*2];
+ pWH[0] = rvi.w; pWH[1] = rvi.h;
+ for(int i = 2; i < nWidthHeight*2; i++)
+ pWH[i] = rvi.morewh[i-2]*4;
+ #pragma pack(push, 1)
+ struct {UINT32 data1; UINT32 data2; UINT32* dimensions;} cmsg_data =
+ {0x24, nWidthHeight, pWH};
+ #pragma pack(pop)
+ hr = RVCustomMessage(&cmsg_data, m_dwCookie);
+ delete [] pWH;
+ }
+
+ return hr;
}
void CRealVideoDecoder::FreeRV()
{
- if(m_dwCookie)
- {
- RVFree(m_dwCookie);
- m_dwCookie = 0;
- }
+ if(m_dwCookie)
+ {
+ RVFree(m_dwCookie);
+ m_dwCookie = 0;
+ }
}
HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
{
- CAutoLock cAutoLock(&m_csReceive);
-
- HRESULT hr;
-
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn)))
- return hr;
-
- long len = pIn->GetActualDataLength();
- if(len <= 0) return S_OK; // nothing to do
-
- REFERENCE_TIME rtStart, rtStop;
- pIn->GetTime(&rtStart, &rtStop);
-
- rtStart += m_tStart;
-
- int offset = 1 + ((*pDataIn) + 1) * 8;
-
-#pragma pack(push, 1)
- struct
- {
- DWORD len, unk1, chunks;
- DWORD* extra;
- DWORD unk2, timestamp;
- } transform_in =
- {len - offset, 0, *pDataIn, (DWORD*)(pDataIn + 1), 0, (DWORD)(rtStart / 10000)};
- struct
- {
- DWORD unk1, unk2, timestamp, w, h;
- } transform_out =
- {0, 0, 0, 0, 0};
-#pragma pack(pop)
-
- pDataIn += offset;
-
- if(m_fDropFrames && m_timestamp + 1 == transform_in.timestamp)
- {
- m_timestamp = transform_in.timestamp;
- return S_OK;
- }
-
-
- unsigned int tmp1, tmp2;
- bool interlaced = false, tmp3, tmp4;
- ::GetDimensions_X10(pDataIn, &tmp1, &tmp2, &interlaced, &tmp3, &tmp4);
-
- int size = tmp1 * tmp2;
- if(m_lastBuffSizeDim < size)
- {
- m_pI420.Free();
- m_pI420Tmp.Free();
-
- m_lastBuffSizeDim = size;
- ATLTRACE("resize out put buff %d" , size);
- if(m_pI420.Allocate(size * 3 / 2))
- {
- ATLTRACE(" m_pI420.Allocated 1");
- memset(m_pI420, 0, size);
- ATLTRACE(" m_pI420.Allocated 2");
- memset(m_pI420 + size, 0x80, size / 2);
- ATLTRACE(" m_pI420.Allocated 3");
- }
- else
- {
- ATLTRACE(" m_pI420.Allocate fail %d" , size * 3 / 2);
- return S_OK;
- }
- if(m_pI420Tmp.Allocate(size * 3 / 2))
- {
- ATLTRACE(" m_pI420Tmp.Allocated 1");
- memset(m_pI420Tmp, 0, size);
- ATLTRACE(" m_pI420Tmp.Allocated 2");
- memset(m_pI420Tmp + size, 0x80, size / 2);
- ATLTRACE(" m_pI420Tmp.Allocated 3");
- }
- else
- {
- ATLTRACE(" m_pI420Tmp.Allocate fail %d" , size * 3 / 2);
- return S_OK;
- }
- }
-
- hr = RVTransform(pDataIn, (BYTE*)m_pI420, &transform_in, &transform_out, m_dwCookie);
-
- m_timestamp = transform_in.timestamp;
-
- if(FAILED(hr))
- {
- TRACE(_T("RV returned an error code!!!\n"));
- ASSERT(!(transform_out.unk1 & 1)); // error allowed when the "render" flag is not set
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK; // nothing to do
+
+ REFERENCE_TIME rtStart, rtStop;
+ pIn->GetTime(&rtStart, &rtStop);
+
+ rtStart += m_tStart;
+
+ int offset = 1+((*pDataIn)+1)*8;
+
+ #pragma pack(push, 1)
+ struct {DWORD len, unk1, chunks; DWORD* extra; DWORD unk2, timestamp;} transform_in =
+ {len - offset, 0, *pDataIn, (DWORD*)(pDataIn+1), 0, (DWORD)(rtStart/10000)};
+ struct {DWORD unk1, unk2, timestamp, w, h;} transform_out =
+ {0,0,0,0,0};
+ #pragma pack(pop)
+
+ pDataIn += offset;
+
+ if(m_fDropFrames && m_timestamp+1 == transform_in.timestamp)
+ {
+ m_timestamp = transform_in.timestamp;
+ return S_OK;
+ }
+
+
+ unsigned int tmp1, tmp2;
+ bool interlaced = false, tmp3, tmp4;
+ ::GetDimensions_X10(pDataIn, &tmp1, &tmp2, &interlaced, &tmp3, &tmp4);
+
+ int size = tmp1*tmp2;
+ if( m_lastBuffSizeDim < size )
+ {
+ m_pI420.Free();
+ m_pI420Tmp.Free();
+
+ m_lastBuffSizeDim = size;
+ ATLTRACE("resize out put buff %d" ,size);
+ if ( m_pI420.Allocate(size*3/2) )
+ {
+ ATLTRACE(" m_pI420.Allocated 1" );
+ memset(m_pI420, 0, size);
+ ATLTRACE(" m_pI420.Allocated 2" );
+ memset(m_pI420 + size, 0x80, size/2);
+ ATLTRACE(" m_pI420.Allocated 3" );
+ }
+ else
+ {
+ ATLTRACE(" m_pI420.Allocate fail %d" ,size*3/2);
+ return S_OK;
+ }
+ if( m_pI420Tmp.Allocate(size*3/2) )
+ {
+ ATLTRACE(" m_pI420Tmp.Allocated 1" );
+ memset(m_pI420Tmp, 0, size);
+ ATLTRACE(" m_pI420Tmp.Allocated 2" );
+ memset(m_pI420Tmp + size, 0x80, size/2);
+ ATLTRACE(" m_pI420Tmp.Allocated 3" );
+ }
+ else
+ {
+ ATLTRACE(" m_pI420Tmp.Allocate fail %d" ,size*3/2);
+ return S_OK;
+ }
+ }
+
+ hr = RVTransform(pDataIn, (BYTE*)m_pI420, &transform_in, &transform_out, m_dwCookie);
+
+ m_timestamp = transform_in.timestamp;
+
+ if(FAILED(hr))
+ {
+ TRACE(_T("RV returned an error code!!!\n"));
+ ASSERT(!(transform_out.unk1&1)); // error allowed when the "render" flag is not set
// return hr;
- }
+ }
- if(pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1 & 1))
- return S_OK;
+ if(pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1&1))
+ return S_OK;
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
&& */ FAILED(hr = GetDeliveryBuffer(m_w, m_h, &pOut))
- || FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
- BYTE* pI420[3] = {m_pI420, m_pI420Tmp, NULL};
+ BYTE* pI420[3] = {m_pI420, m_pI420Tmp, NULL};
- if(interlaced)
- {
- int size = m_w * m_h;
- DeinterlaceBlend(pI420[1], pI420[0], m_w, m_h, m_w, m_w);
- DeinterlaceBlend(pI420[1] + size, pI420[0] + size, m_w / 2, m_h / 2, m_w / 2, m_w / 2);
- DeinterlaceBlend(pI420[1] + size * 5 / 4, pI420[0] + size * 5 / 4, m_w / 2, m_h / 2, m_w / 2, m_w / 2);
- pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
- }
+ if(interlaced)
+ {
+ int size = m_w*m_h;
+ DeinterlaceBlend(pI420[1], pI420[0], m_w, m_h, m_w, m_w);
+ DeinterlaceBlend(pI420[1]+size, pI420[0]+size, m_w/2, m_h/2, m_w/2, m_w/2);
+ DeinterlaceBlend(pI420[1]+size*5/4, pI420[0]+size*5/4, m_w/2, m_h/2, m_w/2, m_w/2);
+ pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
+ }
- if(transform_out.w != m_w || transform_out.h != m_h)
- {
- Resize(pI420[0], transform_out.w, transform_out.h, pI420[1], m_w, m_h);
- // only one of these can be true, and when it happens the result image must be in the tmp buffer
- if(transform_out.w == m_w || transform_out.h == m_h)
- pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
- }
+ if(transform_out.w != m_w || transform_out.h != m_h)
+ {
+ Resize(pI420[0], transform_out.w, transform_out.h, pI420[1], m_w, m_h);
+ // only one of these can be true, and when it happens the result image must be in the tmp buffer
+ if(transform_out.w == m_w || transform_out.h == m_h)
+ pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
+ }
- rtStart = 10000i64 * transform_out.timestamp - m_tStart;
- rtStop = rtStart + 1;
- pOut->SetTime(&rtStart, /*NULL*/&rtStop);
+ rtStart = 10000i64*transform_out.timestamp - m_tStart;
+ rtStop = rtStart + 1;
+ pOut->SetTime(&rtStart, /*NULL*/&rtStop);
- pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
+ pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
- CopyBuffer(pDataOut, pI420[0], m_w, m_h, m_w, MEDIASUBTYPE_I420);
+ CopyBuffer(pDataOut, pI420[0], m_w, m_h, m_w, MEDIASUBTYPE_I420);
- DbgLog((LOG_TRACE, 0, _T("V: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
- rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
+DbgLog((LOG_TRACE, 0, _T("V: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
+ rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
- return m_pOutput->Deliver(pOut);
+ return m_pOutput->Deliver(pOut);
}
void CRealVideoDecoder::Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- int si = wi * hi, so = wo * ho;
- ASSERT(((si * so) & 3) == 0);
-
- if(wi < wo)
- {
- ResizeWidth(pIn, wi, hi, pOut, wo, ho);
- ResizeWidth(pIn + si, wi / 2, hi / 2, pOut + so, wo / 2, ho / 2);
- ResizeWidth(pIn + si + si / 4, wi / 2, hi / 2, pOut + so + so / 4, wo / 2, ho / 2);
- if(hi == ho) return;
- ResizeHeight(pOut, wo, hi, pIn, wo, ho);
- ResizeHeight(pOut + so, wo / 2, hi / 2, pIn + so, wo / 2, ho / 2);
- ResizeHeight(pOut + so + so / 4, wo / 2, hi / 2, pIn + so + so / 4, wo / 2, ho / 2);
- }
- else if(hi < ho)
- {
- ResizeHeight(pIn, wi, hi, pOut, wo, ho);
- ResizeHeight(pIn + si, wi / 2, hi / 2, pOut + so, wo / 2, ho / 2);
- ResizeHeight(pIn + si + si / 4, wi / 2, hi / 2, pOut + so + so / 4, wo / 2, ho / 2);
- if(wi == wo) return;
- ASSERT(0); // this is uncreachable code, but anyway... looks nice being so symmetric
- ResizeWidth(pOut, wi, ho, pIn, wo, ho);
- ResizeWidth(pOut + so, wi / 2, ho / 2, pIn + so, wo / 2, ho / 2);
- ResizeWidth(pOut + so + so / 4, wi / 2, ho / 2, pIn + so + so / 4, wo / 2, ho / 2);
- }
+ int si = wi*hi, so = wo*ho;
+ ASSERT(((si*so)&3) == 0);
+
+ if(wi < wo)
+ {
+ ResizeWidth(pIn, wi, hi, pOut, wo, ho);
+ ResizeWidth(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
+ ResizeWidth(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
+ if(hi == ho) return;
+ ResizeHeight(pOut, wo, hi, pIn, wo, ho);
+ ResizeHeight(pOut + so, wo/2, hi/2, pIn + so, wo/2, ho/2);
+ ResizeHeight(pOut + so + so/4, wo/2, hi/2, pIn + so + so/4, wo/2, ho/2);
+ }
+ else if(hi < ho)
+ {
+ ResizeHeight(pIn, wi, hi, pOut, wo, ho);
+ ResizeHeight(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
+ ResizeHeight(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
+ if(wi == wo) return;
+ ASSERT(0); // this is uncreachable code, but anyway... looks nice being so symmetric
+ ResizeWidth(pOut, wi, ho, pIn, wo, ho);
+ ResizeWidth(pOut + so, wi/2, ho/2, pIn + so, wo/2, ho/2);
+ ResizeWidth(pOut + so + so/4, wi/2, ho/2, pIn + so + so/4, wo/2, ho/2);
+ }
}
void CRealVideoDecoder::ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- for(DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo)
- {
- if(wi == wo) memcpy(pOut, pIn, wo);
- else ResizeRow(pIn, wi, 1, pOut, wo, 1);
- }
+ for(DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo)
+ {
+ if(wi == wo) memcpy(pOut, pIn, wo);
+ else ResizeRow(pIn, wi, 1, pOut, wo, 1);
+ }
}
void CRealVideoDecoder::ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
{
- if(hi == ho)
- {
- memcpy(pOut, pIn, wo * ho);
- }
- else
- {
- for(DWORD x = 0; x < wo; x++, pIn++, pOut++)
- ResizeRow(pIn, hi, wo, pOut, ho, wo);
- }
+ if(hi == ho)
+ {
+ memcpy(pOut, pIn, wo*ho);
+ }
+ else
+ {
+ for(DWORD x = 0; x < wo; x++, pIn++, pOut++)
+ ResizeRow(pIn, hi, wo, pOut, ho, wo);
+ }
}
void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DWORD wo, DWORD dpo)
{
- ASSERT(wi < wo);
+ ASSERT(wi < wo);
if(dpo == 1)
- {
- for(DWORD i = 0, j = 0, dj = (wi << 16) / wo; i < wo - 1; i++, pOut++, j += dj)
+ {
+ for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut++, j += dj)
// pOut[i] = pIn[j>>16];
- {
- BYTE* p = &pIn[j>>16];
- DWORD jf = j & 0xffff;
- *pOut = ((p[0] * (0xffff - jf) + p[1] * jf) + 0x7fff) >> 16;
- }
-
- *pOut = pIn[wi-1];
- }
- else
- {
- for(DWORD i = 0, j = 0, dj = (wi << 16) / wo; i < wo - 1; i++, pOut += dpo, j += dj)
+ {
+ BYTE* p = &pIn[j>>16];
+ DWORD jf = j&0xffff;
+ *pOut = ((p[0]*(0xffff-jf) + p[1]*jf) + 0x7fff) >> 16;
+ }
+
+ *pOut = pIn[wi-1];
+ }
+ else
+ {
+ for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut += dpo, j += dj)
// *pOut = pIn[dpi*(j>>16)];
- {
- BYTE* p = &pIn[dpi*(j>>16)];
- DWORD jf = j & 0xffff;
- *pOut = ((p[0] * (0xffff - jf) + p[dpi] * jf) + 0x7fff) >> 16;
- }
-
- *pOut = pIn[dpi*(wi-1)];
- }
+ {
+ BYTE* p = &pIn[dpi*(j>>16)];
+ DWORD jf = j&0xffff;
+ *pOut = ((p[0]*(0xffff-jf) + p[dpi]*jf) + 0x7fff) >> 16;
+ }
+
+ *pOut = pIn[dpi*(wi-1)];
+ }
}
HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->majortype != MEDIATYPE_Video
- || mtIn->subtype != MEDIASUBTYPE_RV20
- && mtIn->subtype != MEDIASUBTYPE_RV30
- && mtIn->subtype != MEDIASUBTYPE_RV40
- && mtIn->subtype != MEDIASUBTYPE_RV41)
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(mtIn->formattype == FORMAT_VideoInfo2)
- {
- VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mtIn->Format();
- if(vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
- || vih2->dwPictAspectRatioY < vih2->bmiHeader.biHeight)
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- if(!m_pInput->IsConnected())
- {
- if(m_hDrvDll)
- {
- FreeLibrary(m_hDrvDll);
- m_hDrvDll = NULL;
- }
-
- CAtlList<CString> paths;
- CString olddll, newdll, oldpath, newpath;
-
- olddll.Format(_T("drv%c3260.dll"), (TCHAR)((mtIn->subtype.Data1 >> 16) & 0xff));
- newdll =
- mtIn->subtype == FOURCCMap('14VR') ? _T("drvi.dll") :
- mtIn->subtype == FOURCCMap('02VR') ? _T("drv2.dll") :
- _T("drvc.dll");
-
- CRegKey key;
- TCHAR buff[_MAX_PATH];
- ULONG len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
- && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
- {
- oldpath = buff;
- TCHAR c = oldpath[oldpath.GetLength()-1];
- if(c != '\\' && c != '/') oldpath += '\\';
- key.Close();
- }
- len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
- && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
- {
- newpath = buff;
- TCHAR c = newpath[newpath.GetLength()-1];
- if(c != '\\' && c != '/') newpath += '\\';
- key.Close();
- }
-
- if(!newpath.IsEmpty()) paths.AddTail(newpath + newdll);
- if(!oldpath.IsEmpty()) paths.AddTail(oldpath + newdll);
- paths.AddTail(newdll); // default dll paths
- if(!newpath.IsEmpty()) paths.AddTail(newpath + olddll);
- if(!oldpath.IsEmpty()) paths.AddTail(oldpath + olddll);
- paths.AddTail(olddll); // default dll paths
-
- POSITION pos = paths.GetHeadPosition();
- while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
-
- if(m_hDrvDll)
- {
- RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420CustomMessage");
- RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV20toYUV420Free");
- RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420HiveMessage");
- RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV20toYUV420Init");
- RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV20toYUV420Transform");
-
- if(!RVCustomMessage) RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420CustomMessage");
- if(!RVFree) RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV40toYUV420Free");
- if(!RVHiveMessage) RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420HiveMessage");
- if(!RVInit) RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV40toYUV420Init");
- if(!RVTransform) RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV40toYUV420Transform");
- }
-
- if(!m_hDrvDll || !RVCustomMessage
- || !RVFree || !RVHiveMessage
- || !RVInit || !RVTransform)
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(FAILED(InitRV(mtIn)))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- return S_OK;
+ if(mtIn->majortype != MEDIATYPE_Video
+ || mtIn->subtype != MEDIASUBTYPE_RV20
+ && mtIn->subtype != MEDIASUBTYPE_RV30
+ && mtIn->subtype != MEDIASUBTYPE_RV40
+ && mtIn->subtype != MEDIASUBTYPE_RV41)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(mtIn->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mtIn->Format();
+ if(vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
+ || vih2->dwPictAspectRatioY < vih2->bmiHeader.biHeight)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ if(!m_pInput->IsConnected())
+ {
+ if(m_hDrvDll) {FreeLibrary(m_hDrvDll); m_hDrvDll = NULL;}
+
+ CAtlList<CString> paths;
+ CString olddll, newdll, oldpath, newpath;
+
+ olddll.Format(_T("drv%c3260.dll"), (TCHAR)((mtIn->subtype.Data1>>16)&0xff));
+ newdll =
+ mtIn->subtype == FOURCCMap('14VR') ? _T("drvi.dll") :
+ mtIn->subtype == FOURCCMap('02VR') ? _T("drv2.dll") :
+ _T("drvc.dll");
+
+ CRegKey key;
+ TCHAR buff[_MAX_PATH];
+ ULONG len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ oldpath = buff;
+ TCHAR c = oldpath[oldpath.GetLength()-1];
+ if(c != '\\' && c != '/') oldpath += '\\';
+ key.Close();
+ }
+ len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ newpath = buff;
+ TCHAR c = newpath[newpath.GetLength()-1];
+ if(c != '\\' && c != '/') newpath += '\\';
+ key.Close();
+ }
+
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + newdll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + newdll);
+ paths.AddTail(newdll); // default dll paths
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + olddll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + olddll);
+ paths.AddTail(olddll); // default dll paths
+
+ POSITION pos = paths.GetHeadPosition();
+ while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
+
+ if(m_hDrvDll)
+ {
+ RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420CustomMessage");
+ RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV20toYUV420Free");
+ RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420HiveMessage");
+ RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV20toYUV420Init");
+ RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV20toYUV420Transform");
+
+ if(!RVCustomMessage) RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420CustomMessage");
+ if(!RVFree) RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV40toYUV420Free");
+ if(!RVHiveMessage) RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420HiveMessage");
+ if(!RVInit) RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV40toYUV420Init");
+ if(!RVTransform) RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV40toYUV420Transform");
+ }
+
+ if(!m_hDrvDll || !RVCustomMessage
+ || !RVFree || !RVHiveMessage
+ || !RVInit || !RVTransform)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(FAILED(InitRV(mtIn)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
}
HRESULT CRealVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- if(m_pOutput && m_pOutput->IsConnected())
- {
- BITMAPINFOHEADER bih1, bih2;
- if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
- && abs(bih1.biHeight) != abs(bih2.biHeight))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
+ if(m_pOutput && m_pOutput->IsConnected())
+ {
+ BITMAPINFOHEADER bih1, bih2;
+ if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ && abs(bih1.biHeight) != abs(bih2.biHeight))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
- return __super::CheckTransform(mtIn, mtOut);
+ return __super::CheckTransform(mtIn, mtOut);
}
HRESULT CRealVideoDecoder::StartStreaming()
{
- const CMediaType& mt = m_pInput->CurrentMediaType();
- if(FAILED(InitRV(&mt)))
- return E_FAIL;
+ const CMediaType& mt = m_pInput->CurrentMediaType();
+ if(FAILED(InitRV(&mt)))
+ return E_FAIL;
- int size = m_w * m_h;
- m_lastBuffSizeDim = size;
- m_pI420.Allocate(size * 3 / 2);
- memset(m_pI420, 0, size);
- memset(m_pI420 + size, 0x80, size / 2);
- m_pI420Tmp.Allocate(size * 3 / 2);
- memset(m_pI420Tmp, 0, size);
- memset(m_pI420Tmp + size, 0x80, size / 2);
+ int size = m_w*m_h;
+ m_lastBuffSizeDim = size;
+ m_pI420.Allocate(size*3/2);
+ memset(m_pI420, 0, size);
+ memset(m_pI420 + size, 0x80, size/2);
+ m_pI420Tmp.Allocate(size*3/2);
+ memset(m_pI420Tmp, 0, size);
+ memset(m_pI420Tmp + size, 0x80, size/2);
- return __super::StartStreaming();
+ return __super::StartStreaming();
}
HRESULT CRealVideoDecoder::StopStreaming()
{
- m_pI420.Free();
- m_pI420Tmp.Free();
+ m_pI420.Free();
+ m_pI420Tmp.Free();
- FreeRV();
+ FreeRV();
- return __super::StopStreaming();
+ return __super::StopStreaming();
}
HRESULT CRealVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- m_timestamp = ~0;
- m_fDropFrames = false;
+ m_timestamp = ~0;
+ m_fDropFrames = false;
- DWORD tmp[2] = {20, 0};
- RVHiveMessage(tmp, m_dwCookie);
+ DWORD tmp[2] = {20, 0};
+ RVHiveMessage(tmp, m_dwCookie);
- m_tStart = tStart;
- return __super::NewSegment(tStart, tStop, dRate);
+ m_tStart = tStart;
+ return __super::NewSegment(tStart, tStop, dRate);
}
HRESULT CRealVideoDecoder::AlterQuality(Quality q)
{
- if(q.Late > 500 * 10000i64) m_fDropFrames = true;
- if(q.Late <= 0) m_fDropFrames = false;
+ if(q.Late > 500*10000i64) m_fDropFrames = true;
+ if(q.Late <= 0) m_fDropFrames = false;
// TRACE(_T("CRealVideoDecoder::AlterQuality: Type=%d, Proportion=%d, Late=%I64d, TimeStamp=%I64d\n"), q.Type, q.Proportion, q.Late, q.TimeStamp);
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
/////////////////////////
@@ -1977,543 +1876,518 @@ HRESULT CRealVideoDecoder::AlterQuality(Quality q)
//
CRealAudioDecoder::CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CRealAudioDecoder"), lpunk, __uuidof(this))
- , m_hDrvDll(NULL)
- , m_dwCookie(0)
+ : CTransformFilter(NAME("CRealAudioDecoder"), lpunk, __uuidof(this))
+ , m_hDrvDll(NULL)
+ , m_dwCookie(0)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CRealAudioDecoder::~CRealAudioDecoder()
{
// FreeRA();
- if(m_hDrvDll) FreeLibrary(m_hDrvDll);
+ if(m_hDrvDll) FreeLibrary(m_hDrvDll);
}
HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
{
- FreeRA();
-
- HRESULT hr;
-
- if(RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
- || RAOpenCodec && FAILED(hr = RAOpenCodec(&m_dwCookie)))
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->Format();
-
- // someone might be doing cbSize = sizeof(WAVEFORMATEX), chances of
- // cbSize being really sizeof(WAVEFORMATEX) is less than this,
- // especially with our rm splitter ;)
- DWORD cbSize = pwfe->cbSize;
- if(cbSize == sizeof(WAVEFORMATEX))
- {
- ASSERT(0);
- cbSize = 0;
- }
-
- WORD wBitsPerSample = pwfe->wBitsPerSample;
- if(!wBitsPerSample) wBitsPerSample = 16;
-
-#pragma pack(push, 1)
- struct
- {
- DWORD freq;
- WORD bpsample, channels, quality;
- DWORD bpframe, packetsize, extralen;
- void* extra;
- } initdata =
- {
- pwfe->nSamplesPerSec, wBitsPerSample, pwfe->nChannels, 100,
- 0, 0, 0, NULL
- };
-#pragma pack(pop)
-
- CAutoVectorPtr<BYTE> pBuff;
-
- if(pmt->subtype == MEDIASUBTYPE_AAC)
- {
- pBuff.Allocate(cbSize + 1);
- pBuff[0] = 0x02;
- memcpy(pBuff + 1, pwfe + 1, cbSize);
- initdata.extralen = cbSize + 1;
- initdata.extra = pBuff;
- }
- else
- {
- if(pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) // must have type_specific_data appended
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- BYTE* fmt = pmt->Format() + sizeof(WAVEFORMATEX) + cbSize;
-
- for(int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len - 4; i++, fmt++)
- {
- if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a')
- break;
- }
-
- m_rai = *(rainfo*)fmt;
- m_rai.bswap();
-
- BYTE* p;
-
- if(m_rai.version2 == 4)
- {
- p = (BYTE*)((rainfo4*)fmt + 1);
- int len = *p++;
- p += len;
- len = *p++;
- p += len;
- ASSERT(len == 4);
- }
- else if(m_rai.version2 == 5)
- {
- p = (BYTE*)((rainfo5*)fmt + 1);
- }
- else
- {
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- p += 3;
- if(m_rai.version2 == 5) p++;
-
- initdata.bpframe = m_rai.sub_packet_size;
- initdata.packetsize = m_rai.coded_frame_size;
- initdata.extralen = min((pmt->Format() + pmt->FormatLength()) - (p + 4), *(DWORD*)p);
- initdata.extra = p + 4;
- }
-
- if(FAILED(hr = RAInitDecoder(m_dwCookie, &initdata)))
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(RASetPwd)
- RASetPwd(m_dwCookie, "Ardubancel Quazanga");
-
- if(RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor)))
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- return S_OK;
+ FreeRA();
+
+ HRESULT hr;
+
+ if(RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
+ || RAOpenCodec && FAILED(hr = RAOpenCodec(&m_dwCookie)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->Format();
+
+ // someone might be doing cbSize = sizeof(WAVEFORMATEX), chances of
+ // cbSize being really sizeof(WAVEFORMATEX) is less than this,
+ // especially with our rm splitter ;)
+ DWORD cbSize = pwfe->cbSize;
+ if(cbSize == sizeof(WAVEFORMATEX)) {ASSERT(0); cbSize = 0;}
+
+ WORD wBitsPerSample = pwfe->wBitsPerSample;
+ if(!wBitsPerSample) wBitsPerSample = 16;
+
+ #pragma pack(push, 1)
+ struct {DWORD freq; WORD bpsample, channels, quality; DWORD bpframe, packetsize, extralen; void* extra;} initdata =
+ {pwfe->nSamplesPerSec, wBitsPerSample, pwfe->nChannels, 100,
+ 0, 0, 0, NULL};
+ #pragma pack(pop)
+
+ CAutoVectorPtr<BYTE> pBuff;
+
+ if(pmt->subtype == MEDIASUBTYPE_AAC)
+ {
+ pBuff.Allocate(cbSize+1);
+ pBuff[0] = 0x02;
+ memcpy(pBuff+1, pwfe+1, cbSize);
+ initdata.extralen = cbSize+1;
+ initdata.extra = pBuff;
+ }
+ else
+ {
+ if(pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) // must have type_specific_data appended
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ BYTE* fmt = pmt->Format() + sizeof(WAVEFORMATEX) + cbSize;
+
+ for(int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len-4; i++, fmt++)
+ {
+ if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a')
+ break;
+ }
+
+ m_rai = *(rainfo*)fmt;
+ m_rai.bswap();
+
+ BYTE* p;
+
+ if(m_rai.version2 == 4)
+ {
+ p = (BYTE*)((rainfo4*)fmt+1);
+ int len = *p++; p += len; len = *p++; p += len;
+ ASSERT(len == 4);
+ }
+ else if(m_rai.version2 == 5)
+ {
+ p = (BYTE*)((rainfo5*)fmt+1);
+ }
+ else
+ {
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ p += 3;
+ if(m_rai.version2 == 5) p++;
+
+ initdata.bpframe = m_rai.sub_packet_size;
+ initdata.packetsize = m_rai.coded_frame_size;
+ initdata.extralen = min((pmt->Format() + pmt->FormatLength()) - (p + 4), *(DWORD*)p);
+ initdata.extra = p + 4;
+ }
+
+ if(FAILED(hr = RAInitDecoder(m_dwCookie, &initdata)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(RASetPwd)
+ RASetPwd(m_dwCookie, "Ardubancel Quazanga");
+
+ if(RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ return S_OK;
}
void CRealAudioDecoder::FreeRA()
{
- if(m_dwCookie)
- {
- RAFreeDecoder(m_dwCookie);
- RACloseCodec(m_dwCookie);
- m_dwCookie = 0;
- }
+ if(m_dwCookie)
+ {
+ RAFreeDecoder(m_dwCookie);
+ RACloseCodec(m_dwCookie);
+ m_dwCookie = 0;
+ }
}
HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- HRESULT hr;
+ HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
if(pProps->dwStreamId != AM_STREAM_MEDIA)
- return m_pOutput->Deliver(pIn);
-
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
- BYTE* pDataInOrg = pDataIn;
-
- long len = pIn->GetActualDataLength();
- if(len <= 0) return S_OK;
-
- REFERENCE_TIME rtStart, rtStop;
- pIn->GetTime(&rtStart, &rtStop);
- /*
- if(pIn->IsPreroll() == S_OK || rtStart < 0)
- return S_OK;
- */
- //
-
- if(S_OK == pIn->IsSyncPoint())
- {
- m_bufflen = 0;
- m_rtBuffStart = rtStart;
- m_fBuffDiscontinuity = pIn->IsDiscontinuity() == S_OK;
- }
-
- BYTE* src = NULL;
- BYTE* dst = NULL;
-
- int w = m_rai.coded_frame_size;
- int h = m_rai.sub_packet_h;
- int sps = m_rai.sub_packet_size;
-
- if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
- || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RACP
- || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_AAC)
- {
- src = pDataIn;
- dst = pDataIn + len;
- w = len;
- }
- else
- {
- memcpy(&m_buff[m_bufflen], pDataIn, len);
- m_bufflen += len;
-
- len = w * h;
-
- if(m_bufflen >= len)
- {
- ASSERT(m_bufflen == len);
-
- src = m_buff;
- dst = m_buff + len;
-
- if(sps > 0
- && (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_COOK
- || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_ATRC))
- {
- for(int y = 0; y < h; y++)
- {
- for(int x = 0, w2 = w / sps; x < w2; x++)
- {
- // TRACE(_T("--- %d, %d\n"), (h*x+((h+1)/2)*(y&1)+(y>>1)), sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
- memcpy(dst + sps*(h * x + ((h + 1) / 2)*(y & 1) + (y >> 1)), src, sps);
- src += sps;
- }
- }
-
- src = m_buff + len;
- dst = m_buff + len * 2;
- }
- else if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR)
- {
- // http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-August/010569.html
-
- static BYTE 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}
- };
-
- int bs = h * w * 2 / 96; // nibbles per subpacket
- for(int n = 0; n < 38; n++)
- {
- int i = bs * sipr_swaps[n][0];
- int o = bs * sipr_swaps[n][1];
- // swap nibbles of block 'i' with 'o' TODO: optimize
- for(int j = 0; j < bs; j++)
- {
- int x = (i & 1) ? (src[(i>>1)] >> 4) : (src[(i>>1)] & 15);
- int y = (o & 1) ? (src[(o>>1)] >> 4) : (src[(o>>1)] & 15);
- if(o & 1) src[(o>>1)] = (src[(o>>1)] & 0x0F) | (x << 4);
- else src[(o>>1)] = (src[(o>>1)] & 0xF0) | x;
- if(i & 1) src[(i>>1)] = (src[(i>>1)] & 0x0F) | (y << 4);
- else src[(i>>1)] = (src[(i>>1)] & 0xF0) | y;
- ++i;
- ++o;
- }
- }
- }
+ return m_pOutput->Deliver(pIn);
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+ BYTE* pDataInOrg = pDataIn;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK;
- m_bufflen = 0;
- }
- }
-
- rtStart = m_rtBuffStart;
-
- for(; src < dst; src += w)
- {
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
- || FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- m_pOutput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
-
- hr = RADecode(m_dwCookie, src, w, pDataOut, &len, -1);
-
- if(FAILED(hr))
- {
- TRACE(_T("RA returned an error code!!!\n"));
- continue;
+ REFERENCE_TIME rtStart, rtStop;
+ pIn->GetTime(&rtStart, &rtStop);
+/*
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+*/
+ //
+
+ if(S_OK == pIn->IsSyncPoint())
+ {
+ m_bufflen = 0;
+ m_rtBuffStart = rtStart;
+ m_fBuffDiscontinuity = pIn->IsDiscontinuity() == S_OK;
+ }
+
+ BYTE* src = NULL;
+ BYTE* dst = NULL;
+
+ int w = m_rai.coded_frame_size;
+ int h = m_rai.sub_packet_h;
+ int sps = m_rai.sub_packet_size;
+
+ if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
+ || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RACP
+ || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_AAC)
+ {
+ src = pDataIn;
+ dst = pDataIn + len;
+ w = len;
+ }
+ else
+ {
+ memcpy(&m_buff[m_bufflen], pDataIn, len);
+ m_bufflen += len;
+
+ len = w*h;
+
+ if(m_bufflen >= len)
+ {
+ ASSERT(m_bufflen == len);
+
+ src = m_buff;
+ dst = m_buff + len;
+
+ if(sps > 0
+ && (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_COOK
+ || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_ATRC))
+ {
+ for(int y = 0; y < h; y++)
+ {
+ for(int x = 0, w2 = w / sps; x < w2; x++)
+ {
+ // TRACE(_T("--- %d, %d\n"), (h*x+((h+1)/2)*(y&1)+(y>>1)), sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
+ memcpy(dst + sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), src, sps);
+ src += sps;
+ }
+ }
+
+ src = m_buff + len;
+ dst = m_buff + len*2;
+ }
+ else if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR)
+ {
+ // http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-August/010569.html
+
+ static BYTE 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} };
+
+ int bs=h*w*2/96; // nibbles per subpacket
+ for(int n=0;n<38;n++){
+ int i=bs*sipr_swaps[n][0];
+ int o=bs*sipr_swaps[n][1];
+ // swap nibbles of block 'i' with 'o' TODO: optimize
+ for(int j=0;j<bs;j++){
+ int x=(i&1) ? (src[(i>>1)]>>4) : (src[(i>>1)]&15);
+ int y=(o&1) ? (src[(o>>1)]>>4) : (src[(o>>1)]&15);
+ if(o&1) src[(o>>1)]=(src[(o>>1)]&0x0F)|(x<<4);
+ else src[(o>>1)]=(src[(o>>1)]&0xF0)|x;
+ if(i&1) src[(i>>1)]=(src[(i>>1)]&0x0F)|(y<<4);
+ else src[(i>>1)]=(src[(i>>1)]&0xF0)|y;
+ ++i;++o;
+ }
+ }
+ }
+
+ m_bufflen = 0;
+ }
+ }
+
+ rtStart = m_rtBuffStart;
+
+ for(; src < dst; src += w)
+ {
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ hr = RADecode(m_dwCookie, src, w, pDataOut, &len, -1);
+
+ if(FAILED(hr))
+ {
+ TRACE(_T("RA returned an error code!!!\n"));
+ continue;
// return hr;
- }
+ }
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
- rtStop = rtStart + 1000i64 * len / pwfe->nAvgBytesPerSec * 10000;
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
+ rtStop = rtStart + 1000i64*len/pwfe->nAvgBytesPerSec*10000;
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
- pOut->SetDiscontinuity(m_fBuffDiscontinuity);
- m_fBuffDiscontinuity = false;
- pOut->SetSyncPoint(TRUE);
+ pOut->SetDiscontinuity(m_fBuffDiscontinuity); m_fBuffDiscontinuity = false;
+ pOut->SetSyncPoint(TRUE);
- pOut->SetActualDataLength(len);
+ pOut->SetActualDataLength(len);
- DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
- rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
+DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
+rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
- if(rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut)))
- return hr;
+ if(rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut)))
+ return hr;
- rtStart = rtStop;
- }
+ rtStart = rtStop;
+ }
- m_rtBuffStart = rtStart;
+ m_rtBuffStart = rtStart;
- return S_OK;
+ return S_OK;
}
HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->majortype != MEDIATYPE_Audio
- || mtIn->subtype != MEDIASUBTYPE_14_4
- && mtIn->subtype != MEDIASUBTYPE_28_8
- && mtIn->subtype != MEDIASUBTYPE_ATRC
- && mtIn->subtype != MEDIASUBTYPE_COOK
- && mtIn->subtype != MEDIASUBTYPE_DNET
- && mtIn->subtype != MEDIASUBTYPE_SIPR
- && mtIn->subtype != MEDIASUBTYPE_RAAC
- && mtIn->subtype != MEDIASUBTYPE_RACP
- && mtIn->subtype != MEDIASUBTYPE_AAC)
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(!m_pInput->IsConnected())
- {
- if(m_hDrvDll)
- {
- FreeLibrary(m_hDrvDll);
- m_hDrvDll = NULL;
- }
-
- CAtlList<CString> paths;
- CString olddll, newdll, oldpath, newpath;
-
- TCHAR fourcc[5] =
- {
- (TCHAR)((mtIn->subtype.Data1 >> 0) & 0xff),
- (TCHAR)((mtIn->subtype.Data1 >> 8) & 0xff),
- (TCHAR)((mtIn->subtype.Data1 >> 16) & 0xff),
- (TCHAR)((mtIn->subtype.Data1 >> 24) & 0xff),
- 0
- };
-
- if(!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc))
- _tcscpy(fourcc, _T("RAAC"));
-
- olddll.Format(_T("%s3260.dll"), fourcc);
- newdll.Format(_T("%s.dll"), fourcc);
-
- CRegKey key;
- TCHAR buff[_MAX_PATH];
- ULONG len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
- && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
- {
- oldpath = buff;
- TCHAR c = oldpath[oldpath.GetLength()-1];
- if(c != '\\' && c != '/') oldpath += '\\';
- key.Close();
- }
- len = sizeof(buff);
- if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
- && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
- {
- newpath = buff;
- TCHAR c = newpath[newpath.GetLength()-1];
- if(c != '\\' && c != '/') newpath += '\\';
- key.Close();
- }
-
- if(!newpath.IsEmpty()) paths.AddTail(newpath + newdll);
- if(!oldpath.IsEmpty()) paths.AddTail(oldpath + newdll);
- paths.AddTail(newdll); // default dll paths
- if(!newpath.IsEmpty()) paths.AddTail(newpath + olddll);
- if(!oldpath.IsEmpty()) paths.AddTail(oldpath + olddll);
- paths.AddTail(olddll); // default dll paths
-
- POSITION pos = paths.GetHeadPosition();
- while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
-
- if(m_hDrvDll)
- {
- RACloseCodec = (PCloseCodec)GetProcAddress(m_hDrvDll, "RACloseCodec");
- RADecode = (PDecode)GetProcAddress(m_hDrvDll, "RADecode");
- RAFlush = (PFlush)GetProcAddress(m_hDrvDll, "RAFlush");
- RAFreeDecoder = (PFreeDecoder)GetProcAddress(m_hDrvDll, "RAFreeDecoder");
- RAGetFlavorProperty = (PGetFlavorProperty)GetProcAddress(m_hDrvDll, "RAGetFlavorProperty");
- RAInitDecoder = (PInitDecoder)GetProcAddress(m_hDrvDll, "RAInitDecoder");
- RAOpenCodec = (POpenCodec)GetProcAddress(m_hDrvDll, "RAOpenCodec");
- RAOpenCodec2 = (POpenCodec2)GetProcAddress(m_hDrvDll, "RAOpenCodec2");
- RASetFlavor = (PSetFlavor)GetProcAddress(m_hDrvDll, "RASetFlavor");
- RASetDLLAccessPath = (PSetDLLAccessPath)GetProcAddress(m_hDrvDll, "RASetDLLAccessPath");
- RASetPwd = (PSetPwd)GetProcAddress(m_hDrvDll, "RASetPwd");
- }
-
- if(!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
- || !RAFreeDecoder || !RAGetFlavorProperty || !RAInitDecoder
- || !(RAOpenCodec || RAOpenCodec2) /*|| !RASetFlavor*/)
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(m_hDrvDll)
- {
- char buff[_MAX_PATH];
- GetModuleFileNameA(m_hDrvDll, buff, MAX_PATH);
- CPathA p(buff);
- p.RemoveFileSpec();
- p.AddBackslash();
- m_dllpath = p.m_strPath;
- if(RASetDLLAccessPath)
- RASetDLLAccessPath("DT_Codecs=" + m_dllpath);
- }
-
- if(FAILED(InitRA(mtIn)))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- return S_OK;
+ if(mtIn->majortype != MEDIATYPE_Audio
+ || mtIn->subtype != MEDIASUBTYPE_14_4
+ && mtIn->subtype != MEDIASUBTYPE_28_8
+ && mtIn->subtype != MEDIASUBTYPE_ATRC
+ && mtIn->subtype != MEDIASUBTYPE_COOK
+ && mtIn->subtype != MEDIASUBTYPE_DNET
+ && mtIn->subtype != MEDIASUBTYPE_SIPR
+ && mtIn->subtype != MEDIASUBTYPE_RAAC
+ && mtIn->subtype != MEDIASUBTYPE_RACP
+ && mtIn->subtype != MEDIASUBTYPE_AAC)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(!m_pInput->IsConnected())
+ {
+ if(m_hDrvDll) {FreeLibrary(m_hDrvDll); m_hDrvDll = NULL;}
+
+ CAtlList<CString> paths;
+ CString olddll, newdll, oldpath, newpath;
+
+ TCHAR fourcc[5] =
+ {
+ (TCHAR)((mtIn->subtype.Data1>>0)&0xff),
+ (TCHAR)((mtIn->subtype.Data1>>8)&0xff),
+ (TCHAR)((mtIn->subtype.Data1>>16)&0xff),
+ (TCHAR)((mtIn->subtype.Data1>>24)&0xff),
+ 0
+ };
+
+ if(!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc))
+ _tcscpy(fourcc, _T("RAAC"));
+
+ olddll.Format(_T("%s3260.dll"), fourcc);
+ newdll.Format(_T("%s.dll"), fourcc);
+
+ CRegKey key;
+ TCHAR buff[_MAX_PATH];
+ ULONG len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ oldpath = buff;
+ TCHAR c = oldpath[oldpath.GetLength()-1];
+ if(c != '\\' && c != '/') oldpath += '\\';
+ key.Close();
+ }
+ len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ newpath = buff;
+ TCHAR c = newpath[newpath.GetLength()-1];
+ if(c != '\\' && c != '/') newpath += '\\';
+ key.Close();
+ }
+
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + newdll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + newdll);
+ paths.AddTail(newdll); // default dll paths
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + olddll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + olddll);
+ paths.AddTail(olddll); // default dll paths
+
+ POSITION pos = paths.GetHeadPosition();
+ while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
+
+ if(m_hDrvDll)
+ {
+ RACloseCodec = (PCloseCodec)GetProcAddress(m_hDrvDll, "RACloseCodec");
+ RADecode = (PDecode)GetProcAddress(m_hDrvDll, "RADecode");
+ RAFlush = (PFlush)GetProcAddress(m_hDrvDll, "RAFlush");
+ RAFreeDecoder = (PFreeDecoder)GetProcAddress(m_hDrvDll, "RAFreeDecoder");
+ RAGetFlavorProperty = (PGetFlavorProperty)GetProcAddress(m_hDrvDll, "RAGetFlavorProperty");
+ RAInitDecoder = (PInitDecoder)GetProcAddress(m_hDrvDll, "RAInitDecoder");
+ RAOpenCodec = (POpenCodec)GetProcAddress(m_hDrvDll, "RAOpenCodec");
+ RAOpenCodec2 = (POpenCodec2)GetProcAddress(m_hDrvDll, "RAOpenCodec2");
+ RASetFlavor = (PSetFlavor)GetProcAddress(m_hDrvDll, "RASetFlavor");
+ RASetDLLAccessPath = (PSetDLLAccessPath)GetProcAddress(m_hDrvDll, "RASetDLLAccessPath");
+ RASetPwd = (PSetPwd)GetProcAddress(m_hDrvDll, "RASetPwd");
+ }
+
+ if(!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
+ || !RAFreeDecoder || !RAGetFlavorProperty || !RAInitDecoder
+ || !(RAOpenCodec || RAOpenCodec2) /*|| !RASetFlavor*/)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(m_hDrvDll)
+ {
+ char buff[_MAX_PATH];
+ GetModuleFileNameA(m_hDrvDll, buff, MAX_PATH);
+ CPathA p(buff);
+ p.RemoveFileSpec();
+ p.AddBackslash();
+ m_dllpath = p.m_strPath;
+ if(RASetDLLAccessPath)
+ RASetDLLAccessPath("DT_Codecs=" + m_dllpath);
+ }
+
+ if(FAILED(InitRA(mtIn)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
}
HRESULT CRealAudioDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return mtIn->majortype == MEDIATYPE_Audio && (mtIn->subtype == MEDIASUBTYPE_14_4
- || mtIn->subtype == MEDIASUBTYPE_28_8
- || mtIn->subtype == MEDIASUBTYPE_ATRC
- || mtIn->subtype == MEDIASUBTYPE_COOK
- || mtIn->subtype == MEDIASUBTYPE_DNET
- || mtIn->subtype == MEDIASUBTYPE_SIPR
- || mtIn->subtype == MEDIASUBTYPE_RAAC
- || mtIn->subtype == MEDIASUBTYPE_RACP
- || mtIn->subtype == MEDIASUBTYPE_AAC)
- && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return mtIn->majortype == MEDIATYPE_Audio && (mtIn->subtype == MEDIASUBTYPE_14_4
+ || mtIn->subtype == MEDIASUBTYPE_28_8
+ || mtIn->subtype == MEDIASUBTYPE_ATRC
+ || mtIn->subtype == MEDIASUBTYPE_COOK
+ || mtIn->subtype == MEDIASUBTYPE_DNET
+ || mtIn->subtype == MEDIASUBTYPE_SIPR
+ || mtIn->subtype == MEDIASUBTYPE_RAAC
+ || mtIn->subtype == MEDIASUBTYPE_RACP
+ || mtIn->subtype == MEDIASUBTYPE_AAC)
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- CComPtr<IMemAllocator> pAllocatorIn;
- m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
- WORD wBitsPerSample = pwfe->wBitsPerSample;
- if(!wBitsPerSample) wBitsPerSample = 16;
+ WORD wBitsPerSample = pwfe->wBitsPerSample;
+ if(!wBitsPerSample) wBitsPerSample = 16;
- // ok, maybe this is too much...
- pProperties->cBuffers = 8;
- pProperties->cbBuffer = pwfe->nChannels * pwfe->nSamplesPerSec * wBitsPerSample >> 3; // nAvgBytesPerSec;
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ // ok, maybe this is too much...
+ pProperties->cBuffers = 8;
+ pProperties->cbBuffer = pwfe->nChannels*pwfe->nSamplesPerSec*wBitsPerSample>>3; // nAvgBytesPerSec;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- *pmt = m_pInput->CurrentMediaType();
- pmt->subtype = MEDIASUBTYPE_PCM;
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
-
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) return VFW_S_NO_MORE_ITEMS;
-
- if(!pwfe->wBitsPerSample) pwfe->wBitsPerSample = 16;
-
- pwfe->cbSize = 0;
- pwfe->wFormatTag = WAVE_FORMAT_PCM;
- pwfe->nBlockAlign = pwfe->nChannels * pwfe->wBitsPerSample >> 3;
- pwfe->nAvgBytesPerSec = pwfe->nSamplesPerSec * pwfe->nBlockAlign;
-
- if(iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6)
- {
- static DWORD chmask[] =
- {
- KSAUDIO_SPEAKER_DIRECTOUT,
- KSAUDIO_SPEAKER_MONO,
- KSAUDIO_SPEAKER_STEREO,
- KSAUDIO_SPEAKER_STEREO | SPEAKER_FRONT_CENTER,
- KSAUDIO_SPEAKER_QUAD,
- KSAUDIO_SPEAKER_QUAD | SPEAKER_FRONT_CENTER,
- KSAUDIO_SPEAKER_5POINT1
- };
-
- WAVEFORMATEXTENSIBLE* pwfex = (WAVEFORMATEXTENSIBLE*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
- pwfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
- pwfex->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- pwfex->dwChannelMask = chmask[pwfex->Format.nChannels];
- pwfex->Samples.wValidBitsPerSample = pwfex->Format.wBitsPerSample;
- pwfex->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
- }
-
- return S_OK;
+ *pmt = m_pInput->CurrentMediaType();
+ pmt->subtype = MEDIASUBTYPE_PCM;
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) return VFW_S_NO_MORE_ITEMS;
+
+ if(!pwfe->wBitsPerSample) pwfe->wBitsPerSample = 16;
+
+ pwfe->cbSize = 0;
+ pwfe->wFormatTag = WAVE_FORMAT_PCM;
+ pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
+ pwfe->nAvgBytesPerSec = pwfe->nSamplesPerSec*pwfe->nBlockAlign;
+
+ if(iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6)
+ {
+ static DWORD chmask[] =
+ {
+ KSAUDIO_SPEAKER_DIRECTOUT,
+ KSAUDIO_SPEAKER_MONO,
+ KSAUDIO_SPEAKER_STEREO,
+ KSAUDIO_SPEAKER_STEREO|SPEAKER_FRONT_CENTER,
+ KSAUDIO_SPEAKER_QUAD,
+ KSAUDIO_SPEAKER_QUAD|SPEAKER_FRONT_CENTER,
+ KSAUDIO_SPEAKER_5POINT1
+ };
+
+ WAVEFORMATEXTENSIBLE* pwfex = (WAVEFORMATEXTENSIBLE*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
+ pwfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
+ pwfex->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ pwfex->dwChannelMask = chmask[pwfex->Format.nChannels];
+ pwfex->Samples.wValidBitsPerSample = pwfex->Format.wBitsPerSample;
+ pwfex->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ }
+
+ return S_OK;
}
HRESULT CRealAudioDecoder::StartStreaming()
{
- int w = m_rai.coded_frame_size;
- int h = m_rai.sub_packet_h;
- int sps = m_rai.sub_packet_size;
+ int w = m_rai.coded_frame_size;
+ int h = m_rai.sub_packet_h;
+ int sps = m_rai.sub_packet_size;
- int len = w * h;
+ int len = w*h;
- m_buff.Allocate(len * 2);
- m_bufflen = 0;
- m_rtBuffStart = 0;
+ m_buff.Allocate(len*2);
+ m_bufflen = 0;
+ m_rtBuffStart = 0;
- return __super::StartStreaming();
+ return __super::StartStreaming();
}
HRESULT CRealAudioDecoder::StopStreaming()
{
- m_buff.Free();
- m_bufflen = 0;
+ m_buff.Free();
+ m_bufflen = 0;
- return __super::StopStreaming();
+ return __super::StopStreaming();
}
HRESULT CRealAudioDecoder::EndOfStream()
{
- return __super::EndOfStream();
+ return __super::EndOfStream();
}
HRESULT CRealAudioDecoder::BeginFlush()
{
- return __super::BeginFlush();
+ return __super::BeginFlush();
}
HRESULT CRealAudioDecoder::EndFlush()
{
- return __super::EndFlush();
+ return __super::EndFlush();
}
HRESULT CRealAudioDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
- m_tStart = tStart;
- m_bufflen = 0;
- m_rtBuffStart = 0;
- return __super::NewSegment(tStart, tStop, dRate);
+ CAutoLock cAutoLock(&m_csReceive);
+ m_tStart = tStart;
+ m_bufflen = 0;
+ m_rtBuffStart = 0;
+ return __super::NewSegment(tStart, tStop, dRate);
}
diff --git a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.h b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.h
index 200c3b5fc..42b28e5da 100644
--- a/src/filters/parser/RealMediaSplitter/RealMediaSplitter.h
+++ b/src/filters/parser/RealMediaSplitter/RealMediaSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,219 +30,185 @@
namespace RMFF
{
-typedef struct
-{
- union
- {
- char id[4];
- UINT32 object_id;
- };
- UINT32 size;
- UINT16 object_version;
-} ChunkHdr;
-typedef struct
-{
- UINT32 version, nHeaders;
-} FileHdr;
-typedef struct
-{
- UINT32 maxBitRate, avgBitRate;
- UINT32 maxPacketSize, avgPacketSize, nPackets;
- UINT32 tDuration, tPreroll;
- UINT32 ptrIndex, ptrData;
- UINT16 nStreams;
- enum flags_t {PN_SAVE_ENABLED = 1, PN_PERFECT_PLAY_ENABLED = 2, PN_LIVE_BROADCAST = 4} flags;
-} Properies;
-typedef struct
-{
- UINT16 stream;
- UINT32 maxBitRate, avgBitRate;
- UINT32 maxPacketSize, avgPacketSize;
- UINT32 tStart, tPreroll, tDuration;
- CStringA name, mime;
- CAtlArray<BYTE> typeSpecData;
- UINT32 width, height;
- bool interlaced, top_field_first;
-} MediaProperies;
-typedef struct
-{
- CStringA title, author, copyright, comment;
-} ContentDesc;
-typedef struct
-{
- UINT64 pos;
- UINT32 nPackets, ptrNext;
-} DataChunk;
-typedef struct
-{
- UINT16 len, stream;
- UINT32 tStart;
- UINT8 reserved;
- enum flag_t {PN_RELIABLE_FLAG = 1, PN_KEYFRAME_FLAG = 2} flags; // UINT8
- CAtlArray<BYTE> pData;
-} MediaPacketHeader;
-typedef struct
-{
- UINT32 nIndices;
- UINT16 stream;
- UINT32 ptrNext;
-} IndexChunkHeader;
-typedef struct
-{
- UINT32 tStart, ptrFilePos, packet;
-} IndexRecord;
+ typedef struct {union {char id[4]; UINT32 object_id;}; UINT32 size; UINT16 object_version;} ChunkHdr;
+ typedef struct {UINT32 version, nHeaders;} FileHdr;
+ typedef struct
+ {
+ UINT32 maxBitRate, avgBitRate;
+ UINT32 maxPacketSize, avgPacketSize, nPackets;
+ UINT32 tDuration, tPreroll;
+ UINT32 ptrIndex, ptrData;
+ UINT16 nStreams;
+ enum flags_t {PN_SAVE_ENABLED=1, PN_PERFECT_PLAY_ENABLED=2, PN_LIVE_BROADCAST=4} flags;
+ } Properies;
+ typedef struct
+ {
+ UINT16 stream;
+ UINT32 maxBitRate, avgBitRate;
+ UINT32 maxPacketSize, avgPacketSize;
+ UINT32 tStart, tPreroll, tDuration;
+ CStringA name, mime;
+ CAtlArray<BYTE> typeSpecData;
+ UINT32 width, height;
+ bool interlaced, top_field_first;
+ } MediaProperies;
+ typedef struct {CStringA title, author, copyright, comment;} ContentDesc;
+ typedef struct {UINT64 pos; UINT32 nPackets, ptrNext;} DataChunk;
+ typedef struct
+ {
+ UINT16 len, stream;
+ UINT32 tStart;
+ UINT8 reserved;
+ enum flag_t {PN_RELIABLE_FLAG=1, PN_KEYFRAME_FLAG=2} flags; // UINT8
+ CAtlArray<BYTE> pData;
+ } MediaPacketHeader;
+ typedef struct {UINT32 nIndices; UINT16 stream; UINT32 ptrNext;} IndexChunkHeader;
+ typedef struct {UINT32 tStart, ptrFilePos, packet;} IndexRecord;
}
struct rvinfo
{
- DWORD dwSize, fcc1, fcc2;
- WORD w, h, bpp;
- DWORD unk1, fps, type1, type2;
- BYTE morewh[14];
- void bswap();
+ DWORD dwSize, fcc1, fcc2;
+ WORD w, h, bpp;
+ DWORD unk1, fps, type1, type2;
+ BYTE morewh[14];
+ void bswap();
};
struct rainfo
{
- DWORD fourcc1; // '.', 'r', 'a', 0xfd
- WORD version1; // 4 or 5
- WORD unknown1; // 00 000
- DWORD fourcc2; // .ra4 or .ra5
- DWORD unknown2; // ???
- WORD version2; // 4 or 5
- DWORD header_size; // == 0x4e
- WORD flavor; // codec flavor id
- DWORD coded_frame_size; // coded frame size
- DWORD unknown3; // big number
- DWORD unknown4; // bigger number
- DWORD unknown5; // yet another number
- WORD sub_packet_h;
- WORD frame_size;
- WORD sub_packet_size;
- WORD unknown6; // 00 00
- void bswap();
+ DWORD fourcc1; // '.', 'r', 'a', 0xfd
+ WORD version1; // 4 or 5
+ WORD unknown1; // 00 000
+ DWORD fourcc2; // .ra4 or .ra5
+ DWORD unknown2; // ???
+ WORD version2; // 4 or 5
+ DWORD header_size; // == 0x4e
+ WORD flavor; // codec flavor id
+ DWORD coded_frame_size; // coded frame size
+ DWORD unknown3; // big number
+ DWORD unknown4; // bigger number
+ DWORD unknown5; // yet another number
+ WORD sub_packet_h;
+ WORD frame_size;
+ WORD sub_packet_size;
+ WORD unknown6; // 00 00
+ void bswap();
};
struct rainfo4 : rainfo
{
- WORD sample_rate;
- WORD unknown8; // 0
- WORD sample_size;
- WORD channels;
- void bswap();
+ WORD sample_rate;
+ WORD unknown8; // 0
+ WORD sample_size;
+ WORD channels;
+ void bswap();
};
struct rainfo5 : rainfo
{
- BYTE unknown7[6]; // 0, srate, 0
- WORD sample_rate;
- WORD unknown8; // 0
- WORD sample_size;
- WORD channels;
- DWORD genr; // "genr"
- DWORD fourcc3; // fourcc
- void bswap();
+ BYTE unknown7[6]; // 0, srate, 0
+ WORD sample_rate;
+ WORD unknown8; // 0
+ WORD sample_size;
+ WORD channels;
+ DWORD genr; // "genr"
+ DWORD fourcc3; // fourcc
+ void bswap();
};
#pragma pack(pop)
class CRMFile : public CBaseSplitterFile
{
- // using CBaseSplitterFile::Read;
+ // using CBaseSplitterFile::Read;
- HRESULT Init();
- void GetDimensions();
+ HRESULT Init();
+ void GetDimensions();
public:
- CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr);
-
- template<typename T> HRESULT Read(T& var);
- HRESULT Read(RMFF::ChunkHdr& hdr);
- HRESULT Read(RMFF::MediaPacketHeader& mph, bool fFull = true);
-
- RMFF::FileHdr m_fh;
- RMFF::ContentDesc m_cd;
- RMFF::Properies m_p;
- CAutoPtrList<RMFF::MediaProperies> m_mps;
- CAutoPtrList<RMFF::DataChunk> m_dcs;
- CAutoPtrList<RMFF::IndexRecord> m_irs;
-
- typedef struct
- {
- CStringA name, data;
- } subtitle;
- CAtlList<subtitle> m_subs;
-
- int GetMasterStream();
+ CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ template<typename T> HRESULT Read(T& var);
+ HRESULT Read(RMFF::ChunkHdr& hdr);
+ HRESULT Read(RMFF::MediaPacketHeader& mph, bool fFull = true);
+
+ RMFF::FileHdr m_fh;
+ RMFF::ContentDesc m_cd;
+ RMFF::Properies m_p;
+ CAutoPtrList<RMFF::MediaProperies> m_mps;
+ CAutoPtrList<RMFF::DataChunk> m_dcs;
+ CAutoPtrList<RMFF::IndexRecord> m_irs;
+
+ typedef struct {CStringA name, data;} subtitle;
+ CAtlList<subtitle> m_subs;
+
+ int GetMasterStream();
};
class CRealMediaSplitterOutputPin : public CBaseSplitterOutputPin
{
private:
- typedef struct
- {
- CAtlArray<BYTE> data;
- DWORD offset;
- } segment;
-
- class CSegments : public CAutoPtrList<segment>, public CCritSec
- {
- public:
- REFERENCE_TIME rtStart;
- bool fDiscontinuity, fSyncPoint, fMerged;
- void Clear()
- {
- CAutoLock cAutoLock(this);
- rtStart = 0;
- fDiscontinuity = fSyncPoint = fMerged = false;
- RemoveAll();
- }
- } m_segments;
-
- CCritSec m_csQueue;
-
- HRESULT DeliverSegments();
+ typedef struct {CAtlArray<BYTE> data; DWORD offset;} segment;
+
+ class CSegments : public CAutoPtrList<segment>, public CCritSec
+ {
+ public:
+ REFERENCE_TIME rtStart;
+ bool fDiscontinuity, fSyncPoint, fMerged;
+ void Clear()
+ {
+ CAutoLock cAutoLock(this);
+ rtStart = 0;
+ fDiscontinuity = fSyncPoint = fMerged = false;
+ RemoveAll();
+ }
+ } m_segments;
+
+ CCritSec m_csQueue;
+
+ HRESULT DeliverSegments();
protected:
- HRESULT DeliverPacket(CAutoPtr<Packet> p);
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
public:
- CRealMediaSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CRealMediaSplitterOutputPin();
+ CRealMediaSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CRealMediaSplitterOutputPin();
- HRESULT DeliverEndFlush();
+ HRESULT DeliverEndFlush();
};
[uuid("E21BE468-5C18-43EB-B0CC-DB93A847D769")]
class CRealMediaSplitterFilter : public CBaseSplitterFilter
{
protected:
- CAutoPtr<CRMFile> m_pFile;
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ CAutoPtr<CRMFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
- POSITION m_seekpos;
- UINT32 m_seekpacket;
- UINT64 m_seekfilepos;
+ POSITION m_seekpos;
+ UINT32 m_seekpacket;
+ UINT64 m_seekfilepos;
public:
- CRealMediaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CRealMediaSplitterFilter();
+ CRealMediaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CRealMediaSplitterFilter();
- // IKeyFrameInfo
+ // IKeyFrameInfo
- STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
- STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
};
[uuid("765035B3-5944-4A94-806B-20EE3415F26F")]
class CRealMediaSourceFilter : public CRealMediaSplitterFilter
{
public:
- CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
////////////
@@ -250,106 +216,106 @@ public:
[uuid("238D0F23-5DC9-45A6-9BE2-666160C324DD")]
class CRealVideoDecoder : public CBaseVideoFilter
{
- typedef HRESULT(WINAPI *PRVCustomMessage)(void*, DWORD);
- typedef HRESULT(WINAPI *PRVFree)(DWORD);
- typedef HRESULT(WINAPI *PRVHiveMessage)(void*, DWORD);
- typedef HRESULT(WINAPI *PRVInit)(void*, DWORD* dwCookie);
- typedef HRESULT(WINAPI *PRVTransform)(BYTE*, BYTE*, void*, void*, DWORD);
+ typedef HRESULT (WINAPI *PRVCustomMessage)(void*, DWORD);
+ typedef HRESULT (WINAPI *PRVFree)(DWORD);
+ typedef HRESULT (WINAPI *PRVHiveMessage)(void*, DWORD);
+ typedef HRESULT (WINAPI *PRVInit)(void*, DWORD* dwCookie);
+ typedef HRESULT (WINAPI *PRVTransform)(BYTE*, BYTE*, void*, void*, DWORD);
- PRVCustomMessage RVCustomMessage;
- PRVFree RVFree;
- PRVHiveMessage RVHiveMessage;
- PRVInit RVInit;
- PRVTransform RVTransform;
+ PRVCustomMessage RVCustomMessage;
+ PRVFree RVFree;
+ PRVHiveMessage RVHiveMessage;
+ PRVInit RVInit;
+ PRVTransform RVTransform;
- HMODULE m_hDrvDll;
- DWORD m_dwCookie;
- int m_lastBuffSizeDim;
+ HMODULE m_hDrvDll;
+ DWORD m_dwCookie;
+ int m_lastBuffSizeDim;
- HRESULT InitRV(const CMediaType* pmt);
- void FreeRV();
+ HRESULT InitRV(const CMediaType* pmt);
+ void FreeRV();
- REFERENCE_TIME m_tStart;
+ REFERENCE_TIME m_tStart;
- void Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
- void ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
- void ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
- void ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DWORD wo, DWORD dpo);
+ void Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
+ void ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
+ void ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
+ void ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DWORD wo, DWORD dpo);
- CAutoVectorPtr<BYTE> m_pI420, m_pI420Tmp;
+ CAutoVectorPtr<BYTE> m_pI420, m_pI420Tmp;
public:
- CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CRealVideoDecoder();
+ CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRealVideoDecoder();
- HRESULT Transform(IMediaSample* pIn);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT Transform(IMediaSample* pIn);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
- HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- DWORD m_timestamp;
- bool m_fDropFrames;
- HRESULT AlterQuality(Quality q);
+ DWORD m_timestamp;
+ bool m_fDropFrames;
+ HRESULT AlterQuality(Quality q);
};
[uuid("941A4793-A705-4312-8DFC-C11CA05F397E")]
class CRealAudioDecoder : public CTransformFilter
{
- typedef HRESULT(WINAPI *PCloseCodec)(DWORD);
- typedef HRESULT(WINAPI *PDecode)(DWORD, BYTE*, long, BYTE*, long*, long);
- typedef HRESULT(WINAPI *PFlush)(DWORD, DWORD, DWORD);
- typedef HRESULT(WINAPI *PFreeDecoder)(DWORD);
- typedef void*(WINAPI *PGetFlavorProperty)(void*, DWORD, DWORD, int*);
- typedef HRESULT(WINAPI *PInitDecoder)(DWORD, void*);
- typedef HRESULT(WINAPI *POpenCodec)(void*);
- typedef HRESULT(WINAPI *POpenCodec2)(void*, const char*);
- typedef HRESULT(WINAPI *PSetFlavor)(DWORD, WORD);
- typedef void (WINAPI *PSetDLLAccessPath)(const char*);
- typedef void (WINAPI *PSetPwd)(DWORD, const char*);
-
- PCloseCodec RACloseCodec;
- PDecode RADecode;
- PFlush RAFlush;
- PFreeDecoder RAFreeDecoder;
- PGetFlavorProperty RAGetFlavorProperty;
- PInitDecoder RAInitDecoder;
- POpenCodec RAOpenCodec;
- POpenCodec2 RAOpenCodec2;
- PSetFlavor RASetFlavor;
- PSetDLLAccessPath RASetDLLAccessPath;
- PSetPwd RASetPwd;
-
- CStringA m_dllpath;
- HMODULE m_hDrvDll;
- DWORD m_dwCookie;
-
- HRESULT InitRA(const CMediaType* pmt);
- void FreeRA();
-
- REFERENCE_TIME m_tStart;
-
- rainfo m_rai;
- CAutoVectorPtr<BYTE> m_buff;
- int m_bufflen;
- REFERENCE_TIME m_rtBuffStart;
- bool m_fBuffDiscontinuity;
+ typedef HRESULT (WINAPI *PCloseCodec)(DWORD);
+ typedef HRESULT (WINAPI *PDecode)(DWORD,BYTE*,long,BYTE*,long*,long);
+ typedef HRESULT (WINAPI *PFlush)(DWORD,DWORD,DWORD);
+ typedef HRESULT (WINAPI *PFreeDecoder)(DWORD);
+ typedef void* (WINAPI *PGetFlavorProperty)(void*,DWORD,DWORD,int*);
+ typedef HRESULT (WINAPI *PInitDecoder)(DWORD, void*);
+ typedef HRESULT (WINAPI *POpenCodec)(void*);
+ typedef HRESULT (WINAPI *POpenCodec2)(void*, const char*);
+ typedef HRESULT (WINAPI *PSetFlavor)(DWORD, WORD);
+ typedef void (WINAPI *PSetDLLAccessPath)(const char*);
+ typedef void (WINAPI *PSetPwd)(DWORD, const char*);
+
+ PCloseCodec RACloseCodec;
+ PDecode RADecode;
+ PFlush RAFlush;
+ PFreeDecoder RAFreeDecoder;
+ PGetFlavorProperty RAGetFlavorProperty;
+ PInitDecoder RAInitDecoder;
+ POpenCodec RAOpenCodec;
+ POpenCodec2 RAOpenCodec2;
+ PSetFlavor RASetFlavor;
+ PSetDLLAccessPath RASetDLLAccessPath;
+ PSetPwd RASetPwd;
+
+ CStringA m_dllpath;
+ HMODULE m_hDrvDll;
+ DWORD m_dwCookie;
+
+ HRESULT InitRA(const CMediaType* pmt);
+ void FreeRA();
+
+ REFERENCE_TIME m_tStart;
+
+ rainfo m_rai;
+ CAutoVectorPtr<BYTE> m_buff;
+ int m_bufflen;
+ REFERENCE_TIME m_rtBuffStart;
+ bool m_fBuffDiscontinuity;
public:
- CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CRealAudioDecoder();
+ CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRealAudioDecoder();
- HRESULT Receive(IMediaSample* pIn);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT Receive(IMediaSample* pIn);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
HRESULT EndOfStream();
HRESULT BeginFlush();
diff --git a/src/filters/parser/RealMediaSplitter/resource.h b/src/filters/parser/RealMediaSplitter/resource.h
index 713badf0e..68f7b566d 100644
--- a/src/filters/parser/RealMediaSplitter/resource.h
+++ b/src/filters/parser/RealMediaSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by RealMediaSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/RealMediaSplitter/stdafx.cpp b/src/filters/parser/RealMediaSplitter/stdafx.cpp
index 54ea1d445..8a7154bc7 100644
--- a/src/filters/parser/RealMediaSplitter/stdafx.cpp
+++ b/src/filters/parser/RealMediaSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/RealMediaSplitter/stdafx.h b/src/filters/parser/RealMediaSplitter/stdafx.h
index 6fe7f24f9..f7ba733d1 100644
--- a/src/filters/parser/RealMediaSplitter/stdafx.h
+++ b/src/filters/parser/RealMediaSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/RoQSplitter/RoQSplitter.cpp b/src/filters/parser/RoQSplitter/RoQSplitter.cpp
index 2c6fcafca..78545aef3 100644
--- a/src/filters/parser/RoQSplitter/RoQSplitter.cpp
+++ b/src/filters/parser/RoQSplitter/RoQSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,8 +28,8 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_RoQ},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_RoQ},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -40,12 +40,12 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RoQV},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RoQV},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut2[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins2[] =
@@ -56,12 +56,12 @@ const AMOVIESETUP_PIN sudpPins2[] =
const AMOVIESETUP_MEDIATYPE sudPinTypesIn3[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_RoQA},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_RoQA},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut3[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
};
const AMOVIESETUP_PIN sudpPins3[] =
@@ -72,16 +72,16 @@ const AMOVIESETUP_PIN sudpPins3[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CRoQSplitterFilter), L"MPC - RoQ Splitter", MERIT_NORMAL + 1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CRoQSourceFilter), L"MPC - RoQ Source", MERIT_NORMAL + 1, 0, NULL, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CRoQVideoDecoder), L"MPC - RoQ Video Decoder", MERIT_NORMAL, countof(sudpPins2), sudpPins2, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CRoQAudioDecoder), L"MPC - RoQ Audio Decoder", MERIT_NORMAL, countof(sudpPins3), sudpPins3, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRoQSplitterFilter), L"MPC - RoQ Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRoQSourceFilter), L"MPC - RoQ Source", MERIT_NORMAL+1, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRoQVideoDecoder), L"MPC - RoQ Video Decoder", MERIT_NORMAL, countof(sudpPins2), sudpPins2, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CRoQAudioDecoder), L"MPC - RoQ Audio Decoder", MERIT_NORMAL, countof(sudpPins3), sudpPins3, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CRoQSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CRoQSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CRoQSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CRoQSourceFilter>, NULL, &sudFilter[1]},
{sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CRoQVideoDecoder>, NULL, &sudFilter[2]},
{sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CRoQAudioDecoder>, NULL, &sudFilter[3]},
};
@@ -90,16 +90,16 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_RoQ, _T("0,8,,8410FFFFFFFF1E00"), _T(".roq"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_RoQ, _T("0,8,,8410FFFFFFFF1E00"), _T(".roq"), NULL);
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- UnRegisterSourceFilter(MEDIASUBTYPE_RoQ);
+ UnRegisterSourceFilter(MEDIASUBTYPE_RoQ);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -113,206 +113,206 @@ CFilterApp theApp;
//
CRoQSplitterFilter::CRoQSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CRoQSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CRoQSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
HRESULT CRoQSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pAsyncReader = pAsyncReader;
-
- UINT64 hdr = 0, hdrchk = 0x001effffffff1084;
- m_pAsyncReader->SyncRead(0, 8, (BYTE*)&hdr);
- if(hdr != hdrchk) return E_FAIL;
-
- //
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- // pins
-
- CMediaType mt;
- CAtlArray<CMediaType> mts;
-
- int iHasVideo = 0;
- int iHasAudio = 0;
-
- m_index.RemoveAll();
- __int64 audiosamples = 0;
-
- roq_info ri;
- memset(&ri, 0, sizeof(ri));
-
- roq_chunk rc;
-
- UINT64 pos = 8;
-
- while(S_OK == m_pAsyncReader->SyncRead(pos, sizeof(rc), (BYTE*)&rc))
- {
- pos += sizeof(rc);
-
- if(rc.id == 0x1001)
- {
- if(S_OK != m_pAsyncReader->SyncRead(pos, sizeof(ri), (BYTE*)&ri) || ri.w == 0 || ri.h == 0)
- break;
- }
- else if(rc.id == 0x1002 || rc.id == 0x1011)
- {
- if(!iHasVideo && ri.w > 0 && ri.h > 0)
- {
- mts.RemoveAll();
-
- mt.InitMediaType();
- mt.majortype = MEDIATYPE_Video;
- mt.subtype = MEDIASUBTYPE_RoQV;
- mt.formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER vih;
- memset(&vih, 0, sizeof(vih));
- vih.AvgTimePerFrame = 10000000i64 / 30;
- vih.bmiHeader.biSize = sizeof(vih.bmiHeader.biSize);
- vih.bmiHeader.biWidth = ri.w;
- vih.bmiHeader.biHeight = ri.h;
- vih.bmiHeader.biCompression = MEDIASUBTYPE_RoQV.Data1;
- mt.SetFormat((BYTE*)&vih, sizeof(vih));
- mt.lSampleSize = 1;
-
- mts.Add(mt);
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
- AddOutputPin(0, pPinOut);
- }
-
- if(rc.id == 0x1002)
- {
- iHasVideo++;
-
- index i;
- i.rtv = 10000000i64 * m_index.GetCount() / 30;
- i.rta = 10000000i64 * audiosamples / 22050;
- i.fp = pos - sizeof(rc);
- m_index.AddTail(i);
- }
- }
- else if(rc.id == 0x1020 || rc.id == 0x1021)
- {
- if(!iHasAudio)
- {
- mts.RemoveAll();
-
- mt.InitMediaType();
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = MEDIASUBTYPE_RoQA;
- mt.formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX wfe;
- memset(&wfe, 0, sizeof(wfe));
- wfe.wFormatTag = (WORD)WAVE_FORMAT_RoQA; // cut into half, hehe, like anyone would care
- wfe.nChannels = (rc.id & 1) + 1;
- wfe.nSamplesPerSec = 22050;
- wfe.wBitsPerSample = 16;
- mt.SetFormat((BYTE*)&wfe, sizeof(wfe));
- mt.lSampleSize = 1;
- mts.Add(mt);
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
- AddOutputPin(1, pPinOut);
- }
-
- iHasAudio++;
-
- audiosamples += rc.size / ((rc.id & 1) + 1);
- }
-
- pos += rc.size;
- }
-
- //
-
- m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64 * iHasVideo / 30;
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pAsyncReader = pAsyncReader;
+
+ UINT64 hdr = 0, hdrchk = 0x001effffffff1084;
+ m_pAsyncReader->SyncRead(0, 8, (BYTE*)&hdr);
+ if(hdr != hdrchk) return E_FAIL;
+
+ //
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ // pins
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ int iHasVideo = 0;
+ int iHasAudio = 0;
+
+ m_index.RemoveAll();
+ __int64 audiosamples = 0;
+
+ roq_info ri;
+ memset(&ri, 0, sizeof(ri));
+
+ roq_chunk rc;
+
+ UINT64 pos = 8;
+
+ while(S_OK == m_pAsyncReader->SyncRead(pos, sizeof(rc), (BYTE*)&rc))
+ {
+ pos += sizeof(rc);
+
+ if(rc.id == 0x1001)
+ {
+ if(S_OK != m_pAsyncReader->SyncRead(pos, sizeof(ri), (BYTE*)&ri) || ri.w == 0 || ri.h == 0)
+ break;
+ }
+ else if(rc.id == 0x1002 || rc.id == 0x1011)
+ {
+ if(!iHasVideo && ri.w > 0 && ri.h > 0)
+ {
+ mts.RemoveAll();
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_RoQV;
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.AvgTimePerFrame = 10000000i64/30;
+ vih.bmiHeader.biSize = sizeof(vih.bmiHeader.biSize);
+ vih.bmiHeader.biWidth = ri.w;
+ vih.bmiHeader.biHeight = ri.h;
+ vih.bmiHeader.biCompression = MEDIASUBTYPE_RoQV.Data1;
+ mt.SetFormat((BYTE*)&vih, sizeof(vih));
+ mt.lSampleSize = 1;
+
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ AddOutputPin(0, pPinOut);
+ }
+
+ if(rc.id == 0x1002)
+ {
+ iHasVideo++;
+
+ index i;
+ i.rtv = 10000000i64*m_index.GetCount()/30;
+ i.rta = 10000000i64*audiosamples/22050;
+ i.fp = pos - sizeof(rc);
+ m_index.AddTail(i);
+ }
+ }
+ else if(rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ if(!iHasAudio)
+ {
+ mts.RemoveAll();
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_RoQA;
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = (WORD)WAVE_FORMAT_RoQA; // cut into half, hehe, like anyone would care
+ wfe.nChannels = (rc.id&1)+1;
+ wfe.nSamplesPerSec = 22050;
+ wfe.wBitsPerSample = 16;
+ mt.SetFormat((BYTE*)&wfe, sizeof(wfe));
+ mt.lSampleSize = 1;
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
+ AddOutputPin(1, pPinOut);
+ }
+
+ iHasAudio++;
+
+ audiosamples += rc.size / ((rc.id&1)+1);
+ }
+
+ pos += rc.size;
+ }
+
+ //
+
+ m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64*iHasVideo/30;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CRoQSplitterFilter::DemuxInit()
{
- m_indexpos = m_index.GetHeadPosition();
+ m_indexpos = m_index.GetHeadPosition();
- return(true);
+ return(true);
}
void CRoQSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0)
- {
- m_indexpos = m_index.GetHeadPosition();
- }
- else
- {
- m_indexpos = m_index.GetTailPosition();
- while(m_indexpos && m_index.GetPrev(m_indexpos).rtv > rt);
- }
+ if(rt <= 0)
+ {
+ m_indexpos = m_index.GetHeadPosition();
+ }
+ else
+ {
+ m_indexpos = m_index.GetTailPosition();
+ while(m_indexpos && m_index.GetPrev(m_indexpos).rtv > rt);
+ }
}
bool CRoQSplitterFilter::DemuxLoop()
{
- if(!m_indexpos) return(true);
-
- index& i = m_index.GetAt(m_indexpos);
-
- REFERENCE_TIME rtVideo = i.rtv, rtAudio = i.rta;
-
- HRESULT hr = S_OK;
-
- UINT64 pos = i.fp;
-
- roq_chunk rc;
- while(S_OK == (hr = m_pAsyncReader->SyncRead(pos, sizeof(rc), (BYTE*)&rc))
- && !CheckRequest(NULL))
- {
- pos += sizeof(rc);
-
- CAutoPtr<Packet> p(DNew Packet());
-
- if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
- {
- p->SetCount(sizeof(rc) + rc.size);
- memcpy(p->GetData(), &rc, sizeof(rc));
- if(S_OK != (hr = m_pAsyncReader->SyncRead(pos, rc.size, p->GetData() + sizeof(rc))))
- break;
- }
-
- if(rc.id == 0x1002 || rc.id == 0x1011)
- {
- p->TrackNumber = 0;
- p->bSyncPoint = rtVideo == 0;
- p->rtStart = rtVideo;
- p->rtStop = rtVideo += (rc.id == 0x1011 ? 10000000i64 / 30 : 0);
- TRACE(_T("v: %I64d - %I64d (%d)\n"), p->rtStart / 10000, p->rtStop / 10000, p->GetCount());
- }
- else if(rc.id == 0x1020 || rc.id == 0x1021)
- {
- int nChannels = (rc.id & 1) + 1;
-
- p->TrackNumber = 1;
- p->bSyncPoint = TRUE;
- p->rtStart = rtAudio;
- p->rtStop = rtAudio += 10000000i64 * rc.size / (nChannels * 22050);
- TRACE(_T("a: %I64d - %I64d (%d)\n"), p->rtStart / 10000, p->rtStop / 10000, p->GetCount());
- }
-
- if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
- {
- hr = DeliverPacket(p);
- }
-
- pos += rc.size;
- }
-
- return(true);
+ if(!m_indexpos) return(true);
+
+ index& i = m_index.GetAt(m_indexpos);
+
+ REFERENCE_TIME rtVideo = i.rtv, rtAudio = i.rta;
+
+ HRESULT hr = S_OK;
+
+ UINT64 pos = i.fp;
+
+ roq_chunk rc;
+ while(S_OK == (hr = m_pAsyncReader->SyncRead(pos, sizeof(rc), (BYTE*)&rc))
+ && !CheckRequest(NULL))
+ {
+ pos += sizeof(rc);
+
+ CAutoPtr<Packet> p(DNew Packet());
+
+ if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ p->SetCount(sizeof(rc) + rc.size);
+ memcpy(p->GetData(), &rc, sizeof(rc));
+ if(S_OK != (hr = m_pAsyncReader->SyncRead(pos, rc.size, p->GetData() + sizeof(rc))))
+ break;
+ }
+
+ if(rc.id == 0x1002 || rc.id == 0x1011)
+ {
+ p->TrackNumber = 0;
+ p->bSyncPoint = rtVideo == 0;
+ p->rtStart = rtVideo;
+ p->rtStop = rtVideo += (rc.id == 0x1011 ? 10000000i64/30 : 0);
+ TRACE(_T("v: %I64d - %I64d (%d)\n"), p->rtStart/10000, p->rtStop/10000, p->GetCount());
+ }
+ else if(rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ int nChannels = (rc.id&1)+1;
+
+ p->TrackNumber = 1;
+ p->bSyncPoint = TRUE;
+ p->rtStart = rtAudio;
+ p->rtStop = rtAudio += 10000000i64*rc.size/(nChannels*22050);
+ TRACE(_T("a: %I64d - %I64d (%d)\n"), p->rtStart/10000, p->rtStop/10000, p->GetCount());
+ }
+
+ if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ hr = DeliverPacket(p);
+ }
+
+ pos += rc.size;
+ }
+
+ return(true);
}
//
@@ -320,10 +320,10 @@ bool CRoQSplitterFilter::DemuxLoop()
//
CRoQSourceFilter::CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CRoQSplitterFilter(pUnk, phr)
+ : CRoQSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
//
@@ -331,9 +331,9 @@ CRoQSourceFilter::CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
//
CRoQVideoDecoder::CRoQVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CRoQVideoDecoder"), lpunk, __uuidof(this))
+ : CTransformFilter(NAME("CRoQVideoDecoder"), lpunk, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CRoQVideoDecoder::~CRoQVideoDecoder()
@@ -342,532 +342,505 @@ CRoQVideoDecoder::~CRoQVideoDecoder()
void CRoQVideoDecoder::apply_vector_2x2(int x, int y, roq_cell* cell)
{
- unsigned char* yptr;
- yptr = m_y[0] + (y * m_pitch) + x;
- *yptr++ = cell->y0;
- *yptr++ = cell->y1;
- yptr += (m_pitch - 2);
- *yptr++ = cell->y2;
- *yptr++ = cell->y3;
- m_u[0][(y/2) *(m_pitch/2) + x/2] = cell->u;
- m_v[0][(y/2) *(m_pitch/2) + x/2] = cell->v;
+ unsigned char* yptr;
+ yptr = m_y[0] + (y * m_pitch) + x;
+ *yptr++ = cell->y0;
+ *yptr++ = cell->y1;
+ yptr += (m_pitch - 2);
+ *yptr++ = cell->y2;
+ *yptr++ = cell->y3;
+ m_u[0][(y/2) * (m_pitch/2) + x/2] = cell->u;
+ m_v[0][(y/2) * (m_pitch/2) + x/2] = cell->v;
}
void CRoQVideoDecoder::apply_vector_4x4(int x, int y, roq_cell* cell)
{
- unsigned long row_inc, c_row_inc;
- register unsigned char y0, y1, u, v;
- unsigned char *yptr, *uptr, *vptr;
-
- yptr = m_y[0] + (y * m_pitch) + x;
- uptr = m_u[0] + (y / 2) * (m_pitch / 2) + x / 2;
- vptr = m_v[0] + (y / 2) * (m_pitch / 2) + x / 2;
-
- row_inc = m_pitch - 4;
- c_row_inc = (m_pitch / 2) - 2;
- *yptr++ = y0 = cell->y0;
- *uptr++ = u = cell->u;
- *vptr++ = v = cell->v;
- *yptr++ = y0;
- *yptr++ = y1 = cell->y1;
- *uptr++ = u;
- *vptr++ = v;
- *yptr++ = y1;
-
- yptr += row_inc;
-
- *yptr++ = y0;
- *yptr++ = y0;
- *yptr++ = y1;
- *yptr++ = y1;
-
- yptr += row_inc;
- uptr += c_row_inc;
- vptr += c_row_inc;
-
- *yptr++ = y0 = cell->y2;
- *uptr++ = u;
- *vptr++ = v;
- *yptr++ = y0;
- *yptr++ = y1 = cell->y3;
- *uptr++ = u;
- *vptr++ = v;
- *yptr++ = y1;
-
- yptr += row_inc;
-
- *yptr++ = y0;
- *yptr++ = y0;
- *yptr++ = y1;
- *yptr++ = y1;
+ unsigned long row_inc, c_row_inc;
+ register unsigned char y0, y1, u, v;
+ unsigned char *yptr, *uptr, *vptr;
+
+ yptr = m_y[0] + (y * m_pitch) + x;
+ uptr = m_u[0] + (y/2) * (m_pitch/2) + x/2;
+ vptr = m_v[0] + (y/2) * (m_pitch/2) + x/2;
+
+ row_inc = m_pitch - 4;
+ c_row_inc = (m_pitch/2) - 2;
+ *yptr++ = y0 = cell->y0; *uptr++ = u = cell->u; *vptr++ = v = cell->v;
+ *yptr++ = y0;
+ *yptr++ = y1 = cell->y1; *uptr++ = u; *vptr++ = v;
+ *yptr++ = y1;
+
+ yptr += row_inc;
+
+ *yptr++ = y0;
+ *yptr++ = y0;
+ *yptr++ = y1;
+ *yptr++ = y1;
+
+ yptr += row_inc; uptr += c_row_inc; vptr += c_row_inc;
+
+ *yptr++ = y0 = cell->y2; *uptr++ = u; *vptr++ = v;
+ *yptr++ = y0;
+ *yptr++ = y1 = cell->y3; *uptr++ = u; *vptr++ = v;
+ *yptr++ = y1;
+
+ yptr += row_inc;
+
+ *yptr++ = y0;
+ *yptr++ = y0;
+ *yptr++ = y1;
+ *yptr++ = y1;
}
void CRoQVideoDecoder::apply_motion_4x4(int x, int y, unsigned char mv, char mean_x, char mean_y)
{
- int i, mx, my;
- unsigned char *pa, *pb;
-
- mx = x + 8 - (mv >> 4) - mean_x;
- my = y + 8 - (mv & 0xf) - mean_y;
-
- pa = m_y[0] + (y * m_pitch) + x;
- pb = m_y[1] + (my * m_pitch) + mx;
- for(i = 0; i < 4; i++)
- {
- pa[0] = pb[0];
- pa[1] = pb[1];
- pa[2] = pb[2];
- pa[3] = pb[3];
- pa += m_pitch;
- pb += m_pitch;
- }
-
- pa = m_u[0] + (y / 2) * (m_pitch / 2) + x / 2;
- pb = m_u[1] + (my / 2) * (m_pitch / 2) + (mx + 1) / 2;
- for(i = 0; i < 2; i++)
- {
- pa[0] = pb[0];
- pa[1] = pb[1];
- pa += m_pitch / 2;
- pb += m_pitch / 2;
- }
-
- pa = m_v[0] + (y / 2) * (m_pitch / 2) + x / 2;
- pb = m_v[1] + (my / 2) * (m_pitch / 2) + (mx + 1) / 2;
- for(i = 0; i < 2; i++)
- {
- pa[0] = pb[0];
- pa[1] = pb[1];
- pa += m_pitch / 2;
- pb += m_pitch / 2;
- }
+ int i, mx, my;
+ unsigned char *pa, *pb;
+
+ mx = x + 8 - (mv >> 4) - mean_x;
+ my = y + 8 - (mv & 0xf) - mean_y;
+
+ pa = m_y[0] + (y * m_pitch) + x;
+ pb = m_y[1] + (my * m_pitch) + mx;
+ for(i = 0; i < 4; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa += m_pitch;
+ pb += m_pitch;
+ }
+
+ pa = m_u[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_u[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 2; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
+
+ pa = m_v[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_v[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 2; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
}
void CRoQVideoDecoder::apply_motion_8x8(int x, int y, unsigned char mv, char mean_x, char mean_y)
{
- int mx, my, i;
- unsigned char *pa, *pb;
-
- mx = x + 8 - (mv >> 4) - mean_x;
- my = y + 8 - (mv & 0xf) - mean_y;
-
- pa = m_y[0] + (y * m_pitch) + x;
- pb = m_y[1] + (my * m_pitch) + mx;
- for(i = 0; i < 8; i++)
- {
- pa[0] = pb[0];
- pa[1] = pb[1];
- pa[2] = pb[2];
- pa[3] = pb[3];
- pa[4] = pb[4];
- pa[5] = pb[5];
- pa[6] = pb[6];
- pa[7] = pb[7];
- pa += m_pitch;
- pb += m_pitch;
- }
-
- pa = m_u[0] + (y / 2) * (m_pitch / 2) + x / 2;
- pb = m_u[1] + (my / 2) * (m_pitch / 2) + (mx + 1) / 2;
- for(i = 0; i < 4; i++)
- {
- pa[0] = pb[0];
- pa[1] = pb[1];
- pa[2] = pb[2];
- pa[3] = pb[3];
- pa += m_pitch / 2;
- pb += m_pitch / 2;
- }
-
- pa = m_v[0] + (y / 2) * (m_pitch / 2) + x / 2;
- pb = m_v[1] + (my / 2) * (m_pitch / 2) + (mx + 1) / 2;
- for(i = 0; i < 4; i++)
- {
- pa[0] = pb[0];
- pa[1] = pb[1];
- pa[2] = pb[2];
- pa[3] = pb[3];
- pa += m_pitch / 2;
- pb += m_pitch / 2;
- }
+ int mx, my, i;
+ unsigned char *pa, *pb;
+
+ mx = x + 8 - (mv >> 4) - mean_x;
+ my = y + 8 - (mv & 0xf) - mean_y;
+
+ pa = m_y[0] + (y * m_pitch) + x;
+ pb = m_y[1] + (my * m_pitch) + mx;
+ for(i = 0; i < 8; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa[4] = pb[4];
+ pa[5] = pb[5];
+ pa[6] = pb[6];
+ pa[7] = pb[7];
+ pa += m_pitch;
+ pb += m_pitch;
+ }
+
+ pa = m_u[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_u[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 4; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
+
+ pa = m_v[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_v[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 4; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
}
HRESULT CRoQVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- m_rtStart = tStart;
+ m_rtStart = tStart;
- BITMAPINFOHEADER bih;
- ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
- int size = bih.biWidth * bih.biHeight;
+ int size = bih.biWidth*bih.biHeight;
- memset(m_y[0], 0, size);
- memset(m_u[0], 0x80, size / 2);
- memset(m_y[1], 0, size);
- memset(m_u[1], 0x80, size / 2);
+ memset(m_y[0], 0, size);
+ memset(m_u[0], 0x80, size/2);
+ memset(m_y[1], 0, size);
+ memset(m_u[1], 0x80, size/2);
- return __super::NewSegment(tStart, tStop, dRate);
+ return __super::NewSegment(tStart, tStop, dRate);
}
HRESULT CRoQVideoDecoder::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- CAutoLock cAutoLock(&m_csReceive);
-
- HRESULT hr;
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- m_pOutput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
-
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
-
- long len = pIn->GetActualDataLength();
- if(len <= 0) return S_OK; // nothing to do
-
- REFERENCE_TIME rtStart = 0, rtStop = 0;
- pIn->GetTime(&rtStart, &rtStop);
-
- if(pIn->IsPreroll() == S_OK || rtStart < 0)
- return S_OK;
-
- BYTE* pDataOut = NULL;
- if(FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
-
- BITMAPINFOHEADER bih;
- ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
-
- int w = bih.biWidth, h = bih.biHeight;
-
- // TODO: decode picture into m_pI420
-
- roq_chunk* rc = (roq_chunk*)pDataIn;
-
- pDataIn += sizeof(roq_chunk);
-
- if(rc->id == 0x1002)
- {
- DWORD nv1 = rc->arg >> 8;
- if(nv1 == 0) nv1 = 256;
-
- DWORD nv2 = rc->arg & 0xff;
- if(nv2 == 0 && nv1 * 6 < rc->size) nv2 = 256;
-
- memcpy(m_cells, pDataIn, sizeof(m_cells[0])*nv1);
- pDataIn += sizeof(m_cells[0]) * nv1;
-
- for(int i = 0; i < (int)nv2; i++)
- for(int j = 0; j < 4; j++)
- m_qcells[i].idx[j] = &m_cells[*pDataIn++];
-
- return S_FALSE;
- }
- else if(rc->id == 0x1011)
- {
- int bpos = 0, xpos = 0, ypos = 0;
- int vqflg = 0, vqflg_pos = -1, vqid;
- roq_qcell* qcell = NULL;
-
- BYTE* buf = pDataIn;
-
- while(bpos < (int)rc->size && ypos < h)
- {
- for(int yp = ypos; yp < ypos + 16; yp += 8)
- {
- for(int xp = xpos; xp < xpos + 16; xp += 8)
- {
- if(vqflg_pos < 0)
- {
- vqflg = buf[bpos++];
- vqflg |= buf[bpos++] << 8;
- vqflg_pos = 7;
- }
-
- vqid = (vqflg >> (vqflg_pos * 2)) & 3;
- vqflg_pos--;
-
- switch(vqid)
- {
- case 0:
- break;
- case 1:
- apply_motion_8x8(xp, yp, buf[bpos++], rc->arg >> 8, rc->arg & 0xff);
- break;
- case 2:
- qcell = m_qcells + buf[bpos++];
- apply_vector_4x4(xp, yp, qcell->idx[0]);
- apply_vector_4x4(xp + 4, yp, qcell->idx[1]);
- apply_vector_4x4(xp, yp + 4, qcell->idx[2]);
- apply_vector_4x4(xp + 4, yp + 4, qcell->idx[3]);
- break;
- case 3:
- for(int k = 0; k < 4; k++)
- {
- int x = xp, y = yp;
- if(k & 1) x += 4;
- if(k & 2) y += 4;
-
- if(vqflg_pos < 0)
- {
- vqflg = buf[bpos++];
- vqflg |= buf[bpos++] << 8;
- vqflg_pos = 7;
- }
-
- vqid = (vqflg >> (vqflg_pos * 2)) & 3;
- vqflg_pos--;
-
- switch(vqid)
- {
- case 0:
- break;
- case 1:
- apply_motion_4x4(x, y, buf[bpos++], rc->arg >> 8, rc->arg & 0xff);
- break;
- case 2:
- qcell = m_qcells + buf[bpos++];
- apply_vector_2x2(x, y, qcell->idx[0]);
- apply_vector_2x2(x + 2, y, qcell->idx[1]);
- apply_vector_2x2(x, y + 2, qcell->idx[2]);
- apply_vector_2x2(x + 2, y + 2, qcell->idx[3]);
- break;
- case 3:
- apply_vector_2x2(x, y, &m_cells[buf[bpos++]]);
- apply_vector_2x2(x + 2, y, &m_cells[buf[bpos++]]);
- apply_vector_2x2(x, y + 2, &m_cells[buf[bpos++]]);
- apply_vector_2x2(x + 2, y + 2, &m_cells[buf[bpos++]]);
- break;
- }
- }
- break;
- }
- }
- }
-
- xpos += 16;
- if(xpos >= w)
- {
- xpos -= w;
- ypos += 16;
- }
- }
-
- if(m_rtStart + rtStart == 0)
- {
- memcpy(m_y[1], m_y[0], w * h * 3 / 2);
- }
- else
- {
- BYTE* tmp;
- tmp = m_y[0];
- m_y[0] = m_y[1];
- m_y[1] = tmp;
- tmp = m_u[0];
- m_u[0] = m_u[1];
- m_u[1] = tmp;
- tmp = m_v[0];
- m_v[0] = m_v[1];
- m_v[1] = tmp;
- }
- }
- else
- {
- return E_UNEXPECTED;
- }
-
- if(rtStart < 0)
- return S_FALSE;
-
- Copy(pDataOut, m_y[1], w, h);
-
- pOut->SetTime(&rtStart, &rtStop);
-
- return S_OK;
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK; // nothing to do
+
+ REFERENCE_TIME rtStart = 0, rtStop = 0;
+ pIn->GetTime(&rtStart, &rtStop);
+
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ int w = bih.biWidth, h = bih.biHeight;
+
+ // TODO: decode picture into m_pI420
+
+ roq_chunk* rc = (roq_chunk*)pDataIn;
+
+ pDataIn += sizeof(roq_chunk);
+
+ if(rc->id == 0x1002)
+ {
+ DWORD nv1 = rc->arg>>8;
+ if(nv1 == 0) nv1 = 256;
+
+ DWORD nv2 = rc->arg&0xff;
+ if(nv2 == 0 && nv1 * 6 < rc->size) nv2 = 256;
+
+ memcpy(m_cells, pDataIn, sizeof(m_cells[0])*nv1);
+ pDataIn += sizeof(m_cells[0])*nv1;
+
+ for(int i = 0; i < (int)nv2; i++)
+ for(int j = 0; j < 4; j++)
+ m_qcells[i].idx[j] = &m_cells[*pDataIn++];
+
+ return S_FALSE;
+ }
+ else if(rc->id == 0x1011)
+ {
+ int bpos = 0, xpos = 0, ypos = 0;
+ int vqflg = 0, vqflg_pos = -1, vqid;
+ roq_qcell* qcell = NULL;
+
+ BYTE* buf = pDataIn;
+
+ while(bpos < (int)rc->size && ypos < h)
+ {
+ for(int yp = ypos; yp < ypos + 16; yp += 8)
+ {
+ for(int xp = xpos; xp < xpos + 16; xp += 8)
+ {
+ if(vqflg_pos < 0)
+ {
+ vqflg = buf[bpos++];
+ vqflg |= buf[bpos++]<<8;
+ vqflg_pos = 7;
+ }
+
+ vqid = (vqflg >> (vqflg_pos * 2)) & 3;
+ vqflg_pos--;
+
+ switch(vqid)
+ {
+ case 0:
+ break;
+ case 1:
+ apply_motion_8x8(xp, yp, buf[bpos++], rc->arg >> 8, rc->arg & 0xff);
+ break;
+ case 2:
+ qcell = m_qcells + buf[bpos++];
+ apply_vector_4x4(xp, yp, qcell->idx[0]);
+ apply_vector_4x4(xp+4, yp, qcell->idx[1]);
+ apply_vector_4x4(xp, yp+4, qcell->idx[2]);
+ apply_vector_4x4(xp+4, yp+4, qcell->idx[3]);
+ break;
+ case 3:
+ for(int k = 0; k < 4; k++)
+ {
+ int x = xp, y = yp;
+ if(k&1) x += 4;
+ if(k&2) y += 4;
+
+ if(vqflg_pos < 0)
+ {
+ vqflg = buf[bpos++];
+ vqflg |= buf[bpos++]<<8;
+ vqflg_pos = 7;
+ }
+
+ vqid = (vqflg >> (vqflg_pos * 2)) & 3;
+ vqflg_pos--;
+
+ switch(vqid)
+ {
+ case 0:
+ break;
+ case 1:
+ apply_motion_4x4(x, y, buf[bpos++], rc->arg >> 8, rc->arg & 0xff);
+ break;
+ case 2:
+ qcell = m_qcells + buf[bpos++];
+ apply_vector_2x2(x, y, qcell->idx[0]);
+ apply_vector_2x2(x+2, y, qcell->idx[1]);
+ apply_vector_2x2(x, y+2, qcell->idx[2]);
+ apply_vector_2x2(x+2, y+2, qcell->idx[3]);
+ break;
+ case 3:
+ apply_vector_2x2(x, y, &m_cells[buf[bpos++]]);
+ apply_vector_2x2(x+2, y, &m_cells[buf[bpos++]]);
+ apply_vector_2x2(x, y+2, &m_cells[buf[bpos++]]);
+ apply_vector_2x2(x+2, y+2, &m_cells[buf[bpos++]]);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ xpos += 16;
+ if(xpos >= w) {xpos -= w; ypos += 16;}
+ }
+
+ if(m_rtStart+rtStart == 0)
+ {
+ memcpy(m_y[1], m_y[0], w*h*3/2);
+ }
+ else
+ {
+ BYTE* tmp;
+ tmp = m_y[0]; m_y[0] = m_y[1]; m_y[1] = tmp;
+ tmp = m_u[0]; m_u[0] = m_u[1]; m_u[1] = tmp;
+ tmp = m_v[0]; m_v[0] = m_v[1]; m_v[1] = tmp;
+ }
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
+
+ if(rtStart < 0)
+ return S_FALSE;
+
+ Copy(pDataOut, m_y[1], w, h);
+
+ pOut->SetTime(&rtStart, &rtStop);
+
+ return S_OK;
}
void CRoQVideoDecoder::Copy(BYTE* pOut, BYTE* pIn, DWORD w, DWORD h)
{
- BITMAPINFOHEADER bihOut;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
-
- int pitchIn = w;
- int pitchInUV = pitchIn >> 1;
- BYTE* pInU = pIn + pitchIn * h;
- BYTE* pInV = pInU + pitchInUV * h / 2;
-
- if(bihOut.biCompression == '2YUY')
- {
- BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth * 2, pIn, pInU, pInV, pitchIn);
- }
- else if(bihOut.biCompression == 'I420' || bihOut.biCompression == 'VUYI')
- {
- BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth * h, pOut + bihOut.biWidth * h * 5 / 4, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
- }
- else if(bihOut.biCompression == '21VY')
- {
- BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth * h * 5 / 4, pOut + bihOut.biWidth * h, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
- }
- else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
- {
- int pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
-
- if(bihOut.biHeight > 0)
- {
- pOut += pitchOut * (h - 1);
- pitchOut = -pitchOut;
- }
-
- if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn))
- {
- for(DWORD y = 0; y < h; y++, pIn += pitchIn, pOut += pitchOut)
- memset(pOut, 0, pitchOut);
- }
- }
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ int pitchIn = w;
+ int pitchInUV = pitchIn>>1;
+ BYTE* pInU = pIn + pitchIn*h;
+ BYTE* pInV = pInU + pitchInUV*h/2;
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == 'I420' || bihOut.biCompression == 'VUYI')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h, pOut + bihOut.biWidth*h*5/4, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == '21VY')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h*5/4, pOut + bihOut.biWidth*h, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ int pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
+
+ if(bihOut.biHeight > 0)
+ {
+ pOut += pitchOut*(h-1);
+ pitchOut = -pitchOut;
+ }
+
+ if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pIn += pitchIn, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
}
HRESULT CRoQVideoDecoder::CheckInputType(const CMediaType* mtIn)
{
- return mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_RoQV
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_RoQV
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CRoQVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- if(m_pOutput && m_pOutput->IsConnected())
- {
- BITMAPINFOHEADER bih1, bih2;
- if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
- && abs(bih1.biHeight) != abs(bih2.biHeight))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- return SUCCEEDED(CheckInputType(mtIn))
- && mtOut->majortype == MEDIATYPE_Video && (mtOut->subtype == MEDIASUBTYPE_YUY2
- || mtOut->subtype == MEDIASUBTYPE_YV12
- || mtOut->subtype == MEDIASUBTYPE_I420
- || mtOut->subtype == MEDIASUBTYPE_IYUV
- || mtOut->subtype == MEDIASUBTYPE_ARGB32
- || mtOut->subtype == MEDIASUBTYPE_RGB32
- || mtOut->subtype == MEDIASUBTYPE_RGB24
- || mtOut->subtype == MEDIASUBTYPE_RGB565
- || mtOut->subtype == MEDIASUBTYPE_RGB555)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ if(m_pOutput && m_pOutput->IsConnected())
+ {
+ BITMAPINFOHEADER bih1, bih2;
+ if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ && abs(bih1.biHeight) != abs(bih2.biHeight))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Video && (mtOut->subtype == MEDIASUBTYPE_YUY2
+ || mtOut->subtype == MEDIASUBTYPE_YV12
+ || mtOut->subtype == MEDIASUBTYPE_I420
+ || mtOut->subtype == MEDIASUBTYPE_IYUV
+ || mtOut->subtype == MEDIASUBTYPE_ARGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB24
+ || mtOut->subtype == MEDIASUBTYPE_RGB565
+ || mtOut->subtype == MEDIASUBTYPE_RGB555)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CRoQVideoDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- BITMAPINFOHEADER bih;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = bih.biSizeImage;
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biSizeImage;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CRoQVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- struct
- {
- const GUID* subtype;
- WORD biPlanes, biBitCount;
- DWORD biCompression;
- } fmts[] =
- {
- {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
- {&MEDIASUBTYPE_I420, 3, 12, '024I'},
- {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
- {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
- {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
- {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
- {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
- {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
- {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
- {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
- };
-
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition >= countof(fmts)) return VFW_S_NO_MORE_ITEMS;
-
- BITMAPINFOHEADER bih;
- ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
-
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = *fmts[iPosition].subtype;
- pmt->formattype = FORMAT_VideoInfo;
-
- BITMAPINFOHEADER bihOut;
- memset(&bihOut, 0, sizeof(bihOut));
- bihOut.biSize = sizeof(bihOut);
- bihOut.biWidth = bih.biWidth;
- bihOut.biHeight = bih.biHeight;
- bihOut.biPlanes = fmts[iPosition].biPlanes;
- bihOut.biBitCount = fmts[iPosition].biBitCount;
- bihOut.biCompression = fmts[iPosition].biCompression;
- bihOut.biSizeImage = bih.biWidth * bih.biHeight * bihOut.biBitCount >> 3;
-
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
- vih->bmiHeader = bihOut;
-
- CorrectMediaType(pmt);
-
- return S_OK;
+ struct {const GUID* subtype; WORD biPlanes, biBitCount; DWORD biCompression;} fmts[] =
+ {
+ {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
+ {&MEDIASUBTYPE_I420, 3, 12, '024I'},
+ {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
+ {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
+ };
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= countof(fmts)) return VFW_S_NO_MORE_ITEMS;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = *fmts[iPosition].subtype;
+ pmt->formattype = FORMAT_VideoInfo;
+
+ BITMAPINFOHEADER bihOut;
+ memset(&bihOut, 0, sizeof(bihOut));
+ bihOut.biSize = sizeof(bihOut);
+ bihOut.biWidth = bih.biWidth;
+ bihOut.biHeight = bih.biHeight;
+ bihOut.biPlanes = fmts[iPosition].biPlanes;
+ bihOut.biBitCount = fmts[iPosition].biBitCount;
+ bihOut.biCompression = fmts[iPosition].biCompression;
+ bihOut.biSizeImage = bih.biWidth*bih.biHeight*bihOut.biBitCount>>3;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->bmiHeader = bihOut;
+
+ CorrectMediaType(pmt);
+
+ return S_OK;
}
HRESULT CRoQVideoDecoder::StartStreaming()
{
- BITMAPINFOHEADER bih;
- ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
- int size = bih.biWidth * bih.biHeight;
+ int size = bih.biWidth*bih.biHeight;
- m_y[0] = DNew BYTE[size*3/2];
- m_u[0] = m_y[0] + size;
- m_v[0] = m_y[0] + size * 5 / 4;
- m_y[1] = DNew BYTE[size*3/2];
- m_u[1] = m_y[1] + size;
- m_v[1] = m_y[1] + size * 5 / 4;
+ m_y[0] = DNew BYTE[size*3/2];
+ m_u[0] = m_y[0] + size;
+ m_v[0] = m_y[0] + size*5/4;
+ m_y[1] = DNew BYTE[size*3/2];
+ m_u[1] = m_y[1] + size;
+ m_v[1] = m_y[1] + size*5/4;
- m_pitch = bih.biWidth;
+ m_pitch = bih.biWidth;
- return __super::StartStreaming();
+ return __super::StartStreaming();
}
HRESULT CRoQVideoDecoder::StopStreaming()
{
- delete [] m_y[0];
- m_y[0] = NULL;
- delete [] m_y[1];
- m_y[1] = NULL;
+ delete [] m_y[0]; m_y[0] = NULL;
+ delete [] m_y[1]; m_y[1] = NULL;
- return __super::StopStreaming();
+ return __super::StopStreaming();
}
//
@@ -875,9 +848,9 @@ HRESULT CRoQVideoDecoder::StopStreaming()
//
CRoQAudioDecoder::CRoQAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CRoQAudioDecoder"), lpunk, __uuidof(this))
+ : CTransformFilter(NAME("CRoQAudioDecoder"), lpunk, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CRoQAudioDecoder::~CRoQAudioDecoder()
@@ -886,148 +859,147 @@ CRoQAudioDecoder::~CRoQAudioDecoder()
HRESULT CRoQAudioDecoder::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- HRESULT hr;
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- m_pOutput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
-
- WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
-
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn)))
- return hr;
-
- long len = pIn->GetActualDataLength();
- if(len <= 0) return S_OK;
-
- REFERENCE_TIME rtStart, rtStop;
- pIn->GetTime(&rtStart, &rtStop);
-
- if(pIn->IsPreroll() == S_OK || rtStart < 0)
- return S_OK;
-
- BYTE* pDataOut = NULL;
- if(FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
-
- long size = pOut->GetSize();
- if(size <= 0)
- return E_FAIL;
-
- roq_chunk* rc = (roq_chunk*)pDataIn;
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
-
- if(wfe->nChannels == 1)
- {
- int mono = (short)rc->arg;
- unsigned char* src = pDataIn + sizeof(roq_chunk);
- short* dst = (short*)pDataOut;
- for(int i = sizeof(roq_chunk); i < len; i++, src++, dst++)
- {
- short diff = (*src & 0x7f) * (*src & 0x7f);
- if(*src & 0x80) diff = -diff;
- mono += diff;
- *dst = (short)mono;
- }
- }
- else if(wfe->nChannels == 2)
- {
- int left = (char)(rc->arg >> 8) << 8;
- int right = (char)(rc->arg) << 8;
- unsigned char* src = pDataIn + sizeof(roq_chunk);
- short* dst = (short*)pDataOut;
- for(int i = sizeof(roq_chunk); i < len; i += 2, src++, dst++)
- {
- short diff = (*src & 0x7f) * (*src & 0x7f);
- if(*src & 0x80) diff = -diff;
- ASSERT((int)left + diff <= SHRT_MAX && (int)left + diff >= SHRT_MIN);
- left += diff;
- *dst = (short)left;
-
- src++;
- dst++;
-
- diff = (*src & 0x7f) * (*src & 0x7f);
- if(*src & 0x80) diff = -diff;
- ASSERT((int)right + diff <= SHRT_MAX && (int)right + diff >= SHRT_MIN);
- right += diff;
- *dst = (short)right;
- }
- }
- else
- {
- return E_UNEXPECTED;
- }
-
- pOut->SetTime(&rtStart, &rtStop);
-
- pOut->SetActualDataLength(2 *(len - sizeof(roq_chunk)));
-
- return S_OK;
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK;
+
+ REFERENCE_TIME rtStart, rtStop;
+ pIn->GetTime(&rtStart, &rtStop);
+
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ long size = pOut->GetSize();
+ if(size <= 0)
+ return E_FAIL;
+
+ roq_chunk* rc = (roq_chunk*)pDataIn;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ if(wfe->nChannels == 1)
+ {
+ int mono = (short)rc->arg;
+ unsigned char* src = pDataIn + sizeof(roq_chunk);
+ short* dst = (short*)pDataOut;
+ for(int i = sizeof(roq_chunk); i < len; i++, src++, dst++)
+ {
+ short diff = (*src&0x7f)*(*src&0x7f);
+ if(*src&0x80) diff = -diff;
+ mono += diff;
+ *dst = (short)mono;
+ }
+ }
+ else if(wfe->nChannels == 2)
+ {
+ int left = (char)(rc->arg>>8)<<8;
+ int right = (char)(rc->arg)<<8;
+ unsigned char* src = pDataIn + sizeof(roq_chunk);
+ short* dst = (short*)pDataOut;
+ for(int i = sizeof(roq_chunk); i < len; i+=2, src++, dst++)
+ {
+ short diff = (*src&0x7f)*(*src&0x7f);
+ if(*src&0x80) diff = -diff;
+ ASSERT((int)left + diff <= SHRT_MAX && (int)left + diff >= SHRT_MIN);
+ left += diff;
+ *dst = (short)left;
+
+ src++; dst++;
+
+ diff = (*src&0x7f)*(*src&0x7f);
+ if(*src&0x80) diff = -diff;
+ ASSERT((int)right + diff <= SHRT_MAX && (int)right + diff >= SHRT_MIN);
+ right += diff;
+ *dst = (short)right;
+ }
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
+
+ pOut->SetTime(&rtStart, &rtStop);
+
+ pOut->SetActualDataLength(2*(len-sizeof(roq_chunk)));
+
+ return S_OK;
}
HRESULT CRoQAudioDecoder::CheckInputType(const CMediaType* mtIn)
{
- return mtIn->majortype == MEDIATYPE_Audio && mtIn->subtype == MEDIASUBTYPE_RoQA
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return mtIn->majortype == MEDIATYPE_Audio && mtIn->subtype == MEDIASUBTYPE_RoQA
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CRoQAudioDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return SUCCEEDED(CheckInputType(mtIn))
- && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CRoQAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- CComPtr<IMemAllocator> pAllocatorIn;
- m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
- // ok, maybe this is too much...
- pProperties->cBuffers = 8;
- pProperties->cbBuffer = wfe->nChannels * wfe->nSamplesPerSec * wfe->wBitsPerSample >> 3; // nAvgBytesPerSec;
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ // ok, maybe this is too much...
+ pProperties->cBuffers = 8;
+ pProperties->cbBuffer = wfe->nChannels*wfe->nSamplesPerSec*wfe->wBitsPerSample>>3; // nAvgBytesPerSec;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR;
+ ? E_FAIL
+ : NOERROR;
}
HRESULT CRoQAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- *pmt = m_pInput->CurrentMediaType();
- pmt->subtype = MEDIASUBTYPE_PCM;
+ *pmt = m_pInput->CurrentMediaType();
+ pmt->subtype = MEDIASUBTYPE_PCM;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
- wfe->cbSize = 0;
- wfe->wFormatTag = WAVE_FORMAT_PCM;
- wfe->nBlockAlign = wfe->nChannels * wfe->wBitsPerSample >> 3;
- wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
+ wfe->cbSize = 0;
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nBlockAlign = wfe->nChannels*wfe->wBitsPerSample>>3;
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec*wfe->nBlockAlign;
- return S_OK;
+ return S_OK;
}
diff --git a/src/filters/parser/RoQSplitter/RoQSplitter.h b/src/filters/parser/RoQSplitter/RoQSplitter.h
index 50e86a4ff..c7fa21108 100644
--- a/src/filters/parser/RoQSplitter/RoQSplitter.h
+++ b/src/filters/parser/RoQSplitter/RoQSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,119 +24,101 @@
#include "../BaseSplitter/BaseSplitter.h"
// {48B93619-A959-45d9-B5FD-E12A67A96CF1}
-DEFINE_GUID(MEDIASUBTYPE_RoQ,
- 0x48b93619, 0xa959, 0x45d9, 0xb5, 0xfd, 0xe1, 0x2a, 0x67, 0xa9, 0x6c, 0xf1);
+DEFINE_GUID(MEDIASUBTYPE_RoQ,
+0x48b93619, 0xa959, 0x45d9, 0xb5, 0xfd, 0xe1, 0x2a, 0x67, 0xa9, 0x6c, 0xf1);
// 56516F52-0000-0010-8000-00AA00389B71 'RoQV' == MEDIASUBTYPE_RoQV
DEFINE_GUID(MEDIASUBTYPE_RoQV,
- 0x56516F52, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+0x56516F52, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
#define WAVE_FORMAT_RoQA 0x41516F52
// 41516F52-0000-0010-8000-00AA00389B71 'RoQA' == MEDIASUBTYPE_RoQA
DEFINE_GUID(MEDIASUBTYPE_RoQA,
- WAVE_FORMAT_RoQA, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+WAVE_FORMAT_RoQA, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
#pragma pack(push, 1)
-struct roq_chunk
-{
- WORD id;
- DWORD size;
- WORD arg;
-};
-struct roq_info
-{
- WORD w, h, unk1, unk2;
-};
+struct roq_chunk {WORD id; DWORD size; WORD arg;};
+struct roq_info {WORD w, h, unk1, unk2;};
#pragma pack(pop)
[uuid("C73DF7C1-21F2-44C7-A430-D35FB9BB298F")]
class CRoQSplitterFilter : public CBaseSplitterFilter
{
- CComPtr<IAsyncReader> m_pAsyncReader;
+ CComPtr<IAsyncReader> m_pAsyncReader;
- struct index
- {
- REFERENCE_TIME rtv, rta;
- __int64 fp;
- };
- CAtlList<index> m_index;
- POSITION m_indexpos;
+ struct index {REFERENCE_TIME rtv, rta; __int64 fp;};
+ CAtlList<index> m_index;
+ POSITION m_indexpos;
protected:
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CRoQSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CRoQSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
[uuid("02B8E5C2-4E1F-45D3-9A8E-B8F1EDE6DE09")]
class CRoQSourceFilter : public CRoQSplitterFilter
{
public:
- CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
[uuid("FBEFC5EC-ABA0-4E6C-ACA3-D05FDFEFB853")]
class CRoQVideoDecoder : public CTransformFilter
{
- CCritSec m_csReceive;
+ CCritSec m_csReceive;
- REFERENCE_TIME m_rtStart;
+ REFERENCE_TIME m_rtStart;
- BYTE* m_y[2];
- BYTE* m_u[2];
- BYTE* m_v[2];
- int m_pitch;
+ BYTE* m_y[2];
+ BYTE* m_u[2];
+ BYTE* m_v[2];
+ int m_pitch;
- void Copy(BYTE* pOut, BYTE* pIn, DWORD w, DWORD h);
+ void Copy(BYTE* pOut, BYTE* pIn, DWORD w, DWORD h);
-#pragma pack(push, 1)
- struct roq_cell
- {
- BYTE y0, y1, y2, y3, u, v;
- } m_cells[256];
- struct roq_qcell
- {
- roq_cell* idx[4];
- } m_qcells[256];
-#pragma pack(pop)
- void apply_vector_2x2(int x, int y, roq_cell* cell);
- void apply_vector_4x4(int x, int y, roq_cell* cell);
- void apply_motion_4x4(int x, int y, unsigned char mv, char mean_x, char mean_y);
- void apply_motion_8x8(int x, int y, unsigned char mv, char mean_x, char mean_y);
+ #pragma pack(push, 1)
+ struct roq_cell {BYTE y0, y1, y2, y3, u, v;} m_cells[256];
+ struct roq_qcell {roq_cell* idx[4];} m_qcells[256];
+ #pragma pack(pop)
+ void apply_vector_2x2(int x, int y, roq_cell* cell);
+ void apply_vector_4x4(int x, int y, roq_cell* cell);
+ void apply_motion_4x4(int x, int y, unsigned char mv, char mean_x, char mean_y);
+ void apply_motion_8x8(int x, int y, unsigned char mv, char mean_x, char mean_y);
public:
- CRoQVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CRoQVideoDecoder();
+ CRoQVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRoQVideoDecoder();
HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
};
[uuid("226FAF85-E358-4502-8C98-F4224BE76953")]
class CRoQAudioDecoder : public CTransformFilter
{
public:
- CRoQAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CRoQAudioDecoder();
-
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ CRoQAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRoQAudioDecoder();
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
};
diff --git a/src/filters/parser/RoQSplitter/resource.h b/src/filters/parser/RoQSplitter/resource.h
index ed68ccb09..9bee95d26 100644
--- a/src/filters/parser/RoQSplitter/resource.h
+++ b/src/filters/parser/RoQSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by RoQSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/RoQSplitter/stdafx.cpp b/src/filters/parser/RoQSplitter/stdafx.cpp
index e1ec5adac..4284c08d9 100644
--- a/src/filters/parser/RoQSplitter/stdafx.cpp
+++ b/src/filters/parser/RoQSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/RoQSplitter/stdafx.h b/src/filters/parser/RoQSplitter/stdafx.h
index 0c8bbfda0..e3ebbbb58 100644
--- a/src/filters/parser/RoQSplitter/stdafx.h
+++ b/src/filters/parser/RoQSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/SSFSplitter/SSFSplitter.cpp b/src/filters/parser/SSFSplitter/SSFSplitter.cpp
index 5858ae13f..d4cafd14e 100644
--- a/src/filters/parser/SSFSplitter/SSFSplitter.cpp
+++ b/src/filters/parser/SSFSplitter/SSFSplitter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,8 +28,8 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_SSF},
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_SSF},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -40,30 +40,30 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CSSFSplitterFilter), L"MPC - SSF Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSSFSourceFilter), L"MPC - SSF Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSSFSplitterFilter), L"MPC - SSF Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSSFSourceFilter), L"MPC - SSF Source", MERIT_NORMAL, 0, NULL, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSSFSplitterFilter>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSSFSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSSFSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSSFSourceFilter>, NULL, &sudFilter[1]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(_T("Media Type\\Extensions"), _T(".ssf"), _T("Source Filter"), CStringFromGUID(__uuidof(CSSFSourceFilter)));
+ SetRegKeyValue(_T("Media Type\\Extensions"), _T(".ssf"), _T("Source Filter"), CStringFromGUID(__uuidof(CSSFSourceFilter)));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".ssf"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ssf"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -74,33 +74,33 @@ CFilterApp theApp;
namespace ssf
{
-class InputStreamBSF : public InputStream
-{
- CBaseSplitterFile* m_pFile;
-
-public:
- InputStreamBSF(CBaseSplitterFile* pFile)
- : m_pFile(pFile)
- {
- ASSERT(m_pFile);
- }
-
- int InputStreamBSF::NextByte()
- {
- if(!m_pFile) ThrowError(_T("m_pFile is NULL"));
- if(!m_pFile->GetRemaining()) return EOS;
- return (int)m_pFile->BitRead(8);
- }
-};
+ class InputStreamBSF : public InputStream
+ {
+ CBaseSplitterFile* m_pFile;
+
+ public:
+ InputStreamBSF(CBaseSplitterFile* pFile)
+ : m_pFile(pFile)
+ {
+ ASSERT(m_pFile);
+ }
+
+ int InputStreamBSF::NextByte()
+ {
+ if(!m_pFile) ThrowError(_T("m_pFile is NULL"));
+ if(!m_pFile->GetRemaining()) return EOS;
+ return (int)m_pFile->BitRead(8);
+ }
+ };
}
int CSSFSplitterFilter::SegmentItemEx::Compare(const void* a, const void* b)
{
- const SegmentItemEx* si1 = (const SegmentItemEx*)a;
- const SegmentItemEx* si2 = (const SegmentItemEx*)b;
- if(si1->start < si2->start) return -1;
- if(si2->start < si1->start) return +1;
- return 0;
+ const SegmentItemEx* si1 = (const SegmentItemEx*)a;
+ const SegmentItemEx* si2 = (const SegmentItemEx*)b;
+ if(si1->start < si2->start) return -1;
+ if(si2->start < si1->start) return +1;
+ return 0;
}
//
@@ -108,154 +108,142 @@ int CSSFSplitterFilter::SegmentItemEx::Compare(const void* a, const void* b)
//
CSSFSplitterFilter::CSSFSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CSSFSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CSSFSplitterFilter"), pUnk, phr, __uuidof(this))
{
}
HRESULT CSSFSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
{
- CheckPointer(pAsyncReader, E_POINTER);
-
- HRESULT hr = E_FAIL;
-
- m_pFile.Free();
- m_pFile.Attach(DNew CBaseSplitterFile(pAsyncReader, hr));
- if(!m_pFile) return E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pFile.Free();
- return hr;
- }
-
- try
- {
- m_ssf.Parse(ssf::InputStreamBSF(m_pFile));
- }
- catch(ssf::Exception&)
- {
- return E_FAIL;
- }
-
- //
-
- m_rtNewStart = m_rtCurrent = 0;
- m_rtNewStop = m_rtStop = m_rtDuration = 0;
-
- if(ssf::Reference* pRootRef = m_ssf.GetRootRef())
- {
- ssf::WCharOutputStream s;
- ssf::StringMapW<float> offset;
-
- POSITION pos = pRootRef->m_nodes.GetHeadPosition();
- while(pos)
- {
- if(ssf::Definition* pDef = dynamic_cast<ssf::Definition*>(pRootRef->m_nodes.GetNext(pos)))
- {
- try
- {
- ssf::Definition::Time time;
-
- if(pDef->m_type == L"subtitle" && pDef->GetAsTime(time, offset) && (*pDef)[L"@"].IsValue())
- {
- SegmentItemEx si;
- si.pDef = pDef;
- si.start = time.start.value;
- si.stop = time.stop.value;
- m_subs.AddTail(si);
-
- // m_ssf.SetTime(pDef, si.start, si.stop);
-
- continue;
- }
- }
- catch(ssf::Exception&)
- {
- }
-
- pDef->Dump(s);
- }
- }
-
- CStringA hdr = UTF16To8(s.GetString());
-
- CAtlArray<CMediaType> mts;
-
- CMediaType mt;
- mt.majortype = MEDIATYPE_Subtitle;
- mt.subtype = MEDIASUBTYPE_SSF;
- mt.formattype = FORMAT_SubtitleInfo;
- SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength() + 3);
- memset(si, 0, sizeof(*si));
- si->dwOffset = sizeof(*si);
- BYTE* p = (BYTE*)(si + 1);
- p[0] = 0xef;
- p[1] = 0xbb;
- p[2] = 0xbf;
- memcpy(&p[3], (LPCSTR)hdr, hdr.GetLength());
- mts.Add(mt);
-
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Output", this, this, &hr));
- EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(0, pPinOut)));
-
- CAtlArray<SegmentItemEx> subs;
- subs.SetCount(m_subs.GetCount());
- pos = m_subs.GetHeadPosition();
- for(size_t i = 0; pos; i++) subs.SetAt(i, m_subs.GetNext(pos));
- qsort(subs.GetData(), subs.GetCount(), sizeof(SegmentItemEx), SegmentItemEx::Compare);
- m_subs.RemoveAll();
- for(size_t i = 0; i < subs.GetCount(); i++) m_subs.AddTail(subs[i]);
-
- if(!m_ssf.m_segments.IsEmpty())
- {
- m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64 * m_ssf.m_segments.GetTail().m_stop;
- }
- }
-
- return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pFile.Attach(DNew CBaseSplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ try {m_ssf.Parse(ssf::InputStreamBSF(m_pFile));}
+ catch(ssf::Exception&) {return E_FAIL;}
+
+ //
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ if(ssf::Reference* pRootRef = m_ssf.GetRootRef())
+ {
+ ssf::WCharOutputStream s;
+ ssf::StringMapW<float> offset;
+
+ POSITION pos = pRootRef->m_nodes.GetHeadPosition();
+ while(pos)
+ {
+ if(ssf::Definition* pDef = dynamic_cast<ssf::Definition*>(pRootRef->m_nodes.GetNext(pos)))
+ {
+ try
+ {
+ ssf::Definition::Time time;
+
+ if(pDef->m_type == L"subtitle" && pDef->GetAsTime(time, offset) && (*pDef)[L"@"].IsValue())
+ {
+ SegmentItemEx si;
+ si.pDef = pDef;
+ si.start = time.start.value;
+ si.stop = time.stop.value;
+ m_subs.AddTail(si);
+
+ // m_ssf.SetTime(pDef, si.start, si.stop);
+
+ continue;
+ }
+ }
+ catch(ssf::Exception&)
+ {
+ }
+
+ pDef->Dump(s);
+ }
+ }
+
+ CStringA hdr = UTF16To8(s.GetString());
+
+ CAtlArray<CMediaType> mts;
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.subtype = MEDIASUBTYPE_SSF;
+ mt.formattype = FORMAT_SubtitleInfo;
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength() + 3);
+ memset(si, 0, sizeof(*si));
+ si->dwOffset = sizeof(*si);
+ BYTE* p = (BYTE*)(si+1);
+ p[0] = 0xef; p[1] = 0xbb; p[2] = 0xbf;
+ memcpy(&p[3], (LPCSTR)hdr, hdr.GetLength());
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CBaseSplitterOutputPin(mts, L"Output", this, this, &hr));
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(0, pPinOut)));
+
+ CAtlArray<SegmentItemEx> subs;
+ subs.SetCount(m_subs.GetCount());
+ pos = m_subs.GetHeadPosition();
+ for(size_t i = 0; pos; i++) subs.SetAt(i, m_subs.GetNext(pos));
+ qsort(subs.GetData(), subs.GetCount(), sizeof(SegmentItemEx), SegmentItemEx::Compare);
+ m_subs.RemoveAll();
+ for(size_t i = 0; i < subs.GetCount(); i++) m_subs.AddTail(subs[i]);
+
+ if(!m_ssf.m_segments.IsEmpty())
+ {
+ m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64*m_ssf.m_segments.GetTail().m_stop;
+ }
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
}
bool CSSFSplitterFilter::DemuxInit()
{
- return true;
+ return true;
}
void CSSFSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
{
- if(rt <= 0)
- {
- }
- else
- {
- // TODO
- }
+ if(rt <= 0)
+ {
+ }
+ else
+ {
+ // TODO
+ }
}
bool CSSFSplitterFilter::DemuxLoop()
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- POSITION pos = m_subs.GetHeadPosition();
+ POSITION pos = m_subs.GetHeadPosition();
- while(pos && SUCCEEDED(hr) && !CheckRequest(NULL))
- {
- SegmentItemEx& si = m_subs.GetNext(pos);
+ while(pos && SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ SegmentItemEx& si = m_subs.GetNext(pos);
- ssf::WCharOutputStream s;
- si.pDef->Dump(s);
- CStringA& str = UTF16To8(s.GetString());
+ ssf::WCharOutputStream s;
+ si.pDef->Dump(s);
+ CStringA& str = UTF16To8(s.GetString());
- CAutoPtr<Packet> p(DNew Packet());
+ CAutoPtr<Packet> p(DNew Packet());
- p->TrackNumber = 0;
- p->bSyncPoint = TRUE; // TODO
- p->rtStart = 10000000i64 * si.start;
- p->rtStop = 10000000i64 * si.stop;
- p->SetData((LPCSTR)str, str.GetLength());
+ p->TrackNumber = 0;
+ p->bSyncPoint = TRUE; // TODO
+ p->rtStart = 10000000i64*si.start;
+ p->rtStop = 10000000i64*si.stop;
+ p->SetData((LPCSTR)str, str.GetLength());
- hr = DeliverPacket(p);
- }
+ hr = DeliverPacket(p);
+ }
- return true;
+ return true;
}
//
@@ -263,8 +251,8 @@ bool CSSFSplitterFilter::DemuxLoop()
//
CSSFSourceFilter::CSSFSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CSSFSplitterFilter(pUnk, phr)
+ : CSSFSplitterFilter(pUnk, phr)
{
- m_clsid = __uuidof(this);
- m_pInput.Free();
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
}
diff --git a/src/filters/parser/SSFSplitter/SSFSplitter.h b/src/filters/parser/SSFSplitter/SSFSplitter.h
index 26b6ae48a..abd82b5fe 100644
--- a/src/filters/parser/SSFSplitter/SSFSplitter.h
+++ b/src/filters/parser/SSFSplitter/SSFSplitter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,31 +27,31 @@
[uuid("95C3F9F6-1E05-4C34-8122-504476EACB51")]
class CSSFSplitterFilter : public CBaseSplitterFilter
{
- CAutoPtr<CBaseSplitterFile> m_pFile;
+ CAutoPtr<CBaseSplitterFile> m_pFile;
- ssf::SubtitleFile m_ssf;
+ ssf::SubtitleFile m_ssf;
- struct SegmentItemEx : public ssf::SubtitleFile::SegmentItem
- {
- static int Compare(const void* a, const void* b);
- };
+ struct SegmentItemEx : public ssf::SubtitleFile::SegmentItem
+ {
+ static int Compare(const void* a, const void* b);
+ };
- CAtlList<SegmentItemEx> m_subs;
+ CAtlList<SegmentItemEx> m_subs;
protected:
- HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
- bool DemuxInit();
- void DemuxSeek(REFERENCE_TIME rt);
- bool DemuxLoop();
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
public:
- CSSFSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CSSFSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
[uuid("57F46A2A-6DC9-4A9F-B5FA-DFDD62B8BAFB")]
class CSSFSourceFilter : public CSSFSplitterFilter
{
public:
- CSSFSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ CSSFSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
};
diff --git a/src/filters/parser/SSFSplitter/resource.h b/src/filters/parser/SSFSplitter/resource.h
index 67ed4aab3..ac2936f6e 100644
--- a/src/filters/parser/SSFSplitter/resource.h
+++ b/src/filters/parser/SSFSplitter/resource.h
@@ -3,7 +3,7 @@
// Used by SSFSplitter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/SSFSplitter/stdafx.cpp b/src/filters/parser/SSFSplitter/stdafx.cpp
index b52e42b40..924d2f316 100644
--- a/src/filters/parser/SSFSplitter/stdafx.cpp
+++ b/src/filters/parser/SSFSplitter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/SSFSplitter/stdafx.h b/src/filters/parser/SSFSplitter/stdafx.h
index 5eae4881c..043e18b3c 100644
--- a/src/filters/parser/SSFSplitter/stdafx.h
+++ b/src/filters/parser/SSFSplitter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp b/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp
index 8d80b2720..571bea2ca 100644
--- a/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp
+++ b/src/filters/parser/StreamDriveThru/StreamDriveThru.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,12 +27,12 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -43,24 +43,24 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CStreamDriveThruFilter), L"MPC - StreamDriveThru", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CStreamDriveThruFilter), L"MPC - StreamDriveThru", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CStreamDriveThruFilter>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CStreamDriveThruFilter>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -74,290 +74,272 @@ CFilterApp theApp;
//
CStreamDriveThruFilter::CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseFilter(NAME("CStreamDriveThruFilter"), pUnk, &m_csLock, __uuidof(this))
- , m_position(0)
+ : CBaseFilter(NAME("CStreamDriveThruFilter"), pUnk, &m_csLock, __uuidof(this))
+ , m_position(0)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- m_pInput = DNew CStreamDriveThruInputPin(NAME("CStreamDriveThruInputPin"), this, &m_csLock, phr);
- m_pOutput = DNew CStreamDriveThruOutputPin(NAME("CStreamDriveThruOutputPin"), this, &m_csLock, phr);
+ m_pInput = DNew CStreamDriveThruInputPin(NAME("CStreamDriveThruInputPin"), this, &m_csLock, phr);
+ m_pOutput = DNew CStreamDriveThruOutputPin(NAME("CStreamDriveThruOutputPin"), this, &m_csLock, phr);
- CAMThread::Create();
+ CAMThread::Create();
}
CStreamDriveThruFilter::~CStreamDriveThruFilter()
{
- CAutoLock csAutoLock(&m_csLock);
+ CAutoLock csAutoLock(&m_csLock);
- CAMThread::CallWorker(CMD_EXIT);
- CAMThread::Close();
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
- delete m_pInput;
- delete m_pOutput;
+ delete m_pInput;
+ delete m_pOutput;
}
STDMETHODIMP CStreamDriveThruFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- QI(IMediaSeeking)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IMediaSeeking)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
#define PACKETSIZE 65536
DWORD CStreamDriveThruFilter::ThreadProc()
{
- while(1)
- {
- DWORD cmd = GetRequest();
-
- switch(cmd)
- {
- default:
- case CMD_EXIT:
- Reply(S_OK);
- return 0;
- case CMD_STOP:
- Reply(S_OK);
- break;
- case CMD_PAUSE:
- Reply(S_OK);
- break;
- case CMD_RUN:
- Reply(S_OK);
-
- do
- {
- CComPtr<IAsyncReader> pAsyncReader;
- CComPtr<IStream> pStream;
-
- if(!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
- || !m_pOutput || !m_pOutput->IsConnected() || FAILED(m_pOutput->GetStream(&pStream)))
- break;
-
- LARGE_INTEGER li = {0};
- ULARGE_INTEGER uli = {0};
-
- if(FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
- || FAILED(pStream->SetSize(uli)))
- break;
-
- if(CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected()))
- {
- pFSF->SetMode(AM_FILE_OVERWRITE);
-
- LPOLESTR pfn;
- if(SUCCEEDED(pFSF->GetCurFile(&pfn, NULL)))
- {
- pFSF->SetFileName(pfn, NULL);
- CoTaskMemFree(pfn);
- }
- }
-
- m_position = 0;
- BYTE buff[PACKETSIZE];
-
- do
- {
- while(!CheckRequest(&cmd))
- {
- CAutoLock csAutoLock(&m_csLock);
-
- LONGLONG total = 0, available = 0;
- if(FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total)
- {
- cmd = CMD_STOP;
- break;
- }
-
- LONG size = (LONG)min(PACKETSIZE, total - m_position);
- if(FAILED(pAsyncReader->SyncRead(m_position, size, buff)))
- {
- cmd = CMD_STOP;
- break;
- }
-
- ULONG written = 0;
- if(FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written)
- {
- cmd = CMD_STOP;
- break;
- }
-
- m_position += size;
- }
-
- if(cmd == CMD_PAUSE)
- {
- Reply(S_OK); // reply to CMD_PAUSE
-
- while(!CheckRequest(&cmd))
- Sleep(50);
-
- Reply(S_OK); // reply to something
- }
- }
- while(cmd == CMD_RUN);
-
- uli.QuadPart = m_position;
- pStream->SetSize(uli);
-
- if(CComPtr<IPin> pPin = m_pOutput->GetConnected())
- pPin->EndOfStream();
- }
- while(false);
-
- break;
- }
- }
-
- return 0;
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ Reply(S_OK);
+ return 0;
+ case CMD_STOP:
+ Reply(S_OK);
+ break;
+ case CMD_PAUSE:
+ Reply(S_OK);
+ break;
+ case CMD_RUN:
+ Reply(S_OK);
+
+ do
+ {
+ CComPtr<IAsyncReader> pAsyncReader;
+ CComPtr<IStream> pStream;
+
+ if(!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
+ || !m_pOutput || !m_pOutput->IsConnected() || FAILED(m_pOutput->GetStream(&pStream)))
+ break;
+
+ LARGE_INTEGER li = {0};
+ ULARGE_INTEGER uli = {0};
+
+ if(FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
+ || FAILED(pStream->SetSize(uli)))
+ break;
+
+ if(CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected()))
+ {
+ pFSF->SetMode(AM_FILE_OVERWRITE);
+
+ LPOLESTR pfn;
+ if(SUCCEEDED(pFSF->GetCurFile(&pfn, NULL)))
+ {
+ pFSF->SetFileName(pfn, NULL);
+ CoTaskMemFree(pfn);
+ }
+ }
+
+ m_position = 0;
+ BYTE buff[PACKETSIZE];
+
+ do
+ {
+ while(!CheckRequest(&cmd))
+ {
+ CAutoLock csAutoLock(&m_csLock);
+
+ LONGLONG total = 0, available = 0;
+ if(FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total)
+ {
+ cmd = CMD_STOP;
+ break;
+ }
+
+ LONG size = (LONG)min(PACKETSIZE, total - m_position);
+ if(FAILED(pAsyncReader->SyncRead(m_position, size, buff)))
+ {
+ cmd = CMD_STOP;
+ break;
+ }
+
+ ULONG written = 0;
+ if(FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written)
+ {
+ cmd = CMD_STOP;
+ break;
+ }
+
+ m_position += size;
+ }
+
+ if(cmd == CMD_PAUSE)
+ {
+ Reply(S_OK); // reply to CMD_PAUSE
+
+ while(!CheckRequest(&cmd))
+ Sleep(50);
+
+ Reply(S_OK); // reply to something
+ }
+ }
+ while(cmd == CMD_RUN);
+
+ uli.QuadPart = m_position;
+ pStream->SetSize(uli);
+
+ if(CComPtr<IPin> pPin = m_pOutput->GetConnected())
+ pPin->EndOfStream();
+ }
+ while(false);
+
+ break;
+ }
+ }
+
+ return 0;
}
int CStreamDriveThruFilter::GetPinCount()
{
- return 2;
+ return 2;
}
CBasePin* CStreamDriveThruFilter::GetPin(int n)
{
CAutoLock csAutoLock(&m_csLock);
- if(n == 0) return m_pInput;
- else if(n == 1) return m_pOutput;
+ if(n == 0) return m_pInput;
+ else if(n == 1) return m_pOutput;
return NULL;
}
STDMETHODIMP CStreamDriveThruFilter::Stop()
{
- HRESULT hr;
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Stop()))
+ return hr;
- if(FAILED(hr = __super::Stop()))
- return hr;
+ CallWorker(CMD_STOP);
- CallWorker(CMD_STOP);
-
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamDriveThruFilter::Pause()
{
- HRESULT hr;
-
- if(FAILED(hr = __super::Pause()))
- return hr;
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Pause()))
+ return hr;
- CallWorker(CMD_PAUSE);
+ CallWorker(CMD_PAUSE);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamDriveThruFilter::Run(REFERENCE_TIME tStart)
{
- HRESULT hr;
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Run(tStart)))
+ return hr;
- if(FAILED(hr = __super::Run(tStart)))
- return hr;
+ CallWorker(CMD_RUN);
- CallWorker(CMD_RUN);
-
- return S_OK;
+ return S_OK;
}
// IMediaSeeking
STDMETHODIMP CStreamDriveThruFilter::GetCapabilities(DWORD* pCapabilities)
{
- return pCapabilities ? *pCapabilities = AM_SEEKING_CanGetCurrentPos | AM_SEEKING_CanGetStopPos | AM_SEEKING_CanGetDuration, S_OK : E_POINTER;
+ return pCapabilities ? *pCapabilities = AM_SEEKING_CanGetCurrentPos|AM_SEEKING_CanGetStopPos|AM_SEEKING_CanGetDuration, S_OK : E_POINTER;
}
STDMETHODIMP CStreamDriveThruFilter::CheckCapabilities(DWORD* pCapabilities)
{
- CheckPointer(pCapabilities, E_POINTER);
+ CheckPointer(pCapabilities, E_POINTER);
- if(*pCapabilities == 0) return S_OK;
+ if(*pCapabilities == 0) return S_OK;
- DWORD caps;
- GetCapabilities(&caps);
+ DWORD caps;
+ GetCapabilities(&caps);
- DWORD caps2 = caps & *pCapabilities;
+ DWORD caps2 = caps & *pCapabilities;
- return caps2 == 0 ? E_FAIL : caps2 == *pCapabilities ? S_OK : S_FALSE;
+ return caps2 == 0 ? E_FAIL : caps2 == *pCapabilities ? S_OK : S_FALSE;
}
STDMETHODIMP CStreamDriveThruFilter::IsFormatSupported(const GUID* pFormat)
{
- return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
+ return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
}
STDMETHODIMP CStreamDriveThruFilter::QueryPreferredFormat(GUID* pFormat)
{
- return GetTimeFormat(pFormat);
+ return GetTimeFormat(pFormat);
}
STDMETHODIMP CStreamDriveThruFilter::GetTimeFormat(GUID* pFormat)
{
- return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
+ return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
}
STDMETHODIMP CStreamDriveThruFilter::IsUsingTimeFormat(const GUID* pFormat)
{
- return IsFormatSupported(pFormat);
+ return IsFormatSupported(pFormat);
}
STDMETHODIMP CStreamDriveThruFilter::SetTimeFormat(const GUID* pFormat)
{
- return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
+ return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
}
STDMETHODIMP CStreamDriveThruFilter::GetDuration(LONGLONG* pDuration)
{
- CheckPointer(pDuration, E_POINTER);
- CheckPointer(m_pInput, VFW_E_NOT_CONNECTED);
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pInput, VFW_E_NOT_CONNECTED);
- if(CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected())
- {
- LONGLONG total, available;
- if(SUCCEEDED(pAsyncReader->Length(&total, &available)))
- {
- *pDuration = total;
- return S_OK;
- }
- }
+ if(CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected())
+ {
+ LONGLONG total, available;
+ if(SUCCEEDED(pAsyncReader->Length(&total, &available)))
+ {
+ *pDuration = total;
+ return S_OK;
+ }
+ }
- return E_NOINTERFACE;
+ return E_NOINTERFACE;
}
STDMETHODIMP CStreamDriveThruFilter::GetStopPosition(LONGLONG* pStop)
{
- return GetDuration(pStop);
+ return GetDuration(pStop);
}
STDMETHODIMP CStreamDriveThruFilter::GetCurrentPosition(LONGLONG* pCurrent)
{
- return pCurrent ? *pCurrent = m_position, S_OK : E_POINTER;
-}
-STDMETHODIMP CStreamDriveThruFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CStreamDriveThruFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CStreamDriveThruFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CStreamDriveThruFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CStreamDriveThruFilter::SetRate(double dRate)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CStreamDriveThruFilter::GetRate(double* pdRate)
-{
- return E_NOTIMPL;
+ return pCurrent ? *pCurrent = m_position, S_OK : E_POINTER;
}
+STDMETHODIMP CStreamDriveThruFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
STDMETHODIMP CStreamDriveThruFilter::GetPreroll(LONGLONG* pllPreroll)
{
- return pllPreroll ? *pllPreroll = 0, S_OK : E_POINTER;
+ return pllPreroll ? *pllPreroll = 0, S_OK : E_POINTER;
}
//
@@ -365,7 +347,7 @@ STDMETHODIMP CStreamDriveThruFilter::GetPreroll(LONGLONG* pllPreroll)
//
CStreamDriveThruInputPin::CStreamDriveThruInputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBasePin(pName, pFilter, pLock, phr, L"Input", PINDIR_INPUT)
+ : CBasePin(pName, pFilter, pLock, phr, L"Input", PINDIR_INPUT)
{
}
@@ -375,79 +357,79 @@ CStreamDriveThruInputPin::~CStreamDriveThruInputPin()
HRESULT CStreamDriveThruInputPin::GetAsyncReader(IAsyncReader** ppAsyncReader)
{
- CheckPointer(ppAsyncReader, E_POINTER);
+ CheckPointer(ppAsyncReader, E_POINTER);
- *ppAsyncReader = NULL;
+ *ppAsyncReader = NULL;
- CheckPointer(m_pAsyncReader, VFW_E_NOT_CONNECTED);
+ CheckPointer(m_pAsyncReader, VFW_E_NOT_CONNECTED);
- (*ppAsyncReader = m_pAsyncReader)->AddRef();
+ (*ppAsyncReader = m_pAsyncReader)->AddRef();
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamDriveThruInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CStreamDriveThruInputPin::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Stream
- ? S_OK
- : E_INVALIDARG;
+ return pmt->majortype == MEDIATYPE_Stream
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CStreamDriveThruInputPin::CheckConnect(IPin* pPin)
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin)))
- return hr;
+ if(FAILED(hr = __super::CheckConnect(pPin)))
+ return hr;
- if(!CComQIPtr<IAsyncReader>(pPin))
- return E_NOINTERFACE;
+ if(!CComQIPtr<IAsyncReader>(pPin))
+ return E_NOINTERFACE;
- return S_OK;
+ return S_OK;
}
HRESULT CStreamDriveThruInputPin::BreakConnect()
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::BreakConnect()))
- return hr;
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
- m_pAsyncReader.Release();
+ m_pAsyncReader.Release();
- return S_OK;
+ return S_OK;
}
HRESULT CStreamDriveThruInputPin::CompleteConnect(IPin* pPin)
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin)))
- return hr;
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
- CheckPointer(pPin, E_POINTER);
- m_pAsyncReader = pPin;
- CheckPointer(m_pAsyncReader, E_NOINTERFACE);
+ CheckPointer(pPin, E_POINTER);
+ m_pAsyncReader = pPin;
+ CheckPointer(m_pAsyncReader, E_NOINTERFACE);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamDriveThruInputPin::BeginFlush()
{
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
STDMETHODIMP CStreamDriveThruInputPin::EndFlush()
{
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
//
@@ -455,7 +437,7 @@ STDMETHODIMP CStreamDriveThruInputPin::EndFlush()
//
CStreamDriveThruOutputPin::CStreamDriveThruOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
+ : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
{
}
@@ -465,23 +447,23 @@ CStreamDriveThruOutputPin::~CStreamDriveThruOutputPin()
HRESULT CStreamDriveThruOutputPin::GetStream(IStream** ppStream)
{
- CheckPointer(ppStream, E_POINTER);
+ CheckPointer(ppStream, E_POINTER);
- *ppStream = NULL;
+ *ppStream = NULL;
- CheckPointer(m_pStream, VFW_E_NOT_CONNECTED);
+ CheckPointer(m_pStream, VFW_E_NOT_CONNECTED);
- (*ppStream = m_pStream)->AddRef();
+ (*ppStream = m_pStream)->AddRef();
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamDriveThruOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv, E_POINTER);
- return
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CStreamDriveThruOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -491,8 +473,8 @@ HRESULT CStreamDriveThruOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOC
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = PACKETSIZE;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = PACKETSIZE;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -505,76 +487,76 @@ HRESULT CStreamDriveThruOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOC
HRESULT CStreamDriveThruOutputPin::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Stream
- ? S_OK
- : E_INVALIDARG;
+ return pmt->majortype == MEDIATYPE_Stream
+ ? S_OK
+ : E_INVALIDARG;
}
HRESULT CStreamDriveThruOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pLock);
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- pmt->majortype = MEDIATYPE_Stream;
- pmt->subtype = GUID_NULL;
- pmt->formattype = GUID_NULL;
- pmt->SetSampleSize(PACKETSIZE);
+ pmt->majortype = MEDIATYPE_Stream;
+ pmt->subtype = GUID_NULL;
+ pmt->formattype = GUID_NULL;
+ pmt->SetSampleSize(PACKETSIZE);
- return S_OK;
+ return S_OK;
}
HRESULT CStreamDriveThruOutputPin::CheckConnect(IPin* pPin)
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::CheckConnect(pPin)))
- return hr;
+ if(FAILED(hr = __super::CheckConnect(pPin)))
+ return hr;
- if(!CComQIPtr<IStream>(pPin))
- return E_NOINTERFACE;
+ if(!CComQIPtr<IStream>(pPin))
+ return E_NOINTERFACE;
- return S_OK;
+ return S_OK;
}
HRESULT CStreamDriveThruOutputPin::BreakConnect()
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::BreakConnect()))
- return hr;
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
- m_pStream.Release();
+ m_pStream.Release();
- return S_OK;
+ return S_OK;
}
HRESULT CStreamDriveThruOutputPin::CompleteConnect(IPin* pPin)
{
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = __super::CompleteConnect(pPin)))
- return hr;
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
- CheckPointer(pPin, E_POINTER);
- m_pStream = pPin;
- CheckPointer(m_pStream, E_NOINTERFACE);
+ CheckPointer(pPin, E_POINTER);
+ m_pStream = pPin;
+ CheckPointer(m_pStream, E_NOINTERFACE);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamDriveThruOutputPin::BeginFlush()
{
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
STDMETHODIMP CStreamDriveThruOutputPin::EndFlush()
{
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
STDMETHODIMP CStreamDriveThruOutputPin::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
diff --git a/src/filters/parser/StreamDriveThru/StreamDriveThru.h b/src/filters/parser/StreamDriveThru/StreamDriveThru.h
index 042b66c53..08a2ebe16 100644
--- a/src/filters/parser/StreamDriveThru/StreamDriveThru.h
+++ b/src/filters/parser/StreamDriveThru/StreamDriveThru.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,38 +27,38 @@
class CStreamDriveThruInputPin : public CBasePin
{
- CComQIPtr<IAsyncReader> m_pAsyncReader;
+ CComQIPtr<IAsyncReader> m_pAsyncReader;
public:
- CStreamDriveThruInputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CStreamDriveThruInputPin();
+ CStreamDriveThruInputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CStreamDriveThruInputPin();
- HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
+ HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT CheckMediaType(const CMediaType* pmt);
HRESULT CheckConnect(IPin* pPin);
HRESULT BreakConnect();
- HRESULT CompleteConnect(IPin* pPin);
+ HRESULT CompleteConnect(IPin* pPin);
- STDMETHODIMP BeginFlush();
- STDMETHODIMP EndFlush();
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
};
class CStreamDriveThruOutputPin : public CBaseOutputPin
{
- CComQIPtr<IStream> m_pStream;
+ CComQIPtr<IStream> m_pStream;
public:
- CStreamDriveThruOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
- virtual ~CStreamDriveThruOutputPin();
+ CStreamDriveThruOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CStreamDriveThruOutputPin();
- HRESULT GetStream(IStream** ppStream);
+ HRESULT GetStream(IStream** ppStream);
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
@@ -70,58 +70,58 @@ public:
HRESULT BreakConnect();
HRESULT CompleteConnect(IPin* pPin);
- STDMETHODIMP BeginFlush();
- STDMETHODIMP EndFlush();
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
[uuid("534FE6FD-F1F0-4aec-9F45-FF397320CE33")]
class CStreamDriveThruFilter : public CBaseFilter, protected CAMThread, public IMediaSeeking
{
- CCritSec m_csLock;
+ CCritSec m_csLock;
- CStreamDriveThruInputPin* m_pInput;
- CStreamDriveThruOutputPin* m_pOutput;
+ CStreamDriveThruInputPin* m_pInput;
+ CStreamDriveThruOutputPin* m_pOutput;
protected:
- enum {CMD_EXIT, CMD_STOP, CMD_PAUSE, CMD_RUN};
+ enum {CMD_EXIT, CMD_STOP, CMD_PAUSE, CMD_RUN};
DWORD ThreadProc();
- LONGLONG m_position;
+ LONGLONG m_position;
public:
- CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr);
- virtual ~CStreamDriveThruFilter();
+ CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CStreamDriveThruFilter();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- int GetPinCount();
- CBasePin* GetPin(int n);
-
- STDMETHODIMP Stop();
- STDMETHODIMP Pause();
- STDMETHODIMP Run(REFERENCE_TIME tStart);
-
- // IMediaSeeking
-
- STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
- STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
- STDMETHODIMP IsFormatSupported(const GUID* pFormat);
- STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
- STDMETHODIMP GetTimeFormat(GUID* pFormat);
- STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
- STDMETHODIMP SetTimeFormat(const GUID* pFormat);
- STDMETHODIMP GetDuration(LONGLONG* pDuration);
- STDMETHODIMP GetStopPosition(LONGLONG* pStop);
- STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
- STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
- STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
- STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
- STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
- STDMETHODIMP SetRate(double dRate);
- STDMETHODIMP GetRate(double* pdRate);
- STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
};
diff --git a/src/filters/parser/StreamDriveThru/resource.h b/src/filters/parser/StreamDriveThru/resource.h
index eb1073cda..16eef629e 100644
--- a/src/filters/parser/StreamDriveThru/resource.h
+++ b/src/filters/parser/StreamDriveThru/resource.h
@@ -3,7 +3,7 @@
// Used by streamdrivethru.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/parser/StreamDriveThru/stdafx.cpp b/src/filters/parser/StreamDriveThru/stdafx.cpp
index d774a068d..6915aebce 100644
--- a/src/filters/parser/StreamDriveThru/stdafx.cpp
+++ b/src/filters/parser/StreamDriveThru/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/parser/StreamDriveThru/stdafx.h b/src/filters/parser/StreamDriveThru/stdafx.h
index 3e12d9514..e0482b2bb 100644
--- a/src/filters/parser/StreamDriveThru/stdafx.h
+++ b/src/filters/parser/StreamDriveThru/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/CDDAReader/CDDAReader.cpp b/src/filters/reader/CDDAReader/CDDAReader.cpp
index 3f83ec737..193451274 100644
--- a/src/filters/reader/CDDAReader/CDDAReader.cpp
+++ b/src/filters/reader/CDDAReader/CDDAReader.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -31,55 +31,55 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CCDDAReader), L"MPC - CDDA Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CCDDAReader), L"MPC - CDDA Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CCDDAReader>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CCDDAReader>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- if(GetVersion() & 0x80000000)
- {
- ::MessageBox(NULL, _T("Sorry, this will only run on Windows NT based operating system."), _T("CDDA Reader"), MB_OK);
- return E_NOTIMPL;
- }
+ if(GetVersion()&0x80000000)
+ {
+ ::MessageBox(NULL, _T("Sorry, this will only run on Windows NT based operating system."), _T("CDDA Reader"), MB_OK);
+ return E_NOTIMPL;
+ }
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"),
- _T("0"), _T("0,4,,52494646,8,4,,43444441")); // "RIFFxxxxCDDA"
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"),
+ _T("0"), _T("0,4,,52494646,8,4,,43444441")); // "RIFFxxxxCDDA"
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"),
- _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"),
+ _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".cda"),
- _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".cda"),
+ _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".cda"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".cda"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -93,15 +93,15 @@ CFilterApp theApp;
//
CCDDAReader::CCDDAReader(IUnknown* pUnk, HRESULT* phr)
- : CAsyncReader(NAME("CCDDAReader"), pUnk, &m_stream, phr, __uuidof(this))
+ : CAsyncReader(NAME("CCDDAReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- if(GetVersion() & 0x80000000)
- {
- if(phr) *phr = E_NOTIMPL;
- return;
- }
+ if(GetVersion()&0x80000000)
+ {
+ if(phr) *phr = E_NOTIMPL;
+ return;
+ }
}
CCDDAReader::~CCDDAReader()
@@ -112,355 +112,310 @@ STDMETHODIMP CCDDAReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IFileSourceFilter)
- QI2(IAMMediaContent)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ QI2(IAMMediaContent)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IFileSourceFilter
-STDMETHODIMP CCDDAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CCDDAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(!m_stream.Load(pszFileName))
- return E_FAIL;
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- CMediaType mt;
- mt.majortype = MEDIATYPE_Stream;
- mt.subtype = MEDIASUBTYPE_WAVE;
- m_mt = mt;
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = MEDIASUBTYPE_WAVE;
+ m_mt = mt;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CCDDAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- CheckPointer(ppszFileName, E_POINTER);
+ CheckPointer(ppszFileName, E_POINTER);
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ wcscpy(*ppszFileName, m_fn);
- wcscpy(*ppszFileName, m_fn);
-
- return S_OK;
+ return S_OK;
}
// IAMMediaContent
-STDMETHODIMP CCDDAReader::GetTypeInfoCount(UINT* pctinfo)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr)
-{
- return E_NOTIMPL;
-}
+STDMETHODIMP CCDDAReader::GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
STDMETHODIMP CCDDAReader::get_AuthorName(BSTR* pbstrAuthorName)
{
- CheckPointer(pbstrAuthorName, E_POINTER);
- CString str = m_stream.m_trackArtist;
- if(str.IsEmpty()) str = m_stream.m_discArtist;
- *pbstrAuthorName = str.AllocSysString();
- return S_OK;
+ CheckPointer(pbstrAuthorName, E_POINTER);
+ CString str = m_stream.m_trackArtist;
+ if(str.IsEmpty()) str = m_stream.m_discArtist;
+ *pbstrAuthorName = str.AllocSysString();
+ return S_OK;
}
STDMETHODIMP CCDDAReader::get_Title(BSTR* pbstrTitle)
{
- CheckPointer(pbstrTitle, E_POINTER);
- CString str = m_stream.m_trackTitle;
- if(str.IsEmpty()) str = m_stream.m_discTitle;
- *pbstrTitle = str.AllocSysString();
- return S_OK;
-}
-
-STDMETHODIMP CCDDAReader::get_Rating(BSTR* pbstrRating)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_Description(BSTR* pbstrDescription)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_Copyright(BSTR* pbstrCopyright)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_BaseURL(BSTR* pbstrBaseURL)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_LogoURL(BSTR* pbstrLogoURL)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_LogoIconURL(BSTR* pbstrLogoURL)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_WatermarkURL(BSTR* pbstrWatermarkURL)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_MoreInfoURL(BSTR* pbstrMoreInfoURL)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL)
-{
- return E_NOTIMPL;
-}
-STDMETHODIMP CCDDAReader::get_MoreInfoText(BSTR* pbstrMoreInfoText)
-{
- return E_NOTIMPL;
-}
+ CheckPointer(pbstrTitle, E_POINTER);
+ CString str = m_stream.m_trackTitle;
+ if(str.IsEmpty()) str = m_stream.m_discTitle;
+ *pbstrTitle = str.AllocSysString();
+ return S_OK;
+}
+
+STDMETHODIMP CCDDAReader::get_Rating(BSTR* pbstrRating) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_Description(BSTR* pbstrDescription) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_Copyright(BSTR* pbstrCopyright) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
// CCDDAStream
CCDDAStream::CCDDAStream()
{
- m_hDrive = INVALID_HANDLE_VALUE;
-
- m_llPosition = m_llLength = 0;
-
- memset(&m_TOC, 0, sizeof(m_TOC));
- m_nStartSector = m_nStopSector = 0;
-
- memset(&m_header, 0, sizeof(m_header));
- m_header.riff.hdr.chunkID = RIFFID;
- m_header.riff.WAVE = WAVEID;
- m_header.frm.hdr.chunkID = FormatID;
- m_header.frm.hdr.chunkSize = sizeof(m_header.frm.pcm);
- m_header.frm.pcm.wf.wFormatTag = WAVE_FORMAT_PCM;
- m_header.frm.pcm.wf.nSamplesPerSec = 44100;
- m_header.frm.pcm.wf.nChannels = 2;
- m_header.frm.pcm.wBitsPerSample = 16;
- m_header.frm.pcm.wf.nBlockAlign = m_header.frm.pcm.wf.nChannels * m_header.frm.pcm.wBitsPerSample / 8;
- m_header.frm.pcm.wf.nAvgBytesPerSec = m_header.frm.pcm.wf.nSamplesPerSec * m_header.frm.pcm.wf.nBlockAlign;
- m_header.data.hdr.chunkID = DataID;
+ m_hDrive = INVALID_HANDLE_VALUE;
+
+ m_llPosition = m_llLength = 0;
+
+ memset(&m_TOC, 0, sizeof(m_TOC));
+ m_nStartSector = m_nStopSector = 0;
+
+ memset(&m_header, 0, sizeof(m_header));
+ m_header.riff.hdr.chunkID = RIFFID;
+ m_header.riff.WAVE = WAVEID;
+ m_header.frm.hdr.chunkID = FormatID;
+ m_header.frm.hdr.chunkSize = sizeof(m_header.frm.pcm);
+ m_header.frm.pcm.wf.wFormatTag = WAVE_FORMAT_PCM;
+ m_header.frm.pcm.wf.nSamplesPerSec = 44100;
+ m_header.frm.pcm.wf.nChannels = 2;
+ m_header.frm.pcm.wBitsPerSample = 16;
+ m_header.frm.pcm.wf.nBlockAlign = m_header.frm.pcm.wf.nChannels * m_header.frm.pcm.wBitsPerSample / 8;
+ m_header.frm.pcm.wf.nAvgBytesPerSec = m_header.frm.pcm.wf.nSamplesPerSec * m_header.frm.pcm.wf.nBlockAlign;
+ m_header.data.hdr.chunkID = DataID;
}
CCDDAStream::~CCDDAStream()
{
- if(m_hDrive != INVALID_HANDLE_VALUE)
- {
- CloseHandle(m_hDrive);
- m_hDrive = INVALID_HANDLE_VALUE;
- }
+ if(m_hDrive != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ }
}
bool CCDDAStream::Load(const WCHAR* fnw)
{
- CString path(fnw);
-
- int iDriveLetter = path.Find(_T(":\\")) - 1;
- int iTrackIndex = CString(path).MakeLower().Find(_T(".cda")) - 1;
- if(iDriveLetter < 0 || iTrackIndex <= iDriveLetter)
- return(false);
-
- CString drive = CString(_T("\\\\.\\")) + path[iDriveLetter] + _T(":");
- while(iTrackIndex > 0 && _istdigit(path[iTrackIndex-1])) iTrackIndex--;
- if(1 != _stscanf(path.Mid(iTrackIndex), _T("%d"), &iTrackIndex))
- return(false);
-
- if(m_hDrive != INVALID_HANDLE_VALUE)
- {
- CloseHandle(m_hDrive);
- m_hDrive = INVALID_HANDLE_VALUE;
- }
-
- m_hDrive = CreateFile(drive, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
- if(m_hDrive == INVALID_HANDLE_VALUE)
- {
- return(false);
- }
-
- DWORD BytesReturned;
- if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC, NULL, 0, &m_TOC, sizeof(m_TOC), &BytesReturned, 0)
- || !(m_TOC.FirstTrack <= iTrackIndex && iTrackIndex <= m_TOC.LastTrack))
- {
- CloseHandle(m_hDrive);
- m_hDrive = INVALID_HANDLE_VALUE;
- return(false);
- }
-
- // MMC-3 Draft Revision 10g: Table 222 – Q Sub-channel control field
- m_TOC.TrackData[iTrackIndex-1].Control &= 5;
- if(!(m_TOC.TrackData[iTrackIndex-1].Control == 0 || m_TOC.TrackData[iTrackIndex-1].Control == 1))
- {
- CloseHandle(m_hDrive);
- m_hDrive = INVALID_HANDLE_VALUE;
- return(false);
- }
-
- if(m_TOC.TrackData[iTrackIndex-1].Control & 8)
- m_header.frm.pcm.wf.nChannels = 4;
-
- m_nStartSector = MSF2UINT(m_TOC.TrackData[iTrackIndex-1].Address) - 150;//MSF2UINT(m_TOC.TrackData[0].Address);
- m_nStopSector = MSF2UINT(m_TOC.TrackData[iTrackIndex].Address) - 150;//MSF2UINT(m_TOC.TrackData[0].Address);
-
- m_llLength = (m_nStopSector - m_nStartSector) * RAW_SECTOR_SIZE;
-
- m_header.riff.hdr.chunkSize = (long)(m_llLength + sizeof(m_header) - 8);
- m_header.data.hdr.chunkSize = (long)(m_llLength);
-
- do
- {
- CDROM_READ_TOC_EX TOCEx;
- memset(&TOCEx, 0, sizeof(TOCEx));
- TOCEx.Format = CDROM_READ_TOC_EX_FORMAT_CDTEXT;
- TOCEx.SessionTrack = iTrackIndex;
- WORD size = 0;
- ASSERT(MINIMUM_CDROM_READ_TOC_EX_SIZE == sizeof(size));
- if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), &size, sizeof(size), &BytesReturned, 0))
- break;
-
- size = ((size >> 8) | (size << 8)) + sizeof(size);
-
- CAutoVectorPtr<BYTE> pCDTextData;
- pCDTextData.Allocate(size);
- memset(pCDTextData, 0, size);
-
- if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), pCDTextData, size, &BytesReturned, 0))
- break;
-
- size = (WORD)(BytesReturned - sizeof(CDROM_TOC_CD_TEXT_DATA));
- CDROM_TOC_CD_TEXT_DATA_BLOCK* pDesc = ((CDROM_TOC_CD_TEXT_DATA*)(BYTE*)pCDTextData)->Descriptors;
-
- CStringArray str[16];
- for(int i = 0; i < 16; i++) str[i].SetSize(1 + m_TOC.LastTrack);
- CString last;
-
- for(int i = 0; size >= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK); i++, size -= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK), pDesc++)
- {
- if(pDesc->TrackNumber > m_TOC.LastTrack)
- continue;
-
- const int lenU = countof(pDesc->Text);
- const int lenW = countof(pDesc->WText);
-
- CString text = !pDesc->Unicode
- ? CString(CStringA((CHAR*)pDesc->Text, lenU))
- : CString(CStringW((WCHAR*)pDesc->WText, lenW));
-
- int tlen = text.GetLength();
- CString tmp = (tlen < 12 - 1)
- ? (!pDesc->Unicode
- ? CString(CStringA((CHAR*)pDesc->Text + tlen + 1, lenU - (tlen + 1)))
- : CString(CStringW((WCHAR*)pDesc->WText + tlen + 1, lenW - (tlen + 1))))
- : _T("");
-
- if((pDesc->PackType -= 0x80) >= 0x10)
- continue;
-
- if(pDesc->CharacterPosition == 0)
- {
- str[pDesc->PackType][pDesc->TrackNumber] = text;
- }
- else if(pDesc->CharacterPosition <= 0xf)
- {
- if(pDesc->CharacterPosition < 0xf && last.GetLength() > 0)
- {
- str[pDesc->PackType][pDesc->TrackNumber] = last + text;
- }
- else
- {
- str[pDesc->PackType][pDesc->TrackNumber] += text;
- }
- }
-
- last = tmp;
- }
-
- m_discTitle = str[0][0];
- m_trackTitle = str[0][iTrackIndex];
- m_discArtist = str[1][0];
- m_trackArtist = str[1][iTrackIndex];
- }
- while(0);
-
-
- return(true);
+ CString path(fnw);
+
+ int iDriveLetter = path.Find(_T(":\\"))-1;
+ int iTrackIndex = CString(path).MakeLower().Find(_T(".cda"))-1;
+ if(iDriveLetter < 0 || iTrackIndex <= iDriveLetter)
+ return(false);
+
+ CString drive = CString(_T("\\\\.\\")) + path[iDriveLetter] + _T(":");
+ while(iTrackIndex > 0 && _istdigit(path[iTrackIndex-1])) iTrackIndex--;
+ if(1 != _stscanf(path.Mid(iTrackIndex), _T("%d"), &iTrackIndex))
+ return(false);
+
+ if(m_hDrive != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ }
+
+ m_hDrive = CreateFile(drive, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
+ if(m_hDrive == INVALID_HANDLE_VALUE)
+ {
+ return(false);
+ }
+
+ DWORD BytesReturned;
+ if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC, NULL, 0, &m_TOC, sizeof(m_TOC), &BytesReturned, 0)
+ || !(m_TOC.FirstTrack <= iTrackIndex && iTrackIndex <= m_TOC.LastTrack))
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ // MMC-3 Draft Revision 10g: Table 222 – Q Sub-channel control field
+ m_TOC.TrackData[iTrackIndex-1].Control &= 5;
+ if(!(m_TOC.TrackData[iTrackIndex-1].Control == 0 || m_TOC.TrackData[iTrackIndex-1].Control == 1))
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ if(m_TOC.TrackData[iTrackIndex-1].Control&8)
+ m_header.frm.pcm.wf.nChannels = 4;
+
+ m_nStartSector = MSF2UINT(m_TOC.TrackData[iTrackIndex-1].Address) - 150;//MSF2UINT(m_TOC.TrackData[0].Address);
+ m_nStopSector = MSF2UINT(m_TOC.TrackData[iTrackIndex].Address) - 150;//MSF2UINT(m_TOC.TrackData[0].Address);
+
+ m_llLength = (m_nStopSector-m_nStartSector)*RAW_SECTOR_SIZE;
+
+ m_header.riff.hdr.chunkSize = (long)(m_llLength + sizeof(m_header) - 8);
+ m_header.data.hdr.chunkSize = (long)(m_llLength);
+
+ do
+ {
+ CDROM_READ_TOC_EX TOCEx;
+ memset(&TOCEx, 0, sizeof(TOCEx));
+ TOCEx.Format = CDROM_READ_TOC_EX_FORMAT_CDTEXT;
+ TOCEx.SessionTrack = iTrackIndex;
+ WORD size = 0;
+ ASSERT(MINIMUM_CDROM_READ_TOC_EX_SIZE == sizeof(size));
+ if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), &size, sizeof(size), &BytesReturned, 0))
+ break;
+
+ size = ((size>>8)|(size<<8)) + sizeof(size);
+
+ CAutoVectorPtr<BYTE> pCDTextData;
+ pCDTextData.Allocate(size);
+ memset(pCDTextData, 0, size);
+
+ if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), pCDTextData, size, &BytesReturned, 0))
+ break;
+
+ size = (WORD)(BytesReturned - sizeof(CDROM_TOC_CD_TEXT_DATA));
+ CDROM_TOC_CD_TEXT_DATA_BLOCK* pDesc = ((CDROM_TOC_CD_TEXT_DATA*)(BYTE*)pCDTextData)->Descriptors;
+
+ CStringArray str[16];
+ for(int i = 0; i < 16; i++) str[i].SetSize(1+m_TOC.LastTrack);
+ CString last;
+
+ for(int i = 0; size >= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK); i++, size -= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK), pDesc++)
+ {
+ if(pDesc->TrackNumber > m_TOC.LastTrack)
+ continue;
+
+ const int lenU = countof(pDesc->Text);
+ const int lenW = countof(pDesc->WText);
+
+ CString text = !pDesc->Unicode
+ ? CString(CStringA((CHAR*)pDesc->Text, lenU))
+ : CString(CStringW((WCHAR*)pDesc->WText, lenW));
+
+ int tlen = text.GetLength();
+ CString tmp = (tlen < 12-1)
+ ? (!pDesc->Unicode
+ ? CString(CStringA((CHAR*)pDesc->Text+tlen+1, lenU-(tlen+1)))
+ : CString(CStringW((WCHAR*)pDesc->WText+tlen+1, lenW-(tlen+1))))
+ : _T("");
+
+ if((pDesc->PackType -= 0x80) >= 0x10)
+ continue;
+
+ if(pDesc->CharacterPosition == 0)
+ {
+ str[pDesc->PackType][pDesc->TrackNumber] = text;
+ }
+ else if(pDesc->CharacterPosition <= 0xf)
+ {
+ if(pDesc->CharacterPosition < 0xf && last.GetLength() > 0)
+ {
+ str[pDesc->PackType][pDesc->TrackNumber] = last + text;
+ }
+ else
+ {
+ str[pDesc->PackType][pDesc->TrackNumber] += text;
+ }
+ }
+
+ last = tmp;
+ }
+
+ m_discTitle = str[0][0];
+ m_trackTitle = str[0][iTrackIndex];
+ m_discArtist = str[1][0];
+ m_trackArtist = str[1][iTrackIndex];
+ }
+ while(0);
+
+
+ return(true);
}
HRESULT CCDDAStream::SetPointer(LONGLONG llPos)
{
- if(llPos < 0 || llPos > m_llLength) return S_FALSE;
- m_llPosition = llPos;
- return S_OK;
+ if(llPos < 0 || llPos > m_llLength) return S_FALSE;
+ m_llPosition = llPos;
+ return S_OK;
}
HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
{
- CAutoLock lck(&m_csLock);
-
- BYTE buff[RAW_SECTOR_SIZE];
-
- PBYTE pbBufferOrg = pbBuffer;
- LONGLONG pos = m_llPosition;
- size_t len = (size_t)dwBytesToRead;
-
- if(pos < sizeof(m_header) && len > 0)
- {
- size_t l = (size_t)min(len, sizeof(m_header) - pos);
- memcpy(pbBuffer, &((BYTE*)&m_header)[pos], l);
- pbBuffer += l;
- pos += l;
- len -= l;
- }
-
- pos -= sizeof(m_header);
-
- while(pos >= 0 && pos < m_llLength && len > 0)
- {
- RAW_READ_INFO rawreadinfo;
- rawreadinfo.SectorCount = 1;
- rawreadinfo.TrackMode = CDDA;
-
- UINT sector = m_nStartSector + int(pos / RAW_SECTOR_SIZE);
- __int64 offset = pos % RAW_SECTOR_SIZE;
-
- rawreadinfo.DiskOffset.QuadPart = sector * 2048;
- DWORD BytesReturned = 0;
- BOOL b = DeviceIoControl(
- m_hDrive, IOCTL_CDROM_RAW_READ,
- &rawreadinfo, sizeof(rawreadinfo),
- buff, RAW_SECTOR_SIZE,
- &BytesReturned, 0);
-
- size_t l = (size_t)min(min(len, RAW_SECTOR_SIZE - offset), m_llLength - pos);
- memcpy(pbBuffer, &buff[offset], l);
-
- pbBuffer += l;
- pos += l;
- len -= l;
- }
-
- if(pdwBytesRead) *pdwBytesRead = pbBuffer - pbBufferOrg;
- m_llPosition += pbBuffer - pbBufferOrg;
-
- return S_OK;
+ CAutoLock lck(&m_csLock);
+
+ BYTE buff[RAW_SECTOR_SIZE];
+
+ PBYTE pbBufferOrg = pbBuffer;
+ LONGLONG pos = m_llPosition;
+ size_t len = (size_t)dwBytesToRead;
+
+ if(pos < sizeof(m_header) && len > 0)
+ {
+ size_t l = (size_t)min(len, sizeof(m_header) - pos);
+ memcpy(pbBuffer, &((BYTE*)&m_header)[pos], l);
+ pbBuffer += l;
+ pos += l;
+ len -= l;
+ }
+
+ pos -= sizeof(m_header);
+
+ while(pos >= 0 && pos < m_llLength && len > 0)
+ {
+ RAW_READ_INFO rawreadinfo;
+ rawreadinfo.SectorCount = 1;
+ rawreadinfo.TrackMode = CDDA;
+
+ UINT sector = m_nStartSector + int(pos/RAW_SECTOR_SIZE);
+ __int64 offset = pos%RAW_SECTOR_SIZE;
+
+ rawreadinfo.DiskOffset.QuadPart = sector*2048;
+ DWORD BytesReturned = 0;
+ BOOL b = DeviceIoControl(
+ m_hDrive, IOCTL_CDROM_RAW_READ,
+ &rawreadinfo, sizeof(rawreadinfo),
+ buff, RAW_SECTOR_SIZE,
+ &BytesReturned, 0);
+
+ size_t l = (size_t)min(min(len, RAW_SECTOR_SIZE - offset), m_llLength - pos);
+ memcpy(pbBuffer, &buff[offset], l);
+
+ pbBuffer += l;
+ pos += l;
+ len -= l;
+ }
+
+ if(pdwBytesRead) *pdwBytesRead = pbBuffer - pbBufferOrg;
+ m_llPosition += pbBuffer - pbBufferOrg;
+
+ return S_OK;
}
LONGLONG CCDDAStream::Size(LONGLONG* pSizeAvailable)
{
- LONGLONG size = sizeof(m_header) + m_llLength;
- if(pSizeAvailable) *pSizeAvailable = size;
+ LONGLONG size = sizeof(m_header) + m_llLength;
+ if(pSizeAvailable) *pSizeAvailable = size;
return size;
}
diff --git a/src/filters/reader/CDDAReader/CDDAReader.h b/src/filters/reader/CDDAReader/CDDAReader.h
index 15019e76d..d3ac17c0a 100644
--- a/src/filters/reader/CDDAReader/CDDAReader.h
+++ b/src/filters/reader/CDDAReader/CDDAReader.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,97 +28,77 @@
#include "../asyncreader/asyncio.h"
#include "../asyncreader/asyncrdr.h"
-typedef struct
-{
- UINT chunkID;
- long chunkSize;
-} ChunkHeader;
+typedef struct {UINT chunkID; long chunkSize;} ChunkHeader;
-#define RIFFID 'FFIR'
-#define WAVEID 'EVAW'
-typedef struct
-{
- ChunkHeader hdr;
- UINT WAVE;
-} RIFFChunk;
+#define RIFFID 'FFIR'
+#define WAVEID 'EVAW'
+typedef struct {ChunkHeader hdr; UINT WAVE;} RIFFChunk;
-#define FormatID ' tmf'
-typedef struct
-{
- ChunkHeader hdr;
- PCMWAVEFORMAT pcm;
-} FormatChunk;
+#define FormatID ' tmf'
+typedef struct {ChunkHeader hdr; PCMWAVEFORMAT pcm;} FormatChunk;
#define DataID 'atad'
-typedef struct
-{
- ChunkHeader hdr;
-} DataChunk;
+typedef struct {ChunkHeader hdr;} DataChunk;
-typedef struct
-{
- RIFFChunk riff;
- FormatChunk frm;
- DataChunk data;
-} WAVEChunck;
+typedef struct {RIFFChunk riff; FormatChunk frm; DataChunk data;} WAVEChunck;
class CCDDAStream : public CAsyncStream
{
private:
CCritSec m_csLock;
- LONGLONG m_llPosition, m_llLength;
+ LONGLONG m_llPosition, m_llLength;
- HANDLE m_hDrive;
- CDROM_TOC m_TOC;
- UINT m_nFirstSector, m_nStartSector, m_nStopSector;
+ HANDLE m_hDrive;
+ CDROM_TOC m_TOC;
+ UINT m_nFirstSector, m_nStartSector, m_nStopSector;
- WAVEChunck m_header;
+ WAVEChunck m_header;
public:
- CCDDAStream();
- virtual ~CCDDAStream();
+ CCDDAStream();
+ virtual ~CCDDAStream();
- CString m_discTitle, m_trackTitle;
- CString m_discArtist, m_trackArtist;
+ CString m_discTitle, m_trackTitle;
+ CString m_discArtist, m_trackArtist;
- bool Load(const WCHAR* fnw);
+ bool Load(const WCHAR* fnw);
- // overrides
+ // overrides
HRESULT SetPointer(LONGLONG llPos);
HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
LONGLONG Size(LONGLONG* pSizeAvailable);
DWORD Alignment();
void Lock();
- void Unlock();
+ void Unlock();
};
[uuid("54A35221-2C8D-4a31-A5DF-6D809847E393")]
-class CCDDAReader
- : public CAsyncReader
- , public IFileSourceFilter
- , public IAMMediaContent
+class CCDDAReader
+ : public CAsyncReader
+ , public IFileSourceFilter
+ , public IAMMediaContent
{
CCDDAStream m_stream;
- CStringW m_fn;
+ CStringW m_fn;
public:
CCDDAReader(IUnknown* pUnk, HRESULT* phr);
- ~CCDDAReader();
+ ~CCDDAReader();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
+ // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
- // IAMMediaContent
+ // IAMMediaContent
STDMETHODIMP GetTypeInfoCount(UINT* pctinfo);
- STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo);
- STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid);
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo);
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid);
STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr);
STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName);
diff --git a/src/filters/reader/CDDAReader/resource.h b/src/filters/reader/CDDAReader/resource.h
index 0bc7c47f7..0d07f7b10 100644
--- a/src/filters/reader/CDDAReader/resource.h
+++ b/src/filters/reader/CDDAReader/resource.h
@@ -3,7 +3,7 @@
// Used by cddareader.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/reader/CDDAReader/stdafx.cpp b/src/filters/reader/CDDAReader/stdafx.cpp
index c330f87bd..d431dab84 100644
--- a/src/filters/reader/CDDAReader/stdafx.cpp
+++ b/src/filters/reader/CDDAReader/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/CDDAReader/stdafx.h b/src/filters/reader/CDDAReader/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/reader/CDDAReader/stdafx.h
+++ b/src/filters/reader/CDDAReader/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/CDXAReader/CDXAReader.cpp b/src/filters/reader/CDXAReader/CDXAReader.cpp
index 4ed1dbfa7..9d9e5e854 100644
--- a/src/filters/reader/CDXAReader/CDXAReader.cpp
+++ b/src/filters/reader/CDXAReader/CDXAReader.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,83 +28,83 @@
/////////
-static DWORD EDC_crctable[256] =
+static DWORD EDC_crctable[256] =
{
- 0x00000000l, 0x90910101l, 0x91210201l, 0x01b00300l,
- 0x92410401l, 0x02d00500l, 0x03600600l, 0x93f10701l,
- 0x94810801l, 0x04100900l, 0x05a00a00l, 0x95310b01l,
- 0x06c00c00l, 0x96510d01l, 0x97e10e01l, 0x07700f00l,
- 0x99011001l, 0x09901100l, 0x08201200l, 0x98b11301l,
- 0x0b401400l, 0x9bd11501l, 0x9a611601l, 0x0af01700l,
- 0x0d801800l, 0x9d111901l, 0x9ca11a01l, 0x0c301b00l,
- 0x9fc11c01l, 0x0f501d00l, 0x0ee01e00l, 0x9e711f01l,
- 0x82012001l, 0x12902100l, 0x13202200l, 0x83b12301l,
- 0x10402400l, 0x80d12501l, 0x81612601l, 0x11f02700l,
- 0x16802800l, 0x86112901l, 0x87a12a01l, 0x17302b00l,
- 0x84c12c01l, 0x14502d00l, 0x15e02e00l, 0x85712f01l,
- 0x1b003000l, 0x8b913101l, 0x8a213201l, 0x1ab03300l,
- 0x89413401l, 0x19d03500l, 0x18603600l, 0x88f13701l,
- 0x8f813801l, 0x1f103900l, 0x1ea03a00l, 0x8e313b01l,
- 0x1dc03c00l, 0x8d513d01l, 0x8ce13e01l, 0x1c703f00l,
- 0xb4014001l, 0x24904100l, 0x25204200l, 0xb5b14301l,
- 0x26404400l, 0xb6d14501l, 0xb7614601l, 0x27f04700l,
- 0x20804800l, 0xb0114901l, 0xb1a14a01l, 0x21304b00l,
- 0xb2c14c01l, 0x22504d00l, 0x23e04e00l, 0xb3714f01l,
- 0x2d005000l, 0xbd915101l, 0xbc215201l, 0x2cb05300l,
- 0xbf415401l, 0x2fd05500l, 0x2e605600l, 0xbef15701l,
- 0xb9815801l, 0x29105900l, 0x28a05a00l, 0xb8315b01l,
- 0x2bc05c00l, 0xbb515d01l, 0xbae15e01l, 0x2a705f00l,
- 0x36006000l, 0xa6916101l, 0xa7216201l, 0x37b06300l,
- 0xa4416401l, 0x34d06500l, 0x35606600l, 0xa5f16701l,
- 0xa2816801l, 0x32106900l, 0x33a06a00l, 0xa3316b01l,
- 0x30c06c00l, 0xa0516d01l, 0xa1e16e01l, 0x31706f00l,
- 0xaf017001l, 0x3f907100l, 0x3e207200l, 0xaeb17301l,
- 0x3d407400l, 0xadd17501l, 0xac617601l, 0x3cf07700l,
- 0x3b807800l, 0xab117901l, 0xaaa17a01l, 0x3a307b00l,
- 0xa9c17c01l, 0x39507d00l, 0x38e07e00l, 0xa8717f01l,
- 0xd8018001l, 0x48908100l, 0x49208200l, 0xd9b18301l,
- 0x4a408400l, 0xdad18501l, 0xdb618601l, 0x4bf08700l,
- 0x4c808800l, 0xdc118901l, 0xdda18a01l, 0x4d308b00l,
- 0xdec18c01l, 0x4e508d00l, 0x4fe08e00l, 0xdf718f01l,
- 0x41009000l, 0xd1919101l, 0xd0219201l, 0x40b09300l,
- 0xd3419401l, 0x43d09500l, 0x42609600l, 0xd2f19701l,
- 0xd5819801l, 0x45109900l, 0x44a09a00l, 0xd4319b01l,
- 0x47c09c00l, 0xd7519d01l, 0xd6e19e01l, 0x46709f00l,
- 0x5a00a000l, 0xca91a101l, 0xcb21a201l, 0x5bb0a300l,
- 0xc841a401l, 0x58d0a500l, 0x5960a600l, 0xc9f1a701l,
- 0xce81a801l, 0x5e10a900l, 0x5fa0aa00l, 0xcf31ab01l,
- 0x5cc0ac00l, 0xcc51ad01l, 0xcde1ae01l, 0x5d70af00l,
- 0xc301b001l, 0x5390b100l, 0x5220b200l, 0xc2b1b301l,
- 0x5140b400l, 0xc1d1b501l, 0xc061b601l, 0x50f0b700l,
- 0x5780b800l, 0xc711b901l, 0xc6a1ba01l, 0x5630bb00l,
- 0xc5c1bc01l, 0x5550bd00l, 0x54e0be00l, 0xc471bf01l,
- 0x6c00c000l, 0xfc91c101l, 0xfd21c201l, 0x6db0c300l,
- 0xfe41c401l, 0x6ed0c500l, 0x6f60c600l, 0xfff1c701l,
- 0xf881c801l, 0x6810c900l, 0x69a0ca00l, 0xf931cb01l,
- 0x6ac0cc00l, 0xfa51cd01l, 0xfbe1ce01l, 0x6b70cf00l,
- 0xf501d001l, 0x6590d100l, 0x6420d200l, 0xf4b1d301l,
- 0x6740d400l, 0xf7d1d501l, 0xf661d601l, 0x66f0d700l,
- 0x6180d800l, 0xf111d901l, 0xf0a1da01l, 0x6030db00l,
- 0xf3c1dc01l, 0x6350dd00l, 0x62e0de00l, 0xf271df01l,
- 0xee01e001l, 0x7e90e100l, 0x7f20e200l, 0xefb1e301l,
- 0x7c40e400l, 0xecd1e501l, 0xed61e601l, 0x7df0e700l,
- 0x7a80e800l, 0xea11e901l, 0xeba1ea01l, 0x7b30eb00l,
- 0xe8c1ec01l, 0x7850ed00l, 0x79e0ee00l, 0xe971ef01l,
- 0x7700f000l, 0xe791f101l, 0xe621f201l, 0x76b0f300l,
- 0xe541f401l, 0x75d0f500l, 0x7460f600l, 0xe4f1f701l,
- 0xe381f801l, 0x7310f900l, 0x72a0fa00l, 0xe231fb01l,
- 0x71c0fc00l, 0xe151fd01l, 0xe0e1fe01l, 0x7070ff00l
+ 0x00000000l, 0x90910101l, 0x91210201l, 0x01b00300l,
+ 0x92410401l, 0x02d00500l, 0x03600600l, 0x93f10701l,
+ 0x94810801l, 0x04100900l, 0x05a00a00l, 0x95310b01l,
+ 0x06c00c00l, 0x96510d01l, 0x97e10e01l, 0x07700f00l,
+ 0x99011001l, 0x09901100l, 0x08201200l, 0x98b11301l,
+ 0x0b401400l, 0x9bd11501l, 0x9a611601l, 0x0af01700l,
+ 0x0d801800l, 0x9d111901l, 0x9ca11a01l, 0x0c301b00l,
+ 0x9fc11c01l, 0x0f501d00l, 0x0ee01e00l, 0x9e711f01l,
+ 0x82012001l, 0x12902100l, 0x13202200l, 0x83b12301l,
+ 0x10402400l, 0x80d12501l, 0x81612601l, 0x11f02700l,
+ 0x16802800l, 0x86112901l, 0x87a12a01l, 0x17302b00l,
+ 0x84c12c01l, 0x14502d00l, 0x15e02e00l, 0x85712f01l,
+ 0x1b003000l, 0x8b913101l, 0x8a213201l, 0x1ab03300l,
+ 0x89413401l, 0x19d03500l, 0x18603600l, 0x88f13701l,
+ 0x8f813801l, 0x1f103900l, 0x1ea03a00l, 0x8e313b01l,
+ 0x1dc03c00l, 0x8d513d01l, 0x8ce13e01l, 0x1c703f00l,
+ 0xb4014001l, 0x24904100l, 0x25204200l, 0xb5b14301l,
+ 0x26404400l, 0xb6d14501l, 0xb7614601l, 0x27f04700l,
+ 0x20804800l, 0xb0114901l, 0xb1a14a01l, 0x21304b00l,
+ 0xb2c14c01l, 0x22504d00l, 0x23e04e00l, 0xb3714f01l,
+ 0x2d005000l, 0xbd915101l, 0xbc215201l, 0x2cb05300l,
+ 0xbf415401l, 0x2fd05500l, 0x2e605600l, 0xbef15701l,
+ 0xb9815801l, 0x29105900l, 0x28a05a00l, 0xb8315b01l,
+ 0x2bc05c00l, 0xbb515d01l, 0xbae15e01l, 0x2a705f00l,
+ 0x36006000l, 0xa6916101l, 0xa7216201l, 0x37b06300l,
+ 0xa4416401l, 0x34d06500l, 0x35606600l, 0xa5f16701l,
+ 0xa2816801l, 0x32106900l, 0x33a06a00l, 0xa3316b01l,
+ 0x30c06c00l, 0xa0516d01l, 0xa1e16e01l, 0x31706f00l,
+ 0xaf017001l, 0x3f907100l, 0x3e207200l, 0xaeb17301l,
+ 0x3d407400l, 0xadd17501l, 0xac617601l, 0x3cf07700l,
+ 0x3b807800l, 0xab117901l, 0xaaa17a01l, 0x3a307b00l,
+ 0xa9c17c01l, 0x39507d00l, 0x38e07e00l, 0xa8717f01l,
+ 0xd8018001l, 0x48908100l, 0x49208200l, 0xd9b18301l,
+ 0x4a408400l, 0xdad18501l, 0xdb618601l, 0x4bf08700l,
+ 0x4c808800l, 0xdc118901l, 0xdda18a01l, 0x4d308b00l,
+ 0xdec18c01l, 0x4e508d00l, 0x4fe08e00l, 0xdf718f01l,
+ 0x41009000l, 0xd1919101l, 0xd0219201l, 0x40b09300l,
+ 0xd3419401l, 0x43d09500l, 0x42609600l, 0xd2f19701l,
+ 0xd5819801l, 0x45109900l, 0x44a09a00l, 0xd4319b01l,
+ 0x47c09c00l, 0xd7519d01l, 0xd6e19e01l, 0x46709f00l,
+ 0x5a00a000l, 0xca91a101l, 0xcb21a201l, 0x5bb0a300l,
+ 0xc841a401l, 0x58d0a500l, 0x5960a600l, 0xc9f1a701l,
+ 0xce81a801l, 0x5e10a900l, 0x5fa0aa00l, 0xcf31ab01l,
+ 0x5cc0ac00l, 0xcc51ad01l, 0xcde1ae01l, 0x5d70af00l,
+ 0xc301b001l, 0x5390b100l, 0x5220b200l, 0xc2b1b301l,
+ 0x5140b400l, 0xc1d1b501l, 0xc061b601l, 0x50f0b700l,
+ 0x5780b800l, 0xc711b901l, 0xc6a1ba01l, 0x5630bb00l,
+ 0xc5c1bc01l, 0x5550bd00l, 0x54e0be00l, 0xc471bf01l,
+ 0x6c00c000l, 0xfc91c101l, 0xfd21c201l, 0x6db0c300l,
+ 0xfe41c401l, 0x6ed0c500l, 0x6f60c600l, 0xfff1c701l,
+ 0xf881c801l, 0x6810c900l, 0x69a0ca00l, 0xf931cb01l,
+ 0x6ac0cc00l, 0xfa51cd01l, 0xfbe1ce01l, 0x6b70cf00l,
+ 0xf501d001l, 0x6590d100l, 0x6420d200l, 0xf4b1d301l,
+ 0x6740d400l, 0xf7d1d501l, 0xf661d601l, 0x66f0d700l,
+ 0x6180d800l, 0xf111d901l, 0xf0a1da01l, 0x6030db00l,
+ 0xf3c1dc01l, 0x6350dd00l, 0x62e0de00l, 0xf271df01l,
+ 0xee01e001l, 0x7e90e100l, 0x7f20e200l, 0xefb1e301l,
+ 0x7c40e400l, 0xecd1e501l, 0xed61e601l, 0x7df0e700l,
+ 0x7a80e800l, 0xea11e901l, 0xeba1ea01l, 0x7b30eb00l,
+ 0xe8c1ec01l, 0x7850ed00l, 0x79e0ee00l, 0xe971ef01l,
+ 0x7700f000l, 0xe791f101l, 0xe621f201l, 0x76b0f300l,
+ 0xe541f401l, 0x75d0f500l, 0x7460f600l, 0xe4f1f701l,
+ 0xe381f801l, 0x7310f900l, 0x72a0fa00l, 0xe231fb01l,
+ 0x71c0fc00l, 0xe151fd01l, 0xe0e1fe01l, 0x7070ff00l
};
static DWORD build_edc(const void* in, unsigned from, unsigned upto)
{
- const BYTE* p = (BYTE*)in + from;
- DWORD result = 0;
-
- for(; from < upto; from++)
- result = EDC_crctable[(result ^ *p++) & 0xffL] ^(result >> 8);
+ const BYTE* p = (BYTE*)in + from;
+ DWORD result = 0;
- return result;
+ for(; from < upto; from++)
+ result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
+
+ return result;
}
/////////
@@ -113,44 +113,44 @@ static DWORD build_edc(const void* in, unsigned from, unsigned upto)
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CCDXAReader), L"MPC - CDXA Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CCDXAReader), L"MPC - CDXA Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CCDXAReader>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CCDXAReader>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"),
- _T("0"), _T("0,4,,52494646,8,4,,43445841")); // "RIFFxxxxCDXA"
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"),
+ _T("0"), _T("0,4,,52494646,8,4,,43445841")); // "RIFFxxxxCDXA"
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"),
- _T("Source Filter"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"),
+ _T("Source Filter"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -164,9 +164,9 @@ CFilterApp theApp;
//
CCDXAReader::CCDXAReader(IUnknown* pUnk, HRESULT* phr)
- : CAsyncReader(NAME("CCDXAReader"), pUnk, &m_stream, phr, __uuidof(this))
+ : CAsyncReader(NAME("CCDXAReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CCDXAReader::~CCDXAReader()
@@ -175,174 +175,174 @@ CCDXAReader::~CCDXAReader()
STDMETHODIMP CCDXAReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IFileSourceFilter)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
-STDMETHODIMP CCDXAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt)
+STDMETHODIMP CCDXAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt)
{
- CMediaType mt;
- m_mt = mt;
+ CMediaType mt;
+ m_mt = mt;
- if(!m_stream.Load(pszFileName))
- return E_FAIL;
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- mt.majortype = MEDIATYPE_Stream;
- mt.subtype = m_stream.m_subtype;
- m_mt = mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = m_stream.m_subtype;
+ m_mt = mt;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CCDXAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ wcscpy(*ppszFileName, m_fn);
- wcscpy(*ppszFileName, m_fn);
-
- return S_OK;
+ return S_OK;
}
// CCDXAStream
CCDXAStream::CCDXAStream()
{
- m_subtype = MEDIASUBTYPE_NULL;
-
- m_hFile = INVALID_HANDLE_VALUE;
+ m_subtype = MEDIASUBTYPE_NULL;
+
+ m_hFile = INVALID_HANDLE_VALUE;
- m_llPosition = m_llLength = 0;
- m_nFirstSector = 0;
- m_nBufferedSector = -1;
+ m_llPosition = m_llLength = 0;
+ m_nFirstSector = 0;
+ m_nBufferedSector = -1;
}
CCDXAStream::~CCDXAStream()
{
- if(m_hFile != INVALID_HANDLE_VALUE)
- {
- CloseHandle(m_hFile);
- m_hFile = INVALID_HANDLE_VALUE;
- }
+ if(m_hFile != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ }
}
bool CCDXAStream::Load(const WCHAR* fnw)
{
- if(m_hFile != INVALID_HANDLE_VALUE)
- {
- CloseHandle(m_hFile);
- m_hFile = INVALID_HANDLE_VALUE;
- }
-
- m_hFile = CreateFile(CString(fnw), GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
- if(m_hFile == INVALID_HANDLE_VALUE)
- {
- return(false);
- }
-
- BYTE hdr[RIFFCDXA_HEADER_SIZE];
- DWORD NumberOfBytesRead;
- if(!ReadFile(m_hFile, (LPVOID)hdr, RIFFCDXA_HEADER_SIZE, &NumberOfBytesRead, NULL)
- || *((DWORD*)&hdr[0]) != 'FFIR' || *((DWORD*)&hdr[8]) != 'AXDC'
- || *((DWORD*)&hdr[4]) != (*((DWORD*)&hdr[0x28]) + 0x24))
- {
- CloseHandle(m_hFile);
- m_hFile = INVALID_HANDLE_VALUE;
- return(false);
- }
-
- LARGE_INTEGER size = {0, 0};
- size.LowPart = (LONG)GetFileSize(m_hFile, (LPDWORD)&size.HighPart);
-
- m_llLength = int((size.QuadPart - RIFFCDXA_HEADER_SIZE) / RAW_SECTOR_SIZE) * RAW_DATA_SIZE;
-
- if(!LookForMediaSubType())
- {
- m_llPosition = m_llLength = 0;
- CloseHandle(m_hFile);
- m_hFile = INVALID_HANDLE_VALUE;
- return(false);
- }
-
- m_llPosition = 0;
-
- m_nBufferedSector = -1;
-
- return(true);
+ if(m_hFile != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ }
+
+ m_hFile = CreateFile(CString(fnw), GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
+ if(m_hFile == INVALID_HANDLE_VALUE)
+ {
+ return(false);
+ }
+
+ BYTE hdr[RIFFCDXA_HEADER_SIZE];
+ DWORD NumberOfBytesRead;
+ if(!ReadFile(m_hFile, (LPVOID)hdr, RIFFCDXA_HEADER_SIZE, &NumberOfBytesRead, NULL)
+ || *((DWORD*)&hdr[0]) != 'FFIR' || *((DWORD*)&hdr[8]) != 'AXDC'
+ || *((DWORD*)&hdr[4]) != (*((DWORD*)&hdr[0x28])+0x24))
+ {
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ LARGE_INTEGER size = {0, 0};
+ size.LowPart = (LONG)GetFileSize(m_hFile, (LPDWORD)&size.HighPart);
+
+ m_llLength = int((size.QuadPart - RIFFCDXA_HEADER_SIZE) / RAW_SECTOR_SIZE) * RAW_DATA_SIZE;
+
+ if(!LookForMediaSubType())
+ {
+ m_llPosition = m_llLength = 0;
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ m_llPosition = 0;
+
+ m_nBufferedSector = -1;
+
+ return(true);
}
HRESULT CCDXAStream::SetPointer(LONGLONG llPos)
{
- return (llPos >= 0 && llPos < m_llLength) ? m_llPosition = llPos, S_OK : S_FALSE;
+ return (llPos >= 0 && llPos < m_llLength) ? m_llPosition = llPos, S_OK : S_FALSE;
}
HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
{
- CAutoLock lck(&m_csLock);
+ CAutoLock lck(&m_csLock);
- PBYTE pbBufferOrg = pbBuffer;
- LONGLONG pos = m_llPosition;
+ PBYTE pbBufferOrg = pbBuffer;
+ LONGLONG pos = m_llPosition;
- while(pos >= 0 && pos < m_llLength && dwBytesToRead > 0)
- {
- UINT sector = m_nFirstSector + int(pos / RAW_DATA_SIZE);
- __int64 offset = pos % RAW_DATA_SIZE;
+ while(pos >= 0 && pos < m_llLength && dwBytesToRead > 0)
+ {
+ UINT sector = m_nFirstSector + int(pos/RAW_DATA_SIZE);
+ __int64 offset = pos%RAW_DATA_SIZE;
- if(m_nBufferedSector != sector)
- {
- LARGE_INTEGER FilePointer;
- FilePointer.QuadPart = RIFFCDXA_HEADER_SIZE + sector * RAW_SECTOR_SIZE;
- SetFilePointer(m_hFile, (LONG)FilePointer.LowPart, (PLONG)&FilePointer.HighPart, FILE_BEGIN);
+ if(m_nBufferedSector != sector)
+ {
+ LARGE_INTEGER FilePointer;
+ FilePointer.QuadPart = RIFFCDXA_HEADER_SIZE + sector*RAW_SECTOR_SIZE;
+ SetFilePointer(m_hFile, (LONG)FilePointer.LowPart, (PLONG)&FilePointer.HighPart, FILE_BEGIN);
- memset(m_sector, 0, sizeof(m_sector));
+ memset(m_sector, 0, sizeof(m_sector));
- DWORD NumberOfBytesRead = 0;
+ DWORD NumberOfBytesRead = 0;
- int nRetries = 3;
- while(nRetries--)
- {
- NumberOfBytesRead = 0;
- if(!ReadFile(m_hFile, m_sector, RAW_SECTOR_SIZE, &NumberOfBytesRead, NULL)
- || NumberOfBytesRead != RAW_SECTOR_SIZE)
- break;
+ int nRetries = 3;
+ while(nRetries--)
+ {
+ NumberOfBytesRead = 0;
+ if(!ReadFile(m_hFile, m_sector, RAW_SECTOR_SIZE, &NumberOfBytesRead, NULL)
+ || NumberOfBytesRead != RAW_SECTOR_SIZE)
+ break;
- if(*(DWORD*)&m_sector[RAW_SECTOR_SIZE-4] == 0) // no CRC? it happens...
- break;
+ if(*(DWORD*)&m_sector[RAW_SECTOR_SIZE-4] == 0) // no CRC? it happens...
+ break;
- if(build_edc(m_sector, RAW_SYNC_SIZE + RAW_HEADER_SIZE, RAW_SECTOR_SIZE) == 0)
- break;
+ if(build_edc(m_sector, RAW_SYNC_SIZE + RAW_HEADER_SIZE, RAW_SECTOR_SIZE) == 0)
+ break;
- TRACE(_T("CCDXAStream: CRC error at sector %d (fp=0x%I64x, retriesleft=%d)\n"), sector, FilePointer.QuadPart, nRetries);
- }
+ TRACE(_T("CCDXAStream: CRC error at sector %d (fp=0x%I64x, retriesleft=%d)\n"), sector, FilePointer.QuadPart, nRetries);
+ }
- m_nBufferedSector = sector;
- }
+ m_nBufferedSector = sector;
+ }
- DWORD l = min(min(dwBytesToRead, RAW_DATA_SIZE - offset), m_llLength - pos);
- memcpy(pbBuffer, &m_sector[RAW_SYNC_SIZE + RAW_HEADER_SIZE + RAW_SUBHEADER_SIZE + offset], l);
+ DWORD l = min(min(dwBytesToRead, RAW_DATA_SIZE - offset), m_llLength - pos);
+ memcpy(pbBuffer, &m_sector[RAW_SYNC_SIZE + RAW_HEADER_SIZE + RAW_SUBHEADER_SIZE + offset], l);
- pbBuffer += l;
- pos += l;
- dwBytesToRead -= l;
- }
+ pbBuffer += l;
+ pos += l;
+ dwBytesToRead -= l;
+ }
- if(pdwBytesRead) *pdwBytesRead = pbBuffer - pbBufferOrg;
- m_llPosition += pbBuffer - pbBufferOrg;
+ if(pdwBytesRead) *pdwBytesRead = pbBuffer - pbBufferOrg;
+ m_llPosition += pbBuffer - pbBufferOrg;
- if(dwBytesToRead != 0) return S_FALSE;
+ if(dwBytesToRead != 0) return S_FALSE;
- return S_OK;
+ return S_OK;
}
LONGLONG CCDXAStream::Size(LONGLONG* pSizeAvailable)
{
- if(pSizeAvailable) *pSizeAvailable = m_llLength;
+ if(pSizeAvailable) *pSizeAvailable = m_llLength;
return m_llLength;
}
@@ -365,184 +365,172 @@ void CCDXAStream::Unlock()
bool CCDXAStream::LookForMediaSubType()
{
- BYTE buff[RAW_DATA_SIZE];
-
- m_subtype = MEDIASUBTYPE_NULL;
-
- m_llPosition = 0;
-
- for(int iSectorsRead = 0;
- Read(buff, RAW_DATA_SIZE, 1, NULL) == S_OK && iSectorsRead < 1000;
- iSectorsRead++)
- {
- if(*((DWORD*)&buff[0]) == 0xba010000)
- {
- m_llPosition = 0;
- m_llLength -= iSectorsRead * RAW_DATA_SIZE;
- m_nFirstSector = iSectorsRead;
-
- if((buff[4] & 0xc4) == 0x44) m_subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
- else if((buff[4] & 0xf1) == 0x21) m_subtype = MEDIASUBTYPE_MPEG1System;
-
- return m_subtype != MEDIASUBTYPE_NULL;
- }
- else if(*((DWORD*)&buff[0]) == 'SggO')
- {
- m_llPosition = 0;
- m_llLength -= iSectorsRead * RAW_DATA_SIZE;
- m_nFirstSector = iSectorsRead;
-
- m_subtype = MEDIASUBTYPE_Ogg;
-
- return(true);
- }
- else if(*((DWORD*)&buff[0]) == 0xA3DF451A)
- {
- m_llPosition = 0;
- m_llLength -= iSectorsRead * RAW_DATA_SIZE;
- m_nFirstSector = iSectorsRead;
-
- m_subtype = MEDIASUBTYPE_Matroska;
-
- return(true);
- }
- else if(*((DWORD*)&buff[0]) == 'FMR.')
- {
- m_llPosition = 0;
- m_llLength -= iSectorsRead * RAW_DATA_SIZE;
- m_nFirstSector = iSectorsRead;
-
- m_subtype = MEDIASUBTYPE_RealMedia;
-
- return(true);
- }
- else if(*((DWORD*)&buff[0]) == 'FFIR' && *((DWORD*)&buff[8]) == ' IVA')
- {
- m_llPosition = 0;
- m_llLength = min(m_llLength, *((DWORD*)&buff[4]) + 8);
- m_nFirstSector = iSectorsRead;
-
- m_subtype = MEDIASUBTYPE_Avi;
-
- return(true);
- }
- else if(*((DWORD*)&buff[4]) == 'voom' || *((DWORD*)&buff[4]) == 'tadm'
- || *((DWORD*)&buff[4]) == 'pytf' && *((DWORD*)&buff[8]) == 'mosi' && *((DWORD*)&buff[16]) == '14pm')
- {
- m_llPosition = 0;
- m_llLength -= iSectorsRead * RAW_DATA_SIZE;
- m_nFirstSector = iSectorsRead;
-
- m_subtype = MEDIASUBTYPE_QTMovie;
-
- return(true);
- }
- }
-
- m_llPosition = 0;
-
- CRegKey majorkey;
- CString majortype = _T("\\Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}");
- if(ERROR_SUCCESS == majorkey.Open(HKEY_CLASSES_ROOT, majortype, KEY_READ))
- {
- TCHAR subtype[256+1];
- DWORD len = 256;
- for(int i = 0; ERROR_SUCCESS == majorkey.EnumKey(i, subtype, &len); i++, len = 256)
- {
- CRegKey subkey;
- if(ERROR_SUCCESS != subkey.Open(HKEY_CLASSES_ROOT, majortype + _T("\\") + subtype, KEY_READ))
- continue;
-
- for(int j = 0; true; j++)
- {
- TCHAR number[10];
- _stprintf(number, _T("%d"), j);
-
- TCHAR pattern[256+1];
- ULONG len = 256;
- if(ERROR_SUCCESS != subkey.QueryStringValue(number, pattern, &len))
- break;
-
- CString p = pattern;
- p += ',';
-
- __int64 offset = 0;
- DWORD cb = 0;
- CAtlArray<BYTE> mask, val;
-
- int nMatches = 0, nTries = 0;
-
- for(int k = 0, l; nTries >= 0 && (l = p.Find(',', k)) >= 0; k = l + 1, nTries++)
- {
- CString s = p.Mid(k, l - k);
- TRACE(s + '\n');
-
- TCHAR* end = NULL;
-
- switch(nTries & 3)
- {
- case 0:
- offset = _tcstol(s, &end, 10);
- break;
- case 1:
- cb = _tcstol(s, &end, 10);
- break;
- case 2:
- CStringToBin(s, mask);
- break;
- case 3:
- CStringToBin(s, val);
- break;
- default:
- nTries = -1;
- break;
- }
-
- if(nTries >= 0 && (nTries & 3) == 3)
- {
- if(cb > 0 && val.GetCount() > 0 && cb == val.GetCount())
- {
- if(offset >= 0 && S_OK == SetPointer(offset)
- || S_OK == SetPointer(m_llLength + offset))
- {
- CAutoVectorPtr<BYTE> pData;
- if(pData.Allocate(cb))
- {
- DWORD BytesRead = 0;
- if(S_OK == Read(pData, cb, 1, &BytesRead) && cb == BytesRead)
- {
- if(mask.GetCount() < cb)
- {
- int i = mask.GetCount();
- mask.SetCount(cb);
- for(; i < cb; i++) mask[i] = 0xff;
- }
-
- for(int i = 0; i < cb; i++)
- pData[i] &= (BYTE)mask[i];
-
- if(memcmp(pData, val.GetData(), cb) == 0)
- nMatches++;
- }
- }
- }
-
- offset = 0;
- cb = 0;
- mask.RemoveAll();
- val.RemoveAll();
- }
- }
- }
-
- if(nMatches > 0 && nMatches * 4 == nTries)
- {
- m_subtype = GUIDFromCString(subtype);
- return S_OK;
- }
- }
- }
- }
-
- return(false);
+ BYTE buff[RAW_DATA_SIZE];
+
+ m_subtype = MEDIASUBTYPE_NULL;
+
+ m_llPosition = 0;
+
+ for(int iSectorsRead = 0;
+ Read(buff, RAW_DATA_SIZE, 1, NULL) == S_OK && iSectorsRead < 1000;
+ iSectorsRead++)
+ {
+ if(*((DWORD*)&buff[0]) == 0xba010000)
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ if((buff[4]&0xc4) == 0x44) m_subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
+ else if((buff[4]&0xf1) == 0x21) m_subtype = MEDIASUBTYPE_MPEG1System;
+
+ return m_subtype != MEDIASUBTYPE_NULL;
+ }
+ else if(*((DWORD*)&buff[0]) == 'SggO')
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_Ogg;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[0]) == 0xA3DF451A)
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_Matroska;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[0]) == 'FMR.')
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_RealMedia;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[0]) == 'FFIR' && *((DWORD*)&buff[8]) == ' IVA')
+ {
+ m_llPosition = 0;
+ m_llLength = min(m_llLength, *((DWORD*)&buff[4])+8);
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_Avi;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[4]) == 'voom' || *((DWORD*)&buff[4]) == 'tadm'
+ || *((DWORD*)&buff[4]) == 'pytf' && *((DWORD*)&buff[8]) == 'mosi' && *((DWORD*)&buff[16]) == '14pm')
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_QTMovie;
+
+ return(true);
+ }
+ }
+
+ m_llPosition = 0;
+
+ CRegKey majorkey;
+ CString majortype = _T("\\Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}");
+ if(ERROR_SUCCESS == majorkey.Open(HKEY_CLASSES_ROOT, majortype, KEY_READ))
+ {
+ TCHAR subtype[256+1];
+ DWORD len = 256;
+ for(int i = 0; ERROR_SUCCESS == majorkey.EnumKey(i, subtype, &len); i++, len = 256)
+ {
+ CRegKey subkey;
+ if(ERROR_SUCCESS != subkey.Open(HKEY_CLASSES_ROOT, majortype + _T("\\") + subtype, KEY_READ))
+ continue;
+
+ for(int j = 0; true; j++)
+ {
+ TCHAR number[10];
+ _stprintf(number, _T("%d"), j);
+
+ TCHAR pattern[256+1];
+ ULONG len = 256;
+ if(ERROR_SUCCESS != subkey.QueryStringValue(number, pattern, &len))
+ break;
+
+ CString p = pattern;
+ p += ',';
+
+ __int64 offset = 0;
+ DWORD cb = 0;
+ CAtlArray<BYTE> mask, val;
+
+ int nMatches = 0, nTries = 0;
+
+ for(int k = 0, l; nTries >= 0 && (l = p.Find(',', k)) >= 0; k = l+1, nTries++)
+ {
+ CString s = p.Mid(k, l-k);
+ TRACE(s + '\n');
+
+ TCHAR* end = NULL;
+
+ switch(nTries&3)
+ {
+ case 0: offset = _tcstol(s, &end, 10); break;
+ case 1: cb = _tcstol(s, &end, 10); break;
+ case 2: CStringToBin(s, mask); break;
+ case 3: CStringToBin(s, val); break;
+ default: nTries = -1; break;
+ }
+
+ if(nTries >= 0 && (nTries&3) == 3)
+ {
+ if(cb > 0 && val.GetCount() > 0 && cb == val.GetCount())
+ {
+ if(offset >= 0 && S_OK == SetPointer(offset)
+ || S_OK == SetPointer(m_llLength + offset))
+ {
+ CAutoVectorPtr<BYTE> pData;
+ if(pData.Allocate(cb))
+ {
+ DWORD BytesRead = 0;
+ if(S_OK == Read(pData, cb, 1, &BytesRead) && cb == BytesRead)
+ {
+ if(mask.GetCount() < cb)
+ {
+ int i = mask.GetCount();
+ mask.SetCount(cb);
+ for(; i < cb; i++) mask[i] = 0xff;
+ }
+
+ for(int i = 0; i < cb; i++)
+ pData[i] &= (BYTE)mask[i];
+
+ if(memcmp(pData, val.GetData(), cb) == 0)
+ nMatches++;
+ }
+ }
+ }
+
+ offset = 0; cb = 0;
+ mask.RemoveAll(); val.RemoveAll();
+ }
+ }
+ }
+
+ if(nMatches > 0 && nMatches*4 == nTries)
+ {
+ m_subtype = GUIDFromCString(subtype);
+ return S_OK;
+ }
+ }
+ }
+ }
+
+ return(false);
}
diff --git a/src/filters/reader/CDXAReader/CDXAReader.h b/src/filters/reader/CDXAReader/CDXAReader.h
index 60f4babaa..56a34be86 100644
--- a/src/filters/reader/CDXAReader/CDXAReader.h
+++ b/src/filters/reader/CDXAReader/CDXAReader.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,60 +28,60 @@
class CCDXAStream : public CAsyncStream
{
private:
- enum
- {
- RIFFCDXA_HEADER_SIZE = 44, // usually...
- RAW_SYNC_SIZE = 12, // 00 FF .. FF 00
- RAW_HEADER_SIZE = 4,
- RAW_SUBHEADER_SIZE = 8,
- RAW_DATA_SIZE = 2324,
- RAW_EDC_SIZE = 4,
- RAW_SECTOR_SIZE = 2352
- };
+ enum
+ {
+ RIFFCDXA_HEADER_SIZE = 44, // usually...
+ RAW_SYNC_SIZE = 12, // 00 FF .. FF 00
+ RAW_HEADER_SIZE = 4,
+ RAW_SUBHEADER_SIZE = 8,
+ RAW_DATA_SIZE = 2324,
+ RAW_EDC_SIZE = 4,
+ RAW_SECTOR_SIZE = 2352
+ };
CCritSec m_csLock;
- HANDLE m_hFile;
- LONGLONG m_llPosition, m_llLength;
- int m_nFirstSector;
+ HANDLE m_hFile;
+ LONGLONG m_llPosition, m_llLength;
+ int m_nFirstSector;
- int m_nBufferedSector;
- BYTE m_sector[RAW_SECTOR_SIZE];
+ int m_nBufferedSector;
+ BYTE m_sector[RAW_SECTOR_SIZE];
- bool LookForMediaSubType();
+ bool LookForMediaSubType();
public:
- CCDXAStream();
- virtual ~CCDXAStream();
+ CCDXAStream();
+ virtual ~CCDXAStream();
- bool Load(const WCHAR* fnw);
+ bool Load(const WCHAR* fnw);
HRESULT SetPointer(LONGLONG llPos);
HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
LONGLONG Size(LONGLONG* pSizeAvailable);
DWORD Alignment();
void Lock();
- void Unlock();
+ void Unlock();
- GUID m_subtype;
+ GUID m_subtype;
};
[uuid("D367878E-F3B8-4235-A968-F378EF1B9A44")]
-class CCDXAReader
- : public CAsyncReader
- , public IFileSourceFilter
+class CCDXAReader
+ : public CAsyncReader
+ , public IFileSourceFilter
{
- CCDXAStream m_stream;
- CStringW m_fn;
+ CCDXAStream m_stream;
+ CStringW m_fn;
public:
CCDXAReader(IUnknown* pUnk, HRESULT* phr);
- ~CCDXAReader();
+ ~CCDXAReader();
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
};
diff --git a/src/filters/reader/CDXAReader/resource.h b/src/filters/reader/CDXAReader/resource.h
index 302231738..35951cffd 100644
--- a/src/filters/reader/CDXAReader/resource.h
+++ b/src/filters/reader/CDXAReader/resource.h
@@ -3,7 +3,7 @@
// Used by cdxareader.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/reader/CDXAReader/stdafx.cpp b/src/filters/reader/CDXAReader/stdafx.cpp
index 429feefb5..d5332bbe6 100644
--- a/src/filters/reader/CDXAReader/stdafx.cpp
+++ b/src/filters/reader/CDXAReader/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/CDXAReader/stdafx.h b/src/filters/reader/CDXAReader/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/reader/CDXAReader/stdafx.h
+++ b/src/filters/reader/CDXAReader/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/UDPReader/UDPReader.cpp b/src/filters/reader/UDPReader/UDPReader.cpp
index 4afb4e830..fbeb8426e 100644
--- a/src/filters/reader/UDPReader/UDPReader.cpp
+++ b/src/filters/reader/UDPReader/UDPReader.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,39 +27,39 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CUDPReader), L"MPC - UDP Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CUDPReader), L"MPC - UDP Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CUDPReader>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CUDPReader>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(_T("udp"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CUDPReader)));
- SetRegKeyValue(_T("tévé"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CUDPReader)));
+ SetRegKeyValue(_T("udp"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CUDPReader)));
+ SetRegKeyValue(_T("tévé"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CUDPReader)));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- // TODO
+ // TODO
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -76,9 +76,9 @@ CFilterApp theApp;
//
CUDPReader::CUDPReader(IUnknown* pUnk, HRESULT* phr)
- : CAsyncReader(NAME("CUDPReader"), pUnk, &m_stream, phr, __uuidof(this))
+ : CAsyncReader(NAME("CUDPReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CUDPReader::~CUDPReader()
@@ -89,212 +89,208 @@ STDMETHODIMP CUDPReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IFileSourceFilter)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IFileSourceFilter
-STDMETHODIMP CUDPReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CUDPReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(!m_stream.Load(pszFileName))
- return E_FAIL;
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- CMediaType mt;
- mt.majortype = MEDIATYPE_Stream;
- mt.subtype = m_stream.GetSubType();
- m_mt = mt;
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = m_stream.GetSubType();
+ m_mt = mt;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CUDPReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- wcscpy(*ppszFileName, m_fn);
+ wcscpy(*ppszFileName, m_fn);
- return S_OK;
+ return S_OK;
}
// CUDPStream
CUDPStream::CUDPStream()
{
- m_port = 0;
- m_socket = -1;
- m_subtype = MEDIASUBTYPE_NULL;
+ m_port = 0;
+ m_socket = -1;
+ m_subtype = MEDIASUBTYPE_NULL;
}
CUDPStream::~CUDPStream()
{
- Clear();
+ Clear();
}
void CUDPStream::Clear()
{
- if(m_socket >= 0)
- {
- closesocket(m_socket);
- m_socket = -1;
- }
- if(CAMThread::ThreadExists())
- {
- CAMThread::CallWorker(CMD_EXIT);
- CAMThread::Close();
- }
- while(!m_packets.IsEmpty()) delete m_packets.RemoveHead();
- m_pos = m_len = 0;
- m_drop = false;
+ if(m_socket >= 0) {closesocket(m_socket); m_socket = -1;}
+ if(CAMThread::ThreadExists())
+ {
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
+ }
+ while(!m_packets.IsEmpty()) delete m_packets.RemoveHead();
+ m_pos = m_len = 0;
+ m_drop = false;
}
void CUDPStream::Append(BYTE* buff, int len)
{
- CAutoLock cAutoLock(&m_csLock);
-
- if(m_packets.GetCount() > 1)
- {
- __int64 size = m_packets.GetTail()->m_end - m_packets.GetHead()->m_start;
-
- if(!m_drop && (m_pos >= BUFF_SIZE_FIRST && size >= BUFF_SIZE_FIRST || size >= 2 * BUFF_SIZE_FIRST))
- {
- m_drop = true;
- TRACE(_T("DROP ON\n"));
- }
- else if(m_drop && size <= BUFF_SIZE_FIRST)
- {
- m_drop = false;
- TRACE(_T("DROP OFF\n"));
- }
-
- if(m_drop) return;
- }
-
- m_packets.AddTail(DNew packet_t(buff, m_len, m_len + len));
- m_len += len;
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(m_packets.GetCount() > 1)
+ {
+ __int64 size = m_packets.GetTail()->m_end - m_packets.GetHead()->m_start;
+
+ if(!m_drop && (m_pos >= BUFF_SIZE_FIRST && size >= BUFF_SIZE_FIRST || size >= 2*BUFF_SIZE_FIRST))
+ {
+ m_drop = true;
+ TRACE(_T("DROP ON\n"));
+ }
+ else if(m_drop && size <= BUFF_SIZE_FIRST)
+ {
+ m_drop = false;
+ TRACE(_T("DROP OFF\n"));
+ }
+
+ if(m_drop) return;
+ }
+
+ m_packets.AddTail(DNew packet_t(buff, m_len, m_len + len));
+ m_len += len;
}
bool CUDPStream::Load(const WCHAR* fnw)
{
- Clear();
+ Clear();
- CStringW url = CStringW(fnw);
+ CStringW url = CStringW(fnw);
#ifdef DEBUG
-// url = L"udp://:1234/";
-// url = L"udp://239.255.255.250:1234/{e436eb8e-524f-11ce-9f53-0020af0ba770}";
+// url = L"udp://:1234/";
+// url = L"udp://239.255.255.250:1234/{e436eb8e-524f-11ce-9f53-0020af0ba770}";
// url = L"udp://239.255.255.19:2345/";
#endif
- CAtlList<CStringW> sl;
- Explode(url, sl, ':');
- if(sl.GetCount() != 3) return false;
+ CAtlList<CStringW> sl;
+ Explode(url, sl, ':');
+ if(sl.GetCount() != 3) return false;
- CStringW protocol = sl.RemoveHead();
- // if(protocol != L"udp") return false;
+ CStringW protocol = sl.RemoveHead();
+ // if(protocol != L"udp") return false;
- m_ip = CString(sl.RemoveHead()).TrimLeft('/');
+ m_ip = CString(sl.RemoveHead()).TrimLeft('/');
- int port = _wtoi(Explode(sl.RemoveHead(), sl, '/', 2));
- if(port < 0 || port > 0xffff) return false;
- m_port = port;
+ int port = _wtoi(Explode(sl.RemoveHead(), sl, '/', 2));
+ if(port < 0 || port > 0xffff) return false;
+ m_port = port;
- if(sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype)))
- m_subtype = MEDIASUBTYPE_NULL; // TODO: detect subtype
+ if(sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype)))
+ m_subtype = MEDIASUBTYPE_NULL; // TODO: detect subtype
- CAMThread::Create();
- if(FAILED(CAMThread::CallWorker(CMD_RUN)))
- {
- Clear();
- return false;
- }
+ CAMThread::Create();
+ if(FAILED(CAMThread::CallWorker(CMD_RUN)))
+ {
+ Clear();
+ return false;
+ }
- clock_t start = clock();
- while(clock() - start < 3000 && m_len < 1000000)
- Sleep(100);
+ clock_t start = clock();
+ while(clock() - start < 3000 && m_len < 1000000)
+ Sleep(100);
- return true;
+ return true;
}
HRESULT CUDPStream::SetPointer(LONGLONG llPos)
{
- CAutoLock cAutoLock(&m_csLock);
+ CAutoLock cAutoLock(&m_csLock);
- if(m_packets.IsEmpty() && llPos != 0
- || !m_packets.IsEmpty() && llPos < m_packets.GetHead()->m_start
- || !m_packets.IsEmpty() && llPos > m_packets.GetTail()->m_end)
- {
- TRACE(_T("CUDPStream: SetPointer error\n"));
- return E_FAIL;
- }
+ if(m_packets.IsEmpty() && llPos != 0
+ || !m_packets.IsEmpty() && llPos < m_packets.GetHead()->m_start
+ || !m_packets.IsEmpty() && llPos > m_packets.GetTail()->m_end)
+ {
+ TRACE(_T("CUDPStream: SetPointer error\n"));
+ return E_FAIL;
+ }
- m_pos = llPos;
+ m_pos = llPos;
- return S_OK;
+ return S_OK;
}
HRESULT CUDPStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
{
- CAutoLock cAutoLock(&m_csLock);
-
- DWORD len = dwBytesToRead;
- BYTE* ptr = pbBuffer;
-
- while(len > 0 && !m_packets.IsEmpty())
- {
- POSITION pos = m_packets.GetHeadPosition();
- while(pos && len > 0)
- {
- packet_t* p = m_packets.GetNext(pos);
-
- if(p->m_start <= m_pos && m_pos < p->m_end)
- {
- int size;
-
- if(m_pos < p->m_start)
- {
- ASSERT(0);
- size = min(len, p->m_start - m_pos);
- memset(ptr, 0, size);
- }
- else
- {
- size = min(len, p->m_end - m_pos);
- memcpy(ptr, &p->m_buff[m_pos - p->m_start], size);
- }
-
- m_pos += size;
-
- ptr += size;
- len -= size;
- }
-
- if(p->m_end <= m_pos - 2048 && BUFF_SIZE_FIRST <= m_pos)
- {
- while(m_packets.GetHeadPosition() != pos)
- delete m_packets.RemoveHead();
- }
-
- }
- }
-
- if(pdwBytesRead)
- *pdwBytesRead = ptr - pbBuffer;
-
- return S_OK;
+ CAutoLock cAutoLock(&m_csLock);
+
+ DWORD len = dwBytesToRead;
+ BYTE* ptr = pbBuffer;
+
+ while(len > 0 && !m_packets.IsEmpty())
+ {
+ POSITION pos = m_packets.GetHeadPosition();
+ while(pos && len > 0)
+ {
+ packet_t* p = m_packets.GetNext(pos);
+
+ if(p->m_start <= m_pos && m_pos < p->m_end)
+ {
+ int size;
+
+ if(m_pos < p->m_start)
+ {
+ ASSERT(0);
+ size = min(len, p->m_start - m_pos);
+ memset(ptr, 0, size);
+ }
+ else
+ {
+ size = min(len, p->m_end - m_pos);
+ memcpy(ptr, &p->m_buff[m_pos - p->m_start], size);
+ }
+
+ m_pos += size;
+
+ ptr += size;
+ len -= size;
+ }
+
+ if(p->m_end <= m_pos - 2048 && BUFF_SIZE_FIRST <= m_pos)
+ {
+ while(m_packets.GetHeadPosition() != pos)
+ delete m_packets.RemoveHead();
+ }
+
+ }
+ }
+
+ if(pdwBytesRead)
+ *pdwBytesRead = ptr - pbBuffer;
+
+ return S_OK;
}
LONGLONG CUDPStream::Size(LONGLONG* pSizeAvailable)
{
- CAutoLock cAutoLock(&m_csLock);
- if(pSizeAvailable) *pSizeAvailable = m_len;
- return 0;
+ CAutoLock cAutoLock(&m_csLock);
+ if(pSizeAvailable) *pSizeAvailable = m_len;
+ return 0;
}
DWORD CUDPStream::Alignment()
@@ -314,150 +310,138 @@ void CUDPStream::Unlock()
DWORD CUDPStream::ThreadProc()
{
- WSADATA wsaData;
- WSAStartup(MAKEWORD(2, 2), &wsaData);
-
- sockaddr_in addr;
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
- addr.sin_port = htons((u_short)m_port);
-
- ip_mreq imr;
- imr.imr_multiaddr.s_addr = inet_addr(CStringA(m_ip));
- imr.imr_interface.s_addr = INADDR_ANY;
-
- if((m_socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0)
- {
- /* u_long argp = 1;
- ioctlsocket(m_socket, FIONBIO, &argp);
- */
- DWORD dw = TRUE;
- if(setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&dw, sizeof(dw)) < 0)
- {
- closesocket(m_socket);
- m_socket = -1;
- }
-
- if(bind(m_socket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
- {
- closesocket(m_socket);
- m_socket = -1;
- }
-
- if(IN_MULTICAST(htonl(imr.imr_multiaddr.s_addr)))
- {
- int ret = setsockopt(m_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&imr, sizeof(imr));
- if(ret < 0) ret = ::WSAGetLastError();
- ret = ret;
- }
- }
-
- SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL);
-
- FILE* dump = NULL;
+ WSADATA wsaData;
+ WSAStartup(MAKEWORD(2, 2), &wsaData);
+
+ sockaddr_in addr;
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ addr.sin_port = htons((u_short)m_port);
+
+ ip_mreq imr;
+ imr.imr_multiaddr.s_addr = inet_addr(CStringA(m_ip));
+ imr.imr_interface.s_addr = INADDR_ANY;
+
+ if((m_socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0)
+ {
+/* u_long argp = 1;
+ ioctlsocket(m_socket, FIONBIO, &argp);
+*/
+ DWORD dw = TRUE;
+ if(setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&dw, sizeof(dw)) < 0)
+ {
+ closesocket(m_socket);
+ m_socket = -1;
+ }
+
+ if(bind(m_socket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
+ {
+ closesocket(m_socket);
+ m_socket = -1;
+ }
+
+ if(IN_MULTICAST(htonl(imr.imr_multiaddr.s_addr)))
+ {
+ int ret = setsockopt(m_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&imr, sizeof(imr));
+ if(ret < 0) ret = ::WSAGetLastError();
+ ret = ret;
+ }
+ }
+
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL);
+
+ FILE* dump = NULL;
// dump = _tfopen(_T("c:\\udp.ts"), _T("wb"));
- FILE* log = NULL;
+ FILE* log = NULL;
// log = _tfopen(_T("c:\\udp.txt"), _T("wt"));
- while(1)
- {
- DWORD cmd = GetRequest();
-
- switch(cmd)
- {
- default:
- case CMD_EXIT:
- if(m_socket >= 0)
- {
- closesocket(m_socket);
- m_socket = -1;
- }
- WSACleanup();
- if(dump) fclose(dump);
- if(log) fclose(log);
- Reply(S_OK);
- return 0;
- case CMD_RUN:
- Reply(m_socket >= 0 ? S_OK : E_FAIL);
-
- {
- char buff[65536*2];
- int buffsize = 0;
-
- for(unsigned int i = 0; ; i++)
- {
- if(!(i & 0xff))
- {
- if(CheckRequest(NULL))
- break;
- }
-
- int fromlen = sizeof(addr);
- int len = recvfrom(m_socket, &buff[buffsize], 65536, 0, (SOCKADDR*)&addr, &fromlen);
- if(len <= 0)
- {
- Sleep(1);
- continue;
- }
-
- if(log)
- {
- if(buffsize >= len && !memcmp(&buff[buffsize-len], &buff[buffsize], len))
- {
- DWORD pid = ((buff[buffsize+1] << 8) | buff[buffsize+2]) & 0x1fff;
- DWORD counter = buff[buffsize+3] & 0xf;
- _ftprintf(log, _T("%04d %2d DUP\n"), pid, counter);
- }
- }
-
- buffsize += len;
-
- if(buffsize >= 65536 || m_len == 0)
- {
- if(dump)
- {
- fwrite(buff, buffsize, 1, dump);
- }
-
- if(log)
- {
- static BYTE pid2counter[0x2000];
- static bool init = false;
- if(!init)
- {
- memset(pid2counter, 0, sizeof(pid2counter));
- init = true;
- }
-
- for(int i = 0; i < buffsize; i += 188)
- {
- DWORD pid = ((buff[i+1] << 8) | buff[i+2]) & 0x1fff;
- DWORD counter = buff[i+3] & 0xf;
- if(pid2counter[pid] != ((counter - 1 + 16) & 15))
- _ftprintf(log, _T("%04x %2d -> %2d\n"), pid, pid2counter[pid], counter);
- pid2counter[pid] = counter;
- }
- }
-
- Append((BYTE*)buff, buffsize);
- buffsize = 0;
- }
- }
- }
- break;
- }
- }
-
- ASSERT(0);
- return -1;
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ if(m_socket >= 0) {closesocket(m_socket); m_socket = -1;}
+ WSACleanup();
+ if(dump) fclose(dump);
+ if(log) fclose(log);
+ Reply(S_OK);
+ return 0;
+ case CMD_RUN:
+ Reply(m_socket >= 0 ? S_OK : E_FAIL);
+
+ {
+ char buff[65536*2];
+ int buffsize = 0;
+
+ for(unsigned int i = 0; ; i++)
+ {
+ if(!(i&0xff))
+ {
+ if(CheckRequest(NULL))
+ break;
+ }
+
+ int fromlen = sizeof(addr);
+ int len = recvfrom(m_socket, &buff[buffsize], 65536, 0, (SOCKADDR*)&addr, &fromlen);
+ if(len <= 0) {Sleep(1); continue;}
+
+ if(log)
+ {
+ if(buffsize >= len && !memcmp(&buff[buffsize-len], &buff[buffsize], len))
+ {
+ DWORD pid = ((buff[buffsize+1]<<8)|buff[buffsize+2])&0x1fff;
+ DWORD counter = buff[buffsize+3]&0xf;
+ _ftprintf(log, _T("%04d %2d DUP\n"), pid, counter);
+ }
+ }
+
+ buffsize += len;
+
+ if(buffsize >= 65536 || m_len == 0)
+ {
+ if(dump)
+ {
+ fwrite(buff, buffsize, 1, dump);
+ }
+
+ if(log)
+ {
+ static BYTE pid2counter[0x2000];
+ static bool init = false;
+ if(!init) {memset(pid2counter, 0, sizeof(pid2counter)); init = true;}
+
+ for(int i = 0; i < buffsize; i += 188)
+ {
+ DWORD pid = ((buff[i+1]<<8)|buff[i+2])&0x1fff;
+ DWORD counter = buff[i+3]&0xf;
+ if(pid2counter[pid] != ((counter-1+16)&15))
+ _ftprintf(log, _T("%04x %2d -> %2d\n"), pid, pid2counter[pid], counter);
+ pid2counter[pid] = counter;
+ }
+ }
+
+ Append((BYTE*)buff, buffsize);
+ buffsize = 0;
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ ASSERT(0);
+ return -1;
}
-CUDPStream::packet_t::packet_t(BYTE* p, __int64 start, __int64 end)
- : m_start(start)
- , m_end(end)
+CUDPStream::packet_t::packet_t(BYTE* p, __int64 start, __int64 end)
+ : m_start(start)
+ , m_end(end)
{
- int size = end - start;
- m_buff = DNew BYTE[size];
- memcpy(m_buff, p, size);
+ int size = end - start;
+ m_buff = DNew BYTE[size];
+ memcpy(m_buff, p, size);
}
diff --git a/src/filters/reader/UDPReader/UDPReader.h b/src/filters/reader/UDPReader/UDPReader.h
index 8a42702fc..863fa277d 100644
--- a/src/filters/reader/UDPReader/UDPReader.h
+++ b/src/filters/reader/UDPReader/UDPReader.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,66 +30,60 @@ class CUDPStream : public CAsyncStream, public CAMThread
private:
CCritSec m_csLock;
- class packet_t
- {
- public:
- BYTE* m_buff;
- __int64 m_start, m_end;
- packet_t(BYTE* p, __int64 start, __int64 end);
- virtual ~packet_t()
- {
- delete [] m_buff;
- }
- };
+ class packet_t
+ {
+ public:
+ BYTE* m_buff;
+ __int64 m_start, m_end;
+ packet_t(BYTE* p, __int64 start, __int64 end);
+ virtual ~packet_t() {delete [] m_buff;}
+ };
- int m_port;
- CString m_ip;
- SOCKET m_socket;
- GUID m_subtype;
- __int64 m_pos, m_len;
- bool m_drop;
- CAtlList<packet_t*> m_packets;
+ int m_port;
+ CString m_ip;
+ SOCKET m_socket;
+ GUID m_subtype;
+ __int64 m_pos, m_len;
+ bool m_drop;
+ CAtlList<packet_t*> m_packets;
- void Clear();
- void Append(BYTE* buff, int len);
+ void Clear();
+ void Append(BYTE* buff, int len);
- enum {CMD_EXIT, CMD_RUN};
- DWORD ThreadProc();
+ enum {CMD_EXIT, CMD_RUN};
+ DWORD ThreadProc();
public:
- CUDPStream();
- virtual ~CUDPStream();
+ CUDPStream();
+ virtual ~CUDPStream();
- bool Load(const WCHAR* fnw);
- const GUID& GetSubType()
- {
- return m_subtype;
- }
+ bool Load(const WCHAR* fnw);
+ const GUID& GetSubType() {return m_subtype;}
HRESULT SetPointer(LONGLONG llPos);
HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
LONGLONG Size(LONGLONG* pSizeAvailable);
DWORD Alignment();
void Lock();
- void Unlock();
+ void Unlock();
};
[uuid("0E4221A9-9718-48D5-A5CF-4493DAD4A015")]
-class CUDPReader
- : public CAsyncReader
- , public IFileSourceFilter
+class CUDPReader
+ : public CAsyncReader
+ , public IFileSourceFilter
{
- CUDPStream m_stream;
- CStringW m_fn;
+ CUDPStream m_stream;
+ CStringW m_fn;
public:
CUDPReader(IUnknown* pUnk, HRESULT* phr);
- ~CUDPReader();
+ ~CUDPReader();
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
};
diff --git a/src/filters/reader/UDPReader/resource.h b/src/filters/reader/UDPReader/resource.h
index 440a1b299..320510fa1 100644
--- a/src/filters/reader/UDPReader/resource.h
+++ b/src/filters/reader/UDPReader/resource.h
@@ -3,7 +3,7 @@
// Used by udpreader.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/reader/UDPReader/stdafx.cpp b/src/filters/reader/UDPReader/stdafx.cpp
index 6566b4234..a416647fd 100644
--- a/src/filters/reader/UDPReader/stdafx.cpp
+++ b/src/filters/reader/UDPReader/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/UDPReader/stdafx.h b/src/filters/reader/UDPReader/stdafx.h
index 488c7089a..f4d095421 100644
--- a/src/filters/reader/UDPReader/stdafx.h
+++ b/src/filters/reader/UDPReader/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/VTSReader/VTSReader.cpp b/src/filters/reader/VTSReader/VTSReader.cpp
index a8a0fa408..371dd4fbb 100644
--- a/src/filters/reader/VTSReader/VTSReader.cpp
+++ b/src/filters/reader/VTSReader/VTSReader.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,47 +28,47 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PROGRAM},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PROGRAM},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CVTSReader), L"MPC - VTS Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CVTSReader), L"MPC - VTS Reader", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CVTSReader>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CVTSReader>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- if(GetVersion() & 0x80000000)
- return E_NOTIMPL;
+ if(GetVersion()&0x80000000)
+ return E_NOTIMPL;
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"),
- _T("0"), _T("0,12,,445644564944454F2D565453")); // "DVDVIDEO-VTS"
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"),
+ _T("0"), _T("0,12,,445644564944454F2D565453")); // "DVDVIDEO-VTS"
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"),
- _T("Source Filter"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"),
+ _T("Source Filter"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -82,15 +82,15 @@ CFilterApp theApp;
//
CVTSReader::CVTSReader(IUnknown* pUnk, HRESULT* phr)
- : CAsyncReader(NAME("CVTSReader"), pUnk, &m_stream, phr, __uuidof(this))
+ : CAsyncReader(NAME("CVTSReader"), pUnk, &m_stream, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- if(GetVersion() & 0x80000000)
- {
- if(phr) *phr = E_NOTIMPL;
- return;
- }
+ if(GetVersion()&0x80000000)
+ {
+ if(phr) *phr = E_NOTIMPL;
+ return;
+ }
}
CVTSReader::~CVTSReader()
@@ -101,45 +101,45 @@ STDMETHODIMP CVTSReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IFileSourceFilter)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IFileSourceFilter
-STDMETHODIMP CVTSReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CVTSReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(!m_stream.Load(pszFileName))
- return E_FAIL;
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- CMediaType mt;
- mt.majortype = MEDIATYPE_Stream;
- mt.subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
- m_mt = mt;
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
+ m_mt = mt;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CVTSReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- wcscpy(*ppszFileName, m_fn);
+ wcscpy(*ppszFileName, m_fn);
- return S_OK;
+ return S_OK;
}
// CVTSStream
CVTSStream::CVTSStream() : m_off(0)
{
- m_vob.Attach(DNew CVobFile());
+ m_vob.Attach(DNew CVobFile());
}
CVTSStream::~CVTSStream()
@@ -148,55 +148,55 @@ CVTSStream::~CVTSStream()
bool CVTSStream::Load(const WCHAR* fnw)
{
- CAtlList<CString> sl;
- return(m_vob && m_vob->Open(CString(fnw), sl) /*&& m_vob->IsDVD()*/);
+ CAtlList<CString> sl;
+ return(m_vob && m_vob->Open(CString(fnw), sl) /*&& m_vob->IsDVD()*/);
}
HRESULT CVTSStream::SetPointer(LONGLONG llPos)
{
- m_off = (int)(llPos & 2047);
- int lba = (int)(llPos / 2048);
+ m_off = (int)(llPos&2047);
+ int lba = (int)(llPos/2048);
- return lba == m_vob->Seek(lba) ? S_OK : S_FALSE;
+ return lba == m_vob->Seek(lba) ? S_OK : S_FALSE;
}
HRESULT CVTSStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
{
- CAutoLock lck(&m_csLock);
+ CAutoLock lck(&m_csLock);
- DWORD len = dwBytesToRead;
- BYTE* ptr = pbBuffer;
+ DWORD len = dwBytesToRead;
+ BYTE* ptr = pbBuffer;
- while(len > 0)
- {
- BYTE buff[2048];
- if(!m_vob->Read(buff))
- break;
+ while(len > 0)
+ {
+ BYTE buff[2048];
+ if(!m_vob->Read(buff))
+ break;
- int size = min(2048 - m_off, min(len, 2048));
+ int size = min(2048 - m_off, min(len, 2048));
- memcpy(ptr, &buff[m_off], size);
+ memcpy(ptr, &buff[m_off], size);
- m_off = (m_off + size) & 2047;
+ m_off = (m_off + size)&2047;
- if(m_off > 0)
- m_vob->Seek(m_vob->GetPosition() - 1);
+ if(m_off > 0)
+ m_vob->Seek(m_vob->GetPosition()-1);
- ptr += size;
- len -= size;
- }
+ ptr += size;
+ len -= size;
+ }
- if(pdwBytesRead)
- *pdwBytesRead = ptr - pbBuffer;
+ if(pdwBytesRead)
+ *pdwBytesRead = ptr - pbBuffer;
- return S_OK;
+ return S_OK;
}
LONGLONG CVTSStream::Size(LONGLONG* pSizeAvailable)
{
- LONGLONG len = 2048i64 * m_vob->GetLength();
- if(pSizeAvailable) *pSizeAvailable = len;
- return(len);
+ LONGLONG len = 2048i64*m_vob->GetLength();
+ if(pSizeAvailable) *pSizeAvailable = len;
+ return(len);
}
DWORD CVTSStream::Alignment()
diff --git a/src/filters/reader/VTSReader/VTSReader.h b/src/filters/reader/VTSReader/VTSReader.h
index 5a3c2a0fc..992351bfc 100644
--- a/src/filters/reader/VTSReader/VTSReader.h
+++ b/src/filters/reader/VTSReader/VTSReader.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -32,39 +32,39 @@ class CVTSStream : public CAsyncStream
private:
CCritSec m_csLock;
- CAutoPtr<CVobFile> m_vob;
- int m_off;
+ CAutoPtr<CVobFile> m_vob;
+ int m_off;
public:
- CVTSStream();
- virtual ~CVTSStream();
+ CVTSStream();
+ virtual ~CVTSStream();
- bool Load(const WCHAR* fnw);
+ bool Load(const WCHAR* fnw);
HRESULT SetPointer(LONGLONG llPos);
HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
LONGLONG Size(LONGLONG* pSizeAvailable);
DWORD Alignment();
void Lock();
- void Unlock();
+ void Unlock();
};
[uuid("773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73")]
-class CVTSReader
- : public CAsyncReader
- , public IFileSourceFilter
+class CVTSReader
+ : public CAsyncReader
+ , public IFileSourceFilter
{
- CVTSStream m_stream;
- CStringW m_fn;
+ CVTSStream m_stream;
+ CStringW m_fn;
public:
CVTSReader(IUnknown* pUnk, HRESULT* phr);
- ~CVTSReader();
+ ~CVTSReader();
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
};
diff --git a/src/filters/reader/VTSReader/resource.h b/src/filters/reader/VTSReader/resource.h
index 1b23a414b..de42e25ad 100644
--- a/src/filters/reader/VTSReader/resource.h
+++ b/src/filters/reader/VTSReader/resource.h
@@ -3,7 +3,7 @@
// Used by vtsreader.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/reader/VTSReader/stdafx.cpp b/src/filters/reader/VTSReader/stdafx.cpp
index cbc634206..edb7e9517 100644
--- a/src/filters/reader/VTSReader/stdafx.cpp
+++ b/src/filters/reader/VTSReader/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/VTSReader/stdafx.h b/src/filters/reader/VTSReader/stdafx.h
index 15801800a..4c5d23feb 100644
--- a/src/filters/reader/VTSReader/stdafx.h
+++ b/src/filters/reader/VTSReader/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/reader/asyncreader/asyncio.cpp b/src/filters/reader/asyncreader/asyncio.cpp
index b84d44c70..3f6494a6f 100644
--- a/src/filters/reader/asyncreader/asyncio.cpp
+++ b/src/filters/reader/asyncreader/asyncio.cpp
@@ -55,33 +55,25 @@ CAsyncRequest::Complete()
m_pStream->Lock();
m_hr = m_pStream->SetPointer(m_llPos);
- if(S_OK == m_hr)
- {
+ if (S_OK == m_hr) {
DWORD dwActual;
m_hr = m_pStream->Read(m_pBuffer, m_lLength, m_bAligned, &dwActual);
- if(m_hr == OLE_S_FIRST)
- {
- if(m_pContext)
- {
+ if (m_hr == OLE_S_FIRST) {
+ if (m_pContext) {
IMediaSample *pSample = reinterpret_cast<IMediaSample *>(m_pContext);
pSample->SetDiscontinuity(TRUE);
m_hr = S_OK;
}
}
- if(FAILED(m_hr))
- {
- }
- else if(dwActual != (DWORD)m_lLength)
- {
+ if (FAILED(m_hr)) {
+ } else if (dwActual != (DWORD)m_lLength) {
// tell caller size changed - probably because of EOF
m_lLength = (LONG) dwActual;
m_hr = S_FALSE;
- }
- else
- {
+ } else {
m_hr = S_OK;
}
}
@@ -97,16 +89,16 @@ CAsyncRequest::Complete()
// note - all events created manual reset
CAsyncIo::CAsyncIo(CAsyncStream *pStream)
- : m_hThread(NULL),
- m_evWork(TRUE),
- m_evDone(TRUE),
- m_evStop(TRUE),
- m_listWork(NAME("Work list")),
- m_listDone(NAME("Done list")),
- m_bFlushing(FALSE),
- m_cItemsOut(0),
- m_bWaiting(FALSE),
- m_pStream(pStream)
+ : m_hThread(NULL),
+ m_evWork(TRUE),
+ m_evDone(TRUE),
+ m_evStop(TRUE),
+ m_listWork(NAME("Work list")),
+ m_listDone(NAME("Done list")),
+ m_bFlushing(FALSE),
+ m_cItemsOut(0),
+ m_bWaiting(FALSE),
+ m_pStream(pStream)
{
}
@@ -122,8 +114,7 @@ CAsyncIo::~CAsyncIo()
// empty the done list
POSITION pos = m_listDone.GetHeadPosition();
- while(pos)
- {
+ while (pos) {
CAsyncRequest* pRequest = m_listDone.GetNext(pos);
delete pRequest;
}
@@ -155,19 +146,17 @@ CAsyncIo::AsyncInactive(void)
// add a request to the queue.
HRESULT
CAsyncIo::Request(
- LONGLONG llPos,
- LONG lLength,
- BOOL bAligned,
- BYTE* pBuffer,
- LPVOID pContext,
- DWORD dwUser)
+ LONGLONG llPos,
+ LONG lLength,
+ BOOL bAligned,
+ BYTE* pBuffer,
+ LPVOID pContext,
+ DWORD dwUser)
{
- if(bAligned)
- {
- if(!IsAligned(llPos) ||
- !IsAligned(lLength) ||
- !IsAligned((LONG) pBuffer))
- {
+ if (bAligned) {
+ if (!IsAligned(llPos) ||
+ !IsAligned(lLength) ||
+ !IsAligned((LONG) pBuffer)) {
return VFW_E_BADALIGN;
}
}
@@ -175,22 +164,20 @@ CAsyncIo::Request(
CAsyncRequest* pRequest = DNew CAsyncRequest;
HRESULT hr = pRequest->Request(
- this,
- m_pStream,
- llPos,
- lLength,
- bAligned,
- pBuffer,
- pContext,
- dwUser);
- if(SUCCEEDED(hr))
- {
+ this,
+ m_pStream,
+ llPos,
+ lLength,
+ bAligned,
+ pBuffer,
+ pContext,
+ dwUser);
+ if (SUCCEEDED(hr)) {
// might fail if flushing
hr = PutWorkItem(pRequest);
}
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
delete pRequest;
}
return hr;
@@ -211,35 +198,28 @@ CAsyncIo::WaitForNext(
// wait until the event is set, but since we are not
// holding the critsec when waiting, we may need to re-wait
- for(;;)
- {
+ for (;;) {
- if(!m_evDone.Wait(dwTimeout))
- {
+ if (!m_evDone.Wait(dwTimeout)) {
// timeout occurred
return VFW_E_TIMEOUT;
}
// get next event from list
CAsyncRequest* pRequest = GetDoneItem();
- if(pRequest)
- {
+ if (pRequest) {
// found a completed request
// check if ok
HRESULT hr = pRequest->GetHResult();
- if(hr == S_FALSE)
- {
+ if (hr == S_FALSE) {
// this means the actual length was less than
// requested - may be ok if he aligned the end of file
- if((pRequest->GetActualLength() +
- pRequest->GetStart()) == Size())
- {
+ if ((pRequest->GetActualLength() +
+ pRequest->GetStart()) == Size()) {
hr = S_OK;
- }
- else
- {
+ } else {
// it was an actual read error
hr = E_FAIL;
}
@@ -254,13 +234,10 @@ CAsyncIo::WaitForNext(
delete pRequest;
return hr;
- }
- else
- {
+ } else {
// Hold the critical section while checking the list state
CAutoLock lck(&m_csLists);
- if(m_bFlushing && !m_bWaiting)
- {
+ if (m_bFlushing && !m_bWaiting) {
// can't block as we are between BeginFlush and EndFlush
@@ -280,34 +257,32 @@ CAsyncIo::WaitForNext(
// Need to hold m_csFile while doing this (done in request object)
HRESULT
CAsyncIo::SyncReadAligned(
- LONGLONG llPos,
- LONG lLength,
- BYTE* pBuffer,
- LONG* pcbActual,
- PVOID pvContext
-)
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer,
+ LONG* pcbActual,
+ PVOID pvContext
+ )
{
- if(!IsAligned(llPos) ||
- !IsAligned(lLength) ||
- !IsAligned((LONG) pBuffer))
- {
+ if (!IsAligned(llPos) ||
+ !IsAligned(lLength) ||
+ !IsAligned((LONG) pBuffer)) {
return VFW_E_BADALIGN;
}
CAsyncRequest request;
HRESULT hr = request.Request(
- this,
- m_pStream,
- llPos,
- lLength,
- TRUE,
- pBuffer,
- pvContext,
- 0);
-
- if(FAILED(hr))
- {
+ this,
+ m_pStream,
+ llPos,
+ lLength,
+ TRUE,
+ pBuffer,
+ pvContext,
+ 0);
+
+ if (FAILED(hr)) {
return hr;
}
@@ -354,15 +329,13 @@ CAsyncIo::BeginFlush()
m_bFlushing = TRUE;
CAsyncRequest * preq;
- while((preq = GetWorkItem()) != 0)
- {
+ while((preq = GetWorkItem()) != 0) {
preq->Cancel();
PutDoneItem(preq);
}
// now wait for any outstanding requests to complete
- if(m_cItemsOut > 0)
- {
+ if (m_cItemsOut > 0) {
// can be only one person waiting
ASSERT(!m_bWaiting);
@@ -371,9 +344,7 @@ CAsyncIo::BeginFlush()
// signalled via m_evAllDone when all outstanding items are
// done. It also tells WaitForNext to continue blocking.
m_bWaiting = TRUE;
- }
- else
- {
+ } else {
// all done
// force m_evDone set so that even if list is empty,
@@ -388,15 +359,13 @@ CAsyncIo::BeginFlush()
ASSERT(m_bWaiting);
// wait without holding critsec
- for(;;)
- {
+ for (;;) {
m_evAllDone.Wait();
{
// hold critsec to check
CAutoLock lock(&m_csLists);
- if(m_cItemsOut == 0)
- {
+ if (m_cItemsOut == 0) {
// now we are sure that all outstanding requests are on
// the done list and no more will be accepted
@@ -426,12 +395,9 @@ CAsyncIo::EndFlush()
// m_evDone might have been set by BeginFlush - ensure it is
// set IFF m_listDone is non-empty
- if(m_listDone.GetCount() > 0)
- {
+ if (m_listDone.GetCount() > 0) {
m_evDone.Set();
- }
- else
- {
+ } else {
m_evDone.Reset();
}
@@ -442,8 +408,7 @@ CAsyncIo::EndFlush()
HRESULT
CAsyncIo::StartThread(void)
{
- if(m_hThread)
- {
+ if (m_hThread) {
return S_OK;
}
@@ -458,9 +423,8 @@ CAsyncIo::StartThread(void)
this,
0,
&dwThreadID);
- if(!m_hThread)
- {
- DWORD dwErr = GetLastError();
+ if (!m_hThread) {
+ DWORD dwErr = GetLastError();
return HRESULT_FROM_WIN32(dwErr);
}
return S_OK;
@@ -473,8 +437,7 @@ CAsyncIo::CloseThread(void)
// signal the thread-exit object
m_evStop.Set();
- if(m_hThread)
- {
+ if (m_hThread) {
WaitForSingleObject(m_hThread, INFINITE);
CloseHandle(m_hThread);
@@ -496,8 +459,7 @@ CAsyncIo::GetWorkItem()
CAsyncRequest * preq = m_listWork.RemoveHead();
// force event set correctly
- if(m_listWork.GetCount() == 0)
- {
+ if (m_listWork.GetCount() == 0) {
m_evWork.Reset();
}
return preq;
@@ -521,9 +483,8 @@ CAsyncIo::GetDoneItem()
// has moved to the done list which means we must wait until
// cItemsOut is 0 (which is guaranteed by m_bWaiting being TRUE).
- if(m_listDone.GetCount() == 0 &&
- (!m_bFlushing || m_bWaiting))
- {
+ if (m_listDone.GetCount() == 0 &&
+ (!m_bFlushing || m_bWaiting)) {
m_evDone.Reset();
}
@@ -537,12 +498,10 @@ CAsyncIo::PutWorkItem(CAsyncRequest* pRequest)
CAutoLock lock(&m_csLists);
HRESULT hr;
- if(m_bFlushing)
- {
+ if (m_bFlushing) {
hr = VFW_E_WRONG_STATE;
}
- else if(m_listWork.AddTail(pRequest))
- {
+ else if (m_listWork.AddTail(pRequest)) {
// event should now be in a set state - force this
m_evWork.Set();
@@ -550,9 +509,7 @@ CAsyncIo::PutWorkItem(CAsyncRequest* pRequest)
// start the thread now if not already started
hr = StartThread();
- }
- else
- {
+ } else {
hr = E_OUTOFMEMORY;
}
@@ -566,15 +523,12 @@ CAsyncIo::PutDoneItem(CAsyncRequest* pRequest)
{
ASSERT(CritCheckIn(&m_csLists));
- if(m_listDone.AddTail(pRequest))
- {
+ if (m_listDone.AddTail(pRequest)) {
// event should now be in a set state - force this
m_evDone.Set();
return S_OK;
- }
- else
- {
+ } else {
return E_OUTOFMEMORY;
}
}
@@ -585,14 +539,12 @@ CAsyncIo::ProcessRequests(void)
{
// lock to get the item and increment the outstanding count
CAsyncRequest * preq = NULL;
- for(;;)
- {
+ for (;;) {
{
CAutoLock lock(&m_csLists);
preq = GetWorkItem();
- if(preq == NULL)
- {
+ if (preq == NULL) {
// done
return;
}
@@ -611,10 +563,8 @@ CAsyncIo::ProcessRequests(void)
PutDoneItem(preq);
- if(--m_cItemsOut == 0)
- {
- if(m_bWaiting)
- {
+ if (--m_cItemsOut == 0) {
+ if (m_bWaiting) {
m_evAllDone.Set();
}
}
@@ -629,24 +579,20 @@ CAsyncIo::ThreadProc(void)
{
HANDLE ahev[] = {m_evStop, m_evWork};
- for(;;)
- {
- DWORD dw = WaitForMultipleObjects(
- 2,
- ahev,
- FALSE,
- INFINITE);
- if(dw == WAIT_OBJECT_0 + 1)
- {
-
- // requests need processing
- ProcessRequests();
- }
- else
- {
- // any error or stop event - we should exit
- return 0;
- }
+ for (;;) {
+ DWORD dw = WaitForMultipleObjects(
+ 2,
+ ahev,
+ FALSE,
+ INFINITE);
+ if (dw == WAIT_OBJECT_0+1) {
+
+ // requests need processing
+ ProcessRequests();
+ } else {
+ // any error or stop event - we should exit
+ return 0;
+ }
}
}
@@ -656,16 +602,15 @@ CAsyncIo::ThreadProc(void)
// may not be aligned - so we will have to buffer.
HRESULT
CAsyncIo::SyncRead(
- LONGLONG llPos,
- LONG lLength,
- BYTE* pBuffer)
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer)
{
- if(IsAligned(llPos) &&
- IsAligned(lLength) &&
- IsAligned((LONG) pBuffer))
- {
+ if (IsAligned(llPos) &&
+ IsAligned(lLength) &&
+ IsAligned((LONG) pBuffer)) {
LONG cbUnused;
- return SyncReadAligned(llPos, lLength, pBuffer, &cbUnused, NULL);
+ return SyncReadAligned(llPos, lLength, pBuffer, &cbUnused, NULL);
}
// not aligned with requirements - use buffered file handle.
@@ -674,17 +619,16 @@ CAsyncIo::SyncRead(
CAsyncRequest request;
HRESULT hr = request.Request(
- this,
- m_pStream,
- llPos,
- lLength,
- FALSE,
- pBuffer,
- NULL,
- 0);
-
- if(FAILED(hr))
- {
+ this,
+ m_pStream,
+ llPos,
+ lLength,
+ FALSE,
+ pBuffer,
+ NULL,
+ 0);
+
+ if (FAILED(hr)) {
return hr;
}
diff --git a/src/filters/reader/asyncreader/asyncio.h b/src/filters/reader/asyncreader/asyncio.h
index bf84cd2ca..0f463bf7a 100644
--- a/src/filters/reader/asyncreader/asyncio.h
+++ b/src/filters/reader/asyncreader/asyncio.h
@@ -57,14 +57,14 @@ public:
// init the params for this request. Issue the i/o
// if overlapped i/o is possible.
HRESULT Request(
- CAsyncIo *pIo,
+ CAsyncIo *pIo,
CAsyncStream *pStream,
- LONGLONG llPos,
- LONG lLength,
+ LONGLONG llPos,
+ LONG lLength,
BOOL bAligned,
- BYTE* pBuffer,
- LPVOID pContext, // filter's context
- DWORD dwUser); // downstream filter's context
+ BYTE* pBuffer,
+ LPVOID pContext, // filter's context
+ DWORD dwUser); // downstream filter's context
// issue the i/o if not overlapped, and block until i/o complete.
// returns error code of file i/o
@@ -73,33 +73,30 @@ public:
// cancels the i/o. blocks until i/o is no longer pending
HRESULT Cancel() const
{
- return S_OK;
+ return S_OK;
};
// accessor functions
LPVOID GetContext() /*const*/
{
- return m_pContext;
+ return m_pContext;
};
DWORD GetUser() const
{
- return m_dwUser;
+ return m_dwUser;
};
- HRESULT GetHResult() const
- {
+ HRESULT GetHResult() const {
return m_hr;
};
// we set m_lLength to the actual length
- LONG GetActualLength() const
- {
+ LONG GetActualLength() const {
return m_lLength;
};
- LONGLONG GetStart() const
- {
+ LONGLONG GetStart() const {
return m_llPos;
};
};
@@ -151,8 +148,7 @@ class CAsyncIo
CAMEvent m_evStop; // set when thread should exit
HANDLE m_hThread;
- LONGLONG Size()
- {
+ LONGLONG Size() {
ASSERT(m_pStream != NULL);
return m_pStream->Size();
};
@@ -183,10 +179,9 @@ class CAsyncIo
// initial static thread proc calls ThreadProc with DWORD
// param as this
- static DWORD WINAPI InitialThreadProc(LPVOID pv)
- {
- CAsyncIo * pThis = static_cast<CAsyncIo*>(pv);
- return pThis->ThreadProc();
+ static DWORD WINAPI InitialThreadProc(LPVOID pv) {
+ CAsyncIo * pThis = static_cast<CAsyncIo*> (pv);
+ return pThis->ThreadProc();
};
DWORD ThreadProc(void);
@@ -209,36 +204,36 @@ public:
// queue a requested read. must be aligned.
HRESULT Request(
- LONGLONG llPos,
- LONG lLength,
- BOOL bAligned,
- BYTE* pBuffer,
- LPVOID pContext,
- DWORD dwUser);
+ LONGLONG llPos,
+ LONG lLength,
+ BOOL bAligned,
+ BYTE* pBuffer,
+ LPVOID pContext,
+ DWORD dwUser);
// wait for the next read to complete
HRESULT WaitForNext(
- DWORD dwTimeout,
- LPVOID *ppContext,
- DWORD * pdwUser,
- LONG * pcbActual
- );
+ DWORD dwTimeout,
+ LPVOID *ppContext,
+ DWORD * pdwUser,
+ LONG * pcbActual
+ );
// perform a read of an already aligned buffer
HRESULT SyncReadAligned(
- LONGLONG llPos,
- LONG lLength,
- BYTE* pBuffer,
- LONG* pcbActual,
- PVOID pvContext
- );
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer,
+ LONG* pcbActual,
+ PVOID pvContext
+ );
// perform a synchronous read. will be buffered
// if not aligned.
HRESULT SyncRead(
- LONGLONG llPos,
- LONG lLength,
- BYTE* pBuffer);
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer);
// return length
HRESULT Length(LONGLONG *pllTotal, LONGLONG* pllAvailable);
@@ -255,26 +250,18 @@ public:
return m_pStream->Alignment();
};
- BOOL IsAligned(LONG l)
- {
- if((l & (Alignment() - 1)) == 0)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ BOOL IsAligned(LONG l) {
+ if ((l & (Alignment() -1)) == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
};
- BOOL IsAligned(LONGLONG ll)
- {
- return IsAligned((LONG)(ll & 0xffffffff));
+ BOOL IsAligned(LONGLONG ll) {
+ return IsAligned( (LONG) (ll & 0xffffffff));
};
// Accessor
- HANDLE StopEvent() const
- {
- return m_evDone;
- }
+ HANDLE StopEvent() const { return m_evDone; }
};
diff --git a/src/filters/reader/asyncreader/asyncrdr.cpp b/src/filters/reader/asyncreader/asyncrdr.cpp
index 7f32fdc6e..5e807f8cc 100644
--- a/src/filters/reader/asyncreader/asyncrdr.cpp
+++ b/src/filters/reader/asyncreader/asyncrdr.cpp
@@ -2,7 +2,7 @@
// File: AsyncRdr.cpp
//
// Desc: DirectShow sample code - base library with I/O functionality.
-// This file implements I/O source filter methods and output pin
+// This file implements I/O source filter methods and output pin
// methods for CAsyncReader and CAsyncOutputPin.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
@@ -20,13 +20,13 @@ CAsyncOutputPin::CAsyncOutputPin(
CAsyncReader *pReader,
CAsyncIo *pIo,
CCritSec * pLock)
- : CBasePin(
- NAME("Async output pin"),
- pReader,
- pLock,
- phr,
- L"Output",
- PINDIR_OUTPUT),
+ : CBasePin(
+ NAME("Async output pin"),
+ pReader,
+ pLock,
+ phr,
+ L"Output",
+ PINDIR_OUTPUT),
m_pReader(pReader),
m_pIo(pIo)
{
@@ -39,29 +39,24 @@ CAsyncOutputPin::~CAsyncOutputPin()
STDMETHODIMP
CAsyncOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv,E_POINTER);
- if(riid == IID_IAsyncReader)
- {
+ if (riid == IID_IAsyncReader) {
m_bQueriedForAsyncReader = TRUE;
- return GetInterface((IAsyncReader*) this, ppv);
- }
- else
- {
- return CBasePin::NonDelegatingQueryInterface(riid, ppv);
+ return GetInterface((IAsyncReader*) this, ppv);
+ } else {
+ return CBasePin::NonDelegatingQueryInterface(riid, ppv);
}
}
HRESULT
CAsyncOutputPin::GetMediaType(int iPosition, CMediaType *pMediaType)
{
- if(iPosition < 0)
- {
- return E_INVALIDARG;
+ if (iPosition < 0) {
+ return E_INVALIDARG;
}
- if(iPosition > 0)
- {
- return VFW_S_NO_MORE_ITEMS;
+ if (iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
}
*pMediaType = *m_pReader->LoadType();
@@ -74,11 +69,10 @@ CAsyncOutputPin::CheckMediaType(const CMediaType* pType)
CAutoLock lck(m_pLock);
/* We treat MEDIASUBTYPE_NULL subtype as a wild card */
- if((m_pReader->LoadType()->majortype == pType->majortype) &&
- (m_pReader->LoadType()->subtype == MEDIASUBTYPE_NULL ||
- m_pReader->LoadType()->subtype == pType->subtype))
- {
- return S_OK;
+ if ((m_pReader->LoadType()->majortype == pType->majortype) &&
+ (m_pReader->LoadType()->subtype == MEDIASUBTYPE_NULL ||
+ m_pReader->LoadType()->subtype == pType->subtype)) {
+ return S_OK;
}
return S_FALSE;
}
@@ -91,24 +85,21 @@ CAsyncOutputPin::InitAllocator(IMemAllocator **ppAlloc)
CMemAllocator *pMemObject = NULL;
/* Create a default memory allocator */
- pMemObject = DNew CMemAllocator(NAME("Base memory allocator"), NULL, &hr);
- if(pMemObject == NULL)
- {
- return E_OUTOFMEMORY;
+ pMemObject = DNew CMemAllocator(NAME("Base memory allocator"),NULL, &hr);
+ if (pMemObject == NULL) {
+ return E_OUTOFMEMORY;
}
- if(FAILED(hr))
- {
- delete pMemObject;
- return hr;
+ if (FAILED(hr)) {
+ delete pMemObject;
+ return hr;
}
/* Get a reference counted IID_IMemAllocator interface */
- hr = pMemObject->QueryInterface(IID_IMemAllocator, (void **)ppAlloc);
- if(FAILED(hr))
- {
- delete pMemObject;
- return E_NOINTERFACE;
+ hr = pMemObject->QueryInterface(IID_IMemAllocator,(void **)ppAlloc);
+ if (FAILED(hr)) {
+ delete pMemObject;
+ return E_NOINTERFACE;
}
ASSERT(*ppAlloc != NULL);
@@ -124,21 +115,18 @@ CAsyncOutputPin::RequestAllocator(
IMemAllocator ** ppActual)
{
// we care about alignment but nothing else
- if(!pProps->cbAlign || !m_pIo->IsAligned(pProps->cbAlign))
- {
- m_pIo->Alignment(&pProps->cbAlign);
+ if (!pProps->cbAlign || !m_pIo->IsAligned(pProps->cbAlign)) {
+ m_pIo->Alignment(&pProps->cbAlign);
}
ALLOCATOR_PROPERTIES Actual;
HRESULT hr;
- if(pPreferred)
- {
- hr = pPreferred->SetProperties(pProps, &Actual);
- if(SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign))
- {
+ if (pPreferred) {
+ hr = pPreferred->SetProperties(pProps, &Actual);
+ if (SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign)) {
pPreferred->AddRef();
- *ppActual = pPreferred;
+ *ppActual = pPreferred;
return S_OK;
}
}
@@ -146,15 +134,13 @@ CAsyncOutputPin::RequestAllocator(
// create our own allocator
IMemAllocator* pAlloc;
hr = InitAllocator(&pAlloc);
- if(FAILED(hr))
- {
+ if (FAILED(hr)) {
return hr;
}
//...and see if we can make it suitable
hr = pAlloc->SetProperties(pProps, &Actual);
- if(SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign))
- {
+ if (SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign)) {
// we need to release our refcount on pAlloc, and addref
// it to pass a refcount to the caller - this is a net nothing.
*ppActual = pAlloc;
@@ -166,8 +152,7 @@ CAsyncOutputPin::RequestAllocator(
// if we failed because of the IsAligned test, the error code will
// not be failure
- if(SUCCEEDED(hr))
- {
+ if (SUCCEEDED(hr)) {
hr = VFW_E_BADALIGN;
}
return hr;
@@ -183,29 +168,26 @@ CAsyncOutputPin::Request(
{
REFERENCE_TIME tStart, tStop;
HRESULT hr = pSample->GetTime(&tStart, &tStop);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
LONGLONG llPos = tStart / UNITS;
- LONG lLength = (LONG)((tStop - tStart) / UNITS);
+ LONG lLength = (LONG) ((tStop - tStart) / UNITS);
LONGLONG llTotal;
LONGLONG llAvailable;
hr = m_pIo->Length(&llTotal, &llAvailable);
- if(llPos + lLength > llTotal)
- {
+ if (llPos + lLength > llTotal) {
// the end needs to be aligned, but may have been aligned
// on a coarser alignment.
LONG lAlign;
m_pIo->Alignment(&lAlign);
- llTotal = (llTotal + lAlign - 1) & ~(lAlign - 1);
+ llTotal = (llTotal + lAlign -1) & ~(lAlign-1);
- if(llPos + lLength > llTotal)
- {
- lLength = (LONG)(llTotal - llPos);
+ if (llPos + lLength > llTotal) {
+ lLength = (LONG) (llTotal - llPos);
// must be reducing this!
ASSERT((llTotal * UNITS) <= tStop);
@@ -217,50 +199,46 @@ CAsyncOutputPin::Request(
BYTE* pBuffer;
hr = pSample->GetPointer(&pBuffer);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
return m_pIo->Request(
- llPos,
- lLength,
- TRUE,
- pBuffer,
- (LPVOID)pSample,
- dwUser);
+ llPos,
+ lLength,
+ TRUE,
+ pBuffer,
+ (LPVOID)pSample,
+ dwUser);
}
// sync-aligned request. just like a request/waitfornext pair.
STDMETHODIMP
CAsyncOutputPin::SyncReadAligned(
- IMediaSample* pSample)
+ IMediaSample* pSample)
{
REFERENCE_TIME tStart, tStop;
HRESULT hr = pSample->GetTime(&tStart, &tStop);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
LONGLONG llPos = tStart / UNITS;
- LONG lLength = (LONG)((tStop - tStart) / UNITS);
+ LONG lLength = (LONG) ((tStop - tStart) / UNITS);
LONGLONG llTotal;
LONGLONG llAvailable;
hr = m_pIo->Length(&llTotal, &llAvailable);
- if(llPos + lLength > llTotal)
- {
+ if (llPos + lLength > llTotal) {
// the end needs to be aligned, but may have been aligned
// on a coarser alignment.
LONG lAlign;
m_pIo->Alignment(&lAlign);
- llTotal = (llTotal + lAlign - 1) & ~(lAlign - 1);
+ llTotal = (llTotal + lAlign -1) & ~(lAlign-1);
- if(llPos + lLength > llTotal)
- {
- lLength = (LONG)(llTotal - llPos);
+ if (llPos + lLength > llTotal) {
+ lLength = (LONG) (llTotal - llPos);
// must be reducing this!
ASSERT((llTotal * UNITS) <= tStop);
@@ -272,19 +250,18 @@ CAsyncOutputPin::SyncReadAligned(
BYTE* pBuffer;
hr = pSample->GetPointer(&pBuffer);
- if(FAILED(hr))
- {
- return hr;
+ if (FAILED(hr)) {
+ return hr;
}
LONG cbActual;
hr = m_pIo->SyncReadAligned(
- llPos,
- lLength,
- pBuffer,
- &cbActual,
- pSample
- );
+ llPos,
+ lLength,
+ pBuffer,
+ &cbActual,
+ pSample
+ );
pSample->SetActualDataLength(cbActual);
return hr;
@@ -303,14 +280,13 @@ CAsyncOutputPin::WaitForNext(
IMediaSample* pSample;
HRESULT hr = m_pIo->WaitForNext(
- dwTimeout,
- (LPVOID*) &pSample,
- (DWORD*)pdwUser,
- &cbActual
- );
-
- if(SUCCEEDED(hr))
- {
+ dwTimeout,
+ (LPVOID*) &pSample,
+ (DWORD*)pdwUser,
+ &cbActual
+ );
+
+ if (SUCCEEDED(hr)) {
pSample->SetActualDataLength(cbActual);
}
@@ -374,19 +350,19 @@ CAsyncReader::CAsyncReader(
LPUNKNOWN pUnk,
CAsyncStream *pStream,
HRESULT *phr,
- const CLSID& clsid)
- : CBaseFilter(
+ const CLSID& clsid)
+ : CBaseFilter(
pName,
- pUnk,
- &m_csFilter,
- clsid,
+ pUnk,
+ &m_csFilter,
+ clsid,
NULL
- ),
+ ),
m_OutputPin(
- phr,
- this,
- &m_Io,
- &m_csFilter),
+ phr,
+ this,
+ &m_Io,
+ &m_csFilter),
m_Io(pStream)
{
}
@@ -399,16 +375,16 @@ STDMETHODIMP CAsyncReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return
- (riid == __uuidof(IAMFilterMiscFlags)) ? GetInterface((IAMFilterMiscFlags*)this, ppv) :
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ (riid == __uuidof(IAMFilterMiscFlags)) ? GetInterface((IAMFilterMiscFlags*)this, ppv) :
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IAMFilterMiscFlags
ULONG CAsyncReader::GetMiscFlags()
{
- return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
}
@@ -421,13 +397,10 @@ CAsyncReader::GetPinCount()
CBasePin *
CAsyncReader::GetPin(int n)
{
- if((GetPinCount() > 0) && (n == 0))
- {
- return &m_OutputPin;
- }
- else
- {
- return NULL;
+ if ((GetPinCount() > 0) && (n == 0)) {
+ return &m_OutputPin;
+ } else {
+ return NULL;
}
}
diff --git a/src/filters/reader/asyncreader/asyncrdr.h b/src/filters/reader/asyncreader/asyncrdr.h
index 8cbf917bd..467662d0f 100644
--- a/src/filters/reader/asyncreader/asyncrdr.h
+++ b/src/filters/reader/asyncreader/asyncrdr.h
@@ -19,8 +19,8 @@ class CAsyncReader;
// the output pin class
class CAsyncOutputPin
- : public IAsyncReader,
- public CBasePin
+ : public IAsyncReader,
+ public CBasePin
{
protected:
CAsyncReader* m_pReader;
@@ -39,8 +39,8 @@ public:
// constructor and destructor
CAsyncOutputPin(
HRESULT * phr,
- CAsyncReader *pReader,
- CAsyncIo *pIo,
+ CAsyncReader *pReader,
+ CAsyncIo *pIo,
CCritSec * pLock);
~CAsyncOutputPin();
@@ -76,12 +76,9 @@ public:
// See if it was asked for
HRESULT CompleteConnect(IPin *pReceivePin)
{
- if(m_bQueriedForAsyncReader)
- {
+ if (m_bQueriedForAsyncReader) {
return CBasePin::CompleteConnect(pReceivePin);
- }
- else
- {
+ } else {
#ifdef VFW_E_NO_TRANSPORT
return VFW_E_NO_TRANSPORT;
#else
@@ -104,9 +101,9 @@ public:
// this allocator will be not be committed and decommitted by
// the async reader, only by the consumer.
STDMETHODIMP RequestAllocator(
- IMemAllocator* pPreferred,
- ALLOCATOR_PROPERTIES* pProps,
- IMemAllocator ** ppActual);
+ IMemAllocator* pPreferred,
+ ALLOCATOR_PROPERTIES* pProps,
+ IMemAllocator ** ppActual);
// queue a request for data.
// media sample start and stop times contain the requested absolute
@@ -116,8 +113,8 @@ public:
// samples allocated from source pin's allocator may fail
// GetPointer until after returning from WaitForNext.
STDMETHODIMP Request(
- IMediaSample* pSample,
- DWORD_PTR dwUser); // user context
+ IMediaSample* pSample,
+ DWORD_PTR dwUser); // user context
// block until the next sample is completed or the timeout occurs.
// timeout (millisecs) may be 0 or INFINITE. Samples may not
@@ -125,32 +122,32 @@ public:
// notification will already have been sent by the source filter,
// and STDMETHODIMP will be an error.
STDMETHODIMP WaitForNext(
- DWORD dwTimeout,
- IMediaSample** ppSample, // completed sample
- DWORD_PTR* pdwUser); // user context
+ DWORD dwTimeout,
+ IMediaSample** ppSample, // completed sample
+ DWORD_PTR* pdwUser); // user context
// sync read of data. Sample passed in must have been acquired from
// the agreed allocator. Start and stop position must be aligned.
// equivalent to a Request/WaitForNext pair, but may avoid the
// need for a thread on the source filter.
STDMETHODIMP SyncReadAligned(
- IMediaSample* pSample);
+ IMediaSample* pSample);
// sync read. works in stopped state as well as run state.
// need not be aligned. Will fail if read is beyond actual total
// length.
STDMETHODIMP SyncRead(
- LONGLONG llPosition, // absolute file position
- LONG lLength, // nr bytes required
- BYTE* pBuffer); // write data here
+ LONGLONG llPosition, // absolute file position
+ LONG lLength, // nr bytes required
+ BYTE* pBuffer); // write data here
// return total length of stream, and currently available length.
// reads for beyond the available length but within the total length will
// normally succeed but may block for a long period.
STDMETHODIMP Length(
- LONGLONG* pTotal,
- LONGLONG* pAvailable);
+ LONGLONG* pTotal,
+ LONGLONG* pAvailable);
// cause all outstanding reads to return, possibly with a failure code
// (VFW_E_TIMEOUT) indicating they were cancelled.
@@ -182,7 +179,7 @@ protected:
CMediaType m_mt;
public:
-
+
// construction / destruction
CAsyncReader(
@@ -190,14 +187,14 @@ public:
LPUNKNOWN pUnk,
CAsyncStream *pStream,
HRESULT *phr,
- const CLSID& clsid);
+ const CLSID& clsid);
~CAsyncReader();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags();
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
// --- CBaseFilter methods ---
int GetPinCount();
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp
index b128b43bf..df623f2b2 100644
--- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -67,7 +67,7 @@ DEFINE_GUIDSTRUCT("0000000b-0cea-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_I
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&GUID_NULL},
+ {&GUID_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -77,25 +77,25 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMpcAudioRenderer), L"MPC - Audio Renderer", 0x40000001, countof(sudpPins), sudpPins, CLSID_AudioRendererCategory},
+ {&__uuidof(CMpcAudioRenderer), L"MPC - Audio Renderer", 0x40000001, countof(sudpPins), sudpPins,CLSID_AudioRendererCategory},
};
CFactoryTemplate g_Templates[] =
{
{sudFilter[0].strName, &__uuidof(CMpcAudioRenderer), CreateInstance<CMpcAudioRenderer>, NULL, &sudFilter[0]},
- //{L"CMpcAudioRendererPropertyPage", &__uuidof(CMpcAudioRendererSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpcAudioRendererSettingsWnd> >},
+ //{L"CMpcAudioRendererPropertyPage", &__uuidof(CMpcAudioRendererSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpcAudioRendererSettingsWnd> >},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -105,366 +105,366 @@ CFilterApp theApp;
#endif
CMpcAudioRenderer::CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr)
- : CBaseRenderer(__uuidof(this), NAME("MPC - Audio Renderer"), punk, phr)
- , m_pDSBuffer(NULL)
- , m_pSoundTouch(NULL)
- , m_pDS(NULL)
- , m_dwDSWriteOff(0)
- , m_nDSBufSize(0)
- , m_dRate(1.0)
- , m_pReferenceClock(NULL)
- , m_pWaveFileFormat(NULL)
- , pMMDevice(NULL)
- , pAudioClient(NULL)
- , pRenderClient(NULL)
- , useWASAPI(true)
- , nFramesInBuffer(0)
- , hnsPeriod(0)
- , hTask(NULL)
- , bufferSize(0)
- , isAudioClientStarted(false)
- , lastBufferTime(0)
- , hnsActualDuration(0)
+: CBaseRenderer(__uuidof(this), NAME("MPC - Audio Renderer"), punk, phr)
+, m_pDSBuffer (NULL )
+, m_pSoundTouch (NULL )
+, m_pDS (NULL )
+, m_dwDSWriteOff (0 )
+, m_nDSBufSize (0 )
+, m_dRate (1.0 )
+, m_pReferenceClock (NULL )
+, m_pWaveFileFormat (NULL )
+, pMMDevice (NULL)
+, pAudioClient (NULL )
+, pRenderClient (NULL )
+, useWASAPI (true )
+, nFramesInBuffer (0 )
+, hnsPeriod (0 )
+, hTask (NULL )
+, bufferSize (0)
+, isAudioClientStarted (false)
+, lastBufferTime (0)
+, hnsActualDuration (0)
{
- HMODULE hLib;
-
- // Load Vista specifics DLLs
- hLib = LoadLibrary(L"AVRT.dll");
- if(hLib != NULL)
- {
- pfAvSetMmThreadCharacteristicsW = (PTR_AvSetMmThreadCharacteristicsW) GetProcAddress(hLib, "AvSetMmThreadCharacteristicsW");
- pfAvRevertMmThreadCharacteristics = (PTR_AvRevertMmThreadCharacteristics) GetProcAddress(hLib, "AvRevertMmThreadCharacteristics");
- }
- else
- useWASAPI = false; // Wasapi not available below Vista
-
- TRACE(_T("CMpcAudioRenderer constructor"));
- if(!useWASAPI)
- {
- m_pSoundTouch = new soundtouch::SoundTouch();
- *phr = DirectSoundCreate8(NULL, &m_pDS, NULL);
- }
+ HMODULE hLib;
+
+ // Load Vista specifics DLLs
+ hLib = LoadLibrary (L"AVRT.dll");
+ if (hLib != NULL)
+ {
+ pfAvSetMmThreadCharacteristicsW = (PTR_AvSetMmThreadCharacteristicsW) GetProcAddress (hLib, "AvSetMmThreadCharacteristicsW");
+ pfAvRevertMmThreadCharacteristics = (PTR_AvRevertMmThreadCharacteristics) GetProcAddress (hLib, "AvRevertMmThreadCharacteristics");
+ }
+ else
+ useWASAPI = false; // Wasapi not available below Vista
+
+ TRACE(_T("CMpcAudioRenderer constructor"));
+ if (!useWASAPI)
+ {
+ m_pSoundTouch = new soundtouch::SoundTouch();
+ *phr = DirectSoundCreate8 (NULL, &m_pDS, NULL);
+ }
}
CMpcAudioRenderer::~CMpcAudioRenderer()
{
- Stop();
-
- SAFE_DELETE(m_pSoundTouch);
- SAFE_RELEASE(m_pDSBuffer);
- SAFE_RELEASE(m_pDS);
-
- SAFE_RELEASE(pRenderClient);
- SAFE_RELEASE(pAudioClient);
- SAFE_RELEASE(pMMDevice);
-
- if(m_pReferenceClock)
- {
- SetSyncSource(NULL);
- SAFE_RELEASE(m_pReferenceClock);
- }
-
- if(m_pWaveFileFormat)
- {
- BYTE *p = (BYTE *)m_pWaveFileFormat;
- SAFE_DELETE_ARRAY(p);
- }
-
- if(hTask != NULL && pfAvRevertMmThreadCharacteristics != NULL)
- {
- pfAvRevertMmThreadCharacteristics(hTask);
- }
+ Stop();
+
+ SAFE_DELETE (m_pSoundTouch);
+ SAFE_RELEASE (m_pDSBuffer);
+ SAFE_RELEASE (m_pDS);
+
+ SAFE_RELEASE (pRenderClient);
+ SAFE_RELEASE (pAudioClient);
+ SAFE_RELEASE (pMMDevice);
+
+ if (m_pReferenceClock)
+ {
+ SetSyncSource(NULL);
+ SAFE_RELEASE (m_pReferenceClock);
+ }
+
+ if (m_pWaveFileFormat)
+ {
+ BYTE *p = (BYTE *)m_pWaveFileFormat;
+ SAFE_DELETE_ARRAY(p);
+ }
+
+ if (hTask != NULL && pfAvRevertMmThreadCharacteristics != NULL)
+ {
+ pfAvRevertMmThreadCharacteristics(hTask);
+ }
}
HRESULT CMpcAudioRenderer::CheckInputType(const CMediaType *pmt)
{
- return CheckMediaType(pmt);
+ return CheckMediaType(pmt);
}
HRESULT CMpcAudioRenderer::CheckMediaType(const CMediaType *pmt)
{
- HRESULT hr = S_OK;
- if(pmt == NULL) return E_INVALIDARG;
- TRACE(_T("CMpcAudioRenderer::CheckMediaType"));
- WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmt->Format();
-
- if(pwfx == NULL) return VFW_E_TYPE_NOT_ACCEPTED;
-
- if((pmt->majortype != MEDIATYPE_Audio) ||
- (pmt->formattype != FORMAT_WaveFormatEx))
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType Not supported"));
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- if(useWASAPI)
- {
- hr = CheckAudioClient((WAVEFORMATEX *)NULL);
- if(FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType Error on check audio client"));
- return hr;
- }
- if(!pAudioClient)
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType Error, audio client not loaded"));
- return VFW_E_CANNOT_CONNECT;
- }
-
- if(pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL) != S_OK)
- {
- TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client refused the format"));
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client accepted the format"));
- }
- else if(pwfx->wFormatTag != WAVE_FORMAT_PCM)
- {
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- return S_OK;
+ HRESULT hr = S_OK;
+ if (pmt == NULL) return E_INVALIDARG;
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType"));
+ WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pmt->Format();
+
+ if (pwfx == NULL) return VFW_E_TYPE_NOT_ACCEPTED;
+
+if ((pmt->majortype != MEDIATYPE_Audio ) ||
+ (pmt->formattype != FORMAT_WaveFormatEx ))
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType Not supported"));
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ if(useWASAPI)
+ {
+ hr=CheckAudioClient((WAVEFORMATEX *)NULL);
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType Error on check audio client"));
+ return hr;
+ }
+ if (!pAudioClient)
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType Error, audio client not loaded"));
+ return VFW_E_CANNOT_CONNECT;
+ }
+
+ if (pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL) != S_OK)
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client refused the format"));
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ TRACE(_T("CMpcAudioRenderer::CheckMediaType WASAPI client accepted the format"));
+ }
+ else if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
+ {
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ return S_OK;
}
void CMpcAudioRenderer::OnReceiveFirstSample(IMediaSample *pMediaSample)
{
- if(!useWASAPI)
- ClearBuffer();
+ if (!useWASAPI)
+ ClearBuffer();
}
BOOL CMpcAudioRenderer::ScheduleSample(IMediaSample *pMediaSample)
{
- REFERENCE_TIME StartSample;
- REFERENCE_TIME EndSample;
-
-// Is someone pulling our leg
- if(pMediaSample == NULL) return FALSE;
-
-// Get the next sample due up for rendering. If there aren't any ready
-// then GetNextSampleTimes returns an error. If there is one to be done
-// then it succeeds and yields the sample times. If it is due now then
-// it returns S_OK other if it's to be done when due it returns S_FALSE
- HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample);
- if(FAILED(hr)) return FALSE;
-
-// If we don't have a reference clock then we cannot set up the advise
-// time so we simply set the event indicating an image to render. This
-// will cause us to run flat out without any timing or synchronisation
- if(hr == S_OK)
- {
- EXECUTE_ASSERT(SetEvent((HANDLE) m_RenderEvent));
- return TRUE;
- }
-
- if(m_dRate <= 1.1)
- {
- ASSERT(m_dwAdvise == 0);
- ASSERT(m_pClock);
- WaitForSingleObject((HANDLE)m_RenderEvent, 0);
-
- hr = m_pClock->AdviseTime((REFERENCE_TIME) m_tStart, StartSample, (HEVENT)(HANDLE) m_RenderEvent, &m_dwAdvise);
- if(SUCCEEDED(hr)) return TRUE;
- }
- else
- hr = DoRenderSample(pMediaSample);
-
-// We could not schedule the next sample for rendering despite the fact
-// we have a valid sample here. This is a fair indication that either
-// the system clock is wrong or the time stamp for the sample is duff
- ASSERT(m_dwAdvise == 0);
-
- return FALSE;
+ REFERENCE_TIME StartSample;
+ REFERENCE_TIME EndSample;
+
+ // Is someone pulling our leg
+ if (pMediaSample == NULL) return FALSE;
+
+ // Get the next sample due up for rendering. If there aren't any ready
+ // then GetNextSampleTimes returns an error. If there is one to be done
+ // then it succeeds and yields the sample times. If it is due now then
+ // it returns S_OK other if it's to be done when due it returns S_FALSE
+ HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample);
+ if (FAILED(hr)) return FALSE;
+
+ // If we don't have a reference clock then we cannot set up the advise
+ // time so we simply set the event indicating an image to render. This
+ // will cause us to run flat out without any timing or synchronisation
+ if (hr == S_OK)
+ {
+ EXECUTE_ASSERT(SetEvent((HANDLE) m_RenderEvent));
+ return TRUE;
+ }
+
+ if (m_dRate <= 1.1)
+ {
+ ASSERT(m_dwAdvise == 0);
+ ASSERT(m_pClock);
+ WaitForSingleObject((HANDLE)m_RenderEvent,0);
+
+ hr = m_pClock->AdviseTime( (REFERENCE_TIME) m_tStart, StartSample, (HEVENT)(HANDLE) m_RenderEvent, &m_dwAdvise);
+ if (SUCCEEDED(hr)) return TRUE;
+ }
+ else
+ hr = DoRenderSample (pMediaSample);
+
+ // We could not schedule the next sample for rendering despite the fact
+ // we have a valid sample here. This is a fair indication that either
+ // the system clock is wrong or the time stamp for the sample is duff
+ ASSERT(m_dwAdvise == 0);
+
+ return FALSE;
}
HRESULT CMpcAudioRenderer::DoRenderSample(IMediaSample *pMediaSample)
{
- if(useWASAPI)
- return DoRenderSampleWasapi(pMediaSample);
- else
- return DoRenderSampleDirectSound(pMediaSample);
+ if (useWASAPI)
+ return DoRenderSampleWasapi(pMediaSample);
+ else
+ return DoRenderSampleDirectSound(pMediaSample);
}
STDMETHODIMP CMpcAudioRenderer::NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
- if(riid == IID_IReferenceClock)
- {
- return GetReferenceClockInterface(riid, ppv);
- }
+ if (riid == IID_IReferenceClock)
+ {
+ return GetReferenceClockInterface(riid, ppv);
+ }
- return CBaseRenderer::NonDelegatingQueryInterface(riid, ppv);
+ return CBaseRenderer::NonDelegatingQueryInterface (riid, ppv);
}
HRESULT CMpcAudioRenderer::SetMediaType(const CMediaType *pmt)
{
- if(! pmt) return E_POINTER;
- HRESULT hr = S_OK;
- int size = 0;
- TRACE(_T("CMpcAudioRenderer::SetMediaType"));
-
- if(useWASAPI)
- {
- // New media type set but render client already initialized => reset it
- if(pRenderClient != NULL)
- {
- WAVEFORMATEX *pNewWf = (WAVEFORMATEX *) pmt->Format();
- TRACE(_T("CMpcAudioRenderer::SetMediaType Render client already initialized. Reinitialization..."));
- CheckAudioClient(pNewWf);
- }
- }
-
- if(m_pWaveFileFormat)
- {
- BYTE *p = (BYTE *)m_pWaveFileFormat;
- SAFE_DELETE_ARRAY(p);
- }
- m_pWaveFileFormat = NULL;
-
- WAVEFORMATEX *pwf = (WAVEFORMATEX *) pmt->Format();
- if(pwf != NULL)
- {
- size = sizeof(WAVEFORMATEX) + pwf->cbSize;
-
- m_pWaveFileFormat = (WAVEFORMATEX *)new BYTE[size];
- if(! m_pWaveFileFormat)
- return E_OUTOFMEMORY;
-
- memcpy(m_pWaveFileFormat, pwf, size);
-
-
- if(!useWASAPI && m_pSoundTouch && (pwf->nChannels <= 2))
- {
- m_pSoundTouch->setSampleRate(pwf->nSamplesPerSec);
- m_pSoundTouch->setChannels(pwf->nChannels);
- m_pSoundTouch->setTempoChange(0);
- m_pSoundTouch->setPitchSemiTones(0);
- }
- }
-
- return CBaseRenderer::SetMediaType(pmt);
+ if (! pmt) return E_POINTER;
+ HRESULT hr = S_OK;
+ int size = 0;
+ TRACE(_T("CMpcAudioRenderer::SetMediaType"));
+
+ if (useWASAPI)
+ {
+ // New media type set but render client already initialized => reset it
+ if (pRenderClient!=NULL)
+ {
+ WAVEFORMATEX *pNewWf = (WAVEFORMATEX *) pmt->Format();
+ TRACE(_T("CMpcAudioRenderer::SetMediaType Render client already initialized. Reinitialization..."));
+ CheckAudioClient(pNewWf);
+ }
+ }
+
+ if (m_pWaveFileFormat)
+ {
+ BYTE *p = (BYTE *)m_pWaveFileFormat;
+ SAFE_DELETE_ARRAY(p);
+ }
+ m_pWaveFileFormat=NULL;
+
+ WAVEFORMATEX *pwf = (WAVEFORMATEX *) pmt->Format();
+ if (pwf!=NULL)
+ {
+ size = sizeof(WAVEFORMATEX) + pwf->cbSize;
+
+ m_pWaveFileFormat = (WAVEFORMATEX *)new BYTE[size];
+ if (! m_pWaveFileFormat)
+ return E_OUTOFMEMORY;
+
+ memcpy(m_pWaveFileFormat, pwf, size);
+
+
+ if (!useWASAPI && m_pSoundTouch && (pwf->nChannels <= 2))
+ {
+ m_pSoundTouch->setSampleRate (pwf->nSamplesPerSec);
+ m_pSoundTouch->setChannels (pwf->nChannels);
+ m_pSoundTouch->setTempoChange (0);
+ m_pSoundTouch->setPitchSemiTones(0);
+ }
+ }
+
+ return CBaseRenderer::SetMediaType (pmt);
}
HRESULT CMpcAudioRenderer::CompleteConnect(IPin *pReceivePin)
{
- HRESULT hr = S_OK;
- TRACE(_T("CMpcAudioRenderer::CompleteConnect"));
+ HRESULT hr = S_OK;
+ TRACE(_T("CMpcAudioRenderer::CompleteConnect"));
- if(!useWASAPI && ! m_pDS) return E_FAIL;
+ if (!useWASAPI && ! m_pDS) return E_FAIL;
- if(SUCCEEDED(hr)) hr = CBaseRenderer::CompleteConnect(pReceivePin);
- if(SUCCEEDED(hr)) hr = InitCoopLevel();
+ if (SUCCEEDED(hr)) hr = CBaseRenderer::CompleteConnect(pReceivePin);
+ if (SUCCEEDED(hr)) hr = InitCoopLevel();
- if(!useWASAPI)
- {
- if(SUCCEEDED(hr)) hr = CreateDSBuffer();
- }
- if(SUCCEEDED(hr)) TRACE(_T("CMpcAudioRenderer::CompleteConnect Success"));
- return hr;
+ if (!useWASAPI)
+ {
+ if (SUCCEEDED(hr)) hr = CreateDSBuffer();
+ }
+ if (SUCCEEDED(hr)) TRACE(_T("CMpcAudioRenderer::CompleteConnect Success"));
+ return hr;
}
STDMETHODIMP CMpcAudioRenderer::Run(REFERENCE_TIME tStart)
{
- HRESULT hr;
-
- if(m_State == State_Running) return NOERROR;
-
- if(useWASAPI)
- {
- hr = CheckAudioClient(m_pWaveFileFormat);
- if(FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::Run Error on check audio client"));
- return hr;
- }
- // Rather start the client at the last moment when the buffer is fed
- /*hr = pAudioClient->Start();
- if (FAILED (hr))
- {
- TRACE(_T("CMpcAudioRenderer::Run Start error"));
- return hr;
- }*/
- }
- else
- {
- if(m_pDSBuffer &&
- m_pPosition &&
- m_pWaveFileFormat &&
- SUCCEEDED(m_pPosition->GetRate(&m_dRate)))
- {
- if(m_dRate < 1.0)
- {
- hr = m_pDSBuffer->SetFrequency((long)(m_pWaveFileFormat->nSamplesPerSec * m_dRate));
- if(FAILED(hr)) return hr;
- }
- else
- {
- hr = m_pDSBuffer->SetFrequency((long)m_pWaveFileFormat->nSamplesPerSec);
- m_pSoundTouch->setRateChange((float)(m_dRate - 1.0) * 100);
- }
- }
-
- ClearBuffer();
- }
- hr = CBaseRenderer::Run(tStart);
-
- return hr;
+ HRESULT hr;
+
+ if (m_State == State_Running) return NOERROR;
+
+ if (useWASAPI)
+ {
+ hr=CheckAudioClient(m_pWaveFileFormat);
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::Run Error on check audio client"));
+ return hr;
+ }
+ // Rather start the client at the last moment when the buffer is fed
+ /*hr = pAudioClient->Start();
+ if (FAILED (hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::Run Start error"));
+ return hr;
+ }*/
+ }
+ else
+ {
+ if (m_pDSBuffer &&
+ m_pPosition &&
+ m_pWaveFileFormat &&
+ SUCCEEDED(m_pPosition->GetRate(&m_dRate)))
+ {
+ if (m_dRate < 1.0)
+ {
+ hr = m_pDSBuffer->SetFrequency ((long)(m_pWaveFileFormat->nSamplesPerSec * m_dRate));
+ if (FAILED (hr)) return hr;
+ }
+ else
+ {
+ hr = m_pDSBuffer->SetFrequency ((long)m_pWaveFileFormat->nSamplesPerSec);
+ m_pSoundTouch->setRateChange((float)(m_dRate-1.0)*100);
+ }
+ }
+
+ ClearBuffer();
+ }
+ hr = CBaseRenderer::Run(tStart);
+
+ return hr;
}
-STDMETHODIMP CMpcAudioRenderer::Stop()
+STDMETHODIMP CMpcAudioRenderer::Stop()
{
- if(m_pDSBuffer) m_pDSBuffer->Stop();
- isAudioClientStarted = false;
+ if (m_pDSBuffer) m_pDSBuffer->Stop();
+ isAudioClientStarted=false;
- return CBaseRenderer::Stop();
+ return CBaseRenderer::Stop();
};
STDMETHODIMP CMpcAudioRenderer::Pause()
{
- if(m_pDSBuffer) m_pDSBuffer->Stop();
- if(pAudioClient && isAudioClientStarted) pAudioClient->Stop();
- isAudioClientStarted = false;
+ if (m_pDSBuffer) m_pDSBuffer->Stop();
+ if (pAudioClient && isAudioClientStarted) pAudioClient->Stop();
+ isAudioClientStarted=false;
- return CBaseRenderer::Pause();
+ return CBaseRenderer::Pause();
};
HRESULT CMpcAudioRenderer::GetReferenceClockInterface(REFIID riid, void **ppv)
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- if(m_pReferenceClock)
- return m_pReferenceClock->NonDelegatingQueryInterface(riid, ppv);
+ if (m_pReferenceClock)
+ return m_pReferenceClock->NonDelegatingQueryInterface(riid, ppv);
- m_pReferenceClock = new CBaseReferenceClock(NAME("Mpc Audio Clock"), NULL, &hr);
- if(! m_pReferenceClock)
- return E_OUTOFMEMORY;
+ m_pReferenceClock = new CBaseReferenceClock (NAME("Mpc Audio Clock"), NULL, &hr);
+ if (! m_pReferenceClock)
+ return E_OUTOFMEMORY;
- m_pReferenceClock->AddRef();
+ m_pReferenceClock->AddRef();
- hr = SetSyncSource(m_pReferenceClock);
- if(FAILED(hr))
- {
- SetSyncSource(NULL);
- return hr;
- }
+ hr = SetSyncSource(m_pReferenceClock);
+ if (FAILED(hr))
+ {
+ SetSyncSource(NULL);
+ return hr;
+ }
- return GetReferenceClockInterface(riid, ppv);
+ return GetReferenceClockInterface(riid, ppv);
}
HRESULT CMpcAudioRenderer::EndOfStream(void)
{
- if(m_pDSBuffer) m_pDSBuffer->Stop();
+ if (m_pDSBuffer) m_pDSBuffer->Stop();
#if !FILEWRITER
- if(pAudioClient && isAudioClientStarted) pAudioClient->Stop();
+ if (pAudioClient && isAudioClientStarted) pAudioClient->Stop();
#endif
- isAudioClientStarted = false;
+ isAudioClientStarted=false;
- return CBaseRenderer::EndOfStream();
+ return CBaseRenderer::EndOfStream();
}
@@ -473,232 +473,232 @@ HRESULT CMpcAudioRenderer::EndOfStream(void)
HRESULT CMpcAudioRenderer::CreateDSBuffer()
{
- if(! m_pWaveFileFormat) return E_POINTER;
-
- HRESULT hr = S_OK;
- LPDIRECTSOUNDBUFFER pDSBPrimary = NULL;
- DSBUFFERDESC dsbd;
- DSBUFFERDESC cDSBufferDesc;
- DSBCAPS bufferCaps;
- DWORD dwDSBufSize = m_pWaveFileFormat->nAvgBytesPerSec * 4;
-
- ZeroMemory(&bufferCaps, sizeof(bufferCaps));
- ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
-
- dsbd.dwSize = sizeof(DSBUFFERDESC);
- dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
- dsbd.dwBufferBytes = 0;
- dsbd.lpwfxFormat = NULL;
- if(SUCCEEDED(hr = m_pDS->CreateSoundBuffer(&dsbd, &pDSBPrimary, NULL)))
- {
- hr = pDSBPrimary->SetFormat(m_pWaveFileFormat);
- ATLASSERT(SUCCEEDED(hr));
- SAFE_RELEASE(pDSBPrimary);
- }
-
-
- SAFE_RELEASE(m_pDSBuffer);
- cDSBufferDesc.dwSize = sizeof(DSBUFFERDESC);
- cDSBufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS |
- DSBCAPS_GETCURRENTPOSITION2 |
- DSBCAPS_CTRLVOLUME |
- DSBCAPS_CTRLPAN |
- DSBCAPS_CTRLFREQUENCY;
- cDSBufferDesc.dwBufferBytes = dwDSBufSize;
- cDSBufferDesc.dwReserved = 0;
- cDSBufferDesc.lpwfxFormat = m_pWaveFileFormat;
- cDSBufferDesc.guid3DAlgorithm = GUID_NULL;
-
- hr = m_pDS->CreateSoundBuffer(&cDSBufferDesc, &m_pDSBuffer, NULL);
-
- m_nDSBufSize = 0;
- if(SUCCEEDED(hr))
- {
- bufferCaps.dwSize = sizeof(bufferCaps);
- hr = m_pDSBuffer->GetCaps(&bufferCaps);
- }
- if(SUCCEEDED(hr))
- {
- m_nDSBufSize = bufferCaps.dwBufferBytes;
- hr = ClearBuffer();
- m_pDSBuffer->SetFrequency((long)(m_pWaveFileFormat->nSamplesPerSec * m_dRate));
- }
-
- return hr;
+ if (! m_pWaveFileFormat) return E_POINTER;
+
+ HRESULT hr = S_OK;
+ LPDIRECTSOUNDBUFFER pDSBPrimary = NULL;
+ DSBUFFERDESC dsbd;
+ DSBUFFERDESC cDSBufferDesc;
+ DSBCAPS bufferCaps;
+ DWORD dwDSBufSize = m_pWaveFileFormat->nAvgBytesPerSec * 4;
+
+ ZeroMemory(&bufferCaps, sizeof(bufferCaps));
+ ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
+
+ dsbd.dwSize = sizeof(DSBUFFERDESC);
+ dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
+ dsbd.dwBufferBytes = 0;
+ dsbd.lpwfxFormat = NULL;
+ if (SUCCEEDED (hr = m_pDS->CreateSoundBuffer( &dsbd, &pDSBPrimary, NULL )))
+ {
+ hr = pDSBPrimary->SetFormat(m_pWaveFileFormat);
+ ATLASSERT(SUCCEEDED(hr));
+ SAFE_RELEASE (pDSBPrimary);
+ }
+
+
+ SAFE_RELEASE (m_pDSBuffer);
+ cDSBufferDesc.dwSize = sizeof (DSBUFFERDESC);
+ cDSBufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS |
+ DSBCAPS_GETCURRENTPOSITION2 |
+ DSBCAPS_CTRLVOLUME |
+ DSBCAPS_CTRLPAN |
+ DSBCAPS_CTRLFREQUENCY;
+ cDSBufferDesc.dwBufferBytes = dwDSBufSize;
+ cDSBufferDesc.dwReserved = 0;
+ cDSBufferDesc.lpwfxFormat = m_pWaveFileFormat;
+ cDSBufferDesc.guid3DAlgorithm = GUID_NULL;
+
+ hr = m_pDS->CreateSoundBuffer (&cDSBufferDesc, &m_pDSBuffer, NULL);
+
+ m_nDSBufSize = 0;
+ if (SUCCEEDED(hr))
+ {
+ bufferCaps.dwSize = sizeof(bufferCaps);
+ hr = m_pDSBuffer->GetCaps(&bufferCaps);
+ }
+ if (SUCCEEDED (hr))
+ {
+ m_nDSBufSize = bufferCaps.dwBufferBytes;
+ hr = ClearBuffer();
+ m_pDSBuffer->SetFrequency ((long)(m_pWaveFileFormat->nSamplesPerSec * m_dRate));
+ }
+
+ return hr;
}
HRESULT CMpcAudioRenderer::ClearBuffer()
{
- HRESULT hr = S_FALSE;
- VOID* pDSLockedBuffer = NULL;
- DWORD dwDSLockedSize = 0;
-
- if(m_pDSBuffer)
- {
- m_dwDSWriteOff = 0;
- m_pDSBuffer->SetCurrentPosition(0);
-
- hr = m_pDSBuffer->Lock(0, 0, &pDSLockedBuffer, &dwDSLockedSize, NULL, NULL, DSBLOCK_ENTIREBUFFER);
- if(SUCCEEDED(hr))
- {
- memset(pDSLockedBuffer, 0, dwDSLockedSize);
- hr = m_pDSBuffer->Unlock(pDSLockedBuffer, dwDSLockedSize, NULL, NULL);
- }
- }
-
- return hr;
+ HRESULT hr = S_FALSE;
+ VOID* pDSLockedBuffer = NULL;
+ DWORD dwDSLockedSize = 0;
+
+ if (m_pDSBuffer)
+ {
+ m_dwDSWriteOff = 0;
+ m_pDSBuffer->SetCurrentPosition(0);
+
+ hr = m_pDSBuffer->Lock (0, 0, &pDSLockedBuffer, &dwDSLockedSize, NULL, NULL, DSBLOCK_ENTIREBUFFER);
+ if (SUCCEEDED (hr))
+ {
+ memset (pDSLockedBuffer, 0, dwDSLockedSize);
+ hr = m_pDSBuffer->Unlock (pDSLockedBuffer, dwDSLockedSize, NULL, NULL);
+ }
+ }
+
+ return hr;
}
HRESULT CMpcAudioRenderer::InitCoopLevel()
{
- HRESULT hr = S_OK;
- IVideoWindow* pVideoWindow = NULL;
- HWND hWnd = NULL;
- CComBSTR bstrCaption;
-
- hr = m_pGraph->QueryInterface(__uuidof(IVideoWindow), (void**) &pVideoWindow);
- if(SUCCEEDED(hr))
- {
- pVideoWindow->get_Owner((OAHWND*)&hWnd);
- SAFE_RELEASE(pVideoWindow);
- }
- if(!hWnd)
- {
- hWnd = GetTopWindow(NULL);
- }
-
- ATLASSERT(hWnd != NULL);
- if(!useWASAPI)
- hr = m_pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
- else if(hTask == NULL)
- {
- // Ask MMCSS to temporarily boost the thread priority
- // to reduce glitches while the low-latency stream plays.
- DWORD taskIndex = 0;
-
- if(pfAvSetMmThreadCharacteristicsW)
- {
- hTask = pfAvSetMmThreadCharacteristicsW(TEXT("Pro Audio"), &taskIndex);
- TRACE(_T("CMpcAudioRenderer::InitCoopLevel Putting thread in higher priority for Wasapi mode (lowest latency)"));
- hr = GetLastError();
- if(hTask == NULL)
- return hr;
- }
- }
-
- return hr;
+ HRESULT hr = S_OK;
+ IVideoWindow* pVideoWindow = NULL;
+ HWND hWnd = NULL;
+ CComBSTR bstrCaption;
+
+ hr = m_pGraph->QueryInterface (__uuidof(IVideoWindow), (void**) &pVideoWindow);
+ if (SUCCEEDED (hr))
+ {
+ pVideoWindow->get_Owner((OAHWND*)&hWnd);
+ SAFE_RELEASE (pVideoWindow);
+ }
+ if (!hWnd)
+ {
+ hWnd = GetTopWindow(NULL);
+ }
+
+ ATLASSERT(hWnd != NULL);
+ if (!useWASAPI)
+ hr = m_pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
+ else if (hTask == NULL)
+ {
+ // Ask MMCSS to temporarily boost the thread priority
+ // to reduce glitches while the low-latency stream plays.
+ DWORD taskIndex = 0;
+
+ if (pfAvSetMmThreadCharacteristicsW)
+ {
+ hTask = pfAvSetMmThreadCharacteristicsW(TEXT("Pro Audio"), &taskIndex);
+ TRACE(_T("CMpcAudioRenderer::InitCoopLevel Putting thread in higher priority for Wasapi mode (lowest latency)"));
+ hr=GetLastError();
+ if (hTask == NULL)
+ return hr;
+ }
+ }
+
+ return hr;
}
HRESULT CMpcAudioRenderer::DoRenderSampleDirectSound(IMediaSample *pMediaSample)
{
- HRESULT hr = S_OK;
- DWORD dwStatus = 0;
- const long lSize = pMediaSample->GetActualDataLength();
- DWORD dwPlayCursor = 0;
- DWORD dwWriteCursor = 0;
-
- hr = m_pDSBuffer->GetStatus(&dwStatus);
-
- if(SUCCEEDED(hr) && (dwStatus & DSBSTATUS_BUFFERLOST))
- hr = m_pDSBuffer->Restore();
-
- if((SUCCEEDED(hr)) && ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING))
- {
- hr = m_pDSBuffer->Play(0, 0, DSBPLAY_LOOPING);
- ATLASSERT(SUCCEEDED(hr));
- }
-
- if(SUCCEEDED(hr)) hr = m_pDSBuffer->GetCurrentPosition(&dwPlayCursor, &dwWriteCursor);
-
- if(SUCCEEDED(hr))
- {
- if(((dwPlayCursor < dwWriteCursor) &&
- (
- ((m_dwDSWriteOff >= dwPlayCursor) && (m_dwDSWriteOff <= dwWriteCursor))
- ||
- ((m_dwDSWriteOff < dwPlayCursor) && (m_dwDSWriteOff + lSize >= dwPlayCursor))
- )
- )
- ||
- ((dwWriteCursor < dwPlayCursor) &&
- (
- (m_dwDSWriteOff >= dwPlayCursor) || (m_dwDSWriteOff < dwWriteCursor)
- )))
- {
- m_dwDSWriteOff = dwWriteCursor;
- }
-
- if(m_dwDSWriteOff >= (DWORD)m_nDSBufSize)
- {
- m_dwDSWriteOff = 0;
- }
- }
-
- if(SUCCEEDED(hr)) hr = WriteSampleToDSBuffer(pMediaSample, NULL);
-
- return hr;
+ HRESULT hr = S_OK;
+ DWORD dwStatus = 0;
+ const long lSize = pMediaSample->GetActualDataLength();
+ DWORD dwPlayCursor = 0;
+ DWORD dwWriteCursor = 0;
+
+ hr = m_pDSBuffer->GetStatus(&dwStatus);
+
+ if (SUCCEEDED(hr) && (dwStatus & DSBSTATUS_BUFFERLOST))
+ hr = m_pDSBuffer->Restore();
+
+ if ((SUCCEEDED(hr)) && ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING))
+ {
+ hr = m_pDSBuffer->Play( 0, 0, DSBPLAY_LOOPING);
+ ATLASSERT(SUCCEEDED(hr));
+ }
+
+ if (SUCCEEDED(hr)) hr = m_pDSBuffer->GetCurrentPosition(&dwPlayCursor, &dwWriteCursor);
+
+ if (SUCCEEDED(hr))
+ {
+ if ( ( (dwPlayCursor < dwWriteCursor) &&
+ (
+ ((m_dwDSWriteOff >= dwPlayCursor) && (m_dwDSWriteOff <= dwWriteCursor))
+ ||
+ ((m_dwDSWriteOff < dwPlayCursor) && (m_dwDSWriteOff + lSize >= dwPlayCursor))
+ )
+ )
+ ||
+ ( (dwWriteCursor < dwPlayCursor) &&
+ (
+ (m_dwDSWriteOff >= dwPlayCursor) || (m_dwDSWriteOff < dwWriteCursor)
+ ) ) )
+ {
+ m_dwDSWriteOff = dwWriteCursor;
+ }
+
+ if (m_dwDSWriteOff >= (DWORD)m_nDSBufSize)
+ {
+ m_dwDSWriteOff = 0;
+ }
+ }
+
+ if (SUCCEEDED(hr)) hr = WriteSampleToDSBuffer(pMediaSample, NULL);
+
+ return hr;
}
HRESULT CMpcAudioRenderer::WriteSampleToDSBuffer(IMediaSample *pMediaSample, bool *looped)
{
- if(! m_pDSBuffer) return E_POINTER;
-
- REFERENCE_TIME rtStart = 0;
- REFERENCE_TIME rtStop = 0;
- HRESULT hr = S_OK;
- bool loop = false;
- VOID* pDSLockedBuffers[2] = { NULL, NULL };
- DWORD dwDSLockedSize[2] = { 0, 0 };
- BYTE* pMediaBuffer = NULL;
- long lSize = pMediaSample->GetActualDataLength();
-
- hr = pMediaSample->GetPointer(&pMediaBuffer);
-
- if(m_dRate > 1.0)
- {
- int nBytePerSample = m_pWaveFileFormat->nChannels * (m_pWaveFileFormat->wBitsPerSample / 8);
- m_pSoundTouch->putSamples((const short*)pMediaBuffer, lSize / nBytePerSample);
- lSize = m_pSoundTouch->receiveSamples((short*)pMediaBuffer, lSize / nBytePerSample) * nBytePerSample;
- }
-
- pMediaSample->GetTime(&rtStart, &rtStop);
-
- if(rtStart < 0)
- {
- DWORD dwPercent = (DWORD)((-rtStart * 100) / (rtStop - rtStart));
- DWORD dwRemove = (lSize * dwPercent / 100);
-
- dwRemove = (dwRemove / m_pWaveFileFormat->nBlockAlign) * m_pWaveFileFormat->nBlockAlign;
- pMediaBuffer += dwRemove;
- lSize -= dwRemove;
- }
-
- if(SUCCEEDED(hr))
- hr = m_pDSBuffer->Lock(m_dwDSWriteOff, lSize, &pDSLockedBuffers[0], &dwDSLockedSize[0], &pDSLockedBuffers[1], &dwDSLockedSize[1], 0);
- if(SUCCEEDED(hr))
- {
- if(pDSLockedBuffers [0] != NULL)
- {
- memcpy(pDSLockedBuffers[0], pMediaBuffer, dwDSLockedSize[0]);
- m_dwDSWriteOff += dwDSLockedSize[0];
- }
-
- if(pDSLockedBuffers [1] != NULL)
- {
- memcpy(pDSLockedBuffers[1], &pMediaBuffer[dwDSLockedSize[0]], dwDSLockedSize[1]);
- m_dwDSWriteOff = dwDSLockedSize[1];
- loop = true;
- }
-
- hr = m_pDSBuffer->Unlock(pDSLockedBuffers[0], dwDSLockedSize[0], pDSLockedBuffers[1], dwDSLockedSize[1]);
- ATLASSERT(dwDSLockedSize [0] + dwDSLockedSize [1] == (DWORD)lSize);
- }
-
- if(SUCCEEDED(hr) && looped) *looped = loop;
-
- return hr;
+ if (! m_pDSBuffer) return E_POINTER;
+
+ REFERENCE_TIME rtStart = 0;
+ REFERENCE_TIME rtStop = 0;
+ HRESULT hr = S_OK;
+ bool loop = false;
+ VOID* pDSLockedBuffers[2] = { NULL, NULL };
+ DWORD dwDSLockedSize[2] = { 0, 0 };
+ BYTE* pMediaBuffer = NULL;
+ long lSize = pMediaSample->GetActualDataLength();
+
+ hr = pMediaSample->GetPointer(&pMediaBuffer);
+
+ if (m_dRate > 1.0)
+ {
+ int nBytePerSample = m_pWaveFileFormat->nChannels * (m_pWaveFileFormat->wBitsPerSample/8);
+ m_pSoundTouch->putSamples((const short*)pMediaBuffer, lSize / nBytePerSample);
+ lSize = m_pSoundTouch->receiveSamples ((short*)pMediaBuffer, lSize / nBytePerSample) * nBytePerSample;
+ }
+
+ pMediaSample->GetTime (&rtStart, &rtStop);
+
+ if (rtStart < 0)
+ {
+ DWORD dwPercent = (DWORD) ((-rtStart * 100) / (rtStop - rtStart));
+ DWORD dwRemove = (lSize*dwPercent/100);
+
+ dwRemove = (dwRemove / m_pWaveFileFormat->nBlockAlign) * m_pWaveFileFormat->nBlockAlign;
+ pMediaBuffer += dwRemove;
+ lSize -= dwRemove;
+ }
+
+ if (SUCCEEDED (hr))
+ hr = m_pDSBuffer->Lock (m_dwDSWriteOff, lSize, &pDSLockedBuffers[0], &dwDSLockedSize[0], &pDSLockedBuffers[1], &dwDSLockedSize[1], 0 );
+ if (SUCCEEDED (hr))
+ {
+ if (pDSLockedBuffers [0] != NULL)
+ {
+ memcpy(pDSLockedBuffers[0], pMediaBuffer, dwDSLockedSize[0]);
+ m_dwDSWriteOff += dwDSLockedSize[0];
+ }
+
+ if (pDSLockedBuffers [1] != NULL)
+ {
+ memcpy(pDSLockedBuffers[1], &pMediaBuffer[dwDSLockedSize[0]], dwDSLockedSize[1]);
+ m_dwDSWriteOff = dwDSLockedSize[1];
+ loop = true;
+ }
+
+ hr = m_pDSBuffer->Unlock(pDSLockedBuffers[0], dwDSLockedSize[0], pDSLockedBuffers[1], dwDSLockedSize[1]);
+ ATLASSERT (dwDSLockedSize [0] + dwDSLockedSize [1] == (DWORD)lSize);
+ }
+
+ if (SUCCEEDED(hr) && looped) *looped = loop;
+
+ return hr;
}
#pragma endregion
@@ -707,175 +707,175 @@ HRESULT CMpcAudioRenderer::WriteSampleToDSBuffer(IMediaSample *pMediaSample, boo
HRESULT CMpcAudioRenderer::DoRenderSampleWasapi(IMediaSample *pMediaSample)
{
- HRESULT hr = S_OK;
- REFERENCE_TIME rtStart = 0;
- REFERENCE_TIME rtStop = 0;
- DWORD flags = 0;
- BYTE *pMediaBuffer = NULL;
- BYTE *pInputBufferPointer = NULL;
- BYTE *pInputBufferEnd = NULL;
- BYTE *pData;
- bufferSize = pMediaSample->GetActualDataLength();
- const long lSize = bufferSize;
- pMediaSample->GetTime(&rtStart, &rtStop);
-
- AM_MEDIA_TYPE *pmt;
- if(SUCCEEDED(pMediaSample->GetMediaType(&pmt)) && pmt != NULL)
- {
- CMediaType mt(*pmt);
- if((WAVEFORMATEXTENSIBLE*)mt.Format() != NULL)
- hr = CheckAudioClient(&(((WAVEFORMATEXTENSIBLE*)mt.Format())->Format));
- else
- hr = CheckAudioClient((WAVEFORMATEX*)mt.Format());
- if(FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Error while checking audio client with input media type"));
- return hr;
- }
- DeleteMediaType(pmt);
- pmt = NULL;
- }
-
-// Initialization
- hr = pMediaSample->GetPointer(&pMediaBuffer);
- if(FAILED(hr)) return hr;
-
- pInputBufferPointer = &pMediaBuffer[0];
- pInputBufferEnd = &pMediaBuffer[0] + lSize;
-
- WORD frameSize = m_pWaveFileFormat->nBlockAlign;
-
-
-// Sleep for half the buffer duration since last buffer feed
- DWORD currentTime = GetTickCount();
- if(lastBufferTime != 0 && hnsActualDuration != 0 && lastBufferTime < currentTime && (currentTime - lastBufferTime) < hnsActualDuration)
- {
- hnsActualDuration = hnsActualDuration - (currentTime - lastBufferTime);
- Sleep(hnsActualDuration);
- }
-
- // Each loop fills one of the two buffers.
- while(pInputBufferPointer < pInputBufferEnd)
- {
- UINT32 numFramesPadding = 0;
- pAudioClient->GetCurrentPadding(&numFramesPadding);
- UINT32 numFramesAvailable = nFramesInBuffer - numFramesPadding;
-
- UINT32 nAvailableBytes = numFramesAvailable * frameSize;
- UINT32 nBytesToWrite = nAvailableBytes;
- // More room than enough in the output buffer
- if(nAvailableBytes > pInputBufferEnd - pInputBufferPointer)
- {
- nBytesToWrite = pInputBufferEnd - pInputBufferPointer;
- numFramesAvailable = (UINT32)((float)nBytesToWrite / frameSize);
- }
-
- // Grab the next empty buffer from the audio device.
- hr = pRenderClient->GetBuffer(numFramesAvailable, &pData);
- if(FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi GetBuffer failed with size %ld : (error %lx)"), nFramesInBuffer, hr);
- return hr;
- }
-
- // Load the buffer with data from the audio source.
- if(pData != NULL)
- {
-
- memcpy(&pData[0], pInputBufferPointer, nBytesToWrite);
- pInputBufferPointer += nBytesToWrite;
- }
- else
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Output buffer is NULL"));
-
- hr = pRenderClient->ReleaseBuffer(numFramesAvailable, 0); // no flags
- if(FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi ReleaseBuffer failed with size %ld (error %lx)"), nFramesInBuffer, hr);
- return hr;
- }
-
- if(!isAudioClientStarted)
- {
- TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Starting audio client"));
- pAudioClient->Start();
- isAudioClientStarted = true;
- }
-
- if(pInputBufferPointer >= pInputBufferEnd)
- {
- lastBufferTime = GetTickCount();
- // This is the duration of the filled buffer
- hnsActualDuration = (double)REFTIMES_PER_SEC * numFramesAvailable / m_pWaveFileFormat->nSamplesPerSec;
- // Sleep time is half this duration
- hnsActualDuration = (DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2);
- break;
- }
-
- // Buffer not completely filled, sleep for half buffer capacity duration
- hnsActualDuration = (double)REFTIMES_PER_SEC * nFramesInBuffer / m_pWaveFileFormat->nSamplesPerSec;
- // Sleep time is half this duration
- hnsActualDuration = (DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2);
- Sleep(hnsActualDuration);
- }
+ HRESULT hr = S_OK;
+ REFERENCE_TIME rtStart = 0;
+ REFERENCE_TIME rtStop = 0;
+ DWORD flags = 0;
+ BYTE *pMediaBuffer = NULL;
+ BYTE *pInputBufferPointer = NULL;
+ BYTE *pInputBufferEnd = NULL;
+ BYTE *pData;
+ bufferSize = pMediaSample->GetActualDataLength();
+ const long lSize = bufferSize;
+ pMediaSample->GetTime (&rtStart, &rtStop);
+
+ AM_MEDIA_TYPE *pmt;
+ if (SUCCEEDED(pMediaSample->GetMediaType(&pmt)) && pmt!=NULL)
+ {
+ CMediaType mt(*pmt);
+ if ((WAVEFORMATEXTENSIBLE*)mt.Format() != NULL)
+ hr=CheckAudioClient(&(((WAVEFORMATEXTENSIBLE*)mt.Format())->Format));
+ else
+ hr=CheckAudioClient((WAVEFORMATEX*)mt.Format());
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Error while checking audio client with input media type"));
+ return hr;
+ }
+ DeleteMediaType(pmt);
+ pmt=NULL;
+ }
+
+ // Initialization
+ hr = pMediaSample->GetPointer(&pMediaBuffer);
+ if (FAILED (hr)) return hr;
+
+ pInputBufferPointer=&pMediaBuffer[0];
+ pInputBufferEnd=&pMediaBuffer[0]+lSize;
+
+ WORD frameSize = m_pWaveFileFormat->nBlockAlign;
+
+
+ // Sleep for half the buffer duration since last buffer feed
+ DWORD currentTime=GetTickCount();
+ if (lastBufferTime!=0 && hnsActualDuration!= 0 && lastBufferTime<currentTime && (currentTime-lastBufferTime)<hnsActualDuration)
+ {
+ hnsActualDuration=hnsActualDuration-(currentTime-lastBufferTime);
+ Sleep(hnsActualDuration);
+ }
+
+ // Each loop fills one of the two buffers.
+ while (pInputBufferPointer < pInputBufferEnd)
+ {
+ UINT32 numFramesPadding=0;
+ pAudioClient->GetCurrentPadding(&numFramesPadding);
+ UINT32 numFramesAvailable = nFramesInBuffer - numFramesPadding;
+
+ UINT32 nAvailableBytes=numFramesAvailable*frameSize;
+ UINT32 nBytesToWrite=nAvailableBytes;
+ // More room than enough in the output buffer
+ if (nAvailableBytes > pInputBufferEnd - pInputBufferPointer)
+ {
+ nBytesToWrite=pInputBufferEnd - pInputBufferPointer;
+ numFramesAvailable=(UINT32)((float)nBytesToWrite/frameSize);
+ }
+
+ // Grab the next empty buffer from the audio device.
+ hr = pRenderClient->GetBuffer(numFramesAvailable, &pData);
+ if (FAILED (hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi GetBuffer failed with size %ld : (error %lx)"),nFramesInBuffer,hr);
return hr;
+ }
+
+ // Load the buffer with data from the audio source.
+ if (pData != NULL)
+ {
+
+ memcpy(&pData[0], pInputBufferPointer, nBytesToWrite);
+ pInputBufferPointer += nBytesToWrite;
+ }
+ else
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Output buffer is NULL"));
+
+ hr = pRenderClient->ReleaseBuffer(numFramesAvailable, 0); // no flags
+ if (FAILED (hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi ReleaseBuffer failed with size %ld (error %lx)"),nFramesInBuffer,hr);
+ return hr;
+ }
+
+ if (!isAudioClientStarted)
+ {
+ TRACE(_T("CMpcAudioRenderer::DoRenderSampleWasapi Starting audio client"));
+ pAudioClient->Start();
+ isAudioClientStarted=true;
+ }
+
+ if (pInputBufferPointer >= pInputBufferEnd)
+ {
+ lastBufferTime=GetTickCount();
+ // This is the duration of the filled buffer
+ hnsActualDuration=(double)REFTIMES_PER_SEC * numFramesAvailable / m_pWaveFileFormat->nSamplesPerSec;
+ // Sleep time is half this duration
+ hnsActualDuration=(DWORD)(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
+ break;
+ }
+
+ // Buffer not completely filled, sleep for half buffer capacity duration
+ hnsActualDuration=(double)REFTIMES_PER_SEC * nFramesInBuffer / m_pWaveFileFormat->nSamplesPerSec;
+ // Sleep time is half this duration
+ hnsActualDuration=(DWORD)(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
+ Sleep(hnsActualDuration);
+ }
+ return hr;
}
HRESULT CMpcAudioRenderer::CheckAudioClient(WAVEFORMATEX *pWaveFormatEx)
{
- HRESULT hr = S_OK;
- CAutoLock cAutoLock(&m_csCheck);
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient"));
- if(pMMDevice == NULL) hr = GetDefaultAudioDevice(&pMMDevice);
-
-// If no WAVEFORMATEX structure provided and client already exists, return it
- if(pAudioClient != NULL && pWaveFormatEx == NULL) return hr;
-
-// Just create the audio client if no WAVEFORMATEX provided
- if(pAudioClient == NULL && pWaveFormatEx == NULL)
- {
- if(SUCCEEDED(hr)) hr = CreateAudioClient(pMMDevice, &pAudioClient);
- return hr;
- }
-
-// Compare the exisiting WAVEFORMATEX with the one provided
- WAVEFORMATEX *pNewWaveFormatEx = NULL;
- if(CheckFormatChanged(pWaveFormatEx, &pNewWaveFormatEx))
- {
- // Format has changed, audio client has to be reinitialized
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient Format changed, reinitialize the audio client"));
- if(m_pWaveFileFormat)
- {
- BYTE *p = (BYTE *)m_pWaveFileFormat;
- SAFE_DELETE_ARRAY(p);
- }
- m_pWaveFileFormat = pNewWaveFormatEx;
- hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
- if(SUCCEEDED(hr))
- {
- if(pAudioClient != NULL && isAudioClientStarted) pAudioClient->Stop();
- isAudioClientStarted = false;
- SAFE_RELEASE(pRenderClient);
- SAFE_RELEASE(pAudioClient);
- if(SUCCEEDED(hr)) hr = CreateAudioClient(pMMDevice, &pAudioClient);
- }
- else
- {
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient New format not supported, accept it anyway"));
- return S_OK;
- }
- }
- else if(pRenderClient == NULL)
- {
- TRACE(_T("CMpcAudioRenderer::CheckAudioClient First initialization of the audio renderer"));
- }
- else
- return hr;
-
-
- SAFE_RELEASE(pRenderClient);
- if(SUCCEEDED(hr)) hr = InitAudioClient(pWaveFormatEx, pAudioClient, &pRenderClient);
- return hr;
+ HRESULT hr = S_OK;
+ CAutoLock cAutoLock(&m_csCheck);
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient"));
+ if (pMMDevice == NULL) hr=GetDefaultAudioDevice(&pMMDevice);
+
+ // If no WAVEFORMATEX structure provided and client already exists, return it
+ if (pAudioClient != NULL && pWaveFormatEx == NULL) return hr;
+
+ // Just create the audio client if no WAVEFORMATEX provided
+ if (pAudioClient == NULL && pWaveFormatEx==NULL)
+ {
+ if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
+ return hr;
+ }
+
+ // Compare the exisiting WAVEFORMATEX with the one provided
+ WAVEFORMATEX *pNewWaveFormatEx = NULL;
+ if (CheckFormatChanged(pWaveFormatEx, &pNewWaveFormatEx))
+ {
+ // Format has changed, audio client has to be reinitialized
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient Format changed, reinitialize the audio client"));
+ if (m_pWaveFileFormat)
+ {
+ BYTE *p = (BYTE *)m_pWaveFileFormat;
+ SAFE_DELETE_ARRAY(p);
+ }
+ m_pWaveFileFormat=pNewWaveFormatEx;
+ hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
+ if (SUCCEEDED(hr))
+ {
+ if (pAudioClient!=NULL && isAudioClientStarted) pAudioClient->Stop();
+ isAudioClientStarted=false;
+ SAFE_RELEASE(pRenderClient);
+ SAFE_RELEASE(pAudioClient);
+ if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
+ }
+ else
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient New format not supported, accept it anyway"));
+ return S_OK;
+ }
+ }
+ else if (pRenderClient == NULL)
+ {
+ TRACE(_T("CMpcAudioRenderer::CheckAudioClient First initialization of the audio renderer"));
+ }
+ else
+ return hr;
+
+
+ SAFE_RELEASE(pRenderClient);
+ if (SUCCEEDED (hr)) hr=InitAudioClient(pWaveFormatEx, pAudioClient, &pRenderClient);
+ return hr;
}
/* Retrieves the default audio device from the Core Audio API
@@ -884,163 +884,162 @@ HRESULT CMpcAudioRenderer::CheckAudioClient(WAVEFORMATEX *pWaveFormatEx)
*/
HRESULT CMpcAudioRenderer::GetDefaultAudioDevice(IMMDevice **ppMMDevice)
{
- HRESULT hr;
- CComPtr<IMMDeviceEnumerator> enumerator;
- TRACE(_T("CMpcAudioRenderer::GetDefaultAudioDevice"));
-
- hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
- hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
- ppMMDevice);
- return hr;
+ HRESULT hr;
+ CComPtr<IMMDeviceEnumerator> enumerator;
+ TRACE(_T("CMpcAudioRenderer::GetDefaultAudioDevice"));
+
+ hr = enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
+ hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
+ ppMMDevice);
+ return hr;
}
bool CMpcAudioRenderer::CheckFormatChanged(WAVEFORMATEX *pWaveFormatEx, WAVEFORMATEX **ppNewWaveFormatEx)
{
- bool formatChanged = false;
- if(m_pWaveFileFormat == NULL)
- formatChanged = true;
- else if(pWaveFormatEx->wFormatTag != m_pWaveFileFormat->wFormatTag
- || pWaveFormatEx->nChannels != m_pWaveFileFormat->nChannels
- || pWaveFormatEx->wBitsPerSample != m_pWaveFileFormat->wBitsPerSample) // TODO : improve the checks
- formatChanged = true;
-
-
- if(!formatChanged) return false;
-
- int size = sizeof(WAVEFORMATEX) + pWaveFormatEx->cbSize; // Always true, even for WAVEFORMATEXTENSIBLE and WAVEFORMATEXTENSIBLE_IEC61937
- *ppNewWaveFormatEx = (WAVEFORMATEX *)new BYTE[size];
- if(! *ppNewWaveFormatEx)
- return false;
- memcpy(*ppNewWaveFormatEx, pWaveFormatEx, size);
- return true;
+ bool formatChanged=false;
+ if (m_pWaveFileFormat==NULL)
+ formatChanged=true;
+ else if (pWaveFormatEx->wFormatTag != m_pWaveFileFormat->wFormatTag
+ || pWaveFormatEx->nChannels != m_pWaveFileFormat->nChannels
+ || pWaveFormatEx->wBitsPerSample != m_pWaveFileFormat->wBitsPerSample) // TODO : improve the checks
+ formatChanged=true;
+
+
+ if (!formatChanged) return false;
+
+ int size = sizeof(WAVEFORMATEX) + pWaveFormatEx->cbSize; // Always true, even for WAVEFORMATEXTENSIBLE and WAVEFORMATEXTENSIBLE_IEC61937
+ *ppNewWaveFormatEx = (WAVEFORMATEX *)new BYTE[size];
+ if (! *ppNewWaveFormatEx)
+ return false;
+ memcpy(*ppNewWaveFormatEx, pWaveFormatEx, size);
+ return true;
}
HRESULT CMpcAudioRenderer::GetBufferSize(WAVEFORMATEX *pWaveFormatEx, REFERENCE_TIME *pHnsBufferPeriod)
-{
- if(pWaveFormatEx == NULL) return S_OK;
- if(pWaveFormatEx->cbSize < 22) //WAVEFORMATEX
- return S_OK;
-
- WAVEFORMATEXTENSIBLE *wfext = (WAVEFORMATEXTENSIBLE*)pWaveFormatEx;
-
- if(bufferSize == 0)
- if(wfext->SubFormat == KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP)
- bufferSize = 61440;
- else if(wfext->SubFormat == KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD)
- bufferSize = 32768;
- else if(wfext->SubFormat == KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS)
- bufferSize = 24576;
- else if(wfext->Format.wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF)
- bufferSize = 6144;
- else return S_OK;
-
- *pHnsBufferPeriod = (REFERENCE_TIME)((REFERENCE_TIME)bufferSize * 10000 * 8 / ((REFERENCE_TIME)pWaveFormatEx->nChannels * pWaveFormatEx->wBitsPerSample *
- 1.0 * pWaveFormatEx->nSamplesPerSec) /*+ 0.5*/);
- *pHnsBufferPeriod *= 1000;
-
- TRACE(_T("CMpcAudioRenderer::GetBufferSize set a %lld period for a %ld buffer size"), *pHnsBufferPeriod, bufferSize);
-
- return S_OK;
+{
+ if (pWaveFormatEx==NULL) return S_OK;
+ if (pWaveFormatEx->cbSize <22) //WAVEFORMATEX
+ return S_OK;
+
+ WAVEFORMATEXTENSIBLE *wfext=(WAVEFORMATEXTENSIBLE*)pWaveFormatEx;
+
+ if (bufferSize==0)
+ if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP)
+ bufferSize=61440;
+ else if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD)
+ bufferSize=32768;
+ else if (wfext->SubFormat==KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS)
+ bufferSize=24576;
+ else if (wfext->Format.wFormatTag==WAVE_FORMAT_DOLBY_AC3_SPDIF)
+ bufferSize=6144;
+ else return S_OK;
+
+ *pHnsBufferPeriod = (REFERENCE_TIME)( (REFERENCE_TIME)bufferSize * 10000 * 8 / ((REFERENCE_TIME)pWaveFormatEx->nChannels * pWaveFormatEx->wBitsPerSample *
+ 1.0 * pWaveFormatEx->nSamplesPerSec) /*+ 0.5*/);
+ *pHnsBufferPeriod *= 1000;
+
+ TRACE(_T("CMpcAudioRenderer::GetBufferSize set a %lld period for a %ld buffer size"),*pHnsBufferPeriod,bufferSize);
+
+ return S_OK;
}
HRESULT CMpcAudioRenderer::InitAudioClient(WAVEFORMATEX *pWaveFormatEx, IAudioClient *pAudioClient, IAudioRenderClient **ppRenderClient)
{
- TRACE(_T("CMpcAudioRenderer::InitAudioClient"));
- HRESULT hr = S_OK;
-// Initialize the stream to play at the minimum latency.
-//if (SUCCEEDED (hr)) hr = pAudioClient->GetDevicePeriod(NULL, &hnsPeriod);
- hnsPeriod = 500000; //50 ms is the best according to James @Slysoft
-
- hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
- if(FAILED(hr))
- TRACE(_T("CMpcAudioRenderer::InitAudioClient not supported (0x%08x)"), hr);
- else
- TRACE(_T("CMpcAudioRenderer::InitAudioClient format supported"));
-
- GetBufferSize(pWaveFormatEx, &hnsPeriod);
-
- if(SUCCEEDED(hr)) hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, 0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
- hnsPeriod, hnsPeriod, pWaveFormatEx, NULL);
- if(FAILED(hr) && hr != AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
- {
- TRACE(_T("CMpcAudioRenderer::InitAudioClient failed (0x%08x)"), hr);
- return hr;
- }
-
- if(AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
- {
- // if the buffer size was not aligned, need to do the alignment dance
- TRACE(_T("CMpcAudioRenderer::InitAudioClient Buffer size not aligned. Realigning"));
-
- // get the buffer size, which will be aligned
- hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
-
- // throw away this IAudioClient
- pAudioClient->Release();
- pAudioClient = NULL;
-
- // calculate the new aligned periodicity
- hnsPeriod = // hns =
- (REFERENCE_TIME)(
- 10000.0 * // (hns / ms) *
- 1000 * // (ms / s) *
- nFramesInBuffer / // frames /
- pWaveFormatEx->nSamplesPerSec // (frames / s)
- + 0.5 // rounding
- );
-
- if(SUCCEEDED(hr)) hr = CreateAudioClient(pMMDevice, &pAudioClient);
- TRACE(_T("CMpcAudioRenderer::InitAudioClient Trying again with periodicity of %I64u hundred-nanoseconds, or %u frames.\n"), hnsPeriod, nFramesInBuffer);
- if(SUCCEEDED(hr))
- hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, 0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
- hnsPeriod, hnsPeriod, pWaveFormatEx, NULL);
- if(FAILED(hr))
- {
- TRACE(_T("CMpcAudioRenderer::InitAudioClient Failed to reinitialize the audio client"));
- return hr;
- }
- } // if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
-
-// get the buffer size, which is aligned
- if(SUCCEEDED(hr)) hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
-
-// calculate the new period
- if(SUCCEEDED(hr)) hr = pAudioClient->GetService(__uuidof(IAudioRenderClient), (void**)(ppRenderClient));
-
- if(FAILED(hr))
- TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization failed (0x%08x)"), hr);
- else
- TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization success"));
-
- return hr;
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient"));
+ HRESULT hr=S_OK;
+ // Initialize the stream to play at the minimum latency.
+ //if (SUCCEEDED (hr)) hr = pAudioClient->GetDevicePeriod(NULL, &hnsPeriod);
+ hnsPeriod=500000; //50 ms is the best according to James @Slysoft
+
+ hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, pWaveFormatEx, NULL);
+ if (FAILED(hr))
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient not supported (0x%08x)"), hr);
+ else
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient format supported"));
+
+ GetBufferSize(pWaveFormatEx, &hnsPeriod);
+
+ if (SUCCEEDED (hr)) hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
+ hnsPeriod,hnsPeriod,pWaveFormatEx,NULL);
+ if (FAILED (hr) && hr != AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
+ {
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient failed (0x%08x)"), hr);
+ return hr;
+ }
+
+ if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
+ {
+ // if the buffer size was not aligned, need to do the alignment dance
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient Buffer size not aligned. Realigning"));
+
+ // get the buffer size, which will be aligned
+ hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
+
+ // throw away this IAudioClient
+ pAudioClient->Release();pAudioClient=NULL;
+
+ // calculate the new aligned periodicity
+ hnsPeriod = // hns =
+ (REFERENCE_TIME)(
+ 10000.0 * // (hns / ms) *
+ 1000 * // (ms / s) *
+ nFramesInBuffer / // frames /
+ pWaveFormatEx->nSamplesPerSec // (frames / s)
+ + 0.5 // rounding
+ );
+
+ if (SUCCEEDED (hr)) hr=CreateAudioClient(pMMDevice, &pAudioClient);
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient Trying again with periodicity of %I64u hundred-nanoseconds, or %u frames.\n"), hnsPeriod, nFramesInBuffer);
+ if (SUCCEEDED (hr))
+ hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,0/*AUDCLNT_STREAMFLAGS_EVENTCALLBACK*/,
+ hnsPeriod, hnsPeriod, pWaveFormatEx, NULL);
+ if (FAILED(hr))
+ {
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient Failed to reinitialize the audio client"));
+ return hr;
+ }
+ } // if (AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED == hr)
+
+ // get the buffer size, which is aligned
+ if (SUCCEEDED (hr)) hr = pAudioClient->GetBufferSize(&nFramesInBuffer);
+
+ // calculate the new period
+ if (SUCCEEDED (hr)) hr = pAudioClient->GetService(__uuidof(IAudioRenderClient), (void**)(ppRenderClient));
+
+ if (FAILED (hr))
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization failed (0x%08x)"), hr);
+ else
+ TRACE(_T("CMpcAudioRenderer::InitAudioClient service initialization success"));
+
+ return hr;
}
HRESULT CMpcAudioRenderer::CreateAudioClient(IMMDevice *pMMDevice, IAudioClient **ppAudioClient)
{
- HRESULT hr = S_OK;
- hnsPeriod = 0;
-
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient"));
-
- if(*ppAudioClient)
- {
- if(isAudioClientStarted)(*ppAudioClient)->Stop();
- SAFE_RELEASE(*ppAudioClient);
- isAudioClientStarted = false;
- }
-
- if(pMMDevice == NULL)
- {
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient failed, device not loaded"));
- return E_FAIL;
- }
-
- hr = pMMDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, reinterpret_cast<void**>(ppAudioClient));
- if(FAILED(hr))
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient activation failed (0x%08x)"), hr);
- else
- TRACE(_T("CMpcAudioRenderer::CreateAudioClient success"));
- return hr;
+ HRESULT hr = S_OK;
+ hnsPeriod = 0;
+
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient"));
+
+ if (*ppAudioClient)
+ {
+ if (isAudioClientStarted) (*ppAudioClient)->Stop();
+ SAFE_RELEASE(*ppAudioClient);
+ isAudioClientStarted=false;
+ }
+
+ if (pMMDevice==NULL)
+ {
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient failed, device not loaded"));
+ return E_FAIL;
+ }
+
+ hr = pMMDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, NULL, reinterpret_cast<void**>(ppAudioClient));
+ if (FAILED(hr))
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient activation failed (0x%08x)"), hr);
+ else
+ TRACE(_T("CMpcAudioRenderer::CreateAudioClient success"));
+ return hr;
}
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h
index 686723f9a..83b937b08 100644
--- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h
+++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -47,80 +47,80 @@
class CMpcAudioRenderer : public CBaseRenderer
{
public:
- CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr);
- virtual ~CMpcAudioRenderer();
+ CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr);
+ virtual ~CMpcAudioRenderer();
static const AMOVIESETUP_FILTER sudASFilter;
- HRESULT CheckInputType(const CMediaType* mtIn);
- virtual HRESULT CheckMediaType(const CMediaType *pmt);
- virtual HRESULT DoRenderSample(IMediaSample *pMediaSample);
- virtual void OnReceiveFirstSample(IMediaSample *pMediaSample);
- BOOL ScheduleSample(IMediaSample *pMediaSample);
- virtual HRESULT SetMediaType(const CMediaType *pmt);
- virtual HRESULT CompleteConnect(IPin *pReceivePin);
+ HRESULT CheckInputType (const CMediaType* mtIn);
+ virtual HRESULT CheckMediaType (const CMediaType *pmt);
+ virtual HRESULT DoRenderSample (IMediaSample *pMediaSample);
+ virtual void OnReceiveFirstSample (IMediaSample *pMediaSample);
+ BOOL ScheduleSample (IMediaSample *pMediaSample);
+ virtual HRESULT SetMediaType (const CMediaType *pmt);
+ virtual HRESULT CompleteConnect (IPin *pReceivePin);
- HRESULT EndOfStream(void);
+ HRESULT EndOfStream(void);
DECLARE_IUNKNOWN
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
- // === IMediaFilter
- STDMETHOD(Run)(REFERENCE_TIME tStart);
- STDMETHOD(Stop)();
- STDMETHOD(Pause)();
+ // === IMediaFilter
+ STDMETHOD(Run) (REFERENCE_TIME tStart);
+ STDMETHOD(Stop) ();
+ STDMETHOD(Pause) ();
-// CMpcAudioRenderer
+ // CMpcAudioRenderer
private:
- HRESULT DoRenderSampleDirectSound(IMediaSample *pMediaSample);
-
- HRESULT InitCoopLevel();
- HRESULT ClearBuffer();
- HRESULT CreateDSBuffer();
- HRESULT GetReferenceClockInterface(REFIID riid, void **ppv);
- HRESULT WriteSampleToDSBuffer(IMediaSample *pMediaSample, bool *looped);
-
- LPDIRECTSOUND8 m_pDS;
- LPDIRECTSOUNDBUFFER m_pDSBuffer;
- DWORD m_dwDSWriteOff;
- WAVEFORMATEX *m_pWaveFileFormat;
- int m_nDSBufSize;
- CBaseReferenceClock* m_pReferenceClock;
- double m_dRate;
- soundtouch::SoundTouch* m_pSoundTouch;
-
-// CMpcAudioRenderer WASAPI methods
- HRESULT GetDefaultAudioDevice(IMMDevice **ppMMDevice);
- HRESULT CreateAudioClient(IMMDevice *pMMDevice, IAudioClient **ppAudioClient);
- HRESULT InitAudioClient(WAVEFORMATEX *pWaveFormatEx, IAudioClient *pAudioClient, IAudioRenderClient **ppRenderClient);
- HRESULT CheckAudioClient(WAVEFORMATEX *pWaveFormatEx);
- bool CheckFormatChanged(WAVEFORMATEX *pWaveFormatEx, WAVEFORMATEX **ppNewWaveFormatEx);
- HRESULT DoRenderSampleWasapi(IMediaSample *pMediaSample);
- HRESULT GetBufferSize(WAVEFORMATEX *pWaveFormatEx, REFERENCE_TIME *pHnsBufferPeriod);
-
-
-// WASAPI variables
- bool useWASAPI;
- IMMDevice *pMMDevice;
- IAudioClient *pAudioClient;
- IAudioRenderClient *pRenderClient;
- UINT32 nFramesInBuffer;
- REFERENCE_TIME hnsPeriod, hnsActualDuration;
- HANDLE hTask;
- CCritSec m_csCheck;
- UINT32 bufferSize;
- bool isAudioClientStarted;
- DWORD lastBufferTime;
-
- // AVRT.dll (Vista or greater
- typedef HANDLE(__stdcall *PTR_AvSetMmThreadCharacteristicsW)(LPCWSTR TaskName, LPDWORD TaskIndex);
- typedef BOOL (__stdcall *PTR_AvRevertMmThreadCharacteristics)(HANDLE AvrtHandle);
-
- PTR_AvSetMmThreadCharacteristicsW pfAvSetMmThreadCharacteristicsW;
- PTR_AvRevertMmThreadCharacteristics pfAvRevertMmThreadCharacteristics;
+ HRESULT DoRenderSampleDirectSound(IMediaSample *pMediaSample);
+
+ HRESULT InitCoopLevel();
+ HRESULT ClearBuffer();
+ HRESULT CreateDSBuffer();
+ HRESULT GetReferenceClockInterface(REFIID riid, void **ppv);
+ HRESULT WriteSampleToDSBuffer(IMediaSample *pMediaSample, bool *looped);
+
+ LPDIRECTSOUND8 m_pDS;
+ LPDIRECTSOUNDBUFFER m_pDSBuffer;
+ DWORD m_dwDSWriteOff;
+ WAVEFORMATEX *m_pWaveFileFormat;
+ int m_nDSBufSize;
+ CBaseReferenceClock* m_pReferenceClock;
+ double m_dRate;
+ soundtouch::SoundTouch* m_pSoundTouch;
+
+ // CMpcAudioRenderer WASAPI methods
+ HRESULT GetDefaultAudioDevice(IMMDevice **ppMMDevice);
+ HRESULT CreateAudioClient(IMMDevice *pMMDevice, IAudioClient **ppAudioClient);
+ HRESULT InitAudioClient(WAVEFORMATEX *pWaveFormatEx, IAudioClient *pAudioClient, IAudioRenderClient **ppRenderClient);
+ HRESULT CheckAudioClient(WAVEFORMATEX *pWaveFormatEx);
+ bool CheckFormatChanged(WAVEFORMATEX *pWaveFormatEx, WAVEFORMATEX **ppNewWaveFormatEx);
+ HRESULT DoRenderSampleWasapi(IMediaSample *pMediaSample);
+ HRESULT GetBufferSize(WAVEFORMATEX *pWaveFormatEx, REFERENCE_TIME *pHnsBufferPeriod);
+
+
+ // WASAPI variables
+ bool useWASAPI;
+ IMMDevice *pMMDevice;
+ IAudioClient *pAudioClient;
+ IAudioRenderClient *pRenderClient;
+ UINT32 nFramesInBuffer;
+ REFERENCE_TIME hnsPeriod, hnsActualDuration;
+ HANDLE hTask;
+ CCritSec m_csCheck;
+ UINT32 bufferSize;
+ bool isAudioClientStarted;
+ DWORD lastBufferTime;
+
+ // AVRT.dll (Vista or greater
+ typedef HANDLE (__stdcall *PTR_AvSetMmThreadCharacteristicsW)(LPCWSTR TaskName, LPDWORD TaskIndex);
+ typedef BOOL (__stdcall *PTR_AvRevertMmThreadCharacteristics)(HANDLE AvrtHandle);
+
+ PTR_AvSetMmThreadCharacteristicsW pfAvSetMmThreadCharacteristicsW;
+ PTR_AvRevertMmThreadCharacteristics pfAvRevertMmThreadCharacteristics;
};
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/BPMDetect.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/BPMDetect.h
index b87e0ecc5..4def43f1e 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/BPMDetect.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/BPMDetect.h
@@ -14,10 +14,10 @@
/// taking absolute value that's smoothed by sliding average. Signal levels that
/// are below a couple of times the general RMS amplitude level are cut away to
/// leave only notable peaks there.
-/// - Repeating sound patterns (e.g. beats) are detected by calculating short-term
+/// - Repeating sound patterns (e.g. beats) are detected by calculating short-term
/// autocorrelation function of the enveloped signal.
-/// - After whole sound data file has been analyzed as above, the bpm level is
-/// detected by function 'getBpm' that finds the highest peak of the autocorrelation
+/// - After whole sound data file has been analyzed as above, the bpm level is
+/// detected by function 'getBpm' that finds the highest peak of the autocorrelation
/// function, calculates it's precise location and converts this reading to bpm's.
///
/// Author : Copyright (c) Olli Parviainen
@@ -76,7 +76,7 @@ class BPMDetect
protected:
/// Auto-correlation accumulator bins.
float *xcorr;
-
+
/// Amplitude envelope sliding average approximation level accumulator
float envelopeAccu;
@@ -104,15 +104,15 @@ protected:
/// Beginning of auto-correlation window: Autocorrelation isn't being updated for
/// the first these many correlation bins.
int windowStart;
-
+
/// FIFO-buffer for decimated processing samples.
soundtouch::FIFOSampleBuffer *buffer;
- /// Updates auto-correlation function for given number of decimated samples that
- /// are read from the internal 'buffer' pipe (samples aren't removed from the pipe
+ /// Updates auto-correlation function for given number of decimated samples that
+ /// are read from the internal 'buffer' pipe (samples aren't removed from the pipe
/// though).
void updateXCorr(int process_samples /// How many samples are processed.
- );
+ );
/// Decimates samples to approx. 500 Hz.
///
@@ -120,32 +120,32 @@ protected:
int decimate(soundtouch::SAMPLETYPE *dest, ///< Destination buffer
const soundtouch::SAMPLETYPE *src, ///< Source sample buffer
int numsamples ///< Number of source samples.
- );
+ );
/// Calculates amplitude envelope for the buffer of samples.
/// Result is output to 'samples'.
void calcEnvelope(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/output data buffer
int numsamples ///< Number of samples in buffer
- );
+ );
public:
/// Constructor.
BPMDetect(int numChannels, ///< Number of channels in sample data.
int sampleRate ///< Sample rate in Hz.
- );
+ );
/// Destructor.
virtual ~BPMDetect();
/// Inputs a block of samples for analyzing: Envelopes the samples and then
/// updates the autocorrelation estimation. When whole song data has been input
- /// in smaller blocks using this function, read the resulting bpm with 'getBpm'
- /// function.
- ///
+ /// in smaller blocks using this function, read the resulting bpm with 'getBpm'
+ /// function.
+ ///
/// Notice that data in 'samples' array can be disrupted in processing.
void inputSamples(const soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer
int numSamples ///< Number of samples in buffer
- );
+ );
/// Analyzes the results and returns the BPM rate. Use this function to read result
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSampleBuffer.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSampleBuffer.h
index 69755c598..76cbf9514 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSampleBuffer.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSampleBuffer.h
@@ -1,12 +1,12 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// A buffer class for temporarily storaging sound samples, operates as a
+/// A buffer class for temporarily storaging sound samples, operates as a
/// first-in-first-out pipe.
///
-/// Samples are added to the end of the sample buffer with the 'putSamples'
+/// Samples are added to the end of the sample buffer with the 'putSamples'
/// function, and are received from the beginning of the buffer by calling
-/// the 'receiveSamples' function. The class automatically removes the
-/// output samples from the buffer as well as grows the storage size
+/// the 'receiveSamples' function. The class automatically removes the
+/// output samples from the buffer as well as grows the storage size
/// whenever necessary.
///
/// Author : Copyright (c) Olli Parviainen
@@ -54,7 +54,7 @@ namespace soundtouch
/// Sample buffer working in FIFO (first-in-first-out) principle. The class takes
/// care of storage size adjustment and data moving during input/output operations.
///
-/// Notice that in case of stereo audio, one sample is considered to consist of
+/// Notice that in case of stereo audio, one sample is considered to consist of
/// both channel data.
class FIFOSampleBuffer : public FIFOSamplePipe
{
@@ -75,12 +75,12 @@ private:
/// Channels, 1=mono, 2=stereo.
uint channels;
- /// Current position pointer to the buffer. This pointer is increased when samples are
+ /// Current position pointer to the buffer. This pointer is increased when samples are
/// removed from the pipe so that it's necessary to actually rewind buffer (move data)
/// only new data when is put to the pipe.
uint bufferPos;
- /// Rewind the buffer by moving data from position pointed by 'bufferPos' to real
+ /// Rewind the buffer by moving data from position pointed by 'bufferPos' to real
/// beginning of the buffer.
void rewind();
@@ -89,72 +89,72 @@ private:
/// Returns current capacity.
uint getCapacity() const;
-
+
public:
/// Constructor
FIFOSampleBuffer(int numChannels = 2 ///< Number of channels, 1=mono, 2=stereo.
- ///< Default is stereo.
- );
+ ///< Default is stereo.
+ );
/// destructor
~FIFOSampleBuffer();
- /// Returns a pointer to the beginning of the output samples.
- /// This function is provided for accessing the output samples directly.
+ /// Returns a pointer to the beginning of the output samples.
+ /// This function is provided for accessing the output samples directly.
/// Please be careful for not to corrupt the book-keeping!
///
/// When using this function to output samples, also remember to 'remove' the
- /// output samples from the buffer by calling the
+ /// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
virtual SAMPLETYPE *ptrBegin();
- /// Returns a pointer to the end of the used part of the sample buffer (i.e.
- /// where the new samples are to be inserted). This function may be used for
+ /// Returns a pointer to the end of the used part of the sample buffer (i.e.
+ /// where the new samples are to be inserted). This function may be used for
/// inserting new samples into the sample buffer directly. Please be careful
/// not corrupt the book-keeping!
///
- /// When using this function as means for inserting new samples, also remember
- /// to increase the sample count afterwards, by calling the
+ /// When using this function as means for inserting new samples, also remember
+ /// to increase the sample count afterwards, by calling the
/// 'putSamples(numSamples)' function.
SAMPLETYPE *ptrEnd(
- uint slackCapacity ///< How much free capacity (in samples) there _at least_
- ///< should be so that the caller can succesfully insert the
- ///< desired samples to the buffer. If necessary, the function
- ///< grows the buffer size to comply with this requirement.
- );
+ uint slackCapacity ///< How much free capacity (in samples) there _at least_
+ ///< should be so that the caller can succesfully insert the
+ ///< desired samples to the buffer. If necessary, the function
+ ///< grows the buffer size to comply with this requirement.
+ );
/// Adds 'numSamples' pcs of samples from the 'samples' memory position to
/// the sample buffer.
virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples.
uint numSamples ///< Number of samples to insert.
- );
+ );
- /// Adjusts the book-keeping to increase number of samples in the buffer without
+ /// Adjusts the book-keeping to increase number of samples in the buffer without
/// copying any actual samples.
///
/// This function is used to update the number of samples in the sample buffer
- /// when accessing the buffer directly with 'ptrEnd' function. Please be
+ /// when accessing the buffer directly with 'ptrEnd' function. Please be
/// careful though!
virtual void putSamples(uint numSamples ///< Number of samples been inserted.
- );
+ );
- /// Output samples from beginning of the sample buffer. Copies requested samples to
- /// output buffer and removes them from the sample buffer. If there are less than
+ /// Output samples from beginning of the sample buffer. Copies requested samples to
+ /// output buffer and removes them from the sample buffer. If there are less than
/// 'numsample' samples in the buffer, returns all that available.
///
/// \return Number of samples returned.
virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples.
uint maxSamples ///< How many samples to receive at max.
- );
+ );
- /// Adjusts book-keeping so that given number of samples are removed from beginning of the
- /// sample buffer without copying them anywhere.
+ /// Adjusts book-keeping so that given number of samples are removed from beginning of the
+ /// sample buffer without copying them anywhere.
///
/// Used to reduce the number of samples in the buffer when accessing the sample buffer directly
/// with 'ptrBegin' function.
virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe.
- );
+ );
/// Returns number of samples currently available.
virtual uint numSamples() const;
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSamplePipe.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSamplePipe.h
index 017b132e8..b5fc3b779 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSamplePipe.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/FIFOSamplePipe.h
@@ -5,7 +5,7 @@
/// into one end of the pipe with the 'putSamples' function, and the processed
/// samples are received from the other end with the 'receiveSamples' function.
///
-/// 'FIFOProcessor' : A base class for classes the do signal processing with
+/// 'FIFOProcessor' : A base class for classes the do signal processing with
/// the samples while operating like a first-in-first-out pipe. When samples
/// are input with the 'putSamples' function, the class processes them
/// and moves the processed samples to the given 'output' pipe object, which
@@ -63,12 +63,12 @@ public:
virtual ~FIFOSamplePipe() {}
- /// Returns a pointer to the beginning of the output samples.
- /// This function is provided for accessing the output samples directly.
+ /// Returns a pointer to the beginning of the output samples.
+ /// This function is provided for accessing the output samples directly.
/// Please be careful for not to corrupt the book-keeping!
///
/// When using this function to output samples, also remember to 'remove' the
- /// output samples from the buffer by calling the
+ /// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
virtual SAMPLETYPE *ptrBegin() = 0;
@@ -76,12 +76,12 @@ public:
/// the sample buffer.
virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples.
uint numSamples ///< Number of samples to insert.
- ) = 0;
+ ) = 0;
// Moves samples from the 'other' pipe instance to this instance.
void moveSamples(FIFOSamplePipe &other ///< Other pipe instance where from the receive the data.
- )
+ )
{
int oNumSamples = other.numSamples();
@@ -89,22 +89,22 @@ public:
other.receiveSamples(oNumSamples);
};
- /// Output samples from beginning of the sample buffer. Copies requested samples to
- /// output buffer and removes them from the sample buffer. If there are less than
+ /// Output samples from beginning of the sample buffer. Copies requested samples to
+ /// output buffer and removes them from the sample buffer. If there are less than
/// 'numsample' samples in the buffer, returns all that available.
///
/// \return Number of samples returned.
virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples.
uint maxSamples ///< How many samples to receive at max.
- ) = 0;
+ ) = 0;
- /// Adjusts book-keeping so that given number of samples are removed from beginning of the
- /// sample buffer without copying them anywhere.
+ /// Adjusts book-keeping so that given number of samples are removed from beginning of the
+ /// sample buffer without copying them anywhere.
///
/// Used to reduce the number of samples in the buffer when accessing the sample buffer directly
/// with 'ptrBegin' function.
virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe.
- ) = 0;
+ ) = 0;
/// Returns number of samples currently available.
virtual uint numSamples() const = 0;
@@ -118,15 +118,15 @@ public:
-/// Base-class for sound processing routines working in FIFO principle. With this base
+/// Base-class for sound processing routines working in FIFO principle. With this base
/// class it's easy to implement sound processing stages that can be chained together,
-/// so that samples that are fed into beginning of the pipe automatically go through
+/// so that samples that are fed into beginning of the pipe automatically go through
/// all the processing stages.
///
-/// When samples are input to this class, they're first processed and then put to
+/// When samples are input to this class, they're first processed and then put to
/// the FIFO pipe that's defined as output of this class. This output pipe can be
/// either other processing stage or a FIFO sample buffer.
-class FIFOProcessor : public FIFOSamplePipe
+class FIFOProcessor :public FIFOSamplePipe
{
protected:
/// Internal pipe where processed samples are put.
@@ -141,7 +141,7 @@ protected:
}
- /// Constructor. Doesn't define output pipe; it has to be set be
+ /// Constructor. Doesn't define output pipe; it has to be set be
/// 'setOutPipe' function.
FIFOProcessor()
{
@@ -163,12 +163,12 @@ protected:
}
- /// Returns a pointer to the beginning of the output samples.
- /// This function is provided for accessing the output samples directly.
+ /// Returns a pointer to the beginning of the output samples.
+ /// This function is provided for accessing the output samples directly.
/// Please be careful for not to corrupt the book-keeping!
///
/// When using this function to output samples, also remember to 'remove' the
- /// output samples from the buffer by calling the
+ /// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
virtual SAMPLETYPE *ptrBegin()
{
@@ -177,26 +177,26 @@ protected:
public:
- /// Output samples from beginning of the sample buffer. Copies requested samples to
- /// output buffer and removes them from the sample buffer. If there are less than
+ /// Output samples from beginning of the sample buffer. Copies requested samples to
+ /// output buffer and removes them from the sample buffer. If there are less than
/// 'numsample' samples in the buffer, returns all that available.
///
/// \return Number of samples returned.
virtual uint receiveSamples(SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples.
uint maxSamples ///< How many samples to receive at max.
- )
+ )
{
return output->receiveSamples(outBuffer, maxSamples);
}
- /// Adjusts book-keeping so that given number of samples are removed from beginning of the
- /// sample buffer without copying them anywhere.
+ /// Adjusts book-keeping so that given number of samples are removed from beginning of the
+ /// sample buffer without copying them anywhere.
///
/// Used to reduce the number of samples in the buffer when accessing the sample buffer directly
/// with 'ptrBegin' function.
virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe.
- )
+ )
{
return output->receiveSamples(maxSamples);
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/STTypes.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/STTypes.h
index 33ff19d28..cad502ffa 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/STTypes.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/STTypes.h
@@ -43,17 +43,17 @@ typedef unsigned int uint;
typedef unsigned long ulong;
#ifdef __GNUC__
-// In GCC, include soundtouch_config.h made by config scritps
-#include "soundtouch_config.h"
+ // In GCC, include soundtouch_config.h made by config scritps
+ #include "soundtouch_config.h"
#endif
#ifndef _WINDEF_
-// if these aren't defined already by Windows headers, define now
+ // if these aren't defined already by Windows headers, define now
-typedef int BOOL;
+ typedef int BOOL;
-#define FALSE 0
-#define TRUE 1
+ #define FALSE 0
+ #define TRUE 1
#endif // _WINDEF_
@@ -61,88 +61,88 @@ typedef int BOOL;
namespace soundtouch
{
-/// Activate these undef's to overrule the possible sampletype
+/// Activate these undef's to overrule the possible sampletype
/// setting inherited from some other header file:
//#undef INTEGER_SAMPLES
//#undef FLOAT_SAMPLES
#if !(INTEGER_SAMPLES || FLOAT_SAMPLES)
-
-/// Choose either 32bit floating point or 16bit integer sampletype
-/// by choosing one of the following defines, unless this selection
-/// has already been done in some other file.
-////
-/// Notes:
-/// - In Windows environment, choose the sample format with the
-/// following defines.
-/// - In GNU environment, the floating point samples are used by
-/// default, but integer samples can be chosen by giving the
-/// following switch to the configure script:
-/// ./configure --enable-integer-samples
-/// However, if you still prefer to select the sample format here
-/// also in GNU environment, then please #undef the INTEGER_SAMPLE
-/// and FLOAT_SAMPLE defines first as in comments above.
-//#define INTEGER_SAMPLES 1 //< 16bit integer samples
-#define FLOAT_SAMPLES 1 //< 32bit float samples
-
-#endif
-
-#ifndef _WIN64
-/// Define this to allow X86-specific assembler/intrinsic optimizations.
-/// Notice that library contains also usual C++ versions of each of these
-/// these routines, so if you're having difficulties getting the optimized
-/// routines compiled for whatever reason, you may disable these optimizations
-/// to make the library compile.
-
-#define ALLOW_X86_OPTIMIZATIONS 1
-
-#endif
-
-// If defined, allows the SIMD-optimized routines to take minor shortcuts
-// for improved performance. Undefine to require faithfully similar SIMD
-// calculations as in normal C implementation.
-#define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1
-
-
-#ifdef INTEGER_SAMPLES
-// 16bit integer sample type
-typedef short SAMPLETYPE;
-// data type for sample accumulation: Use 32bit integer to prevent overflows
-typedef long LONG_SAMPLETYPE;
-
-#ifdef FLOAT_SAMPLES
-// check that only one sample type is defined
-#error "conflicting sample types defined"
-#endif // FLOAT_SAMPLES
-
-#ifdef ALLOW_X86_OPTIMIZATIONS
-// Allow MMX optimizations
-#define ALLOW_MMX 1
-#endif
-
-#else
-
-// floating point samples
-typedef float SAMPLETYPE;
-// data type for sample accumulation: Use double to utilize full precision.
-typedef double LONG_SAMPLETYPE;
-
-#ifdef ALLOW_X86_OPTIMIZATIONS
-// Allow 3DNow! and SSE optimizations
-#if WIN32
-#define ALLOW_3DNOW 1
-#endif
-
-#define ALLOW_SSE 1
-#endif
-
-#endif // INTEGER_SAMPLES
+
+ /// Choose either 32bit floating point or 16bit integer sampletype
+ /// by choosing one of the following defines, unless this selection
+ /// has already been done in some other file.
+ ////
+ /// Notes:
+ /// - In Windows environment, choose the sample format with the
+ /// following defines.
+ /// - In GNU environment, the floating point samples are used by
+ /// default, but integer samples can be chosen by giving the
+ /// following switch to the configure script:
+ /// ./configure --enable-integer-samples
+ /// However, if you still prefer to select the sample format here
+ /// also in GNU environment, then please #undef the INTEGER_SAMPLE
+ /// and FLOAT_SAMPLE defines first as in comments above.
+ //#define INTEGER_SAMPLES 1 //< 16bit integer samples
+ #define FLOAT_SAMPLES 1 //< 32bit float samples
+
+ #endif
+
+ #ifndef _WIN64
+ /// Define this to allow X86-specific assembler/intrinsic optimizations.
+ /// Notice that library contains also usual C++ versions of each of these
+ /// these routines, so if you're having difficulties getting the optimized
+ /// routines compiled for whatever reason, you may disable these optimizations
+ /// to make the library compile.
+
+ #define ALLOW_X86_OPTIMIZATIONS 1
+
+ #endif
+
+ // If defined, allows the SIMD-optimized routines to take minor shortcuts
+ // for improved performance. Undefine to require faithfully similar SIMD
+ // calculations as in normal C implementation.
+ #define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1
+
+
+ #ifdef INTEGER_SAMPLES
+ // 16bit integer sample type
+ typedef short SAMPLETYPE;
+ // data type for sample accumulation: Use 32bit integer to prevent overflows
+ typedef long LONG_SAMPLETYPE;
+
+ #ifdef FLOAT_SAMPLES
+ // check that only one sample type is defined
+ #error "conflicting sample types defined"
+ #endif // FLOAT_SAMPLES
+
+ #ifdef ALLOW_X86_OPTIMIZATIONS
+ // Allow MMX optimizations
+ #define ALLOW_MMX 1
+ #endif
+
+ #else
+
+ // floating point samples
+ typedef float SAMPLETYPE;
+ // data type for sample accumulation: Use double to utilize full precision.
+ typedef double LONG_SAMPLETYPE;
+
+ #ifdef ALLOW_X86_OPTIMIZATIONS
+ // Allow 3DNow! and SSE optimizations
+ #if WIN32
+ #define ALLOW_3DNOW 1
+ #endif
+
+ #define ALLOW_SSE 1
+ #endif
+
+ #endif // INTEGER_SAMPLES
};
-// When this #define is active, eliminates a clicking sound when the "rate" or "pitch"
-// parameter setting crosses from value <1 to >=1 or vice versa during processing.
-// Default is off as such crossover is untypical case and involves a slight sound
+// When this #define is active, eliminates a clicking sound when the "rate" or "pitch"
+// parameter setting crosses from value <1 to >=1 or vice versa during processing.
+// Default is off as such crossover is untypical case and involves a slight sound
// quality compromise.
//#define PREVENT_CLICK_AT_RATE_CROSSOVER 1
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/SoundTouch.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/SoundTouch.h
index e382faafd..0e042d3c0 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/SoundTouch.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/Include/SoundTouch.h
@@ -1,27 +1,27 @@
//////////////////////////////////////////////////////////////////////////////
///
-/// SoundTouch - main class for tempo/pitch/rate adjusting routines.
+/// SoundTouch - main class for tempo/pitch/rate adjusting routines.
///
/// Notes:
-/// - Initialize the SoundTouch object instance by setting up the sound stream
-/// parameters with functions 'setSampleRate' and 'setChannels', then set
+/// - Initialize the SoundTouch object instance by setting up the sound stream
+/// parameters with functions 'setSampleRate' and 'setChannels', then set
/// desired tempo/pitch/rate settings with the corresponding functions.
///
-/// - The SoundTouch class behaves like a first-in-first-out pipeline: The
+/// - The SoundTouch class behaves like a first-in-first-out pipeline: The
/// samples that are to be processed are fed into one of the pipe by calling
-/// function 'putSamples', while the ready processed samples can be read
+/// function 'putSamples', while the ready processed samples can be read
/// from the other end of the pipeline with function 'receiveSamples'.
-///
-/// - The SoundTouch processing classes require certain sized 'batches' of
-/// samples in order to process the sound. For this reason the classes buffer
-/// incoming samples until there are enough of samples available for
+///
+/// - The SoundTouch processing classes require certain sized 'batches' of
+/// samples in order to process the sound. For this reason the classes buffer
+/// incoming samples until there are enough of samples available for
/// processing, then they carry out the processing step and consequently
/// make the processed samples available for outputting.
-///
-/// - For the above reason, the processing routines introduce a certain
+///
+/// - For the above reason, the processing routines introduce a certain
/// 'latency' between the input and output, so that the samples input to
-/// SoundTouch may not be immediately available in the output, and neither
-/// the amount of outputtable samples may not immediately be in direct
+/// SoundTouch may not be immediately available in the output, and neither
+/// the amount of outputtable samples may not immediately be in direct
/// relationship with the amount of previously input samples.
///
/// - The tempo/pitch/rate control parameters can be altered during processing.
@@ -30,8 +30,8 @@
/// required.
///
/// - This class utilizes classes 'TDStretch' for tempo change (without modifying
-/// pitch) and 'RateTransposer' for changing the playback rate (that is, both
-/// tempo and pitch in the same ratio) of the sound. The third available control
+/// pitch) and 'RateTransposer' for changing the playback rate (that is, both
+/// tempo and pitch in the same ratio) of the sound. The third available control
/// 'pitch' (change pitch but maintain tempo) is produced by a combination of
/// combining the two other controls.
///
@@ -98,20 +98,20 @@ namespace soundtouch
/// quality compromising)
#define SETTING_USE_QUICKSEEK 2
-/// Time-stretch algorithm single processing sequence length in milliseconds. This determines
-/// to how long sequences the original sound is chopped in the time-stretch algorithm.
+/// Time-stretch algorithm single processing sequence length in milliseconds. This determines
+/// to how long sequences the original sound is chopped in the time-stretch algorithm.
/// See "STTypes.h" or README for more information.
#define SETTING_SEQUENCE_MS 3
-/// Time-stretch algorithm seeking window length in milliseconds for algorithm that finds the
-/// best possible overlapping location. This determines from how wide window the algorithm
-/// may look for an optimal joining location when mixing the sound sequences back together.
+/// Time-stretch algorithm seeking window length in milliseconds for algorithm that finds the
+/// best possible overlapping location. This determines from how wide window the algorithm
+/// may look for an optimal joining location when mixing the sound sequences back together.
/// See "STTypes.h" or README for more information.
#define SETTING_SEEKWINDOW_MS 4
-/// Time-stretch algorithm overlap length in milliseconds. When the chopped sound sequences
-/// are mixed back together, to form a continuous sound stream, this parameter defines over
-/// how long period the two consecutive sequences are let to overlap each other.
+/// Time-stretch algorithm overlap length in milliseconds. When the chopped sound sequences
+/// are mixed back together, to form a continuous sound stream, this parameter defines over
+/// how long period the two consecutive sequences are let to overlap each other.
/// See "STTypes.h" or README for more information.
#define SETTING_OVERLAP_MS 5
@@ -137,7 +137,7 @@ private:
/// Flag: Has sample rate been set?
BOOL bSrateSet;
- /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and
+ /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and
/// 'virtualPitch' parameters.
void calcEffectiveRateAndTempo();
@@ -181,7 +181,7 @@ public:
/// represent lower pitches, larger values higher pitch.
void setPitch(float newPitch);
- /// Sets pitch change in octaves compared to the original pitch
+ /// Sets pitch change in octaves compared to the original pitch
/// (-1.00 .. +1.00)
void setPitchOctaves(float newPitch);
@@ -209,11 +209,11 @@ public:
/// the input of the object. Notice that sample rate _has_to_ be set before
/// calling this function, otherwise throws a runtime_error exception.
virtual void putSamples(
- const SAMPLETYPE *samples, ///< Pointer to sample buffer.
- uint numSamples ///< Number of samples in buffer. Notice
- ///< that in case of stereo-sound a single sample
- ///< contains data for both channels.
- );
+ const SAMPLETYPE *samples, ///< Pointer to sample buffer.
+ uint numSamples ///< Number of samples in buffer. Notice
+ ///< that in case of stereo-sound a single sample
+ ///< contains data for both channels.
+ );
/// Clears all the samples in the object's output and internal processing
/// buffers.
@@ -221,18 +221,18 @@ public:
/// Changes a setting controlling the processing system behaviour. See the
/// 'SETTING_...' defines for available setting ID's.
- ///
+ ///
/// \return 'TRUE' if the setting was succesfully changed
BOOL setSetting(int settingId, ///< Setting ID number. see SETTING_... defines.
int value ///< New setting value.
- );
+ );
/// Reads a setting controlling the processing system behaviour. See the
/// 'SETTING_...' defines for available setting ID's.
///
/// \return the setting value.
int getSetting(int settingId ///< Setting ID number, see SETTING_... defines.
- ) const;
+ ) const;
/// Returns number of samples currently unprocessed.
virtual uint numUnprocessedSamples() const;
@@ -242,7 +242,7 @@ public:
/// classes 'FIFOProcessor' and 'FIFOSamplePipe')
///
/// - receiveSamples() : Use this function to receive 'ready' processed samples from SoundTouch.
- /// - numSamples() : Get number of 'ready' samples that can be received with
+ /// - numSamples() : Get number of 'ready' samples that can be received with
/// function 'receiveSamples()'
/// - isEmpty() : Returns nonzero if there aren't any 'ready' samples.
/// - clear() : Clears all samples from ready/processing buffers.
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/3dnow_win.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/3dnow_win.cpp
index 7b309a427..f0a9d7ecc 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/3dnow_win.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/3dnow_win.cpp
@@ -1,32 +1,32 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// Win32 version of the AMD 3DNow! optimized routines for AMD K6-2/Athlon
+/// Win32 version of the AMD 3DNow! optimized routines for AMD K6-2/Athlon
/// processors. All 3DNow! optimized functions have been gathered into this
-/// single source code file, regardless to their class or original source code
-/// file, in order to ease porting the library to other compiler and processor
+/// single source code file, regardless to their class or original source code
+/// file, in order to ease porting the library to other compiler and processor
/// platforms.
///
-/// By the way; the performance gain depends heavily on the CPU generation: On
-/// K6-2 these routines provided speed-up of even 2.4 times, while on Athlon the
-/// difference to the original routines stayed at unremarkable 8%! Such a small
-/// improvement on Athlon is due to 3DNow can perform only two operations in
+/// By the way; the performance gain depends heavily on the CPU generation: On
+/// K6-2 these routines provided speed-up of even 2.4 times, while on Athlon the
+/// difference to the original routines stayed at unremarkable 8%! Such a small
+/// improvement on Athlon is due to 3DNow can perform only two operations in
/// parallel, and obviously also the Athlon FPU is doing a very good job with
-/// the standard C floating point routines! Here these routines are anyway,
-/// although it might not be worth the effort to convert these to GCC platform,
-/// for Athlon CPU at least. The situation is different regarding the SSE
-/// optimizations though, thanks to the four parallel operations of SSE that
+/// the standard C floating point routines! Here these routines are anyway,
+/// although it might not be worth the effort to convert these to GCC platform,
+/// for Athlon CPU at least. The situation is different regarding the SSE
+/// optimizations though, thanks to the four parallel operations of SSE that
/// already make a difference.
-///
-/// This file is to be compiled in Windows platform with Microsoft Visual C++
+///
+/// This file is to be compiled in Windows platform with Microsoft Visual C++
/// Compiler. Please see '3dnow_gcc.cpp' for the gcc compiler version for all
/// GNU platforms (if file supplied).
///
-/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++
-/// 6.0 processor pack" update to support 3DNow! instruction set. The update is
+/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++
+/// 6.0 processor pack" update to support 3DNow! instruction set. The update is
/// available for download at Microsoft Developers Network, see here:
/// http://msdn.microsoft.com/en-us/vstudio/aa718349.aspx
///
-/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and
+/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and
/// perform a search with keywords "processor pack".
///
/// Author : Copyright (c) Olli Parviainen
@@ -73,7 +73,7 @@
using namespace soundtouch;
#ifdef ALLOW_3DNOW
-// 3DNow! routines available only with float sample type
+// 3DNow! routines available only with float sample type
//////////////////////////////////////////////////////////////////////////////
//
@@ -111,10 +111,10 @@ double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) c
}
*/
- _asm
+ _asm
{
// give prefetch hints to CPU of what data are to be needed soonish.
- // give more aggressive hints on pV1 as that changes more between different calls
+ // give more aggressive hints on pV1 as that changes more between different calls
// while pV2 stays the same.
prefetch [pV1]
prefetch [pV2]
@@ -128,7 +128,7 @@ double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) c
mov ecx, overlapLengthLocal
shr ecx, 2 // div by four
- loop1:
+ loop1:
movq mm1, [eax]
prefetch [eax + 32] // give a prefetch hint to CPU what data are to be needed soonish
pfmul mm1, [ebx]
@@ -153,7 +153,7 @@ double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) c
dec ecx
jnz loop1
- // add halfs of mm0 together and return the result.
+ // add halfs of mm0 together and return the result.
// note: mm1 is used as a dummy parameter only, we actually don't care about it's value
pfacc mm0, mm1
movd corr, mm0
@@ -202,15 +202,15 @@ void FIRFilter3DNow::setCoefficients(const float *coeffs, uint newLength, uint u
// Ensure that filter coeffs array is aligned to 16-byte boundary
delete[] filterCoeffsUnalign;
filterCoeffsUnalign = new float[2 * newLength + 4];
- filterCoeffsAlign = (float *)(((uint)filterCoeffsUnalign + 15) & (uint) - 16);
+ filterCoeffsAlign = (float *)(((uint)filterCoeffsUnalign + 15) & (uint)-16);
fDivider = (float)resultDivider;
- // rearrange the filter coefficients for mmx routines
- for(i = 0; i < newLength; i ++)
+ // rearrange the filter coefficients for mmx routines
+ for (i = 0; i < newLength; i ++)
{
filterCoeffsAlign[2 * i + 0] =
- filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider;
+ filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider;
}
}
@@ -219,7 +219,7 @@ void FIRFilter3DNow::setCoefficients(const float *coeffs, uint newLength, uint u
uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, uint numSamples) const
{
float *filterCoeffsLocal = filterCoeffsAlign;
- uint count = (numSamples - length) & (uint) - 2;
+ uint count = (numSamples - length) & (uint)-2;
uint lengthLocal = length / 4;
assert(length != 0);
@@ -239,26 +239,26 @@ uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, uint nu
suml2 = sumr2 = 0.0;
ptr = src;
filterCoeffsLocal = filterCoeffs;
- for (i = 0; i < lengthLocal; i ++)
+ for (i = 0; i < lengthLocal; i ++)
{
// unroll loop for efficiency.
- suml1 += ptr[0] * filterCoeffsLocal[0] +
+ suml1 += ptr[0] * filterCoeffsLocal[0] +
ptr[2] * filterCoeffsLocal[2] +
ptr[4] * filterCoeffsLocal[4] +
ptr[6] * filterCoeffsLocal[6];
- sumr1 += ptr[1] * filterCoeffsLocal[1] +
+ sumr1 += ptr[1] * filterCoeffsLocal[1] +
ptr[3] * filterCoeffsLocal[3] +
ptr[5] * filterCoeffsLocal[5] +
ptr[7] * filterCoeffsLocal[7];
- suml2 += ptr[8] * filterCoeffsLocal[0] +
+ suml2 += ptr[8] * filterCoeffsLocal[0] +
ptr[10] * filterCoeffsLocal[2] +
ptr[12] * filterCoeffsLocal[4] +
ptr[14] * filterCoeffsLocal[6];
- sumr2 += ptr[9] * filterCoeffsLocal[1] +
+ sumr2 += ptr[9] * filterCoeffsLocal[1] +
ptr[11] * filterCoeffsLocal[3] +
ptr[13] * filterCoeffsLocal[5] +
ptr[15] * filterCoeffsLocal[7];
@@ -283,7 +283,7 @@ uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, uint nu
mov edx, count
shr edx, 1
- loop1:
+ loop1:
// "outer loop" : during each round 2*2 output samples are calculated
prefetch [ebx] // give a prefetch hint to CPU what data are to be needed soonish
prefetch [filterCoeffsLocal] // give a prefetch hint to CPU what data are to be needed soonish
@@ -294,7 +294,7 @@ uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, uint nu
pxor mm1, mm1
mov ecx, lengthLocal
- loop2:
+ loop2:
// "inner loop" : during each round four FIR filter taps are evaluated for 2*2 output samples
movq mm2, [edi]
movq mm3, mm2
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.cpp
index fc7ff4716..96abda49c 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.cpp
@@ -1,9 +1,9 @@
////////////////////////////////////////////////////////////////////////////////
///
/// FIR low-pass (anti-alias) filter with filter coefficient design routine and
-/// MMX optimization.
-///
-/// Anti-alias filter is used to prevent folding of high frequencies when
+/// MMX optimization.
+///
+/// Anti-alias filter is used to prevent folding of high frequencies when
/// transposing the sample rate with interpolation.
///
/// Author : Copyright (c) Olli Parviainen
@@ -98,7 +98,7 @@ void AAFilter::setLength(uint newLength)
void AAFilter::calculateCoeffs()
{
uint i;
- double cntTemp, temp, tempCoeff, h, w;
+ double cntTemp, temp, tempCoeff,h, w;
double fc2, wc;
double scaleCoeff, sum;
double *work;
@@ -112,21 +112,21 @@ void AAFilter::calculateCoeffs()
work = new double[length];
coeffs = new SAMPLETYPE[length];
- fc2 = 2.0 * cutoffFreq;
+ fc2 = 2.0 * cutoffFreq;
wc = PI * fc2;
tempCoeff = TWOPI / (double)length;
sum = 0;
- for(i = 0; i < length; i ++)
+ for (i = 0; i < length; i ++)
{
cntTemp = (double)i - (double)(length / 2);
temp = cntTemp * wc;
- if(temp != 0)
+ if (temp != 0)
{
h = fc2 * sin(temp) / temp; // sinc function
- }
- else
+ }
+ else
{
h = 1.0;
}
@@ -135,7 +135,7 @@ void AAFilter::calculateCoeffs()
temp = w * h;
work[i] = temp;
- // calc net sum of coefficients
+ // calc net sum of coefficients
sum += temp;
}
@@ -151,7 +151,7 @@ void AAFilter::calculateCoeffs()
// divided by 16384
scaleCoeff = 16384.0f / sum;
- for(i = 0; i < length; i ++)
+ for (i = 0; i < length; i ++)
{
// scale & round to nearest integer
temp = work[i] * scaleCoeff;
@@ -169,8 +169,8 @@ void AAFilter::calculateCoeffs()
}
-// Applies the filter to the given sequence of samples.
-// Note : The amount of outputted samples is by value of 'filter length'
+// Applies the filter to the given sequence of samples.
+// Note : The amount of outputted samples is by value of 'filter length'
// smaller than the amount of input samples.
uint AAFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples, uint numChannels) const
{
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.h
index e17b08c72..d5c8ce4ca 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/AAFilter.h
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
-/// while maintaining the original pitch by using a time domain WSOLA-like method
+/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
+/// while maintaining the original pitch by using a time domain WSOLA-like method
/// with several performance-increasing tweaks.
///
-/// Anti-alias filter is used to prevent folding of high frequencies when
+/// Anti-alias filter is used to prevent folding of high frequencies when
/// transposing the sample rate with interpolation.
///
/// Author : Copyright (c) Olli Parviainen
@@ -67,8 +67,8 @@ public:
~AAFilter();
- /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling
- /// frequency (nyquist frequency = 0.5). The filter will cut off the
+ /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling
+ /// frequency (nyquist frequency = 0.5). The filter will cut off the
/// frequencies than that.
void setCutoffFreq(double newCutoffFreq);
@@ -77,12 +77,12 @@ public:
uint getLength() const;
- /// Applies the filter to the given sequence of samples.
- /// Note : The amount of outputted samples is by value of 'filter length'
+ /// Applies the filter to the given sequence of samples.
+ /// Note : The amount of outputted samples is by value of 'filter length'
/// smaller than the amount of input samples.
- uint evaluate(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples,
+ uint evaluate(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples,
uint numChannels) const;
};
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/BPMDetect.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/BPMDetect.cpp
index bae075e6d..405f514bf 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/BPMDetect.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/BPMDetect.cpp
@@ -14,10 +14,10 @@
/// taking absolute value that's smoothed by sliding average. Signal levels that
/// are below a couple of times the general RMS amplitude level are cut away to
/// leave only notable peaks there.
-/// - Repeating sound patterns (e.g. beats) are detected by calculating short-term
+/// - Repeating sound patterns (e.g. beats) are detected by calculating short-term
/// autocorrelation function of the enveloped signal.
-/// - After whole sound data file has been analyzed as above, the bpm level is
-/// detected by function 'getBpm' that finds the highest peak of the autocorrelation
+/// - After whole sound data file has been analyzed as above, the bpm level is
+/// detected by function 'getBpm' that finds the highest peak of the autocorrelation
/// function, calculates it's precise location and converts this reading to bpm's.
///
/// Author : Copyright (c) Olli Parviainen
@@ -66,7 +66,7 @@ using namespace soundtouch;
#define INPUT_BLOCK_SAMPLES 2048
#define DECIMATED_BLOCK_SAMPLES 256
-/// decay constant for calculating RMS volume sliding average approximation
+/// decay constant for calculating RMS volume sliding average approximation
/// (time constant is about 10 sec)
const float avgdecay = 0.99986f;
@@ -128,16 +128,16 @@ BPMDetect::~BPMDetect()
-/// convert to mono, low-pass filter & decimate to about 500 Hz.
+/// convert to mono, low-pass filter & decimate to about 500 Hz.
/// return number of outputted samples.
///
-/// Decimation is used to remove the unnecessary frequencies and thus to reduce
-/// the amount of data needed to be processed as calculating autocorrelation
+/// Decimation is used to remove the unnecessary frequencies and thus to reduce
+/// the amount of data needed to be processed as calculating autocorrelation
/// function is a very-very heavy operation.
///
-/// Anti-alias filtering is done simply by averaging the samples. This is really a
+/// Anti-alias filtering is done simply by averaging the samples. This is really a
/// poor-man's anti-alias filtering, but it's not so critical in this kind of application
-/// (it'd also be difficult to design a high-quality filter with steep cut-off at very
+/// (it'd also be difficult to design a high-quality filter with steep cut-off at very
/// narrow band)
int BPMDetect::decimate(SAMPLETYPE *dest, const SAMPLETYPE *src, int numsamples)
{
@@ -147,19 +147,19 @@ int BPMDetect::decimate(SAMPLETYPE *dest, const SAMPLETYPE *src, int numsamples)
assert(channels > 0);
assert(decimateBy > 0);
outcount = 0;
- for(count = 0; count < numsamples; count ++)
+ for (count = 0; count < numsamples; count ++)
{
int j;
// convert to mono and accumulate
- for(j = 0; j < channels; j ++)
+ for (j = 0; j < channels; j ++)
{
decimateSum += src[j];
}
src += j;
decimateCount ++;
- if(decimateCount >= decimateBy)
+ if (decimateCount >= decimateBy)
{
// Store every Nth sample only
out = (LONG_SAMPLETYPE)(decimateSum / (decimateBy * channels));
@@ -167,11 +167,11 @@ int BPMDetect::decimate(SAMPLETYPE *dest, const SAMPLETYPE *src, int numsamples)
decimateCount = 0;
#ifdef INTEGER_SAMPLES
// check ranges for sure (shouldn't actually be necessary)
- if(out > 32767)
+ if (out > 32767)
{
out = 32767;
- }
- else if(out < -32768)
+ }
+ else if (out < -32768)
{
out = -32768;
}
@@ -190,25 +190,25 @@ void BPMDetect::updateXCorr(int process_samples)
{
int offs;
SAMPLETYPE *pBuffer;
-
+
assert(buffer->numSamples() >= (uint)(process_samples + windowLen));
pBuffer = buffer->ptrBegin();
- for(offs = windowStart; offs < windowLen; offs ++)
+ for (offs = windowStart; offs < windowLen; offs ++)
{
LONG_SAMPLETYPE sum;
int i;
sum = 0;
- for(i = 0; i < process_samples; i ++)
+ for (i = 0; i < process_samples; i ++)
{
sum += pBuffer[i] * pBuffer[i + offs]; // scaling the sub-result shouldn't be necessary
}
-// xcorr[offs] *= xcorr_decay; // decay 'xcorr' here with suitable coefficients
- // if it's desired that the system adapts automatically to
- // various bpms, e.g. in processing continouos music stream.
- // The 'xcorr_decay' should be a value that's smaller than but
- // close to one, and should also depend on 'process_samples' value.
+// xcorr[offs] *= xcorr_decay; // decay 'xcorr' here with suitable coefficients
+ // if it's desired that the system adapts automatically to
+ // various bpms, e.g. in processing continouos music stream.
+ // The 'xcorr_decay' should be a value that's smaller than but
+ // close to one, and should also depend on 'process_samples' value.
xcorr[offs] += (float)sum;
}
@@ -217,7 +217,7 @@ void BPMDetect::updateXCorr(int process_samples)
// Calculates envelope of the sample data
-void BPMDetect::calcEnvelope(SAMPLETYPE *samples, int numsamples)
+void BPMDetect::calcEnvelope(SAMPLETYPE *samples, int numsamples)
{
const float decay = 0.7f; // decay constant for smoothing the envelope
const float norm = (1 - decay);
@@ -226,7 +226,7 @@ void BPMDetect::calcEnvelope(SAMPLETYPE *samples, int numsamples)
LONG_SAMPLETYPE out;
float val;
- for(i = 0; i < numsamples; i ++)
+ for (i = 0; i < numsamples; i ++)
{
// calc average RMS volume
RMSVolumeAccu *= avgdecay;
@@ -245,7 +245,7 @@ void BPMDetect::calcEnvelope(SAMPLETYPE *samples, int numsamples)
#ifdef INTEGER_SAMPLES
// cut peaks (shouldn't be necessary though)
- if(out > 32767) out = 32767;
+ if (out > 32767) out = 32767;
#endif // INTEGER_SAMPLES
samples[i] = (SAMPLETYPE)out;
}
@@ -258,7 +258,7 @@ void BPMDetect::inputSamples(const SAMPLETYPE *samples, int numSamples)
SAMPLETYPE decimated[DECIMATED_BLOCK_SAMPLES];
// iterate so that max INPUT_BLOCK_SAMPLES processed per iteration
- while(numSamples > 0)
+ while (numSamples > 0)
{
int block;
int decSamples;
@@ -276,7 +276,7 @@ void BPMDetect::inputSamples(const SAMPLETYPE *samples, int numSamples)
}
// when the buffer has enought samples for processing...
- if((int)buffer->numSamples() > windowLen)
+ if ((int)buffer->numSamples() > windowLen)
{
int processLength;
@@ -301,7 +301,7 @@ float BPMDetect::getBpm()
peakPos = peakFinder.detectPeak(xcorr, windowStart, windowLen);
assert(decimateBy != 0);
- if(peakPos < 1e-6) return 0.0; // detection failed.
+ if (peakPos < 1e-6) return 0.0; // detection failed.
// calculate BPM
return (float)(60.0 * (((double)sampleRate / (double)decimateBy) / peakPos));
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIFOSampleBuffer.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIFOSampleBuffer.cpp
index 1e467a12c..01f64b083 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIFOSampleBuffer.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIFOSampleBuffer.cpp
@@ -1,12 +1,12 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// A buffer class for temporarily storaging sound samples, operates as a
+/// A buffer class for temporarily storaging sound samples, operates as a
/// first-in-first-out pipe.
///
-/// Samples are added to the end of the sample buffer with the 'putSamples'
+/// Samples are added to the end of the sample buffer with the 'putSamples'
/// function, and are received from the beginning of the buffer by calling
-/// the 'receiveSamples' function. The class automatically removes the
-/// outputted samples from the buffer, as well as grows the buffer size
+/// the 'receiveSamples' function. The class automatically removes the
+/// outputted samples from the buffer, as well as grows the buffer size
/// whenever necessary.
///
/// Author : Copyright (c) Olli Parviainen
@@ -63,7 +63,7 @@ FIFOSampleBuffer::FIFOSampleBuffer(int numChannels)
samplesInBuffer = 0;
bufferPos = 0;
channels = (uint)numChannels;
- ensureCapacity(32); // allocate initial capacity
+ ensureCapacity(32); // allocate initial capacity
}
@@ -89,11 +89,11 @@ void FIFOSampleBuffer::setChannels(int numChannels)
// if output location pointer 'bufferPos' isn't zero, 'rewinds' the buffer and
-// zeroes this pointer by copying samples from the 'bufferPos' pointer
+// zeroes this pointer by copying samples from the 'bufferPos' pointer
// location on to the beginning of the buffer.
void FIFOSampleBuffer::rewind()
{
- if(buffer && bufferPos)
+ if (buffer && bufferPos)
{
memmove(buffer, ptrBegin(), sizeof(SAMPLETYPE) * channels * samplesInBuffer);
bufferPos = 0;
@@ -101,7 +101,7 @@ void FIFOSampleBuffer::rewind()
}
-// Adds 'numSamples' pcs of samples from the 'samples' memory position to
+// Adds 'numSamples' pcs of samples from the 'samples' memory position to
// the sample buffer.
void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint nSamples)
{
@@ -114,7 +114,7 @@ void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint nSamples)
// samples.
//
// This function is used to update the number of samples in the sample buffer
-// when accessing the buffer directly with 'ptrEnd' function. Please be
+// when accessing the buffer directly with 'ptrEnd' function. Please be
// careful though!
void FIFOSampleBuffer::putSamples(uint nSamples)
{
@@ -126,31 +126,31 @@ void FIFOSampleBuffer::putSamples(uint nSamples)
}
-// Returns a pointer to the end of the used part of the sample buffer (i.e.
-// where the new samples are to be inserted). This function may be used for
-// inserting new samples into the sample buffer directly. Please be careful!
+// Returns a pointer to the end of the used part of the sample buffer (i.e.
+// where the new samples are to be inserted). This function may be used for
+// inserting new samples into the sample buffer directly. Please be careful!
//
// Parameter 'slackCapacity' tells the function how much free capacity (in
// terms of samples) there _at least_ should be, in order to the caller to
-// succesfully insert all the required samples to the buffer. When necessary,
+// succesfully insert all the required samples to the buffer. When necessary,
// the function grows the buffer size to comply with this requirement.
//
-// When using this function as means for inserting new samples, also remember
-// to increase the sample count afterwards, by calling the
+// When using this function as means for inserting new samples, also remember
+// to increase the sample count afterwards, by calling the
// 'putSamples(numSamples)' function.
-SAMPLETYPE *FIFOSampleBuffer::ptrEnd(uint slackCapacity)
+SAMPLETYPE *FIFOSampleBuffer::ptrEnd(uint slackCapacity)
{
ensureCapacity(samplesInBuffer + slackCapacity);
return buffer + samplesInBuffer * channels;
}
-// Returns a pointer to the beginning of the currently non-outputted samples.
-// This function is provided for accessing the output samples directly.
+// Returns a pointer to the beginning of the currently non-outputted samples.
+// This function is provided for accessing the output samples directly.
// Please be careful!
//
// When using this function to output samples, also remember to 'remove' the
-// outputted samples from the buffer by calling the
+// outputted samples from the buffer by calling the
// 'receiveSamples(numSamples)' function
SAMPLETYPE *FIFOSampleBuffer::ptrBegin()
{
@@ -167,19 +167,19 @@ void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement)
{
SAMPLETYPE *tempUnaligned, *temp;
- if(capacityRequirement > getCapacity())
+ if (capacityRequirement > getCapacity())
{
// enlarge the buffer in 4kbyte steps (round up to next 4k boundary)
- sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & (uint) - 4096;
+ sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & (uint)-4096;
assert(sizeInBytes % 2 == 0);
tempUnaligned = new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE) + 16 / sizeof(SAMPLETYPE)];
- if(tempUnaligned == NULL)
+ if (tempUnaligned == NULL)
{
throw std::runtime_error("Couldn't allocate memory!\n");
}
// Align the buffer to begin at 16byte cache line boundary for optimal performance
- temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong) - 16);
- if(samplesInBuffer)
+ temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
+ if (samplesInBuffer)
{
memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE));
}
@@ -187,8 +187,8 @@ void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement)
buffer = temp;
bufferUnaligned = tempUnaligned;
bufferPos = 0;
- }
- else
+ }
+ else
{
// simply rewind the buffer (if necessary)
rewind();
@@ -231,7 +231,7 @@ uint FIFOSampleBuffer::receiveSamples(SAMPLETYPE *output, uint maxSamples)
// the sample buffer with the 'ptrBegin' function.
uint FIFOSampleBuffer::receiveSamples(uint maxSamples)
{
- if(maxSamples >= samplesInBuffer)
+ if (maxSamples >= samplesInBuffer)
{
uint temp;
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp
index 8cc0635f8..159df256d 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.cpp
@@ -1,8 +1,8 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// General FIR digital filter routines with MMX optimization.
+/// General FIR digital filter routines with MMX optimization.
///
-/// Note : MMX optimized functions reside in a separate, platform-specific file,
+/// Note : MMX optimized functions reside in a separate, platform-specific file,
/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp'
///
/// Author : Copyright (c) Olli Parviainen
@@ -88,14 +88,14 @@ uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, ui
end = 2 * (numSamples - length);
- for(j = 0; j < end; j += 2)
+ for (j = 0; j < end; j += 2)
{
const SAMPLETYPE *ptr;
suml = sumr = 0;
ptr = src + j;
- for(i = 0; i < length; i += 4)
+ for (i = 0; i < length; i += 4)
{
// loop is unrolled by factor of 4 here for efficiency
suml += ptr[2 * i + 0] * filterCoeffs[i + 0] +
@@ -143,15 +143,15 @@ uint FIRFilter::evaluateFilterMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint
assert(length != 0);
end = numSamples - length;
- for(j = 0; j < end; j ++)
+ for (j = 0; j < end; j ++)
{
sum = 0;
- for(i = 0; i < length; i += 4)
+ for (i = 0; i < length; i += 4)
{
// loop is unrolled by factor of 4 here for efficiency
- sum += src[i + 0] * filterCoeffs[i + 0] +
- src[i + 1] * filterCoeffs[i + 1] +
- src[i + 2] * filterCoeffs[i + 2] +
+ sum += src[i + 0] * filterCoeffs[i + 0] +
+ src[i + 1] * filterCoeffs[i + 1] +
+ src[i + 2] * filterCoeffs[i + 2] +
src[i + 3] * filterCoeffs[i + 3];
}
#ifdef INTEGER_SAMPLES
@@ -174,7 +174,7 @@ uint FIRFilter::evaluateFilterMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint
void FIRFilter::setCoefficients(const SAMPLETYPE *coeffs, uint newLength, uint uResultDivFactor)
{
assert(newLength > 0);
- if(newLength % 8) throw std::runtime_error("FIR filter length not divisible by 8");
+ if (newLength % 8) throw std::runtime_error("FIR filter length not divisible by 8");
lengthDiv8 = newLength / 8;
length = lengthDiv8 * 8;
@@ -196,9 +196,9 @@ uint FIRFilter::getLength() const
-// Applies the filter to the given sequence of samples.
+// Applies the filter to the given sequence of samples.
//
-// Note : The amount of outputted samples is by value of 'filter_length'
+// Note : The amount of outputted samples is by value of 'filter_length'
// smaller than the amount of input samples.
uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples, uint numChannels) const
{
@@ -206,20 +206,18 @@ uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSample
assert(length > 0);
assert(lengthDiv8 * 8 == length);
- if(numSamples < length) return 0;
- if(numChannels == 2)
+ if (numSamples < length) return 0;
+ if (numChannels == 2)
{
return evaluateFilterStereo(dest, src, numSamples);
- }
- else
- {
+ } else {
return evaluateFilterMono(dest, src, numSamples);
}
}
-// Operator 'new' is overloaded so that it automatically creates a suitable instance
+// Operator 'new' is overloaded so that it automatically creates a suitable instance
// depending on if we've a MMX-capable CPU available or not.
void * FIRFilter::operator new(size_t s)
{
@@ -240,7 +238,7 @@ FIRFilter * FIRFilter::newInstance()
#ifdef ALLOW_MMX
// MMX routines available only with integer sample types
- if(uExtensions & SUPPORT_MMX)
+ if (uExtensions & SUPPORT_MMX)
{
return ::new FIRFilterMMX;
}
@@ -248,27 +246,27 @@ FIRFilter * FIRFilter::newInstance()
#endif // ALLOW_MMX
#ifdef ALLOW_SSE
- if(uExtensions & SUPPORT_SSE)
- {
- // SSE support
- return ::new FIRFilterSSE;
- }
- else
+ if (uExtensions & SUPPORT_SSE)
+ {
+ // SSE support
+ return ::new FIRFilterSSE;
+ }
+ else
#endif // ALLOW_SSE
#ifdef ALLOW_3DNOW
- if(uExtensions & SUPPORT_3DNOW)
- {
- // 3DNow! support
- return ::new FIRFilter3DNow;
- }
- else
+ if (uExtensions & SUPPORT_3DNOW)
+ {
+ // 3DNow! support
+ return ::new FIRFilter3DNow;
+ }
+ else
#endif // ALLOW_3DNOW
#endif // _WIN64
- {
- // ISA optimizations not supported, use plain C version
- return ::new FIRFilter;
- }
+ {
+ // ISA optimizations not supported, use plain C version
+ return ::new FIRFilter;
+ }
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.h
index 2458131d1..5713f7bb2 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/FIRFilter.h
@@ -1,8 +1,8 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// General FIR digital filter routines with MMX optimization.
+/// General FIR digital filter routines with MMX optimization.
///
-/// Note : MMX optimized functions reside in a separate, platform-specific file,
+/// Note : MMX optimized functions reside in a separate, platform-specific file,
/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp'
///
/// Author : Copyright (c) Olli Parviainen
@@ -48,11 +48,11 @@
namespace soundtouch
{
-class FIRFilter
+class FIRFilter
{
protected:
// Number of FIR filter taps
- uint length;
+ uint length;
// Number of FIR filter taps divided by 8
uint lengthDiv8;
@@ -65,37 +65,37 @@ protected:
// Memory for filter coefficients
SAMPLETYPE *filterCoeffs;
- virtual uint evaluateFilterStereo(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
+ virtual uint evaluateFilterStereo(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
uint numSamples) const;
- virtual uint evaluateFilterMono(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
+ virtual uint evaluateFilterMono(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
uint numSamples) const;
public:
FIRFilter();
virtual ~FIRFilter();
- /// Operator 'new' is overloaded so that it automatically creates a suitable instance
+ /// Operator 'new' is overloaded so that it automatically creates a suitable instance
/// depending on if we've a MMX-capable CPU available or not.
static void * operator new(size_t s);
static FIRFilter *newInstance();
- /// Applies the filter to the given sequence of samples.
- /// Note : The amount of outputted samples is by value of 'filter_length'
+ /// Applies the filter to the given sequence of samples.
+ /// Note : The amount of outputted samples is by value of 'filter_length'
/// smaller than the amount of input samples.
///
/// \return Number of samples copied to 'dest'.
- uint evaluate(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples,
+ uint evaluate(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples,
uint numChannels) const;
uint getLength() const;
- virtual void setCoefficients(const SAMPLETYPE *coeffs,
- uint newLength,
+ virtual void setCoefficients(const SAMPLETYPE *coeffs,
+ uint newLength,
uint uResultDivFactor);
};
@@ -105,57 +105,57 @@ public:
#ifdef ALLOW_MMX
/// Class that implements MMX optimized functions exclusive for 16bit integer samples type.
-class FIRFilterMMX : public FIRFilter
-{
-protected:
- short *filterCoeffsUnalign;
- short *filterCoeffsAlign;
+ class FIRFilterMMX : public FIRFilter
+ {
+ protected:
+ short *filterCoeffsUnalign;
+ short *filterCoeffsAlign;
- virtual uint evaluateFilterStereo(short *dest, const short *src, uint numSamples) const;
-public:
- FIRFilterMMX();
- ~FIRFilterMMX();
+ virtual uint evaluateFilterStereo(short *dest, const short *src, uint numSamples) const;
+ public:
+ FIRFilterMMX();
+ ~FIRFilterMMX();
- virtual void setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor);
-};
+ virtual void setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor);
+ };
#endif // ALLOW_MMX
#ifdef ALLOW_3DNOW
-/// Class that implements 3DNow! optimized functions exclusive for floating point samples type.
-class FIRFilter3DNow : public FIRFilter
-{
-protected:
- float *filterCoeffsUnalign;
- float *filterCoeffsAlign;
+ /// Class that implements 3DNow! optimized functions exclusive for floating point samples type.
+ class FIRFilter3DNow : public FIRFilter
+ {
+ protected:
+ float *filterCoeffsUnalign;
+ float *filterCoeffsAlign;
- virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const;
-public:
- FIRFilter3DNow();
- ~FIRFilter3DNow();
- virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor);
-};
+ virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const;
+ public:
+ FIRFilter3DNow();
+ ~FIRFilter3DNow();
+ virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor);
+ };
#endif // ALLOW_3DNOW
#ifdef ALLOW_SSE
-/// Class that implements SSE optimized functions exclusive for floating point samples type.
-class FIRFilterSSE : public FIRFilter
-{
-protected:
- float *filterCoeffsUnalign;
- float *filterCoeffsAlign;
-
- virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const;
-public:
- FIRFilterSSE();
- ~FIRFilterSSE();
-
- virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor);
-};
+ /// Class that implements SSE optimized functions exclusive for floating point samples type.
+ class FIRFilterSSE : public FIRFilter
+ {
+ protected:
+ float *filterCoeffsUnalign;
+ float *filterCoeffsAlign;
+
+ virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const;
+ public:
+ FIRFilterSSE();
+ ~FIRFilterSSE();
+
+ virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor);
+ };
#endif // ALLOW_SSE
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.cpp
index 2df0e10fc..03f60bfa9 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.cpp
@@ -1,8 +1,8 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// Peak detection routine.
+/// Peak detection routine.
///
-/// The routine detects highest value on an array of values and calculates the
+/// The routine detects highest value on an array of values and calculates the
/// precise peak location as a mass-center of the 'hump' around the peak value.
///
/// Author : Copyright (c) Olli Parviainen
@@ -56,7 +56,7 @@ PeakFinder::PeakFinder()
// Finds 'ground level' of a peak hump by starting from 'peakpos' and proceeding
-// to direction defined by 'direction' until next 'hump' after minimum value will
+// to direction defined by 'direction' until next 'hump' after minimum value will
// begin
int PeakFinder::findGround(const float *data, int peakpos, int direction) const
{
@@ -72,7 +72,7 @@ int PeakFinder::findGround(const float *data, int peakpos, int direction) const
pos = peakpos;
- while((pos > minPos) && (pos < maxPos))
+ while ((pos > minPos) && (pos < maxPos))
{
int prevpos;
@@ -81,16 +81,16 @@ int PeakFinder::findGround(const float *data, int peakpos, int direction) const
// calculate derivate
delta = data[pos] - data[prevpos];
- if(delta <= 0)
+ if (delta <= 0)
{
// going downhill, ok
- if(climb_count)
+ if (climb_count)
{
climb_count --; // decrease climb count
}
// check if new minimum found
- if(data[pos] < refvalue)
+ if (data[pos] < refvalue)
{
// new minimum found
lowpos = pos;
@@ -101,7 +101,7 @@ int PeakFinder::findGround(const float *data, int peakpos, int direction) const
{
// going uphill, increase climbing counter
climb_count ++;
- if(climb_count > 5) break; // we've been climbing too long => it's next uphill => quit
+ if (climb_count > 5) break; // we've been climbing too long => it's next uphill => quit
}
}
return lowpos;
@@ -118,9 +118,9 @@ int PeakFinder::findCrossingLevel(const float *data, float level, int peakpos, i
peaklevel = data[peakpos];
assert(peaklevel >= level);
pos = peakpos;
- while((pos >= minPos) && (pos < maxPos))
+ while ((pos >= minPos) && (pos < maxPos))
{
- if(data[pos + direction] < level) return pos; // crossing found
+ if (data[pos + direction] < level) return pos; // crossing found
pos += direction;
}
return -1; // not found
@@ -136,13 +136,13 @@ double PeakFinder::calcMassCenter(const float *data, int firstPos, int lastPos)
sum = 0;
wsum = 0;
- for(i = firstPos; i <= lastPos; i ++)
+ for (i = firstPos; i <= lastPos; i ++)
{
sum += (float)i * data[i];
wsum += data[i];
}
- if(wsum < 1e-6) return 0;
+ if (wsum < 1e-6) return 0;
return sum / wsum;
}
@@ -164,8 +164,8 @@ double PeakFinder::getPeakCenter(const float *data, int peakpos) const
groundLevel = max(data[gp1], data[gp2]);
peakLevel = data[peakpos];
- if(groundLevel < 1e-6) return 0; // ground level too small => detection failed
- if((peakLevel / groundLevel) < 1.3) return 0; // peak less than 30% of the ground level => no good peak detected
+ if (groundLevel < 1e-6) return 0; // ground level too small => detection failed
+ if ((peakLevel / groundLevel) < 1.3) return 0; // peak less than 30% of the ground level => no good peak detected
// calculate 70%-level of the peak
cutLevel = 0.70f * peakLevel + 0.30f * groundLevel;
@@ -173,7 +173,7 @@ double PeakFinder::getPeakCenter(const float *data, int peakpos) const
crosspos1 = findCrossingLevel(data, cutLevel, peakpos, -1);
crosspos2 = findCrossingLevel(data, cutLevel, peakpos, 1);
- if((crosspos1 < 0) || (crosspos2 < 0)) return 0; // no crossing, no peak..
+ if ((crosspos1 < 0) || (crosspos2 < 0)) return 0; // no crossing, no peak..
// calculate mass center of the peak surroundings
return calcMassCenter(data, crosspos1, crosspos2);
@@ -181,7 +181,7 @@ double PeakFinder::getPeakCenter(const float *data, int peakpos) const
-double PeakFinder::detectPeak(const float *data, int aminPos, int amaxPos)
+double PeakFinder::detectPeak(const float *data, int aminPos, int amaxPos)
{
int i;
@@ -194,29 +194,29 @@ double PeakFinder::detectPeak(const float *data, int aminPos, int amaxPos)
// find absolute peak
peakpos = minPos;
peak = data[minPos];
- for(i = minPos + 1; i < maxPos; i ++)
+ for (i = minPos + 1; i < maxPos; i ++)
{
- if(data[i] > peak)
+ if (data[i] > peak)
{
peak = data[i];
peakpos = i;
}
}
-
+
// Calculate exact location of the highest peak mass center
highPeak = getPeakCenter(data, peakpos);
peak = highPeak;
- // Now check if the highest peak were in fact harmonic of the true base beat peak
- // - sometimes the highest peak can be Nth harmonic of the true base peak yet
+ // Now check if the highest peak were in fact harmonic of the true base beat peak
+ // - sometimes the highest peak can be Nth harmonic of the true base peak yet
// just a slightly higher than the true base
- for(i = 2; i < 10; i ++)
+ for (i = 2; i < 10; i ++)
{
double peaktmp, tmp;
- int i1, i2;
+ int i1,i2;
peakpos = (int)(highPeak / (double)i + 0.5f);
- if(peakpos < minPos) break;
+ if (peakpos < minPos) break;
// calculate mass-center of possible base peak
peaktmp = getPeakCenter(data, peakpos);
@@ -225,7 +225,7 @@ double PeakFinder::detectPeak(const float *data, int aminPos, int amaxPos)
i1 = (int)(highPeak + 0.5);
i2 = (int)(peaktmp + 0.5);
tmp = 2 * (data[i2] - data[i1]) / (data[i2] + data[i1]);
- if(fabs(tmp) < 0.1)
+ if (fabs(tmp) < 0.1)
{
// The highest peak is harmonic of almost as high base peak,
// thus use the base peak instead
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.h
index c72ec033d..e3640cc6d 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/PeakFinder.h
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// The routine detects highest value on an array of values and calculates the
+/// The routine detects highest value on an array of values and calculates the
/// precise peak location as a mass-center of the 'hump' around the peak value.
///
/// Author : Copyright (c) Olli Parviainen
@@ -51,8 +51,8 @@ protected:
/// Calculates the mass center between given vector items.
double calcMassCenter(const float *data, ///< Data vector.
- int firstPos, ///< Index of first vector item beloging to the peak.
- int lastPos ///< Index of last vector item beloging to the peak.
+ int firstPos, ///< Index of first vector item beloging to the peak.
+ int lastPos ///< Index of last vector item beloging to the peak.
) const;
/// Finds the data vector index where the monotoniously decreasing signal crosses the
@@ -61,20 +61,20 @@ protected:
float level, ///< Goal crossing level.
int peakpos, ///< Peak position index within the data vector.
int direction /// Direction where to proceed from the peak: 1 = right, -1 = left.
- ) const;
+ ) const;
- /// Finds the 'ground' level, i.e. smallest level between two neighbouring peaks, to right-
+ /// Finds the 'ground' level, i.e. smallest level between two neighbouring peaks, to right-
/// or left-hand side of the given peak position.
int findGround(const float *data, /// Data vector.
int peakpos, /// Peak position index within the data vector.
int direction /// Direction where to proceed from the peak: 1 = right, -1 = left.
- ) const;
+ ) const;
/// get exact center of peak near given position by calculating local mass of center
double getPeakCenter(const float *data, int peakpos) const;
public:
- /// Constructor.
+ /// Constructor.
PeakFinder();
/// Detect exact peak position of the data vector by finding the largest peak 'hump'
@@ -82,9 +82,9 @@ public:
///
/// \return The location of the largest base harmonic peak hump.
double detectPeak(const float *data, /// Data vector to be analyzed. The data vector has
- /// to be at least 'maxPos' items long.
- int minPos, ///< Min allowed peak location within the vector data.
- int maxPos ///< Max allowed peak location within the vector data.
+ /// to be at least 'maxPos' items long.
+ int minPos, ///< Min allowed peak location within the vector data.
+ int maxPos ///< Max allowed peak location within the vector data.
);
};
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp
index f8dc7915d..7e0b277d6 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.cpp
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
-///
-/// Sample rate transposer. Changes sample rate by using linear interpolation
+///
+/// Sample rate transposer. Changes sample rate by using linear interpolation
/// together with anti-alias filtering (first order interpolation with anti-
/// alias filtering should be quite adequate for this application)
///
@@ -61,18 +61,18 @@ protected:
virtual void resetRegisters();
- virtual uint transposeStereo(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples);
- virtual uint transposeMono(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples);
+ virtual uint transposeStereo(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples);
+ virtual uint transposeMono(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples);
public:
RateTransposerInteger();
virtual ~RateTransposerInteger();
- /// Sets new target rate. Normal rate = 1.0, smaller values represent slower
+ /// Sets new target rate. Normal rate = 1.0, smaller values represent slower
/// rate, larger faster rates.
virtual void setRate(float newRate);
@@ -89,12 +89,12 @@ protected:
virtual void resetRegisters();
- virtual uint transposeStereo(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples);
- virtual uint transposeMono(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples);
+ virtual uint transposeStereo(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples);
+ virtual uint transposeMono(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples);
public:
RateTransposerFloat();
@@ -104,7 +104,7 @@ public:
-// Operator 'new' is overloaded so that it automatically creates a suitable instance
+// Operator 'new' is overloaded so that it automatically creates a suitable instance
// depending on if we've a MMX/SSE/etc-capable CPU available or not.
void * RateTransposer::operator new(size_t s)
{
@@ -165,7 +165,7 @@ AAFilter *RateTransposer::getAAFilter()
-// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower
+// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower
// iRate, larger faster iRates.
void RateTransposer::setRate(float newRate)
{
@@ -174,11 +174,11 @@ void RateTransposer::setRate(float newRate)
fRate = newRate;
// design a new anti-alias filter
- if(newRate > 1.0f)
+ if (newRate > 1.0f)
{
fCutoff = 0.5f / newRate;
- }
- else
+ }
+ else
{
fCutoff = 0.5f * newRate;
}
@@ -220,7 +220,7 @@ void RateTransposer::upsample(const SAMPLETYPE *src, uint nSamples)
// If the parameter 'uRate' value is smaller than 'SCALE', first transpose
// the samples and then apply the anti-alias filter to remove aliasing.
- // First check that there's enough room in 'storeBuffer'
+ // First check that there's enough room in 'storeBuffer'
// (+16 is to reserve some slack in the destination buffer)
sizeTemp = (uint)((float)nSamples / fRate + 16.0f);
@@ -231,8 +231,8 @@ void RateTransposer::upsample(const SAMPLETYPE *src, uint nSamples)
// Apply the anti-alias filter to samples in "store output", output the
// result to "dest"
num = storeBuffer.numSamples();
- count = pAAFilter->evaluate(outputBuffer.ptrEnd(num),
- storeBuffer.ptrBegin(), num, (uint)numChannels);
+ count = pAAFilter->evaluate(outputBuffer.ptrEnd(num),
+ storeBuffer.ptrBegin(), num, (uint)numChannels);
outputBuffer.putSamples(count);
// Remove the processed samples from "storeBuffer"
@@ -253,16 +253,16 @@ void RateTransposer::downsample(const SAMPLETYPE *src, uint nSamples)
// Add the new samples to the end of the storeBuffer
storeBuffer.putSamples(src, nSamples);
- // Anti-alias filter the samples to prevent folding and output the filtered
+ // Anti-alias filter the samples to prevent folding and output the filtered
// data to tempBuffer. Note : because of the FIR filter length, the
// filtering routine takes in 'filter_length' more samples than it outputs.
assert(tempBuffer.isEmpty());
sizeTemp = storeBuffer.numSamples();
- count = pAAFilter->evaluate(tempBuffer.ptrEnd(sizeTemp),
- storeBuffer.ptrBegin(), sizeTemp, (uint)numChannels);
+ count = pAAFilter->evaluate(tempBuffer.ptrEnd(sizeTemp),
+ storeBuffer.ptrBegin(), sizeTemp, (uint)numChannels);
- if(count == 0) return;
+ if (count == 0) return;
// Remove the filtered samples from 'storeBuffer'
storeBuffer.receiveSamples(count);
@@ -274,7 +274,7 @@ void RateTransposer::downsample(const SAMPLETYPE *src, uint nSamples)
}
-// Transposes sample rate by applying anti-alias filter to prevent folding.
+// Transposes sample rate by applying anti-alias filter to prevent folding.
// Returns amount of samples returned in the "dest" buffer.
// The maximum amount of samples that can be returned at a time is set by
// the 'set_returnBuffer_size' function.
@@ -283,12 +283,12 @@ void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples)
uint count;
uint sizeReq;
- if(nSamples == 0) return;
+ if (nSamples == 0) return;
assert(pAAFilter);
// If anti-alias filter is turned off, simply transpose without applying
// the filter
- if(bUseAAFilter == FALSE)
+ if (bUseAAFilter == FALSE)
{
sizeReq = (uint)((float)nSamples / fRate + 1.0f);
count = transpose(outputBuffer.ptrEnd(sizeReq), src, nSamples);
@@ -297,26 +297,26 @@ void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples)
}
// Transpose with anti-alias filter
- if(fRate < 1.0f)
+ if (fRate < 1.0f)
{
upsample(src, nSamples);
- }
- else
+ }
+ else
{
downsample(src, nSamples);
}
}
-// Transposes the sample rate of the given samples using linear interpolation.
+// Transposes the sample rate of the given samples using linear interpolation.
// Returns the number of samples returned in the "dest" buffer
inline uint RateTransposer::transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, uint nSamples)
{
- if(numChannels == 2)
+ if (numChannels == 2)
{
return transposeStereo(dest, src, nSamples);
- }
- else
+ }
+ else
{
return transposeMono(dest, src, nSamples);
}
@@ -327,7 +327,7 @@ inline uint RateTransposer::transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, u
void RateTransposer::setChannels(int nChannels)
{
assert(nChannels > 0);
- if(numChannels == nChannels) return;
+ if (numChannels == nChannels) return;
assert(nChannels == 1 || nChannels == 2);
numChannels = nChannels;
@@ -355,7 +355,7 @@ int RateTransposer::isEmpty() const
int res;
res = FIFOProcessor::isEmpty();
- if(res == 0) return 0;
+ if (res == 0) return 0;
return storeBuffer.isEmpty();
}
@@ -363,7 +363,7 @@ int RateTransposer::isEmpty() const
//////////////////////////////////////////////////////////////////////////////
//
// RateTransposerInteger - integer arithmetic implementation
-//
+//
/// fixed-point interpolation routine precision
#define SCALE 65536
@@ -371,7 +371,7 @@ int RateTransposer::isEmpty() const
// Constructor
RateTransposerInteger::RateTransposerInteger() : RateTransposer()
{
- // Notice: use local function calling syntax for sake of clarity,
+ // Notice: use local function calling syntax for sake of clarity,
// to indicate the fact that C++ constructor can't call virtual functions.
RateTransposerInteger::resetRegisters();
RateTransposerInteger::setRate(1.0f);
@@ -386,27 +386,27 @@ RateTransposerInteger::~RateTransposerInteger()
void RateTransposerInteger::resetRegisters()
{
iSlopeCount = 0;
- sPrevSampleL =
- sPrevSampleR = 0;
+ sPrevSampleL =
+ sPrevSampleR = 0;
}
-// Transposes the sample rate of the given samples using linear interpolation.
-// 'Mono' version of the routine. Returns the number of samples returned in
+// Transposes the sample rate of the given samples using linear interpolation.
+// 'Mono' version of the routine. Returns the number of samples returned in
// the "dest" buffer
uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint nSamples)
{
unsigned int i, used;
LONG_SAMPLETYPE temp, vol1;
- if(nSamples == 0) return 0; // no samples, no work
+ if (nSamples == 0) return 0; // no samples, no work
- used = 0;
+ used = 0;
i = 0;
// Process the last sample saved from the previous call first...
- while(iSlopeCount <= SCALE)
+ while (iSlopeCount <= SCALE)
{
vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount);
temp = vol1 * sPrevSampleL + iSlopeCount * src[0];
@@ -417,13 +417,13 @@ uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *sr
// now always (iSlopeCount > SCALE)
iSlopeCount -= SCALE;
- while(1)
+ while (1)
{
- while(iSlopeCount > SCALE)
+ while (iSlopeCount > SCALE)
{
iSlopeCount -= SCALE;
used ++;
- if(used >= nSamples - 1) goto end;
+ if (used >= nSamples - 1) goto end;
}
vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount);
temp = src[used] * vol1 + iSlopeCount * src[used + 1];
@@ -440,21 +440,21 @@ end:
}
-// Transposes the sample rate of the given samples using linear interpolation.
-// 'Stereo' version of the routine. Returns the number of samples returned in
+// Transposes the sample rate of the given samples using linear interpolation.
+// 'Stereo' version of the routine. Returns the number of samples returned in
// the "dest" buffer
uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint nSamples)
{
unsigned int srcPos, i, used;
LONG_SAMPLETYPE temp, vol1;
- if(nSamples == 0) return 0; // no samples, no work
+ if (nSamples == 0) return 0; // no samples, no work
- used = 0;
+ used = 0;
i = 0;
// Process the last sample saved from the sPrevSampleLious call first...
- while(iSlopeCount <= SCALE)
+ while (iSlopeCount <= SCALE)
{
vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount);
temp = vol1 * sPrevSampleL + iSlopeCount * src[0];
@@ -467,13 +467,13 @@ uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *
// now always (iSlopeCount > SCALE)
iSlopeCount -= SCALE;
- while(1)
+ while (1)
{
- while(iSlopeCount > SCALE)
+ while (iSlopeCount > SCALE)
{
iSlopeCount -= SCALE;
used ++;
- if(used >= nSamples - 1) goto end;
+ if (used >= nSamples - 1) goto end;
}
srcPos = 2 * used;
vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount);
@@ -494,7 +494,7 @@ end:
}
-// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower
+// Sets new target iRate. Normal iRate = 1.0, smaller values represent slower
// iRate, larger faster iRates.
void RateTransposerInteger::setRate(float newRate)
{
@@ -506,13 +506,13 @@ void RateTransposerInteger::setRate(float newRate)
//////////////////////////////////////////////////////////////////////////////
//
// RateTransposerFloat - floating point arithmetic implementation
-//
+//
//////////////////////////////////////////////////////////////////////////////
// Constructor
RateTransposerFloat::RateTransposerFloat() : RateTransposer()
{
- // Notice: use local function calling syntax for sake of clarity,
+ // Notice: use local function calling syntax for sake of clarity,
// to indicate the fact that C++ constructor can't call virtual functions.
RateTransposerFloat::resetRegisters();
RateTransposerFloat::setRate(1.0f);
@@ -527,24 +527,24 @@ RateTransposerFloat::~RateTransposerFloat()
void RateTransposerFloat::resetRegisters()
{
fSlopeCount = 0;
- sPrevSampleL =
- sPrevSampleR = 0;
+ sPrevSampleL =
+ sPrevSampleR = 0;
}
-// Transposes the sample rate of the given samples using linear interpolation.
-// 'Mono' version of the routine. Returns the number of samples returned in
+// Transposes the sample rate of the given samples using linear interpolation.
+// 'Mono' version of the routine. Returns the number of samples returned in
// the "dest" buffer
uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint nSamples)
{
unsigned int i, used;
- used = 0;
+ used = 0;
i = 0;
// Process the last sample saved from the previous call first...
- while(fSlopeCount <= 1.0f)
+ while (fSlopeCount <= 1.0f)
{
dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]);
i++;
@@ -552,15 +552,15 @@ uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src,
}
fSlopeCount -= 1.0f;
- if(nSamples > 1)
+ if (nSamples > 1)
{
- while(1)
+ while (1)
{
- while(fSlopeCount > 1.0f)
+ while (fSlopeCount > 1.0f)
{
fSlopeCount -= 1.0f;
used ++;
- if(used >= nSamples - 1) goto end;
+ if (used >= nSamples - 1) goto end;
}
dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[used] + fSlopeCount * src[used + 1]);
i++;
@@ -575,20 +575,20 @@ end:
}
-// Transposes the sample rate of the given samples using linear interpolation.
-// 'Mono' version of the routine. Returns the number of samples returned in
+// Transposes the sample rate of the given samples using linear interpolation.
+// 'Mono' version of the routine. Returns the number of samples returned in
// the "dest" buffer
uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint nSamples)
{
unsigned int srcPos, i, used;
- if(nSamples == 0) return 0; // no samples, no work
+ if (nSamples == 0) return 0; // no samples, no work
- used = 0;
+ used = 0;
i = 0;
// Process the last sample saved from the sPrevSampleLious call first...
- while(fSlopeCount <= 1.0f)
+ while (fSlopeCount <= 1.0f)
{
dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]);
dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleR + fSlopeCount * src[1]);
@@ -598,22 +598,22 @@ uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *sr
// now always (iSlopeCount > 1.0f)
fSlopeCount -= 1.0f;
- if(nSamples > 1)
+ if (nSamples > 1)
{
- while(1)
+ while (1)
{
- while(fSlopeCount > 1.0f)
+ while (fSlopeCount > 1.0f)
{
fSlopeCount -= 1.0f;
used ++;
- if(used >= nSamples - 1) goto end;
+ if (used >= nSamples - 1) goto end;
}
srcPos = 2 * used;
- dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos]
- + fSlopeCount * src[srcPos + 2]);
- dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos + 1]
- + fSlopeCount * src[srcPos + 3]);
+ dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos]
+ + fSlopeCount * src[srcPos + 2]);
+ dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos + 1]
+ + fSlopeCount * src[srcPos + 3]);
i++;
fSlopeCount += fRate;
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.h
index 776136ac8..f035af2c0 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/RateTransposer.h
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
-///
-/// Sample rate transposer. Changes sample rate by using linear interpolation
+///
+/// Sample rate transposer. Changes sample rate by using linear interpolation
/// together with anti-alias filtering (first order interpolation with anti-
/// alias filtering should be quite adequate for this application).
///
-/// Use either of the derived classes of 'RateTransposerInteger' or
+/// Use either of the derived classes of 'RateTransposerInteger' or
/// 'RateTransposerFloat' for corresponding integer/floating point tranposing
/// algorithm implementation.
///
@@ -57,9 +57,9 @@ namespace soundtouch
/// A common linear samplerate transposer class.
///
-/// Note: Use function "RateTransposer::newInstance()" to create a new class
-/// instance instead of the "new" operator; that function automatically
-/// chooses a correct implementation depending on if integer or floating
+/// Note: Use function "RateTransposer::newInstance()" to create a new class
+/// instance instead of the "new" operator; that function automatically
+/// chooses a correct implementation depending on if integer or floating
/// arithmetics are to be used.
class RateTransposer : public FIFOProcessor
{
@@ -85,26 +85,26 @@ protected:
virtual void resetRegisters() = 0;
- virtual uint transposeStereo(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples) = 0;
- virtual uint transposeMono(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples) = 0;
- inline uint transpose(SAMPLETYPE *dest,
- const SAMPLETYPE *src,
- uint numSamples);
-
- void downsample(const SAMPLETYPE *src,
+ virtual uint transposeStereo(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples) = 0;
+ virtual uint transposeMono(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples) = 0;
+ inline uint transpose(SAMPLETYPE *dest,
+ const SAMPLETYPE *src,
+ uint numSamples);
+
+ void downsample(const SAMPLETYPE *src,
uint numSamples);
- void upsample(const SAMPLETYPE *src,
- uint numSamples);
+ void upsample(const SAMPLETYPE *src,
+ uint numSamples);
- /// Transposes sample rate by applying anti-alias filter to prevent folding.
+ /// Transposes sample rate by applying anti-alias filter to prevent folding.
/// Returns amount of samples returned in the "dest" buffer.
/// The maximum amount of samples that can be returned at a time is set by
/// the 'set_returnBuffer_size' function.
- void processSamples(const SAMPLETYPE *src,
+ void processSamples(const SAMPLETYPE *src,
uint numSamples);
@@ -112,26 +112,20 @@ public:
RateTransposer();
virtual ~RateTransposer();
- /// Operator 'new' is overloaded so that it automatically creates a suitable instance
+ /// Operator 'new' is overloaded so that it automatically creates a suitable instance
/// depending on if we're to use integer or floating point arithmetics.
static void *operator new(size_t s);
- /// Use this function instead of "new" operator to create a new instance of this class.
- /// This function automatically chooses a correct implementation, depending on if
+ /// Use this function instead of "new" operator to create a new instance of this class.
+ /// This function automatically chooses a correct implementation, depending on if
/// integer ot floating point arithmetics are to be used.
static RateTransposer *newInstance();
/// Returns the output buffer object
- FIFOSamplePipe *getOutput()
- {
- return &outputBuffer;
- };
+ FIFOSamplePipe *getOutput() { return &outputBuffer; };
/// Returns the store buffer object
- FIFOSamplePipe *getStore()
- {
- return &storeBuffer;
- };
+ FIFOSamplePipe *getStore() { return &storeBuffer; };
/// Return anti-alias filter object
AAFilter *getAAFilter();
@@ -142,7 +136,7 @@ public:
/// Returns nonzero if anti-alias filter is enabled.
BOOL isAAFilterEnabled() const;
- /// Sets new target rate. Normal rate = 1.0, smaller values represent slower
+ /// Sets new target rate. Normal rate = 1.0, smaller values represent slower
/// rate, larger faster rates.
virtual void setRate(float newRate);
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/SoundTouch.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/SoundTouch.cpp
index bd7b2f77d..aa7ac0284 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/SoundTouch.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/SoundTouch.cpp
@@ -1,27 +1,27 @@
//////////////////////////////////////////////////////////////////////////////
///
-/// SoundTouch - main class for tempo/pitch/rate adjusting routines.
+/// SoundTouch - main class for tempo/pitch/rate adjusting routines.
///
/// Notes:
-/// - Initialize the SoundTouch object instance by setting up the sound stream
-/// parameters with functions 'setSampleRate' and 'setChannels', then set
+/// - Initialize the SoundTouch object instance by setting up the sound stream
+/// parameters with functions 'setSampleRate' and 'setChannels', then set
/// desired tempo/pitch/rate settings with the corresponding functions.
///
-/// - The SoundTouch class behaves like a first-in-first-out pipeline: The
+/// - The SoundTouch class behaves like a first-in-first-out pipeline: The
/// samples that are to be processed are fed into one of the pipe by calling
-/// function 'putSamples', while the ready processed samples can be read
+/// function 'putSamples', while the ready processed samples can be read
/// from the other end of the pipeline with function 'receiveSamples'.
-///
-/// - The SoundTouch processing classes require certain sized 'batches' of
-/// samples in order to process the sound. For this reason the classes buffer
-/// incoming samples until there are enough of samples available for
+///
+/// - The SoundTouch processing classes require certain sized 'batches' of
+/// samples in order to process the sound. For this reason the classes buffer
+/// incoming samples until there are enough of samples available for
/// processing, then they carry out the processing step and consequently
/// make the processed samples available for outputting.
-///
-/// - For the above reason, the processing routines introduce a certain
+///
+/// - For the above reason, the processing routines introduce a certain
/// 'latency' between the input and output, so that the samples input to
-/// SoundTouch may not be immediately available in the output, and neither
-/// the amount of outputtable samples may not immediately be in direct
+/// SoundTouch may not be immediately available in the output, and neither
+/// the amount of outputtable samples may not immediately be in direct
/// relationship with the amount of previously input samples.
///
/// - The tempo/pitch/rate control parameters can be altered during processing.
@@ -30,8 +30,8 @@
/// required.
///
/// - This class utilizes classes 'TDStretch' for tempo change (without modifying
-/// pitch) and 'RateTransposer' for changing the playback rate (that is, both
-/// tempo and pitch in the same ratio) of the sound. The third available control
+/// pitch) and 'RateTransposer' for changing the playback rate (that is, both
+/// tempo and pitch in the same ratio) of the sound. The third available control
/// 'pitch' (change pitch but maintain tempo) is produced by a combination of
/// combining the two other controls.
///
@@ -82,7 +82,7 @@
#include "cpu_detect.h"
using namespace soundtouch;
-
+
/// test if two floating point numbers are equal
#define TEST_FLOAT_EQUAL(a, b) (fabs(a - b) < 1e-10)
@@ -90,8 +90,8 @@ using namespace soundtouch;
/// Print library version string for autoconf
extern "C" void soundtouch_ac_test()
{
- printf("SoundTouch Version: %s\n", SOUNDTOUCH_VERSION);
-}
+ printf("SoundTouch Version: %s\n",SOUNDTOUCH_VERSION);
+}
SoundTouch::SoundTouch()
@@ -105,9 +105,9 @@ SoundTouch::SoundTouch()
rate = tempo = 0;
- virtualPitch =
- virtualRate =
- virtualTempo = 1.0;
+ virtualPitch =
+ virtualRate =
+ virtualTempo = 1.0;
calcEffectiveRateAndTempo();
@@ -144,7 +144,7 @@ uint SoundTouch::getVersionId()
// Sets the number of channels, 1 = mono, 2 = stereo
void SoundTouch::setChannels(uint numChannels)
{
- if(numChannels != 1 && numChannels != 2)
+ if (numChannels != 1 && numChannels != 2)
{
throw std::runtime_error("Illegal number of channels");
}
@@ -240,13 +240,13 @@ void SoundTouch::calcEffectiveRateAndTempo()
tempo = virtualTempo / virtualPitch;
rate = virtualPitch * virtualRate;
- if(!TEST_FLOAT_EQUAL(rate, oldRate)) pRateTransposer->setRate(rate);
- if(!TEST_FLOAT_EQUAL(tempo, oldTempo)) pTDStretch->setTempo(tempo);
+ if (!TEST_FLOAT_EQUAL(rate,oldRate)) pRateTransposer->setRate(rate);
+ if (!TEST_FLOAT_EQUAL(tempo, oldTempo)) pTDStretch->setTempo(tempo);
#ifndef PREVENT_CLICK_AT_RATE_CROSSOVER
- if(rate <= 1.0f)
+ if (rate <= 1.0f)
{
- if(output != pTDStretch)
+ if (output != pTDStretch)
{
FIFOSamplePipe *tempoOut;
@@ -263,7 +263,7 @@ void SoundTouch::calcEffectiveRateAndTempo()
else
#endif
{
- if(output != pRateTransposer)
+ if (output != pRateTransposer)
{
FIFOSamplePipe *transOut;
@@ -276,7 +276,7 @@ void SoundTouch::calcEffectiveRateAndTempo()
output = pRateTransposer;
}
- }
+ }
}
@@ -293,42 +293,42 @@ void SoundTouch::setSampleRate(uint srate)
// the input of the object.
void SoundTouch::putSamples(const SAMPLETYPE *samples, uint nSamples)
{
- if(bSrateSet == FALSE)
+ if (bSrateSet == FALSE)
{
throw std::runtime_error("SoundTouch : Sample rate not defined");
- }
- else if(channels == 0)
+ }
+ else if (channels == 0)
{
throw std::runtime_error("SoundTouch : Number of channels not defined");
}
// Transpose the rate of the new samples if necessary
/* Bypass the nominal setting - can introduce a click in sound when tempo/pitch control crosses the nominal value...
- if (rate == 1.0f)
+ if (rate == 1.0f)
{
- // The rate value is same as the original, simply evaluate the tempo changer.
+ // The rate value is same as the original, simply evaluate the tempo changer.
assert(output == pTDStretch);
- if (pRateTransposer->isEmpty() == 0)
+ if (pRateTransposer->isEmpty() == 0)
{
// yet flush the last samples in the pitch transposer buffer
// (may happen if 'rate' changes from a non-zero value to zero)
pTDStretch->moveSamples(*pRateTransposer);
}
pTDStretch->putSamples(samples, nSamples);
- }
+ }
*/
#ifndef PREVENT_CLICK_AT_RATE_CROSSOVER
- else if(rate <= 1.0f)
+ else if (rate <= 1.0f)
{
// transpose the rate down, output the transposed sound to tempo changer buffer
assert(output == pTDStretch);
pRateTransposer->putSamples(samples, nSamples);
pTDStretch->moveSamples(*pRateTransposer);
- }
- else
+ }
+ else
#endif
{
- // evaluate the tempo changer, then transpose the rate up,
+ // evaluate the tempo changer, then transpose the rate up,
assert(output == pRateTransposer);
pTDStretch->putSamples(samples, nSamples);
pRateTransposer->moveSamples(*pTDStretch);
@@ -353,13 +353,13 @@ void SoundTouch::flush()
memset(buff, 0, 128 * sizeof(SAMPLETYPE));
// "Push" the last active samples out from the processing pipeline by
- // feeding blank samples into the processing pipeline until new,
- // processed samples appear in the output (not however, more than
+ // feeding blank samples into the processing pipeline until new,
+ // processed samples appear in the output (not however, more than
// 8ksamples in any case)
- for(i = 0; i < 128; i ++)
+ for (i = 0; i < 128; i ++)
{
putSamples(buff, 64);
- if(numSamples() != nOut) break; // new samples have appeared in the output!
+ if (numSamples() != nOut) break; // new samples have appeared in the output!
}
// Clear working buffers
@@ -379,40 +379,40 @@ BOOL SoundTouch::setSetting(int settingId, int value)
// read current tdstretch routine parameters
pTDStretch->getParameters(&sampleRate, &sequenceMs, &seekWindowMs, &overlapMs);
- switch(settingId)
+ switch (settingId)
{
- case SETTING_USE_AA_FILTER :
- // enables / disabless anti-alias filter
- pRateTransposer->enableAAFilter((value != 0) ? TRUE : FALSE);
- return TRUE;
-
- case SETTING_AA_FILTER_LENGTH :
- // sets anti-alias filter length
- pRateTransposer->getAAFilter()->setLength(value);
- return TRUE;
-
- case SETTING_USE_QUICKSEEK :
- // enables / disables tempo routine quick seeking algorithm
- pTDStretch->enableQuickSeek((value != 0) ? TRUE : FALSE);
- return TRUE;
-
- case SETTING_SEQUENCE_MS:
- // change time-stretch sequence duration parameter
- pTDStretch->setParameters(sampleRate, value, seekWindowMs, overlapMs);
- return TRUE;
-
- case SETTING_SEEKWINDOW_MS:
- // change time-stretch seek window length parameter
- pTDStretch->setParameters(sampleRate, sequenceMs, value, overlapMs);
- return TRUE;
-
- case SETTING_OVERLAP_MS:
- // change time-stretch overlap length parameter
- pTDStretch->setParameters(sampleRate, sequenceMs, seekWindowMs, value);
- return TRUE;
-
- default :
- return FALSE;
+ case SETTING_USE_AA_FILTER :
+ // enables / disabless anti-alias filter
+ pRateTransposer->enableAAFilter((value != 0) ? TRUE : FALSE);
+ return TRUE;
+
+ case SETTING_AA_FILTER_LENGTH :
+ // sets anti-alias filter length
+ pRateTransposer->getAAFilter()->setLength(value);
+ return TRUE;
+
+ case SETTING_USE_QUICKSEEK :
+ // enables / disables tempo routine quick seeking algorithm
+ pTDStretch->enableQuickSeek((value != 0) ? TRUE : FALSE);
+ return TRUE;
+
+ case SETTING_SEQUENCE_MS:
+ // change time-stretch sequence duration parameter
+ pTDStretch->setParameters(sampleRate, value, seekWindowMs, overlapMs);
+ return TRUE;
+
+ case SETTING_SEEKWINDOW_MS:
+ // change time-stretch seek window length parameter
+ pTDStretch->setParameters(sampleRate, sequenceMs, value, overlapMs);
+ return TRUE;
+
+ case SETTING_OVERLAP_MS:
+ // change time-stretch overlap length parameter
+ pTDStretch->setParameters(sampleRate, sequenceMs, seekWindowMs, value);
+ return TRUE;
+
+ default :
+ return FALSE;
}
}
@@ -425,31 +425,31 @@ int SoundTouch::getSetting(int settingId) const
{
int temp;
- switch(settingId)
+ switch (settingId)
{
- case SETTING_USE_AA_FILTER :
- return (uint)pRateTransposer->isAAFilterEnabled();
+ case SETTING_USE_AA_FILTER :
+ return (uint)pRateTransposer->isAAFilterEnabled();
- case SETTING_AA_FILTER_LENGTH :
- return pRateTransposer->getAAFilter()->getLength();
+ case SETTING_AA_FILTER_LENGTH :
+ return pRateTransposer->getAAFilter()->getLength();
- case SETTING_USE_QUICKSEEK :
- return (uint) pTDStretch->isQuickSeekEnabled();
+ case SETTING_USE_QUICKSEEK :
+ return (uint) pTDStretch->isQuickSeekEnabled();
- case SETTING_SEQUENCE_MS:
- pTDStretch->getParameters(NULL, &temp, NULL, NULL);
- return temp;
+ case SETTING_SEQUENCE_MS:
+ pTDStretch->getParameters(NULL, &temp, NULL, NULL);
+ return temp;
- case SETTING_SEEKWINDOW_MS:
- pTDStretch->getParameters(NULL, NULL, &temp, NULL);
- return temp;
+ case SETTING_SEEKWINDOW_MS:
+ pTDStretch->getParameters(NULL, NULL, &temp, NULL);
+ return temp;
- case SETTING_OVERLAP_MS:
- pTDStretch->getParameters(NULL, NULL, NULL, &temp);
- return temp;
+ case SETTING_OVERLAP_MS:
+ pTDStretch->getParameters(NULL, NULL, NULL, &temp);
+ return temp;
- default :
- return 0;
+ default :
+ return 0;
}
}
@@ -468,10 +468,10 @@ void SoundTouch::clear()
uint SoundTouch::numUnprocessedSamples() const
{
FIFOSamplePipe * psp;
- if(pTDStretch)
+ if (pTDStretch)
{
psp = pTDStretch->getInput();
- if(psp)
+ if (psp)
{
return psp->numSamples();
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp
index e4d9577d7..062524c84 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.cpp
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
-///
-/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
-/// while maintaining the original pitch by using a time domain WSOLA-like
+///
+/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
+/// while maintaining the original pitch by using a time domain WSOLA-like
/// method with several performance-increasing tweaks.
///
-/// Note : MMX optimized functions reside in a separate, platform-specific
+/// Note : MMX optimized functions reside in a separate, platform-specific
/// file, e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp'
///
/// Author : Copyright (c) Olli Parviainen
@@ -66,29 +66,17 @@ using namespace soundtouch;
*****************************************************************************/
// Table for the hierarchical mixing position seeking algorithm
-static const short _scanOffsets[5][24] =
-{
- {
- 124, 186, 248, 310, 372, 434, 496, 558, 620, 682, 744, 806,
- 868, 930, 992, 1054, 1116, 1178, 1240, 1302, 1364, 1426, 1488, 0
- },
- {
- -100, -75, -50, -25, 25, 50, 75, 100, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- -20, -15, -10, -5, 5, 10, 15, 20, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- -4, -3, -2, -1, 1, 2, 3, 4, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 121, 114, 97, 114, 98, 105, 108, 32, 104, 99, 117, 111,
- 116, 100, 110, 117, 111, 115, 0, 0, 0, 0, 0, 0
- }
-};
+static const short _scanOffsets[5][24]={
+ { 124, 186, 248, 310, 372, 434, 496, 558, 620, 682, 744, 806,
+ 868, 930, 992, 1054, 1116, 1178, 1240, 1302, 1364, 1426, 1488, 0},
+ {-100, -75, -50, -25, 25, 50, 75, 100, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { -20, -15, -10, -5, 5, 10, 15, 20, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { -4, -3, -2, -1, 1, 2, 3, 4, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 121, 114, 97, 114, 98, 105, 108, 32, 104, 99, 117, 111,
+ 116, 100, 110, 117, 111, 115, 0, 0, 0, 0, 0, 0}};
/*****************************************************************************
*
@@ -134,34 +122,34 @@ TDStretch::~TDStretch()
//
// 'sampleRate' = sample rate of the sound
// 'sequenceMS' = one processing sequence length in milliseconds (default = 82 ms)
-// 'seekwindowMS' = seeking window length for scanning the best overlapping
+// 'seekwindowMS' = seeking window length for scanning the best overlapping
// position (default = 28 ms)
// 'overlapMS' = overlapping length (default = 12 ms)
-void TDStretch::setParameters(int aSampleRate, int aSequenceMS,
+void TDStretch::setParameters(int aSampleRate, int aSequenceMS,
int aSeekWindowMS, int aOverlapMS)
{
// accept only positive parameter values - if zero or negative, use old values instead
- if(aSampleRate > 0) this->sampleRate = aSampleRate;
- if(aOverlapMS > 0) this->overlapMs = aOverlapMS;
+ if (aSampleRate > 0) this->sampleRate = aSampleRate;
+ if (aOverlapMS > 0) this->overlapMs = aOverlapMS;
- if(aSequenceMS > 0)
+ if (aSequenceMS > 0)
{
this->sequenceMs = aSequenceMS;
bAutoSeqSetting = FALSE;
- }
- else if(aSequenceMS == 0)
+ }
+ else if (aSequenceMS == 0)
{
// if zero, use automatic setting
bAutoSeqSetting = TRUE;
}
- if(aSeekWindowMS > 0)
+ if (aSeekWindowMS > 0)
{
this->seekWindowMs = aSeekWindowMS;
bAutoSeekSetting = FALSE;
- }
- else if(aSeekWindowMS == 0)
+ }
+ else if (aSeekWindowMS == 0)
{
// if zero, use automatic setting
bAutoSeekSetting = TRUE;
@@ -183,22 +171,22 @@ void TDStretch::setParameters(int aSampleRate, int aSequenceMS,
/// value isn't returned.
void TDStretch::getParameters(int *pSampleRate, int *pSequenceMs, int *pSeekWindowMs, int *pOverlapMs) const
{
- if(pSampleRate)
+ if (pSampleRate)
{
*pSampleRate = sampleRate;
}
- if(pSequenceMs)
+ if (pSequenceMs)
{
*pSequenceMs = (bAutoSeqSetting) ? (USE_AUTO_SEQUENCE_LEN) : sequenceMs;
}
- if(pSeekWindowMs)
+ if (pSeekWindowMs)
{
*pSeekWindowMs = (bAutoSeekSetting) ? (USE_AUTO_SEEKWINDOW_LEN) : seekWindowMs;
}
- if(pOverlapMs)
+ if (pOverlapMs)
{
*pOverlapMs = overlapMs;
}
@@ -210,10 +198,10 @@ void TDStretch::overlapMono(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput) const
{
int i, itemp;
- for(i = 0; i < overlapLength ; i ++)
+ for (i = 0; i < overlapLength ; i ++)
{
itemp = overlapLength - i;
- pOutput[i] = (pInput[i] * i + pMidBuffer[i] * itemp) / overlapLength; // >> overlapDividerBits;
+ pOutput[i] = (pInput[i] * i + pMidBuffer[i] * itemp ) / overlapLength; // >> overlapDividerBits;
}
}
@@ -259,26 +247,26 @@ BOOL TDStretch::isQuickSeekEnabled() const
// Seeks for the optimal overlap-mixing position.
int TDStretch::seekBestOverlapPosition(const SAMPLETYPE *refPos)
{
- if(channels == 2)
+ if (channels == 2)
{
// stereo sound
- if(bQuickSeek)
+ if (bQuickSeek)
{
return seekBestOverlapPositionStereoQuick(refPos);
- }
- else
+ }
+ else
{
return seekBestOverlapPositionStereo(refPos);
}
- }
- else
+ }
+ else
{
// mono sound
- if(bQuickSeek)
+ if (bQuickSeek)
{
return seekBestOverlapPositionMonoQuick(refPos);
- }
- else
+ }
+ else
{
return seekBestOverlapPositionMono(refPos);
}
@@ -292,13 +280,11 @@ int TDStretch::seekBestOverlapPosition(const SAMPLETYPE *refPos)
// of 'ovlPos'.
inline void TDStretch::overlap(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput, uint ovlPos) const
{
- if(channels == 2)
+ if (channels == 2)
{
// stereo sound
overlapStereo(pOutput, pInput + 2 * ovlPos);
- }
- else
- {
+ } else {
// mono sound.
overlapMono(pOutput, pInput + ovlPos);
}
@@ -313,7 +299,7 @@ inline void TDStretch::overlap(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput, ui
// The best position is determined as the position where the two overlapped
// sample sequences are 'most alike', in terms of the highest cross-correlation
// value over the overlapping period
-int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos)
+int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos)
{
int bestOffs;
double bestCorr, corr;
@@ -327,7 +313,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos)
// Scans for the best correlation value by testing each possible position
// over the permitted range.
- for(i = 0; i < seekLength; i ++)
+ for (i = 0; i < seekLength; i ++)
{
// Calculates correlation value for the mixing position corresponding
// to 'i'
@@ -337,7 +323,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos)
corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp));
// Checks for the highest correlation value
- if(corr > bestCorr)
+ if (corr > bestCorr)
{
bestCorr = corr;
bestOffs = i;
@@ -356,7 +342,7 @@ int TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos)
// The best position is determined as the position where the two overlapped
// sample sequences are 'most alike', in terms of the highest cross-correlation
// value over the overlapping period
-int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos)
+int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos)
{
int j;
int bestOffs;
@@ -374,16 +360,16 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos)
// Scans for the best correlation value using four-pass hierarchical search.
//
// The look-up table 'scans' has hierarchical position adjusting steps.
- // In first pass the routine searhes for the highest correlation with
+ // In first pass the routine searhes for the highest correlation with
// relatively coarse steps, then rescans the neighbourhood of the highest
// correlation with better resolution and so on.
- for(scanCount = 0; scanCount < 4; scanCount ++)
+ for (scanCount = 0;scanCount < 4; scanCount ++)
{
j = 0;
- while(_scanOffsets[scanCount][j])
+ while (_scanOffsets[scanCount][j])
{
tempOffset = corrOffset + _scanOffsets[scanCount][j];
- if(tempOffset >= seekLength) break;
+ if (tempOffset >= seekLength) break;
// Calculates correlation value for the mixing position corresponding
// to 'tempOffset'
@@ -393,7 +379,7 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos)
corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp));
// Checks for the highest correlation value
- if(corr > bestCorr)
+ if (corr > bestCorr)
{
bestCorr = corr;
bestOffs = tempOffset;
@@ -416,7 +402,7 @@ int TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos)
// The best position is determined as the position where the two overlapped
// sample sequences are 'most alike', in terms of the highest cross-correlation
// value over the overlapping period
-int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos)
+int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos)
{
int bestOffs;
double bestCorr, corr;
@@ -431,7 +417,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos)
// Scans for the best correlation value by testing each possible position
// over the permitted range.
- for(tempOffset = 0; tempOffset < seekLength; tempOffset ++)
+ for (tempOffset = 0; tempOffset < seekLength; tempOffset ++)
{
compare = refPos + tempOffset;
@@ -443,7 +429,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos)
corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp));
// Checks for the highest correlation value
- if(corr > bestCorr)
+ if (corr > bestCorr)
{
bestCorr = corr;
bestOffs = tempOffset;
@@ -462,7 +448,7 @@ int TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos)
// The best position is determined as the position where the two overlapped
// sample sequences are 'most alike', in terms of the highest cross-correlation
// value over the overlapping period
-int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos)
+int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos)
{
int j;
int bestOffs;
@@ -480,16 +466,16 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos)
// Scans for the best correlation value using four-pass hierarchical search.
//
// The look-up table 'scans' has hierarchical position adjusting steps.
- // In first pass the routine searhes for the highest correlation with
+ // In first pass the routine searhes for the highest correlation with
// relatively coarse steps, then rescans the neighbourhood of the highest
// correlation with better resolution and so on.
- for(scanCount = 0; scanCount < 4; scanCount ++)
+ for (scanCount = 0;scanCount < 4; scanCount ++)
{
j = 0;
- while(_scanOffsets[scanCount][j])
+ while (_scanOffsets[scanCount][j])
{
tempOffset = corrOffset + _scanOffsets[scanCount][j];
- if(tempOffset >= seekLength) break;
+ if (tempOffset >= seekLength) break;
// Calculates correlation value for the mixing position corresponding
// to 'tempOffset'
@@ -499,7 +485,7 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos)
corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp));
// Checks for the highest correlation value
- if(corr > bestCorr)
+ if (corr > bestCorr)
{
bestCorr = corr;
bestOffs = tempOffset;
@@ -515,7 +501,7 @@ int TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos)
}
-/// clear cross correlation routine state if necessary
+/// clear cross correlation routine state if necessary
void TDStretch::clearCrossCorrState()
{
// default implementation is empty.
@@ -527,33 +513,33 @@ void TDStretch::calcSeqParameters()
{
// Adjust tempo param according to tempo, so that variating processing sequence length is used
// at varius tempo settings, between the given low...top limits
-#define AUTOSEQ_TEMPO_LOW 0.5 // auto setting low tempo range (-50%)
-#define AUTOSEQ_TEMPO_TOP 2.0 // auto setting top tempo range (+100%)
+ #define AUTOSEQ_TEMPO_LOW 0.5 // auto setting low tempo range (-50%)
+ #define AUTOSEQ_TEMPO_TOP 2.0 // auto setting top tempo range (+100%)
// sequence-ms setting values at above low & top tempo
-#define AUTOSEQ_AT_MIN 125.0
-#define AUTOSEQ_AT_MAX 50.0
-#define AUTOSEQ_K ((AUTOSEQ_AT_MAX - AUTOSEQ_AT_MIN) / (AUTOSEQ_TEMPO_TOP - AUTOSEQ_TEMPO_LOW))
-#define AUTOSEQ_C (AUTOSEQ_AT_MIN - (AUTOSEQ_K) * (AUTOSEQ_TEMPO_LOW))
+ #define AUTOSEQ_AT_MIN 125.0
+ #define AUTOSEQ_AT_MAX 50.0
+ #define AUTOSEQ_K ((AUTOSEQ_AT_MAX - AUTOSEQ_AT_MIN) / (AUTOSEQ_TEMPO_TOP - AUTOSEQ_TEMPO_LOW))
+ #define AUTOSEQ_C (AUTOSEQ_AT_MIN - (AUTOSEQ_K) * (AUTOSEQ_TEMPO_LOW))
// seek-window-ms setting values at above low & top tempo
-#define AUTOSEEK_AT_MIN 25.0
-#define AUTOSEEK_AT_MAX 15.0
-#define AUTOSEEK_K ((AUTOSEEK_AT_MAX - AUTOSEEK_AT_MIN) / (AUTOSEQ_TEMPO_TOP - AUTOSEQ_TEMPO_LOW))
-#define AUTOSEEK_C (AUTOSEEK_AT_MIN - (AUTOSEEK_K) * (AUTOSEQ_TEMPO_LOW))
+ #define AUTOSEEK_AT_MIN 25.0
+ #define AUTOSEEK_AT_MAX 15.0
+ #define AUTOSEEK_K ((AUTOSEEK_AT_MAX - AUTOSEEK_AT_MIN) / (AUTOSEQ_TEMPO_TOP - AUTOSEQ_TEMPO_LOW))
+ #define AUTOSEEK_C (AUTOSEEK_AT_MIN - (AUTOSEEK_K) * (AUTOSEQ_TEMPO_LOW))
-#define CHECK_LIMITS(x, mi, ma) (((x) < (mi)) ? (mi) : (((x) > (ma)) ? (ma) : (x)))
+ #define CHECK_LIMITS(x, mi, ma) (((x) < (mi)) ? (mi) : (((x) > (ma)) ? (ma) : (x)))
double seq, seek;
-
- if(bAutoSeqSetting)
+
+ if (bAutoSeqSetting)
{
seq = AUTOSEQ_C + AUTOSEQ_K * tempo;
seq = CHECK_LIMITS(seq, AUTOSEQ_AT_MAX, AUTOSEQ_AT_MIN);
sequenceMs = (int)(seq + 0.5);
}
- if(bAutoSeekSetting)
+ if (bAutoSeekSetting)
{
seek = AUTOSEEK_C + AUTOSEEK_K * tempo;
seek = CHECK_LIMITS(seek, AUTOSEEK_AT_MAX, AUTOSEEK_AT_MIN);
@@ -562,7 +548,7 @@ void TDStretch::calcSeqParameters()
// Update seek window lengths
seekWindowLength = (sampleRate * sequenceMs) / 1000;
- if(seekWindowLength < 2 * overlapLength)
+ if (seekWindowLength < 2 * overlapLength)
{
seekWindowLength = 2 * overlapLength;
}
@@ -571,7 +557,7 @@ void TDStretch::calcSeqParameters()
-// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower
+// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower
// tempo, larger faster tempo.
void TDStretch::setTempo(float newTempo)
{
@@ -582,11 +568,11 @@ void TDStretch::setTempo(float newTempo)
// Calculate new sequence duration
calcSeqParameters();
- // Calculate ideal skip length (according to tempo value)
+ // Calculate ideal skip length (according to tempo value)
nominalSkip = tempo * (seekWindowLength - overlapLength);
intskip = (int)(nominalSkip + 0.5f);
- // Calculate how many samples are needed in the 'inputBuffer' to
+ // Calculate how many samples are needed in the 'inputBuffer' to
// process another batch of samples
//sampleReq = max(intskip + overlapLength, seekWindowLength) + seekLength / 2;
sampleReq = max(intskip + overlapLength, seekWindowLength) + seekLength;
@@ -598,7 +584,7 @@ void TDStretch::setTempo(float newTempo)
void TDStretch::setChannels(int numChannels)
{
assert(numChannels > 0);
- if(channels == numChannels) return;
+ if (channels == numChannels) return;
assert(numChannels == 1 || numChannels == 2);
channels = numChannels;
@@ -614,18 +600,18 @@ void TDStretch::processNominalTempo()
{
assert(tempo == 1.0f);
- if (bMidBufferDirty)
+ if (bMidBufferDirty)
{
// If there are samples in pMidBuffer waiting for overlapping,
- // do a single sliding overlapping with them in order to prevent a
+ // do a single sliding overlapping with them in order to prevent a
// clicking distortion in the output sound
- if (inputBuffer.numSamples() < overlapLength)
+ if (inputBuffer.numSamples() < overlapLength)
{
// wait until we've got overlapLength input samples
return;
}
- // Mix the samples in the beginning of 'inputBuffer' with the
- // samples in 'midBuffer' using sliding overlapping
+ // Mix the samples in the beginning of 'inputBuffer' with the
+ // samples in 'midBuffer' using sliding overlapping
overlap(outputBuffer.ptrEnd(overlapLength), inputBuffer.ptrBegin(), 0);
outputBuffer.putSamples(overlapLength);
inputBuffer.receiveSamples(overlapLength);
@@ -650,7 +636,7 @@ void TDStretch::processSamples()
/* Removed this small optimization - can introduce a click to sound when tempo setting
crosses the nominal value
- if (tempo == 1.0f)
+ if (tempo == 1.0f)
{
// tempo not changed from the original, so bypass the processing
processNominalTempo();
@@ -660,14 +646,14 @@ void TDStretch::processSamples()
// Process samples as long as there are enough samples in 'inputBuffer'
// to form a processing frame.
-// while ((int)inputBuffer.numSamples() >= sampleReq - (outDebt / 4))
- while((int)inputBuffer.numSamples() >= sampleReq)
+// while ((int)inputBuffer.numSamples() >= sampleReq - (outDebt / 4))
+ while ((int)inputBuffer.numSamples() >= sampleReq)
{
// If tempo differs from the normal ('SCALE'), scan for the best overlapping
// position
offset = seekBestOverlapPosition(inputBuffer.ptrBegin());
- // Mix the samples in the 'inputBuffer' at position of 'offset' with the
+ // Mix the samples in the 'inputBuffer' at position of 'offset' with the
// samples in 'midBuffer' using sliding overlapping
// ... first partially overlap with the end of the previous sequence
// (that's in 'midBuffer')
@@ -680,7 +666,7 @@ void TDStretch::processSamples()
// compensate cumulated output length diff vs. ideal output
// temp -= outDebt / 4;
- // update ideal vs. true output difference
+ // update ideal vs. true output difference
// outDebt += temp;
// length of sequence
@@ -688,19 +674,19 @@ void TDStretch::processSamples()
temp = (seekWindowLength - 2 * overlapLength);
// crosscheck that we don't have buffer overflow...
- if((int)inputBuffer.numSamples() < (offset + temp + overlapLength * 2))
+ if ((int)inputBuffer.numSamples() < (offset + temp + overlapLength * 2))
{
continue; // just in case, shouldn't really happen
}
- outputBuffer.putSamples(inputBuffer.ptrBegin() + channels *(offset + overlapLength), (uint)temp);
+ outputBuffer.putSamples(inputBuffer.ptrBegin() + channels * (offset + overlapLength), (uint)temp);
- // Copies the end of the current sequence from 'inputBuffer' to
- // 'midBuffer' for being mixed with the beginning of the next
+ // Copies the end of the current sequence from 'inputBuffer' to
+ // 'midBuffer' for being mixed with the beginning of the next
// processing sequence and so on
assert((offset + temp + overlapLength * 2) <= (int)inputBuffer.numSamples());
- memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels *(offset + temp + overlapLength),
- channels * sizeof(SAMPLETYPE) * overlapLength);
+ memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + temp + overlapLength),
+ channels * sizeof(SAMPLETYPE) * overlapLength);
// Remove the processed samples from the input buffer. Update
// the difference between integer & nominal skip step to 'skipFract'
@@ -734,7 +720,7 @@ void TDStretch::acceptNewOverlapLength(int newOverlapLength)
prevOvl = overlapLength;
overlapLength = newOverlapLength;
- if(overlapLength > prevOvl)
+ if (overlapLength > prevOvl)
{
delete[] pMidBuffer;
delete[] pRefMidBufferUnaligned;
@@ -744,12 +730,12 @@ void TDStretch::acceptNewOverlapLength(int newOverlapLength)
pRefMidBufferUnaligned = new SAMPLETYPE[2 * overlapLength + 16 / sizeof(SAMPLETYPE)];
// ensure that 'pRefMidBuffer' is aligned to 16 byte boundary for efficiency
- pRefMidBuffer = (SAMPLETYPE *)((((ulong)pRefMidBufferUnaligned) + 15) & (ulong) - 16);
+ pRefMidBuffer = (SAMPLETYPE *)((((ulong)pRefMidBufferUnaligned) + 15) & (ulong)-16);
}
}
-// Operator 'new' is overloaded so that it automatically creates a suitable instance
+// Operator 'new' is overloaded so that it automatically creates a suitable instance
// depending on if we've a MMX/SSE/etc-capable CPU available or not.
void * TDStretch::operator new(size_t s)
{
@@ -762,7 +748,7 @@ void * TDStretch::operator new(size_t s)
TDStretch * TDStretch::newInstance()
{
#ifndef _WIN64
- uint uExtensions;
+ uint uExtensions;
uExtensions = detectCPUextensions();
@@ -770,7 +756,7 @@ TDStretch * TDStretch::newInstance()
#ifdef ALLOW_MMX
// MMX routines available only with integer sample types
- if(uExtensions & SUPPORT_MMX)
+ if (uExtensions & SUPPORT_MMX)
{
return ::new TDStretchMMX;
}
@@ -779,30 +765,30 @@ TDStretch * TDStretch::newInstance()
#ifdef ALLOW_SSE
- if(uExtensions & SUPPORT_SSE)
- {
- // SSE support
- return ::new TDStretchSSE;
- }
- else
+ if (uExtensions & SUPPORT_SSE)
+ {
+ // SSE support
+ return ::new TDStretchSSE;
+ }
+ else
#endif // ALLOW_SSE
#ifdef ALLOW_3DNOW
- if(uExtensions & SUPPORT_3DNOW)
- {
- // 3DNow! support
- return ::new TDStretch3DNow;
- }
- else
+ if (uExtensions & SUPPORT_3DNOW)
+ {
+ // 3DNow! support
+ return ::new TDStretch3DNow;
+ }
+ else
#endif // ALLOW_3DNOW
#endif // _WIN64
- {
- // ISA optimizations not supported, use plain C version
- return ::new TDStretch;
- }
+ {
+ // ISA optimizations not supported, use plain C version
+ return ::new TDStretch;
+ }
}
@@ -821,7 +807,7 @@ void TDStretch::precalcCorrReferenceStereo()
int i, cnt2;
int temp, temp2;
- for(i = 0 ; i < (int)overlapLength ; i ++)
+ for (i=0 ; i < (int)overlapLength ;i ++)
{
temp = i * (overlapLength - i);
cnt2 = i * 2;
@@ -842,7 +828,7 @@ void TDStretch::precalcCorrReferenceMono()
long temp;
long temp2;
- for(i = 0 ; i < (int)overlapLength ; i ++)
+ for (i=0 ; i < (int)overlapLength ;i ++)
{
temp = i * (overlapLength - i);
temp2 = (pMidBuffer[i] * temp) / slopingDivider;
@@ -851,7 +837,7 @@ void TDStretch::precalcCorrReferenceMono()
}
-// Overlaps samples in 'midBuffer' with the samples in 'input'. The 'Stereo'
+// Overlaps samples in 'midBuffer' with the samples in 'input'. The 'Stereo'
// version of the routine.
void TDStretch::overlapStereo(short *poutput, const short *input) const
{
@@ -859,12 +845,12 @@ void TDStretch::overlapStereo(short *poutput, const short *input) const
short temp;
int cnt2;
- for(i = 0; i < overlapLength ; i ++)
+ for (i = 0; i < overlapLength ; i ++)
{
temp = (short)(overlapLength - i);
cnt2 = 2 * i;
- poutput[cnt2] = (input[cnt2] * i + pMidBuffer[cnt2] * temp) / overlapLength;
- poutput[cnt2 + 1] = (input[cnt2 + 1] * i + pMidBuffer[cnt2 + 1] * temp) / overlapLength;
+ poutput[cnt2] = (input[cnt2] * i + pMidBuffer[cnt2] * temp ) / overlapLength;
+ poutput[cnt2 + 1] = (input[cnt2 + 1] * i + pMidBuffer[cnt2 + 1] * temp ) / overlapLength;
}
}
@@ -885,17 +871,17 @@ void TDStretch::calculateOverlapLength(int aoverlapMs)
assert(aoverlapMs >= 0);
// calculate overlap length so that it's power of 2 - thus it's easy to do
- // integer division by right-shifting. Term "-1" at end is to account for
- // the extra most significatnt bit left unused in result by signed multiplication
+ // integer division by right-shifting. Term "-1" at end is to account for
+ // the extra most significatnt bit left unused in result by signed multiplication
overlapDividerBits = _getClosest2Power((sampleRate * aoverlapMs) / 1000.0) - 1;
- if(overlapDividerBits > 9) overlapDividerBits = 9;
- if(overlapDividerBits < 3) overlapDividerBits = 3;
+ if (overlapDividerBits > 9) overlapDividerBits = 9;
+ if (overlapDividerBits < 3) overlapDividerBits = 3;
newOvl = (int)pow(2.0, (int)overlapDividerBits + 1); // +1 => account for -1 above
acceptNewOverlapLength(newOvl);
- // calculate sloping divider so that crosscorrelation operation won't
- // overflow 32-bit register. Max. sum of the crosscorrelation sum without
+ // calculate sloping divider so that crosscorrelation operation won't
+ // overflow 32-bit register. Max. sum of the crosscorrelation sum without
// divider would be 2^30*(N^3-N)/3, where N = overlap length
slopingDivider = (newOvl * newOvl - 1) / 3;
}
@@ -908,15 +894,15 @@ long TDStretch::calcCrossCorrMono(const short *mixingPos, const short *compare)
int i;
corr = norm = 0;
- for(i = 1; i < overlapLength; i ++)
+ for (i = 1; i < overlapLength; i ++)
{
corr += (mixingPos[i] * compare[i]) >> overlapDividerBits;
norm += (mixingPos[i] * mixingPos[i]) >> overlapDividerBits;
}
- // Normalize result by dividing by sqrt(norm) - this step is easiest
+ // Normalize result by dividing by sqrt(norm) - this step is easiest
// done using floating point operation
- if(norm == 0) norm = 1; // to avoid div by zero
+ if (norm == 0) norm = 1; // to avoid div by zero
return (long)((double)corr * SHRT_MAX / sqrt((double)norm));
}
@@ -928,16 +914,16 @@ long TDStretch::calcCrossCorrStereo(const short *mixingPos, const short *compare
int i;
corr = norm = 0;
- for(i = 2; i < 2 * overlapLength; i += 2)
+ for (i = 2; i < 2 * overlapLength; i += 2)
{
corr += (mixingPos[i] * compare[i] +
mixingPos[i + 1] * compare[i + 1]) >> overlapDividerBits;
norm += (mixingPos[i] * mixingPos[i] + mixingPos[i + 1] * mixingPos[i + 1]) >> overlapDividerBits;
}
- // Normalize result by dividing by sqrt(norm) - this step is easiest
+ // Normalize result by dividing by sqrt(norm) - this step is easiest
// done using floating point operation
- if(norm == 0) norm = 1; // to avoid div by zero
+ if (norm == 0) norm = 1; // to avoid div by zero
return (long)((double)corr * SHRT_MAX / sqrt((double)norm));
}
@@ -958,7 +944,7 @@ void TDStretch::precalcCorrReferenceStereo()
int i, cnt2;
float temp;
- for(i = 0 ; i < (int)overlapLength ; i ++)
+ for (i=0 ; i < (int)overlapLength ;i ++)
{
temp = (float)i * (float)(overlapLength - i);
cnt2 = i * 2;
@@ -975,7 +961,7 @@ void TDStretch::precalcCorrReferenceMono()
int i;
float temp;
- for(i = 0 ; i < (int)overlapLength ; i ++)
+ for (i=0 ; i < (int)overlapLength ;i ++)
{
temp = (float)i * (float)(overlapLength - i);
pRefMidBuffer[i] = (float)(pMidBuffer[i] * temp);
@@ -994,7 +980,7 @@ void TDStretch::overlapStereo(float *pOutput, const float *pInput) const
fScale = 1.0f / (float)overlapLength;
- for(i = 0; i < (int)overlapLength ; i ++)
+ for (i = 0; i < (int)overlapLength ; i ++)
{
fTemp = (float)(overlapLength - i) * fScale;
fi = (float)i * fScale;
@@ -1012,7 +998,7 @@ void TDStretch::calculateOverlapLength(int overlapInMsec)
assert(overlapInMsec >= 0);
newOvl = (sampleRate * overlapInMsec) / 1000;
- if(newOvl < 16) newOvl = 16;
+ if (newOvl < 16) newOvl = 16;
// must be divisible by 8
newOvl -= newOvl % 8;
@@ -1029,13 +1015,13 @@ double TDStretch::calcCrossCorrMono(const float *mixingPos, const float *compare
int i;
corr = norm = 0;
- for(i = 1; i < overlapLength; i ++)
+ for (i = 1; i < overlapLength; i ++)
{
corr += mixingPos[i] * compare[i];
norm += mixingPos[i] * mixingPos[i];
}
- if(norm < 1e-9) norm = 1.0; // to avoid div by zero
+ if (norm < 1e-9) norm = 1.0; // to avoid div by zero
return corr / sqrt(norm);
}
@@ -1047,15 +1033,15 @@ double TDStretch::calcCrossCorrStereo(const float *mixingPos, const float *compa
int i;
corr = norm = 0;
- for(i = 2; i < 2 * overlapLength; i += 2)
+ for (i = 2; i < 2 * overlapLength; i += 2)
{
corr += mixingPos[i] * compare[i] +
mixingPos[i + 1] * compare[i + 1];
- norm += mixingPos[i] * mixingPos[i] +
+ norm += mixingPos[i] * mixingPos[i] +
mixingPos[i + 1] * mixingPos[i + 1];
}
- if(norm < 1e-9) norm = 1.0; // to avoid div by zero
+ if (norm < 1e-9) norm = 1.0; // to avoid div by zero
return corr / sqrt(norm);
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.h
index fc035d5b5..00d1f3e31 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/TDStretch.h
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
-///
-/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
-/// while maintaining the original pitch by using a time domain WSOLA-like method
+///
+/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
+/// while maintaining the original pitch by using a time domain WSOLA-like method
/// with several performance-increasing tweaks.
///
-/// Note : MMX/SSE optimized functions reside in separate, platform-specific files
+/// Note : MMX/SSE optimized functions reside in separate, platform-specific files
/// 'mmx_optimized.cpp' and 'sse_optimized.cpp'
///
/// Author : Copyright (c) Olli Parviainen
@@ -53,14 +53,14 @@ namespace soundtouch
{
/// Default values for sound processing parameters:
-/// Notice that the default parameters are tuned for contemporary popular music
+/// Notice that the default parameters are tuned for contemporary popular music
/// processing. For speech processing applications these parameters suit better:
/// #define DEFAULT_SEQUENCE_MS 40
/// #define DEFAULT_SEEKWINDOW_MS 15
/// #define DEFAULT_OVERLAP_MS 8
///
-/// Default length of a single processing sequence, in milliseconds. This determines to how
+/// Default length of a single processing sequence, in milliseconds. This determines to how
/// long sequences the original sound is chopped in the time-stretch algorithm.
///
/// The larger this value is, the lesser sequences are used in processing. In principle
@@ -75,15 +75,15 @@ namespace soundtouch
/// according to tempo setting (recommended)
#define USE_AUTO_SEQUENCE_LEN 0
-/// Seeking window default length in milliseconds for algorithm that finds the best possible
-/// overlapping location. This determines from how wide window the algorithm may look for an
-/// optimal joining location when mixing the sound sequences back together.
+/// Seeking window default length in milliseconds for algorithm that finds the best possible
+/// overlapping location. This determines from how wide window the algorithm may look for an
+/// optimal joining location when mixing the sound sequences back together.
///
/// The bigger this window setting is, the higher the possibility to find a better mixing
/// position will become, but at the same time large values may cause a "drifting" artifact
/// because consequent sequences will be taken at more uneven intervals.
///
-/// If there's a disturbing artifact that sounds as if a constant frequency was drifting
+/// If there's a disturbing artifact that sounds as if a constant frequency was drifting
/// around, try reducing this setting.
///
/// Increasing this value increases computational burden & vice versa.
@@ -94,11 +94,11 @@ namespace soundtouch
/// according to tempo setting (recommended)
#define USE_AUTO_SEEKWINDOW_LEN 0
-/// Overlap length in milliseconds. When the chopped sound sequences are mixed back together,
-/// to form a continuous sound stream, this parameter defines over how long period the two
-/// consecutive sequences are let to overlap each other.
+/// Overlap length in milliseconds. When the chopped sound sequences are mixed back together,
+/// to form a continuous sound stream, this parameter defines over how long period the two
+/// consecutive sequences are let to overlap each other.
///
-/// This shouldn't be that critical parameter. If you reduce the DEFAULT_SEQUENCE_MS setting
+/// This shouldn't be that critical parameter. If you reduce the DEFAULT_SEQUENCE_MS setting
/// by a large amount, you might wish to try a smaller value on this.
///
/// Increasing this value increases computational burden & vice versa.
@@ -167,33 +167,27 @@ protected:
/// The maximum amount of samples that can be returned at a time is set by
/// the 'set_returnBuffer_size' function.
void processSamples();
-
+
public:
TDStretch();
virtual ~TDStretch();
- /// Operator 'new' is overloaded so that it automatically creates a suitable instance
+ /// Operator 'new' is overloaded so that it automatically creates a suitable instance
/// depending on if we've a MMX/SSE/etc-capable CPU available or not.
static void *operator new(size_t s);
- /// Use this function instead of "new" operator to create a new instance of this class.
+ /// Use this function instead of "new" operator to create a new instance of this class.
/// This function automatically chooses a correct feature set depending on if the CPU
/// supports MMX/SSE/etc extensions.
static TDStretch *newInstance();
-
+
/// Returns the output buffer object
- FIFOSamplePipe *getOutput()
- {
- return &outputBuffer;
- };
+ FIFOSamplePipe *getOutput() { return &outputBuffer; };
/// Returns the input buffer object
- FIFOSamplePipe *getInput()
- {
- return &inputBuffer;
- };
+ FIFOSamplePipe *getInput() { return &inputBuffer; };
- /// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower
+ /// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower
/// tempo, larger faster tempo.
void setTempo(float newTempo);
@@ -206,7 +200,7 @@ public:
/// Sets the number of channels, 1 = mono, 2 = stereo
void setChannels(int numChannels);
- /// Enables/disables the quick position seeking algorithm. Zero to disable,
+ /// Enables/disables the quick position seeking algorithm. Zero to disable,
/// nonzero to enable
void enableQuickSeek(BOOL enable);
@@ -218,14 +212,14 @@ public:
//
/// 'sampleRate' = sample rate of the sound
/// 'sequenceMS' = one processing sequence length in milliseconds
- /// 'seekwindowMS' = seeking window length for scanning the best overlapping
+ /// 'seekwindowMS' = seeking window length for scanning the best overlapping
/// position
/// 'overlapMS' = overlapping length
void setParameters(int sampleRate, ///< Samplerate of sound being processed (Hz)
int sequenceMS = -1, ///< Single processing sequence length (ms)
int seekwindowMS = -1, ///< Offset seeking window length (ms)
int overlapMS = -1 ///< Sequence overlapping length (ms)
- );
+ );
/// Get routine control parameters, see setParameters() function.
/// Any of the parameters to this function can be NULL, in such case corresponding parameter
@@ -235,10 +229,10 @@ public:
/// Adds 'numsamples' pcs of samples from the 'samples' memory position into
/// the input of the object.
virtual void putSamples(
- const SAMPLETYPE *samples, ///< Input sample data
- uint numSamples ///< Number of samples in 'samples' so that one sample
- ///< contains both channels if stereo
- );
+ const SAMPLETYPE *samples, ///< Input sample data
+ uint numSamples ///< Number of samples in 'samples' so that one sample
+ ///< contains both channels if stereo
+ );
};
@@ -246,34 +240,34 @@ public:
// Implementation-specific class declarations:
#ifdef ALLOW_MMX
-/// Class that implements MMX optimized routines for 16bit integer samples type.
-class TDStretchMMX : public TDStretch
-{
-protected:
- long calcCrossCorrStereo(const short *mixingPos, const short *compare) const;
- virtual void overlapStereo(short *output, const short *input) const;
- virtual void clearCrossCorrState();
-};
+ /// Class that implements MMX optimized routines for 16bit integer samples type.
+ class TDStretchMMX : public TDStretch
+ {
+ protected:
+ long calcCrossCorrStereo(const short *mixingPos, const short *compare) const;
+ virtual void overlapStereo(short *output, const short *input) const;
+ virtual void clearCrossCorrState();
+ };
#endif /// ALLOW_MMX
#ifdef ALLOW_3DNOW
-/// Class that implements 3DNow! optimized routines for floating point samples type.
-class TDStretch3DNow : public TDStretch
-{
-protected:
- double calcCrossCorrStereo(const float *mixingPos, const float *compare) const;
-};
+ /// Class that implements 3DNow! optimized routines for floating point samples type.
+ class TDStretch3DNow : public TDStretch
+ {
+ protected:
+ double calcCrossCorrStereo(const float *mixingPos, const float *compare) const;
+ };
#endif /// ALLOW_3DNOW
#ifdef ALLOW_SSE
-/// Class that implements SSE optimized routines for floating point samples type.
-class TDStretchSSE : public TDStretch
-{
-protected:
- double calcCrossCorrStereo(const float *mixingPos, const float *compare) const;
-};
+ /// Class that implements SSE optimized routines for floating point samples type.
+ class TDStretchSSE : public TDStretch
+ {
+ protected:
+ double calcCrossCorrStereo(const float *mixingPos, const float *compare) const;
+ };
#endif /// ALLOW_SSE
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/cpu_detect.h b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/cpu_detect.h
index c9f675128..025781dae 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/cpu_detect.h
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/cpu_detect.h
@@ -2,8 +2,8 @@
///
/// A header file for detecting the Intel MMX instructions set extension.
///
-/// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the
-/// routine implementations for x86 Windows, x86 gnu version and non-x86
+/// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the
+/// routine implementations for x86 Windows, x86 gnu version and non-x86
/// platforms, respectively.
///
/// Author : Copyright (c) Olli Parviainen
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp
index d80bbbe46..539ee57c8 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/mmx_optimized.cpp
@@ -1,15 +1,15 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// MMX optimized routines. All MMX optimized functions have been gathered into
-/// this single source code file, regardless to their class or original source
-/// code file, in order to ease porting the library to other compiler and
+/// MMX optimized routines. All MMX optimized functions have been gathered into
+/// this single source code file, regardless to their class or original source
+/// code file, in order to ease porting the library to other compiler and
/// processor platforms.
///
/// The MMX-optimizations are programmed using MMX compiler intrinsics that
/// are supported both by Microsoft Visual C++ and GCC compilers, so this file
/// should compile with both toolsets.
///
-/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++
+/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++
/// 6.0 processor pack" update to support compiler intrinsic syntax. The update
/// is available for download at Microsoft Developers Network, see here:
/// http://msdn.microsoft.com/en-us/vstudio/aa718349.aspx
@@ -79,16 +79,16 @@ long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const
__m64 accu, normaccu;
long corr, norm;
int i;
-
+
pVec1 = (__m64*)pV1;
pVec2 = (__m64*)pV2;
shifter = _m_from_int(overlapDividerBits);
normaccu = accu = _mm_setzero_si64();
- // Process 4 parallel sets of 2 * stereo samples each during each
+ // Process 4 parallel sets of 2 * stereo samples each during each
// round to improve CPU-level parallellization.
- for(i = 0; i < overlapLength / 8; i ++)
+ for (i = 0; i < overlapLength / 8; i ++)
{
__m64 temp, temp2;
@@ -127,9 +127,9 @@ long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const
// Clear MMS state
_m_empty();
- // Normalize result by dividing by sqrt(norm) - this step is easiest
+ // Normalize result by dividing by sqrt(norm) - this step is easiest
// done using floating point operation
- if(norm == 0) norm = 1; // to avoid div by zero
+ if (norm == 0) norm = 1; // to avoid div by zero
return (long)((double)corr * USHRT_MAX / sqrt((double)norm));
// Note: Warning about the missing EMMS instruction is harmless
// as it'll be called elsewhere.
@@ -161,7 +161,7 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const
// mix1 = mixer values for 1st stereo sample
// mix1 = mixer values for 2nd stereo sample
// adder = adder for updating mixer values after each round
-
+
mix1 = _mm_set_pi16(0, overlapLength, 0, overlapLength);
adder = _mm_set_pi16(1, -1, 1, -1);
mix2 = _mm_add_pi16(mix1, adder);
@@ -171,10 +171,10 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const
// overlapDividerBits calculation earlier.
shifter = _m_from_int(overlapDividerBits + 1);
- for(i = 0; i < overlapLength / 4; i ++)
+ for (i = 0; i < overlapLength / 4; i ++)
{
__m64 temp1, temp2;
-
+
// load & shuffle data so that input & mixbuffer data samples are paired
temp1 = _mm_unpacklo_pi16(pVMidBuf[0], pVinput[0]); // = i0l m0l i0r m0r
temp2 = _mm_unpackhi_pi16(pVMidBuf[0], pVinput[0]); // = i1l m1l i1r m1r
@@ -244,8 +244,8 @@ void FIRFilterMMX::setCoefficients(const short *coeffs, uint newLength, uint uRe
filterCoeffsUnalign = new short[2 * newLength + 8];
filterCoeffsAlign = (short *)(((ulong)filterCoeffsUnalign + 15) & -16);
- // rearrange the filter coefficients for mmx routines
- for(i = 0; i < length; i += 4)
+ // rearrange the filter coefficients for mmx routines
+ for (i = 0;i < length; i += 4)
{
filterCoeffsAlign[2 * i + 0] = coeffs[i + 0];
filterCoeffsAlign[2 * i + 1] = coeffs[i + 2];
@@ -268,9 +268,9 @@ uint FIRFilterMMX::evaluateFilterStereo(short *dest, const short *src, uint numS
uint i, j;
__m64 *pVdest = (__m64*)dest;
- if(length < 2) return 0;
+ if (length < 2) return 0;
- for(i = 0; i < (numSamples - length) / 2; i ++)
+ for (i = 0; i < (numSamples - length) / 2; i ++)
{
__m64 accu1;
__m64 accu2;
@@ -278,7 +278,7 @@ uint FIRFilterMMX::evaluateFilterStereo(short *dest, const short *src, uint numS
const __m64 *pVfilter = (const __m64*)filterCoeffsAlign;
accu1 = accu2 = _mm_setzero_si64();
- for(j = 0; j < lengthDiv8 * 2; j ++)
+ for (j = 0; j < lengthDiv8 * 2; j ++)
{
__m64 temp1, temp2;
@@ -312,7 +312,7 @@ uint FIRFilterMMX::evaluateFilterStereo(short *dest, const short *src, uint numS
pVdest ++;
}
- _m_empty(); // clear emms state
+ _m_empty(); // clear emms state
return (numSamples & 0xfffffffe) - length;
}
diff --git a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/sse_optimized.cpp b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/sse_optimized.cpp
index 79d45cb8c..7659be682 100644
--- a/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/sse_optimized.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/SoundTouch/source/sse_optimized.cpp
@@ -1,20 +1,20 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// SSE optimized routines for Pentium-III, Athlon-XP and later CPUs. All SSE
-/// optimized functions have been gathered into this single source
-/// code file, regardless to their class or original source code file, in order
+/// SSE optimized routines for Pentium-III, Athlon-XP and later CPUs. All SSE
+/// optimized functions have been gathered into this single source
+/// code file, regardless to their class or original source code file, in order
/// to ease porting the library to other compiler and processor platforms.
///
/// The SSE-optimizations are programmed using SSE compiler intrinsics that
/// are supported both by Microsoft Visual C++ and GCC compilers, so this file
/// should compile with both toolsets.
///
-/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++
-/// 6.0 processor pack" update to support SSE instruction set. The update is
+/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++
+/// 6.0 processor pack" update to support SSE instruction set. The update is
/// available for download at Microsoft Developers Network, see here:
/// http://msdn.microsoft.com/en-us/vstudio/aa718349.aspx
///
-/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and
+/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and
/// perform a search with keywords "processor pack".
///
/// Author : Copyright (c) Olli Parviainen
@@ -58,7 +58,7 @@ using namespace soundtouch;
#ifdef ALLOW_SSE
-// SSE routines available only with float sample type
+// SSE routines available only with float sample type
//////////////////////////////////////////////////////////////////////////////
//
@@ -78,8 +78,8 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
const __m128 *pVec2;
__m128 vSum, vNorm;
- // Note. It means a major slow-down if the routine needs to tolerate
- // unaligned __m128 memory accesses. It's way faster if we can skip
+ // Note. It means a major slow-down if the routine needs to tolerate
+ // unaligned __m128 memory accesses. It's way faster if we can skip
// unaligned slots and use _mm_load_ps instruction instead of _mm_loadu_ps.
// This can mean up to ~ 10-fold difference (incl. part of which is
// due to skipping every second round for stereo sound though).
@@ -88,18 +88,18 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
// for choosing if this little cheating is allowed.
#ifdef ALLOW_NONEXACT_SIMD_OPTIMIZATION
- // Little cheating allowed, return valid correlation only for
+ // Little cheating allowed, return valid correlation only for
// aligned locations, meaning every second round for stereo sound.
-#define _MM_LOAD _mm_load_ps
+ #define _MM_LOAD _mm_load_ps
- if(((ulong)pV1) & 15) return -1e50; // skip unaligned locations
+ if (((ulong)pV1) & 15) return -1e50; // skip unaligned locations
#else
// No cheating allowed, use unaligned load & take the resulting
// performance hit.
-#define _MM_LOAD _mm_loadu_ps
-#endif
+ #define _MM_LOAD _mm_loadu_ps
+#endif
// ensure overlapLength is divisible by 8
assert((overlapLength % 8) == 0);
@@ -111,28 +111,28 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
vSum = vNorm = _mm_setzero_ps();
// Unroll the loop by factor of 4 * 4 operations
- for(i = 0; i < overlapLength / 8; i ++)
+ for (i = 0; i < overlapLength / 8; i ++)
{
__m128 vTemp;
// vSum += pV1[0..3] * pV2[0..3]
vTemp = _MM_LOAD(pVec1);
- vSum = _mm_add_ps(vSum, _mm_mul_ps(vTemp , pVec2[0]));
- vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp , vTemp));
+ vSum = _mm_add_ps(vSum, _mm_mul_ps(vTemp ,pVec2[0]));
+ vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp ,vTemp));
// vSum += pV1[4..7] * pV2[4..7]
vTemp = _MM_LOAD(pVec1 + 4);
vSum = _mm_add_ps(vSum, _mm_mul_ps(vTemp, pVec2[1]));
- vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp , vTemp));
+ vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp ,vTemp));
// vSum += pV1[8..11] * pV2[8..11]
vTemp = _MM_LOAD(pVec1 + 8);
vSum = _mm_add_ps(vSum, _mm_mul_ps(vTemp, pVec2[2]));
- vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp , vTemp));
+ vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp ,vTemp));
// vSum += pV1[12..15] * pV2[12..15]
vTemp = _MM_LOAD(pVec1 + 12);
vSum = _mm_add_ps(vSum, _mm_mul_ps(vTemp, pVec2[3]));
- vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp , vTemp));
+ vNorm = _mm_add_ps(vNorm, _mm_mul_ps(vTemp ,vTemp));
pVec1 += 16;
pVec2 += 4;
@@ -141,7 +141,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
// return value = vSum[0] + vSum[1] + vSum[2] + vSum[3]
float *pvNorm = (float*)&vNorm;
double norm = sqrt(pvNorm[0] + pvNorm[1] + pvNorm[2] + pvNorm[3]);
- if(norm < 1e-9) norm = 1.0; // to avoid div by zero
+ if (norm < 1e-9) norm = 1.0; // to avoid div by zero
float *pvSum = (float*)&vSum;
return (double)(pvSum[0] + pvSum[1] + pvSum[2] + pvSum[3]) / norm;
@@ -152,7 +152,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
// Calculates the cross-correlation value between 'pV1' and 'pV2' vectors
corr = norm = 0.0;
- for (i = 0; i < overlapLength / 8; i ++)
+ for (i = 0; i < overlapLength / 8; i ++)
{
corr += pV1[0] * pV2[0] +
pV1[1] * pV2[1] +
@@ -171,7 +171,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
pV1[14] * pV2[14] +
pV1[15] * pV2[15];
- for (j = 0; j < 15; j ++) norm += pV1[j] * pV1[j];
+ for (j = 0; j < 15; j ++) norm += pV1[j] * pV1[j];
pV1 += 16;
pV2 += 16;
@@ -186,9 +186,9 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
uint overlapLengthLocal = overlapLength;
float corr;
- _asm
+ _asm
{
- // Very important note: data in 'pV2' _must_ be aligned to
+ // Very important note: data in 'pV2' _must_ be aligned to
// 16-byte boundary!
// give prefetch hints to CPU of what data are to be needed soonish
@@ -234,7 +234,7 @@ double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) con
dec ecx
jnz loop1
- // add the four floats of xmm0 together and return the result.
+ // add the four floats of xmm0 together and return the result.
movhlps xmm1, xmm0 // move 3 & 4 of xmm0 to 1 & 2 of xmm1
addps xmm1, xmm0
@@ -285,15 +285,15 @@ void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uRe
// Ensure that filter coeffs array is aligned to 16-byte boundary
delete[] filterCoeffsUnalign;
filterCoeffsUnalign = new float[2 * newLength + 4];
- filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15) & (ulong) - 16);
+ filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15) & (ulong)-16);
fDivider = (float)resultDivider;
- // rearrange the filter coefficients for mmx routines
- for(i = 0; i < newLength; i ++)
+ // rearrange the filter coefficients for mmx routines
+ for (i = 0; i < newLength; i ++)
{
filterCoeffsAlign[2 * i + 0] =
- filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider;
+ filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider;
}
}
@@ -302,12 +302,12 @@ void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uRe
// SSE-optimized version of the filter routine for stereo sound
uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint numSamples) const
{
- int count = (int)((numSamples - length) & (uint) - 2);
+ int count = (int)((numSamples - length) & (uint)-2);
int j;
assert(count % 2 == 0);
- if(count < 2) return 0;
+ if (count < 2) return 0;
assert(source != NULL);
assert(dest != NULL);
@@ -316,7 +316,7 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n
assert(((ulong)filterCoeffsAlign) % 16 == 0);
// filter is evaluated for two stereo samples with each iteration, thus use of 'j += 2'
- for(j = 0; j < count; j += 2)
+ for (j = 0; j < count; j += 2)
{
const float *pSrc;
const __m128 *pFil;
@@ -324,13 +324,13 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n
uint i;
pSrc = (const float*)source; // source audio data
- pFil = (const __m128*)filterCoeffsAlign; // filter coefficients. NOTE: Assumes coefficients
- // are aligned to 16-byte boundary
+ pFil = (const __m128*)filterCoeffsAlign; // filter coefficients. NOTE: Assumes coefficients
+ // are aligned to 16-byte boundary
sum1 = sum2 = _mm_setzero_ps();
- for(i = 0; i < length / 8; i ++)
+ for (i = 0; i < length / 8; i ++)
{
- // Unroll loop for efficiency & calculate filter for 2*2 stereo samples
+ // Unroll loop for efficiency & calculate filter for 2*2 stereo samples
// at each pass
// sum1 is accu for 2*2 filtered stereo sound data at the primary sound data offset
@@ -357,22 +357,22 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n
// post-shuffle & add the filtered values and store to dest.
_mm_storeu_ps(dest, _mm_add_ps(
- _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(1, 0, 3, 2)), // s2_1 s2_0 s1_3 s1_2
- _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(3, 2, 1, 0)) // s2_3 s2_2 s1_1 s1_0
- ));
+ _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(1,0,3,2)), // s2_1 s2_0 s1_3 s1_2
+ _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(3,2,1,0)) // s2_3 s2_2 s1_1 s1_0
+ ));
source += 4;
dest += 4;
}
// Ideas for further improvement:
- // 1. If it could be guaranteed that 'source' were always aligned to 16-byte
+ // 1. If it could be guaranteed that 'source' were always aligned to 16-byte
// boundary, a faster aligned '_mm_load_ps' instruction could be used.
- // 2. If it could be guaranteed that 'dest' were always aligned to 16-byte
+ // 2. If it could be guaranteed that 'dest' were always aligned to 16-byte
// boundary, a faster '_mm_store_ps' instruction could be used.
return (uint)count;
- /* original routine in C-language. please notice the C-version has differently
+ /* original routine in C-language. please notice the C-version has differently
organized coefficients though.
double suml1, suml2;
double sumr1, sumr2;
@@ -387,26 +387,26 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n
suml2 = sumr2 = 0.0;
ptr = src;
pFil = filterCoeffs;
- for (i = 0; i < lengthLocal; i ++)
+ for (i = 0; i < lengthLocal; i ++)
{
// unroll loop for efficiency.
- suml1 += ptr[0] * pFil[0] +
+ suml1 += ptr[0] * pFil[0] +
ptr[2] * pFil[2] +
ptr[4] * pFil[4] +
ptr[6] * pFil[6];
- sumr1 += ptr[1] * pFil[1] +
+ sumr1 += ptr[1] * pFil[1] +
ptr[3] * pFil[3] +
ptr[5] * pFil[5] +
ptr[7] * pFil[7];
- suml2 += ptr[8] * pFil[0] +
+ suml2 += ptr[8] * pFil[0] +
ptr[10] * pFil[2] +
ptr[12] * pFil[4] +
ptr[14] * pFil[6];
- sumr2 += ptr[9] * pFil[1] +
+ sumr2 += ptr[9] * pFil[1] +
ptr[11] * pFil[3] +
ptr[13] * pFil[5] +
ptr[15] * pFil[7];
@@ -428,7 +428,7 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n
/* Similar routine in assembly, again obsoleted due to maintainability
_asm
{
- // Very important note: data in 'src' _must_ be aligned to
+ // Very important note: data in 'src' _must_ be aligned to
// 16-byte boundary!
mov edx, count
mov ebx, dword ptr src
diff --git a/src/filters/renderer/MpcAudioRenderer/resource.h b/src/filters/renderer/MpcAudioRenderer/resource.h
index fd81d8a9a..ea5e32fc3 100644
--- a/src/filters/renderer/MpcAudioRenderer/resource.h
+++ b/src/filters/renderer/MpcAudioRenderer/resource.h
@@ -19,7 +19,7 @@
#define IDS_MPA_DYNRANGE 33156
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
diff --git a/src/filters/renderer/MpcAudioRenderer/stdafx.cpp b/src/filters/renderer/MpcAudioRenderer/stdafx.cpp
index 0ac102726..c046a694e 100644
--- a/src/filters/renderer/MpcAudioRenderer/stdafx.cpp
+++ b/src/filters/renderer/MpcAudioRenderer/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
diff --git a/src/filters/renderer/MpcAudioRenderer/stdafx.h b/src/filters/renderer/MpcAudioRenderer/stdafx.h
index 2ddc1a553..4f2979b53 100644
--- a/src/filters/renderer/MpcAudioRenderer/stdafx.h
+++ b/src/filters/renderer/MpcAudioRenderer/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
diff --git a/src/filters/source/BaseSource/BaseSource.cpp b/src/filters/source/BaseSource/BaseSource.cpp
index b5cf0c708..00ab0cc8e 100644
--- a/src/filters/source/BaseSource/BaseSource.cpp
+++ b/src/filters/source/BaseSource/BaseSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -31,68 +31,68 @@
// CBaseStream
//
-CBaseStream::CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr)
- : CSourceStream(name, phr, pParent, L"Output")
- , CSourceSeeking(name, (IPin*)this, phr, &m_cSharedState)
- , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
+CBaseStream::CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr)
+ : CSourceStream(name, phr, pParent, L"Output")
+ , CSourceSeeking(name, (IPin*)this, phr, &m_cSharedState)
+ , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
- m_AvgTimePerFrame = 0;
- m_rtDuration = 0;
- m_rtStop = m_rtDuration;
+ m_AvgTimePerFrame = 0;
+ m_rtDuration = 0;
+ m_rtStop = m_rtDuration;
}
CBaseStream::~CBaseStream()
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
}
STDMETHODIMP CBaseStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv)
- : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+ return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv)
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
void CBaseStream::UpdateFromSeek()
{
- if(ThreadExists())
- {
- // next time around the loop, the worker thread will
- // pick up the position change.
- // We need to flush all the existing data - we must do that here
- // as our thread will probably be blocked in GetBuffer otherwise
-
- m_bFlushing = TRUE;
-
- DeliverBeginFlush();
- // make sure we have stopped pushing
- Stop();
- // complete the flush
- DeliverEndFlush();
+ if(ThreadExists())
+ {
+ // next time around the loop, the worker thread will
+ // pick up the position change.
+ // We need to flush all the existing data - we must do that here
+ // as our thread will probably be blocked in GetBuffer otherwise
+
+ m_bFlushing = TRUE;
+
+ DeliverBeginFlush();
+ // make sure we have stopped pushing
+ Stop();
+ // complete the flush
+ DeliverEndFlush();
m_bFlushing = FALSE;
- // restart
- Run();
- }
+ // restart
+ Run();
+ }
}
HRESULT CBaseStream::SetRate(double dRate)
{
- if(dRate <= 0)
- return E_INVALIDARG;
+ if(dRate <= 0)
+ return E_INVALIDARG;
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- m_dRateSeeking = dRate;
- }
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_dRateSeeking = dRate;
+ }
- UpdateFromSeek();
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CBaseStream::OnThreadStartPlay()
@@ -105,8 +105,8 @@ HRESULT CBaseStream::ChangeStart()
{
{
CAutoLock lock(CSourceSeeking::m_pLock);
- m_rtSampleTime = 0;
- m_rtPosition = m_rtStart;
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
}
UpdateFromSeek();
@@ -119,7 +119,7 @@ HRESULT CBaseStream::ChangeStop()
{
CAutoLock lock(CSourceSeeking::m_pLock);
if(m_rtPosition < m_rtStop)
- return S_OK;
+ return S_OK;
}
// We're already past the new stop time -- better flush the graph.
@@ -140,49 +140,49 @@ HRESULT CBaseStream::OnThreadCreate()
HRESULT CBaseStream::FillBuffer(IMediaSample* pSample)
{
- HRESULT hr;
+ HRESULT hr;
- {
- CAutoLock cAutoLockShared(&m_cSharedState);
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
if(m_rtPosition >= m_rtStop)
- return S_FALSE;
+ return S_FALSE;
- BYTE* pOut = NULL;
- if(FAILED(hr = pSample->GetPointer(&pOut)) || !pOut)
- return S_FALSE;
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pOut)) || !pOut)
+ return S_FALSE;
- int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
+ int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
- long len = pSample->GetSize();
+ long len = pSample->GetSize();
- hr = FillBuffer(pSample, nFrame, pOut, len);
- if(hr != S_OK) return hr;
+ hr = FillBuffer(pSample, nFrame, pOut, len);
+ if(hr != S_OK) return hr;
- pSample->SetActualDataLength(len);
+ pSample->SetActualDataLength(len);
- REFERENCE_TIME rtStart, rtStop;
+ REFERENCE_TIME rtStart, rtStop;
// The sample times are modified by the current rate.
rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
- pSample->SetTime(&rtStart, &rtStop);
+ pSample->SetTime(&rtStart, &rtStop);
m_rtSampleTime += m_AvgTimePerFrame;
m_rtPosition += m_AvgTimePerFrame;
- }
+ }
- pSample->SetSyncPoint(TRUE);
+ pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity)
+ if(m_bDiscontinuity)
{
- pSample->SetDiscontinuity(TRUE);
- m_bDiscontinuity = FALSE;
- }
+ pSample->SetDiscontinuity(TRUE);
+ m_bDiscontinuity = FALSE;
+ }
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CBaseStream::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
diff --git a/src/filters/source/BaseSource/BaseSource.h b/src/filters/source/BaseSource/BaseSource.h
index 07eed8751..91e2ccdb8 100644
--- a/src/filters/source/BaseSource/BaseSource.h
+++ b/src/filters/source/BaseSource/BaseSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,102 +25,99 @@
template<class TStream>
class CBaseSource
- : public CSource
- , public IFileSourceFilter
- , public IAMFilterMiscFlags
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
{
protected:
- CStringW m_fn;
+ CStringW m_fn;
public:
- CBaseSource(TCHAR* name, LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
- : CSource(name, lpunk, clsid)
- {
- if(phr) *phr = S_OK;
- }
+ CBaseSource(TCHAR* name, LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
+ : CSource(name, lpunk, clsid)
+ {
+ if(phr) *phr = S_OK;
+ }
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
- {
- CheckPointer(ppv, E_POINTER);
-
- return
- QI(IFileSourceFilter)
- QI(IAMFilterMiscFlags)
- __super::NonDelegatingQueryInterface(riid, ppv);
- }
+ {
+ CheckPointer(ppv, E_POINTER);
- // IFileSourceFilter
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+ }
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
- {
- // TODO: destroy any already existing pins and create new, now we are just going die nicely instead of doing it :)
- if(GetPinCount() > 0)
- return VFW_E_ALREADY_CONNECTED;
+ // IFileSourceFilter
- HRESULT hr = S_OK;
- if(!(DNew TStream(pszFileName, this, &hr)))
- return E_OUTOFMEMORY;
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+ {
+ // TODO: destroy any already existing pins and create new, now we are just going die nicely instead of doing it :)
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
- if(FAILED(hr))
- return hr;
+ HRESULT hr = S_OK;
+ if(!(DNew TStream(pszFileName, this, &hr)))
+ return E_OUTOFMEMORY;
- m_fn = pszFileName;
+ if(FAILED(hr))
+ return hr;
- return S_OK;
- }
+ m_fn = pszFileName;
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
- {
- size_t nCount;
- if(!ppszFileName) return E_POINTER;
+ return S_OK;
+ }
- nCount = m_fn.GetLength() + 1;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc(nCount * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+ {
+ size_t nCount;
+ if(!ppszFileName) return E_POINTER;
+
+ nCount = m_fn.GetLength()+1;
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc(nCount*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- wcscpy_s(*ppszFileName, nCount, m_fn);
+ wcscpy_s(*ppszFileName, nCount, m_fn);
- return S_OK;
- }
+ return S_OK;
+ }
- // IAMFilterMiscFlags
+ // IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags()
- {
- return AM_FILTER_MISC_FLAGS_IS_SOURCE;
- }
+ STDMETHODIMP_(ULONG) GetMiscFlags()
+ {
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+ }
};
-class CBaseStream
- : public CSourceStream
- , public CSourceSeeking
+class CBaseStream
+ : public CSourceStream
+ , public CSourceSeeking
{
protected:
- CCritSec m_cSharedState;
+ CCritSec m_cSharedState;
- REFERENCE_TIME m_AvgTimePerFrame;
- REFERENCE_TIME m_rtSampleTime, m_rtPosition;
+ REFERENCE_TIME m_AvgTimePerFrame;
+ REFERENCE_TIME m_rtSampleTime, m_rtPosition;
- BOOL m_bDiscontinuity, m_bFlushing;
+ BOOL m_bDiscontinuity, m_bFlushing;
- HRESULT OnThreadStartPlay();
- HRESULT OnThreadCreate();
+ HRESULT OnThreadStartPlay();
+ HRESULT OnThreadCreate();
private:
- void UpdateFromSeek();
- STDMETHODIMP SetRate(double dRate);
+ void UpdateFromSeek();
+ STDMETHODIMP SetRate(double dRate);
- HRESULT ChangeStart();
+ HRESULT ChangeStart();
HRESULT ChangeStop();
- HRESULT ChangeRate()
- {
- return S_OK;
- }
+ HRESULT ChangeRate() {return S_OK;}
public:
CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr);
- virtual ~CBaseStream();
+ virtual ~CBaseStream();
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
@@ -128,5 +125,5 @@ public:
virtual HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/) = 0;
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/BaseSource/stdafx.cpp b/src/filters/source/BaseSource/stdafx.cpp
index 8c08467b1..7407b6b89 100644
--- a/src/filters/source/BaseSource/stdafx.cpp
+++ b/src/filters/source/BaseSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/BaseSource/stdafx.h b/src/filters/source/BaseSource/stdafx.h
index 2bec11afc..22cb54295 100644
--- a/src/filters/source/BaseSource/stdafx.h
+++ b/src/filters/source/BaseSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/D2VSource/D2VSource.cpp b/src/filters/source/D2VSource/D2VSource.cpp
index 088aa3fdd..6806e440f 100644
--- a/src/filters/source/D2VSource/D2VSource.cpp
+++ b/src/filters/source/D2VSource/D2VSource.cpp
@@ -1,19 +1,19 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
*
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
@@ -26,49 +26,49 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2}
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2}
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CD2VSource), L"MPC - D2VSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CD2VSource), L"MPC - D2VSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CD2VSource>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CD2VSource>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
- _T("0"), _T("0,18,,4456443241564950726F6A65637446696C65")); // "DVD2AVIProjectFile"
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("0"), _T("0,18,,4456443241564950726F6A65637446696C65")); // "DVD2AVIProjectFile"
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
- _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".d2v"),
- _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".d2v"),
+ _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".d2v"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".d2v"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -82,9 +82,9 @@ CFilterApp theApp;
//
CD2VSource::CD2VSource(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
+ : CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CD2VSource::~CD2VSource()
@@ -95,40 +95,40 @@ CD2VSource::~CD2VSource()
// CD2VStream
//
-CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
- : CBaseStream(NAME("D2VSourceStream"), pParent, phr)
- , m_pFrameBuffer(NULL)
+CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
+ : CBaseStream(NAME("D2VSourceStream"), pParent, phr)
+ , m_pFrameBuffer(NULL)
{
- CAutoLock cAutoLock(&m_cSharedState);
-
- m_pDecoder.Attach(DNew CMPEG2Dec());
- if(!m_pDecoder)
- {
- if(phr) *phr = E_OUTOFMEMORY;
- return;
- }
-
- if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2))
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width * m_pDecoder->Clip_Height * 4))
- {
- if(phr) *phr = E_OUTOFMEMORY;
- return;
- }
-
- m_AvgTimePerFrame = 10000000000i64 / m_pDecoder->VF_FrameRate;
- m_rtDuration = m_rtStop = m_AvgTimePerFrame * m_pDecoder->VF_FrameLimit;
-
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ m_pDecoder.Attach(DNew CMPEG2Dec());
+ if(!m_pDecoder)
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width*m_pDecoder->Clip_Height*4))
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ m_AvgTimePerFrame = 10000000000i64/m_pDecoder->VF_FrameRate;
+ m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_pDecoder->VF_FrameLimit;
+
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
CD2VStream::~CD2VStream()
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
}
HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -140,12 +140,12 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
HRESULT hr = NOERROR;
- int w, h, bpp;
- if(!GetDim(w, h, bpp))
- return E_FAIL;
+ int w, h, bpp;
+ if(!GetDim(w, h, bpp))
+ return E_FAIL;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = w * h * bpp >> 3;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = w*h*bpp>>3;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -158,41 +158,41 @@ HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES
HRESULT CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
{
- if(!m_pDecoder)
- return S_FALSE;
+ if(!m_pDecoder)
+ return S_FALSE;
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- SetMediaType(&mt);
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
+ DeleteMediaType(pmt);
+ }
- int w, h, bpp;
- if(!GetDim(w, h, bpp))
- return S_FALSE;
+ int w, h, bpp;
+ if(!GetDim(w, h, bpp))
+ return S_FALSE;
- BYTE* pIn = m_pFrameBuffer;
+ BYTE* pIn = m_pFrameBuffer;
- int pitchIn, pitchOut = 0;
+ int pitchIn, pitchOut = 0;
- pitchIn = m_pDecoder->Clip_Width * bpp >> 3;
- pitchOut = w * bpp >> 3;
+ pitchIn = m_pDecoder->Clip_Width*bpp>>3;
+ pitchOut = w*bpp>>3;
- m_pDecoder->Decode(pIn, (unsigned long)(nFrame), pitchIn);
+ m_pDecoder->Decode(pIn, (unsigned long)(nFrame), pitchIn);
- for(int y = 0, p = min(pitchIn, pitchOut);
- y < h;
- y++, pIn += pitchIn, pOut += pitchOut)
- {
- memcpy(pOut, pIn, p);
- }
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pIn += pitchIn, pOut += pitchOut)
+ {
+ memcpy(pOut, pIn, p);
+ }
- len = pitchOut * h;
+ len = pitchOut*h;
- return S_OK;
+ return S_OK;
}
HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
@@ -207,77 +207,77 @@ HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->SetFormatType(&FORMAT_VideoInfo);
pmt->SetTemporalCompression(FALSE);
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
- vih->AvgTimePerFrame = m_AvgTimePerFrame;
- vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
- vih->bmiHeader.biWidth = m_pDecoder->Clip_Width;
- vih->bmiHeader.biHeight = m_pDecoder->Clip_Height;
- vih->bmiHeader.biPlanes = 1;
- vih->bmiHeader.biBitCount = 16;
- vih->bmiHeader.biCompression = '2YUY';
- vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth * abs(vih->bmiHeader.biHeight) * vih->bmiHeader.biBitCount >> 3;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->AvgTimePerFrame = m_AvgTimePerFrame;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = m_pDecoder->Clip_Width;
+ vih->bmiHeader.biHeight = m_pDecoder->Clip_Height;
+ vih->bmiHeader.biPlanes = 1;
+ vih->bmiHeader.biBitCount = 16;
+ vih->bmiHeader.biCompression = '2YUY';
+ vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth*abs(vih->bmiHeader.biHeight)*vih->bmiHeader.biBitCount>>3;
- pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
+ pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
return NOERROR;
}
HRESULT CD2VStream::SetMediaType(const CMediaType* pmt)
{
- if(m_pDecoder)
- {
- if(pmt->subtype == MEDIASUBTYPE_YUY2)
- m_pDecoder->m_dstFormat = CMPEG2Dec::YUY2;
- else
- return E_FAIL;
- }
-
- return CSourceStream::SetMediaType(pmt);
+ if(m_pDecoder)
+ {
+ if(pmt->subtype == MEDIASUBTYPE_YUY2)
+ m_pDecoder->m_dstFormat = CMPEG2Dec::YUY2;
+ else
+ return E_FAIL;
+ }
+
+ return CSourceStream::SetMediaType(pmt);
}
HRESULT CD2VStream::CheckMediaType(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Video
- && pmt->subtype == MEDIASUBTYPE_YUY2
- && pmt->formattype == FORMAT_VideoInfo
- ? S_OK
- : E_INVALIDARG;
+ return pmt->majortype == MEDIATYPE_Video
+ && pmt->subtype == MEDIASUBTYPE_YUY2
+ && pmt->formattype == FORMAT_VideoInfo
+ ? S_OK
+ : E_INVALIDARG;
}
STDMETHODIMP CD2VStream::Notify(IBaseFilter* pSender, Quality q)
{
- if(q.Late > 0 && q.Late < 100000000)
- {
- CAutoLock cAutoLockShared(&m_cSharedState);
+ if(q.Late > 0 && q.Late < 100000000)
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
- m_rtSampleTime += (q.Late / m_AvgTimePerFrame) * m_AvgTimePerFrame;
- m_rtPosition += (q.Late / m_AvgTimePerFrame) * m_AvgTimePerFrame;
- }
+ m_rtSampleTime += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ m_rtPosition += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ }
- return S_OK;
+ return S_OK;
}
//
bool CD2VStream::GetDim(int& w, int& h, int& bpp)
{
- if(m_mt.formattype == FORMAT_VideoInfo)
- {
- w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
- h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
- bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
- w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
- h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
- bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else
- {
- return(false);
- }
-
- return(true);
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else
+ {
+ return(false);
+ }
+
+ return(true);
}
diff --git a/src/filters/source/D2VSource/D2VSource.h b/src/filters/source/D2VSource/D2VSource.h
index ac0bddc2d..bf2e18f9a 100644
--- a/src/filters/source/D2VSource/D2VSource.h
+++ b/src/filters/source/D2VSource/D2VSource.h
@@ -1,19 +1,19 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
*
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
@@ -27,8 +27,8 @@ class CD2VStream;
class CD2VSource : public CBaseSource<CD2VStream>
{
public:
- CD2VSource(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CD2VSource();
+ CD2VSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CD2VSource();
};
class CMPEG2Dec;
@@ -36,14 +36,14 @@ class CMPEG2Dec;
class CD2VStream : public CBaseStream
{
private:
- CAutoPtr<CMPEG2Dec> m_pDecoder;
- CAutoVectorPtr<BYTE> m_pFrameBuffer;
+ CAutoPtr<CMPEG2Dec> m_pDecoder;
+ CAutoVectorPtr<BYTE> m_pFrameBuffer;
- bool GetDim(int& w, int& h, int& bpp);
+ bool GetDim(int& w, int& h, int& bpp);
public:
CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr);
- virtual ~CD2VStream();
+ virtual ~CD2VStream();
HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/);
@@ -52,5 +52,5 @@ public:
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
HRESULT SetMediaType(const CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/D2VSource/MPEG2Dec.h b/src/filters/source/D2VSource/MPEG2Dec.h
index aea3f4f07..34368208b 100644
--- a/src/filters/source/D2VSource/MPEG2Dec.h
+++ b/src/filters/source/D2VSource/MPEG2Dec.h
@@ -73,244 +73,232 @@
#define FO_SWAP 2
-typedef void (WINAPI *PBufferOp)(unsigned char*, int, int);
+typedef void (WINAPI *PBufferOp) (unsigned char*, int, int);
#define MAX_FRAME_NUMBER 1000000
#define MAX_GOP_SIZE 1024
-class CMPEG2Dec
+class CMPEG2Dec
{
protected:
- // getbit.cpp
- void Initialize_Buffer();
- void Fill_Buffer();
- void Next_Packet();
- void Flush_Buffer_All(unsigned int N);
- unsigned int Get_Bits_All(unsigned int N);
- void Next_File();
-
- unsigned int Show_Bits(unsigned int N);
- unsigned int Get_Bits(unsigned int N);
- void Flush_Buffer(unsigned int N);
- void Fill_Next();
- unsigned int Get_Byte();
- unsigned int Get_Short();
- void next_start_code();
-
- unsigned char Rdbfr[BUFFER_SIZE], *Rdptr, *Rdmax;
- unsigned int CurrentBfr, NextBfr, BitsLeft, Val, Read;
-
- // gethdr.cpp
- int Get_Hdr();
- void sequence_header();
- int slice_header();
+ // getbit.cpp
+ void Initialize_Buffer();
+ void Fill_Buffer();
+ void Next_Packet();
+ void Flush_Buffer_All(unsigned int N);
+ unsigned int Get_Bits_All(unsigned int N);
+ void Next_File();
+
+ unsigned int Show_Bits(unsigned int N);
+ unsigned int Get_Bits(unsigned int N);
+ void Flush_Buffer(unsigned int N);
+ void Fill_Next();
+ unsigned int Get_Byte();
+ unsigned int Get_Short();
+ void next_start_code();
+
+ unsigned char Rdbfr[BUFFER_SIZE], *Rdptr, *Rdmax;
+ unsigned int CurrentBfr, NextBfr, BitsLeft, Val, Read;
+
+ // gethdr.cpp
+ int Get_Hdr();
+ void sequence_header();
+ int slice_header();
private:
- void group_of_pictures_header();
- void picture_header();
- void sequence_extension();
- void sequence_display_extension();
- void quant_matrix_extension();
- void picture_display_extension();
- void picture_coding_extension();
- void copyright_extension();
- int extra_bit_information();
- void extension_and_user_data();
+ void group_of_pictures_header();
+ void picture_header();
+ void sequence_extension();
+ void sequence_display_extension();
+ void quant_matrix_extension();
+ void picture_display_extension();
+ void picture_coding_extension();
+ void copyright_extension();
+ int extra_bit_information();
+ void extension_and_user_data();
protected:
- // getpic.cpp
- void Decode_Picture(int ref, unsigned char *dst, int pitch);
+ // getpic.cpp
+ void Decode_Picture(int ref, unsigned char *dst, int pitch);
private:
- void Update_Picture_Buffers();
- void picture_data();
- int slice(int MBAmax);
- void macroblock_modes(int *pmacroblock_type, int *pmotion_type,
- int *pmotion_vector_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
- void Clear_Block(int count);
- void Add_Block(int count, int bx, int by, int dct_type, int addflag);
- void motion_compensation(int MBA, int macroblock_type, int motion_type,
- int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2], int dct_type);
- void skipped_macroblock(int dc_dct_pred[3], int PMV[2][2][2],
- int *motion_type, int motion_vertical_field_select[2][2], int *macroblock_type);
- int start_of_slice(int *MBA, int *MBAinc, int dc_dct_pred[3], int PMV[2][2][2]);
- int decode_macroblock(int *macroblock_type, int *motion_type, int *dct_type,
- int PMV[2][2][2], int dc_dct_pred[3], int motion_vertical_field_select[2][2], int dmvector[2]);
- void Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]);
- void Decode_MPEG2_Non_Intra_Block(int comp);
-
- int Get_macroblock_type();
- int Get_I_macroblock_type();
- int Get_P_macroblock_type();
- int Get_B_macroblock_type();
- int Get_D_macroblock_type();
- int Get_coded_block_pattern();
- int Get_macroblock_address_increment();
- int Get_Luma_DC_dct_diff();
- int Get_Chroma_DC_dct_diff();
-
- void form_predictions(int bx, int by, int macroblock_type, int motion_type,
- int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2]);
- void form_prediction(unsigned char *src[], int sfield, unsigned char *dst[], int dfield,
- int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
- void form_component_prediction(unsigned char *src, unsigned char *dst,
- int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
-
- // motion.cpp
- void motion_vectors(int PMV[2][2][2], int dmvector[2], int motion_vertical_field_select[2][2],
- int s, int motion_vector_count, int mv_format,
- int h_r_size, int v_r_size, int dmv, int mvscale);
- void Dual_Prime_Arithmetic(int DMV[][2], int *dmvector, int mvx, int mvy);
+ void Update_Picture_Buffers();
+ void picture_data();
+ int slice(int MBAmax);
+ void macroblock_modes(int *pmacroblock_type, int *pmotion_type,
+ int *pmotion_vector_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
+ void Clear_Block(int count);
+ void Add_Block(int count, int bx, int by, int dct_type, int addflag);
+ void motion_compensation(int MBA, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2], int dct_type);
+ void skipped_macroblock(int dc_dct_pred[3], int PMV[2][2][2],
+ int *motion_type, int motion_vertical_field_select[2][2], int *macroblock_type);
+ int start_of_slice(int *MBA, int *MBAinc, int dc_dct_pred[3], int PMV[2][2][2]);
+ int decode_macroblock(int *macroblock_type, int *motion_type, int *dct_type,
+ int PMV[2][2][2], int dc_dct_pred[3], int motion_vertical_field_select[2][2], int dmvector[2]);
+ void Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]);
+ void Decode_MPEG2_Non_Intra_Block(int comp);
+
+ int Get_macroblock_type();
+ int Get_I_macroblock_type();
+ int Get_P_macroblock_type();
+ int Get_B_macroblock_type();
+ int Get_D_macroblock_type();
+ int Get_coded_block_pattern();
+ int Get_macroblock_address_increment();
+ int Get_Luma_DC_dct_diff();
+ int Get_Chroma_DC_dct_diff();
+
+ void form_predictions(int bx, int by, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2]);
+ void form_prediction(unsigned char *src[], int sfield, unsigned char *dst[], int dfield,
+ int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
+ void form_component_prediction(unsigned char *src, unsigned char *dst,
+ int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
+
+ // motion.cpp
+ void motion_vectors(int PMV[2][2][2], int dmvector[2], int motion_vertical_field_select[2][2],
+ int s, int motion_vector_count, int mv_format,
+ int h_r_size, int v_r_size, int dmv, int mvscale);
+ void Dual_Prime_Arithmetic(int DMV[][2], int *dmvector, int mvx, int mvy);
private:
- void motion_vector(int *PMV, int *dmvector, int h_r_size, int v_r_size,
- int dmv, int mvscale, int full_pel_vector);
- void decode_motion_vector(int *pred, int r_size, int motion_code,
- int motion_residualesidual, int full_pel_vector);
- int Get_motion_code();
- int Get_dmvector();
+ void motion_vector(int *PMV, int *dmvector, int h_r_size, int v_r_size,
+ int dmv, int mvscale, int full_pel_vector);
+ void decode_motion_vector(int *pred, int r_size, int motion_code,
+ int motion_residualesidual, int full_pel_vector);
+ int Get_motion_code();
+ int Get_dmvector();
protected:
- // store.cpp
- void assembleFrame(unsigned char *src[], int pf, unsigned char *dst, int pitch);
+ // store.cpp
+ void assembleFrame(unsigned char *src[], int pf, unsigned char *dst, int pitch);
private:
- void Luminance_Filter(unsigned char *src, unsigned char *dst);
- void conv420to422(unsigned char *src, unsigned char *dst, int frame_type);
- void conv422to444(unsigned char *src, unsigned char *dst);
- void conv444toRGB24(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
- void conv422toYUY2(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
+ void Luminance_Filter(unsigned char *src, unsigned char *dst);
+ void conv420to422(unsigned char *src, unsigned char *dst, int frame_type);
+ void conv422to444(unsigned char *src, unsigned char *dst);
+ void conv444toRGB24(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
+ void conv422toYUY2(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
protected:
- // decoder operation control flags
- int Fault_Flag;
- int File_Flag;
- int File_Limit;
- int FO_Flag;
- int IDCT_Flag;
- int SystemStream_Flag;
-
- int Luminance_Flag;
- int Resize_Flag;
-
- int KeyOp_Flag;
- int lfsr0, lfsr1;
- PBufferOp BufferOp;
-
- int Infile[MAX_FILE_NUMBER];
- char *Infilename[MAX_FILE_NUMBER];
-
- int intra_quantizer_matrix[64];
- int non_intra_quantizer_matrix[64];
- int chroma_intra_quantizer_matrix[64];
- int chroma_non_intra_quantizer_matrix[64];
-
- int load_intra_quantizer_matrix;
- int load_non_intra_quantizer_matrix;
- int load_chroma_intra_quantizer_matrix;
- int load_chroma_non_intra_quantizer_matrix;
-
- int q_scale_type;
- int alternate_scan;
- int quantizer_scale;
-
- void *fTempArray, *p_fTempArray;
- short *block[8], *p_block[8];
- int pf_backward, pf_forward, pf_current;
-
- // global values
- unsigned char *backward_reference_frame[3], *forward_reference_frame[3];
- unsigned char *auxframe[3], *current_frame[3];
- unsigned char *u422, *v422, *u444, *v444, /* *rgb24,*/ *lum;
- unsigned char *dstFrame; // replaces rgb24
- __int64 RGB_Scale, RGB_Offset, RGB_CRV, RGB_CBU, RGB_CGX, LumOffsetMask, LumGainMask;
-
- int HALF_WIDTH, PROGRESSIVE_HEIGHT, INTERLACED_HEIGHT, DOUBLE_WIDTH;
- int /*TWIDTH, SWIDTH,*/ HALF_WIDTH_D8, LUM_AREA, CLIP_AREA, HALF_CLIP_AREA, CLIP_STEP;
- int DSTBYTES, DSTBYTES2; // these replace TWIDTH and SWIDTH
+ // decoder operation control flags
+ int Fault_Flag;
+ int File_Flag;
+ int File_Limit;
+ int FO_Flag;
+ int IDCT_Flag;
+ int SystemStream_Flag;
+
+ int Luminance_Flag;
+ int Resize_Flag;
+
+ int KeyOp_Flag;
+ int lfsr0, lfsr1;
+ PBufferOp BufferOp;
+
+ int Infile[MAX_FILE_NUMBER];
+ char *Infilename[MAX_FILE_NUMBER];
+
+ int intra_quantizer_matrix[64];
+ int non_intra_quantizer_matrix[64];
+ int chroma_intra_quantizer_matrix[64];
+ int chroma_non_intra_quantizer_matrix[64];
+
+ int load_intra_quantizer_matrix;
+ int load_non_intra_quantizer_matrix;
+ int load_chroma_intra_quantizer_matrix;
+ int load_chroma_non_intra_quantizer_matrix;
+
+ int q_scale_type;
+ int alternate_scan;
+ int quantizer_scale;
+
+ void *fTempArray, *p_fTempArray;
+ short *block[8], *p_block[8];
+ int pf_backward, pf_forward, pf_current;
+
+ // global values
+ unsigned char *backward_reference_frame[3], *forward_reference_frame[3];
+ unsigned char *auxframe[3], *current_frame[3];
+ unsigned char *u422, *v422, *u444, *v444, /* *rgb24,*/ *lum;
+ unsigned char *dstFrame; // replaces rgb24
+ __int64 RGB_Scale, RGB_Offset, RGB_CRV, RGB_CBU, RGB_CGX, LumOffsetMask, LumGainMask;
+
+ int HALF_WIDTH, PROGRESSIVE_HEIGHT, INTERLACED_HEIGHT, DOUBLE_WIDTH;
+ int /*TWIDTH, SWIDTH,*/ HALF_WIDTH_D8, LUM_AREA, CLIP_AREA, HALF_CLIP_AREA, CLIP_STEP;
+ int DSTBYTES, DSTBYTES2; // these replace TWIDTH and SWIDTH
public:
- int Clip_Width, Clip_Height, Resize_Width, Resize_Height;
+ int Clip_Width, Clip_Height, Resize_Width, Resize_Height;
protected:
- int Coded_Picture_Width, Coded_Picture_Height, Chroma_Width, Chroma_Height;
- int block_count, Second_Field;
- int horizontal_size, vertical_size, mb_width, mb_height;
-
- /* ISO/IEC 13818-2 section 6.2.2.3: sequence_extension() */
- int progressive_sequence;
- int chroma_format;
-
- /* ISO/IEC 13818-2 section 6.2.3: picture_header() */
- int picture_coding_type;
- int temporal_reference;
-
- /* ISO/IEC 13818-2 section 6.2.3.1: picture_coding_extension() header */
- int f_code[2][2];
- int picture_structure;
- int frame_pred_frame_dct;
- int progressive_frame;
- int concealment_motion_vectors;
- int intra_dc_precision;
- int top_field_first;
- int repeat_first_field;
- int intra_vlc_format;
-
- // interface
- typedef struct
- {
- DWORD number;
- int file;
- __int64 position;
- } GOPLIST;
- GOPLIST *GOPList[MAX_FRAME_NUMBER];
-
- typedef struct
- {
- DWORD top;
- DWORD bottom;
- char forward;
- char backward;
- } FRAMELIST;
- FRAMELIST *FrameList[MAX_FRAME_NUMBER];
-
- unsigned char *GOPBuffer[MAX_GOP_SIZE];
+ int Coded_Picture_Width, Coded_Picture_Height, Chroma_Width, Chroma_Height;
+ int block_count, Second_Field;
+ int horizontal_size, vertical_size, mb_width, mb_height;
+
+ /* ISO/IEC 13818-2 section 6.2.2.3: sequence_extension() */
+ int progressive_sequence;
+ int chroma_format;
+
+ /* ISO/IEC 13818-2 section 6.2.3: picture_header() */
+ int picture_coding_type;
+ int temporal_reference;
+
+ /* ISO/IEC 13818-2 section 6.2.3.1: picture_coding_extension() header */
+ int f_code[2][2];
+ int picture_structure;
+ int frame_pred_frame_dct;
+ int progressive_frame;
+ int concealment_motion_vectors;
+ int intra_dc_precision;
+ int top_field_first;
+ int repeat_first_field;
+ int intra_vlc_format;
+
+ // interface
+ typedef struct {
+ DWORD number;
+ int file;
+ __int64 position;
+ } GOPLIST;
+ GOPLIST *GOPList[MAX_FRAME_NUMBER];
+
+ typedef struct {
+ DWORD top;
+ DWORD bottom;
+ char forward;
+ char backward;
+ } FRAMELIST;
+ FRAMELIST *FrameList[MAX_FRAME_NUMBER];
+
+ unsigned char *GOPBuffer[MAX_GOP_SIZE];
public:
- BOOL Field_Order, Full_Frame;
+ BOOL Field_Order, Full_Frame;
protected:
- HINSTANCE hLibrary;
+ HINSTANCE hLibrary;
- void Copyodd(unsigned char *src, unsigned char *dst, int pitch, int forward);
- void Copyeven(unsigned char *src, unsigned char *dst, int pitch, int forward);
+ void Copyodd(unsigned char *src, unsigned char *dst, int pitch, int forward);
+ void Copyeven(unsigned char *src, unsigned char *dst, int pitch, int forward);
public:
- FILE *VF_File;
- int VF_FrameRate;
- DWORD VF_FrameLimit;
- DWORD VF_FrameBound;
- DWORD VF_GOPLimit;
- DWORD VF_GOPNow;
- DWORD VF_GOPSize;
- int VF_FrameSize;
- DWORD VF_OldFrame;
- DWORD VF_OldRef;
-
- enum DstFormat
- {
- RGB24, YUY2
- };
- DstFormat m_dstFormat;
-
- CMPEG2Dec();
- ~CMPEG2Dec()
- {
- Close();
- }
- int Open(LPCTSTR path, DstFormat);
- void Close();
- void Decode(unsigned char *dst, DWORD frame, int pitch);
- bool dstRGB24() const
- {
- return m_dstFormat == RGB24;
- }
- bool dstYUY2() const
- {
- return m_dstFormat == YUY2;
- }
+ FILE *VF_File;
+ int VF_FrameRate;
+ DWORD VF_FrameLimit;
+ DWORD VF_FrameBound;
+ DWORD VF_GOPLimit;
+ DWORD VF_GOPNow;
+ DWORD VF_GOPSize;
+ int VF_FrameSize;
+ DWORD VF_OldFrame;
+ DWORD VF_OldRef;
+
+ enum DstFormat {
+ RGB24, YUY2
+ };
+ DstFormat m_dstFormat;
+
+ CMPEG2Dec();
+ ~CMPEG2Dec() {Close();}
+ int Open(LPCTSTR path, DstFormat);
+ void Close();
+ void Decode(unsigned char *dst, DWORD frame, int pitch);
+ bool dstRGB24() const { return m_dstFormat == RGB24; }
+ bool dstYUY2() const { return m_dstFormat == YUY2; }
};
diff --git a/src/filters/source/D2VSource/idctfpu.cpp b/src/filters/source/D2VSource/idctfpu.cpp
index 0b92b0315..92fcd3954 100644
--- a/src/filters/source/D2VSource/idctfpu.cpp
+++ b/src/filters/source/D2VSource/idctfpu.cpp
@@ -33,7 +33,7 @@
#define FLOAT double
-const static double RC = 1.0 * 1024 * 1024 * 1024 * 1024 * 256 * 16 + 1024; // magic + clip center
+const static double RC = 1.0*1024*1024*1024*1024*256*16 + 1024; // magic + clip center
static FLOAT W1; // /* sqrt(2)*cos(1*pi/16) */
static FLOAT W2; // /* sqrt(2)*cos(2*pi/16) */
@@ -56,7 +56,7 @@ static FLOAT W2mW6; // W2-W6
static FLOAT W2pW6; // W2+W6
static FLOAT S2; // 1/sqrt(2)
-static FLOAT D8 = 1.0 / 8;
+static FLOAT D8 = 1.0/8;
static FLOAT W7_8;
static FLOAT W1mW7_8;
@@ -78,62 +78,56 @@ static short *iclp;
void Initialize_FPU_IDCT()
{
- int i;
-
- S2 = sqrt(0.5); // 1.0/sqrt(2);
-
- W1 = sqrt(2.0) * cos(PI * (1.0 / 16));
- W1_8 = W1 / 8;
- W2 = sqrt(2.0) * cos(PI * (2.0 / 16));
- W2_8 = W2 / 8;
- W3 = sqrt(2.0) * cos(PI * (3.0 / 16));
- W3_8 = W3 / 8;
- W5 = sqrt(2.0) * cos(PI * (5.0 / 16));
- W5_8 = W5 / 8;
- W6 = sqrt(2.0) * cos(PI * (6.0 / 16));
- W6_8 = W6 / 8;
- W7 = sqrt(2.0) * cos(PI * (7.0 / 16));
- W7_8 = W7 / 8;
-
- W1mW7 = W1 - W7;
- W1mW7_8 = W1mW7 / 8;
- W1pW7 = W1 + W7;
- W1pW7_8 = W1pW7 / 8;
- W3mW5 = W3 - W5;
- W3mW5_8 = W3mW5 / 8;
- W3pW5 = W3 + W5;
- W3pW5_8 = W3pW5 / 8;
- W2mW6 = W2 - W6;
- W2mW6_8 = W2mW6 / 8;
- W2pW6 = W2 + W6;
- W2pW6_8 = W2pW6 / 8;
-
- iclp = iclip + 1024;
- for(i = -1024; i < 1024; i++)
- iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
+ int i;
+
+ S2 = sqrt(0.5); // 1.0/sqrt(2);
+
+ W1 = sqrt(2.0)*cos(PI*(1.0/16));
+ W1_8 = W1/8;
+ W2 = sqrt(2.0)*cos(PI*(2.0/16));
+ W2_8 = W2/8;
+ W3 = sqrt(2.0)*cos(PI*(3.0/16));
+ W3_8 = W3/8;
+ W5 = sqrt(2.0)*cos(PI*(5.0/16));
+ W5_8 = W5/8;
+ W6 = sqrt(2.0)*cos(PI*(6.0/16));
+ W6_8 = W6/8;
+ W7 = sqrt(2.0)*cos(PI*(7.0/16));
+ W7_8 = W7/8;
+
+ W1mW7 = W1-W7; W1mW7_8 = W1mW7/8;
+ W1pW7 = W1+W7; W1pW7_8 = W1pW7/8;
+ W3mW5 = W3-W5; W3mW5_8 = W3mW5/8;
+ W3pW5 = W3+W5; W3pW5_8 = W3pW5/8;
+ W2mW6 = W2-W6; W2mW6_8 = W2mW6/8;
+ W2pW6 = W2+W6; W2pW6_8 = W2pW6/8;
+
+ iclp = iclip+1024;
+ for (i= -1024; i<1024; i++)
+ iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
}
void FPU_IDCT(short *block)
{
- int *b = (int *) block;
- if(b[0] == 0 && (b[31] == 0x10000 || b[31] == 0))
- {
- if(b[ 1] | b[ 2] | b[ 3] | b[ 4] | b[ 5])
- goto normal;
- if(b[ 6] | b[ 7] | b[ 8] | b[ 9] | b[10])
- goto normal;
- if(b[11] | b[12] | b[13] | b[14] | b[15])
- goto normal;
- if(b[16] | b[17] | b[18] | b[19] | b[20])
- goto normal;
- if(b[21] | b[22] | b[23] | b[24] | b[25])
- goto normal;
- if(b[26] | b[27] | b[28] | b[29] | b[30])
- goto normal;
- b[31] = 0;
- ////empty++;
- return;
- }
+ int *b = (int *) block;
+ if( b[0]==0 && (b[31]==0x10000 || b[31]==0) )
+ {
+ if( b[ 1]|b[ 2]|b[ 3]|b[ 4]|b[ 5] )
+ goto normal;
+ if( b[ 6]|b[ 7]|b[ 8]|b[ 9]|b[10] )
+ goto normal;
+ if( b[11]|b[12]|b[13]|b[14]|b[15] )
+ goto normal;
+ if( b[16]|b[17]|b[18]|b[19]|b[20] )
+ goto normal;
+ if( b[21]|b[22]|b[23]|b[24]|b[25] )
+ goto normal;
+ if( b[26]|b[27]|b[28]|b[29]|b[30] )
+ goto normal;
+ b[31]=0;
+ ////empty++;
+ return;
+ }
normal:
#define tmp ebx
@@ -149,314 +143,314 @@ normal:
#define int6 ebx-3*8-7*4
#define int7 ebx-3*8-8*4
#define SIZE 8*8*8+3*8+8*4+16 // locals + 16-byte alignment area
- __asm
- {
- lea ebx, [esp-8*8*8]
- sub esp, SIZE
- and ebx, -16 // force 16-byte alignment of locals
+ __asm
+ {
+ lea ebx,[esp-8*8*8]
+ sub esp,SIZE
+ and ebx,-16 // force 16-byte alignment of locals
// rows
- mov esi, [block]
- lea edi, [tmp]
- mov ecx, 8
-
- align 16
- Lrows:
- movsx eax, word ptr [esi+2]
- or eax, [esi+4]
- or eax, [esi+8]
- or eax, [esi+12]
- jnz L1
-
- fild word ptr [esi+0*2]
- fst qword ptr [edi+7*8]
- fst qword ptr [edi+6*8]
- fst qword ptr [edi+5*8]
- fst qword ptr [edi+4*8]
- fst qword ptr [edi+3*8]
- fst qword ptr [edi+2*8]
- fst qword ptr [edi+1*8]
- fstp qword ptr [edi+0*8]
- jmp L2
-
- align 16
- L1:
-
- fild word ptr [esi+7*2]
- fld st(0)
- fild word ptr [esi+1*2]
- fadd st(1), st(0)
- fld qword ptr [W7]
- fxch st(1)
- fmul qword ptr [W1mW7]
- fxch st(1)
- fmulp st(2), st(0)
- fadd st(0), st(1)
- fstp qword ptr [tmp1]
- fild word ptr [esi+3*2]
- fld st(0)
- fxch st(3)
- fmul qword ptr [W1pW7]
- fild word ptr [esi+5*2]
- fadd st(4), st(0)
- fmul qword ptr [W3mW5]
- fxch st(1)
- fsubp st(3), st(0) //fsubrp
- fld qword ptr [W3]
- fmulp st(4), st(0)
- fsubr st(0), st(3)
- fstp qword ptr [tmp2]
- fmul qword ptr [W3pW5]
- fsubp st(2), st(0) //fsubrp
- fxch st(1)
- fstp qword ptr [tmp3]
- fild word ptr [esi+0*2]
- fild word ptr [esi+4*2]
- fild word ptr [esi+2*2]
- fld st(0)
- fmul qword ptr [W2mW6]
- fld st(3)
- fild word ptr [esi+6*2]
- fxch st(5)
- fsub st(0), st(4)
- fxch st(3)
- fadd st(0), st(5)
- fxch st(1)
- faddp st(4), st(0)
- fld qword ptr [W6]
- fmulp st(1), st(0)
- fxch st(4)
- fmul qword ptr [W2pW6]
- fld qword ptr [tmp1]
- fsub qword ptr [tmp2]
- fld st(5)
- fxch st(3)
- faddp st(6), st(0)
- fld qword ptr [tmp1]
- fxch st(1)
- fstp qword ptr [tmp1]
- fld st(6)
- fadd qword ptr [tmp3]
- fxch st(1)
- fadd qword ptr [tmp2]
- fxch st(7)
- fsub qword ptr [tmp3]
- fxch st(1)
- fstp qword ptr [tmp2]
- fld st(4)
- fxch st(3)
- fsubrp st(2), st(0) //fsubp
- fxch st(4)
- fsub st(0), st(5)
- fxch st(2)
- faddp st(5), st(0)
- fld st(2)
- fsub st(0), st(1)
- fxch st(5)
- fstp qword ptr [tmp3]
- fld qword ptr [tmp1]
- fld qword ptr [S2]
- fxch st(4)
- faddp st(2), st(0)
- fld st(3)
- fxch st(1)
- fadd st(0), st(5)
- fmulp st(1), st(0)
-
- fld qword ptr [tmp3]
- fadd st(0), st(7)
- fxch st(5)
- fsubr qword ptr [tmp1]
- fxch st(5)
- fstp qword ptr [edi+0*8]
- fxch st(6)
- fsubr qword ptr [tmp3]
- fld st(2)
- fxch st(1)
- fstp qword ptr [edi+7*8]
- fadd qword ptr [tmp2]
- fxch st(3)
- fmulp st(4), st(0)
- fxch st(2)
- fstp qword ptr [edi+3*8]
- fld st(1)
- fadd st(0), st(5)
- fxch st(1)
- fsub qword ptr [tmp2]
- fxch st(2)
- fsubrp st(5), st(0) //fsubp
- fstp qword ptr [edi+1*8]
- fld st(2)
- fxch st(1)
- fstp qword ptr [edi+4*8]
- fxch st(2)
- fsub st(0), st(1)
- fxch st(2)
- faddp st(1), st(0)
- fxch st(2)
- fstp qword ptr [edi+6*8]
- fstp qword ptr [edi+5*8]
- fstp qword ptr [edi+2*8]
- L2:
- add esi, 8*2
- add edi, 8*8
- dec ecx
- jnz Lrows
+ mov esi,[block]
+ lea edi,[tmp]
+ mov ecx,8
+
+ align 16
+Lrows:
+ movsx eax,word ptr [esi+2]
+ or eax, [esi+4]
+ or eax, [esi+8]
+ or eax, [esi+12]
+ jnz L1
+
+ fild word ptr [esi+0*2]
+ fst qword ptr [edi+7*8]
+ fst qword ptr [edi+6*8]
+ fst qword ptr [edi+5*8]
+ fst qword ptr [edi+4*8]
+ fst qword ptr [edi+3*8]
+ fst qword ptr [edi+2*8]
+ fst qword ptr [edi+1*8]
+ fstp qword ptr [edi+0*8]
+ jmp L2
+
+ align 16
+ L1:
+
+ fild word ptr [esi+7*2]
+ fld st(0)
+ fild word ptr [esi+1*2]
+ fadd st(1),st(0)
+ fld qword ptr [W7]
+ fxch st(1)
+ fmul qword ptr [W1mW7]
+ fxch st(1)
+ fmulp st(2),st(0)
+ fadd st(0),st(1)
+ fstp qword ptr [tmp1]
+ fild word ptr [esi+3*2]
+ fld st(0)
+ fxch st(3)
+ fmul qword ptr [W1pW7]
+ fild word ptr [esi+5*2]
+ fadd st(4),st(0)
+ fmul qword ptr [W3mW5]
+ fxch st(1)
+ fsubp st(3),st(0)//fsubrp
+ fld qword ptr [W3]
+ fmulp st(4),st(0)
+ fsubr st(0),st(3)
+ fstp qword ptr [tmp2]
+ fmul qword ptr [W3pW5]
+ fsubp st(2),st(0)//fsubrp
+ fxch st(1)
+ fstp qword ptr [tmp3]
+ fild word ptr [esi+0*2]
+ fild word ptr [esi+4*2]
+ fild word ptr [esi+2*2]
+ fld st(0)
+ fmul qword ptr [W2mW6]
+ fld st(3)
+ fild word ptr [esi+6*2]
+ fxch st(5)
+ fsub st(0),st(4)
+ fxch st(3)
+ fadd st(0),st(5)
+ fxch st(1)
+ faddp st(4),st(0)
+ fld qword ptr [W6]
+ fmulp st(1),st(0)
+ fxch st(4)
+ fmul qword ptr [W2pW6]
+ fld qword ptr [tmp1]
+ fsub qword ptr [tmp2]
+ fld st(5)
+ fxch st(3)
+ faddp st(6),st(0)
+ fld qword ptr [tmp1]
+ fxch st(1)
+ fstp qword ptr [tmp1]
+ fld st(6)
+ fadd qword ptr [tmp3]
+ fxch st(1)
+ fadd qword ptr [tmp2]
+ fxch st(7)
+ fsub qword ptr [tmp3]
+ fxch st(1)
+ fstp qword ptr [tmp2]
+ fld st(4)
+ fxch st(3)
+ fsubrp st(2),st(0)//fsubp
+ fxch st(4)
+ fsub st(0),st(5)
+ fxch st(2)
+ faddp st(5),st(0)
+ fld st(2)
+ fsub st(0),st(1)
+ fxch st(5)
+ fstp qword ptr [tmp3]
+ fld qword ptr [tmp1]
+ fld qword ptr [S2]
+ fxch st(4)
+ faddp st(2),st(0)
+ fld st(3)
+ fxch st(1)
+ fadd st(0),st(5)
+ fmulp st(1),st(0)
+
+ fld qword ptr [tmp3]
+ fadd st(0),st(7)
+ fxch st(5)
+ fsubr qword ptr [tmp1]
+ fxch st(5)
+ fstp qword ptr [edi+0*8]
+ fxch st(6)
+ fsubr qword ptr [tmp3]
+ fld st(2)
+ fxch st(1)
+ fstp qword ptr [edi+7*8]
+ fadd qword ptr [tmp2]
+ fxch st(3)
+ fmulp st(4),st(0)
+ fxch st(2)
+ fstp qword ptr [edi+3*8]
+ fld st(1)
+ fadd st(0),st(5)
+ fxch st(1)
+ fsub qword ptr [tmp2]
+ fxch st(2)
+ fsubrp st(5),st(0)//fsubp
+ fstp qword ptr [edi+1*8]
+ fld st(2)
+ fxch st(1)
+ fstp qword ptr [edi+4*8]
+ fxch st(2)
+ fsub st(0),st(1)
+ fxch st(2)
+ faddp st(1),st(0)
+ fxch st(2)
+ fstp qword ptr [edi+6*8]
+ fstp qword ptr [edi+5*8]
+ fstp qword ptr [edi+2*8]
+ L2:
+ add esi,8*2
+ add edi,8*8
+ dec ecx
+ jnz Lrows
// columns
- lea esi, [tmp]
- mov edi, [block]
- lea edx, [iclip+1024*2]
- mov ecx, 8
-
- align 16
- Lcols:
- fld qword ptr [esi+7*8*8]
- fld st(0)
- fld qword ptr [esi+1*8*8]
- fadd st(1), st(0)
- fld qword ptr [W7_8]
- fxch st(1)
- fmul qword ptr [W1mW7_8]
- fxch st(1)
- fmulp st(2), st(0)
- fadd st(0), st(1)
- fstp qword ptr [tmp2]
- fld qword ptr [esi+3*8*8]
- fld st(0)
- fxch st(3)
- fmul qword ptr [W1pW7_8]
- fld qword ptr [esi+5*8*8]
- fadd st(4), st(0)
- fmul qword ptr [W3mW5_8]
- fxch st(1)
- fsubp st(3), st(0) //fsubrp
- fld qword ptr [W3_8]
- fmulp st(4), st(0)
- fsubr st(0), st(3)
- fstp qword ptr [tmp3]
- fld qword ptr [D8]
- fld qword ptr [esi+0*8*8]
- fmul st(0), st(1)
- fxch st(2)
- fmul qword ptr [W3pW5_8]
- fld qword ptr [esi+4*8*8]
- fmulp st(2), st(0)
- fld qword ptr [esi+6*8*8]
- fld st(3)
- fxch st(6)
- fsubrp st(2), st(0) //fsubp
- fld qword ptr [esi+2*8*8]
- fld st(0)
- fxch st(5)
- fsub st(0), st(4)
- fxch st(7)
- faddp st(4), st(0)
- fxch st(4)
- fadd st(0), st(1)
- fld qword ptr [W6_8]
- fxch st(2)
- fmul qword ptr [W2pW6_8]
- fxch st(2)
- fmulp st(1), st(0)
- fxch st(4)
- fmul qword ptr [W2mW6_8]
- fld qword ptr [tmp2]
- fsub qword ptr [tmp3]
- fxch st(2)
- fsubr st(0), st(5)
- fxch st(1)
- faddp st(5), st(0)
- fld qword ptr [tmp2]
- fxch st(2)
- fstp qword ptr [tmp2]
- fld st(5)
- fxch st(2)
- fadd qword ptr [tmp3]
- fxch st(6)
- fsub st(0), st(3)
- fxch st(2)
- faddp st(3), st(0)
- fld st(3)
- fsub st(0), st(5)
- fxch st(3)
- fstp qword ptr [tmp3]
- fxch st(3)
- faddp st(4), st(0)
- fld st(5)
- fld qword ptr [tmp2]
- fxch st(7)
- fsub st(0), st(4)
- fxch st(7)
- fadd st(0), st(2)
- fxch st(1)
- faddp st(4), st(0)
- fld qword ptr [S2]
- fmul st(1), st(0)
- fxch st(1)
- fstp qword ptr [tmp1]
- fld st(4)
- fadd st(0), st(6)
- fxch st(2)
- fsubr qword ptr [tmp2]
- fxch st(5)
- fsubrp st(6), st(0) //fsubp
- fxch st(1)
- fistp dword ptr [int0]
- fxch st(4)
- mov eax, [int0]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+0*8*2], ax
- fistp dword ptr [int7]
- mov eax, [int7]
- fld st(0)
- movsx eax, word ptr [edx+2*eax]
- mov [edi+7*8*2], ax
- fadd qword ptr [tmp3]
- fistp dword ptr [int3]
- mov eax, [int3]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+3*8*2], ax
- fsub qword ptr [tmp3]
- fld st(1)
- fxch st(1)
- fistp dword ptr [int4]
- mov eax, [int4]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+4*8*2], ax
- fadd qword ptr [tmp1]
- fxch st(3)
- fmulp st(2), st(0)
- fxch st(2)
- fistp dword ptr [int1]
- fxch st(1)
- mov eax, [int1]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+1*8*2], ax
- fsub qword ptr [tmp1]
- fld st(2)
- fsub st(0), st(2)
- fxch st(1)
- fistp dword ptr [int6]
- fxch st(2)
- mov eax, [int6]
- faddp st(1), st(0)
- movsx eax, word ptr [edx+2*eax]
- mov [edi+6*8*2], ax
- fistp dword ptr [int2]
- mov eax, [int2]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+2*8*2], ax
- fistp dword ptr [int5]
- mov eax, [int5]
- movsx eax, word ptr [edx+2*eax]
- mov [edi+5*8*2], ax
-
- add esi, 8
- add edi, 2
- dec ecx
- jnz Lcols
-
- add esp, SIZE
- }
+ lea esi,[tmp]
+ mov edi,[block]
+ lea edx,[iclip+1024*2]
+ mov ecx,8
+
+ align 16
+Lcols:
+ fld qword ptr [esi+7*8*8]
+ fld st(0)
+ fld qword ptr [esi+1*8*8]
+ fadd st(1),st(0)
+ fld qword ptr [W7_8]
+ fxch st(1)
+ fmul qword ptr [W1mW7_8]
+ fxch st(1)
+ fmulp st(2),st(0)
+ fadd st(0),st(1)
+ fstp qword ptr [tmp2]
+ fld qword ptr [esi+3*8*8]
+ fld st(0)
+ fxch st(3)
+ fmul qword ptr [W1pW7_8]
+ fld qword ptr [esi+5*8*8]
+ fadd st(4),st(0)
+ fmul qword ptr [W3mW5_8]
+ fxch st(1)
+ fsubp st(3),st(0)//fsubrp
+ fld qword ptr [W3_8]
+ fmulp st(4),st(0)
+ fsubr st(0),st(3)
+ fstp qword ptr [tmp3]
+ fld qword ptr [D8]
+ fld qword ptr [esi+0*8*8]
+ fmul st(0),st(1)
+ fxch st(2)
+ fmul qword ptr [W3pW5_8]
+ fld qword ptr [esi+4*8*8]
+ fmulp st(2),st(0)
+ fld qword ptr [esi+6*8*8]
+ fld st(3)
+ fxch st(6)
+ fsubrp st(2),st(0)//fsubp
+ fld qword ptr [esi+2*8*8]
+ fld st(0)
+ fxch st(5)
+ fsub st(0),st(4)
+ fxch st(7)
+ faddp st(4),st(0)
+ fxch st(4)
+ fadd st(0),st(1)
+ fld qword ptr [W6_8]
+ fxch st(2)
+ fmul qword ptr [W2pW6_8]
+ fxch st(2)
+ fmulp st(1),st(0)
+ fxch st(4)
+ fmul qword ptr [W2mW6_8]
+ fld qword ptr [tmp2]
+ fsub qword ptr [tmp3]
+ fxch st(2)
+ fsubr st(0),st(5)
+ fxch st(1)
+ faddp st(5),st(0)
+ fld qword ptr [tmp2]
+ fxch st(2)
+ fstp qword ptr [tmp2]
+ fld st(5)
+ fxch st(2)
+ fadd qword ptr [tmp3]
+ fxch st(6)
+ fsub st(0),st(3)
+ fxch st(2)
+ faddp st(3),st(0)
+ fld st(3)
+ fsub st(0),st(5)
+ fxch st(3)
+ fstp qword ptr [tmp3]
+ fxch st(3)
+ faddp st(4),st(0)
+ fld st(5)
+ fld qword ptr [tmp2]
+ fxch st(7)
+ fsub st(0),st(4)
+ fxch st(7)
+ fadd st(0),st(2)
+ fxch st(1)
+ faddp st(4),st(0)
+ fld qword ptr [S2]
+ fmul st(1),st(0)
+ fxch st(1)
+ fstp qword ptr [tmp1]
+ fld st(4)
+ fadd st(0),st(6)
+ fxch st(2)
+ fsubr qword ptr [tmp2]
+ fxch st(5)
+ fsubrp st(6),st(0)//fsubp
+ fxch st(1)
+ fistp dword ptr [int0]
+ fxch st(4)
+ mov eax,[int0]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+0*8*2],ax
+ fistp dword ptr [int7]
+ mov eax,[int7]
+ fld st(0)
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+7*8*2],ax
+ fadd qword ptr [tmp3]
+ fistp dword ptr [int3]
+ mov eax,[int3]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+3*8*2],ax
+ fsub qword ptr [tmp3]
+ fld st(1)
+ fxch st(1)
+ fistp dword ptr [int4]
+ mov eax,[int4]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+4*8*2],ax
+ fadd qword ptr [tmp1]
+ fxch st(3)
+ fmulp st(2),st(0)
+ fxch st(2)
+ fistp dword ptr [int1]
+ fxch st(1)
+ mov eax,[int1]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+1*8*2],ax
+ fsub qword ptr [tmp1]
+ fld st(2)
+ fsub st(0),st(2)
+ fxch st(1)
+ fistp dword ptr [int6]
+ fxch st(2)
+ mov eax,[int6]
+ faddp st(1),st(0)
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+6*8*2],ax
+ fistp dword ptr [int2]
+ mov eax,[int2]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+2*8*2],ax
+ fistp dword ptr [int5]
+ mov eax,[int5]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+5*8*2],ax
+
+ add esi,8
+ add edi,2
+ dec ecx
+ jnz Lcols
+
+ add esp,SIZE
+ }
}
diff --git a/src/filters/source/D2VSource/idctref.cpp b/src/filters/source/D2VSource/idctref.cpp
index 2c1024692..74b695ce1 100644
--- a/src/filters/source/D2VSource/idctref.cpp
+++ b/src/filters/source/D2VSource/idctref.cpp
@@ -40,323 +40,323 @@ static double c[8][8];
/* initialize DCT coefficient matrix */
void Initialize_REF_IDCT()
{
- int freq, time, i;
- double scale;
+ int freq, time, i;
+ double scale;
- for(freq = 0; freq < 8; freq++)
- {
- scale = (freq == 0) ? sqrt(0.125) : 0.5;
- for(time = 0; time < 8; time++)
- c[freq][time] = scale * cos((M_PI / 8.0) * freq * (time + 0.5));
- }
+ for (freq=0; freq < 8; freq++)
+ {
+ scale = (freq == 0) ? sqrt(0.125) : 0.5;
+ for (time=0; time<8; time++)
+ c[freq][time] = scale*cos((M_PI/8.0)*freq*(time + 0.5));
+ }
#ifdef ModelX
- iclp = iclip + 1024;
- for(i = -1024; i < 1024; i++)
- iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
+ iclp = iclip+1024;
+ for (i= -1024; i<1024; i++)
+ iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
#endif
}
void REF_IDCT(short *block)
{
- double tmp[64];
- double rnd[64];
- int int0, int1, int2, int3, int4, int5, int6, int7;
- unsigned short fpold;
- unsigned short fpnew;
-
- int *b = (int *) block;
-
- if(!(b[0] | (b[31]&~0x10000)))
- {
- if(b[ 1] | b[ 2] | b[ 3] | b[ 4] | b[ 5] | b[ 6])
- goto normal;
- if(b[ 7] | b[ 8] | b[ 9] | b[10] | b[11] | b[12])
- goto normal;
- if(b[13] | b[14] | b[15] | b[16] | b[17] | b[18])
- goto normal;
- if(b[19] | b[20] | b[21] | b[22] | b[23] | b[24])
- goto normal;
- if(b[25] | b[26] | b[27] | b[28] | b[29] | b[30])
- goto normal;
- b[31] = 0;
- return;
- }
+ double tmp[64];
+ double rnd[64];
+ int int0, int1, int2, int3, int4, int5, int6, int7;
+ unsigned short fpold;
+ unsigned short fpnew;
+
+ int *b = (int *) block;
+
+ if( !(b[0]|(b[31]&~0x10000)) )
+ {
+ if( b[ 1]|b[ 2]|b[ 3]|b[ 4]|b[ 5]|b[ 6] )
+ goto normal;
+ if( b[ 7]|b[ 8]|b[ 9]|b[10]|b[11]|b[12] )
+ goto normal;
+ if( b[13]|b[14]|b[15]|b[16]|b[17]|b[18] )
+ goto normal;
+ if( b[19]|b[20]|b[21]|b[22]|b[23]|b[24] )
+ goto normal;
+ if( b[25]|b[26]|b[27]|b[28]|b[29]|b[30] )
+ goto normal;
+ b[31]=0;
+ return;
+ }
normal:
- __asm
- {
- // do the IDCT
- mov esi, [block]
- lea eax, [c]
- lea edi, [tmp]
- //mov ebx,8
- mov ebx, 8 // 0x77000000 // 8
- align 16
- __col1:
- movzx edx, [esi+1*2]
- mov ecx, [esi+2*2]
- or edx, [esi+4*2]
- or ecx, [esi+6*2]
- or edx, ecx
- //mov ecx,8
- mov ecx, 8/2 // 0x77000000 // 8
-
- jnz __row1
- fild word ptr [esi+0*2]
- fmul qword ptr [eax+0*8*8]
- fst qword ptr [edi+0*8]
- fst qword ptr [edi+1*8]
- fst qword ptr [edi+2*8]
- fst qword ptr [edi+3*8]
- fst qword ptr [edi+4*8]
- fst qword ptr [edi+5*8]
- fst qword ptr [edi+6*8]
- fstp qword ptr [edi+7*8]
- add edi, 8*8
- jmp __next1
- align 16
- __row1:
- fild word ptr [esi+0*2]
- fmul qword ptr [eax+0*8*8]
- fild word ptr [esi+1*2]
- fmul qword ptr [eax+1*8*8]
- fadd
- fild word ptr [esi+2*2]
- fmul qword ptr [eax+2*8*8]
- fadd
- fild word ptr [esi+3*2]
- fmul qword ptr [eax+3*8*8]
- fadd
- fild word ptr [esi+4*2]
- fmul qword ptr [eax+4*8*8]
- fadd
- fild word ptr [esi+5*2]
- fmul qword ptr [eax+5*8*8]
- fadd
- fild word ptr [esi+6*2]
- fmul qword ptr [eax+6*8*8]
- fadd
- fild word ptr [esi+7*2]
- fmul qword ptr [eax+7*8*8]
- fadd
-
- fild word ptr [esi+0*2]
- fmul qword ptr [eax+0*8*8+8]
- fild word ptr [esi+1*2]
- fmul qword ptr [eax+1*8*8+8]
- fadd
- fild word ptr [esi+2*2]
- fmul qword ptr [eax+2*8*8+8]
- fadd
- fild word ptr [esi+3*2]
- fmul qword ptr [eax+3*8*8+8]
- fadd
- fild word ptr [esi+4*2]
- fmul qword ptr [eax+4*8*8+8]
- fadd
- fild word ptr [esi+5*2]
- fmul qword ptr [eax+5*8*8+8]
- fadd
- fild word ptr [esi+6*2]
- fmul qword ptr [eax+6*8*8+8]
- fadd
- fild word ptr [esi+7*2]
- fmul qword ptr [eax+7*8*8+8]
- fadd
- add eax, 8*2
- fxch st(1)
- fstp qword ptr [edi]//
- fstp qword ptr [edi+8]
- add edi, 8*2
- dec ecx
-
- jnz __row1
- add eax, -8*8
- //align 16
- __next1:
- add esi, +8*2
-
- sub ebx, 0x80000001 // add ebx,ebx
- js __col1
- //align 16
- test ebx, ebx // align jump &| redo flags
- jnz __col1
-
- lea esi, [tmp]
- lea eax, [c]
- lea edi, [rnd]
- //mov edi,[block]
- fld qword ptr [HALF]
- mov ebx, 8
- __row2:
- mov ecx, 8/2
- align 16
- __col2:
- fld qword ptr [esi+0*8*8]
- fmul qword ptr [eax+0*8*8]
- fld qword ptr [esi+1*8*8]
- fmul qword ptr [eax+1*8*8]
- fadd
- fld qword ptr [esi+2*8*8]
- fmul qword ptr [eax+2*8*8]
- fadd
- fld qword ptr [esi+3*8*8]
- fmul qword ptr [eax+3*8*8]
- fadd
- fld qword ptr [esi+4*8*8]
- fmul qword ptr [eax+4*8*8]
- fadd
- fld qword ptr [esi+5*8*8]
- fmul qword ptr [eax+5*8*8]
- fadd
- fld qword ptr [esi+6*8*8]
- fmul qword ptr [eax+6*8*8]
- fadd
- fld qword ptr [esi+7*8*8]
- fmul qword ptr [eax+7*8*8]
- fadd
- fadd st(0), st(1)
-
- fxch st(1)
-
- fld qword ptr [esi+0*8*8]
- fmul qword ptr [eax+0*8*8+8]
- fld qword ptr [esi+1*8*8]
- fmul qword ptr [eax+1*8*8+8]
- fadd
- fld qword ptr [esi+2*8*8]
- fmul qword ptr [eax+2*8*8+8]
- fadd
- fld qword ptr [esi+3*8*8]
- fmul qword ptr [eax+3*8*8+8]
- fadd
- fld qword ptr [esi+4*8*8]
- fmul qword ptr [eax+4*8*8+8]
- fadd
- fld qword ptr [esi+5*8*8]
- fmul qword ptr [eax+5*8*8+8]
- fadd
- fld qword ptr [esi+6*8*8]
- fmul qword ptr [eax+6*8*8+8]
- fadd
- fld qword ptr [esi+7*8*8]
- fmul qword ptr [eax+7*8*8+8]
- fadd
- fadd st(0), st(1)
- add eax, 8*2
-
- fxch st(2)
- fstp qword ptr [edi]
- fxch st(1)
- fstp qword ptr [edi+8*8]
- add edi, 8*8*2
-
- dec ecx
-
- jnz __col2
- add eax, -8*8
- add esi, +8
- add edi, 8-8*8*8
-
- sub ebx, 0x80000001
- js __row2
- //align 16
- test ebx, ebx // align jump &| redo flags
- jnz __row2
- ffree st(0) // bye bye 0.5
-
- // set x87 to floor mode
- fstcw [fpold]
- movzx eax, [fpold]
-
- or eax, 0x0400 // round down - floor
- mov [fpnew], ax
- fldcw [fpnew]
-
- // now floor the damn array
- lea esi, [rnd]
- mov edi, [block]
- mov ebx, -256 // clip min
- mov edx, +255 // clip max
- mov ecx, 8
- align 16
- __floor:
- fld qword ptr [esi+0*8]
- fistp dword ptr [int0]
- mov eax, [int0]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+1*8]
- fistp dword ptr [int1]
- mov word ptr [edi+0*2], ax
- mov eax, [int1]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+2*8]
- fistp dword ptr [int2]
- mov word ptr [edi+1*2], ax
- mov eax, [int2]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+3*8]
- fistp dword ptr [int3]
- mov word ptr [edi+2*2], ax
- mov eax, [int3]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+4*8]
- fistp dword ptr [int4]
- mov word ptr [edi+3*2], ax
- mov eax, [int4]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+5*8]
- fistp dword ptr [int5]
- mov word ptr [edi+4*2], ax
- mov eax, [int5]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+6*8]
- fistp dword ptr [int6]
- mov word ptr [edi+5*2], ax
- mov eax, [int6]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- fld qword ptr [esi+7*8]
- fistp dword ptr [int7]
- mov word ptr [edi+6*2], ax
- mov eax, [int7]
- cmp eax, ebx
- cmovl eax, ebx
- cmp eax, edx
- cmovg eax, edx
- mov word ptr [edi+7*2], ax
-
- add esi, 8*8
- add edi, 8*2
-
- sub ecx, 0x80000001
- js __floor
- //align 16
- test ecx, ecx // align jump &| redo flags
- jnz __floor
-
- // set x87 to default mode
- fldcw [fpold]
- };
+ __asm
+ {
+ // do the IDCT
+ mov esi,[block]
+ lea eax,[c]
+ lea edi,[tmp]
+ //mov ebx,8
+ mov ebx,8 // 0x77000000 // 8
+ align 16
+ __col1:
+ movzx edx,[esi+1*2]
+ mov ecx,[esi+2*2]
+ or edx,[esi+4*2]
+ or ecx,[esi+6*2]
+ or edx,ecx
+ //mov ecx,8
+ mov ecx,8/2 // 0x77000000 // 8
+
+ jnz __row1
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8]
+ fst qword ptr [edi+0*8]
+ fst qword ptr [edi+1*8]
+ fst qword ptr [edi+2*8]
+ fst qword ptr [edi+3*8]
+ fst qword ptr [edi+4*8]
+ fst qword ptr [edi+5*8]
+ fst qword ptr [edi+6*8]
+ fstp qword ptr [edi+7*8]
+ add edi,8*8
+ jmp __next1
+ align 16
+ __row1:
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8]
+ fild word ptr [esi+1*2]
+ fmul qword ptr [eax+1*8*8]
+ fadd
+ fild word ptr [esi+2*2]
+ fmul qword ptr [eax+2*8*8]
+ fadd
+ fild word ptr [esi+3*2]
+ fmul qword ptr [eax+3*8*8]
+ fadd
+ fild word ptr [esi+4*2]
+ fmul qword ptr [eax+4*8*8]
+ fadd
+ fild word ptr [esi+5*2]
+ fmul qword ptr [eax+5*8*8]
+ fadd
+ fild word ptr [esi+6*2]
+ fmul qword ptr [eax+6*8*8]
+ fadd
+ fild word ptr [esi+7*2]
+ fmul qword ptr [eax+7*8*8]
+ fadd
+
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8+8]
+ fild word ptr [esi+1*2]
+ fmul qword ptr [eax+1*8*8+8]
+ fadd
+ fild word ptr [esi+2*2]
+ fmul qword ptr [eax+2*8*8+8]
+ fadd
+ fild word ptr [esi+3*2]
+ fmul qword ptr [eax+3*8*8+8]
+ fadd
+ fild word ptr [esi+4*2]
+ fmul qword ptr [eax+4*8*8+8]
+ fadd
+ fild word ptr [esi+5*2]
+ fmul qword ptr [eax+5*8*8+8]
+ fadd
+ fild word ptr [esi+6*2]
+ fmul qword ptr [eax+6*8*8+8]
+ fadd
+ fild word ptr [esi+7*2]
+ fmul qword ptr [eax+7*8*8+8]
+ fadd
+ add eax,8*2
+ fxch st(1)
+ fstp qword ptr [edi]//
+ fstp qword ptr [edi+8]
+ add edi,8*2
+ dec ecx
+
+ jnz __row1
+ add eax,-8*8
+ //align 16
+ __next1:
+ add esi,+8*2
+
+ sub ebx,0x80000001 // add ebx,ebx
+ js __col1
+ //align 16
+ test ebx,ebx // align jump &| redo flags
+ jnz __col1
+
+ lea esi,[tmp]
+ lea eax,[c]
+ lea edi,[rnd]
+ //mov edi,[block]
+ fld qword ptr [HALF]
+ mov ebx,8
+ __row2:
+ mov ecx,8/2
+ align 16
+ __col2:
+ fld qword ptr [esi+0*8*8]
+ fmul qword ptr [eax+0*8*8]
+ fld qword ptr [esi+1*8*8]
+ fmul qword ptr [eax+1*8*8]
+ fadd
+ fld qword ptr [esi+2*8*8]
+ fmul qword ptr [eax+2*8*8]
+ fadd
+ fld qword ptr [esi+3*8*8]
+ fmul qword ptr [eax+3*8*8]
+ fadd
+ fld qword ptr [esi+4*8*8]
+ fmul qword ptr [eax+4*8*8]
+ fadd
+ fld qword ptr [esi+5*8*8]
+ fmul qword ptr [eax+5*8*8]
+ fadd
+ fld qword ptr [esi+6*8*8]
+ fmul qword ptr [eax+6*8*8]
+ fadd
+ fld qword ptr [esi+7*8*8]
+ fmul qword ptr [eax+7*8*8]
+ fadd
+ fadd st(0),st(1)
+
+ fxch st(1)
+
+ fld qword ptr [esi+0*8*8]
+ fmul qword ptr [eax+0*8*8+8]
+ fld qword ptr [esi+1*8*8]
+ fmul qword ptr [eax+1*8*8+8]
+ fadd
+ fld qword ptr [esi+2*8*8]
+ fmul qword ptr [eax+2*8*8+8]
+ fadd
+ fld qword ptr [esi+3*8*8]
+ fmul qword ptr [eax+3*8*8+8]
+ fadd
+ fld qword ptr [esi+4*8*8]
+ fmul qword ptr [eax+4*8*8+8]
+ fadd
+ fld qword ptr [esi+5*8*8]
+ fmul qword ptr [eax+5*8*8+8]
+ fadd
+ fld qword ptr [esi+6*8*8]
+ fmul qword ptr [eax+6*8*8+8]
+ fadd
+ fld qword ptr [esi+7*8*8]
+ fmul qword ptr [eax+7*8*8+8]
+ fadd
+ fadd st(0),st(1)
+ add eax,8*2
+
+ fxch st(2)
+ fstp qword ptr [edi]
+ fxch st(1)
+ fstp qword ptr [edi+8*8]
+ add edi,8*8*2
+
+ dec ecx
+
+ jnz __col2
+ add eax,-8*8
+ add esi,+8
+ add edi,8-8*8*8
+
+ sub ebx,0x80000001
+ js __row2
+ //align 16
+ test ebx,ebx // align jump &| redo flags
+ jnz __row2
+ ffree st(0) // bye bye 0.5
+
+ // set x87 to floor mode
+ fstcw [fpold]
+ movzx eax, [fpold]
+
+ or eax, 0x0400 // round down - floor
+ mov [fpnew], ax
+ fldcw [fpnew]
+
+ // now floor the damn array
+ lea esi, [rnd]
+ mov edi, [block]
+ mov ebx, -256 // clip min
+ mov edx, +255 // clip max
+ mov ecx, 8
+ align 16
+ __floor:
+ fld qword ptr [esi+0*8]
+ fistp dword ptr [int0]
+ mov eax,[int0]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+1*8]
+ fistp dword ptr [int1]
+ mov word ptr [edi+0*2],ax
+ mov eax,[int1]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+2*8]
+ fistp dword ptr [int2]
+ mov word ptr [edi+1*2],ax
+ mov eax,[int2]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+3*8]
+ fistp dword ptr [int3]
+ mov word ptr [edi+2*2],ax
+ mov eax,[int3]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+4*8]
+ fistp dword ptr [int4]
+ mov word ptr [edi+3*2],ax
+ mov eax,[int4]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+5*8]
+ fistp dword ptr [int5]
+ mov word ptr [edi+4*2],ax
+ mov eax,[int5]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+6*8]
+ fistp dword ptr [int6]
+ mov word ptr [edi+5*2],ax
+ mov eax,[int6]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+7*8]
+ fistp dword ptr [int7]
+ mov word ptr [edi+6*2],ax
+ mov eax,[int7]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ mov word ptr [edi+7*2],ax
+
+ add esi, 8*8
+ add edi, 8*2
+
+ sub ecx,0x80000001
+ js __floor
+ //align 16
+ test ecx,ecx // align jump &| redo flags
+ jnz __floor
+
+ // set x87 to default mode
+ fldcw [fpold]
+ };
}
diff --git a/src/filters/source/D2VSource/resource.h b/src/filters/source/D2VSource/resource.h
index 98cb5e018..1d1658441 100644
--- a/src/filters/source/D2VSource/resource.h
+++ b/src/filters/source/D2VSource/resource.h
@@ -3,7 +3,7 @@
// Used by d2vsource.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
index ffa885fef..fc6251abf 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -32,82 +32,82 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
#ifdef DDPLUS_ONLY
- {&__uuidof(CDTSAC3Source), L"MPC - DD+ Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin}
+ {&__uuidof(CDTSAC3Source), L"MPC - DD+ Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin}
#else
- {&__uuidof(CDTSAC3Source), L"MPC - DTS/AC3/DD+ Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CDTSAC3Source), L"MPC - DTS/AC3/DD+ Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
#endif
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDTSAC3Source>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDTSAC3Source>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
- _T("0"), _T("0,4,,7FFE8001"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("0"), _T("0,4,,7FFE8001"));
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
- _T("1"), _T("0,2,,0B77"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("1"), _T("0,2,,0B77"));
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
- _T("2"), _T("0,2,,770B"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("2"), _T("0,2,,770B"));
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
- _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
#ifndef DDPLUS_ONLY
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".dts"),
- _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".dts"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ac3"),
- _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ac3"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
#endif
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ddp"),
- _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ddp"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ec3"),
- _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ec3"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
#ifndef DDPLUS_ONLY
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".dts"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".ac3"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".dts"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ac3"));
#endif
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".ddp"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".ec3"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ddp"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ec3"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -121,7 +121,7 @@ CFilterApp theApp;
//
CDTSAC3Source::CDTSAC3Source(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseSource<CDTSAC3Stream>(NAME("CDTSAC3Source"), lpunk, phr, __uuidof(this))
+ : CBaseSource<CDTSAC3Stream>(NAME("CDTSAC3Source"), lpunk, phr, __uuidof(this))
{
}
@@ -131,165 +131,165 @@ CDTSAC3Source::~CDTSAC3Source()
// CDTSAC3Stream
-CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
- : CBaseStream(NAME("CDTSAC3Stream"), pParent, phr)
- , m_nFileOffset(0)
+CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
+ : CBaseStream(NAME("CDTSAC3Stream"), pParent, phr)
+ , m_nFileOffset(0)
{
- CAutoLock cAutoLock(&m_cSharedState);
-
- m_subtype = GUID_NULL;
- m_wFormatTag = 0;
- m_streamid = 0;
-
- CString fn(wfn);
-
- if(!m_file.Open(fn, CFile::modeRead | CFile::shareDenyNone))
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- DWORD id = 0;
- if(m_file.Read(&id, sizeof(id)) != sizeof(id)
- || id != 0x0180FE7F && (WORD)id != 0x0b77 && (WORD)id != 0x770b)
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- if(id == 0x0180FE7F)
- {
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ m_subtype = GUID_NULL;
+ m_wFormatTag = 0;
+ m_streamid = 0;
+
+ CString fn(wfn);
+
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ DWORD id = 0;
+ if(m_file.Read(&id, sizeof(id)) != sizeof(id)
+ || id != 0x0180FE7F && (WORD)id != 0x0b77 && (WORD)id != 0x770b)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(id == 0x0180FE7F)
+ {
#ifdef DDPLUS_ONLY
-//Temporary patch to disable DTS source
- if(phr) *phr = E_FAIL;
- return;
+//Temporary patch to disable DTS source
+ if(phr) *phr = E_FAIL;
+ return;
#endif
- BYTE buff[8];
- m_file.Read(buff, 8);
-
- int frametype = (buff[0] >> 7); // 1
- int deficitsamplecount = (buff[0] >> 2) & 31; // 5
- int crcpresent = (buff[0] >> 1) & 1; // 1
- int npcmsampleblocks = ((buff[0] & 1) << 6) | (buff[1] >> 2); // 7
- int framebytes = (((buff[1] & 3) << 12) | (buff[2] << 4) | (buff[3] >> 4)) + 1; // 14
- int audiochannelarrangement = (buff[3] & 15) << 2 | (buff[4] >> 6); // 6
- int freq = (buff[4] >> 2) & 15; // 4
- int transbitrate = ((buff[4] & 3) << 3) | (buff[5] >> 5); // 5
-
- int freqtbl[] =
- {
- 0, 8000, 16000, 32000,
- 0, 0,
- 11025, 22050, 44100,
- 0, 0,
- 12000, 24000, 48000,
- 0, 0
- };
-
- int bitratetbl[] =
- {
- 32000, 56000, 64000, 96000, 112000, 128000, 192000, 224000,
- 256000, 320000, 384000, 448000, 512000, 576000, 640000, 754500,
- 960000, 1024000, 1152000, 1280000, 1344000, 1408000, 1411200, 1472000,
- 1509750, 1920000, 2048000, 3072000, 3840000, 0, 0, 0
- };
+ BYTE buff[8];
+ m_file.Read(buff, 8);
+
+ int frametype = (buff[0]>>7); // 1
+ int deficitsamplecount = (buff[0]>>2)&31; // 5
+ int crcpresent = (buff[0]>>1)&1; // 1
+ int npcmsampleblocks = ((buff[0]&1)<<6)|(buff[1]>>2); // 7
+ int framebytes = (((buff[1]&3)<<12)|(buff[2]<<4)|(buff[3]>>4)) + 1; // 14
+ int audiochannelarrangement = (buff[3]&15)<<2|(buff[4]>>6); // 6
+ int freq = (buff[4]>>2)&15; // 4
+ int transbitrate = ((buff[4]&3)<<3)|(buff[5]>>5); // 5
+
+ int freqtbl[] =
+ {
+ 0,8000,16000,32000,
+ 0,0,
+ 11025,22050,44100,
+ 0,0,
+ 12000,24000,48000,
+ 0,0
+ };
+
+ int bitratetbl[] =
+ {
+ 32000,56000,64000,96000,112000,128000,192000,224000,
+ 256000,320000,384000,448000,512000,576000,640000,754500,
+ 960000,1024000,1152000,1280000,1344000,1408000,1411200,1472000,
+ 1509750,1920000,2048000,3072000,3840000,0,0,0
+ };
#define DTS_MAGIC_NUMBER 6 //magic number to make sonic audio decoder 4.2 happy
- m_nSamplesPerSec = freqtbl[freq];
- m_nAvgBytesPerSec = (bitratetbl[transbitrate] + 4) / 8;
+ m_nSamplesPerSec = freqtbl[freq];
+ m_nAvgBytesPerSec = (bitratetbl[transbitrate] + 4) / 8;
// m_nBytesPerFrame = m_nAvgBytesPerSec*10.656063618290258449304174950298/1000 + 0.5;
- m_nBytesPerFrame = framebytes * DTS_MAGIC_NUMBER;
- if(framebytes == 2012)
- {
- // DTS and DTS-HD tracks from HD DVD and Blu-Ray sources have framesizes of 2012 bytes
- // but if we handle them mathematically "correctly", audio sync will slowly drift away
- // we have to handle them as if they had 2013 bytes
- m_AvgTimePerFrame = 10000000i64 * (2013 * DTS_MAGIC_NUMBER) * 8 / bitratetbl[transbitrate];
- }
- else
- m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[transbitrate];
-
- m_subtype = MEDIASUBTYPE_DTS;
- m_wFormatTag = WAVE_FORMAT_DVD_DTS;
- m_streamid = 0x88;
- }
- else
- {
- BYTE info, info1, bsid;
- if((BYTE)id == 0x77) m_file.Seek(1, CFile::current); // LE
- m_file.Read(&info, 1);
- m_file.Read(&info1, 1);
- bsid = (info1 >> 3);
-
- if(bsid >= 0 && bsid <= 8) //AC3
- {
+ m_nBytesPerFrame = framebytes*DTS_MAGIC_NUMBER;
+ if (framebytes == 2012)
+ {
+ // DTS and DTS-HD tracks from HD DVD and Blu-Ray sources have framesizes of 2012 bytes
+ // but if we handle them mathematically "correctly", audio sync will slowly drift away
+ // we have to handle them as if they had 2013 bytes
+ m_AvgTimePerFrame = 10000000i64 * (2013*DTS_MAGIC_NUMBER) * 8 / bitratetbl[transbitrate];
+ }
+ else
+ m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[transbitrate];
+
+ m_subtype = MEDIASUBTYPE_DTS;
+ m_wFormatTag = WAVE_FORMAT_DVD_DTS;
+ m_streamid = 0x88;
+ }
+ else
+ {
+ BYTE info, info1, bsid;
+ if((BYTE)id == 0x77) m_file.Seek(1, CFile::current); // LE
+ m_file.Read(&info, 1);
+ m_file.Read(&info1, 1);
+ bsid = (info1>>3);
+
+ if(bsid>=0 && bsid<=8) //AC3
+ {
#ifdef DDPLUS_ONLY
-//Temporary patch to disable AC3 source
- if(phr) *phr = E_FAIL;
- return;
+//Temporary patch to disable AC3 source
+ if(phr) *phr = E_FAIL;
+ return;
#endif
- BYTE freq = info >> 6;
- BYTE bitrate = info & 0x3f;
+ BYTE freq = info>>6;
+ BYTE bitrate = info&0x3f;
- if(bitrate >= 38)
- {
- if(phr) *phr = E_FAIL;
- return;
- }
+ if(bitrate >= 38)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
- int freqtbl[] = {48000, 44100, 32000, 48000};
+ int freqtbl[] = {48000,44100,32000,48000};
- int bitratetbl[] =
- {
- 32000, 32000, 40000, 40000, 48000, 48000, 56000, 56000, 64000, 64000,
- 80000, 80000, 96000, 96000, 112000, 112000, 128000, 128000, 160000, 160000,
- 192000, 192000, 224000, 224000, 256000, 256000, 320000, 320000, 384000, 384000,
- 448000, 448000, 512000, 512000, 576000, 576000, 640000, 640000
- };
+ int bitratetbl[] =
+ {
+ 32000,32000,40000,40000,48000,48000,56000,56000,64000,64000,
+ 80000,80000,96000,96000,112000,112000,128000,128000,160000,160000,
+ 192000,192000,224000,224000,256000,256000,320000,320000,384000,384000,
+ 448000,448000,512000,512000,576000,576000,640000,640000
+ };
#define AC3_MAGIC_NUMBER 3 //magic number to make sonic audio decoder 4.2 happy
- m_nSamplesPerSec = freqtbl[freq];
- m_nAvgBytesPerSec = (bitratetbl[bitrate] + 4) / 8;
- m_nBytesPerFrame = m_nAvgBytesPerSec * 32 / 1000 * AC3_MAGIC_NUMBER;
- m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[bitrate];
-
- m_subtype = MEDIASUBTYPE_DOLBY_AC3;
- m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- m_streamid = 0x80;
-
- }
- else if(bsid >= 11 && bsid <= 16) //DD+
- {
- BYTE fscod = info >> 6;
- BYTE numblkscod = (info & 0x30) >> 4;
- if(fscod == 3)
- {
- fscod = numblkscod + 3;
- numblkscod = 3;
- }
-
- int freqtbl[] = {48000, 44100, 32000, 22400, 22050, 16000, 48000};
- m_nSamplesPerSec = freqtbl[fscod];
- m_nBytesPerFrame = (2 + (id >> 23) + ((id & 0x00070000) >> 7)) * 6;
- int timetbl[] = {320000, 640000, 960000, 1920000};
- m_AvgTimePerFrame = timetbl[numblkscod];
-
- m_subtype = MEDIASUBTYPE_DOLBY_AC3;
- m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- m_streamid = 0xC0;
- }
- else
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- }
-
- m_rtDuration = m_AvgTimePerFrame * m_file.GetLength() / m_nBytesPerFrame;
- m_rtStop = m_rtDuration;
+ m_nSamplesPerSec = freqtbl[freq];
+ m_nAvgBytesPerSec = (bitratetbl[bitrate] + 4) / 8;
+ m_nBytesPerFrame = m_nAvgBytesPerSec*32/1000*AC3_MAGIC_NUMBER;
+ m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[bitrate];
+
+ m_subtype = MEDIASUBTYPE_DOLBY_AC3;
+ m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ m_streamid = 0x80;
+
+ }
+ else if(bsid>=11 && bsid <=16) //DD+
+ {
+ BYTE fscod = info>>6;
+ BYTE numblkscod = (info&0x30)>>4;
+ if(fscod == 3)
+ {
+ fscod = numblkscod+3;
+ numblkscod = 3;
+ }
+
+ int freqtbl[] = {48000,44100,32000,22400,22050,16000,48000};
+ m_nSamplesPerSec = freqtbl[fscod];
+ m_nBytesPerFrame = (2+(id >> 23)+((id&0x00070000)>>7))*6;
+ int timetbl[] = {320000, 640000, 960000, 1920000};
+ m_AvgTimePerFrame = timetbl[numblkscod];
+
+ m_subtype = MEDIASUBTYPE_DOLBY_AC3;
+ m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ m_streamid = 0xC0;
+ }
+ else
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ }
+
+ m_rtDuration = m_AvgTimePerFrame * m_file.GetLength() / m_nBytesPerFrame;
+ m_rtStop = m_rtDuration;
}
CDTSAC3Stream::~CDTSAC3Stream()
@@ -303,8 +303,8 @@ HRESULT CDTSAC3Stream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERT
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = m_nBytesPerFrame + 35;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = m_nBytesPerFrame+35;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -317,157 +317,157 @@ HRESULT CDTSAC3Stream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERT
HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
{
- BYTE* pOutOrg = pOut;
-
- const GUID* majortype = &m_mt.majortype;
- const GUID* subtype = &m_mt.subtype;
-
- if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- {
- BYTE PESHeader[] =
- {
- 0x00, 0x00, 0x01, 0xBA, // PES id
- 0x44, 0x00, 0x04, 0x00, 0x04, 0x01, // SCR (0)
- 0x01, 0x89, 0xC3, 0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
- };
-
- memcpy(pOut, &PESHeader, sizeof(PESHeader));
- pOut += sizeof(PESHeader);
-
- majortype = &MEDIATYPE_MPEG2_PES;
- }
-
- if(*majortype == MEDIATYPE_MPEG2_PES)
- {
- BYTE Private1Header[] =
- {
- 0x00, 0x00, 0x01, 0xBD, // private stream 1 id
- (m_nBytesPerFrame + 15) >> 8, (m_nBytesPerFrame + 15) & 255, // packet length
- 0x81, 0x80, // marker, original, PTS - flags
- 0x08, // packet data starting offset
- 0x21, 0x00, 0x01, 0x00, 0x01, // PTS (0)
- 0xFF, 0xFF, 0xFF, // stuffing
- m_streamid, // stream id (0)
- 0x01, 0x00, 0x01, // no idea about this (might be the current sector on the disc), but dvd2avi doesn't output it to the ac3/dts file so we have to put it back
- };
-
- memcpy(pOut, &Private1Header, sizeof(Private1Header));
- pOut += sizeof(Private1Header);
-
- majortype = &MEDIATYPE_Audio;
- }
-
- if(*majortype == MEDIATYPE_Audio)
- {
- m_file.Seek(m_nFileOffset + nFrame * m_nBytesPerFrame, CFile::begin);
- if(m_file.Read(pOut, m_nBytesPerFrame) < m_nBytesPerFrame) return S_FALSE;
- pOut += m_nBytesPerFrame;
- }
-
- len = pOut - pOutOrg;
-
- return S_OK;
+ BYTE* pOutOrg = pOut;
+
+ const GUID* majortype = &m_mt.majortype;
+ const GUID* subtype = &m_mt.subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ BYTE PESHeader[] =
+ {
+ 0x00,0x00,0x01,0xBA, // PES id
+ 0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
+ 0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ BYTE Private1Header[] =
+ {
+ 0x00,0x00,0x01,0xBD, // private stream 1 id
+ (m_nBytesPerFrame+15)>>8,(m_nBytesPerFrame+15)&255, // packet length
+ 0x81,0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21,0x00,0x01,0x00,0x01, // PTS (0)
+ 0xFF,0xFF,0xFF, // stuffing
+ m_streamid, // stream id (0)
+ 0x01,0x00,0x01, // no idea about this (might be the current sector on the disc), but dvd2avi doesn't output it to the ac3/dts file so we have to put it back
+ };
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ m_file.Seek(m_nFileOffset + nFrame*m_nBytesPerFrame, CFile::begin);
+ if(m_file.Read(pOut, m_nBytesPerFrame) < m_nBytesPerFrame) return S_FALSE;
+ pOut += m_nBytesPerFrame;
+ }
+
+ len = pOut - pOutOrg;
+
+ return S_OK;
}
bool CDTSAC3Stream::CheckDTS(const CMediaType* pmt)
{
- return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
- || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DTS;
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DTS;
// return pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_DTS;
}
bool CDTSAC3Stream::CheckWAVEDTS(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
}
bool CDTSAC3Stream::CheckAC3(const CMediaType* pmt)
{
- return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
- || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
// return pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
}
bool CDTSAC3Stream::CheckWAVEAC3(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
}
HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition >= 0 && iPosition < 5)
- {
- pmt->subtype = m_subtype;
- pmt->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->wFormatTag = WAVE_FORMAT_PCM;
- wfe->nSamplesPerSec = m_nSamplesPerSec;
- wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
- wfe->nChannels = 6;
-
- switch(iPosition)
- {
- case 0:
- pmt->majortype = MEDIATYPE_Audio;
- break;
- case 1:
- pmt->ResetFormatBuffer();
- pmt->formattype = FORMAT_None;
- case 2:
- pmt->majortype = MEDIATYPE_MPEG2_PES;
- break;
- case 3:
- pmt->ResetFormatBuffer();
- pmt->formattype = FORMAT_None;
- case 4:
- pmt->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
- break;
- default:
- return E_INVALIDARG;
- }
- }
- else if(iPosition == 5)
- {
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = FOURCCMap(m_wFormatTag);
- pmt->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->wFormatTag = m_wFormatTag;
- wfe->nSamplesPerSec = m_nSamplesPerSec;
- wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
- wfe->nChannels = 2;
- wfe->nBlockAlign = 1;
- }
- else
- {
- return VFW_S_NO_MORE_ITEMS;
- }
+ if(iPosition >= 0 && iPosition < 5)
+ {
+ pmt->subtype = m_subtype;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nSamplesPerSec = m_nSamplesPerSec;
+ wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
+ wfe->nChannels = 6;
+
+ switch(iPosition)
+ {
+ case 0:
+ pmt->majortype = MEDIATYPE_Audio;
+ break;
+ case 1:
+ pmt->ResetFormatBuffer();
+ pmt->formattype = FORMAT_None;
+ case 2:
+ pmt->majortype = MEDIATYPE_MPEG2_PES;
+ break;
+ case 3:
+ pmt->ResetFormatBuffer();
+ pmt->formattype = FORMAT_None;
+ case 4:
+ pmt->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
+ break;
+ default:
+ return E_INVALIDARG;
+ }
+ }
+ else if(iPosition == 5)
+ {
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = FOURCCMap(m_wFormatTag);
+ pmt->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = m_wFormatTag;
+ wfe->nSamplesPerSec = m_nSamplesPerSec;
+ wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
+ wfe->nChannels = 2;
+ wfe->nBlockAlign = 1;
+ }
+ else
+ {
+ return VFW_S_NO_MORE_ITEMS;
+ }
pmt->SetTemporalCompression(FALSE);
- return S_OK;
+ return S_OK;
}
HRESULT CDTSAC3Stream::CheckMediaType(const CMediaType* pmt)
{
- return CheckDTS(pmt) || CheckWAVEDTS(pmt)
- || CheckAC3(pmt) || CheckWAVEAC3(pmt)
- ? S_OK
- : E_INVALIDARG;
+ return CheckDTS(pmt) || CheckWAVEDTS(pmt)
+ || CheckAC3(pmt) || CheckWAVEAC3(pmt)
+ ? S_OK
+ : E_INVALIDARG;
}
diff --git a/src/filters/source/DTSAC3Source/DTSAC3Source.h b/src/filters/source/DTSAC3Source/DTSAC3Source.h
index 4022d58db..6c9a30140 100644
--- a/src/filters/source/DTSAC3Source/DTSAC3Source.h
+++ b/src/filters/source/DTSAC3Source/DTSAC3Source.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,30 +30,30 @@ class CDTSAC3Stream;
class CDTSAC3Source : public CBaseSource<CDTSAC3Stream>
{
public:
- CDTSAC3Source(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CDTSAC3Source();
+ CDTSAC3Source(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDTSAC3Source();
};
class CDTSAC3Stream : public CBaseStream
{
- CFile m_file;
- int m_nFileOffset, m_nBytesPerFrame, m_nAvgBytesPerSec, m_nSamplesPerSec;
- GUID m_subtype;
- WORD m_wFormatTag;
- BYTE m_streamid;
+ CFile m_file;
+ int m_nFileOffset, m_nBytesPerFrame, m_nAvgBytesPerSec, m_nSamplesPerSec;
+ GUID m_subtype;
+ WORD m_wFormatTag;
+ BYTE m_streamid;
- bool CheckDTS(const CMediaType* pmt);
- bool CheckWAVEDTS(const CMediaType* pmt);
- bool CheckAC3(const CMediaType* pmt);
- bool CheckWAVEAC3(const CMediaType* pmt);
+ bool CheckDTS(const CMediaType* pmt);
+ bool CheckWAVEDTS(const CMediaType* pmt);
+ bool CheckAC3(const CMediaType* pmt);
+ bool CheckWAVEAC3(const CMediaType* pmt);
public:
CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
- virtual ~CDTSAC3Stream();
+ virtual ~CDTSAC3Stream();
HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
-
- HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
HRESULT CheckMediaType(const CMediaType* pMediaType);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
};
diff --git a/src/filters/source/DTSAC3Source/resource.h b/src/filters/source/DTSAC3Source/resource.h
index 6e541c0c4..3507c6e74 100644
--- a/src/filters/source/DTSAC3Source/resource.h
+++ b/src/filters/source/DTSAC3Source/resource.h
@@ -3,7 +3,7 @@
// Used by dtsac3source.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/source/DTSAC3Source/stdafx.cpp b/src/filters/source/DTSAC3Source/stdafx.cpp
index 4b148b3b2..396f14d73 100644
--- a/src/filters/source/DTSAC3Source/stdafx.cpp
+++ b/src/filters/source/DTSAC3Source/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/DTSAC3Source/stdafx.h b/src/filters/source/DTSAC3Source/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/source/DTSAC3Source/stdafx.h
+++ b/src/filters/source/DTSAC3Source/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/FLICSource/FLICSource.cpp b/src/filters/source/FLICSource/FLICSource.cpp
index 1d892df6f..1c291cd33 100644
--- a/src/filters/source/FLICSource/FLICSource.cpp
+++ b/src/filters/source/FLICSource/FLICSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,58 +27,58 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CFLICSource), L"MPC - FLICSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CFLICSource), L"MPC - FLICSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFLICSource>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFLICSource>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
- _T("0"), _T("4,2,,11AF"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("0"), _T("4,2,,11AF"));
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
- _T("1"), _T("4,2,,12AF"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("1"), _T("4,2,,12AF"));
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
- _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".fli"),
- _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".fli"),
+ _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".flc"),
- _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".flc"),
+ _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".fli"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".flc"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".fli"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".flc"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -92,7 +92,7 @@ CFilterApp theApp;
//
CFLICSource::CFLICSource(LPUNKNOWN lpunk, HRESULT* phr)
- : CSource(NAME("CFLICSource"), lpunk, __uuidof(this))
+ : CSource(NAME("CFLICSource"), lpunk, __uuidof(this))
{
}
@@ -104,205 +104,205 @@ STDMETHODIMP CFLICSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IFileSourceFilter)
- QI(IAMFilterMiscFlags)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IFileSourceFilter
-STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(GetPinCount() > 0)
- return VFW_E_ALREADY_CONNECTED;
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
- HRESULT hr = S_OK;
- if(!(DNew CFLICStream(pszFileName, this, &hr)))
- return E_OUTOFMEMORY;
+ HRESULT hr = S_OK;
+ if(!(DNew CFLICStream(pszFileName, this, &hr)))
+ return E_OUTOFMEMORY;
- if(FAILED(hr))
- return hr;
+ if(FAILED(hr))
+ return hr;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CFLICSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- wcscpy(*ppszFileName, m_fn);
+ wcscpy(*ppszFileName, m_fn);
- return S_OK;
+ return S_OK;
}
// IAMFilterMiscFlags
ULONG CFLICSource::GetMiscFlags()
{
- return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
}
// CFLICStream
-CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
- : CSourceStream(NAME("FLICStream"), phr, pParent, L"Output")
- , CSourceSeeking(NAME("FLICStream"), (IPin*)this, phr, &m_cSharedState)
- , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
-{
- CAutoLock cAutoLock(&m_cSharedState);
-
- CString fn(wfn);
-
- if(!m_flic.Open(fn, CFile::modeRead | CFile::shareDenyNone))
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- if(m_flic.Read(&m_hdr, sizeof(m_hdr)) != sizeof(m_hdr)
- || (m_hdr.id != 0xaf11 && m_hdr.id != 0xaf12)
- || m_hdr.bpp != 8)
- {
- if(phr) *phr = E_FAIL;
- return;
- }
-
- m_AvgTimePerFrame = (m_hdr.id == 0xaf11)
- ? 10000000i64 * max(m_hdr.ticks, 1) / 70
- : 10000000i64 * max(m_hdr.ticks, 1) / 1000;
-
- // not tested (lack of test files)
- {
- __int64 pos = m_flic.GetPosition();
- FLIC_PREFIX fp;
- if(m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.id != 0xf100)
- m_flic.Seek(pos, CFile::begin);
- else
- m_flic.Seek(pos + fp.size, CFile::begin);
- }
-
- do
- {
- FLIC_FRAME_ENTRY ffe;
- if(m_flic.Read(&ffe.hdr, sizeof(ffe.hdr)) != sizeof(ffe.hdr) || ffe.hdr.id != 0xf1fa)
- break;
- ffe.pos = m_flic.GetPosition();
- ffe.fKeyframe = (m_frames.GetCount() == 0);
-
- int chunk = 0;
- while(chunk < ffe.hdr.chunks)
- {
- FLIC_CHUNK fc;
- if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
- break;
- /*
- switch(fc.type)
- {
- case FLIC_COLOR: _colorchunk(); break;
- case FLIC_256_COLOR: _color256chunk(); break;
- case FLIC_BRUN: _brunchunk(); break;
- case FLIC_LC: _lcchunk(); break;
- case FLIC_DELTA: _deltachunk(); break;
- case FLIC_BLACK: _blackchunk(); break;
- case FLIC_COPY: _copychunk(); break;
- case FLIC_MINI: break;
- default: break;
- }
- */
- ffe.fKeyframe =
- (/*fc.type == FLIC_256_COLOR
+CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
+ : CSourceStream(NAME("FLICStream"), phr, pParent, L"Output")
+ , CSourceSeeking(NAME("FLICStream"), (IPin*)this, phr, &m_cSharedState)
+ , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ CString fn(wfn);
+
+ if(!m_flic.Open(fn, CFile::modeRead|CFile::shareDenyNone))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(m_flic.Read(&m_hdr, sizeof(m_hdr)) != sizeof(m_hdr)
+ || (m_hdr.id != 0xaf11 && m_hdr.id != 0xaf12)
+ || m_hdr.bpp != 8)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ m_AvgTimePerFrame = (m_hdr.id == 0xaf11)
+ ? 10000000i64 * max(m_hdr.ticks, 1) / 70
+ : 10000000i64 * max(m_hdr.ticks, 1) / 1000;
+
+ // not tested (lack of test files)
+ {
+ __int64 pos = m_flic.GetPosition();
+ FLIC_PREFIX fp;
+ if(m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.id != 0xf100)
+ m_flic.Seek(pos, CFile::begin);
+ else
+ m_flic.Seek(pos + fp.size, CFile::begin);
+ }
+
+ do
+ {
+ FLIC_FRAME_ENTRY ffe;
+ if(m_flic.Read(&ffe.hdr, sizeof(ffe.hdr)) != sizeof(ffe.hdr) || ffe.hdr.id != 0xf1fa)
+ break;
+ ffe.pos = m_flic.GetPosition();
+ ffe.fKeyframe = (m_frames.GetCount() == 0);
+
+ int chunk = 0;
+ while(chunk < ffe.hdr.chunks)
+ {
+ FLIC_CHUNK fc;
+ if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
+ break;
+/*
+ switch(fc.type)
+ {
+ case FLIC_COLOR: _colorchunk(); break;
+ case FLIC_256_COLOR: _color256chunk(); break;
+ case FLIC_BRUN: _brunchunk(); break;
+ case FLIC_LC: _lcchunk(); break;
+ case FLIC_DELTA: _deltachunk(); break;
+ case FLIC_BLACK: _blackchunk(); break;
+ case FLIC_COPY: _copychunk(); break;
+ case FLIC_MINI: break;
+ default: break;
+ }
+*/
+ ffe.fKeyframe =
+ (/*fc.type == FLIC_256_COLOR
|| fc.type == FLIC_64_COLOR
- ||*/ fc.type == FLIC_BRUN
- || fc.type == FLIC_BLACK
- || fc.type == FLIC_COPY);
-
- __int64 pos = m_flic.GetPosition() + fc.size - sizeof(fc);
- if(m_flic.Seek(pos, CFile::begin) != pos)
- break;
-
- chunk++;
- }
- if(chunk < ffe.hdr.chunks)
- break;
-
- __int64 pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
- if(m_flic.Seek(pos, CFile::begin) != pos)
- break;
-
- m_frames.Add(ffe);
- }
- while(1);
-
- m_nLastFrameNum = -1;
- memset(m_pPalette, 0, sizeof(m_pPalette));
- m_nBufferSize = m_hdr.x * m_hdr.y * 32 >> 3;
- if(!m_pFrameBuffer.Allocate(m_nBufferSize))
- {
- if(phr) *phr = E_OUTOFMEMORY;
- return;
- }
-
- m_rtDuration = m_rtStop = m_AvgTimePerFrame * m_frames.GetCount();
-
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ ||*/ fc.type == FLIC_BRUN
+ || fc.type == FLIC_BLACK
+ || fc.type == FLIC_COPY);
+
+ __int64 pos = m_flic.GetPosition() + fc.size - sizeof(fc);
+ if(m_flic.Seek(pos, CFile::begin) != pos)
+ break;
+
+ chunk++;
+ }
+ if(chunk < ffe.hdr.chunks)
+ break;
+
+ __int64 pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
+ if(m_flic.Seek(pos, CFile::begin) != pos)
+ break;
+
+ m_frames.Add(ffe);
+ }
+ while(1);
+
+ m_nLastFrameNum = -1;
+ memset(m_pPalette, 0, sizeof(m_pPalette));
+ m_nBufferSize = m_hdr.x*m_hdr.y*32>>3;
+ if(!m_pFrameBuffer.Allocate(m_nBufferSize))
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_frames.GetCount();
+
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
CFLICStream::~CFLICStream()
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
}
STDMETHODIMP CFLICStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
- : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+ return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
void CFLICStream::UpdateFromSeek()
{
- if(ThreadExists())
- {
- // next time around the loop, the worker thread will
- // pick up the position change.
- // We need to flush all the existing data - we must do that here
- // as our thread will probably be blocked in GetBuffer otherwise
-
- m_bFlushing = TRUE;
-
- DeliverBeginFlush();
- // make sure we have stopped pushing
- Stop();
- // complete the flush
- DeliverEndFlush();
+ if(ThreadExists())
+ {
+ // next time around the loop, the worker thread will
+ // pick up the position change.
+ // We need to flush all the existing data - we must do that here
+ // as our thread will probably be blocked in GetBuffer otherwise
+
+ m_bFlushing = TRUE;
+
+ DeliverBeginFlush();
+ // make sure we have stopped pushing
+ Stop();
+ // complete the flush
+ DeliverEndFlush();
m_bFlushing = FALSE;
- // restart
- Run();
- }
+ // restart
+ Run();
+ }
}
HRESULT CFLICStream::SetRate(double dRate)
{
- if(dRate <= 0)
- return E_INVALIDARG;
+ if(dRate <= 0)
+ return E_INVALIDARG;
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- m_dRateSeeking = dRate;
- }
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_dRateSeeking = dRate;
+ }
- UpdateFromSeek();
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CFLICStream::OnThreadStartPlay()
@@ -315,8 +315,8 @@ HRESULT CFLICStream::ChangeStart()
{
{
CAutoLock lock(CSourceSeeking::m_pLock);
- m_rtSampleTime = 0;
- m_rtPosition = m_rtStart;
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
}
UpdateFromSeek();
@@ -329,7 +329,7 @@ HRESULT CFLICStream::ChangeStop()
{
CAutoLock lock(CSourceSeeking::m_pLock);
if(m_rtPosition < m_rtStop)
- return S_OK;
+ return S_OK;
}
// We're already past the new stop time -- better flush the graph.
@@ -356,8 +356,8 @@ HRESULT CFLICStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIE
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = m_nBufferSize;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = m_nBufferSize;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -370,71 +370,71 @@ HRESULT CFLICStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIE
HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
{
- HRESULT hr;
+ HRESULT hr;
- {
- CAutoLock cAutoLockShared(&m_cSharedState);
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
if(m_rtPosition >= m_rtStop)
- return S_FALSE;
-
- BYTE* pDataIn = m_pFrameBuffer;
- BYTE* pDataOut = NULL;
- if(!pDataIn || FAILED(hr = pSample->GetPointer(&pDataOut)) || !pDataOut)
- return S_FALSE;
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- SetMediaType(&mt);
-
- DeleteMediaType(pmt);
- }
-
- int w, h, bpp;
- if(m_mt.formattype == FORMAT_VideoInfo)
- {
- w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
- h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
- bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else if(m_mt.formattype == FORMAT_VideoInfo2)
- {
- w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
- h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
- bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
- }
- else
- {
- return S_FALSE;
- }
-
- int pitchIn = m_hdr.x;
- int pitchOut = w * bpp >> 3;
-
- int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
-
- {
- SeekToNearestKeyFrame(nFrame);
-
- while(m_nLastFrameNum < nFrame && !m_bFlushing)
- ExtractFrame(++m_nLastFrameNum);
-
- for(int y = 0, p = min(pitchIn, pitchOut);
- y < h;
- y++, pDataIn += pitchIn, pDataOut += pitchOut)
- {
- BYTE* src = pDataIn;
- BYTE* end = src + p;
- DWORD* dst = (DWORD*)pDataOut;
- while(src < end) *dst++ = m_pPalette[*src++];
- }
- }
-
- pSample->SetActualDataLength(pitchOut * h);
-
- REFERENCE_TIME rtStart, rtStop;
+ return S_FALSE;
+
+ BYTE* pDataIn = m_pFrameBuffer;
+ BYTE* pDataOut = NULL;
+ if(!pDataIn || FAILED(hr = pSample->GetPointer(&pDataOut)) || !pDataOut)
+ return S_FALSE;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+
+ DeleteMediaType(pmt);
+ }
+
+ int w, h, bpp;
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else
+ {
+ return S_FALSE;
+ }
+
+ int pitchIn = m_hdr.x;
+ int pitchOut = w*bpp>>3;
+
+ int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
+
+ {
+ SeekToNearestKeyFrame(nFrame);
+
+ while(m_nLastFrameNum < nFrame && !m_bFlushing)
+ ExtractFrame(++m_nLastFrameNum);
+
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pDataIn += pitchIn, pDataOut += pitchOut)
+ {
+ BYTE* src = pDataIn;
+ BYTE* end = src + p;
+ DWORD* dst = (DWORD*)pDataOut;
+ while(src < end) *dst++ = m_pPalette[*src++];
+ }
+ }
+
+ pSample->SetActualDataLength(pitchOut*h);
+
+ REFERENCE_TIME rtStart, rtStop;
// The sample times are modified by the current rate.
rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
@@ -442,17 +442,17 @@ HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
m_rtSampleTime += m_AvgTimePerFrame;
m_rtPosition += m_AvgTimePerFrame;
- }
+ }
- pSample->SetSyncPoint(TRUE);
+ pSample->SetSyncPoint(TRUE);
- if(m_bDiscontinuity)
+ if(m_bDiscontinuity)
{
- pSample->SetDiscontinuity(TRUE);
- m_bDiscontinuity = FALSE;
- }
+ pSample->SetDiscontinuity(TRUE);
+ m_bDiscontinuity = FALSE;
+ }
- return S_OK;
+ return S_OK;
}
HRESULT CFLICStream::GetMediaType(int iPosition, CMediaType* pmt)
@@ -467,309 +467,290 @@ HRESULT CFLICStream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->SetFormatType(&FORMAT_VideoInfo);
pmt->SetTemporalCompression(TRUE);
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
- vih->AvgTimePerFrame = m_AvgTimePerFrame;
- vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
- vih->bmiHeader.biWidth = m_hdr.x;
- vih->bmiHeader.biHeight = -m_hdr.y;
- vih->bmiHeader.biPlanes = 1;
- vih->bmiHeader.biBitCount = 32;
- vih->bmiHeader.biCompression = BI_RGB;
- vih->bmiHeader.biSizeImage = m_nBufferSize;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->AvgTimePerFrame = m_AvgTimePerFrame;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = m_hdr.x;
+ vih->bmiHeader.biHeight = -m_hdr.y;
+ vih->bmiHeader.biPlanes = 1;
+ vih->bmiHeader.biBitCount = 32;
+ vih->bmiHeader.biCompression = BI_RGB;
+ vih->bmiHeader.biSizeImage = m_nBufferSize;
- pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
+ pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
return NOERROR;
}
HRESULT CFLICStream::CheckConnect(IPin* pPin)
{
- return CSourceStream::CheckConnect(pPin);
+ return CSourceStream::CheckConnect(pPin);
}
HRESULT CFLICStream::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Video
- && pmt->subtype == MEDIASUBTYPE_RGB32
- && pmt->formattype == FORMAT_VideoInfo) return S_OK;
+ if(pmt->majortype == MEDIATYPE_Video
+ && pmt->subtype == MEDIASUBTYPE_RGB32
+ && pmt->formattype == FORMAT_VideoInfo) return S_OK;
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
STDMETHODIMP CFLICStream::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
////////
void CFLICStream::SeekToNearestKeyFrame(int nFrame)
{
- if(m_nLastFrameNum == nFrame)
- return;
+ if(m_nLastFrameNum == nFrame)
+ return;
- if(m_nLastFrameNum > nFrame)
- m_nLastFrameNum = -1;
+ if(m_nLastFrameNum > nFrame)
+ m_nLastFrameNum = -1;
- for(int i = m_nLastFrameNum + 1, j = min(m_frames.GetCount(), nFrame); i < j; i++)
- {
- FLIC_FRAME_ENTRY& ffe = m_frames[i];
- if(ffe.fKeyframe)
- m_nLastFrameNum = i - 1;
- }
+ for(int i = m_nLastFrameNum+1, j = min(m_frames.GetCount(), nFrame); i < j; i++)
+ {
+ FLIC_FRAME_ENTRY& ffe = m_frames[i];
+ if(ffe.fKeyframe)
+ m_nLastFrameNum = i-1;
+ }
}
void CFLICStream::ExtractFrame(int nFrame)
{
- FLIC_FRAME_ENTRY& ffe = m_frames[nFrame];
+ FLIC_FRAME_ENTRY& ffe = m_frames[nFrame];
- bool fNewPalette = false;
- bool fNewFrame = false;
+ bool fNewPalette = false;
+ bool fNewFrame = false;
- m_flic.Seek(ffe.pos, CFile::begin);
+ m_flic.Seek(ffe.pos, CFile::begin);
- int chunk = 0;
- while(chunk < ffe.hdr.chunks)
- {
- FLIC_CHUNK fc;
- if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
- break;
-
- __int64 next = m_flic.GetPosition() + fc.size - sizeof(fc);
-
- switch(fc.type)
- {
- case FLIC_64_COLOR:
- fNewPalette = _colorchunk(true);
- break;
- case FLIC_256_COLOR:
- fNewPalette = _colorchunk(false);
- break;
- case FLIC_BRUN:
- _brunchunk();
- fNewFrame = true;
- break;
- case FLIC_LC:
- _lcchunk();
- break;
- case FLIC_DELTA:
- _deltachunk();
- break;
- case FLIC_BLACK:
- _blackchunk();
- fNewFrame = true;
- break;
- case FLIC_COPY:
- _copychunk();
- fNewFrame = true;
- break;
- case FLIC_MINI:
- break;
- default:
- break;
- }
-
- if(m_flic.Seek(next, CFile::begin) != next)
- break;
-
- chunk++;
- }
+ int chunk = 0;
+ while(chunk < ffe.hdr.chunks)
+ {
+ FLIC_CHUNK fc;
+ if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
+ break;
+
+ __int64 next = m_flic.GetPosition() + fc.size - sizeof(fc);
+
+ switch(fc.type)
+ {
+ case FLIC_64_COLOR: fNewPalette = _colorchunk(true); break;
+ case FLIC_256_COLOR: fNewPalette = _colorchunk(false); break;
+ case FLIC_BRUN: _brunchunk(); fNewFrame = true; break;
+ case FLIC_LC: _lcchunk(); break;
+ case FLIC_DELTA: _deltachunk(); break;
+ case FLIC_BLACK: _blackchunk(); fNewFrame = true; break;
+ case FLIC_COPY: _copychunk(); fNewFrame = true; break;
+ case FLIC_MINI: break;
+ default: break;
+ }
+
+ if(m_flic.Seek(next, CFile::begin) != next)
+ break;
- if(chunk < ffe.hdr.chunks)
- ASSERT(0);
+ chunk++;
+ }
- ffe.fKeyframe = (fNewPalette && fNewFrame);
+ if(chunk < ffe.hdr.chunks)
+ ASSERT(0);
+
+ ffe.fKeyframe = (fNewPalette && fNewFrame);
}
void CFLICStream::_blackchunk()
{
- memset(m_pFrameBuffer, 0, m_nBufferSize);
+ memset(m_pFrameBuffer, 0, m_nBufferSize);
}
void CFLICStream::_copychunk()
{
- m_flic.Read(m_pFrameBuffer, m_nBufferSize);
+ m_flic.Read(m_pFrameBuffer, m_nBufferSize);
}
bool CFLICStream::_colorchunk(bool f64)
{
- int nColorsUpdated = 0;
-
- BYTE skip = 0;
-
- WORD packets;
- m_flic.Read(&packets, sizeof(packets));
-
- while(packets--)
- {
- BYTE skip2;
- m_flic.Read(&skip2, sizeof(skip2));
- skip += skip2;
-
- BYTE count;
- m_flic.Read(&count, sizeof(count));
-
- int len = (count == 0 ? (256 - skip) : count);
- while(len-- > 0)
- {
- BYTE r, g, b;
- m_flic.Read(&r, sizeof(r));
- m_flic.Read(&g, sizeof(g));
- m_flic.Read(&b, sizeof(b));
- m_pPalette[skip++] = f64
- ? ((r << 18) & 0xff0000) | ((g << 10) & 0xff00) | ((b << 2) & 0xff)
- : ((r << 16) & 0xff0000) | ((g << 8) & 0xff00) | ((b << 0) & 0xff);
- nColorsUpdated++;
- }
- }
-
- return(nColorsUpdated == 256);
+ int nColorsUpdated = 0;
+
+ BYTE skip = 0;
+
+ WORD packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ while(packets--)
+ {
+ BYTE skip2;
+ m_flic.Read(&skip2, sizeof(skip2));
+ skip += skip2;
+
+ BYTE count;
+ m_flic.Read(&count, sizeof(count));
+
+ int len = (count == 0 ? (256-skip) : count);
+ while(len-- > 0)
+ {
+ BYTE r, g, b;
+ m_flic.Read(&r, sizeof(r));
+ m_flic.Read(&g, sizeof(g));
+ m_flic.Read(&b, sizeof(b));
+ m_pPalette[skip++] = f64
+ ? ((r << 18)&0xff0000) | ((g << 10)&0xff00) | ((b << 2)&0xff)
+ : ((r << 16)&0xff0000) | ((g << 8)&0xff00) | ((b << 0)&0xff);
+ nColorsUpdated++;
+ }
+ }
+
+ return(nColorsUpdated == 256);
}
void CFLICStream::_brunchunk()
{
- BYTE* tmp = m_pFrameBuffer;
-
- int lines = m_hdr.y;
- while(lines--)
- {
- BYTE packets;
- m_flic.Read(&packets, sizeof(packets));
-
- BYTE* ptr = tmp;
-
- while(ptr < tmp + m_hdr.x)
- {
- signed char count;
- m_flic.Read(&count, sizeof(count));
-
- if(count >= 0)
- {
- BYTE c;
- m_flic.Read(&c, sizeof(c));
- memset(ptr, c, count);
- ptr += count;
- }
- else
- {
- m_flic.Read(ptr, -count);
- ptr += -count;
- }
- }
-
- tmp += m_hdr.x;
- }
+ BYTE* tmp = m_pFrameBuffer;
+
+ int lines = m_hdr.y;
+ while(lines--)
+ {
+ BYTE packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ BYTE* ptr = tmp;
+
+ while(ptr < tmp + m_hdr.x)
+ {
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+
+ if(count >= 0)
+ {
+ BYTE c;
+ m_flic.Read(&c, sizeof(c));
+ memset(ptr, c, count);
+ ptr += count;
+ }
+ else
+ {
+ m_flic.Read(ptr, -count);
+ ptr += -count;
+ }
+ }
+
+ tmp += m_hdr.x;
+ }
}
void CFLICStream::_lcchunk()
{
- WORD y;
- m_flic.Read(&y, sizeof(y));
+ WORD y;
+ m_flic.Read(&y, sizeof(y));
- BYTE* tmp = &m_pFrameBuffer[y*m_hdr.x];
+ BYTE* tmp = &m_pFrameBuffer[y*m_hdr.x];
- WORD lines;
- m_flic.Read(&lines, sizeof(lines));
+ WORD lines;
+ m_flic.Read(&lines, sizeof(lines));
- while(lines--)
- {
- BYTE* ptr = tmp;
-
- BYTE packets;
- m_flic.Read(&packets, sizeof(packets));
-
- while(packets--)
- {
- BYTE skip;
- m_flic.Read(&skip, sizeof(skip));
-
- ptr += skip;
-
- signed char count;
- m_flic.Read(&count, sizeof(count));
-
- if(count >= 0)
- {
- m_flic.Read(ptr, count);
- ptr += count;
- }
- else
- {
- BYTE c;
- m_flic.Read(&c, sizeof(c));
- memset(ptr, c, -count);
- ptr += -count;
- }
- }
-
- tmp += m_hdr.x;
- }
+ while(lines--)
+ {
+ BYTE* ptr = tmp;
+
+ BYTE packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ while(packets--)
+ {
+ BYTE skip;
+ m_flic.Read(&skip, sizeof(skip));
+
+ ptr += skip;
+
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+
+ if(count >= 0)
+ {
+ m_flic.Read(ptr, count);
+ ptr += count;
+ }
+ else
+ {
+ BYTE c;
+ m_flic.Read(&c, sizeof(c));
+ memset(ptr, c, -count);
+ ptr += -count;
+ }
+ }
+
+ tmp += m_hdr.x;
+ }
}
void CFLICStream::_deltachunk()
{
- BYTE* tmp = m_pFrameBuffer;
-
- WORD lines;
- m_flic.Read(&lines, sizeof(lines));
-
- while(lines--)
- {
- signed short packets;
- m_flic.Read(&packets, sizeof(packets));
-
- if(packets < 0)
- {
- if(packets & 0x4000)
- {
- tmp += -packets * m_hdr.x;
- lines++;
- }
- else
- {
- signed char count;
- m_flic.Read(&count, sizeof(count));
- tmp[m_hdr.x-1] = (BYTE)packets;
- }
- }
- else
- {
- BYTE* ptr = tmp;
-
- while(packets--)
- {
- BYTE skip;
- m_flic.Read(&skip, sizeof(skip));
-
- ptr += skip;
-
- signed char count;
- m_flic.Read(&count, sizeof(count));
-
- if(count >= 0)
- {
- // Fix vulnerability : http://www.team509.com/modules.php?name=News&file=article&sid=38
- if((count << 1) + (long)(ptr - m_pFrameBuffer) < m_nBufferSize)
- m_flic.Read(ptr, count << 1);
- else
- ASSERT(FALSE);
- ptr += count << 1;
- }
- else
- {
- WORD c;
- m_flic.Read(&c, sizeof(c));
- count = -count;
- while(count-- > 0)
- {
- *ptr++ = c >> 8;
- *ptr++ = c & 0xff;
- }
- }
- }
-
- tmp += m_hdr.x;
- }
- }
+ BYTE* tmp = m_pFrameBuffer;
+
+ WORD lines;
+ m_flic.Read(&lines, sizeof(lines));
+
+ while(lines--)
+ {
+ signed short packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ if(packets < 0)
+ {
+ if(packets&0x4000)
+ {
+ tmp += -packets * m_hdr.x;
+ lines++;
+ }
+ else
+ {
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+ tmp[m_hdr.x-1] = (BYTE)packets;
+ }
+ }
+ else
+ {
+ BYTE* ptr = tmp;
+
+ while(packets--)
+ {
+ BYTE skip;
+ m_flic.Read(&skip, sizeof(skip));
+
+ ptr += skip;
+
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+
+ if(count >= 0)
+ {
+ // Fix vulnerability : http://www.team509.com/modules.php?name=News&file=article&sid=38
+ if ((count << 1) + (long)(ptr - m_pFrameBuffer) < m_nBufferSize)
+ m_flic.Read(ptr, count << 1);
+ else
+ ASSERT(FALSE);
+ ptr += count << 1;
+ }
+ else
+ {
+ WORD c;
+ m_flic.Read(&c, sizeof(c));
+ count = -count;
+ while(count-- > 0)
+ {
+ *ptr++ = c>>8;
+ *ptr++ = c&0xff;
+ }
+ }
+ }
+
+ tmp += m_hdr.x;
+ }
+ }
}
diff --git a/src/filters/source/FLICSource/FLICSource.h b/src/filters/source/FLICSource/FLICSource.h
index 801f69286..acbade1e8 100644
--- a/src/filters/source/FLICSource/FLICSource.h
+++ b/src/filters/source/FLICSource/FLICSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,134 +26,131 @@
#pragma pack(push, 1)
enum
{
- FLIC_256_COLOR = 4,
- FLIC_DELTA = 7,
- FLIC_64_COLOR = 11,
- FLIC_LC = 12,
- FLIC_BLACK = 13,
- FLIC_BRUN = 15,
- FLIC_COPY = 16,
- FLIC_MINI = 18
+ FLIC_256_COLOR = 4,
+ FLIC_DELTA = 7,
+ FLIC_64_COLOR = 11,
+ FLIC_LC = 12,
+ FLIC_BLACK = 13,
+ FLIC_BRUN = 15,
+ FLIC_COPY = 16,
+ FLIC_MINI = 18
};
-
+
struct FLIC
{
- DWORD size;
- WORD id; // 0xaf11 or 0xaf12
- WORD frames, x, y, bpp;
- WORD flags, ticks;
- DWORD next, frit;
- BYTE reserved[102];
+ DWORD size;
+ WORD id; // 0xaf11 or 0xaf12
+ WORD frames, x, y, bpp;
+ WORD flags, ticks;
+ DWORD next, frit;
+ BYTE reserved[102];
};
struct FLIC_PREFIX
{
- DWORD size;
- WORD id; // 0xf100
- WORD chunks;
- BYTE reserved[8];
+ DWORD size;
+ WORD id; // 0xf100
+ WORD chunks;
+ BYTE reserved[8];
};
struct FLIC_FRAME
{
- DWORD size;
- WORD id; // 0xf1fa
- WORD chunks;
- BYTE reserved[8];
+ DWORD size;
+ WORD id; // 0xf1fa
+ WORD chunks;
+ BYTE reserved[8];
};
struct FLIC_CHUNK
{
- DWORD size;
- WORD type;
+ DWORD size;
+ WORD type;
};
#pragma pack(pop)
struct FLIC_FRAME_ENTRY
{
- __int64 pos;
- bool fKeyframe;
- FLIC_FRAME hdr;
+ __int64 pos;
+ bool fKeyframe;
+ FLIC_FRAME hdr;
};
[uuid("17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4")]
class CFLICSource
- : public CSource
- , public IFileSourceFilter
- , public IAMFilterMiscFlags
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
{
- CStringW m_fn;
+ CStringW m_fn;
public:
- CFLICSource(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CFLICSource();
+ CFLICSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CFLICSource();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
- // IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags();
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
};
-class CFLICStream
- : public CSourceStream
- , public CSourceSeeking
+class CFLICStream
+ : public CSourceStream
+ , public CSourceSeeking
{
- CFile m_flic;
- FLIC m_hdr;
- CAtlArray<FLIC_FRAME_ENTRY> m_frames;
+ CFile m_flic;
+ FLIC m_hdr;
+ CAtlArray<FLIC_FRAME_ENTRY> m_frames;
- CCritSec m_cSharedState;
+ CCritSec m_cSharedState;
- REFERENCE_TIME m_AvgTimePerFrame;
- REFERENCE_TIME m_rtSampleTime, m_rtPosition;
+ REFERENCE_TIME m_AvgTimePerFrame;
+ REFERENCE_TIME m_rtSampleTime, m_rtPosition;
- BOOL m_bDiscontinuity, m_bFlushing;
+ BOOL m_bDiscontinuity, m_bFlushing;
- HRESULT OnThreadStartPlay();
- HRESULT OnThreadCreate();
+ HRESULT OnThreadStartPlay();
+ HRESULT OnThreadCreate();
- void UpdateFromSeek();
- STDMETHODIMP SetRate(double dRate);
+ void UpdateFromSeek();
+ STDMETHODIMP SetRate(double dRate);
- HRESULT ChangeStart();
+ HRESULT ChangeStart();
HRESULT ChangeStop();
- HRESULT ChangeRate()
- {
- return S_OK;
- }
+ HRESULT ChangeRate() {return S_OK;}
private:
- int m_nLastFrameNum;
- DWORD m_pPalette[256];
- CAutoVectorPtr<BYTE> m_pFrameBuffer;
- int m_nBufferSize;
-
- void SeekToNearestKeyFrame(int nFrame);
- void ExtractFrame(int nFrame);
- void _blackchunk();
- void _copychunk();
- bool _colorchunk(bool f64);
- void _brunchunk();
- void _lcchunk();
- void _deltachunk();
+ int m_nLastFrameNum;
+ DWORD m_pPalette[256];
+ CAutoVectorPtr<BYTE> m_pFrameBuffer;
+ int m_nBufferSize;
+
+ void SeekToNearestKeyFrame(int nFrame);
+ void ExtractFrame(int nFrame);
+ void _blackchunk();
+ void _copychunk();
+ bool _colorchunk(bool f64);
+ void _brunchunk();
+ void _lcchunk();
+ void _deltachunk();
public:
CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr);
- virtual ~CFLICStream();
+ virtual ~CFLICStream();
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
HRESULT FillBuffer(IMediaSample* pSample);
- HRESULT CheckConnect(IPin* pPin);
+ HRESULT CheckConnect(IPin* pPin);
HRESULT CheckMediaType(const CMediaType* pMediaType);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
-
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
diff --git a/src/filters/source/FLICSource/resource.h b/src/filters/source/FLICSource/resource.h
index 4cd977803..43aa0620e 100644
--- a/src/filters/source/FLICSource/resource.h
+++ b/src/filters/source/FLICSource/resource.h
@@ -3,7 +3,7 @@
// Used by flicsource.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/source/FLICSource/stdafx.cpp b/src/filters/source/FLICSource/stdafx.cpp
index c60551b94..5158d6e51 100644
--- a/src/filters/source/FLICSource/stdafx.cpp
+++ b/src/filters/source/FLICSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/FLICSource/stdafx.h b/src/filters/source/FLICSource/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/source/FLICSource/stdafx.h
+++ b/src/filters/source/FLICSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/FlacSource/FlacSource.cpp b/src/filters/source/FlacSource/FlacSource.cpp
index a1e07d0b7..5283edfd1 100644
--- a/src/filters/source/FlacSource/FlacSource.cpp
+++ b/src/filters/source/FlacSource/FlacSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -35,49 +35,49 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_FLAC_FRAMED}
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_FLAC_FRAMED}
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CFlacSource), L"MPC - Flac Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CFlacSource), L"MPC - Flac Source", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFlacSource>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFlacSource>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
- _T("0"), _T("0,4,,664C6143"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
+ _T("0"), _T("0,4,,664C6143"));
- SetRegKeyValue(
- _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
- _T("Source Filter"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"),
+ _T("Source Filter"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".flac"),
- _T("Source Filter"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".flac"),
+ _T("Source Filter"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".flac"));
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{1930D8FF-4739-4e42-9199-3B2EDEAA3BF2}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".flac"));
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -103,7 +103,7 @@ static void StreamDecoderMetadata(const FLAC__StreamDecoder *decoder, con
//
CFlacSource::CFlacSource(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseSource<CFlacStream>(NAME("CFlacSource"), lpunk, phr, __uuidof(this))
+ : CBaseSource<CFlacStream>(NAME("CFlacSource"), lpunk, phr, __uuidof(this))
{
}
@@ -113,52 +113,51 @@ CFlacSource::~CFlacSource()
// CFlacStream
-CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
- : CBaseStream(NAME("CFlacStream"), pParent, phr)
- , m_bIsEOF(false)
+CFlacStream::CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
+ : CBaseStream(NAME("CFlacStream"), pParent, phr)
+ , m_bIsEOF (false)
{
- CAutoLock cAutoLock(&m_cSharedState);
- CString fn(wfn);
- CFileException ex;
- HRESULT hr = E_FAIL;
-
- do
- {
- if(!m_file.Open(fn, CFile::modeRead | CFile::shareDenyNone, &ex))
- {
- hr = AmHresultFromWin32(ex.m_lOsError);
- break;
- }
-
- m_pDecoder = FLAC__stream_decoder_new();
- if(!m_pDecoder) break;
-
- if(FLAC__STREAM_DECODER_INIT_STATUS_OK != FLAC__stream_decoder_init_stream(_DECODER_,
- StreamDecoderRead,
- StreamDecoderSeek,
- StreamDecoderTell,
- StreamDecoderLength,
- StreamDecoderEof,
- StreamDecoderWrite,
- StreamDecoderMetadata,
- StreamDecoderError,
- this))
- {
- break;
- }
-
-
- if(!FLAC__stream_decoder_process_until_end_of_metadata(_DECODER_) ||
- !FLAC__stream_decoder_seek_absolute(_DECODER_, 0))
- break;
-
- FLAC__stream_decoder_get_decode_position(_DECODER_, &m_llOffset);
-
- hr = S_OK;
- }
- while(false);
-
- if(phr) *phr = hr;
+ CAutoLock cAutoLock(&m_cSharedState);
+ CString fn(wfn);
+ CFileException ex;
+ HRESULT hr = E_FAIL;
+
+ do
+ {
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyNone, &ex))
+ {
+ hr = AmHresultFromWin32 (ex.m_lOsError);
+ break;
+ }
+
+ m_pDecoder = FLAC__stream_decoder_new();
+ if (!m_pDecoder) break;
+
+ if (FLAC__STREAM_DECODER_INIT_STATUS_OK != FLAC__stream_decoder_init_stream (_DECODER_,
+ StreamDecoderRead,
+ StreamDecoderSeek,
+ StreamDecoderTell,
+ StreamDecoderLength,
+ StreamDecoderEof,
+ StreamDecoderWrite,
+ StreamDecoderMetadata,
+ StreamDecoderError,
+ this))
+ {
+ break;
+ }
+
+
+ if (!FLAC__stream_decoder_process_until_end_of_metadata (_DECODER_) ||
+ !FLAC__stream_decoder_seek_absolute (_DECODER_, 0))
+ break;
+
+ FLAC__stream_decoder_get_decode_position(_DECODER_, &m_llOffset);
+
+ hr = S_OK;
+ } while (false);
+
+ if(phr) *phr = hr;
}
CFlacStream::~CFlacStream()
@@ -173,8 +172,8 @@ HRESULT CFlacStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIE
HRESULT hr = NOERROR;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = m_nMaxFrameSize;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = m_nMaxFrameSize;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -187,33 +186,33 @@ HRESULT CFlacStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIE
HRESULT CFlacStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
{
- FLAC__uint64 llCurPos;
- FLAC__uint64 llNextPos;
+ FLAC__uint64 llCurPos;
+ FLAC__uint64 llNextPos;
- if(m_bDiscontinuity)
- {
- FLAC__stream_decoder_seek_absolute(_DECODER_, (m_rtPosition * m_i64TotalNumSamples) / m_rtDuration);
- }
+ if (m_bDiscontinuity)
+ {
+ FLAC__stream_decoder_seek_absolute (_DECODER_, (m_rtPosition * m_i64TotalNumSamples) / m_rtDuration);
+ }
- FLAC__stream_decoder_get_decode_position(_DECODER_, &llCurPos);
+ FLAC__stream_decoder_get_decode_position(_DECODER_, &llCurPos);
+
+ FLAC__stream_decoder_skip_single_frame (_DECODER_);
+ if (m_bIsEOF)
+ return S_FALSE;
+ FLAC__stream_decoder_get_decode_position(_DECODER_, &llNextPos);
- FLAC__stream_decoder_skip_single_frame(_DECODER_);
- if(m_bIsEOF)
- return S_FALSE;
- FLAC__stream_decoder_get_decode_position(_DECODER_, &llNextPos);
+ FLAC__uint64 llCurFile = m_file.GetPosition();
+ len = llNextPos - llCurPos;
+ ASSERT (len > 0);
+ if (len <= 0) return S_FALSE;
- FLAC__uint64 llCurFile = m_file.GetPosition();
- len = llNextPos - llCurPos;
- ASSERT(len > 0);
- if(len <= 0) return S_FALSE;
+ m_file.Seek (llCurPos, CFile::begin);
+ m_file.Read (pOut, len);
+ m_file.Seek (llCurFile, CFile::begin);
- m_file.Seek(llCurPos, CFile::begin);
- m_file.Read(pOut, len);
- m_file.Seek(llCurFile, CFile::begin);
+ m_AvgTimePerFrame = m_rtDuration * len / (m_llFileSize-m_llOffset);
- m_AvgTimePerFrame = m_rtDuration * len / (m_llFileSize - m_llOffset);
-
- return S_OK;
+ return S_OK;
}
@@ -222,118 +221,118 @@ HRESULT CFlacStream::GetMediaType(int iPosition, CMediaType* pmt)
{
CAutoLock cAutoLock(m_pFilter->pStateLock());
- if(iPosition == 0)
- {
- pmt->majortype = MEDIATYPE_Audio;
- pmt->subtype = MEDIASUBTYPE_FLAC_FRAMED;
- pmt->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->wFormatTag = WAVE_FORMAT_FLAC;
- wfe->nSamplesPerSec = m_nSamplesPerSec;
- wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
- wfe->nChannels = m_nChannels;
- wfe->nBlockAlign = 1;
- wfe->wBitsPerSample = m_wBitsPerSample;
- }
- else
- {
- return VFW_S_NO_MORE_ITEMS;
- }
+ if(iPosition == 0)
+ {
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_FLAC_FRAMED;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_FLAC;
+ wfe->nSamplesPerSec = m_nSamplesPerSec;
+ wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
+ wfe->nChannels = m_nChannels;
+ wfe->nBlockAlign = 1;
+ wfe->wBitsPerSample = m_wBitsPerSample;
+ }
+ else
+ {
+ return VFW_S_NO_MORE_ITEMS;
+ }
pmt->SetTemporalCompression(FALSE);
- return S_OK;
+ return S_OK;
}
HRESULT CFlacStream::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_FLAC_FRAMED
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_FLAC)
- return S_OK;
- else
- return E_INVALIDARG;
+ if ( pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_FLAC_FRAMED
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_FLAC)
+ return S_OK;
+ else
+ return E_INVALIDARG;
}
-void CFlacStream::UpdateFromMetadata(void* pBuffer)
+void CFlacStream::UpdateFromMetadata (void* pBuffer)
{
- const FLAC__StreamMetadata* pMetadata = (const FLAC__StreamMetadata*) pBuffer;
-
- m_nMaxFrameSize = pMetadata->data.stream_info.max_framesize;
- m_nSamplesPerSec = pMetadata->data.stream_info.sample_rate;
- m_nChannels = pMetadata->data.stream_info.channels;
- m_wBitsPerSample = pMetadata->data.stream_info.bits_per_sample;
- m_i64TotalNumSamples = pMetadata->data.stream_info.total_samples;
- m_nAvgBytesPerSec = (m_nChannels * (m_wBitsPerSample >> 3)) * m_nSamplesPerSec;
-
- // === Init members from base classes
- GetFileSizeEx(m_file.m_hFile, (LARGE_INTEGER*)&m_llFileSize);
- m_rtDuration = (m_i64TotalNumSamples * UNITS) / m_nSamplesPerSec;
- m_rtStop = m_rtDuration;
- m_AvgTimePerFrame = (m_nMaxFrameSize + pMetadata->data.stream_info.min_framesize) * m_rtDuration / 2 / m_llFileSize;
+ const FLAC__StreamMetadata* pMetadata = (const FLAC__StreamMetadata*) pBuffer;
+
+ m_nMaxFrameSize = pMetadata->data.stream_info.max_framesize;
+ m_nSamplesPerSec = pMetadata->data.stream_info.sample_rate;
+ m_nChannels = pMetadata->data.stream_info.channels;
+ m_wBitsPerSample = pMetadata->data.stream_info.bits_per_sample;
+ m_i64TotalNumSamples = pMetadata->data.stream_info.total_samples;
+ m_nAvgBytesPerSec = (m_nChannels * (m_wBitsPerSample >> 3)) * m_nSamplesPerSec;
+
+ // === Init members from base classes
+ GetFileSizeEx (m_file.m_hFile, (LARGE_INTEGER*)&m_llFileSize);
+ m_rtDuration = (m_i64TotalNumSamples * UNITS) / m_nSamplesPerSec;
+ m_rtStop = m_rtDuration;
+ m_AvgTimePerFrame = (m_nMaxFrameSize + pMetadata->data.stream_info.min_framesize) * m_rtDuration / 2 / m_llFileSize;
}
FLAC__StreamDecoderReadStatus StreamDecoderRead(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
- UINT nRead;
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
+ UINT nRead;
- nRead = pThis->GetFile()->Read(buffer, *bytes);
- pThis->m_bIsEOF = (nRead != *bytes);
- *bytes = nRead;
+ nRead = pThis->GetFile()->Read (buffer, *bytes);
+ pThis->m_bIsEOF = (nRead != *bytes);
+ *bytes = nRead;
- return (*bytes == 0) ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ return (*bytes == 0) ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
FLAC__StreamDecoderSeekStatus StreamDecoderSeek(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
-
- pThis->m_bIsEOF = false;
- pThis->GetFile()->Seek(absolute_byte_offset, CFile::begin);
- return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
+
+ pThis->m_bIsEOF = false;
+ pThis->GetFile()->Seek (absolute_byte_offset, CFile::begin);
+ return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
}
FLAC__StreamDecoderTellStatus StreamDecoderTell(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
- *absolute_byte_offset = pThis->GetFile()->GetPosition();
- return FLAC__STREAM_DECODER_TELL_STATUS_OK;
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
+ *absolute_byte_offset = pThis->GetFile()->GetPosition();
+ return FLAC__STREAM_DECODER_TELL_STATUS_OK;
}
FLAC__StreamDecoderLengthStatus StreamDecoderLength(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
- CFile* pFile = pThis->GetFile();
-
- if(pFile == NULL)
- return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
- else
- {
- *stream_length = pFile->GetLength();
- return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
- }
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
+ CFile* pFile = pThis->GetFile();
+
+ if (pFile == NULL)
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
+ else
+ {
+ *stream_length = pFile->GetLength();
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
+ }
}
FLAC__bool StreamDecoderEof(const FLAC__StreamDecoder *decoder, void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
- return pThis->m_bIsEOF;
+ return pThis->m_bIsEOF;
}
FLAC__StreamDecoderWriteStatus StreamDecoderWrite(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
- return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
void StreamDecoderError(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
@@ -343,8 +342,8 @@ void StreamDecoderError(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderE
void StreamDecoderMetadata(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
- CFlacStream* pThis = static_cast<CFlacStream*>(client_data);
+ CFlacStream* pThis = static_cast<CFlacStream*> (client_data);
- if(pThis)
- pThis->UpdateFromMetadata((void*)metadata);
+ if (pThis)
+ pThis->UpdateFromMetadata ((void*)metadata);
}
diff --git a/src/filters/source/FlacSource/FlacSource.h b/src/filters/source/FlacSource/FlacSource.h
index f7c4ce5a0..3b7f87969 100644
--- a/src/filters/source/FlacSource/FlacSource.h
+++ b/src/filters/source/FlacSource/FlacSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,8 +30,8 @@ class CFlacStream;
class CFlacSource : public CBaseSource<CFlacStream>
{
public:
- CFlacSource(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CFlacSource();
+ CFlacSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CFlacSource();
};
@@ -39,34 +39,31 @@ class CGolombBuffer;
class CFlacStream : public CBaseStream
{
- CFile m_file;
- void* m_pDecoder;
+ CFile m_file;
+ void* m_pDecoder;
- int m_nMaxFrameSize;
- int m_nSamplesPerSec;
- int m_nChannels;
- WORD m_wBitsPerSample;
- __int64 m_i64TotalNumSamples;
- int m_nAvgBytesPerSec;
+ int m_nMaxFrameSize;
+ int m_nSamplesPerSec;
+ int m_nChannels;
+ WORD m_wBitsPerSample;
+ __int64 m_i64TotalNumSamples;
+ int m_nAvgBytesPerSec;
- ULONGLONG m_llOffset; // Position of first frame in file
- ULONGLONG m_llFileSize; // Size of the file
+ ULONGLONG m_llOffset; // Position of first frame in file
+ ULONGLONG m_llFileSize; // Size of the file
public:
CFlacStream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
- virtual ~CFlacStream();
+ virtual ~CFlacStream();
HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
-
- HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
HRESULT CheckMediaType(const CMediaType* pMediaType);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- void UpdateFromMetadata(void* pBuffer);
- inline CFile* GetFile()
- {
- return &m_file;
- };
+ void UpdateFromMetadata (void* pBuffer);
+ inline CFile* GetFile() { return &m_file; };
- bool m_bIsEOF;
+ bool m_bIsEOF;
};
diff --git a/src/filters/source/FlacSource/resource.h b/src/filters/source/FlacSource/resource.h
index 6e541c0c4..3507c6e74 100644
--- a/src/filters/source/FlacSource/resource.h
+++ b/src/filters/source/FlacSource/resource.h
@@ -3,7 +3,7 @@
// Used by dtsac3source.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/source/FlacSource/stdafx.cpp b/src/filters/source/FlacSource/stdafx.cpp
index 4b148b3b2..396f14d73 100644
--- a/src/filters/source/FlacSource/stdafx.cpp
+++ b/src/filters/source/FlacSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/FlacSource/stdafx.h b/src/filters/source/FlacSource/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/source/FlacSource/stdafx.h
+++ b/src/filters/source/FlacSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
index a2b8c5ec7..75bdf8d51 100644
--- a/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
+++ b/src/filters/source/ShoutcastSource/ShoutcastSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,47 +33,47 @@
static const DWORD s_bitrate[2][16] =
{
- {1, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0},
- {1, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0}
+ {1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
+ {1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}
};
static const DWORD s_freq[4][4] =
{
- {11025, 12000, 8000, 0},
- {0, 0, 0, 0},
- {22050, 24000, 16000, 0},
- {44100, 48000, 32000, 0}
+ {11025,12000,8000,0},
+ {0,0,0,0},
+ {22050,24000,16000,0},
+ {44100,48000,32000,0}
};
static const BYTE s_channels[4] =
{
- 2, 2, 2, 1 // stereo, joint stereo, dual, mono
+ 2,2,2,1 // stereo, joint stereo, dual, mono
};
typedef struct
{
- WORD sync;
- BYTE version;
- BYTE layer;
- DWORD bitrate;
- DWORD freq;
- BYTE channels;
- DWORD framesize;
-
- bool ExtractHeader(CSocket& socket)
- {
- BYTE buff[4];
- if(4 != socket.Receive(buff, 4, MSG_PEEK))
- return(false);
-
- sync = (buff[0] << 4) | (buff[1] >> 4) | 1;
- version = (buff[1] >> 3) & 3;
- layer = 4 - ((buff[1] >> 1) & 3);
- bitrate = s_bitrate[version&1][buff[2] >> 4] * 1000;
- freq = s_freq[version][(buff[2] >> 2) & 3];
- channels = s_channels[(buff[3] >> 6) & 3];
- framesize = freq ? ((((version & 1) ? 144 : 72) * bitrate / freq) + ((buff[2] >> 1) & 1)) : 0;
-
- return(sync == 0xfff && layer == 3 && bitrate != 0 && freq != 0);
- }
+ WORD sync;
+ BYTE version;
+ BYTE layer;
+ DWORD bitrate;
+ DWORD freq;
+ BYTE channels;
+ DWORD framesize;
+
+ bool ExtractHeader(CSocket& socket)
+ {
+ BYTE buff[4];
+ if(4 != socket.Receive(buff, 4, MSG_PEEK))
+ return(false);
+
+ sync = (buff[0]<<4)|(buff[1]>>4)|1;
+ version = (buff[1]>>3)&3;
+ layer = 4 - ((buff[1]>>1)&3);
+ bitrate = s_bitrate[version&1][buff[2]>>4]*1000;
+ freq = s_freq[version][(buff[2]>>2)&3];
+ channels = s_channels[(buff[3]>>6)&3];
+ framesize = freq ? ((((version&1)?144:72) * bitrate / freq) + ((buff[2]>>1)&1)) : 0;
+
+ return(sync == 0xfff && layer == 3 && bitrate != 0 && freq != 0);
+ }
} mp3hdr;
@@ -81,34 +81,34 @@ typedef struct
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CShoutcastSource), L"MPC - ShoutcastSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CShoutcastSource), L"MPC - ShoutcastSource", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CShoutcastSource>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CShoutcastSource>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -116,24 +116,24 @@ STDAPI DllUnregisterServer()
class CShoutcastSourceApp : public CFilterApp
{
public:
- BOOL InitInstance()
- {
- if(!__super::InitInstance()) return FALSE;
- /*
- if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
- AfxMessageBox(_T("AfxWinInit failed!"));
- return FALSE;
- }
- */
- if(!AfxSocketInit(NULL))
- {
- AfxMessageBox(_T("AfxSocketInit failed!"));
- return FALSE;
- }
-
- return TRUE;
- }
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+/*
+ if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
+ {
+ AfxMessageBox(_T("AfxWinInit failed!"));
+ return FALSE;
+ }
+*/
+ if(!AfxSocketInit(NULL))
+ {
+ AfxMessageBox(_T("AfxSocketInit failed!"));
+ return FALSE;
+ }
+
+ return TRUE;
+ }
};
CShoutcastSourceApp theApp;
@@ -145,10 +145,10 @@ CShoutcastSourceApp theApp;
//
CShoutcastSource::CShoutcastSource(LPUNKNOWN lpunk, HRESULT* phr)
- : CSource(NAME("CShoutcastSource"), lpunk, __uuidof(this))
+ : CSource(NAME("CShoutcastSource"), lpunk, __uuidof(this))
{
#ifndef REGISTER_FILTER
- AfxSocketInit();
+ AfxSocketInit();
#endif
}
@@ -160,96 +160,96 @@ STDMETHODIMP CShoutcastSource::NonDelegatingQueryInterface(REFIID riid, void** p
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IFileSourceFilter)
- QI(IAMFilterMiscFlags)
- QI(IAMOpenProgress)
- QI2(IAMMediaContent)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ QI(IAMOpenProgress)
+ QI2(IAMMediaContent)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IFileSourceFilter
-STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(GetPinCount() > 0)
- return VFW_E_ALREADY_CONNECTED;
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
- HRESULT hr = E_OUTOFMEMORY;
+ HRESULT hr = E_OUTOFMEMORY;
- if(!(DNew CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr))
- return hr;
+ if(!(DNew CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr))
+ return hr;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CShoutcastSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
-
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- wcscpy(*ppszFileName, m_fn);
+ wcscpy(*ppszFileName, m_fn);
- return S_OK;
+ return S_OK;
}
// IAMFilterMiscFlags
ULONG CShoutcastSource::GetMiscFlags()
{
- return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
}
// IAMOpenProgress
STDMETHODIMP CShoutcastSource::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
{
- if(m_iPins == 1)
- {
+ if(m_iPins == 1)
+ {
if(pllTotal) *pllTotal = 100;
- if(pllCurrent) *pllCurrent = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetBufferFullness();
- return S_OK;
- }
+ if(pllCurrent) *pllCurrent = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetBufferFullness();
+ return S_OK;
+ }
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
STDMETHODIMP CShoutcastSource::AbortOperation()
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
// IAMMediaContent
STDMETHODIMP CShoutcastSource::get_Title(BSTR* pbstrTitle)
{
- CheckPointer(pbstrTitle, E_POINTER);
+ CheckPointer(pbstrTitle, E_POINTER);
- if(m_iPins == 1)
- {
- *pbstrTitle = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetTitle().AllocSysString();
- return S_OK;
- }
+ if(m_iPins == 1)
+ {
+ *pbstrTitle = (static_cast<CShoutcastStream*>(m_paStreams[0]))->GetTitle().AllocSysString();
+ return S_OK;
+ }
- return E_UNEXPECTED;
+ return E_UNEXPECTED;
}
// CShoutcastStream
CShoutcastStream::CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent, HRESULT* phr)
- : CSourceStream(NAME("ShoutcastStream"), phr, pParent, L"Output")
- , m_fBuffering(false)
+ : CSourceStream(NAME("ShoutcastStream"), phr, pParent, L"Output")
+ , m_fBuffering(false)
{
- ASSERT(phr);
+ ASSERT(phr);
- *phr = S_OK;
+ *phr = S_OK;
- CString fn(wfn);
- if(fn.Find(_T("://")) < 0) fn = _T("http://") + fn;
+ CString fn(wfn);
+ if(fn.Find(_T("://")) < 0) fn = _T("http://") + fn;
#if defined(REGISTER_FILTER) && defined(DEBUG)
//fn = _T("http://localhost:8000/");
@@ -257,37 +257,37 @@ CShoutcastStream::CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent,
//fn = _T("http://218.145.30.106:11000"); // 128kbps korean
//fn = _T("http://65.206.46.110:8020"); // 96kbps
//fn = _T("http://64.236.34.72:80/stream/1003");
- fn = _T("http://64.236.34.72:80/stream/1011");
+fn = _T("http://64.236.34.72:80/stream/1011");
//fn = _T("http://218.145.30.106:11000");
//fn = _T("http://radio.sluchaj.com:8000/radio.ogg"); // ogg
// http://www.oddsock.org/icecast2yp/ // more ogg via icecast2
#endif
- if(!m_url.CrackUrl(fn))
- {
- *phr = E_FAIL;
- return;
- }
+ if(!m_url.CrackUrl(fn))
+ {
+ *phr = E_FAIL;
+ return;
+ }
- if(m_url.GetUrlPathLength() == 0)
- m_url.SetUrlPath(_T("/"));
+ if(m_url.GetUrlPathLength() == 0)
+ m_url.SetUrlPath(_T("/"));
- if(m_url.GetPortNumber() == ATL_URL_INVALID_PORT_NUMBER)
- m_url.SetPortNumber(ATL_URL_DEFAULT_HTTP_PORT);
+ if(m_url.GetPortNumber() == ATL_URL_INVALID_PORT_NUMBER)
+ m_url.SetPortNumber(ATL_URL_DEFAULT_HTTP_PORT);
- if(m_url.GetScheme() != ATL_URL_SCHEME_HTTP)
- {
- *phr = E_FAIL;
- return;
- }
+ if(m_url.GetScheme() != ATL_URL_SCHEME_HTTP)
+ {
+ *phr = E_FAIL;
+ return;
+ }
- if(!m_socket.Create() || !m_socket.Connect(m_url))
- {
- *phr = E_FAIL;
- return;
- }
+ if(!m_socket.Create() || !m_socket.Connect(m_url))
+ {
+ *phr = E_FAIL;
+ return;
+ }
- m_socket.Close();
+ m_socket.Close();
}
CShoutcastStream::~CShoutcastStream()
@@ -296,23 +296,23 @@ CShoutcastStream::~CShoutcastStream()
void CShoutcastStream::EmptyBuffer()
{
- CAutoLock cAutoLock(&m_queue);
- m_queue.RemoveAll();
+ CAutoLock cAutoLock(&m_queue);
+ m_queue.RemoveAll();
}
LONGLONG CShoutcastStream::GetBufferFullness()
{
- CAutoLock cAutoLock(&m_queue);
- if(!m_fBuffering) return 100;
- if(m_queue.IsEmpty()) return 0;
- LONGLONG ret = 100i64 * (m_queue.GetTail().rtStart - m_queue.GetHead().rtStart) / AVGBUFFERLENGTH;
- return(min(ret, 100));
+ CAutoLock cAutoLock(&m_queue);
+ if(!m_fBuffering) return 100;
+ if(m_queue.IsEmpty()) return 0;
+ LONGLONG ret = 100i64*(m_queue.GetTail().rtStart - m_queue.GetHead().rtStart) / AVGBUFFERLENGTH;
+ return(min(ret, 100));
}
CString CShoutcastStream::GetTitle()
{
- CAutoLock cAutoLock(&m_queue);
- return(m_title);
+ CAutoLock cAutoLock(&m_queue);
+ return(m_title);
}
HRESULT CShoutcastStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
@@ -322,8 +322,8 @@ HRESULT CShoutcastStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROP
HRESULT hr = NOERROR;
- pProperties->cBuffers = BUFFERS;
- pProperties->cbBuffer = MAXFRAMESIZE;
+ pProperties->cBuffers = BUFFERS;
+ pProperties->cbBuffer = MAXFRAMESIZE;
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -336,65 +336,65 @@ HRESULT CShoutcastStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROP
HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
{
- HRESULT hr;
-
- BYTE* pData = NULL;
- if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
- return S_FALSE;
-
- do
- {
- // do we have to refill our buffer?
- {
- CAutoLock cAutoLock(&m_queue);
- if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH)
- break; // nope, that's great
- }
-
- TRACE(_T("START BUFFERING\n"));
- m_fBuffering = true;
-
- while(1)
- {
- if(fExitThread) // playback stopped?
- return S_FALSE;
-
- Sleep(50);
-
- CAutoLock cAutoLock(&m_queue);
- if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - AVGBUFFERLENGTH)
- break; // this is enough
- }
-
- pSample->SetDiscontinuity(TRUE);
-
- DeliverBeginFlush();
- DeliverEndFlush();
-
- DeliverNewSegment(0, ~0, 1.0);
-
- TRACE(_T("END BUFFERING\n"));
- m_fBuffering = false;
- }
- while(false);
-
- {
- CAutoLock cAutoLock(&m_queue);
- ASSERT(!m_queue.IsEmpty());
- if(!m_queue.IsEmpty())
- {
- mp3frame f = m_queue.RemoveHead();
- DWORD len = min(pSample->GetSize(), f.len);
- memcpy(pData, f.pData, len);
- pSample->SetActualDataLength(len);
- pSample->SetTime(&f.rtStart, &f.rtStop);
- m_title = f.title;
- }
- }
-
- pSample->SetSyncPoint(TRUE);
-
- return S_OK;
+ HRESULT hr;
+
+ BYTE* pData = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
+ return S_FALSE;
+
+ do
+ {
+ // do we have to refill our buffer?
+ {
+ CAutoLock cAutoLock(&m_queue);
+ if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH)
+ break; // nope, that's great
+ }
+
+ TRACE(_T("START BUFFERING\n"));
+ m_fBuffering = true;
+
+ while(1)
+ {
+ if(fExitThread) // playback stopped?
+ return S_FALSE;
+
+ Sleep(50);
+
+ CAutoLock cAutoLock(&m_queue);
+ if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - AVGBUFFERLENGTH)
+ break; // this is enough
+ }
+
+ pSample->SetDiscontinuity(TRUE);
+
+ DeliverBeginFlush();
+ DeliverEndFlush();
+
+ DeliverNewSegment(0, ~0, 1.0);
+
+ TRACE(_T("END BUFFERING\n"));
+ m_fBuffering = false;
+ }
+ while(false);
+
+ {
+ CAutoLock cAutoLock(&m_queue);
+ ASSERT(!m_queue.IsEmpty());
+ if(!m_queue.IsEmpty())
+ {
+ mp3frame f = m_queue.RemoveHead();
+ DWORD len = min(pSample->GetSize(), f.len);
+ memcpy(pData, f.pData, len);
+ pSample->SetActualDataLength(len);
+ pSample->SetTime(&f.rtStart, &f.rtStop);
+ m_title = f.title;
+ }
+ }
+
+ pSample->SetSyncPoint(TRUE);
+
+ return S_OK;
}
HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
@@ -408,290 +408,286 @@ HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
pmt->SetSubtype(&MEDIASUBTYPE_MP3);
pmt->SetFormatType(&FORMAT_WaveFormatEx);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->wFormatTag = (WORD)MEDIASUBTYPE_MP3.Data1;
- wfe->nChannels = (WORD)m_socket.m_channels;
- wfe->nSamplesPerSec = m_socket.m_freq;
- wfe->nAvgBytesPerSec = m_socket.m_bitrate / 8;
- wfe->nBlockAlign = 1;
- wfe->wBitsPerSample = 0;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->wFormatTag = (WORD)MEDIASUBTYPE_MP3.Data1;
+ wfe->nChannels = (WORD)m_socket.m_channels;
+ wfe->nSamplesPerSec = m_socket.m_freq;
+ wfe->nAvgBytesPerSec = m_socket.m_bitrate/8;
+ wfe->nBlockAlign = 1;
+ wfe->wBitsPerSample = 0;
return NOERROR;
}
HRESULT CShoutcastStream::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_MP3
- && pmt->formattype == FORMAT_WaveFormatEx) return S_OK;
+ if(pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_MP3
+ && pmt->formattype == FORMAT_WaveFormatEx) return S_OK;
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
static UINT SocketThreadProc(LPVOID pParam)
{
- return (static_cast<CShoutcastStream*>(pParam))->SocketThreadProc();
+ return (static_cast<CShoutcastStream*>(pParam))->SocketThreadProc();
}
UINT CShoutcastStream::SocketThreadProc()
{
- fExitThread = false;
+ fExitThread = false;
- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
- AfxSocketInit();
+ AfxSocketInit();
- CAutoVectorPtr<BYTE> pData;
- if(!m_socket.Create() || !m_socket.Connect(m_url)
- || !pData.Allocate(max(m_socket.m_metaint, MAXFRAMESIZE)))
- {
- m_socket.Close();
- return 1;
- }
+ CAutoVectorPtr<BYTE> pData;
+ if(!m_socket.Create() || !m_socket.Connect(m_url)
+ || !pData.Allocate(max(m_socket.m_metaint, MAXFRAMESIZE)))
+ {
+ m_socket.Close();
+ return 1;
+ }
- REFERENCE_TIME m_rtSampleTime = 0;
+ REFERENCE_TIME m_rtSampleTime = 0;
+
+ while(!fExitThread)
+ {
+ int len = MAXFRAMESIZE;
+ len = m_socket.Receive(pData, len);
+ if(len <= 0) break;
- while(!fExitThread)
- {
- int len = MAXFRAMESIZE;
- len = m_socket.Receive(pData, len);
- if(len <= 0) break;
+ mp3frame f(len);
+ memcpy(f.pData, pData, len);
+ f.rtStop = (f.rtStart = m_rtSampleTime) + (10000000i64 * len * 8/m_socket.m_bitrate);
+ m_rtSampleTime = f.rtStop;
+ f.title = m_socket.m_title;
+ if(f.title.IsEmpty()) f.title = m_socket.m_url;
- mp3frame f(len);
- memcpy(f.pData, pData, len);
- f.rtStop = (f.rtStart = m_rtSampleTime) + (10000000i64 * len * 8 / m_socket.m_bitrate);
- m_rtSampleTime = f.rtStop;
- f.title = m_socket.m_title;
- if(f.title.IsEmpty()) f.title = m_socket.m_url;
+ CAutoLock cAutoLock(&m_queue);
+ m_queue.AddTail(f);
+ }
- CAutoLock cAutoLock(&m_queue);
- m_queue.AddTail(f);
- }
+ m_socket.Close();
- m_socket.Close();
-
- return 0;
+ return 0;
}
HRESULT CShoutcastStream::OnThreadCreate()
{
- EmptyBuffer();
+ EmptyBuffer();
- fExitThread = true;
- m_hSocketThread = AfxBeginThread(::SocketThreadProc, this)->m_hThread;
- while(fExitThread) Sleep(10);
+ fExitThread = true;
+ m_hSocketThread = AfxBeginThread(::SocketThreadProc, this)->m_hThread;
+ while(fExitThread) Sleep(10);
- return NOERROR;
+ return NOERROR;
}
HRESULT CShoutcastStream::OnThreadDestroy()
{
- EmptyBuffer();
+ EmptyBuffer();
+
+ fExitThread = true;
+ m_socket.CancelBlockingCall();
+ WaitForSingleObject(m_hSocketThread, -1);
- fExitThread = true;
- m_socket.CancelBlockingCall();
- WaitForSingleObject(m_hSocketThread, -1);
-
- return NOERROR;
+ return NOERROR;
}
HRESULT CShoutcastStream::Inactive()
{
- fExitThread = true;
- return __super::Inactive();
+ fExitThread = true;
+ return __super::Inactive();
}
//
int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nFlags)
{
- if(nFlags & MSG_PEEK)
- return __super::Receive(lpBuf, nBufLen, nFlags);
-
- if(m_metaint > 0 && m_nBytesRead + nBufLen > m_metaint)
- nBufLen = m_metaint - m_nBytesRead;
-
- int len = __super::Receive(lpBuf, nBufLen, nFlags);
- if(len <= 0) return len;
-
- if((m_nBytesRead += len) == m_metaint)
- {
- m_nBytesRead = 0;
-
- static BYTE buff[255*16], b = 0;
- memset(buff, 0, sizeof(buff));
- if(1 == __super::Receive(&b, 1) && b && b * 16 == __super::Receive(buff, b * 16))
- {
- CStringA str = (LPCSTR)buff;
-
- TRACE(_T("Metainfo: %s\n"), CString(str));
-
- CStringA title("StreamTitle='"), url("StreamUrl='");
-
- int i = str.Find(title);
- if(i >= 0)
- {
- i += title.GetLength();
- int j = str.Find('\'', i);
- if(j > i) m_title = str.Mid(i, j - i);
- }
- else
- {
- TRACE(_T("!!!!!!!!!Missing StreamTitle!!!!!!!!!\n"));
- }
-
- i = str.Find(url);
- if(i >= 0)
- {
- i += url.GetLength();
- int j = str.Find('\'', i);
- if(j > i) m_url = str.Mid(i, j - i);
- }
- }
- }
- else if(m_metaint > 0)
- {
- char* p = (char*)lpBuf;
- char* p0 = p;
- char* pend = p + len - 13;
- for(; p < pend; p++)
- {
- if(strncmp(p, "StreamTitle='", 13))
- continue;
-
- TRACE(_T("!!!!!!!!!StreamTitle found inside mp3 data!!!!!!!!! offset=%d\n"), p - p0);
- TRACE(_T("resyncing...\n"));
- while(p-- > p0)
- {
- if((BYTE)*p >= 0x20)
- continue;
-
- TRACE(_T("found possible length byte: %d, skipping %d bytes\n"), *p, 1 + *p * 16);
- p += 1 + *p * 16;
- len = (p0 + len) - p;
- TRACE(_T("returning the remaining bytes in the packet: %d\n"), len);
- if(len <= 0)
- {
- TRACE(_T("nothing to return, reading a bit more in\n"));
- if(len < 0) __super::Receive(lpBuf, -len, nFlags);
-
- int len = __super::Receive(lpBuf, nBufLen, nFlags);
- if(len <= 0) return len;
- }
-
- m_nBytesRead = len;
- memcpy(lpBuf, p, len);
-
- break;
- }
-
- break;
- }
- }
-
- return len;
+ if(nFlags&MSG_PEEK)
+ return __super::Receive(lpBuf, nBufLen, nFlags);
+
+ if(m_metaint > 0 && m_nBytesRead + nBufLen > m_metaint)
+ nBufLen = m_metaint - m_nBytesRead;
+
+ int len = __super::Receive(lpBuf, nBufLen, nFlags);
+ if(len <= 0) return len;
+
+ if((m_nBytesRead += len) == m_metaint)
+ {
+ m_nBytesRead = 0;
+
+ static BYTE buff[255*16], b = 0;
+ memset(buff, 0, sizeof(buff));
+ if(1 == __super::Receive(&b, 1) && b && b*16 == __super::Receive(buff, b*16))
+ {
+ CStringA str = (LPCSTR)buff;
+
+ TRACE(_T("Metainfo: %s\n"), CString(str));
+
+ CStringA title("StreamTitle='"), url("StreamUrl='");
+
+ int i = str.Find(title);
+ if(i >= 0)
+ {
+ i += title.GetLength();
+ int j = str.Find('\'', i);
+ if(j > i) m_title = str.Mid(i, j - i);
+ }
+ else
+ {
+ TRACE(_T("!!!!!!!!!Missing StreamTitle!!!!!!!!!\n"));
+ }
+
+ i = str.Find(url);
+ if(i >= 0)
+ {
+ i += url.GetLength();
+ int j = str.Find('\'', i);
+ if(j > i) m_url = str.Mid(i, j - i);
+ }
+ }
+ }
+ else if(m_metaint > 0)
+ {
+ char* p = (char*)lpBuf;
+ char* p0 = p;
+ char* pend = p + len - 13;
+ for(; p < pend; p++)
+ {
+ if(strncmp(p, "StreamTitle='", 13))
+ continue;
+
+TRACE(_T("!!!!!!!!!StreamTitle found inside mp3 data!!!!!!!!! offset=%d\n"), p - p0);
+TRACE(_T("resyncing...\n"));
+ while(p-- > p0)
+ {
+ if((BYTE)*p >= 0x20)
+ continue;
+
+TRACE(_T("found possible length byte: %d, skipping %d bytes\n"), *p, 1 + *p*16);
+ p += 1 + *p*16;
+ len = (p0 + len) - p;
+TRACE(_T("returning the remaining bytes in the packet: %d\n"), len);
+ if(len <= 0)
+ {
+TRACE(_T("nothing to return, reading a bit more in\n"));
+ if(len < 0) __super::Receive(lpBuf, -len, nFlags);
+
+ int len = __super::Receive(lpBuf, nBufLen, nFlags);
+ if(len <= 0) return len;
+ }
+
+ m_nBytesRead = len;
+ memcpy(lpBuf, p, len);
+
+ break;
+ }
+
+ break;
+ }
+ }
+
+ return len;
}
bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
{
- if(!__super::Connect(url.GetHostName(), url.GetPortNumber()))
- return(false);
-
- CStringA str;
- str.Format(
- "GET %s HTTP/1.0\r\n"
- "Icy-MetaData:1\r\n"
- "User-Agent: shoutcastsource\r\n"
- "Host: %s\r\n"
- "Accept: */*\r\n"
- "Connection: Keep-Alive\r\n"
- "\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
-
- bool fOK = false;
- bool fTryAgain = false;
- int metaint = 0;
-
- do
- {
- int len = Send((BYTE*)(LPCSTR)str, str.GetLength());
-
- m_nBytesRead = 0;
- m_metaint = metaint = 0;
- m_bitrate = 0;
-
- str.Empty();
- BYTE cur = 0, prev = 0;
- while(Receive(&cur, 1) == 1 && cur && !(cur == '\n' && prev == '\n'))
- {
- if(cur == '\r')
- continue;
-
- if(cur == '\n')
- {
- str.MakeLower();
- if(str.Find("icy 200 ok") >= 0) fOK = true;
- else if(1 == sscanf(str, "icy-br:%d", &m_bitrate)) m_bitrate *= 1000;
- else if(1 == sscanf(str, "icy-metaint:%d", &metaint)) metaint = metaint;
- str.Empty();
- }
- else
- {
- str += cur;
- }
-
- prev = cur;
- cur = 0;
- }
-
- if(!fOK && GetLastError() == WSAECONNRESET && !fTryAgain)
- {
- str.Format(
- "GET %s HTTP/1.0\r\n"
- "Icy-MetaData:1\r\n"
- "Host: %s\r\n"
- "Accept: */*\r\n"
- "Connection: Keep-Alive\r\n"
- "\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
-
- fTryAgain = true;
- }
- else
- {
- fTryAgain = false;
- }
- }
- while(fTryAgain);
-
- if(!fOK || m_bitrate == 0)
- {
- Close();
- return(false);
- }
-
- m_metaint = metaint;
- m_nBytesRead = 0;
-
- return(FindSync());
+ if(!__super::Connect(url.GetHostName(), url.GetPortNumber()))
+ return(false);
+
+ CStringA str;
+ str.Format(
+ "GET %s HTTP/1.0\r\n"
+ "Icy-MetaData:1\r\n"
+ "User-Agent: shoutcastsource\r\n"
+ "Host: %s\r\n"
+ "Accept: */*\r\n"
+ "Connection: Keep-Alive\r\n"
+ "\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
+
+ bool fOK = false;
+ bool fTryAgain = false;
+ int metaint = 0;
+
+ do
+ {
+ int len = Send((BYTE*)(LPCSTR)str, str.GetLength());
+
+ m_nBytesRead = 0;
+ m_metaint = metaint = 0;
+ m_bitrate = 0;
+
+ str.Empty();
+ BYTE cur = 0, prev = 0;
+ while(Receive(&cur, 1) == 1 && cur && !(cur == '\n' && prev == '\n'))
+ {
+ if(cur == '\r')
+ continue;
+
+ if(cur == '\n')
+ {
+ str.MakeLower();
+ if(str.Find("icy 200 ok") >= 0) fOK = true;
+ else if(1 == sscanf(str, "icy-br:%d", &m_bitrate)) m_bitrate *= 1000;
+ else if(1 == sscanf(str, "icy-metaint:%d", &metaint)) metaint = metaint;
+ str.Empty();
+ }
+ else
+ {
+ str += cur;
+ }
+
+ prev = cur;
+ cur = 0;
+ }
+
+ if(!fOK && GetLastError() == WSAECONNRESET && !fTryAgain)
+ {
+ str.Format(
+ "GET %s HTTP/1.0\r\n"
+ "Icy-MetaData:1\r\n"
+ "Host: %s\r\n"
+ "Accept: */*\r\n"
+ "Connection: Keep-Alive\r\n"
+ "\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
+
+ fTryAgain = true;
+ }
+ else
+ {
+ fTryAgain = false;
+ }
+ }
+ while(fTryAgain);
+
+ if(!fOK || m_bitrate == 0) {Close(); return(false);}
+
+ m_metaint = metaint;
+ m_nBytesRead = 0;
+
+ return(FindSync());
}
bool CShoutcastStream::CShoutcastSocket::FindSync()
{
- m_freq = -1;
- m_channels = -1;
-
- BYTE b;
- for(int i = MAXFRAMESIZE; i > 0; i--, Receive(&b, 1))
- {
- mp3hdr h;
- if(h.ExtractHeader(*this) && m_bitrate == h.bitrate)
- {
- if(h.bitrate > 1) m_bitrate = h.bitrate;
- m_freq = h.freq;
- m_channels = h.channels;
- return(true);
- }
- }
-
- return(false);
+ m_freq = -1;
+ m_channels = -1;
+
+ BYTE b;
+ for(int i = MAXFRAMESIZE; i > 0; i--, Receive(&b, 1))
+ {
+ mp3hdr h;
+ if(h.ExtractHeader(*this) && m_bitrate == h.bitrate)
+ {
+ if(h.bitrate > 1) m_bitrate = h.bitrate;
+ m_freq = h.freq;
+ m_channels = h.channels;
+ return(true);
+ }
+ }
+
+ return(false);
}
diff --git a/src/filters/source/ShoutcastSource/ShoutcastSource.h b/src/filters/source/ShoutcastSource/ShoutcastSource.h
index 080b6f198..ab45dbf4f 100644
--- a/src/filters/source/ShoutcastSource/ShoutcastSource.h
+++ b/src/filters/source/ShoutcastSource/ShoutcastSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,182 +29,118 @@
[uuid("68F540E9-766F-44d2-AB07-E26CC6D27A79")]
class CShoutcastSource
- : public CSource
- , public IFileSourceFilter
- , public IAMFilterMiscFlags
- , public IAMOpenProgress
- , public IAMMediaContent
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
+ , public IAMOpenProgress
+ , public IAMMediaContent
{
- CStringW m_fn;
+ CStringW m_fn;
public:
- CShoutcastSource(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CShoutcastSource();
+ CShoutcastSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CShoutcastSource();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
- // IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags();
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
- // IAMOpenProgress
+ // IAMOpenProgress
STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
STDMETHODIMP AbortOperation();
- // IAMMediaContent
- STDMETHODIMP GetTypeInfoCount(UINT* pctinfo)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_Title(BSTR* pbstrTitle);
- STDMETHODIMP get_Rating(BSTR* pbstrRating)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_Description(BSTR* pbstrDescription)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_Copyright(BSTR* pbstrCopyright)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText)
- {
- return E_NOTIMPL;
- }
+ // IAMMediaContent
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
+ STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
+ STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName) {return E_NOTIMPL;}
+ STDMETHODIMP get_Title(BSTR* pbstrTitle);
+ STDMETHODIMP get_Rating(BSTR* pbstrRating) {return E_NOTIMPL;}
+ STDMETHODIMP get_Description(BSTR* pbstrDescription) {return E_NOTIMPL;}
+ STDMETHODIMP get_Copyright(BSTR* pbstrCopyright) {return E_NOTIMPL;}
+ STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
};
class CShoutcastStream : public CSourceStream
{
- class mp3frame
- {
- public:
- DWORD len;
- BYTE* pData;
- REFERENCE_TIME rtStart, rtStop;
- CString title;
- mp3frame(DWORD len = 0)
- {
- pData = (this->len = len) ? DNew BYTE[len] : NULL;
- rtStart = rtStop = 0;
- }
- mp3frame(const mp3frame& f)
- {
- *this = f;
- }
- ~mp3frame()
- {
- delete pData;
- }
- void operator = (const mp3frame& f)
- {
- len = f.len;
- pData = f.pData;
- rtStart = f.rtStart;
- rtStop = f.rtStop;
- title = f.title;
- ((mp3frame*)&f)->pData = NULL;
- }
- };
-
- class mp3queue : public CAtlList<mp3frame>, public CCritSec {} m_queue;
-
- class CShoutcastSocket : public CSocket
- {
- DWORD m_nBytesRead;
-
- public:
- CShoutcastSocket()
- {
- m_metaint = m_bitrate = m_freq = m_channels = 0;
- }
- int Receive(void* lpBuf, int nBufLen, int nFlags = 0);
-
- DWORD m_metaint, m_bitrate, m_freq, m_channels;
- CString m_title, m_url;
- bool Connect(CUrl& url);
- bool FindSync();
- } m_socket;
-
- HANDLE m_hSocketThread;
-
- CUrl m_url;
-
- bool m_fBuffering;
- CString m_title;
+ class mp3frame
+ {
+ public:
+ DWORD len;
+ BYTE* pData;
+ REFERENCE_TIME rtStart, rtStop;
+ CString title;
+ mp3frame(DWORD len = 0) {pData = (this->len = len) ? DNew BYTE[len] : NULL; rtStart = rtStop = 0;}
+ mp3frame(const mp3frame& f) {*this = f;}
+ ~mp3frame() {delete pData;}
+ void operator = (const mp3frame& f)
+ {
+ len = f.len;
+ pData = f.pData;
+ rtStart = f.rtStart;
+ rtStop = f.rtStop;
+ title = f.title;
+ ((mp3frame*)&f)->pData = NULL;
+ }
+ };
+
+ class mp3queue : public CAtlList<mp3frame>, public CCritSec {} m_queue;
+
+ class CShoutcastSocket : public CSocket
+ {
+ DWORD m_nBytesRead;
+
+ public:
+ CShoutcastSocket() {m_metaint = m_bitrate = m_freq = m_channels = 0;}
+ int Receive(void* lpBuf, int nBufLen, int nFlags = 0);
+
+ DWORD m_metaint, m_bitrate, m_freq, m_channels;
+ CString m_title, m_url;
+ bool Connect(CUrl& url);
+ bool FindSync();
+ } m_socket;
+
+ HANDLE m_hSocketThread;
+
+ CUrl m_url;
+
+ bool m_fBuffering;
+ CString m_title;
public:
CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent, HRESULT* phr);
- virtual ~CShoutcastStream();
+ virtual ~CShoutcastStream();
- bool fExitThread;
- UINT SocketThreadProc();
+ bool fExitThread;
+ UINT SocketThreadProc();
- void EmptyBuffer();
- LONGLONG GetBufferFullness();
- CString GetTitle();
+ void EmptyBuffer();
+ LONGLONG GetBufferFullness();
+ CString GetTitle();
HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
HRESULT FillBuffer(IMediaSample* pSample);
HRESULT CheckMediaType(const CMediaType* pMediaType);
HRESULT GetMediaType(int iPosition, CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q)
- {
- return E_NOTIMPL;
- }
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q) {return E_NOTIMPL;}
HRESULT OnThreadCreate();
HRESULT OnThreadDestroy();
- HRESULT Inactive();
+ HRESULT Inactive();
HRESULT Pause();
};
diff --git a/src/filters/source/ShoutcastSource/resource.h b/src/filters/source/ShoutcastSource/resource.h
index 8a12dbf0d..ae3ca9687 100644
--- a/src/filters/source/ShoutcastSource/resource.h
+++ b/src/filters/source/ShoutcastSource/resource.h
@@ -3,7 +3,7 @@
// Used by shoutcastsource.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/source/ShoutcastSource/stdafx.cpp b/src/filters/source/ShoutcastSource/stdafx.cpp
index 0385cc615..8905f2db5 100644
--- a/src/filters/source/ShoutcastSource/stdafx.cpp
+++ b/src/filters/source/ShoutcastSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/ShoutcastSource/stdafx.h b/src/filters/source/ShoutcastSource/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/source/ShoutcastSource/stdafx.h
+++ b/src/filters/source/ShoutcastSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/SubtitleSource/SubtitleSource.cpp b/src/filters/source/SubtitleSource/SubtitleSource.cpp
index db9b9aa4d..0bddf17a8 100644
--- a/src/filters/source/SubtitleSource/SubtitleSource.cpp
+++ b/src/filters/source/SubtitleSource/SubtitleSource.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -34,87 +34,87 @@ static int _ATPF = 400000;
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Subtitle, &MEDIASUBTYPE_NULL},
- {&MEDIATYPE_Text, &MEDIASUBTYPE_NULL},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
+ {&MEDIATYPE_Subtitle, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Text, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
};
const AMOVIESETUP_PIN sudOpPin[] =
{
- {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
};
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CSubtitleSourceASCII), L"MPC - SubtitleSource (S_TEXT/ASCII)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSubtitleSourceUTF8), L"MPC - SubtitleSource (S_TEXT/UTF8)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSubtitleSourceSSA), L"MPC - SubtitleSource (S_TEXT/SSA)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSubtitleSourceASS), L"MPC - SubtitleSource (S_TEXT/ASS)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSubtitleSourceUSF), L"MPC - SubtitleSource (S_TEXT/USF)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSubtitleSourcePreview), L"MPC - SubtitleSource (Preview)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CSubtitleSourceARGB), L"MPC - SubtitleSource (ARGB)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourceASCII), L"MPC - SubtitleSource (S_TEXT/ASCII)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourceUTF8), L"MPC - SubtitleSource (S_TEXT/UTF8)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourceSSA), L"MPC - SubtitleSource (S_TEXT/SSA)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourceASS), L"MPC - SubtitleSource (S_TEXT/ASS)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourceUSF), L"MPC - SubtitleSource (S_TEXT/USF)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourcePreview), L"MPC - SubtitleSource (Preview)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CSubtitleSourceARGB), L"MPC - SubtitleSource (ARGB)", MERIT_NORMAL, countof(sudOpPin), sudOpPin, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSubtitleSourceASCII>, NULL, &sudFilter[0]},
- {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSubtitleSourceUTF8>, NULL, &sudFilter[1]},
- {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CSubtitleSourceSSA>, NULL, &sudFilter[2]},
- {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CSubtitleSourceASS>, NULL, &sudFilter[3]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSubtitleSourceASCII>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSubtitleSourceUTF8>, NULL, &sudFilter[1]},
+ {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CSubtitleSourceSSA>, NULL, &sudFilter[2]},
+ {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CSubtitleSourceASS>, NULL, &sudFilter[3]},
// {sudFilter[4].strName, sudFilter[4].clsID, CreateInstance<CSubtitleSourceUSF>, NULL, &sudFilter[4]},
- {sudFilter[5].strName, sudFilter[5].clsID, CreateInstance<CSubtitleSourcePreview>, NULL, &sudFilter[5]},
- {sudFilter[6].strName, sudFilter[6].clsID, CreateInstance<CSubtitleSourceARGB>, NULL, &sudFilter[6]},
+ {sudFilter[5].strName, sudFilter[5].clsID, CreateInstance<CSubtitleSourcePreview>, NULL, &sudFilter[5]},
+ {sudFilter[6].strName, sudFilter[6].clsID, CreateInstance<CSubtitleSourceARGB>, NULL, &sudFilter[6]},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- /*
- CString clsid = CStringFromGUID(__uuidof(CSubtitleSourcePreview));
+/*
+ CString clsid = CStringFromGUID(__uuidof(CSubtitleSourcePreview));
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".sub"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".sub"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".srt"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".srt"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".smi"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".smi"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ssa"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ssa"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".ass"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ass"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".xss"),
- _T("Source Filter"), clsid);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".xss"),
+ _T("Source Filter"), clsid);
- SetRegKeyValue(
- _T("Media Type\\Extensions"), _T(".usf"),
- _T("Source Filter"), clsid);
- */
- return AMovieDllRegisterServer2(TRUE);
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".usf"),
+ _T("Source Filter"), clsid);
+*/
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".sub"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".srt"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".smi"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".ssa"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".ass"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".xss"));
- DeleteRegKey(_T("Media Type\\Extensions"), _T(".usf"));
- /**/
- return AMovieDllRegisterServer2(FALSE);
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".sub"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".srt"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".smi"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ssa"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ass"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".xss"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".usf"));
+/**/
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -122,20 +122,20 @@ STDAPI DllUnregisterServer()
class CSubtitleSourceApp : public CFilterApp
{
public:
- BOOL InitInstance()
- {
- if(!__super::InitInstance()) return FALSE;
-
- _WIDTH = GetProfileInt(_T("SubtitleSource"), _T("w"), 640);
- _HEIGHT = GetProfileInt(_T("SubtitleSource"), _T("h"), 480);
- _ATPF = GetProfileInt(_T("SubtitleSource"), _T("atpf"), 400000);
- if(_ATPF <= 0) _ATPF = 400000;
- WriteProfileInt(_T("SubtitleSource"), _T("w"), _WIDTH);
- WriteProfileInt(_T("SubtitleSource"), _T("h"), _HEIGHT);
- WriteProfileInt(_T("SubtitleSource"), _T("atpf"), _ATPF);
-
- return TRUE;
- }
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+
+ _WIDTH = GetProfileInt(_T("SubtitleSource"), _T("w"), 640);
+ _HEIGHT = GetProfileInt(_T("SubtitleSource"), _T("h"), 480);
+ _ATPF = GetProfileInt(_T("SubtitleSource"), _T("atpf"), 400000);
+ if(_ATPF <= 0) _ATPF = 400000;
+ WriteProfileInt(_T("SubtitleSource"), _T("w"), _WIDTH);
+ WriteProfileInt(_T("SubtitleSource"), _T("h"), _HEIGHT);
+ WriteProfileInt(_T("SubtitleSource"), _T("atpf"), _ATPF);
+
+ return TRUE;
+ }
};
CSubtitleSourceApp theApp;
@@ -147,7 +147,7 @@ CSubtitleSourceApp theApp;
//
CSubtitleSource::CSubtitleSource(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
- : CSource(NAME("CSubtitleSource"), lpunk, clsid)
+ : CSource(NAME("CSubtitleSource"), lpunk, clsid)
{
}
@@ -159,134 +159,134 @@ STDMETHODIMP CSubtitleSource::NonDelegatingQueryInterface(REFIID riid, void** pp
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IFileSourceFilter)
- QI(IAMFilterMiscFlags)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IFileSourceFilter
-STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
- if(GetPinCount() > 0)
- return VFW_E_ALREADY_CONNECTED;
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
- HRESULT hr = S_OK;
- if(!(DNew CSubtitleStream(pszFileName, this, &hr)))
- return E_OUTOFMEMORY;
+ HRESULT hr = S_OK;
+ if(!(DNew CSubtitleStream(pszFileName, this, &hr)))
+ return E_OUTOFMEMORY;
- if(FAILED(hr))
- return hr;
+ if(FAILED(hr))
+ return hr;
- m_fn = pszFileName;
+ m_fn = pszFileName;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CSubtitleSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
{
- if(!ppszFileName) return E_POINTER;
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
- if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength() + 1) * sizeof(WCHAR))))
- return E_OUTOFMEMORY;
+ wcscpy(*ppszFileName, m_fn);
- wcscpy(*ppszFileName, m_fn);
-
- return S_OK;
+ return S_OK;
}
// IAMFilterMiscFlags
ULONG CSubtitleSource::GetMiscFlags()
{
- return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
}
//
// CSubtitleStream
//
-CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr)
- : CSourceStream(NAME("SubtitleStream"), phr, pParent, L"Output")
- , CSourceSeeking(NAME("SubtitleStream"), (IPin*)this, phr, &m_cSharedState)
- , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
- , m_nPosition(0)
- , m_rts(NULL)
+CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr)
+ : CSourceStream(NAME("SubtitleStream"), phr, pParent, L"Output")
+ , CSourceSeeking(NAME("SubtitleStream"), (IPin*)this, phr, &m_cSharedState)
+ , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
+ , m_nPosition(0)
+ , m_rts(NULL)
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
- CString fn(wfn);
+ CString fn(wfn);
- if(!m_rts.Open(fn, DEFAULT_CHARSET))
- {
- if(phr) *phr = E_FAIL;
- return;
- }
+ if(!m_rts.Open(fn, DEFAULT_CHARSET))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
- m_rts.CreateDefaultStyle(DEFAULT_CHARSET);
- m_rts.ConvertToTimeBased(25);
- m_rts.Sort();
+ m_rts.CreateDefaultStyle(DEFAULT_CHARSET);
+ m_rts.ConvertToTimeBased(25);
+ m_rts.Sort();
- m_rtDuration = 0;
- for(int i = 0, cnt = m_rts.GetCount(); i < cnt; i++)
- m_rtDuration = max(m_rtDuration, 10000i64 * m_rts[i].end);
+ m_rtDuration = 0;
+ for(int i = 0, cnt = m_rts.GetCount(); i < cnt; i++)
+ m_rtDuration = max(m_rtDuration, 10000i64*m_rts[i].end);
- m_rtStop = m_rtDuration;
+ m_rtStop = m_rtDuration;
- if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
}
CSubtitleStream::~CSubtitleStream()
{
- CAutoLock cAutoLock(&m_cSharedState);
+ CAutoLock cAutoLock(&m_cSharedState);
}
STDMETHODIMP CSubtitleStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
- : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+ return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
void CSubtitleStream::UpdateFromSeek()
{
- if(ThreadExists())
- {
- // next time around the loop, the worker thread will
- // pick up the position change.
- // We need to flush all the existing data - we must do that here
- // as our thread will probably be blocked in GetBuffer otherwise
-
- m_bFlushing = TRUE;
-
- DeliverBeginFlush();
- // make sure we have stopped pushing
- Stop();
- // complete the flush
- DeliverEndFlush();
+ if(ThreadExists())
+ {
+ // next time around the loop, the worker thread will
+ // pick up the position change.
+ // We need to flush all the existing data - we must do that here
+ // as our thread will probably be blocked in GetBuffer otherwise
+
+ m_bFlushing = TRUE;
+
+ DeliverBeginFlush();
+ // make sure we have stopped pushing
+ Stop();
+ // complete the flush
+ DeliverEndFlush();
m_bFlushing = FALSE;
- // restart
- Run();
- }
+ // restart
+ Run();
+ }
}
HRESULT CSubtitleStream::SetRate(double dRate)
{
- if(dRate <= 0)
- return E_INVALIDARG;
+ if(dRate <= 0)
+ return E_INVALIDARG;
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- m_dRateSeeking = dRate;
- }
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_dRateSeeking = dRate;
+ }
- UpdateFromSeek();
+ UpdateFromSeek();
- return S_OK;
+ return S_OK;
}
HRESULT CSubtitleStream::OnThreadStartPlay()
@@ -300,26 +300,25 @@ HRESULT CSubtitleStream::ChangeStart()
{
CAutoLock lock(CSourceSeeking::m_pLock);
- OnThreadCreate();
- /*
- if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
- {
- m_nPosition = (int)(m_rtStart/10000)*1/1000;
- }
- else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
- {
- int m_nSegments = 0;
- if(!m_rts.SearchSubs((int)(m_rtStart/10000), 25, &m_nPosition, &m_nSegments))
- m_nPosition = m_nSegments;
- }
- else
- {
- m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
- if(m_nPosition < 0) m_nPosition = 0;
- else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
- }
- */
- }
+ OnThreadCreate();
+/*
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ m_nPosition = (int)(m_rtStart/10000)*1/1000;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ int m_nSegments = 0;
+ if(!m_rts.SearchSubs((int)(m_rtStart/10000), 25, &m_nPosition, &m_nSegments))
+ m_nPosition = m_nSegments;
+ }
+ else
+ {
+ m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
+ if(m_nPosition < 0) m_nPosition = 0;
+ else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
+ }
+*/ }
UpdateFromSeek();
@@ -328,13 +327,13 @@ HRESULT CSubtitleStream::ChangeStart()
HRESULT CSubtitleStream::ChangeStop()
{
- /*
- {
- CAutoLock lock(CSourceSeeking::m_pLock);
- if(m_rtPosition < m_rtStop)
- return S_OK;
- }
- */
+/*
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop)
+ return S_OK;
+ }
+*/
// We're already past the new stop time -- better flush the graph.
UpdateFromSeek();
@@ -345,22 +344,22 @@ HRESULT CSubtitleStream::OnThreadCreate()
{
CAutoLock cAutoLockShared(&m_cSharedState);
- if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
- {
- m_nPosition = m_rtStart / _ATPF;
- }
- else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
- {
- int m_nSegments = 0;
- if(!m_rts.SearchSubs((int)(m_rtStart / 10000), 10000000 / _ATPF, &m_nPosition, &m_nSegments))
- m_nPosition = m_nSegments;
- }
- else
- {
- m_nPosition = m_rts.SearchSub((int)(m_rtStart / 10000), 25);
- if(m_nPosition < 0) m_nPosition = 0;
- else if(m_rts[m_nPosition].end <= (int)(m_rtStart / 10000)) m_nPosition++;
- }
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ m_nPosition = m_rtStart/_ATPF;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ int m_nSegments = 0;
+ if(!m_rts.SearchSubs((int)(m_rtStart/10000), 10000000/_ATPF, &m_nPosition, &m_nSegments))
+ m_nPosition = m_nSegments;
+ }
+ else
+ {
+ m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
+ if(m_nPosition < 0) m_nPosition = 0;
+ else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
+ }
return CSourceStream::OnThreadCreate();
}
@@ -374,16 +373,16 @@ HRESULT CSubtitleStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPE
HRESULT hr = NOERROR;
- if(m_mt.majortype == MEDIATYPE_Video)
- {
- pProperties->cBuffers = 2;
- pProperties->cbBuffer = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biSizeImage;
- }
- else
- {
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = 0x10000;
- }
+ if(m_mt.majortype == MEDIATYPE_Video)
+ {
+ pProperties->cBuffers = 2;
+ pProperties->cbBuffer = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biSizeImage;
+ }
+ else
+ {
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 0x10000;
+ }
ALLOCATOR_PROPERTIES Actual;
if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
@@ -396,148 +395,148 @@ HRESULT CSubtitleStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPE
HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
{
- HRESULT hr;
-
+ HRESULT hr;
+
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ BYTE* pData = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
+ return S_FALSE;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ int len = 0;
+ REFERENCE_TIME rtStart, rtStop;
+
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ rtStart = (REFERENCE_TIME)((m_nPosition*_ATPF - m_rtStart) / m_dRateSeeking);
+ rtStop = (REFERENCE_TIME)(((m_nPosition+1)*_ATPF - m_rtStart) / m_dRateSeeking);
+ if(m_rtStart+rtStart >= m_rtDuration)
+ return S_FALSE;
+
+ BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
+
+ SubPicDesc spd;
+ spd.w = _WIDTH;
+ spd.h = _HEIGHT;
+ spd.bpp = 32;
+ spd.pitch = bmi.biWidth*4;
+ spd.bits = pData;
+
+ len = spd.h*spd.pitch;
+
+ for(int y = 0; y < spd.h; y++)
+ memsetd((DWORD*)(pData + spd.pitch*y), 0xff000000, spd.w*4);
+
+ RECT bbox;
+ m_rts.Render(spd, m_nPosition*_ATPF, 10000000.0/_ATPF, bbox);
+
+ for(int y = 0; y < spd.h; y++)
+ {
+ DWORD* p = (DWORD*)(pData + spd.pitch*y);
+ for(int x = 0; x < spd.w; x++, p++)
+ *p = (0xff000000-(*p&0xff000000))|(*p&0xffffff);
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ const STSSegment* stss = m_rts.GetSegment(m_nPosition);
+ if(!stss) return S_FALSE;
+
+ BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
+
+ SubPicDesc spd;
+ spd.w = _WIDTH;
+ spd.h = _HEIGHT;
+ spd.bpp = 32;
+ spd.pitch = bmi.biWidth*4;
+ spd.bits = pData;
+
+ len = spd.h*spd.pitch;
+
+ for(int y = 0; y < spd.h; y++)
+ {
+ DWORD c1 = 0xff606060, c2 = 0xffa0a0a0;
+ if(y&32) c1 ^= c2, c2 ^= c1, c1 ^= c2;
+ DWORD* p = (DWORD*)(pData + spd.pitch*y);
+ for(int x = 0; x < spd.w; x+=32, p+=32)
+ memsetd(p, (x&32) ? c1 : c2, min(spd.w-x,32)*4);
+ }
+
+ RECT bbox;
+ m_rts.Render(spd, 10000i64*(stss->start+stss->end)/2, 10000000.0/_ATPF, bbox);
+
+ rtStart = (REFERENCE_TIME)((10000i64*stss->start - m_rtStart) / m_dRateSeeking);
+ rtStop = (REFERENCE_TIME)((10000i64*stss->end - m_rtStart) / m_dRateSeeking);
+ }
+ else
+ {
+ if(m_nPosition >= m_rts.GetCount())
+ return S_FALSE;
+
+ STSEntry& stse = m_rts[m_nPosition];
+
+ if(stse.start >= m_rtStop/10000)
+ return S_FALSE;
+
+ if(m_mt.majortype == MEDIATYPE_Subtitle && m_mt.subtype == MEDIASUBTYPE_UTF8)
+ {
+ CStringA str = UTF16To8(m_rts.GetStrW(m_nPosition, false));
+ memcpy((char*)pData, str, len = str.GetLength());
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle && (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS))
+ {
+ CStringW line;
+ line.Format(L"%d,%d,%s,%s,%d,%d,%d,%s,%s",
+ stse.readorder, stse.layer, CStringW(stse.style), CStringW(stse.actor),
+ stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top+stse.marginRect.bottom)/2,
+ CStringW(stse.effect), m_rts.GetStrW(m_nPosition, true));
+
+ CStringA str = UTF16To8(line);
+ memcpy((char*)pData, str, len = str.GetLength());
+ }
+ else if(m_mt.majortype == MEDIATYPE_Text && m_mt.subtype == MEDIASUBTYPE_NULL)
+ {
+ CStringA str = m_rts.GetStrA(m_nPosition, false);
+ memcpy((char*)pData, str, len = str.GetLength());
+ }
+ else
+ {
+ return S_FALSE;
+ }
+
+ rtStart = (REFERENCE_TIME)((10000i64*stse.start - m_rtStart) / m_dRateSeeking);
+ rtStop = (REFERENCE_TIME)((10000i64*stse.end - m_rtStart) / m_dRateSeeking);
+ }
+
+ pSample->SetTime(&rtStart, &rtStop);
+ pSample->SetActualDataLength(len);
+
+ m_nPosition++;
+ }
+
+ pSample->SetSyncPoint(TRUE);
+
+ if(m_bDiscontinuity)
{
- CAutoLock cAutoLockShared(&m_cSharedState);
-
- BYTE* pData = NULL;
- if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
- return S_FALSE;
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
-
- int len = 0;
- REFERENCE_TIME rtStart, rtStop;
-
- if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
- {
- rtStart = (REFERENCE_TIME)((m_nPosition * _ATPF - m_rtStart) / m_dRateSeeking);
- rtStop = (REFERENCE_TIME)(((m_nPosition + 1) * _ATPF - m_rtStart) / m_dRateSeeking);
- if(m_rtStart + rtStart >= m_rtDuration)
- return S_FALSE;
-
- BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
-
- SubPicDesc spd;
- spd.w = _WIDTH;
- spd.h = _HEIGHT;
- spd.bpp = 32;
- spd.pitch = bmi.biWidth * 4;
- spd.bits = pData;
-
- len = spd.h * spd.pitch;
-
- for(int y = 0; y < spd.h; y++)
- memsetd((DWORD*)(pData + spd.pitch * y), 0xff000000, spd.w * 4);
-
- RECT bbox;
- m_rts.Render(spd, m_nPosition * _ATPF, 10000000.0 / _ATPF, bbox);
-
- for(int y = 0; y < spd.h; y++)
- {
- DWORD* p = (DWORD*)(pData + spd.pitch * y);
- for(int x = 0; x < spd.w; x++, p++)
- *p = (0xff000000 - (*p & 0xff000000)) | (*p & 0xffffff);
- }
- }
- else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
- {
- const STSSegment* stss = m_rts.GetSegment(m_nPosition);
- if(!stss) return S_FALSE;
-
- BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
-
- SubPicDesc spd;
- spd.w = _WIDTH;
- spd.h = _HEIGHT;
- spd.bpp = 32;
- spd.pitch = bmi.biWidth * 4;
- spd.bits = pData;
-
- len = spd.h * spd.pitch;
-
- for(int y = 0; y < spd.h; y++)
- {
- DWORD c1 = 0xff606060, c2 = 0xffa0a0a0;
- if(y & 32) c1 ^= c2, c2 ^= c1, c1 ^= c2;
- DWORD* p = (DWORD*)(pData + spd.pitch * y);
- for(int x = 0; x < spd.w; x += 32, p += 32)
- memsetd(p, (x & 32) ? c1 : c2, min(spd.w - x, 32) * 4);
- }
-
- RECT bbox;
- m_rts.Render(spd, 10000i64 *(stss->start + stss->end) / 2, 10000000.0 / _ATPF, bbox);
-
- rtStart = (REFERENCE_TIME)((10000i64 * stss->start - m_rtStart) / m_dRateSeeking);
- rtStop = (REFERENCE_TIME)((10000i64 * stss->end - m_rtStart) / m_dRateSeeking);
- }
- else
- {
- if(m_nPosition >= m_rts.GetCount())
- return S_FALSE;
-
- STSEntry& stse = m_rts[m_nPosition];
-
- if(stse.start >= m_rtStop / 10000)
- return S_FALSE;
-
- if(m_mt.majortype == MEDIATYPE_Subtitle && m_mt.subtype == MEDIASUBTYPE_UTF8)
- {
- CStringA str = UTF16To8(m_rts.GetStrW(m_nPosition, false));
- memcpy((char*)pData, str, len = str.GetLength());
- }
- else if(m_mt.majortype == MEDIATYPE_Subtitle && (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS))
- {
- CStringW line;
- line.Format(L"%d,%d,%s,%s,%d,%d,%d,%s,%s",
- stse.readorder, stse.layer, CStringW(stse.style), CStringW(stse.actor),
- stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top + stse.marginRect.bottom) / 2,
- CStringW(stse.effect), m_rts.GetStrW(m_nPosition, true));
-
- CStringA str = UTF16To8(line);
- memcpy((char*)pData, str, len = str.GetLength());
- }
- else if(m_mt.majortype == MEDIATYPE_Text && m_mt.subtype == MEDIASUBTYPE_NULL)
- {
- CStringA str = m_rts.GetStrA(m_nPosition, false);
- memcpy((char*)pData, str, len = str.GetLength());
- }
- else
- {
- return S_FALSE;
- }
-
- rtStart = (REFERENCE_TIME)((10000i64 * stse.start - m_rtStart) / m_dRateSeeking);
- rtStop = (REFERENCE_TIME)((10000i64 * stse.end - m_rtStart) / m_dRateSeeking);
- }
-
- pSample->SetTime(&rtStart, &rtStop);
- pSample->SetActualDataLength(len);
-
- m_nPosition++;
- }
-
- pSample->SetSyncPoint(TRUE);
+ pSample->SetDiscontinuity(TRUE);
+ m_bDiscontinuity = FALSE;
+ }
- if(m_bDiscontinuity)
- {
- pSample->SetDiscontinuity(TRUE);
- m_bDiscontinuity = FALSE;
- }
-
- return S_OK;
+ return S_OK;
}
HRESULT CSubtitleStream::GetMediaType(CMediaType* pmt)
{
- return (static_cast<CSubtitleSource*>(m_pFilter))->GetMediaType(pmt);
+ return (static_cast<CSubtitleSource*>(m_pFilter))->GetMediaType(pmt);
}
HRESULT CSubtitleStream::CheckMediaType(const CMediaType* pmt)
@@ -547,8 +546,8 @@ HRESULT CSubtitleStream::CheckMediaType(const CMediaType* pmt)
CMediaType mt;
GetMediaType(&mt);
- if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype)
- {
+ if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype)
+ {
return NOERROR;
}
@@ -557,7 +556,7 @@ HRESULT CSubtitleStream::CheckMediaType(const CMediaType* pmt)
STDMETHODIMP CSubtitleStream::Notify(IBaseFilter* pSender, Quality q)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//
@@ -565,7 +564,7 @@ STDMETHODIMP CSubtitleStream::Notify(IBaseFilter* pSender, Quality q)
//
CSubtitleSourceASCII::CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -573,11 +572,11 @@ HRESULT CSubtitleSourceASCII::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Text);
- pmt->SetSubtype(&MEDIASUBTYPE_NULL);
- pmt->SetFormatType(&FORMAT_None);
- pmt->ResetFormatBuffer();
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Text);
+ pmt->SetSubtype(&MEDIASUBTYPE_NULL);
+ pmt->SetFormatType(&FORMAT_None);
+ pmt->ResetFormatBuffer();
return NOERROR;
}
@@ -587,7 +586,7 @@ HRESULT CSubtitleSourceASCII::GetMediaType(CMediaType* pmt)
//
CSubtitleSourceUTF8::CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -595,13 +594,13 @@ HRESULT CSubtitleSourceUTF8::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Subtitle);
- pmt->SetSubtype(&MEDIASUBTYPE_UTF8);
- pmt->SetFormatType(&FORMAT_SubtitleInfo);
- SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
- memset(psi, 0, pmt->FormatLength());
- strcpy(psi->IsoLang, "eng");
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_UTF8);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
+ memset(psi, 0, pmt->FormatLength());
+ strcpy(psi->IsoLang, "eng");
return NOERROR;
}
@@ -611,7 +610,7 @@ HRESULT CSubtitleSourceUTF8::GetMediaType(CMediaType* pmt)
//
CSubtitleSourceSSA::CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -619,38 +618,38 @@ HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Subtitle);
- pmt->SetSubtype(&MEDIASUBTYPE_SSA);
- pmt->SetFormatType(&FORMAT_SubtitleInfo);
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_SSA);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
- CSimpleTextSubtitle sts;
- sts.Open(CString(m_fn), DEFAULT_CHARSET);
- sts.RemoveAll();
+ CSimpleTextSubtitle sts;
+ sts.Open(CString(m_fn), DEFAULT_CHARSET);
+ sts.RemoveAll();
- CFile f;
- TCHAR path[_MAX_PATH], fn[_MAX_PATH];
- if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
- return E_FAIL;
+ CFile f;
+ TCHAR path[_MAX_PATH], fn[_MAX_PATH];
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
+ return E_FAIL;
- _tremove(fn);
+ _tremove(fn);
- _tcscat(fn, _T(".ssa"));
+ _tcscat(fn, _T(".ssa"));
- if(!sts.SaveAs(fn, EXTSSA, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
- return E_FAIL;
+ if(!sts.SaveAs(fn, EXTSSA, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
+ return E_FAIL;
- int len = (int)f.GetLength() - 3;
- f.Seek(3, CFile::begin);
+ int len = (int)f.GetLength()-3;
+ f.Seek(3, CFile::begin);
- SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO) + len);
- memset(psi, 0, pmt->FormatLength());
- psi->dwOffset = sizeof(SUBTITLEINFO);
- strcpy(psi->IsoLang, "eng");
- f.Read(pmt->pbFormat + psi->dwOffset, len);
- f.Close();
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO) + len);
+ memset(psi, 0, pmt->FormatLength());
+ psi->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy(psi->IsoLang, "eng");
+ f.Read(pmt->pbFormat + psi->dwOffset, len);
+ f.Close();
- _tremove(fn);
+ _tremove(fn);
return NOERROR;
}
@@ -660,7 +659,7 @@ HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
//
CSubtitleSourceASS::CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -668,37 +667,37 @@ HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Subtitle);
- pmt->SetSubtype(&MEDIASUBTYPE_ASS);
- pmt->SetFormatType(&FORMAT_SubtitleInfo);
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_ASS);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
- CSimpleTextSubtitle sts;
- sts.Open(CString(m_fn), DEFAULT_CHARSET);
- sts.RemoveAll();
+ CSimpleTextSubtitle sts;
+ sts.Open(CString(m_fn), DEFAULT_CHARSET);
+ sts.RemoveAll();
- CFile f;
- TCHAR path[_MAX_PATH], fn[_MAX_PATH];
- if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
- return E_FAIL;
+ CFile f;
+ TCHAR path[_MAX_PATH], fn[_MAX_PATH];
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
+ return E_FAIL;
- _tremove(fn);
+ _tremove(fn);
- _tcscat(fn, _T(".ass"));
+ _tcscat(fn, _T(".ass"));
- if(!sts.SaveAs(fn, EXTASS, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
- return E_FAIL;
+ if(!sts.SaveAs(fn, EXTASS, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
+ return E_FAIL;
- int len = (int)f.GetLength();
+ int len = (int)f.GetLength();
- SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO) + len);
- memset(psi, 0, pmt->FormatLength());
- psi->dwOffset = sizeof(SUBTITLEINFO);
- strcpy(psi->IsoLang, "eng");
- f.Read(pmt->pbFormat + psi->dwOffset, len);
- f.Close();
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO) + len);
+ memset(psi, 0, pmt->FormatLength());
+ psi->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy(psi->IsoLang, "eng");
+ f.Read(pmt->pbFormat + psi->dwOffset, len);
+ f.Close();
- _tremove(fn);
+ _tremove(fn);
return NOERROR;
}
@@ -708,7 +707,7 @@ HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
//
CSubtitleSourceUSF::CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -716,14 +715,14 @@ HRESULT CSubtitleSourceUSF::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Subtitle);
- pmt->SetSubtype(&MEDIASUBTYPE_USF);
- pmt->SetFormatType(&FORMAT_SubtitleInfo);
- SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
- memset(psi, 0, pmt->FormatLength());
- strcpy(psi->IsoLang, "eng");
- // TODO: ...
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_USF);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
+ memset(psi, 0, pmt->FormatLength());
+ strcpy(psi->IsoLang, "eng");
+ // TODO: ...
return NOERROR;
}
@@ -733,7 +732,7 @@ HRESULT CSubtitleSourceUSF::GetMediaType(CMediaType* pmt)
//
CSubtitleSourcePreview::CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -741,19 +740,19 @@ HRESULT CSubtitleSourcePreview::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Video);
- pmt->SetSubtype(&MEDIASUBTYPE_RGB32);
- pmt->SetFormatType(&FORMAT_VideoInfo);
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(pvih, 0, pmt->FormatLength());
- pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
- pvih->bmiHeader.biWidth = _WIDTH;
- pvih->bmiHeader.biHeight = _HEIGHT;
- pvih->bmiHeader.biBitCount = 32;
- pvih->bmiHeader.biCompression = BI_RGB;
- pvih->bmiHeader.biPlanes = 1;
- pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth * abs(pvih->bmiHeader.biHeight) * pvih->bmiHeader.biBitCount >> 3;
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_RGB32);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(pvih, 0, pmt->FormatLength());
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ pvih->bmiHeader.biWidth = _WIDTH;
+ pvih->bmiHeader.biHeight = _HEIGHT;
+ pvih->bmiHeader.biBitCount = 32;
+ pvih->bmiHeader.biCompression = BI_RGB;
+ pvih->bmiHeader.biPlanes = 1;
+ pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth*abs(pvih->bmiHeader.biHeight)*pvih->bmiHeader.biBitCount>>3;
return NOERROR;
}
@@ -763,7 +762,7 @@ HRESULT CSubtitleSourcePreview::GetMediaType(CMediaType* pmt)
//
CSubtitleSourceARGB::CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr)
- : CSubtitleSource(lpunk, phr, __uuidof(this))
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
{
}
@@ -771,20 +770,20 @@ HRESULT CSubtitleSourceARGB::GetMediaType(CMediaType* pmt)
{
CAutoLock cAutoLock(pStateLock());
- pmt->InitMediaType();
- pmt->SetType(&MEDIATYPE_Video);
- pmt->SetSubtype(&MEDIASUBTYPE_ARGB32);
- pmt->SetFormatType(&FORMAT_VideoInfo);
- VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(pvih, 0, pmt->FormatLength());
- pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
- // TODO: read w,h,fps from a config file or registry
- pvih->bmiHeader.biWidth = _WIDTH;
- pvih->bmiHeader.biHeight = _HEIGHT;
- pvih->bmiHeader.biBitCount = 32;
- pvih->bmiHeader.biCompression = BI_RGB;
- pvih->bmiHeader.biPlanes = 1;
- pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth * abs(pvih->bmiHeader.biHeight) * pvih->bmiHeader.biBitCount >> 3;
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_ARGB32);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(pvih, 0, pmt->FormatLength());
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ // TODO: read w,h,fps from a config file or registry
+ pvih->bmiHeader.biWidth = _WIDTH;
+ pvih->bmiHeader.biHeight = _HEIGHT;
+ pvih->bmiHeader.biBitCount = 32;
+ pvih->bmiHeader.biCompression = BI_RGB;
+ pvih->bmiHeader.biPlanes = 1;
+ pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth*abs(pvih->bmiHeader.biHeight)*pvih->bmiHeader.biBitCount>>3;
return NOERROR;
}
diff --git a/src/filters/source/SubtitleSource/SubtitleSource.h b/src/filters/source/SubtitleSource/SubtitleSource.h
index 8fc2acb91..77ef35581 100644
--- a/src/filters/source/SubtitleSource/SubtitleSource.h
+++ b/src/filters/source/SubtitleSource/SubtitleSource.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,130 +25,127 @@
#include "../../../subtitles/RTS.h"
class CSubtitleSource
- : public CSource
- , public IFileSourceFilter
- , public IAMFilterMiscFlags
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
{
protected:
- CStringW m_fn;
+ CStringW m_fn;
public:
- CSubtitleSource(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
- virtual ~CSubtitleSource();
+ CSubtitleSource(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CSubtitleSource();
- DECLARE_IUNKNOWN;
+ DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IFileSourceFilter
- STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
- // IAMFilterMiscFlags
- STDMETHODIMP_(ULONG) GetMiscFlags();
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
virtual HRESULT GetMediaType(CMediaType* pmt) = 0;
};
-class CSubtitleStream
- : public CSourceStream
- , public CSourceSeeking
+class CSubtitleStream
+ : public CSourceStream
+ , public CSourceSeeking
{
- CCritSec m_cSharedState;
+ CCritSec m_cSharedState;
- int m_nPosition;
+ int m_nPosition;
- BOOL m_bDiscontinuity, m_bFlushing;
+ BOOL m_bDiscontinuity, m_bFlushing;
- HRESULT OnThreadStartPlay();
- HRESULT OnThreadCreate();
+ HRESULT OnThreadStartPlay();
+ HRESULT OnThreadCreate();
- void UpdateFromSeek();
- STDMETHODIMP SetRate(double dRate);
+ void UpdateFromSeek();
+ STDMETHODIMP SetRate(double dRate);
- HRESULT ChangeStart();
+ HRESULT ChangeStart();
HRESULT ChangeStop();
- HRESULT ChangeRate()
- {
- return S_OK;
- }
+ HRESULT ChangeRate() {return S_OK;}
protected:
- CRenderedTextSubtitle m_rts;
+ CRenderedTextSubtitle m_rts;
public:
CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr);
- virtual ~CSubtitleStream();
+ virtual ~CSubtitleStream();
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
HRESULT FillBuffer(IMediaSample* pSample);
HRESULT GetMediaType(CMediaType* pmt);
- HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT CheckMediaType(const CMediaType* pmt);
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
};
[uuid("E44CA3B5-A0FF-41A0-AF16-42429B1095EA")]
class CSubtitleSourceASCII : public CSubtitleSource
{
public:
- CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
[uuid("87864E0F-7073-4E39-B802-143DE0ED4964")]
class CSubtitleSourceUTF8 : public CSubtitleSource
{
public:
- CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
[uuid("18316B1A-5877-4CC4-85FD-EDE65CD489EC")]
class CSubtitleSourceSSA : public CSubtitleSource
{
public:
- CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
[uuid("416782BC-1D87-48C0-8F65-F113A5CB8E15")]
class CSubtitleSourceASS : public CSubtitleSource
{
public:
- CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
[uuid("D7215AFC-DFE6-483B-9AF3-6BBECFF14CF4")]
class CSubtitleSourceUSF : public CSubtitleSource
{
public:
- CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
[uuid("932E75D4-BBD4-4A0F-9071-6728FBDC4C98")]
class CSubtitleSourcePreview : public CSubtitleSource
{
public:
- CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
[uuid("CF0D7280-527D-415E-BA02-56017484D73E")]
class CSubtitleSourceARGB : public CSubtitleSource
{
public:
- CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr);
+ CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr);
- HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT GetMediaType(CMediaType* pmt);
};
diff --git a/src/filters/source/SubtitleSource/resource.h b/src/filters/source/SubtitleSource/resource.h
index 2dcb23529..fb6ab9443 100644
--- a/src/filters/source/SubtitleSource/resource.h
+++ b/src/filters/source/SubtitleSource/resource.h
@@ -3,7 +3,7 @@
// Used by subtitlesource.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/source/SubtitleSource/stdafx.cpp b/src/filters/source/SubtitleSource/stdafx.cpp
index a51424de6..f08539cb9 100644
--- a/src/filters/source/SubtitleSource/stdafx.cpp
+++ b/src/filters/source/SubtitleSource/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/source/SubtitleSource/stdafx.h b/src/filters/source/SubtitleSource/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/source/SubtitleSource/stdafx.h
+++ b/src/filters/source/SubtitleSource/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/stdafx.cpp b/src/filters/stdafx.cpp
index 9e202bbeb..fd94566f5 100644
--- a/src/filters/stdafx.cpp
+++ b/src/filters/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/stdafx.h b/src/filters/stdafx.h
index abde5c188..b5b447c08 100644
--- a/src/filters/stdafx.h
+++ b/src/filters/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/switcher/AudioSwitcher/Audio.cpp b/src/filters/switcher/AudioSwitcher/Audio.cpp
index a5db05ca9..2490b4e77 100644
--- a/src/filters/switcher/AudioSwitcher/Audio.cpp
+++ b/src/filters/switcher/AudioSwitcher/Audio.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,316 +24,291 @@
#include "stdafx.h"
#include "Audio.h"
-static long audio_pointsample_8(void *dst, void *src, long accum, long samp_frac, long cnt)
-{
- unsigned char *d = (unsigned char *)dst;
- unsigned char *s = (unsigned char *)src;
+static long audio_pointsample_8(void *dst, void *src, long accum, long samp_frac, long cnt) {
+ unsigned char *d = (unsigned char *)dst;
+ unsigned char *s = (unsigned char *)src;
- do
- {
- *d++ = s[accum>>19];
- accum += samp_frac;
- }
- while(--cnt);
+ do {
+ *d++ = s[accum>>19];
+ accum += samp_frac;
+ } while(--cnt);
- return accum;
+ return accum;
}
-static long audio_pointsample_16(void *dst, void *src, long accum, long samp_frac, long cnt)
-{
- unsigned short *d = (unsigned short *)dst;
- unsigned short *s = (unsigned short *)src;
+static long audio_pointsample_16(void *dst, void *src, long accum, long samp_frac, long cnt) {
+ unsigned short *d = (unsigned short *)dst;
+ unsigned short *s = (unsigned short *)src;
- do
- {
- *d++ = s[accum>>19];
- accum += samp_frac;
- }
- while(--cnt);
+ do {
+ *d++ = s[accum>>19];
+ accum += samp_frac;
+ } while(--cnt);
- return accum;
+ return accum;
}
-static long audio_pointsample_32(void *dst, void *src, long accum, long samp_frac, long cnt)
-{
- unsigned long *d = (unsigned long *)dst;
- unsigned long *s = (unsigned long *)src;
+static long audio_pointsample_32(void *dst, void *src, long accum, long samp_frac, long cnt) {
+ unsigned long *d = (unsigned long *)dst;
+ unsigned long *s = (unsigned long *)src;
- do
- {
- *d++ = s[accum>>19];
- accum += samp_frac;
- }
- while(--cnt);
+ do {
+ *d++ = s[accum>>19];
+ accum += samp_frac;
+ } while(--cnt);
- return accum;
+ return accum;
}
-static long audio_downsample_mono8(void *dst, void *src, long *filter_bank, int filter_width, long accum, long samp_frac, long cnt)
-{
- unsigned char *d = (unsigned char *)dst;
- unsigned char *s = (unsigned char *)src;
-
- do
- {
- long sum = 0;
- int w;
- long *fb_ptr;
- unsigned char *s_ptr;
-
- w = filter_width;
- fb_ptr = filter_bank + filter_width * ((accum >> 11) & 0xff);
- s_ptr = s + (accum >> 19);
- do
- {
- sum += *fb_ptr++ * (int) * s_ptr++;
- }
- while(--w);
-
- if(sum < 0)
- *d++ = 0;
- else if(sum > 0x3fffff)
- *d++ = 0xff;
- else
- *d++ = ((sum + 0x2000) >> 14);
-
- accum += samp_frac;
- }
- while(--cnt);
-
- return accum;
+static long audio_downsample_mono8(void *dst, void *src, long *filter_bank, int filter_width, long accum, long samp_frac, long cnt) {
+ unsigned char *d = (unsigned char *)dst;
+ unsigned char *s = (unsigned char *)src;
+
+ do {
+ long sum = 0;
+ int w;
+ long *fb_ptr;
+ unsigned char *s_ptr;
+
+ w = filter_width;
+ fb_ptr = filter_bank + filter_width * ((accum>>11)&0xff);
+ s_ptr = s + (accum>>19);
+ do {
+ sum += *fb_ptr++ * (int)*s_ptr++;
+ } while(--w);
+
+ if (sum < 0)
+ *d++ = 0;
+ else if (sum > 0x3fffff)
+ *d++ = 0xff;
+ else
+ *d++ = ((sum + 0x2000)>>14);
+
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
}
-static long audio_downsample_mono16(void *dst, void *src, long *filter_bank, int filter_width, long accum, long samp_frac, long cnt)
-{
- signed short *d = (signed short *)dst;
- signed short *s = (signed short *)src;
-
- do
- {
- long sum = 0;
- int w;
- long *fb_ptr;
- signed short *s_ptr;
-
- w = filter_width;
- fb_ptr = filter_bank + filter_width * ((accum >> 11) & 0xff);
- s_ptr = s + (accum >> 19);
- do
- {
- sum += *fb_ptr++ * (int) * s_ptr++;
- }
- while(--w);
-
- if(sum < -0x20000000)
- *d++ = -0x8000;
- else if(sum > 0x1fffffff)
- *d++ = 0x7fff;
- else
- *d++ = ((sum + 0x2000) >> 14);
-
- accum += samp_frac;
- }
- while(--cnt);
-
- return accum;
+static long audio_downsample_mono16(void *dst, void *src, long *filter_bank, int filter_width, long accum, long samp_frac, long cnt) {
+ signed short *d = (signed short *)dst;
+ signed short *s = (signed short *)src;
+
+ do {
+ long sum = 0;
+ int w;
+ long *fb_ptr;
+ signed short *s_ptr;
+
+ w = filter_width;
+ fb_ptr = filter_bank + filter_width * ((accum>>11)&0xff);
+ s_ptr = s + (accum>>19);
+ do {
+ sum += *fb_ptr++ * (int)*s_ptr++;
+ } while(--w);
+
+ if (sum < -0x20000000)
+ *d++ = -0x8000;
+ else if (sum > 0x1fffffff)
+ *d++ = 0x7fff;
+ else
+ *d++ = ((sum + 0x2000)>>14);
+
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
}
-static int permute_index(int a, int b)
-{
- return (b - (a >> 8) - 1) + (a & 255) * b;
+static int permute_index(int a, int b) {
+ return (b-(a>>8)-1) + (a&255)*b;
}
-static void make_downsample_filter(long *filter_bank, int filter_width, long samp_frac)
-{
- int i, j, v;
- double filt_max;
- double filtwidth_frac;
+static void make_downsample_filter(long *filter_bank, int filter_width, long samp_frac) {
+ int i, j, v;
+ double filt_max;
+ double filtwidth_frac;
- filtwidth_frac = samp_frac / 2048.0;
+ filtwidth_frac = samp_frac/2048.0;
- filter_bank[filter_width-1] = 0;
+ filter_bank[filter_width-1] = 0;
- filt_max = (16384.0 * 524288.0) / samp_frac;
+ filt_max = (16384.0 * 524288.0) / samp_frac;
- for(i = 0; i < 128 * filter_width; i++)
- {
- int y = 0;
- double d = i / filtwidth_frac;
+ for(i=0; i<128*filter_width; i++) {
+ int y = 0;
+ double d = i / filtwidth_frac;
- if(d < 1.0)
- y = (int)(0.5 + filt_max * (1.0 - d));
+ if (d<1.0)
+ y = (int)(0.5 + filt_max*(1.0 - d));
- filter_bank[permute_index(128*filter_width + i, filter_width)]
- = filter_bank[permute_index(128*filter_width - i, filter_width)]
- = y;
- }
+ filter_bank[permute_index(128*filter_width + i, filter_width)]
+ = filter_bank[permute_index(128*filter_width - i, filter_width)]
+ = y;
+ }
- // Normalize the filter to correct for integer roundoff errors
+ // Normalize the filter to correct for integer roundoff errors
- for(i = 0; i < 256 * filter_width; i += filter_width)
- {
- v = 0;
- for(j = 0; j < filter_width; j++)
- v += filter_bank[i+j];
+ for(i=0; i<256*filter_width; i+=filter_width) {
+ v=0;
+ for(j=0; j<filter_width; j++)
+ v += filter_bank[i+j];
// _RPT2(0,"error[%02x] = %04x\n", i/filter_width, 0x4000 - v);
- v = (0x4000 - v) / filter_width;
- for(j = 0; j < filter_width; j++)
- filter_bank[i+j] += v;
- }
+ v = (0x4000 - v)/filter_width;
+ for(j=0; j<filter_width; j++)
+ filter_bank[i+j] += v;
+ }
// _CrtCheckMemory();
}
AudioStreamResampler::AudioStreamResampler(int bps, long org_rate, long new_rate, bool fHighQuality)
{
- samp_frac = 0x80000;
-
- this->bps = bps;
-
- if(bps == 1)
- {
- ptsampleRout = audio_pointsample_8;
- dnsampleRout = audio_downsample_mono8;
- }
- else if(bps >= 2)
- {
- ptsampleRout = audio_pointsample_16;
- dnsampleRout = audio_downsample_mono16;
- }
- else
- {
- return;
- }
+ samp_frac = 0x80000;
+
+ this->bps = bps;
+
+ if(bps == 1)
+ {
+ ptsampleRout = audio_pointsample_8;
+ dnsampleRout = audio_downsample_mono8;
+ }
+ else if(bps >= 2)
+ {
+ ptsampleRout = audio_pointsample_16;
+ dnsampleRout = audio_downsample_mono16;
+ }
+ else
+ {
+ return;
+ }
// org_rate > new_rate!
- samp_frac = MulDiv(org_rate, 0x80000, new_rate);
+ samp_frac = MulDiv(org_rate, 0x80000, new_rate);
- holdover = 0;
- filter_bank = NULL;
- filter_width = 1;
- accum = 0;
+ holdover = 0;
+ filter_bank = NULL;
+ filter_width = 1;
+ accum = 0;
- // If this is a high-quality downsample, allocate memory for the filter bank
+ // If this is a high-quality downsample, allocate memory for the filter bank
- if(fHighQuality)
- {
- if(samp_frac > 0x80000)
- {
- // HQ downsample: allocate filter bank
+ if(fHighQuality)
+ {
+ if(samp_frac>0x80000)
+ {
+ // HQ downsample: allocate filter bank
- filter_width = ((samp_frac + 0x7ffff) >> 19) << 1 << 1;
+ filter_width = ((samp_frac + 0x7ffff)>>19)<<1 <<1;
- if(!(filter_bank = DNew long[filter_width * 256]))
- {
- filter_width = 1;
- return;
- }
+ if(!(filter_bank = DNew long[filter_width * 256]))
+ {
+ filter_width = 1;
+ return;
+ }
- make_downsample_filter(filter_bank, filter_width, samp_frac);
+ make_downsample_filter(filter_bank, filter_width, samp_frac);
- // Clear lower samples
+ // Clear lower samples
- memset(cbuffer, bps >= 2 ? 0 : 0x80, bps * filter_width);
+ memset(cbuffer, bps >= 2 ? 0 : 0x80, bps*filter_width);
- holdover = filter_width / 2;
- }
- }
+ holdover = filter_width/2;
+ }
+ }
}
AudioStreamResampler::~AudioStreamResampler()
{
- delete [] filter_bank;
+ delete [] filter_bank;
}
long AudioStreamResampler::Downsample(void* input, long samplesin, void* output, long samplesout)
{
- long lActualSamples = 0;
+ long lActualSamples = 0;
- // Downsampling is even worse because we have overlap to the left and to the
- // right of the interpolated point.
- //
- // We need (n/2) points to the left and (n/2-1) points to the right.
+ // Downsampling is even worse because we have overlap to the left and to the
+ // right of the interpolated point.
+ //
+ // We need (n/2) points to the left and (n/2-1) points to the right.
- while(samplesin > 0 && samplesout > 0)
- {
- long srcSamples, dstSamples;
- int nhold;
+ while(samplesin > 0 && samplesout > 0)
+ {
+ long srcSamples, dstSamples;
+ int nhold;
- // Figure out how many source samples we need.
- //
- // To do this, compute the highest fixed-point accumulator we'll reach.
- // Truncate that, and add the filter width. Then subtract however many
- // samples are sitting at the bottom of the buffer.
+ // Figure out how many source samples we need.
+ //
+ // To do this, compute the highest fixed-point accumulator we'll reach.
+ // Truncate that, and add the filter width. Then subtract however many
+ // samples are sitting at the bottom of the buffer.
- srcSamples = (long)(((__int64)samp_frac * (samplesout - 1) + accum) >> 19) + filter_width - holdover;
+ srcSamples = (long)(((__int64)samp_frac*(samplesout-1) + accum) >> 19) + filter_width - holdover;
- // Don't exceed the buffer (BUFFER_SIZE - holdover).
+ // Don't exceed the buffer (BUFFER_SIZE - holdover).
- if(srcSamples > BUFFER_SIZE - holdover)
- srcSamples = BUFFER_SIZE - holdover;
+ if(srcSamples > BUFFER_SIZE - holdover)
+ srcSamples = BUFFER_SIZE - holdover;
- // Read into buffer.
+ // Read into buffer.
- srcSamples = min(srcSamples, samplesin);
- if(!srcSamples) break;
+ srcSamples = min(srcSamples, samplesin);
+ if(!srcSamples) break;
- memcpy((char*)cbuffer + holdover * bps, (char*)input, srcSamples * bps);
- input = (void *)((char *)input + srcSamples * bps);
+ memcpy((char*)cbuffer + holdover*bps, (char*)input, srcSamples*bps);
+ input = (void *)((char *)input + srcSamples*bps);
- // Figure out how many destination samples we'll get out of what we
- // read. We'll have (srcSamples+holdover) bytes, so the maximum
- // fixed-pt accumulator we can hit is
- // (srcSamples+holdover-filter_width)<<16 + 0xffff.
+ // Figure out how many destination samples we'll get out of what we
+ // read. We'll have (srcSamples+holdover) bytes, so the maximum
+ // fixed-pt accumulator we can hit is
+ // (srcSamples+holdover-filter_width)<<16 + 0xffff.
- dstSamples = (((__int64)(srcSamples + holdover - filter_width) << 19) + 0x7ffff - accum) / samp_frac + 1;
+ dstSamples = (((__int64)(srcSamples+holdover-filter_width)<<19) + 0x7ffff - accum) / samp_frac + 1;
- if(dstSamples > samplesout)
- dstSamples = samplesout;
+ if(dstSamples > samplesout)
+ dstSamples = samplesout;
- if(dstSamples >= 1)
- {
- if(filter_bank)
- accum = dnsampleRout(output, cbuffer, filter_bank, filter_width, accum, samp_frac, dstSamples);
- else
- accum = ptsampleRout(output, cbuffer, accum, samp_frac, dstSamples);
+ if(dstSamples >= 1)
+ {
+ if(filter_bank)
+ accum = dnsampleRout(output, cbuffer, filter_bank, filter_width, accum, samp_frac, dstSamples);
+ else
+ accum = ptsampleRout(output, cbuffer, accum, samp_frac, dstSamples);
- output = (void *)((char *)output + bps * dstSamples);
- lActualSamples += dstSamples;
- samplesout -= dstSamples;
- }
+ output = (void *)((char *)output + bps * dstSamples);
+ lActualSamples += dstSamples;
+ samplesout -= dstSamples;
+ }
- // We're "shifting" the new samples down to the bottom by discarding
- // all the samples in the buffer, so adjust the fixed-pt accum
- // accordingly.
+ // We're "shifting" the new samples down to the bottom by discarding
+ // all the samples in the buffer, so adjust the fixed-pt accum
+ // accordingly.
- accum -= ((srcSamples + holdover) << 19);
+ accum -= ((srcSamples+holdover)<<19);
- // Oops, did we need some of those?
- //
- // If accum=0, we need (n/2) samples back. accum>=0x10000 is fewer,
- // accum<0 is more.
+ // Oops, did we need some of those?
+ //
+ // If accum=0, we need (n/2) samples back. accum>=0x10000 is fewer,
+ // accum<0 is more.
- nhold = - (accum >> 19);
+ nhold = - (accum>>19);
// _ASSERT(nhold<=(filter_width/2));
- if(nhold > 0)
- {
- memmove(cbuffer, (char *)cbuffer + bps*(srcSamples + holdover - nhold), bps * nhold);
- holdover = nhold;
- accum += nhold << 19;
- }
- else
- holdover = 0;
+ if (nhold>0) {
+ memmove(cbuffer, (char *)cbuffer+bps*(srcSamples+holdover-nhold), bps*nhold);
+ holdover = nhold;
+ accum += nhold<<19;
+ } else
+ holdover = 0;
// _ASSERT(accum>=0);
- }
+ }
- int Bytes = lActualSamples * bps;
+ int Bytes = lActualSamples * bps;
- return lActualSamples;
+ return lActualSamples;
}
diff --git a/src/filters/switcher/AudioSwitcher/Audio.h b/src/filters/switcher/AudioSwitcher/Audio.h
index ca9311762..81688d93c 100644
--- a/src/filters/switcher/AudioSwitcher/Audio.h
+++ b/src/filters/switcher/AudioSwitcher/Audio.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,29 +26,29 @@
#include <mmsystem.h>
#include <msacm.h>
-typedef long(*AudioPointSampler)(void *, void *, long, long, long);
-typedef long(*AudioDownSampler)(void *, void *, long *, int, long, long, long);
+typedef long (*AudioPointSampler)(void *, void *, long, long, long);
+typedef long (*AudioDownSampler)(void *, void *, long *, int, long, long, long);
-class AudioStreamResampler
+class AudioStreamResampler
{
private:
- AudioPointSampler ptsampleRout;
- AudioDownSampler dnsampleRout;
- long samp_frac;
- long accum;
- int holdover;
- long *filter_bank;
- int filter_width;
- bool fHighQuality;
-
- enum { BUFFER_SIZE = 512 };
- BYTE cbuffer[4*BUFFER_SIZE];
- int bps;
+ AudioPointSampler ptsampleRout;
+ AudioDownSampler dnsampleRout;
+ long samp_frac;
+ long accum;
+ int holdover;
+ long *filter_bank;
+ int filter_width;
+ bool fHighQuality;
+
+ enum { BUFFER_SIZE=512 };
+ BYTE cbuffer[4*BUFFER_SIZE];
+ int bps;
public:
- AudioStreamResampler(int bps, long org_rate, long new_rate, bool fHighQuality);
- ~AudioStreamResampler();
+ AudioStreamResampler(int bps, long org_rate, long new_rate, bool fHighQuality);
+ ~AudioStreamResampler();
- long Downsample(void* input, long samplesin, void* output, long samplesout);
+ long Downsample(void* input, long samplesin, void* output, long samplesout);
};
diff --git a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp
index a333fb773..3f9da40e9 100644
--- a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp
+++ b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -39,12 +39,12 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL}
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL}
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL}
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL}
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -55,7 +55,7 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CAudioSwitcherFilter), L"MPC - AudioSwitcher", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CAudioSwitcherFilter), L"MPC - AudioSwitcher", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
@@ -67,12 +67,12 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -86,546 +86,533 @@ CFilterApp theApp;
//
CAudioSwitcherFilter::CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CStreamSwitcherFilter(lpunk, phr, __uuidof(this))
- , m_fCustomChannelMapping(false)
- , m_fDownSampleTo441(false)
- , m_rtAudioTimeShift(0)
- , m_rtNextStart(0)
- , m_rtNextStop(1)
- , m_fNormalize(false)
- , m_fNormalizeRecover(false)
- , m_boost(1)
- , m_sample_max(0.1f)
+ : CStreamSwitcherFilter(lpunk, phr, __uuidof(this))
+ , m_fCustomChannelMapping(false)
+ , m_fDownSampleTo441(false)
+ , m_rtAudioTimeShift(0)
+ , m_rtNextStart(0)
+ , m_rtNextStop(1)
+ , m_fNormalize(false)
+ , m_fNormalizeRecover(false)
+ , m_boost(1)
+ , m_sample_max(0.1f)
{
- memset(m_pSpeakerToChannelMap, 0, sizeof(m_pSpeakerToChannelMap));
+ memset(m_pSpeakerToChannelMap, 0, sizeof(m_pSpeakerToChannelMap));
- if(phr)
- {
- if(FAILED(*phr)) return;
- else *phr = S_OK;
- }
+ if(phr)
+ {
+ if(FAILED(*phr)) return;
+ else *phr = S_OK;
+ }
}
STDMETHODIMP CAudioSwitcherFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IAudioSwitcherFilter)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IAudioSwitcherFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CAudioSwitcherFilter::CheckMediaType(const CMediaType* pmt)
{
- if(pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->nChannels > 2
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag != WAVE_FORMAT_EXTENSIBLE)
- return VFW_E_INVALIDMEDIATYPE; // stupid iviaudio tries to fool us
-
- return (pmt->majortype == MEDIATYPE_Audio
- && pmt->formattype == FORMAT_WaveFormatEx
- && (((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 8
- || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 16
- || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 24
- || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 32)
- && (((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_PCM
- || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_IEEE_FLOAT
- || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF
- || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_EXTENSIBLE))
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ if(pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->nChannels > 2
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag != WAVE_FORMAT_EXTENSIBLE)
+ return VFW_E_INVALIDMEDIATYPE; // stupid iviaudio tries to fool us
+
+ return (pmt->majortype == MEDIATYPE_Audio
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && (((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 8
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 16
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 24
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 32)
+ && (((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_PCM
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_IEEE_FLOAT
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_EXTENSIBLE))
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
-template<class T, class U, int Umin, int Umax>
+template<class T, class U, int Umin, int Umax>
void mix(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
{
- U sum = 0;
-
- for(int i = 0, j = min(18, ch); i < j; i++)
- {
- if(mask & (1 << i))
- {
- sum += *(T*)&src[bps*i];
- }
- }
-
- if(sum < Umin) sum = Umin;
- if(sum > Umax) sum = Umax;
-
- *(T*)dst = (T)sum;
+ U sum = 0;
+
+ for(int i = 0, j = min(18, ch); i < j; i++)
+ {
+ if(mask & (1<<i))
+ {
+ sum += *(T*)&src[bps*i];
+ }
+ }
+
+ if(sum < Umin) sum = Umin;
+ if(sum > Umax) sum = Umax;
+
+ *(T*)dst = (T)sum;
}
-template<>
-void mix < int, INT64, (-1 << 24), (+1 << 24) - 1 > (DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
+template<>
+void mix<int, INT64, (-1<<24), (+1<<24)-1>(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
{
- INT64 sum = 0;
+ INT64 sum = 0;
- for(int i = 0, j = min(18, ch); i < j; i++)
- {
- if(mask & (1 << i))
- {
- int tmp;
- memcpy((BYTE*)&tmp + 1, &src[bps*i], 3);
- sum += tmp >> 8;
- }
- }
+ for(int i = 0, j = min(18, ch); i < j; i++)
+ {
+ if(mask & (1<<i))
+ {
+ int tmp;
+ memcpy((BYTE*)&tmp+1, &src[bps*i], 3);
+ sum += tmp >> 8;
+ }
+ }
- sum = min(max(sum, (-1 << 24)), (+1 << 24) - 1);
+ sum = min(max(sum, (-1<<24)), (+1<<24)-1);
- memcpy(dst, (BYTE*)&sum, 3);
+ memcpy(dst, (BYTE*)&sum, 3);
}
template<class T>
T clamp(double s, T smin, T smax)
{
- if(s < -1) s = -1;
- else if(s > 1) s = 1;
- T t = (T)(s * smax);
- if(t < smin) t = smin;
- else if(t > smax) t = smax;
- return t;
+ if(s < -1) s = -1;
+ else if(s > 1) s = 1;
+ T t = (T)(s * smax);
+ if(t < smin) t = smin;
+ else if(t > smax) t = smax;
+ return t;
}
HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- CStreamSwitcherInputPin* pInPin = GetInputPin();
- CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
- if(!pInPin || !pOutPin)
- return __super::Transform(pIn, pOut);
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
- WAVEFORMATEX* wfeout = (WAVEFORMATEX*)pOutPin->CurrentMediaType().pbFormat;
- WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
- WAVEFORMATEXTENSIBLE* wfexout = (WAVEFORMATEXTENSIBLE*)wfeout;
-
- int bps = wfe->wBitsPerSample >> 3;
-
- int len = pIn->GetActualDataLength() / (bps * wfe->nChannels);
- int lenout = (UINT64)len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
-
- REFERENCE_TIME rtStart, rtStop;
- if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
- {
- rtStart += m_rtAudioTimeShift;
- rtStop += m_rtAudioTimeShift;
- pOut->SetTime(&rtStart, &rtStop);
-
- m_rtNextStart = rtStart;
- m_rtNextStop = rtStop;
- }
- else
- {
- pOut->SetTime(&m_rtNextStart, &m_rtNextStop);
- }
-
- REFERENCE_TIME rtDur = 10000000i64 * len / wfe->nSamplesPerSec;
-
- m_rtNextStart += rtDur;
- m_rtNextStop += rtDur;
-
- if(pIn->IsDiscontinuity() == S_OK)
- {
- m_sample_max = 0.1f;
- }
-
- WORD tag = wfe->wFormatTag;
- bool fPCM = tag == WAVE_FORMAT_PCM || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM;
- bool fFloat = tag == WAVE_FORMAT_IEEE_FLOAT || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
- if(!fPCM && !fFloat) return __super::Transform(pIn, pOut);
-
- BYTE* pDataIn = NULL;
- BYTE* pDataOut = NULL;
-
- HRESULT hr;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
- if(FAILED(hr = pOut->GetPointer(&pDataOut))) return hr;
-
- if(!pDataIn || !pDataOut || len < 0 || lenout < 0) return S_FALSE;
- // len = 0 doesn't mean it's failed, return S_OK otherwise might skrew the sound
- if(len == 0)
- {
- pOut->SetActualDataLength(0);
- return S_OK;
- }
-
- memset(pDataOut, 0, pOut->GetSize());
-
- if(m_fCustomChannelMapping)
- {
- if(m_chs[wfe->nChannels-1].GetCount() > 0)
- {
- for(int i = 0; i < wfeout->nChannels; i++)
- {
- DWORD mask = m_chs[wfe->nChannels-1][i].Channel;
-
- BYTE* src = pDataIn;
- BYTE* dst = &pDataOut[bps*i];
-
- int srcstep = bps * wfe->nChannels;
- int dststep = bps * wfeout->nChannels;
-
- if(fPCM && wfe->wBitsPerSample == 8)
- {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
- {
- mix<unsigned char, INT64, 0, UCHAR_MAX>(mask, wfe->nChannels, bps, src, dst);
- }
- }
- else if(fPCM && wfe->wBitsPerSample == 16)
- {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
- {
- mix<short, INT64, SHRT_MIN, SHRT_MAX>(mask, wfe->nChannels, bps, src, dst);
- }
- }
- else if(fPCM && wfe->wBitsPerSample == 24)
- {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
- {
- mix < int, INT64, (-1 << 24), (+1 << 24) - 1 > (mask, wfe->nChannels, bps, src, dst);
- }
- }
- else if(fPCM && wfe->wBitsPerSample == 32)
- {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
- {
- mix<int, __int64, INT_MIN, INT_MAX>(mask, wfe->nChannels, bps, src, dst);
- }
- }
- else if(fFloat && wfe->wBitsPerSample == 32)
- {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
- {
- mix < float, double, -1, 1 > (mask, wfe->nChannels, bps, src, dst);
- }
- }
- else if(fFloat && wfe->wBitsPerSample == 64)
- {
- for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
- {
- mix < double, double, -1, 1 > (mask, wfe->nChannels, bps, src, dst);
- }
- }
- }
- }
- else
- {
- BYTE* pDataOut = NULL;
- HRESULT hr;
- if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) return hr;
- memset(pDataOut, 0, pOut->GetSize());
- }
- }
- else
- {
- HRESULT hr;
- if(S_OK != (hr = __super::Transform(pIn, pOut)))
- return hr;
- }
-
- if(m_fDownSampleTo441
- && wfe->nSamplesPerSec > 44100 && wfeout->nSamplesPerSec == 44100
- && wfe->wBitsPerSample <= 16 && fPCM)
- {
- if(BYTE* buff = DNew BYTE[len*bps])
- {
- for(int ch = 0; ch < wfeout->nChannels; ch++)
- {
- memset(buff, 0, len * bps);
-
- for(int i = 0; i < len; i++)
- memcpy(buff + i * bps, (char*)pDataOut + (ch + i * wfeout->nChannels)*bps, bps);
-
- m_pResamplers[ch]->Downsample(buff, len, buff, lenout);
-
- for(int i = 0; i < lenout; i++)
- memcpy((char*)pDataOut + (ch + i * wfeout->nChannels)*bps, buff + i * bps, bps);
- }
-
- delete [] buff;
- }
- }
-
- if(m_fNormalize || m_boost > 1)
- {
- int samples = lenout * wfeout->nChannels;
-
- if(double* buff = DNew double[samples])
- {
- for(int i = 0; i < samples; i++)
- {
- if(fPCM && wfe->wBitsPerSample == 8) buff[i] = (double)((BYTE*)pDataOut)[i] / UCHAR_MAX;
- else if(fPCM && wfe->wBitsPerSample == 16) buff[i] = (double)((short*)pDataOut)[i] / SHRT_MAX;
- else if(fPCM && wfe->wBitsPerSample == 24)
- {
- int tmp;
- memcpy(((BYTE*)&tmp) + 1, &pDataOut[i*3], 3);
- buff[i] = (float)(tmp >> 8) / ((1 << 23) - 1);
- }
- else if(fPCM && wfe->wBitsPerSample == 32) buff[i] = (double)((int*)pDataOut)[i] / INT_MAX;
- else if(fFloat && wfe->wBitsPerSample == 32) buff[i] = (double)((float*)pDataOut)[i];
- else if(fFloat && wfe->wBitsPerSample == 64) buff[i] = ((double*)pDataOut)[i];
- }
-
- double sample_mul = 1;
-
- if(m_fNormalize)
- {
- for(int i = 0; i < samples; i++)
- {
- double s = buff[i];
- if(s < 0) s = -s;
- if(s > 1) s = 1;
- if(m_sample_max < s) m_sample_max = s;
- }
-
- sample_mul = 1.0f / m_sample_max;
-
- if(m_fNormalizeRecover) m_sample_max -= 1.0 * rtDur / 200000000; // -5%/sec
- if(m_sample_max < 0.1) m_sample_max = 0.1;
- }
-
- if(m_boost > 1)
- {
- sample_mul *= (1 + log10(m_boost));
- }
-
- for(int i = 0; i < samples; i++)
- {
- double s = buff[i] * sample_mul;
-
- if(fPCM && wfe->wBitsPerSample == 8)((BYTE*)pDataOut)[i] = clamp<BYTE>(s, 0, UCHAR_MAX);
- else if(fPCM && wfe->wBitsPerSample == 16)((short*)pDataOut)[i] = clamp<short>(s, SHRT_MIN, SHRT_MAX);
- else if(fPCM && wfe->wBitsPerSample == 24)
- {
- int tmp = clamp<int>(s, -1 << 23, (1 << 23) - 1);
- memcpy(&pDataOut[i*3], &tmp, 3);
- }
- else if(fPCM && wfe->wBitsPerSample == 32)((int*)pDataOut)[i] = clamp<int>(s, INT_MIN, INT_MAX);
- else if(fFloat && wfe->wBitsPerSample == 32)((float*)pDataOut)[i] = clamp<float>(s, -1, +1);
- else if(fFloat && wfe->wBitsPerSample == 64)((double*)pDataOut)[i] = clamp<double>(s, -1, +1);
- }
-
- delete buff;
- }
- }
-
- pOut->SetActualDataLength(lenout * bps * wfeout->nChannels);
-
- return S_OK;
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
+ if(!pInPin || !pOutPin)
+ return __super::Transform(pIn, pOut);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
+ WAVEFORMATEX* wfeout = (WAVEFORMATEX*)pOutPin->CurrentMediaType().pbFormat;
+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
+ WAVEFORMATEXTENSIBLE* wfexout = (WAVEFORMATEXTENSIBLE*)wfeout;
+
+ int bps = wfe->wBitsPerSample>>3;
+
+ int len = pIn->GetActualDataLength() / (bps*wfe->nChannels);
+ int lenout = (UINT64)len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
+
+ REFERENCE_TIME rtStart, rtStop;
+ if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
+ {
+ rtStart += m_rtAudioTimeShift;
+ rtStop += m_rtAudioTimeShift;
+ pOut->SetTime(&rtStart, &rtStop);
+
+ m_rtNextStart = rtStart;
+ m_rtNextStop = rtStop;
+ }
+ else
+ {
+ pOut->SetTime(&m_rtNextStart, &m_rtNextStop);
+ }
+
+ REFERENCE_TIME rtDur = 10000000i64*len/wfe->nSamplesPerSec;
+
+ m_rtNextStart += rtDur;
+ m_rtNextStop += rtDur;
+
+ if(pIn->IsDiscontinuity() == S_OK)
+ {
+ m_sample_max = 0.1f;
+ }
+
+ WORD tag = wfe->wFormatTag;
+ bool fPCM = tag == WAVE_FORMAT_PCM || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM;
+ bool fFloat = tag == WAVE_FORMAT_IEEE_FLOAT || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+ if(!fPCM && !fFloat) return __super::Transform(pIn, pOut);
+
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
+
+ HRESULT hr;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut))) return hr;
+
+ if(!pDataIn || !pDataOut || len < 0 || lenout < 0) return S_FALSE;
+ // len = 0 doesn't mean it's failed, return S_OK otherwise might skrew the sound
+ if(len == 0) {pOut->SetActualDataLength(0); return S_OK;}
+
+ memset(pDataOut, 0, pOut->GetSize());
+
+ if(m_fCustomChannelMapping)
+ {
+ if(m_chs[wfe->nChannels-1].GetCount() > 0)
+ {
+ for(int i = 0; i < wfeout->nChannels; i++)
+ {
+ DWORD mask = m_chs[wfe->nChannels-1][i].Channel;
+
+ BYTE* src = pDataIn;
+ BYTE* dst = &pDataOut[bps*i];
+
+ int srcstep = bps*wfe->nChannels;
+ int dststep = bps*wfeout->nChannels;
+
+ if(fPCM && wfe->wBitsPerSample == 8)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<unsigned char, INT64, 0, UCHAR_MAX>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fPCM && wfe->wBitsPerSample == 16)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<short, INT64, SHRT_MIN, SHRT_MAX>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fPCM && wfe->wBitsPerSample == 24)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<int, INT64, (-1<<24), (+1<<24)-1>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fPCM && wfe->wBitsPerSample == 32)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<int, __int64, INT_MIN, INT_MAX>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fFloat && wfe->wBitsPerSample == 32)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<float, double, -1, 1>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fFloat && wfe->wBitsPerSample == 64)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<double, double, -1, 1>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ }
+ }
+ else
+ {
+ BYTE* pDataOut = NULL;
+ HRESULT hr;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) return hr;
+ memset(pDataOut, 0, pOut->GetSize());
+ }
+ }
+ else
+ {
+ HRESULT hr;
+ if(S_OK != (hr = __super::Transform(pIn, pOut)))
+ return hr;
+ }
+
+ if(m_fDownSampleTo441
+ && wfe->nSamplesPerSec > 44100 && wfeout->nSamplesPerSec == 44100
+ && wfe->wBitsPerSample <= 16 && fPCM)
+ {
+ if(BYTE* buff = DNew BYTE[len*bps])
+ {
+ for(int ch = 0; ch < wfeout->nChannels; ch++)
+ {
+ memset(buff, 0, len*bps);
+
+ for(int i = 0; i < len; i++)
+ memcpy(buff + i*bps, (char*)pDataOut + (ch + i*wfeout->nChannels)*bps, bps);
+
+ m_pResamplers[ch]->Downsample(buff, len, buff, lenout);
+
+ for(int i = 0; i < lenout; i++)
+ memcpy((char*)pDataOut + (ch + i*wfeout->nChannels)*bps, buff + i*bps, bps);
+ }
+
+ delete [] buff;
+ }
+ }
+
+ if(m_fNormalize || m_boost > 1)
+ {
+ int samples = lenout*wfeout->nChannels;
+
+ if(double* buff = DNew double[samples])
+ {
+ for(int i = 0; i < samples; i++)
+ {
+ if(fPCM && wfe->wBitsPerSample == 8) buff[i] = (double)((BYTE*)pDataOut)[i] / UCHAR_MAX;
+ else if(fPCM && wfe->wBitsPerSample == 16) buff[i] = (double)((short*)pDataOut)[i] / SHRT_MAX;
+ else if(fPCM && wfe->wBitsPerSample == 24) {int tmp; memcpy(((BYTE*)&tmp)+1, &pDataOut[i*3], 3); buff[i] = (float)(tmp >> 8) / ((1<<23)-1);}
+ else if(fPCM && wfe->wBitsPerSample == 32) buff[i] = (double)((int*)pDataOut)[i] / INT_MAX;
+ else if(fFloat && wfe->wBitsPerSample == 32) buff[i] = (double)((float*)pDataOut)[i];
+ else if(fFloat && wfe->wBitsPerSample == 64) buff[i] = ((double*)pDataOut)[i];
+ }
+
+ double sample_mul = 1;
+
+ if(m_fNormalize)
+ {
+ for(int i = 0; i < samples; i++)
+ {
+ double s = buff[i];
+ if(s < 0) s = -s;
+ if(s > 1) s = 1;
+ if(m_sample_max < s) m_sample_max = s;
+ }
+
+ sample_mul = 1.0f / m_sample_max;
+
+ if(m_fNormalizeRecover) m_sample_max -= 1.0*rtDur/200000000; // -5%/sec
+ if(m_sample_max < 0.1) m_sample_max = 0.1;
+ }
+
+ if(m_boost > 1)
+ {
+ sample_mul *= (1+log10(m_boost));
+ }
+
+ for(int i = 0; i < samples; i++)
+ {
+ double s = buff[i] * sample_mul;
+
+ if(fPCM && wfe->wBitsPerSample == 8) ((BYTE*)pDataOut)[i] = clamp<BYTE>(s, 0, UCHAR_MAX);
+ else if(fPCM && wfe->wBitsPerSample == 16) ((short*)pDataOut)[i] = clamp<short>(s, SHRT_MIN, SHRT_MAX);
+ else if(fPCM && wfe->wBitsPerSample == 24) {int tmp = clamp<int>(s, -1<<23, (1<<23)-1); memcpy(&pDataOut[i*3], &tmp, 3);}
+ else if(fPCM && wfe->wBitsPerSample == 32) ((int*)pDataOut)[i] = clamp<int>(s, INT_MIN, INT_MAX);
+ else if(fFloat && wfe->wBitsPerSample == 32) ((float*)pDataOut)[i] = clamp<float>(s, -1, +1);
+ else if(fFloat && wfe->wBitsPerSample == 64) ((double*)pDataOut)[i] = clamp<double>(s, -1, +1);
+ }
+
+ delete buff;
+ }
+ }
+
+ pOut->SetActualDataLength(lenout*bps*wfeout->nChannels);
+
+ return S_OK;
}
CMediaType CAudioSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& cbBuffer)
{
- CStreamSwitcherInputPin* pInPin = GetInputPin();
- CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
- if(!pInPin || !pOutPin || ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF)
- return __super::CreateNewOutputMediaType(mt, cbBuffer);
-
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
-
- if(m_fCustomChannelMapping)
- {
- m_chs[wfe->nChannels-1].RemoveAll();
-
- DWORD mask = DWORD((__int64(1) << wfe->nChannels) - 1);
- for(int i = 0; i < 18; i++)
- {
- if(m_pSpeakerToChannelMap[wfe->nChannels-1][i]&mask)
- {
- ChMap cm = {1 << i, m_pSpeakerToChannelMap[wfe->nChannels-1][i]};
- m_chs[wfe->nChannels-1].Add(cm);
- }
- }
-
- if(m_chs[wfe->nChannels-1].GetCount() > 0)
- {
- mt.ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
- WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)mt.pbFormat;
- wfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
- wfex->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- wfex->Samples.wValidBitsPerSample = wfe->wBitsPerSample;
- wfex->SubFormat =
- wfe->wFormatTag == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM :
- wfe->wFormatTag == WAVE_FORMAT_IEEE_FLOAT ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT :
- wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE ? ((WAVEFORMATEXTENSIBLE*)wfe)->SubFormat :
- KSDATAFORMAT_SUBTYPE_PCM; // can't happen
-
- wfex->dwChannelMask = 0;
- for(int i = 0; i < m_chs[wfe->nChannels-1].GetCount(); i++)
- wfex->dwChannelMask |= m_chs[wfe->nChannels-1][i].Speaker;
-
- wfex->Format.nChannels = (WORD)m_chs[wfe->nChannels-1].GetCount();
- wfex->Format.nBlockAlign = wfex->Format.nChannels * wfex->Format.wBitsPerSample >> 3;
- wfex->Format.nAvgBytesPerSec = wfex->Format.nBlockAlign * wfex->Format.nSamplesPerSec;
- }
- }
-
- WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mt.pbFormat;
-
- if(m_fDownSampleTo441)
- {
- if(wfeout->nSamplesPerSec > 44100 && wfeout->wBitsPerSample <= 16)
- {
- wfeout->nSamplesPerSec = 44100;
- wfeout->nAvgBytesPerSec = wfeout->nBlockAlign * wfeout->nSamplesPerSec;
- }
- }
-
- int bps = wfe->wBitsPerSample >> 3;
- int len = cbBuffer / (bps * wfe->nChannels);
- int lenout = len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
- cbBuffer = lenout * bps * wfeout->nChannels;
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
+ if(!pInPin || !pOutPin || ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF)
+ return __super::CreateNewOutputMediaType(mt, cbBuffer);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
+
+ if(m_fCustomChannelMapping)
+ {
+ m_chs[wfe->nChannels-1].RemoveAll();
+
+ DWORD mask = DWORD((__int64(1)<<wfe->nChannels)-1);
+ for(int i = 0; i < 18; i++)
+ {
+ if(m_pSpeakerToChannelMap[wfe->nChannels-1][i]&mask)
+ {
+ ChMap cm = {1<<i, m_pSpeakerToChannelMap[wfe->nChannels-1][i]};
+ m_chs[wfe->nChannels-1].Add(cm);
+ }
+ }
+
+ if(m_chs[wfe->nChannels-1].GetCount() > 0)
+ {
+ mt.ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)mt.pbFormat;
+ wfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+ wfex->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfex->Samples.wValidBitsPerSample = wfe->wBitsPerSample;
+ wfex->SubFormat =
+ wfe->wFormatTag == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM :
+ wfe->wFormatTag == WAVE_FORMAT_IEEE_FLOAT ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT :
+ wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE ? ((WAVEFORMATEXTENSIBLE*)wfe)->SubFormat :
+ KSDATAFORMAT_SUBTYPE_PCM; // can't happen
+
+ wfex->dwChannelMask = 0;
+ for(int i = 0; i < m_chs[wfe->nChannels-1].GetCount(); i++)
+ wfex->dwChannelMask |= m_chs[wfe->nChannels-1][i].Speaker;
+
+ wfex->Format.nChannels = (WORD)m_chs[wfe->nChannels-1].GetCount();
+ wfex->Format.nBlockAlign = wfex->Format.nChannels*wfex->Format.wBitsPerSample>>3;
+ wfex->Format.nAvgBytesPerSec = wfex->Format.nBlockAlign*wfex->Format.nSamplesPerSec;
+ }
+ }
+
+ WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mt.pbFormat;
+
+ if(m_fDownSampleTo441)
+ {
+ if(wfeout->nSamplesPerSec > 44100 && wfeout->wBitsPerSample <= 16)
+ {
+ wfeout->nSamplesPerSec = 44100;
+ wfeout->nAvgBytesPerSec = wfeout->nBlockAlign*wfeout->nSamplesPerSec;
+ }
+ }
+
+ int bps = wfe->wBitsPerSample>>3;
+ int len = cbBuffer / (bps*wfe->nChannels);
+ int lenout = len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
+ cbBuffer = lenout*bps*wfeout->nChannels;
// mt.lSampleSize = (ULONG)max(mt.lSampleSize, wfe->nAvgBytesPerSec * rtLen / 10000000i64);
// mt.lSampleSize = (mt.lSampleSize + (wfe->nBlockAlign-1)) & ~(wfe->nBlockAlign-1);
- return mt;
+ return mt;
}
void CAudioSwitcherFilter::OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut)
{
- const WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn.pbFormat;
- const WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mtOut.pbFormat;
-
- m_pResamplers.RemoveAll();
- for(int i = 0; i < wfeout->nChannels; i++)
- {
- CAutoPtr<AudioStreamResampler> pResampler;
- pResampler.Attach(DNew AudioStreamResampler(wfeout->wBitsPerSample >> 3, wfe->nSamplesPerSec, wfeout->nSamplesPerSec, true));
- m_pResamplers.Add(pResampler);
- }
-
- TRACE(_T("CAudioSwitcherFilter::OnNewOutputMediaType\n"));
- m_sample_max = 0.1f;
+ const WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn.pbFormat;
+ const WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mtOut.pbFormat;
+
+ m_pResamplers.RemoveAll();
+ for(int i = 0; i < wfeout->nChannels; i++)
+ {
+ CAutoPtr<AudioStreamResampler> pResampler;
+ pResampler.Attach(DNew AudioStreamResampler(wfeout->wBitsPerSample>>3, wfe->nSamplesPerSec, wfeout->nSamplesPerSec, true));
+ m_pResamplers.Add(pResampler);
+ }
+
+ TRACE(_T("CAudioSwitcherFilter::OnNewOutputMediaType\n"));
+ m_sample_max = 0.1f;
}
HRESULT CAudioSwitcherFilter::DeliverEndFlush()
{
- TRACE(_T("CAudioSwitcherFilter::DeliverEndFlush\n"));
- m_sample_max = 0.1f;
- return __super::DeliverEndFlush();
+ TRACE(_T("CAudioSwitcherFilter::DeliverEndFlush\n"));
+ m_sample_max = 0.1f;
+ return __super::DeliverEndFlush();
}
HRESULT CAudioSwitcherFilter::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- TRACE(_T("CAudioSwitcherFilter::DeliverNewSegment\n"));
- m_sample_max = 0.1f;
- return __super::DeliverNewSegment(tStart, tStop, dRate);
+ TRACE(_T("CAudioSwitcherFilter::DeliverNewSegment\n"));
+ m_sample_max = 0.1f;
+ return __super::DeliverNewSegment(tStart, tStop, dRate);
}
// IAudioSwitcherFilter
STDMETHODIMP CAudioSwitcherFilter::GetInputSpeakerConfig(DWORD* pdwChannelMask)
{
- if(!pdwChannelMask)
- return E_POINTER;
+ if(!pdwChannelMask)
+ return E_POINTER;
- *pdwChannelMask = 0;
+ *pdwChannelMask = 0;
- CStreamSwitcherInputPin* pInPin = GetInputPin();
- if(!pInPin || !pInPin->IsConnected())
- return E_UNEXPECTED;
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ if(!pInPin || !pInPin->IsConnected())
+ return E_UNEXPECTED;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
- if(wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
- {
- WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
- *pdwChannelMask = wfex->dwChannelMask;
- }
- else
- {
- *pdwChannelMask = 0/*wfe->nChannels == 1 ? 4 : wfe->nChannels == 2 ? 3 : 0*/;
- }
+ if(wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ {
+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
+ *pdwChannelMask = wfex->dwChannelMask;
+ }
+ else
+ {
+ *pdwChannelMask = 0/*wfe->nChannels == 1 ? 4 : wfe->nChannels == 2 ? 3 : 0*/;
+ }
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CAudioSwitcherFilter::GetSpeakerConfig(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18])
{
- if(pfCustomChannelMapping) *pfCustomChannelMapping = m_fCustomChannelMapping;
- memcpy(pSpeakerToChannelMap, m_pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
+ if(pfCustomChannelMapping) *pfCustomChannelMapping = m_fCustomChannelMapping;
+ memcpy(pSpeakerToChannelMap, m_pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CAudioSwitcherFilter::SetSpeakerConfig(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18])
{
- if(m_State == State_Stopped || m_fCustomChannelMapping != fCustomChannelMapping
- || memcmp(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap)))
- {
- PauseGraph;
-
- CStreamSwitcherInputPin* pInput = GetInputPin();
+ if(m_State == State_Stopped || m_fCustomChannelMapping != fCustomChannelMapping
+ || memcmp(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap)))
+ {
+ PauseGraph;
+
+ CStreamSwitcherInputPin* pInput = GetInputPin();
- SelectInput(NULL);
+ SelectInput(NULL);
- m_fCustomChannelMapping = fCustomChannelMapping;
- memcpy(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
+ m_fCustomChannelMapping = fCustomChannelMapping;
+ memcpy(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
- SelectInput(pInput);
+ SelectInput(pInput);
- ResumeGraph;
- }
+ ResumeGraph;
+ }
- return S_OK;
+ return S_OK;
}
STDMETHODIMP_(int) CAudioSwitcherFilter::GetNumberOfInputChannels()
{
- CStreamSwitcherInputPin* pInPin = GetInputPin();
- return pInPin ? ((WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat)->nChannels : 0;
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ return pInPin ? ((WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat)->nChannels : 0;
}
STDMETHODIMP_(bool) CAudioSwitcherFilter::IsDownSamplingTo441Enabled()
{
- return m_fDownSampleTo441;
+ return m_fDownSampleTo441;
}
STDMETHODIMP CAudioSwitcherFilter::EnableDownSamplingTo441(bool fEnable)
{
- if(m_fDownSampleTo441 != fEnable)
- {
- PauseGraph;
- m_fDownSampleTo441 = fEnable;
- ResumeGraph;
- }
-
- return S_OK;
+ if(m_fDownSampleTo441 != fEnable)
+ {
+ PauseGraph;
+ m_fDownSampleTo441 = fEnable;
+ ResumeGraph;
+ }
+
+ return S_OK;
}
STDMETHODIMP_(REFERENCE_TIME) CAudioSwitcherFilter::GetAudioTimeShift()
{
- return m_rtAudioTimeShift;
+ return m_rtAudioTimeShift;
}
STDMETHODIMP CAudioSwitcherFilter::SetAudioTimeShift(REFERENCE_TIME rtAudioTimeShift)
{
- m_rtAudioTimeShift = rtAudioTimeShift;
- return S_OK;
+ m_rtAudioTimeShift = rtAudioTimeShift;
+ return S_OK;
}
STDMETHODIMP CAudioSwitcherFilter::GetNormalizeBoost(bool& fNormalize, bool& fNormalizeRecover, float& boost)
{
- fNormalize = m_fNormalize;
- fNormalizeRecover = m_fNormalizeRecover;
- boost = m_boost;
- return S_OK;
+ fNormalize = m_fNormalize;
+ fNormalizeRecover = m_fNormalizeRecover;
+ boost = m_boost;
+ return S_OK;
}
STDMETHODIMP CAudioSwitcherFilter::SetNormalizeBoost(bool fNormalize, bool fNormalizeRecover, float boost)
{
- if(m_fNormalize != fNormalize) m_sample_max = 0.1f;
- m_fNormalize = fNormalize;
- m_fNormalizeRecover = fNormalizeRecover;
- m_boost = boost;
- return S_OK;
+ if(m_fNormalize != fNormalize) m_sample_max = 0.1f;
+ m_fNormalize = fNormalize;
+ m_fNormalizeRecover = fNormalizeRecover;
+ m_boost = boost;
+ return S_OK;
}
// IAMStreamSelect
STDMETHODIMP CAudioSwitcherFilter::Enable(long lIndex, DWORD dwFlags)
{
- HRESULT hr = __super::Enable(lIndex, dwFlags);
- if(S_OK == hr) m_sample_max = 0.1f;
- return hr;
+ HRESULT hr = __super::Enable(lIndex, dwFlags);
+ if(S_OK == hr) m_sample_max = 0.1f;
+ return hr;
}
diff --git a/src/filters/switcher/AudioSwitcher/AudioSwitcher.h b/src/filters/switcher/AudioSwitcher/AudioSwitcher.h
index f89976729..bef3a11c8 100644
--- a/src/filters/switcher/AudioSwitcher/AudioSwitcher.h
+++ b/src/filters/switcher/AudioSwitcher/AudioSwitcher.h
@@ -21,19 +21,18 @@
#include "StreamSwitcher.h"
[uuid("CEDB2890-53AE-4231-91A3-B0AAFCD1DBDE")]
-interface IAudioSwitcherFilter :
-public IUnknown
+interface IAudioSwitcherFilter : public IUnknown
{
- STDMETHOD(GetInputSpeakerConfig)(DWORD* pdwChannelMask) = 0;
- STDMETHOD(GetSpeakerConfig)(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
- STDMETHOD(SetSpeakerConfig)(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
- STDMETHOD_(int, GetNumberOfInputChannels)() = 0;
- STDMETHOD_(bool, IsDownSamplingTo441Enabled)() = 0;
- STDMETHOD(EnableDownSamplingTo441)(bool fEnable) = 0;
- STDMETHOD_(REFERENCE_TIME, GetAudioTimeShift)() = 0;
- STDMETHOD(SetAudioTimeShift)(REFERENCE_TIME rtAudioTimeShift) = 0;
- STDMETHOD(GetNormalizeBoost)(bool& fNormalize, bool& fNormalizeRecover, float& boost) = 0;
- STDMETHOD(SetNormalizeBoost)(bool fNormalize, bool fNormalizeRecover, float boost) = 0;
+ STDMETHOD(GetInputSpeakerConfig) (DWORD* pdwChannelMask) = 0;
+ STDMETHOD(GetSpeakerConfig) (bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
+ STDMETHOD(SetSpeakerConfig) (bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
+ STDMETHOD_(int, GetNumberOfInputChannels) () = 0;
+ STDMETHOD_(bool, IsDownSamplingTo441Enabled) () = 0;
+ STDMETHOD(EnableDownSamplingTo441) (bool fEnable) = 0;
+ STDMETHOD_(REFERENCE_TIME, GetAudioTimeShift) () = 0;
+ STDMETHOD(SetAudioTimeShift) (REFERENCE_TIME rtAudioTimeShift) = 0;
+ STDMETHOD(GetNormalizeBoost) (bool& fNormalize, bool& fNormalizeRecover, float& boost) = 0;
+ STDMETHOD(SetNormalizeBoost) (bool fNormalize, bool fNormalizeRecover, float boost) = 0;
};
class AudioStreamResampler;
@@ -41,49 +40,46 @@ class AudioStreamResampler;
[uuid("18C16B08-6497-420e-AD14-22D21C2CEAB7")]
class CAudioSwitcherFilter : public CStreamSwitcherFilter, public IAudioSwitcherFilter
{
- typedef struct
- {
- DWORD Speaker, Channel;
- } ChMap;
- CAtlArray<ChMap> m_chs[18];
+ typedef struct {DWORD Speaker, Channel;} ChMap;
+ CAtlArray<ChMap> m_chs[18];
- bool m_fCustomChannelMapping;
- DWORD m_pSpeakerToChannelMap[18][18];
- bool m_fDownSampleTo441;
- REFERENCE_TIME m_rtAudioTimeShift;
- CAutoPtrArray<AudioStreamResampler> m_pResamplers;
- double m_sample_max;
- bool m_fNormalize, m_fNormalizeRecover;
- float m_boost;
+ bool m_fCustomChannelMapping;
+ DWORD m_pSpeakerToChannelMap[18][18];
+ bool m_fDownSampleTo441;
+ REFERENCE_TIME m_rtAudioTimeShift;
+ CAutoPtrArray<AudioStreamResampler> m_pResamplers;
+ double m_sample_max;
+ bool m_fNormalize, m_fNormalizeRecover;
+ float m_boost;
- REFERENCE_TIME m_rtNextStart, m_rtNextStop;
+ REFERENCE_TIME m_rtNextStart, m_rtNextStop;
public:
- CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT CheckMediaType(const CMediaType* pmt);
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
- void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
+ void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut);
- HRESULT DeliverEndFlush();
- HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- // IAudioSwitcherFilter
- STDMETHODIMP GetInputSpeakerConfig(DWORD* pdwChannelMask);
+ // IAudioSwitcherFilter
+ STDMETHODIMP GetInputSpeakerConfig(DWORD* pdwChannelMask);
STDMETHODIMP GetSpeakerConfig(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]);
STDMETHODIMP SetSpeakerConfig(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]);
STDMETHODIMP_(int) GetNumberOfInputChannels();
- STDMETHODIMP_(bool) IsDownSamplingTo441Enabled();
- STDMETHODIMP EnableDownSamplingTo441(bool fEnable);
- STDMETHODIMP_(REFERENCE_TIME) GetAudioTimeShift();
- STDMETHODIMP SetAudioTimeShift(REFERENCE_TIME rtAudioTimeShift);
- STDMETHODIMP GetNormalizeBoost(bool& fNormalize, bool& fNormalizeRecover, float& boost);
- STDMETHODIMP SetNormalizeBoost(bool fNormalize, bool fNormalizeRecover, float boost);
+ STDMETHODIMP_(bool) IsDownSamplingTo441Enabled();
+ STDMETHODIMP EnableDownSamplingTo441(bool fEnable);
+ STDMETHODIMP_(REFERENCE_TIME) GetAudioTimeShift();
+ STDMETHODIMP SetAudioTimeShift(REFERENCE_TIME rtAudioTimeShift);
+ STDMETHODIMP GetNormalizeBoost(bool& fNormalize, bool& fNormalizeRecover, float& boost);
+ STDMETHODIMP SetNormalizeBoost(bool fNormalize, bool fNormalizeRecover, float boost);
- // IAMStreamSelect
- STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+ // IAMStreamSelect
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
};
diff --git a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
index e9d734fb0..b949290eb 100644
--- a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
+++ b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
@@ -38,8 +38,8 @@
//
CStreamSwitcherPassThru::CStreamSwitcherPassThru(LPUNKNOWN pUnk, HRESULT* phr, CStreamSwitcherFilter* pFilter)
- : CMediaPosition(NAME("CStreamSwitcherPassThru"), pUnk)
- , m_pFilter(pFilter)
+ : CMediaPosition(NAME("CStreamSwitcherPassThru"), pUnk)
+ , m_pFilter(pFilter)
{
}
@@ -48,9 +48,9 @@ STDMETHODIMP CStreamSwitcherPassThru::NonDelegatingQueryInterface(REFIID riid, v
CheckPointer(ppv, E_POINTER);
*ppv = NULL;
- return
- QI(IMediaSeeking)
- CMediaPosition::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IMediaSeeking)
+ CMediaPosition::NonDelegatingQueryInterface(riid, ppv);
}
template<class T>
@@ -58,32 +58,32 @@ HRESULT GetPeer(CStreamSwitcherFilter* pFilter, T** ppT)
{
*ppT = NULL;
- CBasePin* pPin = pFilter->GetInputPin();
- if(!pPin) return E_NOTIMPL;
+ CBasePin* pPin = pFilter->GetInputPin();
+ if(!pPin) return E_NOTIMPL;
CComPtr<IPin> pConnected;
- if(FAILED(pPin->ConnectedTo(&pConnected)))
- return E_NOTIMPL;
+ if(FAILED(pPin->ConnectedTo(&pConnected)))
+ return E_NOTIMPL;
- if(CComQIPtr<T> pT = pConnected)
- {
- *ppT = pT.Detach();
- return S_OK;
- }
+ if(CComQIPtr<T> pT = pConnected)
+ {
+ *ppT = pT.Detach();
+ return S_OK;
+ }
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
#define CallPeerSeeking(call) \
CComPtr<IMediaSeeking> pMS; \
if(FAILED(GetPeer(m_pFilter, &pMS))) return E_NOTIMPL; \
return pMS->##call; \
-
+
#define CallPeer(call) \
CComPtr<IMediaPosition> pMP; \
if(FAILED(GetPeer(m_pFilter, &pMP))) return E_NOTIMPL; \
return pMP->##call; \
-
+
#define CallPeerSeekingAll(call) \
HRESULT hr = E_NOTIMPL; \
POSITION pos = m_pFilter->m_pInputs.GetHeadPosition(); \
@@ -101,7 +101,7 @@ HRESULT GetPeer(CStreamSwitcherFilter* pFilter, T** ppT)
} \
} \
return hr; \
-
+
#define CallPeerAll(call) \
HRESULT hr = E_NOTIMPL; \
POSITION pos = m_pFilter->m_pInputs.GetHeadPosition(); \
@@ -119,139 +119,83 @@ HRESULT GetPeer(CStreamSwitcherFilter* pFilter, T** ppT)
} \
} \
return hr; \
-
+
// IMediaSeeking
STDMETHODIMP CStreamSwitcherPassThru::GetCapabilities(DWORD* pCaps)
-{
- CallPeerSeeking(GetCapabilities(pCaps));
-}
+ {CallPeerSeeking(GetCapabilities(pCaps));}
STDMETHODIMP CStreamSwitcherPassThru::CheckCapabilities(DWORD* pCaps)
-{
- CallPeerSeeking(CheckCapabilities(pCaps));
-}
+ {CallPeerSeeking(CheckCapabilities(pCaps));}
STDMETHODIMP CStreamSwitcherPassThru::IsFormatSupported(const GUID* pFormat)
-{
- CallPeerSeeking(IsFormatSupported(pFormat));
-}
+ {CallPeerSeeking(IsFormatSupported(pFormat));}
STDMETHODIMP CStreamSwitcherPassThru::QueryPreferredFormat(GUID* pFormat)
-{
- CallPeerSeeking(QueryPreferredFormat(pFormat));
-}
+ {CallPeerSeeking(QueryPreferredFormat(pFormat));}
STDMETHODIMP CStreamSwitcherPassThru::SetTimeFormat(const GUID* pFormat)
-{
- CallPeerSeeking(SetTimeFormat(pFormat));
-}
+ {CallPeerSeeking(SetTimeFormat(pFormat));}
STDMETHODIMP CStreamSwitcherPassThru::GetTimeFormat(GUID* pFormat)
-{
- CallPeerSeeking(GetTimeFormat(pFormat));
-}
+ {CallPeerSeeking(GetTimeFormat(pFormat));}
STDMETHODIMP CStreamSwitcherPassThru::IsUsingTimeFormat(const GUID* pFormat)
-{
- CallPeerSeeking(IsUsingTimeFormat(pFormat));
-}
+ {CallPeerSeeking(IsUsingTimeFormat(pFormat));}
STDMETHODIMP CStreamSwitcherPassThru::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
-{
- CallPeerSeeking(ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat));
-}
+ {CallPeerSeeking(ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat));}
STDMETHODIMP CStreamSwitcherPassThru::SetPositions(LONGLONG* pCurrent, DWORD CurrentFlags, LONGLONG* pStop, DWORD StopFlags)
-{
- CallPeerSeekingAll(SetPositions(pCurrent, CurrentFlags, pStop, StopFlags));
-}
+ {CallPeerSeekingAll(SetPositions(pCurrent, CurrentFlags, pStop, StopFlags));}
STDMETHODIMP CStreamSwitcherPassThru::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
-{
- CallPeerSeeking(GetPositions(pCurrent, pStop));
-}
+ {CallPeerSeeking(GetPositions(pCurrent, pStop));}
STDMETHODIMP CStreamSwitcherPassThru::GetCurrentPosition(LONGLONG* pCurrent)
-{
- CallPeerSeeking(GetCurrentPosition(pCurrent));
-}
+ {CallPeerSeeking(GetCurrentPosition(pCurrent));}
STDMETHODIMP CStreamSwitcherPassThru::GetStopPosition(LONGLONG* pStop)
-{
- CallPeerSeeking(GetStopPosition(pStop));
-}
+ {CallPeerSeeking(GetStopPosition(pStop));}
STDMETHODIMP CStreamSwitcherPassThru::GetDuration(LONGLONG* pDuration)
-{
- CallPeerSeeking(GetDuration(pDuration));
-}
+ {CallPeerSeeking(GetDuration(pDuration));}
STDMETHODIMP CStreamSwitcherPassThru::GetPreroll(LONGLONG* pllPreroll)
-{
- CallPeerSeeking(GetPreroll(pllPreroll));
-}
+ {CallPeerSeeking(GetPreroll(pllPreroll));}
STDMETHODIMP CStreamSwitcherPassThru::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
-{
- CallPeerSeeking(GetAvailable(pEarliest, pLatest));
-}
+ {CallPeerSeeking(GetAvailable(pEarliest, pLatest));}
STDMETHODIMP CStreamSwitcherPassThru::GetRate(double* pdRate)
-{
- CallPeerSeeking(GetRate(pdRate));
-}
+ {CallPeerSeeking(GetRate(pdRate));}
STDMETHODIMP CStreamSwitcherPassThru::SetRate(double dRate)
-{
- if(0.0 == dRate) return E_INVALIDARG;
- CallPeerSeekingAll(SetRate(dRate));
-}
+ {if(0.0 == dRate) return E_INVALIDARG;
+ CallPeerSeekingAll(SetRate(dRate));}
// IMediaPosition
STDMETHODIMP CStreamSwitcherPassThru::get_Duration(REFTIME* plength)
-{
- CallPeer(get_Duration(plength));
-}
+ {CallPeer(get_Duration(plength));}
STDMETHODIMP CStreamSwitcherPassThru::get_CurrentPosition(REFTIME* pllTime)
-{
- CallPeer(get_CurrentPosition(pllTime));
-}
+ {CallPeer(get_CurrentPosition(pllTime));}
STDMETHODIMP CStreamSwitcherPassThru::put_CurrentPosition(REFTIME llTime)
-{
- CallPeerAll(put_CurrentPosition(llTime));
-}
+ {CallPeerAll(put_CurrentPosition(llTime));}
STDMETHODIMP CStreamSwitcherPassThru::get_StopTime(REFTIME* pllTime)
-{
- CallPeer(get_StopTime(pllTime));
-}
+ {CallPeer(get_StopTime(pllTime));}
STDMETHODIMP CStreamSwitcherPassThru::put_StopTime(REFTIME llTime)
-{
- CallPeerAll(put_StopTime(llTime));
-}
+ {CallPeerAll(put_StopTime(llTime));}
STDMETHODIMP CStreamSwitcherPassThru::get_PrerollTime(REFTIME * pllTime)
-{
- CallPeer(get_PrerollTime(pllTime));
-}
+ {CallPeer(get_PrerollTime(pllTime));}
STDMETHODIMP CStreamSwitcherPassThru::put_PrerollTime(REFTIME llTime)
-{
- CallPeerAll(put_PrerollTime(llTime));
-}
+ {CallPeerAll(put_PrerollTime(llTime));}
STDMETHODIMP CStreamSwitcherPassThru::get_Rate(double* pdRate)
-{
- CallPeer(get_Rate(pdRate));
-}
+ {CallPeer(get_Rate(pdRate));}
STDMETHODIMP CStreamSwitcherPassThru::put_Rate(double dRate)
-{
- if(0.0 == dRate) return E_INVALIDARG;
- CallPeerAll(put_Rate(dRate));
-}
+ {if(0.0 == dRate) return E_INVALIDARG;
+ CallPeerAll(put_Rate(dRate));}
STDMETHODIMP CStreamSwitcherPassThru::CanSeekForward(LONG* pCanSeekForward)
-{
- CallPeer(CanSeekForward(pCanSeekForward));
-}
-STDMETHODIMP CStreamSwitcherPassThru::CanSeekBackward(LONG* pCanSeekBackward)
-{
- CallPeer(CanSeekBackward(pCanSeekBackward));
-}
+ {CallPeer(CanSeekForward(pCanSeekForward));}
+STDMETHODIMP CStreamSwitcherPassThru::CanSeekBackward(LONG* pCanSeekBackward)
+ {CallPeer(CanSeekBackward(pCanSeekBackward));}
//
// CStreamSwitcherAllocator
//
CStreamSwitcherAllocator::CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr)
- : CMemAllocator(NAME("CStreamSwitcherAllocator"), NULL, phr)
- , m_pPin(pPin)
- , m_fMediaTypeChanged(false)
+ : CMemAllocator(NAME("CStreamSwitcherAllocator"), NULL, phr)
+ , m_pPin(pPin)
+ , m_fMediaTypeChanged(false)
{
- ASSERT(phr);
- ASSERT(pPin);
+ ASSERT(phr);
+ ASSERT(pPin);
}
#ifdef DEBUG
@@ -263,69 +207,69 @@ CStreamSwitcherAllocator::~CStreamSwitcherAllocator()
STDMETHODIMP_(ULONG) CStreamSwitcherAllocator::NonDelegatingAddRef()
{
- return m_pPin->m_pFilter->AddRef();
+ return m_pPin->m_pFilter->AddRef();
}
STDMETHODIMP_(ULONG) CStreamSwitcherAllocator::NonDelegatingRelease()
{
- return m_pPin->m_pFilter->Release();
+ return m_pPin->m_pFilter->Release();
}
STDMETHODIMP CStreamSwitcherAllocator::GetBuffer(
- IMediaSample** ppBuffer,
- REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
- DWORD dwFlags)
+ IMediaSample** ppBuffer,
+ REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
+ DWORD dwFlags)
{
- HRESULT hr = VFW_E_NOT_COMMITTED;
+ HRESULT hr = VFW_E_NOT_COMMITTED;
- if(!m_bCommitted)
+ if(!m_bCommitted)
return hr;
- /*
- TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() + %x\n"), this);
- m_pPin->m_evBlock.Wait();
- TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() - %x\n"), this);
- */
- if(m_fMediaTypeChanged)
- {
- if(!m_pPin || !m_pPin->m_pFilter)
- return hr;
-
- CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pPin->m_pFilter))->GetOutputPin();
- if(!pOut || !pOut->CurrentAllocator())
- return hr;
-
- ALLOCATOR_PROPERTIES Properties, Actual;
- if(FAILED(pOut->CurrentAllocator()->GetProperties(&Actual)))
- return hr;
- if(FAILED(GetProperties(&Properties)))
- return hr;
-
- if(!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer)
- {
- Properties.cbBuffer = Actual.cbBuffer;
- if(FAILED(Decommit())) return hr;
- if(FAILED(SetProperties(&Properties, &Actual))) return hr;
- if(FAILED(Commit())) return hr;
- ASSERT(Actual.cbBuffer >= Properties.cbBuffer);
- if(Actual.cbBuffer < Properties.cbBuffer) return hr;
- }
- }
-
- hr = CMemAllocator::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
-
- if(m_fMediaTypeChanged && SUCCEEDED(hr))
- {
- (*ppBuffer)->SetMediaType(&m_mt);
- m_fMediaTypeChanged = false;
- }
-
- return hr;
+/*
+TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() + %x\n"), this);
+ m_pPin->m_evBlock.Wait();
+TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() - %x\n"), this);
+*/
+ if(m_fMediaTypeChanged)
+ {
+ if(!m_pPin || !m_pPin->m_pFilter)
+ return hr;
+
+ CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pPin->m_pFilter))->GetOutputPin();
+ if(!pOut || !pOut->CurrentAllocator())
+ return hr;
+
+ ALLOCATOR_PROPERTIES Properties, Actual;
+ if(FAILED(pOut->CurrentAllocator()->GetProperties(&Actual)))
+ return hr;
+ if(FAILED(GetProperties(&Properties)))
+ return hr;
+
+ if(!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer)
+ {
+ Properties.cbBuffer = Actual.cbBuffer;
+ if(FAILED(Decommit())) return hr;
+ if(FAILED(SetProperties(&Properties, &Actual))) return hr;
+ if(FAILED(Commit())) return hr;
+ ASSERT(Actual.cbBuffer >= Properties.cbBuffer);
+ if(Actual.cbBuffer < Properties.cbBuffer) return hr;
+ }
+ }
+
+ hr = CMemAllocator::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
+
+ if(m_fMediaTypeChanged && SUCCEEDED(hr))
+ {
+ (*ppBuffer)->SetMediaType(&m_mt);
+ m_fMediaTypeChanged = false;
+ }
+
+ return hr;
}
void CStreamSwitcherAllocator::NotifyMediaType(const CMediaType& mt)
{
- CopyMediaType(&m_mt, &mt);
- m_fMediaTypeChanged = true;
+ CopyMediaType(&m_mt, &mt);
+ m_fMediaTypeChanged = true;
}
@@ -335,15 +279,15 @@ void CStreamSwitcherAllocator::NotifyMediaType(const CMediaType& mt)
CStreamSwitcherInputPin::CStreamSwitcherInputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr, LPCWSTR pName)
: CBaseInputPin(NAME("CStreamSwitcherInputPin"), pFilter, &pFilter->m_csState, phr, pName)
- , m_Allocator(this, phr)
- , m_bSampleSkipped(FALSE)
- , m_bQualityChanged(FALSE)
- , m_bUsingOwnAllocator(FALSE)
- , m_evBlock(TRUE)
- , m_fCanBlock(false)
- , m_hNotifyEvent(NULL)
+ , m_Allocator(this, phr)
+ , m_bSampleSkipped(FALSE)
+ , m_bQualityChanged(FALSE)
+ , m_bUsingOwnAllocator(FALSE)
+ , m_evBlock(TRUE)
+ , m_fCanBlock(false)
+ , m_hNotifyEvent(NULL)
{
- m_bCanReconnectWhenActive = TRUE;
+ m_bCanReconnectWhenActive = TRUE;
}
[uuid("138130AF-A79B-45D5-B4AA-87697457BA87")]
@@ -351,104 +295,104 @@ class NeroAudioDecoder {};
STDMETHODIMP CStreamSwitcherInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IStreamSwitcherInputPin)
- IsConnected() && GetCLSID(GetFilterFromPin(GetConnected())) == __uuidof(NeroAudioDecoder) && QI(IPinConnection)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IStreamSwitcherInputPin)
+ IsConnected() && GetCLSID(GetFilterFromPin(GetConnected())) == __uuidof(NeroAudioDecoder) && QI(IPinConnection)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IPinConnection
STDMETHODIMP CStreamSwitcherInputPin::DynamicQueryAccept(const AM_MEDIA_TYPE* pmt)
{
- return QueryAccept(pmt);
+ return QueryAccept(pmt);
}
STDMETHODIMP CStreamSwitcherInputPin::NotifyEndOfStream(HANDLE hNotifyEvent)
{
- if(m_hNotifyEvent) SetEvent(m_hNotifyEvent);
- m_hNotifyEvent = hNotifyEvent;
- return S_OK;
+ if(m_hNotifyEvent) SetEvent(m_hNotifyEvent);
+ m_hNotifyEvent = hNotifyEvent;
+ return S_OK;
}
STDMETHODIMP CStreamSwitcherInputPin::IsEndPin()
{
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamSwitcherInputPin::DynamicDisconnect()
{
- CAutoLock cAutoLock(&m_csReceive);
- Disconnect();
- return S_OK;
+ CAutoLock cAutoLock(&m_csReceive);
+ Disconnect();
+ return S_OK;
}
// IStreamSwitcherInputPin
STDMETHODIMP_(bool) CStreamSwitcherInputPin::IsActive()
{
- // TODO: lock onto something here
- return(this == (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin());
+ // TODO: lock onto something here
+ return(this == (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin());
}
-//
+//
HRESULT CStreamSwitcherInputPin::QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt)
{
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
+ CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
- if(pOut && pOut->IsConnected())
- {
- if(CComPtr<IPinConnection> pPC = pOut->CurrentPinConnection())
- {
- hr = pPC->DynamicQueryAccept(pmt);
- if(hr == S_OK) return S_OK;
- }
+ if(pOut && pOut->IsConnected())
+ {
+ if(CComPtr<IPinConnection> pPC = pOut->CurrentPinConnection())
+ {
+ hr = pPC->DynamicQueryAccept(pmt);
+ if(hr == S_OK) return S_OK;
+ }
- hr = pOut->GetConnected()->QueryAccept(pmt);
- }
+ hr = pOut->GetConnected()->QueryAccept(pmt);
+ }
- return hr;
+ return hr;
}
void CStreamSwitcherInputPin::Block(bool fBlock)
{
- if(fBlock) m_evBlock.Reset();
- else m_evBlock.Set();
+ if(fBlock) m_evBlock.Reset();
+ else m_evBlock.Set();
}
HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample)
{
- if(!pInSample || !ppOutSample)
- return E_POINTER;
+ if(!pInSample || !ppOutSample)
+ return E_POINTER;
- CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
- ASSERT(pOut->GetConnected());
+ CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
+ ASSERT(pOut->GetConnected());
CComPtr<IMediaSample> pOutSample;
- DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0;
+ DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0;
if(!(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT))
- dwFlags |= AM_GBF_NOTASYNCPOINT;
+ dwFlags |= AM_GBF_NOTASYNCPOINT;
- HRESULT hr = pOut->GetDeliveryBuffer(&pOutSample
- , m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID ? &m_SampleProps.tStart : NULL
- , m_SampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID ? &m_SampleProps.tStop : NULL
- , dwFlags);
+ HRESULT hr = pOut->GetDeliveryBuffer(&pOutSample
+ , m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID ? &m_SampleProps.tStart : NULL
+ , m_SampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID ? &m_SampleProps.tStop : NULL
+ , dwFlags);
if(FAILED(hr))
- return hr;
+ return hr;
- if(!pOutSample)
- return E_FAIL;
+ if(!pOutSample)
+ return E_FAIL;
if(CComQIPtr<IMediaSample2> pOutSample2 = pOutSample)
- {
+ {
AM_SAMPLE2_PROPERTIES OutProps;
- EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)));
+ EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)));
OutProps.dwTypeSpecificFlags = m_SampleProps.dwTypeSpecificFlags;
OutProps.dwSampleFlags =
(OutProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED) |
@@ -460,157 +404,157 @@ HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample,
hr = pOutSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId), (PBYTE)&OutProps);
if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
- m_bSampleSkipped = FALSE;
+ m_bSampleSkipped = FALSE;
}
else
- {
+ {
if(m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID)
- pOutSample->SetTime(&m_SampleProps.tStart, &m_SampleProps.tStop);
+ pOutSample->SetTime(&m_SampleProps.tStart, &m_SampleProps.tStop);
- if(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT)
- pOutSample->SetSyncPoint(TRUE);
+ if(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT)
+ pOutSample->SetSyncPoint(TRUE);
- if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
- {
- pOutSample->SetDiscontinuity(TRUE);
+ if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
+ {
+ pOutSample->SetDiscontinuity(TRUE);
m_bSampleSkipped = FALSE;
}
- LONGLONG MediaStart, MediaEnd;
+ LONGLONG MediaStart, MediaEnd;
if(pInSample->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
- pOutSample->SetMediaTime(&MediaStart, &MediaEnd);
+ pOutSample->SetMediaTime(&MediaStart, &MediaEnd);
}
- *ppOutSample = pOutSample.Detach();
+ *ppOutSample = pOutSample.Detach();
- return S_OK;
+ return S_OK;
}
// pure virtual
HRESULT CStreamSwitcherInputPin::CheckMediaType(const CMediaType* pmt)
{
- return (static_cast<CStreamSwitcherFilter*>(m_pFilter))->CheckMediaType(pmt);
+ return (static_cast<CStreamSwitcherFilter*>(m_pFilter))->CheckMediaType(pmt);
}
-// virtual
+// virtual
HRESULT CStreamSwitcherInputPin::CheckConnect(IPin* pPin)
{
- return (IPin*)(static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin() == pPin
- ? E_FAIL
- : __super::CheckConnect(pPin);
+ return (IPin*)(static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin() == pPin
+ ? E_FAIL
+ : __super::CheckConnect(pPin);
}
HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin)
{
- HRESULT hr = __super::CompleteConnect(pReceivePin);
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::CompleteConnect(pReceivePin);
+ if(FAILED(hr)) return hr;
(static_cast<CStreamSwitcherFilter*>(m_pFilter))->CompleteConnect(PINDIR_INPUT, this, pReceivePin);
- m_fCanBlock = false;
- bool fForkedSomewhere = false;
+ m_fCanBlock = false;
+ bool fForkedSomewhere = false;
- CStringW fileName;
- CStringW pinName;
+ CStringW fileName;
+ CStringW pinName;
IPin* pPin = (IPin*)this;
- IBaseFilter* pBF = (IBaseFilter*)m_pFilter;
+ IBaseFilter* pBF = (IBaseFilter*)m_pFilter;
- while((pPin = GetUpStreamPin(pBF, pPin)) && (pBF = GetFilterFromPin(pPin)))
- {
- if(IsSplitter(pBF))
- {
- pinName = GetPinName(pPin);
- }
+ while((pPin = GetUpStreamPin(pBF, pPin)) && (pBF = GetFilterFromPin(pPin)))
+ {
+ if(IsSplitter(pBF))
+ {
+ pinName = GetPinName(pPin);
+ }
- CLSID clsid = GetCLSID(pBF);
- if(clsid == CLSID_AviSplitter || clsid == CLSID_OggSplitter)
- m_fCanBlock = true;
-
- int nIn, nOut, nInC, nOutC;
- CountPins(pBF, nIn, nOut, nInC, nOutC);
- fForkedSomewhere = fForkedSomewhere || nIn > 1 || nOut > 1;
-
- if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
- {
- WCHAR* pszName = NULL;
- AM_MEDIA_TYPE mt;
- if(SUCCEEDED(pFSF->GetCurFile(&pszName, &mt)) && pszName)
- {
- fileName = pszName;
- CoTaskMemFree(pszName);
-
- fileName.Replace('\\', '/');
- CStringW fn = fileName.Mid(fileName.ReverseFind('/') + 1);
- if(!fn.IsEmpty()) fileName = fn;
-
- if(!pinName.IsEmpty()) fileName += L" / " + pinName;
-
- WCHAR* pName = DNew WCHAR[fileName.GetLength()+1];
- if(pName)
- {
- wcscpy(pName, fileName);
- if(m_pName) delete [] m_pName;
- m_pName = pName;
- }
- }
-
- break;
- }
+ CLSID clsid = GetCLSID(pBF);
+ if(clsid == CLSID_AviSplitter || clsid == CLSID_OggSplitter)
+ m_fCanBlock = true;
- pPin = GetFirstPin(pBF);
- }
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+ fForkedSomewhere = fForkedSomewhere || nIn > 1 || nOut > 1;
+
+ if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
+ {
+ WCHAR* pszName = NULL;
+ AM_MEDIA_TYPE mt;
+ if(SUCCEEDED(pFSF->GetCurFile(&pszName, &mt)) && pszName)
+ {
+ fileName = pszName;
+ CoTaskMemFree(pszName);
+
+ fileName.Replace('\\', '/');
+ CStringW fn = fileName.Mid(fileName.ReverseFind('/')+1);
+ if(!fn.IsEmpty()) fileName = fn;
+
+ if(!pinName.IsEmpty()) fileName += L" / " + pinName;
+
+ WCHAR* pName = DNew WCHAR[fileName.GetLength()+1];
+ if(pName)
+ {
+ wcscpy(pName, fileName);
+ if(m_pName) delete [] m_pName;
+ m_pName = pName;
+ }
+ }
+
+ break;
+ }
+
+ pPin = GetFirstPin(pBF);
+ }
- if(!fForkedSomewhere)
- m_fCanBlock = true;
+ if(!fForkedSomewhere)
+ m_fCanBlock = true;
- m_hNotifyEvent = NULL;
+ m_hNotifyEvent = NULL;
- return S_OK;
+ return S_OK;
}
HRESULT CStreamSwitcherInputPin::Active()
{
- Block(!IsActive());
+ Block(!IsActive());
- return __super::Active();
+ return __super::Active();
}
HRESULT CStreamSwitcherInputPin::Inactive()
{
- Block(false);
+ Block(false);
- return __super::Inactive();
+ return __super::Inactive();
}
// IPin
STDMETHODIMP CStreamSwitcherInputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
{
- HRESULT hr = __super::QueryAccept(pmt);
- if(S_OK != hr) return hr;
+ HRESULT hr = __super::QueryAccept(pmt);
+ if(S_OK != hr) return hr;
- return QueryAcceptDownstream(pmt);
+ return QueryAcceptDownstream(pmt);
}
STDMETHODIMP CStreamSwitcherInputPin::ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt)
{
- // FIXME: this locked up once
+ // FIXME: this locked up once
// CAutoLock cAutoLock(&((CStreamSwitcherFilter*)m_pFilter)->m_csReceive);
- HRESULT hr;
- if(S_OK != (hr = QueryAcceptDownstream(pmt)))
- return VFW_E_TYPE_NOT_ACCEPTED;
+ HRESULT hr;
+ if(S_OK != (hr = QueryAcceptDownstream(pmt)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
if(m_Connected && m_Connected != pConnector)
return VFW_E_ALREADY_CONNECTED;
- if(m_Connected)
- m_Connected->Release(), m_Connected = NULL;
+ if(m_Connected)
+ m_Connected->Release(), m_Connected = NULL;
- return SUCCEEDED(__super::ReceiveConnection(pConnector, pmt)) ? S_OK : E_FAIL;
+ return SUCCEEDED(__super::ReceiveConnection(pConnector, pmt)) ? S_OK : E_FAIL;
}
STDMETHODIMP CStreamSwitcherInputPin::GetAllocator(IMemAllocator** ppAllocator)
@@ -618,7 +562,7 @@ STDMETHODIMP CStreamSwitcherInputPin::GetAllocator(IMemAllocator** ppAllocator)
CheckPointer(ppAllocator, E_POINTER);
if(m_pAllocator == NULL)
- {
+ {
(m_pAllocator = &m_Allocator)->AddRef();
}
@@ -629,239 +573,239 @@ STDMETHODIMP CStreamSwitcherInputPin::GetAllocator(IMemAllocator** ppAllocator)
STDMETHODIMP CStreamSwitcherInputPin::NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly)
{
- HRESULT hr = __super::NotifyAllocator(pAllocator, bReadOnly);
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::NotifyAllocator(pAllocator, bReadOnly);
+ if(FAILED(hr)) return hr;
- m_bUsingOwnAllocator = (pAllocator == (IMemAllocator*)&m_Allocator);
+ m_bUsingOwnAllocator = (pAllocator == (IMemAllocator*)&m_Allocator);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamSwitcherInputPin::BeginFlush()
{
CAutoLock cAutoLock(&(static_cast<CStreamSwitcherFilter*>(m_pFilter))->m_csState);
- HRESULT hr;
+ HRESULT hr;
- CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
+ CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
- CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
if(!IsConnected() || !pOut || !pOut->IsConnected())
- return VFW_E_NOT_CONNECTED;
+ return VFW_E_NOT_CONNECTED;
- if(FAILED(hr = __super::BeginFlush()))
- return hr;
+ if(FAILED(hr = __super::BeginFlush()))
+ return hr;
- return IsActive() ? pSSF->DeliverBeginFlush() : Block(false), S_OK;
+ return IsActive() ? pSSF->DeliverBeginFlush() : Block(false), S_OK;
}
STDMETHODIMP CStreamSwitcherInputPin::EndFlush()
{
- CAutoLock cAutoLock(&(static_cast<CStreamSwitcherFilter*>(m_pFilter))->m_csState);
+ CAutoLock cAutoLock(&(static_cast<CStreamSwitcherFilter*>(m_pFilter))->m_csState);
- HRESULT hr;
+ HRESULT hr;
- CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
+ CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
- CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
if(!IsConnected() || !pOut || !pOut->IsConnected())
- return VFW_E_NOT_CONNECTED;
+ return VFW_E_NOT_CONNECTED;
- if(FAILED(hr = __super::EndFlush()))
- return hr;
+ if(FAILED(hr = __super::EndFlush()))
+ return hr;
- return IsActive() ? pSSF->DeliverEndFlush() : Block(true), S_OK;
+ return IsActive() ? pSSF->DeliverEndFlush() : Block(true), S_OK;
}
STDMETHODIMP CStreamSwitcherInputPin::EndOfStream()
{
CAutoLock cAutoLock(&m_csReceive);
- CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
+ CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
- CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
- if(!IsConnected() || !pOut || !pOut->IsConnected())
- return VFW_E_NOT_CONNECTED;
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ if(!IsConnected() || !pOut || !pOut->IsConnected())
+ return VFW_E_NOT_CONNECTED;
- if(m_hNotifyEvent)
- {
- SetEvent(m_hNotifyEvent), m_hNotifyEvent = NULL;
- return S_OK;
- }
+ if(m_hNotifyEvent)
+ {
+ SetEvent(m_hNotifyEvent), m_hNotifyEvent = NULL;
+ return S_OK;
+ }
- return IsActive() ? pSSF->DeliverEndOfStream() : S_OK;
+ return IsActive() ? pSSF->DeliverEndOfStream() : S_OK;
}
// IMemInputPin
STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
{
- AM_MEDIA_TYPE* pmt = NULL;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
- const CMediaType mt(*pmt);
- DeleteMediaType(pmt), pmt = NULL;
- SetMediaType(&mt);
- }
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ const CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+ SetMediaType(&mt);
+ }
- // DAMN!!!!!! this doesn't work if the stream we are blocking
- // shares the same thread with another stream, mpeg splitters
- // are usually like that. Our nicely built up multithreaded
- // strategy is useless because of this, ARRRRRRGHHHHHH.
+ // DAMN!!!!!! this doesn't work if the stream we are blocking
+ // shares the same thread with another stream, mpeg splitters
+ // are usually like that. Our nicely built up multithreaded
+ // strategy is useless because of this, ARRRRRRGHHHHHH.
#ifdef BLOCKSTREAM
- if(m_fCanBlock)
- m_evBlock.Wait();
+ if(m_fCanBlock)
+ m_evBlock.Wait();
#endif
- if(!IsActive())
- {
+ if(!IsActive())
+ {
#ifdef BLOCKSTREAM
- if(m_fCanBlock)
- return S_FALSE;
+ if(m_fCanBlock)
+ return S_FALSE;
#endif
- TRACE(_T("&^$#@ : a stupid fix for this stupid problem\n"));
+ TRACE(_T("&^$#@ : a stupid fix for this stupid problem\n"));
//Sleep(32);
- return E_FAIL; // a stupid fix for this stupid problem
- }
+ return E_FAIL; // a stupid fix for this stupid problem
+ }
CAutoLock cAutoLock(&m_csReceive);
- CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
- ASSERT(pOut->GetConnected());
-
- HRESULT hr = __super::Receive(pSample);
- if(S_OK != hr) return hr;
-
- if(m_SampleProps.dwStreamId != AM_STREAM_MEDIA)
- {
- return pOut->Deliver(pSample);
- }
-
- //
-
- ALLOCATOR_PROPERTIES props, actual;
- hr = m_pAllocator->GetProperties(&props);
- hr = pOut->CurrentAllocator()->GetProperties(&actual);
-
- REFERENCE_TIME rtStart = 0, rtStop = 0;
- if(S_OK == pSample->GetTime(&rtStart, &rtStop))
- {
- //
- }
-
- long cbBuffer = pSample->GetActualDataLength();
-
- CMediaType mtOut = m_mt;
- mtOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->CreateNewOutputMediaType(mtOut, cbBuffer);
-
- bool fTypeChanged = false;
-
- if(mtOut != pOut->CurrentMediaType() || cbBuffer > actual.cbBuffer)
- {
- fTypeChanged = true;
-
- m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED/*|AM_SAMPLE_DATADISCONTINUITY|AM_SAMPLE_TIMEDISCONTINUITY*/;
-
- /*
- if(CComQIPtr<IPinConnection> pPC = pOut->CurrentPinConnection())
- {
- HANDLE hEOS = CreateEvent(NULL, FALSE, FALSE, NULL);
- hr = pPC->NotifyEndOfStream(hEOS);
- hr = pOut->DeliverEndOfStream();
- WaitForSingleObject(hEOS, 3000);
- CloseHandle(hEOS);
- hr = pOut->DeliverBeginFlush();
- hr = pOut->DeliverEndFlush();
- }
- */
-
- if(props.cBuffers < 8 && mtOut.majortype == MEDIATYPE_Audio)
- props.cBuffers = 8;
-
- props.cbBuffer = cbBuffer;
-
- if(actual.cbAlign != props.cbAlign
- || actual.cbPrefix != props.cbPrefix
- || actual.cBuffers < props.cBuffers
- || actual.cbBuffer < props.cbBuffer)
- {
- hr = pOut->DeliverBeginFlush();
- hr = pOut->DeliverEndFlush();
- hr = pOut->CurrentAllocator()->Decommit();
- hr = pOut->CurrentAllocator()->SetProperties(&props, &actual);
- hr = pOut->CurrentAllocator()->Commit();
- }
- }
-
- CComPtr<IMediaSample> pOutSample;
- if(FAILED(InitializeOutputSample(pSample, &pOutSample)))
- return E_FAIL;
-
- pmt = NULL;
- if(SUCCEEDED(pOutSample->GetMediaType(&pmt)) && pmt)
- {
- const CMediaType mt(*pmt);
- DeleteMediaType(pmt), pmt = NULL;
- // TODO
- ASSERT(0);
- }
-
- if(fTypeChanged)
- {
- pOut->SetMediaType(&mtOut);
- (static_cast<CStreamSwitcherFilter*>(m_pFilter))->OnNewOutputMediaType(m_mt, mtOut);
- pOutSample->SetMediaType(&mtOut);
- }
-
- // Transform
-
- hr = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->Transform(pSample, pOutSample);
-
- //
+ CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetOutputPin();
+ ASSERT(pOut->GetConnected());
+
+ HRESULT hr = __super::Receive(pSample);
+ if(S_OK != hr) return hr;
+
+ if(m_SampleProps.dwStreamId != AM_STREAM_MEDIA)
+ {
+ return pOut->Deliver(pSample);
+ }
+
+ //
+
+ ALLOCATOR_PROPERTIES props, actual;
+ hr = m_pAllocator->GetProperties(&props);
+ hr = pOut->CurrentAllocator()->GetProperties(&actual);
+
+ REFERENCE_TIME rtStart = 0, rtStop = 0;
+ if(S_OK == pSample->GetTime(&rtStart, &rtStop))
+ {
+ //
+ }
+
+ long cbBuffer = pSample->GetActualDataLength();
+
+ CMediaType mtOut = m_mt;
+ mtOut = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->CreateNewOutputMediaType(mtOut, cbBuffer);
+
+ bool fTypeChanged = false;
+
+ if(mtOut != pOut->CurrentMediaType() || cbBuffer > actual.cbBuffer)
+ {
+ fTypeChanged = true;
+
+ m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED/*|AM_SAMPLE_DATADISCONTINUITY|AM_SAMPLE_TIMEDISCONTINUITY*/;
+
+/*
+ if(CComQIPtr<IPinConnection> pPC = pOut->CurrentPinConnection())
+ {
+ HANDLE hEOS = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hr = pPC->NotifyEndOfStream(hEOS);
+ hr = pOut->DeliverEndOfStream();
+ WaitForSingleObject(hEOS, 3000);
+ CloseHandle(hEOS);
+ hr = pOut->DeliverBeginFlush();
+ hr = pOut->DeliverEndFlush();
+ }
+*/
+
+ if(props.cBuffers < 8 && mtOut.majortype == MEDIATYPE_Audio)
+ props.cBuffers = 8;
+
+ props.cbBuffer = cbBuffer;
+
+ if(actual.cbAlign != props.cbAlign
+ || actual.cbPrefix != props.cbPrefix
+ || actual.cBuffers < props.cBuffers
+ || actual.cbBuffer < props.cbBuffer)
+ {
+ hr = pOut->DeliverBeginFlush();
+ hr = pOut->DeliverEndFlush();
+ hr = pOut->CurrentAllocator()->Decommit();
+ hr = pOut->CurrentAllocator()->SetProperties(&props, &actual);
+ hr = pOut->CurrentAllocator()->Commit();
+ }
+ }
+
+ CComPtr<IMediaSample> pOutSample;
+ if(FAILED(InitializeOutputSample(pSample, &pOutSample)))
+ return E_FAIL;
+
+ pmt = NULL;
+ if(SUCCEEDED(pOutSample->GetMediaType(&pmt)) && pmt)
+ {
+ const CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+ // TODO
+ ASSERT(0);
+ }
+
+ if(fTypeChanged)
+ {
+ pOut->SetMediaType(&mtOut);
+ (static_cast<CStreamSwitcherFilter*>(m_pFilter))->OnNewOutputMediaType(m_mt, mtOut);
+ pOutSample->SetMediaType(&mtOut);
+ }
+
+ // Transform
+
+ hr = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->Transform(pSample, pOutSample);
+
+ //
if(S_OK == hr)
- {
- hr = pOut->Deliver(pOutSample);
+ {
+ hr = pOut->Deliver(pOutSample);
m_bSampleSkipped = FALSE;
- /*
- if(FAILED(hr))
- {
- ASSERT(0);
- }
- */
- }
+/*
+ if(FAILED(hr))
+ {
+ ASSERT(0);
+ }
+*/
+ }
else if(S_FALSE == hr)
- {
- hr = S_OK;
- pOutSample = NULL;
- m_bSampleSkipped = TRUE;
-
- if(!m_bQualityChanged)
- {
- m_pFilter->NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
- m_bQualityChanged = TRUE;
- }
- }
+ {
+ hr = S_OK;
+ pOutSample = NULL;
+ m_bSampleSkipped = TRUE;
+
+ if(!m_bQualityChanged)
+ {
+ m_pFilter->NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
+ m_bQualityChanged = TRUE;
+ }
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CStreamSwitcherInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- if(!IsConnected())
- return S_OK;
+ if(!IsConnected())
+ return S_OK;
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
+ CStreamSwitcherFilter* pSSF = static_cast<CStreamSwitcherFilter*>(m_pFilter);
- CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
if(!pOut || !pOut->IsConnected())
- return VFW_E_NOT_CONNECTED;
+ return VFW_E_NOT_CONNECTED;
- return pSSF->DeliverNewSegment(tStart, tStop, dRate);
+ return pSSF->DeliverNewSegment(tStart, tStop, dRate);
}
//
@@ -869,87 +813,87 @@ STDMETHODIMP CStreamSwitcherInputPin::NewSegment(REFERENCE_TIME tStart, REFERENC
//
CStreamSwitcherOutputPin::CStreamSwitcherOutputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr)
- : CBaseOutputPin(NAME("CStreamSwitcherOutputPin"), pFilter, &pFilter->m_csState, phr, L"Out")
+ : CBaseOutputPin(NAME("CStreamSwitcherOutputPin"), pFilter, &pFilter->m_csState, phr, L"Out")
{
// m_bCanReconnectWhenActive = TRUE;
}
STDMETHODIMP CStreamSwitcherOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
- CheckPointer(ppv, E_POINTER);
+ CheckPointer(ppv,E_POINTER);
ValidateReadWritePtr(ppv, sizeof(PVOID));
*ppv = NULL;
if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking)
- {
+ {
if(m_pStreamSwitcherPassThru == NULL)
- {
- HRESULT hr = S_OK;
- m_pStreamSwitcherPassThru = (IUnknown*)(INonDelegatingUnknown*)
- DNew CStreamSwitcherPassThru(GetOwner(), &hr, static_cast<CStreamSwitcherFilter*>(m_pFilter));
+ {
+ HRESULT hr = S_OK;
+ m_pStreamSwitcherPassThru = (IUnknown*)(INonDelegatingUnknown*)
+ DNew CStreamSwitcherPassThru(GetOwner(), &hr, static_cast<CStreamSwitcherFilter*>(m_pFilter));
- if(!m_pStreamSwitcherPassThru) return E_OUTOFMEMORY;
+ if(!m_pStreamSwitcherPassThru) return E_OUTOFMEMORY;
if(FAILED(hr)) return hr;
}
return m_pStreamSwitcherPassThru->QueryInterface(riid, ppv);
}
- /*
- else if(riid == IID_IStreamBuilder)
- {
- return GetInterface((IStreamBuilder*)this, ppv);
- }
- */
- return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
+/*
+ else if(riid == IID_IStreamBuilder)
+ {
+ return GetInterface((IStreamBuilder*)this, ppv);
+ }
+*/
+ return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CStreamSwitcherOutputPin::QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt)
{
- HRESULT hr = S_FALSE;
+ HRESULT hr = S_FALSE;
- CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
+ CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(pIn && pIn->IsConnected() && (pIn->IsUsingOwnAllocator() || pIn->CurrentMediaType() == *pmt))
- {
- if(CComQIPtr<IPin> pPinTo = pIn->GetConnected())
- {
- if(S_OK != (hr = pPinTo->QueryAccept(pmt)))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- else
- {
- return E_FAIL;
- }
- }
+ if(pIn && pIn->IsConnected() && (pIn->IsUsingOwnAllocator() || pIn->CurrentMediaType() == *pmt))
+ {
+ if(CComQIPtr<IPin> pPinTo = pIn->GetConnected())
+ {
+ if(S_OK != (hr = pPinTo->QueryAccept(pmt)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else
+ {
+ return E_FAIL;
+ }
+ }
- return hr;
+ return hr;
}
// pure virtual
HRESULT CStreamSwitcherOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(!pIn || !pIn->IsConnected()) return E_UNEXPECTED;
+ CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
+ if(!pIn || !pIn->IsConnected()) return E_UNEXPECTED;
- CComPtr<IMemAllocator> pAllocatorIn;
- pIn->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ CComPtr<IMemAllocator> pAllocatorIn;
+ pIn->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
- HRESULT hr;
- if(FAILED(hr = pAllocatorIn->GetProperties(pProperties)))
- return hr;
+ HRESULT hr;
+ if(FAILED(hr = pAllocatorIn->GetProperties(pProperties)))
+ return hr;
- if(pProperties->cBuffers < 8 && pIn->CurrentMediaType().majortype == MEDIATYPE_Audio)
- pProperties->cBuffers = 8;
+ if(pProperties->cBuffers < 8 && pIn->CurrentMediaType().majortype == MEDIATYPE_Audio)
+ pProperties->cBuffers = 8;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
- return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
}
// virtual
@@ -959,12 +903,12 @@ class MatrixMixer {};
HRESULT CStreamSwitcherOutputPin::CheckConnect(IPin* pPin)
{
- CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPin);
+ CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPin);
- return
- IsAudioWaveRenderer(pBF) || GetCLSID(pBF) == __uuidof(MatrixMixer)
- ? __super::CheckConnect(pPin)
- : E_FAIL;
+ return
+ IsAudioWaveRenderer(pBF) || GetCLSID(pBF) == __uuidof(MatrixMixer)
+ ? __super::CheckConnect(pPin)
+ : E_FAIL;
// return CComQIPtr<IPinConnection>(pPin) ? CBaseOutputPin::CheckConnect(pPin) : E_NOINTERFACE;
// return CBaseOutputPin::CheckConnect(pPin);
@@ -972,64 +916,64 @@ HRESULT CStreamSwitcherOutputPin::CheckConnect(IPin* pPin)
HRESULT CStreamSwitcherOutputPin::BreakConnect()
{
- m_pPinConnection = NULL;
- return __super::BreakConnect();
+ m_pPinConnection = NULL;
+ return __super::BreakConnect();
}
HRESULT CStreamSwitcherOutputPin::CompleteConnect(IPin* pReceivePin)
{
- m_pPinConnection = CComQIPtr<IPinConnection>(pReceivePin);
- return __super::CompleteConnect(pReceivePin);
+ m_pPinConnection = CComQIPtr<IPinConnection>(pReceivePin);
+ return __super::CompleteConnect(pReceivePin);
}
HRESULT CStreamSwitcherOutputPin::CheckMediaType(const CMediaType* pmt)
{
- return (static_cast<CStreamSwitcherFilter*>(m_pFilter))->CheckMediaType(pmt);
+ return (static_cast<CStreamSwitcherFilter*>(m_pFilter))->CheckMediaType(pmt);
}
HRESULT CStreamSwitcherOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
- CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(!pIn || !pIn->IsConnected()) return E_UNEXPECTED;
+ CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
+ if(!pIn || !pIn->IsConnected()) return E_UNEXPECTED;
- CComPtr<IEnumMediaTypes> pEM;
- if(FAILED(pIn->GetConnected()->EnumMediaTypes(&pEM)))
- return VFW_S_NO_MORE_ITEMS;
+ CComPtr<IEnumMediaTypes> pEM;
+ if(FAILED(pIn->GetConnected()->EnumMediaTypes(&pEM)))
+ return VFW_S_NO_MORE_ITEMS;
- if(iPosition > 0 && FAILED(pEM->Skip(iPosition)))
- return VFW_S_NO_MORE_ITEMS;
+ if(iPosition > 0 && FAILED(pEM->Skip(iPosition)))
+ return VFW_S_NO_MORE_ITEMS;
- AM_MEDIA_TYPE* tmp = NULL;
- if(S_OK != pEM->Next(1, &tmp, NULL) || !tmp)
- return VFW_S_NO_MORE_ITEMS;
+ AM_MEDIA_TYPE* tmp = NULL;
+ if(S_OK != pEM->Next(1, &tmp, NULL) || !tmp)
+ return VFW_S_NO_MORE_ITEMS;
- CopyMediaType(pmt, tmp);
- DeleteMediaType(tmp);
- /*
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ CopyMediaType(pmt, tmp);
+ DeleteMediaType(tmp);
+/*
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- CopyMediaType(pmt, &pIn->CurrentMediaType());
- */
- return S_OK;
+ CopyMediaType(pmt, &pIn->CurrentMediaType());
+*/
+ return S_OK;
}
// IPin
STDMETHODIMP CStreamSwitcherOutputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
{
- HRESULT hr = __super::QueryAccept(pmt);
- if(S_OK != hr) return hr;
+ HRESULT hr = __super::QueryAccept(pmt);
+ if(S_OK != hr) return hr;
- return QueryAcceptUpstream(pmt);
+ return QueryAcceptUpstream(pmt);
}
// IQualityControl
STDMETHODIMP CStreamSwitcherOutputPin::Notify(IBaseFilter* pSender, Quality q)
{
- CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
- if(!pIn || !pIn->IsConnected()) return VFW_E_NOT_CONNECTED;
+ CStreamSwitcherInputPin* pIn = (static_cast<CStreamSwitcherFilter*>(m_pFilter))->GetInputPin();
+ if(!pIn || !pIn->IsConnected()) return VFW_E_NOT_CONNECTED;
return pIn->PassNotify(q);
}
@@ -1037,319 +981,319 @@ STDMETHODIMP CStreamSwitcherOutputPin::Notify(IBaseFilter* pSender, Quality q)
STDMETHODIMP CStreamSwitcherOutputPin::Render(IPin* ppinOut, IGraphBuilder* pGraph)
{
- CComPtr<IBaseFilter> pBF;
- pBF.CoCreateInstance(CLSID_DSoundRender);
- if(!pBF || FAILED(pGraph->AddFilter(pBF, L"Default DirectSound Device")))
- {
- return E_FAIL;
- }
+ CComPtr<IBaseFilter> pBF;
+ pBF.CoCreateInstance(CLSID_DSoundRender);
+ if(!pBF || FAILED(pGraph->AddFilter(pBF, L"Default DirectSound Device")))
+ {
+ return E_FAIL;
+ }
- if(FAILED(pGraph->ConnectDirect(ppinOut, GetFirstDisconnectedPin(pBF, PINDIR_INPUT), NULL)))
- {
- pGraph->RemoveFilter(pBF);
- return E_FAIL;
- }
+ if(FAILED(pGraph->ConnectDirect(ppinOut, GetFirstDisconnectedPin(pBF, PINDIR_INPUT), NULL)))
+ {
+ pGraph->RemoveFilter(pBF);
+ return E_FAIL;
+ }
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamSwitcherOutputPin::Backout(IPin* ppinOut, IGraphBuilder* pGraph)
{
- return S_OK;
+ return S_OK;
}
//
// CStreamSwitcherFilter
//
-CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
- : CBaseFilter(NAME("CStreamSwitcherFilter"), lpunk, &m_csState, clsid)
+CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
+ : CBaseFilter(NAME("CStreamSwitcherFilter"), lpunk, &m_csState, clsid)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- do
- {
- CAutoPtr<CStreamSwitcherInputPin> pInput;
- CAutoPtr<CStreamSwitcherOutputPin> pOutput;
+ do
+ {
+ CAutoPtr<CStreamSwitcherInputPin> pInput;
+ CAutoPtr<CStreamSwitcherOutputPin> pOutput;
- hr = S_OK;
+ hr = S_OK;
pInput.Attach(DNew CStreamSwitcherInputPin(this, &hr, L"Channel 1"));
- if(!pInput || FAILED(hr)) break;
+ if(!pInput || FAILED(hr)) break;
- hr = S_OK;
- pOutput.Attach(DNew CStreamSwitcherOutputPin(this, &hr));
+ hr = S_OK;
+ pOutput.Attach(DNew CStreamSwitcherOutputPin(this, &hr));
if(!pOutput || FAILED(hr)) break;
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
+
+ m_pInputs.AddHead(m_pInput = pInput.Detach());
+ m_pOutput = pOutput.Detach();
- m_pInputs.AddHead(m_pInput = pInput.Detach());
- m_pOutput = pOutput.Detach();
+ return;
+ }
+ while(false);
- return;
- }
- while(false);
-
- if(phr) *phr = E_FAIL;
+ if(phr) *phr = E_FAIL;
}
CStreamSwitcherFilter::~CStreamSwitcherFilter()
{
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos) delete m_pInputs.GetNext(pos);
- m_pInputs.RemoveAll();
- m_pInput = NULL;
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos) delete m_pInputs.GetNext(pos);
+ m_pInputs.RemoveAll();
+ m_pInput = NULL;
- delete m_pOutput;
- m_pOutput = NULL;
+ delete m_pOutput;
+ m_pOutput = NULL;
}
STDMETHODIMP CStreamSwitcherFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IAMStreamSelect)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IAMStreamSelect)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
//
int CStreamSwitcherFilter::GetPinCount()
{
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
- return(1 + (int)m_pInputs.GetCount());
+ return(1 + (int)m_pInputs.GetCount());
}
CBasePin* CStreamSwitcherFilter::GetPin(int n)
{
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
- if(n < 0 || n >= GetPinCount()) return NULL;
- else if(n == 0) return m_pOutput;
- else return m_pInputs.GetAt(m_pInputs.FindIndex(n - 1));
+ if(n < 0 || n >= GetPinCount()) return NULL;
+ else if(n == 0) return m_pOutput;
+ else return m_pInputs.GetAt(m_pInputs.FindIndex(n-1));
}
int CStreamSwitcherFilter::GetConnectedInputPinCount()
{
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
- int nConnected = 0;
+ int nConnected = 0;
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- if(m_pInputs.GetNext(pos)->IsConnected())
- nConnected++;
- }
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ if(m_pInputs.GetNext(pos)->IsConnected())
+ nConnected++;
+ }
- return(nConnected);
+ return(nConnected);
}
CStreamSwitcherInputPin* CStreamSwitcherFilter::GetConnectedInputPin(int n)
{
- if(n >= 0)
- {
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
- if(pPin->IsConnected())
- {
- if(n == 0) return(pPin);
- n--;
- }
- }
- }
+ if(n >= 0)
+ {
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
+ if(pPin->IsConnected())
+ {
+ if(n == 0) return(pPin);
+ n--;
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
CStreamSwitcherInputPin* CStreamSwitcherFilter::GetInputPin()
{
- return m_pInput;
+ return m_pInput;
}
CStreamSwitcherOutputPin* CStreamSwitcherFilter::GetOutputPin()
{
- return m_pOutput;
+ return m_pOutput;
}
//
HRESULT CStreamSwitcherFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin)
{
- if(dir == PINDIR_INPUT)
- {
- CAutoLock cAutoLock(&m_csPins);
+ if(dir == PINDIR_INPUT)
+ {
+ CAutoLock cAutoLock(&m_csPins);
- int nConnected = GetConnectedInputPinCount();
+ int nConnected = GetConnectedInputPinCount();
- if(nConnected == 1)
- {
- m_pInput = static_cast<CStreamSwitcherInputPin*>(pPin);
- }
+ if(nConnected == 1)
+ {
+ m_pInput = static_cast<CStreamSwitcherInputPin*>(pPin);
+ }
- if(nConnected == m_pInputs.GetCount())
- {
- CStringW name;
- name.Format(L"Channel %d", ++m_PinVersion);
-
- HRESULT hr = S_OK;
- CStreamSwitcherInputPin* pPin = DNew CStreamSwitcherInputPin(this, &hr, name);
- if(!pPin || FAILED(hr))
- {
- delete pPin;
- return E_FAIL;
- }
- m_pInputs.AddTail(pPin);
- }
- }
+ if(nConnected == m_pInputs.GetCount())
+ {
+ CStringW name;
+ name.Format(L"Channel %d", ++m_PinVersion);
- return S_OK;
+ HRESULT hr = S_OK;
+ CStreamSwitcherInputPin* pPin = DNew CStreamSwitcherInputPin(this, &hr, name);
+ if(!pPin || FAILED(hr))
+ {
+ delete pPin;
+ return E_FAIL;
+ }
+ m_pInputs.AddTail(pPin);
+ }
+ }
+
+ return S_OK;
}
// this should be very thread safe, I hope it is, it must be... :)
void CStreamSwitcherFilter::SelectInput(CStreamSwitcherInputPin* pInput)
{
- // make sure no input thinks it is active
- m_pInput = NULL;
-
- // release blocked GetBuffer in our own allocator & block all Receive
- POSITION pos = m_pInputs.GetHeadPosition();
- while(pos)
- {
- CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
- pPin->Block(false);
- // a few Receive calls can arrive here, but since m_pInput == NULL neighter of them gets delivered
- pPin->Block(true);
- }
+ // make sure no input thinks it is active
+ m_pInput = NULL;
- // this will let waiting GetBuffer() calls go on inside our Receive()
- if(m_pOutput)
- {
- m_pOutput->DeliverBeginFlush();
- m_pOutput->DeliverEndFlush();
- }
+ // release blocked GetBuffer in our own allocator & block all Receive
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
+ pPin->Block(false);
+ // a few Receive calls can arrive here, but since m_pInput == NULL neighter of them gets delivered
+ pPin->Block(true);
+ }
+
+ // this will let waiting GetBuffer() calls go on inside our Receive()
+ if(m_pOutput)
+ {
+ m_pOutput->DeliverBeginFlush();
+ m_pOutput->DeliverEndFlush();
+ }
- if(!pInput) return;
+ if(!pInput) return;
- // set new input
- m_pInput = pInput;
+ // set new input
+ m_pInput = pInput;
- // let it go
- m_pInput->Block(false);
+ // let it go
+ m_pInput->Block(false);
}
//
HRESULT CStreamSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- BYTE* pDataIn = NULL;
- BYTE* pDataOut = NULL;
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
- HRESULT hr;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
- if(FAILED(hr = pOut->GetPointer(&pDataOut))) return hr;
+ HRESULT hr;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut))) return hr;
- long len = pIn->GetActualDataLength();
- long size = pOut->GetSize();
+ long len = pIn->GetActualDataLength();
+ long size = pOut->GetSize();
- if(!pDataIn || !pDataOut /*|| len > size || len <= 0*/) return S_FALSE; // FIXME
+ if(!pDataIn || !pDataOut /*|| len > size || len <= 0*/) return S_FALSE; // FIXME
- memcpy(pDataOut, pDataIn, min(len, size));
- pOut->SetActualDataLength(min(len, size));
+ memcpy(pDataOut, pDataIn, min(len, size));
+ pOut->SetActualDataLength(min(len, size));
- return S_OK;
+ return S_OK;
}
CMediaType CStreamSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& cbBuffer)
{
- return mt;
+ return mt;
}
HRESULT CStreamSwitcherFilter::DeliverEndOfStream()
{
- return m_pOutput ? m_pOutput->DeliverEndOfStream() : E_FAIL;
+ return m_pOutput ? m_pOutput->DeliverEndOfStream() : E_FAIL;
}
HRESULT CStreamSwitcherFilter::DeliverBeginFlush()
{
- return m_pOutput ? m_pOutput->DeliverBeginFlush() : E_FAIL;
+ return m_pOutput ? m_pOutput->DeliverBeginFlush() : E_FAIL;
}
HRESULT CStreamSwitcherFilter::DeliverEndFlush()
{
- return m_pOutput ? m_pOutput->DeliverEndFlush() : E_FAIL;
+ return m_pOutput ? m_pOutput->DeliverEndFlush() : E_FAIL;
}
HRESULT CStreamSwitcherFilter::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- return m_pOutput ? m_pOutput->DeliverNewSegment(tStart, tStop, dRate) : E_FAIL;
+ return m_pOutput ? m_pOutput->DeliverNewSegment(tStart, tStop, dRate) : E_FAIL;
}
// IAMStreamSelect
STDMETHODIMP CStreamSwitcherFilter::Count(DWORD* pcStreams)
{
- if(!pcStreams) return E_POINTER;
+ if(!pcStreams) return E_POINTER;
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
- *pcStreams = GetConnectedInputPinCount();
+ *pcStreams = GetConnectedInputPinCount();
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamSwitcherFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
{
- CAutoLock cAutoLock(&m_csPins);
+ CAutoLock cAutoLock(&m_csPins);
- CBasePin* pPin = GetConnectedInputPin(lIndex);
- if(!pPin) return E_INVALIDARG;
+ CBasePin* pPin = GetConnectedInputPin(lIndex);
+ if(!pPin) return E_INVALIDARG;
- if(ppmt)
- *ppmt = CreateMediaType(&m_pOutput->CurrentMediaType());
+ if(ppmt)
+ *ppmt = CreateMediaType(&m_pOutput->CurrentMediaType());
- if(pdwFlags)
- *pdwFlags = (m_pInput == pPin) ? AMSTREAMSELECTINFO_EXCLUSIVE : 0;
+ if(pdwFlags)
+ *pdwFlags = (m_pInput == pPin) ? AMSTREAMSELECTINFO_EXCLUSIVE : 0;
- if(plcid)
- *plcid = 0;
+ if(plcid)
+ *plcid = 0;
- if(pdwGroup)
- *pdwGroup = 0;
+ if(pdwGroup)
+ *pdwGroup = 0;
- if(ppszName && (*ppszName = (WCHAR*)CoTaskMemAlloc((wcslen(pPin->Name()) + 1) * sizeof(WCHAR))))
- wcscpy(*ppszName, pPin->Name());
+ if(ppszName && (*ppszName = (WCHAR*)CoTaskMemAlloc((wcslen(pPin->Name())+1)*sizeof(WCHAR))))
+ wcscpy(*ppszName, pPin->Name());
- if(ppObject)
- *ppObject = NULL;
+ if(ppObject)
+ *ppObject = NULL;
- if(ppUnk)
- *ppUnk = NULL;
+ if(ppUnk)
+ *ppUnk = NULL;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CStreamSwitcherFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(dwFlags != AMSTREAMSELECTENABLE_ENABLE)
- return E_NOTIMPL;
+ if(dwFlags != AMSTREAMSELECTENABLE_ENABLE)
+ return E_NOTIMPL;
- PauseGraph;
+ PauseGraph;
- CStreamSwitcherInputPin* pNewInput = GetConnectedInputPin(lIndex);
- if(!pNewInput) return E_INVALIDARG;
+ CStreamSwitcherInputPin* pNewInput = GetConnectedInputPin(lIndex);
+ if(!pNewInput) return E_INVALIDARG;
- SelectInput(pNewInput);
+ SelectInput(pNewInput);
- ResumeGraph;
+ ResumeGraph;
- return S_OK;
+ return S_OK;
}
//////////
diff --git a/src/filters/switcher/AudioSwitcher/StreamSwitcher.h b/src/filters/switcher/AudioSwitcher/StreamSwitcher.h
index 38fe41f84..e6a7f17b7 100644
--- a/src/filters/switcher/AudioSwitcher/StreamSwitcher.h
+++ b/src/filters/switcher/AudioSwitcher/StreamSwitcher.h
@@ -32,25 +32,25 @@
CComQIPtr<IMediaSeeking> _pMS((IUnknown*)(INonDelegatingUnknown*)m_pGraph); \
LONGLONG _rtNow = 0; \
if(_pMS) _hr = _pMS->GetCurrentPosition(&_rtNow); \
-
+
#define ResumeGraph \
if(SUCCEEDED(_hr) && _pMS && _fs != State_Stopped) \
_hr = _pMS->SetPositions(&_rtNow, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); \
\
if(_fs == State_Running && _pMS) \
_pMC->Run(); \
-
+
class CStreamSwitcherFilter;
class CStreamSwitcherPassThru : public IMediaSeeking, public CMediaPosition
{
protected:
- CStreamSwitcherFilter* m_pFilter;
+ CStreamSwitcherFilter* m_pFilter;
public:
CStreamSwitcherPassThru(LPUNKNOWN, HRESULT* phr, CStreamSwitcherFilter* pFilter);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// IMediaSeeking methods
@@ -94,206 +94,184 @@ protected:
CStreamSwitcherInputPin* m_pPin;
CMediaType m_mt;
- bool m_fMediaTypeChanged;
+ bool m_fMediaTypeChanged;
public:
- CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr);
+ CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr);
#ifdef DEBUG
- ~CStreamSwitcherAllocator();
+ ~CStreamSwitcherAllocator();
#endif
- STDMETHODIMP_(ULONG) NonDelegatingAddRef();
- STDMETHODIMP_(ULONG) NonDelegatingRelease();
+ STDMETHODIMP_(ULONG) NonDelegatingAddRef();
+ STDMETHODIMP_(ULONG) NonDelegatingRelease();
- STDMETHODIMP GetBuffer(
- IMediaSample** ppBuffer,
- REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
- DWORD dwFlags);
+ STDMETHODIMP GetBuffer(
+ IMediaSample** ppBuffer,
+ REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
+ DWORD dwFlags);
- void NotifyMediaType(const CMediaType& mt);
+ void NotifyMediaType(const CMediaType& mt);
};
[uuid("DA395FA3-4A3E-4D85-805E-0BEFF53D4BCD")]
-interface IStreamSwitcherInputPin :
-public IUnknown
+interface IStreamSwitcherInputPin : public IUnknown
{
- STDMETHOD_(bool, IsActive)() = 0;
+ STDMETHOD_(bool, IsActive)() = 0;
};
class CStreamSwitcherInputPin : public CBaseInputPin, public IPinConnection, public IStreamSwitcherInputPin
{
- friend class CStreamSwitcherAllocator;
+ friend class CStreamSwitcherAllocator;
- CStreamSwitcherAllocator m_Allocator;
+ CStreamSwitcherAllocator m_Allocator;
- BOOL m_bSampleSkipped;
- BOOL m_bQualityChanged;
- BOOL m_bUsingOwnAllocator;
+ BOOL m_bSampleSkipped;
+ BOOL m_bQualityChanged;
+ BOOL m_bUsingOwnAllocator;
- CAMEvent m_evBlock;
- bool m_fCanBlock;
- HRESULT Active();
- HRESULT Inactive();
+ CAMEvent m_evBlock;
+ bool m_fCanBlock;
+ HRESULT Active();
+ HRESULT Inactive();
- HRESULT QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt);
+ HRESULT QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt);
- HRESULT InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample);
+ HRESULT InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample);
- HANDLE m_hNotifyEvent;
+ HANDLE m_hNotifyEvent;
public:
CStreamSwitcherInputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr, LPCWSTR pName);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- }
- IMemAllocator* CurrentAllocator()
- {
- return m_pAllocator;
- }
-
- bool IsUsingOwnAllocator()
- {
- return m_bUsingOwnAllocator == TRUE;
- }
-
- void Block(bool fBlock);
-
- CCritSec m_csReceive;
-
- // pure virtual
- HRESULT CheckMediaType(const CMediaType* pmt);
-
- // virtual
- HRESULT CheckConnect(IPin* pPin);
- HRESULT CompleteConnect(IPin* pReceivePin);
-
- // IPin
- STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
- STDMETHODIMP NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly);
- STDMETHODIMP BeginFlush();
+ CMediaType& CurrentMediaType() {return m_mt;}
+ IMemAllocator* CurrentAllocator() {return m_pAllocator;}
+
+ bool IsUsingOwnAllocator() {return m_bUsingOwnAllocator == TRUE;}
+
+ void Block(bool fBlock);
+
+ CCritSec m_csReceive;
+
+ // pure virtual
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+ // virtual
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ // IPin
+ STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
+ STDMETHODIMP NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly);
+ STDMETHODIMP BeginFlush();
STDMETHODIMP EndFlush();
- STDMETHODIMP EndOfStream();
+ STDMETHODIMP EndOfStream();
- // IMemInputPin
+ // IMemInputPin
STDMETHODIMP Receive(IMediaSample* pSample);
- STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- // IPinConnection
- STDMETHODIMP DynamicQueryAccept(const AM_MEDIA_TYPE* pmt);
- STDMETHODIMP NotifyEndOfStream(HANDLE hNotifyEvent);
- STDMETHODIMP IsEndPin();
- STDMETHODIMP DynamicDisconnect();
+ // IPinConnection
+ STDMETHODIMP DynamicQueryAccept(const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP NotifyEndOfStream(HANDLE hNotifyEvent);
+ STDMETHODIMP IsEndPin();
+ STDMETHODIMP DynamicDisconnect();
- // IStreamSwitcherInputPin
- STDMETHODIMP_(bool) IsActive();
+ // IStreamSwitcherInputPin
+ STDMETHODIMP_(bool) IsActive();
};
class CStreamSwitcherOutputPin : public CBaseOutputPin, public IStreamBuilder
{
- CComPtr<IUnknown> m_pStreamSwitcherPassThru;
- CComPtr<IPinConnection> m_pPinConnection;
+ CComPtr<IUnknown> m_pStreamSwitcherPassThru;
+ CComPtr<IPinConnection> m_pPinConnection;
- HRESULT QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt);
+ HRESULT QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt);
public:
CStreamSwitcherOutputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- }
- IMemAllocator* CurrentAllocator()
- {
- return m_pAllocator;
- }
- IPinConnection* CurrentPinConnection()
- {
- return m_pPinConnection;
- }
-
- // pure virtual
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
-
- // virtual
- HRESULT CheckConnect(IPin* pPin);
- HRESULT BreakConnect();
- HRESULT CompleteConnect(IPin* pReceivePin);
-
- HRESULT CheckMediaType(const CMediaType* pmt);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
-
- // IPin
- STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
-
- // IQualityControl
- STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
-
- // IStreamBuilder
- STDMETHODIMP Render(IPin* ppinOut, IGraphBuilder* pGraph);
- STDMETHODIMP Backout(IPin* ppinOut, IGraphBuilder* pGraph);
+ CMediaType& CurrentMediaType() {return m_mt;}
+ IMemAllocator* CurrentAllocator() {return m_pAllocator;}
+ IPinConnection* CurrentPinConnection() {return m_pPinConnection;}
+
+ // pure virtual
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+
+ // virtual
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ // IPin
+ STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
+
+ // IQualityControl
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+
+ // IStreamBuilder
+ STDMETHODIMP Render(IPin* ppinOut, IGraphBuilder* pGraph);
+ STDMETHODIMP Backout(IPin* ppinOut, IGraphBuilder* pGraph);
};
class CStreamSwitcherFilter : public CBaseFilter, public IAMStreamSelect
{
- friend class CStreamSwitcherInputPin;
- friend class CStreamSwitcherOutputPin;
- friend class CStreamSwitcherPassThru;
+ friend class CStreamSwitcherInputPin;
+ friend class CStreamSwitcherOutputPin;
+ friend class CStreamSwitcherPassThru;
- CAtlList<CStreamSwitcherInputPin*> m_pInputs;
- CStreamSwitcherInputPin* m_pInput;
- CStreamSwitcherOutputPin* m_pOutput;
+ CAtlList<CStreamSwitcherInputPin*> m_pInputs;
+ CStreamSwitcherInputPin* m_pInput;
+ CStreamSwitcherOutputPin* m_pOutput;
- CCritSec m_csState, m_csPins;
+ CCritSec m_csState, m_csPins;
- HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin);
protected:
- void SelectInput(CStreamSwitcherInputPin* pInput);
+ void SelectInput(CStreamSwitcherInputPin* pInput);
public:
- CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
- virtual ~CStreamSwitcherFilter();
+ CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CStreamSwitcherFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- int GetPinCount();
- CBasePin* GetPin(int n);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
- int GetConnectedInputPinCount();
- CStreamSwitcherInputPin* GetConnectedInputPin(int n);
- CStreamSwitcherInputPin* GetInputPin();
- CStreamSwitcherOutputPin* GetOutputPin();
+ int GetConnectedInputPinCount();
+ CStreamSwitcherInputPin* GetConnectedInputPin(int n);
+ CStreamSwitcherInputPin* GetInputPin();
+ CStreamSwitcherOutputPin* GetOutputPin();
- bool m_fResetOutputMediaType;
- void ResetOutputMediaType()
- {
- m_fResetOutputMediaType = true;
- }
+ bool m_fResetOutputMediaType;
+ void ResetOutputMediaType() {m_fResetOutputMediaType = true;}
- // override these
- virtual HRESULT CheckMediaType(const CMediaType* pmt) = 0;
- virtual HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- virtual CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
- virtual void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut) {}
+ // override these
+ virtual HRESULT CheckMediaType(const CMediaType* pmt) = 0;
+ virtual HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ virtual CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
+ virtual void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut) {}
- // and maybe these
+ // and maybe these
virtual HRESULT DeliverEndOfStream();
virtual HRESULT DeliverBeginFlush();
virtual HRESULT DeliverEndFlush();
virtual HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- // IAMStreamSelect
+ // IAMStreamSelect
STDMETHODIMP Count(DWORD* pcStreams);
STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
diff --git a/src/filters/switcher/AudioSwitcher/stdafx.cpp b/src/filters/switcher/AudioSwitcher/stdafx.cpp
index 6e0175b5d..f1f712075 100644
--- a/src/filters/switcher/AudioSwitcher/stdafx.cpp
+++ b/src/filters/switcher/AudioSwitcher/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/switcher/AudioSwitcher/stdafx.h b/src/filters/switcher/AudioSwitcher/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/switcher/AudioSwitcher/stdafx.h
+++ b/src/filters/switcher/AudioSwitcher/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
index 16915d94a..d4ad8c14e 100644
--- a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
+++ b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -31,13 +31,13 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -48,7 +48,7 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CAVI2AC3Filter), L"MPC - AVI<->AC3/DTS", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CAVI2AC3Filter), L"MPC - AVI<->AC3/DTS", MERIT_NORMAL, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
@@ -60,12 +60,12 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -79,9 +79,9 @@ CFilterApp theApp;
//
CAVI2AC3Filter::CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CAVI2AC3Filter"), lpunk, __uuidof(this))
+ : CTransformFilter(NAME("CAVI2AC3Filter"), lpunk, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
CAVI2AC3Filter::~CAVI2AC3Filter()
@@ -90,432 +90,432 @@ CAVI2AC3Filter::~CAVI2AC3Filter()
HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSample)
{
- HRESULT hr;
-
- BYTE* pIn = NULL;
- if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
- BYTE* pInOrg = pIn;
-
- long len = pSample->GetActualDataLength();
- if(len <= 0) return S_FALSE;
-
- BYTE* pOut = NULL;
- if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
- BYTE* pOutOrg = pOut;
-
- int size = pOutSample->GetSize();
-
- if((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
- && (CheckWAVEAC3(&m_pOutput->CurrentMediaType()) || CheckWAVEDTS(&m_pOutput->CurrentMediaType())))
- {
- if(*(DWORD*)pIn == 0xBA010000)
- {
- pIn += 14;
- }
-
- if(*(DWORD*)pIn == 0xBD010000)
- {
- pIn += 8 + 1 + pIn[8] + 1 + 3;
- }
-
- len -= (pInOrg - pIn);
-
- if(size < len) return E_FAIL;
-
- memcpy(pOut, pIn, len);
- pOut += len;
- }
- else if((CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
- && (CheckAC3(&m_pOutput->CurrentMediaType()) || CheckDTS(&m_pOutput->CurrentMediaType())))
- {
- if((m_pOutput->CurrentMediaType().majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
- || m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
- && (len + 12 + 3) >= 0x10000) // damn, this can happen if the interleave time is too big
- {
- REFERENCE_TIME rtStart = 0, rtStop = 1;
- bool fHasTime = (S_OK == pSample->GetTime(&rtStart, &rtStop));
-
- bool fDiscontinuity = (S_OK == pOutSample->IsDiscontinuity());
-
- int pos = 0;
- while(pos < len)
- {
- int curlen = min(len - pos, 2013);
- pos += 2013;
-
- CComPtr<IMediaSample> pOutSample;
- hr = InitializeOutputSample(pSample, &pOutSample);
-
- if(fDiscontinuity)
- {
- if(fHasTime)
- {
- rtStop = rtStart + (rtStop - rtStart) * curlen / len;
- pOutSample->SetTime(&rtStart, &rtStop);
- }
-
- fDiscontinuity = false;
- }
- else
- {
- pOutSample->SetTime(NULL, NULL);
- pOutSample->SetDiscontinuity(FALSE);
- }
-
- BYTE* pOut = NULL;
- if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
- BYTE* pOutOrg = pOut;
-
- int size = pOutSample->GetSize();
-
- const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
- const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
-
- if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- {
- if(size < curlen + 32 + 3) return E_FAIL;
-
- BYTE PESHeader[] =
- {
- 0x00, 0x00, 0x01, 0xBA, // PES id
- 0x44, 0x00, 0x04, 0x00, 0x04, 0x01, // SCR (0)
- 0x01, 0x89, 0xC3, 0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
- };
-
- memcpy(pOut, &PESHeader, sizeof(PESHeader));
- pOut += sizeof(PESHeader);
-
- majortype = &MEDIATYPE_MPEG2_PES;
- }
-
- if(*majortype == MEDIATYPE_MPEG2_PES)
- {
- if(size < curlen + 20 + 3) return E_FAIL;
-
- BYTE Private1Header[] =
- {
- 0x00, 0x00, 0x01, 0xBD, // private stream 1 id
- 0x07, 0xEC, // packet length (TODO: modify it later)
- 0x81, 0x80, // marker, original, PTS - flags
- 0x08, // packet data starting offset
- 0x21, 0x00, 0x01, 0x00, 0x01, // PTS (0)
- 0xFF, 0xFF, 0xFF, // stuffing
- 0x80, // stream id (0)
- 0x01, 0x00, 0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
- };
-
- int packetlen = curlen + 12 + 3;
- ASSERT(packetlen <= 0xffff);
- Private1Header[4] = (packetlen >> 8) & 0xff;
- Private1Header[5] = packetlen & 0xff;
-
- if(*subtype == MEDIASUBTYPE_DTS)
- {
- Private1Header[17] += 8;
- }
-
- if(*subtype == MEDIASUBTYPE_DOLBY_AC3)
- {
- for(int i = 0; i < curlen; i++)
- {
- if(*(DWORD*)&pIn[i] == 0x770B)
- {
- i++;
- Private1Header[19] = (i >> 8) & 0xff;
- Private1Header[20] = i & 0xff;
- break;
- }
- }
- }
- else if(*subtype == MEDIASUBTYPE_DTS)
- {
- for(int i = 0; i < curlen; i++)
- {
- if(*(DWORD*)&pIn[i] == 0x0180FE7F)
- {
- i++;
- Private1Header[19] = (i >> 8) & 0xff;
- Private1Header[20] = i & 0xff;
- break;
- }
- }
- }
-
- memcpy(pOut, &Private1Header, sizeof(Private1Header));
- pOut += sizeof(Private1Header);
-
- majortype = &MEDIATYPE_Audio;
- }
-
- if(*majortype == MEDIATYPE_Audio)
- {
- if(size < curlen) return E_FAIL;
- memcpy(pOut, pIn, curlen);
- pIn += curlen;
- pOut += curlen;
- }
-
- pOutSample->SetActualDataLength(pOut - pOutOrg);
-
- hr = m_pOutput->Deliver(pOutSample);
- }
-
- return S_FALSE;
- }
- else // phew, we can do the easier way
- {
- const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
- const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
-
- if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- {
- if(size < len + 32 + 3) return E_FAIL;
-
- BYTE PESHeader[] =
- {
- 0x00, 0x00, 0x01, 0xBA, // PES id
- 0x44, 0x00, 0x04, 0x00, 0x04, 0x01, // SCR (0)
- 0x01, 0x89, 0xC3, 0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
- };
-
- memcpy(pOut, &PESHeader, sizeof(PESHeader));
- pOut += sizeof(PESHeader);
-
- majortype = &MEDIATYPE_MPEG2_PES;
- }
-
- if(*majortype == MEDIATYPE_MPEG2_PES)
- {
- if(size < len + 20 + 3) return E_FAIL;
-
- BYTE Private1Header[] =
- {
- 0x00, 0x00, 0x01, 0xBD, // private stream 1 id
- 0x07, 0xEC, // packet length (TODO: modify it later)
- 0x81, 0x80, // marker, original, PTS - flags
- 0x08, // packet data starting offset
- 0x21, 0x00, 0x01, 0x00, 0x01, // PTS (0)
- 0xFF, 0xFF, 0xFF, // stuffing
- 0x80, // stream id (0)
- 0x01, 0x00, 0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
- };
-
- int packetlen = len + 12 + 3;
- ASSERT(packetlen <= 0xffff);
- Private1Header[4] = (packetlen >> 8) & 0xff;
- Private1Header[5] = packetlen & 0xff;
-
- if(*subtype == MEDIASUBTYPE_DTS)
- {
- Private1Header[17] += 8;
- }
-
- memcpy(pOut, &Private1Header, sizeof(Private1Header));
- pOut += sizeof(Private1Header);
-
- majortype = &MEDIATYPE_Audio;
- }
-
- if(*majortype == MEDIATYPE_Audio)
- {
- if(size < len) return E_FAIL;
-
- memcpy(pOut, pIn, len);
- pIn += len;
- pOut += len;
- }
- }
- }
- else
- {
- return E_FAIL;
- }
-
- pOutSample->SetActualDataLength(pOut - pOutOrg);
-
- return S_OK;
+ HRESULT hr;
+
+ BYTE* pIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
+ BYTE* pInOrg = pIn;
+
+ long len = pSample->GetActualDataLength();
+ if(len <= 0) return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ BYTE* pOutOrg = pOut;
+
+ int size = pOutSample->GetSize();
+
+ if((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ && (CheckWAVEAC3(&m_pOutput->CurrentMediaType()) || CheckWAVEDTS(&m_pOutput->CurrentMediaType())))
+ {
+ if(*(DWORD*)pIn == 0xBA010000)
+ {
+ pIn += 14;
+ }
+
+ if(*(DWORD*)pIn == 0xBD010000)
+ {
+ pIn += 8 + 1 + pIn[8] + 1 + 3;
+ }
+
+ len -= (pInOrg - pIn);
+
+ if(size < len) return E_FAIL;
+
+ memcpy(pOut, pIn, len);
+ pOut += len;
+ }
+ else if((CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
+ && (CheckAC3(&m_pOutput->CurrentMediaType()) || CheckDTS(&m_pOutput->CurrentMediaType())))
+ {
+ if((m_pOutput->CurrentMediaType().majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ || m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
+ && (len + 12 + 3) >= 0x10000) // damn, this can happen if the interleave time is too big
+ {
+ REFERENCE_TIME rtStart = 0, rtStop = 1;
+ bool fHasTime = (S_OK == pSample->GetTime(&rtStart, &rtStop));
+
+ bool fDiscontinuity = (S_OK == pOutSample->IsDiscontinuity());
+
+ int pos = 0;
+ while(pos < len)
+ {
+ int curlen = min(len - pos, 2013);
+ pos += 2013;
+
+ CComPtr<IMediaSample> pOutSample;
+ hr = InitializeOutputSample(pSample, &pOutSample);
+
+ if(fDiscontinuity)
+ {
+ if(fHasTime)
+ {
+ rtStop = rtStart + (rtStop - rtStart) * curlen / len;
+ pOutSample->SetTime(&rtStart, &rtStop);
+ }
+
+ fDiscontinuity = false;
+ }
+ else
+ {
+ pOutSample->SetTime(NULL, NULL);
+ pOutSample->SetDiscontinuity(FALSE);
+ }
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ BYTE* pOutOrg = pOut;
+
+ int size = pOutSample->GetSize();
+
+ const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
+ const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ if(size < curlen + 32 + 3) return E_FAIL;
+
+ BYTE PESHeader[] =
+ {
+ 0x00,0x00,0x01,0xBA, // PES id
+ 0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
+ 0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(size < curlen + 20 + 3) return E_FAIL;
+
+ BYTE Private1Header[] =
+ {
+ 0x00,0x00,0x01,0xBD, // private stream 1 id
+ 0x07,0xEC, // packet length (TODO: modify it later)
+ 0x81,0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21,0x00,0x01,0x00,0x01, // PTS (0)
+ 0xFF,0xFF,0xFF, // stuffing
+ 0x80, // stream id (0)
+ 0x01,0x00,0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
+ };
+
+ int packetlen = curlen + 12 + 3;
+ ASSERT(packetlen <= 0xffff);
+ Private1Header[4] = (packetlen>>8)&0xff;
+ Private1Header[5] = packetlen&0xff;
+
+ if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ Private1Header[17] += 8;
+ }
+
+ if(*subtype == MEDIASUBTYPE_DOLBY_AC3)
+ {
+ for(int i = 0; i < curlen; i++)
+ {
+ if(*(DWORD*)&pIn[i] == 0x770B)
+ {
+ i++;
+ Private1Header[19] = (i>>8)&0xff;
+ Private1Header[20] = i&0xff;
+ break;
+ }
+ }
+ }
+ else if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ for(int i = 0; i < curlen; i++)
+ {
+ if(*(DWORD*)&pIn[i] == 0x0180FE7F)
+ {
+ i++;
+ Private1Header[19] = (i>>8)&0xff;
+ Private1Header[20] = i&0xff;
+ break;
+ }
+ }
+ }
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ if(size < curlen) return E_FAIL;
+ memcpy(pOut, pIn, curlen);
+ pIn += curlen;
+ pOut += curlen;
+ }
+
+ pOutSample->SetActualDataLength(pOut - pOutOrg);
+
+ hr = m_pOutput->Deliver(pOutSample);
+ }
+
+ return S_FALSE;
+ }
+ else // phew, we can do the easier way
+ {
+ const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
+ const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ if(size < len + 32 + 3) return E_FAIL;
+
+ BYTE PESHeader[] =
+ {
+ 0x00,0x00,0x01,0xBA, // PES id
+ 0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
+ 0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(size < len + 20 + 3) return E_FAIL;
+
+ BYTE Private1Header[] =
+ {
+ 0x00,0x00,0x01,0xBD, // private stream 1 id
+ 0x07,0xEC, // packet length (TODO: modify it later)
+ 0x81,0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21,0x00,0x01,0x00,0x01, // PTS (0)
+ 0xFF,0xFF,0xFF, // stuffing
+ 0x80, // stream id (0)
+ 0x01,0x00,0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
+ };
+
+ int packetlen = len + 12 + 3;
+ ASSERT(packetlen <= 0xffff);
+ Private1Header[4] = (packetlen>>8)&0xff;
+ Private1Header[5] = packetlen&0xff;
+
+ if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ Private1Header[17] += 8;
+ }
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ if(size < len) return E_FAIL;
+
+ memcpy(pOut, pIn, len);
+ pIn += len;
+ pOut += len;
+ }
+ }
+ }
+ else
+ {
+ return E_FAIL;
+ }
+
+ pOutSample->SetActualDataLength(pOut - pOutOrg);
+
+ return S_OK;
}
bool CAVI2AC3Filter::CheckAC3(const CMediaType* pmt)
{
- return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
- || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
}
bool CAVI2AC3Filter::CheckDTS(const CMediaType* pmt)
{
- return (pmt->majortype == MEDIATYPE_Audio
- || pmt->majortype == MEDIATYPE_MPEG2_PES
- || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
- && pmt->subtype == MEDIASUBTYPE_DTS;
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DTS;
}
bool CAVI2AC3Filter::CheckWAVEAC3(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
}
bool CAVI2AC3Filter::CheckWAVEDTS(const CMediaType* pmt)
{
- return pmt->majortype == MEDIATYPE_Audio
- && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
- && pmt->formattype == FORMAT_WaveFormatEx
- && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
}
HRESULT CAVI2AC3Filter::CheckInputType(const CMediaType* mtIn)
{
- bool fWaveFormatEx = !!(mtIn->formattype == FORMAT_WaveFormatEx);
+ bool fWaveFormatEx = !!(mtIn->formattype == FORMAT_WaveFormatEx);
- return CheckAC3(mtIn) && fWaveFormatEx || CheckDTS(mtIn) && fWaveFormatEx
- || CheckWAVEAC3(mtIn) || CheckWAVEDTS(mtIn)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return CheckAC3(mtIn) && fWaveFormatEx || CheckDTS(mtIn) && fWaveFormatEx
+ || CheckWAVEAC3(mtIn) || CheckWAVEDTS(mtIn)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CAVI2AC3Filter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return CheckAC3(mtIn) && CheckWAVEAC3(mtOut)
- || CheckWAVEAC3(mtIn) && CheckAC3(mtOut)
- || CheckDTS(mtIn) && CheckWAVEDTS(mtOut)
- || CheckWAVEDTS(mtIn) && CheckDTS(mtOut)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return CheckAC3(mtIn) && CheckWAVEAC3(mtOut)
+ || CheckWAVEAC3(mtIn) && CheckAC3(mtOut)
+ || CheckDTS(mtIn) && CheckWAVEDTS(mtOut)
+ || CheckWAVEDTS(mtIn) && CheckDTS(mtOut)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CAVI2AC3Filter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- CComPtr<IMemAllocator> pAllocatorIn;
- m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
- pAllocatorIn->GetProperties(pProperties);
+ pAllocatorIn->GetProperties(pProperties);
- pProperties->cBuffers = 2;
- pProperties->cbBuffer = max(pProperties->cbBuffer, 1024 * 1024); // this should be enough...
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ pProperties->cBuffers = 2;
+ pProperties->cbBuffer = max(pProperties->cbBuffer, 1024*1024); // this should be enough...
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- const GUID& majortype = m_pInput->CurrentMediaType().majortype;
- const GUID& subtype = m_pInput->CurrentMediaType().subtype;
-
- if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
- {
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
-
- pMediaType->majortype = MEDIATYPE_Audio;
-
- pMediaType->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->nAvgBytesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nAvgBytesPerSec;
- wfe->nSamplesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nSamplesPerSec;
- wfe->wBitsPerSample = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->wBitsPerSample;
- wfe->nChannels = 2;
- wfe->nBlockAlign = 1;
-
- if(subtype == MEDIASUBTYPE_DOLBY_AC3)
- {
- pMediaType->subtype = MEDIASUBTYPE_WAVE_DOLBY_AC3;
- wfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- }
- else if(subtype == MEDIASUBTYPE_DTS)
- {
- pMediaType->subtype = MEDIASUBTYPE_WAVE_DTS;
- wfe->wFormatTag = WAVE_FORMAT_DVD_DTS;
- }
- else
- {
- return E_INVALIDARG;
- }
- }
- else if(CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
- {
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 4) return VFW_S_NO_MORE_ITEMS;
-
- if(subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
- {
- pMediaType->subtype = MEDIASUBTYPE_DOLBY_AC3;
-
- pMediaType->formattype = FORMAT_WaveFormatEx;
- DOLBYAC3WAVEFORMAT* wfe = (DOLBYAC3WAVEFORMAT*)pMediaType->AllocFormatBuffer(sizeof(DOLBYAC3WAVEFORMAT));
- memset(wfe, 0, sizeof(DOLBYAC3WAVEFORMAT));
- // unfortunately we can't tell what we are going to get in transform,
- // so we just set the most common values and hope that the ac3 decoder
- // is flexible enough (it is usually :) to find out these from the bitstream
- wfe->wfx.cbSize = sizeof(DOLBYAC3WAVEFORMAT) - sizeof(WAVEFORMATEX);
- wfe->wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
- wfe->wfx.nSamplesPerSec = 48000;
- wfe->wfx.nChannels = 6;
- wfe->bBigEndian = TRUE;
- }
- else if(subtype == MEDIASUBTYPE_WAVE_DTS)
- {
- pMediaType->subtype = MEDIASUBTYPE_DTS;
-
- pMediaType->formattype = FORMAT_WaveFormatEx;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
- memset(wfe, 0, sizeof(WAVEFORMATEX));
- // same case as with ac3, but this time we don't even know the structure
- wfe->cbSize = sizeof(WAVEFORMATEX);
- wfe->wFormatTag = WAVE_FORMAT_PCM;
- wfe->nSamplesPerSec = 48000;
- wfe->nChannels = 6;
- }
- else
- {
- return E_INVALIDARG;
- }
-
- switch(iPosition)
- {
- case 0:
- pMediaType->majortype = MEDIATYPE_Audio;
- break;
- case 1:
- pMediaType->ResetFormatBuffer();
- pMediaType->formattype = FORMAT_None;
- case 2:
- pMediaType->majortype = MEDIATYPE_MPEG2_PES;
- break;
- case 3:
- pMediaType->ResetFormatBuffer();
- pMediaType->formattype = FORMAT_None;
- case 4:
- pMediaType->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
- break;
- default:
- return E_INVALIDARG;
- }
- }
- else
- {
- return VFW_S_NO_MORE_ITEMS;
- }
-
- return S_OK;
+ const GUID& majortype = m_pInput->CurrentMediaType().majortype;
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ {
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pMediaType->majortype = MEDIATYPE_Audio;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->nAvgBytesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nAvgBytesPerSec;
+ wfe->nSamplesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nSamplesPerSec;
+ wfe->wBitsPerSample = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->wBitsPerSample;
+ wfe->nChannels = 2;
+ wfe->nBlockAlign = 1;
+
+ if(subtype == MEDIASUBTYPE_DOLBY_AC3)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_WAVE_DOLBY_AC3;
+ wfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ }
+ else if(subtype == MEDIASUBTYPE_DTS)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_WAVE_DTS;
+ wfe->wFormatTag = WAVE_FORMAT_DVD_DTS;
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+ }
+ else if(CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
+ {
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 4) return VFW_S_NO_MORE_ITEMS;
+
+ if(subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_DOLBY_AC3;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ DOLBYAC3WAVEFORMAT* wfe = (DOLBYAC3WAVEFORMAT*)pMediaType->AllocFormatBuffer(sizeof(DOLBYAC3WAVEFORMAT));
+ memset(wfe, 0, sizeof(DOLBYAC3WAVEFORMAT));
+ // unfortunately we can't tell what we are going to get in transform,
+ // so we just set the most common values and hope that the ac3 decoder
+ // is flexible enough (it is usually :) to find out these from the bitstream
+ wfe->wfx.cbSize = sizeof(DOLBYAC3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+ wfe->wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ wfe->wfx.nSamplesPerSec = 48000;
+ wfe->wfx.nChannels = 6;
+ wfe->bBigEndian = TRUE;
+ }
+ else if(subtype == MEDIASUBTYPE_WAVE_DTS)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_DTS;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ // same case as with ac3, but this time we don't even know the structure
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nSamplesPerSec = 48000;
+ wfe->nChannels = 6;
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+
+ switch(iPosition)
+ {
+ case 0:
+ pMediaType->majortype = MEDIATYPE_Audio;
+ break;
+ case 1:
+ pMediaType->ResetFormatBuffer();
+ pMediaType->formattype = FORMAT_None;
+ case 2:
+ pMediaType->majortype = MEDIATYPE_MPEG2_PES;
+ break;
+ case 3:
+ pMediaType->ResetFormatBuffer();
+ pMediaType->formattype = FORMAT_None;
+ case 4:
+ pMediaType->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
+ break;
+ default:
+ return E_INVALIDARG;
+ }
+ }
+ else
+ {
+ return VFW_S_NO_MORE_ITEMS;
+ }
+
+ return S_OK;
}
diff --git a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h
index 1bc126606..30d36fa51 100644
--- a/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h
+++ b/src/filters/transform/AVI2AC3Filter/AVI2AC3Filter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -49,18 +49,18 @@ typedef struct tagDOLBYAC3WAVEFORMAT
[uuid("93230DD0-7B3C-4efb-AFBB-DC380FEC9E6B")]
class CAVI2AC3Filter : public CTransformFilter
{
- bool CheckAC3(const CMediaType* pmt);
- bool CheckDTS(const CMediaType* pmt);
- bool CheckWAVEAC3(const CMediaType* pmt);
- bool CheckWAVEDTS(const CMediaType* pmt);
+ bool CheckAC3(const CMediaType* pmt);
+ bool CheckDTS(const CMediaType* pmt);
+ bool CheckWAVEAC3(const CMediaType* pmt);
+ bool CheckWAVEDTS(const CMediaType* pmt);
public:
- CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CAVI2AC3Filter();
+ CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CAVI2AC3Filter();
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
};
diff --git a/src/filters/transform/AVI2AC3Filter/resource.h b/src/filters/transform/AVI2AC3Filter/resource.h
index b4c366537..599923e8b 100644
--- a/src/filters/transform/AVI2AC3Filter/resource.h
+++ b/src/filters/transform/AVI2AC3Filter/resource.h
@@ -3,7 +3,7 @@
// Used by avi2ac3filter.rc
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
diff --git a/src/filters/transform/AVI2AC3Filter/stdafx.cpp b/src/filters/transform/AVI2AC3Filter/stdafx.cpp
index a97315dee..0ad87fbc7 100644
--- a/src/filters/transform/AVI2AC3Filter/stdafx.cpp
+++ b/src/filters/transform/AVI2AC3Filter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/AVI2AC3Filter/stdafx.h b/src/filters/transform/AVI2AC3Filter/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/transform/AVI2AC3Filter/stdafx.h
+++ b/src/filters/transform/AVI2AC3Filter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
index f3aa7d16b..93e91fcd5 100644
--- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
+++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,28 +33,24 @@
//
bool f_need_set_aspect;
-CBaseVideoFilter::CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers)
- : CTransformFilter(pName, lpunk, clsid)
- , m_cBuffers(cBuffers)
+CBaseVideoFilter::CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers)
+ : CTransformFilter(pName, lpunk, clsid)
+ , m_cBuffers(cBuffers)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- if(!(m_pInput = DNew CBaseVideoInputPin(NAME("CBaseVideoInputPin"), this, phr, L"Video"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
+ if(!(m_pInput = DNew CBaseVideoInputPin(NAME("CBaseVideoInputPin"), this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
- if(!(m_pOutput = DNew CBaseVideoOutputPin(NAME("CBaseVideoOutputPin"), this, phr, L"Output"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr))
- {
- delete m_pInput, m_pInput = NULL;
- return;
- }
+ if(!(m_pOutput = DNew CBaseVideoOutputPin(NAME("CBaseVideoOutputPin"), this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
- m_wout = m_win = m_w = 0;
- m_hout = m_hin = m_h = 0;
- m_arxout = m_arxin = m_arx = 0;
- m_aryout = m_aryin = m_ary = 0;
+ m_wout = m_win = m_w = 0;
+ m_hout = m_hin = m_h = 0;
+ m_arxout = m_arxin = m_arx = 0;
+ m_aryout = m_aryin = m_ary = 0;
- f_need_set_aspect = false;
+ f_need_set_aspect = false;
}
CBaseVideoFilter::~CBaseVideoFilter()
@@ -63,641 +59,624 @@ CBaseVideoFilter::~CBaseVideoFilter()
void CBaseVideoFilter::SetAspect(CSize aspect)
{
- f_need_set_aspect = true;
- m_arx = aspect.cx;
- m_ary = aspect.cy;
+ f_need_set_aspect = true;
+ m_arx = aspect.cx;
+ m_ary = aspect.cy;
}
int CBaseVideoFilter::GetPinCount()
{
- return 2;
+ return 2;
}
CBasePin* CBaseVideoFilter::GetPin(int n)
{
- switch(n)
- {
- case 0:
- return m_pInput;
- case 1:
- return m_pOutput;
- }
- return NULL;
+ switch(n)
+ {
+ case 0: return m_pInput;
+ case 1: return m_pOutput;
+ }
+ return NULL;
}
HRESULT CBaseVideoFilter::Receive(IMediaSample* pIn)
{
#ifndef _WIN64
- // TODOX64 : fixme!
- _mm_empty(); // just for safety
+ // TODOX64 : fixme!
+ _mm_empty(); // just for safety
#endif
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- HRESULT hr;
+ HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
if(pProps->dwStreamId != AM_STREAM_MEDIA)
- return m_pOutput->Deliver(pIn);
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- m_pInput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
+ return m_pOutput->Deliver(pIn);
- if(FAILED(hr = Transform(pIn)))
- return hr;
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pInput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
- return S_OK;
+ if(FAILED(hr = Transform(pIn)))
+ return hr;
+
+ return S_OK;
}
HRESULT CBaseVideoFilter::GetDeliveryBuffer(int w, int h, IMediaSample** ppOut)
{
- CheckPointer(ppOut, E_POINTER);
+ CheckPointer(ppOut, E_POINTER);
- HRESULT hr;
+ HRESULT hr;
- if(FAILED(hr = ReconnectOutput(w, h)))
- return hr;
+ if(FAILED(hr = ReconnectOutput(w, h)))
+ return hr;
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(ppOut, NULL, NULL, 0)))
- return hr;
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(ppOut, NULL, NULL, 0)))
+ return hr;
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED((*ppOut)->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt = *pmt;
- m_pOutput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED((*ppOut)->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
- (*ppOut)->SetDiscontinuity(FALSE);
- (*ppOut)->SetSyncPoint(TRUE);
+ (*ppOut)->SetDiscontinuity(FALSE);
+ (*ppOut)->SetSyncPoint(TRUE);
- // FIXME: hell knows why but without this the overlay mixer starts very skippy
- // (don't enable this for other renderers, the old for example will go crazy if you do)
- if(GetCLSID(m_pOutput->GetConnected()) == CLSID_OverlayMixer)
- (*ppOut)->SetDiscontinuity(TRUE);
+ // FIXME: hell knows why but without this the overlay mixer starts very skippy
+ // (don't enable this for other renderers, the old for example will go crazy if you do)
+ if(GetCLSID(m_pOutput->GetConnected()) == CLSID_OverlayMixer)
+ (*ppOut)->SetDiscontinuity(TRUE);
- return S_OK;
+ return S_OK;
}
HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h, bool bSendSample, int realWidth, int realHeight)
{
- CMediaType& mt = m_pOutput->CurrentMediaType();
-
- bool m_update_aspect = false;
- if(f_need_set_aspect)
- {
- int wout = 0, hout = 0, arxout = 0, aryout = 0;
- ExtractDim(&mt, wout, hout, arxout, aryout);
- if(arxout != m_arx || aryout != m_ary)
- {
- CString debug_s;
- debug_s.Format(_T("\nCBaseVideoFilter::ReconnectOutput; wout = %d, hout = %d, current = %dx%d, set = %dx%d\n"), wout, hout, arxout, aryout, m_arx, m_ary);
- TRACE(debug_s);
- m_update_aspect = true;
- }
- }
-
- int w_org = m_w;
- int h_org = m_h;
-
- bool fForceReconnection = false;
- if(w != m_w || h != m_h)
- {
- fForceReconnection = true;
- m_w = w;
- m_h = h;
- }
-
- HRESULT hr = S_OK;
-
- if(m_update_aspect || fForceReconnection || m_w != m_wout || m_h != m_hout || m_arx != m_arxout || m_ary != m_aryout)
- {
- if(GetCLSID(m_pOutput->GetConnected()) == CLSID_VideoRenderer)
- {
- NotifyEvent(EC_ERRORABORT, 0, 0);
- return E_FAIL;
- }
-
- BITMAPINFOHEADER* bmi = NULL;
-
- if(mt.formattype == FORMAT_VideoInfo)
- {
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.Format();
- if(realWidth != -1 && realHeight != -1)
- {
- SetRect(&vih->rcSource, 0, 0, realWidth, realHeight);
- SetRect(&vih->rcTarget, 0, 0, realWidth, realHeight);
- }
- else
- {
- SetRect(&vih->rcSource, 0, 0, m_w, m_h);
- SetRect(&vih->rcTarget, 0, 0, m_w, m_h);
- }
- bmi = &vih->bmiHeader;
- bmi->biXPelsPerMeter = m_w * m_ary;
- bmi->biYPelsPerMeter = m_h * m_arx;
- }
- else if(mt.formattype == FORMAT_VideoInfo2)
- {
- VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)mt.Format();
- if(realWidth != -1 && realHeight != -1)
- {
- SetRect(&vih->rcSource, 0, 0, realWidth, realHeight);
- SetRect(&vih->rcTarget, 0, 0, realWidth, realHeight);
- }
- else
- {
- SetRect(&vih->rcSource, 0, 0, m_w, m_h);
- SetRect(&vih->rcTarget, 0, 0, m_w, m_h);
- }
- bmi = &vih->bmiHeader;
- vih->dwPictAspectRatioX = m_arx;
- vih->dwPictAspectRatioY = m_ary;
- }
-
- bmi->biWidth = m_w;
- bmi->biHeight = m_h;
- bmi->biSizeImage = m_w * m_h * bmi->biBitCount >> 3;
-
- hr = m_pOutput->GetConnected()->QueryAccept(&mt);
- ASSERT(SUCCEEDED(hr)); // should better not fail, after all "mt" is the current media type, just with a different resolution
- HRESULT hr1 = 0, hr2 = 0;
- CComPtr<IMediaSample> pOut;
- if(SUCCEEDED(hr1 = m_pOutput->GetConnected()->ReceiveConnection(m_pOutput, &mt)))
- {
- if(bSendSample)
- {
- if(SUCCEEDED(hr2 = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0)))
- {
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt = *pmt;
- m_pOutput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
- else // stupid overlay mixer won't let us know the new pitch...
- {
- long size = pOut->GetSize();
- bmi->biWidth = size / bmi->biHeight * 8 / bmi->biBitCount;
- }
- }
- else
- {
- m_w = w_org;
- m_h = h_org;
- return E_FAIL;
- }
- }
- }
-
- m_wout = m_w;
- m_hout = m_h;
- m_arxout = m_arx;
- m_aryout = m_ary;
-
- // some renderers don't send this
- NotifyEvent(EC_VIDEO_SIZE_CHANGED, MAKELPARAM(m_w, m_h), 0);
-
- return S_OK;
- }
-
- return S_FALSE;
+ CMediaType& mt = m_pOutput->CurrentMediaType();
+
+ bool m_update_aspect = false;
+ if(f_need_set_aspect)
+ {
+ int wout = 0, hout = 0, arxout = 0, aryout = 0;
+ ExtractDim(&mt, wout, hout, arxout, aryout);
+ if(arxout != m_arx || aryout != m_ary)
+ {
+ CString debug_s;
+ debug_s.Format(_T("\nCBaseVideoFilter::ReconnectOutput; wout = %d, hout = %d, current = %dx%d, set = %dx%d\n"), wout, hout, arxout, aryout, m_arx, m_ary);
+ TRACE(debug_s);
+ m_update_aspect = true;
+ }
+ }
+
+ int w_org = m_w;
+ int h_org = m_h;
+
+ bool fForceReconnection = false;
+ if(w != m_w || h != m_h)
+ {
+ fForceReconnection = true;
+ m_w = w;
+ m_h = h;
+ }
+
+ HRESULT hr = S_OK;
+
+ if(m_update_aspect || fForceReconnection || m_w != m_wout || m_h != m_hout || m_arx != m_arxout || m_ary != m_aryout)
+ {
+ if(GetCLSID(m_pOutput->GetConnected()) == CLSID_VideoRenderer)
+ {
+ NotifyEvent(EC_ERRORABORT, 0, 0);
+ return E_FAIL;
+ }
+
+ BITMAPINFOHEADER* bmi = NULL;
+
+ if(mt.formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.Format();
+ if (realWidth != -1 && realHeight != -1)
+ {
+ SetRect(&vih->rcSource, 0, 0, realWidth, realHeight);
+ SetRect(&vih->rcTarget, 0, 0, realWidth, realHeight);
+ }
+ else
+ {
+ SetRect(&vih->rcSource, 0, 0, m_w, m_h);
+ SetRect(&vih->rcTarget, 0, 0, m_w, m_h);
+ }
+ bmi = &vih->bmiHeader;
+ bmi->biXPelsPerMeter = m_w * m_ary;
+ bmi->biYPelsPerMeter = m_h * m_arx;
+ }
+ else if(mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)mt.Format();
+ if (realWidth != -1 && realHeight != -1)
+ {
+ SetRect(&vih->rcSource, 0, 0, realWidth, realHeight);
+ SetRect(&vih->rcTarget, 0, 0, realWidth, realHeight);
+ }
+ else
+ {
+ SetRect(&vih->rcSource, 0, 0, m_w, m_h);
+ SetRect(&vih->rcTarget, 0, 0, m_w, m_h);
+ }
+ bmi = &vih->bmiHeader;
+ vih->dwPictAspectRatioX = m_arx;
+ vih->dwPictAspectRatioY = m_ary;
+ }
+
+ bmi->biWidth = m_w;
+ bmi->biHeight = m_h;
+ bmi->biSizeImage = m_w*m_h*bmi->biBitCount>>3;
+
+ hr = m_pOutput->GetConnected()->QueryAccept(&mt);
+ ASSERT(SUCCEEDED(hr)); // should better not fail, after all "mt" is the current media type, just with a different resolution
+ HRESULT hr1 = 0, hr2 = 0;
+ CComPtr<IMediaSample> pOut;
+ if(SUCCEEDED(hr1 = m_pOutput->GetConnected()->ReceiveConnection(m_pOutput, &mt)))
+ {
+ if (bSendSample)
+ {
+ if (SUCCEEDED(hr2 = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0)))
+ {
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+ else // stupid overlay mixer won't let us know the new pitch...
+ {
+ long size = pOut->GetSize();
+ bmi->biWidth = size / bmi->biHeight * 8 / bmi->biBitCount;
+ }
+ }
+ else
+ {
+ m_w = w_org;
+ m_h = h_org;
+ return E_FAIL;
+ }
+ }
+ }
+
+ m_wout = m_w;
+ m_hout = m_h;
+ m_arxout = m_arx;
+ m_aryout = m_ary;
+
+ // some renderers don't send this
+ NotifyEvent(EC_VIDEO_SIZE_CHANGED, MAKELPARAM(m_w, m_h), 0);
+
+ return S_OK;
+ }
+
+ return S_FALSE;
}
HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced)
{
- int abs_h = abs(h);
- BYTE* pInYUV[3] = {pIn, pIn + pitchIn*abs_h, pIn + pitchIn*abs_h + (pitchIn >> 1)*(abs_h >> 1)};
- return CopyBuffer(pOut, pInYUV, w, h, pitchIn, subtype, fInterlaced);
+ int abs_h = abs(h);
+ BYTE* pInYUV[3] = {pIn, pIn + pitchIn*abs_h, pIn + pitchIn*abs_h + (pitchIn>>1)*(abs_h>>1)};
+ return CopyBuffer(pOut, pInYUV, w, h, pitchIn, subtype, fInterlaced);
}
HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced)
{
- BITMAPINFOHEADER bihOut;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
-
- int pitchOut = 0;
-
- if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
- {
- pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
-
- if(bihOut.biHeight > 0)
- {
- pOut += pitchOut * (h - 1);
- pitchOut = -pitchOut;
- if(h < 0) h = -h;
- }
- }
-
- if(h < 0)
- {
- h = -h;
- ppIn[0] += pitchIn * (h - 1);
- ppIn[1] += (pitchIn >> 1) * ((h >> 1) - 1);
- ppIn[2] += (pitchIn >> 1) * ((h >> 1) - 1);
- pitchIn = -pitchIn;
- }
-
- if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12)
- {
- BYTE* pIn = ppIn[0];
- BYTE* pInU = ppIn[1];
- BYTE* pInV = ppIn[2];
-
- if(subtype == MEDIASUBTYPE_YV12)
- {
- BYTE* tmp = pInU;
- pInU = pInV;
- pInV = tmp;
- }
-
- BYTE* pOutU = pOut + bihOut.biWidth * h;
- BYTE* pOutV = pOut + bihOut.biWidth * h * 5 / 4;
-
- if(bihOut.biCompression == '21VY')
- {
- BYTE* tmp = pOutU;
- pOutU = pOutV;
- pOutV = tmp;
- }
-
- ASSERT(w <= abs(pitchIn));
-
- if(bihOut.biCompression == '2YUY')
- {
- BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth * 2, pIn, pInU, pInV, pitchIn, fInterlaced);
- }
- else if(bihOut.biCompression == '024I' || bihOut.biCompression == 'VUYI' || bihOut.biCompression == '21VY')
- {
- BitBltFromI420ToI420(w, h, pOut, pOutU, pOutV, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
- }
- else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
- {
- if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn))
- {
- for(DWORD y = 0; y < h; y++, pOut += pitchOut)
- memset(pOut, 0, pitchOut);
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_YUY2)
- {
- if(bihOut.biCompression == '2YUY')
- {
- BitBltFromYUY2ToYUY2(w, h, pOut, bihOut.biWidth * 2, ppIn[0], pitchIn);
- }
- else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
- {
- if(!BitBltFromYUY2ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn))
- {
- for(DWORD y = 0; y < h; y++, pOut += pitchOut)
- memset(pOut, 0, pitchOut);
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_RGB24 || subtype == MEDIASUBTYPE_RGB565)
- {
- int sbpp =
- subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 ? 32 :
- subtype == MEDIASUBTYPE_RGB24 ? 24 :
- subtype == MEDIASUBTYPE_RGB565 ? 16 : 0;
-
- if(bihOut.biCompression == '2YUY')
- {
- // TODO
- // BitBltFromRGBToYUY2();
- }
- else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
- {
- if(!BitBltFromRGBToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn, sbpp))
- {
- for(DWORD y = 0; y < h; y++, pOut += pitchOut)
- memset(pOut, 0, pitchOut);
- }
- }
- }
- else
- {
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- return S_OK;
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ int pitchOut = 0;
+
+ if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
+
+ if(bihOut.biHeight > 0)
+ {
+ pOut += pitchOut*(h-1);
+ pitchOut = -pitchOut;
+ if(h < 0) h = -h;
+ }
+ }
+
+ if(h < 0)
+ {
+ h = -h;
+ ppIn[0] += pitchIn*(h-1);
+ ppIn[1] += (pitchIn>>1)*((h>>1)-1);
+ ppIn[2] += (pitchIn>>1)*((h>>1)-1);
+ pitchIn = -pitchIn;
+ }
+
+ if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12)
+ {
+ BYTE* pIn = ppIn[0];
+ BYTE* pInU = ppIn[1];
+ BYTE* pInV = ppIn[2];
+
+ if(subtype == MEDIASUBTYPE_YV12) {BYTE* tmp = pInU; pInU = pInV; pInV = tmp;}
+
+ BYTE* pOutU = pOut + bihOut.biWidth*h;
+ BYTE* pOutV = pOut + bihOut.biWidth*h*5/4;
+
+ if(bihOut.biCompression == '21VY') {BYTE* tmp = pOutU; pOutU = pOutV; pOutV = tmp;}
+
+ ASSERT(w <= abs(pitchIn));
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pIn, pInU, pInV, pitchIn, fInterlaced);
+ }
+ else if(bihOut.biCompression == '024I' || bihOut.biCompression == 'VUYI' || bihOut.biCompression == '21VY')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOutU, pOutV, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_YUY2)
+ {
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromYUY2ToYUY2(w, h, pOut, bihOut.biWidth*2, ppIn[0], pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ if(!BitBltFromYUY2ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_RGB24 || subtype == MEDIASUBTYPE_RGB565)
+ {
+ int sbpp =
+ subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 ? 32 :
+ subtype == MEDIASUBTYPE_RGB24 ? 24 :
+ subtype == MEDIASUBTYPE_RGB565 ? 16 : 0;
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ // TODO
+ // BitBltFromRGBToYUY2();
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ if(!BitBltFromRGBToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn, sbpp))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+ }
+ else
+ {
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
}
HRESULT CBaseVideoFilter::CheckInputType(const CMediaType* mtIn)
{
- BITMAPINFOHEADER bih;
- ExtractBIH(mtIn, &bih);
-
- return mtIn->majortype == MEDIATYPE_Video
- && (mtIn->subtype == MEDIASUBTYPE_YV12
- || mtIn->subtype == MEDIASUBTYPE_I420
- || mtIn->subtype == MEDIASUBTYPE_IYUV
- || mtIn->subtype == MEDIASUBTYPE_YUY2
- || mtIn->subtype == MEDIASUBTYPE_ARGB32
- || mtIn->subtype == MEDIASUBTYPE_RGB32
- || mtIn->subtype == MEDIASUBTYPE_RGB24
- || mtIn->subtype == MEDIASUBTYPE_RGB565)
- && (mtIn->formattype == FORMAT_VideoInfo
- || mtIn->formattype == FORMAT_VideoInfo2)
- && bih.biHeight > 0
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ BITMAPINFOHEADER bih;
+ ExtractBIH(mtIn, &bih);
+
+ return mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YV12
+ || mtIn->subtype == MEDIASUBTYPE_I420
+ || mtIn->subtype == MEDIASUBTYPE_IYUV
+ || mtIn->subtype == MEDIASUBTYPE_YUY2
+ || mtIn->subtype == MEDIASUBTYPE_ARGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB24
+ || mtIn->subtype == MEDIASUBTYPE_RGB565)
+ && (mtIn->formattype == FORMAT_VideoInfo
+ || mtIn->formattype == FORMAT_VideoInfo2)
+ && bih.biHeight > 0
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CBaseVideoFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- if(FAILED(CheckInputType(mtIn)) || mtOut->majortype != MEDIATYPE_Video)
- return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(mtIn->majortype == MEDIATYPE_Video
- && (mtIn->subtype == MEDIASUBTYPE_YV12
- || mtIn->subtype == MEDIASUBTYPE_I420
- || mtIn->subtype == MEDIASUBTYPE_IYUV))
- {
- if(mtOut->subtype != MEDIASUBTYPE_YV12
- && mtOut->subtype != MEDIASUBTYPE_I420
- && mtOut->subtype != MEDIASUBTYPE_IYUV
- && mtOut->subtype != MEDIASUBTYPE_YUY2
- && mtOut->subtype != MEDIASUBTYPE_ARGB32
- && mtOut->subtype != MEDIASUBTYPE_RGB32
- && mtOut->subtype != MEDIASUBTYPE_RGB24
- && mtOut->subtype != MEDIASUBTYPE_RGB565)
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- else if(mtIn->majortype == MEDIATYPE_Video
- && (mtIn->subtype == MEDIASUBTYPE_YUY2))
- {
- if(mtOut->subtype != MEDIASUBTYPE_YUY2
- && mtOut->subtype != MEDIASUBTYPE_ARGB32
- && mtOut->subtype != MEDIASUBTYPE_RGB32
- && mtOut->subtype != MEDIASUBTYPE_RGB24
- && mtOut->subtype != MEDIASUBTYPE_RGB565)
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- else if(mtIn->majortype == MEDIATYPE_Video
- && (mtIn->subtype == MEDIASUBTYPE_ARGB32
- || mtIn->subtype == MEDIASUBTYPE_RGB32
- || mtIn->subtype == MEDIASUBTYPE_RGB24
- || mtIn->subtype == MEDIASUBTYPE_RGB565))
- {
- if(mtOut->subtype != MEDIASUBTYPE_ARGB32
- && mtOut->subtype != MEDIASUBTYPE_RGB32
- && mtOut->subtype != MEDIASUBTYPE_RGB24
- && mtOut->subtype != MEDIASUBTYPE_RGB565)
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- return S_OK;
+ if(FAILED(CheckInputType(mtIn)) || mtOut->majortype != MEDIATYPE_Video)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YV12
+ || mtIn->subtype == MEDIASUBTYPE_I420
+ || mtIn->subtype == MEDIASUBTYPE_IYUV))
+ {
+ if(mtOut->subtype != MEDIASUBTYPE_YV12
+ && mtOut->subtype != MEDIASUBTYPE_I420
+ && mtOut->subtype != MEDIASUBTYPE_IYUV
+ && mtOut->subtype != MEDIASUBTYPE_YUY2
+ && mtOut->subtype != MEDIASUBTYPE_ARGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB24
+ && mtOut->subtype != MEDIASUBTYPE_RGB565)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YUY2))
+ {
+ if(mtOut->subtype != MEDIASUBTYPE_YUY2
+ && mtOut->subtype != MEDIASUBTYPE_ARGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB24
+ && mtOut->subtype != MEDIASUBTYPE_RGB565)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_ARGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB24
+ || mtIn->subtype == MEDIASUBTYPE_RGB565))
+ {
+ if(mtOut->subtype != MEDIASUBTYPE_ARGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB24
+ && mtOut->subtype != MEDIASUBTYPE_RGB565)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
}
HRESULT CBaseVideoFilter::CheckOutputType(const CMediaType& mtOut)
{
- int wout = 0, hout = 0, arxout = 0, aryout = 0;
- return ExtractDim(&mtOut, wout, hout, arxout, aryout)
- && m_h == abs((int)hout)
- && mtOut.subtype != MEDIASUBTYPE_ARGB32
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ int wout = 0, hout = 0, arxout = 0, aryout = 0;
+ return ExtractDim(&mtOut, wout, hout, arxout, aryout)
+ && m_h == abs((int)hout)
+ && mtOut.subtype != MEDIASUBTYPE_ARGB32
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CBaseVideoFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- BITMAPINFOHEADER bih;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
- long cBuffers = m_pOutput->CurrentMediaType().formattype == FORMAT_VideoInfo ? 1 : m_cBuffers;
+ long cBuffers = m_pOutput->CurrentMediaType().formattype == FORMAT_VideoInfo ? 1 : m_cBuffers;
- pProperties->cBuffers = m_cBuffers;
- pProperties->cbBuffer = bih.biSizeImage;
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ pProperties->cBuffers = m_cBuffers;
+ pProperties->cbBuffer = bih.biSizeImage;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR;
+ ? E_FAIL
+ : NOERROR;
}
VIDEO_OUTPUT_FORMATS DefaultFormats[] =
{
- {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
- {&MEDIASUBTYPE_I420, 3, 12, '024I'},
- {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
- {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
- {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
- {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
- {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
- {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
- {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
- {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
- {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
+ {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
+ {&MEDIASUBTYPE_I420, 3, 12, '024I'},
+ {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
+ {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
};
-void CBaseVideoFilter::GetOutputFormats(int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats)
+void CBaseVideoFilter::GetOutputFormats (int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats)
{
- nNumber = countof(DefaultFormats);
- *ppFormats = DefaultFormats;
+ nNumber = countof(DefaultFormats);
+ *ppFormats = DefaultFormats;
}
HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
- VIDEO_OUTPUT_FORMATS* fmts;
- int nFormatCount;
+ VIDEO_OUTPUT_FORMATS* fmts;
+ int nFormatCount;
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- // this will make sure we won't connect to the old renderer in dvd mode
- // that renderer can't switch the format dynamically
+ // this will make sure we won't connect to the old renderer in dvd mode
+ // that renderer can't switch the format dynamically
- bool fFoundDVDNavigator = false;
- CComPtr<IBaseFilter> pBF = this;
- CComPtr<IPin> pPin = m_pInput;
- for(; !fFoundDVDNavigator && (pBF = GetUpStreamFilter(pBF, pPin)); pPin = GetFirstPin(pBF))
+ bool fFoundDVDNavigator = false;
+ CComPtr<IBaseFilter> pBF = this;
+ CComPtr<IPin> pPin = m_pInput;
+ for(; !fFoundDVDNavigator && (pBF = GetUpStreamFilter(pBF, pPin)); pPin = GetFirstPin(pBF))
fFoundDVDNavigator = GetCLSID(pBF) == CLSID_DVDNavigator;
- if(fFoundDVDNavigator || m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo2)
- iPosition = iPosition * 2;
-
- //
- GetOutputFormats(nFormatCount, &fmts);
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition >= 2 * nFormatCount) return VFW_S_NO_MORE_ITEMS;
-
- pmt->majortype = MEDIATYPE_Video;
- pmt->subtype = *fmts[iPosition/2].subtype;
-
- int w = m_win, h = m_hin, arx = m_arxin, ary = m_aryin;
- int RealWidth = -1;
- int RealHeight = -1;
- GetOutputSize(w, h, arx, ary, RealWidth, RealHeight);
-
- BITMAPINFOHEADER bihOut;
- memset(&bihOut, 0, sizeof(bihOut));
- bihOut.biSize = sizeof(bihOut);
- bihOut.biWidth = w;
- bihOut.biHeight = h;
- bihOut.biPlanes = fmts[iPosition/2].biPlanes;
- bihOut.biBitCount = fmts[iPosition/2].biBitCount;
- bihOut.biCompression = fmts[iPosition/2].biCompression;
- bihOut.biSizeImage = w * h * bihOut.biBitCount >> 3;
-
- if(iPosition & 1)
- {
- pmt->formattype = FORMAT_VideoInfo;
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
- vih->bmiHeader = bihOut;
- vih->bmiHeader.biXPelsPerMeter = vih->bmiHeader.biWidth * ary;
- vih->bmiHeader.biYPelsPerMeter = vih->bmiHeader.biHeight * arx;
- }
- else
- {
- pmt->formattype = FORMAT_VideoInfo2;
- VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
- memset(vih, 0, sizeof(VIDEOINFOHEADER2));
- vih->bmiHeader = bihOut;
- vih->dwPictAspectRatioX = arx;
- vih->dwPictAspectRatioY = ary;
- if(IsVideoInterlaced()) vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced | AMINTERLACE_DisplayModeBobOrWeave;
- }
-
- CMediaType& mt = m_pInput->CurrentMediaType();
-
- // these fields have the same field offset in all four structs
- ((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame = ((VIDEOINFOHEADER*)mt.Format())->AvgTimePerFrame;
- ((VIDEOINFOHEADER*)pmt->Format())->dwBitRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitRate;
- ((VIDEOINFOHEADER*)pmt->Format())->dwBitErrorRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitErrorRate;
-
- CorrectMediaType(pmt);
-
- // copy source and target rectangles from input pin
- CMediaType& pmtInput = m_pInput->CurrentMediaType();
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->Format();
- VIDEOINFOHEADER* vihInput = (VIDEOINFOHEADER*)pmtInput.Format();
-
- if(vih && vihInput && (vihInput->rcSource.right != 0) && (vihInput->rcSource.bottom != 0))
- {
- vih->rcSource = vihInput->rcSource;
- vih->rcTarget = vihInput->rcTarget;
- }
- else
- {
- vih->rcSource.right = vih->rcTarget.right = m_win;
- vih->rcSource.bottom = vih->rcTarget.bottom = m_hin;
- }
-
- if(RealWidth != -1 && vih->rcSource.right > RealWidth)
- vih->rcSource.right = RealWidth;
- if(RealHeight != -1 && vih->rcSource.bottom > RealHeight)
- vih->rcSource.bottom = RealHeight;
-
- return S_OK;
+ if(fFoundDVDNavigator || m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo2)
+ iPosition = iPosition*2;
+
+ //
+ GetOutputFormats (nFormatCount, &fmts);
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= 2*nFormatCount) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = *fmts[iPosition/2].subtype;
+
+ int w = m_win, h = m_hin, arx = m_arxin, ary = m_aryin;
+ int RealWidth = -1;
+ int RealHeight = -1;
+ GetOutputSize(w, h, arx, ary, RealWidth, RealHeight);
+
+ BITMAPINFOHEADER bihOut;
+ memset(&bihOut, 0, sizeof(bihOut));
+ bihOut.biSize = sizeof(bihOut);
+ bihOut.biWidth = w;
+ bihOut.biHeight = h;
+ bihOut.biPlanes = fmts[iPosition/2].biPlanes;
+ bihOut.biBitCount = fmts[iPosition/2].biBitCount;
+ bihOut.biCompression = fmts[iPosition/2].biCompression;
+ bihOut.biSizeImage = w*h*bihOut.biBitCount>>3;
+
+ if(iPosition&1)
+ {
+ pmt->formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->bmiHeader = bihOut;
+ vih->bmiHeader.biXPelsPerMeter = vih->bmiHeader.biWidth * ary;
+ vih->bmiHeader.biYPelsPerMeter = vih->bmiHeader.biHeight * arx;
+ }
+ else
+ {
+ pmt->formattype = FORMAT_VideoInfo2;
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER2));
+ vih->bmiHeader = bihOut;
+ vih->dwPictAspectRatioX = arx;
+ vih->dwPictAspectRatioY = ary;
+ if(IsVideoInterlaced()) vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced | AMINTERLACE_DisplayModeBobOrWeave;
+ }
+
+ CMediaType& mt = m_pInput->CurrentMediaType();
+
+ // these fields have the same field offset in all four structs
+ ((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame = ((VIDEOINFOHEADER*)mt.Format())->AvgTimePerFrame;
+ ((VIDEOINFOHEADER*)pmt->Format())->dwBitRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitRate;
+ ((VIDEOINFOHEADER*)pmt->Format())->dwBitErrorRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitErrorRate;
+
+ CorrectMediaType(pmt);
+
+ // copy source and target rectangles from input pin
+ CMediaType& pmtInput = m_pInput->CurrentMediaType();
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->Format();
+ VIDEOINFOHEADER* vihInput = (VIDEOINFOHEADER*)pmtInput.Format();
+
+ if (vih && vihInput && (vihInput->rcSource.right != 0) && (vihInput->rcSource.bottom != 0))
+ {
+ vih->rcSource = vihInput->rcSource;
+ vih->rcTarget = vihInput->rcTarget;
+ }
+ else
+ {
+ vih->rcSource.right = vih->rcTarget.right = m_win;
+ vih->rcSource.bottom = vih->rcTarget.bottom = m_hin;
+ }
+
+ if (RealWidth != -1 && vih->rcSource.right > RealWidth)
+ vih->rcSource.right = RealWidth;
+ if (RealHeight != -1 && vih->rcSource.bottom > RealHeight)
+ vih->rcSource.bottom = RealHeight;
+
+ return S_OK;
}
HRESULT CBaseVideoFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
{
- if(dir == PINDIR_INPUT)
- {
- m_w = m_h = m_arx = m_ary = 0;
- ExtractDim(pmt, m_w, m_h, m_arx, m_ary);
- m_win = m_w;
- m_hin = m_h;
- m_arxin = m_arx;
- m_aryin = m_ary;
- int RealWidth;
- int RealHeight;
- GetOutputSize(m_w, m_h, m_arx, m_ary, RealWidth, RealHeight);
-
- DWORD a = m_arx, b = m_ary;
- while(a)
- {
- int tmp = a;
- a = b % tmp;
- b = tmp;
- }
- if(b) m_arx /= b, m_ary /= b;
- }
- else if(dir == PINDIR_OUTPUT)
- {
- int wout = 0, hout = 0, arxout = 0, aryout = 0;
- ExtractDim(pmt, wout, hout, arxout, aryout);
- if(m_w == wout && m_h == hout && m_arx == arxout && m_ary == aryout)
- {
- m_wout = wout;
- m_hout = hout;
- m_arxout = arxout;
- m_aryout = aryout;
- }
- }
-
- return __super::SetMediaType(dir, pmt);
+ if(dir == PINDIR_INPUT)
+ {
+ m_w = m_h = m_arx = m_ary = 0;
+ ExtractDim(pmt, m_w, m_h, m_arx, m_ary);
+ m_win = m_w;
+ m_hin = m_h;
+ m_arxin = m_arx;
+ m_aryin = m_ary;
+ int RealWidth;
+ int RealHeight;
+ GetOutputSize(m_w, m_h, m_arx, m_ary, RealWidth, RealHeight);
+
+ DWORD a = m_arx, b = m_ary;
+ while(a) {int tmp = a; a = b % tmp; b = tmp;}
+ if(b) m_arx /= b, m_ary /= b;
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ int wout = 0, hout = 0, arxout = 0, aryout = 0;
+ ExtractDim(pmt, wout, hout, arxout, aryout);
+ if(m_w == wout && m_h == hout && m_arx == arxout && m_ary == aryout)
+ {
+ m_wout = wout;
+ m_hout = hout;
+ m_arxout = arxout;
+ m_aryout = aryout;
+ }
+ }
+
+ return __super::SetMediaType(dir, pmt);
}
//
// CBaseVideoInputAllocator
//
-
+
CBaseVideoInputAllocator::CBaseVideoInputAllocator(HRESULT* phr)
- : CMemAllocator(NAME("CBaseVideoInputAllocator"), NULL, phr)
+ : CMemAllocator(NAME("CBaseVideoInputAllocator"), NULL, phr)
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
}
void CBaseVideoInputAllocator::SetMediaType(const CMediaType& mt)
{
- m_mt = mt;
+ m_mt = mt;
}
STDMETHODIMP CBaseVideoInputAllocator::GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags)
{
- if(!m_bCommitted)
+ if(!m_bCommitted)
return VFW_E_NOT_COMMITTED;
- HRESULT hr = __super::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
+ HRESULT hr = __super::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
- if(SUCCEEDED(hr) && m_mt.majortype != GUID_NULL)
- {
- (*ppBuffer)->SetMediaType(&m_mt);
- m_mt.majortype = GUID_NULL;
- }
+ if(SUCCEEDED(hr) && m_mt.majortype != GUID_NULL)
+ {
+ (*ppBuffer)->SetMediaType(&m_mt);
+ m_mt.majortype = GUID_NULL;
+ }
- return hr;
+ return hr;
}
//
// CBaseVideoInputPin
//
-CBaseVideoInputPin::CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
- : CTransformInputPin(pObjectName, pFilter, phr, pName)
- , m_pAllocator(NULL)
+CBaseVideoInputPin::CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
+ : CTransformInputPin(pObjectName, pFilter, phr, pName)
+ , m_pAllocator(NULL)
{
}
CBaseVideoInputPin::~CBaseVideoInputPin()
{
- delete m_pAllocator;
+ delete m_pAllocator;
}
STDMETHODIMP CBaseVideoInputPin::GetAllocator(IMemAllocator** ppAllocator)
@@ -705,8 +684,8 @@ STDMETHODIMP CBaseVideoInputPin::GetAllocator(IMemAllocator** ppAllocator)
CheckPointer(ppAllocator, E_POINTER);
if(m_pAllocator == NULL)
- {
- HRESULT hr = S_OK;
+ {
+ HRESULT hr = S_OK;
m_pAllocator = DNew CBaseVideoInputAllocator(&hr);
m_pAllocator->AddRef();
}
@@ -714,45 +693,45 @@ STDMETHODIMP CBaseVideoInputPin::GetAllocator(IMemAllocator** ppAllocator)
(*ppAllocator = m_pAllocator)->AddRef();
return S_OK;
-}
+}
STDMETHODIMP CBaseVideoInputPin::ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt)
{
- CAutoLock cObjectLock(m_pLock);
+ CAutoLock cObjectLock(m_pLock);
- if(m_Connected)
- {
- CMediaType mt(*pmt);
+ if(m_Connected)
+ {
+ CMediaType mt(*pmt);
- if(FAILED(CheckMediaType(&mt)))
- return VFW_E_TYPE_NOT_ACCEPTED;
+ if(FAILED(CheckMediaType(&mt)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
- ALLOCATOR_PROPERTIES props, actual;
+ ALLOCATOR_PROPERTIES props, actual;
- CComPtr<IMemAllocator> pMemAllocator;
- if(FAILED(GetAllocator(&pMemAllocator))
- || FAILED(pMemAllocator->Decommit())
- || FAILED(pMemAllocator->GetProperties(&props)))
- return E_FAIL;
+ CComPtr<IMemAllocator> pMemAllocator;
+ if(FAILED(GetAllocator(&pMemAllocator))
+ || FAILED(pMemAllocator->Decommit())
+ || FAILED(pMemAllocator->GetProperties(&props)))
+ return E_FAIL;
- BITMAPINFOHEADER bih;
- if(ExtractBIH(pmt, &bih) && bih.biSizeImage)
- props.cbBuffer = bih.biSizeImage;
+ BITMAPINFOHEADER bih;
+ if(ExtractBIH(pmt, &bih) && bih.biSizeImage)
+ props.cbBuffer = bih.biSizeImage;
- if(FAILED(pMemAllocator->SetProperties(&props, &actual))
- || FAILED(pMemAllocator->Commit())
- || props.cbBuffer != actual.cbBuffer)
- return E_FAIL;
+ if(FAILED(pMemAllocator->SetProperties(&props, &actual))
+ || FAILED(pMemAllocator->Commit())
+ || props.cbBuffer != actual.cbBuffer)
+ return E_FAIL;
- if(m_pAllocator)
- m_pAllocator->SetMediaType(mt);
+ if(m_pAllocator)
+ m_pAllocator->SetMediaType(mt);
- return SetMediaType(&mt) == S_OK
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
- }
+ return SetMediaType(&mt) == S_OK
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+ }
- return __super::ReceiveConnection(pConnector, pmt);
+ return __super::ReceiveConnection(pConnector, pmt);
}
//
@@ -760,17 +739,17 @@ STDMETHODIMP CBaseVideoInputPin::ReceiveConnection(IPin* pConnector, const AM_ME
//
CBaseVideoOutputPin::CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
- : CTransformOutputPin(pObjectName, pFilter, phr, pName)
+ : CTransformOutputPin(pObjectName, pFilter, phr, pName)
{
}
HRESULT CBaseVideoOutputPin::CheckMediaType(const CMediaType* mtOut)
{
- if(IsConnected())
- {
- HRESULT hr = (static_cast<CBaseVideoFilter*>(m_pFilter))->CheckOutputType(*mtOut);
- if(FAILED(hr)) return hr;
- }
+ if(IsConnected())
+ {
+ HRESULT hr = (static_cast<CBaseVideoFilter*>(m_pFilter))->CheckOutputType(*mtOut);
+ if(FAILED(hr)) return hr;
+ }
- return __super::CheckMediaType(mtOut);
+ return __super::CheckMediaType(mtOut);
}
diff --git a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h
index a48ccf543..298cc615b 100644
--- a/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h
+++ b/src/filters/transform/BaseVideoFilter/BaseVideoFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,10 +24,10 @@
typedef struct
{
- const GUID* subtype;
- WORD biPlanes;
- WORD biBitCount;
- DWORD biCompression;
+ const GUID* subtype;
+ WORD biPlanes;
+ WORD biBitCount;
+ DWORD biCompression;
} VIDEO_OUTPUT_FORMATS;
class CBaseVideoFilter : public CTransformFilter
@@ -35,73 +35,70 @@ class CBaseVideoFilter : public CTransformFilter
private:
HRESULT Receive(IMediaSample* pIn);
- // these are private for a reason, don't bother them
- DWORD m_win, m_hin, m_arxin, m_aryin;
- DWORD m_wout, m_hout, m_arxout, m_aryout;
+ // these are private for a reason, don't bother them
+ DWORD m_win, m_hin, m_arxin, m_aryin;
+ DWORD m_wout, m_hout, m_arxout, m_aryout;
- long m_cBuffers;
+ long m_cBuffers;
protected:
- CCritSec m_csReceive;
+ CCritSec m_csReceive;
- int m_w, m_h, m_arx, m_ary;
+ int m_w, m_h, m_arx, m_ary;
- HRESULT GetDeliveryBuffer(int w, int h, IMediaSample** ppOut);
- HRESULT CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);
- HRESULT CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);
+ HRESULT GetDeliveryBuffer(int w, int h, IMediaSample** ppOut);
+ HRESULT CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);
+ HRESULT CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);
- virtual void GetOutputSize(int& w, int& h, int& arx, int& ary, int &RealWidth, int &RealHeight) {}
- virtual HRESULT Transform(IMediaSample* pIn) = 0;
- virtual bool IsVideoInterlaced()
- {
- return false;
- }
- virtual void GetOutputFormats(int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats);
+ virtual void GetOutputSize(int& w, int& h, int& arx, int& ary, int &RealWidth, int &RealHeight) {}
+ virtual HRESULT Transform(IMediaSample* pIn) = 0;
+ virtual bool IsVideoInterlaced() {return false;}
+ virtual void GetOutputFormats (int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats);
public:
- CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers = 1);
- virtual ~CBaseVideoFilter();
+ CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers = 1);
+ virtual ~CBaseVideoFilter();
- HRESULT ReconnectOutput(int w, int h, bool bSendSample = true, int realWidth = -1, int realHeight = -1);
- int GetPinCount();
- CBasePin* GetPin(int n);
+ HRESULT ReconnectOutput(int w, int h, bool bSendSample = true, int realWidth = -1, int realHeight = -1);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckOutputType(const CMediaType& mtOut);
+ HRESULT CheckOutputType(const CMediaType& mtOut);
HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt);
+ HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt);
- void SetAspect(CSize aspect);
+ void SetAspect(CSize aspect);
};
class CBaseVideoInputAllocator : public CMemAllocator
{
- CMediaType m_mt;
+ CMediaType m_mt;
public:
- CBaseVideoInputAllocator(HRESULT* phr);
- void SetMediaType(const CMediaType& mt);
- STDMETHODIMP GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
+ CBaseVideoInputAllocator(HRESULT* phr);
+ void SetMediaType(const CMediaType& mt);
+ STDMETHODIMP GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
};
class CBaseVideoInputPin : public CTransformInputPin
{
- CBaseVideoInputAllocator* m_pAllocator;
+ CBaseVideoInputAllocator* m_pAllocator;
public:
- CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
- ~CBaseVideoInputPin();
+ CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
+ ~CBaseVideoInputPin();
- STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
- STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
+ STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
};
class CBaseVideoOutputPin : public CTransformOutputPin
{
public:
- CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
+ CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
HRESULT CheckMediaType(const CMediaType* mtOut);
};
diff --git a/src/filters/transform/BaseVideoFilter/stdafx.cpp b/src/filters/transform/BaseVideoFilter/stdafx.cpp
index 5899c1666..4b29d63b8 100644
--- a/src/filters/transform/BaseVideoFilter/stdafx.cpp
+++ b/src/filters/transform/BaseVideoFilter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/BaseVideoFilter/stdafx.h b/src/filters/transform/BaseVideoFilter/stdafx.h
index 4fd7a1865..8068e9c6e 100644
--- a/src/filters/transform/BaseVideoFilter/stdafx.h
+++ b/src/filters/transform/BaseVideoFilter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/BufferFilter/BufferFilter.cpp b/src/filters/transform/BufferFilter/BufferFilter.cpp
index b892aabf8..e728bcbc4 100644
--- a/src/filters/transform/BufferFilter/BufferFilter.cpp
+++ b/src/filters/transform/BufferFilter/BufferFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,12 +27,12 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -43,24 +43,24 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CBufferFilter), L"MPC - Buffer Filter", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CBufferFilter), L"MPC - Buffer Filter", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CBufferFilter>, NULL, &sudFilter[0]}
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CBufferFilter>, NULL, &sudFilter[0]}
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -73,27 +73,23 @@ CFilterApp theApp;
// CBufferFilter
//
-CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CBufferFilter"), lpunk, __uuidof(this))
- , m_nSamplesToBuffer(2)
+CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CBufferFilter"), lpunk, __uuidof(this))
+ , m_nSamplesToBuffer(2)
{
- HRESULT hr = S_OK;
-
- do
- {
- if(!(m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In"))) hr = E_OUTOFMEMORY;
- if(FAILED(hr)) break;
-
- if(!(m_pOutput = DNew CBufferFilterOutputPin(this, &hr))) hr = E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- delete m_pInput, m_pInput = NULL;
- break;
- }
- }
- while(false);
-
- if(phr) *phr = hr;
+ HRESULT hr = S_OK;
+
+ do
+ {
+ if(!(m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In"))) hr = E_OUTOFMEMORY;
+ if(FAILED(hr)) break;
+
+ if(!(m_pOutput = DNew CBufferFilterOutputPin(this, &hr))) hr = E_OUTOFMEMORY;
+ if(FAILED(hr)) {delete m_pInput, m_pInput = NULL; break;}
+ }
+ while(false);
+
+ if(phr) *phr = hr;
}
CBufferFilter::~CBufferFilter()
@@ -102,194 +98,188 @@ CBufferFilter::~CBufferFilter()
STDMETHODIMP CBufferFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IBufferFilter)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IBufferFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// IBufferFilter
STDMETHODIMP CBufferFilter::SetBuffers(int nBuffers)
{
- if(!m_pOutput)
- return E_FAIL;
+ if(!m_pOutput)
+ return E_FAIL;
- if(m_pOutput->IsConnected()) // TODO: allow "on-the-fly" changes
- return VFW_E_ALREADY_CONNECTED;
+ if(m_pOutput->IsConnected()) // TODO: allow "on-the-fly" changes
+ return VFW_E_ALREADY_CONNECTED;
- m_nSamplesToBuffer = nBuffers;
+ m_nSamplesToBuffer = nBuffers;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP_(int) CBufferFilter::GetBuffers()
{
- return(m_nSamplesToBuffer);
+ return(m_nSamplesToBuffer);
}
STDMETHODIMP_(int) CBufferFilter::GetFreeBuffers()
{
- CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
- return(pPin && pPin->m_pOutputQueue ? (m_nSamplesToBuffer - pPin->m_pOutputQueue->GetQueueCount()) : 0);
+ CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
+ return(pPin && pPin->m_pOutputQueue ? (m_nSamplesToBuffer - pPin->m_pOutputQueue->GetQueueCount()) : 0);
}
STDMETHODIMP CBufferFilter::SetPriority(DWORD dwPriority)
{
- CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
- return(pPin && pPin->m_pOutputQueue ? (pPin->m_pOutputQueue->SetPriority(dwPriority) ? S_OK : E_FAIL) : E_UNEXPECTED);
+ CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
+ return(pPin && pPin->m_pOutputQueue ? (pPin->m_pOutputQueue->SetPriority(dwPriority) ? S_OK : E_FAIL) : E_UNEXPECTED);
}
//
HRESULT CBufferFilter::Receive(IMediaSample* pSample)
{
- /* Check for other streams and pass them on */
- AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
- if(pProps->dwStreamId != AM_STREAM_MEDIA)
- return m_pOutput->Deliver(pSample);
-
- HRESULT hr;
- ASSERT(pSample);
- IMediaSample* pOutSample;
-
- ASSERT(m_pOutput != NULL);
-
- // Set up the output sample
- hr = InitializeOutputSample(pSample, &pOutSample);
-
- if(FAILED(hr))
- return hr;
-
- // Start timing the transform (if PERF is defined)
- MSR_START(m_idTransform);
-
- // have the derived class transform the data
-
- hr = Transform(pSample, pOutSample);
-
- // Stop the clock and log it (if PERF is defined)
- MSR_STOP(m_idTransform);
-
- if(FAILED(hr))
- {
- DbgLog((LOG_TRACE, 1, TEXT("Error from transform")));
- }
- else
- {
- // the Transform() function can return S_FALSE to indicate that the
- // sample should not be delivered; we only deliver the sample if it's
- // really S_OK (same as NOERROR, of course.)
- if(hr == NOERROR)
- {
- hr = m_pOutput->Deliver(pOutSample);
- m_bSampleSkipped = FALSE; // last thing no longer dropped
- }
- else
- {
- // S_FALSE returned from Transform is a PRIVATE agreement
- // We should return NOERROR from Receive() in this cause because returning S_FALSE
- // from Receive() means that this is the end of the stream and no more data should
- // be sent.
- if(S_FALSE == hr)
- {
-
- // Release the sample before calling notify to avoid
- // deadlocks if the sample holds a lock on the system
- // such as DirectDraw buffers do
- pOutSample->Release();
- m_bSampleSkipped = TRUE;
- if(!m_bQualityChanged)
- {
- NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
- m_bQualityChanged = TRUE;
- }
- return NOERROR;
- }
- }
- }
-
- // release the output buffer. If the connected pin still needs it,
- // it will have addrefed it itself.
- pOutSample->Release();
-
- return hr;
+ /* Check for other streams and pass them on */
+ AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
+ if(pProps->dwStreamId != AM_STREAM_MEDIA)
+ return m_pOutput->Deliver(pSample);
+
+ HRESULT hr;
+ ASSERT(pSample);
+ IMediaSample* pOutSample;
+
+ ASSERT(m_pOutput != NULL);
+
+ // Set up the output sample
+ hr = InitializeOutputSample(pSample, &pOutSample);
+
+ if(FAILED(hr))
+ return hr;
+
+ // Start timing the transform (if PERF is defined)
+ MSR_START(m_idTransform);
+
+ // have the derived class transform the data
+
+ hr = Transform(pSample, pOutSample);
+
+ // Stop the clock and log it (if PERF is defined)
+ MSR_STOP(m_idTransform);
+
+ if(FAILED(hr)) {
+ DbgLog((LOG_TRACE,1,TEXT("Error from transform")));
+ }
+ else {
+ // the Transform() function can return S_FALSE to indicate that the
+ // sample should not be delivered; we only deliver the sample if it's
+ // really S_OK (same as NOERROR, of course.)
+ if(hr == NOERROR) {
+ hr = m_pOutput->Deliver(pOutSample);
+ m_bSampleSkipped = FALSE; // last thing no longer dropped
+ }
+ else {
+ // S_FALSE returned from Transform is a PRIVATE agreement
+ // We should return NOERROR from Receive() in this cause because returning S_FALSE
+ // from Receive() means that this is the end of the stream and no more data should
+ // be sent.
+ if(S_FALSE == hr) {
+
+ // Release the sample before calling notify to avoid
+ // deadlocks if the sample holds a lock on the system
+ // such as DirectDraw buffers do
+ pOutSample->Release();
+ m_bSampleSkipped = TRUE;
+ if(!m_bQualityChanged) {
+ NotifyEvent(EC_QUALITY_CHANGE,0,0);
+ m_bQualityChanged = TRUE;
+ }
+ return NOERROR;
+ }
+ }
+ }
+
+ // release the output buffer. If the connected pin still needs it,
+ // it will have addrefed it itself.
+ pOutSample->Release();
+
+ return hr;
}
HRESULT CBufferFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- BYTE* pDataIn = NULL;
- BYTE* pDataOut = NULL;
-
- pIn->GetPointer(&pDataIn);
- pOut->GetPointer(&pDataOut);
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
- long len = pIn->GetActualDataLength();
- long size = pOut->GetSize();
+ pIn->GetPointer(&pDataIn);
+ pOut->GetPointer(&pDataOut);
- if(!pDataIn || !pDataOut || len > size || len <= 0) return S_FALSE;
+ long len = pIn->GetActualDataLength();
+ long size = pOut->GetSize();
- memcpy(pDataOut, pDataIn, min(len, size));
+ if(!pDataIn || !pDataOut || len > size || len <= 0) return S_FALSE;
- pOut->SetActualDataLength(min(len, size));
+ memcpy(pDataOut, pDataIn, min(len, size));
+
+ pOut->SetActualDataLength(min(len, size));
- return S_OK;
+ return S_OK;
}
HRESULT CBufferFilter::CheckInputType(const CMediaType* mtIn)
{
- return S_OK;
+ return S_OK;
}
HRESULT CBufferFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return mtIn->MatchesPartial(mtOut) ? S_OK : VFW_E_TYPE_NOT_ACCEPTED;
+ return mtIn->MatchesPartial(mtOut) ? S_OK : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CBufferFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- CComPtr<IMemAllocator> pAllocatorIn;
- m_pInput->GetAllocator(&pAllocatorIn);
- if(!pAllocatorIn) return E_UNEXPECTED;
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
- pAllocatorIn->GetProperties(pProperties);
+ pAllocatorIn->GetProperties(pProperties);
- pProperties->cBuffers = max(m_nSamplesToBuffer, pProperties->cBuffers);
+ pProperties->cBuffers = max(m_nSamplesToBuffer, pProperties->cBuffers);
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CBufferFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- // TODO: offer all input types from upstream and allow reconnection at least in stopped state
- if(iPosition < 0) return E_INVALIDARG;
+ // TODO: offer all input types from upstream and allow reconnection at least in stopped state
+ if(iPosition < 0) return E_INVALIDARG;
if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- CopyMediaType(pMediaType, &m_pInput->CurrentMediaType());
+ CopyMediaType(pMediaType, &m_pInput->CurrentMediaType());
- return S_OK;
+ return S_OK;
}
HRESULT CBufferFilter::StopStreaming()
{
- CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
- if(m_pInput && pPin && pPin->m_pOutputQueue)
- {
- while(!m_pInput->IsFlushing() && pPin->m_pOutputQueue->GetQueueCount() > 0)
- Sleep(50);
- }
-
- return __super::StopStreaming();
+ CBufferFilterOutputPin* pPin = static_cast<CBufferFilterOutputPin*>(m_pOutput);
+ if(m_pInput && pPin && pPin->m_pOutputQueue)
+ {
+ while(!m_pInput->IsFlushing() && pPin->m_pOutputQueue->GetQueueCount() > 0)
+ Sleep(50);
+ }
+
+ return __super::StopStreaming();
}
//
@@ -297,66 +287,66 @@ HRESULT CBufferFilter::StopStreaming()
//
CBufferFilterOutputPin::CBufferFilterOutputPin(CTransformFilter* pFilter, HRESULT* phr)
- : CTransformOutputPin(NAME("CBufferFilterOutputPin"), pFilter, phr, L"Out")
+ : CTransformOutputPin(NAME("CBufferFilterOutputPin"), pFilter, phr, L"Out")
{
}
HRESULT CBufferFilterOutputPin::Active()
{
- CAutoLock lock_it(m_pLock);
+ CAutoLock lock_it(m_pLock);
- if(m_Connected && !m_pOutputQueue)
- {
- HRESULT hr = NOERROR;
+ if(m_Connected && !m_pOutputQueue)
+ {
+ HRESULT hr = NOERROR;
- m_pOutputQueue.Attach(DNew CBufferFilterOutputQueue(m_Connected, &hr));
- if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
+ m_pOutputQueue.Attach(DNew CBufferFilterOutputQueue(m_Connected, &hr));
+ if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pOutputQueue.Free();
- return hr;
- }
- }
+ if(FAILED(hr))
+ {
+ m_pOutputQueue.Free();
+ return hr;
+ }
+ }
- return __super::Active();
+ return __super::Active();
}
HRESULT CBufferFilterOutputPin::Inactive()
{
- CAutoLock lock_it(m_pLock);
- m_pOutputQueue.Free();
- return __super::Inactive();
+ CAutoLock lock_it(m_pLock);
+ m_pOutputQueue.Free();
+ return __super::Inactive();
}
HRESULT CBufferFilterOutputPin::Deliver(IMediaSample* pMediaSample)
{
- if(!m_pOutputQueue) return NOERROR;
- pMediaSample->AddRef();
- return m_pOutputQueue->Receive(pMediaSample);
+ if(!m_pOutputQueue) return NOERROR;
+ pMediaSample->AddRef();
+ return m_pOutputQueue->Receive(pMediaSample);
}
#define CallQueue(call) \
if(!m_pOutputQueue) return NOERROR; \
m_pOutputQueue->##call; \
return NOERROR; \
-
+
HRESULT CBufferFilterOutputPin::DeliverEndOfStream()
{
- CallQueue(EOS());
+ CallQueue(EOS());
}
HRESULT CBufferFilterOutputPin::DeliverBeginFlush()
{
- CallQueue(BeginFlush());
+ CallQueue(BeginFlush());
}
HRESULT CBufferFilterOutputPin::DeliverEndFlush()
{
- CallQueue(EndFlush());
+ CallQueue(EndFlush());
}
HRESULT CBufferFilterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CallQueue(NewSegment(tStart, tStop, dRate));
+ CallQueue(NewSegment(tStart, tStop, dRate));
}
diff --git a/src/filters/transform/BufferFilter/BufferFilter.h b/src/filters/transform/BufferFilter/BufferFilter.h
index 14c7fb587..a65d7a16c 100644
--- a/src/filters/transform/BufferFilter/BufferFilter.h
+++ b/src/filters/transform/BufferFilter/BufferFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,79 +24,78 @@
#include <atlbase.h>
[uuid("63EF0035-3FFE-4c41-9230-4346E028BE20")]
-interface IBufferFilter :
-public IUnknown
+interface IBufferFilter : public IUnknown
{
- STDMETHOD(SetBuffers)(int nBuffers) = 0;
- STDMETHOD_(int, GetBuffers)() = 0;
- STDMETHOD_(int, GetFreeBuffers)() = 0;
- STDMETHOD(SetPriority)(DWORD dwPriority = THREAD_PRIORITY_NORMAL) = 0;
+ STDMETHOD(SetBuffers) (int nBuffers) = 0;
+ STDMETHOD_(int, GetBuffers) () = 0;
+ STDMETHOD_(int, GetFreeBuffers) () = 0;
+ STDMETHOD(SetPriority) (DWORD dwPriority = THREAD_PRIORITY_NORMAL) = 0;
};
[uuid("DA2B3D77-2F29-4fd2-AC99-DEE4A8A13BF0")]
class CBufferFilter : public CTransformFilter, public IBufferFilter
{
- int m_nSamplesToBuffer;
+ int m_nSamplesToBuffer;
public:
- CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CBufferFilter();
+ CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CBufferFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IBufferFilter
- STDMETHODIMP SetBuffers(int nBuffers);
- STDMETHODIMP_(int) GetBuffers();
- STDMETHODIMP_(int) GetFreeBuffers();
- STDMETHODIMP SetPriority(DWORD dwPriority = THREAD_PRIORITY_NORMAL);
+ // IBufferFilter
+ STDMETHODIMP SetBuffers(int nBuffers);
+ STDMETHODIMP_(int) GetBuffers();
+ STDMETHODIMP_(int) GetFreeBuffers();
+ STDMETHODIMP SetPriority(DWORD dwPriority = THREAD_PRIORITY_NORMAL);
- HRESULT Receive(IMediaSample* pSample);
- HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT Receive(IMediaSample* pSample);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
HRESULT CheckInputType(const CMediaType* mtIn);
HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT StopStreaming();
+ HRESULT StopStreaming();
};
class CBufferFilterOutputPin : public CTransformOutputPin
{
- class CBufferFilterOutputQueue : public COutputQueue
- {
- public:
- CBufferFilterOutputQueue(IPin* pInputPin, HRESULT* phr,
- DWORD dwPriority = THREAD_PRIORITY_NORMAL,
- BOOL bAuto = FALSE, BOOL bQueue = TRUE,
- LONG lBatchSize = 1, BOOL bBatchExact = FALSE,
- LONG lListSize = DEFAULTCACHE,
- bool bFlushingOpt = false)
- : COutputQueue(pInputPin, phr, bAuto, bQueue, lBatchSize, bBatchExact, lListSize, dwPriority, bFlushingOpt)
- {
- }
+ class CBufferFilterOutputQueue : public COutputQueue
+ {
+ public:
+ CBufferFilterOutputQueue(IPin* pInputPin, HRESULT* phr,
+ DWORD dwPriority = THREAD_PRIORITY_NORMAL,
+ BOOL bAuto = FALSE, BOOL bQueue = TRUE,
+ LONG lBatchSize = 1, BOOL bBatchExact = FALSE,
+ LONG lListSize = DEFAULTCACHE,
+ bool bFlushingOpt = false)
+ : COutputQueue(pInputPin, phr, bAuto, bQueue, lBatchSize, bBatchExact, lListSize, dwPriority, bFlushingOpt)
+ {
+ }
- int GetQueueCount()
- {
- return m_List ? m_List->GetCount() : -1;
- }
+ int GetQueueCount()
+ {
+ return m_List ? m_List->GetCount() : -1;
+ }
- bool SetPriority(DWORD dwPriority)
- {
- return m_hThread ? !!::SetThreadPriority(m_hThread, dwPriority) : false;
- }
- };
+ bool SetPriority(DWORD dwPriority)
+ {
+ return m_hThread ? !!::SetThreadPriority(m_hThread, dwPriority) : false;
+ }
+ };
public:
- CBufferFilterOutputPin(CTransformFilter* pFilter, HRESULT* phr);
+ CBufferFilterOutputPin(CTransformFilter* pFilter, HRESULT* phr);
- CAutoPtr<CBufferFilterOutputQueue> m_pOutputQueue;
+ CAutoPtr<CBufferFilterOutputQueue> m_pOutputQueue;
- HRESULT Active();
+ HRESULT Active();
HRESULT Inactive();
- HRESULT Deliver(IMediaSample* pMediaSample);
+ HRESULT Deliver(IMediaSample* pMediaSample);
HRESULT DeliverEndOfStream();
HRESULT DeliverBeginFlush();
- HRESULT DeliverEndFlush();
+ HRESULT DeliverEndFlush();
HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
};
diff --git a/src/filters/transform/BufferFilter/stdafx.cpp b/src/filters/transform/BufferFilter/stdafx.cpp
index 323361b0e..280418994 100644
--- a/src/filters/transform/BufferFilter/stdafx.cpp
+++ b/src/filters/transform/BufferFilter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/BufferFilter/stdafx.h b/src/filters/transform/BufferFilter/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/transform/BufferFilter/stdafx.h
+++ b/src/filters/transform/BufferFilter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp b/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp
index e426052de..e3bd46f23 100644
--- a/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp
+++ b/src/filters/transform/DeCSSFilter/DeCSSFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,13 +29,13 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_NULL},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_NULL},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -46,7 +46,7 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CDeCSSFilter), L"MPC - DeCSSFilter", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CDeCSSFilter), L"MPC - DeCSSFilter", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
@@ -58,12 +58,12 @@ int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
#include "../../FilterApp.h"
@@ -80,45 +80,41 @@ class CKsPSInputPin : public CDeCSSInputPin
{
public:
CKsPSInputPin(TCHAR* pObjectName, CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
- : CDeCSSInputPin(pObjectName, pFilter, phr, pName)
- {
- }
+ : CDeCSSInputPin(pObjectName, pFilter, phr, pName)
+ {
+ }
- // IKsPropertySet
+ // IKsPropertySet
STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength)
- {
- if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected())
- return pKsPS->Set(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength);
- return E_NOTIMPL;
- }
+ {
+ if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected())
+ return pKsPS->Set(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength);
+ return E_NOTIMPL;
+ }
STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength, ULONG* pBytesReturned)
- {
- if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected())
- return pKsPS->Get(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength, pBytesReturned);
- return E_NOTIMPL;
- }
+ {
+ if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected())
+ return pKsPS->Get(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength, pBytesReturned);
+ return E_NOTIMPL;
+ }
STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
- {
- if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected())
- return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
- return E_NOTIMPL;
- }
+ {
+ if(CComQIPtr<IKsPropertySet> pKsPS = (static_cast<CDeCSSFilter*>(m_pFilter))->m_pOutput->GetConnected())
+ return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
+ return E_NOTIMPL;
+ }
};
-CDeCSSFilter::CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CDeCSSFilter"), lpunk, __uuidof(this))
+CDeCSSFilter::CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CDeCSSFilter"), lpunk, __uuidof(this))
{
- if(phr) *phr = S_OK;
+ if(phr) *phr = S_OK;
- if(!(m_pInput = DNew CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
+ if(!(m_pInput = DNew CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
- if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr))
- {
- delete m_pInput, m_pInput = NULL;
- return;
- }
+ if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
}
CDeCSSFilter::~CDeCSSFilter()
@@ -127,108 +123,101 @@ CDeCSSFilter::~CDeCSSFilter()
HRESULT CDeCSSFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
{
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt = *pmt;
- m_pInput->SetMediaType(&mt);
- mt.majortype = m_pOutput->CurrentMediaType().majortype;
- m_pOutput->SetMediaType(&mt);
- pOut->SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
-
- BYTE* pDataIn = NULL;
- BYTE* pDataOut = NULL;
-
- pIn->GetPointer(&pDataIn);
- pOut->GetPointer(&pDataOut);
-
- long len = pIn->GetActualDataLength();
- long size = pOut->GetSize();
-
- if(len == 0 || pDataIn == NULL) // format changes do not carry any data
- {
- pOut->SetActualDataLength(0);
- return S_OK;
- }
-
- if(m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
- {
- if(*(DWORD*)pDataIn == 0xBA010000)
- {
- len -= 14;
- pDataIn += 14;
- if(int stuffing = (pDataIn[-1] & 7))
- {
- len -= stuffing;
- pDataIn += stuffing;
- }
- }
- if(len <= 0) return S_FALSE;
- if(*(DWORD*)pDataIn == 0xBB010000)
- {
- len -= 4;
- pDataIn += 4;
- int hdrlen = ((pDataIn[0] << 8) | pDataIn[1]) + 2;
- len -= hdrlen;
- pDataIn += hdrlen;
- }
- if(len <= 0) return S_FALSE;
- }
-
- if(!pDataIn || !pDataOut || len > size || len < 0) return S_FALSE;
-
- memcpy(pDataOut, pDataIn, min(len, size));
- pOut->SetActualDataLength(min(len, size));
-
- return S_OK;
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pInput->SetMediaType(&mt);
+ mt.majortype = m_pOutput->CurrentMediaType().majortype;
+ m_pOutput->SetMediaType(&mt);
+ pOut->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
+
+ pIn->GetPointer(&pDataIn);
+ pOut->GetPointer(&pDataOut);
+
+ long len = pIn->GetActualDataLength();
+ long size = pOut->GetSize();
+
+ if(len == 0 || pDataIn == NULL) // format changes do not carry any data
+ {
+ pOut->SetActualDataLength(0);
+ return S_OK;
+ }
+
+ if(m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(*(DWORD*)pDataIn == 0xBA010000)
+ {
+ len -= 14; pDataIn += 14;
+ if(int stuffing = (pDataIn[-1]&7)) {len -= stuffing; pDataIn += stuffing;}
+ }
+ if(len <= 0) return S_FALSE;
+ if(*(DWORD*)pDataIn == 0xBB010000)
+ {
+ len -= 4; pDataIn += 4;
+ int hdrlen = ((pDataIn[0]<<8)|pDataIn[1]) + 2;
+ len -= hdrlen; pDataIn += hdrlen;
+ }
+ if(len <= 0) return S_FALSE;
+ }
+
+ if(!pDataIn || !pDataOut || len > size || len < 0) return S_FALSE;
+
+ memcpy(pDataOut, pDataIn, min(len, size));
+ pOut->SetActualDataLength(min(len, size));
+
+ return S_OK;
}
HRESULT CDeCSSFilter::CheckInputType(const CMediaType* mtIn)
{
- return mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CDeCSSFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return SUCCEEDED(CheckInputType(mtIn))
- && mtOut->majortype == MEDIATYPE_MPEG2_PACK || mtOut->majortype == MEDIATYPE_MPEG2_PES
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_MPEG2_PACK || mtOut->majortype == MEDIATYPE_MPEG2_PES
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CDeCSSFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- pProperties->cbAlign = 1;
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = 2048;
- pProperties->cbPrefix = 0;
+ pProperties->cbAlign = 1;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 2048;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR);
+ ? E_FAIL
+ : NOERROR);
}
HRESULT CDeCSSFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition < 0) return E_INVALIDARG;
if(iPosition > 1) return VFW_S_NO_MORE_ITEMS;
- CopyMediaType(pmt, &m_pInput->CurrentMediaType());
- if(iPosition == 0) pmt->majortype = MEDIATYPE_MPEG2_PACK;
- if(iPosition == 1) pmt->majortype = MEDIATYPE_MPEG2_PES;
+ CopyMediaType(pmt, &m_pInput->CurrentMediaType());
+ if(iPosition == 0) pmt->majortype = MEDIATYPE_MPEG2_PACK;
+ if(iPosition == 1) pmt->majortype = MEDIATYPE_MPEG2_PES;
- return S_OK;
+ return S_OK;
}
diff --git a/src/filters/transform/DeCSSFilter/DeCSSFilter.h b/src/filters/transform/DeCSSFilter/DeCSSFilter.h
index b09b97137..e31b1ffa3 100644
--- a/src/filters/transform/DeCSSFilter/DeCSSFilter.h
+++ b/src/filters/transform/DeCSSFilter/DeCSSFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,11 +24,11 @@
[uuid("7B3BD419-FE03-4820-BE94-A22A4F844895")]
class CDeCSSFilter : public CTransformFilter
{
- friend class CKsPSInputPin;
+ friend class CKsPSInputPin;
public:
- CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CDeCSSFilter();
+ CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDeCSSFilter();
HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
HRESULT CheckInputType(const CMediaType* mtIn);
diff --git a/src/filters/transform/DeCSSFilter/stdafx.cpp b/src/filters/transform/DeCSSFilter/stdafx.cpp
index f5a641996..d8ef94a00 100644
--- a/src/filters/transform/DeCSSFilter/stdafx.cpp
+++ b/src/filters/transform/DeCSSFilter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/DeCSSFilter/stdafx.h b/src/filters/transform/DeCSSFilter/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/transform/DeCSSFilter/stdafx.h
+++ b/src/filters/transform/DeCSSFilter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/MPCVideoDec/CpuId.cpp b/src/filters/transform/MPCVideoDec/CpuId.cpp
index 19ff73f9c..55895a292 100644
--- a/src/filters/transform/MPCVideoDec/CpuId.cpp
+++ b/src/filters/transform/MPCVideoDec/CpuId.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -41,162 +41,162 @@
CCpuId::CCpuId(void)
{
- unsigned nHighestFeature;
- unsigned nHighestFeatureEx;
- int nBuff[4];
- char szMan[13];
- char szFeatures[256];
-
- // Get CPU manufacturer and highest CPUID
- __cpuid(nBuff, 0);
- nHighestFeature = (unsigned)nBuff[0];
- *(int*)&szMan[0] = nBuff[1];
- *(int*)&szMan[4] = nBuff[3];
- *(int*)&szMan[8] = nBuff[2];
- szMan[12] = 0;
- if(strcmp(szMan, "AuthenticAMD") == 0)
- m_nType = PROCESSOR_AMD;
- else if(strcmp(szMan, "GenuineIntel") == 0)
- m_nType = PROCESSOR_INTEL;
- else
- m_nType = PROCESSOR_UNKNOWN;
-
- // Get highest extended feature
- __cpuid(nBuff, 0x80000000);
- nHighestFeatureEx = (unsigned)nBuff[0];
-
- // Get processor brand name
- /*
- if(nHighestFeatureEx >= 0x80000004)
- {
- char szCPUName[49];
- szCPUName[0] = 0;
- __cpuid((int*)&szCPUName[0], 0x80000002);
- __cpuid((int*)&szCPUName[16], 0x80000003);
- __cpuid((int*)&szCPUName[32], 0x80000004);
- szCPUName[48] = 0;
- for(int i=(int)strlen(szCPUName)-1; i>=0; --i)
- {
- if(szCPUName[i] == ' ')
- szCPUName[i] = '\0';
- else
- break;
- }
-
- ELog::Get().SystemFormat(L"PERF : CPU: %S (%S)\n", szCPUName, szMan);
- }
- else
- ELog::Get().SystemFormat(L"PERF : CPU: %S\n", szMan);
- */
-
- // Get CPU features
- m_nCPUFeatures = 0;
- szFeatures[0] = 0;
- if(nHighestFeature >= 1)
- {
- __cpuid(nBuff, 1);
- if(nBuff[3] & 1 << 23) m_nCPUFeatures |= MPC_MM_MMX;
- if(nBuff[3] & 1 << 25) m_nCPUFeatures |= MPC_MM_SSE;
- if(nBuff[3] & 1 << 26) m_nCPUFeatures |= MPC_MM_SSE2;
- if(nBuff[2] & 1 << 0) m_nCPUFeatures |= MPC_MM_SSE3;
-
- // Intel specific:
- if(m_nType == PROCESSOR_INTEL)
- {
- if(nBuff[2] & 1 << 9) m_nCPUFeatures |= MPC_MM_SSSE3;
- // if(nBuff[2] & 1<<7) strcat(szFeatures, "EST ");
- }
-
- //if(nBuff[3] & 1<<28)
- // strcat(szFeatures, "HTT ");
- }
-
- // AMD specific:
- if(m_nType == PROCESSOR_AMD)
- {
- // Get extended features
- __cpuid(nBuff, 0x80000000);
- if(nHighestFeatureEx >= 0x80000001)
- {
- __cpuid(nBuff, 0x80000001);
- if(nBuff[3] & 1 << 31) m_nCPUFeatures |= MPC_MM_3DNOW;
- // if(nBuff[3] & 1<<30) strcat(szFeatures, "Ex3DNow! ");
- if(nBuff[3] & 1 << 22) m_nCPUFeatures |= MPC_MM_MMXEXT;
- }
-
- // Get level 1 cache size
- //if(nHighestFeatureEx >= 0x80000005)
- //{
- // __cpuid(nBuff, 0x80000005);
- // ELog::Get().SystemFormat(L"PERF : L1 cache size: %dK\n", ((unsigned)nBuff[2])>>24);
- //}
- }
-
- /*
- // Get cache size
- if(nHighestFeatureEx >= 0x80000006)
- {
- __cpuid(nBuff, 0x80000006);
- ELog::Get().SystemFormat(L"PERF : L2 cache size: %dK\n", ((unsigned)nBuff[2])>>16);
- }
-
- // Log features
- ELog::Get().SystemFormat(L"PERF : CPU Features: %S\n", szFeatures);
-
- // Get misc system info
- SYSTEM_INFO theInfo;
- GetSystemInfo(&theInfo);
-
- // Log number of CPUs and speeds
- ELog::Get().SystemFormat(L"PERF : Number of CPUs: %d\n", theInfo.dwNumberOfProcessors);
- for(DWORD i=0; i<theInfo.dwNumberOfProcessors; ++i)
- {
- DWORD dwCPUSpeed = ReadCPUSpeedFromRegistry(i);
- ELog::Get().SystemFormat(L"PERF : * CPU %d speed: ~%dMHz\n", i, dwCPUSpeed);
- }
- */
-
- /*
- unsigned nHighestFeature;
- unsigned nHighestFeatureEx;
-
- m_CPUInfo[0] = -1;
- m_CPUInfoEx[0] = -1;
- m_CPUAMDInfo[0] = -1;
-
- __cpuid(m_CPUInfo, 0);
- nHighestFeature = (unsigned)m_CPUInfo[0];
-
- __cpuid(nBuff, 0x80000000);
- nHighestFeatureEx = (unsigned)nBuff[0];
-
- m_nDSPFlags = 0;
- if (m_CPUInfo[3] & CPUID_MMX) m_nDSPFlags|=MPC_MM_MMX;
- if (m_CPUInfo[3] & CPUID_SSE) m_nDSPFlags|=MPC_MM_SSE;
- if (m_CPUInfo[3] & CPUID_SSE2) m_nDSPFlags|=MPC_MM_SSE2;
- if (m_CPUInfo[2] & CPUID_SSE3) m_nDSPFlags|=MPC_MM_SSE3;
-
- switch (m_nType)
- {
- case PROCESSOR_AMD :
- __cpuid(m_CPUAMDInfo, 0x80000000);
- if(nHighestFeatureEx >= 0x80000001)
- {
- if (m_CPUAMDInfo[3] & CPUID_MMXEXT) m_nDSPFlags|=MPC_MM_MMXEXT;
- if (m_CPUAMDInfo[3] & CPUID_3DNOW) m_nDSPFlags|=MPC_MM_3DNOW;
- }
- break;
- case PROCESSOR_INTEL :
- if(m_CPUInfo[2] & CPUID_SSSE3) m_nDSPFlags|=MPC_MM_SSSE3;
- break;
- }
- */
+unsigned nHighestFeature;
+unsigned nHighestFeatureEx;
+int nBuff[4];
+char szMan[13];
+char szFeatures[256];
+
+ // Get CPU manufacturer and highest CPUID
+ __cpuid(nBuff, 0);
+ nHighestFeature = (unsigned)nBuff[0];
+ *(int*)&szMan[0] = nBuff[1];
+ *(int*)&szMan[4] = nBuff[3];
+ *(int*)&szMan[8] = nBuff[2];
+ szMan[12] = 0;
+ if(strcmp(szMan, "AuthenticAMD") == 0)
+ m_nType = PROCESSOR_AMD;
+ else if(strcmp(szMan, "GenuineIntel") == 0)
+ m_nType = PROCESSOR_INTEL;
+ else
+ m_nType = PROCESSOR_UNKNOWN;
+
+ // Get highest extended feature
+ __cpuid(nBuff, 0x80000000);
+ nHighestFeatureEx = (unsigned)nBuff[0];
+
+ // Get processor brand name
+ /*
+ if(nHighestFeatureEx >= 0x80000004)
+ {
+ char szCPUName[49];
+ szCPUName[0] = 0;
+ __cpuid((int*)&szCPUName[0], 0x80000002);
+ __cpuid((int*)&szCPUName[16], 0x80000003);
+ __cpuid((int*)&szCPUName[32], 0x80000004);
+ szCPUName[48] = 0;
+ for(int i=(int)strlen(szCPUName)-1; i>=0; --i)
+ {
+ if(szCPUName[i] == ' ')
+ szCPUName[i] = '\0';
+ else
+ break;
+ }
+
+ ELog::Get().SystemFormat(L"PERF : CPU: %S (%S)\n", szCPUName, szMan);
+ }
+ else
+ ELog::Get().SystemFormat(L"PERF : CPU: %S\n", szMan);
+ */
+
+ // Get CPU features
+ m_nCPUFeatures = 0;
+ szFeatures[0] = 0;
+ if(nHighestFeature >= 1)
+ {
+ __cpuid(nBuff, 1);
+ if(nBuff[3] & 1<<23) m_nCPUFeatures|=MPC_MM_MMX;
+ if(nBuff[3] & 1<<25) m_nCPUFeatures|=MPC_MM_SSE;
+ if(nBuff[3] & 1<<26) m_nCPUFeatures|=MPC_MM_SSE2;
+ if(nBuff[2] & 1<<0) m_nCPUFeatures|=MPC_MM_SSE3;
+
+ // Intel specific:
+ if(m_nType == PROCESSOR_INTEL)
+ {
+ if(nBuff[2] & 1<<9) m_nCPUFeatures|=MPC_MM_SSSE3;
+ // if(nBuff[2] & 1<<7) strcat(szFeatures, "EST ");
+ }
+
+ //if(nBuff[3] & 1<<28)
+ // strcat(szFeatures, "HTT ");
+ }
+
+ // AMD specific:
+ if(m_nType == PROCESSOR_AMD)
+ {
+ // Get extended features
+ __cpuid(nBuff, 0x80000000);
+ if(nHighestFeatureEx >= 0x80000001)
+ {
+ __cpuid(nBuff, 0x80000001);
+ if(nBuff[3] & 1<<31) m_nCPUFeatures|=MPC_MM_3DNOW;
+ // if(nBuff[3] & 1<<30) strcat(szFeatures, "Ex3DNow! ");
+ if(nBuff[3] & 1<<22) m_nCPUFeatures|=MPC_MM_MMXEXT;
+ }
+
+ // Get level 1 cache size
+ //if(nHighestFeatureEx >= 0x80000005)
+ //{
+ // __cpuid(nBuff, 0x80000005);
+ // ELog::Get().SystemFormat(L"PERF : L1 cache size: %dK\n", ((unsigned)nBuff[2])>>24);
+ //}
+ }
+
+ /*
+ // Get cache size
+ if(nHighestFeatureEx >= 0x80000006)
+ {
+ __cpuid(nBuff, 0x80000006);
+ ELog::Get().SystemFormat(L"PERF : L2 cache size: %dK\n", ((unsigned)nBuff[2])>>16);
+ }
+
+ // Log features
+ ELog::Get().SystemFormat(L"PERF : CPU Features: %S\n", szFeatures);
+
+ // Get misc system info
+ SYSTEM_INFO theInfo;
+ GetSystemInfo(&theInfo);
+
+ // Log number of CPUs and speeds
+ ELog::Get().SystemFormat(L"PERF : Number of CPUs: %d\n", theInfo.dwNumberOfProcessors);
+ for(DWORD i=0; i<theInfo.dwNumberOfProcessors; ++i)
+ {
+ DWORD dwCPUSpeed = ReadCPUSpeedFromRegistry(i);
+ ELog::Get().SystemFormat(L"PERF : * CPU %d speed: ~%dMHz\n", i, dwCPUSpeed);
+ }
+ */
+
+ /*
+ unsigned nHighestFeature;
+ unsigned nHighestFeatureEx;
+
+ m_CPUInfo[0] = -1;
+ m_CPUInfoEx[0] = -1;
+ m_CPUAMDInfo[0] = -1;
+
+ __cpuid(m_CPUInfo, 0);
+ nHighestFeature = (unsigned)m_CPUInfo[0];
+
+ __cpuid(nBuff, 0x80000000);
+ nHighestFeatureEx = (unsigned)nBuff[0];
+
+ m_nDSPFlags = 0;
+ if (m_CPUInfo[3] & CPUID_MMX) m_nDSPFlags|=MPC_MM_MMX;
+ if (m_CPUInfo[3] & CPUID_SSE) m_nDSPFlags|=MPC_MM_SSE;
+ if (m_CPUInfo[3] & CPUID_SSE2) m_nDSPFlags|=MPC_MM_SSE2;
+ if (m_CPUInfo[2] & CPUID_SSE3) m_nDSPFlags|=MPC_MM_SSE3;
+
+ switch (m_nType)
+ {
+ case PROCESSOR_AMD :
+ __cpuid(m_CPUAMDInfo, 0x80000000);
+ if(nHighestFeatureEx >= 0x80000001)
+ {
+ if (m_CPUAMDInfo[3] & CPUID_MMXEXT) m_nDSPFlags|=MPC_MM_MMXEXT;
+ if (m_CPUAMDInfo[3] & CPUID_3DNOW) m_nDSPFlags|=MPC_MM_3DNOW;
+ }
+ break;
+ case PROCESSOR_INTEL :
+ if(m_CPUInfo[2] & CPUID_SSSE3) m_nDSPFlags|=MPC_MM_SSSE3;
+ break;
+ }
+ */
}
int CCpuId::GetProcessorNumber()
{
- SYSTEM_INFO SystemInfo;
- GetSystemInfo(&SystemInfo);
+ SYSTEM_INFO SystemInfo;
+ GetSystemInfo(&SystemInfo);
- return SystemInfo.dwNumberOfProcessors;
+ return SystemInfo.dwNumberOfProcessors;
}
diff --git a/src/filters/transform/MPCVideoDec/CpuId.h b/src/filters/transform/MPCVideoDec/CpuId.h
index 02148b82f..524ff9e4b 100644
--- a/src/filters/transform/MPCVideoDec/CpuId.h
+++ b/src/filters/transform/MPCVideoDec/CpuId.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -26,40 +26,34 @@ class CCpuId
{
public:
- typedef enum PROCESSOR_TYPE
- {
- PROCESSOR_AMD,
- PROCESSOR_INTEL,
- PROCESSOR_UNKNOWN
- };
-
- // Enum codes identicals to FFMpeg cpu features define !
- typedef enum PROCESSOR_FEATURES
- {
- MPC_MM_MMX = 0x0001, /* standard MMX */
- MPC_MM_3DNOW = 0x0004, /* AMD 3DNOW */
- MPC_MM_MMXEXT = 0x0002, /* SSE integer functions or AMD MMX ext */
- MPC_MM_SSE = 0x0008, /* SSE functions */
- MPC_MM_SSE2 = 0x0010, /* PIV SSE2 functions */
- MPC_MM_3DNOWEXT = 0x0020, /* AMD 3DNowExt */
- MPC_MM_SSE3 = 0x0040, /* AMD64 & PIV SSE3 functions*/
- MPC_MM_SSSE3 = 0x0080 /* PIV Core 2 SSSE3 functions*/
- };
-
- CCpuId();
-
- int GetFeatures() const
- {
- return m_nCPUFeatures;
- };
- PROCESSOR_TYPE GetType() const
- {
- return m_nType;
- };
- int GetProcessorNumber();
+ typedef enum PROCESSOR_TYPE
+ {
+ PROCESSOR_AMD,
+ PROCESSOR_INTEL,
+ PROCESSOR_UNKNOWN
+ };
+
+ // Enum codes identicals to FFMpeg cpu features define !
+ typedef enum PROCESSOR_FEATURES
+ {
+ MPC_MM_MMX = 0x0001, /* standard MMX */
+ MPC_MM_3DNOW = 0x0004, /* AMD 3DNOW */
+ MPC_MM_MMXEXT = 0x0002, /* SSE integer functions or AMD MMX ext */
+ MPC_MM_SSE = 0x0008, /* SSE functions */
+ MPC_MM_SSE2 = 0x0010, /* PIV SSE2 functions */
+ MPC_MM_3DNOWEXT = 0x0020, /* AMD 3DNowExt */
+ MPC_MM_SSE3 = 0x0040, /* AMD64 & PIV SSE3 functions*/
+ MPC_MM_SSSE3 = 0x0080 /* PIV Core 2 SSSE3 functions*/
+ };
+
+ CCpuId();
+
+ int GetFeatures() const { return m_nCPUFeatures; };
+ PROCESSOR_TYPE GetType() const { return m_nType; };
+ int GetProcessorNumber();
private :
- int m_nCPUFeatures;
- PROCESSOR_TYPE m_nType;
+ int m_nCPUFeatures;
+ PROCESSOR_TYPE m_nType;
};
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoder.cpp b/src/filters/transform/MPCVideoDec/DXVADecoder.cpp
index 2872d8bff..8c28598ac 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoder.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoder.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -32,7 +32,7 @@
extern "C"
{
-#include "FfmpegContext.h"
+ #include "FfmpegContext.h"
}
#define MAX_RETRY_ON_PENDING 50
@@ -47,718 +47,718 @@ extern "C"
-CDXVADecoder::CDXVADecoder(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
+CDXVADecoder::CDXVADecoder (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
{
- m_nEngine = ENGINE_DXVA1;
- m_pAMVideoAccelerator = pAMVideoAccelerator;
- m_dwBufferIndex = 0;
- m_nMaxWaiting = 3;
+ m_nEngine = ENGINE_DXVA1;
+ m_pAMVideoAccelerator = pAMVideoAccelerator;
+ m_dwBufferIndex = 0;
+ m_nMaxWaiting = 3;
- Init(pFilter, nMode, nPicEntryNumber);
+ Init (pFilter, nMode, nPicEntryNumber);
}
-CDXVADecoder::CDXVADecoder(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
+CDXVADecoder::CDXVADecoder (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
{
- m_nEngine = ENGINE_DXVA2;
- m_pDirectXVideoDec = pDirectXVideoDec;
- memcpy(&m_DXVA2Config, pDXVA2Config, sizeof(DXVA2_ConfigPictureDecode));
+ m_nEngine = ENGINE_DXVA2;
+ m_pDirectXVideoDec = pDirectXVideoDec;
+ memcpy (&m_DXVA2Config, pDXVA2Config, sizeof(DXVA2_ConfigPictureDecode));
- Init(pFilter, nMode, nPicEntryNumber);
+ Init (pFilter, nMode, nPicEntryNumber);
};
CDXVADecoder::~CDXVADecoder()
{
- SAFE_DELETE_ARRAY(m_pPictureStore);
- SAFE_DELETE_ARRAY(m_ExecuteParams.pCompressedBuffers);
+ SAFE_DELETE_ARRAY (m_pPictureStore);
+ SAFE_DELETE_ARRAY (m_ExecuteParams.pCompressedBuffers);
}
void CDXVADecoder::Init(CMPCVideoDecFilter* pFilter, DXVAMode nMode, int nPicEntryNumber)
{
- m_pFilter = pFilter;
- m_nMode = nMode;
- m_nPicEntryNumber = nPicEntryNumber;
- m_pPictureStore = DNew PICTURE_STORE[nPicEntryNumber];
- m_dwNumBuffersInfo = 0;
-
- memset(&m_DXVA1Config, 0, sizeof(m_DXVA1Config));
- memset(&m_DXVA1BufferDesc, 0, sizeof(m_DXVA1BufferDesc));
- m_DXVA1Config.guidConfigBitstreamEncryption = DXVA_NoEncrypt;
- m_DXVA1Config.guidConfigMBcontrolEncryption = DXVA_NoEncrypt;
- m_DXVA1Config.guidConfigResidDiffEncryption = DXVA_NoEncrypt;
- m_DXVA1Config.bConfigBitstreamRaw = 2;
-
- memset(&m_DXVA1BufferInfo, 0, sizeof(m_DXVA1BufferInfo));
- memset(&m_ExecuteParams, 0, sizeof(m_ExecuteParams));
- Flush();
+ m_pFilter = pFilter;
+ m_nMode = nMode;
+ m_nPicEntryNumber = nPicEntryNumber;
+ m_pPictureStore = DNew PICTURE_STORE[nPicEntryNumber];
+ m_dwNumBuffersInfo = 0;
+
+ memset (&m_DXVA1Config, 0, sizeof(m_DXVA1Config));
+ memset (&m_DXVA1BufferDesc, 0, sizeof(m_DXVA1BufferDesc));
+ m_DXVA1Config.guidConfigBitstreamEncryption = DXVA_NoEncrypt;
+ m_DXVA1Config.guidConfigMBcontrolEncryption = DXVA_NoEncrypt;
+ m_DXVA1Config.guidConfigResidDiffEncryption = DXVA_NoEncrypt;
+ m_DXVA1Config.bConfigBitstreamRaw = 2;
+
+ memset (&m_DXVA1BufferInfo, 0, sizeof(m_DXVA1BufferInfo));
+ memset (&m_ExecuteParams, 0, sizeof(m_ExecuteParams));
+ Flush();
}
// === Public functions
-void CDXVADecoder::AllocExecuteParams(int nSize)
+void CDXVADecoder::AllocExecuteParams (int nSize)
{
- m_ExecuteParams.pCompressedBuffers = DNew DXVA2_DecodeBufferDesc[nSize];
+ m_ExecuteParams.pCompressedBuffers = DNew DXVA2_DecodeBufferDesc[nSize];
- for(int i = 0; i < nSize; i++)
- memset(&m_ExecuteParams.pCompressedBuffers[i], 0, sizeof(DXVA2_DecodeBufferDesc));
+ for (int i=0; i<nSize; i++)
+ memset (&m_ExecuteParams.pCompressedBuffers[i], 0, sizeof(DXVA2_DecodeBufferDesc));
}
-void CDXVADecoder::SetExtraData(BYTE* pDataIn, UINT nSize)
+void CDXVADecoder::SetExtraData (BYTE* pDataIn, UINT nSize)
{
- // Extradata is codec dependant
- UNREFERENCED_PARAMETER(pDataIn);
- UNREFERENCED_PARAMETER(nSize);
+ // Extradata is codec dependant
+ UNREFERENCED_PARAMETER (pDataIn);
+ UNREFERENCED_PARAMETER (nSize);
}
void CDXVADecoder::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize)
{
- memcpy(pDXVABuffer, (BYTE*)pBuffer, nSize);
+ memcpy (pDXVABuffer, (BYTE*)pBuffer, nSize);
}
void CDXVADecoder::Flush()
{
- TRACE("CDXVADecoder::Flush\n");
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- m_pPictureStore[i].bRefPicture = false;
- m_pPictureStore[i].bInUse = false;
- m_pPictureStore[i].bDisplayed = false;
- m_pPictureStore[i].pSample = NULL;
- m_pPictureStore[i].nCodecSpecific = -1;
- m_pPictureStore[i].dwDisplayCount = 0;
- }
-
- m_nWaitingPics = 0;
- m_bFlushed = true;
- m_nFieldSurface = -1;
- m_dwDisplayCount = 1;
- m_pFieldSample = NULL;
+ TRACE ("CDXVADecoder::Flush\n");
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ m_pPictureStore[i].bRefPicture = false;
+ m_pPictureStore[i].bInUse = false;
+ m_pPictureStore[i].bDisplayed = false;
+ m_pPictureStore[i].pSample = NULL;
+ m_pPictureStore[i].nCodecSpecific = -1;
+ m_pPictureStore[i].dwDisplayCount = 0;
+ }
+
+ m_nWaitingPics = 0;
+ m_bFlushed = true;
+ m_nFieldSurface = -1;
+ m_dwDisplayCount= 1;
+ m_pFieldSample = NULL;
}
HRESULT CDXVADecoder::ConfigureDXVA1()
{
- HRESULT hr = S_FALSE;
- DXVA_ConfigPictureDecode ConfigRequested;
-
- if(m_pAMVideoAccelerator)
- {
- memset(&ConfigRequested, 0, sizeof(ConfigRequested));
- ConfigRequested.guidConfigBitstreamEncryption = DXVA_NoEncrypt;
- ConfigRequested.guidConfigMBcontrolEncryption = DXVA_NoEncrypt;
- ConfigRequested.guidConfigResidDiffEncryption = DXVA_NoEncrypt;
- ConfigRequested.bConfigBitstreamRaw = 2;
-
- writeDXVA_QueryOrReplyFunc(&ConfigRequested.dwFunction, DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY, DXVA_PICTURE_DECODING_FUNCTION);
- hr = m_pAMVideoAccelerator->Execute(ConfigRequested.dwFunction, &ConfigRequested, sizeof(DXVA_ConfigPictureDecode), &m_DXVA1Config, sizeof(DXVA_ConfigPictureDecode), 0, NULL);
-
- // Copy to DXVA2 structure (simplify code based on accelerator config)
- m_DXVA2Config.guidConfigBitstreamEncryption = m_DXVA1Config.guidConfigBitstreamEncryption;
- m_DXVA2Config.guidConfigMBcontrolEncryption = m_DXVA1Config.guidConfigMBcontrolEncryption;
- m_DXVA2Config.guidConfigResidDiffEncryption = m_DXVA1Config.guidConfigResidDiffEncryption;
- m_DXVA2Config.ConfigBitstreamRaw = m_DXVA1Config.bConfigBitstreamRaw;
- m_DXVA2Config.ConfigMBcontrolRasterOrder = m_DXVA1Config.bConfigMBcontrolRasterOrder;
- m_DXVA2Config.ConfigResidDiffHost = m_DXVA1Config.bConfigResidDiffHost;
- m_DXVA2Config.ConfigSpatialResid8 = m_DXVA1Config.bConfigSpatialResid8;
- m_DXVA2Config.ConfigResid8Subtraction = m_DXVA1Config.bConfigResid8Subtraction;
- m_DXVA2Config.ConfigSpatialHost8or9Clipping = m_DXVA1Config.bConfigSpatialHost8or9Clipping;
- m_DXVA2Config.ConfigSpatialResidInterleaved = m_DXVA1Config.bConfigSpatialResidInterleaved;
- m_DXVA2Config.ConfigIntraResidUnsigned = m_DXVA1Config.bConfigIntraResidUnsigned;
- m_DXVA2Config.ConfigResidDiffAccelerator = m_DXVA1Config.bConfigResidDiffAccelerator;
- m_DXVA2Config.ConfigHostInverseScan = m_DXVA1Config.bConfigHostInverseScan;
- m_DXVA2Config.ConfigSpecificIDCT = m_DXVA1Config.bConfigSpecificIDCT;
- m_DXVA2Config.Config4GroupedCoefs = m_DXVA1Config.bConfig4GroupedCoefs;
-
- if(SUCCEEDED(hr))
- {
- writeDXVA_QueryOrReplyFunc(&m_DXVA1Config.dwFunction, DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY, DXVA_PICTURE_DECODING_FUNCTION);
- hr = m_pAMVideoAccelerator->Execute(m_DXVA1Config.dwFunction, &m_DXVA1Config, sizeof(DXVA_ConfigPictureDecode), &ConfigRequested, sizeof(DXVA_ConfigPictureDecode), 0, NULL);
-
- // TODO : check config!
+ HRESULT hr = S_FALSE;
+ DXVA_ConfigPictureDecode ConfigRequested;
+
+ if (m_pAMVideoAccelerator)
+ {
+ memset (&ConfigRequested, 0, sizeof(ConfigRequested));
+ ConfigRequested.guidConfigBitstreamEncryption = DXVA_NoEncrypt;
+ ConfigRequested.guidConfigMBcontrolEncryption = DXVA_NoEncrypt;
+ ConfigRequested.guidConfigResidDiffEncryption = DXVA_NoEncrypt;
+ ConfigRequested.bConfigBitstreamRaw = 2;
+
+ writeDXVA_QueryOrReplyFunc (&ConfigRequested.dwFunction, DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY, DXVA_PICTURE_DECODING_FUNCTION);
+ hr = m_pAMVideoAccelerator->Execute (ConfigRequested.dwFunction, &ConfigRequested, sizeof(DXVA_ConfigPictureDecode), &m_DXVA1Config, sizeof(DXVA_ConfigPictureDecode), 0, NULL);
+
+ // Copy to DXVA2 structure (simplify code based on accelerator config)
+ m_DXVA2Config.guidConfigBitstreamEncryption = m_DXVA1Config.guidConfigBitstreamEncryption;
+ m_DXVA2Config.guidConfigMBcontrolEncryption = m_DXVA1Config.guidConfigMBcontrolEncryption;
+ m_DXVA2Config.guidConfigResidDiffEncryption = m_DXVA1Config.guidConfigResidDiffEncryption;
+ m_DXVA2Config.ConfigBitstreamRaw = m_DXVA1Config.bConfigBitstreamRaw;
+ m_DXVA2Config.ConfigMBcontrolRasterOrder = m_DXVA1Config.bConfigMBcontrolRasterOrder;
+ m_DXVA2Config.ConfigResidDiffHost = m_DXVA1Config.bConfigResidDiffHost;
+ m_DXVA2Config.ConfigSpatialResid8 = m_DXVA1Config.bConfigSpatialResid8;
+ m_DXVA2Config.ConfigResid8Subtraction = m_DXVA1Config.bConfigResid8Subtraction;
+ m_DXVA2Config.ConfigSpatialHost8or9Clipping = m_DXVA1Config.bConfigSpatialHost8or9Clipping;
+ m_DXVA2Config.ConfigSpatialResidInterleaved = m_DXVA1Config.bConfigSpatialResidInterleaved;
+ m_DXVA2Config.ConfigIntraResidUnsigned = m_DXVA1Config.bConfigIntraResidUnsigned;
+ m_DXVA2Config.ConfigResidDiffAccelerator = m_DXVA1Config.bConfigResidDiffAccelerator;
+ m_DXVA2Config.ConfigHostInverseScan = m_DXVA1Config.bConfigHostInverseScan;
+ m_DXVA2Config.ConfigSpecificIDCT = m_DXVA1Config.bConfigSpecificIDCT;
+ m_DXVA2Config.Config4GroupedCoefs = m_DXVA1Config.bConfig4GroupedCoefs;
+
+ if (SUCCEEDED (hr))
+ {
+ writeDXVA_QueryOrReplyFunc (&m_DXVA1Config.dwFunction, DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY, DXVA_PICTURE_DECODING_FUNCTION);
+ hr = m_pAMVideoAccelerator->Execute (m_DXVA1Config.dwFunction, &m_DXVA1Config, sizeof(DXVA_ConfigPictureDecode), &ConfigRequested, sizeof(DXVA_ConfigPictureDecode), 0, NULL);
+
+ // TODO : check config!
// ASSERT (ConfigRequested.bConfigBitstreamRaw == 2);
- AMVAUncompDataInfo DataInfo;
- DWORD dwNum = COMP_BUFFER_COUNT;
- DataInfo.dwUncompWidth = m_pFilter->PictWidthRounded();
- DataInfo.dwUncompHeight = m_pFilter->PictHeightRounded();
- memcpy(&DataInfo.ddUncompPixelFormat, m_pFilter->GetPixelFormat(), sizeof(DDPIXELFORMAT));
- hr = m_pAMVideoAccelerator->GetCompBufferInfo(m_pFilter->GetDXVADecoderGuid(), &DataInfo, &dwNum, m_ComBufferInfo);
- }
- }
- return hr;
+ AMVAUncompDataInfo DataInfo;
+ DWORD dwNum = COMP_BUFFER_COUNT;
+ DataInfo.dwUncompWidth = m_pFilter->PictWidthRounded();
+ DataInfo.dwUncompHeight = m_pFilter->PictHeightRounded();
+ memcpy (&DataInfo.ddUncompPixelFormat, m_pFilter->GetPixelFormat(), sizeof (DDPIXELFORMAT));
+ hr = m_pAMVideoAccelerator->GetCompBufferInfo (m_pFilter->GetDXVADecoderGuid(), &DataInfo, &dwNum, m_ComBufferInfo);
+ }
+ }
+ return hr;
}
-CDXVADecoder* CDXVADecoder::CreateDecoder(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, int nPicEntryNumber)
+CDXVADecoder* CDXVADecoder::CreateDecoder (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, int nPicEntryNumber)
{
- CDXVADecoder* pDecoder = NULL;
-
- if((*guidDecoder == DXVA2_ModeH264_E) || (*guidDecoder == DXVA2_ModeH264_F) || (*guidDecoder == DXVA_Intel_H264_ClearVideo))
- pDecoder = DNew CDXVADecoderH264(pFilter, pAMVideoAccelerator, H264_VLD, nPicEntryNumber);
- else if(*guidDecoder == DXVA2_ModeVC1_D || *guidDecoder == DXVA_Intel_VC1_ClearVideo)
- pDecoder = DNew CDXVADecoderVC1(pFilter, pAMVideoAccelerator, VC1_VLD, nPicEntryNumber);
- else if(*guidDecoder == DXVA2_ModeMPEG2_VLD)
- pDecoder = DNew CDXVADecoderMpeg2(pFilter, pAMVideoAccelerator, MPEG2_VLD, nPicEntryNumber);
- else
- ASSERT(FALSE); // Unknown decoder !!
-
- return pDecoder;
+ CDXVADecoder* pDecoder = NULL;
+
+ if ((*guidDecoder == DXVA2_ModeH264_E) || (*guidDecoder == DXVA2_ModeH264_F) || (*guidDecoder == DXVA_Intel_H264_ClearVideo))
+ pDecoder = DNew CDXVADecoderH264 (pFilter, pAMVideoAccelerator, H264_VLD, nPicEntryNumber);
+ else if (*guidDecoder == DXVA2_ModeVC1_D || *guidDecoder == DXVA_Intel_VC1_ClearVideo)
+ pDecoder = DNew CDXVADecoderVC1 (pFilter, pAMVideoAccelerator, VC1_VLD, nPicEntryNumber);
+ else if (*guidDecoder == DXVA2_ModeMPEG2_VLD)
+ pDecoder = DNew CDXVADecoderMpeg2 (pFilter, pAMVideoAccelerator, MPEG2_VLD, nPicEntryNumber);
+ else
+ ASSERT (FALSE); // Unknown decoder !!
+
+ return pDecoder;
}
-CDXVADecoder* CDXVADecoder::CreateDecoder(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, const GUID* guidDecoder, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
+CDXVADecoder* CDXVADecoder::CreateDecoder (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, const GUID* guidDecoder, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
{
- CDXVADecoder* pDecoder = NULL;
-
- if((*guidDecoder == DXVA2_ModeH264_E) || (*guidDecoder == DXVA2_ModeH264_F) || (*guidDecoder == DXVA_Intel_H264_ClearVideo))
- pDecoder = DNew CDXVADecoderH264(pFilter, pDirectXVideoDec, H264_VLD, nPicEntryNumber, pDXVA2Config);
- else if(*guidDecoder == DXVA2_ModeVC1_D || *guidDecoder == DXVA_Intel_VC1_ClearVideo)
- pDecoder = DNew CDXVADecoderVC1(pFilter, pDirectXVideoDec, VC1_VLD, nPicEntryNumber, pDXVA2Config);
- else if(*guidDecoder == DXVA2_ModeMPEG2_VLD)
- pDecoder = DNew CDXVADecoderMpeg2(pFilter, pDirectXVideoDec, MPEG2_VLD, nPicEntryNumber, pDXVA2Config);
- else
- ASSERT(FALSE); // Unknown decoder !!
-
- return pDecoder;
+ CDXVADecoder* pDecoder = NULL;
+
+ if ((*guidDecoder == DXVA2_ModeH264_E) || (*guidDecoder == DXVA2_ModeH264_F) || (*guidDecoder == DXVA_Intel_H264_ClearVideo))
+ pDecoder = DNew CDXVADecoderH264 (pFilter, pDirectXVideoDec, H264_VLD, nPicEntryNumber, pDXVA2Config);
+ else if (*guidDecoder == DXVA2_ModeVC1_D || *guidDecoder == DXVA_Intel_VC1_ClearVideo)
+ pDecoder = DNew CDXVADecoderVC1 (pFilter, pDirectXVideoDec, VC1_VLD, nPicEntryNumber, pDXVA2Config);
+ else if (*guidDecoder == DXVA2_ModeMPEG2_VLD)
+ pDecoder = DNew CDXVADecoderMpeg2 (pFilter, pDirectXVideoDec, MPEG2_VLD, nPicEntryNumber, pDXVA2Config);
+ else
+ ASSERT (FALSE); // Unknown decoder !!
+
+ return pDecoder;
}
// === DXVA functions
-HRESULT CDXVADecoder::AddExecuteBuffer(DWORD CompressedBufferType, UINT nSize, void* pBuffer, UINT* pRealSize)
+HRESULT CDXVADecoder::AddExecuteBuffer (DWORD CompressedBufferType, UINT nSize, void* pBuffer, UINT* pRealSize)
{
- HRESULT hr = E_INVALIDARG;
- DWORD dwNumMBs = 0;
- BYTE* pDXVABuffer;
+ HRESULT hr = E_INVALIDARG;
+ DWORD dwNumMBs = 0;
+ BYTE* pDXVABuffer;
- //if (CompressedBufferType != DXVA2_PictureParametersBufferType && CompressedBufferType != DXVA2_InverseQuantizationMatrixBufferType)
- // dwNumMBs = FFGetMBNumber (m_pFilter->GetAVCtx());
+ //if (CompressedBufferType != DXVA2_PictureParametersBufferType && CompressedBufferType != DXVA2_InverseQuantizationMatrixBufferType)
+ // dwNumMBs = FFGetMBNumber (m_pFilter->GetAVCtx());
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- DWORD dwTypeIndex;
- LONG lStride;
- dwTypeIndex = GetDXVA1CompressedType(CompressedBufferType);
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ DWORD dwTypeIndex;
+ LONG lStride;
+ dwTypeIndex = GetDXVA1CompressedType (CompressedBufferType);
// TRACE ("Fill : %d - %d\n", dwTypeIndex, m_dwBufferIndex);
- hr = m_pAMVideoAccelerator->GetBuffer(dwTypeIndex, m_dwBufferIndex, FALSE, (void**)&pDXVABuffer, &lStride);
- ASSERT(SUCCEEDED(hr));
-
- if(SUCCEEDED(hr))
- {
- if(CompressedBufferType == DXVA2_BitStreamDateBufferType)
- CopyBitstream(pDXVABuffer, (BYTE*)pBuffer, nSize);
- else
- memcpy(pDXVABuffer, (BYTE*)pBuffer, nSize);
- m_DXVA1BufferInfo[m_dwNumBuffersInfo].dwTypeIndex = dwTypeIndex;
- m_DXVA1BufferInfo[m_dwNumBuffersInfo].dwBufferIndex = m_dwBufferIndex;
- m_DXVA1BufferInfo[m_dwNumBuffersInfo].dwDataSize = nSize;
-
- m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwTypeIndex = dwTypeIndex;
- m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwBufferIndex = m_dwBufferIndex;
- m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwDataSize = nSize;
- m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwNumMBsInBuffer = dwNumMBs;
-
- m_dwNumBuffersInfo++;
- }
- break;
-
- case ENGINE_DXVA2 :
- UINT nDXVASize;
- hr = m_pDirectXVideoDec->GetBuffer(CompressedBufferType, (void**)&pDXVABuffer, &nDXVASize);
- ASSERT(nSize <= nDXVASize);
-
- if(SUCCEEDED(hr) && (nSize <= nDXVASize))
- {
- if(CompressedBufferType == DXVA2_BitStreamDateBufferType)
- CopyBitstream(pDXVABuffer, (BYTE*)pBuffer, nSize);
- else
- memcpy(pDXVABuffer, (BYTE*)pBuffer, nSize);
-
- m_ExecuteParams.pCompressedBuffers[m_ExecuteParams.NumCompBuffers].CompressedBufferType = CompressedBufferType;
- m_ExecuteParams.pCompressedBuffers[m_ExecuteParams.NumCompBuffers].DataSize = nSize;
- m_ExecuteParams.pCompressedBuffers[m_ExecuteParams.NumCompBuffers].NumMBsInBuffer = dwNumMBs;
- m_ExecuteParams.NumCompBuffers++;
-
- }
- break;
- default :
- ASSERT(FALSE);
- break;
- }
- if(pRealSize) *pRealSize = nSize;
-
- return hr;
+ hr = m_pAMVideoAccelerator->GetBuffer(dwTypeIndex, m_dwBufferIndex, FALSE, (void**)&pDXVABuffer, &lStride);
+ ASSERT (SUCCEEDED (hr));
+
+ if (SUCCEEDED (hr))
+ {
+ if (CompressedBufferType == DXVA2_BitStreamDateBufferType)
+ CopyBitstream (pDXVABuffer, (BYTE*)pBuffer, nSize);
+ else
+ memcpy (pDXVABuffer, (BYTE*)pBuffer, nSize);
+ m_DXVA1BufferInfo[m_dwNumBuffersInfo].dwTypeIndex = dwTypeIndex;
+ m_DXVA1BufferInfo[m_dwNumBuffersInfo].dwBufferIndex = m_dwBufferIndex;
+ m_DXVA1BufferInfo[m_dwNumBuffersInfo].dwDataSize = nSize;
+
+ m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwTypeIndex = dwTypeIndex;
+ m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwBufferIndex = m_dwBufferIndex;
+ m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwDataSize = nSize;
+ m_DXVA1BufferDesc[m_dwNumBuffersInfo].dwNumMBsInBuffer = dwNumMBs;
+
+ m_dwNumBuffersInfo++;
+ }
+ break;
+
+ case ENGINE_DXVA2 :
+ UINT nDXVASize;
+ hr = m_pDirectXVideoDec->GetBuffer (CompressedBufferType, (void**)&pDXVABuffer, &nDXVASize);
+ ASSERT (nSize <= nDXVASize);
+
+ if (SUCCEEDED (hr) && (nSize <= nDXVASize))
+ {
+ if (CompressedBufferType == DXVA2_BitStreamDateBufferType)
+ CopyBitstream (pDXVABuffer, (BYTE*)pBuffer, nSize);
+ else
+ memcpy (pDXVABuffer, (BYTE*)pBuffer, nSize);
+
+ m_ExecuteParams.pCompressedBuffers[m_ExecuteParams.NumCompBuffers].CompressedBufferType = CompressedBufferType;
+ m_ExecuteParams.pCompressedBuffers[m_ExecuteParams.NumCompBuffers].DataSize = nSize;
+ m_ExecuteParams.pCompressedBuffers[m_ExecuteParams.NumCompBuffers].NumMBsInBuffer = dwNumMBs;
+ m_ExecuteParams.NumCompBuffers++;
+
+ }
+ break;
+ default :
+ ASSERT (FALSE);
+ break;
+ }
+ if (pRealSize) *pRealSize = nSize;
+
+ return hr;
}
HRESULT CDXVADecoder::GetDeliveryBuffer(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, IMediaSample** ppSampleToDeliver)
{
- HRESULT hr;
- CComPtr<IMediaSample> pNewSample;
-
- // Change aspect ratio for DXVA2
- if(m_nEngine == ENGINE_DXVA2)
- {
- m_pFilter->UpdateAspectRatio();
- m_pFilter->ReconnectOutput(m_pFilter->PictWidthRounded(), m_pFilter->PictHeightRounded(), true, m_pFilter->PictWidth(), m_pFilter->PictHeight());
- }
- hr = m_pFilter->GetOutputPin()->GetDeliveryBuffer(&pNewSample, 0, 0, 0);
-
- if(SUCCEEDED(hr))
- {
- pNewSample->SetTime(&rtStart, &rtStop);
- pNewSample->SetMediaTime(NULL, NULL);
- *ppSampleToDeliver = pNewSample.Detach();
- }
- return hr;
+ HRESULT hr;
+ CComPtr<IMediaSample> pNewSample;
+
+ // Change aspect ratio for DXVA2
+ if (m_nEngine == ENGINE_DXVA2)
+ {
+ m_pFilter->UpdateAspectRatio();
+ m_pFilter->ReconnectOutput(m_pFilter->PictWidthRounded(), m_pFilter->PictHeightRounded(), true, m_pFilter->PictWidth(), m_pFilter->PictHeight());
+ }
+ hr = m_pFilter->GetOutputPin()->GetDeliveryBuffer(&pNewSample, 0, 0, 0);
+
+ if (SUCCEEDED (hr))
+ {
+ pNewSample->SetTime(&rtStart, &rtStop);
+ pNewSample->SetMediaTime(NULL, NULL);
+ *ppSampleToDeliver = pNewSample.Detach();
+ }
+ return hr;
}
HRESULT CDXVADecoder::Execute()
{
- HRESULT hr = E_INVALIDARG;
+ HRESULT hr = E_INVALIDARG;
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- DWORD dwFunction;
- HRESULT hr2;
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ DWORD dwFunction;
+ HRESULT hr2;
// writeDXVA_QueryOrReplyFunc (&dwFunction, DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY, DXVA_PICTURE_DECODING_FUNCTION);
// hr = m_pAMVideoAccelerator->Execute (dwFunction, &m_DXVA1Config, sizeof(DXVA_ConfigPictureDecode), NULL, 0, m_dwNumBuffersInfo, m_DXVA1BufferInfo);
- DWORD dwResult;
- dwFunction = 0x01000000;
- hr = m_pAMVideoAccelerator->Execute(dwFunction, m_DXVA1BufferDesc, sizeof(DXVA_BufferDescription) * m_dwNumBuffersInfo, &dwResult, sizeof(dwResult), m_dwNumBuffersInfo, m_DXVA1BufferInfo);
- ASSERT(SUCCEEDED(hr));
-
- for(DWORD i = 0; i < m_dwNumBuffersInfo; i++)
- {
- hr2 = m_pAMVideoAccelerator->ReleaseBuffer(m_DXVA1BufferInfo[i].dwTypeIndex, m_DXVA1BufferInfo[i].dwBufferIndex);
- ASSERT(SUCCEEDED(hr2));
- }
-
- m_dwNumBuffersInfo = 0;
- break;
-
- case ENGINE_DXVA2 :
-
- for(DWORD i = 0; i < m_ExecuteParams.NumCompBuffers; i++)
- {
- hr2 = m_pDirectXVideoDec->ReleaseBuffer(m_ExecuteParams.pCompressedBuffers[i].CompressedBufferType);
- ASSERT(SUCCEEDED(hr2));
- }
-
- hr = m_pDirectXVideoDec->Execute(&m_ExecuteParams);
- m_ExecuteParams.NumCompBuffers = 0;
- break;
- default :
- ASSERT(FALSE);
- break;
- }
-
- return hr;
+ DWORD dwResult;
+ dwFunction = 0x01000000;
+ hr = m_pAMVideoAccelerator->Execute (dwFunction, m_DXVA1BufferDesc, sizeof(DXVA_BufferDescription)*m_dwNumBuffersInfo,&dwResult, sizeof(dwResult), m_dwNumBuffersInfo, m_DXVA1BufferInfo);
+ ASSERT (SUCCEEDED (hr));
+
+ for (DWORD i=0; i<m_dwNumBuffersInfo; i++)
+ {
+ hr2 = m_pAMVideoAccelerator->ReleaseBuffer (m_DXVA1BufferInfo[i].dwTypeIndex, m_DXVA1BufferInfo[i].dwBufferIndex);
+ ASSERT (SUCCEEDED (hr2));
+ }
+
+ m_dwNumBuffersInfo = 0;
+ break;
+
+ case ENGINE_DXVA2 :
+
+ for (DWORD i=0; i<m_ExecuteParams.NumCompBuffers; i++)
+ {
+ hr2 = m_pDirectXVideoDec->ReleaseBuffer (m_ExecuteParams.pCompressedBuffers[i].CompressedBufferType);
+ ASSERT (SUCCEEDED (hr2));
+ }
+
+ hr = m_pDirectXVideoDec->Execute(&m_ExecuteParams);
+ m_ExecuteParams.NumCompBuffers = 0;
+ break;
+ default :
+ ASSERT (FALSE);
+ break;
+ }
+
+ return hr;
}
HRESULT CDXVADecoder::QueryStatus(PVOID LPDXVAStatus, UINT nSize)
{
- HRESULT hr = E_INVALIDARG;
- DXVA2_DecodeExecuteParams ExecuteParams;
- DXVA2_DecodeExtensionData ExtensionData;
- DWORD dwFunction = 0x07000000;
-
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- hr = m_pAMVideoAccelerator->Execute(dwFunction, NULL, 0, LPDXVAStatus, nSize, 0, NULL);
- break;
-
- case ENGINE_DXVA2 :
- memset(&ExecuteParams, 0, sizeof(ExecuteParams));
- memset(&ExtensionData, 0, sizeof(ExtensionData));
- ExecuteParams.pExtensionData = &ExtensionData;
- ExtensionData.pPrivateOutputData = LPDXVAStatus;
- ExtensionData.PrivateOutputDataSize = nSize;
- ExtensionData.Function = 7;
- hr = m_pDirectXVideoDec->Execute(&ExecuteParams);
- break;
- default :
- ASSERT(FALSE);
- break;
- }
-
- return hr;
+ HRESULT hr = E_INVALIDARG;
+ DXVA2_DecodeExecuteParams ExecuteParams;
+ DXVA2_DecodeExtensionData ExtensionData;
+ DWORD dwFunction = 0x07000000;
+
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ hr = m_pAMVideoAccelerator->Execute (dwFunction, NULL, 0, LPDXVAStatus, nSize, 0, NULL);
+ break;
+
+ case ENGINE_DXVA2 :
+ memset (&ExecuteParams, 0, sizeof(ExecuteParams));
+ memset (&ExtensionData, 0, sizeof(ExtensionData));
+ ExecuteParams.pExtensionData = &ExtensionData;
+ ExtensionData.pPrivateOutputData = LPDXVAStatus;
+ ExtensionData.PrivateOutputDataSize = nSize;
+ ExtensionData.Function = 7;
+ hr = m_pDirectXVideoDec->Execute(&ExecuteParams);
+ break;
+ default :
+ ASSERT (FALSE);
+ break;
+ }
+
+ return hr;
}
-DWORD CDXVADecoder::GetDXVA1CompressedType(DWORD dwDXVA2CompressedType)
+DWORD CDXVADecoder::GetDXVA1CompressedType (DWORD dwDXVA2CompressedType)
{
- if(dwDXVA2CompressedType <= DXVA2_BitStreamDateBufferType)
- return dwDXVA2CompressedType + 1;
- else
- {
- switch(dwDXVA2CompressedType)
- {
- case DXVA2_MotionVectorBuffer :
- return DXVA_MOTION_VECTOR_BUFFER;
- break;
- case DXVA2_FilmGrainBuffer :
- return DXVA_FILM_GRAIN_BUFFER;
- break;
- default :
- ASSERT(FALSE);
- return DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED;
- }
- }
+ if (dwDXVA2CompressedType <= DXVA2_BitStreamDateBufferType)
+ return dwDXVA2CompressedType + 1;
+ else
+ {
+ switch (dwDXVA2CompressedType)
+ {
+ case DXVA2_MotionVectorBuffer :
+ return DXVA_MOTION_VECTOR_BUFFER;
+ break;
+ case DXVA2_FilmGrainBuffer :
+ return DXVA_FILM_GRAIN_BUFFER;
+ break;
+ default :
+ ASSERT (FALSE);
+ return DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED;
+ }
+ }
}
HRESULT CDXVADecoder::FindFreeDXVA1Buffer(DWORD dwTypeIndex, DWORD& dwBufferIndex)
{
- HRESULT hr;
- int nTry;
+ HRESULT hr;
+ int nTry;
- dwBufferIndex = 0; //(dwBufferIndex + 1) % m_ComBufferInfo[DXVA_PICTURE_DECODE_BUFFER].dwNumCompBuffers;
+ dwBufferIndex = 0; //(dwBufferIndex + 1) % m_ComBufferInfo[DXVA_PICTURE_DECODE_BUFFER].dwNumCompBuffers;
- DO_DXVA_PENDING_LOOP(m_pAMVideoAccelerator->QueryRenderStatus(-1, dwBufferIndex, 0));
-
- return hr;
+ DO_DXVA_PENDING_LOOP (m_pAMVideoAccelerator->QueryRenderStatus (-1, dwBufferIndex, 0));
+
+ return hr;
}
HRESULT CDXVADecoder::BeginFrame(int nSurfaceIndex, IMediaSample* pSampleToDeliver)
{
- HRESULT hr = E_INVALIDARG;
- int nTry = 0;
-
- for(int i = 0; i < 20; i++)
- {
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- AMVABeginFrameInfo BeginFrameInfo;
-
- BeginFrameInfo.dwDestSurfaceIndex = nSurfaceIndex;
- BeginFrameInfo.dwSizeInputData = sizeof(nSurfaceIndex);
- BeginFrameInfo.pInputData = &nSurfaceIndex;
- BeginFrameInfo.dwSizeOutputData = 0;
- BeginFrameInfo.pOutputData = NULL;
-
- DO_DXVA_PENDING_LOOP(m_pAMVideoAccelerator->BeginFrame(&BeginFrameInfo));
-
- ASSERT(SUCCEEDED(hr));
- // TRACE ("BeginFrame %d\n",nSurfaceIndex);
- if(SUCCEEDED(hr))
- hr = FindFreeDXVA1Buffer(-1, m_dwBufferIndex);
- break;
-
- case ENGINE_DXVA2 :
- {
- CComQIPtr<IMFGetService> pSampleService;
- CComPtr<IDirect3DSurface9> pDecoderRenderTarget;
- pSampleService = pSampleToDeliver;
- if(pSampleService)
- {
- hr = pSampleService->GetService(MR_BUFFER_SERVICE, __uuidof(IDirect3DSurface9), (void**) &pDecoderRenderTarget);
- if(SUCCEEDED(hr))
- DO_DXVA_PENDING_LOOP(m_pDirectXVideoDec->BeginFrame(pDecoderRenderTarget, NULL));
- }
- }
- break;
- default :
- ASSERT(FALSE);
- break;
- }
-
- // For slow accelerator wait a little...
- if(SUCCEEDED(hr)) break;
- Sleep(1);
- }
-
- return hr;
+ HRESULT hr = E_INVALIDARG;
+ int nTry = 0;
+
+ for (int i=0; i<20; i++)
+ {
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ AMVABeginFrameInfo BeginFrameInfo;
+
+ BeginFrameInfo.dwDestSurfaceIndex = nSurfaceIndex;
+ BeginFrameInfo.dwSizeInputData = sizeof(nSurfaceIndex);
+ BeginFrameInfo.pInputData = &nSurfaceIndex;
+ BeginFrameInfo.dwSizeOutputData = 0;
+ BeginFrameInfo.pOutputData = NULL;
+
+ DO_DXVA_PENDING_LOOP (m_pAMVideoAccelerator->BeginFrame(&BeginFrameInfo));
+
+ ASSERT (SUCCEEDED (hr));
+ // TRACE ("BeginFrame %d\n",nSurfaceIndex);
+ if (SUCCEEDED (hr))
+ hr = FindFreeDXVA1Buffer (-1, m_dwBufferIndex);
+ break;
+
+ case ENGINE_DXVA2 :
+ {
+ CComQIPtr<IMFGetService> pSampleService;
+ CComPtr<IDirect3DSurface9> pDecoderRenderTarget;
+ pSampleService = pSampleToDeliver;
+ if (pSampleService)
+ {
+ hr = pSampleService->GetService (MR_BUFFER_SERVICE, __uuidof(IDirect3DSurface9), (void**) &pDecoderRenderTarget);
+ if (SUCCEEDED (hr))
+ DO_DXVA_PENDING_LOOP (m_pDirectXVideoDec->BeginFrame(pDecoderRenderTarget, NULL));
+ }
+ }
+ break;
+ default :
+ ASSERT (FALSE);
+ break;
+ }
+
+ // For slow accelerator wait a little...
+ if (SUCCEEDED (hr)) break;
+ Sleep(1);
+ }
+
+ return hr;
}
HRESULT CDXVADecoder::EndFrame(int nSurfaceIndex)
{
- HRESULT hr = E_INVALIDARG;
- DWORD dwDummy = nSurfaceIndex;
+ HRESULT hr = E_INVALIDARG;
+ DWORD dwDummy = nSurfaceIndex;
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- AMVAEndFrameInfo EndFrameInfo;
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ AMVAEndFrameInfo EndFrameInfo;
- EndFrameInfo.dwSizeMiscData = sizeof(dwDummy); // TODO : usefull ??
- EndFrameInfo.pMiscData = &dwDummy;
- hr = m_pAMVideoAccelerator->EndFrame(&EndFrameInfo);
+ EndFrameInfo.dwSizeMiscData = sizeof (dwDummy); // TODO : usefull ??
+ EndFrameInfo.pMiscData = &dwDummy;
+ hr = m_pAMVideoAccelerator->EndFrame(&EndFrameInfo);
// TRACE ("EndFrame %d\n",nSurfaceIndex);
- ASSERT(SUCCEEDED(hr));
- break;
-
- case ENGINE_DXVA2 :
- hr = m_pDirectXVideoDec->EndFrame(NULL);
- break;
- default :
- ASSERT(FALSE);
- break;
- }
-
- return hr;
+ ASSERT (SUCCEEDED (hr));
+ break;
+
+ case ENGINE_DXVA2 :
+ hr = m_pDirectXVideoDec->EndFrame(NULL);
+ break;
+ default :
+ ASSERT (FALSE);
+ break;
+ }
+
+ return hr;
}
// === Picture store functions
-bool CDXVADecoder::AddToStore(int nSurfaceIndex, IMediaSample* pSample, bool bRefPicture,
- REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, bool bIsField,
- FF_FIELD_TYPE nFieldType, FF_SLICE_TYPE nSliceType, int nCodecSpecific)
+bool CDXVADecoder::AddToStore (int nSurfaceIndex, IMediaSample* pSample, bool bRefPicture,
+ REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, bool bIsField,
+ FF_FIELD_TYPE nFieldType, FF_SLICE_TYPE nSliceType, int nCodecSpecific)
{
- if(bIsField && (m_nFieldSurface == -1))
- {
- m_nFieldSurface = nSurfaceIndex;
- m_pFieldSample = pSample;
- m_pPictureStore[nSurfaceIndex].n1FieldType = nFieldType;
- m_pPictureStore[nSurfaceIndex].rtStart = rtStart;
- m_pPictureStore[nSurfaceIndex].rtStop = rtStop;
- m_pPictureStore[nSurfaceIndex].nCodecSpecific = nCodecSpecific;
- return false;
- }
- else
- {
- //TRACE ("Add Stor: %10I64d - %10I64d Ind = %d Codec=%d\n", rtStart, rtStop, nSurfaceIndex, nCodecSpecific);
- ASSERT(m_pPictureStore[nSurfaceIndex].pSample == NULL);
- ASSERT(!m_pPictureStore[nSurfaceIndex].bInUse);
- ASSERT((nSurfaceIndex < m_nPicEntryNumber) && (m_pPictureStore[nSurfaceIndex].pSample == NULL));
-
- m_pPictureStore[nSurfaceIndex].bRefPicture = bRefPicture;
- m_pPictureStore[nSurfaceIndex].bInUse = true;
- m_pPictureStore[nSurfaceIndex].bDisplayed = false;
- m_pPictureStore[nSurfaceIndex].pSample = pSample;
- m_pPictureStore[nSurfaceIndex].nSliceType = nSliceType;
-
- if(!bIsField)
- {
- m_pPictureStore[nSurfaceIndex].rtStart = rtStart;
- m_pPictureStore[nSurfaceIndex].rtStop = rtStop;
- m_pPictureStore[nSurfaceIndex].n1FieldType = nFieldType;
- m_pPictureStore[nSurfaceIndex].nCodecSpecific = nCodecSpecific;
- }
-
- m_nFieldSurface = -1;
- m_nWaitingPics++;
- return true;
- }
+ if (bIsField && (m_nFieldSurface == -1))
+ {
+ m_nFieldSurface = nSurfaceIndex;
+ m_pFieldSample = pSample;
+ m_pPictureStore[nSurfaceIndex].n1FieldType = nFieldType;
+ m_pPictureStore[nSurfaceIndex].rtStart = rtStart;
+ m_pPictureStore[nSurfaceIndex].rtStop = rtStop;
+ m_pPictureStore[nSurfaceIndex].nCodecSpecific = nCodecSpecific;
+ return false;
+ }
+ else
+ {
+ //TRACE ("Add Stor: %10I64d - %10I64d Ind = %d Codec=%d\n", rtStart, rtStop, nSurfaceIndex, nCodecSpecific);
+ ASSERT (m_pPictureStore[nSurfaceIndex].pSample == NULL);
+ ASSERT (!m_pPictureStore[nSurfaceIndex].bInUse);
+ ASSERT ((nSurfaceIndex < m_nPicEntryNumber) && (m_pPictureStore[nSurfaceIndex].pSample == NULL));
+
+ m_pPictureStore[nSurfaceIndex].bRefPicture = bRefPicture;
+ m_pPictureStore[nSurfaceIndex].bInUse = true;
+ m_pPictureStore[nSurfaceIndex].bDisplayed = false;
+ m_pPictureStore[nSurfaceIndex].pSample = pSample;
+ m_pPictureStore[nSurfaceIndex].nSliceType = nSliceType;
+
+ if (!bIsField)
+ {
+ m_pPictureStore[nSurfaceIndex].rtStart = rtStart;
+ m_pPictureStore[nSurfaceIndex].rtStop = rtStop;
+ m_pPictureStore[nSurfaceIndex].n1FieldType = nFieldType;
+ m_pPictureStore[nSurfaceIndex].nCodecSpecific = nCodecSpecific;
+ }
+
+ m_nFieldSurface = -1;
+ m_nWaitingPics++;
+ return true;
+ }
}
-void CDXVADecoder::UpdateStore(int nSurfaceIndex, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+void CDXVADecoder::UpdateStore (int nSurfaceIndex, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
- ASSERT((nSurfaceIndex < m_nPicEntryNumber) && m_pPictureStore[nSurfaceIndex].bInUse && !m_pPictureStore[nSurfaceIndex].bDisplayed);
- m_pPictureStore[nSurfaceIndex].rtStart = rtStart;
- m_pPictureStore[nSurfaceIndex].rtStop = rtStop;
+ ASSERT ((nSurfaceIndex < m_nPicEntryNumber) && m_pPictureStore[nSurfaceIndex].bInUse && !m_pPictureStore[nSurfaceIndex].bDisplayed);
+ m_pPictureStore[nSurfaceIndex].rtStart = rtStart;
+ m_pPictureStore[nSurfaceIndex].rtStop = rtStop;
}
-void CDXVADecoder::RemoveRefFrame(int nSurfaceIndex)
+void CDXVADecoder::RemoveRefFrame (int nSurfaceIndex)
{
- ASSERT((nSurfaceIndex < m_nPicEntryNumber) && m_pPictureStore[nSurfaceIndex].bInUse);
+ ASSERT ((nSurfaceIndex < m_nPicEntryNumber) && m_pPictureStore[nSurfaceIndex].bInUse);
- m_pPictureStore[nSurfaceIndex].bRefPicture = false;
- if(m_pPictureStore[nSurfaceIndex].bDisplayed)
- FreePictureSlot(nSurfaceIndex);
+ m_pPictureStore[nSurfaceIndex].bRefPicture = false;
+ if (m_pPictureStore[nSurfaceIndex].bDisplayed)
+ FreePictureSlot (nSurfaceIndex);
}
int CDXVADecoder::FindOldestFrame()
{
- REFERENCE_TIME rtMin = _I64_MAX;
- int nPos = -1;
-
- // TODO : find better solution...
- if(m_nWaitingPics > m_nMaxWaiting)
- {
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(!m_pPictureStore[i].bDisplayed &&
- m_pPictureStore[i].bInUse &&
- (m_pPictureStore[i].rtStart < rtMin))
- {
- rtMin = m_pPictureStore[i].rtStart;
- nPos = i;
- }
- }
- }
- return nPos;
+ REFERENCE_TIME rtMin = _I64_MAX;
+ int nPos = -1;
+
+ // TODO : find better solution...
+ if (m_nWaitingPics > m_nMaxWaiting)
+ {
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (!m_pPictureStore[i].bDisplayed &&
+ m_pPictureStore[i].bInUse &&
+ (m_pPictureStore[i].rtStart < rtMin))
+ {
+ rtMin = m_pPictureStore[i].rtStart;
+ nPos = i;
+ }
+ }
+ }
+ return nPos;
}
void CDXVADecoder::SetTypeSpecificFlags(PICTURE_STORE* pPicture, IMediaSample* pMS)
{
- if(CComQIPtr<IMediaSample2> pMS2 = pMS)
- {
- AM_SAMPLE2_PROPERTIES props;
- if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
- {
- props.dwTypeSpecificFlags &= ~0x7f;
-
- if(pPicture->n1FieldType == PICT_FRAME)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
- else
- {
- if(pPicture->n1FieldType == PICT_TOP_FIELD)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
- //if(m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD)
- // props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_REPEAT_FIELD;
- }
-
- switch(pPicture->nSliceType)
- {
- case I_TYPE :
- case SI_TYPE :
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
- break;
- case P_TYPE :
- case SP_TYPE :
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
- break;
- default :
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
- break;
- }
-
- pMS2->SetProperties(sizeof(props), (BYTE*)&props);
- }
- }
- pMS->SetTime(&pPicture->rtStart, &pPicture->rtStop);
+ if(CComQIPtr<IMediaSample2> pMS2 = pMS)
+ {
+ AM_SAMPLE2_PROPERTIES props;
+ if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
+ {
+ props.dwTypeSpecificFlags &= ~0x7f;
+
+ if(pPicture->n1FieldType == PICT_FRAME)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
+ else
+ {
+ if(pPicture->n1FieldType == PICT_TOP_FIELD)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
+ //if(m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD)
+ // props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_REPEAT_FIELD;
+ }
+
+ switch (pPicture->nSliceType)
+ {
+ case I_TYPE :
+ case SI_TYPE :
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
+ break;
+ case P_TYPE :
+ case SP_TYPE :
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
+ break;
+ default :
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
+ break;
+ }
+
+ pMS2->SetProperties(sizeof(props), (BYTE*)&props);
+ }
+ }
+ pMS->SetTime(&pPicture->rtStart, &pPicture->rtStop);
}
HRESULT CDXVADecoder::DisplayNextFrame()
{
- HRESULT hr = S_FALSE;
- CComPtr<IMediaSample> pSampleToDeliver;
- int nPicIndex;
-
- nPicIndex = FindOldestFrame();
- if(nPicIndex != -1)
- {
- if(m_pPictureStore[nPicIndex].rtStart >= 0)
- {
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- // For DXVA1, query a media sample at the last time (only one in the allocator)
- hr = GetDeliveryBuffer(m_pPictureStore[nPicIndex].rtStart, m_pPictureStore[nPicIndex].rtStop, &pSampleToDeliver);
- SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], pSampleToDeliver);
- if(SUCCEEDED(hr)) hr = m_pAMVideoAccelerator->DisplayFrame(nPicIndex, pSampleToDeliver);
- break;
- case ENGINE_DXVA2 :
- // For DXVA2 media sample is in the picture store
- m_pPictureStore[nPicIndex].pSample->SetTime(&m_pPictureStore[nPicIndex].rtStart, &m_pPictureStore[nPicIndex].rtStop);
- SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], m_pPictureStore[nPicIndex].pSample);
- hr = m_pFilter->GetOutputPin()->Deliver(m_pPictureStore[nPicIndex].pSample);
- break;
- }
+ HRESULT hr = S_FALSE;
+ CComPtr<IMediaSample> pSampleToDeliver;
+ int nPicIndex;
+
+ nPicIndex = FindOldestFrame();
+ if (nPicIndex != -1)
+ {
+ if (m_pPictureStore[nPicIndex].rtStart >= 0)
+ {
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ // For DXVA1, query a media sample at the last time (only one in the allocator)
+ hr = GetDeliveryBuffer (m_pPictureStore[nPicIndex].rtStart, m_pPictureStore[nPicIndex].rtStop, &pSampleToDeliver);
+ SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], pSampleToDeliver);
+ if (SUCCEEDED (hr)) hr = m_pAMVideoAccelerator->DisplayFrame(nPicIndex, pSampleToDeliver);
+ break;
+ case ENGINE_DXVA2 :
+ // For DXVA2 media sample is in the picture store
+ m_pPictureStore[nPicIndex].pSample->SetTime (&m_pPictureStore[nPicIndex].rtStart, &m_pPictureStore[nPicIndex].rtStop);
+ SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], m_pPictureStore[nPicIndex].pSample);
+ hr = m_pFilter->GetOutputPin()->Deliver(m_pPictureStore[nPicIndex].pSample);
+ break;
+ }
#if defined(_DEBUG) && 0
- static REFERENCE_TIME rtLast = 0;
- TRACE("Deliver : %10I64d - %10I64d (Dur = %10I64d) {Delta = %10I64d} Ind = %02d Codec=%d Ref=%d\n",
- m_pPictureStore[nPicIndex].rtStart,
- m_pPictureStore[nPicIndex].rtStop,
- m_pPictureStore[nPicIndex].rtStop - m_pPictureStore[nPicIndex].rtStart,
- m_pPictureStore[nPicIndex].rtStart - rtLast, nPicIndex,
- m_pPictureStore[nPicIndex].nCodecSpecific,
- m_pPictureStore[nPicIndex].bRefPicture);
- rtLast = m_pPictureStore[nPicIndex].rtStart;
+ static REFERENCE_TIME rtLast = 0;
+ TRACE ("Deliver : %10I64d - %10I64d (Dur = %10I64d) {Delta = %10I64d} Ind = %02d Codec=%d Ref=%d\n",
+ m_pPictureStore[nPicIndex].rtStart,
+ m_pPictureStore[nPicIndex].rtStop,
+ m_pPictureStore[nPicIndex].rtStop - m_pPictureStore[nPicIndex].rtStart,
+ m_pPictureStore[nPicIndex].rtStart - rtLast, nPicIndex,
+ m_pPictureStore[nPicIndex].nCodecSpecific,
+ m_pPictureStore[nPicIndex].bRefPicture);
+ rtLast = m_pPictureStore[nPicIndex].rtStart;
#endif
- }
+ }
- m_pPictureStore[nPicIndex].bDisplayed = true;
- if(!m_pPictureStore[nPicIndex].bRefPicture)
- FreePictureSlot(nPicIndex);
- }
+ m_pPictureStore[nPicIndex].bDisplayed = true;
+ if (!m_pPictureStore[nPicIndex].bRefPicture)
+ FreePictureSlot (nPicIndex);
+ }
- return hr;
+ return hr;
}
HRESULT CDXVADecoder::GetFreeSurfaceIndex(int& nSurfaceIndex, IMediaSample** ppSampleToDeliver, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
- HRESULT hr = E_UNEXPECTED;
- int nPos = -1;
- DWORD dwMinDisplay = MAXDWORD;
-
- if(m_nFieldSurface != -1)
- {
- nSurfaceIndex = m_nFieldSurface;
- *ppSampleToDeliver = m_pFieldSample.Detach();
- return S_FALSE;
- }
-
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(!m_pPictureStore[i].bInUse && m_pPictureStore[i].dwDisplayCount < dwMinDisplay)
- {
- dwMinDisplay = m_pPictureStore[i].dwDisplayCount;
- nPos = i;
- }
- }
-
- if(nPos != -1)
- {
- nSurfaceIndex = nPos;
- return S_OK;
- }
-
- // Ho ho...
- ASSERT(FALSE);
- Flush();
- break;
- case ENGINE_DXVA2 :
- CComPtr<IMediaSample> pNewSample;
- CComQIPtr<IMPCDXVA2Sample> pMPCDXVA2Sample;
- // TODO : test IDirect3DDeviceManager9::TestDevice !!!
+ HRESULT hr = E_UNEXPECTED;
+ int nPos = -1;
+ DWORD dwMinDisplay = MAXDWORD;
+
+ if (m_nFieldSurface != -1)
+ {
+ nSurfaceIndex = m_nFieldSurface;
+ *ppSampleToDeliver = m_pFieldSample.Detach();
+ return S_FALSE;
+ }
+
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (!m_pPictureStore[i].bInUse && m_pPictureStore[i].dwDisplayCount < dwMinDisplay)
+ {
+ dwMinDisplay = m_pPictureStore[i].dwDisplayCount;
+ nPos = i;
+ }
+ }
+
+ if (nPos != -1)
+ {
+ nSurfaceIndex = nPos;
+ return S_OK;
+ }
+
+ // Ho ho...
+ ASSERT (FALSE);
+ Flush();
+ break;
+ case ENGINE_DXVA2 :
+ CComPtr<IMediaSample> pNewSample;
+ CComQIPtr<IMPCDXVA2Sample> pMPCDXVA2Sample;
+ // TODO : test IDirect3DDeviceManager9::TestDevice !!!
// TRACE ("==> Try get buffer...\n");
- if(SUCCEEDED(hr = GetDeliveryBuffer(rtStart, rtStop, &pNewSample)))
- {
- pMPCDXVA2Sample = pNewSample;
- nSurfaceIndex = pMPCDXVA2Sample ? pMPCDXVA2Sample->GetDXSurfaceId() : 0;
- *ppSampleToDeliver = pNewSample.Detach();
+ if (SUCCEEDED (hr = GetDeliveryBuffer(rtStart, rtStop, &pNewSample)))
+ {
+ pMPCDXVA2Sample = pNewSample;
+ nSurfaceIndex = pMPCDXVA2Sample ? pMPCDXVA2Sample->GetDXSurfaceId() : 0;
+ *ppSampleToDeliver = pNewSample.Detach();
// TRACE ("GetFreeSurfaceIndex : %d\n", nSurfaceIndex);
- }
- break;
- }
+ }
+ break;
+ }
- return hr;
+ return hr;
}
-void CDXVADecoder::FreePictureSlot(int nSurfaceIndex)
+void CDXVADecoder::FreePictureSlot (int nSurfaceIndex)
{
// TRACE ("Free : %d\n", nSurfaceIndex);
- m_pPictureStore[nSurfaceIndex].dwDisplayCount = m_dwDisplayCount++;
- m_pPictureStore[nSurfaceIndex].bInUse = false;
- m_pPictureStore[nSurfaceIndex].bDisplayed = false;
- m_pPictureStore[nSurfaceIndex].pSample = NULL;
- m_pPictureStore[nSurfaceIndex].nCodecSpecific = -1;
- m_nWaitingPics--;
+ m_pPictureStore[nSurfaceIndex].dwDisplayCount = m_dwDisplayCount++;
+ m_pPictureStore[nSurfaceIndex].bInUse = false;
+ m_pPictureStore[nSurfaceIndex].bDisplayed = false;
+ m_pPictureStore[nSurfaceIndex].pSample = NULL;
+ m_pPictureStore[nSurfaceIndex].nCodecSpecific = -1;
+ m_nWaitingPics--;
}
BYTE CDXVADecoder::GetConfigResidDiffAccelerator()
{
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- return m_DXVA1Config.bConfigResidDiffAccelerator;
- case ENGINE_DXVA2 :
- return m_DXVA2Config.ConfigResidDiffAccelerator;
- }
- return 0;
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ return m_DXVA1Config.bConfigResidDiffAccelerator;
+ case ENGINE_DXVA2 :
+ return m_DXVA2Config.ConfigResidDiffAccelerator;
+ }
+ return 0;
}
BYTE CDXVADecoder::GetConfigIntraResidUnsigned()
{
- switch(m_nEngine)
- {
- case ENGINE_DXVA1 :
- return m_DXVA1Config.bConfigIntraResidUnsigned;
- case ENGINE_DXVA2 :
- return m_DXVA2Config.ConfigIntraResidUnsigned;
- }
- return 0;
+ switch (m_nEngine)
+ {
+ case ENGINE_DXVA1 :
+ return m_DXVA1Config.bConfigIntraResidUnsigned;
+ case ENGINE_DXVA2 :
+ return m_DXVA2Config.ConfigIntraResidUnsigned;
+ }
+ return 0;
} \ No newline at end of file
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoder.h b/src/filters/transform/MPCVideoDec/DXVADecoder.h
index de12cf9ea..19d874ab3 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoder.h
+++ b/src/filters/transform/MPCVideoDec/DXVADecoder.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -27,47 +27,47 @@
typedef enum
{
- ENGINE_DXVA1,
- ENGINE_DXVA2
+ ENGINE_DXVA1,
+ ENGINE_DXVA2
} DXVA_ENGINE;
typedef enum
{
- H264_VLD,
- VC1_VLD,
- MPEG2_VLD
+ H264_VLD,
+ VC1_VLD,
+ MPEG2_VLD
} DXVAMode;
typedef enum
{
- PICT_TOP_FIELD = 1,
- PICT_BOTTOM_FIELD = 2,
- PICT_FRAME = 3
+ PICT_TOP_FIELD = 1,
+ PICT_BOTTOM_FIELD = 2,
+ PICT_FRAME = 3
} FF_FIELD_TYPE;
typedef enum
{
- I_TYPE = 1, ///< Intra
- P_TYPE = 2, ///< Predicted
- B_TYPE = 3, ///< Bi-dir predicted
- S_TYPE = 4, ///< S(GMC)-VOP MPEG4
- SI_TYPE = 5, ///< Switching Intra
- SP_TYPE = 6, ///< Switching Predicted
- BI_TYPE = 7
+ I_TYPE = 1, ///< Intra
+ P_TYPE = 2, ///< Predicted
+ B_TYPE = 3, ///< Bi-dir predicted
+ S_TYPE = 4, ///< S(GMC)-VOP MPEG4
+ SI_TYPE = 5, ///< Switching Intra
+ SP_TYPE = 6, ///< Switching Predicted
+ BI_TYPE = 7
} FF_SLICE_TYPE;
typedef struct
{
- bool bRefPicture; // True if reference picture
- int bInUse; // Slot in use
- bool bDisplayed; // True if picture have been presented
- CComPtr<IMediaSample> pSample; // Only for DXVA2 !
- REFERENCE_TIME rtStart;
- REFERENCE_TIME rtStop;
- FF_FIELD_TYPE n1FieldType; // Top or bottom for the 1st field
- FF_SLICE_TYPE nSliceType;
- int nCodecSpecific;
- DWORD dwDisplayCount;
+ bool bRefPicture; // True if reference picture
+ int bInUse; // Slot in use
+ bool bDisplayed; // True if picture have been presented
+ CComPtr<IMediaSample> pSample; // Only for DXVA2 !
+ REFERENCE_TIME rtStart;
+ REFERENCE_TIME rtStop;
+ FF_FIELD_TYPE n1FieldType; // Top or bottom for the 1st field
+ FF_SLICE_TYPE nSliceType;
+ int nCodecSpecific;
+ DWORD dwDisplayCount;
} PICTURE_STORE;
@@ -80,95 +80,80 @@ class CMPCVideoDecFilter;
class CDXVADecoder
{
public :
- // === Public functions
- virtual ~CDXVADecoder();
- DXVAMode GetMode() const
- {
- return m_nMode;
- };
- DXVA_ENGINE GetEngine() const
- {
- return m_nEngine;
- };
- void AllocExecuteParams(int nSize);
- void SetDirectXVideoDec(IDirectXVideoDecoder* pDirectXVideoDec)
- {
- m_pDirectXVideoDec = pDirectXVideoDec;
- };
-
- virtual HRESULT DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop) = NULL;
- virtual void SetExtraData(BYTE* pDataIn, UINT nSize);
- virtual void CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
- virtual void Flush();
- HRESULT ConfigureDXVA1();
-
- static CDXVADecoder* CreateDecoder(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, int nPicEntryNumber);
- static CDXVADecoder* CreateDecoder(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, const GUID* guidDecoder, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
+ // === Public functions
+ virtual ~CDXVADecoder();
+ DXVAMode GetMode() const { return m_nMode; };
+ DXVA_ENGINE GetEngine() const { return m_nEngine; };
+ void AllocExecuteParams (int nSize);
+ void SetDirectXVideoDec (IDirectXVideoDecoder* pDirectXVideoDec) { m_pDirectXVideoDec = pDirectXVideoDec; };
+
+ virtual HRESULT DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop) = NULL;
+ virtual void SetExtraData (BYTE* pDataIn, UINT nSize);
+ virtual void CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
+ virtual void Flush();
+ HRESULT ConfigureDXVA1();
+
+ static CDXVADecoder* CreateDecoder (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, int nPicEntryNumber);
+ static CDXVADecoder* CreateDecoder (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, const GUID* guidDecoder, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
protected :
- CDXVADecoder(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
- CDXVADecoder(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
-
- CMPCVideoDecFilter* m_pFilter;
- bool m_bFlushed;
- int m_nMaxWaiting;
-
- PICTURE_STORE* m_pPictureStore; // Store reference picture, and delayed B-frames
- int m_nPicEntryNumber; // Total number of picture in store
- int m_nWaitingPics; // Number of picture not yet displayed
-
- // === DXVA functions
- HRESULT AddExecuteBuffer(DWORD CompressedBufferType, UINT nSize, void* pBuffer, UINT* pRealSize = NULL);
- HRESULT GetDeliveryBuffer(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, IMediaSample** ppSampleToDeliver);
- HRESULT Execute();
- DWORD GetDXVA1CompressedType(DWORD dwDXVA2CompressedType);
- HRESULT FindFreeDXVA1Buffer(DWORD dwTypeIndex, DWORD& dwBufferIndex);
- HRESULT BeginFrame(int nSurfaceIndex, IMediaSample* pSampleToDeliver);
- HRESULT EndFrame(int nSurfaceIndex);
- HRESULT QueryStatus(PVOID LPDXVAStatus, UINT nSize);
- BYTE GetConfigIntraResidUnsigned();
- BYTE GetConfigResidDiffAccelerator();
- DXVA_ConfigPictureDecode* GetDXVA1Config()
- {
- return &m_DXVA1Config;
- };
- DXVA2_ConfigPictureDecode* GetDXVA2Config()
- {
- return &m_DXVA2Config;
- };
-
- // === Picture store functions
- bool AddToStore(int nSurfaceIndex, IMediaSample* pSample, bool bRefPicture, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, bool bIsField, FF_FIELD_TYPE nFieldType, FF_SLICE_TYPE nSliceType, int nCodecSpecific);
- void UpdateStore(int nSurfaceIndex, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- void RemoveRefFrame(int nSurfaceIndex);
- HRESULT DisplayNextFrame();
- HRESULT GetFreeSurfaceIndex(int& nSurfaceIndex, IMediaSample** ppSampleToDeliver, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- virtual int FindOldestFrame();
+ CDXVADecoder (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
+ CDXVADecoder (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
+
+ CMPCVideoDecFilter* m_pFilter;
+ bool m_bFlushed;
+ int m_nMaxWaiting;
+
+ PICTURE_STORE* m_pPictureStore; // Store reference picture, and delayed B-frames
+ int m_nPicEntryNumber; // Total number of picture in store
+ int m_nWaitingPics; // Number of picture not yet displayed
+
+ // === DXVA functions
+ HRESULT AddExecuteBuffer (DWORD CompressedBufferType, UINT nSize, void* pBuffer, UINT* pRealSize = NULL);
+ HRESULT GetDeliveryBuffer(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, IMediaSample** ppSampleToDeliver);
+ HRESULT Execute();
+ DWORD GetDXVA1CompressedType (DWORD dwDXVA2CompressedType);
+ HRESULT FindFreeDXVA1Buffer(DWORD dwTypeIndex, DWORD& dwBufferIndex);
+ HRESULT BeginFrame(int nSurfaceIndex, IMediaSample* pSampleToDeliver);
+ HRESULT EndFrame(int nSurfaceIndex);
+ HRESULT QueryStatus(PVOID LPDXVAStatus, UINT nSize);
+ BYTE GetConfigIntraResidUnsigned();
+ BYTE GetConfigResidDiffAccelerator();
+ DXVA_ConfigPictureDecode* GetDXVA1Config() { return &m_DXVA1Config; };
+ DXVA2_ConfigPictureDecode* GetDXVA2Config() { return &m_DXVA2Config; };
+
+ // === Picture store functions
+ bool AddToStore (int nSurfaceIndex, IMediaSample* pSample, bool bRefPicture, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, bool bIsField, FF_FIELD_TYPE nFieldType, FF_SLICE_TYPE nSliceType, int nCodecSpecific);
+ void UpdateStore (int nSurfaceIndex, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ void RemoveRefFrame (int nSurfaceIndex);
+ HRESULT DisplayNextFrame();
+ HRESULT GetFreeSurfaceIndex(int& nSurfaceIndex, IMediaSample** ppSampleToDeliver, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ virtual int FindOldestFrame();
private :
- DXVAMode m_nMode;
- DXVA_ENGINE m_nEngine;
-
- CComPtr<IMediaSample> m_pFieldSample;
- int m_nFieldSurface;
-
- // === DXVA1 variables
- CComQIPtr<IAMVideoAccelerator> m_pAMVideoAccelerator;
- AMVABUFFERINFO m_DXVA1BufferInfo[MAX_COM_BUFFER];
- DXVA_BufferDescription m_DXVA1BufferDesc[MAX_COM_BUFFER];
- DWORD m_dwNumBuffersInfo;
- DXVA_ConfigPictureDecode m_DXVA1Config;
- AMVACompBufferInfo m_ComBufferInfo[COMP_BUFFER_COUNT];
- DWORD m_dwBufferIndex;
- DWORD m_dwDisplayCount;
-
- // === DXVA2 variables
- CComPtr<IDirectXVideoDecoder> m_pDirectXVideoDec;
- DXVA2_ConfigPictureDecode m_DXVA2Config;
- DXVA2_DecodeExecuteParams m_ExecuteParams;
-
- void Init(CMPCVideoDecFilter* pFilter, DXVAMode nMode, int nPicEntryNumber);
- void FreePictureSlot(int nSurfaceIndex);
- void SetTypeSpecificFlags(PICTURE_STORE* pPicture, IMediaSample* pMS);
+ DXVAMode m_nMode;
+ DXVA_ENGINE m_nEngine;
+
+ CComPtr<IMediaSample> m_pFieldSample;
+ int m_nFieldSurface;
+
+ // === DXVA1 variables
+ CComQIPtr<IAMVideoAccelerator> m_pAMVideoAccelerator;
+ AMVABUFFERINFO m_DXVA1BufferInfo[MAX_COM_BUFFER];
+ DXVA_BufferDescription m_DXVA1BufferDesc[MAX_COM_BUFFER];
+ DWORD m_dwNumBuffersInfo;
+ DXVA_ConfigPictureDecode m_DXVA1Config;
+ AMVACompBufferInfo m_ComBufferInfo[COMP_BUFFER_COUNT];
+ DWORD m_dwBufferIndex;
+ DWORD m_dwDisplayCount;
+
+ // === DXVA2 variables
+ CComPtr<IDirectXVideoDecoder> m_pDirectXVideoDec;
+ DXVA2_ConfigPictureDecode m_DXVA2Config;
+ DXVA2_DecodeExecuteParams m_ExecuteParams;
+
+ void Init(CMPCVideoDecFilter* pFilter, DXVAMode nMode, int nPicEntryNumber);
+ void FreePictureSlot (int nSurfaceIndex);
+ void SetTypeSpecificFlags(PICTURE_STORE* pPicture, IMediaSample* pMS);
}; \ No newline at end of file
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp b/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
index e0916735e..de1aecbd7 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderH264.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -30,22 +30,22 @@
extern "C"
{
-#include "FfmpegContext.h"
+ #include "FfmpegContext.h"
}
-CDXVADecoderH264::CDXVADecoderH264(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
- : CDXVADecoder(pFilter, pAMVideoAccelerator, nMode, nPicEntryNumber)
+CDXVADecoderH264::CDXVADecoderH264 (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
+ : CDXVADecoder (pFilter, pAMVideoAccelerator, nMode, nPicEntryNumber)
{
- m_bUseLongSlice = (GetDXVA1Config()->bConfigBitstreamRaw != 2);
- Init();
+ m_bUseLongSlice = (GetDXVA1Config()->bConfigBitstreamRaw != 2);
+ Init();
}
-CDXVADecoderH264::CDXVADecoderH264(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
- : CDXVADecoder(pFilter, pDirectXVideoDec, nMode, nPicEntryNumber, pDXVA2Config)
+CDXVADecoderH264::CDXVADecoderH264 (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
+ : CDXVADecoder (pFilter, pDirectXVideoDec, nMode, nPicEntryNumber, pDXVA2Config)
{
- m_bUseLongSlice = (m_pFilter->GetDXVA2Config()->ConfigBitstreamRaw != 2);
- Init();
+ m_bUseLongSlice = (m_pFilter->GetDXVA2Config()->ConfigBitstreamRaw != 2);
+ Init();
}
CDXVADecoderH264::~CDXVADecoderH264()
@@ -54,344 +54,342 @@ CDXVADecoderH264::~CDXVADecoderH264()
void CDXVADecoderH264::Init()
{
- memset(&m_DXVAPicParams, 0, sizeof(m_DXVAPicParams));
- memset(&m_DXVAPicParams, 0, sizeof(DXVA_PicParams_H264));
- memset(&m_pSliceLong, 0, sizeof(DXVA_Slice_H264_Long) *MAX_SLICES);
- memset(&m_pSliceShort, 0, sizeof(DXVA_Slice_H264_Short)*MAX_SLICES);
-
- m_DXVAPicParams.MbsConsecutiveFlag = 1;
- if(m_pFilter->GetPCIVendor() == PCIV_Intel)
- m_DXVAPicParams.Reserved16Bits = 0x534c;
- else
- m_DXVAPicParams.Reserved16Bits = 0;
- m_DXVAPicParams.ContinuationFlag = 1;
- m_DXVAPicParams.Reserved8BitsA = 0;
- m_DXVAPicParams.Reserved8BitsB = 0;
- m_DXVAPicParams.MinLumaBipredSize8x8Flag = 1; // Improve accelerator performances
- m_DXVAPicParams.StatusReportFeedbackNumber = 0; // Use to report status
-
- for(int i = 0; i < 16; i++)
- {
- m_DXVAPicParams.RefFrameList[i].AssociatedFlag = 1;
- m_DXVAPicParams.RefFrameList[i].bPicEntry = 255;
- m_DXVAPicParams.RefFrameList[i].Index7Bits = 127;
- }
-
-
- m_nNALLength = 4;
- m_nMaxSlices = 0;
-
- switch(GetMode())
- {
- case H264_VLD :
- AllocExecuteParams(3);
- break;
- default :
- ASSERT(FALSE);
- }
+ memset (&m_DXVAPicParams, 0, sizeof (m_DXVAPicParams));
+ memset (&m_DXVAPicParams, 0, sizeof (DXVA_PicParams_H264));
+ memset (&m_pSliceLong, 0, sizeof (DXVA_Slice_H264_Long) *MAX_SLICES);
+ memset (&m_pSliceShort, 0, sizeof (DXVA_Slice_H264_Short)*MAX_SLICES);
+
+ m_DXVAPicParams.MbsConsecutiveFlag = 1;
+ if(m_pFilter->GetPCIVendor() == PCIV_Intel)
+ m_DXVAPicParams.Reserved16Bits = 0x534c;
+ else
+ m_DXVAPicParams.Reserved16Bits = 0;
+ m_DXVAPicParams.ContinuationFlag = 1;
+ m_DXVAPicParams.Reserved8BitsA = 0;
+ m_DXVAPicParams.Reserved8BitsB = 0;
+ m_DXVAPicParams.MinLumaBipredSize8x8Flag = 1; // Improve accelerator performances
+ m_DXVAPicParams.StatusReportFeedbackNumber = 0; // Use to report status
+
+ for (int i =0; i<16; i++)
+ {
+ m_DXVAPicParams.RefFrameList[i].AssociatedFlag = 1;
+ m_DXVAPicParams.RefFrameList[i].bPicEntry = 255;
+ m_DXVAPicParams.RefFrameList[i].Index7Bits = 127;
+ }
+
+
+ m_nNALLength = 4;
+ m_nMaxSlices = 0;
+
+ switch (GetMode())
+ {
+ case H264_VLD :
+ AllocExecuteParams (3);
+ break;
+ default :
+ ASSERT(FALSE);
+ }
}
void CDXVADecoderH264::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize)
{
- CH264Nalu Nalu;
- int nDummy;
- int nSlices = 0;
- int nDxvaNalLength;
+ CH264Nalu Nalu;
+ int nDummy;
+ int nSlices = 0;
+ int nDxvaNalLength;
- Nalu.SetBuffer(pBuffer, nSize, m_nNALLength);
- nSize = 0;
+ Nalu.SetBuffer (pBuffer, nSize, m_nNALLength);
+ nSize = 0;
#if 0
- // Test to place Nal on multiple of 128 bytes (seems to be not necessary)
- if(!m_bUseLongSlice)
- {
- while(Nalu.ReadNext())
- {
- switch(Nalu.GetType())
- {
- case NALU_TYPE_SLICE:
- case NALU_TYPE_IDR:
- // For AVC1, put startcode 0x000001
- pDXVABuffer[0] = pDXVABuffer[1] = 0;
- pDXVABuffer[2] = 1;
-
- // Copy NALU
- memcpy(pDXVABuffer + 3, Nalu.GetDataBuffer(), Nalu.GetDataLength());
-
- // Complete with zero padding (buffer size should be a multiple of 128)
- nDummy = 128 - ((Nalu.GetDataLength() + 3) % 128);
- pDXVABuffer += Nalu.GetDataLength() + 3;
- memset(pDXVABuffer, 0, nDummy);
- pDXVABuffer += nDummy;
-
- // Update slice control buffer
- nDxvaNalLength = Nalu.GetDataLength() + 3 + nDummy;
- m_pSliceShort[nSlices].BSNALunitDataLocation = nSize;
- m_pSliceShort[nSlices].SliceBytesInBuffer = nDxvaNalLength;
-
- nSize += nDxvaNalLength;
- nSlices++;
- break;
- }
- }
- }
- else
+ // Test to place Nal on multiple of 128 bytes (seems to be not necessary)
+ if(!m_bUseLongSlice)
+ {
+ while (Nalu.ReadNext())
+ {
+ switch (Nalu.GetType())
+ {
+ case NALU_TYPE_SLICE:
+ case NALU_TYPE_IDR:
+ // For AVC1, put startcode 0x000001
+ pDXVABuffer[0]=pDXVABuffer[1]=0;pDXVABuffer[2]=1;
+
+ // Copy NALU
+ memcpy (pDXVABuffer+3, Nalu.GetDataBuffer(), Nalu.GetDataLength());
+
+ // Complete with zero padding (buffer size should be a multiple of 128)
+ nDummy = 128 - ((Nalu.GetDataLength()+3) %128);
+ pDXVABuffer += Nalu.GetDataLength() + 3;
+ memset (pDXVABuffer, 0, nDummy);
+ pDXVABuffer += nDummy;
+
+ // Update slice control buffer
+ nDxvaNalLength = Nalu.GetDataLength()+3+nDummy;
+ m_pSliceShort[nSlices].BSNALunitDataLocation = nSize;
+ m_pSliceShort[nSlices].SliceBytesInBuffer = nDxvaNalLength;
+
+ nSize += nDxvaNalLength;
+ nSlices++;
+ break;
+ }
+ }
+ }
+ else
#endif
- {
- while(Nalu.ReadNext())
- {
- switch(Nalu.GetType())
- {
- case NALU_TYPE_SLICE:
- case NALU_TYPE_IDR:
- // For AVC1, put startcode 0x000001
- pDXVABuffer[0] = pDXVABuffer[1] = 0;
- pDXVABuffer[2] = 1;
-
- // Copy NALU
- memcpy(pDXVABuffer + 3, Nalu.GetDataBuffer(), Nalu.GetDataLength());
-
- // Update slice control buffer
- nDxvaNalLength = Nalu.GetDataLength() + 3;
- m_pSliceShort[nSlices].BSNALunitDataLocation = nSize;
- m_pSliceShort[nSlices].SliceBytesInBuffer = nDxvaNalLength;
-
- nSize += nDxvaNalLength;
- pDXVABuffer += nDxvaNalLength;
- nSlices++;
- break;
- }
- }
-
- // Complete with zero padding (buffer size should be a multiple of 128)
- nDummy = 128 - (nSize % 128);
-
- memset(pDXVABuffer, 0, nDummy);
- m_pSliceShort[nSlices-1].SliceBytesInBuffer += nDummy;
- nSize += nDummy;
- }
+ {
+ while (Nalu.ReadNext())
+ {
+ switch (Nalu.GetType())
+ {
+ case NALU_TYPE_SLICE:
+ case NALU_TYPE_IDR:
+ // For AVC1, put startcode 0x000001
+ pDXVABuffer[0]=pDXVABuffer[1]=0;pDXVABuffer[2]=1;
+
+ // Copy NALU
+ memcpy (pDXVABuffer+3, Nalu.GetDataBuffer(), Nalu.GetDataLength());
+
+ // Update slice control buffer
+ nDxvaNalLength = Nalu.GetDataLength()+3;
+ m_pSliceShort[nSlices].BSNALunitDataLocation = nSize;
+ m_pSliceShort[nSlices].SliceBytesInBuffer = nDxvaNalLength;
+
+ nSize += nDxvaNalLength;
+ pDXVABuffer += nDxvaNalLength;
+ nSlices++;
+ break;
+ }
+ }
+
+ // Complete with zero padding (buffer size should be a multiple of 128)
+ nDummy = 128 - (nSize %128);
+
+ memset (pDXVABuffer, 0, nDummy);
+ m_pSliceShort[nSlices-1].SliceBytesInBuffer += nDummy;
+ nSize += nDummy;
+ }
}
void CDXVADecoderH264::Flush()
{
- ClearRefFramesList();
- m_DXVAPicParams.UsedForReferenceFlags = 0;
- m_nOutPOC = -1;
- m_rtLastFrameDisplayed = 0;
+ ClearRefFramesList();
+ m_DXVAPicParams.UsedForReferenceFlags = 0;
+ m_nOutPOC = -1;
+ m_rtLastFrameDisplayed = 0;
- __super::Flush();
+ __super::Flush();
}
-HRESULT CDXVADecoderH264::DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+HRESULT CDXVADecoderH264::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
- HRESULT hr = S_FALSE;
- CH264Nalu Nalu;
- UINT nSlices = 0;
- int nSurfaceIndex;
- int nFieldType;
- int nSliceType;
- int nFramePOC;
- CComPtr<IMediaSample> pSampleToDeliver;
- CComQIPtr<IMPCDXVA2Sample> pDXVA2Sample;
- int nDXIndex = 0;
- UINT nNalOffset = 0;
- int nOutPOC;
- REFERENCE_TIME rtOutStart;
-
- Nalu.SetBuffer(pDataIn, nSize, m_nNALLength);
- FFH264DecodeBuffer(m_pFilter->GetAVCtx(), pDataIn, nSize, &nFramePOC, &nOutPOC, &rtOutStart);
-
- while(Nalu.ReadNext())
- {
- switch(Nalu.GetType())
- {
- case NALU_TYPE_SLICE:
- case NALU_TYPE_IDR:
- if(m_bUseLongSlice)
- {
- m_pSliceLong[nSlices].BSNALunitDataLocation = nNalOffset;
- m_pSliceLong[nSlices].SliceBytesInBuffer = Nalu.GetDataLength() + 3; //.GetRoundedDataLength();
- m_pSliceLong[nSlices].slice_id = nSlices;
- FF264UpdateRefFrameSliceLong(&m_DXVAPicParams, &m_pSliceLong[nSlices], m_pFilter->GetAVCtx());
-
- if(nSlices > 0)
- m_pSliceLong[nSlices-1].NumMbsForSlice = m_pSliceLong[nSlices].NumMbsForSlice = m_pSliceLong[nSlices].first_mb_in_slice - m_pSliceLong[nSlices-1].first_mb_in_slice;
- }
- nSlices++;
- nNalOffset += (UINT)(Nalu.GetDataLength() + 3);
- if(nSlices > MAX_SLICES) break;
- break;
- }
- }
- if(nSlices == 0) return S_FALSE;
-
- m_nMaxWaiting = min(max(m_DXVAPicParams.num_ref_frames, 3), 8);
-
- // If parsing fail (probably no PPS/SPS), continue anyway it may arrived later (happen on truncated streams)
- if(FAILED(FFH264BuildPicParams(&m_DXVAPicParams, &m_DXVAScalingMatrix, &nFieldType, &nSliceType, m_pFilter->GetAVCtx(), m_pFilter->GetPCIVendor())))
- return S_FALSE;
-
- // Wait I frame after a flush
- if(m_bFlushed && !m_DXVAPicParams.IntraPicFlag)
- return S_FALSE;
-
-
- CHECK_HR(GetFreeSurfaceIndex(nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop));
- FFH264SetCurrentPicture(nSurfaceIndex, &m_DXVAPicParams, m_pFilter->GetAVCtx());
-
- CHECK_HR(BeginFrame(nSurfaceIndex, pSampleToDeliver));
-
- m_DXVAPicParams.StatusReportFeedbackNumber++;
+ HRESULT hr = S_FALSE;
+ CH264Nalu Nalu;
+ UINT nSlices = 0;
+ int nSurfaceIndex;
+ int nFieldType;
+ int nSliceType;
+ int nFramePOC;
+ CComPtr<IMediaSample> pSampleToDeliver;
+ CComQIPtr<IMPCDXVA2Sample> pDXVA2Sample;
+ int nDXIndex = 0;
+ UINT nNalOffset = 0;
+ int nOutPOC;
+ REFERENCE_TIME rtOutStart;
+
+ Nalu.SetBuffer (pDataIn, nSize, m_nNALLength);
+ FFH264DecodeBuffer (m_pFilter->GetAVCtx(), pDataIn, nSize, &nFramePOC, &nOutPOC, &rtOutStart);
+
+ while (Nalu.ReadNext())
+ {
+ switch (Nalu.GetType())
+ {
+ case NALU_TYPE_SLICE:
+ case NALU_TYPE_IDR:
+ if(m_bUseLongSlice)
+ {
+ m_pSliceLong[nSlices].BSNALunitDataLocation = nNalOffset;
+ m_pSliceLong[nSlices].SliceBytesInBuffer = Nalu.GetDataLength()+3; //.GetRoundedDataLength();
+ m_pSliceLong[nSlices].slice_id = nSlices;
+ FF264UpdateRefFrameSliceLong(&m_DXVAPicParams, &m_pSliceLong[nSlices], m_pFilter->GetAVCtx());
+
+ if (nSlices>0)
+ m_pSliceLong[nSlices-1].NumMbsForSlice = m_pSliceLong[nSlices].NumMbsForSlice = m_pSliceLong[nSlices].first_mb_in_slice - m_pSliceLong[nSlices-1].first_mb_in_slice;
+ }
+ nSlices++;
+ nNalOffset += (UINT)(Nalu.GetDataLength() + 3);
+ if (nSlices > MAX_SLICES) break;
+ break;
+ }
+ }
+ if (nSlices == 0) return S_FALSE;
+
+ m_nMaxWaiting = min (max (m_DXVAPicParams.num_ref_frames, 3), 8);
+
+ // If parsing fail (probably no PPS/SPS), continue anyway it may arrived later (happen on truncated streams)
+ if (FAILED (FFH264BuildPicParams (&m_DXVAPicParams, &m_DXVAScalingMatrix, &nFieldType, &nSliceType, m_pFilter->GetAVCtx(), m_pFilter->GetPCIVendor())))
+ return S_FALSE;
+
+ // Wait I frame after a flush
+ if (m_bFlushed && !m_DXVAPicParams.IntraPicFlag)
+ return S_FALSE;
+
+
+ CHECK_HR (GetFreeSurfaceIndex (nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop));
+ FFH264SetCurrentPicture (nSurfaceIndex, &m_DXVAPicParams, m_pFilter->GetAVCtx());
+
+ CHECK_HR (BeginFrame(nSurfaceIndex, pSampleToDeliver));
+
+ m_DXVAPicParams.StatusReportFeedbackNumber++;
// TRACE("CDXVADecoderH264 : Decode frame %u\n", m_DXVAPicParams.StatusReportFeedbackNumber);
- // Send picture parameters
- CHECK_HR(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_DXVAPicParams), &m_DXVAPicParams));
- CHECK_HR(Execute());
+ // Send picture parameters
+ CHECK_HR (AddExecuteBuffer (DXVA2_PictureParametersBufferType, sizeof(m_DXVAPicParams), &m_DXVAPicParams));
+ CHECK_HR (Execute());
- // Add bitstream, slice control and quantization matrix
- CHECK_HR(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nSize, pDataIn, &nSize));
+ // Add bitstream, slice control and quantization matrix
+ CHECK_HR (AddExecuteBuffer (DXVA2_BitStreamDateBufferType, nSize, pDataIn, &nSize));
- if(m_bUseLongSlice)
- {
- CHECK_HR(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(DXVA_Slice_H264_Long)*nSlices, m_pSliceLong));
- }
- else
- {
- CHECK_HR(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(DXVA_Slice_H264_Short)*nSlices, m_pSliceShort));
- }
+ if (m_bUseLongSlice)
+ {
+ CHECK_HR(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(DXVA_Slice_H264_Long)*nSlices, m_pSliceLong));
+ }
+ else
+ {
+ CHECK_HR (AddExecuteBuffer (DXVA2_SliceControlBufferType, sizeof (DXVA_Slice_H264_Short)*nSlices, m_pSliceShort));
+ }
- CHECK_HR(AddExecuteBuffer(DXVA2_InverseQuantizationMatrixBufferType, sizeof(DXVA_Qmatrix_H264), (void*)&m_DXVAScalingMatrix));
+ CHECK_HR (AddExecuteBuffer (DXVA2_InverseQuantizationMatrixBufferType, sizeof (DXVA_Qmatrix_H264), (void*)&m_DXVAScalingMatrix));
- // Decode bitstream
- CHECK_HR(Execute());
+ // Decode bitstream
+ CHECK_HR (Execute());
- CHECK_HR(EndFrame(nSurfaceIndex));
+ CHECK_HR (EndFrame(nSurfaceIndex));
#ifdef _DEBUG
// DisplayStatus();
#endif
- bool bAdded = AddToStore(nSurfaceIndex, pSampleToDeliver, m_DXVAPicParams.RefPicFlag, rtStart, rtStop,
- m_DXVAPicParams.field_pic_flag, (FF_FIELD_TYPE)nFieldType,
- (FF_SLICE_TYPE)nSliceType, nFramePOC);
-
- FFH264UpdateRefFramesList(&m_DXVAPicParams, m_pFilter->GetAVCtx());
- ClearUnusedRefFrames();
-
- if(bAdded)
- {
- hr = DisplayNextFrame();
-
- if(nOutPOC != INT_MIN)
- {
- m_nOutPOC = nOutPOC;
- m_rtOutStart = rtOutStart;
- }
- }
- m_bFlushed = false;
- return hr;
+ bool bAdded = AddToStore (nSurfaceIndex, pSampleToDeliver, m_DXVAPicParams.RefPicFlag, rtStart, rtStop,
+ m_DXVAPicParams.field_pic_flag, (FF_FIELD_TYPE)nFieldType,
+ (FF_SLICE_TYPE)nSliceType, nFramePOC);
+
+ FFH264UpdateRefFramesList (&m_DXVAPicParams, m_pFilter->GetAVCtx());
+ ClearUnusedRefFrames();
+
+ if (bAdded)
+ {
+ hr = DisplayNextFrame();
+
+ if (nOutPOC != INT_MIN)
+ {
+ m_nOutPOC = nOutPOC;
+ m_rtOutStart = rtOutStart;
+ }
+ }
+ m_bFlushed = false;
+ return hr;
}
void CDXVADecoderH264::RemoveUndisplayedFrame(int nPOC)
{
- // Find frame with given POC, and free the slot
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(m_pPictureStore[i].bInUse && m_pPictureStore[i].nCodecSpecific == nPOC)
- {
- m_pPictureStore[i].bDisplayed = true;
- RemoveRefFrame(i);
- return;
- }
- }
+ // Find frame with given POC, and free the slot
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (m_pPictureStore[i].bInUse && m_pPictureStore[i].nCodecSpecific == nPOC)
+ {
+ m_pPictureStore[i].bDisplayed = true;
+ RemoveRefFrame (i);
+ return;
+ }
+ }
}
void CDXVADecoderH264::ClearUnusedRefFrames()
{
- // Remove old reference frames (not anymore a short or long ref frame)
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(m_pPictureStore[i].bRefPicture && m_pPictureStore[i].bDisplayed)
- if(!FFH264IsRefFrameInUse(i, m_pFilter->GetAVCtx()))
- RemoveRefFrame(i);
- }
+ // Remove old reference frames (not anymore a short or long ref frame)
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (m_pPictureStore[i].bRefPicture && m_pPictureStore[i].bDisplayed)
+ if (!FFH264IsRefFrameInUse (i, m_pFilter->GetAVCtx()))
+ RemoveRefFrame (i);
+ }
}
-void CDXVADecoderH264::SetExtraData(BYTE* pDataIn, UINT nSize)
+void CDXVADecoderH264::SetExtraData (BYTE* pDataIn, UINT nSize)
{
- AVCodecContext* pAVCtx = m_pFilter->GetAVCtx();
- m_nNALLength = pAVCtx->nal_length_size;
- FFH264DecodeBuffer(pAVCtx, pDataIn, nSize, NULL, NULL, NULL);
- FFH264SetDxvaSliceLong(pAVCtx, m_pSliceLong);
+ AVCodecContext* pAVCtx = m_pFilter->GetAVCtx();
+ m_nNALLength = pAVCtx->nal_length_size;
+ FFH264DecodeBuffer (pAVCtx, pDataIn, nSize, NULL, NULL, NULL);
+ FFH264SetDxvaSliceLong (pAVCtx, m_pSliceLong);
}
void CDXVADecoderH264::ClearRefFramesList()
{
- int i;
-
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(m_pPictureStore[i].bInUse)
- {
- m_pPictureStore[i].bDisplayed = true;
- RemoveRefFrame(i);
- }
- }
+ int i;
+
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (m_pPictureStore[i].bInUse)
+ {
+ m_pPictureStore[i].bDisplayed = true;
+ RemoveRefFrame (i);
+ }
+ }
}
HRESULT CDXVADecoderH264::DisplayStatus()
{
- HRESULT hr = E_INVALIDARG;
- DXVA_Status_H264 Status;
+ HRESULT hr = E_INVALIDARG;
+ DXVA_Status_H264 Status;
- memset(&Status, 0, sizeof(Status));
+ memset (&Status, 0, sizeof(Status));
- CHECK_HR(hr = CDXVADecoder::QueryStatus(&Status, sizeof(Status)));
+ CHECK_HR (hr = CDXVADecoder::QueryStatus(&Status, sizeof(Status)));
- TRACE("CDXVADecoderH264 : Status for the frame %u : bBufType = %u, bStatus = %u, wNumMbsAffected = %u\n",
- Status.StatusReportFeedbackNumber,
- Status.bBufType,
- Status.bStatus,
- Status.wNumMbsAffected);
+ TRACE ("CDXVADecoderH264 : Status for the frame %u : bBufType = %u, bStatus = %u, wNumMbsAffected = %u\n",
+ Status.StatusReportFeedbackNumber,
+ Status.bBufType,
+ Status.bStatus,
+ Status.wNumMbsAffected);
- return hr;
+ return hr;
}
int CDXVADecoderH264::FindOldestFrame()
{
- int nPos = -1;
- REFERENCE_TIME rtPos = _I64_MAX;
-
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(m_pPictureStore[i].bInUse && !m_pPictureStore[i].bDisplayed)
- {
- if(m_pPictureStore[i].nCodecSpecific == m_nOutPOC && m_pPictureStore[i].rtStart < rtPos)
- {
- nPos = i;
- rtPos = m_pPictureStore[i].rtStart;
- }
- }
- }
-
- if(nPos != -1)
- {
- if(m_rtOutStart == _I64_MIN)
- {
- // If start time not set (no PTS for example), guess presentation time!
- m_rtOutStart = m_rtLastFrameDisplayed;
- }
- m_pPictureStore[nPos].rtStart = m_rtOutStart;
- m_pPictureStore[nPos].rtStop = m_rtOutStart + m_pFilter->GetAvrTimePerFrame();
- m_rtLastFrameDisplayed = m_rtOutStart + m_pFilter->GetAvrTimePerFrame();
- m_pFilter->ReorderBFrames(m_pPictureStore[nPos].rtStart, m_pPictureStore[nPos].rtStop);
- }
-
- return nPos;
+ int nPos = -1;
+ REFERENCE_TIME rtPos = _I64_MAX;
+
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (m_pPictureStore[i].bInUse && !m_pPictureStore[i].bDisplayed)
+ {
+ if (m_pPictureStore[i].nCodecSpecific == m_nOutPOC && m_pPictureStore[i].rtStart < rtPos)
+ {
+ nPos = i;
+ rtPos = m_pPictureStore[i].rtStart;
+ }
+ }
+ }
+
+ if (nPos != -1)
+ {
+ if (m_rtOutStart == _I64_MIN)
+ {
+ // If start time not set (no PTS for example), guess presentation time!
+ m_rtOutStart = m_rtLastFrameDisplayed;
+ }
+ m_pPictureStore[nPos].rtStart = m_rtOutStart;
+ m_pPictureStore[nPos].rtStop = m_rtOutStart + m_pFilter->GetAvrTimePerFrame();
+ m_rtLastFrameDisplayed = m_rtOutStart + m_pFilter->GetAvrTimePerFrame();
+ m_pFilter->ReorderBFrames (m_pPictureStore[nPos].rtStart, m_pPictureStore[nPos].rtStop);
+ }
+
+ return nPos;
}
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderH264.h b/src/filters/transform/MPCVideoDec/DXVADecoderH264.h
index beba4a491..861fa72b4 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderH264.h
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderH264.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -33,37 +33,37 @@
class CDXVADecoderH264 : public CDXVADecoder
{
public:
- CDXVADecoderH264(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
- CDXVADecoderH264(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
- virtual ~CDXVADecoderH264();
+ CDXVADecoderH264 (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
+ CDXVADecoderH264 (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
+ virtual ~CDXVADecoderH264();
- virtual HRESULT DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- virtual void SetExtraData(BYTE* pDataIn, UINT nSize);
- virtual void CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
- virtual void Flush();
+ virtual HRESULT DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ virtual void SetExtraData (BYTE* pDataIn, UINT nSize);
+ virtual void CopyBitstream (BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
+ virtual void Flush();
protected :
- virtual int FindOldestFrame();
+ virtual int FindOldestFrame();
private:
- DXVA_PicParams_H264 m_DXVAPicParams;
- DXVA_Qmatrix_H264 m_DXVAScalingMatrix;
- DXVA_Slice_H264_Short m_pSliceShort[MAX_SLICES];
- DXVA_Slice_H264_Long m_pSliceLong[MAX_SLICES];
- UINT m_nMaxSlices;
- int m_nNALLength;
- bool m_bUseLongSlice;
- int m_nOutPOC;
- REFERENCE_TIME m_rtOutStart;
- REFERENCE_TIME m_rtLastFrameDisplayed;
+ DXVA_PicParams_H264 m_DXVAPicParams;
+ DXVA_Qmatrix_H264 m_DXVAScalingMatrix;
+ DXVA_Slice_H264_Short m_pSliceShort[MAX_SLICES];
+ DXVA_Slice_H264_Long m_pSliceLong[MAX_SLICES];
+ UINT m_nMaxSlices;
+ int m_nNALLength;
+ bool m_bUseLongSlice;
+ int m_nOutPOC;
+ REFERENCE_TIME m_rtOutStart;
+ REFERENCE_TIME m_rtLastFrameDisplayed;
- // Private functions
- void Init();
- HRESULT DisplayStatus();
+ // Private functions
+ void Init();
+ HRESULT DisplayStatus();
- // DXVA functions
- void RemoveUndisplayedFrame(int nPOC);
- void ClearRefFramesList();
- void ClearUnusedRefFrames();
+ // DXVA functions
+ void RemoveUndisplayedFrame(int nPOC);
+ void ClearRefFramesList();
+ void ClearUnusedRefFrames();
};
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.cpp b/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.cpp
index 059258caa..6d986fa42 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -26,159 +26,159 @@
extern "C"
{
-#include "FfmpegContext.h"
+ #include "FfmpegContext.h"
}
#if 0
-#define TRACE_MPEG2 TRACE
+ #define TRACE_MPEG2 TRACE
#else
-#define TRACE_MPEG2(...)
+ #define TRACE_MPEG2(...)
#endif
-CDXVADecoderMpeg2::CDXVADecoderMpeg2(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
- : CDXVADecoder(pFilter, pAMVideoAccelerator, nMode, nPicEntryNumber)
+CDXVADecoderMpeg2::CDXVADecoderMpeg2 (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
+ : CDXVADecoder (pFilter, pAMVideoAccelerator, nMode, nPicEntryNumber)
{
- Init();
+ Init();
}
-CDXVADecoderMpeg2::CDXVADecoderMpeg2(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
- : CDXVADecoder(pFilter, pDirectXVideoDec, nMode, nPicEntryNumber, pDXVA2Config)
+CDXVADecoderMpeg2::CDXVADecoderMpeg2 (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
+ : CDXVADecoder (pFilter, pDirectXVideoDec, nMode, nPicEntryNumber, pDXVA2Config)
{
- Init();
+ Init();
}
CDXVADecoderMpeg2::~CDXVADecoderMpeg2(void)
{
- Flush();
+ Flush();
}
void CDXVADecoderMpeg2::Init()
{
- memset(&m_PictureParams, 0, sizeof(m_PictureParams));
- memset(&m_SliceInfo, 0, sizeof(m_SliceInfo));
- memset(&m_QMatrixData, 0, sizeof(m_QMatrixData));
-
- m_nMaxWaiting = 5;
- m_wRefPictureIndex[0] = NO_REF_FRAME;
- m_wRefPictureIndex[1] = NO_REF_FRAME;
- m_nSliceCount = 0;
-
- switch(GetMode())
- {
- case MPEG2_VLD :
- AllocExecuteParams(4);
- break;
- default :
- ASSERT(FALSE);
- }
+ memset (&m_PictureParams, 0, sizeof(m_PictureParams));
+ memset (&m_SliceInfo, 0, sizeof(m_SliceInfo));
+ memset (&m_QMatrixData, 0, sizeof(m_QMatrixData));
+
+ m_nMaxWaiting = 5;
+ m_wRefPictureIndex[0] = NO_REF_FRAME;
+ m_wRefPictureIndex[1] = NO_REF_FRAME;
+ m_nSliceCount = 0;
+
+ switch (GetMode())
+ {
+ case MPEG2_VLD :
+ AllocExecuteParams (4);
+ break;
+ default :
+ ASSERT(FALSE);
+ }
}
// === Public functions
-HRESULT CDXVADecoderMpeg2::DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+HRESULT CDXVADecoderMpeg2::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
- HRESULT hr;
- int nSurfaceIndex;
- CComPtr<IMediaSample> pSampleToDeliver;
- int nFieldType;
- int nSliceType;
+ HRESULT hr;
+ int nSurfaceIndex;
+ CComPtr<IMediaSample> pSampleToDeliver;
+ int nFieldType;
+ int nSliceType;
- FFMpeg2DecodeFrame(&m_PictureParams, &m_QMatrixData, m_SliceInfo, &m_nSliceCount, m_pFilter->GetAVCtx(),
- m_pFilter->GetFrame(), &m_nNextCodecIndex, &nFieldType, &nSliceType, pDataIn, nSize);
+ FFMpeg2DecodeFrame (&m_PictureParams, &m_QMatrixData, m_SliceInfo, &m_nSliceCount, m_pFilter->GetAVCtx(),
+ m_pFilter->GetFrame(), &m_nNextCodecIndex, &nFieldType, &nSliceType, pDataIn, nSize);
- // Wait I frame after a flush
- if(m_bFlushed && ! m_PictureParams.bPicIntra)
- return S_FALSE;
+ // Wait I frame after a flush
+ if (m_bFlushed && ! m_PictureParams.bPicIntra)
+ return S_FALSE;
- hr = GetFreeSurfaceIndex(nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop);
- if(FAILED(hr))
- {
- ASSERT(hr == VFW_E_NOT_COMMITTED); // Normal when stop playing
- return hr;
- }
+ hr = GetFreeSurfaceIndex (nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop);
+ if (FAILED (hr))
+ {
+ ASSERT (hr == VFW_E_NOT_COMMITTED); // Normal when stop playing
+ return hr;
+ }
- CHECK_HR(BeginFrame(nSurfaceIndex, pSampleToDeliver));
+ CHECK_HR (BeginFrame(nSurfaceIndex, pSampleToDeliver));
- UpdatePictureParams(nSurfaceIndex);
+ UpdatePictureParams(nSurfaceIndex);
- TRACE_MPEG2("=> %s %I64d Surf=%d\n", GetFFMpegPictureType(nSliceType), rtStart, nSurfaceIndex);
+ TRACE_MPEG2 ("=> %s %I64d Surf=%d\n", GetFFMpegPictureType(nSliceType), rtStart, nSurfaceIndex);
- TRACE_MPEG2("CDXVADecoderMpeg2 : Decode frame %i\n", m_PictureParams.bPicScanMethod);
+ TRACE_MPEG2("CDXVADecoderMpeg2 : Decode frame %i\n", m_PictureParams.bPicScanMethod);
- CHECK_HR(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));
+ CHECK_HR (AddExecuteBuffer (DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));
- CHECK_HR(AddExecuteBuffer(DXVA2_InverseQuantizationMatrixBufferType, sizeof(m_QMatrixData), &m_QMatrixData));
+ CHECK_HR (AddExecuteBuffer (DXVA2_InverseQuantizationMatrixBufferType, sizeof(m_QMatrixData), &m_QMatrixData));
- // Send bitstream to accelerator
- CHECK_HR(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(DXVA_SliceInfo)*m_nSliceCount, &m_SliceInfo));
- CHECK_HR(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nSize, pDataIn, &nSize));
+ // Send bitstream to accelerator
+ CHECK_HR (AddExecuteBuffer (DXVA2_SliceControlBufferType, sizeof (DXVA_SliceInfo)*m_nSliceCount, &m_SliceInfo));
+ CHECK_HR (AddExecuteBuffer (DXVA2_BitStreamDateBufferType, nSize, pDataIn, &nSize));
- // Decode frame
- CHECK_HR(Execute());
- CHECK_HR(EndFrame(nSurfaceIndex));
+ // Decode frame
+ CHECK_HR (Execute());
+ CHECK_HR (EndFrame(nSurfaceIndex));
- AddToStore(nSurfaceIndex, pSampleToDeliver, (m_PictureParams.bPicBackwardPrediction != 1), rtStart, rtStop,
- false, (FF_FIELD_TYPE)nFieldType, (FF_SLICE_TYPE)nSliceType, FFGetCodedPicture(m_pFilter->GetAVCtx()));
- m_bFlushed = false;
+ AddToStore (nSurfaceIndex, pSampleToDeliver, (m_PictureParams.bPicBackwardPrediction != 1), rtStart, rtStop,
+ false,(FF_FIELD_TYPE)nFieldType, (FF_SLICE_TYPE)nSliceType, FFGetCodedPicture(m_pFilter->GetAVCtx()));
+ m_bFlushed = false;
- return DisplayNextFrame();
+ return DisplayNextFrame();
}
void CDXVADecoderMpeg2::UpdatePictureParams(int nSurfaceIndex)
{
- DXVA2_ConfigPictureDecode* cpd = GetDXVA2Config(); // Ok for DXVA1 too (parameters have been copied)
-
- m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
-
- // Manage reference picture list
- if(!m_PictureParams.bPicBackwardPrediction)
- {
- if(m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame(m_wRefPictureIndex[0]);
- m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
- m_wRefPictureIndex[1] = nSurfaceIndex;
- }
- m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
- m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;
-
- // Shall be 0 if bConfigResidDiffHost is 0 or if BPP > 8
- if(cpd->ConfigResidDiffHost == 0 || m_PictureParams.bBPPminus1 > 7)
- m_PictureParams.bPicSpatialResid8 = 0;
- else
- {
- if(m_PictureParams.bBPPminus1 == 7 && m_PictureParams.bPicIntra && cpd->ConfigResidDiffHost)
- // Shall be 1 if BPP is 8 and bPicIntra is 1 and bConfigResidDiffHost is 1
- m_PictureParams.bPicSpatialResid8 = 1;
- else
- // Shall be 1 if bConfigSpatialResid8 is 1
- m_PictureParams.bPicSpatialResid8 = cpd->ConfigSpatialResid8;
- }
-
- // Shall be 0 if bConfigResidDiffHost is 0 or if bConfigSpatialResid8 is 0 or if BPP > 8
- if(cpd->ConfigResidDiffHost == 0 || cpd->ConfigSpatialResid8 == 0 || m_PictureParams.bBPPminus1 > 7)
- m_PictureParams.bPicOverflowBlocks = 0;
-
- // Shall be 1 if bConfigHostInverseScan is 1 or if bConfigResidDiffAccelerator is 0.
-
- if(cpd->ConfigHostInverseScan == 1 || cpd->ConfigResidDiffAccelerator == 0)
- {
- m_PictureParams.bPicScanFixed = 1;
-
- if(cpd->ConfigHostInverseScan != 0)
- m_PictureParams.bPicScanMethod = 3; // 11 = Arbitrary scan with absolute coefficient address.
- else if(FFGetAlternateScan(m_pFilter->GetAVCtx()))
- m_PictureParams.bPicScanMethod = 1; // 00 = Zig-zag scan (MPEG-2 Figure 7-2)
- else
- m_PictureParams.bPicScanMethod = 0; // 01 = Alternate-vertical (MPEG-2 Figure 7-3),
- }
+ DXVA2_ConfigPictureDecode* cpd = GetDXVA2Config(); // Ok for DXVA1 too (parameters have been copied)
+
+ m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
+
+ // Manage reference picture list
+ if (!m_PictureParams.bPicBackwardPrediction)
+ {
+ if (m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame (m_wRefPictureIndex[0]);
+ m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
+ m_wRefPictureIndex[1] = nSurfaceIndex;
+ }
+ m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
+ m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;
+
+ // Shall be 0 if bConfigResidDiffHost is 0 or if BPP > 8
+ if (cpd->ConfigResidDiffHost == 0 || m_PictureParams.bBPPminus1 > 7)
+ m_PictureParams.bPicSpatialResid8 = 0;
+ else
+ {
+ if (m_PictureParams.bBPPminus1 == 7 && m_PictureParams.bPicIntra && cpd->ConfigResidDiffHost)
+ // Shall be 1 if BPP is 8 and bPicIntra is 1 and bConfigResidDiffHost is 1
+ m_PictureParams.bPicSpatialResid8 = 1;
+ else
+ // Shall be 1 if bConfigSpatialResid8 is 1
+ m_PictureParams.bPicSpatialResid8 = cpd->ConfigSpatialResid8;
+ }
+
+ // Shall be 0 if bConfigResidDiffHost is 0 or if bConfigSpatialResid8 is 0 or if BPP > 8
+ if (cpd->ConfigResidDiffHost == 0 || cpd->ConfigSpatialResid8 == 0 || m_PictureParams.bBPPminus1 > 7)
+ m_PictureParams.bPicOverflowBlocks = 0;
+
+ // Shall be 1 if bConfigHostInverseScan is 1 or if bConfigResidDiffAccelerator is 0.
+
+ if (cpd->ConfigHostInverseScan == 1 || cpd->ConfigResidDiffAccelerator == 0)
+ {
+ m_PictureParams.bPicScanFixed = 1;
+
+ if (cpd->ConfigHostInverseScan != 0)
+ m_PictureParams.bPicScanMethod = 3; // 11 = Arbitrary scan with absolute coefficient address.
+ else if (FFGetAlternateScan(m_pFilter->GetAVCtx()))
+ m_PictureParams.bPicScanMethod = 1; // 00 = Zig-zag scan (MPEG-2 Figure 7-2)
+ else
+ m_PictureParams.bPicScanMethod = 0; // 01 = Alternate-vertical (MPEG-2 Figure 7-3),
+ }
}
-void CDXVADecoderMpeg2::SetExtraData(BYTE* pDataIn, UINT nSize)
+void CDXVADecoderMpeg2::SetExtraData (BYTE* pDataIn, UINT nSize)
{
- m_PictureParams.wPicWidthInMBminus1 = m_pFilter->PictWidth() - 1;
- m_PictureParams.wPicHeightInMBminus1 = m_pFilter->PictHeight() - 1;
+ m_PictureParams.wPicWidthInMBminus1 = m_pFilter->PictWidth() - 1;
+ m_PictureParams.wPicHeightInMBminus1 = m_pFilter->PictHeight() - 1;
}
@@ -186,52 +186,52 @@ void CDXVADecoderMpeg2::SetExtraData(BYTE* pDataIn, UINT nSize)
void CDXVADecoderMpeg2::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize)
{
- int nDummy;
+ int nDummy;
- while(*((DWORD*)pBuffer) != 0x01010000)
- {
- pBuffer++;
- nSize--;
+ while (*((DWORD*)pBuffer) != 0x01010000)
+ {
+ pBuffer++;
+ nSize--;
- if(nSize <= 0) return;
- }
+ if (nSize <= 0) return;
+ }
- memcpy(pDXVABuffer, pBuffer, nSize);
+ memcpy (pDXVABuffer, pBuffer, nSize);
}
void CDXVADecoderMpeg2::Flush()
{
- m_nNextCodecIndex = INT_MIN;
+ m_nNextCodecIndex = INT_MIN;
- if(m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame(m_wRefPictureIndex[0]);
- if(m_wRefPictureIndex[1] != NO_REF_FRAME) RemoveRefFrame(m_wRefPictureIndex[1]);
+ if (m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame (m_wRefPictureIndex[0]);
+ if (m_wRefPictureIndex[1] != NO_REF_FRAME) RemoveRefFrame (m_wRefPictureIndex[1]);
- m_wRefPictureIndex[0] = NO_REF_FRAME;
- m_wRefPictureIndex[1] = NO_REF_FRAME;
+ m_wRefPictureIndex[0] = NO_REF_FRAME;
+ m_wRefPictureIndex[1] = NO_REF_FRAME;
- __super::Flush();
+ __super::Flush();
}
int CDXVADecoderMpeg2::FindOldestFrame()
{
- REFERENCE_TIME rtMin = _I64_MAX;
- int nPos = -1;
-
- for(int i = 0; i < m_nPicEntryNumber; i++)
- {
- if(!m_pPictureStore[i].bDisplayed &&
- m_pPictureStore[i].bInUse &&
- (m_pPictureStore[i].nCodecSpecific == m_nNextCodecIndex))
- {
- m_nNextCodecIndex = INT_MIN;
- nPos = i;
- }
- }
-
- if(nPos != -1)
- m_pFilter->UpdateFrameTime(m_pPictureStore[nPos].rtStart, m_pPictureStore[nPos].rtStop);
-
- return nPos;
+ REFERENCE_TIME rtMin = _I64_MAX;
+ int nPos = -1;
+
+ for (int i=0; i<m_nPicEntryNumber; i++)
+ {
+ if (!m_pPictureStore[i].bDisplayed &&
+ m_pPictureStore[i].bInUse &&
+ (m_pPictureStore[i].nCodecSpecific == m_nNextCodecIndex))
+ {
+ m_nNextCodecIndex = INT_MIN;
+ nPos = i;
+ }
+ }
+
+ if (nPos != -1)
+ m_pFilter->UpdateFrameTime(m_pPictureStore[nPos].rtStart, m_pPictureStore[nPos].rtStop);
+
+ return nPos;
}
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.h b/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.h
index f56886a3e..d87cea541 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.h
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderMpeg2.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -31,29 +31,29 @@
class CDXVADecoderMpeg2 : public CDXVADecoder
{
public:
- CDXVADecoderMpeg2(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
- CDXVADecoderMpeg2(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
- virtual ~CDXVADecoderMpeg2(void);
+ CDXVADecoderMpeg2 (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
+ CDXVADecoderMpeg2 (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
+ virtual ~CDXVADecoderMpeg2(void);
- // === Public functions
- virtual HRESULT DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- virtual void SetExtraData(BYTE* pDataIn, UINT nSize);
- virtual void CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
- virtual void Flush();
+ // === Public functions
+ virtual HRESULT DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ virtual void SetExtraData (BYTE* pDataIn, UINT nSize);
+ virtual void CopyBitstream (BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
+ virtual void Flush();
protected :
- virtual int FindOldestFrame();
+ virtual int FindOldestFrame();
private:
- DXVA_PictureParameters m_PictureParams;
- DXVA_QmatrixData m_QMatrixData;
- WORD m_wRefPictureIndex[2];
- DXVA_SliceInfo m_SliceInfo[MAX_SLICE];
- int m_nSliceCount;
+ DXVA_PictureParameters m_PictureParams;
+ DXVA_QmatrixData m_QMatrixData;
+ WORD m_wRefPictureIndex[2];
+ DXVA_SliceInfo m_SliceInfo[MAX_SLICE];
+ int m_nSliceCount;
- int m_nNextCodecIndex;
+ int m_nNextCodecIndex;
- // Private functions
- void Init();
- void UpdatePictureParams(int nSurfaceIndex);
+ // Private functions
+ void Init();
+ void UpdatePictureParams(int nSurfaceIndex);
};
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp b/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp
index 3c52577ef..d126ac3e8 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderVC1.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -26,301 +26,299 @@
extern "C"
{
-#include "FfmpegContext.h"
+ #include "FfmpegContext.h"
}
#if 0
-#define TRACE_VC1 TRACE
+ #define TRACE_VC1 TRACE
#else
-#define TRACE_VC1(...)
+ #define TRACE_VC1(...)
#endif
inline void SwapRT(REFERENCE_TIME& rtFirst, REFERENCE_TIME& rtSecond)
{
- REFERENCE_TIME rtTemp = rtFirst;
- rtFirst = rtSecond;
- rtSecond = rtTemp;
+ REFERENCE_TIME rtTemp = rtFirst;
+ rtFirst = rtSecond;
+ rtSecond = rtTemp;
}
-CDXVADecoderVC1::CDXVADecoderVC1(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
- : CDXVADecoder(pFilter, pAMVideoAccelerator, nMode, nPicEntryNumber)
+CDXVADecoderVC1::CDXVADecoderVC1 (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber)
+ : CDXVADecoder (pFilter, pAMVideoAccelerator, nMode, nPicEntryNumber)
{
- Init();
+ Init();
}
-CDXVADecoderVC1::CDXVADecoderVC1(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
- : CDXVADecoder(pFilter, pDirectXVideoDec, nMode, nPicEntryNumber, pDXVA2Config)
+CDXVADecoderVC1::CDXVADecoderVC1 (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config)
+ : CDXVADecoder (pFilter, pDirectXVideoDec, nMode, nPicEntryNumber, pDXVA2Config)
{
- Init();
+ Init();
}
CDXVADecoderVC1::~CDXVADecoderVC1(void)
{
- Flush();
+ Flush();
}
void CDXVADecoderVC1::Init()
{
- memset(&m_PictureParams, 0, sizeof(m_PictureParams));
- memset(&m_SliceInfo, 0, sizeof(m_SliceInfo));
-
- m_nMaxWaiting = 5;
- m_wRefPictureIndex[0] = NO_REF_FRAME;
- m_wRefPictureIndex[1] = NO_REF_FRAME;
-
- switch(GetMode())
- {
- case VC1_VLD :
- AllocExecuteParams(3);
- break;
- default :
- ASSERT(FALSE);
- }
+ memset (&m_PictureParams, 0, sizeof(m_PictureParams));
+ memset (&m_SliceInfo, 0, sizeof(m_SliceInfo));
+
+ m_nMaxWaiting = 5;
+ m_wRefPictureIndex[0] = NO_REF_FRAME;
+ m_wRefPictureIndex[1] = NO_REF_FRAME;
+
+ switch (GetMode())
+ {
+ case VC1_VLD :
+ AllocExecuteParams (3);
+ break;
+ default :
+ ASSERT(FALSE);
+ }
}
// === Public functions
-HRESULT CDXVADecoderVC1::DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+HRESULT CDXVADecoderVC1::DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
- HRESULT hr;
- int nSurfaceIndex;
- CComPtr<IMediaSample> pSampleToDeliver;
- int nFieldType;
- int nSliceType;
-
- FFVC1UpdatePictureParam(&m_PictureParams, m_pFilter->GetAVCtx(), &nFieldType, &nSliceType, pDataIn, nSize);
- if(FFIsSkipped(m_pFilter->GetAVCtx()))
- return S_OK;
-
- // Wait I frame after a flush
- if(m_bFlushed && ! m_PictureParams.bPicIntra)
- return S_FALSE;
-
- hr = GetFreeSurfaceIndex(nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop);
- if(FAILED(hr))
- {
- ASSERT(hr == VFW_E_NOT_COMMITTED); // Normal when stop playing
- return hr;
- }
-
- CHECK_HR(BeginFrame(nSurfaceIndex, pSampleToDeliver));
-
- TRACE_VC1("=> %s %I64d Surf=%d\n", GetFFMpegPictureType(nSliceType), rtStart, nSurfaceIndex);
-
- m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
- m_PictureParams.wDeblockedPictureIndex = m_PictureParams.wDecodedPictureIndex;
-
- // Manage reference picture list
- if(!m_PictureParams.bPicBackwardPrediction)
- {
- if(m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame(m_wRefPictureIndex[0]);
- m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
- m_wRefPictureIndex[1] = nSurfaceIndex;
- }
- m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
- m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;
-
- m_PictureParams.bPic4MVallowed = (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME && m_PictureParams.bPicStructure == 3) ? 1 : 0;
- m_PictureParams.bPicDeblockConfined |= (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME) ? 0x04 : 0;
-
- m_PictureParams.bPicScanMethod++; // Use for status reporting sections 3.8.1 and 3.8.2
-
- TRACE_VC1("CDXVADecoderVC1 : Decode frame %i\n", m_PictureParams.bPicScanMethod);
-
- // Send picture params to accelerator
- m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
- CHECK_HR(AddExecuteBuffer(DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));
+ HRESULT hr;
+ int nSurfaceIndex;
+ CComPtr<IMediaSample> pSampleToDeliver;
+ int nFieldType;
+ int nSliceType;
+
+ FFVC1UpdatePictureParam (&m_PictureParams, m_pFilter->GetAVCtx(), &nFieldType, &nSliceType, pDataIn, nSize);
+ if (FFIsSkipped (m_pFilter->GetAVCtx()))
+ return S_OK;
+
+ // Wait I frame after a flush
+ if (m_bFlushed && ! m_PictureParams.bPicIntra)
+ return S_FALSE;
+
+ hr = GetFreeSurfaceIndex (nSurfaceIndex, &pSampleToDeliver, rtStart, rtStop);
+ if (FAILED (hr))
+ {
+ ASSERT (hr == VFW_E_NOT_COMMITTED); // Normal when stop playing
+ return hr;
+ }
+
+ CHECK_HR (BeginFrame(nSurfaceIndex, pSampleToDeliver));
+
+ TRACE_VC1 ("=> %s %I64d Surf=%d\n", GetFFMpegPictureType(nSliceType), rtStart, nSurfaceIndex);
+
+ m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
+ m_PictureParams.wDeblockedPictureIndex = m_PictureParams.wDecodedPictureIndex;
+
+ // Manage reference picture list
+ if (!m_PictureParams.bPicBackwardPrediction)
+ {
+ if (m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame (m_wRefPictureIndex[0]);
+ m_wRefPictureIndex[0] = m_wRefPictureIndex[1];
+ m_wRefPictureIndex[1] = nSurfaceIndex;
+ }
+ m_PictureParams.wForwardRefPictureIndex = (m_PictureParams.bPicIntra == 0) ? m_wRefPictureIndex[0] : NO_REF_FRAME;
+ m_PictureParams.wBackwardRefPictureIndex = (m_PictureParams.bPicBackwardPrediction == 1) ? m_wRefPictureIndex[1] : NO_REF_FRAME;
+
+ m_PictureParams.bPic4MVallowed = (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME && m_PictureParams.bPicStructure == 3) ? 1 : 0;
+ m_PictureParams.bPicDeblockConfined |= (m_PictureParams.wBackwardRefPictureIndex == NO_REF_FRAME) ? 0x04 : 0;
+
+ m_PictureParams.bPicScanMethod++; // Use for status reporting sections 3.8.1 and 3.8.2
+
+ TRACE_VC1("CDXVADecoderVC1 : Decode frame %i\n", m_PictureParams.bPicScanMethod);
+
+ // Send picture params to accelerator
+ m_PictureParams.wDecodedPictureIndex = nSurfaceIndex;
+ CHECK_HR (AddExecuteBuffer (DXVA2_PictureParametersBufferType, sizeof(m_PictureParams), &m_PictureParams));
// CHECK_HR (Execute());
- // Send bitstream to accelerator
- CHECK_HR(AddExecuteBuffer(DXVA2_BitStreamDateBufferType, nSize, pDataIn, &nSize));
+ // Send bitstream to accelerator
+ CHECK_HR (AddExecuteBuffer (DXVA2_BitStreamDateBufferType, nSize, pDataIn, &nSize));
- m_SliceInfo.wQuantizerScaleCode = 1; // TODO : 1->31 ???
- m_SliceInfo.dwSliceBitsInBuffer = nSize * 8;
- CHECK_HR(AddExecuteBuffer(DXVA2_SliceControlBufferType, sizeof(m_SliceInfo), &m_SliceInfo));
+ m_SliceInfo.wQuantizerScaleCode = 1; // TODO : 1->31 ???
+ m_SliceInfo.dwSliceBitsInBuffer = nSize * 8;
+ CHECK_HR (AddExecuteBuffer (DXVA2_SliceControlBufferType, sizeof (m_SliceInfo), &m_SliceInfo));
- // Decode frame
- CHECK_HR(Execute());
- CHECK_HR(EndFrame(nSurfaceIndex));
+ // Decode frame
+ CHECK_HR (Execute());
+ CHECK_HR (EndFrame(nSurfaceIndex));
#ifdef _DEBUG
- DisplayStatus();
+ DisplayStatus();
#endif
- // Re-order B frames
- if(m_pFilter->IsReorderBFrame())
- {
- if(m_PictureParams.bPicBackwardPrediction == 1)
- {
- SwapRT(rtStart, m_rtStartDelayed);
- SwapRT(rtStop, m_rtStopDelayed);
- }
- else
- {
- // Save I or P reference time (swap later)
- if(!m_bFlushed)
- {
- if(m_nDelayedSurfaceIndex != -1)
- UpdateStore(m_nDelayedSurfaceIndex, m_rtStartDelayed, m_rtStopDelayed);
- m_rtStartDelayed = m_rtStopDelayed = _I64_MAX;
- SwapRT(rtStart, m_rtStartDelayed);
- SwapRT(rtStop, m_rtStopDelayed);
- m_nDelayedSurfaceIndex = nSurfaceIndex;
- }
- }
- }
-
- AddToStore(nSurfaceIndex, pSampleToDeliver, (m_PictureParams.bPicBackwardPrediction != 1), rtStart, rtStop,
- false, (FF_FIELD_TYPE)nFieldType, (FF_SLICE_TYPE)nSliceType, 0);
- m_bFlushed = false;
-
- return DisplayNextFrame();
+ // Re-order B frames
+ if (m_pFilter->IsReorderBFrame())
+ {
+ if (m_PictureParams.bPicBackwardPrediction == 1)
+ {
+ SwapRT (rtStart, m_rtStartDelayed);
+ SwapRT (rtStop, m_rtStopDelayed);
+ }
+ else
+ {
+ // Save I or P reference time (swap later)
+ if (!m_bFlushed)
+ {
+ if (m_nDelayedSurfaceIndex != -1)
+ UpdateStore (m_nDelayedSurfaceIndex, m_rtStartDelayed, m_rtStopDelayed);
+ m_rtStartDelayed = m_rtStopDelayed = _I64_MAX;
+ SwapRT (rtStart, m_rtStartDelayed);
+ SwapRT (rtStop, m_rtStopDelayed);
+ m_nDelayedSurfaceIndex = nSurfaceIndex;
+ }
+ }
+ }
+
+ AddToStore (nSurfaceIndex, pSampleToDeliver, (m_PictureParams.bPicBackwardPrediction != 1), rtStart, rtStop,
+ false,(FF_FIELD_TYPE)nFieldType, (FF_SLICE_TYPE)nSliceType, 0);
+ m_bFlushed = false;
+
+ return DisplayNextFrame();
}
-void CDXVADecoderVC1::SetExtraData(BYTE* pDataIn, UINT nSize)
+void CDXVADecoderVC1::SetExtraData (BYTE* pDataIn, UINT nSize)
{
- m_PictureParams.wPicWidthInMBminus1 = m_pFilter->PictWidth() - 1;
- m_PictureParams.wPicHeightInMBminus1 = m_pFilter->PictHeight() - 1;
- m_PictureParams.bMacroblockWidthMinus1 = 15;
- m_PictureParams.bMacroblockHeightMinus1 = 15;
- m_PictureParams.bBlockWidthMinus1 = 7;
- m_PictureParams.bBlockHeightMinus1 = 7;
- m_PictureParams.bBPPminus1 = 7;
-
- m_PictureParams.bMVprecisionAndChromaRelation = 0;
- m_PictureParams.bChromaFormat = VC1_CHROMA_420;
-
- m_PictureParams.bPicScanFixed = 0; // Use for status reporting sections 3.8.1 and 3.8.2
- m_PictureParams.bPicReadbackRequests = 0;
-
- m_PictureParams.bRcontrol = 0;
- m_PictureParams.bPicExtrapolation = 0;
-
- m_PictureParams.bPicDeblocked = 2; // TODO ???
- m_PictureParams.bPicOBMC = 0;
- m_PictureParams.bPicBinPB = 0; // TODO
- m_PictureParams.bMV_RPS = 0; // TODO
-
- m_PictureParams.bReservedBits = 0;
-
- // iWMV9 - i9IRU - iOHIT - iINSO - iWMVA - 0 - 0 - 0 | Section 3.2.5
- m_PictureParams.bBidirectionalAveragingMode = (1 << 7) |
- (GetConfigIntraResidUnsigned() << 6) | // i9IRU
- (GetConfigResidDiffAccelerator() << 5); // iOHIT
+ m_PictureParams.wPicWidthInMBminus1 = m_pFilter->PictWidth() - 1;
+ m_PictureParams.wPicHeightInMBminus1 = m_pFilter->PictHeight() - 1;
+ m_PictureParams.bMacroblockWidthMinus1 = 15;
+ m_PictureParams.bMacroblockHeightMinus1 = 15;
+ m_PictureParams.bBlockWidthMinus1 = 7;
+ m_PictureParams.bBlockHeightMinus1 = 7;
+ m_PictureParams.bBPPminus1 = 7;
+
+ m_PictureParams.bMVprecisionAndChromaRelation = 0;
+ m_PictureParams.bChromaFormat = VC1_CHROMA_420;
+
+ m_PictureParams.bPicScanFixed = 0; // Use for status reporting sections 3.8.1 and 3.8.2
+ m_PictureParams.bPicReadbackRequests = 0;
+
+ m_PictureParams.bRcontrol = 0;
+ m_PictureParams.bPicExtrapolation = 0;
+
+ m_PictureParams.bPicDeblocked = 2; // TODO ???
+ m_PictureParams.bPicOBMC = 0;
+ m_PictureParams.bPicBinPB = 0; // TODO
+ m_PictureParams.bMV_RPS = 0; // TODO
+
+ m_PictureParams.bReservedBits = 0;
+
+ // iWMV9 - i9IRU - iOHIT - iINSO - iWMVA - 0 - 0 - 0 | Section 3.2.5
+ m_PictureParams.bBidirectionalAveragingMode = (1 << 7) |
+ (GetConfigIntraResidUnsigned() <<6) | // i9IRU
+ (GetConfigResidDiffAccelerator() <<5); // iOHIT
}
BYTE* CDXVADecoderVC1::FindNextStartCode(BYTE* pBuffer, UINT nSize, UINT& nPacketSize)
{
- BYTE* pStart = pBuffer;
- BYTE bCode = 0;
- for(int i = 0; i < nSize - 4; i++)
- {
- if(((*((DWORD*)(pBuffer + i)) & 0x00FFFFFF) == 0x00010000) || (i >= nSize - 5))
- {
- if(bCode == 0)
- {
- bCode = pBuffer[i+3];
- if((nSize == 5) && (bCode == 0x0D))
- {
- nPacketSize = nSize;
- return pBuffer;
- }
- }
- else
- {
- if(bCode == 0x0D)
- {
- // Start code found!
- nPacketSize = i - (pStart - pBuffer) + (i >= nSize - 5 ? 5 : 1);
- return pStart;
- }
- else
- {
- // Other stuff, ignore it
- pStart = pBuffer + i;
- bCode = pBuffer[i+3];
- }
- }
- }
- }
-
- ASSERT(FALSE); // Should never happen!
- return NULL;
+ BYTE* pStart = pBuffer;
+ BYTE bCode = 0;
+ for (int i=0; i<nSize-4; i++)
+ {
+ if ( ((*((DWORD*)(pBuffer+i)) & 0x00FFFFFF) == 0x00010000) || (i >= nSize-5) )
+ {
+ if (bCode == 0)
+ {
+ bCode = pBuffer[i+3];
+ if ((nSize == 5) && (bCode == 0x0D))
+ {
+ nPacketSize = nSize;
+ return pBuffer;
+ }
+ }
+ else
+ {
+ if (bCode == 0x0D)
+ {
+ // Start code found!
+ nPacketSize = i - (pStart - pBuffer) + (i >= nSize-5 ? 5 : 1);
+ return pStart;
+ }
+ else
+ {
+ // Other stuff, ignore it
+ pStart = pBuffer + i;
+ bCode = pBuffer[i+3];
+ }
+ }
+ }
+ }
+
+ ASSERT (FALSE); // Should never happen!
+ return NULL;
}
void CDXVADecoderVC1::CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize)
{
- int nDummy;
-
- if((*((DWORD*)pBuffer) & 0x00FFFFFF) != 0x00010000)
- {
- // Some splitter have remove startcode (Haali)
- pDXVABuffer[0] = pDXVABuffer[1] = 0;
- pDXVABuffer[2] = 1;
- pDXVABuffer[3] = 0x0D;
- pDXVABuffer += 4;
- // Copy bitstream buffer, with zero padding (buffer is rounded to multiple of 128)
- memcpy(pDXVABuffer, (BYTE*)pBuffer, nSize);
- nSize += 4;
- }
- else
- {
- BYTE* pStart;
- UINT nPacketSize;
-
- pStart = FindNextStartCode(pBuffer, nSize, nPacketSize);
- if(pStart)
- {
- // Startcode already present
- memcpy(pDXVABuffer, (BYTE*)pStart, nPacketSize);
- nSize = nPacketSize;
- }
- }
-
- nDummy = 128 - (nSize % 128);
-
- pDXVABuffer += nSize;
- memset(pDXVABuffer, 0, nDummy);
- nSize += nDummy;
+ int nDummy;
+
+ if ( (*((DWORD*)pBuffer) & 0x00FFFFFF) != 0x00010000)
+ {
+ // Some splitter have remove startcode (Haali)
+ pDXVABuffer[0]=pDXVABuffer[1]=0; pDXVABuffer[2]=1; pDXVABuffer[3]=0x0D;
+ pDXVABuffer +=4;
+ // Copy bitstream buffer, with zero padding (buffer is rounded to multiple of 128)
+ memcpy (pDXVABuffer, (BYTE*)pBuffer, nSize);
+ nSize +=4;
+ }
+ else
+ {
+ BYTE* pStart;
+ UINT nPacketSize;
+
+ pStart = FindNextStartCode (pBuffer, nSize, nPacketSize);
+ if (pStart)
+ {
+ // Startcode already present
+ memcpy (pDXVABuffer, (BYTE*)pStart, nPacketSize);
+ nSize = nPacketSize;
+ }
+ }
+
+ nDummy = 128 - (nSize %128);
+
+ pDXVABuffer += nSize;
+ memset (pDXVABuffer, 0, nDummy);
+ nSize += nDummy;
}
void CDXVADecoderVC1::Flush()
{
- m_nDelayedSurfaceIndex = -1;
- m_rtStartDelayed = _I64_MAX;
- m_rtStopDelayed = _I64_MAX;
+ m_nDelayedSurfaceIndex = -1;
+ m_rtStartDelayed = _I64_MAX;
+ m_rtStopDelayed = _I64_MAX;
- if(m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame(m_wRefPictureIndex[0]);
- if(m_wRefPictureIndex[1] != NO_REF_FRAME) RemoveRefFrame(m_wRefPictureIndex[1]);
+ if (m_wRefPictureIndex[0] != NO_REF_FRAME) RemoveRefFrame (m_wRefPictureIndex[0]);
+ if (m_wRefPictureIndex[1] != NO_REF_FRAME) RemoveRefFrame (m_wRefPictureIndex[1]);
- m_wRefPictureIndex[0] = NO_REF_FRAME;
- m_wRefPictureIndex[1] = NO_REF_FRAME;
+ m_wRefPictureIndex[0] = NO_REF_FRAME;
+ m_wRefPictureIndex[1] = NO_REF_FRAME;
- __super::Flush();
+ __super::Flush();
}
HRESULT CDXVADecoderVC1::DisplayStatus()
{
- HRESULT hr = E_INVALIDARG;
- DXVA_Status_VC1 Status;
+ HRESULT hr = E_INVALIDARG;
+ DXVA_Status_VC1 Status;
- memset(&Status, 0, sizeof(Status));
+ memset (&Status, 0, sizeof(Status));
- if(SUCCEEDED(hr = CDXVADecoder::QueryStatus(&Status, sizeof(Status))))
- {
- Status.StatusReportFeedbackNumber = 0x00FF & Status.StatusReportFeedbackNumber;
+ if (SUCCEEDED (hr = CDXVADecoder::QueryStatus(&Status, sizeof(Status))))
+ {
+ Status.StatusReportFeedbackNumber = 0x00FF & Status.StatusReportFeedbackNumber;
- TRACE_VC1("CDXVADecoderVC1 : Status for the frame %u : bBufType = %u, bStatus = %u, wNumMbsAffected = %u\n",
- Status.StatusReportFeedbackNumber,
- Status.bBufType,
- Status.bStatus,
- Status.wNumMbsAffected);
- }
+ TRACE_VC1 ("CDXVADecoderVC1 : Status for the frame %u : bBufType = %u, bStatus = %u, wNumMbsAffected = %u\n",
+ Status.StatusReportFeedbackNumber,
+ Status.bBufType,
+ Status.bStatus,
+ Status.wNumMbsAffected);
+ }
- return hr;
+ return hr;
}
diff --git a/src/filters/transform/MPCVideoDec/DXVADecoderVC1.h b/src/filters/transform/MPCVideoDec/DXVADecoderVC1.h
index bef03188a..379d226bf 100644
--- a/src/filters/transform/MPCVideoDec/DXVADecoderVC1.h
+++ b/src/filters/transform/MPCVideoDec/DXVADecoderVC1.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -29,84 +29,84 @@
class CDXVADecoderVC1 : public CDXVADecoder
{
public:
- CDXVADecoderVC1(CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
- CDXVADecoderVC1(CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
- virtual ~CDXVADecoderVC1(void);
-
- // === Public functions
- virtual HRESULT DecodeFrame(BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- virtual void SetExtraData(BYTE* pDataIn, UINT nSize);
- virtual void CopyBitstream(BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
- virtual void Flush();
-
- typedef enum
- {
- VC1_PS_TOP_FIELD = 1,
- VC1_PS_BOTTOM_FIELD = 2,
- VC1_PS_PROGRESSIVE = 3
- };
-
- typedef enum
- {
- VC1_CHROMA_420 = 1,
- VC1_CHROMA_422 = 2,
- VC1_CHROMA_444 = 3
- } VC1_CHROMA_FORMAT;
-
- typedef enum
- {
- VC1_CR_BICUBIC_QUARTER_CHROMA = 4,
- VC1_CR_BICUBIC_HALF_CHROMA = 5,
- VC1_CR_BILINEAR_QUARTER_CHROMA = 12,
- VC1_CR_BILINEAR_HALF_CHROMA = 13,
- };
-
- typedef enum
- {
- VC1_SCAN_ZIGZAG = 0,
- VC1_SCAN_ALTERNATE_VERTICAL = 1,
- VC1_SCAN_ALTERNATE_HORIZONTAL = 2,
- VC1_SCAN_ARBITRARY = 3 // Use when bConfigHostInverseScan = 1
- } VC1_PIC_SCAN_METHOD;
-
- typedef enum // Values for bPicDeblockConfined when bConfigBitstreamRaw = 1
- {
- VC1_EXTENDED_DMV = 0x0001,
- VC1_PSF = 0x0002,
- VC1_REFPICFLAG = 0x0004,
- VC1_FINTERPFLAG = 0x0008,
- VC1_TFCNTRFLAG = 0x0010,
- VC1_INTERLACE = 0x0020,
- VC1_PULLDOWN = 0x0040,
- VC1_POSTPROCFLAG = 0x0080
- } VC1_DEBLOCK_CONFINED;
-
- typedef enum // Values for bPicSpatialResid8
- {
- VC1_VSTRANSFORM = 0x0001,
- VC1_DQUANT = 0x0002,
- VC1_EXTENDED_MV = 0x0004,
- VC1_FASTUVMC = 0x0008,
- VC1_LOOPFILTER = 0x0010,
- VC1_REDIST_FLAG = 0x0020,
- VC1_PANSCAN_FLAG = 0x0040,
- } VC1_PIC_SPATIAL_RESID8;
+ CDXVADecoderVC1 (CMPCVideoDecFilter* pFilter, IAMVideoAccelerator* pAMVideoAccelerator, DXVAMode nMode, int nPicEntryNumber);
+ CDXVADecoderVC1 (CMPCVideoDecFilter* pFilter, IDirectXVideoDecoder* pDirectXVideoDec, DXVAMode nMode, int nPicEntryNumber, DXVA2_ConfigPictureDecode* pDXVA2Config);
+ virtual ~CDXVADecoderVC1(void);
+
+ // === Public functions
+ virtual HRESULT DecodeFrame (BYTE* pDataIn, UINT nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ virtual void SetExtraData (BYTE* pDataIn, UINT nSize);
+ virtual void CopyBitstream (BYTE* pDXVABuffer, BYTE* pBuffer, UINT& nSize);
+ virtual void Flush();
+
+ typedef enum
+ {
+ VC1_PS_TOP_FIELD = 1,
+ VC1_PS_BOTTOM_FIELD = 2,
+ VC1_PS_PROGRESSIVE = 3
+ };
+
+ typedef enum
+ {
+ VC1_CHROMA_420 = 1,
+ VC1_CHROMA_422 = 2,
+ VC1_CHROMA_444 = 3
+ } VC1_CHROMA_FORMAT;
+
+ typedef enum
+ {
+ VC1_CR_BICUBIC_QUARTER_CHROMA = 4,
+ VC1_CR_BICUBIC_HALF_CHROMA = 5,
+ VC1_CR_BILINEAR_QUARTER_CHROMA = 12,
+ VC1_CR_BILINEAR_HALF_CHROMA = 13,
+ };
+
+ typedef enum
+ {
+ VC1_SCAN_ZIGZAG = 0,
+ VC1_SCAN_ALTERNATE_VERTICAL = 1,
+ VC1_SCAN_ALTERNATE_HORIZONTAL = 2,
+ VC1_SCAN_ARBITRARY = 3 // Use when bConfigHostInverseScan = 1
+ } VC1_PIC_SCAN_METHOD;
+
+ typedef enum // Values for bPicDeblockConfined when bConfigBitstreamRaw = 1
+ {
+ VC1_EXTENDED_DMV = 0x0001,
+ VC1_PSF = 0x0002,
+ VC1_REFPICFLAG = 0x0004,
+ VC1_FINTERPFLAG = 0x0008,
+ VC1_TFCNTRFLAG = 0x0010,
+ VC1_INTERLACE = 0x0020,
+ VC1_PULLDOWN = 0x0040,
+ VC1_POSTPROCFLAG = 0x0080
+ } VC1_DEBLOCK_CONFINED;
+
+ typedef enum // Values for bPicSpatialResid8
+ {
+ VC1_VSTRANSFORM = 0x0001,
+ VC1_DQUANT = 0x0002,
+ VC1_EXTENDED_MV = 0x0004,
+ VC1_FASTUVMC = 0x0008,
+ VC1_LOOPFILTER = 0x0010,
+ VC1_REDIST_FLAG = 0x0020,
+ VC1_PANSCAN_FLAG = 0x0040,
+ } VC1_PIC_SPATIAL_RESID8;
protected :
private:
- DXVA_PictureParameters m_PictureParams;
- DXVA_SliceInfo m_SliceInfo;
- WORD m_wRefPictureIndex[2];
-
- int m_nDelayedSurfaceIndex;
- REFERENCE_TIME m_rtStartDelayed;
- REFERENCE_TIME m_rtStopDelayed;
-
- // Private functions
- void Init();
- HRESULT DisplayStatus();
- BYTE* FindNextStartCode(BYTE* pBuffer, UINT nSize, UINT& nPacketSize);
+ DXVA_PictureParameters m_PictureParams;
+ DXVA_SliceInfo m_SliceInfo;
+ WORD m_wRefPictureIndex[2];
+
+ int m_nDelayedSurfaceIndex;
+ REFERENCE_TIME m_rtStartDelayed;
+ REFERENCE_TIME m_rtStopDelayed;
+
+ // Private functions
+ void Init();
+ HRESULT DisplayStatus();
+ BYTE* FindNextStartCode(BYTE* pBuffer, UINT nSize, UINT& nPacketSize);
};
diff --git a/src/filters/transform/MPCVideoDec/FfmpegContext.c b/src/filters/transform/MPCVideoDec/FfmpegContext.c
index aec29d41e..d12cbcc31 100644
--- a/src/filters/transform/MPCVideoDec/FfmpegContext.c
+++ b/src/filters/transform/MPCVideoDec/FfmpegContext.c
@@ -1,6 +1,6 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -45,21 +45,18 @@ int av_vc1_decode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size);
const byte ZZ_SCAN[16] =
-{
- 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
+{ 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
};
const byte ZZ_SCAN8[64] =
-{
- 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
+{ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
+ 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
};
// FIXME : remove duplicate declaration with ffmpeg ??
-typedef struct Mpeg1Context
-{
+typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx;
int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
int repeat_field; /* true if we must repeat the field */
@@ -70,30 +67,30 @@ typedef struct Mpeg1Context
int save_width, save_height, save_progressive_seq;
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
- DXVA_SliceInfo* pSliceInfo;
+ DXVA_SliceInfo* pSliceInfo;
} Mpeg1Context;
int IsVista()
{
- OSVERSIONINFO osver;
+ OSVERSIONINFO osver;
- osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ osver.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
+
+ if ( GetVersionEx( &osver ) &&
+ osver.dwPlatformId == VER_PLATFORM_WIN32_NT &&
+ (osver.dwMajorVersion >= 6 ) )
+ return 1;
- if(GetVersionEx(&osver) &&
- osver.dwPlatformId == VER_PLATFORM_WIN32_NT &&
- (osver.dwMajorVersion >= 6))
- return 1;
-
- return 0;
+ return 0;
}
char* GetFFMpegPictureType(int nType)
{
- static char* s_FFMpegPictTypes[] = { "? ", "I ", "P ", "B ", "S ", "SI", "SP" };
- int nTypeCount = sizeof(s_FFMpegPictTypes) / sizeof(TCHAR) - 1;
+ static char* s_FFMpegPictTypes[] = { "? ", "I ", "P ", "B ", "S ", "SI", "SP" };
+ int nTypeCount = sizeof(s_FFMpegPictTypes)/sizeof(TCHAR)-1;
- return s_FFMpegPictTypes[min(nType, nTypeCount)];
+ return s_FFMpegPictTypes[min(nType, nTypeCount)];
}
inline MpegEncContext* GetMpegEncContext(struct AVCodecContext* pAVCtx)
@@ -101,642 +98,604 @@ inline MpegEncContext* GetMpegEncContext(struct AVCodecContext* pAVCtx)
Mpeg1Context* s1;
MpegEncContext* s = NULL;
- switch(pAVCtx->codec_id)
- {
- case CODEC_ID_VC1 :
- case CODEC_ID_H264 :
- s = (MpegEncContext*) pAVCtx->priv_data;
- break;
- case CODEC_ID_MPEG2VIDEO:
- s1 = (Mpeg1Context*)pAVCtx->priv_data;
- s = (MpegEncContext*)&s1->mpeg_enc_ctx;
- break;
- }
- return s;
+ switch (pAVCtx->codec_id)
+ {
+ case CODEC_ID_VC1 :
+ case CODEC_ID_H264 :
+ s = (MpegEncContext*) pAVCtx->priv_data;
+ break;
+ case CODEC_ID_MPEG2VIDEO:
+ s1 = (Mpeg1Context*)pAVCtx->priv_data;
+ s = (MpegEncContext*)&s1->mpeg_enc_ctx;
+ break;
+ }
+ return s;
}
-void FFH264DecodeBuffer(struct AVCodecContext* pAVCtx, BYTE* pBuffer, UINT nSize, int* pFramePOC, int* pOutPOC, REFERENCE_TIME* pOutrtStart)
+void FFH264DecodeBuffer (struct AVCodecContext* pAVCtx, BYTE* pBuffer, UINT nSize, int* pFramePOC, int* pOutPOC, REFERENCE_TIME* pOutrtStart)
{
- if(pBuffer != NULL)
- {
- H264Context* h = (H264Context*) pAVCtx->priv_data;
- av_h264_decode_frame(pAVCtx, pOutPOC, pOutrtStart, pBuffer, nSize);
+ if (pBuffer != NULL)
+ {
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
+ av_h264_decode_frame (pAVCtx, pOutPOC, pOutrtStart, pBuffer, nSize);
- if(h->s.current_picture_ptr && pFramePOC) *pFramePOC = h->s.current_picture_ptr->field_poc[0];
- }
+ if (h->s.current_picture_ptr && pFramePOC) *pFramePOC = h->s.current_picture_ptr->field_poc[0];
+ }
}
int FFH264CheckCompatibility(int nWidth, int nHeight, struct AVCodecContext* pAVCtx, BYTE* pBuffer, UINT nSize, int nPCIVendor, LARGE_INTEGER VideoDriverVersion)
{
- H264Context* pContext = (H264Context*) pAVCtx->priv_data;
- SPS* cur_sps;
- PPS* cur_pps;
-
- int supportLevel51 = 0;
-
- if(pBuffer != NULL)
- av_h264_decode_frame(pAVCtx, NULL, NULL, pBuffer, nSize);
-
- cur_sps = pContext->sps_buffers[0];
- cur_pps = pContext->pps_buffers[0];
-
- if(cur_sps != NULL)
- {
-
- if(nPCIVendor == PCIV_nVidia)
- {
- // nVidia cards support level 5.1 since drivers v6.14.11.7800 for XP and drivers v7.15.11.7800 for Vista
- // vA.B.C.D
- int A, B, C, D;
- if(IsVista())
- {
- A = 7;
- B = 15;
- C = 11;
- D = 7800;
- }
- else
- {
- A = 6;
- B = 14;
- C = 11;
- D = 7800;
- }
-
- if(HIWORD(VideoDriverVersion.HighPart) > A)
- {
- supportLevel51 = 1;
- }
- else if(HIWORD(VideoDriverVersion.HighPart) == A)
- {
- if(LOWORD(VideoDriverVersion.HighPart) > B)
- {
- supportLevel51 = 1;
- }
- else if(LOWORD(VideoDriverVersion.HighPart) == B)
- {
- if(HIWORD(VideoDriverVersion.LowPart) > C)
- {
- supportLevel51 = 1;
- }
- else if(HIWORD(VideoDriverVersion.LowPart) == C)
- {
- if(LOWORD(VideoDriverVersion.LowPart) >= D)
- {
- supportLevel51 = 1;
- }
- }
- }
- }
- }
- else if(nPCIVendor == PCIV_S3_Graphics)
- supportLevel51 = 1;
-
- // Check max num reference frame according to the level
-#define MAX_DPB_41 12288 // DPB value for level 4.1
-
- if(supportLevel51 == 1)
- {
- // 11 refs as absolute max, but for Nvidia(Vista, HD) - 16
- if(IsVista())
- {
- if(nWidth > 1279)
- {
- if(cur_sps->ref_frame_count > 16)
- return 2; // Too much ref frames
- }
- else
- {
- if(cur_sps->ref_frame_count > 11)
- return 2; // Too much ref frames
- }
- }
- else
- {
- if(cur_sps->ref_frame_count > 14)
- return 2; // Too much ref frames
- }
- }
- else
- {
- // level 4.1 with 11 refs as absolute max
- if(cur_sps->ref_frame_count > min(11, (1024 * MAX_DPB_41 / (nWidth * nHeight * 1.5))))
- return 2; // Too much ref frames
- }
-
- }
-
- return 0;
+ H264Context* pContext = (H264Context*) pAVCtx->priv_data;
+ SPS* cur_sps;
+ PPS* cur_pps;
+
+ int supportLevel51 = 0;
+
+ if (pBuffer != NULL)
+ av_h264_decode_frame (pAVCtx, NULL, NULL, pBuffer, nSize);
+
+ cur_sps = pContext->sps_buffers[0];
+ cur_pps = pContext->pps_buffers[0];
+
+ if (cur_sps != NULL)
+ {
+
+ if (nPCIVendor == PCIV_nVidia) {
+ // nVidia cards support level 5.1 since drivers v6.14.11.7800 for XP and drivers v7.15.11.7800 for Vista
+ // vA.B.C.D
+ int A, B, C, D;
+ if (IsVista()) {
+ A = 7; B = 15; C = 11; D = 7800;
+ } else {
+ A = 6; B = 14; C = 11; D = 7800;
+ }
+
+ if (HIWORD(VideoDriverVersion.HighPart) > A) {
+ supportLevel51 = 1;
+ } else if (HIWORD(VideoDriverVersion.HighPart) == A) {
+ if (LOWORD(VideoDriverVersion.HighPart) > B) {
+ supportLevel51 = 1;
+ } else if (LOWORD(VideoDriverVersion.HighPart) == B) {
+ if (HIWORD(VideoDriverVersion.LowPart) > C) {
+ supportLevel51 = 1;
+ } else if (HIWORD(VideoDriverVersion.LowPart) == C) {
+ if (LOWORD(VideoDriverVersion.LowPart) >= D) {
+ supportLevel51 = 1;
+ }
+ }
+ }
+ }
+ }
+ else if (nPCIVendor == PCIV_S3_Graphics)
+ supportLevel51 = 1;
+
+ // Check max num reference frame according to the level
+ #define MAX_DPB_41 12288 // DPB value for level 4.1
+
+ if (supportLevel51 == 1) {
+ // 11 refs as absolute max, but for Nvidia(Vista, HD) - 16
+ if(IsVista()) {
+ if(nWidth>1279) {
+ if (cur_sps->ref_frame_count > 16)
+ return 2; // Too much ref frames
+ } else {
+ if (cur_sps->ref_frame_count > 11)
+ return 2; // Too much ref frames
+ }
+ } else {
+ if (cur_sps->ref_frame_count > 14)
+ return 2; // Too much ref frames
+ }
+ } else {
+ // level 4.1 with 11 refs as absolute max
+ if (cur_sps->ref_frame_count > min(11, (1024*MAX_DPB_41/(nWidth*nHeight*1.5))))
+ return 2; // Too much ref frames
+ }
+
+ }
+
+ return 0;
}
void CopyScalingMatrix(DXVA_Qmatrix_H264* pDest, DXVA_Qmatrix_H264* pSource, int nPCIVendor)
{
- int i, j;
-
- switch(nPCIVendor)
- {
- case PCIV_ATI :
- // The ATI way
- memcpy(pDest, pSource, sizeof(DXVA_Qmatrix_H264));
- break;
-
- default :
- // The nVidia way (and other manufacturers compliant with specifications....)
- for(i = 0; i < 6; i++)
- for(j = 0; j < 16; j++)
- pDest->bScalingLists4x4[i][j] = pSource->bScalingLists4x4[i][ZZ_SCAN[j]];
-
- for(i = 0; i < 2; i++)
- for(j = 0; j < 64; j++)
- pDest->bScalingLists8x8[i][j] = pSource->bScalingLists8x8[i][ZZ_SCAN8[j]];
- break;
- }
+ int i,j;
+
+ switch (nPCIVendor)
+ {
+ case PCIV_ATI :
+ // The ATI way
+ memcpy (pDest, pSource, sizeof (DXVA_Qmatrix_H264));
+ break;
+
+ default :
+ // The nVidia way (and other manufacturers compliant with specifications....)
+ for (i=0; i<6; i++)
+ for (j=0; j<16; j++)
+ pDest->bScalingLists4x4[i][j] = pSource->bScalingLists4x4[i][ZZ_SCAN[j]];
+
+ for (i=0; i<2; i++)
+ for (j=0; j<64; j++)
+ pDest->bScalingLists8x8[i][j] = pSource->bScalingLists8x8[i][ZZ_SCAN8[j]];
+ break;
+ }
}
USHORT FFH264FindRefFrameIndex(USHORT num_frame, DXVA_PicParams_H264* pDXVAPicParams)
{
- int i;
- for(i = 0; i < pDXVAPicParams->num_ref_frames; i++)
- {
- if(pDXVAPicParams->FrameNumList[i] == num_frame)
- return pDXVAPicParams->RefFrameList[i].Index7Bits;
- }
+ int i;
+ for (i=0; i<pDXVAPicParams->num_ref_frames; i++)
+ {
+ if (pDXVAPicParams->FrameNumList[i] == num_frame)
+ return pDXVAPicParams->RefFrameList[i].Index7Bits;
+ }
#ifdef _DEBUG
// DebugBreak(); // Ref frame not found !
#endif
- return 127;
+ return 127;
}
-HRESULT FFH264BuildPicParams(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Qmatrix_H264* pDXVAScalingMatrix, int* nFieldType, int* nSliceType, struct AVCodecContext* pAVCtx, int nPCIVendor)
+HRESULT FFH264BuildPicParams (DXVA_PicParams_H264* pDXVAPicParams, DXVA_Qmatrix_H264* pDXVAScalingMatrix, int* nFieldType, int* nSliceType, struct AVCodecContext* pAVCtx, int nPCIVendor)
{
- H264Context* h = (H264Context*) pAVCtx->priv_data;
- SPS* cur_sps;
- PPS* cur_pps;
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
+ SPS* cur_sps;
+ PPS* cur_pps;
MpegEncContext* const s = &h->s;
- int field_pic_flag;
- HRESULT hr = E_FAIL;
+ int field_pic_flag;
+ HRESULT hr = E_FAIL;
- field_pic_flag = (h->s.picture_structure != PICT_FRAME);
+ field_pic_flag = (h->s.picture_structure != PICT_FRAME);
- cur_sps = &h->sps;
- cur_pps = &h->pps;
+ cur_sps = &h->sps;
+ cur_pps = &h->pps;
- if(cur_sps && cur_pps)
- {
- *nFieldType = h->s.picture_structure;
- if(h->sps.pic_struct_present_flag)
- {
- switch(h->sei_pic_struct)
+ if (cur_sps && cur_pps)
+ {
+ *nFieldType = h->s.picture_structure;
+ if (h->sps.pic_struct_present_flag)
+ {
+ switch (h->sei_pic_struct)
{
case SEI_PIC_STRUCT_TOP_FIELD:
case SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
- *nFieldType = PICT_TOP_FIELD;
+ *nFieldType = PICT_TOP_FIELD;
break;
case SEI_PIC_STRUCT_BOTTOM_FIELD:
case SEI_PIC_STRUCT_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
- *nFieldType = PICT_BOTTOM_FIELD;
+ *nFieldType = PICT_BOTTOM_FIELD;
break;
case SEI_PIC_STRUCT_FRAME_DOUBLING:
case SEI_PIC_STRUCT_FRAME_TRIPLING:
case SEI_PIC_STRUCT_FRAME:
- *nFieldType = PICT_FRAME;
+ *nFieldType = PICT_FRAME;
break;
- }
- }
-
- *nSliceType = h->slice_type;
-
- if(cur_sps->mb_width == 0 || cur_sps->mb_height == 0) return VFW_E_INVALID_FILE_FORMAT;
- pDXVAPicParams->wFrameWidthInMbsMinus1 = cur_sps->mb_width - 1; // pic_width_in_mbs_minus1;
- pDXVAPicParams->wFrameHeightInMbsMinus1 = cur_sps->mb_height * (2 - cur_sps->frame_mbs_only_flag) - 1; // pic_height_in_map_units_minus1;
- pDXVAPicParams->num_ref_frames = cur_sps->ref_frame_count; // num_ref_frames;
- pDXVAPicParams->field_pic_flag = field_pic_flag;
- pDXVAPicParams->MbaffFrameFlag = (h->sps.mb_aff && (field_pic_flag == 0));
- pDXVAPicParams->residual_colour_transform_flag = cur_sps->residual_color_transform_flag;
- pDXVAPicParams->sp_for_switch_flag = h->sp_for_switch_flag;
- pDXVAPicParams->chroma_format_idc = cur_sps->chroma_format_idc;
- pDXVAPicParams->RefPicFlag = h->ref_pic_flag;
- pDXVAPicParams->constrained_intra_pred_flag = cur_pps->constrained_intra_pred;
- pDXVAPicParams->weighted_pred_flag = cur_pps->weighted_pred;
- pDXVAPicParams->weighted_bipred_idc = cur_pps->weighted_bipred_idc;
- pDXVAPicParams->frame_mbs_only_flag = cur_sps->frame_mbs_only_flag;
- pDXVAPicParams->transform_8x8_mode_flag = cur_pps->transform_8x8_mode;
- pDXVAPicParams->MinLumaBipredSize8x8Flag = h->sps.level_idc >= 31;
- pDXVAPicParams->IntraPicFlag = (h->slice_type == FF_I_TYPE);
-
- pDXVAPicParams->bit_depth_luma_minus8 = cur_sps->bit_depth_luma - 8; // bit_depth_luma_minus8
- pDXVAPicParams->bit_depth_chroma_minus8 = cur_sps->bit_depth_chroma - 8; // bit_depth_chroma_minus8
- // pDXVAPicParams->StatusReportFeedbackNumber = SET IN DecodeFrame;
-
-
- // pDXVAPicParams->CurrFieldOrderCnt = SET IN UpdateRefFramesList;
- // pDXVAPicParams->FieldOrderCntList = SET IN UpdateRefFramesList;
- // pDXVAPicParams->FrameNumList = SET IN UpdateRefFramesList;
- // pDXVAPicParams->UsedForReferenceFlags = SET IN UpdateRefFramesList;
- // pDXVAPicParams->NonExistingFrameFlags
- pDXVAPicParams->frame_num = h->frame_num;
- // pDXVAPicParams->SliceGroupMap
-
-
- pDXVAPicParams->log2_max_frame_num_minus4 = cur_sps->log2_max_frame_num - 4; // log2_max_frame_num_minus4;
- pDXVAPicParams->pic_order_cnt_type = cur_sps->poc_type; // pic_order_cnt_type;
- pDXVAPicParams->log2_max_pic_order_cnt_lsb_minus4 = cur_sps->log2_max_poc_lsb - 4; // log2_max_pic_order_cnt_lsb_minus4;
- pDXVAPicParams->delta_pic_order_always_zero_flag = cur_sps->delta_pic_order_always_zero_flag;
- pDXVAPicParams->direct_8x8_inference_flag = cur_sps->direct_8x8_inference_flag;
- pDXVAPicParams->entropy_coding_mode_flag = cur_pps->cabac; // entropy_coding_mode_flag;
- pDXVAPicParams->pic_order_present_flag = cur_pps->pic_order_present; // pic_order_present_flag;
- pDXVAPicParams->num_slice_groups_minus1 = cur_pps->slice_group_count - 1; // num_slice_groups_minus1;
- pDXVAPicParams->slice_group_map_type = cur_pps->mb_slice_group_map_type; // slice_group_map_type;
- pDXVAPicParams->deblocking_filter_control_present_flag = cur_pps->deblocking_filter_parameters_present; // deblocking_filter_control_present_flag;
- pDXVAPicParams->redundant_pic_cnt_present_flag = cur_pps->redundant_pic_cnt_present; // redundant_pic_cnt_present_flag;
- pDXVAPicParams->slice_group_change_rate_minus1 = cur_pps->slice_group_change_rate_minus1;
-
- pDXVAPicParams->chroma_qp_index_offset = cur_pps->chroma_qp_index_offset[0];
- pDXVAPicParams->second_chroma_qp_index_offset = cur_pps->chroma_qp_index_offset[1];
- pDXVAPicParams->num_ref_idx_l0_active_minus1 = cur_pps->ref_count[0] - 1; // num_ref_idx_l0_active_minus1;
- pDXVAPicParams->num_ref_idx_l1_active_minus1 = cur_pps->ref_count[1] - 1; // num_ref_idx_l1_active_minus1;
- pDXVAPicParams->pic_init_qp_minus26 = cur_pps->init_qp - 26;
- pDXVAPicParams->pic_init_qs_minus26 = cur_pps->init_qs - 26;
-
- if(field_pic_flag)
- {
- pDXVAPicParams->CurrPic.AssociatedFlag = (h->s.picture_structure == PICT_BOTTOM_FIELD);
-
- if(pDXVAPicParams->CurrPic.AssociatedFlag)
- {
- // Bottom field
- pDXVAPicParams->CurrFieldOrderCnt[0] = 0;
- pDXVAPicParams->CurrFieldOrderCnt[1] = h->poc_lsb + h->poc_msb;
- }
- else
- {
- // Top field
- pDXVAPicParams->CurrFieldOrderCnt[0] = h->poc_lsb + h->poc_msb;
- pDXVAPicParams->CurrFieldOrderCnt[1] = 0;
- }
- }
- else
- {
- pDXVAPicParams->CurrPic.AssociatedFlag = 0;
- pDXVAPicParams->CurrFieldOrderCnt[0] = h->poc_lsb + h->poc_msb;
- pDXVAPicParams->CurrFieldOrderCnt[1] = h->poc_lsb + h->poc_msb;
- }
-
- CopyScalingMatrix(pDXVAScalingMatrix, (DXVA_Qmatrix_H264*)cur_pps->scaling_matrix4, nPCIVendor);
- hr = S_OK;
- }
-
- return hr;
+ }
+ }
+
+ *nSliceType = h->slice_type;
+
+ if (cur_sps->mb_width==0 || cur_sps->mb_height==0) return VFW_E_INVALID_FILE_FORMAT;
+ pDXVAPicParams->wFrameWidthInMbsMinus1 = cur_sps->mb_width - 1; // pic_width_in_mbs_minus1;
+ pDXVAPicParams->wFrameHeightInMbsMinus1 = cur_sps->mb_height * (2 - cur_sps->frame_mbs_only_flag) - 1; // pic_height_in_map_units_minus1;
+ pDXVAPicParams->num_ref_frames = cur_sps->ref_frame_count; // num_ref_frames;
+ pDXVAPicParams->field_pic_flag = field_pic_flag;
+ pDXVAPicParams->MbaffFrameFlag = (h->sps.mb_aff && (field_pic_flag==0));
+ pDXVAPicParams->residual_colour_transform_flag = cur_sps->residual_color_transform_flag;
+ pDXVAPicParams->sp_for_switch_flag = h->sp_for_switch_flag;
+ pDXVAPicParams->chroma_format_idc = cur_sps->chroma_format_idc;
+ pDXVAPicParams->RefPicFlag = h->ref_pic_flag;
+ pDXVAPicParams->constrained_intra_pred_flag = cur_pps->constrained_intra_pred;
+ pDXVAPicParams->weighted_pred_flag = cur_pps->weighted_pred;
+ pDXVAPicParams->weighted_bipred_idc = cur_pps->weighted_bipred_idc;
+ pDXVAPicParams->frame_mbs_only_flag = cur_sps->frame_mbs_only_flag;
+ pDXVAPicParams->transform_8x8_mode_flag = cur_pps->transform_8x8_mode;
+ pDXVAPicParams->MinLumaBipredSize8x8Flag = h->sps.level_idc >= 31;
+ pDXVAPicParams->IntraPicFlag = (h->slice_type == FF_I_TYPE );
+
+ pDXVAPicParams->bit_depth_luma_minus8 = cur_sps->bit_depth_luma - 8; // bit_depth_luma_minus8
+ pDXVAPicParams->bit_depth_chroma_minus8 = cur_sps->bit_depth_chroma - 8; // bit_depth_chroma_minus8
+ // pDXVAPicParams->StatusReportFeedbackNumber = SET IN DecodeFrame;
+
+
+ // pDXVAPicParams->CurrFieldOrderCnt = SET IN UpdateRefFramesList;
+ // pDXVAPicParams->FieldOrderCntList = SET IN UpdateRefFramesList;
+ // pDXVAPicParams->FrameNumList = SET IN UpdateRefFramesList;
+ // pDXVAPicParams->UsedForReferenceFlags = SET IN UpdateRefFramesList;
+ // pDXVAPicParams->NonExistingFrameFlags
+ pDXVAPicParams->frame_num = h->frame_num;
+ // pDXVAPicParams->SliceGroupMap
+
+
+ pDXVAPicParams->log2_max_frame_num_minus4 = cur_sps->log2_max_frame_num - 4; // log2_max_frame_num_minus4;
+ pDXVAPicParams->pic_order_cnt_type = cur_sps->poc_type; // pic_order_cnt_type;
+ pDXVAPicParams->log2_max_pic_order_cnt_lsb_minus4 = cur_sps->log2_max_poc_lsb - 4; // log2_max_pic_order_cnt_lsb_minus4;
+ pDXVAPicParams->delta_pic_order_always_zero_flag = cur_sps->delta_pic_order_always_zero_flag;
+ pDXVAPicParams->direct_8x8_inference_flag = cur_sps->direct_8x8_inference_flag;
+ pDXVAPicParams->entropy_coding_mode_flag = cur_pps->cabac; // entropy_coding_mode_flag;
+ pDXVAPicParams->pic_order_present_flag = cur_pps->pic_order_present; // pic_order_present_flag;
+ pDXVAPicParams->num_slice_groups_minus1 = cur_pps->slice_group_count - 1; // num_slice_groups_minus1;
+ pDXVAPicParams->slice_group_map_type = cur_pps->mb_slice_group_map_type; // slice_group_map_type;
+ pDXVAPicParams->deblocking_filter_control_present_flag = cur_pps->deblocking_filter_parameters_present; // deblocking_filter_control_present_flag;
+ pDXVAPicParams->redundant_pic_cnt_present_flag = cur_pps->redundant_pic_cnt_present; // redundant_pic_cnt_present_flag;
+ pDXVAPicParams->slice_group_change_rate_minus1 = cur_pps->slice_group_change_rate_minus1;
+
+ pDXVAPicParams->chroma_qp_index_offset = cur_pps->chroma_qp_index_offset[0];
+ pDXVAPicParams->second_chroma_qp_index_offset = cur_pps->chroma_qp_index_offset[1];
+ pDXVAPicParams->num_ref_idx_l0_active_minus1 = cur_pps->ref_count[0]-1; // num_ref_idx_l0_active_minus1;
+ pDXVAPicParams->num_ref_idx_l1_active_minus1 = cur_pps->ref_count[1]-1; // num_ref_idx_l1_active_minus1;
+ pDXVAPicParams->pic_init_qp_minus26 = cur_pps->init_qp - 26;
+ pDXVAPicParams->pic_init_qs_minus26 = cur_pps->init_qs - 26;
+
+ if (field_pic_flag)
+ {
+ pDXVAPicParams->CurrPic.AssociatedFlag = (h->s.picture_structure == PICT_BOTTOM_FIELD);
+
+ if (pDXVAPicParams->CurrPic.AssociatedFlag)
+ {
+ // Bottom field
+ pDXVAPicParams->CurrFieldOrderCnt[0] = 0;
+ pDXVAPicParams->CurrFieldOrderCnt[1] = h->poc_lsb + h->poc_msb;
+ }
+ else
+ {
+ // Top field
+ pDXVAPicParams->CurrFieldOrderCnt[0] = h->poc_lsb + h->poc_msb;
+ pDXVAPicParams->CurrFieldOrderCnt[1] = 0;
+ }
+ }
+ else
+ {
+ pDXVAPicParams->CurrPic.AssociatedFlag = 0;
+ pDXVAPicParams->CurrFieldOrderCnt[0] = h->poc_lsb + h->poc_msb;
+ pDXVAPicParams->CurrFieldOrderCnt[1] = h->poc_lsb + h->poc_msb;
+ }
+
+ CopyScalingMatrix (pDXVAScalingMatrix, (DXVA_Qmatrix_H264*)cur_pps->scaling_matrix4, nPCIVendor);
+ hr = S_OK;
+ }
+
+ return hr;
}
-void FFH264SetCurrentPicture(int nIndex, DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx)
+void FFH264SetCurrentPicture (int nIndex, DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx)
{
- H264Context* h = (H264Context*) pAVCtx->priv_data;
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
- pDXVAPicParams->CurrPic.Index7Bits = nIndex;
+ pDXVAPicParams->CurrPic.Index7Bits = nIndex;
- if(h->s.current_picture_ptr)
- h->s.current_picture_ptr->opaque = (void*)nIndex;
+ if (h->s.current_picture_ptr)
+ h->s.current_picture_ptr->opaque = (void*)nIndex;
}
-void FFH264UpdateRefFramesList(DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx)
+void FFH264UpdateRefFramesList (DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx)
{
- H264Context* h = (H264Context*) pAVCtx->priv_data;
- UINT nUsedForReferenceFlags = 0;
- int i;
- Picture* pic;
- UCHAR AssociatedFlag;
-
- for(i = 0; i < 16; i++)
- {
- if(i < h->short_ref_count)
- {
- // Short list reference frames
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
+ UINT nUsedForReferenceFlags = 0;
+ int i;
+ Picture* pic;
+ UCHAR AssociatedFlag;
+
+ for(i=0; i<16; i++)
+ {
+ if (i < h->short_ref_count)
+ {
+ // Short list reference frames
pic = h->short_ref[h->short_ref_count - i - 1];
- AssociatedFlag = pic->long_ref != 0;
- }
- else if(i >= h->short_ref_count && i < h->long_ref_count)
- {
- // Long list reference frames
+ AssociatedFlag = pic->long_ref != 0;
+ }
+ else if (i >= h->short_ref_count && i < h->long_ref_count)
+ {
+ // Long list reference frames
pic = h->short_ref[h->short_ref_count + h->long_ref_count - i - 1];
- AssociatedFlag = 1;
+ AssociatedFlag = 1;
+ }
+ else
+ pic = NULL;
+
+
+ if (pic != NULL)
+ {
+ pDXVAPicParams->FrameNumList[i] = pic->long_ref ? pic->pic_id : pic->frame_num;
+
+ if (pic->field_poc[0] != INT_MAX)
+ {
+ pDXVAPicParams->FieldOrderCntList[i][0] = pic->field_poc [0];
+ nUsedForReferenceFlags |= 1<<(i*2);
+ }
+ else
+ pDXVAPicParams->FieldOrderCntList[i][0] = 0;
+
+ if (pic->field_poc[1] != INT_MAX)
+ {
+ pDXVAPicParams->FieldOrderCntList[i][1] = pic->field_poc [1];
+ nUsedForReferenceFlags |= 2<<(i*2);
+ }
+ else
+ {
+ pDXVAPicParams->FieldOrderCntList[i][1] = 0;
+ }
+
+ pDXVAPicParams->RefFrameList[i].AssociatedFlag = AssociatedFlag;
+ pDXVAPicParams->RefFrameList[i].Index7Bits = (UCHAR)pic->opaque;
}
- else
- pic = NULL;
-
-
- if(pic != NULL)
- {
- pDXVAPicParams->FrameNumList[i] = pic->long_ref ? pic->pic_id : pic->frame_num;
-
- if(pic->field_poc[0] != INT_MAX)
- {
- pDXVAPicParams->FieldOrderCntList[i][0] = pic->field_poc [0];
- nUsedForReferenceFlags |= 1 << (i * 2);
- }
- else
- pDXVAPicParams->FieldOrderCntList[i][0] = 0;
-
- if(pic->field_poc[1] != INT_MAX)
- {
- pDXVAPicParams->FieldOrderCntList[i][1] = pic->field_poc [1];
- nUsedForReferenceFlags |= 2 << (i * 2);
- }
- else
- {
- pDXVAPicParams->FieldOrderCntList[i][1] = 0;
- }
-
- pDXVAPicParams->RefFrameList[i].AssociatedFlag = AssociatedFlag;
- pDXVAPicParams->RefFrameList[i].Index7Bits = (UCHAR)pic->opaque;
- }
- else
- {
- pDXVAPicParams->FrameNumList[i] = 0;
- pDXVAPicParams->FieldOrderCntList[i][0] = 0;
- pDXVAPicParams->FieldOrderCntList[i][1] = 0;
- pDXVAPicParams->RefFrameList[i].AssociatedFlag = 1;
- pDXVAPicParams->RefFrameList[i].Index7Bits = 127;
- }
- }
-
- pDXVAPicParams->UsedForReferenceFlags = nUsedForReferenceFlags;
+ else
+ {
+ pDXVAPicParams->FrameNumList[i] = 0;
+ pDXVAPicParams->FieldOrderCntList[i][0] = 0;
+ pDXVAPicParams->FieldOrderCntList[i][1] = 0;
+ pDXVAPicParams->RefFrameList[i].AssociatedFlag = 1;
+ pDXVAPicParams->RefFrameList[i].Index7Bits = 127;
+ }
+ }
+
+ pDXVAPicParams->UsedForReferenceFlags = nUsedForReferenceFlags;
}
-BOOL FFH264IsRefFrameInUse(int nFrameNum, struct AVCodecContext* pAVCtx)
+BOOL FFH264IsRefFrameInUse (int nFrameNum, struct AVCodecContext* pAVCtx)
{
- H264Context* h = (H264Context*) pAVCtx->priv_data;
- int i;
-
- for(i = 0; i < h->short_ref_count; i++)
- {
- if((int)h->short_ref[i]->opaque == nFrameNum)
- return TRUE;
- }
-
- for(i = 0; i < h->long_ref_count; i++)
- {
- if((int)h->long_ref[i]->opaque == nFrameNum)
- return TRUE;
- }
-
- return FALSE;
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
+ int i;
+
+ for (i=0; i<h->short_ref_count; i++)
+ {
+ if ((int)h->short_ref[i]->opaque == nFrameNum)
+ return TRUE;
+ }
+
+ for (i=0; i<h->long_ref_count; i++)
+ {
+ if ((int)h->long_ref[i]->opaque == nFrameNum)
+ return TRUE;
+ }
+
+ return FALSE;
}
void FF264UpdateRefFrameSliceLong(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Slice_H264_Long* pSlice, struct AVCodecContext* pAVCtx)
{
- H264Context* h = (H264Context*) pAVCtx->priv_data;
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
MpegEncContext* const s = &h->s;
- HRESULT hr = E_FAIL;
- unsigned int i, j, k;
-
- for(i = 0; i < 32; i++)
- {
- pSlice->RefPicList[0][i].AssociatedFlag = 1;
- pSlice->RefPicList[0][i].bPicEntry = 255;
- pSlice->RefPicList[0][i].Index7Bits = 127;
- pSlice->RefPicList[1][i].AssociatedFlag = 1;
- pSlice->RefPicList[1][i].bPicEntry = 255;
- pSlice->RefPicList[1][i].Index7Bits = 127;
- }
-
- if(h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE)
- {
- if(h->ref_count[0] > 0)
- {
- for(i = 0; i < h->ref_count[0]; i++)
- {
- pSlice->RefPicList[0][i].Index7Bits = FFH264FindRefFrameIndex(h->ref_list[0][i].frame_num, pDXVAPicParams);
- pSlice->RefPicList[0][i].AssociatedFlag = 0;
- if((h->s.picture_structure != PICT_FRAME))
- {
- if((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
- (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM) ||
- (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP))
- {
- pSlice->RefPicList[0][i].AssociatedFlag = 1;
- }
-
- }
-
- }
- }
- }
- else
- pSlice->num_ref_idx_l0_active_minus1 = 0;
-
- if(h->slice_type == FF_B_TYPE || h->slice_type == FF_S_TYPE || h->slice_type == FF_BI_TYPE)
- {
- if(h->ref_count[1] > 0)
- {
- for(i = 0; i < h->ref_count[1]; i++)
- {
- pSlice->RefPicList[1][i].Index7Bits = FFH264FindRefFrameIndex(h->ref_list[1][i].frame_num, pDXVAPicParams);
- pSlice->RefPicList[1][i].AssociatedFlag = 0;
- if((h->s.picture_structure != PICT_FRAME))
- {
- if((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
- (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM) ||
- (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP))
- {
- pSlice->RefPicList[1][i].AssociatedFlag = 1;
- }
- }
- }
- }
- }
- else
- pSlice->num_ref_idx_l1_active_minus1 = 0;
-
-
- if(h->slice_type == FF_I_TYPE || h->slice_type == FF_SI_TYPE)
- {
- for(i = 0; i < 16; i++)
- pSlice->RefPicList[0][i].bPicEntry = 0xff;
- }
-
- if(h->slice_type == FF_P_TYPE || h->slice_type == FF_I_TYPE ||
- h->slice_type == FF_SP_TYPE || h->slice_type == FF_SI_TYPE)
- {
- for(i = 0; i < 16; i++)
- pSlice->RefPicList[1][i].bPicEntry = 0xff;
- }
+ HRESULT hr = E_FAIL;
+ unsigned int i,j,k;
+
+ for(i=0; i<32; i++)
+ { pSlice->RefPicList[0][i].AssociatedFlag = 1;
+ pSlice->RefPicList[0][i].bPicEntry = 255;
+ pSlice->RefPicList[0][i].Index7Bits = 127;
+ pSlice->RefPicList[1][i].AssociatedFlag = 1;
+ pSlice->RefPicList[1][i].bPicEntry = 255;
+ pSlice->RefPicList[1][i].Index7Bits = 127;
+ }
+
+ if(h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE)
+ {
+ if(h->ref_count[0] > 0){
+ for(i=0; i < h->ref_count[0]; i++){
+ pSlice->RefPicList[0][i].Index7Bits = FFH264FindRefFrameIndex (h->ref_list[0][i].frame_num, pDXVAPicParams);
+ pSlice->RefPicList[0][i].AssociatedFlag = 0;
+ if((h->s.picture_structure != PICT_FRAME)){
+ if((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
+ (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM) ||
+ (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)){
+ pSlice->RefPicList[0][i].AssociatedFlag = 1;
+ }
+
+ }
+
+ }
+ }
+ }
+ else
+ pSlice->num_ref_idx_l0_active_minus1 = 0;
+
+ if(h->slice_type == FF_B_TYPE || h->slice_type == FF_S_TYPE || h->slice_type == FF_BI_TYPE)
+ {
+ if(h->ref_count[1] > 0){
+ for(i=0; i < h->ref_count[1]; i++){
+ pSlice->RefPicList[1][i].Index7Bits = FFH264FindRefFrameIndex (h->ref_list[1][i].frame_num, pDXVAPicParams);
+ pSlice->RefPicList[1][i].AssociatedFlag = 0;
+ if((h->s.picture_structure != PICT_FRAME)){
+ if((h->sei_pic_struct == SEI_PIC_STRUCT_BOTTOM_FIELD) ||
+ (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM) ||
+ (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)){
+ pSlice->RefPicList[1][i].AssociatedFlag = 1;
+ }
+ }
+ }
+ }
+ }
+ else
+ pSlice->num_ref_idx_l1_active_minus1 = 0;
+
+
+ if(h->slice_type == FF_I_TYPE || h->slice_type == FF_SI_TYPE)
+ {
+ for(i = 0; i<16; i++)
+ pSlice->RefPicList[0][i].bPicEntry = 0xff;
+ }
+
+ if(h->slice_type == FF_P_TYPE || h->slice_type == FF_I_TYPE ||
+ h->slice_type ==FF_SP_TYPE || h->slice_type == FF_SI_TYPE)
+ {
+ for(i = 0; i < 16; i++)
+ pSlice->RefPicList[1][i].bPicEntry = 0xff;
+ }
}
-void FFH264SetDxvaSliceLong(struct AVCodecContext* pAVCtx, void* pSliceLong)
+void FFH264SetDxvaSliceLong (struct AVCodecContext* pAVCtx, void* pSliceLong)
{
- H264Context* h = (H264Context*) pAVCtx->priv_data;
- h->dxva_slice_long = pSliceLong;
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
+ h->dxva_slice_long = pSliceLong;
}
-HRESULT FFVC1UpdatePictureParam(DXVA_PictureParameters* pPicParams, struct AVCodecContext* pAVCtx, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize)
+HRESULT FFVC1UpdatePictureParam (DXVA_PictureParameters* pPicParams, struct AVCodecContext* pAVCtx, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize)
{
- VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
-
- if(pBuffer)
- {
- av_vc1_decode_frame(pAVCtx, pBuffer, nSize);
- }
-
- // WARNING : vc1->interlace is not reliable (always set for progressive video on HD-DVD material)
- if(vc1->fcm == 0)
- *nFieldType = PICT_FRAME;
- else // fcm : 2 or 3 frame or field interlaced
- *nFieldType = (vc1->tff ? PICT_TOP_FIELD : PICT_BOTTOM_FIELD);
-
- pPicParams->bPicIntra = (vc1->s.pict_type == FF_I_TYPE);
- pPicParams->bPicBackwardPrediction = (vc1->s.pict_type == FF_B_TYPE);
-
- // Init Init Init Todo
- // iWMV9 - i9IRU - iOHIT - iINSO - iWMVA - 0 - 0 - 0 | Section 3.2.5
- pPicParams->bBidirectionalAveragingMode = (pPicParams->bBidirectionalAveragingMode & 0xE0) | // init in SetExtraData
- ((vc1->lumshift != 0 || vc1->lumscale != 32) ? 0x10 : 0) | // iINSO
- ((vc1->profile == PROFILE_ADVANCED) << 3); // iWMVA
-
- // Section 3.2.20.3
- pPicParams->bPicSpatialResid8 = (vc1->panscanflag << 7) | (vc1->refdist_flag << 6) |
- (vc1->s.loop_filter << 5) | (vc1->fastuvmc << 4) |
- (vc1->extended_mv << 3) | (vc1->dquant << 1) |
- (vc1->vstransform);
-
- // Section 3.2.20.4
- pPicParams->bPicOverflowBlocks = (vc1->quantizer_mode << 6) | (vc1->multires << 5) |
- (vc1->s.resync_marker << 4) | (vc1->rangered << 3) |
- (vc1->s.max_b_frames);
-
- // Section 3.2.20.2
- pPicParams->bPicDeblockConfined = (vc1->postprocflag << 7) | (vc1->broadcast << 6) |
- (vc1->interlace << 5) | (vc1->tfcntrflag << 4) |
- (vc1->finterpflag << 3) | // (refpic << 2) set in DecodeFrame !
- (vc1->psf << 1) | vc1->extended_dmv;
-
-
- // TODO section 3.2.20.6
- pPicParams->bPicStructure = *nFieldType;
-
- // Cf page 17 : 2 for interlaced, 0 for progressive
- pPicParams->bPicExtrapolation = (*nFieldType == PICT_FRAME) ? 1 : 2;
-
- pPicParams->wBitstreamPCEelements = vc1->lumshift;
- pPicParams->wBitstreamFcodes = vc1->lumscale;
-
- // Section 3.2.16
- *nSliceType = vc1->s.pict_type;
-
- // TODO : not finish...
- pPicParams->bMVprecisionAndChromaRelation = ((vc1->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) | // 0 for non-bilinear luma motion, 1 for bilinear
- (1 << 2) | // 0 for WMV8, 1 for WMV9 motion
- (0 << 1) | // 1 for WMV8 quarter sample luma motion
- (0); // 0 for quarter sample chroma motion, 1 for half sample chroma
-
- // Cf §7.1.1.25 in VC1 specification, §3.2.14.3 in DXVA spec
- pPicParams->bRcontrol = vc1->rnd;
-
- /*
- // TODO : find files with de-ringing ...
- pPicParams->bPicDeblocked = ((vc1->postproc & 0x01) ? 0x02 : 0) | // In loop de-blocking
- ((vc1->postproc & 0x02) ? 0x08 : 0); // Out of loop de-ringing
- */
-
- return S_OK;
+ VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
+
+ if (pBuffer)
+ {
+ av_vc1_decode_frame (pAVCtx, pBuffer, nSize);
+ }
+
+ // WARNING : vc1->interlace is not reliable (always set for progressive video on HD-DVD material)
+ if (vc1->fcm == 0)
+ *nFieldType = PICT_FRAME;
+ else // fcm : 2 or 3 frame or field interlaced
+ *nFieldType = (vc1->tff ? PICT_TOP_FIELD : PICT_BOTTOM_FIELD);
+
+ pPicParams->bPicIntra = (vc1->s.pict_type == FF_I_TYPE);
+ pPicParams->bPicBackwardPrediction = (vc1->s.pict_type == FF_B_TYPE);
+
+ // Init Init Init Todo
+ // iWMV9 - i9IRU - iOHIT - iINSO - iWMVA - 0 - 0 - 0 | Section 3.2.5
+ pPicParams->bBidirectionalAveragingMode = (pPicParams->bBidirectionalAveragingMode & 0xE0) | // init in SetExtraData
+ ((vc1->lumshift!=0 || vc1->lumscale!=32) ? 0x10 : 0)| // iINSO
+ ((vc1->profile == PROFILE_ADVANCED) <<3 ); // iWMVA
+
+ // Section 3.2.20.3
+ pPicParams->bPicSpatialResid8 = (vc1->panscanflag << 7) | (vc1->refdist_flag << 6) |
+ (vc1->s.loop_filter << 5) | (vc1->fastuvmc << 4) |
+ (vc1->extended_mv << 3) | (vc1->dquant << 1) |
+ (vc1->vstransform);
+
+ // Section 3.2.20.4
+ pPicParams->bPicOverflowBlocks = (vc1->quantizer_mode << 6) | (vc1->multires << 5) |
+ (vc1->s.resync_marker << 4) | (vc1->rangered << 3) |
+ (vc1->s.max_b_frames);
+
+ // Section 3.2.20.2
+ pPicParams->bPicDeblockConfined = (vc1->postprocflag << 7) | (vc1->broadcast << 6) |
+ (vc1->interlace << 5) | (vc1->tfcntrflag << 4) |
+ (vc1->finterpflag << 3) | // (refpic << 2) set in DecodeFrame !
+ (vc1->psf << 1) | vc1->extended_dmv;
+
+
+ // TODO section 3.2.20.6
+ pPicParams->bPicStructure = *nFieldType;
+
+ // Cf page 17 : 2 for interlaced, 0 for progressive
+ pPicParams->bPicExtrapolation = (*nFieldType == PICT_FRAME) ? 1 : 2;
+
+ pPicParams->wBitstreamPCEelements = vc1->lumshift;
+ pPicParams->wBitstreamFcodes = vc1->lumscale;
+
+ // Section 3.2.16
+ *nSliceType = vc1->s.pict_type;
+
+ // TODO : not finish...
+ pPicParams->bMVprecisionAndChromaRelation = ((vc1->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) | // 0 for non-bilinear luma motion, 1 for bilinear
+ (1 << 2) | // 0 for WMV8, 1 for WMV9 motion
+ (0 << 1) | // 1 for WMV8 quarter sample luma motion
+ (0); // 0 for quarter sample chroma motion, 1 for half sample chroma
+
+ // Cf §7.1.1.25 in VC1 specification, §3.2.14.3 in DXVA spec
+ pPicParams->bRcontrol = vc1->rnd;
+
+ /*
+ // TODO : find files with de-ringing ...
+ pPicParams->bPicDeblocked = ((vc1->postproc & 0x01) ? 0x02 : 0) | // In loop de-blocking
+ ((vc1->postproc & 0x02) ? 0x08 : 0); // Out of loop de-ringing
+ */
+
+ return S_OK;
}
-HRESULT FFMpeg2DecodeFrame(DXVA_PictureParameters* pPicParams, DXVA_QmatrixData* pQMatrixData, DXVA_SliceInfo* pSliceInfo, int* nSliceCount,
- struct AVCodecContext* pAVCtx, struct AVFrame* pFrame, int* nNextCodecIndex, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize)
+HRESULT FFMpeg2DecodeFrame (DXVA_PictureParameters* pPicParams, DXVA_QmatrixData* pQMatrixData, DXVA_SliceInfo* pSliceInfo, int* nSliceCount,
+ struct AVCodecContext* pAVCtx, struct AVFrame* pFrame, int* nNextCodecIndex, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize)
{
- int i;
- int got_picture = 0;
+ int i;
+ int got_picture = 0;
Mpeg1Context* s1 = (Mpeg1Context*)pAVCtx->priv_data;
MpegEncContext* s = (MpegEncContext*)&s1->mpeg_enc_ctx;
- if(pBuffer)
- {
- s1->pSliceInfo = pSliceInfo;
- avcodec_decode_video(pAVCtx, pFrame, &got_picture, pBuffer, nSize);
- *nSliceCount = s1->slice_count;
- }
+ if (pBuffer)
+ {
+ s1->pSliceInfo = pSliceInfo;
+ avcodec_decode_video (pAVCtx, pFrame, &got_picture, pBuffer, nSize);
+ *nSliceCount = s1->slice_count;
+ }
- // pPicParams->wDecodedPictureIndex; set in DecodeFrame
- // pPicParams->wDeblockedPictureIndex; 0 for Mpeg2
- // pPicParams->wForwardRefPictureIndex; set in DecodeFrame
- // pPicParams->wBackwardRefPictureIndex; set in DecodeFrame
+ // pPicParams->wDecodedPictureIndex; set in DecodeFrame
+ // pPicParams->wDeblockedPictureIndex; 0 for Mpeg2
+ // pPicParams->wForwardRefPictureIndex; set in DecodeFrame
+ // pPicParams->wBackwardRefPictureIndex; set in DecodeFrame
- pPicParams->wPicWidthInMBminus1 = s->mb_width - 1;
- pPicParams->wPicHeightInMBminus1 = s->mb_height - 1;
+ pPicParams->wPicWidthInMBminus1 = s->mb_width-1;
+ pPicParams->wPicHeightInMBminus1 = s->mb_height-1;
- pPicParams->bMacroblockWidthMinus1 = 15; // This is equal to “15” for MPEG-1, MPEG-2, H.263, and MPEG-4
- pPicParams->bMacroblockHeightMinus1 = 15; // This is equal to “15” for MPEG-1, MPEG-2, H.261, H.263, and MPEG-4
+ pPicParams->bMacroblockWidthMinus1 = 15; // This is equal to “15” for MPEG-1, MPEG-2, H.263, and MPEG-4
+ pPicParams->bMacroblockHeightMinus1 = 15; // This is equal to “15” for MPEG-1, MPEG-2, H.261, H.263, and MPEG-4
- pPicParams->bBlockWidthMinus1 = 7; // This is equal to “7” for MPEG-1, MPEG-2, H.261, H.263, and MPEG-4
- pPicParams->bBlockHeightMinus1 = 7; // This is equal to “7” for MPEG-1, MPEG-2, H.261, H.263, and MPEG-4
+ pPicParams->bBlockWidthMinus1 = 7; // This is equal to “7” for MPEG-1, MPEG-2, H.261, H.263, and MPEG-4
+ pPicParams->bBlockHeightMinus1 = 7; // This is equal to “7” for MPEG-1, MPEG-2, H.261, H.263, and MPEG-4
- pPicParams->bBPPminus1 = 7; // It is equal to “7” for MPEG-1, MPEG-2, H.261, and H.263
+ pPicParams->bBPPminus1 = 7; // It is equal to “7” for MPEG-1, MPEG-2, H.261, and H.263
- pPicParams->bPicStructure = s->picture_structure;
+ pPicParams->bPicStructure = s->picture_structure;
// pPicParams->bSecondField;
- pPicParams->bPicIntra = (s->current_picture.pict_type == FF_I_TYPE);
- pPicParams->bPicBackwardPrediction = (s->current_picture.pict_type == FF_B_TYPE);
-
- pPicParams->bBidirectionalAveragingMode = 0; // The value “0” indicates MPEG-1 and MPEG-2 rounded averaging (//2),
- // pPicParams->bMVprecisionAndChromaRelation = 0; // Indicates that luminance motion vectors have half-sample precision and that chrominance motion vectors are derived from luminance motion vectors according to the rules in MPEG-2
- pPicParams->bChromaFormat = 0x01; // For MPEG-1, MPEG-2 “Main Profile,” H.261 and H.263 bitstreams, this value shall always be set to ‘01’, indicating "4:2:0" format
-
- // pPicParams->bPicScanFixed = 1; // set in UpdatePicParams
- // pPicParams->bPicScanMethod = 1; // set in UpdatePicParams
- // pPicParams->bPicReadbackRequests; // ??
-
- // pPicParams->bRcontrol = 0; // It shall be set to “0” for all MPEG-1, and MPEG-2 bitstreams in order to conform with the rounding operator defined by those standards
- // pPicParams->bPicSpatialResid8; // set in UpdatePicParams
- // pPicParams->bPicOverflowBlocks; // set in UpdatePicParams
- // pPicParams->bPicExtrapolation; = 0; // by H.263 Annex D and MPEG-4
-
- // pPicParams->bPicDeblocked; = 0; // MPEG2_A Restricted Profile
- // pPicParams->bPicDeblockConfined; // ??
- // pPicParams->bPic4MVallowed; // See H.263 Annexes F and J
- // pPicParams->bPicOBMC; // H.263 Annex F
- // pPicParams->bPicBinPB; // Annexes G and M of H.263
- // pPicParams->bMV_RPS; // ???
- // pPicParams->bReservedBits; // ??
-
- pPicParams->wBitstreamFcodes = (s->mpeg_f_code[0][0] << 12) | (s->mpeg_f_code[0][1] << 8) |
- (s->mpeg_f_code[1][0] << 4) | (s->mpeg_f_code[1][1]);
- pPicParams->wBitstreamPCEelements = (s->intra_dc_precision << 14) | (s->picture_structure << 12) |
- (s->top_field_first << 11) | (s->frame_pred_frame_dct << 10) |
- (s->concealment_motion_vectors << 9) | (s->q_scale_type << 8) |
- (s->intra_vlc_format << 7) | (s->alternate_scan << 6) |
- (s->repeat_first_field << 5) | (s->chroma_420_type << 4) |
- (s->progressive_frame << 3);
-
- // TODO : could be interesting to parameter concealment method?
- // pPicParams->bBitstreamConcealmentNeed;
- // pPicParams->bBitstreamConcealmentMethod;
-
- pQMatrixData->bNewQmatrix[0] = 1;
- pQMatrixData->bNewQmatrix[1] = 1;
- pQMatrixData->bNewQmatrix[2] = 1;
- pQMatrixData->bNewQmatrix[3] = 1;
- for(i = 0; i < 64; i++) // intra Y, inter Y, intra chroma, inter chroma
- {
- pQMatrixData->Qmatrix[0][i] = s->intra_matrix[ZZ_SCAN8[i]];
- pQMatrixData->Qmatrix[1][i] = s->inter_matrix[ZZ_SCAN8[i]];
- pQMatrixData->Qmatrix[2][i] = s->chroma_intra_matrix[ZZ_SCAN8[i]];
- pQMatrixData->Qmatrix[3][i] = s->chroma_inter_matrix[ZZ_SCAN8[i]];
- }
-
- if(got_picture)
- *nNextCodecIndex = pFrame->coded_picture_number;
-
- return S_OK;
+ pPicParams->bPicIntra = (s->current_picture.pict_type == FF_I_TYPE);
+ pPicParams->bPicBackwardPrediction = (s->current_picture.pict_type == FF_B_TYPE);
+
+ pPicParams->bBidirectionalAveragingMode = 0; // The value “0” indicates MPEG-1 and MPEG-2 rounded averaging (//2),
+ // pPicParams->bMVprecisionAndChromaRelation = 0; // Indicates that luminance motion vectors have half-sample precision and that chrominance motion vectors are derived from luminance motion vectors according to the rules in MPEG-2
+ pPicParams->bChromaFormat = 0x01; // For MPEG-1, MPEG-2 “Main Profile,” H.261 and H.263 bitstreams, this value shall always be set to ‘01’, indicating "4:2:0" format
+
+ // pPicParams->bPicScanFixed = 1; // set in UpdatePicParams
+ // pPicParams->bPicScanMethod = 1; // set in UpdatePicParams
+ // pPicParams->bPicReadbackRequests; // ??
+
+ // pPicParams->bRcontrol = 0; // It shall be set to “0” for all MPEG-1, and MPEG-2 bitstreams in order to conform with the rounding operator defined by those standards
+ // pPicParams->bPicSpatialResid8; // set in UpdatePicParams
+ // pPicParams->bPicOverflowBlocks; // set in UpdatePicParams
+ // pPicParams->bPicExtrapolation; = 0; // by H.263 Annex D and MPEG-4
+
+ // pPicParams->bPicDeblocked; = 0; // MPEG2_A Restricted Profile
+ // pPicParams->bPicDeblockConfined; // ??
+ // pPicParams->bPic4MVallowed; // See H.263 Annexes F and J
+ // pPicParams->bPicOBMC; // H.263 Annex F
+ // pPicParams->bPicBinPB; // Annexes G and M of H.263
+ // pPicParams->bMV_RPS; // ???
+ // pPicParams->bReservedBits; // ??
+
+ pPicParams->wBitstreamFcodes = (s->mpeg_f_code[0][0]<<12) | (s->mpeg_f_code[0][1]<<8) |
+ (s->mpeg_f_code[1][0]<<4) | (s->mpeg_f_code[1][1]);
+ pPicParams->wBitstreamPCEelements = (s->intra_dc_precision<<14) | (s->picture_structure<<12) |
+ (s->top_field_first<<11) | (s->frame_pred_frame_dct<<10)|
+ (s->concealment_motion_vectors<<9) | (s->q_scale_type<<8)|
+ (s->intra_vlc_format<<7) | (s->alternate_scan<<6)|
+ (s->repeat_first_field<<5) | (s->chroma_420_type<<4)|
+ (s->progressive_frame<<3);
+
+ // TODO : could be interesting to parameter concealment method?
+ // pPicParams->bBitstreamConcealmentNeed;
+ // pPicParams->bBitstreamConcealmentMethod;
+
+ pQMatrixData->bNewQmatrix[0] = 1;
+ pQMatrixData->bNewQmatrix[1] = 1;
+ pQMatrixData->bNewQmatrix[2] = 1;
+ pQMatrixData->bNewQmatrix[3] = 1;
+ for (i=0; i<64; i++) // intra Y, inter Y, intra chroma, inter chroma
+ {
+ pQMatrixData->Qmatrix[0][i] = s->intra_matrix[ZZ_SCAN8[i]];
+ pQMatrixData->Qmatrix[1][i] = s->inter_matrix[ZZ_SCAN8[i]];
+ pQMatrixData->Qmatrix[2][i] = s->chroma_intra_matrix[ZZ_SCAN8[i]];
+ pQMatrixData->Qmatrix[3][i] = s->chroma_inter_matrix[ZZ_SCAN8[i]];
+ }
+
+ if (got_picture)
+ *nNextCodecIndex = pFrame->coded_picture_number;
+
+ return S_OK;
}
@@ -744,57 +703,57 @@ unsigned long FFGetMBNumber(struct AVCodecContext* pAVCtx)
{
MpegEncContext* s = GetMpegEncContext(pAVCtx);
- return (s != NULL) ? s->mb_num : 0;
+ return (s != NULL) ? s->mb_num : 0;
}
int FFIsSkipped(struct AVCodecContext* pAVCtx)
{
- VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
- return vc1->p_frame_skipped;
+ VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
+ return vc1->p_frame_skipped;
}
int FFIsInterlaced(struct AVCodecContext* pAVCtx, int nHeight)
{
- if(pAVCtx->codec_id == CODEC_ID_H264)
- {
- H264Context* h = (H264Context*) pAVCtx->priv_data;
- SPS* cur_sps = h->sps_buffers[0];
-
- if(cur_sps && !cur_sps->frame_mbs_only_flag)
- return 1;
- else
- return 0;
- }
- else if(pAVCtx->codec_id == CODEC_ID_VC1)
- {
- VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
- return vc1->interlace;
- }
-
- return 0;
+ if (pAVCtx->codec_id == CODEC_ID_H264)
+ {
+ H264Context* h = (H264Context*) pAVCtx->priv_data;
+ SPS* cur_sps = h->sps_buffers[0];
+
+ if (cur_sps && !cur_sps->frame_mbs_only_flag)
+ return 1;
+ else
+ return 0;
+ }
+ else if (pAVCtx->codec_id == CODEC_ID_VC1)
+ {
+ VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
+ return vc1->interlace;
+ }
+
+ return 0;
}
void FFSetThreadNumber(struct AVCodecContext* pAVCtx, int nThreadCount)
{
- if(pAVCtx->thread_count > 1)
- {
- avcodec_thread_free(pAVCtx);
- pAVCtx->thread_count = 1;
- }
-
- if(nThreadCount > 1)
- avcodec_thread_init(pAVCtx, nThreadCount);
+ if (pAVCtx->thread_count > 1)
+ {
+ avcodec_thread_free (pAVCtx);
+ pAVCtx->thread_count = 1;
+ }
+
+ if (nThreadCount > 1)
+ avcodec_thread_init(pAVCtx, nThreadCount);
}
BOOL FFSoftwareCheckCompatibility(struct AVCodecContext* pAVCtx)
{
- if(pAVCtx->codec_id == CODEC_ID_VC1)
- {
- VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
- return !vc1->interlace;
- }
- else
- return TRUE;
+ if (pAVCtx->codec_id == CODEC_ID_VC1)
+ {
+ VC1Context* vc1 = (VC1Context*) pAVCtx->priv_data;
+ return !vc1->interlace;
+ }
+ else
+ return TRUE;
}
@@ -802,7 +761,7 @@ int FFGetCodedPicture(struct AVCodecContext* pAVCtx)
{
MpegEncContext* s = GetMpegEncContext(pAVCtx);
- return (s != NULL) ? s->current_picture.coded_picture_number : 0;
+ return (s != NULL) ? s->current_picture.coded_picture_number : 0;
}
@@ -810,16 +769,16 @@ BOOL FFGetAlternateScan(struct AVCodecContext* pAVCtx)
{
MpegEncContext* s = GetMpegEncContext(pAVCtx);
- return (s != NULL) ? s->alternate_scan : 0;
+ return (s != NULL) ? s->alternate_scan : 0;
}
#ifdef _WIN64
// Stupid : MSVC "forgot" to link toupper (referenced in ffmpeg and compile with Gcc) in x64
// for standalone decoder without this dummy function !
-void DummyX64Link()
+void DummyX64Link ()
{
- toupper('X');
+ toupper('X');
}
#endif \ No newline at end of file
diff --git a/src/filters/transform/MPCVideoDec/FfmpegContext.h b/src/filters/transform/MPCVideoDec/FfmpegContext.h
index 71e2a3646..101ef4336 100644
--- a/src/filters/transform/MPCVideoDec/FfmpegContext.h
+++ b/src/filters/transform/MPCVideoDec/FfmpegContext.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -29,29 +29,29 @@ struct AVFrame;
enum PCI_Vendors
{
- PCIV_ATI = 0x1002,
- PCIV_nVidia = 0x10DE,
- PCIV_Intel = 0x8086,
- PCIV_S3_Graphics = 0x5333
+ PCIV_ATI = 0x1002,
+ PCIV_nVidia = 0x10DE,
+ PCIV_Intel = 0x8086,
+ PCIV_S3_Graphics = 0x5333
};
// === H264 functions
-void FFH264DecodeBuffer(struct AVCodecContext* pAVCtx, BYTE* pBuffer, UINT nSize, int* pFramePOC, int* pOutPOC, REFERENCE_TIME* pOutrtStart);
-HRESULT FFH264BuildPicParams(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Qmatrix_H264* pDXVAScalingMatrix, int* nFieldType, int* nSliceType, struct AVCodecContext* pAVCtx, int nPCIVendor);
+void FFH264DecodeBuffer (struct AVCodecContext* pAVCtx, BYTE* pBuffer, UINT nSize, int* pFramePOC, int* pOutPOC, REFERENCE_TIME* pOutrtStart);
+HRESULT FFH264BuildPicParams (DXVA_PicParams_H264* pDXVAPicParams, DXVA_Qmatrix_H264* pDXVAScalingMatrix, int* nFieldType, int* nSliceType, struct AVCodecContext* pAVCtx, int nPCIVendor);
int FFH264CheckCompatibility(int nWidth, int nHeight, struct AVCodecContext* pAVCtx, BYTE* pBuffer, UINT nSize, int nPCIVendor, LARGE_INTEGER VideoDriverVersion);
-void FFH264SetCurrentPicture(int nIndex, DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx);
-void FFH264UpdateRefFramesList(DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx);
-BOOL FFH264IsRefFrameInUse(int nFrameNum, struct AVCodecContext* pAVCtx);
+void FFH264SetCurrentPicture (int nIndex, DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx);
+void FFH264UpdateRefFramesList (DXVA_PicParams_H264* pDXVAPicParams, struct AVCodecContext* pAVCtx);
+BOOL FFH264IsRefFrameInUse (int nFrameNum, struct AVCodecContext* pAVCtx);
void FF264UpdateRefFrameSliceLong(DXVA_PicParams_H264* pDXVAPicParams, DXVA_Slice_H264_Long* pSlice, struct AVCodecContext* pAVCtx);
-void FFH264SetDxvaSliceLong(struct AVCodecContext* pAVCtx, void* pSliceLong);
+void FFH264SetDxvaSliceLong (struct AVCodecContext* pAVCtx, void* pSliceLong);
// === VC1 functions
-HRESULT FFVC1UpdatePictureParam(DXVA_PictureParameters* pPicParams, struct AVCodecContext* pAVCtx, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize);
+HRESULT FFVC1UpdatePictureParam (DXVA_PictureParameters* pPicParams, struct AVCodecContext* pAVCtx, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize);
int FFIsSkipped(struct AVCodecContext* pAVCtx);
// === Mpeg2 functions
-HRESULT FFMpeg2DecodeFrame(DXVA_PictureParameters* pPicParams, DXVA_QmatrixData* m_QMatrixData, DXVA_SliceInfo* pSliceInfo, int* nSliceCount,
- struct AVCodecContext* pAVCtx, struct AVFrame* pFrame, int* nNextCodecIndex, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize);
+HRESULT FFMpeg2DecodeFrame (DXVA_PictureParameters* pPicParams, DXVA_QmatrixData* m_QMatrixData, DXVA_SliceInfo* pSliceInfo, int* nSliceCount,
+ struct AVCodecContext* pAVCtx, struct AVFrame* pFrame, int* nNextCodecIndex, int* nFieldType, int* nSliceType, BYTE* pBuffer, UINT nSize);
// === Common functions
int IsVista();
diff --git a/src/filters/transform/MPCVideoDec/H264QuantizationMatrix.h b/src/filters/transform/MPCVideoDec/H264QuantizationMatrix.h
index 099f13eb8..80dde2a89 100644
--- a/src/filters/transform/MPCVideoDec/H264QuantizationMatrix.h
+++ b/src/filters/transform/MPCVideoDec/H264QuantizationMatrix.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -24,336 +24,270 @@
typedef enum
{
- Flat16,
- JVTMatrix,
- QMatrix,
- QMatrix2,
+ Flat16,
+ JVTMatrix,
+ QMatrix,
+ QMatrix2,
} QMatrixH264Type;
const byte ZZ_SCAN[16] =
-{
- 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
+{ 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
};
const byte ZZ_SCAN8[64] =
-{
- 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
+{ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
+ 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
};
-const DXVA_Qmatrix_H264 g_QMatrixH264[] =
+const DXVA_Qmatrix_H264 g_QMatrixH264[] =
{
- // 1) #flat 16
- {
- {
- // INTRA4X4_LUMA =
- {
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16
- },
-
- // INTRA4X4_CHROMAU =
- {
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16
- },
-
- // INTRA4X4_CHROMAV =
- {
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16
- },
-
- // INTER4X4_LUMA =
- {
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16
- },
-
- // INTER4X4_CHROMAU =
- {
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16
- },
-
- // INTER4X4_CHROMAV =
- {
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16,
- 16, 16, 16, 16
- }
- },
- {
- // INTRA8X8_LUMA =
- {
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16
- },
-
- // INTER8X8_LUMA =
- {
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16
- }
- }
- },
- // 2) The JVT Matrix
- {
- {
- // INTRA4X4_LUMA
- {
- 6, 13, 20, 28,
- 13, 20, 28, 32,
- 20, 28, 32, 37,
- 28, 32, 37, 42
- },
-
- // INTRA4X4_CHROMAU
- {
- 6, 13, 20, 28,
- 13, 20, 28, 32,
- 20, 28, 32, 37,
- 28, 32, 37, 42
- },
-
- // INTRA4X4_CHROMAV
- {
- 6, 13, 20, 28,
- 13, 20, 28, 32,
- 20, 28, 32, 37,
- 28, 32, 37, 42
- },
-
- // INTER4X4_LUMA
- {
- 10, 14, 20, 24,
- 14, 20, 24, 27,
- 20, 24, 27, 30,
- 24, 27, 30, 34
- },
-
- // INTER4X4_CHROMAU
- {
- 10, 14, 20, 24,
- 14, 20, 24, 27,
- 20, 24, 27, 30,
- 24, 27, 30, 34
- },
-
- // INTER4X4_CHROMAV
- {
- 10, 14, 20, 24,
- 14, 20, 24, 27,
- 20, 24, 27, 30,
- 24, 27, 30, 34
- }
- },
- {
- // INTRA8X8_LUMA
- {
- 6, 10, 13, 16, 18, 23, 25, 27,
- 10, 11, 16, 18, 23, 25, 27, 29,
- 13, 16, 18, 23, 25, 27, 29, 31,
- 16, 18, 23, 25, 27, 29, 31, 33,
- 18, 23, 25, 27, 29, 31, 33, 36,
- 23, 25, 27, 29, 31, 33, 36, 38,
- 25, 27, 29, 31, 33, 36, 38, 40,
- 27, 29, 31, 33, 36, 38, 40, 42
- },
-
- // INTER8X8_LUMA
- {
- 9, 13, 15, 17, 19, 21, 22, 24,
- 13, 13, 17, 19, 21, 22, 24, 25,
- 15, 17, 19, 21, 22, 24, 25, 27,
- 17, 19, 21, 22, 24, 25, 27, 28,
- 19, 21, 22, 24, 25, 27, 28, 30,
- 21, 22, 24, 25, 27, 28, 30, 32,
- 22, 24, 25, 27, 28, 30, 32, 33,
- 24, 25, 27, 28, 30, 32, 33, 35
- }
- }
- },
-
- // 3) q_matrix
- {
- {
- // INTRA4X4_LUMA =
- {
- 6, 12, 19, 26,
- 12, 19, 26, 31,
- 19, 26, 31, 35,
- 26, 31, 35, 39
- },
-
- // INTRA4X4_CHROMAU =
- {
- 6, 12, 19, 26,
- 12, 19, 26, 31,
- 19, 26, 31, 35,
- 26, 31, 35, 39
- },
-
- // INTRA4X4_CHROMAV =
- {
- 6, 12, 19, 26,
- 12, 19, 26, 31,
- 19, 26, 31, 35,
- 26, 31, 35, 39
- },
-
- // INTER4X4_LUMA =
- {
- 9, 13, 18, 21,
- 13, 18, 21, 24,
- 18, 21, 24, 27,
- 21, 24, 27, 30
- },
-
- // INTER4X4_CHROMAU =
- {
- 9, 13, 18, 21,
- 13, 18, 21, 24,
- 18, 21, 24, 27,
- 21, 24, 27, 30
- },
-
- // INTER4X4_CHROMAV =
- {
- 9, 13, 18, 21,
- 13, 18, 21, 24,
- 18, 21, 24, 27,
- 21, 24, 27, 30
- }
- },
- {
- // INTRA8X8_LUMA =
- {
- 6, 10, 13, 16, 19, 24, 26, 28,
- 10, 12, 16, 19, 24, 26, 28, 31,
- 13, 16, 19, 24, 26, 28, 31, 33,
- 16, 19, 24, 26, 28, 31, 33, 35,
- 19, 24, 26, 28, 31, 33, 35, 37,
- 24, 26, 28, 31, 33, 35, 37, 39,
- 26, 28, 31, 33, 35, 37, 39, 42,
- 28, 31, 33, 35, 37, 39, 42, 44
- },
-
- // INTER8X8_LUMA =
- {
- 9, 12, 14, 16, 18, 19, 21, 22,
- 12, 13, 16, 18, 19, 21, 22, 24,
- 14, 16, 18, 19, 21, 22, 24, 25,
- 16, 18, 19, 21, 22, 24, 25, 27,
- 18, 19, 21, 22, 24, 25, 27, 28,
- 19, 21, 22, 24, 25, 27, 28, 30,
- 21, 22, 24, 25, 27, 28, 30, 31,
- 22, 24, 25, 27, 28, 30, 31, 33
- }
- }
- },
-
- // 4) q_matrix2
- {
- {
- // INTRA4X4_LUMA =
- {
- 7, 16, 22, 24,
- 16, 22, 24, 28,
- 18, 22, 27, 33,
- 22, 24, 32, 47
- },
-
- // INTRA4X4_CHROMAU =
- {
- 7, 16, 22, 24,
- 16, 22, 24, 28,
- 18, 22, 27, 33,
- 22, 24, 32, 47
- },
-
- // INTRA4X4_CHROMAV =
- {
- 7, 16, 22, 24,
- 16, 22, 24, 28,
- 18, 22, 27, 33,
- 22, 24, 32, 47
- },
-
- // INTER4X4_LUMA =
- {
- 13, 15, 17, 18,
- 15, 17, 18, 20,
- 17, 18, 21, 22,
- 18, 20, 22, 25
- },
-
- // INTER4X4_CHROMAU =
- {
- 13, 15, 17, 18,
- 15, 17, 18, 20,
- 17, 18, 21, 22,
- 18, 20, 22, 25
- },
-
- // INTER4X4_CHROMAV =
- {
- 13, 15, 17, 18,
- 15, 17, 18, 20,
- 17, 18, 21, 22,
- 18, 20, 22, 25
- }
- },
- {
- // INTRA8X8_LUMA =
- {
- 7, 13, 16, 18, 22, 22, 24, 28,
- 13, 13, 18, 20, 22, 24, 28, 31,
- 16, 18, 22, 22, 24, 28, 28, 32,
- 18, 18, 22, 22, 24, 28, 31, 33,
- 18, 22, 22, 24, 27, 29, 33, 40,
- 22, 22, 24, 27, 29, 33, 40, 48,
- 22, 22, 24, 28, 32, 38, 47, 57,
- 22, 24, 29, 32, 38, 47, 57, 69
- },
-
- // INTER8X8_LUMA =
- {
- 13, 14, 15, 16, 17, 17, 18, 19,
- 14, 15, 16, 17, 17, 18, 19, 20,
- 15, 16, 17, 17, 18, 19, 20, 21,
- 16, 17, 17, 18, 19, 20, 21, 22,
- 17, 17, 18, 19, 21, 22, 22, 23,
- 17, 18, 19, 20, 22, 22, 23, 25,
- 18, 19, 20, 22, 22, 23, 25, 26,
- 19, 20, 21, 22, 23, 25, 26, 27
- }
- }
- }
+ // 1) #flat 16
+ {
+ {
+ // INTRA4X4_LUMA =
+ { 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16 },
+
+ // INTRA4X4_CHROMAU =
+ { 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16 },
+
+ // INTRA4X4_CHROMAV =
+ { 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16 },
+
+ // INTER4X4_LUMA =
+ { 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16 },
+
+ // INTER4X4_CHROMAU =
+ { 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16 },
+
+ // INTER4X4_CHROMAV =
+ { 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16,
+ 16,16,16,16 }
+ },
+ {
+ // INTRA8X8_LUMA =
+ { 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16 },
+
+ // INTER8X8_LUMA =
+ { 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16 }
+ }
+ },
+ // 2) The JVT Matrix
+ {
+ {
+ // INTRA4X4_LUMA
+ { 6,13,20,28,
+ 13,20,28,32,
+ 20,28,32,37,
+ 28,32,37,42 },
+
+ // INTRA4X4_CHROMAU
+ { 6,13,20,28,
+ 13,20,28,32,
+ 20,28,32,37,
+ 28,32,37,42 },
+
+ // INTRA4X4_CHROMAV
+ { 6,13,20,28,
+ 13,20,28,32,
+ 20,28,32,37,
+ 28,32,37,42 },
+
+ // INTER4X4_LUMA
+ { 10,14,20,24,
+ 14,20,24,27,
+ 20,24,27,30,
+ 24,27,30,34 },
+
+ // INTER4X4_CHROMAU
+ { 10,14,20,24,
+ 14,20,24,27,
+ 20,24,27,30,
+ 24,27,30,34 },
+
+ // INTER4X4_CHROMAV
+ { 10,14,20,24,
+ 14,20,24,27,
+ 20,24,27,30,
+ 24,27,30,34 }
+ },
+ {
+ // INTRA8X8_LUMA
+ { 6,10,13,16,18,23,25,27,
+ 10,11,16,18,23,25,27,29,
+ 13,16,18,23,25,27,29,31,
+ 16,18,23,25,27,29,31,33,
+ 18,23,25,27,29,31,33,36,
+ 23,25,27,29,31,33,36,38,
+ 25,27,29,31,33,36,38,40,
+ 27,29,31,33,36,38,40,42 },
+
+ // INTER8X8_LUMA
+ { 9,13,15,17,19,21,22,24,
+ 13,13,17,19,21,22,24,25,
+ 15,17,19,21,22,24,25,27,
+ 17,19,21,22,24,25,27,28,
+ 19,21,22,24,25,27,28,30,
+ 21,22,24,25,27,28,30,32,
+ 22,24,25,27,28,30,32,33,
+ 24,25,27,28,30,32,33,35 }
+ }
+ },
+
+ // 3) q_matrix
+ {
+ {
+ // INTRA4X4_LUMA =
+ { 6,12,19,26,
+ 12,19,26,31,
+ 19,26,31,35,
+ 26,31,35,39 },
+
+ // INTRA4X4_CHROMAU =
+ { 6,12,19,26,
+ 12,19,26,31,
+ 19,26,31,35,
+ 26,31,35,39 },
+
+ // INTRA4X4_CHROMAV =
+ { 6,12,19,26,
+ 12,19,26,31,
+ 19,26,31,35,
+ 26,31,35,39 },
+
+ // INTER4X4_LUMA =
+ { 9,13,18,21,
+ 13,18,21,24,
+ 18,21,24,27,
+ 21,24,27,30 },
+
+ // INTER4X4_CHROMAU =
+ { 9,13,18,21,
+ 13,18,21,24,
+ 18,21,24,27,
+ 21,24,27,30 },
+
+ // INTER4X4_CHROMAV =
+ { 9,13,18,21,
+ 13,18,21,24,
+ 18,21,24,27,
+ 21,24,27,30 }
+ },
+ {
+ // INTRA8X8_LUMA =
+ { 6,10,13,16,19,24,26,28,
+ 10,12,16,19,24,26,28,31,
+ 13,16,19,24,26,28,31,33,
+ 16,19,24,26,28,31,33,35,
+ 19,24,26,28,31,33,35,37,
+ 24,26,28,31,33,35,37,39,
+ 26,28,31,33,35,37,39,42,
+ 28,31,33,35,37,39,42,44 },
+
+ // INTER8X8_LUMA =
+ { 9,12,14,16,18,19,21,22,
+ 12,13,16,18,19,21,22,24,
+ 14,16,18,19,21,22,24,25,
+ 16,18,19,21,22,24,25,27,
+ 18,19,21,22,24,25,27,28,
+ 19,21,22,24,25,27,28,30,
+ 21,22,24,25,27,28,30,31,
+ 22,24,25,27,28,30,31,33 }
+ }
+ },
+
+ // 4) q_matrix2
+ {
+ {
+ // INTRA4X4_LUMA =
+ { 7,16,22,24,
+ 16,22,24,28,
+ 18,22,27,33,
+ 22,24,32,47 },
+
+ // INTRA4X4_CHROMAU =
+ { 7,16,22,24,
+ 16,22,24,28,
+ 18,22,27,33,
+ 22,24,32,47 },
+
+ // INTRA4X4_CHROMAV =
+ { 7,16,22,24,
+ 16,22,24,28,
+ 18,22,27,33,
+ 22,24,32,47 },
+
+ // INTER4X4_LUMA =
+ {13,15,17,18,
+ 15,17,18,20,
+ 17,18,21,22,
+ 18,20,22,25 },
+
+ // INTER4X4_CHROMAU =
+ {13,15,17,18,
+ 15,17,18,20,
+ 17,18,21,22,
+ 18,20,22,25 },
+
+ // INTER4X4_CHROMAV =
+ {13,15,17,18,
+ 15,17,18,20,
+ 17,18,21,22,
+ 18,20,22,25 }
+ },
+ {
+ // INTRA8X8_LUMA =
+ { 7,13,16,18,22,22,24,28,
+ 13,13,18,20,22,24,28,31,
+ 16,18,22,22,24,28,28,32,
+ 18,18,22,22,24,28,31,33,
+ 18,22,22,24,27,29,33,40,
+ 22,22,24,27,29,33,40,48,
+ 22,22,24,28,32,38,47,57,
+ 22,24,29,32,38,47,57,69 },
+
+ // INTER8X8_LUMA =
+ { 13,14,15,16,17,17,18,19,
+ 14,15,16,17,17,18,19,20,
+ 15,16,17,17,18,19,20,21,
+ 16,17,17,18,19,20,21,22,
+ 17,17,18,19,21,22,22,23,
+ 17,18,19,20,22,22,23,25,
+ 18,19,20,22,22,23,25,26,
+ 19,20,21,22,23,25,26,27 }
+ }
+ }
}; \ No newline at end of file
diff --git a/src/filters/transform/MPCVideoDec/IMPCVideoDecFilter.h b/src/filters/transform/MPCVideoDec/IMPCVideoDecFilter.h
index d935401dd..444a0268d 100644
--- a/src/filters/transform/MPCVideoDec/IMPCVideoDecFilter.h
+++ b/src/filters/transform/MPCVideoDec/IMPCVideoDecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -24,52 +24,51 @@
#pragma once
// Internal codec list (use to enable/disable codec in standalone mode)
-typedef enum
+typedef enum
{
- MPCVD_H264 = 1,
- MPCVD_VC1 = MPCVD_H264 << 1,
- MPCVD_XVID = MPCVD_VC1 << 1,
- MPCVD_DIVX = MPCVD_XVID << 1,
- MPCVD_WMV = MPCVD_DIVX << 1,
- MPCVD_MSMPEG4 = MPCVD_WMV << 1,
- MPCVD_H263 = MPCVD_MSMPEG4 << 1,
- MPCVD_SVQ3 = MPCVD_H263 << 1,
- MPCVD_THEORA = MPCVD_SVQ3 << 1,
- MPCVD_AMVV = MPCVD_THEORA << 1,
- MPCVD_FLASH = MPCVD_AMVV << 1,
- MPCVD_H264_DXVA = MPCVD_FLASH << 1,
- MPCVD_VC1_DXVA = MPCVD_H264_DXVA << 1,
- MPCVD_VP6 = MPCVD_VC1_DXVA << 1
+ MPCVD_H264 = 1,
+ MPCVD_VC1 = MPCVD_H264<<1,
+ MPCVD_XVID = MPCVD_VC1<<1,
+ MPCVD_DIVX = MPCVD_XVID<<1,
+ MPCVD_WMV = MPCVD_DIVX<<1,
+ MPCVD_MSMPEG4 = MPCVD_WMV<<1,
+ MPCVD_H263 = MPCVD_MSMPEG4<<1,
+ MPCVD_SVQ3 = MPCVD_H263<<1,
+ MPCVD_THEORA = MPCVD_SVQ3<<1,
+ MPCVD_AMVV = MPCVD_THEORA<<1,
+ MPCVD_FLASH = MPCVD_AMVV<<1,
+ MPCVD_H264_DXVA = MPCVD_FLASH<<1,
+ MPCVD_VC1_DXVA = MPCVD_H264_DXVA<<1,
+ MPCVD_VP6 = MPCVD_VC1_DXVA<<1
} MPC_VIDEO_CODEC;
[uuid("CDC3B5B3-A8B0-4c70-A805-9FC80CDEF262")]
-interface IMPCVideoDecFilter :
-public IUnknown
+interface IMPCVideoDecFilter : public IUnknown
{
- STDMETHOD(Apply()) = 0;
+ STDMETHOD(Apply()) = 0;
- STDMETHOD(SetThreadNumber(int nValue)) = 0;
- STDMETHOD_(int, GetThreadNumber()) = 0;
+ STDMETHOD(SetThreadNumber(int nValue)) = 0;
+ STDMETHOD_(int, GetThreadNumber()) = 0;
- STDMETHOD(SetDiscardMode(int nValue)) = 0;
- STDMETHOD_(int, GetDiscardMode()) = 0;
+ STDMETHOD(SetDiscardMode(int nValue)) = 0;
+ STDMETHOD_(int, GetDiscardMode()) = 0;
- STDMETHOD(SetErrorRecognition(int nValue)) = 0;
- STDMETHOD_(int, GetErrorRecognition()) = 0;
+ STDMETHOD(SetErrorRecognition(int nValue)) = 0;
+ STDMETHOD_(int, GetErrorRecognition()) = 0;
- STDMETHOD(SetIDCTAlgo(int nValue)) = 0;
- STDMETHOD_(int, GetIDCTAlgo()) = 0;
+ STDMETHOD(SetIDCTAlgo(int nValue)) = 0;
+ STDMETHOD_(int, GetIDCTAlgo()) = 0;
- STDMETHOD_(GUID*, GetDXVADecoderGuid()) = 0;
+ STDMETHOD_(GUID*, GetDXVADecoderGuid()) = 0;
- STDMETHOD(SetActiveCodecs(MPC_VIDEO_CODEC nValue)) = 0;
- STDMETHOD_(MPC_VIDEO_CODEC, GetActiveCodecs()) = 0;
+ STDMETHOD(SetActiveCodecs(MPC_VIDEO_CODEC nValue)) = 0;
+ STDMETHOD_(MPC_VIDEO_CODEC, GetActiveCodecs()) = 0;
- STDMETHOD_(LPCTSTR, GetVideoCardDescription()) = 0;
+ STDMETHOD_(LPCTSTR, GetVideoCardDescription()) = 0;
- STDMETHOD(SetARMode(int nValue)) = 0;
- STDMETHOD_(int, GetARMode()) = 0;
+ STDMETHOD(SetARMode(int nValue)) = 0;
+ STDMETHOD_(int, GetARMode()) = 0;
- STDMETHOD(SetDXVACheckCompatibility(int nValue)) = 0;
- STDMETHOD_(int, GetDXVACheckCompatibility()) = 0;
+ STDMETHOD(SetDXVACheckCompatibility(int nValue)) = 0;
+ STDMETHOD_(int, GetDXVACheckCompatibility()) = 0;
};
diff --git a/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.cpp
index aa13fea61..fb69949dc 100644
--- a/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2007 see AUTHORS
@@ -39,344 +39,335 @@
typedef struct
{
- const CLSID* clsMinorType;
- const enum CodecID nFFCodec;
- const int fourcc;
+ const CLSID* clsMinorType;
+ const enum CodecID nFFCodec;
+ const int fourcc;
} FFMPEG_CODECS;
const FFMPEG_CODECS ffCodecs[] =
{
- // AMVA
- { &MEDIASUBTYPE_IMA_AMV, CODEC_ID_ADPCM_IMA_AMV, MAKEFOURCC('A', 'M', 'V', 'A') },
+ // AMVA
+ { &MEDIASUBTYPE_IMA_AMV, CODEC_ID_ADPCM_IMA_AMV, MAKEFOURCC('A','M','V','A') },
};
const AMOVIESETUP_MEDIATYPE CMPCAudioDecFilter::sudPinTypesIn[] =
{
- { &MEDIATYPE_Audio, &MEDIASUBTYPE_IMA_AMV },
+ { &MEDIATYPE_Audio, &MEDIASUBTYPE_IMA_AMV },
};
const int CMPCAudioDecFilter::sudPinTypesInCount = countof(CMPCAudioDecFilter::sudPinTypesIn);
const AMOVIESETUP_MEDIATYPE CMPCAudioDecFilter::sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM}
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM}
};
const int CMPCAudioDecFilter::sudPinTypesOutCount = countof(CMPCAudioDecFilter::sudPinTypesOut);
CMPCAudioDecFilter::CMPCAudioDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CMPCAudioDecFilter"), lpunk, __uuidof(this))
+ : CTransformFilter(NAME("CMPCAudioDecFilter"), lpunk, __uuidof(this))
{
- if(!(m_pInput = new CTransformInputPin(NAME("CAudioDecInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
+ if(!(m_pInput = new CTransformInputPin(NAME("CAudioDecInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
- if(!(m_pOutput = new CTransformOutputPin(NAME("CAudioDecOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
- if(FAILED(*phr))
- {
- delete m_pInput, m_pInput = NULL;
- return;
- }
+ if(!(m_pOutput = new CTransformOutputPin(NAME("CAudioDecOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
- m_iSampleFormat = SAMPLE_FMT_S16;
+ m_iSampleFormat = SAMPLE_FMT_S16;
- m_pAVCodec = NULL;
- m_pAVCtx = NULL;
- m_pFrame = NULL;
- m_nCodecNb = -1;
+ m_pAVCodec = NULL;
+ m_pAVCtx = NULL;
+ m_pFrame = NULL;
+ m_nCodecNb = -1;
- avcodec_init();
- avcodec_register_all();
- av_log_set_callback(LogLibAVCodec);
+ avcodec_init();
+ avcodec_register_all();
+ av_log_set_callback(LogLibAVCodec);
}
CMPCAudioDecFilter::~CMPCAudioDecFilter(void)
{
- Cleanup();
+ Cleanup();
}
void CMPCAudioDecFilter::Cleanup()
{
- if(m_pAVCtx)
- {
- avcodec_thread_free(m_pAVCtx);
- av_free(m_pAVCtx);
- }
- if(m_pFrame) av_free(m_pFrame);
-
- m_pAVCodec = NULL;
- m_pAVCtx = NULL;
- m_pFrame = NULL;
- m_nCodecNb = -1;
+ if (m_pAVCtx)
+ {
+ avcodec_thread_free (m_pAVCtx);
+ av_free(m_pAVCtx);
+ }
+ if (m_pFrame) av_free(m_pFrame);
+
+ m_pAVCodec = NULL;
+ m_pAVCtx = NULL;
+ m_pFrame = NULL;
+ m_nCodecNb = -1;
}
-void CMPCAudioDecFilter::LogLibAVCodec(void* par, int level, const char *fmt, va_list valist)
+void CMPCAudioDecFilter::LogLibAVCodec(void* par,int level,const char *fmt,va_list valist)
{
#ifdef _DEBUG
- //AVCodecContext* m_pAVCtx = (AVCodecContext*) par;
+ //AVCodecContext* m_pAVCtx = (AVCodecContext*) par;
- //char Msg [500];
- //snprintf (Msg, sizeof(Msg), fmt, valist);
- //TRACE("AVLIB : %s", Msg);
+ //char Msg [500];
+ //snprintf (Msg, sizeof(Msg), fmt, valist);
+ //TRACE("AVLIB : %s", Msg);
#endif
}
STDMETHODIMP CMPCAudioDecFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
+ return
// QI(IMPCVideoDecFilter)
// QI(ISpecifyPropertyPages)
// QI(ISpecifyPropertyPages2)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMPCAudioDecFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return SUCCEEDED(CheckInputType(mtIn))
- && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
- || mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_IEEE_FLOAT
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ || mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_IEEE_FLOAT
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CMPCAudioDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- return S_OK;
+ return S_OK;
}
HRESULT CMPCAudioDecFilter::CheckInputType(const CMediaType* mtIn)
{
- for(int i = 0; i < sizeof(sudPinTypesIn) / sizeof(AMOVIESETUP_MEDIATYPE); i++)
- {
- if((mtIn->majortype == *sudPinTypesIn[i].clsMajorType) &&
- (mtIn->subtype == *sudPinTypesIn[i].clsMinorType))
- return S_OK;
- }
-
- return VFW_E_TYPE_NOT_ACCEPTED;
+ for (int i=0; i<sizeof(sudPinTypesIn)/sizeof(AMOVIESETUP_MEDIATYPE); i++)
+ {
+ if ((mtIn->majortype == *sudPinTypesIn[i].clsMajorType) &&
+ (mtIn->subtype == *sudPinTypesIn[i].clsMinorType))
+ return S_OK;
+ }
+
+ return VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CMPCAudioDecFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
-
- CMediaType mt = m_pInput->CurrentMediaType();
- const GUID& subtype = mt.subtype;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
-
- //if(GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 || subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
- //|| GetSpeakerConfig(dts) < 0 && (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS))
- //{
- // *pmt = CreateMediaTypeSPDIF();
- //}
- //else if(subtype == MEDIASUBTYPE_Vorbis2)
- //{
- // *pmt = CreateMediaType(GetSampleFormat(), m_vorbis.vi.rate, m_vorbis.vi.channels);
- //}
- //else
- //{
- *pmt = CreateMediaType(GetSampleFormat(), wfe->nSamplesPerSec, min(2, wfe->nChannels));
- //}
-
- return S_OK;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ CMediaType mt = m_pInput->CurrentMediaType();
+ const GUID& subtype = mt.subtype;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ //if(GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 || subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ //|| GetSpeakerConfig(dts) < 0 && (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS))
+ //{
+ // *pmt = CreateMediaTypeSPDIF();
+ //}
+ //else if(subtype == MEDIASUBTYPE_Vorbis2)
+ //{
+ // *pmt = CreateMediaType(GetSampleFormat(), m_vorbis.vi.rate, m_vorbis.vi.channels);
+ //}
+ //else
+ //{
+ *pmt = CreateMediaType(GetSampleFormat(), wfe->nSamplesPerSec, min(2, wfe->nChannels));
+ //}
+
+ return S_OK;
}
-HRESULT CMPCAudioDecFilter::SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt)
+HRESULT CMPCAudioDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt)
{
- return __super::SetMediaType(direction, pmt);
+ return __super::SetMediaType(direction, pmt);
}
HRESULT CMPCAudioDecFilter::CompleteConnect(PIN_DIRECTION direction, IPin* pReceivePin)
{
- int nNewCodec;
-
- if(direction == PINDIR_OUTPUT)
- {
- CMediaType& mt = m_pInput->CurrentMediaType();
- nNewCodec = FindCodec(&mt);
- if((direction == PINDIR_OUTPUT) && (nNewCodec != -1) && (nNewCodec != m_nCodecNb))
- {
- WAVEFORMATEX* wfex = (WAVEFORMATEX*) mt.pbFormat;
- Cleanup();
-
- m_nCodecNb = nNewCodec;
- m_pInput->CurrentMediaType();
-
- m_pAVCodec = avcodec_find_decoder(ffCodecs[nNewCodec].nFFCodec);
- CheckPointer(m_pAVCodec, VFW_E_UNSUPPORTED_AUDIO);
-
- m_pAVCtx = avcodec_alloc_context();
- CheckPointer(m_pAVCtx, E_POINTER);
-
- m_pAVCtx->sample_rate = wfex->nSamplesPerSec;
- m_pAVCtx->channels = wfex->nChannels;
-
- m_pAVCtx->bit_rate = wfex->nAvgBytesPerSec * 8;
- m_pAVCtx->bits_per_coded_sample = wfex->wBitsPerSample;
- m_pAVCtx->block_align = wfex->nBlockAlign;
-
- /*
- if (codecId==CODEC_ID_FLAC && extradata.size>=4 && *(FOURCC*)extradata.data==mmioFOURCC('f','L','a','C')) // HACK
- {
- avctx->extradata=extradata.data+8;
- avctx->extradata_size=34;
- }
- else if (codecId==CODEC_ID_COOK && mt.formattype==FORMAT_WaveFormatEx && mt.pbFormat)
- {
- avctx->extradata=mt.pbFormat+sizeof(WAVEFORMATEX);
- avctx->extradata_size=mt.cbFormat-sizeof(WAVEFORMATEX);
- for (;avctx->extradata_size;avctx->extradata=(uint8_t*)avctx->extradata+1,avctx->extradata_size--)
- if (memcmp(avctx->extradata,"cook",4)==0)
- {
- avctx->extradata=(uint8_t*)avctx->extradata+12;
- avctx->extradata_size-=12;
- break;
- }
- }
- else
- {
- avctx->extradata=extradata.data;
- avctx->extradata_size=(int)extradata.size;
- }
- if (codecId==CODEC_ID_VORBIS && mt.formattype==FORMAT_VorbisFormat2)
- {
- const VORBISFORMAT2 *vf2=(const VORBISFORMAT2*)mt.pbFormat;
- avctx->vorbis_header_size[0]=vf2->HeaderSize[0];
- avctx->vorbis_header_size[1]=vf2->HeaderSize[1];
- avctx->vorbis_header_size[2]=vf2->HeaderSize[2];
- }
- if (libavcodec->avcodec_open(avctx,avcodec)<0) return false;
- codecinited=true;
- switch (avctx->sample_fmt)
- {
- case SAMPLE_FMT_S16:fmt.sf=TsampleFormat::SF_PCM16;break;
- case SAMPLE_FMT_FLT:fmt.sf=TsampleFormat::SF_FLOAT32;break;
- }
- */
-
- if(avcodec_open(m_pAVCtx, m_pAVCodec) < 0)
- return VFW_E_INVALIDMEDIATYPE;
- }
- }
-
- return __super::CompleteConnect(direction, pReceivePin);
+ int nNewCodec;
+
+ if (direction == PINDIR_OUTPUT)
+ {
+ CMediaType& mt = m_pInput->CurrentMediaType();
+ nNewCodec = FindCodec(&mt);
+ if ((direction == PINDIR_OUTPUT) && (nNewCodec != -1) && (nNewCodec != m_nCodecNb))
+ {
+ WAVEFORMATEX* wfex = (WAVEFORMATEX*) mt.pbFormat;
+ Cleanup();
+
+ m_nCodecNb = nNewCodec;
+ m_pInput->CurrentMediaType();
+
+ m_pAVCodec = avcodec_find_decoder(ffCodecs[nNewCodec].nFFCodec);
+ CheckPointer (m_pAVCodec, VFW_E_UNSUPPORTED_AUDIO);
+
+ m_pAVCtx = avcodec_alloc_context();
+ CheckPointer (m_pAVCtx, E_POINTER);
+
+ m_pAVCtx->sample_rate = wfex->nSamplesPerSec;
+ m_pAVCtx->channels = wfex->nChannels;
+
+ m_pAVCtx->bit_rate = wfex->nAvgBytesPerSec*8;
+ m_pAVCtx->bits_per_coded_sample = wfex->wBitsPerSample;
+ m_pAVCtx->block_align = wfex->nBlockAlign;
+
+ /*
+ if (codecId==CODEC_ID_FLAC && extradata.size>=4 && *(FOURCC*)extradata.data==mmioFOURCC('f','L','a','C')) // HACK
+ {
+ avctx->extradata=extradata.data+8;
+ avctx->extradata_size=34;
+ }
+ else if (codecId==CODEC_ID_COOK && mt.formattype==FORMAT_WaveFormatEx && mt.pbFormat)
+ {
+ avctx->extradata=mt.pbFormat+sizeof(WAVEFORMATEX);
+ avctx->extradata_size=mt.cbFormat-sizeof(WAVEFORMATEX);
+ for (;avctx->extradata_size;avctx->extradata=(uint8_t*)avctx->extradata+1,avctx->extradata_size--)
+ if (memcmp(avctx->extradata,"cook",4)==0)
+ {
+ avctx->extradata=(uint8_t*)avctx->extradata+12;
+ avctx->extradata_size-=12;
+ break;
+ }
+ }
+ else
+ {
+ avctx->extradata=extradata.data;
+ avctx->extradata_size=(int)extradata.size;
+ }
+ if (codecId==CODEC_ID_VORBIS && mt.formattype==FORMAT_VorbisFormat2)
+ {
+ const VORBISFORMAT2 *vf2=(const VORBISFORMAT2*)mt.pbFormat;
+ avctx->vorbis_header_size[0]=vf2->HeaderSize[0];
+ avctx->vorbis_header_size[1]=vf2->HeaderSize[1];
+ avctx->vorbis_header_size[2]=vf2->HeaderSize[2];
+ }
+ if (libavcodec->avcodec_open(avctx,avcodec)<0) return false;
+ codecinited=true;
+ switch (avctx->sample_fmt)
+ {
+ case SAMPLE_FMT_S16:fmt.sf=TsampleFormat::SF_PCM16;break;
+ case SAMPLE_FMT_FLT:fmt.sf=TsampleFormat::SF_FLOAT32;break;
+ }
+ */
+
+ if (avcodec_open(m_pAVCtx, m_pAVCodec)<0)
+ return VFW_E_INVALIDMEDIATYPE;
+ }
+ }
+
+ return __super::CompleteConnect (direction, pReceivePin);
}
HRESULT CMPCAudioDecFilter::Transform(IMediaSample* pIn)
{
- HRESULT hr = S_OK;
- //BYTE* pDataIn = NULL;
- //UINT nSize;
- //int got_picture;
- //REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
+ HRESULT hr = S_OK;
+ //BYTE* pDataIn = NULL;
+ //UINT nSize;
+ //int got_picture;
+ //REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
- //if(FAILED(hr = pIn->GetPointer(&pDataIn)))
- // return hr;
+ //if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ // return hr;
- //nSize = pIn->GetActualDataLength();
- //hr = pIn->GetTime(&rtStart, &rtStop);
+ //nSize = pIn->GetActualDataLength();
+ //hr = pIn->GetTime(&rtStart, &rtStop);
- ////FILE* File = fopen ("e:\\temp\\h264.bin", "wb");
- ////fwrite (pDataIn, nSize, 1, File);
- ////fclose (File);
+ ////FILE* File = fopen ("e:\\temp\\h264.bin", "wb");
+ ////fwrite (pDataIn, nSize, 1, File);
+ ////fclose (File);
- //int used_bytes;
+ //int used_bytes;
- //m_pAVCtx->parserRtStart=&rtStart;
- //
- //while (nSize > 0)
- //{
- // used_bytes = avcodec_decode_video (m_pAVCtx, m_pFrame, &got_picture, pDataIn, nSize);
- // if (!got_picture || !m_pFrame->data[0]) return S_FALSE;
+ //m_pAVCtx->parserRtStart=&rtStart;
+ //
+ //while (nSize > 0)
+ //{
+ // used_bytes = avcodec_decode_video (m_pAVCtx, m_pFrame, &got_picture, pDataIn, nSize);
+ // if (!got_picture || !m_pFrame->data[0]) return S_FALSE;
- // if(pIn->IsPreroll() == S_OK || rtStart < 0)
- // return S_OK;
+ // if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ // return S_OK;
- // CComPtr<IMediaSample> pOut;
- // BYTE* pDataOut = NULL;
- // if(FAILED(hr = GetDeliveryBuffer(m_pAVCtx->width, m_pAVCtx->height, &pOut)) || FAILED(hr = pOut->GetPointer(&pDataOut)))
- // return hr;
+ // CComPtr<IMediaSample> pOut;
+ // BYTE* pDataOut = NULL;
+ // if(FAILED(hr = GetDeliveryBuffer(m_pAVCtx->width, m_pAVCtx->height, &pOut)) || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ // return hr;
- // TRACE ("CMPCAudioDecFilter::Transform %I64d - %I64d\n", rtStart, rtStop);
+ // TRACE ("CMPCAudioDecFilter::Transform %I64d - %I64d\n", rtStart, rtStop);
- // //rtStart = m_pFrame->rtStart;
- // //rtStop = m_pFrame->rtStart + 1;
+ // //rtStart = m_pFrame->rtStart;
+ // //rtStop = m_pFrame->rtStart + 1;
- // pOut->SetTime(&rtStart, &rtStop);
- // pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
+ // pOut->SetTime(&rtStart, &rtStop);
+ // pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
- // CopyBuffer(pDataOut, m_pFrame->data, m_pAVCtx->width, m_pAVCtx->height, m_pFrame->linesize[0], MEDIASUBTYPE_I420, false);
+ // CopyBuffer(pDataOut, m_pFrame->data, m_pAVCtx->width, m_pAVCtx->height, m_pFrame->linesize[0], MEDIASUBTYPE_I420, false);
- // hr = m_pOutput->Deliver(pOut);
+ // hr = m_pOutput->Deliver(pOut);
- // nSize -= used_bytes;
- // pDataIn += used_bytes;
- //}
+ // nSize -= used_bytes;
+ // pDataIn += used_bytes;
+ //}
- return hr;
+ return hr;
}
int CMPCAudioDecFilter::FindCodec(const CMediaType* mtIn)
{
- for(int i = 0; i < countof(ffCodecs); i++)
- if(mtIn->subtype == *ffCodecs[i].clsMinorType)
- return i;
+ for (int i=0; i<countof(ffCodecs); i++)
+ if (mtIn->subtype == *ffCodecs[i].clsMinorType)
+ return i;
- return -1;
+ return -1;
}
STDMETHODIMP_(SampleFormat) CMPCAudioDecFilter::GetSampleFormat()
{
// CAutoLock cAutoLock(&m_csProps);
- return m_iSampleFormat;
+ return m_iSampleFormat;
}
CMediaType CMPCAudioDecFilter::CreateMediaType(SampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask)
{
- CMediaType mt;
-
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = sf == SAMPLE_FMT_FLT ? MEDIASUBTYPE_IEEE_FLOAT : MEDIASUBTYPE_PCM;
- mt.formattype = FORMAT_WaveFormatEx;
-
- WAVEFORMATEXTENSIBLE wfex;
- memset(&wfex, 0, sizeof(wfex));
- WAVEFORMATEX* wfe = &wfex.Format;
- wfe->wFormatTag = (WORD)mt.subtype.Data1;
- wfe->nChannels = nChannels;
- wfe->nSamplesPerSec = nSamplesPerSec;
- switch(sf)
- {
- default:
- case SAMPLE_FMT_S16:
- wfe->wBitsPerSample = 16;
- break;
- case SAMPLE_FMT_S32:
- case SAMPLE_FMT_FLT:
- wfe->wBitsPerSample = 32;
- break;
- }
- wfe->nBlockAlign = wfe->nChannels * wfe->wBitsPerSample / 8;
- wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
-
- // FIXME: 32 bit only seems to work with WAVE_FORMAT_EXTENSIBLE
- if(dwChannelMask == 0 && (sf == SAMPLE_FMT_S32))
- dwChannelMask = nChannels == 2 ? (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) : SPEAKER_FRONT_CENTER;
-
- if(dwChannelMask)
- {
- wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- wfex.Format.cbSize = sizeof(wfex) - sizeof(wfex.Format);
- wfex.dwChannelMask = dwChannelMask;
- wfex.Samples.wValidBitsPerSample = wfex.Format.wBitsPerSample;
- wfex.SubFormat = mt.subtype;
- }
-
- mt.SetFormat((BYTE*)&wfex, sizeof(wfex.Format) + wfex.Format.cbSize);
-
- return mt;
+ CMediaType mt;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = sf == SAMPLE_FMT_FLT ? MEDIASUBTYPE_IEEE_FLOAT : MEDIASUBTYPE_PCM;
+ mt.formattype = FORMAT_WaveFormatEx;
+
+ WAVEFORMATEXTENSIBLE wfex;
+ memset(&wfex, 0, sizeof(wfex));
+ WAVEFORMATEX* wfe = &wfex.Format;
+ wfe->wFormatTag = (WORD)mt.subtype.Data1;
+ wfe->nChannels = nChannels;
+ wfe->nSamplesPerSec = nSamplesPerSec;
+ switch(sf)
+ {
+ default:
+ case SAMPLE_FMT_S16: wfe->wBitsPerSample = 16; break;
+ case SAMPLE_FMT_S32: case SAMPLE_FMT_FLT: wfe->wBitsPerSample = 32; break;
+ }
+ wfe->nBlockAlign = wfe->nChannels*wfe->wBitsPerSample/8;
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec*wfe->nBlockAlign;
+
+ // FIXME: 32 bit only seems to work with WAVE_FORMAT_EXTENSIBLE
+ if(dwChannelMask == 0 && (sf == SAMPLE_FMT_S32))
+ dwChannelMask = nChannels == 2 ? (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT) : SPEAKER_FRONT_CENTER;
+
+ if(dwChannelMask)
+ {
+ wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfex.Format.cbSize = sizeof(wfex) - sizeof(wfex.Format);
+ wfex.dwChannelMask = dwChannelMask;
+ wfex.Samples.wValidBitsPerSample = wfex.Format.wBitsPerSample;
+ wfex.SubFormat = mt.subtype;
+ }
+
+ mt.SetFormat((BYTE*)&wfex, sizeof(wfex.Format) + wfex.Format.cbSize);
+
+ return mt;
}
diff --git a/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.h b/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.h
index f26586332..8bbda59ad 100644
--- a/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.h
+++ b/src/filters/transform/MPCVideoDec/MPCAudioDecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2007 see AUTHORS
@@ -26,46 +26,46 @@ enum SampleFormat;
[uuid("BF67339B-465E-4c5a-AE2D-DC4EE17EA272")]
class CMPCAudioDecFilter
- : public CTransformFilter
+ : public CTransformFilter
{
public:
- const static AMOVIESETUP_MEDIATYPE sudPinTypesIn[];
- const static int sudPinTypesInCount;
- const static AMOVIESETUP_MEDIATYPE sudPinTypesOut[];
- const static int sudPinTypesOutCount;
+ const static AMOVIESETUP_MEDIATYPE sudPinTypesIn[];
+ const static int sudPinTypesInCount;
+ const static AMOVIESETUP_MEDIATYPE sudPinTypesOut[];
+ const static int sudPinTypesOutCount;
- CMPCAudioDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CMPCAudioDecFilter();
+ CMPCAudioDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CMPCAudioDecFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT Transform(IMediaSample* pIn);
+ HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT Transform(IMediaSample* pIn);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
// HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT CMPCAudioDecFilter::CompleteConnect(PIN_DIRECTION direction, IPin* pReceivePin);
+ HRESULT CMPCAudioDecFilter::CompleteConnect(PIN_DIRECTION direction, IPin* pReceivePin);
- STDMETHODIMP_(SampleFormat) GetSampleFormat();
- CMediaType CreateMediaType(SampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
+ STDMETHODIMP_(SampleFormat) GetSampleFormat();
+ CMediaType CreateMediaType(SampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
protected :
- SampleFormat m_iSampleFormat;
+ SampleFormat m_iSampleFormat;
- AVCodec* m_pAVCodec;
- AVCodecContext* m_pAVCtx;
- AVFrame* m_pFrame;
- int m_nCodecNb;
+ AVCodec* m_pAVCodec;
+ AVCodecContext* m_pAVCtx;
+ AVFrame* m_pFrame;
+ int m_nCodecNb;
- int FindCodec(const CMediaType* mtIn);
- void Cleanup();
+ int FindCodec(const CMediaType* mtIn);
+ void Cleanup();
- static void LogLibAVCodec(void* par, int level, const char *fmt, va_list valist);
+ static void LogLibAVCodec(void* par,int level,const char *fmt,va_list valist);
};
diff --git a/src/filters/transform/MPCVideoDec/MPCFfmpegDec.cpp b/src/filters/transform/MPCVideoDec/MPCFfmpegDec.cpp
index 68db6cc82..838ab5b0e 100644
--- a/src/filters/transform/MPCVideoDec/MPCFfmpegDec.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCFfmpegDec.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -34,34 +34,34 @@
// Workaround: graphedit crashes when a filter exposes more than 115 input MediaTypes!
const AMOVIESETUP_PIN sudpPinsVideoDec[] =
{
- {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, CMPCVideoDecFilter::sudPinTypesInCount > 115 ? 115 : CMPCVideoDecFilter::sudPinTypesInCount, CMPCVideoDecFilter::sudPinTypesIn},
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, CMPCVideoDecFilter::sudPinTypesInCount > 115 ? 115 : CMPCVideoDecFilter::sudPinTypesInCount, CMPCVideoDecFilter::sudPinTypesIn},
{L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, CMPCVideoDecFilter::sudPinTypesOutCount, CMPCVideoDecFilter::sudPinTypesOut}
};
const AMOVIESETUP_FILTER sudFilters[] =
{
- {&__uuidof(CMPCVideoDecFilter), L"MPC - Video decoder", /*MERIT_DO_NOT_USE*/0x40000001, countof(sudpPinsVideoDec), sudpPinsVideoDec, CLSID_LegacyAmFilterCategory}
+ {&__uuidof(CMPCVideoDecFilter), L"MPC - Video decoder", /*MERIT_DO_NOT_USE*/0x40000001, countof(sudpPinsVideoDec), sudpPinsVideoDec, CLSID_LegacyAmFilterCategory}
};
CFactoryTemplate g_Templates[] =
{
{sudFilters[0].strName, &__uuidof(CMPCVideoDecFilter), CreateInstance<CMPCVideoDecFilter>, NULL, &sudFilters[0]},
- {L"CMPCVideoDecPropertyPage", &__uuidof(CMPCVideoDecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMPCVideoDecSettingsWnd> >},
- {L"CMPCVideoDecPropertyPage2", &__uuidof(CMPCVideoDecCodecWnd), CreateInstance<CInternalPropertyPageTempl<CMPCVideoDecCodecWnd> >},
+ {L"CMPCVideoDecPropertyPage", &__uuidof(CMPCVideoDecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMPCVideoDecSettingsWnd> >},
+ {L"CMPCVideoDecPropertyPage2", &__uuidof(CMPCVideoDecCodecWnd), CreateInstance<CInternalPropertyPageTempl<CMPCVideoDecCodecWnd> >},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
//
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
index e9c2bcbf2..d87a0f92a 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -35,10 +35,10 @@
extern "C"
{
-#include "FfmpegContext.h"
-#include "libswscale/swscale.h"
+ #include "FfmpegContext.h"
+ #include "libswscale/swscale.h"
- extern void init_libvo();
+ extern void init_libvo();
}
#include "../../../DSUtil/DSUtil.h"
@@ -60,40 +60,39 @@ extern "C"
typedef struct
{
- const int PicEntryNumber;
- const UINT PreferedConfigBitstream;
- const GUID* Decoder[MAX_SUPPORTED_MODE];
- const WORD RestrictedMode[MAX_SUPPORTED_MODE];
+ const int PicEntryNumber;
+ const UINT PreferedConfigBitstream;
+ const GUID* Decoder[MAX_SUPPORTED_MODE];
+ const WORD RestrictedMode[MAX_SUPPORTED_MODE];
} DXVA_PARAMS;
typedef struct
{
- const CLSID* clsMinorType;
- const enum CodecID nFFCodec;
- const int fourcc;
- const DXVA_PARAMS* DXVAModes;
-
- int DXVAModeCount()
- {
- if(!DXVAModes) return 0;
- for(int i = 0; i < MAX_SUPPORTED_MODE; i++)
- {
- if(DXVAModes->Decoder[i] == &GUID_NULL) return i;
- }
- return MAX_SUPPORTED_MODE;
- }
+ const CLSID* clsMinorType;
+ const enum CodecID nFFCodec;
+ const int fourcc;
+ const DXVA_PARAMS* DXVAModes;
+
+ int DXVAModeCount()
+ {
+ if (!DXVAModes) return 0;
+ for (int i=0; i<MAX_SUPPORTED_MODE; i++)
+ {
+ if (DXVAModes->Decoder[i] == &GUID_NULL) return i;
+ }
+ return MAX_SUPPORTED_MODE;
+ }
} FFMPEG_CODECS;
typedef enum
{
- ffYCbCr_RGB_coeff_ITUR_BT601 = 0,
- ffYCbCr_RGB_coeff_ITUR_BT709 = 1,
- ffYCbCr_RGB_coeff_SMPTE240M = 2,
+ ffYCbCr_RGB_coeff_ITUR_BT601 = 0,
+ ffYCbCr_RGB_coeff_ITUR_BT709 = 1,
+ ffYCbCr_RGB_coeff_SMPTE240M = 2,
} ffYCbCr_RGB_MatrixCoefficientsType;
-struct TYCbCr2RGB_coeffs
-{
+struct TYCbCr2RGB_coeffs {
double Kr;
double Kg;
double Kb;
@@ -114,34 +113,29 @@ struct TYCbCr2RGB_coeffs
double cspOptionsRGB_WhiteLevel,
double cspOptionsRGB_BlackLevel)
{
- if(cspOptionsIturBt == ffYCbCr_RGB_coeff_ITUR_BT601)
- {
- Kr = 0.299;
- Kg = 0.587;
- Kb = 0.114;
- }
- else if(cspOptionsIturBt == ffYCbCr_RGB_coeff_SMPTE240M)
- {
- Kr = 0.2122;
- Kg = 0.7013;
- Kb = 0.0865;
- }
- else
- {
- Kr = 0.2125;
- Kg = 0.7154;
- Kb = 0.0721;
+ if (cspOptionsIturBt == ffYCbCr_RGB_coeff_ITUR_BT601) {
+ Kr = 0.299;
+ Kg = 0.587;
+ Kb = 0.114;
+ } else if (cspOptionsIturBt == ffYCbCr_RGB_coeff_SMPTE240M) {
+ Kr = 0.2122;
+ Kg = 0.7013;
+ Kb = 0.0865;
+ } else {
+ Kr = 0.2125;
+ Kg = 0.7154;
+ Kb = 0.0721;
}
double in_y_range = cspOptionsWhiteCutoff - cspOptionsBlackCutoff;
chr_range = 128 - cspOptionsChromaCutoff;
double cspOptionsRGBrange = cspOptionsRGB_WhiteLevel - cspOptionsRGB_BlackLevel;
- y_mul = cspOptionsRGBrange / in_y_range;
- vr_mul = (cspOptionsRGBrange / chr_range) * (1.0 - Kr);
- ug_mul = (cspOptionsRGBrange / chr_range) * (1.0 - Kb) * Kb / Kg;
- vg_mul = (cspOptionsRGBrange / chr_range) * (1.0 - Kr) * Kr / Kg;
- ub_mul = (cspOptionsRGBrange / chr_range) * (1.0 - Kb);
+ y_mul =cspOptionsRGBrange / in_y_range;
+ vr_mul=(cspOptionsRGBrange / chr_range) * (1.0 - Kr);
+ ug_mul=(cspOptionsRGBrange / chr_range) * (1.0 - Kb) * Kb / Kg;
+ vg_mul=(cspOptionsRGBrange / chr_range) * (1.0 - Kr) * Kr / Kg;
+ ub_mul=(cspOptionsRGBrange / chr_range) * (1.0 - Kb);
int sub = min((int)cspOptionsRGB_BlackLevel, cspOptionsBlackCutoff);
Ysub = cspOptionsBlackCutoff - sub;
RGB_add1 = (int)cspOptionsRGB_BlackLevel - sub;
@@ -153,206 +147,206 @@ struct TYCbCr2RGB_coeffs
// DXVA modes supported for Mpeg2
DXVA_PARAMS DXVA_Mpeg2 =
{
- 9, // PicEntryNumber
- 1, // PreferedConfigBitstream
- { &DXVA2_ModeMPEG2_VLD, &GUID_NULL },
- { DXVA_RESTRICTED_MODE_UNRESTRICTED, 0 } // Restricted mode for DXVA1?
+ 9, // PicEntryNumber
+ 1, // PreferedConfigBitstream
+ { &DXVA2_ModeMPEG2_VLD, &GUID_NULL },
+ { DXVA_RESTRICTED_MODE_UNRESTRICTED, 0 } // Restricted mode for DXVA1?
};
// DXVA modes supported for H264
DXVA_PARAMS DXVA_H264 =
{
- 16, // PicEntryNumber
- 2, // PreferedConfigBitstream
- { &DXVA2_ModeH264_E, &DXVA2_ModeH264_F, &DXVA_Intel_H264_ClearVideo, &GUID_NULL },
- { DXVA_RESTRICTED_MODE_H264_E, 0}
+ 16, // PicEntryNumber
+ 2, // PreferedConfigBitstream
+ { &DXVA2_ModeH264_E, &DXVA2_ModeH264_F, &DXVA_Intel_H264_ClearVideo, &GUID_NULL },
+ { DXVA_RESTRICTED_MODE_H264_E, 0}
};
DXVA_PARAMS DXVA_H264_VISTA =
{
- 22, // PicEntryNumber
- 2, // PreferedConfigBitstream
- { &DXVA2_ModeH264_E, &DXVA2_ModeH264_F, &DXVA_Intel_H264_ClearVideo, &GUID_NULL },
- { DXVA_RESTRICTED_MODE_H264_E, 0}
+ 22, // PicEntryNumber
+ 2, // PreferedConfigBitstream
+ { &DXVA2_ModeH264_E, &DXVA2_ModeH264_F, &DXVA_Intel_H264_ClearVideo, &GUID_NULL },
+ { DXVA_RESTRICTED_MODE_H264_E, 0}
};
// DXVA modes supported for VC1
DXVA_PARAMS DXVA_VC1 =
{
- 14, // PicEntryNumber
- 1, // PreferedConfigBitstream
- { &DXVA2_ModeVC1_D, &GUID_NULL },
- { DXVA_RESTRICTED_MODE_VC1_D, 0}
+ 14, // PicEntryNumber
+ 1, // PreferedConfigBitstream
+ { &DXVA2_ModeVC1_D, &GUID_NULL },
+ { DXVA_RESTRICTED_MODE_VC1_D, 0}
};
FFMPEG_CODECS ffCodecs[] =
{
#if INCLUDE_MPC_VIDEO_DECODER
- // Flash video
- { &MEDIASUBTYPE_FLV1, CODEC_ID_FLV1, MAKEFOURCC('F', 'L', 'V', '1'), NULL },
- { &MEDIASUBTYPE_flv1, CODEC_ID_FLV1, MAKEFOURCC('f', 'l', 'v', '1'), NULL },
- { &MEDIASUBTYPE_FLV4, CODEC_ID_VP6F, MAKEFOURCC('F', 'L', 'V', '4'), NULL },
- { &MEDIASUBTYPE_flv4, CODEC_ID_VP6F, MAKEFOURCC('f', 'l', 'v', '4'), NULL },
- { &MEDIASUBTYPE_VP6F, CODEC_ID_VP6F, MAKEFOURCC('V', 'P', '6', 'F'), NULL },
- { &MEDIASUBTYPE_vp6f, CODEC_ID_VP6F, MAKEFOURCC('v', 'p', '6', 'f'), NULL },
-
- // VP5
- { &MEDIASUBTYPE_VP50, CODEC_ID_VP5, MAKEFOURCC('V', 'P', '5', '0'), NULL },
- { &MEDIASUBTYPE_vp50, CODEC_ID_VP5, MAKEFOURCC('v', 'p', '5', '0'), NULL },
-
- // VP6
- { &MEDIASUBTYPE_VP60, CODEC_ID_VP6, MAKEFOURCC('V', 'P', '6', '0'), NULL },
- { &MEDIASUBTYPE_vp60, CODEC_ID_VP6, MAKEFOURCC('v', 'p', '6', '0'), NULL },
- { &MEDIASUBTYPE_VP61, CODEC_ID_VP6, MAKEFOURCC('V', 'P', '6', '1'), NULL },
- { &MEDIASUBTYPE_vp61, CODEC_ID_VP6, MAKEFOURCC('v', 'p', '6', '1'), NULL },
- { &MEDIASUBTYPE_VP62, CODEC_ID_VP6, MAKEFOURCC('V', 'P', '6', '2'), NULL },
- { &MEDIASUBTYPE_vp62, CODEC_ID_VP6, MAKEFOURCC('v', 'p', '6', '2'), NULL },
- { &MEDIASUBTYPE_VP6A, CODEC_ID_VP6A, MAKEFOURCC('V', 'P', '6', 'A'), NULL },
- { &MEDIASUBTYPE_vp6a, CODEC_ID_VP6A, MAKEFOURCC('v', 'p', '6', 'a'), NULL },
-
- // Xvid
- { &MEDIASUBTYPE_XVID, CODEC_ID_MPEG4, MAKEFOURCC('X', 'V', 'I', 'D'), NULL },
- { &MEDIASUBTYPE_xvid, CODEC_ID_MPEG4, MAKEFOURCC('x', 'v', 'i', 'd'), NULL },
- { &MEDIASUBTYPE_XVIX, CODEC_ID_MPEG4, MAKEFOURCC('X', 'V', 'I', 'X'), NULL },
- { &MEDIASUBTYPE_xvix, CODEC_ID_MPEG4, MAKEFOURCC('x', 'v', 'i', 'x'), NULL },
-
- // DivX
- { &MEDIASUBTYPE_DX50, CODEC_ID_MPEG4, MAKEFOURCC('D', 'X', '5', '0'), NULL },
- { &MEDIASUBTYPE_dx50, CODEC_ID_MPEG4, MAKEFOURCC('d', 'x', '5', '0'), NULL },
- { &MEDIASUBTYPE_DIVX, CODEC_ID_MPEG4, MAKEFOURCC('D', 'I', 'V', 'X'), NULL },
- { &MEDIASUBTYPE_divx, CODEC_ID_MPEG4, MAKEFOURCC('d', 'i', 'v', 'x'), NULL },
-
- // WMV1/2/3
- { &MEDIASUBTYPE_WMV1, CODEC_ID_WMV1, MAKEFOURCC('W', 'M', 'V', '1'), NULL },
- { &MEDIASUBTYPE_wmv1, CODEC_ID_WMV1, MAKEFOURCC('w', 'm', 'v', '1'), NULL },
- { &MEDIASUBTYPE_WMV2, CODEC_ID_WMV2, MAKEFOURCC('W', 'M', 'V', '2'), NULL },
- { &MEDIASUBTYPE_wmv2, CODEC_ID_WMV2, MAKEFOURCC('w', 'm', 'v', '2'), NULL },
- { &MEDIASUBTYPE_WMV3, CODEC_ID_WMV3, MAKEFOURCC('W', 'M', 'V', '3'), NULL },
- { &MEDIASUBTYPE_wmv3, CODEC_ID_WMV3, MAKEFOURCC('w', 'm', 'v', '3'), NULL },
-
- // Mpeg 2
- { &MEDIASUBTYPE_MPEG2_VIDEO, CODEC_ID_MPEG2VIDEO, MAKEFOURCC('M', 'P', 'G', '2'), &DXVA_Mpeg2 },
-
- // MSMPEG-4
- { &MEDIASUBTYPE_DIV3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D', 'I', 'V', '3'), NULL },
- { &MEDIASUBTYPE_div3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d', 'i', 'v', '3'), NULL },
- { &MEDIASUBTYPE_DVX3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D', 'V', 'X', '3'), NULL },
- { &MEDIASUBTYPE_dvx3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d', 'v', 'x', '3'), NULL },
- { &MEDIASUBTYPE_MP43, CODEC_ID_MSMPEG4V3, MAKEFOURCC('M', 'P', '4', '3'), NULL },
- { &MEDIASUBTYPE_mp43, CODEC_ID_MSMPEG4V3, MAKEFOURCC('m', 'p', '4', '3'), NULL },
- { &MEDIASUBTYPE_COL1, CODEC_ID_MSMPEG4V3, MAKEFOURCC('C', 'O', 'L', '1'), NULL },
- { &MEDIASUBTYPE_col1, CODEC_ID_MSMPEG4V3, MAKEFOURCC('c', 'o', 'l', '1'), NULL },
- { &MEDIASUBTYPE_DIV4, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D', 'I', 'V', '4'), NULL },
- { &MEDIASUBTYPE_div4, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d', 'i', 'v', '4'), NULL },
- { &MEDIASUBTYPE_DIV5, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D', 'I', 'V', '5'), NULL },
- { &MEDIASUBTYPE_div5, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d', 'i', 'v', '5'), NULL },
- { &MEDIASUBTYPE_DIV6, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D', 'I', 'V', '6'), NULL },
- { &MEDIASUBTYPE_div6, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d', 'i', 'v', '6'), NULL },
- { &MEDIASUBTYPE_AP41, CODEC_ID_MSMPEG4V3, MAKEFOURCC('A', 'P', '4', '1'), NULL },
- { &MEDIASUBTYPE_ap41, CODEC_ID_MSMPEG4V3, MAKEFOURCC('a', 'p', '4', '1'), NULL },
- { &MEDIASUBTYPE_MPG3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('M', 'P', 'G', '3'), NULL },
- { &MEDIASUBTYPE_mpg3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('m', 'p', 'g', '3'), NULL },
- { &MEDIASUBTYPE_DIV2, CODEC_ID_MSMPEG4V2, MAKEFOURCC('D', 'I', 'V', '2'), NULL },
- { &MEDIASUBTYPE_div2, CODEC_ID_MSMPEG4V2, MAKEFOURCC('d', 'i', 'v', '2'), NULL },
- { &MEDIASUBTYPE_MP42, CODEC_ID_MSMPEG4V2, MAKEFOURCC('M', 'P', '4', '2'), NULL },
- { &MEDIASUBTYPE_mp42, CODEC_ID_MSMPEG4V2, MAKEFOURCC('m', 'p', '4', '2'), NULL },
- { &MEDIASUBTYPE_MPG4, CODEC_ID_MSMPEG4V1, MAKEFOURCC('M', 'P', 'G', '4'), NULL },
- { &MEDIASUBTYPE_mpg4, CODEC_ID_MSMPEG4V1, MAKEFOURCC('m', 'p', 'g', '4'), NULL },
- { &MEDIASUBTYPE_DIV1, CODEC_ID_MSMPEG4V1, MAKEFOURCC('D', 'I', 'V', '1'), NULL },
- { &MEDIASUBTYPE_div1, CODEC_ID_MSMPEG4V1, MAKEFOURCC('d', 'i', 'v', '1'), NULL },
- { &MEDIASUBTYPE_MP41, CODEC_ID_MSMPEG4V1, MAKEFOURCC('M', 'P', '4', '1'), NULL },
- { &MEDIASUBTYPE_mp41, CODEC_ID_MSMPEG4V1, MAKEFOURCC('m', 'p', '4', '1'), NULL },
-
- // AMV Video
- { &MEDIASUBTYPE_AMVV, CODEC_ID_AMV, MAKEFOURCC('A', 'M', 'V', 'V'), NULL },
+ // Flash video
+ { &MEDIASUBTYPE_FLV1, CODEC_ID_FLV1, MAKEFOURCC('F','L','V','1'), NULL },
+ { &MEDIASUBTYPE_flv1, CODEC_ID_FLV1, MAKEFOURCC('f','l','v','1'), NULL },
+ { &MEDIASUBTYPE_FLV4, CODEC_ID_VP6F, MAKEFOURCC('F','L','V','4'), NULL },
+ { &MEDIASUBTYPE_flv4, CODEC_ID_VP6F, MAKEFOURCC('f','l','v','4'), NULL },
+ { &MEDIASUBTYPE_VP6F, CODEC_ID_VP6F, MAKEFOURCC('V','P','6','F'), NULL },
+ { &MEDIASUBTYPE_vp6f, CODEC_ID_VP6F, MAKEFOURCC('v','p','6','f'), NULL },
+
+ // VP5
+ { &MEDIASUBTYPE_VP50, CODEC_ID_VP5, MAKEFOURCC('V','P','5','0'), NULL },
+ { &MEDIASUBTYPE_vp50, CODEC_ID_VP5, MAKEFOURCC('v','p','5','0'), NULL },
+
+ // VP6
+ { &MEDIASUBTYPE_VP60, CODEC_ID_VP6, MAKEFOURCC('V','P','6','0'), NULL },
+ { &MEDIASUBTYPE_vp60, CODEC_ID_VP6, MAKEFOURCC('v','p','6','0'), NULL },
+ { &MEDIASUBTYPE_VP61, CODEC_ID_VP6, MAKEFOURCC('V','P','6','1'), NULL },
+ { &MEDIASUBTYPE_vp61, CODEC_ID_VP6, MAKEFOURCC('v','p','6','1'), NULL },
+ { &MEDIASUBTYPE_VP62, CODEC_ID_VP6, MAKEFOURCC('V','P','6','2'), NULL },
+ { &MEDIASUBTYPE_vp62, CODEC_ID_VP6, MAKEFOURCC('v','p','6','2'), NULL },
+ { &MEDIASUBTYPE_VP6A, CODEC_ID_VP6A, MAKEFOURCC('V','P','6','A'), NULL },
+ { &MEDIASUBTYPE_vp6a, CODEC_ID_VP6A, MAKEFOURCC('v','p','6','a'), NULL },
+
+ // Xvid
+ { &MEDIASUBTYPE_XVID, CODEC_ID_MPEG4, MAKEFOURCC('X','V','I','D'), NULL },
+ { &MEDIASUBTYPE_xvid, CODEC_ID_MPEG4, MAKEFOURCC('x','v','i','d'), NULL },
+ { &MEDIASUBTYPE_XVIX, CODEC_ID_MPEG4, MAKEFOURCC('X','V','I','X'), NULL },
+ { &MEDIASUBTYPE_xvix, CODEC_ID_MPEG4, MAKEFOURCC('x','v','i','x'), NULL },
+
+ // DivX
+ { &MEDIASUBTYPE_DX50, CODEC_ID_MPEG4, MAKEFOURCC('D','X','5','0'), NULL },
+ { &MEDIASUBTYPE_dx50, CODEC_ID_MPEG4, MAKEFOURCC('d','x','5','0'), NULL },
+ { &MEDIASUBTYPE_DIVX, CODEC_ID_MPEG4, MAKEFOURCC('D','I','V','X'), NULL },
+ { &MEDIASUBTYPE_divx, CODEC_ID_MPEG4, MAKEFOURCC('d','i','v','x'), NULL },
+
+ // WMV1/2/3
+ { &MEDIASUBTYPE_WMV1, CODEC_ID_WMV1, MAKEFOURCC('W','M','V','1'), NULL },
+ { &MEDIASUBTYPE_wmv1, CODEC_ID_WMV1, MAKEFOURCC('w','m','v','1'), NULL },
+ { &MEDIASUBTYPE_WMV2, CODEC_ID_WMV2, MAKEFOURCC('W','M','V','2'), NULL },
+ { &MEDIASUBTYPE_wmv2, CODEC_ID_WMV2, MAKEFOURCC('w','m','v','2'), NULL },
+ { &MEDIASUBTYPE_WMV3, CODEC_ID_WMV3, MAKEFOURCC('W','M','V','3'), NULL },
+ { &MEDIASUBTYPE_wmv3, CODEC_ID_WMV3, MAKEFOURCC('w','m','v','3'), NULL },
+
+ // Mpeg 2
+ { &MEDIASUBTYPE_MPEG2_VIDEO, CODEC_ID_MPEG2VIDEO, MAKEFOURCC('M','P','G','2'), &DXVA_Mpeg2 },
+
+ // MSMPEG-4
+ { &MEDIASUBTYPE_DIV3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D','I','V','3'), NULL },
+ { &MEDIASUBTYPE_div3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d','i','v','3'), NULL },
+ { &MEDIASUBTYPE_DVX3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D','V','X','3'), NULL },
+ { &MEDIASUBTYPE_dvx3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d','v','x','3'), NULL },
+ { &MEDIASUBTYPE_MP43, CODEC_ID_MSMPEG4V3, MAKEFOURCC('M','P','4','3'), NULL },
+ { &MEDIASUBTYPE_mp43, CODEC_ID_MSMPEG4V3, MAKEFOURCC('m','p','4','3'), NULL },
+ { &MEDIASUBTYPE_COL1, CODEC_ID_MSMPEG4V3, MAKEFOURCC('C','O','L','1'), NULL },
+ { &MEDIASUBTYPE_col1, CODEC_ID_MSMPEG4V3, MAKEFOURCC('c','o','l','1'), NULL },
+ { &MEDIASUBTYPE_DIV4, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D','I','V','4'), NULL },
+ { &MEDIASUBTYPE_div4, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d','i','v','4'), NULL },
+ { &MEDIASUBTYPE_DIV5, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D','I','V','5'), NULL },
+ { &MEDIASUBTYPE_div5, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d','i','v','5'), NULL },
+ { &MEDIASUBTYPE_DIV6, CODEC_ID_MSMPEG4V3, MAKEFOURCC('D','I','V','6'), NULL },
+ { &MEDIASUBTYPE_div6, CODEC_ID_MSMPEG4V3, MAKEFOURCC('d','i','v','6'), NULL },
+ { &MEDIASUBTYPE_AP41, CODEC_ID_MSMPEG4V3, MAKEFOURCC('A','P','4','1'), NULL },
+ { &MEDIASUBTYPE_ap41, CODEC_ID_MSMPEG4V3, MAKEFOURCC('a','p','4','1'), NULL },
+ { &MEDIASUBTYPE_MPG3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('M','P','G','3'), NULL },
+ { &MEDIASUBTYPE_mpg3, CODEC_ID_MSMPEG4V3, MAKEFOURCC('m','p','g','3'), NULL },
+ { &MEDIASUBTYPE_DIV2, CODEC_ID_MSMPEG4V2, MAKEFOURCC('D','I','V','2'), NULL },
+ { &MEDIASUBTYPE_div2, CODEC_ID_MSMPEG4V2, MAKEFOURCC('d','i','v','2'), NULL },
+ { &MEDIASUBTYPE_MP42, CODEC_ID_MSMPEG4V2, MAKEFOURCC('M','P','4','2'), NULL },
+ { &MEDIASUBTYPE_mp42, CODEC_ID_MSMPEG4V2, MAKEFOURCC('m','p','4','2'), NULL },
+ { &MEDIASUBTYPE_MPG4, CODEC_ID_MSMPEG4V1, MAKEFOURCC('M','P','G','4'), NULL },
+ { &MEDIASUBTYPE_mpg4, CODEC_ID_MSMPEG4V1, MAKEFOURCC('m','p','g','4'), NULL },
+ { &MEDIASUBTYPE_DIV1, CODEC_ID_MSMPEG4V1, MAKEFOURCC('D','I','V','1'), NULL },
+ { &MEDIASUBTYPE_div1, CODEC_ID_MSMPEG4V1, MAKEFOURCC('d','i','v','1'), NULL },
+ { &MEDIASUBTYPE_MP41, CODEC_ID_MSMPEG4V1, MAKEFOURCC('M','P','4','1'), NULL },
+ { &MEDIASUBTYPE_mp41, CODEC_ID_MSMPEG4V1, MAKEFOURCC('m','p','4','1'), NULL },
+
+ // AMV Video
+ { &MEDIASUBTYPE_AMVV, CODEC_ID_AMV, MAKEFOURCC('A','M','V','V'), NULL },
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- // H264/AVC
- { &MEDIASUBTYPE_H264, CODEC_ID_H264, MAKEFOURCC('H', '2', '6', '4'), &DXVA_H264 },
- { &MEDIASUBTYPE_h264, CODEC_ID_H264, MAKEFOURCC('h', '2', '6', '4'), &DXVA_H264 },
- { &MEDIASUBTYPE_X264, CODEC_ID_H264, MAKEFOURCC('X', '2', '6', '4'), &DXVA_H264 },
- { &MEDIASUBTYPE_x264, CODEC_ID_H264, MAKEFOURCC('x', '2', '6', '4'), &DXVA_H264 },
- { &MEDIASUBTYPE_VSSH, CODEC_ID_H264, MAKEFOURCC('V', 'S', 'S', 'H'), &DXVA_H264 },
- { &MEDIASUBTYPE_vssh, CODEC_ID_H264, MAKEFOURCC('v', 's', 's', 'h'), &DXVA_H264 },
- { &MEDIASUBTYPE_DAVC, CODEC_ID_H264, MAKEFOURCC('D', 'A', 'V', 'C'), &DXVA_H264 },
- { &MEDIASUBTYPE_davc, CODEC_ID_H264, MAKEFOURCC('d', 'a', 'v', 'c'), &DXVA_H264 },
- { &MEDIASUBTYPE_PAVC, CODEC_ID_H264, MAKEFOURCC('P', 'A', 'V', 'C'), &DXVA_H264 },
- { &MEDIASUBTYPE_pavc, CODEC_ID_H264, MAKEFOURCC('p', 'a', 'v', 'c'), &DXVA_H264 },
- { &MEDIASUBTYPE_AVC1, CODEC_ID_H264, MAKEFOURCC('A', 'V', 'C', '1'), &DXVA_H264 },
- { &MEDIASUBTYPE_avc1, CODEC_ID_H264, MAKEFOURCC('a', 'v', 'c', '1'), &DXVA_H264 },
- { &MEDIASUBTYPE_H264_bis, CODEC_ID_H264, MAKEFOURCC('a', 'v', 'c', '1'), &DXVA_H264 },
-
+ // H264/AVC
+ { &MEDIASUBTYPE_H264, CODEC_ID_H264, MAKEFOURCC('H','2','6','4'), &DXVA_H264 },
+ { &MEDIASUBTYPE_h264, CODEC_ID_H264, MAKEFOURCC('h','2','6','4'), &DXVA_H264 },
+ { &MEDIASUBTYPE_X264, CODEC_ID_H264, MAKEFOURCC('X','2','6','4'), &DXVA_H264 },
+ { &MEDIASUBTYPE_x264, CODEC_ID_H264, MAKEFOURCC('x','2','6','4'), &DXVA_H264 },
+ { &MEDIASUBTYPE_VSSH, CODEC_ID_H264, MAKEFOURCC('V','S','S','H'), &DXVA_H264 },
+ { &MEDIASUBTYPE_vssh, CODEC_ID_H264, MAKEFOURCC('v','s','s','h'), &DXVA_H264 },
+ { &MEDIASUBTYPE_DAVC, CODEC_ID_H264, MAKEFOURCC('D','A','V','C'), &DXVA_H264 },
+ { &MEDIASUBTYPE_davc, CODEC_ID_H264, MAKEFOURCC('d','a','v','c'), &DXVA_H264 },
+ { &MEDIASUBTYPE_PAVC, CODEC_ID_H264, MAKEFOURCC('P','A','V','C'), &DXVA_H264 },
+ { &MEDIASUBTYPE_pavc, CODEC_ID_H264, MAKEFOURCC('p','a','v','c'), &DXVA_H264 },
+ { &MEDIASUBTYPE_AVC1, CODEC_ID_H264, MAKEFOURCC('A','V','C','1'), &DXVA_H264 },
+ { &MEDIASUBTYPE_avc1, CODEC_ID_H264, MAKEFOURCC('a','v','c','1'), &DXVA_H264 },
+ { &MEDIASUBTYPE_H264_bis, CODEC_ID_H264, MAKEFOURCC('a','v','c','1'), &DXVA_H264 },
+
#if INCLUDE_MPC_VIDEO_DECODER
- // SVQ3
- { &MEDIASUBTYPE_SVQ3, CODEC_ID_SVQ3, MAKEFOURCC('S', 'V', 'Q', '3'), NULL },
+ // SVQ3
+ { &MEDIASUBTYPE_SVQ3, CODEC_ID_SVQ3, MAKEFOURCC('S','V','Q','3'), NULL },
- // SVQ1
- { &MEDIASUBTYPE_SVQ1, CODEC_ID_SVQ1, MAKEFOURCC('S', 'V', 'Q', '1'), NULL },
+ // SVQ1
+ { &MEDIASUBTYPE_SVQ1, CODEC_ID_SVQ1, MAKEFOURCC('S','V','Q','1'), NULL },
- // H263
- { &MEDIASUBTYPE_H263, CODEC_ID_H263, MAKEFOURCC('H', '2', '6', '3'), NULL },
- { &MEDIASUBTYPE_h263, CODEC_ID_H263, MAKEFOURCC('h', '2', '6', '3'), NULL },
+ // H263
+ { &MEDIASUBTYPE_H263, CODEC_ID_H263, MAKEFOURCC('H','2','6','3'), NULL },
+ { &MEDIASUBTYPE_h263, CODEC_ID_H263, MAKEFOURCC('h','2','6','3'), NULL },
- { &MEDIASUBTYPE_S263, CODEC_ID_H263, MAKEFOURCC('S', '2', '6', '3'), NULL },
- { &MEDIASUBTYPE_s263, CODEC_ID_H263, MAKEFOURCC('s', '2', '6', '3'), NULL },
+ { &MEDIASUBTYPE_S263, CODEC_ID_H263, MAKEFOURCC('S','2','6','3'), NULL },
+ { &MEDIASUBTYPE_s263, CODEC_ID_H263, MAKEFOURCC('s','2','6','3'), NULL },
- // Real video
- { &MEDIASUBTYPE_RV10, CODEC_ID_RV10, MAKEFOURCC('R', 'V', '1', '0'), NULL },
- { &MEDIASUBTYPE_RV20, CODEC_ID_RV20, MAKEFOURCC('R', 'V', '2', '0'), NULL },
- { &MEDIASUBTYPE_RV30, CODEC_ID_RV30, MAKEFOURCC('R', 'V', '3', '0'), NULL },
- { &MEDIASUBTYPE_RV40, CODEC_ID_RV40, MAKEFOURCC('R', 'V', '4', '0'), NULL },
+ // Real video
+ { &MEDIASUBTYPE_RV10, CODEC_ID_RV10, MAKEFOURCC('R','V','1','0'), NULL },
+ { &MEDIASUBTYPE_RV20, CODEC_ID_RV20, MAKEFOURCC('R','V','2','0'), NULL },
+ { &MEDIASUBTYPE_RV30, CODEC_ID_RV30, MAKEFOURCC('R','V','3','0'), NULL },
+ { &MEDIASUBTYPE_RV40, CODEC_ID_RV40, MAKEFOURCC('R','V','4','0'), NULL },
- // Theora
- { &MEDIASUBTYPE_THEORA, CODEC_ID_THEORA, MAKEFOURCC('T', 'H', 'E', 'O'), NULL },
- { &MEDIASUBTYPE_theora, CODEC_ID_THEORA, MAKEFOURCC('t', 'h', 'e', 'o'), NULL },
+ // Theora
+ { &MEDIASUBTYPE_THEORA, CODEC_ID_THEORA, MAKEFOURCC('T','H','E','O'), NULL },
+ { &MEDIASUBTYPE_theora, CODEC_ID_THEORA, MAKEFOURCC('t','h','e','o'), NULL },
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- // WVC1
- { &MEDIASUBTYPE_WVC1, CODEC_ID_VC1, MAKEFOURCC('W', 'V', 'C', '1'), &DXVA_VC1 },
- { &MEDIASUBTYPE_wvc1, CODEC_ID_VC1, MAKEFOURCC('w', 'v', 'c', '1'), &DXVA_VC1 },
+ // WVC1
+ { &MEDIASUBTYPE_WVC1, CODEC_ID_VC1, MAKEFOURCC('W','V','C','1'), &DXVA_VC1 },
+ { &MEDIASUBTYPE_wvc1, CODEC_ID_VC1, MAKEFOURCC('w','v','c','1'), &DXVA_VC1 },
#if INCLUDE_MPC_VIDEO_DECODER
- // Other MPEG-4
- { &MEDIASUBTYPE_MP4V, CODEC_ID_MPEG4, MAKEFOURCC('M', 'P', '4', 'V'), NULL },
- { &MEDIASUBTYPE_mp4v, CODEC_ID_MPEG4, MAKEFOURCC('m', 'p', '4', 'v'), NULL },
- { &MEDIASUBTYPE_M4S2, CODEC_ID_MPEG4, MAKEFOURCC('M', '4', 'S', '2'), NULL },
- { &MEDIASUBTYPE_m4s2, CODEC_ID_MPEG4, MAKEFOURCC('m', '4', 's', '2'), NULL },
- { &MEDIASUBTYPE_MP4S, CODEC_ID_MPEG4, MAKEFOURCC('M', 'P', '4', 'S'), NULL },
- { &MEDIASUBTYPE_mp4s, CODEC_ID_MPEG4, MAKEFOURCC('m', 'p', '4', 's'), NULL },
- { &MEDIASUBTYPE_3IV1, CODEC_ID_MPEG4, MAKEFOURCC('3', 'I', 'V', '1'), NULL },
- { &MEDIASUBTYPE_3iv1, CODEC_ID_MPEG4, MAKEFOURCC('3', 'i', 'v', '1'), NULL },
- { &MEDIASUBTYPE_3IV2, CODEC_ID_MPEG4, MAKEFOURCC('3', 'I', 'V', '2'), NULL },
- { &MEDIASUBTYPE_3iv2, CODEC_ID_MPEG4, MAKEFOURCC('3', 'i', 'v', '2'), NULL },
- { &MEDIASUBTYPE_3IVX, CODEC_ID_MPEG4, MAKEFOURCC('3', 'I', 'V', 'X'), NULL },
- { &MEDIASUBTYPE_3ivx, CODEC_ID_MPEG4, MAKEFOURCC('3', 'i', 'v', 'x'), NULL },
- { &MEDIASUBTYPE_BLZ0, CODEC_ID_MPEG4, MAKEFOURCC('B', 'L', 'Z', '0'), NULL },
- { &MEDIASUBTYPE_blz0, CODEC_ID_MPEG4, MAKEFOURCC('b', 'l', 'z', '0'), NULL },
- { &MEDIASUBTYPE_DM4V, CODEC_ID_MPEG4, MAKEFOURCC('D', 'M', '4', 'V'), NULL },
- { &MEDIASUBTYPE_dm4v, CODEC_ID_MPEG4, MAKEFOURCC('d', 'm', '4', 'v'), NULL },
- { &MEDIASUBTYPE_FFDS, CODEC_ID_MPEG4, MAKEFOURCC('F', 'F', 'D', 'S'), NULL },
- { &MEDIASUBTYPE_ffds, CODEC_ID_MPEG4, MAKEFOURCC('f', 'f', 'd', 's'), NULL },
- { &MEDIASUBTYPE_FVFW, CODEC_ID_MPEG4, MAKEFOURCC('F', 'V', 'F', 'W'), NULL },
- { &MEDIASUBTYPE_fvfw, CODEC_ID_MPEG4, MAKEFOURCC('f', 'v', 'f', 'w'), NULL },
- { &MEDIASUBTYPE_DXGM, CODEC_ID_MPEG4, MAKEFOURCC('D', 'X', 'G', 'M'), NULL },
- { &MEDIASUBTYPE_dxgm, CODEC_ID_MPEG4, MAKEFOURCC('d', 'x', 'g', 'm'), NULL },
- { &MEDIASUBTYPE_FMP4, CODEC_ID_MPEG4, MAKEFOURCC('F', 'M', 'P', '4'), NULL },
- { &MEDIASUBTYPE_fmp4, CODEC_ID_MPEG4, MAKEFOURCC('f', 'm', 'p', '4'), NULL },
- { &MEDIASUBTYPE_HDX4, CODEC_ID_MPEG4, MAKEFOURCC('H', 'D', 'X', '4'), NULL },
- { &MEDIASUBTYPE_hdx4, CODEC_ID_MPEG4, MAKEFOURCC('h', 'd', 'x', '4'), NULL },
- { &MEDIASUBTYPE_LMP4, CODEC_ID_MPEG4, MAKEFOURCC('L', 'M', 'P', '4'), NULL },
- { &MEDIASUBTYPE_lmp4, CODEC_ID_MPEG4, MAKEFOURCC('l', 'm', 'p', '4'), NULL },
- { &MEDIASUBTYPE_NDIG, CODEC_ID_MPEG4, MAKEFOURCC('N', 'D', 'I', 'G'), NULL },
- { &MEDIASUBTYPE_ndig, CODEC_ID_MPEG4, MAKEFOURCC('n', 'd', 'i', 'g'), NULL },
- { &MEDIASUBTYPE_RMP4, CODEC_ID_MPEG4, MAKEFOURCC('R', 'M', 'P', '4'), NULL },
- { &MEDIASUBTYPE_rmp4, CODEC_ID_MPEG4, MAKEFOURCC('r', 'm', 'p', '4'), NULL },
- { &MEDIASUBTYPE_SMP4, CODEC_ID_MPEG4, MAKEFOURCC('S', 'M', 'P', '4'), NULL },
- { &MEDIASUBTYPE_smp4, CODEC_ID_MPEG4, MAKEFOURCC('s', 'm', 'p', '4'), NULL },
- { &MEDIASUBTYPE_SEDG, CODEC_ID_MPEG4, MAKEFOURCC('S', 'E', 'D', 'G'), NULL },
- { &MEDIASUBTYPE_sedg, CODEC_ID_MPEG4, MAKEFOURCC('s', 'e', 'd', 'g'), NULL },
- { &MEDIASUBTYPE_UMP4, CODEC_ID_MPEG4, MAKEFOURCC('U', 'M', 'P', '4'), NULL },
- { &MEDIASUBTYPE_ump4, CODEC_ID_MPEG4, MAKEFOURCC('u', 'm', 'p', '4'), NULL },
- { &MEDIASUBTYPE_WV1F, CODEC_ID_MPEG4, MAKEFOURCC('W', 'V', '1', 'F'), NULL },
- { &MEDIASUBTYPE_wv1f, CODEC_ID_MPEG4, MAKEFOURCC('w', 'v', '1', 'f'), NULL },
+ // Other MPEG-4
+ { &MEDIASUBTYPE_MP4V, CODEC_ID_MPEG4, MAKEFOURCC('M','P','4','V'), NULL },
+ { &MEDIASUBTYPE_mp4v, CODEC_ID_MPEG4, MAKEFOURCC('m','p','4','v'), NULL },
+ { &MEDIASUBTYPE_M4S2, CODEC_ID_MPEG4, MAKEFOURCC('M','4','S','2'), NULL },
+ { &MEDIASUBTYPE_m4s2, CODEC_ID_MPEG4, MAKEFOURCC('m','4','s','2'), NULL },
+ { &MEDIASUBTYPE_MP4S, CODEC_ID_MPEG4, MAKEFOURCC('M','P','4','S'), NULL },
+ { &MEDIASUBTYPE_mp4s, CODEC_ID_MPEG4, MAKEFOURCC('m','p','4','s'), NULL },
+ { &MEDIASUBTYPE_3IV1, CODEC_ID_MPEG4, MAKEFOURCC('3','I','V','1'), NULL },
+ { &MEDIASUBTYPE_3iv1, CODEC_ID_MPEG4, MAKEFOURCC('3','i','v','1'), NULL },
+ { &MEDIASUBTYPE_3IV2, CODEC_ID_MPEG4, MAKEFOURCC('3','I','V','2'), NULL },
+ { &MEDIASUBTYPE_3iv2, CODEC_ID_MPEG4, MAKEFOURCC('3','i','v','2'), NULL },
+ { &MEDIASUBTYPE_3IVX, CODEC_ID_MPEG4, MAKEFOURCC('3','I','V','X'), NULL },
+ { &MEDIASUBTYPE_3ivx, CODEC_ID_MPEG4, MAKEFOURCC('3','i','v','x'), NULL },
+ { &MEDIASUBTYPE_BLZ0, CODEC_ID_MPEG4, MAKEFOURCC('B','L','Z','0'), NULL },
+ { &MEDIASUBTYPE_blz0, CODEC_ID_MPEG4, MAKEFOURCC('b','l','z','0'), NULL },
+ { &MEDIASUBTYPE_DM4V, CODEC_ID_MPEG4, MAKEFOURCC('D','M','4','V'), NULL },
+ { &MEDIASUBTYPE_dm4v, CODEC_ID_MPEG4, MAKEFOURCC('d','m','4','v'), NULL },
+ { &MEDIASUBTYPE_FFDS, CODEC_ID_MPEG4, MAKEFOURCC('F','F','D','S'), NULL },
+ { &MEDIASUBTYPE_ffds, CODEC_ID_MPEG4, MAKEFOURCC('f','f','d','s'), NULL },
+ { &MEDIASUBTYPE_FVFW, CODEC_ID_MPEG4, MAKEFOURCC('F','V','F','W'), NULL },
+ { &MEDIASUBTYPE_fvfw, CODEC_ID_MPEG4, MAKEFOURCC('f','v','f','w'), NULL },
+ { &MEDIASUBTYPE_DXGM, CODEC_ID_MPEG4, MAKEFOURCC('D','X','G','M'), NULL },
+ { &MEDIASUBTYPE_dxgm, CODEC_ID_MPEG4, MAKEFOURCC('d','x','g','m'), NULL },
+ { &MEDIASUBTYPE_FMP4, CODEC_ID_MPEG4, MAKEFOURCC('F','M','P','4'), NULL },
+ { &MEDIASUBTYPE_fmp4, CODEC_ID_MPEG4, MAKEFOURCC('f','m','p','4'), NULL },
+ { &MEDIASUBTYPE_HDX4, CODEC_ID_MPEG4, MAKEFOURCC('H','D','X','4'), NULL },
+ { &MEDIASUBTYPE_hdx4, CODEC_ID_MPEG4, MAKEFOURCC('h','d','x','4'), NULL },
+ { &MEDIASUBTYPE_LMP4, CODEC_ID_MPEG4, MAKEFOURCC('L','M','P','4'), NULL },
+ { &MEDIASUBTYPE_lmp4, CODEC_ID_MPEG4, MAKEFOURCC('l','m','p','4'), NULL },
+ { &MEDIASUBTYPE_NDIG, CODEC_ID_MPEG4, MAKEFOURCC('N','D','I','G'), NULL },
+ { &MEDIASUBTYPE_ndig, CODEC_ID_MPEG4, MAKEFOURCC('n','d','i','g'), NULL },
+ { &MEDIASUBTYPE_RMP4, CODEC_ID_MPEG4, MAKEFOURCC('R','M','P','4'), NULL },
+ { &MEDIASUBTYPE_rmp4, CODEC_ID_MPEG4, MAKEFOURCC('r','m','p','4'), NULL },
+ { &MEDIASUBTYPE_SMP4, CODEC_ID_MPEG4, MAKEFOURCC('S','M','P','4'), NULL },
+ { &MEDIASUBTYPE_smp4, CODEC_ID_MPEG4, MAKEFOURCC('s','m','p','4'), NULL },
+ { &MEDIASUBTYPE_SEDG, CODEC_ID_MPEG4, MAKEFOURCC('S','E','D','G'), NULL },
+ { &MEDIASUBTYPE_sedg, CODEC_ID_MPEG4, MAKEFOURCC('s','e','d','g'), NULL },
+ { &MEDIASUBTYPE_UMP4, CODEC_ID_MPEG4, MAKEFOURCC('U','M','P','4'), NULL },
+ { &MEDIASUBTYPE_ump4, CODEC_ID_MPEG4, MAKEFOURCC('u','m','p','4'), NULL },
+ { &MEDIASUBTYPE_WV1F, CODEC_ID_MPEG4, MAKEFOURCC('W','V','1','F'), NULL },
+ { &MEDIASUBTYPE_wv1f, CODEC_ID_MPEG4, MAKEFOURCC('w','v','1','f'), NULL },
#endif /* INCLUDE_MPC_VIDEO_DECODER */
};
@@ -360,173 +354,173 @@ FFMPEG_CODECS ffCodecs[] =
const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] =
{
#if INCLUDE_MPC_VIDEO_DECODER
- // Flash video
- { &MEDIATYPE_Video, &MEDIASUBTYPE_FLV1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_flv1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_FLV4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_flv4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VP6F },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vp6f },
-
- // VP5
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VP50 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vp50 },
-
- // VP6
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VP60 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vp60 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VP61 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vp61 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VP62 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vp62 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VP6A },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vp6a },
-
- // Xvid
- { &MEDIATYPE_Video, &MEDIASUBTYPE_XVID },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_xvid },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_XVIX },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_xvix },
-
- // DivX
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DX50 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_dx50 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIVX },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_divx },
-
- // WMV1/2/3
- { &MEDIATYPE_Video, &MEDIASUBTYPE_WMV1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_wmv1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_WMV2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_wmv2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_WMV3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_wmv3 },
-
- // Mpeg 2
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MPEG2_VIDEO },
-
- // MSMPEG-4
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_div3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DVX3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_dvx3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MP43 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mp43 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_COL1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_col1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_div4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV5 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_div5 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV6 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_div6 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_AP41 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_ap41 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MPG3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mpg3 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_div2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MP42 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mp42 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MPG4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mpg4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_div1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MP41 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mp41 },
-
- // AMV Video
- { &MEDIATYPE_Video, &MEDIASUBTYPE_AMVV },
+ // Flash video
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_FLV1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_flv1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_FLV4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_flv4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VP6F },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vp6f },
+
+ // VP5
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VP50 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vp50 },
+
+ // VP6
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VP60 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vp60 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VP61 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vp61 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VP62 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vp62 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VP6A },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vp6a },
+
+ // Xvid
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_XVID },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_xvid },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_XVIX },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_xvix },
+
+ // DivX
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DX50 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_dx50 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIVX },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_divx },
+
+ // WMV1/2/3
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_WMV1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_wmv1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_WMV2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_wmv2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_WMV3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_wmv3 },
+
+ // Mpeg 2
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MPEG2_VIDEO },
+
+ // MSMPEG-4
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_div3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DVX3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_dvx3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MP43 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mp43 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_COL1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_col1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_div4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV5 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_div5 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV6 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_div6 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_AP41 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_ap41 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MPG3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mpg3 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_div2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MP42 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mp42 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MPG4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mpg4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DIV1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_div1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MP41 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mp41 },
+
+ // AMV Video
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_AMVV },
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- // H264/AVC
- { &MEDIATYPE_Video, &MEDIASUBTYPE_H264 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_h264 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_X264 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_x264 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_VSSH },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_vssh },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DAVC },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_davc },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_PAVC },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_pavc },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_AVC1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_avc1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_H264_bis },
+ // H264/AVC
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_H264 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_h264 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_X264 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_x264 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_VSSH },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_vssh },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DAVC },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_davc },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_PAVC },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_pavc },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_AVC1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_avc1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_H264_bis },
#if INCLUDE_MPC_VIDEO_DECODER
- // SVQ3
- { &MEDIATYPE_Video, &MEDIASUBTYPE_SVQ3 },
-
- // SVQ1
- { &MEDIATYPE_Video, &MEDIASUBTYPE_SVQ1 },
-
- // H263
- { &MEDIATYPE_Video, &MEDIASUBTYPE_H263 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_h263 },
-
- { &MEDIATYPE_Video, &MEDIASUBTYPE_S263 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_s263 },
-
- // Real video
- { &MEDIATYPE_Video, &MEDIASUBTYPE_RV10 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_RV20 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_RV30 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_RV40 },
-
- // Theora
- { &MEDIATYPE_Video, &MEDIASUBTYPE_THEORA },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_theora },
+ // SVQ3
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_SVQ3 },
+
+ // SVQ1
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_SVQ1 },
+
+ // H263
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_H263 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_h263 },
+
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_S263 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_s263 },
+
+ // Real video
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_RV10 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_RV20 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_RV30 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_RV40 },
+
+ // Theora
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_THEORA },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_theora },
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- // VC1
- { &MEDIATYPE_Video, &MEDIASUBTYPE_WVC1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_wvc1 },
-
+ // VC1
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_WVC1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_wvc1 },
+
#if INCLUDE_MPC_VIDEO_DECODER
- // IMPORTANT : some of the last MediaTypes present in next group may be not available in
- // the standalone filter (workaround to prevent GraphEdit crash).
- // Other MPEG-4
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MP4V },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mp4v },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_M4S2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_m4s2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_MP4S },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_mp4s },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_3IV1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_3iv1 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_3IV2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_3iv2 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_3IVX },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_3ivx },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_BLZ0 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_blz0 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DM4V },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_dm4v },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_FFDS },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_ffds },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_FVFW },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_fvfw },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_DXGM },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_dxgm },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_FMP4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_fmp4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_HDX4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_hdx4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_LMP4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_lmp4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_NDIG },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_ndig },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_RMP4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_rmp4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_SMP4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_smp4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_SEDG },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_sedg },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_UMP4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_ump4 },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_WV1F },
- { &MEDIATYPE_Video, &MEDIASUBTYPE_wv1f }
+ // IMPORTANT : some of the last MediaTypes present in next group may be not available in
+ // the standalone filter (workaround to prevent GraphEdit crash).
+ // Other MPEG-4
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MP4V },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mp4v },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_M4S2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_m4s2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_MP4S },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_mp4s },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_3IV1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_3iv1 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_3IV2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_3iv2 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_3IVX },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_3ivx },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_BLZ0 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_blz0 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DM4V },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_dm4v },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_FFDS },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_ffds },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_FVFW },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_fvfw },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_DXGM },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_dxgm },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_FMP4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_fmp4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_HDX4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_hdx4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_LMP4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_lmp4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_NDIG },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_ndig },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_RMP4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_rmp4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_SMP4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_smp4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_SEDG },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_sedg },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_UMP4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_ump4 },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_WV1F },
+ { &MEDIATYPE_Video, &MEDIASUBTYPE_wv1f }
#endif /* INCLUDE_MPC_VIDEO_DECODER */
};
@@ -538,468 +532,468 @@ bool CMPCVideoDecFilter::m_ref_frame_count_check_skip = false;
const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesOut[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_NV12},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_NV24}
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NV12},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NV24}
};
const int CMPCVideoDecFilter::sudPinTypesOutCount = countof(CMPCVideoDecFilter::sudPinTypesOut);
-BOOL CALLBACK EnumFindProcessWnd(HWND hwnd, LPARAM lParam)
+BOOL CALLBACK EnumFindProcessWnd (HWND hwnd, LPARAM lParam)
{
- DWORD procid = 0;
- TCHAR WindowClass [40];
- GetWindowThreadProcessId(hwnd, &procid);
- GetClassName(hwnd, WindowClass, countof(WindowClass));
-
- if(procid == GetCurrentProcessId() && _tcscmp(WindowClass, _T("MediaPlayerClassicW")) == 0)
- {
- HWND* pWnd = (HWND*) lParam;
- *pWnd = hwnd;
- return FALSE;
- }
- return TRUE;
+ DWORD procid = 0;
+ TCHAR WindowClass [40];
+ GetWindowThreadProcessId (hwnd, &procid);
+ GetClassName (hwnd, WindowClass, countof(WindowClass));
+
+ if (procid == GetCurrentProcessId() && _tcscmp (WindowClass, _T("MediaPlayerClassicW")) == 0)
+ {
+ HWND* pWnd = (HWND*) lParam;
+ *pWnd = hwnd;
+ return FALSE;
+ }
+ return TRUE;
}
-CMPCVideoDecFilter::CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseVideoFilter(NAME("MPC - Video decoder"), lpunk, phr, __uuidof(this))
+CMPCVideoDecFilter::CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CBaseVideoFilter(NAME("MPC - Video decoder"), lpunk, phr, __uuidof(this))
{
- HWND hWnd = NULL;
- for(int i = 0; i < countof(ffCodecs); i++)
- {
- if(ffCodecs[i].nFFCodec == CODEC_ID_H264)
- {
- if(IsVista())
- {
- ffCodecs[i].DXVAModes = &DXVA_H264_VISTA;
- }
- }
- }
+ HWND hWnd = NULL;
+ for (int i=0; i<countof(ffCodecs); i++)
+ {
+ if(ffCodecs[i].nFFCodec == CODEC_ID_H264)
+ {
+ if(IsVista())
+ {
+ ffCodecs[i].DXVAModes = &DXVA_H264_VISTA;
+ }
+ }
+ }
- if(phr) *phr = S_OK;
-
- if(m_pOutput) delete m_pOutput;
- if(!(m_pOutput = DNew CVideoDecOutputPin(NAME("CVideoDecOutputPin"), this, phr, L"Output"))) * phr = E_OUTOFMEMORY;
-
- m_pCpuId = DNew CCpuId();
- m_pAVCodec = NULL;
- m_pAVCtx = NULL;
- m_pFrame = NULL;
- m_nCodecNb = -1;
- m_rtAvrTimePerFrame = 0;
- m_bReorderBFrame = true;
- m_DXVADecoderGUID = GUID_NULL;
- m_nActiveCodecs = MPCVD_H264 | MPCVD_VC1 | MPCVD_XVID | MPCVD_DIVX | MPCVD_MSMPEG4 | MPCVD_FLASH | MPCVD_WMV | MPCVD_H263 | MPCVD_SVQ3 | MPCVD_AMVV | MPCVD_THEORA | MPCVD_H264_DXVA | MPCVD_VC1_DXVA | MPCVD_VP6;
- m_rtLastStart = 0;
- m_nCountEstimated = 0;
-
- m_nWorkaroundBug = FF_BUG_AUTODETECT;
- m_nErrorConcealment = FF_EC_DEBLOCK | FF_EC_GUESS_MVS;
-
- m_nThreadNumber = m_pCpuId->GetProcessorNumber();
- m_nDiscardMode = AVDISCARD_DEFAULT;
- m_nErrorRecognition = FF_ER_CAREFUL;
- m_nIDCTAlgo = FF_IDCT_AUTO;
- m_bDXVACompatible = true;
- m_pFFBuffer = NULL;
- m_nFFBufferSize = 0;
- ResetBuffer();
-
- m_nWidth = 0;
- m_nHeight = 0;
- m_pSwsContext = NULL;
-
- m_bUseDXVA = true;
- m_bUseFFmpeg = true;
-
- m_nDXVAMode = MODE_SOFTWARE;
- m_pDXVADecoder = NULL;
- m_pVideoOutputFormat = NULL;
- m_nVideoOutputCount = 0;
- m_hDevice = INVALID_HANDLE_VALUE;
-
- m_nARMode = 1;
- m_nDXVACheckCompatibility = 0;
- m_nPosB = 1;
- m_sar.SetSize(1, 1);
-
- CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder"), KEY_READ))
- {
- DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ThreadNumber"), dw)) m_nThreadNumber = dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DiscardMode"), dw)) m_nDiscardMode = dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ErrorRecognition"), dw)) m_nErrorRecognition = dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("IDCTAlgo"), dw)) m_nIDCTAlgo = dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ActiveCodecs"), dw)) m_nActiveCodecs = dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ARMode"), dw)) m_nARMode = dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DXVACheckCompatibility"), dw)) m_nDXVACheckCompatibility = dw;
- }
+ if(phr) *phr = S_OK;
+
+ if (m_pOutput) delete m_pOutput;
+ if(!(m_pOutput = DNew CVideoDecOutputPin(NAME("CVideoDecOutputPin"), this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+
+ m_pCpuId = DNew CCpuId();
+ m_pAVCodec = NULL;
+ m_pAVCtx = NULL;
+ m_pFrame = NULL;
+ m_nCodecNb = -1;
+ m_rtAvrTimePerFrame = 0;
+ m_bReorderBFrame = true;
+ m_DXVADecoderGUID = GUID_NULL;
+ m_nActiveCodecs = MPCVD_H264|MPCVD_VC1|MPCVD_XVID|MPCVD_DIVX|MPCVD_MSMPEG4|MPCVD_FLASH|MPCVD_WMV|MPCVD_H263|MPCVD_SVQ3|MPCVD_AMVV|MPCVD_THEORA|MPCVD_H264_DXVA|MPCVD_VC1_DXVA|MPCVD_VP6;
+ m_rtLastStart = 0;
+ m_nCountEstimated = 0;
+
+ m_nWorkaroundBug = FF_BUG_AUTODETECT;
+ m_nErrorConcealment = FF_EC_DEBLOCK | FF_EC_GUESS_MVS;
+
+ m_nThreadNumber = m_pCpuId->GetProcessorNumber();
+ m_nDiscardMode = AVDISCARD_DEFAULT;
+ m_nErrorRecognition = FF_ER_CAREFUL;
+ m_nIDCTAlgo = FF_IDCT_AUTO;
+ m_bDXVACompatible = true;
+ m_pFFBuffer = NULL;
+ m_nFFBufferSize = 0;
+ ResetBuffer();
+
+ m_nWidth = 0;
+ m_nHeight = 0;
+ m_pSwsContext = NULL;
+
+ m_bUseDXVA = true;
+ m_bUseFFmpeg = true;
+
+ m_nDXVAMode = MODE_SOFTWARE;
+ m_pDXVADecoder = NULL;
+ m_pVideoOutputFormat = NULL;
+ m_nVideoOutputCount = 0;
+ m_hDevice = INVALID_HANDLE_VALUE;
+
+ m_nARMode = 1;
+ m_nDXVACheckCompatibility = 0;
+ m_nPosB = 1;
+ m_sar.SetSize(1,1);
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder"), KEY_READ))
+ {
+ DWORD dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ThreadNumber"), dw)) m_nThreadNumber = dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DiscardMode"), dw)) m_nDiscardMode = dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ErrorRecognition"), dw)) m_nErrorRecognition = dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("IDCTAlgo"), dw)) m_nIDCTAlgo = dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ActiveCodecs"), dw)) m_nActiveCodecs = dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ARMode"), dw)) m_nARMode = dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DXVACheckCompatibility"), dw)) m_nDXVACheckCompatibility = dw;
+ }
- if(m_nDXVACheckCompatibility > 3) m_nDXVACheckCompatibility = 0;
+ if(m_nDXVACheckCompatibility>3) m_nDXVACheckCompatibility = 0;
- ff_avcodec_default_get_buffer = avcodec_default_get_buffer;
- ff_avcodec_default_release_buffer = avcodec_default_release_buffer;
- ff_avcodec_default_reget_buffer = avcodec_default_reget_buffer;
+ ff_avcodec_default_get_buffer = avcodec_default_get_buffer;
+ ff_avcodec_default_release_buffer = avcodec_default_release_buffer;
+ ff_avcodec_default_reget_buffer = avcodec_default_reget_buffer;
- avcodec_init();
- avcodec_register_all();
- av_log_set_callback(LogLibAVCodec);
+ avcodec_init();
+ avcodec_register_all();
+ av_log_set_callback(LogLibAVCodec);
#if INCLUDE_MPC_VIDEO_DECODER
- init_libvo();
+ init_libvo();
#endif
- EnumWindows(EnumFindProcessWnd, (LPARAM)&hWnd);
- DetectVideoCard(hWnd);
+ EnumWindows(EnumFindProcessWnd, (LPARAM)&hWnd);
+ DetectVideoCard(hWnd);
#ifdef _DEBUG
- // Check codec definition table
- int nCodecs = countof(ffCodecs);
- int nPinTypes = countof(sudPinTypesIn);
- ASSERT(nCodecs == nPinTypes);
- for(int i = 0; i < nPinTypes; i++)
- ASSERT(ffCodecs[i].clsMinorType == sudPinTypesIn[i].clsMinorType);
+ // Check codec definition table
+ int nCodecs = countof(ffCodecs);
+ int nPinTypes = countof(sudPinTypesIn);
+ ASSERT (nCodecs == nPinTypes);
+ for (int i=0; i<nPinTypes; i++)
+ ASSERT (ffCodecs[i].clsMinorType == sudPinTypesIn[i].clsMinorType);
#endif
}
UINT CMPCVideoDecFilter::GetAdapter(IDirect3D9* pD3D, HWND hWnd)
{
- if(hWnd == NULL || pD3D == NULL)
- return D3DADAPTER_DEFAULT;
+ if(hWnd == NULL || pD3D == NULL)
+ return D3DADAPTER_DEFAULT;
- HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
- if(hMonitor == NULL) return D3DADAPTER_DEFAULT;
+ HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
+ if(hMonitor == NULL) return D3DADAPTER_DEFAULT;
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp)
- {
- HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
- if(hAdpMon == hMonitor) return adp;
- }
+ for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp)
+ {
+ HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
+ if(hAdpMon == hMonitor) return adp;
+ }
- return D3DADAPTER_DEFAULT;
+ return D3DADAPTER_DEFAULT;
}
void CMPCVideoDecFilter::DetectVideoCard(HWND hWnd)
{
- IDirect3D9* pD3D9;
- m_nPCIVendor = 0;
- m_nPCIDevice = 0;
- m_VideoDriverVersion.HighPart = 0;
- m_VideoDriverVersion.LowPart = 0;
+ IDirect3D9* pD3D9;
+ m_nPCIVendor = 0;
+ m_nPCIDevice = 0;
+ m_VideoDriverVersion.HighPart = 0;
+ m_VideoDriverVersion.LowPart = 0;
- if(pD3D9 = Direct3DCreate9(D3D_SDK_VERSION))
- {
- D3DADAPTER_IDENTIFIER9 adapterIdentifier;
- if(pD3D9->GetAdapterIdentifier(GetAdapter(pD3D9, hWnd), 0, &adapterIdentifier) == S_OK)
- {
- m_nPCIVendor = adapterIdentifier.VendorId;
- m_nPCIDevice = adapterIdentifier.DeviceId;
- m_VideoDriverVersion = adapterIdentifier.DriverVersion;
- m_strDeviceDescription = adapterIdentifier.Description;
- m_strDeviceDescription.AppendFormat(_T(" (%d)"), m_nPCIVendor);
- }
- pD3D9->Release();
- }
+ if (pD3D9 = Direct3DCreate9(D3D_SDK_VERSION))
+ {
+ D3DADAPTER_IDENTIFIER9 adapterIdentifier;
+ if (pD3D9->GetAdapterIdentifier(GetAdapter(pD3D9, hWnd), 0, &adapterIdentifier) == S_OK)
+ {
+ m_nPCIVendor = adapterIdentifier.VendorId;
+ m_nPCIDevice = adapterIdentifier.DeviceId;
+ m_VideoDriverVersion = adapterIdentifier.DriverVersion;
+ m_strDeviceDescription = adapterIdentifier.Description;
+ m_strDeviceDescription.AppendFormat (_T(" (%d)"), m_nPCIVendor);
+ }
+ pD3D9->Release();
+ }
}
CMPCVideoDecFilter::~CMPCVideoDecFilter()
{
- Cleanup();
+ Cleanup();
- SAFE_DELETE(m_pCpuId);
+ SAFE_DELETE(m_pCpuId);
}
inline int LNKO(int a, int b)
{
- if(a == 0 || b == 0)
- return(1);
- while(a != b)
- {
- if(a < b) b -= a;
- else if(a > b) a -= b;
- }
- return(a);
+ if(a == 0 || b == 0)
+ return(1);
+ while(a != b)
+ {
+ if(a < b) b -= a;
+ else if(a > b) a -= b;
+ }
+ return(a);
}
bool CMPCVideoDecFilter::IsVideoInterlaced()
{
- // NOT A BUG : always tell DirectShow it's interlaced (progressive flags set in
- // SetTypeSpecificFlags function)
- return true;
+ // NOT A BUG : always tell DirectShow it's interlaced (progressive flags set in
+ // SetTypeSpecificFlags function)
+ return true;
};
-void CMPCVideoDecFilter::UpdateFrameTime(REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
+void CMPCVideoDecFilter::UpdateFrameTime (REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
{
- if(rtStart == _I64_MIN)
- {
- // If reference time has not been set by splitter, extrapolate start time
- // from last known start time already delivered
- rtStart = m_rtLastStart + m_rtAvrTimePerFrame * m_nCountEstimated;
- m_nCountEstimated++;
- }
- else
- {
- // Known start time, set as new reference
- m_rtLastStart = rtStart;
- m_nCountEstimated = 1;
- }
+ if (rtStart == _I64_MIN)
+ {
+ // If reference time has not been set by splitter, extrapolate start time
+ // from last known start time already delivered
+ rtStart = m_rtLastStart + m_rtAvrTimePerFrame*m_nCountEstimated;
+ m_nCountEstimated++;
+ }
+ else
+ {
+ // Known start time, set as new reference
+ m_rtLastStart = rtStart;
+ m_nCountEstimated = 1;
+ }
- rtStop = rtStart + m_rtAvrTimePerFrame;
+ rtStop = rtStart + m_rtAvrTimePerFrame;
}
void CMPCVideoDecFilter::GetOutputSize(int& w, int& h, int& arx, int& ary, int &RealWidth, int &RealHeight)
{
#if 1
- RealWidth = m_nWidth;
- RealHeight = m_nHeight;
- w = PictWidthRounded();
- h = PictHeightRounded();
+ RealWidth = m_nWidth;
+ RealHeight = m_nHeight;
+ w = PictWidthRounded();
+ h = PictHeightRounded();
#else
- if(m_nDXVAMode == MODE_SOFTWARE)
- {
- w = m_nWidth;
- h = m_nHeight;
- }
- else
- {
- // DXVA surface are multiple of 16 pixels!
- w = PictWidthRounded();
- h = PictHeightRounded();
- }
+ if (m_nDXVAMode == MODE_SOFTWARE)
+ {
+ w = m_nWidth;
+ h = m_nHeight;
+ }
+ else
+ {
+ // DXVA surface are multiple of 16 pixels!
+ w = PictWidthRounded();
+ h = PictHeightRounded();
+ }
#endif
}
int CMPCVideoDecFilter::PictWidth()
{
- return m_nWidth;
+ return m_nWidth;
}
int CMPCVideoDecFilter::PictHeight()
{
- return m_nHeight;
+ return m_nHeight;
}
int CMPCVideoDecFilter::PictWidthRounded()
{
- // Picture height should be rounded to 16 for DXVA
- return ((m_nWidth + 15) / 16) * 16;
+ // Picture height should be rounded to 16 for DXVA
+ return ((m_nWidth + 15) / 16) * 16;
}
int CMPCVideoDecFilter::PictHeightRounded()
{
- // Picture height should be rounded to 16 for DXVA
- return ((m_nHeight + 15) / 16) * 16;
+ // Picture height should be rounded to 16 for DXVA
+ return ((m_nHeight + 15) / 16) * 16;
}
int CMPCVideoDecFilter::FindCodec(const CMediaType* mtIn)
{
- for(int i = 0; i < countof(ffCodecs); i++)
- if(mtIn->subtype == *ffCodecs[i].clsMinorType)
- {
-#ifndef REGISTER_FILTER
- switch(ffCodecs[i].nFFCodec)
- {
- case CODEC_ID_H264 :
-#if INTERNAL_DECODER_H264_DXVA
- m_bUseDXVA = (DXVAFilters & 1) != 0;
-#else
- m_bUseDXVA = false;
-#endif
-#if INTERNAL_DECODER_H264
- m_bUseFFmpeg = (FFmpegFilters & 1) != 0;
-#else
- m_bUseFFmpeg = false;
-#endif
- break;
- case CODEC_ID_VC1 :
-#if INTERNAL_DECODER_VC1_DXVA
- m_bUseDXVA = (DXVAFilters & 2) != 0;
-#else
- m_bUseDXVA = false;
-#endif
-#if INTERNAL_DECODER_VC1
- m_bUseFFmpeg = (FFmpegFilters & 2) != 0;
-#else
- m_bUseFFmpeg = false;
-#endif
- break;
- case CODEC_ID_MPEG2VIDEO :
-#if INTERNAL_DECODER_MPEG2_DXVA
- m_bUseDXVA = true;
-#endif
- m_bUseFFmpeg = false; // No Mpeg2 software support with ffmpeg!
- break;
- default :
- m_bUseDXVA = false;
- }
-
- return ((m_bUseDXVA || m_bUseFFmpeg) ? i : -1);
+ for (int i=0; i<countof(ffCodecs); i++)
+ if (mtIn->subtype == *ffCodecs[i].clsMinorType)
+ {
+#ifndef REGISTER_FILTER
+ switch (ffCodecs[i].nFFCodec)
+ {
+ case CODEC_ID_H264 :
+ #if INTERNAL_DECODER_H264_DXVA
+ m_bUseDXVA = (DXVAFilters & 1) != 0;
+ #else
+ m_bUseDXVA = false;
+ #endif
+ #if INTERNAL_DECODER_H264
+ m_bUseFFmpeg = (FFmpegFilters & 1) != 0;
+ #else
+ m_bUseFFmpeg = false;
+ #endif
+ break;
+ case CODEC_ID_VC1 :
+ #if INTERNAL_DECODER_VC1_DXVA
+ m_bUseDXVA = (DXVAFilters & 2) != 0;
+ #else
+ m_bUseDXVA = false;
+ #endif
+ #if INTERNAL_DECODER_VC1
+ m_bUseFFmpeg = (FFmpegFilters & 2) != 0;
+ #else
+ m_bUseFFmpeg = false;
+ #endif
+ break;
+ case CODEC_ID_MPEG2VIDEO :
+ #if INTERNAL_DECODER_MPEG2_DXVA
+ m_bUseDXVA = true;
+ #endif
+ m_bUseFFmpeg = false; // No Mpeg2 software support with ffmpeg!
+ break;
+ default :
+ m_bUseDXVA = false;
+ }
+
+ return ((m_bUseDXVA || m_bUseFFmpeg) ? i : -1);
#else
- bool bCodecActivated = false;
- switch(ffCodecs[i].nFFCodec)
- {
- case CODEC_ID_FLV1 :
- case CODEC_ID_VP6F :
- bCodecActivated = (m_nActiveCodecs & MPCVD_FLASH) != 0;
- break;
- case CODEC_ID_MPEG4 :
- if((*ffCodecs[i].clsMinorType == MEDIASUBTYPE_XVID) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_xvid) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_XVIX) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_xvix))
- {
- bCodecActivated = (m_nActiveCodecs & MPCVD_XVID) != 0;
- }
- else if((*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DX50) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_dx50) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DIVX) ||
- (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_divx))
- {
- bCodecActivated = (m_nActiveCodecs & MPCVD_DIVX) != 0;
- }
- break;
- case CODEC_ID_WMV1 :
- case CODEC_ID_WMV2 :
- case CODEC_ID_WMV3 :
- bCodecActivated = (m_nActiveCodecs & MPCVD_WMV) != 0;
- break;
- case CODEC_ID_MSMPEG4V3 :
- case CODEC_ID_MSMPEG4V2 :
- case CODEC_ID_MSMPEG4V1 :
- bCodecActivated = (m_nActiveCodecs & MPCVD_MSMPEG4) != 0;
- break;
- case CODEC_ID_H264 :
- m_bUseDXVA = (m_nActiveCodecs & MPCVD_H264_DXVA) != 0;
- m_bUseFFmpeg = (m_nActiveCodecs & MPCVD_H264) != 0;
- bCodecActivated = m_bUseDXVA || m_bUseFFmpeg;
- break;
- case CODEC_ID_SVQ3 :
- case CODEC_ID_SVQ1 :
- bCodecActivated = (m_nActiveCodecs & MPCVD_SVQ3) != 0;
- break;
- case CODEC_ID_H263 :
- bCodecActivated = (m_nActiveCodecs & MPCVD_H263) != 0;
- break;
- case CODEC_ID_THEORA :
- bCodecActivated = (m_nActiveCodecs & MPCVD_THEORA) != 0;
- break;
- case CODEC_ID_VC1 :
- m_bUseDXVA = (m_nActiveCodecs & MPCVD_VC1_DXVA) != 0;
- m_bUseFFmpeg = (m_nActiveCodecs & MPCVD_VC1) != 0;
- bCodecActivated = m_bUseDXVA || m_bUseFFmpeg;
- break;
- case CODEC_ID_AMV :
- bCodecActivated = (m_nActiveCodecs & MPCVD_AMVV) != 0;
- break;
- case CODEC_ID_VP5 :
- case CODEC_ID_VP6 :
- case CODEC_ID_VP6A :
- bCodecActivated = (m_nActiveCodecs & MPCVD_VP6) != 0;
- break;
- }
- return (bCodecActivated ? i : -1);
+ bool bCodecActivated = false;
+ switch (ffCodecs[i].nFFCodec)
+ {
+ case CODEC_ID_FLV1 :
+ case CODEC_ID_VP6F :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_FLASH) != 0;
+ break;
+ case CODEC_ID_MPEG4 :
+ if ((*ffCodecs[i].clsMinorType == MEDIASUBTYPE_XVID) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_xvid) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_XVIX) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_xvix) )
+ {
+ bCodecActivated = (m_nActiveCodecs & MPCVD_XVID) != 0;
+ }
+ else if ((*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DX50) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_dx50) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_DIVX) ||
+ (*ffCodecs[i].clsMinorType == MEDIASUBTYPE_divx) )
+ {
+ bCodecActivated = (m_nActiveCodecs & MPCVD_DIVX) != 0;
+ }
+ break;
+ case CODEC_ID_WMV1 :
+ case CODEC_ID_WMV2 :
+ case CODEC_ID_WMV3 :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_WMV) != 0;
+ break;
+ case CODEC_ID_MSMPEG4V3 :
+ case CODEC_ID_MSMPEG4V2 :
+ case CODEC_ID_MSMPEG4V1 :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_MSMPEG4) != 0;
+ break;
+ case CODEC_ID_H264 :
+ m_bUseDXVA = (m_nActiveCodecs & MPCVD_H264_DXVA) != 0;
+ m_bUseFFmpeg = (m_nActiveCodecs & MPCVD_H264) != 0;
+ bCodecActivated = m_bUseDXVA || m_bUseFFmpeg;
+ break;
+ case CODEC_ID_SVQ3 :
+ case CODEC_ID_SVQ1 :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_SVQ3) != 0;
+ break;
+ case CODEC_ID_H263 :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_H263) != 0;
+ break;
+ case CODEC_ID_THEORA :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_THEORA) != 0;
+ break;
+ case CODEC_ID_VC1 :
+ m_bUseDXVA = (m_nActiveCodecs & MPCVD_VC1_DXVA) != 0;
+ m_bUseFFmpeg = (m_nActiveCodecs & MPCVD_VC1) != 0;
+ bCodecActivated = m_bUseDXVA || m_bUseFFmpeg;
+ break;
+ case CODEC_ID_AMV :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_AMVV) != 0;
+ break;
+ case CODEC_ID_VP5 :
+ case CODEC_ID_VP6 :
+ case CODEC_ID_VP6A :
+ bCodecActivated = (m_nActiveCodecs & MPCVD_VP6) != 0;
+ break;
+ }
+ return (bCodecActivated ? i : -1);
#endif
- }
+ }
- return -1;
+ return -1;
}
void CMPCVideoDecFilter::Cleanup()
{
- SAFE_DELETE(m_pDXVADecoder);
+ SAFE_DELETE (m_pDXVADecoder);
- // Release FFMpeg
- if(m_pAVCtx)
- {
- if(m_pAVCtx->intra_matrix) free(m_pAVCtx->intra_matrix);
- if(m_pAVCtx->inter_matrix) free(m_pAVCtx->inter_matrix);
- if(m_pAVCtx->extradata) free((unsigned char*)m_pAVCtx->extradata);
- if(m_pFFBuffer) free(m_pFFBuffer);
+ // Release FFMpeg
+ if (m_pAVCtx)
+ {
+ if (m_pAVCtx->intra_matrix) free(m_pAVCtx->intra_matrix);
+ if (m_pAVCtx->inter_matrix) free(m_pAVCtx->inter_matrix);
+ if (m_pAVCtx->extradata) free((unsigned char*)m_pAVCtx->extradata);
+ if (m_pFFBuffer) free(m_pFFBuffer);
- if(m_pAVCtx->slice_offset) av_free(m_pAVCtx->slice_offset);
- if(m_pAVCtx->codec) avcodec_close(m_pAVCtx);
+ if (m_pAVCtx->slice_offset) av_free(m_pAVCtx->slice_offset);
+ if (m_pAVCtx->codec) avcodec_close(m_pAVCtx);
- // Free thread resource if necessary
- FFSetThreadNumber(m_pAVCtx, 0);
+ // Free thread resource if necessary
+ FFSetThreadNumber (m_pAVCtx, 0);
- av_free(m_pAVCtx);
- }
- if(m_pFrame) av_free(m_pFrame);
+ av_free(m_pAVCtx);
+ }
+ if (m_pFrame) av_free(m_pFrame);
#if INCLUDE_MPC_VIDEO_DECODER
- if(m_pSwsContext)
- {
- sws_freeContext(m_pSwsContext);
- m_pSwsContext = NULL;
- }
+ if (m_pSwsContext)
+ {
+ sws_freeContext(m_pSwsContext);
+ m_pSwsContext = NULL;
+ }
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- m_pAVCodec = NULL;
- m_pAVCtx = NULL;
- m_pFrame = NULL;
- m_pFFBuffer = NULL;
- m_nFFBufferSize = 0;
- m_nFFBufferPos = 0;
- m_nFFPicEnd = INT_MIN;
- m_nCodecNb = -1;
- SAFE_DELETE_ARRAY(m_pVideoOutputFormat);
-
- // Release DXVA ressources
- if(m_hDevice != INVALID_HANDLE_VALUE)
- {
- m_pDeviceManager->CloseDeviceHandle(m_hDevice);
- m_hDevice = INVALID_HANDLE_VALUE;
- }
+ m_pAVCodec = NULL;
+ m_pAVCtx = NULL;
+ m_pFrame = NULL;
+ m_pFFBuffer = NULL;
+ m_nFFBufferSize = 0;
+ m_nFFBufferPos = 0;
+ m_nFFPicEnd = INT_MIN;
+ m_nCodecNb = -1;
+ SAFE_DELETE_ARRAY (m_pVideoOutputFormat);
+
+ // Release DXVA ressources
+ if (m_hDevice != INVALID_HANDLE_VALUE)
+ {
+ m_pDeviceManager->CloseDeviceHandle(m_hDevice);
+ m_hDevice = INVALID_HANDLE_VALUE;
+ }
- m_pDeviceManager = NULL;
- m_pDecoderService = NULL;
- m_pDecoderRenderTarget = NULL;
+ m_pDeviceManager = NULL;
+ m_pDecoderService = NULL;
+ m_pDecoderRenderTarget = NULL;
}
void CMPCVideoDecFilter::CalcAvgTimePerFrame()
{
- CMediaType &mt = m_pInput->CurrentMediaType();
- if(mt.formattype == FORMAT_VideoInfo)
- m_rtAvrTimePerFrame = ((VIDEOINFOHEADER*)mt.pbFormat)->AvgTimePerFrame;
- else if(mt.formattype == FORMAT_VideoInfo2)
- m_rtAvrTimePerFrame = ((VIDEOINFOHEADER2*)mt.pbFormat)->AvgTimePerFrame;
- else if(mt.formattype == FORMAT_MPEGVideo)
- m_rtAvrTimePerFrame = ((MPEG1VIDEOINFO*)mt.pbFormat)->hdr.AvgTimePerFrame;
- else if(mt.formattype == FORMAT_MPEG2Video)
- m_rtAvrTimePerFrame = ((MPEG2VIDEOINFO*)mt.pbFormat)->hdr.AvgTimePerFrame;
- else
- {
- ASSERT(FALSE);
- m_rtAvrTimePerFrame = 1;
- }
+ CMediaType &mt = m_pInput->CurrentMediaType();
+ if (mt.formattype==FORMAT_VideoInfo)
+ m_rtAvrTimePerFrame = ((VIDEOINFOHEADER*)mt.pbFormat)->AvgTimePerFrame;
+ else if (mt.formattype==FORMAT_VideoInfo2)
+ m_rtAvrTimePerFrame = ((VIDEOINFOHEADER2*)mt.pbFormat)->AvgTimePerFrame;
+ else if (mt.formattype==FORMAT_MPEGVideo)
+ m_rtAvrTimePerFrame = ((MPEG1VIDEOINFO*)mt.pbFormat)->hdr.AvgTimePerFrame;
+ else if (mt.formattype==FORMAT_MPEG2Video)
+ m_rtAvrTimePerFrame = ((MPEG2VIDEOINFO*)mt.pbFormat)->hdr.AvgTimePerFrame;
+ else
+ {
+ ASSERT (FALSE);
+ m_rtAvrTimePerFrame = 1;
+ }
- m_rtAvrTimePerFrame = max(1, m_rtAvrTimePerFrame);
+ m_rtAvrTimePerFrame = max (1, m_rtAvrTimePerFrame);
}
-void CMPCVideoDecFilter::LogLibAVCodec(void* par, int level, const char *fmt, va_list valist)
+void CMPCVideoDecFilter::LogLibAVCodec(void* par,int level,const char *fmt,va_list valist)
{
#ifdef _DEBUG
- char Msg [500];
- vsnprintf_s(Msg, sizeof(Msg), _TRUNCATE, fmt, valist);
- TRACE("AVLIB : %s", Msg);
+ char Msg [500];
+ vsnprintf_s (Msg, sizeof(Msg), _TRUNCATE, fmt, valist);
+ TRACE("AVLIB : %s", Msg);
#endif
}
void CMPCVideoDecFilter::OnGetBuffer(AVFrame *pic)
{
- // Callback from FFMpeg to store Ref Time in frame (needed to have correct rtStart after avcodec_decode_video calls)
+ // Callback from FFMpeg to store Ref Time in frame (needed to have correct rtStart after avcodec_decode_video calls)
// pic->rtStart = m_rtStart;
}
STDMETHODIMP CMPCVideoDecFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IMPCVideoDecFilter)
- QI(ISpecifyPropertyPages)
- QI(ISpecifyPropertyPages2)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IMPCVideoDecFilter)
+ QI(ISpecifyPropertyPages)
+ QI(ISpecifyPropertyPages2)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
@@ -1007,569 +1001,565 @@ STDMETHODIMP CMPCVideoDecFilter::NonDelegatingQueryInterface(REFIID riid, void**
HRESULT CMPCVideoDecFilter::CheckInputType(const CMediaType* mtIn)
{
- for(int i = 0; i < sizeof(sudPinTypesIn) / sizeof(AMOVIESETUP_MEDIATYPE); i++)
- {
- if((mtIn->majortype == *sudPinTypesIn[i].clsMajorType) &&
- (mtIn->subtype == *sudPinTypesIn[i].clsMinorType))
- return S_OK;
- }
+ for (int i=0; i<sizeof(sudPinTypesIn)/sizeof(AMOVIESETUP_MEDIATYPE); i++)
+ {
+ if ((mtIn->majortype == *sudPinTypesIn[i].clsMajorType) &&
+ (mtIn->subtype == *sudPinTypesIn[i].clsMinorType))
+ return S_OK;
+ }
- return VFW_E_TYPE_NOT_ACCEPTED;
+ return VFW_E_TYPE_NOT_ACCEPTED;
}
bool CMPCVideoDecFilter::IsMultiThreadSupported(int nCodec)
{
- return (nCodec == CODEC_ID_H264);
+ return (nCodec==CODEC_ID_H264);
}
-HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt)
+HRESULT CMPCVideoDecFilter::SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt)
{
- int nNewCodec;
-
- if(direction == PINDIR_INPUT)
- {
- nNewCodec = FindCodec(pmt);
- if(nNewCodec == -1) return VFW_E_TYPE_NOT_ACCEPTED;
-
- if(nNewCodec != m_nCodecNb)
- {
- m_nCodecNb = nNewCodec;
-
- m_bReorderBFrame = true;
- m_pAVCodec = avcodec_find_decoder(ffCodecs[nNewCodec].nFFCodec);
- CheckPointer(m_pAVCodec, VFW_E_UNSUPPORTED_VIDEO);
+ int nNewCodec;
- m_pAVCtx = avcodec_alloc_context();
- CheckPointer(m_pAVCtx, E_POINTER);
-
- if((m_nThreadNumber > 1) && IsMultiThreadSupported(ffCodecs[m_nCodecNb].nFFCodec))
- FFSetThreadNumber(m_pAVCtx, m_nThreadNumber);
- m_pFrame = avcodec_alloc_frame();
- CheckPointer(m_pFrame, E_POINTER);
-
- if(pmt->formattype == FORMAT_VideoInfo)
- {
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
- m_pAVCtx->width = vih->bmiHeader.biWidth;
- m_pAVCtx->height = abs(vih->bmiHeader.biHeight);
- m_pAVCtx->codec_tag = vih->bmiHeader.biCompression;
- }
- else if(pmt->formattype == FORMAT_VideoInfo2)
- {
- VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)pmt->pbFormat;
- m_pAVCtx->width = vih2->bmiHeader.biWidth;
- m_pAVCtx->height = abs(vih2->bmiHeader.biHeight);
- m_pAVCtx->codec_tag = vih2->bmiHeader.biCompression;
- }
- else if(pmt->formattype == FORMAT_MPEGVideo)
- {
- MPEG1VIDEOINFO* mpgv = (MPEG1VIDEOINFO*)pmt->pbFormat;
- m_pAVCtx->width = mpgv->hdr.bmiHeader.biWidth;
- m_pAVCtx->height = abs(mpgv->hdr.bmiHeader.biHeight);
- m_pAVCtx->codec_tag = mpgv->hdr.bmiHeader.biCompression;
- }
- else if(pmt->formattype == FORMAT_MPEG2Video)
- {
- MPEG2VIDEOINFO* mpg2v = (MPEG2VIDEOINFO*)pmt->pbFormat;
- m_pAVCtx->width = mpg2v->hdr.bmiHeader.biWidth;
- m_pAVCtx->height = abs(mpg2v->hdr.bmiHeader.biHeight);
- m_pAVCtx->codec_tag = mpg2v->hdr.bmiHeader.biCompression;
-
- if(mpg2v->hdr.bmiHeader.biCompression == NULL)
- {
- m_pAVCtx->codec_tag = pmt->subtype.Data1;
- }
- else if((m_pAVCtx->codec_tag == MAKEFOURCC('a', 'v', 'c', '1')) || (m_pAVCtx->codec_tag == MAKEFOURCC('A', 'V', 'C', '1')))
- {
- m_pAVCtx->nal_length_size = mpg2v->dwFlags;
- m_bReorderBFrame = false;
- }
- }
- m_nWidth = m_pAVCtx->width;
- m_nHeight = m_pAVCtx->height;
-
- m_pAVCtx->intra_matrix = (uint16_t*)calloc(sizeof(uint16_t), 64);
- m_pAVCtx->inter_matrix = (uint16_t*)calloc(sizeof(uint16_t), 64);
- m_pAVCtx->codec_tag = ffCodecs[nNewCodec].fourcc;
- m_pAVCtx->workaround_bugs = m_nWorkaroundBug;
- m_pAVCtx->error_concealment = m_nErrorConcealment;
- m_pAVCtx->error_recognition = m_nErrorRecognition;
- m_pAVCtx->idct_algo = m_nIDCTAlgo;
- m_pAVCtx->skip_loop_filter = (AVDiscard)m_nDiscardMode;
- m_pAVCtx->dsp_mask = FF_MM_FORCE | m_pCpuId->GetFeatures();
-
- m_pAVCtx->postgain = 1.0f;
- m_pAVCtx->debug_mv = 0;
-#ifdef _DEBUG
- //m_pAVCtx->debug = FF_DEBUG_PICT_INFO | FF_DEBUG_STARTCODE | FF_DEBUG_PTS;
-#endif
-
- m_pAVCtx->opaque = this;
- m_pAVCtx->get_buffer = get_buffer;
+ if (direction == PINDIR_INPUT)
+ {
+ nNewCodec = FindCodec(pmt);
+ if (nNewCodec == -1) return VFW_E_TYPE_NOT_ACCEPTED;
- AllocExtradata(m_pAVCtx, pmt);
- ConnectTo(m_pAVCtx);
- CalcAvgTimePerFrame();
+ if (nNewCodec != m_nCodecNb)
+ {
+ m_nCodecNb = nNewCodec;
- if(avcodec_open(m_pAVCtx, m_pAVCodec) < 0)
- return VFW_E_INVALIDMEDIATYPE;
+ m_bReorderBFrame = true;
+ m_pAVCodec = avcodec_find_decoder(ffCodecs[nNewCodec].nFFCodec);
+ CheckPointer (m_pAVCodec, VFW_E_UNSUPPORTED_VIDEO);
- switch(ffCodecs[m_nCodecNb].nFFCodec)
- {
- case CODEC_ID_H264 :
- int nCompat;
- nCompat = FFH264CheckCompatibility(PictWidthRounded(), PictHeightRounded(), m_pAVCtx, (BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size, m_nPCIVendor, m_VideoDriverVersion);
+ m_pAVCtx = avcodec_alloc_context();
+ CheckPointer (m_pAVCtx, E_POINTER);
- if(nCompat > 0)
- {
- switch(m_nDXVACheckCompatibility)
- {
- case 0 :
- m_bDXVACompatible = false;
- break;
- case 1 :
- if(nCompat == 2) m_bDXVACompatible = false;
- break;
- case 2 :
- if(nCompat == 1) m_bDXVACompatible = false;
- break;
- }
- }
- break;
- case CODEC_ID_MPEG2VIDEO :
- // DSP is disable for DXVA decoding (to keep default idct_permutation)
- m_pAVCtx->dsp_mask ^= FF_MM_FORCE;
- break;
- }
+ if ((m_nThreadNumber > 1) && IsMultiThreadSupported (ffCodecs[m_nCodecNb].nFFCodec))
+ FFSetThreadNumber(m_pAVCtx, m_nThreadNumber);
+ m_pFrame = avcodec_alloc_frame();
+ CheckPointer (m_pFrame, E_POINTER);
- // Force single thread for DXVA !
- if(IsDXVASupported())
- FFSetThreadNumber(m_pAVCtx, 1);
+ if(pmt->formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+ m_pAVCtx->width = vih->bmiHeader.biWidth;
+ m_pAVCtx->height = abs(vih->bmiHeader.biHeight);
+ m_pAVCtx->codec_tag = vih->bmiHeader.biCompression;
+ }
+ else if(pmt->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)pmt->pbFormat;
+ m_pAVCtx->width = vih2->bmiHeader.biWidth;
+ m_pAVCtx->height = abs(vih2->bmiHeader.biHeight);
+ m_pAVCtx->codec_tag = vih2->bmiHeader.biCompression;
+ }
+ else if(pmt->formattype == FORMAT_MPEGVideo)
+ {
+ MPEG1VIDEOINFO* mpgv = (MPEG1VIDEOINFO*)pmt->pbFormat;
+ m_pAVCtx->width = mpgv->hdr.bmiHeader.biWidth;
+ m_pAVCtx->height = abs(mpgv->hdr.bmiHeader.biHeight);
+ m_pAVCtx->codec_tag = mpgv->hdr.bmiHeader.biCompression;
+ }
+ else if(pmt->formattype == FORMAT_MPEG2Video)
+ {
+ MPEG2VIDEOINFO* mpg2v = (MPEG2VIDEOINFO*)pmt->pbFormat;
+ m_pAVCtx->width = mpg2v->hdr.bmiHeader.biWidth;
+ m_pAVCtx->height = abs(mpg2v->hdr.bmiHeader.biHeight);
+ m_pAVCtx->codec_tag = mpg2v->hdr.bmiHeader.biCompression;
+
+ if (mpg2v->hdr.bmiHeader.biCompression == NULL)
+ {
+ m_pAVCtx->codec_tag = pmt->subtype.Data1;
+ }
+ else if ( (m_pAVCtx->codec_tag == MAKEFOURCC('a','v','c','1')) || (m_pAVCtx->codec_tag == MAKEFOURCC('A','V','C','1')))
+ {
+ m_pAVCtx->nal_length_size = mpg2v->dwFlags;
+ m_bReorderBFrame = false;
+ }
+ }
+ m_nWidth = m_pAVCtx->width;
+ m_nHeight = m_pAVCtx->height;
+
+ m_pAVCtx->intra_matrix = (uint16_t*)calloc(sizeof(uint16_t),64);
+ m_pAVCtx->inter_matrix = (uint16_t*)calloc(sizeof(uint16_t),64);
+ m_pAVCtx->codec_tag = ffCodecs[nNewCodec].fourcc;
+ m_pAVCtx->workaround_bugs = m_nWorkaroundBug;
+ m_pAVCtx->error_concealment = m_nErrorConcealment;
+ m_pAVCtx->error_recognition = m_nErrorRecognition;
+ m_pAVCtx->idct_algo = m_nIDCTAlgo;
+ m_pAVCtx->skip_loop_filter = (AVDiscard)m_nDiscardMode;
+ m_pAVCtx->dsp_mask = FF_MM_FORCE | m_pCpuId->GetFeatures();
+
+ m_pAVCtx->postgain = 1.0f;
+ m_pAVCtx->debug_mv = 0;
+ #ifdef _DEBUG
+ //m_pAVCtx->debug = FF_DEBUG_PICT_INFO | FF_DEBUG_STARTCODE | FF_DEBUG_PTS;
+ #endif
+
+ m_pAVCtx->opaque = this;
+ m_pAVCtx->get_buffer = get_buffer;
+
+ AllocExtradata (m_pAVCtx, pmt);
+ ConnectTo (m_pAVCtx);
+ CalcAvgTimePerFrame();
+
+ if (avcodec_open(m_pAVCtx, m_pAVCodec)<0)
+ return VFW_E_INVALIDMEDIATYPE;
+
+ switch (ffCodecs[m_nCodecNb].nFFCodec)
+ {
+ case CODEC_ID_H264 :
+ int nCompat;
+ nCompat = FFH264CheckCompatibility (PictWidthRounded(), PictHeightRounded(), m_pAVCtx, (BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size, m_nPCIVendor, m_VideoDriverVersion);
+
+ if(nCompat>0)
+ {
+ switch(m_nDXVACheckCompatibility)
+ {
+ case 0 :
+ m_bDXVACompatible = false;
+ break;
+ case 1 :
+ if(nCompat == 2) m_bDXVACompatible = false;
+ break;
+ case 2 :
+ if(nCompat == 1) m_bDXVACompatible = false;
+ break;
+ }
+ }
+ break;
+ case CODEC_ID_MPEG2VIDEO :
+ // DSP is disable for DXVA decoding (to keep default idct_permutation)
+ m_pAVCtx->dsp_mask ^= FF_MM_FORCE;
+ break;
+ }
+
+ // Force single thread for DXVA !
+ if (IsDXVASupported())
+ FFSetThreadNumber(m_pAVCtx, 1);
- BuildDXVAOutputFormat();
- }
- }
+ BuildDXVAOutputFormat();
+ }
+ }
- return __super::SetMediaType(direction, pmt);
+ return __super::SetMediaType(direction, pmt);
}
VIDEO_OUTPUT_FORMATS DXVAFormats[] =
{
- {&MEDIASUBTYPE_NV12, 1, 12, 'avxd'}, // DXVA2
- {&MEDIASUBTYPE_NV12, 1, 12, 'AVXD'},
- {&MEDIASUBTYPE_NV12, 1, 12, 'AVxD'},
- {&MEDIASUBTYPE_NV12, 1, 12, 'AvXD'}
+ {&MEDIASUBTYPE_NV12, 1, 12, 'avxd'}, // DXVA2
+ {&MEDIASUBTYPE_NV12, 1, 12, 'AVXD'},
+ {&MEDIASUBTYPE_NV12, 1, 12, 'AVxD'},
+ {&MEDIASUBTYPE_NV12, 1, 12, 'AvXD'}
};
VIDEO_OUTPUT_FORMATS SoftwareFormats[] =
{
- {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
- {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'}, // Software
- {&MEDIASUBTYPE_I420, 3, 12, '024I'},
- {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'}
+ {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
+ {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'}, // Software
+ {&MEDIASUBTYPE_I420, 3, 12, '024I'},
+ {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'}
};
bool CMPCVideoDecFilter::IsDXVASupported()
{
- if(m_nCodecNb != -1)
- {
- // Does the codec suppport DXVA ?
- if(ffCodecs[m_nCodecNb].DXVAModes != NULL)
- {
- // Enabled by user ?
- if(m_bUseDXVA)
- {
- // is the file compatible ?
- if(m_bDXVACompatible)
- {
- return true;
- }
- }
- }
- }
- return false;
+ if (m_nCodecNb != -1) {
+ // Does the codec suppport DXVA ?
+ if (ffCodecs[m_nCodecNb].DXVAModes != NULL) {
+ // Enabled by user ?
+ if (m_bUseDXVA) {
+ // is the file compatible ?
+ if (m_bDXVACompatible) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
void CMPCVideoDecFilter::BuildDXVAOutputFormat()
{
- int nPos = 0;
+ int nPos = 0;
- SAFE_DELETE_ARRAY(m_pVideoOutputFormat);
+ SAFE_DELETE_ARRAY (m_pVideoOutputFormat);
- m_nVideoOutputCount = (IsDXVASupported() ? ffCodecs[m_nCodecNb].DXVAModeCount() + countof(DXVAFormats) : 0) +
- (m_bUseFFmpeg ? countof(SoftwareFormats) : 0);
+ m_nVideoOutputCount = (IsDXVASupported() ? ffCodecs[m_nCodecNb].DXVAModeCount() + countof (DXVAFormats) : 0) +
+ (m_bUseFFmpeg ? countof(SoftwareFormats) : 0);
- m_pVideoOutputFormat = DNew VIDEO_OUTPUT_FORMATS[m_nVideoOutputCount];
+ m_pVideoOutputFormat = DNew VIDEO_OUTPUT_FORMATS[m_nVideoOutputCount];
- if(IsDXVASupported())
- {
- // Dynamic DXVA media types for DXVA1
- for(nPos = 0; nPos < ffCodecs[m_nCodecNb].DXVAModeCount(); nPos++)
- {
- m_pVideoOutputFormat[nPos].subtype = ffCodecs[m_nCodecNb].DXVAModes->Decoder[nPos];
- m_pVideoOutputFormat[nPos].biCompression = 'avxd';
- m_pVideoOutputFormat[nPos].biBitCount = 12;
- m_pVideoOutputFormat[nPos].biPlanes = 1;
- }
+ if (IsDXVASupported())
+ {
+ // Dynamic DXVA media types for DXVA1
+ for (nPos=0; nPos<ffCodecs[m_nCodecNb].DXVAModeCount(); nPos++)
+ {
+ m_pVideoOutputFormat[nPos].subtype = ffCodecs[m_nCodecNb].DXVAModes->Decoder[nPos];
+ m_pVideoOutputFormat[nPos].biCompression = 'avxd';
+ m_pVideoOutputFormat[nPos].biBitCount = 12;
+ m_pVideoOutputFormat[nPos].biPlanes = 1;
+ }
- // Static list for DXVA2
- memcpy(&m_pVideoOutputFormat[nPos], DXVAFormats, sizeof(DXVAFormats));
- nPos += countof(DXVAFormats);
- }
+ // Static list for DXVA2
+ memcpy (&m_pVideoOutputFormat[nPos], DXVAFormats, sizeof(DXVAFormats));
+ nPos += countof (DXVAFormats);
+ }
- // Software rendering
- if(m_bUseFFmpeg)
- memcpy(&m_pVideoOutputFormat[nPos], SoftwareFormats, sizeof(SoftwareFormats));
+ // Software rendering
+ if (m_bUseFFmpeg)
+ memcpy (&m_pVideoOutputFormat[nPos], SoftwareFormats, sizeof(SoftwareFormats));
}
int CMPCVideoDecFilter::GetPicEntryNumber()
{
- if(IsDXVASupported())
- return ffCodecs[m_nCodecNb].DXVAModes->PicEntryNumber;
- else
- return 0;
+ if (IsDXVASupported())
+ return ffCodecs[m_nCodecNb].DXVAModes->PicEntryNumber;
+ else
+ return 0;
}
-void CMPCVideoDecFilter::GetOutputFormats(int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats)
+void CMPCVideoDecFilter::GetOutputFormats (int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats)
{
- nNumber = m_nVideoOutputCount;
- *ppFormats = m_pVideoOutputFormat;
+ nNumber = m_nVideoOutputCount;
+ *ppFormats = m_pVideoOutputFormat;
}
void CMPCVideoDecFilter::AllocExtradata(AVCodecContext* pAVCtx, const CMediaType* pmt)
{
- const BYTE* data = NULL;
- unsigned int size = 0;
+ const BYTE* data = NULL;
+ unsigned int size = 0;
- if(pmt->formattype == FORMAT_VideoInfo)
- {
- size = pmt->cbFormat - sizeof(VIDEOINFOHEADER);
- data = size ? pmt->pbFormat + sizeof(VIDEOINFOHEADER) : NULL;
- }
- else if(pmt->formattype == FORMAT_VideoInfo2)
- {
- size = pmt->cbFormat - sizeof(VIDEOINFOHEADER2);
- data = size ? pmt->pbFormat + sizeof(VIDEOINFOHEADER2) : NULL;
- }
- else if(pmt->formattype == FORMAT_MPEGVideo)
- {
- MPEG1VIDEOINFO* mpeg1info = (MPEG1VIDEOINFO*)pmt->pbFormat;
- if(mpeg1info->cbSequenceHeader)
- {
- size = mpeg1info->cbSequenceHeader;
- data = mpeg1info->bSequenceHeader;
- }
- }
- else if(pmt->formattype == FORMAT_MPEG2Video)
- {
- MPEG2VIDEOINFO* mpeg2info = (MPEG2VIDEOINFO*)pmt->pbFormat;
- if(mpeg2info->cbSequenceHeader)
- {
- size = mpeg2info->cbSequenceHeader;
- data = (const uint8_t*)mpeg2info->dwSequenceHeader;
- }
- }
- else if(pmt->formattype == FORMAT_VorbisFormat2)
- {
- const VORBISFORMAT2 *vf2 = (const VORBISFORMAT2*)pmt->pbFormat;
- size = pmt->cbFormat - sizeof(VORBISFORMAT2);
- data = size ? pmt->pbFormat + sizeof(VORBISFORMAT2) : NULL;
- }
+ if (pmt->formattype==FORMAT_VideoInfo)
+ {
+ size = pmt->cbFormat-sizeof(VIDEOINFOHEADER);
+ data = size?pmt->pbFormat+sizeof(VIDEOINFOHEADER):NULL;
+ }
+ else if (pmt->formattype==FORMAT_VideoInfo2)
+ {
+ size = pmt->cbFormat-sizeof(VIDEOINFOHEADER2);
+ data = size?pmt->pbFormat+sizeof(VIDEOINFOHEADER2):NULL;
+ }
+ else if (pmt->formattype==FORMAT_MPEGVideo)
+ {
+ MPEG1VIDEOINFO* mpeg1info = (MPEG1VIDEOINFO*)pmt->pbFormat;
+ if (mpeg1info->cbSequenceHeader)
+ {
+ size = mpeg1info->cbSequenceHeader;
+ data = mpeg1info->bSequenceHeader;
+ }
+ }
+ else if (pmt->formattype==FORMAT_MPEG2Video)
+ {
+ MPEG2VIDEOINFO* mpeg2info = (MPEG2VIDEOINFO*)pmt->pbFormat;
+ if (mpeg2info->cbSequenceHeader)
+ {
+ size = mpeg2info->cbSequenceHeader;
+ data = (const uint8_t*)mpeg2info->dwSequenceHeader;
+ }
+ }
+ else if (pmt->formattype==FORMAT_VorbisFormat2)
+ {
+ const VORBISFORMAT2 *vf2=(const VORBISFORMAT2*)pmt->pbFormat;
+ size=pmt->cbFormat-sizeof(VORBISFORMAT2);
+ data=size?pmt->pbFormat+sizeof(VORBISFORMAT2):NULL;
+ }
- if(size)
- {
- pAVCtx->extradata_size = size;
- pAVCtx->extradata = (const unsigned char*)calloc(1, size + FF_INPUT_BUFFER_PADDING_SIZE);
- memcpy((void*)pAVCtx->extradata, data, size);
- }
+ if (size)
+ {
+ pAVCtx->extradata_size = size;
+ pAVCtx->extradata = (const unsigned char*)calloc(1,size+FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy((void*)pAVCtx->extradata, data, size);
+ }
}
HRESULT CMPCVideoDecFilter::CompleteConnect(PIN_DIRECTION direction, IPin* pReceivePin)
{
- LOG(_T("CMPCVideoDecFilter::CompleteConnect"));
+ LOG(_T("CMPCVideoDecFilter::CompleteConnect"));
- if(direction == PINDIR_INPUT && m_pOutput->IsConnected())
- {
- ReconnectOutput(m_nWidth, m_nHeight);
- }
- else if(direction == PINDIR_OUTPUT)
- {
- if(IsDXVASupported())
- {
- if(m_nDXVAMode == MODE_DXVA1)
- m_pDXVADecoder->ConfigureDXVA1();
- else if(SUCCEEDED(ConfigureDXVA2(pReceivePin)) && SUCCEEDED(SetEVRForDXVA2(pReceivePin)))
- m_nDXVAMode = MODE_DXVA2;
- }
- if(m_nDXVAMode == MODE_SOFTWARE && !FFSoftwareCheckCompatibility(m_pAVCtx))
- return VFW_E_INVALIDMEDIATYPE;
+ if (direction==PINDIR_INPUT && m_pOutput->IsConnected())
+ {
+ ReconnectOutput (m_nWidth, m_nHeight);
+ }
+ else if (direction==PINDIR_OUTPUT)
+ {
+ if (IsDXVASupported())
+ {
+ if (m_nDXVAMode == MODE_DXVA1)
+ m_pDXVADecoder->ConfigureDXVA1();
+ else if (SUCCEEDED (ConfigureDXVA2 (pReceivePin)) && SUCCEEDED (SetEVRForDXVA2 (pReceivePin)) )
+ m_nDXVAMode = MODE_DXVA2;
+ }
+ if (m_nDXVAMode == MODE_SOFTWARE && !FFSoftwareCheckCompatibility(m_pAVCtx))
+ return VFW_E_INVALIDMEDIATYPE;
- CLSID ClsidSourceFilter = GetCLSID(m_pInput->GetConnected());
- if((ClsidSourceFilter == __uuidof(CMpegSourceFilter)) || (ClsidSourceFilter == __uuidof(CMpegSplitterFilter)))
- m_bReorderBFrame = false;
- }
+ CLSID ClsidSourceFilter = GetCLSID(m_pInput->GetConnected());
+ if((ClsidSourceFilter == __uuidof(CMpegSourceFilter)) || (ClsidSourceFilter == __uuidof(CMpegSplitterFilter)))
+ m_bReorderBFrame = false;
+ }
- // Cannot use YUY2 if horizontal or vertical resolution is not even
- if(((m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_NV12) && (m_nDXVAMode == MODE_SOFTWARE)) ||
- ((m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_YUY2) && (m_pAVCtx->width & 1 || m_pAVCtx->height & 1)))
- return VFW_E_INVALIDMEDIATYPE;
+ // Cannot use YUY2 if horizontal or vertical resolution is not even
+ if ( ((m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_NV12) && (m_nDXVAMode == MODE_SOFTWARE)) ||
+ ((m_pOutput->CurrentMediaType().subtype == MEDIASUBTYPE_YUY2) && (m_pAVCtx->width&1 || m_pAVCtx->height&1)) )
+ return VFW_E_INVALIDMEDIATYPE;
- return __super::CompleteConnect(direction, pReceivePin);
+ return __super::CompleteConnect (direction, pReceivePin);
}
HRESULT CMPCVideoDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(UseDXVA2())
- {
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
+ if (UseDXVA2())
+ {
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- pProperties->cBuffers = GetPicEntryNumber();
+ pProperties->cBuffers = GetPicEntryNumber();
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
- return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR;
- }
- else
- return __super::DecideBufferSize(pAllocator, pProperties);
+ return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR;
+ }
+ else
+ return __super::DecideBufferSize (pAllocator, pProperties);
}
HRESULT CMPCVideoDecFilter::NewSegment(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
- m_nPosB = 1;
- memset(&m_BFrames, 0, sizeof(m_BFrames));
- m_rtLastStart = 0;
- m_nCountEstimated = 0;
+ CAutoLock cAutoLock(&m_csReceive);
+ m_nPosB = 1;
+ memset (&m_BFrames, 0, sizeof(m_BFrames));
+ m_rtLastStart = 0;
+ m_nCountEstimated = 0;
- ResetBuffer();
+ ResetBuffer();
- if(m_pAVCtx)
- avcodec_flush_buffers(m_pAVCtx);
+ if (m_pAVCtx)
+ avcodec_flush_buffers (m_pAVCtx);
- if(m_pDXVADecoder)
- m_pDXVADecoder->Flush();
- return __super::NewSegment(rtStart, rtStop, dRate);
+ if (m_pDXVADecoder)
+ m_pDXVADecoder->Flush();
+ return __super::NewSegment (rtStart, rtStop, dRate);
}
HRESULT CMPCVideoDecFilter::BreakConnect(PIN_DIRECTION dir)
{
- if(dir == PINDIR_INPUT)
- {
- Cleanup();
- }
+ if (dir == PINDIR_INPUT)
+ {
+ Cleanup();
+ }
- return __super::BreakConnect(dir);
+ return __super::BreakConnect (dir);
}
void CMPCVideoDecFilter::SetTypeSpecificFlags(IMediaSample* pMS)
{
- if(CComQIPtr<IMediaSample2> pMS2 = pMS)
- {
- AM_SAMPLE2_PROPERTIES props;
- if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
- {
- props.dwTypeSpecificFlags &= ~0x7f;
+ if(CComQIPtr<IMediaSample2> pMS2 = pMS)
+ {
+ AM_SAMPLE2_PROPERTIES props;
+ if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
+ {
+ props.dwTypeSpecificFlags &= ~0x7f;
- if(!m_pFrame->interlaced_frame)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
- else
- {
- if(m_pFrame->top_field_first)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
- }
+ if(!m_pFrame->interlaced_frame)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
+ else
+ {
+ if(m_pFrame->top_field_first)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
+ }
- switch(m_pFrame->pict_type)
- {
- case FF_I_TYPE :
- case FF_SI_TYPE :
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
- break;
- case FF_P_TYPE :
- case FF_SP_TYPE :
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
- break;
- default :
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
- break;
- }
+ switch (m_pFrame->pict_type)
+ {
+ case FF_I_TYPE :
+ case FF_SI_TYPE :
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
+ break;
+ case FF_P_TYPE :
+ case FF_SP_TYPE :
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
+ break;
+ default :
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
+ break;
+ }
- pMS2->SetProperties(sizeof(props), (BYTE*)&props);
- }
- }
+ pMS2->SetProperties(sizeof(props), (BYTE*)&props);
+ }
+ }
}
#if INCLUDE_MPC_VIDEO_DECODER
int CMPCVideoDecFilter::GetCspFromMediaType(GUID& subtype)
{
- if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12)
- return FF_CSP_420P | FF_CSP_FLAGS_YUV_ADJ;
- else if(subtype == MEDIASUBTYPE_YUY2)
- return FF_CSP_YUY2;
+ if (subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12)
+ return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ;
+ else if (subtype == MEDIASUBTYPE_YUY2)
+ return FF_CSP_YUY2;
// else if (subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_RGB24 || subtype == MEDIASUBTYPE_RGB565)
- ASSERT(FALSE);
- return FF_CSP_NULL;
+ ASSERT (FALSE);
+ return FF_CSP_NULL;
}
void CMPCVideoDecFilter::InitSwscale()
{
- if(m_pSwsContext == NULL)
- {
- TYCbCr2RGB_coeffs coeffs(ffYCbCr_RGB_coeff_ITUR_BT601, 0, 235, 16, 255.0, 0.0);
- int32_t swscaleTable[7];
- SwsParams params;
-
- memset(&params, 0, sizeof(params));
- if(m_pAVCtx->dsp_mask & CCpuId::MPC_MM_MMX) params.cpu |= SWS_CPU_CAPS_MMX | SWS_CPU_CAPS_MMX2;
- if(m_pAVCtx->dsp_mask & CCpuId::MPC_MM_3DNOW) params.cpu |= SWS_CPU_CAPS_3DNOW;
-
- params.methodLuma.method = params.methodChroma.method = SWS_POINT;
-
- swscaleTable[0] = int32_t(coeffs.vr_mul * 65536 + 0.5);
- swscaleTable[1] = int32_t(coeffs.ub_mul * 65536 + 0.5);
- swscaleTable[2] = int32_t(coeffs.ug_mul * 65536 + 0.5);
- swscaleTable[3] = int32_t(coeffs.vg_mul * 65536 + 0.5);
- swscaleTable[4] = int32_t(coeffs.y_mul * 65536 + 0.5);
- swscaleTable[5] = int32_t(coeffs.Ysub * 65536);
- swscaleTable[6] = coeffs.RGB_add1;
-
- BITMAPINFOHEADER bihOut;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
-
- m_nOutCsp = GetCspFromMediaType(m_pOutput->CurrentMediaType().subtype);
- m_pSwsContext = sws_getContext(m_pAVCtx->width,
- m_pAVCtx->height,
- csp_ffdshow2mplayer(csp_lavc2ffdshow(m_pAVCtx->pix_fmt)),
- m_pAVCtx->width,
- m_pAVCtx->height,
- csp_ffdshow2mplayer(m_nOutCsp),
- &params,
- NULL,
- NULL,
- swscaleTable);
-
- m_pOutSize.cx = bihOut.biWidth;
- m_pOutSize.cy = abs(bihOut.biHeight);
- }
+ if (m_pSwsContext == NULL)
+ {
+ TYCbCr2RGB_coeffs coeffs(ffYCbCr_RGB_coeff_ITUR_BT601,0, 235, 16, 255.0, 0.0);
+ int32_t swscaleTable[7];
+ SwsParams params;
+
+ memset(&params,0,sizeof(params));
+ if (m_pAVCtx->dsp_mask & CCpuId::MPC_MM_MMX) params.cpu |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
+ if (m_pAVCtx->dsp_mask & CCpuId::MPC_MM_3DNOW) params.cpu |= SWS_CPU_CAPS_3DNOW;
+
+ params.methodLuma.method=params.methodChroma.method=SWS_POINT;
+
+ swscaleTable[0] = int32_t(coeffs.vr_mul * 65536 + 0.5);
+ swscaleTable[1] = int32_t(coeffs.ub_mul * 65536 + 0.5);
+ swscaleTable[2] = int32_t(coeffs.ug_mul * 65536 + 0.5);
+ swscaleTable[3] = int32_t(coeffs.vg_mul * 65536 + 0.5);
+ swscaleTable[4] = int32_t(coeffs.y_mul * 65536 + 0.5);
+ swscaleTable[5] = int32_t(coeffs.Ysub * 65536);
+ swscaleTable[6] = coeffs.RGB_add1;
+
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ m_nOutCsp = GetCspFromMediaType(m_pOutput->CurrentMediaType().subtype);
+ m_pSwsContext = sws_getContext(m_pAVCtx->width,
+ m_pAVCtx->height,
+ csp_ffdshow2mplayer(csp_lavc2ffdshow(m_pAVCtx->pix_fmt)),
+ m_pAVCtx->width,
+ m_pAVCtx->height,
+ csp_ffdshow2mplayer(m_nOutCsp),
+ &params,
+ NULL,
+ NULL,
+ swscaleTable);
+
+ m_pOutSize.cx = bihOut.biWidth;
+ m_pOutSize.cy = abs(bihOut.biHeight);
+ }
}
template<class T> inline T odd2even(T x)
{
- return x & 1 ?
- x + 1 :
- x;
+ return x&1 ?
+ x + 1 :
+ x;
}
#endif /* INCLUDE_MPC_VIDEO_DECODER */
HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int nSize, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
{
- HRESULT hr;
- int got_picture;
- int used_bytes;
+ HRESULT hr;
+ int got_picture;
+ int used_bytes;
- while(nSize > 0)
- {
- if(nSize + FF_INPUT_BUFFER_PADDING_SIZE > m_nFFBufferSize)
- {
- m_nFFBufferSize = nSize + FF_INPUT_BUFFER_PADDING_SIZE;
- m_pFFBuffer = (BYTE*)realloc(m_pFFBuffer, m_nFFBufferSize);
- }
-
- // 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>
- // Note: If the first 23 bits of the additional bytes are not 0, then damaged
- // MPEG bitstreams could cause overread and segfault.
- memcpy(m_pFFBuffer, pDataIn, nSize);
- memset(m_pFFBuffer + nSize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ while (nSize > 0)
+ {
+ if (nSize+FF_INPUT_BUFFER_PADDING_SIZE > m_nFFBufferSize)
+ {
+ m_nFFBufferSize = nSize+FF_INPUT_BUFFER_PADDING_SIZE;
+ m_pFFBuffer = (BYTE*)realloc(m_pFFBuffer, m_nFFBufferSize);
+ }
- used_bytes = avcodec_decode_video(m_pAVCtx, m_pFrame, &got_picture, m_pFFBuffer, nSize);
- if(!got_picture || !m_pFrame->data[0]) return S_OK;
- if(pIn->IsPreroll() == S_OK || rtStart < 0) return S_OK;
+ // 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>
+ // Note: If the first 23 bits of the additional bytes are not 0, then damaged
+ // MPEG bitstreams could cause overread and segfault.
+ memcpy(m_pFFBuffer, pDataIn, nSize);
+ memset(m_pFFBuffer+nSize,0,FF_INPUT_BUFFER_PADDING_SIZE);
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
+ used_bytes = avcodec_decode_video (m_pAVCtx, m_pFrame, &got_picture, m_pFFBuffer, nSize);
+ if (!got_picture || !m_pFrame->data[0]) return S_OK;
+ if(pIn->IsPreroll() == S_OK || rtStart < 0) return S_OK;
- UpdateAspectRatio();
- if(FAILED(hr = GetDeliveryBuffer(m_pAVCtx->width, m_pAVCtx->height, &pOut)) || FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
- rtStart = m_pFrame->reordered_opaque;
- rtStop = m_pFrame->reordered_opaque + m_rtAvrTimePerFrame;
- ReorderBFrames(rtStart, rtStop);
+ UpdateAspectRatio();
+ if(FAILED(hr = GetDeliveryBuffer(m_pAVCtx->width, m_pAVCtx->height, &pOut)) || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ rtStart = m_pFrame->reordered_opaque;
+ rtStop = m_pFrame->reordered_opaque + m_rtAvrTimePerFrame;
+ ReorderBFrames(rtStart, rtStop);
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
#if INCLUDE_MPC_VIDEO_DECODER
- if(m_pSwsContext == NULL) InitSwscale();
+ if (m_pSwsContext == NULL) InitSwscale();
- // TODO : quick and dirty patch to fix convertion to YUY2 with swscale
- if(m_nOutCsp == FF_CSP_YUY2)
- CopyBuffer(pDataOut, m_pFrame->data, m_pAVCtx->width, m_pAVCtx->height, m_pFrame->linesize[0], MEDIASUBTYPE_I420, false);
+ // TODO : quick and dirty patch to fix convertion to YUY2 with swscale
+ if (m_nOutCsp == FF_CSP_YUY2)
+ CopyBuffer(pDataOut, m_pFrame->data, m_pAVCtx->width, m_pAVCtx->height, m_pFrame->linesize[0], MEDIASUBTYPE_I420, false);
- else if(m_pSwsContext != NULL)
- {
- uint8_t* dst[4];
- stride_t srcStride[4];
- stride_t dstStride[4];
+ else if (m_pSwsContext != NULL)
+ {
+ uint8_t* dst[4];
+ stride_t srcStride[4];
+ stride_t dstStride[4];
- const TcspInfo *outcspInfo = csp_getInfo(m_nOutCsp);
- for(int i = 0; i < 4; i++)
- {
- srcStride[i] = (stride_t)m_pFrame->linesize[i];
- dstStride[i] = m_pOutSize.cx >> outcspInfo->shiftX[i];
- if(i == 0)
- dst[i] = pDataOut;
- else
- dst[i] = dst[i-1] + dstStride[i-1] * (m_pOutSize.cy >> outcspInfo->shiftY[i-1]);
- }
+ const TcspInfo *outcspInfo=csp_getInfo(m_nOutCsp);
+ for (int i=0;i<4;i++)
+ {
+ srcStride[i]=(stride_t)m_pFrame->linesize[i];
+ dstStride[i]=m_pOutSize.cx>>outcspInfo->shiftX[i];
+ if (i==0)
+ dst[i]=pDataOut;
+ else
+ dst[i]=dst[i-1]+dstStride[i-1]*(m_pOutSize.cy>>outcspInfo->shiftY[i-1]);
+ }
- int nTempCsp = m_nOutCsp;
- if(outcspInfo->id == FF_CSP_420P)
- csp_yuv_adj_to_plane(nTempCsp, outcspInfo, odd2even(m_pOutSize.cy), (unsigned char**)dst, dstStride);
- else
- csp_yuv_adj_to_plane(nTempCsp, outcspInfo, m_pAVCtx->height, (unsigned char**)dst, dstStride);
+ int nTempCsp = m_nOutCsp;
+ if(outcspInfo->id==FF_CSP_420P)
+ csp_yuv_adj_to_plane(nTempCsp,outcspInfo,odd2even(m_pOutSize.cy),(unsigned char**)dst,dstStride);
+ else
+ csp_yuv_adj_to_plane(nTempCsp,outcspInfo,m_pAVCtx->height,(unsigned char**)dst,dstStride);
- sws_scale_ordered(m_pSwsContext, m_pFrame->data, srcStride, 0, m_pAVCtx->height, dst, dstStride);
- }
+ sws_scale_ordered (m_pSwsContext, m_pFrame->data, srcStride, 0, m_pAVCtx->height, dst, dstStride);
+ }
#endif /* INCLUDE_MPC_VIDEO_DECODER */
#if defined(_DEBUG) && 0
- static REFERENCE_TIME rtLast = 0;
- TRACE("Deliver : %10I64d - %10I64d (%10I64d) {%10I64d}\n", rtStart, rtStop,
- rtStop - rtStart, rtStart - rtLast);
- rtLast = rtStart;
+ static REFERENCE_TIME rtLast = 0;
+ TRACE ("Deliver : %10I64d - %10I64d (%10I64d) {%10I64d}\n", rtStart, rtStop,
+ rtStop - rtStart, rtStart - rtLast);
+ rtLast = rtStart;
#endif
- SetTypeSpecificFlags(pOut);
- hr = m_pOutput->Deliver(pOut);
+ SetTypeSpecificFlags (pOut);
+ hr = m_pOutput->Deliver(pOut);
- nSize -= used_bytes;
- pDataIn += used_bytes;
- }
+ nSize -= used_bytes;
+ pDataIn += used_bytes;
+ }
- return hr;
+ return hr;
}
/*
@@ -1640,7 +1630,7 @@ void CMPCVideoDecFilter::FindStartCodeH264 (BYTE** pDataIn, int& nSize)
// return;
// }
// }
- //}
+ //}
//DWORD dw = 0;
@@ -1660,322 +1650,322 @@ void CMPCVideoDecFilter::FindStartCodeH264 (BYTE** pDataIn, int& nSize)
bool CMPCVideoDecFilter::FindPicture(int nIndex, int nStartCode)
{
- DWORD dw = 0;
-
- for(int i = 0; i < m_nFFBufferPos - nIndex; i++)
- {
- dw = (dw << 8) + m_pFFBuffer[i+nIndex];
- if(i >= 4)
- {
- if(m_nFFPicEnd == INT_MIN)
- {
- if((dw & 0xffffff00) == 0x00000100 &&
- (dw & 0x000000FF) == nStartCode)
- {
- m_nFFPicEnd = i + nIndex - 3;
- }
- }
- else
- {
- if((dw & 0xffffff00) == 0x00000100 &&
- ((dw & 0x000000FF) == nStartCode || (dw & 0x000000FF) == 0xB3))
- {
- m_nFFPicEnd = i + nIndex - 3;
- return true;
- }
- }
- }
+ DWORD dw = 0;
- }
+ for (int i=0; i<m_nFFBufferPos-nIndex; i++)
+ {
+ dw = (dw<<8) + m_pFFBuffer[i+nIndex];
+ if (i >= 4)
+ {
+ if (m_nFFPicEnd == INT_MIN)
+ {
+ if ( (dw & 0xffffff00) == 0x00000100 &&
+ (dw & 0x000000FF) == nStartCode )
+ {
+ m_nFFPicEnd = i+nIndex-3;
+ }
+ }
+ else
+ {
+ if ( (dw & 0xffffff00) == 0x00000100 &&
+ ( (dw & 0x000000FF) == nStartCode || (dw & 0x000000FF) == 0xB3 ))
+ {
+ m_nFFPicEnd = i+nIndex-3;
+ return true;
+ }
+ }
+ }
+
+ }
- return false;
+ return false;
}
void CMPCVideoDecFilter::ResetBuffer()
{
- m_nFFBufferPos = 0;
- m_nFFPicEnd = INT_MIN;
+ m_nFFBufferPos = 0;
+ m_nFFPicEnd = INT_MIN;
- for(int i = 0; i < MAX_BUFF_TIME; i++)
- {
- m_FFBufferTime[i].nBuffPos = INT_MIN;
- m_FFBufferTime[i].rtStart = _I64_MIN;
- m_FFBufferTime[i].rtStop = _I64_MIN;
- }
+ for (int i=0; i<MAX_BUFF_TIME; i++)
+ {
+ m_FFBufferTime[i].nBuffPos = INT_MIN;
+ m_FFBufferTime[i].rtStart = _I64_MIN;
+ m_FFBufferTime[i].rtStop = _I64_MIN;
+ }
}
void CMPCVideoDecFilter::PushBufferTime(int nPos, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
{
- for(int i = 0; i < MAX_BUFF_TIME; i++)
- {
- if(m_FFBufferTime[i].nBuffPos == INT_MIN)
- {
- m_FFBufferTime[i].nBuffPos = nPos;
- m_FFBufferTime[i].rtStart = rtStart;
- m_FFBufferTime[i].rtStop = rtStop;
- break;
- }
- }
+ for (int i=0; i<MAX_BUFF_TIME; i++)
+ {
+ if (m_FFBufferTime[i].nBuffPos == INT_MIN)
+ {
+ m_FFBufferTime[i].nBuffPos = nPos;
+ m_FFBufferTime[i].rtStart = rtStart;
+ m_FFBufferTime[i].rtStop = rtStop;
+ break;
+ }
+ }
}
void CMPCVideoDecFilter::PopBufferTime(int nPos)
{
- int nDestPos = 0;
- int i = 0;
+ int nDestPos = 0;
+ int i = 0;
- // Shift buffer time list
- while(i < MAX_BUFF_TIME && m_FFBufferTime[i].nBuffPos != INT_MIN)
- {
- if(m_FFBufferTime[i].nBuffPos >= nPos)
- {
- m_FFBufferTime[nDestPos].nBuffPos = m_FFBufferTime[i].nBuffPos - nPos;
- m_FFBufferTime[nDestPos].rtStart = m_FFBufferTime[i].rtStart;
- m_FFBufferTime[nDestPos].rtStop = m_FFBufferTime[i].rtStop;
- nDestPos++;
- }
- i++;
- }
+ // Shift buffer time list
+ while (i<MAX_BUFF_TIME && m_FFBufferTime[i].nBuffPos!=INT_MIN)
+ {
+ if (m_FFBufferTime[i].nBuffPos >= nPos)
+ {
+ m_FFBufferTime[nDestPos].nBuffPos = m_FFBufferTime[i].nBuffPos - nPos;
+ m_FFBufferTime[nDestPos].rtStart = m_FFBufferTime[i].rtStart;
+ m_FFBufferTime[nDestPos].rtStop = m_FFBufferTime[i].rtStop;
+ nDestPos++;
+ }
+ i++;
+ }
- // Free unused slots
- for(i = nDestPos; i < MAX_BUFF_TIME; i++)
- {
- m_FFBufferTime[i].nBuffPos = INT_MIN;
- m_FFBufferTime[i].rtStart = _I64_MIN;
- m_FFBufferTime[i].rtStop = _I64_MIN;
- }
+ // Free unused slots
+ for (i=nDestPos; i<MAX_BUFF_TIME; i++)
+ {
+ m_FFBufferTime[i].nBuffPos = INT_MIN;
+ m_FFBufferTime[i].rtStart = _I64_MIN;
+ m_FFBufferTime[i].rtStop = _I64_MIN;
+ }
}
-bool CMPCVideoDecFilter::AppendBuffer(BYTE* pDataIn, int nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+bool CMPCVideoDecFilter::AppendBuffer (BYTE* pDataIn, int nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
{
- if(rtStart != _I64_MIN)
- PushBufferTime(m_nFFBufferPos, rtStart, rtStop);
+ if (rtStart != _I64_MIN)
+ PushBufferTime (m_nFFBufferPos, rtStart, rtStop);
- if(m_nFFBufferPos + nSize + FF_INPUT_BUFFER_PADDING_SIZE > m_nFFBufferSize)
- {
- m_nFFBufferSize = m_nFFBufferPos + nSize + FF_INPUT_BUFFER_PADDING_SIZE;
- m_pFFBuffer = (BYTE*)realloc(m_pFFBuffer, m_nFFBufferSize);
- }
+ if (m_nFFBufferPos+nSize+FF_INPUT_BUFFER_PADDING_SIZE > m_nFFBufferSize)
+ {
+ m_nFFBufferSize = m_nFFBufferPos+nSize+FF_INPUT_BUFFER_PADDING_SIZE;
+ m_pFFBuffer = (BYTE*)realloc(m_pFFBuffer, m_nFFBufferSize);
+ }
- memcpy(m_pFFBuffer + m_nFFBufferPos, pDataIn, nSize);
+ memcpy(m_pFFBuffer+m_nFFBufferPos, pDataIn, nSize);
- m_nFFBufferPos += nSize;
+ m_nFFBufferPos += nSize;
- return true;
+ return true;
}
void CMPCVideoDecFilter::ShrinkBuffer()
{
- int nRemaining = m_nFFBufferPos - m_nFFPicEnd;
+ int nRemaining = m_nFFBufferPos-m_nFFPicEnd;
- ASSERT(m_nFFPicEnd != INT_MIN);
+ ASSERT (m_nFFPicEnd != INT_MIN);
- PopBufferTime(m_nFFPicEnd);
- memcpy(m_pFFBuffer, m_pFFBuffer + m_nFFPicEnd, nRemaining);
- m_nFFBufferPos = nRemaining;
+ PopBufferTime (m_nFFPicEnd);
+ memcpy (m_pFFBuffer, m_pFFBuffer+m_nFFPicEnd, nRemaining);
+ m_nFFBufferPos = nRemaining;
- m_nFFPicEnd = (m_pFFBuffer[3] == 0x00) ? 0 : INT_MIN;
+ m_nFFPicEnd = (m_pFFBuffer[3] == 0x00) ? 0 : INT_MIN;
}
HRESULT CMPCVideoDecFilter::Transform(IMediaSample* pIn)
{
- CAutoLock cAutoLock(&m_csReceive);
- HRESULT hr;
- BYTE* pDataIn;
- int nSize;
- REFERENCE_TIME rtStart = _I64_MIN;
- REFERENCE_TIME rtStop = _I64_MIN;
-
- if(FAILED(hr = pIn->GetPointer(&pDataIn)))
- return hr;
-
- nSize = pIn->GetActualDataLength();
- pIn->GetTime(&rtStart, &rtStop);
-
- // FIXE THIS PART TO EVO_SUPPORT (insure m_rtAvrTimePerFrame is not estimated if not needed!!)
- //if (rtStart != _I64_MIN)
- //{
- // // Estimate rtStart/rtStop if not set by parser (EVO support)
- // if (m_nCountEstimated > 0)
- // {
- // m_rtAvrTimePerFrame = (rtStart - m_rtLastStart) / m_nCountEstimated;
-
- // ROUND_FRAMERATE (m_rtAvrTimePerFrame, 417083); // 23.97 fps
- // ROUND_FRAMERATE (m_rtAvrTimePerFrame, 333667); // 29.97 fps
- // ROUND_FRAMERATE (m_rtAvrTimePerFrame, 400000); // 25.00 fps
- // }
- // m_rtLastStart = rtStart;
- // m_nCountEstimated = 0;
- //}
- //else
- //{
- // m_nCountEstimated++;
- // rtStart = rtStop = m_rtLastStart + m_nCountEstimated*m_rtAvrTimePerFrame;
- //}
- if(rtStop <= rtStart && rtStop != _I64_MIN)
- rtStop = rtStart + m_rtAvrTimePerFrame;
-
- m_pAVCtx->reordered_opaque = rtStart;
- m_pAVCtx->reordered_opaque2 = rtStop;
-
- if(m_pAVCtx->has_b_frames)
- {
- m_BFrames[m_nPosB].rtStart = rtStart;
- m_BFrames[m_nPosB].rtStop = rtStop;
- m_nPosB = 1 - m_nPosB;
- }
+ CAutoLock cAutoLock(&m_csReceive);
+ HRESULT hr;
+ BYTE* pDataIn;
+ int nSize;
+ REFERENCE_TIME rtStart = _I64_MIN;
+ REFERENCE_TIME rtStop = _I64_MIN;
-// m_rtStart = rtStart;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
+
+ nSize = pIn->GetActualDataLength();
+ pIn->GetTime(&rtStart, &rtStop);
+
+ // FIXE THIS PART TO EVO_SUPPORT (insure m_rtAvrTimePerFrame is not estimated if not needed!!)
+ //if (rtStart != _I64_MIN)
+ //{
+ // // Estimate rtStart/rtStop if not set by parser (EVO support)
+ // if (m_nCountEstimated > 0)
+ // {
+ // m_rtAvrTimePerFrame = (rtStart - m_rtLastStart) / m_nCountEstimated;
+
+ // ROUND_FRAMERATE (m_rtAvrTimePerFrame, 417083); // 23.97 fps
+ // ROUND_FRAMERATE (m_rtAvrTimePerFrame, 333667); // 29.97 fps
+ // ROUND_FRAMERATE (m_rtAvrTimePerFrame, 400000); // 25.00 fps
+ // }
+ // m_rtLastStart = rtStart;
+ // m_nCountEstimated = 0;
+ //}
+ //else
+ //{
+ // m_nCountEstimated++;
+ // rtStart = rtStop = m_rtLastStart + m_nCountEstimated*m_rtAvrTimePerFrame;
+ //}
+ if (rtStop <= rtStart && rtStop != _I64_MIN)
+ rtStop = rtStart + m_rtAvrTimePerFrame;
+
+ m_pAVCtx->reordered_opaque = rtStart;
+ m_pAVCtx->reordered_opaque2 = rtStop;
+
+ if (m_pAVCtx->has_b_frames)
+ {
+ m_BFrames[m_nPosB].rtStart = rtStart;
+ m_BFrames[m_nPosB].rtStop = rtStop;
+ m_nPosB = 1-m_nPosB;
+ }
+// m_rtStart = rtStart;
+
// DumpBuffer (pDataIn, nSize);
// TRACE ("Receive : %10I64d - %10I64d (%10I64d) Size=%d\n", rtStart, rtStop, rtStop - rtStart, nSize);
- //char strMsg[300];
- //FILE* hFile = fopen ("d:\\receive.txt", "at");
- //sprintf (strMsg, "Receive : %10I64d - %10I64d Size=%d\n", (rtStart + m_rtAvrTimePerFrame/2) / m_rtAvrTimePerFrame, rtStart, nSize);
- //fwrite (strMsg, strlen(strMsg), 1, hFile);
- //fclose (hFile);
+ //char strMsg[300];
+ //FILE* hFile = fopen ("d:\\receive.txt", "at");
+ //sprintf (strMsg, "Receive : %10I64d - %10I64d Size=%d\n", (rtStart + m_rtAvrTimePerFrame/2) / m_rtAvrTimePerFrame, rtStart, nSize);
+ //fwrite (strMsg, strlen(strMsg), 1, hFile);
+ //fclose (hFile);
- //char strMsg[300];
- //FILE* hFile = fopen ("receive.bin", "ab");
- //fwrite (pDataIn, nSize, 1, hFile);
- //fclose (hFile);
+ //char strMsg[300];
+ //FILE* hFile = fopen ("receive.bin", "ab");
+ //fwrite (pDataIn, nSize, 1, hFile);
+ //fclose (hFile);
- switch(m_nDXVAMode)
- {
- case MODE_SOFTWARE :
- hr = SoftwareDecode(pIn, pDataIn, nSize, rtStart, rtStop);
- break;
- case MODE_DXVA1 :
- case MODE_DXVA2 :
- CheckPointer(m_pDXVADecoder, E_UNEXPECTED);
- UpdateAspectRatio();
-
- // Change aspect ratio for DXVA1
- if((m_nDXVAMode == MODE_DXVA1) &&
- ReconnectOutput(PictWidthRounded(), PictHeightRounded(), true, PictWidth(), PictHeight()) == S_OK)
- {
- m_pDXVADecoder->ConfigureDXVA1();
- }
+ switch (m_nDXVAMode)
+ {
+ case MODE_SOFTWARE :
+ hr = SoftwareDecode (pIn, pDataIn, nSize, rtStart, rtStop);
+ break;
+ case MODE_DXVA1 :
+ case MODE_DXVA2 :
+ CheckPointer (m_pDXVADecoder, E_UNEXPECTED);
+ UpdateAspectRatio();
+
+ // Change aspect ratio for DXVA1
+ if ((m_nDXVAMode == MODE_DXVA1) &&
+ ReconnectOutput(PictWidthRounded(), PictHeightRounded(), true, PictWidth(), PictHeight()) == S_OK)
+ {
+ m_pDXVADecoder->ConfigureDXVA1();
+ }
- if(m_pAVCtx->codec_id == CODEC_ID_MPEG2VIDEO)
- {
- AppendBuffer(pDataIn, nSize, rtStart, rtStop);
- hr = S_OK;
+ if (m_pAVCtx->codec_id == CODEC_ID_MPEG2VIDEO)
+ {
+ AppendBuffer (pDataIn, nSize, rtStart, rtStop);
+ hr = S_OK;
- while(FindPicture(max(m_nFFBufferPos - nSize - 4, 0), 0x00))
- {
- if(m_FFBufferTime[0].nBuffPos != INT_MIN && m_FFBufferTime[0].nBuffPos < m_nFFPicEnd)
- {
- rtStart = m_FFBufferTime[0].rtStart;
- rtStop = m_FFBufferTime[0].rtStop;
- }
- else
- rtStart = rtStop = _I64_MIN;
- hr = m_pDXVADecoder->DecodeFrame(m_pFFBuffer, m_nFFPicEnd, rtStart, rtStop);
- ShrinkBuffer();
- }
- }
- else
- {
- hr = m_pDXVADecoder->DecodeFrame(pDataIn, nSize, rtStart, rtStop);
- }
- break;
- default :
- ASSERT(FALSE);
- hr = E_UNEXPECTED;
- }
+ while (FindPicture (max (m_nFFBufferPos-nSize-4, 0), 0x00))
+ {
+ if (m_FFBufferTime[0].nBuffPos != INT_MIN && m_FFBufferTime[0].nBuffPos < m_nFFPicEnd)
+ {
+ rtStart = m_FFBufferTime[0].rtStart;
+ rtStop = m_FFBufferTime[0].rtStop;
+ }
+ else
+ rtStart = rtStop = _I64_MIN;
+ hr = m_pDXVADecoder->DecodeFrame (m_pFFBuffer, m_nFFPicEnd, rtStart, rtStop);
+ ShrinkBuffer();
+ }
+ }
+ else
+ {
+ hr = m_pDXVADecoder->DecodeFrame (pDataIn, nSize, rtStart, rtStop);
+ }
+ break;
+ default :
+ ASSERT (FALSE);
+ hr = E_UNEXPECTED;
+ }
- return hr;
+ return hr;
}
void CMPCVideoDecFilter::UpdateAspectRatio()
{
- if(((m_nARMode) && (m_pAVCtx)) && ((m_pAVCtx->sample_aspect_ratio.num > 0) && (m_pAVCtx->sample_aspect_ratio.den > 0)))
- {
- CSize SAR(m_pAVCtx->sample_aspect_ratio.num, m_pAVCtx->sample_aspect_ratio.den);
- if(m_sar != SAR)
- {
- m_sar = SAR;
- CSize aspect(m_nWidth * SAR.cx, m_nHeight * SAR.cy);
- int lnko = LNKO(aspect.cx, aspect.cy);
- if(lnko > 1) aspect.cx /= lnko, aspect.cy /= lnko;
- SetAspect(aspect);
- }
- }
+ if(((m_nARMode) && (m_pAVCtx)) && ((m_pAVCtx->sample_aspect_ratio.num>0) && (m_pAVCtx->sample_aspect_ratio.den>0)))
+ {
+ CSize SAR(m_pAVCtx->sample_aspect_ratio.num, m_pAVCtx->sample_aspect_ratio.den);
+ if(m_sar != SAR)
+ {
+ m_sar = SAR;
+ CSize aspect(m_nWidth * SAR.cx, m_nHeight * SAR.cy);
+ int lnko = LNKO(aspect.cx, aspect.cy);
+ if(lnko > 1) aspect.cx /= lnko, aspect.cy /= lnko;
+ SetAspect(aspect);
+ }
+ }
}
void CMPCVideoDecFilter::ReorderBFrames(REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
{
- // Re-order B-frames if needed
- if(m_pAVCtx->has_b_frames && m_bReorderBFrame)
- {
- rtStart = m_BFrames [m_nPosB].rtStart;
- rtStop = m_BFrames [m_nPosB].rtStop;
- }
+ // Re-order B-frames if needed
+ if (m_pAVCtx->has_b_frames && m_bReorderBFrame)
+ {
+ rtStart = m_BFrames [m_nPosB].rtStart;
+ rtStop = m_BFrames [m_nPosB].rtStop;
+ }
}
void CMPCVideoDecFilter::FillInVideoDescription(DXVA2_VideoDesc *pDesc)
{
- memset(pDesc, 0, sizeof(DXVA2_VideoDesc));
- pDesc->SampleWidth = PictWidthRounded();
- pDesc->SampleHeight = PictHeightRounded();
- pDesc->Format = D3DFMT_A8R8G8B8;
- pDesc->UABProtectionLevel = 1;
+ memset (pDesc, 0, sizeof(DXVA2_VideoDesc));
+ pDesc->SampleWidth = PictWidthRounded();
+ pDesc->SampleHeight = PictHeightRounded();
+ pDesc->Format = D3DFMT_A8R8G8B8;
+ pDesc->UABProtectionLevel = 1;
}
BOOL CMPCVideoDecFilter::IsSupportedDecoderMode(const GUID& mode)
{
- if(IsDXVASupported())
- {
- for(int i = 0; i < MAX_SUPPORTED_MODE; i++)
- {
- if(*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == GUID_NULL)
- break;
- else if(*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == mode)
- return true;
- }
- }
+ if (IsDXVASupported())
+ {
+ for (int i=0; i<MAX_SUPPORTED_MODE; i++)
+ {
+ if (*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == GUID_NULL)
+ break;
+ else if (*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == mode)
+ return true;
+ }
+ }
- return false;
+ return false;
}
BOOL CMPCVideoDecFilter::IsSupportedDecoderConfig(const D3DFORMAT nD3DFormat, const DXVA2_ConfigPictureDecode& config, bool& bIsPrefered)
{
- bool bRet = false;
+ bool bRet = false;
- bRet = (nD3DFormat == MAKEFOURCC('N', 'V', '1', '2'));
+ bRet = (nD3DFormat == MAKEFOURCC('N', 'V', '1', '2'));
- bIsPrefered = (config.ConfigBitstreamRaw == ffCodecs[m_nCodecNb].DXVAModes->PreferedConfigBitstream);
- LOG(_T("IsSupportedDecoderConfig 0x%08x %d"), nD3DFormat, bRet);
- return bRet;
+ bIsPrefered = (config.ConfigBitstreamRaw == ffCodecs[m_nCodecNb].DXVAModes->PreferedConfigBitstream);
+ LOG (_T("IsSupportedDecoderConfig 0x%08x %d"), nD3DFormat, bRet);
+ return bRet;
}
HRESULT CMPCVideoDecFilter::FindDXVA2DecoderConfiguration(IDirectXVideoDecoderService *pDecoderService,
- const GUID& guidDecoder,
- DXVA2_ConfigPictureDecode *pSelectedConfig,
- BOOL *pbFoundDXVA2Configuration)
+ const GUID& guidDecoder,
+ DXVA2_ConfigPictureDecode *pSelectedConfig,
+ BOOL *pbFoundDXVA2Configuration)
{
HRESULT hr = S_OK;
UINT cFormats = 0;
UINT cConfigurations = 0;
- bool bIsPrefered = false;
+ bool bIsPrefered = false;
D3DFORMAT *pFormats = NULL; // size = cFormats
DXVA2_ConfigPictureDecode *pConfig = NULL; // size = cConfigurations
// Find the valid render target formats for this decoder GUID.
hr = pDecoderService->GetDecoderRenderTargets(guidDecoder, &cFormats, &pFormats);
- LOG(_T("GetDecoderRenderTargets => %d"), cFormats);
+ LOG (_T("GetDecoderRenderTargets => %d"), cFormats);
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
// Look for a format that matches our output format.
- for(UINT iFormat = 0; iFormat < cFormats; iFormat++)
+ for (UINT iFormat = 0; iFormat < cFormats; iFormat++)
{
- LOG(_T("Try to negociate => 0x%08x"), pFormats[iFormat]);
+ LOG (_T("Try to negociate => 0x%08x"), pFormats[iFormat]);
// Fill in the video description. Set the width, height, format, and frame rate.
FillInVideoDescription(&m_VideoDesc); // Private helper function.
@@ -1984,24 +1974,24 @@ HRESULT CMPCVideoDecFilter::FindDXVA2DecoderConfiguration(IDirectXVideoDecoderSe
// Get the available configurations.
hr = pDecoderService->GetDecoderConfigurations(guidDecoder, &m_VideoDesc, NULL, &cConfigurations, &pConfig);
- if(FAILED(hr))
+ if (FAILED(hr))
{
continue;
}
// Find a supported configuration.
- for(UINT iConfig = 0; iConfig < cConfigurations; iConfig++)
+ for (UINT iConfig = 0; iConfig < cConfigurations; iConfig++)
{
- if(IsSupportedDecoderConfig(pFormats[iFormat], pConfig[iConfig], bIsPrefered))
+ if (IsSupportedDecoderConfig(pFormats[iFormat], pConfig[iConfig], bIsPrefered))
{
// This configuration is good.
- if(bIsPrefered || !*pbFoundDXVA2Configuration)
- {
- *pbFoundDXVA2Configuration = TRUE;
- *pSelectedConfig = pConfig[iConfig];
- }
-
- if(bIsPrefered) break;
+ if (bIsPrefered || !*pbFoundDXVA2Configuration)
+ {
+ *pbFoundDXVA2Configuration = TRUE;
+ *pSelectedConfig = pConfig[iConfig];
+ }
+
+ if (bIsPrefered) break;
}
}
@@ -2036,55 +2026,55 @@ HRESULT CMPCVideoDecFilter::ConfigureDXVA2(IPin *pPin)
hr = pPin->QueryInterface(__uuidof(IMFGetService), (void**)&pGetService);
// Get the Direct3D device manager.
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
hr = pGetService->GetService(
- MR_VIDEO_ACCELERATION_SERVICE,
- __uuidof(IDirect3DDeviceManager9),
- (void**)&pDeviceManager);
+ MR_VIDEO_ACCELERATION_SERVICE,
+ __uuidof(IDirect3DDeviceManager9),
+ (void**)&pDeviceManager);
}
// Open a new device handle.
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
hr = pDeviceManager->OpenDeviceHandle(&hDevice);
- }
+ }
// Get the video decoder service.
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
hr = pDeviceManager->GetVideoService(
- hDevice,
- __uuidof(IDirectXVideoDecoderService),
- (void**)&pDecoderService);
+ hDevice,
+ __uuidof(IDirectXVideoDecoderService),
+ (void**)&pDecoderService);
}
// Get the decoder GUIDs.
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
hr = pDecoderService->GetDecoderDeviceGuids(&cDecoderGuids, &pDecoderGuids);
}
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
// Look for the decoder GUIDs we want.
- for(UINT iGuid = 0; iGuid < cDecoderGuids; iGuid++)
+ for (UINT iGuid = 0; iGuid < cDecoderGuids; iGuid++)
{
// Do we support this mode?
- if(!IsSupportedDecoderMode(pDecoderGuids[iGuid]))
+ if (!IsSupportedDecoderMode(pDecoderGuids[iGuid]))
{
continue;
}
- // Find a configuration that we support.
+ // Find a configuration that we support.
hr = FindDXVA2DecoderConfiguration(pDecoderService, pDecoderGuids[iGuid], &config, &bFoundDXVA2Configuration);
- if(FAILED(hr))
+ if (FAILED(hr))
{
break;
}
- if(bFoundDXVA2Configuration)
+ if (bFoundDXVA2Configuration)
{
// Found a good configuration. Save the GUID.
guidDecoder = pDecoderGuids[iGuid];
@@ -2092,16 +2082,16 @@ HRESULT CMPCVideoDecFilter::ConfigureDXVA2(IPin *pPin)
}
}
- if(pDecoderGuids) CoTaskMemFree(pDecoderGuids);
- if(!bFoundDXVA2Configuration)
+ if (pDecoderGuids) CoTaskMemFree(pDecoderGuids);
+ if (!bFoundDXVA2Configuration)
{
hr = E_FAIL; // Unable to find a configuration.
}
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
// Store the things we will need later.
- m_pDeviceManager = pDeviceManager;
+ m_pDeviceManager = pDeviceManager;
m_pDecoderService = pDecoderService;
m_DXVA2Config = config;
@@ -2109,9 +2099,9 @@ HRESULT CMPCVideoDecFilter::ConfigureDXVA2(IPin *pPin)
m_hDevice = hDevice;
}
- if(FAILED(hr))
+ if (FAILED(hr))
{
- if(hDevice != INVALID_HANDLE_VALUE)
+ if (hDevice != INVALID_HANDLE_VALUE)
{
pDeviceManager->CloseDeviceHandle(hDevice);
}
@@ -2127,42 +2117,42 @@ HRESULT CMPCVideoDecFilter::SetEVRForDXVA2(IPin *pPin)
CComPtr<IMFGetService> pGetService;
CComPtr<IDirectXVideoMemoryConfiguration> pVideoConfig;
- CComPtr<IMFVideoDisplayControl> pVdc;
+ CComPtr<IMFVideoDisplayControl> pVdc;
// Query the pin for IMFGetService.
hr = pPin->QueryInterface(__uuidof(IMFGetService), (void**)&pGetService);
// Get the IDirectXVideoMemoryConfiguration interface.
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
hr = pGetService->GetService(
- MR_VIDEO_ACCELERATION_SERVICE,
- __uuidof(IDirectXVideoMemoryConfiguration),
- (void**)&pVideoConfig);
+ MR_VIDEO_ACCELERATION_SERVICE,
+ __uuidof(IDirectXVideoMemoryConfiguration),
+ (void**)&pVideoConfig);
- if(SUCCEEDED(pGetService->GetService(MR_VIDEO_RENDER_SERVICE, __uuidof(IMFVideoDisplayControl), (void**)&pVdc)))
- {
- HWND hWnd;
- if(SUCCEEDED(pVdc->GetVideoWindow(&hWnd)))
- {
- DetectVideoCard(hWnd);
- }
- }
+ if (SUCCEEDED (pGetService->GetService(MR_VIDEO_RENDER_SERVICE, __uuidof(IMFVideoDisplayControl), (void**)&pVdc)))
+ {
+ HWND hWnd;
+ if (SUCCEEDED (pVdc->GetVideoWindow(&hWnd)))
+ {
+ DetectVideoCard(hWnd);
+ }
+ }
}
- // Notify the EVR.
- if(SUCCEEDED(hr))
+ // Notify the EVR.
+ if (SUCCEEDED(hr))
{
DXVA2_SurfaceType surfaceType;
- for(DWORD iTypeIndex = 0; ; iTypeIndex++)
+ for (DWORD iTypeIndex = 0; ; iTypeIndex++)
{
hr = pVideoConfig->GetAvailableSurfaceTypeByIndex(iTypeIndex, &surfaceType);
+
+ if (FAILED(hr))
+ break;
- if(FAILED(hr))
- break;
-
- if(surfaceType == DXVA2_SurfaceType_DecoderRenderTarget)
+ if (surfaceType == DXVA2_SurfaceType_DecoderRenderTarget)
{
hr = pVideoConfig->SetSurfaceType(DXVA2_SurfaceType_DecoderRenderTarget);
break;
@@ -2176,109 +2166,109 @@ HRESULT CMPCVideoDecFilter::SetEVRForDXVA2(IPin *pPin)
HRESULT CMPCVideoDecFilter::CreateDXVA2Decoder(UINT nNumRenderTargets, IDirect3DSurface9** pDecoderRenderTargets)
{
- HRESULT hr;
- CComPtr<IDirectXVideoDecoder> pDirectXVideoDec;
+ HRESULT hr;
+ CComPtr<IDirectXVideoDecoder> pDirectXVideoDec;
+
+ m_pDecoderRenderTarget = NULL;
- m_pDecoderRenderTarget = NULL;
+ if (m_pDXVADecoder) m_pDXVADecoder->SetDirectXVideoDec (NULL);
- if(m_pDXVADecoder) m_pDXVADecoder->SetDirectXVideoDec(NULL);
+ hr = m_pDecoderService->CreateVideoDecoder (m_DXVADecoderGUID, &m_VideoDesc, &m_DXVA2Config,
+ pDecoderRenderTargets, nNumRenderTargets, &pDirectXVideoDec);
- hr = m_pDecoderService->CreateVideoDecoder(m_DXVADecoderGUID, &m_VideoDesc, &m_DXVA2Config,
- pDecoderRenderTargets, nNumRenderTargets, &pDirectXVideoDec);
-
- if(SUCCEEDED(hr))
- {
- if(!m_pDXVADecoder)
- {
- m_pDXVADecoder = CDXVADecoder::CreateDecoder(this, pDirectXVideoDec, &m_DXVADecoderGUID, GetPicEntryNumber(), &m_DXVA2Config);
- if(m_pDXVADecoder) m_pDXVADecoder->SetExtraData((BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size);
- }
+ if (SUCCEEDED (hr))
+ {
+ if (!m_pDXVADecoder)
+ {
+ m_pDXVADecoder = CDXVADecoder::CreateDecoder (this, pDirectXVideoDec, &m_DXVADecoderGUID, GetPicEntryNumber(), &m_DXVA2Config);
+ if (m_pDXVADecoder) m_pDXVADecoder->SetExtraData ((BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size);
+ }
- m_pDXVADecoder->SetDirectXVideoDec(pDirectXVideoDec);
- }
+ m_pDXVADecoder->SetDirectXVideoDec (pDirectXVideoDec);
+ }
- return hr;
+ return hr;
}
HRESULT CMPCVideoDecFilter::FindDXVA1DecoderConfiguration(IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, DDPIXELFORMAT* pPixelFormat)
{
- HRESULT hr = E_FAIL;
- DWORD dwFormats = 0;
- DDPIXELFORMAT* pPixelFormats = NULL;
+ HRESULT hr = E_FAIL;
+ DWORD dwFormats = 0;
+ DDPIXELFORMAT* pPixelFormats = NULL;
- pAMVideoAccelerator->GetUncompFormatsSupported(guidDecoder, &dwFormats, NULL);
- if(dwFormats > 0)
- {
- // Find the valid render target formats for this decoder GUID.
- pPixelFormats = DNew DDPIXELFORMAT[dwFormats];
- hr = pAMVideoAccelerator->GetUncompFormatsSupported(guidDecoder, &dwFormats, pPixelFormats);
- if(SUCCEEDED(hr))
- {
- // Look for a format that matches our output format.
- for(DWORD iFormat = 0; iFormat < dwFormats; iFormat++)
- {
- if(pPixelFormats[iFormat].dwFourCC == MAKEFOURCC('N', 'V', '1', '2'))
- {
- memcpy(pPixelFormat, &pPixelFormats[iFormat], sizeof(DDPIXELFORMAT));
- SAFE_DELETE_ARRAY(pPixelFormats)
- return S_OK;
- }
- }
+ pAMVideoAccelerator->GetUncompFormatsSupported (guidDecoder, &dwFormats, NULL);
+ if (dwFormats > 0)
+ {
+ // Find the valid render target formats for this decoder GUID.
+ pPixelFormats = DNew DDPIXELFORMAT[dwFormats];
+ hr = pAMVideoAccelerator->GetUncompFormatsSupported (guidDecoder, &dwFormats, pPixelFormats);
+ if (SUCCEEDED(hr))
+ {
+ // Look for a format that matches our output format.
+ for (DWORD iFormat = 0; iFormat < dwFormats; iFormat++)
+ {
+ if (pPixelFormats[iFormat].dwFourCC == MAKEFOURCC ('N', 'V', '1', '2'))
+ {
+ memcpy (pPixelFormat, &pPixelFormats[iFormat], sizeof(DDPIXELFORMAT));
+ SAFE_DELETE_ARRAY(pPixelFormats)
+ return S_OK;
+ }
+ }
- SAFE_DELETE_ARRAY(pPixelFormats);
- hr = E_FAIL;
- }
- }
+ SAFE_DELETE_ARRAY(pPixelFormats);
+ hr = E_FAIL;
+ }
+ }
- return hr;
+ return hr;
}
HRESULT CMPCVideoDecFilter::CheckDXVA1Decoder(const GUID *pGuid)
{
- if(m_nCodecNb != -1)
- {
- for(int i = 0; i < MAX_SUPPORTED_MODE; i++)
- if(*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == *pGuid)
- return S_OK;
- }
+ if (m_nCodecNb != -1)
+ {
+ for (int i=0; i<MAX_SUPPORTED_MODE; i++)
+ if (*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == *pGuid)
+ return S_OK;
+ }
- return E_INVALIDARG;
+ return E_INVALIDARG;
}
void CMPCVideoDecFilter::SetDXVA1Params(const GUID* pGuid, DDPIXELFORMAT* pPixelFormat)
{
- m_DXVADecoderGUID = *pGuid;
- memcpy(&m_PixelFormat, pPixelFormat, sizeof(DDPIXELFORMAT));
+ m_DXVADecoderGUID = *pGuid;
+ memcpy (&m_PixelFormat, pPixelFormat, sizeof (DDPIXELFORMAT));
}
WORD CMPCVideoDecFilter::GetDXVA1RestrictedMode()
{
- if(m_nCodecNb != -1)
- {
- for(int i = 0; i < MAX_SUPPORTED_MODE; i++)
- if(*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == m_DXVADecoderGUID)
- return ffCodecs[m_nCodecNb].DXVAModes->RestrictedMode [i];
- }
+ if (m_nCodecNb != -1)
+ {
+ for (int i=0; i<MAX_SUPPORTED_MODE; i++)
+ if (*ffCodecs[m_nCodecNb].DXVAModes->Decoder[i] == m_DXVADecoderGUID)
+ return ffCodecs[m_nCodecNb].DXVAModes->RestrictedMode [i];
+ }
- return DXVA_RESTRICTED_MODE_UNRESTRICTED;
+ return DXVA_RESTRICTED_MODE_UNRESTRICTED;
}
HRESULT CMPCVideoDecFilter::CreateDXVA1Decoder(IAMVideoAccelerator* pAMVideoAccelerator, const GUID* pDecoderGuid, DWORD dwSurfaceCount)
{
- if(m_pDXVADecoder && m_DXVADecoderGUID == *pDecoderGuid)
- return S_OK;
- SAFE_DELETE(m_pDXVADecoder);
+ if (m_pDXVADecoder && m_DXVADecoderGUID == *pDecoderGuid)
+ return S_OK;
+ SAFE_DELETE (m_pDXVADecoder);
- if(!m_bUseDXVA) return E_FAIL;
+ if (!m_bUseDXVA) return E_FAIL;
- m_nDXVAMode = MODE_DXVA1;
- m_DXVADecoderGUID = *pDecoderGuid;
- m_pDXVADecoder = CDXVADecoder::CreateDecoder(this, pAMVideoAccelerator, &m_DXVADecoderGUID, dwSurfaceCount);
- if(m_pDXVADecoder) m_pDXVADecoder->SetExtraData((BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size);
+ m_nDXVAMode = MODE_DXVA1;
+ m_DXVADecoderGUID = *pDecoderGuid;
+ m_pDXVADecoder = CDXVADecoder::CreateDecoder (this, pAMVideoAccelerator, &m_DXVADecoderGUID, dwSurfaceCount);
+ if (m_pDXVADecoder) m_pDXVADecoder->SetExtraData ((BYTE*)m_pAVCtx->extradata, m_pAVCtx->extradata_size);
- return S_OK;
+ return S_OK;
}
@@ -2287,145 +2277,145 @@ HRESULT CMPCVideoDecFilter::CreateDXVA1Decoder(IAMVideoAccelerator* pAMVideoAcc
STDMETHODIMP CMPCVideoDecFilter::GetPages(CAUUID* pPages)
{
- CheckPointer(pPages, E_POINTER);
+ CheckPointer(pPages, E_POINTER);
#ifdef REGISTER_FILTER
- pPages->cElems = 2;
+ pPages->cElems = 2;
#else
- pPages->cElems = 1;
+ pPages->cElems = 1;
#endif
- pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
- pPages->pElems[0] = __uuidof(CMPCVideoDecSettingsWnd);
- if(pPages->cElems > 1) pPages->pElems[1] = __uuidof(CMPCVideoDecCodecWnd);
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
+ pPages->pElems[0] = __uuidof(CMPCVideoDecSettingsWnd);
+ if (pPages->cElems>1) pPages->pElems[1] = __uuidof(CMPCVideoDecCodecWnd);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CMPCVideoDecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
{
- CheckPointer(ppPage, E_POINTER);
+ CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) return E_INVALIDARG;
+ if(*ppPage != NULL) return E_INVALIDARG;
- HRESULT hr;
+ HRESULT hr;
- if(guid == __uuidof(CMPCVideoDecSettingsWnd))
- {
- (*ppPage = DNew CInternalPropertyPageTempl<CMPCVideoDecSettingsWnd>(NULL, &hr))->AddRef();
- }
- else if(guid == __uuidof(CMPCVideoDecCodecWnd))
- {
- (*ppPage = DNew CInternalPropertyPageTempl<CMPCVideoDecCodecWnd>(NULL, &hr))->AddRef();
- }
+ if(guid == __uuidof(CMPCVideoDecSettingsWnd))
+ {
+ (*ppPage = DNew CInternalPropertyPageTempl<CMPCVideoDecSettingsWnd>(NULL, &hr))->AddRef();
+ }
+ else if(guid == __uuidof(CMPCVideoDecCodecWnd))
+ {
+ (*ppPage = DNew CInternalPropertyPageTempl<CMPCVideoDecCodecWnd>(NULL, &hr))->AddRef();
+ }
- return *ppPage ? S_OK : E_FAIL;
+ return *ppPage ? S_OK : E_FAIL;
}
// IFfmpegDecFilter
STDMETHODIMP CMPCVideoDecFilter::Apply()
{
- CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder")))
- {
- key.SetDWORDValue(_T("ThreadNumber"), m_nThreadNumber);
- key.SetDWORDValue(_T("DiscardMode"), m_nDiscardMode);
- key.SetDWORDValue(_T("ErrorRecognition"), m_nErrorRecognition);
- key.SetDWORDValue(_T("IDCTAlgo"), m_nIDCTAlgo);
- key.SetDWORDValue(_T("ActiveCodecs"), m_nActiveCodecs);
- key.SetDWORDValue(_T("ARMode"), m_nARMode);
- key.SetDWORDValue(_T("DXVACheckCompatibility"), m_nDXVACheckCompatibility);
- }
- return S_OK;
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Video Decoder")))
+ {
+ key.SetDWORDValue(_T("ThreadNumber"), m_nThreadNumber);
+ key.SetDWORDValue(_T("DiscardMode"), m_nDiscardMode);
+ key.SetDWORDValue(_T("ErrorRecognition"), m_nErrorRecognition);
+ key.SetDWORDValue(_T("IDCTAlgo"), m_nIDCTAlgo);
+ key.SetDWORDValue(_T("ActiveCodecs"), m_nActiveCodecs);
+ key.SetDWORDValue(_T("ARMode"), m_nARMode);
+ key.SetDWORDValue(_T("DXVACheckCompatibility"), m_nDXVACheckCompatibility);
+ }
+ return S_OK;
}
STDMETHODIMP CMPCVideoDecFilter::SetThreadNumber(int nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nThreadNumber = nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nThreadNumber = nValue;
+ return S_OK;
}
STDMETHODIMP_(int) CMPCVideoDecFilter::GetThreadNumber()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_nThreadNumber;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_nThreadNumber;
}
STDMETHODIMP CMPCVideoDecFilter::SetDiscardMode(int nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nDiscardMode = nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nDiscardMode = nValue;
+ return S_OK;
}
STDMETHODIMP_(int) CMPCVideoDecFilter::GetDiscardMode()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_nDiscardMode;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_nDiscardMode;
}
STDMETHODIMP CMPCVideoDecFilter::SetErrorRecognition(int nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nErrorRecognition = nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nErrorRecognition = nValue;
+ return S_OK;
}
STDMETHODIMP_(int) CMPCVideoDecFilter::GetErrorRecognition()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_nErrorRecognition;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_nErrorRecognition;
}
STDMETHODIMP CMPCVideoDecFilter::SetIDCTAlgo(int nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nIDCTAlgo = nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nIDCTAlgo = nValue;
+ return S_OK;
}
STDMETHODIMP_(int) CMPCVideoDecFilter::GetIDCTAlgo()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_nIDCTAlgo;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_nIDCTAlgo;
}
STDMETHODIMP_(GUID*) CMPCVideoDecFilter::GetDXVADecoderGuid()
{
- if(m_pGraph == NULL)
- return NULL;
- else
- return &m_DXVADecoderGUID;
+ if (m_pGraph == NULL)
+ return NULL;
+ else
+ return &m_DXVADecoderGUID;
}
STDMETHODIMP CMPCVideoDecFilter::SetActiveCodecs(MPC_VIDEO_CODEC nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nActiveCodecs = (int)nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nActiveCodecs = (int)nValue;
+ return S_OK;
}
STDMETHODIMP_(MPC_VIDEO_CODEC) CMPCVideoDecFilter::GetActiveCodecs()
{
- CAutoLock cAutoLock(&m_csProps);
- return (MPC_VIDEO_CODEC)m_nActiveCodecs;
+ CAutoLock cAutoLock(&m_csProps);
+ return (MPC_VIDEO_CODEC)m_nActiveCodecs;
}
STDMETHODIMP_(LPCTSTR) CMPCVideoDecFilter::GetVideoCardDescription()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_strDeviceDescription;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_strDeviceDescription;
}
STDMETHODIMP CMPCVideoDecFilter::SetARMode(int nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nARMode = nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nARMode = nValue;
+ return S_OK;
}
STDMETHODIMP_(int) CMPCVideoDecFilter::GetARMode()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_nARMode;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_nARMode;
}
STDMETHODIMP CMPCVideoDecFilter::SetDXVACheckCompatibility(int nValue)
{
- CAutoLock cAutoLock(&m_csProps);
- m_nDXVACheckCompatibility = nValue;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_nDXVACheckCompatibility = nValue;
+ return S_OK;
}
STDMETHODIMP_(int) CMPCVideoDecFilter::GetDXVACheckCompatibility()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_nDXVACheckCompatibility;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_nDXVACheckCompatibility;
}
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h
index 54cb4bdb4..7e8febb37 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -46,256 +46,226 @@ class CCpuId;
typedef enum
{
- MODE_SOFTWARE,
- MODE_DXVA1,
- MODE_DXVA2
+ MODE_SOFTWARE,
+ MODE_DXVA1,
+ MODE_DXVA2
} DXVA_MODE;
typedef struct
{
- REFERENCE_TIME rtStart;
- REFERENCE_TIME rtStop;
+ REFERENCE_TIME rtStart;
+ REFERENCE_TIME rtStop;
} B_FRAME;
typedef struct
{
- REFERENCE_TIME rtStart;
- REFERENCE_TIME rtStop;
- int nBuffPos;
+ REFERENCE_TIME rtStart;
+ REFERENCE_TIME rtStop;
+ int nBuffPos;
} BUFFER_TIME;
[uuid("008BAC12-FBAF-497b-9670-BC6F6FBAE2C4")]
-class CMPCVideoDecFilter
- : public CBaseVideoFilter
- , public TlibavcodecExt
- , public ISpecifyPropertyPages2
- , public IMPCVideoDecFilter
+class CMPCVideoDecFilter
+ : public CBaseVideoFilter
+ , public TlibavcodecExt
+ , public ISpecifyPropertyPages2
+ , public IMPCVideoDecFilter
{
protected:
- // === FFMpeg callbacks
- static void LogLibAVCodec(void* par, int level, const char *fmt, va_list valist);
- virtual void OnGetBuffer(AVFrame *pic);
-
- friend class CVideoDecDXVAAllocator;
-
- CCpuId* m_pCpuId;
- CCritSec m_csProps;
-
- // === Persistants parameters (registry)
- int m_nThreadNumber;
- int m_nDiscardMode;
- int m_nErrorRecognition;
- int m_nIDCTAlgo;
- bool m_bDXVACompatible;
- int m_nActiveCodecs;
- int m_nARMode;
- int m_nDXVACheckCompatibility;
-
- // === FFMpeg variables
- AVCodec* m_pAVCodec;
- AVCodecContext* m_pAVCtx;
- AVFrame* m_pFrame;
- int m_nCodecNb;
- int m_nWorkaroundBug;
- int m_nErrorConcealment;
- REFERENCE_TIME m_rtAvrTimePerFrame;
- bool m_bReorderBFrame;
- B_FRAME m_BFrames[2];
- int m_nPosB;
- int m_nWidth; // Frame width give to input pin
- int m_nHeight; // Frame height give to input pin
-
- // Buffer management for truncated stream (store stream chunks & reference time sent by splitter)
- BYTE* m_pFFBuffer;
- int m_nFFBufferSize;
- int m_nFFBufferPos;
- int m_nFFPicEnd;
- BUFFER_TIME m_FFBufferTime[MAX_BUFF_TIME];
-
- REFERENCE_TIME m_rtLastStart; // rtStart for last delivered frame
- int m_nCountEstimated; // Number of rtStart estimated since last rtStart received
-
- bool m_bUseDXVA;
- bool m_bUseFFmpeg;
- CSize m_sar;
- SwsContext* m_pSwsContext;
- int m_nOutCsp;
- CSize m_pOutSize; // Picture size on output pin
-
- // === DXVA common variables
- VIDEO_OUTPUT_FORMATS* m_pVideoOutputFormat;
- int m_nVideoOutputCount;
- DXVA_MODE m_nDXVAMode;
- CDXVADecoder* m_pDXVADecoder;
- GUID m_DXVADecoderGUID;
-
- int m_nPCIVendor;
- int m_nPCIDevice;
- LARGE_INTEGER m_VideoDriverVersion;
- CString m_strDeviceDescription;
-
- // === DXVA1 variables
- DDPIXELFORMAT m_PixelFormat;
-
- // === DXVA2 variables
- CComPtr<IDirect3DDeviceManager9> m_pDeviceManager;
- CComPtr<IDirectXVideoDecoderService> m_pDecoderService;
- CComPtr<IDirect3DSurface9> m_pDecoderRenderTarget;
- DXVA2_ConfigPictureDecode m_DXVA2Config;
- HANDLE m_hDevice;
- DXVA2_VideoDesc m_VideoDesc;
-
- // === Private functions
- void Cleanup();
- int FindCodec(const CMediaType* mtIn);
- void AllocExtradata(AVCodecContext* pAVCtx, const CMediaType* mt);
- bool IsMultiThreadSupported(int nCodec);
- void GetOutputFormats(int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats);
- void CalcAvgTimePerFrame();
- void DetectVideoCard(HWND hWnd);
- UINT GetAdapter(IDirect3D9* pD3D, HWND hWnd);
- int GetCspFromMediaType(GUID& subtype);
- void InitSwscale();
-
- void SetTypeSpecificFlags(IMediaSample* pMS);
- HRESULT SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int nSize, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
- //void FindStartCodeVC1 (BYTE** pDataIn, int& nSize);
- //void FindStartCodeH264 (BYTE** pDataIn, int& nSize);
- bool AppendBuffer(BYTE* pDataIn, int nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
- bool FindPicture(int nIndex, int nStartCode);
- void ShrinkBuffer();
- void ResetBuffer();
- void PushBufferTime(int nPos, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
- void PopBufferTime(int nPos);
+ // === FFMpeg callbacks
+ static void LogLibAVCodec(void* par,int level,const char *fmt,va_list valist);
+ virtual void OnGetBuffer(AVFrame *pic);
+
+ friend class CVideoDecDXVAAllocator;
+
+ CCpuId* m_pCpuId;
+ CCritSec m_csProps;
+
+ // === Persistants parameters (registry)
+ int m_nThreadNumber;
+ int m_nDiscardMode;
+ int m_nErrorRecognition;
+ int m_nIDCTAlgo;
+ bool m_bDXVACompatible;
+ int m_nActiveCodecs;
+ int m_nARMode;
+ int m_nDXVACheckCompatibility;
+
+ // === FFMpeg variables
+ AVCodec* m_pAVCodec;
+ AVCodecContext* m_pAVCtx;
+ AVFrame* m_pFrame;
+ int m_nCodecNb;
+ int m_nWorkaroundBug;
+ int m_nErrorConcealment;
+ REFERENCE_TIME m_rtAvrTimePerFrame;
+ bool m_bReorderBFrame;
+ B_FRAME m_BFrames[2];
+ int m_nPosB;
+ int m_nWidth; // Frame width give to input pin
+ int m_nHeight; // Frame height give to input pin
+
+ // Buffer management for truncated stream (store stream chunks & reference time sent by splitter)
+ BYTE* m_pFFBuffer;
+ int m_nFFBufferSize;
+ int m_nFFBufferPos;
+ int m_nFFPicEnd;
+ BUFFER_TIME m_FFBufferTime[MAX_BUFF_TIME];
+
+ REFERENCE_TIME m_rtLastStart; // rtStart for last delivered frame
+ int m_nCountEstimated; // Number of rtStart estimated since last rtStart received
+
+ bool m_bUseDXVA;
+ bool m_bUseFFmpeg;
+ CSize m_sar;
+ SwsContext* m_pSwsContext;
+ int m_nOutCsp;
+ CSize m_pOutSize; // Picture size on output pin
+
+ // === DXVA common variables
+ VIDEO_OUTPUT_FORMATS* m_pVideoOutputFormat;
+ int m_nVideoOutputCount;
+ DXVA_MODE m_nDXVAMode;
+ CDXVADecoder* m_pDXVADecoder;
+ GUID m_DXVADecoderGUID;
+
+ int m_nPCIVendor;
+ int m_nPCIDevice;
+ LARGE_INTEGER m_VideoDriverVersion;
+ CString m_strDeviceDescription;
+
+ // === DXVA1 variables
+ DDPIXELFORMAT m_PixelFormat;
+
+ // === DXVA2 variables
+ CComPtr<IDirect3DDeviceManager9> m_pDeviceManager;
+ CComPtr<IDirectXVideoDecoderService> m_pDecoderService;
+ CComPtr<IDirect3DSurface9> m_pDecoderRenderTarget;
+ DXVA2_ConfigPictureDecode m_DXVA2Config;
+ HANDLE m_hDevice;
+ DXVA2_VideoDesc m_VideoDesc;
+
+ // === Private functions
+ void Cleanup();
+ int FindCodec(const CMediaType* mtIn);
+ void AllocExtradata(AVCodecContext* pAVCtx, const CMediaType* mt);
+ bool IsMultiThreadSupported(int nCodec);
+ void GetOutputFormats (int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats);
+ void CalcAvgTimePerFrame();
+ void DetectVideoCard(HWND hWnd);
+ UINT GetAdapter(IDirect3D9* pD3D, HWND hWnd);
+ int GetCspFromMediaType(GUID& subtype);
+ void InitSwscale();
+
+ void SetTypeSpecificFlags(IMediaSample* pMS);
+ HRESULT SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int nSize, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+ //void FindStartCodeVC1 (BYTE** pDataIn, int& nSize);
+ //void FindStartCodeH264 (BYTE** pDataIn, int& nSize);
+ bool AppendBuffer (BYTE* pDataIn, int nSize, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ bool FindPicture(int nIndex, int nStartCode);
+ void ShrinkBuffer();
+ void ResetBuffer();
+ void PushBufferTime(int nPos, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+ void PopBufferTime(int nPos);
public:
- const static AMOVIESETUP_MEDIATYPE sudPinTypesIn[];
- const static int sudPinTypesInCount;
- const static AMOVIESETUP_MEDIATYPE sudPinTypesOut[];
- const static int sudPinTypesOutCount;
+ const static AMOVIESETUP_MEDIATYPE sudPinTypesIn[];
+ const static int sudPinTypesInCount;
+ const static AMOVIESETUP_MEDIATYPE sudPinTypesOut[];
+ const static int sudPinTypesOutCount;
- static UINT FFmpegFilters;
- static UINT DXVAFilters;
+ static UINT FFmpegFilters;
+ static UINT DXVAFilters;
- static bool m_ref_frame_count_check_skip;
+ static bool m_ref_frame_count_check_skip;
- CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CMPCVideoDecFilter();
+ CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CMPCVideoDecFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- virtual bool IsVideoInterlaced();
- virtual void GetOutputSize(int& w, int& h, int& arx, int& ary, int &RealWidth, int &RealHeight);
- CTransformOutputPin* GetOutputPin()
- {
- return m_pOutput;
- }
- void UpdateFrameTime(REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
-
- // === Overriden DirectShow functions
- HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT Transform(IMediaSample* pIn);
- HRESULT CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin);
+ virtual bool IsVideoInterlaced();
+ virtual void GetOutputSize(int& w, int& h, int& arx, int& ary, int &RealWidth, int &RealHeight);
+ CTransformOutputPin* GetOutputPin() { return m_pOutput; }
+ void UpdateFrameTime (REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+
+ // === Overriden DirectShow functions
+ HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT Transform(IMediaSample* pIn);
+ HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin);
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- HRESULT NewSegment(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double dRate);
- HRESULT BreakConnect(PIN_DIRECTION dir);
-
-
- // === ISpecifyPropertyPages2
-
- STDMETHODIMP GetPages(CAUUID* pPages);
- STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
-
- // === IMPCVideoDecFilter
- STDMETHODIMP Apply();
- STDMETHODIMP SetThreadNumber(int nValue);
- STDMETHODIMP_(int) GetThreadNumber();
- STDMETHOD(SetDiscardMode(int nValue));
- STDMETHOD_(int, GetDiscardMode());
- STDMETHOD(SetErrorRecognition(int nValue));
- STDMETHOD_(int, GetErrorRecognition());
- STDMETHOD(SetIDCTAlgo(int nValue));
- STDMETHOD_(int, GetIDCTAlgo());
- STDMETHOD_(GUID*, GetDXVADecoderGuid());
- STDMETHOD(SetActiveCodecs(MPC_VIDEO_CODEC nValue));
- STDMETHOD_(MPC_VIDEO_CODEC, GetActiveCodecs());
- STDMETHODIMP_(LPCTSTR) GetVideoCardDescription();
-
- STDMETHOD(SetARMode(int nValue));
- STDMETHOD_(int, GetARMode());
-
- STDMETHOD(SetDXVACheckCompatibility(int nValue));
- STDMETHOD_(int, GetDXVACheckCompatibility());
-
-
- // === DXVA common functions
- BOOL IsSupportedDecoderConfig(const D3DFORMAT nD3DFormat, const DXVA2_ConfigPictureDecode& config, bool& bIsPrefered);
- BOOL IsSupportedDecoderMode(const GUID& mode);
- void BuildDXVAOutputFormat();
- int GetPicEntryNumber();
- int PictWidth();
- int PictHeight();
- int PictWidthRounded();
- int PictHeightRounded();
- inline bool UseDXVA2()
- {
- return (m_nDXVAMode == MODE_DXVA2);
- };
- void FlushDXVADecoder()
- {
- if(m_pDXVADecoder) m_pDXVADecoder->Flush();
- }
- inline AVCodecContext* GetAVCtx()
- {
- return m_pAVCtx;
- };
- inline AVFrame* GetFrame()
- {
- return m_pFrame;
- }
- bool IsDXVASupported();
- inline bool IsReorderBFrame()
- {
- return m_bReorderBFrame;
- };
- inline int GetPCIVendor()
- {
- return m_nPCIVendor;
- };
- inline REFERENCE_TIME GetAvrTimePerFrame()
- {
- return m_rtAvrTimePerFrame;
- };
- void UpdateAspectRatio();
- void ReorderBFrames(REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
-
- // === DXVA1 functions
- DDPIXELFORMAT* GetPixelFormat()
- {
- return &m_PixelFormat;
- }
- HRESULT FindDXVA1DecoderConfiguration(IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, DDPIXELFORMAT* pPixelFormat);
- HRESULT CheckDXVA1Decoder(const GUID *pGuid);
- void SetDXVA1Params(const GUID* pGuid, DDPIXELFORMAT* pPixelFormat);
- WORD GetDXVA1RestrictedMode();
- HRESULT CreateDXVA1Decoder(IAMVideoAccelerator* pAMVideoAccelerator, const GUID* pDecoderGuid, DWORD dwSurfaceCount);
-
-
- // === DXVA2 functions
- void FillInVideoDescription(DXVA2_VideoDesc *pDesc);
- DXVA2_ConfigPictureDecode* GetDXVA2Config()
- {
- return &m_DXVA2Config;
- };
- HRESULT ConfigureDXVA2(IPin *pPin);
- HRESULT SetEVRForDXVA2(IPin *pPin);
- HRESULT FindDXVA2DecoderConfiguration(IDirectXVideoDecoderService *pDecoderService,
- const GUID& guidDecoder,
- DXVA2_ConfigPictureDecode *pSelectedConfig,
- BOOL *pbFoundDXVA2Configuration);
- HRESULT CreateDXVA2Decoder(UINT nNumRenderTargets, IDirect3DSurface9** pDecoderRenderTargets);
+ HRESULT NewSegment(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double dRate);
+ HRESULT BreakConnect(PIN_DIRECTION dir);
+
+
+ // === ISpecifyPropertyPages2
+
+ STDMETHODIMP GetPages(CAUUID* pPages);
+ STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
+
+ // === IMPCVideoDecFilter
+ STDMETHODIMP Apply();
+ STDMETHODIMP SetThreadNumber(int nValue);
+ STDMETHODIMP_(int) GetThreadNumber();
+ STDMETHOD(SetDiscardMode(int nValue));
+ STDMETHOD_(int, GetDiscardMode());
+ STDMETHOD(SetErrorRecognition(int nValue));
+ STDMETHOD_(int, GetErrorRecognition());
+ STDMETHOD(SetIDCTAlgo(int nValue));
+ STDMETHOD_(int, GetIDCTAlgo());
+ STDMETHOD_(GUID*, GetDXVADecoderGuid());
+ STDMETHOD(SetActiveCodecs(MPC_VIDEO_CODEC nValue));
+ STDMETHOD_(MPC_VIDEO_CODEC, GetActiveCodecs());
+ STDMETHODIMP_(LPCTSTR) GetVideoCardDescription();
+
+ STDMETHOD(SetARMode(int nValue));
+ STDMETHOD_(int, GetARMode());
+
+ STDMETHOD(SetDXVACheckCompatibility(int nValue));
+ STDMETHOD_(int, GetDXVACheckCompatibility());
+
+
+ // === DXVA common functions
+ BOOL IsSupportedDecoderConfig(const D3DFORMAT nD3DFormat, const DXVA2_ConfigPictureDecode& config, bool& bIsPrefered);
+ BOOL IsSupportedDecoderMode(const GUID& mode);
+ void BuildDXVAOutputFormat();
+ int GetPicEntryNumber();
+ int PictWidth();
+ int PictHeight();
+ int PictWidthRounded();
+ int PictHeightRounded();
+ inline bool UseDXVA2() { return (m_nDXVAMode == MODE_DXVA2); };
+ void FlushDXVADecoder() { if (m_pDXVADecoder) m_pDXVADecoder->Flush(); }
+ inline AVCodecContext* GetAVCtx() { return m_pAVCtx; };
+ inline AVFrame* GetFrame() { return m_pFrame; }
+ bool IsDXVASupported();
+ inline bool IsReorderBFrame() { return m_bReorderBFrame; };
+ inline int GetPCIVendor() { return m_nPCIVendor; };
+ inline REFERENCE_TIME GetAvrTimePerFrame() { return m_rtAvrTimePerFrame; };
+ void UpdateAspectRatio();
+ void ReorderBFrames(REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+
+ // === DXVA1 functions
+ DDPIXELFORMAT* GetPixelFormat() { return &m_PixelFormat; }
+ HRESULT FindDXVA1DecoderConfiguration(IAMVideoAccelerator* pAMVideoAccelerator, const GUID* guidDecoder, DDPIXELFORMAT* pPixelFormat);
+ HRESULT CheckDXVA1Decoder(const GUID *pGuid);
+ void SetDXVA1Params(const GUID* pGuid, DDPIXELFORMAT* pPixelFormat);
+ WORD GetDXVA1RestrictedMode();
+ HRESULT CreateDXVA1Decoder(IAMVideoAccelerator* pAMVideoAccelerator, const GUID* pDecoderGuid, DWORD dwSurfaceCount);
+
+
+ // === DXVA2 functions
+ void FillInVideoDescription(DXVA2_VideoDesc *pDesc);
+ DXVA2_ConfigPictureDecode* GetDXVA2Config() { return &m_DXVA2Config; };
+ HRESULT ConfigureDXVA2(IPin *pPin);
+ HRESULT SetEVRForDXVA2(IPin *pPin);
+ HRESULT FindDXVA2DecoderConfiguration(IDirectXVideoDecoderService *pDecoderService,
+ const GUID& guidDecoder,
+ DXVA2_ConfigPictureDecode *pSelectedConfig,
+ BOOL *pbFoundDXVA2Configuration);
+ HRESULT CreateDXVA2Decoder(UINT nNumRenderTargets, IDirect3DSurface9** pDecoderRenderTargets);
};
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp
index f9e0d3783..b9fbc40e4 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -43,18 +43,18 @@
int g_AVDiscard[] =
{
-16, ///< AVDISCARD_NONE discard nothing
- 0, ///< AVDISCARD_DEFAULT discard useless packets like 0 size packets in avi
- 8, ///< AVDISCARD_NONREF discard all non reference
- 16, ///< AVDISCARD_BIDIR discard all bidirectional frames
- 32, ///< AVDISCARD_NONKEY discard all frames except keyframes
- 48, ///< AVDISCARD_ALL discard all
+ 0, ///< AVDISCARD_DEFAULT discard useless packets like 0 size packets in avi
+ 8, ///< AVDISCARD_NONREF discard all non reference
+ 16, ///< AVDISCARD_BIDIR discard all bidirectional frames
+ 32, ///< AVDISCARD_NONKEY discard all frames except keyframes
+ 48, ///< AVDISCARD_ALL discard all
};
int FindDiscardIndex(int nValue)
{
- for(int i = 0; i < countof(g_AVDiscard); i++)
- if(g_AVDiscard[i] == nValue) return i;
- return 1;
+ for (int i=0; i<countof (g_AVDiscard); i++)
+ if (g_AVDiscard[i] == nValue) return i;
+ return 1;
}
@@ -64,145 +64,145 @@ CMPCVideoDecSettingsWnd::CMPCVideoDecSettingsWnd()
bool CMPCVideoDecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
{
- ASSERT(!m_pMDF);
+ ASSERT(!m_pMDF);
- m_pMDF.Release();
+ m_pMDF.Release();
- POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+
+ if(!m_pMDF) return false;
- if(!m_pMDF) return false;
-
- return true;
+ return true;
}
void CMPCVideoDecSettingsWnd::OnDisconnect()
{
- m_pMDF.Release();
+ m_pMDF.Release();
}
bool CMPCVideoDecSettingsWnd::OnActivate()
{
- DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_BORDER;
- int nPosY = 10;
- GUID* DxvaGui = NULL;
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_BORDER;
+ int nPosY = 10;
+ GUID* DxvaGui = NULL;
#if INCLUDE_MPC_VIDEO_DECODER
- m_grpFFMpeg.Create(ResStr(IDS_VDF_FFSETTINGS), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(10, nPosY, 330, nPosY + 150), this, IDC_STATIC);
-
-#if INTERNAL_DECODER_H264
-
- // Decoding threads
- nPosY += VERTICAL_SPACING;
- m_txtThreadNumber.Create(ResStr(IDS_VDF_THREADNUMBER), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 190, nPosY + 15), this, IDC_STATIC);
- m_cbThreadNumber.Create(WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(200, nPosY - 4, 260, nPosY + 90), this, IDC_PP_THREAD_NUMBER);
- m_cbThreadNumber.AddString(_T("1"));
- m_cbThreadNumber.AddString(_T("2"));
- m_cbThreadNumber.AddString(_T("3"));
- m_cbThreadNumber.AddString(_T("4"));
- m_cbThreadNumber.AddString(_T("5"));
- m_cbThreadNumber.AddString(_T("6"));
- m_cbThreadNumber.AddString(_T("7"));
- m_cbThreadNumber.AddString(_T("8"));
-
-#endif /* INTERNAL_DECODER_H264 */
-
-#if INTERNAL_DECODER_H264
-
- // H264 deblocking mode
- nPosY += VERTICAL_SPACING;
- m_txtDiscardMode.Create(ResStr(IDS_VDF_SKIPDEBLOCK), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 190, nPosY + 15), this, IDC_STATIC);
- m_cbDiscardMode.Create(WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(200, nPosY - 4, 315, nPosY + 90), this, IDC_PP_DISCARD_MODE);
- m_cbDiscardMode.AddString(ResStr(IDS_VDF_DBLK_NONE));
- m_cbDiscardMode.AddString(ResStr(IDS_VDF_DBLK_DEFAULT));
- m_cbDiscardMode.AddString(ResStr(IDS_VDF_DBLK_NONREF));
- m_cbDiscardMode.AddString(ResStr(IDS_VDF_DBLK_BIDIR));
- m_cbDiscardMode.AddString(ResStr(IDS_VDF_DBLK_NONKFRM));
- m_cbDiscardMode.AddString(ResStr(IDS_VDF_DBLK_ALL));
-
-#endif /* INTERNAL_DECODER_H264 */
-
- // Error recognition
- nPosY += VERTICAL_SPACING;
- m_txtErrorRecognition.Create(ResStr(IDS_VDF_ERROR_RECOGNITION), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 190, nPosY + 15), this, IDC_STATIC);
- m_cbErrorRecognition.Create(WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(200, nPosY - 4, 315, nPosY + 90), this, IDC_PP_DISCARD_MODE);
- m_cbErrorRecognition.AddString(ResStr(IDS_VDF_ERR_CAREFUL));
- m_cbErrorRecognition.AddString(ResStr(IDS_VDF_ERR_COMPLIANT));
- m_cbErrorRecognition.AddString(ResStr(IDS_VDF_ERR_AGGRESSIVE));
- m_cbErrorRecognition.AddString(ResStr(IDS_VDF_ERR_VERYAGGRESSIVE));
-
- // IDCT Algo
- nPosY += VERTICAL_SPACING;
- m_txtIDCTAlgo.Create(ResStr(IDS_VDF_IDCT_ALGO), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 190, nPosY + 15), this, IDC_STATIC);
- m_cbIDCTAlgo.Create(WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(200, nPosY - 4, 315, nPosY + 90), this, IDC_PP_DISCARD_MODE);
- m_cbIDCTAlgo.AddString(ResStr(IDS_VDF_IDCT_AUTO));
- m_cbIDCTAlgo.AddString(ResStr(IDS_VDF_IDCT_LIBMPEG2));
- m_cbIDCTAlgo.AddString(ResStr(IDS_VDF_IDCT_SIMPLE_MMX));
- m_cbIDCTAlgo.AddString(ResStr(IDS_VDF_IDCT_XVID));
- m_cbIDCTAlgo.AddString(ResStr(IDS_VDF_IDCT_SIMPLE));
-
- nPosY += VERTICAL_SPACING;
- m_cbARMode.Create(ResStr(IDS_VDF_AR_MODE), WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(LEFT_SPACING, nPosY, 315, nPosY + 15), this, IDC_PP_AR);
- m_cbARMode.SetCheck(FALSE);
-
- nPosY = 170;
+ m_grpFFMpeg.Create (ResStr (IDS_VDF_FFSETTINGS), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, nPosY, 330, nPosY+150), this, IDC_STATIC);
+
+ #if INTERNAL_DECODER_H264
+
+ // Decoding threads
+ nPosY += VERTICAL_SPACING;
+ m_txtThreadNumber.Create (ResStr (IDS_VDF_THREADNUMBER), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 190, nPosY+15), this, IDC_STATIC);
+ m_cbThreadNumber.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200, nPosY-4, 260, nPosY+90), this, IDC_PP_THREAD_NUMBER);
+ m_cbThreadNumber.AddString (_T("1"));
+ m_cbThreadNumber.AddString (_T("2"));
+ m_cbThreadNumber.AddString (_T("3"));
+ m_cbThreadNumber.AddString (_T("4"));
+ m_cbThreadNumber.AddString (_T("5"));
+ m_cbThreadNumber.AddString (_T("6"));
+ m_cbThreadNumber.AddString (_T("7"));
+ m_cbThreadNumber.AddString (_T("8"));
+
+ #endif /* INTERNAL_DECODER_H264 */
+
+ #if INTERNAL_DECODER_H264
+
+ // H264 deblocking mode
+ nPosY += VERTICAL_SPACING;
+ m_txtDiscardMode.Create (ResStr (IDS_VDF_SKIPDEBLOCK), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 190, nPosY+15), this, IDC_STATIC);
+ m_cbDiscardMode.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200, nPosY-4, 315, nPosY+90), this, IDC_PP_DISCARD_MODE);
+ m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONE));
+ m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_DEFAULT));
+ m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONREF));
+ m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_BIDIR));
+ m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONKFRM));
+ m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_ALL));
+
+ #endif /* INTERNAL_DECODER_H264 */
+
+ // Error recognition
+ nPosY += VERTICAL_SPACING;
+ m_txtErrorRecognition.Create (ResStr (IDS_VDF_ERROR_RECOGNITION), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 190, nPosY+15), this, IDC_STATIC);
+ m_cbErrorRecognition.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200, nPosY-4, 315, nPosY+90), this, IDC_PP_DISCARD_MODE);
+ m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_CAREFUL));
+ m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_COMPLIANT));
+ m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_AGGRESSIVE));
+ m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_VERYAGGRESSIVE));
+
+ // IDCT Algo
+ nPosY += VERTICAL_SPACING;
+ m_txtIDCTAlgo.Create (ResStr (IDS_VDF_IDCT_ALGO), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 190, nPosY+15), this, IDC_STATIC);
+ m_cbIDCTAlgo.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200, nPosY-4, 315, nPosY+90), this, IDC_PP_DISCARD_MODE);
+ m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_AUTO));
+ m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_LIBMPEG2));
+ m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_SIMPLE_MMX));
+ m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_XVID));
+ m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_SIMPLE));
+
+ nPosY += VERTICAL_SPACING;
+ m_cbARMode.Create (ResStr (IDS_VDF_AR_MODE), WS_VISIBLE|WS_CHILD|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING, nPosY, 315, nPosY+15), this, IDC_PP_AR);
+ m_cbARMode.SetCheck(FALSE);
+
+ nPosY = 170;
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- m_grpDXVA.Create(ResStr(IDS_VDF_DXVA_SETTING), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(10, nPosY, 330, nPosY + 110), this, IDC_STATIC);
-
- // DXVA Compatibility check
- nPosY += VERTICAL_SPACING;
- m_txtDXVACompatibilityCheck.Create(ResStr(IDS_VDF_DXVACOMPATIBILITY), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 190, nPosY + 15), this, IDC_STATIC);
- m_cbDXVACompatibilityCheck.Create(WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(200, nPosY - 4, 315, nPosY + 90), this, IDC_PP_DXVA_CHECK);
- m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_FULLCHECK));
- m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_REFONLY));
- m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SARONLY));
- m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_NOCHECK));
-
- // DXVA mode
- nPosY += VERTICAL_SPACING;
- m_txtDXVAMode.Create(ResStr(IDS_VDF_DXVA_MODE), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 120, nPosY + 15), this, IDC_STATIC);
- m_edtDXVAMode.Create(WS_CHILD | WS_VISIBLE | WS_DISABLED, CRect(120, nPosY, 315, nPosY + 20), this, 0);
-
- // Video card description
- nPosY += VERTICAL_SPACING;
- m_txtVideoCardDescription.Create(ResStr(IDS_VDF_VIDEOCARD), WS_VISIBLE | WS_CHILD, CRect(LEFT_SPACING, nPosY, 120, nPosY + 15), this, IDC_STATIC);
- m_edtVideoCardDescription.Create(WS_CHILD | WS_VISIBLE | WS_DISABLED, CRect(120, nPosY, 315, nPosY + 20), this, 0);
- m_edtVideoCardDescription.SetWindowText(m_pMDF->GetVideoCardDescription());
-
-
- DxvaGui = m_pMDF->GetDXVADecoderGuid();
- if(DxvaGui != NULL)
- {
- CString DXVAMode = GetDXVAMode(DxvaGui);
- m_edtDXVAMode.SetWindowText(DXVAMode);
- }
- else
- {
- m_txtDXVAMode.ShowWindow(SW_HIDE);
- m_edtDXVAMode.ShowWindow(SW_HIDE);
- }
-
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
- pWnd->SetFont(&m_font, FALSE);
-
- if(m_pMDF)
- {
+ m_grpDXVA.Create (ResStr (IDS_VDF_DXVA_SETTING), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, nPosY, 330, nPosY+110), this, IDC_STATIC);
+
+ // DXVA Compatibility check
+ nPosY += VERTICAL_SPACING;
+ m_txtDXVACompatibilityCheck.Create (ResStr (IDS_VDF_DXVACOMPATIBILITY), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 190, nPosY+15), this, IDC_STATIC);
+ m_cbDXVACompatibilityCheck.Create (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200, nPosY-4, 315, nPosY+90), this, IDC_PP_DXVA_CHECK);
+ m_cbDXVACompatibilityCheck.AddString(ResStr (IDS_VDF_DXVA_FULLCHECK));
+ m_cbDXVACompatibilityCheck.AddString(ResStr (IDS_VDF_DXVA_REFONLY));
+ m_cbDXVACompatibilityCheck.AddString(ResStr (IDS_VDF_DXVA_SARONLY));
+ m_cbDXVACompatibilityCheck.AddString(ResStr (IDS_VDF_DXVA_NOCHECK));
+
+ // DXVA mode
+ nPosY += VERTICAL_SPACING;
+ m_txtDXVAMode.Create (ResStr (IDS_VDF_DXVA_MODE), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 120, nPosY+15), this, IDC_STATIC);
+ m_edtDXVAMode.Create (WS_CHILD|WS_VISIBLE|WS_DISABLED, CRect (120, nPosY, 315, nPosY+20), this, 0);
+
+ // Video card description
+ nPosY += VERTICAL_SPACING;
+ m_txtVideoCardDescription.Create (ResStr (IDS_VDF_VIDEOCARD), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING, nPosY, 120, nPosY+15), this, IDC_STATIC);
+ m_edtVideoCardDescription.Create (WS_CHILD|WS_VISIBLE|WS_DISABLED, CRect (120, nPosY, 315, nPosY+20), this, 0);
+ m_edtVideoCardDescription.SetWindowText (m_pMDF->GetVideoCardDescription());
+
+
+ DxvaGui = m_pMDF->GetDXVADecoderGuid();
+ if (DxvaGui != NULL)
+ {
+ CString DXVAMode = GetDXVAMode (DxvaGui);
+ m_edtDXVAMode.SetWindowText (DXVAMode);
+ }
+ else
+ {
+ m_txtDXVAMode.ShowWindow (SW_HIDE);
+ m_edtDXVAMode.ShowWindow (SW_HIDE);
+ }
+
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
+
+ if (m_pMDF)
+ {
#if INCLUDE_MPC_VIDEO_DECODER
-#if INTERNAL_DECODER_H264
- m_cbThreadNumber.SetCurSel(m_pMDF->GetThreadNumber() - 1);
- m_cbDiscardMode.SetCurSel(FindDiscardIndex(m_pMDF->GetDiscardMode()));
-#endif
- m_cbErrorRecognition.SetCurSel(m_pMDF->GetErrorRecognition() - 1);
- m_cbIDCTAlgo.SetCurSel(m_pMDF->GetIDCTAlgo());
-
- m_cbARMode.SetCheck(m_pMDF->GetARMode());
+ #if INTERNAL_DECODER_H264
+ m_cbThreadNumber.SetCurSel (m_pMDF->GetThreadNumber() - 1);
+ m_cbDiscardMode.SetCurSel (FindDiscardIndex (m_pMDF->GetDiscardMode()));
+ #endif
+ m_cbErrorRecognition.SetCurSel (m_pMDF->GetErrorRecognition()-1);
+ m_cbIDCTAlgo.SetCurSel (m_pMDF->GetIDCTAlgo());
+
+ m_cbARMode.SetCheck(m_pMDF->GetARMode());
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- m_cbDXVACompatibilityCheck.SetCurSel(m_pMDF->GetDXVACheckCompatibility());
- }
+ m_cbDXVACompatibilityCheck.SetCurSel(m_pMDF->GetDXVACheckCompatibility());
+ }
- return true;
+ return true;
}
void CMPCVideoDecSettingsWnd::OnDeactivate()
@@ -211,27 +211,27 @@ void CMPCVideoDecSettingsWnd::OnDeactivate()
bool CMPCVideoDecSettingsWnd::OnApply()
{
- OnDeactivate();
+ OnDeactivate();
- if(m_pMDF && m_cbErrorRecognition.m_hWnd)
- {
+ if(m_pMDF && m_cbErrorRecognition.m_hWnd)
+ {
#if INCLUDE_MPC_VIDEO_DECODER
-#if INTERNAL_DECODER_H264
- m_pMDF->SetThreadNumber(m_cbThreadNumber.GetCurSel() + 1);
- m_pMDF->SetDiscardMode(g_AVDiscard[m_cbDiscardMode.GetCurSel()]);
-#endif /* INTERNAL_DECODER_H264 */
- m_pMDF->SetErrorRecognition(m_cbErrorRecognition.GetCurSel() + 1);
- m_pMDF->SetIDCTAlgo(m_cbIDCTAlgo.GetCurSel());
-
- m_pMDF->SetARMode(m_cbARMode.GetCheck());
+ #if INTERNAL_DECODER_H264
+ m_pMDF->SetThreadNumber (m_cbThreadNumber.GetCurSel() + 1);
+ m_pMDF->SetDiscardMode (g_AVDiscard[m_cbDiscardMode.GetCurSel()]);
+ #endif /* INTERNAL_DECODER_H264 */
+ m_pMDF->SetErrorRecognition (m_cbErrorRecognition.GetCurSel()+1);
+ m_pMDF->SetIDCTAlgo (m_cbIDCTAlgo.GetCurSel());
+
+ m_pMDF->SetARMode(m_cbARMode.GetCheck());
#endif /* INCLUDE_MPC_VIDEO_DECODER */
- m_pMDF->SetDXVACheckCompatibility(m_cbDXVACompatibilityCheck.GetCurSel());
+ m_pMDF->SetDXVACheckCompatibility(m_cbDXVACompatibilityCheck.GetCurSel());
- m_pMDF->Apply();
- }
+ m_pMDF->Apply();
+ }
- return true;
+ return true;
}
@@ -250,76 +250,76 @@ CMPCVideoDecCodecWnd::CMPCVideoDecCodecWnd()
bool CMPCVideoDecCodecWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
{
- ASSERT(!m_pMDF);
-
- m_pMDF.Release();
+ ASSERT(!m_pMDF);
- POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+ m_pMDF.Release();
- if(!m_pMDF) return false;
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+
+ if(!m_pMDF) return false;
- return true;
+ return true;
}
void CMPCVideoDecCodecWnd::OnDisconnect()
{
- m_pMDF.Release();
+ m_pMDF.Release();
}
bool CMPCVideoDecCodecWnd::OnActivate()
{
- DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_BORDER;
- int nPos = 0;
- MPC_VIDEO_CODEC nActiveCodecs = (MPC_VIDEO_CODEC)(m_pMDF ? m_pMDF->GetActiveCodecs() : 0);
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_BORDER;
+ int nPos = 0;
+ MPC_VIDEO_CODEC nActiveCodecs = (MPC_VIDEO_CODEC)(m_pMDF ? m_pMDF->GetActiveCodecs() : 0);
- m_grpSelectedCodec.Create(_T("Selected codecs"), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(10, 10, 330, 280), this, IDC_STATIC);
+ m_grpSelectedCodec.Create (_T("Selected codecs"), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, 10, 330, 280), this, IDC_STATIC);
- m_lstCodecs.Create(dwStyle | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, CRect(20, 30, 320, 270), this, 0);
+ m_lstCodecs.Create (dwStyle | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, CRect (20,30, 320, 270), this, 0);
#if INTERNAL_DECODER_H264_DXVA
- m_lstCodecs.AddString(_T("H.264/AVC (DXVA)"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_H264_DXVA) != 0);
+ m_lstCodecs.AddString (_T("H.264/AVC (DXVA)"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_H264_DXVA) != 0);
#endif
#if INTERNAL_DECODER_H264
- m_lstCodecs.AddString(_T("H.264/AVC (FFmpeg)"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_H264) != 0);
+ m_lstCodecs.AddString (_T("H.264/AVC (FFmpeg)"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_H264) != 0);
#endif
#if INTERNAL_DECODER_VC1_DXVA
- m_lstCodecs.AddString(_T("VC1 (DXVA)"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_VC1_DXVA) != 0);
+ m_lstCodecs.AddString (_T("VC1 (DXVA)"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_VC1_DXVA) != 0);
#endif
#if INTERNAL_DECODER_VC1
- m_lstCodecs.AddString(_T("VC1 (FFmpeg)"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_VC1) != 0);
+ m_lstCodecs.AddString (_T("VC1 (FFmpeg)"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_VC1) != 0);
#endif
-#if INCLUDE_MPC_VIDEO_DECODER
- m_lstCodecs.AddString(_T("Xvid"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_XVID) != 0);
- m_lstCodecs.AddString(_T("DivX"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_DIVX) != 0);
- m_lstCodecs.AddString(_T("MS-MPEG4"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_MSMPEG4) != 0);
- m_lstCodecs.AddString(_T("FLV1/4"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_FLASH) != 0);
- m_lstCodecs.AddString(_T("VP5/6"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_VP6) != 0);
- m_lstCodecs.AddString(_T("WMV1/2/3"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_WMV) != 0);
- m_lstCodecs.AddString(_T("H.263"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_H263) != 0);
- m_lstCodecs.AddString(_T("SVQ1/3"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_SVQ3) != 0);
- m_lstCodecs.AddString(_T("AMV video"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_AMVV) != 0);
- m_lstCodecs.AddString(_T("Theora"));
- m_lstCodecs.SetCheck(nPos++, (nActiveCodecs & MPCVD_THEORA) != 0);
+#if INCLUDE_MPC_VIDEO_DECODER
+ m_lstCodecs.AddString (_T("Xvid"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_XVID) != 0);
+ m_lstCodecs.AddString (_T("DivX"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_DIVX) != 0);
+ m_lstCodecs.AddString (_T("MS-MPEG4"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_MSMPEG4) != 0);
+ m_lstCodecs.AddString (_T("FLV1/4"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_FLASH) != 0);
+ m_lstCodecs.AddString (_T("VP5/6"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_VP6) != 0);
+ m_lstCodecs.AddString (_T("WMV1/2/3"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_WMV) != 0);
+ m_lstCodecs.AddString (_T("H.263"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_H263) != 0);
+ m_lstCodecs.AddString (_T("SVQ1/3"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_SVQ3) != 0);
+ m_lstCodecs.AddString (_T("AMV video"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_AMVV) != 0);
+ m_lstCodecs.AddString (_T("Theora"));
+ m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_THEORA) != 0);
#endif
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
- pWnd->SetFont(&m_font, FALSE);
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
- return true;
+ return true;
}
void CMPCVideoDecCodecWnd::OnDeactivate()
@@ -328,43 +328,43 @@ void CMPCVideoDecCodecWnd::OnDeactivate()
bool CMPCVideoDecCodecWnd::OnApply()
{
- OnDeactivate();
+ OnDeactivate();
- if(m_pMDF)
- {
- int nActiveCodecs = 0;
- int nPos = 0;
+ if(m_pMDF)
+ {
+ int nActiveCodecs = 0;
+ int nPos = 0;
#if INTERNAL_DECODER_H264_DXVA
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_H264_DXVA;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_H264_DXVA;
#endif
#if INTERNAL_DECODER_H264
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_H264;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_H264;
#endif
#if INTERNAL_DECODER_VC1_DXVA
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_VC1_DXVA;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_VC1_DXVA;
#endif
#if INTERNAL_DECODER_VC1
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_VC1;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_VC1;
#endif
#if INCLUDE_MPC_VIDEO_DECODER
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_XVID;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_DIVX;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_MSMPEG4;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_FLASH;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_VP6;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_WMV;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_H263;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_SVQ3;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_AMVV;
- if(m_lstCodecs.GetCheck(nPos++)) nActiveCodecs |= MPCVD_THEORA;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_XVID;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_DIVX;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_MSMPEG4;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_FLASH;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_VP6;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_WMV;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_H263;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_SVQ3;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_AMVV;
+ if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_THEORA;
#endif
- m_pMDF->SetActiveCodecs((MPC_VIDEO_CODEC)nActiveCodecs);
+ m_pMDF->SetActiveCodecs ((MPC_VIDEO_CODEC)nActiveCodecs);
- m_pMDF->Apply();
- }
+ m_pMDF->Apply();
+ }
- return true;
+ return true;
}
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.h b/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.h
index e870f5615..01979df3f 100644
--- a/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.h
+++ b/src/filters/transform/MPCVideoDec/MPCVideoDecSettingsWnd.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -29,58 +29,52 @@
[uuid("D5AA0389-D274-48e1-BF50-ACB05A56DDE0")]
class CMPCVideoDecSettingsWnd : public CInternalPropertyPageWnd
{
- CComQIPtr<IMPCVideoDecFilter> m_pMDF;
-
- CButton m_grpFFMpeg;
- CStatic m_txtThreadNumber;
- CComboBox m_cbThreadNumber;
- CStatic m_txtDiscardMode;
- CComboBox m_cbDiscardMode;
- CStatic m_txtErrorRecognition;
- CComboBox m_cbErrorRecognition;
- CStatic m_txtIDCTAlgo;
- CComboBox m_cbIDCTAlgo;
-
- CButton m_grpDXVA;
- CStatic m_txtDXVAMode;
- CEdit m_edtDXVAMode;
- CStatic m_txtVideoCardDescription;
- CEdit m_edtVideoCardDescription;
-
- CButton m_cbARMode;
-
- CStatic m_txtDXVACompatibilityCheck;
- CComboBox m_cbDXVACompatibilityCheck;
-
- enum
- {
- IDC_PP_THREAD_NUMBER = 10000,
- IDC_PP_ENABLE_DEBLOCKING,
- IDC_PP_DISCARD_MODE,
- IDC_PP_ERROR_RECOGNITION,
- IDC_PP_AR,
- IDC_PP_DXVA_CHECK
- };
+ CComQIPtr<IMPCVideoDecFilter> m_pMDF;
+
+ CButton m_grpFFMpeg;
+ CStatic m_txtThreadNumber;
+ CComboBox m_cbThreadNumber;
+ CStatic m_txtDiscardMode;
+ CComboBox m_cbDiscardMode;
+ CStatic m_txtErrorRecognition;
+ CComboBox m_cbErrorRecognition;
+ CStatic m_txtIDCTAlgo;
+ CComboBox m_cbIDCTAlgo;
+
+ CButton m_grpDXVA;
+ CStatic m_txtDXVAMode;
+ CEdit m_edtDXVAMode;
+ CStatic m_txtVideoCardDescription;
+ CEdit m_edtVideoCardDescription;
+
+ CButton m_cbARMode;
+
+ CStatic m_txtDXVACompatibilityCheck;
+ CComboBox m_cbDXVACompatibilityCheck;
+
+ enum
+ {
+ IDC_PP_THREAD_NUMBER = 10000,
+ IDC_PP_ENABLE_DEBLOCKING,
+ IDC_PP_DISCARD_MODE,
+ IDC_PP_ERROR_RECOGNITION,
+ IDC_PP_AR,
+ IDC_PP_DXVA_CHECK
+ };
public:
- CMPCVideoDecSettingsWnd();
-
- bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
- void OnDisconnect();
- bool OnActivate();
- void OnDeactivate();
- bool OnApply();
-
- static LPCTSTR GetWindowTitle()
- {
- return _T("Settings");
- }
- static CSize GetWindowSize()
- {
- return CSize(320, 300);
- }
-
- DECLARE_MESSAGE_MAP()
+ CMPCVideoDecSettingsWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
+
+ static LPCTSTR GetWindowTitle() {return _T("Settings");}
+ static CSize GetWindowSize() {return CSize(320, 300);}
+
+ DECLARE_MESSAGE_MAP()
};
@@ -91,29 +85,23 @@ public:
[uuid("3C395D46-8B0F-440d-B962-2F4A97355453")]
class CMPCVideoDecCodecWnd : public CInternalPropertyPageWnd
{
- CComQIPtr<IMPCVideoDecFilter> m_pMDF;
+ CComQIPtr<IMPCVideoDecFilter> m_pMDF;
- CButton m_grpSelectedCodec;
- CCheckListBox m_lstCodecs;
- CImageList m_onoff;
+ CButton m_grpSelectedCodec;
+ CCheckListBox m_lstCodecs;
+ CImageList m_onoff;
public:
- CMPCVideoDecCodecWnd();
-
- bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
- void OnDisconnect();
- bool OnActivate();
- void OnDeactivate();
- bool OnApply();
-
- static LPCTSTR GetWindowTitle()
- {
- return _T("Codecs");
- }
- static CSize GetWindowSize()
- {
- return CSize(320, 300);
- }
-
- DECLARE_MESSAGE_MAP()
+ CMPCVideoDecCodecWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
+
+ static LPCTSTR GetWindowTitle() {return _T("Codecs");}
+ static CSize GetWindowSize() {return CSize(320, 300);}
+
+ DECLARE_MESSAGE_MAP()
};
diff --git a/src/filters/transform/MPCVideoDec/TlibavcodecExt.cpp b/src/filters/transform/MPCVideoDec/TlibavcodecExt.cpp
index de1b24474..3976c5a2c 100644
--- a/src/filters/transform/MPCVideoDec/TlibavcodecExt.cpp
+++ b/src/filters/transform/MPCVideoDec/TlibavcodecExt.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -30,33 +30,33 @@
void TlibavcodecExt::ConnectTo(AVCodecContext *pAVCtx)
{
- pAVCtx->opaque = this;
- pAVCtx->get_buffer = get_buffer;
- pAVCtx->reget_buffer = reget_buffer;
- pAVCtx->release_buffer = release_buffer;
- pAVCtx->handle_user_data = handle_user_data0;
+ pAVCtx->opaque = this;
+ pAVCtx->get_buffer = get_buffer;
+ pAVCtx->reget_buffer = reget_buffer;
+ pAVCtx->release_buffer = release_buffer;
+ pAVCtx->handle_user_data = handle_user_data0;
}
int TlibavcodecExt::get_buffer(AVCodecContext *c, AVFrame *pic)
{
- int ret = c->opaque->ff_avcodec_default_get_buffer(c, pic);
- if(ret == 0)
- c->opaque->OnGetBuffer(pic);
- return ret;
+ int ret=c->opaque->ff_avcodec_default_get_buffer(c,pic);
+ if (ret==0)
+ c->opaque->OnGetBuffer(pic);
+ return ret;
}
int TlibavcodecExt::reget_buffer(AVCodecContext *c, AVFrame *pic)
{
- int ret = c->opaque->ff_avcodec_default_reget_buffer(c, pic);
- if(ret == 0)
- c->opaque->OnRegetBuffer(pic);
- return ret;
+ int ret=c->opaque->ff_avcodec_default_reget_buffer(c,pic);
+ if (ret==0)
+ c->opaque->OnRegetBuffer(pic);
+ return ret;
}
void TlibavcodecExt::release_buffer(AVCodecContext *c, AVFrame *pic)
{
- c->opaque->ff_avcodec_default_release_buffer(c, pic);
- c->opaque->OnReleaseBuffer(pic);
+ c->opaque->ff_avcodec_default_release_buffer(c,pic);
+ c->opaque->OnReleaseBuffer(pic);
}
-void TlibavcodecExt::handle_user_data0(AVCodecContext *c, const uint8_t *buf, int buf_len)
+void TlibavcodecExt::handle_user_data0(AVCodecContext *c, const uint8_t *buf,int buf_len)
{
- c->opaque->HandleUserData(buf, buf_len);
+ c->opaque->HandleUserData(buf,buf_len);
}
diff --git a/src/filters/transform/MPCVideoDec/TlibavcodecExt.h b/src/filters/transform/MPCVideoDec/TlibavcodecExt.h
index 1d33ffef0..68297594e 100644
--- a/src/filters/transform/MPCVideoDec/TlibavcodecExt.h
+++ b/src/filters/transform/MPCVideoDec/TlibavcodecExt.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -31,30 +31,30 @@ typedef unsigned char uint8_t;
struct AVCodecContext;
struct AVFrame;
-typedef int (*FUNC_AV_DEFAULT_GET_BUFFER)(AVCodecContext *s, AVFrame *pic);
-typedef void (*FUNC_AV_DEFAULT_RELEASE_BUFFER)(AVCodecContext *s, AVFrame *pic);
-typedef int (*FUNC_AV_DEFAULT_REGET_BUFFER)(AVCodecContext *s, AVFrame *pic);
+typedef int (*FUNC_AV_DEFAULT_GET_BUFFER)(AVCodecContext *s, AVFrame *pic);
+typedef void (*FUNC_AV_DEFAULT_RELEASE_BUFFER)(AVCodecContext *s, AVFrame *pic);
+typedef int (*FUNC_AV_DEFAULT_REGET_BUFFER)(AVCodecContext *s, AVFrame *pic);
struct TlibavcodecExt
{
protected:
- static int get_buffer(AVCodecContext *s, AVFrame *pic);
- static void release_buffer(AVCodecContext *s, AVFrame *pic);
- static int reget_buffer(AVCodecContext *s, AVFrame *pic);
- static void handle_user_data0(AVCodecContext *c, const uint8_t *buf, int buf_len);
+ static int get_buffer(AVCodecContext *s, AVFrame *pic);
+ static void release_buffer(AVCodecContext *s, AVFrame *pic);
+ static int reget_buffer(AVCodecContext *s, AVFrame *pic);
+ static void handle_user_data0(AVCodecContext *c,const uint8_t *buf,int buf_len);
- FUNC_AV_DEFAULT_GET_BUFFER ff_avcodec_default_get_buffer;
- FUNC_AV_DEFAULT_RELEASE_BUFFER ff_avcodec_default_release_buffer;
- FUNC_AV_DEFAULT_REGET_BUFFER ff_avcodec_default_reget_buffer;
+ FUNC_AV_DEFAULT_GET_BUFFER ff_avcodec_default_get_buffer;
+ FUNC_AV_DEFAULT_RELEASE_BUFFER ff_avcodec_default_release_buffer;
+ FUNC_AV_DEFAULT_REGET_BUFFER ff_avcodec_default_reget_buffer;
public:
- virtual ~TlibavcodecExt() {}
- void ConnectTo(AVCodecContext *pAVCtx);
- virtual void OnGetBuffer(AVFrame *pic) {}
- virtual void OnRegetBuffer(AVFrame *pic) {}
- virtual void OnReleaseBuffer(AVFrame *pic) {}
- virtual void HandleUserData(const uint8_t *buf, int buf_len) {}
+ virtual ~TlibavcodecExt() {}
+ void ConnectTo(AVCodecContext *pAVCtx);
+ virtual void OnGetBuffer(AVFrame *pic) {}
+ virtual void OnRegetBuffer(AVFrame *pic) {}
+ virtual void OnReleaseBuffer(AVFrame *pic) {}
+ virtual void HandleUserData(const uint8_t *buf,int buf_len) {}
};
diff --git a/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.cpp b/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.cpp
index 2e9bcbb9f..ac0d1d304 100644
--- a/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.cpp
+++ b/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -27,9 +27,9 @@
CDXVA2Sample::CDXVA2Sample(CVideoDecDXVAAllocator *pAlloc, HRESULT *phr)
- : CMediaSample(NAME("CDXVA2Sample"), (CBaseAllocator*)pAlloc, phr, NULL, 0)
- , m_dwSurfaceId(0)
-{
+ : CMediaSample(NAME("CDXVA2Sample"), (CBaseAllocator*)pAlloc, phr, NULL, 0)
+ , m_dwSurfaceId(0)
+{
}
// Note: CMediaSample does not derive from CUnknown, so we cannot use the
@@ -37,110 +37,110 @@ CDXVA2Sample::CDXVA2Sample(CVideoDecDXVAAllocator *pAlloc, HRESULT *phr)
STDMETHODIMP CDXVA2Sample::QueryInterface(REFIID riid, __deref_out void **ppv)
{
- CheckPointer(ppv, E_POINTER);
- ValidateReadWritePtr(ppv, sizeof(PVOID));
-
- if(riid == __uuidof(IMFGetService))
- {
- return GetInterface((IMFGetService*) this, ppv);
- }
- if(riid == __uuidof(IMPCDXVA2Sample))
- {
- return GetInterface((IMPCDXVA2Sample*) this, ppv);
- }
- else
- {
- return CMediaSample::QueryInterface(riid, ppv);
- }
+ CheckPointer(ppv,E_POINTER);
+ ValidateReadWritePtr(ppv,sizeof(PVOID));
+
+ if (riid == __uuidof(IMFGetService))
+ {
+ return GetInterface((IMFGetService*) this, ppv);
+ }
+ if (riid == __uuidof(IMPCDXVA2Sample))
+ {
+ return GetInterface((IMPCDXVA2Sample*) this, ppv);
+ }
+ else
+ {
+ return CMediaSample::QueryInterface(riid, ppv);
+ }
}
STDMETHODIMP_(ULONG) CDXVA2Sample::AddRef()
{
- return __super::AddRef();
+ return __super::AddRef();
}
STDMETHODIMP_(ULONG) CDXVA2Sample::Release()
{
- // Return a temporary variable for thread safety.
- ULONG cRef = __super::Release();
- return cRef;
+ // Return a temporary variable for thread safety.
+ ULONG cRef = __super::Release();
+ return cRef;
}
// IMFGetService::GetService
STDMETHODIMP CDXVA2Sample::GetService(REFGUID guidService, REFIID riid, LPVOID *ppv)
{
- if(guidService != MR_BUFFER_SERVICE)
- {
- return MF_E_UNSUPPORTED_SERVICE;
- }
- else if(m_pSurface == NULL)
- {
- return E_NOINTERFACE;
- }
- else
- {
- return m_pSurface->QueryInterface(riid, ppv);
- }
+ if (guidService != MR_BUFFER_SERVICE)
+ {
+ return MF_E_UNSUPPORTED_SERVICE;
+ }
+ else if (m_pSurface == NULL)
+ {
+ return E_NOINTERFACE;
+ }
+ else
+ {
+ return m_pSurface->QueryInterface(riid, ppv);
+ }
}
// Override GetPointer because this class does not manage a system memory buffer.
// The EVR uses the MR_BUFFER_SERVICE service to get the Direct3D surface.
STDMETHODIMP CDXVA2Sample::GetPointer(BYTE ** ppBuffer)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
-// Sets the pointer to the Direct3D surface.
+// Sets the pointer to the Direct3D surface.
void CDXVA2Sample::SetSurface(DWORD surfaceId, IDirect3DSurface9 *pSurf)
{
- m_pSurface = pSurf;
- m_dwSurfaceId = surfaceId;
+ m_pSurface = pSurf;
+ m_dwSurfaceId = surfaceId;
}
STDMETHODIMP_(int) CDXVA2Sample::GetDXSurfaceId()
{
- return m_dwSurfaceId;
+ return m_dwSurfaceId;
}
CVideoDecDXVAAllocator::CVideoDecDXVAAllocator(CMPCVideoDecFilter* pVideoDecFilter, HRESULT* phr)
- : CBaseAllocator(NAME("CVideoDecDXVAAllocator"), NULL, phr)
+ : CBaseAllocator(NAME("CVideoDecDXVAAllocator"), NULL, phr)
{
- m_pVideoDecFilter = pVideoDecFilter;
- m_ppRTSurfaceArray = NULL;
+ m_pVideoDecFilter = pVideoDecFilter;
+ m_ppRTSurfaceArray = NULL;
}
CVideoDecDXVAAllocator::~CVideoDecDXVAAllocator()
{
- Free();
+ Free();
}
HRESULT CVideoDecDXVAAllocator::Alloc()
{
HRESULT hr;
- CComPtr<IDirectXVideoAccelerationService> pDXVA2Service;
+ CComPtr<IDirectXVideoAccelerationService> pDXVA2Service;
- CheckPointer(m_pVideoDecFilter->m_pDeviceManager, E_UNEXPECTED);
- hr = m_pVideoDecFilter->m_pDeviceManager->GetVideoService(m_pVideoDecFilter->m_hDevice, IID_IDirectXVideoAccelerationService, (void**)&pDXVA2Service);
- CheckPointer(pDXVA2Service, E_UNEXPECTED);
- CAutoLock lock(this);
+ CheckPointer(m_pVideoDecFilter->m_pDeviceManager, E_UNEXPECTED);
+ hr = m_pVideoDecFilter->m_pDeviceManager->GetVideoService (m_pVideoDecFilter->m_hDevice, IID_IDirectXVideoAccelerationService, (void**)&pDXVA2Service);
+ CheckPointer (pDXVA2Service, E_UNEXPECTED);
+ CAutoLock lock(this);
hr = __super::Alloc();
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
// Free the old resources.
Free();
- m_nSurfaceArrayCount = m_lCount;
+ m_nSurfaceArrayCount = m_lCount;
// Allocate a new array of pointers.
- m_ppRTSurfaceArray = DNew IDirect3DSurface9 * [m_lCount];
- if(m_ppRTSurfaceArray == NULL)
+ m_ppRTSurfaceArray = DNew IDirect3DSurface9*[m_lCount];
+ if (m_ppRTSurfaceArray == NULL)
{
hr = E_OUTOFMEMORY;
}
@@ -151,34 +151,34 @@ HRESULT CVideoDecDXVAAllocator::Alloc()
}
// Allocate the surfaces.
- D3DFORMAT m_dwFormat = m_pVideoDecFilter->m_VideoDesc.Format;
- if(SUCCEEDED(hr))
+ D3DFORMAT m_dwFormat = m_pVideoDecFilter->m_VideoDesc.Format;
+ if (SUCCEEDED(hr))
{
hr = pDXVA2Service->CreateSurface(
- m_pVideoDecFilter->PictWidthRounded(),
- m_pVideoDecFilter->PictHeightRounded(),
- m_lCount - 1,
- (D3DFORMAT)m_dwFormat,
- D3DPOOL_DEFAULT,
- 0,
- DXVA2_VideoDecoderRenderTarget,
- m_ppRTSurfaceArray,
- NULL
- );
+ m_pVideoDecFilter->PictWidthRounded(),
+ m_pVideoDecFilter->PictHeightRounded(),
+ m_lCount - 1,
+ (D3DFORMAT)m_dwFormat,
+ D3DPOOL_DEFAULT,
+ 0,
+ DXVA2_VideoDecoderRenderTarget,
+ m_ppRTSurfaceArray,
+ NULL
+ );
}
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
- // Important : create samples in reverse order !
- for(m_lAllocated = m_lCount - 1; m_lAllocated >= 0; m_lAllocated--)
+ // Important : create samples in reverse order !
+ for (m_lAllocated = m_lCount-1; m_lAllocated >= 0; m_lAllocated--)
{
CDXVA2Sample *pSample = DNew CDXVA2Sample(this, &hr);
- if(pSample == NULL)
+ if (pSample == NULL)
{
hr = E_OUTOFMEMORY;
break;
}
- if(FAILED(hr))
+ if (FAILED(hr))
{
break;
}
@@ -189,11 +189,11 @@ HRESULT CVideoDecDXVAAllocator::Alloc()
m_lFree.Add(pSample);
}
- hr = m_pVideoDecFilter->CreateDXVA2Decoder(m_lCount, m_ppRTSurfaceArray);
- if(FAILED(hr)) Free();
- }
+ hr = m_pVideoDecFilter->CreateDXVA2Decoder (m_lCount, m_ppRTSurfaceArray);
+ if (FAILED (hr)) Free();
+ }
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
m_bChanged = FALSE;
}
@@ -204,30 +204,29 @@ void CVideoDecDXVAAllocator::Free()
{
CMediaSample *pSample = NULL;
- m_pVideoDecFilter->FlushDXVADecoder();
+ m_pVideoDecFilter->FlushDXVADecoder();
// m_FreeSurface.RemoveAll();
do
{
pSample = m_lFree.RemoveHead();
- if(pSample)
+ if (pSample)
{
delete pSample;
}
- }
- while(pSample);
+ } while (pSample);
- if(m_ppRTSurfaceArray)
+ if (m_ppRTSurfaceArray)
{
- for(long i = 0; i < m_nSurfaceArrayCount; i++)
+ for (long i = 0; i < m_nSurfaceArrayCount; i++)
{
- if(m_ppRTSurfaceArray[i] != NULL)
- m_ppRTSurfaceArray[i]->Release();
+ if (m_ppRTSurfaceArray[i] != NULL)
+ m_ppRTSurfaceArray[i]->Release();
}
delete [] m_ppRTSurfaceArray;
- m_ppRTSurfaceArray = NULL;
+ m_ppRTSurfaceArray = NULL;
}
m_lAllocated = 0;
- m_nSurfaceArrayCount = 0;
+ m_nSurfaceArrayCount = 0;
}
diff --git a/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.h b/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.h
index 2d1ee462d..c0bbcd0f7 100644
--- a/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.h
+++ b/src/filters/transform/MPCVideoDec/VideoDecDXVAAllocator.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -32,10 +32,9 @@ class CVideoDecDXVAAllocator;
[uuid("AE7EC2A2-1913-4a80-8DD6-DF1497ABA494")]
-interface IMPCDXVA2Sample :
-public IUnknown
+interface IMPCDXVA2Sample : public IUnknown
{
- STDMETHOD_(int, GetDXSurfaceId()) = 0;
+ STDMETHOD_(int, GetDXSurfaceId()) = 0;
};
class CDXVA2Sample : public CMediaSample, public IMFGetService, public IMPCDXVA2Sample
@@ -49,15 +48,15 @@ public:
// Note: CMediaSample does not derive from CUnknown, so we cannot use the
// DECLARE_IUNKNOWN macro that is used by most of the filter classes.
- STDMETHODIMP QueryInterface(REFIID riid, __deref_out void **ppv);
+ STDMETHODIMP QueryInterface(REFIID riid, __deref_out void **ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IMFGetService::GetService
STDMETHODIMP GetService(REFGUID guidService, REFIID riid, LPVOID *ppv);
- // IMPCDXVA2Sample
- STDMETHODIMP_(int) GetDXSurfaceId();
+ // IMPCDXVA2Sample
+ STDMETHODIMP_(int) GetDXSurfaceId();
// Override GetPointer because this class does not manage a system memory buffer.
// The EVR uses the MR_BUFFER_SERVICE service to get the Direct3D surface.
@@ -65,7 +64,7 @@ public:
private:
- // Sets the pointer to the Direct3D surface.
+ // Sets the pointer to the Direct3D surface.
void SetSurface(DWORD surfaceId, IDirect3DSurface9 *pSurf);
CComPtr<IDirect3DSurface9> m_pSurface;
@@ -78,27 +77,27 @@ private:
class CVideoDecDXVAAllocator : public CBaseAllocator
{
public:
- CVideoDecDXVAAllocator(CMPCVideoDecFilter* pVideoDecFilter, HRESULT* phr);
- virtual ~CVideoDecDXVAAllocator();
+ CVideoDecDXVAAllocator(CMPCVideoDecFilter* pVideoDecFilter, HRESULT* phr);
+ virtual ~CVideoDecDXVAAllocator();
-// STDMETHODIMP GetBuffer(__deref_out IMediaSample **ppBuffer, // Try for a circular buffer!
-// __in_opt REFERENCE_TIME * pStartTime,
-// __in_opt REFERENCE_TIME * pEndTime,
-// DWORD dwFlags);
-//
-// STDMETHODIMP ReleaseBuffer(IMediaSample *pBuffer);
-// CAtlList<int> m_FreeSurface;
+ // STDMETHODIMP GetBuffer(__deref_out IMediaSample **ppBuffer, // Try for a circular buffer!
+ // __in_opt REFERENCE_TIME * pStartTime,
+ // __in_opt REFERENCE_TIME * pEndTime,
+ // DWORD dwFlags);
+ //
+ // STDMETHODIMP ReleaseBuffer(IMediaSample *pBuffer);
+ // CAtlList<int> m_FreeSurface;
protected:
- HRESULT Alloc(void);
- void Free(void);
+ HRESULT Alloc(void);
+ void Free(void);
private :
- CMPCVideoDecFilter* m_pVideoDecFilter;
+ CMPCVideoDecFilter* m_pVideoDecFilter;
- IDirect3DSurface9** m_ppRTSurfaceArray;
- UINT m_nSurfaceArrayCount;
+ IDirect3DSurface9** m_ppRTSurfaceArray;
+ UINT m_nSurfaceArrayCount;
};
diff --git a/src/filters/transform/MPCVideoDec/VideoDecOutputPin.cpp b/src/filters/transform/MPCVideoDec/VideoDecOutputPin.cpp
index 29fadf0ff..c3652416f 100644
--- a/src/filters/transform/MPCVideoDec/VideoDecOutputPin.cpp
+++ b/src/filters/transform/MPCVideoDec/VideoDecOutputPin.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -27,13 +27,13 @@
#include "../../../DSUtil/DSUtil.h"
CVideoDecOutputPin::CVideoDecOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
- : CBaseVideoOutputPin(pObjectName, pFilter, phr, pName)
+ : CBaseVideoOutputPin(pObjectName, pFilter, phr, pName)
{
- m_pVideoDecFilter = static_cast<CMPCVideoDecFilter*>(pFilter);
- m_pDXVA2Allocator = NULL;
- m_dwDXVA1SurfaceCount = 0;
- m_GuidDecoderDXVA1 = GUID_NULL;
- memset(&m_ddUncompPixelFormat, 0, sizeof(m_ddUncompPixelFormat));
+ m_pVideoDecFilter = static_cast<CMPCVideoDecFilter*> (pFilter);
+ m_pDXVA2Allocator = NULL;
+ m_dwDXVA1SurfaceCount = 0;
+ m_GuidDecoderDXVA1 = GUID_NULL;
+ memset (&m_ddUncompPixelFormat, 0, sizeof(m_ddUncompPixelFormat));
}
CVideoDecOutputPin::~CVideoDecOutputPin(void)
@@ -43,99 +43,99 @@ CVideoDecOutputPin::~CVideoDecOutputPin(void)
HRESULT CVideoDecOutputPin::InitAllocator(IMemAllocator **ppAlloc)
{
- TRACE("CVideoDecOutputPin::InitAllocator");
- if(m_pVideoDecFilter->UseDXVA2())
- {
- HRESULT hr = S_FALSE;
- m_pDXVA2Allocator = DNew CVideoDecDXVAAllocator(m_pVideoDecFilter, &hr);
- if(!m_pDXVA2Allocator)
- {
- return E_OUTOFMEMORY;
- }
- if(FAILED(hr))
- {
- delete m_pDXVA2Allocator;
- return hr;
- }
- // Return the IMemAllocator interface.
- return m_pDXVA2Allocator->QueryInterface(__uuidof(IMemAllocator), (void **)ppAlloc);
- }
- else
- return __super::InitAllocator(ppAlloc);
+ TRACE("CVideoDecOutputPin::InitAllocator");
+ if (m_pVideoDecFilter->UseDXVA2())
+ {
+ HRESULT hr = S_FALSE;
+ m_pDXVA2Allocator = DNew CVideoDecDXVAAllocator(m_pVideoDecFilter, &hr);
+ if (!m_pDXVA2Allocator)
+ {
+ return E_OUTOFMEMORY;
+ }
+ if (FAILED(hr))
+ {
+ delete m_pDXVA2Allocator;
+ return hr;
+ }
+ // Return the IMemAllocator interface.
+ return m_pDXVA2Allocator->QueryInterface(__uuidof(IMemAllocator), (void **)ppAlloc);
+ }
+ else
+ return __super::InitAllocator(ppAlloc);
}
STDMETHODIMP CVideoDecOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IAMVideoAcceleratorNotify)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IAMVideoAcceleratorNotify)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// === IAMVideoAcceleratorNotify
STDMETHODIMP CVideoDecOutputPin::GetUncompSurfacesInfo(const GUID *pGuid, LPAMVAUncompBufferInfo pUncompBufferInfo)
{
- HRESULT hr = E_INVALIDARG;
-
- if(SUCCEEDED(m_pVideoDecFilter->CheckDXVA1Decoder(pGuid)))
- {
- CComQIPtr<IAMVideoAccelerator> pAMVideoAccelerator = GetConnected();
-
- if(pAMVideoAccelerator)
- {
- pUncompBufferInfo->dwMaxNumSurfaces = m_pVideoDecFilter->GetPicEntryNumber();
- pUncompBufferInfo->dwMinNumSurfaces = m_pVideoDecFilter->GetPicEntryNumber();
-
- hr = m_pVideoDecFilter->FindDXVA1DecoderConfiguration(pAMVideoAccelerator, pGuid, &pUncompBufferInfo->ddUncompPixelFormat);
- if(SUCCEEDED(hr))
- {
- memcpy(&m_ddUncompPixelFormat, &pUncompBufferInfo->ddUncompPixelFormat, sizeof(DDPIXELFORMAT));
- m_GuidDecoderDXVA1 = *pGuid;
- }
- }
- }
- return hr;
+ HRESULT hr = E_INVALIDARG;
+
+ if (SUCCEEDED (m_pVideoDecFilter->CheckDXVA1Decoder (pGuid)))
+ {
+ CComQIPtr<IAMVideoAccelerator> pAMVideoAccelerator = GetConnected();
+
+ if (pAMVideoAccelerator)
+ {
+ pUncompBufferInfo->dwMaxNumSurfaces = m_pVideoDecFilter->GetPicEntryNumber();
+ pUncompBufferInfo->dwMinNumSurfaces = m_pVideoDecFilter->GetPicEntryNumber();
+
+ hr = m_pVideoDecFilter->FindDXVA1DecoderConfiguration (pAMVideoAccelerator, pGuid, &pUncompBufferInfo->ddUncompPixelFormat);
+ if (SUCCEEDED (hr))
+ {
+ memcpy (&m_ddUncompPixelFormat, &pUncompBufferInfo->ddUncompPixelFormat, sizeof(DDPIXELFORMAT));
+ m_GuidDecoderDXVA1 = *pGuid;
+ }
+ }
+ }
+ return hr;
}
-STDMETHODIMP CVideoDecOutputPin::SetUncompSurfacesInfo(DWORD dwActualUncompSurfacesAllocated)
+STDMETHODIMP CVideoDecOutputPin::SetUncompSurfacesInfo(DWORD dwActualUncompSurfacesAllocated)
{
- m_dwDXVA1SurfaceCount = dwActualUncompSurfacesAllocated;
- return S_OK;
+ m_dwDXVA1SurfaceCount = dwActualUncompSurfacesAllocated;
+ return S_OK;
}
STDMETHODIMP CVideoDecOutputPin::GetCreateVideoAcceleratorData(const GUID *pGuid, LPDWORD pdwSizeMiscData, LPVOID *ppMiscData)
{
- HRESULT hr = E_UNEXPECTED;
- AMVAUncompDataInfo UncompInfo;
- AMVACompBufferInfo CompInfo[30];
- DWORD dwNumTypesCompBuffers = countof(CompInfo);
- CComQIPtr<IAMVideoAccelerator> pAMVideoAccelerator = GetConnected();
- DXVA_ConnectMode* pConnectMode;
-
- if(pAMVideoAccelerator)
- {
- memcpy(&UncompInfo.ddUncompPixelFormat, &m_ddUncompPixelFormat, sizeof(DDPIXELFORMAT));
- UncompInfo.dwUncompWidth = m_pVideoDecFilter->PictWidthRounded();
- UncompInfo.dwUncompHeight = m_pVideoDecFilter->PictHeightRounded();
- hr = pAMVideoAccelerator->GetCompBufferInfo(&m_GuidDecoderDXVA1, &UncompInfo, &dwNumTypesCompBuffers, CompInfo);
-
- if(SUCCEEDED(hr))
- {
- hr = m_pVideoDecFilter->CreateDXVA1Decoder(pAMVideoAccelerator, pGuid, m_dwDXVA1SurfaceCount);
-
- if(SUCCEEDED(hr))
- {
- m_pVideoDecFilter->SetDXVA1Params(&m_GuidDecoderDXVA1, &m_ddUncompPixelFormat);
-
- pConnectMode = (DXVA_ConnectMode*)CoTaskMemAlloc(sizeof(DXVA_ConnectMode));
- pConnectMode->guidMode = m_GuidDecoderDXVA1;
- pConnectMode->wRestrictedMode = m_pVideoDecFilter->GetDXVA1RestrictedMode();
- *pdwSizeMiscData = sizeof(DXVA_ConnectMode);
- *ppMiscData = pConnectMode;
- }
- }
- }
-
-
- return hr;
+ HRESULT hr = E_UNEXPECTED;
+ AMVAUncompDataInfo UncompInfo;
+ AMVACompBufferInfo CompInfo[30];
+ DWORD dwNumTypesCompBuffers = countof(CompInfo);
+ CComQIPtr<IAMVideoAccelerator> pAMVideoAccelerator = GetConnected();
+ DXVA_ConnectMode* pConnectMode;
+
+ if (pAMVideoAccelerator)
+ {
+ memcpy (&UncompInfo.ddUncompPixelFormat, &m_ddUncompPixelFormat, sizeof (DDPIXELFORMAT));
+ UncompInfo.dwUncompWidth = m_pVideoDecFilter->PictWidthRounded();
+ UncompInfo.dwUncompHeight = m_pVideoDecFilter->PictHeightRounded();
+ hr = pAMVideoAccelerator->GetCompBufferInfo(&m_GuidDecoderDXVA1, &UncompInfo, &dwNumTypesCompBuffers, CompInfo);
+
+ if (SUCCEEDED (hr))
+ {
+ hr = m_pVideoDecFilter->CreateDXVA1Decoder (pAMVideoAccelerator, pGuid, m_dwDXVA1SurfaceCount);
+
+ if (SUCCEEDED (hr))
+ {
+ m_pVideoDecFilter->SetDXVA1Params (&m_GuidDecoderDXVA1, &m_ddUncompPixelFormat);
+
+ pConnectMode = (DXVA_ConnectMode*)CoTaskMemAlloc (sizeof(DXVA_ConnectMode));
+ pConnectMode->guidMode = m_GuidDecoderDXVA1;
+ pConnectMode->wRestrictedMode = m_pVideoDecFilter->GetDXVA1RestrictedMode();
+ *pdwSizeMiscData = sizeof(DXVA_ConnectMode);
+ *ppMiscData = pConnectMode;
+ }
+ }
+ }
+
+
+ return hr;
}
diff --git a/src/filters/transform/MPCVideoDec/VideoDecOutputPin.h b/src/filters/transform/MPCVideoDec/VideoDecOutputPin.h
index 10df35dd2..d6de33575 100644
--- a/src/filters/transform/MPCVideoDec/VideoDecOutputPin.h
+++ b/src/filters/transform/MPCVideoDec/VideoDecOutputPin.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -32,27 +32,27 @@ class CVideoDecDXVAAllocator;
class CVideoDecOutputPin : public CBaseVideoOutputPin
- , public IAMVideoAcceleratorNotify
+ , public IAMVideoAcceleratorNotify
{
public:
- CVideoDecOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
+ CVideoDecOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
- ~CVideoDecOutputPin();
+ ~CVideoDecOutputPin();
- HRESULT InitAllocator(IMemAllocator **ppAlloc);
+ HRESULT InitAllocator(IMemAllocator **ppAlloc);
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- // IAMVideoAcceleratorNotify
- STDMETHODIMP GetUncompSurfacesInfo(const GUID *pGuid, LPAMVAUncompBufferInfo pUncompBufferInfo);
- STDMETHODIMP SetUncompSurfacesInfo(DWORD dwActualUncompSurfacesAllocated);
- STDMETHODIMP GetCreateVideoAcceleratorData(const GUID *pGuid, LPDWORD pdwSizeMiscData, LPVOID *ppMiscData);
+ // IAMVideoAcceleratorNotify
+ STDMETHODIMP GetUncompSurfacesInfo(const GUID *pGuid, LPAMVAUncompBufferInfo pUncompBufferInfo);
+ STDMETHODIMP SetUncompSurfacesInfo(DWORD dwActualUncompSurfacesAllocated);
+ STDMETHODIMP GetCreateVideoAcceleratorData(const GUID *pGuid, LPDWORD pdwSizeMiscData, LPVOID *ppMiscData);
private :
- CMPCVideoDecFilter* m_pVideoDecFilter;
- CVideoDecDXVAAllocator* m_pDXVA2Allocator;
- DWORD m_dwDXVA1SurfaceCount;
- GUID m_GuidDecoderDXVA1;
- DDPIXELFORMAT m_ddUncompPixelFormat;
+ CMPCVideoDecFilter* m_pVideoDecFilter;
+ CVideoDecDXVAAllocator* m_pDXVA2Allocator;
+ DWORD m_dwDXVA1SurfaceCount;
+ GUID m_GuidDecoderDXVA1;
+ DDPIXELFORMAT m_ddUncompPixelFormat;
};
diff --git a/src/filters/transform/MPCVideoDec/ffImgfmt.cpp b/src/filters/transform/MPCVideoDec/ffImgfmt.cpp
index 3fbee9153..1959b476b 100644
--- a/src/filters/transform/MPCVideoDec/ffImgfmt.cpp
+++ b/src/filters/transform/MPCVideoDec/ffImgfmt.cpp
@@ -26,959 +26,956 @@
-const TcspInfo cspInfos[] =
+const TcspInfo cspInfos[]=
{
- {
- FF_CSP_420P, _l("YV12"),
- 1, 12, //Bpp
- 3, //numplanes
- {0, 1, 1, 0}, //shiftX
- {0, 1, 1, 0}, //shiftY
- {0, 128, 128, 0}, //black,
- FOURCC_YV12, FOURCC_YV12, &MEDIASUBTYPE_YV12
- },
- {
- FF_CSP_422P, _l("422P"),
- 1, 18, //Bpp
- 3, //numplanes
- {0, 1, 1, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 128, 128, 0}, //black
- FOURCC_422P, FOURCC_422P, &MEDIASUBTYPE_422P
- },
- {
- FF_CSP_444P, _l("444P"),
- 1, 24, //Bpp
- 3, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 128, 128, 0}, //black
- FOURCC_444P, FOURCC_444P, &MEDIASUBTYPE_444P
- },
- {
- FF_CSP_411P, _l("411P"),
- 1, 17, //Bpp
- 3, //numplanes
- {0, 2, 2, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 128, 128, 0}, //black
- FOURCC_411P, FOURCC_411P, &MEDIASUBTYPE_411P
- },
- {
- FF_CSP_410P, _l("410P"),
- 1, 10, //Bpp
- 3, //numplanes
- {0, 2, 2, 0}, //shiftX
- {0, 2, 2, 0}, //shiftY
- {0, 128, 128, 0}, //black
- FOURCC_410P, FOURCC_410P, &MEDIASUBTYPE_410P
- },
+ {
+ FF_CSP_420P,_l("YV12"),
+ 1,12, //Bpp
+ 3, //numplanes
+ {0,1,1,0}, //shiftX
+ {0,1,1,0}, //shiftY
+ {0,128,128,0}, //black,
+ FOURCC_YV12, FOURCC_YV12, &MEDIASUBTYPE_YV12
+ },
+ {
+ FF_CSP_422P,_l("422P"),
+ 1,18, //Bpp
+ 3, //numplanes
+ {0,1,1,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,128,128,0}, //black
+ FOURCC_422P, FOURCC_422P, &MEDIASUBTYPE_422P
+ },
+ {
+ FF_CSP_444P,_l("444P"),
+ 1,24, //Bpp
+ 3, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,128,128,0}, //black
+ FOURCC_444P, FOURCC_444P, &MEDIASUBTYPE_444P
+ },
+ {
+ FF_CSP_411P,_l("411P"),
+ 1,17, //Bpp
+ 3, //numplanes
+ {0,2,2,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,128,128,0}, //black
+ FOURCC_411P, FOURCC_411P, &MEDIASUBTYPE_411P
+ },
+ {
+ FF_CSP_410P,_l("410P"),
+ 1,10, //Bpp
+ 3, //numplanes
+ {0,2,2,0}, //shiftX
+ {0,2,2,0}, //shiftY
+ {0,128,128,0}, //black
+ FOURCC_410P, FOURCC_410P, &MEDIASUBTYPE_410P
+ },
- {
- FF_CSP_YUY2, _l("YUY2"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0x8000, 0, 0, 0}, //black
- FOURCC_YUY2, FOURCC_YUY2, &MEDIASUBTYPE_YUY2,
- 0, 1 //packedLumaOffset,packedChromaOffset
- },
- {
- FF_CSP_UYVY, _l("UYVY"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0x0080, 0, 0, 0}, //black
- FOURCC_UYVY, FOURCC_UYVY, &MEDIASUBTYPE_UYVY,
- 1, 0 //packedLumaOffset,packedChromaOffset
- },
- {
- FF_CSP_YVYU, _l("YVYU"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0x8000, 0, 0, 0}, //black
- FOURCC_YVYU, FOURCC_YVYU, &MEDIASUBTYPE_YVYU,
- 0, 1 //packedLumaOffset,packedChromaOffset
- },
- {
- FF_CSP_VYUY, _l("VYUY"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0x0080, 0, 0, 0}, //black
- FOURCC_VYUY, FOURCC_VYUY, &MEDIASUBTYPE_VYUY,
- 1, 0 //packedLumaOffset,packedChromaOffset
- },
+ {
+ FF_CSP_YUY2,_l("YUY2"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0x8000,0,0,0}, //black
+ FOURCC_YUY2, FOURCC_YUY2, &MEDIASUBTYPE_YUY2,
+ 0,1 //packedLumaOffset,packedChromaOffset
+ },
+ {
+ FF_CSP_UYVY,_l("UYVY"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0x0080,0,0,0}, //black
+ FOURCC_UYVY, FOURCC_UYVY, &MEDIASUBTYPE_UYVY,
+ 1,0 //packedLumaOffset,packedChromaOffset
+ },
+ {
+ FF_CSP_YVYU,_l("YVYU"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0x8000,0,0,0}, //black
+ FOURCC_YVYU, FOURCC_YVYU, &MEDIASUBTYPE_YVYU,
+ 0,1 //packedLumaOffset,packedChromaOffset
+ },
+ {
+ FF_CSP_VYUY,_l("VYUY"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0x0080,0,0,0}, //black
+ FOURCC_VYUY, FOURCC_VYUY, &MEDIASUBTYPE_VYUY,
+ 1,0 //packedLumaOffset,packedChromaOffset
+ },
- {
- FF_CSP_ABGR, _l("ABGR"),
- 4, 32, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB32
- },
- {
- FF_CSP_RGBA, _l("RGBA"),
- 4, 32, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB32
- },
- {
- FF_CSP_BGR32, _l("BGR32"),
- 4, 32, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB32
- },
- {
- FF_CSP_BGR24, _l("BGR24"),
- 3, 24, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB24
- },
- {
- FF_CSP_BGR15, _l("BGR15"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB555
- },
- {
- FF_CSP_BGR16, _l("BGR16"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB565
- },
- {
- FF_CSP_RGB32, _l("RGB32"),
- 4, 32, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, FOURCC_RGB3, &MEDIASUBTYPE_RGB32
- },
- {
- FF_CSP_RGB24, _l("RGB24"),
- 3, 24, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, FOURCC_RGB2, &MEDIASUBTYPE_RGB24
- },
- {
- FF_CSP_RGB15, _l("RGB15"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, FOURCC_RGB5, &MEDIASUBTYPE_RGB555
- },
- {
- FF_CSP_RGB16, _l("RGB16"),
- 2, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, FOURCC_RGB6, &MEDIASUBTYPE_RGB565
- },
+ {
+ FF_CSP_ABGR,_l("ABGR"),
+ 4,32, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB32
+ },
+ {
+ FF_CSP_RGBA,_l("RGBA"),
+ 4,32, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB32
+ },
+ {
+ FF_CSP_BGR32,_l("BGR32"),
+ 4,32, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB32
+ },
+ {
+ FF_CSP_BGR24,_l("BGR24"),
+ 3,24, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB24
+ },
+ {
+ FF_CSP_BGR15,_l("BGR15"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB555
+ },
+ {
+ FF_CSP_BGR16,_l("BGR16"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB565
+ },
+ {
+ FF_CSP_RGB32,_l("RGB32"),
+ 4,32, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, FOURCC_RGB3, &MEDIASUBTYPE_RGB32
+ },
+ {
+ FF_CSP_RGB24,_l("RGB24"),
+ 3,24, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, FOURCC_RGB2, &MEDIASUBTYPE_RGB24
+ },
+ {
+ FF_CSP_RGB15,_l("RGB15"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, FOURCC_RGB5, &MEDIASUBTYPE_RGB555
+ },
+ {
+ FF_CSP_RGB16,_l("RGB16"),
+ 2,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, FOURCC_RGB6, &MEDIASUBTYPE_RGB565
+ },
- {
- FF_CSP_PAL8, _l("pal8"),
- 1, 8, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- BI_RGB, 0, &MEDIASUBTYPE_RGB8
- },
- {
- FF_CSP_CLJR, _l("cljr"),
- 1, 16, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- FOURCC_CLJR, FOURCC_CLJR, &MEDIASUBTYPE_CLJR
- },
- {
- FF_CSP_Y800, _l("gray"),
- 1, 8, //Bpp
- 1, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 0, 0, 0}, //shiftY
- {0, 0, 0, 0}, //black
- FOURCC_Y800, FOURCC_Y800, &MEDIASUBTYPE_Y800
- },
- {
- FF_CSP_NV12, _l("NV12"),
- 1, 12, //Bpp
- 2, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 1, 1, 0}, //shiftY
- {0, 128, 128, 0}, //black
- FOURCC_NV12, FOURCC_NV12, &MEDIASUBTYPE_NV12
- },
- 0
+ {
+ FF_CSP_PAL8,_l("pal8"),
+ 1,8, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ BI_RGB, 0, &MEDIASUBTYPE_RGB8
+ },
+ {
+ FF_CSP_CLJR,_l("cljr"),
+ 1,16, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ FOURCC_CLJR, FOURCC_CLJR, &MEDIASUBTYPE_CLJR
+ },
+ {
+ FF_CSP_Y800,_l("gray"),
+ 1,8, //Bpp
+ 1, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,0,0,0}, //shiftY
+ {0,0,0,0}, //black
+ FOURCC_Y800, FOURCC_Y800, &MEDIASUBTYPE_Y800
+ },
+ {
+ FF_CSP_NV12,_l("NV12"),
+ 1,12, //Bpp
+ 2, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,1,1,0}, //shiftY
+ {0,128,128,0}, //black
+ FOURCC_NV12, FOURCC_NV12, &MEDIASUBTYPE_NV12
+ },
+ 0
};
-TcspInfo cspInfoIYUV =
+TcspInfo cspInfoIYUV=
{
- FF_CSP_420P, _l("YV12"),
- 1, 12, //Bpp
- 3, //numplanes
- {0, 1, 1, 0}, //shiftX
- {0, 1, 1, 0}, //shiftY
- {0, 128, 128, 0}, //black,
- FOURCC_IYUV, FOURCC_IYUV, &MEDIASUBTYPE_IYUV
+ FF_CSP_420P,_l("YV12"),
+ 1,12, //Bpp
+ 3, //numplanes
+ {0,1,1,0}, //shiftX
+ {0,1,1,0}, //shiftY
+ {0,128,128,0}, //black,
+ FOURCC_IYUV, FOURCC_IYUV, &MEDIASUBTYPE_IYUV
};
-TcspInfo cspInfoNV21 =
+TcspInfo cspInfoNV21=
{
- FF_CSP_NV12, _l("NV21"),
- 1, 12, //Bpp
- 2, //numplanes
- {0, 0, 0, 0}, //shiftX
- {0, 1, 1, 0}, //shiftY
- {0, 128, 128, 0}, //black
- FOURCC_NV21, FOURCC_NV21, &MEDIASUBTYPE_NV21
+ FF_CSP_NV12,_l("NV21"),
+ 1,12, //Bpp
+ 2, //numplanes
+ {0,0,0,0}, //shiftX
+ {0,1,1,0}, //shiftY
+ {0,128,128,0}, //black
+ FOURCC_NV21, FOURCC_NV21, &MEDIASUBTYPE_NV21
};
-const TcspFcc cspFccs[] =
+const TcspFcc cspFccs[]=
{
- _l("YV12") , FOURCC_YV12, FF_CSP_420P | FF_CSP_FLAGS_YUV_ADJ, false, true,
- _l("I420/IYUV"), FOURCC_I420, FF_CSP_420P | FF_CSP_FLAGS_YUV_ADJ | FF_CSP_FLAGS_YUV_ORDER, false, true,
- _l("YUY2") , FOURCC_YUY2, FF_CSP_YUY2, false, true,
- _l("YVYU") , FOURCC_YVYU, FF_CSP_YVYU, false, true,
- _l("UYVY") , FOURCC_UYVY, FF_CSP_UYVY, false, true,
- _l("VYUY") , FOURCC_VYUY, FF_CSP_VYUY, false, true,
- _l("RGB32") , FOURCC_RGB3, FF_CSP_RGB32, true, true,
- _l("RGB24") , FOURCC_RGB2, FF_CSP_RGB24, true, true,
- _l("RGB555") , FOURCC_RGB5, FF_CSP_RGB15, true, true,
- _l("RGB565") , FOURCC_RGB6, FF_CSP_RGB16, true, true,
- _l("CLJR") , FOURCC_CLJR, FF_CSP_CLJR, false, false,
- _l("Y800") , FOURCC_Y800, FF_CSP_Y800, false, true,
- _l("NV12") , FOURCC_NV12, FF_CSP_NV12, false, false,
- _l("NV21") , FOURCC_NV21, FF_CSP_NV12 | FF_CSP_FLAGS_YUV_ORDER, false, false,
- NULL, 0
+ _l("YV12") ,FOURCC_YV12,FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ,false,true,
+ _l("I420/IYUV"),FOURCC_I420,FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ|FF_CSP_FLAGS_YUV_ORDER,false,true,
+ _l("YUY2") ,FOURCC_YUY2,FF_CSP_YUY2,false,true,
+ _l("YVYU") ,FOURCC_YVYU,FF_CSP_YVYU,false,true,
+ _l("UYVY") ,FOURCC_UYVY,FF_CSP_UYVY,false,true,
+ _l("VYUY") ,FOURCC_VYUY,FF_CSP_VYUY,false,true,
+ _l("RGB32") ,FOURCC_RGB3,FF_CSP_RGB32,true,true,
+ _l("RGB24") ,FOURCC_RGB2,FF_CSP_RGB24,true,true,
+ _l("RGB555") ,FOURCC_RGB5,FF_CSP_RGB15,true,true,
+ _l("RGB565") ,FOURCC_RGB6,FF_CSP_RGB16,true,true,
+ _l("CLJR") ,FOURCC_CLJR,FF_CSP_CLJR,false,false,
+ _l("Y800") ,FOURCC_Y800,FF_CSP_Y800,false,true,
+ _l("NV12") ,FOURCC_NV12,FF_CSP_NV12,false,false,
+ _l("NV21") ,FOURCC_NV21,FF_CSP_NV12|FF_CSP_FLAGS_YUV_ORDER,false,false,
+ NULL,0
};
-char_t* csp_getName(int csp, char_t *buf, size_t len)
+char_t* csp_getName(int csp,char_t *buf,size_t len)
{
- return csp_getName(csp_getInfo(csp), csp, buf, len);
+ return csp_getName(csp_getInfo(csp),csp,buf,len);
}
-char_t* csp_getName(const TcspInfo *cspInfo, int csp, char_t *buf, size_t len)
+char_t* csp_getName(const TcspInfo *cspInfo,int csp,char_t *buf,size_t len)
{
- const char_t *colorspaceName = cspInfo ? cspInfo->name : _l("unknown");
- _sntprintf_s(buf,
- len,
- _TRUNCATE,
- _l("%s%s%s%s%s%s"),
- colorspaceName,
- csp & FF_CSP_FLAGS_VFLIP ? _l(",flipped") : _l(""),
- csp & FF_CSP_FLAGS_INTERLACED ? _l(",interlaced") : _l(""),
- csp & FF_CSP_FLAGS_YUV_ADJ ? _l(",adj") : _l(""),
- csp & FF_CSP_FLAGS_YUV_ORDER ? _l(",VU") : _l(""),
- csp & FF_CSP_FLAGS_YUV_JPEG ? _l(",JPEG") : _l(""));
- return buf;
+ const char_t *colorspaceName=cspInfo?cspInfo->name:_l("unknown");
+ _sntprintf_s(buf,
+ len,
+ _TRUNCATE,
+ _l("%s%s%s%s%s%s"),
+ colorspaceName,
+ csp & FF_CSP_FLAGS_VFLIP ? _l(",flipped") : _l(""),
+ csp & FF_CSP_FLAGS_INTERLACED ? _l(",interlaced") : _l(""),
+ csp & FF_CSP_FLAGS_YUV_ADJ ? _l(",adj") : _l(""),
+ csp & FF_CSP_FLAGS_YUV_ORDER ? _l(",VU") : _l(""),
+ csp & FF_CSP_FLAGS_YUV_JPEG ? _l(",JPEG") : _l(""));
+ return buf;
}
const TcspInfo* csp_getInfoFcc(FOURCC fcccsp)
{
- if(fcccsp == FOURCC_IYUV || fcccsp == FOURCC_I420)
- return &cspInfoIYUV;
- else
- {
- for(int i = 0; i < FF_CSPS_NUM; i++)
- if(cspInfos[i].fcccsp == fcccsp)
- return cspInfos + i;
- return NULL;
- }
+ if (fcccsp==FOURCC_IYUV || fcccsp==FOURCC_I420)
+ return &cspInfoIYUV;
+ else
+ {
+ for (int i=0;i<FF_CSPS_NUM;i++)
+ if (cspInfos[i].fcccsp==fcccsp)
+ return cspInfos+i;
+ return NULL;
+ }
}
-int csp_bestMatch(int inCSP, int wantedCSPS, int *rank)
+int csp_bestMatch(int inCSP,int wantedCSPS,int *rank)
{
- int outCSP = inCSP & wantedCSPS & FF_CSPS_MASK;
- if(outCSP)
- {
- if(rank) *rank = 100;
- return outCSP | (inCSP&~FF_CSPS_MASK);
- }
+ int outCSP=inCSP&wantedCSPS&FF_CSPS_MASK;
+ if (outCSP)
+ {
+ if (rank) *rank=100;
+ return outCSP|(inCSP&~FF_CSPS_MASK);
+ }
- const int *bestcsps = NULL;
- switch(inCSP & FF_CSPS_MASK)
- {
- case FF_CSP_420P:
+ const int *bestcsps=NULL;
+ switch (inCSP&FF_CSPS_MASK)
+ {
+ case FF_CSP_420P:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_422P:
+ case FF_CSP_422P:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_YUY2 ,
- FF_CSP_420P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_YUY2 ,
+ FF_CSP_420P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_444P:
+ case FF_CSP_444P:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_422P ,
- FF_CSP_420P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_422P ,
+ FF_CSP_420P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_411P:
+ case FF_CSP_411P:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_410P:
+ case FF_CSP_410P:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_YUY2:
+ case FF_CSP_YUY2:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_UYVY:
+ case FF_CSP_UYVY:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_YUY2 ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_YUY2 ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_YVYU:
+ case FF_CSP_YVYU:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_VYUY ,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_VYUY ,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_VYUY:
+ case FF_CSP_VYUY:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_ABGR:
+ case FF_CSP_ABGR:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_RGBA:
+ case FF_CSP_RGBA:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_ABGR ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_ABGR ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_BGR32:
+ case FF_CSP_BGR32:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_BGR24:
+ case FF_CSP_BGR24:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_RGB24,
- FF_CSP_BGR32,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_RGB32,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_RGB24,
+ FF_CSP_BGR32,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_RGB32,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_BGR15:
+ case FF_CSP_BGR15:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_BGR32,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR24,
- FF_CSP_BGR16,
- FF_CSP_RGB32,
- FF_CSP_RGB24,
- FF_CSP_RGB15,
- FF_CSP_RGB16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_BGR32,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB32,
+ FF_CSP_RGB24,
+ FF_CSP_RGB15,
+ FF_CSP_RGB16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_BGR16:
+ case FF_CSP_BGR16:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_BGR32,
- FF_CSP_BGR24,
- FF_CSP_BGR15,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_RGB32,
- FF_CSP_RGB24,
- FF_CSP_RGB15,
- FF_CSP_RGB16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_BGR32,
+ FF_CSP_BGR24,
+ FF_CSP_BGR15,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_RGB32,
+ FF_CSP_RGB24,
+ FF_CSP_RGB15,
+ FF_CSP_RGB16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_RGB32:
+ case FF_CSP_RGB32:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR15,
- FF_CSP_BGR16,
- FF_CSP_RGB15,
- FF_CSP_RGB16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR15,
+ FF_CSP_BGR16,
+ FF_CSP_RGB15,
+ FF_CSP_RGB16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_RGB24:
+ case FF_CSP_RGB24:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_BGR24,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR15,
- FF_CSP_BGR16,
- FF_CSP_RGB15,
- FF_CSP_RGB16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_BGR24,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR15,
+ FF_CSP_BGR16,
+ FF_CSP_RGB15,
+ FF_CSP_RGB16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_RGB15:
+ case FF_CSP_RGB15:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_BGR15,
- FF_CSP_RGB32,
- FF_CSP_RGB24,
- FF_CSP_RGB16,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_BGR24,
- FF_CSP_BGR16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_BGR15,
+ FF_CSP_RGB32,
+ FF_CSP_RGB24,
+ FF_CSP_RGB16,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_BGR24,
+ FF_CSP_BGR16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_RGB16:
+ case FF_CSP_RGB16:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_RGB15,
- FF_CSP_RGB32,
- FF_CSP_RGB24,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_BGR24,
- FF_CSP_BGR15,
- FF_CSP_BGR16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_RGB15,
+ FF_CSP_RGB32,
+ FF_CSP_RGB24,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_BGR24,
+ FF_CSP_BGR15,
+ FF_CSP_BGR16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_PAL8:
+ case FF_CSP_PAL8:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_RGB32,
- FF_CSP_BGR32,
- FF_CSP_RGB24,
- FF_CSP_BGR24,
- FF_CSP_RGB15,
- FF_CSP_BGR15,
- FF_CSP_RGB16,
- FF_CSP_BGR16,
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_RGB32,
+ FF_CSP_BGR32,
+ FF_CSP_RGB24,
+ FF_CSP_BGR24,
+ FF_CSP_RGB15,
+ FF_CSP_BGR15,
+ FF_CSP_RGB16,
+ FF_CSP_BGR16,
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_CLJR:
+ case FF_CSP_CLJR:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- case FF_CSP_Y800:
+ case FF_CSP_Y800:
{
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
- }
- case FF_CSP_NV12:
- {
- static const int best[FF_CSPS_NUM] =
- {
- FF_CSP_420P ,
- FF_CSP_422P ,
- FF_CSP_444P ,
- FF_CSP_411P ,
- FF_CSP_410P ,
- FF_CSP_YUY2 ,
- FF_CSP_UYVY ,
- FF_CSP_YVYU ,
- FF_CSP_VYUY ,
- FF_CSP_ABGR ,
- FF_CSP_RGBA ,
- FF_CSP_BGR32,
- FF_CSP_RGB32,
- FF_CSP_BGR24,
- FF_CSP_RGB24,
- FF_CSP_BGR16,
- FF_CSP_RGB16,
- FF_CSP_BGR15,
- FF_CSP_RGB15,
- FF_CSP_NULL
- };
- bestcsps = best;
- break;
- }
- default:
- return FF_CSP_NULL;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- if(rank) *rank = 99;
- while(*bestcsps)
+ case FF_CSP_NV12:
{
- if(*bestcsps & wantedCSPS)
- return *bestcsps | (inCSP&~FF_CSPS_MASK);
- bestcsps++;
- if(rank)(*rank)--;
+ static const int best[FF_CSPS_NUM]=
+ {
+ FF_CSP_420P ,
+ FF_CSP_422P ,
+ FF_CSP_444P ,
+ FF_CSP_411P ,
+ FF_CSP_410P ,
+ FF_CSP_YUY2 ,
+ FF_CSP_UYVY ,
+ FF_CSP_YVYU ,
+ FF_CSP_VYUY ,
+ FF_CSP_ABGR ,
+ FF_CSP_RGBA ,
+ FF_CSP_BGR32,
+ FF_CSP_RGB32,
+ FF_CSP_BGR24,
+ FF_CSP_RGB24,
+ FF_CSP_BGR16,
+ FF_CSP_RGB16,
+ FF_CSP_BGR15,
+ FF_CSP_RGB15,
+ FF_CSP_NULL
+ };
+ bestcsps=best;
+ break;
}
- return FF_CSP_NULL;
+ default:return FF_CSP_NULL;
+ }
+ if (rank) *rank=99;
+ while (*bestcsps)
+ {
+ if (*bestcsps&wantedCSPS)
+ return *bestcsps|(inCSP&~FF_CSPS_MASK);
+ bestcsps++;
+ if (rank) (*rank)--;
+ }
+ return FF_CSP_NULL;
}
-bool TcspInfos::TsortFc::operator()(const TcspInfo* &csp1, const TcspInfo* &csp2)
+bool TcspInfos::TsortFc::operator ()(const TcspInfo* &csp1,const TcspInfo* &csp2)
{
- int rank1;
- csp_bestMatch(csp, csp1->id, &rank1);
- int rank2;
- csp_bestMatch(csp, csp2->id, &rank2);
- return rank1 > rank2;
+ int rank1;csp_bestMatch(csp,csp1->id,&rank1);
+ int rank2;csp_bestMatch(csp,csp2->id,&rank2);
+ return rank1>rank2;
}
//void TcspInfos::sort(int csp)
//{
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h b/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h
index 6074019fa..5e116d904 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h
@@ -1,89 +1,32 @@
#ifndef _PODTYPES_H_
#define _PODTYPES_H_
-template<class T> struct isPOD
-{
- enum {is = false};
-};
-template<> struct isPOD<bool>
-{
- enum {is = true};
-};
+template<class T> struct isPOD {enum {is=false};};
+template<> struct isPOD<bool> {enum {is=true};};
-template<> struct isPOD<char>
-{
- enum {is = true};
-};
+template<> struct isPOD<char> {enum {is=true};};
-template<> struct isPOD<signed char>
-{
- enum {is = true};
-};
-template<> struct isPOD<short int>
-{
- enum {is = true};
-};
-template<> struct isPOD<int>
-{
- enum {is = true};
-};
-template<> struct isPOD<long int>
-{
- enum {is = true};
-};
-template<> struct isPOD<__int64>
-{
- enum {is = true};
-};
+template<> struct isPOD<signed char> {enum {is=true};};
+template<> struct isPOD<short int> {enum {is=true};};
+template<> struct isPOD<int> {enum {is=true};};
+template<> struct isPOD<long int> {enum {is=true};};
+template<> struct isPOD<__int64> {enum {is=true};};
-template<> struct isPOD<unsigned char>
-{
- enum {is = true};
-};
-template<> struct isPOD<unsigned short int>
-{
- enum {is = true};
-};
-template<> struct isPOD<unsigned int>
-{
- enum {is = true};
-};
-template<> struct isPOD<unsigned long int>
-{
- enum {is = true};
-};
-template<> struct isPOD<unsigned __int64>
-{
- enum {is = true};
-};
+template<> struct isPOD<unsigned char> {enum {is=true};};
+template<> struct isPOD<unsigned short int> {enum {is=true};};
+template<> struct isPOD<unsigned int> {enum {is=true};};
+template<> struct isPOD<unsigned long int> {enum {is=true};};
+template<> struct isPOD<unsigned __int64> {enum {is=true};};
-template<> struct isPOD<float>
-{
- enum {is = true};
-};
-template<> struct isPOD<double>
-{
- enum {is = true};
-};
-template<> struct isPOD<long double>
-{
- enum {is = true};
-};
+template<> struct isPOD<float> {enum {is=true};};
+template<> struct isPOD<double> {enum {is=true};};
+template<> struct isPOD<long double> {enum {is=true};};
#if defined(__INTEL_COMPILER) || defined(__GNUC__) || (_MSC_VER>=1300)
-template<> struct isPOD<wchar_t>
-{
- enum {is = true};
-};
-template<class Tp> struct isPOD<Tp*>
-{
- enum {is = true};
-};
+template<> struct isPOD<wchar_t> {enum {is=true};};
+template<class Tp> struct isPOD<Tp*> {enum {is=true};};
#endif
-template<class A> struct allocator_traits
-{
- enum {is_static = false};
-};
+template<class A> struct allocator_traits {enum {is_static=false};};
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h b/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h
index ae0ebae9a..a22137d23 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h
@@ -1,71 +1,50 @@
#ifndef _ARRAY_ALLOCATOR_H_
#define _ARRAY_ALLOCATOR_H_
-template <class T, size_t size> class array_allocator
+template <class T,size_t size> class array_allocator
{
private:
- T array[size];
+ T array[size];
public:
- typedef T value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
- typedef T* pointer;
- typedef const T* const_pointer;
+ typedef T* pointer;
+ typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
+ typedef T& reference;
+ typedef const T& const_reference;
- pointer address(reference r) const
- {
- return &r;
- }
- const_pointer address(const_reference r) const
- {
- return &r;
- }
+ pointer address(reference r) const { return &r; }
+ const_pointer address(const_reference r) const { return &r; }
- array_allocator() throw() {}
- template <class U, size_t sz> array_allocator(const array_allocator<U, sz>&) throw() {}
- ~array_allocator() throw() {}
+ array_allocator() throw(){}
+ template <class U,size_t sz> array_allocator(const array_allocator<U,sz>& ) throw() {}
+ ~array_allocator() throw(){}
- pointer allocate(size_type n, const void* = 0)
- {
- return array;
- }
- void deallocate(pointer p, size_type)
- {
- }
+ pointer allocate(size_type n, const void* = 0)
+ {
+ return array;
+ }
+ void deallocate(pointer p, size_type)
+ {
+ }
-//Use placement new to engage the constructor
- void construct(pointer p, const T& val)
- {
- new((void*)p) T(val);
- }
- void destroy(pointer p)
- {
- ((T*)p)->~T();
- }
+ //Use placement new to engage the constructor
+ void construct(pointer p, const T& val) { new((void*)p) T(val); }
+ void destroy(pointer p){ ((T*)p)->~T(); }
- size_type max_size() const throw()
- {
- return size;
- }
- template<class U> struct rebind
- {
- typedef array_allocator<U, size> other;
- };
+ size_type max_size() const throw() {return size;}
+ template<class U> struct rebind { typedef array_allocator<U,size> other; };
};
-template<class T, size_t size> struct array_vector : std::vector<T, array_allocator<T, size> >
+template<class T,size_t size> struct array_vector : std::vector<T, array_allocator<T,size> >
{
};
#if defined(__INTEL_COMPILER) || defined(__GNUC__) || (_MSC_VER>=1300)
-template<class T, size_t a> struct allocator_traits<array_allocator<T, a> >
-{
- enum {is_static = true};
-};
+ template<class T,size_t a> struct allocator_traits<array_allocator<T,a> > {enum {is_static=true};};
#endif
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h b/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h
index 9fa92686f..e25cb5dc5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h
@@ -7,154 +7,61 @@
#undef _l
#ifdef UNICODE
-typedef wchar_t char_t;
-#define tsprintf swprintf
-#define tsnprintf _snwprintf
-#define tfprintf fwprintf
-#define tsscanf swscanf
-#define __l(x) L ## x
-#define _l(x) __l(x)
+ typedef wchar_t char_t;
+ #define tsprintf swprintf
+ #define tsnprintf _snwprintf
+ #define tfprintf fwprintf
+ #define tsscanf swscanf
+ #define __l(x) L ## x
+ #define _l(x) __l(x)
#else
-typedef char char_t;
-#define tsprintf sprintf
-#define tsnprintf _snprintf
-#define tfprintf fprintf
-#define tsscanf sscanf
-#define _l(x) x
+ typedef char char_t;
+ #define tsprintf sprintf
+ #define tsnprintf _snprintf
+ #define tfprintf fprintf
+ #define tsscanf sscanf
+ #define _l(x) x
#endif
#ifdef __cplusplus
#ifdef __GNUC__
-#ifndef __forceinline
-#define __forceinline __attribute__((__always_inline__)) inline
-#endif
+ #ifndef __forceinline
+ #define __forceinline __attribute__((__always_inline__)) inline
+ #endif
#endif
-static __forceinline wchar_t* strcat(wchar_t *a, const wchar_t *b)
-{
- return wcscat(a, b);
-}
-static __forceinline wchar_t* strncat(wchar_t *a, const wchar_t *b, size_t c)
-{
- return wcsncat(a, b, c);
-}
-static __forceinline int strcmp(const wchar_t *a, const wchar_t *b)
-{
- return wcscmp(a, b);
-}
-static __forceinline int strncmp(const wchar_t *a, const wchar_t *b, size_t c)
-{
- return wcsncmp(a, b, c);
-}
-static __forceinline int strnicmp(const wchar_t *a, const wchar_t *b, size_t c)
-{
- return _wcsnicmp(a, b, c);
-}
-static __forceinline wchar_t* strncpy(wchar_t *a, const wchar_t *b, size_t c)
-{
- return wcsncpy(a, b, c);
-}
-static __forceinline long strtol(const wchar_t *a, wchar_t **b, int c)
-{
- return wcstol(a, b, c);
-}
-static __forceinline wchar_t* strchr(const wchar_t *a, wchar_t b)
-{
- return (wchar_t*)wcschr(a, b);
-}
-static __forceinline int _strnicmp(const wchar_t *a, const wchar_t *b, size_t c)
-{
- return _wcsnicmp(a, b, c);
-}
-static __forceinline wchar_t* strstr(const wchar_t *a, const wchar_t *b)
-{
- return (wchar_t*)wcsstr(a, b);
-}
-static __forceinline size_t strlen(const wchar_t *a)
-{
- return wcslen(a);
-}
-static __forceinline wchar_t* strcpy(wchar_t *a, const wchar_t *b)
-{
- return wcscpy(a, b);
-}
-static __forceinline int atoi(const wchar_t *a)
-{
- return _wtoi(a);
-}
-static __forceinline wchar_t* _itoa(int a, wchar_t *b, int c)
-{
- return _itow(a, b, c);
-}
-static __forceinline int stricmp(const wchar_t *a, const wchar_t *b)
-{
- return _wcsicmp(a, b);
-}
-static __forceinline unsigned long strtoul(const wchar_t *a, wchar_t **b, int c)
-{
- return wcstoul(a, b, c);
-}
-static __forceinline double strtod(const wchar_t *a, wchar_t **b)
-{
- return wcstod(a, b);
-}
-static __forceinline int vsprintf(wchar_t *a, const wchar_t *b, va_list c)
-{
- return vswprintf(a, b, c);
-}
-static __forceinline int _vsnprintf(wchar_t *a, size_t b, const wchar_t *c, va_list d)
-{
- return _vsnwprintf(a, b, c, d);
-}
-static __forceinline void _splitpath(const wchar_t *a, wchar_t *b, wchar_t *c, wchar_t *d, wchar_t *e)
-{
- _wsplitpath(a, b, c, d, e);
-}
-static __forceinline void _makepath(wchar_t *a, const wchar_t *b, const wchar_t *c, const wchar_t *d, const wchar_t *e)
-{
- _wmakepath(a, b, c, d, e);
-}
-static __forceinline FILE* fopen(const wchar_t *a, const wchar_t *b)
-{
- return _wfopen(a, b);
-}
-static __forceinline int fputs(const wchar_t *a, FILE *b)
-{
- return fputws(a, b);
-}
-static __forceinline int _stricoll(const wchar_t *a, const wchar_t *b)
-{
- return _wcsicoll(a, b);
-}
-static __forceinline wchar_t* strrchr(const wchar_t *a, wchar_t b)
-{
- return (wchar_t*)wcsrchr(a, b);
-}
-static __forceinline wchar_t* strupr(wchar_t *a)
-{
- return _wcsupr(a);
-}
-static __forceinline wchar_t* strlwr(wchar_t *a)
-{
- return _wcslwr(a);
-}
-static __forceinline wchar_t* _strtime(wchar_t *a)
-{
- return _wstrtime(a);
-}
-static __forceinline wchar_t* memchr(wchar_t *a, wchar_t b, size_t c)
-{
- return wmemchr(a, b, c);
-}
-static __forceinline const wchar_t* memchr(const wchar_t *a, wchar_t b, size_t c)
-{
- return wmemchr(a, b, c);
-}
-static __forceinline wchar_t* strpbrk(const wchar_t *a, const wchar_t *b)
-{
- return (wchar_t*)wcspbrk(a, b);
-}
+static __forceinline wchar_t* strcat(wchar_t *a, const wchar_t *b) {return wcscat(a,b);}
+static __forceinline wchar_t* strncat(wchar_t *a, const wchar_t *b,size_t c) {return wcsncat(a,b,c);}
+static __forceinline int strcmp(const wchar_t *a, const wchar_t *b) {return wcscmp(a,b);}
+static __forceinline int strncmp(const wchar_t *a, const wchar_t *b, size_t c) {return wcsncmp(a,b,c);}
+static __forceinline int strnicmp(const wchar_t *a, const wchar_t *b,size_t c) {return _wcsnicmp(a,b,c);}
+static __forceinline wchar_t* strncpy(wchar_t *a, const wchar_t *b, size_t c) {return wcsncpy(a,b,c);}
+static __forceinline long strtol(const wchar_t *a, wchar_t **b, int c) {return wcstol(a,b,c);}
+static __forceinline wchar_t* strchr(const wchar_t *a, wchar_t b) {return (wchar_t*)wcschr(a,b);}
+static __forceinline int _strnicmp(const wchar_t *a, const wchar_t *b, size_t c) {return _wcsnicmp(a,b,c);}
+static __forceinline wchar_t* strstr(const wchar_t *a, const wchar_t *b) {return (wchar_t*)wcsstr(a,b);}
+static __forceinline size_t strlen(const wchar_t *a) {return wcslen(a);}
+static __forceinline wchar_t* strcpy(wchar_t *a, const wchar_t *b) {return wcscpy(a,b);}
+static __forceinline int atoi(const wchar_t *a) {return _wtoi(a);}
+static __forceinline wchar_t* _itoa(int a, wchar_t *b, int c) {return _itow(a,b,c);}
+static __forceinline int stricmp(const wchar_t *a, const wchar_t *b) {return _wcsicmp(a,b);}
+static __forceinline unsigned long strtoul(const wchar_t *a,wchar_t **b,int c) {return wcstoul(a,b,c);}
+static __forceinline double strtod(const wchar_t *a, wchar_t **b) {return wcstod(a,b);}
+static __forceinline int vsprintf(wchar_t *a, const wchar_t *b, va_list c) {return vswprintf(a,b,c);}
+static __forceinline int _vsnprintf(wchar_t *a, size_t b, const wchar_t *c, va_list d) {return _vsnwprintf(a,b,c,d);}
+static __forceinline void _splitpath(const wchar_t *a, wchar_t *b, wchar_t *c, wchar_t *d, wchar_t *e) {_wsplitpath(a,b,c,d,e);}
+static __forceinline void _makepath(wchar_t *a, const wchar_t *b, const wchar_t *c, const wchar_t *d,const wchar_t *e) {_wmakepath(a,b,c,d,e);}
+static __forceinline FILE* fopen(const wchar_t *a, const wchar_t *b) {return _wfopen(a,b);}
+static __forceinline int fputs(const wchar_t *a, FILE *b) {return fputws(a,b);}
+static __forceinline int _stricoll(const wchar_t *a, const wchar_t *b) {return _wcsicoll(a,b);}
+static __forceinline wchar_t* strrchr(const wchar_t *a, wchar_t b) {return (wchar_t*)wcsrchr(a,b);}
+static __forceinline wchar_t* strupr(wchar_t *a) {return _wcsupr(a);}
+static __forceinline wchar_t* strlwr(wchar_t *a) {return _wcslwr(a);}
+static __forceinline wchar_t* _strtime(wchar_t *a) {return _wstrtime(a);}
+static __forceinline wchar_t* memchr(wchar_t *a,wchar_t b,size_t c) {return wmemchr(a,b,c);}
+static __forceinline const wchar_t* memchr(const wchar_t *a,wchar_t b,size_t c) {return wmemchr(a,b,c);}
+static __forceinline wchar_t* strpbrk(const wchar_t *a, const wchar_t *b) {return (wchar_t*)wcspbrk(a,b);}
template<class Tout> struct text
// ANSI <--> UNICODE conversion.
@@ -164,94 +71,88 @@ template<class Tout> struct text
// outlen : count of characters, not byte size!!
{
private:
- Tout *buf;
- bool own;
+ Tout *buf;
+ bool own;
public:
- template<class Tin> inline text(const Tin *in);
- template<class Tin> inline text(const Tin *in, Tout *Ibuf);
- template<class Tin> inline text(const Tin *in, int inlen, Tout *Ibuf, size_t outlen);
- ~text()
- {
- if(own) delete []buf;
- }
- operator const Tout*() const
- {
- return buf;
- }
+ template<class Tin> inline text(const Tin *in);
+ template<class Tin> inline text(const Tin *in,Tout *Ibuf);
+ template<class Tin> inline text(const Tin *in,int inlen,Tout *Ibuf,size_t outlen);
+ ~text() {if (own) delete []buf;}
+ operator const Tout*() const {return buf;}
};
-template<> template<> inline text<char>::text(const char *in): buf(const_cast<char*>(in)), own(false) {}
-template<> template<> inline text<char>::text(const char *in, char *Ibuf): buf(strcpy(Ibuf, in)), own(false) {}
-template<> template<> inline text<char>::text(const char *in, int inlen, char *Ibuf, size_t outlen): own(false)
+template<> template<> inline text<char>::text(const char *in):buf(const_cast<char*>(in)),own(false) {}
+template<> template<> inline text<char>::text(const char *in,char *Ibuf):buf(strcpy(Ibuf,in)),own(false) {}
+template<> template<> inline text<char>::text(const char *in,int inlen,char *Ibuf,size_t outlen):own(false)
{
- if(inlen != -1)
- buf = strncpy(Ibuf, in, ((size_t)inlen < outlen ? inlen : outlen));
- else
- {
- size_t inlen1 = strlen(in) + 1;
- buf = strncpy(Ibuf, in, inlen1 < outlen ? inlen1 : outlen);
- }
+ if (inlen!=-1)
+ buf=strncpy(Ibuf,in,((size_t)inlen < outlen ? inlen : outlen));
+ else
+ {
+ size_t inlen1=strlen(in)+1;
+ buf=strncpy(Ibuf,in,inlen1 < outlen ? inlen1 : outlen);
+ }
}
-template<> template<> inline text<wchar_t>::text(const wchar_t *in): buf(const_cast<wchar_t*>(in)), own(false) {}
-template<> template<> inline text<wchar_t>::text(const wchar_t *in, wchar_t *Ibuf): buf(strcpy(Ibuf, in)), own(false) {}
-template<> template<> inline text<wchar_t>::text(const wchar_t *in, int inlen, wchar_t *Ibuf, size_t outlen): own(false)
+template<> template<> inline text<wchar_t>::text(const wchar_t *in):buf(const_cast<wchar_t*>(in)),own(false) {}
+template<> template<> inline text<wchar_t>::text(const wchar_t *in,wchar_t *Ibuf):buf(strcpy(Ibuf,in)),own(false) {}
+template<> template<> inline text<wchar_t>::text(const wchar_t *in,int inlen,wchar_t *Ibuf,size_t outlen):own(false)
{
- if(inlen != -1)
- buf = strncpy(Ibuf, in, ((size_t)inlen < outlen ? inlen : outlen));
- else
- {
- size_t inlen1 = strlen(in) + 1;
- buf = strncpy(Ibuf, in, inlen1 < outlen ? inlen1 : outlen);
- }
+ if (inlen!=-1)
+ buf=strncpy(Ibuf,in,((size_t)inlen < outlen ? inlen : outlen));
+ else
+ {
+ size_t inlen1=strlen(in)+1;
+ buf=strncpy(Ibuf,in,inlen1 < outlen ? inlen1 : outlen);
+ }
}
-template<> template<> inline text<wchar_t>::text(const char *in): own(in ? true : false)
+template<> template<> inline text<wchar_t>::text(const char *in):own(in?true:false)
{
- if(in)
- {
- size_t l = strlen(in);
- buf = new wchar_t[l+1];
- MultiByteToWideChar(CP_ACP, 0, in, int(l + 1), buf, int(l + 1));
- }
- else
- buf = NULL;
+ if (in)
+ {
+ size_t l=strlen(in);
+ buf=new wchar_t[l+1];
+ MultiByteToWideChar(CP_ACP,0,in,int(l+1),buf,int(l+1));
+ }
+ else
+ buf=NULL;
}
-template<> template<> inline text<wchar_t>::text(const char *in, wchar_t *Ibuf): own(false), buf(Ibuf)
+template<> template<> inline text<wchar_t>::text(const char *in,wchar_t *Ibuf):own(false),buf(Ibuf)
{
- size_t l = strlen(in);
- MultiByteToWideChar(CP_ACP, 0, in, int(l + 1), buf, int(l + 1));
+ size_t l=strlen(in);
+ MultiByteToWideChar(CP_ACP,0,in,int(l+1),buf,int(l+1));
}
-template<> template<> inline text<wchar_t>::text(const char *in, int inlen, wchar_t *Ibuf, size_t outlen): own(false), buf(Ibuf)
+template<> template<> inline text<wchar_t>::text(const char *in,int inlen,wchar_t *Ibuf,size_t outlen):own(false),buf(Ibuf)
{
- MultiByteToWideChar(CP_ACP, 0, in, int(inlen), buf, int(outlen));
+ MultiByteToWideChar(CP_ACP,0,in,int(inlen),buf,int(outlen));
}
-template<> template<> inline text<char>::text(const wchar_t *in): own(in ? true : false)
+template<> template<> inline text<char>::text(const wchar_t *in):own(in?true:false)
{
- if(in)
- {
- size_t l = strlen(in);
- int length = WideCharToMultiByte(CP_ACP, 0, in, int(l + 1), buf, 0, NULL, NULL);
- buf = new char[length+1];
- WideCharToMultiByte(CP_ACP, 0, in, int(l + 1), buf, int(length + 1), NULL, NULL);
- }
- else
- buf = NULL;
+ if (in)
+ {
+ size_t l=strlen(in);
+ int length=WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,0,NULL,NULL);
+ buf=new char[length+1];
+ WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,int(length+1),NULL,NULL);
+ }
+ else
+ buf=NULL;
}
-template<> template<> inline text<char>::text(const wchar_t *in, char *Ibuf): own(false), buf(Ibuf)
+template<> template<> inline text<char>::text(const wchar_t *in,char *Ibuf):own(false),buf(Ibuf)
{
- size_t l = strlen(in);
- int length = WideCharToMultiByte(CP_ACP, 0, in, int(l + 1), buf, 0, NULL, NULL);
- WideCharToMultiByte(CP_ACP, 0, in, int(l + 1), buf, length, NULL, NULL);
+ size_t l=strlen(in);
+ int length= WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,0,NULL,NULL);
+ WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,length,NULL,NULL);
}
-template<> template<> inline text<char>::text(const wchar_t *in, int inlen, char *Ibuf, size_t outlen): own(false), buf(Ibuf)
+template<> template<> inline text<char>::text(const wchar_t *in,int inlen,char *Ibuf,size_t outlen):own(false),buf(Ibuf)
{
- WideCharToMultiByte(CP_ACP, 0, in, int(inlen), buf, int(outlen), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0,in,int(inlen),buf,int(outlen),NULL,NULL);
}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/compiler.h b/src/filters/transform/MPCVideoDec/ffmpeg/compiler.h
index 8ea0c854a..ce927530b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/compiler.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/compiler.h
@@ -2,53 +2,53 @@
#define _COMPILER_H_
#ifndef STRINGIFY
-#define STRINGIFY(s) TOSTRING(s)
-#define TOSTRING(s) #s
+ #define STRINGIFY(s) TOSTRING(s)
+ #define TOSTRING(s) #s
#endif
#if defined(__INTEL_COMPILER)
-#if __INTEL_COMPILER >= 1100
-#define COMPILER "icl 11"
-#elif __INTEL_COMPILER >= 1000
-#define COMPILER "icl 10"
-#elif __INTEL_COMPILER >= 900
-#define COMPILER "icl 9"
-#elif __INTEL_COMPILER >= 800
-#define COMPILER "icl 8"
-#else
-#define COMPILER "icl"
-#endif
+ #if __INTEL_COMPILER >= 1100
+ #define COMPILER "icl 11"
+ #elif __INTEL_COMPILER >= 1000
+ #define COMPILER "icl 10"
+ #elif __INTEL_COMPILER >= 900
+ #define COMPILER "icl 9"
+ #elif __INTEL_COMPILER >= 800
+ #define COMPILER "icl 8"
+ #else
+ #define COMPILER "icl"
+ #endif
#elif defined(_MSC_VER)
-#if _MSC_VER>=1500
-#define COMPILER "msvc 2008"
-#elif _MSC_VER>=1400
-#define COMPILER "msvc 2005"
-#elif _MSC_VER>=1300
-#define COMPILER "msvc 2003"
-#else
+ #if _MSC_VER>=1500
+ #define COMPILER "msvc 2008"
+ #elif _MSC_VER>=1400
+ #define COMPILER "msvc 2005"
+ #elif _MSC_VER>=1300
+ #define COMPILER "msvc 2003"
+ #else
#define COMPILER "unknown and not supported"
-#endif
+ #endif
#elif defined(__GNUC__)
-#ifdef __SSE__
-#define COMPILER_SSE " sse"
-#ifdef __SSE2__
-#define COMPILER_SSE2 ",sse2"
+ #ifdef __SSE__
+ #define COMPILER_SSE " sse"
+ #ifdef __SSE2__
+ #define COMPILER_SSE2 ",sse2"
+ #else
+ #define COMPILER_SSE2 ""
+ #endif
+ #else
+ #define COMPILER_SSE ""
+ #define COMPILER_SSE2 ""
+ #endif
+ #define COMPILER "MinGW GCC "STRINGIFY(__GNUC__)"."STRINGIFY(__GNUC_MINOR__)"."STRINGIFY(__GNUC_PATCHLEVEL__) COMPILER_SSE COMPILER_SSE2
#else
-#define COMPILER_SSE2 ""
-#endif
-#else
-#define COMPILER_SSE ""
-#define COMPILER_SSE2 ""
-#endif
-#define COMPILER "MinGW GCC "STRINGIFY(__GNUC__)"."STRINGIFY(__GNUC_MINOR__)"."STRINGIFY(__GNUC_PATCHLEVEL__) COMPILER_SSE COMPILER_SSE2
-#else
-#define COMPILER "unknown and not supported"
+ #define COMPILER "unknown and not supported"
#endif
#ifdef _WIN64
-#define COMPILER_X64 ", x64"
+ #define COMPILER_X64 ", x64"
#else
-#define COMPILER_X64 ", x86"
+ #define COMPILER_X64 ", x86"
#endif
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/config.h b/src/filters/transform/MPCVideoDec/ffmpeg/config.h
index 263e29d87..27413f2d5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/config.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/config.h
@@ -1,30 +1,30 @@
#ifdef __GNUC__
-#define HAVE_INLINE_ASM 1
-#define HAVE_MMX 1
-#define HAVE_SSE 1
-#define HAVE_SSSE3 1
-#define HAVE_AMD3DNOW 1
-#define HAVE_AMD3DNOWEXT 1
-
-#define ARCH_X86 1
-#ifdef ARCH_X86_64
-#define HAVE_FAST_64BIT 1
-#define HAVE_CMOV 1
-#define HAVE_FAST_CMOV 1
-#endif
+ #define HAVE_INLINE_ASM 1
+ #define HAVE_MMX 1
+ #define HAVE_SSE 1
+ #define HAVE_SSSE3 1
+ #define HAVE_AMD3DNOW 1
+ #define HAVE_AMD3DNOWEXT 1
+
+ #define ARCH_X86 1
+ #ifdef ARCH_X86_64
+ #define HAVE_FAST_64BIT 1
+ #define HAVE_CMOV 1
+ #define HAVE_FAST_CMOV 1
+ #endif
#else
-#define HAVE_INLINE_ASM 0
-#define HAVE_MMX 0
-#define HAVE_SSE 0
-#define HAVE_SSSE3 0
-#define HAVE_AMD3DNOW 0
-#define HAVE_AMD3DNOWEXT 0
-#define ARCH_X86 0
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define HAVE_FAST_64BIT 0
-#define HAVE_CMOV 0
-#define HAVE_FAST_CMOV 0
+ #define HAVE_INLINE_ASM 0
+ #define HAVE_MMX 0
+ #define HAVE_SSE 0
+ #define HAVE_SSSE3 0
+ #define HAVE_AMD3DNOW 0
+ #define HAVE_AMD3DNOWEXT 0
+ #define ARCH_X86 0
+ #define ARCH_X86_32 0
+ #define ARCH_X86_64 0
+ #define HAVE_FAST_64BIT 0
+ #define HAVE_CMOV 0
+ #define HAVE_FAST_CMOV 0
#endif
#define HAVE_TEN_OPERANDS 1
@@ -36,13 +36,13 @@
#define HAVE_FAST_UNALIGNED 1
#ifdef __GNUC__
-#define HAVE_ATTRIBUTE_PACKED 1
+ #define HAVE_ATTRIBUTE_PACKED 1
#else
-#define HAVE_ATTRIBUTE_PACKED 0
+ #define HAVE_ATTRIBUTE_PACKED 0
#endif
#ifndef __GNUC__
-#define EMULATE_FAST_INT
+ #define EMULATE_FAST_INT
#endif
#define HAVE_BSWAP 1
@@ -66,7 +66,7 @@
#define CONFIG_ZLIB 1
#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
+#define CONFIG_ENCODERS 0
#define CONFIG_AASC_DECODER 0
#define CONFIG_AMV_DECODER 1
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/cpudetect.h b/src/filters/transform/MPCVideoDec/ffmpeg/cpudetect.h
index ffc293271..3346c0b74 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/cpudetect.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/cpudetect.h
@@ -3,29 +3,28 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#define CPUTYPE_I386 3
#define CPUTYPE_I486 4
#define CPUTYPE_I586 5
#define CPUTYPE_I686 6
- typedef struct cpucaps_s
- {
- int hasMMX;
- int hasMMX2;
- int has3DNow;
- int has3DNowExt;
- int hasSSE;
- int hasSSE2;
- int hasSSSE3;
- int isP4HT; // -1: not initialized, 0: non P4Ht, ;1: p4HT
- } CpuCaps;
+typedef struct cpucaps_s {
+ int hasMMX;
+ int hasMMX2;
+ int has3DNow;
+ int has3DNowExt;
+ int hasSSE;
+ int hasSSE2;
+ int hasSSSE3;
+ int isP4HT; // -1: not initialized, 0: non P4Ht, ;1: p4HT
+} CpuCaps;
- extern CpuCaps gCpuCaps;
+extern CpuCaps gCpuCaps;
#ifdef __cplusplus
}
-#endif
+#endif
#endif /* !CPUDETECT_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h b/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h
index 39690de36..f12d85a69 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h
@@ -14,34 +14,34 @@
// BMP image uses BGR order, so select RGB order)
enum
{
- FF_CSP_NULL = 0,
-
- FF_CSP_420P = 1U << 0,
- FF_CSP_422P = 1U << 1,
- FF_CSP_444P = 1U << 2,
- FF_CSP_411P = 1U << 3,
- FF_CSP_410P = 1U << 4,
-
- FF_CSP_YUY2 = 1U << 5,
- FF_CSP_UYVY = 1U << 6,
- FF_CSP_YVYU = 1U << 7,
- FF_CSP_VYUY = 1U << 8,
-
- FF_CSP_ABGR = 1U << 9, // [a|b|g|r]
- FF_CSP_RGBA = 1U << 10, // [r|g|b|a]
- FF_CSP_BGR32 = 1U << 11,
- FF_CSP_BGR24 = 1U << 12,
- FF_CSP_BGR15 = 1U << 13,
- FF_CSP_BGR16 = 1U << 14,
- FF_CSP_RGB32 = 1U << 15,
- FF_CSP_RGB24 = 1U << 16,
- FF_CSP_RGB15 = 1U << 17,
- FF_CSP_RGB16 = 1U << 18,
-
- FF_CSP_PAL8 = 1U << 19,
- FF_CSP_CLJR = 1U << 20,
- FF_CSP_Y800 = 1U << 21,
- FF_CSP_NV12 = 1U << 22
+ FF_CSP_NULL = 0,
+
+ FF_CSP_420P =1U<< 0,
+ FF_CSP_422P =1U<< 1,
+ FF_CSP_444P =1U<< 2,
+ FF_CSP_411P =1U<< 3,
+ FF_CSP_410P =1U<< 4,
+
+ FF_CSP_YUY2 =1U<< 5,
+ FF_CSP_UYVY =1U<< 6,
+ FF_CSP_YVYU =1U<< 7,
+ FF_CSP_VYUY =1U<< 8,
+
+ FF_CSP_ABGR =1U<< 9, // [a|b|g|r]
+ FF_CSP_RGBA =1U<<10, // [r|g|b|a]
+ FF_CSP_BGR32 =1U<<11,
+ FF_CSP_BGR24 =1U<<12,
+ FF_CSP_BGR15 =1U<<13,
+ FF_CSP_BGR16 =1U<<14,
+ FF_CSP_RGB32 =1U<<15,
+ FF_CSP_RGB24 =1U<<16,
+ FF_CSP_RGB15 =1U<<17,
+ FF_CSP_RGB16 =1U<<18,
+
+ FF_CSP_PAL8 =1U<<19,
+ FF_CSP_CLJR =1U<<20,
+ FF_CSP_Y800 =1U<<21,
+ FF_CSP_NV12 =1U<<22
};
#define FF_CSPS_NUM 24
@@ -82,35 +82,22 @@ typedef ptrdiff_t stride_t;
static __inline int csp_xvid4_2ffdshow(int csp)
{
- switch(csp)
- {
- case XVID4_CSP_BGR :
- return FF_CSP_RGB24;
- case XVID4_CSP_YV12 :
- return FF_CSP_420P | FF_CSP_FLAGS_YUV_ADJ;
- case XVID4_CSP_YUY2 :
- return FF_CSP_YUY2;
- case XVID4_CSP_UYVY :
- return FF_CSP_UYVY;
- case XVID4_CSP_I420 :
- return FF_CSP_420P | FF_CSP_FLAGS_YUV_ADJ | FF_CSP_FLAGS_YUV_ORDER;
- case XVID4_CSP_RGB555:
- return FF_CSP_RGB15;
- case XVID4_CSP_RGB565:
- return FF_CSP_RGB16;
- case XVID4_CSP_PLANAR:
- return FF_CSP_420P;
- case XVID4_CSP_YVYU :
- return FF_CSP_YVYU;
- case XVID4_CSP_BGRA :
- return FF_CSP_RGB32;
- case XVID4_CSP_ABGR :
- return FF_CSP_ABGR;
- case XVID4_CSP_RGBA :
- return FF_CSP_RGBA;
- default :
- return FF_CSP_NULL;
- }
+ switch (csp)
+ {
+ case XVID4_CSP_BGR :return FF_CSP_RGB24;
+ case XVID4_CSP_YV12 :return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ;
+ case XVID4_CSP_YUY2 :return FF_CSP_YUY2;
+ case XVID4_CSP_UYVY :return FF_CSP_UYVY;
+ case XVID4_CSP_I420 :return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ|FF_CSP_FLAGS_YUV_ORDER;
+ case XVID4_CSP_RGB555:return FF_CSP_RGB15;
+ case XVID4_CSP_RGB565:return FF_CSP_RGB16;
+ case XVID4_CSP_PLANAR:return FF_CSP_420P;
+ case XVID4_CSP_YVYU :return FF_CSP_YVYU;
+ case XVID4_CSP_BGRA :return FF_CSP_RGB32;
+ case XVID4_CSP_ABGR :return FF_CSP_ABGR;
+ case XVID4_CSP_RGBA :return FF_CSP_RGBA;
+ default :return FF_CSP_NULL;
+ }
}
//================================= libavcodec ===================================
@@ -141,9 +128,8 @@ static __inline int csp_xvid4_2ffdshow(int csp)
* 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,
+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...
@@ -200,81 +186,48 @@ enum PixelFormat
static __inline int csp_lavc2ffdshow(enum PixelFormat pix_fmt)
{
- switch(pix_fmt)
- {
- case PIX_FMT_YUV420P :
- return FF_CSP_420P;
- case PIX_FMT_YUVJ420P:
- return FF_CSP_420P | FF_CSP_FLAGS_YUV_JPEG;
- case PIX_FMT_YUV422P :
- return FF_CSP_422P;
- case PIX_FMT_YUVJ422P:
- return FF_CSP_422P | FF_CSP_FLAGS_YUV_JPEG;
- case PIX_FMT_YUV444P :
- return FF_CSP_444P;
- case PIX_FMT_YUVJ444P:
- return FF_CSP_444P | FF_CSP_FLAGS_YUV_JPEG;
- case PIX_FMT_YUV411P :
- return FF_CSP_411P;
- case PIX_FMT_YUV410P :
- return FF_CSP_410P;
- case PIX_FMT_YUYV422 :
- return FF_CSP_YUY2;
- case PIX_FMT_UYVY422 :
- return FF_CSP_UYVY;
- case PIX_FMT_RGB24 :
- return FF_CSP_RGB24;
- case PIX_FMT_BGR24 :
- return FF_CSP_BGR24;
- case PIX_FMT_RGB32 :
- return FF_CSP_RGB32;
- case PIX_FMT_RGB555 :
- return FF_CSP_RGB15;
- case PIX_FMT_RGB565 :
- return FF_CSP_RGB16;
- case PIX_FMT_PAL8 :
- return FF_CSP_PAL8;
- case PIX_FMT_GRAY8 :
- return FF_CSP_Y800;
- default :
- return FF_CSP_NULL;
- }
+ switch (pix_fmt)
+ {
+ case PIX_FMT_YUV420P :return FF_CSP_420P;
+ case PIX_FMT_YUVJ420P:return FF_CSP_420P|FF_CSP_FLAGS_YUV_JPEG;
+ case PIX_FMT_YUV422P :return FF_CSP_422P;
+ case PIX_FMT_YUVJ422P:return FF_CSP_422P|FF_CSP_FLAGS_YUV_JPEG;
+ case PIX_FMT_YUV444P :return FF_CSP_444P;
+ case PIX_FMT_YUVJ444P:return FF_CSP_444P|FF_CSP_FLAGS_YUV_JPEG;
+ case PIX_FMT_YUV411P :return FF_CSP_411P;
+ case PIX_FMT_YUV410P :return FF_CSP_410P;
+ case PIX_FMT_YUYV422 :return FF_CSP_YUY2;
+ case PIX_FMT_UYVY422 :return FF_CSP_UYVY;
+ case PIX_FMT_RGB24 :return FF_CSP_RGB24;
+ case PIX_FMT_BGR24 :return FF_CSP_BGR24;
+ case PIX_FMT_RGB32 :return FF_CSP_RGB32;
+ case PIX_FMT_RGB555 :return FF_CSP_RGB15;
+ case PIX_FMT_RGB565 :return FF_CSP_RGB16;
+ case PIX_FMT_PAL8 :return FF_CSP_PAL8;
+ case PIX_FMT_GRAY8 :return FF_CSP_Y800;
+ default :return FF_CSP_NULL;
+ }
}
static __inline enum PixelFormat csp_ffdshow2lavc(int pix_fmt)
{
- switch(pix_fmt & FF_CSPS_MASK)
- {
- case FF_CSP_420P:
- return pix_fmt & FF_CSP_FLAGS_YUV_JPEG ? PIX_FMT_YUVJ420P : PIX_FMT_YUV420P;
- case FF_CSP_422P:
- return pix_fmt & FF_CSP_FLAGS_YUV_JPEG ? PIX_FMT_YUVJ422P : PIX_FMT_YUV422P;
- case FF_CSP_444P:
- return pix_fmt & FF_CSP_FLAGS_YUV_JPEG ? PIX_FMT_YUVJ444P : PIX_FMT_YUV444P;
- case FF_CSP_411P:
- return PIX_FMT_YUV411P;
- case FF_CSP_410P:
- return PIX_FMT_YUV410P;
- case FF_CSP_YUY2:
- return PIX_FMT_YUYV422;
- case FF_CSP_UYVY:
- return PIX_FMT_UYVY422;
- case FF_CSP_RGB24:
- return PIX_FMT_RGB24;
- case FF_CSP_BGR24:
- return PIX_FMT_BGR24;
- case FF_CSP_RGB32:
- return PIX_FMT_RGB32;
- case FF_CSP_RGB15:
- return PIX_FMT_RGB555;
- case FF_CSP_RGB16:
- return PIX_FMT_RGB565;
- case FF_CSP_PAL8:
- return PIX_FMT_PAL8;
- case FF_CSP_Y800:
- return PIX_FMT_GRAY8;
- default :
- return PIX_FMT_NB;
- }
+ switch (pix_fmt&FF_CSPS_MASK)
+ {
+ case FF_CSP_420P:return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ420P:PIX_FMT_YUV420P;
+ case FF_CSP_422P:return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ422P:PIX_FMT_YUV422P;
+ case FF_CSP_444P:return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ444P:PIX_FMT_YUV444P;
+ case FF_CSP_411P:return PIX_FMT_YUV411P;
+ case FF_CSP_410P:return PIX_FMT_YUV410P;
+ case FF_CSP_YUY2:return PIX_FMT_YUYV422;
+ case FF_CSP_UYVY:return PIX_FMT_UYVY422;
+ case FF_CSP_RGB24:return PIX_FMT_RGB24;
+ case FF_CSP_BGR24:return PIX_FMT_BGR24;
+ case FF_CSP_RGB32:return PIX_FMT_RGB32;
+ case FF_CSP_RGB15:return PIX_FMT_RGB555;
+ case FF_CSP_RGB16:return PIX_FMT_RGB565;
+ case FF_CSP_PAL8:return PIX_FMT_PAL8;
+ case FF_CSP_Y800:return PIX_FMT_GRAY8;
+ default :return PIX_FMT_NB;
+ }
}
//=================================== mplayer ===================================
@@ -353,121 +306,78 @@ static __inline enum PixelFormat csp_ffdshow2lavc(int pix_fmt)
static __inline int csp_mplayercsp2Bpp(int mplayercsp)
{
-// return byte per pixel for the first plane.
-// IMGFMT_NV21,IMGFMT_NV12 are troublesome, because bpp is different in first plane and second plane.
- switch(mplayercsp)
- {
- case IMGFMT_YV12 :
- return 1;
- case IMGFMT_422P :
- return 1;
- case IMGFMT_444P :
- return 1;
- case IMGFMT_411P :
- return 1;
- case IMGFMT_YVU9 :
- return 1;
-
- case IMGFMT_YUY2 :
- return 2;
- case IMGFMT_UYVY :
- return 2;
- case IMGFMT_YVYU :
- return 2;
- case IMGFMT_VYUY :
- return 2;
-
- case IMGFMT_RGB32 :
- return 4;
-
- case IMGFMT_BGR15:
- return 2;
- case IMGFMT_BGR16:
- return 2;
- case IMGFMT_BGR24:
- return 3;
- case IMGFMT_BGR32:
- return 4;
-
- case IMGFMT_RGB15:
- return 2;
- case IMGFMT_RGB16:
- return 2;
- case IMGFMT_RGB24:
- return 3;
-
- case IMGFMT_Y800 :
- return 1;
- case IMGFMT_NV12 :
- return 1;
- case IMGFMT_NV21 :
- return 1;
- default :
- return 1;
- }
+ // return byte per pixel for the first plane.
+ // IMGFMT_NV21,IMGFMT_NV12 are troublesome, because bpp is different in first plane and second plane.
+ switch (mplayercsp)
+ {
+ case IMGFMT_YV12 :return 1;
+ case IMGFMT_422P :return 1;
+ case IMGFMT_444P :return 1;
+ case IMGFMT_411P :return 1;
+ case IMGFMT_YVU9 :return 1;
+
+ case IMGFMT_YUY2 :return 2;
+ case IMGFMT_UYVY :return 2;
+ case IMGFMT_YVYU :return 2;
+ case IMGFMT_VYUY :return 2;
+
+ case IMGFMT_RGB32 :return 4;
+
+ case IMGFMT_BGR15:return 2;
+ case IMGFMT_BGR16:return 2;
+ case IMGFMT_BGR24:return 3;
+ case IMGFMT_BGR32:return 4;
+
+ case IMGFMT_RGB15:return 2;
+ case IMGFMT_RGB16:return 2;
+ case IMGFMT_RGB24:return 3;
+
+ case IMGFMT_Y800 :return 1;
+ case IMGFMT_NV12 :return 1;
+ case IMGFMT_NV21 :return 1;
+ default :return 1;
+ }
}
-// libmplayer refers to the write order, FF_CSP_ enum refers to the "memory byte order",
+// libmplayer refers to the write order, FF_CSP_ enum refers to the "memory byte order",
// which under x86 is reversed, see the comment above the FF_CSP_ enum definition.
static __inline int csp_ffdshow2mplayer(int csp)
{
- switch(csp & FF_CSPS_MASK)
- {
- case FF_CSP_420P :
- return IMGFMT_YV12;
- case FF_CSP_422P :
- return IMGFMT_422P;
- case FF_CSP_444P :
- return IMGFMT_444P;
- case FF_CSP_411P :
- return IMGFMT_411P;
- case FF_CSP_410P :
- return IMGFMT_YVU9;
- /*
- case FF_CSP_YUY2 :return IMGFMT_YVYU;
- case FF_CSP_UYVY :return IMGFMT_VYUY;
- case FF_CSP_YVYU :return IMGFMT_YUY2;
- case FF_CSP_VYUY :return IMGFMT_UYVY;
- */
- case FF_CSP_YUY2 :
- return IMGFMT_YUY2;
- case FF_CSP_UYVY :
- return IMGFMT_UYVY;
- case FF_CSP_YVYU :
- return IMGFMT_YVYU;
- case FF_CSP_VYUY :
- return IMGFMT_VYUY;
-
- case FF_CSP_ABGR :
- return IMGFMT_RGB32;
- case FF_CSP_RGBA :
- return IMGFMT_RGB32;
-
- case FF_CSP_RGB15:
- return IMGFMT_BGR15; // see the comment above
- case FF_CSP_RGB16:
- return IMGFMT_BGR16; // see the comment above
- case FF_CSP_RGB24:
- return IMGFMT_BGR24; // see the comment above
- case FF_CSP_RGB32:
- return IMGFMT_BGR32; // see the comment above
-
- case FF_CSP_BGR15:
- return IMGFMT_RGB15; // see the comment above
- case FF_CSP_BGR16:
- return IMGFMT_RGB16; // see the comment above
- case FF_CSP_BGR24:
- return IMGFMT_RGB24; // see the comment above
- case FF_CSP_BGR32:
- return IMGFMT_RGB32; // see the comment above
-
- case FF_CSP_Y800 :
- return IMGFMT_Y800;
- case FF_CSP_NV12 :
- return csp & FF_CSP_FLAGS_YUV_ORDER ? IMGFMT_NV12 : IMGFMT_NV21;
- default :
- return 0;
- }
+ switch (csp&FF_CSPS_MASK)
+ {
+ case FF_CSP_420P :return IMGFMT_YV12;
+ case FF_CSP_422P :return IMGFMT_422P;
+ case FF_CSP_444P :return IMGFMT_444P;
+ case FF_CSP_411P :return IMGFMT_411P;
+ case FF_CSP_410P :return IMGFMT_YVU9;
+/*
+ case FF_CSP_YUY2 :return IMGFMT_YVYU;
+ case FF_CSP_UYVY :return IMGFMT_VYUY;
+ case FF_CSP_YVYU :return IMGFMT_YUY2;
+ case FF_CSP_VYUY :return IMGFMT_UYVY;
+*/
+ case FF_CSP_YUY2 :return IMGFMT_YUY2;
+ case FF_CSP_UYVY :return IMGFMT_UYVY;
+ case FF_CSP_YVYU :return IMGFMT_YVYU;
+ case FF_CSP_VYUY :return IMGFMT_VYUY;
+
+ case FF_CSP_ABGR :return IMGFMT_RGB32;
+ case FF_CSP_RGBA :return IMGFMT_RGB32;
+
+ case FF_CSP_RGB15:return IMGFMT_BGR15; // see the comment above
+ case FF_CSP_RGB16:return IMGFMT_BGR16; // see the comment above
+ case FF_CSP_RGB24:return IMGFMT_BGR24; // see the comment above
+ case FF_CSP_RGB32:return IMGFMT_BGR32; // see the comment above
+
+ case FF_CSP_BGR15:return IMGFMT_RGB15; // see the comment above
+ case FF_CSP_BGR16:return IMGFMT_RGB16; // see the comment above
+ case FF_CSP_BGR24:return IMGFMT_RGB24; // see the comment above
+ case FF_CSP_BGR32:return IMGFMT_RGB32; // see the comment above
+
+ case FF_CSP_Y800 :return IMGFMT_Y800;
+ case FF_CSP_NV12 :return csp&FF_CSP_FLAGS_YUV_ORDER?IMGFMT_NV12:IMGFMT_NV21;
+ default :return 0;
+ }
}
#define SWS_IN_CSPS \
@@ -517,11 +427,11 @@ static __inline int csp_ffdshow2mplayer(int csp)
static __inline int csp_supSWSin(int x)
{
- return (x & FF_CSPS_MASK)&SWS_IN_CSPS;
+ return (x&FF_CSPS_MASK)&SWS_IN_CSPS;
}
static __inline int csp_supSWSout(int x)
{
- return (x & FF_CSPS_MASK)&SWS_OUT_CSPS;
+ return (x&FF_CSPS_MASK)&SWS_OUT_CSPS;
}
#endif
@@ -536,152 +446,144 @@ static __inline int csp_supSWSout(int x)
struct TcspInfo
{
- int id;
- const char_t *name;
- int Bpp, bpp;
- unsigned int numPlanes;
- unsigned int shiftX[4], shiftY[4];
- unsigned int black[4];
- FOURCC fcc, fcccsp;
- const GUID *subtype;
- int packedLumaOffset, packedChromaOffset;
+ int id;
+ const char_t *name;
+ int Bpp,bpp;
+ unsigned int numPlanes;
+ unsigned int shiftX[4],shiftY[4];
+ unsigned int black[4];
+ FOURCC fcc,fcccsp;const GUID *subtype;
+ int packedLumaOffset,packedChromaOffset;
};
extern const TcspInfo cspInfos[];
-struct TcspInfos : std::vector<const TcspInfo*, array_allocator<const TcspInfo*, FF_CSPS_NUM * 2> >
+struct TcspInfos :std::vector<const TcspInfo*,array_allocator<const TcspInfo*,FF_CSPS_NUM*2> >
{
private:
- struct TsortFc
- {
- private:
- int csp;
- public:
- TsortFc(int Icsp): csp(Icsp) {}
- bool operator()(const TcspInfo* &csp1, const TcspInfo* &csp2);
- };
+ struct TsortFc
+ {
+ private:
+ int csp;
+ public:
+ TsortFc(int Icsp):csp(Icsp) {}
+ bool operator ()(const TcspInfo* &csp1,const TcspInfo* &csp2);
+ };
public:
- void sort(int csp);
+ void sort(int csp);
};
static __inline const TcspInfo* csp_getInfo(int csp)
{
- switch(csp&(FF_CSPS_MASK | FF_CSP_FLAGS_YUV_ORDER))
- {
- case FF_CSP_420P|FF_CSP_FLAGS_YUV_ORDER:
+ switch (csp&(FF_CSPS_MASK|FF_CSP_FLAGS_YUV_ORDER))
+ {
+ case FF_CSP_420P|FF_CSP_FLAGS_YUV_ORDER:
{
- extern TcspInfo cspInfoIYUV;
- return &cspInfoIYUV;
+ extern TcspInfo cspInfoIYUV;
+ return &cspInfoIYUV;
}
- case FF_CSP_NV12|FF_CSP_FLAGS_YUV_ORDER:
+ case FF_CSP_NV12|FF_CSP_FLAGS_YUV_ORDER:
{
- extern TcspInfo cspInfoNV21;
- return &cspInfoNV21;
- }
- default:
- csp &= FF_CSPS_MASK;
- if(csp == 0) return NULL;
- int i = 0;
- while(csp >>= 1)
- i++;
- if(i <= FF_CSPS_NUM)
- return &cspInfos[i];
- else
- return NULL;
+ extern TcspInfo cspInfoNV21;
+ return &cspInfoNV21;
}
+ default:
+ csp&=FF_CSPS_MASK;
+ if (csp==0) return NULL;
+ int i=0;
+ while (csp>>=1)
+ i++;
+ if (i<=FF_CSPS_NUM)
+ return &cspInfos[i];
+ else
+ return NULL;
+ }
}
const TcspInfo* csp_getInfoFcc(FOURCC fcc);
static __inline int csp_isYUVplanar(int x)
{
- return x & FF_CSPS_MASK & FF_CSPS_MASK_YUV_PLANAR;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_YUV_PLANAR;
}
static __inline int csp_isYUVpacked(int x)
{
- return x & FF_CSPS_MASK & FF_CSPS_MASK_YUV_PACKED;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_YUV_PACKED;
}
static __inline int csp_isYUV(int x)
{
- return csp_isYUVpacked(x) | csp_isYUVplanar(x);
+ return csp_isYUVpacked(x)|csp_isYUVplanar(x);
}
static __inline int csp_isYUV_NV(int x)
{
- return csp_isYUVpacked(x) | csp_isYUVplanar(x) | (x & FF_CSP_NV12);
+ return csp_isYUVpacked(x)|csp_isYUVplanar(x)|(x & FF_CSP_NV12);
}
static __inline int csp_isRGB_RGB(int x)
{
- return x & FF_CSPS_MASK & FF_CSPS_MASK_RGB;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_RGB;
}
static __inline int csp_isRGB_BGR(int x)
{
- return x & FF_CSPS_MASK & FF_CSPS_MASK_BGR;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_BGR;
}
static __inline int csp_isRGB(int x)
{
- return csp_isRGB_RGB(x) | csp_isRGB_BGR(x);
+ return csp_isRGB_RGB(x)|csp_isRGB_BGR(x);
}
static __inline int csp_isPAL(int x)
{
- return x & FF_CSPS_MASK & FF_CSP_PAL8;
+ return x&FF_CSPS_MASK&FF_CSP_PAL8;
}
static __inline int csp_supXvid(int x)
{
- return (x & FF_CSPS_MASK) & (FF_CSP_RGB24 | FF_CSP_420P | FF_CSP_YUY2 | FF_CSP_UYVY | FF_CSP_YVYU | FF_CSP_VYUY | FF_CSP_RGB15 | FF_CSP_RGB16 | FF_CSP_RGB32 | FF_CSP_ABGR | FF_CSP_RGBA | FF_CSP_BGR24);
+ return (x&FF_CSPS_MASK)&(FF_CSP_RGB24|FF_CSP_420P|FF_CSP_YUY2|FF_CSP_UYVY|FF_CSP_YVYU|FF_CSP_VYUY|FF_CSP_RGB15|FF_CSP_RGB16|FF_CSP_RGB32|FF_CSP_ABGR|FF_CSP_RGBA|FF_CSP_BGR24);
}
-bool csp_inFOURCCmask(int x, FOURCC fcc);
+bool csp_inFOURCCmask(int x,FOURCC fcc);
-extern char_t* csp_getName(const TcspInfo *cspInfo, int csp, char_t *buf, size_t len);
-extern char_t* csp_getName(int csp, char_t *buf, size_t len);
-extern int csp_bestMatch(int inCSP, int wantedCSPS, int *rank = NULL);
+extern char_t* csp_getName(const TcspInfo *cspInfo,int csp,char_t *buf,size_t len);
+extern char_t* csp_getName(int csp,char_t *buf,size_t len);
+extern int csp_bestMatch(int inCSP,int wantedCSPS,int *rank=NULL);
-static __inline void csp_yuv_adj_to_plane(int &csp, const TcspInfo *cspInfo, unsigned int dy, unsigned char *data[4], stride_t stride[4])
+static __inline void csp_yuv_adj_to_plane(int &csp,const TcspInfo *cspInfo,unsigned int dy,unsigned char *data[4],stride_t stride[4])
{
- if(csp_isYUVplanar(csp) && (csp & FF_CSP_FLAGS_YUV_ADJ))
- {
- csp &= ~FF_CSP_FLAGS_YUV_ADJ;
- data[2] = data[0] + stride[0] * (dy >> cspInfo->shiftY[0]);
- stride[1] = stride[0] >> cspInfo->shiftX[1];
- data[1] = data[2] + stride[1] * (dy >> cspInfo->shiftY[1]);
- stride[2] = stride[0] >> cspInfo->shiftX[2];
- }
- else if((csp & FF_CSP_NV12) && (csp & FF_CSP_FLAGS_YUV_ADJ))
- {
- csp &= ~FF_CSP_FLAGS_YUV_ADJ;
- data[1] = data[0] + stride[0] * dy;
+ if (csp_isYUVplanar(csp) && (csp & FF_CSP_FLAGS_YUV_ADJ)) {
+ csp&=~FF_CSP_FLAGS_YUV_ADJ;
+ data[2]=data[0]+stride[0]*(dy>>cspInfo->shiftY[0]);stride[1]=stride[0]>>cspInfo->shiftX[1];
+ data[1]=data[2]+stride[1]*(dy>>cspInfo->shiftY[1]);stride[2]=stride[0]>>cspInfo->shiftX[2];
+ } else if ((csp & FF_CSP_NV12) && (csp & FF_CSP_FLAGS_YUV_ADJ)) {
+ csp&=~FF_CSP_FLAGS_YUV_ADJ;
+ data[1] = data[0] + stride[0] *dy;
stride[1] = stride[0];
}
-
+
}
-static __inline void csp_yuv_order(int &csp, unsigned char *data[4], stride_t stride[4])
+static __inline void csp_yuv_order(int &csp,unsigned char *data[4],stride_t stride[4])
{
- if(csp_isYUVplanar(csp) && (csp & FF_CSP_FLAGS_YUV_ORDER))
- {
- csp &= ~FF_CSP_FLAGS_YUV_ORDER;
- std::swap(data[1], data[2]);
- std::swap(stride[1], stride[2]);
- }
+ if (csp_isYUVplanar(csp) && (csp&FF_CSP_FLAGS_YUV_ORDER))
+ {
+ csp&=~FF_CSP_FLAGS_YUV_ORDER;
+ std::swap(data[1],data[2]);
+ std::swap(stride[1],stride[2]);
+ }
}
-static __inline void csp_vflip(int &csp, const TcspInfo *cspInfo, unsigned char *data[], stride_t stride[], unsigned int dy)
+static __inline void csp_vflip(int &csp,const TcspInfo *cspInfo,unsigned char *data[],stride_t stride[],unsigned int dy)
{
- if(csp & FF_CSP_FLAGS_VFLIP)
+ if (csp&FF_CSP_FLAGS_VFLIP)
+ {
+ csp&=~FF_CSP_FLAGS_VFLIP;
+ for (unsigned int i=0;i<cspInfo->numPlanes;i++)
{
- csp &= ~FF_CSP_FLAGS_VFLIP;
- for(unsigned int i = 0; i < cspInfo->numPlanes; i++)
- {
- data[i] += stride[i] * ((dy >> cspInfo->shiftY[i]) - 1);
- stride[i] *= -1;
- }
+ data[i]+=stride[i]*((dy>>cspInfo->shiftY[i])-1);
+ stride[i]*=-1;
}
+ }
}
-int getBMPcolorspace(const BITMAPINFOHEADER *hdr, const TcspInfos &forcedCsps);
+int getBMPcolorspace(const BITMAPINFOHEADER *hdr,const TcspInfos &forcedCsps);
struct TcspFcc
{
- const char_t *name;
- FOURCC fcc;
- int csp;
- bool flip;
- bool supEnc;
+ const char_t *name;
+ FOURCC fcc;int csp;bool flip;
+ bool supEnc;
};
extern const TcspFcc cspFccs[];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h b/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h
index d70d1e752..94d4490c1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h
@@ -228,224 +228,71 @@
CODEC_OP(CODEC_ID_TTF ,2104,"TTF")
enum CodecID
{
-#define CODEC_OP(codecEnum,codecId,codecName) codecEnum=codecId,
- FFDSHOW_CODECS
-#undef CODEC_OP
+ #define CODEC_OP(codecEnum,codecId,codecName) codecEnum=codecId,
+ FFDSHOW_CODECS
+ #undef CODEC_OP
};
#ifdef __cplusplus
-template<> struct isPOD<CodecID>
-{
- enum {is = true};
-};
+template<> struct isPOD<CodecID> {enum {is=true};};
const FOURCC* getCodecFOURCCs(CodecID codecId);
//const char_t* getCodecName(CodecID codecId);
-static __inline bool lavc_codec(int x)
-{
- return x > 0 && x < 200;
-}
-static __inline bool raw_codec(int x)
-{
- return x >= 300 && x < 400;
-}
-static __inline bool xvid_codec(int x)
-{
- return x == CODEC_ID_XVID4;
-}
-static __inline bool theora_codec(int x)
-{
- return x == CODEC_ID_THEORA_LIB;
-}
-static __inline bool mplayer_codec(int x)
-{
- return x == CODEC_ID_MP3LIB;
-}
-static __inline bool wmv9_codec(int x)
-{
- return x >= 1000 && x < 1100;
-}
-static __inline bool mpeg12_codec(int x)
-{
- return x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_LIBMPEG2;
-}
-static __inline bool mpeg1_codec(int x)
-{
- return x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_LIBMPEG2;
-}
-static __inline bool mpeg2_codec(int x)
-{
- return x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_LIBMPEG2;
-}
-static __inline bool mpeg4_codec(int x)
-{
- return x == CODEC_ID_MPEG4 || xvid_codec(x) || x == CODEC_ID_SKAL;
-}
-static __inline bool spdif_codec(int x)
-{
- return x == CODEC_ID_SPDIF_AC3 || x == CODEC_ID_SPDIF_DTS;
-}
-static __inline bool huffyuv_codec(int x)
-{
- return x == CODEC_ID_HUFFYUV || x == CODEC_ID_FFVHUFF;
-}
-static __inline bool x264_codec(int x)
-{
- return x == CODEC_ID_X264 || x == CODEC_ID_X264_LOSSLESS;
-}
-static __inline bool lossless_codec(int x)
-{
- return huffyuv_codec(x) || x == CODEC_ID_LJPEG || x == CODEC_ID_FFV1 || x == CODEC_ID_DVVIDEO || x == CODEC_ID_X264_LOSSLESS;
-}
+static __inline bool lavc_codec(int x) {return x>0 && x<200;}
+static __inline bool raw_codec(int x) {return x>=300 && x<400;}
+static __inline bool xvid_codec(int x) {return x==CODEC_ID_XVID4;}
+static __inline bool theora_codec(int x) {return x==CODEC_ID_THEORA_LIB;}
+static __inline bool mplayer_codec(int x) {return x==CODEC_ID_MP3LIB;}
+static __inline bool wmv9_codec(int x) {return x>=1000 && x<1100;}
+static __inline bool mpeg12_codec(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_LIBMPEG2;}
+static __inline bool mpeg1_codec(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_LIBMPEG2;}
+static __inline bool mpeg2_codec(int x) {return x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_LIBMPEG2;}
+static __inline bool mpeg4_codec(int x) {return x==CODEC_ID_MPEG4 || xvid_codec(x) || x==CODEC_ID_SKAL;}
+static __inline bool spdif_codec(int x) {return x==CODEC_ID_SPDIF_AC3 || x==CODEC_ID_SPDIF_DTS;}
+static __inline bool huffyuv_codec(int x) {return x==CODEC_ID_HUFFYUV || x==CODEC_ID_FFVHUFF;}
+static __inline bool x264_codec(int x) {return x==CODEC_ID_X264 || x==CODEC_ID_X264_LOSSLESS;}
+static __inline bool lossless_codec(int x) {return huffyuv_codec(x) || x==CODEC_ID_LJPEG || x==CODEC_ID_FFV1 || x==CODEC_ID_DVVIDEO || x==CODEC_ID_X264_LOSSLESS;}
//I'm not sure of all these
-static __inline bool sup_CBR(int x)
-{
- return !lossless_codec(x) && !raw_codec(x);
-}
-static __inline bool sup_VBR_QUAL(int x)
-{
- return !lossless_codec(x) && !raw_codec(x) && x != CODEC_ID_SKAL;
-}
-static __inline bool sup_VBR_QUANT(int x)
-{
- return (lavc_codec(x) || xvid_codec(x) || theora_codec(x) || x == CODEC_ID_SKAL || x == CODEC_ID_X264) && !lossless_codec(x) && x != CODEC_ID_SNOW;
-}
-static __inline bool sup_XVID2PASS(int x)
-{
- return sup_VBR_QUANT(x) && x != CODEC_ID_X264 && x != CODEC_ID_SNOW;
-}
-static __inline bool sup_LAVC2PASS(int x)
-{
- return (lavc_codec(x) && !lossless_codec(x) && x != CODEC_ID_MJPEG && !raw_codec(x)) || x == CODEC_ID_X264;
-}
+static __inline bool sup_CBR(int x) {return !lossless_codec(x) && !raw_codec(x);}
+static __inline bool sup_VBR_QUAL(int x) {return !lossless_codec(x) && !raw_codec(x) && x!=CODEC_ID_SKAL;}
+static __inline bool sup_VBR_QUANT(int x) {return (lavc_codec(x) || xvid_codec(x) || theora_codec(x) || x==CODEC_ID_SKAL || x==CODEC_ID_X264) && !lossless_codec(x) && x!=CODEC_ID_SNOW;}
+static __inline bool sup_XVID2PASS(int x) {return sup_VBR_QUANT(x) && x!=CODEC_ID_X264 && x!=CODEC_ID_SNOW;}
+static __inline bool sup_LAVC2PASS(int x) {return (lavc_codec(x) && !lossless_codec(x) && x!=CODEC_ID_MJPEG && !raw_codec(x)) || x==CODEC_ID_X264;}
-static __inline bool sup_interlace(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x == CODEC_ID_SKAL;
-}
-static __inline bool sup_gray(int x)
-{
- return x != CODEC_ID_LJPEG && x != CODEC_ID_FFV1 && x != CODEC_ID_SNOW && !theora_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x != CODEC_ID_SKAL && x != CODEC_ID_DVVIDEO && !x264_codec(x);
-}
-static __inline bool sup_globalheader(int x)
-{
- return x == CODEC_ID_MPEG4;
-}
-static __inline bool sup_part(int x)
-{
- return x == CODEC_ID_MPEG4;
-}
-static __inline bool sup_packedBitstream(int x)
-{
- return xvid_codec(x);
-}
-static __inline bool sup_minKeySet(int x)
-{
- return x != CODEC_ID_MJPEG && x != CODEC_ID_SNOW && (!lossless_codec(x) || x == CODEC_ID_X264_LOSSLESS) && !wmv9_codec(x) && !raw_codec(x);
-}
-static __inline bool sup_maxKeySet(int x)
-{
- return x != CODEC_ID_MJPEG && (!lossless_codec(x) || x == CODEC_ID_X264_LOSSLESS) && !raw_codec(x);
-}
-static __inline bool sup_bframes(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x264_codec(x);
-}
-static __inline bool sup_adaptiveBframes(int x)
-{
- return lavc_codec(x) || x == CODEC_ID_X264;
-}
-static __inline bool sup_closedGop(int x)
-{
- return sup_bframes(x) && !x264_codec(x);
-}
-static __inline bool sup_lavcme(int x)
-{
- return lavc_codec(x) && x != CODEC_ID_MJPEG && !lossless_codec(x);
-}
-static __inline bool sup_quantProps(int x)
-{
- return !lossless_codec(x) && !theora_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x != CODEC_ID_SNOW;
-}
-static __inline bool sup_trellisQuant(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_XVID4 || x == CODEC_ID_H263 || x == CODEC_ID_H263P || x == CODEC_ID_SKAL || x == CODEC_ID_X264;
-}
-static __inline bool sup_masking(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_H263 || x == CODEC_ID_H263P || x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x == CODEC_ID_SKAL || x == CODEC_ID_X264;
-}
-static __inline bool sup_lavcOnePass(int x)
-{
- return (lavc_codec(x) && !lossless_codec(x)) || x == CODEC_ID_X264;
-}
-static __inline bool sup_perFrameQuant(int x)
-{
- return !lossless_codec(x) && !wmv9_codec(x) && !raw_codec(x) && !x264_codec(x) && x != CODEC_ID_SNOW;
-}
-static __inline bool sup_4mv(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_H263 || x == CODEC_ID_H263P || x == CODEC_ID_SNOW || x == CODEC_ID_SKAL;
-}
-static __inline bool sup_aspect(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_XVID4 || x == CODEC_ID_THEORA_LIB || x264_codec(x);
-}
-static __inline bool sup_PSNR(int x)
-{
- return (lavc_codec(x) && !lossless_codec(x)) || xvid_codec(x) || x == CODEC_ID_SKAL || x264_codec(x);
-}
-static __inline bool sup_quantBias(int x)
-{
- return lavc_codec(x) && !lossless_codec(x);
-}
-static __inline bool sup_MPEGquant(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_MSMPEG4V3 || x == CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x == CODEC_ID_SKAL;
-}
-static __inline bool sup_lavcQuant(int x)
-{
- return lavc_codec(x) && sup_quantProps(x);
-}
-static __inline bool sup_customQuantTables(int x)
-{
- return x == CODEC_ID_MPEG4 || xvid_codec(x) || x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_SKAL || x == CODEC_ID_X264;
-}
-static __inline bool sup_qpel(int x)
-{
- return x == CODEC_ID_MPEG4 || x == CODEC_ID_SNOW || xvid_codec(x) || x == CODEC_ID_SKAL;
-}
-static __inline bool sup_gmc(int x)
-{
- return xvid_codec(x) || x == CODEC_ID_SKAL;
-}
-static __inline bool sup_me_mv0(int x)
-{
- return sup_lavcme(x) && x != CODEC_ID_SNOW;
-}
-static __inline bool sup_cbp_rd(int x)
-{
- return x == CODEC_ID_MPEG4;
-}
-static __inline bool sup_qns(int x)
-{
- return lavc_codec(x) && sup_quantProps(x) && x != CODEC_ID_MSMPEG4V3 && x != CODEC_ID_MSMPEG4V2 && x != CODEC_ID_MSMPEG4V1 && x != CODEC_ID_WMV1 && x != CODEC_ID_WMV2 && x != CODEC_ID_MJPEG && x != CODEC_ID_SNOW;
-}
-static __inline bool sup_threads(int x)
-{
- return x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_MPEG4 || x == CODEC_ID_XVID4 || x264_codec(x);
-}
-static __inline bool sup_threads_dec(int x)
-{
- return x == CODEC_ID_MPEG1VIDEO || x == CODEC_ID_MPEG2VIDEO || x == CODEC_ID_H264;
-}
-static __inline bool sup_palette(int x)
-{
- return x == CODEC_ID_MSVIDEO1 || x == CODEC_ID_8BPS || x == CODEC_ID_QTRLE || x == CODEC_ID_TSCC || x == CODEC_ID_QPEG || x == CODEC_ID_PNG;
-}
+static __inline bool sup_interlace(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x==CODEC_ID_SKAL;}
+static __inline bool sup_gray(int x) {return x!=CODEC_ID_LJPEG && x!=CODEC_ID_FFV1 && x!=CODEC_ID_SNOW && !theora_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_SKAL && x!=CODEC_ID_DVVIDEO && !x264_codec(x);}
+static __inline bool sup_globalheader(int x) {return x==CODEC_ID_MPEG4;}
+static __inline bool sup_part(int x) {return x==CODEC_ID_MPEG4;}
+static __inline bool sup_packedBitstream(int x) {return xvid_codec(x);}
+static __inline bool sup_minKeySet(int x) {return x!=CODEC_ID_MJPEG && x!=CODEC_ID_SNOW && (!lossless_codec(x) || x==CODEC_ID_X264_LOSSLESS) && !wmv9_codec(x) && !raw_codec(x);}
+static __inline bool sup_maxKeySet(int x) {return x!=CODEC_ID_MJPEG && (!lossless_codec(x) || x==CODEC_ID_X264_LOSSLESS) && !raw_codec(x);}
+static __inline bool sup_bframes(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x264_codec(x);}
+static __inline bool sup_adaptiveBframes(int x) {return lavc_codec(x) || x==CODEC_ID_X264;}
+static __inline bool sup_closedGop(int x) {return sup_bframes(x) && !x264_codec(x);}
+static __inline bool sup_lavcme(int x) {return lavc_codec(x) && x!=CODEC_ID_MJPEG && !lossless_codec(x);}
+static __inline bool sup_quantProps(int x) {return !lossless_codec(x) && !theora_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_SNOW;}
+static __inline bool sup_trellisQuant(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_SKAL || x==CODEC_ID_X264;}
+static __inline bool sup_masking(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x==CODEC_ID_SKAL || x==CODEC_ID_X264;}
+static __inline bool sup_lavcOnePass(int x) {return (lavc_codec(x) && !lossless_codec(x)) || x==CODEC_ID_X264;}
+static __inline bool sup_perFrameQuant(int x) {return !lossless_codec(x) && !wmv9_codec(x) && !raw_codec(x) && !x264_codec(x) && x!=CODEC_ID_SNOW;}
+static __inline bool sup_4mv(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_SNOW || x==CODEC_ID_SKAL;}
+static __inline bool sup_aspect(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4 || x==CODEC_ID_THEORA_LIB || x264_codec(x);}
+static __inline bool sup_PSNR(int x) {return (lavc_codec(x) && !lossless_codec(x)) || xvid_codec(x) || x==CODEC_ID_SKAL || x264_codec(x);}
+static __inline bool sup_quantBias(int x) {return lavc_codec(x) && !lossless_codec(x);}
+static __inline bool sup_MPEGquant(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MSMPEG4V3 || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x==CODEC_ID_SKAL;}
+static __inline bool sup_lavcQuant(int x) {return lavc_codec(x) && sup_quantProps(x);}
+static __inline bool sup_customQuantTables(int x) {return x==CODEC_ID_MPEG4 || xvid_codec(x) || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_SKAL || x==CODEC_ID_X264;}
+static __inline bool sup_qpel(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_SNOW || xvid_codec(x) || x==CODEC_ID_SKAL;}
+static __inline bool sup_gmc(int x) {return xvid_codec(x) || x==CODEC_ID_SKAL;}
+static __inline bool sup_me_mv0(int x) {return sup_lavcme(x) && x!=CODEC_ID_SNOW;}
+static __inline bool sup_cbp_rd(int x) {return x==CODEC_ID_MPEG4;}
+static __inline bool sup_qns(int x) {return lavc_codec(x) && sup_quantProps(x) && x!=CODEC_ID_MSMPEG4V3 && x!=CODEC_ID_MSMPEG4V2 && x!=CODEC_ID_MSMPEG4V1 && x!=CODEC_ID_WMV1 && x!=CODEC_ID_WMV2 && x!=CODEC_ID_MJPEG && x!=CODEC_ID_SNOW;}
+static __inline bool sup_threads(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_MPEG4 || x==CODEC_ID_XVID4 || x264_codec(x);}
+static __inline bool sup_threads_dec(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_H264;}
+static __inline bool sup_palette(int x) {return x==CODEC_ID_MSVIDEO1 || x==CODEC_ID_8BPS || x==CODEC_ID_QTRLE || x==CODEC_ID_TSCC || x==CODEC_ID_QPEG || x==CODEC_ID_PNG;}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/CompilatorVersion.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/CompilatorVersion.c
index a6a68e9d7..cbf3c9c3f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/CompilatorVersion.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/CompilatorVersion.c
@@ -17,26 +17,26 @@
*/
#ifdef _MSC_VER
-#if (_MSC_VER == 1500)
-#if (_MSC_FULL_VER >= 150030729)
-char FfmpegCompiler[] = "MSVC 2008 SP1";
-#else
-char FfmpegCompiler[] = "MSVC 2008";
-#endif
-#elif (_MSC_VER < 1500)
-#error Compiler is not supported!
-#endif
+ #if (_MSC_VER == 1500)
+ #if (_MSC_FULL_VER >= 150030729)
+ char FfmpegCompiler[] = "MSVC 2008 SP1";
+ #else
+ char FfmpegCompiler[] = "MSVC 2008";
+ #endif
+ #elif (_MSC_VER < 1500)
+ #error Compiler is not supported!
+ #endif
-char* GetFfmpegCompiler()
-{
- return FfmpegCompiler;
-}
+ char* GetFfmpegCompiler()
+ {
+ return FfmpegCompiler;
+ }
#else // _MSC_VER
-#include <stdio.h>
-static char g_Gcc_Compiler[20];
-char* GetFfmpegCompiler()
-{
- sprintf(g_Gcc_Compiler, "GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
- return g_Gcc_Compiler;
-}
+ #include <stdio.h>
+ static char g_Gcc_Compiler[20];
+ char* GetFfmpegCompiler()
+ {
+ sprintf (g_Gcc_Compiler, "GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+ return g_Gcc_Compiler;
+ }
#endif //_MSC_VER
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.c
index 3257ae17c..839608875 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.c
@@ -34,34 +34,25 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
int new_frame_start;
get_next:
- i = END_NOT_FOUND;
- if(s->remaining_size <= buf_size)
- {
- if(s->remaining_size && !s->need_next_header)
- {
- i = s->remaining_size;
+ i=END_NOT_FOUND;
+ if(s->remaining_size <= buf_size){
+ if(s->remaining_size && !s->need_next_header){
+ i= s->remaining_size;
s->remaining_size = 0;
- }
- else //we need a header first
- {
- len = 0;
- for(i = s->remaining_size; i < buf_size; i++)
- {
- s->state = (s->state << 8) + buf[i];
- if((len = s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
+ }else{ //we need a header first
+ len=0;
+ for(i=s->remaining_size; i<buf_size; i++){
+ s->state = (s->state<<8) + buf[i];
+ if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
break;
}
- if(len <= 0)
- {
- i = END_NOT_FOUND;
- }
- else
- {
- s->state = 0;
- i -= s->header_size - 1;
+ if(len<=0){
+ i=END_NOT_FOUND;
+ }else{
+ s->state=0;
+ i-= s->header_size -1;
s->remaining_size = len;
- if(!new_frame_start || pc->index + i <= 0)
- {
+ if(!new_frame_start || pc->index+i<=0){
s->remaining_size += i;
goto get_next;
}
@@ -69,8 +60,7 @@ get_next:
}
}
- if(ff_combine_frame(pc, i, &buf, &buf_size) < 0)
- {
+ if(ff_combine_frame(pc, i, &buf, &buf_size)<0){
s->remaining_size -= FFMIN(s->remaining_size, buf_size);
*poutbuf = NULL;
*poutbuf_size = 0;
@@ -87,16 +77,13 @@ get_next:
/* allow downmixing to stereo (or mono for AC-3) */
if(avctx->request_channels > 0 &&
- 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->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->channels = avctx->request_channels;
- }
- else if(avctx->codec_id != CODEC_ID_AAC || s->channels)
- {
+ } else if (avctx->codec_id != CODEC_ID_AAC || s->channels) {
avctx->channels = s->channels;
avctx->channel_layout = s->channel_layout;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.h
index b67167c88..b19d3d222 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/aac_ac3_parser.h
@@ -27,8 +27,7 @@
#include "avcodec.h"
#include "parser.h"
-typedef enum
-{
+typedef enum {
AAC_AC3_PARSE_ERROR_SYNC = -1,
AAC_AC3_PARSE_ERROR_BSID = -2,
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3,
@@ -38,13 +37,12 @@ typedef enum
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7,
} AACAC3ParseError;
-typedef struct AACAC3ParseContext
-{
+typedef struct AACAC3ParseContext {
ParseContext pc;
int frame_size;
int header_size;
int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info,
- int *need_next_header, int *new_frame_start);
+ int *need_next_header, int *new_frame_start);
int channels;
int sample_rate;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.c
index c349ac890..255ec9081 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.c
@@ -33,22 +33,20 @@
/**
* Starting frequency coefficient bin for each critical band.
*/
-static const uint8_t band_start_tab[51] =
-{
- 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, 31,
- 34, 37, 40, 43, 46, 49, 55, 61, 67, 73,
- 79, 85, 97, 109, 121, 133, 157, 181, 205, 229, 253
+static const uint8_t band_start_tab[51] = {
+ 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, 31,
+ 34, 37, 40, 43, 46, 49, 55, 61, 67, 73,
+ 79, 85, 97, 109, 121, 133, 157, 181, 205, 229, 253
};
/**
* Maps each frequency coefficient bin to the critical band that contains it.
*/
-static const uint8_t bin_to_band_tab[253] =
-{
- 0,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+static const uint8_t bin_to_band_tab[253] = {
+ 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, 28, 28, 29, 29, 29, 30, 30, 30,
31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34,
@@ -78,12 +76,9 @@ static uint8_t bin_to_band_tab[253];
static inline int calc_lowcomp1(int a, int b0, int b1, int c)
{
- if((b0 + 256) == b1)
- {
+ if ((b0 + 256) == b1) {
a = c;
- }
- else if(b0 > b1)
- {
+ } else if (b0 > b1) {
a = FFMAX(a - 64, 0);
}
return a;
@@ -91,16 +86,11 @@ static inline int calc_lowcomp1(int a, int b0, int b1, int c)
static inline int calc_lowcomp(int a, int b0, int b1, int bin)
{
- if(bin < 7)
- {
+ if (bin < 7) {
return calc_lowcomp1(a, b0, b1, 384);
- }
- else if(bin < 20)
- {
+ } else if (bin < 20) {
return calc_lowcomp1(a, b0, b1, 320);
- }
- else
- {
+ } else {
return FFMAX(a - 128, 0);
}
}
@@ -111,28 +101,24 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
int bin, band;
/* exponent mapping to PSD */
- for(bin = start; bin < end; bin++)
- {
- psd[bin] = (3072 - (exp[bin] << 7));
+ for (bin = start; bin < end; bin++) {
+ psd[bin]=(3072 - (exp[bin] << 7));
}
/* PSD integration */
bin = start;
band = bin_to_band_tab[start];
- do
- {
+ do {
int v = psd[bin++];
int band_end = FFMIN(band_start_tab[band+1], end);
- for(; bin < band_end; bin++)
- {
+ for (; bin < band_end; bin++) {
int max = FFMAX(v, psd[bin]);
/* logadd */
int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255);
v = max + ff_ac3_log_add_tab[adr];
}
band_psd[band++] = v;
- }
- while(end > band_start_tab[band]);
+ } while (end > band_start_tab[band]);
}
int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
@@ -150,25 +136,21 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
band_start = bin_to_band_tab[start];
band_end = bin_to_band_tab[end-1] + 1;
- if(band_start == 0)
- {
+ if (band_start == 0) {
lowcomp = 0;
lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384);
excite[0] = band_psd[0] - fast_gain - lowcomp;
lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384);
excite[1] = band_psd[1] - fast_gain - lowcomp;
begin = 7;
- for(band = 2; band < 7; band++)
- {
- if(!(is_lfe && band == 6))
+ for (band = 2; band < 7; band++) {
+ if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384);
fastleak = band_psd[band] - fast_gain;
slowleak = band_psd[band] - s->slow_gain;
excite[band] = fastleak - lowcomp;
- if(!(is_lfe && band == 6))
- {
- if(band_psd[band] <= band_psd[band+1])
- {
+ if (!(is_lfe && band == 6)) {
+ if (band_psd[band] <= band_psd[band+1]) {
begin = band + 1;
break;
}
@@ -176,26 +158,22 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
}
end1 = FFMIN(band_end, 22);
- for(band = begin; band < end1; band++)
- {
- if(!(is_lfe && band == 6))
+ for (band = begin; band < end1; band++) {
+ if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band);
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[band] = FFMAX(fastleak - lowcomp, slowleak);
}
begin = 22;
- }
- else
- {
+ } else {
/* coupling channel */
begin = band_start;
fastleak = (s->cpl_fast_leak << 8) + 768;
slowleak = (s->cpl_slow_leak << 8) + 768;
}
- for(band = begin; band < band_end; band++)
- {
+ for (band = begin; band < band_end; band++) {
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[band] = FFMAX(fastleak, slowleak);
@@ -203,11 +181,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
/* compute masking curve */
- for(band = band_start; band < band_end; band++)
- {
+ for (band = band_start; band < band_end; band++) {
int tmp = s->db_per_bit - band_psd[band];
- if(tmp > 0)
- {
+ if (tmp > 0) {
excite[band] += tmp >> 2;
}
mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
@@ -215,27 +191,21 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
/* delta bit allocation */
- if(dba_mode == DBA_REUSE || dba_mode == DBA_NEW)
- {
+ if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
int i, seg, delta;
- if(dba_nsegs >= 8)
+ if (dba_nsegs >= 8)
return -1;
band = 0;
- for(seg = 0; seg < dba_nsegs; seg++)
- {
+ for (seg = 0; seg < dba_nsegs; seg++) {
band += dba_offsets[seg];
- if(band >= 50 || dba_lengths[seg] > 50 - band)
+ if (band >= 50 || dba_lengths[seg] > 50-band)
return -1;
- if(dba_values[seg] >= 4)
- {
+ if (dba_values[seg] >= 4) {
delta = (dba_values[seg] - 3) << 7;
- }
- else
- {
+ } else {
delta = (dba_values[seg] - 4) << 7;
}
- for(i = 0; i < dba_lengths[seg]; i++)
- {
+ for (i = 0; i < dba_lengths[seg]; i++) {
mask[band++] += delta;
}
}
@@ -250,25 +220,21 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
int bin, band;
/* special case, if snr offset is -960, set all bap's to zero */
- if(snr_offset == -960)
- {
+ if (snr_offset == -960) {
memset(bap, 0, 256);
return;
}
bin = start;
band = bin_to_band_tab[start];
- do
- {
+ do {
int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
int band_end = FFMIN(band_start_tab[band+1], end);
- for(; bin < band_end; bin++)
- {
+ for (; bin < band_end; bin++) {
int address = av_clip((psd[bin] - m) >> 5, 0, 63);
bap[bin] = bap_tab[address];
}
- }
- while(end > band_start_tab[band++]);
+ } while (end > band_start_tab[band++]);
}
/* AC-3 bit allocation. The algorithm is the one described in the AC-3
@@ -304,11 +270,10 @@ av_cold void ac3_common_init(void)
#if !CONFIG_HARDCODED_TABLES
/* compute bndtab and masktab from bandsz */
int bin = 0, band;
- for(band = 0; band < 50; band++)
- {
+ for (band = 0; band < 50; band++) {
int band_end = bin + ff_ac3_critical_band_size_tab[band];
band_start_tab[band] = bin;
- while(bin < band_end)
+ while (bin < band_end)
bin_to_band_tab[bin++] = band;
}
band_start_tab[50] = bin;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.h
index 5deb4e7a6..4a4d3709b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3.h
@@ -44,8 +44,7 @@
#define EXP_D45 3
/** Delta bit allocation strategy */
-typedef enum
-{
+typedef enum {
DBA_REUSE = 0,
DBA_NEW,
DBA_NONE,
@@ -53,8 +52,7 @@ typedef enum
} AC3DeltaStrategy;
/** Channel mode (audio coding mode) */
-typedef enum
-{
+typedef enum {
AC3_CHMODE_DUALMONO = 0,
AC3_CHMODE_MONO,
AC3_CHMODE_STEREO,
@@ -65,8 +63,7 @@ typedef enum
AC3_CHMODE_3F2R
} AC3ChannelMode;
-typedef struct AC3BitAllocParameters
-{
+typedef struct AC3BitAllocParameters {
int sr_code;
int sr_shift;
int slow_gain, slow_decay, fast_decay, db_per_bit, floor;
@@ -77,8 +74,7 @@ typedef struct AC3BitAllocParameters
* @struct AC3HeaderInfo
* Coded AC-3 header values up to the lfeon element, plus derived values.
*/
-typedef struct
-{
+typedef struct {
/** @defgroup coded Coded elements
* @{
*/
@@ -108,8 +104,7 @@ typedef struct
/** @} */
} AC3HeaderInfo;
-typedef enum
-{
+typedef enum {
EAC3_FRAME_TYPE_INDEPENDENT = 0,
EAC3_FRAME_TYPE_DEPENDENT,
EAC3_FRAME_TYPE_AC3_CONVERT,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c
index edef35a54..6331b64da 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3_parser.c
@@ -29,8 +29,7 @@
#define AC3_HEADER_SIZE 7
-static const uint8_t eac3_blocks[4] =
-{
+static const uint8_t eac3_blocks[4] = {
1, 2, 3, 6
};
@@ -56,8 +55,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
hdr->center_mix_level = 1; // -4.5dB
hdr->surround_mix_level = 1; // -6.0dB
- if(hdr->bitstream_id <= 10)
- {
+ if(hdr->bitstream_id <= 10) {
/* Normal AC-3 */
hdr->crc1 = get_bits(gbc, 16);
hdr->sr_code = get_bits(gbc, 2);
@@ -73,12 +71,9 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
skip_bits(gbc, 3); // skip bitstream mode
hdr->channel_mode = get_bits(gbc, 3);
- if(hdr->channel_mode == AC3_CHMODE_STEREO)
- {
+ if(hdr->channel_mode == AC3_CHMODE_STEREO) {
skip_bits(gbc, 2); // skip dsurmod
- }
- else
- {
+ } else {
if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
hdr->center_mix_level = get_bits(gbc, 2);
if(hdr->channel_mode & 4)
@@ -93,9 +88,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
hdr->substreamid = 0;
- }
- else
- {
+ } else {
/* Enhanced AC-3 */
hdr->crc1 = 0;
hdr->frame_type = get_bits(gbc, 2);
@@ -109,16 +102,13 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
hdr->sr_code = get_bits(gbc, 2);
- if(hdr->sr_code == 3)
- {
+ if (hdr->sr_code == 3) {
int sr_code2 = get_bits(gbc, 2);
if(sr_code2 == 3)
return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
hdr->sr_shift = 1;
- }
- else
- {
+ } else {
hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
hdr->sr_shift = 0;
@@ -128,41 +118,35 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
hdr->lfe_on = get_bits1(gbc);
hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
- (hdr->num_blocks * 256.0));
+ (hdr->num_blocks * 256.0));
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
}
hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
- if(hdr->lfe_on)
+ if (hdr->lfe_on)
hdr->channel_layout |= CH_LOW_FREQUENCY;
return 0;
}
-int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr)
-{
+int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){
int ret, i;
ret = ff_ac3_parse_header(gbc, hdr);
- if(!ret)
- {
- if(hdr->bitstream_id > 10)
- {
+ if(!ret){
+ if(hdr->bitstream_id>10){
/* Enhanced AC-3 */
skip_bits(gbc, 5); // skip bitstream id
/* skip dialog normalization and compression gain */
- for(i = 0; i < (hdr->channel_mode ? 1 : 2); i++)
- {
+ for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
skip_bits(gbc, 5); // skip dialog normalization
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 8); //skip Compression gain word
}
}
/* dependent stream channel map */
- if(hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc))
- {
- hdr->channel_map = get_bits(gbc, 16); //custom channel map
- return 0;
+ if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) {
+ hdr->channel_map = get_bits(gbc, 16); //custom channel map
+ return 0;
}
}
//default channel map based on acmod and lfeon
@@ -174,18 +158,17 @@ int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr)
}
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
- int *need_next_header, int *new_frame_start)
+ int *need_next_header, int *new_frame_start)
{
int err;
- union
- {
+ union {
uint64_t u64;
uint8_t u8[8];
} tmp = { be2me_64(state) };
AC3HeaderInfo hdr;
GetBitContext gbc;
- init_get_bits(&gbc, tmp.u8 + 8 - AC3_HEADER_SIZE, 54);
+ init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
err = ff_ac3_parse_header(&gbc, &hdr);
if(err < 0)
@@ -196,7 +179,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
hdr_info->channels = hdr.channels;
hdr_info->channel_layout = hdr.channel_layout;
hdr_info->samples = hdr.num_blocks * 256;
- if(hdr.bitstream_id > 10)
+ if(hdr.bitstream_id>10)
hdr_info->codec_id = CODEC_ID_EAC3;
else
hdr_info->codec_id = CODEC_ID_AC3;
@@ -215,8 +198,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
}
-AVCodecParser ac3_parser =
-{
+AVCodecParser ac3_parser = {
{ CODEC_ID_AC3, CODEC_ID_EAC3 },
sizeof(AACAC3ParseContext),
ac3_parse_init,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.c
index e689839e7..36ca31fad 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.c
@@ -57,8 +57,7 @@ static int b5_mantissas[16];
* Quantization table: levels for symmetric. bits for asymmetric.
* reference: Table 7.18 Mapping of bap to Quantizer
*/
-static const uint8_t quantization_tab[16] =
-{
+static const uint8_t quantization_tab[16] = {
0, 3, 5, 7, 11, 15,
5, 6, 7, 8, 9, 10, 11, 12, 14, 16
};
@@ -77,8 +76,7 @@ static float dynamic_range_tab[256];
#define LEVEL_ZERO 0.0000000000000000
#define LEVEL_ONE 1.0000000000000000
-static const float gain_levels[9] =
-{
+static const float gain_levels[9] = {
LEVEL_PLUS_3DB,
LEVEL_PLUS_1POINT5DB,
LEVEL_ONE,
@@ -106,8 +104,7 @@ static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
* Table for default stereo downmixing coefficients
* reference: Section 7.8.2 Downmixing Into Two Channels
*/
-static const uint8_t ac3_default_coeffs[8][5][2] =
-{
+static const uint8_t ac3_default_coeffs[8][5][2] = {
{ { 2, 7 }, { 7, 2 }, },
{ { 4, 4 }, },
{ { 2, 7 }, { 7, 2 }, },
@@ -138,8 +135,7 @@ static av_cold void ac3_tables_init(void)
/* generate table for ungrouping 3 values in 7 bits
reference: Section 7.1.3 Exponent Decoding */
- for(i = 0; i < 128; i++)
- {
+ for(i=0; i<128; i++) {
ungroup_3_in_7_bits_tab[i][0] = i / 25;
ungroup_3_in_7_bits_tab[i][1] = (i % 25) / 5;
ungroup_3_in_7_bits_tab[i][2] = (i % 25) % 5;
@@ -147,15 +143,13 @@ static av_cold void ac3_tables_init(void)
/* generate grouped mantissa tables
reference: Section 7.3.5 Ungrouping of Mantissas */
- for(i = 0; i < 32; i++)
- {
+ for(i=0; i<32; i++) {
/* bap=1 mantissas */
b1_mantissas[i][0] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][0], 3);
b1_mantissas[i][1] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][1], 3);
b1_mantissas[i][2] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][2], 3);
}
- for(i = 0; i < 128; i++)
- {
+ for(i=0; i<128; i++) {
/* bap=2 mantissas */
b2_mantissas[i][0] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][0], 5);
b2_mantissas[i][1] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][1], 5);
@@ -167,21 +161,18 @@ static av_cold void ac3_tables_init(void)
}
/* generate ungrouped mantissa tables
reference: Tables 7.21 and 7.23 */
- for(i = 0; i < 7; i++)
- {
+ for(i=0; i<7; i++) {
/* bap=3 mantissas */
b3_mantissas[i] = symmetric_dequant(i, 7);
}
- for(i = 0; i < 15; i++)
- {
+ for(i=0; i<15; i++) {
/* bap=5 mantissas */
b5_mantissas[i] = symmetric_dequant(i, 15);
}
/* generate dynamic range table
reference: Section 7.7.1 Dynamic Range Control */
- for(i = 0; i < 256; i++)
- {
+ for(i=0; i<256; i++) {
int v = (i >> 5) - ((i >> 7) << 3) - 5;
dynamic_range_tab[i] = powf(2.0f, v) * ((i & 0x1F) | 0x20);
}
@@ -205,31 +196,26 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
av_lfg_init(&s->dith_state, 0);
/* set bias values for float to int16 conversion */
- if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c)
- {
+ if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
s->add_bias = 385.0f;
s->mul_bias = 1.0f;
- }
- else
- {
+ } else {
s->add_bias = 0.0f;
s->mul_bias = 32767.0f;
}
/* allow downmixing to stereo or mono */
- if(avctx->channels > 0 && avctx->request_channels > 0 &&
- avctx->request_channels < avctx->channels &&
- avctx->request_channels <= 2)
- {
+ if (avctx->channels > 0 && avctx->request_channels > 0 &&
+ avctx->request_channels < avctx->channels &&
+ avctx->request_channels <= 2) {
avctx->channels = avctx->request_channels;
}
s->downmixed = 1;
/* allocate context input buffer */
- if(avctx->error_recognition >= FF_ER_CAREFUL)
- {
+ if (avctx->error_recognition >= FF_ER_CAREFUL) {
s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
- if(!s->input_buffer)
+ if (!s->input_buffer)
return AVERROR_NOMEM;
}
@@ -249,36 +235,31 @@ static int ac3_parse_header(AC3DecodeContext *s)
/* read the rest of the bsi. read twice for dual mono mode. */
i = !(s->channel_mode);
- do
- {
+ do {
skip_bits(gbc, 5); // skip dialog normalization
- if(get_bits1(gbc))
+ if (get_bits1(gbc))
skip_bits(gbc, 8); //skip compression
- if(get_bits1(gbc))
+ if (get_bits1(gbc))
skip_bits(gbc, 8); //skip language code
- if(get_bits1(gbc))
+ if (get_bits1(gbc))
skip_bits(gbc, 7); //skip audio production information
- }
- while(i--);
+ } while (i--);
skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
/* skip the timecodes (or extra bitstream information for Alternate Syntax)
TODO: read & use the xbsi1 downmix levels */
- if(get_bits1(gbc))
+ if (get_bits1(gbc))
skip_bits(gbc, 14); //skip timecode1 / xbsi1
- if(get_bits1(gbc))
+ if (get_bits1(gbc))
skip_bits(gbc, 14); //skip timecode2 / xbsi2
/* skip additional bitstream info */
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
i = get_bits(gbc, 6);
- do
- {
+ do {
skip_bits(gbc, 8);
- }
- while(i--);
+ } while(i--);
}
return 0;
@@ -314,16 +295,14 @@ static int parse_frame_header(AC3DecodeContext *s)
s->frame_type = hdr.frame_type;
s->substreamid = hdr.substreamid;
- if(s->lfe_on)
- {
+ if(s->lfe_on) {
s->start_freq[s->lfe_ch] = 0;
s->end_freq[s->lfe_ch] = 7;
s->num_exp_groups[s->lfe_ch] = 2;
s->channel_in_cpl[s->lfe_ch] = 0;
}
- if(hdr.bitstream_id <= 10)
- {
+ if (hdr.bitstream_id <= 10) {
s->eac3 = 0;
s->snr_offset_strategy = 2;
s->block_switch_syntax = 1;
@@ -335,14 +314,10 @@ static int parse_frame_header(AC3DecodeContext *s)
s->skip_syntax = 1;
memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
return ac3_parse_header(s);
- }
- else if(CONFIG_EAC3_DECODER)
- {
+ } else if (CONFIG_EAC3_DECODER) {
s->eac3 = 1;
return ff_eac3_parse_header(s);
- }
- else
- {
+ } else {
av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n");
return -1;
}
@@ -359,44 +334,37 @@ static void set_downmix_coeffs(AC3DecodeContext *s)
float smix = gain_levels[surround_levels[s->surround_mix_level]];
float norm0, norm1;
- for(i = 0; i < s->fbw_channels; i++)
- {
+ for(i=0; i<s->fbw_channels; i++) {
s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]];
s->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[s->channel_mode][i][1]];
}
- if(s->channel_mode > 1 && s->channel_mode & 1)
- {
+ if(s->channel_mode > 1 && s->channel_mode & 1) {
s->downmix_coeffs[1][0] = s->downmix_coeffs[1][1] = cmix;
}
- if(s->channel_mode == AC3_CHMODE_2F1R || s->channel_mode == AC3_CHMODE_3F1R)
- {
+ if(s->channel_mode == AC3_CHMODE_2F1R || s->channel_mode == AC3_CHMODE_3F1R) {
int nf = s->channel_mode - 2;
s->downmix_coeffs[nf][0] = s->downmix_coeffs[nf][1] = smix * LEVEL_MINUS_3DB;
}
- if(s->channel_mode == AC3_CHMODE_2F2R || s->channel_mode == AC3_CHMODE_3F2R)
- {
+ if(s->channel_mode == AC3_CHMODE_2F2R || s->channel_mode == AC3_CHMODE_3F2R) {
int nf = s->channel_mode - 4;
s->downmix_coeffs[nf][0] = s->downmix_coeffs[nf+1][1] = smix;
}
/* renormalize */
norm0 = norm1 = 0.0;
- for(i = 0; i < s->fbw_channels; i++)
- {
+ for(i=0; i<s->fbw_channels; i++) {
norm0 += s->downmix_coeffs[i][0];
norm1 += s->downmix_coeffs[i][1];
}
norm0 = 1.0f / norm0;
norm1 = 1.0f / norm1;
- for(i = 0; i < s->fbw_channels; i++)
- {
+ for(i=0; i<s->fbw_channels; i++) {
s->downmix_coeffs[i][0] *= norm0;
s->downmix_coeffs[i][1] *= norm1;
}
- if(s->output_mode == AC3_CHMODE_MONO)
- {
- for(i = 0; i < s->fbw_channels; i++)
+ if(s->output_mode == AC3_CHMODE_MONO) {
+ for(i=0; i<s->fbw_channels; i++)
s->downmix_coeffs[i][0] = (s->downmix_coeffs[i][0] + s->downmix_coeffs[i][1]) * LEVEL_MINUS_3DB;
}
}
@@ -414,8 +382,7 @@ static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps,
/* unpack groups */
group_size = exp_strategy + (exp_strategy == EXP_D45);
- for(grp = 0, i = 0; grp < ngrps; grp++)
- {
+ for(grp=0,i=0; grp<ngrps; grp++) {
expacc = get_bits(gbc, 7);
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0];
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1];
@@ -424,20 +391,15 @@ static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps,
/* convert to absolute exps and expand groups */
prevexp = absexp;
- for(i = 0, j = 0; i < ngrps * 3; i++)
- {
+ for(i=0,j=0; i<ngrps*3; i++) {
prevexp += dexp[i] - 2;
- if(prevexp > 24U)
+ if (prevexp > 24U)
return -1;
- switch(group_size)
- {
- case 4:
- dexps[j++] = prevexp;
- dexps[j++] = prevexp;
- case 2:
- dexps[j++] = prevexp;
- case 1:
- dexps[j++] = prevexp;
+ switch (group_size) {
+ case 4: dexps[j++] = prevexp;
+ dexps[j++] = prevexp;
+ case 2: dexps[j++] = prevexp;
+ case 1: dexps[j++] = prevexp;
}
}
return 0;
@@ -453,22 +415,17 @@ static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
int bin, band, ch;
bin = s->start_freq[CPL_CH];
- for(band = 0; band < s->num_cpl_bands; band++)
- {
+ for (band = 0; band < s->num_cpl_bands; band++) {
int band_start = bin;
int band_end = bin + s->cpl_band_sizes[band];
- for(ch = 1; ch <= s->fbw_channels; ch++)
- {
- if(s->channel_in_cpl[ch])
- {
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (s->channel_in_cpl[ch]) {
int cpl_coord = s->cpl_coords[ch][band] << 5;
- for(bin = band_start; bin < band_end; bin++)
- {
+ for (bin = band_start; bin < band_end; bin++) {
s->fixed_coeffs[ch][bin] = MULH(s->fixed_coeffs[CPL_CH][bin] << 4, cpl_coord);
}
- if(ch == 2 && s->phase_flags[band])
- {
- for(bin = band_start; bin < band_end; bin++)
+ if (ch == 2 && s->phase_flags[band]) {
+ for (bin = band_start; bin < band_end; bin++)
s->fixed_coeffs[2][bin] = -s->fixed_coeffs[2][bin];
}
}
@@ -480,8 +437,7 @@ static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
/**
* Grouped mantissas for 3-level 5-level and 11-level quantization
*/
-typedef struct
-{
+typedef struct {
int b1_mant[2];
int b2_mant[2];
int b4_mant;
@@ -505,73 +461,65 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
GetBitContext *gbc = &s->gbc;
int freq;
- for(freq = start_freq; freq < end_freq; freq++)
- {
+ for(freq = start_freq; freq < end_freq; freq++){
int bap = baps[freq];
int mantissa;
- switch(bap)
- {
- case 0:
- if(dither)
- mantissa = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
- else
- mantissa = 0;
- break;
- case 1:
- if(m->b1)
- {
- m->b1--;
- mantissa = m->b1_mant[m->b1];
- }
- else
- {
- int bits = get_bits(gbc, 5);
- mantissa = b1_mantissas[bits][0];
- m->b1_mant[1] = b1_mantissas[bits][1];
- m->b1_mant[0] = b1_mantissas[bits][2];
- m->b1 = 2;
- }
- break;
- case 2:
- if(m->b2)
- {
- m->b2--;
- mantissa = m->b2_mant[m->b2];
- }
- else
- {
- int bits = get_bits(gbc, 7);
- mantissa = b2_mantissas[bits][0];
- m->b2_mant[1] = b2_mantissas[bits][1];
- m->b2_mant[0] = b2_mantissas[bits][2];
- m->b2 = 2;
- }
- break;
- case 3:
- mantissa = b3_mantissas[get_bits(gbc, 3)];
- break;
- case 4:
- if(m->b4)
- {
- m->b4 = 0;
- mantissa = m->b4_mant;
- }
- else
- {
- int bits = get_bits(gbc, 7);
- mantissa = b4_mantissas[bits][0];
- m->b4_mant = b4_mantissas[bits][1];
- m->b4 = 1;
- }
- break;
- case 5:
- mantissa = b5_mantissas[get_bits(gbc, 4)];
- break;
- default: /* 6 to 15 */
- mantissa = get_bits(gbc, quantization_tab[bap]);
- /* Shift mantissa and sign-extend it. */
- mantissa = (mantissa << (32 - quantization_tab[bap])) >> 8;
- break;
+ switch(bap){
+ case 0:
+ if (dither)
+ mantissa = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
+ else
+ mantissa = 0;
+ break;
+ case 1:
+ if(m->b1){
+ m->b1--;
+ mantissa = m->b1_mant[m->b1];
+ }
+ else{
+ int bits = get_bits(gbc, 5);
+ mantissa = b1_mantissas[bits][0];
+ m->b1_mant[1] = b1_mantissas[bits][1];
+ m->b1_mant[0] = b1_mantissas[bits][2];
+ m->b1 = 2;
+ }
+ break;
+ case 2:
+ if(m->b2){
+ m->b2--;
+ mantissa = m->b2_mant[m->b2];
+ }
+ else{
+ int bits = get_bits(gbc, 7);
+ mantissa = b2_mantissas[bits][0];
+ m->b2_mant[1] = b2_mantissas[bits][1];
+ m->b2_mant[0] = b2_mantissas[bits][2];
+ m->b2 = 2;
+ }
+ break;
+ case 3:
+ mantissa = b3_mantissas[get_bits(gbc, 3)];
+ break;
+ case 4:
+ if(m->b4){
+ m->b4 = 0;
+ mantissa = m->b4_mant;
+ }
+ else{
+ int bits = get_bits(gbc, 7);
+ mantissa = b4_mantissas[bits][0];
+ m->b4_mant = b4_mantissas[bits][1];
+ m->b4 = 1;
+ }
+ break;
+ case 5:
+ mantissa = b5_mantissas[get_bits(gbc, 4)];
+ break;
+ default: /* 6 to 15 */
+ mantissa = get_bits(gbc, quantization_tab[bap]);
+ /* Shift mantissa and sign-extend it. */
+ mantissa = (mantissa << (32-quantization_tab[bap]))>>8;
+ break;
}
coeffs[freq] = mantissa >> exps[freq];
}
@@ -582,16 +530,12 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
* mantissas for coupled channels which do not use dithering.
* reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0)
*/
-static void remove_dithering(AC3DecodeContext *s)
-{
+static void remove_dithering(AC3DecodeContext *s) {
int ch, i;
- for(ch = 1; ch <= s->fbw_channels; ch++)
- {
- if(!s->dither_flag[ch] && s->channel_in_cpl[ch])
- {
- for(i = s->start_freq[CPL_CH]; i < s->end_freq[CPL_CH]; i++)
- {
+ for(ch=1; ch<=s->fbw_channels; ch++) {
+ if(!s->dither_flag[ch] && s->channel_in_cpl[ch]) {
+ for(i = s->start_freq[CPL_CH]; i<s->end_freq[CPL_CH]; i++) {
if(!s->bap[CPL_CH][i])
s->fixed_coeffs[ch][i] = 0;
}
@@ -600,21 +544,17 @@ static void remove_dithering(AC3DecodeContext *s)
}
static void decode_transform_coeffs_ch(AC3DecodeContext *s, int blk, int ch,
- mant_groups *m)
+ mant_groups *m)
{
- if(!s->channel_uses_aht[ch])
- {
+ if (!s->channel_uses_aht[ch]) {
ac3_decode_transform_coeffs_ch(s, ch, m);
- }
- else
- {
+ } else {
/* if AHT is used, mantissas for all blocks are encoded in the first
block of the frame. */
int bin;
- if(!blk && CONFIG_EAC3_DECODER)
+ if (!blk && CONFIG_EAC3_DECODER)
ff_eac3_decode_transform_coeffs_aht_ch(s, ch);
- for(bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++)
- {
+ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
s->fixed_coeffs[ch][bin] = s->pre_mantissa[ch][bin][blk] >> s->dexps[ch][bin];
}
}
@@ -631,24 +571,19 @@ static void decode_transform_coeffs(AC3DecodeContext *s, int blk)
m.b1 = m.b2 = m.b4 = 0;
- for(ch = 1; ch <= s->channels; ch++)
- {
+ 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
coefficients for the first coupled channel*/
- if(s->channel_in_cpl[ch])
- {
- if(!got_cplchan)
- {
+ if (s->channel_in_cpl[ch]) {
+ if (!got_cplchan) {
decode_transform_coeffs_ch(s, blk, CPL_CH, &m);
calc_transform_coeffs_cpl(s);
got_cplchan = 1;
}
end = s->end_freq[CPL_CH];
- }
- else
- {
+ } else {
end = s->end_freq[ch];
}
do
@@ -671,13 +606,10 @@ static void do_rematrixing(AC3DecodeContext *s)
end = FFMIN(s->end_freq[1], s->end_freq[2]);
- for(bnd = 0; bnd < s->num_rematrixing_bands; bnd++)
- {
- if(s->rematrixing_flags[bnd])
- {
+ for(bnd=0; bnd<s->num_rematrixing_bands; bnd++) {
+ if(s->rematrixing_flags[bnd]) {
bndend = FFMIN(end, ff_ac3_rematrix_band_tab[bnd+1]);
- for(i = ff_ac3_rematrix_band_tab[bnd]; i < bndend; i++)
- {
+ for(i=ff_ac3_rematrix_band_tab[bnd]; i<bndend; i++) {
int tmp0 = s->fixed_coeffs[1][i];
s->fixed_coeffs[1][i] += s->fixed_coeffs[2][i];
s->fixed_coeffs[2][i] = tmp0 - s->fixed_coeffs[2][i];
@@ -695,28 +627,24 @@ static inline void do_imdct(AC3DecodeContext *s, int channels)
{
int ch;
float add_bias = s->add_bias;
- if(s->out_channels == 1 && channels > 1)
+ if(s->out_channels==1 && channels>1)
add_bias *= LEVEL_MINUS_3DB; // compensate for the gain in downmix
- for(ch = 1; ch <= channels; ch++)
- {
- if(s->block_switch[ch])
- {
+ for (ch=1; ch<=channels; ch++) {
+ if (s->block_switch[ch]) {
int i;
- float *x = s->tmp_output + 128;
- for(i = 0; i < 128; i++)
+ float *x = s->tmp_output+128;
+ for(i=0; i<128; i++)
x[i] = s->transform_coeffs[ch][2*i];
ff_imdct_half(&s->imdct_256, s->tmp_output, x);
s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128);
- for(i = 0; i < 128; i++)
+ for(i=0; i<128; i++)
x[i] = s->transform_coeffs[ch][2*i+1];
ff_imdct_half(&s->imdct_256, s->delay[ch-1], x);
- }
- else
- {
+ } else {
ff_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->tmp_output, s->window, add_bias, 128);
- memcpy(s->delay[ch-1], s->tmp_output + 128, 128 * sizeof(float));
+ memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float));
}
}
}
@@ -724,30 +652,24 @@ 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)
+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++)
- {
+ if(out_ch == 2) {
+ for(i=0; i<len; i++) {
v0 = v1 = 0.0f;
- for(j = 0; j < in_ch; j++)
- {
+ 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++)
- {
+ } else if(out_ch == 1) {
+ for(i=0; i<len; i++) {
v0 = 0.0f;
- for(j = 0; j < in_ch; j++)
+ for(j=0; j<in_ch; j++)
v0 += samples[j][i] * matrix[j][0];
samples[0][i] = v0;
}
@@ -760,26 +682,25 @@ void ff_ac3_downmix_c(float(*samples)[256], float(*matrix)[2], int out_ch, int i
static void ac3_upmix_delay(AC3DecodeContext *s)
{
int channel_data_size = sizeof(s->delay[0]);
- switch(s->channel_mode)
- {
- case AC3_CHMODE_DUALMONO:
- case AC3_CHMODE_STEREO:
- /* upmix mono to stereo */
- memcpy(s->delay[1], s->delay[0], channel_data_size);
- break;
- case AC3_CHMODE_2F2R:
- memset(s->delay[3], 0, channel_data_size);
- case AC3_CHMODE_2F1R:
- memset(s->delay[2], 0, channel_data_size);
- break;
- case AC3_CHMODE_3F2R:
- memset(s->delay[4], 0, channel_data_size);
- case AC3_CHMODE_3F1R:
- memset(s->delay[3], 0, channel_data_size);
- case AC3_CHMODE_3F:
- memcpy(s->delay[2], s->delay[1], channel_data_size);
- memset(s->delay[1], 0, channel_data_size);
- break;
+ switch(s->channel_mode) {
+ case AC3_CHMODE_DUALMONO:
+ case AC3_CHMODE_STEREO:
+ /* upmix mono to stereo */
+ memcpy(s->delay[1], s->delay[0], channel_data_size);
+ break;
+ case AC3_CHMODE_2F2R:
+ memset(s->delay[3], 0, channel_data_size);
+ case AC3_CHMODE_2F1R:
+ memset(s->delay[2], 0, channel_data_size);
+ break;
+ case AC3_CHMODE_3F2R:
+ memset(s->delay[4], 0, channel_data_size);
+ case AC3_CHMODE_3F1R:
+ memset(s->delay[3], 0, channel_data_size);
+ case AC3_CHMODE_3F:
+ memcpy(s->delay[2], s->delay[1], channel_data_size);
+ memset(s->delay[1], 0, channel_data_size);
+ break;
}
}
@@ -804,7 +725,7 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
const uint8_t *default_band_struct,
int *num_bands, uint8_t *band_sizes)
{
- int subbnd, bnd, n_subbands, n_bands = 0;
+ int subbnd, bnd, n_subbands, n_bands=0;
uint8_t bnd_sz[22];
uint8_t coded_band_struct[22];
const uint8_t *band_struct;
@@ -812,20 +733,14 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
n_subbands = end_subband - start_subband;
/* decode band structure from bitstream or use default */
- if(!eac3 || get_bits1(gbc))
- {
- for(subbnd = 0; subbnd < n_subbands - 1; subbnd++)
- {
+ if (!eac3 || get_bits1(gbc)) {
+ for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
coded_band_struct[subbnd] = get_bits1(gbc);
}
band_struct = coded_band_struct;
- }
- else if(!blk)
- {
+ } else if (!blk) {
band_struct = &default_band_struct[start_subband+1];
- }
- else
- {
+ } else {
/* no change in band structure */
return;
}
@@ -833,29 +748,24 @@ static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
/* calculate number of bands and band sizes based on band structure.
note that the first 4 subbands in enhanced coupling span only 6 bins
instead of 12. */
- if(num_bands || band_sizes)
- {
+ if (num_bands || band_sizes ) {
n_bands = n_subbands;
bnd_sz[0] = ecpl ? 6 : 12;
- for(bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++)
- {
+ for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
- if(band_struct[subbnd-1])
- {
+ if (band_struct[subbnd-1]) {
n_bands--;
bnd_sz[bnd] += subbnd_size;
- }
- else
- {
+ } else {
bnd_sz[++bnd] = subbnd_size;
}
}
}
/* set optional output params */
- if(num_bands)
+ if (num_bands)
*num_bands = n_bands;
- if(band_sizes)
+ if (band_sizes)
memcpy(band_sizes, bnd_sz, n_bands);
}
@@ -877,10 +787,8 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
/* block switch flags */
different_transforms = 0;
- if(s->block_switch_syntax)
- {
- for(ch = 1; ch <= fbw_channels; ch++)
- {
+ if (s->block_switch_syntax) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
s->block_switch[ch] = get_bits1(gbc);
if(ch > 1 && s->block_switch[ch] != s->block_switch[1])
different_transforms = 1;
@@ -888,65 +796,51 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
/* dithering flags */
- if(s->dither_flag_syntax)
- {
- for(ch = 1; ch <= fbw_channels; ch++)
- {
+ if (s->dither_flag_syntax) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
s->dither_flag[ch] = get_bits1(gbc);
}
}
/* dynamic range */
i = !(s->channel_mode);
- do
- {
- if(get_bits1(gbc))
- {
- s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)] - 1.0) *
- s->avctx->drc_scale) + 1.0;
- }
- else if(blk == 0)
- {
+ do {
+ if(get_bits1(gbc)) {
+ s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)]-1.0) *
+ s->avctx->drc_scale)+1.0;
+ } else if(blk == 0) {
s->dynamic_range[i] = 1.0f;
}
- }
- while(i--);
+ } while(i--);
/* spectral extension strategy */
- if(s->eac3 && (!blk || get_bits1(gbc)))
- {
+ if (s->eac3 && (!blk || get_bits1(gbc))) {
s->spx_in_use = get_bits1(gbc);
- if(s->spx_in_use)
- {
+ if (s->spx_in_use) {
int begf, endf;
int spx_end_subband;
/* determine which channels use spx */
- if(s->channel_mode == AC3_CHMODE_MONO)
- {
+ if (s->channel_mode == AC3_CHMODE_MONO) {
s->channel_in_spx[1] = 1;
- }
- else
- {
- for(ch = 1; ch <= fbw_channels; ch++)
+ } else {
+ for (ch = 1; ch <= fbw_channels; ch++)
s->channel_in_spx[ch] = get_bits1(gbc);
}
s->spx_copy_start_freq = get_bits(gbc, 2) * 12 + 25;
begf = get_bits(gbc, 3);
endf = get_bits(gbc, 3);
- s->spx_start_subband = begf < 6 ? begf + 2 : 2 * begf - 3;
- spx_end_subband = endf < 4 ? endf + 5 : 2 * endf + 3;
- if(s->spx_start_subband >= spx_end_subband)
- {
+ s->spx_start_subband = begf < 6 ? begf+2 : 2*begf-3;
+ spx_end_subband = endf < 4 ? endf+5 : 2*endf+3;
+ if (s->spx_start_subband >= spx_end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension range (%d >= %d)\n",
s->spx_start_subband, spx_end_subband);
return -1;
}
s->spx_start_freq = s->spx_start_subband * 12 + 25;
s->spx_end_freq = spx_end_subband * 12 + 25;
- if(s->spx_copy_start_freq >= s->spx_start_freq)
- {
+ if (s->spx_copy_start_freq >= s->spx_start_freq) {
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension copy start bin (%d >= %d)\n",
s->spx_copy_start_freq, s->spx_start_freq);
return -1;
@@ -955,11 +849,8 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->spx_start_subband, spx_end_subband,
ff_eac3_default_spx_band_struct,
&s->num_spx_bands, s->spx_band_sizes);
- }
- else
- {
- for(ch = 1; ch <= fbw_channels; ch++)
- {
+ } else {
+ for (ch = 1; ch <= fbw_channels; ch++) {
s->channel_in_spx[ch] = 0;
s->first_spx_coords[ch] = 1;
}
@@ -967,14 +858,10 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
/* spectral extension coordinates */
- if(s->spx_in_use)
- {
- for(ch = 1; ch <= fbw_channels; ch++)
- {
- if(s->channel_in_spx[ch])
- {
- if(s->first_spx_coords[ch] || get_bits1(gbc))
- {
+ if (s->spx_in_use) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ if (s->channel_in_spx[ch]) {
+ if (s->first_spx_coords[ch] || get_bits1(gbc)) {
int bin;
float spx_blend;
int master_spx_coord;
@@ -982,8 +869,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
spx_blend = get_bits(gbc, 5) / 32.0f;
master_spx_coord = get_bits(gbc, 2) * 3;
bin = s->spx_start_freq;
- for(bnd = 0; bnd < s->num_spx_bands; bnd++)
- {
+ for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
int bandsize;
int spx_coord_exp, spx_coord_mant;
float nratio, sblend, nblend, spx_coord;
@@ -992,7 +878,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
bandsize = s->spx_band_sizes[bnd];
nratio = ((float)((bin + (bandsize >> 1))) / s->spx_end_freq) - spx_blend;
nratio = av_clipf(nratio, 0.0f, 1.0f);
- nblend = sqrt(nratio);
+ nblend = sqrt( nratio);
sblend = sqrt(1.0f - nratio);
nblend *= 1.73205077648f; // scale noise to give unity variance
bin += bandsize;
@@ -1000,7 +886,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
/* decode spx coordinates */
spx_coord_exp = get_bits(gbc, 4);
spx_coord_mant = get_bits(gbc, 2);
- if(spx_coord_exp == 15)
+ if (spx_coord_exp == 15)
spx_coord = spx_coord_mant / 4.0f;
else
spx_coord = (spx_coord_mant + 4) / 8.0f;
@@ -1011,61 +897,51 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->spx_signal_blend[ch][bnd] = sblend * spx_coord * 32.0f;
}
}
- }
- else
- {
+ } else {
s->first_spx_coords[ch] = 1;
}
}
}
/* coupling strategy */
- if(s->eac3 ? s->cpl_strategy_exists[blk] : get_bits1(gbc))
- {
+ if (s->eac3 ? s->cpl_strategy_exists[blk] : get_bits1(gbc)) {
memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
- if(!s->eac3)
+ if (!s->eac3)
s->cpl_in_use[blk] = get_bits1(gbc);
- if(s->cpl_in_use[blk])
- {
+ if (s->cpl_in_use[blk]) {
/* coupling in use */
int cpl_start_subband, cpl_end_subband;
- if(channel_mode < AC3_CHMODE_STEREO)
- {
+ if (channel_mode < AC3_CHMODE_STEREO) {
av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n");
return -1;
}
/* check for enhanced coupling */
- if(s->eac3 && get_bits1(gbc))
- {
+ if (s->eac3 && get_bits1(gbc)) {
/* TODO: parse enhanced coupling strategy info */
av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
return -1;
}
/* determine which channels are coupled */
- if(s->eac3 && s->channel_mode == AC3_CHMODE_STEREO)
- {
+ if (s->eac3 && s->channel_mode == AC3_CHMODE_STEREO) {
s->channel_in_cpl[1] = 1;
s->channel_in_cpl[2] = 1;
- }
- else
- {
- for(ch = 1; ch <= fbw_channels; ch++)
+ } else {
+ for (ch = 1; ch <= fbw_channels; ch++)
s->channel_in_cpl[ch] = get_bits1(gbc);
}
/* phase flags in use */
- if(channel_mode == AC3_CHMODE_STEREO)
+ if (channel_mode == AC3_CHMODE_STEREO)
s->phase_flags_in_use = get_bits1(gbc);
/* coupling frequency range */
cpl_start_subband = get_bits(gbc, 4);
cpl_end_subband = s->spx_in_use ? s->spx_start_subband - 1 :
- get_bits(gbc, 4) + 3;
- if(cpl_start_subband >= cpl_end_subband)
- {
+ get_bits(gbc, 4) + 3;
+ if (cpl_start_subband >= cpl_end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
cpl_start_subband, cpl_end_subband);
return -1;
@@ -1077,158 +953,123 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
cpl_end_subband,
ff_eac3_default_cpl_band_struct,
&s->num_cpl_bands, s->cpl_band_sizes);
- }
- else
- {
+ } else {
/* coupling not in use */
- for(ch = 1; ch <= fbw_channels; ch++)
- {
+ for (ch = 1; ch <= fbw_channels; ch++) {
s->channel_in_cpl[ch] = 0;
s->first_cpl_coords[ch] = 1;
}
s->first_cpl_leak = s->eac3;
s->phase_flags_in_use = 0;
}
- }
- else if(!s->eac3)
- {
- if(!blk)
- {
+ } else if (!s->eac3) {
+ if(!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must be present in block 0\n");
return -1;
- }
- else
- {
+ } else {
s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
}
}
cpl_in_use = s->cpl_in_use[blk];
/* coupling coordinates */
- if(cpl_in_use)
- {
+ if (cpl_in_use) {
int cpl_coords_exist = 0;
- for(ch = 1; ch <= fbw_channels; ch++)
- {
- if(s->channel_in_cpl[ch])
- {
- if((s->eac3 && s->first_cpl_coords[ch]) || get_bits1(gbc))
- {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ if (s->channel_in_cpl[ch]) {
+ if ((s->eac3 && s->first_cpl_coords[ch]) || get_bits1(gbc)) {
int master_cpl_coord, cpl_coord_exp, cpl_coord_mant;
s->first_cpl_coords[ch] = 0;
cpl_coords_exist = 1;
master_cpl_coord = 3 * get_bits(gbc, 2);
- for(bnd = 0; bnd < s->num_cpl_bands; bnd++)
- {
+ for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
cpl_coord_exp = get_bits(gbc, 4);
cpl_coord_mant = get_bits(gbc, 4);
- if(cpl_coord_exp == 15)
+ if (cpl_coord_exp == 15)
s->cpl_coords[ch][bnd] = cpl_coord_mant << 22;
else
s->cpl_coords[ch][bnd] = (cpl_coord_mant + 16) << 21;
s->cpl_coords[ch][bnd] >>= (cpl_coord_exp + master_cpl_coord);
}
- }
- else if(!blk)
- {
+ } else if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must be present in block 0\n");
return -1;
}
- }
- else
- {
+ } else {
/* channel not in coupling */
s->first_cpl_coords[ch] = 1;
}
}
/* phase flags */
- if(channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist)
- {
- for(bnd = 0; bnd < s->num_cpl_bands; bnd++)
- {
- s->phase_flags[bnd] = s->phase_flags_in_use ? get_bits1(gbc) : 0;
+ if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) {
+ for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
+ s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0;
}
}
}
/* stereo rematrixing strategy and band structure */
- if(channel_mode == AC3_CHMODE_STEREO)
- {
- if((s->eac3 && !blk) || get_bits1(gbc))
- {
+ if (channel_mode == AC3_CHMODE_STEREO) {
+ if ((s->eac3 && !blk) || get_bits1(gbc)) {
s->num_rematrixing_bands = 4;
- if(cpl_in_use && s->start_freq[CPL_CH] <= 61)
- {
+ if (cpl_in_use && s->start_freq[CPL_CH] <= 61) {
s->num_rematrixing_bands -= 1 + (s->start_freq[CPL_CH] == 37);
- }
- else if(s->spx_in_use && s->spx_start_freq <= 61)
- {
+ } else if (s->spx_in_use && s->spx_start_freq <= 61) {
s->num_rematrixing_bands -= 1;
}
- for(bnd = 0; bnd < s->num_rematrixing_bands; bnd++)
+ for(bnd=0; bnd<s->num_rematrixing_bands; bnd++)
s->rematrixing_flags[bnd] = get_bits1(gbc);
- }
- else if(!blk)
- {
+ } else if (!blk) {
av_log(s->avctx, AV_LOG_WARNING, "Warning: new rematrixing strategy not present in block 0\n");
s->num_rematrixing_bands = 0;
}
}
/* exponent strategies for each channel */
- for(ch = !cpl_in_use; ch <= s->channels; ch++)
- {
- if(!s->eac3)
+ for (ch = !cpl_in_use; ch <= s->channels; ch++) {
+ if (!s->eac3)
s->exp_strategy[blk][ch] = get_bits(gbc, 2 - (ch == s->lfe_ch));
if(s->exp_strategy[blk][ch] != EXP_REUSE)
bit_alloc_stages[ch] = 3;
}
/* channel bandwidth */
- for(ch = 1; ch <= fbw_channels; ch++)
- {
+ for (ch = 1; ch <= fbw_channels; ch++) {
s->start_freq[ch] = 0;
- if(s->exp_strategy[blk][ch] != EXP_REUSE)
- {
+ if (s->exp_strategy[blk][ch] != EXP_REUSE) {
int group_size;
int prev = s->end_freq[ch];
- if(s->channel_in_cpl[ch])
+ if (s->channel_in_cpl[ch])
s->end_freq[ch] = s->start_freq[CPL_CH];
- else if(s->channel_in_spx[ch])
+ else if (s->channel_in_spx[ch])
s->end_freq[ch] = s->spx_start_freq;
- else
- {
+ else {
int bandwidth_code = get_bits(gbc, 6);
- if(bandwidth_code > 60)
- {
+ if (bandwidth_code > 60) {
av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code);
return -1;
}
s->end_freq[ch] = bandwidth_code * 3 + 73;
}
group_size = 3 << (s->exp_strategy[blk][ch] - 1);
- s->num_exp_groups[ch] = (s->end_freq[ch] + group_size - 4) / group_size;
+ s->num_exp_groups[ch] = (s->end_freq[ch]+group_size-4) / group_size;
if(blk > 0 && s->end_freq[ch] != prev)
memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
}
}
- if(cpl_in_use && s->exp_strategy[blk][CPL_CH] != EXP_REUSE)
- {
+ if (cpl_in_use && s->exp_strategy[blk][CPL_CH] != EXP_REUSE) {
s->num_exp_groups[CPL_CH] = (s->end_freq[CPL_CH] - s->start_freq[CPL_CH]) /
(3 << (s->exp_strategy[blk][CPL_CH] - 1));
}
/* decode exponents for each channel */
- for(ch = !cpl_in_use; ch <= s->channels; ch++)
- {
- if(s->exp_strategy[blk][ch] != EXP_REUSE)
- {
+ for (ch = !cpl_in_use; ch <= s->channels; ch++) {
+ if (s->exp_strategy[blk][ch] != EXP_REUSE) {
s->dexps[ch][0] = get_bits(gbc, 4) << !ch;
- if(decode_exponents(gbc, s->exp_strategy[blk][ch],
- s->num_exp_groups[ch], s->dexps[ch][0],
- &s->dexps[ch][s->start_freq[ch] + !!ch]))
- {
+ if (decode_exponents(gbc, s->exp_strategy[blk][ch],
+ s->num_exp_groups[ch], s->dexps[ch][0],
+ &s->dexps[ch][s->start_freq[ch]+!!ch])) {
av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n");
return -1;
}
@@ -1238,48 +1079,39 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
/* bit allocation information */
- if(s->bit_allocation_syntax)
- {
- if(get_bits1(gbc))
- {
+ if (s->bit_allocation_syntax) {
+ if (get_bits1(gbc)) {
s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift;
s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift;
s->bit_alloc_params.slow_gain = ff_ac3_slow_gain_tab[get_bits(gbc, 2)];
s->bit_alloc_params.db_per_bit = ff_ac3_db_per_bit_tab[get_bits(gbc, 2)];
s->bit_alloc_params.floor = ff_ac3_floor_tab[get_bits(gbc, 3)];
- for(ch = !cpl_in_use; ch <= s->channels; ch++)
+ for(ch=!cpl_in_use; ch<=s->channels; ch++)
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
- }
- else if(!blk)
- {
+ } else if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must be present in block 0\n");
return -1;
}
}
/* signal-to-noise ratio offsets and fast gains (signal-to-mask ratios) */
- if(!s->eac3 || !blk)
- {
- if(s->snr_offset_strategy && get_bits1(gbc))
- {
+ if(!s->eac3 || !blk){
+ if(s->snr_offset_strategy && get_bits1(gbc)) {
int snr = 0;
int csnr;
csnr = (get_bits(gbc, 6) - 15) << 4;
- for(i = ch = !cpl_in_use; ch <= s->channels; ch++)
- {
+ for (i = ch = !cpl_in_use; ch <= s->channels; ch++) {
/* snr offset */
- if(ch == i || s->snr_offset_strategy == 2)
+ if (ch == i || s->snr_offset_strategy == 2)
snr = (csnr + get_bits(gbc, 4)) << 2;
/* run at least last bit allocation stage if snr offset changes */
- if(blk && s->snr_offset[ch] != snr)
- {
+ if(blk && s->snr_offset[ch] != snr) {
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 1);
}
s->snr_offset[ch] = snr;
/* fast gain (normal AC-3 only) */
- if(!s->eac3)
- {
+ if (!s->eac3) {
int prev = s->fast_gain[ch];
s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
/* run last 2 bit allocation stages if fast gain changes */
@@ -1287,57 +1119,45 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
}
}
- }
- else if(!s->eac3 && !blk)
- {
+ } else if (!s->eac3 && !blk) {
av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
return -1;
}
}
/* fast gain (E-AC-3 only) */
- if(s->fast_gain_syntax && get_bits1(gbc))
- {
- for(ch = !cpl_in_use; ch <= s->channels; ch++)
- {
+ if (s->fast_gain_syntax && get_bits1(gbc)) {
+ for (ch = !cpl_in_use; ch <= s->channels; ch++) {
int prev = s->fast_gain[ch];
s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
/* run last 2 bit allocation stages if fast gain changes */
if(blk && prev != s->fast_gain[ch])
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
}
- }
- else if(s->eac3 && !blk)
- {
- for(ch = !cpl_in_use; ch <= s->channels; ch++)
+ } else if (s->eac3 && !blk) {
+ for (ch = !cpl_in_use; ch <= s->channels; ch++)
s->fast_gain[ch] = ff_ac3_fast_gain_tab[4];
}
/* E-AC-3 to AC-3 converter SNR offset */
- if(s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && get_bits1(gbc))
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && get_bits1(gbc)) {
skip_bits(gbc, 10); // skip converter snr offset
}
/* coupling leak information */
- if(cpl_in_use)
- {
- if(s->first_cpl_leak || get_bits1(gbc))
- {
+ if (cpl_in_use) {
+ if (s->first_cpl_leak || get_bits1(gbc)) {
int fl = get_bits(gbc, 3);
int sl = get_bits(gbc, 3);
/* run last 2 bit allocation stages for coupling channel if
coupling leak changes */
if(blk && (fl != s->bit_alloc_params.cpl_fast_leak ||
- sl != s->bit_alloc_params.cpl_slow_leak))
- {
+ sl != s->bit_alloc_params.cpl_slow_leak)) {
bit_alloc_stages[CPL_CH] = FFMAX(bit_alloc_stages[CPL_CH], 2);
}
s->bit_alloc_params.cpl_fast_leak = fl;
s->bit_alloc_params.cpl_slow_leak = sl;
- }
- else if(!s->eac3 && !blk)
- {
+ } else if (!s->eac3 && !blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must be present in block 0\n");
return -1;
}
@@ -1345,27 +1165,21 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
/* delta bit allocation information */
- if(s->dba_syntax && get_bits1(gbc))
- {
+ if (s->dba_syntax && get_bits1(gbc)) {
/* delta bit allocation exists (strategy) */
- for(ch = !cpl_in_use; ch <= fbw_channels; ch++)
- {
+ for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
s->dba_mode[ch] = get_bits(gbc, 2);
- if(s->dba_mode[ch] == DBA_RESERVED)
- {
+ if (s->dba_mode[ch] == DBA_RESERVED) {
av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
return -1;
}
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
}
/* channel delta offset, len and bit allocation */
- for(ch = !cpl_in_use; ch <= fbw_channels; ch++)
- {
- if(s->dba_mode[ch] == DBA_NEW)
- {
+ for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
+ if (s->dba_mode[ch] == DBA_NEW) {
s->dba_nsegs[ch] = get_bits(gbc, 3);
- for(seg = 0; seg <= s->dba_nsegs[ch]; seg++)
- {
+ for (seg = 0; seg <= s->dba_nsegs[ch]; seg++) {
s->dba_offsets[ch][seg] = get_bits(gbc, 5);
s->dba_lengths[ch][seg] = get_bits(gbc, 4);
s->dba_values[ch][seg] = get_bits(gbc, 3);
@@ -1374,42 +1188,34 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
}
}
- }
- else if(blk == 0)
- {
- for(ch = 0; ch <= s->channels; ch++)
- {
+ } else if(blk == 0) {
+ for(ch=0; ch<=s->channels; ch++) {
s->dba_mode[ch] = DBA_NONE;
}
}
/* Bit allocation */
- for(ch = !cpl_in_use; ch <= s->channels; ch++)
- {
- if(bit_alloc_stages[ch] > 2)
- {
+ for(ch=!cpl_in_use; ch<=s->channels; ch++) {
+ if(bit_alloc_stages[ch] > 2) {
/* Exponent mapping into PSD and PSD integration */
ff_ac3_bit_alloc_calc_psd(s->dexps[ch],
s->start_freq[ch], s->end_freq[ch],
s->psd[ch], s->band_psd[ch]);
}
- if(bit_alloc_stages[ch] > 1)
- {
+ if(bit_alloc_stages[ch] > 1) {
/* Compute excitation function, Compute masking curve, and
Apply delta bit allocation */
- if(ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params, s->band_psd[ch],
- s->start_freq[ch], s->end_freq[ch],
- s->fast_gain[ch], (ch == s->lfe_ch),
- s->dba_mode[ch], s->dba_nsegs[ch],
- s->dba_offsets[ch], s->dba_lengths[ch],
- s->dba_values[ch], s->mask[ch]))
- {
+ if (ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params, s->band_psd[ch],
+ s->start_freq[ch], s->end_freq[ch],
+ s->fast_gain[ch], (ch == s->lfe_ch),
+ s->dba_mode[ch], s->dba_nsegs[ch],
+ s->dba_offsets[ch], s->dba_lengths[ch],
+ s->dba_values[ch], s->mask[ch])) {
av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n");
return -1;
}
}
- if(bit_alloc_stages[ch] > 0)
- {
+ if(bit_alloc_stages[ch] > 0) {
/* Compute bit allocation */
const uint8_t *bap_tab = s->channel_uses_aht[ch] ?
ff_eac3_hebap_tab : ff_ac3_bap_tab;
@@ -1422,8 +1228,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
/* unused dummy data */
- if(s->skip_syntax && get_bits1(gbc))
- {
+ if (s->skip_syntax && get_bits1(gbc)) {
int skipl = get_bits(gbc, 9);
while(skipl--)
skip_bits(gbc, 8);
@@ -1440,22 +1245,18 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
do_rematrixing(s);
/* apply scaling to coefficients (headroom, dynrng) */
- for(ch = 1; ch <= s->channels; ch++)
- {
+ for(ch=1; ch<=s->channels; ch++) {
float gain = s->mul_bias / 4194304.0f;
- if(s->channel_mode == AC3_CHMODE_DUALMONO)
- {
+ if(s->channel_mode == AC3_CHMODE_DUALMONO) {
gain *= s->dynamic_range[2-ch];
- }
- else
- {
+ } else {
gain *= s->dynamic_range[0];
}
s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256);
}
/* apply spectral extension to high frequency bins */
- if(s->spx_in_use)
+ if (s->spx_in_use)
ff_eac3_apply_spectral_extension(s);
/* downmix and MDCT. order depends on whether block switching is used for
@@ -1463,33 +1264,26 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
and short transforms cannot be mixed. */
downmix_output = s->channels != s->out_channels &&
!((s->output_mode & AC3_OUTPUT_LFEON) &&
- s->fbw_channels == s->out_channels);
- if(different_transforms)
- {
+ s->fbw_channels == s->out_channels);
+ if(different_transforms) {
/* the delay samples have already been downmixed, so we upmix the delay
samples in order to reconstruct all channels before downmixing. */
- if(s->downmixed)
- {
+ if(s->downmixed) {
s->downmixed = 0;
ac3_upmix_delay(s);
}
do_imdct(s, s->channels);
- if(downmix_output)
- {
+ if(downmix_output) {
s->dsp.ac3_downmix(s->output, 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);
+ } else {
+ if(downmix_output) {
+ s->dsp.ac3_downmix(s->transform_coeffs+1, s->downmix_coeffs, s->out_channels, s->fbw_channels, 256);
}
- if(downmix_output && !s->downmixed)
- {
+ if(downmix_output && !s->downmixed) {
s->downmixed = 1;
s->dsp.ac3_downmix(s->delay, s->downmix_coeffs, s->out_channels, s->fbw_channels, 128);
}
@@ -1513,15 +1307,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
const float *output[AC3_MAX_CHANNELS];
/* initialize the GetBitContext with the start of valid AC-3 Frame */
- if(s->input_buffer)
- {
+ if (s->input_buffer) {
/* copy input buffer to decoder context to avoid reading past the end
of the buffer, which can be caused by a damaged input stream. */
memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
init_get_bits(&s->gbc, s->input_buffer, buf_size * 8);
- }
- else
- {
+ } else {
init_get_bits(&s->gbc, buf, buf_size * 8);
}
@@ -1530,60 +1321,51 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
err = parse_frame_header(s);
/* check that reported frame size fits in input buffer */
- if(!err && s->frame_size > buf_size)
- {
+ if(!err && s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
err = AAC_AC3_PARSE_ERROR_FRAME_SIZE;
}
/* check for crc mismatch */
- if(err != AAC_AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_recognition >= FF_ER_CAREFUL)
- {
- if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size - 2))
- {
+ if(err != AAC_AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_recognition >= FF_ER_CAREFUL) {
+ if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
err = AAC_AC3_PARSE_ERROR_CRC;
}
}
- if(err && err != AAC_AC3_PARSE_ERROR_CRC)
- {
- switch(err)
- {
- case AAC_AC3_PARSE_ERROR_SYNC:
- av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
- return -1;
- case AAC_AC3_PARSE_ERROR_BSID:
- av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
- break;
- case AAC_AC3_PARSE_ERROR_SAMPLE_RATE:
- av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
- break;
- case AAC_AC3_PARSE_ERROR_FRAME_SIZE:
- av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
- break;
- case AAC_AC3_PARSE_ERROR_FRAME_TYPE:
- /* skip frame if CRC is ok. otherwise use error concealment. */
- /* TODO: add support for substreams and dependent frames */
- if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid)
- {
- av_log(avctx, AV_LOG_ERROR, "unsupported frame type : skipping frame\n");
- return s->frame_size;
- }
- else
- {
- av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
- }
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "invalid header\n");
- break;
+ if(err && err != AAC_AC3_PARSE_ERROR_CRC) {
+ switch(err) {
+ case AAC_AC3_PARSE_ERROR_SYNC:
+ av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
+ return -1;
+ case AAC_AC3_PARSE_ERROR_BSID:
+ av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
+ break;
+ case AAC_AC3_PARSE_ERROR_SAMPLE_RATE:
+ av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
+ break;
+ case AAC_AC3_PARSE_ERROR_FRAME_SIZE:
+ av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
+ break;
+ case AAC_AC3_PARSE_ERROR_FRAME_TYPE:
+ /* skip frame if CRC is ok. otherwise use error concealment. */
+ /* TODO: add support for substreams and dependent frames */
+ if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
+ av_log(avctx, AV_LOG_ERROR, "unsupported frame type : skipping frame\n");
+ return s->frame_size;
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
+ }
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "invalid header\n");
+ break;
}
}
/* if frame is ok, set audio parameters */
- if(!err)
- {
+ if (!err) {
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
@@ -1592,9 +1374,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
s->output_mode = s->channel_mode;
if(s->lfe_on)
s->output_mode |= AC3_OUTPUT_LFEON;
- if(avctx->request_channels > 0 && avctx->request_channels <= 2 &&
- avctx->request_channels < s->channels)
- {
+ if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
+ avctx->request_channels < s->channels) {
s->out_channels = avctx->request_channels;
s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
s->channel_layout = ff_ac3_channel_layout_tab[s->output_mode];
@@ -1604,13 +1385,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
/* set downmixing coefficients if needed */
if(s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) &&
- s->fbw_channels == s->out_channels))
- {
+ s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s);
}
- }
- else if(!s->out_channels)
- {
+ } 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;
@@ -1618,19 +1396,17 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
/* 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++)
+ for (ch = 0; ch < s->out_channels; ch++)
output[ch] = s->output[channel_map[ch]];
- for(blk = 0; blk < s->num_blocks; blk++)
- {
- if(!err && decode_audio_block(s, blk))
- {
+ 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;
}
s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
out_samples += 256 * s->out_channels;
}
- *data_size = s->num_blocks * 256 * avctx->channels * sizeof(int16_t);
+ *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
return s->frame_size;
}
@@ -1648,12 +1424,11 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx)
return 0;
}
-AVCodec ac3_decoder =
-{
+AVCodec ac3_decoder = {
/*.name = */"ac3",
/*.type = */CODEC_TYPE_AUDIO,
/*.id = */CODEC_ID_AC3,
- /*.priv_data_size = */sizeof(AC3DecodeContext),
+ /*.priv_data_size = */sizeof (AC3DecodeContext),
/*.init = */ac3_decode_init,
/*.encode = */NULL,
/*.close = */ac3_decode_end,
@@ -1667,12 +1442,11 @@ AVCodec ac3_decoder =
};
#if CONFIG_EAC3_DECODER
-AVCodec eac3_decoder =
-{
+AVCodec eac3_decoder = {
/*.name = */"eac3",
/*.type = */CODEC_TYPE_AUDIO,
/*.id = */CODEC_ID_EAC3,
- /*.priv_data_size = */sizeof(AC3DecodeContext),
+ /*.priv_data_size = */sizeof (AC3DecodeContext),
/*.init = */ac3_decode_init,
/*.encode = */NULL,
/*.close = */ac3_decode_end,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.h
index cf221c8fc..e982d4aca 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec.h
@@ -44,8 +44,7 @@
#define MAX_BLOCKS 6
#define SPX_MAX_BANDS 17
-typedef struct
-{
+typedef struct {
AVCodecContext *avctx; ///< parent context
GetBitContext gbc; ///< bitstream reader
uint8_t *input_buffer; ///< temp buffer to prevent overread
@@ -75,7 +74,7 @@ typedef struct
int fast_gain_syntax; ///< fast gain codes enabled (frmfgaincode)
int dba_syntax; ///< delta bit allocation syntax enabled (dbaflde)
int skip_syntax; ///< skip field syntax enabled (skipflde)
-///@}
+ ///@}
///@defgroup cpl standard coupling
int cpl_in_use[MAX_BLOCKS]; ///< coupling in use (cplinu)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c
index 03f4da888..57bed8de6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c
@@ -32,8 +32,7 @@
* Used by bap=1 mantissas and GAQ.
* ff_ac3_ungroup_3_in_5_bits_tab[i] = { i/9, (i%9)/3, (i%9)%3 }
*/
-const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] =
-{
+const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] = {
{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 1, 0 },
{ 0, 1, 1 }, { 0, 1, 2 }, { 0, 2, 0 }, { 0, 2, 1 },
{ 0, 2, 2 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 0, 2 },
@@ -50,8 +49,7 @@ const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] =
*/
const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 };
-const uint8_t ff_eac3_hebap_tab[64] =
-{
+const uint8_t ff_eac3_hebap_tab[64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8,
8, 8, 9, 9, 9, 10, 10, 10, 10, 11,
11, 11, 11, 12, 12, 12, 12, 13, 13, 13,
@@ -77,8 +75,7 @@ const uint8_t ff_eac3_default_spx_band_struct[17] =
* Table E.25: Spectral Extension Attenuation Table
* ff_eac3_spx_atten_tab[code][bin]=pow(2.0,(bin+1)*(code+1)/-15.0);
*/
-const float ff_eac3_spx_atten_tab[32][3] =
-{
+const float ff_eac3_spx_atten_tab[32][3] = {
{ 0.954841603910416503f, 0.911722488558216804f, 0.870550563296124125f },
{ 0.911722488558216804f, 0.831237896142787758f, 0.757858283255198995f },
{ 0.870550563296124125f, 0.757858283255198995f, 0.659753955386447100f },
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c
index bbf5869e1..0ee330589 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c
@@ -31,8 +31,7 @@
* Possible frame sizes.
* from ATSC A/52 Table 5.18 Frame Size Code Table.
*/
-const uint16_t ff_ac3_frame_size_tab[38][3] =
-{
+const uint16_t ff_ac3_frame_size_tab[38][3] = {
{ 64, 69, 96 },
{ 64, 70, 96 },
{ 80, 87, 120 },
@@ -77,16 +76,14 @@ const uint16_t ff_ac3_frame_size_tab[38][3] =
* Maps audio coding mode (acmod) to number of full-bandwidth channels.
* from ATSC A/52 Table 5.8 Audio Coding Mode
*/
-const uint8_t ff_ac3_channels_tab[8] =
-{
+const uint8_t ff_ac3_channels_tab[8] = {
2, 1, 2, 3, 3, 4, 4, 5
};
/**
* Maps audio coding mode (acmod) to channel layout mask.
*/
-const uint16_t ff_ac3_channel_layout_tab[8] =
-{
+const uint16_t ff_ac3_channel_layout_tab[8] = {
CH_LAYOUT_STEREO,
CH_LAYOUT_MONO,
CH_LAYOUT_STEREO,
@@ -109,8 +106,7 @@ const uint16_t ff_ac3_channel_layout_tab[8] =
* Table to remap channels from SMPTE order to AC-3 order.
* [channel_mode][lfe][ch]
*/
-const uint8_t ff_ac3_enc_channel_map[8][2][6] =
-{
+const uint8_t ff_ac3_enc_channel_map[8][2][6] = {
COMMON_CHANNEL_MAP
{ { 0, 1, 2, 3, }, { 0, 1, 3, 4, 2, } },
{ { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } },
@@ -120,8 +116,7 @@ const uint8_t ff_ac3_enc_channel_map[8][2][6] =
* Table to remap channels from from AC-3 order to SMPTE order.
* [channel_mode][lfe][ch]
*/
-const uint8_t ff_ac3_dec_channel_map[8][2][6] =
-{
+const uint8_t ff_ac3_dec_channel_map[8][2][6] = {
COMMON_CHANNEL_MAP
{ { 0, 1, 2, 3, }, { 0, 1, 4, 2, 3, } },
{ { 0, 2, 1, 3, 4, }, { 0, 2, 1, 5, 3, 4 } },
@@ -131,8 +126,7 @@ const uint8_t ff_ac3_dec_channel_map[8][2][6] =
const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
/* possible bitrates */
-const uint16_t ff_ac3_bitrate_tab[19] =
-{
+const uint16_t ff_ac3_bitrate_tab[19] = {
32, 40, 48, 56, 64, 80, 96, 112, 128,
160, 192, 224, 256, 320, 384, 448, 512, 576, 640
};
@@ -140,128 +134,124 @@ const uint16_t ff_ac3_bitrate_tab[19] =
/* AC-3 MDCT window */
/* MDCT window */
-const int16_t ff_ac3_window[256] =
-{
+const int16_t ff_ac3_window[256] = {
4, 7, 12, 16, 21, 28, 34, 42,
- 51, 61, 72, 84, 97, 111, 127, 145,
- 164, 184, 207, 231, 257, 285, 315, 347,
- 382, 419, 458, 500, 544, 591, 641, 694,
- 750, 810, 872, 937, 1007, 1079, 1155, 1235,
- 1318, 1406, 1497, 1593, 1692, 1796, 1903, 2016,
- 2132, 2253, 2379, 2509, 2644, 2783, 2927, 3076,
- 3230, 3389, 3552, 3721, 3894, 4072, 4255, 4444,
- 4637, 4835, 5038, 5246, 5459, 5677, 5899, 6127,
- 6359, 6596, 6837, 7083, 7334, 7589, 7848, 8112,
- 8380, 8652, 8927, 9207, 9491, 9778, 10069, 10363,
- 10660, 10960, 11264, 11570, 11879, 12190, 12504, 12820,
- 13138, 13458, 13780, 14103, 14427, 14753, 15079, 15407,
- 15735, 16063, 16392, 16720, 17049, 17377, 17705, 18032,
- 18358, 18683, 19007, 19330, 19651, 19970, 20287, 20602,
- 20914, 21225, 21532, 21837, 22139, 22438, 22733, 23025,
- 23314, 23599, 23880, 24157, 24430, 24699, 24964, 25225,
- 25481, 25732, 25979, 26221, 26459, 26691, 26919, 27142,
- 27359, 27572, 27780, 27983, 28180, 28373, 28560, 28742,
- 28919, 29091, 29258, 29420, 29577, 29729, 29876, 30018,
- 30155, 30288, 30415, 30538, 30657, 30771, 30880, 30985,
- 31086, 31182, 31274, 31363, 31447, 31528, 31605, 31678,
- 31747, 31814, 31877, 31936, 31993, 32046, 32097, 32145,
- 32190, 32232, 32272, 32310, 32345, 32378, 32409, 32438,
- 32465, 32490, 32513, 32535, 32556, 32574, 32592, 32608,
- 32623, 32636, 32649, 32661, 32671, 32681, 32690, 32698,
- 32705, 32712, 32718, 32724, 32729, 32733, 32737, 32741,
- 32744, 32747, 32750, 32752, 32754, 32756, 32757, 32759,
- 32760, 32761, 32762, 32763, 32764, 32764, 32765, 32765,
- 32766, 32766, 32766, 32766, 32767, 32767, 32767, 32767,
- 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
- 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+ 51, 61, 72, 84, 97, 111, 127, 145,
+ 164, 184, 207, 231, 257, 285, 315, 347,
+ 382, 419, 458, 500, 544, 591, 641, 694,
+ 750, 810, 872, 937, 1007, 1079, 1155, 1235,
+ 1318, 1406, 1497, 1593, 1692, 1796, 1903, 2016,
+ 2132, 2253, 2379, 2509, 2644, 2783, 2927, 3076,
+ 3230, 3389, 3552, 3721, 3894, 4072, 4255, 4444,
+ 4637, 4835, 5038, 5246, 5459, 5677, 5899, 6127,
+ 6359, 6596, 6837, 7083, 7334, 7589, 7848, 8112,
+ 8380, 8652, 8927, 9207, 9491, 9778,10069,10363,
+10660,10960,11264,11570,11879,12190,12504,12820,
+13138,13458,13780,14103,14427,14753,15079,15407,
+15735,16063,16392,16720,17049,17377,17705,18032,
+18358,18683,19007,19330,19651,19970,20287,20602,
+20914,21225,21532,21837,22139,22438,22733,23025,
+23314,23599,23880,24157,24430,24699,24964,25225,
+25481,25732,25979,26221,26459,26691,26919,27142,
+27359,27572,27780,27983,28180,28373,28560,28742,
+28919,29091,29258,29420,29577,29729,29876,30018,
+30155,30288,30415,30538,30657,30771,30880,30985,
+31086,31182,31274,31363,31447,31528,31605,31678,
+31747,31814,31877,31936,31993,32046,32097,32145,
+32190,32232,32272,32310,32345,32378,32409,32438,
+32465,32490,32513,32535,32556,32574,32592,32608,
+32623,32636,32649,32661,32671,32681,32690,32698,
+32705,32712,32718,32724,32729,32733,32737,32741,
+32744,32747,32750,32752,32754,32756,32757,32759,
+32760,32761,32762,32763,32764,32764,32765,32765,
+32766,32766,32766,32766,32767,32767,32767,32767,
+32767,32767,32767,32767,32767,32767,32767,32767,
+32767,32767,32767,32767,32767,32767,32767,32767,
};
-const uint8_t ff_ac3_log_add_tab[260] =
-{
- 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37,
- 0x36, 0x35, 0x34, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2f,
- 0x2e, 0x2d, 0x2c, 0x2c, 0x2b, 0x2a, 0x29, 0x29, 0x28, 0x27,
- 0x26, 0x26, 0x25, 0x24, 0x24, 0x23, 0x23, 0x22, 0x21, 0x21,
- 0x20, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1d, 0x1c, 0x1c, 0x1b,
- 0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17, 0x17, 0x16,
- 0x16, 0x15, 0x15, 0x15, 0x14, 0x14, 0x13, 0x13, 0x13, 0x12,
- 0x12, 0x12, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x0f, 0x0f,
- 0x0f, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a,
- 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05,
- 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 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, 0x00, 0x00,
+const uint8_t ff_ac3_log_add_tab[260]= {
+0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
+0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
+0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
+0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21,
+0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,
+0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16,
+0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12,
+0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f,
+0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,
+0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,
+0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
+0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06,
+0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
+0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04,
+0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,
+0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,
+0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
+0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,
+0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+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,0x00,0x00,
};
-const uint16_t ff_ac3_hearing_threshold_tab[50][3] =
-{
- { 0x04d0, 0x04f0, 0x0580 },
- { 0x04d0, 0x04f0, 0x0580 },
- { 0x0440, 0x0460, 0x04b0 },
- { 0x0400, 0x0410, 0x0450 },
- { 0x03e0, 0x03e0, 0x0420 },
- { 0x03c0, 0x03d0, 0x03f0 },
- { 0x03b0, 0x03c0, 0x03e0 },
- { 0x03b0, 0x03b0, 0x03d0 },
- { 0x03a0, 0x03b0, 0x03c0 },
- { 0x03a0, 0x03a0, 0x03b0 },
- { 0x03a0, 0x03a0, 0x03b0 },
- { 0x03a0, 0x03a0, 0x03b0 },
- { 0x03a0, 0x03a0, 0x03a0 },
- { 0x0390, 0x03a0, 0x03a0 },
- { 0x0390, 0x0390, 0x03a0 },
- { 0x0390, 0x0390, 0x03a0 },
- { 0x0380, 0x0390, 0x03a0 },
- { 0x0380, 0x0380, 0x03a0 },
- { 0x0370, 0x0380, 0x03a0 },
- { 0x0370, 0x0380, 0x03a0 },
- { 0x0360, 0x0370, 0x0390 },
- { 0x0360, 0x0370, 0x0390 },
- { 0x0350, 0x0360, 0x0390 },
- { 0x0350, 0x0360, 0x0390 },
- { 0x0340, 0x0350, 0x0380 },
- { 0x0340, 0x0350, 0x0380 },
- { 0x0330, 0x0340, 0x0380 },
- { 0x0320, 0x0340, 0x0370 },
- { 0x0310, 0x0320, 0x0360 },
- { 0x0300, 0x0310, 0x0350 },
- { 0x02f0, 0x0300, 0x0340 },
- { 0x02f0, 0x02f0, 0x0330 },
- { 0x02f0, 0x02f0, 0x0320 },
- { 0x02f0, 0x02f0, 0x0310 },
- { 0x0300, 0x02f0, 0x0300 },
- { 0x0310, 0x0300, 0x02f0 },
- { 0x0340, 0x0320, 0x02f0 },
- { 0x0390, 0x0350, 0x02f0 },
- { 0x03e0, 0x0390, 0x0300 },
- { 0x0420, 0x03e0, 0x0310 },
- { 0x0460, 0x0420, 0x0330 },
- { 0x0490, 0x0450, 0x0350 },
- { 0x04a0, 0x04a0, 0x03c0 },
- { 0x0460, 0x0490, 0x0410 },
- { 0x0440, 0x0460, 0x0470 },
- { 0x0440, 0x0440, 0x04a0 },
- { 0x0520, 0x0480, 0x0460 },
- { 0x0800, 0x0630, 0x0440 },
- { 0x0840, 0x0840, 0x0450 },
- { 0x0840, 0x0840, 0x04e0 },
+const uint16_t ff_ac3_hearing_threshold_tab[50][3]= {
+{ 0x04d0,0x04f0,0x0580 },
+{ 0x04d0,0x04f0,0x0580 },
+{ 0x0440,0x0460,0x04b0 },
+{ 0x0400,0x0410,0x0450 },
+{ 0x03e0,0x03e0,0x0420 },
+{ 0x03c0,0x03d0,0x03f0 },
+{ 0x03b0,0x03c0,0x03e0 },
+{ 0x03b0,0x03b0,0x03d0 },
+{ 0x03a0,0x03b0,0x03c0 },
+{ 0x03a0,0x03a0,0x03b0 },
+{ 0x03a0,0x03a0,0x03b0 },
+{ 0x03a0,0x03a0,0x03b0 },
+{ 0x03a0,0x03a0,0x03a0 },
+{ 0x0390,0x03a0,0x03a0 },
+{ 0x0390,0x0390,0x03a0 },
+{ 0x0390,0x0390,0x03a0 },
+{ 0x0380,0x0390,0x03a0 },
+{ 0x0380,0x0380,0x03a0 },
+{ 0x0370,0x0380,0x03a0 },
+{ 0x0370,0x0380,0x03a0 },
+{ 0x0360,0x0370,0x0390 },
+{ 0x0360,0x0370,0x0390 },
+{ 0x0350,0x0360,0x0390 },
+{ 0x0350,0x0360,0x0390 },
+{ 0x0340,0x0350,0x0380 },
+{ 0x0340,0x0350,0x0380 },
+{ 0x0330,0x0340,0x0380 },
+{ 0x0320,0x0340,0x0370 },
+{ 0x0310,0x0320,0x0360 },
+{ 0x0300,0x0310,0x0350 },
+{ 0x02f0,0x0300,0x0340 },
+{ 0x02f0,0x02f0,0x0330 },
+{ 0x02f0,0x02f0,0x0320 },
+{ 0x02f0,0x02f0,0x0310 },
+{ 0x0300,0x02f0,0x0300 },
+{ 0x0310,0x0300,0x02f0 },
+{ 0x0340,0x0320,0x02f0 },
+{ 0x0390,0x0350,0x02f0 },
+{ 0x03e0,0x0390,0x0300 },
+{ 0x0420,0x03e0,0x0310 },
+{ 0x0460,0x0420,0x0330 },
+{ 0x0490,0x0450,0x0350 },
+{ 0x04a0,0x04a0,0x03c0 },
+{ 0x0460,0x0490,0x0410 },
+{ 0x0440,0x0460,0x0470 },
+{ 0x0440,0x0440,0x04a0 },
+{ 0x0520,0x0480,0x0460 },
+{ 0x0800,0x0630,0x0440 },
+{ 0x0840,0x0840,0x0450 },
+{ 0x0840,0x0840,0x04e0 },
};
-const uint8_t ff_ac3_bap_tab[64] =
-{
+const uint8_t ff_ac3_bap_tab[64]= {
0, 1, 1, 1, 1, 1, 2, 2, 3, 3,
3, 4, 4, 5, 5, 6, 6, 6, 6, 7,
7, 7, 7, 8, 8, 8, 8, 9, 9, 9,
@@ -271,38 +261,31 @@ const uint8_t ff_ac3_bap_tab[64] =
15, 15, 15, 15,
};
-const uint8_t ff_ac3_slow_decay_tab[4] =
-{
+const uint8_t ff_ac3_slow_decay_tab[4]={
0x0f, 0x11, 0x13, 0x15,
};
-const uint8_t ff_ac3_fast_decay_tab[4] =
-{
+const uint8_t ff_ac3_fast_decay_tab[4]={
0x3f, 0x53, 0x67, 0x7b,
};
-const uint16_t ff_ac3_slow_gain_tab[4] =
-{
+const uint16_t ff_ac3_slow_gain_tab[4]= {
0x540, 0x4d8, 0x478, 0x410,
};
-const uint16_t ff_ac3_db_per_bit_tab[4] =
-{
+const uint16_t ff_ac3_db_per_bit_tab[4]= {
0x000, 0x700, 0x900, 0xb00,
};
-const int16_t ff_ac3_floor_tab[8] =
-{
+const int16_t ff_ac3_floor_tab[8]= {
0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800,
};
-const uint16_t ff_ac3_fast_gain_tab[8] =
-{
+const uint16_t ff_ac3_fast_gain_tab[8]= {
0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
};
-const uint8_t ff_ac3_critical_band_size_tab[50] =
-{
+const uint8_t ff_ac3_critical_band_size_tab[50]={
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
@@ -310,10 +293,9 @@ const uint8_t ff_ac3_critical_band_size_tab[50] =
/**
* Default channel map for a dependent substream defined by acmod
*/
-const uint16_t ff_eac3_default_chmap[8] =
-{
+const uint16_t ff_eac3_default_chmap[8] = {
AC3_CHMAP_L | AC3_CHMAP_R, // FIXME Ch1+Ch2
- AC3_CHMAP_C,
+ AC3_CHMAP_C,
AC3_CHMAP_L | AC3_CHMAP_R,
AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R,
AC3_CHMAP_L | AC3_CHMAP_R | AC3_CHMAP_C_SUR,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h
index b240649aa..d3880d0a2 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h
@@ -49,15 +49,14 @@ extern const uint16_t ff_eac3_default_chmap[8];
* Lc/Rc pair, Lrs/Rrs pair, Ts, Lsd/Rsd pair,
* Lw/Rw pair, Lvh/Rvh pair, Cvh, Reserved, LFE2
*/
-enum CustomChannelMapLocation
-{
- AC3_CHMAP_L = 1 << (15 - 0),
- AC3_CHMAP_C = 1 << (15 - 1),
- AC3_CHMAP_R = 1 << (15 - 2),
- AC3_CHMAP_L_SUR = 1 << (15 - 3),
- AC3_CHMAP_R_SUR = 1 << (15 - 4),
- AC3_CHMAP_C_SUR = 1 << (15 - 7),
- AC3_CHMAP_LFE = 1 << (15 - 15)
+enum CustomChannelMapLocation{
+ AC3_CHMAP_L= 1<<(15-0),
+ AC3_CHMAP_C= 1<<(15-1),
+ AC3_CHMAP_R= 1<<(15-2),
+ AC3_CHMAP_L_SUR= 1<<(15-3),
+ AC3_CHMAP_R_SUR = 1<<(15-4),
+ AC3_CHMAP_C_SUR= 1<<(15-7),
+ AC3_CHMAP_LFE = 1<<(15-15)
};
#endif /* AVCODEC_AC3TAB_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/adpcm.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/adpcm.c
index a5f965dba..365da9cbb 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/adpcm.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/adpcm.c
@@ -52,8 +52,7 @@
/* step_table[] and index_table[] are from the ADPCM reference source */
/* This is the index table: */
-static const int index_table[16] =
-{
+static const int index_table[16] = {
-1, -1, -1, -1, 2, 4, 6, 8,
-1, -1, -1, -1, 2, 4, 6, 8,
};
@@ -62,8 +61,7 @@ static const int index_table[16] =
* This is the step table. Note that many programs use slight deviations from
* this table, but such deviations are negligible:
*/
-static const int step_table[89] =
-{
+static const int step_table[89] = {
7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
@@ -77,65 +75,56 @@ static const int step_table[89] =
/* These are for MS-ADPCM */
/* AdaptationTable[], AdaptCoeff1[], and AdaptCoeff2[] are from libsndfile */
-static const int AdaptationTable[] =
-{
- 230, 230, 230, 230, 307, 409, 512, 614,
- 768, 614, 512, 409, 307, 230, 230, 230
+static const int AdaptationTable[] = {
+ 230, 230, 230, 230, 307, 409, 512, 614,
+ 768, 614, 512, 409, 307, 230, 230, 230
};
/** Divided by 4 to fit in 8-bit integers */
-static const uint8_t AdaptCoeff1[] =
-{
- 64, 128, 0, 48, 60, 115, 98
+static const uint8_t AdaptCoeff1[] = {
+ 64, 128, 0, 48, 60, 115, 98
};
/** Divided by 4 to fit in 8-bit integers */
-static const int8_t AdaptCoeff2[] =
-{
- 0, -64, 0, 16, 0, -52, -58
+static const int8_t AdaptCoeff2[] = {
+ 0, -64, 0, 16, 0, -52, -58
};
/* These are for CD-ROM XA ADPCM */
-static const int xa_adpcm_table[5][2] =
-{
- { 0, 0 },
- { 60, 0 },
- { 115, -52 },
- { 98, -55 },
- { 122, -60 }
+static const int xa_adpcm_table[5][2] = {
+ { 0, 0 },
+ { 60, 0 },
+ { 115, -52 },
+ { 98, -55 },
+ { 122, -60 }
};
-static const int ea_adpcm_table[] =
-{
+static const int ea_adpcm_table[] = {
0, 240, 460, 392, 0, 0, -208, -220, 0, 1,
3, 4, 7, 8, 10, 11, 0, -1, -3, -4
};
// padded to zero where table size is less then 16
-static const int swf_index_tables[4][16] =
-{
+static const int swf_index_tables[4][16] = {
/*2*/ { -1, 2 },
/*3*/ { -1, -1, 2, 4 },
/*4*/ { -1, -1, -1, -1, 2, 4, 6, 8 },
/*5*/ { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }
};
-static const int yamaha_indexscale[] =
-{
+static const int yamaha_indexscale[] = {
230, 230, 230, 230, 307, 409, 512, 614,
230, 230, 230, 230, 307, 409, 512, 614
};
-static const int yamaha_difflookup[] =
-{
+static const int yamaha_difflookup[] = {
1, 3, 5, 7, 9, 11, 13, 15,
-1, -3, -5, -7, -9, -11, -13, -15
};
/* end of tables */
-typedef struct ADPCMChannelStatus
-{
+typedef struct ADPCMChannelStatus {
int predictor;
short int step_index;
int step;
@@ -150,8 +139,7 @@ typedef struct ADPCMChannelStatus
int idelta;
} ADPCMChannelStatus;
-typedef struct ADPCMContext
-{
+typedef struct ADPCMContext {
ADPCMChannelStatus status[2];
} ADPCMContext;
@@ -160,19 +148,16 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
ADPCMContext *c = avctx->priv_data;
unsigned int max_channels = 2;
- if(avctx->channels > max_channels)
- {
+ if(avctx->channels > max_channels){
return -1;
}
- switch(avctx->codec->id)
- {
+ switch(avctx->codec->id) {
case CODEC_ID_ADPCM_CT:
c->status[0].step = c->status[1].step = 511;
break;
case CODEC_ID_ADPCM_IMA_WS:
- if(avctx->extradata && avctx->extradata_size == 2 * 4)
- {
+ if (avctx->extradata && avctx->extradata_size == 2 * 4) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
}
@@ -192,8 +177,8 @@ static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble,
step = step_table[c->step_index];
step_index = c->step_index + index_table[(unsigned)nibble];
- if(step_index < 0) step_index = 0;
- else if(step_index > 88) step_index = 88;
+ if (step_index < 0) step_index = 0;
+ else if (step_index > 88) step_index = 88;
sign = nibble & 8;
delta = nibble & 7;
@@ -202,7 +187,7 @@ static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble,
* quickly enough */
diff = ((2 * delta + 1) * step) >> shift;
predictor = c->predictor;
- if(sign) predictor -= diff;
+ if (sign) predictor -= diff;
else predictor += diff;
c->predictor = av_clip_int16(predictor);
@@ -216,12 +201,12 @@ static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
int predictor;
predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;
- predictor += (signed)((nibble & 0x08) ? (nibble - 0x10) : (nibble)) * c->idelta;
+ predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
c->sample2 = c->sample1;
c->sample1 = av_clip_int16(predictor);
c->idelta = (AdaptationTable[(int)nibble] * c->idelta) >> 8;
- if(c->idelta < 16) c->idelta = 16;
+ if (c->idelta < 16) c->idelta = 16;
return c->sample1;
}
@@ -251,17 +236,17 @@ static inline short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble
{
int sign, delta, diff;
- sign = nibble & (1 << (size - 1));
- delta = nibble & ((1 << (size - 1)) - 1);
+ sign = nibble & (1<<(size-1));
+ delta = nibble & ((1<<(size-1))-1);
diff = delta << (7 + c->step + shift);
/* clamp result */
- c->predictor = av_clip(c->predictor + (sign ? -diff : diff), -16384, 16256);
+ c->predictor = av_clip(c->predictor + (sign ? -diff : diff), -16384,16256);
/* calculate new step */
- if(delta >= (2 * size - 3) && c->step < 3)
+ if (delta >= (2*size - 3) && c->step < 3)
c->step++;
- else if(delta == 0 && c->step > 0)
+ else if (delta == 0 && c->step > 0)
c->step--;
return (short) c->predictor;
@@ -269,8 +254,7 @@ static inline short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble
static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned char nibble)
{
- if(!c->step)
- {
+ if(!c->step) {
c->predictor = 0;
c->step = 127;
}
@@ -283,15 +267,14 @@ static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned c
}
static void xa_decode(short *out, const unsigned char *in,
- ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
+ ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
{
int i, j;
- int shift, filter, f0, f1;
- int s_1, s_2;
- int d, s, t;
+ int shift,filter,f0,f1;
+ int s_1,s_2;
+ int d,s,t;
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
shift = 12 - (in[4+i*2] & 15);
filter = in[4+i*2] >> 4;
@@ -301,25 +284,23 @@ static void xa_decode(short *out, const unsigned char *in,
s_1 = left->sample1;
s_2 = left->sample2;
- for(j = 0; j < 28; j++)
- {
+ for(j=0;j<28;j++) {
d = in[16+i+j*4];
- t = (signed char)(d << 4)>>4;
- s = (t << shift) + ((s_1 * f0 + s_2 * f1 + 32) >> 6);
+ t = (signed char)(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;
}
- if(inc == 2) /* stereo */
- {
+ if (inc==2) { /* stereo */
left->sample1 = s_1;
left->sample2 = s_2;
s_1 = right->sample1;
s_2 = right->sample2;
- out = out + 1 - 28 * 2;
+ out = out + 1 - 28*2;
}
shift = 12 - (in[5+i*2] & 15);
@@ -328,26 +309,22 @@ static void xa_decode(short *out, const unsigned char *in,
f0 = xa_adpcm_table[filter][0];
f1 = xa_adpcm_table[filter][1];
- for(j = 0; j < 28; j++)
- {
+ for(j=0;j<28;j++) {
d = in[16+i+j*4];
t = (signed char)d >> 4;
- s = (t << shift) + ((s_1 * f0 + s_2 * f1 + 32) >> 6);
+ 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;
}
- if(inc == 2) /* stereo */
- {
+ if (inc==2) { /* stereo */
right->sample1 = s_1;
right->sample2 = s_2;
out -= 1;
- }
- else
- {
+ } else {
left->sample1 = s_1;
left->sample2 = s_2;
}
@@ -371,8 +348,8 @@ static void xa_decode(short *out, const unsigned char *in,
}
static int adpcm_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
ADPCMContext *c = avctx->priv_data;
ADPCMChannelStatus *cs;
@@ -398,28 +375,26 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
uint8_t shift_left, shift_right;
int count1, count2;
- if(!buf_size)
+ if (!buf_size)
return 0;
//should protect all 4bit ADPCM variants
//8 is needed for CODEC_ID_ADPCM_IMA_WAV with 2 channels
//
- if(*data_size / 4 < buf_size + 8)
+ if(*data_size/4 < buf_size + 8)
return -1;
samples = data;
- samples_end = samples + *data_size / 2;
- *data_size = 0;
+ samples_end= samples + *data_size/2;
+ *data_size= 0;
src = buf;
st = avctx->channels == 2 ? 1 : 0;
- switch(avctx->codec->id)
- {
+ switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_QT:
- n = buf_size - 2 * avctx->channels;
- for(channel = 0; channel < avctx->channels; channel++)
- {
+ n = buf_size - 2*avctx->channels;
+ for (channel = 0; channel < avctx->channels; channel++) {
cs = &(c->status[channel]);
/* (pppppp) (piiiiiii) */
@@ -436,8 +411,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
cs->step_index = (*src++) & 0x7F;
- if(cs->step_index > 88)
- {
+ if (cs->step_index > 88){
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
cs->step_index = 88;
}
@@ -446,8 +420,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
samples = (short*)data + channel;
- for(m = 32; n > 0 && m > 0; n--, m--) /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */
- {
+ for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */
*samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);
samples += avctx->channels;
*samples = adpcm_ima_expand_nibble(cs, src[0] >> 4 , 3);
@@ -455,84 +428,76 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
src ++;
}
}
- if(st)
+ if (st)
samples--;
break;
case CODEC_ID_ADPCM_IMA_WAV:
- if(avctx->block_align != 0 && buf_size > avctx->block_align)
+ if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
// samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1;
- for(i = 0; i < avctx->channels; i++)
- {
+ for(i=0; i<avctx->channels; i++){
cs = &(c->status[i]);
cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src);
cs->step_index = *src++;
- if(cs->step_index > 88)
- {
+ if (cs->step_index > 88){
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
cs->step_index = 88;
}
- if(*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); /* unused */
+ if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); /* unused */
}
- while(src < buf + buf_size)
- {
- for(m = 0; m < 4; m++)
- {
- for(i = 0; i <= st; i++)
+ while(src < buf + buf_size){
+ for(m=0; m<4; m++){
+ for(i=0; i<=st; i++)
*samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3);
- for(i = 0; i <= st; i++)
+ for(i=0; i<=st; i++)
*samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4 , 3);
src++;
}
- src += 4 * st;
+ src += 4*st;
}
break;
case CODEC_ID_ADPCM_4XM:
cs = &(c->status[0]);
- c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
- if(st)
- {
- c->status[1].predictor = (int16_t)bytestream_get_le16(&src);
+ c->status[0].predictor= (int16_t)bytestream_get_le16(&src);
+ if(st){
+ c->status[1].predictor= (int16_t)bytestream_get_le16(&src);
}
- c->status[0].step_index = (int16_t)bytestream_get_le16(&src);
- if(st)
- {
- c->status[1].step_index = (int16_t)bytestream_get_le16(&src);
+ c->status[0].step_index= (int16_t)bytestream_get_le16(&src);
+ if(st){
+ c->status[1].step_index= (int16_t)bytestream_get_le16(&src);
}
- if(cs->step_index < 0) cs->step_index = 0;
- if(cs->step_index > 88) cs->step_index = 88;
+ if (cs->step_index < 0) cs->step_index = 0;
+ if (cs->step_index > 88) cs->step_index = 88;
- m = (buf_size - (src - buf)) >> st;
- for(i = 0; i < m; i++)
- {
+ m= (buf_size - (src - buf))>>st;
+ for(i=0; i<m; i++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4);
- if(st)
+ if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4);
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4);
- if(st)
+ if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4);
}
- src += m << st;
+ src += m<<st;
break;
case CODEC_ID_ADPCM_MS:
- if(avctx->block_align != 0 && buf_size > avctx->block_align)
+ if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
n = buf_size - 7 * avctx->channels;
- if(n < 0)
+ if (n < 0)
return -1;
block_predictor[0] = av_clip(*src++, 0, 6);
block_predictor[1] = 0;
- if(st)
+ if (st)
block_predictor[1] = av_clip(*src++, 0, 6);
c->status[0].idelta = (int16_t)bytestream_get_le16(&src);
- if(st)
- {
+ if (st){
c->status[1].idelta = (int16_t)bytestream_get_le16(&src);
}
c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]];
@@ -541,60 +506,57 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]];
c->status[0].sample1 = bytestream_get_le16(&src);
- if(st) c->status[1].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);
+ if (st) c->status[1].sample2 = bytestream_get_le16(&src);
*samples++ = c->status[0].sample2;
- if(st) *samples++ = c->status[1].sample2;
+ if (st) *samples++ = c->status[1].sample2;
*samples++ = c->status[0].sample1;
- if(st) *samples++ = c->status[1].sample1;
- for(; n > 0; n--)
- {
- *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4);
+ if (st) *samples++ = c->status[1].sample1;
+ for(;n>0;n--) {
+ *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 );
*samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
src ++;
}
break;
case CODEC_ID_ADPCM_IMA_DK4:
- if(avctx->block_align != 0 && buf_size > avctx->block_align)
+ if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
c->status[0].step_index = *src++;
src++;
*samples++ = c->status[0].predictor;
- if(st)
- {
+ if (st) {
c->status[1].predictor = (int16_t)bytestream_get_le16(&src);
c->status[1].step_index = *src++;
src++;
*samples++ = c->status[1].predictor;
}
- while(src < buf + buf_size)
- {
+ while (src < buf + buf_size) {
/* take care of the top nibble (always left or mono channel) */
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- src[0] >> 4, 3);
+ src[0] >> 4, 3);
/* take care of the bottom nibble, which is right sample for
* stereo, or another mono sample */
- if(st)
+ if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1],
- src[0] & 0x0F, 3);
+ src[0] & 0x0F, 3);
else
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- src[0] & 0x0F, 3);
+ src[0] & 0x0F, 3);
src++;
}
break;
case CODEC_ID_ADPCM_IMA_DK3:
- if(avctx->block_align != 0 && buf_size > avctx->block_align)
+ if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
- if(buf_size + 16 > (samples_end - samples) * 3 / 8)
+ if(buf_size + 16 > (samples_end - samples)*3/8)
return -1;
c->status[0].predictor = (int16_t)AV_RL16(src + 10);
@@ -607,8 +569,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
/* the DK3_GET_NEXT_NIBBLE macro issues the break statement when
* the buffer is consumed */
- while(1)
- {
+ while (1) {
/* for this algorithm, c->status[0] is the sum channel and
* c->status[1] is the diff channel */
@@ -638,40 +599,34 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
break;
case CODEC_ID_ADPCM_IMA_WS:
/* no per-block initialization; just start decoding the data */
- while(src < buf + buf_size)
- {
+ while (src < buf + buf_size) {
- if(st)
- {
+ if (st) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- src[0] >> 4 , 3);
+ src[0] >> 4 , 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[1],
- src[0] & 0x0F, 3);
- }
- else
- {
+ src[0] & 0x0F, 3);
+ } else {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- src[0] >> 4 , 3);
+ src[0] >> 4 , 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- src[0] & 0x0F, 3);
+ src[0] & 0x0F, 3);
}
src++;
}
break;
case CODEC_ID_ADPCM_XA:
- while(buf_size >= 128)
- {
+ while (buf_size >= 128) {
xa_decode(samples, src, &c->status[0], &c->status[1],
- avctx->channels);
+ avctx->channels);
src += 128;
samples += 28 * 8;
buf_size -= 128;
}
break;
case CODEC_ID_ADPCM_EA:
- if(buf_size < 4 || AV_RL32(src) >= ((buf_size - 12) * 2))
- {
+ if (buf_size < 4 || AV_RL32(src) >= ((buf_size - 12) * 2)) {
src += buf_size;
break;
}
@@ -682,30 +637,28 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
current_right_sample = (int16_t)bytestream_get_le16(&src);
previous_right_sample = (int16_t)bytestream_get_le16(&src);
- for(count1 = 0; count1 < samples_in_chunk / 28; count1++)
- {
+ for (count1 = 0; count1 < samples_in_chunk/28;count1++) {
coeff1l = ea_adpcm_table[ *src >> 4 ];
- coeff2l = ea_adpcm_table[(*src >> 4) + 4];
+ coeff2l = ea_adpcm_table[(*src >> 4 ) + 4];
coeff1r = ea_adpcm_table[*src & 0x0F];
coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
src++;
- shift_left = (*src >> 4) + 8;
+ shift_left = (*src >> 4 ) + 8;
shift_right = (*src & 0x0F) + 8;
src++;
- for(count2 = 0; count2 < 28; count2++)
- {
+ for (count2 = 0; count2 < 28; count2++) {
next_left_sample = (int32_t)((*src & 0xF0) << 24) >> shift_left;
next_right_sample = (int32_t)((*src & 0x0F) << 28) >> shift_right;
src++;
next_left_sample = (next_left_sample +
- (current_left_sample * coeff1l) +
- (previous_left_sample * coeff2l) + 0x80) >> 8;
+ (current_left_sample * coeff1l) +
+ (previous_left_sample * coeff2l) + 0x80) >> 8;
next_right_sample = (next_right_sample +
- (current_right_sample * coeff1r) +
- (previous_right_sample * coeff2r) + 0x80) >> 8;
+ (current_right_sample * coeff1r) +
+ (previous_right_sample * coeff2r) + 0x80) >> 8;
previous_left_sample = current_left_sample;
current_left_sample = av_clip_int16(next_left_sample);
@@ -716,7 +669,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
}
}
- if(src - buf == buf_size - 2)
+ if (src - buf == buf_size - 2)
src += 2; // Skip terminating 0x0000
break;
@@ -725,41 +678,36 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
c->status[0].step_index = bytestream_get_le16(&src);
- if(avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
- src += 4;
+ if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
+ src+=4;
- while(src < buf + buf_size)
- {
+ while (src < buf + buf_size) {
char hi, lo;
lo = *src & 0x0F;
hi = *src >> 4;
- if(avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
+ if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
FFSWAP(char, hi, lo);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- lo, 3);
+ lo, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
- hi, 3);
+ hi, 3);
src++;
}
break;
case CODEC_ID_ADPCM_CT:
- while(src < buf + buf_size)
- {
- if(st)
- {
+ while (src < buf + buf_size) {
+ if (st) {
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
- src[0] >> 4);
+ src[0] >> 4);
*samples++ = adpcm_ct_expand_nibble(&c->status[1],
- src[0] & 0x0F);
- }
- else
- {
+ src[0] & 0x0F);
+ } else {
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
- src[0] >> 4);
+ src[0] >> 4);
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
- src[0] & 0x0F);
+ src[0] & 0x0F);
}
src++;
}
@@ -767,50 +715,41 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
case CODEC_ID_ADPCM_SBPRO_4:
case CODEC_ID_ADPCM_SBPRO_3:
case CODEC_ID_ADPCM_SBPRO_2:
- if(!c->status[0].step_index)
- {
+ if (!c->status[0].step_index) {
/* the first byte is a raw sample */
*samples++ = 128 * (*src++ - 0x80);
- if(st)
- *samples++ = 128 * (*src++ - 0x80);
+ if (st)
+ *samples++ = 128 * (*src++ - 0x80);
c->status[0].step_index = 1;
}
- if(avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4)
- {
- while(src < buf + buf_size)
- {
+ if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
+ while (src < buf + buf_size) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] >> 4, 4, 0);
+ src[0] >> 4, 4, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
- src[0] & 0x0F, 4, 0);
+ src[0] & 0x0F, 4, 0);
src++;
}
- }
- else if(avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3)
- {
- while(src < buf + buf_size && samples + 2 < samples_end)
- {
+ } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
+ while (src < buf + buf_size && samples + 2 < samples_end) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] >> 5 , 3, 0);
+ src[0] >> 5 , 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- (src[0] >> 2) & 0x07, 3, 0);
+ (src[0] >> 2) & 0x07, 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] & 0x03, 2, 0);
+ src[0] & 0x03, 2, 0);
src++;
}
- }
- else
- {
- while(src < buf + buf_size && samples + 3 < samples_end)
- {
+ } else {
+ while (src < buf + buf_size && samples + 3 < samples_end) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] >> 6 , 2, 2);
+ src[0] >> 6 , 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
- (src[0] >> 4) & 0x03, 2, 2);
+ (src[0] >> 4) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- (src[0] >> 2) & 0x03, 2, 2);
+ (src[0] >> 2) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
- src[0] & 0x03, 2, 2);
+ src[0] & 0x03, 2, 2);
src++;
}
}
@@ -820,48 +759,42 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
GetBitContext gb;
const int *table;
int k0, signmask, nb_bits, count;
- int size = buf_size * 8;
+ int size = buf_size*8;
init_get_bits(&gb, buf, size);
//read bits & initial values
- nb_bits = get_bits(&gb, 2) + 2;
+ 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);
+ 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++)
- {
+ 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++)
- {
+ for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
int i;
- for(i = 0; i < avctx->channels; i++)
- {
+ for (i = 0; i < avctx->channels; i++) {
// similar to IMA adpcm
int delta = get_bits(&gb, nb_bits);
int step = step_table[c->status[i].step_index];
long vpdiff = 0; // vpdiff = (delta+0.5)*step/4
int k = k0;
- do
- {
- if(delta & k)
+ do {
+ if (delta & k)
vpdiff += step;
step >>= 1;
k >>= 1;
- }
- while(k);
+ } while(k);
vpdiff += step;
- if(delta & signmask)
+ if (delta & signmask)
c->status[i].predictor -= vpdiff;
else
c->status[i].predictor += vpdiff;
@@ -872,8 +805,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
c->status[i].predictor = av_clip_int16(c->status[i].predictor);
*samples++ = c->status[i].predictor;
- if(samples >= samples_end)
- {
+ if (samples >= samples_end) {
av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
return -1;
}
@@ -884,21 +816,17 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
break;
}
case CODEC_ID_ADPCM_YAMAHA:
- while(src < buf + buf_size)
- {
- if(st)
- {
+ while (src < buf + buf_size) {
+ if (st) {
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
- src[0] & 0x0F);
+ src[0] & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[1],
- src[0] >> 4);
- }
- else
- {
+ src[0] >> 4 );
+ } else {
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
- src[0] & 0x0F);
+ src[0] & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
- src[0] >> 4);
+ src[0] >> 4 );
}
src++;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c
index 1d70c6fe9..b3a10e214 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c
@@ -42,13 +42,13 @@ void avcodec_register_all(void)
{
static int initialized;
- if(initialized)
+ if (initialized)
return;
initialized = 1;
/* video codecs */
//REGISTER_DECODER (AASC, aasc);
- REGISTER_DECODER(AMV, amv);
+ REGISTER_DECODER (AMV, amv);
//REGISTER_DECODER (ASV1, asv1);
//REGISTER_DECODER (ASV2, asv2);
//REGISTER_DECODER (AVS, avs);
@@ -61,13 +61,13 @@ void avcodec_register_all(void)
//REGISTER_DECODER (EIGHTBPS, eightbps);
//REGISTER_ENCDEC (FFV1, ffv1);
//REGISTER_ENCDEC (FFVHUFF, ffvhuff);
- REGISTER_DECODER(FLV, flv);
+ REGISTER_DECODER (FLV, flv);
//REGISTER_DECODER (FRAPS, fraps);
//REGISTER_ENCDEC (H261, h261);
- REGISTER_DECODER(H263, h263);
+ REGISTER_DECODER (H263, h263);
//REGISTER_DECODER (H263I, h263i);
//REGISTER_ENCODER (H263P, h263p);
- REGISTER_DECODER(H264, h264);
+ REGISTER_DECODER (H264, h264);
//REGISTER_ENCDEC (HUFFYUV, huffyuv);
//REGISTER_DECODER (INDEO2, indeo2);
//REGISTER_DECODER (INDEO3, indeo3);
@@ -77,12 +77,12 @@ void avcodec_register_all(void)
//REGISTER_ENCDEC (MJPEG, mjpeg);
//REGISTER_DECODER (MJPEGB, mjpegb);
//REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
- REGISTER_DECODER(MPEG2VIDEO, mpeg2video);
- REGISTER_DECODER(MPEG4, mpeg4);
+ REGISTER_DECODER (MPEG2VIDEO, mpeg2video);
+ REGISTER_DECODER (MPEG4, mpeg4);
//REGISTER_DECODER (MPEGVIDEO, mpegvideo);
- REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
- REGISTER_DECODER(MSMPEG4V2, msmpeg4v2);
- REGISTER_DECODER(MSMPEG4V3, msmpeg4v3);
+ REGISTER_DECODER (MSMPEG4V1, msmpeg4v1);
+ REGISTER_DECODER (MSMPEG4V2, msmpeg4v2);
+ REGISTER_DECODER (MSMPEG4V3, msmpeg4v3);
//REGISTER_DECODER (MSRLE, msrle);
//REGISTER_DECODER (MSVIDEO1, msvideo1);
//REGISTER_DECODER (MSZH, mszh);
@@ -90,28 +90,28 @@ void avcodec_register_all(void)
//REGISTER_DECODER (QPEG, qpeg);
//REGISTER_DECODER (QTRLE, qtrle);
//REGISTER_DECODER (RPZA, rpza);
- REGISTER_DECODER(RV10, rv10);
- REGISTER_DECODER(RV20, rv20);
- REGISTER_DECODER(RV30, rv30);
- REGISTER_DECODER(RV40, rv40);
+ REGISTER_DECODER (RV10, rv10);
+ REGISTER_DECODER (RV20, rv20);
+ REGISTER_DECODER (RV30, rv30);
+ REGISTER_DECODER (RV40, rv40);
//REGISTER_DECODER (SP5X, sp5x);
- REGISTER_DECODER(SVQ1, svq1);
- REGISTER_DECODER(SVQ3, svq3);
- REGISTER_DECODER(THEORA, theora);
+ REGISTER_DECODER (SVQ1, svq1);
+ REGISTER_DECODER (SVQ3, svq3);
+ REGISTER_DECODER (THEORA, theora);
//REGISTER_DECODER (TRUEMOTION1, truemotion1);
//REGISTER_DECODER (TRUEMOTION2, truemotion2);
//REGISTER_DECODER (TSCC, tscc);
//REGISTER_DECODER (ULTI, ulti);
- REGISTER_DECODER(VC1, vc1);
+ REGISTER_DECODER (VC1, vc1);
//REGISTER_DECODER (VCR1, vcr1);
- REGISTER_DECODER(VP3, vp3);
- REGISTER_DECODER(VP5, vp5);
- REGISTER_DECODER(VP6, vp6);
- REGISTER_DECODER(VP6A, vp6a);
- REGISTER_DECODER(VP6F, vp6f);
- REGISTER_DECODER(WMV1, wmv1);
- REGISTER_DECODER(WMV2, wmv2);
- REGISTER_DECODER(WMV3, wmv3);
+ REGISTER_DECODER (VP3, vp3);
+ REGISTER_DECODER (VP5, vp5);
+ REGISTER_DECODER (VP6, vp6);
+ REGISTER_DECODER (VP6A, vp6a);
+ REGISTER_DECODER (VP6F, vp6f);
+ REGISTER_DECODER (WMV1, wmv1);
+ REGISTER_DECODER (WMV2, wmv2);
+ REGISTER_DECODER (WMV3, wmv3);
//REGISTER_DECODER (WNV1, wnv1);
//REGISTER_DECODER (XL, xl);
//REGISTER_DECODER (ZLIB, zlib);
@@ -119,25 +119,25 @@ void avcodec_register_all(void)
/* audio codecs */
//REGISTER_DECODER (AAC, aac);
- REGISTER_DECODER(AC3, ac3);
+ REGISTER_DECODER (AC3, ac3);
//REGISTER_DECODER (ATRAC3, atrac3);
//REGISTER_DECODER (COOK, cook);
//REGISTER_DECODER (DCA, dca);
- REGISTER_DECODER(EAC3, eac3);
+ REGISTER_DECODER (EAC3, eac3);
//REGISTER_DECODER (FLAC, flac);
//REGISTER_DECODER (IMC, imc);
//REGISTER_DECODER (MACE3, mace3);
//REGISTER_DECODER (MACE6, mace6);
- REGISTER_DECODER(MLP, mlp);
+ REGISTER_DECODER (MLP, mlp);
//REGISTER_DECODER (MP1, mp1);
//REGISTER_DECODER (MP2, mp2);
//REGISTER_DECODER (MP3, mp3);
//REGISTER_DECODER (MSGSM, msgsm);
- REGISTER_DECODER(NELLYMOSER, nellymoser);
+ REGISTER_DECODER (NELLYMOSER, nellymoser);
//REGISTER_DECODER (QDM2, qdm2);
//REGISTER_DECODER (RA_144, ra_144);
//REGISTER_DECODER (RA_288, ra_288);
- REGISTER_DECODER(TRUEHD, truehd);
+ REGISTER_DECODER (TRUEHD, truehd);
//REGISTER_DECODER (TRUESPEECH, truespeech);
//REGISTER_DECODER (TTA, tta);
//REGISTER_DECODER (VORBIS, vorbis);
@@ -149,33 +149,33 @@ void avcodec_register_all(void)
//REGISTER_DECODER (PCM_MULAW,pcm_mulaw);
/* ADPCM codecs */
- REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
- REGISTER_DECODER(ADPCM_CT, adpcm_ct);
- REGISTER_DECODER(ADPCM_EA, adpcm_ea);
+ REGISTER_DECODER (ADPCM_4XM, adpcm_4xm);
+ REGISTER_DECODER (ADPCM_CT, adpcm_ct);
+ REGISTER_DECODER (ADPCM_EA, adpcm_ea);
//REGISTER_DECODER (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_QT, adpcm_ima_qt);
- REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
- REGISTER_DECODER(ADPCM_IMA_WAV, adpcm_ima_wav);
- REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
- REGISTER_DECODER(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_DECODER(ADPCM_SWF, adpcm_swf);
- REGISTER_DECODER(ADPCM_XA, adpcm_xa);
- REGISTER_DECODER(ADPCM_YAMAHA, adpcm_yamaha);
-
+ 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_QT, adpcm_ima_qt);
+ REGISTER_DECODER (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
+ REGISTER_DECODER (ADPCM_IMA_WAV, adpcm_ima_wav);
+ REGISTER_DECODER (ADPCM_IMA_WS, adpcm_ima_ws);
+ REGISTER_DECODER (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_DECODER (ADPCM_SWF, adpcm_swf);
+ REGISTER_DECODER (ADPCM_XA, adpcm_xa);
+ REGISTER_DECODER (ADPCM_YAMAHA, adpcm_yamaha);
+
/* external libraries */
- REGISTER_DECODER(LIBAMR_NB, libamr_nb);
+ REGISTER_DECODER (LIBAMR_NB, libamr_nb);
/* parsers */
//REGISTER_PARSER (AAC, aac);
- REGISTER_PARSER(AC3, ac3);
+ REGISTER_PARSER (AC3, ac3);
//REGISTER_PARSER (DCA, dca);
- REGISTER_PARSER(MLP, mlp);
- //REGISTER_PARSER (MPEGAUDIO, mpegaudio);
+ REGISTER_PARSER (MLP, mlp);
+ //REGISTER_PARSER (MPEGAUDIO, mpegaudio);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.c
index 5d058a1be..7b8dbfc93 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.c
@@ -39,15 +39,15 @@ typedef
struct
{
- int reset_flag_old; /* previous was homing frame */
+ int reset_flag_old; /* previous was homing frame */
- enum RXFrameType prev_ft; /* previous frame type */
- enum Mode prev_mode; /* previous mode */
- void *decoder_State; /* Points decoder state */
+ enum RXFrameType prev_ft; /* previous frame type */
+ enum Mode prev_mode; /* previous mode */
+ void *decoder_State; /* Points decoder state */
-} dec_interface_State;
+}dec_interface_State;
#ifdef ETSI
@@ -66,22 +66,21 @@ struct
* Returns:
* value
*/
-static Word16 Bin2Int(Word16 no_of_bits, Word16 *bitstream)
+static Word16 Bin2Int( Word16 no_of_bits, Word16 *bitstream )
{
- Word32 value, i, bit;
+ Word32 value, i, bit;
- value = 0;
+ value = 0;
- for(i = 0; i < no_of_bits; i++)
- {
- value = value << 1;
- bit = *bitstream++;
+ for ( i = 0; i < no_of_bits; i++ ) {
+ value = value << 1;
+ bit = *bitstream++;
- if(bit == 0x1)
- value = value + 1;
- }
- return(Word16)(value);
+ if ( bit == 0x1 )
+ value = value + 1;
+ }
+ return( Word16 )( value );
}
@@ -101,86 +100,76 @@ static Word16 Bin2Int(Word16 no_of_bits, Word16 *bitstream)
* Returns:
* void
*/
-static void Bits2Prm(enum Mode mode, Word16 bits[], Word16 prm[])
+static void Bits2Prm( enum Mode mode, Word16 bits[], Word16 prm[] )
{
- Word32 i;
+ Word32 i;
- switch(mode)
- {
- case MR122:
- for(i = 0; i < PRMNO_MR122; i++)
- {
- prm[i] = Bin2Int(bitno_MR122[i], bits);
+ switch ( mode ) {
+ case MR122:
+ for ( i = 0; i < PRMNO_MR122; i++ ) {
+ prm[i] = Bin2Int( bitno_MR122[i], bits );
bits += bitno_MR122[i];
- }
- break;
+ }
+ break;
- case MR102:
- for(i = 0; i < PRMNO_MR102; i++)
- {
- prm[i] = Bin2Int(bitno_MR102[i], bits);
+ case MR102:
+ for ( i = 0; i < PRMNO_MR102; i++ ) {
+ prm[i] = Bin2Int( bitno_MR102[i], bits );
bits += bitno_MR102[i];
- }
- break;
+ }
+ break;
- case MR795:
- for(i = 0; i < PRMNO_MR795; i++)
- {
- prm[i] = Bin2Int(bitno_MR795[i], bits);
+ case MR795:
+ for ( i = 0; i < PRMNO_MR795; i++ ) {
+ prm[i] = Bin2Int( bitno_MR795[i], bits );
bits += bitno_MR795[i];
- }
- break;
+ }
+ break;
- case MR74:
- for(i = 0; i < PRMNO_MR74; i++)
- {
- prm[i] = Bin2Int(bitno_MR74[i], bits);
+ case MR74:
+ for ( i = 0; i < PRMNO_MR74; i++ ) {
+ prm[i] = Bin2Int( bitno_MR74[i], bits );
bits += bitno_MR74[i];
- }
- break;
+ }
+ break;
- case MR67:
- for(i = 0; i < PRMNO_MR67; i++)
- {
- prm[i] = Bin2Int(bitno_MR67[i], bits);
+ case MR67:
+ for ( i = 0; i < PRMNO_MR67; i++ ) {
+ prm[i] = Bin2Int( bitno_MR67[i], bits );
bits += bitno_MR67[i];
- }
- break;
+ }
+ break;
- case MR59:
- for(i = 0; i < PRMNO_MR59; i++)
- {
- prm[i] = Bin2Int(bitno_MR59[i], bits);
+ case MR59:
+ for ( i = 0; i < PRMNO_MR59; i++ ) {
+ prm[i] = Bin2Int( bitno_MR59[i], bits );
bits += bitno_MR59[i];
- }
- break;
+ }
+ break;
- case MR515:
- for(i = 0; i < PRMNO_MR515; i++)
- {
- prm[i] = Bin2Int(bitno_MR515[i], bits);
+ case MR515:
+ for ( i = 0; i < PRMNO_MR515; i++ ) {
+ prm[i] = Bin2Int( bitno_MR515[i], bits );
bits += bitno_MR515[i];
- }
- break;
+ }
+ break;
- case MR475:
- for(i = 0; i < PRMNO_MR475; i++)
- {
- prm[i] = Bin2Int(bitno_MR475[i], bits);
+ case MR475:
+ for ( i = 0; i < PRMNO_MR475; i++ ) {
+ prm[i] = Bin2Int( bitno_MR475[i], bits );
bits += bitno_MR475[i];
- }
- break;
+ }
+ break;
- case MRDTX:
- for(i = 0; i < PRMNO_MRDTX; i++)
- {
- prm[i] = Bin2Int(bitno_MRDTX[i], bits);
+ case MRDTX:
+ for ( i = 0; i < PRMNO_MRDTX; i++ ) {
+ prm[i] = Bin2Int( bitno_MRDTX[i], bits );
bits += bitno_MRDTX[i];
- }
- break;
- }
- return;
+ }
+ break;
+ }
+ return;
}
#else
@@ -203,191 +192,172 @@ static void Bits2Prm(enum Mode mode, Word16 bits[], Word16 prm[])
* Returns:
* mode used mode
*/
-enum Mode DecoderMMS(Word16 *param, UWord8 *stream, enum RXFrameType
- *frame_type, enum Mode *speech_mode, Word16 *q_bit)
+enum Mode DecoderMMS( Word16 *param, UWord8 *stream, enum RXFrameType
+ *frame_type, enum Mode *speech_mode, Word16 *q_bit )
{
- enum Mode mode;
- Word32 j;
- Word16 *mask;
-
-
- memset(param, 0, PRMNO_MR122 << 1);
- *q_bit = 0x01 & (*stream >> 2);
- mode = 0x0F & (*stream >> 3);
- stream++;
-
- if(mode == MRDTX)
- {
- mask = order_MRDTX;
-
- for(j = 1; j < 36; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
-
- /* get SID type bit */
-
- *frame_type = RX_SID_FIRST;
- if(*stream & 0x80)
- *frame_type = RX_SID_UPDATE;
-
- /* since there is update, use it */
- /* *frame_type = RX_SID_UPDATE; */
-
- /* speech mode indicator */
- *speech_mode = (*stream >> 4) && 0x07;
-
- }
- else if(mode == 15)
- {
- *frame_type = RX_NO_DATA;
- }
- else if(mode == MR475)
- {
- mask = order_MR475;
-
- for(j = 1; j < 96; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR515)
- {
- mask = order_MR515;
-
- for(j = 1; j < 104; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR59)
- {
- mask = order_MR59;
-
- for(j = 1; j < 119; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR67)
- {
- mask = order_MR67;
-
- for(j = 1; j < 135; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR74)
- {
- mask = order_MR74;
-
- for(j = 1; j < 149; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR795)
- {
- mask = order_MR795;
-
- for(j = 1; j < 160; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR102)
- {
- mask = order_MR102;
-
- for(j = 1; j < 205; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR122)
- {
- mask = order_MR122;
-
- for(j = 1; j < 245; j++)
- {
- if(*stream & 0x80)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream <<= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else
- *frame_type = RX_SPEECH_BAD;
- return mode;
+ enum Mode mode;
+ Word32 j;
+ Word16 *mask;
+
+
+ memset( param, 0, PRMNO_MR122 <<1 );
+ *q_bit = 0x01 & (*stream >> 2);
+ mode = 0x0F & (*stream >> 3);
+ stream++;
+
+ if ( mode == MRDTX ) {
+ mask = order_MRDTX;
+
+ for ( j = 1; j < 36; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+
+ /* get SID type bit */
+
+ *frame_type = RX_SID_FIRST;
+ if (*stream & 0x80)
+ *frame_type = RX_SID_UPDATE;
+
+ /* since there is update, use it */
+ /* *frame_type = RX_SID_UPDATE; */
+
+ /* speech mode indicator */
+ *speech_mode = (*stream >> 4) && 0x07;
+
+ }
+ else if ( mode == 15 ) {
+ *frame_type = RX_NO_DATA;
+ }
+ else if ( mode == MR475 ) {
+ mask = order_MR475;
+
+ for ( j = 1; j < 96; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR515 ) {
+ mask = order_MR515;
+
+ for ( j = 1; j < 104; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR59 ) {
+ mask = order_MR59;
+
+ for ( j = 1; j < 119; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR67 ) {
+ mask = order_MR67;
+
+ for ( j = 1; j < 135; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR74 ) {
+ mask = order_MR74;
+
+ for ( j = 1; j < 149; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR795 ) {
+ mask = order_MR795;
+
+ for ( j = 1; j < 160; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR102 ) {
+ mask = order_MR102;
+
+ for ( j = 1; j < 205; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR122 ) {
+ mask = order_MR122;
+
+ for ( j = 1; j < 245; j++ ) {
+ if ( *stream & 0x80 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream <<= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else
+ *frame_type = RX_SPEECH_BAD;
+ return mode;
}
#else
@@ -408,190 +378,171 @@ enum Mode DecoderMMS(Word16 *param, UWord8 *stream, enum RXFrameType
* Returns:
* mode used mode
*/
-enum Mode Decoder3GPP(Word16 *param, UWord8 *stream, enum RXFrameType
- *frame_type, enum Mode *speech_mode)
+enum Mode Decoder3GPP( Word16 *param, UWord8 *stream, enum RXFrameType
+ *frame_type, enum Mode *speech_mode )
{
- enum Mode mode;
- Word32 j;
- Word16 *mask;
-
-
- memset(param, 0, PRMNO_MR122 << 1);
- mode = 0xF & *stream;
- *stream >>= 4;
-
- if(mode == MRDTX)
- {
- mask = order_MRDTX;
-
- for(j = 5; j < 40; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
-
- /* get SID type bit */
-
- *frame_type = RX_SID_FIRST;
- if(*stream)
- *frame_type = RX_SID_UPDATE;
-
- /* since there is update, use it */
- /* *frame_type = RX_SID_UPDATE; */
- stream++;
-
- /* speech mode indicator */
- *speech_mode = *stream;
- }
- else if(mode == 15)
- {
- *frame_type = RX_NO_DATA;
- }
- else if(mode == MR475)
- {
- mask = order_MR475;
-
- for(j = 5; j < 100; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR515)
- {
- mask = order_MR515;
-
- for(j = 5; j < 108; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR59)
- {
- mask = order_MR59;
-
- for(j = 5; j < 123; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR67)
- {
- mask = order_MR67;
-
- for(j = 5; j < 139; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR74)
- {
- mask = order_MR74;
-
- for(j = 5; j < 153; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR795)
- {
- mask = order_MR795;
-
- for(j = 5; j < 164; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR102)
- {
- mask = order_MR102;
-
- for(j = 5; j < 209; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else if(mode == MR122)
- {
- mask = order_MR122;
-
- for(j = 5; j < 249; j++)
- {
- if(*stream & 0x1)
- param[ * mask] = (short)(param[ * mask] + *(mask + 1));
- mask += 2;
-
- if(j % 8)
- *stream >>= 1;
- else
- stream++;
- }
- *frame_type = RX_SPEECH_GOOD;
- }
- else
- *frame_type = RX_SPEECH_BAD;
- return mode;
+ enum Mode mode;
+ Word32 j;
+ Word16 *mask;
+
+
+ memset( param, 0, PRMNO_MR122 <<1 );
+ mode = 0xF & *stream;
+ *stream >>= 4;
+
+ if ( mode == MRDTX ) {
+ mask = order_MRDTX;
+
+ for ( j = 5; j < 40; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+
+ /* get SID type bit */
+
+ *frame_type = RX_SID_FIRST;
+ if (*stream)
+ *frame_type = RX_SID_UPDATE;
+
+ /* since there is update, use it */
+ /* *frame_type = RX_SID_UPDATE; */
+ stream++;
+
+ /* speech mode indicator */
+ *speech_mode = *stream;
+ }
+ else if ( mode == 15 ) {
+ *frame_type = RX_NO_DATA;
+ }
+ else if ( mode == MR475 ) {
+ mask = order_MR475;
+
+ for ( j = 5; j < 100; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR515 ) {
+ mask = order_MR515;
+
+ for ( j = 5; j < 108; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR59 ) {
+ mask = order_MR59;
+
+ for ( j = 5; j < 123; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR67 ) {
+ mask = order_MR67;
+
+ for ( j = 5; j < 139; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR74 ) {
+ mask = order_MR74;
+
+ for ( j = 5; j < 153; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR795 ) {
+ mask = order_MR795;
+
+ for ( j = 5; j < 164; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR102 ) {
+ mask = order_MR102;
+
+ for ( j = 5; j < 209; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else if ( mode == MR122 ) {
+ mask = order_MR122;
+
+ for ( j = 5; j < 249; j++ ) {
+ if ( *stream & 0x1 )
+ param[ * mask] = ( short )( param[ * mask] + *( mask + 1 ) );
+ mask += 2;
+
+ if ( j % 8 )
+ *stream >>= 1;
+ else
+ stream++;
+ }
+ *frame_type = RX_SPEECH_GOOD;
+ }
+ else
+ *frame_type = RX_SPEECH_BAD;
+ return mode;
}
#endif
#endif
@@ -609,11 +560,11 @@ enum Mode Decoder3GPP(Word16 *param, UWord8 *stream, enum RXFrameType
* Returns:
* void
*/
-void Decoder_Interface_reset(dec_interface_State *st)
+void Decoder_Interface_reset( dec_interface_State *st )
{
- st->reset_flag_old = 1;
- st->prev_ft = RX_SPEECH_GOOD;
- st->prev_mode = MR475; /* minimum bitrate */
+ st->reset_flag_old = 1;
+ st->prev_ft = RX_SPEECH_GOOD;
+ st->prev_mode = MR475; /* minimum bitrate */
}
@@ -631,27 +582,25 @@ void Decoder_Interface_reset(dec_interface_State *st)
* success : pointer to structure
* failure : NULL
*/
-void * Decoder_Interface_init(void)
+void * Decoder_Interface_init( void )
{
- dec_interface_State * s;
-
- /* allocate memory */
- if((s = (dec_interface_State *) malloc(sizeof(dec_interface_State))) ==
- NULL)
- {
- fprintf(stderr, "Decoder_Interface_init: "
- "can not malloc state structure\n");
- return NULL;
- }
- s->decoder_State = Speech_Decode_Frame_init();
-
- if(s->decoder_State == NULL)
- {
- free(s);
- return NULL;
- }
- Decoder_Interface_reset(s);
- return s;
+ dec_interface_State * s;
+
+ /* allocate memory */
+ if ( ( s = ( dec_interface_State * ) malloc( sizeof( dec_interface_State ) ) ) ==
+ NULL ) {
+ fprintf( stderr, "Decoder_Interface_init: "
+ "can not malloc state structure\n" );
+ return NULL;
+ }
+ s->decoder_State = Speech_Decode_Frame_init( );
+
+ if ( s->decoder_State == NULL ) {
+ free( s );
+ return NULL;
+ }
+ Decoder_Interface_reset( s );
+ return s;
}
@@ -668,16 +617,16 @@ void * Decoder_Interface_init(void)
* Returns:
* Void
*/
-void Decoder_Interface_exit(void *state)
+void Decoder_Interface_exit( void *state )
{
- dec_interface_State * s;
- s = (dec_interface_State *)state;
-
- /* free memory */
- Speech_Decode_Frame_exit(s->decoder_State);
- free(s);
- s = NULL;
- state = NULL;
+ dec_interface_State * s;
+ s = ( dec_interface_State * )state;
+
+ /* free memory */
+ Speech_Decode_Frame_exit(s->decoder_State );
+ free( s );
+ s = NULL;
+ state = NULL;
}
@@ -697,254 +646,235 @@ void Decoder_Interface_exit(void *state)
* Returns:
* Void
*/
-void Decoder_Interface_Decode(void *st,
+void Decoder_Interface_Decode( void *st,
#ifndef ETSI
- UWord8 *bits,
+ UWord8 *bits,
#else
- Word16 *bits,
+ Word16 *bits,
#endif
- Word16 *synth, int bfi)
+ Word16 *synth, int bfi)
{
- enum Mode mode; /* AMR mode */
+ enum Mode mode; /* AMR mode */
#ifndef ETSI
- enum Mode speech_mode = MR475; /* speech mode */
+ enum Mode speech_mode = MR475; /* speech mode */
#endif
- Word16 prm[PRMNO_MR122]; /* AMR parameters */
+ Word16 prm[PRMNO_MR122]; /* AMR parameters */
- enum RXFrameType frame_type; /* frame type */
- dec_interface_State * s; /* pointer to structure */
+ enum RXFrameType frame_type; /* frame type */
+ dec_interface_State * s; /* pointer to structure */
- const Word16 *homing; /* pointer to homing frame */
- Word16 homingSize; /* frame size for homing frame */
- Word32 i; /* counter */
- Word32 resetFlag = 1; /* homing frame */
+ const Word16 *homing; /* pointer to homing frame */
+ Word16 homingSize; /* frame size for homing frame */
+ Word32 i; /* counter */
+ Word32 resetFlag = 1; /* homing frame */
#ifndef ETSI
#ifndef IF2
- Word16 q_bit;
+ Word16 q_bit;
#endif
#endif
- s = (dec_interface_State *)st;
+ s = ( dec_interface_State * )st;
#ifndef ETSI
- /*
- * extract mode information and frametype,
- * octets to parameters
- */
+ /*
+ * extract mode information and frametype,
+ * octets to parameters
+ */
#ifdef IF2
- mode = Decoder3GPP(prm, bits, &frame_type, &speech_mode);
+ mode = Decoder3GPP( prm, bits, &frame_type, &speech_mode );
#else
- mode = DecoderMMS(prm, bits, &frame_type, &speech_mode, &q_bit);
- if(!bfi) bfi = 1 - q_bit;
+ mode = DecoderMMS( prm, bits, &frame_type, &speech_mode, &q_bit );
+ if (!bfi) bfi = 1 - q_bit;
#endif
- if(bfi == 1)
- {
- if(mode <= MR122)
- {
- frame_type = RX_SPEECH_BAD;
- }
- else if(frame_type != RX_NO_DATA)
- {
- frame_type = RX_SID_BAD;
- mode = s->prev_mode;
- }
- }
- else
- {
- if(frame_type == RX_SID_FIRST || frame_type == RX_SID_UPDATE)
- {
- mode = speech_mode;
- }
- else if(frame_type == RX_NO_DATA)
- {
- mode = s->prev_mode;
- }
- /*
- * if no mode information
- * guess one from the previous frame
- */
- if(frame_type == RX_SPEECH_BAD)
- {
- mode = s->prev_mode;
- if(s->prev_ft >= RX_SID_FIRST)
- {
- frame_type = RX_SID_BAD;
- }
- }
- }
+ if ( bfi == 1 ) {
+ if ( mode <= MR122 ) {
+ frame_type = RX_SPEECH_BAD;
+ }
+ else if ( frame_type != RX_NO_DATA ) {
+ frame_type = RX_SID_BAD;
+ mode = s->prev_mode;
+ }
+ } else {
+ if ( frame_type == RX_SID_FIRST || frame_type == RX_SID_UPDATE) {
+ mode = speech_mode;
+ }
+ else if ( frame_type == RX_NO_DATA ) {
+ mode = s->prev_mode;
+ }
+ /*
+ * if no mode information
+ * guess one from the previous frame
+ */
+ if ( frame_type == RX_SPEECH_BAD ) {
+ mode = s->prev_mode;
+ if ( s->prev_ft >= RX_SID_FIRST ) {
+ frame_type = RX_SID_BAD;
+ }
+ }
+ }
#else
- bfi = 0;
- frame_type = bits[0];
-
- switch(frame_type)
- {
- case 0:
- frame_type = RX_SPEECH_GOOD;
- mode = bits[245];
- Bits2Prm(mode, &bits[1], prm);
- break;
-
- case 1:
- frame_type = RX_SID_FIRST;
- mode = bits[245];
- break;
-
- case 2:
- frame_type = RX_SID_UPDATE;
- mode = bits[245];
- Bits2Prm(MRDTX, &bits[1], prm);
- break;
-
- case 3:
- frame_type = RX_NO_DATA;
- mode = s->prev_mode;
- break;
- }
+ bfi = 0;
+ frame_type = bits[0];
+
+ switch ( frame_type ) {
+ case 0:
+ frame_type = RX_SPEECH_GOOD;
+ mode = bits[245];
+ Bits2Prm( mode, &bits[1], prm );
+ break;
+
+ case 1:
+ frame_type = RX_SID_FIRST;
+ mode = bits[245];
+ break;
+
+ case 2:
+ frame_type = RX_SID_UPDATE;
+ mode = bits[245];
+ Bits2Prm( MRDTX, &bits[1], prm );
+ break;
+
+ case 3:
+ frame_type = RX_NO_DATA;
+ mode = s->prev_mode;
+ break;
+ }
#endif
- /* test for homing frame */
- if(s->reset_flag_old == 1)
- {
- switch(mode)
- {
- case MR122:
+ /* test for homing frame */
+ if ( s->reset_flag_old == 1 ) {
+ switch ( mode ) {
+ case MR122:
homing = dhf_MR122;
homingSize = 18;
break;
- case MR102:
+ case MR102:
homing = dhf_MR102;
homingSize = 12;
break;
- case MR795:
+ case MR795:
homing = dhf_MR795;
homingSize = 8;
break;
- case MR74:
+ case MR74:
homing = dhf_MR74;
homingSize = 7;
break;
- case MR67:
+ case MR67:
homing = dhf_MR67;
homingSize = 7;
break;
- case MR59:
+ case MR59:
homing = dhf_MR59;
homingSize = 7;
break;
- case MR515:
+ case MR515:
homing = dhf_MR515;
homingSize = 7;
break;
- case MR475:
+ case MR475:
homing = dhf_MR475;
homingSize = 7;
break;
- default:
+ default:
homing = NULL;
homingSize = 0;
break;
- }
-
- for(i = 0; i < homingSize; i++)
- {
- resetFlag = prm[i] ^ homing[i];
-
- if(resetFlag)
- break;
- }
- }
-
- if((resetFlag == 0) && (s->reset_flag_old != 0))
- {
- for(i = 0; i < 160; i++)
- {
- synth[i] = EHF_MASK;
- }
- }
- else
- Speech_Decode_Frame(s->decoder_State, mode, prm, frame_type, synth);
-
- if(s->reset_flag_old == 0)
- {
- /* check whole frame */
- switch(mode)
- {
- case MR122:
+ }
+
+ for ( i = 0; i < homingSize; i++ ) {
+ resetFlag = prm[i] ^ homing[i];
+
+ if ( resetFlag )
+ break;
+ }
+ }
+
+ if ( ( resetFlag == 0 ) && ( s->reset_flag_old != 0 ) ) {
+ for ( i = 0; i < 160; i++ ) {
+ synth[i] = EHF_MASK;
+ }
+ }
+ else
+ Speech_Decode_Frame( s->decoder_State, mode, prm, frame_type, synth );
+
+ if ( s->reset_flag_old == 0 ) {
+ /* check whole frame */
+ switch ( mode ) {
+ case MR122:
homing = dhf_MR122;
homingSize = PRMNO_MR122;
break;
- case MR102:
+ case MR102:
homing = dhf_MR102;
homingSize = PRMNO_MR102;
break;
- case MR795:
+ case MR795:
homing = dhf_MR795;
homingSize = PRMNO_MR795;
break;
- case MR74:
+ case MR74:
homing = dhf_MR74;
homingSize = PRMNO_MR74;
break;
- case MR67:
+ case MR67:
homing = dhf_MR67;
homingSize = PRMNO_MR67;
break;
- case MR59:
+ case MR59:
homing = dhf_MR59;
homingSize = PRMNO_MR59;
break;
- case MR515:
+ case MR515:
homing = dhf_MR515;
homingSize = PRMNO_MR515;
break;
- case MR475:
+ case MR475:
homing = dhf_MR475;
homingSize = PRMNO_MR475;
break;
- default:
+ default:
homing = NULL;
homingSize = 0;
- }
-
- for(i = 0; i < homingSize; i++)
- {
- resetFlag = prm[i] ^ homing[i];
-
- if(resetFlag)
- break;
- }
- }
-
- /* reset decoder if current frame is a homing frame */
- if(resetFlag == 0)
- {
- Speech_Decode_Frame_reset(s->decoder_State);
- }
- s->reset_flag_old = !resetFlag;
- s->prev_ft = frame_type;
- s->prev_mode = mode;
+ }
+
+ for ( i = 0; i < homingSize; i++ ) {
+ resetFlag = prm[i] ^ homing[i];
+
+ if ( resetFlag )
+ break;
+ }
+ }
+
+ /* reset decoder if current frame is a homing frame */
+ if ( resetFlag == 0 ) {
+ Speech_Decode_Frame_reset( s->decoder_State );
+ }
+ s->reset_flag_old = !resetFlag;
+ s->prev_ft = frame_type;
+ s->prev_mode = mode;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.h
index 95197e953..3f4653379 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_dec.h
@@ -30,26 +30,26 @@
* Conversion from packed bitstream to endoded parameters
* Decoding parameters to speech
*/
-void Decoder_Interface_Decode(void *st,
+void Decoder_Interface_Decode( void *st,
#ifndef ETSI
- unsigned char *bits,
+ unsigned char *bits,
#else
- short *bits,
+ short *bits,
#endif
- short *synth, int bfi);
+ short *synth, int bfi );
/*
* Reserve and init. memory
*/
-void *Decoder_Interface_init(void);
+void *Decoder_Interface_init( void );
/*
* Exit and free memory
*/
-void Decoder_Interface_exit(void *state);
+void Decoder_Interface_exit( void *state );
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_enc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_enc.h
index 2a2812ed3..6b89f9a8a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_enc.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_enc.h
@@ -35,24 +35,24 @@
* Encodes one frame of speech
* Returns packed octets
*/
-int Encoder_Interface_Encode(void *st, enum Mode mode, short *speech,
+int Encoder_Interface_Encode( void *st, enum Mode mode, short *speech,
#ifndef ETSI
- unsigned char *serial, /* max size 31 bytes */
+ unsigned char *serial, /* max size 31 bytes */
#else
- short *serial, /* size 500 bytes */
+ short *serial, /* size 500 bytes */
#endif
- int forceSpeech); /* use speech mode */
+ int forceSpeech ); /* use speech mode */
/*
* Reserve and init. memory
*/
-void *Encoder_Interface_init(int dtx);
+void *Encoder_Interface_init( int dtx );
/*
* Exit and free memory
*/
-void Encoder_Interface_exit(void *state);
+void Encoder_Interface_exit( void *state );
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_rom.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_rom.h
index 16cdf469a..349f9d4d0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_rom.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/interf_rom.h
@@ -50,1756 +50,1753 @@
*/
#ifndef IF2
#ifndef ETSI
-static const UWord8 block_size[16] = { 13, 14, 16, 18, 20, 21, 27, 32,
- 6 , 0 , 0 , 0 , 0 , 0 , 0 , 1
- };
+static const UWord8 block_size[16]={ 13, 14, 16, 18, 20, 21, 27, 32,
+ 6 , 0 , 0 , 0 , 0 , 0 , 0 , 1 };
-static const UWord8 toc_byte[16] = {0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
- 0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C
- };
+static const UWord8 toc_byte[16]={0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
+ 0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C};
#endif
#else
/* One encoded frame (bytes) */
-static const UWord8 block_size[16] = { 13, 14, 16, 18, 19, 21, 26, 31,
- 5 , 0 , 0 , 0 , 0 , 0 , 0 , 1
- };
+static const UWord8 block_size[16]={ 13, 14, 16, 18, 19, 21, 26, 31,
+ 5 , 0 , 0 , 0 , 0 , 0 , 0 , 1 };
#endif
/* Subjective importance of the speech encoded bits */
static Word16 order_MR475[] =
{
- 0, 0x80,
- 0, 0x40,
- 0, 0x20,
- 0, 0x10,
- 0, 0x8,
- 0, 0x4,
- 0, 0x2,
- 0, 0x1,
- 1, 0x80,
- 1, 0x40,
- 1, 0x20,
- 1, 0x10,
- 1, 0x8,
- 1, 0x4,
- 1, 0x2,
- 1, 0x1,
- 3, 0x80,
- 3, 0x40,
- 3, 0x20,
- 3, 0x10,
- 3, 0x8,
- 3, 0x4,
- 7, 0x8,
- 7, 0x4,
- 10, 0x8,
- 10, 0x4,
- 14, 0x8,
- 14, 0x4,
- 6, 0x1,
- 6, 0x2,
- 6, 0x4,
- 6, 0x8,
- 13, 0x1,
- 13, 0x2,
- 13, 0x4,
- 13, 0x8,
- 2, 0x20,
- 2, 0x10,
- 2, 0x4,
- 2, 0x1,
- 13, 0x10,
- 13, 0x20,
- 13, 0x40,
- 13, 0x80,
- 3, 0x2,
- 3, 0x1,
- 6, 0x10,
- 6, 0x20,
- 6, 0x40,
- 6, 0x80,
- 5, 0x2,
- 5, 0x1,
- 2, 0x40,
- 2, 0x8,
- 2, 0x2,
- 7, 0x2,
- 7, 0x1,
- 9, 0x2,
- 9, 0x1,
- 10, 0x2,
- 10, 0x1,
- 12, 0x2,
- 12, 0x1,
- 14, 0x2,
- 14, 0x1,
- 16, 0x2,
- 16, 0x1,
- 4, 0x20,
- 4, 0x10,
- 4, 0x4,
- 4, 0x2,
- 8, 0x20,
- 8, 0x10,
- 8, 0x4,
- 8, 0x2,
- 11, 0x20,
- 11, 0x10,
- 11, 0x4,
- 11, 0x2,
- 15, 0x20,
- 15, 0x10,
- 15, 0x4,
- 15, 0x2,
- 4, 0x8,
- 8, 0x8,
- 11, 0x8,
- 15, 0x8,
- 4, 0x1,
- 8, 0x1,
- 11, 0x1,
- 15, 0x1,
- 4, 0x40,
- 8, 0x40,
- 11, 0x40,
- 15, 0x40
+ 0, 0x80,
+ 0, 0x40,
+ 0, 0x20,
+ 0, 0x10,
+ 0, 0x8,
+ 0, 0x4,
+ 0, 0x2,
+ 0, 0x1,
+ 1, 0x80,
+ 1, 0x40,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x8,
+ 1, 0x4,
+ 1, 0x2,
+ 1, 0x1,
+ 3, 0x80,
+ 3, 0x40,
+ 3, 0x20,
+ 3, 0x10,
+ 3, 0x8,
+ 3, 0x4,
+ 7, 0x8,
+ 7, 0x4,
+ 10, 0x8,
+ 10, 0x4,
+ 14, 0x8,
+ 14, 0x4,
+ 6, 0x1,
+ 6, 0x2,
+ 6, 0x4,
+ 6, 0x8,
+ 13, 0x1,
+ 13, 0x2,
+ 13, 0x4,
+ 13, 0x8,
+ 2, 0x20,
+ 2, 0x10,
+ 2, 0x4,
+ 2, 0x1,
+ 13, 0x10,
+ 13, 0x20,
+ 13, 0x40,
+ 13, 0x80,
+ 3, 0x2,
+ 3, 0x1,
+ 6, 0x10,
+ 6, 0x20,
+ 6, 0x40,
+ 6, 0x80,
+ 5, 0x2,
+ 5, 0x1,
+ 2, 0x40,
+ 2, 0x8,
+ 2, 0x2,
+ 7, 0x2,
+ 7, 0x1,
+ 9, 0x2,
+ 9, 0x1,
+ 10, 0x2,
+ 10, 0x1,
+ 12, 0x2,
+ 12, 0x1,
+ 14, 0x2,
+ 14, 0x1,
+ 16, 0x2,
+ 16, 0x1,
+ 4, 0x20,
+ 4, 0x10,
+ 4, 0x4,
+ 4, 0x2,
+ 8, 0x20,
+ 8, 0x10,
+ 8, 0x4,
+ 8, 0x2,
+ 11, 0x20,
+ 11, 0x10,
+ 11, 0x4,
+ 11, 0x2,
+ 15, 0x20,
+ 15, 0x10,
+ 15, 0x4,
+ 15, 0x2,
+ 4, 0x8,
+ 8, 0x8,
+ 11, 0x8,
+ 15, 0x8,
+ 4, 0x1,
+ 8, 0x1,
+ 11, 0x1,
+ 15, 0x1,
+ 4, 0x40,
+ 8, 0x40,
+ 11, 0x40,
+ 15, 0x40
};
static Word16 order_MR515[] =
{
- 0, 0x1,
- 0, 0x2,
- 0, 0x4,
- 0, 0x8,
- 0, 0x10,
- 0, 0x20,
- 0, 0x40,
- 0, 0x80,
- 1, 0x1,
- 1, 0x2,
- 1, 0x4,
- 1, 0x8,
- 1, 0x10,
- 1, 0x20,
- 1, 0x40,
- 1, 0x80,
- 3, 0x80,
- 3, 0x40,
- 3, 0x20,
- 3, 0x10,
- 3, 0x8,
- 7, 0x8,
- 11, 0x8,
- 15, 0x8,
- 6, 0x1,
- 6, 0x2,
- 6, 0x4,
- 10, 0x1,
- 10, 0x2,
- 10, 0x4,
- 14, 0x1,
- 14, 0x2,
- 14, 0x4,
- 18, 0x1,
- 18, 0x2,
- 18, 0x4,
- 6, 0x8,
- 10, 0x8,
- 14, 0x8,
- 18, 0x8,
- 3, 0x4,
- 7, 0x4,
- 11, 0x4,
- 15, 0x4,
- 2, 0x10,
- 6, 0x10,
- 10, 0x10,
- 14, 0x10,
- 18, 0x10,
- 3, 0x2,
- 7, 0x2,
- 11, 0x2,
- 2, 0x20,
- 2, 0x4,
- 2, 0x1,
- 6, 0x20,
- 10, 0x20,
- 14, 0x20,
- 18, 0x20,
- 2, 0x2,
- 3, 0x1,
- 7, 0x1,
- 11, 0x1,
- 15, 0x2,
- 2, 0x8,
- 2, 0x40,
- 15, 0x1,
- 5, 0x1,
- 5, 0x2,
- 9, 0x1,
- 9, 0x2,
- 13, 0x1,
- 4, 0x4,
- 8, 0x4,
- 12, 0x4,
- 16, 0x4,
- 13, 0x2,
- 17, 0x1,
- 17, 0x2,
- 4, 0x2,
- 8, 0x2,
- 12, 0x2,
- 16, 0x2,
- 4, 0x20,
- 8, 0x20,
- 4, 0x10,
- 8, 0x10,
- 12, 0x20,
- 12, 0x10,
- 16, 0x20,
- 16, 0x10,
- 4, 0x40,
- 8, 0x40,
- 12, 0x40,
- 16, 0x40,
- 4, 0x1,
- 8, 0x1,
- 12, 0x1,
- 16, 0x1,
- 4, 0x8,
- 8, 0x8,
- 12, 0x8,
- 16, 0x8
+ 0, 0x1,
+ 0, 0x2,
+ 0, 0x4,
+ 0, 0x8,
+ 0, 0x10,
+ 0, 0x20,
+ 0, 0x40,
+ 0, 0x80,
+ 1, 0x1,
+ 1, 0x2,
+ 1, 0x4,
+ 1, 0x8,
+ 1, 0x10,
+ 1, 0x20,
+ 1, 0x40,
+ 1, 0x80,
+ 3, 0x80,
+ 3, 0x40,
+ 3, 0x20,
+ 3, 0x10,
+ 3, 0x8,
+ 7, 0x8,
+ 11, 0x8,
+ 15, 0x8,
+ 6, 0x1,
+ 6, 0x2,
+ 6, 0x4,
+ 10, 0x1,
+ 10, 0x2,
+ 10, 0x4,
+ 14, 0x1,
+ 14, 0x2,
+ 14, 0x4,
+ 18, 0x1,
+ 18, 0x2,
+ 18, 0x4,
+ 6, 0x8,
+ 10, 0x8,
+ 14, 0x8,
+ 18, 0x8,
+ 3, 0x4,
+ 7, 0x4,
+ 11, 0x4,
+ 15, 0x4,
+ 2, 0x10,
+ 6, 0x10,
+ 10, 0x10,
+ 14, 0x10,
+ 18, 0x10,
+ 3, 0x2,
+ 7, 0x2,
+ 11, 0x2,
+ 2, 0x20,
+ 2, 0x4,
+ 2, 0x1,
+ 6, 0x20,
+ 10, 0x20,
+ 14, 0x20,
+ 18, 0x20,
+ 2, 0x2,
+ 3, 0x1,
+ 7, 0x1,
+ 11, 0x1,
+ 15, 0x2,
+ 2, 0x8,
+ 2, 0x40,
+ 15, 0x1,
+ 5, 0x1,
+ 5, 0x2,
+ 9, 0x1,
+ 9, 0x2,
+ 13, 0x1,
+ 4, 0x4,
+ 8, 0x4,
+ 12, 0x4,
+ 16, 0x4,
+ 13, 0x2,
+ 17, 0x1,
+ 17, 0x2,
+ 4, 0x2,
+ 8, 0x2,
+ 12, 0x2,
+ 16, 0x2,
+ 4, 0x20,
+ 8, 0x20,
+ 4, 0x10,
+ 8, 0x10,
+ 12, 0x20,
+ 12, 0x10,
+ 16, 0x20,
+ 16, 0x10,
+ 4, 0x40,
+ 8, 0x40,
+ 12, 0x40,
+ 16, 0x40,
+ 4, 0x1,
+ 8, 0x1,
+ 12, 0x1,
+ 16, 0x1,
+ 4, 0x8,
+ 8, 0x8,
+ 12, 0x8,
+ 16, 0x8
};
static Word16 order_MR59[] =
{
- 0, 0x80,
- 0, 0x40,
- 0, 0x8,
- 0, 0x4,
- 0, 0x10,
- 0, 0x2,
- 0, 0x1,
- 0, 0x20,
- 1, 0x8,
- 1, 0x2,
- 1, 0x100,
- 1, 0x80,
- 1, 0x20,
- 1, 0x10,
- 1, 0x4,
- 1, 0x40,
- 1, 0x1,
- 3, 0x20,
- 11, 0x20,
- 3, 0x10,
- 11, 0x10,
- 3, 0x40,
- 11, 0x40,
- 3, 0x80,
- 11, 0x80,
- 3, 0x8,
- 11, 0x8,
- 7, 0x8,
- 15, 0x8,
- 6, 0x1,
- 10, 0x1,
- 14, 0x1,
- 18, 0x1,
- 3, 0x4,
- 11, 0x4,
- 7, 0x4,
- 15, 0x4,
- 6, 0x2,
- 10, 0x2,
- 14, 0x2,
- 18, 0x2,
- 7, 0x2,
- 15, 0x2,
- 3, 0x2,
- 11, 0x2,
- 3, 0x1,
- 11, 0x1,
- 6, 0x4,
- 10, 0x4,
- 14, 0x4,
- 18, 0x4,
- 6, 0x8,
- 10, 0x8,
- 14, 0x8,
- 18, 0x8,
- 6, 0x10,
- 10, 0x10,
- 14, 0x10,
- 18, 0x10,
- 2, 0x40,
- 2, 0x10,
- 2, 0x4,
- 2, 0x8,
- 2, 0x80,
- 2, 0x100,
- 2, 0x20,
- 2, 0x2,
- 17, 0x1,
- 5, 0x2,
- 13, 0x2,
- 17, 0x2,
- 9, 0x2,
- 9, 0x1,
- 5, 0x1,
- 13, 0x1,
- 2, 0x1,
- 6, 0x20,
- 10, 0x20,
- 14, 0x20,
- 18, 0x20,
- 7, 0x1,
- 15, 0x1,
- 4, 0x4,
- 8, 0x4,
- 12, 0x4,
- 16, 0x4,
- 4, 0x8,
- 8, 0x8,
- 12, 0x8,
- 16, 0x8,
- 4, 0x40,
- 8, 0x40,
- 12, 0x40,
- 16, 0x40,
- 4, 0x80,
- 8, 0x80,
- 12, 0x80,
- 16, 0x80,
- 4, 0x100,
- 8, 0x100,
- 12, 0x100,
- 16, 0x100,
- 4, 0x1,
- 8, 0x1,
- 12, 0x1,
- 16, 0x1,
- 4, 0x2,
- 8, 0x2,
- 12, 0x2,
- 16, 0x2,
- 4, 0x10,
- 8, 0x10,
- 12, 0x10,
- 16, 0x10,
- 4, 0x20,
- 8, 0x20,
- 12, 0x20,
- 16, 0x20
+ 0, 0x80,
+ 0, 0x40,
+ 0, 0x8,
+ 0, 0x4,
+ 0, 0x10,
+ 0, 0x2,
+ 0, 0x1,
+ 0, 0x20,
+ 1, 0x8,
+ 1, 0x2,
+ 1, 0x100,
+ 1, 0x80,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x4,
+ 1, 0x40,
+ 1, 0x1,
+ 3, 0x20,
+ 11, 0x20,
+ 3, 0x10,
+ 11, 0x10,
+ 3, 0x40,
+ 11, 0x40,
+ 3, 0x80,
+ 11, 0x80,
+ 3, 0x8,
+ 11, 0x8,
+ 7, 0x8,
+ 15, 0x8,
+ 6, 0x1,
+ 10, 0x1,
+ 14, 0x1,
+ 18, 0x1,
+ 3, 0x4,
+ 11, 0x4,
+ 7, 0x4,
+ 15, 0x4,
+ 6, 0x2,
+ 10, 0x2,
+ 14, 0x2,
+ 18, 0x2,
+ 7, 0x2,
+ 15, 0x2,
+ 3, 0x2,
+ 11, 0x2,
+ 3, 0x1,
+ 11, 0x1,
+ 6, 0x4,
+ 10, 0x4,
+ 14, 0x4,
+ 18, 0x4,
+ 6, 0x8,
+ 10, 0x8,
+ 14, 0x8,
+ 18, 0x8,
+ 6, 0x10,
+ 10, 0x10,
+ 14, 0x10,
+ 18, 0x10,
+ 2, 0x40,
+ 2, 0x10,
+ 2, 0x4,
+ 2, 0x8,
+ 2, 0x80,
+ 2, 0x100,
+ 2, 0x20,
+ 2, 0x2,
+ 17, 0x1,
+ 5, 0x2,
+ 13, 0x2,
+ 17, 0x2,
+ 9, 0x2,
+ 9, 0x1,
+ 5, 0x1,
+ 13, 0x1,
+ 2, 0x1,
+ 6, 0x20,
+ 10, 0x20,
+ 14, 0x20,
+ 18, 0x20,
+ 7, 0x1,
+ 15, 0x1,
+ 4, 0x4,
+ 8, 0x4,
+ 12, 0x4,
+ 16, 0x4,
+ 4, 0x8,
+ 8, 0x8,
+ 12, 0x8,
+ 16, 0x8,
+ 4, 0x40,
+ 8, 0x40,
+ 12, 0x40,
+ 16, 0x40,
+ 4, 0x80,
+ 8, 0x80,
+ 12, 0x80,
+ 16, 0x80,
+ 4, 0x100,
+ 8, 0x100,
+ 12, 0x100,
+ 16, 0x100,
+ 4, 0x1,
+ 8, 0x1,
+ 12, 0x1,
+ 16, 0x1,
+ 4, 0x2,
+ 8, 0x2,
+ 12, 0x2,
+ 16, 0x2,
+ 4, 0x10,
+ 8, 0x10,
+ 12, 0x10,
+ 16, 0x10,
+ 4, 0x20,
+ 8, 0x20,
+ 12, 0x20,
+ 16, 0x20
};
static Word16 order_MR67[] =
{
- 0, 0x80,
- 0, 0x40,
- 0, 0x8,
- 0, 0x10,
- 0, 0x4,
- 0, 0x2,
- 1, 0x8,
- 0, 0x1,
- 0, 0x20,
- 1, 0x100,
- 1, 0x80,
- 1, 0x20,
- 1, 0x2,
- 1, 0x10,
- 1, 0x4,
- 1, 0x40,
- 3, 0x20,
- 11, 0x20,
- 3, 0x10,
- 11, 0x10,
- 3, 0x40,
- 11, 0x40,
- 3, 0x80,
- 11, 0x80,
- 3, 0x8,
- 11, 0x8,
- 1, 0x1,
- 7, 0x8,
- 15, 0x8,
- 7, 0x4,
- 15, 0x4,
- 3, 0x4,
- 11, 0x4,
- 7, 0x2,
- 15, 0x2,
- 6, 0x40,
- 10, 0x40,
- 14, 0x40,
- 18, 0x40,
- 3, 0x2,
- 11, 0x2,
- 6, 0x8,
- 10, 0x8,
- 14, 0x8,
- 18, 0x8,
- 6, 0x4,
- 10, 0x4,
- 14, 0x4,
- 18, 0x4,
- 7, 0x1,
- 15, 0x1,
- 3, 0x1,
- 11, 0x1,
- 2, 0x40,
- 2, 0x4,
- 6, 0x2,
- 10, 0x2,
- 14, 0x2,
- 18, 0x2,
- 2, 0x10,
- 2, 0x8,
- 2, 0x80,
- 2, 0x100,
- 2, 0x20,
- 2, 0x2,
- 2, 0x1,
- 6, 0x10,
- 10, 0x10,
- 14, 0x10,
- 18, 0x10,
- 5, 0x1,
- 9, 0x1,
- 13, 0x1,
- 17, 0x1,
- 6, 0x1,
- 10, 0x1,
- 14, 0x1,
- 18, 0x1,
- 5, 0x2,
- 9, 0x2,
- 13, 0x2,
- 17, 0x2,
- 18, 0x20,
- 14, 0x20,
- 10, 0x20,
- 6, 0x20,
- 5, 0x4,
- 9, 0x4,
- 13, 0x4,
- 17, 0x4,
- 4, 0x4,
- 8, 0x4,
- 12, 0x4,
- 16, 0x4,
- 4, 0x20,
- 8, 0x20,
- 12, 0x20,
- 16, 0x20,
- 4, 0x40,
- 8, 0x40,
- 12, 0x40,
- 16, 0x40,
- 4, 0x200,
- 8, 0x200,
- 12, 0x200,
- 16, 0x200,
- 4, 0x400,
- 8, 0x400,
- 12, 0x400,
- 16, 0x400,
- 4, 0x1,
- 8, 0x1,
- 12, 0x1,
- 16, 0x1,
- 4, 0x2,
- 8, 0x2,
- 12, 0x2,
- 16, 0x2,
- 4, 0x8,
- 8, 0x8,
- 12, 0x8,
- 16, 0x8,
- 4, 0x10,
- 8, 0x10,
- 12, 0x10,
- 16, 0x10,
- 4, 0x80,
- 8, 0x80,
- 12, 0x80,
- 16, 0x80,
- 4, 0x100,
- 8, 0x100,
- 12, 0x100,
- 16, 0x100
+ 0, 0x80,
+ 0, 0x40,
+ 0, 0x8,
+ 0, 0x10,
+ 0, 0x4,
+ 0, 0x2,
+ 1, 0x8,
+ 0, 0x1,
+ 0, 0x20,
+ 1, 0x100,
+ 1, 0x80,
+ 1, 0x20,
+ 1, 0x2,
+ 1, 0x10,
+ 1, 0x4,
+ 1, 0x40,
+ 3, 0x20,
+ 11, 0x20,
+ 3, 0x10,
+ 11, 0x10,
+ 3, 0x40,
+ 11, 0x40,
+ 3, 0x80,
+ 11, 0x80,
+ 3, 0x8,
+ 11, 0x8,
+ 1, 0x1,
+ 7, 0x8,
+ 15, 0x8,
+ 7, 0x4,
+ 15, 0x4,
+ 3, 0x4,
+ 11, 0x4,
+ 7, 0x2,
+ 15, 0x2,
+ 6, 0x40,
+ 10, 0x40,
+ 14, 0x40,
+ 18, 0x40,
+ 3, 0x2,
+ 11, 0x2,
+ 6, 0x8,
+ 10, 0x8,
+ 14, 0x8,
+ 18, 0x8,
+ 6, 0x4,
+ 10, 0x4,
+ 14, 0x4,
+ 18, 0x4,
+ 7, 0x1,
+ 15, 0x1,
+ 3, 0x1,
+ 11, 0x1,
+ 2, 0x40,
+ 2, 0x4,
+ 6, 0x2,
+ 10, 0x2,
+ 14, 0x2,
+ 18, 0x2,
+ 2, 0x10,
+ 2, 0x8,
+ 2, 0x80,
+ 2, 0x100,
+ 2, 0x20,
+ 2, 0x2,
+ 2, 0x1,
+ 6, 0x10,
+ 10, 0x10,
+ 14, 0x10,
+ 18, 0x10,
+ 5, 0x1,
+ 9, 0x1,
+ 13, 0x1,
+ 17, 0x1,
+ 6, 0x1,
+ 10, 0x1,
+ 14, 0x1,
+ 18, 0x1,
+ 5, 0x2,
+ 9, 0x2,
+ 13, 0x2,
+ 17, 0x2,
+ 18, 0x20,
+ 14, 0x20,
+ 10, 0x20,
+ 6, 0x20,
+ 5, 0x4,
+ 9, 0x4,
+ 13, 0x4,
+ 17, 0x4,
+ 4, 0x4,
+ 8, 0x4,
+ 12, 0x4,
+ 16, 0x4,
+ 4, 0x20,
+ 8, 0x20,
+ 12, 0x20,
+ 16, 0x20,
+ 4, 0x40,
+ 8, 0x40,
+ 12, 0x40,
+ 16, 0x40,
+ 4, 0x200,
+ 8, 0x200,
+ 12, 0x200,
+ 16, 0x200,
+ 4, 0x400,
+ 8, 0x400,
+ 12, 0x400,
+ 16, 0x400,
+ 4, 0x1,
+ 8, 0x1,
+ 12, 0x1,
+ 16, 0x1,
+ 4, 0x2,
+ 8, 0x2,
+ 12, 0x2,
+ 16, 0x2,
+ 4, 0x8,
+ 8, 0x8,
+ 12, 0x8,
+ 16, 0x8,
+ 4, 0x10,
+ 8, 0x10,
+ 12, 0x10,
+ 16, 0x10,
+ 4, 0x80,
+ 8, 0x80,
+ 12, 0x80,
+ 16, 0x80,
+ 4, 0x100,
+ 8, 0x100,
+ 12, 0x100,
+ 16, 0x100
};
static Word16 order_MR74[] =
{
- 0, 0x80,
- 0, 0x40,
- 0, 0x20,
- 0, 0x10,
- 0, 0x8,
- 0, 0x4,
- 0, 0x2,
- 0, 0x1,
- 1, 0x100,
- 1, 0x80,
- 1, 0x40,
- 1, 0x20,
- 1, 0x10,
- 1, 0x8,
- 1, 0x4,
- 1, 0x2,
- 1, 0x1,
- 3, 0x80,
- 11, 0x80,
- 3, 0x40,
- 11, 0x40,
- 3, 0x20,
- 11, 0x20,
- 3, 0x10,
- 11, 0x10,
- 3, 0x8,
- 11, 0x8,
- 6, 0x40,
- 10, 0x40,
- 14, 0x40,
- 18, 0x40,
- 6, 0x20,
- 10, 0x20,
- 14, 0x20,
- 18, 0x20,
- 6, 0x8,
- 10, 0x8,
- 14, 0x8,
- 18, 0x8,
- 6, 0x4,
- 10, 0x4,
- 14, 0x4,
- 18, 0x4,
- 7, 0x10,
- 15, 0x10,
- 7, 0x8,
- 15, 0x8,
- 2, 0x10,
- 2, 0x8,
- 2, 0x4,
- 2, 0x100,
- 2, 0x80,
- 2, 0x40,
- 3, 0x4,
- 7, 0x4,
- 11, 0x4,
- 15, 0x4,
- 6, 0x2,
- 10, 0x2,
- 14, 0x2,
- 18, 0x2,
- 2, 0x20,
- 2, 0x2,
- 2, 0x1,
- 5, 0x1,
- 9, 0x1,
- 13, 0x1,
- 17, 0x1,
- 6, 0x1,
- 10, 0x1,
- 14, 0x1,
- 18, 0x1,
- 5, 0x2,
- 9, 0x2,
- 13, 0x2,
- 17, 0x2,
- 5, 0x4,
- 9, 0x4,
- 6, 0x10,
- 10, 0x10,
- 14, 0x10,
- 18, 0x10,
- 13, 0x4,
- 17, 0x4,
- 5, 0x8,
- 9, 0x8,
- 13, 0x8,
- 17, 0x8,
- 3, 0x2,
- 3, 0x1,
- 7, 0x2,
- 7, 0x1,
- 11, 0x2,
- 11, 0x1,
- 15, 0x2,
- 15, 0x1,
- 4, 0x20,
- 4, 0x10,
- 4, 0x8,
- 4, 0x4,
- 4, 0x2,
- 4, 0x1,
- 8, 0x20,
- 8, 0x10,
- 8, 0x8,
- 8, 0x4,
- 8, 0x2,
- 8, 0x1,
- 12, 0x20,
- 12, 0x10,
- 12, 0x8,
- 12, 0x4,
- 12, 0x2,
- 12, 0x1,
- 16, 0x20,
- 16, 0x10,
- 16, 0x8,
- 16, 0x4,
- 16, 0x2,
- 16, 0x1,
- 4, 0x1000,
- 8, 0x1000,
- 12, 0x1000,
- 16, 0x1000,
- 4, 0x800,
- 8, 0x800,
- 12, 0x800,
- 16, 0x800,
- 4, 0x400,
- 8, 0x400,
- 12, 0x400,
- 16, 0x400,
- 4, 0x200,
- 8, 0x200,
- 12, 0x200,
- 16, 0x200,
- 4, 0x100,
- 8, 0x100,
- 12, 0x100,
- 16, 0x100,
- 4, 0x80,
- 8, 0x80,
- 12, 0x80,
- 16, 0x80,
- 4, 0x40,
- 8, 0x40,
- 12, 0x40,
- 16, 0x40
+ 0, 0x80,
+ 0, 0x40,
+ 0, 0x20,
+ 0, 0x10,
+ 0, 0x8,
+ 0, 0x4,
+ 0, 0x2,
+ 0, 0x1,
+ 1, 0x100,
+ 1, 0x80,
+ 1, 0x40,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x8,
+ 1, 0x4,
+ 1, 0x2,
+ 1, 0x1,
+ 3, 0x80,
+ 11, 0x80,
+ 3, 0x40,
+ 11, 0x40,
+ 3, 0x20,
+ 11, 0x20,
+ 3, 0x10,
+ 11, 0x10,
+ 3, 0x8,
+ 11, 0x8,
+ 6, 0x40,
+ 10, 0x40,
+ 14, 0x40,
+ 18, 0x40,
+ 6, 0x20,
+ 10, 0x20,
+ 14, 0x20,
+ 18, 0x20,
+ 6, 0x8,
+ 10, 0x8,
+ 14, 0x8,
+ 18, 0x8,
+ 6, 0x4,
+ 10, 0x4,
+ 14, 0x4,
+ 18, 0x4,
+ 7, 0x10,
+ 15, 0x10,
+ 7, 0x8,
+ 15, 0x8,
+ 2, 0x10,
+ 2, 0x8,
+ 2, 0x4,
+ 2, 0x100,
+ 2, 0x80,
+ 2, 0x40,
+ 3, 0x4,
+ 7, 0x4,
+ 11, 0x4,
+ 15, 0x4,
+ 6, 0x2,
+ 10, 0x2,
+ 14, 0x2,
+ 18, 0x2,
+ 2, 0x20,
+ 2, 0x2,
+ 2, 0x1,
+ 5, 0x1,
+ 9, 0x1,
+ 13, 0x1,
+ 17, 0x1,
+ 6, 0x1,
+ 10, 0x1,
+ 14, 0x1,
+ 18, 0x1,
+ 5, 0x2,
+ 9, 0x2,
+ 13, 0x2,
+ 17, 0x2,
+ 5, 0x4,
+ 9, 0x4,
+ 6, 0x10,
+ 10, 0x10,
+ 14, 0x10,
+ 18, 0x10,
+ 13, 0x4,
+ 17, 0x4,
+ 5, 0x8,
+ 9, 0x8,
+ 13, 0x8,
+ 17, 0x8,
+ 3, 0x2,
+ 3, 0x1,
+ 7, 0x2,
+ 7, 0x1,
+ 11, 0x2,
+ 11, 0x1,
+ 15, 0x2,
+ 15, 0x1,
+ 4, 0x20,
+ 4, 0x10,
+ 4, 0x8,
+ 4, 0x4,
+ 4, 0x2,
+ 4, 0x1,
+ 8, 0x20,
+ 8, 0x10,
+ 8, 0x8,
+ 8, 0x4,
+ 8, 0x2,
+ 8, 0x1,
+ 12, 0x20,
+ 12, 0x10,
+ 12, 0x8,
+ 12, 0x4,
+ 12, 0x2,
+ 12, 0x1,
+ 16, 0x20,
+ 16, 0x10,
+ 16, 0x8,
+ 16, 0x4,
+ 16, 0x2,
+ 16, 0x1,
+ 4, 0x1000,
+ 8, 0x1000,
+ 12, 0x1000,
+ 16, 0x1000,
+ 4, 0x800,
+ 8, 0x800,
+ 12, 0x800,
+ 16, 0x800,
+ 4, 0x400,
+ 8, 0x400,
+ 12, 0x400,
+ 16, 0x400,
+ 4, 0x200,
+ 8, 0x200,
+ 12, 0x200,
+ 16, 0x200,
+ 4, 0x100,
+ 8, 0x100,
+ 12, 0x100,
+ 16, 0x100,
+ 4, 0x80,
+ 8, 0x80,
+ 12, 0x80,
+ 16, 0x80,
+ 4, 0x40,
+ 8, 0x40,
+ 12, 0x40,
+ 16, 0x40
};
static Word16 order_MR795[] =
{
- 0, 0x1,
- 0, 0x2,
- 0, 0x4,
- 0, 0x8,
- 0, 0x10,
- 0, 0x20,
- 0, 0x40,
- 1, 0x8,
- 1, 0x2,
- 1, 0x100,
- 1, 0x80,
- 1, 0x20,
- 1, 0x10,
- 1, 0x4,
- 1, 0x40,
- 1, 0x1,
- 2, 0x40,
- 2, 0x10,
- 2, 0x4,
- 2, 0x8,
- 2, 0x80,
- 2, 0x100,
- 2, 0x20,
- 7, 0x10,
- 12, 0x10,
- 17, 0x10,
- 22, 0x10,
- 7, 0x8,
- 12, 0x8,
- 17, 0x8,
- 22, 0x8,
- 7, 0x4,
- 12, 0x4,
- 17, 0x4,
- 22, 0x4,
- 6, 0x8,
- 11, 0x8,
- 16, 0x8,
- 21, 0x8,
- 6, 0x4,
- 11, 0x4,
- 16, 0x4,
- 21, 0x4,
- 3, 0x80,
- 13, 0x80,
- 3, 0x40,
- 13, 0x40,
- 3, 0x20,
- 13, 0x20,
- 3, 0x10,
- 13, 0x10,
- 3, 0x8,
- 13, 0x8,
- 8, 0x20,
- 18, 0x20,
- 8, 0x10,
- 18, 0x10,
- 8, 0x8,
- 18, 0x8,
- 7, 0x2,
- 12, 0x2,
- 17, 0x2,
- 22, 0x2,
- 3, 0x4,
- 13, 0x4,
- 8, 0x4,
- 18, 0x4,
- 0, 0x80,
- 0, 0x100,
- 2, 0x2,
- 2, 0x1,
- 3, 0x2,
- 13, 0x2,
- 3, 0x1,
- 13, 0x1,
- 8, 0x2,
- 18, 0x2,
- 8, 0x1,
- 18, 0x1,
- 6, 0x2,
- 11, 0x2,
- 16, 0x2,
- 21, 0x2,
- 7, 0x1,
- 12, 0x1,
- 17, 0x1,
- 22, 0x1,
- 6, 0x1,
- 11, 0x1,
- 16, 0x1,
- 21, 0x1,
- 15, 0x1,
- 15, 0x2,
- 15, 0x4,
- 4, 0x2,
- 9, 0x2,
- 14, 0x2,
- 19, 0x2,
- 4, 0x10,
- 9, 0x10,
- 14, 0x10,
- 19, 0x10,
- 4, 0x80,
- 9, 0x80,
- 14, 0x80,
- 19, 0x80,
- 4, 0x800,
- 9, 0x800,
- 14, 0x800,
- 19, 0x800,
- 15, 0x8,
- 20, 0x1,
- 20, 0x2,
- 20, 0x4,
- 20, 0x8,
- 10, 0x1,
- 10, 0x2,
- 10, 0x4,
- 10, 0x8,
- 5, 0x1,
- 5, 0x2,
- 5, 0x4,
- 5, 0x8,
- 4, 0x1,
- 4, 0x4,
- 4, 0x8,
- 4, 0x20,
- 4, 0x100,
- 4, 0x1000,
- 9, 0x1,
- 9, 0x4,
- 9, 0x8,
- 9, 0x20,
- 9, 0x100,
- 9, 0x1000,
- 14, 0x1,
- 14, 0x4,
- 14, 0x8,
- 14, 0x20,
- 14, 0x100,
- 14, 0x1000,
- 19, 0x1,
- 19, 0x4,
- 19, 0x8,
- 19, 0x20,
- 19, 0x100,
- 19, 0x1000,
- 4, 0x40,
- 9, 0x40,
- 14, 0x40,
- 19, 0x40,
- 4, 0x400,
- 9, 0x400,
- 14, 0x400,
- 19, 0x400,
- 4, 0x200,
- 9, 0x200,
- 14, 0x200,
- 19, 0x200,
- 0, 0x1,
- 0, 0x2,
- 0, 0x4,
- 0, 0x8,
- 0, 0x10,
- 0, 0x20,
- 0, 0x40,
- 1, 0x8,
- 1, 0x2,
- 1, 0x100,
- 1, 0x80,
- 1, 0x20,
- 1, 0x10,
- 1, 0x4,
- 1, 0x40,
- 1, 0x1,
- 2, 0x40,
- 2, 0x10,
- 2, 0x4,
- 2, 0x8,
- 2, 0x80,
- 2, 0x100,
- 2, 0x20,
- 7, 0x10,
- 12, 0x10,
- 17, 0x10,
- 22, 0x10,
- 7, 0x8,
- 12, 0x8,
- 17, 0x8,
- 22, 0x8,
- 7, 0x4,
- 12, 0x4,
- 17, 0x4,
- 22, 0x4,
- 6, 0x8,
- 11, 0x8,
- 16, 0x8,
- 21, 0x8,
- 6, 0x4,
- 11, 0x4,
- 16, 0x4,
- 21, 0x4,
- 3, 0x80,
- 13, 0x80,
- 3, 0x40,
- 13, 0x40,
- 3, 0x20,
- 13, 0x20,
- 3, 0x10,
- 13, 0x10,
- 3, 0x8,
- 13, 0x8,
- 8, 0x20,
- 18, 0x20,
- 8, 0x10,
- 18, 0x10,
- 8, 0x8,
- 18, 0x8,
- 7, 0x2,
- 12, 0x2,
- 17, 0x2,
- 22, 0x2,
- 3, 0x4,
- 13, 0x4,
- 8, 0x4,
- 18, 0x4,
- 0, 0x80,
- 0, 0x100,
- 2, 0x2,
- 2, 0x1,
- 3, 0x2,
- 13, 0x2,
- 3, 0x1,
- 13, 0x1,
- 8, 0x2,
- 18, 0x2,
- 8, 0x1,
- 18, 0x1,
- 6, 0x2,
- 11, 0x2,
- 16, 0x2,
- 21, 0x2,
- 7, 0x1,
- 12, 0x1,
- 17, 0x1,
- 22, 0x1,
- 6, 0x1,
- 11, 0x1,
- 16, 0x1,
- 21, 0x1,
- 15, 0x1,
- 15, 0x2,
- 15, 0x4,
- 4, 0x2,
- 9, 0x2,
- 14, 0x2,
- 19, 0x2,
- 4, 0x10,
- 9, 0x10,
- 14, 0x10,
- 19, 0x10,
- 4, 0x80,
- 9, 0x80,
- 14, 0x80,
- 19, 0x80,
- 4, 0x800,
- 9, 0x800,
- 14, 0x800,
- 19, 0x800,
- 15, 0x8,
- 20, 0x1,
- 20, 0x2,
- 20, 0x4,
- 20, 0x8,
- 10, 0x1,
- 10, 0x2,
- 10, 0x4,
- 10, 0x8,
- 5, 0x1,
- 5, 0x2,
- 5, 0x4,
- 5, 0x8,
- 4, 0x1,
- 4, 0x4,
- 4, 0x8,
- 4, 0x20,
- 4, 0x100,
- 4, 0x1000,
- 9, 0x1,
- 9, 0x4,
- 9, 0x8,
- 9, 0x20,
- 9, 0x100,
- 9, 0x1000,
- 14, 0x1,
- 14, 0x4,
- 14, 0x8,
- 14, 0x20,
- 14, 0x100,
- 14, 0x1000,
- 19, 0x1,
- 19, 0x4,
- 19, 0x8,
- 19, 0x20,
- 19, 0x100,
- 19, 0x1000,
- 4, 0x40,
- 9, 0x40,
- 14, 0x40,
- 19, 0x40,
- 4, 0x400,
- 9, 0x400,
- 14, 0x400,
- 19, 0x400,
- 4, 0x200,
- 9, 0x200,
- 14, 0x200,
- 19, 0x200
+ 0, 0x1,
+ 0, 0x2,
+ 0, 0x4,
+ 0, 0x8,
+ 0, 0x10,
+ 0, 0x20,
+ 0, 0x40,
+ 1, 0x8,
+ 1, 0x2,
+ 1, 0x100,
+ 1, 0x80,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x4,
+ 1, 0x40,
+ 1, 0x1,
+ 2, 0x40,
+ 2, 0x10,
+ 2, 0x4,
+ 2, 0x8,
+ 2, 0x80,
+ 2, 0x100,
+ 2, 0x20,
+ 7, 0x10,
+ 12, 0x10,
+ 17, 0x10,
+ 22, 0x10,
+ 7, 0x8,
+ 12, 0x8,
+ 17, 0x8,
+ 22, 0x8,
+ 7, 0x4,
+ 12, 0x4,
+ 17, 0x4,
+ 22, 0x4,
+ 6, 0x8,
+ 11, 0x8,
+ 16, 0x8,
+ 21, 0x8,
+ 6, 0x4,
+ 11, 0x4,
+ 16, 0x4,
+ 21, 0x4,
+ 3, 0x80,
+ 13, 0x80,
+ 3, 0x40,
+ 13, 0x40,
+ 3, 0x20,
+ 13, 0x20,
+ 3, 0x10,
+ 13, 0x10,
+ 3, 0x8,
+ 13, 0x8,
+ 8, 0x20,
+ 18, 0x20,
+ 8, 0x10,
+ 18, 0x10,
+ 8, 0x8,
+ 18, 0x8,
+ 7, 0x2,
+ 12, 0x2,
+ 17, 0x2,
+ 22, 0x2,
+ 3, 0x4,
+ 13, 0x4,
+ 8, 0x4,
+ 18, 0x4,
+ 0, 0x80,
+ 0, 0x100,
+ 2, 0x2,
+ 2, 0x1,
+ 3, 0x2,
+ 13, 0x2,
+ 3, 0x1,
+ 13, 0x1,
+ 8, 0x2,
+ 18, 0x2,
+ 8, 0x1,
+ 18, 0x1,
+ 6, 0x2,
+ 11, 0x2,
+ 16, 0x2,
+ 21, 0x2,
+ 7, 0x1,
+ 12, 0x1,
+ 17, 0x1,
+ 22, 0x1,
+ 6, 0x1,
+ 11, 0x1,
+ 16, 0x1,
+ 21, 0x1,
+ 15, 0x1,
+ 15, 0x2,
+ 15, 0x4,
+ 4, 0x2,
+ 9, 0x2,
+ 14, 0x2,
+ 19, 0x2,
+ 4, 0x10,
+ 9, 0x10,
+ 14, 0x10,
+ 19, 0x10,
+ 4, 0x80,
+ 9, 0x80,
+ 14, 0x80,
+ 19, 0x80,
+ 4, 0x800,
+ 9, 0x800,
+ 14, 0x800,
+ 19, 0x800,
+ 15, 0x8,
+ 20, 0x1,
+ 20, 0x2,
+ 20, 0x4,
+ 20, 0x8,
+ 10, 0x1,
+ 10, 0x2,
+ 10, 0x4,
+ 10, 0x8,
+ 5, 0x1,
+ 5, 0x2,
+ 5, 0x4,
+ 5, 0x8,
+ 4, 0x1,
+ 4, 0x4,
+ 4, 0x8,
+ 4, 0x20,
+ 4, 0x100,
+ 4, 0x1000,
+ 9, 0x1,
+ 9, 0x4,
+ 9, 0x8,
+ 9, 0x20,
+ 9, 0x100,
+ 9, 0x1000,
+ 14, 0x1,
+ 14, 0x4,
+ 14, 0x8,
+ 14, 0x20,
+ 14, 0x100,
+ 14, 0x1000,
+ 19, 0x1,
+ 19, 0x4,
+ 19, 0x8,
+ 19, 0x20,
+ 19, 0x100,
+ 19, 0x1000,
+ 4, 0x40,
+ 9, 0x40,
+ 14, 0x40,
+ 19, 0x40,
+ 4, 0x400,
+ 9, 0x400,
+ 14, 0x400,
+ 19, 0x400,
+ 4, 0x200,
+ 9, 0x200,
+ 14, 0x200,
+ 19, 0x200,
+ 0, 0x1,
+ 0, 0x2,
+ 0, 0x4,
+ 0, 0x8,
+ 0, 0x10,
+ 0, 0x20,
+ 0, 0x40,
+ 1, 0x8,
+ 1, 0x2,
+ 1, 0x100,
+ 1, 0x80,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x4,
+ 1, 0x40,
+ 1, 0x1,
+ 2, 0x40,
+ 2, 0x10,
+ 2, 0x4,
+ 2, 0x8,
+ 2, 0x80,
+ 2, 0x100,
+ 2, 0x20,
+ 7, 0x10,
+ 12, 0x10,
+ 17, 0x10,
+ 22, 0x10,
+ 7, 0x8,
+ 12, 0x8,
+ 17, 0x8,
+ 22, 0x8,
+ 7, 0x4,
+ 12, 0x4,
+ 17, 0x4,
+ 22, 0x4,
+ 6, 0x8,
+ 11, 0x8,
+ 16, 0x8,
+ 21, 0x8,
+ 6, 0x4,
+ 11, 0x4,
+ 16, 0x4,
+ 21, 0x4,
+ 3, 0x80,
+ 13, 0x80,
+ 3, 0x40,
+ 13, 0x40,
+ 3, 0x20,
+ 13, 0x20,
+ 3, 0x10,
+ 13, 0x10,
+ 3, 0x8,
+ 13, 0x8,
+ 8, 0x20,
+ 18, 0x20,
+ 8, 0x10,
+ 18, 0x10,
+ 8, 0x8,
+ 18, 0x8,
+ 7, 0x2,
+ 12, 0x2,
+ 17, 0x2,
+ 22, 0x2,
+ 3, 0x4,
+ 13, 0x4,
+ 8, 0x4,
+ 18, 0x4,
+ 0, 0x80,
+ 0, 0x100,
+ 2, 0x2,
+ 2, 0x1,
+ 3, 0x2,
+ 13, 0x2,
+ 3, 0x1,
+ 13, 0x1,
+ 8, 0x2,
+ 18, 0x2,
+ 8, 0x1,
+ 18, 0x1,
+ 6, 0x2,
+ 11, 0x2,
+ 16, 0x2,
+ 21, 0x2,
+ 7, 0x1,
+ 12, 0x1,
+ 17, 0x1,
+ 22, 0x1,
+ 6, 0x1,
+ 11, 0x1,
+ 16, 0x1,
+ 21, 0x1,
+ 15, 0x1,
+ 15, 0x2,
+ 15, 0x4,
+ 4, 0x2,
+ 9, 0x2,
+ 14, 0x2,
+ 19, 0x2,
+ 4, 0x10,
+ 9, 0x10,
+ 14, 0x10,
+ 19, 0x10,
+ 4, 0x80,
+ 9, 0x80,
+ 14, 0x80,
+ 19, 0x80,
+ 4, 0x800,
+ 9, 0x800,
+ 14, 0x800,
+ 19, 0x800,
+ 15, 0x8,
+ 20, 0x1,
+ 20, 0x2,
+ 20, 0x4,
+ 20, 0x8,
+ 10, 0x1,
+ 10, 0x2,
+ 10, 0x4,
+ 10, 0x8,
+ 5, 0x1,
+ 5, 0x2,
+ 5, 0x4,
+ 5, 0x8,
+ 4, 0x1,
+ 4, 0x4,
+ 4, 0x8,
+ 4, 0x20,
+ 4, 0x100,
+ 4, 0x1000,
+ 9, 0x1,
+ 9, 0x4,
+ 9, 0x8,
+ 9, 0x20,
+ 9, 0x100,
+ 9, 0x1000,
+ 14, 0x1,
+ 14, 0x4,
+ 14, 0x8,
+ 14, 0x20,
+ 14, 0x100,
+ 14, 0x1000,
+ 19, 0x1,
+ 19, 0x4,
+ 19, 0x8,
+ 19, 0x20,
+ 19, 0x100,
+ 19, 0x1000,
+ 4, 0x40,
+ 9, 0x40,
+ 14, 0x40,
+ 19, 0x40,
+ 4, 0x400,
+ 9, 0x400,
+ 14, 0x400,
+ 19, 0x400,
+ 4, 0x200,
+ 9, 0x200,
+ 14, 0x200,
+ 19, 0x200
};
static Word16 order_MR102[] =
{
- 0, 0x1,
- 0, 0x2,
- 0, 0x4,
- 0, 0x8,
- 0, 0x10,
- 0, 0x20,
- 0, 0x40,
- 0, 0x80,
- 1, 0x1,
- 1, 0x2,
- 1, 0x4,
- 1, 0x8,
- 1, 0x10,
- 1, 0x20,
- 1, 0x40,
- 1, 0x80,
- 1, 0x100,
- 3, 0x80,
- 3, 0x40,
- 3, 0x20,
- 3, 0x10,
- 3, 0x8,
- 3, 0x4,
- 21, 0x80,
- 21, 0x40,
- 21, 0x20,
- 21, 0x10,
- 21, 0x8,
- 21, 0x4,
- 12, 0x10,
- 12, 0x8,
- 30, 0x10,
- 30, 0x8,
- 11, 0x40,
- 11, 0x8,
- 11, 0x4,
- 20, 0x40,
- 20, 0x8,
- 20, 0x4,
- 29, 0x40,
- 29, 0x8,
- 29, 0x4,
- 38, 0x40,
- 38, 0x8,
- 38, 0x4,
- 3, 0x2,
- 3, 0x1,
- 21, 0x2,
- 21, 0x1,
- 12, 0x4,
- 12, 0x2,
- 30, 0x4,
- 30, 0x2,
- 11, 0x20,
- 20, 0x20,
- 29, 0x20,
- 38, 0x20,
- 2, 0x40,
- 2, 0x4,
- 2, 0x10,
- 2, 0x8,
- 2, 0x80,
- 2, 0x100,
- 2, 0x20,
- 2, 0x2,
- 2, 0x1,
- 7, 0x1,
- 6, 0x1,
- 5, 0x1,
- 4, 0x1,
- 16, 0x1,
- 15, 0x1,
- 14, 0x1,
- 13, 0x1,
- 25, 0x1,
- 24, 0x1,
- 23, 0x1,
- 22, 0x1,
- 34, 0x1,
- 33, 0x1,
- 32, 0x1,
- 31, 0x1,
- 11, 0x2,
- 11, 0x10,
- 11, 0x1,
- 20, 0x2,
- 20, 0x10,
- 20, 0x1,
- 29, 0x2,
- 29, 0x10,
- 29, 0x1,
- 38, 0x2,
- 38, 0x10,
- 38, 0x1,
- 12, 0x1,
- 30, 0x1,
- 17, 0x200,
- 17, 0x100,
- 18, 0x100,
- 18, 0x200,
- 18, 0x80,
- 17, 0x80,
- 18, 0x20,
- 17, 0x20,
- 17, 0x40,
- 18, 0x40,
- 19, 0x40,
- 19, 0x20,
- 18, 0x10,
- 19, 0x8,
- 17, 0x10,
- 19, 0x10,
- 17, 0x8,
- 18, 0x8,
- 26, 0x200,
- 26, 0x100,
- 27, 0x100,
- 27, 0x200,
- 27, 0x80,
- 26, 0x80,
- 27, 0x20,
- 26, 0x20,
- 26, 0x40,
- 27, 0x40,
- 28, 0x40,
- 28, 0x20,
- 27, 0x10,
- 28, 0x8,
- 26, 0x10,
- 28, 0x10,
- 26, 0x8,
- 27, 0x8,
- 35, 0x200,
- 35, 0x100,
- 36, 0x100,
- 36, 0x200,
- 36, 0x80,
- 35, 0x80,
- 36, 0x20,
- 35, 0x20,
- 35, 0x40,
- 36, 0x40,
- 37, 0x40,
- 37, 0x20,
- 36, 0x10,
- 37, 0x8,
- 35, 0x10,
- 37, 0x10,
- 35, 0x8,
- 36, 0x8,
- 8, 0x200,
- 8, 0x100,
- 9, 0x100,
- 9, 0x200,
- 9, 0x80,
- 8, 0x80,
- 9, 0x20,
- 8, 0x20,
- 8, 0x40,
- 9, 0x40,
- 10, 0x40,
- 10, 0x20,
- 9, 0x10,
- 10, 0x8,
- 8, 0x10,
- 10, 0x10,
- 8, 0x8,
- 9, 0x8,
- 37, 0x4,
- 35, 0x1,
- 36, 0x1,
- 37, 0x1,
- 35, 0x4,
- 37, 0x2,
- 35, 0x2,
- 36, 0x4,
- 36, 0x2,
- 28, 0x4,
- 26, 0x1,
- 27, 0x1,
- 28, 0x1,
- 26, 0x4,
- 28, 0x2,
- 26, 0x2,
- 27, 0x4,
- 27, 0x2,
- 19, 0x4,
- 17, 0x1,
- 18, 0x1,
- 19, 0x1,
- 17, 0x4,
- 19, 0x2,
- 17, 0x2,
- 18, 0x4,
- 18, 0x2,
- 10, 0x4,
- 8, 0x1,
- 9, 0x1,
- 10, 0x1,
- 8, 0x4,
- 10, 0x2,
- 8, 0x2,
- 9, 0x4,
- 9, 0x2
+ 0, 0x1,
+ 0, 0x2,
+ 0, 0x4,
+ 0, 0x8,
+ 0, 0x10,
+ 0, 0x20,
+ 0, 0x40,
+ 0, 0x80,
+ 1, 0x1,
+ 1, 0x2,
+ 1, 0x4,
+ 1, 0x8,
+ 1, 0x10,
+ 1, 0x20,
+ 1, 0x40,
+ 1, 0x80,
+ 1, 0x100,
+ 3, 0x80,
+ 3, 0x40,
+ 3, 0x20,
+ 3, 0x10,
+ 3, 0x8,
+ 3, 0x4,
+ 21, 0x80,
+ 21, 0x40,
+ 21, 0x20,
+ 21, 0x10,
+ 21, 0x8,
+ 21, 0x4,
+ 12, 0x10,
+ 12, 0x8,
+ 30, 0x10,
+ 30, 0x8,
+ 11, 0x40,
+ 11, 0x8,
+ 11, 0x4,
+ 20, 0x40,
+ 20, 0x8,
+ 20, 0x4,
+ 29, 0x40,
+ 29, 0x8,
+ 29, 0x4,
+ 38, 0x40,
+ 38, 0x8,
+ 38, 0x4,
+ 3, 0x2,
+ 3, 0x1,
+ 21, 0x2,
+ 21, 0x1,
+ 12, 0x4,
+ 12, 0x2,
+ 30, 0x4,
+ 30, 0x2,
+ 11, 0x20,
+ 20, 0x20,
+ 29, 0x20,
+ 38, 0x20,
+ 2, 0x40,
+ 2, 0x4,
+ 2, 0x10,
+ 2, 0x8,
+ 2, 0x80,
+ 2, 0x100,
+ 2, 0x20,
+ 2, 0x2,
+ 2, 0x1,
+ 7, 0x1,
+ 6, 0x1,
+ 5, 0x1,
+ 4, 0x1,
+ 16, 0x1,
+ 15, 0x1,
+ 14, 0x1,
+ 13, 0x1,
+ 25, 0x1,
+ 24, 0x1,
+ 23, 0x1,
+ 22, 0x1,
+ 34, 0x1,
+ 33, 0x1,
+ 32, 0x1,
+ 31, 0x1,
+ 11, 0x2,
+ 11, 0x10,
+ 11, 0x1,
+ 20, 0x2,
+ 20, 0x10,
+ 20, 0x1,
+ 29, 0x2,
+ 29, 0x10,
+ 29, 0x1,
+ 38, 0x2,
+ 38, 0x10,
+ 38, 0x1,
+ 12, 0x1,
+ 30, 0x1,
+ 17, 0x200,
+ 17, 0x100,
+ 18, 0x100,
+ 18, 0x200,
+ 18, 0x80,
+ 17, 0x80,
+ 18, 0x20,
+ 17, 0x20,
+ 17, 0x40,
+ 18, 0x40,
+ 19, 0x40,
+ 19, 0x20,
+ 18, 0x10,
+ 19, 0x8,
+ 17, 0x10,
+ 19, 0x10,
+ 17, 0x8,
+ 18, 0x8,
+ 26, 0x200,
+ 26, 0x100,
+ 27, 0x100,
+ 27, 0x200,
+ 27, 0x80,
+ 26, 0x80,
+ 27, 0x20,
+ 26, 0x20,
+ 26, 0x40,
+ 27, 0x40,
+ 28, 0x40,
+ 28, 0x20,
+ 27, 0x10,
+ 28, 0x8,
+ 26, 0x10,
+ 28, 0x10,
+ 26, 0x8,
+ 27, 0x8,
+ 35, 0x200,
+ 35, 0x100,
+ 36, 0x100,
+ 36, 0x200,
+ 36, 0x80,
+ 35, 0x80,
+ 36, 0x20,
+ 35, 0x20,
+ 35, 0x40,
+ 36, 0x40,
+ 37, 0x40,
+ 37, 0x20,
+ 36, 0x10,
+ 37, 0x8,
+ 35, 0x10,
+ 37, 0x10,
+ 35, 0x8,
+ 36, 0x8,
+ 8, 0x200,
+ 8, 0x100,
+ 9, 0x100,
+ 9, 0x200,
+ 9, 0x80,
+ 8, 0x80,
+ 9, 0x20,
+ 8, 0x20,
+ 8, 0x40,
+ 9, 0x40,
+ 10, 0x40,
+ 10, 0x20,
+ 9, 0x10,
+ 10, 0x8,
+ 8, 0x10,
+ 10, 0x10,
+ 8, 0x8,
+ 9, 0x8,
+ 37, 0x4,
+ 35, 0x1,
+ 36, 0x1,
+ 37, 0x1,
+ 35, 0x4,
+ 37, 0x2,
+ 35, 0x2,
+ 36, 0x4,
+ 36, 0x2,
+ 28, 0x4,
+ 26, 0x1,
+ 27, 0x1,
+ 28, 0x1,
+ 26, 0x4,
+ 28, 0x2,
+ 26, 0x2,
+ 27, 0x4,
+ 27, 0x2,
+ 19, 0x4,
+ 17, 0x1,
+ 18, 0x1,
+ 19, 0x1,
+ 17, 0x4,
+ 19, 0x2,
+ 17, 0x2,
+ 18, 0x4,
+ 18, 0x2,
+ 10, 0x4,
+ 8, 0x1,
+ 9, 0x1,
+ 10, 0x1,
+ 8, 0x4,
+ 10, 0x2,
+ 8, 0x2,
+ 9, 0x4,
+ 9, 0x2
};
static Word16 order_MR122[] =
{
- 0, 0x40,
- 0, 0x20,
- 0, 0x10,
- 0, 0x8,
- 0, 0x4,
- 0, 0x2,
- 0, 0x1,
- 1, 0x80,
- 1, 0x40,
- 1, 0x20,
- 1, 0x10,
- 1, 0x8,
- 1, 0x4,
- 1, 0x2,
- 1, 0x1,
- 2, 0x1,
- 2, 0x100,
- 2, 0x80,
- 2, 0x40,
- 2, 0x20,
- 2, 0x10,
- 2, 0x8,
- 2, 0x4,
- 2, 0x2,
- 3, 0x80,
- 3, 0x40,
- 3, 0x20,
- 3, 0x10,
- 3, 0x8,
- 5, 0x100,
- 31, 0x100,
- 5, 0x80,
- 31, 0x80,
- 5, 0x40,
- 31, 0x40,
- 5, 0x20,
- 31, 0x20,
- 5, 0x10,
- 31, 0x10,
- 5, 0x8,
- 31, 0x8,
- 5, 0x4,
- 31, 0x4,
- 5, 0x2,
- 31, 0x2,
- 5, 0x1,
- 31, 0x1,
- 6, 0x8,
- 19, 0x8,
- 32, 0x8,
- 45, 0x8,
- 6, 0x4,
- 19, 0x4,
- 32, 0x4,
- 45, 0x4,
- 6, 0x2,
- 19, 0x2,
- 32, 0x2,
- 45, 0x2,
- 17, 0x10,
- 30, 0x10,
- 43, 0x10,
- 56, 0x10,
- 17, 0x8,
- 30, 0x8,
- 43, 0x8,
- 56, 0x8,
- 17, 0x4,
- 30, 0x4,
- 43, 0x4,
- 56, 0x4,
- 18, 0x20,
- 44, 0x20,
- 18, 0x10,
- 44, 0x10,
- 18, 0x8,
- 44, 0x8,
- 18, 0x4,
- 44, 0x4,
- 18, 0x2,
- 44, 0x2,
- 3, 0x4,
- 3, 0x2,
- 3, 0x1,
- 4, 0x20,
- 4, 0x10,
- 4, 0x8,
- 4, 0x4,
- 6, 0x1,
- 19, 0x1,
- 32, 0x1,
- 45, 0x1,
- 17, 0x2,
- 30, 0x2,
- 43, 0x2,
- 56, 0x2,
- 7, 0x8,
- 20, 0x8,
- 33, 0x8,
- 46, 0x8,
- 8, 0x8,
- 21, 0x8,
- 34, 0x8,
- 47, 0x8,
- 17, 0x1,
- 30, 0x1,
- 43, 0x1,
- 56, 0x1,
- 9, 0x8,
- 22, 0x8,
- 35, 0x8,
- 48, 0x8,
- 10, 0x8,
- 23, 0x8,
- 36, 0x8,
- 49, 0x8,
- 11, 0x8,
- 24, 0x8,
- 37, 0x8,
- 50, 0x8,
- 4, 0x2,
- 4, 0x1,
- 7, 0x1,
- 7, 0x2,
- 7, 0x4,
- 8, 0x1,
- 8, 0x2,
- 8, 0x4,
- 9, 0x1,
- 9, 0x2,
- 9, 0x4,
- 10, 0x1,
- 10, 0x2,
- 10, 0x4,
- 11, 0x1,
- 11, 0x2,
- 11, 0x4,
- 20, 0x1,
- 20, 0x2,
- 20, 0x4,
- 21, 0x1,
- 21, 0x2,
- 21, 0x4,
- 22, 0x1,
- 22, 0x2,
- 22, 0x4,
- 23, 0x1,
- 23, 0x2,
- 23, 0x4,
- 24, 0x1,
- 24, 0x2,
- 24, 0x4,
- 33, 0x1,
- 33, 0x2,
- 33, 0x4,
- 34, 0x1,
- 34, 0x2,
- 34, 0x4,
- 35, 0x1,
- 35, 0x2,
- 35, 0x4,
- 36, 0x1,
- 36, 0x2,
- 36, 0x4,
- 37, 0x1,
- 37, 0x2,
- 37, 0x4,
- 46, 0x1,
- 46, 0x2,
- 46, 0x4,
- 47, 0x1,
- 47, 0x2,
- 47, 0x4,
- 48, 0x1,
- 48, 0x2,
- 48, 0x4,
- 49, 0x1,
- 49, 0x2,
- 49, 0x4,
- 50, 0x1,
- 50, 0x2,
- 50, 0x4,
- 12, 0x1,
- 12, 0x2,
- 12, 0x4,
- 13, 0x1,
- 13, 0x2,
- 13, 0x4,
- 14, 0x1,
- 14, 0x2,
- 14, 0x4,
- 15, 0x1,
- 15, 0x2,
- 15, 0x4,
- 16, 0x1,
- 16, 0x2,
- 16, 0x4,
- 25, 0x1,
- 25, 0x2,
- 25, 0x4,
- 26, 0x1,
- 26, 0x2,
- 26, 0x4,
- 27, 0x1,
- 27, 0x2,
- 27, 0x4,
- 28, 0x1,
- 28, 0x2,
- 28, 0x4,
- 29, 0x1,
- 29, 0x2,
- 29, 0x4,
- 38, 0x1,
- 38, 0x2,
- 38, 0x4,
- 39, 0x1,
- 39, 0x2,
- 39, 0x4,
- 40, 0x1,
- 40, 0x2,
- 40, 0x4,
- 41, 0x1,
- 41, 0x2,
- 41, 0x4,
- 42, 0x1,
- 42, 0x2,
- 42, 0x4,
- 51, 0x1,
- 51, 0x2,
- 51, 0x4,
- 52, 0x1,
- 52, 0x2,
- 52, 0x4,
- 53, 0x1,
- 53, 0x2,
- 53, 0x4,
- 54, 0x1,
- 54, 0x2,
- 54, 0x4,
- 55, 0x1,
- 55, 0x2,
- 55, 0x4,
- 18, 0x1,
- 44, 0x1
+ 0, 0x40,
+ 0, 0x20,
+ 0, 0x10,
+ 0, 0x8,
+ 0, 0x4,
+ 0, 0x2,
+ 0, 0x1,
+ 1, 0x80,
+ 1, 0x40,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x8,
+ 1, 0x4,
+ 1, 0x2,
+ 1, 0x1,
+ 2, 0x1,
+ 2, 0x100,
+ 2, 0x80,
+ 2, 0x40,
+ 2, 0x20,
+ 2, 0x10,
+ 2, 0x8,
+ 2, 0x4,
+ 2, 0x2,
+ 3, 0x80,
+ 3, 0x40,
+ 3, 0x20,
+ 3, 0x10,
+ 3, 0x8,
+ 5, 0x100,
+ 31, 0x100,
+ 5, 0x80,
+ 31, 0x80,
+ 5, 0x40,
+ 31, 0x40,
+ 5, 0x20,
+ 31, 0x20,
+ 5, 0x10,
+ 31, 0x10,
+ 5, 0x8,
+ 31, 0x8,
+ 5, 0x4,
+ 31, 0x4,
+ 5, 0x2,
+ 31, 0x2,
+ 5, 0x1,
+ 31, 0x1,
+ 6, 0x8,
+ 19, 0x8,
+ 32, 0x8,
+ 45, 0x8,
+ 6, 0x4,
+ 19, 0x4,
+ 32, 0x4,
+ 45, 0x4,
+ 6, 0x2,
+ 19, 0x2,
+ 32, 0x2,
+ 45, 0x2,
+ 17, 0x10,
+ 30, 0x10,
+ 43, 0x10,
+ 56, 0x10,
+ 17, 0x8,
+ 30, 0x8,
+ 43, 0x8,
+ 56, 0x8,
+ 17, 0x4,
+ 30, 0x4,
+ 43, 0x4,
+ 56, 0x4,
+ 18, 0x20,
+ 44, 0x20,
+ 18, 0x10,
+ 44, 0x10,
+ 18, 0x8,
+ 44, 0x8,
+ 18, 0x4,
+ 44, 0x4,
+ 18, 0x2,
+ 44, 0x2,
+ 3, 0x4,
+ 3, 0x2,
+ 3, 0x1,
+ 4, 0x20,
+ 4, 0x10,
+ 4, 0x8,
+ 4, 0x4,
+ 6, 0x1,
+ 19, 0x1,
+ 32, 0x1,
+ 45, 0x1,
+ 17, 0x2,
+ 30, 0x2,
+ 43, 0x2,
+ 56, 0x2,
+ 7, 0x8,
+ 20, 0x8,
+ 33, 0x8,
+ 46, 0x8,
+ 8, 0x8,
+ 21, 0x8,
+ 34, 0x8,
+ 47, 0x8,
+ 17, 0x1,
+ 30, 0x1,
+ 43, 0x1,
+ 56, 0x1,
+ 9, 0x8,
+ 22, 0x8,
+ 35, 0x8,
+ 48, 0x8,
+ 10, 0x8,
+ 23, 0x8,
+ 36, 0x8,
+ 49, 0x8,
+ 11, 0x8,
+ 24, 0x8,
+ 37, 0x8,
+ 50, 0x8,
+ 4, 0x2,
+ 4, 0x1,
+ 7, 0x1,
+ 7, 0x2,
+ 7, 0x4,
+ 8, 0x1,
+ 8, 0x2,
+ 8, 0x4,
+ 9, 0x1,
+ 9, 0x2,
+ 9, 0x4,
+ 10, 0x1,
+ 10, 0x2,
+ 10, 0x4,
+ 11, 0x1,
+ 11, 0x2,
+ 11, 0x4,
+ 20, 0x1,
+ 20, 0x2,
+ 20, 0x4,
+ 21, 0x1,
+ 21, 0x2,
+ 21, 0x4,
+ 22, 0x1,
+ 22, 0x2,
+ 22, 0x4,
+ 23, 0x1,
+ 23, 0x2,
+ 23, 0x4,
+ 24, 0x1,
+ 24, 0x2,
+ 24, 0x4,
+ 33, 0x1,
+ 33, 0x2,
+ 33, 0x4,
+ 34, 0x1,
+ 34, 0x2,
+ 34, 0x4,
+ 35, 0x1,
+ 35, 0x2,
+ 35, 0x4,
+ 36, 0x1,
+ 36, 0x2,
+ 36, 0x4,
+ 37, 0x1,
+ 37, 0x2,
+ 37, 0x4,
+ 46, 0x1,
+ 46, 0x2,
+ 46, 0x4,
+ 47, 0x1,
+ 47, 0x2,
+ 47, 0x4,
+ 48, 0x1,
+ 48, 0x2,
+ 48, 0x4,
+ 49, 0x1,
+ 49, 0x2,
+ 49, 0x4,
+ 50, 0x1,
+ 50, 0x2,
+ 50, 0x4,
+ 12, 0x1,
+ 12, 0x2,
+ 12, 0x4,
+ 13, 0x1,
+ 13, 0x2,
+ 13, 0x4,
+ 14, 0x1,
+ 14, 0x2,
+ 14, 0x4,
+ 15, 0x1,
+ 15, 0x2,
+ 15, 0x4,
+ 16, 0x1,
+ 16, 0x2,
+ 16, 0x4,
+ 25, 0x1,
+ 25, 0x2,
+ 25, 0x4,
+ 26, 0x1,
+ 26, 0x2,
+ 26, 0x4,
+ 27, 0x1,
+ 27, 0x2,
+ 27, 0x4,
+ 28, 0x1,
+ 28, 0x2,
+ 28, 0x4,
+ 29, 0x1,
+ 29, 0x2,
+ 29, 0x4,
+ 38, 0x1,
+ 38, 0x2,
+ 38, 0x4,
+ 39, 0x1,
+ 39, 0x2,
+ 39, 0x4,
+ 40, 0x1,
+ 40, 0x2,
+ 40, 0x4,
+ 41, 0x1,
+ 41, 0x2,
+ 41, 0x4,
+ 42, 0x1,
+ 42, 0x2,
+ 42, 0x4,
+ 51, 0x1,
+ 51, 0x2,
+ 51, 0x4,
+ 52, 0x1,
+ 52, 0x2,
+ 52, 0x4,
+ 53, 0x1,
+ 53, 0x2,
+ 53, 0x4,
+ 54, 0x1,
+ 54, 0x2,
+ 54, 0x4,
+ 55, 0x1,
+ 55, 0x2,
+ 55, 0x4,
+ 18, 0x1,
+ 44, 0x1
};
static Word16 order_MRDTX[] =
{
- 0, 0x4,
- 0, 0x2,
- 0, 0x1,
- 1, 0x80,
- 1, 0x40,
- 1, 0x20,
- 1, 0x10,
- 1, 0x8,
- 1, 0x4,
- 1, 0x2,
- 1, 0x1,
- 2, 0x100,
- 2, 0x80,
- 2, 0x40,
- 2, 0x20,
- 2, 0x10,
- 2, 0x8,
- 2, 0x4,
- 2, 0x2,
- 2, 0x1,
- 3, 0x100,
- 3, 0x80,
- 3, 0x40,
- 3, 0x20,
- 3, 0x10,
- 3, 0x8,
- 3, 0x4,
- 3, 0x2,
- 3, 0x1,
- 4, 0x20,
- 4, 0x10,
- 4, 0x8,
- 4, 0x4,
- 4, 0x2,
- 4, 0x1
+ 0, 0x4,
+ 0, 0x2,
+ 0, 0x1,
+ 1, 0x80,
+ 1, 0x40,
+ 1, 0x20,
+ 1, 0x10,
+ 1, 0x8,
+ 1, 0x4,
+ 1, 0x2,
+ 1, 0x1,
+ 2, 0x100,
+ 2, 0x80,
+ 2, 0x40,
+ 2, 0x20,
+ 2, 0x10,
+ 2, 0x8,
+ 2, 0x4,
+ 2, 0x2,
+ 2, 0x1,
+ 3, 0x100,
+ 3, 0x80,
+ 3, 0x40,
+ 3, 0x20,
+ 3, 0x10,
+ 3, 0x8,
+ 3, 0x4,
+ 3, 0x2,
+ 3, 0x1,
+ 4, 0x20,
+ 4, 0x10,
+ 4, 0x8,
+ 4, 0x4,
+ 4, 0x2,
+ 4, 0x1
};
/* Homing frames for the decoder */
static const Word16 dhf_MR475[PRMNO_MR475] =
{
- 0x00F8,
- 0x009D,
- 0x001C,
- 0x0066,
- 0x0000,
- 0x0003,
- 0x0028,
- 0x000F,
- 0x0038,
- 0x0001,
- 0x000F,
- 0x0031,
- 0x0002,
- 0x0008,
- 0x000F,
- 0x0026,
- 0x0003
+ 0x00F8,
+ 0x009D,
+ 0x001C,
+ 0x0066,
+ 0x0000,
+ 0x0003,
+ 0x0028,
+ 0x000F,
+ 0x0038,
+ 0x0001,
+ 0x000F,
+ 0x0031,
+ 0x0002,
+ 0x0008,
+ 0x000F,
+ 0x0026,
+ 0x0003
};
static const Word16 dhf_MR515[PRMNO_MR515] =
{
- 0x00F8,
- 0x009D,
- 0x001C,
- 0x0066,
- 0x0000,
- 0x0003,
- 0x0037,
- 0x000F,
- 0x0000,
- 0x0003,
- 0x0005,
- 0x000F,
- 0x0037,
- 0x0003,
- 0x0037,
- 0x000F,
- 0x0023,
- 0x0003,
- 0x001F
+ 0x00F8,
+ 0x009D,
+ 0x001C,
+ 0x0066,
+ 0x0000,
+ 0x0003,
+ 0x0037,
+ 0x000F,
+ 0x0000,
+ 0x0003,
+ 0x0005,
+ 0x000F,
+ 0x0037,
+ 0x0003,
+ 0x0037,
+ 0x000F,
+ 0x0023,
+ 0x0003,
+ 0x001F
};
static const Word16 dhf_MR59[PRMNO_MR59] =
{
- 0x00F8,
- 0x00E3,
- 0x002F,
- 0x00BD,
- 0x0000,
- 0x0003,
- 0x0037,
- 0x000F,
- 0x0001,
- 0x0003,
- 0x000F,
- 0x0060,
- 0x00F9,
- 0x0003,
- 0x0037,
- 0x000F,
- 0x0000,
- 0x0003,
- 0x0037
+ 0x00F8,
+ 0x00E3,
+ 0x002F,
+ 0x00BD,
+ 0x0000,
+ 0x0003,
+ 0x0037,
+ 0x000F,
+ 0x0001,
+ 0x0003,
+ 0x000F,
+ 0x0060,
+ 0x00F9,
+ 0x0003,
+ 0x0037,
+ 0x000F,
+ 0x0000,
+ 0x0003,
+ 0x0037
};
static const Word16 dhf_MR67[PRMNO_MR67] =
{
- 0x00F8,
- 0x00E3,
- 0x002F,
- 0x00BD,
- 0x0002,
- 0x0007,
- 0x0000,
- 0x000F,
- 0x0098,
- 0x0007,
- 0x0061,
- 0x0060,
- 0x05C5,
- 0x0007,
- 0x0000,
- 0x000F,
- 0x0318,
- 0x0007,
- 0x0000
+ 0x00F8,
+ 0x00E3,
+ 0x002F,
+ 0x00BD,
+ 0x0002,
+ 0x0007,
+ 0x0000,
+ 0x000F,
+ 0x0098,
+ 0x0007,
+ 0x0061,
+ 0x0060,
+ 0x05C5,
+ 0x0007,
+ 0x0000,
+ 0x000F,
+ 0x0318,
+ 0x0007,
+ 0x0000
};
static const Word16 dhf_MR74[PRMNO_MR74] =
{
- 0x00F8,
- 0x00E3,
- 0x002F,
- 0x00BD,
- 0x0006,
- 0x000F,
- 0x0000,
- 0x001B,
- 0x0208,
- 0x000F,
- 0x0062,
- 0x0060,
- 0x1BA6,
- 0x000F,
- 0x0000,
- 0x001B,
- 0x0006,
- 0x000F,
- 0x0000
+ 0x00F8,
+ 0x00E3,
+ 0x002F,
+ 0x00BD,
+ 0x0006,
+ 0x000F,
+ 0x0000,
+ 0x001B,
+ 0x0208,
+ 0x000F,
+ 0x0062,
+ 0x0060,
+ 0x1BA6,
+ 0x000F,
+ 0x0000,
+ 0x001B,
+ 0x0006,
+ 0x000F,
+ 0x0000
};
static const Word16 dhf_MR795[PRMNO_MR795] =
{
- 0x00C2,
- 0x00E3,
- 0x002F,
- 0x00BD,
- 0x0006,
- 0x000F,
- 0x000A,
- 0x0000,
- 0x0039,
- 0x1C08,
- 0x0007,
- 0x000A,
- 0x000B,
- 0x0063,
- 0x11A6,
- 0x000F,
- 0x0001,
- 0x0000,
- 0x0039,
- 0x09A0,
- 0x000F,
- 0x0002,
- 0x0001
+ 0x00C2,
+ 0x00E3,
+ 0x002F,
+ 0x00BD,
+ 0x0006,
+ 0x000F,
+ 0x000A,
+ 0x0000,
+ 0x0039,
+ 0x1C08,
+ 0x0007,
+ 0x000A,
+ 0x000B,
+ 0x0063,
+ 0x11A6,
+ 0x000F,
+ 0x0001,
+ 0x0000,
+ 0x0039,
+ 0x09A0,
+ 0x000F,
+ 0x0002,
+ 0x0001
};
static const Word16 dhf_MR102[PRMNO_MR102] =
{
- 0x00F8,
- 0x00E3,
- 0x002F,
- 0x0045,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x001B,
- 0x0000,
- 0x0001,
- 0x0000,
- 0x0001,
- 0x0326,
- 0x00CE,
- 0x007E,
- 0x0051,
- 0x0062,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x015A,
- 0x0359,
- 0x0076,
- 0x0000,
- 0x001B,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x017C,
- 0x0215,
- 0x0038,
- 0x0030
+ 0x00F8,
+ 0x00E3,
+ 0x002F,
+ 0x0045,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x001B,
+ 0x0000,
+ 0x0001,
+ 0x0000,
+ 0x0001,
+ 0x0326,
+ 0x00CE,
+ 0x007E,
+ 0x0051,
+ 0x0062,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x015A,
+ 0x0359,
+ 0x0076,
+ 0x0000,
+ 0x001B,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x017C,
+ 0x0215,
+ 0x0038,
+ 0x0030
};
static const Word16 dhf_MR122[PRMNO_MR122] =
{
- 0x0004,
- 0x002A,
- 0x00DB,
- 0x0096,
- 0x002A,
- 0x0156,
- 0x000B,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0036,
- 0x000B,
- 0x0000,
- 0x000F,
- 0x000E,
- 0x000C,
- 0x000D,
- 0x0000,
- 0x0001,
- 0x0005,
- 0x0007,
- 0x0001,
- 0x0008,
- 0x0024,
- 0x0000,
- 0x0001,
- 0x0000,
- 0x0005,
- 0x0006,
- 0x0001,
- 0x0002,
- 0x0004,
- 0x0007,
- 0x0004,
- 0x0002,
- 0x0003,
- 0x0036,
- 0x000B,
- 0x0000,
- 0x0002,
- 0x0004,
- 0x0000,
- 0x0003,
- 0x0006,
- 0x0001,
- 0x0007,
- 0x0006,
- 0x0005,
- 0x0000
+ 0x0004,
+ 0x002A,
+ 0x00DB,
+ 0x0096,
+ 0x002A,
+ 0x0156,
+ 0x000B,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0036,
+ 0x000B,
+ 0x0000,
+ 0x000F,
+ 0x000E,
+ 0x000C,
+ 0x000D,
+ 0x0000,
+ 0x0001,
+ 0x0005,
+ 0x0007,
+ 0x0001,
+ 0x0008,
+ 0x0024,
+ 0x0000,
+ 0x0001,
+ 0x0000,
+ 0x0005,
+ 0x0006,
+ 0x0001,
+ 0x0002,
+ 0x0004,
+ 0x0007,
+ 0x0004,
+ 0x0002,
+ 0x0003,
+ 0x0036,
+ 0x000B,
+ 0x0000,
+ 0x0002,
+ 0x0004,
+ 0x0000,
+ 0x0003,
+ 0x0006,
+ 0x0001,
+ 0x0007,
+ 0x0006,
+ 0x0005,
+ 0x0000
};
/* parameter sizes (# of bits), one table per mode */
static const Word16 bitno_MR475[PRMNO_MR475] =
{
- 8, 8, 7, /* LSP VQ */
- 8, 7, 2, 8, /* first subframe */
- 4, 7, 2, /* second subframe */
- 4, 7, 2, 8, /* third subframe */
- 4, 7, 2 /* fourth subframe */
+ 8, 8, 7, /* LSP VQ */
+ 8, 7, 2, 8, /* first subframe */
+ 4, 7, 2, /* second subframe */
+ 4, 7, 2, 8, /* third subframe */
+ 4, 7, 2 /* fourth subframe */
};
static const Word16 bitno_MR515[PRMNO_MR515] =
{
- 8, 8, 7, /* LSP VQ */
- 8, 7, 2, 6, /* first subframe */
- 4, 7, 2, 6, /* second subframe */
- 4, 7, 2, 6, /* third subframe */
- 4, 7, 2, 6 /* fourth subframe */
+ 8, 8, 7, /* LSP VQ */
+ 8, 7, 2, 6, /* first subframe */
+ 4, 7, 2, 6, /* second subframe */
+ 4, 7, 2, 6, /* third subframe */
+ 4, 7, 2, 6 /* fourth subframe */
};
static const Word16 bitno_MR59[PRMNO_MR59] =
{
- 8, 9, 9, /* LSP VQ */
- 8, 9, 2, 6, /* first subframe */
- 4, 9, 2, 6, /* second subframe */
- 8, 9, 2, 6, /* third subframe */
- 4, 9, 2, 6 /* fourth subframe */
+ 8, 9, 9, /* LSP VQ */
+ 8, 9, 2, 6, /* first subframe */
+ 4, 9, 2, 6, /* second subframe */
+ 8, 9, 2, 6, /* third subframe */
+ 4, 9, 2, 6 /* fourth subframe */
};
static const Word16 bitno_MR67[PRMNO_MR67] =
{
- 8, 9, 9, /* LSP VQ */
- 8, 11, 3, 7, /* first subframe */
- 4, 11, 3, 7, /* second subframe */
- 8, 11, 3, 7, /* third subframe */
- 4, 11, 3, 7 /* fourth subframe */
+ 8, 9, 9, /* LSP VQ */
+ 8, 11, 3, 7, /* first subframe */
+ 4, 11, 3, 7, /* second subframe */
+ 8, 11, 3, 7, /* third subframe */
+ 4, 11, 3, 7 /* fourth subframe */
};
static const Word16 bitno_MR74[PRMNO_MR74] =
{
- 8, 9, 9, /* LSP VQ */
- 8, 13, 4, 7, /* first subframe */
- 5, 13, 4, 7, /* second subframe */
- 8, 13, 4, 7, /* third subframe */
- 5, 13, 4, 7 /* fourth subframe */
+ 8, 9, 9, /* LSP VQ */
+ 8, 13, 4, 7, /* first subframe */
+ 5, 13, 4, 7, /* second subframe */
+ 8, 13, 4, 7, /* third subframe */
+ 5, 13, 4, 7 /* fourth subframe */
};
static const Word16 bitno_MR795[PRMNO_MR795] =
{
- 9, 9, 9, /* LSP VQ */
- 8, 13, 4, 4, 5, /* first subframe */
- 6, 13, 4, 4, 5, /* second subframe */
- 8, 13, 4, 4, 5, /* third subframe */
- 6, 13, 4, 4, 5 /* fourth subframe */
+ 9, 9, 9, /* LSP VQ */
+ 8, 13, 4, 4, 5, /* first subframe */
+ 6, 13, 4, 4, 5, /* second subframe */
+ 8, 13, 4, 4, 5, /* third subframe */
+ 6, 13, 4, 4, 5 /* fourth subframe */
};
static const Word16 bitno_MR102[PRMNO_MR102] =
{
- 8, 9, 9, /* LSP VQ */
- 8, 1, 1, 1, 1, 10, 10, 7, 7, /* first subframe */
- 5, 1, 1, 1, 1, 10, 10, 7, 7, /* second subframe */
- 8, 1, 1, 1, 1, 10, 10, 7, 7, /* third subframe */
- 5, 1, 1, 1, 1, 10, 10, 7, 7 /* fourth subframe */
+ 8, 9, 9, /* LSP VQ */
+ 8, 1, 1, 1, 1, 10, 10, 7, 7, /* first subframe */
+ 5, 1, 1, 1, 1, 10, 10, 7, 7, /* second subframe */
+ 8, 1, 1, 1, 1, 10, 10, 7, 7, /* third subframe */
+ 5, 1, 1, 1, 1, 10, 10, 7, 7 /* fourth subframe */
};
static const Word16 bitno_MR122[PRMNO_MR122] =
{
- 7, 8, 9, 8, 6, /* LSP VQ */
- 9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* first subframe */
- 6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* second subframe */
- 9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* third subframe */
- 6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5 /* fourth subframe */
+ 7, 8, 9, 8, 6, /* LSP VQ */
+ 9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* first subframe */
+ 6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* second subframe */
+ 9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* third subframe */
+ 6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5 /* fourth subframe */
};
static const Word16 bitno_MRDTX[PRMNO_MRDTX] =
{
- 3, 8, 9, 9, 6
+ 3, 8, 9, 9, 6
};
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/rom_dec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/rom_dec.h
index 3a2b84c7a..49e2155e3 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/rom_dec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/rom_dec.h
@@ -112,98 +112,98 @@
/* level adjustment for different modes Q11 */
static const Word16 dtx_log_en_adjust[9] =
{
- - 1023,
- /* MR475 */ - 878,
- /* MR515 */ - 732,
- /* MR59 */ - 586,
- /* MR67 */ - 440,
- /* MR74 */ - 294,
- /* MR795 */ - 148,
- /* MR102 */ 0,
- /* MR122 */ 0,
- /* MRDTX */
+ - 1023,
+ /* MR475 */ - 878,
+ /* MR515 */ - 732,
+ /* MR59 */ - 586,
+ /* MR67 */ - 440,
+ /* MR74 */ - 294,
+ /* MR795 */ - 148,
+ /* MR102 */ 0,
+ /* MR122 */ 0,
+ /* MRDTX */
};
/* attenuation factors for codebook gain */
static const Word32 cdown[7] =
-{
- 32767,
- 32112,
- 32112,
- 32112,
- 32112,
- 32112,
- 22937
-};
+ {
+ 32767,
+ 32112,
+ 32112,
+ 32112,
+ 32112,
+ 32112,
+ 22937
+ };
/* attenuation factors for adaptive codebook gain */
static const Word32 pdown[7] =
-{
- 32767,
- 32112,
- 32112,
- 26214,
- 9830,
- 6553,
- 6553
-};
+ {
+ 32767,
+ 32112,
+ 32112,
+ 26214,
+ 9830,
+ 6553,
+ 6553
+ };
/* algebraic code book gain MA predictor coefficients */
static const Word32 pred[NPRED] =
{
- 5571,
- 4751,
- 2785,
- 1556
+ 5571,
+ 4751,
+ 2785,
+ 1556
};
/* algebraic code book gain MA predictor coefficients (MR122) */
static const Word32 pred_MR122[NPRED] =
{
- 44,
- 37,
- 22,
- 12
+ 44,
+ 37,
+ 22,
+ 12
};
static const Word32 gamma4_gamma3_MR122[M] =
{
- 22938,
- 16057,
- 11240,
- 7868,
- 5508,
- 3856,
- 2699,
- 1889,
- 1322,
- 925
+ 22938,
+ 16057,
+ 11240,
+ 7868,
+ 5508,
+ 3856,
+ 2699,
+ 1889,
+ 1322,
+ 925
};
static const Word32 gamma3[M] =
{
- 18022,
- 9912,
- 5451,
- 2998,
- 1649,
- 907,
- 499,
- 274,
- 151,
- 83
+ 18022,
+ 9912,
+ 5451,
+ 2998,
+ 1649,
+ 907,
+ 499,
+ 274,
+ 151,
+ 83
};
static const Word32 gamma4_MR122[M] =
{
- 24576,
- 18432,
- 13824,
- 10368,
- 7776,
- 5832,
- 4374,
- 3281,
- 2461,
- 1846
+ 24576,
+ 18432,
+ 13824,
+ 10368,
+ 7776,
+ 5832,
+ 4374,
+ 3281,
+ 2461,
+ 1846
};
@@ -211,663 +211,663 @@ static const Word32 gamma4_MR122[M] =
#define NB_QUA_PITCH 16
static const Word32 qua_gain_pitch[NB_QUA_PITCH] =
{
- 0,
- 3277,
- 6556,
- 8192,
- 9830,
- 11469,
- 12288,
- 13107,
- 13926,
- 14746,
- 15565,
- 16384,
- 17203,
- 18022,
- 18842,
- 19661
+ 0,
+ 3277,
+ 6556,
+ 8192,
+ 9830,
+ 11469,
+ 12288,
+ 13107,
+ 13926,
+ 14746,
+ 15565,
+ 16384,
+ 17203,
+ 18022,
+ 18842,
+ 19661
};
/* fixed codebook gain quantization table (MR122, MR795) */
#define NB_QUA_CODE 32
static const Word32 qua_gain_code[NB_QUA_CODE * 3] =
{
- /* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
- * are stored:
- *
- * qua_ener_MR122 = log2(g_fac) (not the rounded floating point value, but
- * the value the original EFR algorithm
- * calculates from g_fac [using Log2])
- * qua_ener = 20*log10(g_fac); (rounded floating point value)
- *
- *
- * g_fac (Q11),
- * qua_ener_MR122 (Q10),
- * qua_ener (Q10)
- */ 159,
- - 3776,
- - 22731,
- 206,
- - 3394,
- - 20428,
- 268,
- - 3005,
- - 18088,
- 349,
- - 2615,
- - 15739,
- 419,
- - 2345,
- - 14113,
- 482,
- - 2138,
- - 12867,
- 554,
- - 1932,
- - 11629,
- 637,
- - 1726,
- - 10387,
- 733,
- - 1518,
- - 9139,
- 842,
- - 1314,
- - 7906,
- 969,
- - 1106,
- - 6656,
- 1114,
- - 900,
- - 5416,
- 1281,
- - 694,
- - 4173,
- 1473,
- - 487,
- - 2931,
- 1694,
- - 281,
- - 1688,
- 1948,
- - 75,
- - 445,
- 2241,
- 133,
- 801,
- 2577,
- 339,
- 2044,
- 2963,
- 545,
- 3285,
- 3408,
- 752,
- 4530,
- 3919,
- 958,
- 5772,
- 4507,
- 1165,
- 7016,
- 5183,
- 1371,
- 8259,
- 5960,
- 1577,
- 9501,
- 6855,
- 1784,
- 10745,
- 7883,
- 1991,
- 11988,
- 9065,
- 2197,
- 13231,
- 10425,
- 2404,
- 14474,
- 12510,
- 2673,
- 16096,
- 16263,
- 3060,
- 18429,
- 21142,
- 3448,
- 20763,
- 27485,
- 3836,
- 23097
+/* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
+ * are stored:
+ *
+ * qua_ener_MR122 = log2(g_fac) (not the rounded floating point value, but
+ * the value the original EFR algorithm
+ * calculates from g_fac [using Log2])
+ * qua_ener = 20*log10(g_fac); (rounded floating point value)
+ *
+ *
+ * g_fac (Q11),
+ * qua_ener_MR122 (Q10),
+ * qua_ener (Q10)
+ */ 159,
+ - 3776,
+ - 22731,
+ 206,
+ - 3394,
+ - 20428,
+ 268,
+ - 3005,
+ - 18088,
+ 349,
+ - 2615,
+ - 15739,
+ 419,
+ - 2345,
+ - 14113,
+ 482,
+ - 2138,
+ - 12867,
+ 554,
+ - 1932,
+ - 11629,
+ 637,
+ - 1726,
+ - 10387,
+ 733,
+ - 1518,
+ - 9139,
+ 842,
+ - 1314,
+ - 7906,
+ 969,
+ - 1106,
+ - 6656,
+ 1114,
+ - 900,
+ - 5416,
+ 1281,
+ - 694,
+ - 4173,
+ 1473,
+ - 487,
+ - 2931,
+ 1694,
+ - 281,
+ - 1688,
+ 1948,
+ - 75,
+ - 445,
+ 2241,
+ 133,
+ 801,
+ 2577,
+ 339,
+ 2044,
+ 2963,
+ 545,
+ 3285,
+ 3408,
+ 752,
+ 4530,
+ 3919,
+ 958,
+ 5772,
+ 4507,
+ 1165,
+ 7016,
+ 5183,
+ 1371,
+ 8259,
+ 5960,
+ 1577,
+ 9501,
+ 6855,
+ 1784,
+ 10745,
+ 7883,
+ 1991,
+ 11988,
+ 9065,
+ 2197,
+ 13231,
+ 10425,
+ 2404,
+ 14474,
+ 12510,
+ 2673,
+ 16096,
+ 16263,
+ 3060,
+ 18429,
+ 21142,
+ 3448,
+ 20763,
+ 27485,
+ 3836,
+ 23097
};
/* gray coding table */
static const Word8 gray[8] =
{
- 0,
- 1,
- 3,
- 2,
- 6,
- 4,
- 5,
- 7
+ 0,
+ 1,
+ 3,
+ 2,
+ 6,
+ 4,
+ 5,
+ 7
};
/* gray decoding table */
static const Word32 dgray[8] =
{
- 0,
- 1,
- 3,
- 2,
- 5,
- 6,
- 4,
- 7
+ 0,
+ 1,
+ 3,
+ 2,
+ 5,
+ 6,
+ 4,
+ 7
};
/* table[i] = sqrt((i+16)*2^-6) * 2^15, i.e. sqrt(x) scaled Q15 */
static const Word32 sqrt_table[49] =
{
- 16384,
- 16888,
- 17378,
- 17854,
- 18318,
- 18770,
- 19212,
- 19644,
- 20066,
- 20480,
- 20886,
- 21283,
- 21674,
- 22058,
- 22435,
- 22806,
- 23170,
- 23530,
- 23884,
- 24232,
- 24576,
- 24915,
- 25249,
- 25580,
- 25905,
- 26227,
- 26545,
- 26859,
- 27170,
- 27477,
- 27780,
- 28081,
- 28378,
- 28672,
- 28963,
- 29251,
- 29537,
- 29819,
- 30099,
- 30377,
- 30652,
- 30924,
- 31194,
- 31462,
- 31727,
- 31991,
- 32252,
- 32511,
- 32767
+ 16384,
+ 16888,
+ 17378,
+ 17854,
+ 18318,
+ 18770,
+ 19212,
+ 19644,
+ 20066,
+ 20480,
+ 20886,
+ 21283,
+ 21674,
+ 22058,
+ 22435,
+ 22806,
+ 23170,
+ 23530,
+ 23884,
+ 24232,
+ 24576,
+ 24915,
+ 25249,
+ 25580,
+ 25905,
+ 26227,
+ 26545,
+ 26859,
+ 27170,
+ 27477,
+ 27780,
+ 28081,
+ 28378,
+ 28672,
+ 28963,
+ 29251,
+ 29537,
+ 29819,
+ 30099,
+ 30377,
+ 30652,
+ 30924,
+ 31194,
+ 31462,
+ 31727,
+ 31991,
+ 32252,
+ 32511,
+ 32767
};
static const Word32 inv_sqrt_table[49] =
{
- 32767,
- 31790,
- 30894,
- 30070,
- 29309,
- 28602,
- 27945,
- 27330,
- 26755,
- 26214,
- 25705,
- 25225,
- 24770,
- 24339,
- 23930,
- 23541,
- 23170,
- 22817,
- 22479,
- 22155,
- 21845,
- 21548,
- 21263,
- 20988,
- 20724,
- 20470,
- 20225,
- 19988,
- 19760,
- 19539,
- 19326,
- 19119,
- 18919,
- 18725,
- 18536,
- 18354,
- 18176,
- 18004,
- 17837,
- 17674,
- 17515,
- 17361,
- 17211,
- 17064,
- 16921,
- 16782,
- 16646,
- 16514,
- 16384
+ 32767,
+ 31790,
+ 30894,
+ 30070,
+ 29309,
+ 28602,
+ 27945,
+ 27330,
+ 26755,
+ 26214,
+ 25705,
+ 25225,
+ 24770,
+ 24339,
+ 23930,
+ 23541,
+ 23170,
+ 22817,
+ 22479,
+ 22155,
+ 21845,
+ 21548,
+ 21263,
+ 20988,
+ 20724,
+ 20470,
+ 20225,
+ 19988,
+ 19760,
+ 19539,
+ 19326,
+ 19119,
+ 18919,
+ 18725,
+ 18536,
+ 18354,
+ 18176,
+ 18004,
+ 17837,
+ 17674,
+ 17515,
+ 17361,
+ 17211,
+ 17064,
+ 16921,
+ 16782,
+ 16646,
+ 16514,
+ 16384
};
/* table used inbase 2 logharithm computation */
static const Word32 log2_table[33] =
{
- 0,
- 1455,
- 2866,
- 4236,
- 5568,
- 6863,
- 8124,
- 9352,
- 10549,
- 11716,
- 12855,
- 13967,
- 15054,
- 16117,
- 17156,
- 18172,
- 19167,
- 20142,
- 21097,
- 22033,
- 22951,
- 23852,
- 24735,
- 25603,
- 26455,
- 27291,
- 28113,
- 28922,
- 29716,
- 30497,
- 31266,
- 32023,
- 32767
+ 0,
+ 1455,
+ 2866,
+ 4236,
+ 5568,
+ 6863,
+ 8124,
+ 9352,
+ 10549,
+ 11716,
+ 12855,
+ 13967,
+ 15054,
+ 16117,
+ 17156,
+ 18172,
+ 19167,
+ 20142,
+ 21097,
+ 22033,
+ 22951,
+ 23852,
+ 24735,
+ 25603,
+ 26455,
+ 27291,
+ 28113,
+ 28922,
+ 29716,
+ 30497,
+ 31266,
+ 32023,
+ 32767
};
/* table used in 2 to the power computation */
static const Word32 pow2_table[33] =
{
- 16384,
- 16743,
- 17109,
- 17484,
- 17867,
- 18258,
- 18658,
- 19066,
- 19484,
- 19911,
- 20347,
- 20792,
- 21247,
- 21713,
- 22188,
- 22674,
- 23170,
- 23678,
- 24196,
- 24726,
- 25268,
- 25821,
- 26386,
- 26964,
- 27554,
- 28158,
- 28774,
- 29405,
- 30048,
- 30706,
- 31379,
- 32066,
- 32767
+ 16384,
+ 16743,
+ 17109,
+ 17484,
+ 17867,
+ 18258,
+ 18658,
+ 19066,
+ 19484,
+ 19911,
+ 20347,
+ 20792,
+ 21247,
+ 21713,
+ 22188,
+ 22674,
+ 23170,
+ 23678,
+ 24196,
+ 24726,
+ 25268,
+ 25821,
+ 26386,
+ 26964,
+ 27554,
+ 28158,
+ 28774,
+ 29405,
+ 30048,
+ 30706,
+ 31379,
+ 32066,
+ 32767
};
/* table of cos(x) */
static const Word32 cos_table[65] =
{
- 32767,
- 32729,
- 32610,
- 32413,
- 32138,
- 31786,
- 31357,
- 30853,
- 30274,
- 29622,
- 28899,
- 28106,
- 27246,
- 26320,
- 25330,
- 24279,
- 23170,
- 22006,
- 20788,
- 19520,
- 18205,
- 16846,
- 15447,
- 14010,
- 12540,
- 11039,
- 9512,
- 7962,
- 6393,
- 4808,
- 3212,
- 1608,
- 0,
- - 1608,
- - 3212,
- - 4808,
- - 6393,
- - 7962,
- - 9512,
- - 11039,
- - 12540,
- - 14010,
- - 15447,
- - 16846,
- - 18205,
- - 19520,
- - 20788,
- - 22006,
- - 23170,
- - 24279,
- - 25330,
- - 26320,
- - 27246,
- - 28106,
- - 28899,
- - 29622,
- - 30274,
- - 30853,
- - 31357,
- - 31786,
- - 32138,
- - 32413,
- - 32610,
- - 32729,
- - 32768
+ 32767,
+ 32729,
+ 32610,
+ 32413,
+ 32138,
+ 31786,
+ 31357,
+ 30853,
+ 30274,
+ 29622,
+ 28899,
+ 28106,
+ 27246,
+ 26320,
+ 25330,
+ 24279,
+ 23170,
+ 22006,
+ 20788,
+ 19520,
+ 18205,
+ 16846,
+ 15447,
+ 14010,
+ 12540,
+ 11039,
+ 9512,
+ 7962,
+ 6393,
+ 4808,
+ 3212,
+ 1608,
+ 0,
+ - 1608,
+ - 3212,
+ - 4808,
+ - 6393,
+ - 7962,
+ - 9512,
+ - 11039,
+ - 12540,
+ - 14010,
+ - 15447,
+ - 16846,
+ - 18205,
+ - 19520,
+ - 20788,
+ - 22006,
+ - 23170,
+ - 24279,
+ - 25330,
+ - 26320,
+ - 27246,
+ - 28106,
+ - 28899,
+ - 29622,
+ - 30274,
+ - 30853,
+ - 31357,
+ - 31786,
+ - 32138,
+ - 32413,
+ - 32610,
+ - 32729,
+ - 32768
};
/* slope used to compute y = acos(x) */
static const Word32 acos_slope[64] =
{
- - 26887,
- - 8812,
- - 5323,
- - 3813,
- - 2979,
- - 2444,
- - 2081,
- - 1811,
- - 1608,
- - 1450,
- - 1322,
- - 1219,
- - 1132,
- - 1059,
- - 998,
- - 946,
- - 901,
- - 861,
- - 827,
- - 797,
- - 772,
- - 750,
- - 730,
- - 713,
- - 699,
- - 687,
- - 677,
- - 668,
- - 662,
- - 657,
- - 654,
- - 652,
- - 652,
- - 654,
- - 657,
- - 662,
- - 668,
- - 677,
- - 687,
- - 699,
- - 713,
- - 730,
- - 750,
- - 772,
- - 797,
- - 827,
- - 861,
- - 901,
- - 946,
- - 998,
- - 1059,
- - 1132,
- - 1219,
- - 1322,
- - 1450,
- - 1608,
- - 1811,
- - 2081,
- - 2444,
- - 2979,
- - 3813,
- - 5323,
- - 8812,
- - 26887
+ - 26887,
+ - 8812,
+ - 5323,
+ - 3813,
+ - 2979,
+ - 2444,
+ - 2081,
+ - 1811,
+ - 1608,
+ - 1450,
+ - 1322,
+ - 1219,
+ - 1132,
+ - 1059,
+ - 998,
+ - 946,
+ - 901,
+ - 861,
+ - 827,
+ - 797,
+ - 772,
+ - 750,
+ - 730,
+ - 713,
+ - 699,
+ - 687,
+ - 677,
+ - 668,
+ - 662,
+ - 657,
+ - 654,
+ - 652,
+ - 652,
+ - 654,
+ - 657,
+ - 662,
+ - 668,
+ - 677,
+ - 687,
+ - 699,
+ - 713,
+ - 730,
+ - 750,
+ - 772,
+ - 797,
+ - 827,
+ - 861,
+ - 901,
+ - 946,
+ - 998,
+ - 1059,
+ - 1132,
+ - 1219,
+ - 1322,
+ - 1450,
+ - 1608,
+ - 1811,
+ - 2081,
+ - 2444,
+ - 2979,
+ - 3813,
+ - 5323,
+ - 8812,
+ - 26887
};
/* All impulse responses are in Q15 */
/* phase dispersion impulse response (MR795) */
static const Word32 ph_imp_low_MR795[] =
{
- 26777,
- 801,
- 2505,
- - 683,
- - 1382,
- 582,
- 604,
- - 1274,
- 3511,
- - 5894,
- 4534,
- - 499,
- - 1940,
- 3011,
- - 5058,
- 5614,
- - 1990,
- - 1061,
- - 1459,
- 4442,
- - 700,
- - 5335,
- 4609,
- 452,
- - 589,
- - 3352,
- 2953,
- 1267,
- - 1212,
- - 2590,
- 1731,
- 3670,
- - 4475,
- - 975,
- 4391,
- - 2537,
- 949,
- - 1363,
- - 979,
- 5734
+ 26777,
+ 801,
+ 2505,
+ - 683,
+ - 1382,
+ 582,
+ 604,
+ - 1274,
+ 3511,
+ - 5894,
+ 4534,
+ - 499,
+ - 1940,
+ 3011,
+ - 5058,
+ 5614,
+ - 1990,
+ - 1061,
+ - 1459,
+ 4442,
+ - 700,
+ - 5335,
+ 4609,
+ 452,
+ - 589,
+ - 3352,
+ 2953,
+ 1267,
+ - 1212,
+ - 2590,
+ 1731,
+ 3670,
+ - 4475,
+ - 975,
+ 4391,
+ - 2537,
+ 949,
+ - 1363,
+ - 979,
+ 5734
};
/* phase dispersion impulse response (MR795) */
static const Word32 ph_imp_mid_MR795[] =
{
- 30274,
- 3831,
- - 4036,
- 2972,
- - 1048,
- - 1002,
- 2477,
- - 3043,
- 2815,
- - 2231,
- 1753,
- - 1611,
- 1714,
- - 1775,
- 1543,
- - 1008,
- 429,
- - 169,
- 472,
- - 1264,
- 2176,
- - 2706,
- 2523,
- - 1621,
- 344,
- 826,
- - 1529,
- 1724,
- - 1657,
- 1701,
- - 2063,
- 2644,
- - 3060,
- 2897,
- - 1978,
- 557,
- 780,
- - 1369,
- 842,
- 655
+ 30274,
+ 3831,
+ - 4036,
+ 2972,
+ - 1048,
+ - 1002,
+ 2477,
+ - 3043,
+ 2815,
+ - 2231,
+ 1753,
+ - 1611,
+ 1714,
+ - 1775,
+ 1543,
+ - 1008,
+ 429,
+ - 169,
+ 472,
+ - 1264,
+ 2176,
+ - 2706,
+ 2523,
+ - 1621,
+ 344,
+ 826,
+ - 1529,
+ 1724,
+ - 1657,
+ 1701,
+ - 2063,
+ 2644,
+ - 3060,
+ 2897,
+ - 1978,
+ 557,
+ 780,
+ - 1369,
+ 842,
+ 655
};
/* phase dispersion impulse response (MR475 - MR67) */
static const Word32 ph_imp_low[] =
{
- 14690,
- 11518,
- 1268,
- - 2761,
- - 5671,
- 7514,
- - 35,
- - 2807,
- - 3040,
- 4823,
- 2952,
- - 8424,
- 3785,
- 1455,
- 2179,
- - 8637,
- 8051,
- - 2103,
- - 1454,
- 777,
- 1108,
- - 2385,
- 2254,
- - 363,
- - 674,
- - 2103,
- 6046,
- - 5681,
- 1072,
- 3123,
- - 5058,
- 5312,
- - 2329,
- - 3728,
- 6924,
- - 3889,
- 675,
- - 1775,
- 29,
- 10145
+ 14690,
+ 11518,
+ 1268,
+ - 2761,
+ - 5671,
+ 7514,
+ - 35,
+ - 2807,
+ - 3040,
+ 4823,
+ 2952,
+ - 8424,
+ 3785,
+ 1455,
+ 2179,
+ - 8637,
+ 8051,
+ - 2103,
+ - 1454,
+ 777,
+ 1108,
+ - 2385,
+ 2254,
+ - 363,
+ - 674,
+ - 2103,
+ 6046,
+ - 5681,
+ 1072,
+ 3123,
+ - 5058,
+ 5312,
+ - 2329,
+ - 3728,
+ 6924,
+ - 3889,
+ 675,
+ - 1775,
+ 29,
+ 10145
};
/* phase dispersion impulse response (MR475 - MR67) */
static const Word32 ph_imp_mid[] =
{
- 30274,
- 3831,
- - 4036,
- 2972,
- - 1048,
- - 1002,
- 2477,
- - 3043,
- 2815,
- - 2231,
- 1753,
- - 1611,
- 1714,
- - 1775,
- 1543,
- - 1008,
- 429,
- - 169,
- 472,
- - 1264,
- 2176,
- - 2706,
- 2523,
- - 1621,
- 344,
- 826,
- - 1529,
- 1724,
- - 1657,
- 1701,
- - 2063,
- 2644,
- - 3060,
- 2897,
- - 1978,
- 557,
- 780,
- - 1369,
- 842,
- 655
+ 30274,
+ 3831,
+ - 4036,
+ 2972,
+ - 1048,
+ - 1002,
+ 2477,
+ - 3043,
+ 2815,
+ - 2231,
+ 1753,
+ - 1611,
+ 1714,
+ - 1775,
+ 1543,
+ - 1008,
+ 429,
+ - 169,
+ 472,
+ - 1264,
+ 2176,
+ - 2706,
+ 2523,
+ - 1621,
+ 344,
+ 826,
+ - 1529,
+ 1724,
+ - 1657,
+ 1701,
+ - 2063,
+ 2644,
+ - 3060,
+ 2897,
+ - 1978,
+ 557,
+ 780,
+ - 1369,
+ 842,
+ 655
};
/* initialization table for the MA predictor in DTX */
@@ -876,86 +876,86 @@ static const Word32 ph_imp_mid[] =
/* initalization table for MA predictor in dtx mode */
static const Word32 past_rq_init[80] =
{
- - 258,
- - 318,
- - 439,
- - 634,
- - 656,
- - 773,
- - 711,
- - 502,
- - 268,
- - 193,
- - 2,
- 125,
- 122,
- - 39,
- - 9,
- 105,
- 129,
- 283,
- 372,
- 575,
- - 277,
- - 324,
- - 197,
- - 487,
- - 445,
- - 362,
- - 292,
- - 27,
- 177,
- 543,
- 342,
- 517,
- 516,
- 130,
- 27,
- - 104,
- - 120,
- - 140,
- - 74,
- - 56,
- - 564,
- - 943,
- - 1520,
- - 965,
- - 814,
- - 526,
- - 322,
- - 2,
- 159,
- 657,
- - 312,
- - 284,
- - 386,
- - 597,
- - 493,
- - 526,
- - 418,
- - 229,
- 105,
- 449,
- - 557,
- - 870,
- - 1075,
- - 919,
- - 950,
- - 752,
- - 709,
- - 316,
- 62,
- 486,
- - 314,
- - 191,
- - 203,
- - 330,
- - 160,
- - 103,
- - 51,
- 131,
- 338,
- 515
+ - 258,
+ - 318,
+ - 439,
+ - 634,
+ - 656,
+ - 773,
+ - 711,
+ - 502,
+ - 268,
+ - 193,
+ - 2,
+ 125,
+ 122,
+ - 39,
+ - 9,
+ 105,
+ 129,
+ 283,
+ 372,
+ 575,
+ - 277,
+ - 324,
+ - 197,
+ - 487,
+ - 445,
+ - 362,
+ - 292,
+ - 27,
+ 177,
+ 543,
+ 342,
+ 517,
+ 516,
+ 130,
+ 27,
+ - 104,
+ - 120,
+ - 140,
+ - 74,
+ - 56,
+ - 564,
+ - 943,
+ - 1520,
+ - 965,
+ - 814,
+ - 526,
+ - 322,
+ - 2,
+ 159,
+ 657,
+ - 312,
+ - 284,
+ - 386,
+ - 597,
+ - 493,
+ - 526,
+ - 418,
+ - 229,
+ 105,
+ 449,
+ - 557,
+ - 870,
+ - 1075,
+ - 919,
+ - 950,
+ - 752,
+ - 709,
+ - 316,
+ 62,
+ 486,
+ - 314,
+ - 191,
+ - 203,
+ - 330,
+ - 160,
+ - 103,
+ - 51,
+ 131,
+ 338,
+ 515
};
#define ALPHA 29491
@@ -963,16 +963,16 @@ static const Word32 past_rq_init[80] =
/* LSF means (not in MR122) */
static const Word32 mean_lsf_3[10] =
{
- 1546,
- 2272,
- 3778,
- 5488,
- 6972,
- 8382,
- 10047,
- 11229,
- 12766,
- 13714
+ 1546,
+ 2272,
+ 3778,
+ 5488,
+ 6972,
+ 8382,
+ 10047,
+ 11229,
+ 12766,
+ 13714
};
#define ALPHA_122 31128
@@ -980,31 +980,31 @@ static const Word32 mean_lsf_3[10] =
/* LSF means ->normalize frequency domain */
static const Word32 mean_lsf_5[10] =
{
- 1384,
- 2077,
- 3420,
- 5108,
- 6742,
- 8122,
- 9863,
- 11092,
- 12714,
- 13701
+ 1384,
+ 2077,
+ 3420,
+ 5108,
+ 6742,
+ 8122,
+ 9863,
+ 11092,
+ 12714,
+ 13701
};
/* LSF prediction factors (not in MR122) */
static const Word32 pred_fac[10] =
{
- 9556,
- 10769,
- 12571,
- 13292,
- 14381,
- 11651,
- 10588,
- 9767,
- 8593,
- 6484
+ 9556,
+ 10769,
+ 12571,
+ 13292,
+ 14381,
+ 11651,
+ 10588,
+ 9767,
+ 8593,
+ 6484
};
#define DICO1_SIZE_3 256
#define DICO2_SIZE_3 512
@@ -1013,6428 +1013,6428 @@ static const Word32 pred_fac[10] =
/* 1st LSF quantizer (not in MR122 and MR795) */
static const Word32 dico1_lsf_3[] =
{
- 6,
- 82,
- - 131,
- 154,
- - 56,
- - 735,
- 183,
- - 65,
- - 265,
- 9,
- - 210,
- - 361,
- 113,
- 718,
- 1817,
- 1010,
- 1214,
- 1573,
- 857,
- 1333,
- 2276,
- 827,
- 1568,
- 1933,
- 717,
- 1989,
- 2206,
- 838,
- 1172,
- 1823,
- 721,
- 1000,
- 2154,
- 286,
- 476,
- 1509,
- - 247,
- - 531,
- 230,
- 147,
- - 82,
- 569,
- 26,
- - 177,
- - 944,
- - 27,
- - 273,
- 692,
- - 164,
- - 264,
- - 183,
- 224,
- 790,
- 1039,
- 899,
- 946,
- 601,
- 485,
- 771,
- 1150,
- 524,
- 677,
- 903,
- - 140,
- 375,
- 778,
- 410,
- 676,
- 429,
- 301,
- 530,
- 1009,
- 719,
- 646,
- 38,
- 226,
- 367,
- 40,
- 145,
- - 45,
- - 505,
- 290,
- 121,
- - 121,
- 302,
- 127,
- 166,
- - 124,
- - 383,
- - 956,
- - 358,
- - 455,
- - 977,
- 715,
- 878,
- 894,
- 978,
- 923,
- 211,
- 477,
- 272,
- 64,
- 188,
- - 78,
- 17,
- - 143,
- - 65,
- 38,
- 643,
- 586,
- 621,
- - 134,
- - 426,
- - 651,
- 347,
- 545,
- 2820,
- 1188,
- 2726,
- 2442,
- 142,
- - 80,
- 1735,
- 283,
- 130,
- 461,
- - 262,
- - 399,
- - 1145,
- - 411,
- 155,
- 430,
- 329,
- 375,
- 779,
- 53,
- - 226,
- - 139,
- - 129,
- - 236,
- 1682,
- 285,
- 744,
- 1327,
- 738,
- 697,
- 1664,
- 312,
- 409,
- 266,
- 325,
- 720,
- 135,
- 1,
- 221,
- 453,
- 8,
- 203,
- 145,
- 299,
- 640,
- 760,
- 29,
- 468,
- 638,
- 103,
- 429,
- 379,
- 420,
- 954,
- 932,
- 1326,
- 1210,
- 1258,
- 704,
- 1012,
- 1152,
- - 166,
- - 444,
- - 266,
- - 316,
- - 130,
- - 376,
- 191,
- 1151,
- 1904,
- - 240,
- - 543,
- - 1260,
- - 112,
- 268,
- 1207,
- 70,
- 1062,
- 1583,
- 278,
- 1360,
- 1574,
- - 258,
- - 272,
- - 768,
- 19,
- 563,
- 2240,
- - 3,
- - 265,
- 135,
- - 295,
- - 591,
- - 388,
- 140,
- 354,
- - 206,
- - 260,
- - 504,
- - 795,
- - 433,
- - 718,
- - 1319,
- 109,
- 331,
- 962,
- - 429,
- - 87,
- 652,
- - 296,
- 426,
- 1019,
- - 239,
- 775,
- 851,
- 489,
- 1334,
- 1073,
- - 334,
- - 332,
- 25,
- 543,
- 1206,
- 1807,
- 326,
- 61,
- 727,
- 578,
- 849,
- 1405,
- - 208,
- - 277,
- 329,
- - 152,
- 64,
- 669,
- - 434,
- - 678,
- - 727,
- - 454,
- - 71,
- 251,
- 605,
- 480,
- 254,
- - 482,
- 11,
- 996,
- - 289,
- 395,
- 486,
- 722,
- 1049,
- 1440,
- - 30,
- - 316,
- - 786,
- - 106,
- - 115,
- - 619,
- 861,
- 1474,
- 1412,
- 1055,
- 1366,
- 1184,
- 812,
- 1237,
- 925,
- 42,
- - 251,
- - 576,
- 342,
- 141,
- - 454,
- - 168,
- - 80,
- 1359,
- - 342,
- - 656,
- - 1763,
- 100,
- 821,
- 725,
- 990,
- 747,
- 800,
- 332,
- 440,
- 568,
- 663,
- 379,
- 852,
- 112,
- 165,
- - 369,
- 597,
- 910,
- 282,
- - 8,
- 834,
- 1281,
- - 352,
- 572,
- 695,
- 462,
- 2246,
- 1806,
- 345,
- 190,
- 1374,
- 416,
- 915,
- 2166,
- 168,
- - 82,
- 280,
- - 516,
- - 446,
- 840,
- 47,
- 533,
- 44,
- - 362,
- - 711,
- - 1143,
- 22,
- 193,
- 1472,
- - 85,
- 233,
- 1813,
- - 62,
- 579,
- 1504,
- 550,
- 944,
- 1749,
- 723,
- 650,
- 1148,
- 972,
- 884,
- 1395,
- - 425,
- 643,
- 0,
- 1000,
- 952,
- 1098,
- 249,
- 1446,
- 672,
- - 334,
- - 87,
- 2172,
- - 554,
- 1882,
- 2672,
- 140,
- 1826,
- 1853,
- 920,
- 1749,
- 2590,
- 1076,
- 1933,
- 2038,
- - 137,
- - 443,
- - 1555,
- 1269,
- 1174,
- 468,
- - 493,
- - 122,
- 1521,
- - 451,
- 1033,
- 1214,
- 482,
- 1695,
- 1118,
- 815,
- 649,
- 384,
- - 446,
- - 692,
- 107,
- - 319,
- - 605,
- - 118,
- - 207,
- - 505,
- 525,
- - 468,
- - 12,
- 2736,
- 75,
- 1934,
- 1305,
- 880,
- 2358,
- 2267,
- 1285,
- 1575,
- 2004,
- - 48,
- - 304,
- - 1186,
- - 435,
- - 461,
- - 251,
- - 366,
- - 404,
- - 547,
- - 289,
- - 605,
- - 597,
- - 538,
- - 810,
- - 165,
- - 120,
- 3,
- 356,
- 639,
- 1241,
- 1502,
- 96,
- 177,
- 750,
- - 435,
- - 585,
- - 1174,
- - 356,
- 109,
- - 79,
- - 485,
- 288,
- 2005,
- 9,
- 1116,
- 731,
- 880,
- 2134,
- 946,
- - 265,
- 1585,
- 1065,
- 1157,
- 1210,
- 843,
- - 498,
- - 668,
- 431,
- 374,
- 321,
- - 229,
- 1440,
- 2101,
- 1381,
- 449,
- 461,
- 1155,
- - 105,
- 39,
- - 384,
- - 263,
- 367,
- 182,
- - 371,
- - 660,
- 773,
- - 188,
- 1151,
- 971,
- 1333,
- 1632,
- 1435,
- 774,
- 1267,
- 1221,
- - 482,
- - 832,
- - 1489,
- - 237,
- - 210,
- 860,
- 890,
- 1615,
- 1064,
- 472,
- 1062,
- 1192,
- 185,
- 1077,
- 989,
- - 568,
- - 992,
- - 1704,
- - 449,
- - 902,
- - 2043,
- - 142,
- - 377,
- - 458,
- - 210,
- - 554,
- - 1029,
- - 11,
- 1133,
- 2265,
- - 329,
- - 675,
- - 893,
- - 250,
- 657,
- 1187,
- 519,
- 1510,
- 1779,
- 520,
- 539,
- 1403,
- 527,
- 1421,
- 1302,
- - 563,
- - 871,
- - 1248,
- - 147,
- - 463,
- 879,
- - 76,
- 2334,
- 2840,
- 563,
- 2573,
- 2385,
- 632,
- 1926,
- 2920,
- 719,
- 2023,
- 1840,
- - 545,
- - 723,
- 1108,
- 129,
- - 125,
- 884,
- 1417,
- 1632,
- 925,
- - 94,
- 1566,
- 1751,
- - 341,
- 1533,
- 1551,
- 591,
- 395,
- - 274,
- - 76,
- 981,
- 2831,
- 153,
- 2985,
- 1844,
- 1032,
- 2565,
- 2749,
- 1508,
- 2832,
- 1879,
- 791,
- 1199,
- 538,
- - 190,
- - 453,
- 1489,
- - 278,
- - 548,
- 1158,
- - 245,
- 1941,
- 2044,
- 1024,
- 1560,
- 1650,
- 512,
- 253,
- 466,
- - 62,
- - 323,
- 1151,
- - 473,
- - 376,
- 507,
- - 433,
- 1380,
- 2162,
- 899,
- 1943,
- 1445,
- 134,
- 704,
- 440,
- 460,
- 525,
- - 28,
- - 450,
- 279,
- 1338,
- 0,
- 971,
- 252,
- - 445,
- - 627,
- - 991,
- - 348,
- - 602,
- - 1424,
- 398,
- 712,
- 1656,
- - 107,
- 314,
- - 178,
- 93,
- 2226,
- 2238,
- 518,
- 849,
- 656,
- - 462,
- - 711,
- - 447,
- 174,
- - 34,
- 1191,
- - 119,
- 42,
- 1005,
- - 372,
- 274,
- 758,
- 1036,
- 2352,
- 1838,
- 675,
- 1724,
- 1498,
- 430,
- 1286,
- 2133,
- - 129,
- - 439,
- 0,
- - 373,
- 800,
- 2144,
- 6,
- 1587,
- 2478,
- 478,
- 596,
- 2128,
- - 428,
- - 736,
- 1505,
- 385,
- 178,
- 980,
- 139,
- 449,
- 1225,
- - 526,
- - 842,
- - 982,
- 145,
- 1554,
- 1242,
- 623,
- 1448,
- 656,
- 349,
- 1016,
- 1482,
- 31,
- - 280,
- 415,
- - 316,
- 724,
- 1641,
- 360,
- 1058,
- 556,
- - 436,
- - 358,
- 1201,
- - 355,
- 1123,
- 1939,
- 401,
- 1584,
- 2248,
- - 527,
- - 1012,
- 355,
- 233,
- 238,
- 2233,
- - 550,
- - 897,
- - 639,
- - 365,
- - 501,
- 1957,
- 389,
- 1860,
- 1621,
- 162,
- 1132,
- 1264,
- - 237,
- 1174,
- 1390,
- - 640,
- - 411,
- 116,
- - 228,
- 1694,
- 2298,
- 1639,
- 2186,
- 2267,
- 562,
- 1273,
- 2658,
- 323,
- 338,
- 1774,
- 578,
- 1107,
- 852,
- 22,
- 594,
- 934,
- - 143,
- 718,
- 446
+ 6,
+ 82,
+ - 131,
+ 154,
+ - 56,
+ - 735,
+ 183,
+ - 65,
+ - 265,
+ 9,
+ - 210,
+ - 361,
+ 113,
+ 718,
+ 1817,
+ 1010,
+ 1214,
+ 1573,
+ 857,
+ 1333,
+ 2276,
+ 827,
+ 1568,
+ 1933,
+ 717,
+ 1989,
+ 2206,
+ 838,
+ 1172,
+ 1823,
+ 721,
+ 1000,
+ 2154,
+ 286,
+ 476,
+ 1509,
+ - 247,
+ - 531,
+ 230,
+ 147,
+ - 82,
+ 569,
+ 26,
+ - 177,
+ - 944,
+ - 27,
+ - 273,
+ 692,
+ - 164,
+ - 264,
+ - 183,
+ 224,
+ 790,
+ 1039,
+ 899,
+ 946,
+ 601,
+ 485,
+ 771,
+ 1150,
+ 524,
+ 677,
+ 903,
+ - 140,
+ 375,
+ 778,
+ 410,
+ 676,
+ 429,
+ 301,
+ 530,
+ 1009,
+ 719,
+ 646,
+ 38,
+ 226,
+ 367,
+ 40,
+ 145,
+ - 45,
+ - 505,
+ 290,
+ 121,
+ - 121,
+ 302,
+ 127,
+ 166,
+ - 124,
+ - 383,
+ - 956,
+ - 358,
+ - 455,
+ - 977,
+ 715,
+ 878,
+ 894,
+ 978,
+ 923,
+ 211,
+ 477,
+ 272,
+ 64,
+ 188,
+ - 78,
+ 17,
+ - 143,
+ - 65,
+ 38,
+ 643,
+ 586,
+ 621,
+ - 134,
+ - 426,
+ - 651,
+ 347,
+ 545,
+ 2820,
+ 1188,
+ 2726,
+ 2442,
+ 142,
+ - 80,
+ 1735,
+ 283,
+ 130,
+ 461,
+ - 262,
+ - 399,
+ - 1145,
+ - 411,
+ 155,
+ 430,
+ 329,
+ 375,
+ 779,
+ 53,
+ - 226,
+ - 139,
+ - 129,
+ - 236,
+ 1682,
+ 285,
+ 744,
+ 1327,
+ 738,
+ 697,
+ 1664,
+ 312,
+ 409,
+ 266,
+ 325,
+ 720,
+ 135,
+ 1,
+ 221,
+ 453,
+ 8,
+ 203,
+ 145,
+ 299,
+ 640,
+ 760,
+ 29,
+ 468,
+ 638,
+ 103,
+ 429,
+ 379,
+ 420,
+ 954,
+ 932,
+ 1326,
+ 1210,
+ 1258,
+ 704,
+ 1012,
+ 1152,
+ - 166,
+ - 444,
+ - 266,
+ - 316,
+ - 130,
+ - 376,
+ 191,
+ 1151,
+ 1904,
+ - 240,
+ - 543,
+ - 1260,
+ - 112,
+ 268,
+ 1207,
+ 70,
+ 1062,
+ 1583,
+ 278,
+ 1360,
+ 1574,
+ - 258,
+ - 272,
+ - 768,
+ 19,
+ 563,
+ 2240,
+ - 3,
+ - 265,
+ 135,
+ - 295,
+ - 591,
+ - 388,
+ 140,
+ 354,
+ - 206,
+ - 260,
+ - 504,
+ - 795,
+ - 433,
+ - 718,
+ - 1319,
+ 109,
+ 331,
+ 962,
+ - 429,
+ - 87,
+ 652,
+ - 296,
+ 426,
+ 1019,
+ - 239,
+ 775,
+ 851,
+ 489,
+ 1334,
+ 1073,
+ - 334,
+ - 332,
+ 25,
+ 543,
+ 1206,
+ 1807,
+ 326,
+ 61,
+ 727,
+ 578,
+ 849,
+ 1405,
+ - 208,
+ - 277,
+ 329,
+ - 152,
+ 64,
+ 669,
+ - 434,
+ - 678,
+ - 727,
+ - 454,
+ - 71,
+ 251,
+ 605,
+ 480,
+ 254,
+ - 482,
+ 11,
+ 996,
+ - 289,
+ 395,
+ 486,
+ 722,
+ 1049,
+ 1440,
+ - 30,
+ - 316,
+ - 786,
+ - 106,
+ - 115,
+ - 619,
+ 861,
+ 1474,
+ 1412,
+ 1055,
+ 1366,
+ 1184,
+ 812,
+ 1237,
+ 925,
+ 42,
+ - 251,
+ - 576,
+ 342,
+ 141,
+ - 454,
+ - 168,
+ - 80,
+ 1359,
+ - 342,
+ - 656,
+ - 1763,
+ 100,
+ 821,
+ 725,
+ 990,
+ 747,
+ 800,
+ 332,
+ 440,
+ 568,
+ 663,
+ 379,
+ 852,
+ 112,
+ 165,
+ - 369,
+ 597,
+ 910,
+ 282,
+ - 8,
+ 834,
+ 1281,
+ - 352,
+ 572,
+ 695,
+ 462,
+ 2246,
+ 1806,
+ 345,
+ 190,
+ 1374,
+ 416,
+ 915,
+ 2166,
+ 168,
+ - 82,
+ 280,
+ - 516,
+ - 446,
+ 840,
+ 47,
+ 533,
+ 44,
+ - 362,
+ - 711,
+ - 1143,
+ 22,
+ 193,
+ 1472,
+ - 85,
+ 233,
+ 1813,
+ - 62,
+ 579,
+ 1504,
+ 550,
+ 944,
+ 1749,
+ 723,
+ 650,
+ 1148,
+ 972,
+ 884,
+ 1395,
+ - 425,
+ 643,
+ 0,
+ 1000,
+ 952,
+ 1098,
+ 249,
+ 1446,
+ 672,
+ - 334,
+ - 87,
+ 2172,
+ - 554,
+ 1882,
+ 2672,
+ 140,
+ 1826,
+ 1853,
+ 920,
+ 1749,
+ 2590,
+ 1076,
+ 1933,
+ 2038,
+ - 137,
+ - 443,
+ - 1555,
+ 1269,
+ 1174,
+ 468,
+ - 493,
+ - 122,
+ 1521,
+ - 451,
+ 1033,
+ 1214,
+ 482,
+ 1695,
+ 1118,
+ 815,
+ 649,
+ 384,
+ - 446,
+ - 692,
+ 107,
+ - 319,
+ - 605,
+ - 118,
+ - 207,
+ - 505,
+ 525,
+ - 468,
+ - 12,
+ 2736,
+ 75,
+ 1934,
+ 1305,
+ 880,
+ 2358,
+ 2267,
+ 1285,
+ 1575,
+ 2004,
+ - 48,
+ - 304,
+ - 1186,
+ - 435,
+ - 461,
+ - 251,
+ - 366,
+ - 404,
+ - 547,
+ - 289,
+ - 605,
+ - 597,
+ - 538,
+ - 810,
+ - 165,
+ - 120,
+ 3,
+ 356,
+ 639,
+ 1241,
+ 1502,
+ 96,
+ 177,
+ 750,
+ - 435,
+ - 585,
+ - 1174,
+ - 356,
+ 109,
+ - 79,
+ - 485,
+ 288,
+ 2005,
+ 9,
+ 1116,
+ 731,
+ 880,
+ 2134,
+ 946,
+ - 265,
+ 1585,
+ 1065,
+ 1157,
+ 1210,
+ 843,
+ - 498,
+ - 668,
+ 431,
+ 374,
+ 321,
+ - 229,
+ 1440,
+ 2101,
+ 1381,
+ 449,
+ 461,
+ 1155,
+ - 105,
+ 39,
+ - 384,
+ - 263,
+ 367,
+ 182,
+ - 371,
+ - 660,
+ 773,
+ - 188,
+ 1151,
+ 971,
+ 1333,
+ 1632,
+ 1435,
+ 774,
+ 1267,
+ 1221,
+ - 482,
+ - 832,
+ - 1489,
+ - 237,
+ - 210,
+ 860,
+ 890,
+ 1615,
+ 1064,
+ 472,
+ 1062,
+ 1192,
+ 185,
+ 1077,
+ 989,
+ - 568,
+ - 992,
+ - 1704,
+ - 449,
+ - 902,
+ - 2043,
+ - 142,
+ - 377,
+ - 458,
+ - 210,
+ - 554,
+ - 1029,
+ - 11,
+ 1133,
+ 2265,
+ - 329,
+ - 675,
+ - 893,
+ - 250,
+ 657,
+ 1187,
+ 519,
+ 1510,
+ 1779,
+ 520,
+ 539,
+ 1403,
+ 527,
+ 1421,
+ 1302,
+ - 563,
+ - 871,
+ - 1248,
+ - 147,
+ - 463,
+ 879,
+ - 76,
+ 2334,
+ 2840,
+ 563,
+ 2573,
+ 2385,
+ 632,
+ 1926,
+ 2920,
+ 719,
+ 2023,
+ 1840,
+ - 545,
+ - 723,
+ 1108,
+ 129,
+ - 125,
+ 884,
+ 1417,
+ 1632,
+ 925,
+ - 94,
+ 1566,
+ 1751,
+ - 341,
+ 1533,
+ 1551,
+ 591,
+ 395,
+ - 274,
+ - 76,
+ 981,
+ 2831,
+ 153,
+ 2985,
+ 1844,
+ 1032,
+ 2565,
+ 2749,
+ 1508,
+ 2832,
+ 1879,
+ 791,
+ 1199,
+ 538,
+ - 190,
+ - 453,
+ 1489,
+ - 278,
+ - 548,
+ 1158,
+ - 245,
+ 1941,
+ 2044,
+ 1024,
+ 1560,
+ 1650,
+ 512,
+ 253,
+ 466,
+ - 62,
+ - 323,
+ 1151,
+ - 473,
+ - 376,
+ 507,
+ - 433,
+ 1380,
+ 2162,
+ 899,
+ 1943,
+ 1445,
+ 134,
+ 704,
+ 440,
+ 460,
+ 525,
+ - 28,
+ - 450,
+ 279,
+ 1338,
+ 0,
+ 971,
+ 252,
+ - 445,
+ - 627,
+ - 991,
+ - 348,
+ - 602,
+ - 1424,
+ 398,
+ 712,
+ 1656,
+ - 107,
+ 314,
+ - 178,
+ 93,
+ 2226,
+ 2238,
+ 518,
+ 849,
+ 656,
+ - 462,
+ - 711,
+ - 447,
+ 174,
+ - 34,
+ 1191,
+ - 119,
+ 42,
+ 1005,
+ - 372,
+ 274,
+ 758,
+ 1036,
+ 2352,
+ 1838,
+ 675,
+ 1724,
+ 1498,
+ 430,
+ 1286,
+ 2133,
+ - 129,
+ - 439,
+ 0,
+ - 373,
+ 800,
+ 2144,
+ 6,
+ 1587,
+ 2478,
+ 478,
+ 596,
+ 2128,
+ - 428,
+ - 736,
+ 1505,
+ 385,
+ 178,
+ 980,
+ 139,
+ 449,
+ 1225,
+ - 526,
+ - 842,
+ - 982,
+ 145,
+ 1554,
+ 1242,
+ 623,
+ 1448,
+ 656,
+ 349,
+ 1016,
+ 1482,
+ 31,
+ - 280,
+ 415,
+ - 316,
+ 724,
+ 1641,
+ 360,
+ 1058,
+ 556,
+ - 436,
+ - 358,
+ 1201,
+ - 355,
+ 1123,
+ 1939,
+ 401,
+ 1584,
+ 2248,
+ - 527,
+ - 1012,
+ 355,
+ 233,
+ 238,
+ 2233,
+ - 550,
+ - 897,
+ - 639,
+ - 365,
+ - 501,
+ 1957,
+ 389,
+ 1860,
+ 1621,
+ 162,
+ 1132,
+ 1264,
+ - 237,
+ 1174,
+ 1390,
+ - 640,
+ - 411,
+ 116,
+ - 228,
+ 1694,
+ 2298,
+ 1639,
+ 2186,
+ 2267,
+ 562,
+ 1273,
+ 2658,
+ 323,
+ 338,
+ 1774,
+ 578,
+ 1107,
+ 852,
+ 22,
+ 594,
+ 934,
+ - 143,
+ 718,
+ 446
};
/* 2nd LSF quantizer (not in MR122) */
static const Word32 dico2_lsf_3[] =
{
- 50,
- 71,
- - 9,
- - 338,
- - 698,
- - 1407,
- 102,
- - 138,
- - 820,
- - 310,
- - 469,
- - 1147,
- 414,
- 67,
- - 267,
- 1060,
- 814,
- 1441,
- 1548,
- 1360,
- 1272,
- 1754,
- 1895,
- 1661,
- 2019,
- 2133,
- 1820,
- 1808,
- 2318,
- 1845,
- 644,
- - 93,
- 454,
- 858,
- 329,
- - 136,
- 489,
- - 258,
- - 128,
- - 198,
- - 745,
- - 41,
- - 52,
- - 265,
- - 985,
- 346,
- 137,
- 479,
- - 1741,
- - 748,
- - 684,
- - 1163,
- - 1725,
- - 367,
- - 895,
- - 1145,
- - 784,
- - 488,
- - 946,
- - 968,
- - 85,
- - 390,
- - 725,
- 215,
- - 340,
- - 171,
- 1020,
- 916,
- 1969,
- 564,
- 179,
- 746,
- 662,
- 977,
- 1734,
- 887,
- 622,
- 914,
- 939,
- 856,
- 1165,
- 309,
- 688,
- 803,
- 917,
- 161,
- 570,
- 118,
- - 20,
- - 283,
- - 816,
- - 42,
- 204,
- - 1228,
- - 325,
- - 462,
- - 963,
- - 202,
- - 143,
- - 988,
- - 484,
- - 361,
- - 702,
- - 978,
- - 477,
- - 302,
- - 790,
- - 1188,
- - 100,
- - 786,
- - 1088,
- - 1054,
- - 947,
- - 1684,
- - 202,
- - 843,
- - 782,
- - 1039,
- - 1378,
- - 901,
- - 624,
- - 110,
- - 85,
- 356,
- 213,
- - 10,
- - 493,
- 364,
- 774,
- 425,
- 822,
- 479,
- - 83,
- 557,
- 520,
- - 992,
- - 1560,
- - 572,
- - 603,
- - 741,
- - 26,
- - 502,
- - 638,
- - 903,
- 209,
- 306,
- 147,
- - 316,
- - 593,
- - 596,
- - 85,
- - 211,
- - 225,
- - 918,
- - 529,
- 117,
- 233,
- - 439,
- - 738,
- 1101,
- 751,
- 633,
- 1457,
- 1716,
- 1511,
- 1765,
- 1457,
- 910,
- 1122,
- 1156,
- 849,
- 1354,
- 868,
- 470,
- - 871,
- - 1150,
- - 1796,
- - 871,
- - 861,
- - 992,
- - 118,
- 155,
- 212,
- - 1051,
- - 849,
- - 606,
- - 1117,
- - 1849,
- - 2750,
- - 1019,
- - 1427,
- - 1869,
- 370,
- - 184,
- - 414,
- 959,
- 493,
- 104,
- 958,
- 1039,
- 543,
- 154,
- 653,
- 201,
- 1249,
- 507,
- 150,
- 663,
- 503,
- 230,
- 623,
- 777,
- 675,
- 659,
- 88,
- - 110,
- 843,
- 244,
- 224,
- 382,
- 541,
- 302,
- 724,
- 433,
- 666,
- 1166,
- 734,
- 341,
- - 138,
- 20,
- - 397,
- - 1183,
- - 424,
- - 46,
- - 321,
- - 352,
- - 124,
- 1333,
- 1021,
- 1080,
- 262,
- 366,
- 723,
- 922,
- 283,
- - 551,
- 31,
- - 636,
- - 611,
- - 689,
- - 697,
- - 415,
- - 952,
- - 779,
- - 201,
- - 1329,
- - 598,
- - 359,
- - 953,
- - 1285,
- 166,
- 493,
- 305,
- 221,
- 846,
- 703,
- 610,
- 840,
- 936,
- 774,
- - 723,
- - 1324,
- - 1261,
- - 357,
- - 1025,
- - 1388,
- - 1096,
- - 1376,
- - 365,
- - 1416,
- - 1881,
- - 608,
- - 1798,
- - 1727,
- - 674,
- - 545,
- - 1173,
- - 703,
- 678,
- 786,
- 148,
- - 123,
- 696,
- 1288,
- 644,
- 350,
- - 10,
- 414,
- 614,
- 15,
- 137,
- 344,
- - 211,
- - 814,
- - 1512,
- - 819,
- - 391,
- - 930,
- - 588,
- 47,
- - 591,
- - 898,
- - 909,
- - 1097,
- - 163,
- - 1272,
- - 1167,
- - 157,
- - 1464,
- - 1525,
- - 389,
- - 1274,
- - 1188,
- - 624,
- 671,
- 213,
- 454,
- 124,
- - 274,
- - 525,
- - 729,
- - 496,
- - 152,
- - 1344,
- 122,
- 135,
- - 2905,
- - 589,
- - 394,
- - 1728,
- 441,
- - 50,
- 1476,
- 904,
- 787,
- 316,
- 236,
- - 440,
- - 347,
- 217,
- 413,
- - 911,
- - 917,
- 121,
- - 455,
- - 932,
- 202,
- - 92,
- - 465,
- - 375,
- 488,
- 390,
- 474,
- 876,
- 729,
- 316,
- - 1815,
- - 1312,
- - 669,
- 87,
- 962,
- 432,
- 563,
- - 249,
- - 1058,
- 250,
- 285,
- 1105,
- 1141,
- 427,
- 696,
- - 1038,
- - 1664,
- - 1582,
- - 948,
- 346,
- 160,
- - 309,
- - 272,
- - 858,
- 670,
- 624,
- 1250,
- - 944,
- - 408,
- - 666,
- - 606,
- - 320,
- - 384,
- - 492,
- 230,
- 65,
- 334,
- - 50,
- - 16,
- - 16,
- - 690,
- - 1397,
- 1791,
- 1716,
- 1399,
- 2478,
- 2063,
- 1404,
- 1245,
- 1471,
- 1426,
- - 382,
- - 1037,
- - 2,
- 173,
- - 398,
- 1145,
- 1491,
- 2024,
- 1801,
- 772,
- 1274,
- 1506,
- 1429,
- 1735,
- 2001,
- 1079,
- 1218,
- 1273,
- - 1154,
- - 1851,
- - 1329,
- - 808,
- - 1133,
- - 1096,
- - 451,
- - 1033,
- - 1722,
- 65,
- 578,
- - 84,
- - 1476,
- - 2434,
- - 1778,
- - 765,
- - 1366,
- - 494,
- - 218,
- - 594,
- - 931,
- 337,
- - 236,
- 562,
- 2357,
- 2662,
- 1938,
- 1489,
- 1276,
- 874,
- 189,
- 358,
- 374,
- - 1519,
- - 2281,
- - 2346,
- - 967,
- - 1271,
- - 2095,
- - 628,
- - 1188,
- - 1542,
- 1661,
- 1043,
- 546,
- 565,
- 1061,
- 732,
- - 64,
- - 836,
- - 434,
- - 436,
- - 96,
- 203,
- 1078,
- 1216,
- 1636,
- 907,
- 1534,
- 986,
- 326,
- 965,
- 845,
- 142,
- - 84,
- 197,
- 470,
- 2379,
- 1570,
- 1133,
- 470,
- 1214,
- 395,
- 1376,
- 1200,
- 1125,
- 1042,
- 348,
- - 543,
- - 1234,
- - 376,
- - 215,
- - 181,
- 481,
- - 1947,
- - 1621,
- - 210,
- - 750,
- - 1185,
- 390,
- 29,
- - 399,
- 27,
- 820,
- 1236,
- 755,
- 695,
- 979,
- 409,
- - 174,
- 1197,
- 1035,
- 912,
- 1356,
- 1846,
- - 992,
- - 1437,
- 484,
- - 1485,
- - 1700,
- 208,
- - 412,
- 1204,
- 1432,
- - 271,
- 896,
- 1144,
- - 416,
- 1777,
- 1434,
- - 1696,
- - 2644,
- - 204,
- - 1789,
- - 1551,
- 1033,
- - 1656,
- - 1559,
- 1303,
- - 1253,
- - 1589,
- 1081,
- - 669,
- - 1095,
- - 66,
- - 682,
- 320,
- - 345,
- 659,
- 305,
- 1069,
- - 1292,
- - 804,
- - 19,
- - 1635,
- - 1291,
- 29,
- - 1683,
- - 497,
- 71,
- - 287,
- - 7,
- - 100,
- - 494,
- - 962,
- - 237,
- 852,
- 1881,
- 1740,
- - 1217,
- - 1387,
- 227,
- - 660,
- 302,
- 373,
- 96,
- 1087,
- 1257,
- - 1074,
- - 1669,
- 160,
- 485,
- 2076,
- 1798,
- - 934,
- - 220,
- 552,
- - 596,
- - 612,
- 237,
- 336,
- 1720,
- 879,
- 643,
- 629,
- 434,
- 1267,
- 522,
- 1633,
- 15,
- 244,
- - 441,
- 1475,
- 717,
- 184,
- 1819,
- 1590,
- 1709,
- 988,
- 261,
- 937,
- 2093,
- 2345,
- 1520,
- 2139,
- 1858,
- 1606,
- - 577,
- - 579,
- - 1203,
- - 956,
- 135,
- - 488,
- - 464,
- 51,
- - 338,
- - 629,
- - 348,
- - 723,
- 1146,
- 2073,
- 1442,
- 2192,
- 1466,
- 911,
- - 1444,
- - 1572,
- - 2278,
- 1400,
- 710,
- 1297,
- 1335,
- 633,
- 928,
- 1434,
- 2194,
- 2594,
- 2422,
- 2204,
- 1881,
- 982,
- 2242,
- 1854,
- 380,
- 792,
- 1145,
- - 63,
- - 539,
- 414,
- - 252,
- - 964,
- - 314,
- - 1261,
- - 683,
- - 780,
- - 831,
- - 526,
- - 1005,
- - 1666,
- - 1135,
- - 424,
- - 1611,
- - 452,
- - 299,
- 1268,
- 1048,
- 642,
- 1147,
- 853,
- 856,
- - 675,
- - 336,
- 139,
- 2268,
- 1343,
- 1418,
- 29,
- 768,
- 797,
- - 1224,
- 423,
- 564,
- - 1318,
- - 1082,
- 245,
- - 1302,
- - 812,
- 573,
- - 1298,
- - 1617,
- 646,
- - 968,
- 834,
- 723,
- 993,
- 1652,
- 2027,
- - 191,
- - 817,
- 432,
- 662,
- 60,
- 198,
- 626,
- 997,
- 1330,
- 1648,
- 1963,
- 1289,
- - 1597,
- - 93,
- - 45,
- - 1088,
- 37,
- - 84,
- 1653,
- 2607,
- 2337,
- 1065,
- 2040,
- 2377,
- 1139,
- 2326,
- 2118,
- 859,
- 357,
- 1510,
- 664,
- 1227,
- 1099,
- 479,
- 1360,
- 912,
- 1897,
- 1754,
- 2019,
- 1168,
- 1909,
- 1784,
- 399,
- 34,
- 256,
- - 593,
- - 304,
- - 1053,
- 547,
- 1694,
- 1407,
- 647,
- - 99,
- - 341,
- 1492,
- 1647,
- 1190,
- 38,
- - 644,
- - 212,
- 395,
- 846,
- 222,
- - 704,
- - 765,
- - 716,
- - 724,
- - 1964,
- - 2804,
- - 150,
- 291,
- - 82,
- 1233,
- 1459,
- 1007,
- - 140,
- - 155,
- 153,
- 439,
- 297,
- 1568,
- - 1529,
- - 410,
- - 636,
- 1536,
- 455,
- - 237,
- - 1328,
- - 139,
- - 260,
- 531,
- 554,
- 868,
- 269,
- 1264,
- 606,
- - 233,
- 883,
- 463,
- 742,
- 600,
- - 120,
- - 73,
- 421,
- 212,
- - 439,
- - 58,
- 804,
- - 1286,
- - 1241,
- 728,
- 294,
- - 490,
- 50,
- - 591,
- - 905,
- - 1254,
- 42,
- - 687,
- 147,
- - 25,
- 273,
- 596,
- - 311,
- 1213,
- 601,
- - 754,
- 849,
- 584,
- 429,
- 607,
- 587,
- - 602,
- - 166,
- 461,
- - 796,
- - 823,
- 777,
- 1380,
- 910,
- 1755,
- 119,
- 1417,
- 972,
- - 219,
- - 880,
- - 1596,
- - 1049,
- - 1010,
- 438,
- - 713,
- - 1379,
- 78,
- 0,
- - 447,
- - 1179,
- - 1136,
- - 1319,
- - 1573,
- 2248,
- 1767,
- 1309,
- 946,
- 1583,
- 1432,
- 1150,
- 482,
- 436,
- - 469,
- - 1108,
- 618,
- - 447,
- - 966,
- 1088,
- - 1252,
- - 1515,
- - 114,
- - 1104,
- - 2008,
- - 579,
- 210,
- 613,
- 497,
- - 1975,
- - 1437,
- 642,
- - 1269,
- - 856,
- 1011,
- - 1646,
- - 1185,
- 1063,
- - 1555,
- - 672,
- 1204,
- - 1692,
- - 1114,
- 623,
- - 979,
- - 1326,
- - 1277,
- 539,
- - 147,
- 894,
- - 1354,
- - 897,
- - 434,
- 888,
- 475,
- 428,
- 153,
- - 384,
- 338,
- - 1492,
- - 511,
- 359,
- - 974,
- - 1115,
- - 470,
- 105,
- - 550,
- 677,
- - 937,
- - 1145,
- 877,
- 380,
- - 260,
- 210,
- 1685,
- 924,
- 1256,
- 1775,
- 1190,
- 1095,
- 1419,
- 631,
- 533,
- 627,
- 299,
- - 347,
- - 411,
- - 534,
- 647,
- - 650,
- 29,
- - 595,
- - 378,
- - 1367,
- 1563,
- 1402,
- 1121,
- 1465,
- 1089,
- 1410,
- 648,
- - 2096,
- - 1090,
- - 6,
- 311,
- - 194,
- - 869,
- - 639,
- - 831,
- 416,
- - 1162,
- - 1224,
- 1349,
- - 1247,
- - 941,
- 1813,
- - 2193,
- - 1987,
- 453,
- - 619,
- - 1367,
- - 956,
- - 1606,
- - 1972,
- - 1507,
- - 1175,
- - 1057,
- - 1104,
- - 377,
- 601,
- 201,
- 1876,
- 825,
- 374,
- - 430,
- - 1323,
- 29,
- - 1397,
- - 1249,
- - 1331,
- - 1007,
- - 1504,
- 960,
- - 1401,
- - 2009,
- 197,
- - 1379,
- - 1949,
- - 236,
- - 1077,
- 123,
- 422,
- 615,
- 1269,
- 546,
- - 306,
- 1526,
- 904,
- 1194,
- 1788,
- 1177,
- - 626,
- - 884,
- - 1526,
- 199,
- 766,
- 1504,
- - 1065,
- 862,
- 197,
- - 1034,
- - 1773,
- - 887,
- - 800,
- 145,
- 599,
- - 1134,
- - 519,
- 626,
- - 1205,
- - 1926,
- 500,
- - 910,
- - 1041,
- - 1395,
- - 1476,
- - 1567,
- - 969,
- - 523,
- 842,
- 34,
- 1794,
- 646,
- 862,
- - 1207,
- - 1888,
- - 1002,
- - 78,
- - 9,
- - 672,
- 1044,
- 759,
- 80,
- - 600,
- 1139,
- 1019,
- 57,
- 2000,
- 1422,
- - 833,
- 1414,
- 1121,
- - 1202,
- 1630,
- 1260,
- - 461,
- 1420,
- 1244,
- 1537,
- 975,
- 253,
- - 283,
- 324,
- - 359,
- 599,
- - 195,
- 106,
- 588,
- 62,
- - 587,
- - 757,
- 645,
- 205,
- 51,
- 1201,
- 758,
- - 1209,
- 673,
- - 390,
- - 624,
- 1581,
- 941,
- - 151,
- 1023,
- 735,
- 2820,
- 1301,
- 690,
- - 302,
- 524,
- - 99,
- - 900,
- - 1588,
- - 1189,
- 1084,
- 251,
- 238,
- 2014,
- 1792,
- 1010,
- 1245,
- 1633,
- 1741,
- - 1227,
- - 1540,
- - 1208,
- - 621,
- 456,
- - 109,
- 40,
- - 65,
- 788,
- - 805,
- - 699,
- - 1350,
- - 583,
- 904,
- 832,
- - 801,
- 532,
- 594,
- 1972,
- 1408,
- 1351,
- - 1177,
- - 1880,
- - 2114,
- - 773,
- 568,
- 948,
- - 1015,
- 1079,
- 1260,
- - 1111,
- 482,
- - 130,
- 1778,
- 1044,
- 780,
- - 1491,
- 245,
- 912,
- - 316,
- - 1141,
- - 917,
- - 536,
- - 1442,
- - 2346,
- - 785,
- - 1546,
- - 1988,
- - 2003,
- 257,
- 909,
- - 1849,
- - 633,
- - 1209,
- - 1538,
- - 1918,
- - 1054,
- 1606,
- 2239,
- 1576,
- - 567,
- - 1500,
- - 1544,
- - 1279,
- 195,
- 1369,
- - 817,
- 293,
- 1219,
- - 525,
- 630,
- 1197,
- - 1698,
- - 2425,
- - 1840,
- - 303,
- 731,
- 747,
- - 1169,
- - 251,
- 269,
- - 950,
- - 75,
- 1684,
- - 1182,
- - 453,
- 1005,
- - 1599,
- 585,
- 378,
- - 2075,
- - 571,
- - 427,
- - 529,
- - 1159,
- - 1171,
- - 283,
- - 205,
- - 564,
- - 796,
- 1246,
- 717,
- 2277,
- 927,
- 539,
- - 454,
- 559,
- 440,
- - 717,
- 1460,
- 1615,
- - 1030,
- 1052,
- 1610,
- - 1169,
- - 138,
- 847,
- 226,
- 39,
- - 612,
- - 1251,
- - 106,
- - 729,
- - 651,
- 968,
- 1302,
- - 714,
- - 636,
- 1727,
- 353,
- 1069,
- 410,
- - 798,
- - 156,
- 1099,
- - 574,
- 918,
- 446,
- - 1310,
- 1012,
- 466,
- 1408,
- 1591,
- 765,
- 1429,
- 1380,
- 1757,
- 1949,
- 1956,
- 2378,
- 1578,
- 2047,
- 2148,
- 916,
- 98,
- - 7,
- 1893,
- 1418,
- 2141,
- 348,
- 1405,
- 1579,
- 152,
- 1134,
- 1801,
- - 267,
- 154,
- 1395,
- - 1166,
- 469,
- 1054,
- - 1142,
- - 405,
- - 1073,
- - 1341,
- - 2264,
- - 1581,
- - 364,
- 869,
- 1706,
- - 1162,
- 549,
- 1550,
- - 1225,
- - 1932,
- - 1666,
- - 1485,
- - 1977,
- - 2055,
- - 1727,
- - 906,
- - 98,
- - 1897,
- 233,
- 1492,
- 892,
- 108,
- - 331,
- - 1728,
- - 1170,
- - 1700,
- - 1060,
- 1980,
- 1790,
- - 1070,
- - 1741,
- - 1909,
- - 11,
- 1539,
- 1317,
- - 1600,
- 94,
- 497,
- 421,
- 443,
- - 197,
- - 1578,
- - 349,
- - 994,
- - 599,
- - 539,
- 1140,
- - 965,
- - 1419,
- - 129,
- - 1341,
- 175,
- - 447,
- - 375,
- 1311,
- 2055,
- - 371,
- - 650,
- - 307,
- - 1073,
- 605,
- 365,
- - 2057,
- - 113,
- 430,
- 652,
- 914,
- 967,
- - 1012,
- - 1586,
- - 2323,
- 1505,
- 1248,
- 559,
- 262,
- - 486,
- - 401,
- - 1727,
- 1342,
- 1546,
- 50,
- 56,
- 432,
- - 330,
- 119,
- - 604,
- - 1517,
- - 1080,
- - 810,
- 946,
- 1127,
- 1055,
- - 1400,
- - 1703,
- - 1712,
- - 1270,
- - 704,
- - 1317,
- 807,
- 1821,
- 1143,
- 2760,
- 1606,
- 2171,
- 1120,
- 409,
- - 150,
- - 147,
- 404,
- 959,
- 2439,
- 1911,
- 2189,
- - 906,
- - 141,
- - 866,
- - 904,
- - 142,
- - 458,
- - 557,
- - 708,
- - 1679,
- - 830,
- - 1431,
- - 1583,
- - 1842,
- - 1346,
- - 1086,
- - 1604,
- - 272,
- 915,
- - 1196,
- 772,
- 1056,
- - 638,
- - 1234,
- - 1897,
- - 500,
- - 81,
- - 822,
- - 1289,
- - 1613,
- - 735,
- - 117,
- 785,
- 168,
- - 1090,
- 1133,
- 922,
- - 1096,
- - 746,
- 1384,
- 287,
- - 547,
- - 1063,
- - 1376,
- - 2201,
- - 1204,
- - 2176,
- - 1570,
- - 1757,
- - 1511,
- - 2241,
- - 771,
- - 1737,
- 1099,
- 830,
- - 1588,
- 724,
- 1243,
- - 1542,
- 693,
- 805,
- - 1690,
- - 240,
- 1665,
- - 1700,
- - 4,
- - 668,
- 2149,
- 816,
- 1042,
- - 818,
- - 1841,
- 22,
- - 764,
- - 507,
- 449,
- - 1151,
- - 617,
- 289,
- - 843,
- - 1596,
- - 240,
- 498,
- - 234,
- - 657,
- - 752,
- 480,
- 1678,
- - 319,
- - 481,
- 193,
- - 811,
- 171,
- - 119,
- - 2128,
- - 202,
- - 848,
- 1717,
- 1140,
- 1700
+ 50,
+ 71,
+ - 9,
+ - 338,
+ - 698,
+ - 1407,
+ 102,
+ - 138,
+ - 820,
+ - 310,
+ - 469,
+ - 1147,
+ 414,
+ 67,
+ - 267,
+ 1060,
+ 814,
+ 1441,
+ 1548,
+ 1360,
+ 1272,
+ 1754,
+ 1895,
+ 1661,
+ 2019,
+ 2133,
+ 1820,
+ 1808,
+ 2318,
+ 1845,
+ 644,
+ - 93,
+ 454,
+ 858,
+ 329,
+ - 136,
+ 489,
+ - 258,
+ - 128,
+ - 198,
+ - 745,
+ - 41,
+ - 52,
+ - 265,
+ - 985,
+ 346,
+ 137,
+ 479,
+ - 1741,
+ - 748,
+ - 684,
+ - 1163,
+ - 1725,
+ - 367,
+ - 895,
+ - 1145,
+ - 784,
+ - 488,
+ - 946,
+ - 968,
+ - 85,
+ - 390,
+ - 725,
+ 215,
+ - 340,
+ - 171,
+ 1020,
+ 916,
+ 1969,
+ 564,
+ 179,
+ 746,
+ 662,
+ 977,
+ 1734,
+ 887,
+ 622,
+ 914,
+ 939,
+ 856,
+ 1165,
+ 309,
+ 688,
+ 803,
+ 917,
+ 161,
+ 570,
+ 118,
+ - 20,
+ - 283,
+ - 816,
+ - 42,
+ 204,
+ - 1228,
+ - 325,
+ - 462,
+ - 963,
+ - 202,
+ - 143,
+ - 988,
+ - 484,
+ - 361,
+ - 702,
+ - 978,
+ - 477,
+ - 302,
+ - 790,
+ - 1188,
+ - 100,
+ - 786,
+ - 1088,
+ - 1054,
+ - 947,
+ - 1684,
+ - 202,
+ - 843,
+ - 782,
+ - 1039,
+ - 1378,
+ - 901,
+ - 624,
+ - 110,
+ - 85,
+ 356,
+ 213,
+ - 10,
+ - 493,
+ 364,
+ 774,
+ 425,
+ 822,
+ 479,
+ - 83,
+ 557,
+ 520,
+ - 992,
+ - 1560,
+ - 572,
+ - 603,
+ - 741,
+ - 26,
+ - 502,
+ - 638,
+ - 903,
+ 209,
+ 306,
+ 147,
+ - 316,
+ - 593,
+ - 596,
+ - 85,
+ - 211,
+ - 225,
+ - 918,
+ - 529,
+ 117,
+ 233,
+ - 439,
+ - 738,
+ 1101,
+ 751,
+ 633,
+ 1457,
+ 1716,
+ 1511,
+ 1765,
+ 1457,
+ 910,
+ 1122,
+ 1156,
+ 849,
+ 1354,
+ 868,
+ 470,
+ - 871,
+ - 1150,
+ - 1796,
+ - 871,
+ - 861,
+ - 992,
+ - 118,
+ 155,
+ 212,
+ - 1051,
+ - 849,
+ - 606,
+ - 1117,
+ - 1849,
+ - 2750,
+ - 1019,
+ - 1427,
+ - 1869,
+ 370,
+ - 184,
+ - 414,
+ 959,
+ 493,
+ 104,
+ 958,
+ 1039,
+ 543,
+ 154,
+ 653,
+ 201,
+ 1249,
+ 507,
+ 150,
+ 663,
+ 503,
+ 230,
+ 623,
+ 777,
+ 675,
+ 659,
+ 88,
+ - 110,
+ 843,
+ 244,
+ 224,
+ 382,
+ 541,
+ 302,
+ 724,
+ 433,
+ 666,
+ 1166,
+ 734,
+ 341,
+ - 138,
+ 20,
+ - 397,
+ - 1183,
+ - 424,
+ - 46,
+ - 321,
+ - 352,
+ - 124,
+ 1333,
+ 1021,
+ 1080,
+ 262,
+ 366,
+ 723,
+ 922,
+ 283,
+ - 551,
+ 31,
+ - 636,
+ - 611,
+ - 689,
+ - 697,
+ - 415,
+ - 952,
+ - 779,
+ - 201,
+ - 1329,
+ - 598,
+ - 359,
+ - 953,
+ - 1285,
+ 166,
+ 493,
+ 305,
+ 221,
+ 846,
+ 703,
+ 610,
+ 840,
+ 936,
+ 774,
+ - 723,
+ - 1324,
+ - 1261,
+ - 357,
+ - 1025,
+ - 1388,
+ - 1096,
+ - 1376,
+ - 365,
+ - 1416,
+ - 1881,
+ - 608,
+ - 1798,
+ - 1727,
+ - 674,
+ - 545,
+ - 1173,
+ - 703,
+ 678,
+ 786,
+ 148,
+ - 123,
+ 696,
+ 1288,
+ 644,
+ 350,
+ - 10,
+ 414,
+ 614,
+ 15,
+ 137,
+ 344,
+ - 211,
+ - 814,
+ - 1512,
+ - 819,
+ - 391,
+ - 930,
+ - 588,
+ 47,
+ - 591,
+ - 898,
+ - 909,
+ - 1097,
+ - 163,
+ - 1272,
+ - 1167,
+ - 157,
+ - 1464,
+ - 1525,
+ - 389,
+ - 1274,
+ - 1188,
+ - 624,
+ 671,
+ 213,
+ 454,
+ 124,
+ - 274,
+ - 525,
+ - 729,
+ - 496,
+ - 152,
+ - 1344,
+ 122,
+ 135,
+ - 2905,
+ - 589,
+ - 394,
+ - 1728,
+ 441,
+ - 50,
+ 1476,
+ 904,
+ 787,
+ 316,
+ 236,
+ - 440,
+ - 347,
+ 217,
+ 413,
+ - 911,
+ - 917,
+ 121,
+ - 455,
+ - 932,
+ 202,
+ - 92,
+ - 465,
+ - 375,
+ 488,
+ 390,
+ 474,
+ 876,
+ 729,
+ 316,
+ - 1815,
+ - 1312,
+ - 669,
+ 87,
+ 962,
+ 432,
+ 563,
+ - 249,
+ - 1058,
+ 250,
+ 285,
+ 1105,
+ 1141,
+ 427,
+ 696,
+ - 1038,
+ - 1664,
+ - 1582,
+ - 948,
+ 346,
+ 160,
+ - 309,
+ - 272,
+ - 858,
+ 670,
+ 624,
+ 1250,
+ - 944,
+ - 408,
+ - 666,
+ - 606,
+ - 320,
+ - 384,
+ - 492,
+ 230,
+ 65,
+ 334,
+ - 50,
+ - 16,
+ - 16,
+ - 690,
+ - 1397,
+ 1791,
+ 1716,
+ 1399,
+ 2478,
+ 2063,
+ 1404,
+ 1245,
+ 1471,
+ 1426,
+ - 382,
+ - 1037,
+ - 2,
+ 173,
+ - 398,
+ 1145,
+ 1491,
+ 2024,
+ 1801,
+ 772,
+ 1274,
+ 1506,
+ 1429,
+ 1735,
+ 2001,
+ 1079,
+ 1218,
+ 1273,
+ - 1154,
+ - 1851,
+ - 1329,
+ - 808,
+ - 1133,
+ - 1096,
+ - 451,
+ - 1033,
+ - 1722,
+ 65,
+ 578,
+ - 84,
+ - 1476,
+ - 2434,
+ - 1778,
+ - 765,
+ - 1366,
+ - 494,
+ - 218,
+ - 594,
+ - 931,
+ 337,
+ - 236,
+ 562,
+ 2357,
+ 2662,
+ 1938,
+ 1489,
+ 1276,
+ 874,
+ 189,
+ 358,
+ 374,
+ - 1519,
+ - 2281,
+ - 2346,
+ - 967,
+ - 1271,
+ - 2095,
+ - 628,
+ - 1188,
+ - 1542,
+ 1661,
+ 1043,
+ 546,
+ 565,
+ 1061,
+ 732,
+ - 64,
+ - 836,
+ - 434,
+ - 436,
+ - 96,
+ 203,
+ 1078,
+ 1216,
+ 1636,
+ 907,
+ 1534,
+ 986,
+ 326,
+ 965,
+ 845,
+ 142,
+ - 84,
+ 197,
+ 470,
+ 2379,
+ 1570,
+ 1133,
+ 470,
+ 1214,
+ 395,
+ 1376,
+ 1200,
+ 1125,
+ 1042,
+ 348,
+ - 543,
+ - 1234,
+ - 376,
+ - 215,
+ - 181,
+ 481,
+ - 1947,
+ - 1621,
+ - 210,
+ - 750,
+ - 1185,
+ 390,
+ 29,
+ - 399,
+ 27,
+ 820,
+ 1236,
+ 755,
+ 695,
+ 979,
+ 409,
+ - 174,
+ 1197,
+ 1035,
+ 912,
+ 1356,
+ 1846,
+ - 992,
+ - 1437,
+ 484,
+ - 1485,
+ - 1700,
+ 208,
+ - 412,
+ 1204,
+ 1432,
+ - 271,
+ 896,
+ 1144,
+ - 416,
+ 1777,
+ 1434,
+ - 1696,
+ - 2644,
+ - 204,
+ - 1789,
+ - 1551,
+ 1033,
+ - 1656,
+ - 1559,
+ 1303,
+ - 1253,
+ - 1589,
+ 1081,
+ - 669,
+ - 1095,
+ - 66,
+ - 682,
+ 320,
+ - 345,
+ 659,
+ 305,
+ 1069,
+ - 1292,
+ - 804,
+ - 19,
+ - 1635,
+ - 1291,
+ 29,
+ - 1683,
+ - 497,
+ 71,
+ - 287,
+ - 7,
+ - 100,
+ - 494,
+ - 962,
+ - 237,
+ 852,
+ 1881,
+ 1740,
+ - 1217,
+ - 1387,
+ 227,
+ - 660,
+ 302,
+ 373,
+ 96,
+ 1087,
+ 1257,
+ - 1074,
+ - 1669,
+ 160,
+ 485,
+ 2076,
+ 1798,
+ - 934,
+ - 220,
+ 552,
+ - 596,
+ - 612,
+ 237,
+ 336,
+ 1720,
+ 879,
+ 643,
+ 629,
+ 434,
+ 1267,
+ 522,
+ 1633,
+ 15,
+ 244,
+ - 441,
+ 1475,
+ 717,
+ 184,
+ 1819,
+ 1590,
+ 1709,
+ 988,
+ 261,
+ 937,
+ 2093,
+ 2345,
+ 1520,
+ 2139,
+ 1858,
+ 1606,
+ - 577,
+ - 579,
+ - 1203,
+ - 956,
+ 135,
+ - 488,
+ - 464,
+ 51,
+ - 338,
+ - 629,
+ - 348,
+ - 723,
+ 1146,
+ 2073,
+ 1442,
+ 2192,
+ 1466,
+ 911,
+ - 1444,
+ - 1572,
+ - 2278,
+ 1400,
+ 710,
+ 1297,
+ 1335,
+ 633,
+ 928,
+ 1434,
+ 2194,
+ 2594,
+ 2422,
+ 2204,
+ 1881,
+ 982,
+ 2242,
+ 1854,
+ 380,
+ 792,
+ 1145,
+ - 63,
+ - 539,
+ 414,
+ - 252,
+ - 964,
+ - 314,
+ - 1261,
+ - 683,
+ - 780,
+ - 831,
+ - 526,
+ - 1005,
+ - 1666,
+ - 1135,
+ - 424,
+ - 1611,
+ - 452,
+ - 299,
+ 1268,
+ 1048,
+ 642,
+ 1147,
+ 853,
+ 856,
+ - 675,
+ - 336,
+ 139,
+ 2268,
+ 1343,
+ 1418,
+ 29,
+ 768,
+ 797,
+ - 1224,
+ 423,
+ 564,
+ - 1318,
+ - 1082,
+ 245,
+ - 1302,
+ - 812,
+ 573,
+ - 1298,
+ - 1617,
+ 646,
+ - 968,
+ 834,
+ 723,
+ 993,
+ 1652,
+ 2027,
+ - 191,
+ - 817,
+ 432,
+ 662,
+ 60,
+ 198,
+ 626,
+ 997,
+ 1330,
+ 1648,
+ 1963,
+ 1289,
+ - 1597,
+ - 93,
+ - 45,
+ - 1088,
+ 37,
+ - 84,
+ 1653,
+ 2607,
+ 2337,
+ 1065,
+ 2040,
+ 2377,
+ 1139,
+ 2326,
+ 2118,
+ 859,
+ 357,
+ 1510,
+ 664,
+ 1227,
+ 1099,
+ 479,
+ 1360,
+ 912,
+ 1897,
+ 1754,
+ 2019,
+ 1168,
+ 1909,
+ 1784,
+ 399,
+ 34,
+ 256,
+ - 593,
+ - 304,
+ - 1053,
+ 547,
+ 1694,
+ 1407,
+ 647,
+ - 99,
+ - 341,
+ 1492,
+ 1647,
+ 1190,
+ 38,
+ - 644,
+ - 212,
+ 395,
+ 846,
+ 222,
+ - 704,
+ - 765,
+ - 716,
+ - 724,
+ - 1964,
+ - 2804,
+ - 150,
+ 291,
+ - 82,
+ 1233,
+ 1459,
+ 1007,
+ - 140,
+ - 155,
+ 153,
+ 439,
+ 297,
+ 1568,
+ - 1529,
+ - 410,
+ - 636,
+ 1536,
+ 455,
+ - 237,
+ - 1328,
+ - 139,
+ - 260,
+ 531,
+ 554,
+ 868,
+ 269,
+ 1264,
+ 606,
+ - 233,
+ 883,
+ 463,
+ 742,
+ 600,
+ - 120,
+ - 73,
+ 421,
+ 212,
+ - 439,
+ - 58,
+ 804,
+ - 1286,
+ - 1241,
+ 728,
+ 294,
+ - 490,
+ 50,
+ - 591,
+ - 905,
+ - 1254,
+ 42,
+ - 687,
+ 147,
+ - 25,
+ 273,
+ 596,
+ - 311,
+ 1213,
+ 601,
+ - 754,
+ 849,
+ 584,
+ 429,
+ 607,
+ 587,
+ - 602,
+ - 166,
+ 461,
+ - 796,
+ - 823,
+ 777,
+ 1380,
+ 910,
+ 1755,
+ 119,
+ 1417,
+ 972,
+ - 219,
+ - 880,
+ - 1596,
+ - 1049,
+ - 1010,
+ 438,
+ - 713,
+ - 1379,
+ 78,
+ 0,
+ - 447,
+ - 1179,
+ - 1136,
+ - 1319,
+ - 1573,
+ 2248,
+ 1767,
+ 1309,
+ 946,
+ 1583,
+ 1432,
+ 1150,
+ 482,
+ 436,
+ - 469,
+ - 1108,
+ 618,
+ - 447,
+ - 966,
+ 1088,
+ - 1252,
+ - 1515,
+ - 114,
+ - 1104,
+ - 2008,
+ - 579,
+ 210,
+ 613,
+ 497,
+ - 1975,
+ - 1437,
+ 642,
+ - 1269,
+ - 856,
+ 1011,
+ - 1646,
+ - 1185,
+ 1063,
+ - 1555,
+ - 672,
+ 1204,
+ - 1692,
+ - 1114,
+ 623,
+ - 979,
+ - 1326,
+ - 1277,
+ 539,
+ - 147,
+ 894,
+ - 1354,
+ - 897,
+ - 434,
+ 888,
+ 475,
+ 428,
+ 153,
+ - 384,
+ 338,
+ - 1492,
+ - 511,
+ 359,
+ - 974,
+ - 1115,
+ - 470,
+ 105,
+ - 550,
+ 677,
+ - 937,
+ - 1145,
+ 877,
+ 380,
+ - 260,
+ 210,
+ 1685,
+ 924,
+ 1256,
+ 1775,
+ 1190,
+ 1095,
+ 1419,
+ 631,
+ 533,
+ 627,
+ 299,
+ - 347,
+ - 411,
+ - 534,
+ 647,
+ - 650,
+ 29,
+ - 595,
+ - 378,
+ - 1367,
+ 1563,
+ 1402,
+ 1121,
+ 1465,
+ 1089,
+ 1410,
+ 648,
+ - 2096,
+ - 1090,
+ - 6,
+ 311,
+ - 194,
+ - 869,
+ - 639,
+ - 831,
+ 416,
+ - 1162,
+ - 1224,
+ 1349,
+ - 1247,
+ - 941,
+ 1813,
+ - 2193,
+ - 1987,
+ 453,
+ - 619,
+ - 1367,
+ - 956,
+ - 1606,
+ - 1972,
+ - 1507,
+ - 1175,
+ - 1057,
+ - 1104,
+ - 377,
+ 601,
+ 201,
+ 1876,
+ 825,
+ 374,
+ - 430,
+ - 1323,
+ 29,
+ - 1397,
+ - 1249,
+ - 1331,
+ - 1007,
+ - 1504,
+ 960,
+ - 1401,
+ - 2009,
+ 197,
+ - 1379,
+ - 1949,
+ - 236,
+ - 1077,
+ 123,
+ 422,
+ 615,
+ 1269,
+ 546,
+ - 306,
+ 1526,
+ 904,
+ 1194,
+ 1788,
+ 1177,
+ - 626,
+ - 884,
+ - 1526,
+ 199,
+ 766,
+ 1504,
+ - 1065,
+ 862,
+ 197,
+ - 1034,
+ - 1773,
+ - 887,
+ - 800,
+ 145,
+ 599,
+ - 1134,
+ - 519,
+ 626,
+ - 1205,
+ - 1926,
+ 500,
+ - 910,
+ - 1041,
+ - 1395,
+ - 1476,
+ - 1567,
+ - 969,
+ - 523,
+ 842,
+ 34,
+ 1794,
+ 646,
+ 862,
+ - 1207,
+ - 1888,
+ - 1002,
+ - 78,
+ - 9,
+ - 672,
+ 1044,
+ 759,
+ 80,
+ - 600,
+ 1139,
+ 1019,
+ 57,
+ 2000,
+ 1422,
+ - 833,
+ 1414,
+ 1121,
+ - 1202,
+ 1630,
+ 1260,
+ - 461,
+ 1420,
+ 1244,
+ 1537,
+ 975,
+ 253,
+ - 283,
+ 324,
+ - 359,
+ 599,
+ - 195,
+ 106,
+ 588,
+ 62,
+ - 587,
+ - 757,
+ 645,
+ 205,
+ 51,
+ 1201,
+ 758,
+ - 1209,
+ 673,
+ - 390,
+ - 624,
+ 1581,
+ 941,
+ - 151,
+ 1023,
+ 735,
+ 2820,
+ 1301,
+ 690,
+ - 302,
+ 524,
+ - 99,
+ - 900,
+ - 1588,
+ - 1189,
+ 1084,
+ 251,
+ 238,
+ 2014,
+ 1792,
+ 1010,
+ 1245,
+ 1633,
+ 1741,
+ - 1227,
+ - 1540,
+ - 1208,
+ - 621,
+ 456,
+ - 109,
+ 40,
+ - 65,
+ 788,
+ - 805,
+ - 699,
+ - 1350,
+ - 583,
+ 904,
+ 832,
+ - 801,
+ 532,
+ 594,
+ 1972,
+ 1408,
+ 1351,
+ - 1177,
+ - 1880,
+ - 2114,
+ - 773,
+ 568,
+ 948,
+ - 1015,
+ 1079,
+ 1260,
+ - 1111,
+ 482,
+ - 130,
+ 1778,
+ 1044,
+ 780,
+ - 1491,
+ 245,
+ 912,
+ - 316,
+ - 1141,
+ - 917,
+ - 536,
+ - 1442,
+ - 2346,
+ - 785,
+ - 1546,
+ - 1988,
+ - 2003,
+ 257,
+ 909,
+ - 1849,
+ - 633,
+ - 1209,
+ - 1538,
+ - 1918,
+ - 1054,
+ 1606,
+ 2239,
+ 1576,
+ - 567,
+ - 1500,
+ - 1544,
+ - 1279,
+ 195,
+ 1369,
+ - 817,
+ 293,
+ 1219,
+ - 525,
+ 630,
+ 1197,
+ - 1698,
+ - 2425,
+ - 1840,
+ - 303,
+ 731,
+ 747,
+ - 1169,
+ - 251,
+ 269,
+ - 950,
+ - 75,
+ 1684,
+ - 1182,
+ - 453,
+ 1005,
+ - 1599,
+ 585,
+ 378,
+ - 2075,
+ - 571,
+ - 427,
+ - 529,
+ - 1159,
+ - 1171,
+ - 283,
+ - 205,
+ - 564,
+ - 796,
+ 1246,
+ 717,
+ 2277,
+ 927,
+ 539,
+ - 454,
+ 559,
+ 440,
+ - 717,
+ 1460,
+ 1615,
+ - 1030,
+ 1052,
+ 1610,
+ - 1169,
+ - 138,
+ 847,
+ 226,
+ 39,
+ - 612,
+ - 1251,
+ - 106,
+ - 729,
+ - 651,
+ 968,
+ 1302,
+ - 714,
+ - 636,
+ 1727,
+ 353,
+ 1069,
+ 410,
+ - 798,
+ - 156,
+ 1099,
+ - 574,
+ 918,
+ 446,
+ - 1310,
+ 1012,
+ 466,
+ 1408,
+ 1591,
+ 765,
+ 1429,
+ 1380,
+ 1757,
+ 1949,
+ 1956,
+ 2378,
+ 1578,
+ 2047,
+ 2148,
+ 916,
+ 98,
+ - 7,
+ 1893,
+ 1418,
+ 2141,
+ 348,
+ 1405,
+ 1579,
+ 152,
+ 1134,
+ 1801,
+ - 267,
+ 154,
+ 1395,
+ - 1166,
+ 469,
+ 1054,
+ - 1142,
+ - 405,
+ - 1073,
+ - 1341,
+ - 2264,
+ - 1581,
+ - 364,
+ 869,
+ 1706,
+ - 1162,
+ 549,
+ 1550,
+ - 1225,
+ - 1932,
+ - 1666,
+ - 1485,
+ - 1977,
+ - 2055,
+ - 1727,
+ - 906,
+ - 98,
+ - 1897,
+ 233,
+ 1492,
+ 892,
+ 108,
+ - 331,
+ - 1728,
+ - 1170,
+ - 1700,
+ - 1060,
+ 1980,
+ 1790,
+ - 1070,
+ - 1741,
+ - 1909,
+ - 11,
+ 1539,
+ 1317,
+ - 1600,
+ 94,
+ 497,
+ 421,
+ 443,
+ - 197,
+ - 1578,
+ - 349,
+ - 994,
+ - 599,
+ - 539,
+ 1140,
+ - 965,
+ - 1419,
+ - 129,
+ - 1341,
+ 175,
+ - 447,
+ - 375,
+ 1311,
+ 2055,
+ - 371,
+ - 650,
+ - 307,
+ - 1073,
+ 605,
+ 365,
+ - 2057,
+ - 113,
+ 430,
+ 652,
+ 914,
+ 967,
+ - 1012,
+ - 1586,
+ - 2323,
+ 1505,
+ 1248,
+ 559,
+ 262,
+ - 486,
+ - 401,
+ - 1727,
+ 1342,
+ 1546,
+ 50,
+ 56,
+ 432,
+ - 330,
+ 119,
+ - 604,
+ - 1517,
+ - 1080,
+ - 810,
+ 946,
+ 1127,
+ 1055,
+ - 1400,
+ - 1703,
+ - 1712,
+ - 1270,
+ - 704,
+ - 1317,
+ 807,
+ 1821,
+ 1143,
+ 2760,
+ 1606,
+ 2171,
+ 1120,
+ 409,
+ - 150,
+ - 147,
+ 404,
+ 959,
+ 2439,
+ 1911,
+ 2189,
+ - 906,
+ - 141,
+ - 866,
+ - 904,
+ - 142,
+ - 458,
+ - 557,
+ - 708,
+ - 1679,
+ - 830,
+ - 1431,
+ - 1583,
+ - 1842,
+ - 1346,
+ - 1086,
+ - 1604,
+ - 272,
+ 915,
+ - 1196,
+ 772,
+ 1056,
+ - 638,
+ - 1234,
+ - 1897,
+ - 500,
+ - 81,
+ - 822,
+ - 1289,
+ - 1613,
+ - 735,
+ - 117,
+ 785,
+ 168,
+ - 1090,
+ 1133,
+ 922,
+ - 1096,
+ - 746,
+ 1384,
+ 287,
+ - 547,
+ - 1063,
+ - 1376,
+ - 2201,
+ - 1204,
+ - 2176,
+ - 1570,
+ - 1757,
+ - 1511,
+ - 2241,
+ - 771,
+ - 1737,
+ 1099,
+ 830,
+ - 1588,
+ 724,
+ 1243,
+ - 1542,
+ 693,
+ 805,
+ - 1690,
+ - 240,
+ 1665,
+ - 1700,
+ - 4,
+ - 668,
+ 2149,
+ 816,
+ 1042,
+ - 818,
+ - 1841,
+ 22,
+ - 764,
+ - 507,
+ 449,
+ - 1151,
+ - 617,
+ 289,
+ - 843,
+ - 1596,
+ - 240,
+ 498,
+ - 234,
+ - 657,
+ - 752,
+ 480,
+ 1678,
+ - 319,
+ - 481,
+ 193,
+ - 811,
+ 171,
+ - 119,
+ - 2128,
+ - 202,
+ - 848,
+ 1717,
+ 1140,
+ 1700
};
/* 3rd LSF quantizer (not in MR122, MR515 and MR475) */
static const Word32 dico3_lsf_3[] =
{
- 67,
- - 17,
- 66,
- - 12,
- - 1690,
- - 581,
- - 104,
- - 272,
- - 1076,
- - 1186,
- - 1845,
- - 376,
- - 1140,
- - 926,
- - 420,
- - 58,
- - 259,
- - 656,
- - 1134,
- - 553,
- 1788,
- 1227,
- 455,
- 129,
- 462,
- 441,
- - 240,
- - 528,
- 840,
- 514,
- 130,
- - 75,
- 1114,
- 623,
- 153,
- 216,
- 1068,
- 564,
- - 6,
- - 276,
- 1119,
- 727,
- 190,
- - 68,
- 704,
- 306,
- 119,
- - 264,
- 329,
- 61,
- - 100,
- 156,
- 364,
- 123,
- 183,
- - 208,
- - 171,
- - 123,
- 220,
- - 65,
- - 306,
- - 62,
- 402,
- 17,
- - 660,
- - 938,
- - 266,
- 0,
- 385,
- 235,
- 276,
- 285,
- 320,
- 268,
- - 336,
- - 200,
- - 724,
- 17,
- - 84,
- 381,
- - 544,
- 429,
- 494,
- 519,
- - 117,
- 288,
- 304,
- 329,
- 643,
- 157,
- 701,
- 508,
- 1200,
- 625,
- 796,
- 608,
- 998,
- 421,
- 492,
- 632,
- 1204,
- 780,
- 446,
- 132,
- 1257,
- 844,
- 547,
- 449,
- 829,
- 658,
- 541,
- 470,
- 1132,
- 1258,
- 918,
- 639,
- 547,
- 51,
- 423,
- 279,
- 9,
- 392,
- 83,
- 94,
- 542,
- 543,
- 229,
- - 147,
- - 198,
- 129,
- 194,
- - 185,
- - 863,
- - 1321,
- - 302,
- 30,
- - 597,
- - 629,
- - 19,
- 114,
- - 900,
- - 1081,
- 466,
- 353,
- - 1483,
- - 1573,
- 15,
- - 143,
- - 1708,
- - 2059,
- - 751,
- 196,
- - 1876,
- - 2067,
- - 642,
- - 258,
- - 2335,
- - 1470,
- - 450,
- - 564,
- - 584,
- - 186,
- - 872,
- - 414,
- - 1805,
- - 988,
- - 1125,
- - 1310,
- - 726,
- - 1129,
- 28,
- 169,
- - 1039,
- - 864,
- - 718,
- - 246,
- 484,
- 36,
- - 233,
- - 49,
- 265,
- 67,
- 289,
- 467,
- 178,
- 543,
- 810,
- 540,
- 84,
- 282,
- 672,
- 703,
- - 975,
- - 777,
- 129,
- 287,
- - 938,
- - 227,
- 955,
- 595,
- - 1617,
- - 289,
- 836,
- 649,
- - 1847,
- - 215,
- 1106,
- 718,
- - 2034,
- - 1085,
- 650,
- 440,
- - 2101,
- - 529,
- 907,
- 575,
- - 2011,
- - 336,
- 670,
- 204,
- - 2389,
- - 692,
- 360,
- 137,
- - 2156,
- - 2204,
- - 9,
- 280,
- - 266,
- 119,
- 39,
- 193,
- 78,
- - 59,
- - 120,
- 226,
- - 975,
- - 858,
- - 781,
- - 1095,
- - 619,
- - 413,
- - 451,
- - 842,
- - 1216,
- - 1321,
- - 813,
- - 883,
- - 1376,
- - 1615,
- - 394,
- - 428,
- - 737,
- - 1113,
- - 549,
- - 790,
- - 880,
- - 975,
- - 967,
- - 642,
- - 985,
- - 886,
- - 1273,
- - 1361,
- - 473,
- - 804,
- - 1401,
- - 1407,
- 160,
- - 265,
- - 919,
- - 275,
- - 248,
- - 250,
- - 718,
- - 380,
- 97,
- - 103,
- - 375,
- - 229,
- - 415,
- - 193,
- - 135,
- - 555,
- 628,
- 361,
- 119,
- 216,
- 579,
- 364,
- 391,
- 209,
- 634,
- 522,
- - 154,
- - 148,
- 526,
- 389,
- 170,
- 33,
- 105,
- 267,
- 64,
- 380,
- - 1503,
- - 1000,
- - 30,
- - 369,
- - 1070,
- 58,
- 647,
- 223,
- - 1520,
- - 291,
- 621,
- 307,
- - 1531,
- 156,
- 762,
- 404,
- - 2029,
- 141,
- 734,
- 499,
- - 1849,
- - 650,
- 306,
- 512,
- - 187,
- - 104,
- - 59,
- 438,
- 134,
- - 230,
- 156,
- - 186,
- - 61,
- - 260,
- - 16,
- 10,
- - 569,
- - 3,
- - 421,
- - 297,
- - 1725,
- - 521,
- - 346,
- 178,
- - 1362,
- - 59,
- - 44,
- 157,
- - 2146,
- - 461,
- - 470,
- - 349,
- - 2170,
- - 1,
- - 369,
- - 121,
- - 1579,
- - 373,
- - 900,
- - 1015,
- - 1117,
- - 591,
- - 613,
- - 784,
- - 561,
- 122,
- - 75,
- - 449,
- - 4,
- - 171,
- - 123,
- - 372,
- 192,
- 168,
- - 76,
- - 132,
- 252,
- - 107,
- 340,
- 210,
- 392,
- 509,
- 272,
- 181,
- - 109,
- 145,
- 218,
- 119,
- - 416,
- - 263,
- 485,
- 265,
- - 181,
- - 8,
- - 286,
- 226,
- - 244,
- - 218,
- 69,
- - 290,
- - 158,
- 191,
- - 1,
- - 64,
- - 592,
- - 90,
- 213,
- - 96,
- 255,
- 435,
- 178,
- - 80,
- - 369,
- - 18,
- - 33,
- - 80,
- - 42,
- 415,
- 140,
- - 222,
- 1143,
- 651,
- 649,
- 329,
- 767,
- 556,
- 249,
- 235,
- 948,
- 413,
- 442,
- 279,
- 141,
- 339,
- 356,
- 557,
- - 470,
- - 170,
- 99,
- 237,
- - 569,
- - 800,
- 352,
- 565,
- 282,
- 473,
- 470,
- 332,
- - 199,
- - 690,
- - 1284,
- - 917,
- - 193,
- - 426,
- - 800,
- - 1122,
- - 26,
- - 371,
- - 490,
- - 193,
- 637,
- 595,
- 519,
- 330,
- 408,
- - 115,
- 79,
- 12,
- 477,
- 87,
- - 103,
- - 376,
- - 666,
- - 347,
- - 277,
- - 291,
- - 510,
- - 481,
- 169,
- 297,
- - 829,
- - 738,
- - 205,
- - 171,
- - 320,
- - 540,
- 328,
- 283,
- - 859,
- - 958,
- 442,
- - 2,
- 556,
- 686,
- 130,
- 56,
- 1383,
- 1012,
- 755,
- 427,
- 612,
- 741,
- 628,
- 553,
- - 339,
- - 796,
- 134,
- 277,
- - 633,
- - 1085,
- - 2,
- - 246,
- - 880,
- - 1035,
- - 1607,
- - 1064,
- - 994,
- - 474,
- - 1138,
- - 488,
- - 414,
- - 795,
- 73,
- - 206,
- - 8,
- - 139,
- 439,
- 204,
- - 176,
- - 578,
- 23,
- 131,
- - 269,
- - 757,
- - 191,
- 245,
- - 109,
- - 338,
- 112,
- 316,
- 120,
- - 406,
- - 118,
- 611,
- - 180,
- - 186,
- - 645,
- 115,
- - 173,
- 34,
- - 518,
- - 489,
- - 151,
- 61,
- - 583,
- - 844,
- 220,
- - 138,
- - 681,
- - 1020,
- 391,
- - 17,
- - 598,
- - 321,
- 157,
- - 295,
- 129,
- 155,
- - 926,
- - 875,
- - 987,
- 285,
- 241,
- - 83,
- - 125,
- - 125,
- 620,
- 597,
- 432,
- 92,
- 393,
- 78,
- 409,
- 61,
- - 393,
- - 739,
- - 413,
- - 748,
- 83,
- 54,
- 361,
- 27,
- - 1084,
- 130,
- - 337,
- - 694,
- - 1565,
- 297,
- 318,
- - 19,
- - 1873,
- 36,
- 51,
- - 317,
- - 2323,
- - 246,
- 231,
- - 84,
- - 2306,
- - 783,
- 40,
- - 179,
- - 2233,
- - 930,
- - 474,
- - 462,
- - 754,
- - 86,
- - 288,
- - 626,
- - 2411,
- - 455,
- - 63,
- 171,
- - 1099,
- - 1094,
- - 26,
- - 143,
- - 1193,
- - 455,
- - 406,
- - 381,
- - 605,
- - 210,
- - 96,
- - 51,
- - 580,
- - 476,
- - 276,
- - 15,
- - 1195,
- - 634,
- - 1203,
- - 881,
- - 378,
- - 221,
- - 669,
- - 952,
- 594,
- 178,
- - 403,
- - 676,
- 763,
- 327,
- 601,
- 290,
- 172,
- 300,
- 203,
- 157,
- - 56,
- - 336,
- 356,
- 24,
- - 228,
- - 296,
- - 259,
- - 29,
- - 186,
- 263,
- 416,
- 14,
- - 353,
- 373,
- - 12,
- - 216,
- 257,
- 96,
- 174,
- 57,
- - 1526,
- - 616,
- - 954,
- - 499,
- - 497,
- - 152,
- - 333,
- 125,
- 105,
- 200,
- 179,
- - 97,
- - 331,
- - 224,
- 765,
- 697,
- 760,
- 256,
- 301,
- 59,
- 455,
- - 85,
- 204,
- 288,
- - 514,
- 240,
- 251,
- - 109,
- 256,
- 417,
- - 34,
- - 413,
- 101,
- 430,
- 384,
- 156,
- - 31,
- - 10,
- 206,
- 426,
- 589,
- 145,
- 143,
- 71,
- 808,
- 906,
- 333,
- 349,
- 986,
- 938,
- 589,
- 331,
- 1300,
- 824,
- 187,
- 509,
- 1062,
- 653,
- 379,
- 466,
- 1462,
- 937,
- 401,
- 274,
- 787,
- 861,
- 265,
- 2,
- 609,
- 553,
- 28,
- 305,
- 926,
- 340,
- 106,
- 386,
- 241,
- - 267,
- - 147,
- 225,
- - 178,
- - 534,
- 347,
- 502,
- - 643,
- - 381,
- 397,
- 30,
- - 651,
- - 733,
- - 435,
- 398,
- - 407,
- - 726,
- - 484,
- - 248,
- - 789,
- - 914,
- - 438,
- - 476,
- - 498,
- - 390,
- 75,
- - 295,
- - 964,
- - 590,
- - 606,
- 150,
- - 121,
- - 49,
- - 155,
- - 78,
- 935,
- 550,
- 389,
- 38,
- - 321,
- 127,
- 424,
- 315,
- - 285,
- - 113,
- 283,
- 259,
- 658,
- 203,
- 322,
- 486,
- 903,
- 505,
- 748,
- 417,
- 611,
- 423,
- 555,
- 512,
- 239,
- - 83,
- - 578,
- - 19,
- - 339,
- - 731,
- 349,
- 13,
- - 934,
- - 1399,
- - 114,
- - 360,
- 107,
- 692,
- 182,
- 90,
- - 1243,
- - 1538,
- - 1551,
- - 725,
- - 568,
- - 903,
- - 1363,
- - 525,
- - 517,
- - 853,
- - 861,
- - 1004,
- - 168,
- - 690,
- - 835,
- 63,
- - 137,
- - 556,
- - 547,
- 144,
- - 286,
- - 817,
- 485,
- 319,
- - 147,
- - 408,
- 526,
- 246,
- - 347,
- - 434,
- 297,
- - 28,
- - 290,
- - 471,
- - 1110,
- - 1285,
- - 460,
- - 359,
- - 988,
- - 794,
- 1347,
- 1299,
- 690,
- 523,
- 1216,
- 1068,
- 1094,
- 757,
- 825,
- 1140,
- 752,
- 494,
- 1252,
- 1365,
- 1195,
- 898,
- 521,
- 1053,
- 532,
- 432,
- - 334,
- - 216,
- - 313,
- - 263,
- - 160,
- 52,
- - 472,
- - 155,
- 127,
- 136,
- - 380,
- 44,
- 851,
- 410,
- - 162,
- - 489,
- 123,
- - 255,
- - 796,
- - 667,
- 1090,
- 917,
- 789,
- 493,
- 1397,
- 1197,
- 558,
- 202,
- - 51,
- - 118,
- - 342,
- - 701,
- 83,
- 108,
- - 42,
- - 441,
- 61,
- 95,
- 287,
- 256,
- - 27,
- 89,
- 524,
- 531,
- 351,
- 227,
- 592,
- 545,
- 697,
- 155,
- - 164,
- 307,
- 638,
- 274,
- - 489,
- - 50,
- 754,
- 240,
- - 166,
- - 124,
- - 116,
- - 579,
- - 1212,
- - 63,
- 190,
- - 295,
- - 1040,
- - 1296,
- 147,
- - 376,
- - 177,
- - 113,
- 841,
- 1241,
- 1051,
- 668,
- 2,
- 293,
- 551,
- 304,
- - 1096,
- - 953,
- - 248,
- 376,
- - 750,
- - 965,
- 87,
- 516,
- - 275,
- - 516,
- 689,
- 391,
- - 379,
- - 643,
- 876,
- 594,
- - 390,
- - 1013,
- - 645,
- 573,
- - 107,
- - 568,
- - 689,
- - 826,
- - 1025,
- - 27,
- - 328,
- - 203,
- 861,
- 749,
- 548,
- 233,
- - 1660,
- - 1043,
- 451,
- 108,
- - 660,
- - 620,
- 430,
- 236,
- 21,
- - 396,
- - 1158,
- - 631,
- 1372,
- 1298,
- 967,
- 577,
- 1125,
- 1125,
- 589,
- 454,
- - 323,
- - 865,
- - 467,
- 153,
- - 468,
- - 699,
- - 804,
- - 509,
- - 392,
- - 718,
- - 204,
- - 35,
- - 603,
- - 1093,
- - 567,
- - 162,
- - 505,
- - 1004,
- - 102,
- 350,
- 219,
- 224,
- 423,
- 252,
- 395,
- 591,
- 608,
- 363,
- - 746,
- - 96,
- 373,
- 172,
- 171,
- 295,
- 714,
- 339,
- 233,
- 77,
- 107,
- 277,
- 157,
- 153,
- - 499,
- - 356,
- 1547,
- 1073,
- 576,
- 494,
- - 292,
- - 339,
- - 504,
- - 592,
- - 903,
- - 72,
- - 619,
- - 481,
- - 1594,
- - 1117,
- - 567,
- - 254,
- - 793,
- - 507,
- - 564,
- - 291,
- - 492,
- - 532,
- 502,
- 560,
- - 382,
- 427,
- 600,
- 230,
- - 227,
- 477,
- 251,
- 75,
- 285,
- 842,
- 813,
- 476,
- - 1310,
- - 1333,
- 186,
- 377,
- - 587,
- - 917,
- 643,
- 381,
- - 1186,
- - 553,
- 411,
- 82,
- - 1127,
- - 820,
- - 174,
- - 540,
- - 604,
- 119,
- 543,
- 205,
- - 380,
- 657,
- 909,
- 567,
- 112,
- - 298,
- - 374,
- 114,
- - 857,
- - 251,
- 56,
- 159,
- 401,
- 345,
- - 34,
- - 140,
- - 111,
- - 607,
- 41,
- 614,
- 355,
- - 114,
- - 77,
- 474,
- 578,
- 56,
- 1450,
- 924,
- 1098,
- 1420,
- 741,
- 400,
- 246,
- 22,
- 588,
- 313,
- - 121,
- 327,
- 831,
- 472,
- - 1138,
- - 608,
- 856,
- 552,
- - 1241,
- - 1072,
- 638,
- 600,
- - 358,
- 254,
- - 333,
- - 303,
- - 646,
- 739,
- 358,
- 74,
- 1226,
- 1671,
- 1221,
- 849,
- 2241,
- 1624,
- 983,
- 636,
- 1841,
- 1477,
- 749,
- 384,
- 350,
- 263,
- 87,
- 128,
- - 1902,
- - 941,
- - 144,
- - 64,
- - 1734,
- - 255,
- 288,
- - 31,
- - 2644,
- - 1238,
- 366,
- 235,
- - 1643,
- - 1092,
- - 1344,
- - 304,
- - 541,
- - 1075,
- - 1116,
- 123,
- - 1178,
- - 252,
- - 816,
- - 180,
- - 1016,
- 533,
- 565,
- 233,
- - 487,
- - 430,
- - 188,
- 334,
- 867,
- 1236,
- 534,
- 171,
- - 1590,
- - 1607,
- 635,
- 630,
- - 2196,
- 310,
- 924,
- 412,
- - 2358,
- - 328,
- 956,
- 529,
- - 2639,
- - 377,
- 630,
- 278,
- - 2602,
- 317,
- 799,
- 299,
- - 2406,
- 133,
- 340,
- 31,
- - 2156,
- - 1468,
- 131,
- 125,
- - 1184,
- - 490,
- - 139,
- 46,
- - 744,
- 447,
- 891,
- 564,
- 67,
- - 451,
- 646,
- 604,
- - 553,
- - 429,
- - 876,
- 396,
- 162,
- - 66,
- 1305,
- 915,
- 479,
- 579,
- 1088,
- 794,
- 450,
- 278,
- 566,
- 324,
- - 1057,
- - 154,
- 148,
- - 177,
- - 2545,
- 168,
- 1070,
- 592,
- - 2351,
- - 42,
- 819,
- 345,
- - 2344,
- - 707,
- 721,
- 250,
- - 2175,
- - 1497,
- - 309,
- 122,
- - 78,
- - 73,
- 120,
- 173,
- - 4,
- 262,
- - 263,
- - 261,
- - 431,
- - 64,
- - 405,
- - 732,
- - 2609,
- 116,
- - 83,
- - 193,
- - 1525,
- - 944,
- - 477,
- - 725,
- - 508,
- 307,
- 170,
- 172,
- 832,
- 417,
- 832,
- 686,
- - 225,
- 177,
- 894,
- 818,
- - 482,
- - 389,
- 1279,
- 1039,
- - 383,
- 201,
- - 350,
- 40,
- 730,
- 635,
- 226,
- 526,
- 503,
- 462,
- 338,
- 398,
- 535,
- 714,
- 40,
- - 282,
- 1482,
- 1471,
- 1085,
- 731,
- 1561,
- 1072,
- 909,
- 693,
- 1419,
- 1282,
- 889,
- 879,
- 1153,
- 728,
- 1186,
- 840,
- - 226,
- 1130,
- 949,
- 689,
- - 494,
- - 986,
- - 1556,
- - 128,
- - 568,
- - 721,
- - 713,
- - 26,
- 317,
- 524,
- 70,
- 135,
- - 405,
- - 865,
- - 1766,
- - 652,
- - 174,
- - 801,
- 885,
- 773,
- - 153,
- - 91,
- 1099,
- 751,
- - 506,
- - 1149,
- 853,
- 646,
- 241,
- 782,
- 519,
- 539,
- 1853,
- 1700,
- 1101,
- 684,
- - 1249,
- - 1486,
- - 464,
- 188,
- - 893,
- - 1409,
- - 1312,
- - 341,
- - 135,
- 438,
- - 175,
- 18,
- 1111,
- 976,
- 319,
- 208,
- - 1430,
- - 1768,
- 83,
- 458,
- - 530,
- - 1000,
- 307,
- 129,
- - 840,
- - 15,
- - 29,
- - 356,
- - 911,
- - 924,
- - 1147,
- - 242,
- - 119,
- - 528,
- 127,
- - 133,
- - 761,
- - 765,
- 190,
- - 83,
- - 315,
- 895,
- 522,
- 231,
- - 222,
- 102,
- - 63,
- - 428,
- 316,
- 699,
- 379,
- 70,
- 25,
- 716,
- 314,
- - 108,
- 507,
- 874,
- 566,
- 238,
- 108,
- 941,
- 519,
- 195,
- 425,
- - 60,
- - 427,
- 257,
- 139,
- - 103,
- - 630,
- 446,
- 334,
- 370,
- 412,
- 48,
- - 172,
- - 690,
- - 283,
- 557,
- 187,
- - 286,
- 158,
- 483,
- 140,
- 270,
- - 344,
- - 631,
- 924,
- 579,
- - 116,
- 132,
- 142,
- 466,
- - 68,
- - 64,
- 230,
- - 145,
- - 302,
- - 542,
- - 803,
- - 912,
- 1018,
- 737,
- - 773,
- 1015,
- 630,
- 297,
- - 2596,
- 95,
- 445,
- 336,
- - 2122,
- 491,
- 510,
- 191,
- - 1253,
- 161,
- - 2,
- - 324,
- - 1450,
- - 633,
- - 712,
- - 105,
- - 842,
- - 254,
- - 411,
- 100,
- - 640,
- - 290,
- 1010,
- 763,
- - 650,
- 313,
- 1169,
- 730,
- 140,
- 505,
- 1030,
- 766,
- 772,
- 287,
- 1067,
- 823,
- 495,
- 749,
- 305,
- 323,
- - 164,
- 462,
- 78,
- 399,
- - 342,
- - 874,
- 69,
- 597,
- - 16,
- 620,
- 621,
- 337,
- - 138,
- - 444,
- - 265,
- 218,
- 84,
- - 450,
- 953,
- 666,
- - 222,
- - 803,
- 541,
- 604,
- - 921,
- - 1376,
- 244,
- 116,
- - 841,
- - 723,
- 630,
- 588,
- 140,
- 663,
- 294,
- 368,
- 935,
- 1046,
- 881,
- 759,
- 1746,
- 1464,
- 916,
- 628,
- 436,
- 963,
- 281,
- 1,
- - 119,
- 74,
- 542,
- 213,
- 1,
- - 567,
- 301,
- 241,
- 260,
- 435,
- 222,
- 396,
- 936,
- 957,
- 1108,
- 703,
- 510,
- 506,
- 808,
- 478,
- 601,
- 694,
- 960,
- 620,
- 972,
- 741,
- 980,
- 600,
- 834,
- 717,
- 767,
- 684,
- 643,
- 972,
- 935,
- 638,
- 501,
- 661,
- 720,
- 851,
- - 105,
- - 632,
- - 303,
- - 117,
- - 429,
- 130,
- 789,
- 442,
- - 522,
- - 188,
- 704,
- 373,
- - 759,
- 42,
- 814,
- 523,
- - 531,
- - 1137,
- 373,
- 578,
- - 682,
- - 1203,
- - 455,
- 285,
- - 1163,
- - 1577,
- - 1098,
- 44,
- 81,
- - 82,
- 712,
- 363,
- 477,
- 246,
- 954,
- 622,
- 1604,
- 1622,
- 1277,
- 891,
- 1409,
- 859,
- 924,
- 892,
- 774,
- 1041,
- 947,
- 1142,
- 40,
- - 546,
- - 75,
- 288,
- - 616,
- - 106,
- - 697,
- - 26,
- - 169,
- - 160,
- - 891,
- - 739,
- - 279,
- - 384,
- - 1029,
- - 350,
- 1781,
- 1308,
- 1046,
- 816,
- 1580,
- 1533,
- 1472,
- 1178,
- 1505,
- 1076,
- 1216,
- 899,
- 890,
- 904,
- 564,
- 654,
- 920,
- 692,
- 1021,
- 856,
- - 493,
- 132,
- 177,
- 505,
- 71,
- 195,
- - 28,
- 97,
- 456,
- 351,
- - 164,
- 88,
- 439,
- 278,
- - 40,
- 350,
- 1395,
- 949,
- 234,
- - 95,
- - 805,
- - 472,
- 38,
- - 163,
- 367,
- - 98,
- 489,
- 523,
- 1025,
- 1178,
- 1212,
- 906,
- 319,
- 1314,
- 814,
- 461,
- - 123,
- - 543,
- - 804,
- 447,
- - 748,
- - 324,
- - 897,
- - 1127,
- - 737,
- - 501,
- - 789,
- - 713,
- 715,
- 777,
- 1239,
- 922,
- 1949,
- 1939,
- 1368,
- 865,
- 730,
- 880,
- 758,
- 388,
- - 871,
- 454,
- 17,
- - 251,
- - 381,
- - 810,
- - 1583,
- 239,
- - 521,
- - 966,
- - 792,
- 259,
- - 890,
- - 1358,
- - 770,
- - 73,
- 166,
- 349,
- - 212,
- 323,
- - 840,
- - 301,
- 473,
- 435,
- - 679,
- - 464,
- 728,
- 351,
- - 156,
- - 199,
- 667,
- 432,
- 29,
- - 252,
- 415,
- 480,
- - 731,
- - 379,
- 145,
- 559,
- - 528,
- - 631,
- - 1158,
- - 159,
- 445,
- 273,
- 123,
- 639,
- 373,
- - 126,
- 800,
- 568,
- 84,
- - 162,
- 720,
- 712,
- - 830,
- - 536,
- - 185,
- 222,
- 408,
- 452,
- 501,
- 771,
- - 897,
- - 1355,
- - 67,
- 442,
- - 792,
- - 1406,
- 566,
- 602,
- 167,
- - 326,
- 509,
- 330,
- - 95,
- - 626,
- - 730,
- - 344,
- 1668,
- 1217,
- 779,
- 455,
- 1316,
- 828,
- 584,
- 719,
- 404,
- - 31,
- 1013,
- 789,
- 89,
- 107,
- 891,
- 549,
- 871,
- 1581,
- 917,
- 671,
- 866,
- 1479,
- 1289,
- 854,
- 391,
- 1068,
- 1122,
- 812,
- 78,
- - 562,
- 345,
- 563,
- 429,
- - 103,
- 417,
- 787,
- - 122,
- - 437,
- 411,
- 788,
- - 913,
- - 417,
- 602,
- 754,
- - 226,
- - 16,
- 151,
- 760,
- - 700,
- 118,
- - 104,
- - 14,
- - 1128,
- 48,
- 284,
- 393,
- - 390,
- - 419,
- - 639,
- - 116,
- - 910,
- 306,
- 316,
- - 13,
- 1207,
- 984,
- 821,
- 669,
- - 1195,
- - 693,
- 140,
- - 213,
- - 884,
- - 416,
- - 199,
- - 558,
- - 616,
- 245,
- - 404,
- - 664,
- 262,
- 56,
- - 617,
- - 724,
- - 85,
- - 491,
- - 320,
- - 656,
- - 570,
- - 831,
- - 129,
- - 528,
- - 1506,
- - 63,
- - 367,
- - 385,
- - 358,
- - 321,
- 4,
- 51,
- - 366,
- - 214,
- 319,
- 511,
- 146,
- 671,
- - 17,
- - 291,
- - 110,
- 464,
- - 139,
- - 496,
- - 202,
- 220,
- - 312,
- - 631,
- - 660,
- - 73,
- - 655,
- - 820,
- - 662,
- - 653,
- - 1288,
- - 857,
- - 430,
- - 953,
- - 959,
- - 264,
- - 49,
- - 468,
- - 72,
- - 381,
- - 350,
- - 563,
- - 193,
- - 407,
- 55,
- - 408,
- - 803,
- 11,
- - 309,
- 649,
- 188,
- - 198,
- - 512,
- 461,
- - 79,
- - 458,
- - 1318,
- - 263,
- - 134,
- - 523,
- - 1657,
- - 435,
- - 495,
- - 765,
- 57,
- - 347,
- - 414,
- 434,
- - 1141,
- - 242,
- - 664,
- - 857,
- 34,
- - 68,
- - 707,
- - 338
+ 67,
+ - 17,
+ 66,
+ - 12,
+ - 1690,
+ - 581,
+ - 104,
+ - 272,
+ - 1076,
+ - 1186,
+ - 1845,
+ - 376,
+ - 1140,
+ - 926,
+ - 420,
+ - 58,
+ - 259,
+ - 656,
+ - 1134,
+ - 553,
+ 1788,
+ 1227,
+ 455,
+ 129,
+ 462,
+ 441,
+ - 240,
+ - 528,
+ 840,
+ 514,
+ 130,
+ - 75,
+ 1114,
+ 623,
+ 153,
+ 216,
+ 1068,
+ 564,
+ - 6,
+ - 276,
+ 1119,
+ 727,
+ 190,
+ - 68,
+ 704,
+ 306,
+ 119,
+ - 264,
+ 329,
+ 61,
+ - 100,
+ 156,
+ 364,
+ 123,
+ 183,
+ - 208,
+ - 171,
+ - 123,
+ 220,
+ - 65,
+ - 306,
+ - 62,
+ 402,
+ 17,
+ - 660,
+ - 938,
+ - 266,
+ 0,
+ 385,
+ 235,
+ 276,
+ 285,
+ 320,
+ 268,
+ - 336,
+ - 200,
+ - 724,
+ 17,
+ - 84,
+ 381,
+ - 544,
+ 429,
+ 494,
+ 519,
+ - 117,
+ 288,
+ 304,
+ 329,
+ 643,
+ 157,
+ 701,
+ 508,
+ 1200,
+ 625,
+ 796,
+ 608,
+ 998,
+ 421,
+ 492,
+ 632,
+ 1204,
+ 780,
+ 446,
+ 132,
+ 1257,
+ 844,
+ 547,
+ 449,
+ 829,
+ 658,
+ 541,
+ 470,
+ 1132,
+ 1258,
+ 918,
+ 639,
+ 547,
+ 51,
+ 423,
+ 279,
+ 9,
+ 392,
+ 83,
+ 94,
+ 542,
+ 543,
+ 229,
+ - 147,
+ - 198,
+ 129,
+ 194,
+ - 185,
+ - 863,
+ - 1321,
+ - 302,
+ 30,
+ - 597,
+ - 629,
+ - 19,
+ 114,
+ - 900,
+ - 1081,
+ 466,
+ 353,
+ - 1483,
+ - 1573,
+ 15,
+ - 143,
+ - 1708,
+ - 2059,
+ - 751,
+ 196,
+ - 1876,
+ - 2067,
+ - 642,
+ - 258,
+ - 2335,
+ - 1470,
+ - 450,
+ - 564,
+ - 584,
+ - 186,
+ - 872,
+ - 414,
+ - 1805,
+ - 988,
+ - 1125,
+ - 1310,
+ - 726,
+ - 1129,
+ 28,
+ 169,
+ - 1039,
+ - 864,
+ - 718,
+ - 246,
+ 484,
+ 36,
+ - 233,
+ - 49,
+ 265,
+ 67,
+ 289,
+ 467,
+ 178,
+ 543,
+ 810,
+ 540,
+ 84,
+ 282,
+ 672,
+ 703,
+ - 975,
+ - 777,
+ 129,
+ 287,
+ - 938,
+ - 227,
+ 955,
+ 595,
+ - 1617,
+ - 289,
+ 836,
+ 649,
+ - 1847,
+ - 215,
+ 1106,
+ 718,
+ - 2034,
+ - 1085,
+ 650,
+ 440,
+ - 2101,
+ - 529,
+ 907,
+ 575,
+ - 2011,
+ - 336,
+ 670,
+ 204,
+ - 2389,
+ - 692,
+ 360,
+ 137,
+ - 2156,
+ - 2204,
+ - 9,
+ 280,
+ - 266,
+ 119,
+ 39,
+ 193,
+ 78,
+ - 59,
+ - 120,
+ 226,
+ - 975,
+ - 858,
+ - 781,
+ - 1095,
+ - 619,
+ - 413,
+ - 451,
+ - 842,
+ - 1216,
+ - 1321,
+ - 813,
+ - 883,
+ - 1376,
+ - 1615,
+ - 394,
+ - 428,
+ - 737,
+ - 1113,
+ - 549,
+ - 790,
+ - 880,
+ - 975,
+ - 967,
+ - 642,
+ - 985,
+ - 886,
+ - 1273,
+ - 1361,
+ - 473,
+ - 804,
+ - 1401,
+ - 1407,
+ 160,
+ - 265,
+ - 919,
+ - 275,
+ - 248,
+ - 250,
+ - 718,
+ - 380,
+ 97,
+ - 103,
+ - 375,
+ - 229,
+ - 415,
+ - 193,
+ - 135,
+ - 555,
+ 628,
+ 361,
+ 119,
+ 216,
+ 579,
+ 364,
+ 391,
+ 209,
+ 634,
+ 522,
+ - 154,
+ - 148,
+ 526,
+ 389,
+ 170,
+ 33,
+ 105,
+ 267,
+ 64,
+ 380,
+ - 1503,
+ - 1000,
+ - 30,
+ - 369,
+ - 1070,
+ 58,
+ 647,
+ 223,
+ - 1520,
+ - 291,
+ 621,
+ 307,
+ - 1531,
+ 156,
+ 762,
+ 404,
+ - 2029,
+ 141,
+ 734,
+ 499,
+ - 1849,
+ - 650,
+ 306,
+ 512,
+ - 187,
+ - 104,
+ - 59,
+ 438,
+ 134,
+ - 230,
+ 156,
+ - 186,
+ - 61,
+ - 260,
+ - 16,
+ 10,
+ - 569,
+ - 3,
+ - 421,
+ - 297,
+ - 1725,
+ - 521,
+ - 346,
+ 178,
+ - 1362,
+ - 59,
+ - 44,
+ 157,
+ - 2146,
+ - 461,
+ - 470,
+ - 349,
+ - 2170,
+ - 1,
+ - 369,
+ - 121,
+ - 1579,
+ - 373,
+ - 900,
+ - 1015,
+ - 1117,
+ - 591,
+ - 613,
+ - 784,
+ - 561,
+ 122,
+ - 75,
+ - 449,
+ - 4,
+ - 171,
+ - 123,
+ - 372,
+ 192,
+ 168,
+ - 76,
+ - 132,
+ 252,
+ - 107,
+ 340,
+ 210,
+ 392,
+ 509,
+ 272,
+ 181,
+ - 109,
+ 145,
+ 218,
+ 119,
+ - 416,
+ - 263,
+ 485,
+ 265,
+ - 181,
+ - 8,
+ - 286,
+ 226,
+ - 244,
+ - 218,
+ 69,
+ - 290,
+ - 158,
+ 191,
+ - 1,
+ - 64,
+ - 592,
+ - 90,
+ 213,
+ - 96,
+ 255,
+ 435,
+ 178,
+ - 80,
+ - 369,
+ - 18,
+ - 33,
+ - 80,
+ - 42,
+ 415,
+ 140,
+ - 222,
+ 1143,
+ 651,
+ 649,
+ 329,
+ 767,
+ 556,
+ 249,
+ 235,
+ 948,
+ 413,
+ 442,
+ 279,
+ 141,
+ 339,
+ 356,
+ 557,
+ - 470,
+ - 170,
+ 99,
+ 237,
+ - 569,
+ - 800,
+ 352,
+ 565,
+ 282,
+ 473,
+ 470,
+ 332,
+ - 199,
+ - 690,
+ - 1284,
+ - 917,
+ - 193,
+ - 426,
+ - 800,
+ - 1122,
+ - 26,
+ - 371,
+ - 490,
+ - 193,
+ 637,
+ 595,
+ 519,
+ 330,
+ 408,
+ - 115,
+ 79,
+ 12,
+ 477,
+ 87,
+ - 103,
+ - 376,
+ - 666,
+ - 347,
+ - 277,
+ - 291,
+ - 510,
+ - 481,
+ 169,
+ 297,
+ - 829,
+ - 738,
+ - 205,
+ - 171,
+ - 320,
+ - 540,
+ 328,
+ 283,
+ - 859,
+ - 958,
+ 442,
+ - 2,
+ 556,
+ 686,
+ 130,
+ 56,
+ 1383,
+ 1012,
+ 755,
+ 427,
+ 612,
+ 741,
+ 628,
+ 553,
+ - 339,
+ - 796,
+ 134,
+ 277,
+ - 633,
+ - 1085,
+ - 2,
+ - 246,
+ - 880,
+ - 1035,
+ - 1607,
+ - 1064,
+ - 994,
+ - 474,
+ - 1138,
+ - 488,
+ - 414,
+ - 795,
+ 73,
+ - 206,
+ - 8,
+ - 139,
+ 439,
+ 204,
+ - 176,
+ - 578,
+ 23,
+ 131,
+ - 269,
+ - 757,
+ - 191,
+ 245,
+ - 109,
+ - 338,
+ 112,
+ 316,
+ 120,
+ - 406,
+ - 118,
+ 611,
+ - 180,
+ - 186,
+ - 645,
+ 115,
+ - 173,
+ 34,
+ - 518,
+ - 489,
+ - 151,
+ 61,
+ - 583,
+ - 844,
+ 220,
+ - 138,
+ - 681,
+ - 1020,
+ 391,
+ - 17,
+ - 598,
+ - 321,
+ 157,
+ - 295,
+ 129,
+ 155,
+ - 926,
+ - 875,
+ - 987,
+ 285,
+ 241,
+ - 83,
+ - 125,
+ - 125,
+ 620,
+ 597,
+ 432,
+ 92,
+ 393,
+ 78,
+ 409,
+ 61,
+ - 393,
+ - 739,
+ - 413,
+ - 748,
+ 83,
+ 54,
+ 361,
+ 27,
+ - 1084,
+ 130,
+ - 337,
+ - 694,
+ - 1565,
+ 297,
+ 318,
+ - 19,
+ - 1873,
+ 36,
+ 51,
+ - 317,
+ - 2323,
+ - 246,
+ 231,
+ - 84,
+ - 2306,
+ - 783,
+ 40,
+ - 179,
+ - 2233,
+ - 930,
+ - 474,
+ - 462,
+ - 754,
+ - 86,
+ - 288,
+ - 626,
+ - 2411,
+ - 455,
+ - 63,
+ 171,
+ - 1099,
+ - 1094,
+ - 26,
+ - 143,
+ - 1193,
+ - 455,
+ - 406,
+ - 381,
+ - 605,
+ - 210,
+ - 96,
+ - 51,
+ - 580,
+ - 476,
+ - 276,
+ - 15,
+ - 1195,
+ - 634,
+ - 1203,
+ - 881,
+ - 378,
+ - 221,
+ - 669,
+ - 952,
+ 594,
+ 178,
+ - 403,
+ - 676,
+ 763,
+ 327,
+ 601,
+ 290,
+ 172,
+ 300,
+ 203,
+ 157,
+ - 56,
+ - 336,
+ 356,
+ 24,
+ - 228,
+ - 296,
+ - 259,
+ - 29,
+ - 186,
+ 263,
+ 416,
+ 14,
+ - 353,
+ 373,
+ - 12,
+ - 216,
+ 257,
+ 96,
+ 174,
+ 57,
+ - 1526,
+ - 616,
+ - 954,
+ - 499,
+ - 497,
+ - 152,
+ - 333,
+ 125,
+ 105,
+ 200,
+ 179,
+ - 97,
+ - 331,
+ - 224,
+ 765,
+ 697,
+ 760,
+ 256,
+ 301,
+ 59,
+ 455,
+ - 85,
+ 204,
+ 288,
+ - 514,
+ 240,
+ 251,
+ - 109,
+ 256,
+ 417,
+ - 34,
+ - 413,
+ 101,
+ 430,
+ 384,
+ 156,
+ - 31,
+ - 10,
+ 206,
+ 426,
+ 589,
+ 145,
+ 143,
+ 71,
+ 808,
+ 906,
+ 333,
+ 349,
+ 986,
+ 938,
+ 589,
+ 331,
+ 1300,
+ 824,
+ 187,
+ 509,
+ 1062,
+ 653,
+ 379,
+ 466,
+ 1462,
+ 937,
+ 401,
+ 274,
+ 787,
+ 861,
+ 265,
+ 2,
+ 609,
+ 553,
+ 28,
+ 305,
+ 926,
+ 340,
+ 106,
+ 386,
+ 241,
+ - 267,
+ - 147,
+ 225,
+ - 178,
+ - 534,
+ 347,
+ 502,
+ - 643,
+ - 381,
+ 397,
+ 30,
+ - 651,
+ - 733,
+ - 435,
+ 398,
+ - 407,
+ - 726,
+ - 484,
+ - 248,
+ - 789,
+ - 914,
+ - 438,
+ - 476,
+ - 498,
+ - 390,
+ 75,
+ - 295,
+ - 964,
+ - 590,
+ - 606,
+ 150,
+ - 121,
+ - 49,
+ - 155,
+ - 78,
+ 935,
+ 550,
+ 389,
+ 38,
+ - 321,
+ 127,
+ 424,
+ 315,
+ - 285,
+ - 113,
+ 283,
+ 259,
+ 658,
+ 203,
+ 322,
+ 486,
+ 903,
+ 505,
+ 748,
+ 417,
+ 611,
+ 423,
+ 555,
+ 512,
+ 239,
+ - 83,
+ - 578,
+ - 19,
+ - 339,
+ - 731,
+ 349,
+ 13,
+ - 934,
+ - 1399,
+ - 114,
+ - 360,
+ 107,
+ 692,
+ 182,
+ 90,
+ - 1243,
+ - 1538,
+ - 1551,
+ - 725,
+ - 568,
+ - 903,
+ - 1363,
+ - 525,
+ - 517,
+ - 853,
+ - 861,
+ - 1004,
+ - 168,
+ - 690,
+ - 835,
+ 63,
+ - 137,
+ - 556,
+ - 547,
+ 144,
+ - 286,
+ - 817,
+ 485,
+ 319,
+ - 147,
+ - 408,
+ 526,
+ 246,
+ - 347,
+ - 434,
+ 297,
+ - 28,
+ - 290,
+ - 471,
+ - 1110,
+ - 1285,
+ - 460,
+ - 359,
+ - 988,
+ - 794,
+ 1347,
+ 1299,
+ 690,
+ 523,
+ 1216,
+ 1068,
+ 1094,
+ 757,
+ 825,
+ 1140,
+ 752,
+ 494,
+ 1252,
+ 1365,
+ 1195,
+ 898,
+ 521,
+ 1053,
+ 532,
+ 432,
+ - 334,
+ - 216,
+ - 313,
+ - 263,
+ - 160,
+ 52,
+ - 472,
+ - 155,
+ 127,
+ 136,
+ - 380,
+ 44,
+ 851,
+ 410,
+ - 162,
+ - 489,
+ 123,
+ - 255,
+ - 796,
+ - 667,
+ 1090,
+ 917,
+ 789,
+ 493,
+ 1397,
+ 1197,
+ 558,
+ 202,
+ - 51,
+ - 118,
+ - 342,
+ - 701,
+ 83,
+ 108,
+ - 42,
+ - 441,
+ 61,
+ 95,
+ 287,
+ 256,
+ - 27,
+ 89,
+ 524,
+ 531,
+ 351,
+ 227,
+ 592,
+ 545,
+ 697,
+ 155,
+ - 164,
+ 307,
+ 638,
+ 274,
+ - 489,
+ - 50,
+ 754,
+ 240,
+ - 166,
+ - 124,
+ - 116,
+ - 579,
+ - 1212,
+ - 63,
+ 190,
+ - 295,
+ - 1040,
+ - 1296,
+ 147,
+ - 376,
+ - 177,
+ - 113,
+ 841,
+ 1241,
+ 1051,
+ 668,
+ 2,
+ 293,
+ 551,
+ 304,
+ - 1096,
+ - 953,
+ - 248,
+ 376,
+ - 750,
+ - 965,
+ 87,
+ 516,
+ - 275,
+ - 516,
+ 689,
+ 391,
+ - 379,
+ - 643,
+ 876,
+ 594,
+ - 390,
+ - 1013,
+ - 645,
+ 573,
+ - 107,
+ - 568,
+ - 689,
+ - 826,
+ - 1025,
+ - 27,
+ - 328,
+ - 203,
+ 861,
+ 749,
+ 548,
+ 233,
+ - 1660,
+ - 1043,
+ 451,
+ 108,
+ - 660,
+ - 620,
+ 430,
+ 236,
+ 21,
+ - 396,
+ - 1158,
+ - 631,
+ 1372,
+ 1298,
+ 967,
+ 577,
+ 1125,
+ 1125,
+ 589,
+ 454,
+ - 323,
+ - 865,
+ - 467,
+ 153,
+ - 468,
+ - 699,
+ - 804,
+ - 509,
+ - 392,
+ - 718,
+ - 204,
+ - 35,
+ - 603,
+ - 1093,
+ - 567,
+ - 162,
+ - 505,
+ - 1004,
+ - 102,
+ 350,
+ 219,
+ 224,
+ 423,
+ 252,
+ 395,
+ 591,
+ 608,
+ 363,
+ - 746,
+ - 96,
+ 373,
+ 172,
+ 171,
+ 295,
+ 714,
+ 339,
+ 233,
+ 77,
+ 107,
+ 277,
+ 157,
+ 153,
+ - 499,
+ - 356,
+ 1547,
+ 1073,
+ 576,
+ 494,
+ - 292,
+ - 339,
+ - 504,
+ - 592,
+ - 903,
+ - 72,
+ - 619,
+ - 481,
+ - 1594,
+ - 1117,
+ - 567,
+ - 254,
+ - 793,
+ - 507,
+ - 564,
+ - 291,
+ - 492,
+ - 532,
+ 502,
+ 560,
+ - 382,
+ 427,
+ 600,
+ 230,
+ - 227,
+ 477,
+ 251,
+ 75,
+ 285,
+ 842,
+ 813,
+ 476,
+ - 1310,
+ - 1333,
+ 186,
+ 377,
+ - 587,
+ - 917,
+ 643,
+ 381,
+ - 1186,
+ - 553,
+ 411,
+ 82,
+ - 1127,
+ - 820,
+ - 174,
+ - 540,
+ - 604,
+ 119,
+ 543,
+ 205,
+ - 380,
+ 657,
+ 909,
+ 567,
+ 112,
+ - 298,
+ - 374,
+ 114,
+ - 857,
+ - 251,
+ 56,
+ 159,
+ 401,
+ 345,
+ - 34,
+ - 140,
+ - 111,
+ - 607,
+ 41,
+ 614,
+ 355,
+ - 114,
+ - 77,
+ 474,
+ 578,
+ 56,
+ 1450,
+ 924,
+ 1098,
+ 1420,
+ 741,
+ 400,
+ 246,
+ 22,
+ 588,
+ 313,
+ - 121,
+ 327,
+ 831,
+ 472,
+ - 1138,
+ - 608,
+ 856,
+ 552,
+ - 1241,
+ - 1072,
+ 638,
+ 600,
+ - 358,
+ 254,
+ - 333,
+ - 303,
+ - 646,
+ 739,
+ 358,
+ 74,
+ 1226,
+ 1671,
+ 1221,
+ 849,
+ 2241,
+ 1624,
+ 983,
+ 636,
+ 1841,
+ 1477,
+ 749,
+ 384,
+ 350,
+ 263,
+ 87,
+ 128,
+ - 1902,
+ - 941,
+ - 144,
+ - 64,
+ - 1734,
+ - 255,
+ 288,
+ - 31,
+ - 2644,
+ - 1238,
+ 366,
+ 235,
+ - 1643,
+ - 1092,
+ - 1344,
+ - 304,
+ - 541,
+ - 1075,
+ - 1116,
+ 123,
+ - 1178,
+ - 252,
+ - 816,
+ - 180,
+ - 1016,
+ 533,
+ 565,
+ 233,
+ - 487,
+ - 430,
+ - 188,
+ 334,
+ 867,
+ 1236,
+ 534,
+ 171,
+ - 1590,
+ - 1607,
+ 635,
+ 630,
+ - 2196,
+ 310,
+ 924,
+ 412,
+ - 2358,
+ - 328,
+ 956,
+ 529,
+ - 2639,
+ - 377,
+ 630,
+ 278,
+ - 2602,
+ 317,
+ 799,
+ 299,
+ - 2406,
+ 133,
+ 340,
+ 31,
+ - 2156,
+ - 1468,
+ 131,
+ 125,
+ - 1184,
+ - 490,
+ - 139,
+ 46,
+ - 744,
+ 447,
+ 891,
+ 564,
+ 67,
+ - 451,
+ 646,
+ 604,
+ - 553,
+ - 429,
+ - 876,
+ 396,
+ 162,
+ - 66,
+ 1305,
+ 915,
+ 479,
+ 579,
+ 1088,
+ 794,
+ 450,
+ 278,
+ 566,
+ 324,
+ - 1057,
+ - 154,
+ 148,
+ - 177,
+ - 2545,
+ 168,
+ 1070,
+ 592,
+ - 2351,
+ - 42,
+ 819,
+ 345,
+ - 2344,
+ - 707,
+ 721,
+ 250,
+ - 2175,
+ - 1497,
+ - 309,
+ 122,
+ - 78,
+ - 73,
+ 120,
+ 173,
+ - 4,
+ 262,
+ - 263,
+ - 261,
+ - 431,
+ - 64,
+ - 405,
+ - 732,
+ - 2609,
+ 116,
+ - 83,
+ - 193,
+ - 1525,
+ - 944,
+ - 477,
+ - 725,
+ - 508,
+ 307,
+ 170,
+ 172,
+ 832,
+ 417,
+ 832,
+ 686,
+ - 225,
+ 177,
+ 894,
+ 818,
+ - 482,
+ - 389,
+ 1279,
+ 1039,
+ - 383,
+ 201,
+ - 350,
+ 40,
+ 730,
+ 635,
+ 226,
+ 526,
+ 503,
+ 462,
+ 338,
+ 398,
+ 535,
+ 714,
+ 40,
+ - 282,
+ 1482,
+ 1471,
+ 1085,
+ 731,
+ 1561,
+ 1072,
+ 909,
+ 693,
+ 1419,
+ 1282,
+ 889,
+ 879,
+ 1153,
+ 728,
+ 1186,
+ 840,
+ - 226,
+ 1130,
+ 949,
+ 689,
+ - 494,
+ - 986,
+ - 1556,
+ - 128,
+ - 568,
+ - 721,
+ - 713,
+ - 26,
+ 317,
+ 524,
+ 70,
+ 135,
+ - 405,
+ - 865,
+ - 1766,
+ - 652,
+ - 174,
+ - 801,
+ 885,
+ 773,
+ - 153,
+ - 91,
+ 1099,
+ 751,
+ - 506,
+ - 1149,
+ 853,
+ 646,
+ 241,
+ 782,
+ 519,
+ 539,
+ 1853,
+ 1700,
+ 1101,
+ 684,
+ - 1249,
+ - 1486,
+ - 464,
+ 188,
+ - 893,
+ - 1409,
+ - 1312,
+ - 341,
+ - 135,
+ 438,
+ - 175,
+ 18,
+ 1111,
+ 976,
+ 319,
+ 208,
+ - 1430,
+ - 1768,
+ 83,
+ 458,
+ - 530,
+ - 1000,
+ 307,
+ 129,
+ - 840,
+ - 15,
+ - 29,
+ - 356,
+ - 911,
+ - 924,
+ - 1147,
+ - 242,
+ - 119,
+ - 528,
+ 127,
+ - 133,
+ - 761,
+ - 765,
+ 190,
+ - 83,
+ - 315,
+ 895,
+ 522,
+ 231,
+ - 222,
+ 102,
+ - 63,
+ - 428,
+ 316,
+ 699,
+ 379,
+ 70,
+ 25,
+ 716,
+ 314,
+ - 108,
+ 507,
+ 874,
+ 566,
+ 238,
+ 108,
+ 941,
+ 519,
+ 195,
+ 425,
+ - 60,
+ - 427,
+ 257,
+ 139,
+ - 103,
+ - 630,
+ 446,
+ 334,
+ 370,
+ 412,
+ 48,
+ - 172,
+ - 690,
+ - 283,
+ 557,
+ 187,
+ - 286,
+ 158,
+ 483,
+ 140,
+ 270,
+ - 344,
+ - 631,
+ 924,
+ 579,
+ - 116,
+ 132,
+ 142,
+ 466,
+ - 68,
+ - 64,
+ 230,
+ - 145,
+ - 302,
+ - 542,
+ - 803,
+ - 912,
+ 1018,
+ 737,
+ - 773,
+ 1015,
+ 630,
+ 297,
+ - 2596,
+ 95,
+ 445,
+ 336,
+ - 2122,
+ 491,
+ 510,
+ 191,
+ - 1253,
+ 161,
+ - 2,
+ - 324,
+ - 1450,
+ - 633,
+ - 712,
+ - 105,
+ - 842,
+ - 254,
+ - 411,
+ 100,
+ - 640,
+ - 290,
+ 1010,
+ 763,
+ - 650,
+ 313,
+ 1169,
+ 730,
+ 140,
+ 505,
+ 1030,
+ 766,
+ 772,
+ 287,
+ 1067,
+ 823,
+ 495,
+ 749,
+ 305,
+ 323,
+ - 164,
+ 462,
+ 78,
+ 399,
+ - 342,
+ - 874,
+ 69,
+ 597,
+ - 16,
+ 620,
+ 621,
+ 337,
+ - 138,
+ - 444,
+ - 265,
+ 218,
+ 84,
+ - 450,
+ 953,
+ 666,
+ - 222,
+ - 803,
+ 541,
+ 604,
+ - 921,
+ - 1376,
+ 244,
+ 116,
+ - 841,
+ - 723,
+ 630,
+ 588,
+ 140,
+ 663,
+ 294,
+ 368,
+ 935,
+ 1046,
+ 881,
+ 759,
+ 1746,
+ 1464,
+ 916,
+ 628,
+ 436,
+ 963,
+ 281,
+ 1,
+ - 119,
+ 74,
+ 542,
+ 213,
+ 1,
+ - 567,
+ 301,
+ 241,
+ 260,
+ 435,
+ 222,
+ 396,
+ 936,
+ 957,
+ 1108,
+ 703,
+ 510,
+ 506,
+ 808,
+ 478,
+ 601,
+ 694,
+ 960,
+ 620,
+ 972,
+ 741,
+ 980,
+ 600,
+ 834,
+ 717,
+ 767,
+ 684,
+ 643,
+ 972,
+ 935,
+ 638,
+ 501,
+ 661,
+ 720,
+ 851,
+ - 105,
+ - 632,
+ - 303,
+ - 117,
+ - 429,
+ 130,
+ 789,
+ 442,
+ - 522,
+ - 188,
+ 704,
+ 373,
+ - 759,
+ 42,
+ 814,
+ 523,
+ - 531,
+ - 1137,
+ 373,
+ 578,
+ - 682,
+ - 1203,
+ - 455,
+ 285,
+ - 1163,
+ - 1577,
+ - 1098,
+ 44,
+ 81,
+ - 82,
+ 712,
+ 363,
+ 477,
+ 246,
+ 954,
+ 622,
+ 1604,
+ 1622,
+ 1277,
+ 891,
+ 1409,
+ 859,
+ 924,
+ 892,
+ 774,
+ 1041,
+ 947,
+ 1142,
+ 40,
+ - 546,
+ - 75,
+ 288,
+ - 616,
+ - 106,
+ - 697,
+ - 26,
+ - 169,
+ - 160,
+ - 891,
+ - 739,
+ - 279,
+ - 384,
+ - 1029,
+ - 350,
+ 1781,
+ 1308,
+ 1046,
+ 816,
+ 1580,
+ 1533,
+ 1472,
+ 1178,
+ 1505,
+ 1076,
+ 1216,
+ 899,
+ 890,
+ 904,
+ 564,
+ 654,
+ 920,
+ 692,
+ 1021,
+ 856,
+ - 493,
+ 132,
+ 177,
+ 505,
+ 71,
+ 195,
+ - 28,
+ 97,
+ 456,
+ 351,
+ - 164,
+ 88,
+ 439,
+ 278,
+ - 40,
+ 350,
+ 1395,
+ 949,
+ 234,
+ - 95,
+ - 805,
+ - 472,
+ 38,
+ - 163,
+ 367,
+ - 98,
+ 489,
+ 523,
+ 1025,
+ 1178,
+ 1212,
+ 906,
+ 319,
+ 1314,
+ 814,
+ 461,
+ - 123,
+ - 543,
+ - 804,
+ 447,
+ - 748,
+ - 324,
+ - 897,
+ - 1127,
+ - 737,
+ - 501,
+ - 789,
+ - 713,
+ 715,
+ 777,
+ 1239,
+ 922,
+ 1949,
+ 1939,
+ 1368,
+ 865,
+ 730,
+ 880,
+ 758,
+ 388,
+ - 871,
+ 454,
+ 17,
+ - 251,
+ - 381,
+ - 810,
+ - 1583,
+ 239,
+ - 521,
+ - 966,
+ - 792,
+ 259,
+ - 890,
+ - 1358,
+ - 770,
+ - 73,
+ 166,
+ 349,
+ - 212,
+ 323,
+ - 840,
+ - 301,
+ 473,
+ 435,
+ - 679,
+ - 464,
+ 728,
+ 351,
+ - 156,
+ - 199,
+ 667,
+ 432,
+ 29,
+ - 252,
+ 415,
+ 480,
+ - 731,
+ - 379,
+ 145,
+ 559,
+ - 528,
+ - 631,
+ - 1158,
+ - 159,
+ 445,
+ 273,
+ 123,
+ 639,
+ 373,
+ - 126,
+ 800,
+ 568,
+ 84,
+ - 162,
+ 720,
+ 712,
+ - 830,
+ - 536,
+ - 185,
+ 222,
+ 408,
+ 452,
+ 501,
+ 771,
+ - 897,
+ - 1355,
+ - 67,
+ 442,
+ - 792,
+ - 1406,
+ 566,
+ 602,
+ 167,
+ - 326,
+ 509,
+ 330,
+ - 95,
+ - 626,
+ - 730,
+ - 344,
+ 1668,
+ 1217,
+ 779,
+ 455,
+ 1316,
+ 828,
+ 584,
+ 719,
+ 404,
+ - 31,
+ 1013,
+ 789,
+ 89,
+ 107,
+ 891,
+ 549,
+ 871,
+ 1581,
+ 917,
+ 671,
+ 866,
+ 1479,
+ 1289,
+ 854,
+ 391,
+ 1068,
+ 1122,
+ 812,
+ 78,
+ - 562,
+ 345,
+ 563,
+ 429,
+ - 103,
+ 417,
+ 787,
+ - 122,
+ - 437,
+ 411,
+ 788,
+ - 913,
+ - 417,
+ 602,
+ 754,
+ - 226,
+ - 16,
+ 151,
+ 760,
+ - 700,
+ 118,
+ - 104,
+ - 14,
+ - 1128,
+ 48,
+ 284,
+ 393,
+ - 390,
+ - 419,
+ - 639,
+ - 116,
+ - 910,
+ 306,
+ 316,
+ - 13,
+ 1207,
+ 984,
+ 821,
+ 669,
+ - 1195,
+ - 693,
+ 140,
+ - 213,
+ - 884,
+ - 416,
+ - 199,
+ - 558,
+ - 616,
+ 245,
+ - 404,
+ - 664,
+ 262,
+ 56,
+ - 617,
+ - 724,
+ - 85,
+ - 491,
+ - 320,
+ - 656,
+ - 570,
+ - 831,
+ - 129,
+ - 528,
+ - 1506,
+ - 63,
+ - 367,
+ - 385,
+ - 358,
+ - 321,
+ 4,
+ 51,
+ - 366,
+ - 214,
+ 319,
+ 511,
+ 146,
+ 671,
+ - 17,
+ - 291,
+ - 110,
+ 464,
+ - 139,
+ - 496,
+ - 202,
+ 220,
+ - 312,
+ - 631,
+ - 660,
+ - 73,
+ - 655,
+ - 820,
+ - 662,
+ - 653,
+ - 1288,
+ - 857,
+ - 430,
+ - 953,
+ - 959,
+ - 264,
+ - 49,
+ - 468,
+ - 72,
+ - 381,
+ - 350,
+ - 563,
+ - 193,
+ - 407,
+ 55,
+ - 408,
+ - 803,
+ 11,
+ - 309,
+ 649,
+ 188,
+ - 198,
+ - 512,
+ 461,
+ - 79,
+ - 458,
+ - 1318,
+ - 263,
+ - 134,
+ - 523,
+ - 1657,
+ - 435,
+ - 495,
+ - 765,
+ 57,
+ - 347,
+ - 414,
+ 434,
+ - 1141,
+ - 242,
+ - 664,
+ - 857,
+ 34,
+ - 68,
+ - 707,
+ - 338
};
#define MR515_3_SIZE 128
/* 3rd LSF quantizer (MR515 and MR475) */
static const Word32 mr515_3_lsf[] =
{
- 419,
- 163,
- - 30,
- - 262,
- - 455,
- - 789,
- - 1430,
- - 721,
- 1006,
- 664,
- 269,
- 25,
- 619,
- 260,
- 183,
- 96,
- - 968,
- - 1358,
- - 388,
- 135,
- - 693,
- 835,
- 456,
- 154,
- 1105,
- 703,
- 569,
- 363,
- 1625,
- 1326,
- 985,
- 748,
- - 220,
- 219,
- 76,
- - 208,
- - 1455,
- - 1662,
- 49,
- 149,
- - 964,
- - 172,
- - 752,
- - 336,
- 625,
- 209,
- - 250,
- - 66,
- - 1017,
- - 838,
- - 2,
- 317,
- - 2168,
- - 1485,
- - 138,
- 123,
- - 1876,
- - 2099,
- - 521,
- 85,
- - 967,
- - 366,
- - 695,
- - 881,
- - 921,
- - 1011,
- - 763,
- - 949,
- - 124,
- - 256,
- - 352,
- - 660,
- 178,
- 463,
- 354,
- 304,
- - 1744,
- - 591,
- - 282,
- 79,
- - 2249,
- 175,
- 867,
- 499,
- - 138,
- - 180,
- - 181,
- - 21,
- - 2291,
- - 1241,
- - 460,
- - 520,
- - 771,
- 451,
- - 10,
- - 308,
- 271,
- - 65,
- 4,
- 214,
- - 279,
- - 435,
- - 43,
- - 348,
- - 670,
- 35,
- - 65,
- - 211,
- 806,
- 535,
- 85,
- 297,
- 57,
- 239,
- 722,
- 493,
- 225,
- 661,
- 840,
- 547,
- - 540,
- - 376,
- 14,
- 349,
- 469,
- 721,
- 331,
- 162,
- - 544,
- - 752,
- - 62,
- - 10,
- 398,
- - 88,
- 724,
- 701,
- - 19,
- - 533,
- - 94,
- 601,
- 136,
- - 71,
- - 681,
- - 747,
- - 166,
- - 344,
- 261,
- - 50,
- 161,
- - 52,
- 485,
- 337,
- - 1675,
- 50,
- 190,
- - 93,
- - 2282,
- - 231,
- - 194,
- - 82,
- - 95,
- - 595,
- - 154,
- 128,
- 894,
- 501,
- 588,
- 457,
- - 345,
- 206,
- 122,
- 110,
- - 631,
- - 227,
- - 569,
- 3,
- 408,
- 239,
- 397,
- 226,
- - 197,
- - 2,
- 128,
- 491,
- 1281,
- 904,
- 292,
- 215,
- 538,
- 306,
- 259,
- 509,
- - 677,
- - 1047,
- 13,
- 321,
- - 679,
- - 588,
- - 358,
- - 212,
- - 558,
- 243,
- 646,
- 479,
- 486,
- 342,
- 634,
- 532,
- 107,
- 802,
- 331,
- 136,
- - 112,
- - 398,
- - 1031,
- - 286,
- - 326,
- - 705,
- 288,
- 272,
- 1299,
- 1144,
- 1178,
- 860,
- - 423,
- 121,
- - 385,
- - 148,
- - 295,
- - 302,
- - 834,
- - 819,
- 16,
- - 24,
- - 201,
- - 476,
- 555,
- 91,
- - 245,
- 294,
- - 38,
- - 379,
- - 962,
- - 1221,
- - 1191,
- - 1518,
- - 273,
- - 395,
- - 390,
- - 1013,
- - 645,
- 573,
- - 1843,
- - 1030,
- 505,
- 468,
- 744,
- 947,
- 609,
- 493,
- - 689,
- - 1172,
- - 628,
- - 135,
- - 1026,
- 195,
- 411,
- 196,
- 1582,
- 1147,
- 575,
- 337,
- - 1239,
- - 777,
- - 648,
- - 142,
- 595,
- 825,
- 967,
- 735,
- - 1206,
- - 970,
- - 81,
- - 342,
- - 745,
- 13,
- - 72,
- 375,
- 454,
- 19,
- 1407,
- 921,
- - 1647,
- - 172,
- 861,
- 562,
- 928,
- 1537,
- 1063,
- 740,
- - 2472,
- - 952,
- 264,
- 82,
- - 502,
- - 965,
- - 1334,
- 123,
- 867,
- 1236,
- 534,
- 171,
- - 2320,
- - 460,
- 780,
- 363,
- - 1190,
- - 617,
- 252,
- - 61,
- - 174,
- 34,
- 1011,
- 788,
- - 2333,
- 247,
- 423,
- 153,
- - 16,
- - 355,
- 262,
- 449,
- - 1576,
- - 1073,
- - 544,
- - 371,
- - 615,
- - 305,
- 1051,
- 805,
- 687,
- 528,
- 6,
- - 182,
- 935,
- 875,
- 1002,
- 809,
- 199,
- 257,
- 126,
- 76,
- - 584,
- - 1138,
- 599,
- 556,
- - 1105,
- - 1391,
- - 1591,
- - 519,
- - 977,
- - 1325,
- 108,
- 347,
- - 722,
- - 975,
- 365,
- 101,
- - 145,
- 681,
- 249,
- - 153,
- 0,
- - 334,
- - 570,
- 159,
- 412,
- 285,
- - 336,
- - 617,
- - 953,
- - 966,
- 887,
- 689,
- - 1251,
- 84,
- - 185,
- - 398,
- - 592,
- 433,
- 1044,
- 653,
- 85,
- 329,
- - 40,
- 361,
- - 433,
- - 705,
- 466,
- 574,
- - 154,
- 654,
- 592,
- 290,
- - 167,
- 72,
- 349,
- 175,
- 674,
- 297,
- 977,
- 720,
- 1235,
- 1204,
- 757,
- 488,
- - 400,
- - 269,
- 538,
- 372,
- - 1350,
- - 1387,
- - 1194,
- - 91,
- 1262,
- 876,
- 775,
- 700,
- - 599,
- - 38,
- - 430,
- - 722,
- 1976,
- 1630,
- 991,
- 608,
- 111,
- 276,
- - 226,
- - 96,
- - 947,
- - 388,
- - 11,
- - 7,
- - 303,
- - 531,
- - 839,
- 338,
- 1734,
- 1710,
- 1405,
- 1013,
- - 516,
- - 855,
- - 645,
- 210,
- - 688,
- - 416,
- 513,
- 230,
- - 822,
- - 637,
- - 1146,
- - 320,
- - 952,
- - 658,
- - 694,
- 183,
- - 114,
- - 623,
- 818,
- 674,
- - 191,
- - 204,
- 731,
- 635,
- 51,
- 1221,
- 883,
- 576,
- - 954,
- - 431,
- 826,
- 598,
- - 342,
- - 755,
- - 900,
- - 407,
- - 1126,
- - 354,
- - 206,
- - 512,
- - 547,
- - 810,
- - 357,
- - 620,
- 66,
- 515,
- - 73,
- - 410,
- - 872,
- - 945,
- - 1444,
- - 1227,
- 191,
- - 17,
- - 544,
- - 231,
- - 1540,
- - 544,
- - 901,
- - 886
+ 419,
+ 163,
+ - 30,
+ - 262,
+ - 455,
+ - 789,
+ - 1430,
+ - 721,
+ 1006,
+ 664,
+ 269,
+ 25,
+ 619,
+ 260,
+ 183,
+ 96,
+ - 968,
+ - 1358,
+ - 388,
+ 135,
+ - 693,
+ 835,
+ 456,
+ 154,
+ 1105,
+ 703,
+ 569,
+ 363,
+ 1625,
+ 1326,
+ 985,
+ 748,
+ - 220,
+ 219,
+ 76,
+ - 208,
+ - 1455,
+ - 1662,
+ 49,
+ 149,
+ - 964,
+ - 172,
+ - 752,
+ - 336,
+ 625,
+ 209,
+ - 250,
+ - 66,
+ - 1017,
+ - 838,
+ - 2,
+ 317,
+ - 2168,
+ - 1485,
+ - 138,
+ 123,
+ - 1876,
+ - 2099,
+ - 521,
+ 85,
+ - 967,
+ - 366,
+ - 695,
+ - 881,
+ - 921,
+ - 1011,
+ - 763,
+ - 949,
+ - 124,
+ - 256,
+ - 352,
+ - 660,
+ 178,
+ 463,
+ 354,
+ 304,
+ - 1744,
+ - 591,
+ - 282,
+ 79,
+ - 2249,
+ 175,
+ 867,
+ 499,
+ - 138,
+ - 180,
+ - 181,
+ - 21,
+ - 2291,
+ - 1241,
+ - 460,
+ - 520,
+ - 771,
+ 451,
+ - 10,
+ - 308,
+ 271,
+ - 65,
+ 4,
+ 214,
+ - 279,
+ - 435,
+ - 43,
+ - 348,
+ - 670,
+ 35,
+ - 65,
+ - 211,
+ 806,
+ 535,
+ 85,
+ 297,
+ 57,
+ 239,
+ 722,
+ 493,
+ 225,
+ 661,
+ 840,
+ 547,
+ - 540,
+ - 376,
+ 14,
+ 349,
+ 469,
+ 721,
+ 331,
+ 162,
+ - 544,
+ - 752,
+ - 62,
+ - 10,
+ 398,
+ - 88,
+ 724,
+ 701,
+ - 19,
+ - 533,
+ - 94,
+ 601,
+ 136,
+ - 71,
+ - 681,
+ - 747,
+ - 166,
+ - 344,
+ 261,
+ - 50,
+ 161,
+ - 52,
+ 485,
+ 337,
+ - 1675,
+ 50,
+ 190,
+ - 93,
+ - 2282,
+ - 231,
+ - 194,
+ - 82,
+ - 95,
+ - 595,
+ - 154,
+ 128,
+ 894,
+ 501,
+ 588,
+ 457,
+ - 345,
+ 206,
+ 122,
+ 110,
+ - 631,
+ - 227,
+ - 569,
+ 3,
+ 408,
+ 239,
+ 397,
+ 226,
+ - 197,
+ - 2,
+ 128,
+ 491,
+ 1281,
+ 904,
+ 292,
+ 215,
+ 538,
+ 306,
+ 259,
+ 509,
+ - 677,
+ - 1047,
+ 13,
+ 321,
+ - 679,
+ - 588,
+ - 358,
+ - 212,
+ - 558,
+ 243,
+ 646,
+ 479,
+ 486,
+ 342,
+ 634,
+ 532,
+ 107,
+ 802,
+ 331,
+ 136,
+ - 112,
+ - 398,
+ - 1031,
+ - 286,
+ - 326,
+ - 705,
+ 288,
+ 272,
+ 1299,
+ 1144,
+ 1178,
+ 860,
+ - 423,
+ 121,
+ - 385,
+ - 148,
+ - 295,
+ - 302,
+ - 834,
+ - 819,
+ 16,
+ - 24,
+ - 201,
+ - 476,
+ 555,
+ 91,
+ - 245,
+ 294,
+ - 38,
+ - 379,
+ - 962,
+ - 1221,
+ - 1191,
+ - 1518,
+ - 273,
+ - 395,
+ - 390,
+ - 1013,
+ - 645,
+ 573,
+ - 1843,
+ - 1030,
+ 505,
+ 468,
+ 744,
+ 947,
+ 609,
+ 493,
+ - 689,
+ - 1172,
+ - 628,
+ - 135,
+ - 1026,
+ 195,
+ 411,
+ 196,
+ 1582,
+ 1147,
+ 575,
+ 337,
+ - 1239,
+ - 777,
+ - 648,
+ - 142,
+ 595,
+ 825,
+ 967,
+ 735,
+ - 1206,
+ - 970,
+ - 81,
+ - 342,
+ - 745,
+ 13,
+ - 72,
+ 375,
+ 454,
+ 19,
+ 1407,
+ 921,
+ - 1647,
+ - 172,
+ 861,
+ 562,
+ 928,
+ 1537,
+ 1063,
+ 740,
+ - 2472,
+ - 952,
+ 264,
+ 82,
+ - 502,
+ - 965,
+ - 1334,
+ 123,
+ 867,
+ 1236,
+ 534,
+ 171,
+ - 2320,
+ - 460,
+ 780,
+ 363,
+ - 1190,
+ - 617,
+ 252,
+ - 61,
+ - 174,
+ 34,
+ 1011,
+ 788,
+ - 2333,
+ 247,
+ 423,
+ 153,
+ - 16,
+ - 355,
+ 262,
+ 449,
+ - 1576,
+ - 1073,
+ - 544,
+ - 371,
+ - 615,
+ - 305,
+ 1051,
+ 805,
+ 687,
+ 528,
+ 6,
+ - 182,
+ 935,
+ 875,
+ 1002,
+ 809,
+ 199,
+ 257,
+ 126,
+ 76,
+ - 584,
+ - 1138,
+ 599,
+ 556,
+ - 1105,
+ - 1391,
+ - 1591,
+ - 519,
+ - 977,
+ - 1325,
+ 108,
+ 347,
+ - 722,
+ - 975,
+ 365,
+ 101,
+ - 145,
+ 681,
+ 249,
+ - 153,
+ 0,
+ - 334,
+ - 570,
+ 159,
+ 412,
+ 285,
+ - 336,
+ - 617,
+ - 953,
+ - 966,
+ 887,
+ 689,
+ - 1251,
+ 84,
+ - 185,
+ - 398,
+ - 592,
+ 433,
+ 1044,
+ 653,
+ 85,
+ 329,
+ - 40,
+ 361,
+ - 433,
+ - 705,
+ 466,
+ 574,
+ - 154,
+ 654,
+ 592,
+ 290,
+ - 167,
+ 72,
+ 349,
+ 175,
+ 674,
+ 297,
+ 977,
+ 720,
+ 1235,
+ 1204,
+ 757,
+ 488,
+ - 400,
+ - 269,
+ 538,
+ 372,
+ - 1350,
+ - 1387,
+ - 1194,
+ - 91,
+ 1262,
+ 876,
+ 775,
+ 700,
+ - 599,
+ - 38,
+ - 430,
+ - 722,
+ 1976,
+ 1630,
+ 991,
+ 608,
+ 111,
+ 276,
+ - 226,
+ - 96,
+ - 947,
+ - 388,
+ - 11,
+ - 7,
+ - 303,
+ - 531,
+ - 839,
+ 338,
+ 1734,
+ 1710,
+ 1405,
+ 1013,
+ - 516,
+ - 855,
+ - 645,
+ 210,
+ - 688,
+ - 416,
+ 513,
+ 230,
+ - 822,
+ - 637,
+ - 1146,
+ - 320,
+ - 952,
+ - 658,
+ - 694,
+ 183,
+ - 114,
+ - 623,
+ 818,
+ 674,
+ - 191,
+ - 204,
+ 731,
+ 635,
+ 51,
+ 1221,
+ 883,
+ 576,
+ - 954,
+ - 431,
+ 826,
+ 598,
+ - 342,
+ - 755,
+ - 900,
+ - 407,
+ - 1126,
+ - 354,
+ - 206,
+ - 512,
+ - 547,
+ - 810,
+ - 357,
+ - 620,
+ 66,
+ 515,
+ - 73,
+ - 410,
+ - 872,
+ - 945,
+ - 1444,
+ - 1227,
+ 191,
+ - 17,
+ - 544,
+ - 231,
+ - 1540,
+ - 544,
+ - 901,
+ - 886
};
#define MR795_1_SIZE 512
/* 1st LSF quantizer (MR795) */
static const Word32 mr795_1_lsf[] =
{
- - 890,
- - 1550,
- - 2541,
- - 819,
- - 970,
- 175,
- - 826,
- - 1234,
- - 762,
- - 599,
- - 22,
- 634,
- - 811,
- - 987,
- - 902,
- - 323,
- 203,
- 26,
- - 383,
- - 235,
- - 781,
- - 399,
- 1262,
- 906,
- - 932,
- - 1399,
- - 1380,
- - 624,
- 93,
- 87,
- - 414,
- - 539,
- - 691,
- 37,
- 633,
- 510,
- - 387,
- - 476,
- - 1330,
- 399,
- 66,
- 263,
- - 407,
- - 49,
- - 335,
- - 417,
- 1041,
- 1865,
- - 779,
- - 1089,
- - 1440,
- - 746,
- - 858,
- 832,
- - 581,
- - 759,
- - 371,
- - 673,
- - 506,
- 2088,
- - 560,
- - 634,
- - 1179,
- 271,
- 241,
- 14,
- - 438,
- - 244,
- - 397,
- 463,
- 1202,
- 1047,
- - 606,
- - 797,
- - 1438,
- - 51,
- - 323,
- 481,
- - 224,
- - 584,
- - 527,
- 494,
- 881,
- 682,
- - 433,
- - 306,
- - 1002,
- 554,
- 659,
- 222,
- 171,
- - 160,
- - 353,
- 681,
- 1798,
- 1565,
- - 852,
- - 1181,
- - 1695,
- - 336,
- - 666,
- 114,
- - 581,
- - 756,
- - 744,
- - 195,
- 375,
- 497,
- - 465,
- - 804,
- - 1098,
- 154,
- 282,
- - 131,
- - 50,
- - 191,
- - 719,
- 323,
- 732,
- 1542,
- - 722,
- - 819,
- - 1404,
- 105,
- - 250,
- 185,
- - 178,
- - 502,
- - 742,
- 321,
- 510,
- 1111,
- - 323,
- - 567,
- - 966,
- 127,
- 484,
- 338,
- - 160,
- 52,
- - 338,
- 732,
- 1367,
- 1554,
- - 626,
- - 802,
- - 1696,
- - 286,
- - 586,
- 676,
- - 695,
- - 343,
- - 370,
- - 490,
- 295,
- 1893,
- - 630,
- - 574,
- - 1014,
- - 80,
- 645,
- - 69,
- - 6,
- - 318,
- - 364,
- 782,
- 1450,
- 1038,
- - 313,
- - 733,
- - 1395,
- 120,
- 60,
- 477,
- - 264,
- - 585,
- - 123,
- 711,
- 1245,
- 633,
- - 91,
- - 355,
- - 1016,
- 771,
- 758,
- 261,
- 253,
- 81,
- - 474,
- 930,
- 2215,
- 1720,
- - 808,
- - 1099,
- - 1925,
- - 560,
- - 782,
- 169,
- - 804,
- - 1074,
- - 188,
- - 626,
- - 55,
- 1405,
- - 694,
- - 716,
- - 1194,
- - 660,
- 354,
- 329,
- - 514,
- - 55,
- - 543,
- 366,
- 1033,
- 1182,
- - 658,
- - 959,
- - 1357,
- - 55,
- - 184,
- 93,
- - 605,
- - 286,
- - 662,
- 404,
- 449,
- 827,
- - 286,
- - 350,
- - 1263,
- 628,
- 306,
- 227,
- - 16,
- 147,
- - 623,
- 186,
- 923,
- 2146,
- - 674,
- - 890,
- - 1606,
- - 443,
- - 228,
- 339,
- - 369,
- - 790,
- - 409,
- 231,
- 86,
- 1469,
- - 448,
- - 581,
- - 1061,
- 594,
- 450,
- - 177,
- - 124,
- - 170,
- - 447,
- 671,
- 1159,
- 1404,
- - 476,
- - 667,
- - 1511,
- - 77,
- - 138,
- 716,
- - 177,
- - 372,
- - 381,
- 451,
- 934,
- 915,
- - 250,
- - 432,
- - 822,
- 272,
- 828,
- 446,
- 26,
- 19,
- - 31,
- 698,
- 1692,
- 2168,
- - 646,
- - 977,
- - 1924,
- - 179,
- - 473,
- 268,
- - 379,
- - 745,
- - 691,
- 11,
- 127,
- 1033,
- - 488,
- - 917,
- - 825,
- 61,
- 323,
- 135,
- 147,
- - 145,
- - 686,
- 685,
- 786,
- 1682,
- - 506,
- - 848,
- - 1297,
- 35,
- 90,
- 222,
- - 23,
- - 346,
- - 670,
- 455,
- 591,
- 1287,
- - 203,
- - 593,
- - 1086,
- 652,
- 352,
- 437,
- 39,
- 63,
- - 457,
- 841,
- 1265,
- 2105,
- - 520,
- - 882,
- - 1584,
- - 328,
- - 711,
- 1421,
- - 596,
- - 342,
- - 70,
- 209,
- 173,
- 1928,
- - 423,
- - 598,
- - 921,
- 421,
- 605,
- - 38,
- - 2,
- - 245,
- - 127,
- 896,
- 1969,
- 1135,
- - 379,
- - 518,
- - 1579,
- 173,
- 118,
- 753,
- - 55,
- - 381,
- - 52,
- 985,
- 1021,
- 753,
- - 2,
- - 291,
- - 891,
- 753,
- 992,
- 423,
- 264,
- 131,
- - 196,
- 895,
- 2274,
- 2543,
- - 635,
- - 1088,
- - 2499,
- - 529,
- - 982,
- 526,
- - 764,
- - 830,
- - 548,
- - 436,
- 316,
- 599,
- - 675,
- - 940,
- - 746,
- - 57,
- 236,
- - 11,
- - 201,
- - 81,
- - 798,
- 16,
- 845,
- 1558,
- - 737,
- - 985,
- - 1212,
- - 468,
- 17,
- 290,
- - 279,
- - 584,
- - 700,
- 183,
- 822,
- 705,
- - 265,
- - 492,
- - 1187,
- 421,
- 152,
- 468,
- - 390,
- 166,
- - 268,
- 39,
- 1550,
- 1868,
- - 635,
- - 966,
- - 1571,
- - 453,
- - 492,
- 910,
- - 284,
- - 1027,
- - 75,
- - 181,
- - 133,
- 1852,
- - 445,
- - 624,
- - 1174,
- 420,
- 367,
- - 49,
- - 389,
- - 212,
- - 169,
- 707,
- 1073,
- 1208,
- - 539,
- - 710,
- - 1449,
- 83,
- - 163,
- 484,
- - 236,
- - 543,
- - 355,
- 338,
- 1175,
- 814,
- - 246,
- - 309,
- - 958,
- 606,
- 760,
- 60,
- 166,
- - 8,
- - 163,
- - 306,
- 1849,
- 2563,
- - 747,
- - 1025,
- - 1783,
- - 419,
- - 446,
- 209,
- - 718,
- - 566,
- - 534,
- - 506,
- 693,
- 857,
- - 463,
- - 697,
- - 1082,
- 325,
- 431,
- - 206,
- - 15,
- - 8,
- - 763,
- 545,
- 919,
- 1518,
- - 611,
- - 783,
- - 1313,
- 256,
- - 55,
- 208,
- - 165,
- - 348,
- - 662,
- 321,
- 680,
- 930,
- - 326,
- - 429,
- - 951,
- 484,
- 446,
- 570,
- - 197,
- 72,
- - 73,
- 909,
- 1455,
- 1741,
- - 563,
- - 737,
- - 1974,
- - 124,
- - 416,
- 718,
- - 478,
- - 404,
- - 314,
- - 16,
- 446,
- 1636,
- - 551,
- - 537,
- - 750,
- - 58,
- 638,
- 214,
- 55,
- - 185,
- - 271,
- 1148,
- 1301,
- 1212,
- - 483,
- - 671,
- - 1264,
- 117,
- 285,
- 543,
- - 204,
- - 391,
- - 111,
- 513,
- 1538,
- 854,
- - 114,
- - 190,
- - 978,
- 877,
- 595,
- 464,
- 260,
- 260,
- - 311,
- 748,
- 2283,
- 2216,
- - 517,
- - 945,
- - 2171,
- - 326,
- - 708,
- 378,
- - 812,
- - 691,
- - 232,
- - 560,
- 687,
- 1409,
- - 732,
- - 690,
- - 836,
- - 359,
- 645,
- 386,
- - 265,
- 62,
- - 678,
- 145,
- 1644,
- 1208,
- - 555,
- - 988,
- - 1233,
- - 78,
- 14,
- 114,
- - 327,
- - 358,
- - 489,
- 392,
- 677,
- 697,
- - 201,
- - 236,
- - 1140,
- 693,
- 449,
- 178,
- - 243,
- 256,
- - 433,
- 611,
- 1385,
- 2456,
- - 612,
- - 901,
- - 1464,
- - 307,
- - 17,
- 499,
- - 315,
- - 667,
- - 254,
- 256,
- 428,
- 1463,
- - 486,
- - 422,
- - 1056,
- 655,
- 370,
- 18,
- - 102,
- - 185,
- - 276,
- 755,
- 1578,
- 1335,
- - 488,
- - 603,
- - 1418,
- 182,
- - 93,
- 870,
- - 73,
- - 458,
- - 348,
- 835,
- 862,
- 957,
- - 282,
- - 333,
- - 746,
- 547,
- 839,
- 428,
- 273,
- - 89,
- 13,
- 940,
- 1708,
- 2576,
- - 418,
- - 1084,
- - 1758,
- - 44,
- - 358,
- 259,
- - 497,
- - 643,
- - 560,
- 99,
- 557,
- 961,
- - 421,
- - 766,
- - 917,
- 295,
- 326,
- 184,
- 175,
- 15,
- - 626,
- 532,
- 878,
- 1981,
- - 443,
- - 768,
- - 1275,
- 221,
- 156,
- 268,
- 39,
- - 363,
- - 505,
- 695,
- 772,
- 1140,
- - 162,
- - 459,
- - 912,
- 709,
- 444,
- 658,
- 25,
- 303,
- - 312,
- 1268,
- 1410,
- 1715,
- - 297,
- - 766,
- - 1836,
- - 263,
- - 108,
- 1070,
- - 406,
- - 13,
- - 129,
- 57,
- 438,
- 2734,
- - 374,
- - 487,
- - 835,
- 304,
- 696,
- 164,
- 104,
- - 235,
- 5,
- 1611,
- 1900,
- 1399,
- - 229,
- - 582,
- - 1325,
- 405,
- 192,
- 817,
- - 87,
- - 438,
- 111,
- 1028,
- 1199,
- 993,
- 68,
- - 175,
- - 934,
- 1033,
- 1117,
- 451,
- 478,
- 200,
- - 248,
- 2127,
- 2696,
- 2042,
- - 835,
- - 1323,
- - 2131,
- - 799,
- - 692,
- 466,
- - 812,
- - 1032,
- - 469,
- - 622,
- 288,
- 920,
- - 701,
- - 841,
- - 1070,
- - 411,
- 512,
- 8,
- - 390,
- - 91,
- - 744,
- - 30,
- 1043,
- 1161,
- - 822,
- - 1148,
- - 1156,
- - 294,
- - 46,
- 110,
- - 411,
- - 374,
- - 678,
- 214,
- 531,
- 668,
- - 406,
- - 420,
- - 1194,
- 487,
- 232,
- 303,
- - 318,
- 91,
- - 472,
- 123,
- 1232,
- 2445,
- - 722,
- - 952,
- - 1495,
- - 738,
- - 675,
- 1332,
- - 543,
- - 606,
- - 211,
- - 95,
- - 98,
- 1508,
- - 549,
- - 514,
- - 1193,
- 473,
- 211,
- 73,
- - 288,
- - 112,
- - 389,
- 537,
- 1332,
- 1258,
- - 567,
- - 755,
- - 1545,
- 71,
- - 283,
- 632,
- - 170,
- - 481,
- - 493,
- 681,
- 1002,
- 817,
- - 356,
- - 331,
- - 877,
- 419,
- 706,
- 346,
- 241,
- - 34,
- - 326,
- 377,
- 1950,
- 1883,
- - 727,
- - 1075,
- - 1625,
- - 233,
- - 543,
- 116,
- - 524,
- - 806,
- - 585,
- - 73,
- 478,
- 729,
- - 288,
- - 925,
- - 1143,
- 173,
- 447,
- - 52,
- 68,
- - 229,
- - 606,
- 449,
- 529,
- 1797,
- - 591,
- - 875,
- - 1363,
- 183,
- - 144,
- 324,
- - 103,
- - 452,
- - 666,
- 623,
- 488,
- 1176,
- - 238,
- - 511,
- - 1004,
- 326,
- 552,
- 458,
- 136,
- 108,
- - 319,
- 626,
- 1343,
- 1883,
- - 490,
- - 646,
- - 1730,
- - 186,
- - 449,
- 984,
- - 738,
- - 76,
- - 170,
- - 550,
- 755,
- 2560,
- - 496,
- - 510,
- - 947,
- 210,
- 694,
- - 52,
- 84,
- - 322,
- - 199,
- 1090,
- 1625,
- 1224,
- - 376,
- - 603,
- - 1396,
- 343,
- 74,
- 632,
- - 175,
- - 502,
- - 32,
- 972,
- 1332,
- 734,
- 52,
- - 295,
- - 1113,
- 1065,
- 918,
- 160,
- 393,
- 107,
- - 397,
- 1214,
- 2649,
- 1741,
- - 632,
- - 1201,
- - 1891,
- - 719,
- - 277,
- 353,
- - 651,
- - 880,
- - 122,
- - 211,
- 209,
- 1338,
- - 562,
- - 714,
- - 1059,
- - 208,
- 388,
- 159,
- - 320,
- - 61,
- - 551,
- 293,
- 1092,
- 1443,
- - 648,
- - 865,
- - 1253,
- - 49,
- - 143,
- 305,
- - 401,
- - 227,
- - 585,
- 561,
- 532,
- 927,
- - 117,
- - 443,
- - 1188,
- 507,
- 436,
- 292,
- - 79,
- 233,
- - 458,
- 671,
- 1025,
- 2396,
- - 633,
- - 842,
- - 1525,
- - 308,
- - 286,
- 640,
- - 373,
- - 621,
- - 407,
- 418,
- 253,
- 1305,
- - 315,
- - 581,
- - 1137,
- 572,
- 685,
- - 281,
- 61,
- - 68,
- - 371,
- 991,
- 1101,
- 1498,
- - 493,
- - 683,
- - 1362,
- - 47,
- 164,
- 704,
- - 256,
- - 314,
- - 268,
- 631,
- 949,
- 1052,
- - 118,
- - 348,
- - 833,
- 68,
- 1180,
- 568,
- 152,
- 117,
- 34,
- 1113,
- 1902,
- 2239,
- - 601,
- - 959,
- - 1706,
- - 143,
- - 489,
- 480,
- - 332,
- - 655,
- - 574,
- 54,
- 353,
- 1192,
- - 462,
- - 652,
- - 796,
- 150,
- 549,
- 112,
- 195,
- - 111,
- - 515,
- 679,
- 1108,
- 1647,
- - 558,
- - 749,
- - 1217,
- - 9,
- 272,
- 341,
- - 53,
- - 265,
- - 535,
- 489,
- 843,
- 1298,
- - 120,
- - 482,
- - 1032,
- 632,
- 543,
- 408,
- 179,
- 306,
- - 526,
- 1124,
- 1464,
- 2244,
- - 417,
- - 786,
- - 1562,
- - 224,
- - 384,
- 1364,
- - 377,
- - 459,
- - 25,
- 385,
- 489,
- 2174,
- - 332,
- - 651,
- - 829,
- 544,
- 553,
- 61,
- 22,
- - 113,
- - 89,
- 1128,
- 1725,
- 1524,
- - 216,
- - 373,
- - 1653,
- 161,
- 316,
- 908,
- - 165,
- - 222,
- - 67,
- 1362,
- 1175,
- 789,
- 73,
- - 252,
- - 767,
- 738,
- 932,
- 616,
- 362,
- 246,
- - 126,
- 787,
- 2654,
- 3027,
- - 691,
- - 1106,
- - 2190,
- - 565,
- - 588,
- 524,
- - 590,
- - 979,
- - 490,
- - 263,
- 397,
- 982,
- - 577,
- - 837,
- - 945,
- - 22,
- 435,
- - 49,
- - 190,
- - 118,
- - 629,
- - 88,
- 1240,
- 1513,
- - 636,
- - 1051,
- - 1019,
- - 291,
- 189,
- 259,
- - 257,
- - 470,
- - 629,
- 145,
- 945,
- 894,
- - 326,
- - 364,
- - 1094,
- 543,
- 260,
- 630,
- - 202,
- 189,
- - 209,
- 357,
- 1379,
- 2091,
- - 569,
- - 1075,
- - 1449,
- - 714,
- - 239,
- 919,
- - 420,
- - 705,
- - 84,
- - 109,
- - 114,
- 2407,
- - 413,
- - 529,
- - 1177,
- 482,
- 368,
- 131,
- - 186,
- - 72,
- - 131,
- 861,
- 1255,
- 1220,
- - 611,
- - 658,
- - 1341,
- 227,
- - 121,
- 631,
- - 176,
- - 489,
- - 218,
- 745,
- 1175,
- 957,
- - 321,
- - 148,
- - 936,
- 671,
- 966,
- 216,
- 340,
- - 3,
- - 143,
- 469,
- 1848,
- 2437,
- - 729,
- - 961,
- - 1683,
- - 213,
- - 254,
- 321,
- - 511,
- - 438,
- - 521,
- - 126,
- 725,
- 903,
- - 340,
- - 685,
- - 1032,
- 316,
- 480,
- 20,
- 23,
- - 89,
- - 551,
- 353,
- 1051,
- 1789,
- - 544,
- - 757,
- - 1364,
- 298,
- - 25,
- 436,
- - 100,
- - 392,
- - 519,
- 467,
- 754,
- 1078,
- - 210,
- - 398,
- - 1078,
- 620,
- 658,
- 630,
- 33,
- 147,
- - 178,
- 921,
- 1687,
- 1921,
- - 325,
- - 528,
- - 1978,
- 2,
- - 285,
- 910,
- - 371,
- - 490,
- - 230,
- 0,
- 597,
- 2010,
- - 496,
- - 395,
- - 834,
- 37,
- 945,
- 245,
- 181,
- - 160,
- - 144,
- 1481,
- 1373,
- 1357,
- - 355,
- - 601,
- - 1270,
- 298,
- 322,
- 672,
- - 193,
- - 336,
- 77,
- 1089,
- 1533,
- 922,
- 177,
- - 39,
- - 1125,
- 996,
- 781,
- 536,
- 456,
- 366,
- - 432,
- 1415,
- 2440,
- 2279,
- - 466,
- - 758,
- - 2325,
- - 303,
- - 509,
- 387,
- - 727,
- - 557,
- 66,
- - 145,
- 643,
- 1248,
- - 544,
- - 676,
- - 916,
- - 225,
- 862,
- 588,
- - 152,
- 40,
- - 533,
- 423,
- 1423,
- 1558,
- - 572,
- - 843,
- - 1145,
- - 128,
- 85,
- 461,
- - 238,
- - 257,
- - 584,
- 605,
- 748,
- 861,
- 24,
- - 202,
- - 1409,
- 797,
- 487,
- 303,
- - 181,
- 364,
- - 182,
- 616,
- 1378,
- 2942,
- - 494,
- - 852,
- - 1441,
- - 292,
- 61,
- 812,
- - 84,
- - 723,
- - 182,
- 555,
- 532,
- 1506,
- - 365,
- - 493,
- - 1057,
- 822,
- 588,
- 11,
- - 14,
- - 18,
- - 230,
- 1001,
- 1401,
- 1451,
- - 474,
- - 569,
- - 1292,
- 302,
- 62,
- 1062,
- - 70,
- - 376,
- - 222,
- 982,
- 974,
- 1149,
- - 196,
- - 234,
- - 795,
- 479,
- 1098,
- 499,
- 362,
- 58,
- 70,
- 1147,
- 2069,
- 2857,
- - 487,
- - 878,
- - 1824,
- 73,
- - 288,
- 348,
- - 358,
- - 500,
- - 508,
- 199,
- 721,
- 1242,
- - 78,
- - 697,
- - 795,
- 361,
- 536,
- 196,
- 374,
- 110,
- - 735,
- 847,
- 1051,
- 1896,
- - 366,
- - 713,
- - 1182,
- 315,
- 320,
- 429,
- 72,
- - 215,
- - 450,
- 759,
- 886,
- 1363,
- - 30,
- - 428,
- - 834,
- 861,
- 627,
- 796,
- 118,
- 468,
- - 279,
- 1355,
- 1883,
- 1893,
- - 188,
- - 642,
- - 1612,
- 63,
- - 175,
- 1198,
- - 418,
- - 211,
- 51,
- 414,
- 587,
- 2601,
- - 234,
- - 557,
- - 858,
- 424,
- 889,
- 222,
- 136,
- - 101,
- 83,
- 1413,
- 2278,
- 1383,
- - 84,
- - 445,
- - 1389,
- 414,
- 313,
- 1045,
- 29,
- - 343,
- 65,
- 1552,
- 1647,
- 980,
- 183,
- - 91,
- - 829,
- 1273,
- 1413,
- 360,
- 553,
- 272,
- - 107,
- 1587,
- 3149,
- 2603
+ - 890,
+ - 1550,
+ - 2541,
+ - 819,
+ - 970,
+ 175,
+ - 826,
+ - 1234,
+ - 762,
+ - 599,
+ - 22,
+ 634,
+ - 811,
+ - 987,
+ - 902,
+ - 323,
+ 203,
+ 26,
+ - 383,
+ - 235,
+ - 781,
+ - 399,
+ 1262,
+ 906,
+ - 932,
+ - 1399,
+ - 1380,
+ - 624,
+ 93,
+ 87,
+ - 414,
+ - 539,
+ - 691,
+ 37,
+ 633,
+ 510,
+ - 387,
+ - 476,
+ - 1330,
+ 399,
+ 66,
+ 263,
+ - 407,
+ - 49,
+ - 335,
+ - 417,
+ 1041,
+ 1865,
+ - 779,
+ - 1089,
+ - 1440,
+ - 746,
+ - 858,
+ 832,
+ - 581,
+ - 759,
+ - 371,
+ - 673,
+ - 506,
+ 2088,
+ - 560,
+ - 634,
+ - 1179,
+ 271,
+ 241,
+ 14,
+ - 438,
+ - 244,
+ - 397,
+ 463,
+ 1202,
+ 1047,
+ - 606,
+ - 797,
+ - 1438,
+ - 51,
+ - 323,
+ 481,
+ - 224,
+ - 584,
+ - 527,
+ 494,
+ 881,
+ 682,
+ - 433,
+ - 306,
+ - 1002,
+ 554,
+ 659,
+ 222,
+ 171,
+ - 160,
+ - 353,
+ 681,
+ 1798,
+ 1565,
+ - 852,
+ - 1181,
+ - 1695,
+ - 336,
+ - 666,
+ 114,
+ - 581,
+ - 756,
+ - 744,
+ - 195,
+ 375,
+ 497,
+ - 465,
+ - 804,
+ - 1098,
+ 154,
+ 282,
+ - 131,
+ - 50,
+ - 191,
+ - 719,
+ 323,
+ 732,
+ 1542,
+ - 722,
+ - 819,
+ - 1404,
+ 105,
+ - 250,
+ 185,
+ - 178,
+ - 502,
+ - 742,
+ 321,
+ 510,
+ 1111,
+ - 323,
+ - 567,
+ - 966,
+ 127,
+ 484,
+ 338,
+ - 160,
+ 52,
+ - 338,
+ 732,
+ 1367,
+ 1554,
+ - 626,
+ - 802,
+ - 1696,
+ - 286,
+ - 586,
+ 676,
+ - 695,
+ - 343,
+ - 370,
+ - 490,
+ 295,
+ 1893,
+ - 630,
+ - 574,
+ - 1014,
+ - 80,
+ 645,
+ - 69,
+ - 6,
+ - 318,
+ - 364,
+ 782,
+ 1450,
+ 1038,
+ - 313,
+ - 733,
+ - 1395,
+ 120,
+ 60,
+ 477,
+ - 264,
+ - 585,
+ - 123,
+ 711,
+ 1245,
+ 633,
+ - 91,
+ - 355,
+ - 1016,
+ 771,
+ 758,
+ 261,
+ 253,
+ 81,
+ - 474,
+ 930,
+ 2215,
+ 1720,
+ - 808,
+ - 1099,
+ - 1925,
+ - 560,
+ - 782,
+ 169,
+ - 804,
+ - 1074,
+ - 188,
+ - 626,
+ - 55,
+ 1405,
+ - 694,
+ - 716,
+ - 1194,
+ - 660,
+ 354,
+ 329,
+ - 514,
+ - 55,
+ - 543,
+ 366,
+ 1033,
+ 1182,
+ - 658,
+ - 959,
+ - 1357,
+ - 55,
+ - 184,
+ 93,
+ - 605,
+ - 286,
+ - 662,
+ 404,
+ 449,
+ 827,
+ - 286,
+ - 350,
+ - 1263,
+ 628,
+ 306,
+ 227,
+ - 16,
+ 147,
+ - 623,
+ 186,
+ 923,
+ 2146,
+ - 674,
+ - 890,
+ - 1606,
+ - 443,
+ - 228,
+ 339,
+ - 369,
+ - 790,
+ - 409,
+ 231,
+ 86,
+ 1469,
+ - 448,
+ - 581,
+ - 1061,
+ 594,
+ 450,
+ - 177,
+ - 124,
+ - 170,
+ - 447,
+ 671,
+ 1159,
+ 1404,
+ - 476,
+ - 667,
+ - 1511,
+ - 77,
+ - 138,
+ 716,
+ - 177,
+ - 372,
+ - 381,
+ 451,
+ 934,
+ 915,
+ - 250,
+ - 432,
+ - 822,
+ 272,
+ 828,
+ 446,
+ 26,
+ 19,
+ - 31,
+ 698,
+ 1692,
+ 2168,
+ - 646,
+ - 977,
+ - 1924,
+ - 179,
+ - 473,
+ 268,
+ - 379,
+ - 745,
+ - 691,
+ 11,
+ 127,
+ 1033,
+ - 488,
+ - 917,
+ - 825,
+ 61,
+ 323,
+ 135,
+ 147,
+ - 145,
+ - 686,
+ 685,
+ 786,
+ 1682,
+ - 506,
+ - 848,
+ - 1297,
+ 35,
+ 90,
+ 222,
+ - 23,
+ - 346,
+ - 670,
+ 455,
+ 591,
+ 1287,
+ - 203,
+ - 593,
+ - 1086,
+ 652,
+ 352,
+ 437,
+ 39,
+ 63,
+ - 457,
+ 841,
+ 1265,
+ 2105,
+ - 520,
+ - 882,
+ - 1584,
+ - 328,
+ - 711,
+ 1421,
+ - 596,
+ - 342,
+ - 70,
+ 209,
+ 173,
+ 1928,
+ - 423,
+ - 598,
+ - 921,
+ 421,
+ 605,
+ - 38,
+ - 2,
+ - 245,
+ - 127,
+ 896,
+ 1969,
+ 1135,
+ - 379,
+ - 518,
+ - 1579,
+ 173,
+ 118,
+ 753,
+ - 55,
+ - 381,
+ - 52,
+ 985,
+ 1021,
+ 753,
+ - 2,
+ - 291,
+ - 891,
+ 753,
+ 992,
+ 423,
+ 264,
+ 131,
+ - 196,
+ 895,
+ 2274,
+ 2543,
+ - 635,
+ - 1088,
+ - 2499,
+ - 529,
+ - 982,
+ 526,
+ - 764,
+ - 830,
+ - 548,
+ - 436,
+ 316,
+ 599,
+ - 675,
+ - 940,
+ - 746,
+ - 57,
+ 236,
+ - 11,
+ - 201,
+ - 81,
+ - 798,
+ 16,
+ 845,
+ 1558,
+ - 737,
+ - 985,
+ - 1212,
+ - 468,
+ 17,
+ 290,
+ - 279,
+ - 584,
+ - 700,
+ 183,
+ 822,
+ 705,
+ - 265,
+ - 492,
+ - 1187,
+ 421,
+ 152,
+ 468,
+ - 390,
+ 166,
+ - 268,
+ 39,
+ 1550,
+ 1868,
+ - 635,
+ - 966,
+ - 1571,
+ - 453,
+ - 492,
+ 910,
+ - 284,
+ - 1027,
+ - 75,
+ - 181,
+ - 133,
+ 1852,
+ - 445,
+ - 624,
+ - 1174,
+ 420,
+ 367,
+ - 49,
+ - 389,
+ - 212,
+ - 169,
+ 707,
+ 1073,
+ 1208,
+ - 539,
+ - 710,
+ - 1449,
+ 83,
+ - 163,
+ 484,
+ - 236,
+ - 543,
+ - 355,
+ 338,
+ 1175,
+ 814,
+ - 246,
+ - 309,
+ - 958,
+ 606,
+ 760,
+ 60,
+ 166,
+ - 8,
+ - 163,
+ - 306,
+ 1849,
+ 2563,
+ - 747,
+ - 1025,
+ - 1783,
+ - 419,
+ - 446,
+ 209,
+ - 718,
+ - 566,
+ - 534,
+ - 506,
+ 693,
+ 857,
+ - 463,
+ - 697,
+ - 1082,
+ 325,
+ 431,
+ - 206,
+ - 15,
+ - 8,
+ - 763,
+ 545,
+ 919,
+ 1518,
+ - 611,
+ - 783,
+ - 1313,
+ 256,
+ - 55,
+ 208,
+ - 165,
+ - 348,
+ - 662,
+ 321,
+ 680,
+ 930,
+ - 326,
+ - 429,
+ - 951,
+ 484,
+ 446,
+ 570,
+ - 197,
+ 72,
+ - 73,
+ 909,
+ 1455,
+ 1741,
+ - 563,
+ - 737,
+ - 1974,
+ - 124,
+ - 416,
+ 718,
+ - 478,
+ - 404,
+ - 314,
+ - 16,
+ 446,
+ 1636,
+ - 551,
+ - 537,
+ - 750,
+ - 58,
+ 638,
+ 214,
+ 55,
+ - 185,
+ - 271,
+ 1148,
+ 1301,
+ 1212,
+ - 483,
+ - 671,
+ - 1264,
+ 117,
+ 285,
+ 543,
+ - 204,
+ - 391,
+ - 111,
+ 513,
+ 1538,
+ 854,
+ - 114,
+ - 190,
+ - 978,
+ 877,
+ 595,
+ 464,
+ 260,
+ 260,
+ - 311,
+ 748,
+ 2283,
+ 2216,
+ - 517,
+ - 945,
+ - 2171,
+ - 326,
+ - 708,
+ 378,
+ - 812,
+ - 691,
+ - 232,
+ - 560,
+ 687,
+ 1409,
+ - 732,
+ - 690,
+ - 836,
+ - 359,
+ 645,
+ 386,
+ - 265,
+ 62,
+ - 678,
+ 145,
+ 1644,
+ 1208,
+ - 555,
+ - 988,
+ - 1233,
+ - 78,
+ 14,
+ 114,
+ - 327,
+ - 358,
+ - 489,
+ 392,
+ 677,
+ 697,
+ - 201,
+ - 236,
+ - 1140,
+ 693,
+ 449,
+ 178,
+ - 243,
+ 256,
+ - 433,
+ 611,
+ 1385,
+ 2456,
+ - 612,
+ - 901,
+ - 1464,
+ - 307,
+ - 17,
+ 499,
+ - 315,
+ - 667,
+ - 254,
+ 256,
+ 428,
+ 1463,
+ - 486,
+ - 422,
+ - 1056,
+ 655,
+ 370,
+ 18,
+ - 102,
+ - 185,
+ - 276,
+ 755,
+ 1578,
+ 1335,
+ - 488,
+ - 603,
+ - 1418,
+ 182,
+ - 93,
+ 870,
+ - 73,
+ - 458,
+ - 348,
+ 835,
+ 862,
+ 957,
+ - 282,
+ - 333,
+ - 746,
+ 547,
+ 839,
+ 428,
+ 273,
+ - 89,
+ 13,
+ 940,
+ 1708,
+ 2576,
+ - 418,
+ - 1084,
+ - 1758,
+ - 44,
+ - 358,
+ 259,
+ - 497,
+ - 643,
+ - 560,
+ 99,
+ 557,
+ 961,
+ - 421,
+ - 766,
+ - 917,
+ 295,
+ 326,
+ 184,
+ 175,
+ 15,
+ - 626,
+ 532,
+ 878,
+ 1981,
+ - 443,
+ - 768,
+ - 1275,
+ 221,
+ 156,
+ 268,
+ 39,
+ - 363,
+ - 505,
+ 695,
+ 772,
+ 1140,
+ - 162,
+ - 459,
+ - 912,
+ 709,
+ 444,
+ 658,
+ 25,
+ 303,
+ - 312,
+ 1268,
+ 1410,
+ 1715,
+ - 297,
+ - 766,
+ - 1836,
+ - 263,
+ - 108,
+ 1070,
+ - 406,
+ - 13,
+ - 129,
+ 57,
+ 438,
+ 2734,
+ - 374,
+ - 487,
+ - 835,
+ 304,
+ 696,
+ 164,
+ 104,
+ - 235,
+ 5,
+ 1611,
+ 1900,
+ 1399,
+ - 229,
+ - 582,
+ - 1325,
+ 405,
+ 192,
+ 817,
+ - 87,
+ - 438,
+ 111,
+ 1028,
+ 1199,
+ 993,
+ 68,
+ - 175,
+ - 934,
+ 1033,
+ 1117,
+ 451,
+ 478,
+ 200,
+ - 248,
+ 2127,
+ 2696,
+ 2042,
+ - 835,
+ - 1323,
+ - 2131,
+ - 799,
+ - 692,
+ 466,
+ - 812,
+ - 1032,
+ - 469,
+ - 622,
+ 288,
+ 920,
+ - 701,
+ - 841,
+ - 1070,
+ - 411,
+ 512,
+ 8,
+ - 390,
+ - 91,
+ - 744,
+ - 30,
+ 1043,
+ 1161,
+ - 822,
+ - 1148,
+ - 1156,
+ - 294,
+ - 46,
+ 110,
+ - 411,
+ - 374,
+ - 678,
+ 214,
+ 531,
+ 668,
+ - 406,
+ - 420,
+ - 1194,
+ 487,
+ 232,
+ 303,
+ - 318,
+ 91,
+ - 472,
+ 123,
+ 1232,
+ 2445,
+ - 722,
+ - 952,
+ - 1495,
+ - 738,
+ - 675,
+ 1332,
+ - 543,
+ - 606,
+ - 211,
+ - 95,
+ - 98,
+ 1508,
+ - 549,
+ - 514,
+ - 1193,
+ 473,
+ 211,
+ 73,
+ - 288,
+ - 112,
+ - 389,
+ 537,
+ 1332,
+ 1258,
+ - 567,
+ - 755,
+ - 1545,
+ 71,
+ - 283,
+ 632,
+ - 170,
+ - 481,
+ - 493,
+ 681,
+ 1002,
+ 817,
+ - 356,
+ - 331,
+ - 877,
+ 419,
+ 706,
+ 346,
+ 241,
+ - 34,
+ - 326,
+ 377,
+ 1950,
+ 1883,
+ - 727,
+ - 1075,
+ - 1625,
+ - 233,
+ - 543,
+ 116,
+ - 524,
+ - 806,
+ - 585,
+ - 73,
+ 478,
+ 729,
+ - 288,
+ - 925,
+ - 1143,
+ 173,
+ 447,
+ - 52,
+ 68,
+ - 229,
+ - 606,
+ 449,
+ 529,
+ 1797,
+ - 591,
+ - 875,
+ - 1363,
+ 183,
+ - 144,
+ 324,
+ - 103,
+ - 452,
+ - 666,
+ 623,
+ 488,
+ 1176,
+ - 238,
+ - 511,
+ - 1004,
+ 326,
+ 552,
+ 458,
+ 136,
+ 108,
+ - 319,
+ 626,
+ 1343,
+ 1883,
+ - 490,
+ - 646,
+ - 1730,
+ - 186,
+ - 449,
+ 984,
+ - 738,
+ - 76,
+ - 170,
+ - 550,
+ 755,
+ 2560,
+ - 496,
+ - 510,
+ - 947,
+ 210,
+ 694,
+ - 52,
+ 84,
+ - 322,
+ - 199,
+ 1090,
+ 1625,
+ 1224,
+ - 376,
+ - 603,
+ - 1396,
+ 343,
+ 74,
+ 632,
+ - 175,
+ - 502,
+ - 32,
+ 972,
+ 1332,
+ 734,
+ 52,
+ - 295,
+ - 1113,
+ 1065,
+ 918,
+ 160,
+ 393,
+ 107,
+ - 397,
+ 1214,
+ 2649,
+ 1741,
+ - 632,
+ - 1201,
+ - 1891,
+ - 719,
+ - 277,
+ 353,
+ - 651,
+ - 880,
+ - 122,
+ - 211,
+ 209,
+ 1338,
+ - 562,
+ - 714,
+ - 1059,
+ - 208,
+ 388,
+ 159,
+ - 320,
+ - 61,
+ - 551,
+ 293,
+ 1092,
+ 1443,
+ - 648,
+ - 865,
+ - 1253,
+ - 49,
+ - 143,
+ 305,
+ - 401,
+ - 227,
+ - 585,
+ 561,
+ 532,
+ 927,
+ - 117,
+ - 443,
+ - 1188,
+ 507,
+ 436,
+ 292,
+ - 79,
+ 233,
+ - 458,
+ 671,
+ 1025,
+ 2396,
+ - 633,
+ - 842,
+ - 1525,
+ - 308,
+ - 286,
+ 640,
+ - 373,
+ - 621,
+ - 407,
+ 418,
+ 253,
+ 1305,
+ - 315,
+ - 581,
+ - 1137,
+ 572,
+ 685,
+ - 281,
+ 61,
+ - 68,
+ - 371,
+ 991,
+ 1101,
+ 1498,
+ - 493,
+ - 683,
+ - 1362,
+ - 47,
+ 164,
+ 704,
+ - 256,
+ - 314,
+ - 268,
+ 631,
+ 949,
+ 1052,
+ - 118,
+ - 348,
+ - 833,
+ 68,
+ 1180,
+ 568,
+ 152,
+ 117,
+ 34,
+ 1113,
+ 1902,
+ 2239,
+ - 601,
+ - 959,
+ - 1706,
+ - 143,
+ - 489,
+ 480,
+ - 332,
+ - 655,
+ - 574,
+ 54,
+ 353,
+ 1192,
+ - 462,
+ - 652,
+ - 796,
+ 150,
+ 549,
+ 112,
+ 195,
+ - 111,
+ - 515,
+ 679,
+ 1108,
+ 1647,
+ - 558,
+ - 749,
+ - 1217,
+ - 9,
+ 272,
+ 341,
+ - 53,
+ - 265,
+ - 535,
+ 489,
+ 843,
+ 1298,
+ - 120,
+ - 482,
+ - 1032,
+ 632,
+ 543,
+ 408,
+ 179,
+ 306,
+ - 526,
+ 1124,
+ 1464,
+ 2244,
+ - 417,
+ - 786,
+ - 1562,
+ - 224,
+ - 384,
+ 1364,
+ - 377,
+ - 459,
+ - 25,
+ 385,
+ 489,
+ 2174,
+ - 332,
+ - 651,
+ - 829,
+ 544,
+ 553,
+ 61,
+ 22,
+ - 113,
+ - 89,
+ 1128,
+ 1725,
+ 1524,
+ - 216,
+ - 373,
+ - 1653,
+ 161,
+ 316,
+ 908,
+ - 165,
+ - 222,
+ - 67,
+ 1362,
+ 1175,
+ 789,
+ 73,
+ - 252,
+ - 767,
+ 738,
+ 932,
+ 616,
+ 362,
+ 246,
+ - 126,
+ 787,
+ 2654,
+ 3027,
+ - 691,
+ - 1106,
+ - 2190,
+ - 565,
+ - 588,
+ 524,
+ - 590,
+ - 979,
+ - 490,
+ - 263,
+ 397,
+ 982,
+ - 577,
+ - 837,
+ - 945,
+ - 22,
+ 435,
+ - 49,
+ - 190,
+ - 118,
+ - 629,
+ - 88,
+ 1240,
+ 1513,
+ - 636,
+ - 1051,
+ - 1019,
+ - 291,
+ 189,
+ 259,
+ - 257,
+ - 470,
+ - 629,
+ 145,
+ 945,
+ 894,
+ - 326,
+ - 364,
+ - 1094,
+ 543,
+ 260,
+ 630,
+ - 202,
+ 189,
+ - 209,
+ 357,
+ 1379,
+ 2091,
+ - 569,
+ - 1075,
+ - 1449,
+ - 714,
+ - 239,
+ 919,
+ - 420,
+ - 705,
+ - 84,
+ - 109,
+ - 114,
+ 2407,
+ - 413,
+ - 529,
+ - 1177,
+ 482,
+ 368,
+ 131,
+ - 186,
+ - 72,
+ - 131,
+ 861,
+ 1255,
+ 1220,
+ - 611,
+ - 658,
+ - 1341,
+ 227,
+ - 121,
+ 631,
+ - 176,
+ - 489,
+ - 218,
+ 745,
+ 1175,
+ 957,
+ - 321,
+ - 148,
+ - 936,
+ 671,
+ 966,
+ 216,
+ 340,
+ - 3,
+ - 143,
+ 469,
+ 1848,
+ 2437,
+ - 729,
+ - 961,
+ - 1683,
+ - 213,
+ - 254,
+ 321,
+ - 511,
+ - 438,
+ - 521,
+ - 126,
+ 725,
+ 903,
+ - 340,
+ - 685,
+ - 1032,
+ 316,
+ 480,
+ 20,
+ 23,
+ - 89,
+ - 551,
+ 353,
+ 1051,
+ 1789,
+ - 544,
+ - 757,
+ - 1364,
+ 298,
+ - 25,
+ 436,
+ - 100,
+ - 392,
+ - 519,
+ 467,
+ 754,
+ 1078,
+ - 210,
+ - 398,
+ - 1078,
+ 620,
+ 658,
+ 630,
+ 33,
+ 147,
+ - 178,
+ 921,
+ 1687,
+ 1921,
+ - 325,
+ - 528,
+ - 1978,
+ 2,
+ - 285,
+ 910,
+ - 371,
+ - 490,
+ - 230,
+ 0,
+ 597,
+ 2010,
+ - 496,
+ - 395,
+ - 834,
+ 37,
+ 945,
+ 245,
+ 181,
+ - 160,
+ - 144,
+ 1481,
+ 1373,
+ 1357,
+ - 355,
+ - 601,
+ - 1270,
+ 298,
+ 322,
+ 672,
+ - 193,
+ - 336,
+ 77,
+ 1089,
+ 1533,
+ 922,
+ 177,
+ - 39,
+ - 1125,
+ 996,
+ 781,
+ 536,
+ 456,
+ 366,
+ - 432,
+ 1415,
+ 2440,
+ 2279,
+ - 466,
+ - 758,
+ - 2325,
+ - 303,
+ - 509,
+ 387,
+ - 727,
+ - 557,
+ 66,
+ - 145,
+ 643,
+ 1248,
+ - 544,
+ - 676,
+ - 916,
+ - 225,
+ 862,
+ 588,
+ - 152,
+ 40,
+ - 533,
+ 423,
+ 1423,
+ 1558,
+ - 572,
+ - 843,
+ - 1145,
+ - 128,
+ 85,
+ 461,
+ - 238,
+ - 257,
+ - 584,
+ 605,
+ 748,
+ 861,
+ 24,
+ - 202,
+ - 1409,
+ 797,
+ 487,
+ 303,
+ - 181,
+ 364,
+ - 182,
+ 616,
+ 1378,
+ 2942,
+ - 494,
+ - 852,
+ - 1441,
+ - 292,
+ 61,
+ 812,
+ - 84,
+ - 723,
+ - 182,
+ 555,
+ 532,
+ 1506,
+ - 365,
+ - 493,
+ - 1057,
+ 822,
+ 588,
+ 11,
+ - 14,
+ - 18,
+ - 230,
+ 1001,
+ 1401,
+ 1451,
+ - 474,
+ - 569,
+ - 1292,
+ 302,
+ 62,
+ 1062,
+ - 70,
+ - 376,
+ - 222,
+ 982,
+ 974,
+ 1149,
+ - 196,
+ - 234,
+ - 795,
+ 479,
+ 1098,
+ 499,
+ 362,
+ 58,
+ 70,
+ 1147,
+ 2069,
+ 2857,
+ - 487,
+ - 878,
+ - 1824,
+ 73,
+ - 288,
+ 348,
+ - 358,
+ - 500,
+ - 508,
+ 199,
+ 721,
+ 1242,
+ - 78,
+ - 697,
+ - 795,
+ 361,
+ 536,
+ 196,
+ 374,
+ 110,
+ - 735,
+ 847,
+ 1051,
+ 1896,
+ - 366,
+ - 713,
+ - 1182,
+ 315,
+ 320,
+ 429,
+ 72,
+ - 215,
+ - 450,
+ 759,
+ 886,
+ 1363,
+ - 30,
+ - 428,
+ - 834,
+ 861,
+ 627,
+ 796,
+ 118,
+ 468,
+ - 279,
+ 1355,
+ 1883,
+ 1893,
+ - 188,
+ - 642,
+ - 1612,
+ 63,
+ - 175,
+ 1198,
+ - 418,
+ - 211,
+ 51,
+ 414,
+ 587,
+ 2601,
+ - 234,
+ - 557,
+ - 858,
+ 424,
+ 889,
+ 222,
+ 136,
+ - 101,
+ 83,
+ 1413,
+ 2278,
+ 1383,
+ - 84,
+ - 445,
+ - 1389,
+ 414,
+ 313,
+ 1045,
+ 29,
+ - 343,
+ 65,
+ 1552,
+ 1647,
+ 980,
+ 183,
+ - 91,
+ - 829,
+ 1273,
+ 1413,
+ 360,
+ 553,
+ 272,
+ - 107,
+ 1587,
+ 3149,
+ 2603
};
#define DICO1_SIZE_5 128
#define DICO2_SIZE_5 256
@@ -7445,3866 +7445,3866 @@ static const Word32 mr795_1_lsf[] =
/* 1st LSF quantizer (MR122) */
static const Word32 dico1_lsf_5[DICO1_SIZE_5 * 4] =
{
- - 451,
- - 1065,
- - 529,
- - 1305,
- - 450,
- - 756,
- - 497,
- - 863,
- - 384,
- - 619,
- - 413,
- - 669,
- - 317,
- - 538,
- - 331,
- - 556,
- - 414,
- - 508,
- - 424,
- - 378,
- - 274,
- - 324,
- - 434,
- - 614,
- - 226,
- - 500,
- - 232,
- - 514,
- - 263,
- - 377,
- - 298,
- - 410,
- - 151,
- - 710,
- - 174,
- - 818,
- - 149,
- - 412,
- - 156,
- - 429,
- - 288,
- - 462,
- - 186,
- - 203,
- - 170,
- - 302,
- - 191,
- - 321,
- - 131,
- - 147,
- - 297,
- - 395,
- - 228,
- - 214,
- - 245,
- - 192,
- - 67,
- - 316,
- - 71,
- - 327,
- - 104,
- - 205,
- - 94,
- - 183,
- - 143,
- - 38,
- - 193,
- - 95,
- 16,
- - 76,
- - 124,
- - 248,
- 23,
- - 237,
- 24,
- - 244,
- 18,
- - 136,
- 44,
- - 111,
- - 33,
- - 24,
- - 25,
- 0,
- 149,
- 19,
- 23,
- - 143,
- 158,
- - 169,
- 174,
- - 181,
- 133,
- - 55,
- 165,
- - 26,
- 111,
- 84,
- 98,
- 75,
- 87,
- 183,
- - 115,
- - 11,
- - 8,
- 130,
- 11,
- 170,
- 254,
- 77,
- 205,
- 17,
- 183,
- 112,
- 262,
- 194,
- 202,
- 287,
- 95,
- 189,
- - 42,
- - 105,
- 234,
- 179,
- 39,
- 186,
- 163,
- 345,
- 332,
- 199,
- 299,
- 161,
- - 54,
- 285,
- - 78,
- 281,
- - 133,
- 141,
- - 182,
- 111,
- 249,
- 341,
- 271,
- 364,
- 93,
- 403,
- 75,
- 391,
- 92,
- 510,
- - 138,
- 220,
- - 185,
- - 29,
- - 34,
- 361,
- - 115,
- 320,
- 3,
- 554,
- 99,
- 286,
- 218,
- 591,
- - 245,
- 406,
- - 268,
- 453,
- 0,
- 580,
- 25,
- 606,
- 275,
- 532,
- 148,
- 450,
- - 73,
- 739,
- - 285,
- 518,
- - 288,
- 94,
- - 203,
- 674,
- - 140,
- - 74,
- 205,
- 714,
- - 114,
- 299,
- 176,
- 923,
- 182,
- 557,
- 240,
- 705,
- - 16,
- 513,
- 485,
- 593,
- 293,
- 384,
- 451,
- 617,
- - 38,
- 50,
- 563,
- 529,
- 303,
- 209,
- 459,
- 363,
- 433,
- 452,
- 450,
- 454,
- 367,
- 606,
- 477,
- 741,
- 432,
- 353,
- 368,
- 267,
- 361,
- 716,
- 273,
- 583,
- 453,
- 166,
- 510,
- 172,
- 201,
- 629,
- 274,
- 191,
- 568,
- 639,
- 302,
- 298,
- 634,
- 387,
- 643,
- 350,
- 587,
- 560,
- 612,
- 565,
- 600,
- 788,
- 487,
- 672,
- 512,
- 1015,
- 321,
- 333,
- 357,
- 854,
- - 125,
- 413,
- 474,
- 712,
- 17,
- - 151,
- 564,
- 285,
- 270,
- - 241,
- 971,
- 889,
- 489,
- 220,
- 510,
- 896,
- 549,
- 924,
- 327,
- 825,
- 290,
- 911,
- 540,
- 1108,
- 158,
- 805,
- 199,
- 957,
- 511,
- 730,
- 100,
- 874,
- 13,
- 791,
- 435,
- 632,
- 676,
- 972,
- 249,
- 900,
- 467,
- 1218,
- 781,
- 1074,
- 585,
- 785,
- - 23,
- 669,
- 267,
- 1043,
- 619,
- 1084,
- 615,
- 1145,
- 622,
- 905,
- 916,
- 1049,
- 80,
- 331,
- 584,
- 1075,
- 89,
- 639,
- 988,
- 961,
- 770,
- 720,
- 798,
- 699,
- 492,
- 447,
- 899,
- 627,
- 271,
- 1188,
- 725,
- 1333,
- 87,
- 603,
- 832,
- 1603,
- 616,
- 1127,
- 890,
- 1505,
- 1000,
- 1156,
- 866,
- 1009,
- 995,
- 827,
- 1149,
- 858,
- 817,
- 1450,
- 773,
- 1320,
- 500,
- 1389,
- 312,
- 1153,
- - 20,
- 1084,
- 64,
- 1283,
- 2,
- 1172,
- 399,
- 1869,
- 514,
- 1706,
- 502,
- 1636,
- 886,
- 1522,
- 416,
- 600,
- 1131,
- 1350,
- 1275,
- 1390,
- 889,
- 1795,
- 914,
- 1766,
- 227,
- 1183,
- 1250,
- 1826,
- 505,
- 1854,
- 919,
- 2353,
- - 199,
- 431,
- 152,
- 1735,
- - 213,
- - 28,
- 392,
- 1334,
- - 153,
- - 52,
- 978,
- 1151,
- - 323,
- - 400,
- 813,
- 1703,
- - 136,
- 84,
- 1449,
- 2015,
- - 331,
- - 143,
- - 137,
- 1192,
- - 256,
- 534,
- - 157,
- 1031,
- - 307,
- - 439,
- 542,
- 731,
- - 329,
- - 420,
- - 97,
- 616,
- - 362,
- - 168,
- - 322,
- 366,
- - 247,
- - 110,
- - 211,
- 89,
- - 196,
- - 309,
- 20,
- 59,
- - 364,
- - 463,
- - 286,
- 89,
- - 336,
- 175,
- - 432,
- 141,
- - 379,
- - 190,
- - 434,
- - 196,
- - 79,
- 150,
- - 278,
- - 227,
- - 280,
- 166,
- - 555,
- - 422,
- - 155,
- 541,
- - 366,
- 54,
- - 29,
- - 83,
- - 301,
- - 774,
- 186,
- 628,
- - 397,
- - 264,
- 242,
- 293,
- - 197,
- - 585,
- 124,
- 410,
- 53,
- - 133,
- 10,
- 340,
- - 570,
- - 1065,
- 65,
- - 446,
- 68,
- - 493,
- 383,
- 937,
- - 357,
- - 711,
- - 359,
- - 250,
- - 677,
- - 1068,
- 292,
- - 26,
- 363,
- 6,
- 607,
- 1313,
- - 127,
- - 10,
- 1513,
- 1886,
- 713,
- 972,
- 1469,
- 2181,
- 1443,
- 2016
+ - 451,
+ - 1065,
+ - 529,
+ - 1305,
+ - 450,
+ - 756,
+ - 497,
+ - 863,
+ - 384,
+ - 619,
+ - 413,
+ - 669,
+ - 317,
+ - 538,
+ - 331,
+ - 556,
+ - 414,
+ - 508,
+ - 424,
+ - 378,
+ - 274,
+ - 324,
+ - 434,
+ - 614,
+ - 226,
+ - 500,
+ - 232,
+ - 514,
+ - 263,
+ - 377,
+ - 298,
+ - 410,
+ - 151,
+ - 710,
+ - 174,
+ - 818,
+ - 149,
+ - 412,
+ - 156,
+ - 429,
+ - 288,
+ - 462,
+ - 186,
+ - 203,
+ - 170,
+ - 302,
+ - 191,
+ - 321,
+ - 131,
+ - 147,
+ - 297,
+ - 395,
+ - 228,
+ - 214,
+ - 245,
+ - 192,
+ - 67,
+ - 316,
+ - 71,
+ - 327,
+ - 104,
+ - 205,
+ - 94,
+ - 183,
+ - 143,
+ - 38,
+ - 193,
+ - 95,
+ 16,
+ - 76,
+ - 124,
+ - 248,
+ 23,
+ - 237,
+ 24,
+ - 244,
+ 18,
+ - 136,
+ 44,
+ - 111,
+ - 33,
+ - 24,
+ - 25,
+ 0,
+ 149,
+ 19,
+ 23,
+ - 143,
+ 158,
+ - 169,
+ 174,
+ - 181,
+ 133,
+ - 55,
+ 165,
+ - 26,
+ 111,
+ 84,
+ 98,
+ 75,
+ 87,
+ 183,
+ - 115,
+ - 11,
+ - 8,
+ 130,
+ 11,
+ 170,
+ 254,
+ 77,
+ 205,
+ 17,
+ 183,
+ 112,
+ 262,
+ 194,
+ 202,
+ 287,
+ 95,
+ 189,
+ - 42,
+ - 105,
+ 234,
+ 179,
+ 39,
+ 186,
+ 163,
+ 345,
+ 332,
+ 199,
+ 299,
+ 161,
+ - 54,
+ 285,
+ - 78,
+ 281,
+ - 133,
+ 141,
+ - 182,
+ 111,
+ 249,
+ 341,
+ 271,
+ 364,
+ 93,
+ 403,
+ 75,
+ 391,
+ 92,
+ 510,
+ - 138,
+ 220,
+ - 185,
+ - 29,
+ - 34,
+ 361,
+ - 115,
+ 320,
+ 3,
+ 554,
+ 99,
+ 286,
+ 218,
+ 591,
+ - 245,
+ 406,
+ - 268,
+ 453,
+ 0,
+ 580,
+ 25,
+ 606,
+ 275,
+ 532,
+ 148,
+ 450,
+ - 73,
+ 739,
+ - 285,
+ 518,
+ - 288,
+ 94,
+ - 203,
+ 674,
+ - 140,
+ - 74,
+ 205,
+ 714,
+ - 114,
+ 299,
+ 176,
+ 923,
+ 182,
+ 557,
+ 240,
+ 705,
+ - 16,
+ 513,
+ 485,
+ 593,
+ 293,
+ 384,
+ 451,
+ 617,
+ - 38,
+ 50,
+ 563,
+ 529,
+ 303,
+ 209,
+ 459,
+ 363,
+ 433,
+ 452,
+ 450,
+ 454,
+ 367,
+ 606,
+ 477,
+ 741,
+ 432,
+ 353,
+ 368,
+ 267,
+ 361,
+ 716,
+ 273,
+ 583,
+ 453,
+ 166,
+ 510,
+ 172,
+ 201,
+ 629,
+ 274,
+ 191,
+ 568,
+ 639,
+ 302,
+ 298,
+ 634,
+ 387,
+ 643,
+ 350,
+ 587,
+ 560,
+ 612,
+ 565,
+ 600,
+ 788,
+ 487,
+ 672,
+ 512,
+ 1015,
+ 321,
+ 333,
+ 357,
+ 854,
+ - 125,
+ 413,
+ 474,
+ 712,
+ 17,
+ - 151,
+ 564,
+ 285,
+ 270,
+ - 241,
+ 971,
+ 889,
+ 489,
+ 220,
+ 510,
+ 896,
+ 549,
+ 924,
+ 327,
+ 825,
+ 290,
+ 911,
+ 540,
+ 1108,
+ 158,
+ 805,
+ 199,
+ 957,
+ 511,
+ 730,
+ 100,
+ 874,
+ 13,
+ 791,
+ 435,
+ 632,
+ 676,
+ 972,
+ 249,
+ 900,
+ 467,
+ 1218,
+ 781,
+ 1074,
+ 585,
+ 785,
+ - 23,
+ 669,
+ 267,
+ 1043,
+ 619,
+ 1084,
+ 615,
+ 1145,
+ 622,
+ 905,
+ 916,
+ 1049,
+ 80,
+ 331,
+ 584,
+ 1075,
+ 89,
+ 639,
+ 988,
+ 961,
+ 770,
+ 720,
+ 798,
+ 699,
+ 492,
+ 447,
+ 899,
+ 627,
+ 271,
+ 1188,
+ 725,
+ 1333,
+ 87,
+ 603,
+ 832,
+ 1603,
+ 616,
+ 1127,
+ 890,
+ 1505,
+ 1000,
+ 1156,
+ 866,
+ 1009,
+ 995,
+ 827,
+ 1149,
+ 858,
+ 817,
+ 1450,
+ 773,
+ 1320,
+ 500,
+ 1389,
+ 312,
+ 1153,
+ - 20,
+ 1084,
+ 64,
+ 1283,
+ 2,
+ 1172,
+ 399,
+ 1869,
+ 514,
+ 1706,
+ 502,
+ 1636,
+ 886,
+ 1522,
+ 416,
+ 600,
+ 1131,
+ 1350,
+ 1275,
+ 1390,
+ 889,
+ 1795,
+ 914,
+ 1766,
+ 227,
+ 1183,
+ 1250,
+ 1826,
+ 505,
+ 1854,
+ 919,
+ 2353,
+ - 199,
+ 431,
+ 152,
+ 1735,
+ - 213,
+ - 28,
+ 392,
+ 1334,
+ - 153,
+ - 52,
+ 978,
+ 1151,
+ - 323,
+ - 400,
+ 813,
+ 1703,
+ - 136,
+ 84,
+ 1449,
+ 2015,
+ - 331,
+ - 143,
+ - 137,
+ 1192,
+ - 256,
+ 534,
+ - 157,
+ 1031,
+ - 307,
+ - 439,
+ 542,
+ 731,
+ - 329,
+ - 420,
+ - 97,
+ 616,
+ - 362,
+ - 168,
+ - 322,
+ 366,
+ - 247,
+ - 110,
+ - 211,
+ 89,
+ - 196,
+ - 309,
+ 20,
+ 59,
+ - 364,
+ - 463,
+ - 286,
+ 89,
+ - 336,
+ 175,
+ - 432,
+ 141,
+ - 379,
+ - 190,
+ - 434,
+ - 196,
+ - 79,
+ 150,
+ - 278,
+ - 227,
+ - 280,
+ 166,
+ - 555,
+ - 422,
+ - 155,
+ 541,
+ - 366,
+ 54,
+ - 29,
+ - 83,
+ - 301,
+ - 774,
+ 186,
+ 628,
+ - 397,
+ - 264,
+ 242,
+ 293,
+ - 197,
+ - 585,
+ 124,
+ 410,
+ 53,
+ - 133,
+ 10,
+ 340,
+ - 570,
+ - 1065,
+ 65,
+ - 446,
+ 68,
+ - 493,
+ 383,
+ 937,
+ - 357,
+ - 711,
+ - 359,
+ - 250,
+ - 677,
+ - 1068,
+ 292,
+ - 26,
+ 363,
+ 6,
+ 607,
+ 1313,
+ - 127,
+ - 10,
+ 1513,
+ 1886,
+ 713,
+ 972,
+ 1469,
+ 2181,
+ 1443,
+ 2016
};
/* 2nd LSF quantizer (MR122) */
static const Word32 dico2_lsf_5[DICO2_SIZE_5 * 4] =
{
- - 1631,
- - 1600,
- - 1796,
- - 2290,
- - 1027,
- - 1770,
- - 1100,
- - 2025,
- - 1277,
- - 1388,
- - 1367,
- - 1534,
- - 947,
- - 1461,
- - 972,
- - 1524,
- - 999,
- - 1222,
- - 1020,
- - 1172,
- - 815,
- - 987,
- - 992,
- - 1371,
- - 1216,
- - 1006,
- - 1289,
- - 1094,
- - 744,
- - 1268,
- - 755,
- - 1293,
- - 862,
- - 923,
- - 905,
- - 984,
- - 678,
- - 1051,
- - 685,
- - 1050,
- - 1087,
- - 985,
- - 1062,
- - 679,
- - 989,
- - 641,
- - 1127,
- - 976,
- - 762,
- - 654,
- - 890,
- - 806,
- - 833,
- - 1091,
- - 706,
- - 629,
- - 621,
- - 806,
- - 640,
- - 812,
- - 775,
- - 634,
- - 779,
- - 543,
- - 996,
- - 565,
- - 1075,
- - 580,
- - 546,
- - 611,
- - 572,
- - 619,
- - 760,
- - 290,
- - 879,
- - 526,
- - 823,
- - 462,
- - 795,
- - 253,
- - 553,
- - 415,
- - 589,
- - 439,
- - 533,
- - 340,
- - 692,
- - 935,
- - 505,
- - 772,
- - 702,
- - 1131,
- - 263,
- - 306,
- - 971,
- - 483,
- - 445,
- - 74,
- - 555,
- - 548,
- - 614,
- - 129,
- - 693,
- - 234,
- - 396,
- - 246,
- - 475,
- - 250,
- - 265,
- - 404,
- - 376,
- - 514,
- - 417,
- - 510,
- - 300,
- - 313,
- - 334,
- - 664,
- - 463,
- - 814,
- - 386,
- - 704,
- - 337,
- - 615,
- - 234,
- - 201,
- - 233,
- - 239,
- - 167,
- - 567,
- - 203,
- - 619,
- - 147,
- - 415,
- - 115,
- - 352,
- - 166,
- - 750,
- - 171,
- - 761,
- - 270,
- - 879,
- - 264,
- - 903,
- - 367,
- - 744,
- 43,
- - 475,
- 14,
- - 653,
- 43,
- - 670,
- 11,
- - 448,
- - 59,
- - 521,
- - 126,
- - 119,
- - 155,
- - 613,
- - 42,
- - 863,
- - 27,
- - 931,
- 136,
- - 483,
- 183,
- - 468,
- 55,
- - 298,
- 55,
- - 304,
- 313,
- - 609,
- 313,
- - 720,
- 322,
- - 167,
- 100,
- - 541,
- - 3,
- - 119,
- - 111,
- - 187,
- 233,
- - 236,
- 260,
- - 234,
- 26,
- - 165,
- 134,
- - 45,
- - 40,
- - 549,
- 360,
- - 203,
- 378,
- - 388,
- 450,
- - 383,
- 275,
- 20,
- 182,
- - 103,
- 246,
- - 111,
- 431,
- 37,
- 462,
- - 146,
- 487,
- - 157,
- - 284,
- - 59,
- 503,
- - 184,
- 24,
- 53,
- - 3,
- 54,
- 122,
- 259,
- 333,
- 66,
- 484,
- 104,
- 436,
- 68,
- 195,
- 116,
- 190,
- 206,
- 269,
- - 9,
- 482,
- 352,
- 382,
- 285,
- 399,
- 277,
- 452,
- 256,
- 69,
- 186,
- 13,
- 297,
- - 13,
- 259,
- - 95,
- 30,
- 56,
- 394,
- 196,
- 425,
- 205,
- 456,
- 281,
- 577,
- 15,
- 191,
- 375,
- 290,
- 407,
- 576,
- - 56,
- 227,
- 544,
- 405,
- 0,
- 549,
- - 92,
- 528,
- - 229,
- 351,
- - 245,
- 338,
- - 362,
- 435,
- 167,
- 527,
- - 75,
- 302,
- 91,
- 824,
- 129,
- 599,
- 496,
- 679,
- 186,
- 749,
- 153,
- 737,
- - 281,
- 600,
- - 348,
- 615,
- - 236,
- 769,
- 41,
- 881,
- 38,
- 890,
- - 220,
- 841,
- - 357,
- 883,
- - 393,
- 903,
- - 634,
- 474,
- - 444,
- 850,
- - 175,
- 678,
- - 493,
- 242,
- - 519,
- 785,
- - 714,
- 582,
- - 541,
- 366,
- - 543,
- 434,
- - 597,
- 500,
- - 765,
- 222,
- - 702,
- 917,
- - 743,
- 962,
- - 869,
- 501,
- - 899,
- 548,
- - 379,
- 200,
- - 435,
- 157,
- - 819,
- 214,
- - 861,
- 157,
- - 614,
- 40,
- - 632,
- 94,
- - 883,
- - 54,
- - 741,
- 516,
- - 501,
- 298,
- - 614,
- - 171,
- - 870,
- - 161,
- - 865,
- - 23,
- - 818,
- 93,
- - 1015,
- - 267,
- - 662,
- - 359,
- - 549,
- 2,
- - 442,
- - 121,
- - 377,
- 0,
- - 227,
- 33,
- - 414,
- - 126,
- - 129,
- 212,
- - 934,
- 34,
- - 1082,
- - 282,
- - 1119,
- - 268,
- - 710,
- - 825,
- - 420,
- - 191,
- - 1076,
- - 928,
- - 917,
- - 93,
- - 628,
- - 358,
- 97,
- 7,
- - 206,
- - 393,
- - 101,
- 24,
- - 203,
- 38,
- - 168,
- 83,
- - 599,
- - 423,
- - 279,
- 426,
- - 700,
- 118,
- - 75,
- 206,
- - 981,
- - 673,
- - 680,
- 417,
- - 367,
- 37,
- - 279,
- 474,
- - 129,
- - 318,
- 319,
- 296,
- - 626,
- - 39,
- 343,
- 602,
- - 696,
- - 39,
- - 303,
- 940,
- 104,
- 233,
- - 380,
- 137,
- - 36,
- 269,
- - 75,
- - 214,
- 120,
- 43,
- - 529,
- - 477,
- 459,
- 164,
- - 202,
- - 229,
- - 49,
- - 167,
- 609,
- 792,
- 98,
- - 220,
- 915,
- 148,
- 293,
- 283,
- 869,
- 91,
- 575,
- 394,
- 326,
- - 78,
- 717,
- 67,
- 365,
- - 323,
- 616,
- - 36,
- 731,
- 27,
- 619,
- 238,
- 632,
- 273,
- 448,
- 99,
- 801,
- 476,
- 869,
- 273,
- 685,
- 64,
- 789,
- 72,
- 1021,
- 217,
- 793,
- 459,
- 734,
- 360,
- 646,
- 480,
- 360,
- 322,
- 429,
- 464,
- 638,
- 430,
- 756,
- 363,
- 1000,
- 404,
- 683,
- 528,
- 602,
- 615,
- 655,
- 413,
- 946,
- 687,
- 937,
- 602,
- 904,
- 604,
- 555,
- 737,
- 786,
- 662,
- 467,
- 654,
- 362,
- 589,
- 929,
- 710,
- 498,
- 478,
- 415,
- 420,
- 693,
- 883,
- 813,
- 683,
- 781,
- 925,
- 913,
- 939,
- 726,
- 732,
- 491,
- 853,
- 531,
- 948,
- 734,
- 963,
- 315,
- 808,
- 761,
- 755,
- 1144,
- 760,
- 655,
- 1076,
- 826,
- 1057,
- 1091,
- 838,
- 1003,
- 808,
- 1047,
- 1133,
- 659,
- 1101,
- 992,
- 1050,
- 1074,
- 1075,
- 971,
- 694,
- 1226,
- 1054,
- 571,
- 841,
- 884,
- 1404,
- 1379,
- 1096,
- 1080,
- 861,
- 1231,
- 735,
- 1284,
- 760,
- 1272,
- 991,
- 1367,
- 1053,
- 1257,
- 700,
- 1050,
- 534,
- 988,
- 453,
- 1264,
- 599,
- 1140,
- 679,
- 1621,
- 815,
- 1384,
- 521,
- 1317,
- 393,
- 1564,
- 805,
- 1448,
- 686,
- 1068,
- 648,
- 875,
- 307,
- 1083,
- 361,
- 1047,
- 317,
- 1417,
- 964,
- 675,
- 571,
- 1152,
- 79,
- 1114,
- - 47,
- 1530,
- 311,
- 1721,
- 314,
- 1166,
- 689,
- 514,
- - 94,
- 349,
- 282,
- 1412,
- 328,
- 1025,
- 487,
- - 65,
- 57,
- 805,
- 970,
- 36,
- 62,
- 769,
- - 263,
- 791,
- - 346,
- 637,
- 699,
- - 137,
- 620,
- 534,
- 541,
- - 735,
- 194,
- 711,
- 300,
- - 268,
- - 863,
- 926,
- 769,
- - 708,
- - 428,
- 506,
- 174,
- - 892,
- - 630,
- 435,
- 547,
- - 1435,
- - 258,
- 621,
- 471,
- - 1018,
- - 1368,
- - 393,
- 521,
- - 920,
- - 686,
- - 25,
- 20,
- - 982,
- - 1156,
- 340,
- 9,
- - 1558,
- - 1135,
- - 352,
- 48,
- - 1579,
- - 402,
- - 887,
- 6,
- - 1156,
- - 888,
- - 548,
- - 352,
- - 1643,
- - 1168,
- - 159,
- 610,
- - 2024,
- - 963,
- - 225,
- 193,
- - 1656,
- - 1960,
- - 245,
- - 493,
- - 964,
- - 1680,
- - 936,
- - 635,
- - 1299,
- - 1744,
- - 1388,
- - 604,
- - 1540,
- - 835,
- - 1397,
- - 135,
- - 1588,
- - 290,
- - 1670,
- - 712,
- - 2011,
- - 1632,
- - 1663,
- - 27,
- - 2258,
- - 811,
- - 1157,
- 184,
- - 1265,
- 189,
- - 1367,
- 586,
- - 2011,
- 201,
- - 790,
- 712,
- - 1210,
- 3,
- - 1033,
- 808,
- - 1251,
- 830,
- - 111,
- 635,
- - 1636,
- 447,
- - 463,
- - 949,
- - 445,
- - 928,
- - 504,
- - 1162,
- - 501,
- - 1211,
- 144,
- - 351,
- - 372,
- - 1052,
- - 283,
- - 1059,
- - 279,
- - 1123,
- - 575,
- - 1438,
- - 587,
- - 1614,
- - 935,
- - 984,
- 229,
- 690,
- - 921,
- - 719,
- - 403,
- 1362,
- - 685,
- - 465,
- 874,
- 397,
- - 509,
- - 46,
- 317,
- 1334,
- - 485,
- 456,
- 813,
- 439,
- - 411,
- 339,
- 898,
- 1067,
- - 425,
- 46,
- 1441,
- 497,
- - 909,
- - 800,
- 1465,
- 1046,
- - 254,
- - 321,
- 1430,
- 1165,
- 68,
- 350,
- 1034,
- 666,
- 370,
- 11,
- 1311,
- 790,
- 143,
- 232,
- 1041,
- 1562,
- - 114,
- 663,
- 1616,
- 1078,
- 454,
- 579,
- 1275,
- 1040,
- - 76,
- 909,
- 752,
- 1067,
- 153,
- 512,
- 348,
- 1214,
- 614,
- 385,
- 1843,
- 808,
- 269,
- 1034,
- 203,
- 1086,
- 652,
- 1017,
- 1783,
- 1130,
- 429,
- 1327,
- 387,
- 1384,
- - 49,
- 1183,
- - 72,
- 1215,
- - 416,
- 1001,
- 544,
- 1749,
- - 352,
- 1223,
- - 502,
- 1199,
- - 589,
- 569,
- - 227,
- 1630,
- - 142,
- 1578,
- - 230,
- 1715,
- - 714,
- 1288,
- - 838,
- 1398,
- 1131,
- 1357,
- - 208,
- 1232,
- 437,
- 965,
- - 929,
- 818,
- 811,
- 1410,
- 859,
- 1507,
- 164,
- 1212,
- 1387,
- 1793,
- 484,
- 1874,
- 456,
- 2063,
- 996,
- 1170,
- 1326,
- 1402,
- 1316,
- 1360,
- 1135,
- 1262,
- 1234,
- 1618,
- 1361,
- 1768,
- 1421,
- 1227,
- 1584,
- 1347,
- 854,
- 672,
- 1685,
- 1566,
- 1139,
- 1270,
- 2016,
- 1825,
- 1773,
- 1581,
- 1532,
- 1460,
- 1487,
- 946,
- 1659,
- 1021,
- 1744,
- 1212,
- 1392,
- 977,
- 1772,
- 1161,
- 1826,
- 1164,
- 1718,
- 1429,
- 1973,
- 1591,
- 1185,
- 864,
- 2132,
- 1061,
- 1799,
- 814,
- 1838,
- 757,
- 2104,
- 1315,
- 2054,
- 1258,
- 2113,
- 915,
- 2331,
- 930,
- 1467,
- 1147,
- 2590,
- 1439,
- 2245,
- 1744,
- 2090,
- 1620,
- 2358,
- 1454,
- 2666,
- 1506,
- 1876,
- 1837,
- 2070,
- 1975,
- 1739,
- 1577,
- 682,
- 1289,
- 1584,
- 2045,
- 1454,
- 2098,
- 2498,
- 2004,
- 2711,
- 2066,
- 726,
- 1588,
- 2756,
- 2336,
- 228,
- 847,
- 2456,
- 1659,
- 36,
- 301,
- 1942,
- 1957,
- - 446,
- - 96,
- 2154,
- 1396,
- 1533,
- 1101,
- 14,
- 608,
- - 923,
- - 732,
- 1383,
- 1982,
- 1345,
- 952,
- - 680,
- 321,
- 1281,
- 1268,
- - 1594,
- 365,
- 941,
- 946,
- - 1737,
- - 822,
- 2374,
- 2787,
- 1821,
- 2788
+ - 1631,
+ - 1600,
+ - 1796,
+ - 2290,
+ - 1027,
+ - 1770,
+ - 1100,
+ - 2025,
+ - 1277,
+ - 1388,
+ - 1367,
+ - 1534,
+ - 947,
+ - 1461,
+ - 972,
+ - 1524,
+ - 999,
+ - 1222,
+ - 1020,
+ - 1172,
+ - 815,
+ - 987,
+ - 992,
+ - 1371,
+ - 1216,
+ - 1006,
+ - 1289,
+ - 1094,
+ - 744,
+ - 1268,
+ - 755,
+ - 1293,
+ - 862,
+ - 923,
+ - 905,
+ - 984,
+ - 678,
+ - 1051,
+ - 685,
+ - 1050,
+ - 1087,
+ - 985,
+ - 1062,
+ - 679,
+ - 989,
+ - 641,
+ - 1127,
+ - 976,
+ - 762,
+ - 654,
+ - 890,
+ - 806,
+ - 833,
+ - 1091,
+ - 706,
+ - 629,
+ - 621,
+ - 806,
+ - 640,
+ - 812,
+ - 775,
+ - 634,
+ - 779,
+ - 543,
+ - 996,
+ - 565,
+ - 1075,
+ - 580,
+ - 546,
+ - 611,
+ - 572,
+ - 619,
+ - 760,
+ - 290,
+ - 879,
+ - 526,
+ - 823,
+ - 462,
+ - 795,
+ - 253,
+ - 553,
+ - 415,
+ - 589,
+ - 439,
+ - 533,
+ - 340,
+ - 692,
+ - 935,
+ - 505,
+ - 772,
+ - 702,
+ - 1131,
+ - 263,
+ - 306,
+ - 971,
+ - 483,
+ - 445,
+ - 74,
+ - 555,
+ - 548,
+ - 614,
+ - 129,
+ - 693,
+ - 234,
+ - 396,
+ - 246,
+ - 475,
+ - 250,
+ - 265,
+ - 404,
+ - 376,
+ - 514,
+ - 417,
+ - 510,
+ - 300,
+ - 313,
+ - 334,
+ - 664,
+ - 463,
+ - 814,
+ - 386,
+ - 704,
+ - 337,
+ - 615,
+ - 234,
+ - 201,
+ - 233,
+ - 239,
+ - 167,
+ - 567,
+ - 203,
+ - 619,
+ - 147,
+ - 415,
+ - 115,
+ - 352,
+ - 166,
+ - 750,
+ - 171,
+ - 761,
+ - 270,
+ - 879,
+ - 264,
+ - 903,
+ - 367,
+ - 744,
+ 43,
+ - 475,
+ 14,
+ - 653,
+ 43,
+ - 670,
+ 11,
+ - 448,
+ - 59,
+ - 521,
+ - 126,
+ - 119,
+ - 155,
+ - 613,
+ - 42,
+ - 863,
+ - 27,
+ - 931,
+ 136,
+ - 483,
+ 183,
+ - 468,
+ 55,
+ - 298,
+ 55,
+ - 304,
+ 313,
+ - 609,
+ 313,
+ - 720,
+ 322,
+ - 167,
+ 100,
+ - 541,
+ - 3,
+ - 119,
+ - 111,
+ - 187,
+ 233,
+ - 236,
+ 260,
+ - 234,
+ 26,
+ - 165,
+ 134,
+ - 45,
+ - 40,
+ - 549,
+ 360,
+ - 203,
+ 378,
+ - 388,
+ 450,
+ - 383,
+ 275,
+ 20,
+ 182,
+ - 103,
+ 246,
+ - 111,
+ 431,
+ 37,
+ 462,
+ - 146,
+ 487,
+ - 157,
+ - 284,
+ - 59,
+ 503,
+ - 184,
+ 24,
+ 53,
+ - 3,
+ 54,
+ 122,
+ 259,
+ 333,
+ 66,
+ 484,
+ 104,
+ 436,
+ 68,
+ 195,
+ 116,
+ 190,
+ 206,
+ 269,
+ - 9,
+ 482,
+ 352,
+ 382,
+ 285,
+ 399,
+ 277,
+ 452,
+ 256,
+ 69,
+ 186,
+ 13,
+ 297,
+ - 13,
+ 259,
+ - 95,
+ 30,
+ 56,
+ 394,
+ 196,
+ 425,
+ 205,
+ 456,
+ 281,
+ 577,
+ 15,
+ 191,
+ 375,
+ 290,
+ 407,
+ 576,
+ - 56,
+ 227,
+ 544,
+ 405,
+ 0,
+ 549,
+ - 92,
+ 528,
+ - 229,
+ 351,
+ - 245,
+ 338,
+ - 362,
+ 435,
+ 167,
+ 527,
+ - 75,
+ 302,
+ 91,
+ 824,
+ 129,
+ 599,
+ 496,
+ 679,
+ 186,
+ 749,
+ 153,
+ 737,
+ - 281,
+ 600,
+ - 348,
+ 615,
+ - 236,
+ 769,
+ 41,
+ 881,
+ 38,
+ 890,
+ - 220,
+ 841,
+ - 357,
+ 883,
+ - 393,
+ 903,
+ - 634,
+ 474,
+ - 444,
+ 850,
+ - 175,
+ 678,
+ - 493,
+ 242,
+ - 519,
+ 785,
+ - 714,
+ 582,
+ - 541,
+ 366,
+ - 543,
+ 434,
+ - 597,
+ 500,
+ - 765,
+ 222,
+ - 702,
+ 917,
+ - 743,
+ 962,
+ - 869,
+ 501,
+ - 899,
+ 548,
+ - 379,
+ 200,
+ - 435,
+ 157,
+ - 819,
+ 214,
+ - 861,
+ 157,
+ - 614,
+ 40,
+ - 632,
+ 94,
+ - 883,
+ - 54,
+ - 741,
+ 516,
+ - 501,
+ 298,
+ - 614,
+ - 171,
+ - 870,
+ - 161,
+ - 865,
+ - 23,
+ - 818,
+ 93,
+ - 1015,
+ - 267,
+ - 662,
+ - 359,
+ - 549,
+ 2,
+ - 442,
+ - 121,
+ - 377,
+ 0,
+ - 227,
+ 33,
+ - 414,
+ - 126,
+ - 129,
+ 212,
+ - 934,
+ 34,
+ - 1082,
+ - 282,
+ - 1119,
+ - 268,
+ - 710,
+ - 825,
+ - 420,
+ - 191,
+ - 1076,
+ - 928,
+ - 917,
+ - 93,
+ - 628,
+ - 358,
+ 97,
+ 7,
+ - 206,
+ - 393,
+ - 101,
+ 24,
+ - 203,
+ 38,
+ - 168,
+ 83,
+ - 599,
+ - 423,
+ - 279,
+ 426,
+ - 700,
+ 118,
+ - 75,
+ 206,
+ - 981,
+ - 673,
+ - 680,
+ 417,
+ - 367,
+ 37,
+ - 279,
+ 474,
+ - 129,
+ - 318,
+ 319,
+ 296,
+ - 626,
+ - 39,
+ 343,
+ 602,
+ - 696,
+ - 39,
+ - 303,
+ 940,
+ 104,
+ 233,
+ - 380,
+ 137,
+ - 36,
+ 269,
+ - 75,
+ - 214,
+ 120,
+ 43,
+ - 529,
+ - 477,
+ 459,
+ 164,
+ - 202,
+ - 229,
+ - 49,
+ - 167,
+ 609,
+ 792,
+ 98,
+ - 220,
+ 915,
+ 148,
+ 293,
+ 283,
+ 869,
+ 91,
+ 575,
+ 394,
+ 326,
+ - 78,
+ 717,
+ 67,
+ 365,
+ - 323,
+ 616,
+ - 36,
+ 731,
+ 27,
+ 619,
+ 238,
+ 632,
+ 273,
+ 448,
+ 99,
+ 801,
+ 476,
+ 869,
+ 273,
+ 685,
+ 64,
+ 789,
+ 72,
+ 1021,
+ 217,
+ 793,
+ 459,
+ 734,
+ 360,
+ 646,
+ 480,
+ 360,
+ 322,
+ 429,
+ 464,
+ 638,
+ 430,
+ 756,
+ 363,
+ 1000,
+ 404,
+ 683,
+ 528,
+ 602,
+ 615,
+ 655,
+ 413,
+ 946,
+ 687,
+ 937,
+ 602,
+ 904,
+ 604,
+ 555,
+ 737,
+ 786,
+ 662,
+ 467,
+ 654,
+ 362,
+ 589,
+ 929,
+ 710,
+ 498,
+ 478,
+ 415,
+ 420,
+ 693,
+ 883,
+ 813,
+ 683,
+ 781,
+ 925,
+ 913,
+ 939,
+ 726,
+ 732,
+ 491,
+ 853,
+ 531,
+ 948,
+ 734,
+ 963,
+ 315,
+ 808,
+ 761,
+ 755,
+ 1144,
+ 760,
+ 655,
+ 1076,
+ 826,
+ 1057,
+ 1091,
+ 838,
+ 1003,
+ 808,
+ 1047,
+ 1133,
+ 659,
+ 1101,
+ 992,
+ 1050,
+ 1074,
+ 1075,
+ 971,
+ 694,
+ 1226,
+ 1054,
+ 571,
+ 841,
+ 884,
+ 1404,
+ 1379,
+ 1096,
+ 1080,
+ 861,
+ 1231,
+ 735,
+ 1284,
+ 760,
+ 1272,
+ 991,
+ 1367,
+ 1053,
+ 1257,
+ 700,
+ 1050,
+ 534,
+ 988,
+ 453,
+ 1264,
+ 599,
+ 1140,
+ 679,
+ 1621,
+ 815,
+ 1384,
+ 521,
+ 1317,
+ 393,
+ 1564,
+ 805,
+ 1448,
+ 686,
+ 1068,
+ 648,
+ 875,
+ 307,
+ 1083,
+ 361,
+ 1047,
+ 317,
+ 1417,
+ 964,
+ 675,
+ 571,
+ 1152,
+ 79,
+ 1114,
+ - 47,
+ 1530,
+ 311,
+ 1721,
+ 314,
+ 1166,
+ 689,
+ 514,
+ - 94,
+ 349,
+ 282,
+ 1412,
+ 328,
+ 1025,
+ 487,
+ - 65,
+ 57,
+ 805,
+ 970,
+ 36,
+ 62,
+ 769,
+ - 263,
+ 791,
+ - 346,
+ 637,
+ 699,
+ - 137,
+ 620,
+ 534,
+ 541,
+ - 735,
+ 194,
+ 711,
+ 300,
+ - 268,
+ - 863,
+ 926,
+ 769,
+ - 708,
+ - 428,
+ 506,
+ 174,
+ - 892,
+ - 630,
+ 435,
+ 547,
+ - 1435,
+ - 258,
+ 621,
+ 471,
+ - 1018,
+ - 1368,
+ - 393,
+ 521,
+ - 920,
+ - 686,
+ - 25,
+ 20,
+ - 982,
+ - 1156,
+ 340,
+ 9,
+ - 1558,
+ - 1135,
+ - 352,
+ 48,
+ - 1579,
+ - 402,
+ - 887,
+ 6,
+ - 1156,
+ - 888,
+ - 548,
+ - 352,
+ - 1643,
+ - 1168,
+ - 159,
+ 610,
+ - 2024,
+ - 963,
+ - 225,
+ 193,
+ - 1656,
+ - 1960,
+ - 245,
+ - 493,
+ - 964,
+ - 1680,
+ - 936,
+ - 635,
+ - 1299,
+ - 1744,
+ - 1388,
+ - 604,
+ - 1540,
+ - 835,
+ - 1397,
+ - 135,
+ - 1588,
+ - 290,
+ - 1670,
+ - 712,
+ - 2011,
+ - 1632,
+ - 1663,
+ - 27,
+ - 2258,
+ - 811,
+ - 1157,
+ 184,
+ - 1265,
+ 189,
+ - 1367,
+ 586,
+ - 2011,
+ 201,
+ - 790,
+ 712,
+ - 1210,
+ 3,
+ - 1033,
+ 808,
+ - 1251,
+ 830,
+ - 111,
+ 635,
+ - 1636,
+ 447,
+ - 463,
+ - 949,
+ - 445,
+ - 928,
+ - 504,
+ - 1162,
+ - 501,
+ - 1211,
+ 144,
+ - 351,
+ - 372,
+ - 1052,
+ - 283,
+ - 1059,
+ - 279,
+ - 1123,
+ - 575,
+ - 1438,
+ - 587,
+ - 1614,
+ - 935,
+ - 984,
+ 229,
+ 690,
+ - 921,
+ - 719,
+ - 403,
+ 1362,
+ - 685,
+ - 465,
+ 874,
+ 397,
+ - 509,
+ - 46,
+ 317,
+ 1334,
+ - 485,
+ 456,
+ 813,
+ 439,
+ - 411,
+ 339,
+ 898,
+ 1067,
+ - 425,
+ 46,
+ 1441,
+ 497,
+ - 909,
+ - 800,
+ 1465,
+ 1046,
+ - 254,
+ - 321,
+ 1430,
+ 1165,
+ 68,
+ 350,
+ 1034,
+ 666,
+ 370,
+ 11,
+ 1311,
+ 790,
+ 143,
+ 232,
+ 1041,
+ 1562,
+ - 114,
+ 663,
+ 1616,
+ 1078,
+ 454,
+ 579,
+ 1275,
+ 1040,
+ - 76,
+ 909,
+ 752,
+ 1067,
+ 153,
+ 512,
+ 348,
+ 1214,
+ 614,
+ 385,
+ 1843,
+ 808,
+ 269,
+ 1034,
+ 203,
+ 1086,
+ 652,
+ 1017,
+ 1783,
+ 1130,
+ 429,
+ 1327,
+ 387,
+ 1384,
+ - 49,
+ 1183,
+ - 72,
+ 1215,
+ - 416,
+ 1001,
+ 544,
+ 1749,
+ - 352,
+ 1223,
+ - 502,
+ 1199,
+ - 589,
+ 569,
+ - 227,
+ 1630,
+ - 142,
+ 1578,
+ - 230,
+ 1715,
+ - 714,
+ 1288,
+ - 838,
+ 1398,
+ 1131,
+ 1357,
+ - 208,
+ 1232,
+ 437,
+ 965,
+ - 929,
+ 818,
+ 811,
+ 1410,
+ 859,
+ 1507,
+ 164,
+ 1212,
+ 1387,
+ 1793,
+ 484,
+ 1874,
+ 456,
+ 2063,
+ 996,
+ 1170,
+ 1326,
+ 1402,
+ 1316,
+ 1360,
+ 1135,
+ 1262,
+ 1234,
+ 1618,
+ 1361,
+ 1768,
+ 1421,
+ 1227,
+ 1584,
+ 1347,
+ 854,
+ 672,
+ 1685,
+ 1566,
+ 1139,
+ 1270,
+ 2016,
+ 1825,
+ 1773,
+ 1581,
+ 1532,
+ 1460,
+ 1487,
+ 946,
+ 1659,
+ 1021,
+ 1744,
+ 1212,
+ 1392,
+ 977,
+ 1772,
+ 1161,
+ 1826,
+ 1164,
+ 1718,
+ 1429,
+ 1973,
+ 1591,
+ 1185,
+ 864,
+ 2132,
+ 1061,
+ 1799,
+ 814,
+ 1838,
+ 757,
+ 2104,
+ 1315,
+ 2054,
+ 1258,
+ 2113,
+ 915,
+ 2331,
+ 930,
+ 1467,
+ 1147,
+ 2590,
+ 1439,
+ 2245,
+ 1744,
+ 2090,
+ 1620,
+ 2358,
+ 1454,
+ 2666,
+ 1506,
+ 1876,
+ 1837,
+ 2070,
+ 1975,
+ 1739,
+ 1577,
+ 682,
+ 1289,
+ 1584,
+ 2045,
+ 1454,
+ 2098,
+ 2498,
+ 2004,
+ 2711,
+ 2066,
+ 726,
+ 1588,
+ 2756,
+ 2336,
+ 228,
+ 847,
+ 2456,
+ 1659,
+ 36,
+ 301,
+ 1942,
+ 1957,
+ - 446,
+ - 96,
+ 2154,
+ 1396,
+ 1533,
+ 1101,
+ 14,
+ 608,
+ - 923,
+ - 732,
+ 1383,
+ 1982,
+ 1345,
+ 952,
+ - 680,
+ 321,
+ 1281,
+ 1268,
+ - 1594,
+ 365,
+ 941,
+ 946,
+ - 1737,
+ - 822,
+ 2374,
+ 2787,
+ 1821,
+ 2788
};
/* 3rd LSF quantizer (MR122) */
static const Word32 dico3_lsf_5[DICO3_SIZE_5 * 4] =
{
- - 1812,
- - 2275,
- - 1879,
- - 2537,
- - 1640,
- - 1848,
- - 1695,
- - 2004,
- - 1220,
- - 1912,
- - 1221,
- - 2106,
- - 1559,
- - 1588,
- - 1573,
- - 1556,
- - 1195,
- - 1615,
- - 1224,
- - 1727,
- - 1359,
- - 1151,
- - 1616,
- - 1948,
- - 1274,
- - 1391,
- - 1305,
- - 1403,
- - 1607,
- - 1179,
- - 1676,
- - 1311,
- - 1443,
- - 1478,
- - 1367,
- - 898,
- - 1256,
- - 1059,
- - 1331,
- - 1134,
- - 982,
- - 1133,
- - 1149,
- - 1504,
- - 1080,
- - 1308,
- - 1020,
- - 1183,
- - 980,
- - 1486,
- - 967,
- - 1495,
- - 988,
- - 922,
- - 1047,
- - 1077,
- - 838,
- - 1179,
- - 858,
- - 1222,
- - 1131,
- - 1041,
- - 1064,
- - 767,
- - 872,
- - 1157,
- - 701,
- - 880,
- - 706,
- - 906,
- - 774,
- - 1016,
- - 578,
- - 1080,
- - 801,
- - 1478,
- - 591,
- - 1111,
- - 592,
- - 1146,
- - 713,
- - 1388,
- - 640,
- - 1376,
- - 597,
- - 1059,
- - 416,
- - 903,
- - 686,
- - 832,
- - 661,
- - 708,
- - 444,
- - 868,
- - 490,
- - 921,
- - 374,
- - 776,
- - 619,
- - 1170,
- - 585,
- - 549,
- - 769,
- - 795,
- - 435,
- - 659,
- - 530,
- - 741,
- - 498,
- - 837,
- - 357,
- - 597,
- - 279,
- - 871,
- - 243,
- - 887,
- - 282,
- - 665,
- - 280,
- - 667,
- - 165,
- - 560,
- - 394,
- - 903,
- - 362,
- - 410,
- - 448,
- - 583,
- - 409,
- - 574,
- - 313,
- - 357,
- - 637,
- - 548,
- - 570,
- - 436,
- - 896,
- - 504,
- - 382,
- - 757,
- - 58,
- - 481,
- - 165,
- - 618,
- - 191,
- - 374,
- - 234,
- - 382,
- - 222,
- - 683,
- - 25,
- - 480,
- - 418,
- - 359,
- - 730,
- - 353,
- - 324,
- - 157,
- - 432,
- - 322,
- - 394,
- - 303,
- - 284,
- - 104,
- - 601,
- - 289,
- - 556,
- - 196,
- - 588,
- - 150,
- - 659,
- - 608,
- - 473,
- - 24,
- - 68,
- - 448,
- - 474,
- - 8,
- - 506,
- - 45,
- - 748,
- - 184,
- - 844,
- - 252,
- - 901,
- - 91,
- - 584,
- - 97,
- - 652,
- 138,
- - 764,
- - 131,
- - 678,
- - 12,
- - 670,
- 165,
- - 259,
- - 3,
- - 840,
- - 107,
- - 909,
- 37,
- - 992,
- 44,
- - 854,
- - 415,
- - 839,
- 13,
- - 1001,
- - 271,
- - 1026,
- - 309,
- - 798,
- - 478,
- - 832,
- - 488,
- - 943,
- 168,
- - 1112,
- - 387,
- - 1185,
- - 101,
- - 1183,
- - 40,
- - 941,
- - 316,
- - 1030,
- - 770,
- - 1044,
- - 625,
- - 1081,
- - 538,
- - 1224,
- - 299,
- - 1312,
- - 436,
- - 1197,
- - 663,
- - 1167,
- - 161,
- - 1216,
- - 690,
- - 1237,
- - 831,
- - 1432,
- - 720,
- - 1403,
- - 493,
- - 898,
- - 740,
- - 922,
- - 801,
- - 1102,
- - 402,
- - 1579,
- - 964,
- - 1061,
- - 638,
- - 1269,
- - 1438,
- - 1499,
- - 934,
- - 1502,
- - 895,
- - 1598,
- - 564,
- - 1723,
- - 717,
- - 606,
- - 597,
- - 1166,
- - 1085,
- - 1369,
- - 468,
- - 1946,
- - 1493,
- - 1838,
- - 953,
- - 1932,
- - 931,
- - 1499,
- - 188,
- - 1635,
- - 421,
- - 1457,
- - 338,
- - 1448,
- - 22,
- - 1942,
- - 422,
- - 2006,
- - 249,
- - 496,
- - 114,
- - 1910,
- - 755,
- - 1289,
- 174,
- - 1451,
- - 109,
- - 482,
- - 257,
- - 1221,
- - 508,
- - 1617,
- 151,
- - 1694,
- 208,
- - 654,
- 107,
- - 1651,
- 29,
- - 1141,
- 279,
- - 1215,
- 306,
- - 1228,
- - 506,
- - 730,
- - 175,
- - 1236,
- - 101,
- - 969,
- 551,
- - 870,
- 278,
- - 823,
- 315,
- - 563,
- 376,
- - 1051,
- 228,
- - 507,
- 280,
- - 599,
- 281,
- - 758,
- 253,
- - 305,
- 379,
- - 755,
- - 134,
- - 611,
- 660,
- - 824,
- 536,
- - 817,
- 646,
- - 413,
- 49,
- - 341,
- 177,
- - 453,
- 526,
- - 482,
- 589,
- - 71,
- 339,
- - 657,
- 264,
- - 244,
- 295,
- - 237,
- 315,
- - 387,
- 569,
- - 506,
- - 9,
- - 377,
- 14,
- - 160,
- 661,
- - 216,
- 40,
- - 308,
- - 46,
- 95,
- 214,
- - 242,
- 167,
- - 86,
- 192,
- - 56,
- 27,
- - 76,
- 31,
- 36,
- 309,
- - 106,
- - 182,
- - 113,
- 74,
- - 441,
- - 22,
- 23,
- 139,
- 81,
- - 11,
- 44,
- 15,
- - 87,
- - 137,
- - 118,
- - 207,
- - 158,
- - 58,
- 272,
- - 92,
- - 156,
- - 441,
- 8,
- - 136,
- 128,
- - 221,
- 101,
- - 218,
- 40,
- - 197,
- - 76,
- - 456,
- 9,
- - 445,
- 33,
- - 423,
- 226,
- 60,
- 73,
- - 222,
- 156,
- - 399,
- 280,
- - 318,
- 245,
- - 341,
- 166,
- - 499,
- 339,
- - 190,
- 327,
- - 219,
- 325,
- - 137,
- - 89,
- - 596,
- 100,
- - 627,
- 144,
- - 677,
- 487,
- 28,
- 252,
- - 391,
- 214,
- - 41,
- 282,
- - 28,
- 99,
- - 286,
- 331,
- 49,
- 459,
- - 388,
- 565,
- - 369,
- 436,
- 28,
- 336,
- - 9,
- 397,
- - 167,
- 618,
- 34,
- 596,
- - 17,
- 561,
- - 140,
- 299,
- 79,
- 522,
- 125,
- 203,
- 2,
- 244,
- 288,
- 255,
- 211,
- 175,
- 82,
- 596,
- 187,
- 517,
- 108,
- 381,
- 255,
- 365,
- 297,
- 497,
- 352,
- 327,
- - 82,
- 25,
- 210,
- 371,
- 245,
- 261,
- 3,
- 545,
- 449,
- 140,
- 294,
- 44,
- 295,
- 212,
- 347,
- 244,
- 494,
- 331,
- 528,
- 201,
- 307,
- 349,
- 411,
- 613,
- 284,
- 614,
- 413,
- 464,
- 322,
- 624,
- 397,
- 97,
- 200,
- - 160,
- 384,
- 149,
- 362,
- 495,
- 525,
- 269,
- 585,
- 33,
- 491,
- - 121,
- 433,
- 427,
- 611,
- 498,
- 516,
- 171,
- 443,
- 497,
- 666,
- 440,
- 275,
- 566,
- 575,
- 146,
- 639,
- 155,
- 670,
- - 33,
- 173,
- 212,
- 696,
- - 166,
- 601,
- - 191,
- 695,
- - 489,
- 503,
- 175,
- 742,
- 214,
- 476,
- 372,
- 1083,
- 578,
- 530,
- 586,
- 777,
- 425,
- 874,
- 315,
- 841,
- 374,
- 848,
- - 165,
- 565,
- 35,
- 991,
- - 39,
- 1062,
- 329,
- 712,
- 786,
- 840,
- 645,
- 795,
- 661,
- 676,
- 571,
- 918,
- 632,
- 1079,
- 673,
- 817,
- 318,
- 388,
- 874,
- 1012,
- 564,
- 848,
- 880,
- 620,
- 557,
- 479,
- 671,
- 453,
- 692,
- 468,
- 840,
- 642,
- 844,
- 645,
- 506,
- 428,
- 897,
- 567,
- 837,
- 387,
- 962,
- 499,
- 691,
- 561,
- 939,
- 926,
- 783,
- 296,
- 790,
- 268,
- 1028,
- 530,
- 874,
- 329,
- 548,
- 143,
- 675,
- 291,
- 503,
- 66,
- 1041,
- 359,
- 786,
- 97,
- 805,
- 33,
- 837,
- 470,
- 511,
- 49,
- 1092,
- 327,
- 1174,
- 323,
- 3,
- 242,
- 872,
- 474,
- 689,
- 429,
- 1329,
- 678,
- 1042,
- 620,
- 1109,
- 664,
- 321,
- 193,
- 889,
- 950,
- 1153,
- 874,
- 893,
- 635,
- 877,
- 862,
- 948,
- 913,
- 1293,
- 665,
- 1320,
- 639,
- 997,
- 793,
- 1402,
- 1030,
- 1176,
- 1012,
- 1110,
- 959,
- 1410,
- 925,
- 1403,
- 915,
- 543,
- 862,
- 1116,
- 1222,
- 835,
- 1190,
- 835,
- 1190,
- 959,
- 1148,
- 1147,
- 1376,
- 1300,
- 1193,
- 1415,
- 1231,
- 1335,
- 1341,
- 746,
- 1092,
- 1711,
- 1283,
- 1389,
- 1073,
- 1334,
- 1566,
- 1153,
- 1475,
- 1645,
- 1137,
- 1825,
- 1220,
- 1056,
- 1382,
- 1521,
- 1730,
- 1632,
- 1545,
- 1620,
- 1542,
- 855,
- 1596,
- 865,
- 1667,
- 693,
- 885,
- 1716,
- 1519,
- 1167,
- 1296,
- 2209,
- 1760,
- 1952,
- 1493,
- 2020,
- 1482,
- 1534,
- 1866,
- 1694,
- 2008,
- 1566,
- 748,
- 1761,
- 825,
- 294,
- 1392,
- 1084,
- 2058,
- 621,
- 1315,
- 365,
- 1287,
- 198,
- 1028,
- 488,
- 1408,
- 249,
- 403,
- 1014,
- 1561,
- 324,
- 363,
- 1645,
- 1044,
- 193,
- 367,
- 2034,
- 1859,
- - 251,
- 579,
- 750,
- 994,
- - 243,
- 30,
- 1325,
- 879,
- - 28,
- - 169,
- 624,
- 917,
- - 453,
- 159,
- 186,
- 1370,
- - 614,
- 6,
- 537,
- 392,
- - 94,
- - 291,
- 781,
- 229,
- - 128,
- - 298,
- 245,
- 491,
- - 701,
- - 648,
- 972,
- 789,
- - 501,
- - 640,
- 178,
- 255,
- - 365,
- - 390,
- - 255,
- 317,
- - 958,
- - 294,
- - 191,
- 228,
- - 775,
- - 447,
- 157,
- - 237,
- - 657,
- - 720,
- - 407,
- 92,
- - 117,
- - 611,
- 334,
- - 230,
- - 679,
- - 1084,
- - 144,
- - 317,
- - 901,
- - 861,
- - 738,
- - 360,
- - 85,
- - 727,
- - 90,
- - 787,
- 100,
- - 22,
- - 391,
- - 263,
- - 56,
- - 73,
- - 337,
- - 754,
- 5,
- - 189,
- - 706,
- - 624,
- 89,
- - 344,
- - 135,
- - 1113,
- - 353,
- - 237,
- - 684,
- - 1135,
- - 275,
- - 1102,
- - 269,
- - 1203,
- 152,
- 145,
- - 722,
- - 1232,
- 49,
- 80,
- - 1248,
- - 776,
- - 248,
- 391,
- - 732,
- - 547,
- 469,
- 218,
- - 255,
- - 864,
- 69,
- 366,
- - 166,
- - 485,
- - 688,
- 191,
- - 1212,
- - 1196,
- - 170,
- - 169,
- - 1308,
- - 1631,
- 321,
- 470,
- - 1419,
- - 1243,
- - 64,
- 272,
- - 1361,
- - 248,
- 492,
- 565,
- - 721,
- - 609,
- 195,
- 485,
- - 573,
- - 133,
- 427,
- 202,
- - 171,
- - 118,
- 199,
- 575,
- 2,
- - 31,
- 694,
- 755,
- - 1366,
- - 39,
- 552,
- 557,
- - 489,
- 271,
- 680,
- 537,
- 13,
- - 453,
- 855,
- 954,
- - 133,
- - 52,
- - 81,
- 738,
- - 1169,
- 637,
- 1055,
- 1059,
- - 95,
- 676,
- 1259,
- 1081,
- 489,
- 305,
- - 449,
- 954,
- - 534,
- 996,
- - 969,
- 866,
- - 1058,
- 1059,
- - 1294,
- 618,
- - 1416,
- 617,
- - 458,
- 1366,
- - 159,
- 1821,
- - 774,
- - 528,
- - 14,
- 1110,
- - 1202,
- - 901,
- - 772,
- 433,
- - 1256,
- - 1255,
- - 1011,
- - 302,
- - 602,
- - 585,
- - 759,
- - 1618,
- - 760,
- - 1549,
- - 840,
- - 1921,
- - 816,
- - 539,
- - 1769,
- - 2235,
- - 227,
- - 36,
- - 2034,
- - 1831,
- - 2107,
- - 1126,
- - 2471,
- - 1816,
- - 1470,
- 252,
- - 2701,
- - 415,
- - 571,
- - 467,
- 1509,
- 1554,
- 2180,
- 1975,
- 2326,
- 2020
+ - 1812,
+ - 2275,
+ - 1879,
+ - 2537,
+ - 1640,
+ - 1848,
+ - 1695,
+ - 2004,
+ - 1220,
+ - 1912,
+ - 1221,
+ - 2106,
+ - 1559,
+ - 1588,
+ - 1573,
+ - 1556,
+ - 1195,
+ - 1615,
+ - 1224,
+ - 1727,
+ - 1359,
+ - 1151,
+ - 1616,
+ - 1948,
+ - 1274,
+ - 1391,
+ - 1305,
+ - 1403,
+ - 1607,
+ - 1179,
+ - 1676,
+ - 1311,
+ - 1443,
+ - 1478,
+ - 1367,
+ - 898,
+ - 1256,
+ - 1059,
+ - 1331,
+ - 1134,
+ - 982,
+ - 1133,
+ - 1149,
+ - 1504,
+ - 1080,
+ - 1308,
+ - 1020,
+ - 1183,
+ - 980,
+ - 1486,
+ - 967,
+ - 1495,
+ - 988,
+ - 922,
+ - 1047,
+ - 1077,
+ - 838,
+ - 1179,
+ - 858,
+ - 1222,
+ - 1131,
+ - 1041,
+ - 1064,
+ - 767,
+ - 872,
+ - 1157,
+ - 701,
+ - 880,
+ - 706,
+ - 906,
+ - 774,
+ - 1016,
+ - 578,
+ - 1080,
+ - 801,
+ - 1478,
+ - 591,
+ - 1111,
+ - 592,
+ - 1146,
+ - 713,
+ - 1388,
+ - 640,
+ - 1376,
+ - 597,
+ - 1059,
+ - 416,
+ - 903,
+ - 686,
+ - 832,
+ - 661,
+ - 708,
+ - 444,
+ - 868,
+ - 490,
+ - 921,
+ - 374,
+ - 776,
+ - 619,
+ - 1170,
+ - 585,
+ - 549,
+ - 769,
+ - 795,
+ - 435,
+ - 659,
+ - 530,
+ - 741,
+ - 498,
+ - 837,
+ - 357,
+ - 597,
+ - 279,
+ - 871,
+ - 243,
+ - 887,
+ - 282,
+ - 665,
+ - 280,
+ - 667,
+ - 165,
+ - 560,
+ - 394,
+ - 903,
+ - 362,
+ - 410,
+ - 448,
+ - 583,
+ - 409,
+ - 574,
+ - 313,
+ - 357,
+ - 637,
+ - 548,
+ - 570,
+ - 436,
+ - 896,
+ - 504,
+ - 382,
+ - 757,
+ - 58,
+ - 481,
+ - 165,
+ - 618,
+ - 191,
+ - 374,
+ - 234,
+ - 382,
+ - 222,
+ - 683,
+ - 25,
+ - 480,
+ - 418,
+ - 359,
+ - 730,
+ - 353,
+ - 324,
+ - 157,
+ - 432,
+ - 322,
+ - 394,
+ - 303,
+ - 284,
+ - 104,
+ - 601,
+ - 289,
+ - 556,
+ - 196,
+ - 588,
+ - 150,
+ - 659,
+ - 608,
+ - 473,
+ - 24,
+ - 68,
+ - 448,
+ - 474,
+ - 8,
+ - 506,
+ - 45,
+ - 748,
+ - 184,
+ - 844,
+ - 252,
+ - 901,
+ - 91,
+ - 584,
+ - 97,
+ - 652,
+ 138,
+ - 764,
+ - 131,
+ - 678,
+ - 12,
+ - 670,
+ 165,
+ - 259,
+ - 3,
+ - 840,
+ - 107,
+ - 909,
+ 37,
+ - 992,
+ 44,
+ - 854,
+ - 415,
+ - 839,
+ 13,
+ - 1001,
+ - 271,
+ - 1026,
+ - 309,
+ - 798,
+ - 478,
+ - 832,
+ - 488,
+ - 943,
+ 168,
+ - 1112,
+ - 387,
+ - 1185,
+ - 101,
+ - 1183,
+ - 40,
+ - 941,
+ - 316,
+ - 1030,
+ - 770,
+ - 1044,
+ - 625,
+ - 1081,
+ - 538,
+ - 1224,
+ - 299,
+ - 1312,
+ - 436,
+ - 1197,
+ - 663,
+ - 1167,
+ - 161,
+ - 1216,
+ - 690,
+ - 1237,
+ - 831,
+ - 1432,
+ - 720,
+ - 1403,
+ - 493,
+ - 898,
+ - 740,
+ - 922,
+ - 801,
+ - 1102,
+ - 402,
+ - 1579,
+ - 964,
+ - 1061,
+ - 638,
+ - 1269,
+ - 1438,
+ - 1499,
+ - 934,
+ - 1502,
+ - 895,
+ - 1598,
+ - 564,
+ - 1723,
+ - 717,
+ - 606,
+ - 597,
+ - 1166,
+ - 1085,
+ - 1369,
+ - 468,
+ - 1946,
+ - 1493,
+ - 1838,
+ - 953,
+ - 1932,
+ - 931,
+ - 1499,
+ - 188,
+ - 1635,
+ - 421,
+ - 1457,
+ - 338,
+ - 1448,
+ - 22,
+ - 1942,
+ - 422,
+ - 2006,
+ - 249,
+ - 496,
+ - 114,
+ - 1910,
+ - 755,
+ - 1289,
+ 174,
+ - 1451,
+ - 109,
+ - 482,
+ - 257,
+ - 1221,
+ - 508,
+ - 1617,
+ 151,
+ - 1694,
+ 208,
+ - 654,
+ 107,
+ - 1651,
+ 29,
+ - 1141,
+ 279,
+ - 1215,
+ 306,
+ - 1228,
+ - 506,
+ - 730,
+ - 175,
+ - 1236,
+ - 101,
+ - 969,
+ 551,
+ - 870,
+ 278,
+ - 823,
+ 315,
+ - 563,
+ 376,
+ - 1051,
+ 228,
+ - 507,
+ 280,
+ - 599,
+ 281,
+ - 758,
+ 253,
+ - 305,
+ 379,
+ - 755,
+ - 134,
+ - 611,
+ 660,
+ - 824,
+ 536,
+ - 817,
+ 646,
+ - 413,
+ 49,
+ - 341,
+ 177,
+ - 453,
+ 526,
+ - 482,
+ 589,
+ - 71,
+ 339,
+ - 657,
+ 264,
+ - 244,
+ 295,
+ - 237,
+ 315,
+ - 387,
+ 569,
+ - 506,
+ - 9,
+ - 377,
+ 14,
+ - 160,
+ 661,
+ - 216,
+ 40,
+ - 308,
+ - 46,
+ 95,
+ 214,
+ - 242,
+ 167,
+ - 86,
+ 192,
+ - 56,
+ 27,
+ - 76,
+ 31,
+ 36,
+ 309,
+ - 106,
+ - 182,
+ - 113,
+ 74,
+ - 441,
+ - 22,
+ 23,
+ 139,
+ 81,
+ - 11,
+ 44,
+ 15,
+ - 87,
+ - 137,
+ - 118,
+ - 207,
+ - 158,
+ - 58,
+ 272,
+ - 92,
+ - 156,
+ - 441,
+ 8,
+ - 136,
+ 128,
+ - 221,
+ 101,
+ - 218,
+ 40,
+ - 197,
+ - 76,
+ - 456,
+ 9,
+ - 445,
+ 33,
+ - 423,
+ 226,
+ 60,
+ 73,
+ - 222,
+ 156,
+ - 399,
+ 280,
+ - 318,
+ 245,
+ - 341,
+ 166,
+ - 499,
+ 339,
+ - 190,
+ 327,
+ - 219,
+ 325,
+ - 137,
+ - 89,
+ - 596,
+ 100,
+ - 627,
+ 144,
+ - 677,
+ 487,
+ 28,
+ 252,
+ - 391,
+ 214,
+ - 41,
+ 282,
+ - 28,
+ 99,
+ - 286,
+ 331,
+ 49,
+ 459,
+ - 388,
+ 565,
+ - 369,
+ 436,
+ 28,
+ 336,
+ - 9,
+ 397,
+ - 167,
+ 618,
+ 34,
+ 596,
+ - 17,
+ 561,
+ - 140,
+ 299,
+ 79,
+ 522,
+ 125,
+ 203,
+ 2,
+ 244,
+ 288,
+ 255,
+ 211,
+ 175,
+ 82,
+ 596,
+ 187,
+ 517,
+ 108,
+ 381,
+ 255,
+ 365,
+ 297,
+ 497,
+ 352,
+ 327,
+ - 82,
+ 25,
+ 210,
+ 371,
+ 245,
+ 261,
+ 3,
+ 545,
+ 449,
+ 140,
+ 294,
+ 44,
+ 295,
+ 212,
+ 347,
+ 244,
+ 494,
+ 331,
+ 528,
+ 201,
+ 307,
+ 349,
+ 411,
+ 613,
+ 284,
+ 614,
+ 413,
+ 464,
+ 322,
+ 624,
+ 397,
+ 97,
+ 200,
+ - 160,
+ 384,
+ 149,
+ 362,
+ 495,
+ 525,
+ 269,
+ 585,
+ 33,
+ 491,
+ - 121,
+ 433,
+ 427,
+ 611,
+ 498,
+ 516,
+ 171,
+ 443,
+ 497,
+ 666,
+ 440,
+ 275,
+ 566,
+ 575,
+ 146,
+ 639,
+ 155,
+ 670,
+ - 33,
+ 173,
+ 212,
+ 696,
+ - 166,
+ 601,
+ - 191,
+ 695,
+ - 489,
+ 503,
+ 175,
+ 742,
+ 214,
+ 476,
+ 372,
+ 1083,
+ 578,
+ 530,
+ 586,
+ 777,
+ 425,
+ 874,
+ 315,
+ 841,
+ 374,
+ 848,
+ - 165,
+ 565,
+ 35,
+ 991,
+ - 39,
+ 1062,
+ 329,
+ 712,
+ 786,
+ 840,
+ 645,
+ 795,
+ 661,
+ 676,
+ 571,
+ 918,
+ 632,
+ 1079,
+ 673,
+ 817,
+ 318,
+ 388,
+ 874,
+ 1012,
+ 564,
+ 848,
+ 880,
+ 620,
+ 557,
+ 479,
+ 671,
+ 453,
+ 692,
+ 468,
+ 840,
+ 642,
+ 844,
+ 645,
+ 506,
+ 428,
+ 897,
+ 567,
+ 837,
+ 387,
+ 962,
+ 499,
+ 691,
+ 561,
+ 939,
+ 926,
+ 783,
+ 296,
+ 790,
+ 268,
+ 1028,
+ 530,
+ 874,
+ 329,
+ 548,
+ 143,
+ 675,
+ 291,
+ 503,
+ 66,
+ 1041,
+ 359,
+ 786,
+ 97,
+ 805,
+ 33,
+ 837,
+ 470,
+ 511,
+ 49,
+ 1092,
+ 327,
+ 1174,
+ 323,
+ 3,
+ 242,
+ 872,
+ 474,
+ 689,
+ 429,
+ 1329,
+ 678,
+ 1042,
+ 620,
+ 1109,
+ 664,
+ 321,
+ 193,
+ 889,
+ 950,
+ 1153,
+ 874,
+ 893,
+ 635,
+ 877,
+ 862,
+ 948,
+ 913,
+ 1293,
+ 665,
+ 1320,
+ 639,
+ 997,
+ 793,
+ 1402,
+ 1030,
+ 1176,
+ 1012,
+ 1110,
+ 959,
+ 1410,
+ 925,
+ 1403,
+ 915,
+ 543,
+ 862,
+ 1116,
+ 1222,
+ 835,
+ 1190,
+ 835,
+ 1190,
+ 959,
+ 1148,
+ 1147,
+ 1376,
+ 1300,
+ 1193,
+ 1415,
+ 1231,
+ 1335,
+ 1341,
+ 746,
+ 1092,
+ 1711,
+ 1283,
+ 1389,
+ 1073,
+ 1334,
+ 1566,
+ 1153,
+ 1475,
+ 1645,
+ 1137,
+ 1825,
+ 1220,
+ 1056,
+ 1382,
+ 1521,
+ 1730,
+ 1632,
+ 1545,
+ 1620,
+ 1542,
+ 855,
+ 1596,
+ 865,
+ 1667,
+ 693,
+ 885,
+ 1716,
+ 1519,
+ 1167,
+ 1296,
+ 2209,
+ 1760,
+ 1952,
+ 1493,
+ 2020,
+ 1482,
+ 1534,
+ 1866,
+ 1694,
+ 2008,
+ 1566,
+ 748,
+ 1761,
+ 825,
+ 294,
+ 1392,
+ 1084,
+ 2058,
+ 621,
+ 1315,
+ 365,
+ 1287,
+ 198,
+ 1028,
+ 488,
+ 1408,
+ 249,
+ 403,
+ 1014,
+ 1561,
+ 324,
+ 363,
+ 1645,
+ 1044,
+ 193,
+ 367,
+ 2034,
+ 1859,
+ - 251,
+ 579,
+ 750,
+ 994,
+ - 243,
+ 30,
+ 1325,
+ 879,
+ - 28,
+ - 169,
+ 624,
+ 917,
+ - 453,
+ 159,
+ 186,
+ 1370,
+ - 614,
+ 6,
+ 537,
+ 392,
+ - 94,
+ - 291,
+ 781,
+ 229,
+ - 128,
+ - 298,
+ 245,
+ 491,
+ - 701,
+ - 648,
+ 972,
+ 789,
+ - 501,
+ - 640,
+ 178,
+ 255,
+ - 365,
+ - 390,
+ - 255,
+ 317,
+ - 958,
+ - 294,
+ - 191,
+ 228,
+ - 775,
+ - 447,
+ 157,
+ - 237,
+ - 657,
+ - 720,
+ - 407,
+ 92,
+ - 117,
+ - 611,
+ 334,
+ - 230,
+ - 679,
+ - 1084,
+ - 144,
+ - 317,
+ - 901,
+ - 861,
+ - 738,
+ - 360,
+ - 85,
+ - 727,
+ - 90,
+ - 787,
+ 100,
+ - 22,
+ - 391,
+ - 263,
+ - 56,
+ - 73,
+ - 337,
+ - 754,
+ 5,
+ - 189,
+ - 706,
+ - 624,
+ 89,
+ - 344,
+ - 135,
+ - 1113,
+ - 353,
+ - 237,
+ - 684,
+ - 1135,
+ - 275,
+ - 1102,
+ - 269,
+ - 1203,
+ 152,
+ 145,
+ - 722,
+ - 1232,
+ 49,
+ 80,
+ - 1248,
+ - 776,
+ - 248,
+ 391,
+ - 732,
+ - 547,
+ 469,
+ 218,
+ - 255,
+ - 864,
+ 69,
+ 366,
+ - 166,
+ - 485,
+ - 688,
+ 191,
+ - 1212,
+ - 1196,
+ - 170,
+ - 169,
+ - 1308,
+ - 1631,
+ 321,
+ 470,
+ - 1419,
+ - 1243,
+ - 64,
+ 272,
+ - 1361,
+ - 248,
+ 492,
+ 565,
+ - 721,
+ - 609,
+ 195,
+ 485,
+ - 573,
+ - 133,
+ 427,
+ 202,
+ - 171,
+ - 118,
+ 199,
+ 575,
+ 2,
+ - 31,
+ 694,
+ 755,
+ - 1366,
+ - 39,
+ 552,
+ 557,
+ - 489,
+ 271,
+ 680,
+ 537,
+ 13,
+ - 453,
+ 855,
+ 954,
+ - 133,
+ - 52,
+ - 81,
+ 738,
+ - 1169,
+ 637,
+ 1055,
+ 1059,
+ - 95,
+ 676,
+ 1259,
+ 1081,
+ 489,
+ 305,
+ - 449,
+ 954,
+ - 534,
+ 996,
+ - 969,
+ 866,
+ - 1058,
+ 1059,
+ - 1294,
+ 618,
+ - 1416,
+ 617,
+ - 458,
+ 1366,
+ - 159,
+ 1821,
+ - 774,
+ - 528,
+ - 14,
+ 1110,
+ - 1202,
+ - 901,
+ - 772,
+ 433,
+ - 1256,
+ - 1255,
+ - 1011,
+ - 302,
+ - 602,
+ - 585,
+ - 759,
+ - 1618,
+ - 760,
+ - 1549,
+ - 840,
+ - 1921,
+ - 816,
+ - 539,
+ - 1769,
+ - 2235,
+ - 227,
+ - 36,
+ - 2034,
+ - 1831,
+ - 2107,
+ - 1126,
+ - 2471,
+ - 1816,
+ - 1470,
+ 252,
+ - 2701,
+ - 415,
+ - 571,
+ - 467,
+ 1509,
+ 1554,
+ 2180,
+ 1975,
+ 2326,
+ 2020
};
/* 4th LSF quantizer (MR122) */
static const Word32 dico4_lsf_5[DICO4_SIZE_5 * 4] =
{
- - 1857,
- - 1681,
- - 1857,
- - 1755,
- - 2056,
- - 1150,
- - 2134,
- - 1654,
- - 1619,
- - 1099,
- - 1704,
- - 1131,
- - 1345,
- - 1608,
- - 1359,
- - 1638,
- - 1338,
- - 1293,
- - 1325,
- - 1265,
- - 1664,
- - 1649,
- - 1487,
- - 851,
- - 1346,
- - 1832,
- - 1413,
- - 2188,
- - 1282,
- - 681,
- - 1785,
- - 1649,
- - 966,
- - 1082,
- - 1183,
- - 1676,
- - 1054,
- - 1073,
- - 1142,
- - 1158,
- - 1207,
- - 744,
- - 1274,
- - 997,
- - 934,
- - 1383,
- - 927,
- - 1416,
- - 1010,
- - 1305,
- - 783,
- - 955,
- - 1049,
- - 900,
- - 993,
- - 817,
- - 737,
- - 823,
- - 972,
- - 1189,
- - 738,
- - 1094,
- - 738,
- - 1154,
- - 784,
- - 801,
- - 810,
- - 786,
- - 892,
- - 520,
- - 1000,
- - 818,
- - 644,
- - 965,
- - 577,
- - 882,
- - 541,
- - 694,
- - 671,
- - 917,
- - 595,
- - 642,
- - 646,
- - 615,
- - 956,
- - 621,
- - 925,
- - 515,
- - 727,
- - 483,
- - 815,
- - 485,
- - 840,
- - 578,
- - 440,
- - 713,
- - 578,
- - 325,
- - 657,
- - 670,
- - 386,
- - 570,
- - 441,
- - 666,
- - 514,
- - 787,
- - 392,
- - 529,
- - 522,
- - 453,
- - 487,
- - 423,
- - 616,
- - 585,
- - 617,
- - 157,
- - 662,
- - 268,
- - 680,
- - 348,
- - 322,
- - 323,
- - 632,
- - 444,
- - 304,
- - 430,
- - 332,
- - 458,
- - 277,
- - 468,
- - 659,
- - 793,
- - 319,
- - 636,
- - 227,
- - 554,
- - 373,
- - 347,
- - 334,
- - 210,
- - 456,
- - 192,
- - 530,
- - 242,
- - 216,
- - 198,
- - 366,
- - 370,
- - 338,
- - 161,
- - 409,
- - 748,
- - 107,
- - 380,
- - 294,
- - 643,
- - 223,
- - 665,
- - 234,
- - 741,
- - 141,
- - 496,
- - 130,
- - 510,
- - 139,
- - 327,
- - 172,
- - 305,
- - 306,
- - 580,
- - 164,
- - 263,
- - 262,
- - 172,
- - 67,
- - 402,
- 31,
- - 366,
- - 10,
- - 436,
- - 86,
- - 527,
- 71,
- - 377,
- - 22,
- - 609,
- - 12,
- - 678,
- - 67,
- - 319,
- 63,
- - 191,
- 35,
- - 181,
- - 39,
- - 242,
- 126,
- - 167,
- - 140,
- - 544,
- 155,
- - 297,
- 174,
- - 297,
- 38,
- - 8,
- 117,
- - 380,
- 197,
- - 452,
- 240,
- - 522,
- 223,
- - 103,
- 110,
- - 187,
- 87,
- - 155,
- 169,
- - 47,
- 157,
- 26,
- - 83,
- - 100,
- 128,
- 80,
- 209,
- - 62,
- 6,
- 7,
- 22,
- 5,
- 318,
- - 20,
- 248,
- - 45,
- - 200,
- - 63,
- 156,
- - 69,
- 250,
- - 183,
- 369,
- - 126,
- - 113,
- - 76,
- - 142,
- - 122,
- - 64,
- - 254,
- - 31,
- 35,
- - 177,
- - 71,
- - 7,
- 171,
- 93,
- 27,
- 108,
- 212,
- - 330,
- - 209,
- - 123,
- - 70,
- - 279,
- 95,
- - 96,
- 20,
- - 188,
- - 61,
- - 314,
- 87,
- - 300,
- - 78,
- - 354,
- - 134,
- 11,
- 122,
- - 140,
- 122,
- - 275,
- 152,
- - 293,
- 140,
- - 82,
- 138,
- - 321,
- - 111,
- - 480,
- - 156,
- - 359,
- 76,
- - 254,
- - 40,
- - 635,
- - 96,
- - 522,
- 79,
- - 507,
- 8,
- - 268,
- 303,
- - 539,
- 68,
- - 446,
- 61,
- - 522,
- 306,
- 111,
- 189,
- - 435,
- 122,
- - 379,
- 166,
- - 571,
- - 398,
- - 632,
- - 74,
- - 747,
- - 95,
- - 455,
- 194,
- - 952,
- 83,
- - 798,
- 192,
- - 755,
- 192,
- - 781,
- - 162,
- - 619,
- 234,
- - 663,
- - 297,
- - 488,
- - 109,
- - 964,
- - 132,
- - 838,
- - 68,
- - 843,
- 58,
- - 1112,
- - 86,
- - 805,
- - 299,
- - 944,
- - 253,
- - 778,
- - 50,
- - 965,
- - 549,
- - 352,
- - 98,
- - 992,
- - 343,
- - 1117,
- - 315,
- - 1117,
- - 307,
- - 1155,
- - 374,
- - 637,
- - 230,
- - 1166,
- - 43,
- - 1299,
- - 100,
- - 925,
- - 393,
- - 1274,
- - 600,
- - 689,
- - 130,
- - 1479,
- - 312,
- - 1321,
- - 254,
- - 1464,
- - 442,
- - 1292,
- - 613,
- - 1261,
- - 503,
- - 1501,
- - 368,
- - 1322,
- 26,
- - 1432,
- - 66,
- - 1743,
- - 161,
- - 1644,
- - 467,
- - 1760,
- - 548,
- - 1393,
- - 568,
- - 1556,
- - 871,
- - 1495,
- - 1034,
- - 1387,
- - 571,
- - 1917,
- - 528,
- - 1783,
- - 123,
- - 1897,
- - 231,
- - 2054,
- - 323,
- - 2052,
- - 906,
- - 1976,
- - 567,
- - 1917,
- - 620,
- - 2047,
- - 989,
- - 1077,
- - 370,
- - 2031,
- - 704,
- - 2355,
- - 749,
- - 2740,
- - 1089,
- - 1909,
- 159,
- - 2012,
- 248,
- - 626,
- - 123,
- - 2339,
- - 962,
- - 669,
- - 408,
- - 1379,
- - 1174,
- - 452,
- - 364,
- - 1044,
- - 735,
- - 132,
- 183,
- - 1620,
- - 752,
- - 547,
- - 307,
- - 777,
- - 1261,
- - 98,
- 41,
- - 880,
- - 1091,
- - 257,
- 97,
- - 1602,
- - 1833,
- 31,
- - 26,
- - 644,
- - 561,
- - 180,
- - 546,
- - 385,
- - 1095,
- - 410,
- - 802,
- - 414,
- - 827,
- - 457,
- - 970,
- - 490,
- - 1109,
- - 215,
- - 916,
- - 144,
- - 937,
- - 493,
- - 1269,
- - 517,
- - 1507,
- 181,
- 101,
- - 332,
- - 889,
- - 836,
- - 937,
- - 559,
- - 429,
- - 629,
- - 547,
- - 183,
- - 337,
- - 545,
- - 82,
- - 250,
- - 286,
- 5,
- - 132,
- - 348,
- - 252,
- - 293,
- - 472,
- - 158,
- 100,
- - 29,
- 197,
- - 236,
- - 424,
- - 861,
- - 213,
- - 140,
- - 7,
- - 427,
- - 443,
- 187,
- - 97,
- - 684,
- - 736,
- - 293,
- 258,
- - 368,
- - 152,
- - 150,
- 392,
- - 609,
- 175,
- - 142,
- 299,
- - 138,
- 152,
- - 119,
- 329,
- - 486,
- - 52,
- 293,
- 198,
- - 183,
- 117,
- 175,
- 331,
- - 58,
- - 274,
- 231,
- 300,
- - 288,
- 330,
- - 305,
- 372,
- - 111,
- 409,
- - 9,
- 423,
- 83,
- 256,
- 67,
- 367,
- - 19,
- 248,
- 91,
- 113,
- - 35,
- 406,
- - 191,
- 154,
- 238,
- 296,
- 5,
- 197,
- 141,
- 221,
- 313,
- 198,
- 211,
- 421,
- 244,
- 334,
- 88,
- 426,
- - 243,
- 454,
- 202,
- 552,
- - 5,
- 403,
- 291,
- 185,
- 219,
- 301,
- 251,
- 138,
- 128,
- 69,
- 197,
- 288,
- - 140,
- - 61,
- 188,
- 361,
- 197,
- 598,
- 442,
- 273,
- 290,
- 143,
- 472,
- 482,
- 157,
- 370,
- 415,
- 321,
- 372,
- 385,
- 402,
- 552,
- 155,
- 24,
- 550,
- 263,
- - 11,
- 21,
- 360,
- 227,
- 147,
- - 254,
- 424,
- 97,
- 366,
- - 13,
- 375,
- 141,
- 449,
- 232,
- 396,
- 507,
- 474,
- 272,
- 701,
- 324,
- 362,
- - 47,
- 587,
- 148,
- 543,
- 69,
- 400,
- - 51,
- 561,
- 59,
- 220,
- - 10,
- 352,
- 147,
- 206,
- 211,
- 653,
- 185,
- 563,
- 297,
- 565,
- 284,
- 594,
- 121,
- 766,
- 192,
- 398,
- 118,
- 642,
- 434,
- 233,
- 264,
- 481,
- 467,
- 129,
- - 165,
- 699,
- 239,
- 90,
- 26,
- 342,
- 474,
- - 55,
- 27,
- 388,
- 94,
- - 172,
- 0,
- 725,
- 379,
- - 60,
- 337,
- 370,
- 465,
- 95,
- 319,
- 806,
- 595,
- 78,
- 260,
- 497,
- 851,
- 210,
- 560,
- 458,
- 574,
- - 464,
- 202,
- 497,
- 625,
- - 202,
- 152,
- 48,
- 712,
- - 20,
- 566,
- 100,
- 715,
- 455,
- 468,
- 411,
- 605,
- 319,
- 646,
- 195,
- 615,
- 401,
- 538,
- 680,
- 739,
- 201,
- 667,
- 434,
- 954,
- 454,
- 425,
- 646,
- 491,
- 606,
- 681,
- 416,
- 508,
- 497,
- 822,
- 426,
- 815,
- 660,
- 647,
- 628,
- 716,
- 697,
- 466,
- 618,
- 457,
- 685,
- 460,
- 365,
- 309,
- 721,
- 567,
- 836,
- 601,
- 609,
- 300,
- 825,
- 459,
- 943,
- 687,
- 681,
- 533,
- 915,
- 598,
- 591,
- 243,
- 876,
- 451,
- 874,
- 420,
- 786,
- 317,
- 732,
- 220,
- 922,
- 317,
- 1108,
- 367,
- 531,
- 466,
- 1028,
- 649,
- 1053,
- 615,
- 1034,
- 553,
- 829,
- 602,
- 1021,
- 799,
- 927,
- 803,
- 878,
- 763,
- 799,
- 496,
- 1373,
- 773,
- 585,
- 770,
- 803,
- 930,
- 1099,
- 793,
- 1222,
- 862,
- 1209,
- 895,
- 1025,
- 727,
- 772,
- 845,
- 1172,
- 1115,
- 867,
- 1021,
- 830,
- 1013,
- 841,
- 910,
- 506,
- 703,
- 1239,
- 1077,
- 620,
- 819,
- 1196,
- 1083,
- 1155,
- 1081,
- 1142,
- 907,
- 1547,
- 1121,
- 1309,
- 648,
- 1343,
- 612,
- 1484,
- 988,
- 1479,
- 937,
- 985,
- 1328,
- 955,
- 1341,
- 429,
- 910,
- 841,
- 1338,
- 564,
- 1179,
- 412,
- 1156,
- 1427,
- 1320,
- 1434,
- 1330,
- 640,
- 760,
- 1726,
- 1410,
- 190,
- 555,
- 1073,
- 1005,
- 426,
- 257,
- 839,
- 980,
- 235,
- 231,
- 1520,
- 1167,
- 109,
- 293,
- 1014,
- 1569,
- 305,
- 142,
- 1148,
- 539,
- - 291,
- - 108,
- 1213,
- 972,
- 22,
- - 216,
- 667,
- 828,
- - 482,
- 438,
- 453,
- 1431,
- - 581,
- - 422,
- 789,
- 387,
- - 358,
- - 454,
- 174,
- 780,
- - 36,
- - 372,
- 390,
- - 134,
- - 629,
- 160,
- - 306,
- 751,
- - 1258,
- - 331,
- 177,
- 522,
- - 248,
- 574,
- - 251,
- 639,
- - 531,
- 407,
- - 596,
- 394,
- - 419,
- 789,
- - 617,
- 801,
- - 986,
- 399,
- - 857,
- 727,
- - 7,
- 518,
- - 703,
- 310,
- - 1143,
- - 24,
- - 1002,
- 287,
- - 960,
- 363,
- - 1299,
- 312,
- - 1534,
- 245,
- - 1557,
- 305,
- 28,
- 153,
- - 859,
- - 175,
- - 33,
- 332,
- - 1398,
- - 154,
- 212,
- 410,
- - 593,
- - 197,
- - 1092,
- - 704,
- - 904,
- - 65,
- 282,
- 367,
- - 918,
- - 686,
- 345,
- 93,
- - 258,
- - 357,
- 696,
- 644,
- - 693,
- - 28,
- 448,
- 493,
- - 273,
- 193,
- 527,
- 546,
- - 243,
- - 513,
- 384,
- - 136,
- 273,
- - 353,
- 512,
- - 142,
- 537,
- - 198,
- 941,
- 750,
- 83,
- 248,
- 578,
- 861,
- - 56,
- 592,
- 842,
- 44,
- 892,
- 24,
- 33,
- 890,
- - 16,
- 982,
- 831,
- 1398,
- 1535,
- 1898,
- 1716,
- 1376,
- 1948,
- 1465
+ - 1857,
+ - 1681,
+ - 1857,
+ - 1755,
+ - 2056,
+ - 1150,
+ - 2134,
+ - 1654,
+ - 1619,
+ - 1099,
+ - 1704,
+ - 1131,
+ - 1345,
+ - 1608,
+ - 1359,
+ - 1638,
+ - 1338,
+ - 1293,
+ - 1325,
+ - 1265,
+ - 1664,
+ - 1649,
+ - 1487,
+ - 851,
+ - 1346,
+ - 1832,
+ - 1413,
+ - 2188,
+ - 1282,
+ - 681,
+ - 1785,
+ - 1649,
+ - 966,
+ - 1082,
+ - 1183,
+ - 1676,
+ - 1054,
+ - 1073,
+ - 1142,
+ - 1158,
+ - 1207,
+ - 744,
+ - 1274,
+ - 997,
+ - 934,
+ - 1383,
+ - 927,
+ - 1416,
+ - 1010,
+ - 1305,
+ - 783,
+ - 955,
+ - 1049,
+ - 900,
+ - 993,
+ - 817,
+ - 737,
+ - 823,
+ - 972,
+ - 1189,
+ - 738,
+ - 1094,
+ - 738,
+ - 1154,
+ - 784,
+ - 801,
+ - 810,
+ - 786,
+ - 892,
+ - 520,
+ - 1000,
+ - 818,
+ - 644,
+ - 965,
+ - 577,
+ - 882,
+ - 541,
+ - 694,
+ - 671,
+ - 917,
+ - 595,
+ - 642,
+ - 646,
+ - 615,
+ - 956,
+ - 621,
+ - 925,
+ - 515,
+ - 727,
+ - 483,
+ - 815,
+ - 485,
+ - 840,
+ - 578,
+ - 440,
+ - 713,
+ - 578,
+ - 325,
+ - 657,
+ - 670,
+ - 386,
+ - 570,
+ - 441,
+ - 666,
+ - 514,
+ - 787,
+ - 392,
+ - 529,
+ - 522,
+ - 453,
+ - 487,
+ - 423,
+ - 616,
+ - 585,
+ - 617,
+ - 157,
+ - 662,
+ - 268,
+ - 680,
+ - 348,
+ - 322,
+ - 323,
+ - 632,
+ - 444,
+ - 304,
+ - 430,
+ - 332,
+ - 458,
+ - 277,
+ - 468,
+ - 659,
+ - 793,
+ - 319,
+ - 636,
+ - 227,
+ - 554,
+ - 373,
+ - 347,
+ - 334,
+ - 210,
+ - 456,
+ - 192,
+ - 530,
+ - 242,
+ - 216,
+ - 198,
+ - 366,
+ - 370,
+ - 338,
+ - 161,
+ - 409,
+ - 748,
+ - 107,
+ - 380,
+ - 294,
+ - 643,
+ - 223,
+ - 665,
+ - 234,
+ - 741,
+ - 141,
+ - 496,
+ - 130,
+ - 510,
+ - 139,
+ - 327,
+ - 172,
+ - 305,
+ - 306,
+ - 580,
+ - 164,
+ - 263,
+ - 262,
+ - 172,
+ - 67,
+ - 402,
+ 31,
+ - 366,
+ - 10,
+ - 436,
+ - 86,
+ - 527,
+ 71,
+ - 377,
+ - 22,
+ - 609,
+ - 12,
+ - 678,
+ - 67,
+ - 319,
+ 63,
+ - 191,
+ 35,
+ - 181,
+ - 39,
+ - 242,
+ 126,
+ - 167,
+ - 140,
+ - 544,
+ 155,
+ - 297,
+ 174,
+ - 297,
+ 38,
+ - 8,
+ 117,
+ - 380,
+ 197,
+ - 452,
+ 240,
+ - 522,
+ 223,
+ - 103,
+ 110,
+ - 187,
+ 87,
+ - 155,
+ 169,
+ - 47,
+ 157,
+ 26,
+ - 83,
+ - 100,
+ 128,
+ 80,
+ 209,
+ - 62,
+ 6,
+ 7,
+ 22,
+ 5,
+ 318,
+ - 20,
+ 248,
+ - 45,
+ - 200,
+ - 63,
+ 156,
+ - 69,
+ 250,
+ - 183,
+ 369,
+ - 126,
+ - 113,
+ - 76,
+ - 142,
+ - 122,
+ - 64,
+ - 254,
+ - 31,
+ 35,
+ - 177,
+ - 71,
+ - 7,
+ 171,
+ 93,
+ 27,
+ 108,
+ 212,
+ - 330,
+ - 209,
+ - 123,
+ - 70,
+ - 279,
+ 95,
+ - 96,
+ 20,
+ - 188,
+ - 61,
+ - 314,
+ 87,
+ - 300,
+ - 78,
+ - 354,
+ - 134,
+ 11,
+ 122,
+ - 140,
+ 122,
+ - 275,
+ 152,
+ - 293,
+ 140,
+ - 82,
+ 138,
+ - 321,
+ - 111,
+ - 480,
+ - 156,
+ - 359,
+ 76,
+ - 254,
+ - 40,
+ - 635,
+ - 96,
+ - 522,
+ 79,
+ - 507,
+ 8,
+ - 268,
+ 303,
+ - 539,
+ 68,
+ - 446,
+ 61,
+ - 522,
+ 306,
+ 111,
+ 189,
+ - 435,
+ 122,
+ - 379,
+ 166,
+ - 571,
+ - 398,
+ - 632,
+ - 74,
+ - 747,
+ - 95,
+ - 455,
+ 194,
+ - 952,
+ 83,
+ - 798,
+ 192,
+ - 755,
+ 192,
+ - 781,
+ - 162,
+ - 619,
+ 234,
+ - 663,
+ - 297,
+ - 488,
+ - 109,
+ - 964,
+ - 132,
+ - 838,
+ - 68,
+ - 843,
+ 58,
+ - 1112,
+ - 86,
+ - 805,
+ - 299,
+ - 944,
+ - 253,
+ - 778,
+ - 50,
+ - 965,
+ - 549,
+ - 352,
+ - 98,
+ - 992,
+ - 343,
+ - 1117,
+ - 315,
+ - 1117,
+ - 307,
+ - 1155,
+ - 374,
+ - 637,
+ - 230,
+ - 1166,
+ - 43,
+ - 1299,
+ - 100,
+ - 925,
+ - 393,
+ - 1274,
+ - 600,
+ - 689,
+ - 130,
+ - 1479,
+ - 312,
+ - 1321,
+ - 254,
+ - 1464,
+ - 442,
+ - 1292,
+ - 613,
+ - 1261,
+ - 503,
+ - 1501,
+ - 368,
+ - 1322,
+ 26,
+ - 1432,
+ - 66,
+ - 1743,
+ - 161,
+ - 1644,
+ - 467,
+ - 1760,
+ - 548,
+ - 1393,
+ - 568,
+ - 1556,
+ - 871,
+ - 1495,
+ - 1034,
+ - 1387,
+ - 571,
+ - 1917,
+ - 528,
+ - 1783,
+ - 123,
+ - 1897,
+ - 231,
+ - 2054,
+ - 323,
+ - 2052,
+ - 906,
+ - 1976,
+ - 567,
+ - 1917,
+ - 620,
+ - 2047,
+ - 989,
+ - 1077,
+ - 370,
+ - 2031,
+ - 704,
+ - 2355,
+ - 749,
+ - 2740,
+ - 1089,
+ - 1909,
+ 159,
+ - 2012,
+ 248,
+ - 626,
+ - 123,
+ - 2339,
+ - 962,
+ - 669,
+ - 408,
+ - 1379,
+ - 1174,
+ - 452,
+ - 364,
+ - 1044,
+ - 735,
+ - 132,
+ 183,
+ - 1620,
+ - 752,
+ - 547,
+ - 307,
+ - 777,
+ - 1261,
+ - 98,
+ 41,
+ - 880,
+ - 1091,
+ - 257,
+ 97,
+ - 1602,
+ - 1833,
+ 31,
+ - 26,
+ - 644,
+ - 561,
+ - 180,
+ - 546,
+ - 385,
+ - 1095,
+ - 410,
+ - 802,
+ - 414,
+ - 827,
+ - 457,
+ - 970,
+ - 490,
+ - 1109,
+ - 215,
+ - 916,
+ - 144,
+ - 937,
+ - 493,
+ - 1269,
+ - 517,
+ - 1507,
+ 181,
+ 101,
+ - 332,
+ - 889,
+ - 836,
+ - 937,
+ - 559,
+ - 429,
+ - 629,
+ - 547,
+ - 183,
+ - 337,
+ - 545,
+ - 82,
+ - 250,
+ - 286,
+ 5,
+ - 132,
+ - 348,
+ - 252,
+ - 293,
+ - 472,
+ - 158,
+ 100,
+ - 29,
+ 197,
+ - 236,
+ - 424,
+ - 861,
+ - 213,
+ - 140,
+ - 7,
+ - 427,
+ - 443,
+ 187,
+ - 97,
+ - 684,
+ - 736,
+ - 293,
+ 258,
+ - 368,
+ - 152,
+ - 150,
+ 392,
+ - 609,
+ 175,
+ - 142,
+ 299,
+ - 138,
+ 152,
+ - 119,
+ 329,
+ - 486,
+ - 52,
+ 293,
+ 198,
+ - 183,
+ 117,
+ 175,
+ 331,
+ - 58,
+ - 274,
+ 231,
+ 300,
+ - 288,
+ 330,
+ - 305,
+ 372,
+ - 111,
+ 409,
+ - 9,
+ 423,
+ 83,
+ 256,
+ 67,
+ 367,
+ - 19,
+ 248,
+ 91,
+ 113,
+ - 35,
+ 406,
+ - 191,
+ 154,
+ 238,
+ 296,
+ 5,
+ 197,
+ 141,
+ 221,
+ 313,
+ 198,
+ 211,
+ 421,
+ 244,
+ 334,
+ 88,
+ 426,
+ - 243,
+ 454,
+ 202,
+ 552,
+ - 5,
+ 403,
+ 291,
+ 185,
+ 219,
+ 301,
+ 251,
+ 138,
+ 128,
+ 69,
+ 197,
+ 288,
+ - 140,
+ - 61,
+ 188,
+ 361,
+ 197,
+ 598,
+ 442,
+ 273,
+ 290,
+ 143,
+ 472,
+ 482,
+ 157,
+ 370,
+ 415,
+ 321,
+ 372,
+ 385,
+ 402,
+ 552,
+ 155,
+ 24,
+ 550,
+ 263,
+ - 11,
+ 21,
+ 360,
+ 227,
+ 147,
+ - 254,
+ 424,
+ 97,
+ 366,
+ - 13,
+ 375,
+ 141,
+ 449,
+ 232,
+ 396,
+ 507,
+ 474,
+ 272,
+ 701,
+ 324,
+ 362,
+ - 47,
+ 587,
+ 148,
+ 543,
+ 69,
+ 400,
+ - 51,
+ 561,
+ 59,
+ 220,
+ - 10,
+ 352,
+ 147,
+ 206,
+ 211,
+ 653,
+ 185,
+ 563,
+ 297,
+ 565,
+ 284,
+ 594,
+ 121,
+ 766,
+ 192,
+ 398,
+ 118,
+ 642,
+ 434,
+ 233,
+ 264,
+ 481,
+ 467,
+ 129,
+ - 165,
+ 699,
+ 239,
+ 90,
+ 26,
+ 342,
+ 474,
+ - 55,
+ 27,
+ 388,
+ 94,
+ - 172,
+ 0,
+ 725,
+ 379,
+ - 60,
+ 337,
+ 370,
+ 465,
+ 95,
+ 319,
+ 806,
+ 595,
+ 78,
+ 260,
+ 497,
+ 851,
+ 210,
+ 560,
+ 458,
+ 574,
+ - 464,
+ 202,
+ 497,
+ 625,
+ - 202,
+ 152,
+ 48,
+ 712,
+ - 20,
+ 566,
+ 100,
+ 715,
+ 455,
+ 468,
+ 411,
+ 605,
+ 319,
+ 646,
+ 195,
+ 615,
+ 401,
+ 538,
+ 680,
+ 739,
+ 201,
+ 667,
+ 434,
+ 954,
+ 454,
+ 425,
+ 646,
+ 491,
+ 606,
+ 681,
+ 416,
+ 508,
+ 497,
+ 822,
+ 426,
+ 815,
+ 660,
+ 647,
+ 628,
+ 716,
+ 697,
+ 466,
+ 618,
+ 457,
+ 685,
+ 460,
+ 365,
+ 309,
+ 721,
+ 567,
+ 836,
+ 601,
+ 609,
+ 300,
+ 825,
+ 459,
+ 943,
+ 687,
+ 681,
+ 533,
+ 915,
+ 598,
+ 591,
+ 243,
+ 876,
+ 451,
+ 874,
+ 420,
+ 786,
+ 317,
+ 732,
+ 220,
+ 922,
+ 317,
+ 1108,
+ 367,
+ 531,
+ 466,
+ 1028,
+ 649,
+ 1053,
+ 615,
+ 1034,
+ 553,
+ 829,
+ 602,
+ 1021,
+ 799,
+ 927,
+ 803,
+ 878,
+ 763,
+ 799,
+ 496,
+ 1373,
+ 773,
+ 585,
+ 770,
+ 803,
+ 930,
+ 1099,
+ 793,
+ 1222,
+ 862,
+ 1209,
+ 895,
+ 1025,
+ 727,
+ 772,
+ 845,
+ 1172,
+ 1115,
+ 867,
+ 1021,
+ 830,
+ 1013,
+ 841,
+ 910,
+ 506,
+ 703,
+ 1239,
+ 1077,
+ 620,
+ 819,
+ 1196,
+ 1083,
+ 1155,
+ 1081,
+ 1142,
+ 907,
+ 1547,
+ 1121,
+ 1309,
+ 648,
+ 1343,
+ 612,
+ 1484,
+ 988,
+ 1479,
+ 937,
+ 985,
+ 1328,
+ 955,
+ 1341,
+ 429,
+ 910,
+ 841,
+ 1338,
+ 564,
+ 1179,
+ 412,
+ 1156,
+ 1427,
+ 1320,
+ 1434,
+ 1330,
+ 640,
+ 760,
+ 1726,
+ 1410,
+ 190,
+ 555,
+ 1073,
+ 1005,
+ 426,
+ 257,
+ 839,
+ 980,
+ 235,
+ 231,
+ 1520,
+ 1167,
+ 109,
+ 293,
+ 1014,
+ 1569,
+ 305,
+ 142,
+ 1148,
+ 539,
+ - 291,
+ - 108,
+ 1213,
+ 972,
+ 22,
+ - 216,
+ 667,
+ 828,
+ - 482,
+ 438,
+ 453,
+ 1431,
+ - 581,
+ - 422,
+ 789,
+ 387,
+ - 358,
+ - 454,
+ 174,
+ 780,
+ - 36,
+ - 372,
+ 390,
+ - 134,
+ - 629,
+ 160,
+ - 306,
+ 751,
+ - 1258,
+ - 331,
+ 177,
+ 522,
+ - 248,
+ 574,
+ - 251,
+ 639,
+ - 531,
+ 407,
+ - 596,
+ 394,
+ - 419,
+ 789,
+ - 617,
+ 801,
+ - 986,
+ 399,
+ - 857,
+ 727,
+ - 7,
+ 518,
+ - 703,
+ 310,
+ - 1143,
+ - 24,
+ - 1002,
+ 287,
+ - 960,
+ 363,
+ - 1299,
+ 312,
+ - 1534,
+ 245,
+ - 1557,
+ 305,
+ 28,
+ 153,
+ - 859,
+ - 175,
+ - 33,
+ 332,
+ - 1398,
+ - 154,
+ 212,
+ 410,
+ - 593,
+ - 197,
+ - 1092,
+ - 704,
+ - 904,
+ - 65,
+ 282,
+ 367,
+ - 918,
+ - 686,
+ 345,
+ 93,
+ - 258,
+ - 357,
+ 696,
+ 644,
+ - 693,
+ - 28,
+ 448,
+ 493,
+ - 273,
+ 193,
+ 527,
+ 546,
+ - 243,
+ - 513,
+ 384,
+ - 136,
+ 273,
+ - 353,
+ 512,
+ - 142,
+ 537,
+ - 198,
+ 941,
+ 750,
+ 83,
+ 248,
+ 578,
+ 861,
+ - 56,
+ 592,
+ 842,
+ 44,
+ 892,
+ 24,
+ 33,
+ 890,
+ - 16,
+ 982,
+ 831,
+ 1398,
+ 1535,
+ 1898,
+ 1716,
+ 1376,
+ 1948,
+ 1465
};
/* 5th LSF quantizer (MR122) */
static const Word32 dico5_lsf_5[DICO5_SIZE_5 * 4] =
{
- - 1002,
- - 929,
- - 1096,
- - 1203,
- - 641,
- - 931,
- - 604,
- - 961,
- - 779,
- - 673,
- - 835,
- - 788,
- - 416,
- - 664,
- - 458,
- - 766,
- - 652,
- - 521,
- - 662,
- - 495,
- - 1023,
- - 509,
- - 1023,
- - 428,
- - 444,
- - 552,
- - 368,
- - 449,
- - 479,
- - 211,
- - 1054,
- - 903,
- - 316,
- - 249,
- - 569,
- - 591,
- - 569,
- - 275,
- - 541,
- - 191,
- - 716,
- - 188,
- - 842,
- - 264,
- - 333,
- - 248,
- - 318,
- - 228,
- - 275,
- 1,
- - 567,
- - 228,
- - 115,
- - 221,
- - 238,
- - 374,
- - 197,
- - 507,
- - 222,
- - 579,
- - 258,
- - 432,
- - 61,
- - 244,
- - 345,
- 2,
- - 338,
- 39,
- - 215,
- - 169,
- - 58,
- 0,
- - 56,
- - 6,
- - 203,
- - 131,
- 1,
- - 186,
- - 5,
- - 211,
- 6,
- - 380,
- 11,
- - 418,
- - 116,
- 131,
- - 134,
- 113,
- 89,
- - 4,
- 71,
- - 2,
- - 19,
- - 192,
- 262,
- 24,
- 189,
- 151,
- - 133,
- - 109,
- 186,
- - 153,
- 166,
- - 219,
- 37,
- 139,
- 193,
- 171,
- 337,
- 124,
- 158,
- - 61,
- 141,
- 226,
- - 13,
- 190,
- 231,
- 34,
- 354,
- 109,
- 316,
- 201,
- 244,
- 164,
- 330,
- - 85,
- 390,
- - 84,
- 254,
- 327,
- 257,
- 335,
- 491,
- 147,
- 476,
- 105,
- 54,
- 77,
- 437,
- 370,
- 421,
- 314,
- 449,
- 342,
- 329,
- 126,
- 673,
- 292,
- 571,
- 388,
- 243,
- 193,
- 653,
- 320,
- 621,
- 280,
- 194,
- 380,
- 517,
- 581,
- 45,
- 323,
- 111,
- 422,
- 489,
- 395,
- 734,
- 534,
- 622,
- 546,
- 486,
- 502,
- 318,
- 572,
- 189,
- 550,
- 385,
- 422,
- - 157,
- 153,
- - 125,
- 382,
- - 197,
- 386,
- - 263,
- 334,
- 228,
- 697,
- - 188,
- 1,
- 51,
- 297,
- - 507,
- 213,
- - 376,
- 397,
- - 24,
- 255,
- - 547,
- 89,
- - 502,
- - 94,
- 387,
- 179,
- - 620,
- 68,
- - 684,
- 112,
- - 642,
- - 350,
- - 260,
- 172,
- - 438,
- - 324,
- 264,
- 648,
- - 964,
- - 4,
- - 1121,
- 7,
- - 134,
- 134,
- - 1133,
- - 306,
- 143,
- 96,
- - 420,
- - 497,
- - 1221,
- - 350,
- - 1527,
- - 685,
- - 161,
- 72,
- 873,
- 691,
- 732,
- 283,
- 921,
- 353,
- 334,
- 475,
- 1095,
- 821,
- 864,
- 524,
- 843,
- 497,
- 714,
- 711,
- 788,
- 750,
- 1076,
- 714,
- 1204,
- 753
+ - 1002,
+ - 929,
+ - 1096,
+ - 1203,
+ - 641,
+ - 931,
+ - 604,
+ - 961,
+ - 779,
+ - 673,
+ - 835,
+ - 788,
+ - 416,
+ - 664,
+ - 458,
+ - 766,
+ - 652,
+ - 521,
+ - 662,
+ - 495,
+ - 1023,
+ - 509,
+ - 1023,
+ - 428,
+ - 444,
+ - 552,
+ - 368,
+ - 449,
+ - 479,
+ - 211,
+ - 1054,
+ - 903,
+ - 316,
+ - 249,
+ - 569,
+ - 591,
+ - 569,
+ - 275,
+ - 541,
+ - 191,
+ - 716,
+ - 188,
+ - 842,
+ - 264,
+ - 333,
+ - 248,
+ - 318,
+ - 228,
+ - 275,
+ 1,
+ - 567,
+ - 228,
+ - 115,
+ - 221,
+ - 238,
+ - 374,
+ - 197,
+ - 507,
+ - 222,
+ - 579,
+ - 258,
+ - 432,
+ - 61,
+ - 244,
+ - 345,
+ 2,
+ - 338,
+ 39,
+ - 215,
+ - 169,
+ - 58,
+ 0,
+ - 56,
+ - 6,
+ - 203,
+ - 131,
+ 1,
+ - 186,
+ - 5,
+ - 211,
+ 6,
+ - 380,
+ 11,
+ - 418,
+ - 116,
+ 131,
+ - 134,
+ 113,
+ 89,
+ - 4,
+ 71,
+ - 2,
+ - 19,
+ - 192,
+ 262,
+ 24,
+ 189,
+ 151,
+ - 133,
+ - 109,
+ 186,
+ - 153,
+ 166,
+ - 219,
+ 37,
+ 139,
+ 193,
+ 171,
+ 337,
+ 124,
+ 158,
+ - 61,
+ 141,
+ 226,
+ - 13,
+ 190,
+ 231,
+ 34,
+ 354,
+ 109,
+ 316,
+ 201,
+ 244,
+ 164,
+ 330,
+ - 85,
+ 390,
+ - 84,
+ 254,
+ 327,
+ 257,
+ 335,
+ 491,
+ 147,
+ 476,
+ 105,
+ 54,
+ 77,
+ 437,
+ 370,
+ 421,
+ 314,
+ 449,
+ 342,
+ 329,
+ 126,
+ 673,
+ 292,
+ 571,
+ 388,
+ 243,
+ 193,
+ 653,
+ 320,
+ 621,
+ 280,
+ 194,
+ 380,
+ 517,
+ 581,
+ 45,
+ 323,
+ 111,
+ 422,
+ 489,
+ 395,
+ 734,
+ 534,
+ 622,
+ 546,
+ 486,
+ 502,
+ 318,
+ 572,
+ 189,
+ 550,
+ 385,
+ 422,
+ - 157,
+ 153,
+ - 125,
+ 382,
+ - 197,
+ 386,
+ - 263,
+ 334,
+ 228,
+ 697,
+ - 188,
+ 1,
+ 51,
+ 297,
+ - 507,
+ 213,
+ - 376,
+ 397,
+ - 24,
+ 255,
+ - 547,
+ 89,
+ - 502,
+ - 94,
+ 387,
+ 179,
+ - 620,
+ 68,
+ - 684,
+ 112,
+ - 642,
+ - 350,
+ - 260,
+ 172,
+ - 438,
+ - 324,
+ 264,
+ 648,
+ - 964,
+ - 4,
+ - 1121,
+ 7,
+ - 134,
+ 134,
+ - 1133,
+ - 306,
+ 143,
+ 96,
+ - 420,
+ - 497,
+ - 1221,
+ - 350,
+ - 1527,
+ - 685,
+ - 161,
+ 72,
+ 873,
+ 691,
+ 732,
+ 283,
+ 921,
+ 353,
+ 334,
+ 475,
+ 1095,
+ 821,
+ 864,
+ 524,
+ 843,
+ 497,
+ 714,
+ 711,
+ 788,
+ 750,
+ 1076,
+ 714,
+ 1204,
+ 753
};
@@ -11312,16 +11312,16 @@ static const Word32 dico5_lsf_5[DICO5_SIZE_5 * 4] =
/* Scaling factors for the lsp variability operation */
static const Word16 lsf_hist_mean_scale[M] =
{
- 20000,
- 20000,
- 20000,
- 20000,
- 20000,
- 18000,
- 16384,
- 8192,
- 0,
- 0
+ 20000,
+ 20000,
+ 20000,
+ 20000,
+ 20000,
+ 18000,
+ 16384,
+ 8192,
+ 0,
+ 0
};
/*
@@ -11349,1035 +11349,1035 @@ static const Word16 lsf_hist_mean_scale[M] =
*/
static const Word32 table_gain_MR475[MR475_VQ_SIZE * 4] =
{
- /*
- * g_pit(0),
- * g_fac(0),
- * g_pit(1),
- * g_fac(1)
- */ 812,
- 128,
- 542,
- 140,
- 2873,
- 1135,
- 2266,
- 3402,
- 2067,
- 563,
- 12677,
- 647,
- 4132,
- 1798,
- 5601,
- 5285,
- 7689,
- 374,
- 3735,
- 441,
- 10912,
- 2638,
- 11807,
- 2494,
- 20490,
- 797,
- 5218,
- 675,
- 6724,
- 8354,
- 5282,
- 1696,
- 1488,
- 428,
- 5882,
- 452,
- 5332,
- 4072,
- 3583,
- 1268,
- 2469,
- 901,
- 15894,
- 1005,
- 14982,
- 3271,
- 10331,
- 4858,
- 3635,
- 2021,
- 2596,
- 835,
- 12360,
- 4892,
- 12206,
- 1704,
- 13432,
- 1604,
- 9118,
- 2341,
- 3968,
- 1538,
- 5479,
- 9936,
- 3795,
- 417,
- 1359,
- 414,
- 3640,
- 1569,
- 7995,
- 3541,
- 11405,
- 645,
- 8552,
- 635,
- 4056,
- 1377,
- 16608,
- 6124,
- 11420,
- 700,
- 2007,
- 607,
- 12415,
- 1578,
- 11119,
- 4654,
- 13680,
- 1708,
- 11990,
- 1229,
- 7996,
- 7297,
- 13231,
- 5715,
- 2428,
- 1159,
- 2073,
- 1941,
- 6218,
- 6121,
- 3546,
- 1804,
- 8925,
- 1802,
- 8679,
- 1580,
- 13935,
- 3576,
- 13313,
- 6237,
- 6142,
- 1130,
- 5994,
- 1734,
- 14141,
- 4662,
- 11271,
- 3321,
- 12226,
- 1551,
- 13931,
- 3015,
- 5081,
- 10464,
- 9444,
- 6706,
- 1689,
- 683,
- 1436,
- 1306,
- 7212,
- 3933,
- 4082,
- 2713,
- 7793,
- 704,
- 15070,
- 802,
- 6299,
- 5212,
- 4337,
- 5357,
- 6676,
- 541,
- 6062,
- 626,
- 13651,
- 3700,
- 11498,
- 2408,
- 16156,
- 716,
- 12177,
- 751,
- 8065,
- 11489,
- 6314,
- 2256,
- 4466,
- 496,
- 7293,
- 523,
- 10213,
- 3833,
- 8394,
- 3037,
- 8403,
- 966,
- 14228,
- 1880,
- 8703,
- 5409,
- 16395,
- 4863,
- 7420,
- 1979,
- 6089,
- 1230,
- 9371,
- 4398,
- 14558,
- 3363,
- 13559,
- 2873,
- 13163,
- 1465,
- 5534,
- 1678,
- 13138,
- 14771,
- 7338,
- 600,
- 1318,
- 548,
- 4252,
- 3539,
- 10044,
- 2364,
- 10587,
- 622,
- 13088,
- 669,
- 14126,
- 3526,
- 5039,
- 9784,
- 15338,
- 619,
- 3115,
- 590,
- 16442,
- 3013,
- 15542,
- 4168,
- 15537,
- 1611,
- 15405,
- 1228,
- 16023,
- 9299,
- 7534,
- 4976,
- 1990,
- 1213,
- 11447,
- 1157,
- 12512,
- 5519,
- 9475,
- 2644,
- 7716,
- 2034,
- 13280,
- 2239,
- 16011,
- 5093,
- 8066,
- 6761,
- 10083,
- 1413,
- 5002,
- 2347,
- 12523,
- 5975,
- 15126,
- 2899,
- 18264,
- 2289,
- 15827,
- 2527,
- 16265,
- 10254,
- 14651,
- 11319,
- 1797,
- 337,
- 3115,
- 397,
- 3510,
- 2928,
- 4592,
- 2670,
- 7519,
- 628,
- 11415,
- 656,
- 5946,
- 2435,
- 6544,
- 7367,
- 8238,
- 829,
- 4000,
- 863,
- 10032,
- 2492,
- 16057,
- 3551,
- 18204,
- 1054,
- 6103,
- 1454,
- 5884,
- 7900,
- 18752,
- 3468,
- 1864,
- 544,
- 9198,
- 683,
- 11623,
- 4160,
- 4594,
- 1644,
- 3158,
- 1157,
- 15953,
- 2560,
- 12349,
- 3733,
- 17420,
- 5260,
- 6106,
- 2004,
- 2917,
- 1742,
- 16467,
- 5257,
- 16787,
- 1680,
- 17205,
- 1759,
- 4773,
- 3231,
- 7386,
- 6035,
- 14342,
- 10012,
- 4035,
- 442,
- 4194,
- 458,
- 9214,
- 2242,
- 7427,
- 4217,
- 12860,
- 801,
- 11186,
- 825,
- 12648,
- 2084,
- 12956,
- 6554,
- 9505,
- 996,
- 6629,
- 985,
- 10537,
- 2502,
- 15289,
- 5006,
- 12602,
- 2055,
- 15484,
- 1653,
- 16194,
- 6921,
- 14231,
- 5790,
- 2626,
- 828,
- 5615,
- 1686,
- 13663,
- 5778,
- 3668,
- 1554,
- 11313,
- 2633,
- 9770,
- 1459,
- 14003,
- 4733,
- 15897,
- 6291,
- 6278,
- 1870,
- 7910,
- 2285,
- 16978,
- 4571,
- 16576,
- 3849,
- 15248,
- 2311,
- 16023,
- 3244,
- 14459,
- 17808,
- 11847,
- 2763,
- 1981,
- 1407,
- 1400,
- 876,
- 4335,
- 3547,
- 4391,
- 4210,
- 5405,
- 680,
- 17461,
- 781,
- 6501,
- 5118,
- 8091,
- 7677,
- 7355,
- 794,
- 8333,
- 1182,
- 15041,
- 3160,
- 14928,
- 3039,
- 20421,
- 880,
- 14545,
- 852,
- 12337,
- 14708,
- 6904,
- 1920,
- 4225,
- 933,
- 8218,
- 1087,
- 10659,
- 4084,
- 10082,
- 4533,
- 2735,
- 840,
- 20657,
- 1081,
- 16711,
- 5966,
- 15873,
- 4578,
- 10871,
- 2574,
- 3773,
- 1166,
- 14519,
- 4044,
- 20699,
- 2627,
- 15219,
- 2734,
- 15274,
- 2186,
- 6257,
- 3226,
- 13125,
- 19480,
- 7196,
- 930,
- 2462,
- 1618,
- 4515,
- 3092,
- 13852,
- 4277,
- 10460,
- 833,
- 17339,
- 810,
- 16891,
- 2289,
- 15546,
- 8217,
- 13603,
- 1684,
- 3197,
- 1834,
- 15948,
- 2820,
- 15812,
- 5327,
- 17006,
- 2438,
- 16788,
- 1326,
- 15671,
- 8156,
- 11726,
- 8556,
- 3762,
- 2053,
- 9563,
- 1317,
- 13561,
- 6790,
- 12227,
- 1936,
- 8180,
- 3550,
- 13287,
- 1778,
- 16299,
- 6599,
- 16291,
- 7758,
- 8521,
- 2551,
- 7225,
- 2645,
- 18269,
- 7489,
- 16885,
- 2248,
- 17882,
- 2884,
- 17265,
- 3328,
- 9417,
- 20162,
- 11042,
- 8320,
- 1286,
- 620,
- 1431,
- 583,
- 5993,
- 2289,
- 3978,
- 3626,
- 5144,
- 752,
- 13409,
- 830,
- 5553,
- 2860,
- 11764,
- 5908,
- 10737,
- 560,
- 5446,
- 564,
- 13321,
- 3008,
- 11946,
- 3683,
- 19887,
- 798,
- 9825,
- 728,
- 13663,
- 8748,
- 7391,
- 3053,
- 2515,
- 778,
- 6050,
- 833,
- 6469,
- 5074,
- 8305,
- 2463,
- 6141,
- 1865,
- 15308,
- 1262,
- 14408,
- 4547,
- 13663,
- 4515,
- 3137,
- 2983,
- 2479,
- 1259,
- 15088,
- 4647,
- 15382,
- 2607,
- 14492,
- 2392,
- 12462,
- 2537,
- 7539,
- 2949,
- 12909,
- 12060,
- 5468,
- 684,
- 3141,
- 722,
- 5081,
- 1274,
- 12732,
- 4200,
- 15302,
- 681,
- 7819,
- 592,
- 6534,
- 2021,
- 16478,
- 8737,
- 13364,
- 882,
- 5397,
- 899,
- 14656,
- 2178,
- 14741,
- 4227,
- 14270,
- 1298,
- 13929,
- 2029,
- 15477,
- 7482,
- 15815,
- 4572,
- 2521,
- 2013,
- 5062,
- 1804,
- 5159,
- 6582,
- 7130,
- 3597,
- 10920,
- 1611,
- 11729,
- 1708,
- 16903,
- 3455,
- 16268,
- 6640,
- 9306,
- 1007,
- 9369,
- 2106,
- 19182,
- 5037,
- 12441,
- 4269,
- 15919,
- 1332,
- 15357,
- 3512,
- 11898,
- 14141,
- 16101,
- 6854,
- 2010,
- 737,
- 3779,
- 861,
- 11454,
- 2880,
- 3564,
- 3540,
- 9057,
- 1241,
- 12391,
- 896,
- 8546,
- 4629,
- 11561,
- 5776,
- 8129,
- 589,
- 8218,
- 588,
- 18728,
- 3755,
- 12973,
- 3149,
- 15729,
- 758,
- 16634,
- 754,
- 15222,
- 11138,
- 15871,
- 2208,
- 4673,
- 610,
- 10218,
- 678,
- 15257,
- 4146,
- 5729,
- 3327,
- 8377,
- 1670,
- 19862,
- 2321,
- 15450,
- 5511,
- 14054,
- 5481,
- 5728,
- 2888,
- 7580,
- 1346,
- 14384,
- 5325,
- 16236,
- 3950,
- 15118,
- 3744,
- 15306,
- 1435,
- 14597,
- 4070,
- 12301,
- 15696,
- 7617,
- 1699,
- 2170,
- 884,
- 4459,
- 4567,
- 18094,
- 3306,
- 12742,
- 815,
- 14926,
- 907,
- 15016,
- 4281,
- 15518,
- 8368,
- 17994,
- 1087,
- 2358,
- 865,
- 16281,
- 3787,
- 15679,
- 4596,
- 16356,
- 1534,
- 16584,
- 2210,
- 16833,
- 9697,
- 15929,
- 4513,
- 3277,
- 1085,
- 9643,
- 2187,
- 11973,
- 6068,
- 9199,
- 4462,
- 8955,
- 1629,
- 10289,
- 3062,
- 16481,
- 5155,
- 15466,
- 7066,
- 13678,
- 2543,
- 5273,
- 2277,
- 16746,
- 6213,
- 16655,
- 3408,
- 20304,
- 3363,
- 18688,
- 1985,
- 14172,
- 12867,
- 15154,
- 15703,
- 4473,
- 1020,
- 1681,
- 886,
- 4311,
- 4301,
- 8952,
- 3657,
- 5893,
- 1147,
- 11647,
- 1452,
- 15886,
- 2227,
- 4582,
- 6644,
- 6929,
- 1205,
- 6220,
- 799,
- 12415,
- 3409,
- 15968,
- 3877,
- 19859,
- 2109,
- 9689,
- 2141,
- 14742,
- 8830,
- 14480,
- 2599,
- 1817,
- 1238,
- 7771,
- 813,
- 19079,
- 4410,
- 5554,
- 2064,
- 3687,
- 2844,
- 17435,
- 2256,
- 16697,
- 4486,
- 16199,
- 5388,
- 8028,
- 2763,
- 3405,
- 2119,
- 17426,
- 5477,
- 13698,
- 2786,
- 19879,
- 2720,
- 9098,
- 3880,
- 18172,
- 4833,
- 17336,
- 12207,
- 5116,
- 996,
- 4935,
- 988,
- 9888,
- 3081,
- 6014,
- 5371,
- 15881,
- 1667,
- 8405,
- 1183,
- 15087,
- 2366,
- 19777,
- 7002,
- 11963,
- 1562,
- 7279,
- 1128,
- 16859,
- 1532,
- 15762,
- 5381,
- 14708,
- 2065,
- 20105,
- 2155,
- 17158,
- 8245,
- 17911,
- 6318,
- 5467,
- 1504,
- 4100,
- 2574,
- 17421,
- 6810,
- 5673,
- 2888,
- 16636,
- 3382,
- 8975,
- 1831,
- 20159,
- 4737,
- 19550,
- 7294,
- 6658,
- 2781,
- 11472,
- 3321,
- 19397,
- 5054,
- 18878,
- 4722,
- 16439,
- 2373,
- 20430,
- 4386,
- 11353,
- 26526,
- 11593,
- 3068,
- 2866,
- 1566,
- 5108,
- 1070,
- 9614,
- 4915,
- 4939,
- 3536,
- 7541,
- 878,
- 20717,
- 851,
- 6938,
- 4395,
- 16799,
- 7733,
- 10137,
- 1019,
- 9845,
- 964,
- 15494,
- 3955,
- 15459,
- 3430,
- 18863,
- 982,
- 20120,
- 963,
- 16876,
- 12887,
- 14334,
- 4200,
- 6599,
- 1220,
- 9222,
- 814,
- 16942,
- 5134,
- 5661,
- 4898,
- 5488,
- 1798,
- 20258,
- 3962,
- 17005,
- 6178,
- 17929,
- 5929,
- 9365,
- 3420,
- 7474,
- 1971,
- 19537,
- 5177,
- 19003,
- 3006,
- 16454,
- 3788,
- 16070,
- 2367,
- 8664,
- 2743,
- 9445,
- 26358,
- 10856,
- 1287,
- 3555,
- 1009,
- 5606,
- 3622,
- 19453,
- 5512,
- 12453,
- 797,
- 20634,
- 911,
- 15427,
- 3066,
- 17037,
- 10275,
- 18883,
- 2633,
- 3913,
- 1268,
- 19519,
- 3371,
- 18052,
- 5230,
- 19291,
- 1678,
- 19508,
- 3172,
- 18072,
- 10754,
- 16625,
- 6845,
- 3134,
- 2298,
- 10869,
- 2437,
- 15580,
- 6913,
- 12597,
- 3381,
- 11116,
- 3297,
- 16762,
- 2424,
- 18853,
- 6715,
- 17171,
- 9887,
- 12743,
- 2605,
- 8937,
- 3140,
- 19033,
- 7764,
- 18347,
- 3880,
- 20475,
- 3682,
- 19602,
- 3380,
- 13044,
- 19373,
- 10526,
- 23124
+/*
+ * g_pit(0),
+ * g_fac(0),
+ * g_pit(1),
+ * g_fac(1)
+ */ 812,
+ 128,
+ 542,
+ 140,
+ 2873,
+ 1135,
+ 2266,
+ 3402,
+ 2067,
+ 563,
+ 12677,
+ 647,
+ 4132,
+ 1798,
+ 5601,
+ 5285,
+ 7689,
+ 374,
+ 3735,
+ 441,
+ 10912,
+ 2638,
+ 11807,
+ 2494,
+ 20490,
+ 797,
+ 5218,
+ 675,
+ 6724,
+ 8354,
+ 5282,
+ 1696,
+ 1488,
+ 428,
+ 5882,
+ 452,
+ 5332,
+ 4072,
+ 3583,
+ 1268,
+ 2469,
+ 901,
+ 15894,
+ 1005,
+ 14982,
+ 3271,
+ 10331,
+ 4858,
+ 3635,
+ 2021,
+ 2596,
+ 835,
+ 12360,
+ 4892,
+ 12206,
+ 1704,
+ 13432,
+ 1604,
+ 9118,
+ 2341,
+ 3968,
+ 1538,
+ 5479,
+ 9936,
+ 3795,
+ 417,
+ 1359,
+ 414,
+ 3640,
+ 1569,
+ 7995,
+ 3541,
+ 11405,
+ 645,
+ 8552,
+ 635,
+ 4056,
+ 1377,
+ 16608,
+ 6124,
+ 11420,
+ 700,
+ 2007,
+ 607,
+ 12415,
+ 1578,
+ 11119,
+ 4654,
+ 13680,
+ 1708,
+ 11990,
+ 1229,
+ 7996,
+ 7297,
+ 13231,
+ 5715,
+ 2428,
+ 1159,
+ 2073,
+ 1941,
+ 6218,
+ 6121,
+ 3546,
+ 1804,
+ 8925,
+ 1802,
+ 8679,
+ 1580,
+ 13935,
+ 3576,
+ 13313,
+ 6237,
+ 6142,
+ 1130,
+ 5994,
+ 1734,
+ 14141,
+ 4662,
+ 11271,
+ 3321,
+ 12226,
+ 1551,
+ 13931,
+ 3015,
+ 5081,
+ 10464,
+ 9444,
+ 6706,
+ 1689,
+ 683,
+ 1436,
+ 1306,
+ 7212,
+ 3933,
+ 4082,
+ 2713,
+ 7793,
+ 704,
+ 15070,
+ 802,
+ 6299,
+ 5212,
+ 4337,
+ 5357,
+ 6676,
+ 541,
+ 6062,
+ 626,
+ 13651,
+ 3700,
+ 11498,
+ 2408,
+ 16156,
+ 716,
+ 12177,
+ 751,
+ 8065,
+ 11489,
+ 6314,
+ 2256,
+ 4466,
+ 496,
+ 7293,
+ 523,
+ 10213,
+ 3833,
+ 8394,
+ 3037,
+ 8403,
+ 966,
+ 14228,
+ 1880,
+ 8703,
+ 5409,
+ 16395,
+ 4863,
+ 7420,
+ 1979,
+ 6089,
+ 1230,
+ 9371,
+ 4398,
+ 14558,
+ 3363,
+ 13559,
+ 2873,
+ 13163,
+ 1465,
+ 5534,
+ 1678,
+ 13138,
+ 14771,
+ 7338,
+ 600,
+ 1318,
+ 548,
+ 4252,
+ 3539,
+ 10044,
+ 2364,
+ 10587,
+ 622,
+ 13088,
+ 669,
+ 14126,
+ 3526,
+ 5039,
+ 9784,
+ 15338,
+ 619,
+ 3115,
+ 590,
+ 16442,
+ 3013,
+ 15542,
+ 4168,
+ 15537,
+ 1611,
+ 15405,
+ 1228,
+ 16023,
+ 9299,
+ 7534,
+ 4976,
+ 1990,
+ 1213,
+ 11447,
+ 1157,
+ 12512,
+ 5519,
+ 9475,
+ 2644,
+ 7716,
+ 2034,
+ 13280,
+ 2239,
+ 16011,
+ 5093,
+ 8066,
+ 6761,
+ 10083,
+ 1413,
+ 5002,
+ 2347,
+ 12523,
+ 5975,
+ 15126,
+ 2899,
+ 18264,
+ 2289,
+ 15827,
+ 2527,
+ 16265,
+ 10254,
+ 14651,
+ 11319,
+ 1797,
+ 337,
+ 3115,
+ 397,
+ 3510,
+ 2928,
+ 4592,
+ 2670,
+ 7519,
+ 628,
+ 11415,
+ 656,
+ 5946,
+ 2435,
+ 6544,
+ 7367,
+ 8238,
+ 829,
+ 4000,
+ 863,
+ 10032,
+ 2492,
+ 16057,
+ 3551,
+ 18204,
+ 1054,
+ 6103,
+ 1454,
+ 5884,
+ 7900,
+ 18752,
+ 3468,
+ 1864,
+ 544,
+ 9198,
+ 683,
+ 11623,
+ 4160,
+ 4594,
+ 1644,
+ 3158,
+ 1157,
+ 15953,
+ 2560,
+ 12349,
+ 3733,
+ 17420,
+ 5260,
+ 6106,
+ 2004,
+ 2917,
+ 1742,
+ 16467,
+ 5257,
+ 16787,
+ 1680,
+ 17205,
+ 1759,
+ 4773,
+ 3231,
+ 7386,
+ 6035,
+ 14342,
+ 10012,
+ 4035,
+ 442,
+ 4194,
+ 458,
+ 9214,
+ 2242,
+ 7427,
+ 4217,
+ 12860,
+ 801,
+ 11186,
+ 825,
+ 12648,
+ 2084,
+ 12956,
+ 6554,
+ 9505,
+ 996,
+ 6629,
+ 985,
+ 10537,
+ 2502,
+ 15289,
+ 5006,
+ 12602,
+ 2055,
+ 15484,
+ 1653,
+ 16194,
+ 6921,
+ 14231,
+ 5790,
+ 2626,
+ 828,
+ 5615,
+ 1686,
+ 13663,
+ 5778,
+ 3668,
+ 1554,
+ 11313,
+ 2633,
+ 9770,
+ 1459,
+ 14003,
+ 4733,
+ 15897,
+ 6291,
+ 6278,
+ 1870,
+ 7910,
+ 2285,
+ 16978,
+ 4571,
+ 16576,
+ 3849,
+ 15248,
+ 2311,
+ 16023,
+ 3244,
+ 14459,
+ 17808,
+ 11847,
+ 2763,
+ 1981,
+ 1407,
+ 1400,
+ 876,
+ 4335,
+ 3547,
+ 4391,
+ 4210,
+ 5405,
+ 680,
+ 17461,
+ 781,
+ 6501,
+ 5118,
+ 8091,
+ 7677,
+ 7355,
+ 794,
+ 8333,
+ 1182,
+ 15041,
+ 3160,
+ 14928,
+ 3039,
+ 20421,
+ 880,
+ 14545,
+ 852,
+ 12337,
+ 14708,
+ 6904,
+ 1920,
+ 4225,
+ 933,
+ 8218,
+ 1087,
+ 10659,
+ 4084,
+ 10082,
+ 4533,
+ 2735,
+ 840,
+ 20657,
+ 1081,
+ 16711,
+ 5966,
+ 15873,
+ 4578,
+ 10871,
+ 2574,
+ 3773,
+ 1166,
+ 14519,
+ 4044,
+ 20699,
+ 2627,
+ 15219,
+ 2734,
+ 15274,
+ 2186,
+ 6257,
+ 3226,
+ 13125,
+ 19480,
+ 7196,
+ 930,
+ 2462,
+ 1618,
+ 4515,
+ 3092,
+ 13852,
+ 4277,
+ 10460,
+ 833,
+ 17339,
+ 810,
+ 16891,
+ 2289,
+ 15546,
+ 8217,
+ 13603,
+ 1684,
+ 3197,
+ 1834,
+ 15948,
+ 2820,
+ 15812,
+ 5327,
+ 17006,
+ 2438,
+ 16788,
+ 1326,
+ 15671,
+ 8156,
+ 11726,
+ 8556,
+ 3762,
+ 2053,
+ 9563,
+ 1317,
+ 13561,
+ 6790,
+ 12227,
+ 1936,
+ 8180,
+ 3550,
+ 13287,
+ 1778,
+ 16299,
+ 6599,
+ 16291,
+ 7758,
+ 8521,
+ 2551,
+ 7225,
+ 2645,
+ 18269,
+ 7489,
+ 16885,
+ 2248,
+ 17882,
+ 2884,
+ 17265,
+ 3328,
+ 9417,
+ 20162,
+ 11042,
+ 8320,
+ 1286,
+ 620,
+ 1431,
+ 583,
+ 5993,
+ 2289,
+ 3978,
+ 3626,
+ 5144,
+ 752,
+ 13409,
+ 830,
+ 5553,
+ 2860,
+ 11764,
+ 5908,
+ 10737,
+ 560,
+ 5446,
+ 564,
+ 13321,
+ 3008,
+ 11946,
+ 3683,
+ 19887,
+ 798,
+ 9825,
+ 728,
+ 13663,
+ 8748,
+ 7391,
+ 3053,
+ 2515,
+ 778,
+ 6050,
+ 833,
+ 6469,
+ 5074,
+ 8305,
+ 2463,
+ 6141,
+ 1865,
+ 15308,
+ 1262,
+ 14408,
+ 4547,
+ 13663,
+ 4515,
+ 3137,
+ 2983,
+ 2479,
+ 1259,
+ 15088,
+ 4647,
+ 15382,
+ 2607,
+ 14492,
+ 2392,
+ 12462,
+ 2537,
+ 7539,
+ 2949,
+ 12909,
+ 12060,
+ 5468,
+ 684,
+ 3141,
+ 722,
+ 5081,
+ 1274,
+ 12732,
+ 4200,
+ 15302,
+ 681,
+ 7819,
+ 592,
+ 6534,
+ 2021,
+ 16478,
+ 8737,
+ 13364,
+ 882,
+ 5397,
+ 899,
+ 14656,
+ 2178,
+ 14741,
+ 4227,
+ 14270,
+ 1298,
+ 13929,
+ 2029,
+ 15477,
+ 7482,
+ 15815,
+ 4572,
+ 2521,
+ 2013,
+ 5062,
+ 1804,
+ 5159,
+ 6582,
+ 7130,
+ 3597,
+ 10920,
+ 1611,
+ 11729,
+ 1708,
+ 16903,
+ 3455,
+ 16268,
+ 6640,
+ 9306,
+ 1007,
+ 9369,
+ 2106,
+ 19182,
+ 5037,
+ 12441,
+ 4269,
+ 15919,
+ 1332,
+ 15357,
+ 3512,
+ 11898,
+ 14141,
+ 16101,
+ 6854,
+ 2010,
+ 737,
+ 3779,
+ 861,
+ 11454,
+ 2880,
+ 3564,
+ 3540,
+ 9057,
+ 1241,
+ 12391,
+ 896,
+ 8546,
+ 4629,
+ 11561,
+ 5776,
+ 8129,
+ 589,
+ 8218,
+ 588,
+ 18728,
+ 3755,
+ 12973,
+ 3149,
+ 15729,
+ 758,
+ 16634,
+ 754,
+ 15222,
+ 11138,
+ 15871,
+ 2208,
+ 4673,
+ 610,
+ 10218,
+ 678,
+ 15257,
+ 4146,
+ 5729,
+ 3327,
+ 8377,
+ 1670,
+ 19862,
+ 2321,
+ 15450,
+ 5511,
+ 14054,
+ 5481,
+ 5728,
+ 2888,
+ 7580,
+ 1346,
+ 14384,
+ 5325,
+ 16236,
+ 3950,
+ 15118,
+ 3744,
+ 15306,
+ 1435,
+ 14597,
+ 4070,
+ 12301,
+ 15696,
+ 7617,
+ 1699,
+ 2170,
+ 884,
+ 4459,
+ 4567,
+ 18094,
+ 3306,
+ 12742,
+ 815,
+ 14926,
+ 907,
+ 15016,
+ 4281,
+ 15518,
+ 8368,
+ 17994,
+ 1087,
+ 2358,
+ 865,
+ 16281,
+ 3787,
+ 15679,
+ 4596,
+ 16356,
+ 1534,
+ 16584,
+ 2210,
+ 16833,
+ 9697,
+ 15929,
+ 4513,
+ 3277,
+ 1085,
+ 9643,
+ 2187,
+ 11973,
+ 6068,
+ 9199,
+ 4462,
+ 8955,
+ 1629,
+ 10289,
+ 3062,
+ 16481,
+ 5155,
+ 15466,
+ 7066,
+ 13678,
+ 2543,
+ 5273,
+ 2277,
+ 16746,
+ 6213,
+ 16655,
+ 3408,
+ 20304,
+ 3363,
+ 18688,
+ 1985,
+ 14172,
+ 12867,
+ 15154,
+ 15703,
+ 4473,
+ 1020,
+ 1681,
+ 886,
+ 4311,
+ 4301,
+ 8952,
+ 3657,
+ 5893,
+ 1147,
+ 11647,
+ 1452,
+ 15886,
+ 2227,
+ 4582,
+ 6644,
+ 6929,
+ 1205,
+ 6220,
+ 799,
+ 12415,
+ 3409,
+ 15968,
+ 3877,
+ 19859,
+ 2109,
+ 9689,
+ 2141,
+ 14742,
+ 8830,
+ 14480,
+ 2599,
+ 1817,
+ 1238,
+ 7771,
+ 813,
+ 19079,
+ 4410,
+ 5554,
+ 2064,
+ 3687,
+ 2844,
+ 17435,
+ 2256,
+ 16697,
+ 4486,
+ 16199,
+ 5388,
+ 8028,
+ 2763,
+ 3405,
+ 2119,
+ 17426,
+ 5477,
+ 13698,
+ 2786,
+ 19879,
+ 2720,
+ 9098,
+ 3880,
+ 18172,
+ 4833,
+ 17336,
+ 12207,
+ 5116,
+ 996,
+ 4935,
+ 988,
+ 9888,
+ 3081,
+ 6014,
+ 5371,
+ 15881,
+ 1667,
+ 8405,
+ 1183,
+ 15087,
+ 2366,
+ 19777,
+ 7002,
+ 11963,
+ 1562,
+ 7279,
+ 1128,
+ 16859,
+ 1532,
+ 15762,
+ 5381,
+ 14708,
+ 2065,
+ 20105,
+ 2155,
+ 17158,
+ 8245,
+ 17911,
+ 6318,
+ 5467,
+ 1504,
+ 4100,
+ 2574,
+ 17421,
+ 6810,
+ 5673,
+ 2888,
+ 16636,
+ 3382,
+ 8975,
+ 1831,
+ 20159,
+ 4737,
+ 19550,
+ 7294,
+ 6658,
+ 2781,
+ 11472,
+ 3321,
+ 19397,
+ 5054,
+ 18878,
+ 4722,
+ 16439,
+ 2373,
+ 20430,
+ 4386,
+ 11353,
+ 26526,
+ 11593,
+ 3068,
+ 2866,
+ 1566,
+ 5108,
+ 1070,
+ 9614,
+ 4915,
+ 4939,
+ 3536,
+ 7541,
+ 878,
+ 20717,
+ 851,
+ 6938,
+ 4395,
+ 16799,
+ 7733,
+ 10137,
+ 1019,
+ 9845,
+ 964,
+ 15494,
+ 3955,
+ 15459,
+ 3430,
+ 18863,
+ 982,
+ 20120,
+ 963,
+ 16876,
+ 12887,
+ 14334,
+ 4200,
+ 6599,
+ 1220,
+ 9222,
+ 814,
+ 16942,
+ 5134,
+ 5661,
+ 4898,
+ 5488,
+ 1798,
+ 20258,
+ 3962,
+ 17005,
+ 6178,
+ 17929,
+ 5929,
+ 9365,
+ 3420,
+ 7474,
+ 1971,
+ 19537,
+ 5177,
+ 19003,
+ 3006,
+ 16454,
+ 3788,
+ 16070,
+ 2367,
+ 8664,
+ 2743,
+ 9445,
+ 26358,
+ 10856,
+ 1287,
+ 3555,
+ 1009,
+ 5606,
+ 3622,
+ 19453,
+ 5512,
+ 12453,
+ 797,
+ 20634,
+ 911,
+ 15427,
+ 3066,
+ 17037,
+ 10275,
+ 18883,
+ 2633,
+ 3913,
+ 1268,
+ 19519,
+ 3371,
+ 18052,
+ 5230,
+ 19291,
+ 1678,
+ 19508,
+ 3172,
+ 18072,
+ 10754,
+ 16625,
+ 6845,
+ 3134,
+ 2298,
+ 10869,
+ 2437,
+ 15580,
+ 6913,
+ 12597,
+ 3381,
+ 11116,
+ 3297,
+ 16762,
+ 2424,
+ 18853,
+ 6715,
+ 17171,
+ 9887,
+ 12743,
+ 2605,
+ 8937,
+ 3140,
+ 19033,
+ 7764,
+ 18347,
+ 3880,
+ 20475,
+ 3682,
+ 19602,
+ 3380,
+ 13044,
+ 19373,
+ 10526,
+ 23124
};
@@ -12385,892 +12385,890 @@ static const Word32 table_gain_MR475[MR475_VQ_SIZE * 4] =
#define VQ_SIZE_HIGHRATES 128
static const Word32 table_gain_highrates[VQ_SIZE_HIGHRATES * 4] =
{
- /*
- * Note: every 4th value (qua_ener) contains the original values from IS641
- * to ensure bit-exactness; however, they are not exactly the
- * rounded value of (20*log10(g_fac))
- */ /*
+/*
+ * Note: every 4th value (qua_ener) contains the original values from IS641
+ * to ensure bit-exactness; however, they are not exactly the
+ * rounded value of (20*log10(g_fac))
+ */ /*
* g_pit,
* g_fac,
* qua_ener_MR122,
* qua_ener
*/ 577,
- 662,
- - 2692,
- - 16214,
- 806,
- 1836,
- - 1185,
- - 7135,
- 3109,
- 1052,
- - 2008,
- - 12086,
- 4181,
- 1387,
- - 1600,
- - 9629,
- 2373,
- 1425,
- - 1560,
- - 9394,
- 3248,
- 1985,
- - 1070,
- - 6442,
- 1827,
- 2320,
- - 840,
- - 5056,
- 941,
- 3314,
- - 313,
- - 1885,
- 2351,
- 2977,
- - 471,
- - 2838,
- 3616,
- 2420,
- - 777,
- - 4681,
- 3451,
- 3096,
- - 414,
- - 2490,
- 2955,
- 4301,
- 72,
- 434,
- 1848,
- 4500,
- 139,
- 836,
- 3884,
- 5416,
- 413,
- 2484,
- 1187,
- 7210,
- 835,
- 5030,
- 3083,
- 9000,
- 1163,
- 7002,
- 7384,
- 883,
- - 2267,
- - 13647,
- 5962,
- 1506,
- - 1478,
- - 8900,
- 5155,
- 2134,
- - 963,
- - 5800,
- 7944,
- 2009,
- - 1052,
- - 6335,
- 6507,
- 2250,
- - 885,
- - 5327,
- 7670,
- 2752,
- - 588,
- - 3537,
- 5952,
- 3016,
- - 452,
- - 2724,
- 4898,
- 3764,
- - 125,
- - 751,
- 6989,
- 3588,
- - 196,
- - 1177,
- 8174,
- 3978,
- - 43,
- - 260,
- 6064,
- 4404,
- 107,
- 645,
- 7709,
- 5087,
- 320,
- 1928,
- 5523,
- 6021,
- 569,
- 3426,
- 7769,
- 7126,
- 818,
- 4926,
- 6060,
- 7938,
- 977,
- 5885,
- 5594,
- 11487,
- 1523,
- 9172,
- 10581,
- 1356,
- - 1633,
- - 9831,
- 9049,
- 1597,
- - 1391,
- - 8380,
- 9794,
- 2035,
- - 1033,
- - 6220,
- 8946,
- 2415,
- - 780,
- - 4700,
- 10296,
- 2584,
- - 681,
- - 4099,
- 9407,
- 2734,
- - 597,
- - 3595,
- 8700,
- 3218,
- - 356,
- - 2144,
- 9757,
- 3395,
- - 277,
- - 1669,
- 10177,
- 3892,
- - 75,
- - 454,
- 9170,
- 4528,
- 148,
- 891,
- 10152,
- 5004,
- 296,
- 1781,
- 9114,
- 5735,
- 497,
- 2993,
- 10500,
- 6266,
- 628,
- 3782,
- 10110,
- 7631,
- 919,
- 5534,
- 8844,
- 8727,
- 1117,
- 6728,
- 8956,
- 12496,
- 1648,
- 9921,
- 12924,
- 976,
- - 2119,
- - 12753,
- 11435,
- 1755,
- - 1252,
- - 7539,
- 12138,
- 2328,
- - 835,
- - 5024,
- 11388,
- 2368,
- - 810,
- - 4872,
- 10700,
- 3064,
- - 429,
- - 2580,
- 12332,
- 2861,
- - 530,
- - 3192,
- 11722,
- 3327,
- - 307,
- - 1848,
- 11270,
- 3700,
- - 150,
- - 904,
- 10861,
- 4413,
- 110,
- 663,
- 12082,
- 4533,
- 150,
- 902,
- 11283,
- 5205,
- 354,
- 2132,
- 11960,
- 6305,
- 637,
- 3837,
- 11167,
- 7534,
- 900,
- 5420,
- 12128,
- 8329,
- 1049,
- 6312,
- 10969,
- 10777,
- 1429,
- 8604,
- 10300,
- 17376,
- 2135,
- 12853,
- 13899,
- 1681,
- - 1316,
- - 7921,
- 12580,
- 2045,
- - 1026,
- - 6179,
- 13265,
- 2439,
- - 766,
- - 4610,
- 14033,
- 2989,
- - 465,
- - 2802,
- 13452,
- 3098,
- - 413,
- - 2482,
- 12396,
- 3658,
- - 167,
- - 1006,
- 13510,
- 3780,
- - 119,
- - 713,
- 12880,
- 4272,
- 62,
- 374,
- 13533,
- 4861,
- 253,
- 1523,
- 12667,
- 5457,
- 424,
- 2552,
- 13854,
- 6106,
- 590,
- 3551,
- 13031,
- 6483,
- 678,
- 4084,
- 13557,
- 7721,
- 937,
- 5639,
- 12957,
- 9311,
- 1213,
- 7304,
- 13714,
- 11551,
- 1532,
- 9221,
- 12591,
- 15206,
- 1938,
- 11667,
- 15113,
- 1540,
- - 1445,
- - 8700,
- 15072,
- 2333,
- - 832,
- - 5007,
- 14527,
- 2511,
- - 723,
- - 4352,
- 14692,
- 3199,
- - 365,
- - 2197,
- 15382,
- 3560,
- - 207,
- - 1247,
- 14133,
- 3960,
- - 50,
- - 300,
- 15102,
- 4236,
- 50,
- 298,
- 14332,
- 4824,
- 242,
- 1454,
- 14846,
- 5451,
- 422,
- 2542,
- 15306,
- 6083,
- 584,
- 3518,
- 14329,
- 6888,
- 768,
- 4623,
- 15060,
- 7689,
- 930,
- 5602,
- 14406,
- 9426,
- 1231,
- 7413,
- 15387,
- 9741,
- 1280,
- 7706,
- 14824,
- 14271,
- 1844,
- 11102,
- 13600,
- 24939,
- 2669,
- 16067,
- 16396,
- 1969,
- - 1082,
- - 6517,
- 16817,
- 2832,
- - 545,
- - 3283,
- 15713,
- 2843,
- - 539,
- - 3248,
- 16104,
- 3336,
- - 303,
- - 1825,
- 16384,
- 3963,
- - 49,
- - 294,
- 16940,
- 4579,
- 165,
- 992,
- 15711,
- 4599,
- 171,
- 1030,
- 16222,
- 5448,
- 421,
- 2537,
- 16832,
- 6382,
- 655,
- 3945,
- 15745,
- 7141,
- 821,
- 4944,
- 16326,
- 7469,
- 888,
- 5343,
- 16611,
- 8624,
- 1100,
- 6622,
- 17028,
- 10418,
- 1379,
- 8303,
- 15905,
- 11817,
- 1565,
- 9423,
- 16878,
- 14690,
- 1887,
- 11360,
- 16515,
- 20870,
- 2406,
- 14483,
- 18142,
- 2083,
- - 999,
- - 6013,
- 19401,
- 3178,
- - 375,
- - 2257,
- 17508,
- 3426,
- - 264,
- - 1589,
- 20054,
- 4027,
- - 25,
- - 151,
- 18069,
- 4249,
- 54,
- 326,
- 18952,
- 5066,
- 314,
- 1890,
- 17711,
- 5402,
- 409,
- 2461,
- 19835,
- 6192,
- 610,
- 3676,
- 17950,
- 7014,
- 795,
- 4784,
- 21318,
- 7877,
- 966,
- 5816,
- 17910,
- 9289,
- 1210,
- 7283,
- 19144,
- 9290,
- 1210,
- 7284,
- 20517,
- 11381,
- 1510,
- 9089,
- 18075,
- 14485,
- 1866,
- 11234,
- 19999,
- 17882,
- 2177,
- 13108,
- 18842,
- 32764,
- 3072,
- 18494
+ 662,
+ - 2692,
+ - 16214,
+ 806,
+ 1836,
+ - 1185,
+ - 7135,
+ 3109,
+ 1052,
+ - 2008,
+ - 12086,
+ 4181,
+ 1387,
+ - 1600,
+ - 9629,
+ 2373,
+ 1425,
+ - 1560,
+ - 9394,
+ 3248,
+ 1985,
+ - 1070,
+ - 6442,
+ 1827,
+ 2320,
+ - 840,
+ - 5056,
+ 941,
+ 3314,
+ - 313,
+ - 1885,
+ 2351,
+ 2977,
+ - 471,
+ - 2838,
+ 3616,
+ 2420,
+ - 777,
+ - 4681,
+ 3451,
+ 3096,
+ - 414,
+ - 2490,
+ 2955,
+ 4301,
+ 72,
+ 434,
+ 1848,
+ 4500,
+ 139,
+ 836,
+ 3884,
+ 5416,
+ 413,
+ 2484,
+ 1187,
+ 7210,
+ 835,
+ 5030,
+ 3083,
+ 9000,
+ 1163,
+ 7002,
+ 7384,
+ 883,
+ - 2267,
+ - 13647,
+ 5962,
+ 1506,
+ - 1478,
+ - 8900,
+ 5155,
+ 2134,
+ - 963,
+ - 5800,
+ 7944,
+ 2009,
+ - 1052,
+ - 6335,
+ 6507,
+ 2250,
+ - 885,
+ - 5327,
+ 7670,
+ 2752,
+ - 588,
+ - 3537,
+ 5952,
+ 3016,
+ - 452,
+ - 2724,
+ 4898,
+ 3764,
+ - 125,
+ - 751,
+ 6989,
+ 3588,
+ - 196,
+ - 1177,
+ 8174,
+ 3978,
+ - 43,
+ - 260,
+ 6064,
+ 4404,
+ 107,
+ 645,
+ 7709,
+ 5087,
+ 320,
+ 1928,
+ 5523,
+ 6021,
+ 569,
+ 3426,
+ 7769,
+ 7126,
+ 818,
+ 4926,
+ 6060,
+ 7938,
+ 977,
+ 5885,
+ 5594,
+ 11487,
+ 1523,
+ 9172,
+ 10581,
+ 1356,
+ - 1633,
+ - 9831,
+ 9049,
+ 1597,
+ - 1391,
+ - 8380,
+ 9794,
+ 2035,
+ - 1033,
+ - 6220,
+ 8946,
+ 2415,
+ - 780,
+ - 4700,
+ 10296,
+ 2584,
+ - 681,
+ - 4099,
+ 9407,
+ 2734,
+ - 597,
+ - 3595,
+ 8700,
+ 3218,
+ - 356,
+ - 2144,
+ 9757,
+ 3395,
+ - 277,
+ - 1669,
+ 10177,
+ 3892,
+ - 75,
+ - 454,
+ 9170,
+ 4528,
+ 148,
+ 891,
+ 10152,
+ 5004,
+ 296,
+ 1781,
+ 9114,
+ 5735,
+ 497,
+ 2993,
+ 10500,
+ 6266,
+ 628,
+ 3782,
+ 10110,
+ 7631,
+ 919,
+ 5534,
+ 8844,
+ 8727,
+ 1117,
+ 6728,
+ 8956,
+ 12496,
+ 1648,
+ 9921,
+ 12924,
+ 976,
+ - 2119,
+ - 12753,
+ 11435,
+ 1755,
+ - 1252,
+ - 7539,
+ 12138,
+ 2328,
+ - 835,
+ - 5024,
+ 11388,
+ 2368,
+ - 810,
+ - 4872,
+ 10700,
+ 3064,
+ - 429,
+ - 2580,
+ 12332,
+ 2861,
+ - 530,
+ - 3192,
+ 11722,
+ 3327,
+ - 307,
+ - 1848,
+ 11270,
+ 3700,
+ - 150,
+ - 904,
+ 10861,
+ 4413,
+ 110,
+ 663,
+ 12082,
+ 4533,
+ 150,
+ 902,
+ 11283,
+ 5205,
+ 354,
+ 2132,
+ 11960,
+ 6305,
+ 637,
+ 3837,
+ 11167,
+ 7534,
+ 900,
+ 5420,
+ 12128,
+ 8329,
+ 1049,
+ 6312,
+ 10969,
+ 10777,
+ 1429,
+ 8604,
+ 10300,
+ 17376,
+ 2135,
+ 12853,
+ 13899,
+ 1681,
+ - 1316,
+ - 7921,
+ 12580,
+ 2045,
+ - 1026,
+ - 6179,
+ 13265,
+ 2439,
+ - 766,
+ - 4610,
+ 14033,
+ 2989,
+ - 465,
+ - 2802,
+ 13452,
+ 3098,
+ - 413,
+ - 2482,
+ 12396,
+ 3658,
+ - 167,
+ - 1006,
+ 13510,
+ 3780,
+ - 119,
+ - 713,
+ 12880,
+ 4272,
+ 62,
+ 374,
+ 13533,
+ 4861,
+ 253,
+ 1523,
+ 12667,
+ 5457,
+ 424,
+ 2552,
+ 13854,
+ 6106,
+ 590,
+ 3551,
+ 13031,
+ 6483,
+ 678,
+ 4084,
+ 13557,
+ 7721,
+ 937,
+ 5639,
+ 12957,
+ 9311,
+ 1213,
+ 7304,
+ 13714,
+ 11551,
+ 1532,
+ 9221,
+ 12591,
+ 15206,
+ 1938,
+ 11667,
+ 15113,
+ 1540,
+ - 1445,
+ - 8700,
+ 15072,
+ 2333,
+ - 832,
+ - 5007,
+ 14527,
+ 2511,
+ - 723,
+ - 4352,
+ 14692,
+ 3199,
+ - 365,
+ - 2197,
+ 15382,
+ 3560,
+ - 207,
+ - 1247,
+ 14133,
+ 3960,
+ - 50,
+ - 300,
+ 15102,
+ 4236,
+ 50,
+ 298,
+ 14332,
+ 4824,
+ 242,
+ 1454,
+ 14846,
+ 5451,
+ 422,
+ 2542,
+ 15306,
+ 6083,
+ 584,
+ 3518,
+ 14329,
+ 6888,
+ 768,
+ 4623,
+ 15060,
+ 7689,
+ 930,
+ 5602,
+ 14406,
+ 9426,
+ 1231,
+ 7413,
+ 15387,
+ 9741,
+ 1280,
+ 7706,
+ 14824,
+ 14271,
+ 1844,
+ 11102,
+ 13600,
+ 24939,
+ 2669,
+ 16067,
+ 16396,
+ 1969,
+ - 1082,
+ - 6517,
+ 16817,
+ 2832,
+ - 545,
+ - 3283,
+ 15713,
+ 2843,
+ - 539,
+ - 3248,
+ 16104,
+ 3336,
+ - 303,
+ - 1825,
+ 16384,
+ 3963,
+ - 49,
+ - 294,
+ 16940,
+ 4579,
+ 165,
+ 992,
+ 15711,
+ 4599,
+ 171,
+ 1030,
+ 16222,
+ 5448,
+ 421,
+ 2537,
+ 16832,
+ 6382,
+ 655,
+ 3945,
+ 15745,
+ 7141,
+ 821,
+ 4944,
+ 16326,
+ 7469,
+ 888,
+ 5343,
+ 16611,
+ 8624,
+ 1100,
+ 6622,
+ 17028,
+ 10418,
+ 1379,
+ 8303,
+ 15905,
+ 11817,
+ 1565,
+ 9423,
+ 16878,
+ 14690,
+ 1887,
+ 11360,
+ 16515,
+ 20870,
+ 2406,
+ 14483,
+ 18142,
+ 2083,
+ - 999,
+ - 6013,
+ 19401,
+ 3178,
+ - 375,
+ - 2257,
+ 17508,
+ 3426,
+ - 264,
+ - 1589,
+ 20054,
+ 4027,
+ - 25,
+ - 151,
+ 18069,
+ 4249,
+ 54,
+ 326,
+ 18952,
+ 5066,
+ 314,
+ 1890,
+ 17711,
+ 5402,
+ 409,
+ 2461,
+ 19835,
+ 6192,
+ 610,
+ 3676,
+ 17950,
+ 7014,
+ 795,
+ 4784,
+ 21318,
+ 7877,
+ 966,
+ 5816,
+ 17910,
+ 9289,
+ 1210,
+ 7283,
+ 19144,
+ 9290,
+ 1210,
+ 7284,
+ 20517,
+ 11381,
+ 1510,
+ 9089,
+ 18075,
+ 14485,
+ 1866,
+ 11234,
+ 19999,
+ 17882,
+ 2177,
+ 13108,
+ 18842,
+ 32764,
+ 3072,
+ 18494
};
/* table used in 'low' rates: MR475, MR515, MR59 */
#define VQ_SIZE_LOWRATES 64
static const Word32 table_gain_lowrates[VQ_SIZE_LOWRATES * 4] =
{
- /*
- * g_pit,
- * g_fac,
- * qua_ener_MR122,
- * qua_ener
- */ 10813,
- 28753,
- 2879,
- 17333,
- 20480,
- 2785,
- - 570,
- - 3431,
- 18841,
- 6594,
- 703,
- 4235,
- 6225,
- 7413,
- 876,
- 5276,
- 17203,
- 10444,
- 1383,
- 8325,
- 21626,
- 1269,
- - 1731,
- - 10422,
- 21135,
- 4423,
- 113,
- 683,
- 11304,
- 1556,
- - 1430,
- - 8609,
- 19005,
- 12820,
- 1686,
- 10148,
- 17367,
- 2498,
- - 731,
- - 4398,
- 17858,
- 4833,
- 244,
- 1472,
- 9994,
- 2498,
- - 731,
- - 4398,
- 17530,
- 7864,
- 964,
- 5802,
- 14254,
- 1884,
- - 1147,
- - 6907,
- 15892,
- 3153,
- - 387,
- - 2327,
- 6717,
- 1802,
- - 1213,
- - 7303,
- 18186,
- 20193,
- 2357,
- 14189,
- 18022,
- 3031,
- - 445,
- - 2678,
- 16711,
- 5857,
- 528,
- 3181,
- 8847,
- 4014,
- - 30,
- - 180,
- 15892,
- 8970,
- 1158,
- 6972,
- 18022,
- 1392,
- - 1594,
- - 9599,
- 16711,
- 4096,
- 0,
- 0,
- 8192,
- 655,
- - 2708,
- - 16305,
- 15237,
- 13926,
- 1808,
- 10884,
- 14254,
- 3112,
- - 406,
- - 2444,
- 14090,
- 4669,
- 193,
- 1165,
- 5406,
- 2703,
- - 614,
- - 3697,
- 13434,
- 6553,
- 694,
- 4180,
- 12451,
- 901,
- - 2237,
- - 13468,
- 12451,
- 2662,
- - 637,
- - 3833,
- 3768,
- 655,
- - 2708,
- - 16305,
- 14745,
- 23511,
- 2582,
- 15543,
- 19169,
- 2457,
- - 755,
- - 4546,
- 20152,
- 5079,
- 318,
- 1913,
- 6881,
- 4096,
- 0,
- 0,
- 20480,
- 8560,
- 1089,
- 6556,
- 19660,
- 737,
- - 2534,
- - 15255,
- 19005,
- 4259,
- 58,
- 347,
- 7864,
- 2088,
- - 995,
- - 5993,
- 11468,
- 12288,
- 1623,
- 9771,
- 15892,
- 1474,
- - 1510,
- - 9090,
- 15728,
- 4628,
- 180,
- 1086,
- 9175,
- 1433,
- - 1552,
- - 9341,
- 16056,
- 7004,
- 793,
- 4772,
- 14827,
- 737,
- - 2534,
- - 15255,
- 15073,
- 2252,
- - 884,
- - 5321,
- 5079,
- 1228,
- - 1780,
- - 10714,
- 13271,
- 17326,
- 2131,
- 12827,
- 16547,
- 2334,
- - 831,
- - 5002,
- 15073,
- 5816,
- 518,
- 3118,
- 3932,
- 3686,
- - 156,
- - 938,
- 14254,
- 8601,
- 1096,
- 6598,
- 16875,
- 778,
- - 2454,
- - 14774,
- 15073,
- 3809,
- - 107,
- - 646,
- 6062,
- 614,
- - 2804,
- - 16879,
- 9338,
- 9256,
- 1204,
- 7251,
- 13271,
- 1761,
- - 1247,
- - 7508,
- 13271,
- 3522,
- - 223,
- - 1343,
- 2457,
- 1966,
- - 1084,
- - 6529,
- 11468,
- 5529,
- 443,
- 2668,
- 10485,
- 737,
- - 2534,
- - 15255,
- 11632,
- 3194,
- - 367,
- - 2212,
- 1474,
- 778,
- - 2454,
- - 14774
+/*
+ * g_pit,
+ * g_fac,
+ * qua_ener_MR122,
+ * qua_ener
+ */ 10813,
+ 28753,
+ 2879,
+ 17333,
+ 20480,
+ 2785,
+ - 570,
+ - 3431,
+ 18841,
+ 6594,
+ 703,
+ 4235,
+ 6225,
+ 7413,
+ 876,
+ 5276,
+ 17203,
+ 10444,
+ 1383,
+ 8325,
+ 21626,
+ 1269,
+ - 1731,
+ - 10422,
+ 21135,
+ 4423,
+ 113,
+ 683,
+ 11304,
+ 1556,
+ - 1430,
+ - 8609,
+ 19005,
+ 12820,
+ 1686,
+ 10148,
+ 17367,
+ 2498,
+ - 731,
+ - 4398,
+ 17858,
+ 4833,
+ 244,
+ 1472,
+ 9994,
+ 2498,
+ - 731,
+ - 4398,
+ 17530,
+ 7864,
+ 964,
+ 5802,
+ 14254,
+ 1884,
+ - 1147,
+ - 6907,
+ 15892,
+ 3153,
+ - 387,
+ - 2327,
+ 6717,
+ 1802,
+ - 1213,
+ - 7303,
+ 18186,
+ 20193,
+ 2357,
+ 14189,
+ 18022,
+ 3031,
+ - 445,
+ - 2678,
+ 16711,
+ 5857,
+ 528,
+ 3181,
+ 8847,
+ 4014,
+ - 30,
+ - 180,
+ 15892,
+ 8970,
+ 1158,
+ 6972,
+ 18022,
+ 1392,
+ - 1594,
+ - 9599,
+ 16711,
+ 4096,
+ 0,
+ 0,
+ 8192,
+ 655,
+ - 2708,
+ - 16305,
+ 15237,
+ 13926,
+ 1808,
+ 10884,
+ 14254,
+ 3112,
+ - 406,
+ - 2444,
+ 14090,
+ 4669,
+ 193,
+ 1165,
+ 5406,
+ 2703,
+ - 614,
+ - 3697,
+ 13434,
+ 6553,
+ 694,
+ 4180,
+ 12451,
+ 901,
+ - 2237,
+ - 13468,
+ 12451,
+ 2662,
+ - 637,
+ - 3833,
+ 3768,
+ 655,
+ - 2708,
+ - 16305,
+ 14745,
+ 23511,
+ 2582,
+ 15543,
+ 19169,
+ 2457,
+ - 755,
+ - 4546,
+ 20152,
+ 5079,
+ 318,
+ 1913,
+ 6881,
+ 4096,
+ 0,
+ 0,
+ 20480,
+ 8560,
+ 1089,
+ 6556,
+ 19660,
+ 737,
+ - 2534,
+ - 15255,
+ 19005,
+ 4259,
+ 58,
+ 347,
+ 7864,
+ 2088,
+ - 995,
+ - 5993,
+ 11468,
+ 12288,
+ 1623,
+ 9771,
+ 15892,
+ 1474,
+ - 1510,
+ - 9090,
+ 15728,
+ 4628,
+ 180,
+ 1086,
+ 9175,
+ 1433,
+ - 1552,
+ - 9341,
+ 16056,
+ 7004,
+ 793,
+ 4772,
+ 14827,
+ 737,
+ - 2534,
+ - 15255,
+ 15073,
+ 2252,
+ - 884,
+ - 5321,
+ 5079,
+ 1228,
+ - 1780,
+ - 10714,
+ 13271,
+ 17326,
+ 2131,
+ 12827,
+ 16547,
+ 2334,
+ - 831,
+ - 5002,
+ 15073,
+ 5816,
+ 518,
+ 3118,
+ 3932,
+ 3686,
+ - 156,
+ - 938,
+ 14254,
+ 8601,
+ 1096,
+ 6598,
+ 16875,
+ 778,
+ - 2454,
+ - 14774,
+ 15073,
+ 3809,
+ - 107,
+ - 646,
+ 6062,
+ 614,
+ - 2804,
+ - 16879,
+ 9338,
+ 9256,
+ 1204,
+ 7251,
+ 13271,
+ 1761,
+ - 1247,
+ - 7508,
+ 13271,
+ 3522,
+ - 223,
+ - 1343,
+ 2457,
+ 1966,
+ - 1084,
+ - 6529,
+ 11468,
+ 5529,
+ 443,
+ 2668,
+ 10485,
+ 737,
+ - 2534,
+ - 15255,
+ 11632,
+ 3194,
+ - 367,
+ - 2212,
+ 1474,
+ 778,
+ - 2454,
+ - 14774
};
static const Word32 inter6[61] =
{
- 29443,
- 28346,
- 25207,
- 20449,
- 14701,
- 8693,
- 3143,
- - 1352,
- - 4402,
- - 5865,
- - 5850,
- - 4673,
- - 2783,
- - 672,
- 1211,
- 2536,
- 3130,
- 2991,
- 2259,
- 1170,
- 0,
- - 1001,
- - 1652,
- - 1868,
- - 1666,
- - 1147,
- - 464,
- 218,
- 756,
- 1060,
- 1099,
- 904,
- 550,
- 135,
- - 245,
- - 514,
- - 634,
- - 602,
- - 451,
- - 231,
- 0,
- 191,
- 308,
- 340,
- 296,
- 198,
- 78,
- - 36,
- - 120,
- - 163,
- - 165,
- - 132,
- - 79,
- - 19,
- 34,
- 73,
- 91,
- 89,
- 70,
- 38,
- 0
+ 29443,
+ 28346,
+ 25207,
+ 20449,
+ 14701,
+ 8693,
+ 3143,
+ - 1352,
+ - 4402,
+ - 5865,
+ - 5850,
+ - 4673,
+ - 2783,
+ - 672,
+ 1211,
+ 2536,
+ 3130,
+ 2991,
+ 2259,
+ 1170,
+ 0,
+ - 1001,
+ - 1652,
+ - 1868,
+ - 1666,
+ - 1147,
+ - 464,
+ 218,
+ 756,
+ 1060,
+ 1099,
+ 904,
+ 550,
+ 135,
+ - 245,
+ - 514,
+ - 634,
+ - 602,
+ - 451,
+ - 231,
+ 0,
+ 191,
+ 308,
+ 340,
+ 296,
+ 198,
+ 78,
+ - 36,
+ - 120,
+ - 163,
+ - 165,
+ - 132,
+ - 79,
+ - 19,
+ 34,
+ 73,
+ 91,
+ 89,
+ 70,
+ 38,
+ 0
};
/*
* window for non-MR122 modesm; uses 40 samples lookahead
* used only in BuildCNParam
*/
-static const Word32 window_200_40[L_WINDOW] =
-{
- 2621, 2623, 2629, 2638, 2651, 2668, 2689, 2713, 2741, 2772,
- 2808, 2847, 2890, 2936, 2986, 3040, 3097, 3158, 3223, 3291,
- 3363, 3438, 3517, 3599, 3685, 3774, 3867, 3963, 4063, 4166,
- 4272, 4382, 4495, 4611, 4731, 4853, 4979, 5108, 5240, 5376,
- 5514, 5655, 5800, 5947, 6097, 6250, 6406, 6565, 6726, 6890,
- 7057, 7227, 7399, 7573, 7750, 7930, 8112, 8296, 8483, 8672,
- 8863, 9057, 9252, 9450, 9650, 9852, 10055, 10261, 10468, 10677,
- 10888, 11101, 11315, 11531, 11748, 11967, 12187, 12409, 12632, 12856,
- 13082, 13308, 13536, 13764, 13994, 14225, 14456, 14688, 14921, 15155,
- 15389, 15624, 15859, 16095, 16331, 16568, 16805, 17042, 17279, 17516,
- 17754, 17991, 18228, 18465, 18702, 18939, 19175, 19411, 19647, 19882,
- 20117, 20350, 20584, 20816, 21048, 21279, 21509, 21738, 21967, 22194,
- 22420, 22644, 22868, 23090, 23311, 23531, 23749, 23965, 24181, 24394,
- 24606, 24816, 25024, 25231, 25435, 25638, 25839, 26037, 26234, 26428,
- 26621, 26811, 26999, 27184, 27368, 27548, 27727, 27903, 28076, 28247,
- 28415, 28581, 28743, 28903, 29061, 29215, 29367, 29515, 29661, 29804,
- 29944, 30081, 30214, 30345, 30472, 30597, 30718, 30836, 30950, 31062,
- 31170, 31274, 31376, 31474, 31568, 31659, 31747, 31831, 31911, 31988,
- 32062, 32132, 32198, 32261, 32320, 32376, 32428, 32476, 32521, 32561,
- 32599, 32632, 32662, 32688, 32711, 32729, 32744, 32755, 32763, 32767,
- 32767, 32741, 32665, 32537, 32359, 32129, 31850, 31521, 31143, 30716,
- 30242, 29720, 29151, 28538, 27879, 27177, 26433, 25647, 24821, 23957,
- 23055, 22117, 21145, 20139, 19102, 18036, 16941, 15820, 14674, 13505,
- 12315, 11106, 9879, 8637, 7381, 6114, 4838, 3554, 2264, 971
-};
+static const Word32 window_200_40[L_WINDOW] = {
+ 2621, 2623, 2629, 2638, 2651, 2668, 2689, 2713, 2741, 2772,
+ 2808, 2847, 2890, 2936, 2986, 3040, 3097, 3158, 3223, 3291,
+ 3363, 3438, 3517, 3599, 3685, 3774, 3867, 3963, 4063, 4166,
+ 4272, 4382, 4495, 4611, 4731, 4853, 4979, 5108, 5240, 5376,
+ 5514, 5655, 5800, 5947, 6097, 6250, 6406, 6565, 6726, 6890,
+ 7057, 7227, 7399, 7573, 7750, 7930, 8112, 8296, 8483, 8672,
+ 8863, 9057, 9252, 9450, 9650, 9852, 10055, 10261, 10468, 10677,
+ 10888, 11101, 11315, 11531, 11748, 11967, 12187, 12409, 12632, 12856,
+ 13082, 13308, 13536, 13764, 13994, 14225, 14456, 14688, 14921, 15155,
+ 15389, 15624, 15859, 16095, 16331, 16568, 16805, 17042, 17279, 17516,
+ 17754, 17991, 18228, 18465, 18702, 18939, 19175, 19411, 19647, 19882,
+ 20117, 20350, 20584, 20816, 21048, 21279, 21509, 21738, 21967, 22194,
+ 22420, 22644, 22868, 23090, 23311, 23531, 23749, 23965, 24181, 24394,
+ 24606, 24816, 25024, 25231, 25435, 25638, 25839, 26037, 26234, 26428,
+ 26621, 26811, 26999, 27184, 27368, 27548, 27727, 27903, 28076, 28247,
+ 28415, 28581, 28743, 28903, 29061, 29215, 29367, 29515, 29661, 29804,
+ 29944, 30081, 30214, 30345, 30472, 30597, 30718, 30836, 30950, 31062,
+ 31170, 31274, 31376, 31474, 31568, 31659, 31747, 31831, 31911, 31988,
+ 32062, 32132, 32198, 32261, 32320, 32376, 32428, 32476, 32521, 32561,
+ 32599, 32632, 32662, 32688, 32711, 32729, 32744, 32755, 32763, 32767,
+ 32767, 32741, 32665, 32537, 32359, 32129, 31850, 31521, 31143, 30716,
+ 30242, 29720, 29151, 28538, 27879, 27177, 26433, 25647, 24821, 23957,
+ 23055, 22117, 21145, 20139, 19102, 18036, 16941, 15820, 14674, 13505,
+ 12315, 11106, 9879, 8637, 7381, 6114, 4838, 3554, 2264, 971};
@@ -13284,24 +13282,24 @@ static const UWord8 table_mute[9] = {0, 0, 0, 0, 1, 0, 1, 1, 0};
/* track start positions for fixed codebook routines */
static const Word8 startPos[16] =
-{
- 0,
- 2,
- 0,
- 3,
- 0,
- 2,
- 0,
- 3,
- 1,
- 3,
- 2,
- 4,
- 1,
- 4,
- 1,
- 4
-};
+ {
+ 0,
+ 2,
+ 0,
+ 3,
+ 0,
+ 2,
+ 0,
+ 3,
+ 1,
+ 3,
+ 2,
+ 4,
+ 1,
+ 4,
+ 1,
+ 4
+ };
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.c
index 8165164fa..dae5a01cd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.c
@@ -35,7 +35,7 @@
*/
enum DTXStateType
{
- SPEECH = 0, DTX, DTX_MUTE
+ SPEECH = 0, DTX, DTX_MUTE
};
/*
@@ -43,185 +43,185 @@ enum DTXStateType
*/
typedef struct
{
- /* history vector of past synthesis speech energy */
- Word32 frameEnergyHist[L_ENERGYHIST];
+ /* history vector of past synthesis speech energy */
+ Word32 frameEnergyHist[L_ENERGYHIST];
- /* state flags */
- Word16 bgHangover; /* counter; number of frames after last speech frame */
+ /* state flags */
+ Word16 bgHangover; /* counter; number of frames after last speech frame */
-} Bgn_scdState;
+}Bgn_scdState;
typedef struct
{
- Word32 hangCount; /* counter; */
- /* history vector of past synthesis speech energy */
- Word32 cbGainHistory[L_CBGAINHIST];
- Word16 hangVar; /* counter; */
+ Word32 hangCount; /* counter; */
+ /* history vector of past synthesis speech energy */
+ Word32 cbGainHistory[L_CBGAINHIST];
+ Word16 hangVar; /* counter; */
-} Cb_gain_averageState;
+}Cb_gain_averageState;
typedef struct
{
- Word32 lsp_meanSave[M]; /* Averaged LSPs saved for efficiency */
+ Word32 lsp_meanSave[M]; /* Averaged LSPs saved for efficiency */
-} lsp_avgState;
+}lsp_avgState;
typedef struct
{
- Word32 past_r_q[M]; /* Past quantized prediction error, Q15 */
- Word32 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */
+ Word32 past_r_q[M]; /* Past quantized prediction error, Q15 */
+ Word32 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */
-} D_plsfState;
+}D_plsfState;
typedef struct
{
- Word32 pbuf[5];
- Word32 past_gain_pit;
- Word32 prev_gp;
+ Word32 pbuf[5];
+ Word32 past_gain_pit;
+ Word32 prev_gp;
-} ec_gain_pitchState;
+}ec_gain_pitchState;
typedef struct
{
- Word32 gbuf[5];
- Word32 past_gain_code;
- Word32 prev_gc;
+ Word32 gbuf[5];
+ Word32 past_gain_code;
+ Word32 prev_gc;
-} ec_gain_codeState;
+}ec_gain_codeState;
typedef struct
{
- /*
- * normal MA predictor memory, Q10
- * (contains 20*log10(quaErr))
- */
- Word32 past_qua_en[4];
+ /*
+ * normal MA predictor memory, Q10
+ * (contains 20*log10(quaErr))
+ */
+ Word32 past_qua_en[4];
- /*
- * MA predictor memory for MR122 mode, Q10
- * (contains log2(quaErr))
- */
- Word32 past_qua_en_MR122[4];
+ /*
+ * MA predictor memory for MR122 mode, Q10
+ * (contains log2(quaErr))
+ */
+ Word32 past_qua_en_MR122[4];
-} gc_predState;
+}gc_predState;
typedef struct
{
- Word32 gainMem[PHDGAINMEMSIZE];
- Word32 prevCbGain;
- Word32 prevState;
- Word16 lockFull;
- Word16 onset;
+ Word32 gainMem[PHDGAINMEMSIZE];
+ Word32 prevCbGain;
+ Word32 prevState;
+ Word16 lockFull;
+ Word16 onset;
-} ph_dispState;
+}ph_dispState;
typedef struct
{
- enum DTXStateType dtxGlobalState; /* contains previous state */
-
- Word32 log_en;
- Word32 old_log_en;
- Word32 pn_seed_rx;
- Word32 lsp[M];
- Word32 lsp_old[M];
- Word32 lsf_hist[M * DTX_HIST_SIZE];
- Word32 lsf_hist_mean[M * DTX_HIST_SIZE];
- Word32 log_en_hist[DTX_HIST_SIZE];
- Word32 true_sid_period_inv;
- Word16 since_last_sid;
- Word16 lsf_hist_ptr;
- Word16 log_pg_mean;
- Word16 log_en_hist_ptr;
- Word16 log_en_adjust;
- Word16 dtxHangoverCount;
- Word16 decAnaElapsedCount;
- Word16 sid_frame;
- Word16 valid_data;
- Word16 dtxHangoverAdded;
-
-
- /* updated in main decoder */
- Word16 data_updated; /* marker to know if CNI data is ever renewed */
-
-
-} dtx_decState;
+ enum DTXStateType dtxGlobalState; /* contains previous state */
+
+ Word32 log_en;
+ Word32 old_log_en;
+ Word32 pn_seed_rx;
+ Word32 lsp[M];
+ Word32 lsp_old[M];
+ Word32 lsf_hist[M * DTX_HIST_SIZE];
+ Word32 lsf_hist_mean[M * DTX_HIST_SIZE];
+ Word32 log_en_hist[DTX_HIST_SIZE];
+ Word32 true_sid_period_inv;
+ Word16 since_last_sid;
+ Word16 lsf_hist_ptr;
+ Word16 log_pg_mean;
+ Word16 log_en_hist_ptr;
+ Word16 log_en_adjust;
+ Word16 dtxHangoverCount;
+ Word16 decAnaElapsedCount;
+ Word16 sid_frame;
+ Word16 valid_data;
+ Word16 dtxHangoverAdded;
+
+
+ /* updated in main decoder */
+ Word16 data_updated; /* marker to know if CNI data is ever renewed */
+
+
+}dtx_decState;
typedef struct
{
- Word32 past_gain;
+ Word32 past_gain;
-} agcState;
+}agcState;
typedef struct
{
- /* Excitation vector */
- Word32 old_exc[L_SUBFR + PIT_MAX + L_INTERPOL];
- Word32 *exc;
- Word32 lsp_old[M];
+ /* Excitation vector */
+ Word32 old_exc[L_SUBFR + PIT_MAX + L_INTERPOL];
+ Word32 *exc;
+ Word32 lsp_old[M];
- /* Filter's memory */
- Word32 mem_syn[M];
+ /* Filter's memory */
+ Word32 mem_syn[M];
- /* pitch sharpening */
- Word32 sharp;
- Word32 old_T0;
+ /* pitch sharpening */
+ Word32 sharp;
+ Word32 old_T0;
- /* Variable holding received ltpLag, used in background noise and BFI */
- Word32 T0_lagBuff;
+ /* Variable holding received ltpLag, used in background noise and BFI */
+ Word32 T0_lagBuff;
- /* Variables for the source characteristic detector (SCD) */
- Word32 inBackgroundNoise;
- Word32 voicedHangover;
- Word32 ltpGainHistory[9];
+ /* Variables for the source characteristic detector (SCD) */
+ Word32 inBackgroundNoise;
+ Word32 voicedHangover;
+ Word32 ltpGainHistory[9];
- /* Memories for bad frame handling */
- Word32 excEnergyHist[9];
- Word16 prev_bf;
- Word16 prev_pdf;
- Word16 state;
- Word16 nodataSeed;
+ /* Memories for bad frame handling */
+ Word32 excEnergyHist[9];
+ Word16 prev_bf;
+ Word16 prev_pdf;
+ Word16 state;
+ Word16 nodataSeed;
- Bgn_scdState * background_state;
- Cb_gain_averageState * Cb_gain_averState;
- lsp_avgState * lsp_avg_st;
- D_plsfState * lsfState;
- ec_gain_pitchState * ec_gain_p_st;
- ec_gain_codeState * ec_gain_c_st;
- gc_predState * pred_state;
- ph_dispState * ph_disp_st;
- dtx_decState * dtxDecoderState;
-} Decoder_amrState;
+ Bgn_scdState * background_state;
+ Cb_gain_averageState * Cb_gain_averState;
+ lsp_avgState * lsp_avg_st;
+ D_plsfState * lsfState;
+ ec_gain_pitchState * ec_gain_p_st;
+ ec_gain_codeState * ec_gain_c_st;
+ gc_predState * pred_state;
+ ph_dispState * ph_disp_st;
+ dtx_decState * dtxDecoderState;
+}Decoder_amrState;
typedef struct
{
- Word32 res2[L_SUBFR];
- Word32 mem_syn_pst[M];
- Word32 synth_buf[M + L_FRAME];
- Word32 preemph_state_mem_pre;
- agcState * agc_state;
-} Post_FilterState;
+ Word32 res2[L_SUBFR];
+ Word32 mem_syn_pst[M];
+ Word32 synth_buf[M + L_FRAME];
+ Word32 preemph_state_mem_pre;
+ agcState * agc_state;
+}Post_FilterState;
typedef struct
{
- Word32 y2_hi;
- Word32 y2_lo;
- Word32 y1_hi;
- Word32 y1_lo;
- Word32 x0;
- Word32 x1;
+ Word32 y2_hi;
+ Word32 y2_lo;
+ Word32 y1_hi;
+ Word32 y1_lo;
+ Word32 x0;
+ Word32 x1;
-} Post_ProcessState;
+}Post_ProcessState;
typedef struct
{
- Decoder_amrState * decoder_amrState;
- Post_FilterState * post_state;
- Post_ProcessState * postHP_state;
-} Speech_Decode_FrameState;
+ Decoder_amrState * decoder_amrState;
+ Post_FilterState * post_state;
+ Post_ProcessState * postHP_state;
+}Speech_Decode_FrameState;
/*
@@ -238,187 +238,180 @@ typedef struct
* Returns:
* void
*/
-static void Decoder_amr_reset(Decoder_amrState *state, enum Mode mode)
+static void Decoder_amr_reset( Decoder_amrState *state, enum Mode mode )
{
- Word32 i;
-
- /* Cb_gain_average_reset */
- memset(state->Cb_gain_averState->cbGainHistory, 0, L_CBGAINHIST << 2);
- state->Cb_gain_averState->hangVar = 0;
- state->Cb_gain_averState->hangCount = 0;
-
- /* Initialize static pointer */
- state->exc = state->old_exc + PIT_MAX + L_INTERPOL;
-
- /* Static vectors to zero */
- memset(state->old_exc, 0, (PIT_MAX + L_INTERPOL) << 2);
-
- if(mode != MRDTX)
- memset(state->mem_syn, 0, M << 2);
-
- /* initialize pitch sharpening */
- state->sharp = SHARPMIN;
- state->old_T0 = 40;
-
- /* Initialize state->lsp_old [] */
- if(mode != MRDTX)
- {
- state->lsp_old[0] = 30000;
- state->lsp_old[1] = 26000;
- state->lsp_old[2] = 21000;
- state->lsp_old[3] = 15000;
- state->lsp_old[4] = 8000;
- state->lsp_old[5] = 0;
- state->lsp_old[6] = -8000;
- state->lsp_old[7] = -15000;
- state->lsp_old[8] = -21000;
- state->lsp_old[9] = -26000;
- }
-
- /* Initialize memories of bad frame handling */
- state->prev_bf = 0;
- state->prev_pdf = 0;
- state->state = 0;
- state->T0_lagBuff = 40;
- state->inBackgroundNoise = 0;
- state->voicedHangover = 0;
-
- if(mode != MRDTX)
- memset(state->excEnergyHist, 0, 9 << 2);
- memset(state->ltpGainHistory, 0, 9 << 2);
-
- if(mode != MRDTX)
- {
- state->lsp_avg_st->lsp_meanSave[0] = 1384;
- state->lsp_avg_st->lsp_meanSave[1] = 2077;
- state->lsp_avg_st->lsp_meanSave[2] = 3420;
- state->lsp_avg_st->lsp_meanSave[3] = 5108;
- state->lsp_avg_st->lsp_meanSave[4] = 6742;
- state->lsp_avg_st->lsp_meanSave[5] = 8122;
- state->lsp_avg_st->lsp_meanSave[6] = 9863;
- state->lsp_avg_st->lsp_meanSave[7] = 11092;
- state->lsp_avg_st->lsp_meanSave[8] = 12714;
- state->lsp_avg_st->lsp_meanSave[9] = 13701;
- }
- memset(state->lsfState->past_r_q, 0, M << 2);
-
- /* Past dequantized lsfs */
- state->lsfState->past_lsf_q[0] = 1384;
- state->lsfState->past_lsf_q[1] = 2077;
- state->lsfState->past_lsf_q[2] = 3420;
- state->lsfState->past_lsf_q[3] = 5108;
- state->lsfState->past_lsf_q[4] = 6742;
- state->lsfState->past_lsf_q[5] = 8122;
- state->lsfState->past_lsf_q[6] = 9863;
- state->lsfState->past_lsf_q[7] = 11092;
- state->lsfState->past_lsf_q[8] = 12714;
- state->lsfState->past_lsf_q[9] = 13701;
-
- for(i = 0; i < 5; i++)
- state->ec_gain_p_st->pbuf[i] = 1640;
- state->ec_gain_p_st->past_gain_pit = 0;
- state->ec_gain_p_st->prev_gp = 16384;
-
- for(i = 0; i < 5; i++)
- state->ec_gain_c_st->gbuf[i] = 1;
- state->ec_gain_c_st->past_gain_code = 0;
- state->ec_gain_c_st->prev_gc = 1;
-
- if(mode != MRDTX)
- {
- for(i = 0; i < NPRED; i++)
- {
- state->pred_state->past_qua_en[i] = MIN_ENERGY;
- state->pred_state->past_qua_en_MR122[i] = MIN_ENERGY_MR122;
- }
- }
- state->nodataSeed = 21845;
-
- /* Static vectors to zero */
- memset(state->background_state->frameEnergyHist, 0, L_ENERGYHIST << 2);
-
- /* Initialize hangover handling */
- state->background_state->bgHangover = 0;
-
- /* phDispReset */
- memset(state->ph_disp_st->gainMem, 0, PHDGAINMEMSIZE << 2);
- state->ph_disp_st->prevState = 0;
- state->ph_disp_st->prevCbGain = 0;
- state->ph_disp_st->lockFull = 0;
- state->ph_disp_st->onset = 0; /* assume no onset in start */
-
- if(mode != MRDTX)
- {
- state->dtxDecoderState->since_last_sid = 0;
- state->dtxDecoderState->true_sid_period_inv = 8192;
- state->dtxDecoderState->log_en = 3500;
- state->dtxDecoderState->old_log_en = 3500;
-
- /* low level noise for better performance in DTX handover cases*/
- state->dtxDecoderState->pn_seed_rx = PN_INITIAL_SEED;
-
- /* Initialize state->lsp [] */
- state->dtxDecoderState->lsp[0] = 30000;
- state->dtxDecoderState->lsp[1] = 26000;
- state->dtxDecoderState->lsp[2] = 21000;
- state->dtxDecoderState->lsp[3] = 15000;
- state->dtxDecoderState->lsp[4] = 8000;
- state->dtxDecoderState->lsp[5] = 0;
- state->dtxDecoderState->lsp[6] = -8000;
- state->dtxDecoderState->lsp[7] = -15000;
- state->dtxDecoderState->lsp[8] = -21000;
- state->dtxDecoderState->lsp[9] = -26000;
-
- /* Initialize state->lsp_old [] */
- state->dtxDecoderState->lsp_old[0] = 30000;
- state->dtxDecoderState->lsp_old[1] = 26000;
- state->dtxDecoderState->lsp_old[2] = 21000;
- state->dtxDecoderState->lsp_old[3] = 15000;
- state->dtxDecoderState->lsp_old[4] = 8000;
- state->dtxDecoderState->lsp_old[5] = 0;
- state->dtxDecoderState->lsp_old[6] = -8000;
- state->dtxDecoderState->lsp_old[7] = -15000;
- state->dtxDecoderState->lsp_old[8] = -21000;
- state->dtxDecoderState->lsp_old[9] = -26000;
- state->dtxDecoderState->lsf_hist_ptr = 0;
- state->dtxDecoderState->log_pg_mean = 0;
- state->dtxDecoderState->log_en_hist_ptr = 0;
-
- /* initialize decoder lsf history */
- state->dtxDecoderState->lsf_hist[0] = 1384;
- state->dtxDecoderState->lsf_hist[1] = 2077;
- state->dtxDecoderState->lsf_hist[2] = 3420;
- state->dtxDecoderState->lsf_hist[3] = 5108;
- state->dtxDecoderState->lsf_hist[4] = 6742;
- state->dtxDecoderState->lsf_hist[5] = 8122;
- state->dtxDecoderState->lsf_hist[6] = 9863;
- state->dtxDecoderState->lsf_hist[7] = 11092;
- state->dtxDecoderState->lsf_hist[8] = 12714;
- state->dtxDecoderState->lsf_hist[9] = 13701;
-
- for(i = 1; i < DTX_HIST_SIZE; i++)
- {
- memcpy(&state->dtxDecoderState->lsf_hist[M * i], &state->
- dtxDecoderState->lsf_hist[0], M << 2);
- }
- memset(state->dtxDecoderState->lsf_hist_mean, 0, M * DTX_HIST_SIZE << 2);
-
- /* initialize decoder log frame energy */
- for(i = 0; i < DTX_HIST_SIZE; i++)
- {
- state->dtxDecoderState->log_en_hist[i] = state->dtxDecoderState->log_en
- ;
- }
- state->dtxDecoderState->log_en_adjust = 0;
- state->dtxDecoderState->dtxHangoverCount = DTX_HANG_CONST;
- state->dtxDecoderState->decAnaElapsedCount = 31;
- state->dtxDecoderState->sid_frame = 0;
- state->dtxDecoderState->valid_data = 0;
- state->dtxDecoderState->dtxHangoverAdded = 0;
- state->dtxDecoderState->dtxGlobalState = DTX;
- state->dtxDecoderState->data_updated = 0;
- }
- return;
+ Word32 i;
+
+ /* Cb_gain_average_reset */
+ memset(state->Cb_gain_averState->cbGainHistory, 0, L_CBGAINHIST << 2);
+ state->Cb_gain_averState->hangVar = 0;
+ state->Cb_gain_averState->hangCount= 0;
+
+ /* Initialize static pointer */
+ state->exc = state->old_exc + PIT_MAX + L_INTERPOL;
+
+ /* Static vectors to zero */
+ memset( state->old_exc, 0, ( PIT_MAX + L_INTERPOL )<<2 );
+
+ if ( mode != MRDTX )
+ memset( state->mem_syn, 0, M <<2 );
+
+ /* initialize pitch sharpening */
+ state->sharp = SHARPMIN;
+ state->old_T0 = 40;
+
+ /* Initialize state->lsp_old [] */
+ if ( mode != MRDTX ) {
+ state->lsp_old[0] = 30000;
+ state->lsp_old[1] = 26000;
+ state->lsp_old[2] = 21000;
+ state->lsp_old[3] = 15000;
+ state->lsp_old[4] = 8000;
+ state->lsp_old[5] = 0;
+ state->lsp_old[6] = -8000;
+ state->lsp_old[7] = -15000;
+ state->lsp_old[8] = -21000;
+ state->lsp_old[9] = -26000;
+ }
+
+ /* Initialize memories of bad frame handling */
+ state->prev_bf = 0;
+ state->prev_pdf = 0;
+ state->state = 0;
+ state->T0_lagBuff = 40;
+ state->inBackgroundNoise = 0;
+ state->voicedHangover = 0;
+
+ if ( mode != MRDTX )
+ memset( state->excEnergyHist, 0, 9 <<2 );
+ memset( state->ltpGainHistory, 0, 9 <<2 );
+
+ if ( mode != MRDTX ) {
+ state->lsp_avg_st->lsp_meanSave[0] = 1384;
+ state->lsp_avg_st->lsp_meanSave[1] = 2077;
+ state->lsp_avg_st->lsp_meanSave[2] = 3420;
+ state->lsp_avg_st->lsp_meanSave[3] = 5108;
+ state->lsp_avg_st->lsp_meanSave[4] = 6742;
+ state->lsp_avg_st->lsp_meanSave[5] = 8122;
+ state->lsp_avg_st->lsp_meanSave[6] = 9863;
+ state->lsp_avg_st->lsp_meanSave[7] = 11092;
+ state->lsp_avg_st->lsp_meanSave[8] = 12714;
+ state->lsp_avg_st->lsp_meanSave[9] = 13701;
+ }
+ memset( state->lsfState->past_r_q, 0, M <<2 );
+
+ /* Past dequantized lsfs */
+ state->lsfState->past_lsf_q[0] = 1384;
+ state->lsfState->past_lsf_q[1] = 2077;
+ state->lsfState->past_lsf_q[2] = 3420;
+ state->lsfState->past_lsf_q[3] = 5108;
+ state->lsfState->past_lsf_q[4] = 6742;
+ state->lsfState->past_lsf_q[5] = 8122;
+ state->lsfState->past_lsf_q[6] = 9863;
+ state->lsfState->past_lsf_q[7] = 11092;
+ state->lsfState->past_lsf_q[8] = 12714;
+ state->lsfState->past_lsf_q[9] = 13701;
+
+ for ( i = 0; i < 5; i++ )
+ state->ec_gain_p_st->pbuf[i] = 1640;
+ state->ec_gain_p_st->past_gain_pit = 0;
+ state->ec_gain_p_st->prev_gp = 16384;
+
+ for ( i = 0; i < 5; i++ )
+ state->ec_gain_c_st->gbuf[i] = 1;
+ state->ec_gain_c_st->past_gain_code = 0;
+ state->ec_gain_c_st->prev_gc = 1;
+
+ if ( mode != MRDTX ) {
+ for ( i = 0; i < NPRED; i++ ) {
+ state->pred_state->past_qua_en[i] = MIN_ENERGY;
+ state->pred_state->past_qua_en_MR122[i] = MIN_ENERGY_MR122;
+ }
+ }
+ state->nodataSeed = 21845;
+
+ /* Static vectors to zero */
+ memset( state->background_state->frameEnergyHist, 0, L_ENERGYHIST <<2 );
+
+ /* Initialize hangover handling */
+ state->background_state->bgHangover = 0;
+
+ /* phDispReset */
+ memset( state->ph_disp_st->gainMem, 0, PHDGAINMEMSIZE <<2 );
+ state->ph_disp_st->prevState = 0;
+ state->ph_disp_st->prevCbGain = 0;
+ state->ph_disp_st->lockFull = 0;
+ state->ph_disp_st->onset = 0; /* assume no onset in start */
+
+ if ( mode != MRDTX ) {
+ state->dtxDecoderState->since_last_sid = 0;
+ state->dtxDecoderState->true_sid_period_inv = 8192;
+ state->dtxDecoderState->log_en = 3500;
+ state->dtxDecoderState->old_log_en = 3500;
+
+ /* low level noise for better performance in DTX handover cases*/
+ state->dtxDecoderState->pn_seed_rx = PN_INITIAL_SEED;
+
+ /* Initialize state->lsp [] */
+ state->dtxDecoderState->lsp[0] = 30000;
+ state->dtxDecoderState->lsp[1] = 26000;
+ state->dtxDecoderState->lsp[2] = 21000;
+ state->dtxDecoderState->lsp[3] = 15000;
+ state->dtxDecoderState->lsp[4] = 8000;
+ state->dtxDecoderState->lsp[5] = 0;
+ state->dtxDecoderState->lsp[6] = -8000;
+ state->dtxDecoderState->lsp[7] = -15000;
+ state->dtxDecoderState->lsp[8] = -21000;
+ state->dtxDecoderState->lsp[9] = -26000;
+
+ /* Initialize state->lsp_old [] */
+ state->dtxDecoderState->lsp_old[0] = 30000;
+ state->dtxDecoderState->lsp_old[1] = 26000;
+ state->dtxDecoderState->lsp_old[2] = 21000;
+ state->dtxDecoderState->lsp_old[3] = 15000;
+ state->dtxDecoderState->lsp_old[4] = 8000;
+ state->dtxDecoderState->lsp_old[5] = 0;
+ state->dtxDecoderState->lsp_old[6] = -8000;
+ state->dtxDecoderState->lsp_old[7] = -15000;
+ state->dtxDecoderState->lsp_old[8] = -21000;
+ state->dtxDecoderState->lsp_old[9] = -26000;
+ state->dtxDecoderState->lsf_hist_ptr = 0;
+ state->dtxDecoderState->log_pg_mean = 0;
+ state->dtxDecoderState->log_en_hist_ptr = 0;
+
+ /* initialize decoder lsf history */
+ state->dtxDecoderState->lsf_hist[0] = 1384;
+ state->dtxDecoderState->lsf_hist[1] = 2077;
+ state->dtxDecoderState->lsf_hist[2] = 3420;
+ state->dtxDecoderState->lsf_hist[3] = 5108;
+ state->dtxDecoderState->lsf_hist[4] = 6742;
+ state->dtxDecoderState->lsf_hist[5] = 8122;
+ state->dtxDecoderState->lsf_hist[6] = 9863;
+ state->dtxDecoderState->lsf_hist[7] = 11092;
+ state->dtxDecoderState->lsf_hist[8] = 12714;
+ state->dtxDecoderState->lsf_hist[9] = 13701;
+
+ for ( i = 1; i < DTX_HIST_SIZE; i++ ) {
+ memcpy( &state->dtxDecoderState->lsf_hist[M * i], &state->
+ dtxDecoderState->lsf_hist[0], M <<2 );
+ }
+ memset( state->dtxDecoderState->lsf_hist_mean, 0, M * DTX_HIST_SIZE <<2 );
+
+ /* initialize decoder log frame energy */
+ for ( i = 0; i < DTX_HIST_SIZE; i++ ) {
+ state->dtxDecoderState->log_en_hist[i] = state->dtxDecoderState->log_en
+ ;
+ }
+ state->dtxDecoderState->log_en_adjust = 0;
+ state->dtxDecoderState->dtxHangoverCount = DTX_HANG_CONST;
+ state->dtxDecoderState->decAnaElapsedCount = 31;
+ state->dtxDecoderState->sid_frame = 0;
+ state->dtxDecoderState->valid_data = 0;
+ state->dtxDecoderState->dtxHangoverAdded = 0;
+ state->dtxDecoderState->dtxGlobalState = DTX;
+ state->dtxDecoderState->data_updated = 0;
+ }
+ return;
}
@@ -442,121 +435,105 @@ static void Decoder_amr_reset(Decoder_amrState *state, enum Mode mode)
* Returns:
* DTXStateType DTX, DTX_MUTE or SPEECH
*/
-static enum DTXStateType rx_dtx_handler(dtx_decState *st, enum RXFrameType frame_type)
+static enum DTXStateType rx_dtx_handler( dtx_decState *st, enum RXFrameType frame_type )
{
- enum DTXStateType newState;
- enum DTXStateType encState;
-
- /* DTX if SID frame or previously in DTX{_MUTE} and (NO_RX OR BAD_SPEECH) */
- if(table_SID[frame_type] | ((st->dtxGlobalState != SPEECH) &
- table_speech_bad[frame_type]))
- {
- newState = DTX;
-
- /* stay in mute for these input types */
- if((st->dtxGlobalState == DTX_MUTE) & table_mute[frame_type])
- {
- newState = DTX_MUTE;
- }
-
- /*
- * evaluate if noise parameters are too old
- * since_last_sid is reset when CN parameters have been updated
- */
- st->since_last_sid += 1;
-
- /* no update of sid parameters in DTX for a long while */
- if((frame_type != RX_SID_UPDATE) & (st->since_last_sid > DTX_MAX_EMPTY_THRESH))
- {
- newState = DTX_MUTE;
- }
- }
- else
- {
- newState = SPEECH;
- st->since_last_sid = 0;
- }
-
- /*
- * reset the decAnaElapsed Counter when receiving CNI data the first
- * time, to robustify counter missmatch after handover
- * this might delay the bwd CNI analysis in the new decoder slightly.
- */
- if((st->data_updated == 0) & (frame_type == RX_SID_UPDATE))
- {
- st->decAnaElapsedCount = 0;
- }
-
- /*
- * update the SPE-SPD DTX hangover synchronization
- * to know when SPE has added dtx hangover
- */
- st->decAnaElapsedCount += 1;
- st->dtxHangoverAdded = 0;
- encState = SPEECH;
-
- if(table_DTX[frame_type])
- {
- encState = DTX;
- if((frame_type == RX_NO_DATA) & (newState == SPEECH))
- {
- encState = SPEECH;
- }
- }
-
- if(encState == SPEECH)
- {
- st->dtxHangoverCount = DTX_HANG_CONST;
- }
- else
- {
- if(st->decAnaElapsedCount > DTX_ELAPSED_FRAMES_THRESH)
- {
- st->dtxHangoverAdded = 1;
- st->decAnaElapsedCount = 0;
- st->dtxHangoverCount = 0;
- }
- else if(st->dtxHangoverCount == 0)
- {
- st->decAnaElapsedCount = 0;
- }
- else
- {
- st->dtxHangoverCount -= 1;
- }
- }
-
- if(newState != SPEECH)
- {
- /*
- * DTX or DTX_MUTE
- * CN data is not in a first SID, first SIDs are marked as SID_BAD
- * but will do backwards analysis if a hangover period has been added
- * according to the state machine above
- */
- st->sid_frame = 0;
- st->valid_data = 0;
-
- if(frame_type == RX_SID_FIRST)
- {
- st->sid_frame = 1;
- }
- else if(frame_type == RX_SID_UPDATE)
- {
- st->sid_frame = 1;
- st->valid_data = 1;
- }
- else if(frame_type == RX_SID_BAD)
- {
- st->sid_frame = 1;
-
- /* use old data */
- st->dtxHangoverAdded = 0;
- }
- }
-
- /* newState is used by both SPEECH AND DTX synthesis routines */
- return newState;
+ enum DTXStateType newState;
+ enum DTXStateType encState;
+
+ /* DTX if SID frame or previously in DTX{_MUTE} and (NO_RX OR BAD_SPEECH) */
+ if ( table_SID[frame_type] | ( ( st->dtxGlobalState != SPEECH ) &
+ table_speech_bad[frame_type] ) ) {
+ newState = DTX;
+
+ /* stay in mute for these input types */
+ if ( ( st->dtxGlobalState == DTX_MUTE ) & table_mute[frame_type] ) {
+ newState = DTX_MUTE;
+ }
+
+ /*
+ * evaluate if noise parameters are too old
+ * since_last_sid is reset when CN parameters have been updated
+ */
+ st->since_last_sid += 1;
+
+ /* no update of sid parameters in DTX for a long while */
+ if ((frame_type != RX_SID_UPDATE) & ( st->since_last_sid > DTX_MAX_EMPTY_THRESH )) {
+ newState = DTX_MUTE;
+ }
+ }
+ else {
+ newState = SPEECH;
+ st->since_last_sid = 0;
+ }
+
+ /*
+ * reset the decAnaElapsed Counter when receiving CNI data the first
+ * time, to robustify counter missmatch after handover
+ * this might delay the bwd CNI analysis in the new decoder slightly.
+ */
+ if ( ( st->data_updated == 0 ) & ( frame_type == RX_SID_UPDATE ) ) {
+ st->decAnaElapsedCount = 0;
+ }
+
+ /*
+ * update the SPE-SPD DTX hangover synchronization
+ * to know when SPE has added dtx hangover
+ */
+ st->decAnaElapsedCount += 1;
+ st->dtxHangoverAdded = 0;
+ encState = SPEECH;
+
+ if ( table_DTX[frame_type] ) {
+ encState = DTX;
+ if( ( frame_type == RX_NO_DATA ) & ( newState == SPEECH ) ) {
+ encState = SPEECH;
+ }
+ }
+
+ if ( encState == SPEECH ) {
+ st->dtxHangoverCount = DTX_HANG_CONST;
+ }
+ else {
+ if ( st->decAnaElapsedCount > DTX_ELAPSED_FRAMES_THRESH ) {
+ st->dtxHangoverAdded = 1;
+ st->decAnaElapsedCount = 0;
+ st->dtxHangoverCount = 0;
+ }
+ else if ( st->dtxHangoverCount == 0 ) {
+ st->decAnaElapsedCount = 0;
+ }
+ else {
+ st->dtxHangoverCount -= 1;
+ }
+ }
+
+ if ( newState != SPEECH ) {
+ /*
+ * DTX or DTX_MUTE
+ * CN data is not in a first SID, first SIDs are marked as SID_BAD
+ * but will do backwards analysis if a hangover period has been added
+ * according to the state machine above
+ */
+ st->sid_frame = 0;
+ st->valid_data = 0;
+
+ if ( frame_type == RX_SID_FIRST ) {
+ st->sid_frame = 1;
+ }
+ else if ( frame_type == RX_SID_UPDATE ) {
+ st->sid_frame = 1;
+ st->valid_data = 1;
+ }
+ else if ( frame_type == RX_SID_BAD ) {
+ st->sid_frame = 1;
+
+ /* use old data */
+ st->dtxHangoverAdded = 0;
+ }
+ }
+
+ /* newState is used by both SPEECH AND DTX synthesis routines */
+ return newState;
}
@@ -574,24 +551,23 @@ static enum DTXStateType rx_dtx_handler(dtx_decState *st, enum RXFrameType frame
* Returns:
* void
*/
-static void Lsf_lsp(Word32 lsf[], Word32 lsp[])
+static void Lsf_lsp( Word32 lsf[], Word32 lsp[] )
{
- Word32 i, ind, offset, tmp;
+ Word32 i, ind, offset, tmp;
- for(i = 0; i < M; i++)
- {
- /* ind = b8-b15 of lsf[i] */
- ind = lsf[i] >> 8;
+ for ( i = 0; i < M; i++ ) {
+ /* ind = b8-b15 of lsf[i] */
+ ind = lsf[i] >> 8;
- /* offset = b0-b7 of lsf[i] */
- offset = lsf[i] & 0x00ff;
+ /* offset = b0-b7 of lsf[i] */
+ offset = lsf[i] & 0x00ff;
- /* lsp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 256 */
- tmp = ((cos_table[ind+1] - cos_table[ind]) * offset) << 1;
- lsp[i] = cos_table[ind] + (tmp >> 9);
- }
- return;
+ /* lsp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 256 */
+ tmp = ( ( cos_table[ind+1]-cos_table[ind] )*offset ) << 1;
+ lsp[i] = cos_table[ind] + ( tmp >> 9 );
+ }
+ return;
}
@@ -614,131 +590,114 @@ static void Lsf_lsp(Word32 lsf[], Word32 lsp[])
* Returns:
* void
*/
-static void D_plsf_3(D_plsfState *st, enum Mode mode, Word16 bfi, Word16 *
- indice, Word32 *lsp1_q)
+static void D_plsf_3( D_plsfState *st, enum Mode mode, Word16 bfi, Word16 *
+ indice, Word32 *lsp1_q )
{
- Word32 lsf1_r[M], lsf1_q[M];
- Word32 i, index, temp;
- const Word32 *p_cb1, *p_cb2, *p_cb3, *p_dico;
-
-
- /* if bad frame */
- if(bfi != 0)
- {
- /* use the past LSFs slightly shifted towards their mean */
- for(i = 0; i < M; i++)
- {
- /* lsfi_q[i] = ALPHA*past_lsf_q[i] + ONE_ALPHA*meanLsf[i]; */
- lsf1_q[i] = ((st->past_lsf_q[i] * ALPHA) >> 15) + ((mean_lsf_3[i]
- * ONE_ALPHA) >> 15);
- }
-
- /* estimate past quantized residual to be used in next frame */
- if(mode != MRDTX)
- {
- for(i = 0; i < M; i++)
- {
- /* temp = meanLsf[i] + pastR2_q[i] * pred_fac; */
- temp = mean_lsf_3[i] + ((st->past_r_q[i] * pred_fac[i]) >> 15);
- st->past_r_q[i] = lsf1_q[i] - temp;
- }
- }
- else
- {
- for(i = 0; i < M; i++)
- {
- /* temp = meanLsf[i] + pastR2_q[i]; */
- temp = mean_lsf_3[i] + st->past_r_q[i];
- st->past_r_q[i] = lsf1_q[i] - temp;
- }
- }
- }
-
- /* if good LSFs received */
- else
- {
- if((mode == MR475) | (mode == MR515))
- {
- /* MR475, MR515 */
- p_cb1 = dico1_lsf_3;
- p_cb2 = dico2_lsf_3;
- p_cb3 = mr515_3_lsf;
- }
- else if(mode == MR795)
- {
- /* MR795 */
- p_cb1 = mr795_1_lsf;
- p_cb2 = dico2_lsf_3;
- p_cb3 = dico3_lsf_3;
- }
- else
- {
- /* MR59, MR67, MR74, MR102, MRDTX */
- p_cb1 = dico1_lsf_3;
- p_cb2 = dico2_lsf_3;
- p_cb3 = dico3_lsf_3;
- }
-
- /* decode prediction residuals from 3 received indices */
- index = *indice++;
- p_dico = &p_cb1[index + index + index];
- index = *indice++;
- lsf1_r[0] = *p_dico++;
- lsf1_r[1] = *p_dico++;
- lsf1_r[2] = *p_dico++;
-
- if((mode == MR475) | (mode == MR515))
- {
- /* MR475, MR515 only using every second entry */
- index = index << 1;
- }
- p_dico = &p_cb2[index + index + index];
- index = *indice++;
- lsf1_r[3] = *p_dico++;
- lsf1_r[4] = *p_dico++;
- lsf1_r[5] = *p_dico++;
- p_dico = &p_cb3[index << 2];
- lsf1_r[6] = *p_dico++;
- lsf1_r[7] = *p_dico++;
- lsf1_r[8] = *p_dico++;
- lsf1_r[9] = *p_dico++;
-
- /* Compute quantized LSFs and update the past quantized residual */
- if(mode != MRDTX)
- {
- for(i = 0; i < M; i++)
- {
- lsf1_q[i] = lsf1_r[i] + (mean_lsf_3[i] + ((st->past_r_q[i] *
- pred_fac[i]) >> 15));
- }
- memcpy(st->past_r_q, lsf1_r, M << 2);
- }
- else
- {
- for(i = 0; i < M; i++)
- {
- lsf1_q[i] = lsf1_r[i] + (mean_lsf_3[i] + st->past_r_q[i]);
- }
- memcpy(st->past_r_q, lsf1_r, M << 2);
- }
- }
-
- /* verification that LSFs has minimum distance of LSF_GAP Hz */
- temp = LSF_GAP;
-
- for(i = 0; i < M; i++)
- {
- if(lsf1_q[i] < temp)
- {
- lsf1_q[i] = temp;
- }
- temp = lsf1_q[i] + LSF_GAP;
- }
- memcpy(st->past_lsf_q, lsf1_q, M << 2);
-
- /* convert LSFs to the cosine domain */
- Lsf_lsp(lsf1_q, lsp1_q);
- return;
+ Word32 lsf1_r[M], lsf1_q[M];
+ Word32 i, index, temp;
+ const Word32 *p_cb1, *p_cb2, *p_cb3, *p_dico;
+
+
+ /* if bad frame */
+ if ( bfi != 0 ) {
+ /* use the past LSFs slightly shifted towards their mean */
+ for ( i = 0; i < M; i++ ) {
+ /* lsfi_q[i] = ALPHA*past_lsf_q[i] + ONE_ALPHA*meanLsf[i]; */
+ lsf1_q[i] = ( ( st->past_lsf_q[i] * ALPHA ) >> 15 ) + ( ( mean_lsf_3[i]
+ * ONE_ALPHA ) >> 15 );
+ }
+
+ /* estimate past quantized residual to be used in next frame */
+ if ( mode != MRDTX ) {
+ for ( i = 0; i < M; i++ ) {
+ /* temp = meanLsf[i] + pastR2_q[i] * pred_fac; */
+ temp = mean_lsf_3[i] + ( ( st->past_r_q[i] * pred_fac[i] ) >> 15 );
+ st->past_r_q[i] = lsf1_q[i] - temp;
+ }
+ }
+ else {
+ for ( i = 0; i < M; i++ ) {
+ /* temp = meanLsf[i] + pastR2_q[i]; */
+ temp = mean_lsf_3[i] + st->past_r_q[i];
+ st->past_r_q[i] = lsf1_q[i] - temp;
+ }
+ }
+ }
+
+ /* if good LSFs received */
+ else {
+ if ( ( mode == MR475 ) | ( mode == MR515 ) ) {
+ /* MR475, MR515 */
+ p_cb1 = dico1_lsf_3;
+ p_cb2 = dico2_lsf_3;
+ p_cb3 = mr515_3_lsf;
+ }
+ else if ( mode == MR795 ) {
+ /* MR795 */
+ p_cb1 = mr795_1_lsf;
+ p_cb2 = dico2_lsf_3;
+ p_cb3 = dico3_lsf_3;
+ }
+ else {
+ /* MR59, MR67, MR74, MR102, MRDTX */
+ p_cb1 = dico1_lsf_3;
+ p_cb2 = dico2_lsf_3;
+ p_cb3 = dico3_lsf_3;
+ }
+
+ /* decode prediction residuals from 3 received indices */
+ index = *indice++;
+ p_dico = &p_cb1[index + index + index];
+ index = *indice++;
+ lsf1_r[0] = *p_dico++;
+ lsf1_r[1] = *p_dico++;
+ lsf1_r[2] = *p_dico++;
+
+ if ( ( mode == MR475 ) | ( mode == MR515 ) ) {
+ /* MR475, MR515 only using every second entry */
+ index = index << 1;
+ }
+ p_dico = &p_cb2[index + index + index];
+ index = *indice++;
+ lsf1_r[3] = *p_dico++;
+ lsf1_r[4] = *p_dico++;
+ lsf1_r[5] = *p_dico++;
+ p_dico = &p_cb3[index << 2];
+ lsf1_r[6] = *p_dico++;
+ lsf1_r[7] = *p_dico++;
+ lsf1_r[8] = *p_dico++;
+ lsf1_r[9] = *p_dico++;
+
+ /* Compute quantized LSFs and update the past quantized residual */
+ if ( mode != MRDTX ) {
+ for ( i = 0; i < M; i++ ) {
+ lsf1_q[i] = lsf1_r[i] + ( mean_lsf_3[i] + ( ( st->past_r_q[i] *
+ pred_fac[i] ) >> 15 ) );
+ }
+ memcpy( st->past_r_q, lsf1_r, M <<2 );
+ }
+ else {
+ for ( i = 0; i < M; i++ ) {
+ lsf1_q[i] = lsf1_r[i] + ( mean_lsf_3[i] + st->past_r_q[i] );
+ }
+ memcpy( st->past_r_q, lsf1_r, M <<2 );
+ }
+ }
+
+ /* verification that LSFs has minimum distance of LSF_GAP Hz */
+ temp = LSF_GAP;
+
+ for ( i = 0; i < M; i++ ) {
+ if ( lsf1_q[i] < temp ) {
+ lsf1_q[i] = temp;
+ }
+ temp = lsf1_q[i] + LSF_GAP;
+ }
+ memcpy( st->past_lsf_q, lsf1_q, M <<2 );
+
+ /* convert LSFs to the cosine domain */
+ Lsf_lsp( lsf1_q, lsp1_q );
+ return;
}
@@ -756,39 +715,35 @@ static void D_plsf_3(D_plsfState *st, enum Mode mode, Word16 bfi, Word16 *
* Returns:
* noise_bits
*/
-static Word32 pseudonoise(Word32 *shift_reg, Word32 no_bits)
+static Word32 pseudonoise( Word32 *shift_reg, Word32 no_bits )
{
- Word32 noise_bits, Sn, i;
- Word32 s_reg;
-
-
- s_reg = *shift_reg;
- noise_bits = 0;
-
- for(i = 0; i < no_bits; i++)
- {
- /* State n == 31 */
- Sn = s_reg & 0x00000001L;
-
- /* State n == 3 */
- if(s_reg & 0x10000000L)
- {
- Sn = Sn ^ 0x1L;
- }
- else
- {
- Sn = Sn ^ 0x0L;
- }
- noise_bits = (noise_bits << 1) | (s_reg & 1);
- s_reg = s_reg >> 1;
-
- if(Sn & 1)
- {
- s_reg = s_reg | 0x40000000L;
- }
- }
- *shift_reg = s_reg;
- return noise_bits;
+ Word32 noise_bits, Sn, i;
+ Word32 s_reg;
+
+
+ s_reg = *shift_reg;
+ noise_bits = 0;
+
+ for ( i = 0; i < no_bits; i++ ) {
+ /* State n == 31 */
+ Sn = s_reg & 0x00000001L;
+
+ /* State n == 3 */
+ if ( s_reg & 0x10000000L ) {
+ Sn = Sn ^ 0x1L;
+ }
+ else {
+ Sn = Sn ^ 0x0L;
+ }
+ noise_bits = ( noise_bits << 1 ) | ( s_reg & 1 );
+ s_reg = s_reg >> 1;
+
+ if ( Sn & 1 ) {
+ s_reg = s_reg | 0x40000000L;
+ }
+ }
+ *shift_reg = s_reg;
+ return noise_bits;
}
@@ -807,22 +762,20 @@ static Word32 pseudonoise(Word32 *shift_reg, Word32 no_bits)
* Returns:
* void
*/
-static void Lsp_lsf(Word32 lsp[], Word32 lsf[])
+static void Lsp_lsf( Word32 lsp[], Word32 lsf[] )
{
- Word32 i, ind = 63; /* begin at end of table -1 */
-
-
- for(i = M - 1; i >= 0; i--)
- {
- /* find value in table that is just greater than lsp[i] */
- while(cos_table[ind] < lsp[i])
- {
- ind--;
- }
- lsf[i] = ((((lsp[i] - cos_table[ind]) * acos_slope[ind]) + 0x800)
- >> 12) + (ind << 8);
- }
- return;
+ Word32 i, ind = 63; /* begin at end of table -1 */
+
+
+ for ( i = M - 1; i >= 0; i-- ) {
+ /* find value in table that is just greater than lsp[i] */
+ while ( cos_table[ind] < lsp[i] ) {
+ ind--;
+ }
+ lsf[i] = ( ( ( ( lsp[i] - cos_table[ind] ) * acos_slope[ind] ) + 0x800 )
+ >> 12 ) + ( ind << 8 );
+ }
+ return;
}
@@ -841,21 +794,19 @@ static void Lsp_lsf(Word32 lsp[], Word32 lsf[])
* Returns:
* void
*/
-static void Reorder_lsf(Word32 *lsf, Word32 min_dist)
+static void Reorder_lsf( Word32 *lsf, Word32 min_dist )
{
- Word32 lsf_min, i;
+ Word32 lsf_min, i;
- lsf_min = min_dist;
+ lsf_min = min_dist;
- for(i = 0; i < M; i++)
- {
- if(lsf[i] < lsf_min)
- {
- lsf[i] = lsf_min;
- }
- lsf_min = lsf[i] + min_dist;
- }
+ for ( i = 0; i < M; i++ ) {
+ if ( lsf[i] < lsf_min ) {
+ lsf[i] = lsf_min;
+ }
+ lsf_min = lsf[i] + min_dist;
+ }
}
/* VC5.0 Global optimization does not work with this function */
@@ -895,52 +846,52 @@ static void Reorder_lsf(Word32 *lsf, Word32 min_dist)
* Returns:
* void
*/
-static void Get_lsp_pol(Word32 *lsp, Word32 *f)
+static void Get_lsp_pol( Word32 *lsp, Word32 *f )
{
- volatile Word32 f0, f1, f2, f3, f4, f5;
- Word32 l1, l2, l3, l4;
-
-
- /* f[0] = 1.0; */
- f0 = 16777216L;
-
- /* f1 = *lsp * -1024; */
- f1 = -lsp[0] << 10;
- l1 = lsp[2];
- l2 = lsp[4];
- l3 = lsp[6];
- l4 = lsp[8];
- f2 = f0 << 1;
- f2 -= (((f1 >> 16) * l1) + (((f1 & 0xFFFE) * l1) >> 16)) << 2;
- f1 -= l1 << 10;
- f3 = f1 << 1;
- f3 -= (((f2 >> 16) * l2) + (((f2 & 0xFFFE) * l2) >> 16)) << 2;
- f2 += f0;
- f2 -= (((f1 >> 16) * l2) + (((f1 & 0xFFFE) * l2) >> 16)) << 2;
- f1 -= l2 << 10;
- f4 = f2 << 1;
- f4 -= (((f3 >> 16) * l3) + (((f3 & 0xFFFE) * l3) >> 16)) << 2;
- f3 += f1;
- f3 -= (((f2 >> 16) * l3) + (((f2 & 0xFFFE) * l3) >> 16)) << 2;
- f2 += f0;
- f2 -= (((f1 >> 16) * l3) + (((f1 & 0xFFFE) * l3) >> 16)) << 2;
- f1 -= l3 << 10;
- f5 = f3 << 1;
- f5 -= (((f4 >> 16) * l4) + (((f4 & 0xFFFE) * l4) >> 16)) << 2;
- f4 += f2;
- f4 -= (((f3 >> 16) * l4) + (((f3 & 0xFFFE) * l4) >> 16)) << 2;
- f3 += f1;
- f3 -= (((f2 >> 16) * l4) + (((f2 & 0xFFFE) * l4) >> 16)) << 2;
- f2 += f0;
- f2 -= (((f1 >> 16) * l4) + (((f1 & 0xFFFE) * l4) >> 16)) << 2;
- f1 -= l4 << 10;
- f[0] = f0;
- f[1] = f1;
- f[2] = f2;
- f[3] = f3;
- f[4] = f4;
- f[5] = f5;
- return;
+ volatile Word32 f0, f1, f2, f3, f4, f5;
+ Word32 l1, l2, l3, l4;
+
+
+ /* f[0] = 1.0; */
+ f0 = 16777216L;
+
+ /* f1 = *lsp * -1024; */
+ f1 = -lsp[0] << 10;
+ l1 = lsp[2];
+ l2 = lsp[4];
+ l3 = lsp[6];
+ l4 = lsp[8];
+ f2 = f0 << 1;
+ f2 -= ( ( ( f1 >> 16 ) * l1 ) + ( ( ( f1 & 0xFFFE ) * l1 ) >> 16 ) ) << 2;
+ f1 -= l1 << 10;
+ f3 = f1 << 1;
+ f3 -= ( ( ( f2 >> 16 ) * l2 ) + ( ( ( f2 & 0xFFFE ) * l2 ) >> 16 ) ) << 2;
+ f2 += f0;
+ f2 -= ( ( ( f1 >> 16 ) * l2 ) + ( ( ( f1 & 0xFFFE ) * l2 ) >> 16 ) ) << 2;
+ f1 -= l2 << 10;
+ f4 = f2 << 1;
+ f4 -= ( ( ( f3 >> 16 ) * l3 ) + ( ( ( f3 & 0xFFFE ) * l3 ) >> 16 ) ) << 2;
+ f3 += f1;
+ f3 -= ( ( ( f2 >> 16 ) * l3 ) + ( ( ( f2 & 0xFFFE ) * l3 ) >> 16 ) ) << 2;
+ f2 += f0;
+ f2 -= ( ( ( f1 >> 16 ) * l3 ) + ( ( ( f1 & 0xFFFE ) * l3 ) >> 16 ) ) << 2;
+ f1 -= l3 << 10;
+ f5 = f3 << 1;
+ f5 -= ( ( ( f4 >> 16 ) * l4 ) + ( ( ( f4 & 0xFFFE ) * l4 ) >> 16 ) ) << 2;
+ f4 += f2;
+ f4 -= ( ( ( f3 >> 16 ) * l4 ) + ( ( ( f3 & 0xFFFE ) * l4 ) >> 16 ) ) << 2;
+ f3 += f1;
+ f3 -= ( ( ( f2 >> 16 ) * l4 ) + ( ( ( f2 & 0xFFFE ) * l4 ) >> 16 ) ) << 2;
+ f2 += f0;
+ f2 -= ( ( ( f1 >> 16 ) * l4 ) + ( ( ( f1 & 0xFFFE ) * l4 ) >> 16 ) ) << 2;
+ f1 -= l4 << 10;
+ f[0] = f0;
+ f[1] = f1;
+ f[2] = f2;
+ f[3] = f3;
+ f[4] = f4;
+ f[5] = f5;
+ return;
}
#if _MSC_VER == 1100
#pragma optimize( "", on )
@@ -966,39 +917,35 @@ static void Get_lsp_pol(Word32 *lsp, Word32 *f)
* Returns:
* void
*/
-static void Lsp_Az(Word32 lsp[], Word32 a[])
+static void Lsp_Az( Word32 lsp[], Word32 a[] )
{
- Word32 f1[6], f2[6];
- Word32 T0, i, j;
-
-
- Get_lsp_pol(&lsp[0], f1);
- Get_lsp_pol(&lsp[1], f2);
-
- for(i = 5; i > 0; i--)
- {
- f1[i] += f1[i - 1];
- f2[i] -= f2[i - 1];
- }
- a[0] = 4096;
-
- for(i = 1, j = 10; i <= 5; i++, j--)
- {
- T0 = f1[i] + f2[i];
- a[i] = (Word16)(T0 >> 13); /* emulate fixed point bug */
- if((T0 & 4096) != 0)
- {
- a[i]++;
- }
- T0 = f1[i] - f2[i];
- a[j] = (Word16)(T0 >> 13); /* emulate fixed point bug */
-
- if((T0 & 4096) != 0)
- {
- a[j]++;
- }
- }
- return;
+ Word32 f1[6], f2[6];
+ Word32 T0, i, j;
+
+
+ Get_lsp_pol( &lsp[0], f1 );
+ Get_lsp_pol( &lsp[1], f2 );
+
+ for ( i = 5; i > 0; i-- ) {
+ f1[i] += f1[i - 1];
+ f2[i] -= f2[i - 1];
+ }
+ a[0] = 4096;
+
+ for ( i = 1, j = 10; i <= 5; i++, j-- ) {
+ T0 = f1[i] + f2[i];
+ a[i] = (Word16)(T0 >> 13); /* emulate fixed point bug */
+ if ( ( T0 & 4096 ) != 0 ) {
+ a[i]++;
+ }
+ T0 = f1[i] - f2[i];
+ a[j] = (Word16)(T0 >> 13); /* emulate fixed point bug */
+
+ if ( ( T0 & 4096 ) != 0 ) {
+ a[j]++;
+ }
+ }
+ return;
}
@@ -1016,83 +963,74 @@ static void Lsp_Az(Word32 lsp[], Word32 a[])
* Returns:
* void
*/
-static void A_Refl(Word32 a[], Word32 refl[])
+static void A_Refl( Word32 a[], Word32 refl[] )
{
- /* local variables */
- int normShift;
- Word32 aState[M], bState[M];
- Word32 normProd, acc, temp, mult, scale, i, j;
-
-
- /* initialize states */
- memcpy(aState, a, M << 2);
-
- /* backward Levinson recursion */
- for(i = M - 1; i >= 0; i--)
- {
- if(labs(aState[i]) >= 4096)
- {
- goto ExitRefl;
- }
- refl[i] = aState[i] << 3;
- temp = (refl[i] * refl[i]) << 1;
- acc = (MAX_32 - temp);
- normShift = 0;
- if(acc != 0)
- {
- temp = acc;
- while(!(temp & 0x40000000))
- {
- normShift++;
- temp = temp << 1;
- }
- }
- else
- {
- normShift = 0;
- }
- scale = 15 - normShift;
- acc = (acc << normShift);
- temp = (acc + (Word32)0x00008000L);
-
- if(temp > 0)
- {
- normProd = temp >> 16;
- mult = 0x20000000L / normProd;
- }
- else
- mult = 16384;
-
- for(j = 0; j < i; j++)
- {
- acc = aState[j] << 16;
- acc -= (refl[i] * aState[i - j - 1]) << 1;
- temp = (acc + (Word32)0x00008000L) >> 16;
- temp = (mult * temp) << 1;
-
- if(scale > 0)
- {
- if((temp & ((Word32)1 << (scale - 1))) != 0)
- {
- temp = (temp >> scale) + 1;
- }
- else
- temp = (temp >> scale);
+ /* local variables */
+ int normShift;
+ Word32 aState[M], bState[M];
+ Word32 normProd, acc, temp, mult, scale, i, j;
+
+
+ /* initialize states */
+ memcpy( aState, a, M <<2 );
+
+ /* backward Levinson recursion */
+ for ( i = M - 1; i >= 0; i-- ) {
+ if ( labs( aState[i] ) >= 4096 ) {
+ goto ExitRefl;
+ }
+ refl[i] = aState[i] << 3;
+ temp = ( refl[i] * refl[i] ) << 1;
+ acc = ( MAX_32 - temp );
+ normShift=0;
+ if (acc != 0){
+ temp = acc;
+ while (!(temp & 0x40000000))
+ {
+ normShift++;
+ temp = temp << 1;
+ }
+ }
+ else{
+ normShift = 0;
+ }
+ scale = 15 - normShift;
+ acc = ( acc << normShift );
+ temp = ( acc + ( Word32 )0x00008000L );
+
+ if ( temp > 0 ) {
+ normProd = temp >> 16;
+ mult = 0x20000000L / normProd;
+ }
+ else
+ mult = 16384;
+
+ for ( j = 0; j < i; j++ ) {
+ acc = aState[j] << 16;
+ acc -= ( refl[i] * aState[i - j - 1] ) << 1;
+ temp = ( acc + ( Word32 )0x00008000L ) >> 16;
+ temp = ( mult * temp ) << 1;
+
+ if ( scale > 0 ) {
+ if ( ( temp & ( ( Word32 )1 << ( scale - 1 ) ) ) != 0 ) {
+ temp = ( temp >> scale ) + 1;
}
else
- temp = (temp >> scale);
+ temp = ( temp >> scale );
+ }
+ else
+ temp = ( temp >> scale );
- if(labs(temp) > 32767)
- {
- goto ExitRefl;
- }
- bState[j] = temp;
- }
- memcpy(aState, bState, i << 2);
- }
- return;
+ if ( labs( temp ) > 32767 ) {
+ goto ExitRefl;
+ }
+ bState[j] = temp;
+ }
+ memcpy( aState, bState, i <<2 );
+ }
+ return;
ExitRefl:
- memset(refl, 0, M << 2);
+ memset( refl, 0, M <<2 );
}
@@ -1125,32 +1063,31 @@ ExitRefl:
* Returns:
* void
*/
-static void Log2_norm(Word32 x, Word32 exp, Word32 *exponent, Word32 *
- fraction)
+static void Log2_norm( Word32 x, Word32 exp, Word32 *exponent, Word32 *
+ fraction )
{
- Word32 y, i, a;
+ Word32 y, i, a;
- if(x <= 0)
- {
- *exponent = 0;
- *fraction = 0;
- return;
- }
+ if ( x <= 0 ) {
+ *exponent = 0;
+ *fraction = 0;
+ return;
+ }
- /* Extract b25-b31 */
- i = x >> 25;
- i = i - 32;
+ /* Extract b25-b31 */
+ i = x >> 25;
+ i = i - 32;
- /* Extract b10-b24 of fraction */
- a = x >> 9;
- a = a & 0xFFFE; /* 2a */
+ /* Extract b10-b24 of fraction */
+ a = x >> 9;
+ a = a & 0xFFFE; /* 2a */
- /* fraction */
- y = (log2_table[i] << 16) - a * (log2_table[i] - log2_table[i + 1]);
- *fraction = y >> 16;
- *exponent = 30 - exp;
- return;
+ /* fraction */
+ y = ( log2_table[i] << 16 ) - a * ( log2_table[i] - log2_table[i + 1] );
+ *fraction = y >> 16;
+ *exponent = 30 - exp;
+ return;
}
@@ -1170,20 +1107,19 @@ static void Log2_norm(Word32 x, Word32 exp, Word32 *exponent, Word32 *
* Returns:
* void
*/
-static void Log2(Word32 x, Word32 *exponent, Word32 *fraction)
+static void Log2( Word32 x, Word32 *exponent, Word32 *fraction )
{
- int tmp, exp = 0;
+ int tmp, exp=0;
- if(x != 0)
- {
- tmp = x;
- while(!((tmp & 0x80000000) ^((tmp & 0x40000000) << 1)))
- {
+ if (x != 0){
+ tmp = x;
+ while (!((tmp & 0x80000000) ^ ((tmp & 0x40000000) << 1)))
+ {
exp++;
tmp = tmp << 1;
- }
- }
- Log2_norm(x << exp, exp, exponent, fraction);
+ }
+ }
+ Log2_norm( x <<exp, exp, exponent, fraction );
}
@@ -1208,41 +1144,39 @@ static void Log2(Word32 x, Word32 *exponent, Word32 *fraction)
* Returns:
* result (range: 0<=val<=0x7fffffff)
*/
-static Word32 Pow2(Word32 exponent, Word32 fraction)
+static Word32 Pow2( Word32 exponent, Word32 fraction )
{
- Word32 i, a, tmp, x, exp;
+ Word32 i, a, tmp, x, exp;
- /* Extract b10-b16 of fraction */
- i = fraction >> 10;
+ /* Extract b10-b16 of fraction */
+ i = fraction >> 10;
- /* Extract b0-b9 of fraction */
- a = (fraction << 5) & 0x7fff;
+ /* Extract b0-b9 of fraction */
+ a = ( fraction << 5 ) & 0x7fff;
- /* table[i] << 16 */
- x = pow2_table[i] << 16;
+ /* table[i] << 16 */
+ x = pow2_table[i] << 16;
- /* table[i] - table[i+1] */
- tmp = pow2_table[i] - pow2_table[i + 1];
+ /* table[i] - table[i+1] */
+ tmp = pow2_table[i] - pow2_table[i + 1];
- /* L_x -= tmp*a*2 */
- x -= (tmp * a) << 1;
+ /* L_x -= tmp*a*2 */
+ x -= ( tmp * a ) << 1;
- if(exponent >= -1)
- {
- exp = (30 - exponent);
+ if ( exponent >= -1 ) {
+ exp = ( 30 - exponent );
- /* Rounding */
- if((x & ((Word32)1 << (exp - 1))) != 0)
- {
- x = (x >> exp) + 1;
- }
- else
- x = x >> exp;
- }
- else
- x = 0;
- return(x);
+ /* Rounding */
+ if ( ( x & ( ( Word32 )1 << ( exp - 1 ) ) ) != 0 ) {
+ x = ( x >> exp ) + 1;
+ }
+ else
+ x = x >> exp;
+ }
+ else
+ x = 0;
+ return( x );
}
@@ -1260,30 +1194,27 @@ static Word32 Pow2(Word32 exponent, Word32 fraction)
* Returns:
* void
*/
-static void Build_CN_code(Word32 *seed, Word32 cod[])
+static void Build_CN_code( Word32 *seed, Word32 cod[] )
{
- Word32 i, j, k;
-
-
- memset(cod, 0, L_SUBFR << 2);
-
- for(k = 0; k < 10; k++)
- {
- i = pseudonoise(seed, 2); /* generate pulse position */
- i = (i * 20) >> 1;
- i = (i + k);
- j = pseudonoise(seed, 1); /* generate sign */
-
- if(j > 0)
- {
- cod[i] = 4096;
- }
- else
- {
- cod[i] = -4096;
- }
- }
- return;
+ Word32 i, j, k;
+
+
+ memset( cod, 0, L_SUBFR <<2 );
+
+ for ( k = 0; k < 10; k++ ) {
+ i = pseudonoise( seed, 2 ); /* generate pulse position */
+ i = ( i * 20 ) >> 1;
+ i = ( i + k );
+ j = pseudonoise( seed, 1 ); /* generate sign */
+
+ if ( j > 0 ) {
+ cod[i] = 4096;
+ }
+ else {
+ cod[i] = -4096;
+ }
+ }
+ return;
}
@@ -1303,73 +1234,64 @@ static void Build_CN_code(Word32 *seed, Word32 cod[])
* Returns:
* void
*/
-static void Build_CN_param(Word16 *seed, enum Mode mode, Word16 parm[])
+static void Build_CN_param( Word16 *seed, enum Mode mode, Word16 parm[] )
{
- Word32 i;
- const Word32 *p;
-
-
- *seed = (Word16)((*seed * 31821) + 13849L);
- p = &window_200_40[ * seed & 0x7F];
-
- switch(mode)
- {
- case MR122:
- for(i = 0; i < PRMNO_MR122; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR122[i]));
- }
- break;
-
- case MR102:
- for(i = 0; i < PRMNO_MR102; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR102[i]));
- }
- break;
-
- case MR795:
- for(i = 0; i < PRMNO_MR795; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR795[i]));
- }
- break;
-
- case MR74:
- for(i = 0; i < PRMNO_MR74; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR74[i]));
- }
- break;
-
- case MR67:
- for(i = 0; i < PRMNO_MR67; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR67[i]));
- }
- break;
-
- case MR59:
- for(i = 0; i < PRMNO_MR59; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR59[i]));
- }
- break;
-
- case MR515:
- for(i = 0; i < PRMNO_MR515; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR515[i]));
- }
- break;
-
- case MR475:
- for(i = 0; i < PRMNO_MR475; i++)
- {
- parm[i] = (Word16)(*p++ & ~(0xFFFF << bitno_MR475[i]));
- }
- break;
- }
+ Word32 i;
+ const Word32 *p;
+
+
+ *seed = ( Word16 )( ( *seed * 31821 ) + 13849L );
+ p = &window_200_40[ * seed & 0x7F];
+
+ switch ( mode ) {
+ case MR122:
+ for ( i = 0; i < PRMNO_MR122; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR122[i] ) );
+ }
+ break;
+
+ case MR102:
+ for ( i = 0; i < PRMNO_MR102; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR102[i] ) );
+ }
+ break;
+
+ case MR795:
+ for ( i = 0; i < PRMNO_MR795; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR795[i] ) );
+ }
+ break;
+
+ case MR74:
+ for ( i = 0; i < PRMNO_MR74; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR74[i] ) );
+ }
+ break;
+
+ case MR67:
+ for ( i = 0; i < PRMNO_MR67; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR67[i] ) );
+ }
+ break;
+
+ case MR59:
+ for ( i = 0; i < PRMNO_MR59; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR59[i] ) );
+ }
+ break;
+
+ case MR515:
+ for ( i = 0; i < PRMNO_MR515; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR515[i] ) );
+ }
+ break;
+
+ case MR475:
+ for ( i = 0; i < PRMNO_MR475; i++ ) {
+ parm[i] = ( Word16 )( *p++ & ~( 0xFFFF << bitno_MR475[i] ) );
+ }
+ break;
+ }
}
@@ -1391,57 +1313,53 @@ static void Build_CN_param(Word16 *seed, enum Mode mode, Word16 parm[])
* Returns:
* void
*/
-static Word32 Syn_filt(Word32 a[], Word32 x[], Word32 y[], Word32 lg, Word32 mem[]
- , Word32 update)
+static Word32 Syn_filt( Word32 a[], Word32 x[], Word32 y[], Word32 lg, Word32 mem[]
+ , Word32 update )
{
- Word32 tmp[50]; /* malloc is slow */
- Word32 s, a0, overflow = 0;
- Word32 *yy, *yy_limit;
-
-
- /* Copy mem[] to yy[] */
- memcpy(tmp, mem, 40);
- yy = tmp + M;
- yy_limit = yy + lg;
- a0 = a[0];
-
- /* Do the filtering. */
- while(yy < yy_limit)
- {
-
- s = *x++ * a0;
- s -= yy[-1] * a[1];
- s -= yy[-2] * a[2];
- s -= yy[-3] * a[3];
- s -= yy[-4] * a[4];
- s -= yy[-5] * a[5];
- s -= yy[-6] * a[6];
- s -= yy[-7] * a[7];
- s -= yy[-8] * a[8];
- s -= yy[-9] * a[9];
- s -= yy[-10] * a[10];
- if(labs(s) < 0x7ffffff)
- *yy = (s + 0x800L) >> 12;
- else if(s > 0)
- {
- *yy = 32767;
- overflow = 1;
- }
- else
- {
- *yy = -32768;
- overflow = 1;
- }
- yy++;
- }
- memcpy(y, &tmp[M], lg << 2);
-
- /* Update of memory if update==1 */
- if(update)
- {
- memcpy(mem, &y[lg - M], 40);
- }
- return overflow;
+ Word32 tmp[50]; /* malloc is slow */
+ Word32 s, a0, overflow = 0;
+ Word32 *yy, *yy_limit;
+
+
+ /* Copy mem[] to yy[] */
+ memcpy( tmp, mem, 40 );
+ yy = tmp + M;
+ yy_limit = yy + lg;
+ a0 = a[0];
+
+ /* Do the filtering. */
+ while ( yy < yy_limit ) {
+
+ s = *x++ * a0;
+ s -= yy[-1] * a[1];
+ s -= yy[-2] * a[2];
+ s -= yy[-3] * a[3];
+ s -= yy[-4] * a[4];
+ s -= yy[-5] * a[5];
+ s -= yy[-6] * a[6];
+ s -= yy[-7] * a[7];
+ s -= yy[-8] * a[8];
+ s -= yy[-9] * a[9];
+ s -= yy[-10] * a[10];
+ if ( labs( s ) < 0x7ffffff )
+ *yy = ( s + 0x800L ) >> 12;
+ else if ( s > 0 ) {
+ *yy = 32767;
+ overflow = 1;
+ }
+ else {
+ *yy = -32768;
+ overflow = 1;
+ }
+ yy++;
+ }
+ memcpy( y, &tmp[M], lg <<2 );
+
+ /* Update of memory if update==1 */
+ if ( update ) {
+ memcpy( mem, &y[lg - M], 40 );
+ }
+ return overflow;
}
/*
@@ -1462,57 +1380,50 @@ static Word32 Syn_filt(Word32 a[], Word32 x[], Word32 y[], Word32 lg, Word32 mem
* Returns:
* void
*/
-static void Syn_filt_overflow(Word32 a[], Word32 x[], Word32 y[], Word32 lg, Word32 mem[]
- , Word32 update)
+static void Syn_filt_overflow( Word32 a[], Word32 x[], Word32 y[], Word32 lg, Word32 mem[]
+ , Word32 update )
{
- Word32 tmp[50]; /* malloc is slow */
- Word32 i, j, s, a0;
- Word32 *yy;
-
-
- /* Copy mem[] to yy[] */
- memcpy(tmp, mem, 40);
- yy = tmp + M;
- a0 = a[0];
-
- /* Do the filtering. */
- for(i = 0; i < lg; i++)
- {
- s = x[i] * a0;
-
- for(j = 1; j <= M; j++)
- {
- s -= a[j] * yy[ - j];
- if(s > 1073741823)
- {
- s = 1073741823;
- }
- else if(s < -1073741824)
- {
- s = -1073741824;
- }
- }
-
- if(labs(s) < 0x7FFE800)
- *yy = (s + 0x800L) >> 12;
- else if(s > 0)
- {
- *yy = 32767;
- }
- else
- {
- *yy = -32768;
- }
- yy++;
- }
- memcpy(y, &tmp[M], lg << 2);
-
- /* Update of memory if update==1 */
- if(update)
- {
- memcpy(mem, &y[lg - M], 40);
- }
- return;
+ Word32 tmp[50]; /* malloc is slow */
+ Word32 i, j, s, a0;
+ Word32 *yy;
+
+
+ /* Copy mem[] to yy[] */
+ memcpy( tmp, mem, 40 );
+ yy = tmp + M;
+ a0 = a[0];
+
+ /* Do the filtering. */
+ for ( i = 0; i < lg; i++ ) {
+ s = x[i] * a0;
+
+ for ( j = 1; j <= M; j++ ) {
+ s -= a[j] * yy[ - j];
+ if (s > 1073741823){
+ s = 1073741823;
+ }
+ else if ( s < -1073741824) {
+ s = -1073741824;
+ }
+ }
+
+ if ( labs( s ) < 0x7FFE800 )
+ *yy = ( s + 0x800L ) >> 12;
+ else if ( s > 0 ) {
+ *yy = 32767;
+ }
+ else {
+ *yy = -32768;
+ }
+ yy++;
+ }
+ memcpy( y, &tmp[M], lg <<2 );
+
+ /* Update of memory if update==1 */
+ if ( update ) {
+ memcpy( mem, &y[lg - M], 40 );
+ }
+ return;
}
/*
@@ -1539,463 +1450,415 @@ static void Syn_filt_overflow(Word32 a[], Word32 x[], Word32 y[], Word32 lg, Wor
* Returns:
* void
*/
-static void dtx_dec(dtx_decState *st, Word32 *mem_syn, D_plsfState *lsfState,
- gc_predState *pred_state, Cb_gain_averageState *averState, enum
- DTXStateType new_state, enum Mode mode, Word16 parm[], Word32 synth[],
- Word32 A_t[])
+static void dtx_dec( dtx_decState *st, Word32 *mem_syn, D_plsfState *lsfState,
+ gc_predState *pred_state, Cb_gain_averageState *averState, enum
+ DTXStateType new_state, enum Mode mode, Word16 parm[], Word32 synth[],
+ Word32 A_t[] )
{
- Word32 ex[L_SUBFR], acoeff[11], acoeff_variab[M + 1], lsp_int[M];
- Word32 refl[M], lsf[M], lsf_int[M], lsf_int_variab[M], lsp_int_variab[M];
- Word32 i, j, int_fac, log_en_int, pred_err, log_pg_e, log_pg_m, log_pg;
- Word32 negative, lsf_mean, lsf_variab_index, lsf_variab_factor, ptr;
- Word16 log_en_index, log_en_int_e, log_en_int_m, level, ma_pred_init,
- tmp_int_length;
-
-
- if((st->dtxHangoverAdded != 0) & (st->sid_frame != 0))
- {
- /*
- * sidFirst after dtx hangover period
- * or sidUpd after dtxhangover
- */
- /* set log_en_adjust to correct value */
- st->log_en_adjust = dtx_log_en_adjust[mode];
- ptr = st->lsf_hist_ptr + M;
-
- if(ptr == 80)
- {
- ptr = 0;
- }
- memcpy(&st->lsf_hist[ptr], &st->lsf_hist[st->lsf_hist_ptr], M << 2);
- ptr = st->log_en_hist_ptr + 1;
-
- if(ptr == DTX_HIST_SIZE)
- {
- ptr = 0;
- }
- st->log_en_hist[ptr] = st->log_en_hist[st->log_en_hist_ptr]; /* Q11 */
-
- /*
- * compute mean log energy and lsp
- * from decoded signal (SID_FIRST)
- */
- st->log_en = 0;
- memset(lsf, 0, M << 2);
-
- /* average energy and lsp */
- for(i = 0; i < DTX_HIST_SIZE; i++)
- {
- st->log_en = st->log_en + (st->log_en_hist[i] >> 3);
-
- for(j = 0; j < M; j++)
- {
- lsf[j] += st->lsf_hist[i * M + j];
- }
- }
-
- for(j = 0; j < M; j++)
- {
- lsf[j] = lsf[j] >> 3; /* divide by 8 */
- }
- Lsf_lsp(lsf, st->lsp);
-
- /*
- * make log_en speech coder mode independent
- * added again later before synthesis
- */
- st->log_en = st->log_en - st->log_en_adjust;
-
- /* compute lsf variability vector */
- memcpy(st->lsf_hist_mean, st->lsf_hist, 80 << 2);
-
- for(i = 0; i < M; i++)
- {
- lsf_mean = 0;
-
- /* compute mean lsf */
- for(j = 0; j < 8; j++)
- {
- lsf_mean += st->lsf_hist_mean[i + j * M];
- }
- lsf_mean = lsf_mean >> 3;
-
- /*
- * subtract mean and limit to within reasonable limits
- * moreover the upper lsf's are attenuated
- */
- for(j = 0; j < 8; j++)
- {
- /* subtract mean */
- st->lsf_hist_mean[i + j * M] = st->lsf_hist_mean[i + j * M] -
- lsf_mean;
-
- /* attenuate deviation from mean, especially for upper lsf's */
- st->lsf_hist_mean[i + j * M] = (st->lsf_hist_mean[i + j * M] *
- lsf_hist_mean_scale[i]) >> 15;
-
- /* limit the deviation */
- if(st->lsf_hist_mean[i + j * M] < 0)
- {
- negative = 1;
- }
- else
- {
- negative = 0;
- }
- st->lsf_hist_mean[i + j * M] = labs(st->lsf_hist_mean[i + j * M]);
-
- /* apply soft limit */
- if(st->lsf_hist_mean[i + j * M] > 655)
- {
- st->lsf_hist_mean[i + j * M] = 655 + ((st->lsf_hist_mean[i + j
- * M] - 655) >> 2);
- }
-
- /* apply hard limit */
- if(st->lsf_hist_mean[i + j * M] > 1310)
- {
- st->lsf_hist_mean[i + j * M] = 1310;
- }
-
- if(negative != 0)
- {
- st->lsf_hist_mean[i + j * M] = -st->lsf_hist_mean[i + j * M];
- }
+ Word32 ex[L_SUBFR], acoeff[11], acoeff_variab[M + 1], lsp_int[M];
+ Word32 refl[M], lsf[M], lsf_int[M], lsf_int_variab[M], lsp_int_variab[M];
+ Word32 i, j, int_fac, log_en_int, pred_err, log_pg_e, log_pg_m, log_pg;
+ Word32 negative, lsf_mean, lsf_variab_index, lsf_variab_factor, ptr;
+ Word16 log_en_index, log_en_int_e, log_en_int_m, level, ma_pred_init,
+ tmp_int_length;
+
+
+ if ( ( st->dtxHangoverAdded != 0 ) & ( st->sid_frame != 0 ) ) {
+ /*
+ * sidFirst after dtx hangover period
+ * or sidUpd after dtxhangover
+ */
+ /* set log_en_adjust to correct value */
+ st->log_en_adjust = dtx_log_en_adjust[mode];
+ ptr = st->lsf_hist_ptr + M;
+
+ if ( ptr == 80 ) {
+ ptr = 0;
+ }
+ memcpy( &st->lsf_hist[ptr], &st->lsf_hist[st->lsf_hist_ptr], M <<2 );
+ ptr = st->log_en_hist_ptr + 1;
+
+ if ( ptr == DTX_HIST_SIZE ) {
+ ptr = 0;
+ }
+ st->log_en_hist[ptr] = st->log_en_hist[st->log_en_hist_ptr]; /* Q11 */
+
+ /*
+ * compute mean log energy and lsp
+ * from decoded signal (SID_FIRST)
+ */
+ st->log_en = 0;
+ memset( lsf, 0, M <<2 );
+
+ /* average energy and lsp */
+ for ( i = 0; i < DTX_HIST_SIZE; i++ ) {
+ st->log_en = st->log_en + ( st->log_en_hist[i] >> 3 );
+
+ for ( j = 0; j < M; j++ ) {
+ lsf[j] += st->lsf_hist[i * M + j];
+ }
+ }
+
+ for ( j = 0; j < M; j++ ) {
+ lsf[j] = lsf[j] >> 3; /* divide by 8 */
+ }
+ Lsf_lsp( lsf, st->lsp );
+
+ /*
+ * make log_en speech coder mode independent
+ * added again later before synthesis
+ */
+ st->log_en = st->log_en - st->log_en_adjust;
+
+ /* compute lsf variability vector */
+ memcpy( st->lsf_hist_mean, st->lsf_hist, 80 <<2 );
+
+ for ( i = 0; i < M; i++ ) {
+ lsf_mean = 0;
+
+ /* compute mean lsf */
+ for ( j = 0; j < 8; j++ ) {
+ lsf_mean += st->lsf_hist_mean[i + j * M];
+ }
+ lsf_mean = lsf_mean >> 3;
+
+ /*
+ * subtract mean and limit to within reasonable limits
+ * moreover the upper lsf's are attenuated
+ */
+ for ( j = 0; j < 8; j++ ) {
+ /* subtract mean */
+ st->lsf_hist_mean[i + j * M] = st->lsf_hist_mean[i + j * M] -
+ lsf_mean;
+
+ /* attenuate deviation from mean, especially for upper lsf's */
+ st->lsf_hist_mean[i + j * M] = ( st->lsf_hist_mean[i + j * M] *
+ lsf_hist_mean_scale[i] ) >> 15;
+
+ /* limit the deviation */
+ if ( st->lsf_hist_mean[i + j * M] < 0 ) {
+ negative = 1;
}
- }
- }
-
- if(st->sid_frame != 0)
- {
- /*
- * Set old SID parameters, always shift
- * even if there is no new valid_data
- */
- memcpy(st->lsp_old, st->lsp, M << 2);
- st->old_log_en = st->log_en;
-
- if(st->valid_data != 0) /* new data available (no CRC) */
- {
- /* Compute interpolation factor, since the division only works
- * for values of since_last_sid < 32 we have to limit the
- * interpolation to 32 frames
- */
- tmp_int_length = st->since_last_sid;
- st->since_last_sid = 0;
-
- if(tmp_int_length > 32)
- {
- tmp_int_length = 32;
+ else {
+ negative = 0;
}
+ st->lsf_hist_mean[i + j * M] = labs( st->lsf_hist_mean[i + j * M] );
- if(tmp_int_length >= 2)
- {
- st->true_sid_period_inv = 0x2000000 / (tmp_int_length
- << 10);
+ /* apply soft limit */
+ if ( st->lsf_hist_mean[i + j * M] > 655 ) {
+ st->lsf_hist_mean[i + j * M] = 655 + ( ( st->lsf_hist_mean[i + j
+ * M] - 655 ) >> 2 );
}
- else
- {
- st->true_sid_period_inv = 16384; /* 0.5 it Q15 */
- }
- memcpy(lsfState->past_r_q, &past_rq_init[parm[0] * M], M << 2);
- D_plsf_3(lsfState, MRDTX, 0, &parm[1], st->lsp);
-
- /* reset for next speech frame */
- memset(lsfState->past_r_q, 0, M << 2);
- log_en_index = parm[4];
- /* Q11 and divide by 4 */
- st->log_en = (Word16)(log_en_index << 9);
-
- /* Subtract 2.5 in Q11 */
- st->log_en = (Word16)(st->log_en - 5120);
-
- /* Index 0 is reserved for silence */
- if(log_en_index == 0)
- {
- st->log_en = MIN_16;
+ /* apply hard limit */
+ if ( st->lsf_hist_mean[i + j * M] > 1310 ) {
+ st->lsf_hist_mean[i + j * M] = 1310;
}
- /*
- * no interpolation at startup after coder reset
- * or when SID_UPD has been received right after SPEECH
- */
- if((st->data_updated == 0) || (st->dtxGlobalState == SPEECH))
- {
- memcpy(st->lsp_old, st->lsp, M << 2);
- st->old_log_en = st->log_en;
+ if ( negative != 0 ) {
+ st->lsf_hist_mean[i + j * M] = -st->lsf_hist_mean[i + j * M];
}
- } /* endif valid_data */
-
- /* initialize gain predictor memory of other modes */
- ma_pred_init = (Word16)((st->log_en >> 1) - 9000);
-
- if(ma_pred_init > 0)
- {
- ma_pred_init = 0;
- }
-
- if(ma_pred_init < - 14436)
- {
- ma_pred_init = -14436;
- }
- pred_state->past_qua_en[0] = ma_pred_init;
- pred_state->past_qua_en[1] = ma_pred_init;
- pred_state->past_qua_en[2] = ma_pred_init;
- pred_state->past_qua_en[3] = ma_pred_init;
-
- /* past_qua_en for other modes than MR122 */
- ma_pred_init = (Word16)((5443 * ma_pred_init) >> 15);
-
- /* scale down by factor 20*log10(2) in Q15 */
- pred_state->past_qua_en_MR122[0] = ma_pred_init;
- pred_state->past_qua_en_MR122[1] = ma_pred_init;
- pred_state->past_qua_en_MR122[2] = ma_pred_init;
- pred_state->past_qua_en_MR122[3] = ma_pred_init;
- } /* endif sid_frame */
-
- /*
- * CN generation
- * recompute level adjustment factor Q11
- * st->log_en_adjust = 0.9*st->log_en_adjust +
- * 0.1*dtx_log_en_adjust[mode]);
- */
- st->log_en_adjust = (Word16)(((st->log_en_adjust * 29491) >> 15) + ((
- (dtx_log_en_adjust[mode] << 5) * 3277) >> 20));
-
- /* Interpolate SID info */
- /* Q10 */
- if(st->since_last_sid > 30)
- int_fac = 32767;
- else
- int_fac = (Word16)((st->since_last_sid + 1) << 10);
-
- /* Q10 * Q15 -> Q10 */
- int_fac = (int_fac * st->true_sid_period_inv) >> 15;
-
- /* Maximize to 1.0 in Q10 */
- if(int_fac > 1024)
- {
- int_fac = 1024;
- }
-
- /* Q10 -> Q14 */
- int_fac = (Word16)(int_fac << 4);
-
- /* Q14 * Q11->Q26 */
- log_en_int = (int_fac * st->log_en) << 1;
-
- for(i = 0;
- i < M;
- i++)
- {
- /* Q14 * Q15 -> Q14 */
- lsp_int[i] = (int_fac * st->lsp[i]) >> 15;
- }
-
- /* 1-k in Q14 */
- int_fac = 16384 - int_fac;
-
- /* (Q14 * Q11 -> Q26) + Q26 -> Q26 */
- log_en_int += (int_fac * st->old_log_en) << 1;
-
- for(i = 0;
- i < M;
- i++)
- {
- /* Q14 + (Q14 * Q15 -> Q14) -> Q14 */
- lsp_int[i] = lsp_int[i] + ((int_fac * st->lsp_old[i]) >> 15);
-
- /* Q14 -> Q15 */
- lsp_int[i] = lsp_int[i] << 1;
- }
-
- /* compute the amount of lsf variability */
- /* -0.6 in Q12 */
- lsf_variab_factor = st->log_pg_mean - 2457;
-
- /* *0.3 Q12*Q15 -> Q12 */
- lsf_variab_factor = 4096 - ((lsf_variab_factor * 9830) >> 15);
-
- /* limit to values between 0..1 in Q12 */
- if(lsf_variab_factor >= 4096)
- {
- lsf_variab_factor = 32767;
- }
- else if(lsf_variab_factor < 0)
- {
- lsf_variab_factor = 0;
- }
- else
- lsf_variab_factor = lsf_variab_factor << 3; /* -> Q15 */
-
- /* get index of vector to do variability with */
- lsf_variab_index = pseudonoise(&st->pn_seed_rx, 3);
-
- /* convert to lsf */
- Lsp_lsf(lsp_int, lsf_int);
-
- /* apply lsf variability */
- memcpy(lsf_int_variab, lsf_int, M << 2);
-
- for(i = 0;
- i < M;
- i++)
- {
- lsf_int_variab[i] = lsf_int_variab[i] + ((lsf_variab_factor * st->
- lsf_hist_mean[i + lsf_variab_index * M]) >> 15);
- }
-
- /* make sure that LSP's are ordered */
- Reorder_lsf(lsf_int, LSF_GAP);
- Reorder_lsf(lsf_int_variab, LSF_GAP);
-
- /* copy lsf to speech decoders lsf state */
- memcpy(lsfState->past_lsf_q, lsf_int, M << 2);
-
- /* convert to lsp */
- Lsf_lsp(lsf_int, lsp_int);
- Lsf_lsp(lsf_int_variab, lsp_int_variab);
-
- /* Compute acoeffs Q12 acoeff is used for level
- * normalization and Post_Filter, acoeff_variab is
- * used for synthesis filter
- * by doing this we make sure that the level
- * in high frequenncies does not jump up and down
- */
- Lsp_Az(lsp_int, acoeff);
- Lsp_Az(lsp_int_variab, acoeff_variab);
-
- /* For use in Post_Filter */
- memcpy(&A_t[0], acoeff, MP1 << 2);
- memcpy(&A_t[MP1], acoeff, MP1 << 2);
- memcpy(&A_t[MP1 <<1], acoeff, MP1 << 2);
- memcpy(&A_t[MP1 + MP1 + MP1], acoeff, MP1 << 2);
-
- /* Compute reflection coefficients Q15 */
- A_Refl(&acoeff[1], refl);
-
- /* Compute prediction error in Q15 */
- /* 0.99997 in Q15 */
- pred_err = MAX_16;
-
- for(i = 0;
- i < M;
- i++)
- {
- pred_err = (pred_err * (MAX_16 - ((refl[i] * refl[i]) >> 15))) >>
- 15;
- }
-
- /* compute logarithm of prediction gain */
- Log2(pred_err, &log_pg_e, &log_pg_m);
-
- /* convert exponent and mantissa to Word16 Q12 */
- /* Q12 */
- log_pg = (log_pg_e - 15) << 12;
- /* saturate */
- if(log_pg < -32768)
- {
- log_pg = -32768;
- }
- log_pg = (-(log_pg + (log_pg_m >> 3))) >> 1;
- st->log_pg_mean = (Word16)(((29491 * st->log_pg_mean) >> 15) + ((3277
- * log_pg) >> 15));
-
- /* Compute interpolated log energy */
- /* Q26 -> Q16 */
- log_en_int = log_en_int >> 10;
-
- /* Add 4 in Q16 */
- log_en_int += 262144L;
-
- /* subtract prediction gain */
- log_en_int = log_en_int - (log_pg << 4);
-
- /* adjust level to speech coder mode */
- log_en_int += st->log_en_adjust << 5;
- log_en_int_e = (Word16)(log_en_int >> 16);
- log_en_int_m = (Word16)((log_en_int - (log_en_int_e << 16)) >> 1);
-
- /* Q4 */
- level = (Word16)(Pow2(log_en_int_e, log_en_int_m));
-
- for(i = 0; i < 4; i++)
- {
- /* Compute innovation vector */
- Build_CN_code(&st->pn_seed_rx, ex);
-
- for(j = 0; j < L_SUBFR; j++)
- {
- ex[j] = (level * ex[j]) >> 15;
- }
-
- /* Synthesize */
- Syn_filt(acoeff_variab, ex, &synth[i * L_SUBFR], L_SUBFR, mem_syn, 1);
- } /* next i */
-
- /* reset codebook averaging variables */
- averState->hangVar = 20;
- averState->hangCount = 0;
-
- if(new_state == DTX_MUTE)
- {
+ }
+ }
+ }
+
+ if ( st->sid_frame != 0 ) {
+ /*
+ * Set old SID parameters, always shift
+ * even if there is no new valid_data
+ */
+ memcpy( st->lsp_old, st->lsp, M <<2 );
+ st->old_log_en = st->log_en;
+
+ if ( st->valid_data != 0 ) /* new data available (no CRC) */ {
+ /* Compute interpolation factor, since the division only works
+ * for values of since_last_sid < 32 we have to limit the
+ * interpolation to 32 frames
+ */
+ tmp_int_length = st->since_last_sid;
+ st->since_last_sid = 0;
+
+ if ( tmp_int_length > 32 ) {
+ tmp_int_length = 32;
+ }
+
+ if ( tmp_int_length >= 2 ) {
+ st->true_sid_period_inv = 0x2000000 / ( tmp_int_length
+ << 10 );
+ }
+ else {
+ st->true_sid_period_inv = 16384; /* 0.5 it Q15 */
+ }
+ memcpy( lsfState->past_r_q, &past_rq_init[parm[0] * M], M <<2 );
+ D_plsf_3( lsfState, MRDTX, 0, &parm[1], st->lsp );
+
+ /* reset for next speech frame */
+ memset( lsfState->past_r_q, 0, M <<2 );
+ log_en_index = parm[4];
+
+ /* Q11 and divide by 4 */
+ st->log_en = ( Word16 )( log_en_index << 9 );
+
+ /* Subtract 2.5 in Q11 */
+ st->log_en = ( Word16 )( st->log_en - 5120 );
+
+ /* Index 0 is reserved for silence */
+ if ( log_en_index == 0 ) {
+ st->log_en = MIN_16;
+ }
+
+ /*
+ * no interpolation at startup after coder reset
+ * or when SID_UPD has been received right after SPEECH
+ */
+ if ( ( st->data_updated == 0 ) || ( st->dtxGlobalState == SPEECH ) ) {
+ memcpy( st->lsp_old, st->lsp, M <<2 );
+ st->old_log_en = st->log_en;
+ }
+ } /* endif valid_data */
+
+ /* initialize gain predictor memory of other modes */
+ ma_pred_init = ( Word16 )( ( st->log_en >> 1 ) - 9000 );
+
+ if ( ma_pred_init > 0 ) {
+ ma_pred_init = 0;
+ }
+
+ if ( ma_pred_init < - 14436 ) {
+ ma_pred_init = -14436;
+ }
+ pred_state->past_qua_en[0] = ma_pred_init;
+ pred_state->past_qua_en[1] = ma_pred_init;
+ pred_state->past_qua_en[2] = ma_pred_init;
+ pred_state->past_qua_en[3] = ma_pred_init;
+
+ /* past_qua_en for other modes than MR122 */
+ ma_pred_init = ( Word16 )( ( 5443*ma_pred_init ) >> 15 );
+
+ /* scale down by factor 20*log10(2) in Q15 */
+ pred_state->past_qua_en_MR122[0] = ma_pred_init;
+ pred_state->past_qua_en_MR122[1] = ma_pred_init;
+ pred_state->past_qua_en_MR122[2] = ma_pred_init;
+ pred_state->past_qua_en_MR122[3] = ma_pred_init;
+ } /* endif sid_frame */
+
+ /*
+ * CN generation
+ * recompute level adjustment factor Q11
+ * st->log_en_adjust = 0.9*st->log_en_adjust +
+ * 0.1*dtx_log_en_adjust[mode]);
+ */
+ st->log_en_adjust = ( Word16 )( ( ( st->log_en_adjust * 29491 ) >> 15 ) + ( (
+ ( dtx_log_en_adjust[mode] << 5 ) * 3277 ) >> 20 ) );
+
+ /* Interpolate SID info */
+ /* Q10 */
+ if ( st->since_last_sid > 30 )
+ int_fac = 32767;
+ else
+ int_fac = ( Word16 )( (st->since_last_sid + 1) << 10 );
+
+ /* Q10 * Q15 -> Q10 */
+ int_fac = ( int_fac * st->true_sid_period_inv ) >> 15;
+
+ /* Maximize to 1.0 in Q10 */
+ if ( int_fac > 1024 ) {
+ int_fac = 1024;
+ }
+
+ /* Q10 -> Q14 */
+ int_fac = ( Word16 )( int_fac << 4 );
+
+ /* Q14 * Q11->Q26 */
+ log_en_int = ( int_fac * st->log_en ) << 1;
+
+ for ( i = 0; i < M; i++ ) {
+ /* Q14 * Q15 -> Q14 */
+ lsp_int[i] = ( int_fac * st->lsp[i] ) >> 15;
+ }
+
+ /* 1-k in Q14 */
+ int_fac = 16384 - int_fac;
+
+ /* (Q14 * Q11 -> Q26) + Q26 -> Q26 */
+ log_en_int += ( int_fac * st->old_log_en ) << 1;
+
+ for ( i = 0; i < M; i++ ) {
+ /* Q14 + (Q14 * Q15 -> Q14) -> Q14 */
+ lsp_int[i] = lsp_int[i] + ( ( int_fac * st->lsp_old[i] ) >> 15 );
+
+ /* Q14 -> Q15 */
+ lsp_int[i] = lsp_int[i] << 1;
+ }
+
+ /* compute the amount of lsf variability */
+ /* -0.6 in Q12 */
+ lsf_variab_factor = st->log_pg_mean - 2457;
+
+ /* *0.3 Q12*Q15 -> Q12 */
+ lsf_variab_factor = 4096 - ( ( lsf_variab_factor * 9830 ) >> 15 );
+
+ /* limit to values between 0..1 in Q12 */
+ if ( lsf_variab_factor >= 4096 ) {
+ lsf_variab_factor = 32767;
+ }
+ else if ( lsf_variab_factor < 0 ) {
+ lsf_variab_factor = 0;
+ }
+ else
+ lsf_variab_factor = lsf_variab_factor << 3; /* -> Q15 */
+
+ /* get index of vector to do variability with */
+ lsf_variab_index = pseudonoise( &st->pn_seed_rx, 3 );
+
+ /* convert to lsf */
+ Lsp_lsf( lsp_int, lsf_int );
+
+ /* apply lsf variability */
+ memcpy( lsf_int_variab, lsf_int, M <<2 );
+
+ for ( i = 0; i < M; i++ ) {
+ lsf_int_variab[i] = lsf_int_variab[i] + ( ( lsf_variab_factor * st->
+ lsf_hist_mean[i + lsf_variab_index * M] ) >> 15 );
+ }
+
+ /* make sure that LSP's are ordered */
+ Reorder_lsf( lsf_int, LSF_GAP );
+ Reorder_lsf( lsf_int_variab, LSF_GAP );
+
+ /* copy lsf to speech decoders lsf state */
+ memcpy( lsfState->past_lsf_q, lsf_int, M <<2 );
+
+ /* convert to lsp */
+ Lsf_lsp( lsf_int, lsp_int );
+ Lsf_lsp( lsf_int_variab, lsp_int_variab );
+
+ /* Compute acoeffs Q12 acoeff is used for level
+ * normalization and Post_Filter, acoeff_variab is
+ * used for synthesis filter
+ * by doing this we make sure that the level
+ * in high frequenncies does not jump up and down
+ */
+ Lsp_Az( lsp_int, acoeff );
+ Lsp_Az( lsp_int_variab, acoeff_variab );
+
+ /* For use in Post_Filter */
+ memcpy( &A_t[0], acoeff, MP1 <<2 );
+ memcpy( &A_t[MP1], acoeff, MP1 <<2 );
+ memcpy( &A_t[MP1 <<1], acoeff, MP1 <<2 );
+ memcpy( &A_t[MP1 + MP1 + MP1], acoeff, MP1 <<2 );
+
+ /* Compute reflection coefficients Q15 */
+ A_Refl( &acoeff[1], refl );
+
+ /* Compute prediction error in Q15 */
+ /* 0.99997 in Q15 */
+ pred_err = MAX_16;
+
+ for ( i = 0; i < M; i++ ) {
+ pred_err = ( pred_err * ( MAX_16 - ( ( refl[i] * refl[i] ) >> 15 ) ) ) >>
+ 15;
+ }
+
+ /* compute logarithm of prediction gain */
+ Log2( pred_err, &log_pg_e, &log_pg_m );
+
+ /* convert exponent and mantissa to Word16 Q12 */
+ /* Q12 */
+ log_pg = ( log_pg_e - 15 ) << 12;
+ /* saturate */
+ if (log_pg < -32768) {
+ log_pg = -32768;
+ }
+ log_pg = ( -( log_pg + ( log_pg_m >> 3 ) ) ) >> 1;
+ st->log_pg_mean = ( Word16 )( ( ( 29491*st->log_pg_mean ) >> 15 ) + ( ( 3277
+ * log_pg ) >> 15 ) );
+
+ /* Compute interpolated log energy */
+ /* Q26 -> Q16 */
+ log_en_int = log_en_int >> 10;
+
+ /* Add 4 in Q16 */
+ log_en_int += 262144L;
+
+ /* subtract prediction gain */
+ log_en_int = log_en_int - ( log_pg << 4 );
+
+ /* adjust level to speech coder mode */
+ log_en_int += st->log_en_adjust << 5;
+ log_en_int_e = ( Word16 )( log_en_int >> 16 );
+ log_en_int_m = ( Word16 )( ( log_en_int - ( log_en_int_e << 16 ) ) >> 1 );
+
+ /* Q4 */
+ level = ( Word16 )( Pow2( log_en_int_e, log_en_int_m ) );
+
+ for ( i = 0; i < 4; i++ ) {
+ /* Compute innovation vector */
+ Build_CN_code( &st->pn_seed_rx, ex );
+
+ for ( j = 0; j < L_SUBFR; j++ ) {
+ ex[j] = ( level * ex[j] ) >> 15;
+ }
+
+ /* Synthesize */
+ Syn_filt( acoeff_variab, ex, &synth[i * L_SUBFR], L_SUBFR, mem_syn, 1 );
+ } /* next i */
+
+ /* reset codebook averaging variables */
+ averState->hangVar = 20;
+ averState->hangCount = 0;
+
+ if ( new_state == DTX_MUTE ) {
/*
* mute comfort noise as it has been quite a long time since
* last SID update was performed
*/
- Word32 num, denom;
+ Word32 num, denom;
- tmp_int_length = st->since_last_sid;
+ tmp_int_length = st->since_last_sid;
- if(tmp_int_length > 32)
- {
- tmp_int_length = 32;
- }
-
- if(tmp_int_length == 1)
- {
- st->true_sid_period_inv = MAX_16;
- }
- else
- {
- num = 1024;
- denom = (tmp_int_length << 10);
- st->true_sid_period_inv = 0;
-
- for(i = 0; i < 15; i++)
- {
- st->true_sid_period_inv <<= 1;
- num <<= 1;
-
- if(num >= denom)
- {
- num = num - denom;
- st->true_sid_period_inv += 1;
- }
- }
- }
- st->since_last_sid = 0;
- memcpy(st->lsp_old, st->lsp, M << 2);
- st->old_log_en = st->log_en;
+ if ( tmp_int_length > 32 ) {
+ tmp_int_length = 32;
+ }
- /* subtract 1/8 in Q11 i.e -6/8 dB */
- st->log_en = st->log_en - 256;
- if(st->log_en < -32768) st->log_en = -32768;
- }
+ if ( tmp_int_length == 1 ) {
+ st->true_sid_period_inv = MAX_16;
+ }
+ else {
+ num = 1024;
+ denom = ( tmp_int_length << 10 );
+ st->true_sid_period_inv = 0;
- /*
- * reset interpolation length timer
- * if data has been updated.
- */
- if((st->sid_frame != 0) & ((st->valid_data != 0) || ((st->valid_data
- == 0) & (st->dtxHangoverAdded != 0))))
- {
- st->since_last_sid = 0;
- st->data_updated = 1;
- }
- return;
+ for ( i = 0; i < 15; i++ ) {
+ st->true_sid_period_inv <<= 1;
+ num <<= 1;
+
+ if ( num >= denom ) {
+ num = num - denom;
+ st->true_sid_period_inv += 1;
+ }
+ }
+ }
+ st->since_last_sid = 0;
+ memcpy( st->lsp_old, st->lsp, M << 2 );
+ st->old_log_en = st->log_en;
+
+ /* subtract 1/8 in Q11 i.e -6/8 dB */
+ st->log_en = st->log_en - 256;
+ if (st->log_en < -32768) st->log_en = -32768;
+ }
+
+ /*
+ * reset interpolation length timer
+ * if data has been updated.
+ */
+ if ( ( st->sid_frame != 0 ) & ( ( st->valid_data != 0 ) || ( ( st->valid_data
+ == 0 ) & ( st->dtxHangoverAdded != 0 ) ) ) ) {
+ st->since_last_sid = 0;
+ st->data_updated = 1;
+ }
+ return;
}
@@ -2013,25 +1876,24 @@ static void dtx_dec(dtx_decState *st, Word32 *mem_syn, D_plsfState *lsfState,
* Returns:
* void
*/
-static void lsp_avg(lsp_avgState *st, Word32 *lsp)
+static void lsp_avg( lsp_avgState *st, Word32 *lsp )
{
- Word32 i, tmp;
+ Word32 i, tmp;
- for(i = 0; i < M; i++)
- {
- /* mean = 0.84*mean */
- tmp = (st->lsp_meanSave[i] << 16);
- tmp -= (EXPCONST * st->lsp_meanSave[i]) << 1;
+ for ( i = 0; i < M; i++ ) {
+ /* mean = 0.84*mean */
+ tmp = ( st->lsp_meanSave[i] << 16 );
+ tmp -= ( EXPCONST * st->lsp_meanSave[i] ) << 1;
- /* Add 0.16 of newest LSPs to mean */
- tmp += (EXPCONST * lsp[i]) << 1;
+ /* Add 0.16 of newest LSPs to mean */
+ tmp += ( EXPCONST * lsp[i] ) << 1;
- /* Save means */
- tmp += 0x00008000L;
- st->lsp_meanSave[i] = tmp >> 16;
- }
- return;
+ /* Save means */
+ tmp += 0x00008000L;
+ st->lsp_meanSave[i] = tmp >> 16;
+ }
+ return;
}
@@ -2058,39 +1920,37 @@ static void lsp_avg(lsp_avgState *st, Word32 *lsp)
* Returns:
* void
*/
-static void Int_lpc_1and3(Word32 lsp_old[], Word32 lsp_mid[], Word32 lsp_new[],
- Word32 Az[])
+static void Int_lpc_1and3( Word32 lsp_old[], Word32 lsp_mid[], Word32 lsp_new[],
+ Word32 Az[] )
{
- Word32 lsp[M];
- Word32 i;
+ Word32 lsp[M];
+ Word32 i;
- /* lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */
- for(i = 0; i < 10; i++)
- {
- lsp[i] = (lsp_mid[i] >> 1) + (lsp_old[i] >> 1);
- }
+ /* lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */
+ for ( i = 0; i < 10; i++ ) {
+ lsp[i] = ( lsp_mid[i] >> 1 ) + ( lsp_old[i] >> 1 );
+ }
- /* Subframe 1 */
- Lsp_Az(lsp, Az);
- Az += MP1;
+ /* Subframe 1 */
+ Lsp_Az( lsp, Az );
+ Az += MP1;
- /* Subframe 2 */
- Lsp_Az(lsp_mid, Az);
- Az += MP1;
+ /* Subframe 2 */
+ Lsp_Az( lsp_mid, Az );
+ Az += MP1;
- for(i = 0; i < 10; i++)
- {
- lsp[i] = (lsp_mid[i] >> 1) + (lsp_new[i] >> 1);
- }
+ for ( i = 0; i < 10; i++ ) {
+ lsp[i] = ( lsp_mid[i] >> 1 ) + ( lsp_new[i] >> 1 );
+ }
- /* Subframe 3 */
- Lsp_Az(lsp, Az);
- Az += MP1;
+ /* Subframe 3 */
+ Lsp_Az( lsp, Az );
+ Az += MP1;
- /* Subframe 4 */
- Lsp_Az(lsp_new, Az);
- return;
+ /* Subframe 4 */
+ Lsp_Az( lsp_new, Az );
+ return;
}
@@ -2116,42 +1976,39 @@ static void Int_lpc_1and3(Word32 lsp_old[], Word32 lsp_mid[], Word32 lsp_new[],
* Returns:
* void
*/
-static void Int_lpc_1to3(Word32 lsp_old[], Word32 lsp_new[], Word32 Az[])
+static void Int_lpc_1to3( Word32 lsp_old[], Word32 lsp_new[], Word32 Az[] )
{
- Word32 lsp[M];
- Word32 i;
+ Word32 lsp[M];
+ Word32 i;
- for(i = 0; i < 10; i++)
- {
- lsp[i] = (lsp_new[i] >> 2) + (lsp_old[i] - (lsp_old[i] >> 2));
- }
+ for ( i = 0; i < 10; i++ ) {
+ lsp[i] = ( lsp_new[i] >> 2 ) + ( lsp_old[i] - ( lsp_old[i] >> 2 ) );
+ }
- /* Subframe 1 */
- Lsp_Az(lsp, Az);
- Az += MP1;
+ /* Subframe 1 */
+ Lsp_Az( lsp, Az );
+ Az += MP1;
- for(i = 0; i < 10; i++)
- {
- lsp[i] = (lsp_old[i] >> 1) + (lsp_new[i] >> 1);
- }
+ for ( i = 0; i < 10; i++ ) {
+ lsp[i] = ( lsp_old[i] >> 1 ) + ( lsp_new[i] >> 1 );
+ }
- /* Subframe 2 */
- Lsp_Az(lsp, Az);
- Az += MP1;
+ /* Subframe 2 */
+ Lsp_Az( lsp, Az );
+ Az += MP1;
- for(i = 0; i < 10; i++)
- {
- lsp[i] = (lsp_old[i] >> 2) + (lsp_new[i] - (lsp_new[i] >> 2));
- }
+ for ( i = 0; i < 10; i++ ) {
+ lsp[i] = ( lsp_old[i] >> 2 ) + ( lsp_new[i] - ( lsp_new[i] >> 2 ) );
+ }
- /* Subframe 3 */
- Lsp_Az(lsp, Az);
- Az += MP1;
+ /* Subframe 3 */
+ Lsp_Az( lsp, Az );
+ Az += MP1;
- /* Subframe 4 */
- Lsp_Az(lsp_new, Az);
- return;
+ /* Subframe 4 */
+ Lsp_Az( lsp_new, Az );
+ return;
}
@@ -2174,104 +2031,97 @@ static void Int_lpc_1to3(Word32 lsp_old[], Word32 lsp_new[], Word32 Az[])
* Returns:
* void
*/
-static void D_plsf_5(D_plsfState *st, Word16 bfi, Word16 *indice, Word32 *lsp1_q
- , Word32 *lsp2_q)
+static void D_plsf_5( D_plsfState *st, Word16 bfi, Word16 *indice, Word32 *lsp1_q
+ , Word32 *lsp2_q )
{
- Word32 lsf1_r[M], lsf2_r[M], lsf1_q[M], lsf2_q[M];
- Word32 i, temp1, temp2, sign;
- const Word32 *p_dico;
-
-
- /* if bad frame */
- if(bfi != 0)
- {
- /* use the past LSFs slightly shifted towards their mean */
- for(i = 0; i < M; i += 2)
- {
- /* lsfi_q[i] = ALPHA*st->past_lsf_q[i] + ONE_ALPHA*meanLsf[i]; */
- lsf1_q[i] = ((st->past_lsf_q[i] * ALPHA_122) >> 15) + ((mean_lsf_5[i]
- * ONE_ALPHA_122) >> 15);
- lsf1_q[i + 1] = ((st->past_lsf_q[i + 1] * ALPHA_122) >> 15) + ((
- mean_lsf_5[i + 1] * ONE_ALPHA_122) >> 15);
- }
- memcpy(lsf2_q, lsf1_q, M << 2);
-
- /* estimate past quantized residual to be used in next frame */
- for(i = 0; i < M; i += 2)
- {
- /* temp = meanLsf[i] + st->past_r_q[i] * LSPPpred_facMR122; */
- temp1 = mean_lsf_5[i] + ((st->past_r_q[i] * LSP_PRED_FAC_MR122) >>
- 15);
- temp2 = mean_lsf_5[i + 1] + ((st->past_r_q[i + 1] * LSP_PRED_FAC_MR122
- ) >> 15);
- st->past_r_q[i] = lsf2_q[i] - temp1;
- st->past_r_q[i + 1] = lsf2_q[i + 1] - temp2;
- }
- }
-
- /* if good LSFs received */
- else
- {
- /* decode prediction residuals from 5 received indices */
- p_dico = &dico1_lsf_5[indice[0] << 2];
- lsf1_r[0] = *p_dico++;
- lsf1_r[1] = *p_dico++;
- lsf2_r[0] = *p_dico++;
- lsf2_r[1] = *p_dico++;
- p_dico = &dico2_lsf_5[indice[1] << 2];
- lsf1_r[2] = *p_dico++;
- lsf1_r[3] = *p_dico++;
- lsf2_r[2] = *p_dico++;
- lsf2_r[3] = *p_dico++;
- sign = (Word16)(indice[2] & 1);
- i = indice[2] >> 1;
- p_dico = &dico3_lsf_5[i << 2];
-
- if(sign == 0)
- {
- lsf1_r[4] = *p_dico++;
- lsf1_r[5] = *p_dico++;
- lsf2_r[4] = *p_dico++;
- lsf2_r[5] = *p_dico++;
- }
- else
- {
- lsf1_r[4] = (Word16)(-(*p_dico++));
- lsf1_r[5] = (Word16)(-(*p_dico++));
- lsf2_r[4] = (Word16)(-(*p_dico++));
- lsf2_r[5] = (Word16)(-(*p_dico++));
- }
- p_dico = &dico4_lsf_5[(indice[3] << 2)];
- lsf1_r[6] = *p_dico++;
- lsf1_r[7] = *p_dico++;
- lsf2_r[6] = *p_dico++;
- lsf2_r[7] = *p_dico++;
- p_dico = &dico5_lsf_5[(indice[4] << 2)];
- lsf1_r[8] = *p_dico++;
- lsf1_r[9] = *p_dico++;
- lsf2_r[8] = *p_dico++;
- lsf2_r[9] = *p_dico++;
-
- /* Compute quantized LSFs and update the past quantized residual */
- for(i = 0; i < M; i++)
- {
- temp1 = mean_lsf_5[i] + ((st->past_r_q[i] * LSP_PRED_FAC_MR122) >>
- 15);
- lsf1_q[i] = lsf1_r[i] + temp1;
- lsf2_q[i] = lsf2_r[i] + temp1;
- st->past_r_q[i] = lsf2_r[i];
- }
- }
-
- /* verification that LSFs have minimum distance of LSF_GAP Hz */
- Reorder_lsf(lsf1_q, LSF_GAP);
- Reorder_lsf(lsf2_q, LSF_GAP);
- memcpy(st->past_lsf_q, lsf2_q, M << 2);
-
- /* convert LSFs to the cosine domain */
- Lsf_lsp(lsf1_q, lsp1_q);
- Lsf_lsp(lsf2_q, lsp2_q);
- return;
+ Word32 lsf1_r[M], lsf2_r[M], lsf1_q[M], lsf2_q[M];
+ Word32 i, temp1, temp2, sign;
+ const Word32 *p_dico;
+
+
+ /* if bad frame */
+ if ( bfi != 0 ) {
+ /* use the past LSFs slightly shifted towards their mean */
+ for ( i = 0; i < M; i += 2 ) {
+ /* lsfi_q[i] = ALPHA*st->past_lsf_q[i] + ONE_ALPHA*meanLsf[i]; */
+ lsf1_q[i] = ( ( st->past_lsf_q[i] * ALPHA_122 ) >> 15 ) + ( ( mean_lsf_5[i]
+ * ONE_ALPHA_122 ) >> 15 );
+ lsf1_q[i + 1] = ( ( st->past_lsf_q[i + 1] * ALPHA_122 ) >> 15 ) + ( (
+ mean_lsf_5[i + 1] * ONE_ALPHA_122 ) >> 15 );
+ }
+ memcpy( lsf2_q, lsf1_q, M <<2 );
+
+ /* estimate past quantized residual to be used in next frame */
+ for ( i = 0; i < M; i += 2 ) {
+ /* temp = meanLsf[i] + st->past_r_q[i] * LSPPpred_facMR122; */
+ temp1 = mean_lsf_5[i] + ( ( st->past_r_q[i] * LSP_PRED_FAC_MR122 ) >>
+ 15 );
+ temp2 = mean_lsf_5[i + 1] +( ( st->past_r_q[i + 1] *LSP_PRED_FAC_MR122
+ ) >> 15 );
+ st->past_r_q[i] = lsf2_q[i] - temp1;
+ st->past_r_q[i + 1] = lsf2_q[i + 1] -temp2;
+ }
+ }
+
+ /* if good LSFs received */
+ else {
+ /* decode prediction residuals from 5 received indices */
+ p_dico = &dico1_lsf_5[indice[0] << 2];
+ lsf1_r[0] = *p_dico++;
+ lsf1_r[1] = *p_dico++;
+ lsf2_r[0] = *p_dico++;
+ lsf2_r[1] = *p_dico++;
+ p_dico = &dico2_lsf_5[indice[1] << 2];
+ lsf1_r[2] = *p_dico++;
+ lsf1_r[3] = *p_dico++;
+ lsf2_r[2] = *p_dico++;
+ lsf2_r[3] = *p_dico++;
+ sign = ( Word16 )( indice[2] & 1 );
+ i = indice[2] >> 1;
+ p_dico = &dico3_lsf_5[i << 2];
+
+ if ( sign == 0 ) {
+ lsf1_r[4] = *p_dico++;
+ lsf1_r[5] = *p_dico++;
+ lsf2_r[4] = *p_dico++;
+ lsf2_r[5] = *p_dico++;
+ }
+ else {
+ lsf1_r[4] = ( Word16 )( -( *p_dico++ ) );
+ lsf1_r[5] = ( Word16 )( -( *p_dico++ ) );
+ lsf2_r[4] = ( Word16 )( -( *p_dico++ ) );
+ lsf2_r[5] = ( Word16 )( -( *p_dico++ ) );
+ }
+ p_dico = &dico4_lsf_5[( indice[3]<<2 )];
+ lsf1_r[6] = *p_dico++;
+ lsf1_r[7] = *p_dico++;
+ lsf2_r[6] = *p_dico++;
+ lsf2_r[7] = *p_dico++;
+ p_dico = &dico5_lsf_5[( indice[4]<<2 )];
+ lsf1_r[8] = *p_dico++;
+ lsf1_r[9] = *p_dico++;
+ lsf2_r[8] = *p_dico++;
+ lsf2_r[9] = *p_dico++;
+
+ /* Compute quantized LSFs and update the past quantized residual */
+ for ( i = 0; i < M; i++ ) {
+ temp1 = mean_lsf_5[i] + ( ( st->past_r_q[i] * LSP_PRED_FAC_MR122 ) >>
+ 15 );
+ lsf1_q[i] = lsf1_r[i] + temp1;
+ lsf2_q[i] = lsf2_r[i] + temp1;
+ st->past_r_q[i] = lsf2_r[i];
+ }
+ }
+
+ /* verification that LSFs have minimum distance of LSF_GAP Hz */
+ Reorder_lsf( lsf1_q, LSF_GAP );
+ Reorder_lsf( lsf2_q, LSF_GAP );
+ memcpy( st->past_lsf_q, lsf2_q, M <<2 );
+
+ /* convert LSFs to the cosine domain */
+ Lsf_lsp( lsf1_q, lsp1_q );
+ Lsf_lsp( lsf2_q, lsp2_q );
+ return;
}
@@ -2301,75 +2151,65 @@ static void D_plsf_5(D_plsfState *st, Word16 bfi, Word16 *indice, Word32 *lsp1_q
* Returns:
* void
*/
-static void Dec_lag3(Word32 index, Word32 t0_min, Word32 t0_max, Word32 i_subfr
- , Word32 T0_prev, Word32 *T0, Word32 *T0_frac, Word32 flag4)
+static void Dec_lag3( Word32 index, Word32 t0_min, Word32 t0_max, Word32 i_subfr
+ , Word32 T0_prev, Word32 *T0, Word32 *T0_frac, Word32 flag4 )
{
- Word32 i, tmp_lag;
-
-
- /* if 1st or 3rd subframe */
- if(i_subfr == 0)
- {
- if(index < 197)
- {
- *T0 = (((index + 2) * 10923) >> 15) + 19;
- i = *T0 + *T0 + *T0;
- *T0_frac = (index - i) + 58;
- }
- else
- {
- *T0 = index - 112;
+ Word32 i, tmp_lag;
+
+
+ /* if 1st or 3rd subframe */
+ if ( i_subfr == 0 ) {
+ if ( index < 197 ) {
+ *T0 = ( ( ( index + 2 ) * 10923 ) >> 15 ) + 19;
+ i = *T0 + *T0 + *T0;
+ *T0_frac = ( index - i ) + 58;
+ }
+ else {
+ *T0 = index - 112;
+ *T0_frac = 0;
+ }
+ }
+
+ /* 2nd or 4th subframe */
+ else {
+ if ( flag4 == 0 ) {
+ /* 'normal' decoding: either with 5 or 6 bit resolution */
+ i = ( ( ( index + 2 ) * 10923 ) >> 15 ) - 1;
+ *T0 = i + t0_min;
+ i = i + i + i;
+ *T0_frac = ( index - 2 ) - i;
+ }
+ else {
+ /* decoding with 4 bit resolution */
+ tmp_lag = T0_prev;
+
+ if ( ( tmp_lag - t0_min ) > 5 )
+ tmp_lag = t0_min + 5;
+
+ if ( ( t0_max - tmp_lag ) > 4 )
+ tmp_lag = t0_max - 4;
+
+ if ( index < 4 ) {
+ i = ( tmp_lag - 5 );
+ *T0 = i + index;
*T0_frac = 0;
- }
- }
-
- /* 2nd or 4th subframe */
- else
- {
- if(flag4 == 0)
- {
- /* 'normal' decoding: either with 5 or 6 bit resolution */
- i = (((index + 2) * 10923) >> 15) - 1;
- *T0 = i + t0_min;
- i = i + i + i;
- *T0_frac = (index - 2) - i;
- }
- else
- {
- /* decoding with 4 bit resolution */
- tmp_lag = T0_prev;
-
- if((tmp_lag - t0_min) > 5)
- tmp_lag = t0_min + 5;
-
- if((t0_max - tmp_lag) > 4)
- tmp_lag = t0_max - 4;
-
- if(index < 4)
- {
- i = (tmp_lag - 5);
- *T0 = i + index;
- *T0_frac = 0;
+ }
+ else {
+ if ( index < 12 ) {
+ i = ( ( ( index - 5 ) * 10923 ) >> 15 ) - 1;
+ *T0 = i + tmp_lag;
+ i = i + i + i;
+ *T0_frac = ( index - 9 ) - i;
}
- else
- {
- if(index < 12)
- {
- i = (((index - 5) * 10923) >> 15) - 1;
- *T0 = i + tmp_lag;
- i = i + i + i;
- *T0_frac = (index - 9) - i;
- }
- else
- {
- i = (index - 12) + tmp_lag;
- *T0 = i + 1;
- *T0_frac = 0;
- }
+ else {
+ i = ( index - 12 ) + tmp_lag;
+ *T0 = i + 1;
+ *T0_frac = 0;
}
- } /* end if (decoding with 4 bit resolution) */
- }
- return;
+ }
+ } /* end if (decoding with 4 bit resolution) */
+ }
+ return;
}
@@ -2405,56 +2245,53 @@ static void Dec_lag3(Word32 index, Word32 t0_min, Word32 t0_max, Word32 i_subfr
* Returns:
* void
*/
-static void Pred_lt_3or6_40(Word32 exc[], Word32 T0, Word32 frac, Word32 flag3)
+static void Pred_lt_3or6_40( Word32 exc[], Word32 T0, Word32 frac, Word32 flag3 )
{
- Word32 s, i;
- Word32 *x0, *x1, *x2;
- const Word32 *c1, *c2;
-
-
- x0 = &exc[ - T0];
- frac = -frac;
-
- if(flag3 != 0)
- {
- frac <<= 1; /* inter_3l[k] = inter6[2*k] -> k' = 2*k */
- }
-
- if(frac < 0)
- {
- frac += 6;
- x0--;
- }
- c1 = &inter6[frac];
- c2 = &inter6[6 - frac];
-
- for(i = 0; i < 40; i++)
- {
- x1 = x0++;
- x2 = x0;
- s = x1[0] * c1[0];
- s += x1[ - 1] * c1[6];
- s += x1[ - 2] * c1[12];
- s += x1[ - 3] * c1[18];
- s += x1[ - 4] * c1[24];
- s += x1[ - 5] * c1[30];
- s += x1[ - 6] * c1[36];
- s += x1[ - 7] * c1[42];
- s += x1[ - 8] * c1[48];
- s += x1[ - 9] * c1[54];
- s += x2[0] * c2[0];
- s += x2[1] * c2[6];
- s += x2[2] * c2[12];
- s += x2[3] * c2[18];
- s += x2[4] * c2[24];
- s += x2[5] * c2[30];
- s += x2[6] * c2[36];
- s += x2[7] * c2[42];
- s += x2[8] * c2[48];
- s += x2[9] * c2[54];
- exc[i] = (s + 0x4000) >> 15;
-
- }
+ Word32 s, i;
+ Word32 *x0, *x1, *x2;
+ const Word32 *c1, *c2;
+
+
+ x0 = &exc[ - T0];
+ frac = -frac;
+
+ if ( flag3 != 0 ) {
+ frac <<= 1; /* inter_3l[k] = inter6[2*k] -> k' = 2*k */
+ }
+
+ if ( frac < 0 ) {
+ frac += 6;
+ x0--;
+ }
+ c1 = &inter6[frac];
+ c2 = &inter6[6 - frac];
+
+ for ( i = 0; i < 40; i++ ) {
+ x1 = x0++;
+ x2 = x0;
+ s = x1[0] * c1[0];
+ s += x1[ - 1] * c1[6];
+ s += x1[ - 2] * c1[12];
+ s += x1[ - 3] * c1[18];
+ s += x1[ - 4] * c1[24];
+ s += x1[ - 5] * c1[30];
+ s += x1[ - 6] * c1[36];
+ s += x1[ - 7] * c1[42];
+ s += x1[ - 8] * c1[48];
+ s += x1[ - 9] * c1[54];
+ s += x2[0] * c2[0];
+ s += x2[1] * c2[6];
+ s += x2[2] * c2[12];
+ s += x2[3] * c2[18];
+ s += x2[4] * c2[24];
+ s += x2[5] * c2[30];
+ s += x2[6] * c2[36];
+ s += x2[7] * c2[42];
+ s += x2[8] * c2[48];
+ s += x2[9] * c2[54];
+ exc[i] = ( s + 0x4000 ) >> 15;
+
+ }
}
@@ -2485,55 +2322,49 @@ static void Pred_lt_3or6_40(Word32 exc[], Word32 T0, Word32 frac, Word32 flag3)
* Returns:
* void
*/
-static void Dec_lag6(Word32 index, Word32 pit_min, Word32 pit_max, Word32
- i_subfr, Word32 *T0, Word32 *T0_frac)
+static void Dec_lag6( Word32 index, Word32 pit_min, Word32 pit_max, Word32
+ i_subfr, Word32 *T0, Word32 *T0_frac )
{
- Word32 t0_min, t0_max, i;
-
-
- /* if 1st or 3rd subframe */
- if(i_subfr == 0)
- {
- if(index < 463)
- {
- /* T0 = (index+5)/6 + 17 */
- *T0 = (index + 5) / 6 + 17;
- i = *T0 + *T0 + *T0;
-
- /* *T0_frac = index - T0*6 + 105 */
- *T0_frac = (index - (i + i)) + 105;
- }
- else
- {
- *T0 = index - 368;
- *T0_frac = 0;
- }
- }
-
- /* second or fourth subframe */
- else
- {
- /* find t0_min and t0_max for 2nd (or 4th) subframe */
- t0_min = *T0 - 5;
-
- if(t0_min < pit_min)
- {
- t0_min = pit_min;
- }
- t0_max = t0_min + 9;
-
- if(t0_max > pit_max)
- {
- t0_max = pit_max;
- t0_min = t0_max - 9;
- }
-
- /* i = (index+5)/6 - 1 */
- i = (index + 5) / 6 - 1;
- *T0 = i + t0_min;
- i = i + i + i;
- *T0_frac = (index - 3) - (i + i);
- }
+ Word32 t0_min, t0_max, i;
+
+
+ /* if 1st or 3rd subframe */
+ if ( i_subfr == 0 ) {
+ if ( index < 463 ) {
+ /* T0 = (index+5)/6 + 17 */
+ *T0 = ( index + 5 ) / 6 + 17;
+ i = *T0 + *T0 + *T0;
+
+ /* *T0_frac = index - T0*6 + 105 */
+ *T0_frac = ( index - ( i + i ) ) + 105;
+ }
+ else {
+ *T0 = index - 368;
+ *T0_frac = 0;
+ }
+ }
+
+ /* second or fourth subframe */
+ else {
+ /* find t0_min and t0_max for 2nd (or 4th) subframe */
+ t0_min = *T0 - 5;
+
+ if ( t0_min < pit_min ) {
+ t0_min = pit_min;
+ }
+ t0_max = t0_min + 9;
+
+ if ( t0_max > pit_max ) {
+ t0_max = pit_max;
+ t0_min = t0_max - 9;
+ }
+
+ /* i = (index+5)/6 - 1 */
+ i = ( index + 5 ) / 6 - 1;
+ *T0 = i + t0_min;
+ i = i + i + i;
+ *T0_frac = ( index - 3 ) - ( i + i );
+ }
}
@@ -2554,27 +2385,27 @@ static void Dec_lag6(Word32 index, Word32 pit_min, Word32 pit_max, Word32
* Returns:
* void
*/
-static void decompress10(Word32 MSBs, Word32 LSBs, Word32 index1, Word32 index2
- , Word32 index3, Word32 pos_indx[])
+static void decompress10( Word32 MSBs, Word32 LSBs, Word32 index1, Word32 index2
+ , Word32 index3, Word32 pos_indx[] )
{
- Word32 divMSB;
-
- if(MSBs > 124)
- {
- MSBs = 124;
- }
- /*
- * pos_indx[index1] = ((MSBs-25*(MSBs/25))%5)*2 + (LSBs-4*(LSBs/4))%2;
- * pos_indx[index2] = ((MSBs-25*(MSBs/25))/5)*2 + (LSBs-4*(LSBs/4))/2;
- * pos_indx[index3] = (MSBs/25)*2 + LSBs/4;
- */
- divMSB = MSBs / 25;
- pos_indx[index1] = (((MSBs - 25 * (divMSB)) % 5) << 1) + (LSBs & 0x1
- );
- pos_indx[index2] = (((MSBs - 25 * (divMSB)) / 5) << 1) + ((LSBs &
- 0x2) >> 1);
- pos_indx[index3] = (divMSB << 1) + (LSBs >> 2);
- return;
+ Word32 divMSB;
+
+ if (MSBs > 124)
+ {
+ MSBs = 124;
+ }
+ /*
+ * pos_indx[index1] = ((MSBs-25*(MSBs/25))%5)*2 + (LSBs-4*(LSBs/4))%2;
+ * pos_indx[index2] = ((MSBs-25*(MSBs/25))/5)*2 + (LSBs-4*(LSBs/4))/2;
+ * pos_indx[index3] = (MSBs/25)*2 + LSBs/4;
+ */
+ divMSB = MSBs / 25;
+ pos_indx[index1] = ( ( ( MSBs - 25 * ( divMSB ) ) % 5 ) << 1 ) + ( LSBs & 0x1
+ );
+ pos_indx[index2] = ( ( ( MSBs - 25 * ( divMSB ) ) / 5 ) << 1 ) + ( ( LSBs &
+ 0x2 ) >> 1 );
+ pos_indx[index3] = ( divMSB << 1 ) + ( LSBs >> 2 );
+ return;
}
@@ -2598,9 +2429,9 @@ static void decompress10(Word32 MSBs, Word32 LSBs, Word32 index1, Word32 index2
* Returns:
* void
*/
-static void decompress_codewords(Word16 indx[], Word32 pos_indx[])
+static void decompress_codewords( Word16 indx[], Word32 pos_indx[] )
{
- Word32 ia, ib, MSBs, LSBs, MSBs0_24, tmp;
+ Word32 ia, ib, MSBs, LSBs, MSBs0_24, tmp;
/*
@@ -2608,18 +2439,18 @@ static void decompress_codewords(Word16 indx[], Word32 pos_indx[])
* MSBs = indx[NB_TRACK]/8;
* LSBs = indx[NB_TRACK]%8;
*/
- MSBs = *indx >> 3;
- LSBs = *indx & 0x7;
- decompress10(MSBs, LSBs, 0, 4, 1, pos_indx);
+ MSBs = *indx >> 3;
+ LSBs = *indx & 0x7;
+ decompress10( MSBs, LSBs, 0, 4, 1, pos_indx );
/*
* Second index: 10x10x10 -> 2x5x2x5x2x5-> 125x2x2x2 -> 7+1x3 bits
* MSBs = indx[NB_TRACK+1]/8;
* LSBs = indx[NB_TRACK+1]%8;
*/
- MSBs = indx[1] >> 3;
- LSBs = indx[1] & 0x7;
- decompress10(MSBs, LSBs, 2, 6, 5, pos_indx);
+ MSBs = indx[1] >> 3;
+ LSBs = indx[1] & 0x7;
+ decompress10( MSBs, LSBs, 2, 6, 5, pos_indx );
/*
* Third index: 10x10 -> 2x5x2x5-> 25x2x2 -> 5+1x2 bits
@@ -2632,19 +2463,18 @@ static void decompress_codewords(Word16 indx[], Word32 pos_indx[])
* pos_indx[3] = (MSBs0_24%5)*2 + LSBs%2;
* pos_indx[7] = (MSBs0_24/5)*2 + LSBs/2;
*/
- MSBs = indx[2] >> 2;
- LSBs = indx[2] & 0x3;
- MSBs0_24 = (((MSBs * 25) + 12) >> 5);
- tmp = (MSBs0_24 * 6554) >> 15;
- ia = tmp & 0x1;
- ib = (MSBs0_24 - (tmp * 5));
-
- if(ia == 1)
- {
- ib = 4 - ib;
- }
- pos_indx[3] = (ib << 1) + (LSBs & 0x1);
- pos_indx[7] = (tmp << 1) + (LSBs >> 1);
+ MSBs = indx[2] >> 2;
+ LSBs = indx[2] & 0x3;
+ MSBs0_24 = ( ( ( MSBs * 25 ) + 12 ) >> 5 );
+ tmp = ( MSBs0_24 * 6554 ) >> 15;
+ ia = tmp & 0x1;
+ ib = ( MSBs0_24 - ( tmp * 5 ) );
+
+ if ( ia == 1 ) {
+ ib = 4 - ib;
+ }
+ pos_indx[3] = ( ib << 1 ) + ( LSBs & 0x1 );
+ pos_indx[7] = ( tmp << 1 ) + ( LSBs >> 1 );
}
@@ -2664,48 +2494,45 @@ static void decompress_codewords(Word16 indx[], Word32 pos_indx[])
* Returns:
* void
*/
-static void decode_2i40_9bits(Word32 subNr, Word32 sign, Word32 index, Word32
- cod[])
+static void decode_2i40_9bits( Word32 subNr, Word32 sign, Word32 index, Word32
+ cod[] )
{
- Word32 pos[2];
- Word32 i, j, k;
-
-
- /* Decode the positions */
- /* table bit is the MSB */
- j = (index & 64) >> 6;
- i = index & 7;
-
- /* pos0 =i*5+startPos[j*8+subNr*2] */
- i = (i + (i << 2));
- k = startPos[(j <<3)+(subNr << 1)];
- pos[0] = i + k;
- index = index >> 3;
- i = index & 7;
-
- /* pos1 =i*5+startPos[j*8+subNr*2+1] */
- i = (i + (i << 2));
- k = startPos[((j <<3)+ (subNr <<1)) + 1];
- pos[1] = (Word16)(i + k);
-
- /* decode the signs and build the codeword */
- memset(cod, 0, L_SUBFR << 2);
-
- for(j = 0; j < 2; j++)
- {
- i = sign & 1;
- sign = sign >> 1;
-
- if(i != 0)
- {
- cod[pos[j]] = 8191; /* +1.0 */
- }
- else
- {
- cod[pos[j]] = -8192; /* -1.0 */
- }
- }
- return;
+ Word32 pos[2];
+ Word32 i, j, k;
+
+
+ /* Decode the positions */
+ /* table bit is the MSB */
+ j = ( index & 64 ) >> 6;
+ i = index & 7;
+
+ /* pos0 =i*5+startPos[j*8+subNr*2] */
+ i = ( i + ( i << 2 ) );
+ k = startPos[( j <<3 )+( subNr << 1 )];
+ pos[0] = i + k;
+ index = index >> 3;
+ i = index & 7;
+
+ /* pos1 =i*5+startPos[j*8+subNr*2+1] */
+ i = ( i + ( i << 2 ) );
+ k = startPos[( ( j <<3 )+ ( subNr <<1 ) ) + 1];
+ pos[1] = ( Word16 )( i + k );
+
+ /* decode the signs and build the codeword */
+ memset( cod, 0, L_SUBFR <<2 );
+
+ for ( j = 0; j < 2; j++ ) {
+ i = sign & 1;
+ sign = sign >> 1;
+
+ if ( i != 0 ) {
+ cod[pos[j]] = 8191; /* +1.0 */
+ }
+ else {
+ cod[pos[j]] = -8192; /* -1.0 */
+ }
+ }
+ return;
}
@@ -2724,58 +2551,53 @@ static void decode_2i40_9bits(Word32 subNr, Word32 sign, Word32 index, Word32
* Returns:
* void
*/
-static void decode_2i40_11bits(Word32 sign, Word32 index, Word32 cod[])
+static void decode_2i40_11bits( Word32 sign, Word32 index, Word32 cod[] )
{
- Word32 pos[2];
- Word32 i, j;
-
-
- /* Decode the positions */
- j = index & 1;
- index = index >> 1;
- i = index & 7;
-
- /* pos0 =i*5+1+j*2 */
- i = (i + (i << 2));
- i = (i + 1);
- j = (j << 1);
- pos[0] = i + j;
- index = index >> 3;
- j = index & 3;
- index = index >> 2;
- i = index & 7;
-
- if(j == 3)
- {
- /* pos1 =i*5+4 */
- i = (i + (i << 2));
- pos[1] = i + 4;
- }
- else
- {
- /* pos1 =i*5+j */
- i = (i + (i << 2));
- pos[1] = i + j;
- }
-
- /* decode the signs and build the codeword */
- memset(cod, 0, L_SUBFR << 2);
-
- for(j = 0; j < 2; j++)
- {
- i = sign & 1;
- sign = sign >> 1;
-
- if(i != 0)
- {
- cod[pos[j]] = 8191; /* +1.0 */
- }
- else
- {
- cod[pos[j]] = -8192; /* -1.0 */
- }
- }
- return;
+ Word32 pos[2];
+ Word32 i, j;
+
+
+ /* Decode the positions */
+ j = index & 1;
+ index = index >> 1;
+ i = index & 7;
+
+ /* pos0 =i*5+1+j*2 */
+ i = ( i + ( i << 2 ) );
+ i = ( i + 1 );
+ j = ( j << 1 );
+ pos[0] = i + j;
+ index = index >> 3;
+ j = index & 3;
+ index = index >> 2;
+ i = index & 7;
+
+ if ( j == 3 ) {
+ /* pos1 =i*5+4 */
+ i = ( i + ( i << 2 ) );
+ pos[1] = i + 4;
+ }
+ else {
+ /* pos1 =i*5+j */
+ i = ( i + ( i << 2 ) );
+ pos[1] = i + j;
+ }
+
+ /* decode the signs and build the codeword */
+ memset( cod, 0, L_SUBFR <<2 );
+
+ for ( j = 0; j < 2; j++ ) {
+ i = sign & 1;
+ sign = sign >> 1;
+
+ if ( i != 0 ) {
+ cod[pos[j]] = 8191; /* +1.0 */
+ }
+ else {
+ cod[pos[j]] = -8192; /* -1.0 */
+ }
+ }
+ return;
}
@@ -2794,56 +2616,53 @@ static void decode_2i40_11bits(Word32 sign, Word32 index, Word32 cod[])
* Returns:
* void
*/
-static void decode_3i40_14bits(Word32 sign, Word32 index, Word32 cod[])
+static void decode_3i40_14bits( Word32 sign, Word32 index, Word32 cod[] )
{
- Word32 pos[3];
- Word32 i, j;
-
-
- /* Decode the positions */
- i = index & 7;
-
- /* pos0 =i*5 */
- pos[0] = i + (i << 2);
- index = index >> 3;
- j = index & 1;
- index = index >> 1;
- i = index & 7;
-
- /* pos1 =i*5+1+j*2 */
- i = (i + (i << 2));
- i = (i + 1);
- j = (j << 1);
- pos[1] = i + j;
- index = index >> 3;
- j = index & 1;
- index = index >> 1;
- i = index & 7;
-
- /* pos2 =i*5+2+j*2 */
- i = (i + (i << 2));
- i = (i + 2);
- j = (j << 1);
- pos[2] = i + j;
-
- /* decode the signs and build the codeword */
- memset(cod, 0, L_SUBFR << 2);
-
- for(j = 0; j < 3; j++)
- {
- i = sign & 1;
- sign = sign >> 1;
-
- if(i > 0)
- {
- cod[pos[j]] = 8191; /* +1.0 */
- }
- else
- {
- cod[pos[j]] = -8192; /* -1.0 */
- }
- }
- return;
+ Word32 pos[3];
+ Word32 i, j;
+
+
+ /* Decode the positions */
+ i = index & 7;
+
+ /* pos0 =i*5 */
+ pos[0] = i + ( i << 2 );
+ index = index >> 3;
+ j = index & 1;
+ index = index >> 1;
+ i = index & 7;
+
+ /* pos1 =i*5+1+j*2 */
+ i = ( i + ( i << 2 ) );
+ i = ( i + 1 );
+ j = ( j << 1 );
+ pos[1] = i + j;
+ index = index >> 3;
+ j = index & 1;
+ index = index >> 1;
+ i = index & 7;
+
+ /* pos2 =i*5+2+j*2 */
+ i = ( i + ( i << 2 ) );
+ i = ( i + 2 );
+ j = ( j << 1 );
+ pos[2] = i + j;
+
+ /* decode the signs and build the codeword */
+ memset( cod, 0, L_SUBFR <<2 );
+
+ for ( j = 0; j < 3; j++ ) {
+ i = sign & 1;
+ sign = sign >> 1;
+
+ if ( i > 0 ) {
+ cod[pos[j]] = 8191; /* +1.0 */
+ }
+ else {
+ cod[pos[j]] = -8192; /* -1.0 */
+ }
+ }
+ return;
}
@@ -2862,61 +2681,58 @@ static void decode_3i40_14bits(Word32 sign, Word32 index, Word32 cod[])
* Returns:
* void
*/
-static void decode_4i40_17bits(Word32 sign, Word32 index, Word32 cod[])
+static void decode_4i40_17bits( Word32 sign, Word32 index, Word32 cod[] )
{
- Word32 pos[4];
- Word32 i, j;
-
-
- /* Decode the positions */
- i = index & 7;
- i = dgray[i];
-
- /* pos0 =i*5 */
- pos[0] = i + (i << 2);
- index = index >> 3;
- i = index & 7;
- i = dgray[i];
-
- /* pos1 =i*5+1 */
- i = (i + (i << 2));
- pos[1] = i + 1;
- index = index >> 3;
- i = index & 7;
- i = dgray[i];
-
- /* pos2 =i*5+1 */
- i = (i + (i << 2));
- pos[2] = i + 2;
- index = index >> 3;
- j = index & 1;
- index = index >> 1;
- i = index & 7;
- i = dgray[i];
-
- /* pos3 =i*5+3+j */
- i = (i + (i << 2));
- i = (i + 3);
- pos[3] = i + j;
-
- /* decode the signs and build the codeword */
- memset(cod, 0, L_SUBFR << 2);
-
- for(j = 0; j < 4; j++)
- {
- i = sign & 1;
- sign = sign >> 1;
-
- if(i != 0)
- {
- cod[pos[j]] = 8191;
- }
- else
- {
- cod[pos[j]] = -8192;
- }
- }
- return;
+ Word32 pos[4];
+ Word32 i, j;
+
+
+ /* Decode the positions */
+ i = index & 7;
+ i = dgray[i];
+
+ /* pos0 =i*5 */
+ pos[0] = i + ( i << 2 );
+ index = index >> 3;
+ i = index & 7;
+ i = dgray[i];
+
+ /* pos1 =i*5+1 */
+ i = ( i + ( i << 2 ) );
+ pos[1] = i + 1;
+ index = index >> 3;
+ i = index & 7;
+ i = dgray[i];
+
+ /* pos2 =i*5+1 */
+ i = ( i + ( i << 2 ) );
+ pos[2] = i + 2;
+ index = index >> 3;
+ j = index & 1;
+ index = index >> 1;
+ i = index & 7;
+ i = dgray[i];
+
+ /* pos3 =i*5+3+j */
+ i = ( i + ( i << 2 ) );
+ i = ( i + 3 );
+ pos[3] = i + j;
+
+ /* decode the signs and build the codeword */
+ memset( cod, 0, L_SUBFR <<2 );
+
+ for ( j = 0; j < 4; j++ ) {
+ i = sign & 1;
+ sign = sign >> 1;
+
+ if ( i != 0 ) {
+ cod[pos[j]] = 8191;
+ }
+ else {
+ cod[pos[j]] = -8192;
+ }
+ }
+ return;
}
@@ -2934,49 +2750,45 @@ static void decode_4i40_17bits(Word32 sign, Word32 index, Word32 cod[])
* Returns:
* void
*/
-static void decode_8i40_31bits(Word16 index[], Word32 cod[])
+static void decode_8i40_31bits( Word16 index[], Word32 cod[] )
{
- Word32 linear_codewords[8];
- Word32 i, j, pos1, pos2, sign;
-
-
- memset(cod, 0, L_CODE << 2);
- decompress_codewords(&index[NB_TRACK_MR102], linear_codewords);
-
- /* decode the positions and signs of pulses and build the codeword */
- for(j = 0; j < NB_TRACK_MR102; j++)
- {
- /* compute index i */
- i = linear_codewords[j];
- i <<= 2;
-
- /* position of pulse "j" */
- pos1 = i + j;
-
- if(index[j] == 0)
- {
- sign = POS_CODE; /* +1.0 */
- }
- else
- {
- sign = -NEG_CODE; /* -1.0 */
- }
-
- /* compute index i */
- i = linear_codewords[j + 4];
- i = i << 2;
-
- /* position of pulse "j+4" */
- pos2 = i + j;
- cod[pos1] = sign;
-
- if(pos2 < pos1)
- {
- sign = -(sign);
- }
- cod[pos2] = cod[pos2] + sign;
- }
- return;
+ Word32 linear_codewords[8];
+ Word32 i, j, pos1, pos2, sign;
+
+
+ memset( cod, 0, L_CODE <<2 );
+ decompress_codewords( &index[NB_TRACK_MR102], linear_codewords );
+
+ /* decode the positions and signs of pulses and build the codeword */
+ for ( j = 0; j < NB_TRACK_MR102; j++ ) {
+ /* compute index i */
+ i = linear_codewords[j];
+ i <<= 2;
+
+ /* position of pulse "j" */
+ pos1 = i + j;
+
+ if ( index[j] == 0 ) {
+ sign = POS_CODE; /* +1.0 */
+ }
+ else {
+ sign = -NEG_CODE; /* -1.0 */
+ }
+
+ /* compute index i */
+ i = linear_codewords[j + 4];
+ i = i << 2;
+
+ /* position of pulse "j+4" */
+ pos2 = i + j;
+ cod[pos1] = sign;
+
+ if ( pos2 < pos1 ) {
+ sign = -( sign );
+ }
+ cod[pos2] = cod[pos2] + sign;
+ }
+ return;
}
@@ -2994,51 +2806,47 @@ static void decode_8i40_31bits(Word16 index[], Word32 cod[])
* Returns:
* void
*/
-static void decode_10i40_35bits(Word16 index[], Word32 cod[])
+static void decode_10i40_35bits( Word16 index[], Word32 cod[] )
{
- Word32 i, j, pos1, pos2, sign, tmp;
-
-
- memset(cod, 0, L_CODE << 2);
-
- /* decode the positions and signs of pulses and build the codeword */
- for(j = 0; j < 5; j++)
- {
- /* compute index i */
- tmp = index[j];
- i = tmp & 7;
- i = dgray[i];
- i = (i * 5);
-
- /* position of pulse "j" */
- pos1 = (i + j);
- i = (tmp >> 3) & 1;
-
- if(i == 0)
- {
- sign = 4096; /* +1.0 */
- }
- else
- {
- sign = -4096; /* -1.0 */
- }
-
- /* compute index i */
- i = index[j + 5] & 7;
- i = dgray[i];
- i = i * 5;
-
- /* position of pulse "j+5" */
- pos2 = (i + j);
- cod[pos1] = sign;
-
- if(pos2 < pos1)
- {
- sign = -(sign);
- }
- cod[pos2] = cod[pos2] + sign;
- }
- return;
+ Word32 i, j, pos1, pos2, sign, tmp;
+
+
+ memset( cod, 0, L_CODE <<2 );
+
+ /* decode the positions and signs of pulses and build the codeword */
+ for ( j = 0; j < 5; j++ ) {
+ /* compute index i */
+ tmp = index[j];
+ i = tmp & 7;
+ i = dgray[i];
+ i = ( i * 5 );
+
+ /* position of pulse "j" */
+ pos1 = ( i + j );
+ i = ( tmp >> 3 ) & 1;
+
+ if ( i == 0 ) {
+ sign = 4096; /* +1.0 */
+ }
+ else {
+ sign = -4096; /* -1.0 */
+ }
+
+ /* compute index i */
+ i = index[j + 5] & 7;
+ i = dgray[i];
+ i = i * 5;
+
+ /* position of pulse "j+5" */
+ pos2 = ( i + j );
+ cod[pos1] = sign;
+
+ if ( pos2 < pos1 ) {
+ sign = -( sign );
+ }
+ cod[pos2] = cod[pos2] + sign;
+ }
+ return;
}
@@ -3056,34 +2864,30 @@ static void decode_10i40_35bits(Word16 index[], Word32 cod[])
* Returns:
* index of the median value
*/
-static Word32 gmed_n(Word32 ind[], Word32 n)
+static Word32 gmed_n( Word32 ind[], Word32 n )
{
- Word32 tmp[NMAX], tmp2[NMAX];
- Word32 max, medianIndex, i, j, ix = 0;
-
-
- for(i = 0; i < n; i++)
- {
- tmp2[i] = ind[i];
- }
-
- for(i = 0; i < n; i++)
- {
- max = -32767;
-
- for(j = 0; j < n; j++)
- {
- if(tmp2[j] >= max)
- {
- max = tmp2[j];
- ix = j;
- }
- }
- tmp2[ix] = -32768;
- tmp[i] = ix;
- }
- medianIndex = tmp[(n >>1)];
- return(ind[medianIndex]);
+ Word32 tmp[NMAX], tmp2[NMAX];
+ Word32 max, medianIndex, i, j, ix = 0;
+
+
+ for ( i = 0; i < n; i++ ) {
+ tmp2[i] = ind[i];
+ }
+
+ for ( i = 0; i < n; i++ ) {
+ max = -32767;
+
+ for ( j = 0; j < n; j++ ) {
+ if ( tmp2[j] >= max ) {
+ max = tmp2[j];
+ ix = j;
+ }
+ }
+ tmp2[ix] = -32768;
+ tmp[i] = ix;
+ }
+ medianIndex = tmp[( n >>1 )];
+ return( ind[medianIndex] );
}
@@ -3103,21 +2907,20 @@ static Word32 gmed_n(Word32 ind[], Word32 n)
* Returns:
* void
*/
-static void ec_gain_pitch(ec_gain_pitchState *st, Word16 state, Word32 *
- gain_pitch)
+static void ec_gain_pitch( ec_gain_pitchState *st, Word16 state, Word32 *
+ gain_pitch )
{
- Word32 tmp;
+ Word32 tmp;
- /* calculate median of last five gains */
- tmp = gmed_n(st->pbuf, 5);
+ /* calculate median of last five gains */
+ tmp = gmed_n( st->pbuf, 5 );
- /* new gain = minimum(median, past_gain) * pdown[state] */
- if(tmp > st->past_gain_pit)
- {
- tmp = st->past_gain_pit;
- }
- *gain_pitch = (tmp * pdown[state]) >> 15;
+ /* new gain = minimum(median, past_gain) * pdown[state] */
+ if ( tmp > st->past_gain_pit ) {
+ tmp = st->past_gain_pit;
+ }
+ *gain_pitch = ( tmp * pdown[state] ) >> 15;
}
@@ -3135,21 +2938,19 @@ static void ec_gain_pitch(ec_gain_pitchState *st, Word16 state, Word32 *
* Returns:
* gain
*/
-static Word32 d_gain_pitch(enum Mode mode, Word32 index)
+static Word32 d_gain_pitch( enum Mode mode, Word32 index )
{
- Word32 gain;
-
-
- if(mode == MR122)
- {
- /* clear 2 LSBits */
- gain = (qua_gain_pitch[index] >> 2) << 2;
- }
- else
- {
- gain = qua_gain_pitch[index];
- }
- return gain;
+ Word32 gain;
+
+
+ if ( mode == MR122 ) {
+ /* clear 2 LSBits */
+ gain = ( qua_gain_pitch[index] >> 2 ) << 2;
+ }
+ else {
+ gain = qua_gain_pitch[index];
+ }
+ return gain;
}
@@ -3172,32 +2973,28 @@ static Word32 d_gain_pitch(enum Mode mode, Word32 index)
* Returns:
* gain
*/
-static void ec_gain_pitch_update(ec_gain_pitchState *st, Word32 bfi,
- Word32 prev_bf, Word32 *gain_pitch)
+static void ec_gain_pitch_update( ec_gain_pitchState *st, Word32 bfi,
+ Word32 prev_bf, Word32 *gain_pitch )
{
- if(bfi == 0)
- {
- if(prev_bf != 0)
- {
- if(*gain_pitch > st->prev_gp)
- {
- *gain_pitch = st->prev_gp;
- }
- }
- st->prev_gp = *gain_pitch;
- }
- st->past_gain_pit = *gain_pitch;
-
- /* if (st->past_gain_pit > 1.0) */
- if(st->past_gain_pit > 16384)
- {
- st->past_gain_pit = 16384;
- }
- st->pbuf[0] = st->pbuf[1];
- st->pbuf[1] = st->pbuf[2];
- st->pbuf[2] = st->pbuf[3];
- st->pbuf[3] = st->pbuf[4];
- st->pbuf[4] = st->past_gain_pit;
+ if ( bfi == 0 ) {
+ if ( prev_bf != 0 ) {
+ if ( *gain_pitch > st->prev_gp ) {
+ *gain_pitch = st->prev_gp;
+ }
+ }
+ st->prev_gp = *gain_pitch;
+ }
+ st->past_gain_pit = *gain_pitch;
+
+ /* if (st->past_gain_pit > 1.0) */
+ if ( st->past_gain_pit > 16384 ) {
+ st->past_gain_pit = 16384;
+ }
+ st->pbuf[0] = st->pbuf[1];
+ st->pbuf[1] = st->pbuf[2];
+ st->pbuf[2] = st->pbuf[3];
+ st->pbuf[3] = st->pbuf[4];
+ st->pbuf[4] = st->past_gain_pit;
}
@@ -3245,61 +3042,58 @@ static void ec_gain_pitch_update(ec_gain_pitchState *st, Word32 bfi,
* Returns:
* void
*/
-static void gc_pred(gc_predState *st, enum Mode mode, Word32 *code, Word32 *
- exp_gcode0, Word32 *frac_gcode0, Word32 *exp_en, Word32 *frac_en)
+static void gc_pred( gc_predState *st, enum Mode mode, Word32 *code, Word32 *
+ exp_gcode0, Word32 *frac_gcode0, Word32 *exp_en, Word32 *frac_en )
{
- Word32 exp, frac, ener_code = 0, i = 0;
+ Word32 exp, frac, ener_code = 0, i = 0;
/* energy of code:
* ener_code = sum(code[i]^2)
*/
- while(i < L_SUBFR)
- {
- ener_code += code[i] * code[i];
- i++;
- }
+ while ( i < L_SUBFR ) {
+ ener_code += code[i] * code[i];
+ i++;
+ }
- if((0x3fffffff <= ener_code) | (ener_code < 0))
- ener_code = MAX_32;
- else
- ener_code <<= 1;
+ if ( ( 0x3fffffff <= ener_code ) | ( ener_code < 0 ) )
+ ener_code = MAX_32;
+ else
+ ener_code <<= 1;
- if(mode == MR122)
- {
- Word32 ener;
+ if ( mode == MR122 ) {
+ Word32 ener;
- /* ener_code = ener_code / lcode; lcode = 40; 1/40 = 26214 Q20 */
- ener_code = ((ener_code + 0x00008000L) >> 16) * 52428;
+ /* ener_code = ener_code / lcode; lcode = 40; 1/40 = 26214 Q20 */
+ ener_code = ( ( ener_code + 0x00008000L ) >> 16 ) * 52428;
- /* Q9 * Q20 -> Q30 */
+ /* Q9 * Q20 -> Q30 */
/* energy of code:
* ener_code(Q17) = 10 * Log10(energy) / constant
* = 1/2 * Log2(energy)
* constant = 20*Log10(2)
*/
- /* ener_code = 1/2 * Log2(ener_code); Note: Log2=log2+30 */
- Log2(ener_code, &exp, &frac);
- ener_code = ((exp - 30) << 16) + (frac << 1);
-
- /* Q16 for log(), ->Q17 for 1/2 log() */
- /*
- * predicted energy:
- * ener(Q24) = (Emean + sum{pred[i]*pastEn[i]})/constant
- * = MEAN_ENER + sum(pred[i]*past_qua_en[i])
- * constant = 20*Log10(2)
- */
- ener = 0;
- i = 0;
-
- while(i < 4)
- {
- ener += st->past_qua_en_MR122[i] * pred_MR122[i];
- i++;
- }
- ener <<= 1;
- ener += MEAN_ENER_MR122;
+ /* ener_code = 1/2 * Log2(ener_code); Note: Log2=log2+30 */
+ Log2( ener_code, &exp, &frac );
+ ener_code = ( ( exp - 30 ) << 16 ) + ( frac << 1 );
+
+ /* Q16 for log(), ->Q17 for 1/2 log() */
+ /*
+ * predicted energy:
+ * ener(Q24) = (Emean + sum{pred[i]*pastEn[i]})/constant
+ * = MEAN_ENER + sum(pred[i]*past_qua_en[i])
+ * constant = 20*Log10(2)
+ */
+ ener = 0;
+ i = 0;
+
+ while ( i < 4 ) {
+ ener += st->past_qua_en_MR122[i] * pred_MR122[i];
+ i++;
+ }
+ ener <<= 1;
+ ener += MEAN_ENER_MR122;
/*
* predicted codebook gain
@@ -3308,138 +3102,128 @@ static void gc_pred(gc_predState *st, enum Mode mode, Word32 *code, Word32 *
* = Pow2(ener-ener_code)
* = Pow2(int(d)+frac(d))
*/
- ener = (ener - ener_code) >> 1; /* Q16 */
- *exp_gcode0 = ener >> 16;
- *frac_gcode0 = (ener >> 1) - (*exp_gcode0 << 15);
- }
+ ener = ( ener - ener_code ) >> 1; /* Q16 */
+ *exp_gcode0 = ener >> 16;
+ *frac_gcode0 = ( ener >> 1 ) - ( *exp_gcode0 << 15 );
+ }
- /* all modes except 12.2 */
- else
- {
- Word32 tmp, gcode0;
- int exp_code;
+ /* all modes except 12.2 */
+ else {
+ Word32 tmp, gcode0;
+ int exp_code;
/*
* Compute: meansEner - 10log10(ener_code/ LSufr)
*/
- exp_code = 0;
- if(ener_code != 0)
- {
- while(!(ener_code & 0x40000000))
- {
- exp_code++;
- ener_code = ener_code << 1;
- }
- }
-
- /* Log2 = log2 + 27 */
- Log2_norm(ener_code, exp_code, &exp, &frac);
-
- /* fact = 10/log2(10) = 3.01 = 24660 Q13 */
- /* Q0.Q15 * Q13 -> Q14 */
- tmp = (exp * (-49320)) + (((frac * (-24660)) >> 15) << 1);
-
- /*
- * tmp = meansEner - 10log10(ener_code/L_SUBFR)
- * = meansEner - 10log10(ener_code) + 10log10(L_SUBFR)
- * = K - fact * Log2(ener_code)
- * = K - fact * log2(ener_code) - fact*27
- *
- * ==> K = meansEner + fact*27 + 10log10(L_SUBFR)
- *
- * meansEner = 33 = 540672 Q14 (MR475, MR515, MR59)
- * meansEner = 28.75 = 471040 Q14 (MR67)
- * meansEner = 30 = 491520 Q14 (MR74)
- * meansEner = 36 = 589824 Q14 (MR795)
- * meansEner = 33 = 540672 Q14 (MR102)
- * 10log10(L_SUBFR) = 16.02 = 262481.51 Q14
- * fact * 27 = 1331640 Q14
- * -----------------------------------------
- * (MR475, MR515, MR59) K = 2134793.51 Q14 ~= 16678 * 64 * 2
- * (MR67) K = 2065161.51 Q14 ~= 32268 * 32 * 2
- * (MR74) K = 2085641.51 Q14 ~= 32588 * 32 * 2
- * (MR795) K = 2183945.51 Q14 ~= 17062 * 64 * 2
- * (MR102) K = 2134793.51 Q14 ~= 16678 * 64 * 2
- */
- if(mode == MR102)
- {
- /* mean = 33 dB */
- tmp += 2134784; /* Q14 */
- }
- else if(mode == MR795)
- {
- /* mean = 36 dB */
- tmp += 2183936; /* Q14 */
-
- /*
- * ener_code = <xn xn> * 2^27*2^exp_code
- * frac_en = ener_code / 2^16
- * = <xn xn> * 2^11*2^exp_code
- * <xn xn> = <xn xn>*2^11*2^exp * 2^exp_en
- * := frac_en * 2^exp_en
- *
- * ==> exp_en = -11-exp_code;
- */
- *frac_en = ener_code >> 16;
- *exp_en = -11 - exp_code;
- }
- else if(mode == MR74)
- {
- /* mean = 30 dB */
- tmp += 2085632; /* Q14 */
- }
- else if(mode == MR67)
- {
- /* mean = 28.75 dB */
- tmp += 2065152; /* Q14 */
- }
- else /* MR59, MR515, MR475 */
- {
- /* mean = 33 dB */
- tmp += 2134784; /* Q14 */
- }
+ exp_code=0;
+ if (ener_code != 0){
+ while (!(ener_code & 0x40000000))
+ {
+ exp_code++;
+ ener_code = ener_code << 1;
+ }
+ }
+
+ /* Log2 = log2 + 27 */
+ Log2_norm( ener_code, exp_code, &exp, &frac );
+
+ /* fact = 10/log2(10) = 3.01 = 24660 Q13 */
+ /* Q0.Q15 * Q13 -> Q14 */
+ tmp = ( exp * ( -49320 ) ) + ( ( ( frac * ( -24660 ) ) >> 15 ) << 1 );
+
+ /*
+ * tmp = meansEner - 10log10(ener_code/L_SUBFR)
+ * = meansEner - 10log10(ener_code) + 10log10(L_SUBFR)
+ * = K - fact * Log2(ener_code)
+ * = K - fact * log2(ener_code) - fact*27
+ *
+ * ==> K = meansEner + fact*27 + 10log10(L_SUBFR)
+ *
+ * meansEner = 33 = 540672 Q14 (MR475, MR515, MR59)
+ * meansEner = 28.75 = 471040 Q14 (MR67)
+ * meansEner = 30 = 491520 Q14 (MR74)
+ * meansEner = 36 = 589824 Q14 (MR795)
+ * meansEner = 33 = 540672 Q14 (MR102)
+ * 10log10(L_SUBFR) = 16.02 = 262481.51 Q14
+ * fact * 27 = 1331640 Q14
+ * -----------------------------------------
+ * (MR475, MR515, MR59) K = 2134793.51 Q14 ~= 16678 * 64 * 2
+ * (MR67) K = 2065161.51 Q14 ~= 32268 * 32 * 2
+ * (MR74) K = 2085641.51 Q14 ~= 32588 * 32 * 2
+ * (MR795) K = 2183945.51 Q14 ~= 17062 * 64 * 2
+ * (MR102) K = 2134793.51 Q14 ~= 16678 * 64 * 2
+ */
+ if ( mode == MR102 ) {
+ /* mean = 33 dB */
+ tmp += 2134784; /* Q14 */
+ }
+ else if ( mode == MR795 ) {
+ /* mean = 36 dB */
+ tmp += 2183936; /* Q14 */
+
+ /*
+ * ener_code = <xn xn> * 2^27*2^exp_code
+ * frac_en = ener_code / 2^16
+ * = <xn xn> * 2^11*2^exp_code
+ * <xn xn> = <xn xn>*2^11*2^exp * 2^exp_en
+ * := frac_en * 2^exp_en
+ *
+ * ==> exp_en = -11-exp_code;
+ */
+ *frac_en = ener_code >> 16;
+ *exp_en = -11 - exp_code;
+ }
+ else if ( mode == MR74 ) {
+ /* mean = 30 dB */
+ tmp += 2085632; /* Q14 */
+ }
+ else if ( mode == MR67 ) {
+ /* mean = 28.75 dB */
+ tmp += 2065152; /* Q14 */
+ }
+ else /* MR59, MR515, MR475 */ {
+ /* mean = 33 dB */
+ tmp += 2134784; /* Q14 */
+ }
/*
* Compute gcode0
* = Sum(i=0,3) pred[i]*past_qua_en[i] - ener_code + meanEner
*/
- tmp = tmp << 9; /* Q23 */
+ tmp = tmp << 9; /* Q23 */
- /* Q13 * Q10 -> Q23 */
- i = 0;
+ /* Q13 * Q10 -> Q23 */
+ i = 0;
- while(i < 4)
- {
- tmp += pred[i] * st->past_qua_en[i];
- i++;
- }
- gcode0 = tmp >> 15; /* Q8 */
+ while ( i < 4 ) {
+ tmp += pred[i] * st->past_qua_en[i];
+ i++;
+ }
+ gcode0 = tmp >> 15; /* Q8 */
/*
* gcode0 = pow(10.0, gcode0/20)
* = pow(2, 3.3219*gcode0/20)
* = pow(2, 0.166*gcode0)
*/
- /* 5439 Q15 = 0.165985 */
- /* (correct: 1/(20*log10(2)) 0.166096 = 5443 Q15) */
- /* For IS641 bitexactness */
- if(mode == MR74)
- {
- /* Q8 * Q15 -> Q24 */
- tmp = gcode0 * 10878;
- }
- else
- {
- /* Q8 * Q15 -> Q24 */
- tmp = gcode0 * 10886;
- }
- tmp = tmp >> 9; /* -> Q15 */
-
- /* -> Q0.Q15 */
- *exp_gcode0 = tmp >> 15;
- *frac_gcode0 = tmp - (*exp_gcode0 * 32768);
- }
+ /* 5439 Q15 = 0.165985 */
+ /* (correct: 1/(20*log10(2)) 0.166096 = 5443 Q15) */
+ /* For IS641 bitexactness */
+ if ( mode == MR74 ) {
+ /* Q8 * Q15 -> Q24 */
+ tmp = gcode0 * 10878;
+ }
+ else {
+ /* Q8 * Q15 -> Q24 */
+ tmp = gcode0 * 10886;
+ }
+ tmp = tmp >> 9; /* -> Q15 */
+
+ /* -> Q0.Q15 */
+ *exp_gcode0 = tmp >> 15;
+ *frac_gcode0 = tmp - ( *exp_gcode0 * 32768 );
+ }
}
@@ -3459,19 +3243,18 @@ static void gc_pred(gc_predState *st, enum Mode mode, Word32 *code, Word32 *
* Returns:
* void
*/
-static void gc_pred_update(gc_predState *st, Word32 qua_ener_MR122,
- Word32 qua_ener)
+static void gc_pred_update( gc_predState *st, Word32 qua_ener_MR122,
+ Word32 qua_ener )
{
- Word32 i;
+ Word32 i;
- for(i = 3; i > 0; i--)
- {
- st->past_qua_en[i] = st->past_qua_en[i - 1];
- st->past_qua_en_MR122[i] = st->past_qua_en_MR122[i - 1];
- }
- st->past_qua_en_MR122[0] = qua_ener_MR122; /* log2 (quaErr), Q10 */
- st->past_qua_en[0] = qua_ener; /* 20*log10(quaErr), Q10 */
+ for ( i = 3; i > 0; i-- ) {
+ st->past_qua_en[i] = st->past_qua_en[i - 1];
+ st->past_qua_en_MR122[i] = st->past_qua_en_MR122[i - 1];
+ }
+ st->past_qua_en_MR122[0] = qua_ener_MR122; /* log2 (quaErr), Q10 */
+ st->past_qua_en[0] = qua_ener; /* 20*log10(quaErr), Q10 */
}
@@ -3495,32 +3278,29 @@ static void gc_pred_update(gc_predState *st, Word32 qua_ener_MR122,
* Returns:
* void
*/
-static void Dec_gain(gc_predState *pred_state, enum Mode mode, Word32 index,
- Word32 code[], Word32 evenSubfr, Word32 *gain_pit, Word32 *gain_cod)
+static void Dec_gain( gc_predState *pred_state, enum Mode mode, Word32 index,
+ Word32 code[], Word32 evenSubfr, Word32 *gain_pit, Word32 *gain_cod )
{
- Word32 frac, gcode0, exp, qua_ener, qua_ener_MR122, g_code, tmp;
- const Word32 *p;
-
-
- /* Read the quantized gains (table depends on mode) */
- index = index << 2;
-
- if((mode == MR102) || (mode == MR74) || (mode == MR67))
- {
- p = &table_gain_highrates[index];
- *gain_pit = *p++;
- g_code = *p++;
- qua_ener_MR122 = *p++;
- qua_ener = *p;
- }
- else
- {
- if(mode == MR475)
- {
- index = index + ((1 - evenSubfr) << 1);
- p = &table_gain_MR475[index];
- *gain_pit = *p++;
- g_code = *p++;
+ Word32 frac, gcode0, exp, qua_ener, qua_ener_MR122, g_code, tmp;
+ const Word32 *p;
+
+
+ /* Read the quantized gains (table depends on mode) */
+ index = index << 2;
+
+ if ( ( mode == MR102 ) || ( mode == MR74 ) || ( mode == MR67 ) ) {
+ p = &table_gain_highrates[index];
+ *gain_pit = *p++;
+ g_code = *p++;
+ qua_ener_MR122 = *p++;
+ qua_ener = *p;
+ }
+ else {
+ if ( mode == MR475 ) {
+ index = index + ( ( 1 - evenSubfr ) << 1 );
+ p = &table_gain_MR475[index];
+ *gain_pit = *p++;
+ g_code = *p++;
/*
* calculate predictor update values (not stored in 4.75
@@ -3528,33 +3308,31 @@ static void Dec_gain(gc_predState *pred_state, enum Mode mode, Word32 index,
* qua_ener = log2(g)
* qua_ener_MR122 = 20*log10(g)
*/
- /* Log2(x Q12) = log2(x) + 12 */
- Log2(g_code, &exp, &frac);
- exp = exp - 12;
- tmp = frac >> 5;
-
- if((frac & ((Word16)1 << 4)) != 0)
- {
- tmp++;
- }
- qua_ener_MR122 = tmp + (exp << 10);
-
- /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
- tmp = exp * 49320;
- tmp += (((frac * 24660) >> 15) << 1);
-
- /* Q12 * Q0 = Q13 -> Q10 */
- qua_ener = ((tmp << 13) + 0x00008000L) >> 16;
- }
- else
- {
- p = &table_gain_lowrates[index];
- *gain_pit = *p++;
- g_code = *p++;
- qua_ener_MR122 = *p++;
- qua_ener = *p;
- }
- }
+ /* Log2(x Q12) = log2(x) + 12 */
+ Log2( g_code, &exp, &frac );
+ exp = exp - 12;
+ tmp = frac >> 5;
+
+ if ( ( frac & ( ( Word16 )1 << 4 ) ) != 0 ) {
+ tmp++;
+ }
+ qua_ener_MR122 = tmp + ( exp << 10 );
+
+ /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
+ tmp = exp * 49320;
+ tmp += ( ( ( frac * 24660 ) >> 15 ) << 1 );
+
+ /* Q12 * Q0 = Q13 -> Q10 */
+ qua_ener = ( ( tmp << 13 ) + 0x00008000L ) >> 16;
+ }
+ else {
+ p = &table_gain_lowrates[index];
+ *gain_pit = *p++;
+ g_code = *p++;
+ qua_ener_MR122 = *p++;
+ qua_ener = *p;
+ }
+ }
/*
* predict codebook gain
@@ -3562,8 +3340,8 @@ static void Dec_gain(gc_predState *pred_state, enum Mode mode, Word32 index,
* = 2^exp + 2^frac
* gcode0 (Q14) = 2^14*2^frac = gc0 * 2^(14-exp)
*/
- gc_pred(pred_state, mode, code, &exp, &frac, NULL, NULL);
- gcode0 = Pow2(14, frac);
+ gc_pred( pred_state, mode, code, &exp, &frac, NULL, NULL );
+ gcode0 = Pow2( 14, frac );
/*
* read quantized gains, update table of past quantized energies
@@ -3572,27 +3350,23 @@ static void Dec_gain(gc_predState *pred_state, enum Mode mode, Word32 index,
* = qua_ener
* constant = 20*Log10(2)
*/
- if(exp < 11)
- {
- *gain_cod = (g_code * gcode0) >> (25 - exp);
- }
- else
- {
- tmp = ((g_code * gcode0) << (exp - 9));
-
- if((tmp >> (exp - 9)) != (g_code * gcode0))
- {
- *gain_cod = 0x7FFF;
- }
- else
- {
- *gain_cod = tmp >> 16;
- }
- }
-
- /* update table of past quantized energies */
- gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
- return;
+ if ( exp < 11 ) {
+ *gain_cod = ( g_code * gcode0 ) >> ( 25 - exp );
+ }
+ else {
+ tmp = ( ( g_code * gcode0 ) << ( exp - 9 ) );
+
+ if ( ( tmp >> ( exp - 9 ) ) != ( g_code * gcode0 ) ) {
+ *gain_cod = 0x7FFF;
+ }
+ else {
+ *gain_cod = tmp >> 16;
+ }
+ }
+
+ /* update table of past quantized energies */
+ gc_pred_update( pred_state, qua_ener_MR122, qua_ener );
+ return;
}
@@ -3611,46 +3385,43 @@ static void Dec_gain(gc_predState *pred_state, enum Mode mode, Word32 index,
* Returns:
* void
*/
-static void gc_pred_average_limited(gc_predState *st, Word32 *ener_avg_MR122,
- Word32 *ener_avg)
+static void gc_pred_average_limited( gc_predState *st, Word32 *ener_avg_MR122,
+ Word32 *ener_avg )
{
- Word32 av_pred_en, i;
+ Word32 av_pred_en, i;
- /* do average in MR122 mode (log2() domain) */
- av_pred_en = 0;
+ /* do average in MR122 mode (log2() domain) */
+ av_pred_en = 0;
- for(i = 0; i < NPRED; i++)
- {
- av_pred_en = (av_pred_en + st->past_qua_en_MR122[i]);
- }
+ for ( i = 0; i < NPRED; i++ ) {
+ av_pred_en = ( av_pred_en + st->past_qua_en_MR122[i] );
+ }
- /* av_pred_en = 0.25*av_pred_en */
- av_pred_en = (av_pred_en * 8192) >> 15;
+ /* av_pred_en = 0.25*av_pred_en */
+ av_pred_en = ( av_pred_en * 8192 ) >> 15;
- /* if (av_pred_en < -14/(20Log10(2))) av_pred_en = .. */
- if(av_pred_en < MIN_ENERGY_MR122)
- {
- av_pred_en = MIN_ENERGY_MR122;
- }
- *ener_avg_MR122 = (Word16)av_pred_en;
+ /* if (av_pred_en < -14/(20Log10(2))) av_pred_en = .. */
+ if ( av_pred_en < MIN_ENERGY_MR122 ) {
+ av_pred_en = MIN_ENERGY_MR122;
+ }
+ *ener_avg_MR122 = ( Word16 )av_pred_en;
- /* do average for other modes (20*log10() domain) */
- av_pred_en = 0;
+ /* do average for other modes (20*log10() domain) */
+ av_pred_en = 0;
- for(i = 0; i < NPRED; i++)
- {
- av_pred_en = (av_pred_en + st->past_qua_en[i]);
- if(av_pred_en < -32768)
- av_pred_en = -32768;
- else if(av_pred_en > 32767)
- av_pred_en = 32767;
- }
+ for ( i = 0; i < NPRED; i++ ) {
+ av_pred_en = ( av_pred_en + st->past_qua_en[i] );
+ if (av_pred_en < -32768)
+ av_pred_en = -32768;
+ else if (av_pred_en > 32767)
+ av_pred_en = 32767;
+ }
- /* av_pred_en = 0.25*av_pred_en */
- av_pred_en = (av_pred_en * 8192) >> 15;
+ /* av_pred_en = 0.25*av_pred_en */
+ av_pred_en = ( av_pred_en * 8192 ) >> 15;
- *ener_avg = av_pred_en;
+ *ener_avg = av_pred_en;
}
@@ -3671,29 +3442,28 @@ static void gc_pred_average_limited(gc_predState *st, Word32 *ener_avg_MR122,
* Returns:
* void
*/
-static void ec_gain_code(ec_gain_codeState *st, gc_predState *pred_state,
- Word16 state, Word32 *gain_code)
+static void ec_gain_code( ec_gain_codeState *st, gc_predState *pred_state,
+ Word16 state, Word32 *gain_code )
{
- Word32 tmp, qua_ener_MR122, qua_ener;
+ Word32 tmp, qua_ener_MR122, qua_ener;
- /* calculate median of last five gain values */
- tmp = gmed_n(st->gbuf, 5);
+ /* calculate median of last five gain values */
+ tmp = gmed_n( st->gbuf, 5 );
- /* new gain = minimum(median, past_gain) * cdown[state] */
- if(tmp > st->past_gain_code)
- {
- tmp = st->past_gain_code;
- }
- tmp = (tmp * cdown[state]) >> 15;
- *gain_code = tmp;
+ /* new gain = minimum(median, past_gain) * cdown[state] */
+ if ( tmp > st->past_gain_code ) {
+ tmp = st->past_gain_code;
+ }
+ tmp = ( tmp * cdown[state] ) >> 15;
+ *gain_code = tmp;
- /*
- * update table of past quantized energies with average of
- * current values
- */
- gc_pred_average_limited(pred_state, &qua_ener_MR122, &qua_ener);
- gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
+ /*
+ * update table of past quantized energies with average of
+ * current values
+ */
+ gc_pred_average_limited( pred_state, &qua_ener_MR122, &qua_ener );
+ gc_pred_update( pred_state, qua_ener_MR122, qua_ener );
}
@@ -3715,30 +3485,27 @@ static void ec_gain_code(ec_gain_codeState *st, gc_predState *pred_state,
* Returns:
* void
*/
-static void ec_gain_code_update(ec_gain_codeState *st, Word16 bfi,
- Word16 prev_bf, Word32 *gain_code)
+static void ec_gain_code_update( ec_gain_codeState *st, Word16 bfi,
+ Word16 prev_bf, Word32 *gain_code )
{
- /* limit gain_code by previous good gain if previous frame was bad */
- if(bfi == 0)
- {
- if(prev_bf != 0)
- {
- if(*gain_code > st->prev_gc)
- {
- *gain_code = st->prev_gc;
- }
- }
- st->prev_gc = *gain_code;
- }
-
- /* update EC states: previous gain, gain buffer */
- st->past_gain_code = *gain_code;
- st->gbuf[0] = st->gbuf[1];
- st->gbuf[1] = st->gbuf[2];
- st->gbuf[2] = st->gbuf[3];
- st->gbuf[3] = st->gbuf[4];
- st->gbuf[4] = *gain_code;
- return;
+ /* limit gain_code by previous good gain if previous frame was bad */
+ if ( bfi == 0 ) {
+ if ( prev_bf != 0 ) {
+ if ( *gain_code > st->prev_gc ) {
+ *gain_code = st->prev_gc;
+ }
+ }
+ st->prev_gc = *gain_code;
+ }
+
+ /* update EC states: previous gain, gain buffer */
+ st->past_gain_code = *gain_code;
+ st->gbuf[0] = st->gbuf[1];
+ st->gbuf[1] = st->gbuf[2];
+ st->gbuf[2] = st->gbuf[3];
+ st->gbuf[3] = st->gbuf[4];
+ st->gbuf[4] = *gain_code;
+ return;
}
@@ -3759,73 +3526,66 @@ static void ec_gain_code_update(ec_gain_codeState *st, Word16 bfi,
* Returns:
* void
*/
-static void d_gain_code(gc_predState *pred_state, enum Mode mode, Word32 index,
- Word32 code[], Word32 *gain_code)
+static void d_gain_code( gc_predState *pred_state, enum Mode mode, Word32 index,
+ Word32 code[], Word32 *gain_code )
{
- Word32 g_code0, exp, frac, qua_ener_MR122, qua_ener;
- Word32 exp_inn_en, frac_inn_en, tmp, tmp2, i;
- const Word32 *p;
-
-
- /*
- * Decode codebook gain
- */
- gc_pred(pred_state, mode, code, &exp, &frac, &exp_inn_en, &frac_inn_en);
- p = &qua_gain_code[((index + index)+ index)];
-
- /* Different scalings between MR122 and the other modes */
- if(mode == MR122)
- {
- /* predicted gain */
- g_code0 = Pow2(exp, frac);
-
- if(g_code0 <= 2047)
- g_code0 = g_code0 << 4;
- else
- g_code0 = 32767;
- *gain_code = ((g_code0 * *p++) >> 15) << 1;
- if(*gain_code & 0xFFFF8000)
- *gain_code = 32767;
-
- }
- else
- {
- g_code0 = Pow2(14, frac);
- tmp = (*p++ * g_code0) << 1;
- exp = 9 - exp;
-
- if(exp > 0)
- {
- tmp = tmp >> exp;
- }
- else
- {
- for(i = exp; i < 0; i++)
- {
- tmp2 = tmp << 1;
- if((tmp ^ tmp2) & 0x80000000)
- {
- tmp = (tmp & 0x80000000) ? 0x80000000 : 0x7FFFFFFF;
- break;
- }
- else
- {
- tmp = tmp2;
- }
+ Word32 g_code0, exp, frac, qua_ener_MR122, qua_ener;
+ Word32 exp_inn_en, frac_inn_en, tmp, tmp2, i;
+ const Word32 *p;
+
+
+ /*
+ * Decode codebook gain
+ */
+ gc_pred( pred_state, mode, code, &exp, &frac, &exp_inn_en, &frac_inn_en );
+ p = &qua_gain_code[( ( index + index )+ index )];
+
+ /* Different scalings between MR122 and the other modes */
+ if ( mode == MR122 ) {
+ /* predicted gain */
+ g_code0 = Pow2( exp, frac );
+
+ if ( g_code0 <= 2047 )
+ g_code0 = g_code0 << 4;
+ else
+ g_code0 = 32767;
+ *gain_code = ( ( g_code0 * *p++ ) >> 15 ) << 1;
+ if (*gain_code & 0xFFFF8000)
+ *gain_code = 32767;
+
+ }
+ else {
+ g_code0 = Pow2( 14, frac );
+ tmp = ( *p++ * g_code0 ) << 1;
+ exp = 9 - exp;
+
+ if ( exp > 0 ) {
+ tmp = tmp >> exp;
+ }
+ else {
+ for (i = exp; i < 0; i++) {
+ tmp2 = tmp << 1;
+ if ((tmp ^ tmp2) & 0x80000000) {
+ tmp = (tmp & 0x80000000) ? 0x80000000 : 0x7FFFFFFF;
+ break;
}
- }
- *gain_code = tmp >> 16;
- if(*gain_code & 0xFFFF8000)
- *gain_code = 32767;
- }
-
- /*
- * update table of past quantized energies
- */
- qua_ener_MR122 = *p++;
- qua_ener = *p++;
- gc_pred_update(pred_state, qua_ener_MR122, qua_ener);
- return;
+ else {
+ tmp = tmp2;
+ }
+ }
+ }
+ *gain_code = tmp >> 16;
+ if (*gain_code & 0xFFFF8000)
+ *gain_code = 32767;
+ }
+
+ /*
+ * update table of past quantized energies
+ */
+ qua_ener_MR122 = *p++;
+ qua_ener = *p++;
+ gc_pred_update( pred_state, qua_ener_MR122, qua_ener );
+ return;
}
@@ -3853,40 +3613,36 @@ static void d_gain_code(gc_predState *pred_state, enum Mode mode, Word32 index,
* Returns:
* void
*/
-static void Int_lsf(Word32 lsf_old[], Word32 lsf_new[], int i_subfr, Word32
- lsf_out[])
+static void Int_lsf( Word32 lsf_old[], Word32 lsf_new[], int i_subfr, Word32
+ lsf_out[] )
{
- Word32 i;
-
-
- switch(i_subfr)
- {
- case 0:
- for(i = 0; i < 10; i++)
- {
- lsf_out[i] = lsf_old[i] - (lsf_old[i] >> 2) + (lsf_new[i] >> 2);
- }
- break;
-
- case 40:
- for(i = 0; i < 10; i++)
- {
- lsf_out[i] = (lsf_old[i] >> 1) + (lsf_new[i] >> 1);
- }
- break;
-
- case 80:
- for(i = 0; i < 10; i++)
- {
- lsf_out[i] = (lsf_old[i] >> 2) - (lsf_new[i] >> 2) +
- lsf_new[i];
- }
- break;
-
- case 120:
- memcpy(lsf_out, lsf_new, M << 2);
- break;
- }
+ Word32 i;
+
+
+ switch ( i_subfr ) {
+ case 0:
+ for ( i = 0; i < 10; i++ ) {
+ lsf_out[i] = lsf_old[i] - ( lsf_old[i] >> 2 ) + ( lsf_new[i] >> 2 );
+ }
+ break;
+
+ case 40:
+ for ( i = 0; i < 10; i++ ) {
+ lsf_out[i] = ( lsf_old[i] >> 1 ) + ( lsf_new[i] >> 1 );
+ }
+ break;
+
+ case 80:
+ for ( i = 0; i < 10; i++ ) {
+ lsf_out[i] = ( lsf_old[i] >> 2 ) - ( lsf_new[i] >> 2 ) +
+ lsf_new[i];
+ }
+ break;
+
+ case 120:
+ memcpy( lsf_out, lsf_new, M <<2 );
+ break;
+ }
}
@@ -3915,178 +3671,159 @@ static void Int_lsf(Word32 lsf_old[], Word32 lsf_new[], int i_subfr, Word32
* Returns:
* void
*/
-static Word32 Cb_gain_average(Cb_gain_averageState *st, enum Mode mode, Word32
- gain_code, Word32 lsp[], Word32 lspAver[], Word16 bfi, Word16 prev_bf,
- Word16 pdfi, Word16 prev_pdf, Word32 inBackgroundNoise, Word32
- voicedHangover)
+static Word32 Cb_gain_average( Cb_gain_averageState *st, enum Mode mode, Word32
+ gain_code, Word32 lsp[], Word32 lspAver[], Word16 bfi, Word16 prev_bf,
+ Word16 pdfi, Word16 prev_pdf, Word32 inBackgroundNoise, Word32
+ voicedHangover )
{
- Word32 tmp[M];
- Word32 i, cbGainMix, tmp_diff, bgMix, cbGainMean, sum, diff, tmp1, tmp2;
- int shift1, shift2, shift;
+ Word32 tmp[M];
+ Word32 i, cbGainMix, tmp_diff, bgMix, cbGainMean, sum, diff, tmp1, tmp2;
+ int shift1, shift2, shift;
+
+
+ /* set correct cbGainMix for MR74, MR795, MR122 */
+ cbGainMix = gain_code;
+
+ /*
+ * Store list of CB gain needed in the CB gain averaging *
+ */
+ st->cbGainHistory[0] = st->cbGainHistory[1];
+ st->cbGainHistory[1] = st->cbGainHistory[2];
+ st->cbGainHistory[2] = st->cbGainHistory[3];
+ st->cbGainHistory[3] = st->cbGainHistory[4];
+ st->cbGainHistory[4] = st->cbGainHistory[5];
+ st->cbGainHistory[5] = st->cbGainHistory[6];
+ st->cbGainHistory[6] = gain_code;
+
+ /* compute lsp difference */
+ for ( i = 0; i < M; i++ ) {
+ tmp1 = labs( lspAver[i]- lsp[i] );
+ shift1 = 0;
+ if (tmp1 != 0){
+ while (!(tmp1 & 0x2000))
+ {
+ shift1++;
+ tmp1 = tmp1 << 1;
+ }
+ }
+ tmp2 = lspAver[i];
+ shift2 = 0;
+ if (tmp2 != 0){
+ while (!(tmp2 & 0x4000))
+ {
+ shift2++;
+ tmp2 = tmp2 << 1;
+ }
+ }
+ tmp[i] = ( tmp1 << 15 ) / tmp2;
+ shift = 2 + shift1 - shift2;
+
+ if ( shift >= 0 ) {
+ tmp[i] = tmp[i] >> shift;
+ }
+ else {
+ tmp[i] = tmp[i] << -( shift );
+ }
+ }
+ diff = *tmp + tmp[1] + tmp[2] + tmp[3] + tmp[4] + tmp[5] + tmp[6] + tmp[7] +
+ tmp[8] + tmp[9];
+
+ /* saturate */
+ if ( diff > 32767 ) {
+ diff = 32767;
+ }
+
+ /* Compute hangover */
+ st->hangVar += 1;
+
+ if ( diff <= 5325 ) {
+ st->hangVar = 0;
+ }
+
+ if ( st->hangVar > 10 ) {
+ /* Speech period, reset hangover variable */
+ st->hangCount = 0;
+ }
+
+ /* Compute mix constant (bgMix) */
+ bgMix = 8192;
+
+ /* MR475, MR515, MR59, MR67, MR102 */
+ if ( ( mode <= MR67 ) | ( mode == MR102 ) ) {
+ /* disable mix if too short time since */
+ if ( ( st->hangCount >= 40 ) & ( diff <= 5325 ) ) /* 0.65 in Q13 */ {
+ /* if errors and presumed noise make smoothing probability stronger */
+ if ( ( ( ( ( pdfi != 0 ) & ( prev_pdf != 0 ) ) | ( bfi != 0 ) | (
+ prev_bf != 0 ) ) & ( ( voicedHangover > 1 ) ) & (
+ inBackgroundNoise != 0 ) & ( mode < MR67 ) ) ) {
+ /* bgMix = min(0.25, max(0.0, diff-0.55)) / 0.25; */
+ tmp_diff = diff - 4506; /* 0.55 in Q13 */
+
+ /* max(0.0, diff-0.55) */
+ tmp1 = 0;
+
+ if ( tmp_diff > 0 ) {
+ tmp1 = tmp_diff;
+ }
+ /* min(0.25, tmp1) */
+ if ( 2048 >= tmp1 ) {
+ bgMix = tmp1 << 2;
+ }
+ }
+ else {
+ /* bgMix = min(0.25, max(0.0, diff-0.40)) / 0.25; */
+ tmp_diff = diff - 3277; /* 0.4 in Q13 */
- /* set correct cbGainMix for MR74, MR795, MR122 */
- cbGainMix = gain_code;
+ /* max(0.0, diff-0.40) */
+ tmp1 = 0;
- /*
- * Store list of CB gain needed in the CB gain averaging *
- */
- st->cbGainHistory[0] = st->cbGainHistory[1];
- st->cbGainHistory[1] = st->cbGainHistory[2];
- st->cbGainHistory[2] = st->cbGainHistory[3];
- st->cbGainHistory[3] = st->cbGainHistory[4];
- st->cbGainHistory[4] = st->cbGainHistory[5];
- st->cbGainHistory[5] = st->cbGainHistory[6];
- st->cbGainHistory[6] = gain_code;
-
- /* compute lsp difference */
- for(i = 0; i < M; i++)
- {
- tmp1 = labs(lspAver[i] - lsp[i]);
- shift1 = 0;
- if(tmp1 != 0)
- {
- while(!(tmp1 & 0x2000))
- {
- shift1++;
- tmp1 = tmp1 << 1;
- }
- }
- tmp2 = lspAver[i];
- shift2 = 0;
- if(tmp2 != 0)
- {
- while(!(tmp2 & 0x4000))
- {
- shift2++;
- tmp2 = tmp2 << 1;
- }
- }
- tmp[i] = (tmp1 << 15) / tmp2;
- shift = 2 + shift1 - shift2;
-
- if(shift >= 0)
- {
- tmp[i] = tmp[i] >> shift;
- }
- else
- {
- tmp[i] = tmp[i] << -(shift);
- }
- }
- diff = *tmp + tmp[1] + tmp[2] + tmp[3] + tmp[4] + tmp[5] + tmp[6] + tmp[7] +
- tmp[8] + tmp[9];
-
- /* saturate */
- if(diff > 32767)
- {
- diff = 32767;
- }
-
- /* Compute hangover */
- st->hangVar += 1;
-
- if(diff <= 5325)
- {
- st->hangVar = 0;
- }
-
- if(st->hangVar > 10)
- {
- /* Speech period, reset hangover variable */
- st->hangCount = 0;
- }
-
- /* Compute mix constant (bgMix) */
- bgMix = 8192;
-
- /* MR475, MR515, MR59, MR67, MR102 */
- if((mode <= MR67) | (mode == MR102))
- {
- /* disable mix if too short time since */
- if((st->hangCount >= 40) & (diff <= 5325)) /* 0.65 in Q13 */
- {
- /* if errors and presumed noise make smoothing probability stronger */
- if(((((pdfi != 0) & (prev_pdf != 0)) | (bfi != 0) | (
- prev_bf != 0)) & ((voicedHangover > 1)) & (
- inBackgroundNoise != 0) & (mode < MR67)))
- {
- /* bgMix = min(0.25, max(0.0, diff-0.55)) / 0.25; */
- tmp_diff = diff - 4506; /* 0.55 in Q13 */
-
- /* max(0.0, diff-0.55) */
- tmp1 = 0;
-
- if(tmp_diff > 0)
- {
- tmp1 = tmp_diff;
- }
-
- /* min(0.25, tmp1) */
- if(2048 >= tmp1)
- {
- bgMix = tmp1 << 2;
- }
+ if ( tmp_diff > 0 ) {
+ tmp1 = tmp_diff;
}
- else
- {
- /* bgMix = min(0.25, max(0.0, diff-0.40)) / 0.25; */
- tmp_diff = diff - 3277; /* 0.4 in Q13 */
-
- /* max(0.0, diff-0.40) */
- tmp1 = 0;
-
- if(tmp_diff > 0)
- {
- tmp1 = tmp_diff;
- }
-
- /* min(0.25, tmp1) */
- if(2048 >= tmp1)
- {
- bgMix = tmp1 << 2;
- }
- }
- }
- /*
- * Smoothen the cb gain trajectory
- * smoothing depends on mix constant bgMix
- */
- sum = st->cbGainHistory[2] + st->cbGainHistory[3] + st->cbGainHistory[4] +
- st->cbGainHistory[5] + st->cbGainHistory[6];
-
- if(sum > 163822)
- {
- cbGainMean = 32767;
- }
- else
- {
- cbGainMean = (3277 * sum + 0x00002000L) >> 14; /* Q1 */
- }
-
- /* more smoothing in error and bg noise (NB no DFI used here) */
- if(((bfi != 0) | (prev_bf != 0)) & (inBackgroundNoise != 0) & (
- mode < MR67))
- {
- sum = 9362 * (st->cbGainHistory[0] + st->cbGainHistory[1] + st->
- cbGainHistory[2] + st->cbGainHistory[3] + st->cbGainHistory[4] +
- st->cbGainHistory[5] + st->cbGainHistory[6]);
- cbGainMean = (sum + 0x00008000L) >> 16; /* Q1 */
- }
-
- /* cbGainMix = bgMix*cbGainMix + (1-bgMix)*cbGainMean; */
- sum = bgMix * cbGainMix; /* sum in Q14 */
- sum += cbGainMean << 13;
- sum -= bgMix * cbGainMean;
- cbGainMix = (sum + 0x00001000L) >> 13;
-
- /* Q1 */
- }
- st->hangCount += 1;
- if(st->hangCount & 0x80000000)
- st->hangCount = 40;
- return cbGainMix;
+ /* min(0.25, tmp1) */
+ if ( 2048 >= tmp1 ) {
+ bgMix = tmp1 << 2;
+ }
+ }
+ }
+
+ /*
+ * Smoothen the cb gain trajectory
+ * smoothing depends on mix constant bgMix
+ */
+ sum = st->cbGainHistory[2] + st->cbGainHistory[3] + st->cbGainHistory[4] +
+ st->cbGainHistory[5] + st->cbGainHistory[6];
+
+ if ( sum > 163822 ) {
+ cbGainMean = 32767;
+ }
+ else {
+ cbGainMean = ( 3277 * sum + 0x00002000L ) >> 14; /* Q1 */
+ }
+
+ /* more smoothing in error and bg noise (NB no DFI used here) */
+ if ( ( ( bfi != 0 ) | ( prev_bf != 0 ) ) & ( inBackgroundNoise != 0 ) & (
+ mode < MR67 ) ) {
+ sum = 9362 * ( st->cbGainHistory[0] + st->cbGainHistory[1] + st->
+ cbGainHistory[2] + st->cbGainHistory[3] + st->cbGainHistory[4] +
+ st->cbGainHistory[5] + st->cbGainHistory[6] );
+ cbGainMean = ( sum + 0x00008000L ) >> 16; /* Q1 */
+ }
+
+ /* cbGainMix = bgMix*cbGainMix + (1-bgMix)*cbGainMean; */
+ sum = bgMix * cbGainMix; /* sum in Q14 */
+ sum += cbGainMean << 13;
+ sum -= bgMix * cbGainMean;
+ cbGainMix = ( sum + 0x00001000L ) >> 13;
+
+ /* Q1 */
+ }
+ st->hangCount += 1;
+ if (st->hangCount & 0x80000000)
+ st->hangCount = 40;
+ return cbGainMix;
}
@@ -4113,195 +3850,170 @@ static Word32 Cb_gain_average(Cb_gain_averageState *st, enum Mode mode, Word32
* Returns:
* void
*/
-static void ph_disp(ph_dispState *state, enum Mode mode, Word32 x[],
+static void ph_disp( ph_dispState *state, enum Mode mode, Word32 x[],
Word32 cbGain, Word32 ltpGain, Word32 inno[],
Word32 pitch_fac, Word32 tmp_shift)
{
- Word32 inno_sav[L_SUBFR], ps_poss[L_SUBFR];
- Word32 i, i1, impNr, temp1, temp2, j, nze, nPulse, ppos;
- const Word32 *ph_imp; /* Pointer to phase dispersion filter */
-
-
- /* Update LTP gain memory */
- state->gainMem[4] = state->gainMem[3];
- state->gainMem[3] = state->gainMem[2];
- state->gainMem[2] = state->gainMem[1];
- state->gainMem[1] = state->gainMem[0];
- state->gainMem[0] = ltpGain;
-
- /* basic adaption of phase dispersion */
- /* no dispersion */
- impNr = 2;
-
- /* if (ltpGain < 0.9) */
- if(ltpGain < PHDTHR2LTP)
- {
- /* maximum dispersion */
- impNr = 0;
-
- /* if (ltpGain > 0.6 */
- if(ltpGain > PHDTHR1LTP)
- {
- /* medium dispersion */
- impNr = 1;
- }
- }
-
- /* onset indicator */
- /* onset = (cbGain > onFact * cbGainMem[0]) */
- temp1 = ((state->prevCbGain * ONFACTPLUS1) + 0x1000) >> 13;
-
- if(cbGain > temp1)
- {
- state->onset = ONLENGTH;
- }
- else
- {
- if(state->onset > 0)
- {
- state->onset--;
- }
- }
-
- /*
- * if not onset, check ltpGain buffer and use max phase dispersion if
- * half or more of the ltpGain-parameters say so
- */
- if(state->onset == 0)
- {
- /* Check LTP gain memory and set filter accordingly */
- i1 = 0;
-
- for(i = 0; i < PHDGAINMEMSIZE; i++)
- {
- if(state->gainMem[i] < PHDTHR1LTP)
- {
- i1++;
- }
- }
-
- if(i1 > 2)
- {
- impNr = 0;
- }
- }
-
- /* Restrict decrease in phase dispersion to one step if not onset */
- if((impNr > (state->prevState + 1)) & (state->onset == 0))
- {
- impNr--;
- }
-
- /* if onset, use one step less phase dispersion */
- if((impNr < 2)&(state->onset > 0))
- {
- impNr++;
- }
-
- /* disable for very low levels */
- if(cbGain < 10)
- {
- impNr = 2;
- }
-
- if(state->lockFull == 1)
- {
- impNr = 0;
- }
-
- /* update static memory */
- state->prevState = impNr;
- state->prevCbGain = cbGain;
-
- /*
- * do phase dispersion for all modes but 12.2 and 7.4;
- * don't modify the innovation if impNr >=2 (= no phase disp)
- */
- if((mode != MR122) & (mode != MR102) & (mode != MR74) & (impNr < 2)
- )
- {
- /*
- * track pulse positions, save innovation,
- * and initialize new innovation
- */
- nze = 0;
-
- for(i = 0; i < L_SUBFR; i++)
- {
- if(inno[i] != 0)
- {
- ps_poss[nze] = i;
- nze++;
- }
- }
- memcpy(inno_sav, inno, L_SUBFR << 2);
- memset(inno, 0, L_SUBFR << 2);
-
- /* Choose filter corresponding to codec mode and dispersion criterium */
- ph_imp = ph_imp_mid;
-
- if(impNr == 0)
- {
- ph_imp = ph_imp_low;
- }
-
- if(mode == MR795)
- {
- ph_imp = ph_imp_mid_MR795;
-
- if(impNr == 0)
- {
- ph_imp = ph_imp_low_MR795;
- }
- }
-
- /* Do phase dispersion of innovation */
- for(nPulse = 0; nPulse < nze; nPulse++)
- {
- ppos = ps_poss[nPulse];
-
- /* circular convolution with impulse response */
- j = 0;
-
- for(i = ppos; i < L_SUBFR; i++)
- {
- /* inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos] */
- temp1 = (inno_sav[ppos] * ph_imp[j++]) >> 15;
- inno[i] = inno[i] + temp1;
- }
-
- for(i = 0; i < ppos; i++)
- {
- /* inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i] */
- temp1 = (inno_sav[ppos] * ph_imp[j++]) >> 15;
- inno[i] = inno[i] + temp1;
- }
- }
- }
-
- /*
- * compute total excitation for synthesis part of decoder
- * (using modified innovation if phase dispersion is active)
- */
- for(i = 0; i < L_SUBFR; i++)
- {
- /* x[i] = gain_pit*x[i] + cbGain*code[i]; */
- temp1 = x[i] * pitch_fac + inno[i] * cbGain;
- temp2 = temp1 << tmp_shift;
- x[i] = (temp2 + 0x4000) >> 15;
- if(labs(x[i]) > 32767)
- {
- if((temp1 ^ temp2) & 0x80000000)
- {
- x[i] = (temp1 & 0x80000000) ? -32768 : 32767;
- }
- else
- {
- x[i] = (temp2 & 0x80000000) ? -32768 : 32767;
- }
- }
- }
- return;
+ Word32 inno_sav[L_SUBFR], ps_poss[L_SUBFR];
+ Word32 i, i1, impNr, temp1, temp2, j, nze, nPulse, ppos;
+ const Word32 *ph_imp; /* Pointer to phase dispersion filter */
+
+
+ /* Update LTP gain memory */
+ state->gainMem[4] = state->gainMem[3];
+ state->gainMem[3] = state->gainMem[2];
+ state->gainMem[2] = state->gainMem[1];
+ state->gainMem[1] = state->gainMem[0];
+ state->gainMem[0] = ltpGain;
+
+ /* basic adaption of phase dispersion */
+ /* no dispersion */
+ impNr = 2;
+
+ /* if (ltpGain < 0.9) */
+ if ( ltpGain < PHDTHR2LTP ) {
+ /* maximum dispersion */
+ impNr = 0;
+
+ /* if (ltpGain > 0.6 */
+ if ( ltpGain > PHDTHR1LTP ) {
+ /* medium dispersion */
+ impNr = 1;
+ }
+ }
+
+ /* onset indicator */
+ /* onset = (cbGain > onFact * cbGainMem[0]) */
+ temp1 = ( ( state->prevCbGain * ONFACTPLUS1 ) + 0x1000 ) >> 13;
+
+ if ( cbGain > temp1 ) {
+ state->onset = ONLENGTH;
+ }
+ else {
+ if ( state->onset > 0 ) {
+ state->onset--;
+ }
+ }
+
+ /*
+ * if not onset, check ltpGain buffer and use max phase dispersion if
+ * half or more of the ltpGain-parameters say so
+ */
+ if ( state->onset == 0 ) {
+ /* Check LTP gain memory and set filter accordingly */
+ i1 = 0;
+
+ for ( i = 0; i < PHDGAINMEMSIZE; i++ ) {
+ if ( state->gainMem[i] < PHDTHR1LTP ) {
+ i1++;
+ }
+ }
+
+ if ( i1 > 2 ) {
+ impNr = 0;
+ }
+ }
+
+ /* Restrict decrease in phase dispersion to one step if not onset */
+ if ( ( impNr > ( state->prevState + 1 ) ) & ( state->onset == 0 ) ) {
+ impNr--;
+ }
+
+ /* if onset, use one step less phase dispersion */
+ if ( ( impNr<2 )&( state->onset>0 ) ) {
+ impNr++;
+ }
+
+ /* disable for very low levels */
+ if ( cbGain < 10 ) {
+ impNr = 2;
+ }
+
+ if ( state->lockFull == 1 ) {
+ impNr = 0;
+ }
+
+ /* update static memory */
+ state->prevState = impNr;
+ state->prevCbGain = cbGain;
+
+ /*
+ * do phase dispersion for all modes but 12.2 and 7.4;
+ * don't modify the innovation if impNr >=2 (= no phase disp)
+ */
+ if ( ( mode != MR122 ) & ( mode != MR102 ) & ( mode != MR74 ) & ( impNr < 2 )
+ ) {
+ /*
+ * track pulse positions, save innovation,
+ * and initialize new innovation
+ */
+ nze = 0;
+
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ if ( inno[i] != 0 ) {
+ ps_poss[nze] = i;
+ nze++;
+ }
+ }
+ memcpy( inno_sav, inno, L_SUBFR <<2 );
+ memset( inno, 0, L_SUBFR <<2 );
+
+ /* Choose filter corresponding to codec mode and dispersion criterium */
+ ph_imp = ph_imp_mid;
+
+ if ( impNr == 0 ) {
+ ph_imp = ph_imp_low;
+ }
+
+ if ( mode == MR795 ) {
+ ph_imp = ph_imp_mid_MR795;
+
+ if ( impNr == 0 ) {
+ ph_imp = ph_imp_low_MR795;
+ }
+ }
+
+ /* Do phase dispersion of innovation */
+ for ( nPulse = 0; nPulse < nze; nPulse++ ) {
+ ppos = ps_poss[nPulse];
+
+ /* circular convolution with impulse response */
+ j = 0;
+
+ for ( i = ppos; i < L_SUBFR; i++ ) {
+ /* inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos] */
+ temp1 = ( inno_sav[ppos] * ph_imp[j++] ) >> 15;
+ inno[i] = inno[i] + temp1;
+ }
+
+ for ( i = 0; i < ppos; i++ ) {
+ /* inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i] */
+ temp1 = ( inno_sav[ppos] * ph_imp[j++] ) >> 15;
+ inno[i] = inno[i] + temp1;
+ }
+ }
+ }
+
+ /*
+ * compute total excitation for synthesis part of decoder
+ * (using modified innovation if phase dispersion is active)
+ */
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ /* x[i] = gain_pit*x[i] + cbGain*code[i]; */
+ temp1 = x[i] * pitch_fac + inno[i] * cbGain;
+ temp2 = temp1 << tmp_shift;
+ x[i] = ( temp2 + 0x4000 ) >> 15;
+ if (labs(x[i]) > 32767)
+ {
+ if ((temp1 ^ temp2) & 0x80000000) {
+ x[i] = (temp1 & 0x80000000) ? -32768: 32767;
+ }
+ else {
+ x[i] = (temp2 & 0x80000000) ? -32768: 32767;
+ }
+ }
+ }
+ return;
}
@@ -4329,39 +4041,37 @@ static void ph_disp(ph_dispState *state, enum Mode mode, Word32 x[],
* Returns:
* y output value
*/
-static Word32 sqrt_l_exp(Word32 x, Word32 *exp)
+static Word32 sqrt_l_exp( Word32 x, Word32 *exp )
{
- Word32 y, a, i, tmp;
- int e;
-
-
- if(x <= (Word32)0)
- {
- *exp = 0;
- return(Word32)0;
- }
- e = 0;
- if(x != 0)
- {
- tmp = x;
- while(!(tmp & 0x40000000))
- {
- e++;
- tmp = tmp << 1;
- }
- }
- e = e & 0xFFFE;
- x = (x << e);
- *exp = (Word16)e;
- x = (x >> 9);
- i = (Word16)(x >> 16);
- x = (x >> 1);
- a = x & (Word16)0x7fff;
- i = (i - 16);
- y = (sqrt_table[i] << 16);
- tmp = (sqrt_table[i] - sqrt_table[i + 1]);
- y -= (tmp * a) << 1;
- return(y);
+ Word32 y, a, i, tmp;
+ int e;
+
+
+ if ( x <= ( Word32 )0 ) {
+ *exp = 0;
+ return( Word32 )0;
+ }
+ e=0;
+ if (x != 0){
+ tmp = x;
+ while (!(tmp & 0x40000000))
+ {
+ e++;
+ tmp = tmp << 1;
+ }
+ }
+ e = e & 0xFFFE;
+ x = ( x << e );
+ *exp = ( Word16 )e;
+ x = ( x >> 9 );
+ i = ( Word16 )( x >> 16 );
+ x = ( x >> 1 );
+ a = x & ( Word16 )0x7fff;
+ i = ( i - 16 );
+ y = ( sqrt_table[i] << 16 );
+ tmp = ( sqrt_table[i] - sqrt_table[i + 1] );
+ y -= ( tmp * a ) << 1;
+ return( y );
}
@@ -4383,76 +4093,68 @@ static Word32 sqrt_l_exp(Word32 x, Word32 *exp)
* Returns:
* background noise decision; 0 = no bgn, 1 = bgn
*/
-static Word16 Ex_ctrl(Word32 excitation[], Word32 excEnergy, Word32
- exEnergyHist[], Word32 voicedHangover, Word16 prevBFI, Word16 carefulFlag
- )
+static Word16 Ex_ctrl( Word32 excitation[], Word32 excEnergy, Word32
+ exEnergyHist[], Word32 voicedHangover, Word16 prevBFI, Word16 carefulFlag
+ )
{
- Word32 i, testEnergy, scaleFactor, avgEnergy, prevEnergy, T0;
- int exp;
-
-
- /* get target level */
- avgEnergy = gmed_n(exEnergyHist, 9);
- prevEnergy = (exEnergyHist[7] + exEnergyHist[8]) >> 1;
-
- if(exEnergyHist[8] < prevEnergy)
- {
- prevEnergy = exEnergyHist[8];
- }
-
- /* upscaling to avoid too rapid energy rises for some cases */
- if((excEnergy<avgEnergy)&(excEnergy>5))
- {
- /* testEnergy = 4*prevEnergy; */
- testEnergy = prevEnergy << 2;
-
- if((voicedHangover < 7) || prevBFI != 0)
- {
- /* testEnergy = 3*prevEnergy */
- testEnergy = testEnergy - prevEnergy;
- }
-
- if(avgEnergy > testEnergy)
- {
- avgEnergy = testEnergy;
- }
-
- /* scaleFactor=avgEnergy/excEnergy in Q0 */
- exp = 0;
- if(excEnergy != 0)
- {
- while(!(excEnergy & 0x4000))
- {
- exp++;
- excEnergy = excEnergy << 1;
- }
- }
- excEnergy = 536838144 / excEnergy;
- T0 = (avgEnergy * excEnergy) << 1;
- T0 = (T0 >> (20 - exp));
-
- if(T0 > 32767)
- {
- /* saturate */
- T0 = 32767;
- }
- scaleFactor = T0;
-
- /* test if scaleFactor > 3.0 */
- if((carefulFlag != 0) & (scaleFactor > 3072))
- {
- scaleFactor = 3072;
- }
-
- /* scale the excitation by scaleFactor */
- for(i = 0; i < L_SUBFR; i++)
- {
- T0 = (scaleFactor * excitation[i]) << 1;
- T0 = (T0 >> 11);
- excitation[i] = T0;
- }
- }
- return 0;
+ Word32 i, testEnergy, scaleFactor, avgEnergy, prevEnergy, T0;
+ int exp;
+
+
+ /* get target level */
+ avgEnergy = gmed_n( exEnergyHist, 9 );
+ prevEnergy = ( exEnergyHist[7] + exEnergyHist[8] ) >> 1;
+
+ if ( exEnergyHist[8] < prevEnergy ) {
+ prevEnergy = exEnergyHist[8];
+ }
+
+ /* upscaling to avoid too rapid energy rises for some cases */
+ if ( ( excEnergy<avgEnergy )&( excEnergy>5 ) ) {
+ /* testEnergy = 4*prevEnergy; */
+ testEnergy = prevEnergy << 2;
+
+ if ( ( voicedHangover < 7 ) || prevBFI != 0 ) {
+ /* testEnergy = 3*prevEnergy */
+ testEnergy = testEnergy - prevEnergy;
+ }
+
+ if ( avgEnergy > testEnergy ) {
+ avgEnergy = testEnergy;
+ }
+
+ /* scaleFactor=avgEnergy/excEnergy in Q0 */
+ exp=0;
+ if (excEnergy != 0){
+ while (!(excEnergy & 0x4000))
+ {
+ exp++;
+ excEnergy = excEnergy << 1;
+ }
+ }
+ excEnergy = 536838144 / excEnergy;
+ T0 = ( avgEnergy * excEnergy ) << 1;
+ T0 = ( T0 >> ( 20 - exp ) );
+
+ if ( T0 > 32767 ) {
+ /* saturate */
+ T0 = 32767;
+ }
+ scaleFactor = T0;
+
+ /* test if scaleFactor > 3.0 */
+ if ( ( carefulFlag != 0 ) & ( scaleFactor > 3072 ) ) {
+ scaleFactor = 3072;
+ }
+
+ /* scale the excitation by scaleFactor */
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ T0 = ( scaleFactor * excitation[i] ) << 1;
+ T0 = ( T0 >> 11 );
+ excitation[i] = T0;
+ }
+ }
+ return 0;
}
@@ -4469,53 +4171,52 @@ static Word16 Ex_ctrl(Word32 excitation[], Word32 excEnergy, Word32
* Returns:
* y 1/sqrt(x)
*/
-static Word32 Inv_sqrt(Word32 x)
+static Word32 Inv_sqrt( Word32 x )
{
- int i, a, tmp, exp;
- Word32 y;
-
-
- if(x <= (Word32)0)
- return((Word32)0x3fffffffL);
- exp = 0;
- while(!(x & 0x40000000))
- {
- exp++;
- x = x << 1;
- }
-
- /* x is normalized */
- exp = (30 - exp);
-
- /* If exponent even -> shift right */
- if((exp & 1) == 0)
- {
- x = (x >> 1);
- }
- exp = (exp >> 1);
- exp = (exp + 1);
- x = (x >> 9);
-
- /* Extract b25-b31 */
- i = (Word16)(x >> 16);
-
- /* Extract b10-b24 */
- x = (x >> 1);
- a = x & (Word16)0x7fff;
- i = (i - 16);
-
- /* table[i] << 16 */
- y = inv_sqrt_table[i] << 16;
-
- /* table[i] - table[i+1]) */
- tmp = (inv_sqrt_table[i] - inv_sqrt_table[i + 1]);
-
- /* y -= tmp*a*2 */
- y -= (tmp * a) << 1;
-
- /* denormalization */
- y = (y >> exp);
- return(y);
+ int i, a, tmp, exp;
+ Word32 y;
+
+
+ if ( x <= ( Word32 )0 )
+ return( ( Word32 )0x3fffffffL );
+ exp=0;
+ while (!(x & 0x40000000))
+ {
+ exp++;
+ x = x << 1;
+ }
+
+ /* x is normalized */
+ exp = ( 30 - exp );
+
+ /* If exponent even -> shift right */
+ if ( ( exp & 1 ) == 0 ) {
+ x = ( x >> 1 );
+ }
+ exp = ( exp >> 1 );
+ exp = ( exp + 1 );
+ x = ( x >> 9 );
+
+ /* Extract b25-b31 */
+ i = ( Word16 )( x >> 16 );
+
+ /* Extract b10-b24 */
+ x = ( x >> 1 );
+ a = x & ( Word16 )0x7fff;
+ i = ( i - 16 );
+
+ /* table[i] << 16 */
+ y = inv_sqrt_table[i] << 16;
+
+ /* table[i] - table[i+1]) */
+ tmp = ( inv_sqrt_table[i] - inv_sqrt_table[i + 1] );
+
+ /* y -= tmp*a*2 */
+ y -= ( tmp * a ) << 1;
+
+ /* denormalization */
+ y = ( y >> exp );
+ return( y );
}
@@ -4532,36 +4233,34 @@ static Word32 Inv_sqrt(Word32 x)
* Returns:
* Energy
*/
-static Word32 energy_old(Word32 in[])
+static Word32 energy_old( Word32 in[] )
{
- Word32 temp, i, sum = 0;
-
-
- for(i = 0; i < L_SUBFR; i += 8)
- {
- temp = in[i] >> 2;
- sum += temp * temp;
- temp = in[i + 1] >> 2;
- sum += temp * temp;
- temp = in[i + 2] >> 2;
- sum += temp * temp;
- temp = in[i + 3] >> 2;
- sum += temp * temp;
- temp = in[i + 4] >> 2;
- sum += temp * temp;
- temp = in[i + 5] >> 2;
- sum += temp * temp;
- temp = in[i + 6] >> 2;
- sum += temp * temp;
- temp = in[i + 7] >> 2;
- sum += temp * temp;
- }
-
- if(sum & 0xC0000000)
- {
- return 0x7FFFFFFF;
- }
- return(sum << 1);
+ Word32 temp, i, sum = 0;
+
+
+ for ( i = 0; i < L_SUBFR; i += 8 ) {
+ temp = in[i] >> 2;
+ sum += temp * temp;
+ temp = in[i + 1] >> 2;
+ sum += temp * temp;
+ temp = in[i + 2] >> 2;
+ sum += temp * temp;
+ temp = in[i + 3] >> 2;
+ sum += temp * temp;
+ temp = in[i + 4] >> 2;
+ sum += temp * temp;
+ temp = in[i + 5] >> 2;
+ sum += temp * temp;
+ temp = in[i + 6] >> 2;
+ sum += temp * temp;
+ temp = in[i + 7] >> 2;
+ sum += temp * temp;
+ }
+
+ if ( sum & 0xC0000000 ) {
+ return 0x7FFFFFFF;
+ }
+ return( sum << 1 );
}
@@ -4578,35 +4277,31 @@ static Word32 energy_old(Word32 in[])
* Returns:
* Energy
*/
-static Word32 energy_new(Word32 in[])
+static Word32 energy_new( Word32 in[] )
{
- Word32 i, s = 0, overflow = 0;
-
- s += in[0] * in[0];
- for(i = 1; i < L_SUBFR; i += 3)
- {
- s += in[i] * in[i];
- s += in[i + 1] * in[i + 1];
- s += in[i + 2] * in[i + 2];
-
-
- if(s & 0xC0000000)
- {
- overflow = 1;
- break;
- }
- }
-
- /* check for overflow */
- if(overflow)
- {
- s = energy_old(in);
- }
- else
- {
- s = (s >> 3);
- }
- return s;
+ Word32 i, s = 0, overflow = 0;
+
+ s += in[0] * in[0];
+ for ( i = 1; i < L_SUBFR; i += 3 ) {
+ s += in[i] * in[i];
+ s += in[i + 1] *in[i + 1];
+ s += in[i + 2] * in[i + 2];
+
+
+ if ( s & 0xC0000000 ) {
+ overflow = 1;
+ break;
+ }
+ }
+
+ /* check for overflow */
+ if ( overflow ) {
+ s = energy_old( in );
+ }
+ else {
+ s = ( s >> 3 );
+ }
+ return s;
}
@@ -4624,72 +4319,68 @@ static Word32 energy_new(Word32 in[])
* Returns:
* Energy
*/
-static void agc2(Word32 *sig_in, Word32 *sig_out)
+static void agc2( Word32 *sig_in, Word32 *sig_out )
{
- Word32 s;
- int i, exp;
- Word16 gain_in, gain_out, g0;
-
-
- /* calculate gain_out with exponent */
- s = energy_new(sig_out);
-
- if(s == 0)
- {
- return;
- }
- exp = 0;
- while(!(s & 0x20000000))
- {
- exp++;
- s = s << 1;
- }
-
- gain_out = (Word16)((s + 0x00008000L) >> 16);
-
- /* calculate gain_in with exponent */
- s = energy_new(sig_in);
-
- if(s == 0)
- {
- g0 = 0;
- }
- else
- {
- i = 0;
- while(!(s & 0x40000000))
- {
- i++;
- s = s << 1;
- }
-
- if(s < 0x7fff7fff)
- gain_in = (Word16)((s + 0x00008000L) >> 16);
- else
- gain_in = 32767;
- exp = (exp - i);
+ Word32 s;
+ int i, exp;
+ Word16 gain_in, gain_out, g0;
+
+
+ /* calculate gain_out with exponent */
+ s = energy_new( sig_out );
+
+ if ( s == 0 ) {
+ return;
+ }
+ exp=0;
+ while (!(s & 0x20000000))
+ {
+ exp++;
+ s = s << 1;
+ }
+
+ gain_out = ( Word16 )( ( s + 0x00008000L ) >> 16 );
+
+ /* calculate gain_in with exponent */
+ s = energy_new( sig_in );
+
+ if ( s == 0 ) {
+ g0 = 0;
+ }
+ else {
+ i = 0;
+ while (!(s & 0x40000000))
+ {
+ i++;
+ s = s << 1;
+ }
+
+ if ( s < 0x7fff7fff )
+ gain_in = ( Word16 )( ( s + 0x00008000L ) >> 16 );
+ else
+ gain_in = 32767;
+ exp = ( exp - i );
/*
* g0 = sqrt(gain_in/gain_out);
*/
- /* s = gain_out / gain_in */
- s = (gain_out << 15) / gain_in;
- s = (s << 7);
-
- if(exp > 0)
- s = (s >> exp);
- else
- s = (s << (-exp));
- s = Inv_sqrt(s);
- g0 = (Word16)(((s << 9) + 0x00008000L) >> 16);
- }
-
- /* sig_out(n) = gain(n) * sig_out(n) */
- for(i = 0; i < L_SUBFR; i++)
- {
- sig_out[i] = (sig_out[i] * g0) >> 12;
- }
- return;
+ /* s = gain_out / gain_in */
+ s = ( gain_out << 15 ) / gain_in;
+ s = ( s << 7 );
+
+ if ( exp > 0 )
+ s = ( s >> exp );
+ else
+ s = ( s << ( -exp ) );
+ s = Inv_sqrt( s );
+ g0 = ( Word16 )( ( ( s << 9 ) + 0x00008000L ) >> 16 );
+ }
+
+ /* sig_out(n) = gain(n) * sig_out(n) */
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ sig_out[i] = ( sig_out[i] * g0 ) >> 12;
+ }
+ return;
}
@@ -4710,151 +4401,130 @@ static void agc2(Word32 *sig_in, Word32 *sig_out)
* Returns:
* inbgNoise background noise decision; 0 = no bgn, 1 = bgn
*/
-static Word16 Bgn_scd(Bgn_scdState *st, Word32 ltpGainHist[], Word32 speech[],
- Word32 *voicedHangover)
+static Word16 Bgn_scd( Bgn_scdState *st, Word32 ltpGainHist[], Word32 speech[],
+ Word32 *voicedHangover )
{
- Word32 temp, ltpLimit, frame_energyMin, currEnergy, noiseFloor, maxEnergy,
- maxEnergyLastPart, s, i;
- Word16 prevVoiced, inbgNoise;
-
-
- /*
- * Update the inBackgroundNoise flag (valid for use in next frame if BFI)
- * it now works as a energy detector floating on top
- * not as good as a VAD.
- */
- s = 0;
-
- for(i = 0; i < L_FRAME; i++)
- {
- s += speech[i] * speech[i];
- }
-
- if((s < 0xFFFFFFF) & (s >= 0))
- currEnergy = s >> 13;
- else
- currEnergy = 32767;
- frame_energyMin = 32767;
-
- for(i = 0; i < L_ENERGYHIST; i++)
- {
- if(st->frameEnergyHist[i] < frame_energyMin)
- frame_energyMin = st->frameEnergyHist[i];
- }
-
- /* Frame Energy Margin of 16 */
- noiseFloor = frame_energyMin << 4;
- maxEnergy = st->frameEnergyHist[0];
-
- for(i = 1; i < L_ENERGYHIST - 4; i++)
- {
- if(maxEnergy < st->frameEnergyHist[i])
- {
- maxEnergy = st->frameEnergyHist[i];
- }
- }
- maxEnergyLastPart = st->frameEnergyHist[2 * L_ENERGYHIST / 3];
-
- for(i = 2 * L_ENERGYHIST / 3 + 1; i < L_ENERGYHIST; i++)
- {
- if(maxEnergyLastPart < st->frameEnergyHist[i])
- {
- maxEnergyLastPart = st->frameEnergyHist[i];
- }
- }
-
- /* false */
- inbgNoise = 0;
-
- /*
- * Do not consider silence as noise
- * Do not consider continuous high volume as noise
- * Or if the current noise level is very low
- * Mark as noise if under current noise limit
- * OR if the maximum energy is below the upper limit
- */
- if((maxEnergy > LOWERNOISELIMIT)&(currEnergy < FRAMEENERGYLIMIT)&(
- currEnergy > LOWERNOISELIMIT) & ((currEnergy < noiseFloor) || (
- maxEnergyLastPart < UPPERNOISELIMIT)))
- {
- if((st->bgHangover + 1) > 30)
- {
- st->bgHangover = 30;
- }
- else
- {
- st->bgHangover += 1;
- }
- }
- else
- {
- st->bgHangover = 0;
- }
-
- /* make final decision about frame state, act somewhat cautiosly */
- if(st->bgHangover > 1)
- inbgNoise = 1; /* true */
-
- for(i = 0; i < L_ENERGYHIST - 1; i++)
- {
- st->frameEnergyHist[i] = st->frameEnergyHist[i + 1];
- }
- st->frameEnergyHist[L_ENERGYHIST - 1] = currEnergy;
-
- /*
- * prepare for voicing decision;
- * tighten the threshold after some time in noise
- */
- ltpLimit = 13926; /* 0.85 Q14 */
-
- if(st->bgHangover > 8)
- {
- ltpLimit = 15565; /* 0.95 Q14 */
- }
-
- if(st->bgHangover > 15)
- {
- ltpLimit = 16383; /* 1.00 Q14 */
- }
-
- /* weak sort of voicing indication. */
- prevVoiced = 0; /* false */
-
- if(gmed_n(&ltpGainHist[4], 5) > ltpLimit)
- {
- prevVoiced = 1; /* true */
- }
-
- if(st->bgHangover > 20)
- {
- if(gmed_n(ltpGainHist, 9) > ltpLimit)
- {
- prevVoiced = 1; /* true */
- }
- else
- {
- prevVoiced = 0; /* false */
- }
- }
-
- if(prevVoiced)
- {
- *voicedHangover = 0;
- }
- else
- {
- temp = *voicedHangover + 1;
-
- if(temp > 10)
- {
- *voicedHangover = 10;
- }
- else
- {
- *voicedHangover = temp;
- }
- }
- return inbgNoise;
+ Word32 temp, ltpLimit, frame_energyMin, currEnergy, noiseFloor, maxEnergy,
+ maxEnergyLastPart, s, i;
+ Word16 prevVoiced, inbgNoise;
+
+
+ /*
+ * Update the inBackgroundNoise flag (valid for use in next frame if BFI)
+ * it now works as a energy detector floating on top
+ * not as good as a VAD.
+ */
+ s = 0;
+
+ for ( i = 0; i < L_FRAME; i++ ) {
+ s += speech[i] * speech[i];
+ }
+
+ if ( (s < 0xFFFFFFF) & (s >= 0) )
+ currEnergy = s >> 13;
+ else
+ currEnergy = 32767;
+ frame_energyMin = 32767;
+
+ for ( i = 0; i < L_ENERGYHIST; i++ ) {
+ if ( st->frameEnergyHist[i] < frame_energyMin )
+ frame_energyMin = st->frameEnergyHist[i];
+ }
+
+ /* Frame Energy Margin of 16 */
+ noiseFloor = frame_energyMin << 4;
+ maxEnergy = st->frameEnergyHist[0];
+
+ for ( i = 1; i < L_ENERGYHIST - 4; i++ ) {
+ if ( maxEnergy < st->frameEnergyHist[i] ) {
+ maxEnergy = st->frameEnergyHist[i];
+ }
+ }
+ maxEnergyLastPart = st->frameEnergyHist[2 * L_ENERGYHIST / 3];
+
+ for ( i = 2 * L_ENERGYHIST / 3 + 1; i < L_ENERGYHIST; i++ ) {
+ if ( maxEnergyLastPart < st->frameEnergyHist[i] ) {
+ maxEnergyLastPart = st->frameEnergyHist[i];
+ }
+ }
+
+ /* false */
+ inbgNoise = 0;
+
+ /*
+ * Do not consider silence as noise
+ * Do not consider continuous high volume as noise
+ * Or if the current noise level is very low
+ * Mark as noise if under current noise limit
+ * OR if the maximum energy is below the upper limit
+ */
+ if ( ( maxEnergy> LOWERNOISELIMIT )&( currEnergy<FRAMEENERGYLIMIT )&(
+ currEnergy>LOWERNOISELIMIT ) & ( ( currEnergy < noiseFloor ) || (
+ maxEnergyLastPart < UPPERNOISELIMIT ) ) ) {
+ if ( ( st->bgHangover + 1 ) > 30 ) {
+ st->bgHangover = 30;
+ }
+ else {
+ st->bgHangover += 1;
+ }
+ }
+ else {
+ st->bgHangover = 0;
+ }
+
+ /* make final decision about frame state, act somewhat cautiosly */
+ if ( st->bgHangover > 1 )
+ inbgNoise = 1; /* true */
+
+ for ( i = 0; i < L_ENERGYHIST - 1; i++ ) {
+ st->frameEnergyHist[i] = st->frameEnergyHist[i + 1];
+ }
+ st->frameEnergyHist[L_ENERGYHIST - 1] = currEnergy;
+
+ /*
+ * prepare for voicing decision;
+ * tighten the threshold after some time in noise
+ */
+ ltpLimit = 13926; /* 0.85 Q14 */
+
+ if ( st->bgHangover > 8 ) {
+ ltpLimit = 15565; /* 0.95 Q14 */
+ }
+
+ if ( st->bgHangover > 15 ) {
+ ltpLimit = 16383; /* 1.00 Q14 */
+ }
+
+ /* weak sort of voicing indication. */
+ prevVoiced = 0; /* false */
+
+ if ( gmed_n( &ltpGainHist[4], 5 ) > ltpLimit ) {
+ prevVoiced = 1; /* true */
+ }
+
+ if ( st->bgHangover > 20 ) {
+ if ( gmed_n( ltpGainHist, 9 ) > ltpLimit ) {
+ prevVoiced = 1; /* true */
+ }
+ else {
+ prevVoiced = 0; /* false */
+ }
+ }
+
+ if ( prevVoiced ) {
+ *voicedHangover = 0;
+ }
+ else {
+ temp = *voicedHangover + 1;
+
+ if ( temp > 10 ) {
+ *voicedHangover = 10;
+ }
+ else {
+ *voicedHangover = temp;
+ }
+ }
+ return inbgNoise;
}
@@ -4874,54 +4544,51 @@ static Word16 Bgn_scd(Bgn_scdState *st, Word32 ltpGainHist[], Word32 speech[],
* Returns:
* void
*/
-static void dtx_dec_activity_update(dtx_decState *st, Word32 lsf[], Word32
- frame[])
+static void dtx_dec_activity_update( dtx_decState *st, Word32 lsf[], Word32
+ frame[] )
{
- Word32 frame_en;
- Word32 log_en_e, log_en_m, log_en, i;
+ Word32 frame_en;
+ Word32 log_en_e, log_en_m, log_en, i;
- /* update lsp history */
- st->lsf_hist_ptr += M;
+ /* update lsp history */
+ st->lsf_hist_ptr += M;
- if(st->lsf_hist_ptr == 80)
- {
- st->lsf_hist_ptr = 0;
- }
- memcpy(&st->lsf_hist[st->lsf_hist_ptr], lsf, M << 2);
+ if ( st->lsf_hist_ptr == 80 ) {
+ st->lsf_hist_ptr = 0;
+ }
+ memcpy( &st->lsf_hist[st->lsf_hist_ptr], lsf, M <<2 );
- /* compute log energy based on frame energy */
- frame_en = 0; /* Q0 */
+ /* compute log energy based on frame energy */
+ frame_en = 0; /* Q0 */
- for(i = 0; (i < L_FRAME); i ++)
- {
- frame_en += frame[i] * frame[i];
- if(frame_en & 0x80000000)
- break;
- }
+ for ( i = 0; (i < L_FRAME); i ++ ) {
+ frame_en += frame[i] * frame[i];
+ if (frame_en & 0x80000000)
+ break;
+ }
- log_en = (frame_en & 0xC0000000) ? 0x7FFFFFFE : (Word32)frame_en << 1;
+ log_en = (frame_en & 0xC0000000) ? 0x7FFFFFFE: (Word32)frame_en << 1;
- Log2(log_en , &log_en_e, &log_en_m);
+ Log2( log_en , &log_en_e, &log_en_m );
- /* convert exponent and mantissa to Word16 Q10 */
- log_en = log_en_e << 10; /* Q10 */
- log_en = log_en + (log_en_m >> 5);
+ /* convert exponent and mantissa to Word16 Q10 */
+ log_en = log_en_e << 10; /* Q10 */
+ log_en = log_en + ( log_en_m >> 5 );
- /* divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193 */
- log_en = log_en - 8521;
+ /* divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193 */
+ log_en = log_en - 8521;
- /*
- * insert into log energy buffer, no division by two as
- * log_en in decoder is Q11
- */
- st->log_en_hist_ptr += 1;
+ /*
+ * insert into log energy buffer, no division by two as
+ * log_en in decoder is Q11
+ */
+ st->log_en_hist_ptr += 1;
- if(st->log_en_hist_ptr == DTX_HIST_SIZE)
- {
- st->log_en_hist_ptr = 0;
- }
- st->log_en_hist[st->log_en_hist_ptr] = log_en; /* Q11 */
+ if ( st->log_en_hist_ptr == DTX_HIST_SIZE ) {
+ st->log_en_hist_ptr = 0;
+ }
+ st->log_en_hist[st->log_en_hist_ptr] = log_en; /* Q11 */
}
@@ -4943,475 +4610,421 @@ static void dtx_dec_activity_update(dtx_decState *st, Word32 lsf[], Word32
* Returns:
* void
*/
-static void Decoder_amr(Decoder_amrState *st, enum Mode mode, Word16 parm[],
- enum RXFrameType frame_type, Word32 synth[], Word32 A_t[])
+static void Decoder_amr( Decoder_amrState *st, enum Mode mode, Word16 parm[],
+ enum RXFrameType frame_type, Word32 synth[], Word32 A_t[] )
{
- /* LSPs */
- Word32 lsp_new[M];
- Word32 lsp_mid[M];
-
-
- /* LSFs */
- Word32 prev_lsf[M];
- Word32 lsf_i[M];
-
-
- /* Algebraic codevector */
- Word32 code[L_SUBFR];
-
-
- /* excitation */
- Word32 excp[L_SUBFR];
- Word32 exc_enhanced[L_SUBFR];
-
-
- /* Scalars */
- Word32 i, i_subfr, overflow, T0_frac, index, temp, temp2, subfrNr, excEnergy;
- Word32 gain_code, gain_code_mix, pit_sharp, pit_flag, pitch_fac, t0_min, t0_max;
- Word32 gain_pit = 0, evenSubfr = 0, T0 = 0, index_mr475 = 0;
- Word32 *Az; /* Pointer on A_t */
- Word16 flag4, carefulFlag;
- Word16 delta_frc_low, delta_frc_range, tmp_shift;
- Word16 bfi = 0, pdfi = 0;
- /* bad frame indication flag, potential degraded bad frame flag */
-
-
- enum DTXStateType newDTXState; /* SPEECH , DTX, DTX_MUTE */
-
- /* find the new DTX state SPEECH OR DTX */
- newDTXState = rx_dtx_handler(st->dtxDecoderState, frame_type);
-
- /* DTX actions */
- if(newDTXState != SPEECH)
- {
- Decoder_amr_reset(st, MRDTX);
- dtx_dec(st->dtxDecoderState, st->mem_syn, st->lsfState, st->pred_state,
- st->Cb_gain_averState, newDTXState, mode, parm, synth, A_t);
-
- /* update average lsp */
- Lsf_lsp(st->lsfState->past_lsf_q, st->lsp_old);
- lsp_avg(st->lsp_avg_st, st->lsfState->past_lsf_q);
- goto theEnd;
- }
-
- /* SPEECH action state machine */
- if(table_speech_bad[frame_type])
- {
- bfi = 1;
-
- if(frame_type != RX_SPEECH_BAD)
- {
- Build_CN_param(&st->nodataSeed, mode, parm);
- }
- }
- else if(frame_type == RX_SPEECH_DEGRADED)
- {
- pdfi = 1;
- }
-
- if(bfi != 0)
- {
- st->state += 1;
- }
- else if(st->state == 6)
- {
- st->state = 5;
- }
- else
- {
- st->state = 0;
- }
-
- if(st->state > 6)
- {
- st->state = 6;
- }
+ /* LSPs */
+ Word32 lsp_new[M];
+ Word32 lsp_mid[M];
- /*
- * If this frame is the first speech frame after CNI period,
- * set the BFH state machine to an appropriate state depending
- * on whether there was DTX muting before start of speech or not
- * If there was DTX muting, the first speech frame is muted.
- * If there was no DTX muting, the first speech frame is not
- * muted. The BFH state machine starts from state 5, however, to
- * keep the audible noise resulting from a SID frame which is
- * erroneously interpreted as a good speech frame as small as
- * possible (the decoder output in this case is quickly muted)
- */
- if(st->dtxDecoderState->dtxGlobalState == DTX)
- {
- st->state = 5;
- st->prev_bf = 0;
- }
- else if(st->dtxDecoderState->dtxGlobalState == DTX_MUTE)
- {
- st->state = 5;
- st->prev_bf = 1;
- }
-
- /* save old LSFs for CB gain smoothing */
- memcpy(prev_lsf, st->lsfState->past_lsf_q, M << 2);
- /*
- * decode LSF parameters and generate interpolated lpc coefficients
- * for the 4 subframes
- */
- if(mode != MR122)
- {
- D_plsf_3(st->lsfState, mode, bfi, parm, lsp_new);
-
- /* Advance synthesis parameters pointer */
- parm += 3;
- Int_lpc_1to3(st->lsp_old, lsp_new, A_t);
- }
- else
- {
- D_plsf_5(st->lsfState, bfi, parm, lsp_mid, lsp_new);
-
- /* Advance synthesis parameters pointer */
- parm += 5;
- Int_lpc_1and3(st->lsp_old, lsp_mid, lsp_new, A_t);
- }
-
- /* update the LSPs for the next frame */
- memcpy(st->lsp_old, lsp_new, M << 2);
+ /* LSFs */
+ Word32 prev_lsf[M];
+ Word32 lsf_i[M];
- /*
- * Loop for every subframe in the analysis frame
- *
- * The subframe size is L_SUBFR and the loop is repeated
- * L_FRAME/L_SUBFR times *
- * - decode the pitch delay
- * - decode algebraic code
- * - decode pitch and codebook gains
- * - find the excitation and compute synthesis speech
- */
- /* pointer to interpolated LPC parameters */
- Az = A_t;
- evenSubfr = 0;
- subfrNr = -1;
-
- for(i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
- {
- subfrNr += 1;
- evenSubfr = 1 - evenSubfr;
-
- /* flag for first and 3th subframe */
- pit_flag = i_subfr;
-
- if(i_subfr == L_FRAME_BY2)
- {
- if((mode != MR475) & (mode != MR515))
- {
- pit_flag = 0;
- }
- }
- /* pitch index */
- index = *parm++;
+ /* Algebraic codevector */
+ Word32 code[L_SUBFR];
- /*
- * decode pitch lag and find adaptive codebook vector.
- */
- if(mode != MR122)
- {
- /*
- * flag4 indicates encoding with 4 bit resolution;
- * this is needed for mode MR475, MR515, MR59 and MR67
- */
- flag4 = 0;
- if((mode == MR475) || (mode == MR515) || (mode == MR59) || (
- mode == MR67))
- {
- flag4 = 1;
- }
+ /* excitation */
+ Word32 excp[L_SUBFR];
+ Word32 exc_enhanced[L_SUBFR];
- /*
- * get ranges for the t0_min and t0_max
- * only needed in delta decoding
- */
- delta_frc_low = 5;
- delta_frc_range = 9;
- if(mode == MR795)
- {
- delta_frc_low = 10;
- delta_frc_range = 19;
- }
- t0_min = st->old_T0 - delta_frc_low;
+ /* Scalars */
+ Word32 i, i_subfr, overflow, T0_frac, index, temp, temp2, subfrNr, excEnergy;
+ Word32 gain_code, gain_code_mix, pit_sharp, pit_flag, pitch_fac, t0_min, t0_max;
+ Word32 gain_pit = 0, evenSubfr = 0, T0 = 0, index_mr475 = 0;
+ Word32 *Az; /* Pointer on A_t */
+ Word16 flag4, carefulFlag;
+ Word16 delta_frc_low, delta_frc_range, tmp_shift;
+ Word16 bfi = 0, pdfi = 0;
+ /* bad frame indication flag, potential degraded bad frame flag */
- if(t0_min < PIT_MIN)
- {
- t0_min = PIT_MIN;
- }
- t0_max = t0_min + delta_frc_range;
- if(t0_max > PIT_MAX)
- {
- t0_max = PIT_MAX;
- t0_min = t0_max - delta_frc_range;
- }
- Dec_lag3(index, t0_min, t0_max, pit_flag, st->old_T0, &T0, &T0_frac,
- flag4);
- st->T0_lagBuff = T0;
+ enum DTXStateType newDTXState; /* SPEECH , DTX, DTX_MUTE */
- if(bfi != 0)
- {
- if(st->old_T0 < PIT_MAX)
- {
- /* Graceful pitch degradation */
- st->old_T0 += 1;
- }
- T0 = st->old_T0;
- T0_frac = 0;
-
- if((st->inBackgroundNoise != 0) & (st->voicedHangover > 4) & (
- (mode == MR475) || (mode == MR515) || (mode == MR59)))
- {
- T0 = st->T0_lagBuff;
- }
- }
- Pred_lt_3or6_40(st->exc, T0, T0_frac, 1);
- }
- else
- {
- Dec_lag6(index, PIT_MIN_MR122, PIT_MAX, pit_flag, &T0, &T0_frac);
+ /* find the new DTX state SPEECH OR DTX */
+ newDTXState = rx_dtx_handler( st->dtxDecoderState, frame_type );
- if((bfi != 0) || ((pit_flag != 0) & (index > 60)))
- {
- st->T0_lagBuff = T0;
- T0 = st->old_T0;
- T0_frac = 0;
- }
- Pred_lt_3or6_40(st->exc, T0, T0_frac, 0);
- }
+ /* DTX actions */
+ if ( newDTXState != SPEECH ) {
+ Decoder_amr_reset( st, MRDTX );
+ dtx_dec( st->dtxDecoderState, st->mem_syn, st->lsfState, st->pred_state,
+ st->Cb_gain_averState, newDTXState, mode, parm, synth, A_t );
- /*
- * (MR122 only: Decode pitch gain.)
- * Decode innovative codebook.
- * set pitch sharpening factor
- */
- /* MR475, MR515 */
- if((mode == MR475) || (mode == MR515))
- {
- /* index of position */
- index = *parm++;
-
- /* signs */
- i = *parm++;
- decode_2i40_9bits(subfrNr, i, index, code);
- pit_sharp = st->sharp << 1;
- }
+ /* update average lsp */
+ Lsf_lsp( st->lsfState->past_lsf_q, st->lsp_old );
+ lsp_avg( st->lsp_avg_st, st->lsfState->past_lsf_q );
+ goto theEnd;
+ }
- /* MR59 */
- else if(mode == MR59)
- {
- /* index of position */
- index = *parm++;
+ /* SPEECH action state machine */
+ if ( table_speech_bad[frame_type] ) {
+ bfi = 1;
- /* signs */
- i = *parm++;
- decode_2i40_11bits(i, index, code);
- pit_sharp = st->sharp << 1;
- }
+ if ( frame_type != RX_SPEECH_BAD ) {
+ Build_CN_param( &st->nodataSeed, mode, parm );
+ }
+ }
+ else if ( frame_type == RX_SPEECH_DEGRADED ) {
+ pdfi = 1;
+ }
- /* MR67 */
- else if(mode == MR67)
- {
- /* index of position */
- index = *parm++;
+ if ( bfi != 0 ) {
+ st->state += 1;
+ }
+ else if ( st->state == 6 ) {
+ st->state = 5;
+ }
+ else {
+ st->state = 0;
+ }
- /* signs */
- i = *parm++;
- decode_3i40_14bits(i, index, code);
- pit_sharp = st->sharp << 1;
- }
+ if ( st->state > 6 ) {
+ st->state = 6;
+ }
- /* MR74, MR795 */
- else if(mode <= MR795)
- {
- /* index of position */
- index = *parm++;
-
- /* signs */
- i = *parm++;
- decode_4i40_17bits(i, index, code);
- pit_sharp = st->sharp << 1;
- }
-
- /* MR102 */
- else if(mode == MR102)
- {
- decode_8i40_31bits(parm, code);
- parm += 7;
- pit_sharp = st->sharp << 1;
- }
-
- /* MR122 */
- else
- {
- index = *parm++;
+ /*
+ * If this frame is the first speech frame after CNI period,
+ * set the BFH state machine to an appropriate state depending
+ * on whether there was DTX muting before start of speech or not
+ * If there was DTX muting, the first speech frame is muted.
+ * If there was no DTX muting, the first speech frame is not
+ * muted. The BFH state machine starts from state 5, however, to
+ * keep the audible noise resulting from a SID frame which is
+ * erroneously interpreted as a good speech frame as small as
+ * possible (the decoder output in this case is quickly muted)
+ */
+ if ( st->dtxDecoderState->dtxGlobalState == DTX ) {
+ st->state = 5;
+ st->prev_bf = 0;
+ }
+ else if ( st->dtxDecoderState->dtxGlobalState == DTX_MUTE ) {
+ st->state = 5;
+ st->prev_bf = 1;
+ }
+
+ /* save old LSFs for CB gain smoothing */
+ memcpy( prev_lsf, st->lsfState->past_lsf_q, M <<2 );
- if(bfi != 0)
- {
- ec_gain_pitch(st->ec_gain_p_st, st->state, &gain_pit);
+ /*
+ * decode LSF parameters and generate interpolated lpc coefficients
+ * for the 4 subframes
+ */
+ if ( mode != MR122 ) {
+ D_plsf_3( st->lsfState, mode, bfi, parm, lsp_new );
+
+ /* Advance synthesis parameters pointer */
+ parm += 3;
+ Int_lpc_1to3( st->lsp_old, lsp_new, A_t );
+ }
+ else {
+ D_plsf_5( st->lsfState, bfi, parm, lsp_mid, lsp_new );
+
+ /* Advance synthesis parameters pointer */
+ parm += 5;
+ Int_lpc_1and3( st->lsp_old, lsp_mid, lsp_new, A_t );
+ }
+
+ /* update the LSPs for the next frame */
+ memcpy( st->lsp_old, lsp_new, M <<2 );
+
+ /*
+ * Loop for every subframe in the analysis frame
+ *
+ * The subframe size is L_SUBFR and the loop is repeated
+ * L_FRAME/L_SUBFR times *
+ * - decode the pitch delay
+ * - decode algebraic code
+ * - decode pitch and codebook gains
+ * - find the excitation and compute synthesis speech
+ */
+ /* pointer to interpolated LPC parameters */
+ Az = A_t;
+ evenSubfr = 0;
+ subfrNr = -1;
+
+ for ( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) {
+ subfrNr += 1;
+ evenSubfr = 1 - evenSubfr;
+
+ /* flag for first and 3th subframe */
+ pit_flag = i_subfr;
+
+ if ( i_subfr == L_FRAME_BY2 ) {
+ if ( ( mode != MR475 ) & ( mode != MR515 ) ) {
+ pit_flag = 0;
+ }
+ }
+
+ /* pitch index */
+ index = *parm++;
+
+ /*
+ * decode pitch lag and find adaptive codebook vector.
+ */
+ if ( mode != MR122 ) {
+ /*
+ * flag4 indicates encoding with 4 bit resolution;
+ * this is needed for mode MR475, MR515, MR59 and MR67
+ */
+ flag4 = 0;
+
+ if ( ( mode == MR475 ) || ( mode == MR515 ) || ( mode == MR59 ) || (
+ mode == MR67 ) ) {
+ flag4 = 1;
+ }
+
+ /*
+ * get ranges for the t0_min and t0_max
+ * only needed in delta decoding
+ */
+ delta_frc_low = 5;
+ delta_frc_range = 9;
+
+ if ( mode == MR795 ) {
+ delta_frc_low = 10;
+ delta_frc_range = 19;
+ }
+ t0_min = st->old_T0 - delta_frc_low;
+
+ if ( t0_min < PIT_MIN ) {
+ t0_min = PIT_MIN;
+ }
+ t0_max = t0_min + delta_frc_range;
+
+ if ( t0_max > PIT_MAX ) {
+ t0_max = PIT_MAX;
+ t0_min = t0_max - delta_frc_range;
+ }
+ Dec_lag3( index, t0_min, t0_max, pit_flag, st->old_T0, &T0, &T0_frac,
+ flag4 );
+ st->T0_lagBuff = T0;
+
+ if ( bfi != 0 ) {
+ if ( st->old_T0 < PIT_MAX ) {
+ /* Graceful pitch degradation */
+ st->old_T0 += 1;
}
- else
+ T0 = st->old_T0;
+ T0_frac = 0;
+
+ if ( ( st->inBackgroundNoise != 0 ) & ( st->voicedHangover > 4 ) & (
+ ( mode == MR475 ) || ( mode == MR515 ) || ( mode == MR59 ) ) )
{
- gain_pit = d_gain_pitch(mode, index);
+ T0 = st->T0_lagBuff;
}
- ec_gain_pitch_update(st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit);
- decode_10i40_35bits(parm, code);
- parm += 10;
+ }
+ Pred_lt_3or6_40( st->exc, T0, T0_frac, 1 );
+ }
+ else {
+ Dec_lag6( index, PIT_MIN_MR122, PIT_MAX, pit_flag, &T0, &T0_frac );
- /*
- * pit_sharp = gain_pit;
- * if (pit_sharp > 1.0) pit_sharp = 1.0;
- */
- pit_sharp = gain_pit;
-
- if(pit_sharp > 16383)
- pit_sharp = 32767;
- else
- pit_sharp *= 2;
- }
+ if ( ( bfi != 0 ) || ( ( pit_flag != 0 ) & ( index > 60 ) ) ) {
+ st->T0_lagBuff = T0;
+ T0 = st->old_T0;
+ T0_frac = 0;
+ }
+ Pred_lt_3or6_40( st->exc, T0, T0_frac, 0 );
+ }
+
+ /*
+ * (MR122 only: Decode pitch gain.)
+ * Decode innovative codebook.
+ * set pitch sharpening factor
+ */
+ /* MR475, MR515 */
+ if ( ( mode == MR475 ) || ( mode == MR515 ) ) {
+ /* index of position */
+ index = *parm++;
+
+ /* signs */
+ i = *parm++;
+ decode_2i40_9bits( subfrNr, i, index, code );
+ pit_sharp = st->sharp << 1;
+ }
+
+ /* MR59 */
+ else if ( mode == MR59 ) {
+ /* index of position */
+ index = *parm++;
+
+ /* signs */
+ i = *parm++;
+ decode_2i40_11bits( i, index, code );
+ pit_sharp = st->sharp << 1;
+ }
+
+ /* MR67 */
+ else if ( mode == MR67 ) {
+ /* index of position */
+ index = *parm++;
+
+ /* signs */
+ i = *parm++;
+ decode_3i40_14bits( i, index, code );
+ pit_sharp = st->sharp << 1;
+ }
+
+ /* MR74, MR795 */
+ else if ( mode <= MR795 ) {
+ /* index of position */
+ index = *parm++;
+
+ /* signs */
+ i = *parm++;
+ decode_4i40_17bits( i, index, code );
+ pit_sharp = st->sharp << 1;
+ }
+
+ /* MR102 */
+ else if ( mode == MR102 ) {
+ decode_8i40_31bits( parm, code );
+ parm += 7;
+ pit_sharp = st->sharp << 1;
+ }
+
+ /* MR122 */
+ else {
+ index = *parm++;
+
+ if ( bfi != 0 ) {
+ ec_gain_pitch( st->ec_gain_p_st, st->state, &gain_pit );
+ }
+ else {
+ gain_pit = d_gain_pitch( mode, index );
+ }
+ ec_gain_pitch_update( st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit );
+ decode_10i40_35bits( parm, code );
+ parm += 10;
+
+ /*
+ * pit_sharp = gain_pit;
+ * if (pit_sharp > 1.0) pit_sharp = 1.0;
+ */
+ pit_sharp = gain_pit;
+
+ if ( pit_sharp > 16383 )
+ pit_sharp = 32767;
+ else
+ pit_sharp *= 2;
+ }
/*
* Add the pitch contribution to code[].
*/
- for(i = T0; i < L_SUBFR; i++)
- {
- temp = (code[i - T0] * pit_sharp) >> 15;
- code[i] = code[i] + temp;
- }
+ for ( i = T0; i < L_SUBFR; i++ ) {
+ temp = ( code[i - T0] * pit_sharp ) >> 15;
+ code[i] = code[i] + temp;
+ }
/*
* Decode codebook gain (MR122) or both pitch
* gain and codebook gain (all others)
* Update pitch sharpening "sharp" with quantized gain_pit
*/
- if(mode == MR475)
- {
- /* read and decode pitch and code gain */
- if(evenSubfr != 0)
- {
- /* index of gain(s) */
- index_mr475 = *parm++;
+ if ( mode == MR475 ) {
+ /* read and decode pitch and code gain */
+ if ( evenSubfr != 0 ) {
+ /* index of gain(s) */
+ index_mr475 = *parm++;
+ }
+
+ if ( bfi == 0 ) {
+ Dec_gain( st->pred_state, mode, index_mr475, code, evenSubfr, &
+ gain_pit, &gain_code );
+ }
+ else {
+ ec_gain_pitch( st->ec_gain_p_st, st->state, &gain_pit );
+ ec_gain_code( st->ec_gain_c_st, st->pred_state, st->state, &
+ gain_code );
+ }
+ ec_gain_pitch_update( st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit );
+ ec_gain_code_update( st->ec_gain_c_st, bfi, st->prev_bf, &gain_code );
+ pit_sharp = gain_pit;
+
+ if ( pit_sharp > SHARPMAX ) {
+ pit_sharp = SHARPMAX;
+ }
+ }
+ else if ( ( mode <= MR74 ) || ( mode == MR102 ) ) {
+ /* read and decode pitch and code gain */
+ /* index of gain(s) */
+ index = *parm++;
+
+ if ( bfi == 0 ) {
+ Dec_gain( st->pred_state, mode, index, code, evenSubfr, &gain_pit, &
+ gain_code );
+ }
+ else {
+ ec_gain_pitch( st->ec_gain_p_st, st->state, &gain_pit );
+ ec_gain_code( st->ec_gain_c_st, st->pred_state, st->state, &
+ gain_code );
+ }
+ ec_gain_pitch_update( st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit );
+ ec_gain_code_update( st->ec_gain_c_st, bfi, st->prev_bf, &gain_code );
+ pit_sharp = gain_pit;
+
+ if ( pit_sharp > SHARPMAX ) {
+ pit_sharp = SHARPMAX;
+ }
+
+ if ( mode == MR102 ) {
+ if ( st->old_T0 > ( L_SUBFR + 5 ) ) {
+ pit_sharp = pit_sharp >> 2;
}
-
- if(bfi == 0)
- {
- Dec_gain(st->pred_state, mode, index_mr475, code, evenSubfr, &
- gain_pit, &gain_code);
+ }
+ }
+ else {
+ /* read and decode pitch gain */
+ /* index of gain(s) */
+ index = *parm++;
+
+ if ( mode == MR795 ) {
+ /* decode pitch gain */
+ if ( bfi != 0 ) {
+ ec_gain_pitch( st->ec_gain_p_st, st->state, &gain_pit );
}
- else
- {
- ec_gain_pitch(st->ec_gain_p_st, st->state, &gain_pit);
- ec_gain_code(st->ec_gain_c_st, st->pred_state, st->state, &
- gain_code);
+ else {
+ gain_pit = d_gain_pitch( mode, index );
}
- ec_gain_pitch_update(st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit);
- ec_gain_code_update(st->ec_gain_c_st, bfi, st->prev_bf, &gain_code);
- pit_sharp = gain_pit;
+ ec_gain_pitch_update( st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit
+ );
- if(pit_sharp > SHARPMAX)
- {
- pit_sharp = SHARPMAX;
- }
- }
- else if((mode <= MR74) || (mode == MR102))
- {
- /* read and decode pitch and code gain */
- /* index of gain(s) */
+ /* read and decode code gain */
index = *parm++;
- if(bfi == 0)
- {
- Dec_gain(st->pred_state, mode, index, code, evenSubfr, &gain_pit, &
- gain_code);
+ if ( bfi == 0 ) {
+ d_gain_code( st->pred_state, mode, index, code, &gain_code );
}
- else
- {
- ec_gain_pitch(st->ec_gain_p_st, st->state, &gain_pit);
- ec_gain_code(st->ec_gain_c_st, st->pred_state, st->state, &
- gain_code);
+ else {
+ ec_gain_code( st->ec_gain_c_st, st->pred_state, st->state, &
+ gain_code );
}
- ec_gain_pitch_update(st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit);
- ec_gain_code_update(st->ec_gain_c_st, bfi, st->prev_bf, &gain_code);
+ ec_gain_code_update( st->ec_gain_c_st, bfi, st->prev_bf, &gain_code
+ );
pit_sharp = gain_pit;
- if(pit_sharp > SHARPMAX)
- {
- pit_sharp = SHARPMAX;
- }
-
- if(mode == MR102)
- {
- if(st->old_T0 > (L_SUBFR + 5))
- {
- pit_sharp = pit_sharp >> 2;
- }
+ if ( pit_sharp > SHARPMAX ) {
+ pit_sharp = SHARPMAX;
}
- }
- else
- {
- /* read and decode pitch gain */
- /* index of gain(s) */
- index = *parm++;
+ }
+ else { /* MR122 */
- if(mode == MR795)
- {
- /* decode pitch gain */
- if(bfi != 0)
- {
- ec_gain_pitch(st->ec_gain_p_st, st->state, &gain_pit);
- }
- else
- {
- gain_pit = d_gain_pitch(mode, index);
- }
- ec_gain_pitch_update(st->ec_gain_p_st, bfi, st->prev_bf, &gain_pit
- );
-
- /* read and decode code gain */
- index = *parm++;
-
- if(bfi == 0)
- {
- d_gain_code(st->pred_state, mode, index, code, &gain_code);
- }
- else
- {
- ec_gain_code(st->ec_gain_c_st, st->pred_state, st->state, &
- gain_code);
- }
- ec_gain_code_update(st->ec_gain_c_st, bfi, st->prev_bf, &gain_code
- );
- pit_sharp = gain_pit;
-
- if(pit_sharp > SHARPMAX)
- {
- pit_sharp = SHARPMAX;
- }
+ if ( bfi == 0 ) {
+ d_gain_code( st->pred_state, mode, index, code, &gain_code );
}
- else /* MR122 */
- {
-
- if(bfi == 0)
- {
- d_gain_code(st->pred_state, mode, index, code, &gain_code);
- }
- else
- {
- ec_gain_code(st->ec_gain_c_st, st->pred_state, st->state, &
- gain_code);
- }
- ec_gain_code_update(st->ec_gain_c_st, bfi, st->prev_bf, &gain_code
- );
- pit_sharp = gain_pit;
+ else {
+ ec_gain_code( st->ec_gain_c_st, st->pred_state, st->state, &
+ gain_code );
}
- }
+ ec_gain_code_update( st->ec_gain_c_st, bfi, st->prev_bf, &gain_code
+ );
+ pit_sharp = gain_pit;
+ }
+ }
/*
* store pitch sharpening for next subframe
@@ -5419,277 +5032,244 @@ static void Decoder_amr(Decoder_amrState *st, enum Mode mode, Word16 parm[],
* pitch sharpening in the search phase)
* do not update sharpening in even subframes for MR475
*/
- if((mode != MR475) || evenSubfr == 0)
- {
- st->sharp = gain_pit;
-
- if(st->sharp > SHARPMAX)
- {
- st->sharp = SHARPMAX;
+ if ( ( mode != MR475 ) || evenSubfr == 0 ) {
+ st->sharp = gain_pit;
+
+ if ( st->sharp > SHARPMAX ) {
+ st->sharp = SHARPMAX;
+ }
+ }
+
+ if ( pit_sharp > 16383 )
+ pit_sharp = 32767;
+ else
+ pit_sharp *= 2;
+
+ if ( pit_sharp > 16384 ) {
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ temp = ( st->exc[i] * pit_sharp ) >> 15;
+ temp2 = ( temp * gain_pit ) << 1;
+
+ if ( mode == MR122 ) {
+ temp2 = ( temp2 >> 1 );
}
- }
-
- if(pit_sharp > 16383)
- pit_sharp = 32767;
- else
- pit_sharp *= 2;
-
- if(pit_sharp > 16384)
- {
- for(i = 0; i < L_SUBFR; i++)
- {
- temp = (st->exc[i] * pit_sharp) >> 15;
- temp2 = (temp * gain_pit) << 1;
-
- if(mode == MR122)
- {
- temp2 = (temp2 >> 1);
- }
- excp[i] = (temp2 + 0x00008000L) >> 16;
- }
- }
+ excp[i] = ( temp2 + 0x00008000L ) >> 16;
+ }
+ }
/*
* Store list of LTP gains needed in the source
* characteristic detector (SCD)
*/
- if(bfi == 0)
- {
- for(i = 0; i < 8; i++)
- {
- st->ltpGainHistory[i] = st->ltpGainHistory[i+1];
- }
- st->ltpGainHistory[8] = gain_pit;
- }
+ if ( bfi == 0 ) {
+ for (i = 0; i < 8; i++){
+ st->ltpGainHistory[i] = st->ltpGainHistory[i+1];
+ }
+ st->ltpGainHistory[8] = gain_pit;
+ }
/*
* Limit gain_pit if in background noise and BFI
* for MR475, MR515, MR59
*/
- if((st->prev_bf != 0 || bfi != 0) & (st->inBackgroundNoise != 0) & (
- (mode == MR475) || (mode == MR515) || (mode == MR59)))
- {
- /* if (gain_pit > 0.75) in Q14*/
- if(gain_pit > 12288)
- /* gain_pit = (gain_pit-0.75)/2.0 + 0.75; */
- gain_pit = ((gain_pit - 12288) >> 1) + 12288;
-
- /* if (gain_pit > 0.90) in Q14*/
- if(gain_pit > 14745)
- {
- gain_pit = 14745;
- }
- }
+ if ( ( st->prev_bf != 0 || bfi != 0 ) & ( st->inBackgroundNoise != 0 ) & (
+ ( mode == MR475 ) || ( mode == MR515 ) || ( mode == MR59 ) ) ) {
+ /* if (gain_pit > 0.75) in Q14*/
+ if ( gain_pit > 12288 )
+ /* gain_pit = (gain_pit-0.75)/2.0 + 0.75; */
+ gain_pit = ( ( gain_pit - 12288 ) >> 1 ) + 12288;
+
+ /* if (gain_pit > 0.90) in Q14*/
+ if ( gain_pit > 14745 ) {
+ gain_pit = 14745;
+ }
+ }
/*
* Calculate CB mixed gain
*/
- Int_lsf(prev_lsf, st->lsfState->past_lsf_q, i_subfr, lsf_i);
- gain_code_mix = Cb_gain_average(st->Cb_gain_averState, mode, gain_code,
- lsf_i, st->lsp_avg_st->lsp_meanSave, bfi, st->prev_bf, pdfi, st->
- prev_pdf, st->inBackgroundNoise, st->voicedHangover);
-
- /* make sure that MR74, MR795, MR122 have original codeGain*/
- /* MR74, MR795, MR122 */
- if((mode > MR67) & (mode != MR102))
- {
- gain_code_mix = gain_code;
- }
+ Int_lsf( prev_lsf, st->lsfState->past_lsf_q, i_subfr, lsf_i );
+ gain_code_mix = Cb_gain_average( st->Cb_gain_averState, mode, gain_code,
+ lsf_i, st->lsp_avg_st->lsp_meanSave, bfi, st->prev_bf, pdfi, st->
+ prev_pdf, st->inBackgroundNoise, st->voicedHangover );
+
+ /* make sure that MR74, MR795, MR122 have original codeGain*/
+ /* MR74, MR795, MR122 */
+ if ( ( mode > MR67 ) & ( mode != MR102 ) ) {
+ gain_code_mix = gain_code;
+ }
/*
* Find the total excitation.
* Find synthesis speech corresponding to st->exc[].
*/
- /* MR475, MR515, MR59, MR67, MR74, MR795, MR102*/
- if(mode <= MR102)
- {
- pitch_fac = gain_pit;
- tmp_shift = 1;
- }
-
- /* MR122 */
- else
- {
- pitch_fac = gain_pit >> 1;
- tmp_shift = 2;
- }
+ /* MR475, MR515, MR59, MR67, MR74, MR795, MR102*/
+ if ( mode <= MR102 ) {
+ pitch_fac = gain_pit;
+ tmp_shift = 1;
+ }
+
+ /* MR122 */
+ else {
+ pitch_fac = gain_pit >> 1;
+ tmp_shift = 2;
+ }
/*
* copy unscaled LTP excitation to exc_enhanced (used in phase
* dispersion below) and compute total excitation for LTP feedback
*/
- memcpy(exc_enhanced, st->exc, L_SUBFR << 2);
-
- for(i = 0; i < L_SUBFR; i++)
- {
- /* st->exc[i] = gain_pit*st->exc[i] + gain_code*code[i]; */
- temp = (st->exc[i] * pitch_fac) + (code[i] * gain_code);
- temp2 = (temp << tmp_shift);
- if(((temp2 >> 1) ^ temp2) & 0x40000000)
- {
- if((temp ^ temp2) & 0x80000000)
- {
- temp2 = (temp & 0x80000000) ? (-1073741824L) : 1073725439;
- }
- else
- {
- temp2 = (temp2 & 0x80000000) ? (-1073741824L) : 1073725439;
- }
+ memcpy( exc_enhanced, st->exc, L_SUBFR <<2 );
+
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ /* st->exc[i] = gain_pit*st->exc[i] + gain_code*code[i]; */
+ temp = ( st->exc[i] * pitch_fac ) + ( code[i] * gain_code );
+ temp2 = ( temp << tmp_shift );
+ if (((temp2 >> 1) ^ temp2) & 0x40000000) {
+ if ((temp ^ temp2) & 0x80000000) {
+ temp2 = (temp & 0x80000000) ? (-1073741824L) : 1073725439;
}
- st->exc[i] = (temp2 + 0x00004000L) >> 15;
- }
- /*
- * Adaptive phase dispersion
- */
-
- /* free phase dispersion adaption */
- st->ph_disp_st->lockFull = 0;
-
- if(((mode == MR475) || (mode == MR515) || (mode == MR59)) & (st
- ->voicedHangover > 3) & (st->inBackgroundNoise != 0) & (bfi != 0
- ))
- {
- /*
- * Always Use full Phase Disp.
- * if error in bg noise
- */
- st->ph_disp_st->lockFull = 1;
- }
+ else {
+ temp2 = (temp2 & 0x80000000) ? (-1073741824L) : 1073725439;
+ }
+ }
+ st->exc[i] = ( temp2 + 0x00004000L ) >> 15;
+ }
+ /*
+ * Adaptive phase dispersion
+ */
+
+ /* free phase dispersion adaption */
+ st->ph_disp_st->lockFull = 0;
+
+ if ( ( ( mode == MR475 ) || ( mode == MR515 ) || ( mode == MR59 ) ) & ( st
+ ->voicedHangover > 3 ) & ( st->inBackgroundNoise != 0 ) & ( bfi != 0
+ ) ) {
+ /*
+ * Always Use full Phase Disp.
+ * if error in bg noise
+ */
+ st->ph_disp_st->lockFull = 1;
+ }
/*
* apply phase dispersion to innovation (if enabled) and
* compute total excitation for synthesis part
*/
- ph_disp(st->ph_disp_st, mode, exc_enhanced, gain_code_mix, gain_pit, code
- , pitch_fac, tmp_shift);
+ ph_disp( st->ph_disp_st, mode, exc_enhanced, gain_code_mix, gain_pit, code
+ , pitch_fac, tmp_shift );
/*
* The Excitation control module are active during BFI.
* Conceal drops in signal energy if in bg noise.
*/
- temp2 = 0;
-
- for(i = 0; i < L_SUBFR; i++)
- {
- temp2 += (exc_enhanced[i] * exc_enhanced[i]);
- }
-
- if(temp2 > 0x3FFFFFFF)
- {
- excEnergy = 11584;
- }
- else
- {
- temp2 = sqrt_l_exp(temp2, &temp);
- temp2 = (temp2 >> ((temp >> 1) + 15));
- excEnergy = temp2 >> 2;
- }
-
- if(((mode == MR475) || (mode == MR515) || (mode == MR59)) & (st
- ->voicedHangover > 5) & (st->inBackgroundNoise != 0) & (st->
- state < 4) & (((pdfi != 0) & (st->prev_pdf != 0)) || bfi !=
- 0 || st->prev_bf != 0))
- {
- carefulFlag = 0;
-
- if((pdfi != 0) & (bfi == 0))
- {
- carefulFlag = 1;
- }
- Ex_ctrl(exc_enhanced, excEnergy, st->excEnergyHist, st->voicedHangover
- , st->prev_bf, carefulFlag);
- }
-
- if((st->inBackgroundNoise != 0) & (bfi != 0 || st->prev_bf != 0) & (
- st->state < 4))
- {
- ; /* do nothing! */
- }
- else
- {
- /* Update energy history for all modes */
- for(i = 0; i < 8; i++)
- {
- st->excEnergyHist[i] = st->excEnergyHist[i+1];
- }
- st->excEnergyHist[8] = excEnergy;
- }
+ temp2 = 0;
+
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ temp2 += ( exc_enhanced[i] * exc_enhanced[i] );
+ }
+
+ if ( temp2 > 0x3FFFFFFF ) {
+ excEnergy = 11584;
+ }
+ else {
+ temp2 = sqrt_l_exp( temp2, &temp );
+ temp2 = ( temp2 >> ( ( temp >> 1 ) + 15 ) );
+ excEnergy = temp2 >> 2;
+ }
+
+ if ( ( ( mode == MR475 ) || ( mode == MR515 ) || ( mode == MR59 ) ) & ( st
+ ->voicedHangover > 5 ) & ( st->inBackgroundNoise != 0 ) & ( st->
+ state < 4 ) & ( ( ( pdfi != 0 ) & ( st->prev_pdf != 0 ) ) || bfi !=
+ 0 || st->prev_bf != 0 ) ) {
+ carefulFlag = 0;
+
+ if ( ( pdfi != 0 ) & ( bfi == 0 ) ) {
+ carefulFlag = 1;
+ }
+ Ex_ctrl( exc_enhanced, excEnergy, st->excEnergyHist, st->voicedHangover
+ , st->prev_bf, carefulFlag );
+ }
+
+ if ( ( st->inBackgroundNoise != 0 ) & ( bfi != 0 || st->prev_bf != 0 ) & (
+ st->state < 4 ) ) {; /* do nothing! */
+ }
+ else {
+ /* Update energy history for all modes */
+ for (i = 0; i < 8; i++){
+ st->excEnergyHist[i] = st->excEnergyHist[i+1];
+ }
+ st->excEnergyHist[8] = excEnergy;
+ }
/*
* Excitation control module end.
*/
- if(pit_sharp > 16384)
- {
- for(i = 0; i < L_SUBFR; i++)
- {
- excp[i] = excp[i] + exc_enhanced[i];
- if(labs(excp[i]) > 32767)
- excp[i] = (excp[i] & 0x80000000) ? -32768 : 32767;
- }
- agc2(exc_enhanced, excp);
- overflow = Syn_filt(Az, excp, &synth[i_subfr], L_SUBFR, st->mem_syn, 0
- );
- }
- else
- {
- overflow = Syn_filt(Az, exc_enhanced, &synth[i_subfr], L_SUBFR, st->
- mem_syn, 0);
- }
-
- if(overflow)
- {
- for(i = 0; i < PIT_MAX + L_INTERPOL + L_SUBFR; i++)
- {
- st->old_exc[i] = st->old_exc[i] >> 2;
- }
-
- for(i = 0; i < L_SUBFR; i++)
- {
- exc_enhanced[i] = exc_enhanced[i] >> 2;
- }
- Syn_filt_overflow(Az, exc_enhanced, &synth[i_subfr], L_SUBFR, st->mem_syn, 1);
- }
- else
- {
- memcpy(st->mem_syn, &synth[i_subfr + 30], 40);
- }
+ if ( pit_sharp > 16384 ) {
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ excp[i] = excp[i] + exc_enhanced[i];
+ if (labs(excp[i]) > 32767)
+ excp[i] = (excp[i] & 0x80000000) ? -32768 : 32767;
+ }
+ agc2( exc_enhanced, excp );
+ overflow = Syn_filt( Az, excp, &synth[i_subfr], L_SUBFR, st->mem_syn, 0
+ );
+ }
+ else {
+ overflow = Syn_filt( Az, exc_enhanced, &synth[i_subfr], L_SUBFR, st->
+ mem_syn, 0 );
+ }
+
+ if ( overflow ) {
+ for ( i = 0; i < PIT_MAX + L_INTERPOL + L_SUBFR; i++ ) {
+ st->old_exc[i] = st->old_exc[i] >> 2;
+ }
+
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ exc_enhanced[i] = exc_enhanced[i] >> 2;
+ }
+ Syn_filt_overflow( Az, exc_enhanced, &synth[i_subfr], L_SUBFR, st->mem_syn, 1 );
+ }
+ else {
+ memcpy( st->mem_syn, &synth[i_subfr + 30], 40 );
+ }
/*
* Update signal for next frame.
* -> shift to the left by L_SUBFR st->exc[]
*/
- memcpy(&st->old_exc[0], &st->old_exc[L_SUBFR], (PIT_MAX + L_INTERPOL) <<
- 2);
+ memcpy( &st->old_exc[0], &st->old_exc[L_SUBFR], ( PIT_MAX + L_INTERPOL )<<
+ 2 );
- /* interpolated LPC parameters for next subframe */
- Az += MP1;
+ /* interpolated LPC parameters for next subframe */
+ Az += MP1;
- /* store T0 for next subframe */
- st->old_T0 = T0;
- }
+ /* store T0 for next subframe */
+ st->old_T0 = T0;
+ }
/*
* Call the Source Characteristic Detector which updates
* st->inBackgroundNoise and st->voicedHangover.
*/
- st->inBackgroundNoise = Bgn_scd(st->background_state, &(st->ltpGainHistory[
- 0]), &(synth[0]), &(st->voicedHangover));
- dtx_dec_activity_update(st->dtxDecoderState, st->lsfState->past_lsf_q, synth
- );
+ st->inBackgroundNoise = Bgn_scd( st->background_state, &( st->ltpGainHistory[
+ 0] ), &( synth[0] ), &( st->voicedHangover ) );
+ dtx_dec_activity_update( st->dtxDecoderState, st->lsfState->past_lsf_q, synth
+ );
- /* store bfi for next subframe */
- st->prev_bf = bfi;
- st->prev_pdf = pdfi;
+ /* store bfi for next subframe */
+ st->prev_bf = bfi;
+ st->prev_pdf = pdfi;
/*
* Calculate the LSF averages on the eight
* previous frames
*/
- lsp_avg(st->lsp_avg_st, st->lsfState->past_lsf_q);
+ lsp_avg( st->lsp_avg_st, st->lsfState->past_lsf_q );
theEnd:
- st->dtxDecoderState->dtxGlobalState = newDTXState;
- return;
+ st->dtxDecoderState->dtxGlobalState = newDTXState;
+ return;
}
@@ -5709,45 +5289,39 @@ theEnd:
* Returns:
* void
*/
-static void Residu40(Word32 a[], Word32 x[], Word32 y[])
+static void Residu40( Word32 a[], Word32 x[], Word32 y[] )
{
- Word32 s, i, j;
-
-
- for(i = 0; i < 40; i++)
- {
- s = a[0] * x[i] + a[1] * x[i - 1] + a[2] * x[i - 2] + a[3] * x[i - 3];
- s += a[4] * x[i - 4] + a[5] * x[i - 5] + a[6] * x[i - 6] + a[7] * x[i - 7]
- ;
- s += a[8] * x[i - 8] + a[9] * x[i - 9] + a[10] * x[i - 10];
- y[i] = (s + 0x800) >> 12;
- if(abs(y[i]) > 32767)
- {
- /* go to safe mode */
- for(i = 0; i < 40; i++)
- {
- s = a[0] * x[i];
- for(j = 1; j <= 10; j++)
- {
- s += a[j] * x[i - j];
- if(s > 1073741823)
- {
- s = 1073741823;
- }
- else if(s < -1073741824)
- {
- s = -1073741824;
- }
- }
- y[i] = (s + 0x800) >> 12;
- if(abs(y[i]) > 32767)
- y[i] = (y[i] & 0x80000000) ? -32768 : 32767;
+ Word32 s, i, j;
+
+
+ for ( i = 0; i < 40; i++ ) {
+ s = a[0] * x[i] + a[1] * x[i - 1] + a[2] * x[i - 2] + a[3] * x[i - 3];
+ s += a[4] * x[i - 4] + a[5] * x[i - 5] + a[6] * x[i - 6] + a[7] * x[i - 7]
+ ;
+ s += a[8] * x[i - 8] + a[9] * x[i - 9] + a[10] * x[i - 10];
+ y[i] = ( s + 0x800 ) >> 12;
+ if (abs(y[i]) > 32767){
+ /* go to safe mode */
+ for (i = 0; i < 40; i++) {
+ s = a[0] * x[i];
+ for (j = 1; j <= 10; j++) {
+ s += a[j] * x[i - j];
+ if (s > 1073741823){
+ s = 1073741823;
+ }
+ else if ( s < -1073741824) {
+ s = -1073741824;
+ }
}
- return;
- }
-
- }
- return;
+ y[i] = ( s + 0x800 ) >> 12;
+ if (abs(y[i]) > 32767)
+ y[i] = (y[i] & 0x80000000) ? -32768 : 32767;
+ }
+ return;
+ }
+
+ }
+ return;
}
@@ -5767,111 +5341,102 @@ static void Residu40(Word32 a[], Word32 x[], Word32 y[])
* Returns:
* void
*/
-static void agc(agcState *st, Word32 *sig_in, Word32 *sig_out, Word16 agc_fac)
+static void agc( agcState *st, Word32 *sig_in, Word32 *sig_out, Word16 agc_fac )
{
- Word32 s, gain_in, gain_out, g0, gain;
- int exp, i;
-
-
- /* calculate gain_out with exponent */
- s = energy_new(sig_out);
-
- if(s == 0)
- {
- st->past_gain = 0;
- return;
- }
- exp = 0;
- i = s;
- while(!(i & 0x40000000))
- {
- exp++;
- i = i << 1;
- }
- exp -= 1;
- if(exp & 0x80000000)
- {
- s >>= 1;
- }
- else
- {
- s <<= exp;
- }
- gain_out = (s + 0x00008000L) >> 16;
-
- /* calculate gain_in with exponent */
- s = energy_new(sig_in);
-
- if(s == 0)
- {
- g0 = 0;
- }
- else
- {
- i = 0;
- while(!(s & 0x40000000))
- {
- i++;
- s = s << 1;
- }
- s = s + 0x00008000L;
-
- if(s >= 0)
- gain_in = s >> 16;
- else
- gain_in = 32767;
- exp = (exp - i);
-
- /*
- * g0 = (1-agc_fac) * sqrt(gain_in/gain_out);
- */
- /* s = gain_out / gain_in */
- s = (gain_out << 15) / gain_in;
- exp = 7 - exp;
-
- if(exp > 0)
- {
- if(exp > 31)
- {
- if(s)
- {
- s = 2147483647;
- }
+ Word32 s, gain_in, gain_out, g0, gain;
+ int exp, i;
+
+
+ /* calculate gain_out with exponent */
+ s = energy_new( sig_out );
+
+ if ( s == 0 ) {
+ st->past_gain = 0;
+ return;
+ }
+ exp=0;
+ i = s;
+ while (!(i & 0x40000000))
+ {
+ exp++;
+ i = i << 1;
+ }
+ exp -=1;
+ if (exp & 0x80000000) {
+ s >>= 1;
+ }
+ else {
+ s <<= exp;
+ }
+ gain_out = ( s + 0x00008000L ) >> 16;
+
+ /* calculate gain_in with exponent */
+ s = energy_new( sig_in );
+
+ if ( s == 0 ) {
+ g0 = 0;
+ }
+ else {
+ i=0;
+ while (!(s & 0x40000000))
+ {
+ i++;
+ s = s << 1;
+ }
+ s = s + 0x00008000L;
+
+ if ( s >= 0 )
+ gain_in = s >> 16;
+ else
+ gain_in = 32767;
+ exp = ( exp - i );
+
+ /*
+ * g0 = (1-agc_fac) * sqrt(gain_in/gain_out);
+ */
+ /* s = gain_out / gain_in */
+ s = ( gain_out << 15 ) / gain_in;
+ exp = 7 - exp;
+
+ if ( exp > 0 ){
+ if (exp > 31)
+ {
+ if(s){
+ s = 2147483647;
}
- else
- {
- s = s << exp ;
- }
- }
- else
- s = (s >> (-exp));
- if(s < 0)
- s = 2147483647;
- s = Inv_sqrt(s);
- i = ((s << 9) + 0x00008000L) >> 16;
- if(i & 0xFFFF8000)
- i = 32767;
-
- /* g0 = i * (1-agc_fac) */
- g0 = (i * (32767 - agc_fac)) >> 15;
- }
-
- /*
- * compute gain[n] = agc_fac * gain[n-1] + (1-agc_fac) * sqrt(gain_in/gain_out)
- * sig_out[n] = gain[n] * sig_out[n]
- */
- gain = st->past_gain;
-
- for(i = 0; i < L_SUBFR; i++)
- {
- gain = (gain * agc_fac) >> 15;
- gain = gain + g0;
- sig_out[i] = (sig_out[i] * gain) >> 12;
- if(labs(sig_out[i]) > 32767)
- sig_out[i] = (sig_out[i] & 0x8000000) ? -32768 : 32767;
- }
- st->past_gain = gain;
- return;
+ }
+ else {
+ s = s << exp ;
+ }
+ }
+ else
+ s = ( s >> ( -exp ) );
+ if (s < 0)
+ s = 2147483647;
+ s = Inv_sqrt( s );
+ i = ( ( s << 9 ) + 0x00008000L ) >> 16;
+ if (i & 0xFFFF8000)
+ i = 32767;
+
+ /* g0 = i * (1-agc_fac) */
+ g0 = ( i * ( 32767 - agc_fac ) ) >> 15;
+ }
+
+ /*
+ * compute gain[n] = agc_fac * gain[n-1] + (1-agc_fac) * sqrt(gain_in/gain_out)
+ * sig_out[n] = gain[n] * sig_out[n]
+ */
+ gain = st->past_gain;
+
+ for ( i = 0; i < L_SUBFR; i++ ) {
+ gain = ( gain * agc_fac ) >> 15;
+ gain = gain + g0;
+ sig_out[i] = ( sig_out[i] * gain ) >> 12;
+ if (labs(sig_out[i]) > 32767)
+ sig_out[i] = (sig_out[i] & 0x8000000) ? -32768 : 32767;
+ }
+ st->past_gain = gain;
+ return;
}
@@ -5896,136 +5461,121 @@ static void agc(agcState *st, Word32 *sig_in, Word32 *sig_out, Word16 agc_fac)
* Returns:
* void
*/
-static void Post_Filter(Post_FilterState *st, enum Mode mode, Word32 *syn,
- Word32 *Az_4)
+static void Post_Filter( Post_FilterState *st, enum Mode mode, Word32 *syn,
+ Word32 *Az_4 )
{
- Word32 h[22], Ap3[MP1], Ap4[MP1]; /* bandwidth expanded LP parameters */
- Word32 tmp, i_subfr, i, temp1, temp2, overflow = 0;
- Word32 *Az, *p1, *p2, *syn_work = &st->synth_buf[M];
- const Word32 *pgamma3 = &gamma3[0];
- const Word32 *pgamma4 = &gamma4_gamma3_MR122[0];
-
-
- /*
- * Post filtering
- */
- memcpy(syn_work, syn, L_FRAME << 2);
- Az = Az_4;
-
- if((mode == MR122) || (mode == MR102))
- {
- pgamma3 = &gamma4_gamma3_MR122[0];
- pgamma4 = &gamma4_MR122[0];
- }
-
- for(i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR)
- {
- /* Find weighted filter coefficients Ap3[] and Ap[4] */
- Ap3[0] = Az[0];
- Ap4[0] = Az[0];
-
- for(i = 1; i <= 10; i++)
- {
- Ap3[i] = (Az[i] * pgamma3[i - 1] + 0x4000) >> 15;
- Ap4[i] = (Az[i] * pgamma4[i - 1] + 0x4000) >> 15;
- }
-
- /* filtering of synthesis speech by A(z/0.7) to find res2[] */
- Residu40(Ap3, &syn_work[i_subfr], st->res2);
-
- /* tilt compensation filter */
- /* impulse response of A(z/0.7)/A(z/0.75) */
- memcpy(h, Ap3, MP1 << 2);
- memset(&h[M +1], 0, (22 - M - 1) << 2);
- Syn_filt(Ap4, h, h, 22, &h[M +1], 0);
-
- /* 1st correlation of h[] */
- tmp = 16777216 + h[1] * h[1];
-
- for(i = 2; i < 22; i++)
- {
- tmp += h[i] * h[i];
- if(tmp > 0x3FFF8000)
- break;
- }
- temp1 = tmp >> 15;
- if(temp1 & 0xFFFF8000)
- temp1 = 32767;
-
- tmp = h[0] * h[1];
-
- for(i = 1; i < 21; i++)
- {
- tmp += h[i] * h[i + 1];
- if(abs(tmp) > 1073741823)
- tmp = 1073741823;
- }
- temp2 = tmp >> 15;
-
- if(temp2 <= 0)
- {
- temp2 = 0;
- }
- else
- {
- tmp = temp2 * 26214;
- temp2 = (tmp & 0xffff8000) / temp1;
- }
-
- /* preemphasis */
- p1 = st->res2 + 39;
- p2 = p1 - 1;
- tmp = *p1;
-
- do
- {
- *p1 = *p1 - ((temp2 * *p2--) >> 15);
- if(abs(*p1) > 32767)
- {
- *p1 = (*p1 & 0x80000000) ? -32768 : 32767;
- }
- p1--;
- *p1 = *p1 - ((temp2 * *p2--) >> 15);
- if(abs(*p1) > 32767)
- {
- *p1 = (*p1 & 0x80000000) ? -32768 : 32767;
- }
- p1--;
- *p1 = *p1 - ((temp2 * *p2--) >> 15);
- if(abs(*p1) > 32767)
- {
- *p1 = (*p1 & 0x80000000) ? -32768 : 32767;
- }
- p1--;
- }
- while(p1 > st->res2);
- *p1 = *p1 - ((temp2 * st->preemph_state_mem_pre) >> 15);
- if(abs(*p1) > 32767)
- {
+ Word32 h[22], Ap3[MP1], Ap4[MP1]; /* bandwidth expanded LP parameters */
+ Word32 tmp, i_subfr, i, temp1, temp2, overflow = 0;
+ Word32 *Az, *p1, *p2, *syn_work = &st->synth_buf[M];
+ const Word32 *pgamma3 = &gamma3[0];
+ const Word32 *pgamma4 = &gamma4_gamma3_MR122[0];
+
+
+ /*
+ * Post filtering
+ */
+ memcpy( syn_work, syn, L_FRAME <<2 );
+ Az = Az_4;
+
+ if ( ( mode == MR122 ) || ( mode == MR102 ) ) {
+ pgamma3 = &gamma4_gamma3_MR122[0];
+ pgamma4 = &gamma4_MR122[0];
+ }
+
+ for ( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) {
+ /* Find weighted filter coefficients Ap3[] and Ap[4] */
+ Ap3[0] = Az[0];
+ Ap4[0] = Az[0];
+
+ for ( i = 1; i <= 10; i++ ) {
+ Ap3[i] = ( Az[i] * pgamma3[i - 1] +0x4000 ) >> 15;
+ Ap4[i] = ( Az[i] * pgamma4[i - 1] +0x4000 ) >> 15;
+ }
+
+ /* filtering of synthesis speech by A(z/0.7) to find res2[] */
+ Residu40( Ap3, &syn_work[i_subfr], st->res2 );
+
+ /* tilt compensation filter */
+ /* impulse response of A(z/0.7)/A(z/0.75) */
+ memcpy( h, Ap3, MP1 <<2 );
+ memset( &h[M +1], 0, ( 22 - M - 1 )<<2 );
+ Syn_filt( Ap4, h, h, 22, &h[M +1], 0 );
+
+ /* 1st correlation of h[] */
+ tmp = 16777216 + h[1] * h[1];
+
+ for ( i = 2; i < 22; i++ ) {
+ tmp += h[i] * h[i];
+ if (tmp > 0x3FFF8000)
+ break;
+ }
+ temp1 = tmp >> 15;
+ if (temp1 & 0xFFFF8000)
+ temp1 = 32767;
+
+ tmp = h[0] * h[1];
+
+ for ( i = 1; i < 21; i++ ) {
+ tmp += h[i] * h[i + 1];
+ if (abs(tmp) > 1073741823)
+ tmp = 1073741823;
+ }
+ temp2 = tmp >> 15;
+
+ if ( temp2 <= 0 ) {
+ temp2 = 0;
+ }
+ else {
+ tmp = temp2 * 26214;
+ temp2 = ( tmp & 0xffff8000 ) / temp1;
+ }
+
+ /* preemphasis */
+ p1 = st->res2 + 39;
+ p2 = p1 - 1;
+ tmp = *p1;
+
+ do {
+ *p1 = *p1 - ( ( temp2 * *p2-- ) >> 15 );
+ if (abs(*p1) > 32767) {
*p1 = (*p1 & 0x80000000) ? -32768 : 32767;
- }
- st->preemph_state_mem_pre = tmp;
-
- /* filtering through 1/A(z/0.75) */
- overflow = Syn_filt(Ap4, st->res2, &syn[i_subfr], L_SUBFR, st->mem_syn_pst, 0);
- if(overflow)
- {
- Syn_filt_overflow(Ap4, st->res2, &syn[i_subfr], L_SUBFR, st->mem_syn_pst, 1);
- overflow = 0;
- }
- else
- {
- memcpy(st->mem_syn_pst, &syn[i_subfr + 30], 40);
- }
-
- /* scale output to input */
- agc(st->agc_state, &syn_work[i_subfr], &syn[i_subfr], AGC_FAC);
- Az += MP1;
- }
-
- /* update syn_work[] buffer */
- memcpy(&syn_work[- M], &syn_work[L_FRAME - M], M << 2);
- return;
+ }
+ p1--;
+ *p1 = *p1 - ( ( temp2 * *p2-- ) >> 15 );
+ if (abs(*p1) > 32767) {
+ *p1 = (*p1 & 0x80000000) ? -32768 : 32767;
+ }
+ p1--;
+ *p1 = *p1 - ( ( temp2 * *p2-- ) >> 15 );
+ if (abs(*p1) > 32767) {
+ *p1 = (*p1 & 0x80000000) ? -32768 : 32767;
+ }
+ p1--;
+ } while( p1 > st->res2 );
+ *p1 = *p1 - ( ( temp2 * st->preemph_state_mem_pre ) >> 15 );
+ if (abs(*p1) > 32767) {
+ *p1 = (*p1 & 0x80000000) ? -32768 : 32767;
+ }
+ st->preemph_state_mem_pre = tmp;
+
+ /* filtering through 1/A(z/0.75) */
+ overflow = Syn_filt( Ap4, st->res2, &syn[i_subfr], L_SUBFR, st->mem_syn_pst, 0 );
+ if (overflow){
+ Syn_filt_overflow( Ap4, st->res2, &syn[i_subfr], L_SUBFR, st->mem_syn_pst, 1 );
+ overflow = 0;
+ }
+ else {
+ memcpy(st->mem_syn_pst, &syn[i_subfr + 30], 40);
+ }
+
+ /* scale output to input */
+ agc( st->agc_state, &syn_work[i_subfr], &syn[i_subfr], AGC_FAC );
+ Az += MP1;
+ }
+
+ /* update syn_work[] buffer */
+ memcpy( &syn_work[- M], &syn_work[L_FRAME - M], M <<2 );
+ return;
}
@@ -6047,58 +5597,53 @@ static void Post_Filter(Post_FilterState *st, enum Mode mode, Word32 *syn,
* Returns:
* void
*/
-static void Post_Process(Post_ProcessState *st, Word32 signal[])
-{
+ static void Post_Process( Post_ProcessState *st, Word32 signal[] )
+ {
Word32 x2, tmp, i = 0;
Word32 mask = 0x40000000;
- do
- {
- x2 = st->x1;
- st->x1 = st->x0;
- st->x0 = signal[i];
-
- /*
- * y[i] = b[0]*x[i]*2 + b[1]*x[i-1]*2 + b140[2]*x[i-2]/2
- * + a[1]*y[i-1] + a[2] * y[i-2];
- */
- tmp = (st->y1_hi * 15836) + (((st->y1_lo * 15836) & (Word32)0xffff8000) >> 15);
- tmp += (st->y2_hi * -7667) + (((st->y2_lo * (-7667)) & (Word32)0xffff8000) >> 15);
- tmp += st->x0 * 7699;
- tmp += st->x1 * -15398;
- if(((tmp >> 1) ^ tmp) & mask)
- tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
-
- tmp += x2 * 7699;
- if(((tmp >> 1) ^ tmp) & mask)
- tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
-
- tmp = tmp << 1;
- if(((tmp >> 1) ^ tmp) & mask)
- tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
-
- tmp = tmp << 1;
- if(((tmp >> 1) ^ tmp) & mask)
- tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
-
- if(labs(tmp) < 536862720)
- {
- signal[i++] = (tmp + 0x00002000L) >> 14;
- }
- else if(tmp > 0)
- {
- signal[i++] = 32767;
- }
- else
- {
- signal[i++] = -32768;
- }
- st->y2_hi = st->y1_hi;
- st->y2_lo = st->y1_lo;
- st->y1_hi = tmp >> 15;
- st->y1_lo = ((tmp << 1) - (st->y1_hi << 16)) >> 1;
- }
- while(i < 160);
+ do {
+ x2 = st->x1;
+ st->x1 = st->x0;
+ st->x0 = signal[i];
+
+ /*
+ * y[i] = b[0]*x[i]*2 + b[1]*x[i-1]*2 + b140[2]*x[i-2]/2
+ * + a[1]*y[i-1] + a[2] * y[i-2];
+ */
+ tmp = ( st->y1_hi * 15836) + ( ( ( st->y1_lo * 15836 ) & ( Word32 )0xffff8000 ) >> 15);
+ tmp += (st->y2_hi * -7667) + ( ( ( st->y2_lo * ( -7667 ) ) & ( Word32 )0xffff8000 ) >> 15);
+ tmp += st->x0 * 7699;
+ tmp += st->x1 * -15398;
+ if ( ( (tmp >> 1) ^ tmp ) & mask)
+ tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
+
+ tmp += x2 * 7699;
+ if ( ( (tmp >> 1) ^ tmp ) & mask)
+ tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
+
+ tmp = tmp << 1;
+ if ( ( (tmp >> 1) ^ tmp ) & mask)
+ tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
+
+ tmp = tmp << 1;
+ if ( ( (tmp >> 1) ^ tmp ) & mask)
+ tmp = (tmp & 0x80000000) ? -1073741824 : 1073741823;
+
+ if ( labs( tmp ) < 536862720 ) {
+ signal[i++] = ( tmp + 0x00002000L ) >> 14;
+ }
+ else if ( tmp > 0 ) {
+ signal[i++] = 32767;
+ }
+ else {
+ signal[i++] = -32768;
+ }
+ st->y2_hi = st->y1_hi;
+ st->y2_lo = st->y1_lo;
+ st->y1_hi = tmp >> 15;
+ st->y1_lo = ( ( tmp << 1 ) - ( st->y1_hi << 16 ) ) >> 1;
+ } while( i < 160 );
return;
}
@@ -6120,35 +5665,34 @@ static void Post_Process(Post_ProcessState *st, Word32 signal[])
* Returns:
* void
*/
-void Speech_Decode_Frame(void *st, enum Mode mode, Word16 *parm, enum
- RXFrameType frame_type, Word16 *synth)
+void Speech_Decode_Frame( void *st, enum Mode mode, Word16 *parm, enum
+ RXFrameType frame_type, Word16 *synth )
{
- Word32 Az_dec[AZ_SIZE]; /* Decoded Az for post-filter in 4 subframes*/
- Word32 synth_speech[L_FRAME];
- Word32 i;
-
- /* Synthesis */
- Decoder_amr(((Speech_Decode_FrameState *) st)->decoder_amrState, mode,
- parm, frame_type, synth_speech, Az_dec);
- Post_Filter(((Speech_Decode_FrameState *) st)->post_state, mode,
- synth_speech, Az_dec);
-
- /* post HP filter, and 15->16 bits */
- Post_Process(((Speech_Decode_FrameState *) st)->postHP_state,
- synth_speech);
-
- for(i = 0; i < L_FRAME; i++)
- {
+ Word32 Az_dec[AZ_SIZE]; /* Decoded Az for post-filter in 4 subframes*/
+ Word32 synth_speech[L_FRAME];
+ Word32 i;
+
+ /* Synthesis */
+ Decoder_amr( ( ( Speech_Decode_FrameState * ) st )->decoder_amrState, mode,
+ parm, frame_type, synth_speech, Az_dec );
+ Post_Filter( ( ( Speech_Decode_FrameState * ) st )->post_state, mode,
+ synth_speech, Az_dec );
+
+ /* post HP filter, and 15->16 bits */
+ Post_Process( ( ( Speech_Decode_FrameState * ) st )->postHP_state,
+ synth_speech );
+
+for ( i = 0; i < L_FRAME; i++ ) {
#ifndef NO13BIT
- /* Truncate to 13 bits */
- synth[i] = (Word16)(synth_speech[i] & 0xfff8);
+ /* Truncate to 13 bits */
+ synth[i] = ( Word16 )( synth_speech[i] & 0xfff8 );
#else
- synth[i] = (Word16)(synth_speech[i]);
+ synth[i] = ( Word16 )( synth_speech[i]);
#endif
- }
+ }
- return;
+ return;
}
@@ -6165,24 +5709,24 @@ void Speech_Decode_Frame(void *st, enum Mode mode, Word16 *parm, enum
* Returns:
* Void
*/
-static void Decoder_amr_exit(Decoder_amrState **state)
+static void Decoder_amr_exit( Decoder_amrState **state )
{
- if(state == NULL || *state == NULL)
- return;
- free((*state)->lsfState);
- free((*state)->ec_gain_p_st);
- free((*state)->ec_gain_c_st);
- free((*state)->pred_state);
- free((*state)->background_state);
- free((*state)->ph_disp_st);
- free((*state)->Cb_gain_averState);
- free((*state)->lsp_avg_st);
- free((*state)->dtxDecoderState);
-
- /* deallocate memory */
- free(*state);
- *state = NULL;
- return;
+ if ( state == NULL || *state == NULL )
+ return;
+ free( ( *state )->lsfState );
+ free( ( *state )->ec_gain_p_st );
+ free( ( *state )->ec_gain_c_st );
+ free( ( *state )->pred_state );
+ free( ( *state )->background_state );
+ free( ( *state )->ph_disp_st );
+ free( ( *state )->Cb_gain_averState );
+ free( ( *state )->lsp_avg_st );
+ free( ( *state )->dtxDecoderState );
+
+ /* deallocate memory */
+ free( *state );
+ *state = NULL;
+ return;
}
@@ -6199,16 +5743,16 @@ static void Decoder_amr_exit(Decoder_amrState **state)
* Returns:
* Void
*/
-static void Post_Filter_exit(Post_FilterState **state)
+static void Post_Filter_exit( Post_FilterState **state )
{
- if(state == NULL || *state == NULL)
- return;
- free((*state)->agc_state);
-
- /* deallocate memory */
- free(*state);
- *state = NULL;
- return;
+ if ( state == NULL || *state == NULL )
+ return;
+ free( ( *state )->agc_state );
+
+ /* deallocate memory */
+ free( *state );
+ *state = NULL;
+ return;
}
@@ -6225,20 +5769,19 @@ static void Post_Filter_exit(Post_FilterState **state)
* Returns:
* -1 failure
*/
-static int Post_Process_reset(Post_ProcessState *state)
+static int Post_Process_reset( Post_ProcessState *state )
{
- if((Post_ProcessState *)state == NULL)
- {
- fprintf(stderr, "Post_Process_reset: invalid parameter\n");
- return -1;
- }
- state->y2_hi = 0;
- state->y2_lo = 0;
- state->y1_hi = 0;
- state->y1_lo = 0;
- state->x0 = 0;
- state->x1 = 0;
- return 0;
+ if ( ( Post_ProcessState * )state == NULL ) {
+ fprintf( stderr, "Post_Process_reset: invalid parameter\n" );
+ return-1;
+ }
+ state->y2_hi = 0;
+ state->y2_lo = 0;
+ state->y1_hi = 0;
+ state->y1_lo = 0;
+ state->x0 = 0;
+ state->x1 = 0;
+ return 0;
}
@@ -6255,15 +5798,15 @@ static int Post_Process_reset(Post_ProcessState *state)
* Returns:
* Void
*/
-static void Post_Process_exit(Post_ProcessState **state)
+static void Post_Process_exit( Post_ProcessState **state )
{
- if(state == NULL || *state == NULL)
- return;
+ if ( state == NULL || *state == NULL )
+ return;
- /* deallocate memory */
- free(*state);
- *state = NULL;
- return;
+ /* deallocate memory */
+ free( *state );
+ *state = NULL;
+ return;
}
@@ -6280,158 +5823,147 @@ static void Post_Process_exit(Post_ProcessState **state)
* Returns:
* success = 0
*/
-static int Decoder_amr_init(Decoder_amrState **state)
+static int Decoder_amr_init( Decoder_amrState **state )
{
- Decoder_amrState * s;
-
- if((Decoder_amrState *)state == NULL)
- {
- fprintf(stderr, "Decoder_amr_init: invalid parameter\n");
- return -1;
- }
- *state = NULL;
-
- /* allocate memory */
- if((s = (Decoder_amrState *) malloc(sizeof(Decoder_amrState))) ==
- NULL)
- {
- fprintf(stderr, "Decoder_amr_init: can not malloc state structure\n");
- return -1;
- }
-
- /* DPlsf_init */
- /* allocate memory */
- if((s->lsfState = (D_plsfState *) malloc(sizeof(D_plsfState))) ==
- NULL)
- {
- free(s);
- fprintf(stderr, "DPlsf_init: can not malloc state structure\n");
- return -1;
- }
-
- /* ecGainPitchInit */
- /* allocate memory */
- if((s->ec_gain_p_st = (ec_gain_pitchState *) malloc(sizeof(
- ec_gain_pitchState))) == NULL)
- {
- free(s->lsfState);
- free(s);
- fprintf(stderr, "ecGainPitchInit: can not malloc state structure\n");
- return -1;
- }
-
- /* ecGainCodeInit */
- /* allocate memory */
- if((s->ec_gain_c_st = (ec_gain_codeState *) malloc(sizeof(
- ec_gain_codeState))) == NULL)
- {
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "ecGainCodeInit: can not malloc state structure\n");
- return -1;
- }
-
- /* gcPredInit */
- /* allocate memory */
- if((s->pred_state = (gc_predState *) malloc(sizeof(gc_predState)))
- == NULL)
- {
- free(s->ec_gain_c_st);
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "gcPredInit: can not malloc state structure\n");
- return -1;
- }
-
- /* Cb_gain_averageInit */
- /* allocate memory */
- if((s->Cb_gain_averState = (Cb_gain_averageState *) malloc(sizeof(
- Cb_gain_averageState))) == NULL)
- {
- free(s->pred_state);
- free(s->ec_gain_c_st);
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "Cb_gain_averageInit: can not malloc state structure\n");
- return -1;
- }
- memset(s->Cb_gain_averState->cbGainHistory, 0, L_CBGAINHIST << 2);
-
- /* Initialize hangover handling */
- s->Cb_gain_averState->hangVar = 0;
- s->Cb_gain_averState->hangCount = 0;
-
- /* lsp_avgInit */
- /* allocate memory */
- if((s->lsp_avg_st = (lsp_avgState *) malloc(sizeof(lsp_avgState)))
- == NULL)
- {
- free(s->Cb_gain_averState);
- free(s->pred_state);
- free(s->ec_gain_c_st);
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "lsp_avgInit: can not malloc state structure\n");
- return -1;
- }
-
- /* Bgn_scdInit */
- /* allocate memory */
- if((s->background_state = (Bgn_scdState *) malloc(sizeof(Bgn_scdState
- ))) == NULL)
- {
- free(s->lsp_avg_st);
- free(s->Cb_gain_averState);
- free(s->pred_state);
- free(s->ec_gain_c_st);
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "Bgn_scdInit: can not malloc state structure\n");
- return -1;
- }
-
- /* phDispInit */
- /* allocate memory */
- if((s->ph_disp_st = (ph_dispState *) malloc(sizeof(ph_dispState)))
- == NULL)
- {
- free(s->background_state);
- free(s->lsp_avg_st);
- free(s->Cb_gain_averState);
- free(s->pred_state);
- free(s->ec_gain_c_st);
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "phDispInit: can not malloc state structure\n");
- return -1;
- }
-
- /* dtxDecInit */
- /* allocate memory */
- if((s->dtxDecoderState = (dtx_decState *) malloc(sizeof(dtx_decState)
- )) == NULL)
- {
- free(s->ph_disp_st);
- free(s->background_state);
- free(s->lsp_avg_st);
- free(s->Cb_gain_averState);
- free(s->pred_state);
- free(s->ec_gain_c_st);
- free(s->ec_gain_p_st);
- free(s->lsfState);
- free(s);
- fprintf(stderr, "dtxDecInit: can not malloc state structure\n");
- return -1;
- }
- Decoder_amr_reset(s, 0);
- *state = s;
- return 0;
+ Decoder_amrState * s;
+
+ if ( ( Decoder_amrState * )state == NULL ) {
+ fprintf( stderr, "Decoder_amr_init: invalid parameter\n" );
+ return-1;
+ }
+ *state = NULL;
+
+ /* allocate memory */
+ if ( ( s = ( Decoder_amrState * ) malloc( sizeof( Decoder_amrState ) ) ) ==
+ NULL ) {
+ fprintf( stderr, "Decoder_amr_init: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* DPlsf_init */
+ /* allocate memory */
+ if ( ( s->lsfState = ( D_plsfState * ) malloc( sizeof( D_plsfState ) ) ) ==
+ NULL ) {
+ free(s);
+ fprintf( stderr, "DPlsf_init: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* ecGainPitchInit */
+ /* allocate memory */
+ if ( ( s->ec_gain_p_st = ( ec_gain_pitchState * ) malloc( sizeof(
+ ec_gain_pitchState ) ) ) == NULL ) {
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "ecGainPitchInit: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* ecGainCodeInit */
+ /* allocate memory */
+ if ( ( s->ec_gain_c_st = ( ec_gain_codeState * ) malloc( sizeof(
+ ec_gain_codeState ) ) ) == NULL ) {
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "ecGainCodeInit: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* gcPredInit */
+ /* allocate memory */
+ if ( ( s->pred_state = ( gc_predState * ) malloc( sizeof( gc_predState ) ) )
+ == NULL ) {
+ free(s->ec_gain_c_st);
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "gcPredInit: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* Cb_gain_averageInit */
+ /* allocate memory */
+ if ( ( s->Cb_gain_averState = ( Cb_gain_averageState * ) malloc( sizeof(
+ Cb_gain_averageState ) ) ) == NULL ) {
+ free(s->pred_state);
+ free(s->ec_gain_c_st);
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "Cb_gain_averageInit: can not malloc state structure\n" );
+ return-1;
+ }
+ memset( s->Cb_gain_averState->cbGainHistory, 0, L_CBGAINHIST <<2 );
+
+ /* Initialize hangover handling */
+ s->Cb_gain_averState->hangVar = 0;
+ s->Cb_gain_averState->hangCount = 0;
+
+ /* lsp_avgInit */
+ /* allocate memory */
+ if ( ( s->lsp_avg_st = ( lsp_avgState * ) malloc( sizeof( lsp_avgState ) ) )
+ == NULL ) {
+ free(s->Cb_gain_averState);
+ free(s->pred_state);
+ free(s->ec_gain_c_st);
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "lsp_avgInit: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* Bgn_scdInit */
+ /* allocate memory */
+ if ( ( s->background_state = ( Bgn_scdState * ) malloc( sizeof( Bgn_scdState
+ ) ) ) == NULL ) {
+ free(s->lsp_avg_st);
+ free(s->Cb_gain_averState);
+ free(s->pred_state);
+ free(s->ec_gain_c_st);
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "Bgn_scdInit: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* phDispInit */
+ /* allocate memory */
+ if ( ( s->ph_disp_st = ( ph_dispState * ) malloc( sizeof( ph_dispState ) ) )
+ == NULL ) {
+ free(s->background_state);
+ free(s->lsp_avg_st);
+ free(s->Cb_gain_averState);
+ free(s->pred_state);
+ free(s->ec_gain_c_st);
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "phDispInit: can not malloc state structure\n" );
+ return-1;
+ }
+
+ /* dtxDecInit */
+ /* allocate memory */
+ if ( ( s->dtxDecoderState = ( dtx_decState * ) malloc( sizeof( dtx_decState )
+ ) ) == NULL ) {
+ free(s->ph_disp_st);
+ free(s->background_state);
+ free(s->lsp_avg_st);
+ free(s->Cb_gain_averState);
+ free(s->pred_state);
+ free(s->ec_gain_c_st);
+ free(s->ec_gain_p_st);
+ free(s->lsfState);
+ free(s);
+ fprintf( stderr, "dtxDecInit: can not malloc state structure\n" );
+ return-1;
+ }
+ Decoder_amr_reset( s, 0 );
+ *state = s;
+ return 0;
}
@@ -6448,19 +5980,18 @@ static int Decoder_amr_init(Decoder_amrState **state)
* Returns:
* -1 failure
*/
-static int Post_Filter_reset(Post_FilterState *state)
+static int Post_Filter_reset( Post_FilterState *state )
{
- if((Post_FilterState *)state == NULL)
- {
- fprintf(stderr, "Post_Filter_reset: invalid parameter\n");
- return -1;
- }
- state->preemph_state_mem_pre = 0;
- state->agc_state->past_gain = 4096;
- memset(state->mem_syn_pst, 0, M << 2);
- memset(state->res2, 0, L_SUBFR << 2);
- memset(state->synth_buf, 0, (L_FRAME + M) << 2);
- return 0;
+ if ( ( Post_FilterState * )state == NULL ) {
+ fprintf( stderr, "Post_Filter_reset: invalid parameter\n" );
+ return-1;
+ }
+ state->preemph_state_mem_pre = 0;
+ state->agc_state->past_gain = 4096;
+ memset( state->mem_syn_pst, 0, M <<2 );
+ memset( state->res2, 0, L_SUBFR <<2 );
+ memset( state->synth_buf, 0, ( L_FRAME + M )<<2 );
+ return 0;
}
@@ -6477,36 +6008,34 @@ static int Post_Filter_reset(Post_FilterState *state)
* Returns:
* success = 0
*/
-static int Post_Filter_init(Post_FilterState **state)
+static int Post_Filter_init( Post_FilterState **state )
{
- Post_FilterState * s;
-
- if((Post_FilterState *)state == NULL)
- {
- fprintf(stderr, "F057:invalid parameter\n");
- return -1;
- }
- *state = NULL;
-
- /* allocate memory */
- if((s = (Post_FilterState *) malloc(sizeof(Post_FilterState))) ==
- NULL)
- {
- fprintf(stderr, "F057:can not malloc filter structure\n");
- return -1;
- }
- s->agc_state = NULL;
-
- /* allocate memory */
- if((s->agc_state = (agcState *) malloc(sizeof(agcState))) == NULL)
- {
- free(s);
- fprintf(stderr, "agcInit: can not malloc state structure\n");
- return -1;
- }
- Post_Filter_reset(s);
- *state = s;
- return 0;
+ Post_FilterState * s;
+
+ if ( ( Post_FilterState * )state == NULL ) {
+ fprintf( stderr, "F057:invalid parameter\n" );
+ return-1;
+ }
+ *state = NULL;
+
+ /* allocate memory */
+ if ( ( s = ( Post_FilterState * ) malloc( sizeof( Post_FilterState ) ) ) ==
+ NULL ) {
+ fprintf( stderr, "F057:can not malloc filter structure\n" );
+ return-1;
+ }
+ s->agc_state = NULL;
+
+ /* allocate memory */
+ if ( ( s->agc_state = ( agcState * ) malloc( sizeof( agcState ) ) ) == NULL )
+ {
+ free(s);
+ fprintf( stderr, "agcInit: can not malloc state structure\n" );
+ return-1;
+ }
+ Post_Filter_reset( s );
+ *state = s;
+ return 0;
}
@@ -6523,27 +6052,25 @@ static int Post_Filter_init(Post_FilterState **state)
* Returns:
* success = 0
*/
-static int Post_Process_init(Post_ProcessState **state)
+static int Post_Process_init( Post_ProcessState **state )
{
- Post_ProcessState * s;
-
- if((Post_ProcessState *)state == NULL)
- {
- fprintf(stderr, "Post_Process_init: invalid parameter\n");
- return -1;
- }
- *state = NULL;
-
- /* allocate memory */
- if((s = (Post_ProcessState *) malloc(sizeof(Post_ProcessState))) ==
- NULL)
- {
- fprintf(stderr, "Post_Process_init: can not malloc state structure\n");
- return -1;
- }
- Post_Process_reset(s);
- *state = s;
- return 0;
+ Post_ProcessState * s;
+
+ if ( ( Post_ProcessState * )state == NULL ) {
+ fprintf( stderr, "Post_Process_init: invalid parameter\n" );
+ return-1;
+ }
+ *state = NULL;
+
+ /* allocate memory */
+ if ( ( s = ( Post_ProcessState * ) malloc( sizeof( Post_ProcessState ) ) ) ==
+ NULL ) {
+ fprintf( stderr, "Post_Process_init: can not malloc state structure\n" );
+ return-1;
+ }
+ Post_Process_reset( s );
+ *state = s;
+ return 0;
}
@@ -6560,19 +6087,19 @@ static int Post_Process_init(Post_ProcessState **state)
* Returns:
* Void
*/
-void Speech_Decode_Frame_exit(void **st)
+void Speech_Decode_Frame_exit( void **st )
{
- if(((Speech_Decode_FrameState *)(st)) == NULL)
- return;
- Decoder_amr_exit(&(((Speech_Decode_FrameState *) st)->decoder_amrState
- ));
- Post_Filter_exit(&(((Speech_Decode_FrameState *) st)->post_state));
- Post_Process_exit(&(((Speech_Decode_FrameState *) st)->postHP_state))
- ;
-
- /* deallocate memory */
- free(((Speech_Decode_FrameState *)st));
- return;
+ if ( (( Speech_Decode_FrameState * )( st )) == NULL )
+ return;
+ Decoder_amr_exit( &( ( ( Speech_Decode_FrameState * ) st )->decoder_amrState
+ ) );
+ Post_Filter_exit( &( ( ( Speech_Decode_FrameState * ) st )->post_state ) );
+ Post_Process_exit( &( ( ( Speech_Decode_FrameState * ) st )->postHP_state ) )
+ ;
+
+ /* deallocate memory */
+ free( (( Speech_Decode_FrameState * )st) );
+ return;
}
@@ -6589,17 +6116,17 @@ void Speech_Decode_Frame_exit(void **st)
* Returns:
* -1 = failure
*/
-int Speech_Decode_Frame_reset(void **st)
+int Speech_Decode_Frame_reset( void **st )
{
- Speech_Decode_FrameState * state;
-
- if(st == NULL || *st == NULL)
- return (-1);
- state = (Speech_Decode_FrameState *)st;
- Decoder_amr_reset(state->decoder_amrState, (enum Mode) 0);
- Post_Filter_reset(state->post_state);
- Post_Process_reset(state->postHP_state);
- return 0;
+ Speech_Decode_FrameState * state;
+
+ if ( st == NULL || *st == NULL )
+ return (-1);
+ state = ( Speech_Decode_FrameState * )st;
+ Decoder_amr_reset( state->decoder_amrState, ( enum Mode ) 0 );
+ Post_Filter_reset( state->post_state );
+ Post_Process_reset( state->postHP_state );
+ return 0;
}
@@ -6616,27 +6143,25 @@ int Speech_Decode_Frame_reset(void **st)
* Returns:
* success = 0
*/
-void * Speech_Decode_Frame_init()
+void * Speech_Decode_Frame_init( )
{
- Speech_Decode_FrameState * s;
-
- /* allocate memory */
- if((s = (Speech_Decode_FrameState *) malloc(sizeof(
- Speech_Decode_FrameState))) == NULL)
- {
- fprintf(stderr, "Speech_Decode_Frame_init: can not malloc state "
- "structure\n");
- return NULL;
- }
- s->decoder_amrState = NULL;
- s->post_state = NULL;
- s->postHP_state = NULL;
-
- if(Decoder_amr_init(&s->decoder_amrState) || Post_Filter_init(&s->
- post_state) || Post_Process_init(&s->postHP_state))
- {
- Speech_Decode_Frame_exit((void **)(&s));
- return NULL;
- }
- return s;
+ Speech_Decode_FrameState * s;
+
+ /* allocate memory */
+ if ( ( s = ( Speech_Decode_FrameState * ) malloc( sizeof(
+ Speech_Decode_FrameState ) ) ) == NULL ) {
+ fprintf( stderr, "Speech_Decode_Frame_init: can not malloc state "
+ "structure\n" );
+ return NULL;
+ }
+ s->decoder_amrState = NULL;
+ s->post_state = NULL;
+ s->postHP_state = NULL;
+
+ if ( Decoder_amr_init( &s->decoder_amrState ) || Post_Filter_init( &s->
+ post_state ) || Post_Process_init( &s->postHP_state ) ) {
+ Speech_Decode_Frame_exit( ( void ** )( &s ) );
+ return NULL;
+ }
+ return s;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.h
index bb65b82db..bd7ec3471 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_dec.h
@@ -38,7 +38,7 @@ enum Mode { MR475 = 0,
MR122,
MRDTX,
N_MODES /* number of (SPC) modes */
- };
+};
/* Declaration recieved frame types */
enum RXFrameType { RX_SPEECH_GOOD = 0,
@@ -50,7 +50,7 @@ enum RXFrameType { RX_SPEECH_GOOD = 0,
RX_SID_BAD,
RX_NO_DATA,
RX_N_FRAMETYPES /* number of frame types */
- };
+};
/*
* Function prototypes
@@ -59,23 +59,23 @@ enum RXFrameType { RX_SPEECH_GOOD = 0,
/*
* initialize one instance of the speech decoder
*/
-void* Speech_Decode_Frame_init();
+void* Speech_Decode_Frame_init ();
/*
* free status struct
*/
-void Speech_Decode_Frame_exit(void **st);
+void Speech_Decode_Frame_exit (void **st);
/*
* Decodes one frame from encoded parameters
*/
-void Speech_Decode_Frame(void *st, enum Mode mode, short *serial,
- enum RXFrameType frame_type, short *synth);
+void Speech_Decode_Frame (void *st, enum Mode mode, short *serial,
+ enum RXFrameType frame_type, short *synth);
/*
* reset speech decoder
*/
-int Speech_Decode_Frame_reset(void **st);
+int Speech_Decode_Frame_reset (void **st);
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_enc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_enc.h
index aede76f75..25f9e6480 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_enc.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/amr_float/sp_enc.h
@@ -39,7 +39,7 @@ enum Mode { MR475 = 0,
MR102,
MR122,
MRDTX
- };
+};
/*
* Function prototypes
@@ -51,7 +51,7 @@ enum Mode { MR475 = 0,
* be passed to Speech_Encode_Frame in each call.
* returns 0 on success
*/
-void *Speech_Encode_Frame_init(int dtx);
+void *Speech_Encode_Frame_init (int dtx);
/*
* reset speech encoder (i.e. set state memory to zero)
* returns 0 on success
@@ -62,13 +62,13 @@ int Speech_Encode_Frame_reset(void *st, int dtx);
* de-initialize speech encoder (i.e. free status struct)
* stores NULL in *st
*/
-void Speech_Encode_Frame_exit(void **st);
+void Speech_Encode_Frame_exit (void **st);
/*
* Encodes one speech frame
* Returns analysis parameters
*/
-void Speech_Encode_Frame(void *st, enum Mode mode, short *newSpeech,
- short *prm, enum Mode *usedMode);
+void Speech_Encode_Frame (void *st, enum Mode mode, short *newSpeech,
+ short *prm, enum Mode *usedMode);
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/audioconvert.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/audioconvert.h
index 73cd01db5..46ba3d392 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/audioconvert.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/audioconvert.h
@@ -109,7 +109,7 @@ void av_audio_convert_free(AVAudioConvert *ctx);
* @param len length of audio frame size (measured in samples)
*/
int av_audio_convert(AVAudioConvert *ctx,
- void * const out[6], const int out_stride[6],
+ void * const out[6], const int out_stride[6],
const void * const in[6], const int in_stride[6], int len);
#endif /* AVCODEC_AUDIOCONVERT_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h
index e2859f1e6..c539552c3 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h
@@ -22,9 +22,9 @@
#define AVCODEC_AVCODEC_H
#ifdef __cplusplus
-#define FF_EXPORT extern "C"
+ #define FF_EXPORT extern "C"
#else
-#define FF_EXPORT
+ #define FF_EXPORT
#endif
/**
@@ -59,10 +59,9 @@
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
#define AV_TIME_BASE 1000000
-static const AVRational AV_TIME_BASE_Q = {1, AV_TIME_BASE};
+static const AVRational AV_TIME_BASE_Q={1, AV_TIME_BASE};
-enum CodecType
-{
+enum CodecType {
CODEC_TYPE_UNKNOWN = -1,
CODEC_TYPE_VIDEO,
CODEC_TYPE_AUDIO,
@@ -75,8 +74,7 @@ enum CodecType
/**
* Needed for CorePNG
*/
-enum CorePNGFrameType
-{
+enum CorePNGFrameType {
SAMPLE_I,
SAMPLE_P
};
@@ -84,8 +82,7 @@ enum CorePNGFrameType
/**
* all in native-endian format
*/
-enum SampleFormat
-{
+enum SampleFormat {
SAMPLE_FMT_NONE = -1,
SAMPLE_FMT_U8, ///< unsigned 8 bits
SAMPLE_FMT_S16, ///< signed 16 bits
@@ -162,8 +159,7 @@ enum SampleFormat
/**
* motion estimation type.
*/
-enum Motion_Est_ID
-{
+enum Motion_Est_ID {
ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
ME_FULL,
ME_LOG,
@@ -176,56 +172,51 @@ enum Motion_Est_ID
ME_TESA, ///< transformed exhaustive search algorithm
};
-enum AVDiscard
-{
+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_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,
+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
};
-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
+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
};
-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,
+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
};
-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
+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
};
@@ -234,23 +225,21 @@ enum AVColorRange
* 1 2 1-6 are possible chroma positions
* 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,
+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
};
/**
* H.264 VUI colour primaries (matrix_coefficients)
*/
-typedef enum
-{
+typedef enum {
YCbCr_RGB_coeff_GBR = 0,
YCbCr_RGB_coeff_ITUR_BT_709 = 1,
YCbCr_RGB_coeff_Unspecified = 2,
@@ -262,15 +251,13 @@ typedef enum
YCbCr_RGB_coeff_YCgCo = 8
} YCbCr_RGB_MatrixCoefficientsType;
-typedef enum
-{
+typedef enum {
VIDEO_FULL_RANGE_TV = 0,
VIDEO_FULL_RANGE_PC = 1,
VIDEO_FULL_RANGE_INVALID = 2
} VideoFullRangeType;
-typedef struct RcOverride
-{
+typedef struct RcOverride{
int start_frame;
int end_frame;
int qscale; // If this is 0 then quality_factor will be used instead.
@@ -303,7 +290,7 @@ typedef struct RcOverride
#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
-location instead of only at frame boundaries. */
+ location instead of only at frame boundaries. */
#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
@@ -419,8 +406,7 @@ location instead of only at frame boundaries. */
* This specifies the area which should be displayed.
* Note there may be multiple such areas for one frame.
*/
-typedef struct AVPanScan
-{
+typedef struct AVPanScan{
/**
* id
* - encoding: Set by user.
@@ -442,7 +428,7 @@ typedef struct AVPanScan
* - decoding: Set by libavcodec.
*/
int16_t position[3][2];
-} AVPanScan;
+}AVPanScan;
#define FF_COMMON_FRAME \
/**\
@@ -695,7 +681,7 @@ typedef struct AVPanScan
* - decoding: Set by libavcodec.\
*/\
YCbCr_RGB_MatrixCoefficientsType YCbCr_RGB_matrix_coefficients;
-/* ffdshow custom stuffs (end) */
+ /* ffdshow custom stuffs (end) */
#define FF_QSCALE_TYPE_MPEG1 0
#define FF_QSCALE_TYPE_MPEG2 1
@@ -729,8 +715,7 @@ typedef struct AVPanScan
* FF_COMMON_FRAME!
* sizeof(AVFrame) must not be used outside libav*.
*/
-typedef struct AVFrame
-{
+typedef struct AVFrame {
FF_COMMON_FRAME
} AVFrame;
@@ -742,8 +727,7 @@ typedef struct AVFrame
* sizeof(AVCodecContext) must not be used outside libav*.
*/
struct TlibavcodecExt;
-typedef struct AVCodecContext
-{
+typedef struct AVCodecContext {
/**
* information on struct for av_log
* - set by avcodec_alloc_context
@@ -961,11 +945,11 @@ typedef struct AVCodecContext
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. */
+ /* 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 */
@@ -1282,11 +1266,11 @@ typedef struct AVCodecContext
* - decoding: Set by user.
*/
int idct_algo;
- /*
- * idct_algo is set by ffdshow.ax.
- * It uses the list "idctNames[]" found in Tlibavcodec.cpp.
- * The indexes of the items in that list should match with the values below.
- */
+/*
+ * idct_algo is set by ffdshow.ax.
+ * It uses the list "idctNames[]" found in Tlibavcodec.cpp.
+ * The indexes of the items in that list should match with the values below.
+ */
#define FF_IDCT_AUTO 0
#define FF_IDCT_LIBMPEG2MMX 1
#define FF_IDCT_SIMPLEMMX 2
@@ -1349,14 +1333,14 @@ typedef struct AVCodecContext
* - encoding: Set by libavcodec.
* - decoding: Set by user.
*/
- int bits_per_coded_sample;
+ int bits_per_coded_sample;
/**
* prediction method (needed for huffyuv)
* - encoding: Set by user.
* - decoding: unused
*/
- int prediction_method;
+ int prediction_method;
#define FF_PRED_LEFT 0
#define FF_PRED_PLANE 1
#define FF_PRED_MEDIAN 2
@@ -1531,7 +1515,7 @@ typedef struct AVCodecContext
* - 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);
+ enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
/**
* DTG active format information (additional aspect ratio
@@ -1632,7 +1616,7 @@ typedef struct AVCodecContext
* - encoding: unused
* - decoding: Set by user.
*/
- uint8_t *(*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
+ uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
#endif
/**
@@ -1806,49 +1790,49 @@ typedef struct AVCodecContext
* - encoding: Set by user.
* - decoding: unused
*/
- int me_threshold;
+ int me_threshold;
/**
* Macroblock threshold below which the user specified macroblock types will be used.
* - encoding: Set by user.
* - decoding: unused
*/
- int mb_threshold;
+ int mb_threshold;
/**
* precision of the intra DC coefficient - 8
* - encoding: Set by user.
* - decoding: unused
*/
- int intra_dc_precision;
+ int intra_dc_precision;
/**
* noise vs. sse weight for the nsse comparsion function
* - encoding: Set by user.
* - decoding: unused
*/
- int nsse_weight;
+ int nsse_weight;
/**
* Number of macroblock rows at the top which are skipped.
* - encoding: unused
* - decoding: Set by user.
*/
- int skip_top;
+ int skip_top;
/**
* Number of macroblock rows at the bottom which are skipped.
* - encoding: unused
* - decoding: Set by user.
*/
- int skip_bottom;
+ int skip_bottom;
/**
* profile
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
- int profile;
+ int profile;
#define FF_PROFILE_UNKNOWN -99
#define FF_PROFILE_AAC_MAIN 0
#define FF_PROFILE_AAC_LOW 1
@@ -1860,7 +1844,7 @@ typedef struct AVCodecContext
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
- int level;
+ int level;
#define FF_LEVEL_UNKNOWN -99
/**
@@ -1868,7 +1852,7 @@ typedef struct AVCodecContext
* - encoding: unused
* - decoding: Set by user.
*/
- int lowres;
+ int lowres;
/**
* Bitstream width / height, may be different from width/height if lowres
@@ -2292,29 +2276,29 @@ 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);
/* ffdshow custom stuff (begin) */
-
+
/**
* minimum and maxminum quantizer for I frames. If 0, derived from qmin, i_quant_factor, i_quant_offset
* - encoding: set by user.
* - decoding: unused
*/
- int qmin_i, qmax_i;
+ int qmin_i,qmax_i;
/**
* minimum and maximum quantizer for B frames. If 0, derived from qmin, b_quant_factor, b_quant_offset
* - encoding: set by user.
* - decoding: unused
*/
- int qmin_b, qmax_b;
-
+ int qmin_b,qmax_b;
+
float postgain;
- int ac3mode, ac3lfe;
+ int ac3mode,ac3lfe;
int ac3channels[6];
int nal_length_size;
int vorbis_header_size[3];
int64_t granulepos;
int64_t *parserRtStart;
- void (*handle_user_data)(struct AVCodecContext *c, const uint8_t *buf, int buf_size);
+ void (*handle_user_data)(struct AVCodecContext *c,const uint8_t *buf,int buf_size);
int h264_has_to_drop_first_non_ref; // Workaround Haali's media splitter (http://forum.doom9.org/showthread.php?p=1226434#post1226434)
enum CorePNGFrameType corepng_frame_type;
@@ -2332,8 +2316,7 @@ typedef struct AVCodecContext
/**
* AVHWAccel.
*/
-typedef struct AVHWAccel
-{
+typedef struct AVHWAccel {
/**
* Name of the hardware accelerated codec.
* The name is globally unique among encoders and among decoders (but an
@@ -2423,8 +2406,7 @@ typedef struct AVHWAccel
/**
* AVCodec.
*/
-typedef struct AVCodec
-{
+typedef struct AVCodec {
/**
* Name of the codec implementation.
* The name is globally unique among encoders and among decoders (but an
@@ -2467,8 +2449,7 @@ typedef struct AVCodec
* four components are given, that's all.
* the last component is alpha
*/
-typedef struct AVPicture
-{
+typedef struct AVPicture {
uint8_t *data[4];
int linesize[4]; ///< number of bytes per line
} AVPicture;
@@ -2588,11 +2569,11 @@ enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum
FF_EXPORT int avcodec_thread_init(AVCodecContext *s, int thread_count);
FF_EXPORT void avcodec_thread_free(AVCodecContext *s);
-int avcodec_thread_execute(AVCodecContext *s, 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 avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int), void *arg, int *ret, int count);
+int avcodec_thread_execute(AVCodecContext *s, 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 avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
const char* avcodec_get_current_idct(AVCodecContext *avctx);
-void avcodec_get_encoder_info(AVCodecContext *avctx, int *xvid_build, int *divx_version, int *divx_build, int *lavc_build);
+void avcodec_get_encoder_info(AVCodecContext *avctx,int *xvid_build,int *divx_version,int *divx_build,int *lavc_build);
//FIXME func typedef
/**
@@ -2628,8 +2609,8 @@ FF_EXPORT int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
* @deprecated Use avcodec_decode_audio2() instead.
*/
attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
- int *frame_size_ptr,
- const uint8_t *buf, int buf_size);
+ int *frame_size_ptr,
+ const uint8_t *buf, int buf_size);
/**
* Decodes an audio frame from buf into samples.
@@ -2668,8 +2649,8 @@ attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *sa
* used or zero if no frame could be decompressed.
*/
FF_EXPORT int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
- int *frame_size_ptr,
- const uint8_t *buf, int buf_size);
+ int *frame_size_ptr,
+ const uint8_t *buf, int buf_size);
/**
* Decodes a video frame from buf into picture.
@@ -2706,8 +2687,8 @@ FF_EXPORT int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
* used or zero if no frame could be decompressed.
*/
FF_EXPORT int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
- int *got_picture_ptr,
- const uint8_t *buf, int buf_size);
+ int *got_picture_ptr,
+ const uint8_t *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
@@ -2799,8 +2780,7 @@ int av_get_bits_per_sample(enum CodecID codec_id);
int av_get_bits_per_sample_format(enum SampleFormat sample_fmt);
/* frame parsing */
-typedef struct AVCodecParserContext
-{
+typedef struct AVCodecParserContext {
void *priv_data;
struct AVCodecParser *parser;
int64_t frame_offset; /* offset of the current frame */
@@ -2926,8 +2906,7 @@ typedef struct AVCodecParserContext
int64_t last_pos;
} AVCodecParserContext;
-typedef struct AVCodecParser
-{
+typedef struct AVCodecParser {
int codec_ids[5]; /* several codec IDs are permitted */
int priv_data_size;
int (*parser_init)(AVCodecParserContext *s);
@@ -3048,7 +3027,7 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src,
* Pad image.
*/
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);
+ int padtop, int padbottom, int padleft, int padright, int *color);
unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
@@ -3099,12 +3078,11 @@ void av_log_ask_for_sample(void *avc, const char *msg);
/**
* Lock operation used by lockmgr
*/
-enum AVLockOp
-{
- AV_LOCK_CREATE, ///< Create a mutex
- AV_LOCK_OBTAIN, ///< Lock the mutex
- AV_LOCK_RELEASE, ///< Unlock the mutex
- AV_LOCK_DESTROY, ///< Free mutex resources
+enum AVLockOp {
+ AV_LOCK_CREATE, ///< Create a mutex
+ AV_LOCK_OBTAIN, ///< Lock the mutex
+ AV_LOCK_RELEASE, ///< Unlock the mutex
+ AV_LOCK_DESTROY, ///< Free mutex resources
};
/**
@@ -3129,7 +3107,7 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
* @return 0: no recovery point, 1:I-frame 2:Recovery Point SEI (GDR), 3:IDR, -1:error
*/
int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size, int *recovery_frame_cnt);
+ const uint8_t *buf, int buf_size, int *recovery_frame_cnt);
/* Media Player Classic - Homecinema specific functions */
FF_EXPORT int FFGetChannelMap(struct AVCodecContext* avctx);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c
index 2439c96e2..4337c84b3 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c
@@ -31,27 +31,25 @@
#include "get_bits.h"
#include "put_bits.h"
-const uint8_t ff_log2_run[32] =
-{
- 0, 0, 0, 0, 1, 1, 1, 1,
- 2, 2, 2, 2, 3, 3, 3, 3,
- 4, 4, 5, 5, 6, 6, 7, 7,
- 8, 9, 10, 11, 12, 13, 14, 15
+const uint8_t ff_log2_run[32]={
+ 0, 0, 0, 0, 1, 1, 1, 1,
+ 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 5, 5, 6, 6, 7, 7,
+ 8, 9,10,11,12,13,14,15
};
void align_put_bits(PutBitContext *s)
{
#ifdef ALT_BITSTREAM_WRITER
- put_bits(s, (- s->index) & 7, 0);
+ put_bits(s,( - s->index) & 7,0);
#else
- put_bits(s, s->bit_left & 7, 0);
+ put_bits(s,s->bit_left & 7,0);
#endif
}
void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
{
- while(*string)
- {
+ while(*string){
put_bits(pb, 8, *string);
string++;
}
@@ -61,26 +59,23 @@ void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
{
- int words = length >> 4;
- int bits = length & 15;
+ int words= length>>4;
+ int bits= length&15;
int i;
- if(length == 0) return;
+ if(length==0) return;
- if(CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7)
- {
- for(i = 0; i < words; i++) put_bits(pb, 16, AV_RB16(src + 2 * i));
- }
- else
- {
- for(i = 0; put_bits_count(pb) & 31; i++)
+ if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){
+ for(i=0; i<words; i++) put_bits(pb, 16, AV_RB16(src + 2*i));
+ }else{
+ for(i=0; put_bits_count(pb)&31; i++)
put_bits(pb, 8, src[i]);
flush_put_bits(pb);
- memcpy(put_bits_ptr(pb), src + i, 2 * words - i);
- skip_put_bytes(pb, 2 * words - i);
+ memcpy(put_bits_ptr(pb), src+i, 2*words-i);
+ skip_put_bytes(pb, 2*words-i);
}
- put_bits(pb, bits, AV_RB16(src + 2 * words) >> (16 - bits));
+ put_bits(pb, bits, AV_RB16(src + 2*words)>>(16-bits));
}
/* VLC decoding */
@@ -109,14 +104,13 @@ static int alloc_table(VLC *vlc, int size, int use_static)
int index;
index = vlc->table_size;
vlc->table_size += size;
- if(vlc->table_size > vlc->table_allocated)
- {
+ if (vlc->table_size > vlc->table_allocated) {
if(use_static)
abort(); //cant do anything, init_vlc() is used with too little memory
vlc->table_allocated += (1 << vlc->bits);
vlc->table = av_realloc(vlc->table,
sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
- if(!vlc->table)
+ if (!vlc->table)
return -1;
}
return index;
@@ -131,62 +125,56 @@ static int build_table(VLC *vlc, int table_nb_bits,
{
int i, j, k, n, table_size, table_index, nb, n1, index, code_prefix2, symbol;
uint32_t code;
- VLC_TYPE(*table)[2];
+ VLC_TYPE (*table)[2];
table_size = 1 << table_nb_bits;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
#ifdef DEBUG_VLC
- av_log(NULL, AV_LOG_DEBUG, "new table index=%d size=%d code_prefix=%x n=%d\n",
+ av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d code_prefix=%x n=%d\n",
table_index, table_size, code_prefix, n_prefix);
#endif
- if(table_index < 0)
+ if (table_index < 0)
return -1;
table = &vlc->table[table_index];
- for(i = 0; i < table_size; i++)
- {
+ for(i=0;i<table_size;i++) {
table[i][1] = 0; //bits
table[i][0] = -1; //codes
}
/* first pass: map codes and compute auxillary table sizes */
- for(i = 0; i < nb_codes; i++)
- {
+ for(i=0;i<nb_codes;i++) {
GET_DATA(n, bits, i, bits_wrap, bits_size);
GET_DATA(code, codes, i, codes_wrap, codes_size);
/* we accept tables with holes */
- if(n <= 0)
+ if (n <= 0)
continue;
- if(!symbols)
+ if (!symbols)
symbol = i;
else
GET_DATA(symbol, symbols, i, symbols_wrap, symbols_size);
#if defined(DEBUG_VLC) && 0
- av_log(NULL, AV_LOG_DEBUG, "i=%d n=%d code=0x%x\n", i, n, code);
+ av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code);
#endif
/* if code matches the prefix, it is in the table */
n -= n_prefix;
if(flags & INIT_VLC_LE)
- code_prefix2 = code & (n_prefix >= 32 ? 0xffffffff : (1 << n_prefix) - 1);
+ code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (1 << n_prefix)-1);
else
- code_prefix2 = code >> n;
- if(n > 0 && code_prefix2 == code_prefix)
- {
- if(n <= table_nb_bits)
- {
+ code_prefix2= code >> n;
+ if (n > 0 && code_prefix2 == code_prefix) {
+ if (n <= table_nb_bits) {
/* no need to add another table */
j = (code << (table_nb_bits - n)) & (table_size - 1);
nb = 1 << (table_nb_bits - n);
- for(k = 0; k < nb; k++)
- {
+ for(k=0;k<nb;k++) {
if(flags & INIT_VLC_LE)
- j = (code >> n_prefix) + (k << n);
+ j = (code >> n_prefix) + (k<<n);
#ifdef DEBUG_VLC
av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
j, i, n);
#endif
- if(table[j][1] /*bits*/ != 0)
- {
+ if (table[j][1] /*bits*/ != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
return -1;
}
@@ -194,18 +182,16 @@ static int build_table(VLC *vlc, int table_nb_bits,
table[j][0] = symbol;
j++;
}
- }
- else
- {
+ } else {
n -= table_nb_bits;
j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1);
#ifdef DEBUG_VLC
- av_log(NULL, AV_LOG_DEBUG, "%4x: n=%d (subtable)\n",
+ av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n",
j, n);
#endif
/* compute table size */
n1 = -table[j][1]; //bits
- if(n > n1)
+ if (n > n1)
n1 = n;
table[j][1] = -n1; //bits
}
@@ -213,14 +199,11 @@ static int build_table(VLC *vlc, int table_nb_bits,
}
/* second pass : fill auxillary tables recursively */
- for(i = 0; i < table_size; i++)
- {
+ for(i=0;i<table_size;i++) {
n = table[i][1]; //bits
- if(n < 0)
- {
+ if (n < 0) {
n = -n;
- if(n > table_nb_bits)
- {
+ if (n > table_nb_bits) {
n = table_nb_bits;
table[i][1] = -n; //bits
}
@@ -230,7 +213,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
symbols, symbols_wrap, symbols_size,
(flags & INIT_VLC_LE) ? (code_prefix | (i << n_prefix)) : ((code_prefix << table_nb_bits) | i),
n_prefix + table_nb_bits, flags);
- if(index < 0)
+ if (index < 0)
return -1;
/* note: realloc has been done, so reload tables */
table = &vlc->table[table_index];
@@ -268,40 +251,33 @@ static int build_table(VLC *vlc, int table_nb_bits,
with av_free_static(), 0 if free_vlc() will be used.
*/
int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
- const void *bits, int bits_wrap, int bits_size,
- const void *codes, int codes_wrap, int codes_size,
- const void *symbols, int symbols_wrap, int symbols_size,
- int flags)
+ const void *bits, int bits_wrap, int bits_size,
+ const void *codes, int codes_wrap, int codes_size,
+ const void *symbols, int symbols_wrap, int symbols_size,
+ int flags)
{
vlc->bits = nb_bits;
- if(flags & INIT_VLC_USE_NEW_STATIC)
- {
- if(vlc->table_size && vlc->table_size == vlc->table_allocated)
- {
+ if(flags & INIT_VLC_USE_NEW_STATIC){
+ if(vlc->table_size && vlc->table_size == vlc->table_allocated){
return 0;
- }
- else if(vlc->table_size)
- {
+ }else if(vlc->table_size){
abort(); // fatal error, we are called on a partially initialized table
}
- }
- else
- {
+ }else {
vlc->table = NULL;
vlc->table_allocated = 0;
vlc->table_size = 0;
}
#ifdef DEBUG_VLC
- av_log(NULL, AV_LOG_DEBUG, "build table nb_codes=%d\n", nb_codes);
+ av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes);
#endif
- if(build_table(vlc, nb_bits, nb_codes,
- bits, bits_wrap, bits_size,
- codes, codes_wrap, codes_size,
- symbols, symbols_wrap, symbols_size,
- 0, 0, flags) < 0)
- {
+ if (build_table(vlc, nb_bits, nb_codes,
+ bits, bits_wrap, bits_size,
+ codes, codes_wrap, codes_size,
+ symbols, symbols_wrap, symbols_size,
+ 0, 0, flags) < 0) {
av_freep(&vlc->table);
return -1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bytestream.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bytestream.h
index 4265b0bfd..b56f6ce74 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bytestream.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bytestream.h
@@ -42,14 +42,14 @@ static av_always_inline void bytestream_put_ ##name(uint8_t **b, const type valu
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)
+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)
+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
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.c
index 7b8369e38..cc0a7c225 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.c
@@ -30,24 +30,23 @@
#include "get_bits.h"
#include "cabac.h"
-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},
- { 95, 116, 137, 158}, { 90, 110, 130, 150}, { 85, 104, 123, 142}, { 81, 99, 117, 135},
- { 77, 94, 111, 128}, { 73, 89, 105, 122}, { 69, 85, 100, 116}, { 66, 80, 95, 110},
- { 62, 76, 90, 104}, { 59, 72, 86, 99}, { 56, 69, 81, 94}, { 53, 65, 77, 89},
- { 51, 62, 73, 85}, { 48, 59, 69, 80}, { 46, 56, 66, 76}, { 43, 53, 63, 72},
- { 41, 50, 59, 69}, { 39, 48, 56, 65}, { 37, 45, 54, 62}, { 35, 43, 51, 59},
- { 33, 41, 48, 56}, { 32, 39, 46, 53}, { 30, 37, 43, 50}, { 29, 35, 41, 48},
- { 27, 33, 39, 45}, { 26, 31, 37, 43}, { 24, 30, 35, 41}, { 23, 28, 33, 39},
- { 22, 27, 32, 37}, { 21, 26, 30, 35}, { 20, 24, 29, 33}, { 19, 23, 27, 31},
- { 18, 22, 26, 30}, { 17, 21, 25, 28}, { 16, 20, 23, 27}, { 15, 19, 22, 25},
- { 14, 18, 21, 24}, { 14, 17, 20, 23}, { 13, 16, 19, 22}, { 12, 15, 18, 21},
- { 12, 14, 17, 20}, { 11, 14, 16, 19}, { 11, 13, 15, 18}, { 10, 12, 15, 17},
- { 10, 12, 14, 16}, { 9, 11, 13, 15}, { 9, 11, 12, 14}, { 8, 10, 12, 14},
- { 8, 9, 11, 13}, { 7, 9, 11, 12}, { 7, 9, 10, 12}, { 7, 8, 10, 11},
- { 6, 8, 9, 11}, { 6, 7, 9, 10}, { 6, 7, 8, 9}, { 2, 2, 2, 2},
+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},
+{ 95,116,137,158}, { 90,110,130,150}, { 85,104,123,142}, { 81, 99,117,135},
+{ 77, 94,111,128}, { 73, 89,105,122}, { 69, 85,100,116}, { 66, 80, 95,110},
+{ 62, 76, 90,104}, { 59, 72, 86, 99}, { 56, 69, 81, 94}, { 53, 65, 77, 89},
+{ 51, 62, 73, 85}, { 48, 59, 69, 80}, { 46, 56, 66, 76}, { 43, 53, 63, 72},
+{ 41, 50, 59, 69}, { 39, 48, 56, 65}, { 37, 45, 54, 62}, { 35, 43, 51, 59},
+{ 33, 41, 48, 56}, { 32, 39, 46, 53}, { 30, 37, 43, 50}, { 29, 35, 41, 48},
+{ 27, 33, 39, 45}, { 26, 31, 37, 43}, { 24, 30, 35, 41}, { 23, 28, 33, 39},
+{ 22, 27, 32, 37}, { 21, 26, 30, 35}, { 20, 24, 29, 33}, { 19, 23, 27, 31},
+{ 18, 22, 26, 30}, { 17, 21, 25, 28}, { 16, 20, 23, 27}, { 15, 19, 22, 25},
+{ 14, 18, 21, 24}, { 14, 17, 20, 23}, { 13, 16, 19, 22}, { 12, 15, 18, 21},
+{ 12, 14, 17, 20}, { 11, 14, 16, 19}, { 11, 13, 15, 18}, { 10, 12, 15, 17},
+{ 10, 12, 14, 16}, { 9, 11, 13, 15}, { 9, 11, 12, 14}, { 8, 10, 12, 14},
+{ 8, 9, 11, 13}, { 7, 9, 11, 12}, { 7, 9, 10, 12}, { 7, 8, 10, 11},
+{ 6, 8, 9, 11}, { 6, 7, 9, 10}, { 6, 7, 8, 9}, { 2, 2, 2, 2},
};
uint8_t ff_h264_mlps_state[4*64];
@@ -55,67 +54,63 @@ uint8_t ff_h264_lps_range[4*2*64];
uint8_t ff_h264_lps_state[2*64];
uint8_t ff_h264_mps_state[2*64];
-static const uint8_t mps_state[64] =
-{
- 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, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 62, 63,
+static const uint8_t mps_state[64]= {
+ 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,43,44,45,46,47,48,
+ 49,50,51,52,53,54,55,56,
+ 57,58,59,60,61,62,62,63,
};
-static const uint8_t lps_state[64] =
-{
- 0, 0, 1, 2, 2, 4, 4, 5,
- 6, 7, 8, 9, 9, 11, 11, 12,
- 13, 13, 15, 15, 16, 16, 18, 18,
- 19, 19, 21, 21, 22, 22, 23, 24,
- 24, 25, 26, 26, 27, 27, 28, 29,
- 29, 30, 30, 30, 31, 32, 32, 33,
- 33, 33, 34, 34, 35, 35, 35, 36,
- 36, 36, 37, 37, 37, 38, 38, 63,
+static const uint8_t lps_state[64]= {
+ 0, 0, 1, 2, 2, 4, 4, 5,
+ 6, 7, 8, 9, 9,11,11,12,
+ 13,13,15,15,16,16,18,18,
+ 19,19,21,21,22,22,23,24,
+ 24,25,26,26,27,27,28,29,
+ 29,30,30,30,31,32,32,33,
+ 33,33,34,34,35,35,35,36,
+ 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,
+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,
};
/**
*
* @param buf_size size of buf in bits
*/
-void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size)
-{
+void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){
init_put_bits(&c->pb, buf, buf_size);
- c->low = 0;
- c->range = 0x1FE;
- c->outstanding_count = 0;
+ c->low= 0;
+ c->range= 0x1FE;
+ c->outstanding_count= 0;
#ifdef STRICT_LIMITS
- c->sym_count = 0;
+ c->sym_count =0;
#endif
c->pb.bit_left++; //avoids firstBitFlag
@@ -125,57 +120,48 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size)
*
* @param buf_size size of buf in bits
*/
-void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size)
-{
- c->bytestream_start =
- c->bytestream = buf;
- c->bytestream_end = buf + buf_size;
+void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
+ c->bytestream_start=
+ c->bytestream= buf;
+ c->bytestream_end= buf + buf_size;
#if CABAC_BITS == 16
- c->low = (*c->bytestream++) << 18;
- c->low += (*c->bytestream++) << 10;
+ c->low = (*c->bytestream++)<<18;
+ c->low+= (*c->bytestream++)<<10;
#else
- c->low = (*c->bytestream++) << 10;
+ c->low = (*c->bytestream++)<<10;
#endif
- c->low += ((*c->bytestream++) << 2) + 2;
- c->range = 0x1FE;
+ c->low+= ((*c->bytestream++)<<2) + 2;
+ c->range= 0x1FE;
}
-void ff_init_cabac_states(CABACContext *c)
-{
+void ff_init_cabac_states(CABACContext *c){
int i, j;
- for(i = 0; i < 64; i++)
- {
- for(j = 0; j < 4; j++) //FIXME check if this is worth the 1 shift we save
- {
- ff_h264_lps_range[j*2*64+2*i+0] =
- ff_h264_lps_range[j*2*64+2*i+1] = lps_range[i][j];
+ for(i=0; i<64; i++){
+ for(j=0; j<4; j++){ //FIXME check if this is worth the 1 shift we save
+ ff_h264_lps_range[j*2*64+2*i+0]=
+ ff_h264_lps_range[j*2*64+2*i+1]= lps_range[i][j];
}
- ff_h264_mlps_state[128+2*i+0] =
- ff_h264_mps_state[2*i+0] = 2 * mps_state[i] + 0;
- ff_h264_mlps_state[128+2*i+1] =
- ff_h264_mps_state[2*i+1] = 2 * mps_state[i] + 1;
+ ff_h264_mlps_state[128+2*i+0]=
+ ff_h264_mps_state[2*i+0]= 2*mps_state[i]+0;
+ ff_h264_mlps_state[128+2*i+1]=
+ ff_h264_mps_state[2*i+1]= 2*mps_state[i]+1;
- if(i)
- {
+ if( i ){
#ifdef BRANCHLESS_CABAC_DECODER
- ff_h264_mlps_state[128-2*i-1] = 2 * lps_state[i] + 0;
- ff_h264_mlps_state[128-2*i-2] = 2 * lps_state[i] + 1;
- }
- else
- {
- ff_h264_mlps_state[128-2*i-1] = 1;
- ff_h264_mlps_state[128-2*i-2] = 0;
+ ff_h264_mlps_state[128-2*i-1]= 2*lps_state[i]+0;
+ ff_h264_mlps_state[128-2*i-2]= 2*lps_state[i]+1;
+ }else{
+ ff_h264_mlps_state[128-2*i-1]= 1;
+ ff_h264_mlps_state[128-2*i-2]= 0;
#else
- ff_h264_lps_state[2*i+0] = 2 * lps_state[i] + 0;
- ff_h264_lps_state[2*i+1] = 2 * lps_state[i] + 1;
- }
- else
- {
- ff_h264_lps_state[2*i+0] = 1;
- ff_h264_lps_state[2*i+1] = 0;
+ ff_h264_lps_state[2*i+0]= 2*lps_state[i]+0;
+ ff_h264_lps_state[2*i+1]= 2*lps_state[i]+1;
+ }else{
+ ff_h264_lps_state[2*i+0]= 1;
+ ff_h264_lps_state[2*i+1]= 0;
#endif
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.h
index 6fb6fdcff..16b0dc079 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cabac.h
@@ -38,8 +38,7 @@
#define BRANCHLESS_CABAC_DECODER 1
//#define ARCH_X86_DISABLED 1
-typedef struct CABACContext
-{
+typedef struct CABACContext{
int low;
int range;
int outstanding_count;
@@ -50,7 +49,7 @@ typedef struct CABACContext
const uint8_t *bytestream;
const uint8_t *bytestream_end;
PutBitContext pb;
-} CABACContext;
+}CABACContext;
extern uint8_t ff_h264_mlps_state[4*64];
extern uint8_t ff_h264_lps_range[4*2*64]; ///< rangeTabLPS
@@ -64,85 +63,71 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
void ff_init_cabac_states(CABACContext *c);
-static inline void put_cabac_bit(CABACContext *c, int b)
-{
+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);
+ 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)
- {
+static inline void renorm_cabac_encoder(CABACContext *c){
+ while(c->range < 0x100){
//FIXME optimize
- if(c->low < 0x100)
- {
+ if(c->low<0x100){
put_cabac_bit(c, 0);
- }
- else if(c->low < 0x200)
- {
+ }else if(c->low<0x200){
c->outstanding_count++;
c->low -= 0x100;
- }
- else
- {
+ }else{
put_cabac_bit(c, 1);
c->low -= 0x200;
}
- c->range += c->range;
+ c->range+= c->range;
c->low += c->low;
}
}
-static void refill(CABACContext *c)
-{
+static void refill(CABACContext *c){
#if CABAC_BITS == 16
- c->low += (c->bytestream[0] << 9) + (c->bytestream[1] << 1);
+ c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
#else
- c->low += c->bytestream[0] << 1;
+ c->low+= c->bytestream[0]<<1;
#endif
c->low -= CABAC_MASK;
- c->bytestream += CABAC_BITS / 8;
+ c->bytestream+= CABAC_BITS/8;
}
#if ! ( ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) )
-static void refill2(CABACContext *c)
-{
+static void refill2(CABACContext *c){
int i, x;
- x = c->low ^(c->low - 1);
- i = 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)];
+ x= c->low ^ (c->low-1);
+ i= 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)];
- x = -CABAC_MASK;
+ x= -CABAC_MASK;
#if CABAC_BITS == 16
- x += (c->bytestream[0] << 9) + (c->bytestream[1] << 1);
+ x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
#else
- x += c->bytestream[0] << 1;
+ x+= c->bytestream[0]<<1;
#endif
- c->low += x << i;
- c->bytestream += CABAC_BITS / 8;
+ c->low += x<<i;
+ c->bytestream+= CABAC_BITS/8;
}
#endif
-static inline void renorm_cabac_decoder(CABACContext *c)
-{
- while(c->range < 0x100)
- {
- c->range += c->range;
- c->low += c->low;
+static inline void renorm_cabac_decoder(CABACContext *c){
+ while(c->range < 0x100){
+ c->range+= c->range;
+ c->low+= c->low;
if(!(c->low & CABAC_MASK))
refill(c);
}
}
-static inline void renorm_cabac_decoder_once(CABACContext *c)
-{
+static inline void renorm_cabac_decoder_once(CABACContext *c){
#ifdef ARCH_X86_DISABLED
int temp;
#if 0
@@ -203,27 +188,26 @@ static inline void renorm_cabac_decoder_once(CABACContext *c)
#endif
#else
//P3:675 athlon:476
- int shift = (uint32_t)(c->range - 0x100) >> 31;
- c->range <<= shift;
+ int shift= (uint32_t)(c->range - 0x100)>>31;
+ c->range<<= shift;
c->low <<= shift;
#endif
if(!(c->low & CABAC_MASK))
refill(c);
}
-static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const state)
-{
+static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const state){
//FIXME gcc generates duplicate load/stores for c->low and c->range
#define LOW "0"
#define RANGE "4"
#if ARCH_X86_64
#define BYTESTART "16"
- /* rename BYTE because GCC doesn't like it */
+/* rename BYTE because GCC doesn't like it */
#define FFBYTE "24"
#define BYTEEND "32"
#else
#define BYTESTART "12"
- /* rename BYTE because GCC doesn't like it */
+/* rename BYTE because GCC doesn't like it */
#define FFBYTE "16"
#define BYTEEND "20"
#endif
@@ -309,7 +293,7 @@ static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const st
:"r"(state), "r"(c)
: "%"REG_c, "%ebx", "%edx", "%"REG_S, "memory"
);
- bit &= 1;
+ bit&=1;
#else /* BRANCHLESS_CABAC_DECODER */
@@ -381,47 +365,43 @@ static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const st
:"r"(state), "r"(c)
: "%"REG_c, "%ebx", "%edx", "%esi", "memory"
);
- bit &= 1;
+ bit&=1;
#endif /* BRANCHLESS_CABAC_DECODER */
#else /* ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) */
int s = *state;
- int RangeLPS = ff_h264_lps_range[2*(c->range&0xC0) + s];
+ int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s];
int bit, lps_mask av_unused;
c->range -= RangeLPS;
#ifndef BRANCHLESS_CABAC_DECODER
- if(c->low < (c->range << (CABAC_BITS + 1)))
- {
- bit = s & 1;
- *state = ff_h264_mps_state[s];
+ if(c->low < (c->range<<(CABAC_BITS+1))){
+ bit= s&1;
+ *state= ff_h264_mps_state[s];
renorm_cabac_decoder_once(c);
- }
- else
- {
- bit = ff_h264_norm_shift[RangeLPS];
- c->low -= (c->range << (CABAC_BITS + 1));
- *state = ff_h264_lps_state[s];
- c->range = RangeLPS << bit;
+ }else{
+ bit= ff_h264_norm_shift[RangeLPS];
+ c->low -= (c->range<<(CABAC_BITS+1));
+ *state= ff_h264_lps_state[s];
+ c->range = RangeLPS<<bit;
c->low <<= bit;
- bit = (s & 1) ^ 1;
+ bit= (s&1)^1;
- if(!(c->low & CABAC_MASK))
- {
+ if(!(c->low & CABAC_MASK)){
refill2(c);
}
}
#else /* BRANCHLESS_CABAC_DECODER */
- lps_mask = ((c->range << (CABAC_BITS + 1)) - c->low) >> 31;
+ lps_mask= ((c->range<<(CABAC_BITS+1)) - c->low)>>31;
- c->low -= (c->range << (CABAC_BITS + 1)) & lps_mask;
+ c->low -= (c->range<<(CABAC_BITS+1)) & lps_mask;
c->range += (RangeLPS - c->range) & lps_mask;
- s ^= lps_mask;
- *state = (ff_h264_mlps_state + 128)[s];
- bit = s & 1;
+ s^=lps_mask;
+ *state= (ff_h264_mlps_state+128)[s];
+ bit= s&1;
- lps_mask = ff_h264_norm_shift[c->range];
- c->range <<= lps_mask;
+ lps_mask= ff_h264_norm_shift[c->range];
+ c->range<<= lps_mask;
c->low <<= lps_mask;
if(!(c->low & CABAC_MASK))
refill2(c);
@@ -430,18 +410,15 @@ static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const st
return bit;
}
-static int av_noinline av_unused get_cabac_noinline(CABACContext *c, uint8_t * const state)
-{
- return get_cabac_inline(c, state);
+static int av_noinline av_unused get_cabac_noinline(CABACContext *c, uint8_t * const state){
+ return get_cabac_inline(c,state);
}
-static int av_unused get_cabac(CABACContext *c, uint8_t * const state)
-{
- return get_cabac_inline(c, state);
+static int av_unused get_cabac(CABACContext *c, uint8_t * const state){
+ return get_cabac_inline(c,state);
}
-static int av_unused get_cabac_bypass(CABACContext *c)
-{
+static int av_unused get_cabac_bypass(CABACContext *c){
#if 0 //not faster
int bit;
__asm__ volatile(
@@ -470,7 +447,7 @@ static int av_unused get_cabac_bypass(CABACContext *c)
:"r"(c)
: "%eax", "%"REG_b, "%ecx", "memory"
);
- return bit + 1;
+ return bit+1;
#else
int range;
c->low += c->low;
@@ -478,13 +455,10 @@ static int av_unused get_cabac_bypass(CABACContext *c)
if(!(c->low & CABAC_MASK))
refill(c);
- range = c->range << (CABAC_BITS + 1);
- if(c->low < range)
- {
+ range= c->range<<(CABAC_BITS+1);
+ if(c->low < range){
return 0;
- }
- else
- {
+ }else{
c->low -= range;
return 1;
}
@@ -492,8 +466,7 @@ static int av_unused get_cabac_bypass(CABACContext *c)
}
-static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val)
-{
+static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
#if ARCH_X86 && HAVE_EBX_AVAILABLE
__asm__ volatile(
"movl "RANGE "(%1), %%ebx \n\t"
@@ -531,12 +504,12 @@ static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val)
if(!(c->low & CABAC_MASK))
refill(c);
- range = c->range << (CABAC_BITS + 1);
+ range= c->range<<(CABAC_BITS+1);
c->low -= range;
- mask = c->low >> 31;
+ mask= c->low >> 31;
range &= mask;
c->low += range;
- return (val ^ mask) - mask;
+ return (val^mask)-mask;
#endif
}
@@ -544,16 +517,12 @@ static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val)
*
* @return the number of bytes read or 0 if no end
*/
-static int av_unused get_cabac_terminate(CABACContext *c)
-{
+static int av_unused get_cabac_terminate(CABACContext *c){
c->range -= 2;
- if(c->low < c->range << (CABAC_BITS + 1))
- {
+ if(c->low < c->range<<(CABAC_BITS+1)){
renorm_cabac_decoder_once(c);
return 0;
- }
- else
- {
+ }else{
return c->bytestream - c->bytestream_start;
}
}
@@ -562,16 +531,14 @@ static int av_unused get_cabac_terminate(CABACContext *c)
/**
* Get (truncated) unary binarization.
*/
-static int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated)
-{
+static int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated){
int i;
- for(i = 0; i < max; i++)
- {
- if(get_cabac(c, state) == 0)
+ for(i=0; i<max; i++){
+ if(get_cabac(c, state)==0)
return i;
- if(i < max_index) state++;
+ if(i< max_index) state++;
}
return truncated ? max : -1;
@@ -580,49 +547,40 @@ static int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index,
/**
* get unary exp golomb k-th order binarization.
*/
-static int get_cabac_ueg(CABACContext *c, uint8_t * state, int max, int is_signed, int k, int max_index)
-{
+static int get_cabac_ueg(CABACContext *c, uint8_t * state, int max, int is_signed, int k, int max_index){
int i, v;
- int m = 1 << k;
+ int m= 1<<k;
- if(get_cabac(c, state) == 0)
+ if(get_cabac(c, state)==0)
return 0;
if(0 < max_index) state++;
- for(i = 1; i < max; i++)
- {
- if(get_cabac(c, state) == 0)
- {
- if(is_signed && get_cabac_bypass(c))
- {
+ for(i=1; i<max; i++){
+ if(get_cabac(c, state)==0){
+ if(is_signed && get_cabac_bypass(c)){
return -i;
- }
- else
+ }else
return i;
}
if(i < max_index) state++;
}
- while(get_cabac_bypass(c))
- {
- i += m;
- m += m;
+ while(get_cabac_bypass(c)){
+ i+= m;
+ m+= m;
}
- v = 0;
- while(m >>= 1)
- {
- v += v + get_cabac_bypass(c);
+ v=0;
+ while(m>>=1){
+ v+= v + get_cabac_bypass(c);
}
i += v;
- if(is_signed && get_cabac_bypass(c))
- {
+ if(is_signed && get_cabac_bypass(c)){
return -i;
- }
- else
+ }else
return i;
}
#endif /* 0 */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cook.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cook.c
index 55aa0ba6f..58a7cc74b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cook.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cook.c
@@ -64,14 +64,12 @@
#define SUBBAND_SIZE 20
#define MAX_SUBPACKETS 5
-typedef struct
-{
+typedef struct {
int *now;
int *previous;
} cook_gains;
-typedef struct
-{
+typedef struct {
int ch_idx;
int size;
int num_channels;
@@ -101,8 +99,7 @@ typedef struct
int gain_4[9];
} COOKSubpacket;
-typedef struct cook
-{
+typedef struct cook {
/*
* The following 5 functions provide the lowlevel arithmetic on
* the internal audio buffers.
@@ -111,20 +108,20 @@ typedef struct cook
int* subband_coef_index, int* subband_coef_sign,
float* mlt_p);
- void (* decouple)(struct cook *q,
- COOKSubpacket *p,
- int subband,
- float f1, float f2,
- float *decode_buffer,
- float *mlt_buffer1, float *mlt_buffer2);
+ void (* decouple) (struct cook *q,
+ COOKSubpacket *p,
+ int subband,
+ float f1, float f2,
+ float *decode_buffer,
+ float *mlt_buffer1, float *mlt_buffer2);
- void (* imlt_window)(struct cook *q, float *buffer1,
- cook_gains *gains_ptr, float *previous_buffer);
+ void (* imlt_window) (struct cook *q, float *buffer1,
+ cook_gains *gains_ptr, float *previous_buffer);
- void (* interpolate)(struct cook *q, float* buffer,
- int gain_index, int gain_index_next);
+ void (* interpolate) (struct cook *q, float* buffer,
+ int gain_index, int gain_index_next);
- void (* saturate_output)(struct cook *q, int chan, int16_t *out);
+ void (* saturate_output) (struct cook *q, int chan, int16_t *out);
AVCodecContext* avctx;
GetBitContext gb;
@@ -152,7 +149,7 @@ typedef struct cook
/* data buffers */
uint8_t* decoded_bytes_buffer;
- DECLARE_ALIGNED_16(float, mono_mdct_output)[2048];
+ DECLARE_ALIGNED_16(float,mono_mdct_output)[2048];
float decode_buffer_1[1024];
float decode_buffer_2[1024];
float decode_buffer_0[1060]; /* static allocation for joint decode */
@@ -168,99 +165,87 @@ static float rootpow2tab[127];
/*************** init functions ***************/
/* table generator */
-static av_cold void init_pow2table(void)
-{
+static av_cold void init_pow2table(void){
int i;
- for(i = -63 ; i < 64 ; i++)
- {
- pow2tab[63+i] = pow(2, i);
- rootpow2tab[63+i] = sqrt(pow(2, i));
+ for (i=-63 ; i<64 ; i++){
+ pow2tab[63+i]= pow(2, i);
+ rootpow2tab[63+i]=sqrt(pow(2, i));
}
}
/* table generator */
-static av_cold void init_gain_table(COOKContext *q)
-{
+static av_cold void init_gain_table(COOKContext *q) {
int i;
- q->gain_size_factor = q->samples_per_channel / 8;
- for(i = 0 ; i < 23 ; i++)
- {
+ q->gain_size_factor = q->samples_per_channel/8;
+ for (i=0 ; i<23 ; i++) {
q->gain_table[i] = pow(pow2tab[i+52] ,
- (1.0 / (double)q->gain_size_factor));
+ (1.0/(double)q->gain_size_factor));
}
}
-static av_cold int init_cook_vlc_tables(COOKContext *q)
-{
+static av_cold int init_cook_vlc_tables(COOKContext *q) {
int i, result;
result = 0;
- for(i = 0 ; i < 13 ; i++)
- {
- result |= init_vlc(&q->envelope_quant_index[i], 9, 24,
- envelope_quant_index_huffbits[i], 1, 1,
- envelope_quant_index_huffcodes[i], 2, 2, 0);
+ for (i=0 ; i<13 ; i++) {
+ result |= init_vlc (&q->envelope_quant_index[i], 9, 24,
+ envelope_quant_index_huffbits[i], 1, 1,
+ envelope_quant_index_huffcodes[i], 2, 2, 0);
}
- av_log(q->avctx, AV_LOG_DEBUG, "sqvh VLC init\n");
- for(i = 0 ; i < 7 ; i++)
- {
- result |= init_vlc(&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i],
- cvh_huffbits[i], 1, 1,
- cvh_huffcodes[i], 2, 2, 0);
+ av_log(q->avctx,AV_LOG_DEBUG,"sqvh VLC init\n");
+ for (i=0 ; i<7 ; i++) {
+ result |= init_vlc (&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i],
+ cvh_huffbits[i], 1, 1,
+ cvh_huffcodes[i], 2, 2, 0);
}
- 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,
- 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);
+ 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,
+ 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);
}
}
- av_log(q->avctx, AV_LOG_DEBUG, "VLC tables initialized.\n");
+ av_log(q->avctx,AV_LOG_DEBUG,"VLC tables initialized.\n");
return result;
}
-static av_cold int init_cook_mlt(COOKContext *q)
-{
+static av_cold int init_cook_mlt(COOKContext *q) {
int j;
int mlt_size = q->samples_per_channel;
- if((q->mlt_window = av_malloc(sizeof(float) * mlt_size)) == 0)
- return -1;
+ if ((q->mlt_window = av_malloc(sizeof(float)*mlt_size)) == 0)
+ return -1;
/* Initialize the MLT window: simple sine window. */
ff_sine_window_init(q->mlt_window, mlt_size);
- for(j = 0 ; j < mlt_size ; j++)
+ for(j=0 ; j<mlt_size ; j++)
q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
/* Initialize the MDCT. */
- if(ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size) + 1, 1, 1.0))
- {
- av_free(q->mlt_window);
- return -1;
+ if (ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size)+1, 1, 1.0)) {
+ av_free(q->mlt_window);
+ return -1;
}
- av_log(q->avctx, AV_LOG_DEBUG, "MDCT initialized, order = %d.\n",
- av_log2(mlt_size) + 1);
+ av_log(q->avctx,AV_LOG_DEBUG,"MDCT initialized, order = %d.\n",
+ av_log2(mlt_size)+1);
return 0;
}
-static const float *maybe_reformat_buffer32(COOKContext *q, const float *ptr, int n)
+static const float *maybe_reformat_buffer32 (COOKContext *q, const float *ptr, int n)
{
- if(1)
+ if (1)
return ptr;
}
-static av_cold void init_cplscales_table(COOKContext *q)
-{
+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);
+ for (i=0;i<5;i++)
+ q->cplscales[i] = maybe_reformat_buffer32 (q, cplscales[i], (1<<(i+2))-1);
}
/*************** init functions end ***********/
@@ -288,8 +273,7 @@ static av_cold void init_cplscales_table(COOKContext *q)
#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes)+3) % 4)
#define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
-static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes)
-{
+static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
int i, off;
uint32_t c;
const uint32_t* buf;
@@ -301,10 +285,10 @@ static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes)
* Buffer alignment needs to be checked. */
off = (intptr_t)inbuffer & 3;
- buf = (const uint32_t*)(inbuffer - off);
- c = be2me_32((0x37c511f2 >> (off * 8)) | (0x37c511f2 << (32 - (off * 8))));
+ buf = (const uint32_t*) (inbuffer - off);
+ c = be2me_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
bytes += 3 + off;
- for(i = 0; i < bytes / 4; i++)
+ for (i = 0; i < bytes/4; i++)
obuf[i] = c ^ buf[i];
return off;
@@ -318,7 +302,7 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
{
int i;
COOKContext *q = avctx->priv_data;
- av_log(avctx, AV_LOG_DEBUG, "Deallocating memory.\n");
+ av_log(avctx,AV_LOG_DEBUG, "Deallocating memory.\n");
/* Free allocated memory buffers. */
av_free(q->mlt_window);
@@ -328,20 +312,17 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
ff_mdct_end(&q->mdct_ctx);
/* Free the VLC tables. */
- for(i = 0 ; i < 13 ; i++)
- {
+ for (i=0 ; i<13 ; i++) {
free_vlc(&q->envelope_quant_index[i]);
}
- for(i = 0 ; i < 7 ; i++)
- {
+ for (i=0 ; i<7 ; i++) {
free_vlc(&q->sqvh[i]);
}
- for(i = 0 ; i < q->num_subpackets ; i++)
- {
+ for (i=0 ; i<q->num_subpackets ; i++) {
free_vlc(&q->subpacket[i].ccpl);
}
- av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n");
+ av_log(avctx,AV_LOG_DEBUG,"Memory deallocated.\n");
return 0;
}
@@ -357,18 +338,17 @@ static void decode_gain_info(GetBitContext *gb, int *gaininfo)
{
int i, n;
- while(get_bits1(gb)) {}
+ while (get_bits1(gb)) {}
n = get_bits_count(gb) - 1; //amount of elements*2 to update
i = 0;
- while(n--)
- {
+ while (n--) {
int index = get_bits(gb, 3);
int gain = get_bits1(gb) ? get_bits(gb, 4) - 7 : -1;
- while(i <= index) gaininfo[i++] = gain;
+ while (i <= index) gaininfo[i++] = gain;
}
- while(i <= 8) gaininfo[i++] = 0;
+ while (i <= 8) gaininfo[i++] = 0;
}
/**
@@ -378,28 +358,23 @@ static void decode_gain_info(GetBitContext *gb, int *gaininfo)
* @param quant_index_table pointer to the array
*/
-static void decode_envelope(COOKContext *q, COOKSubpacket *p, int* quant_index_table)
-{
- int i, j, vlc_index;
+static void decode_envelope(COOKContext *q, COOKSubpacket *p, int* quant_index_table) {
+ int i,j, vlc_index;
- quant_index_table[0] = get_bits(&q->gb, 6) - 6; //This is used later in categorize
+ quant_index_table[0]= get_bits(&q->gb,6) - 6; //This is used later in categorize
- for(i = 1 ; i < p->total_subbands ; i++)
- {
- vlc_index = i;
- if(i >= p->js_subband_start * 2)
- {
- vlc_index -= p->js_subband_start;
- }
- else
- {
- vlc_index /= 2;
+ for (i=1 ; i < p->total_subbands ; i++){
+ vlc_index=i;
+ if (i >= p->js_subband_start * 2) {
+ vlc_index-=p->js_subband_start;
+ } else {
+ vlc_index/=2;
if(vlc_index < 1) vlc_index = 1;
}
- if(vlc_index > 13) vlc_index = 13; //the VLC tables >13 are identical to No. 13
+ if (vlc_index>13) vlc_index = 13; //the VLC tables >13 are identical to No. 13
j = get_vlc2(&q->gb, q->envelope_quant_index[vlc_index-1].table,
- q->envelope_quant_index[vlc_index-1].bits, 2);
+ q->envelope_quant_index[vlc_index-1].bits,2);
quant_index_table[i] = quant_index_table[i-1] + j - 12; //differential encoding
}
}
@@ -414,52 +389,46 @@ static void decode_envelope(COOKContext *q, COOKSubpacket *p, int* quant_index_t
*/
static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table,
- int* category, int* category_index)
-{
+ 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 tmp_categorize_array[128*2];
- int tmp_categorize_array1_idx = p->numvector_size;
- int tmp_categorize_array2_idx = p->numvector_size;
+ 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;
+ ((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, 102 * sizeof(int));
- memset(&exp_index2, 0, 102 * sizeof(int));
- memset(&tmp_categorize_array, 0, 128 * 2 * sizeof(int));
+ memset(&exp_index1,0,102*sizeof(int));
+ memset(&exp_index2,0,102*sizeof(int));
+ memset(&tmp_categorize_array,0,128*2*sizeof(int));
- bias = -32;
+ bias=-32;
/* Estimate bias. */
- for(i = 32 ; i > 0 ; i = i / 2)
- {
+ for (i=32 ; i>0 ; i=i/2){
num_bits = 0;
index = 0;
- for(j = p->total_subbands ; j > 0 ; j--)
- {
+ for (j=p->total_subbands ; j>0 ; j--){
exp_idx = av_clip((i - quant_index_table[index] + bias) / 2, 0, 7);
index++;
- num_bits += expbits_tab[exp_idx];
+ num_bits+=expbits_tab[exp_idx];
}
- if(num_bits >= bits_left - 32)
- {
- bias += i;
+ if(num_bits >= bits_left - 32){
+ bias+=i;
}
}
/* Calculate total number of bits. */
- num_bits = 0;
- for(i = 0 ; i < p->total_subbands ; i++)
- {
+ num_bits=0;
+ for (i=0 ; i<p->total_subbands ; i++) {
exp_idx = av_clip((bias - quant_index_table[i]) / 2, 0, 7);
num_bits += expbits_tab[exp_idx];
exp_index1[i] = exp_idx;
@@ -467,41 +436,31 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table,
}
tmpbias1 = tmpbias2 = num_bits;
- for(j = 1 ; j < p->numvector_size ; j++)
- {
- if(tmpbias1 + tmpbias2 > 2 * bits_left) /* ---> */
- {
+ for (j = 1 ; j < p->numvector_size ; j++) {
+ if (tmpbias1 + tmpbias2 > 2*bits_left) { /* ---> */
int max = -999999;
- index = -1;
- for(i = 0 ; i < p->total_subbands ; i++)
- {
- if(exp_index1[i] < 7)
- {
- v = (-2 * exp_index1[i]) - quant_index_table[i] + bias;
- if(v >= max)
- {
+ index=-1;
+ for (i=0 ; i<p->total_subbands ; i++){
+ if (exp_index1[i] < 7) {
+ v = (-2*exp_index1[i]) - quant_index_table[i] + bias;
+ if ( v >= max) {
max = v;
index = i;
}
}
}
- if(index == -1)break;
+ if(index==-1)break;
tmp_categorize_array[tmp_categorize_array1_idx++] = index;
tmpbias1 -= expbits_tab[exp_index1[index]] -
- expbits_tab[exp_index1[index] + 1];
+ expbits_tab[exp_index1[index]+1];
++exp_index1[index];
- }
- else /* <--- */
- {
+ } else { /* <--- */
int min = 999999;
- index = -1;
- for(i = 0 ; i < p->total_subbands ; i++)
- {
- if(exp_index2[i] > 0)
- {
- v = (-2 * exp_index2[i]) - quant_index_table[i] + bias;
- if(v < min)
- {
+ index=-1;
+ for (i=0 ; i<p->total_subbands ; i++){
+ if(exp_index2[i] > 0){
+ v = (-2*exp_index2[i])-quant_index_table[i]+bias;
+ if ( v < min) {
min = v;
index = i;
}
@@ -510,15 +469,15 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table,
if(index == -1)break;
tmp_categorize_array[--tmp_categorize_array2_idx] = index;
tmpbias2 -= expbits_tab[exp_index2[index]] -
- expbits_tab[exp_index2[index] - 1];
+ expbits_tab[exp_index2[index]-1];
--exp_index2[index];
}
}
- for(i = 0 ; i < p->total_subbands ; i++)
+ for(i=0 ; i<p->total_subbands ; i++)
category[i] = exp_index2[i];
- for(i = 0 ; i < p->numvector_size - 1 ; i++)
+ for(i=0 ; i<p->numvector_size-1 ; i++)
category_index[i] = tmp_categorize_array[tmp_categorize_array2_idx++];
}
@@ -533,11 +492,9 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table,
*/
static inline void expand_category(COOKContext *q, int* category,
- int* category_index)
-{
+ int* category_index){
int i;
- for(i = 0 ; i < q->num_vectors ; i++)
- {
+ for(i=0 ; i<q->num_vectors ; i++){
++category[category_index[i]];
}
}
@@ -554,24 +511,19 @@ static inline void expand_category(COOKContext *q, int* category,
*/
static void scalar_dequant_float(COOKContext *q, int index, int quant_index,
- int* subband_coef_index, int* subband_coef_sign,
- float* mlt_p)
-{
+ int* subband_coef_index, int* subband_coef_sign,
+ float* mlt_p){
int i;
float f1;
- for(i = 0 ; i < SUBBAND_SIZE ; i++)
- {
- if(subband_coef_index[i])
- {
+ for(i=0 ; i<SUBBAND_SIZE ; i++) {
+ if (subband_coef_index[i]) {
f1 = quant_centroid_tab[index][subband_coef_index[i]];
- if(subband_coef_sign[i]) f1 = -f1;
- }
- else
- {
+ if (subband_coef_sign[i]) f1 = -f1;
+ } else {
/* noise coding if subband_coef_index[i] == 0 */
f1 = dither_tab[index];
- if(av_lfg_get(&q->random_state) < 0x80000000) f1 = -f1;
+ if (av_lfg_get(&q->random_state) < 0x80000000) f1 = -f1;
}
mlt_p[i] = f1 * rootpow2tab[quant_index+63];
}
@@ -586,44 +538,33 @@ static void scalar_dequant_float(COOKContext *q, int index, int quant_index,
*/
static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, int* subband_coef_index,
- int* subband_coef_sign)
-{
- int i, j;
- int vlc, vd , tmp, result;
+ int* subband_coef_sign) {
+ int i,j;
+ int vlc, vd ,tmp, result;
vd = vd_tab[category];
result = 0;
- for(i = 0 ; i < vpr_tab[category] ; i++)
- {
+ for(i=0 ; i<vpr_tab[category] ; i++){
vlc = get_vlc2(&q->gb, q->sqvh[category].table, q->sqvh[category].bits, 3);
- if(p->bits_per_subpacket < get_bits_count(&q->gb))
- {
+ if (p->bits_per_subpacket < get_bits_count(&q->gb)){
vlc = 0;
result = 1;
}
- for(j = vd - 1 ; j >= 0 ; j--)
- {
- tmp = (vlc * invradix_tab[category]) / 0x100000;
- subband_coef_index[vd*i+j] = vlc - tmp * (kmax_tab[category] + 1);
+ for(j=vd-1 ; j>=0 ; j--){
+ tmp = (vlc * invradix_tab[category])/0x100000;
+ subband_coef_index[vd*i+j] = vlc - tmp * (kmax_tab[category]+1);
vlc = tmp;
}
- for(j = 0 ; j < vd ; j++)
- {
- if(subband_coef_index[i*vd + j])
- {
- if(get_bits_count(&q->gb) < p->bits_per_subpacket)
- {
+ for(j=0 ; j<vd ; j++){
+ if (subband_coef_index[i*vd + j]) {
+ if(get_bits_count(&q->gb) < p->bits_per_subpacket){
subband_coef_sign[i*vd+j] = get_bits1(&q->gb);
+ } else {
+ result=1;
+ subband_coef_sign[i*vd+j]=0;
}
- else
- {
- result = 1;
- subband_coef_sign[i*vd+j] = 0;
- }
- }
- else
- {
- subband_coef_sign[i*vd+j] = 0;
+ } else {
+ subband_coef_sign[i*vd+j]=0;
}
}
}
@@ -642,8 +583,7 @@ static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, int* subb
static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category,
- int *quant_index_table, float* mlt_buffer)
-{
+ int *quant_index_table, float* mlt_buffer){
/* A zero in this table means that the subband coefficient is
random noise coded. */
int subband_coef_index[SUBBAND_SIZE];
@@ -651,21 +591,17 @@ static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category,
positive multiplicator. */
int subband_coef_sign[SUBBAND_SIZE];
int band, j;
- int index = 0;
+ int index=0;
- for(band = 0 ; band < p->total_subbands ; band++)
- {
+ for(band=0 ; band<p->total_subbands ; band++){
index = category[band];
- if(category[band] < 7)
- {
- if(unpack_SQVH(q, p, category[band], subband_coef_index, subband_coef_sign))
- {
- index = 7;
- for(j = 0 ; j < p->total_subbands ; j++) category[band+j] = 7;
+ if(category[band] < 7){
+ if(unpack_SQVH(q, p, category[band], subband_coef_index, subband_coef_sign)){
+ index=7;
+ for(j=0 ; j<p->total_subbands ; j++) category[band+j]=7;
}
}
- if(index >= 7)
- {
+ if(index>=7) {
memset(subband_coef_index, 0, sizeof(subband_coef_index));
memset(subband_coef_sign, 0, sizeof(subband_coef_sign));
}
@@ -674,8 +610,7 @@ static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category,
&mlt_buffer[band * SUBBAND_SIZE]);
}
- if(p->total_subbands*SUBBAND_SIZE >= q->samples_per_channel)
- {
+ if(p->total_subbands*SUBBAND_SIZE >= q->samples_per_channel){
return;
} /* FIXME: should this be removed, or moved into loop above? */
}
@@ -688,18 +623,17 @@ static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category,
* @param mlt_buffer pointer to mlt coefficients
*/
-static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer)
-{
+static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer) {
int category_index[128];
int quant_index_table[102];
int category[128];
- memset(&category, 0, 128 * sizeof(int));
- memset(&category_index, 0, 128 * sizeof(int));
+ memset(&category, 0, 128*sizeof(int));
+ memset(&category_index, 0, 128*sizeof(int));
decode_envelope(q, p, quant_index_table);
- q->num_vectors = get_bits(&q->gb, p->log2_numvector_size);
+ q->num_vectors = get_bits(&q->gb,p->log2_numvector_size);
categorize(q, p, quant_index_table, category, category_index);
expand_category(q, category, category_index);
decode_vectors(q, p, category, quant_index_table, mlt_buffer);
@@ -716,27 +650,21 @@ static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer)
*/
static void interpolate_float(COOKContext *q, float* buffer,
- int gain_index, int gain_index_next)
-{
+ int gain_index, int gain_index_next){
int i;
float fc1, fc2;
fc1 = pow2tab[gain_index+63];
- if(gain_index == gain_index_next) //static gain
- {
- for(i = 0 ; i < q->gain_size_factor ; i++)
- {
- buffer[i] *= fc1;
+ if(gain_index == gain_index_next){ //static gain
+ for(i=0 ; i<q->gain_size_factor ; i++){
+ buffer[i]*=fc1;
}
return;
- }
- else //smooth gain
- {
+ } else { //smooth gain
fc2 = q->gain_table[11 + (gain_index_next-gain_index)];
- for(i = 0 ; i < q->gain_size_factor ; i++)
- {
- buffer[i] *= fc1;
- fc1 *= fc2;
+ for(i=0 ; i<q->gain_size_factor ; i++){
+ buffer[i]*=fc1;
+ fc1*=fc2;
}
return;
}
@@ -751,8 +679,8 @@ static void interpolate_float(COOKContext *q, float* buffer,
* @param previous_buffer pointer to the previous buffer to be used for overlapping
*/
-static void imlt_window_float(COOKContext *q, float *buffer1,
- cook_gains *gains_ptr, float *previous_buffer)
+static void imlt_window_float (COOKContext *q, float *buffer1,
+ cook_gains *gains_ptr, float *previous_buffer)
{
const float fc = pow2tab[gains_ptr->previous[0] + 63];
int i;
@@ -763,10 +691,9 @@ static void imlt_window_float(COOKContext *q, float *buffer1,
*/
/* Apply window and overlap */
- for(i = 0; i < q->samples_per_channel; i++)
- {
+ for(i = 0; i < q->samples_per_channel; i++){
buffer1[i] = buffer1[i] * fc * q->mlt_window[i] -
- previous_buffer[i] * q->mlt_window[q->samples_per_channel - 1 - i];
+ previous_buffer[i] * q->mlt_window[q->samples_per_channel - 1 - i];
}
}
@@ -792,12 +719,11 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
/* Inverse modified discrete cosine transform */
ff_imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
- q->imlt_window(q, buffer1, gains_ptr, previous_buffer);
+ q->imlt_window (q, buffer1, gains_ptr, previous_buffer);
/* Apply gain profile */
- for(i = 0; i < 8; i++)
- {
- if(gains_ptr->now[i] || gains_ptr->now[i + 1])
+ for (i = 0; i < 8; i++) {
+ if (gains_ptr->now[i] || gains_ptr->now[i + 1])
q->interpolate(q, &buffer1[q->gain_size_factor * i],
gains_ptr->now[i], gains_ptr->now[i + 1]);
}
@@ -815,17 +741,14 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
*
*/
-static void decouple_info(COOKContext *q, COOKSubpacket *p, int* decouple_tab)
-{
+static void decouple_info(COOKContext *q, COOKSubpacket *p, int* decouple_tab){
int length, i;
- if(get_bits1(&q->gb))
- {
+ if(get_bits1(&q->gb)) {
if(cplband[p->js_subband_start] > cplband[p->subbands-1]) return;
length = cplband[p->subbands-1] - cplband[p->js_subband_start] + 1;
- for(i = 0 ; i < length ; i++)
- {
+ for (i=0 ; i<length ; i++) {
decouple_tab[cplband[p->js_subband_start] + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2);
}
return;
@@ -834,9 +757,8 @@ static void decouple_info(COOKContext *q, COOKSubpacket *p, int* decouple_tab)
if(cplband[p->js_subband_start] > cplband[p->subbands-1]) return;
length = cplband[p->subbands-1] - cplband[p->js_subband_start] + 1;
- for(i = 0 ; i < length ; i++)
- {
- decouple_tab[cplband[p->js_subband_start] + i] = get_bits(&q->gb, p->js_vlc_bits);
+ for (i=0 ; i<length ; i++) {
+ decouple_tab[cplband[p->js_subband_start] + i] = get_bits(&q->gb, p->js_vlc_bits);
}
return;
}
@@ -852,17 +774,16 @@ static void decouple_info(COOKContext *q, COOKSubpacket *p, int* decouple_tab)
* @param mlt_buffer1 pointer to left channel mlt coefficients
* @param mlt_buffer2 pointer to right channel mlt coefficients
*/
-static void decouple_float(COOKContext *q,
- COOKSubpacket *p,
- int subband,
- float f1, float f2,
- float *decode_buffer,
- float *mlt_buffer1, float *mlt_buffer2)
+static void decouple_float (COOKContext *q,
+ COOKSubpacket *p,
+ int subband,
+ float f1, float f2,
+ float *decode_buffer,
+ float *mlt_buffer1, float *mlt_buffer2)
{
int j, tmp_idx;
- for(j = 0 ; j < SUBBAND_SIZE ; j++)
- {
- tmp_idx = ((p->js_subband_start + subband) * SUBBAND_SIZE) + j;
+ for (j=0 ; j<SUBBAND_SIZE ; j++) {
+ tmp_idx = ((p->js_subband_start + subband)*SUBBAND_SIZE)+j;
mlt_buffer1[SUBBAND_SIZE*subband + j] = f1 * decode_buffer[tmp_idx];
mlt_buffer2[SUBBAND_SIZE*subband + j] = f2 * decode_buffer[tmp_idx];
}
@@ -877,29 +798,26 @@ static void decouple_float(COOKContext *q,
*/
static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1,
- float* mlt_buffer2)
-{
- int i, j;
+ float* mlt_buffer2) {
+ int i,j;
int decouple_tab[SUBBAND_SIZE];
float *decode_buffer = q->decode_buffer_0;
int idx, cpl_tmp;
- float f1, f2;
+ float f1,f2;
const float* cplscale;
memset(decouple_tab, 0, sizeof(decouple_tab));
memset(decode_buffer, 0, sizeof(decode_buffer));
/* Make sure the buffers are zeroed out. */
- memset(mlt_buffer1, 0, 1024 * sizeof(float));
- memset(mlt_buffer2, 0, 1024 * sizeof(float));
+ memset(mlt_buffer1,0, 1024*sizeof(float));
+ memset(mlt_buffer2,0, 1024*sizeof(float));
decouple_info(q, p, decouple_tab);
mono_decode(q, p, decode_buffer);
/* 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++)
- {
+ 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];
}
@@ -908,14 +826,13 @@ static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1,
/* When we reach js_subband_start (the higher frequencies)
the coefficients are stored in a coupling scheme. */
idx = (1 << p->js_vlc_bits) - 1;
- for(i = p->js_subband_start ; i < p->subbands ; i++)
- {
+ for (i=p->js_subband_start ; i<p->subbands ; i++) {
cpl_tmp = cplband[i];
- idx -= decouple_tab[cpl_tmp];
+ idx -=decouple_tab[cpl_tmp];
cplscale = q->cplscales[p->js_vlc_bits-2]; //choose decoupler table
f1 = cplscale[decouple_tab[cpl_tmp]];
f2 = cplscale[idx-1];
- q->decouple(q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
+ q->decouple (q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
idx = (1 << p->js_vlc_bits) - 1;
}
}
@@ -936,7 +853,7 @@ decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer,
int offset;
offset = decode_bytes(inbuffer, q->decoded_bytes_buffer,
- p->bits_per_subpacket / 8);
+ p->bits_per_subpacket/8);
init_get_bits(&q->gb, q->decoded_bytes_buffer + offset,
p->bits_per_subpacket);
decode_gain_info(&q->gb, gains_ptr->now);
@@ -945,24 +862,23 @@ decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer,
FFSWAP(int *, gains_ptr->now, gains_ptr->previous);
}
-/**
-* Saturate the output signal to signed 16bit integers.
-*
-* @param q pointer to the COOKContext
-* @param chan channel to saturate
-* @param out pointer to the output vector
-*/
+ /**
+ * Saturate the output signal to signed 16bit integers.
+ *
+ * @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, int16_t *out)
+saturate_output_float (COOKContext *q, int chan, int16_t *out)
{
int j;
float *output = q->mono_mdct_output + q->samples_per_channel;
/* Clip and convert floats to 16 bits.
*/
- for(j = 0; j < q->samples_per_channel; j++)
- {
+ for (j = 0; j < q->samples_per_channel; j++) {
out[chan + q->nb_channels * j] =
- av_clip_int16(lrintf(output[j]));
+ av_clip_int16(lrintf(output[j]));
}
}
@@ -985,7 +901,7 @@ mlt_compensate_output(COOKContext *q, float *decode_buffer,
int16_t *out, int chan)
{
imlt_gain(q, decode_buffer, gains, previous_buffer);
- q->saturate_output(q, chan, out);
+ q->saturate_output (q, chan, out);
}
@@ -1000,28 +916,23 @@ mlt_compensate_output(COOKContext *q, float *decode_buffer,
*/
-static void decode_subpacket(COOKContext *q, COOKSubpacket* p, const uint8_t *inbuffer, int16_t *outbuffer)
-{
+static void decode_subpacket(COOKContext *q, COOKSubpacket* p, const uint8_t *inbuffer, int16_t *outbuffer) {
int sub_packet_size = p->size;
/* 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));
+ memset(q->decode_buffer_1,0,sizeof(q->decode_buffer_1));
decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
- if(p->joint_stereo)
- {
+ if (p->joint_stereo) {
joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2);
- }
- else
- {
+ } else {
mono_decode(q, p, q->decode_buffer_1);
- if(p->num_channels == 2)
- {
- decode_bytes_and_gain(q, p, inbuffer + sub_packet_size / 2, &p->gains2);
+ if (p->num_channels == 2) {
+ decode_bytes_and_gain(q, p, inbuffer + sub_packet_size/2, &p->gains2);
mono_decode(q, p, q->decode_buffer_2);
}
}
@@ -1029,19 +940,15 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket* p, const uint8_t *in
mlt_compensate_output(q, q->decode_buffer_1, &p->gains1,
p->mono_previous_buffer1, outbuffer, p->ch_idx);
- if(p->num_channels == 2)
- {
- if(p->joint_stereo)
- {
+ 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);
- }
- else
- {
+ } else {
mlt_compensate_output(q, q->decode_buffer_2, &p->gains2,
p->mono_previous_buffer2, outbuffer, p->ch_idx + 1);
- }
- }
+ }
+ }
}
@@ -1053,58 +960,52 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket* p, const uint8_t *in
*/
static int cook_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- const uint8_t *buf, int buf_size)
-{
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size) {
COOKContext *q = avctx->priv_data;
int i;
int offset = 0;
int chidx = 0;
- if(buf_size < avctx->block_align)
+ if (buf_size < avctx->block_align)
return buf_size;
/* estimate subpacket sizes */
q->subpacket[0].size = avctx->block_align;
- for(i = 1; i < q->num_subpackets; i++)
- {
+ for(i=1;i<q->num_subpackets;i++){
q->subpacket[i].size = 2 * buf[avctx->block_align - q->num_subpackets + i];
q->subpacket[0].size -= q->subpacket[i].size + 1;
- if(q->subpacket[0].size < 0)
- {
- av_log(avctx, AV_LOG_DEBUG, "frame subpacket size total > avctx->block_align!\n");
+ if (q->subpacket[0].size < 0) {
+ av_log(avctx,AV_LOG_DEBUG,"frame subpacket size total > avctx->block_align!\n");
return -1;
}
}
/* decode supbackets */
*data_size = 0;
- for(i = 0; i < q->num_subpackets; i++)
- {
- q->subpacket[i].bits_per_subpacket = (q->subpacket[i].size * 8) >> q->subpacket[i].bits_per_subpdiv;
+ for(i=0;i<q->num_subpackets;i++){
+ q->subpacket[i].bits_per_subpacket = (q->subpacket[i].size*8)>>q->subpacket[i].bits_per_subpdiv;
q->subpacket[i].ch_idx = chidx;
- av_log(avctx, AV_LOG_DEBUG, "subpacket[%i] size %i js %i %i block_align %i\n", i, q->subpacket[i].size, q->subpacket[i].joint_stereo, offset, avctx->block_align);
+ av_log(avctx,AV_LOG_DEBUG,"subpacket[%i] size %i js %i %i block_align %i\n",i,q->subpacket[i].size,q->subpacket[i].joint_stereo,offset,avctx->block_align);
decode_subpacket(q, &q->subpacket[i], buf + offset, (int16_t*)data);
offset += q->subpacket[i].size;
chidx += q->subpacket[i].num_channels;
- av_log(avctx, AV_LOG_DEBUG, "subpacket[%i] %i %i\n", i, q->subpacket[i].size * 8, get_bits_count(&q->gb));
+ av_log(avctx,AV_LOG_DEBUG,"subpacket[%i] %i %i\n",i,q->subpacket[i].size * 8,get_bits_count(&q->gb));
}
*data_size = sizeof(int16_t) * q->nb_channels * q->samples_per_channel;
/* Discard the first two frames: no valid audio. */
- if(avctx->frame_number < 2) *data_size = 0;
+ if (avctx->frame_number < 2) *data_size = 0;
return avctx->block_align;
}
-static av_cold int cook_count_channels(unsigned int mask)
-{
+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))
+ for(i = 0;i<32;i++){
+ if(mask & (1<<i))
++channels;
}
return channels;
@@ -1127,12 +1028,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->avctx = avctx;
/* Take care of the codec specific extradata. */
- if(extradata_size <= 0)
- {
- av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n");
+ if (extradata_size <= 0) {
+ av_log(avctx,AV_LOG_ERROR,"Necessary extradata missing!\n");
return -1;
}
- av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size);
+ 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;
@@ -1142,19 +1042,16 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
/* Initialize RNG. */
av_lfg_init(&q->random_state, 0);
- while(edata_ptr < edata_ptr_end)
- {
+ 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)
- {
+ if (extradata_size >= 8){
q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr);
q->subpacket[s].samples_per_frame = bytestream_get_be16(&edata_ptr);
q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr);
extradata_size -= 8;
}
- if(avctx->extradata_size >= 8)
- {
+ if (avctx->extradata_size >= 8){
bytestream_get_be32(&edata_ptr); //Unknown unused
q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr);
q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr);
@@ -1172,85 +1069,72 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
/* Initialize version-dependent variables */
- av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", s, q->subpacket[s].cookversion);
+ av_log(avctx,AV_LOG_DEBUG,"subpacket[%i].cookversion=%x\n",s,q->subpacket[s].cookversion);
q->subpacket[s].joint_stereo = 0;
- switch(q->subpacket[s].cookversion)
- {
- case MONO:
- if(q->nb_channels != 1)
- {
- av_log(avctx, AV_LOG_ERROR, "Container channels != 1, report sample!\n");
- return -1;
- }
- av_log(avctx, AV_LOG_DEBUG, "MONO\n");
- break;
- case STEREO:
- if(q->nb_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)
- {
- av_log(avctx, AV_LOG_ERROR, "Container channels != 2, report sample!\n");
- return -1;
- }
- av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n");
- if(avctx->extradata_size >= 16)
- {
- 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;
- }
- if(q->subpacket[s].samples_per_channel > 256)
- {
- q->subpacket[s].log2_numvector_size = 6;
- }
- if(q->subpacket[s].samples_per_channel > 512)
- {
- q->subpacket[s].log2_numvector_size = 7;
- }
- break;
- case MC_COOK:
- av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n");
- 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)
- {
- 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;
-
- if(q->subpacket[s].samples_per_channel > 256)
- {
+ switch (q->subpacket[s].cookversion) {
+ case MONO:
+ if (q->nb_channels != 1) {
+ av_log(avctx,AV_LOG_ERROR,"Container channels != 1, report sample!\n");
+ return -1;
+ }
+ av_log(avctx,AV_LOG_DEBUG,"MONO\n");
+ break;
+ case STEREO:
+ if (q->nb_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) {
+ av_log(avctx,AV_LOG_ERROR,"Container channels != 2, report sample!\n");
+ return -1;
+ }
+ av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n");
+ if (avctx->extradata_size >= 16){
+ 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;
+ }
+ if (q->subpacket[s].samples_per_channel > 256) {
q->subpacket[s].log2_numvector_size = 6;
}
- if(q->subpacket[s].samples_per_channel > 512)
- {
+ if (q->subpacket[s].samples_per_channel > 512) {
q->subpacket[s].log2_numvector_size = 7;
}
- }
- else
- q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame;
+ break;
+ case MC_COOK:
+ av_log(avctx,AV_LOG_DEBUG,"MULTI_CHANNEL\n");
+ 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){
+ 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;
+
+ if (q->subpacket[s].samples_per_channel > 256) {
+ q->subpacket[s].log2_numvector_size = 6;
+ }
+ if (q->subpacket[s].samples_per_channel > 512) {
+ q->subpacket[s].log2_numvector_size = 7;
+ }
+ }else
+ q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame;
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "Unknown Cook version, report sample!\n");
- return -1;
- break;
+ break;
+ default:
+ av_log(avctx,AV_LOG_ERROR,"Unknown Cook version, report sample!\n");
+ return -1;
+ break;
}
- if(s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel)
- {
- av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n");
+ if(s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) {
+ av_log(avctx,AV_LOG_ERROR,"different number of samples per channel!\n");
return -1;
- }
- else
+ } else
q->samples_per_channel = q->subpacket[0].samples_per_channel;
@@ -1258,21 +1142,18 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->subpacket[s].numvector_size = (1 << q->subpacket[s].log2_numvector_size);
/* Try to catch some obviously faulty streams, othervise it might be exploitable */
- if(q->subpacket[s].total_subbands > 53)
- {
- av_log(avctx, AV_LOG_ERROR, "total_subbands > 53, report sample!\n");
+ if (q->subpacket[s].total_subbands > 53) {
+ av_log(avctx,AV_LOG_ERROR,"total_subbands > 53, report sample!\n");
return -1;
}
- if((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 0))
- {
- av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= 0 and <= 6 allowed!\n", q->subpacket[s].js_vlc_bits);
+ if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 0)) {
+ av_log(avctx,AV_LOG_ERROR,"js_vlc_bits = %d, only >= 0 and <= 6 allowed!\n",q->subpacket[s].js_vlc_bits);
return -1;
}
- if(q->subpacket[s].subbands > 50)
- {
- av_log(avctx, AV_LOG_ERROR, "subbands > 50, report sample!\n");
+ if (q->subpacket[s].subbands > 50) {
+ av_log(avctx,AV_LOG_ERROR,"subbands > 50, report sample!\n");
return -1;
}
q->subpacket[s].gains1.now = q->subpacket[s].gain_1;
@@ -1282,9 +1163,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->num_subpackets++;
s++;
- if(s > MAX_SUBPACKETS)
- {
- av_log(avctx, AV_LOG_ERROR, "Too many subpackets > 5, report file!\n");
+ if (s > MAX_SUBPACKETS) {
+ av_log(avctx,AV_LOG_ERROR,"Too many subpackets > 5, report file!\n");
return -1;
}
}
@@ -1293,30 +1173,29 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
init_gain_table(q);
init_cplscales_table(q);
- if(init_cook_vlc_tables(q) != 0)
+ if (init_cook_vlc_tables(q) != 0)
return -1;
- if(avctx->block_align >= UINT_MAX / 2)
+ if(avctx->block_align >= UINT_MAX/2)
return -1;
/* Pad the databuffer with:
DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(),
FF_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */
- q->decoded_bytes_buffer =
- av_mallocz(avctx->block_align
- + DECODE_BYTES_PAD1(avctx->block_align)
- + FF_INPUT_BUFFER_PADDING_SIZE);
- if(q->decoded_bytes_buffer == NULL)
+ q->decoded_bytes_buffer =
+ av_mallocz(avctx->block_align
+ + DECODE_BYTES_PAD1(avctx->block_align)
+ + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (q->decoded_bytes_buffer == NULL)
return -1;
/* Initialize transform. */
- if(init_cook_mlt(q) != 0)
+ if ( init_cook_mlt(q) != 0 )
return -1;
/* Initialize COOK signal arithmetic handling */
- if(1)
- {
+ if (1) {
q->scalar_dequant = scalar_dequant_float;
q->decouple = decouple_float;
q->imlt_window = imlt_window_float;
@@ -1325,20 +1204,17 @@ 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
- {
- av_log(avctx, AV_LOG_ERROR, "unknown amount of samples_per_channel = %d, report sample!\n", q->samples_per_channel);
+ if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) {
+ } else {
+ av_log(avctx,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel);
return -1;
}
avctx->sample_fmt = SAMPLE_FMT_S16;
- if(channel_mask)
+ if (channel_mask)
avctx->channel_layout = channel_mask;
else
- avctx->channel_layout = (avctx->channels == 2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+ avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
return 0;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cookdata.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cookdata.h
index f2b8a4eff..a0175f04a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cookdata.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cookdata.h
@@ -32,44 +32,37 @@
/* various data tables */
-static const int expbits_tab[8] =
-{
- 52, 47, 43, 37, 29, 22, 16, 0,
+static const int expbits_tab[8] = {
+ 52,47,43,37,29,22,16,0,
};
-static const float dither_tab[8] =
-{
- 0.0, 0.0, 0.0, 0.0, 0.0, 0.176777, 0.25, 0.707107,
+static const float dither_tab[8] = {
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.176777, 0.25, 0.707107,
};
-static const float quant_centroid_tab[7][14] =
-{
- { 0.000, 0.392, 0.761, 1.120, 1.477, 1.832, 2.183, 2.541, 2.893, 3.245, 3.598, 3.942, 4.288, 4.724 },
- { 0.000, 0.544, 1.060, 1.563, 2.068, 2.571, 3.072, 3.562, 4.070, 4.620, 0.000, 0.000, 0.000, 0.000 },
- { 0.000, 0.746, 1.464, 2.180, 2.882, 3.584, 4.316, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
- { 0.000, 1.006, 2.000, 2.993, 3.985, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
- { 0.000, 1.321, 2.703, 3.983, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
- { 0.000, 1.657, 3.491, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
- { 0.000, 1.964, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 }
+static const float quant_centroid_tab[7][14] = {
+ { 0.000, 0.392, 0.761, 1.120, 1.477, 1.832, 2.183, 2.541, 2.893, 3.245, 3.598, 3.942, 4.288, 4.724 },
+ { 0.000, 0.544, 1.060, 1.563, 2.068, 2.571, 3.072, 3.562, 4.070, 4.620, 0.000, 0.000, 0.000, 0.000 },
+ { 0.000, 0.746, 1.464, 2.180, 2.882, 3.584, 4.316, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
+ { 0.000, 1.006, 2.000, 2.993, 3.985, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
+ { 0.000, 1.321, 2.703, 3.983, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
+ { 0.000, 1.657, 3.491, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
+ { 0.000, 1.964, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 }
};
-static const int invradix_tab[7] =
-{
+static const int invradix_tab[7] = {
74899, 104858, 149797, 209716, 262144, 349526, 524288,
};
-static const int kmax_tab[7] =
-{
+static const int kmax_tab[7] = {
13, 9, 6, 4, 3, 2, 1,
};
-static const int vd_tab[7] =
-{
+static const int vd_tab[7] = {
2, 2, 2, 4, 4, 5, 5,
};
-static const int vpr_tab[7] =
-{
+static const int vpr_tab[7] = {
10, 10, 10, 5, 5, 4, 4,
};
@@ -77,18 +70,15 @@ static const int vpr_tab[7] =
/* VLC data */
-static const int vhsize_tab[7] =
-{
+static const int vhsize_tab[7] = {
191, 97, 48, 607, 246, 230, 32,
};
-static const int vhvlcsize_tab[7] =
-{
+static const int vhvlcsize_tab[7] = {
8, 7, 7, 10, 9, 9, 6,
};
-static const uint8_t envelope_quant_index_huffbits[13][24] =
-{
+static const uint8_t envelope_quant_index_huffbits[13][24] = {
{ 4, 6, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 5, 7, 8, 9, 11, 11, 12, 12, 12, 12 },
{ 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 3, 3, 4, 5, 7, 9, 11, 12, 13, 15, 15, 15, 16, 16 },
{ 12, 10, 8, 6, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 4, 5, 5, 7, 9, 11, 13, 14, 14 },
@@ -104,65 +94,37 @@ static const uint8_t envelope_quant_index_huffbits[13][24] =
{ 13, 14, 14, 14, 10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9, 11, 14, 14, 14 },
};
-static const uint16_t envelope_quant_index_huffcodes[13][24] =
-{
- {
- 0x0006, 0x003e, 0x001c, 0x001d, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x0000, 0x0001,
- 0x0002, 0x000d, 0x001e, 0x007e, 0x00fe, 0x01fe, 0x07fc, 0x07fd, 0x0ffc, 0x0ffd, 0x0ffe, 0x0fff
- },
- {
- 0x03fe, 0x00fe, 0x003e, 0x001c, 0x001d, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005,
- 0x000d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x0ffe, 0x1ffe, 0x7ffc, 0x7ffd, 0x7ffe, 0xfffe, 0xffff
- },
- {
- 0x0ffe, 0x03fe, 0x00fe, 0x003e, 0x001c, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x0000,
- 0x0001, 0x0002, 0x000c, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffe, 0x3ffe, 0x3fff
- },
- {
- 0x1ffc, 0x03fe, 0x01fc, 0x01fd, 0x007c, 0x007d, 0x001c, 0x001d, 0x000a, 0x0000, 0x0001, 0x0002,
- 0x0003, 0x0004, 0x000b, 0x000c, 0x000d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffd, 0x1ffe, 0x1fff
- },
- {
- 0x0ffe, 0x1ffe, 0x03fe, 0x00fe, 0x003c, 0x003d, 0x001a, 0x001b, 0x000a, 0x000b, 0x0000, 0x0001,
- 0x0002, 0x0003, 0x0004, 0x000c, 0x001c, 0x001d, 0x003e, 0x007e, 0x01fe, 0x07fe, 0x3ffe, 0x3fff
- },
- {
- 0x0ffe, 0x07fe, 0x01fe, 0x00fc, 0x00fd, 0x007c, 0x001c, 0x000a, 0x000b, 0x0000, 0x0001, 0x0002,
- 0x0003, 0x0004, 0x000c, 0x000d, 0x001d, 0x001e, 0x007d, 0x00fe, 0x03fe, 0x1ffe, 0x3ffe, 0x3fff
- },
- {
- 0x7ffc, 0xfffc, 0x7ffd, 0x0ffe, 0x03fe, 0x00fe, 0x003e, 0x001c, 0x000c, 0x0002, 0x0003, 0x0004,
- 0x0000, 0x0005, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffe, 0xfffd, 0xfffe, 0xffff
- },
- {
- 0x3ffc, 0x3ffd, 0x07fe, 0x03fe, 0x01fc, 0x007c, 0x007d, 0x001c, 0x001d, 0x000c, 0x0002, 0x0003,
- 0x0000, 0x0004, 0x0005, 0x000d, 0x001e, 0x007e, 0x01fd, 0x01fe, 0x0ffe, 0x3ffe, 0x7ffe, 0x7fff
- },
- {
- 0x01fc, 0x01fd, 0x01fe, 0x00fc, 0x007c, 0x003c, 0x001c, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003,
- 0x0004, 0x0005, 0x000d, 0x001d, 0x003d, 0x007d, 0x00fd, 0x03fe, 0x07fe, 0x0ffe, 0x1ffe, 0x1fff
- },
- {
- 0x3ffc, 0x0ffe, 0x03fe, 0x00fc, 0x003c, 0x003d, 0x001c, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003,
- 0x0004, 0x0005, 0x000d, 0x001d, 0x003e, 0x00fd, 0x00fe, 0x01fe, 0x07fe, 0x3ffd, 0x3ffe, 0x3fff
- },
- {
- 0x1ffe, 0x03fe, 0x01fc, 0x00fc, 0x003c, 0x003d, 0x001c, 0x000a, 0x000b, 0x000c, 0x0002, 0x0003,
- 0x0000, 0x0004, 0x000d, 0x001d, 0x003e, 0x00fd, 0x01fd, 0x01fe, 0x07fe, 0x0ffe, 0x3ffe, 0x3fff
- },
- {
- 0xfffc, 0x1ffe, 0x0ffe, 0x07fe, 0x01fe, 0x003e, 0x001c, 0x001d, 0x000a, 0x000b, 0x000c, 0x0002,
- 0x0000, 0x0003, 0x0004, 0x000d, 0x001e, 0x007e, 0x00fe, 0x03fe, 0x3ffe, 0xfffd, 0xfffe, 0xffff
- },
- {
- 0x1ffc, 0x3ffa, 0x3ffb, 0x3ffc, 0x03fe, 0x00fe, 0x007c, 0x007d, 0x001c, 0x000c, 0x0002, 0x0003,
- 0x0000, 0x0004, 0x0005, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x3ffd, 0x3ffe, 0x3fff
- },
-};
-
-
-static const uint8_t cvh_huffbits0[191] =
-{
+static const uint16_t envelope_quant_index_huffcodes[13][24] = {
+ {0x0006, 0x003e, 0x001c, 0x001d, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x0000, 0x0001,
+ 0x0002, 0x000d, 0x001e, 0x007e, 0x00fe, 0x01fe, 0x07fc, 0x07fd, 0x0ffc, 0x0ffd, 0x0ffe, 0x0fff},
+ {0x03fe, 0x00fe, 0x003e, 0x001c, 0x001d, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005,
+ 0x000d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x0ffe, 0x1ffe, 0x7ffc, 0x7ffd, 0x7ffe, 0xfffe, 0xffff},
+ {0x0ffe, 0x03fe, 0x00fe, 0x003e, 0x001c, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x0000,
+ 0x0001, 0x0002, 0x000c, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffe, 0x3ffe, 0x3fff},
+ {0x1ffc, 0x03fe, 0x01fc, 0x01fd, 0x007c, 0x007d, 0x001c, 0x001d, 0x000a, 0x0000, 0x0001, 0x0002,
+ 0x0003, 0x0004, 0x000b, 0x000c, 0x000d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffd, 0x1ffe, 0x1fff},
+ {0x0ffe, 0x1ffe, 0x03fe, 0x00fe, 0x003c, 0x003d, 0x001a, 0x001b, 0x000a, 0x000b, 0x0000, 0x0001,
+ 0x0002, 0x0003, 0x0004, 0x000c, 0x001c, 0x001d, 0x003e, 0x007e, 0x01fe, 0x07fe, 0x3ffe, 0x3fff},
+ {0x0ffe, 0x07fe, 0x01fe, 0x00fc, 0x00fd, 0x007c, 0x001c, 0x000a, 0x000b, 0x0000, 0x0001, 0x0002,
+ 0x0003, 0x0004, 0x000c, 0x000d, 0x001d, 0x001e, 0x007d, 0x00fe, 0x03fe, 0x1ffe, 0x3ffe, 0x3fff},
+ {0x7ffc, 0xfffc, 0x7ffd, 0x0ffe, 0x03fe, 0x00fe, 0x003e, 0x001c, 0x000c, 0x0002, 0x0003, 0x0004,
+ 0x0000, 0x0005, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffe, 0xfffd, 0xfffe, 0xffff},
+ {0x3ffc, 0x3ffd, 0x07fe, 0x03fe, 0x01fc, 0x007c, 0x007d, 0x001c, 0x001d, 0x000c, 0x0002, 0x0003,
+ 0x0000, 0x0004, 0x0005, 0x000d, 0x001e, 0x007e, 0x01fd, 0x01fe, 0x0ffe, 0x3ffe, 0x7ffe, 0x7fff},
+ {0x01fc, 0x01fd, 0x01fe, 0x00fc, 0x007c, 0x003c, 0x001c, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003,
+ 0x0004, 0x0005, 0x000d, 0x001d, 0x003d, 0x007d, 0x00fd, 0x03fe, 0x07fe, 0x0ffe, 0x1ffe, 0x1fff},
+ {0x3ffc, 0x0ffe, 0x03fe, 0x00fc, 0x003c, 0x003d, 0x001c, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003,
+ 0x0004, 0x0005, 0x000d, 0x001d, 0x003e, 0x00fd, 0x00fe, 0x01fe, 0x07fe, 0x3ffd, 0x3ffe, 0x3fff},
+ {0x1ffe, 0x03fe, 0x01fc, 0x00fc, 0x003c, 0x003d, 0x001c, 0x000a, 0x000b, 0x000c, 0x0002, 0x0003,
+ 0x0000, 0x0004, 0x000d, 0x001d, 0x003e, 0x00fd, 0x01fd, 0x01fe, 0x07fe, 0x0ffe, 0x3ffe, 0x3fff},
+ {0xfffc, 0x1ffe, 0x0ffe, 0x07fe, 0x01fe, 0x003e, 0x001c, 0x001d, 0x000a, 0x000b, 0x000c, 0x0002,
+ 0x0000, 0x0003, 0x0004, 0x000d, 0x001e, 0x007e, 0x00fe, 0x03fe, 0x3ffe, 0xfffd, 0xfffe, 0xffff},
+ {0x1ffc, 0x3ffa, 0x3ffb, 0x3ffc, 0x03fe, 0x00fe, 0x007c, 0x007d, 0x001c, 0x000c, 0x0002, 0x0003,
+ 0x0000, 0x0004, 0x0005, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x3ffd, 0x3ffe, 0x3fff},
+};
+
+
+static const uint8_t cvh_huffbits0[191] = {
1, 4, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10,
11, 11, 4, 5, 6, 7, 7, 8, 8, 9, 9, 9,
9, 10, 11, 11, 5, 6, 7, 8, 8, 9, 9, 9,
@@ -181,29 +143,27 @@ static const uint8_t cvh_huffbits0[191] =
0, 0, 11, 11, 12, 13, 13, 14, 15, 16, 16,
};
-static const uint16_t cvh_huffcodes0[191] =
-{
- 0x0000, 0x0008, 0x002c, 0x002d, 0x0062, 0x0063, 0x00d4, 0x00d5, 0x00d6, 0x01c6, 0x01c7, 0x03ca,
- 0x07d6, 0x07d7, 0x0009, 0x0014, 0x002e, 0x0064, 0x0065, 0x00d7, 0x00d8, 0x01c8, 0x01c9, 0x01ca,
- 0x01cb, 0x03cb, 0x07d8, 0x07d9, 0x0015, 0x002f, 0x0066, 0x00d9, 0x00da, 0x01cc, 0x01cd, 0x01ce,
- 0x01cf, 0x03cc, 0x03cd, 0x03ce, 0x07da, 0x0fe4, 0x0030, 0x0067, 0x00db, 0x01d0, 0x01d1, 0x01d2,
- 0x01d3, 0x03cf, 0x03d0, 0x03d1, 0x03d2, 0x07db, 0x0fe5, 0x1fea, 0x0068, 0x0069, 0x00dc, 0x01d4,
- 0x01d5, 0x01d6, 0x03d3, 0x03d4, 0x03d5, 0x03d6, 0x07dc, 0x07dd, 0x0fe6, 0x1feb, 0x00dd, 0x00de,
- 0x01d7, 0x01d8, 0x01d9, 0x03d7, 0x03d8, 0x03d9, 0x03da, 0x07de, 0x07df, 0x0fe7, 0x1fec, 0x3ff2,
- 0x00df, 0x00e0, 0x01da, 0x01db, 0x03db, 0x03dc, 0x07e0, 0x07e1, 0x07e2, 0x0fe8, 0x0fe9, 0x1fed,
- 0x1fee, 0x7ff4, 0x00e1, 0x00e2, 0x01dc, 0x01dd, 0x03dd, 0x03de, 0x07e3, 0x07e4, 0x07e5, 0x0fea,
- 0x0feb, 0x1fef, 0x3ff3, 0x7ff5, 0x01de, 0x01df, 0x01e0, 0x03df, 0x03e0, 0x03e1, 0x07e6, 0x07e7,
- 0x0fec, 0x1ff0, 0x0fed, 0x3ff4, 0x7ff6, 0xfff8, 0x01e1, 0x01e2, 0x03e2, 0x03e3, 0x03e4, 0x03e5,
- 0x07e8, 0x0fee, 0x0fef, 0x3ff5, 0x3ff6, 0xfff9, 0xfffa, 0xfffa, 0x01e3, 0x01e4, 0x03e6, 0x03e7,
- 0x07e9, 0x07ea, 0x0ff0, 0x1ff1, 0x1ff2, 0x3ff7, 0x3ff8, 0x7ff7, 0x7ff7, 0xfffa, 0x03e8, 0x03e9,
- 0x03ea, 0x07eb, 0x07ec, 0x0ff1, 0x0ff2, 0x1ff3, 0x7ff8, 0x7ff9, 0xfffb, 0x3ff8, 0x7ff7, 0x7ff7,
- 0x07ed, 0x07ee, 0x07ef, 0x0ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x7ffa, 0xfffc, 0xfffd, 0xfffb, 0xfffb,
- 0x3ff8, 0x7ff7, 0x07f0, 0x07f1, 0x0ff4, 0x1ff7, 0x1ff8, 0x3ff9, 0x7ffb, 0xfffe, 0xffff,
-};
-
-
-static const uint8_t cvh_huffbits1[97] =
-{
+static const uint16_t cvh_huffcodes0[191] = {
+ 0x0000,0x0008,0x002c,0x002d,0x0062,0x0063,0x00d4,0x00d5,0x00d6,0x01c6,0x01c7,0x03ca,
+ 0x07d6,0x07d7,0x0009,0x0014,0x002e,0x0064,0x0065,0x00d7,0x00d8,0x01c8,0x01c9,0x01ca,
+ 0x01cb,0x03cb,0x07d8,0x07d9,0x0015,0x002f,0x0066,0x00d9,0x00da,0x01cc,0x01cd,0x01ce,
+ 0x01cf,0x03cc,0x03cd,0x03ce,0x07da,0x0fe4,0x0030,0x0067,0x00db,0x01d0,0x01d1,0x01d2,
+ 0x01d3,0x03cf,0x03d0,0x03d1,0x03d2,0x07db,0x0fe5,0x1fea,0x0068,0x0069,0x00dc,0x01d4,
+ 0x01d5,0x01d6,0x03d3,0x03d4,0x03d5,0x03d6,0x07dc,0x07dd,0x0fe6,0x1feb,0x00dd,0x00de,
+ 0x01d7,0x01d8,0x01d9,0x03d7,0x03d8,0x03d9,0x03da,0x07de,0x07df,0x0fe7,0x1fec,0x3ff2,
+ 0x00df,0x00e0,0x01da,0x01db,0x03db,0x03dc,0x07e0,0x07e1,0x07e2,0x0fe8,0x0fe9,0x1fed,
+ 0x1fee,0x7ff4,0x00e1,0x00e2,0x01dc,0x01dd,0x03dd,0x03de,0x07e3,0x07e4,0x07e5,0x0fea,
+ 0x0feb,0x1fef,0x3ff3,0x7ff5,0x01de,0x01df,0x01e0,0x03df,0x03e0,0x03e1,0x07e6,0x07e7,
+ 0x0fec,0x1ff0,0x0fed,0x3ff4,0x7ff6,0xfff8,0x01e1,0x01e2,0x03e2,0x03e3,0x03e4,0x03e5,
+ 0x07e8,0x0fee,0x0fef,0x3ff5,0x3ff6,0xfff9,0xfffa,0xfffa,0x01e3,0x01e4,0x03e6,0x03e7,
+ 0x07e9,0x07ea,0x0ff0,0x1ff1,0x1ff2,0x3ff7,0x3ff8,0x7ff7,0x7ff7,0xfffa,0x03e8,0x03e9,
+ 0x03ea,0x07eb,0x07ec,0x0ff1,0x0ff2,0x1ff3,0x7ff8,0x7ff9,0xfffb,0x3ff8,0x7ff7,0x7ff7,
+ 0x07ed,0x07ee,0x07ef,0x0ff3,0x1ff4,0x1ff5,0x1ff6,0x7ffa,0xfffc,0xfffd,0xfffb,0xfffb,
+ 0x3ff8,0x7ff7,0x07f0,0x07f1,0x0ff4,0x1ff7,0x1ff8,0x3ff9,0x7ffb,0xfffe,0xffff,
+};
+
+
+static const uint8_t cvh_huffbits1[97] = {
1, 4, 5, 6, 7, 8, 8, 9, 10, 10, 4, 5,
6, 7, 7, 8, 8, 9, 9, 11, 5, 5, 6, 7,
8, 8, 9, 9, 10, 11, 6, 6, 7, 8, 8, 9,
@@ -216,37 +176,33 @@ static const uint8_t cvh_huffbits1[97] =
};
-static const uint16_t cvh_huffcodes1[97] =
-{
- 0x0000, 0x0008, 0x0014, 0x0030, 0x006a, 0x00e2, 0x00e3, 0x01e4, 0x03ec, 0x03ed, 0x0009, 0x0015,
- 0x0031, 0x006b, 0x006c, 0x00e4, 0x00e5, 0x01e5, 0x01e6, 0x07f0, 0x0016, 0x0017, 0x0032, 0x006d,
- 0x00e6, 0x00e7, 0x01e7, 0x01e8, 0x03ee, 0x07f1, 0x0033, 0x0034, 0x006e, 0x00e8, 0x00e9, 0x01e9,
- 0x01ea, 0x03ef, 0x07f2, 0x0ff6, 0x006f, 0x0070, 0x00ea, 0x00eb, 0x01eb, 0x01ec, 0x03f0, 0x07f3,
- 0x07f4, 0x1ffa, 0x00ec, 0x00ed, 0x00ee, 0x01ed, 0x01ee, 0x03f1, 0x03f2, 0x07f5, 0x0ff7, 0x3ffa,
- 0x00ef, 0x00f0, 0x00f1, 0x01ef, 0x03f3, 0x07f6, 0x07f7, 0x0ff8, 0x1ffb, 0x7ffe, 0x01f0, 0x01f1,
- 0x01f2, 0x03f4, 0x07f8, 0x0ff9, 0x0ffa, 0x3ffb, 0x3ffc, 0x0000, 0x01f3, 0x01f4, 0x01f5, 0x03f5,
- 0x07f9, 0x0ffb, 0x3ffd, 0xfffe, 0x0000, 0x0000, 0x03f6, 0x03f7, 0x07fa, 0x0ffc, 0x1ffc, 0x3ffe,
+static const uint16_t cvh_huffcodes1[97] = {
+ 0x0000,0x0008,0x0014,0x0030,0x006a,0x00e2,0x00e3,0x01e4,0x03ec,0x03ed,0x0009,0x0015,
+ 0x0031,0x006b,0x006c,0x00e4,0x00e5,0x01e5,0x01e6,0x07f0,0x0016,0x0017,0x0032,0x006d,
+ 0x00e6,0x00e7,0x01e7,0x01e8,0x03ee,0x07f1,0x0033,0x0034,0x006e,0x00e8,0x00e9,0x01e9,
+ 0x01ea,0x03ef,0x07f2,0x0ff6,0x006f,0x0070,0x00ea,0x00eb,0x01eb,0x01ec,0x03f0,0x07f3,
+ 0x07f4,0x1ffa,0x00ec,0x00ed,0x00ee,0x01ed,0x01ee,0x03f1,0x03f2,0x07f5,0x0ff7,0x3ffa,
+ 0x00ef,0x00f0,0x00f1,0x01ef,0x03f3,0x07f6,0x07f7,0x0ff8,0x1ffb,0x7ffe,0x01f0,0x01f1,
+ 0x01f2,0x03f4,0x07f8,0x0ff9,0x0ffa,0x3ffb,0x3ffc,0x0000,0x01f3,0x01f4,0x01f5,0x03f5,
+ 0x07f9,0x0ffb,0x3ffd,0xfffe,0x0000,0x0000,0x03f6,0x03f7,0x07fa,0x0ffc,0x1ffc,0x3ffe,
0xffff,
};
-static const uint8_t cvh_huffbits2[48] =
-{
+static const uint8_t cvh_huffbits2[48] = {
1, 4, 5, 7, 8, 9, 10, 3, 4, 5, 7, 8,
9, 10, 5, 5, 6, 7, 8, 10, 10, 7, 6, 7,
8, 9, 10, 12, 8, 8, 8, 9, 10, 12, 14, 8,
9, 9, 10, 11, 15, 16, 9, 10, 11, 12, 13, 16,
};
-static const uint16_t cvh_huffcodes2[48] =
-{
- 0x0000, 0x000a, 0x0018, 0x0074, 0x00f2, 0x01f4, 0x03f6, 0x0004, 0x000b, 0x0019, 0x0075, 0x00f3,
- 0x01f5, 0x03f7, 0x001a, 0x001b, 0x0038, 0x0076, 0x00f4, 0x03f8, 0x03f9, 0x0077, 0x0039, 0x0078,
- 0x00f5, 0x01f6, 0x03fa, 0x0ffc, 0x00f6, 0x00f7, 0x00f8, 0x01f7, 0x03fb, 0x0ffd, 0x3ffe, 0x00f9,
- 0x01f8, 0x01f9, 0x03fc, 0x07fc, 0x7ffe, 0xfffe, 0x01fa, 0x03fd, 0x07fd, 0x0ffe, 0x1ffe, 0xffff,
+static const uint16_t cvh_huffcodes2[48] = {
+ 0x0000,0x000a,0x0018,0x0074,0x00f2,0x01f4,0x03f6,0x0004,0x000b,0x0019,0x0075,0x00f3,
+ 0x01f5,0x03f7,0x001a,0x001b,0x0038,0x0076,0x00f4,0x03f8,0x03f9,0x0077,0x0039,0x0078,
+ 0x00f5,0x01f6,0x03fa,0x0ffc,0x00f6,0x00f7,0x00f8,0x01f7,0x03fb,0x0ffd,0x3ffe,0x00f9,
+ 0x01f8,0x01f9,0x03fc,0x07fc,0x7ffe,0xfffe,0x01fa,0x03fd,0x07fd,0x0ffe,0x1ffe,0xffff,
};
-static const uint8_t cvh_huffbits3[607] =
-{
+static const uint8_t cvh_huffbits3[607] = {
2, 4, 6, 8, 10, 5, 5, 6, 8, 10, 7, 8,
8, 10, 12, 9, 9, 10, 12, 15, 10, 11, 13, 16,
16, 5, 6, 8, 10, 11, 5, 6, 8, 10, 12, 7,
@@ -301,63 +257,61 @@ static const uint8_t cvh_huffbits3[607] =
};
-static const uint16_t cvh_huffcodes3[607] =
-{
- 0x0000, 0x0004, 0x0022, 0x00c6, 0x03b0, 0x000c, 0x000d, 0x0023, 0x00c7, 0x03b1, 0x005c, 0x00c8,
- 0x00c9, 0x03b2, 0x0fa4, 0x01c2, 0x01c3, 0x03b3, 0x0fa5, 0x7f72, 0x03b4, 0x07b2, 0x1f9a, 0xff24,
- 0xff25, 0x000e, 0x0024, 0x00ca, 0x03b5, 0x07b3, 0x000f, 0x0025, 0x00cb, 0x03b6, 0x0fa6, 0x005d,
- 0x005e, 0x00cc, 0x03b7, 0x1f9b, 0x01c4, 0x01c5, 0x03b8, 0x0fa7, 0x7f73, 0x0fa8, 0x07b4, 0x1f9c,
- 0xff26, 0xff27, 0x005f, 0x01c6, 0x03b9, 0x0fa9, 0x7f74, 0x0060, 0x00cd, 0x03ba, 0x0faa, 0x1f9d,
- 0x01c7, 0x01c8, 0x07b5, 0x1f9e, 0xff28, 0x07b6, 0x07b7, 0x0fab, 0x3fa2, 0xff29, 0x0fac, 0x0fad,
- 0x3fa3, 0xff2a, 0x3fa2, 0x01c9, 0x07b8, 0x0fae, 0xff2b, 0xff2c, 0x01ca, 0x03bb, 0x1f9f, 0x7f75,
- 0xff2d, 0x03bc, 0x07b9, 0x0faf, 0xff2e, 0xff2f, 0x1fa0, 0x1fa1, 0xff30, 0xff31, 0xff32, 0xff33,
- 0xff34, 0x7f76, 0xff35, 0xff31, 0x07ba, 0x1fa2, 0xff36, 0xff37, 0x7f77, 0x07bb, 0x1fa3, 0x7f78,
- 0xff38, 0xff39, 0x1fa4, 0x1fa5, 0xff3a, 0xff3b, 0xff2e, 0x3fa4, 0xff3c, 0xff3d, 0xff3e, 0xff31,
- 0xff3f, 0xff40, 0xff30, 0xff31, 0xff31, 0x0005, 0x0026, 0x00ce, 0x03bd, 0x1fa6, 0x0027, 0x0028,
- 0x00cf, 0x03be, 0x1fa7, 0x01cb, 0x00d0, 0x03bf, 0x0fb0, 0xff41, 0x03c0, 0x03c1, 0x07bc, 0x7f79,
- 0xff42, 0x1fa8, 0x0fb1, 0x3fa5, 0xff43, 0xff44, 0x0010, 0x0029, 0x00d1, 0x07bd, 0x1fa9, 0x002a,
- 0x002b, 0x00d2, 0x03c2, 0x1faa, 0x00d3, 0x00d4, 0x01cc, 0x07be, 0x3fa6, 0x03c3, 0x03c4, 0x0fb2,
- 0x0fb3, 0xff45, 0x1fab, 0x0fb4, 0x1fac, 0x7f7a, 0xff46, 0x0061, 0x00d5, 0x01cd, 0x0fb5, 0xff47,
- 0x0062, 0x00d6, 0x03c5, 0x0fb6, 0x3fa7, 0x01ce, 0x01cf, 0x03c6, 0x1fad, 0xff48, 0x07bf, 0x03c7,
- 0x0fb7, 0x7f7b, 0xff49, 0x1fae, 0x1faf, 0xff4a, 0xff4b, 0x7f7b, 0x01d0, 0x07c0, 0x1fb0, 0xff4c,
- 0xff4d, 0x01d1, 0x03c8, 0x0fb8, 0x7f7c, 0xff4e, 0x03c9, 0x07c1, 0x1fb1, 0xff4f, 0xff50, 0x1fb2,
- 0x0fb9, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff52, 0x07c2, 0x1fb3, 0xff58,
- 0xff59, 0xff5a, 0x07c3, 0x1fb4, 0xff5b, 0xff5c, 0xff5d, 0x0fba, 0x1fb5, 0x7f7d, 0xff5e, 0xff4f,
- 0xff5f, 0xff60, 0xff61, 0xff62, 0xff52, 0xff63, 0xff64, 0xff51, 0xff52, 0xff52, 0x002c, 0x00d7,
- 0x07c4, 0x1fb6, 0xff65, 0x00d8, 0x00d9, 0x03ca, 0x0fbb, 0xff66, 0x07c5, 0x03cb, 0x07c6, 0x1fb7,
- 0xff67, 0x0fbc, 0x1fb8, 0x1fb9, 0x7f7e, 0xff68, 0xff69, 0xff6a, 0x3fa8, 0xff6b, 0x7f7e, 0x002d,
- 0x00da, 0x03cc, 0x1fba, 0xff6c, 0x00db, 0x00dc, 0x03cd, 0x0fbd, 0xff6d, 0x03ce, 0x03cf, 0x07c7,
- 0x1fbb, 0xff6e, 0x1fbc, 0x0fbe, 0x1fbd, 0xff6f, 0xff70, 0x3fa9, 0x3faa, 0x3fab, 0xff71, 0xff6f,
- 0x00dd, 0x01d2, 0x07c8, 0x1fbe, 0xff72, 0x00de, 0x01d3, 0x07c9, 0xff73, 0x3fac, 0x03d0, 0x03d1,
- 0x0fbf, 0x7f7f, 0xff74, 0x0fc0, 0x0fc1, 0x1fbf, 0xff75, 0xff76, 0x7f80, 0xff77, 0xff78, 0xff79,
- 0xff75, 0x03d2, 0x0fc2, 0x7f81, 0xff7a, 0xff7b, 0x03d3, 0x0fc3, 0x0fc4, 0x3fad, 0xff7c, 0x0fc5,
- 0x0fc6, 0x1fc0, 0xff7d, 0xff7e, 0x3fae, 0x7f82, 0xff7f, 0xff80, 0xff80, 0xff81, 0xff82, 0xff83,
- 0xff80, 0xff80, 0x0fc7, 0x7f83, 0x7f84, 0xff84, 0xff7a, 0x1fc1, 0x1fc2, 0xff85, 0xff86, 0x3fad,
- 0x3faf, 0xff87, 0xff88, 0xff89, 0xff7d, 0xff8a, 0xff8b, 0xff8c, 0xff80, 0xff80, 0x3fae, 0x7f82,
- 0xff7f, 0xff80, 0xff80, 0x00df, 0x03d4, 0x1fc3, 0x7f85, 0xff8d, 0x03d5, 0x07ca, 0x1fc4, 0xff8e,
- 0xff8f, 0x1fc5, 0x1fc6, 0x3fb0, 0xff90, 0xff91, 0xff92, 0xff93, 0xff94, 0xff95, 0xff96, 0xff97,
- 0xff98, 0xff99, 0xff9a, 0xff95, 0x00e0, 0x03d6, 0x07cb, 0x7f86, 0xff9b, 0x01d4, 0x03d7, 0x0fc8,
- 0xff9c, 0xff9d, 0x0fc9, 0x0fca, 0x7f87, 0xff9e, 0xff9f, 0xffa0, 0x3fb1, 0xffa1, 0xffa2, 0xffa3,
- 0xffa4, 0xffa5, 0xffa6, 0xffa7, 0xffa2, 0x01d5, 0x07cc, 0x3fb2, 0xffa8, 0xffa9, 0x03d8, 0x07cd,
- 0x1fc7, 0xffaa, 0xffab, 0x3fb3, 0x1fc8, 0x3fb4, 0xffac, 0xffad, 0xffae, 0x7f88, 0x7f89, 0xffaf,
- 0xffaf, 0xffb0, 0xffb1, 0xffb2, 0xffaf, 0xffaf, 0x07ce, 0x1fc9, 0xffb3, 0xffb4, 0xffb5, 0x07cf,
- 0x1fca, 0x7f8a, 0xffb6, 0xffb7, 0x1fcb, 0xffb8, 0xffb9, 0xffba, 0xffba, 0xffbb, 0xffbc, 0xffbd,
- 0xffbe, 0xffbe, 0xffbf, 0xffc0, 0xffbd, 0xffbe, 0xffbe, 0x7f8b, 0xffc1, 0xffc2, 0xffc3, 0xffb4,
- 0x3fb5, 0xffc4, 0xffc5, 0xffc6, 0xffb6, 0xffc7, 0xffc8, 0xffc9, 0xffba, 0xffba, 0xffca, 0xffcb,
- 0xffbd, 0xffbe, 0xffbe, 0xffbb, 0xffbc, 0xffbd, 0xffbe, 0xffbe, 0x01d6, 0x1fcc, 0xffcc, 0xffcd,
- 0xffce, 0x07d0, 0x1fcd, 0xffcf, 0xffd0, 0xffd1, 0x3fb6, 0x7f8c, 0xffd2, 0xffd3, 0xff90, 0x7f8d,
- 0xffd4, 0xffd5, 0xffd6, 0xff95, 0xffd7, 0xffd8, 0xff94, 0xff95, 0xff95, 0x01d7, 0x1fce, 0x7f8e,
- 0x7f8f, 0xffd9, 0x0fcb, 0x1fcf, 0x3fb7, 0xffda, 0xffdb, 0xffdc, 0x7f90, 0xffdd, 0xffde, 0xff9e,
- 0xffdf, 0xffe0, 0xffe1, 0xffe2, 0xffa2, 0xffe3, 0xffe4, 0xffa1, 0xffa2, 0xffa2, 0x07d1, 0x1fd0,
- 0x7f91, 0xffe5, 0xffa8, 0x0fcc, 0x3fb8, 0xffe6, 0xffe7, 0xffaa, 0xffe8, 0xffe9, 0xffea, 0xffeb,
- 0xffac, 0xffec, 0xffed, 0xffee, 0xffaf, 0xffaf, 0xffae, 0x7f88, 0x7f89, 0xffaf, 0xffaf, 0xffef,
- 0xfff0, 0xfff1, 0xfff2, 0xffb4, 0xfff3, 0xfff4, 0xfff5, 0xfff6, 0xffb6, 0xfff7, 0xfff8, 0xfff9,
- 0xffba, 0xffba, 0xfffa, 0xfffb, 0xffbd, 0xffbe, 0xffbe, 0xffbb, 0xffbc, 0xffbd, 0xffbe, 0xffbe,
- 0xfffc, 0xfffd, 0xffb3, 0xffb4, 0xffb4, 0xfffe, 0xffff,
-};
-
-static const uint8_t cvh_huffbits4[246] =
-{
+static const uint16_t cvh_huffcodes3[607] = {
+ 0x0000,0x0004,0x0022,0x00c6,0x03b0,0x000c,0x000d,0x0023,0x00c7,0x03b1,0x005c,0x00c8,
+ 0x00c9,0x03b2,0x0fa4,0x01c2,0x01c3,0x03b3,0x0fa5,0x7f72,0x03b4,0x07b2,0x1f9a,0xff24,
+ 0xff25,0x000e,0x0024,0x00ca,0x03b5,0x07b3,0x000f,0x0025,0x00cb,0x03b6,0x0fa6,0x005d,
+ 0x005e,0x00cc,0x03b7,0x1f9b,0x01c4,0x01c5,0x03b8,0x0fa7,0x7f73,0x0fa8,0x07b4,0x1f9c,
+ 0xff26,0xff27,0x005f,0x01c6,0x03b9,0x0fa9,0x7f74,0x0060,0x00cd,0x03ba,0x0faa,0x1f9d,
+ 0x01c7,0x01c8,0x07b5,0x1f9e,0xff28,0x07b6,0x07b7,0x0fab,0x3fa2,0xff29,0x0fac,0x0fad,
+ 0x3fa3,0xff2a,0x3fa2,0x01c9,0x07b8,0x0fae,0xff2b,0xff2c,0x01ca,0x03bb,0x1f9f,0x7f75,
+ 0xff2d,0x03bc,0x07b9,0x0faf,0xff2e,0xff2f,0x1fa0,0x1fa1,0xff30,0xff31,0xff32,0xff33,
+ 0xff34,0x7f76,0xff35,0xff31,0x07ba,0x1fa2,0xff36,0xff37,0x7f77,0x07bb,0x1fa3,0x7f78,
+ 0xff38,0xff39,0x1fa4,0x1fa5,0xff3a,0xff3b,0xff2e,0x3fa4,0xff3c,0xff3d,0xff3e,0xff31,
+ 0xff3f,0xff40,0xff30,0xff31,0xff31,0x0005,0x0026,0x00ce,0x03bd,0x1fa6,0x0027,0x0028,
+ 0x00cf,0x03be,0x1fa7,0x01cb,0x00d0,0x03bf,0x0fb0,0xff41,0x03c0,0x03c1,0x07bc,0x7f79,
+ 0xff42,0x1fa8,0x0fb1,0x3fa5,0xff43,0xff44,0x0010,0x0029,0x00d1,0x07bd,0x1fa9,0x002a,
+ 0x002b,0x00d2,0x03c2,0x1faa,0x00d3,0x00d4,0x01cc,0x07be,0x3fa6,0x03c3,0x03c4,0x0fb2,
+ 0x0fb3,0xff45,0x1fab,0x0fb4,0x1fac,0x7f7a,0xff46,0x0061,0x00d5,0x01cd,0x0fb5,0xff47,
+ 0x0062,0x00d6,0x03c5,0x0fb6,0x3fa7,0x01ce,0x01cf,0x03c6,0x1fad,0xff48,0x07bf,0x03c7,
+ 0x0fb7,0x7f7b,0xff49,0x1fae,0x1faf,0xff4a,0xff4b,0x7f7b,0x01d0,0x07c0,0x1fb0,0xff4c,
+ 0xff4d,0x01d1,0x03c8,0x0fb8,0x7f7c,0xff4e,0x03c9,0x07c1,0x1fb1,0xff4f,0xff50,0x1fb2,
+ 0x0fb9,0xff51,0xff52,0xff53,0xff54,0xff55,0xff56,0xff57,0xff52,0x07c2,0x1fb3,0xff58,
+ 0xff59,0xff5a,0x07c3,0x1fb4,0xff5b,0xff5c,0xff5d,0x0fba,0x1fb5,0x7f7d,0xff5e,0xff4f,
+ 0xff5f,0xff60,0xff61,0xff62,0xff52,0xff63,0xff64,0xff51,0xff52,0xff52,0x002c,0x00d7,
+ 0x07c4,0x1fb6,0xff65,0x00d8,0x00d9,0x03ca,0x0fbb,0xff66,0x07c5,0x03cb,0x07c6,0x1fb7,
+ 0xff67,0x0fbc,0x1fb8,0x1fb9,0x7f7e,0xff68,0xff69,0xff6a,0x3fa8,0xff6b,0x7f7e,0x002d,
+ 0x00da,0x03cc,0x1fba,0xff6c,0x00db,0x00dc,0x03cd,0x0fbd,0xff6d,0x03ce,0x03cf,0x07c7,
+ 0x1fbb,0xff6e,0x1fbc,0x0fbe,0x1fbd,0xff6f,0xff70,0x3fa9,0x3faa,0x3fab,0xff71,0xff6f,
+ 0x00dd,0x01d2,0x07c8,0x1fbe,0xff72,0x00de,0x01d3,0x07c9,0xff73,0x3fac,0x03d0,0x03d1,
+ 0x0fbf,0x7f7f,0xff74,0x0fc0,0x0fc1,0x1fbf,0xff75,0xff76,0x7f80,0xff77,0xff78,0xff79,
+ 0xff75,0x03d2,0x0fc2,0x7f81,0xff7a,0xff7b,0x03d3,0x0fc3,0x0fc4,0x3fad,0xff7c,0x0fc5,
+ 0x0fc6,0x1fc0,0xff7d,0xff7e,0x3fae,0x7f82,0xff7f,0xff80,0xff80,0xff81,0xff82,0xff83,
+ 0xff80,0xff80,0x0fc7,0x7f83,0x7f84,0xff84,0xff7a,0x1fc1,0x1fc2,0xff85,0xff86,0x3fad,
+ 0x3faf,0xff87,0xff88,0xff89,0xff7d,0xff8a,0xff8b,0xff8c,0xff80,0xff80,0x3fae,0x7f82,
+ 0xff7f,0xff80,0xff80,0x00df,0x03d4,0x1fc3,0x7f85,0xff8d,0x03d5,0x07ca,0x1fc4,0xff8e,
+ 0xff8f,0x1fc5,0x1fc6,0x3fb0,0xff90,0xff91,0xff92,0xff93,0xff94,0xff95,0xff96,0xff97,
+ 0xff98,0xff99,0xff9a,0xff95,0x00e0,0x03d6,0x07cb,0x7f86,0xff9b,0x01d4,0x03d7,0x0fc8,
+ 0xff9c,0xff9d,0x0fc9,0x0fca,0x7f87,0xff9e,0xff9f,0xffa0,0x3fb1,0xffa1,0xffa2,0xffa3,
+ 0xffa4,0xffa5,0xffa6,0xffa7,0xffa2,0x01d5,0x07cc,0x3fb2,0xffa8,0xffa9,0x03d8,0x07cd,
+ 0x1fc7,0xffaa,0xffab,0x3fb3,0x1fc8,0x3fb4,0xffac,0xffad,0xffae,0x7f88,0x7f89,0xffaf,
+ 0xffaf,0xffb0,0xffb1,0xffb2,0xffaf,0xffaf,0x07ce,0x1fc9,0xffb3,0xffb4,0xffb5,0x07cf,
+ 0x1fca,0x7f8a,0xffb6,0xffb7,0x1fcb,0xffb8,0xffb9,0xffba,0xffba,0xffbb,0xffbc,0xffbd,
+ 0xffbe,0xffbe,0xffbf,0xffc0,0xffbd,0xffbe,0xffbe,0x7f8b,0xffc1,0xffc2,0xffc3,0xffb4,
+ 0x3fb5,0xffc4,0xffc5,0xffc6,0xffb6,0xffc7,0xffc8,0xffc9,0xffba,0xffba,0xffca,0xffcb,
+ 0xffbd,0xffbe,0xffbe,0xffbb,0xffbc,0xffbd,0xffbe,0xffbe,0x01d6,0x1fcc,0xffcc,0xffcd,
+ 0xffce,0x07d0,0x1fcd,0xffcf,0xffd0,0xffd1,0x3fb6,0x7f8c,0xffd2,0xffd3,0xff90,0x7f8d,
+ 0xffd4,0xffd5,0xffd6,0xff95,0xffd7,0xffd8,0xff94,0xff95,0xff95,0x01d7,0x1fce,0x7f8e,
+ 0x7f8f,0xffd9,0x0fcb,0x1fcf,0x3fb7,0xffda,0xffdb,0xffdc,0x7f90,0xffdd,0xffde,0xff9e,
+ 0xffdf,0xffe0,0xffe1,0xffe2,0xffa2,0xffe3,0xffe4,0xffa1,0xffa2,0xffa2,0x07d1,0x1fd0,
+ 0x7f91,0xffe5,0xffa8,0x0fcc,0x3fb8,0xffe6,0xffe7,0xffaa,0xffe8,0xffe9,0xffea,0xffeb,
+ 0xffac,0xffec,0xffed,0xffee,0xffaf,0xffaf,0xffae,0x7f88,0x7f89,0xffaf,0xffaf,0xffef,
+ 0xfff0,0xfff1,0xfff2,0xffb4,0xfff3,0xfff4,0xfff5,0xfff6,0xffb6,0xfff7,0xfff8,0xfff9,
+ 0xffba,0xffba,0xfffa,0xfffb,0xffbd,0xffbe,0xffbe,0xffbb,0xffbc,0xffbd,0xffbe,0xffbe,
+ 0xfffc,0xfffd,0xffb3,0xffb4,0xffb4,0xfffe,0xffff,
+};
+
+static const uint8_t cvh_huffbits4[246] = {
2, 4, 7, 10, 4, 5, 7, 10, 7, 8, 10, 14,
11, 11, 15, 15, 4, 5, 9, 12, 5, 5, 8, 12,
8, 7, 10, 15, 11, 11, 15, 15, 7, 9, 12, 15,
@@ -382,34 +336,32 @@ static const uint8_t cvh_huffbits4[246] =
};
-static const uint16_t cvh_huffcodes4[246] =
-{
- 0x0000, 0x0004, 0x006c, 0x03e6, 0x0005, 0x0012, 0x006d, 0x03e7, 0x006e, 0x00e8, 0x03e8, 0x3fc4,
- 0x07e0, 0x07e1, 0x7fa4, 0x7fa5, 0x0006, 0x0013, 0x01e2, 0x0fda, 0x0014, 0x0015, 0x00e9, 0x0fdb,
- 0x00ea, 0x006f, 0x03e9, 0x7fa6, 0x07e2, 0x07e3, 0x7fa7, 0x7fa8, 0x0070, 0x01e3, 0x0fdc, 0x7fa9,
- 0x00eb, 0x00ec, 0x0fdd, 0x7faa, 0x03ea, 0x03eb, 0x1fd6, 0x7fab, 0x3fc5, 0x3fc6, 0x7fac, 0x1fd6,
- 0x07e4, 0x1fd7, 0x7fad, 0x7fae, 0x07e5, 0x1fd8, 0x7faf, 0x7fb0, 0x3fc7, 0x7fb1, 0x7fb2, 0x1fd6,
- 0x7fb3, 0x7fb4, 0x1fd6, 0x1fd6, 0x0007, 0x0016, 0x01e4, 0x1fd9, 0x0017, 0x0032, 0x01e5, 0x1fda,
- 0x01e6, 0x01e7, 0x07e6, 0x7fb5, 0x3fc8, 0x1fdb, 0x7fb6, 0x7fb7, 0x0008, 0x0033, 0x01e8, 0x0fde,
- 0x0018, 0x0034, 0x01e9, 0x1fdc, 0x01ea, 0x00ed, 0x07e7, 0x7fb8, 0x1fdd, 0x0fdf, 0x7fb9, 0x7fba,
- 0x0071, 0x01eb, 0x0fe0, 0x7fbb, 0x0072, 0x00ee, 0x07e8, 0x7fbc, 0x03ec, 0x03ed, 0x3fc9, 0x7fbd,
- 0x3fca, 0x7fbe, 0x7fbf, 0x3fc9, 0x03ee, 0x0fe1, 0x7fc0, 0x7fc1, 0x07e9, 0x1fde, 0x7fc2, 0x7fc3,
- 0x7fc4, 0x7fc5, 0x7fc6, 0x3fc9, 0x7fc7, 0x7fc8, 0x3fc9, 0x3fc9, 0x0035, 0x01ec, 0x1fdf, 0x3fcb,
- 0x00ef, 0x01ed, 0x0fe2, 0x7fc9, 0x0fe3, 0x0fe4, 0x7fca, 0x7fcb, 0x7fcc, 0x7fcd, 0x7fce, 0x7fca,
- 0x0073, 0x01ee, 0x1fe0, 0x7fcf, 0x00f0, 0x01ef, 0x0fe5, 0x7fd0, 0x07ea, 0x0fe6, 0x7fd1, 0x7fd2,
- 0x7fd3, 0x7fd4, 0x7fd5, 0x7fd1, 0x01f0, 0x07eb, 0x7fd6, 0x7fd7, 0x01f1, 0x07ec, 0x7fd8, 0x7fd9,
- 0x3fcc, 0x3fcd, 0x7fda, 0x7fda, 0x7fdb, 0x7fdc, 0x7fda, 0x7fda, 0x3fce, 0x7fdd, 0x7fde, 0x7fd6,
- 0x3fcf, 0x7fdf, 0x7fe0, 0x7fd8, 0x7fe1, 0x7fe2, 0x7fda, 0x7fda, 0x3fcc, 0x3fcd, 0x7fda, 0x7fda,
- 0x01f2, 0x0fe7, 0x7fe3, 0x7fe4, 0x0fe8, 0x1fe1, 0x7fe5, 0x7fe6, 0x7fe7, 0x7fe8, 0x7fe9, 0x7fca,
- 0x7fea, 0x7feb, 0x7fca, 0x7fca, 0x03ef, 0x0fe9, 0x7fec, 0x7fed, 0x0fea, 0x3fd0, 0x7fee, 0x7fef,
- 0x7ff0, 0x7ff1, 0x7ff2, 0x7fd1, 0x7ff3, 0x7ff4, 0x7fd1, 0x7fd1, 0x3fd1, 0x7ff5, 0x7ff6, 0x7fd6,
- 0x7ff7, 0x7ff8, 0x7ff9, 0x7fd8, 0x7ffa, 0x7ffb, 0x7fda, 0x7fda, 0x3fcc, 0x3fcd, 0x7fda, 0x7fda,
- 0x7ffc, 0x7ffd, 0x7fd6, 0x7fd6, 0x7ffe, 0x7fff,
-};
-
-
-static const uint8_t cvh_huffbits5[230] =
-{
+static const uint16_t cvh_huffcodes4[246] = {
+ 0x0000,0x0004,0x006c,0x03e6,0x0005,0x0012,0x006d,0x03e7,0x006e,0x00e8,0x03e8,0x3fc4,
+ 0x07e0,0x07e1,0x7fa4,0x7fa5,0x0006,0x0013,0x01e2,0x0fda,0x0014,0x0015,0x00e9,0x0fdb,
+ 0x00ea,0x006f,0x03e9,0x7fa6,0x07e2,0x07e3,0x7fa7,0x7fa8,0x0070,0x01e3,0x0fdc,0x7fa9,
+ 0x00eb,0x00ec,0x0fdd,0x7faa,0x03ea,0x03eb,0x1fd6,0x7fab,0x3fc5,0x3fc6,0x7fac,0x1fd6,
+ 0x07e4,0x1fd7,0x7fad,0x7fae,0x07e5,0x1fd8,0x7faf,0x7fb0,0x3fc7,0x7fb1,0x7fb2,0x1fd6,
+ 0x7fb3,0x7fb4,0x1fd6,0x1fd6,0x0007,0x0016,0x01e4,0x1fd9,0x0017,0x0032,0x01e5,0x1fda,
+ 0x01e6,0x01e7,0x07e6,0x7fb5,0x3fc8,0x1fdb,0x7fb6,0x7fb7,0x0008,0x0033,0x01e8,0x0fde,
+ 0x0018,0x0034,0x01e9,0x1fdc,0x01ea,0x00ed,0x07e7,0x7fb8,0x1fdd,0x0fdf,0x7fb9,0x7fba,
+ 0x0071,0x01eb,0x0fe0,0x7fbb,0x0072,0x00ee,0x07e8,0x7fbc,0x03ec,0x03ed,0x3fc9,0x7fbd,
+ 0x3fca,0x7fbe,0x7fbf,0x3fc9,0x03ee,0x0fe1,0x7fc0,0x7fc1,0x07e9,0x1fde,0x7fc2,0x7fc3,
+ 0x7fc4,0x7fc5,0x7fc6,0x3fc9,0x7fc7,0x7fc8,0x3fc9,0x3fc9,0x0035,0x01ec,0x1fdf,0x3fcb,
+ 0x00ef,0x01ed,0x0fe2,0x7fc9,0x0fe3,0x0fe4,0x7fca,0x7fcb,0x7fcc,0x7fcd,0x7fce,0x7fca,
+ 0x0073,0x01ee,0x1fe0,0x7fcf,0x00f0,0x01ef,0x0fe5,0x7fd0,0x07ea,0x0fe6,0x7fd1,0x7fd2,
+ 0x7fd3,0x7fd4,0x7fd5,0x7fd1,0x01f0,0x07eb,0x7fd6,0x7fd7,0x01f1,0x07ec,0x7fd8,0x7fd9,
+ 0x3fcc,0x3fcd,0x7fda,0x7fda,0x7fdb,0x7fdc,0x7fda,0x7fda,0x3fce,0x7fdd,0x7fde,0x7fd6,
+ 0x3fcf,0x7fdf,0x7fe0,0x7fd8,0x7fe1,0x7fe2,0x7fda,0x7fda,0x3fcc,0x3fcd,0x7fda,0x7fda,
+ 0x01f2,0x0fe7,0x7fe3,0x7fe4,0x0fe8,0x1fe1,0x7fe5,0x7fe6,0x7fe7,0x7fe8,0x7fe9,0x7fca,
+ 0x7fea,0x7feb,0x7fca,0x7fca,0x03ef,0x0fe9,0x7fec,0x7fed,0x0fea,0x3fd0,0x7fee,0x7fef,
+ 0x7ff0,0x7ff1,0x7ff2,0x7fd1,0x7ff3,0x7ff4,0x7fd1,0x7fd1,0x3fd1,0x7ff5,0x7ff6,0x7fd6,
+ 0x7ff7,0x7ff8,0x7ff9,0x7fd8,0x7ffa,0x7ffb,0x7fda,0x7fda,0x3fcc,0x3fcd,0x7fda,0x7fda,
+ 0x7ffc,0x7ffd,0x7fd6,0x7fd6,0x7ffe,0x7fff,
+};
+
+
+static const uint8_t cvh_huffbits5[230] = {
2, 4, 8, 4, 5, 9, 9, 10, 14, 4, 6, 11,
5, 6, 12, 10, 11, 15, 9, 11, 15, 10, 13, 15,
14, 15, 0, 4, 6, 12, 6, 7, 12, 12, 12, 15,
@@ -434,201 +386,177 @@ static const uint8_t cvh_huffbits5[230] =
-static const uint16_t cvh_huffcodes5[230] =
-{
- 0x0000, 0x0004, 0x00f0, 0x0005, 0x0012, 0x01f0, 0x01f1, 0x03e8, 0x3fce, 0x0006, 0x0030, 0x07de,
- 0x0013, 0x0031, 0x0fd2, 0x03e9, 0x07df, 0x7fb0, 0x01f2, 0x07e0, 0x7fb1, 0x03ea, 0x1fd2, 0x7fb2,
- 0x3fcf, 0x7fb3, 0x0031, 0x0007, 0x0032, 0x0fd3, 0x0033, 0x0070, 0x0fd4, 0x0fd5, 0x0fd6, 0x7fb4,
- 0x0014, 0x0071, 0x1fd3, 0x0034, 0x0072, 0x1fd4, 0x0fd7, 0x1fd5, 0x7fb5, 0x03eb, 0x0fd8, 0x7fb6,
- 0x07e1, 0x1fd6, 0x7fb7, 0x7fb8, 0x7fb9, 0x0072, 0x00f1, 0x1fd7, 0x7fba, 0x07e2, 0x0fd9, 0x7fbb,
- 0x7fbc, 0x7fbd, 0x0070, 0x03ec, 0x1fd8, 0x7fbe, 0x0fda, 0x7fbf, 0x7fc0, 0x7fc1, 0x7fc2, 0x0072,
- 0x7fc3, 0x7fc4, 0x0071, 0x7fc5, 0x7fc6, 0x0072, 0x0034, 0x0072, 0x0072, 0x0008, 0x0015, 0x07e3,
- 0x0016, 0x0073, 0x0fdb, 0x07e4, 0x0fdc, 0x7fc7, 0x0035, 0x0074, 0x1fd9, 0x0075, 0x00f2, 0x3fd0,
- 0x0fdd, 0x3fd1, 0x7fc8, 0x07e5, 0x1fda, 0x7fc9, 0x0fde, 0x1fdb, 0x7fca, 0x7fcb, 0x7fcc, 0x00f2,
- 0x0017, 0x0036, 0x1fdc, 0x0076, 0x00f3, 0x7fcd, 0x0fdf, 0x3fd2, 0x7fce, 0x0037, 0x00f4, 0x3fd3,
- 0x0077, 0x00f5, 0x7fcf, 0x3fd4, 0x7fd0, 0x7fd1, 0x0fe0, 0x0fe1, 0x7fd2, 0x0fe2, 0x1fdd, 0x7fd3,
- 0x7fd4, 0x7fd5, 0x00f5, 0x01f3, 0x1fde, 0x7fd6, 0x0fe3, 0x1fdf, 0x7fd7, 0x7fd8, 0x7fd9, 0x00f3,
- 0x07e6, 0x1fe0, 0x7fda, 0x1fe1, 0x1fe2, 0x7fdb, 0x7fdc, 0x7fdd, 0x00f5, 0x3fd5, 0x7fde, 0x00f4,
- 0x7fdf, 0x7fe0, 0x00f5, 0x0077, 0x00f5, 0x00f5, 0x00f6, 0x03ed, 0x7fe1, 0x07e7, 0x0fe4, 0x7fe2,
- 0x7fe3, 0x7fe4, 0x0073, 0x03ee, 0x0fe5, 0x7fe5, 0x0fe6, 0x1fe3, 0x7fe6, 0x7fe7, 0x7fe8, 0x00f2,
- 0x3fd6, 0x7fe9, 0x0074, 0x7fea, 0x7feb, 0x00f2, 0x0075, 0x00f2, 0x00f2, 0x00f7, 0x0fe7, 0x7fec,
- 0x0fe8, 0x1fe4, 0x7fed, 0x7fee, 0x7fef, 0x00f3, 0x07e8, 0x1fe5, 0x7ff0, 0x1fe6, 0x7ff1, 0x7ff2,
- 0x7ff3, 0x7ff4, 0x00f5, 0x7ff5, 0x7ff6, 0x00f4, 0x7ff7, 0x7ff8, 0x00f5, 0x0077, 0x00f5, 0x00f5,
- 0x3fd7, 0x7ff9, 0x0036, 0x7ffa, 0x7ffb, 0x00f3, 0x0076, 0x00f3, 0x00f3, 0x7ffc, 0x7ffd, 0x0000,
- 0x7ffe, 0x7fff,
+static const uint16_t cvh_huffcodes5[230] = {
+ 0x0000,0x0004,0x00f0,0x0005,0x0012,0x01f0,0x01f1,0x03e8,0x3fce,0x0006,0x0030,0x07de,
+ 0x0013,0x0031,0x0fd2,0x03e9,0x07df,0x7fb0,0x01f2,0x07e0,0x7fb1,0x03ea,0x1fd2,0x7fb2,
+ 0x3fcf,0x7fb3,0x0031,0x0007,0x0032,0x0fd3,0x0033,0x0070,0x0fd4,0x0fd5,0x0fd6,0x7fb4,
+ 0x0014,0x0071,0x1fd3,0x0034,0x0072,0x1fd4,0x0fd7,0x1fd5,0x7fb5,0x03eb,0x0fd8,0x7fb6,
+ 0x07e1,0x1fd6,0x7fb7,0x7fb8,0x7fb9,0x0072,0x00f1,0x1fd7,0x7fba,0x07e2,0x0fd9,0x7fbb,
+ 0x7fbc,0x7fbd,0x0070,0x03ec,0x1fd8,0x7fbe,0x0fda,0x7fbf,0x7fc0,0x7fc1,0x7fc2,0x0072,
+ 0x7fc3,0x7fc4,0x0071,0x7fc5,0x7fc6,0x0072,0x0034,0x0072,0x0072,0x0008,0x0015,0x07e3,
+ 0x0016,0x0073,0x0fdb,0x07e4,0x0fdc,0x7fc7,0x0035,0x0074,0x1fd9,0x0075,0x00f2,0x3fd0,
+ 0x0fdd,0x3fd1,0x7fc8,0x07e5,0x1fda,0x7fc9,0x0fde,0x1fdb,0x7fca,0x7fcb,0x7fcc,0x00f2,
+ 0x0017,0x0036,0x1fdc,0x0076,0x00f3,0x7fcd,0x0fdf,0x3fd2,0x7fce,0x0037,0x00f4,0x3fd3,
+ 0x0077,0x00f5,0x7fcf,0x3fd4,0x7fd0,0x7fd1,0x0fe0,0x0fe1,0x7fd2,0x0fe2,0x1fdd,0x7fd3,
+ 0x7fd4,0x7fd5,0x00f5,0x01f3,0x1fde,0x7fd6,0x0fe3,0x1fdf,0x7fd7,0x7fd8,0x7fd9,0x00f3,
+ 0x07e6,0x1fe0,0x7fda,0x1fe1,0x1fe2,0x7fdb,0x7fdc,0x7fdd,0x00f5,0x3fd5,0x7fde,0x00f4,
+ 0x7fdf,0x7fe0,0x00f5,0x0077,0x00f5,0x00f5,0x00f6,0x03ed,0x7fe1,0x07e7,0x0fe4,0x7fe2,
+ 0x7fe3,0x7fe4,0x0073,0x03ee,0x0fe5,0x7fe5,0x0fe6,0x1fe3,0x7fe6,0x7fe7,0x7fe8,0x00f2,
+ 0x3fd6,0x7fe9,0x0074,0x7fea,0x7feb,0x00f2,0x0075,0x00f2,0x00f2,0x00f7,0x0fe7,0x7fec,
+ 0x0fe8,0x1fe4,0x7fed,0x7fee,0x7fef,0x00f3,0x07e8,0x1fe5,0x7ff0,0x1fe6,0x7ff1,0x7ff2,
+ 0x7ff3,0x7ff4,0x00f5,0x7ff5,0x7ff6,0x00f4,0x7ff7,0x7ff8,0x00f5,0x0077,0x00f5,0x00f5,
+ 0x3fd7,0x7ff9,0x0036,0x7ffa,0x7ffb,0x00f3,0x0076,0x00f3,0x00f3,0x7ffc,0x7ffd,0x0000,
+ 0x7ffe,0x7fff,
};
-static const uint8_t cvh_huffbits6[32] =
-{
- 1, 4, 4, 6, 4, 6, 6, 8, 4, 6, 6, 8,
- 6, 9, 8, 10, 4, 6, 7, 8, 6, 9, 8, 11,
- 6, 9, 8, 10, 8, 10, 9, 11,
+static const uint8_t cvh_huffbits6[32] = {
+ 1, 4, 4, 6, 4, 6, 6, 8, 4, 6, 6, 8,
+ 6, 9, 8, 10, 4, 6, 7, 8, 6, 9, 8, 11,
+ 6, 9, 8, 10, 8, 10, 9, 11,
};
-static const uint16_t cvh_huffcodes6[32] =
-{
- 0x0000, 0x0008, 0x0009, 0x0034, 0x000a, 0x0035, 0x0036, 0x00f6, 0x000b, 0x0037, 0x0038, 0x00f7,
- 0x0039, 0x01fa, 0x00f8, 0x03fc, 0x000c, 0x003a, 0x007a, 0x00f9, 0x003b, 0x01fb, 0x00fa, 0x07fe,
- 0x003c, 0x01fc, 0x00fb, 0x03fd, 0x00fc, 0x03fe, 0x01fd, 0x07ff,
+static const uint16_t cvh_huffcodes6[32] = {
+ 0x0000,0x0008,0x0009,0x0034,0x000a,0x0035,0x0036,0x00f6,0x000b,0x0037,0x0038,0x00f7,
+ 0x0039,0x01fa,0x00f8,0x03fc,0x000c,0x003a,0x007a,0x00f9,0x003b,0x01fb,0x00fa,0x07fe,
+ 0x003c,0x01fc,0x00fb,0x03fd,0x00fc,0x03fe,0x01fd,0x07ff,
};
-static const uint16_t* const cvh_huffcodes[7] =
-{
+static const uint16_t* const cvh_huffcodes[7] = {
cvh_huffcodes0, cvh_huffcodes1, cvh_huffcodes2, cvh_huffcodes3,
cvh_huffcodes4, cvh_huffcodes5, cvh_huffcodes6,
};
-static const uint8_t* const cvh_huffbits[7] =
-{
+static const uint8_t* const cvh_huffbits[7] = {
cvh_huffbits0, cvh_huffbits1, cvh_huffbits2, cvh_huffbits3,
cvh_huffbits4, cvh_huffbits5, cvh_huffbits6,
};
-static const uint16_t ccpl_huffcodes2[3] =
-{
- 0x02, 0x00, 0x03,
+static const uint16_t ccpl_huffcodes2[3] = {
+ 0x02,0x00,0x03,
};
-static const uint16_t ccpl_huffcodes3[7] =
-{
- 0x3e, 0x1e, 0x02, 0x00, 0x06, 0x0e, 0x3f,
+static const uint16_t ccpl_huffcodes3[7] = {
+ 0x3e,0x1e,0x02,0x00,0x06,0x0e,0x3f,
};
-static const uint16_t ccpl_huffcodes4[15] =
-{
- 0xfc, 0xfd, 0x7c, 0x3c, 0x1c, 0x0c, 0x04, 0x00, 0x05, 0x0d, 0x1d, 0x3d,
- 0x7d, 0xfe, 0xff,
+static const uint16_t ccpl_huffcodes4[15] = {
+ 0xfc,0xfd,0x7c,0x3c,0x1c,0x0c,0x04,0x00,0x05,0x0d,0x1d,0x3d,
+ 0x7d,0xfe,0xff,
};
-static const uint16_t ccpl_huffcodes5[31] =
-{
- 0x03f8, 0x03f9, 0x03fa, 0x03fb, 0x01f8, 0x01f9, 0x00f8, 0x00f9, 0x0078, 0x0079, 0x0038, 0x0039,
- 0x0018, 0x0019, 0x0004, 0x0000, 0x0005, 0x001a, 0x001b, 0x003a, 0x003b, 0x007a, 0x007b, 0x00fa,
- 0x00fb, 0x01fa, 0x01fb, 0x03fc, 0x03fd, 0x03fe, 0x03ff,
+static const uint16_t ccpl_huffcodes5[31] = {
+ 0x03f8,0x03f9,0x03fa,0x03fb,0x01f8,0x01f9,0x00f8,0x00f9,0x0078,0x0079,0x0038,0x0039,
+ 0x0018,0x0019,0x0004,0x0000,0x0005,0x001a,0x001b,0x003a,0x003b,0x007a,0x007b,0x00fa,
+ 0x00fb,0x01fa,0x01fb,0x03fc,0x03fd,0x03fe,0x03ff,
};
-static const uint16_t ccpl_huffcodes6[63] =
-{
- 0x0004, 0x0005, 0x0005, 0x0006, 0x0006, 0x0007, 0x0007, 0x0007, 0x0007, 0x0008, 0x0008, 0x0008,
- 0x0008, 0x0009, 0x0009, 0x0009, 0x0009, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000b, 0x000b,
- 0x000b, 0x000b, 0x000c, 0x000d, 0x000e, 0x000e, 0x0010, 0x0000, 0x000a, 0x0018, 0x0019, 0x0036,
- 0x0037, 0x0074, 0x0075, 0x0076, 0x0077, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x01f5, 0x01f6, 0x01f7,
- 0x01f8, 0x03f6, 0x03f7, 0x03f8, 0x03f9, 0x03fa, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x0ffd, 0x1ffd,
- 0x3ffd, 0x3ffe, 0xffff,
+static const uint16_t ccpl_huffcodes6[63] = {
+ 0x0004,0x0005,0x0005,0x0006,0x0006,0x0007,0x0007,0x0007,0x0007,0x0008,0x0008,0x0008,
+ 0x0008,0x0009,0x0009,0x0009,0x0009,0x000a,0x000a,0x000a,0x000a,0x000a,0x000b,0x000b,
+ 0x000b,0x000b,0x000c,0x000d,0x000e,0x000e,0x0010,0x0000,0x000a,0x0018,0x0019,0x0036,
+ 0x0037,0x0074,0x0075,0x0076,0x0077,0x00f4,0x00f5,0x00f6,0x00f7,0x01f5,0x01f6,0x01f7,
+ 0x01f8,0x03f6,0x03f7,0x03f8,0x03f9,0x03fa,0x07fa,0x07fb,0x07fc,0x07fd,0x0ffd,0x1ffd,
+ 0x3ffd,0x3ffe,0xffff,
};
-static const uint8_t ccpl_huffbits2[3] =
-{
- 2, 1, 2,
+static const uint8_t ccpl_huffbits2[3] = {
+ 2,1,2,
};
-static const uint8_t ccpl_huffbits3[7] =
-{
- 6, 5, 2, 1, 3, 4, 6,
+static const uint8_t ccpl_huffbits3[7] = {
+ 6,5,2,1,3,4,6,
};
-static const uint8_t ccpl_huffbits4[15] =
-{
- 8, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7, 8, 8,
+static const uint8_t ccpl_huffbits4[15] = {
+ 8,8,7,6,5,4,3,1,3,4,5,6,7,8,8,
};
-static const uint8_t ccpl_huffbits5[31] =
-{
- 10, 10, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6,
- 5, 5, 3, 1, 3, 5, 5, 6, 6, 7, 7, 8,
- 8, 9, 9, 10, 10, 10, 10,
+static const uint8_t ccpl_huffbits5[31] = {
+ 10,10,10,10,9,9,8,8,7,7,6,6,
+ 5,5,3,1,3,5,5,6,6,7,7,8,
+ 8,9,9,10,10,10,10,
};
-static const uint8_t ccpl_huffbits6[63] =
-{
- 16, 15, 14, 13, 12, 11, 11, 11, 11, 10, 10, 10,
- 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7,
- 7, 7, 6, 6, 5, 5, 3, 1, 4, 5, 5, 6,
- 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9,
- 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 13,
- 14, 14, 16,
+static const uint8_t ccpl_huffbits6[63] = {
+ 16,15,14,13,12,11,11,11,11,10,10,10,
+ 10,9,9,9,9,9,8,8,8,8,7,7,
+ 7,7,6,6,5,5,3,1,4,5,5,6,
+ 6,7,7,7,7,8,8,8,8,9,9,9,
+ 9,10,10,10,10,10,11,11,11,11,12,13,
+ 14,14,16,
};
-static const uint16_t* const ccpl_huffcodes[5] =
-{
- ccpl_huffcodes2, ccpl_huffcodes3,
- ccpl_huffcodes4, ccpl_huffcodes5, ccpl_huffcodes6
+static const uint16_t* const ccpl_huffcodes[5] = {
+ ccpl_huffcodes2,ccpl_huffcodes3,
+ ccpl_huffcodes4,ccpl_huffcodes5,ccpl_huffcodes6
};
-static const uint8_t* const ccpl_huffbits[5] =
-{
- ccpl_huffbits2, ccpl_huffbits3,
- ccpl_huffbits4, ccpl_huffbits5, ccpl_huffbits6
+static const uint8_t* const ccpl_huffbits[5] = {
+ ccpl_huffbits2,ccpl_huffbits3,
+ ccpl_huffbits4,ccpl_huffbits5,ccpl_huffbits6
};
//Coupling tables
-static const int cplband[51] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 11, 12, 12, 13, 13, 14, 14, 14,
- 15, 15, 15, 15, 16, 16, 16, 16, 16, 17,
- 17, 17, 17, 17, 17, 18, 18, 18, 18, 18,
- 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
+static const int cplband[51] = {
+ 0,1,2,3,4,5,6,7,8,9,
+ 10,11,11,12,12,13,13,14,14,14,
+ 15,15,15,15,16,16,16,16,16,17,
+ 17,17,17,17,17,18,18,18,18,18,
+ 18,18,19,19,19,19,19,19,19,19,
19,
};
-static const float cplscale2[3] =
-{
- 0.953020632266998, 0.70710676908493, 0.302905440330505,
-};
-
-static const float cplscale3[7] =
-{
- 0.981279790401459, 0.936997592449188, 0.875934481620789, 0.70710676908493,
- 0.482430040836334, 0.349335819482803, 0.192587479948997,
-};
-
-static const float cplscale4[15] =
-{
- 0.991486728191376, 0.973249018192291, 0.953020632266998, 0.930133521556854,
- 0.903453230857849, 0.870746195316315, 0.826180458068848, 0.70710676908493,
- 0.563405573368073, 0.491732746362686, 0.428686618804932, 0.367221474647522,
- 0.302905440330505, 0.229752898216248, 0.130207896232605,
-};
-
-static const float cplscale5[31] =
-{
- 0.995926380157471, 0.987517595291138, 0.978726446628571, 0.969505727291107,
- 0.95979779958725, 0.949531257152557, 0.938616216182709, 0.926936149597168,
- 0.914336204528809, 0.900602877140045, 0.885426938533783, 0.868331849575043,
- 0.84851086139679, 0.824381768703461, 0.791833400726318, 0.70710676908493,
- 0.610737144947052, 0.566034197807312, 0.529177963733673, 0.495983630418777,
- 0.464778542518616, 0.434642940759659, 0.404955863952637, 0.375219136476517,
- 0.344963222742081, 0.313672333955765, 0.280692428350449, 0.245068684220314,
- 0.205169528722763, 0.157508864998817, 0.0901700109243393,
-};
-
-static const float cplscale6[63] =
-{
- 0.998005926609039, 0.993956744670868, 0.989822506904602, 0.985598564147949,
- 0.981279790401459, 0.976860702037811, 0.972335040569305, 0.967696130275726,
- 0.962936460971832, 0.958047747612000, 0.953020632266998, 0.947844684123993,
- 0.942508161067963, 0.936997592449188, 0.931297719478607, 0.925390899181366,
- 0.919256627559662, 0.912870943546295, 0.906205296516418, 0.899225592613220,
- 0.891890347003937, 0.884148240089417, 0.875934481620789, 0.867165684700012,
- 0.857730865478516, 0.847477376461029, 0.836184680461884, 0.823513329029083,
- 0.808890223503113, 0.791194140911102, 0.767520070075989, 0.707106769084930,
- 0.641024887561798, 0.611565053462982, 0.587959706783295, 0.567296981811523,
- 0.548448026180267, 0.530831515789032, 0.514098942279816, 0.498019754886627,
- 0.482430040836334, 0.467206478118896, 0.452251672744751, 0.437485188245773,
- 0.422837972640991, 0.408248275518417, 0.393658757209778, 0.379014074802399,
- 0.364258885383606, 0.349335819482803, 0.334183186292648, 0.318732559680939,
- 0.302905440330505, 0.286608695983887, 0.269728302955627, 0.252119421958923,
- 0.233590632677078, 0.213876649737358, 0.192587479948997, 0.169101938605309,
- 0.142307326197624, 0.109772264957428, 0.0631198287010193,
-};
-
-static const float* const cplscales[5] =
-{
+static const float cplscale2[3] = {
+0.953020632266998,0.70710676908493,0.302905440330505,
+};
+
+static const float cplscale3[7] = {
+0.981279790401459,0.936997592449188,0.875934481620789,0.70710676908493,
+0.482430040836334,0.349335819482803,0.192587479948997,
+};
+
+static const float cplscale4[15] = {
+0.991486728191376,0.973249018192291,0.953020632266998,0.930133521556854,
+0.903453230857849,0.870746195316315,0.826180458068848,0.70710676908493,
+0.563405573368073,0.491732746362686,0.428686618804932,0.367221474647522,
+0.302905440330505,0.229752898216248,0.130207896232605,
+};
+
+static const float cplscale5[31] = {
+0.995926380157471,0.987517595291138,0.978726446628571,0.969505727291107,
+0.95979779958725,0.949531257152557,0.938616216182709,0.926936149597168,
+0.914336204528809,0.900602877140045,0.885426938533783,0.868331849575043,
+0.84851086139679,0.824381768703461,0.791833400726318,0.70710676908493,
+0.610737144947052,0.566034197807312,0.529177963733673,0.495983630418777,
+0.464778542518616,0.434642940759659,0.404955863952637,0.375219136476517,
+0.344963222742081,0.313672333955765,0.280692428350449,0.245068684220314,
+0.205169528722763,0.157508864998817,0.0901700109243393,
+};
+
+static const float cplscale6[63] = {
+0.998005926609039,0.993956744670868,0.989822506904602,0.985598564147949,
+0.981279790401459,0.976860702037811,0.972335040569305,0.967696130275726,
+0.962936460971832,0.958047747612000,0.953020632266998,0.947844684123993,
+0.942508161067963,0.936997592449188,0.931297719478607,0.925390899181366,
+0.919256627559662,0.912870943546295,0.906205296516418,0.899225592613220,
+0.891890347003937,0.884148240089417,0.875934481620789,0.867165684700012,
+0.857730865478516,0.847477376461029,0.836184680461884,0.823513329029083,
+0.808890223503113,0.791194140911102,0.767520070075989,0.707106769084930,
+0.641024887561798,0.611565053462982,0.587959706783295,0.567296981811523,
+0.548448026180267,0.530831515789032,0.514098942279816,0.498019754886627,
+0.482430040836334,0.467206478118896,0.452251672744751,0.437485188245773,
+0.422837972640991,0.408248275518417,0.393658757209778,0.379014074802399,
+0.364258885383606,0.349335819482803,0.334183186292648,0.318732559680939,
+0.302905440330505,0.286608695983887,0.269728302955627,0.252119421958923,
+0.233590632677078,0.213876649737358,0.192587479948997,0.169101938605309,
+0.142307326197624,0.109772264957428,0.0631198287010193,
+};
+
+static const float* const cplscales[5] = {
cplscale2, cplscale3, cplscale4, cplscale5, cplscale6,
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/corepng.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/corepng.c
index ab4146c9a..04a9fd685 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/corepng.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/corepng.c
@@ -25,35 +25,31 @@
extern AVCodec png_decoder;
-typedef struct CorePNGCodecPrivate
-{
+typedef struct CorePNGCodecPrivate {
int16_t wSize;
int8_t bType;
} CorePNGCodecPrivate;
-typedef struct CorePNGcontext
-{
+typedef struct CorePNGcontext{
AVCodecContext *avctx;
DSPContext dsp;
- AVFrame picture, prev_picture;
+ AVFrame picture,prev_picture;
CorePNGCodecPrivate private;
- uint8_t *buf;
- int buf_size;
- int shiftX, shiftY;
+ uint8_t *buf;int buf_size;
+ int shiftX,shiftY;
AVCodecContext *decctx;
AVFrame decframe;
} CorePNGcontext;
-static int read_image(CorePNGcontext * const a, uint8_t *ptr, int linesize, int flip)
+static int read_image(CorePNGcontext * const a, uint8_t *ptr, int linesize,int flip)
{
- int got_picture = 0, ret;
- a->decframe.data[0] = ptr;
- a->decframe.linesize[0] = linesize * (flip ? -1 : 1);
- ret = avcodec_decode_video(a->decctx, &a->decframe, &got_picture, a->buf, a->buf_size);
- if(ret > 0)
- {
- a->buf += ret;
- a->buf_size -= ret;
+ int got_picture=0,ret;
+ a->decframe.data[0]=ptr;
+ a->decframe.linesize[0]=linesize*(flip?-1:1);
+ ret=avcodec_decode_video(a->decctx,&a->decframe,&got_picture,a->buf,a->buf_size);
+ if(ret>0){
+ a->buf+=ret;
+ a->buf_size-=ret;
}
return 0;
}
@@ -63,80 +59,69 @@ static int decode_frame(AVCodecContext *avctx,
uint8_t *buf, int buf_size)
{
CorePNGcontext * const a = avctx->priv_data;
- int Bpp, num_planes, swapUV = 0;
- AVFrame temp, *p;
+ int Bpp,num_planes,swapUV=0;
+ AVFrame temp,*p;
- if(!a->decctx)
- {
- a->decctx = avcodec_alloc_context();
- avcodec_open(a->decctx, &png_decoder);
+ if (!a->decctx) {
+ a->decctx=avcodec_alloc_context();
+ avcodec_open(a->decctx,&png_decoder);
avcodec_get_frame_defaults(&a->decframe);
}
- temp = a->picture;
- a->picture = a->prev_picture;
- a->prev_picture = temp;
+ temp= a->picture;
+ a->picture= a->prev_picture;
+ a->prev_picture= temp;
- p = &a->picture;
- avctx->coded_frame = p;
+ p= &a->picture;
+ avctx->coded_frame= p;
avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
if(p->data[0])
avctx->release_buffer(avctx, p);
- p->reference = 1;
- if(avctx->get_buffer(avctx, p) < 0)
- {
+ p->reference= 1;
+ if(avctx->get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
/* special case for last picture */
- if(buf_size == 0)
- {
+ if (buf_size == 0) {
return 0;
}
- a->buf = buf;
- a->buf_size = buf_size;
+ a->buf=buf;a->buf_size=buf_size;
- switch(a->private.bType)
- {
+ switch(a->private.bType){
case PNGFrameType_RGB24:
- read_image(a, a->picture.data[0], a->picture.linesize[0], 0);
- Bpp = 3;
- num_planes = 1;
+ read_image(a,a->picture.data[0],a->picture.linesize[0],0);
+ Bpp=3;num_planes=1;
break;
case PNGFrameType_YUY2:
- swapUV = 1;
+ swapUV=1;
case PNGFrameType_YV12:
- read_image(a, a->picture.data[0], a->picture.linesize[0], 1);
- read_image(a, a->picture.data[swapUV?1:2], a->picture.linesize[swapUV?1:2], 1);
- read_image(a, a->picture.data[swapUV?2:1], a->picture.linesize[swapUV?2:1], 1);
- Bpp = 1;
- num_planes = 3;
+ read_image(a,a->picture.data[0],a->picture.linesize[0],1);
+ read_image(a,a->picture.data[swapUV?1:2],a->picture.linesize[swapUV?1:2],1);
+ read_image(a,a->picture.data[swapUV?2:1],a->picture.linesize[swapUV?2:1],1);
+ Bpp=1;num_planes=3;
break;
default:
return 0;
}
- if(avctx->sample_fmt == SAMPLE_I) //indicates that this is a keyframe, CorePNG doesn't store this info in the stream ifself
- {
- a->picture.key_frame = 1;
- a->picture.pict_type = FF_I_TYPE;
- }
- else
- {
- int i, shiftX = 0, shiftY = 0;
- a->picture.key_frame = 0;
- a->picture.pict_type = FF_P_TYPE;
- for(i = 0; i < num_planes; i++, shiftX = a->shiftX, shiftY = a->shiftY)
- {
- uint8_t *cur = a->picture.data[i], *prev = a->prev_picture.data[i];
+ if(avctx->sample_fmt==SAMPLE_I){ //indicates that this is a keyframe, CorePNG doesn't store this info in the stream ifself
+ a->picture.key_frame=1;
+ a->picture.pict_type=FF_I_TYPE;
+ }else{
+ int i,shiftX=0,shiftY=0;
+ a->picture.key_frame=0;
+ a->picture.pict_type=FF_P_TYPE;
+ for(i=0;i<num_planes;i++,shiftX=a->shiftX,shiftY=a->shiftY){
+ uint8_t *cur=a->picture.data[i],*prev=a->prev_picture.data[i];
int y;
- for(y = 0; y < avctx->height >> shiftY; y++, cur += a->picture.linesize[i], prev += a->prev_picture.linesize[i])
- a->dsp.add_bytes(cur, prev, avctx->width * Bpp >> shiftX);
+ for(y=0;y<avctx->height>>shiftY;y++,cur+=a->picture.linesize[i],prev+=a->prev_picture.linesize[i])
+ a->dsp.add_bytes(cur,prev,avctx->width*Bpp>>shiftX);
}
}
@@ -146,26 +131,23 @@ static int decode_frame(AVCodecContext *avctx,
return buf_size;
}
-static int decode_init(AVCodecContext *avctx)
-{
+static int decode_init(AVCodecContext *avctx){
CorePNGcontext * const a = avctx->priv_data;
dsputil_init(&a->dsp, avctx);
- a->avctx = avctx;
- a->picture.data[0] = a->prev_picture.data[0] = NULL;
+ a->avctx= avctx;
+ a->picture.data[0]=a->prev_picture.data[0]=NULL;
if(avctx->extradata_size == sizeof(CorePNGCodecPrivate))
- memcpy(&a->private, avctx->extradata, sizeof(CorePNGCodecPrivate));
- else
- {
+ memcpy(&a->private,avctx->extradata,sizeof(CorePNGCodecPrivate));
+ else{
a->private.wSize = sizeof(CorePNGCodecPrivate);
a->private.bType = PNGFrameType_RGB24;
}
- switch(a->private.bType)
- {
+ switch(a->private.bType){
case PNGFrameType_RGB24:
avctx->pix_fmt = PIX_FMT_BGR24;
break;
@@ -176,11 +158,11 @@ static int decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_YUV420P;
break;
}
- avctx->has_b_frames = 0;
+ avctx->has_b_frames=0;
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &a->shiftX, &a->shiftY);
- a->decctx = NULL;
+ a->decctx=NULL;
return 0;
}
@@ -188,16 +170,14 @@ static int decode_init(AVCodecContext *avctx)
static int decode_done(AVCodecContext *avctx)
{
CorePNGcontext * const a = avctx->priv_data;
- if(a->decctx)
- {
+ if(a->decctx){
avcodec_close(a->decctx);
av_free(a->decctx);
}
return 0;
}
-AVCodec corepng_decoder =
-{
+AVCodec corepng_decoder = {
"corepng",
CODEC_TYPE_VIDEO,
CODEC_ID_COREPNG,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cscd.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cscd.c
index 05a063257..55df95873 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cscd.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cscd.c
@@ -28,8 +28,7 @@
#endif
#include "libavutil/lzo.h"
-typedef struct
-{
+typedef struct {
AVFrame pic;
int linelen, height, bpp;
unsigned int decomp_size;
@@ -37,13 +36,11 @@ typedef struct
} CamStudioContext;
static void copy_frame_default(AVFrame *f, const uint8_t *src,
- int linelen, int height)
-{
+ int linelen, int height) {
int i;
uint8_t *dst = f->data[0];
dst += (height - 1) * f->linesize[0];
- for(i = height; i; i--)
- {
+ for (i = height; i; i--) {
memcpy(dst, src, linelen);
src += linelen;
dst -= f->linesize[0];
@@ -51,14 +48,12 @@ static void copy_frame_default(AVFrame *f, const uint8_t *src,
}
static void add_frame_default(AVFrame *f, const uint8_t *src,
- int linelen, int height)
-{
+ int linelen, int height) {
int i, j;
uint8_t *dst = f->data[0];
dst += (height - 1) * f->linesize[0];
- for(i = height; i; i--)
- {
- for(j = linelen; j; j--)
+ for (i = height; i; i--) {
+ for (j = linelen; j; j--)
*dst++ += *src++;
dst -= f->linesize[0] + linelen;
}
@@ -71,80 +66,68 @@ static void add_frame_default(AVFrame *f, const uint8_t *src,
#define add_frame_32 add_frame_default
#else
static void copy_frame_16(AVFrame *f, const uint8_t *src,
- int linelen, int height)
-{
+ int linelen, int height) {
int i, j;
uint8_t *dst = f->data[0];
dst += (height - 1) * f->linesize[0];
- for(i = height; i; i--)
- {
- for(j = linelen / 2; j; j--)
- {
- dst[0] = src[1];
- dst[1] = src[0];
- src += 2;
- dst += 2;
+ for (i = height; i; i--) {
+ for (j = linelen / 2; j; j--) {
+ dst[0] = src[1];
+ dst[1] = src[0];
+ src += 2;
+ dst += 2;
}
dst -= f->linesize[0] + linelen;
}
}
static void copy_frame_32(AVFrame *f, const uint8_t *src,
- int linelen, int height)
-{
+ int linelen, int height) {
int i, j;
uint8_t *dst = f->data[0];
dst += (height - 1) * f->linesize[0];
- for(i = height; i; i--)
- {
- for(j = linelen / 4; j; j--)
- {
- dst[0] = src[3];
- dst[1] = src[2];
- dst[2] = src[1];
- dst[3] = src[0];
- src += 4;
- dst += 4;
+ for (i = height; i; i--) {
+ for (j = linelen / 4; j; j--) {
+ dst[0] = src[3];
+ dst[1] = src[2];
+ dst[2] = src[1];
+ dst[3] = src[0];
+ src += 4;
+ dst += 4;
}
dst -= f->linesize[0] + linelen;
}
}
static void add_frame_16(AVFrame *f, const uint8_t *src,
- int linelen, int height)
-{
+ int linelen, int height) {
int i, j;
uint8_t *dst = f->data[0];
dst += (height - 1) * f->linesize[0];
- for(i = height; i; i--)
- {
- for(j = linelen / 2; j; j--)
- {
- dst[0] += src[1];
- dst[1] += src[0];
- src += 2;
- dst += 2;
+ for (i = height; i; i--) {
+ for (j = linelen / 2; j; j--) {
+ dst[0] += src[1];
+ dst[1] += src[0];
+ src += 2;
+ dst += 2;
}
dst -= f->linesize[0] + linelen;
}
}
static void add_frame_32(AVFrame *f, const uint8_t *src,
- int linelen, int height)
-{
+ int linelen, int height) {
int i, j;
uint8_t *dst = f->data[0];
dst += (height - 1) * f->linesize[0];
- for(i = height; i; i--)
- {
- for(j = linelen / 4; j; j--)
- {
- dst[0] += src[3];
- dst[1] += src[2];
- dst[2] += src[1];
- dst[3] += src[0];
- src += 4;
- dst += 4;
+ for (i = height; i; i--) {
+ for (j = linelen / 4; j; j--) {
+ dst[0] += src[3];
+ dst[1] += src[2];
+ dst[2] += src[1];
+ dst[3] += src[0];
+ src += 4;
+ dst += 4;
}
dst -= f->linesize[0] + linelen;
}
@@ -152,86 +135,75 @@ static void add_frame_32(AVFrame *f, const uint8_t *src,
#endif
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
- const uint8_t *buf, int buf_size)
-{
+ const uint8_t *buf, int buf_size) {
CamStudioContext *c = avctx->priv_data;
AVFrame *picture = data;
- if(buf_size < 2)
- {
+ if (buf_size < 2) {
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
return -1;
}
- if(c->pic.data[0])
+ if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
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 (avctx->get_buffer(avctx, &c->pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
// decompress data
- switch((buf[0] >> 1) & 7)
- {
- case 0: // lzo compression
- {
- int outlen = c->decomp_size, inlen = buf_size - 2;
- if(av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
- av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
- break;
- }
- case 1: // zlib compression
- {
+ switch ((buf[0] >> 1) & 7) {
+ case 0: { // lzo compression
+ int outlen = c->decomp_size, inlen = buf_size - 2;
+ if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
+ av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
+ break;
+ }
+ case 1: { // zlib compression
#if CONFIG_ZLIB
- unsigned long dlen = c->decomp_size;
- if(uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK)
- av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
- break;
+ unsigned long dlen = c->decomp_size;
+ if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK)
+ av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
+ break;
#else
- av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
- return -1;
+ av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
+ return -1;
#endif
- }
- default:
- av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
- return -1;
+ }
+ default:
+ av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
+ return -1;
}
// flip upside down, add difference frame
- if(buf[0] & 1) // keyframe
- {
+ if (buf[0] & 1) { // keyframe
c->pic.pict_type = FF_I_TYPE;
c->pic.key_frame = 1;
- switch(c->bpp)
- {
- case 16:
- copy_frame_16(&c->pic, c->decomp_buf, c->linelen, c->height);
- break;
- case 32:
- copy_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height);
- break;
- default:
- copy_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height);
+ switch (c->bpp) {
+ case 16:
+ copy_frame_16(&c->pic, c->decomp_buf, c->linelen, c->height);
+ break;
+ case 32:
+ copy_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height);
+ break;
+ default:
+ copy_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height);
}
- }
- else
- {
+ } else {
c->pic.pict_type = FF_P_TYPE;
c->pic.key_frame = 0;
- switch(c->bpp)
- {
- case 16:
- add_frame_16(&c->pic, c->decomp_buf, c->linelen, c->height);
- break;
- case 32:
- add_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height);
- break;
- default:
- add_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height);
+ switch (c->bpp) {
+ case 16:
+ add_frame_16(&c->pic, c->decomp_buf, c->linelen, c->height);
+ break;
+ case 32:
+ add_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height);
+ break;
+ default:
+ add_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height);
}
}
@@ -240,25 +212,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return buf_size;
}
-static av_cold int decode_init(AVCodecContext *avctx)
-{
+static av_cold int decode_init(AVCodecContext *avctx) {
CamStudioContext *c = avctx->priv_data;
- 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;
- default:
- av_log(avctx, AV_LOG_ERROR,
- "CamStudio codec error: invalid depth %i bpp\n",
- avctx->bits_per_coded_sample);
- return 1;
+ 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;
+ default:
+ av_log(avctx, AV_LOG_ERROR,
+ "CamStudio codec error: invalid depth %i bpp\n",
+ avctx->bits_per_coded_sample);
+ return 1;
}
c->bpp = avctx->bits_per_coded_sample;
c->pic.data[0] = NULL;
@@ -266,25 +230,22 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->height = avctx->height;
c->decomp_size = c->height * c->linelen;
c->decomp_buf = av_malloc(c->decomp_size + AV_LZO_OUTPUT_PADDING);
- if(!c->decomp_buf)
- {
+ if (!c->decomp_buf) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return 1;
}
return 0;
}
-static av_cold int decode_end(AVCodecContext *avctx)
-{
+static av_cold int decode_end(AVCodecContext *avctx) {
CamStudioContext *c = avctx->priv_data;
av_freep(&c->decomp_buf);
- if(c->pic.data[0])
+ if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
return 0;
}
-AVCodec cscd_decoder =
-{
+AVCodec cscd_decoder = {
"camstudio",
CODEC_TYPE_VIDEO,
CODEC_ID_CSCD,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cyuv.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cyuv.c
index 380b43675..7f67d922b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cyuv.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/cyuv.c
@@ -36,8 +36,7 @@
#include "dsputil.h"
-typedef struct CyuvDecodeContext
-{
+typedef struct CyuvDecodeContext {
AVCodecContext *avctx;
int width, height;
AVFrame frame;
@@ -50,7 +49,7 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->width = avctx->width;
/* width needs to be divisible by 4 for this codec to work */
- if(s->width & 0x3)
+ if (s->width & 0x3)
return -1;
s->height = avctx->height;
avctx->pix_fmt = PIX_FMT_YUV411P;
@@ -62,7 +61,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
- CyuvDecodeContext *s = avctx->priv_data;
+ CyuvDecodeContext *s=avctx->priv_data;
unsigned char *y_plane;
unsigned char *u_plane;
@@ -85,23 +84,21 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
* followed by (height) lines each with 3 bytes to represent groups
* of 4 pixels. Thus, the total size of the buffer ought to be:
* (3 * 16) + height * (width * 3 / 4) */
- if(buf_size != 48 + s->height *(s->width * 3 / 4))
- {
+ if (buf_size != 48 + s->height * (s->width * 3 / 4)) {
av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n",
- buf_size, 48 + s->height *(s->width * 3 / 4));
+ buf_size, 48 + s->height * (s->width * 3 / 4));
return -1;
}
/* pixel data starts 48 bytes in, after 3x16-byte tables */
stream_ptr = 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 (avctx->get_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -111,12 +108,11 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
v_plane = s->frame.data[2];
/* iterate through each line in the height */
- for(y_ptr = 0, u_ptr = 0, v_ptr = 0;
- y_ptr < (s->height * s->frame.linesize[0]);
- y_ptr += s->frame.linesize[0] - s->width,
- u_ptr += s->frame.linesize[1] - s->width / 4,
- v_ptr += s->frame.linesize[2] - s->width / 4)
- {
+ for (y_ptr = 0, u_ptr = 0, v_ptr = 0;
+ y_ptr < (s->height * s->frame.linesize[0]);
+ y_ptr += s->frame.linesize[0] - s->width,
+ u_ptr += s->frame.linesize[1] - s->width / 4,
+ v_ptr += s->frame.linesize[2] - s->width / 4) {
/* reset predictors */
cur_byte = buf[stream_ptr++];
@@ -136,8 +132,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
/* iterate through the remaining pixel groups (4 pixels/group) */
pixel_groups = s->width / 4 - 1;
- while(pixel_groups--)
- {
+ while (pixel_groups--) {
cur_byte = buf[stream_ptr++];
u_pred += u_table[(cur_byte & 0xF0) >> 4];
@@ -160,8 +155,8 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
}
}
- *data_size = sizeof(AVFrame);
- *(AVFrame*)data = s->frame;
+ *data_size=sizeof(AVFrame);
+ *(AVFrame*)data= s->frame;
return buf_size;
}
@@ -170,15 +165,14 @@ static av_cold int cyuv_decode_end(AVCodecContext *avctx)
{
CyuvDecodeContext *s = avctx->priv_data;
- if(s->frame.data[0])
+ if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
return 0;
}
#if CONFIG_CYUV_DECODER
-AVCodec cyuv_decoder =
-{
+AVCodec cyuv_decoder = {
"cyuv",
CODEC_TYPE_VIDEO,
CODEC_ID_CYUV,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c
index a2027b020..6ee66cd74 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c
@@ -40,7 +40,7 @@
void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
/* ac3dec.c */
-void ff_ac3_downmix_c(float(*samples)[256], float(*matrix)[2], int out_ch, int in_ch, int len);
+void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
/* pngdec.c */
void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
@@ -52,8 +52,7 @@ uint32_t ff_squareTbl[512] = {0, };
#define pb_7f (~0UL/255 * 0x7f)
#define pb_80 (~0UL/255 * 0x80)
-const uint8_t ff_zigzag_direct[64] =
-{
+const uint8_t ff_zigzag_direct[64] = {
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
@@ -66,9 +65,8 @@ const uint8_t ff_zigzag_direct[64] =
/* Specific zigzag scan for 248 idct. NOTE that unlike the
specification, we interleave the fields */
-const uint8_t ff_zigzag248_direct[64] =
-{
- 0, 8, 1, 9, 16, 24, 2, 10,
+const uint8_t ff_zigzag248_direct[64] = {
+ 0, 8, 1, 9, 16, 24, 2, 10,
17, 25, 32, 40, 48, 56, 33, 41,
18, 26, 3, 11, 4, 12, 19, 27,
34, 42, 49, 57, 50, 58, 35, 43,
@@ -81,8 +79,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];
-const uint8_t ff_alternate_horizontal_scan[64] =
-{
+const uint8_t ff_alternate_horizontal_scan[64] = {
0, 1, 2, 3, 8, 9, 16, 17,
10, 11, 4, 5, 6, 7, 15, 14,
13, 12, 19, 18, 24, 25, 32, 33,
@@ -93,8 +90,7 @@ const uint8_t ff_alternate_horizontal_scan[64] =
52, 53, 54, 55, 60, 61, 62, 63,
};
-const uint8_t ff_alternate_vertical_scan[64] =
-{
+const uint8_t ff_alternate_vertical_scan[64] = {
0, 8, 16, 24, 1, 9, 2, 10,
17, 25, 32, 40, 48, 56, 57, 49,
41, 33, 26, 18, 3, 11, 4, 12,
@@ -107,79 +103,74 @@ const uint8_t ff_alternate_vertical_scan[64] =
/* 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 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
};
/* Input permutation for the simple_idct_mmx */
-static const uint8_t simple_mmx_permutation[64] =
-{
- 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
- 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
- 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
- 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
- 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
- 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
- 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
- 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
+static const uint8_t simple_mmx_permutation[64]={
+ 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
+ 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
+ 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
+ 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
+ 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
+ 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
+ 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
+ 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
};
static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7};
-void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
-{
+void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable){
int i;
int end;
- st->scantable = src_scantable;
+ st->scantable= src_scantable;
- for(i = 0; i < 64; i++)
- {
+ for(i=0; i<64; i++){
int j;
j = src_scantable[i];
st->permutated[i] = permutation[j];
}
- end = -1;
- for(i = 0; i < 64; i++)
- {
+ end=-1;
+ for(i=0; i<64; i++){
int j;
j = st->permutated[i];
- if(j > end) end = j;
- st->raster_end[i] = end;
+ if(j>end) end=j;
+ st->raster_end[i]= end;
}
}
@@ -188,10 +179,8 @@ static int pix_sum_c(uint8_t * pix, int line_size)
int s, i, j;
s = 0;
- for(i = 0; i < 16; i++)
- {
- for(j = 0; j < 16; j += 8)
- {
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 16; j += 8) {
s += pix[0];
s += pix[1];
s += pix[2];
@@ -213,10 +202,8 @@ static int pix_norm1_c(uint8_t * pix, int line_size)
uint32_t *sq = ff_squareTbl + 256;
s = 0;
- for(i = 0; i < 16; i++)
- {
- for(j = 0; j < 16; j += 8)
- {
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 16; j += 8) {
#if 0
s += sq[pix[0]];
s += sq[pix[1]];
@@ -228,7 +215,7 @@ static int pix_norm1_c(uint8_t * pix, int line_size)
s += sq[pix[7]];
#else
#if LONG_MAX > 2147483647
- register uint64_t x = *(uint64_t*)pix;
+ register uint64_t x=*(uint64_t*)pix;
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
@@ -238,12 +225,12 @@ static int pix_norm1_c(uint8_t * pix, int line_size)
s += sq[(x>>48)&0xff];
s += sq[(x>>56)&0xff];
#else
- register uint32_t x = *(uint32_t*)pix;
+ register uint32_t x=*(uint32_t*)pix;
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
s += sq[(x>>24)&0xff];
- x = *(uint32_t*)(pix + 4);
+ x=*(uint32_t*)(pix+4);
s += sq[x&0xff];
s += sq[(x>>8)&0xff];
s += sq[(x>>16)&0xff];
@@ -257,24 +244,21 @@ static int pix_norm1_c(uint8_t * pix, int line_size)
return s;
}
-static void bswap_buf(uint32_t *dst, const uint32_t *src, int w)
-{
+static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){
int i;
- for(i = 0; i + 8 <= w; i += 8)
- {
- dst[i+0] = bswap_32(src[i+0]);
- dst[i+1] = bswap_32(src[i+1]);
- dst[i+2] = bswap_32(src[i+2]);
- dst[i+3] = bswap_32(src[i+3]);
- dst[i+4] = bswap_32(src[i+4]);
- dst[i+5] = bswap_32(src[i+5]);
- dst[i+6] = bswap_32(src[i+6]);
- dst[i+7] = bswap_32(src[i+7]);
+ for(i=0; i+8<=w; i+=8){
+ dst[i+0]= bswap_32(src[i+0]);
+ dst[i+1]= bswap_32(src[i+1]);
+ dst[i+2]= bswap_32(src[i+2]);
+ dst[i+3]= bswap_32(src[i+3]);
+ dst[i+4]= bswap_32(src[i+4]);
+ dst[i+5]= bswap_32(src[i+5]);
+ dst[i+6]= bswap_32(src[i+6]);
+ dst[i+7]= bswap_32(src[i+7]);
}
- for(; i < w; i++)
- {
- dst[i+0] = bswap_32(src[i+0]);
+ for(;i<w; i++){
+ dst[i+0]= bswap_32(src[i+0]);
}
}
@@ -284,8 +268,7 @@ static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
uint32_t *sq = ff_squareTbl + 256;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for (i = 0; i < h; i++) {
s += sq[pix1[0] - pix2[0]];
s += sq[pix1[1] - pix2[1]];
s += sq[pix1[2] - pix2[2]];
@@ -302,8 +285,7 @@ static int sse8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
uint32_t *sq = ff_squareTbl + 256;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for (i = 0; i < h; i++) {
s += sq[pix1[0] - pix2[0]];
s += sq[pix1[1] - pix2[1]];
s += sq[pix1[2] - pix2[2]];
@@ -324,8 +306,7 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
uint32_t *sq = ff_squareTbl + 256;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for (i = 0; i < h; i++) {
s += sq[pix1[ 0] - pix2[ 0]];
s += sq[pix1[ 1] - pix2[ 1]];
s += sq[pix1[ 2] - pix2[ 2]];
@@ -358,23 +339,20 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
int i;
last_line = buf + (height - 1) * wrap;
- for(i = 0; i < w; i++)
- {
+ for(i=0;i<w;i++) {
/* top and bottom */
memcpy(buf - (i + 1) * wrap, buf, width);
memcpy(last_line + (i + 1) * wrap, last_line, width);
}
/* left and right */
ptr = buf;
- for(i = 0; i < height; i++)
- {
+ for(i=0;i<height;i++) {
memset(ptr - w, ptr[0], w);
memset(ptr + width, ptr[width-1], w);
ptr += wrap;
}
/* corners */
- for(i = 0; i < w; i++)
- {
+ for(i=0;i<w;i++) {
memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */
memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */
memset(last_line + (i + 1) * wrap - w, last_line[0], w); /* top left */
@@ -395,76 +373,60 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
* @param h height of the source buffer
*/
void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h,
- int src_x, int src_y, int w, int 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;
+ 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;
}
- 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);
- src_x = w - 1;
- }
- else if(src_x <= -block_w)
- {
- src += (1 - block_w - src_x);
- src_x = 1 - block_w;
+ 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);
+ 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);
// copy existing part
- for(y = start_y; y < end_y; y++)
- {
- for(x = start_x; x < end_x; x++)
- {
- buf[x + y*linesize] = src[x + y*linesize];
+ for(y=start_y; y<end_y; y++){
+ for(x=start_x; x<end_x; x++){
+ buf[x + y*linesize]= src[x + y*linesize];
}
}
//top
- for(y = 0; y < start_y; y++)
- {
- for(x = start_x; x < end_x; x++)
- {
- buf[x + y*linesize] = buf[x + start_y*linesize];
+ for(y=0; y<start_y; y++){
+ for(x=start_x; x<end_x; x++){
+ buf[x + y*linesize]= buf[x + start_y*linesize];
}
}
//bottom
- for(y = end_y; y < block_h; y++)
- {
- for(x = start_x; x < end_x; x++)
- {
- buf[x + y*linesize] = buf[x + (end_y-1)*linesize];
+ for(y=end_y; y<block_h; y++){
+ for(x=start_x; x<end_x; x++){
+ buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
}
}
- for(y = 0; y < block_h; y++)
- {
- //left
- for(x = 0; x < start_x; x++)
- {
- buf[x + y*linesize] = buf[start_x + y*linesize];
+ for(y=0; y<block_h; y++){
+ //left
+ for(x=0; x<start_x; x++){
+ buf[x + y*linesize]= buf[start_x + y*linesize];
}
- //right
- for(x = end_x; x < block_w; x++)
- {
- buf[x + y*linesize] = buf[end_x - 1 + y*linesize];
+ //right
+ for(x=end_x; x<block_w; x++){
+ buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
}
}
}
@@ -474,8 +436,7 @@ static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int lin
int i;
/* read the pixels */
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
block[0] = pixels[0];
block[1] = pixels[1];
block[2] = pixels[2];
@@ -490,13 +451,11 @@ static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int lin
}
static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1,
- const uint8_t *s2, int stride)
-{
+ const uint8_t *s2, int stride){
int i;
/* read the pixels */
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
block[0] = s1[0] - s2[0];
block[1] = s1[1] - s2[1];
block[2] = s1[2] - s2[2];
@@ -519,8 +478,7 @@ static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
pixels[0] = cm[block[0]];
pixels[1] = cm[block[1]];
pixels[2] = cm[block[2]];
@@ -536,14 +494,13 @@ static void 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 line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
pixels[0] = cm[block[0]];
pixels[1] = cm[block[1]];
pixels[2] = cm[block[2]];
@@ -555,14 +512,13 @@ static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels
}
static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
+ int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
- for(i = 0; i < 2; i++)
- {
+ for(i=0;i<2;i++) {
pixels[0] = cm[block[0]];
pixels[1] = cm[block[1]];
@@ -577,13 +533,11 @@ static void put_signed_pixels_clamped_c(const DCTELEM *block,
{
int i, j;
- for(i = 0; i < 8; i++)
- {
- for(j = 0; j < 8; j++)
- {
- if(*block < -128)
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ if (*block < -128)
*pixels = 0;
- else if(*block > 127)
+ else if (*block > 127)
*pixels = 255;
else
*pixels = (uint8_t)(*block + 128);
@@ -595,14 +549,13 @@ static void put_signed_pixels_clamped_c(const DCTELEM *block,
}
static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
+ int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
pixels[0] = cm[pixels[0] + block[0]];
pixels[1] = cm[pixels[1] + block[1]];
pixels[2] = cm[pixels[2] + block[2]];
@@ -617,14 +570,13 @@ static void 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 line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
pixels[0] = cm[pixels[0] + block[0]];
pixels[1] = cm[pixels[1] + block[1]];
pixels[2] = cm[pixels[2] + block[2]];
@@ -635,14 +587,13 @@ static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels
}
static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
+ int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
- for(i = 0; i < 2; i++)
- {
+ for(i=0;i<2;i++) {
pixels[0] = cm[pixels[0] + block[0]];
pixels[1] = cm[pixels[1] + block[1]];
pixels += line_size;
@@ -653,8 +604,7 @@ static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels
static void add_pixels8_c(uint8_t *restrict pixels, DCTELEM *block, int line_size)
{
int i;
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
pixels[0] += block[0];
pixels[1] += block[1];
pixels[2] += block[2];
@@ -671,8 +621,7 @@ static void add_pixels8_c(uint8_t *restrict pixels, DCTELEM *block, int line_siz
static void add_pixels4_c(uint8_t *restrict pixels, DCTELEM *block, int line_size)
{
int i;
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
pixels[0] += block[0];
pixels[1] += block[1];
pixels[2] += block[2];
@@ -684,9 +633,9 @@ static void add_pixels4_c(uint8_t *restrict pixels, DCTELEM *block, int line_siz
static int sum_abs_dctelem_c(DCTELEM *block)
{
- int sum = 0, i;
- for(i = 0; i < 64; i++)
- sum += FFABS(block[i]);
+ int sum=0, i;
+ for(i=0; i<64; i++)
+ sum+= FFABS(block[i]);
return sum;
}
@@ -1199,7 +1148,7 @@ CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_c , OPNAME ## _pixels8_c , 8)
CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_x2_c , OPNAME ## _no_rnd_pixels8_x2_c , 8)\
CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_y2_c , OPNAME ## _no_rnd_pixels8_y2_c , 8)\
CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels8_xy2_c, 8)\
-
+
#define op_avg(a, b) a = rnd_avg32(a, b)
#endif
#define op_put(a, b) a = b
@@ -1212,367 +1161,286 @@ PIXOP2(put, op_put)
#define avg2(a,b) ((a+b+1)>>1)
#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
-static void put_no_rnd_pixels16_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h)
-{
+static void put_no_rnd_pixels16_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
put_no_rnd_pixels16_l2(dst, a, b, stride, stride, stride, h);
}
-static void put_no_rnd_pixels8_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h)
-{
+static void put_no_rnd_pixels8_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
put_no_rnd_pixels8_l2(dst, a, b, stride, stride, stride, h);
}
static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder)
{
- const int A = (16 - x16) * (16 - y16);
- const int B = (x16) * (16 - y16);
- const int C = (16 - x16) * (y16);
- const int D = (x16) * (y16);
+ const int A=(16-x16)*(16-y16);
+ const int B=( x16)*(16-y16);
+ const int C=(16-x16)*( y16);
+ const int D=( x16)*( y16);
int i;
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- dst[0] = (A * src[0] + B * src[1] + C * src[stride+0] + D * src[stride+1] + rounder) >> 8;
- dst[1] = (A * src[1] + B * src[2] + C * src[stride+1] + D * src[stride+2] + rounder) >> 8;
- dst[2] = (A * src[2] + B * src[3] + C * src[stride+2] + D * src[stride+3] + rounder) >> 8;
- dst[3] = (A * src[3] + B * src[4] + C * src[stride+3] + D * src[stride+4] + rounder) >> 8;
- dst[4] = (A * src[4] + B * src[5] + C * src[stride+4] + D * src[stride+5] + rounder) >> 8;
- dst[5] = (A * src[5] + B * src[6] + C * src[stride+5] + D * src[stride+6] + rounder) >> 8;
- dst[6] = (A * src[6] + B * src[7] + C * src[stride+6] + D * src[stride+7] + rounder) >> 8;
- dst[7] = (A * src[7] + B * src[8] + C * src[stride+7] + D * src[stride+8] + rounder) >> 8;
- dst += stride;
- src += stride;
+ dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8;
+ dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8;
+ dst[2]= (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + rounder)>>8;
+ dst[3]= (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + rounder)>>8;
+ dst[4]= (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + rounder)>>8;
+ dst[5]= (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + rounder)>>8;
+ dst[6]= (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + rounder)>>8;
+ dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8;
+ dst+= stride;
+ src+= stride;
}
}
void ff_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 dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
{
int y, vx, vy;
- const int s = 1 << shift;
+ const int s= 1<<shift;
width--;
height--;
- for(y = 0; y < h; y++)
- {
+ for(y=0; y<h; y++){
int x;
- vx = ox;
- vy = oy;
- for(x = 0; x < 8; x++) //XXX FIXME optimize
- {
+ 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);
+ 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
- {
- index = av_clip(src_x, 0, width) + av_clip(src_y, 0, height) * stride;
- dst[y*stride + x] = src[index ];
+ }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;
+ vx+= dxx;
+ vy+= dyx;
}
ox += dxy;
oy += dyy;
}
}
-static inline void put_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- switch(width)
- {
- case 2:
- put_pixels2_c(dst, src, stride, height);
- break;
- case 4:
- put_pixels4_c(dst, src, stride, height);
- break;
- case 8:
- put_pixels8_c(dst, src, stride, height);
- break;
- case 16:
- put_pixels16_c(dst, src, stride, height);
- break;
+static inline void put_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ switch(width){
+ case 2: put_pixels2_c (dst, src, stride, height); break;
+ case 4: put_pixels4_c (dst, src, stride, height); break;
+ case 8: put_pixels8_c (dst, src, stride, height); break;
+ case 16:put_pixels16_c(dst, src, stride, height); break;
}
}
-static inline void put_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (683 * (2 * src[j] + src[j+1] + 1)) >> 11;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (683*(2*src[j] + src[j+1] + 1)) >> 11;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (683 * (src[j] + 2 * src[j+1] + 1)) >> 11;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (683*(src[j] + 2*src[j+1] + 1)) >> 11;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (683 * (2 * src[j] + src[j+stride] + 1)) >> 11;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (683*(2*src[j] + src[j+stride] + 1)) >> 11;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (2731 * (4 * src[j] + 3 * src[j+1] + 3 * src[j+stride] + 2 * src[j+stride+1] + 6)) >> 15;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (2731 * (3 * src[j] + 2 * src[j+1] + 4 * src[j+stride] + 3 * src[j+stride+1] + 6)) >> 15;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (683 * (src[j] + 2 * src[j+stride] + 1)) >> 11;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (683*(src[j] + 2*src[j+stride] + 1)) >> 11;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (2731 * (3 * src[j] + 4 * src[j+1] + 2 * src[j+stride] + 3 * src[j+stride+1] + 6)) >> 15;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (2731 * (2 * src[j] + 3 * src[j+1] + 3 * src[j+stride] + 4 * src[j+stride+1] + 6)) >> 15;
- }
- src += stride;
- dst += stride;
+static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- switch(width)
- {
- case 2:
- avg_pixels2_c(dst, src, stride, height);
- break;
- case 4:
- avg_pixels4_c(dst, src, stride, height);
- break;
- case 8:
- avg_pixels8_c(dst, src, stride, height);
- break;
- case 16:
- avg_pixels16_c(dst, src, stride, height);
- break;
+static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ switch(width){
+ case 2: avg_pixels2_c (dst, src, stride, height); break;
+ case 4: avg_pixels4_c (dst, src, stride, height); break;
+ case 8: avg_pixels8_c (dst, src, stride, height); break;
+ case 16:avg_pixels16_c(dst, src, stride, height); break;
}
}
-static inline void avg_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((683 * (2 * src[j] + src[j+1] + 1)) >> 11) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((683*(2*src[j] + src[j+1] + 1)) >> 11) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((683 * (src[j] + 2 * src[j+1] + 1)) >> 11) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+1] + 1)) >> 11) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((683 * (2 * src[j] + src[j+stride] + 1)) >> 11) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((683*(2*src[j] + src[j+stride] + 1)) >> 11) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((2731 * (4 * src[j] + 3 * src[j+1] + 3 * src[j+stride] + 2 * src[j+stride+1] + 6)) >> 15) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((2731 * (3 * src[j] + 2 * src[j+1] + 4 * src[j+stride] + 3 * src[j+stride+1] + 6)) >> 15) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((683 * (src[j] + 2 * src[j+stride] + 1)) >> 11) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+stride] + 1)) >> 11) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((2731 * (3 * src[j] + 4 * src[j+1] + 2 * src[j+stride] + 3 * src[j+stride+1] + 6)) >> 15) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
-static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height)
-{
- int i, j;
- for(i = 0; i < height; i++)
- {
- for(j = 0; j < width; j++)
- {
- dst[j] = (dst[j] + ((2731 * (2 * src[j] + 3 * src[j+1] + 3 * src[j+stride] + 4 * src[j+stride+1] + 6)) >> 15) + 1) >> 1;
- }
- src += stride;
- dst += stride;
+static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
+ int i,j;
+ for (i=0; i < height; i++) {
+ for (j=0; j < width; j++) {
+ dst[j] = (dst[j] + ((2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
+ }
+ src += stride;
+ dst += stride;
}
}
#if 0
@@ -1706,53 +1574,51 @@ H264_CHROMA_MC(avg_ , op_avg)
#undef op_avg
#undef op_put
-static void put_no_rnd_vc1_chroma_mc8_c(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);
- const int B = (x) * (8 - y);
- const int C = (8 - x) * (y);
- const int D = (x) * (y);
+static void put_no_rnd_vc1_chroma_mc8_c(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);
+ const int B=( x)*(8-y);
+ const int C=(8-x)*( y);
+ const int D=( x)*( y);
int i;
- assert(x < 8 && y < 8 && x >= 0 && y >= 0);
+ assert(x<8 && y<8 && x>=0 && y>=0);
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- dst[0] = (A * src[0] + B * src[1] + C * src[stride+0] + D * src[stride+1] + 32 - 4) >> 6;
- dst[1] = (A * src[1] + B * src[2] + C * src[stride+1] + D * src[stride+2] + 32 - 4) >> 6;
- dst[2] = (A * src[2] + B * src[3] + C * src[stride+2] + D * src[stride+3] + 32 - 4) >> 6;
- dst[3] = (A * src[3] + B * src[4] + C * src[stride+3] + D * src[stride+4] + 32 - 4) >> 6;
- dst[4] = (A * src[4] + B * src[5] + C * src[stride+4] + D * src[stride+5] + 32 - 4) >> 6;
- dst[5] = (A * src[5] + B * src[6] + C * src[stride+5] + D * src[stride+6] + 32 - 4) >> 6;
- dst[6] = (A * src[6] + B * src[7] + C * src[stride+6] + D * src[stride+7] + 32 - 4) >> 6;
- dst[7] = (A * src[7] + B * src[8] + C * src[stride+7] + D * src[stride+8] + 32 - 4) >> 6;
- dst += stride;
- src += stride;
+ dst[0] = (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6;
+ dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6;
+ dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6;
+ dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6;
+ dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6;
+ dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6;
+ dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6;
+ dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6;
+ dst+= stride;
+ src+= stride;
}
}
-static void avg_no_rnd_vc1_chroma_mc8_c(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);
- const int B = (x) * (8 - y);
- const int C = (8 - x) * (y);
- const int D = (x) * (y);
+static void avg_no_rnd_vc1_chroma_mc8_c(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);
+ const int B=( x)*(8-y);
+ const int C=(8-x)*( y);
+ const int D=( x)*( y);
int i;
- assert(x < 8 && y < 8 && x >= 0 && y >= 0);
+ assert(x<8 && y<8 && x>=0 && y>=0);
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- dst[0] = avg2(dst[0], ((A * src[0] + B * src[1] + C * src[stride+0] + D * src[stride+1] + 32 - 4) >> 6));
- dst[1] = avg2(dst[1], ((A * src[1] + B * src[2] + C * src[stride+1] + D * src[stride+2] + 32 - 4) >> 6));
- dst[2] = avg2(dst[2], ((A * src[2] + B * src[3] + C * src[stride+2] + D * src[stride+3] + 32 - 4) >> 6));
- dst[3] = avg2(dst[3], ((A * src[3] + B * src[4] + C * src[stride+3] + D * src[stride+4] + 32 - 4) >> 6));
- dst[4] = avg2(dst[4], ((A * src[4] + B * src[5] + C * src[stride+4] + D * src[stride+5] + 32 - 4) >> 6));
- dst[5] = avg2(dst[5], ((A * src[5] + B * src[6] + C * src[stride+5] + D * src[stride+6] + 32 - 4) >> 6));
- dst[6] = avg2(dst[6], ((A * src[6] + B * src[7] + C * src[stride+6] + D * src[stride+7] + 32 - 4) >> 6));
- dst[7] = avg2(dst[7], ((A * src[7] + B * src[8] + C * src[stride+7] + D * src[stride+8] + 32 - 4) >> 6));
- dst += stride;
- src += stride;
+ dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6));
+ dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6));
+ dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6));
+ dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6));
+ dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6));
+ dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6));
+ dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6));
+ dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6));
+ dst+= stride;
+ src+= stride;
}
}
@@ -2517,7 +2383,7 @@ static void OPNAME ## h264_qpel16_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t
OPNAME ## h264_qpel8_hv_lowpass(dst , tmp , src , dstStride, tmpStride, srcStride);\
OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\
}\
-
+
#define H264_MC(OPNAME, SIZE) \
static void OPNAME ## h264_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
@@ -2654,7 +2520,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, i
put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
}\
-
+
#define op_avg(a, b) a = (((a)+cm[((b) + 16)>>5]+1)>>1)
//#define op_avg2(a, b) a = (((a)*w1+cm[((b) + 16)>>5]*w2 + o + 64)>>7)
#define op_put(a, b) a = cm[((b) + 16)>>5]
@@ -2732,38 +2598,36 @@ static void biweight_h264_pixels ## W ## x ## H ## _c(uint8_t *dst, uint8_t *src
} \
}
-H264_WEIGHT(16, 16)
-H264_WEIGHT(16, 8)
-H264_WEIGHT(8, 16)
-H264_WEIGHT(8, 8)
-H264_WEIGHT(8, 4)
-H264_WEIGHT(4, 8)
-H264_WEIGHT(4, 4)
-H264_WEIGHT(4, 2)
-H264_WEIGHT(2, 4)
-H264_WEIGHT(2, 2)
+H264_WEIGHT(16,16)
+H264_WEIGHT(16,8)
+H264_WEIGHT(8,16)
+H264_WEIGHT(8,8)
+H264_WEIGHT(8,4)
+H264_WEIGHT(4,8)
+H264_WEIGHT(4,4)
+H264_WEIGHT(4,2)
+H264_WEIGHT(2,4)
+H264_WEIGHT(2,2)
#undef op_scale1
#undef op_scale2
#undef H264_WEIGHT
-static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
-{
+static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i;
- for(i = 0; i < h; i++)
- {
- dst[0] = cm[(9*(src[0] + src[1]) - (src[-1] + src[2]) + 8) >> 4];
- dst[1] = cm[(9*(src[1] + src[2]) - (src[ 0] + src[3]) + 8) >> 4];
- dst[2] = cm[(9*(src[2] + src[3]) - (src[ 1] + src[4]) + 8) >> 4];
- dst[3] = cm[(9*(src[3] + src[4]) - (src[ 2] + src[5]) + 8) >> 4];
- dst[4] = cm[(9*(src[4] + src[5]) - (src[ 3] + src[6]) + 8) >> 4];
- dst[5] = cm[(9*(src[5] + src[6]) - (src[ 4] + src[7]) + 8) >> 4];
- dst[6] = cm[(9*(src[6] + src[7]) - (src[ 5] + src[8]) + 8) >> 4];
- dst[7] = cm[(9*(src[7] + src[8]) - (src[ 6] + src[9]) + 8) >> 4];
- dst += dstStride;
- src += srcStride;
+ for(i=0; i<h; i++){
+ dst[0]= cm[(9*(src[0] + src[1]) - (src[-1] + src[2]) + 8)>>4];
+ dst[1]= cm[(9*(src[1] + src[2]) - (src[ 0] + src[3]) + 8)>>4];
+ dst[2]= cm[(9*(src[2] + src[3]) - (src[ 1] + src[4]) + 8)>>4];
+ dst[3]= cm[(9*(src[3] + src[4]) - (src[ 2] + src[5]) + 8)>>4];
+ dst[4]= cm[(9*(src[4] + src[5]) - (src[ 3] + src[6]) + 8)>>4];
+ dst[5]= cm[(9*(src[5] + src[6]) - (src[ 4] + src[7]) + 8)>>4];
+ dst[6]= cm[(9*(src[6] + src[7]) - (src[ 5] + src[8]) + 8)>>4];
+ dst[7]= cm[(9*(src[7] + src[8]) - (src[ 6] + src[9]) + 8)>>4];
+ dst+=dstStride;
+ src+=srcStride;
}
}
@@ -2771,20 +2635,16 @@ static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int
/* AVS specific */
void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride)
-{
+void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
put_pixels8_c(dst, src, stride, 8);
}
-void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride)
-{
+void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
avg_pixels8_c(dst, src, stride, 8);
}
-void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride)
-{
+void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
put_pixels16_c(dst, src, stride, 16);
}
-void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride)
-{
+void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
avg_pixels16_c(dst, src, stride, 16);
}
#endif /* CONFIG_CAVS_DECODER */
@@ -2795,12 +2655,10 @@ void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
/* VC-1 specific */
void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd)
-{
+void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) {
put_pixels8_c(dst, src, stride, 8);
}
-void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd)
-{
+void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) {
avg_pixels8_c(dst, src, stride, 8);
}
#endif /* CONFIG_VC1_DECODER */
@@ -2812,34 +2670,28 @@ void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx);
#endif /* CONFIG_RV30_DECODER */
#if CONFIG_RV40_DECODER
-static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
put_pixels16_xy2_c(dst, src, stride, 16);
}
-static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
avg_pixels16_xy2_c(dst, src, stride, 16);
}
-static void put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
put_pixels8_xy2_c(dst, src, stride, 8);
}
-static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
avg_pixels8_xy2_c(dst, src, stride, 8);
}
void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx);
#endif /* CONFIG_RV40_DECODER */
-static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w)
-{
+static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i;
- for(i = 0; i < w; i++)
- {
- const int src_1 = src[ -srcStride];
+ for(i=0; i<w; i++){
+ const int src_1= src[ -srcStride];
const int src0 = src[0 ];
const int src1 = src[ srcStride];
const int src2 = src[2*srcStride];
@@ -2850,184 +2702,164 @@ static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int
const int src7 = src[7*srcStride];
const int src8 = src[8*srcStride];
const int src9 = src[9*srcStride];
- dst[0*dstStride] = cm[(9*(src0 + src1) - (src_1 + src2) + 8)>>4];
- dst[1*dstStride] = cm[(9*(src1 + src2) - (src0 + src3) + 8)>>4];
- dst[2*dstStride] = cm[(9*(src2 + src3) - (src1 + src4) + 8)>>4];
- dst[3*dstStride] = cm[(9*(src3 + src4) - (src2 + src5) + 8)>>4];
- dst[4*dstStride] = cm[(9*(src4 + src5) - (src3 + src6) + 8)>>4];
- dst[5*dstStride] = cm[(9*(src5 + src6) - (src4 + src7) + 8)>>4];
- dst[6*dstStride] = cm[(9*(src6 + src7) - (src5 + src8) + 8)>>4];
- dst[7*dstStride] = cm[(9*(src7 + src8) - (src6 + src9) + 8)>>4];
+ dst[0*dstStride]= cm[(9*(src0 + src1) - (src_1 + src2) + 8)>>4];
+ dst[1*dstStride]= cm[(9*(src1 + src2) - (src0 + src3) + 8)>>4];
+ dst[2*dstStride]= cm[(9*(src2 + src3) - (src1 + src4) + 8)>>4];
+ dst[3*dstStride]= cm[(9*(src3 + src4) - (src2 + src5) + 8)>>4];
+ dst[4*dstStride]= cm[(9*(src4 + src5) - (src3 + src6) + 8)>>4];
+ dst[5*dstStride]= cm[(9*(src5 + src6) - (src4 + src7) + 8)>>4];
+ dst[6*dstStride]= cm[(9*(src6 + src7) - (src5 + src8) + 8)>>4];
+ dst[7*dstStride]= cm[(9*(src7 + src8) - (src6 + src9) + 8)>>4];
src++;
dst++;
}
}
-static void put_mspel8_mc00_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){
put_pixels8_c(dst, src, stride, 8);
}
-static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){
uint8_t half[64];
wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
put_pixels8_l2(dst, src, half, stride, stride, 8, 8);
}
-static void put_mspel8_mc20_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){
wmv2_mspel8_h_lowpass(dst, src, stride, stride, 8);
}
-static void put_mspel8_mc30_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){
uint8_t half[64];
wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
- put_pixels8_l2(dst, src + 1, half, stride, stride, 8, 8);
+ put_pixels8_l2(dst, src+1, half, stride, stride, 8, 8);
}
-static void put_mspel8_mc02_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){
wmv2_mspel8_v_lowpass(dst, src, stride, stride, 8);
}
-static void put_mspel8_mc12_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){
uint8_t halfH[88];
uint8_t halfV[64];
uint8_t halfHV[64];
- wmv2_mspel8_h_lowpass(halfH, src - stride, 8, stride, 11);
+ wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8);
- wmv2_mspel8_v_lowpass(halfHV, halfH + 8, 8, 8, 8);
+ wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);
}
-static void put_mspel8_mc32_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){
uint8_t halfH[88];
uint8_t halfV[64];
uint8_t halfHV[64];
- wmv2_mspel8_h_lowpass(halfH, src - stride, 8, stride, 11);
- wmv2_mspel8_v_lowpass(halfV, src + 1, 8, stride, 8);
- wmv2_mspel8_v_lowpass(halfHV, halfH + 8, 8, 8, 8);
+ wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
+ wmv2_mspel8_v_lowpass(halfV, src+1, 8, stride, 8);
+ wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);
}
-static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride)
-{
+static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){
uint8_t halfH[88];
- wmv2_mspel8_h_lowpass(halfH, src - stride, 8, stride, 11);
- wmv2_mspel8_v_lowpass(dst, halfH + 8, stride, 8, 8);
+ wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
+ wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8);
}
-static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale)
-{
- if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER)
- {
- int x;
- const int strength = ff_h263_loop_filter_strength[qscale];
+static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){
+ if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
+ int x;
+ const int strength= ff_h263_loop_filter_strength[qscale];
- for(x = 0; x < 8; x++)
- {
- int d1, d2, ad1;
- int p0 = src[x-2*stride];
- int p1 = src[x-1*stride];
- int p2 = src[x+0*stride];
- int p3 = src[x+1*stride];
- int d = (p0 - p3 + 4 * (p2 - p1)) / 8;
+ for(x=0; x<8; x++){
+ int d1, d2, ad1;
+ int p0= src[x-2*stride];
+ int p1= src[x-1*stride];
+ int p2= src[x+0*stride];
+ int p3= src[x+1*stride];
+ int d = (p0 - p3 + 4*(p2 - p1)) / 8;
- if(d < -2 * strength) d1 = 0;
- else if(d < - strength) d1 = -2 * strength - d;
- else if(d < strength) d1 = d;
- else if(d < 2 * strength) d1 = 2 * strength - d;
- else d1 = 0;
+ if (d<-2*strength) d1= 0;
+ else if(d<- strength) d1=-2*strength - d;
+ else if(d< strength) d1= d;
+ else if(d< 2*strength) d1= 2*strength - d;
+ else d1= 0;
- p1 += d1;
- p2 -= d1;
- if(p1 & 256) p1 = ~(p1 >> 31);
- if(p2 & 256) p2 = ~(p2 >> 31);
+ p1 += d1;
+ p2 -= d1;
+ if(p1&256) p1= ~(p1>>31);
+ if(p2&256) p2= ~(p2>>31);
- src[x-1*stride] = p1;
- src[x+0*stride] = p2;
+ src[x-1*stride] = p1;
+ src[x+0*stride] = p2;
- ad1 = FFABS(d1) >> 1;
+ ad1= FFABS(d1)>>1;
- d2 = av_clip((p0 - p3) / 4, -ad1, ad1);
+ d2= av_clip((p0-p3)/4, -ad1, ad1);
- src[x-2*stride] = p0 - d2;
- src[x+ stride] = p3 + d2;
- }
+ src[x-2*stride] = p0 - d2;
+ src[x+ stride] = p3 + d2;
+ }
}
}
-static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale)
-{
- if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER)
- {
- int y;
- const int strength = ff_h263_loop_filter_strength[qscale];
-
- for(y = 0; y < 8; y++)
- {
- int d1, d2, ad1;
- int p0 = src[y*stride-2];
- int p1 = src[y*stride-1];
- int p2 = src[y*stride+0];
- int p3 = src[y*stride+1];
- int d = (p0 - p3 + 4 * (p2 - p1)) / 8;
-
- if(d < -2 * strength) d1 = 0;
- else if(d < - strength) d1 = -2 * strength - d;
- else if(d < strength) d1 = d;
- else if(d < 2 * strength) d1 = 2 * strength - d;
- else d1 = 0;
-
- p1 += d1;
- p2 -= d1;
- if(p1 & 256) p1 = ~(p1 >> 31);
- if(p2 & 256) p2 = ~(p2 >> 31);
-
- src[y*stride-1] = p1;
- src[y*stride+0] = p2;
-
- ad1 = FFABS(d1) >> 1;
-
- d2 = av_clip((p0 - p3) / 4, -ad1, ad1);
-
- src[y*stride-2] = p0 - d2;
- src[y*stride+1] = p3 + d2;
- }
+static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){
+ if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
+ int y;
+ const int strength= ff_h263_loop_filter_strength[qscale];
+
+ for(y=0; y<8; y++){
+ int d1, d2, ad1;
+ int p0= src[y*stride-2];
+ int p1= src[y*stride-1];
+ int p2= src[y*stride+0];
+ int p3= src[y*stride+1];
+ int d = (p0 - p3 + 4*(p2 - p1)) / 8;
+
+ if (d<-2*strength) d1= 0;
+ else if(d<- strength) d1=-2*strength - d;
+ else if(d< strength) d1= d;
+ else if(d< 2*strength) d1= 2*strength - d;
+ else d1= 0;
+
+ p1 += d1;
+ p2 -= d1;
+ if(p1&256) p1= ~(p1>>31);
+ if(p2&256) p2= ~(p2>>31);
+
+ src[y*stride-1] = p1;
+ src[y*stride+0] = p2;
+
+ ad1= FFABS(d1)>>1;
+
+ d2= av_clip((p0-p3)/4, -ad1, ad1);
+
+ src[y*stride-2] = p0 - d2;
+ src[y*stride+1] = p3 + d2;
+ }
}
}
-static void h261_loop_filter_c(uint8_t *src, int stride)
-{
- int x, y, xy, yz;
+static void h261_loop_filter_c(uint8_t *src, int stride){
+ int x,y,xy,yz;
int temp[64];
- for(x = 0; x < 8; x++)
- {
- temp[x ] = 4 * src[x ];
- temp[x + 7*8] = 4 * src[x + 7*stride];
+ for(x=0; x<8; x++){
+ temp[x ] = 4*src[x ];
+ temp[x + 7*8] = 4*src[x + 7*stride];
}
- for(y = 1; y < 7; y++)
- {
- for(x = 0; x < 8; x++)
- {
+ for(y=1; y<7; y++){
+ for(x=0; x<8; x++){
xy = y * stride + x;
yz = y * 8 + x;
- temp[yz] = src[xy - stride] + 2 * src[xy] + src[xy + stride];
+ temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride];
}
}
- for(y = 0; y < 8; y++)
- {
- src[ y*stride] = (temp[ y*8] + 2) >> 2;
- src[7+y*stride] = (temp[7+y*8] + 2) >> 2;
- for(x = 1; x < 7; x++)
- {
+ for(y=0; y<8; y++){
+ src[ y*stride] = (temp[ y*8] + 2)>>2;
+ src[7+y*stride] = (temp[7+y*8] + 2)>>2;
+ for(x=1; x<7; x++){
xy = y * stride + x;
yz = y * 8 + x;
- src[xy] = (temp[yz-1] + 2 * temp[yz] + temp[yz+1] + 8) >> 4;
+ src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4;
}
}
}
@@ -3035,15 +2867,12 @@ static void h261_loop_filter_c(uint8_t *src, int stride)
static av_always_inline av_flatten void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0)
{
int i, d;
- for(i = 0; i < 4; i++)
- {
- if(tc0[i] < 0)
- {
- pix += 4 * ystride;
+ for( i = 0; i < 4; i++ ) {
+ if( tc0[i] < 0 ) {
+ pix += 4*ystride;
continue;
}
- for(d = 0; d < 4; d++)
- {
+ for( d = 0; d < 4; d++ ) {
const int p0 = pix[-1*xstride];
const int p1 = pix[-2*xstride];
const int p2 = pix[-3*xstride];
@@ -3051,30 +2880,27 @@ static av_always_inline av_flatten void h264_loop_filter_luma_c(uint8_t *pix, in
const int q1 = pix[1*xstride];
const int q2 = pix[2*xstride];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
int tc = tc0[i];
int i_delta;
- if(FFABS(p2 - p0) < beta)
- {
+ if( FFABS( p2 - p0 ) < beta ) {
if(tc0[i])
- pix[-2*xstride] = p1 + av_clip(((p2 + ((p0 + q0 + 1) >> 1)) >> 1) - p1, -tc0[i], tc0[i]);
+ pix[-2*xstride] = p1 + av_clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] );
tc++;
}
- if(FFABS(q2 - q0) < beta)
- {
+ if( FFABS( q2 - q0 ) < beta ) {
if(tc0[i])
- pix[ xstride] = q1 + av_clip(((q2 + ((p0 + q0 + 1) >> 1)) >> 1) - q1, -tc0[i], tc0[i]);
+ pix[ xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] );
tc++;
}
- i_delta = av_clip((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -tc, tc);
- pix[-xstride] = av_clip_uint8(p0 + i_delta); /* p0' */
- pix[0] = av_clip_uint8(q0 - i_delta); /* q0' */
+ i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
+ pix[-xstride] = av_clip_uint8( p0 + i_delta ); /* p0' */
+ pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */
}
pix += ystride;
}
@@ -3092,8 +2918,7 @@ static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int b
static av_always_inline av_flatten void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta)
{
int d;
- for(d = 0; d < 16; d++)
- {
+ for( d = 0; d < 16; d++ ) {
const int p2 = pix[-3*xstride];
const int p1 = pix[-2*xstride];
const int p0 = pix[-1*xstride];
@@ -3102,45 +2927,37 @@ static av_always_inline av_flatten void h264_loop_filter_luma_intra_c(uint8_t *p
const int q1 = pix[ 1*xstride];
const int q2 = pix[ 2*xstride];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
- if(FFABS(p0 - q0) < ((alpha >> 2) + 2))
- {
- if(FFABS(p2 - p0) < beta)
+ if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
+ if( FFABS( p2 - p0 ) < beta)
{
const int p3 = pix[-4*xstride];
/* p0', p1', p2' */
- pix[-1*xstride] = (p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3;
- pix[-2*xstride] = (p2 + p1 + p0 + q0 + 2) >> 2;
- pix[-3*xstride] = (2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3;
- }
- else
- {
+ pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
+ pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
+ pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
+ } else {
/* p0' */
- pix[-1*xstride] = (2 * p1 + p0 + q1 + 2) >> 2;
+ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
}
- if(FFABS(q2 - q0) < beta)
+ if( FFABS( q2 - q0 ) < beta)
{
const int q3 = pix[3*xstride];
/* q0', q1', q2' */
- pix[0*xstride] = (p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3;
- pix[1*xstride] = (p0 + q0 + q1 + q2 + 2) >> 2;
- pix[2*xstride] = (2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3;
- }
- else
- {
+ pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
+ pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
+ pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
+ } else {
/* q0' */
- pix[0*xstride] = (2 * q1 + q0 + p1 + 2) >> 2;
+ pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
}
- }
- else
- {
+ }else{
/* p0', q0' */
- pix[-1*xstride] = (2 * p1 + p0 + q1 + 2) >> 2;
- pix[ 0*xstride] = (2 * q1 + q0 + p1 + 2) >> 2;
+ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
+ pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
}
}
pix += ystride;
@@ -3158,30 +2975,26 @@ static void h264_h_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha,
static av_always_inline av_flatten void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0)
{
int i, d;
- for(i = 0; i < 4; i++)
- {
+ for( i = 0; i < 4; i++ ) {
const int tc = tc0[i];
- if(tc <= 0)
- {
- pix += 2 * ystride;
+ if( tc <= 0 ) {
+ pix += 2*ystride;
continue;
}
- for(d = 0; d < 2; d++)
- {
+ for( d = 0; d < 2; d++ ) {
const int p0 = pix[-1*xstride];
const int p1 = pix[-2*xstride];
const int q0 = pix[0];
const int q1 = pix[1*xstride];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
- int delta = av_clip((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -tc, tc);
+ int delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
- pix[-xstride] = av_clip_uint8(p0 + delta); /* p0' */
- pix[0] = av_clip_uint8(q0 - delta); /* q0' */
+ pix[-xstride] = av_clip_uint8( p0 + delta ); /* p0' */
+ pix[0] = av_clip_uint8( q0 - delta ); /* q0' */
}
pix += ystride;
}
@@ -3199,20 +3012,18 @@ static void h264_h_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int
static av_always_inline av_flatten void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta)
{
int d;
- for(d = 0; d < 8; d++)
- {
+ for( d = 0; d < 8; d++ ) {
const int p0 = pix[-1*xstride];
const int p1 = pix[-2*xstride];
const int q0 = pix[0];
const int q1 = pix[1*xstride];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
- pix[-xstride] = (2 * p1 + p0 + q1 + 2) >> 2; /* p0' */
- pix[0] = (2 * q1 + q0 + p1 + 2) >> 2; /* q0' */
+ pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */
+ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */
}
pix += ystride;
}
@@ -3231,8 +3042,7 @@ static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_si
int s, i;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - pix2[0]);
s += abs(pix1[1] - pix2[1]);
s += abs(pix1[2] - pix2[2]);
@@ -3260,8 +3070,7 @@ static int pix_abs16_x2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
int s, i;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - avg2(pix2[0], pix2[1]));
s += abs(pix1[1] - avg2(pix2[1], pix2[2]));
s += abs(pix1[2] - avg2(pix2[2], pix2[3]));
@@ -3290,8 +3099,7 @@ static int pix_abs16_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
uint8_t *pix3 = pix2 + line_size;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - avg2(pix2[0], pix3[0]));
s += abs(pix1[1] - avg2(pix2[1], pix3[1]));
s += abs(pix1[2] - avg2(pix2[2], pix3[2]));
@@ -3321,8 +3129,7 @@ static int pix_abs16_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
uint8_t *pix3 = pix2 + line_size;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1]));
s += abs(pix1[1] - avg4(pix2[1], pix2[2], pix3[1], pix3[2]));
s += abs(pix1[2] - avg4(pix2[2], pix2[3], pix3[2], pix3[3]));
@@ -3351,8 +3158,7 @@ static inline int pix_abs8_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz
int s, i;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - pix2[0]);
s += abs(pix1[1] - pix2[1]);
s += abs(pix1[2] - pix2[2]);
@@ -3372,8 +3178,7 @@ static int pix_abs8_x2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
int s, i;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - avg2(pix2[0], pix2[1]));
s += abs(pix1[1] - avg2(pix2[1], pix2[2]));
s += abs(pix1[2] - avg2(pix2[2], pix2[3]));
@@ -3394,8 +3199,7 @@ static int pix_abs8_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
uint8_t *pix3 = pix2 + line_size;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - avg2(pix2[0], pix3[0]));
s += abs(pix1[1] - avg2(pix2[1], pix3[1]));
s += abs(pix1[2] - avg2(pix2[2], pix3[2]));
@@ -3417,8 +3221,7 @@ static int pix_abs8_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
uint8_t *pix3 = pix2 + line_size;
s = 0;
- for(i = 0; i < h; i++)
- {
+ for(i=0;i<h;i++) {
s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1]));
s += abs(pix1[1] - avg4(pix2[1], pix2[2], pix3[1], pix3[2]));
s += abs(pix1[2] - avg4(pix2[2], pix2[3], pix3[2], pix3[3]));
@@ -3434,92 +3237,78 @@ static int pix_abs8_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
return s;
}
-static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h)
-{
+static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){
MpegEncContext *c = v;
- int score1 = 0;
- int score2 = 0;
- int x, y;
+ int score1=0;
+ int score2=0;
+ int x,y;
- for(y = 0; y < h; y++)
- {
- for(x = 0; x < 16; x++)
- {
- score1 += (s1[x ] - s2[x ]) * (s1[x ] - s2[x ]);
+ for(y=0; y<h; y++){
+ for(x=0; x<16; x++){
+ score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]);
}
- if(y + 1 < h)
- {
- for(x = 0; x < 15; x++)
- {
- score2 += FFABS(s1[x ] - s1[x +stride]
- - s1[x+1] + s1[x+1+stride])
- - FFABS(s2[x ] - s2[x +stride]
- - s2[x+1] + s2[x+1+stride]);
+ if(y+1<h){
+ for(x=0; x<15; x++){
+ score2+= FFABS( s1[x ] - s1[x +stride]
+ - s1[x+1] + s1[x+1+stride])
+ -FFABS( s2[x ] - s2[x +stride]
+ - s2[x+1] + s2[x+1+stride]);
}
}
- s1 += stride;
- s2 += stride;
+ s1+= stride;
+ s2+= stride;
}
- if(c) return score1 + FFABS(score2) * c->avctx->nsse_weight;
- else return score1 + FFABS(score2) * 8;
+ if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
+ else return score1 + FFABS(score2)*8;
}
-static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h)
-{
+static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){
MpegEncContext *c = v;
- int score1 = 0;
- int score2 = 0;
- int x, y;
+ int score1=0;
+ int score2=0;
+ int x,y;
- for(y = 0; y < h; y++)
- {
- for(x = 0; x < 8; x++)
- {
- score1 += (s1[x ] - s2[x ]) * (s1[x ] - s2[x ]);
+ for(y=0; y<h; y++){
+ for(x=0; x<8; x++){
+ score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]);
}
- if(y + 1 < h)
- {
- for(x = 0; x < 7; x++)
- {
- score2 += FFABS(s1[x ] - s1[x +stride]
- - s1[x+1] + s1[x+1+stride])
- - FFABS(s2[x ] - s2[x +stride]
- - s2[x+1] + s2[x+1+stride]);
+ if(y+1<h){
+ for(x=0; x<7; x++){
+ score2+= FFABS( s1[x ] - s1[x +stride]
+ - s1[x+1] + s1[x+1+stride])
+ -FFABS( s2[x ] - s2[x +stride]
+ - s2[x+1] + s2[x+1+stride]);
}
}
- s1 += stride;
- s2 += stride;
+ s1+= stride;
+ s2+= stride;
}
- if(c) return score1 + FFABS(score2) * c->avctx->nsse_weight;
- else return score1 + FFABS(score2) * 8;
+ if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
+ else return score1 + FFABS(score2)*8;
}
-static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale)
-{
+static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
int i;
- unsigned int sum = 0;
+ unsigned int sum=0;
- for(i = 0; i < 8 * 8; i++)
- {
- int b = rem[i] + ((basis[i] * scale + (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >> (BASIS_SHIFT - RECON_SHIFT));
- int w = weight[i];
- b >>= RECON_SHIFT;
- assert(-512 < b && b < 512);
+ for(i=0; i<8*8; i++){
+ int b= rem[i] + ((basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT));
+ int w= weight[i];
+ b>>= RECON_SHIFT;
+ assert(-512<b && b<512);
- sum += (w * b) * (w * b) >> 4;
+ sum += (w*b)*(w*b)>>4;
}
- return sum >> 2;
+ return sum>>2;
}
-static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale)
-{
+static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){
int i;
- for(i = 0; i < 8 * 8; i++)
- {
- rem[i] += (basis[i] * scale + (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >> (BASIS_SHIFT - RECON_SHIFT);
+ for(i=0; i<8*8; i++){
+ rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT);
}
}
@@ -3536,95 +3325,89 @@ void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scant
int i;
DCTELEM temp[64];
- if(last <= 0) return;
+ if(last<=0) return;
//if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations
- for(i = 0; i <= last; i++)
- {
- const int j = scantable[i];
- temp[j] = block[j];
- block[j] = 0;
+ for(i=0; i<=last; i++){
+ const int j= scantable[i];
+ temp[j]= block[j];
+ block[j]=0;
}
- for(i = 0; i <= last; i++)
- {
- const int j = scantable[i];
- const int perm_j = permutation[j];
- block[perm_j] = temp[j];
+ for(i=0; i<=last; i++){
+ const int j= scantable[i];
+ const int perm_j= permutation[j];
+ block[perm_j]= temp[j];
}
}
-static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h)
-{
+static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){
return 0;
}
-void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type)
-{
+void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
int i;
- memset(cmp, 0, sizeof(void*) * 6);
+ memset(cmp, 0, sizeof(void*)*6);
- for(i = 0; i < 6; i++)
- {
- switch(type & 0xFF)
- {
+ for(i=0; i<6; i++){
+ switch(type&0xFF){
case FF_CMP_SAD:
- cmp[i] = c->sad[i];
+ cmp[i]= c->sad[i];
break;
case FF_CMP_SATD:
- cmp[i] = c->hadamard8_diff[i];
+ cmp[i]= c->hadamard8_diff[i];
break;
case FF_CMP_SSE:
- cmp[i] = c->sse[i];
+ cmp[i]= c->sse[i];
break;
case FF_CMP_DCT:
- cmp[i] = c->dct_sad[i];
+ cmp[i]= c->dct_sad[i];
break;
case FF_CMP_DCT264:
- cmp[i] = c->dct264_sad[i];
+ cmp[i]= c->dct264_sad[i];
break;
case FF_CMP_DCTMAX:
- cmp[i] = c->dct_max[i];
+ cmp[i]= c->dct_max[i];
break;
case FF_CMP_PSNR:
- cmp[i] = c->quant_psnr[i];
+ cmp[i]= c->quant_psnr[i];
break;
case FF_CMP_BIT:
- cmp[i] = c->bit[i];
+ cmp[i]= c->bit[i];
break;
case FF_CMP_RD:
- cmp[i] = c->rd[i];
+ cmp[i]= c->rd[i];
break;
case FF_CMP_VSAD:
- cmp[i] = c->vsad[i];
+ cmp[i]= c->vsad[i];
break;
case FF_CMP_VSSE:
- cmp[i] = c->vsse[i];
+ cmp[i]= c->vsse[i];
break;
case FF_CMP_ZERO:
- cmp[i] = zero_cmp;
+ cmp[i]= zero_cmp;
break;
case FF_CMP_NSSE:
- cmp[i] = c->nsse[i];
+ cmp[i]= c->nsse[i];
break;
#if CONFIG_SNOW_ENCODER
case FF_CMP_W53:
- cmp[i] = c->w53[i];
+ cmp[i]= c->w53[i];
break;
case FF_CMP_W97:
- cmp[i] = c->w97[i];
+ cmp[i]= c->w97[i];
break;
#endif
default:
- av_log(NULL, AV_LOG_ERROR, "internal error in cmp function selection\n");
+ av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n");
}
}
}
static void clear_block_c(DCTELEM *block)
{
- memset(block, 0, sizeof(DCTELEM) * 64);
+ memset(block, 0, sizeof(DCTELEM)*64);
}
/**
@@ -3632,121 +3415,105 @@ static void clear_block_c(DCTELEM *block)
*/
static void clear_blocks_c(DCTELEM *blocks)
{
- memset(blocks, 0, sizeof(DCTELEM) * 6 * 64);
+ memset(blocks, 0, sizeof(DCTELEM)*6*64);
}
-static void add_bytes_c(uint8_t *dst, uint8_t *src, int w)
-{
+static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
long i;
- for(i = 0; i <= w - sizeof(long); i += sizeof(long))
- {
- long a = *(long*)(src + i);
- long b = *(long*)(dst + i);
- *(long*)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^((a ^ b)&pb_80);
+ for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
+ long a = *(long*)(src+i);
+ long b = *(long*)(dst+i);
+ *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
}
- for(; i < w; i++)
+ for(; i<w; i++)
dst[i+0] += src[i+0];
}
-static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
-{
+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=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];
+ 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)
-{
+static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
long i;
#if !HAVE_FAST_UNALIGNED
- if((long)src2 & (sizeof(long) - 1))
- {
- for(i = 0; i + 7 < w; i += 8)
- {
- dst[i+0] = src1[i+0] - src2[i+0];
- dst[i+1] = src1[i+1] - src2[i+1];
- dst[i+2] = src1[i+2] - src2[i+2];
- dst[i+3] = src1[i+3] - src2[i+3];
- dst[i+4] = src1[i+4] - src2[i+4];
- dst[i+5] = src1[i+5] - src2[i+5];
- dst[i+6] = src1[i+6] - src2[i+6];
- dst[i+7] = src1[i+7] - src2[i+7];
+ if((long)src2 & (sizeof(long)-1)){
+ for(i=0; i+7<w; i+=8){
+ dst[i+0] = src1[i+0]-src2[i+0];
+ dst[i+1] = src1[i+1]-src2[i+1];
+ dst[i+2] = src1[i+2]-src2[i+2];
+ dst[i+3] = src1[i+3]-src2[i+3];
+ dst[i+4] = src1[i+4]-src2[i+4];
+ dst[i+5] = src1[i+5]-src2[i+5];
+ dst[i+6] = src1[i+6]-src2[i+6];
+ dst[i+7] = src1[i+7]-src2[i+7];
}
- }
- else
+ }else
#endif
- 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_80) - (b & pb_7f)) ^((a ^ b ^ pb_80)&pb_80);
- }
- for(; i < w; i++)
- dst[i+0] = src1[i+0] - src2[i+0];
+ 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_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
+ }
+ for(; i<w; i++)
+ dst[i+0] = src1[i+0]-src2[i+0];
}
-static void add_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *diff, int w, int *left, int *left_top)
-{
+static void add_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *diff, int w, int *left, int *left_top){
int i;
uint8_t l, lt;
- l = *left;
- lt = *left_top;
+ l= *left;
+ lt= *left_top;
- for(i = 0; i < w; i++)
- {
- l = mid_pred(l, src1[i], (l + src1[i] - lt) & 0xFF) + diff[i];
- lt = src1[i];
- dst[i] = l;
+ for(i=0; i<w; i++){
+ l= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF) + diff[i];
+ lt= src1[i];
+ dst[i]= l;
}
- *left = l;
- *left_top = lt;
+ *left= l;
+ *left_top= lt;
}
-static void sub_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top)
-{
+static void sub_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top){
int i;
uint8_t l, lt;
- l = *left;
- lt = *left_top;
+ l= *left;
+ lt= *left_top;
- for(i = 0; i < w; i++)
- {
- const int pred = mid_pred(l, src1[i], (l + src1[i] - lt) & 0xFF);
- lt = src1[i];
- l = src2[i];
- dst[i] = l - pred;
+ for(i=0; i<w; i++){
+ const int pred= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF);
+ lt= src1[i];
+ l= src2[i];
+ dst[i]= l - pred;
}
- *left = l;
- *left_top = lt;
+ *left= l;
+ *left_top= lt;
}
-static int add_hfyu_left_prediction_c(uint8_t *dst, const uint8_t *src, int w, int acc)
-{
+static int add_hfyu_left_prediction_c(uint8_t *dst, const uint8_t *src, int w, int acc){
int i;
- for(i = 0; i < w - 1; i++)
- {
- acc += src[i];
- dst[i] = acc;
+ for(i=0; i<w-1; i++){
+ acc+= src[i];
+ dst[i]= acc;
i++;
- acc += src[i];
- dst[i] = acc;
+ acc+= src[i];
+ dst[i]= acc;
}
- for(; i < w; i++)
- {
- acc += src[i];
- dst[i] = acc;
+ for(; i<w; i++){
+ acc+= src[i];
+ dst[i]= acc;
}
return acc;
@@ -3763,32 +3530,30 @@ static int add_hfyu_left_prediction_c(uint8_t *dst, const uint8_t *src, int w, i
#define R 2
#define A 3
#endif
-static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha)
-{
+static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha){
int i;
- int r, g, b, a;
- r = *red;
- g = *green;
- b = *blue;
- a = *alpha;
+ int r,g,b,a;
+ r= *red;
+ g= *green;
+ b= *blue;
+ a= *alpha;
- for(i = 0; i < w; i++)
- {
- b += src[4*i+B];
- g += src[4*i+G];
- r += src[4*i+R];
- a += src[4*i+A];
-
- dst[4*i+B] = b;
- dst[4*i+G] = g;
- dst[4*i+R] = r;
- dst[4*i+A] = a;
+ for(i=0; i<w; i++){
+ b+= src[4*i+B];
+ g+= src[4*i+G];
+ r+= src[4*i+R];
+ a+= src[4*i+A];
+
+ dst[4*i+B]= b;
+ dst[4*i+G]= g;
+ dst[4*i+R]= r;
+ dst[4*i+A]= a;
}
- *red = r;
- *green = g;
- *blue = b;
- *alpha = a;
+ *red= r;
+ *green= g;
+ *blue= b;
+ *alpha= a;
}
#undef B
#undef G
@@ -3810,21 +3575,19 @@ o2= (i1)-(i2);
#define BUTTERFLYA(x,y) (FFABS((x)+(y)) + FFABS((x)-(y)))
-static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h)
-{
+static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
int i;
int temp[64];
- int sum = 0;
+ int sum=0;
- assert(h == 8);
+ assert(h==8);
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
//FIXME try pointer walks
- BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0] - dst[stride*i+0], src[stride*i+1] - dst[stride*i+1]);
- BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2] - dst[stride*i+2], src[stride*i+3] - dst[stride*i+3]);
- BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4] - dst[stride*i+4], src[stride*i+5] - dst[stride*i+5]);
- BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6] - dst[stride*i+6], src[stride*i+7] - dst[stride*i+7]);
+ BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0]-dst[stride*i+0],src[stride*i+1]-dst[stride*i+1]);
+ BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2]-dst[stride*i+2],src[stride*i+3]-dst[stride*i+3]);
+ BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4]-dst[stride*i+4],src[stride*i+5]-dst[stride*i+5]);
+ BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6]-dst[stride*i+6],src[stride*i+7]-dst[stride*i+7]);
BUTTERFLY1(temp[8*i+0], temp[8*i+2]);
BUTTERFLY1(temp[8*i+1], temp[8*i+3]);
@@ -3837,8 +3600,7 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t
BUTTERFLY1(temp[8*i+3], temp[8*i+7]);
}
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
BUTTERFLY1(temp[8*0+i], temp[8*1+i]);
BUTTERFLY1(temp[8*2+i], temp[8*3+i]);
BUTTERFLY1(temp[8*4+i], temp[8*5+i]);
@@ -3850,37 +3612,34 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t
BUTTERFLY1(temp[8*5+i], temp[8*7+i]);
sum +=
- BUTTERFLYA(temp[8*0+i], temp[8*4+i])
- + BUTTERFLYA(temp[8*1+i], temp[8*5+i])
- + BUTTERFLYA(temp[8*2+i], temp[8*6+i])
- + BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
+ BUTTERFLYA(temp[8*0+i], temp[8*4+i])
+ +BUTTERFLYA(temp[8*1+i], temp[8*5+i])
+ +BUTTERFLYA(temp[8*2+i], temp[8*6+i])
+ +BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
}
#if 0
- static int maxi = 0;
- if(sum > maxi)
- {
- maxi = sum;
- printf("MAX:%d\n", maxi);
- }
+static int maxi=0;
+if(sum>maxi){
+ maxi=sum;
+ printf("MAX:%d\n", maxi);
+}
#endif
return sum;
}
-static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_t *dummy, int stride, int h)
-{
+static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_t *dummy, int stride, int h){
int i;
int temp[64];
- int sum = 0;
+ int sum=0;
- assert(h == 8);
+ assert(h==8);
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
//FIXME try pointer walks
- BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0], src[stride*i+1]);
- BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2], src[stride*i+3]);
- BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4], src[stride*i+5]);
- BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6], src[stride*i+7]);
+ BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0],src[stride*i+1]);
+ BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2],src[stride*i+3]);
+ BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4],src[stride*i+5]);
+ BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6],src[stride*i+7]);
BUTTERFLY1(temp[8*i+0], temp[8*i+2]);
BUTTERFLY1(temp[8*i+1], temp[8*i+3]);
@@ -3893,8 +3652,7 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_
BUTTERFLY1(temp[8*i+3], temp[8*i+7]);
}
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
BUTTERFLY1(temp[8*0+i], temp[8*1+i]);
BUTTERFLY1(temp[8*2+i], temp[8*3+i]);
BUTTERFLY1(temp[8*4+i], temp[8*5+i]);
@@ -3906,10 +3664,10 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_
BUTTERFLY1(temp[8*5+i], temp[8*7+i]);
sum +=
- BUTTERFLYA(temp[8*0+i], temp[8*4+i])
- + BUTTERFLYA(temp[8*1+i], temp[8*5+i])
- + BUTTERFLYA(temp[8*2+i], temp[8*6+i])
- + BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
+ BUTTERFLYA(temp[8*0+i], temp[8*4+i])
+ +BUTTERFLYA(temp[8*1+i], temp[8*5+i])
+ +BUTTERFLYA(temp[8*2+i], temp[8*6+i])
+ +BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
}
sum -= FFABS(temp[8*0] + temp[8*4]); // -mean
@@ -3917,13 +3675,12 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_
return sum;
}
-static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h)
-{
- MpegEncContext * const s = (MpegEncContext *)c;
+static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
+ MpegEncContext * const s= (MpegEncContext *)c;
DECLARE_ALIGNED_16(uint64_t, aligned_temp)[sizeof(DCTELEM)*64/8];
- DCTELEM * const temp = (DCTELEM*)aligned_temp;
+ DCTELEM * const temp= (DCTELEM*)aligned_temp;
- assert(h == 8);
+ assert(h==8);
s->dsp.diff_pixels(temp, src1, src2, stride);
s->dsp.fdct(temp);
@@ -3958,154 +3715,138 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2
DST(7, (a4>>2) - a7 ) ;\
}
-static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h)
-{
- MpegEncContext * const s = (MpegEncContext *)c;
+static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
+ MpegEncContext * const s= (MpegEncContext *)c;
DCTELEM dct[8][8];
int i;
- int sum = 0;
+ int sum=0;
s->dsp.diff_pixels(dct[0], src1, src2, stride);
#define SRC(x) dct[i][x]
#define DST(x,v) dct[i][x]= v
- for(i = 0; i < 8; i++)
+ for( i = 0; i < 8; i++ )
DCT8_1D
#undef SRC
#undef DST
#define SRC(x) dct[x][i]
#define DST(x,v) sum += FFABS(v)
- for(i = 0; i < 8; i++)
- DCT8_1D
+ for( i = 0; i < 8; i++ )
+ DCT8_1D
#undef SRC
#undef DST
- return sum;
+ return sum;
}
#endif
-static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h)
-{
- MpegEncContext * const s = (MpegEncContext *)c;
+static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
+ MpegEncContext * const s= (MpegEncContext *)c;
DECLARE_ALIGNED_16(uint64_t, aligned_temp)[sizeof(DCTELEM)*64/8];
- DCTELEM * const temp = (DCTELEM*)aligned_temp;
- int sum = 0, i;
+ DCTELEM * const temp= (DCTELEM*)aligned_temp;
+ int sum=0, i;
- assert(h == 8);
+ assert(h==8);
s->dsp.diff_pixels(temp, src1, src2, stride);
s->dsp.fdct(temp);
- for(i = 0; i < 64; i++)
- sum = FFMAX(sum, FFABS(temp[i]));
+ for(i=0; i<64; i++)
+ sum= FFMAX(sum, FFABS(temp[i]));
return sum;
}
-static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h)
-{
- MpegEncContext * const s = (MpegEncContext *)c;
+static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
+ MpegEncContext * const s= (MpegEncContext *)c;
DECLARE_ALIGNED_16(uint64_t, aligned_temp)[sizeof(DCTELEM)*64*2/8];
- DCTELEM * const temp = (DCTELEM*)aligned_temp;
- DCTELEM * const bak = ((DCTELEM*)aligned_temp) + 64;
- int sum = 0, i;
+ DCTELEM * const temp= (DCTELEM*)aligned_temp;
+ DCTELEM * const bak = ((DCTELEM*)aligned_temp)+64;
+ int sum=0, i;
- assert(h == 8);
- s->mb_intra = 0;
+ assert(h==8);
+ s->mb_intra=0;
s->dsp.diff_pixels(temp, src1, src2, stride);
- memcpy(bak, temp, 64 * sizeof(DCTELEM));
+ memcpy(bak, temp, 64*sizeof(DCTELEM));
- s->block_last_index[0/*FIXME*/] = s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
+ s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
s->dct_unquantize_inter(s, temp, 0, s->qscale);
ff_simple_idct(temp); //FIXME
- for(i = 0; i < 64; i++)
- sum += (temp[i] - bak[i]) * (temp[i] - bak[i]);
+ for(i=0; i<64; i++)
+ sum+= (temp[i]-bak[i])*(temp[i]-bak[i]);
return sum;
}
-static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h)
-{
- MpegEncContext * const s = (MpegEncContext *)c;
- const uint8_t *scantable = s->intra_scantable.permutated;
+static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
+ MpegEncContext * const s= (MpegEncContext *)c;
+ const uint8_t *scantable= s->intra_scantable.permutated;
DECLARE_ALIGNED_16(uint64_t, aligned_temp)[sizeof(DCTELEM)*64/8];
DECLARE_ALIGNED_16(uint64_t, aligned_src1)[8];
DECLARE_ALIGNED_16(uint64_t, aligned_src2)[8];
- DCTELEM * const temp = (DCTELEM*)aligned_temp;
+ DCTELEM * const temp= (DCTELEM*)aligned_temp;
uint8_t * const lsrc1 = (uint8_t*)aligned_src1;
uint8_t * const lsrc2 = (uint8_t*)aligned_src2;
int i, last, run, bits, level, distortion, start_i;
- const int esc_length = s->ac_esc_length;
+ const int esc_length= s->ac_esc_length;
uint8_t * length;
uint8_t * last_length;
- assert(h == 8);
+ assert(h==8);
copy_block8(lsrc1, src1, 8, stride, 8);
copy_block8(lsrc2, src2, 8, stride, 8);
s->dsp.diff_pixels(temp, lsrc1, lsrc2, 8);
- s->block_last_index[0/*FIXME*/] = last = s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
+ s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
- bits = 0;
+ bits=0;
- if(s->mb_intra)
- {
+ if (s->mb_intra) {
start_i = 1;
length = s->intra_ac_vlc_length;
- last_length = s->intra_ac_vlc_last_length;
- bits += s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma
- }
- else
- {
+ last_length= s->intra_ac_vlc_last_length;
+ bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma
+ } else {
start_i = 0;
length = s->inter_ac_vlc_length;
- last_length = s->inter_ac_vlc_last_length;
- }
-
- if(last >= start_i)
- {
- run = 0;
- for(i = start_i; i < last; i++)
- {
- int j = scantable[i];
- level = temp[j];
-
- if(level)
- {
- level += 64;
- if((level&(~127)) == 0)
- {
- bits += length[UNI_AC_ENC_INDEX(run, level)];
- }
- else
- bits += esc_length;
- run = 0;
- }
- else
+ last_length= s->inter_ac_vlc_last_length;
+ }
+
+ if(last>=start_i){
+ run=0;
+ for(i=start_i; i<last; i++){
+ int j= scantable[i];
+ level= temp[j];
+
+ if(level){
+ level+=64;
+ if((level&(~127)) == 0){
+ bits+= length[UNI_AC_ENC_INDEX(run, level)];
+ }else
+ bits+= esc_length;
+ run=0;
+ }else
run++;
}
- i = scantable[last];
+ i= scantable[last];
- level = temp[i] + 64;
+ level= temp[i] + 64;
assert(level - 64);
- if((level&(~127)) == 0)
- {
- bits += last_length[UNI_AC_ENC_INDEX(run, level)];
- }
- else
- bits += esc_length;
+ if((level&(~127)) == 0){
+ bits+= last_length[UNI_AC_ENC_INDEX(run, level)];
+ }else
+ bits+= esc_length;
}
- if(last >= 0)
- {
+ if(last>=0){
if(s->mb_intra)
s->dct_unquantize_intra(s, temp, 0, s->qscale);
else
@@ -4114,78 +3855,66 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int
s->dsp.idct_add(lsrc2, 8, temp);
- distortion = s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8);
+ distortion= s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8);
- return distortion + ((bits * s->qscale * s->qscale * 109 + 64) >> 7);
+ return distortion + ((bits*s->qscale*s->qscale*109 + 64)>>7);
}
-static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h)
-{
- MpegEncContext * const s = (MpegEncContext *)c;
- const uint8_t *scantable = s->intra_scantable.permutated;
+static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
+ MpegEncContext * const s= (MpegEncContext *)c;
+ const uint8_t *scantable= s->intra_scantable.permutated;
DECLARE_ALIGNED_16(uint64_t, aligned_temp)[sizeof(DCTELEM)*64/8];
- DCTELEM * const temp = (DCTELEM*)aligned_temp;
+ DCTELEM * const temp= (DCTELEM*)aligned_temp;
int i, last, run, bits, level, start_i;
- const int esc_length = s->ac_esc_length;
+ const int esc_length= s->ac_esc_length;
uint8_t * length;
uint8_t * last_length;
- assert(h == 8);
+ assert(h==8);
s->dsp.diff_pixels(temp, src1, src2, stride);
- s->block_last_index[0/*FIXME*/] = last = s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
+ s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
- bits = 0;
+ bits=0;
- if(s->mb_intra)
- {
+ if (s->mb_intra) {
start_i = 1;
length = s->intra_ac_vlc_length;
- last_length = s->intra_ac_vlc_last_length;
- bits += s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma
- }
- else
- {
+ last_length= s->intra_ac_vlc_last_length;
+ bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma
+ } else {
start_i = 0;
length = s->inter_ac_vlc_length;
- last_length = s->inter_ac_vlc_last_length;
- }
-
- if(last >= start_i)
- {
- run = 0;
- for(i = start_i; i < last; i++)
- {
- int j = scantable[i];
- level = temp[j];
-
- if(level)
- {
- level += 64;
- if((level&(~127)) == 0)
- {
- bits += length[UNI_AC_ENC_INDEX(run, level)];
- }
- else
- bits += esc_length;
- run = 0;
- }
- else
+ last_length= s->inter_ac_vlc_last_length;
+ }
+
+ if(last>=start_i){
+ run=0;
+ for(i=start_i; i<last; i++){
+ int j= scantable[i];
+ level= temp[j];
+
+ if(level){
+ level+=64;
+ if((level&(~127)) == 0){
+ bits+= length[UNI_AC_ENC_INDEX(run, level)];
+ }else
+ bits+= esc_length;
+ run=0;
+ }else
run++;
}
- i = scantable[last];
+ i= scantable[last];
- level = temp[i] + 64;
+ level= temp[i] + 64;
assert(level - 64);
- if((level&(~127)) == 0)
- {
- bits += last_length[UNI_AC_ENC_INDEX(run, level)];
- }
- else
- bits += esc_length;
+ if((level&(~127)) == 0){
+ bits+= last_length[UNI_AC_ENC_INDEX(run, level)];
+ }else
+ bits+= esc_length;
}
return bits;
@@ -4209,19 +3938,16 @@ static int vsad_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t
VSAD_INTRA(8)
VSAD_INTRA(16)
-static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h)
-{
- int score = 0;
- int x, y;
+static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){
+ int score=0;
+ int x,y;
- for(y = 1; y < h; y++)
- {
- for(x = 0; x < 16; x++)
- {
- score += FFABS(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]);
+ for(y=1; y<h; y++){
+ for(x=0; x<16; x++){
+ score+= FFABS(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]);
}
- s1 += stride;
- s2 += stride;
+ s1+= stride;
+ s2+= stride;
}
return score;
@@ -4246,31 +3972,27 @@ static int vsse_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t
VSSE_INTRA(8)
VSSE_INTRA(16)
-static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h)
-{
- int score = 0;
- int x, y;
+static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){
+ int score=0;
+ int x,y;
- for(y = 1; y < h; y++)
- {
- for(x = 0; x < 16; x++)
- {
- score += SQ(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]);
+ for(y=1; y<h; y++){
+ for(x=0; x<16; x++){
+ score+= SQ(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]);
}
- s1 += stride;
- s2 += stride;
+ s1+= stride;
+ s2+= stride;
}
return score;
}
static int ssd_int8_vs_int16_c(const int8_t *pix1, const int16_t *pix2,
- int size)
-{
- int score = 0;
+ int size){
+ int score=0;
int i;
- for(i = 0; i < size; i++)
- score += (pix1[i] - pix2[i]) * (pix1[i] - pix2[i]);
+ for(i=0; i<size; i++)
+ score += (pix1[i]-pix2[i])*(pix1[i]-pix2[i]);
return score;
}
@@ -4285,42 +4007,37 @@ 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 *src, int len)
-{
+static void vector_fmul_c(float *dst, const float *src, int len){
int i;
- for(i = 0; i < len; i++)
+ for(i=0; i<len; i++)
dst[i] *= src[i];
}
-static void vector_fmul_reverse_c(float *dst, const float *src0, const float *src1, int len)
-{
+static void vector_fmul_reverse_c(float *dst, const float *src0, const float *src1, int len){
int i;
- src1 += len - 1;
- for(i = 0; i < len; i++)
+ src1 += len-1;
+ for(i=0; i<len; i++)
dst[i] = src0[i] * src1[-i];
}
-static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, const float *src2, int len)
-{
+static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, const float *src2, int len){
int i;
- for(i = 0; i < len; i++)
+ for(i=0; i<len; i++)
dst[i] = src0[i] * src1[i] + src2[i];
}
-void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len)
-{
- int i, j;
+void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){
+ int i,j;
dst += len;
win += len;
- src0 += len;
- for(i = -len, j = len - 1; i < 0; i++, j--)
- {
+ src0+= len;
+ for(i=-len, j=len-1; i<0; i++, j--) {
float s0 = src0[i];
float s1 = src1[j];
float wi = win[i];
float wj = win[j];
- dst[i] = s0 * wj - s1 * wi + add_bias;
- dst[j] = s0 * wi + s1 * wj + add_bias;
+ dst[i] = s0*wj - s1*wi + add_bias;
+ dst[j] = s0*wi + s1*wj + add_bias;
}
}
@@ -4329,7 +4046,7 @@ static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
int len)
{
int i;
- for(i = 0; i < len; i++)
+ for (i = 0; i < len; i++)
dst[i] = src[i] * mul;
}
@@ -4337,8 +4054,7 @@ static void vector_fmul_sv_scalar_2_c(float *dst, const float *src,
const float **sv, float mul, int len)
{
int i;
- for(i = 0; i < len; i += 2, sv++)
- {
+ for (i = 0; i < len; i += 2, sv++) {
dst[i ] = src[i ] * sv[0][0] * mul;
dst[i+1] = src[i+1] * sv[0][1] * mul;
}
@@ -4348,8 +4064,7 @@ static void vector_fmul_sv_scalar_4_c(float *dst, const float *src,
const float **sv, float mul, int len)
{
int i;
- for(i = 0; i < len; i += 4, sv++)
- {
+ for (i = 0; i < len; i += 4, sv++) {
dst[i ] = src[i ] * sv[0][0] * mul;
dst[i+1] = src[i+1] * sv[0][1] * mul;
dst[i+2] = src[i+2] * sv[0][2] * mul;
@@ -4361,8 +4076,7 @@ static void sv_fmul_scalar_2_c(float *dst, const float **sv, float mul,
int len)
{
int i;
- for(i = 0; i < len; i += 2, sv++)
- {
+ for (i = 0; i < len; i += 2, sv++) {
dst[i ] = sv[0][0] * mul;
dst[i+1] = sv[0][1] * mul;
}
@@ -4372,8 +4086,7 @@ static void sv_fmul_scalar_4_c(float *dst, const float **sv, float mul,
int len)
{
int i;
- for(i = 0; i < len; i += 4, sv++)
- {
+ for (i = 0; i < len; i += 4, sv++) {
dst[i ] = sv[0][0] * mul;
dst[i+1] = sv[0][1] * mul;
dst[i+2] = sv[0][2] * mul;
@@ -4386,8 +4099,7 @@ static void butterflies_float_c(float *restrict v1, float *restrict v2,
int len)
{
int i;
- for(i = 0; i < len; i++)
- {
+ for (i = 0; i < len; i++) {
float t = v1[i] - v2[i];
v1[i] += v2[i];
v2[i] = t;
@@ -4399,25 +4111,22 @@ static float scalarproduct_float_c(const float *v1, const float *v2, int len)
float p = 0.0;
int i;
- for(i = 0; i < len; i++)
+ for (i = 0; i < len; i++)
p += v1[i] * v2[i];
return p;
}
-static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len)
-{
+static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){
int i;
- for(i = 0; i < len; i++)
+ for(i=0; i<len; i++)
dst[i] = src[i] * mul;
}
-static av_always_inline int float_to_int16_one(const float *src)
-{
+static av_always_inline int float_to_int16_one(const float *src){
int_fast32_t tmp = *(const int32_t*)src;
- if(tmp & 0xf0000)
- {
- tmp = (0x43c0ffff - tmp) >> 31;
+ if(tmp & 0xf0000){
+ tmp = (0x43c0ffff - tmp)>>31;
// is this faster on some gcc/cpu combinations?
// if(tmp > 0x43c0ffff) tmp = 0xFFFF;
// else tmp = 0;
@@ -4425,29 +4134,23 @@ static av_always_inline int float_to_int16_one(const float *src)
return tmp - 0x8000;
}
-void ff_float_to_int16_c(int16_t *dst, const float *src, long len)
-{
+void ff_float_to_int16_c(int16_t *dst, const float *src, long len){
int i;
- for(i = 0; i < len; i++)
- dst[i] = float_to_int16_one(src + i);
+ for(i=0; i<len; i++)
+ dst[i] = float_to_int16_one(src+i);
}
-void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels)
-{
- int i, j, c;
- if(channels == 2)
- {
- for(i = 0; i < len; i++)
- {
- dst[2*i] = float_to_int16_one(src[0] + i);
- dst[2*i+1] = float_to_int16_one(src[1] + i);
+void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels){
+ int i,j,c;
+ if(channels==2){
+ for(i=0; i<len; i++){
+ dst[2*i] = float_to_int16_one(src[0]+i);
+ dst[2*i+1] = float_to_int16_one(src[1]+i);
}
- }
- else
- {
- for(c = 0; c < channels; c++)
- for(i = 0, j = c; i < len; i++, j += channels)
- dst[j] = float_to_int16_one(src[c] + i);
+ }else{
+ for(c=0; c<channels; c++)
+ for(i=0, j=c; i<len; i++, j+=channels)
+ dst[j] = float_to_int16_one(src[c]+i);
}
}
@@ -4462,68 +4165,65 @@ void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, i
static void wmv2_idct_row(short * b)
{
- int s1, s2;
- int a0, a1, a2, a3, a4, a5, a6, a7;
+ int s1,s2;
+ int a0,a1,a2,a3,a4,a5,a6,a7;
/*step 1*/
- a1 = W1 * b[1] + W7 * b[7];
- a7 = W7 * b[1] - W1 * b[7];
- a5 = W5 * b[5] + W3 * b[3];
- a3 = W3 * b[5] - W5 * b[3];
- a2 = W2 * b[2] + W6 * b[6];
- a6 = W6 * b[2] - W2 * b[6];
- a0 = W0 * b[0] + W0 * b[4];
- a4 = W0 * b[0] - W0 * b[4];
+ a1 = W1*b[1]+W7*b[7];
+ a7 = W7*b[1]-W1*b[7];
+ a5 = W5*b[5]+W3*b[3];
+ a3 = W3*b[5]-W5*b[3];
+ a2 = W2*b[2]+W6*b[6];
+ a6 = W6*b[2]-W2*b[6];
+ a0 = W0*b[0]+W0*b[4];
+ a4 = W0*b[0]-W0*b[4];
/*step 2*/
- s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; //1,3,5,7,
- s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;
+ s1 = (181*(a1-a5+a7-a3)+128)>>8;//1,3,5,7,
+ s2 = (181*(a1-a5-a7+a3)+128)>>8;
/*step 3*/
- b[0] = (a0 + a2 + a1 + a5 + (1 << 7))>>8;
- b[1] = (a4 + a6 + s1 + (1 << 7))>>8;
- b[2] = (a4 - a6 + s2 + (1 << 7))>>8;
- b[3] = (a0 - a2 + a7 + a3 + (1 << 7))>>8;
- b[4] = (a0 - a2 - a7 - a3 + (1 << 7))>>8;
- b[5] = (a4 - a6 - s2 + (1 << 7))>>8;
- b[6] = (a4 + a6 - s1 + (1 << 7))>>8;
- b[7] = (a0 + a2 - a1 - a5 + (1 << 7))>>8;
+ b[0] = (a0+a2+a1+a5 + (1<<7))>>8;
+ b[1] = (a4+a6 +s1 + (1<<7))>>8;
+ b[2] = (a4-a6 +s2 + (1<<7))>>8;
+ b[3] = (a0-a2+a7+a3 + (1<<7))>>8;
+ b[4] = (a0-a2-a7-a3 + (1<<7))>>8;
+ b[5] = (a4-a6 -s2 + (1<<7))>>8;
+ b[6] = (a4+a6 -s1 + (1<<7))>>8;
+ b[7] = (a0+a2-a1-a5 + (1<<7))>>8;
}
static void wmv2_idct_col(short * b)
{
- int s1, s2;
- int a0, a1, a2, a3, a4, a5, a6, a7;
+ int s1,s2;
+ int a0,a1,a2,a3,a4,a5,a6,a7;
/*step 1, with extended precision*/
- a1 = (W1 * b[8*1] + W7 * b[8*7] + 4) >> 3;
- a7 = (W7 * b[8*1] - W1 * b[8*7] + 4) >> 3;
- a5 = (W5 * b[8*5] + W3 * b[8*3] + 4) >> 3;
- a3 = (W3 * b[8*5] - W5 * b[8*3] + 4) >> 3;
- a2 = (W2 * b[8*2] + W6 * b[8*6] + 4) >> 3;
- a6 = (W6 * b[8*2] - W2 * b[8*6] + 4) >> 3;
- a0 = (W0 * b[8*0] + W0 * b[8*4]) >> 3;
- a4 = (W0 * b[8*0] - W0 * b[8*4]) >> 3;
+ a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3;
+ a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3;
+ a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3;
+ a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3;
+ a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3;
+ a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3;
+ a0 = (W0*b[8*0]+W0*b[8*4] )>>3;
+ a4 = (W0*b[8*0]-W0*b[8*4] )>>3;
/*step 2*/
- s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8;
- s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;
+ s1 = (181*(a1-a5+a7-a3)+128)>>8;
+ s2 = (181*(a1-a5-a7+a3)+128)>>8;
/*step 3*/
- b[8*0] = (a0 + a2 + a1 + a5 + (1 << 13))>>14;
- b[8*1] = (a4 + a6 + s1 + (1 << 13))>>14;
- b[8*2] = (a4 - a6 + s2 + (1 << 13))>>14;
- b[8*3] = (a0 - a2 + a7 + a3 + (1 << 13))>>14;
+ b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14;
+ b[8*1] = (a4+a6 +s1 + (1<<13))>>14;
+ b[8*2] = (a4-a6 +s2 + (1<<13))>>14;
+ b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14;
- b[8*4] = (a0 - a2 - a7 - a3 + (1 << 13))>>14;
- b[8*5] = (a4 - a6 - s2 + (1 << 13))>>14;
- b[8*6] = (a4 + a6 - s1 + (1 << 13))>>14;
- b[8*7] = (a0 + a2 - a1 - a5 + (1 << 13))>>14;
+ b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14;
+ b[8*5] = (a4-a6 -s2 + (1<<13))>>14;
+ b[8*6] = (a4+a6 -s1 + (1<<13))>>14;
+ b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14;
}
-void ff_wmv2_idct_c(short * block)
-{
+void ff_wmv2_idct_c(short * block){
int i;
- for(i = 0; i < 64; i += 8)
- {
- wmv2_idct_row(block + i);
+ for(i=0;i<64;i+=8){
+ wmv2_idct_row(block+i);
}
- for(i = 0; i < 8; i++)
- {
- wmv2_idct_col(block + i);
+ for(i=0;i<8;i++){
+ wmv2_idct_col(block+i);
}
}
/* XXX: those functions should be suppressed ASAP when all IDCTs are
@@ -4540,34 +4240,34 @@ static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)
}
static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
- j_rev_dct(block);
+ 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);
+ j_rev_dct (block);
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);
+ 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);
+ 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);
+ 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);
+ j_rev_dct2 (block);
add_pixels_clamped2_c(block, dest, line_size);
}
@@ -4575,57 +4275,49 @@ static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block)
{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- dest[0] = cm[(block[0] + 4) >> 3];
+ dest[0] = cm[(block[0] + 4)>>3];
}
static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block)
{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- dest[0] = cm[dest[0] + ((block[0] + 4) >> 3)];
+ dest[0] = cm[dest[0] + ((block[0] + 4)>>3)];
}
-static void just_return(void *mem av_unused, int stride av_unused, int h av_unused)
-{
- return;
-}
+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)
{
int i;
- for(i = 0; i < 256; i++) ff_cropTbl[i + MAX_NEG_CROP] = i;
- for(i = 0; i < MAX_NEG_CROP; i++)
- {
+ for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i;
+ for(i=0;i<MAX_NEG_CROP;i++) {
ff_cropTbl[i] = 0;
ff_cropTbl[i + MAX_NEG_CROP + 256] = 255;
}
- for(i = 0; i < 512; i++)
- {
+ for(i=0;i<512;i++) {
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++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
}
-int ff_check_alignment(void)
-{
- static int did_fail = 0;
+int ff_check_alignment(void){
+ static int did_fail=0;
DECLARE_ALIGNED_16(int, aligned);
- if((intptr_t)&aligned & 15)
- {
- if(!did_fail)
- {
+ if((intptr_t)&aligned & 15){
+ if(!did_fail){
#if HAVE_MMX
av_log(NULL, AV_LOG_ERROR,
- "Compiler did not align stack variables. Libavcodec has been miscompiled\n"
- "and may be very slow or crash. This is not a bug in libavcodec,\n"
- "but in the compiler. You may try recompiling using gcc >= 4.2.\n"
- "Do not report crashes to FFmpeg developers.\n");
+ "Compiler did not align stack variables. Libavcodec has been miscompiled\n"
+ "and may be very slow or crash. This is not a bug in libavcodec,\n"
+ "but in the compiler. You may try recompiling using gcc >= 4.2.\n"
+ "Do not report crashes to FFmpeg developers.\n");
#endif
- did_fail = 1;
+ did_fail=1;
}
return -1;
}
@@ -4639,102 +4331,79 @@ av_cold void attribute_align_arg dsputil_init(DSPContext* c, AVCodecContext *avc
ff_check_alignment();
#if CONFIG_ENCODERS
- if(avctx->dct_algo == FF_DCT_FASTINT)
- {
+ if(avctx->dct_algo==FF_DCT_FASTINT) {
c->fdct = fdct_ifast;
c->fdct248 = fdct_ifast248;
}
- else if(avctx->dct_algo == FF_DCT_FAAN)
- {
+ else if(avctx->dct_algo==FF_DCT_FAAN) {
c->fdct = ff_faandct;
c->fdct248 = ff_faandct248;
}
- else
- {
+ else {
c->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
c->fdct248 = ff_fdct248_islow;
}
#endif //CONFIG_ENCODERS
- if(avctx->lowres == 1)
- {
- if(avctx->idct_algo == FF_IDCT_INT || avctx->idct_algo == FF_IDCT_AUTO || !CONFIG_H264_DECODER)
- {
- c->idct_put = ff_jref_idct4_put;
- c->idct_add = ff_jref_idct4_add;
- }
- else
- {
- c->idct_put = ff_h264_lowres_idct_put_c;
- c->idct_add = ff_h264_lowres_idct_add_c;
+ if(avctx->lowres==1){
+ if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){
+ c->idct_put= ff_jref_idct4_put;
+ c->idct_add= ff_jref_idct4_add;
+ }else{
+ c->idct_put= ff_h264_lowres_idct_put_c;
+ c->idct_add= ff_h264_lowres_idct_add_c;
}
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_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_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->idct_algo == FF_IDCT_INT)
- {
- c->idct_put = ff_jref_idct_put;
- c->idct_add = ff_jref_idct_add;
+ 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_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_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;
+ 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;
c->idct = ff_wmv2_idct_c;
- c->idct_permutation_type = FF_NO_IDCT_PERM;
- }
- else if(avctx->idct_algo == FF_IDCT_FAAN)
- {
- c->idct_put = ff_faanidct_put;
- c->idct_add = ff_faanidct_add;
+ c->idct_permutation_type= FF_NO_IDCT_PERM;
+ }else if(avctx->idct_algo==FF_IDCT_FAAN){
+ c->idct_put= ff_faanidct_put;
+ c->idct_add= ff_faanidct_add;
c->idct = ff_faanidct;
- c->idct_permutation_type = FF_NO_IDCT_PERM;
- }
- else //accurate/default
- {
- c->idct_put = ff_simple_idct_put;
- c->idct_add = ff_simple_idct_add;
+ c->idct_permutation_type= FF_NO_IDCT_PERM;
+ }else{ //accurate/default
+ c->idct_put= ff_simple_idct_put;
+ c->idct_add= ff_simple_idct_add;
c->idct = ff_simple_idct;
- c->idct_permutation_type = FF_NO_IDCT_PERM;
+ c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
- if(CONFIG_H264_DECODER)
- {
- c->h264_idct_add = ff_h264_idct_add_c;
- c->h264_idct8_add = ff_h264_idct8_add_c;
- c->h264_idct_dc_add = ff_h264_idct_dc_add_c;
- c->h264_idct8_dc_add = ff_h264_idct8_dc_add_c;
+ if (CONFIG_H264_DECODER) {
+ c->h264_idct_add= ff_h264_idct_add_c;
+ c->h264_idct8_add= ff_h264_idct8_add_c;
+ c->h264_idct_dc_add= ff_h264_idct_dc_add_c;
+ c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
c->h264_idct_add16 = ff_h264_idct_add16_c;
c->h264_idct8_add4 = ff_h264_idct8_add4_c;
c->h264_idct_add8 = ff_h264_idct_add8_c;
- c->h264_idct_add16intra = ff_h264_idct_add16intra_c;
+ c->h264_idct_add16intra= ff_h264_idct_add16intra_c;
}
c->get_pixels = get_pixels_c;
@@ -4783,8 +4452,8 @@ av_cold void attribute_align_arg dsputil_init(DSPContext* c, AVCodecContext *avc
dspfunc(avg, 3, 2);
#undef dspfunc
- c->put_no_rnd_pixels_l2[0] = put_no_rnd_pixels16_l2_c;
- c->put_no_rnd_pixels_l2[1] = put_no_rnd_pixels8_l2_c;
+ c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
+ c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
@@ -4845,150 +4514,147 @@ av_cold void attribute_align_arg dsputil_init(DSPContext* c, AVCodecContext *avc
dspfunc(avg_h264_qpel, 2, 4);
#undef dspfunc
- c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_c;
- c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_c;
- c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_c;
- c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_c;
- c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_c;
- c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_c;
- c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_c;
- c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_c;
-
- c->weight_h264_pixels_tab[0] = weight_h264_pixels16x16_c;
- c->weight_h264_pixels_tab[1] = weight_h264_pixels16x8_c;
- c->weight_h264_pixels_tab[2] = weight_h264_pixels8x16_c;
- c->weight_h264_pixels_tab[3] = weight_h264_pixels8x8_c;
- c->weight_h264_pixels_tab[4] = weight_h264_pixels8x4_c;
- c->weight_h264_pixels_tab[5] = weight_h264_pixels4x8_c;
- c->weight_h264_pixels_tab[6] = weight_h264_pixels4x4_c;
- c->weight_h264_pixels_tab[7] = weight_h264_pixels4x2_c;
- c->weight_h264_pixels_tab[8] = weight_h264_pixels2x4_c;
- c->weight_h264_pixels_tab[9] = weight_h264_pixels2x2_c;
- c->biweight_h264_pixels_tab[0] = biweight_h264_pixels16x16_c;
- c->biweight_h264_pixels_tab[1] = biweight_h264_pixels16x8_c;
- c->biweight_h264_pixels_tab[2] = biweight_h264_pixels8x16_c;
- c->biweight_h264_pixels_tab[3] = biweight_h264_pixels8x8_c;
- c->biweight_h264_pixels_tab[4] = biweight_h264_pixels8x4_c;
- c->biweight_h264_pixels_tab[5] = biweight_h264_pixels4x8_c;
- c->biweight_h264_pixels_tab[6] = biweight_h264_pixels4x4_c;
- c->biweight_h264_pixels_tab[7] = biweight_h264_pixels4x2_c;
- c->biweight_h264_pixels_tab[8] = biweight_h264_pixels2x4_c;
- c->biweight_h264_pixels_tab[9] = biweight_h264_pixels2x2_c;
+ c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
+ c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
+ c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
+ c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
+ c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
+ c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
+ c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
+ c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
+
+ c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
+ c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
+ c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
+ c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
+ c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
+ c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
+ c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
+ c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
+ c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
+ c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
+ c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
+ c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
+ c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
+ c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
+ c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
+ c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
+ c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
+ c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
+ c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
+ c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
c->draw_edges = draw_edges_c;
#if CONFIG_CAVS_DECODER
- ff_cavsdsp_init(c, avctx);
+ ff_cavsdsp_init(c,avctx);
#endif
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
ff_mlp_init(c, avctx);
#endif
#if CONFIG_VC1_DECODER
- ff_vc1dsp_init(c, avctx);
+ ff_vc1dsp_init(c,avctx);
#endif
#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER
- ff_intrax8dsp_init(c, avctx);
+ ff_intrax8dsp_init(c,avctx);
#endif
#if CONFIG_RV30_DECODER
- ff_rv30dsp_init(c, avctx);
+ ff_rv30dsp_init(c,avctx);
#endif
#if CONFIG_RV40_DECODER
- ff_rv40dsp_init(c, avctx);
+ ff_rv40dsp_init(c,avctx);
c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;
c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;
c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;
c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;
#endif
- c->put_mspel_pixels_tab[0] = put_mspel8_mc00_c;
- c->put_mspel_pixels_tab[1] = put_mspel8_mc10_c;
- c->put_mspel_pixels_tab[2] = put_mspel8_mc20_c;
- c->put_mspel_pixels_tab[3] = put_mspel8_mc30_c;
- c->put_mspel_pixels_tab[4] = put_mspel8_mc02_c;
- c->put_mspel_pixels_tab[5] = put_mspel8_mc12_c;
- c->put_mspel_pixels_tab[6] = put_mspel8_mc22_c;
- c->put_mspel_pixels_tab[7] = put_mspel8_mc32_c;
+ c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
+ c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
+ c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
+ c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
+ c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
+ c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
+ c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
+ c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
#define SET_CMP_FUNC(name) \
c->name[0]= name ## 16_c;\
c->name[1]= name ## 8x8_c;
SET_CMP_FUNC(hadamard8_diff)
- c->hadamard8_diff[4] = hadamard8_intra16_c;
- c->hadamard8_diff[5] = hadamard8_intra8x8_c;
+ c->hadamard8_diff[4]= hadamard8_intra16_c;
+ c->hadamard8_diff[5]= hadamard8_intra8x8_c;
SET_CMP_FUNC(dct_sad)
SET_CMP_FUNC(dct_max)
#if CONFIG_GPL
SET_CMP_FUNC(dct264_sad)
#endif
- c->sad[0] = pix_abs16_c;
- c->sad[1] = pix_abs8_c;
- c->sse[0] = sse16_c;
- c->sse[1] = sse8_c;
- c->sse[2] = sse4_c;
+ c->sad[0]= pix_abs16_c;
+ c->sad[1]= pix_abs8_c;
+ c->sse[0]= sse16_c;
+ c->sse[1]= sse8_c;
+ c->sse[2]= sse4_c;
SET_CMP_FUNC(quant_psnr)
SET_CMP_FUNC(rd)
SET_CMP_FUNC(bit)
- c->vsad[0] = vsad16_c;
- c->vsad[4] = vsad_intra16_c;
- c->vsad[5] = vsad_intra8_c;
- c->vsse[0] = vsse16_c;
- c->vsse[4] = vsse_intra16_c;
- c->vsse[5] = vsse_intra8_c;
- c->nsse[0] = nsse16_c;
- c->nsse[1] = nsse8_c;
+ c->vsad[0]= vsad16_c;
+ c->vsad[4]= vsad_intra16_c;
+ c->vsad[5]= vsad_intra8_c;
+ c->vsse[0]= vsse16_c;
+ c->vsse[4]= vsse_intra16_c;
+ c->vsse[5]= vsse_intra8_c;
+ c->nsse[0]= nsse16_c;
+ c->nsse[1]= nsse8_c;
#if CONFIG_SNOW_ENCODER
- 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;
#endif
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;
+ 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;
c->add_hfyu_left_prediction = add_hfyu_left_prediction_c;
c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c;
- c->bswap_buf = bswap_buf;
+ c->bswap_buf= bswap_buf;
#if CONFIG_PNG_DECODER
- c->add_png_paeth_prediction = ff_add_png_paeth_prediction;
+ c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
#endif
- c->h264_v_loop_filter_luma = h264_v_loop_filter_luma_c;
- c->h264_h_loop_filter_luma = h264_h_loop_filter_luma_c;
- c->h264_v_loop_filter_luma_intra = h264_v_loop_filter_luma_intra_c;
- c->h264_h_loop_filter_luma_intra = h264_h_loop_filter_luma_intra_c;
- c->h264_v_loop_filter_chroma = h264_v_loop_filter_chroma_c;
- c->h264_h_loop_filter_chroma = h264_h_loop_filter_chroma_c;
- c->h264_v_loop_filter_chroma_intra = h264_v_loop_filter_chroma_intra_c;
- c->h264_h_loop_filter_chroma_intra = h264_h_loop_filter_chroma_intra_c;
- c->h264_loop_filter_strength = NULL;
-
- 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;
+ c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
+ c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
+ c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;
+ c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;
+ c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
+ c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
+ c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
+ c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
+ c->h264_loop_filter_strength= NULL;
+
+ 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;
+ 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;
}
- if(CONFIG_VP6_DECODER)
- {
- c->vp6_filter_diag4 = ff_vp6_filter_diag4_c;
+ if (CONFIG_VP6_DECODER) {
+ c->vp6_filter_diag4= ff_vp6_filter_diag4_c;
}
- c->h261_loop_filter = h261_loop_filter_c;
+ c->h261_loop_filter= h261_loop_filter_c;
- c->try_8x8basis = try_8x8basis_c;
- c->add_8x8basis = add_8x8basis_c;
+ c->try_8x8basis= try_8x8basis_c;
+ c->add_8x8basis= add_8x8basis_c;
#if CONFIG_VORBIS_DECODER
c->vorbis_inverse_coupling = vorbis_inverse_coupling;
@@ -5017,53 +4683,51 @@ av_cold void attribute_align_arg dsputil_init(DSPContext* c, AVCodecContext *avc
c->sv_fmul_scalar[1] = sv_fmul_scalar_4_c;
#endif
- c->shrink[0] = ff_img_copy_plane;
- c->shrink[1] = ff_shrink22;
- c->shrink[2] = ff_shrink44;
- c->shrink[3] = ff_shrink88;
+ c->shrink[0]= ff_img_copy_plane;
+ c->shrink[1]= ff_shrink22;
+ c->shrink[2]= ff_shrink44;
+ c->shrink[3]= ff_shrink88;
- c->prefetch = just_return;
+ 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));
-#if HAVE_MMX
+ #if HAVE_MMX
dsputil_init_mmx(c, avctx);
-#endif
+ #endif
- for(i = 0; i < 64; i++)
- {
+ for(i=0; i<64; i++){
if(!c->put_2tap_qpel_pixels_tab[0][i])
- c->put_2tap_qpel_pixels_tab[0][i] = c->put_h264_qpel_pixels_tab[0][i];
+ c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
if(!c->avg_2tap_qpel_pixels_tab[0][i])
- c->avg_2tap_qpel_pixels_tab[0][i] = c->avg_h264_qpel_pixels_tab[0][i];
+ c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
}
- switch(c->idct_permutation_type)
- {
+ switch(c->idct_permutation_type){
case FF_NO_IDCT_PERM:
- for(i = 0; i < 64; i++)
- c->idct_permutation[i] = i;
+ for(i=0; i<64; i++)
+ c->idct_permutation[i]= i;
break;
case FF_LIBMPEG2_IDCT_PERM:
- for(i = 0; i < 64; i++)
- c->idct_permutation[i] = (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
+ for(i=0; i<64; i++)
+ c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
break;
case FF_SIMPLE_IDCT_PERM:
- for(i = 0; i < 64; i++)
- c->idct_permutation[i] = simple_mmx_permutation[i];
+ for(i=0; i<64; i++)
+ c->idct_permutation[i]= simple_mmx_permutation[i];
break;
case FF_TRANSPOSE_IDCT_PERM:
- for(i = 0; i < 64; i++)
- c->idct_permutation[i] = ((i & 7) << 3) | (i >> 3);
+ for(i=0; i<64; i++)
+ c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break;
case FF_PARTTRANS_IDCT_PERM:
- for(i = 0; i < 64; i++)
- c->idct_permutation[i] = (i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3);
+ for(i=0; i<64; i++)
+ c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
break;
case FF_SSE2_IDCT_PERM:
- for(i = 0; i < 64; i++)
- c->idct_permutation[i] = (i & 0x38) | idct_sse2_row_perm[i&7];
+ for(i=0; i<64; i++)
+ c->idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7];
break;
default:
av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
@@ -5077,31 +4741,31 @@ const char* avcodec_get_current_idct(AVCodecContext *avctx)
MpegEncContext *s = avctx->priv_data;
DSPContext *c = &s->dsp;
- if(c->idct_put == ff_jref_idct_put)
+ if (c->idct_put==ff_jref_idct_put)
return "Integer (ff_jref_idct)";
- if(c->idct_put == ff_jref_idct1_put)
+ if (c->idct_put==ff_jref_idct1_put)
return "Integer (ff_jref_idct1)";
- if(c->idct_put == ff_jref_idct1_put)
+ if (c->idct_put==ff_jref_idct1_put)
return "Integer (ff_jref_idct2)";
- if(c->idct_put == ff_jref_idct4_put)
+ if (c->idct_put==ff_jref_idct4_put)
return "Integer (ff_jref_idct4)";
- if(c->idct_put == ff_h264_lowres_idct_put_c)
+ if (c->idct_put==ff_h264_lowres_idct_put_c)
return "H.264 (ff_h264_lowres_idct_c)";
- if(c->idct_put == ff_vp3_idct_put_c)
+ if (c->idct_put==ff_vp3_idct_put_c)
return "VP3 (ff_vp3_idct_c)";
- if(c->idct_put == ff_faanidct_put)
+ if (c->idct_put==ff_faanidct_put)
return "FAAN (ff_faanidct_put)";
- if(c->idct_put == ff_simple_idct_put)
+ if (c->idct_put==ff_simple_idct_put)
return "Simple IDCT (simple_idct)";
#if HAVE_MMX
- return avcodec_get_current_idct_mmx(avctx, c);
+ return avcodec_get_current_idct_mmx(avctx,c);
#else
- return "";
+ return "";
#endif
}
// It's caller's responsibility to check avctx->priv_data is MpegEncContext*.
-void avcodec_get_encoder_info(AVCodecContext *avctx, int *xvid_build, int *divx_version, int *divx_build, int *lavc_build)
+void avcodec_get_encoder_info(AVCodecContext *avctx,int *xvid_build,int *divx_version,int *divx_build,int *lavc_build)
{
MpegEncContext *s = avctx->priv_data;
*xvid_build = s->xvid_build;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.h
index bf8947138..3786102dd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.h
@@ -40,15 +40,15 @@ typedef short DCTELEM;
typedef int DWTELEM;
typedef short IDWTELEM;
-void fdct_ifast(DCTELEM *data);
-void fdct_ifast248(DCTELEM *data);
-void ff_jpeg_fdct_islow(DCTELEM *data);
-void ff_fdct248_islow(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 fdct_ifast (DCTELEM *data);
+void fdct_ifast248 (DCTELEM *data);
+void ff_jpeg_fdct_islow (DCTELEM *data);
+void ff_fdct248_islow (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_wmv2_idct_c(DCTELEM *data);
void ff_fdct_mmx(DCTELEM *block);
@@ -172,8 +172,7 @@ typedef struct slice_buffer_s slice_buffer;
/**
* Scantable.
*/
-typedef struct ScanTable
-{
+typedef struct ScanTable{
const uint8_t *scantable;
uint8_t permutated[64];
uint8_t raster_end[64];
@@ -188,8 +187,7 @@ void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize,
/**
* DSPContext.
*/
-typedef struct DSPContext
-{
+typedef struct DSPContext {
/* pixel ops : interface with DCT */
void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
@@ -206,8 +204,8 @@ typedef struct DSPContext
/**
* global motion compensation.
*/
- void (*gmc)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
+ void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
+ int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
void (*clear_block)(DCTELEM *block/*align 16*/);
void (*clear_blocks)(DCTELEM *blocks/*align 16*/);
int (*pix_sum)(uint8_t * pix, int line_size);
@@ -340,14 +338,14 @@ 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);
+ 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
* note, this might read from src1[-1], src2[-1]
*/
void (*sub_hfyu_median_prediction)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top);
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);
+ 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);
@@ -378,11 +376,11 @@ typedef struct DSPContext
void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride,
- const int16_t *h_weights, const int16_t *v_weights);
+ const int16_t *h_weights,const int16_t *v_weights);
/* 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);
+ 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 *src, int len);
void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
@@ -434,7 +432,7 @@ typedef struct DSPContext
* @param v2 second vector, 16-byte aligned
* @param len length of vectors, multiple of 4
*/
- float(*scalarproduct_float)(const float *v1, const float *v2, int len);
+ float (*scalarproduct_float)(const float *v1, const float *v2, int len);
/**
* Calculate the sum and difference of two vectors of floats.
* @param v1 first input vector, sum output, 16-byte aligned
@@ -548,7 +546,7 @@ typedef struct DSPContext
/* 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);
+ int * range, int * sum, int edges);
/* rv30 functions */
qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
@@ -586,27 +584,25 @@ static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
}
-static inline int get_penalty_factor(int lambda, int lambda2, int type)
-{
- switch(type & 0xFF)
- {
+static inline int get_penalty_factor(int lambda, int lambda2, int type){
+ switch(type&0xFF){
default:
case FF_CMP_SAD:
- return lambda >> FF_LAMBDA_SHIFT;
+ return lambda>>FF_LAMBDA_SHIFT;
case FF_CMP_DCT:
- return (3 * lambda) >> (FF_LAMBDA_SHIFT + 1);
+ return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
case FF_CMP_W53:
- return (4 * lambda) >> (FF_LAMBDA_SHIFT);
+ return (4*lambda)>>(FF_LAMBDA_SHIFT);
case FF_CMP_W97:
- return (2 * lambda) >> (FF_LAMBDA_SHIFT);
+ return (2*lambda)>>(FF_LAMBDA_SHIFT);
case FF_CMP_SATD:
case FF_CMP_DCT264:
- return (2 * lambda) >> FF_LAMBDA_SHIFT;
+ return (2*lambda)>>FF_LAMBDA_SHIFT;
case FF_CMP_RD:
case FF_CMP_PSNR:
case FF_CMP_SSE:
case FF_CMP_NSSE:
- return lambda2 >> FF_LAMBDA_SHIFT;
+ return lambda2>>FF_LAMBDA_SHIFT;
case FF_CMP_BIT:
return 1;
}
@@ -635,11 +631,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
static inline void emms(void)
{
-#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
+ #if defined(__INTEL_COMPILER) || defined(_MSC_VER)
__asm emms;
-#else
- __asm__ volatile("emms;":::"memory");
-#endif
+ #else
+ __asm__ volatile ("emms;":::"memory");
+ #endif
}
@@ -671,13 +667,11 @@ void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
FFTSample type */
typedef float FFTSample;
-typedef struct FFTComplex
-{
+typedef struct FFTComplex {
FFTSample re, im;
} FFTComplex;
-typedef struct FFTContext
-{
+typedef struct FFTContext {
int nbits;
int inverse;
uint16_t *revtab;
@@ -814,11 +808,11 @@ void ff_sine_window_init(float *window, int n);
* initialize the specified entry of ff_sine_windows
*/
void ff_init_ff_sine_windows(int index);
-extern SINETABLE(32);
-extern SINETABLE(64);
-extern SINETABLE(128);
-extern SINETABLE(256);
-extern SINETABLE(512);
+extern SINETABLE( 32);
+extern SINETABLE( 64);
+extern SINETABLE( 128);
+extern SINETABLE( 256);
+extern SINETABLE( 512);
extern SINETABLE(1024);
extern SINETABLE(2048);
extern SINETABLE(4096);
@@ -832,16 +826,14 @@ void ff_mdct_end(FFTContext *s);
/* Real Discrete Fourier Transform */
-enum RDFTransformType
-{
+enum RDFTransformType {
RDFT,
IRDFT,
RIDFT,
IRIDFT,
};
-typedef struct
-{
+typedef struct {
int nbits;
int inverse;
int sign_convention;
@@ -863,8 +855,7 @@ void ff_rdft_end(RDFTContext *s);
/* Discrete Cosine Transform */
-typedef struct
-{
+typedef struct {
int nbits;
int inverse;
FFTSample *data;
@@ -880,7 +871,7 @@ typedef struct
*/
int ff_dct_init(DCTContext *s, int nbits, int inverse);
void ff_dct_calc(DCTContext *s, FFTSample *data);
-void ff_dct_end(DCTContext *s);
+void ff_dct_end (DCTContext *s);
#define WRAPPER8_16(name8, name16)\
static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
@@ -906,79 +897,79 @@ static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st
static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
int i;
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- AV_WN16(dst , AV_RN16(src));
- dst += dstStride;
- src += srcStride;
+ AV_WN16(dst , AV_RN16(src ));
+ dst+=dstStride;
+ src+=srcStride;
}
}
static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
int i;
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src));
- dst += dstStride;
- src += srcStride;
+ AV_WN32(dst , AV_RN32(src ));
+ dst+=dstStride;
+ src+=srcStride;
}
}
static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
int i;
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src));
- AV_WN32(dst + 4 , AV_RN32(src + 4));
- dst += dstStride;
- src += srcStride;
+ AV_WN32(dst , AV_RN32(src ));
+ AV_WN32(dst+4 , AV_RN32(src+4 ));
+ dst+=dstStride;
+ src+=srcStride;
}
}
static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
int i;
- for(i = 0; i < h; i++)
+ for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src));
- AV_WN32(dst + 4 , AV_RN32(src + 4));
- dst[8] = src[8];
- dst += dstStride;
- src += srcStride;
+ AV_WN32(dst , AV_RN32(src ));
+ AV_WN32(dst+4 , AV_RN32(src+4 ));
+ dst[8]= src[8];
+ dst+=dstStride;
+ src+=srcStride;
}
}
static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
int i;
- for(i = 0; i < h; 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));
- dst += dstStride;
- src += srcStride;
+ 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));
+ dst+=dstStride;
+ src+=srcStride;
}
}
static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
int i;
- for(i = 0; i < h; 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));
- dst[16] = src[16];
- dst += dstStride;
- src += srcStride;
+ 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));
+ dst[16]= src[16];
+ dst+=dstStride;
+ src+=srcStride;
}
}
-const char* avcodec_get_current_idct_mmx(AVCodecContext *avctx, DSPContext *c);
+const char* avcodec_get_current_idct_mmx(AVCodecContext *avctx,DSPContext *c);
#endif /* AVCODEC_DSPUTIL_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h
index 14b52cc3a..92468f78d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dxva.h
@@ -41,44 +41,44 @@ extern "C" {
#ifndef __DIRECTX_VA_DECODER__
#define __DIRECTX_VA_DECODER__
- DEFINE_GUID(DXVA_ModeNone, 0x1b81be00, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH261_A, 0x1b81be01, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH261_B, 0x1b81be02, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeNone, 0x1b81be00, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH261_A, 0x1b81be01, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH261_B, 0x1b81be02, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeH263_A, 0x1b81be03, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH263_B, 0x1b81be04, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH263_C, 0x1b81be05, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH263_D, 0x1b81be06, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH263_E, 0x1b81be07, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH263_F, 0x1b81be08, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeH263_A, 0x1b81be03, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH263_B, 0x1b81be04, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH263_C, 0x1b81be05, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH263_D, 0x1b81be06, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH263_E, 0x1b81be07, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH263_F, 0x1b81be08, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeMPEG1_A, 0x1b81be09, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeMPEG1_A, 0x1b81be09, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeMPEG2_A, 0x1b81be0A, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeMPEG2_B, 0x1b81be0B, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeMPEG2_C, 0x1b81be0C, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeMPEG2_D, 0x1b81be0D, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeMPEG2_A, 0x1b81be0A, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeMPEG2_B, 0x1b81be0B, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeMPEG2_C, 0x1b81be0C, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeMPEG2_D, 0x1b81be0D, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeH264_A, 0x1b81be64, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH264_B, 0x1b81be65, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH264_C, 0x1b81be66, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH264_D, 0x1b81be67, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH264_E, 0x1b81be68, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeH264_F, 0x1b81be69, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeH264_A, 0x1b81be64, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH264_B, 0x1b81be65, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH264_C, 0x1b81be66, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH264_D, 0x1b81be67, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeWMV8_A, 0x1b81be80, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeWMV8_B, 0x1b81be81, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeWMV8_A, 0x1b81be80, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeWMV8_B, 0x1b81be81, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeWMV9_A, 0x1b81be90, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeWMV9_B, 0x1b81be91, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeWMV9_C, 0x1b81be94, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeWMV9_A, 0x1b81be90, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeWMV9_B, 0x1b81be91, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeWMV9_C, 0x1b81be94, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_ModeVC1_A, 0x1b81beA0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeVC1_B, 0x1b81beA1, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeVC1_C, 0x1b81beA2, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
- DEFINE_GUID(DXVA_ModeVC1_D, 0x1b81beA3, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_ModeVC1_A, 0x1b81beA0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeVC1_B, 0x1b81beA1, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeVC1_C, 0x1b81beA2, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
- DEFINE_GUID(DXVA_NoEncrypt, 0x1b81beD0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
+DEFINE_GUID(DXVA_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
#define DXVA_ModeWMV8_PostProc DXVA_ModeWMV8_A
#define DXVA_ModeWMV8_MoComp DXVA_ModeWMV8_B
@@ -172,13 +172,13 @@ extern "C" {
#define DXVA_PICTURE_RESAMPLE_BUFFER 14
#define DXVA_READ_BACK_BUFFER 15
- /* H.264/AVC Additional buffer types */
+/* H.264/AVC Additional buffer types */
#define DXVA_MOTION_VECTOR_BUFFER 16
#define DXVA_FILM_GRAIN_BUFFER 17
#define DXVA_NUM_TYPES_COMP_BUFFERS 18
- /* values for bDXVA_Func */
+/* values for bDXVA_Func */
#define DXVA_PICTURE_DECODING_FUNCTION 1
#define DXVA_ALPHA_BLEND_DATA_LOAD_FUNCTION 2
#define DXVA_ALPHA_BLEND_COMBINATION_FUNCTION 3
@@ -187,7 +187,7 @@ extern "C" {
#define DXVA_FILM_GRAIN_SYNTHESIS_FUNCTION 6
#define DXVA_STATUS_REPORTING_FUNCTION 7
- /* values returned from Execute command in absence of read-back */
+/* values returned from Execute command in absence of read-back */
#define DXVA_EXECUTE_RETURN_OK 0
#define DXVA_EXECUTE_RETURN_DATA_ERROR_MINOR 1
#define DXVA_EXECUTE_RETURN_DATA_ERROR_SIGNIF 2
@@ -198,14 +198,13 @@ extern "C" {
#pragma pack(push, BeforeDXVApacking, 1)
- typedef struct _DXVA_ConnectMode
- {
- GUID guidMode;
- WORD wRestrictedMode;
- } DXVA_ConnectMode, *LPDXVA_ConnectMode;
+typedef struct _DXVA_ConnectMode {
+ GUID guidMode;
+ WORD wRestrictedMode;
+} DXVA_ConnectMode, *LPDXVA_ConnectMode;
- typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc;
+typedef DWORD DXVA_ConfigQueryOrReplyFunc, *LPDXVA_ConfigQueryOrReplyFunc;
#define DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY 0xFFFFF1
#define DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY 0xFFFFF5
@@ -229,7 +228,7 @@ extern "C" {
#define setDXVA_QueryOrReplyFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
#define setDXVA_QueryOrReplyFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
- typedef DWORD DXVA_EncryptProtocolFunc, *LPDXVA_EncryptProtocolFunc;
+typedef DWORD DXVA_EncryptProtocolFunc, *LPDXVA_EncryptProtocolFunc;
#define DXVA_ENCRYPTPROTOCOLFUNCFLAG_HOST 0xFFFF00
#define DXVA_ENCRYPTPROTOCOLFUNCFLAG_ACCEL 0xFFFF08
@@ -244,129 +243,125 @@ extern "C" {
#define setDXVA_EncryptProtocolFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8))
#define setDXVA_EncryptProtocolFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc));
- typedef struct _DXVA_EncryptProtocolHeader
- {
- DXVA_EncryptProtocolFunc dwFunction;
- DWORD ReservedBits[3];
- GUID guidEncryptProtocol;
- } DXVA_EncryptProtocolHeader, *LPDXVA_EncryptProtocolHeader;
+typedef struct _DXVA_EncryptProtocolHeader {
+ DXVA_EncryptProtocolFunc dwFunction;
+ DWORD ReservedBits[3];
+ GUID guidEncryptProtocol;
+} DXVA_EncryptProtocolHeader, *LPDXVA_EncryptProtocolHeader;
- typedef struct _DXVA_ConfigPictureDecode
- {
+typedef struct _DXVA_ConfigPictureDecode {
- // Operation Indicated
- DXVA_ConfigQueryOrReplyFunc dwFunction;
+ // Operation Indicated
+ DXVA_ConfigQueryOrReplyFunc dwFunction;
- // Alignment
- DWORD dwReservedBits[3];
+ // Alignment
+ DWORD dwReservedBits[3];
- // Encryption GUIDs
- GUID guidConfigBitstreamEncryption;
- GUID guidConfigMBcontrolEncryption;
- GUID guidConfigResidDiffEncryption;
+ // Encryption GUIDs
+ GUID guidConfigBitstreamEncryption;
+ GUID guidConfigMBcontrolEncryption;
+ GUID guidConfigResidDiffEncryption;
- // Bitstream Processing Indicator
- BYTE bConfigBitstreamRaw;
+ // Bitstream Processing Indicator
+ BYTE bConfigBitstreamRaw;
- // Macroblock Control Config
- BYTE bConfigMBcontrolRasterOrder;
+ // Macroblock Control Config
+ BYTE bConfigMBcontrolRasterOrder;
- // Host Resid Diff Config
- BYTE bConfigResidDiffHost;
- BYTE bConfigSpatialResid8;
- BYTE bConfigResid8Subtraction;
- BYTE bConfigSpatialHost8or9Clipping;
- BYTE bConfigSpatialResidInterleaved;
- BYTE bConfigIntraResidUnsigned;
+ // Host Resid Diff Config
+ BYTE bConfigResidDiffHost;
+ BYTE bConfigSpatialResid8;
+ BYTE bConfigResid8Subtraction;
+ BYTE bConfigSpatialHost8or9Clipping;
+ BYTE bConfigSpatialResidInterleaved;
+ BYTE bConfigIntraResidUnsigned;
- // Accelerator Resid Diff Config
- BYTE bConfigResidDiffAccelerator;
- BYTE bConfigHostInverseScan;
- BYTE bConfigSpecificIDCT;
- BYTE bConfig4GroupedCoefs;
- } DXVA_ConfigPictureDecode, *LPDXVA_ConfigPictureDecode;
+ // Accelerator Resid Diff Config
+ BYTE bConfigResidDiffAccelerator;
+ BYTE bConfigHostInverseScan;
+ BYTE bConfigSpecificIDCT;
+ BYTE bConfig4GroupedCoefs;
+} DXVA_ConfigPictureDecode, *LPDXVA_ConfigPictureDecode;
- /* Picture Decoding Parameters */
+/* Picture Decoding Parameters */
- typedef struct _DXVA_PictureParameters
- {
+typedef struct _DXVA_PictureParameters {
- WORD wDecodedPictureIndex;
- WORD wDeblockedPictureIndex;
+ WORD wDecodedPictureIndex;
+ WORD wDeblockedPictureIndex;
- WORD wForwardRefPictureIndex;
- WORD wBackwardRefPictureIndex;
+ WORD wForwardRefPictureIndex;
+ WORD wBackwardRefPictureIndex;
- WORD wPicWidthInMBminus1;
- WORD wPicHeightInMBminus1;
+ WORD wPicWidthInMBminus1;
+ WORD wPicHeightInMBminus1;
- BYTE bMacroblockWidthMinus1;
- BYTE bMacroblockHeightMinus1;
+ BYTE bMacroblockWidthMinus1;
+ BYTE bMacroblockHeightMinus1;
- BYTE bBlockWidthMinus1;
- BYTE bBlockHeightMinus1;
+ BYTE bBlockWidthMinus1;
+ BYTE bBlockHeightMinus1;
- BYTE bBPPminus1;
+ BYTE bBPPminus1;
- BYTE bPicStructure;
- BYTE bSecondField;
- BYTE bPicIntra;
- BYTE bPicBackwardPrediction;
+ BYTE bPicStructure;
+ BYTE bSecondField;
+ BYTE bPicIntra;
+ BYTE bPicBackwardPrediction;
- BYTE bBidirectionalAveragingMode;
- BYTE bMVprecisionAndChromaRelation;
- BYTE bChromaFormat;
+ BYTE bBidirectionalAveragingMode;
+ BYTE bMVprecisionAndChromaRelation;
+ BYTE bChromaFormat;
- BYTE bPicScanFixed;
- BYTE bPicScanMethod;
- BYTE bPicReadbackRequests;
+ BYTE bPicScanFixed;
+ BYTE bPicScanMethod;
+ BYTE bPicReadbackRequests;
- BYTE bRcontrol;
- BYTE bPicSpatialResid8;
- BYTE bPicOverflowBlocks;
- BYTE bPicExtrapolation;
+ BYTE bRcontrol;
+ BYTE bPicSpatialResid8;
+ BYTE bPicOverflowBlocks;
+ BYTE bPicExtrapolation;
- BYTE bPicDeblocked;
- BYTE bPicDeblockConfined;
- BYTE bPic4MVallowed;
- BYTE bPicOBMC;
- BYTE bPicBinPB;
- BYTE bMV_RPS;
+ BYTE bPicDeblocked;
+ BYTE bPicDeblockConfined;
+ BYTE bPic4MVallowed;
+ BYTE bPicOBMC;
+ BYTE bPicBinPB;
+ BYTE bMV_RPS;
- BYTE bReservedBits;
+ BYTE bReservedBits;
- WORD wBitstreamFcodes;
- WORD wBitstreamPCEelements;
- BYTE bBitstreamConcealmentNeed;
- BYTE bBitstreamConcealmentMethod;
+ WORD wBitstreamFcodes;
+ WORD wBitstreamPCEelements;
+ BYTE bBitstreamConcealmentNeed;
+ BYTE bBitstreamConcealmentMethod;
- } DXVA_PictureParameters, *LPDXVA_PictureParameters;
+} DXVA_PictureParameters, *LPDXVA_PictureParameters;
- /* Picture Resampling */
+/* Picture Resampling */
- typedef struct _DXVA_PicResample
- {
+typedef struct _DXVA_PicResample {
- WORD wPicResampleSourcePicIndex;
- WORD wPicResampleDestPicIndex;
+ WORD wPicResampleSourcePicIndex;
+ WORD wPicResampleDestPicIndex;
- WORD wPicResampleRcontrol;
- BYTE bPicResampleExtrapWidth;
- BYTE bPicResampleExtrapHeight;
+ WORD wPicResampleRcontrol;
+ BYTE bPicResampleExtrapWidth;
+ BYTE bPicResampleExtrapHeight;
- DWORD dwPicResampleSourceWidth;
- DWORD dwPicResampleSourceHeight;
+ DWORD dwPicResampleSourceWidth;
+ DWORD dwPicResampleSourceHeight;
- DWORD dwPicResampleDestWidth;
- DWORD dwPicResampleDestHeight;
+ DWORD dwPicResampleDestWidth;
+ DWORD dwPicResampleDestHeight;
- DWORD dwPicResampleFullDestWidth;
- DWORD dwPicResampleFullDestHeight;
+ DWORD dwPicResampleFullDestWidth;
+ DWORD dwPicResampleFullDestHeight;
- } DXVA_PicResample, *LPDXVA_PicResample;
+} DXVA_PicResample, *LPDXVA_PicResample;
#define DXVA_CHROMA_FORMAT_420 1
@@ -400,107 +395,101 @@ extern "C" {
#define DXVA_BITSTREAM_CONCEALMENT_METHOD_BACKWARD 3
- /* Buffer Description Data */
+/* Buffer Description Data */
- typedef struct _DXVA_BufferDescription
- {
- DWORD dwTypeIndex;
- DWORD dwBufferIndex;
- DWORD dwDataOffset;
- DWORD dwDataSize;
- DWORD dwFirstMBaddress;
- DWORD dwNumMBsInBuffer;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwStride;
- DWORD dwReservedBits;
- } DXVA_BufferDescription, *LPDXVA_BufferDescription;
+typedef struct _DXVA_BufferDescription {
+ DWORD dwTypeIndex;
+ DWORD dwBufferIndex;
+ DWORD dwDataOffset;
+ DWORD dwDataSize;
+ DWORD dwFirstMBaddress;
+ DWORD dwNumMBsInBuffer;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwStride;
+ DWORD dwReservedBits;
+} DXVA_BufferDescription, *LPDXVA_BufferDescription;
- /* Off-Host IDCT Coefficient Data Structures */
+/* Off-Host IDCT Coefficient Data Structures */
- typedef struct _DXVA_TCoef4Group
- {
- BYTE TCoefIDX[4];
- SHORT TCoefValue[4];
- } DXVA_TCoef4Group, *LPDXVA_TCoef4Group;
+typedef struct _DXVA_TCoef4Group {
+ BYTE TCoefIDX[4];
+ SHORT TCoefValue[4];
+} DXVA_TCoef4Group, *LPDXVA_TCoef4Group;
- typedef struct _DXVA_TCoefSingle
- {
- WORD wIndexWithEOB;
- SHORT TCoefValue;
- } DXVA_TCoefSingle, *LPDXVA_TCoefSingle;
+typedef struct _DXVA_TCoefSingle {
+ WORD wIndexWithEOB;
+ SHORT TCoefValue;
+} DXVA_TCoefSingle, *LPDXVA_TCoefSingle;
- /* Macros for Reading EOB and Index Values */
+/* Macros for Reading EOB and Index Values */
#define readDXVA_TCoefSingleIDX(ptr) ((ptr)->wIndexWithEOB >> 1)
#define readDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB & 1)
- /* Macro for Writing EOB and Index Values */
+/* Macro for Writing EOB and Index Values */
#define writeDXVA_TCoefSingleIndexWithEOB(ptr, idx, eob) ((ptr)->wIndexWithEOB = ((idx) << 1) | (eob))
#define setDXVA_TCoefSingleIDX(ptr, idx) ((ptr)->wIndexWithEOB |= ((idx) << 1))
#define setDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB |= 1)
- /* Spatial-Domain Residual Difference Blocks */
+/* Spatial-Domain Residual Difference Blocks */
#define DXVA_USUAL_BLOCK_WIDTH 8
#define DXVA_USUAL_BLOCK_HEIGHT 8
#define DXVA_USUAL_BLOCK_SIZE (DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT)
- typedef SHORT DXVA_Sample16[DXVA_USUAL_BLOCK_SIZE];
- typedef signed char DXVA_Sample8 [DXVA_USUAL_BLOCK_SIZE];
+typedef SHORT DXVA_Sample16[DXVA_USUAL_BLOCK_SIZE];
+typedef signed char DXVA_Sample8 [DXVA_USUAL_BLOCK_SIZE];
- /* Deblocking Filter Control Structure */
+/* Deblocking Filter Control Structure */
- typedef BYTE DXVA_DeblockingEdgeControl;
+typedef BYTE DXVA_DeblockingEdgeControl;
- typedef DXVA_DeblockingEdgeControl * LPDXVA_DeblockingEdgeControl;
+typedef DXVA_DeblockingEdgeControl * LPDXVA_DeblockingEdgeControl;
- /* Macros for Reading STRENGTH and FilterOn */
+/* Macros for Reading STRENGTH and FilterOn */
#define readDXVA_EdgeFilterStrength(ptr) ((*(ptr)) >> 1)
#define readDXVA_EdgeFilterOn(ptr) ((*(ptr)) & 1)
- /* Macro for Writing STRENGTH and FilterOn */
+/* Macro for Writing STRENGTH and FilterOn */
#define writeDXVA_DeblockingEdgeControl(ptr, str, fon) ((*(ptr)) = ((str) << 1) | (fon))
#define setDXVA_EdgeFilterStrength(ptr, str) ((*(ptr)) |= ((str) << 1))
#define setDXVA_EdgeFilterOn(ptr) ((*(ptr)) |= 1)
- /* Macroblock Control Command Data Structures */
+/* Macroblock Control Command Data Structures */
- typedef struct _DXVA_MVvalue
- {
- SHORT horz, vert;
- } DXVA_MVvalue, *LPDXVA_MVvalue;
+typedef struct _DXVA_MVvalue {
+ SHORT horz, vert;
+} DXVA_MVvalue, *LPDXVA_MVvalue;
- /* Inverse Quantization Matrices */
+/* Inverse Quantization Matrices */
- typedef struct _DXVA_QmatrixData
- {
- BYTE bNewQmatrix[4]; /* intra Y, inter Y, intra chroma, inter chroma */
- WORD Qmatrix[4][DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT];
- } DXVA_QmatrixData, *LPDXVA_QmatrixData;
+typedef struct _DXVA_QmatrixData {
+ BYTE bNewQmatrix[4]; /* intra Y, inter Y, intra chroma, inter chroma */
+ WORD Qmatrix[4][DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT];
+} DXVA_QmatrixData, *LPDXVA_QmatrixData;
- /* Slice Control Buffer Data */
+/* Slice Control Buffer Data */
- typedef struct _DXVA_SliceInfo
- {
- WORD wHorizontalPosition;
- WORD wVerticalPosition;
- DWORD dwSliceBitsInBuffer;
- DWORD dwSliceDataLocation;
- BYTE bStartCodeBitOffset;
- BYTE bReservedBits;
- WORD wMBbitOffset;
- WORD wNumberMBsInSlice;
- WORD wQuantizerScaleCode;
- WORD wBadSliceChopping;
- } DXVA_SliceInfo, *LPDXVA_SliceInfo;
+typedef struct _DXVA_SliceInfo {
+ WORD wHorizontalPosition;
+ WORD wVerticalPosition;
+ DWORD dwSliceBitsInBuffer;
+ DWORD dwSliceDataLocation;
+ BYTE bStartCodeBitOffset;
+ BYTE bReservedBits;
+ WORD wMBbitOffset;
+ WORD wNumberMBsInSlice;
+ WORD wQuantizerScaleCode;
+ WORD wBadSliceChopping;
+} DXVA_SliceInfo, *LPDXVA_SliceInfo;
#define DXVA_NumMV_OBMC_off_BinPBwith4MV_off 4
@@ -512,69 +501,64 @@ extern "C" {
#define DXVA_NumBlocksPerMB_422 (4+2+2)
#define DXVA_NumBlocksPerMB_444 (4+4+4)
- /* Basic form for I pictures */
- /* Host Residual Differences */
- typedef struct _DXVA_MBctrl_I_HostResidDiff_1
- {
- WORD wMBaddress;
- WORD wMBtype;
- DWORD dwMB_SNL;
- WORD wPatternCode;
- WORD wPC_Overflow; /* zero if not overflow format */
- DWORD dwReservedBits2;
- } DXVA_MBctrl_I_HostResidDiff_1;
-
- /* Basic form for I pictures */
- /* Off-Host IDCT, 4:2:0 sampling */
- typedef struct _DXVA_MBctrl_I_OffHostIDCT_1
- {
- WORD wMBaddress;
- WORD wMBtype;
- DWORD dwMB_SNL;
- WORD wPatternCode;
- BYTE bNumCoef[DXVA_NumBlocksPerMB_420];
- } DXVA_MBctrl_I_OffHostIDCT_1;
-
- /* Basic form for P and B pictures */
- /* Should also be used for concealment MVs in MPEG-2 I pictures */
- /* Without OBMC, without BinPB and 4MV together, without MV RPS */
- /* Host Residual Differences */
- typedef struct _DXVA_MBctrl_P_HostResidDiff_1
- {
- WORD wMBaddress;
- WORD wMBtype;
- DWORD dwMB_SNL;
- WORD wPatternCode;
- WORD wPC_Overflow; /* zero if not overflow format */
- DWORD dwReservedBits2;
- DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
- } DXVA_MBctrl_P_HostResidDiff_1;
-
- /* Basic form for P and B pictures */
- /* Without OBMC, without BinPB and 4MV together, without MV RPS */
- /* Off-Host IDCT, 4:2:0 sampling */
- typedef struct _DXVA_MBctrl_P_OffHostIDCT_1
- {
- WORD wMBaddress;
- WORD wMBtype;
- DWORD dwMB_SNL;
- WORD wPatternCode;
- BYTE bNumCoef[DXVA_NumBlocksPerMB_420];
- DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
- } DXVA_MBctrl_P_OffHostIDCT_1;
-
- /* How to load alpha blending graphic data */
- typedef struct _DXVA_ConfigAlphaLoad
- {
-
- // Operation Indicated
- DXVA_ConfigQueryOrReplyFunc dwFunction;
-
- // Alignment
- DWORD dwReservedBits[3];
-
- BYTE bConfigDataType;
- } DXVA_ConfigAlphaLoad, *LPDXVA_ConfigAlphaLoad;
+/* Basic form for I pictures */
+/* Host Residual Differences */
+typedef struct _DXVA_MBctrl_I_HostResidDiff_1 {
+ WORD wMBaddress;
+ WORD wMBtype;
+ DWORD dwMB_SNL;
+ WORD wPatternCode;
+ WORD wPC_Overflow; /* zero if not overflow format */
+ DWORD dwReservedBits2;
+} DXVA_MBctrl_I_HostResidDiff_1;
+
+/* Basic form for I pictures */
+/* Off-Host IDCT, 4:2:0 sampling */
+typedef struct _DXVA_MBctrl_I_OffHostIDCT_1 {
+ WORD wMBaddress;
+ WORD wMBtype;
+ DWORD dwMB_SNL;
+ WORD wPatternCode;
+ BYTE bNumCoef[DXVA_NumBlocksPerMB_420];
+} DXVA_MBctrl_I_OffHostIDCT_1;
+
+/* Basic form for P and B pictures */
+/* Should also be used for concealment MVs in MPEG-2 I pictures */
+/* Without OBMC, without BinPB and 4MV together, without MV RPS */
+/* Host Residual Differences */
+typedef struct _DXVA_MBctrl_P_HostResidDiff_1 {
+ WORD wMBaddress;
+ WORD wMBtype;
+ DWORD dwMB_SNL;
+ WORD wPatternCode;
+ WORD wPC_Overflow; /* zero if not overflow format */
+ DWORD dwReservedBits2;
+ DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
+} DXVA_MBctrl_P_HostResidDiff_1;
+
+/* Basic form for P and B pictures */
+/* Without OBMC, without BinPB and 4MV together, without MV RPS */
+/* Off-Host IDCT, 4:2:0 sampling */
+typedef struct _DXVA_MBctrl_P_OffHostIDCT_1 {
+ WORD wMBaddress;
+ WORD wMBtype;
+ DWORD dwMB_SNL;
+ WORD wPatternCode;
+ BYTE bNumCoef[DXVA_NumBlocksPerMB_420];
+ DXVA_MVvalue MVector[DXVA_NumMV_OBMC_off_BinPBwith4MV_off];
+} DXVA_MBctrl_P_OffHostIDCT_1;
+
+/* How to load alpha blending graphic data */
+typedef struct _DXVA_ConfigAlphaLoad {
+
+ // Operation Indicated
+ DXVA_ConfigQueryOrReplyFunc dwFunction;
+
+ // Alignment
+ DWORD dwReservedBits[3];
+
+ BYTE bConfigDataType;
+} DXVA_ConfigAlphaLoad, *LPDXVA_ConfigAlphaLoad;
#define DXVA_CONFIG_DATA_TYPE_IA44 0
#define DXVA_CONFIG_DATA_TYPE_AI44 1
@@ -582,41 +566,39 @@ extern "C" {
#define DXVA_CONFIG_DATA_TYPE_AYUV 3
- /* How to combine alpha blending graphic data */
- typedef struct _DXVA_ConfigAlphaCombine
- {
+/* How to combine alpha blending graphic data */
+typedef struct _DXVA_ConfigAlphaCombine {
- // Operation Indicated
- DXVA_ConfigQueryOrReplyFunc dwFunction;
+ // Operation Indicated
+ DXVA_ConfigQueryOrReplyFunc dwFunction;
- // Alignment
- DWORD dwReservedBits[3];
+ // Alignment
+ DWORD dwReservedBits[3];
- BYTE bConfigBlendType;
- BYTE bConfigPictureResizing;
- BYTE bConfigOnlyUsePicDestRectArea;
- BYTE bConfigGraphicResizing;
- BYTE bConfigWholePlaneAlpha;
+ BYTE bConfigBlendType;
+ BYTE bConfigPictureResizing;
+ BYTE bConfigOnlyUsePicDestRectArea;
+ BYTE bConfigGraphicResizing;
+ BYTE bConfigWholePlaneAlpha;
- } DXVA_ConfigAlphaCombine, *LPDXVA_ConfigAlphaCombine;
+} DXVA_ConfigAlphaCombine, *LPDXVA_ConfigAlphaCombine;
#define DXVA_CONFIG_BLEND_TYPE_FRONT_BUFFER 0
#define DXVA_CONFIG_BLEND_TYPE_BACK_HARDWARE 1
- /* AYUV sample for 16-entry YUV palette or graphic surface */
+/* AYUV sample for 16-entry YUV palette or graphic surface */
- typedef struct _DXVA_AYUVsample2
- {
- BYTE bCrValue;
- BYTE bCbValue;
- BYTE bY_Value;
- BYTE bSampleAlpha8;
- } DXVA_AYUVsample2, *LPDXVA_AYUVsample2;
+typedef struct _DXVA_AYUVsample2 {
+ BYTE bCrValue;
+ BYTE bCbValue;
+ BYTE bY_Value;
+ BYTE bSampleAlpha8;
+} DXVA_AYUVsample2, *LPDXVA_AYUVsample2;
- /* Macros for IA44 alpha blending surface samples */
+/* Macros for IA44 alpha blending surface samples */
- typedef BYTE DXVA_IA44sample, *LPDXVA_IA44sample;
+typedef BYTE DXVA_IA44sample, *LPDXVA_IA44sample;
#define readDXVA_IA44index(ptr) (((*(ptr)) & 0xF0) >> 4)
#define readDXVA_IA44alpha(ptr) ((*(ptr)) & 0x0F)
@@ -626,9 +608,9 @@ extern "C" {
#define setDXVA_IA44index(ptr, idx) ((*(ptr)) |= ((idx) << 4))
#define setDXVA_IA44alpha(ptr, alpha) ((*(ptr)) |= (alpha))
- /* Macros for AI44 alpha blending surface samples */
+/* Macros for AI44 alpha blending surface samples */
- typedef BYTE DXVA_AI44sample, *LPDXVA_AI44sample;
+typedef BYTE DXVA_AI44sample, *LPDXVA_AI44sample;
#define readDXVA_AI44index(ptr) ((*(ptr)) & 0x0F)
#define readDXVA_AI44alpha(ptr) (((*(ptr)) & 0xF0) >> 4)
@@ -639,384 +621,358 @@ extern "C" {
#define setDXVA_AI44alpha(ptr, alpha) ((*(ptr)) |= ((alpha) << 4))
- /* Highlight data structure */
-
- typedef struct _DXVA_Highlight
- {
- WORD wHighlightActive;
- WORD wHighlightIndices;
- WORD wHighlightAlphas;
- RECT HighlightRect;
- } DXVA_Highlight, *LPDXVA_Highlight;
-
- typedef BYTE DXVA_DPXD, *LPDXVA_DPXD;
- typedef WORD DXVA_DCCMD, *LPDXVA_DCCMD;
-
- /* Alpha blend combination */
-
- typedef struct _DXVA_BlendCombination
- {
- WORD wPictureSourceIndex;
- WORD wBlendedDestinationIndex;
- RECT PictureSourceRect16thPel;
- RECT PictureDestinationRect;
- RECT GraphicSourceRect;
- RECT GraphicDestinationRect;
- WORD wBlendDelay;
- BYTE bBlendOn;
- BYTE bWholePlaneAlpha;
- DXVA_AYUVsample2 OutsideYUVcolor;
- } DXVA_BlendCombination, *LPDXVA_BlendCombination;
-
- /* H.264/AVC-specific structures */
-
- /* H.264/AVC picture entry data structure */
- typedef struct _DXVA_PicEntry_H264
- {
- union
- {
- struct
- {
- UCHAR Index7Bits : 7;
- UCHAR AssociatedFlag : 1;
- };
- UCHAR bPicEntry;
- };
- } DXVA_PicEntry_H264, *LPDXVA_PicEntry_H264; /* 1 byte */
-
- /* H.264/AVC picture parameters structure */
- typedef struct _DXVA_PicParams_H264
- {
- USHORT wFrameWidthInMbsMinus1;
- USHORT wFrameHeightInMbsMinus1;
- DXVA_PicEntry_H264 CurrPic; /* flag is bot field flag */
- UCHAR num_ref_frames;
-
- union
- {
- struct
- {
- USHORT field_pic_flag : 1;
- USHORT MbaffFrameFlag : 1;
- USHORT residual_colour_transform_flag : 1;
- USHORT sp_for_switch_flag : 1;
- USHORT chroma_format_idc : 2;
- USHORT RefPicFlag : 1;
- USHORT constrained_intra_pred_flag : 1;
-
- USHORT weighted_pred_flag : 1;
- USHORT weighted_bipred_idc : 2;
- USHORT MbsConsecutiveFlag : 1;
- USHORT frame_mbs_only_flag : 1;
- USHORT transform_8x8_mode_flag : 1;
- USHORT MinLumaBipredSize8x8Flag : 1;
- USHORT IntraPicFlag : 1;
- };
- USHORT wBitFields;
- };
- UCHAR bit_depth_luma_minus8;
- UCHAR bit_depth_chroma_minus8;
-
- USHORT Reserved16Bits;
- UINT StatusReportFeedbackNumber;
-
- DXVA_PicEntry_H264 RefFrameList[16]; /* flag LT */
- INT CurrFieldOrderCnt[2];
- INT FieldOrderCntList[16][2];
-
- CHAR pic_init_qs_minus26;
- CHAR chroma_qp_index_offset; /* also used for QScb */
- CHAR second_chroma_qp_index_offset; /* also for QScr */
- UCHAR ContinuationFlag;
-
- /* remainder for parsing */
- CHAR pic_init_qp_minus26;
- UCHAR num_ref_idx_l0_active_minus1;
- UCHAR num_ref_idx_l1_active_minus1;
- UCHAR Reserved8BitsA;
-
- USHORT FrameNumList[16];
- UINT UsedForReferenceFlags;
- USHORT NonExistingFrameFlags;
- USHORT frame_num;
-
- UCHAR log2_max_frame_num_minus4;
- UCHAR pic_order_cnt_type;
- UCHAR log2_max_pic_order_cnt_lsb_minus4;
- UCHAR delta_pic_order_always_zero_flag;
-
- UCHAR direct_8x8_inference_flag;
- UCHAR entropy_coding_mode_flag;
- UCHAR pic_order_present_flag;
- UCHAR num_slice_groups_minus1;
-
- UCHAR slice_group_map_type;
- UCHAR deblocking_filter_control_present_flag;
- UCHAR redundant_pic_cnt_present_flag;
- UCHAR Reserved8BitsB;
-
- USHORT slice_group_change_rate_minus1;
-
- UCHAR SliceGroupMap[810]; /* 4b/sgmu, Size BT.601 */
-
- } DXVA_PicParams_H264, *LPDXVA_PicParams_H264;
-
- /* H.264/AVC quantization weighting matrix data structure */
- typedef struct _DXVA_Qmatrix_H264
- {
- UCHAR bScalingLists4x4[6][16];
- UCHAR bScalingLists8x8[2][64];
-
- } DXVA_Qmatrix_H264, *LPDXVA_Qmatrix_H264;
-
- /* H.264/AVC slice control data structure - short form */
- typedef struct _DXVA_Slice_H264_Short
- {
- UINT BSNALunitDataLocation; /* type 1..5 */
- UINT SliceBytesInBuffer; /* for off-host parse */
- USHORT wBadSliceChopping; /* for off-host parse */
- } DXVA_Slice_H264_Short, *LPDXVA_Slice_H264_Short;
-
- /* H.264/AVC picture entry data structure - long form */
- typedef struct _DXVA_Slice_H264_Long
- {
- UINT BSNALunitDataLocation; /* type 1..5 */
- UINT SliceBytesInBuffer; /* for off-host parse */
- USHORT wBadSliceChopping; /* for off-host parse */
-
- USHORT first_mb_in_slice;
- USHORT NumMbsForSlice;
-
- USHORT BitOffsetToSliceData; /* after CABAC alignment */
-
- UCHAR slice_type;
- UCHAR luma_log2_weight_denom;
- UCHAR chroma_log2_weight_denom;
- UCHAR num_ref_idx_l0_active_minus1;
- UCHAR num_ref_idx_l1_active_minus1;
- CHAR slice_alpha_c0_offset_div2;
- CHAR slice_beta_offset_div2;
- UCHAR Reserved8Bits;
- DXVA_PicEntry_H264 RefPicList[2][32]; /* L0 & L1 */
- SHORT Weights[2][32][3][2]; /* L0 & L1; Y, Cb, Cr */
- CHAR slice_qs_delta;
- /* rest off-host parse */
- CHAR slice_qp_delta;
- UCHAR redundant_pic_cnt;
- UCHAR direct_spatial_mv_pred_flag;
- UCHAR cabac_init_idc;
- UCHAR disable_deblocking_filter_idc;
- USHORT slice_id;
- } DXVA_Slice_H264_Long, *LPDXVA_Slice_H264_Long;
-
- /* H.264/AVC macroblock control command data structure */
- typedef struct _DXVA_MBctrl_H264
- {
- union
- {
- struct
- {
- UINT bSliceID : 8; /* 1 byte */
- UINT MbType5Bits : 5;
- UINT IntraMbFlag : 1;
- UINT mb_field_decoding_flag : 1;
- UINT transform_size_8x8_flag : 1; /* 2 bytes */
- UINT HostResidDiff : 1;
- UINT DcBlockCodedCrFlag : 1;
- UINT DcBlockCodedCbFlag : 1;
- UINT DcBlockCodedYFlag : 1;
- UINT FilterInternalEdgesFlag : 1;
- UINT FilterLeftMbEdgeFlag : 1;
- UINT FilterTopMbEdgeFlag : 1;
- UINT ReservedBit : 1;
- UINT bMvQuantity : 8; /* 4 bytes */
- };
- UINT dwMBtype; /* 4 bytes so far */
- };
- USHORT CurrMbAddr; /* 6 bytes so far */
- USHORT wPatternCode[3];/* YCbCr, 16 4x4 blks, 1b each */
- /* 12 bytes so far */
- UCHAR bQpPrime[3]; /* Y, Cb, Cr, need just 7b QpY */
- UCHAR bMBresidDataQuantity;
- ULONG dwMBdataLocation; /* offset into resid buffer */
- /* 20 bytes so far */
- union
- {
- struct
- {
- /* start here for Intra MB's (9 useful bytes in branch) */
- USHORT LumaIntraPredModes[4];/* 16 blocks, 4b each */
- /* 28 bytes so far */
- union
- {
- struct
- {
- UCHAR intra_chroma_pred_mode : 2;
- UCHAR IntraPredAvailFlags : 5;
- UCHAR ReservedIntraBit : 1;
- };
- UCHAR bMbIntraStruct; /* 29 bytes so far */
- };
- UCHAR ReservedIntra24Bits[3]; /* 32 bytes total */
- };
- struct
- {
- /* start here for non-Intra MB's (12 bytes in branch) */
- UCHAR bSubMbShapes; /* 4 subMbs, 2b each */
- UCHAR bSubMbPredModes; /* 4 subMBs, 2b each */
- /* 22 bytes so far */
- USHORT wMvBuffOffset; /* offset into MV buffer */
- UCHAR bRefPicSelect[2][4]; /* 32 bytes total */
- };
- };
- } DXVA_MBctrl_H264, *LPDXVA_MBctrl_H264;
-
- /* H.264/AVC IndexA and IndexB data structure */
- typedef struct _DXVA_DeblockIndexAB_H264
- {
- UCHAR bIndexAinternal; /* 6b - could get from MB CC */
- UCHAR bIndexBinternal; /* 6b - could get from MB CC */
-
- UCHAR bIndexAleft0;
- UCHAR bIndexBleft0;
-
- UCHAR bIndexAleft1;
- UCHAR bIndexBleft1;
-
- UCHAR bIndexAtop0;
- UCHAR bIndexBtop0;
-
- UCHAR bIndexAtop1;
- UCHAR bIndexBtop1;
- } DXVA_DeblockIndexAB_H264, *LPDXVA_DeblockIndexAB_H264;
- /* 10 bytes in struct */
-
- /* H.264/AVC deblocking filter control data structure */
- typedef struct _DXVA_Deblock_H264
- {
- USHORT CurrMbAddr; /* dup info */ /* 2 bytes so far */
- union
- {
- struct
- {
- UCHAR ReservedBit : 1;
- UCHAR FieldModeCurrentMbFlag : 1; /* dup info */
- UCHAR FieldModeLeftMbFlag : 1;
- UCHAR FieldModeAboveMbFlag : 1;
- UCHAR FilterInternal8x8EdgesFlag : 1;
- UCHAR FilterInternal4x4EdgesFlag : 1;
- UCHAR FilterLeftMbEdgeFlag : 1;
- UCHAR FilterTopMbEdgeFlag : 1;
- };
- UCHAR FirstByte;
+/* Highlight data structure */
+
+typedef struct _DXVA_Highlight {
+ WORD wHighlightActive;
+ WORD wHighlightIndices;
+ WORD wHighlightAlphas;
+ RECT HighlightRect;
+} DXVA_Highlight, *LPDXVA_Highlight;
+
+typedef BYTE DXVA_DPXD, *LPDXVA_DPXD;
+typedef WORD DXVA_DCCMD, *LPDXVA_DCCMD;
+
+/* Alpha blend combination */
+
+typedef struct _DXVA_BlendCombination {
+ WORD wPictureSourceIndex;
+ WORD wBlendedDestinationIndex;
+ RECT PictureSourceRect16thPel;
+ RECT PictureDestinationRect;
+ RECT GraphicSourceRect;
+ RECT GraphicDestinationRect;
+ WORD wBlendDelay;
+ BYTE bBlendOn;
+ BYTE bWholePlaneAlpha;
+ DXVA_AYUVsample2 OutsideYUVcolor;
+} DXVA_BlendCombination, *LPDXVA_BlendCombination;
+
+/* H.264/AVC-specific structures */
+
+/* H.264/AVC picture entry data structure */
+typedef struct _DXVA_PicEntry_H264 {
+ union {
+ struct {
+ UCHAR Index7Bits : 7;
+ UCHAR AssociatedFlag : 1;
+ };
+ UCHAR bPicEntry;
+ };
+} DXVA_PicEntry_H264, *LPDXVA_PicEntry_H264; /* 1 byte */
+
+/* H.264/AVC picture parameters structure */
+typedef struct _DXVA_PicParams_H264 {
+ USHORT wFrameWidthInMbsMinus1;
+ USHORT wFrameHeightInMbsMinus1;
+ DXVA_PicEntry_H264 CurrPic; /* flag is bot field flag */
+ UCHAR num_ref_frames;
+
+ union {
+ struct {
+ USHORT field_pic_flag : 1;
+ USHORT MbaffFrameFlag : 1;
+ USHORT residual_colour_transform_flag : 1;
+ USHORT sp_for_switch_flag : 1;
+ USHORT chroma_format_idc : 2;
+ USHORT RefPicFlag : 1;
+ USHORT constrained_intra_pred_flag : 1;
+
+ USHORT weighted_pred_flag : 1;
+ USHORT weighted_bipred_idc : 2;
+ USHORT MbsConsecutiveFlag : 1;
+ USHORT frame_mbs_only_flag : 1;
+ USHORT transform_8x8_mode_flag : 1;
+ USHORT MinLumaBipredSize8x8Flag : 1;
+ USHORT IntraPicFlag : 1;
+ };
+ USHORT wBitFields;
+ };
+ UCHAR bit_depth_luma_minus8;
+ UCHAR bit_depth_chroma_minus8;
+
+ USHORT Reserved16Bits;
+ UINT StatusReportFeedbackNumber;
+
+ DXVA_PicEntry_H264 RefFrameList[16]; /* flag LT */
+ INT CurrFieldOrderCnt[2];
+ INT FieldOrderCntList[16][2];
+
+ CHAR pic_init_qs_minus26;
+ CHAR chroma_qp_index_offset; /* also used for QScb */
+ CHAR second_chroma_qp_index_offset; /* also for QScr */
+ UCHAR ContinuationFlag;
+
+/* remainder for parsing */
+ CHAR pic_init_qp_minus26;
+ UCHAR num_ref_idx_l0_active_minus1;
+ UCHAR num_ref_idx_l1_active_minus1;
+ UCHAR Reserved8BitsA;
+
+ USHORT FrameNumList[16];
+ UINT UsedForReferenceFlags;
+ USHORT NonExistingFrameFlags;
+ USHORT frame_num;
+
+ UCHAR log2_max_frame_num_minus4;
+ UCHAR pic_order_cnt_type;
+ UCHAR log2_max_pic_order_cnt_lsb_minus4;
+ UCHAR delta_pic_order_always_zero_flag;
+
+ UCHAR direct_8x8_inference_flag;
+ UCHAR entropy_coding_mode_flag;
+ UCHAR pic_order_present_flag;
+ UCHAR num_slice_groups_minus1;
+
+ UCHAR slice_group_map_type;
+ UCHAR deblocking_filter_control_present_flag;
+ UCHAR redundant_pic_cnt_present_flag;
+ UCHAR Reserved8BitsB;
+
+ USHORT slice_group_change_rate_minus1;
+
+ UCHAR SliceGroupMap[810]; /* 4b/sgmu, Size BT.601 */
+
+} DXVA_PicParams_H264, *LPDXVA_PicParams_H264;
+
+/* H.264/AVC quantization weighting matrix data structure */
+typedef struct _DXVA_Qmatrix_H264 {
+ UCHAR bScalingLists4x4[6][16];
+ UCHAR bScalingLists8x8[2][64];
+
+} DXVA_Qmatrix_H264, *LPDXVA_Qmatrix_H264;
+
+/* H.264/AVC slice control data structure - short form */
+typedef struct _DXVA_Slice_H264_Short {
+ UINT BSNALunitDataLocation; /* type 1..5 */
+ UINT SliceBytesInBuffer; /* for off-host parse */
+ USHORT wBadSliceChopping; /* for off-host parse */
+} DXVA_Slice_H264_Short, *LPDXVA_Slice_H264_Short;
+
+/* H.264/AVC picture entry data structure - long form */
+typedef struct _DXVA_Slice_H264_Long {
+ UINT BSNALunitDataLocation; /* type 1..5 */
+ UINT SliceBytesInBuffer; /* for off-host parse */
+ USHORT wBadSliceChopping; /* for off-host parse */
+
+ USHORT first_mb_in_slice;
+ USHORT NumMbsForSlice;
+
+ USHORT BitOffsetToSliceData; /* after CABAC alignment */
+
+ UCHAR slice_type;
+ UCHAR luma_log2_weight_denom;
+ UCHAR chroma_log2_weight_denom;
+ UCHAR num_ref_idx_l0_active_minus1;
+ UCHAR num_ref_idx_l1_active_minus1;
+ CHAR slice_alpha_c0_offset_div2;
+ CHAR slice_beta_offset_div2;
+ UCHAR Reserved8Bits;
+ DXVA_PicEntry_H264 RefPicList[2][32]; /* L0 & L1 */
+ SHORT Weights[2][32][3][2]; /* L0 & L1; Y, Cb, Cr */
+ CHAR slice_qs_delta;
+ /* rest off-host parse */
+ CHAR slice_qp_delta;
+ UCHAR redundant_pic_cnt;
+ UCHAR direct_spatial_mv_pred_flag;
+ UCHAR cabac_init_idc;
+ UCHAR disable_deblocking_filter_idc;
+ USHORT slice_id;
+} DXVA_Slice_H264_Long, *LPDXVA_Slice_H264_Long;
+
+/* H.264/AVC macroblock control command data structure */
+typedef struct _DXVA_MBctrl_H264 {
+ union {
+ struct {
+ UINT bSliceID : 8; /* 1 byte */
+ UINT MbType5Bits : 5;
+ UINT IntraMbFlag : 1;
+ UINT mb_field_decoding_flag : 1;
+ UINT transform_size_8x8_flag : 1; /* 2 bytes */
+ UINT HostResidDiff : 1;
+ UINT DcBlockCodedCrFlag : 1;
+ UINT DcBlockCodedCbFlag : 1;
+ UINT DcBlockCodedYFlag : 1;
+ UINT FilterInternalEdgesFlag : 1;
+ UINT FilterLeftMbEdgeFlag : 1;
+ UINT FilterTopMbEdgeFlag : 1;
+ UINT ReservedBit : 1;
+ UINT bMvQuantity : 8; /* 4 bytes */
+ };
+ UINT dwMBtype; /* 4 bytes so far */
+ };
+ USHORT CurrMbAddr; /* 6 bytes so far */
+ USHORT wPatternCode[3];/* YCbCr, 16 4x4 blks, 1b each */
+ /* 12 bytes so far */
+ UCHAR bQpPrime[3]; /* Y, Cb, Cr, need just 7b QpY */
+ UCHAR bMBresidDataQuantity;
+ ULONG dwMBdataLocation; /* offset into resid buffer */
+ /* 20 bytes so far */
+ union {
+ struct {
+/* start here for Intra MB's (9 useful bytes in branch) */
+ USHORT LumaIntraPredModes[4];/* 16 blocks, 4b each */
+ /* 28 bytes so far */
+ union {
+ struct {
+ UCHAR intra_chroma_pred_mode : 2;
+ UCHAR IntraPredAvailFlags : 5;
+ UCHAR ReservedIntraBit : 1;
};
- UCHAR Reserved8Bits; /* 4 bytes so far */
-
- UCHAR bbSinternalLeftVert; /* 2 bits per bS */
- UCHAR bbSinternalMidVert;
-
- UCHAR bbSinternalRightVert;
- UCHAR bbSinternalTopHorz; /* 8 bytes so far */
-
- UCHAR bbSinternalMidHorz;
- UCHAR bbSinternalBotHorz; /* 10 bytes so far */
-
- USHORT wbSLeft0; /* 4 bits per bS (1 wasted) */
- USHORT wbSLeft1; /* 4 bits per bS (1 wasted) */
-
- USHORT wbSTop0; /* 4 bits per bS (1 wasted) */
- USHORT wbSTop1; /* 4b (2 wasted) 18 bytes so far*/
-
- DXVA_DeblockIndexAB_H264 IndexAB[3]; /* Y, Cb, Cr */
-
- } DXVA_Deblock_H264, *LPDXVA_Deblock_H264;/* 48 bytes */
-
- /* H.264/AVC film grain characteristics data structure */
- typedef struct _DXVA_FilmGrainCharacteristics
- {
-
- USHORT wFrameWidthInMbsMinus1;
- USHORT wFrameHeightInMbsMinus1;
-
- DXVA_PicEntry_H264 InPic; /* flag is bot field flag */
- DXVA_PicEntry_H264 OutPic; /* flag is field pic flag */
-
- USHORT PicOrderCnt_offset;
- INT CurrPicOrderCnt;
- UINT StatusReportFeedbackNumber;
-
- UCHAR model_id;
- UCHAR separate_colour_description_present_flag;
- UCHAR film_grain_bit_depth_luma_minus8;
- UCHAR film_grain_bit_depth_chroma_minus8;
-
- UCHAR film_grain_full_range_flag;
- UCHAR film_grain_colour_primaries;
- UCHAR film_grain_transfer_characteristics;
- UCHAR film_grain_matrix_coefficients;
-
- UCHAR blending_mode_id;
- UCHAR log2_scale_factor;
-
- UCHAR comp_model_present_flag[4];
- UCHAR num_intensity_intervals_minus1[4];
- UCHAR num_model_values_minus1[4];
-
- UCHAR intensity_interval_lower_bound[3][16];
- UCHAR intensity_interval_upper_bound[3][16];
- SHORT comp_model_value[3][16][8];
- } DXVA_FilmGrainChar_H264, *LPDXVA_FilmGrainChar_H264;
-
- /* H.264/AVC status reporting data structure */
- typedef struct _DXVA_Status_H264
- {
- UINT StatusReportFeedbackNumber;
- DXVA_PicEntry_H264 CurrPic; /* flag is bot field flag */
- UCHAR field_pic_flag;
- UCHAR bDXVA_Func;
- UCHAR bBufType;
- UCHAR bStatus;
- UCHAR bReserved8Bits;
- USHORT wNumMbsAffected;
- } DXVA_Status_H264, *LPDXVA_Status_H264;
-
- /* VC-1 status reporting data structure */
- typedef struct _DXVA_Status_VC1
- {
- USHORT StatusReportFeedbackNumber;
- WORD wDecodedPictureIndex;
- WORD wDeblockedPictureIndex;
- UCHAR bPicStructure;
- UCHAR bBufType;
- UCHAR bStatus;
- UCHAR bReserved8Bits;
- USHORT wNumMbsAffected;
- } DXVA_Status_VC1, *LPDXVA_Status_VC1;
+ UCHAR bMbIntraStruct; /* 29 bytes so far */
+ };
+ UCHAR ReservedIntra24Bits[3]; /* 32 bytes total */
+ };
+ struct {
+/* start here for non-Intra MB's (12 bytes in branch) */
+ UCHAR bSubMbShapes; /* 4 subMbs, 2b each */
+ UCHAR bSubMbPredModes; /* 4 subMBs, 2b each */
+ /* 22 bytes so far */
+ USHORT wMvBuffOffset; /* offset into MV buffer */
+ UCHAR bRefPicSelect[2][4]; /* 32 bytes total */
+ };
+ };
+} DXVA_MBctrl_H264, *LPDXVA_MBctrl_H264;
+
+/* H.264/AVC IndexA and IndexB data structure */
+typedef struct _DXVA_DeblockIndexAB_H264 {
+ UCHAR bIndexAinternal; /* 6b - could get from MB CC */
+ UCHAR bIndexBinternal; /* 6b - could get from MB CC */
+
+ UCHAR bIndexAleft0;
+ UCHAR bIndexBleft0;
+
+ UCHAR bIndexAleft1;
+ UCHAR bIndexBleft1;
+
+ UCHAR bIndexAtop0;
+ UCHAR bIndexBtop0;
+
+ UCHAR bIndexAtop1;
+ UCHAR bIndexBtop1;
+} DXVA_DeblockIndexAB_H264, *LPDXVA_DeblockIndexAB_H264;
+ /* 10 bytes in struct */
+
+/* H.264/AVC deblocking filter control data structure */
+typedef struct _DXVA_Deblock_H264 {
+ USHORT CurrMbAddr; /* dup info */ /* 2 bytes so far */
+ union {
+ struct {
+ UCHAR ReservedBit : 1;
+ UCHAR FieldModeCurrentMbFlag : 1; /* dup info */
+ UCHAR FieldModeLeftMbFlag : 1;
+ UCHAR FieldModeAboveMbFlag : 1;
+ UCHAR FilterInternal8x8EdgesFlag : 1;
+ UCHAR FilterInternal4x4EdgesFlag : 1;
+ UCHAR FilterLeftMbEdgeFlag : 1;
+ UCHAR FilterTopMbEdgeFlag : 1;
+ };
+ UCHAR FirstByte;
+ };
+ UCHAR Reserved8Bits; /* 4 bytes so far */
+
+ UCHAR bbSinternalLeftVert; /* 2 bits per bS */
+ UCHAR bbSinternalMidVert;
+
+ UCHAR bbSinternalRightVert;
+ UCHAR bbSinternalTopHorz; /* 8 bytes so far */
+
+ UCHAR bbSinternalMidHorz;
+ UCHAR bbSinternalBotHorz; /* 10 bytes so far */
+
+ USHORT wbSLeft0; /* 4 bits per bS (1 wasted) */
+ USHORT wbSLeft1; /* 4 bits per bS (1 wasted) */
+
+ USHORT wbSTop0; /* 4 bits per bS (1 wasted) */
+ USHORT wbSTop1; /* 4b (2 wasted) 18 bytes so far*/
+
+ DXVA_DeblockIndexAB_H264 IndexAB[3]; /* Y, Cb, Cr */
+
+} DXVA_Deblock_H264, *LPDXVA_Deblock_H264;/* 48 bytes */
+
+/* H.264/AVC film grain characteristics data structure */
+typedef struct _DXVA_FilmGrainCharacteristics {
+
+ USHORT wFrameWidthInMbsMinus1;
+ USHORT wFrameHeightInMbsMinus1;
+
+ DXVA_PicEntry_H264 InPic; /* flag is bot field flag */
+ DXVA_PicEntry_H264 OutPic; /* flag is field pic flag */
+
+ USHORT PicOrderCnt_offset;
+ INT CurrPicOrderCnt;
+ UINT StatusReportFeedbackNumber;
+
+ UCHAR model_id;
+ UCHAR separate_colour_description_present_flag;
+ UCHAR film_grain_bit_depth_luma_minus8;
+ UCHAR film_grain_bit_depth_chroma_minus8;
+
+ UCHAR film_grain_full_range_flag;
+ UCHAR film_grain_colour_primaries;
+ UCHAR film_grain_transfer_characteristics;
+ UCHAR film_grain_matrix_coefficients;
+
+ UCHAR blending_mode_id;
+ UCHAR log2_scale_factor;
+
+ UCHAR comp_model_present_flag[4];
+ UCHAR num_intensity_intervals_minus1[4];
+ UCHAR num_model_values_minus1[4];
+
+ UCHAR intensity_interval_lower_bound[3][16];
+ UCHAR intensity_interval_upper_bound[3][16];
+ SHORT comp_model_value[3][16][8];
+} DXVA_FilmGrainChar_H264, *LPDXVA_FilmGrainChar_H264;
+
+/* H.264/AVC status reporting data structure */
+typedef struct _DXVA_Status_H264 {
+ UINT StatusReportFeedbackNumber;
+ DXVA_PicEntry_H264 CurrPic; /* flag is bot field flag */
+ UCHAR field_pic_flag;
+ UCHAR bDXVA_Func;
+ UCHAR bBufType;
+ UCHAR bStatus;
+ UCHAR bReserved8Bits;
+ USHORT wNumMbsAffected;
+} DXVA_Status_H264, *LPDXVA_Status_H264;
+
+/* VC-1 status reporting data structure */
+typedef struct _DXVA_Status_VC1 {
+ USHORT StatusReportFeedbackNumber;
+ WORD wDecodedPictureIndex;
+ WORD wDeblockedPictureIndex;
+ UCHAR bPicStructure;
+ UCHAR bBufType;
+ UCHAR bStatus;
+ UCHAR bReserved8Bits;
+ USHORT wNumMbsAffected;
+} DXVA_Status_VC1, *LPDXVA_Status_VC1;
#pragma pack(push, 16)
- typedef DXVA_MBctrl_I_HostResidDiff_1 *
- LPDXVA_MBctrl_I_HostResidDiff_1;
+typedef DXVA_MBctrl_I_HostResidDiff_1 *
+ LPDXVA_MBctrl_I_HostResidDiff_1;
- typedef DXVA_MBctrl_I_OffHostIDCT_1 *
- LPDXVA_MBctrl_I_OffHostIDCT_1;
+typedef DXVA_MBctrl_I_OffHostIDCT_1 *
+ LPDXVA_MBctrl_I_OffHostIDCT_1;
- typedef DXVA_MBctrl_P_HostResidDiff_1 *
- LPDXVA_MBctrl_P_HostResidDiff_1;
+typedef DXVA_MBctrl_P_HostResidDiff_1 *
+ LPDXVA_MBctrl_P_HostResidDiff_1;
- typedef DXVA_MBctrl_P_OffHostIDCT_1 *
- LPDXVA_MBctrl_P_OffHostIDCT_1;
+typedef DXVA_MBctrl_P_OffHostIDCT_1 *
+ LPDXVA_MBctrl_P_OffHostIDCT_1;
#pragma pack(pop)
- /*
- * Other forms of pictures are constructed in the obvious way
- * from the above by adjusting the number of residual difference
- * blocks, the number of motion vectors per macroblock, etc.
- */
+/*
+ * Other forms of pictures are constructed in the obvious way
+ * from the above by adjusting the number of residual difference
+ * blocks, the number of motion vectors per macroblock, etc.
+ */
#define readDXVA_MBskipsFollowing(ptr) (((ptr)->dwMB_SNL & 0xFF000000) >> 24)
#define readDXVA_MBdataLocation(ptr) (((ptr)->dwMB_SNL & 0x00FFFFFF))
@@ -1096,18 +1052,17 @@ extern "C" {
#ifndef __DIRECTX_VA_SAMPLEFORMAT__
#define __DIRECTX_VA_SAMPLEFORMAT__
- typedef enum _DXVA_SampleFormat
- {
- DXVA_SampleFormatMask = 0xFF, // 8 bits used for DXVA Sample format
- DXVA_SampleUnknown = 0,
- DXVA_SamplePreviousFrame = 1,
- DXVA_SampleProgressiveFrame = 2,
- DXVA_SampleFieldInterleavedEvenFirst = 3,
- DXVA_SampleFieldInterleavedOddFirst = 4,
- DXVA_SampleFieldSingleEven = 5,
- DXVA_SampleFieldSingleOdd = 6,
- DXVA_SampleSubStream = 7
- } DXVA_SampleFormat;
+typedef enum _DXVA_SampleFormat {
+ DXVA_SampleFormatMask = 0xFF, // 8 bits used for DXVA Sample format
+ DXVA_SampleUnknown = 0,
+ DXVA_SamplePreviousFrame = 1,
+ DXVA_SampleProgressiveFrame = 2,
+ DXVA_SampleFieldInterleavedEvenFirst = 3,
+ DXVA_SampleFieldInterleavedOddFirst = 4,
+ DXVA_SampleFieldSingleEven = 5,
+ DXVA_SampleFieldSingleOdd = 6,
+ DXVA_SampleSubStream = 7
+} DXVA_SampleFormat;
#define DXVA_ExtractSampleFormat(_sf) ((_sf) & (DXVA_SampleFormatMask))
@@ -1118,111 +1073,111 @@ extern "C" {
#define DXVA_ExtColorData_ShiftBase 8
#define DXVAColorMask(__bits,__base) (DXVABitMask(__bits) << (__base))
- typedef enum _DXVA_VideoTransferFunction
- {
- DXVA_VideoTransFuncShift = (DXVA_ExtColorData_ShiftBase + 19),
- DXVA_VideoTransFuncMask = DXVAColorMask(5, DXVA_VideoTransFuncShift),
-
- DXVA_VideoTransFunc_Unknown = 0,
- DXVA_VideoTransFunc_10 = 1,
- DXVA_VideoTransFunc_18 = 2,
- DXVA_VideoTransFunc_20 = 3,
- DXVA_VideoTransFunc_22 = 4,
- DXVA_VideoTransFunc_22_709 = 5,
- DXVA_VideoTransFunc_22_240M = 6,
- DXVA_VideoTransFunc_22_8bit_sRGB = 7,
- DXVA_VideoTransFunc_28 = 8
- } DXVA_VideoTransferFunction;
-
- typedef enum _DXVA_VideoPrimaries
- {
- DXVA_VideoPrimariesShift = (DXVA_ExtColorData_ShiftBase + 14),
- DXVA_VideoPrimariesMask = DXVAColorMask(5, DXVA_VideoPrimariesShift),
-
- DXVA_VideoPrimaries_Unknown = 0,
- DXVA_VideoPrimaries_reserved = 1,
- DXVA_VideoPrimaries_BT709 = 2,
- DXVA_VideoPrimaries_BT470_2_SysM = 3,
- DXVA_VideoPrimaries_BT470_2_SysBG = 4,
- DXVA_VideoPrimaries_SMPTE170M = 5,
- DXVA_VideoPrimaries_SMPTE240M = 6,
- DXVA_VideoPrimaries_EBU3213 = 7,
- DXVA_VideoPrimaries_SMPTE_C = 8
- } DXVA_VideoPrimaries;
-
- typedef enum _DXVA_VideoLighting
- {
- DXVA_VideoLightingShift = (DXVA_ExtColorData_ShiftBase + 10),
- DXVA_VideoLightingMask = DXVAColorMask(4, DXVA_VideoLightingShift),
-
- DXVA_VideoLighting_Unknown = 0,
- DXVA_VideoLighting_bright = 1,
- DXVA_VideoLighting_office = 2,
- DXVA_VideoLighting_dim = 3,
- DXVA_VideoLighting_dark = 4
- } DXVA_VideoLighting;
-
- typedef enum _DXVA_VideoTransferMatrix
- {
- DXVA_VideoTransferMatrixShift = (DXVA_ExtColorData_ShiftBase + 7),
- DXVA_VideoTransferMatrixMask = DXVAColorMask(3, DXVA_VideoTransferMatrixShift),
-
- DXVA_VideoTransferMatrix_Unknown = 0,
- DXVA_VideoTransferMatrix_BT709 = 1,
- DXVA_VideoTransferMatrix_BT601 = 2,
- DXVA_VideoTransferMatrix_SMPTE240M = 3
- } DXVA_VideoTransferMatrix;
-
- typedef enum _DXVA_NominalRange
- {
- DXVA_NominalRangeShift = (DXVA_ExtColorData_ShiftBase + 4),
- DXVA_NominalRangeMask = DXVAColorMask(3, DXVA_NominalRangeShift),
-
- DXVA_NominalRange_Unknown = 0,
- DXVA_NominalRange_Normal = 1,
- DXVA_NominalRange_Wide = 2,
-
- DXVA_NominalRange_0_255 = 1,
- DXVA_NominalRange_16_235 = 2,
- DXVA_NominalRange_48_208 = 3
- } DXVA_NominalRange;
-
-
- typedef enum _DXVA_VideoChromaSubsampling
- {
- DXVA_VideoChromaSubsamplingShift = (DXVA_ExtColorData_ShiftBase + 0),
- DXVA_VideoChromaSubsamplingMask = DXVAColorMask(4, DXVA_VideoChromaSubsamplingShift),
-
- DXVA_VideoChromaSubsampling_Unknown = 0,
- DXVA_VideoChromaSubsampling_ProgressiveChroma = 0x8,
- DXVA_VideoChromaSubsampling_Horizontally_Cosited = 0x4,
- DXVA_VideoChromaSubsampling_Vertically_Cosited = 0x2,
- DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes = 0x1,
-
- // 4:2:0 variations
- DXVA_VideoChromaSubsampling_MPEG2 = DXVA_VideoChromaSubsampling_Horizontally_Cosited |
- DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
-
- DXVA_VideoChromaSubsampling_MPEG1 = DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
-
- DXVA_VideoChromaSubsampling_DV_PAL = DXVA_VideoChromaSubsampling_Horizontally_Cosited |
- DXVA_VideoChromaSubsampling_Vertically_Cosited,
- // 4:4:4, 4:2:2, 4:1:1
- DXVA_VideoChromaSubsampling_Cosited = DXVA_VideoChromaSubsampling_Horizontally_Cosited |
- DXVA_VideoChromaSubsampling_Vertically_Cosited |
- DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
- } DXVA_VideoChromaSubsampling;
-
- typedef struct _DXVA_ExtendedFormat
- {
- UINT SampleFormat : 8; // See DXVA_SampleFormat
- UINT VideoChromaSubsampling : 4; // See DXVA_VideoChromaSubSampling
- DXVA_NominalRange NominalRange : 3; // See DXVA_NominalRange
- DXVA_VideoTransferMatrix VideoTransferMatrix : 3; // See DXVA_VideoTransferMatrix
- DXVA_VideoLighting VideoLighting : 4; // See DXVA_VideoLighting
- DXVA_VideoPrimaries VideoPrimaries : 5; // See DXVA_VideoPrimaries
- DXVA_VideoTransferFunction VideoTransferFunction : 5; // See DXVA_VideoTransferFunction
- } DXVA_ExtendedFormat;
+typedef enum _DXVA_VideoTransferFunction
+{
+ DXVA_VideoTransFuncShift = (DXVA_ExtColorData_ShiftBase + 19),
+ DXVA_VideoTransFuncMask = DXVAColorMask(5, DXVA_VideoTransFuncShift),
+
+ DXVA_VideoTransFunc_Unknown = 0,
+ DXVA_VideoTransFunc_10 = 1,
+ DXVA_VideoTransFunc_18 = 2,
+ DXVA_VideoTransFunc_20 = 3,
+ DXVA_VideoTransFunc_22 = 4,
+ DXVA_VideoTransFunc_22_709 = 5,
+ DXVA_VideoTransFunc_22_240M = 6,
+ DXVA_VideoTransFunc_22_8bit_sRGB = 7,
+ DXVA_VideoTransFunc_28 = 8
+} DXVA_VideoTransferFunction;
+
+typedef enum _DXVA_VideoPrimaries
+{
+ DXVA_VideoPrimariesShift = (DXVA_ExtColorData_ShiftBase + 14),
+ DXVA_VideoPrimariesMask = DXVAColorMask(5, DXVA_VideoPrimariesShift),
+
+ DXVA_VideoPrimaries_Unknown = 0,
+ DXVA_VideoPrimaries_reserved = 1,
+ DXVA_VideoPrimaries_BT709 = 2,
+ DXVA_VideoPrimaries_BT470_2_SysM = 3,
+ DXVA_VideoPrimaries_BT470_2_SysBG = 4,
+ DXVA_VideoPrimaries_SMPTE170M = 5,
+ DXVA_VideoPrimaries_SMPTE240M = 6,
+ DXVA_VideoPrimaries_EBU3213 = 7,
+ DXVA_VideoPrimaries_SMPTE_C = 8
+} DXVA_VideoPrimaries;
+
+typedef enum _DXVA_VideoLighting
+{
+ DXVA_VideoLightingShift = (DXVA_ExtColorData_ShiftBase + 10),
+ DXVA_VideoLightingMask = DXVAColorMask(4, DXVA_VideoLightingShift),
+
+ DXVA_VideoLighting_Unknown = 0,
+ DXVA_VideoLighting_bright = 1,
+ DXVA_VideoLighting_office = 2,
+ DXVA_VideoLighting_dim = 3,
+ DXVA_VideoLighting_dark = 4
+} DXVA_VideoLighting;
+
+typedef enum _DXVA_VideoTransferMatrix
+{
+ DXVA_VideoTransferMatrixShift = (DXVA_ExtColorData_ShiftBase + 7),
+ DXVA_VideoTransferMatrixMask = DXVAColorMask(3, DXVA_VideoTransferMatrixShift),
+
+ DXVA_VideoTransferMatrix_Unknown = 0,
+ DXVA_VideoTransferMatrix_BT709 = 1,
+ DXVA_VideoTransferMatrix_BT601 = 2,
+ DXVA_VideoTransferMatrix_SMPTE240M = 3
+} DXVA_VideoTransferMatrix;
+
+typedef enum _DXVA_NominalRange
+{
+ DXVA_NominalRangeShift = (DXVA_ExtColorData_ShiftBase + 4),
+ DXVA_NominalRangeMask = DXVAColorMask(3, DXVA_NominalRangeShift),
+
+ DXVA_NominalRange_Unknown = 0,
+ DXVA_NominalRange_Normal = 1,
+ DXVA_NominalRange_Wide = 2,
+
+ DXVA_NominalRange_0_255 = 1,
+ DXVA_NominalRange_16_235 = 2,
+ DXVA_NominalRange_48_208 = 3
+} DXVA_NominalRange;
+
+
+typedef enum _DXVA_VideoChromaSubsampling
+{
+ DXVA_VideoChromaSubsamplingShift = (DXVA_ExtColorData_ShiftBase + 0),
+ DXVA_VideoChromaSubsamplingMask = DXVAColorMask(4, DXVA_VideoChromaSubsamplingShift),
+
+ DXVA_VideoChromaSubsampling_Unknown = 0,
+ DXVA_VideoChromaSubsampling_ProgressiveChroma = 0x8,
+ DXVA_VideoChromaSubsampling_Horizontally_Cosited = 0x4,
+ DXVA_VideoChromaSubsampling_Vertically_Cosited = 0x2,
+ DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes = 0x1,
+
+ // 4:2:0 variations
+ DXVA_VideoChromaSubsampling_MPEG2 = DXVA_VideoChromaSubsampling_Horizontally_Cosited |
+ DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
+
+ DXVA_VideoChromaSubsampling_MPEG1 = DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
+
+ DXVA_VideoChromaSubsampling_DV_PAL = DXVA_VideoChromaSubsampling_Horizontally_Cosited |
+ DXVA_VideoChromaSubsampling_Vertically_Cosited,
+ // 4:4:4, 4:2:2, 4:1:1
+ DXVA_VideoChromaSubsampling_Cosited = DXVA_VideoChromaSubsampling_Horizontally_Cosited |
+ DXVA_VideoChromaSubsampling_Vertically_Cosited |
+ DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
+} DXVA_VideoChromaSubsampling;
+
+typedef struct _DXVA_ExtendedFormat
+{
+ UINT SampleFormat : 8; // See DXVA_SampleFormat
+ UINT VideoChromaSubsampling : 4; // See DXVA_VideoChromaSubSampling
+ DXVA_NominalRange NominalRange : 3; // See DXVA_NominalRange
+ DXVA_VideoTransferMatrix VideoTransferMatrix : 3; // See DXVA_VideoTransferMatrix
+ DXVA_VideoLighting VideoLighting : 4; // See DXVA_VideoLighting
+ DXVA_VideoPrimaries VideoPrimaries : 5; // See DXVA_VideoPrimaries
+ DXVA_VideoTransferFunction VideoTransferFunction : 5; // See DXVA_VideoTransferFunction
+} DXVA_ExtendedFormat;
#endif
@@ -1239,27 +1194,26 @@ extern "C" {
#ifndef __DIRECTX_VA_DEINTERLACE__
#define __DIRECTX_VA_DEINTERLACE__
- typedef LONGLONG REFERENCE_TIME;
+typedef LONGLONG REFERENCE_TIME;
- DEFINE_GUID(DXVA_DeinterlaceBobDevice,
- 0x335aa36e, 0x7884, 0x43a4, 0x9c, 0x91, 0x7f, 0x87, 0xfa, 0xf3, 0xe3, 0x7e);
+DEFINE_GUID(DXVA_DeinterlaceBobDevice,
+ 0x335aa36e,0x7884,0x43a4,0x9c,0x91,0x7f,0x87,0xfa,0xf3,0xe3,0x7e);
- DEFINE_GUID(DXVA_DeinterlaceContainerDevice,
- 0x0e85cb93, 0x3046, 0x4ff0, 0xae, 0xcc, 0xd5, 0x8c, 0xb5, 0xf0, 0x35, 0xfd);
+DEFINE_GUID(DXVA_DeinterlaceContainerDevice,
+ 0x0e85cb93,0x3046,0x4ff0,0xae,0xcc,0xd5,0x8c,0xb5,0xf0,0x35,0xfd);
#if (DIRECT3D_VERSION < 0x0800) || !defined(DIRECT3D_VERSION)
- typedef DWORD D3DFORMAT;
- enum
- {
- D3DPOOL_DEFAULT = 0,
- D3DPOOL_MANAGED = 1,
- D3DPOOL_SYSTEMMEM = 2,
- D3DPOOL_SCRATCH = 3,
- D3DPOOL_LOCALVIDMEM = 4,
- D3DPOOL_NONLOCALVIDMEM = 5,
- D3DPOOL_FORCE_DWORD = 0x7fffffff
- };
+typedef DWORD D3DFORMAT;
+enum {
+ D3DPOOL_DEFAULT = 0,
+ D3DPOOL_MANAGED = 1,
+ D3DPOOL_SYSTEMMEM = 2,
+ D3DPOOL_SCRATCH = 3,
+ D3DPOOL_LOCALVIDMEM = 4,
+ D3DPOOL_NONLOCALVIDMEM = 5,
+ D3DPOOL_FORCE_DWORD = 0x7fffffff
+};
#endif
@@ -1268,91 +1222,86 @@ extern "C" {
// -------------------------------------------------------------------------
//
- typedef struct _DXVA_Frequency
- {
- DWORD Numerator;
- DWORD Denominator;
- } DXVA_Frequency;
-
- typedef struct _DXVA_VideoDesc
- {
- DWORD Size;
- DWORD SampleWidth;
- DWORD SampleHeight;
- DWORD SampleFormat; // also contains extend color data
- D3DFORMAT d3dFormat;
- DXVA_Frequency InputSampleFreq;
- DXVA_Frequency OutputFrameFreq;
- } DXVA_VideoDesc, *LPDXVA_VideoDesc;
-
- typedef enum _DXVA_VideoProcessCaps
- {
- DXVA_VideoProcess_None = 0x0000,
- DXVA_VideoProcess_YUV2RGB = 0x0001,
- DXVA_VideoProcess_StretchX = 0x0002,
- DXVA_VideoProcess_StretchY = 0x0004,
- DXVA_VideoProcess_AlphaBlend = 0x0008,
- DXVA_VideoProcess_SubRects = 0x0010,
- DXVA_VideoProcess_SubStreams = 0x0020,
- DXVA_VideoProcess_SubStreamsExtended = 0x0040,
- DXVA_VideoProcess_YUV2RGBExtended = 0x0080,
- DXVA_VideoProcess_AlphaBlendExtended = 0x0100
- } DXVA_VideoProcessCaps;
-
- typedef enum _DXVA_DeinterlaceTech
- {
-
- // the algorithm is unknown or proprietary
- DXVA_DeinterlaceTech_Unknown = 0x0000,
-
- // the algorithm creates the missing lines by repeating
- // the line either above or below it - this method will look very jaggy and
- // isn't recommended
- DXVA_DeinterlaceTech_BOBLineReplicate = 0x0001,
-
- // The algorithm creates the missing lines by vertically stretching each
- // video field by a factor of two by averaging two lines
- DXVA_DeinterlaceTech_BOBVerticalStretch = 0x0002,
-
- // or using a [-1, 9, 9, -1]/16 filter across four lines.
- DXVA_DeinterlaceTech_BOBVerticalStretch4Tap = 0x0100,
-
- // the pixels in the missing line are recreated by a median filtering operation
- DXVA_DeinterlaceTech_MedianFiltering = 0x0004,
-
- // the pixels in the missing line are recreated by an edge filter.
- // In this process, spatial directional filters are applied to determine
- // the orientation of edges in the picture content, and missing
- // pixels are created by filtering along (rather than across) the
- // detected edges.
- DXVA_DeinterlaceTech_EdgeFiltering = 0x0010,
-
- // the pixels in the missing line are recreated by switching on a field by
- // field basis between using either spatial or temporal interpolation
- // depending on the amount of motion.
- DXVA_DeinterlaceTech_FieldAdaptive = 0x0020,
-
- // the pixels in the missing line are recreated by switching on a pixel by pixel
- // basis between using either spatial or temporal interpolation depending on
- // the amount of motion..
- DXVA_DeinterlaceTech_PixelAdaptive = 0x0040,
-
- // Motion Vector Steering identifies objects within a sequence of video
- // fields. The missing pixels are recreated after first aligning the
- // movement axes of the individual objects in the scene to make them
- // parallel with the time axis.
- DXVA_DeinterlaceTech_MotionVectorSteered = 0x0080
-
- } DXVA_DeinterlaceTech;
-
-
- typedef struct _DXVA_VideoSample
- {
- REFERENCE_TIME rtStart;
- REFERENCE_TIME rtEnd;
- DXVA_SampleFormat SampleFormat; // only lower 8 bits used
- VOID* lpDDSSrcSurface;
- } DXVA_VideoSample, *LPDXVA_VideoSample;
+typedef struct _DXVA_Frequency {
+ DWORD Numerator;
+ DWORD Denominator;
+} DXVA_Frequency;
+
+typedef struct _DXVA_VideoDesc {
+ DWORD Size;
+ DWORD SampleWidth;
+ DWORD SampleHeight;
+ DWORD SampleFormat; // also contains extend color data
+ D3DFORMAT d3dFormat;
+ DXVA_Frequency InputSampleFreq;
+ DXVA_Frequency OutputFrameFreq;
+} DXVA_VideoDesc, *LPDXVA_VideoDesc;
+
+typedef enum _DXVA_VideoProcessCaps {
+ DXVA_VideoProcess_None = 0x0000,
+ DXVA_VideoProcess_YUV2RGB = 0x0001,
+ DXVA_VideoProcess_StretchX = 0x0002,
+ DXVA_VideoProcess_StretchY = 0x0004,
+ DXVA_VideoProcess_AlphaBlend = 0x0008,
+ DXVA_VideoProcess_SubRects = 0x0010,
+ DXVA_VideoProcess_SubStreams = 0x0020,
+ DXVA_VideoProcess_SubStreamsExtended = 0x0040,
+ DXVA_VideoProcess_YUV2RGBExtended = 0x0080,
+ DXVA_VideoProcess_AlphaBlendExtended = 0x0100
+} DXVA_VideoProcessCaps;
+
+typedef enum _DXVA_DeinterlaceTech {
+
+ // the algorithm is unknown or proprietary
+ DXVA_DeinterlaceTech_Unknown = 0x0000,
+
+ // the algorithm creates the missing lines by repeating
+ // the line either above or below it - this method will look very jaggy and
+ // isn't recommended
+ DXVA_DeinterlaceTech_BOBLineReplicate = 0x0001,
+
+ // The algorithm creates the missing lines by vertically stretching each
+ // video field by a factor of two by averaging two lines
+ DXVA_DeinterlaceTech_BOBVerticalStretch = 0x0002,
+
+ // or using a [-1, 9, 9, -1]/16 filter across four lines.
+ DXVA_DeinterlaceTech_BOBVerticalStretch4Tap = 0x0100,
+
+ // the pixels in the missing line are recreated by a median filtering operation
+ DXVA_DeinterlaceTech_MedianFiltering = 0x0004,
+
+ // the pixels in the missing line are recreated by an edge filter.
+ // In this process, spatial directional filters are applied to determine
+ // the orientation of edges in the picture content, and missing
+ // pixels are created by filtering along (rather than across) the
+ // detected edges.
+ DXVA_DeinterlaceTech_EdgeFiltering = 0x0010,
+
+ // the pixels in the missing line are recreated by switching on a field by
+ // field basis between using either spatial or temporal interpolation
+ // depending on the amount of motion.
+ DXVA_DeinterlaceTech_FieldAdaptive = 0x0020,
+
+ // the pixels in the missing line are recreated by switching on a pixel by pixel
+ // basis between using either spatial or temporal interpolation depending on
+ // the amount of motion..
+ DXVA_DeinterlaceTech_PixelAdaptive = 0x0040,
+
+ // Motion Vector Steering identifies objects within a sequence of video
+ // fields. The missing pixels are recreated after first aligning the
+ // movement axes of the individual objects in the scene to make them
+ // parallel with the time axis.
+ DXVA_DeinterlaceTech_MotionVectorSteered = 0x0080
+
+} DXVA_DeinterlaceTech;
+
+
+typedef struct _DXVA_VideoSample {
+ REFERENCE_TIME rtStart;
+ REFERENCE_TIME rtEnd;
+ DXVA_SampleFormat SampleFormat; // only lower 8 bits used
+ VOID* lpDDSSrcSurface;
+} DXVA_VideoSample, *LPDXVA_VideoSample;
@@ -1361,56 +1310,52 @@ extern "C" {
// -------------------------------------------------------------------------
//
- typedef enum _DXVA_SampleFlags
- {
- DXVA_SampleFlagsMask = DXVABit(3) | DXVABit(2) | DXVABit(1) | DXVABit(0),
+typedef enum _DXVA_SampleFlags {
+ DXVA_SampleFlagsMask = DXVABit(3)|DXVABit(2)|DXVABit(1)|DXVABit(0),
- DXVA_SampleFlag_Palette_Changed = 0x0001,
- DXVA_SampleFlag_SrcRect_Changed = 0x0002,
- DXVA_SampleFlag_DstRect_Changed = 0x0004,
- DXVA_SampleFlag_ColorData_Changed = 0x0008,
- } DXVA_SampleFlags;
+ DXVA_SampleFlag_Palette_Changed = 0x0001,
+ DXVA_SampleFlag_SrcRect_Changed = 0x0002,
+ DXVA_SampleFlag_DstRect_Changed = 0x0004,
+ DXVA_SampleFlag_ColorData_Changed = 0x0008,
+} DXVA_SampleFlags;
- typedef enum _DXVA_DestinationFlags
- {
- DXVA_DestinationFlagMask = DXVABit(3) | DXVABit(2) | DXVABit(1) | DXVABit(0),
+typedef enum _DXVA_DestinationFlags {
+ DXVA_DestinationFlagMask = DXVABit(3)|DXVABit(2)|DXVABit(1)|DXVABit(0),
- DXVA_DestinationFlag_Background_Changed = 0x0001,
- DXVA_DestinationFlag_TargetRect_Changed = 0x0002,
- DXVA_DestinationFlag_ColorData_Changed = 0x0004,
- DXVA_DestinationFlag_Alpha_Changed = 0x0008
- } DXVA_DestinationFlags;
+ DXVA_DestinationFlag_Background_Changed = 0x0001,
+ DXVA_DestinationFlag_TargetRect_Changed = 0x0002,
+ DXVA_DestinationFlag_ColorData_Changed = 0x0004,
+ DXVA_DestinationFlag_Alpha_Changed = 0x0008
+} DXVA_DestinationFlags;
- typedef struct _DXVA_VideoSample2
- {
+typedef struct _DXVA_VideoSample2 {
#ifdef _WIN64
- DWORD Size;
- DWORD Reserved;
+ DWORD Size;
+ DWORD Reserved;
#endif
- REFERENCE_TIME rtStart;
- REFERENCE_TIME rtEnd;
- DWORD SampleFormat; // cast to DXVA_ExtendedFormat, or use Extract macros
- DWORD SampleFlags;
- VOID* lpDDSSrcSurface;
- RECT rcSrc;
- RECT rcDst;
- DXVA_AYUVsample2 Palette[16];
- } DXVA_VideoSample2, *LPDXVA_VideoSample2;
-
- typedef struct _DXVA_DeinterlaceCaps
- {
- DWORD Size;
- DWORD NumPreviousOutputFrames;
- DWORD InputPool;
- DWORD NumForwardRefSamples;
- DWORD NumBackwardRefSamples;
- D3DFORMAT d3dOutputFormat;
- DXVA_VideoProcessCaps VideoProcessingCaps;
- DXVA_DeinterlaceTech DeinterlaceTechnology;
- } DXVA_DeinterlaceCaps, *LPDXVA_DeinterlaceCaps;
+ REFERENCE_TIME rtStart;
+ REFERENCE_TIME rtEnd;
+ DWORD SampleFormat; // cast to DXVA_ExtendedFormat, or use Extract macros
+ DWORD SampleFlags;
+ VOID* lpDDSSrcSurface;
+ RECT rcSrc;
+ RECT rcDst;
+ DXVA_AYUVsample2 Palette[16];
+} DXVA_VideoSample2, *LPDXVA_VideoSample2;
+
+typedef struct _DXVA_DeinterlaceCaps {
+ DWORD Size;
+ DWORD NumPreviousOutputFrames;
+ DWORD InputPool;
+ DWORD NumForwardRefSamples;
+ DWORD NumBackwardRefSamples;
+ D3DFORMAT d3dOutputFormat;
+ DXVA_VideoProcessCaps VideoProcessingCaps;
+ DXVA_DeinterlaceTech DeinterlaceTechnology;
+} DXVA_DeinterlaceCaps, *LPDXVA_DeinterlaceCaps;
@@ -1428,65 +1373,61 @@ extern "C" {
//
// These structures are used for thunking 32 bit DeinterlaceBltEx calls on
// 64 bit drivers.
-//
- typedef struct _DXVA_VideoSample32
- {
- REFERENCE_TIME rtStart;
- REFERENCE_TIME rtEnd;
- DWORD SampleFormat;
- DWORD SampleFlags;
- DWORD lpDDSSrcSurface; // 32 bit pointer size
- RECT rcSrc;
- RECT rcDst;
- DXVA_AYUVsample2 Palette[16];
- // DWORD Pad;
- // 4 bytes of padding added by the compiler to align the struct to 8 bytes.
- } DXVA_VideoSample32;
-
- typedef struct _DXVA_DeinterlaceBltEx32
- {
- DWORD Size;
- DXVA_AYUVsample2 BackgroundColor;
- RECT rcTarget;
- REFERENCE_TIME rtTarget;
- DWORD NumSourceSurfaces;
- FLOAT Alpha;
- DXVA_VideoSample32 Source[MAX_DEINTERLACE_SURFACES];
- DWORD DestinationFormat;
- DWORD DestinationFlags;
- } DXVA_DeinterlaceBltEx32;
+//
+typedef struct _DXVA_VideoSample32 {
+ REFERENCE_TIME rtStart;
+ REFERENCE_TIME rtEnd;
+ DWORD SampleFormat;
+ DWORD SampleFlags;
+ DWORD lpDDSSrcSurface; // 32 bit pointer size
+ RECT rcSrc;
+ RECT rcDst;
+ DXVA_AYUVsample2 Palette[16];
+ // DWORD Pad;
+ // 4 bytes of padding added by the compiler to align the struct to 8 bytes.
+} DXVA_VideoSample32;
+
+typedef struct _DXVA_DeinterlaceBltEx32 {
+ DWORD Size;
+ DXVA_AYUVsample2 BackgroundColor;
+ RECT rcTarget;
+ REFERENCE_TIME rtTarget;
+ DWORD NumSourceSurfaces;
+ FLOAT Alpha;
+ DXVA_VideoSample32 Source[MAX_DEINTERLACE_SURFACES];
+ DWORD DestinationFormat;
+ DWORD DestinationFlags;
+} DXVA_DeinterlaceBltEx32;
#endif
- typedef struct _DXVA_DeinterlaceBlt
- {
- DWORD Size;
- DWORD Reserved;
- REFERENCE_TIME rtTarget;
- RECT DstRect;
- RECT SrcRect;
- DWORD NumSourceSurfaces;
- FLOAT Alpha;
- DXVA_VideoSample Source[MAX_DEINTERLACE_SURFACES];
- } DXVA_DeinterlaceBlt;
+typedef struct _DXVA_DeinterlaceBlt {
+ DWORD Size;
+ DWORD Reserved;
+ REFERENCE_TIME rtTarget;
+ RECT DstRect;
+ RECT SrcRect;
+ DWORD NumSourceSurfaces;
+ FLOAT Alpha;
+ DXVA_VideoSample Source[MAX_DEINTERLACE_SURFACES];
+} DXVA_DeinterlaceBlt;
#define DXVA_DeinterlaceBltFnCode 0x01
// lpInput => DXVA_DeinterlaceBlt*
// lpOuput => NULL /* not currently used */
- typedef struct _DXVA_DeinterlaceBltEx
- {
- DWORD Size;
- DXVA_AYUVsample2 BackgroundColor;
- RECT rcTarget;
- REFERENCE_TIME rtTarget;
- DWORD NumSourceSurfaces;
- FLOAT Alpha;
- DXVA_VideoSample2 Source[MAX_DEINTERLACE_SURFACES];
- DWORD DestinationFormat;
- DWORD DestinationFlags;
- } DXVA_DeinterlaceBltEx;
+typedef struct _DXVA_DeinterlaceBltEx {
+ DWORD Size;
+ DXVA_AYUVsample2 BackgroundColor;
+ RECT rcTarget;
+ REFERENCE_TIME rtTarget;
+ DWORD NumSourceSurfaces;
+ FLOAT Alpha;
+ DXVA_VideoSample2 Source[MAX_DEINTERLACE_SURFACES];
+ DWORD DestinationFormat;
+ DWORD DestinationFlags;
+} DXVA_DeinterlaceBltEx;
#define DXVA_DeinterlaceBltExFnCode 0x02
// lpInput => DXVA_DeinterlaceBltEx*
@@ -1494,24 +1435,22 @@ extern "C" {
#define MAX_DEINTERLACE_DEVICE_GUIDS 32
- typedef struct _DXVA_DeinterlaceQueryAvailableModes
- {
- DWORD Size;
- DWORD NumGuids;
- GUID Guids[MAX_DEINTERLACE_DEVICE_GUIDS];
- } DXVA_DeinterlaceQueryAvailableModes;
+typedef struct _DXVA_DeinterlaceQueryAvailableModes {
+ DWORD Size;
+ DWORD NumGuids;
+ GUID Guids[MAX_DEINTERLACE_DEVICE_GUIDS];
+} DXVA_DeinterlaceQueryAvailableModes;
#define DXVA_DeinterlaceQueryAvailableModesFnCode 0x01
// lpInput => DXVA_VideoDesc*
// lpOuput => DXVA_DeinterlaceQueryAvailableModes*
- typedef struct _DXVA_DeinterlaceQueryModeCaps
- {
- DWORD Size;
- GUID Guid;
- DXVA_VideoDesc VideoDesc;
- } DXVA_DeinterlaceQueryModeCaps;
+typedef struct _DXVA_DeinterlaceQueryModeCaps {
+ DWORD Size;
+ GUID Guid;
+ DXVA_VideoDesc VideoDesc;
+} DXVA_DeinterlaceQueryModeCaps;
#define DXVA_DeinterlaceQueryModeCapsFnCode 0x02
// lpInput => DXVA_DeinterlaceQueryModeCaps*
@@ -1531,64 +1470,59 @@ extern "C" {
#ifndef __DIRECTX_VA_PROCAMPCONTROL__
#define __DIRECTX_VA_PROCAMPCONTROL__
- DEFINE_GUID(DXVA_ProcAmpControlDevice,
- 0x9f200913, 0x2ffd, 0x4056, 0x9f, 0x1e, 0xe1, 0xb5, 0x08, 0xf2, 0x2d, 0xcf);
+DEFINE_GUID(DXVA_ProcAmpControlDevice,
+ 0x9f200913,0x2ffd,0x4056,0x9f,0x1e,0xe1,0xb5,0x08,0xf2,0x2d,0xcf);
- typedef enum _DXVA_ProcAmpControlProp
- {
- DXVA_ProcAmp_None = 0x0000,
- DXVA_ProcAmp_Brightness = 0x0001,
- DXVA_ProcAmp_Contrast = 0x0002,
- DXVA_ProcAmp_Hue = 0x0004,
- DXVA_ProcAmp_Saturation = 0x0008
- } DXVA_ProcAmpControlProp;
+typedef enum _DXVA_ProcAmpControlProp {
+ DXVA_ProcAmp_None = 0x0000,
+ DXVA_ProcAmp_Brightness = 0x0001,
+ DXVA_ProcAmp_Contrast = 0x0002,
+ DXVA_ProcAmp_Hue = 0x0004,
+ DXVA_ProcAmp_Saturation = 0x0008
+} DXVA_ProcAmpControlProp;
- typedef struct _DXVA_ProcAmpControlCaps
- {
- DWORD Size;
- DWORD InputPool;
- D3DFORMAT d3dOutputFormat;
- DWORD ProcAmpControlProps;// see DXVA_ProcAmpControlProp
- DWORD VideoProcessingCaps;// see DXVA_VideoProcessCaps
- } DXVA_ProcAmpControlCaps, *LPDXVA_ProcAmpControlCaps;
+typedef struct _DXVA_ProcAmpControlCaps {
+ DWORD Size;
+ DWORD InputPool;
+ D3DFORMAT d3dOutputFormat;
+ DWORD ProcAmpControlProps;// see DXVA_ProcAmpControlProp
+ DWORD VideoProcessingCaps;// see DXVA_VideoProcessCaps
+} DXVA_ProcAmpControlCaps, *LPDXVA_ProcAmpControlCaps;
#define DXVA_ProcAmpControlQueryCapsFnCode 0x03
// lpInput => DXVA_VideoDesc*
// lpOuput => DXVA_ProcAmpControlCaps*
- typedef struct _DXVA_ProcAmpControlQueryRange
- {
- DWORD Size;
- DXVA_ProcAmpControlProp ProcAmpControlProp;
- DXVA_VideoDesc VideoDesc;
- } DXVA_ProcAmpControlQueryRange, *LPDXVA_ProcAmpControlQueryRange;
+typedef struct _DXVA_ProcAmpControlQueryRange {
+ DWORD Size;
+ DXVA_ProcAmpControlProp ProcAmpControlProp;
+ DXVA_VideoDesc VideoDesc;
+} DXVA_ProcAmpControlQueryRange, *LPDXVA_ProcAmpControlQueryRange;
- typedef struct _DXVA_VideoPropertyRange
- {
- FLOAT MinValue;
- FLOAT MaxValue;
- FLOAT DefaultValue;
- FLOAT StepSize;
- } DXVA_VideoPropertyRange, *LPDXVA_VideoPropertyRange;
+typedef struct _DXVA_VideoPropertyRange {
+ FLOAT MinValue;
+ FLOAT MaxValue;
+ FLOAT DefaultValue;
+ FLOAT StepSize;
+} DXVA_VideoPropertyRange, *LPDXVA_VideoPropertyRange;
#define DXVA_ProcAmpControlQueryRangeFnCode 0x04
// lpInput => DXVA_ProcAmpControlQueryRange*
// lpOuput => DXVA_VideoPropertyRange*
- typedef struct _DXVA_ProcAmpControlBlt
- {
- DWORD Size;
- RECT DstRect;
- RECT SrcRect;
- FLOAT Alpha;
- FLOAT Brightness;
- FLOAT Contrast;
- FLOAT Hue;
- FLOAT Saturation;
- } DXVA_ProcAmpControlBlt;
+typedef struct _DXVA_ProcAmpControlBlt {
+ DWORD Size;
+ RECT DstRect;
+ RECT SrcRect;
+ FLOAT Alpha;
+ FLOAT Brightness;
+ FLOAT Contrast;
+ FLOAT Hue;
+ FLOAT Saturation;
+} DXVA_ProcAmpControlBlt;
#define DXVA_ProcAmpControlBltFnCode 0x01
// lpInput => DXVA_ProcAmpControlBlt*
@@ -1610,8 +1544,8 @@ extern "C" {
#define __DIRECTX_VA_CERTOUTPUTPROTECT__
- DEFINE_GUID(DXVA_COPPDevice,
- 0xd2457add, 0x8999, 0x45ed, 0x8a, 0x8a, 0xd1, 0xaa, 0x04, 0x7b, 0xa4, 0xd5);
+DEFINE_GUID(DXVA_COPPDevice,
+ 0xd2457add,0x8999,0x45ed,0x8a,0x8a,0xd1,0xaa,0x04,0x7b,0xa4,0xd5);
// -------------------------------------------------------------------------
@@ -1633,10 +1567,9 @@ extern "C" {
// -------------------------------------------------------------------------
// COPPSequenceStart
// -------------------------------------------------------------------------
- typedef struct _DXVA_COPPSignature
- {
- UCHAR Signature[256];
- } DXVA_COPPSignature, *LPDXVA_COPPSignature;
+typedef struct _DXVA_COPPSignature {
+ UCHAR Signature[256];
+} DXVA_COPPSignature, *LPDXVA_COPPSignature;
#define DXVA_COPPSequenceStartFnCode 0x03
// lpInputData => DXVA_COPPSignature*
@@ -1647,74 +1580,68 @@ extern "C" {
// -------------------------------------------------------------------------
// COPPCommand
// -------------------------------------------------------------------------
- typedef struct _DXVA_COPPCommand
- {
- GUID macKDI; // 16 bytes
- GUID guidCommandID; // 16 bytes
- ULONG dwSequence; // 4 bytes
- ULONG cbSizeData; // 4 bytes
- UCHAR CommandData[4056]; // 4056 bytes (4056+4+4+16+16 = 4096)
- } DXVA_COPPCommand, *LPDXVA_COPPCommand;
+typedef struct _DXVA_COPPCommand {
+ GUID macKDI; // 16 bytes
+ GUID guidCommandID; // 16 bytes
+ ULONG dwSequence; // 4 bytes
+ ULONG cbSizeData; // 4 bytes
+ UCHAR CommandData[4056]; // 4056 bytes (4056+4+4+16+16 = 4096)
+} DXVA_COPPCommand, *LPDXVA_COPPCommand;
#define DXVA_COPPCommandFnCode 0x04
// lpInputData => DXVA_COPPCommand*
// lpOuputData => NULL
- DEFINE_GUID(DXVA_COPPSetProtectionLevel,
- 0x9bb9327c, 0x4eb5, 0x4727, 0x9f, 0x00, 0xb4, 0x2b, 0x09, 0x19, 0xc0, 0xda);
+DEFINE_GUID(DXVA_COPPSetProtectionLevel,
+ 0x9bb9327c,0x4eb5,0x4727,0x9f,0x00,0xb4,0x2b,0x09,0x19,0xc0,0xda);
- typedef struct _DXVA_COPPSetProtectionLevelCmdData
- {
- ULONG ProtType;
- ULONG ProtLevel;
- ULONG ExtendedInfoChangeMask;
- ULONG ExtendedInfoData;
- } DXVA_COPPSetProtectionLevelCmdData;
+typedef struct _DXVA_COPPSetProtectionLevelCmdData {
+ ULONG ProtType;
+ ULONG ProtLevel;
+ ULONG ExtendedInfoChangeMask;
+ ULONG ExtendedInfoData;
+} DXVA_COPPSetProtectionLevelCmdData;
- typedef enum _COPP_DPCP_Protection_Level
- {
- COPP_DPCP_Level0 = 0,
- COPP_DPCP_LevelMin = COPP_DPCP_Level0,
- COPP_DPCP_Level1 = 1,
- COPP_DPCP_LevelMax = COPP_DPCP_Level1,
- COPP_DPCP_ForceDWORD = 0x7fffffff
- } COPP_DPCP_Protection_Level;
+typedef enum _COPP_DPCP_Protection_Level {
+ COPP_DPCP_Level0 = 0,
+ COPP_DPCP_LevelMin = COPP_DPCP_Level0,
+ COPP_DPCP_Level1 = 1,
+ COPP_DPCP_LevelMax = COPP_DPCP_Level1,
+ COPP_DPCP_ForceDWORD = 0x7fffffff
+} COPP_DPCP_Protection_Level;
// Set the HDCP protection level - (0 - 1 DWORD, 4 bytes)
- typedef enum _COPP_HDCP_Protection_Level
- {
- COPP_HDCP_Level0 = 0,
- COPP_HDCP_LevelMin = COPP_HDCP_Level0,
- COPP_HDCP_Level1 = 1,
- COPP_HDCP_LevelMax = COPP_HDCP_Level1,
- COPP_HDCP_ForceDWORD = 0x7fffffff
- } COPP_HDCP_Protection_Level;
-
- typedef enum _COPP_CGMSA_Protection_Level
- {
- COPP_CGMSA_Disabled = 0,
- COPP_CGMSA_LevelMin = COPP_CGMSA_Disabled,
- COPP_CGMSA_CopyFreely = 1,
- COPP_CGMSA_CopyNoMore = 2,
- COPP_CGMSA_CopyOneGeneration = 3,
- COPP_CGMSA_CopyNever = 4,
- COPP_CGMSA_RedistributionControlRequired = 0x08,
- COPP_CGMSA_LevelMax = (COPP_CGMSA_RedistributionControlRequired + COPP_CGMSA_CopyNever),
- COPP_CGMSA_ForceDWORD = 0x7fffffff
- } COPP_CGMSA_Protection_Level;
-
- typedef enum _COPP_ACP_Protection_Level
- {
- COPP_ACP_Level0 = 0,
- COPP_ACP_LevelMin = COPP_ACP_Level0,
- COPP_ACP_Level1 = 1,
- COPP_ACP_Level2 = 2,
- COPP_ACP_Level3 = 3,
- COPP_ACP_LevelMax = COPP_ACP_Level3,
- COPP_ACP_ForceDWORD = 0x7fffffff
- } COPP_ACP_Protection_Level;
+typedef enum _COPP_HDCP_Protection_Level {
+ COPP_HDCP_Level0 = 0,
+ COPP_HDCP_LevelMin = COPP_HDCP_Level0,
+ COPP_HDCP_Level1 = 1,
+ COPP_HDCP_LevelMax = COPP_HDCP_Level1,
+ COPP_HDCP_ForceDWORD = 0x7fffffff
+} COPP_HDCP_Protection_Level;
+
+typedef enum _COPP_CGMSA_Protection_Level {
+ COPP_CGMSA_Disabled = 0,
+ COPP_CGMSA_LevelMin = COPP_CGMSA_Disabled,
+ COPP_CGMSA_CopyFreely = 1,
+ COPP_CGMSA_CopyNoMore = 2,
+ COPP_CGMSA_CopyOneGeneration = 3,
+ COPP_CGMSA_CopyNever = 4,
+ COPP_CGMSA_RedistributionControlRequired = 0x08,
+ COPP_CGMSA_LevelMax = (COPP_CGMSA_RedistributionControlRequired + COPP_CGMSA_CopyNever),
+ COPP_CGMSA_ForceDWORD = 0x7fffffff
+} COPP_CGMSA_Protection_Level;
+
+typedef enum _COPP_ACP_Protection_Level {
+ COPP_ACP_Level0 = 0,
+ COPP_ACP_LevelMin = COPP_ACP_Level0,
+ COPP_ACP_Level1 = 1,
+ COPP_ACP_Level2 = 2,
+ COPP_ACP_Level3 = 3,
+ COPP_ACP_LevelMax = COPP_ACP_Level3,
+ COPP_ACP_ForceDWORD = 0x7fffffff
+} COPP_ACP_Protection_Level;
#define COPP_NoProtectionLevelAvailable -1
#define COPP_DefaultProtectionLevel 0
@@ -1724,138 +1651,127 @@ extern "C" {
// Bit flags of possible protection types. Note that it is possible to apply
// different protection settings to a single connector.
//
- enum
- {
- COPP_ProtectionType_Unknown = 0x80000000,
- COPP_ProtectionType_None = 0x00000000,
- COPP_ProtectionType_HDCP = 0x00000001,
- COPP_ProtectionType_ACP = 0x00000002,
- COPP_ProtectionType_CGMSA = 0x00000004,
- COPP_ProtectionType_DPCP = 0x00000010,
- COPP_ProtectionType_Mask = 0x80000017,
- COPP_ProtectionType_Reserved = 0x7FFFFFF8
- };
+enum {
+ COPP_ProtectionType_Unknown = 0x80000000,
+ COPP_ProtectionType_None = 0x00000000,
+ COPP_ProtectionType_HDCP = 0x00000001,
+ COPP_ProtectionType_ACP = 0x00000002,
+ COPP_ProtectionType_CGMSA = 0x00000004,
+ COPP_ProtectionType_DPCP = 0x00000010,
+ COPP_ProtectionType_Mask = 0x80000017,
+ COPP_ProtectionType_Reserved = 0x7FFFFFF8
+};
- DEFINE_GUID(DXVA_COPPSetSignaling,
- 0x9a631a5, 0xd684, 0x4c60, 0x8e, 0x4d, 0xd3, 0xbb, 0xf, 0xb, 0xe3, 0xee);
-
- typedef struct _DXVA_COPPSetSignalingCmdData
- {
- ULONG ActiveTVProtectionStandard; // See COPP_TVProtectionStandard
- ULONG AspectRatioChangeMask1;
- ULONG AspectRatioData1; // See COPP_ImageAspectRatio_EN300294 for ETSI EN 300 294 values
- ULONG AspectRatioChangeMask2;
- ULONG AspectRatioData2;
- ULONG AspectRatioChangeMask3;
- ULONG AspectRatioData3;
- ULONG ExtendedInfoChangeMask[4];
- ULONG ExtendedInfoData[4];
- ULONG Reserved;
- } DXVA_COPPSetSignalingCmdData;
+DEFINE_GUID(DXVA_COPPSetSignaling,
+ 0x9a631a5, 0xd684, 0x4c60, 0x8e, 0x4d, 0xd3, 0xbb, 0xf, 0xb, 0xe3, 0xee);
+
+typedef struct _DXVA_COPPSetSignalingCmdData {
+ ULONG ActiveTVProtectionStandard; // See COPP_TVProtectionStandard
+ ULONG AspectRatioChangeMask1;
+ ULONG AspectRatioData1; // See COPP_ImageAspectRatio_EN300294 for ETSI EN 300 294 values
+ ULONG AspectRatioChangeMask2;
+ ULONG AspectRatioData2;
+ ULONG AspectRatioChangeMask3;
+ ULONG AspectRatioData3;
+ ULONG ExtendedInfoChangeMask[4];
+ ULONG ExtendedInfoData[4];
+ ULONG Reserved;
+} DXVA_COPPSetSignalingCmdData;
// Add format enum and data enum
- typedef enum _COPP_TVProtectionStandard
- {
- COPP_ProtectionStandard_Unknown = 0x80000000,
- COPP_ProtectionStandard_None = 0x00000000,
- COPP_ProtectionStandard_IEC61880_525i = 0x00000001,
- COPP_ProtectionStandard_IEC61880_2_525i = 0x00000002,
- COPP_ProtectionStandard_IEC62375_625p = 0x00000004,
- COPP_ProtectionStandard_EIA608B_525 = 0x00000008,
- COPP_ProtectionStandard_EN300294_625i = 0x00000010,
- COPP_ProtectionStandard_CEA805A_TypeA_525p = 0x00000020,
- COPP_ProtectionStandard_CEA805A_TypeA_750p = 0x00000040,
- COPP_ProtectionStandard_CEA805A_TypeA_1125i = 0x00000080,
- COPP_ProtectionStandard_CEA805A_TypeB_525p = 0x00000100,
- COPP_ProtectionStandard_CEA805A_TypeB_750p = 0x00000200,
- COPP_ProtectionStandard_CEA805A_TypeB_1125i = 0x00000400,
- COPP_ProtectionStandard_ARIBTRB15_525i = 0x00000800,
- COPP_ProtectionStandard_ARIBTRB15_525p = 0x00001000,
- COPP_ProtectionStandard_ARIBTRB15_750p = 0x00002000,
- COPP_ProtectionStandard_ARIBTRB15_1125i = 0x00004000,
- COPP_ProtectionStandard_Mask = 0x80007FFF,
- COPP_ProtectionStandard_Reserved = 0x7FFF8000
- } COPP_TVProtectionStandard;
+typedef enum _COPP_TVProtectionStandard {
+ COPP_ProtectionStandard_Unknown = 0x80000000,
+ COPP_ProtectionStandard_None = 0x00000000,
+ COPP_ProtectionStandard_IEC61880_525i = 0x00000001,
+ COPP_ProtectionStandard_IEC61880_2_525i = 0x00000002,
+ COPP_ProtectionStandard_IEC62375_625p = 0x00000004,
+ COPP_ProtectionStandard_EIA608B_525 = 0x00000008,
+ COPP_ProtectionStandard_EN300294_625i = 0x00000010,
+ COPP_ProtectionStandard_CEA805A_TypeA_525p = 0x00000020,
+ COPP_ProtectionStandard_CEA805A_TypeA_750p = 0x00000040,
+ COPP_ProtectionStandard_CEA805A_TypeA_1125i = 0x00000080,
+ COPP_ProtectionStandard_CEA805A_TypeB_525p = 0x00000100,
+ COPP_ProtectionStandard_CEA805A_TypeB_750p = 0x00000200,
+ COPP_ProtectionStandard_CEA805A_TypeB_1125i = 0x00000400,
+ COPP_ProtectionStandard_ARIBTRB15_525i = 0x00000800,
+ COPP_ProtectionStandard_ARIBTRB15_525p = 0x00001000,
+ COPP_ProtectionStandard_ARIBTRB15_750p = 0x00002000,
+ COPP_ProtectionStandard_ARIBTRB15_1125i = 0x00004000,
+ COPP_ProtectionStandard_Mask = 0x80007FFF,
+ COPP_ProtectionStandard_Reserved = 0x7FFF8000
+} COPP_TVProtectionStandard;
#define COPP_ImageAspectRatio_EN300294_Mask 0x00000007
- typedef enum _COPP_ImageAspectRatio_EN300294
- {
- COPP_AspectRatio_EN300294_FullFormat4by3 = 0,
- COPP_AspectRatio_EN300294_Box14by9Center = 1,
- COPP_AspectRatio_EN300294_Box14by9Top = 2,
- COPP_AspectRatio_EN300294_Box16by9Center = 3,
- COPP_AspectRatio_EN300294_Box16by9Top = 4,
- COPP_AspectRatio_EN300294_BoxGT16by9Center = 5,
- COPP_AspectRatio_EN300294_FullFormat4by3ProtectedCenter = 6,
- COPP_AspectRatio_EN300294_FullFormat16by9Anamorphic = 7,
- COPP_AspectRatio_ForceDWORD = 0x7fffffff
- } COPP_ImageAspectRatio_EN300294;
+typedef enum _COPP_ImageAspectRatio_EN300294 {
+ COPP_AspectRatio_EN300294_FullFormat4by3 = 0,
+ COPP_AspectRatio_EN300294_Box14by9Center = 1,
+ COPP_AspectRatio_EN300294_Box14by9Top = 2,
+ COPP_AspectRatio_EN300294_Box16by9Center = 3,
+ COPP_AspectRatio_EN300294_Box16by9Top = 4,
+ COPP_AspectRatio_EN300294_BoxGT16by9Center = 5,
+ COPP_AspectRatio_EN300294_FullFormat4by3ProtectedCenter = 6,
+ COPP_AspectRatio_EN300294_FullFormat16by9Anamorphic = 7,
+ COPP_AspectRatio_ForceDWORD = 0x7fffffff
+} COPP_ImageAspectRatio_EN300294;
// -------------------------------------------------------------------------
// COPPQueryStatus
// -------------------------------------------------------------------------
- typedef struct _DXVA_COPPStatusInput
- {
- GUID rApp; // 16 bytes
- GUID guidStatusRequestID;// 16 bytes
- ULONG dwSequence; // 4 bytes
- ULONG cbSizeData; // 4 bytes
- UCHAR StatusData[4056]; // 4056 bytes (4056+4+4+16+16 = 4096)
- } DXVA_COPPStatusInput, *LPDXVA_COPPStatusInput;
-
- typedef struct _DXVA_COPPStatusOutput
- {
- GUID macKDI; // 16 bytes
- ULONG cbSizeData; // 4 bytes
- UCHAR COPPStatus[4076]; // 4076 bytes (4076+16+4 = 4096)
- } DXVA_COPPStatusOutput, *LPDXVA_COPPStatusOutput;
-
- typedef enum _COPP_StatusFlags
- {
- COPP_StatusNormal = 0x00,
- COPP_LinkLost = 0x01,
- COPP_RenegotiationRequired = 0x02,
- COPP_StatusFlagsReserved = 0xFFFFFFFC
- } COPP_StatusFlags;
-
- typedef struct _DXVA_COPPStatusData
- {
- GUID rApp;
- ULONG dwFlags; // See COPP_StatusFlags above
- ULONG dwData;
- ULONG ExtendedInfoValidMask;
- ULONG ExtendedInfoData;
- } DXVA_COPPStatusData;
-
- typedef struct _DXVA_COPPStatusDisplayData
- {
- GUID rApp;
- ULONG dwFlags; // See COPP_StatusFlags above
- ULONG DisplayWidth;
- ULONG DisplayHeight;
- ULONG Format; // also contains extended color data
- ULONG d3dFormat;
- ULONG FreqNumerator;
- ULONG FreqDenominator;
- } DXVA_COPPStatusDisplayData;
-
- typedef enum _COPP_StatusHDCPFlags
- {
- COPP_HDCPRepeater = 0x01,
- COPP_HDCPFlagsReserved = 0xFFFFFFFE
- } COPP_StatusHDCPFlags;
-
- typedef struct _DXVA_COPPStatusHDCPKeyData
- {
- GUID rApp;
- ULONG dwFlags; // See COPP_StatusFlags above
- ULONG dwHDCPFlags; // See COPP_StatusHDCPFlags above
- GUID BKey; // Lower 40 bits
- GUID Reserved1;
- GUID Reserved2;
- } DXVA_COPPStatusHDCPKeyData;
+typedef struct _DXVA_COPPStatusInput {
+ GUID rApp; // 16 bytes
+ GUID guidStatusRequestID;// 16 bytes
+ ULONG dwSequence; // 4 bytes
+ ULONG cbSizeData; // 4 bytes
+ UCHAR StatusData[4056]; // 4056 bytes (4056+4+4+16+16 = 4096)
+} DXVA_COPPStatusInput, *LPDXVA_COPPStatusInput;
+
+typedef struct _DXVA_COPPStatusOutput {
+ GUID macKDI; // 16 bytes
+ ULONG cbSizeData; // 4 bytes
+ UCHAR COPPStatus[4076]; // 4076 bytes (4076+16+4 = 4096)
+} DXVA_COPPStatusOutput, *LPDXVA_COPPStatusOutput;
+
+typedef enum _COPP_StatusFlags {
+ COPP_StatusNormal = 0x00,
+ COPP_LinkLost = 0x01,
+ COPP_RenegotiationRequired = 0x02,
+ COPP_StatusFlagsReserved = 0xFFFFFFFC
+} COPP_StatusFlags;
+
+typedef struct _DXVA_COPPStatusData {
+ GUID rApp;
+ ULONG dwFlags; // See COPP_StatusFlags above
+ ULONG dwData;
+ ULONG ExtendedInfoValidMask;
+ ULONG ExtendedInfoData;
+} DXVA_COPPStatusData;
+
+typedef struct _DXVA_COPPStatusDisplayData {
+ GUID rApp;
+ ULONG dwFlags; // See COPP_StatusFlags above
+ ULONG DisplayWidth;
+ ULONG DisplayHeight;
+ ULONG Format; // also contains extended color data
+ ULONG d3dFormat;
+ ULONG FreqNumerator;
+ ULONG FreqDenominator;
+} DXVA_COPPStatusDisplayData;
+
+typedef enum _COPP_StatusHDCPFlags {
+ COPP_HDCPRepeater = 0x01,
+ COPP_HDCPFlagsReserved = 0xFFFFFFFE
+} COPP_StatusHDCPFlags;
+
+typedef struct _DXVA_COPPStatusHDCPKeyData {
+ GUID rApp;
+ ULONG dwFlags; // See COPP_StatusFlags above
+ ULONG dwHDCPFlags; // See COPP_StatusHDCPFlags above
+ GUID BKey; // Lower 40 bits
+ GUID Reserved1;
+ GUID Reserved2;
+} DXVA_COPPStatusHDCPKeyData;
#define DXVA_COPPQueryStatusFnCode 0x05
@@ -1866,78 +1782,75 @@ extern "C" {
//
// Status GUID and enumerations
//
- DEFINE_GUID(DXVA_COPPQueryConnectorType,
- 0x81d0bfd5, 0x6afe, 0x48c2, 0x99, 0xc0, 0x95, 0xa0, 0x8f, 0x97, 0xc5, 0xda);
-
- typedef enum _COPP_ConnectorType
- {
- COPP_ConnectorType_Unknown = -1,
- COPP_ConnectorType_VGA = 0,
- COPP_ConnectorType_SVideo = 1,
- COPP_ConnectorType_CompositeVideo = 2,
- COPP_ConnectorType_ComponentVideo = 3,
- COPP_ConnectorType_DVI = 4,
- COPP_ConnectorType_HDMI = 5,
- COPP_ConnectorType_LVDS = 6,
- COPP_ConnectorType_TMDS = 7,
- COPP_ConnectorType_D_JPN = 8,
- COPP_ConnectorType_SDI = 9,
- COPP_ConnectorType_DisplayPortExternal = 10,
- COPP_ConnectorType_DisplayPortEmbedded = 11,
- COPP_ConnectorType_UDIExternal = 12,
- COPP_ConnectorType_UDIEmbedded = 13,
- COPP_ConnectorType_Internal = 0x80000000, // can be combined with the other connector types
- COPP_ConnectorType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */
- } COPP_ConnectorType;
-
- DEFINE_GUID(DXVA_COPPQueryProtectionType,
- 0x38f2a801, 0x9a6c, 0x48bb, 0x91, 0x07, 0xb6, 0x69, 0x6e, 0x6f, 0x17, 0x97);
-
- DEFINE_GUID(DXVA_COPPQueryLocalProtectionLevel,
- 0xb2075857, 0x3eda, 0x4d5d, 0x88, 0xdb, 0x74, 0x8f, 0x8c, 0x1a, 0x05, 0x49);
-
- DEFINE_GUID(DXVA_COPPQueryGlobalProtectionLevel,
- 0x1957210a, 0x7766, 0x452a, 0xb9, 0x9a, 0xd2, 0x7a, 0xed, 0x54, 0xf0, 0x3a);
-
- DEFINE_GUID(DXVA_COPPQueryDisplayData,
- 0xd7bf1ba3, 0xad13, 0x4f8e, 0xaf, 0x98, 0x0d, 0xcb, 0x3c, 0xa2, 0x04, 0xcc);
-
- DEFINE_GUID(DXVA_COPPQueryHDCPKeyData,
- 0xdb59d74, 0xa992, 0x492e, 0xa0, 0xbd, 0xc2, 0x3f, 0xda, 0x56, 0x4e, 0x0);
-
- DEFINE_GUID(DXVA_COPPQueryBusData,
- 0xc6f4d673, 0x6174, 0x4184, 0x8e, 0x35, 0xf6, 0xdb, 0x52, 0x0, 0xbc, 0xba);
-
- typedef enum _COPP_BusType
- {
- COPP_BusType_Unknown = 0,
- COPP_BusType_PCI = 1,
- COPP_BusType_PCIX = 2,
- COPP_BusType_PCIExpress = 3,
- COPP_BusType_AGP = 4,
- COPP_BusType_Integrated = 0x80000000, // can be combined with the other bus types
- COPP_BusType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */
- } COPP_BusType;
-
- DEFINE_GUID(DXVA_COPPQuerySignaling,
- 0x6629a591, 0x3b79, 0x4cf3, 0x92, 0x4a, 0x11, 0xe8, 0xe7, 0x81, 0x16, 0x71);
-
- typedef struct _DXVA_COPPStatusSignalingCmdData
- {
- GUID rApp;
- ULONG dwFlags; // See COPP_StatusFlags above
- ULONG AvailableTVProtectionStandards; // See COPP_TVProtectionStandard
- ULONG ActiveTVProtectionStandard; // See COPP_TVProtectionStandard
- ULONG TVType;
- ULONG AspectRatioValidMask1;
- ULONG AspectRatioData1; // See COPP_AspectRatio_EN300294 for ETSI EN 300 294 values
- ULONG AspectRatioValidMask2;
- ULONG AspectRatioData2;
- ULONG AspectRatioValidMask3;
- ULONG AspectRatioData3;
- ULONG ExtendedInfoValidMask[4];
- ULONG ExtendedInfoData[4];
- } DXVA_COPPStatusSignalingCmdData;
+DEFINE_GUID(DXVA_COPPQueryConnectorType,
+ 0x81d0bfd5,0x6afe,0x48c2,0x99,0xc0,0x95,0xa0,0x8f,0x97,0xc5,0xda);
+
+typedef enum _COPP_ConnectorType {
+ COPP_ConnectorType_Unknown = -1,
+ COPP_ConnectorType_VGA = 0,
+ COPP_ConnectorType_SVideo = 1,
+ COPP_ConnectorType_CompositeVideo = 2,
+ COPP_ConnectorType_ComponentVideo = 3,
+ COPP_ConnectorType_DVI = 4,
+ COPP_ConnectorType_HDMI = 5,
+ COPP_ConnectorType_LVDS = 6,
+ COPP_ConnectorType_TMDS = 7,
+ COPP_ConnectorType_D_JPN = 8,
+ COPP_ConnectorType_SDI = 9,
+ COPP_ConnectorType_DisplayPortExternal = 10,
+ COPP_ConnectorType_DisplayPortEmbedded = 11,
+ COPP_ConnectorType_UDIExternal = 12,
+ COPP_ConnectorType_UDIEmbedded = 13,
+ COPP_ConnectorType_Internal = 0x80000000, // can be combined with the other connector types
+ COPP_ConnectorType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */
+} COPP_ConnectorType;
+
+DEFINE_GUID(DXVA_COPPQueryProtectionType,
+ 0x38f2a801,0x9a6c,0x48bb,0x91,0x07,0xb6,0x69,0x6e,0x6f,0x17,0x97);
+
+DEFINE_GUID(DXVA_COPPQueryLocalProtectionLevel,
+ 0xb2075857,0x3eda,0x4d5d,0x88,0xdb,0x74,0x8f,0x8c,0x1a,0x05,0x49);
+
+DEFINE_GUID(DXVA_COPPQueryGlobalProtectionLevel,
+ 0x1957210a,0x7766,0x452a,0xb9,0x9a,0xd2,0x7a,0xed,0x54,0xf0,0x3a);
+
+DEFINE_GUID(DXVA_COPPQueryDisplayData,
+ 0xd7bf1ba3,0xad13,0x4f8e,0xaf,0x98,0x0d,0xcb,0x3c,0xa2,0x04,0xcc);
+
+DEFINE_GUID(DXVA_COPPQueryHDCPKeyData,
+ 0xdb59d74, 0xa992, 0x492e, 0xa0, 0xbd, 0xc2, 0x3f, 0xda, 0x56, 0x4e, 0x0);
+
+DEFINE_GUID(DXVA_COPPQueryBusData,
+ 0xc6f4d673, 0x6174, 0x4184, 0x8e, 0x35, 0xf6, 0xdb, 0x52, 0x0, 0xbc, 0xba);
+
+typedef enum _COPP_BusType {
+ COPP_BusType_Unknown = 0,
+ COPP_BusType_PCI = 1,
+ COPP_BusType_PCIX = 2,
+ COPP_BusType_PCIExpress = 3,
+ COPP_BusType_AGP = 4,
+ COPP_BusType_Integrated = 0x80000000, // can be combined with the other bus types
+ COPP_BusType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */
+} COPP_BusType;
+
+DEFINE_GUID(DXVA_COPPQuerySignaling,
+ 0x6629a591, 0x3b79, 0x4cf3, 0x92, 0x4a, 0x11, 0xe8, 0xe7, 0x81, 0x16, 0x71);
+
+typedef struct _DXVA_COPPStatusSignalingCmdData {
+ GUID rApp;
+ ULONG dwFlags; // See COPP_StatusFlags above
+ ULONG AvailableTVProtectionStandards; // See COPP_TVProtectionStandard
+ ULONG ActiveTVProtectionStandard; // See COPP_TVProtectionStandard
+ ULONG TVType;
+ ULONG AspectRatioValidMask1;
+ ULONG AspectRatioData1; // See COPP_AspectRatio_EN300294 for ETSI EN 300 294 values
+ ULONG AspectRatioValidMask2;
+ ULONG AspectRatioData2;
+ ULONG AspectRatioValidMask3;
+ ULONG AspectRatioData3;
+ ULONG ExtendedInfoValidMask[4];
+ ULONG ExtendedInfoData[4];
+} DXVA_COPPStatusSignalingCmdData;
#endif /* __DIRECTX_VA_CERTOUTPUTPROTECT__ */
@@ -1946,19 +1859,19 @@ extern "C" {
}
#endif
-#ifdef __DXVA1_DEPRECATED_INTERFACES__
+#ifdef __DXVA1_DEPRECATED_INTERFACES__
#if !defined(__cplusplus)
#error C++ compiler required.
#endif
/* IID_IDirect3DVideoDevice9 */
-DEFINE_GUID(IID_IDirect3DVideoDevice9,
- 0x694036ac, 0x542a, 0x4a3a, 0x9a, 0x32, 0x53, 0xbc, 0x20, 0x0, 0x2c, 0x1b);
+DEFINE_GUID(IID_IDirect3DVideoDevice9,
+0x694036ac, 0x542a, 0x4a3a, 0x9a, 0x32, 0x53, 0xbc, 0x20, 0x0, 0x2c, 0x1b);
/* IID_IDirect3DDXVADevice9 */
-DEFINE_GUID(IID_IDirect3DDXVADevice9,
- 0x9f00c3d3, 0x5ab6, 0x465f, 0xb9, 0x55, 0x9f, 0xe, 0xbb, 0x2c, 0x56, 0x6);
+DEFINE_GUID(IID_IDirect3DDXVADevice9,
+0x9f00c3d3, 0x5ab6, 0x465f, 0xb9, 0x55, 0x9f, 0xe, 0xbb, 0x2c, 0x56, 0x6);
interface IDirect3DVideoDevice9;
interface IDirect3DDXVADevice9;
@@ -1995,28 +1908,28 @@ DECLARE_INTERFACE_(IDirect3DVideoDevice9, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DVideoDevice9 methods ***/
- STDMETHOD(CreateSurface)(THIS_ UINT Width, UINT Height, UINT BackBuffers,
- D3DFORMAT Format, D3DPOOL Pool, DWORD Usage,
+ STDMETHOD(CreateSurface)(THIS_ UINT Width,UINT Height,UINT BackBuffers,
+ D3DFORMAT Format,D3DPOOL Pool,DWORD Usage,
IDirect3DSurface9** ppSurface,
- HANDLE * pSharedHandle) PURE;
- STDMETHOD(GetDXVACompressedBufferInfo)(THIS_ GUID * pGuid,
- DXVAUncompDataInfo * pUncompData,
- DWORD * pNumBuffers,
- DXVACompBufferInfo * pBufferInfo) PURE;
- STDMETHOD(GetDXVAGuids)(THIS_ DWORD * pNumGuids, GUID * pGuids) PURE;
- STDMETHOD(GetDXVAInternalInfo)(THIS_ GUID * pGuid,
- DXVAUncompDataInfo * pUncompData,
- DWORD * pMemoryUsed) PURE;
- STDMETHOD(GetUncompressedDXVAFormats)(THIS_ GUID * pGuid,
- DWORD * pNumFormats,
- D3DFORMAT * pFormats) PURE;
- STDMETHOD(CreateDXVADevice)(THIS_ GUID * pGuid,
- DXVAUncompDataInfo * pUncompData,
- LPVOID pData, DWORD DataSize,
+ HANDLE* pSharedHandle) PURE;
+ STDMETHOD(GetDXVACompressedBufferInfo)(THIS_ GUID* pGuid,
+ DXVAUncompDataInfo* pUncompData,
+ DWORD* pNumBuffers,
+ DXVACompBufferInfo* pBufferInfo) PURE;
+ STDMETHOD(GetDXVAGuids)(THIS_ DWORD* pNumGuids,GUID* pGuids) PURE;
+ STDMETHOD(GetDXVAInternalInfo)(THIS_ GUID* pGuid,
+ DXVAUncompDataInfo* pUncompData,
+ DWORD* pMemoryUsed) PURE;
+ STDMETHOD(GetUncompressedDXVAFormats)(THIS_ GUID* pGuid,
+ DWORD* pNumFormats,
+ D3DFORMAT* pFormats) PURE;
+ STDMETHOD(CreateDXVADevice)(THIS_ GUID* pGuid,
+ DXVAUncompDataInfo* pUncompData,
+ LPVOID pData,DWORD DataSize,
IDirect3DDXVADevice9** ppDXVADevice) PURE;
};
@@ -2027,21 +1940,21 @@ DECLARE_INTERFACE_(IDirect3DDXVADevice9, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirect3DDXVADevice9 methods ***/
- STDMETHOD(BeginFrame)(THIS_ IDirect3DSurface9 * pDstSurface,
- DWORD SizeInputData, VOID * pInputData,
- DWORD * pSizeOutputData, VOID * pOutputData) PURE;
- STDMETHOD(EndFrame)(THIS_ DWORD SizeMiscData, VOID * pMiscData) PURE;
- STDMETHOD(Execute)(THIS_ DWORD FunctionNum, VOID * pInputData,
- DWORD InputSize, VOID * OuputData, DWORD OutputSize,
- DWORD NumBuffers, DXVABufferInfo * pBufferInfo) PURE;
- STDMETHOD(QueryStatus)(THIS_ IDirect3DSurface9 * pSurface, DWORD Flags) PURE;
+ STDMETHOD(BeginFrame)(THIS_ IDirect3DSurface9* pDstSurface,
+ DWORD SizeInputData,VOID* pInputData,
+ DWORD* pSizeOutputData,VOID* pOutputData) PURE;
+ STDMETHOD(EndFrame)(THIS_ DWORD SizeMiscData,VOID* pMiscData) PURE;
+ STDMETHOD(Execute)(THIS_ DWORD FunctionNum,VOID* pInputData,
+ DWORD InputSize,VOID* OuputData,DWORD OutputSize,
+ DWORD NumBuffers,DXVABufferInfo* pBufferInfo) PURE;
+ STDMETHOD(QueryStatus)(THIS_ IDirect3DSurface9* pSurface,DWORD Flags) PURE;
};
-#endif /* __DXVA1_DEPRECATED_INTERFACES__ */
+#endif /* __DXVA1_DEPRECATED_INTERFACES__ */
#if _MSC_VER >= 1200
#pragma warning(pop)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec.c
index 0f7864743..79f3c3b49 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec.c
@@ -54,9 +54,8 @@
#include "eac3dec_data.h"
/** gain adaptive quantization mode */
-typedef enum
-{
- EAC3_GAQ_NO = 0,
+typedef enum {
+ EAC3_GAQ_NO =0,
EAC3_GAQ_12,
EAC3_GAQ_14,
EAC3_GAQ_124
@@ -67,7 +66,7 @@ typedef enum
void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
{
int bin, bnd, ch, i;
- uint8_t wrapflag[SPX_MAX_BANDS] = {0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
+ uint8_t wrapflag[SPX_MAX_BANDS]={0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
float rms_energy[SPX_MAX_BANDS];
/* Set copy index mapping table. Set wrap flags to apply a notch filter at
@@ -75,20 +74,16 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
wrapflag[0] = 1;
bin = s->spx_copy_start_freq;
num_copy_sections = 0;
- for(bnd = 0; bnd < s->num_spx_bands; bnd++)
- {
+ for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
int copysize;
int bandsize = s->spx_band_sizes[bnd];
- if((bin + bandsize) > s->spx_start_freq)
- {
+ if ((bin + bandsize) > s->spx_start_freq) {
copy_sizes[num_copy_sections++] = bin - s->spx_copy_start_freq;
bin = s->spx_copy_start_freq;
wrapflag[bnd] = 1;
}
- for(i = 0; i < bandsize; i += copysize)
- {
- if(bin == s->spx_start_freq)
- {
+ for (i = 0; i < bandsize; i += copysize) {
+ if (bin == s->spx_start_freq) {
copy_sizes[num_copy_sections++] = bin - s->spx_copy_start_freq;
bin = s->spx_copy_start_freq;
}
@@ -98,15 +93,13 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
}
copy_sizes[num_copy_sections++] = bin - s->spx_copy_start_freq;
- for(ch = 1; ch <= s->fbw_channels; ch++)
- {
- if(!s->channel_in_spx[ch])
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (!s->channel_in_spx[ch])
continue;
/* Copy coeffs from normal bands to extension bands */
bin = s->spx_start_freq;
- for(i = 0; i < num_copy_sections; i++)
- {
+ for (i = 0; i < num_copy_sections; i++) {
memcpy(&s->transform_coeffs[ch][bin],
&s->transform_coeffs[ch][s->spx_copy_start_freq],
copy_sizes[i]*sizeof(float));
@@ -115,12 +108,10 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
/* Calculate RMS energy for each SPX band. */
bin = s->spx_start_freq;
- for(bnd = 0; bnd < s->num_spx_bands; bnd++)
- {
+ for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
int bandsize = s->spx_band_sizes[bnd];
float accum = 0.0f;
- for(i = 0; i < bandsize; i++)
- {
+ for (i = 0; i < bandsize; i++) {
float coeff = s->transform_coeffs[ch][bin++];
accum += coeff * coeff;
}
@@ -129,14 +120,11 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
/* Apply a notch filter at transitions between normal and extension
bands and at all wrap points. */
- if(s->spx_atten_code[ch] >= 0)
- {
+ if (s->spx_atten_code[ch] >= 0) {
const float *atten_tab = ff_eac3_spx_atten_tab[s->spx_atten_code[ch]];
bin = s->spx_start_freq - 2;
- for(bnd = 0; bnd < s->num_spx_bands; bnd++)
- {
- if(wrapflag[bnd])
- {
+ for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
+ if (wrapflag[bnd]) {
float *coeffs = &s->transform_coeffs[ch][bin];
coeffs[0] *= atten_tab[0];
coeffs[1] *= atten_tab[1];
@@ -152,13 +140,11 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
calculated RMS energy, blending factors, and SPX coordinates for
each band. */
bin = s->spx_start_freq;
- for(bnd = 0; bnd < s->num_spx_bands; bnd++)
- {
+ for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd];
float sscale = s->spx_signal_blend[ch][bnd];
- for(i = 0; i < s->spx_band_sizes[bnd]; i++)
- {
- float noise = nscale * (((int)av_lfg_get(&s->dith_state)) / (float)(1 << 31));
+ for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
+ float noise = nscale * (((int)av_lfg_get(&s->dith_state))/(float)(1<<31));
s->transform_coeffs[ch][bin] *= sscale;
s->transform_coeffs[ch][bin++] += noise;
}
@@ -186,8 +172,8 @@ static void idct6(int pre_mant[6])
odd1 = pre_mant[1] - pre_mant[3] - pre_mant[5];
- even2 = (pre_mant[2] * COEFF_0) >> 23;
- tmp = (pre_mant[4] * COEFF_1) >> 23;
+ even2 = ( pre_mant[2] * COEFF_0) >> 23;
+ tmp = ( pre_mant[4] * COEFF_1) >> 23;
odd0 = ((pre_mant[1] + pre_mant[5]) * COEFF_2) >> 23;
even0 = pre_mant[0] + (tmp >> 1);
@@ -222,28 +208,20 @@ void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
/* if GAQ gain is used, decode gain codes for bins with hebap between
8 and end_bap */
gs = 0;
- if(gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14)
- {
+ if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) {
/* read 1-bit GAQ gain codes */
- for(bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++)
- {
- if(s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap)
- gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode - 1);
+ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
+ if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap)
+ gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1);
}
- }
- else if(gaq_mode == EAC3_GAQ_124)
- {
+ } else if (gaq_mode == EAC3_GAQ_124) {
/* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */
int gc = 2;
- for(bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++)
- {
- if(s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17)
- {
- if(gc++ == 2)
- {
+ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
+ if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) {
+ if (gc++ == 2) {
int group_code = get_bits(gbc, 5);
- if(group_code > 26)
- {
+ if (group_code > 26) {
av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n");
group_code = 26;
}
@@ -256,65 +234,49 @@ void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
}
}
- gs = 0;
- for(bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++)
- {
+ gs=0;
+ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
int hebap = s->bap[ch][bin];
int bits = ff_eac3_bits_vs_hebap[hebap];
- if(!hebap)
- {
+ if (!hebap) {
/* zero-mantissa dithering */
- for(blk = 0; blk < 6; blk++)
- {
+ for (blk = 0; blk < 6; blk++) {
s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
}
- }
- else if(hebap < 8)
- {
+ } else if (hebap < 8) {
/* Vector Quantization */
int v = get_bits(gbc, bits);
- for(blk = 0; blk < 6; blk++)
- {
+ for (blk = 0; blk < 6; blk++) {
s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8;
}
- }
- else
- {
+ } else {
/* Gain Adaptive Quantization */
int gbits, log_gain;
- if(gaq_mode != EAC3_GAQ_NO && hebap < end_bap)
- {
+ if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) {
log_gain = gaq_gain[gs++];
- }
- else
- {
+ } else {
log_gain = 0;
}
gbits = bits - log_gain;
- for(blk = 0; blk < 6; blk++)
- {
+ for (blk = 0; blk < 6; blk++) {
int mant = get_sbits(gbc, gbits);
- if(log_gain && mant == -(1 << (gbits - 1)))
- {
+ if (log_gain && mant == -(1 << (gbits-1))) {
/* large mantissa */
int b;
int mbits = bits - (2 - log_gain);
mant = get_sbits(gbc, mbits);
mant <<= (23 - (mbits - 1));
/* remap mantissa value to correct for asymmetric quantization */
- if(mant >= 0)
+ if (mant >= 0)
b = 1 << (23 - log_gain);
else
b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8;
mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b;
- }
- else
- {
+ } else {
/* small mantissa, no GAQ, or Gk=1 */
mant <<= 24 - bits;
- if(!log_gain)
- {
+ if (!log_gain) {
/* remap mantissa value for no GAQ or Gk=1 */
mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;
}
@@ -337,13 +299,10 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
/* An E-AC-3 stream can have multiple independent streams which the
application can select from. each independent stream can also contain
dependent streams which are used to add or replace channels. */
- if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT)
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
av_log_missing_feature(s->avctx, "Dependent substream decoding", 1);
return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
- }
- else if(s->frame_type == EAC3_FRAME_TYPE_RESERVED)
- {
+ } else if (s->frame_type == EAC3_FRAME_TYPE_RESERVED) {
av_log(s->avctx, AV_LOG_ERROR, "Reserved frame type\n");
return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
}
@@ -351,15 +310,13 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
/* The substream id indicates which substream this frame belongs to. each
independent stream has its own substream id, and the dependent streams
associated to an independent stream have matching substream id's. */
- if(s->substreamid)
- {
+ if (s->substreamid) {
/* only decode substream with id=0. skip any additional substreams. */
av_log_missing_feature(s->avctx, "Additional substreams", 1);
return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
}
- if(s->bit_alloc_params.sr_code == EAC3_SR_CODE_REDUCED)
- {
+ if (s->bit_alloc_params.sr_code == EAC3_SR_CODE_REDUCED) {
/* The E-AC-3 specification does not tell how to handle reduced sample
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
@@ -370,39 +327,31 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
skip_bits(gbc, 5); // skip bitstream id
/* volume control params */
- for(i = 0; i < (s->channel_mode ? 1 : 2); i++)
- {
+ for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
skip_bits(gbc, 5); // skip dialog normalization
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 8); // skip compression gain word
}
}
/* dependent stream channel map */
- if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT)
- {
- if(get_bits1(gbc))
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 16); // skip custom channel map
}
}
/* mixing metadata */
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
/* center and surround mix levels */
- if(s->channel_mode > AC3_CHMODE_STEREO)
- {
+ if (s->channel_mode > AC3_CHMODE_STEREO) {
skip_bits(gbc, 2); // skip preferred stereo downmix mode
- if(s->channel_mode & 1)
- {
+ if (s->channel_mode & 1) {
/* if three front channels exist */
skip_bits(gbc, 3); //skip Lt/Rt center mix level
s->center_mix_level = get_bits(gbc, 3);
}
- if(s->channel_mode & 4)
- {
+ if (s->channel_mode & 4) {
/* if a surround channel exists */
skip_bits(gbc, 3); //skip Lt/Rt surround mix level
s->surround_mix_level = get_bits(gbc, 3);
@@ -410,50 +359,36 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
}
/* lfe mix level */
- if(s->lfe_on && get_bits1(gbc))
- {
+ if (s->lfe_on && get_bits1(gbc)) {
// TODO: use LFE mix level
skip_bits(gbc, 5); // skip LFE mix level code
}
/* info for mixing with other streams and substreams */
- if(s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT)
- {
- for(i = 0; i < (s->channel_mode ? 1 : 2); i++)
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {
+ for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
// TODO: apply program scale factor
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 6); // skip program scale factor
}
}
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 6); // skip external program scale factor
}
/* skip mixing parameter data */
- switch(get_bits(gbc, 2))
- {
- case 1:
- skip_bits(gbc, 5);
- break;
- case 2:
- skip_bits(gbc, 12);
- break;
- case 3:
- {
- int mix_data_size = (get_bits(gbc, 5) + 2) << 3;
- skip_bits_long(gbc, mix_data_size);
- break;
- }
+ switch(get_bits(gbc, 2)) {
+ case 1: skip_bits(gbc, 5); break;
+ case 2: skip_bits(gbc, 12); break;
+ case 3: {
+ int mix_data_size = (get_bits(gbc, 5) + 2) << 3;
+ skip_bits_long(gbc, mix_data_size);
+ break;
+ }
}
/* skip pan information for mono or dual mono source */
- if(s->channel_mode < AC3_CHMODE_STEREO)
- {
- for(i = 0; i < (s->channel_mode ? 1 : 2); i++)
- {
- if(get_bits1(gbc))
- {
+ if (s->channel_mode < AC3_CHMODE_STEREO) {
+ for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
+ if (get_bits1(gbc)) {
/* note: this is not in the ATSC A/52B specification
reference: ETSI TS 102 366 V1.1.1
section: E.1.3.1.25 */
@@ -463,12 +398,9 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
}
}
/* skip mixing configuration information */
- if(get_bits1(gbc))
- {
- for(blk = 0; blk < s->num_blocks; blk++)
- {
- if(s->num_blocks == 1 || get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
+ for (blk = 0; blk < s->num_blocks; blk++) {
+ if (s->num_blocks == 1 || get_bits1(gbc)) {
skip_bits(gbc, 5);
}
}
@@ -477,27 +409,21 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
}
/* informational metadata */
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 3); // skip bit stream mode
skip_bits(gbc, 2); // skip copyright bit and original bitstream bit
- if(s->channel_mode == AC3_CHMODE_STEREO)
- {
+ if (s->channel_mode == AC3_CHMODE_STEREO) {
skip_bits(gbc, 4); // skip Dolby surround and headphone mode
}
- if(s->channel_mode >= AC3_CHMODE_2F2R)
- {
+ if (s->channel_mode >= AC3_CHMODE_2F2R) {
skip_bits(gbc, 2); // skip Dolby surround EX mode
}
- for(i = 0; i < (s->channel_mode ? 1 : 2); i++)
- {
- if(get_bits1(gbc))
- {
+ for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
+ if (get_bits1(gbc)) {
skip_bits(gbc, 8); // skip mix level, room type, and A/D converter type
}
}
- if(s->bit_alloc_params.sr_code != EAC3_SR_CODE_REDUCED)
- {
+ if (s->bit_alloc_params.sr_code != EAC3_SR_CODE_REDUCED) {
skip_bits1(gbc); // skip source sample rate code
}
}
@@ -506,37 +432,30 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
If frames are less than six blocks, this bit should be turned on
once every 6 blocks to indicate the start of a frame set.
reference: RFC 4598, Section 2.1.3 Frame Sets */
- if(s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && s->num_blocks != 6)
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && s->num_blocks != 6) {
skip_bits1(gbc); // skip converter synchronization flag
}
/* original frame size code if this stream was converted from AC-3 */
- if(s->frame_type == EAC3_FRAME_TYPE_AC3_CONVERT &&
- (s->num_blocks == 6 || get_bits1(gbc)))
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_AC3_CONVERT &&
+ (s->num_blocks == 6 || get_bits1(gbc))) {
skip_bits(gbc, 6); // skip frame size code
}
/* additional bitstream info */
- if(get_bits1(gbc))
- {
+ if (get_bits1(gbc)) {
int addbsil = get_bits(gbc, 6);
- for(i = 0; i < addbsil + 1; i++)
- {
+ for (i = 0; i < addbsil + 1; i++) {
skip_bits(gbc, 8); // skip additional bit stream info
}
}
/* audio frame syntax flags, strategy data, and per-frame data */
- if(s->num_blocks == 6)
- {
+ if (s->num_blocks == 6) {
ac3_exponent_strategy = get_bits1(gbc);
parse_aht_info = get_bits1(gbc);
- }
- else
- {
+ } else {
/* less than 6 blocks, so use AC-3-style exponent strategy syntax, and
do not use AHT */
ac3_exponent_strategy = 1;
@@ -547,20 +466,18 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
parse_transient_proc_info = get_bits1(gbc);
s->block_switch_syntax = get_bits1(gbc);
- if(!s->block_switch_syntax)
+ if (!s->block_switch_syntax)
memset(s->block_switch, 0, sizeof(s->block_switch));
s->dither_flag_syntax = get_bits1(gbc);
- if(!s->dither_flag_syntax)
- {
- for(ch = 1; ch <= s->fbw_channels; ch++)
+ if (!s->dither_flag_syntax) {
+ for (ch = 1; ch <= s->fbw_channels; ch++)
s->dither_flag[ch] = 1;
}
s->dither_flag[CPL_CH] = s->dither_flag[s->lfe_ch] = 0;
s->bit_allocation_syntax = get_bits1(gbc);
- if(!s->bit_allocation_syntax)
- {
+ if (!s->bit_allocation_syntax) {
/* set default bit allocation parameters */
s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[2];
s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[1];
@@ -576,110 +493,83 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
/* coupling strategy occurance and coupling use per block */
num_cpl_blocks = 0;
- if(s->channel_mode > 1)
- {
- for(blk = 0; blk < s->num_blocks; blk++)
- {
+ if (s->channel_mode > 1) {
+ for (blk = 0; blk < s->num_blocks; blk++) {
s->cpl_strategy_exists[blk] = (!blk || get_bits1(gbc));
- if(s->cpl_strategy_exists[blk])
- {
+ if (s->cpl_strategy_exists[blk]) {
s->cpl_in_use[blk] = get_bits1(gbc);
- }
- else
- {
+ } else {
s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
}
num_cpl_blocks += s->cpl_in_use[blk];
}
- }
- else
- {
+ } else {
memset(s->cpl_in_use, 0, sizeof(s->cpl_in_use));
}
/* exponent strategy data */
- if(ac3_exponent_strategy)
- {
+ if (ac3_exponent_strategy) {
/* AC-3-style exponent strategy syntax */
- for(blk = 0; blk < s->num_blocks; blk++)
- {
- for(ch = !s->cpl_in_use[blk]; ch <= s->fbw_channels; ch++)
- {
+ for (blk = 0; blk < s->num_blocks; blk++) {
+ for (ch = !s->cpl_in_use[blk]; ch <= s->fbw_channels; ch++) {
s->exp_strategy[blk][ch] = get_bits(gbc, 2);
}
}
- }
- else
- {
+ } else {
/* LUT-based exponent strategy syntax */
- for(ch = !((s->channel_mode > 1) && num_cpl_blocks); ch <= s->fbw_channels; ch++)
- {
+ for (ch = !((s->channel_mode > 1) && num_cpl_blocks); ch <= s->fbw_channels; ch++) {
int frmchexpstr = get_bits(gbc, 5);
- for(blk = 0; blk < 6; blk++)
- {
+ for (blk = 0; blk < 6; blk++) {
s->exp_strategy[blk][ch] = ff_eac3_frm_expstr[frmchexpstr][blk];
}
}
}
/* LFE exponent strategy */
- if(s->lfe_on)
- {
- for(blk = 0; blk < s->num_blocks; blk++)
- {
+ if (s->lfe_on) {
+ for (blk = 0; blk < s->num_blocks; blk++) {
s->exp_strategy[blk][s->lfe_ch] = get_bits1(gbc);
}
}
/* original exponent strategies if this stream was converted from AC-3 */
- if(s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT &&
- (s->num_blocks == 6 || get_bits1(gbc)))
- {
+ if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT &&
+ (s->num_blocks == 6 || get_bits1(gbc))) {
skip_bits(gbc, 5 * s->fbw_channels); // skip converter channel exponent strategy
}
/* determine which channels use AHT */
- if(parse_aht_info)
- {
+ if (parse_aht_info) {
/* For AHT to be used, all non-zero blocks must reuse exponents from
the first block. Furthermore, for AHT to be used in the coupling
channel, all blocks must use coupling and use the same coupling
strategy. */
- s->channel_uses_aht[CPL_CH] = 0;
- for(ch = (num_cpl_blocks != 6); ch <= s->channels; ch++)
- {
+ s->channel_uses_aht[CPL_CH]=0;
+ for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) {
int use_aht = 1;
- for(blk = 1; blk < 6; blk++)
- {
- if((s->exp_strategy[blk][ch] != EXP_REUSE) ||
- (!ch && s->cpl_strategy_exists[blk]))
- {
+ for (blk = 1; blk < 6; blk++) {
+ if ((s->exp_strategy[blk][ch] != EXP_REUSE) ||
+ (!ch && s->cpl_strategy_exists[blk])) {
use_aht = 0;
break;
}
}
s->channel_uses_aht[ch] = use_aht && get_bits1(gbc);
}
- }
- else
- {
+ } else {
memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
}
/* per-frame SNR offset */
- if(!s->snr_offset_strategy)
- {
+ if (!s->snr_offset_strategy) {
int csnroffst = (get_bits(gbc, 6) - 15) << 4;
int snroffst = (csnroffst + get_bits(gbc, 4)) << 2;
- for(ch = 0; ch <= s->channels; ch++)
+ for (ch = 0; ch <= s->channels; ch++)
s->snr_offset[ch] = snroffst;
}
/* transient pre-noise processing data */
- if(parse_transient_proc_info)
- {
- for(ch = 1; ch <= s->fbw_channels; ch++)
- {
- if(get_bits1(gbc)) // channel in transient processing
- {
+ if (parse_transient_proc_info) {
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (get_bits1(gbc)) { // channel in transient processing
skip_bits(gbc, 10); // skip transient processing location
skip_bits(gbc, 8); // skip transient processing length
}
@@ -687,29 +577,26 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
}
/* spectral extension attenuation data */
- for(ch = 1; ch <= s->fbw_channels; ch++)
- {
- if(parse_spx_atten_data && get_bits1(gbc))
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (parse_spx_atten_data && get_bits1(gbc))
s->spx_atten_code[ch] = get_bits(gbc, 5);
else
s->spx_atten_code[ch] = -1;
}
/* block start information */
- if(s->num_blocks > 1 && get_bits1(gbc))
- {
+ if (s->num_blocks > 1 && get_bits1(gbc)) {
/* reference: Section E2.3.2.27
nblkstrtbits = (numblks - 1) * (4 + ceiling(log2(words_per_frame)))
The spec does not say what this data is or what it's used for.
It is likely the offset of each block within the frame. */
- int block_start_bits = (s->num_blocks - 1) * (4 + av_log2(s->frame_size - 2));
+ int block_start_bits = (s->num_blocks-1) * (4 + av_log2(s->frame_size-2));
skip_bits_long(gbc, block_start_bits);
av_log_missing_feature(s->avctx, "Block start info", 1);
}
/* syntax state initialization */
- for(ch = 1; ch <= s->fbw_channels; ch++)
- {
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
s->first_spx_coords[ch] = 1;
s->first_cpl_coords[ch] = 1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec_data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec_data.c
index a629860be..6c6a55180 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec_data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eac3dec_data.c
@@ -27,8 +27,7 @@
#include "eac3dec_data.h"
#include "ac3.h"
-const uint8_t ff_eac3_bits_vs_hebap[20] =
-{
+const uint8_t ff_eac3_bits_vs_hebap[20] = {
0, 2, 3, 4, 5, 7, 8, 9, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 14, 16,
};
@@ -38,8 +37,7 @@ const uint8_t ff_eac3_bits_vs_hebap[20] =
* No gain (Gk=1) inverse quantization, remapping scale factors
* ff_eac3_gaq_remap[hebap+8]
*/
-const int16_t ff_eac3_gaq_remap_1[12] =
-{
+const int16_t ff_eac3_gaq_remap_1[12] = {
4681, 2185, 1057, 520, 258, 129, 64, 32, 16, 8, 2, 0
};
@@ -48,8 +46,7 @@ const int16_t ff_eac3_gaq_remap_1[12] =
* Large mantissa inverse quantization, remapping scale factors
* ff_eac3_gaq_remap_2_4_a[hebap-8][Gk=2,4]
*/
-const int16_t ff_eac3_gaq_remap_2_4_a[9][2] =
-{
+const int16_t ff_eac3_gaq_remap_2_4_a[9][2] = {
{ -10923, -4681 },
{ -14043, -6554 },
{ -15292, -7399 },
@@ -66,8 +63,7 @@ const int16_t ff_eac3_gaq_remap_2_4_a[9][2] =
* Large mantissa inverse quantization, negative mantissa remapping offsets
* ff_eac3_gaq_remap_3_4_b[hebap-8][Gk=2,4]
*/
-const int16_t ff_eac3_gaq_remap_2_4_b[9][2] =
-{
+const int16_t ff_eac3_gaq_remap_2_4_b[9][2] = {
{ -5461, -1170 },
{ -11703, -4915 },
{ -14199, -6606 },
@@ -79,985 +75,977 @@ const int16_t ff_eac3_gaq_remap_2_4_b[9][2] =
{ -16352, -8168 }
};
-static const int16_t vq_hebap1[4][6] =
-{
- { 7167, 4739, 1106, 4269, 10412, 4820},
- { -5702, -3187, -14483, -1392, -2027, 849},
- { 633, 6199, 7009, -12779, -2306, -2636},
- { -1468, -7031, 7592, 10617, -5946, -3062},
+static const int16_t vq_hebap1[4][6] = {
+{ 7167, 4739, 1106, 4269, 10412, 4820},
+{ -5702, -3187, -14483, -1392, -2027, 849},
+{ 633, 6199, 7009, -12779, -2306, -2636},
+{ -1468, -7031, 7592, 10617, -5946, -3062},
};
-static const int16_t vq_hebap2[8][6] =
-{
- { -12073, 608, -7019, 590, 4000, 869},
- { 6692, 15689, -6178, -9239, -74, 133},
- { 1855, -989, 20596, -2920, -4475, 225},
- { -1194, -3901, -821, -6566, -875, -20298},
- { -2762, -3181, -4094, -5623, -16945, 9765},
- { 1547, 6839, 1980, 20233, -1071, -4986},
- { 6221, -17915, -5516, 6266, 358, 1162},
- { 3753, -1066, 4283, -3227, 15928, 10186},
+static const int16_t vq_hebap2[8][6] = {
+{ -12073, 608, -7019, 590, 4000, 869},
+{ 6692, 15689, -6178, -9239, -74, 133},
+{ 1855, -989, 20596, -2920, -4475, 225},
+{ -1194, -3901, -821, -6566, -875, -20298},
+{ -2762, -3181, -4094, -5623, -16945, 9765},
+{ 1547, 6839, 1980, 20233, -1071, -4986},
+{ 6221, -17915, -5516, 6266, 358, 1162},
+{ 3753, -1066, 4283, -3227, 15928, 10186},
};
-static const int16_t vq_hebap3[16][6] =
-{
- { -10028, 20779, 10982, -4560, 798, -68},
- { 11050, 20490, -6617, -5342, -1797, -1631},
- { 3977, -542, 7118, -1166, 18844, 14678},
- { -4320, -96, -7295, -492, -22050, -4277},
- { 2692, 5856, 5530, 21862, -7212, -5325},
- { -135, -23391, 962, 8115, -644, 382},
- { -1563, 3400, -3299, 4693, -6892, 22398},
- { 3535, 3030, 7296, 6214, 20476, -12099},
- { 57, -6823, 1848, -22349, -5919, 6823},
- { -821, -3655, -387, -6253, -1735, -22373},
- { -6046, 1586, -18890, -14392, 9214, 705},
- { -5716, 264, -17964, 14618, 7921, -337},
- { -110, 108, 8, 74, -89, -50},
- { 6612, -1517, 21687, -1658, -7949, -246},
- { 21667, -6335, -8290, -101, -1349, -22},
- { -22003, -6476, 7974, 648, 2054, -331},
+static const int16_t vq_hebap3[16][6] = {
+{ -10028, 20779, 10982, -4560, 798, -68},
+{ 11050, 20490, -6617, -5342, -1797, -1631},
+{ 3977, -542, 7118, -1166, 18844, 14678},
+{ -4320, -96, -7295, -492, -22050, -4277},
+{ 2692, 5856, 5530, 21862, -7212, -5325},
+{ -135, -23391, 962, 8115, -644, 382},
+{ -1563, 3400, -3299, 4693, -6892, 22398},
+{ 3535, 3030, 7296, 6214, 20476, -12099},
+{ 57, -6823, 1848, -22349, -5919, 6823},
+{ -821, -3655, -387, -6253, -1735, -22373},
+{ -6046, 1586, -18890, -14392, 9214, 705},
+{ -5716, 264, -17964, 14618, 7921, -337},
+{ -110, 108, 8, 74, -89, -50},
+{ 6612, -1517, 21687, -1658, -7949, -246},
+{ 21667, -6335, -8290, -101, -1349, -22},
+{ -22003, -6476, 7974, 648, 2054, -331},
};
-static const int16_t vq_hebap4[32][6] =
-{
- { 6636, -4593, 14173, -17297, -16523, 864},
- { 3658, 22540, 104, -1763, -84, 6},
- { 21580, -17815, -7282, -1575, -2078, -320},
- { -2233, 10017, -2728, 14938, -13640, -17659},
- { -1564, -17738, -19161, 13735, 2757, 2951},
- { 4520, 5510, 7393, 10799, 19231, -13770},
- { 399, 2976, -1099, 5013, -1159, 22095},
- { 3624, -2359, 4680, -2238, 22702, 3765},
- { -4201, -8285, -6810, -12390, -18414, 15382},
- { -5198, -6869, -10047, -8364, -16022, -20562},
- { -142, -22671, -368, 4391, -464, -13},
- { 814, -1118, -1089, -22019, 74, 1553},
- { -1618, 19222, -17642, -13490, 842, -2309},
- { 4689, 16490, 20813, -15387, -4164, -3968},
- { -3308, 11214, -13542, 13599, -19473, 13770},
- { 1817, 854, 21225, -966, -1643, -268},
- { -2587, -107, -20154, 376, 1174, -304},
- { -2919, 453, -5390, 750, -22034, -978},
- { -19012, 16839, 10000, -3580, 2211, 1459},
- { 1363, -2658, -33, -4067, 1165, -21985},
- { -8592, -2760, -17520, -15985, 14897, 1323},
- { 652, -9331, 3253, -14622, 12181, 19692},
- { -6361, 5773, -15395, 17291, 16590, -2922},
- { -661, -601, 1609, 22610, 992, -1045},
- { 4961, 9107, 11225, 7829, 16320, 18627},
- { -21872, -1433, 138, 1470, -1891, -196},
- { -19499, -18203, 11056, -516, 2543, -2249},
- { -1196, -17574, 20150, 11462, -401, 2619},
- { 4638, -8154, 11891, -15759, 17615, -14955},
- { -83, 278, 323, 55, -154, 232},
- { 7788, 1462, 18395, 15296, -15763, -1131},
+static const int16_t vq_hebap4[32][6] = {
+{ 6636, -4593, 14173, -17297, -16523, 864},
+{ 3658, 22540, 104, -1763, -84, 6},
+{ 21580, -17815, -7282, -1575, -2078, -320},
+{ -2233, 10017, -2728, 14938, -13640, -17659},
+{ -1564, -17738, -19161, 13735, 2757, 2951},
+{ 4520, 5510, 7393, 10799, 19231, -13770},
+{ 399, 2976, -1099, 5013, -1159, 22095},
+{ 3624, -2359, 4680, -2238, 22702, 3765},
+{ -4201, -8285, -6810, -12390, -18414, 15382},
+{ -5198, -6869, -10047, -8364, -16022, -20562},
+{ -142, -22671, -368, 4391, -464, -13},
+{ 814, -1118, -1089, -22019, 74, 1553},
+{ -1618, 19222, -17642, -13490, 842, -2309},
+{ 4689, 16490, 20813, -15387, -4164, -3968},
+{ -3308, 11214, -13542, 13599, -19473, 13770},
+{ 1817, 854, 21225, -966, -1643, -268},
+{ -2587, -107, -20154, 376, 1174, -304},
+{ -2919, 453, -5390, 750, -22034, -978},
+{ -19012, 16839, 10000, -3580, 2211, 1459},
+{ 1363, -2658, -33, -4067, 1165, -21985},
+{ -8592, -2760, -17520, -15985, 14897, 1323},
+{ 652, -9331, 3253, -14622, 12181, 19692},
+{ -6361, 5773, -15395, 17291, 16590, -2922},
+{ -661, -601, 1609, 22610, 992, -1045},
+{ 4961, 9107, 11225, 7829, 16320, 18627},
+{ -21872, -1433, 138, 1470, -1891, -196},
+{ -19499, -18203, 11056, -516, 2543, -2249},
+{ -1196, -17574, 20150, 11462, -401, 2619},
+{ 4638, -8154, 11891, -15759, 17615, -14955},
+{ -83, 278, 323, 55, -154, 232},
+{ 7788, 1462, 18395, 15296, -15763, -1131},
};
-static const int16_t vq_hebap5[128][6] =
-{
- { -3394, -19730, 2963, 9590, 4660, 19673},
- { -15665, -6405, 17671, 3860, -8232, -19429},
- { 4467, 412, -17873, -8037, 691, -17307},
- { 3580, 2363, 6886, 3763, 6379, -20522},
- { -17230, -14133, -1396, -23939, 8373, -12537},
- { -8073, -21469, -15638, 3214, 8105, -5965},
- { 4343, 5169, 2683, -16822, -5146, -16558},
- { 6348, -10668, 12995, -25500, -22090, 4091},
- { -2880, -8366, -5968, -17158, -2638, 23132},
- { -5095, -14281, -22371, 21741, 3689, 2961},
- { -2443, -17739, 25155, 2707, 1594, 7},
- { -18379, 9010, 4270, 731, -426, -640},
- { -23695, 24732, 5642, 612, -308, -964},
- { -767, 1268, 225, 1635, 173, 916},
- { 5455, 6493, 4902, 10560, 23041, -17140},
- { 17219, -21054, -18716, 4936, -3420, 3357},
- { -1390, 15488, -21946, -14611, 1339, 542},
- { -6866, -2254, -12070, -3075, -19981, -20622},
- { -1803, 11775, 1343, 8917, 693, 24497},
- { -21610, 9462, 4681, 9254, -7815, 15904},
- { -5559, -3018, -9169, -1347, -22547, 12868},
- { -366, 5076, -1727, 20427, -283, -2923},
- { -1886, -6313, -939, -2081, -1399, 3513},
- { -3161, -537, -5075, 11268, 19396, 989},
- { 2345, 4153, 5769, -4273, 233, -399},
- { -21894, -1138, -16474, 5902, 5488, -3211},
- { 10007, -12530, 18829, 20932, -1158, 1790},
- { -1165, 5014, -1199, 6415, -8418, -21038},
- { 1892, -3534, 3815, -5846, 16427, 20288},
- { -2664, -11627, -4147, -18311, -22710, 14848},
- { 17256, 10419, 7764, 12040, 18956, 2525},
- { -21419, -18685, -10897, 4368, -7051, 4539},
- { -1574, 2050, 5760, 24756, 15983, 17678},
- { -538, -22867, 11067, 10301, 385, 528},
- { -8465, -3025, -16357, -23237, 16491, 3654},
- { 5840, 575, 11890, 1947, 25157, 6653},
- { 6625, -3516, -1964, 3850, -390, -116},
- { 18005, 20900, 14323, -7621, -10922, 11802},
- { -4857, -2932, -13334, -7815, 21622, 2267},
- { -579, -9431, -748, -21321, 12367, 8265},
- { -8317, 1375, -17847, 2921, 9062, 22046},
- { 18398, 8635, -1503, -2418, -18295, -14734},
- { -2987, 15129, -3331, 22300, 13878, -13639},
- { 5874, -19026, 15587, 11350, -20738, 1971},
- { 1581, -6955, -21440, 2455, 65, 414},
- { 515, -4468, -665, -4672, 125, -19222},
- { 21495, -20301, -1872, -1926, -211, -1022},
- { 5189, -12250, -1775, -23550, -4546, 5813},
- { 321, -6331, 14646, 6975, -1773, 867},
- { -13814, 3180, 7927, 444, 19552, 3146},
- { -6660, 12252, -1972, 17408, -24280, -12956},
- { -745, 14356, -1107, 23742, -9631, -18344},
- { 18284, -7909, -7531, 19118, 7721, -12659},
- { 1926, 15101, -12848, 2153, 21631, 1864},
- { -2130, 23416, 17056, -15597, -1544, 87},
- { 8314, -11824, 14581, -20591, 7891, -2099},
- { 19600, 22814, -17304, -2040, 285, -3863},
- { -8214, -18322, 10724, -13744, -13469, -1666},
- { 14351, 4880, -20034, 964, -4221, -180},
- { -24598, -16635, 19724, 5925, 4777, 4414},
- { -2495, 23493, -16141, 2918, -1038, -2010},
- { 18974, -2540, 13343, 1405, -6194, -1136},
- { 2489, 13670, 22638, -7311, -129, -2792},
- { -13962, 16775, 23012, 728, 3397, 162},
- { 3038, 993, 8774, -21969, -6609, 910},
- { -12444, -22386, -2626, -5295, 19520, 9872},
- { -1911, -18274, -18506, -14962, 4760, 7119},
- { 8298, -2978, 25886, 7660, -7897, 1020},
- { 6132, 15127, 18757, -24370, -6529, -6627},
- { 7924, 12125, -9459, -23962, 5502, 937},
- { -17056, -5373, 2522, 327, 1129, -390},
- { 15774, 19955, -10380, 11172, -3107, 14853},
- { -11904, -8091, -17928, -22287, -17237, -6803},
- { -12862, -2172, -6509, 5927, 12458, -22355},
- { -497, 322, 1038, -6643, -5404, 20311},
- { 1083, -22984, -8494, 12130, -762, 2623},
- { 5067, 19712, -1901, -30, -325, 85},
- { 987, -5830, 4212, -9030, 9121, -25038},
- { -7868, 7284, -12292, 12914, -21592, 20941},
- { -1630, -7694, -2187, -8525, -5604, -25196},
- { -6668, 388, -22535, 1526, 9082, 193},
- { -7867, -22308, 5163, 362, 944, -259},
- { 3824, -11850, 7591, -23176, 25342, 23771},
- { -10504, 4123, -21111, 21173, 22439, -838},
- { -4723, 21795, 6184, -122, 1642, -717},
- { 24504, 19887, -2043, 986, 7, -55},
- { -27313, -135, 2437, 259, 89, 307},
- { 24446, -3873, -5391, -820, -2387, 361},
- { 5529, 5784, 18682, 242, -21896, -4003},
- { 22304, 4483, 722, -12242, 7570, 15448},
- { 8673, 3009, 20437, 21108, -21100, -3080},
- { -1132, 2705, -1825, 5420, -785, 18532},
- { 16932, -13517, -16509, -14858, -20327, -14221},
- { 2219, 1380, 21474, -1128, 327, 83},
- { -2177, 21517, -3856, -14180, -204, -2191},
- { 953, -9426, 15874, -10710, -3231, 21030},
- { -421, -1377, 640, -8239, -20976, 2174},
- { 4309, 18514, -9100, -18319, -15518, 3704},
- { -5943, 449, -8387, 1075, -22210, -4992},
- { 2953, 12788, 18285, 1430, 14937, 21731},
- { -2913, 401, -4739, -20105, 1699, -1147},
- { 3449, 5241, 8853, 22134, -7547, 1451},
- { -2154, 8584, 18120, -15614, 19319, -5991},
- { 3501, 2841, 5897, 6397, 8630, 23018},
- { 2467, 2956, 379, 5703, -22047, -2189},
- { -16963, -594, 18822, -5295, 1640, 774},
- { 2896, -1424, 3586, -2292, 19910, -1822},
- { -18575, 21219, -14001, -12573, 16466, 635},
- { -1998, -19314, -16527, 12208, -16576, -7854},
- { -9674, 1012, -21645, 2883, -12712, 2321},
- { -1005, 471, -3629, 8045, -11087, 25533},
- { 4141, -21472, -2673, 756, -663, -523},
- { 6490, 8531, 19289, 18949, 6092, -9347},
- { 16965, 24599, 14024, 10072, -536, -10438},
- { -8147, 2145, -23028, -17073, 5451, -4401},
- { -14873, 20520, -18303, -9717, -11885, -17831},
- { -2290, -14120, 2070, 22467, 1671, 725},
- { -8538, 14629, 3521, -20577, 6673, 8200},
- { 20248, 4410, -1366, -585, 1229, -2449},
- { 7467, -7148, 13667, -8246, 22392, -17320},
- { -1932, 3875, -9064, -3812, 958, 265},
- { -4399, 2959, -15911, 19598, 4954, -1105},
- { 18009, -9923, -18137, -3862, 11178, 5821},
- { -14596, -1227, 9660, 21619, 11228, -11721},
- { -721, -1700, 109, -2142, 61, -6772},
- { -24619, -22520, 5608, -1957, -1761, -1012},
- { -23728, -4451, -2688, -14679, -4266, 9919},
- { 8495, -894, 20438, -13820, -17267, 139},
+static const int16_t vq_hebap5[128][6] = {
+{ -3394, -19730, 2963, 9590, 4660, 19673},
+{ -15665, -6405, 17671, 3860, -8232, -19429},
+{ 4467, 412, -17873, -8037, 691, -17307},
+{ 3580, 2363, 6886, 3763, 6379, -20522},
+{ -17230, -14133, -1396, -23939, 8373, -12537},
+{ -8073, -21469, -15638, 3214, 8105, -5965},
+{ 4343, 5169, 2683, -16822, -5146, -16558},
+{ 6348, -10668, 12995, -25500, -22090, 4091},
+{ -2880, -8366, -5968, -17158, -2638, 23132},
+{ -5095, -14281, -22371, 21741, 3689, 2961},
+{ -2443, -17739, 25155, 2707, 1594, 7},
+{ -18379, 9010, 4270, 731, -426, -640},
+{ -23695, 24732, 5642, 612, -308, -964},
+{ -767, 1268, 225, 1635, 173, 916},
+{ 5455, 6493, 4902, 10560, 23041, -17140},
+{ 17219, -21054, -18716, 4936, -3420, 3357},
+{ -1390, 15488, -21946, -14611, 1339, 542},
+{ -6866, -2254, -12070, -3075, -19981, -20622},
+{ -1803, 11775, 1343, 8917, 693, 24497},
+{ -21610, 9462, 4681, 9254, -7815, 15904},
+{ -5559, -3018, -9169, -1347, -22547, 12868},
+{ -366, 5076, -1727, 20427, -283, -2923},
+{ -1886, -6313, -939, -2081, -1399, 3513},
+{ -3161, -537, -5075, 11268, 19396, 989},
+{ 2345, 4153, 5769, -4273, 233, -399},
+{ -21894, -1138, -16474, 5902, 5488, -3211},
+{ 10007, -12530, 18829, 20932, -1158, 1790},
+{ -1165, 5014, -1199, 6415, -8418, -21038},
+{ 1892, -3534, 3815, -5846, 16427, 20288},
+{ -2664, -11627, -4147, -18311, -22710, 14848},
+{ 17256, 10419, 7764, 12040, 18956, 2525},
+{ -21419, -18685, -10897, 4368, -7051, 4539},
+{ -1574, 2050, 5760, 24756, 15983, 17678},
+{ -538, -22867, 11067, 10301, 385, 528},
+{ -8465, -3025, -16357, -23237, 16491, 3654},
+{ 5840, 575, 11890, 1947, 25157, 6653},
+{ 6625, -3516, -1964, 3850, -390, -116},
+{ 18005, 20900, 14323, -7621, -10922, 11802},
+{ -4857, -2932, -13334, -7815, 21622, 2267},
+{ -579, -9431, -748, -21321, 12367, 8265},
+{ -8317, 1375, -17847, 2921, 9062, 22046},
+{ 18398, 8635, -1503, -2418, -18295, -14734},
+{ -2987, 15129, -3331, 22300, 13878, -13639},
+{ 5874, -19026, 15587, 11350, -20738, 1971},
+{ 1581, -6955, -21440, 2455, 65, 414},
+{ 515, -4468, -665, -4672, 125, -19222},
+{ 21495, -20301, -1872, -1926, -211, -1022},
+{ 5189, -12250, -1775, -23550, -4546, 5813},
+{ 321, -6331, 14646, 6975, -1773, 867},
+{ -13814, 3180, 7927, 444, 19552, 3146},
+{ -6660, 12252, -1972, 17408, -24280, -12956},
+{ -745, 14356, -1107, 23742, -9631, -18344},
+{ 18284, -7909, -7531, 19118, 7721, -12659},
+{ 1926, 15101, -12848, 2153, 21631, 1864},
+{ -2130, 23416, 17056, -15597, -1544, 87},
+{ 8314, -11824, 14581, -20591, 7891, -2099},
+{ 19600, 22814, -17304, -2040, 285, -3863},
+{ -8214, -18322, 10724, -13744, -13469, -1666},
+{ 14351, 4880, -20034, 964, -4221, -180},
+{ -24598, -16635, 19724, 5925, 4777, 4414},
+{ -2495, 23493, -16141, 2918, -1038, -2010},
+{ 18974, -2540, 13343, 1405, -6194, -1136},
+{ 2489, 13670, 22638, -7311, -129, -2792},
+{ -13962, 16775, 23012, 728, 3397, 162},
+{ 3038, 993, 8774, -21969, -6609, 910},
+{ -12444, -22386, -2626, -5295, 19520, 9872},
+{ -1911, -18274, -18506, -14962, 4760, 7119},
+{ 8298, -2978, 25886, 7660, -7897, 1020},
+{ 6132, 15127, 18757, -24370, -6529, -6627},
+{ 7924, 12125, -9459, -23962, 5502, 937},
+{ -17056, -5373, 2522, 327, 1129, -390},
+{ 15774, 19955, -10380, 11172, -3107, 14853},
+{ -11904, -8091, -17928, -22287, -17237, -6803},
+{ -12862, -2172, -6509, 5927, 12458, -22355},
+{ -497, 322, 1038, -6643, -5404, 20311},
+{ 1083, -22984, -8494, 12130, -762, 2623},
+{ 5067, 19712, -1901, -30, -325, 85},
+{ 987, -5830, 4212, -9030, 9121, -25038},
+{ -7868, 7284, -12292, 12914, -21592, 20941},
+{ -1630, -7694, -2187, -8525, -5604, -25196},
+{ -6668, 388, -22535, 1526, 9082, 193},
+{ -7867, -22308, 5163, 362, 944, -259},
+{ 3824, -11850, 7591, -23176, 25342, 23771},
+{ -10504, 4123, -21111, 21173, 22439, -838},
+{ -4723, 21795, 6184, -122, 1642, -717},
+{ 24504, 19887, -2043, 986, 7, -55},
+{ -27313, -135, 2437, 259, 89, 307},
+{ 24446, -3873, -5391, -820, -2387, 361},
+{ 5529, 5784, 18682, 242, -21896, -4003},
+{ 22304, 4483, 722, -12242, 7570, 15448},
+{ 8673, 3009, 20437, 21108, -21100, -3080},
+{ -1132, 2705, -1825, 5420, -785, 18532},
+{ 16932, -13517, -16509, -14858, -20327, -14221},
+{ 2219, 1380, 21474, -1128, 327, 83},
+{ -2177, 21517, -3856, -14180, -204, -2191},
+{ 953, -9426, 15874, -10710, -3231, 21030},
+{ -421, -1377, 640, -8239, -20976, 2174},
+{ 4309, 18514, -9100, -18319, -15518, 3704},
+{ -5943, 449, -8387, 1075, -22210, -4992},
+{ 2953, 12788, 18285, 1430, 14937, 21731},
+{ -2913, 401, -4739, -20105, 1699, -1147},
+{ 3449, 5241, 8853, 22134, -7547, 1451},
+{ -2154, 8584, 18120, -15614, 19319, -5991},
+{ 3501, 2841, 5897, 6397, 8630, 23018},
+{ 2467, 2956, 379, 5703, -22047, -2189},
+{ -16963, -594, 18822, -5295, 1640, 774},
+{ 2896, -1424, 3586, -2292, 19910, -1822},
+{ -18575, 21219, -14001, -12573, 16466, 635},
+{ -1998, -19314, -16527, 12208, -16576, -7854},
+{ -9674, 1012, -21645, 2883, -12712, 2321},
+{ -1005, 471, -3629, 8045, -11087, 25533},
+{ 4141, -21472, -2673, 756, -663, -523},
+{ 6490, 8531, 19289, 18949, 6092, -9347},
+{ 16965, 24599, 14024, 10072, -536, -10438},
+{ -8147, 2145, -23028, -17073, 5451, -4401},
+{ -14873, 20520, -18303, -9717, -11885, -17831},
+{ -2290, -14120, 2070, 22467, 1671, 725},
+{ -8538, 14629, 3521, -20577, 6673, 8200},
+{ 20248, 4410, -1366, -585, 1229, -2449},
+{ 7467, -7148, 13667, -8246, 22392, -17320},
+{ -1932, 3875, -9064, -3812, 958, 265},
+{ -4399, 2959, -15911, 19598, 4954, -1105},
+{ 18009, -9923, -18137, -3862, 11178, 5821},
+{ -14596, -1227, 9660, 21619, 11228, -11721},
+{ -721, -1700, 109, -2142, 61, -6772},
+{ -24619, -22520, 5608, -1957, -1761, -1012},
+{ -23728, -4451, -2688, -14679, -4266, 9919},
+{ 8495, -894, 20438, -13820, -17267, 139},
};
-static const int16_t vq_hebap6[256][6] =
-{
- { 10154, 7365, 16861, 18681, -22893, -3636},
- { -2619, -3788, -5529, -5192, -9009, -20298},
- { -5583, -22800, 21297, 7012, 745, 720},
- { 428, -1459, 109, -3082, 361, -8403},
- { 8161, 22401, 241, 1755, -874, -2824},
- { 1140, 12643, 2306, 22263, -25146, -17557},
- { -2609, 3379, 10337, -19730, -15468, -23944},
- { -4040, -12796, -25772, 13096, 3905, 1315},
- { 4624, -23799, 13608, 25317, -1175, 2173},
- { -97, 13747, -5122, 23255, 4214, -22145},
- { 6878, -322, 18264, -854, -11916, -733},
- { 17280, -12669, -9693, 23563, -16240, -1309},
- { 5802, -4968, 19526, -21194, -24622, -183},
- { 5851, -16137, 15229, -9496, -1538, 377},
- { 14096, 25057, 13419, 8290, 23320, 16818},
- { -7261, 118, -15867, 19097, 9781, -277},
- { -4288, 21589, -13288, -16259, 16633, -4862},
- { 4909, -19217, 23411, 14705, -722, 125},
- { 19462, -4732, -1928, -11527, 20770, 5425},
- { -27562, -2881, -4331, 384, -2103, 1367},
- { -266, -9175, 5441, 26333, -1924, 4221},
- { -2970, -20170, -21816, 5450, -7426, 5344},
- { -221, -6696, 603, -9140, 1308, -27506},
- { 9621, -8380, -1967, 9403, -1651, 22817},
- { 7566, -5250, -4165, 1385, -990, 560},
- { -1262, 24738, -19057, 10741, 7585, -7098},
- { 451, 20130, -9949, -6015, -2188, -1458},
- { 22249, 9380, 9096, 10959, -2365, -3724},
- { 18668, -650, -1234, 11092, 7678, 5969},
- { 19207, -1485, -1076, -731, -684, 43},
- { -4973, 13430, 20139, 60, 476, -935},
- { -20029, 8710, 2499, 1016, -1158, 335},
- { -26413, 18598, -2201, -669, 3409, 793},
- { -4726, 8875, -24607, -9646, 3643, -283},
- { 13303, -21404, -3691, -1184, -1970, 1612},
- { 173, 60, 919, 1229, 6942, -665},
- { 16377, 16991, 5341, -14015, -2304, -20390},
- { 25334, -10609, 11947, -7653, -6363, 14058},
- { 23929, -13259, -7226, -937, 234, -187},
- { 6311, -1877, 12506, -1879, 18751, -23341},
- { 621, 6445, 3354, -24274, 8406, 5315},
- { -3297, -5034, -4704, -5080, -25730, 5347},
- { -1275, -13295, -965, -23318, 1214, 26259},
- { -6252, 10035, -20105, 15301, -16073, 5136},
- { 9562, -3911, -19510, 4745, 22270, -4171},
- { 7978, -19600, 14024, -5745, -20855, 8939},
- { 7, -4039, 991, -6065, 52, -19423},
- { 3485, 2969, 7732, 7786, 25312, 6206},
- { -959, -12812, -1840, -22743, 7324, 10830},
- { -4686, 1678, -10172, -5205, 4294, -1271},
- { 3889, 1302, 7450, 638, 20374, -3133},
- { -12496, -9123, 18463, -12343, -7238, 18552},
- { -6185, 8649, -6903, -895, 17109, 16604},
- { -9896, 28579, 2845, 1640, 2925, -298},
- { 14968, -25988, 14878, -24012, 1815, -6474},
- { 26107, 5166, 21225, 15873, 21617, 14825},
- { -21684, 16438, 20504, -14346, -7114, -4162},
- { 28647, 90, -1572, 789, -902, -75},
- { -1479, 2471, -4061, 3612, -2240, 10914},
- { 8616, 17491, 17255, -17456, 17022, -16357},
- { -20722, -18597, 25274, 17720, -3573, 1695},
- { -997, 6129, -6303, 11250, -11359, -19739},
- { -74, -4001, -1584, 13384, 162, -144},
- { -529, 21068, 7923, -11396, 422, -26},
- { 7102, -13531, -20055, 2629, -178, -429},
- { 9201, 1368, -22238, 2623, -20499, 24889},
- { -432, 6675, -266, 8723, 80, 28024},
- { 19493, -3108, -9261, 1910, -21777, 5345},
- { 14079, -11489, 12604, 6079, 19877, 1315},
- { 10947, 9837, -18612, 15742, 4792, 605},
- { -1777, 3758, -4087, 21696, 6024, -576},
- { 3567, -3578, 16379, 2680, -1752, 716},
- { -5049, -1399, -4550, -652, -17721, -3366},
- { -3635, -4372, -6522, -22152, 7382, 1458},
- { 12242, 19190, 5646, -7815, -20289, 21344},
- { -7508, 19952, 23542, -9753, 5669, -1990},
- { -2275, 15438, 10907, -17879, 6497, 13582},
- { -15894, -15646, -4716, 6019, 24250, -6179},
- { -2049, -6856, -1208, 918, 17735, -69},
- { -3721, 9099, -16065, -23621, 5981, -2344},
- { 7862, -8918, 24033, 25508, -11033, -741},
- { -12588, 19468, 14649, 15451, -21226, 1171},
- { 2102, 1147, 2789, 4096, 2179, 8750},
- { -18214, -17758, -10366, -5203, -1066, -3541},
- { -2819, -19958, -11921, 6032, 8315, 10374},
- { -9078, -2100, 19431, -17, 732, -689},
- { -14512, -19224, -7095, 18727, 1870, 22906},
- { 3912, 659, 25597, -4006, 9619, 877},
- { 2616, 22695, -5770, 17920, 3812, 20220},
- { 2561, 26847, -5245, -10908, 2256, -517},
- { -4974, 198, -21983, -3608, 22174, -18924},
- { 21308, -1211, 19144, 16691, -1588, 11390},
- { -1790, 3959, -3488, 7003, -7107, 20877},
- { -6108, -17955, -18722, 24763, 16508, 3211},
- { 20462, -24987, -20361, 4484, -5111, -478},
- { -6378, -1998, -10229, -561, -22039, -22339},
- { 3047, -18850, 7586, 14743, -19862, 6351},
- { -5047, 1405, -9672, 1055, -21881, 11170},
- { 3481, -9699, 6526, -16655, 22813, 21907},
- { -18570, 17501, 14664, 1291, 5026, 19676},
- { 16134, -19810, -16956, -17939, -16933, 5800},
- { -8224, 4908, 8935, 2272, -1140, -23217},
- { 1572, 2753, -1598, 2143, -3346, -21926},
- { -9832, -1060, -27818, 1214, 7289, 150},
- { 98, 1538, 535, 17429, -23198, -901},
- { 21340, -20146, 3297, -1744, -8207, -21462},
- { -4166, -4633, -17902, 5478, 1285, 136},
- { 18713, 21003, 24818, 11421, 1282, -4618},
- { -3535, 7636, -265, 2141, -829, -2035},
- { -3184, 19713, 2775, -2, 1090, 104},
- { -6771, -20185, 2938, -2125, -36, 1268},
- { 9560, 9430, 9586, 22100, 13827, 6296},
- { -535, -20018, 4276, -1868, -448, -17183},
- { -24352, 14244, -13647, -21040, 2271, 11555},
- { -2646, 15437, -4589, 18638, -4299, -622},
- { -20064, 4169, 18115, -1404, 13722, -1825},
- { -16359, 9080, 744, 22021, 125, 10794},
- { 9644, -14607, -18479, -14714, 11174, -20754},
- { -326, -23762, 6144, 7909, 602, 1540},
- { -6650, 6634, -12683, 21396, 20785, -6839},
- { 4252, -21043, 5628, 18687, 23860, 8328},
- { 17986, 5704, -5245, -18093, -555, 3219},
- { 6091, 14232, -5117, -17456, -19452, -11649},
- { -21586, 11302, 15434, 25590, 6777, -26683},
- { 21355, -8244, 5877, -3540, 6079, -2567},
- { 2603, -2455, 5421, -12286, -19100, 5574},
- { -1721, -26393, -23664, 22904, -349, 3787},
- { 2189, -1203, 5340, 3249, -22617, 104},
- { -1664, -11020, -2857, -20723, -24049, 19900},
- { 22873, -7345, -18481, -14616, -8400, -12965},
- { 3777, 3958, 8239, 20494, -6991, -1201},
- { -160, -1613, -793, -8681, 573, 776},
- { 4297, -3786, 20373, 6082, -5321, -18400},
- { 18745, 2463, 12546, -7749, -7734, -2183},
- { 11074, -4720, 22119, 1825, -24351, 4080},
- { 1503, -19178, -1569, 13, -313, 375},
- { 318, -575, 2544, 178, 102, 40},
- { -15996, -26897, 5008, 3320, 686, 1159},
- { 25755, 26886, 574, -5930, -3916, 1407},
- { -9148, -7665, -2875, -8384, -18663, 26400},
- { -7445, -18040, -18396, 8802, -2252, -21886},
- { 7851, 11773, 27485, -12847, -1410, 19590},
- { 2240, 5947, 11247, 15980, -6499, 24280},
- { 21673, -18515, 9771, 6550, -2730, 334},
- { -4149, 1576, -11010, 89, -24429, -5710},
- { 7720, 1478, 21412, -25025, -8385, 9},
- { -2448, 10218, -12756, -16079, 1161, -21284},
- { -8757, -14429, -22918, -14812, 2629, 13844},
- { -7252, 2843, -9639, 2882, -14625, 24497},
- { -674, -6530, 414, -23333, -21343, 454},
- { 2104, -6312, 10887, 18087, -1199, 175},
- { -493, -562, -2739, 118, -1074, 93},
- { -10011, -4075, -28071, 22180, 15077, -636},
- { -4637, -16408, -9003, -20418, -11608, -20932},
- { 4815, 15892, 24238, -13634, -3074, -1059},
- { -6724, 4610, -18772, -15283, -16685, 23988},
- { 15349, -674, -3682, 21679, 4475, -12088},
- { 4756, 2593, 5354, 6001, 15063, 26490},
- { -23815, -17251, 6944, 378, 694, 670},
- { 23392, -8839, -14713, 7544, -876, 11088},
- { 3640, 3336, 22593, -3495, -2328, -113},
- { 284, 6914, 3097, 10171, 6638, -18621},
- { 2472, 5976, 11054, -11936, -603, -663},
- { 16175, 16441, 13164, -4043, 4667, 7431},
- { 19338, 15534, -6533, 1681, -4857, 17048},
- { 17027, 532, -19064, -1441, -5130, 1085},
- { -12617, -17609, 2062, -25332, 19009, -16121},
- { 10056, -21000, -13634, -2949, 15367, 19934},
- { -648, -1605, 10046, -1592, 13296, 19808},
- { -1054, 10744, 538, 24938, 9630, -9052},
- { -10099, 3042, -25076, -24052, 13971, 100},
- { 6547, 6907, 7031, 10348, 23775, -17886},
- { -22793, -1984, -1393, -3330, 9267, 14317},
- { -14346, -3967, 3042, 16254, -17303, 9646},
- { -21393, 23628, 16773, 716, 2663, 114},
- { -19016, -3038, 1574, -245, 1463, -793},
- { 22410, 23441, -14637, -530, 17310, 13617},
- { -11582, 7935, -13954, 23465, -24628, 26550},
- { -1045, 3679, -2218, 10572, 20999, -3702},
- { -15513, 197, 16718, -24603, 4945, 5},
- { 10781, 4335, 26790, -9059, -16152, -2840},
- { 16075, -24100, -3933, -6833, 12645, -7029},
- { 2096, -25572, -8370, 6814, 11, 1178},
- { -11848, -583, -8889, -20543, -10471, -380},
- { -2487, 24777, -21639, -19341, 1660, -732},
- { 2313, 13679, 4085, 24549, 24691, -21179},
- { -2366, -504, -4130, -10570, 23668, 1961},
- { 20379, 17809, -9506, 3733, -18954, -6292},
- { -3856, 16802, -929, -20310, -17739, 6797},
- { 12431, 6078, -11272, -14450, 6913, 23476},
- { 7636, -1655, 23017, 10719, -8292, 838},
- { -8559, -1235, -18096, 3897, 16093, 1490},
- { -3586, 8276, 15165, -3791, -21149, 1741},
- { -4497, 21739, 2366, -278, -4792, 15549},
- { -23122, -13708, 7668, 16232, 24120, 15025},
- { -20043, 12821, -20160, 16691, -11655, -16081},
- { -12601, 20239, 3496, -2549, -6745, -11850},
- { 4441, 7812, 20783, 17080, 11523, -9643},
- { 24766, 8494, -23298, -3262, 11101, -7120},
- { -10107, -7623, -22152, -18303, 26645, 9550},
- { -25549, 477, 7874, -1538, 1123, -168},
- { 470, 9834, -347, 23945, -10381, -9467},
- { -4096, -9702, -6856, -21544, 20845, 7174},
- { 5370, 9748, -23765, -1190, 512, -1538},
- { -1006, -10046, -12649, 19234, -1790, -890},
- { 15108, 23620, -15646, -2522, -1203, -1325},
- { -7406, -2605, 1095, -247, -473, 177},
- { 8089, 4, 12424, -22284, 10405, -7728},
- { 22196, 10775, -5043, 690, 534, -212},
- { -3153, -1418, -16835, 18426, 15821, 22956},
- { 5681, -2229, 3196, -3414, -21817, -14807},
- { 19, 787, 1032, 170, -8295, -645},
- { -882, -2319, -27105, 432, -4392, 1499},
- { -1354, -11819, -76, -20380, -10293, 11328},
- { 211, -4753, -4675, -6933, -13538, 14479},
- { 6043, 5260, -459, -462, 143, -65},
- { -2572, 7256, -3317, 9212, -23184, -9990},
- { -24882, -9532, 18874, 6101, 2429, -14482},
- { 8314, 2277, 14192, 3512, 25881, 22000},
- { 208, 20218, -281, -24778, -63, -1183},
- { 1095, -6034, 2706, -21935, -2655, 563},
- { 23, -5930, 243, -8989, 5345, 20558},
- { -15466, 12699, 4160, 11087, 20621, -10416},
- { 20995, -85, -8468, 194, 1003, -9515},
- { -19637, -3335, -14081, 3574, -23381, -667},
- { -2076, 3489, -3192, -19367, 539, -1530},
- { 7352, -15213, 22596, 19369, 1043, 16627},
- { -1872, -413, 1235, -5276, -3550, 21903},
- { 7931, -2008, 16968, -6799, 29393, -2475},
- { -13589, 8389, -23636, -22091, -14178, -14297},
- { -11575, -20090, 16056, -1848, 15721, 4500},
- { 3849, -16581, 20161, -21155, 7778, 11864},
- { -6547, -1273, -18837, -11218, 11636, 1044},
- { 2528, -6691, -17917, -11362, -4894, -1008},
- { 1241, 4260, 2319, 6111, 3485, 20209},
- { 3014, -3048, 5316, -4539, 20831, 8702},
- { -1790, -14683, 278, 13956, -10065, -10547},
- { -22732, -7957, -1154, 13821, -1484, -1247},
- { -7317, -615, 13094, 18927, 9897, 1452},
- { 2552, -2338, 3424, -4630, 11124, -19584},
- { -11125, -20553, -10855, -10783, -20767, 6833},
- { 984, -15095, 5775, 25125, 5377, -19799},
- { 517, 13272, -7458, -1711, 20612, -6013},
- { -21417, 13251, -20795, 13449, 17281, 13104},
- { -15811, -16248, 23093, -4037, -8195, 871},
- { 582, 12571, -21129, -14766, -9187, 5685},
- { 4318, -1776, 11425, -17763, -9921, 577},
- { 6013, 16830, 17655, -25766, -4400, -3550},
- { -13744, -16541, 3636, -3330, -21091, -15886},
- { 6565, -11147, 8649, -13114, 23345, -13565},
- { -2542, -9046, -7558, 29240, 3701, -383},
- { -10612, 24995, 1893, -8210, 20920, -16210},
- { 5276, 16726, 10659, 19940, -4799, -19324},
- { -532, -9300, 27856, 4965, -241, 536},
- { -765, -20706, -3412, 18870, 2765, 1420},
- { -3059, 2708, -19022, -331, 3537, 116},
+static const int16_t vq_hebap6[256][6] = {
+{ 10154, 7365, 16861, 18681, -22893, -3636},
+{ -2619, -3788, -5529, -5192, -9009, -20298},
+{ -5583, -22800, 21297, 7012, 745, 720},
+{ 428, -1459, 109, -3082, 361, -8403},
+{ 8161, 22401, 241, 1755, -874, -2824},
+{ 1140, 12643, 2306, 22263, -25146, -17557},
+{ -2609, 3379, 10337, -19730, -15468, -23944},
+{ -4040, -12796, -25772, 13096, 3905, 1315},
+{ 4624, -23799, 13608, 25317, -1175, 2173},
+{ -97, 13747, -5122, 23255, 4214, -22145},
+{ 6878, -322, 18264, -854, -11916, -733},
+{ 17280, -12669, -9693, 23563, -16240, -1309},
+{ 5802, -4968, 19526, -21194, -24622, -183},
+{ 5851, -16137, 15229, -9496, -1538, 377},
+{ 14096, 25057, 13419, 8290, 23320, 16818},
+{ -7261, 118, -15867, 19097, 9781, -277},
+{ -4288, 21589, -13288, -16259, 16633, -4862},
+{ 4909, -19217, 23411, 14705, -722, 125},
+{ 19462, -4732, -1928, -11527, 20770, 5425},
+{ -27562, -2881, -4331, 384, -2103, 1367},
+{ -266, -9175, 5441, 26333, -1924, 4221},
+{ -2970, -20170, -21816, 5450, -7426, 5344},
+{ -221, -6696, 603, -9140, 1308, -27506},
+{ 9621, -8380, -1967, 9403, -1651, 22817},
+{ 7566, -5250, -4165, 1385, -990, 560},
+{ -1262, 24738, -19057, 10741, 7585, -7098},
+{ 451, 20130, -9949, -6015, -2188, -1458},
+{ 22249, 9380, 9096, 10959, -2365, -3724},
+{ 18668, -650, -1234, 11092, 7678, 5969},
+{ 19207, -1485, -1076, -731, -684, 43},
+{ -4973, 13430, 20139, 60, 476, -935},
+{ -20029, 8710, 2499, 1016, -1158, 335},
+{ -26413, 18598, -2201, -669, 3409, 793},
+{ -4726, 8875, -24607, -9646, 3643, -283},
+{ 13303, -21404, -3691, -1184, -1970, 1612},
+{ 173, 60, 919, 1229, 6942, -665},
+{ 16377, 16991, 5341, -14015, -2304, -20390},
+{ 25334, -10609, 11947, -7653, -6363, 14058},
+{ 23929, -13259, -7226, -937, 234, -187},
+{ 6311, -1877, 12506, -1879, 18751, -23341},
+{ 621, 6445, 3354, -24274, 8406, 5315},
+{ -3297, -5034, -4704, -5080, -25730, 5347},
+{ -1275, -13295, -965, -23318, 1214, 26259},
+{ -6252, 10035, -20105, 15301, -16073, 5136},
+{ 9562, -3911, -19510, 4745, 22270, -4171},
+{ 7978, -19600, 14024, -5745, -20855, 8939},
+{ 7, -4039, 991, -6065, 52, -19423},
+{ 3485, 2969, 7732, 7786, 25312, 6206},
+{ -959, -12812, -1840, -22743, 7324, 10830},
+{ -4686, 1678, -10172, -5205, 4294, -1271},
+{ 3889, 1302, 7450, 638, 20374, -3133},
+{ -12496, -9123, 18463, -12343, -7238, 18552},
+{ -6185, 8649, -6903, -895, 17109, 16604},
+{ -9896, 28579, 2845, 1640, 2925, -298},
+{ 14968, -25988, 14878, -24012, 1815, -6474},
+{ 26107, 5166, 21225, 15873, 21617, 14825},
+{ -21684, 16438, 20504, -14346, -7114, -4162},
+{ 28647, 90, -1572, 789, -902, -75},
+{ -1479, 2471, -4061, 3612, -2240, 10914},
+{ 8616, 17491, 17255, -17456, 17022, -16357},
+{ -20722, -18597, 25274, 17720, -3573, 1695},
+{ -997, 6129, -6303, 11250, -11359, -19739},
+{ -74, -4001, -1584, 13384, 162, -144},
+{ -529, 21068, 7923, -11396, 422, -26},
+{ 7102, -13531, -20055, 2629, -178, -429},
+{ 9201, 1368, -22238, 2623, -20499, 24889},
+{ -432, 6675, -266, 8723, 80, 28024},
+{ 19493, -3108, -9261, 1910, -21777, 5345},
+{ 14079, -11489, 12604, 6079, 19877, 1315},
+{ 10947, 9837, -18612, 15742, 4792, 605},
+{ -1777, 3758, -4087, 21696, 6024, -576},
+{ 3567, -3578, 16379, 2680, -1752, 716},
+{ -5049, -1399, -4550, -652, -17721, -3366},
+{ -3635, -4372, -6522, -22152, 7382, 1458},
+{ 12242, 19190, 5646, -7815, -20289, 21344},
+{ -7508, 19952, 23542, -9753, 5669, -1990},
+{ -2275, 15438, 10907, -17879, 6497, 13582},
+{ -15894, -15646, -4716, 6019, 24250, -6179},
+{ -2049, -6856, -1208, 918, 17735, -69},
+{ -3721, 9099, -16065, -23621, 5981, -2344},
+{ 7862, -8918, 24033, 25508, -11033, -741},
+{ -12588, 19468, 14649, 15451, -21226, 1171},
+{ 2102, 1147, 2789, 4096, 2179, 8750},
+{ -18214, -17758, -10366, -5203, -1066, -3541},
+{ -2819, -19958, -11921, 6032, 8315, 10374},
+{ -9078, -2100, 19431, -17, 732, -689},
+{ -14512, -19224, -7095, 18727, 1870, 22906},
+{ 3912, 659, 25597, -4006, 9619, 877},
+{ 2616, 22695, -5770, 17920, 3812, 20220},
+{ 2561, 26847, -5245, -10908, 2256, -517},
+{ -4974, 198, -21983, -3608, 22174, -18924},
+{ 21308, -1211, 19144, 16691, -1588, 11390},
+{ -1790, 3959, -3488, 7003, -7107, 20877},
+{ -6108, -17955, -18722, 24763, 16508, 3211},
+{ 20462, -24987, -20361, 4484, -5111, -478},
+{ -6378, -1998, -10229, -561, -22039, -22339},
+{ 3047, -18850, 7586, 14743, -19862, 6351},
+{ -5047, 1405, -9672, 1055, -21881, 11170},
+{ 3481, -9699, 6526, -16655, 22813, 21907},
+{ -18570, 17501, 14664, 1291, 5026, 19676},
+{ 16134, -19810, -16956, -17939, -16933, 5800},
+{ -8224, 4908, 8935, 2272, -1140, -23217},
+{ 1572, 2753, -1598, 2143, -3346, -21926},
+{ -9832, -1060, -27818, 1214, 7289, 150},
+{ 98, 1538, 535, 17429, -23198, -901},
+{ 21340, -20146, 3297, -1744, -8207, -21462},
+{ -4166, -4633, -17902, 5478, 1285, 136},
+{ 18713, 21003, 24818, 11421, 1282, -4618},
+{ -3535, 7636, -265, 2141, -829, -2035},
+{ -3184, 19713, 2775, -2, 1090, 104},
+{ -6771, -20185, 2938, -2125, -36, 1268},
+{ 9560, 9430, 9586, 22100, 13827, 6296},
+{ -535, -20018, 4276, -1868, -448, -17183},
+{ -24352, 14244, -13647, -21040, 2271, 11555},
+{ -2646, 15437, -4589, 18638, -4299, -622},
+{ -20064, 4169, 18115, -1404, 13722, -1825},
+{ -16359, 9080, 744, 22021, 125, 10794},
+{ 9644, -14607, -18479, -14714, 11174, -20754},
+{ -326, -23762, 6144, 7909, 602, 1540},
+{ -6650, 6634, -12683, 21396, 20785, -6839},
+{ 4252, -21043, 5628, 18687, 23860, 8328},
+{ 17986, 5704, -5245, -18093, -555, 3219},
+{ 6091, 14232, -5117, -17456, -19452, -11649},
+{ -21586, 11302, 15434, 25590, 6777, -26683},
+{ 21355, -8244, 5877, -3540, 6079, -2567},
+{ 2603, -2455, 5421, -12286, -19100, 5574},
+{ -1721, -26393, -23664, 22904, -349, 3787},
+{ 2189, -1203, 5340, 3249, -22617, 104},
+{ -1664, -11020, -2857, -20723, -24049, 19900},
+{ 22873, -7345, -18481, -14616, -8400, -12965},
+{ 3777, 3958, 8239, 20494, -6991, -1201},
+{ -160, -1613, -793, -8681, 573, 776},
+{ 4297, -3786, 20373, 6082, -5321, -18400},
+{ 18745, 2463, 12546, -7749, -7734, -2183},
+{ 11074, -4720, 22119, 1825, -24351, 4080},
+{ 1503, -19178, -1569, 13, -313, 375},
+{ 318, -575, 2544, 178, 102, 40},
+{ -15996, -26897, 5008, 3320, 686, 1159},
+{ 25755, 26886, 574, -5930, -3916, 1407},
+{ -9148, -7665, -2875, -8384, -18663, 26400},
+{ -7445, -18040, -18396, 8802, -2252, -21886},
+{ 7851, 11773, 27485, -12847, -1410, 19590},
+{ 2240, 5947, 11247, 15980, -6499, 24280},
+{ 21673, -18515, 9771, 6550, -2730, 334},
+{ -4149, 1576, -11010, 89, -24429, -5710},
+{ 7720, 1478, 21412, -25025, -8385, 9},
+{ -2448, 10218, -12756, -16079, 1161, -21284},
+{ -8757, -14429, -22918, -14812, 2629, 13844},
+{ -7252, 2843, -9639, 2882, -14625, 24497},
+{ -674, -6530, 414, -23333, -21343, 454},
+{ 2104, -6312, 10887, 18087, -1199, 175},
+{ -493, -562, -2739, 118, -1074, 93},
+{ -10011, -4075, -28071, 22180, 15077, -636},
+{ -4637, -16408, -9003, -20418, -11608, -20932},
+{ 4815, 15892, 24238, -13634, -3074, -1059},
+{ -6724, 4610, -18772, -15283, -16685, 23988},
+{ 15349, -674, -3682, 21679, 4475, -12088},
+{ 4756, 2593, 5354, 6001, 15063, 26490},
+{ -23815, -17251, 6944, 378, 694, 670},
+{ 23392, -8839, -14713, 7544, -876, 11088},
+{ 3640, 3336, 22593, -3495, -2328, -113},
+{ 284, 6914, 3097, 10171, 6638, -18621},
+{ 2472, 5976, 11054, -11936, -603, -663},
+{ 16175, 16441, 13164, -4043, 4667, 7431},
+{ 19338, 15534, -6533, 1681, -4857, 17048},
+{ 17027, 532, -19064, -1441, -5130, 1085},
+{ -12617, -17609, 2062, -25332, 19009, -16121},
+{ 10056, -21000, -13634, -2949, 15367, 19934},
+{ -648, -1605, 10046, -1592, 13296, 19808},
+{ -1054, 10744, 538, 24938, 9630, -9052},
+{ -10099, 3042, -25076, -24052, 13971, 100},
+{ 6547, 6907, 7031, 10348, 23775, -17886},
+{ -22793, -1984, -1393, -3330, 9267, 14317},
+{ -14346, -3967, 3042, 16254, -17303, 9646},
+{ -21393, 23628, 16773, 716, 2663, 114},
+{ -19016, -3038, 1574, -245, 1463, -793},
+{ 22410, 23441, -14637, -530, 17310, 13617},
+{ -11582, 7935, -13954, 23465, -24628, 26550},
+{ -1045, 3679, -2218, 10572, 20999, -3702},
+{ -15513, 197, 16718, -24603, 4945, 5},
+{ 10781, 4335, 26790, -9059, -16152, -2840},
+{ 16075, -24100, -3933, -6833, 12645, -7029},
+{ 2096, -25572, -8370, 6814, 11, 1178},
+{ -11848, -583, -8889, -20543, -10471, -380},
+{ -2487, 24777, -21639, -19341, 1660, -732},
+{ 2313, 13679, 4085, 24549, 24691, -21179},
+{ -2366, -504, -4130, -10570, 23668, 1961},
+{ 20379, 17809, -9506, 3733, -18954, -6292},
+{ -3856, 16802, -929, -20310, -17739, 6797},
+{ 12431, 6078, -11272, -14450, 6913, 23476},
+{ 7636, -1655, 23017, 10719, -8292, 838},
+{ -8559, -1235, -18096, 3897, 16093, 1490},
+{ -3586, 8276, 15165, -3791, -21149, 1741},
+{ -4497, 21739, 2366, -278, -4792, 15549},
+{ -23122, -13708, 7668, 16232, 24120, 15025},
+{ -20043, 12821, -20160, 16691, -11655, -16081},
+{ -12601, 20239, 3496, -2549, -6745, -11850},
+{ 4441, 7812, 20783, 17080, 11523, -9643},
+{ 24766, 8494, -23298, -3262, 11101, -7120},
+{ -10107, -7623, -22152, -18303, 26645, 9550},
+{ -25549, 477, 7874, -1538, 1123, -168},
+{ 470, 9834, -347, 23945, -10381, -9467},
+{ -4096, -9702, -6856, -21544, 20845, 7174},
+{ 5370, 9748, -23765, -1190, 512, -1538},
+{ -1006, -10046, -12649, 19234, -1790, -890},
+{ 15108, 23620, -15646, -2522, -1203, -1325},
+{ -7406, -2605, 1095, -247, -473, 177},
+{ 8089, 4, 12424, -22284, 10405, -7728},
+{ 22196, 10775, -5043, 690, 534, -212},
+{ -3153, -1418, -16835, 18426, 15821, 22956},
+{ 5681, -2229, 3196, -3414, -21817, -14807},
+{ 19, 787, 1032, 170, -8295, -645},
+{ -882, -2319, -27105, 432, -4392, 1499},
+{ -1354, -11819, -76, -20380, -10293, 11328},
+{ 211, -4753, -4675, -6933, -13538, 14479},
+{ 6043, 5260, -459, -462, 143, -65},
+{ -2572, 7256, -3317, 9212, -23184, -9990},
+{ -24882, -9532, 18874, 6101, 2429, -14482},
+{ 8314, 2277, 14192, 3512, 25881, 22000},
+{ 208, 20218, -281, -24778, -63, -1183},
+{ 1095, -6034, 2706, -21935, -2655, 563},
+{ 23, -5930, 243, -8989, 5345, 20558},
+{ -15466, 12699, 4160, 11087, 20621, -10416},
+{ 20995, -85, -8468, 194, 1003, -9515},
+{ -19637, -3335, -14081, 3574, -23381, -667},
+{ -2076, 3489, -3192, -19367, 539, -1530},
+{ 7352, -15213, 22596, 19369, 1043, 16627},
+{ -1872, -413, 1235, -5276, -3550, 21903},
+{ 7931, -2008, 16968, -6799, 29393, -2475},
+{ -13589, 8389, -23636, -22091, -14178, -14297},
+{ -11575, -20090, 16056, -1848, 15721, 4500},
+{ 3849, -16581, 20161, -21155, 7778, 11864},
+{ -6547, -1273, -18837, -11218, 11636, 1044},
+{ 2528, -6691, -17917, -11362, -4894, -1008},
+{ 1241, 4260, 2319, 6111, 3485, 20209},
+{ 3014, -3048, 5316, -4539, 20831, 8702},
+{ -1790, -14683, 278, 13956, -10065, -10547},
+{ -22732, -7957, -1154, 13821, -1484, -1247},
+{ -7317, -615, 13094, 18927, 9897, 1452},
+{ 2552, -2338, 3424, -4630, 11124, -19584},
+{ -11125, -20553, -10855, -10783, -20767, 6833},
+{ 984, -15095, 5775, 25125, 5377, -19799},
+{ 517, 13272, -7458, -1711, 20612, -6013},
+{ -21417, 13251, -20795, 13449, 17281, 13104},
+{ -15811, -16248, 23093, -4037, -8195, 871},
+{ 582, 12571, -21129, -14766, -9187, 5685},
+{ 4318, -1776, 11425, -17763, -9921, 577},
+{ 6013, 16830, 17655, -25766, -4400, -3550},
+{ -13744, -16541, 3636, -3330, -21091, -15886},
+{ 6565, -11147, 8649, -13114, 23345, -13565},
+{ -2542, -9046, -7558, 29240, 3701, -383},
+{ -10612, 24995, 1893, -8210, 20920, -16210},
+{ 5276, 16726, 10659, 19940, -4799, -19324},
+{ -532, -9300, 27856, 4965, -241, 536},
+{ -765, -20706, -3412, 18870, 2765, 1420},
+{ -3059, 2708, -19022, -331, 3537, 116},
};
-static const int16_t vq_hebap7[512][6] =
-{
- { -21173, 21893, 10390, 13646, 10718, -9177},
- { -22519, -8193, 18328, -6629, 25518, -10848},
- { 6800, -13758, -13278, 22418, 14667, -20938},
- { 2347, 10516, 1125, -3455, 5569, 27136},
- { -6617, 11851, -24524, 22937, 20362, -6019},
- { -21768, 10681, -19615, -15021, -8478, -2081},
- { -2745, 8684, -4895, 27739, 7554, -11961},
- { -1020, 2460, -954, 4754, -627, -16368},
- { -19702, 23097, 75, -13684, -2644, 2108},
- { 4049, -2872, 5851, -4459, 22150, 12560},
- { -21304, -17129, -730, 7419, -11658, -10523},
- { 11332, 1792, 26666, 23518, -19561, -491},
- { -17827, -16777, -13606, -14389, -22029, -2464},
- { 1091, -5967, -7975, -16977, -20432, -21931},
- { 18388, -1103, 1933, 13342, -17463, 18114},
- { 22646, 17345, -9966, 17919, 18274, 698},
- { 1484, 20297, -5754, -26515, 4941, -22263},
- { -2603, 4587, -5842, 18464, 8767, -2568},
- { -2797, -1602, 21713, 3099, -25683, 3224},
- { -19027, 4693, -5007, 6060, 1972, -15095},
- { -2189, 9516, -530, 20669, -4662, -8301},
- { -22325, -8887, 2529, -11352, 5476, 998},
- { 22100, -5052, 1651, -2657, 4615, 2319},
- { 20855, -3078, -3330, 4105, 13470, 3069},
- { 85, 17289, 10264, -14752, 214, 90},
- { -26365, -18849, -19352, 19244, -10218, 9909},
- { -9739, 20497, -6579, -6983, 2891, -738},
- { 20575, -15860, -22913, 6870, 76, 327},
- { 8744, -12877, -22945, -2372, -19424, -9771},
- { -12886, 16183, 21084, 3821, 749, -13792},
- { -15995, 18399, 2391, -17661, 19484, -6018},
- { 1423, 11734, 4051, 19290, 6857, -19681},
- { -5200, 9766, 18246, 2463, 18764, -4852},
- { -597, 19498, 1323, -9096, -308, -1104},
- { -3099, -25731, -15665, 25332, 4634, 2635},
- { 19623, -2384, -7913, 11796, -9333, -14084},
- { 2642, 26453, -21091, -10354, -1693, -1711},
- { 22031, 21625, 11580, -22915, -4141, 129},
- { -6122, 3542, 915, -261, -17, -383},
- { 1696, 6704, -1425, 20838, 857, -4416},
- { 1423, -15280, -8550, -9667, 5210, 5687},
- { -4520, -613, -11683, 5618, 4230, 619},
- { 937, -4963, -14102, -17104, -6906, -5952},
- { -15068, -481, -7237, -14894, 18876, 21673},
- { -25658, 2910, 1143, -327, -458, -995},
- { -9656, -819, -24900, 2804, 20225, 1083},
- { -1111, -3682, -1788, -19492, 966, 821},
- { 7293, -21759, 10790, -7059, -23293, -1723},
- { -282, -11093, 170, -20950, -28926, 12615},
- { 17938, 3713, -1563, 885, 5, 564},
- { 6116, 22696, 2242, -6951, 9975, -6132},
- { 4338, 26808, -3705, 1976, -1079, -2570},
- { -661, -7901, -2668, -15194, 17722, 4375},
- { -4174, -11053, 717, -22506, 1562, 12252},
- { -6405, 18334, 6103, 6983, 5956, 18195},
- { 9851, 5370, 23604, -6861, -6569, -62},
- { 21964, 13359, -683, 3785, 2168, 209},
- { -3569, -1127, -19724, -1544, 1308, -803},
- { -3083, 16049, -13791, -3077, 4294, 23713},
- { -9999, 9943, -15872, 12934, -23631, 21699},
- { 9722, 22837, 12192, 15091, 5533, 4837},
- { 2243, 2099, 1243, 4089, 4748, 12956},
- { 4007, -2468, 3353, -3092, 8843, 17024},
- { 4330, 6127, 5549, 9249, 11226, 28592},
- { -9586, -8825, 236, 1009, 455, -964},
- { 6829, 19290, -1018, 200, 1821, 578},
- { 5196, 957, 10372, 3330, -12800, -127},
- { -3022, -8193, -14557, 22061, 5920, 1053},
- { 10982, 25942, -24546, -23278, -11905, -6789},
- { 22667, -11010, 5736, 2567, 23705, -10253},
- { -3343, -4233, -5458, 20667, -10843, -3605},
- { -4131, -3612, 4575, -829, -350, -847},
- { -3303, 3451, -7398, -11604, 3023, 455},
- { 3200, -9547, 3202, -22893, 11184, -26466},
- { -14093, -4117, 15382, 14295, -10915, -20377},
- { 3807, -11016, 22052, 14370, -15328, -7733},
- { -6291, -17719, -1560, 12048, -19805, -443},
- { -6147, -4234, -160, 8363, 22638, 11911},
- { 19197, 1175, 7422, -9875, -4136, 4704},
- { -72, -7652, -112, -11955, -3230, 27175},
- { 3274, 5963, 7501, -17019, 866, -25452},
- { 737, 1861, 1833, 2022, 2384, 4755},
- { -5217, 7512, 3323, 2715, 3065, -1606},
- { 4247, 565, 5629, 2497, 18019, -4920},
- { -2833, -17920, -8062, 15738, -1018, 2136},
- { 3050, -19483, 16930, 29835, -10222, 15153},
- { -11346, 118, -25796, -13761, 15320, -468},
- { -4824, 4960, -4263, 1575, -10593, 19561},
- { -8203, -1409, -763, -1139, -607, 1408},
- { -2203, -11415, 2021, -6388, -2600, 711},
- { -413, -2511, -216, -3519, -28267, 1719},
- { -14446, 17050, 13917, 13499, -25762, -16121},
- { 19228, 7341, -12301, 682, -3791, -199},
- { -4193, 20746, -15651, 11349, 5860, -824},
- { -21490, -3546, -3, -1705, -3959, 9213},
- { 15445, -1876, 2012, -19627, 16228, -4845},
- { -2867, -3733, -7354, -175, -20119, 11174},
- { -3571, -24587, 19700, 6654, 979, -654},
- { 21820, -7430, -6639, -10767, -8362, 15543},
- { 14827, 17977, -7204, -3409, 1906, -17288},
- { 3525, -3947, -1415, -2798, 17648, 2082},
- { -6580, -15255, -17913, 1337, 15338, 21158},
- { 6210, 9698, 15155, -24666, -22507, -3999},
- { -1740, -593, 1095, -7779, 25058, 5601},
- { 21415, -432, -1658, -6898, -1438, -14454},
- { -6943, 700, -12139, -745, -24187, 22466},
- { 6287, 3283, 11006, 3844, 19184, 14781},
- { -22502, 15274, 5443, -2808, -970, -3343},
- { 3257, -3708, 4744, -8301, 22814, -10208},
- { 24346, -20970, 19846, 987, -11958, -6277},
- { 3906, -19701, 13060, -1609, 18641, 7466},
- { -26409, -22549, 16305, 2014, 10975, 18032},
- { -7039, 4655, -14818, 18739, 15789, 1296},
- { 9310, -1681, 14667, -3326, 26535, -11853},
- { 5728, 5917, 13400, 10020, -2236, -24704},
- { 1741, -6727, 12695, -22009, 4080, 5450},
- { -2621, 9393, 21143, -25938, -3162, -2529},
- { 20672, 18894, -13939, 6990, -8260, 15811},
- { -23818, 11183, -13639, 11868, 16045, 2630},
- { 18361, -10220, 829, 856, -1010, 157},
- { 14400, -4678, 5153, -13290, -27434, -11028},
- { 21613, 11256, 17453, 7604, 13130, -484},
- { 7, 1236, 573, 4214, 5576, -3081},
- { 916, -9092, 1285, -8958, 1185, -28699},
- { 21587, 23695, 19116, -2885, -14282, -8438},
- { 23414, -6161, 12978, 3061, -9351, 2236},
- { -3070, -7344, -20140, 5788, 582, -551},
- { -3993, 315, -7773, 8224, -28082, -12465},
- { 13766, -15357, 19205, -20624, 13043, -19247},
- { 3777, -177, 8029, -1001, 17812, 5162},
- { -7308, -4327, -18096, -620, -1350, 14932},
- { 14756, -1221, -12819, -14922, -547, 27125},
- { 2234, 1708, 2764, 5416, 7986, -25163},
- { 2873, 3636, 3992, 5344, 10142, 21259},
- { 1158, 5379, 508, -10514, 290, -1615},
- { 1114, 24789, 16575, -25168, -298, -2832},
- { -1107, -6144, -1918, -7791, -2971, -23276},
- { 4016, 10793, 17317, -4342, -20982, -3383},
- { -4494, -207, -9951, -3575, 7947, 1154},
- { -7576, 8117, -14047, 16982, -26457, -27540},
- { -15164, 16096, -16844, -8886, -23720, 15906},
- { 24922, 5680, -1874, 420, 132, 117},
- { -506, -19310, -198, 412, -311, 752},
- { -1906, 3981, -7688, 16566, -19291, -14722},
- { -399, -729, -3807, -4196, -12395, 7639},
- { 3368, 2330, 9092, 23686, -10290, -1705},
- { -3148, 2596, -7986, 14602, -4807, 16627},
- { 8057, 1481, 49, 17205, 24869, 7474},
- { -19304, -513, 11905, 2346, 5588, 3365},
- { -5063, -21812, 11370, 10896, 4881, 261},
- { 4794, 20577, 5109, -6025, -8049, -1521},
- { 8125, -14756, 20639, -14918, 23941, -3650},
- { 12451, 1381, 3613, 8687, -24002, 4848},
- { 6726, 10643, 10086, 25217, -25159, -1065},
- { 6561, 13977, 2911, 21737, 16465, -26050},
- { -1776, 2575, -19606, -16800, 3032, 6679},
- { 15012, -17910, -8438, -21554, -27111, 11808},
- { 3448, -924, -15913, -1135, 5126, -20613},
- { 7720, 2226, 17463, 5434, 28942, 17552},
- { 1246, 15614, -11743, 24618, -17539, 3272},
- { 3215, 17950, 2783, -722, -22672, 5979},
- { -5678, -3184, -26087, 26034, 6583, 3302},
- { 20310, -3555, -2715, -444, -1487, 1526},
- { -20640, -21970, -12207, -25793, 8863, -1036},
- { 17888, 570, -16102, 8329, -2553, 15275},
- { -2677, 9950, -1879, 16477, -12762, -29007},
- { -120, -2221, 219, 97, 365, 35},
- { 1270, -718, 1480, -2689, 1930, -7527},
- { 1896, 8750, 1906, 18235, -12692, -6174},
- { -3733, 13713, -9882, -15960, -1376, -7146},
- { -10600, 8496, 15967, -8792, 7532, 20439},
- { 3041, -13457, 1032, -26952, 5787, 24984},
- { -4590, -8220, -9322, -6112, -17243, 25745},
- { -17808, 6970, 3752, 626, -114, 2178},
- { 4449, -4862, 7054, -5404, 4738, -2827},
- { 4922, -651, 18939, -9866, 848, 1886},
- { -336, -5410, 7234, 20444, -9583, -600},
- { 781, -19474, -12648, 6634, 1414, 450},
- { -3399, -16770, 11107, 13200, -5498, 21663},
- { -3265, 4859, -5961, 7530, -10837, 28086},
- { 10350, -12901, 25699, 25640, -639, 351},
- { 1163, 18763, -5466, -15087, -145, -1377},
- { -14477, 27229, -31383, -32653, 21439, -2894},
- { 15420, 18823, 22128, 19398, 22583, 13587},
- { -10674, 10710, 5089, -4756, 909, -20760},
- { -12948, -20660, 7410, 2722, 3427, 11585},
- { -1105, 18374, 19731, -9650, 22442, 19634},
- { -296, -6798, -14677, 21603, 19796, 21399},
- { -19350, -7501, 25446, 13144, 8588, -25298},
- { 3092, -10618, 20896, 9249, -3326, 1796},
- { -811, 1449, 3106, 4748, 12073, -14262},
- { -20720, 14275, -4332, -25838, -5781, -21149},
- { -5132, 10554, -14020, -22150, 2840, -554},
- { 25533, 17648, 14886, -21074, 2459, 25142},
- { -9370, -1788, -12862, -5870, -25811, -11023},
- { 6698, 819, 10313, 166, 27581, 523},
- { 101, -19388, 3413, 9638, 64, 806},
- { -2742, -17931, -2576, 22818, 8553, 1126},
- { 2972, 15203, 1792, 25434, -5728, -17265},
- { -1419, 1604, 4398, 11452, 1731, 23787},
- { -5136, 4625, -10653, 27981, 9897, -2510},
- { -10528, -28033, 2999, -1530, -832, -830},
- { -11133, -12511, 22206, -7243, -23578, -21698},
- { 16935, -21892, 1861, -9606, 9432, 19026},
- { 10277, 9516, 26815, 2010, -4943, -9080},
- { 5547, -2210, 14270, -15300, -19316, 1822},
- { -4850, -783, -8959, -3076, -20056, -3197},
- { 8232, -2794, -17752, 13308, 3229, -991},
- { -12237, -6581, 10315, -9552, 2260, -20648},
- { -7000, 5529, -7553, -7490, -10342, -10266},
- { 3641, 19479, -5972, -19097, -18570, 12805},
- { 1283, -4164, 4198, -28473, -2498, 1866},
- { 16047, 26826, -13053, -6316, 985, -1597},
- { -403, 13680, 6457, 25070, 27124, -20710},
- { -18070, -1790, -24986, 5953, -954, 26600},
- { -24224, -15383, 24788, 1953, -1136, 187},
- { -2289, 12505, -20738, -904, 18324, 21258},
- { 2658, -6140, 16179, 22276, -556, 2154},
- { -6087, 13950, -25682, -27713, 4049, -4795},
- { -21452, 26473, 19435, -9124, 895, 303},
- { -22200, -26177, -6026, 24729, -22926, -9030},
- { -14276, -15982, 23732, -22851, 9268, -3841},
- { 29482, 21923, -6213, 1679, -2059, -1120},
- { -435, 9802, -3891, 12359, -4288, -18971},
- { 19768, -86, 2467, 1990, -1021, -5354},
- { 20986, -8783, -5329, -23562, -4730, 2673},
- { -5095, 5605, -4629, 19150, 26037, -12259},
- { 972, 6858, 4551, 27949, -4025, -2272},
- { 6075, -3260, -4989, -373, -1571, -3730},
- { -7256, -12992, -8820, -5109, 23054, 5054},
- { 920, 2615, 7912, -7353, -4905, 20186},
- { -250, 5454, 3140, 6928, -18723, -2051},
- { -10299, -4372, 19608, 4879, -661, -1885},
- { 14816, -8603, -19815, 6135, -21210, 14108},
- { -11945, -2223, 5018, 11892, 22741, 406},
- { -13184, -2613, -13256, -22433, -12482, -8380},
- { 17066, 25267, -2273, 5056, -342, 145},
- { 8401, -17683, 19112, 10615, -19453, 17083},
- { 20821, -5700, 12298, -25598, 10391, 7692},
- { 4550, 15779, 17338, -19379, -4768, 1206},
- { -7723, 10836, -27164, -11439, 6835, -1776},
- { 2542, 3199, 4442, 17513, -3711, -914},
- { 20960, -16774, -5814, 11087, -70, 22961},
- { 3305, 2919, 6256, -4800, -20966, -3230},
- { 5924, -16547, 2183, 2733, 3446, -23306},
- { -6061, -194, -13852, -10971, 19488, 1029},
- { 4467, -5964, -19004, 1519, -359, 855},
- { -1581, -7607, 22070, -11580, -10032, 17102},
- { -12412, 2553, 4324, 22500, 5751, 12170},
- { -25127, 17996, -6384, 1180, 1182, 9622},
- { 23462, -8471, -4392, -2669, 7638, -16835},
- { -5511, -2887, -10757, -20883, 7246, 1053},
- { 2703, -20602, -7554, 7516, -7740, 5868},
- { 20670, 21901, 457, 14969, -17657, -11921},
- { 3603, -1595, -2177, -157, -43, 605},
- { 2513, 8954, 10527, 22559, -16100, -16041},
- { 6002, 4951, 6795, -4862, -22400, 18849},
- { 7590, -1693, -24688, -3404, 14169, 1214},
- { -4398, -6663, -6870, -10083, -24596, 9253},
- { 10468, 17751, -7748, 147, -6314, 4419},
- { 16187, -16557, -4119, 4302, 7625, 5409},
- { 3303, 2735, 7458, -19902, -2254, -3702},
- { -2077, 21609, 14870, 12545, -6081, -1764},
- { 4678, 11740, 2859, 6953, 1919, -3871},
- { 3522, -21853, -2469, -10453, 18893, -10742},
- { 3759, -10191, -4866, -2659, -17831, -1242},
- { 14991, 9351, 11870, -1573, -4848, 22549},
- { 9509, -27152, 10734, 20851, -26185, -17878},
- { -7170, -1392, -19495, 12746, 8198, -1988},
- { 1883, 28158, -846, -7235, 249, 233},
- { -7200, 669, -371, -2948, 23234, -5635},
- { 3141, 288, 3223, -1258, -98, -27607},
- { 17373, -23235, 5110, -11199, -2574, -11487},
- { -4928, 1518, -5456, 670, -18278, 1951},
- { 10334, -19865, -4649, 361, -160, -923},
- { 18732, 14264, -3155, -7485, -3328, 5959},
- { -3614, 21077, 7276, 3536, 8121, -1528},
- { -8422, 500, -19182, 18929, 26392, -1039},
- { 15639, 25668, 8375, 1903, 1945, -11979},
- { -2716, 3389, 26850, -4587, 1803, 22},
- { 1177, -655, 1233, -2128, 7844, 1767},
- { -761, 8209, -19290, -4593, 1923, -343},
- { -689, -3530, -3267, -3804, -2753, 18566},
- { -2110, 1962, -1353, 16643, 2765, -23102},
- { -433, 4905, 302, 13016, 15933, -5905},
- { 3203, 4126, 11181, -5496, -2529, -1160},
- { -1091, -6469, -1415, 5682, -268, 583},
- { -9405, -19572, 6216, 1658, 993, -75},
- { -1695, -4504, -2289, -4088, -6556, -16577},
- { 4760, -892, -10902, 6516, 24199, -6011},
- { -253, 1000, 63, -81, -115, -382},
- { -1333, 24224, -698, -4667, -2801, -19144},
- { -876, -28866, -21873, 12677, -6344, 3235},
- { 16847, 21145, -26172, -3183, -396, 230},
- { 18296, -7790, -12857, -679, -1473, 5},
- { -10488, 11429, 25805, -1122, 1401, -438},
- { 3782, -7429, 26720, 17567, 19257, 12542},
- { 6332, -746, 12789, 9316, -22542, -5354},
- { 3418, -22728, 26978, 18303, 1076, 956},
- { -27315, -2988, 920, 235, 2233, 81},
- { 6199, 5296, 16093, 14768, -8429, -1112},
- { -6432, 19244, 9921, -3253, 1278, -954},
- { 24213, 2049, -22931, 2585, -2410, -4216},
- { 9286, 14282, -19735, -3985, -2344, 1028},
- { -20128, 17993, -9458, 23012, -16983, 8625},
- { -6896, -20730, 3762, 17415, 22341, 19024},
- { 842, 24181, 25062, -5839, -78, 937},
- { -621, 19722, -24204, -1962, -14854, -56},
- { 22766, -5119, 17365, 23868, -19480, -6558},
- { -2158, 17490, -21435, 3340, -12819, -20295},
- { -9621, 17325, 715, 2265, -4123, -492},
- { 9156, 12947, 27303, -21175, -6072, -9457},
- { -13164, -23269, -14006, -4184, 6978, 2},
- { 938, -13381, 3520, -24297, 22902, 19589},
- { -4911, -19774, 19764, -9310, -12650, 3819},
- { -5462, -4249, -6987, -6260, -13943, -25150},
- { 9341, 10369, -13862, -6704, 22556, -519},
- { 6651, 18768, -4855, 12570, 14730, -10209},
- { -823, 18119, 398, -1582, -116, -363},
- { -6935, -12694, -28392, 8552, 6961, -239},
- { -2602, -4704, -1021, 2015, 5129, 23670},
- { -12559, -8190, -25028, 18544, 14179, 1663},
- { 3813, 21036, -9620, -5051, -1800, -1087},
- { -22057, 16675, 14960, 9459, 2786, 16991},
- { -26040, -19318, -6414, 1104, 5798, -18039},
- { -1737, 24825, 10417, -11087, 896, -5273},
- { -1855, 11661, -2803, 24809, -21435, -19792},
- { -23473, -16729, -5782, 5643, 2636, 4940},
- { -1724, 4388, -26673, -13695, 10570, -25895},
- { 15358, -19496, 26242, -18493, 1736, 8054},
- { 5684, 20890, 4091, -19100, -14588, -10468},
- { 17260, -16291, 14859, -17711, -19174, 12435},
- { -27185, -12573, 6743, -562, 976, -257},
- { 12395, -8618, -22248, -19843, 11013, 7762},
- { 3799, 11853, -27622, -8473, 1089, -1495},
- { 4141, -2182, -26720, -735, -774, 1469},
- { 3125, 13762, 4606, 29257, 18771, -9958},
- { -17465, -9445, -17562, -2530, -6435, -3726},
- { -1742, 4351, -6841, -19773, 9627, -10654},
- { 7251, 3525, 10835, 5601, 25198, -23348},
- { -10300, -17830, 631, 11640, 2044, -20878},
- { -873, -8502, -1063, -15674, -10693, 14934},
- { -15957, 28137, 5268, 477, -1053, 1158},
- { -1495, -8814, -5764, -24965, 25988, 7907},
- { -1038, -114, -2308, -1319, -6480, 1472},
- { 4895, -17897, -25850, 5301, -188, 1581},
- { 3200, 17225, 4346, 22101, -18543, 22028},
- { -10250, 545, -10932, 2276, -28070, 8118},
- { 15343, 2329, 9316, 20537, 14908, 21021},
- { 6329, 6130, -24508, 837, -8637, -5844},
- { 7386, -501, 10503, 20131, 11435, -4755},
- { -2745, 24174, -9274, 15273, -8389, -5835},
- { 2992, -2864, 6048, -7473, 11687, -19996},
- { -883, -11954, -9976, -21829, -4436, -27178},
- { 3458, 19626, 1280, 2597, 19849, 5255},
- { -5315, 19133, -14518, -8946, 13749, -1352},
- { 18642, 17655, 11001, 6817, -18418, 6336},
- { -1697, 2244, -4640, 3948, -12890, -5273},
- { 20428, 10542, 4170, -1012, 19439, 21691},
- { -2943, -19735, -4208, 1320, 909, -8897},
- { 9351, -8066, -2618, -12933, 26582, 3507},
- { 9705, -22628, 8311, 8167, -13293, 5608},
- { 3222, 3749, -1508, 165, -52, -196},
- { 102, -22744, -8832, 903, -11421, -14662},
- { -120, 5998, 19765, 13401, 3628, 5197},
- { 8528, 5827, -1066, 774, -39, -166},
- { 9411, -9476, 9581, -13004, 24456, 24900},
- { 17878, 2235, -21639, 20478, 4716, -7190},
- { -2482, 9511, 1611, -21943, 14230, -1289},
- { 9288, -2291, 23215, -3452, -10842, 11},
- { 9496, 3041, 5130, -3890, -21219, -22589},
- { 14262, -9838, 20195, 14019, 91, -17200},
- { -18591, 980, 17, 821, 120, -574},
- { 12285, -19269, 13742, 16373, -161, 6025},
- { -3364, 1530, -4005, 2454, -10872, -23839},
- { 105, 5085, -260, 5790, -588, 19170},
- { 4121, 4169, 13439, 14644, 20899, 7434},
- { -175, 13101, -3704, 23233, 3907, 10106},
- { -6101, 23467, 5204, -1341, 1599, 13174},
- { -3217, -3494, 15117, -8387, -11762, -4750},
- { 1146, 4675, -19378, 14917, -5091, 249},
- { -21506, 10136, -16473, -13305, 18382, -8601},
- { 628, 2447, 3344, 3130, -5115, 119},
- { 17900, -22422, -17633, 21967, -16293, -7676},
- { 16863, 24214, 5612, -3858, -809, 3822},
- { -2291, 10091, -2360, -25109, -1226, 312},
- { 2957, 11256, 26745, -13266, -3455, -1128},
- { -19762, -2708, 4604, 6355, 1638, 25501},
- { -19593, -7753, 3159, -85, -489, -1855},
- { 814, 12510, 19077, -4681, -2610, -1474},
- { -23408, -19027, 8137, 19878, 7912, -282},
- { 839, -19652, 11927, 27278, -3211, 2266},
- { 4020, -1110, 8226, -1274, 20922, 25060},
- { 26576, 325, -8693, -232, -2218, -699},
- { -11293, -4200, 1805, -6673, -22940, -1339},
- { -2005, -15886, -1047, -27687, -13235, 14370},
- { -22073, 1949, 13175, -15656, -1846, 8055},
- { 3039, 12025, 7132, -24632, 413, -2347},
- { -24048, -206, 12459, -6654, -417, -10091},
- { 18179, -23688, -20515, -16396, 7230, 763},
- { 5659, -5085, 13878, -23729, -11077, -19587},
- { 11340, 501, 25040, 7616, -19658, 1605},
- { -26650, 8878, 10544, 417, 1299, 261},
- { 14460, 11369, -3263, 9990, 8194, 18111},
- { 1355, -20838, -9196, -16060, -8559, -730},
- { -1918, -20937, -18293, -2461, -2651, 4316},
- { -2810, 24521, -10996, -25721, 308, -1234},
- { -9075, -17280, -1833, -29342, -24213, -16631},
- { -2843, 10165, -5339, -2888, 21858, -21340},
- { -15832, 14849, -23780, 5184, 10113, -20639},
- { -19535, -11361, 8413, 1486, -23658, -5759},
- { -7512, 1027, -20794, 13732, 19892, -21934},
- { -12132, -7022, -19175, -8840, 22125, -16490},
- { 1937, 5210, -6318, -23788, 13141, 11082},
- { -205, 6036, -380, 8658, -233, 28020},
- { -5523, 7477, 7635, 23595, 9763, -2590},
- { 21658, -28313, -3086, -300, -1032, 1744},
- { -22352, 16646, 208, 6665, -17400, -3028},
- { 18482, 9336, -2737, -19372, 407, -4389},
- { -4913, -17370, 18819, -17654, 13416, 15232},
- { 7749, 6368, 23135, -18174, 7584, -4248},
- { -1489, -6523, 586, -10157, 14964, 25568},
- { 3844, -6156, 4897, -13045, -22526, 5647},
- { -8491, -2105, -24774, 905, -9326, 1456},
- { -3040, -1476, 1166, -4428, 11236, 9204},
- { 3397, -1451, 13598, -15841, 24540, 5819},
- { 8483, -2993, 21547, -16916, 7741, 24018},
- { -14932, -23758, -5332, -6664, -4497, 13267},
- { 19379, 12916, -2142, -737, 21100, -22101},
- { 3393, -4629, 5735, -18913, -6969, 2687},
- { 1148, -16147, -21433, -28095, -630, -14449},
- { 7300, 672, 18530, -17452, -10149, 351},
- { 11356, -10974, 17212, 4624, 145, 17791},
- { -711, -3479, -2238, 15887, 2027, 0},
- { -28048, 1794, -593, -2758, -21852, 11535},
- { -19683, 4937, 22004, 21523, -3148, 1790},
- { 813, 8231, 2633, 11981, -3043, 22201},
- { 8952, -24760, -690, 14873, -2366, -5372},
- { 8406, -5439, -274, -642, -145, 778},
- { -6605, 7258, 20780, -23507, -18625, 22782},
- { -22896, -25488, 10020, -1614, 1508, -1393},
- { 7607, 407, -24678, -16385, -1804, -4699},
- { -10592, -19139, 10462, -3747, 8721, -6919},
- { 13010, 5292, -6230, -4884, -20904, -1797},
- { 16891, -13770, -465, 19343, -10741, -12959},
- { 25193, -14799, -5681, -521, -321, -1211},
- { 6917, -3093, 20183, -26903, -12026, 1295},
- { 305, 1992, 19457, -985, 25, -521},
- { 6707, -3698, 8365, -8687, 21921, -27166},
- { 4668, 5997, 7117, 11696, 24401, -10794},
- { 744, -9416, 19893, 1963, 7922, -9824},
- { 3430, 21282, -1736, 10844, 8821, 27015},
- { -8813, 1521, -24038, 1651, 7838, -1208},
- { 3911, -11221, 3273, -12541, 7168, 18402},
- { 21642, 9117, -11536, -5256, 7077, 2382},
- { 100, 3817, -6713, 1244, 1518, -321},
- { 7946, -18670, 10667, -4866, 727, 776},
- { -15883, -8150, -2087, 22739, 1567, -3482},
- { 4380, -2735, 8469, -7025, -11424, 1317},
- { 26970, 4393, 7665, 17561, -714, 650},
- { -16191, -835, 8365, 1795, -14314, 16297},
- { 4504, -10048, 7662, -26690, -17428, 2580},
- { 48, -3984, 564, -5871, 2658, -18658},
- { 12579, -26016, -15642, 2672, -1347, -887},
- { -4950, 4208, -6811, 2569, -20621, -8658},
- { -1836, -14818, -5571, -23322, -14800, 25867},
- { 5434, -28139, -2357, -2883, -570, 2431},
- { 13096, -2771, 24994, -12496, -24723, -1025},
- { -5676, -4339, 1908, 18628, -21323, 17366},
- { 27660, -27897, -15409, 1436, -7112, -2241},
- { 8019, 3847, 24568, -469, 9674, 10683},
- { -903, -10149, 1801, -21260, 4795, -8751},
- { 1122, -9582, 2625, 22791, 956, 882},
- { 7876, 19075, -9900, -24266, 7496, 9277},
- { 980, -26764, -5386, 5396, 1086, 1648},
- { 28838, -1270, -447, 5, -429, -20},
- { -15283, 6132, 22812, 1252, -9963, 511},
- { 851, 7925, -457, -12210, 4261, 7579},
- { -4530, 8452, -1246, 14501, -24951, -5760},
- { -17814, -10727, 9887, -23929, -13432, 1878},
- { -15049, 10165, 16491, -14603, -11712, -21156},
- { -3317, 840, -5683, 22413, 1994, 586},
- { 23158, -5788, -15043, -10372, -9271, -13523},
- { -773, -9509, -3993, -24264, 8463, 5804},
- { -8545, -703, -12440, -3985, -25122, -28147},
- { -16659, 16001, 2746, 1611, 5097, -1043},
- { 41, -7181, 19903, 31555, -32237, 13927},
- { -5658, 845, -12774, 5705, 16695, -86},
- { 5282, 14875, 27026, 21124, 15776, -10477},
- { 14712, 19648, -11487, -13361, -20196, -15229},
- { 8597, -9138, -626, 10891, -6015, 6346},
- { -1488, -1272, -1479, -1303, -3704, -5485},
- { -3370, 17871, -6604, 24930, 25886, -3127},
- { 8416, 27783, -1385, 5350, -4260, 19993},
- { 5688, 362, 17246, 3809, -3246, 1088},
- { -105, -29607, 2747, 15223, -167, 3722},
- { 3502, -3195, 8602, 7772, -1566, -915},
- { -491, 3257, -2423, 5522, 20606, -100},
- { -13948, -11368, -15375, -21866, -8520, 12221},
- { -616, 2424, -2023, 4398, -3805, 8108},
- { -7204, 21043, 21211, -9395, -19391, 896},
- { -5737, -15160, -21298, 17066, -1006, -366},
- { 6261, 3240, -11937, -16213, -15820, 6581},
- { -3155, 24796, 2733, -1257, -875, -1597},
- { -20469, 11094, 24071, -8987, 14136, 2220},
- { -14106, 11959, -22495, 4135, -1055, -5420},
- { 801, -2655, 60, -5324, -790, 5937},
- { -7372, -1764, -22433, -26060, 21707, 4178},
- { -5715, -6648, -14908, 1325, -24044, 1493},
- { -6024, -12488, 23930, 2950, 1601, 1173},
- { 19067, 17630, 17929, -10654, 10928, -4958},
- { 3231, -3284, 27336, 4174, -1683, 497},
+static const int16_t vq_hebap7[512][6] = {
+{ -21173, 21893, 10390, 13646, 10718, -9177},
+{ -22519, -8193, 18328, -6629, 25518, -10848},
+{ 6800, -13758, -13278, 22418, 14667, -20938},
+{ 2347, 10516, 1125, -3455, 5569, 27136},
+{ -6617, 11851, -24524, 22937, 20362, -6019},
+{ -21768, 10681, -19615, -15021, -8478, -2081},
+{ -2745, 8684, -4895, 27739, 7554, -11961},
+{ -1020, 2460, -954, 4754, -627, -16368},
+{ -19702, 23097, 75, -13684, -2644, 2108},
+{ 4049, -2872, 5851, -4459, 22150, 12560},
+{ -21304, -17129, -730, 7419, -11658, -10523},
+{ 11332, 1792, 26666, 23518, -19561, -491},
+{ -17827, -16777, -13606, -14389, -22029, -2464},
+{ 1091, -5967, -7975, -16977, -20432, -21931},
+{ 18388, -1103, 1933, 13342, -17463, 18114},
+{ 22646, 17345, -9966, 17919, 18274, 698},
+{ 1484, 20297, -5754, -26515, 4941, -22263},
+{ -2603, 4587, -5842, 18464, 8767, -2568},
+{ -2797, -1602, 21713, 3099, -25683, 3224},
+{ -19027, 4693, -5007, 6060, 1972, -15095},
+{ -2189, 9516, -530, 20669, -4662, -8301},
+{ -22325, -8887, 2529, -11352, 5476, 998},
+{ 22100, -5052, 1651, -2657, 4615, 2319},
+{ 20855, -3078, -3330, 4105, 13470, 3069},
+{ 85, 17289, 10264, -14752, 214, 90},
+{ -26365, -18849, -19352, 19244, -10218, 9909},
+{ -9739, 20497, -6579, -6983, 2891, -738},
+{ 20575, -15860, -22913, 6870, 76, 327},
+{ 8744, -12877, -22945, -2372, -19424, -9771},
+{ -12886, 16183, 21084, 3821, 749, -13792},
+{ -15995, 18399, 2391, -17661, 19484, -6018},
+{ 1423, 11734, 4051, 19290, 6857, -19681},
+{ -5200, 9766, 18246, 2463, 18764, -4852},
+{ -597, 19498, 1323, -9096, -308, -1104},
+{ -3099, -25731, -15665, 25332, 4634, 2635},
+{ 19623, -2384, -7913, 11796, -9333, -14084},
+{ 2642, 26453, -21091, -10354, -1693, -1711},
+{ 22031, 21625, 11580, -22915, -4141, 129},
+{ -6122, 3542, 915, -261, -17, -383},
+{ 1696, 6704, -1425, 20838, 857, -4416},
+{ 1423, -15280, -8550, -9667, 5210, 5687},
+{ -4520, -613, -11683, 5618, 4230, 619},
+{ 937, -4963, -14102, -17104, -6906, -5952},
+{ -15068, -481, -7237, -14894, 18876, 21673},
+{ -25658, 2910, 1143, -327, -458, -995},
+{ -9656, -819, -24900, 2804, 20225, 1083},
+{ -1111, -3682, -1788, -19492, 966, 821},
+{ 7293, -21759, 10790, -7059, -23293, -1723},
+{ -282, -11093, 170, -20950, -28926, 12615},
+{ 17938, 3713, -1563, 885, 5, 564},
+{ 6116, 22696, 2242, -6951, 9975, -6132},
+{ 4338, 26808, -3705, 1976, -1079, -2570},
+{ -661, -7901, -2668, -15194, 17722, 4375},
+{ -4174, -11053, 717, -22506, 1562, 12252},
+{ -6405, 18334, 6103, 6983, 5956, 18195},
+{ 9851, 5370, 23604, -6861, -6569, -62},
+{ 21964, 13359, -683, 3785, 2168, 209},
+{ -3569, -1127, -19724, -1544, 1308, -803},
+{ -3083, 16049, -13791, -3077, 4294, 23713},
+{ -9999, 9943, -15872, 12934, -23631, 21699},
+{ 9722, 22837, 12192, 15091, 5533, 4837},
+{ 2243, 2099, 1243, 4089, 4748, 12956},
+{ 4007, -2468, 3353, -3092, 8843, 17024},
+{ 4330, 6127, 5549, 9249, 11226, 28592},
+{ -9586, -8825, 236, 1009, 455, -964},
+{ 6829, 19290, -1018, 200, 1821, 578},
+{ 5196, 957, 10372, 3330, -12800, -127},
+{ -3022, -8193, -14557, 22061, 5920, 1053},
+{ 10982, 25942, -24546, -23278, -11905, -6789},
+{ 22667, -11010, 5736, 2567, 23705, -10253},
+{ -3343, -4233, -5458, 20667, -10843, -3605},
+{ -4131, -3612, 4575, -829, -350, -847},
+{ -3303, 3451, -7398, -11604, 3023, 455},
+{ 3200, -9547, 3202, -22893, 11184, -26466},
+{ -14093, -4117, 15382, 14295, -10915, -20377},
+{ 3807, -11016, 22052, 14370, -15328, -7733},
+{ -6291, -17719, -1560, 12048, -19805, -443},
+{ -6147, -4234, -160, 8363, 22638, 11911},
+{ 19197, 1175, 7422, -9875, -4136, 4704},
+{ -72, -7652, -112, -11955, -3230, 27175},
+{ 3274, 5963, 7501, -17019, 866, -25452},
+{ 737, 1861, 1833, 2022, 2384, 4755},
+{ -5217, 7512, 3323, 2715, 3065, -1606},
+{ 4247, 565, 5629, 2497, 18019, -4920},
+{ -2833, -17920, -8062, 15738, -1018, 2136},
+{ 3050, -19483, 16930, 29835, -10222, 15153},
+{ -11346, 118, -25796, -13761, 15320, -468},
+{ -4824, 4960, -4263, 1575, -10593, 19561},
+{ -8203, -1409, -763, -1139, -607, 1408},
+{ -2203, -11415, 2021, -6388, -2600, 711},
+{ -413, -2511, -216, -3519, -28267, 1719},
+{ -14446, 17050, 13917, 13499, -25762, -16121},
+{ 19228, 7341, -12301, 682, -3791, -199},
+{ -4193, 20746, -15651, 11349, 5860, -824},
+{ -21490, -3546, -3, -1705, -3959, 9213},
+{ 15445, -1876, 2012, -19627, 16228, -4845},
+{ -2867, -3733, -7354, -175, -20119, 11174},
+{ -3571, -24587, 19700, 6654, 979, -654},
+{ 21820, -7430, -6639, -10767, -8362, 15543},
+{ 14827, 17977, -7204, -3409, 1906, -17288},
+{ 3525, -3947, -1415, -2798, 17648, 2082},
+{ -6580, -15255, -17913, 1337, 15338, 21158},
+{ 6210, 9698, 15155, -24666, -22507, -3999},
+{ -1740, -593, 1095, -7779, 25058, 5601},
+{ 21415, -432, -1658, -6898, -1438, -14454},
+{ -6943, 700, -12139, -745, -24187, 22466},
+{ 6287, 3283, 11006, 3844, 19184, 14781},
+{ -22502, 15274, 5443, -2808, -970, -3343},
+{ 3257, -3708, 4744, -8301, 22814, -10208},
+{ 24346, -20970, 19846, 987, -11958, -6277},
+{ 3906, -19701, 13060, -1609, 18641, 7466},
+{ -26409, -22549, 16305, 2014, 10975, 18032},
+{ -7039, 4655, -14818, 18739, 15789, 1296},
+{ 9310, -1681, 14667, -3326, 26535, -11853},
+{ 5728, 5917, 13400, 10020, -2236, -24704},
+{ 1741, -6727, 12695, -22009, 4080, 5450},
+{ -2621, 9393, 21143, -25938, -3162, -2529},
+{ 20672, 18894, -13939, 6990, -8260, 15811},
+{ -23818, 11183, -13639, 11868, 16045, 2630},
+{ 18361, -10220, 829, 856, -1010, 157},
+{ 14400, -4678, 5153, -13290, -27434, -11028},
+{ 21613, 11256, 17453, 7604, 13130, -484},
+{ 7, 1236, 573, 4214, 5576, -3081},
+{ 916, -9092, 1285, -8958, 1185, -28699},
+{ 21587, 23695, 19116, -2885, -14282, -8438},
+{ 23414, -6161, 12978, 3061, -9351, 2236},
+{ -3070, -7344, -20140, 5788, 582, -551},
+{ -3993, 315, -7773, 8224, -28082, -12465},
+{ 13766, -15357, 19205, -20624, 13043, -19247},
+{ 3777, -177, 8029, -1001, 17812, 5162},
+{ -7308, -4327, -18096, -620, -1350, 14932},
+{ 14756, -1221, -12819, -14922, -547, 27125},
+{ 2234, 1708, 2764, 5416, 7986, -25163},
+{ 2873, 3636, 3992, 5344, 10142, 21259},
+{ 1158, 5379, 508, -10514, 290, -1615},
+{ 1114, 24789, 16575, -25168, -298, -2832},
+{ -1107, -6144, -1918, -7791, -2971, -23276},
+{ 4016, 10793, 17317, -4342, -20982, -3383},
+{ -4494, -207, -9951, -3575, 7947, 1154},
+{ -7576, 8117, -14047, 16982, -26457, -27540},
+{ -15164, 16096, -16844, -8886, -23720, 15906},
+{ 24922, 5680, -1874, 420, 132, 117},
+{ -506, -19310, -198, 412, -311, 752},
+{ -1906, 3981, -7688, 16566, -19291, -14722},
+{ -399, -729, -3807, -4196, -12395, 7639},
+{ 3368, 2330, 9092, 23686, -10290, -1705},
+{ -3148, 2596, -7986, 14602, -4807, 16627},
+{ 8057, 1481, 49, 17205, 24869, 7474},
+{ -19304, -513, 11905, 2346, 5588, 3365},
+{ -5063, -21812, 11370, 10896, 4881, 261},
+{ 4794, 20577, 5109, -6025, -8049, -1521},
+{ 8125, -14756, 20639, -14918, 23941, -3650},
+{ 12451, 1381, 3613, 8687, -24002, 4848},
+{ 6726, 10643, 10086, 25217, -25159, -1065},
+{ 6561, 13977, 2911, 21737, 16465, -26050},
+{ -1776, 2575, -19606, -16800, 3032, 6679},
+{ 15012, -17910, -8438, -21554, -27111, 11808},
+{ 3448, -924, -15913, -1135, 5126, -20613},
+{ 7720, 2226, 17463, 5434, 28942, 17552},
+{ 1246, 15614, -11743, 24618, -17539, 3272},
+{ 3215, 17950, 2783, -722, -22672, 5979},
+{ -5678, -3184, -26087, 26034, 6583, 3302},
+{ 20310, -3555, -2715, -444, -1487, 1526},
+{ -20640, -21970, -12207, -25793, 8863, -1036},
+{ 17888, 570, -16102, 8329, -2553, 15275},
+{ -2677, 9950, -1879, 16477, -12762, -29007},
+{ -120, -2221, 219, 97, 365, 35},
+{ 1270, -718, 1480, -2689, 1930, -7527},
+{ 1896, 8750, 1906, 18235, -12692, -6174},
+{ -3733, 13713, -9882, -15960, -1376, -7146},
+{ -10600, 8496, 15967, -8792, 7532, 20439},
+{ 3041, -13457, 1032, -26952, 5787, 24984},
+{ -4590, -8220, -9322, -6112, -17243, 25745},
+{ -17808, 6970, 3752, 626, -114, 2178},
+{ 4449, -4862, 7054, -5404, 4738, -2827},
+{ 4922, -651, 18939, -9866, 848, 1886},
+{ -336, -5410, 7234, 20444, -9583, -600},
+{ 781, -19474, -12648, 6634, 1414, 450},
+{ -3399, -16770, 11107, 13200, -5498, 21663},
+{ -3265, 4859, -5961, 7530, -10837, 28086},
+{ 10350, -12901, 25699, 25640, -639, 351},
+{ 1163, 18763, -5466, -15087, -145, -1377},
+{ -14477, 27229, -31383, -32653, 21439, -2894},
+{ 15420, 18823, 22128, 19398, 22583, 13587},
+{ -10674, 10710, 5089, -4756, 909, -20760},
+{ -12948, -20660, 7410, 2722, 3427, 11585},
+{ -1105, 18374, 19731, -9650, 22442, 19634},
+{ -296, -6798, -14677, 21603, 19796, 21399},
+{ -19350, -7501, 25446, 13144, 8588, -25298},
+{ 3092, -10618, 20896, 9249, -3326, 1796},
+{ -811, 1449, 3106, 4748, 12073, -14262},
+{ -20720, 14275, -4332, -25838, -5781, -21149},
+{ -5132, 10554, -14020, -22150, 2840, -554},
+{ 25533, 17648, 14886, -21074, 2459, 25142},
+{ -9370, -1788, -12862, -5870, -25811, -11023},
+{ 6698, 819, 10313, 166, 27581, 523},
+{ 101, -19388, 3413, 9638, 64, 806},
+{ -2742, -17931, -2576, 22818, 8553, 1126},
+{ 2972, 15203, 1792, 25434, -5728, -17265},
+{ -1419, 1604, 4398, 11452, 1731, 23787},
+{ -5136, 4625, -10653, 27981, 9897, -2510},
+{ -10528, -28033, 2999, -1530, -832, -830},
+{ -11133, -12511, 22206, -7243, -23578, -21698},
+{ 16935, -21892, 1861, -9606, 9432, 19026},
+{ 10277, 9516, 26815, 2010, -4943, -9080},
+{ 5547, -2210, 14270, -15300, -19316, 1822},
+{ -4850, -783, -8959, -3076, -20056, -3197},
+{ 8232, -2794, -17752, 13308, 3229, -991},
+{ -12237, -6581, 10315, -9552, 2260, -20648},
+{ -7000, 5529, -7553, -7490, -10342, -10266},
+{ 3641, 19479, -5972, -19097, -18570, 12805},
+{ 1283, -4164, 4198, -28473, -2498, 1866},
+{ 16047, 26826, -13053, -6316, 985, -1597},
+{ -403, 13680, 6457, 25070, 27124, -20710},
+{ -18070, -1790, -24986, 5953, -954, 26600},
+{ -24224, -15383, 24788, 1953, -1136, 187},
+{ -2289, 12505, -20738, -904, 18324, 21258},
+{ 2658, -6140, 16179, 22276, -556, 2154},
+{ -6087, 13950, -25682, -27713, 4049, -4795},
+{ -21452, 26473, 19435, -9124, 895, 303},
+{ -22200, -26177, -6026, 24729, -22926, -9030},
+{ -14276, -15982, 23732, -22851, 9268, -3841},
+{ 29482, 21923, -6213, 1679, -2059, -1120},
+{ -435, 9802, -3891, 12359, -4288, -18971},
+{ 19768, -86, 2467, 1990, -1021, -5354},
+{ 20986, -8783, -5329, -23562, -4730, 2673},
+{ -5095, 5605, -4629, 19150, 26037, -12259},
+{ 972, 6858, 4551, 27949, -4025, -2272},
+{ 6075, -3260, -4989, -373, -1571, -3730},
+{ -7256, -12992, -8820, -5109, 23054, 5054},
+{ 920, 2615, 7912, -7353, -4905, 20186},
+{ -250, 5454, 3140, 6928, -18723, -2051},
+{ -10299, -4372, 19608, 4879, -661, -1885},
+{ 14816, -8603, -19815, 6135, -21210, 14108},
+{ -11945, -2223, 5018, 11892, 22741, 406},
+{ -13184, -2613, -13256, -22433, -12482, -8380},
+{ 17066, 25267, -2273, 5056, -342, 145},
+{ 8401, -17683, 19112, 10615, -19453, 17083},
+{ 20821, -5700, 12298, -25598, 10391, 7692},
+{ 4550, 15779, 17338, -19379, -4768, 1206},
+{ -7723, 10836, -27164, -11439, 6835, -1776},
+{ 2542, 3199, 4442, 17513, -3711, -914},
+{ 20960, -16774, -5814, 11087, -70, 22961},
+{ 3305, 2919, 6256, -4800, -20966, -3230},
+{ 5924, -16547, 2183, 2733, 3446, -23306},
+{ -6061, -194, -13852, -10971, 19488, 1029},
+{ 4467, -5964, -19004, 1519, -359, 855},
+{ -1581, -7607, 22070, -11580, -10032, 17102},
+{ -12412, 2553, 4324, 22500, 5751, 12170},
+{ -25127, 17996, -6384, 1180, 1182, 9622},
+{ 23462, -8471, -4392, -2669, 7638, -16835},
+{ -5511, -2887, -10757, -20883, 7246, 1053},
+{ 2703, -20602, -7554, 7516, -7740, 5868},
+{ 20670, 21901, 457, 14969, -17657, -11921},
+{ 3603, -1595, -2177, -157, -43, 605},
+{ 2513, 8954, 10527, 22559, -16100, -16041},
+{ 6002, 4951, 6795, -4862, -22400, 18849},
+{ 7590, -1693, -24688, -3404, 14169, 1214},
+{ -4398, -6663, -6870, -10083, -24596, 9253},
+{ 10468, 17751, -7748, 147, -6314, 4419},
+{ 16187, -16557, -4119, 4302, 7625, 5409},
+{ 3303, 2735, 7458, -19902, -2254, -3702},
+{ -2077, 21609, 14870, 12545, -6081, -1764},
+{ 4678, 11740, 2859, 6953, 1919, -3871},
+{ 3522, -21853, -2469, -10453, 18893, -10742},
+{ 3759, -10191, -4866, -2659, -17831, -1242},
+{ 14991, 9351, 11870, -1573, -4848, 22549},
+{ 9509, -27152, 10734, 20851, -26185, -17878},
+{ -7170, -1392, -19495, 12746, 8198, -1988},
+{ 1883, 28158, -846, -7235, 249, 233},
+{ -7200, 669, -371, -2948, 23234, -5635},
+{ 3141, 288, 3223, -1258, -98, -27607},
+{ 17373, -23235, 5110, -11199, -2574, -11487},
+{ -4928, 1518, -5456, 670, -18278, 1951},
+{ 10334, -19865, -4649, 361, -160, -923},
+{ 18732, 14264, -3155, -7485, -3328, 5959},
+{ -3614, 21077, 7276, 3536, 8121, -1528},
+{ -8422, 500, -19182, 18929, 26392, -1039},
+{ 15639, 25668, 8375, 1903, 1945, -11979},
+{ -2716, 3389, 26850, -4587, 1803, 22},
+{ 1177, -655, 1233, -2128, 7844, 1767},
+{ -761, 8209, -19290, -4593, 1923, -343},
+{ -689, -3530, -3267, -3804, -2753, 18566},
+{ -2110, 1962, -1353, 16643, 2765, -23102},
+{ -433, 4905, 302, 13016, 15933, -5905},
+{ 3203, 4126, 11181, -5496, -2529, -1160},
+{ -1091, -6469, -1415, 5682, -268, 583},
+{ -9405, -19572, 6216, 1658, 993, -75},
+{ -1695, -4504, -2289, -4088, -6556, -16577},
+{ 4760, -892, -10902, 6516, 24199, -6011},
+{ -253, 1000, 63, -81, -115, -382},
+{ -1333, 24224, -698, -4667, -2801, -19144},
+{ -876, -28866, -21873, 12677, -6344, 3235},
+{ 16847, 21145, -26172, -3183, -396, 230},
+{ 18296, -7790, -12857, -679, -1473, 5},
+{ -10488, 11429, 25805, -1122, 1401, -438},
+{ 3782, -7429, 26720, 17567, 19257, 12542},
+{ 6332, -746, 12789, 9316, -22542, -5354},
+{ 3418, -22728, 26978, 18303, 1076, 956},
+{ -27315, -2988, 920, 235, 2233, 81},
+{ 6199, 5296, 16093, 14768, -8429, -1112},
+{ -6432, 19244, 9921, -3253, 1278, -954},
+{ 24213, 2049, -22931, 2585, -2410, -4216},
+{ 9286, 14282, -19735, -3985, -2344, 1028},
+{ -20128, 17993, -9458, 23012, -16983, 8625},
+{ -6896, -20730, 3762, 17415, 22341, 19024},
+{ 842, 24181, 25062, -5839, -78, 937},
+{ -621, 19722, -24204, -1962, -14854, -56},
+{ 22766, -5119, 17365, 23868, -19480, -6558},
+{ -2158, 17490, -21435, 3340, -12819, -20295},
+{ -9621, 17325, 715, 2265, -4123, -492},
+{ 9156, 12947, 27303, -21175, -6072, -9457},
+{ -13164, -23269, -14006, -4184, 6978, 2},
+{ 938, -13381, 3520, -24297, 22902, 19589},
+{ -4911, -19774, 19764, -9310, -12650, 3819},
+{ -5462, -4249, -6987, -6260, -13943, -25150},
+{ 9341, 10369, -13862, -6704, 22556, -519},
+{ 6651, 18768, -4855, 12570, 14730, -10209},
+{ -823, 18119, 398, -1582, -116, -363},
+{ -6935, -12694, -28392, 8552, 6961, -239},
+{ -2602, -4704, -1021, 2015, 5129, 23670},
+{ -12559, -8190, -25028, 18544, 14179, 1663},
+{ 3813, 21036, -9620, -5051, -1800, -1087},
+{ -22057, 16675, 14960, 9459, 2786, 16991},
+{ -26040, -19318, -6414, 1104, 5798, -18039},
+{ -1737, 24825, 10417, -11087, 896, -5273},
+{ -1855, 11661, -2803, 24809, -21435, -19792},
+{ -23473, -16729, -5782, 5643, 2636, 4940},
+{ -1724, 4388, -26673, -13695, 10570, -25895},
+{ 15358, -19496, 26242, -18493, 1736, 8054},
+{ 5684, 20890, 4091, -19100, -14588, -10468},
+{ 17260, -16291, 14859, -17711, -19174, 12435},
+{ -27185, -12573, 6743, -562, 976, -257},
+{ 12395, -8618, -22248, -19843, 11013, 7762},
+{ 3799, 11853, -27622, -8473, 1089, -1495},
+{ 4141, -2182, -26720, -735, -774, 1469},
+{ 3125, 13762, 4606, 29257, 18771, -9958},
+{ -17465, -9445, -17562, -2530, -6435, -3726},
+{ -1742, 4351, -6841, -19773, 9627, -10654},
+{ 7251, 3525, 10835, 5601, 25198, -23348},
+{ -10300, -17830, 631, 11640, 2044, -20878},
+{ -873, -8502, -1063, -15674, -10693, 14934},
+{ -15957, 28137, 5268, 477, -1053, 1158},
+{ -1495, -8814, -5764, -24965, 25988, 7907},
+{ -1038, -114, -2308, -1319, -6480, 1472},
+{ 4895, -17897, -25850, 5301, -188, 1581},
+{ 3200, 17225, 4346, 22101, -18543, 22028},
+{ -10250, 545, -10932, 2276, -28070, 8118},
+{ 15343, 2329, 9316, 20537, 14908, 21021},
+{ 6329, 6130, -24508, 837, -8637, -5844},
+{ 7386, -501, 10503, 20131, 11435, -4755},
+{ -2745, 24174, -9274, 15273, -8389, -5835},
+{ 2992, -2864, 6048, -7473, 11687, -19996},
+{ -883, -11954, -9976, -21829, -4436, -27178},
+{ 3458, 19626, 1280, 2597, 19849, 5255},
+{ -5315, 19133, -14518, -8946, 13749, -1352},
+{ 18642, 17655, 11001, 6817, -18418, 6336},
+{ -1697, 2244, -4640, 3948, -12890, -5273},
+{ 20428, 10542, 4170, -1012, 19439, 21691},
+{ -2943, -19735, -4208, 1320, 909, -8897},
+{ 9351, -8066, -2618, -12933, 26582, 3507},
+{ 9705, -22628, 8311, 8167, -13293, 5608},
+{ 3222, 3749, -1508, 165, -52, -196},
+{ 102, -22744, -8832, 903, -11421, -14662},
+{ -120, 5998, 19765, 13401, 3628, 5197},
+{ 8528, 5827, -1066, 774, -39, -166},
+{ 9411, -9476, 9581, -13004, 24456, 24900},
+{ 17878, 2235, -21639, 20478, 4716, -7190},
+{ -2482, 9511, 1611, -21943, 14230, -1289},
+{ 9288, -2291, 23215, -3452, -10842, 11},
+{ 9496, 3041, 5130, -3890, -21219, -22589},
+{ 14262, -9838, 20195, 14019, 91, -17200},
+{ -18591, 980, 17, 821, 120, -574},
+{ 12285, -19269, 13742, 16373, -161, 6025},
+{ -3364, 1530, -4005, 2454, -10872, -23839},
+{ 105, 5085, -260, 5790, -588, 19170},
+{ 4121, 4169, 13439, 14644, 20899, 7434},
+{ -175, 13101, -3704, 23233, 3907, 10106},
+{ -6101, 23467, 5204, -1341, 1599, 13174},
+{ -3217, -3494, 15117, -8387, -11762, -4750},
+{ 1146, 4675, -19378, 14917, -5091, 249},
+{ -21506, 10136, -16473, -13305, 18382, -8601},
+{ 628, 2447, 3344, 3130, -5115, 119},
+{ 17900, -22422, -17633, 21967, -16293, -7676},
+{ 16863, 24214, 5612, -3858, -809, 3822},
+{ -2291, 10091, -2360, -25109, -1226, 312},
+{ 2957, 11256, 26745, -13266, -3455, -1128},
+{ -19762, -2708, 4604, 6355, 1638, 25501},
+{ -19593, -7753, 3159, -85, -489, -1855},
+{ 814, 12510, 19077, -4681, -2610, -1474},
+{ -23408, -19027, 8137, 19878, 7912, -282},
+{ 839, -19652, 11927, 27278, -3211, 2266},
+{ 4020, -1110, 8226, -1274, 20922, 25060},
+{ 26576, 325, -8693, -232, -2218, -699},
+{ -11293, -4200, 1805, -6673, -22940, -1339},
+{ -2005, -15886, -1047, -27687, -13235, 14370},
+{ -22073, 1949, 13175, -15656, -1846, 8055},
+{ 3039, 12025, 7132, -24632, 413, -2347},
+{ -24048, -206, 12459, -6654, -417, -10091},
+{ 18179, -23688, -20515, -16396, 7230, 763},
+{ 5659, -5085, 13878, -23729, -11077, -19587},
+{ 11340, 501, 25040, 7616, -19658, 1605},
+{ -26650, 8878, 10544, 417, 1299, 261},
+{ 14460, 11369, -3263, 9990, 8194, 18111},
+{ 1355, -20838, -9196, -16060, -8559, -730},
+{ -1918, -20937, -18293, -2461, -2651, 4316},
+{ -2810, 24521, -10996, -25721, 308, -1234},
+{ -9075, -17280, -1833, -29342, -24213, -16631},
+{ -2843, 10165, -5339, -2888, 21858, -21340},
+{ -15832, 14849, -23780, 5184, 10113, -20639},
+{ -19535, -11361, 8413, 1486, -23658, -5759},
+{ -7512, 1027, -20794, 13732, 19892, -21934},
+{ -12132, -7022, -19175, -8840, 22125, -16490},
+{ 1937, 5210, -6318, -23788, 13141, 11082},
+{ -205, 6036, -380, 8658, -233, 28020},
+{ -5523, 7477, 7635, 23595, 9763, -2590},
+{ 21658, -28313, -3086, -300, -1032, 1744},
+{ -22352, 16646, 208, 6665, -17400, -3028},
+{ 18482, 9336, -2737, -19372, 407, -4389},
+{ -4913, -17370, 18819, -17654, 13416, 15232},
+{ 7749, 6368, 23135, -18174, 7584, -4248},
+{ -1489, -6523, 586, -10157, 14964, 25568},
+{ 3844, -6156, 4897, -13045, -22526, 5647},
+{ -8491, -2105, -24774, 905, -9326, 1456},
+{ -3040, -1476, 1166, -4428, 11236, 9204},
+{ 3397, -1451, 13598, -15841, 24540, 5819},
+{ 8483, -2993, 21547, -16916, 7741, 24018},
+{ -14932, -23758, -5332, -6664, -4497, 13267},
+{ 19379, 12916, -2142, -737, 21100, -22101},
+{ 3393, -4629, 5735, -18913, -6969, 2687},
+{ 1148, -16147, -21433, -28095, -630, -14449},
+{ 7300, 672, 18530, -17452, -10149, 351},
+{ 11356, -10974, 17212, 4624, 145, 17791},
+{ -711, -3479, -2238, 15887, 2027, 0},
+{ -28048, 1794, -593, -2758, -21852, 11535},
+{ -19683, 4937, 22004, 21523, -3148, 1790},
+{ 813, 8231, 2633, 11981, -3043, 22201},
+{ 8952, -24760, -690, 14873, -2366, -5372},
+{ 8406, -5439, -274, -642, -145, 778},
+{ -6605, 7258, 20780, -23507, -18625, 22782},
+{ -22896, -25488, 10020, -1614, 1508, -1393},
+{ 7607, 407, -24678, -16385, -1804, -4699},
+{ -10592, -19139, 10462, -3747, 8721, -6919},
+{ 13010, 5292, -6230, -4884, -20904, -1797},
+{ 16891, -13770, -465, 19343, -10741, -12959},
+{ 25193, -14799, -5681, -521, -321, -1211},
+{ 6917, -3093, 20183, -26903, -12026, 1295},
+{ 305, 1992, 19457, -985, 25, -521},
+{ 6707, -3698, 8365, -8687, 21921, -27166},
+{ 4668, 5997, 7117, 11696, 24401, -10794},
+{ 744, -9416, 19893, 1963, 7922, -9824},
+{ 3430, 21282, -1736, 10844, 8821, 27015},
+{ -8813, 1521, -24038, 1651, 7838, -1208},
+{ 3911, -11221, 3273, -12541, 7168, 18402},
+{ 21642, 9117, -11536, -5256, 7077, 2382},
+{ 100, 3817, -6713, 1244, 1518, -321},
+{ 7946, -18670, 10667, -4866, 727, 776},
+{ -15883, -8150, -2087, 22739, 1567, -3482},
+{ 4380, -2735, 8469, -7025, -11424, 1317},
+{ 26970, 4393, 7665, 17561, -714, 650},
+{ -16191, -835, 8365, 1795, -14314, 16297},
+{ 4504, -10048, 7662, -26690, -17428, 2580},
+{ 48, -3984, 564, -5871, 2658, -18658},
+{ 12579, -26016, -15642, 2672, -1347, -887},
+{ -4950, 4208, -6811, 2569, -20621, -8658},
+{ -1836, -14818, -5571, -23322, -14800, 25867},
+{ 5434, -28139, -2357, -2883, -570, 2431},
+{ 13096, -2771, 24994, -12496, -24723, -1025},
+{ -5676, -4339, 1908, 18628, -21323, 17366},
+{ 27660, -27897, -15409, 1436, -7112, -2241},
+{ 8019, 3847, 24568, -469, 9674, 10683},
+{ -903, -10149, 1801, -21260, 4795, -8751},
+{ 1122, -9582, 2625, 22791, 956, 882},
+{ 7876, 19075, -9900, -24266, 7496, 9277},
+{ 980, -26764, -5386, 5396, 1086, 1648},
+{ 28838, -1270, -447, 5, -429, -20},
+{ -15283, 6132, 22812, 1252, -9963, 511},
+{ 851, 7925, -457, -12210, 4261, 7579},
+{ -4530, 8452, -1246, 14501, -24951, -5760},
+{ -17814, -10727, 9887, -23929, -13432, 1878},
+{ -15049, 10165, 16491, -14603, -11712, -21156},
+{ -3317, 840, -5683, 22413, 1994, 586},
+{ 23158, -5788, -15043, -10372, -9271, -13523},
+{ -773, -9509, -3993, -24264, 8463, 5804},
+{ -8545, -703, -12440, -3985, -25122, -28147},
+{ -16659, 16001, 2746, 1611, 5097, -1043},
+{ 41, -7181, 19903, 31555, -32237, 13927},
+{ -5658, 845, -12774, 5705, 16695, -86},
+{ 5282, 14875, 27026, 21124, 15776, -10477},
+{ 14712, 19648, -11487, -13361, -20196, -15229},
+{ 8597, -9138, -626, 10891, -6015, 6346},
+{ -1488, -1272, -1479, -1303, -3704, -5485},
+{ -3370, 17871, -6604, 24930, 25886, -3127},
+{ 8416, 27783, -1385, 5350, -4260, 19993},
+{ 5688, 362, 17246, 3809, -3246, 1088},
+{ -105, -29607, 2747, 15223, -167, 3722},
+{ 3502, -3195, 8602, 7772, -1566, -915},
+{ -491, 3257, -2423, 5522, 20606, -100},
+{ -13948, -11368, -15375, -21866, -8520, 12221},
+{ -616, 2424, -2023, 4398, -3805, 8108},
+{ -7204, 21043, 21211, -9395, -19391, 896},
+{ -5737, -15160, -21298, 17066, -1006, -366},
+{ 6261, 3240, -11937, -16213, -15820, 6581},
+{ -3155, 24796, 2733, -1257, -875, -1597},
+{ -20469, 11094, 24071, -8987, 14136, 2220},
+{ -14106, 11959, -22495, 4135, -1055, -5420},
+{ 801, -2655, 60, -5324, -790, 5937},
+{ -7372, -1764, -22433, -26060, 21707, 4178},
+{ -5715, -6648, -14908, 1325, -24044, 1493},
+{ -6024, -12488, 23930, 2950, 1601, 1173},
+{ 19067, 17630, 17929, -10654, 10928, -4958},
+{ 3231, -3284, 27336, 4174, -1683, 497},
};
-const int16_t (* const ff_eac3_mantissa_vq[8])[6] =
-{
+const int16_t (* const ff_eac3_mantissa_vq[8])[6] = {
NULL,
vq_hebap1,
vq_hebap2,
@@ -1071,38 +1059,37 @@ const int16_t (* const ff_eac3_mantissa_vq[8])[6] =
/**
* Table E2.14 Frame Exponent Strategy Combinations
*/
-const uint8_t ff_eac3_frm_expstr[32][6] =
-{
- { EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE},
- { EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45},
- { EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE},
- { EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45},
- { EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE},
- { EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45},
- { EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE},
- { EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45},
- { EXP_D25, EXP_REUSE, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE},
- { EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45},
- { EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE},
- { EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45},
- { EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE},
- { EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45},
- { EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE},
- { EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45, EXP_D45},
- { EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE},
- { EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45},
- { EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE},
- { EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45},
- { EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE},
- { EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45},
- { EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE},
- { EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45},
- { EXP_D45, EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE},
- { EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45},
- { EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE},
- { EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45},
- { EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE},
- { EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45},
- { EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE},
- { EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45},
+const uint8_t ff_eac3_frm_expstr[32][6] = {
+{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE},
+{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45},
+{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE},
+{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45},
+{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE},
+{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45},
+{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE},
+{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45},
+{ EXP_D25, EXP_REUSE, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE},
+{ EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45},
+{ EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE},
+{ EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45},
+{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE},
+{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45},
+{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE},
+{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45, EXP_D45},
+{ EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE},
+{ EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45},
+{ EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE},
+{ EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45},
+{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE},
+{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45},
+{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE},
+{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45},
+{ EXP_D45, EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE},
+{ EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45},
+{ EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE},
+{ EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45},
+{ EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE},
+{ EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45},
+{ EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE},
+{ EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45},
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/error_resilience.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/error_resilience.c
index 2ba7a8897..80c7a5c4d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/error_resilience.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/error_resilience.c
@@ -31,11 +31,10 @@
#include "dsputil.h"
#include "mpegvideo.h"
-static void decode_mb(MpegEncContext *s)
-{
- s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16 * s->linesize) + s->mb_x * 16;
- s->dest[1] = s->current_picture.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.data[2] + (s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16 >> s->chroma_x_shift);
+static void decode_mb(MpegEncContext *s){
+ s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize ) + s->mb_x * 16;
+ s->dest[1] = s->current_picture.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.data[2] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
MPV_decode_mb(s, s->block);
}
@@ -46,74 +45,64 @@ static void decode_mb(MpegEncContext *s)
static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int mb_x, int mb_y)
{
int dc, dcu, dcv, y, i;
- for(i = 0; i < 4; i++)
- {
- dc = s->dc_val[0][mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*s->b8_stride];
- if(dc < 0) dc = 0;
- else if(dc > 2040) dc = 2040;
- for(y = 0; y < 8; y++)
- {
+ for(i=0; i<4; i++){
+ dc= s->dc_val[0][mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*s->b8_stride];
+ if(dc<0) dc=0;
+ else if(dc>2040) dc=2040;
+ for(y=0; y<8; y++){
int x;
- for(x = 0; x < 8; x++)
- {
- dest_y[x + (i&1)*8 + (y + (i>>1)*8)*s->linesize] = dc / 8;
+ for(x=0; x<8; x++){
+ dest_y[x + (i&1)*8 + (y + (i>>1)*8)*s->linesize]= dc/8;
}
}
}
dcu = s->dc_val[1][mb_x + mb_y*s->mb_stride];
dcv = s->dc_val[2][mb_x + mb_y*s->mb_stride];
- if(dcu < 0) dcu = 0;
- else if(dcu > 2040) dcu = 2040;
- if(dcv < 0) dcv = 0;
- else if(dcv > 2040) dcv = 2040;
- for(y = 0; y < 8; y++)
- {
+ if (dcu<0 ) dcu=0;
+ else if(dcu>2040) dcu=2040;
+ if (dcv<0 ) dcv=0;
+ else if(dcv>2040) dcv=2040;
+ for(y=0; y<8; y++){
int x;
- for(x = 0; x < 8; x++)
- {
- dest_cb[x + y*(s->uvlinesize)] = dcu / 8;
- dest_cr[x + y*(s->uvlinesize)] = dcv / 8;
+ for(x=0; x<8; x++){
+ dest_cb[x + y*(s->uvlinesize)]= dcu/8;
+ dest_cr[x + y*(s->uvlinesize)]= dcv/8;
}
}
}
-static void filter181(int16_t *data, int width, int height, int stride)
-{
- int x, y;
+static void filter181(int16_t *data, int width, int height, int stride){
+ int x,y;
/* horizontal filter */
- for(y = 1; y < height - 1; y++)
- {
- int prev_dc = data[0 + y*stride];
+ for(y=1; y<height-1; y++){
+ int prev_dc= data[0 + y*stride];
- for(x = 1; x < width - 1; x++)
- {
+ for(x=1; x<width-1; x++){
int dc;
- dc = - prev_dc
- + data[x + y*stride] * 8
- - data[x + 1 + y*stride];
- dc = (dc * 10923 + 32768) >> 16;
- prev_dc = data[x + y*stride];
- data[x + y*stride] = dc;
+ dc= - prev_dc
+ + data[x + y*stride]*8
+ - data[x + 1 + y*stride];
+ dc= (dc*10923 + 32768)>>16;
+ prev_dc= data[x + y*stride];
+ data[x + y*stride]= dc;
}
}
/* vertical filter */
- for(x = 1; x < width - 1; x++)
- {
- int prev_dc = data[x];
+ for(x=1; x<width-1; x++){
+ int prev_dc= data[x];
- for(y = 1; y < height - 1; y++)
- {
+ for(y=1; y<height-1; y++){
int dc;
- dc = - prev_dc
- + data[x + y *stride] * 8
- - data[x + (y+1)*stride];
- dc = (dc * 10923 + 32768) >> 16;
- prev_dc = data[x + y*stride];
- data[x + y*stride] = dc;
+ dc= - prev_dc
+ + data[x + y *stride]*8
+ - data[x + (y+1)*stride];
+ dc= (dc*10923 + 32768)>>16;
+ prev_dc= data[x + y*stride];
+ data[x + y*stride]= dc;
}
}
}
@@ -123,93 +112,81 @@ static void filter181(int16_t *data, int width, int height, int stride)
* @param w width in 8 pixel blocks
* @param h height in 8 pixel blocks
*/
-static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, int is_luma)
-{
+static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, int is_luma){
int b_x, b_y;
- for(b_y = 0; b_y < h; b_y++)
- {
- for(b_x = 0; b_x < w; b_x++)
- {
- int color[4] = {1024, 1024, 1024, 1024};
- int distance[4] = {9999, 9999, 9999, 9999};
+ for(b_y=0; b_y<h; b_y++){
+ for(b_x=0; b_x<w; b_x++){
+ int color[4]={1024,1024,1024,1024};
+ int distance[4]={9999,9999,9999,9999};
int mb_index, error, j;
int64_t guess, weight_sum;
- mb_index = (b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride;
+ mb_index= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
- error = s->error_status_table[mb_index];
+ error= s->error_status_table[mb_index];
if(IS_INTER(s->current_picture.mb_type[mb_index])) continue; //inter
- if(!(error & DC_ERROR)) continue; //dc-ok
+ if(!(error&DC_ERROR)) continue; //dc-ok
/* right block */
- for(j = b_x + 1; j < w; j++)
- {
- int mb_index_j = (j >> is_luma) + (b_y >> is_luma) * s->mb_stride;
- int error_j = s->error_status_table[mb_index_j];
- int intra_j = IS_INTRA(s->current_picture.mb_type[mb_index_j]);
- if(intra_j == 0 || !(error_j & DC_ERROR))
- {
- color[0] = dc[j + b_y*stride];
- distance[0] = j - b_x;
+ for(j=b_x+1; j<w; j++){
+ int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride;
+ int error_j= s->error_status_table[mb_index_j];
+ int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
+ if(intra_j==0 || !(error_j&DC_ERROR)){
+ color[0]= dc[j + b_y*stride];
+ distance[0]= j-b_x;
break;
}
}
/* left block */
- for(j = b_x - 1; j >= 0; j--)
- {
- int mb_index_j = (j >> is_luma) + (b_y >> is_luma) * s->mb_stride;
- int error_j = s->error_status_table[mb_index_j];
- int intra_j = IS_INTRA(s->current_picture.mb_type[mb_index_j]);
- if(intra_j == 0 || !(error_j & DC_ERROR))
- {
- color[1] = dc[j + b_y*stride];
- distance[1] = b_x - j;
+ for(j=b_x-1; j>=0; j--){
+ int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride;
+ int error_j= s->error_status_table[mb_index_j];
+ int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
+ if(intra_j==0 || !(error_j&DC_ERROR)){
+ color[1]= dc[j + b_y*stride];
+ distance[1]= b_x-j;
break;
}
}
/* bottom block */
- for(j = b_y + 1; j < h; j++)
- {
- int mb_index_j = (b_x >> is_luma) + (j >> is_luma) * s->mb_stride;
- int error_j = s->error_status_table[mb_index_j];
- int intra_j = IS_INTRA(s->current_picture.mb_type[mb_index_j]);
- if(intra_j == 0 || !(error_j & DC_ERROR))
- {
- color[2] = dc[b_x + j*stride];
- distance[2] = j - b_y;
+ for(j=b_y+1; j<h; j++){
+ int mb_index_j= (b_x>>is_luma) + (j>>is_luma)*s->mb_stride;
+ int error_j= s->error_status_table[mb_index_j];
+ int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
+ if(intra_j==0 || !(error_j&DC_ERROR)){
+ color[2]= dc[b_x + j*stride];
+ distance[2]= j-b_y;
break;
}
}
/* top block */
- for(j = b_y - 1; j >= 0; j--)
- {
- int mb_index_j = (b_x >> is_luma) + (j >> is_luma) * s->mb_stride;
- int error_j = s->error_status_table[mb_index_j];
- int intra_j = IS_INTRA(s->current_picture.mb_type[mb_index_j]);
- if(intra_j == 0 || !(error_j & DC_ERROR))
- {
- color[3] = dc[b_x + j*stride];
- distance[3] = b_y - j;
+ for(j=b_y-1; j>=0; j--){
+ int mb_index_j= (b_x>>is_luma) + (j>>is_luma)*s->mb_stride;
+ int error_j= s->error_status_table[mb_index_j];
+ int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
+ if(intra_j==0 || !(error_j&DC_ERROR)){
+ color[3]= dc[b_x + j*stride];
+ distance[3]= b_y-j;
break;
}
}
- weight_sum = 0;
- guess = 0;
- for(j = 0; j < 4; j++)
- {
- int64_t weight = 256 * 256 * 256 * 16 / distance[j];
- guess += weight * (int64_t)color[j];
- weight_sum += weight;
+ weight_sum=0;
+ guess=0;
+ for(j=0; j<4; j++){
+ int64_t weight= 256*256*256*16/distance[j];
+ guess+= weight*(int64_t)color[j];
+ weight_sum+= weight;
}
- guess = (guess + weight_sum / 2) / weight_sum;
+ guess= (guess + weight_sum/2) / weight_sum;
- dc[b_x + b_y*stride] = guess;
+ dc[b_x + b_y*stride]= guess;
}
}
}
@@ -219,61 +196,55 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i
* @param w width in 8 pixel blocks
* @param h height in 8 pixel blocks
*/
-static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma)
-{
+static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
int b_x, b_y;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- for(b_y = 0; b_y < h; b_y++)
- {
- for(b_x = 0; b_x < w - 1; b_x++)
- {
+ for(b_y=0; b_y<h; b_y++){
+ for(b_x=0; b_x<w-1; b_x++){
int y;
- int left_status = s->error_status_table[(b_x >>is_luma) + (b_y>>is_luma)*s->mb_stride];
- int right_status = s->error_status_table[((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride];
- int left_intra = IS_INTRA(s->current_picture.mb_type [(b_x >>is_luma) + (b_y>>is_luma)*s->mb_stride]);
- int right_intra = IS_INTRA(s->current_picture.mb_type [((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride]);
- int left_damage = left_status & (DC_ERROR | AC_ERROR | MV_ERROR);
- int right_damage = right_status & (DC_ERROR | AC_ERROR | MV_ERROR);
- int offset = b_x * 8 + b_y * stride * 8;
- int16_t *left_mv = s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + (b_x <<(1-is_luma))];
- int16_t *right_mv = s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))];
+ int left_status = s->error_status_table[( b_x >>is_luma) + (b_y>>is_luma)*s->mb_stride];
+ int right_status= s->error_status_table[((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride];
+ int left_intra= IS_INTRA(s->current_picture.mb_type [( b_x >>is_luma) + (b_y>>is_luma)*s->mb_stride]);
+ int right_intra= IS_INTRA(s->current_picture.mb_type [((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride]);
+ int left_damage = left_status&(DC_ERROR|AC_ERROR|MV_ERROR);
+ int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR);
+ int offset= b_x*8 + b_y*stride*8;
+ int16_t *left_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ( b_x <<(1-is_luma))];
+ int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))];
- if(!(left_damage || right_damage)) continue; // both undamaged
+ if(!(left_damage||right_damage)) continue; // both undamaged
- if((!left_intra) && (!right_intra)
- && FFABS(left_mv[0] - right_mv[0]) + FFABS(left_mv[1] + right_mv[1]) < 2) continue;
+ if( (!left_intra) && (!right_intra)
+ && FFABS(left_mv[0]-right_mv[0]) + FFABS(left_mv[1]+right_mv[1]) < 2) continue;
- for(y = 0; y < 8; y++)
- {
- int a, b, c, d;
+ for(y=0; y<8; y++){
+ int a,b,c,d;
- a = dst[offset + 7 + y*stride] - dst[offset + 6 + y*stride];
- b = dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride];
- c = dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride];
+ a= dst[offset + 7 + y*stride] - dst[offset + 6 + y*stride];
+ b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride];
+ c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride];
- d = FFABS(b) - ((FFABS(a) + FFABS(c) + 1) >> 1);
- d = FFMAX(d, 0);
- if(b < 0) d = -d;
+ d= FFABS(b) - ((FFABS(a) + FFABS(c) + 1)>>1);
+ d= FFMAX(d, 0);
+ if(b<0) d= -d;
- if(d == 0) continue;
+ if(d==0) continue;
if(!(left_damage && right_damage))
- d = d * 16 / 9;
-
- if(left_damage)
- {
- dst[offset + 7 + y*stride] = cm[dst[offset + 7 + y*stride] + ((d * 7) >> 4)];
- dst[offset + 6 + y*stride] = cm[dst[offset + 6 + y*stride] + ((d * 5) >> 4)];
- dst[offset + 5 + y*stride] = cm[dst[offset + 5 + y*stride] + ((d * 3) >> 4)];
- dst[offset + 4 + y*stride] = cm[dst[offset + 4 + y*stride] + ((d * 1) >> 4)];
+ d= d*16/9;
+
+ if(left_damage){
+ dst[offset + 7 + y*stride] = cm[dst[offset + 7 + y*stride] + ((d*7)>>4)];
+ dst[offset + 6 + y*stride] = cm[dst[offset + 6 + y*stride] + ((d*5)>>4)];
+ dst[offset + 5 + y*stride] = cm[dst[offset + 5 + y*stride] + ((d*3)>>4)];
+ dst[offset + 4 + y*stride] = cm[dst[offset + 4 + y*stride] + ((d*1)>>4)];
}
- if(right_damage)
- {
- dst[offset + 8 + y*stride] = cm[dst[offset + 8 + y*stride] - ((d * 7) >> 4)];
- dst[offset + 9 + y*stride] = cm[dst[offset + 9 + y*stride] - ((d * 5) >> 4)];
- dst[offset + 10+ y*stride] = cm[dst[offset +10 + y*stride] - ((d * 3) >> 4)];
- dst[offset + 11+ y*stride] = cm[dst[offset +11 + y*stride] - ((d * 1) >> 4)];
+ if(right_damage){
+ dst[offset + 8 + y*stride] = cm[dst[offset + 8 + y*stride] - ((d*7)>>4)];
+ dst[offset + 9 + y*stride] = cm[dst[offset + 9 + y*stride] - ((d*5)>>4)];
+ dst[offset + 10+ y*stride] = cm[dst[offset +10 + y*stride] - ((d*3)>>4)];
+ dst[offset + 11+ y*stride] = cm[dst[offset +11 + y*stride] - ((d*1)>>4)];
}
}
}
@@ -285,318 +256,284 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
* @param w width in 8 pixel blocks
* @param h height in 8 pixel blocks
*/
-static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma)
-{
+static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
int b_x, b_y;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- for(b_y = 0; b_y < h - 1; b_y++)
- {
- for(b_x = 0; b_x < w; b_x++)
- {
+ for(b_y=0; b_y<h-1; b_y++){
+ for(b_x=0; b_x<w; b_x++){
int x;
- int top_status = s->error_status_table[(b_x>>is_luma) + (b_y >>is_luma)*s->mb_stride];
- int bottom_status = s->error_status_table[(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride];
- int top_intra = IS_INTRA(s->current_picture.mb_type [(b_x>>is_luma) + (b_y >>is_luma)*s->mb_stride]);
- int bottom_intra = IS_INTRA(s->current_picture.mb_type [(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride]);
- int top_damage = top_status & (DC_ERROR | AC_ERROR | MV_ERROR);
- int bottom_damage = bottom_status & (DC_ERROR | AC_ERROR | MV_ERROR);
- int offset = b_x * 8 + b_y * stride * 8;
- int16_t *top_mv = s->current_picture.motion_val[0][s->b8_stride*(b_y <<(1-is_luma)) + (b_x<<(1-is_luma))];
- int16_t *bottom_mv = s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))];
+ int top_status = s->error_status_table[(b_x>>is_luma) + ( b_y >>is_luma)*s->mb_stride];
+ int bottom_status= s->error_status_table[(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride];
+ int top_intra= IS_INTRA(s->current_picture.mb_type [(b_x>>is_luma) + ( b_y >>is_luma)*s->mb_stride]);
+ int bottom_intra= IS_INTRA(s->current_picture.mb_type [(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride]);
+ int top_damage = top_status&(DC_ERROR|AC_ERROR|MV_ERROR);
+ int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR);
+ int offset= b_x*8 + b_y*stride*8;
+ int16_t *top_mv= s->current_picture.motion_val[0][s->b8_stride*( b_y <<(1-is_luma)) + (b_x<<(1-is_luma))];
+ int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))];
- if(!(top_damage || bottom_damage)) continue; // both undamaged
+ if(!(top_damage||bottom_damage)) continue; // both undamaged
- if((!top_intra) && (!bottom_intra)
- && FFABS(top_mv[0] - bottom_mv[0]) + FFABS(top_mv[1] + bottom_mv[1]) < 2) continue;
+ if( (!top_intra) && (!bottom_intra)
+ && FFABS(top_mv[0]-bottom_mv[0]) + FFABS(top_mv[1]+bottom_mv[1]) < 2) continue;
- for(x = 0; x < 8; x++)
- {
- int a, b, c, d;
+ for(x=0; x<8; x++){
+ int a,b,c,d;
- a = dst[offset + x + 7*stride] - dst[offset + x + 6*stride];
- b = dst[offset + x + 8*stride] - dst[offset + x + 7*stride];
- c = dst[offset + x + 9*stride] - dst[offset + x + 8*stride];
+ a= dst[offset + x + 7*stride] - dst[offset + x + 6*stride];
+ b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride];
+ c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride];
- d = FFABS(b) - ((FFABS(a) + FFABS(c) + 1) >> 1);
- d = FFMAX(d, 0);
- if(b < 0) d = -d;
+ d= FFABS(b) - ((FFABS(a) + FFABS(c)+1)>>1);
+ d= FFMAX(d, 0);
+ if(b<0) d= -d;
- if(d == 0) continue;
+ if(d==0) continue;
if(!(top_damage && bottom_damage))
- d = d * 16 / 9;
-
- if(top_damage)
- {
- dst[offset + x + 7*stride] = cm[dst[offset + x + 7*stride] + ((d * 7) >> 4)];
- dst[offset + x + 6*stride] = cm[dst[offset + x + 6*stride] + ((d * 5) >> 4)];
- dst[offset + x + 5*stride] = cm[dst[offset + x + 5*stride] + ((d * 3) >> 4)];
- dst[offset + x + 4*stride] = cm[dst[offset + x + 4*stride] + ((d * 1) >> 4)];
+ d= d*16/9;
+
+ if(top_damage){
+ dst[offset + x + 7*stride] = cm[dst[offset + x + 7*stride] + ((d*7)>>4)];
+ dst[offset + x + 6*stride] = cm[dst[offset + x + 6*stride] + ((d*5)>>4)];
+ dst[offset + x + 5*stride] = cm[dst[offset + x + 5*stride] + ((d*3)>>4)];
+ dst[offset + x + 4*stride] = cm[dst[offset + x + 4*stride] + ((d*1)>>4)];
}
- if(bottom_damage)
- {
- dst[offset + x + 8*stride] = cm[dst[offset + x + 8*stride] - ((d * 7) >> 4)];
- dst[offset + x + 9*stride] = cm[dst[offset + x + 9*stride] - ((d * 5) >> 4)];
- dst[offset + x + 10*stride] = cm[dst[offset + x + 10*stride] - ((d * 3) >> 4)];
- dst[offset + x + 11*stride] = cm[dst[offset + x + 11*stride] - ((d * 1) >> 4)];
+ if(bottom_damage){
+ dst[offset + x + 8*stride] = cm[dst[offset + x + 8*stride] - ((d*7)>>4)];
+ dst[offset + x + 9*stride] = cm[dst[offset + x + 9*stride] - ((d*5)>>4)];
+ dst[offset + x + 10*stride] = cm[dst[offset + x + 10*stride] - ((d*3)>>4)];
+ dst[offset + x + 11*stride] = cm[dst[offset + x + 11*stride] - ((d*1)>>4)];
}
}
}
}
}
-static void guess_mv(MpegEncContext *s)
-{
-#if __STDC_VERSION__ >= 199901L
+static void guess_mv(MpegEncContext *s){
+ #if __STDC_VERSION__ >= 199901L
uint8_t fixed[s->mb_stride * s->mb_height];
-#else
- uint8_t *fixed = _alloca(sizeof(uint8_t) * (s->mb_stride * s->mb_height));
-#endif
+ #else
+ uint8_t *fixed=_alloca(sizeof(uint8_t)*(s->mb_stride * s->mb_height));
+ #endif
#define MV_FROZEN 3
#define MV_CHANGED 2
#define MV_UNCHANGED 1
const int mb_stride = s->mb_stride;
const int mb_width = s->mb_width;
- const int mb_height = s->mb_height;
+ const int mb_height= s->mb_height;
int i, depth, num_avail;
int mb_x, mb_y;
- num_avail = 0;
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[ i ];
- int f = 0;
- int error = s->error_status_table[mb_xy];
+ num_avail=0;
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[ i ];
+ int f=0;
+ int error= s->error_status_table[mb_xy];
- if(IS_INTRA(s->current_picture.mb_type[mb_xy])) f = MV_FROZEN; //intra //FIXME check
- if(!(error & MV_ERROR)) f = MV_FROZEN; //inter with undamaged MV
+ if(IS_INTRA(s->current_picture.mb_type[mb_xy])) f=MV_FROZEN; //intra //FIXME check
+ if(!(error&MV_ERROR)) f=MV_FROZEN; //inter with undamaged MV
- fixed[mb_xy] = f;
- if(f == MV_FROZEN)
+ fixed[mb_xy]= f;
+ if(f==MV_FROZEN)
num_avail++;
}
- if((!(s->avctx->error_concealment & FF_EC_GUESS_MVS)) || num_avail <= mb_width / 2)
- {
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- const int mb_xy = mb_x + mb_y * s->mb_stride;
+ if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ const int mb_xy= mb_x + mb_y*s->mb_stride;
if(IS_INTRA(s->current_picture.mb_type[mb_xy])) continue;
if(!(s->error_status_table[mb_xy]&MV_ERROR)) continue;
s->mv_dir = s->last_picture.data[0] ? MV_DIR_FORWARD : MV_DIR_BACKWARD;
- s->mb_intra = 0;
+ s->mb_intra=0;
s->mv_type = MV_TYPE_16X16;
- s->mb_skipped = 0;
+ s->mb_skipped=0;
s->dsp.clear_blocks(s->block[0]);
- s->mb_x = mb_x;
- s->mb_y = mb_y;
- s->mv[0][0][0] = 0;
- s->mv[0][0][1] = 0;
+ s->mb_x= mb_x;
+ s->mb_y= mb_y;
+ s->mv[0][0][0]= 0;
+ s->mv[0][0][1]= 0;
decode_mb(s);
}
}
return;
}
- for(depth = 0;; depth++)
- {
+ for(depth=0;; depth++){
int changed, pass, none_left;
- none_left = 1;
- changed = 1;
- for(pass = 0; (changed || pass < 2) && pass < 10; pass++)
- {
+ none_left=1;
+ changed=1;
+ for(pass=0; (changed || pass<2) && pass<10; pass++){
int mb_x, mb_y;
- int score_sum = 0;
-
- changed = 0;
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- const int mb_xy = mb_x + mb_y * s->mb_stride;
- int mv_predictor[8][2] = {{0}};
- int pred_count = 0;
+int score_sum=0;
+
+ changed=0;
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ const int mb_xy= mb_x + mb_y*s->mb_stride;
+ int mv_predictor[8][2]={{0}};
+ int pred_count=0;
int j;
- int best_score = 256 * 256 * 256 * 64;
- int best_pred = 0;
- const int mot_stride = s->b8_stride;
- const int mot_index = mb_x * 2 + mb_y * 2 * mot_stride;
- int prev_x = s->current_picture.motion_val[0][mot_index][0];
- int prev_y = s->current_picture.motion_val[0][mot_index][1];
+ int best_score=256*256*256*64;
+ int best_pred=0;
+ const int mot_stride= s->b8_stride;
+ const int mot_index= mb_x*2 + mb_y*2*mot_stride;
+ int prev_x= s->current_picture.motion_val[0][mot_index][0];
+ int prev_y= s->current_picture.motion_val[0][mot_index][1];
- if((mb_x ^ mb_y ^ pass) & 1) continue;
+ if((mb_x^mb_y^pass)&1) continue;
- if(fixed[mb_xy] == MV_FROZEN) continue;
+ if(fixed[mb_xy]==MV_FROZEN) continue;
assert(!IS_INTRA(s->current_picture.mb_type[mb_xy]));
assert(s->last_picture_ptr && s->last_picture_ptr->data[0]);
- j = 0;
- if(mb_x > 0 && fixed[mb_xy-1 ] == MV_FROZEN) j = 1;
- if(mb_x + 1 < mb_width && fixed[mb_xy+1 ] == MV_FROZEN) j = 1;
- if(mb_y > 0 && fixed[mb_xy-mb_stride] == MV_FROZEN) j = 1;
- if(mb_y + 1 < mb_height && fixed[mb_xy+mb_stride] == MV_FROZEN) j = 1;
- if(j == 0) continue;
-
- j = 0;
- if(mb_x > 0 && fixed[mb_xy-1 ] == MV_CHANGED) j = 1;
- if(mb_x + 1 < mb_width && fixed[mb_xy+1 ] == MV_CHANGED) j = 1;
- if(mb_y > 0 && fixed[mb_xy-mb_stride] == MV_CHANGED) j = 1;
- if(mb_y + 1 < mb_height && fixed[mb_xy+mb_stride] == MV_CHANGED) j = 1;
- if(j == 0 && pass > 1) continue;
-
- none_left = 0;
-
- if(mb_x > 0 && fixed[mb_xy-1])
- {
- mv_predictor[pred_count][0] = s->current_picture.motion_val[0][mot_index - 2][0];
- mv_predictor[pred_count][1] = s->current_picture.motion_val[0][mot_index - 2][1];
+ j=0;
+ if(mb_x>0 && fixed[mb_xy-1 ]==MV_FROZEN) j=1;
+ if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_FROZEN) j=1;
+ if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_FROZEN) j=1;
+ if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_FROZEN) j=1;
+ if(j==0) continue;
+
+ j=0;
+ if(mb_x>0 && fixed[mb_xy-1 ]==MV_CHANGED) j=1;
+ if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_CHANGED) j=1;
+ if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_CHANGED) j=1;
+ if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_CHANGED) j=1;
+ if(j==0 && pass>1) continue;
+
+ none_left=0;
+
+ if(mb_x>0 && fixed[mb_xy-1]){
+ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - 2][0];
+ mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - 2][1];
pred_count++;
}
- if(mb_x + 1 < mb_width && fixed[mb_xy+1])
- {
- mv_predictor[pred_count][0] = s->current_picture.motion_val[0][mot_index + 2][0];
- mv_predictor[pred_count][1] = s->current_picture.motion_val[0][mot_index + 2][1];
+ if(mb_x+1<mb_width && fixed[mb_xy+1]){
+ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + 2][0];
+ mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + 2][1];
pred_count++;
}
- if(mb_y > 0 && fixed[mb_xy-mb_stride])
- {
- mv_predictor[pred_count][0] = s->current_picture.motion_val[0][mot_index - mot_stride*2][0];
- mv_predictor[pred_count][1] = s->current_picture.motion_val[0][mot_index - mot_stride*2][1];
+ if(mb_y>0 && fixed[mb_xy-mb_stride]){
+ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_stride*2][0];
+ mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_stride*2][1];
pred_count++;
}
- if(mb_y + 1 < mb_height && fixed[mb_xy+mb_stride])
- {
- mv_predictor[pred_count][0] = s->current_picture.motion_val[0][mot_index + mot_stride*2][0];
- mv_predictor[pred_count][1] = s->current_picture.motion_val[0][mot_index + mot_stride*2][1];
+ if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){
+ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_stride*2][0];
+ mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_stride*2][1];
pred_count++;
}
- if(pred_count == 0) continue;
+ if(pred_count==0) continue;
- if(pred_count > 1)
- {
- int sum_x = 0, sum_y = 0;
+ if(pred_count>1){
+ int sum_x=0, sum_y=0;
int max_x, max_y, min_x, min_y;
- for(j = 0; j < pred_count; j++)
- {
- sum_x += mv_predictor[j][0];
- sum_y += mv_predictor[j][1];
+ for(j=0; j<pred_count; j++){
+ sum_x+= mv_predictor[j][0];
+ sum_y+= mv_predictor[j][1];
}
/* mean */
- mv_predictor[pred_count][0] = sum_x / j;
- mv_predictor[pred_count][1] = sum_y / j;
+ mv_predictor[pred_count][0] = sum_x/j;
+ mv_predictor[pred_count][1] = sum_y/j;
/* median */
- if(pred_count >= 3)
- {
- min_y = min_x = 99999;
- max_y = max_x = -99999;
- }
- else
- {
- min_x = min_y = max_x = max_y = 0;
+ if(pred_count>=3){
+ min_y= min_x= 99999;
+ max_y= max_x=-99999;
+ }else{
+ min_x=min_y=max_x=max_y=0;
}
- for(j = 0; j < pred_count; j++)
- {
- max_x = FFMAX(max_x, mv_predictor[j][0]);
- max_y = FFMAX(max_y, mv_predictor[j][1]);
- min_x = FFMIN(min_x, mv_predictor[j][0]);
- min_y = FFMIN(min_y, mv_predictor[j][1]);
+ for(j=0; j<pred_count; j++){
+ max_x= FFMAX(max_x, mv_predictor[j][0]);
+ max_y= FFMAX(max_y, mv_predictor[j][1]);
+ min_x= FFMIN(min_x, mv_predictor[j][0]);
+ min_y= FFMIN(min_y, mv_predictor[j][1]);
}
mv_predictor[pred_count+1][0] = sum_x - max_x - min_x;
mv_predictor[pred_count+1][1] = sum_y - max_y - min_y;
- if(pred_count == 4)
- {
+ if(pred_count==4){
mv_predictor[pred_count+1][0] /= 2;
mv_predictor[pred_count+1][1] /= 2;
}
- pred_count += 2;
+ pred_count+=2;
}
/* zero MV */
pred_count++;
/* last MV */
- mv_predictor[pred_count][0] = s->current_picture.motion_val[0][mot_index][0];
- mv_predictor[pred_count][1] = s->current_picture.motion_val[0][mot_index][1];
+ mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index][0];
+ mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index][1];
pred_count++;
s->mv_dir = MV_DIR_FORWARD;
- s->mb_intra = 0;
+ s->mb_intra=0;
s->mv_type = MV_TYPE_16X16;
- s->mb_skipped = 0;
+ s->mb_skipped=0;
s->dsp.clear_blocks(s->block[0]);
- s->mb_x = mb_x;
- s->mb_y = mb_y;
+ s->mb_x= mb_x;
+ s->mb_y= mb_y;
- for(j = 0; j < pred_count; j++)
- {
- int score = 0;
- uint8_t *src = s->current_picture.data[0] + mb_x * 16 + mb_y * 16 * s->linesize;
+ for(j=0; j<pred_count; j++){
+ int score=0;
+ uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
- s->current_picture.motion_val[0][mot_index][0] = s->mv[0][0][0] = mv_predictor[j][0];
- s->current_picture.motion_val[0][mot_index][1] = s->mv[0][0][1] = mv_predictor[j][1];
+ s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0];
+ s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1];
decode_mb(s);
- if(mb_x > 0 && fixed[mb_xy-1])
- {
+ if(mb_x>0 && fixed[mb_xy-1]){
int k;
- for(k = 0; k < 16; k++)
- score += FFABS(src[k*s->linesize-1 ] - src[k*s->linesize ]);
+ for(k=0; k<16; k++)
+ score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize ]);
}
- if(mb_x + 1 < mb_width && fixed[mb_xy+1])
- {
+ if(mb_x+1<mb_width && fixed[mb_xy+1]){
int k;
- for(k = 0; k < 16; k++)
- score += FFABS(src[k*s->linesize+15] - src[k*s->linesize+16]);
+ for(k=0; k<16; k++)
+ score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]);
}
- if(mb_y > 0 && fixed[mb_xy-mb_stride])
- {
+ if(mb_y>0 && fixed[mb_xy-mb_stride]){
int k;
- for(k = 0; k < 16; k++)
- score += FFABS(src[k-s->linesize ] - src[k ]);
+ for(k=0; k<16; k++)
+ score += FFABS(src[k-s->linesize ]-src[k ]);
}
- if(mb_y + 1 < mb_height && fixed[mb_xy+mb_stride])
- {
+ if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){
int k;
- for(k = 0; k < 16; k++)
- score += FFABS(src[k+s->linesize*15] - src[k+s->linesize*16]);
+ for(k=0; k<16; k++)
+ score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]);
}
- if(score <= best_score) // <= will favor the last MV
- {
- best_score = score;
- best_pred = j;
+ if(score <= best_score){ // <= will favor the last MV
+ best_score= score;
+ best_pred= j;
}
}
- score_sum += best_score;
+score_sum+= best_score;
//FIXME no need to set s->current_picture.motion_val[0][mot_index][0] explicit
- s->current_picture.motion_val[0][mot_index][0] = s->mv[0][0][0] = mv_predictor[best_pred][0];
- s->current_picture.motion_val[0][mot_index][1] = s->mv[0][0][1] = mv_predictor[best_pred][1];
+ s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[best_pred][0];
+ s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[best_pred][1];
decode_mb(s);
- if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y)
- {
- fixed[mb_xy] = MV_CHANGED;
+ if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){
+ fixed[mb_xy]=MV_CHANGED;
changed++;
- }
- else
- fixed[mb_xy] = MV_UNCHANGED;
+ }else
+ fixed[mb_xy]=MV_UNCHANGED;
}
}
@@ -606,65 +543,57 @@ static void guess_mv(MpegEncContext *s)
if(none_left)
return;
- for(i = 0; i < s->mb_num; i++)
- {
- int mb_xy = s->mb_index2xy[i];
+ for(i=0; i<s->mb_num; i++){
+ int mb_xy= s->mb_index2xy[i];
if(fixed[mb_xy])
- fixed[mb_xy] = MV_FROZEN;
+ fixed[mb_xy]=MV_FROZEN;
}
// printf(":"); fflush(stdout);
}
}
-static int is_intra_more_likely(MpegEncContext *s)
-{
+static int is_intra_more_likely(MpegEncContext *s){
int is_intra_likely, i, j, undamaged_count, skip_amount, mb_x, mb_y;
if(!s->last_picture_ptr || !s->last_picture_ptr->data[0]) return 1; //no previous frame available -> use spatial prediction
- undamaged_count = 0;
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
- const int error = s->error_status_table[mb_xy];
- if(!((error & DC_ERROR) && (error & MV_ERROR)))
+ undamaged_count=0;
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
+ const int error= s->error_status_table[mb_xy];
+ if(!((error&DC_ERROR) && (error&MV_ERROR)))
undamaged_count++;
}
if(undamaged_count < 5) return 0; //almost all MBs damaged -> use temporal prediction
- skip_amount = FFMAX(undamaged_count / 50, 1); //check only upto 50 MBs
- is_intra_likely = 0;
+ skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs
+ is_intra_likely=0;
- j = 0;
- for(mb_y = 0; mb_y < s->mb_height - 1; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
+ j=0;
+ for(mb_y= 0; mb_y<s->mb_height-1; mb_y++){
+ for(mb_x= 0; mb_x<s->mb_width; mb_x++){
int error;
- const int mb_xy = mb_x + mb_y * s->mb_stride;
+ const int mb_xy= mb_x + mb_y*s->mb_stride;
- error = s->error_status_table[mb_xy];
- if((error & DC_ERROR) && (error & MV_ERROR))
+ error= s->error_status_table[mb_xy];
+ if((error&DC_ERROR) && (error&MV_ERROR))
continue; //skip damaged
j++;
- if((j % skip_amount) != 0) continue; //skip a few to speed things up
+ if((j%skip_amount) != 0) continue; //skip a few to speed things up
- if(s->pict_type == FF_I_TYPE)
- {
- uint8_t *mb_ptr = s->current_picture.data[0] + mb_x * 16 + mb_y * 16 * s->linesize;
- uint8_t *last_mb_ptr = s->last_picture.data [0] + mb_x * 16 + mb_y * 16 * s->linesize;
+ if(s->pict_type==FF_I_TYPE){
+ uint8_t *mb_ptr = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
+ uint8_t *last_mb_ptr= s->last_picture.data [0] + mb_x*16 + mb_y*16*s->linesize;
is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr , s->linesize, 16);
- is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr + s->linesize * 16, s->linesize, 16);
- }
- else
- {
+ is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize, 16);
+ }else{
if(IS_INTRA(s->current_picture.mb_type[mb_xy]))
- is_intra_likely++;
+ is_intra_likely++;
else
- is_intra_likely--;
+ is_intra_likely--;
}
}
}
@@ -672,12 +601,11 @@ static int is_intra_more_likely(MpegEncContext *s)
return is_intra_likely > 0;
}
-void ff_er_frame_start(MpegEncContext *s)
-{
+void ff_er_frame_start(MpegEncContext *s){
if(!s->error_recognition) return;
- memset(s->error_status_table, MV_ERROR | AC_ERROR | DC_ERROR | VP_START | AC_END | DC_END | MV_END, s->mb_stride * s->mb_height * sizeof(uint8_t));
- s->error_count = 3 * s->mb_num;
+ memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t));
+ s->error_count= 3*s->mb_num;
}
/**
@@ -686,16 +614,14 @@ void ff_er_frame_start(MpegEncContext *s)
* @param status the status at the end (MV_END, AC_ERROR, ...), it is assumed that no earlier end or
* error of the same type occurred
*/
-void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status)
-{
- const int start_i = av_clip(startx + starty * s->mb_width , 0, s->mb_num - 1);
+void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){
+ const int start_i= av_clip(startx + starty * s->mb_width , 0, s->mb_num-1);
const int end_i = av_clip(endx + endy * s->mb_width , 0, s->mb_num);
- const int start_xy = s->mb_index2xy[start_i];
+ const int start_xy= s->mb_index2xy[start_i];
const int end_xy = s->mb_index2xy[end_i];
- int mask = -1;
+ int mask= -1;
- if(start_i > end_i || start_xy > end_xy)
- {
+ if(start_i > end_i || start_xy > end_xy){
av_log(s->avctx, AV_LOG_ERROR, "internal error, slice end before start\n");
return;
}
@@ -703,96 +629,80 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en
if(!s->error_recognition) return;
mask &= ~VP_START;
- if(status & (AC_ERROR | AC_END))
- {
- mask &= ~(AC_ERROR | AC_END);
+ if(status & (AC_ERROR|AC_END)){
+ mask &= ~(AC_ERROR|AC_END);
s->error_count -= end_i - start_i + 1;
}
- if(status & (DC_ERROR | DC_END))
- {
- mask &= ~(DC_ERROR | DC_END);
+ if(status & (DC_ERROR|DC_END)){
+ mask &= ~(DC_ERROR|DC_END);
s->error_count -= end_i - start_i + 1;
}
- if(status & (MV_ERROR | MV_END))
- {
- mask &= ~(MV_ERROR | MV_END);
+ if(status & (MV_ERROR|MV_END)){
+ mask &= ~(MV_ERROR|MV_END);
s->error_count -= end_i - start_i + 1;
}
- if(status & (AC_ERROR | DC_ERROR | MV_ERROR)) s->error_count = INT_MAX;
+ if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) s->error_count= INT_MAX;
- if(mask == ~0x7F)
- {
+ if(mask == ~0x7F){
memset(&s->error_status_table[start_xy], 0, (end_xy - start_xy) * sizeof(uint8_t));
- }
- else
- {
+ }else{
int i;
- for(i = start_xy; i < end_xy; i++)
- {
+ for(i=start_xy; i<end_xy; i++){
s->error_status_table[ i ] &= mask;
}
}
if(end_i == s->mb_num)
- s->error_count = INT_MAX;
- else
- {
+ s->error_count= INT_MAX;
+ else{
s->error_status_table[end_xy] &= mask;
s->error_status_table[end_xy] |= status;
}
s->error_status_table[start_xy] |= VP_START;
- if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top * s->mb_width < start_i)
- {
- int prev_status = s->error_status_table[ s->mb_index2xy[start_i - 1] ];
+ if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top*s->mb_width < start_i){
+ int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1] ];
prev_status &= ~ VP_START;
- if(prev_status != (MV_END | DC_END | AC_END)) s->error_count = INT_MAX;
+ if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX;
}
}
-void ff_er_frame_end(MpegEncContext *s)
-{
+void ff_er_frame_end(MpegEncContext *s){
int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;
int distance;
- int threshold_part[4] = {100, 100, 100};
- int threshold = 50;
+ int threshold_part[4]= {100,100,100};
+ int threshold= 50;
int is_intra_likely;
int size = s->b8_stride * 2 * s->mb_height;
- Picture *pic = s->current_picture_ptr;
+ Picture *pic= s->current_picture_ptr;
- if(!s->error_recognition || s->error_count == 0 || s->avctx->lowres ||
- s->error_count == 3 * s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return;
+ if(!s->error_recognition || s->error_count==0 || s->avctx->lowres ||
+ s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return;
- if(s->current_picture.motion_val[0] == NULL)
- {
+ if(s->current_picture.motion_val[0] == NULL){
av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
- for(i = 0; i < 2; i++)
- {
- pic->ref_index[i] = av_mallocz(size * sizeof(uint8_t));
- pic->motion_val_base[i] = av_mallocz((size + 4) * 2 * sizeof(uint16_t));
- pic->motion_val[i] = pic->motion_val_base[i] + 4;
+ for(i=0; i<2; i++){
+ pic->ref_index[i]= av_mallocz(size * sizeof(uint8_t));
+ pic->motion_val_base[i]= av_mallocz((size+4) * 2 * sizeof(uint16_t));
+ pic->motion_val[i]= pic->motion_val_base[i]+4;
}
- pic->motion_subsample_log2 = 3;
- s->current_picture = *s->current_picture_ptr;
+ pic->motion_subsample_log2= 3;
+ s->current_picture= *s->current_picture_ptr;
}
- for(i = 0; i < 2; i++)
- {
+ for(i=0; i<2; i++){
if(pic->ref_index[i])
memset(pic->ref_index[i], 0, size * sizeof(uint8_t));
}
- if(s->avctx->debug & FF_DEBUG_ER)
- {
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- int status = s->error_status_table[mb_x + mb_y*s->mb_stride];
+ if(s->avctx->debug&FF_DEBUG_ER){
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ int status= s->error_status_table[mb_x + mb_y*s->mb_stride];
av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status);
}
@@ -802,206 +712,181 @@ void ff_er_frame_end(MpegEncContext *s)
#if 1
/* handle overlapping slices */
- for(error_type = 1; error_type <= 3; error_type++)
- {
- int end_ok = 0;
+ for(error_type=1; error_type<=3; error_type++){
+ int end_ok=0;
- for(i = s->mb_num - 1; i >= 0; i--)
- {
- const int mb_xy = s->mb_index2xy[i];
- int error = s->error_status_table[mb_xy];
+ for(i=s->mb_num-1; i>=0; i--){
+ const int mb_xy= s->mb_index2xy[i];
+ int error= s->error_status_table[mb_xy];
- if(error&(1 << error_type))
- end_ok = 1;
- if(error&(8 << error_type))
- end_ok = 1;
+ if(error&(1<<error_type))
+ end_ok=1;
+ if(error&(8<<error_type))
+ end_ok=1;
if(!end_ok)
- s->error_status_table[mb_xy] |= 1 << error_type;
+ s->error_status_table[mb_xy]|= 1<<error_type;
- if(error & VP_START)
- end_ok = 0;
+ if(error&VP_START)
+ end_ok=0;
}
}
#endif
#if 1
/* handle slices with partitions of different length */
- if(s->partitioned_frame)
- {
- int end_ok = 0;
+ if(s->partitioned_frame){
+ int end_ok=0;
- for(i = s->mb_num - 1; i >= 0; i--)
- {
- const int mb_xy = s->mb_index2xy[i];
- int error = s->error_status_table[mb_xy];
+ for(i=s->mb_num-1; i>=0; i--){
+ const int mb_xy= s->mb_index2xy[i];
+ int error= s->error_status_table[mb_xy];
- if(error & AC_END)
- end_ok = 0;
- if((error & MV_END) || (error & DC_END) || (error & AC_ERROR))
- end_ok = 1;
+ if(error&AC_END)
+ end_ok=0;
+ if((error&MV_END) || (error&DC_END) || (error&AC_ERROR))
+ end_ok=1;
if(!end_ok)
- s->error_status_table[mb_xy] |= AC_ERROR;
+ s->error_status_table[mb_xy]|= AC_ERROR;
- if(error & VP_START)
- end_ok = 0;
+ if(error&VP_START)
+ end_ok=0;
}
}
#endif
/* handle missing slices */
- if(s->error_recognition >= 4)
- {
- int end_ok = 1;
-
- for(i = s->mb_num - 2; i >= s->mb_width + 100; i--) //FIXME +100 hack
- {
- const int mb_xy = s->mb_index2xy[i];
- int error1 = s->error_status_table[mb_xy ];
- int error2 = s->error_status_table[s->mb_index2xy[i+1]];
-
- if(error1 & VP_START)
- end_ok = 1;
-
- if(error2 == (VP_START | DC_ERROR | AC_ERROR | MV_ERROR | AC_END | DC_END | MV_END)
- && error1 != (VP_START | DC_ERROR | AC_ERROR | MV_ERROR | AC_END | DC_END | MV_END)
- && ((error1 & AC_END) || (error1 & DC_END) || (error1 & MV_END))) //end & uninit
- {
- end_ok = 0;
+ if(s->error_recognition>=4){
+ int end_ok=1;
+
+ for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack
+ const int mb_xy= s->mb_index2xy[i];
+ int error1= s->error_status_table[mb_xy ];
+ int error2= s->error_status_table[s->mb_index2xy[i+1]];
+
+ if(error1&VP_START)
+ end_ok=1;
+
+ if( error2==(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END)
+ && error1!=(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END)
+ && ((error1&AC_END) || (error1&DC_END) || (error1&MV_END))){ //end & uninit
+ end_ok=0;
}
if(!end_ok)
- s->error_status_table[mb_xy] |= DC_ERROR | AC_ERROR | MV_ERROR;
+ s->error_status_table[mb_xy]|= DC_ERROR|AC_ERROR|MV_ERROR;
}
}
#if 1
/* backward mark errors */
- distance = 9999999;
- for(error_type = 1; error_type <= 3; error_type++)
- {
- for(i = s->mb_num - 1; i >= 0; i--)
- {
- const int mb_xy = s->mb_index2xy[i];
- int error = s->error_status_table[mb_xy];
+ distance=9999999;
+ for(error_type=1; error_type<=3; error_type++){
+ for(i=s->mb_num-1; i>=0; i--){
+ const int mb_xy= s->mb_index2xy[i];
+ int error= s->error_status_table[mb_xy];
if(!s->mbskip_table[mb_xy]) //FIXME partition specific
distance++;
- if(error&(1 << error_type))
- distance = 0;
+ if(error&(1<<error_type))
+ distance= 0;
- if(s->partitioned_frame)
- {
+ if(s->partitioned_frame){
if(distance < threshold_part[error_type-1])
- s->error_status_table[mb_xy] |= 1 << error_type;
- }
- else
- {
+ s->error_status_table[mb_xy]|= 1<<error_type;
+ }else{
if(distance < threshold)
- s->error_status_table[mb_xy] |= 1 << error_type;
+ s->error_status_table[mb_xy]|= 1<<error_type;
}
- if(error & VP_START)
- distance = 9999999;
+ if(error&VP_START)
+ distance= 9999999;
}
}
#endif
/* forward mark errors */
- error = 0;
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
- int old_error = s->error_status_table[mb_xy];
-
- if(old_error & VP_START)
- error = old_error & (DC_ERROR | AC_ERROR | MV_ERROR);
- else
- {
- error |= old_error & (DC_ERROR | AC_ERROR | MV_ERROR);
- s->error_status_table[mb_xy] |= error;
+ error=0;
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
+ int old_error= s->error_status_table[mb_xy];
+
+ if(old_error&VP_START)
+ error= old_error& (DC_ERROR|AC_ERROR|MV_ERROR);
+ else{
+ error|= old_error& (DC_ERROR|AC_ERROR|MV_ERROR);
+ s->error_status_table[mb_xy]|= error;
}
}
#if 1
/* handle not partitioned case */
- if(!s->partitioned_frame)
- {
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
- error = s->error_status_table[mb_xy];
- if(error&(AC_ERROR | DC_ERROR | MV_ERROR))
- error |= AC_ERROR | DC_ERROR | MV_ERROR;
- s->error_status_table[mb_xy] = error;
+ if(!s->partitioned_frame){
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
+ error= s->error_status_table[mb_xy];
+ if(error&(AC_ERROR|DC_ERROR|MV_ERROR))
+ error|= AC_ERROR|DC_ERROR|MV_ERROR;
+ s->error_status_table[mb_xy]= error;
}
}
#endif
- dc_error = ac_error = mv_error = 0;
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
- error = s->error_status_table[mb_xy];
- if(error & DC_ERROR) dc_error ++;
- if(error & AC_ERROR) ac_error ++;
- if(error & MV_ERROR) mv_error ++;
+ dc_error= ac_error= mv_error=0;
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
+ error= s->error_status_table[mb_xy];
+ if(error&DC_ERROR) dc_error ++;
+ if(error&AC_ERROR) ac_error ++;
+ if(error&MV_ERROR) mv_error ++;
}
av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors\n", dc_error, ac_error, mv_error);
- is_intra_likely = is_intra_more_likely(s);
+ is_intra_likely= is_intra_more_likely(s);
/* set unknown mb-type to most likely */
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
- error = s->error_status_table[mb_xy];
- if(!((error & DC_ERROR) && (error & MV_ERROR)))
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
+ error= s->error_status_table[mb_xy];
+ if(!((error&DC_ERROR) && (error&MV_ERROR)))
continue;
if(is_intra_likely)
- s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA4x4;
+ s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA4x4;
else
- s->current_picture.mb_type[mb_xy] = MB_TYPE_16x16 | MB_TYPE_L0;
+ s->current_picture.mb_type[mb_xy]= MB_TYPE_16x16 | MB_TYPE_L0;
}
// change inter to intra blocks if no reference frames are available
- if(!s->last_picture.data[0] && !s->next_picture.data[0])
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
+ if (!s->last_picture.data[0] && !s->next_picture.data[0])
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
if(!IS_INTRA(s->current_picture.mb_type[mb_xy]))
- s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA4x4;
+ s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA4x4;
}
/* handle inter blocks with damaged AC */
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- const int mb_xy = mb_x + mb_y * s->mb_stride;
- const int mb_type = s->current_picture.mb_type[mb_xy];
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ const int mb_xy= mb_x + mb_y * s->mb_stride;
+ const int mb_type= s->current_picture.mb_type[mb_xy];
int dir = !s->last_picture.data[0];
- error = s->error_status_table[mb_xy];
+ error= s->error_status_table[mb_xy];
if(IS_INTRA(mb_type)) continue; //intra
- if(error & MV_ERROR) continue; //inter with damaged MV
- if(!(error & AC_ERROR)) continue; //undamaged inter
+ if(error&MV_ERROR) continue; //inter with damaged MV
+ if(!(error&AC_ERROR)) continue; //undamaged inter
s->mv_dir = dir ? MV_DIR_BACKWARD : MV_DIR_FORWARD;
- s->mb_intra = 0;
- s->mb_skipped = 0;
- if(IS_8X8(mb_type))
- {
- int mb_index = mb_x * 2 + mb_y * 2 * s->b8_stride;
+ s->mb_intra=0;
+ s->mb_skipped=0;
+ if(IS_8X8(mb_type)){
+ int mb_index= mb_x*2 + mb_y*2*s->b8_stride;
int j;
s->mv_type = MV_TYPE_8X8;
- for(j = 0; j < 4; j++)
- {
+ for(j=0; j<4; j++){
s->mv[0][j][0] = s->current_picture.motion_val[dir][ mb_index + (j&1) + (j>>1)*s->b8_stride ][0];
s->mv[0][j][1] = s->current_picture.motion_val[dir][ mb_index + (j&1) + (j>>1)*s->b8_stride ][1];
}
- }
- else
- {
+ }else{
s->mv_type = MV_TYPE_16X16;
s->mv[0][0][0] = s->current_picture.motion_val[dir][ mb_x*2 + mb_y*2*s->b8_stride ][0];
s->mv[0][0][1] = s->current_picture.motion_val[dir][ mb_x*2 + mb_y*2*s->b8_stride ][1];
@@ -1009,169 +894,150 @@ void ff_er_frame_end(MpegEncContext *s)
s->dsp.clear_blocks(s->block[0]);
- s->mb_x = mb_x;
- s->mb_y = mb_y;
+ s->mb_x= mb_x;
+ s->mb_y= mb_y;
decode_mb(s);
}
}
/* guess MVs */
- if(s->pict_type == FF_B_TYPE)
- {
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- int xy = mb_x * 2 + mb_y * 2 * s->b8_stride;
- const int mb_xy = mb_x + mb_y * s->mb_stride;
- const int mb_type = s->current_picture.mb_type[mb_xy];
- error = s->error_status_table[mb_xy];
+ if(s->pict_type==FF_B_TYPE){
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ int xy= mb_x*2 + mb_y*2*s->b8_stride;
+ const int mb_xy= mb_x + mb_y * s->mb_stride;
+ const int mb_type= s->current_picture.mb_type[mb_xy];
+ error= s->error_status_table[mb_xy];
if(IS_INTRA(mb_type)) continue;
- if(!(error & MV_ERROR)) continue; //inter with undamaged MV
- if(!(error & AC_ERROR)) continue; //undamaged inter
+ if(!(error&MV_ERROR)) continue; //inter with undamaged MV
+ if(!(error&AC_ERROR)) continue; //undamaged inter
- s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
+ s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD;
if(!s->last_picture.data[0]) s->mv_dir &= ~MV_DIR_FORWARD;
if(!s->next_picture.data[0]) s->mv_dir &= ~MV_DIR_BACKWARD;
- s->mb_intra = 0;
+ s->mb_intra=0;
s->mv_type = MV_TYPE_16X16;
- s->mb_skipped = 0;
-
- if(s->pp_time)
- {
- int time_pp = s->pp_time;
- int time_pb = s->pb_time;
-
- s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0] * time_pb / time_pp;
- s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1] * time_pb / time_pp;
- s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0] * (time_pb - time_pp) / time_pp;
- s->mv[1][0][1] = s->next_picture.motion_val[0][xy][1] * (time_pb - time_pp) / time_pp;
- }
- else
- {
- s->mv[0][0][0] = 0;
- s->mv[0][0][1] = 0;
- s->mv[1][0][0] = 0;
- s->mv[1][0][1] = 0;
+ s->mb_skipped=0;
+
+ if(s->pp_time){
+ int time_pp= s->pp_time;
+ int time_pb= s->pb_time;
+
+ s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp;
+ s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp;
+ s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp;
+ s->mv[1][0][1] = s->next_picture.motion_val[0][xy][1]*(time_pb - time_pp)/time_pp;
+ }else{
+ s->mv[0][0][0]= 0;
+ s->mv[0][0][1]= 0;
+ s->mv[1][0][0]= 0;
+ s->mv[1][0][1]= 0;
}
s->dsp.clear_blocks(s->block[0]);
- s->mb_x = mb_x;
- s->mb_y = mb_y;
+ s->mb_x= mb_x;
+ s->mb_y= mb_y;
decode_mb(s);
}
}
- }
- else
+ }else
guess_mv(s);
/* fill DC for inter blocks */
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
int dc, dcu, dcv, y, n;
int16_t *dc_ptr;
uint8_t *dest_y, *dest_cb, *dest_cr;
- const int mb_xy = mb_x + mb_y * s->mb_stride;
- const int mb_type = s->current_picture.mb_type[mb_xy];
+ const int mb_xy= mb_x + mb_y * s->mb_stride;
+ const int mb_type= s->current_picture.mb_type[mb_xy];
- error = s->error_status_table[mb_xy];
+ error= s->error_status_table[mb_xy];
if(IS_INTRA(mb_type) && s->partitioned_frame) continue;
// if(error&MV_ERROR) continue; //inter data damaged FIXME is this good?
- dest_y = s->current_picture.data[0] + mb_x * 16 + mb_y * 16 * s->linesize;
- dest_cb = s->current_picture.data[1] + mb_x * 8 + mb_y * 8 * s->uvlinesize;
- dest_cr = s->current_picture.data[2] + mb_x * 8 + mb_y * 8 * s->uvlinesize;
+ dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
+ dest_cb= s->current_picture.data[1] + mb_x*8 + mb_y*8 *s->uvlinesize;
+ dest_cr= s->current_picture.data[2] + mb_x*8 + mb_y*8 *s->uvlinesize;
- dc_ptr = &s->dc_val[0][mb_x*2 + mb_y*2*s->b8_stride];
- for(n = 0; n < 4; n++)
- {
- dc = 0;
- for(y = 0; y < 8; y++)
- {
+ dc_ptr= &s->dc_val[0][mb_x*2 + mb_y*2*s->b8_stride];
+ for(n=0; n<4; n++){
+ dc=0;
+ for(y=0; y<8; y++){
int x;
- for(x = 0; x < 8; x++)
- {
- dc += dest_y[x + (n&1)*8 + (y + (n>>1)*8)*s->linesize];
+ for(x=0; x<8; x++){
+ dc+= dest_y[x + (n&1)*8 + (y + (n>>1)*8)*s->linesize];
}
}
- dc_ptr[(n&1) + (n>>1)*s->b8_stride] = (dc + 4) >> 3;
+ dc_ptr[(n&1) + (n>>1)*s->b8_stride]= (dc+4)>>3;
}
- dcu = dcv = 0;
- for(y = 0; y < 8; y++)
- {
+ dcu=dcv=0;
+ for(y=0; y<8; y++){
int x;
- for(x = 0; x < 8; x++)
- {
- dcu += dest_cb[x + y*(s->uvlinesize)];
- dcv += dest_cr[x + y*(s->uvlinesize)];
+ for(x=0; x<8; x++){
+ dcu+=dest_cb[x + y*(s->uvlinesize)];
+ dcv+=dest_cr[x + y*(s->uvlinesize)];
}
}
- s->dc_val[1][mb_x + mb_y*s->mb_stride] = (dcu + 4) >> 3;
- s->dc_val[2][mb_x + mb_y*s->mb_stride] = (dcv + 4) >> 3;
+ s->dc_val[1][mb_x + mb_y*s->mb_stride]= (dcu+4)>>3;
+ s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3;
}
}
#if 1
/* guess DC for damaged blocks */
- guess_dc(s, s->dc_val[0], s->mb_width * 2, s->mb_height * 2, s->b8_stride, 1);
+ guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1);
guess_dc(s, s->dc_val[1], s->mb_width , s->mb_height , s->mb_stride, 0);
guess_dc(s, s->dc_val[2], s->mb_width , s->mb_height , s->mb_stride, 0);
#endif
/* filter luma DC */
- filter181(s->dc_val[0], s->mb_width * 2, s->mb_height * 2, s->b8_stride);
+ filter181(s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride);
#if 1
/* render DC only intra */
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
uint8_t *dest_y, *dest_cb, *dest_cr;
- const int mb_xy = mb_x + mb_y * s->mb_stride;
- const int mb_type = s->current_picture.mb_type[mb_xy];
+ const int mb_xy= mb_x + mb_y * s->mb_stride;
+ const int mb_type= s->current_picture.mb_type[mb_xy];
- error = s->error_status_table[mb_xy];
+ error= s->error_status_table[mb_xy];
if(IS_INTER(mb_type)) continue;
- if(!(error & AC_ERROR)) continue; //undamaged
+ if(!(error&AC_ERROR)) continue; //undamaged
- dest_y = s->current_picture.data[0] + mb_x * 16 + mb_y * 16 * s->linesize;
- dest_cb = s->current_picture.data[1] + mb_x * 8 + mb_y * 8 * s->uvlinesize;
- dest_cr = s->current_picture.data[2] + mb_x * 8 + mb_y * 8 * s->uvlinesize;
+ dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
+ dest_cb= s->current_picture.data[1] + mb_x*8 + mb_y*8 *s->uvlinesize;
+ dest_cr= s->current_picture.data[2] + mb_x*8 + mb_y*8 *s->uvlinesize;
put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y);
}
}
#endif
- if(s->avctx->error_concealment & FF_EC_DEBLOCK)
- {
+ if(s->avctx->error_concealment&FF_EC_DEBLOCK){
/* filter horizontal block boundaries */
- h_block_filter(s, s->current_picture.data[0], s->mb_width * 2, s->mb_height * 2, s->linesize , 1);
+ h_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize , 1);
h_block_filter(s, s->current_picture.data[1], s->mb_width , s->mb_height , s->uvlinesize, 0);
h_block_filter(s, s->current_picture.data[2], s->mb_width , s->mb_height , s->uvlinesize, 0);
/* filter vertical block boundaries */
- v_block_filter(s, s->current_picture.data[0], s->mb_width * 2, s->mb_height * 2, s->linesize , 1);
+ v_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize , 1);
v_block_filter(s, s->current_picture.data[1], s->mb_width , s->mb_height , s->uvlinesize, 0);
v_block_filter(s, s->current_picture.data[2], s->mb_width , s->mb_height , s->uvlinesize, 0);
}
ec_clean:
/* clean a few tables */
- for(i = 0; i < s->mb_num; i++)
- {
- const int mb_xy = s->mb_index2xy[i];
- int error = s->error_status_table[mb_xy];
-
- if(s->pict_type != FF_B_TYPE && (error&(DC_ERROR | MV_ERROR | AC_ERROR)))
- {
- s->mbskip_table[mb_xy] = 0;
+ for(i=0; i<s->mb_num; i++){
+ const int mb_xy= s->mb_index2xy[i];
+ int error= s->error_status_table[mb_xy];
+
+ if(s->pict_type!=FF_B_TYPE && (error&(DC_ERROR|MV_ERROR|AC_ERROR))){
+ s->mbskip_table[mb_xy]=0;
}
- s->mbintra_table[mb_xy] = 1;
+ s->mbintra_table[mb_xy]=1;
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eval.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eval.h
index 3e967349c..5481b1407 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eval.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/eval.h
@@ -43,9 +43,9 @@
* @return the value of the expression
*/
double ff_eval2(const char *s, const double *const_value, const char * const *const_name,
- double(**func1)(void *, double), const char **func1_name,
- double(**func2)(void *, double, double), const char **func2_name,
- void *opaque, const char **error);
+ double (**func1)(void *, double), const char **func1_name,
+ double (**func2)(void *, double, double), const char **func2_name,
+ void *opaque, const char **error);
typedef struct ff_expr_s AVEvalExpr;
@@ -62,9 +62,9 @@ typedef struct ff_expr_s AVEvalExpr;
* NULL if anything went wrong
*/
AVEvalExpr * ff_parse(const char *s, const char * const *const_name,
- double(**func1)(void *, double), const char **func1_name,
- double(**func2)(void *, double, double), const char **func2_name,
- const char **error);
+ double (**func1)(void *, double), const char **func1_name,
+ double (**func2)(void *, double, double), const char **func2_name,
+ const char **error);
/**
* Evaluates a previously parsed expression.
* @param const_value a zero terminated array of values for the identifers from ff_parse const_name
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faandct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faandct.c
index 01a4123cf..08818a24c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faandct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faandct.c
@@ -56,16 +56,15 @@ for(i=0; i<8; i++){
#define A5 0.38268343236508977170 // cos(pi*6/16)
#define A4 1.30656296487637652774 // cos(pi*2/16)sqrt(2)
-static const FLOAT postscale[64] =
-{
- B0*B0, B0*B1, B0*B2, B0*B3, B0*B4, B0*B5, B0*B6, B0*B7,
- B1*B0, B1*B1, B1*B2, B1*B3, B1*B4, B1*B5, B1*B6, B1*B7,
- B2*B0, B2*B1, B2*B2, B2*B3, B2*B4, B2*B5, B2*B6, B2*B7,
- B3*B0, B3*B1, B3*B2, B3*B3, B3*B4, B3*B5, B3*B6, B3*B7,
- B4*B0, B4*B1, B4*B2, B4*B3, B4*B4, B4*B5, B4*B6, B4*B7,
- B5*B0, B5*B1, B5*B2, B5*B3, B5*B4, B5*B5, B5*B6, B5*B7,
- B6*B0, B6*B1, B6*B2, B6*B3, B6*B4, B6*B5, B6*B6, B6*B7,
- B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7,
+static const FLOAT postscale[64]={
+B0*B0, B0*B1, B0*B2, B0*B3, B0*B4, B0*B5, B0*B6, B0*B7,
+B1*B0, B1*B1, B1*B2, B1*B3, B1*B4, B1*B5, B1*B6, B1*B7,
+B2*B0, B2*B1, B2*B2, B2*B3, B2*B4, B2*B5, B2*B6, B2*B7,
+B3*B0, B3*B1, B3*B2, B3*B3, B3*B4, B3*B5, B3*B6, B3*B7,
+B4*B0, B4*B1, B4*B2, B4*B3, B4*B4, B4*B5, B4*B6, B4*B7,
+B5*B0, B5*B1, B5*B2, B5*B3, B5*B4, B5*B5, B5*B6, B5*B7,
+B6*B0, B6*B1, B6*B2, B6*B3, B6*B4, B6*B5, B6*B6, B6*B7,
+B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7,
};
static av_always_inline void row_fdct(FLOAT temp[64], DCTELEM * data)
@@ -76,51 +75,50 @@ static av_always_inline void row_fdct(FLOAT temp[64], DCTELEM * data)
FLOAT av_unused z5;
int i;
- for(i = 0; i < 8 * 8; i += 8)
- {
- tmp0 = data[0 + i] + data[7 + i];
- tmp7 = data[0 + i] - data[7 + i];
- tmp1 = data[1 + i] + data[6 + i];
- tmp6 = data[1 + i] - data[6 + i];
- tmp2 = data[2 + i] + data[5 + i];
- tmp5 = data[2 + i] - data[5 + i];
- tmp3 = data[3 + i] + data[4 + i];
- tmp4 = data[3 + i] - data[4 + i];
+ for (i=0; i<8*8; i+=8) {
+ tmp0= data[0 + i] + data[7 + i];
+ tmp7= data[0 + i] - data[7 + i];
+ tmp1= data[1 + i] + data[6 + i];
+ tmp6= data[1 + i] - data[6 + i];
+ tmp2= data[2 + i] + data[5 + i];
+ tmp5= data[2 + i] - data[5 + i];
+ tmp3= data[3 + i] + data[4 + i];
+ tmp4= data[3 + i] - data[4 + i];
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
+ tmp10= tmp0 + tmp3;
+ tmp13= tmp0 - tmp3;
+ tmp11= tmp1 + tmp2;
+ tmp12= tmp1 - tmp2;
- temp[0 + i] = tmp10 + tmp11;
- temp[4 + i] = tmp10 - tmp11;
+ temp[0 + i]= tmp10 + tmp11;
+ temp[4 + i]= tmp10 - tmp11;
tmp12 += tmp13;
tmp12 *= A1;
- temp[2 + i] = tmp13 + tmp12;
- temp[6 + i] = tmp13 - tmp12;
+ temp[2 + i]= tmp13 + tmp12;
+ temp[6 + i]= tmp13 - tmp12;
tmp4 += tmp5;
tmp5 += tmp6;
tmp6 += tmp7;
#if 0
- z5 = (tmp4 - tmp6) * A5;
- z2 = tmp4 * A2 + z5;
- z4 = tmp6 * A4 + z5;
+ z5= (tmp4 - tmp6) * A5;
+ z2= tmp4*A2 + z5;
+ z4= tmp6*A4 + z5;
#else
- z2 = tmp4 * (A2 + A5) - tmp6 * A5;
- z4 = tmp6 * (A4 - A5) + tmp4 * A5;
+ z2= tmp4*(A2+A5) - tmp6*A5;
+ z4= tmp6*(A4-A5) + tmp4*A5;
#endif
- tmp5 *= A1;
+ tmp5*=A1;
- z11 = tmp7 + tmp5;
- z13 = tmp7 - tmp5;
+ z11= tmp7 + tmp5;
+ z13= tmp7 - tmp5;
- temp[5 + i] = z13 + z2;
- temp[3 + i] = z13 - z2;
- temp[1 + i] = z11 + z4;
- temp[7 + i] = z11 - z4;
+ temp[5 + i]= z13 + z2;
+ temp[3 + i]= z13 - z2;
+ temp[1 + i]= z11 + z4;
+ temp[7 + i]= z11 - z4;
}
}
@@ -137,51 +135,50 @@ void ff_faandct(DCTELEM * data)
row_fdct(temp, data);
- for(i = 0; i < 8; i++)
- {
- tmp0 = temp[8*0 + i] + temp[8*7 + i];
- tmp7 = temp[8*0 + i] - temp[8*7 + i];
- tmp1 = temp[8*1 + i] + temp[8*6 + i];
- tmp6 = temp[8*1 + i] - temp[8*6 + i];
- tmp2 = temp[8*2 + i] + temp[8*5 + i];
- tmp5 = temp[8*2 + i] - temp[8*5 + i];
- tmp3 = temp[8*3 + i] + temp[8*4 + i];
- tmp4 = temp[8*3 + i] - temp[8*4 + i];
+ for (i=0; i<8; i++) {
+ tmp0= temp[8*0 + i] + temp[8*7 + i];
+ tmp7= temp[8*0 + i] - temp[8*7 + i];
+ tmp1= temp[8*1 + i] + temp[8*6 + i];
+ tmp6= temp[8*1 + i] - temp[8*6 + i];
+ tmp2= temp[8*2 + i] + temp[8*5 + i];
+ tmp5= temp[8*2 + i] - temp[8*5 + i];
+ tmp3= temp[8*3 + i] + temp[8*4 + i];
+ tmp4= temp[8*3 + i] - temp[8*4 + i];
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
+ tmp10= tmp0 + tmp3;
+ tmp13= tmp0 - tmp3;
+ 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(SCALE(8*0 + i) * (tmp10 + tmp11));
+ data[8*4 + i]= lrintf(SCALE(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(SCALE(8*2 + i) * (tmp13 + tmp12));
+ data[8*6 + i]= lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
tmp4 += tmp5;
tmp5 += tmp6;
tmp6 += tmp7;
#if 0
- z5 = (tmp4 - tmp6) * A5;
- z2 = tmp4 * A2 + z5;
- z4 = tmp6 * A4 + z5;
+ z5= (tmp4 - tmp6) * A5;
+ z2= tmp4*A2 + z5;
+ z4= tmp6*A4 + z5;
#else
- z2 = tmp4 * (A2 + A5) - tmp6 * A5;
- z4 = tmp6 * (A4 - A5) + tmp4 * A5;
+ z2= tmp4*(A2+A5) - tmp6*A5;
+ z4= tmp6*(A4-A5) + tmp4*A5;
#endif
- tmp5 *= A1;
+ tmp5*=A1;
- z11 = tmp7 + tmp5;
- z13 = tmp7 - tmp5;
+ 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(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));
}
}
@@ -196,8 +193,7 @@ void ff_faandct248(DCTELEM * data)
row_fdct(temp, data);
- for(i = 0; i < 8; i++)
- {
+ for (i=0; i<8; i++) {
tmp0 = temp[8*0 + i] + temp[8*1 + i];
tmp1 = temp[8*2 + i] + temp[8*3 + i];
tmp2 = temp[8*4 + i] + temp[8*5 + i];
@@ -212,25 +208,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(SCALE(8*0 + i) * (tmp10 + tmp11));
+ data[8*4 + i] = lrintf(SCALE(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(SCALE(8*2 + i) * (tmp13 + tmp12));
+ data[8*6 + i] = lrintf(SCALE(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(SCALE(8*0 + i) * (tmp10 + tmp11));
+ data[8*5 + i] = lrintf(SCALE(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(SCALE(8*2 + i) * (tmp13 + tmp12));
+ data[8*7 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faanidct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faanidct.c
index 8a6921173..dc3d8fbb8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faanidct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/faanidct.c
@@ -35,43 +35,40 @@
#define A4 0.70710678118654752438 // cos(pi*4/16)
#define A2 0.92387953251128675613 // cos(pi*2/16)
-static const FLOAT prescale[64] =
-{
- B0*B0 / 8, B0*B1 / 8, B0*B2 / 8, B0*B3 / 8, B0*B4 / 8, B0*B5 / 8, B0*B6 / 8, B0*B7 / 8,
- B1*B0 / 8, B1*B1 / 8, B1*B2 / 8, B1*B3 / 8, B1*B4 / 8, B1*B5 / 8, B1*B6 / 8, B1*B7 / 8,
- B2*B0 / 8, B2*B1 / 8, B2*B2 / 8, B2*B3 / 8, B2*B4 / 8, B2*B5 / 8, B2*B6 / 8, B2*B7 / 8,
- B3*B0 / 8, B3*B1 / 8, B3*B2 / 8, B3*B3 / 8, B3*B4 / 8, B3*B5 / 8, B3*B6 / 8, B3*B7 / 8,
- B4*B0 / 8, B4*B1 / 8, B4*B2 / 8, B4*B3 / 8, B4*B4 / 8, B4*B5 / 8, B4*B6 / 8, B4*B7 / 8,
- B5*B0 / 8, B5*B1 / 8, B5*B2 / 8, B5*B3 / 8, B5*B4 / 8, B5*B5 / 8, B5*B6 / 8, B5*B7 / 8,
- B6*B0 / 8, B6*B1 / 8, B6*B2 / 8, B6*B3 / 8, B6*B4 / 8, B6*B5 / 8, B6*B6 / 8, B6*B7 / 8,
- B7*B0 / 8, B7*B1 / 8, B7*B2 / 8, B7*B3 / 8, B7*B4 / 8, B7*B5 / 8, B7*B6 / 8, B7*B7 / 8,
+static const FLOAT prescale[64]={
+B0*B0/8, B0*B1/8, B0*B2/8, B0*B3/8, B0*B4/8, B0*B5/8, B0*B6/8, B0*B7/8,
+B1*B0/8, B1*B1/8, B1*B2/8, B1*B3/8, B1*B4/8, B1*B5/8, B1*B6/8, B1*B7/8,
+B2*B0/8, B2*B1/8, B2*B2/8, B2*B3/8, B2*B4/8, B2*B5/8, B2*B6/8, B2*B7/8,
+B3*B0/8, B3*B1/8, B3*B2/8, B3*B3/8, B3*B4/8, B3*B5/8, B3*B6/8, B3*B7/8,
+B4*B0/8, B4*B1/8, B4*B2/8, B4*B3/8, B4*B4/8, B4*B5/8, B4*B6/8, B4*B7/8,
+B5*B0/8, B5*B1/8, B5*B2/8, B5*B3/8, B5*B4/8, B5*B5/8, B5*B6/8, B5*B7/8,
+B6*B0/8, B6*B1/8, B6*B2/8, B6*B3/8, B6*B4/8, B6*B5/8, B6*B6/8, B6*B7/8,
+B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, B7*B6/8, B7*B7/8,
};
-static inline void p8idct(DCTELEM data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type)
-{
+static inline void p8idct(DCTELEM data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type){
int i;
FLOAT av_unused tmp0;
FLOAT s04, d04, s17, d17, s26, d26, s53, d53;
FLOAT os07, os16, os25, os34;
FLOAT od07, od16, od25, od34;
- for(i = 0; i < y * 8; i += y)
- {
- s17 = temp[1*x + i] + temp[7*x + i];
- d17 = temp[1*x + i] - temp[7*x + i];
- s53 = temp[5*x + i] + temp[3*x + i];
- d53 = temp[5*x + i] - temp[3*x + i];
+ for(i=0; i<y*8; i+=y){
+ s17= temp[1*x + i] + temp[7*x + i];
+ d17= temp[1*x + i] - temp[7*x + i];
+ s53= temp[5*x + i] + temp[3*x + i];
+ d53= temp[5*x + i] - temp[3*x + i];
- od07 = s17 + s53;
- od25 = (s17 - s53) * (2 * A4);
+ od07= s17 + s53;
+ od25= (s17 - s53)*(2*A4);
#if 0 //these 2 are equivalent
- tmp0 = (d17 + d53) * (2 * A2);
- od34 = d17 * (2 * B6) - tmp0;
- od16 = d53 * (-2 * B2) + tmp0;
+ tmp0= (d17 + d53)*(2*A2);
+ od34= d17*( 2*B6) - tmp0;
+ od16= d53*(-2*B2) + tmp0;
#else
- od34 = d17 * (2 * (B6 - A2)) - d53 * (2 * A2);
- od16 = d53 * (2 * (A2 - B2)) + d17 * (2 * A2);
+ od34= d17*(2*(B6-A2)) - d53*(2*A2);
+ od16= d53*(2*(A2-B2)) + d17*(2*A2);
#endif
od16 -= od07;
@@ -80,100 +77,90 @@ static inline void p8idct(DCTELEM data[64], FLOAT temp[64], uint8_t *dest, int s
s26 = temp[2*x + i] + temp[6*x + i];
d26 = temp[2*x + i] - temp[6*x + i];
- d26 *= 2 * A4;
- d26 -= s26;
-
- s04 = temp[0*x + i] + temp[4*x + i];
- d04 = temp[0*x + i] - temp[4*x + i];
-
- os07 = s04 + s26;
- os34 = s04 - s26;
- os16 = d04 + d26;
- os25 = d04 - d26;
-
- if(type == 0)
- {
- temp[0*x + i] = os07 + od07;
- temp[7*x + i] = os07 - od07;
- temp[1*x + i] = os16 + od16;
- temp[6*x + i] = os16 - od16;
- temp[2*x + i] = os25 + od25;
- temp[5*x + i] = os25 - od25;
- temp[3*x + i] = os34 - od34;
- temp[4*x + i] = os34 + od34;
- }
- else if(type == 1)
- {
- data[0*x + i] = lrintf(os07 + od07);
- data[7*x + i] = lrintf(os07 - od07);
- data[1*x + i] = lrintf(os16 + od16);
- data[6*x + i] = lrintf(os16 - od16);
- data[2*x + i] = lrintf(os25 + od25);
- data[5*x + i] = lrintf(os25 - od25);
- data[3*x + i] = lrintf(os34 - od34);
- data[4*x + i] = lrintf(os34 + od34);
- }
- else if(type == 2)
- {
- dest[0*stride + i] = av_clip_uint8(((int)dest[0*stride + i]) + lrintf(os07 + od07));
- dest[7*stride + i] = av_clip_uint8(((int)dest[7*stride + i]) + lrintf(os07 - od07));
- dest[1*stride + i] = av_clip_uint8(((int)dest[1*stride + i]) + lrintf(os16 + od16));
- dest[6*stride + i] = av_clip_uint8(((int)dest[6*stride + i]) + lrintf(os16 - od16));
- dest[2*stride + i] = av_clip_uint8(((int)dest[2*stride + i]) + lrintf(os25 + od25));
- dest[5*stride + i] = av_clip_uint8(((int)dest[5*stride + i]) + lrintf(os25 - od25));
- dest[3*stride + i] = av_clip_uint8(((int)dest[3*stride + i]) + lrintf(os34 - od34));
- dest[4*stride + i] = av_clip_uint8(((int)dest[4*stride + i]) + lrintf(os34 + od34));
- }
- else
- {
- dest[0*stride + i] = av_clip_uint8(lrintf(os07 + od07));
- dest[7*stride + i] = av_clip_uint8(lrintf(os07 - od07));
- dest[1*stride + i] = av_clip_uint8(lrintf(os16 + od16));
- dest[6*stride + i] = av_clip_uint8(lrintf(os16 - od16));
- dest[2*stride + i] = av_clip_uint8(lrintf(os25 + od25));
- dest[5*stride + i] = av_clip_uint8(lrintf(os25 - od25));
- dest[3*stride + i] = av_clip_uint8(lrintf(os34 - od34));
- dest[4*stride + i] = av_clip_uint8(lrintf(os34 + od34));
+ d26*= 2*A4;
+ d26-= s26;
+
+ s04= temp[0*x + i] + temp[4*x + i];
+ d04= temp[0*x + i] - temp[4*x + i];
+
+ os07= s04 + s26;
+ os34= s04 - s26;
+ os16= d04 + d26;
+ os25= d04 - d26;
+
+ if(type==0){
+ temp[0*x + i]= os07 + od07;
+ temp[7*x + i]= os07 - od07;
+ temp[1*x + i]= os16 + od16;
+ temp[6*x + i]= os16 - od16;
+ temp[2*x + i]= os25 + od25;
+ temp[5*x + i]= os25 - od25;
+ temp[3*x + i]= os34 - od34;
+ temp[4*x + i]= os34 + od34;
+ }else if(type==1){
+ data[0*x + i]= lrintf(os07 + od07);
+ data[7*x + i]= lrintf(os07 - od07);
+ data[1*x + i]= lrintf(os16 + od16);
+ data[6*x + i]= lrintf(os16 - od16);
+ data[2*x + i]= lrintf(os25 + od25);
+ data[5*x + i]= lrintf(os25 - od25);
+ data[3*x + i]= lrintf(os34 - od34);
+ data[4*x + i]= lrintf(os34 + od34);
+ }else if(type==2){
+ dest[0*stride + i]= av_clip_uint8(((int)dest[0*stride + i]) + lrintf(os07 + od07));
+ dest[7*stride + i]= av_clip_uint8(((int)dest[7*stride + i]) + lrintf(os07 - od07));
+ dest[1*stride + i]= av_clip_uint8(((int)dest[1*stride + i]) + lrintf(os16 + od16));
+ dest[6*stride + i]= av_clip_uint8(((int)dest[6*stride + i]) + lrintf(os16 - od16));
+ dest[2*stride + i]= av_clip_uint8(((int)dest[2*stride + i]) + lrintf(os25 + od25));
+ dest[5*stride + i]= av_clip_uint8(((int)dest[5*stride + i]) + lrintf(os25 - od25));
+ dest[3*stride + i]= av_clip_uint8(((int)dest[3*stride + i]) + lrintf(os34 - od34));
+ dest[4*stride + i]= av_clip_uint8(((int)dest[4*stride + i]) + lrintf(os34 + od34));
+ }else{
+ dest[0*stride + i]= av_clip_uint8(lrintf(os07 + od07));
+ dest[7*stride + i]= av_clip_uint8(lrintf(os07 - od07));
+ dest[1*stride + i]= av_clip_uint8(lrintf(os16 + od16));
+ dest[6*stride + i]= av_clip_uint8(lrintf(os16 - od16));
+ dest[2*stride + i]= av_clip_uint8(lrintf(os25 + od25));
+ dest[5*stride + i]= av_clip_uint8(lrintf(os25 - od25));
+ dest[3*stride + i]= av_clip_uint8(lrintf(os34 - od34));
+ dest[4*stride + i]= av_clip_uint8(lrintf(os34 + od34));
}
}
}
-void ff_faanidct(DCTELEM block[64])
-{
+void ff_faanidct(DCTELEM block[64]){
FLOAT temp[64];
int i;
emms_c();
- for(i = 0; i < 64; i++)
+ for(i=0; i<64; i++)
temp[i] = block[i] * prescale[i];
p8idct(block, temp, NULL, 0, 1, 8, 0);
p8idct(block, temp, NULL, 0, 8, 1, 1);
}
-void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64])
-{
+void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64]){
FLOAT temp[64];
int i;
emms_c();
- for(i = 0; i < 64; i++)
+ for(i=0; i<64; i++)
temp[i] = block[i] * prescale[i];
p8idct(block, temp, NULL, 0, 1, 8, 0);
p8idct(NULL , temp, dest, line_size, 8, 1, 2);
}
-void ff_faanidct_put(uint8_t *dest, int line_size, DCTELEM block[64])
-{
+void ff_faanidct_put(uint8_t *dest, int line_size, DCTELEM block[64]){
FLOAT temp[64];
int i;
emms_c();
- for(i = 0; i < 64; i++)
+ for(i=0; i<64; i++)
temp[i] = block[i] * prescale[i];
p8idct(block, temp, NULL, 0, 1, 8, 0);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/fft.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/fft.c
index a9e6d7f59..150a59aeb 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/fft.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/fft.c
@@ -44,8 +44,7 @@ COSTABLE(16384);
COSTABLE(32768);
COSTABLE(65536);
#endif
-COSTABLE_CONST FFTSample * const ff_cos_tabs[] =
-{
+COSTABLE_CONST FFTSample * const ff_cos_tabs[] = {
NULL, NULL, NULL, NULL,
ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
@@ -54,24 +53,24 @@ COSTABLE_CONST FFTSample * const ff_cos_tabs[] =
static int split_radix_permutation(int i, int n, int inverse)
{
int m;
- if(n <= 2) return i & 1;
+ if(n <= 2) return i&1;
m = n >> 1;
- if(!(i & m)) return split_radix_permutation(i, m, inverse) * 2;
+ if(!(i&m)) return split_radix_permutation(i, m, inverse)*2;
m >>= 1;
- if(inverse == !(i & m)) return split_radix_permutation(i, m, inverse) * 4 + 1;
- else return split_radix_permutation(i, m, inverse) * 4 - 1;
+ if(inverse == !(i&m)) return split_radix_permutation(i, m, inverse)*4 + 1;
+ else return split_radix_permutation(i, m, inverse)*4 - 1;
}
av_cold void ff_init_ff_cos_tabs(int index)
{
#if !CONFIG_HARDCODED_TABLES
int i;
- int m = 1 << index;
- double freq = 2 * M_PI / m;
+ int m = 1<<index;
+ double freq = 2*M_PI/m;
FFTSample *tab = ff_cos_tabs[index];
- for(i = 0; i <= m / 4; i++)
- tab[i] = cos(i * freq);
- for(i = 1; i < m / 4; i++)
+ for(i=0; i<=m/4; i++)
+ tab[i] = cos(i*freq);
+ for(i=1; i<m/4; i++)
tab[m/2-i] = tab[i];
#endif
}
@@ -82,17 +81,17 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
float alpha, c1, s1, s2;
int av_unused has_vectors;
- if(nbits < 2 || nbits > 16)
+ if (nbits < 2 || nbits > 16)
goto fail;
s->nbits = nbits;
n = 1 << nbits;
s->tmp_buf = NULL;
s->exptab = av_malloc((n / 2) * sizeof(FFTComplex));
- if(!s->exptab)
+ if (!s->exptab)
goto fail;
s->revtab = av_malloc(n * sizeof(uint16_t));
- if(!s->revtab)
+ if (!s->revtab)
goto fail;
s->inverse = inverse;
@@ -106,23 +105,18 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
s->exptab1 = NULL;
s->split_radix = 1;
- if(s->split_radix)
- {
- for(j = 4; j <= nbits; j++)
- {
+ if (s->split_radix) {
+ for(j=4; j<=nbits; j++) {
ff_init_ff_cos_tabs(j);
}
- for(i = 0; i < n; i++)
+ for(i=0; i<n; i++)
s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i;
s->tmp_buf = av_malloc(n * sizeof(FFTComplex));
- }
- else
- {
+ } else {
int np, nblocks, np2, l;
FFTComplex *q;
- for(i = 0; i < (n / 2); i++)
- {
+ for(i=0; i<(n/2); i++) {
alpha = 2 * M_PI * (float)i / (float)n;
c1 = cos(alpha);
s1 = sin(alpha) * s2;
@@ -134,13 +128,11 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
nblocks = np >> 3;
np2 = np >> 1;
s->exptab1 = av_malloc(np * 2 * sizeof(FFTComplex));
- if(!s->exptab1)
+ if (!s->exptab1)
goto fail;
q = s->exptab1;
- do
- {
- for(l = 0; l < np2; l += 2 * nblocks)
- {
+ do {
+ for(l = 0; l < np2; l += 2 * nblocks) {
*q++ = s->exptab[l];
*q++ = s->exptab[l + nblocks];
@@ -152,24 +144,21 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
q++;
}
nblocks = nblocks >> 1;
- }
- while(nblocks != 0);
+ } while (nblocks != 0);
av_freep(&s->exptab);
/* compute bit reverse table */
- for(i = 0; i < n; i++)
- {
- m = 0;
- for(j = 0; j < nbits; j++)
- {
- m |= ((i >> j) & 1) << (nbits - j - 1);
+ for(i=0;i<n;i++) {
+ m=0;
+ for(j=0;j<nbits;j++) {
+ m |= ((i >> j) & 1) << (nbits-j-1);
}
- s->revtab[i] = m;
+ s->revtab[i]=m;
}
}
return 0;
-fail:
+ fail:
av_freep(&s->revtab);
av_freep(&s->exptab);
av_freep(&s->exptab1);
@@ -184,20 +173,17 @@ void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
const uint16_t *revtab = s->revtab;
np = 1 << s->nbits;
- if(s->tmp_buf)
- {
+ if (s->tmp_buf) {
/* TODO: handle split-radix permute in a more optimal way, probably in-place */
- for(j = 0; j < np; j++) s->tmp_buf[revtab[j]] = z[j];
+ for(j=0;j<np;j++) s->tmp_buf[revtab[j]] = z[j];
memcpy(z, s->tmp_buf, np * sizeof(FFTComplex));
return;
}
/* reverse */
- for(j = 0; j < np; j++)
- {
+ for(j=0;j<np;j++) {
k = revtab[j];
- if(k < j)
- {
+ if (k < j) {
tmp = z[k];
z[k] = z[j];
z[j] = tmp;
@@ -325,7 +311,7 @@ static void fft8(FFTComplex *z)
BF(z[6].re, z[2].re, z[2].re, t7);
BF(z[6].im, z[2].im, z[2].im, t8);
- TRANSFORM(z[1], z[3], z[5], z[7], sqrthalf, sqrthalf);
+ TRANSFORM(z[1],z[3],z[5],z[7],sqrthalf,sqrthalf);
}
#if !CONFIG_SMALL
@@ -334,35 +320,34 @@ static void fft16(FFTComplex *z)
FFTSample t1, t2, t3, t4, t5, t6;
fft8(z);
- fft4(z + 8);
- fft4(z + 12);
+ fft4(z+8);
+ fft4(z+12);
- TRANSFORM_ZERO(z[0], z[4], z[8], z[12]);
- TRANSFORM(z[2], z[6], z[10], z[14], sqrthalf, sqrthalf);
- TRANSFORM(z[1], z[5], z[9], z[13], ff_cos_16[1], ff_cos_16[3]);
- TRANSFORM(z[3], z[7], z[11], z[15], ff_cos_16[3], ff_cos_16[1]);
+ TRANSFORM_ZERO(z[0],z[4],z[8],z[12]);
+ TRANSFORM(z[2],z[6],z[10],z[14],sqrthalf,sqrthalf);
+ TRANSFORM(z[1],z[5],z[9],z[13],ff_cos_16[1],ff_cos_16[3]);
+ TRANSFORM(z[3],z[7],z[11],z[15],ff_cos_16[3],ff_cos_16[1]);
}
#else
-DECL_FFT(16, 8, 4)
+DECL_FFT(16,8,4)
#endif
-DECL_FFT(32, 16, 8)
-DECL_FFT(64, 32, 16)
-DECL_FFT(128, 64, 32)
-DECL_FFT(256, 128, 64)
-DECL_FFT(512, 256, 128)
+DECL_FFT(32,16,8)
+DECL_FFT(64,32,16)
+DECL_FFT(128,64,32)
+DECL_FFT(256,128,64)
+DECL_FFT(512,256,128)
#if !CONFIG_SMALL
#define pass pass_big
#endif
-DECL_FFT(1024, 512, 256)
-DECL_FFT(2048, 1024, 512)
-DECL_FFT(4096, 2048, 1024)
-DECL_FFT(8192, 4096, 2048)
-DECL_FFT(16384, 8192, 4096)
-DECL_FFT(32768, 16384, 8192)
-DECL_FFT(65536, 32768, 16384)
-
-static void (* const fft_dispatch[])(FFTComplex*) =
-{
+DECL_FFT(1024,512,256)
+DECL_FFT(2048,1024,512)
+DECL_FFT(4096,2048,1024)
+DECL_FFT(8192,4096,2048)
+DECL_FFT(16384,8192,4096)
+DECL_FFT(32768,16384,8192)
+DECL_FFT(65536,32768,16384)
+
+static void (* const fft_dispatch[])(FFTComplex*) = {
fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/flvdec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/flvdec.c
index 8eab4af1d..104e48d91 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/flvdec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/flvdec.c
@@ -21,17 +21,13 @@
#include "h263.h"
#include "flv.h"
-void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last)
-{
+void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){
int is11 = get_bits1(gb);
*last = get_bits1(gb);
*run = get_bits(gb, 6);
- if(is11)
- {
+ if(is11){
*level = get_sbits(gb, 11);
- }
- else
- {
+ } else {
*level = get_sbits(gb, 7);
}
}
@@ -41,22 +37,19 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
int format, width, height;
/* picture header */
- if(get_bits_long(&s->gb, 17) != 1)
- {
+ if (get_bits_long(&s->gb, 17) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
format = get_bits(&s->gb, 5);
- if(format != 0 && format != 1)
- {
+ if (format != 0 && format != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture format\n");
return -1;
}
- s->h263_flv = format + 1;
+ s->h263_flv = format+1;
s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
format = get_bits(&s->gb, 3);
- switch(format)
- {
+ switch (format) {
case 0:
width = get_bits(&s->gb, 8);
height = get_bits(&s->gb, 8);
@@ -95,12 +88,12 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
s->height = height;
s->pict_type = FF_I_TYPE + get_bits(&s->gb, 2);
- s->dropable = s->pict_type > FF_P_TYPE;
- if(s->dropable)
+ s->dropable= s->pict_type > FF_P_TYPE;
+ if (s->dropable)
s->pict_type = FF_P_TYPE;
skip_bits1(&s->gb); /* deblocking flag */
- s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
+ s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
s->h263_plus = 0;
@@ -108,26 +101,23 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
s->h263_long_vectors = 0;
/* PEI */
- while(get_bits1(&s->gb) != 0)
- {
+ while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
}
s->f_code = 1;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ 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_pict_type_char(s->pict_type), s->h263_flv - 1, s->qscale, s->picture_number);
+ s->dropable ? 'D' : av_get_pict_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number);
}
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
return 0;
}
-AVCodec flv_decoder =
-{
+AVCodec flv_decoder = {
"flv",
CODEC_TYPE_VIDEO,
CODEC_ID_FLV1,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/get_bits.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/get_bits.h
index 1181384f2..c284ab50e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/get_bits.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/get_bits.h
@@ -47,20 +47,18 @@
#if ARCH_X86
// avoid +32 for shift optimization (gcc should do that ...)
-static inline int32_t NEG_SSR32(int32_t a, int8_t s)
-{
- __asm__("sarl %1, %0\n\t"
- : "+r"(a)
- : "ic"((uint8_t)(-s))
- );
+static inline int32_t NEG_SSR32( int32_t a, int8_t s){
+ __asm__ ("sarl %1, %0\n\t"
+ : "+r" (a)
+ : "ic" ((uint8_t)(-s))
+ );
return a;
}
-static inline uint32_t NEG_USR32(uint32_t a, int8_t s)
-{
- __asm__("shrl %1, %0\n\t"
- : "+r"(a)
- : "ic"((uint8_t)(-s))
- );
+static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
+ __asm__ ("shrl %1, %0\n\t"
+ : "+r" (a)
+ : "ic" ((uint8_t)(-s))
+ );
return a;
}
#else
@@ -70,8 +68,7 @@ static inline uint32_t NEG_USR32(uint32_t a, int8_t s)
/* bit input */
/* buffer, buffer_end and size_in_bits must be present and used by every reader */
-typedef struct GetBitContext
-{
+typedef struct GetBitContext {
const uint8_t *buffer, *buffer_end;
#ifdef ALT_BITSTREAM_READER
int index;
@@ -90,15 +87,13 @@ typedef struct GetBitContext
#define VLC_TYPE int16_t
-typedef struct VLC
-{
+typedef struct VLC {
int bits;
- VLC_TYPE(*table)[2]; ///< code, bits
+ VLC_TYPE (*table)[2]; ///< code, bits
int table_size, table_allocated;
} VLC;
-typedef struct RL_VLC_ELEM
-{
+typedef struct RL_VLC_ELEM {
int16_t level;
int8_t len;
uint8_t run;
@@ -155,20 +150,20 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define OPEN_READER(name, gb)\
unsigned int name##_index= (gb)->index;\
int name##_cache= 0;\
-
+
# define CLOSE_READER(name, gb)\
(gb)->index= name##_index;\
-
+
# ifdef ALT_BITSTREAM_READER_LE
# define UPDATE_CACHE(name, gb)\
name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\
-
+
# define SKIP_CACHE(name, gb, num)\
name##_cache >>= (num);
# else
# define UPDATE_CACHE(name, gb)\
name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
-
+
# define SKIP_CACHE(name, gb, num)\
name##_cache <<= (num);
# endif
@@ -176,13 +171,13 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
// FIXME name?
# define SKIP_COUNTER(name, gb, num)\
name##_index += (num);\
-
+
# define SKIP_BITS(name, gb, num)\
{\
SKIP_CACHE(name, gb, num)\
SKIP_COUNTER(name, gb, num)\
}\
-
+
# define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
# define LAST_SKIP_CACHE(name, gb, num) ;
@@ -203,13 +198,11 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define GET_CACHE(name, gb)\
((uint32_t)name##_cache)
-static inline int get_bits_count(const GetBitContext *s)
-{
+static inline int get_bits_count(const GetBitContext *s){
return s->index;
}
-static inline void skip_bits_long(GetBitContext *s, int n)
-{
+static inline void skip_bits_long(GetBitContext *s, int n){
s->index += n;
}
@@ -222,31 +215,31 @@ static inline void skip_bits_long(GetBitContext *s, int n)
int name##_bit_count=(gb)->bit_count;\
int name##_cache= (gb)->cache;\
uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\
-
+
# define CLOSE_READER(name, gb)\
(gb)->bit_count= name##_bit_count;\
(gb)->cache= name##_cache;\
(gb)->buffer_ptr= name##_buffer_ptr;\
-
+
# define UPDATE_CACHE(name, gb)\
if(name##_bit_count >= 0){\
name##_cache+= AV_RB16(name##_buffer_ptr) << name##_bit_count; \
name##_buffer_ptr+=2;\
name##_bit_count-= 16;\
}\
-
+
# define SKIP_CACHE(name, gb, num)\
name##_cache <<= (num);\
-
+
# define SKIP_COUNTER(name, gb, num)\
name##_bit_count += (num);\
-
+
# define SKIP_BITS(name, gb, num)\
{\
SKIP_CACHE(name, gb, num)\
SKIP_COUNTER(name, gb, num)\
}\
-
+
# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
# define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
@@ -259,18 +252,16 @@ static inline void skip_bits_long(GetBitContext *s, int n)
# define GET_CACHE(name, gb)\
((uint32_t)name##_cache)
-static inline int get_bits_count(const GetBitContext *s)
-{
- return (s->buffer_ptr - s->buffer) * 8 - 16 + s->bit_count;
+static inline int get_bits_count(const GetBitContext *s){
+ return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count;
}
-static inline void skip_bits_long(GetBitContext *s, int n)
-{
+static inline void skip_bits_long(GetBitContext *s, int n){
OPEN_READER(re, s)
re_bit_count += n;
- re_buffer_ptr += 2 * (re_bit_count >> 4);
+ re_buffer_ptr += 2*(re_bit_count>>4);
re_bit_count &= 15;
- re_cache = ((re_buffer_ptr[-2] << 8) + re_buffer_ptr[-1]) << (16 + re_bit_count);
+ re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count);
UPDATE_CACHE(re, s)
CLOSE_READER(re, s)
}
@@ -284,13 +275,13 @@ static inline void skip_bits_long(GetBitContext *s, int n)
uint32_t name##_cache0= (gb)->cache0;\
uint32_t name##_cache1= (gb)->cache1;\
uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\
-
+
# define CLOSE_READER(name, gb)\
(gb)->bit_count= name##_bit_count;\
(gb)->cache0= name##_cache0;\
(gb)->cache1= name##_cache1;\
(gb)->buffer_ptr= name##_buffer_ptr;\
-
+
# define UPDATE_CACHE(name, gb)\
if(name##_bit_count > 0){\
const uint32_t next= be2me_32( *name##_buffer_ptr );\
@@ -299,7 +290,7 @@ static inline void skip_bits_long(GetBitContext *s, int n)
name##_buffer_ptr++;\
name##_bit_count-= 32;\
}\
-
+
#if ARCH_X86
# define SKIP_CACHE(name, gb, num)\
__asm__(\
@@ -317,13 +308,13 @@ static inline void skip_bits_long(GetBitContext *s, int n)
# define SKIP_COUNTER(name, gb, num)\
name##_bit_count += (num);\
-
+
# define SKIP_BITS(name, gb, num)\
{\
SKIP_CACHE(name, gb, num)\
SKIP_COUNTER(name, gb, num)\
}\
-
+
# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
# define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
@@ -336,18 +327,16 @@ static inline void skip_bits_long(GetBitContext *s, int n)
# define GET_CACHE(name, gb)\
(name##_cache0)
-static inline int get_bits_count(const GetBitContext *s)
-{
- return ((uint8_t*)s->buffer_ptr - s->buffer) * 8 - 32 + s->bit_count;
+static inline int get_bits_count(const GetBitContext *s){
+ return ((uint8_t*)s->buffer_ptr - s->buffer)*8 - 32 + s->bit_count;
}
-static inline void skip_bits_long(GetBitContext *s, int n)
-{
+static inline void skip_bits_long(GetBitContext *s, int n){
OPEN_READER(re, s)
re_bit_count += n;
- re_buffer_ptr += re_bit_count >> 5;
+ re_buffer_ptr += re_bit_count>>5;
re_bit_count &= 31;
- re_cache0 = be2me_32(re_buffer_ptr[-1]) << re_bit_count;
+ re_cache0 = be2me_32( re_buffer_ptr[-1] ) << re_bit_count;
re_cache1 = 0;
UPDATE_CACHE(re, s)
CLOSE_READER(re, s)
@@ -361,25 +350,23 @@ static inline void skip_bits_long(GetBitContext *s, int n)
* @param n length in bits
* @author BERO
*/
-static inline int get_xbits(GetBitContext *s, int n)
-{
+static inline int get_xbits(GetBitContext *s, int n){
register int sign;
register int32_t cache;
OPEN_READER(re, s)
UPDATE_CACHE(re, s)
- cache = GET_CACHE(re, s);
- sign = (~cache) >> 31;
+ cache = GET_CACHE(re,s);
+ sign=(~cache)>>31;
LAST_SKIP_BITS(re, s, n)
CLOSE_READER(re, s)
return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
}
-static inline int get_sbits(GetBitContext *s, int n)
-{
+static inline int get_sbits(GetBitContext *s, int n){
register int tmp;
OPEN_READER(re, s)
UPDATE_CACHE(re, s)
- tmp = SHOW_SBITS(re, s, n);
+ tmp= SHOW_SBITS(re, s, n);
LAST_SKIP_BITS(re, s, n)
CLOSE_READER(re, s)
return tmp;
@@ -389,12 +376,11 @@ static inline int get_sbits(GetBitContext *s, int n)
* reads 1-17 bits.
* Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
*/
-static inline unsigned int get_bits(GetBitContext *s, int n)
-{
+static inline unsigned int get_bits(GetBitContext *s, int n){
register int tmp;
OPEN_READER(re, s)
UPDATE_CACHE(re, s)
- tmp = SHOW_UBITS(re, s, n);
+ tmp= SHOW_UBITS(re, s, n);
LAST_SKIP_BITS(re, s, n)
CLOSE_READER(re, s)
return tmp;
@@ -404,39 +390,36 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
* shows 1-17 bits.
* Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
*/
-static inline unsigned int show_bits(GetBitContext *s, int n)
-{
+static inline unsigned int show_bits(GetBitContext *s, int n){
register int tmp;
OPEN_READER(re, s)
UPDATE_CACHE(re, s)
- tmp = SHOW_UBITS(re, s, n);
+ tmp= SHOW_UBITS(re, s, n);
// CLOSE_READER(re, s)
return tmp;
}
-static inline void skip_bits(GetBitContext *s, int n)
-{
-//Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
+static inline void skip_bits(GetBitContext *s, int n){
+ //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
OPEN_READER(re, s)
UPDATE_CACHE(re, s)
LAST_SKIP_BITS(re, s, n)
CLOSE_READER(re, s)
}
-static inline unsigned int get_bits1(GetBitContext *s)
-{
+static inline unsigned int get_bits1(GetBitContext *s){
#ifdef ALT_BITSTREAM_READER
- unsigned int index = s->index;
- uint8_t result = s->buffer[ index>>3 ];
+ unsigned int index= s->index;
+ uint8_t result= s->buffer[ index>>3 ];
#ifdef ALT_BITSTREAM_READER_LE
- result >>= (index & 0x07);
- result &= 1;
+ result>>= (index&0x07);
+ result&= 1;
#else
- result <<= (index & 0x07);
- result >>= 8 - 1;
+ result<<= (index&0x07);
+ result>>= 8 - 1;
#endif
index++;
- s->index = index;
+ s->index= index;
return result;
#else
@@ -444,30 +427,26 @@ static inline unsigned int get_bits1(GetBitContext *s)
#endif
}
-static inline unsigned int show_bits1(GetBitContext *s)
-{
+static inline unsigned int show_bits1(GetBitContext *s){
return show_bits(s, 1);
}
-static inline void skip_bits1(GetBitContext *s)
-{
+static inline void skip_bits1(GetBitContext *s){
skip_bits(s, 1);
}
/**
* reads 0-32 bits.
*/
-static inline unsigned int get_bits_long(GetBitContext *s, int n)
-{
- if(n <= 17) return get_bits(s, n);
- else
- {
+static inline unsigned int get_bits_long(GetBitContext *s, int n){
+ if(n<=17) return get_bits(s, n);
+ else{
#ifdef ALT_BITSTREAM_READER_LE
- int ret = get_bits(s, 16);
- return ret | (get_bits(s, n - 16) << 16);
+ int ret= get_bits(s, 16);
+ return ret | (get_bits(s, n-16) << 16);
#else
- int ret = get_bits(s, 16) << (n - 16);
- return ret | get_bits(s, n - 16);
+ int ret= get_bits(s, 16) << (n-16);
+ return ret | get_bits(s, n-16);
#endif
}
}
@@ -475,27 +454,24 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
/**
* reads 0-32 bits as a signed integer.
*/
-static inline int get_sbits_long(GetBitContext *s, int n)
-{
+static inline int get_sbits_long(GetBitContext *s, int n) {
return sign_extend(get_bits_long(s, n), n);
}
/**
* shows 0-32 bits.
*/
-static inline unsigned int show_bits_long(GetBitContext *s, int n)
-{
- if(n <= 17) return show_bits(s, n);
- else
- {
- GetBitContext gb = *s;
+static inline unsigned int show_bits_long(GetBitContext *s, int n){
+ if(n<=17) return show_bits(s, n);
+ else{
+ GetBitContext gb= *s;
return get_bits_long(&gb, n);
}
}
static inline int check_marker(GetBitContext *s, const char *msg)
{
- int bit = get_bits1(s);
+ int bit= get_bits1(s);
if(!bit)
av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
@@ -512,34 +488,33 @@ static inline int check_marker(GetBitContext *s, const char *msg)
* responsible for checking for the buffer end yourself (take advantage of the padding)!
*/
static inline void init_get_bits(GetBitContext *s,
- const uint8_t *buffer, int bit_size)
+ const uint8_t *buffer, int bit_size)
{
- int buffer_size = (bit_size + 7) >> 3;
- if(buffer_size < 0 || bit_size < 0)
- {
+ int buffer_size= (bit_size+7)>>3;
+ if(buffer_size < 0 || bit_size < 0) {
buffer_size = bit_size = 0;
buffer = NULL;
}
- s->buffer = buffer;
- s->size_in_bits = bit_size;
- s->buffer_end = buffer + buffer_size;
+ s->buffer= buffer;
+ s->size_in_bits= bit_size;
+ s->buffer_end= buffer + buffer_size;
#ifdef ALT_BITSTREAM_READER
- s->index = 0;
+ s->index=0;
#elif defined LIBMPEG2_BITSTREAM_READER
- s->buffer_ptr = (uint8_t*)((intptr_t)buffer & (~1));
- s->bit_count = 16 + 8 * ((intptr_t)buffer & 1);
+ s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
+ s->bit_count = 16 + 8*((intptr_t)buffer&1);
skip_bits_long(s, 0);
#elif defined A32_BITSTREAM_READER
- s->buffer_ptr = (uint32_t*)((intptr_t)buffer & (~3));
- s->bit_count = 32 + 8 * ((intptr_t)buffer & 3);
+ s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));
+ s->bit_count = 32 + 8*((intptr_t)buffer&3);
skip_bits_long(s, 0);
#endif
}
static inline void align_get_bits(GetBitContext *s)
{
- int n = (-get_bits_count(s)) & 7;
+ int n= (-get_bits_count(s)) & 7;
if(n) skip_bits(s, n);
}
@@ -553,10 +528,10 @@ static inline void align_get_bits(GetBitContext *s)
NULL, 0, 0, flags)
int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
- const void *bits, int bits_wrap, int bits_size,
- const void *codes, int codes_wrap, int codes_size,
- const void *symbols, int symbols_wrap, int symbols_size,
- int flags);
+ const void *bits, int bits_wrap, int bits_size,
+ const void *codes, int codes_wrap, int codes_size,
+ const void *symbols, int symbols_wrap, int symbols_size,
+ int flags);
#define INIT_VLC_LE 2
#define INIT_VLC_USE_NEW_STATIC 4
void free_vlc(VLC *vlc);
@@ -642,8 +617,8 @@ void free_vlc(VLC *vlc);
* read the longest vlc code
* = (max_vlc_length + bits - 1) / bits
*/
-static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2],
- int bits, int max_depth)
+static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
+ int bits, int max_depth)
{
int code;
@@ -659,46 +634,41 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2],
//#define TRACE
#ifdef TRACE
-static inline void print_bin(int bits, int n)
-{
+static inline void print_bin(int bits, int n){
int i;
- for(i = n - 1; i >= 0; i--)
- {
- av_log(NULL, AV_LOG_DEBUG, "%d", (bits >> i) & 1);
+ for(i=n-1; i>=0; i--){
+ av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
}
- for(i = n; i < 24; i++)
+ for(i=n; i<24; i++)
av_log(NULL, AV_LOG_DEBUG, " ");
}
-static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line)
-{
- int r = get_bits(s, n);
+static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
+ int r= get_bits(s, n);
print_bin(r, n);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s) - n, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line);
return r;
}
-static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth, char *file, const char *func, int line)
-{
- int show = show_bits(s, 24);
- int pos = get_bits_count(s);
- int r = get_vlc2(s, table, bits, max_depth);
- int len = get_bits_count(s) - pos;
- int bits2 = show >> (24 - len);
+static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){
+ int show= show_bits(s, 24);
+ int pos= get_bits_count(s);
+ int r= get_vlc2(s, table, bits, max_depth);
+ int len= get_bits_count(s) - pos;
+ int bits2= show>>(24-len);
print_bin(bits2, len);
av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line);
return r;
}
-static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line)
-{
- int show = show_bits(s, n);
- int r = get_xbits(s, n);
+static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
+ int show= show_bits(s, n);
+ int r= get_xbits(s, n);
print_bin(show, n);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s) - n, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line);
return r;
}
@@ -711,26 +681,24 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const cha
#define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__)
#else //TRACE
-#ifdef __GNUC__
-#define tprintf(p, ...) {}
-#else
-#define tprintf(p) {}
-#endif
+ #ifdef __GNUC__
+ #define tprintf(p, ...) {}
+ #else
+ #define tprintf(p) {}
+ #endif
#endif
-static inline int decode012(GetBitContext *gb)
-{
+static inline int decode012(GetBitContext *gb){
int n;
n = get_bits1(gb);
- if(n == 0)
+ if (n == 0)
return 0;
else
return get_bits1(gb) + 1;
}
-static inline int decode210(GetBitContext *gb)
-{
- if(get_bits1(gb))
+static inline int decode210(GetBitContext *gb){
+ if (get_bits1(gb))
return 0;
else
return 2 - get_bits1(gb);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.c
index 956904f3b..a33b94491 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.c
@@ -28,155 +28,146 @@
#include "libavutil/common.h"
-const uint8_t ff_golomb_vlc_len[512] =
-{
- 14, 13, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 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,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 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,
- 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,
- 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,
- 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,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+const uint8_t ff_golomb_vlc_len[512]={
+14,13,12,12,11,11,11,11,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+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,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+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,
+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,
+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,
+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,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
};
-const uint8_t ff_ue_golomb_vlc_code[512] =
-{
- 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14,
- 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,
- 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,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 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 uint8_t ff_ue_golomb_vlc_code[512]={
+31,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
+ 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,
+ 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,
+ 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,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 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,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 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 int8_t ff_se_golomb_vlc_code[512] =
-{
- 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 8, -8, 9, -9, 10, -10, 11, -11, 12, -12, 13, -13, 14, -14, 15, -15,
- 4, 4, 4, 4, -4, -4, -4, -4, 5, 5, 5, 5, -5, -5, -5, -5, 6, 6, 6, 6, -6, -6, -6, -6, 7, 7, 7, 7, -7, -7, -7, -7,
- 2, 2, 2, 2, 2, 2, 2, 2, 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, 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,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -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,
+const int8_t ff_se_golomb_vlc_code[512]={
+ 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 8, -8, 9, -9, 10,-10, 11,-11, 12,-12, 13,-13, 14,-14, 15,-15,
+ 4, 4, 4, 4, -4, -4, -4, -4, 5, 5, 5, 5, -5, -5, -5, -5, 6, 6, 6, 6, -6, -6, -6, -6, 7, 7, 7, 7, -7, -7, -7, -7,
+ 2, 2, 2, 2, 2, 2, 2, 2, 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, 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,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -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,
};
-const uint8_t ff_ue_golomb_len[256] =
-{
- 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 17,
+const uint8_t ff_ue_golomb_len[256]={
+ 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,
+11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,
+13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15,
+15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,
};
-const uint8_t ff_interleaved_golomb_vlc_len[256] =
-{
- 9, 9, 7, 7, 9, 9, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5,
- 9, 9, 7, 7, 9, 9, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5,
- 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,
- 9, 9, 7, 7, 9, 9, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5,
- 9, 9, 7, 7, 9, 9, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5,
- 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,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+const uint8_t ff_interleaved_golomb_vlc_len[256]={
+9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
+9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
+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,
+9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
+9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
+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,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
};
-const uint8_t ff_interleaved_ue_golomb_vlc_code[256] =
-{
- 15, 16, 7, 7, 17, 18, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3,
- 19, 20, 9, 9, 21, 22, 10, 10, 4, 4, 4, 4, 4, 4, 4, 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, 1, 1, 1, 1, 1, 1, 1, 1,
- 23, 24, 11, 11, 25, 26, 12, 12, 5, 5, 5, 5, 5, 5, 5, 5,
- 27, 28, 13, 13, 29, 30, 14, 14, 6, 6, 6, 6, 6, 6, 6, 6,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 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 uint8_t ff_interleaved_ue_golomb_vlc_code[256]={
+ 15,16,7, 7, 17,18,8, 8, 3, 3, 3, 3, 3, 3, 3, 3,
+ 19,20,9, 9, 21,22,10,10,4, 4, 4, 4, 4, 4, 4, 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, 1, 1, 1, 1, 1, 1, 1, 1,
+ 23,24,11,11,25,26,12,12,5, 5, 5, 5, 5, 5, 5, 5,
+ 27,28,13,13,29,30,14,14,6, 6, 6, 6, 6, 6, 6, 6,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 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 int8_t ff_interleaved_se_golomb_vlc_code[256] =
-{
- 8, -8, 4, 4, 9, -9, -4, -4, 2, 2, 2, 2, 2, 2, 2, 2,
- 10, -10, 5, 5, 11, -11, -5, -5, -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,
- 12, -12, 6, 6, 13, -13, -6, -6, 3, 3, 3, 3, 3, 3, 3, 3,
- 14, -14, 7, 7, 15, -15, -7, -7, -3, -3, -3, -3, -3, -3, -3, -3,
- -1, -1, -1, -1, -1, -1, -1, -1, -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,
+const int8_t ff_interleaved_se_golomb_vlc_code[256]={
+ 8, -8, 4, 4, 9, -9, -4, -4, 2, 2, 2, 2, 2, 2, 2, 2,
+ 10,-10, 5, 5, 11,-11, -5, -5, -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,
+ 12,-12, 6, 6, 13,-13, -6, -6, 3, 3, 3, 3, 3, 3, 3, 3,
+ 14,-14, 7, 7, 15,-15, -7, -7, -3, -3, -3, -3, -3, -3, -3, -3,
+ -1, -1, -1, -1, -1, -1, -1, -1, -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,
};
-const uint8_t ff_interleaved_dirac_golomb_vlc_code[256] =
-{
- 0, 1, 0, 0, 2, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 5, 2, 2, 6, 7, 3, 3, 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,
- 8, 9, 4, 4, 10, 11, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2,
- 12, 13, 6, 6, 14, 15, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 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,
-};
+const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]={
+0, 1, 0, 0, 2, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+4, 5, 2, 2, 6, 7, 3, 3, 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,
+8, 9, 4, 4, 10,11,5, 5, 2, 2, 2, 2, 2, 2, 2, 2,
+12,13,6, 6, 14,15,7, 7, 3, 3, 3, 3, 3, 3, 3, 3,
+1, 1, 1, 1, 1, 1, 1, 1, 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,};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.h
index b4cd4fb9a..3021a5600 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/golomb.h
@@ -42,415 +42,371 @@ extern "C" {
#define INVALID_VLC 0x80000000
- extern const uint8_t ff_golomb_vlc_len[512];
- extern const uint8_t ff_ue_golomb_vlc_code[512];
- extern const int8_t ff_se_golomb_vlc_code[512];
- extern const uint8_t ff_ue_golomb_len[256];
-
- extern const uint8_t ff_interleaved_golomb_vlc_len[256];
- extern const uint8_t ff_interleaved_ue_golomb_vlc_code[256];
- extern const int8_t ff_interleaved_se_golomb_vlc_code[256];
- extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256];
-
-
- /**
- * read unsigned exp golomb code.
- */
- static inline int get_ue_golomb(GetBitContext *gb)
- {
- unsigned int buf;
- int log;
-
- OPEN_READER(re, gb);
- /* ffdshow custom code */
-#if defined(__INTEL_COMPILER) || defined(DEBUG)
-#ifdef ALT_BITSTREAM_READER_LE
- re_cache = AV_RL32(((const uint8_t *)(gb)->buffer) + (re_index >> 3)) >> (re_index & 0x07);
-#else
- re_cache = AV_RB32(((const uint8_t *)(gb)->buffer) + (re_index >> 3)) >> (re_index & 0x07);
-#endif
-#else
- // ICL9.1-Release and MSVC8-DEBUG build can't process this macro properly.
- UPDATE_CACHE(re, gb);
-#endif
- buf = GET_CACHE(re, gb);
-
- if(buf >= (1 << 27))
- {
- buf >>= 32 - 9;
- LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
- CLOSE_READER(re, gb);
-
- return ff_ue_golomb_vlc_code[buf];
- }
- else
- {
- log = 2 * av_log2(buf) - 31;
- buf >>= log;
- buf--;
- LAST_SKIP_BITS(re, gb, 32 - log);
- CLOSE_READER(re, gb);
+extern const uint8_t ff_golomb_vlc_len[512];
+extern const uint8_t ff_ue_golomb_vlc_code[512];
+extern const int8_t ff_se_golomb_vlc_code[512];
+extern const uint8_t ff_ue_golomb_len[256];
- return buf;
- }
- }
+extern const uint8_t ff_interleaved_golomb_vlc_len[256];
+extern const uint8_t ff_interleaved_ue_golomb_vlc_code[256];
+extern const int8_t ff_interleaved_se_golomb_vlc_code[256];
+extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256];
- /**
- * read unsigned exp golomb code, constraint to a max of 31.
- * the return value is undefined if the stored value exceeds 31.
- */
- static inline int get_ue_golomb_31(GetBitContext *gb)
- {
- unsigned int buf;
-
- OPEN_READER(re, gb);
- /* ffdshow custom code */
-#if defined(__INTEL_COMPILER) || defined(DEBUG)
-#ifdef ALT_BITSTREAM_READER_LE
- re_cache = AV_RL32(((const uint8_t *)(gb)->buffer) + (re_index >> 3)) >> (re_index & 0x07);
-#else
- re_cache = AV_RB32(((const uint8_t *)(gb)->buffer) + (re_index >> 3)) >> (re_index & 0x07);
-#endif
-#else
- // ICL9.1-Release and MSVC8-DEBUG build can't process this macro properly.
- UPDATE_CACHE(re, gb);
-#endif
- buf = GET_CACHE(re, gb);
+ /**
+ * read unsigned exp golomb code.
+ */
+static inline int get_ue_golomb(GetBitContext *gb){
+ unsigned int buf;
+ int log;
+
+ OPEN_READER(re, gb);
+ /* ffdshow custom code */
+ #if defined(__INTEL_COMPILER) || defined(DEBUG)
+ #ifdef ALT_BITSTREAM_READER_LE
+ re_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(re_index>>3) ) >> (re_index&0x07);
+ #else
+ re_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(re_index>>3) ) >> (re_index&0x07);
+ #endif
+ #else
+ // ICL9.1-Release and MSVC8-DEBUG build can't process this macro properly.
+ UPDATE_CACHE(re, gb);
+ #endif
+ buf=GET_CACHE(re, gb);
+
+ if(buf >= (1<<27)){
buf >>= 32 - 9;
LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
CLOSE_READER(re, gb);
return ff_ue_golomb_vlc_code[buf];
+ }else{
+ log= 2*av_log2(buf) - 31;
+ buf>>= log;
+ buf--;
+ LAST_SKIP_BITS(re, gb, 32 - log);
+ CLOSE_READER(re, gb);
+
+ return buf;
}
+}
- static inline int svq3_get_ue_golomb(GetBitContext *gb)
- {
- uint32_t buf;
+ /**
+ * read unsigned exp golomb code, constraint to a max of 31.
+ * the return value is undefined if the stored value exceeds 31.
+ */
+static inline int get_ue_golomb_31(GetBitContext *gb){
+ unsigned int buf;
+
+ OPEN_READER(re, gb);
+ /* ffdshow custom code */
+ #if defined(__INTEL_COMPILER) || defined(DEBUG)
+ #ifdef ALT_BITSTREAM_READER_LE
+ re_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(re_index>>3) ) >> (re_index&0x07);
+ #else
+ re_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(re_index>>3) ) >> (re_index&0x07);
+ #endif
+ #else
+ // ICL9.1-Release and MSVC8-DEBUG build can't process this macro properly.
+ UPDATE_CACHE(re, gb);
+ #endif
+ buf=GET_CACHE(re, gb);
+
+ buf >>= 32 - 9;
+ LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
+ CLOSE_READER(re, gb);
+
+ return ff_ue_golomb_vlc_code[buf];
+}
- OPEN_READER(re, gb);
- UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+static inline int svq3_get_ue_golomb(GetBitContext *gb){
+ uint32_t buf;
+
+ OPEN_READER(re, gb);
+ UPDATE_CACHE(re, gb);
+ buf=GET_CACHE(re, gb);
- if(buf & 0xAA800000)
- {
+ if(buf&0xAA800000){
+ buf >>= 32 - 8;
+ LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
+ CLOSE_READER(re, gb);
+
+ return ff_interleaved_ue_golomb_vlc_code[buf];
+ }else{
+ int ret = 1;
+
+ while (1) {
buf >>= 32 - 8;
- LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
- CLOSE_READER(re, gb);
+ LAST_SKIP_BITS(re, gb, FFMIN(ff_interleaved_golomb_vlc_len[buf], 8));
- return ff_interleaved_ue_golomb_vlc_code[buf];
- }
- else
- {
- int ret = 1;
-
- while(1)
- {
- buf >>= 32 - 8;
- LAST_SKIP_BITS(re, gb, FFMIN(ff_interleaved_golomb_vlc_len[buf], 8));
-
- if(ff_interleaved_golomb_vlc_len[buf] != 9)
- {
- ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
- ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
- break;
- }
- ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
- UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+ if (ff_interleaved_golomb_vlc_len[buf] != 9){
+ ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
+ ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
+ break;
}
-
- CLOSE_READER(re, gb);
- return ret - 1;
+ ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
+ UPDATE_CACHE(re, gb);
+ buf = GET_CACHE(re, gb);
}
+
+ CLOSE_READER(re, gb);
+ return ret - 1;
}
+}
- /**
- * read unsigned truncated exp golomb code.
- */
- static inline int get_te0_golomb(GetBitContext *gb, int range)
- {
- assert(range >= 1);
+/**
+ * read unsigned truncated exp golomb code.
+ */
+static inline int get_te0_golomb(GetBitContext *gb, int range){
+ assert(range >= 1);
- if(range == 1) return 0;
- else if(range == 2) return get_bits1(gb) ^ 1;
- else return get_ue_golomb(gb);
- }
+ if(range==1) return 0;
+ else if(range==2) return get_bits1(gb)^1;
+ else return get_ue_golomb(gb);
+}
- /**
- * read unsigned truncated exp golomb code.
- */
- static inline int get_te_golomb(GetBitContext *gb, int range)
- {
- assert(range >= 1);
+/**
+ * read unsigned truncated exp golomb code.
+ */
+static inline int get_te_golomb(GetBitContext *gb, int range){
+ assert(range >= 1);
- if(range == 2) return get_bits1(gb) ^ 1;
- else return get_ue_golomb(gb);
- }
+ if(range==2) return get_bits1(gb)^1;
+ else return get_ue_golomb(gb);
+}
- /**
- * read signed exp golomb code.
- */
- static inline int get_se_golomb(GetBitContext *gb)
- {
- unsigned int buf;
- int log;
+/**
+ * read signed exp golomb code.
+ */
+static inline int get_se_golomb(GetBitContext *gb){
+ unsigned int buf;
+ int log;
- OPEN_READER(re, gb);
- UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+ OPEN_READER(re, gb);
+ UPDATE_CACHE(re, gb);
+ buf=GET_CACHE(re, gb);
- if(buf >= (1 << 27))
- {
- buf >>= 32 - 9;
- LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
- CLOSE_READER(re, gb);
+ if(buf >= (1<<27)){
+ buf >>= 32 - 9;
+ LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
+ CLOSE_READER(re, gb);
- return ff_se_golomb_vlc_code[buf];
- }
- else
- {
- log = 2 * av_log2(buf) - 31;
- buf >>= log;
+ return ff_se_golomb_vlc_code[buf];
+ }else{
+ log= 2*av_log2(buf) - 31;
+ buf>>= log;
- LAST_SKIP_BITS(re, gb, 32 - log);
- CLOSE_READER(re, gb);
+ LAST_SKIP_BITS(re, gb, 32 - log);
+ CLOSE_READER(re, gb);
- if(buf & 1) buf = -(buf >> 1);
- else buf = (buf >> 1);
+ if(buf&1) buf= -(buf>>1);
+ else buf= (buf>>1);
- return buf;
- }
+ return buf;
}
+}
- static inline int svq3_get_se_golomb(GetBitContext *gb)
- {
- unsigned int buf;
- int log;
+static inline int svq3_get_se_golomb(GetBitContext *gb){
+ unsigned int buf;
+ int log;
- OPEN_READER(re, gb);
- UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+ OPEN_READER(re, gb);
+ UPDATE_CACHE(re, gb);
+ buf=GET_CACHE(re, gb);
- if(buf & 0xAA800000)
- {
- buf >>= 32 - 8;
- LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
- CLOSE_READER(re, gb);
+ if(buf&0xAA800000){
+ buf >>= 32 - 8;
+ LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
+ CLOSE_READER(re, gb);
- return ff_interleaved_se_golomb_vlc_code[buf];
- }
- else
- {
- LAST_SKIP_BITS(re, gb, 8);
- UPDATE_CACHE(re, gb);
- buf |= 1 | (GET_CACHE(re, gb) >> 8);
+ return ff_interleaved_se_golomb_vlc_code[buf];
+ }else{
+ LAST_SKIP_BITS(re, gb, 8);
+ UPDATE_CACHE(re, gb);
+ buf |= 1 | (GET_CACHE(re, gb) >> 8);
- if((buf & 0xAAAAAAAA) == 0)
- return INVALID_VLC;
+ if((buf & 0xAAAAAAAA) == 0)
+ return INVALID_VLC;
- for(log = 31; (buf & 0x80000000) == 0; log--)
- {
- buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
- }
+ for(log=31; (buf & 0x80000000) == 0; log--){
+ buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
+ }
- LAST_SKIP_BITS(re, gb, 63 - 2 * log - 8);
- CLOSE_READER(re, gb);
+ LAST_SKIP_BITS(re, gb, 63 - 2*log - 8);
+ CLOSE_READER(re, gb);
- return (signed)(((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
- }
+ return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
}
+}
- /**
- * read unsigned golomb rice code (ffv1).
- */
- static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len)
- {
- unsigned int buf;
- int log;
+/**
+ * read unsigned golomb rice code (ffv1).
+ */
+static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len){
+ unsigned int buf;
+ int log;
- OPEN_READER(re, gb);
- UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+ OPEN_READER(re, gb);
+ UPDATE_CACHE(re, gb);
+ buf=GET_CACHE(re, gb);
- log = av_log2(buf);
+ log= av_log2(buf);
- if(log > 31 - limit)
- {
- buf >>= log - k;
- buf += (30 - log) << k;
- LAST_SKIP_BITS(re, gb, 32 + k - log);
- CLOSE_READER(re, gb);
+ if(log > 31-limit){
+ buf >>= log - k;
+ buf += (30-log)<<k;
+ LAST_SKIP_BITS(re, gb, 32 + k - log);
+ CLOSE_READER(re, gb);
- return buf;
- }
- else
- {
- LAST_SKIP_BITS(re, gb, limit);
- UPDATE_CACHE(re, gb);
+ return buf;
+ }else{
+ LAST_SKIP_BITS(re, gb, limit);
+ UPDATE_CACHE(re, gb);
- buf = SHOW_UBITS(re, gb, esc_len);
+ buf = SHOW_UBITS(re, gb, esc_len);
- LAST_SKIP_BITS(re, gb, esc_len);
- CLOSE_READER(re, gb);
+ LAST_SKIP_BITS(re, gb, esc_len);
+ CLOSE_READER(re, gb);
- return buf + limit - 1;
- }
+ return buf + limit - 1;
}
+}
- /**
- * read unsigned golomb rice code (jpegls).
- */
- static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
- {
- unsigned int buf;
- int log;
+/**
+ * read unsigned golomb rice code (jpegls).
+ */
+static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len){
+ unsigned int buf;
+ int log;
- OPEN_READER(re, gb);
- UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+ OPEN_READER(re, gb);
+ UPDATE_CACHE(re, gb);
+ buf=GET_CACHE(re, gb);
- log = av_log2(buf);
+ log= av_log2(buf);
- if(log - k >= 32 - MIN_CACHE_BITS + (MIN_CACHE_BITS == 32) && 32 - log < limit)
- {
- buf >>= log - k;
- buf += (30 - log) << k;
- LAST_SKIP_BITS(re, gb, 32 + k - log);
- CLOSE_READER(re, gb);
+ if(log - k >= 32-MIN_CACHE_BITS+(MIN_CACHE_BITS==32) && 32-log < limit){
+ buf >>= log - k;
+ buf += (30-log)<<k;
+ LAST_SKIP_BITS(re, gb, 32 + k - log);
+ CLOSE_READER(re, gb);
- return buf;
+ return buf;
+ }else{
+ int i;
+ for(i=0; SHOW_UBITS(re, gb, 1) == 0; i++){
+ LAST_SKIP_BITS(re, gb, 1);
+ UPDATE_CACHE(re, gb);
}
- else
- {
- int i;
- for(i = 0; SHOW_UBITS(re, gb, 1) == 0; i++)
- {
- LAST_SKIP_BITS(re, gb, 1);
- UPDATE_CACHE(re, gb);
- }
- SKIP_BITS(re, gb, 1);
-
- if(i < limit - 1)
- {
- if(k)
- {
- buf = SHOW_UBITS(re, gb, k);
- LAST_SKIP_BITS(re, gb, k);
- }
- else
- {
- buf = 0;
- }
-
- CLOSE_READER(re, gb);
- return buf + (i << k);
+ SKIP_BITS(re, gb, 1);
+
+ if(i < limit - 1){
+ if(k){
+ buf = SHOW_UBITS(re, gb, k);
+ LAST_SKIP_BITS(re, gb, k);
+ }else{
+ buf=0;
}
- else if(i == limit - 1)
- {
- buf = SHOW_UBITS(re, gb, esc_len);
- LAST_SKIP_BITS(re, gb, esc_len);
- CLOSE_READER(re, gb);
- return buf + 1;
- }
- else
- return -1;
- }
+ CLOSE_READER(re, gb);
+ return buf + (i<<k);
+ }else if(i == limit - 1){
+ buf = SHOW_UBITS(re, gb, esc_len);
+ LAST_SKIP_BITS(re, gb, esc_len);
+ CLOSE_READER(re, gb);
+
+ return buf + 1;
+ }else
+ return -1;
}
+}
- /**
- * read signed golomb rice code (ffv1).
- */
- static inline int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len)
- {
- int v = get_ur_golomb(gb, k, limit, esc_len);
+/**
+ * read signed golomb rice code (ffv1).
+ */
+static inline int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len){
+ int v= get_ur_golomb(gb, k, limit, esc_len);
- v++;
- if(v & 1) return v >> 1;
- else return -(v >> 1);
+ v++;
+ if (v&1) return v>>1;
+ else return -(v>>1);
// return (v>>1) ^ -(v&1);
- }
+}
- /**
- * read signed golomb rice code (flac).
- */
- static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len)
- {
- int v = get_ur_golomb_jpegls(gb, k, limit, esc_len);
- return (v >> 1) ^ -(v & 1);
- }
+/**
+ * read signed golomb rice code (flac).
+ */
+static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len){
+ int v= get_ur_golomb_jpegls(gb, k, limit, esc_len);
+ return (v>>1) ^ -(v&1);
+}
- /**
- * read unsigned golomb rice code (shorten).
- */
- static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k)
- {
+/**
+ * read unsigned golomb rice code (shorten).
+ */
+static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){
return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
- }
+}
- /**
- * read signed golomb rice code (shorten).
- */
- static inline int get_sr_golomb_shorten(GetBitContext* gb, int k)
- {
- int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
- if(uvar & 1)
- return ~(uvar >> 1);
- else
- return uvar >> 1;
- }
+/**
+ * read signed golomb rice code (shorten).
+ */
+static inline int get_sr_golomb_shorten(GetBitContext* gb, int k)
+{
+ int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
+ if (uvar & 1)
+ return ~(uvar >> 1);
+ else
+ return uvar >> 1;
+}
#ifdef TRACE
- static inline int get_ue(GetBitContext *s, 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);
- int len = get_bits_count(s) - pos;
- int bits = show >> (24 - len);
+static inline int get_ue(GetBitContext *s, 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);
+ int len= get_bits_count(s) - pos;
+ int bits= show>>(24-len);
- print_bin(bits, len);
+ print_bin(bits, len);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
- return i;
- }
+ return i;
+}
- static inline int get_se(GetBitContext *s, 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);
- int len = get_bits_count(s) - pos;
- int bits = show >> (24 - len);
+static inline int get_se(GetBitContext *s, 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);
+ int len= get_bits_count(s) - pos;
+ int bits= show>>(24-len);
- print_bin(bits, len);
+ print_bin(bits, len);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
- return i;
- }
+ return i;
+}
- static inline int get_te(GetBitContext *s, int r, char *file, const char *func, int line)
- {
- int show = show_bits(s, 24);
- int pos = get_bits_count(s);
- int i = get_te0_golomb(s, r);
- int len = get_bits_count(s) - pos;
- int bits = show >> (24 - len);
+static inline int get_te(GetBitContext *s, int r, char *file, const char *func, int line){
+ int show= show_bits(s, 24);
+ int pos= get_bits_count(s);
+ int i= get_te0_golomb(s, r);
+ int len= get_bits_count(s) - pos;
+ int bits= show>>(24-len);
- print_bin(bits, len);
+ print_bin(bits, len);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
- return i;
- }
+ return i;
+}
#define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
@@ -459,142 +415,125 @@ extern "C" {
#endif
- /**
- * write unsigned exp golomb code.
- */
- static inline void set_ue_golomb(PutBitContext *pb, int i)
- {
- int e;
+/**
+ * write unsigned exp golomb code.
+ */
+static inline void set_ue_golomb(PutBitContext *pb, int i){
+ int e;
- assert(i >= 0);
+ assert(i>=0);
#if 0
- if(i = 0)
- {
- put_bits(pb, 1, 1);
- return;
- }
+ if(i=0){
+ put_bits(pb, 1, 1);
+ return;
+ }
#endif
- if(i < 256)
- put_bits(pb, ff_ue_golomb_len[i], i + 1);
- else
- {
- e = av_log2(i + 1);
+ if(i<256)
+ put_bits(pb, ff_ue_golomb_len[i], i+1);
+ else{
+ e= av_log2(i+1);
- put_bits(pb, 2 * e + 1, i + 1);
- }
+ put_bits(pb, 2*e+1, i+1);
}
+}
- /**
- * write truncated unsigned exp golomb code.
- */
- static inline void set_te_golomb(PutBitContext *pb, int i, int range)
- {
- assert(range >= 1);
- assert(i <= range);
+/**
+ * write truncated unsigned exp golomb code.
+ */
+static inline void set_te_golomb(PutBitContext *pb, int i, int range){
+ assert(range >= 1);
+ assert(i<=range);
- if(range == 2) put_bits(pb, 1, i ^ 1);
- else set_ue_golomb(pb, i);
- }
+ if(range==2) put_bits(pb, 1, i^1);
+ else set_ue_golomb(pb, i);
+}
- /**
- * write signed exp golomb code. 16 bits at most.
- */
- static inline void set_se_golomb(PutBitContext *pb, int i)
- {
+/**
+ * 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;
+ if(i<=0) i= -2*i;
+ else i= 2*i-1;
#elif 1
- i = 2 * i - 1;
- if(i < 0) i ^= -1; //FIXME check if gcc does the right thing
+ i= 2*i-1;
+ if(i<0) i^= -1; //FIXME check if gcc does the right thing
#else
- i = 2 * i - 1;
- i ^= (i >> 31);
+ i= 2*i-1;
+ i^= (i>>31);
#endif
- set_ue_golomb(pb, i);
- }
+ set_ue_golomb(pb, i);
+}
- /**
- * write unsigned golomb rice code (ffv1).
- */
- static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
- {
- int e;
+/**
+ * write unsigned golomb rice code (ffv1).
+ */
+static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){
+ int e;
- assert(i >= 0);
+ assert(i>=0);
- e = i >> k;
- if(e < limit)
- {
- put_bits(pb, e + k + 1, (1 << k) + (i&((1 << k) - 1)));
- }
- else
- {
- put_bits(pb, limit + esc_len, i - limit + 1);
- }
+ e= i>>k;
+ if(e<limit){
+ put_bits(pb, e + k + 1, (1<<k) + (i&((1<<k)-1)));
+ }else{
+ put_bits(pb, limit + esc_len, i - limit + 1);
}
+}
- /**
- * write unsigned golomb rice code (jpegls).
- */
- static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len)
- {
- int e;
-
- assert(i >= 0);
-
- e = (i >> k) + 1;
- if(e < limit)
- {
- while(e > 31)
- {
- put_bits(pb, 31, 0);
- e -= 31;
- }
- put_bits(pb, e, 1);
- if(k)
- put_sbits(pb, k, i);
+/**
+ * write unsigned golomb rice code (jpegls).
+ */
+static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len){
+ int e;
+
+ assert(i>=0);
+
+ e= (i>>k) + 1;
+ if(e<limit){
+ while(e > 31) {
+ put_bits(pb, 31, 0);
+ e -= 31;
}
- else
- {
- while(limit > 31)
- {
- put_bits(pb, 31, 0);
- limit -= 31;
- }
- put_bits(pb, limit , 1);
- put_bits(pb, esc_len, i - 1);
+ put_bits(pb, e, 1);
+ if(k)
+ put_sbits(pb, k, i);
+ }else{
+ while(limit > 31) {
+ put_bits(pb, 31, 0);
+ limit -= 31;
}
+ put_bits(pb, limit , 1);
+ put_bits(pb, esc_len, i - 1);
}
+}
- /**
- * write signed golomb rice code (ffv1).
- */
- static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len)
- {
- int v;
+/**
+ * write signed golomb rice code (ffv1).
+ */
+static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){
+ int v;
- v = -2 * i - 1;
- v ^= (v >> 31);
+ v = -2*i-1;
+ v ^= (v>>31);
- set_ur_golomb(pb, v, k, limit, esc_len);
- }
+ set_ur_golomb(pb, v, k, limit, esc_len);
+}
- /**
- * write signed golomb rice code (flac).
- */
- static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len)
- {
- int v;
+/**
+ * write signed golomb rice code (flac).
+ */
+static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len){
+ int v;
- v = -2 * i - 1;
- v ^= (v >> 31);
+ v = -2*i-1;
+ v ^= (v>>31);
- set_ur_golomb_jpegls(pb, v, k, limit, esc_len);
- }
+ set_ur_golomb_jpegls(pb, v, k, limit, esc_len);
+}
#ifdef __cplusplus
}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.c
index 7f40ede2f..00ebf8f49 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.c
@@ -33,16 +33,15 @@
uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3];
-void ff_h261_loop_filter(MpegEncContext *s)
-{
- H261Context * h = (H261Context*)s;
+void ff_h261_loop_filter(MpegEncContext *s){
+ H261Context * h= (H261Context*)s;
const int linesize = s->linesize;
- const int uvlinesize = s->uvlinesize;
+ const int uvlinesize= s->uvlinesize;
uint8_t *dest_y = s->dest[0];
- uint8_t *dest_cb = s->dest[1];
- uint8_t *dest_cr = s->dest[2];
+ uint8_t *dest_cb= s->dest[1];
+ uint8_t *dest_cr= s->dest[2];
- if(!(IS_FIL(h->mtype)))
+ if(!(IS_FIL (h->mtype)))
return;
s->dsp.h261_loop_filter(dest_y , linesize);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.h
index cc438110a..b5eb539e7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261.h
@@ -33,8 +33,7 @@
/**
* H261Context
*/
-typedef struct H261Context
-{
+typedef struct H261Context{
MpegEncContext s;
int current_mba;
@@ -45,7 +44,7 @@ typedef struct H261Context
int current_mv_y;
int gob_number;
int gob_start_code_skipped; // 1 if gob start code is already read before gob header is read
-} H261Context;
+}H261Context;
#define MB_TYPE_H261_FIL 0x800000
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261_parser.c
index 5153bf802..8353d7a9f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261_parser.c
@@ -28,45 +28,37 @@
#include "parser.h"
-static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const uint8_t *buf, int buf_size)
-{
+static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const uint8_t *buf, int buf_size){
int vop_found, i, j;
uint32_t state;
- vop_found = pc->frame_start_found;
- state = pc->state;
+ vop_found= pc->frame_start_found;
+ state= pc->state;
- for(i = 0; i < buf_size && !vop_found; i++)
- {
- state = (state << 8) | buf[i];
- for(j = 0; j < 8; j++)
- {
- if(((state >> j) & 0xFFFFF0) == 0x000100)
- {
- vop_found = 1;
+ for(i=0; i<buf_size && !vop_found; i++){
+ state= (state<<8) | buf[i];
+ for(j=0; j<8; j++){
+ if(((state>>j)&0xFFFFF0) == 0x000100){
+ vop_found=1;
break;
}
}
}
- if(vop_found)
- {
- for(; i < buf_size; i++)
- {
- state = (state << 8) | buf[i];
- for(j = 0; j < 8; j++)
- {
- if(((state >> j) & 0xFFFFF0) == 0x000100)
- {
- pc->frame_start_found = 0;
- pc->state = (state >> (3 * 8)) + 0xFF00;
- return i - 2;
+ if(vop_found){
+ for(; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ for(j=0; j<8; j++){
+ if(((state>>j)&0xFFFFF0) == 0x000100){
+ pc->frame_start_found=0;
+ pc->state= (state>>(3*8))+0xFF00;
+ return i-2;
}
}
}
}
- pc->frame_start_found = vop_found;
- pc->state = state;
+ pc->frame_start_found= vop_found;
+ pc->state= state;
return END_NOT_FOUND;
}
@@ -78,9 +70,8 @@ static int h261_parse(AVCodecParserContext *s,
ParseContext *pc = s->priv_data;
int next;
- next = h261_find_frame_end(pc, avctx, buf, buf_size);
- if(ff_combine_frame(pc, next, &buf, &buf_size) < 0)
- {
+ next= h261_find_frame_end(pc,avctx, buf, buf_size);
+ if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
@@ -90,8 +81,7 @@ static int h261_parse(AVCodecParserContext *s,
return next;
}
-AVCodecParser h261_parser =
-{
+AVCodecParser h261_parser = {
{ CODEC_ID_H261 },
sizeof(ParseContext),
NULL,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261data.h
index a83e6c249..54d74b82d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261data.h
@@ -31,12 +31,11 @@
#include "h261.h"
// H.261 VLC table for macroblock addressing
-static const uint8_t h261_mba_code[35] =
-{
- 1, 3, 2, 3,
- 2, 3, 2, 7,
- 6, 11, 10, 9,
- 8, 7, 6, 23,
+static const uint8_t h261_mba_code[35] = {
+ 1, 3, 2, 3,
+ 2, 3, 2, 7,
+ 6, 11, 10, 9,
+ 8, 7, 6, 23,
22, 21, 20, 19,
18, 35, 34, 33,
32, 31, 30, 29,
@@ -46,12 +45,11 @@ static const uint8_t h261_mba_code[35] =
1 //(start code)
};
-static const uint8_t h261_mba_bits[35] =
-{
- 1, 3, 3, 4,
- 4, 5, 5, 7,
- 7, 8, 8, 8,
- 8, 8, 8, 10,
+static const uint8_t h261_mba_bits[35] = {
+ 1, 3, 3, 4,
+ 4, 5, 5, 7,
+ 7, 8, 8, 8,
+ 8, 8, 8, 10,
10, 10, 10, 10,
10, 11, 11, 11,
11, 11, 11, 11,
@@ -62,39 +60,35 @@ static const uint8_t h261_mba_bits[35] =
};
//H.261 VLC table for macroblock type
-static const uint8_t h261_mtype_code[10] =
-{
+static const uint8_t h261_mtype_code[10] = {
1, 1, 1, 1,
1, 1, 1, 1,
1, 1
};
-static const uint8_t h261_mtype_bits[10] =
-{
+static const uint8_t h261_mtype_bits[10] = {
4, 7, 1, 5,
9, 8, 10, 3,
2, 6
};
-static const int h261_mtype_map[10] =
-{
- MB_TYPE_INTRA4x4,
- MB_TYPE_INTRA4x4 | MB_TYPE_QUANT,
- MB_TYPE_CBP,
- MB_TYPE_QUANT | MB_TYPE_CBP,
- MB_TYPE_16x16,
- MB_TYPE_CBP | MB_TYPE_16x16,
- MB_TYPE_QUANT | MB_TYPE_CBP | MB_TYPE_16x16,
- MB_TYPE_16x16 | MB_TYPE_H261_FIL,
- MB_TYPE_CBP | MB_TYPE_16x16 | MB_TYPE_H261_FIL,
- MB_TYPE_QUANT | MB_TYPE_CBP | MB_TYPE_16x16 | MB_TYPE_H261_FIL
+static const int h261_mtype_map[10]= {
+ MB_TYPE_INTRA4x4,
+ MB_TYPE_INTRA4x4 | MB_TYPE_QUANT,
+ MB_TYPE_CBP,
+ MB_TYPE_QUANT | MB_TYPE_CBP,
+ MB_TYPE_16x16,
+ MB_TYPE_CBP | MB_TYPE_16x16,
+ MB_TYPE_QUANT | MB_TYPE_CBP | MB_TYPE_16x16,
+ MB_TYPE_16x16 | MB_TYPE_H261_FIL,
+ MB_TYPE_CBP | MB_TYPE_16x16 | MB_TYPE_H261_FIL,
+ MB_TYPE_QUANT | MB_TYPE_CBP | MB_TYPE_16x16 | MB_TYPE_H261_FIL
};
//H.261 VLC table for motion vectors
-static const uint8_t h261_mv_tab[17][2] =
-{
- {1, 1}, {1, 2}, {1, 3}, {1, 4}, {3, 6}, {5, 7}, {4, 7}, {3, 7},
- {11, 9}, {10, 9}, {9, 9}, {17, 10}, {16, 10}, {15, 10}, {14, 10}, {13, 10}, {12, 10}
+static const uint8_t h261_mv_tab[17][2] = {
+ {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
+ {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10}, {12,10}
};
static const int mvmap[17] =
@@ -105,40 +99,38 @@ static const int mvmap[17] =
//H.261 VLC table for coded block pattern
static const uint8_t h261_cbp_tab[63][2] =
{
- {11, 5}, {9, 5}, {13, 6}, {13, 4}, {23, 7}, {19, 7}, {31, 8}, {12, 4},
- {22, 7}, {18, 7}, {30, 8}, {19, 5}, {27, 8}, {23, 8}, {19, 8}, {11, 4},
- {21, 7}, {17, 7}, {29, 8}, {17, 5}, {25, 8}, {21, 8}, {17, 8}, {15, 6},
- {15, 8}, {13, 8}, {3, 9}, {15, 5}, {11, 8}, {7, 8}, {7, 9}, {10, 4},
- {20, 7}, {16, 7}, {28, 8}, {14, 6}, {14, 8}, {12, 8}, {2, 9}, {16, 5},
- {24, 8}, {20, 8}, {16, 8}, {14, 5}, {10, 8}, {6, 8}, {6, 9}, {18, 5},
- {26, 8}, {22, 8}, {18, 8}, {13, 5}, {9, 8}, {5, 8}, {5, 9}, {12, 5},
- {8, 8}, {4, 8}, {4, 9}, {7, 3}, {10, 5}, {8, 5}, {12, 6}
+ {11,5}, {9,5}, {13,6}, {13,4}, {23,7}, {19,7}, {31,8}, {12,4},
+ {22,7}, {18,7}, {30,8}, {19,5}, {27,8}, {23,8}, {19,8}, {11,4},
+ {21,7}, {17,7}, {29,8}, {17,5}, {25,8}, {21,8}, {17,8}, {15,6},
+ {15,8}, {13,8}, {3,9}, {15,5}, {11,8}, {7,8}, {7,9}, {10,4},
+ {20,7}, {16,7}, {28,8}, {14,6}, {14,8}, {12,8}, {2,9}, {16,5},
+ {24,8}, {20,8}, {16,8}, {14,5}, {10,8}, {6,8}, {6,9}, {18,5},
+ {26,8}, {22,8}, {18,8}, {13,5}, {9,8}, {5,8}, {5,9}, {12,5},
+ {8,8}, {4,8}, {4,9}, {7,3}, {10,5}, {8,5}, {12,6}
};
//H.261 VLC table for transform coefficients
-static const uint16_t h261_tcoeff_vlc[65][2] =
-{
- { 0x2, 2 }, { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 },
- { 0x6, 7 }, { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 },
- { 0x1d, 12 }, { 0x18, 12 }, { 0x13, 12 }, { 0x10 , 12 },
- { 0x1a, 13}, { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 },
- { 0x3, 3 }, { 0x6, 6 }, { 0x25 , 8 }, { 0xc, 10 },
- { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x5, 4},
- { 0x4, 7}, { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 },
- { 0x7, 5 }, { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 },
- { 0x6, 5 }, { 0xf, 10 }, { 0x12, 12}, { 0x7, 6},
- { 0x9 , 10 }, { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 },
- { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12},
- { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
- { 0x23, 8 }, { 0x22, 8 }, { 0x20, 8 }, { 0xe , 10 },
- { 0xd, 10 }, { 0x8, 10 }, { 0x1f, 12 }, { 0x1a, 12 },
- { 0x19, 12 }, { 0x17, 12 }, { 0x16, 12}, { 0x1f, 13},
- { 0x1e, 13 }, { 0x1d, 13 }, { 0x1c, 13}, { 0x1b, 13},
- { 0x1, 6 } //escape
+static const uint16_t h261_tcoeff_vlc[65][2] = {
+{ 0x2, 2 }, { 0x3, 2 },{ 0x4, 4 },{ 0x5, 5 },
+{ 0x6, 7 },{ 0x26, 8 },{ 0x21, 8 },{ 0xa, 10 },
+{ 0x1d, 12 },{ 0x18, 12 },{ 0x13, 12 },{ 0x10 , 12 },
+{ 0x1a, 13},{ 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 },
+{ 0x3, 3 }, { 0x6, 6 }, { 0x25 , 8 }, { 0xc, 10 },
+{ 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x5, 4},
+{ 0x4, 7}, { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 },
+{ 0x7, 5 }, { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 },
+{ 0x6, 5 }, { 0xf, 10 }, { 0x12, 12}, { 0x7, 6},
+{ 0x9 , 10 }, { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 },
+{ 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12},
+{ 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
+{ 0x23, 8 }, { 0x22, 8 }, { 0x20, 8 }, { 0xe , 10 },
+{ 0xd, 10 }, { 0x8, 10 },{ 0x1f, 12 }, { 0x1a, 12 },
+{ 0x19, 12 }, { 0x17, 12 }, { 0x16, 12}, { 0x1f, 13},
+{ 0x1e, 13 }, { 0x1d, 13 }, { 0x1c, 13}, { 0x1b, 13},
+{ 0x1, 6 } //escape
};
-static const int8_t h261_tcoeff_level[64] =
-{
+static const int8_t h261_tcoeff_level[64] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
1, 2, 3, 4, 5, 6, 7, 1,
@@ -149,8 +141,7 @@ static const int8_t h261_tcoeff_level[64] =
1, 1, 1, 1, 1, 1, 1, 1
};
-static const int8_t h261_tcoeff_run[64] =
-{
+static const int8_t h261_tcoeff_run[64] = {
0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
@@ -158,12 +149,11 @@ static const int8_t h261_tcoeff_run[64] =
2, 2, 2, 3, 3, 3, 3, 4,
4, 4, 5, 5, 5, 6, 6, 7,
7, 8, 8, 9, 9, 10, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26
+ 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26
};
-static RLTable h261_rl_tcoeff =
-{
+static RLTable h261_rl_tcoeff = {
64,
64,
h261_tcoeff_vlc,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261dec.c
index eb3f07858..3287f5e42 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h261dec.c
@@ -48,33 +48,30 @@ static VLC h261_cbp_vlc;
static int h261_decode_block(H261Context * h, DCTELEM * block, int n, int coded);
-static av_cold void h261_decode_init_vlc(H261Context *h)
-{
+static av_cold void h261_decode_init_vlc(H261Context *h){
static int done = 0;
- if(!done)
- {
+ if(!done){
done = 1;
INIT_VLC_STATIC(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
- h261_mba_bits, 1, 1,
- h261_mba_code, 1, 1, 662);
+ h261_mba_bits, 1, 1,
+ h261_mba_code, 1, 1, 662);
INIT_VLC_STATIC(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
- h261_mtype_bits, 1, 1,
- h261_mtype_code, 1, 1, 80);
+ h261_mtype_bits, 1, 1,
+ h261_mtype_code, 1, 1, 80);
INIT_VLC_STATIC(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
- &h261_mv_tab[0][1], 2, 1,
- &h261_mv_tab[0][0], 2, 1, 144);
+ &h261_mv_tab[0][1], 2, 1,
+ &h261_mv_tab[0][0], 2, 1, 144);
INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
- &h261_cbp_tab[0][1], 2, 1,
- &h261_cbp_tab[0][0], 2, 1, 512);
+ &h261_cbp_tab[0][1], 2, 1,
+ &h261_cbp_tab[0][0], 2, 1, 512);
init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store);
INIT_VLC_RL(h261_rl_tcoeff, 552);
}
}
-static av_cold int h261_decode_init(AVCodecContext *avctx)
-{
- H261Context *h = avctx->priv_data;
+static av_cold int h261_decode_init(AVCodecContext *avctx){
+ H261Context *h= avctx->priv_data;
MpegEncContext * const s = &h->s;
// set defaults
@@ -86,10 +83,10 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
s->codec_id = s->avctx->codec->id;
s->out_format = FMT_H261;
- s->low_delay = 1;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ s->low_delay= 1;
+ avctx->pix_fmt= PIX_FMT_YUV420P;
- s->codec_id = avctx->codec->id;
+ s->codec_id= avctx->codec->id;
h261_decode_init_vlc(h);
@@ -102,13 +99,11 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
* decodes the group of blocks header or slice header.
* @return <0 if an error occurred
*/
-static int h261_decode_gob_header(H261Context *h)
-{
+static int h261_decode_gob_header(H261Context *h){
unsigned int val;
MpegEncContext * const s = &h->s;
- if(!h->gob_start_code_skipped)
- {
+ if ( !h->gob_start_code_skipped ){
/* Check for GOB Start Code */
val = show_bits(&s->gb, 15);
if(val)
@@ -124,27 +119,23 @@ static int h261_decode_gob_header(H261Context *h)
s->qscale = get_bits(&s->gb, 5); /* GQUANT */
/* Check if gob_number is valid */
- if(s->mb_height == 18) //cif
- {
- if((h->gob_number <= 0) || (h->gob_number > 12))
+ if (s->mb_height==18){ //cif
+ if ((h->gob_number<=0) || (h->gob_number>12))
return -1;
}
- else //qcif
- {
- if((h->gob_number != 1) && (h->gob_number != 3) && (h->gob_number != 5))
+ else{ //qcif
+ if ((h->gob_number!=1) && (h->gob_number!=3) && (h->gob_number!=5))
return -1;
}
/* GEI */
- while(get_bits1(&s->gb) != 0)
- {
+ while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
}
- if(s->qscale == 0)
- {
+ if(s->qscale==0) {
av_log(s->avctx, AV_LOG_ERROR, "qscale has forbidden 0 value\n");
- if(s->avctx->error_recognition >= FF_ER_COMPLIANT)
+ if (s->avctx->error_recognition >= FF_ER_COMPLIANT)
return -1;
}
@@ -161,41 +152,35 @@ static int h261_decode_gob_header(H261Context *h)
* decodes the group of blocks / video packet header.
* @return <0 if no resync found
*/
-static int ff_h261_resync(H261Context *h)
-{
+static int ff_h261_resync(H261Context *h){
MpegEncContext * const s = &h->s;
int left, ret;
- if(h->gob_start_code_skipped)
- {
- ret = h261_decode_gob_header(h);
- if(ret >= 0)
+ if ( h->gob_start_code_skipped ){
+ ret= h261_decode_gob_header(h);
+ if(ret>=0)
return 0;
}
- else
- {
- if(show_bits(&s->gb, 15) == 0)
- {
- ret = h261_decode_gob_header(h);
- if(ret >= 0)
+ else{
+ if(show_bits(&s->gb, 15)==0){
+ ret= h261_decode_gob_header(h);
+ if(ret>=0)
return 0;
}
//OK, it is not where it is supposed to be ...
- s->gb = s->last_resync_gb;
+ s->gb= s->last_resync_gb;
align_get_bits(&s->gb);
- left = get_bits_left(&s->gb);
+ left= get_bits_left(&s->gb);
- for(; left > 15 + 1 + 4 + 5; left -= 8)
- {
- if(show_bits(&s->gb, 15) == 0)
- {
- GetBitContext bak = s->gb;
+ for(;left>15+1+4+5; left-=8){
+ if(show_bits(&s->gb, 15)==0){
+ GetBitContext bak= s->gb;
- ret = h261_decode_gob_header(h);
- if(ret >= 0)
+ ret= h261_decode_gob_header(h);
+ if(ret>=0)
return 0;
- s->gb = bak;
+ s->gb= bak;
}
skip_bits(&s->gb, 8);
}
@@ -208,29 +193,28 @@ static int ff_h261_resync(H261Context *h)
* decodes skipped macroblocks
* @return 0
*/
-static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2)
+static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 )
{
MpegEncContext * const s = &h->s;
int i;
s->mb_intra = 0;
- for(i = mba1; i < mba2; i++)
- {
+ for(i=mba1; i<mba2; i++){
int j, xy;
- s->mb_x = ((h->gob_number - 1) % 2) * 11 + i % 11;
- s->mb_y = ((h->gob_number - 1) / 2) * 3 + i / 11;
+ s->mb_x= ((h->gob_number-1) % 2) * 11 + i % 11;
+ s->mb_y= ((h->gob_number-1) / 2) * 3 + i / 11;
xy = s->mb_x + s->mb_y * s->mb_stride;
ff_init_block_index(s);
ff_update_block_index(s);
- for(j = 0; j < 6; j++)
+ for(j=0;j<6;j++)
s->block_last_index[j] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
s->mb_skipped = 1;
@@ -242,50 +226,45 @@ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2)
return 0;
}
-static int decode_mv_component(GetBitContext *gb, int v)
-{
+static int decode_mv_component(GetBitContext *gb, int v){
int mv_diff = get_vlc2(gb, h261_mv_vlc.table, H261_MV_VLC_BITS, 2);
/* check if mv_diff is valid */
- if(mv_diff < 0)
+ if ( mv_diff < 0 )
return v;
mv_diff = mvmap[mv_diff];
if(mv_diff && !get_bits1(gb))
- mv_diff = -mv_diff;
+ mv_diff= -mv_diff;
v += mv_diff;
- if(v <= -16) v += 32;
- else if(v >= 16) v -= 32;
+ if (v <=-16) v+= 32;
+ else if(v >= 16) v-= 32;
return v;
}
-static int h261_decode_mb(H261Context *h)
-{
+static int h261_decode_mb(H261Context *h){
MpegEncContext * const s = &h->s;
int i, cbp, xy;
cbp = 63;
// Read mba
- do
- {
+ do{
h->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2);
/* Check for slice end */
/* NOTE: GOB can be empty (no MB data) or exist only of MBA_stuffing */
- if(h->mba_diff == MBA_STARTCODE) // start code
- {
+ if (h->mba_diff == MBA_STARTCODE){ // start code
h->gob_start_code_skipped = 1;
return SLICE_END;
}
}
- while(h->mba_diff == MBA_STUFFING); // stuffing
+ while( h->mba_diff == MBA_STUFFING ); // stuffing
- if(h->mba_diff < 0)
- {
- if(get_bits_count(&s->gb) + 7 >= s->gb.size_in_bits)
+ if ( h->mba_diff < 0 ){
+ if ( get_bits_count(&s->gb) + 7 >= s->gb.size_in_bits )
return SLICE_END;
av_log(s->avctx, AV_LOG_ERROR, "illegal mba at %d %d\n", s->mb_x, s->mb_y);
@@ -295,11 +274,11 @@ static int h261_decode_mb(H261Context *h)
h->mba_diff += 1;
h->current_mba += h->mba_diff;
- if(h->current_mba > MBA_STUFFING)
+ if ( h->current_mba > MBA_STUFFING )
return SLICE_ERROR;
- s->mb_x = ((h->gob_number - 1) % 2) * 11 + ((h->current_mba - 1) % 11);
- s->mb_y = ((h->gob_number - 1) / 2) * 3 + ((h->current_mba - 1) / 11);
+ s->mb_x= ((h->gob_number-1) % 2) * 11 + ((h->current_mba-1) % 11);
+ s->mb_y= ((h->gob_number-1) / 2) * 3 + ((h->current_mba-1) / 11);
xy = s->mb_x + s->mb_y * s->mb_stride;
ff_init_block_index(s);
ff_update_block_index(s);
@@ -309,75 +288,64 @@ static int h261_decode_mb(H261Context *h)
h->mtype = h261_mtype_map[h->mtype];
// Read mquant
- if(IS_QUANT(h->mtype))
- {
+ if ( IS_QUANT ( h->mtype ) ){
ff_set_qscale(s, get_bits(&s->gb, 5));
}
s->mb_intra = IS_INTRA4x4(h->mtype);
// Read mv
- if(IS_16X16(h->mtype))
- {
+ if ( IS_16X16 ( h->mtype ) ){
// Motion vector data is included for all MC macroblocks. MVD is obtained from the macroblock vector by subtracting the
// vector of the preceding macroblock. For this calculation the vector of the preceding macroblock is regarded as zero in the
// following three situations:
// 1) evaluating MVD for macroblocks 1, 12 and 23;
// 2) evaluating MVD for macroblocks in which MBA does not represent a difference of 1;
// 3) MTYPE of the previous macroblock was not MC.
- if((h->current_mba == 1) || (h->current_mba == 12) || (h->current_mba == 23) ||
- (h->mba_diff != 1))
+ if ( ( h->current_mba == 1 ) || ( h->current_mba == 12 ) || ( h->current_mba == 23 ) ||
+ ( h->mba_diff != 1))
{
h->current_mv_x = 0;
h->current_mv_y = 0;
}
- h->current_mv_x = decode_mv_component(&s->gb, h->current_mv_x);
- h->current_mv_y = decode_mv_component(&s->gb, h->current_mv_y);
- }
- else
- {
+ h->current_mv_x= decode_mv_component(&s->gb, h->current_mv_x);
+ h->current_mv_y= decode_mv_component(&s->gb, h->current_mv_y);
+ }else{
h->current_mv_x = 0;
h->current_mv_y = 0;
}
// Read cbp
- if(HAS_CBP(h->mtype))
- {
+ if ( HAS_CBP( h->mtype ) ){
cbp = get_vlc2(&s->gb, h261_cbp_vlc.table, H261_CBP_VLC_BITS, 2) + 1;
}
- if(s->mb_intra)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
+ if(s->mb_intra){
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
goto intra;
}
//set motion vectors
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
- s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
+ s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
s->mv[0][0][0] = h->current_mv_x * 2;//gets divided by 2 in motion compensation
s->mv[0][0][1] = h->current_mv_y * 2;
intra:
/* decode each block */
- if(s->mb_intra || HAS_CBP(h->mtype))
- {
+ if(s->mb_intra || HAS_CBP(h->mtype)){
s->dsp.clear_blocks(s->block[0]);
- for(i = 0; i < 6; i++)
- {
- if(h261_decode_block(h, s->block[i], i, cbp & 32) < 0)
- {
+ for (i = 0; i < 6; i++) {
+ if (h261_decode_block(h, s->block[i], i, cbp&32) < 0){
return SLICE_ERROR;
}
- cbp += cbp;
+ cbp+=cbp;
}
- }
- else
- {
- for(i = 0; i < 6; i++)
- s->block_last_index[i] = -1;
+ }else{
+ for (i = 0; i < 6; i++)
+ s->block_last_index[i]= -1;
}
MPV_decode_mb(s, s->block);
@@ -403,75 +371,59 @@ static int h261_decode_block(H261Context * h, DCTELEM * block,
// coded with 8 bits.
// NOTE: the two code tables only differ in one VLC so we handle that manually.
scan_table = s->intra_scantable.permutated;
- if(s->mb_intra)
- {
+ if (s->mb_intra){
/* DC coef */
level = get_bits(&s->gb, 8);
// 0 (00000000b) and -128 (10000000b) are FORBIDDEN
- if((level & 0x7F) == 0)
- {
+ if((level&0x7F) == 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
return -1;
}
// The code 1000 0000 is not used, the reconstruction level of 1024 being coded as 1111 1111.
- if(level == 255)
+ if (level == 255)
level = 128;
block[0] = level;
i = 1;
- }
- else if(coded)
- {
+ }else if(coded){
// Run Level Code
// EOB Not possible for first level when cbp is available (that's why the table is different)
// 0 1 1s
// * * 0*
int check = show_bits(&s->gb, 2);
i = 0;
- if(check & 0x2)
- {
+ if ( check & 0x2 ){
skip_bits(&s->gb, 2);
- block[0] = (check & 0x1) ? -1 : 1;
+ block[0] = ( check & 0x1 ) ? -1 : 1;
i = 1;
}
- }
- else
- {
+ }else{
i = 0;
}
- if(!coded)
- {
+ if(!coded){
s->block_last_index[n] = i - 1;
return 0;
}
- for(;;)
- {
+ for(;;){
code = get_vlc2(&s->gb, rl->vlc.table, TCOEFF_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
- if(code == rl->n)
- {
+ if (code == rl->n) {
/* escape */
// The remaining combinations of (run, level) are encoded with a 20-bit word consisting of 6 bits escape, 6 bits run and 8 bits level.
run = get_bits(&s->gb, 6);
level = get_sbits(&s->gb, 8);
- }
- else if(code == 0)
- {
+ }else if(code == 0){
break;
- }
- else
- {
+ }else{
run = rl->table_run[code];
level = rl->table_level[code];
- if(get_bits1(&s->gb))
+ if (get_bits1(&s->gb))
level = -level;
}
i += run;
- if(i >= 64)
- {
+ if (i >= 64){
av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -479,7 +431,7 @@ static int h261_decode_block(H261Context * h, DCTELEM * block,
block[j] = level;
i++;
}
- s->block_last_index[n] = i - 1;
+ s->block_last_index[n] = i-1;
return 0;
}
@@ -487,35 +439,31 @@ static int h261_decode_block(H261Context * h, DCTELEM * block,
* decodes the H261 picture header.
* @return <0 if no startcode found
*/
-static int h261_decode_picture_header(H261Context *h)
-{
+static int h261_decode_picture_header(H261Context *h){
MpegEncContext * const s = &h->s;
int format, i;
- uint32_t startcode = 0;
+ uint32_t startcode= 0;
- for(i = get_bits_left(&s->gb); i > 24; i -= 1)
- {
+ for(i= get_bits_left(&s->gb); i>24; i-=1){
startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;
if(startcode == 0x10)
break;
}
- if(startcode != 0x10)
- {
+ if (startcode != 0x10){
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
/* temporal reference */
- i = get_bits(&s->gb, 5); /* picture timestamp */
- if(i < (s->picture_number & 31))
+ i= get_bits(&s->gb, 5); /* picture timestamp */
+ if(i < (s->picture_number&31))
i += 32;
s->picture_number = (s->picture_number&~31) + i;
- s->avctx->time_base.num = 1001;
- s->avctx->time_base.den = 30000;
- s->current_picture.pts = s->picture_number;
+ s->avctx->time_base.num = 1001; s->avctx->time_base.den = 30000;
+ s->current_picture.pts= s->picture_number;
/* PTYPE starts here */
@@ -526,15 +474,12 @@ static int h261_decode_picture_header(H261Context *h)
format = get_bits1(&s->gb);
//only 2 formats possible
- if(format == 0) //QCIF
- {
+ if (format == 0){//QCIF
s->width = 176;
s->height = 144;
s->mb_width = 11;
s->mb_height = 9;
- }
- else //CIF
- {
+ }else{//CIF
s->width = 352;
s->height = 288;
s->mb_width = 22;
@@ -547,8 +492,7 @@ static int h261_decode_picture_header(H261Context *h)
skip_bits1(&s->gb); /* Reserved */
/* PEI */
- while(get_bits1(&s->gb) != 0)
- {
+ while (get_bits1(&s->gb) != 0){
skip_bits(&s->gb, 8);
}
@@ -560,8 +504,7 @@ static int h261_decode_picture_header(H261Context *h)
return 0;
}
-static int h261_decode_gob(H261Context *h)
-{
+static int h261_decode_gob(H261Context *h){
MpegEncContext * const s = &h->s;
ff_set_qscale(s, s->qscale);
@@ -571,19 +514,17 @@ static int h261_decode_gob(H261Context *h)
{
int ret;
/* DCT & quantize */
- ret = h261_decode_mb(h);
- if(ret < 0)
- {
- if(ret == SLICE_END)
- {
+ ret= h261_decode_mb(h);
+ if(ret<0){
+ if(ret==SLICE_END){
h261_decode_mb_skipped(h, h->current_mba, 33);
return 0;
}
- av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", s->mb_x + s->mb_y * s->mb_stride);
+ av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", s->mb_x + s->mb_y*s->mb_stride);
return -1;
}
- h261_decode_mb_skipped(h, h->current_mba - h->mba_diff, h->current_mba - 1);
+ h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);
}
return -1;
@@ -592,11 +533,10 @@ static int h261_decode_gob(H261Context *h)
/**
* returns the number of bytes consumed for building the current frame
*/
-static int get_consumed_bytes(MpegEncContext *s, int buf_size)
-{
- int pos = get_bits_count(&s->gb) >> 3;
- 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 buf_size){
+ int pos= get_bits_count(&s->gb)>>3;
+ 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;
}
@@ -605,66 +545,61 @@ static int h261_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
- H261Context *h = avctx->priv_data;
+ H261Context *h= avctx->priv_data;
MpegEncContext *s = &h->s;
int ret;
AVFrame *pict = data;
dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
dprintf(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
- s->flags = avctx->flags;
- s->flags2 = avctx->flags2;
+ s->flags= avctx->flags;
+ s->flags2= avctx->flags2;
- h->gob_start_code_skipped = 0;
+ h->gob_start_code_skipped=0;
retry:
- init_get_bits(&s->gb, buf, buf_size * 8);
+ 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(!s->context_initialized){
+ if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
return -1;
}
//we need to set current_picture_ptr before reading the header, otherwise we cannot store anyting im there
- if(s->current_picture_ptr == NULL || s->current_picture_ptr->data[0])
- {
- int i = ff_find_unused_picture(s, 0);
- s->current_picture_ptr = &s->picture[i];
+ if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
+ int i= ff_find_unused_picture(s, 0);
+ s->current_picture_ptr= &s->picture[i];
}
ret = h261_decode_picture_header(h);
/* skip if the header was thrashed */
- if(ret < 0)
- {
+ if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1;
}
- 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;
+ 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);
- s->parse_context = pc;
+ s->parse_context= pc;
}
- if(!s->context_initialized)
- {
+ if (!s->context_initialized) {
avcodec_set_dimensions(avctx, s->width, s->height);
goto retry;
}
// for hurry_up==5
- s->current_picture.pict_type = s->pict_type;
- s->current_picture.key_frame = s->pict_type == FF_I_TYPE;
+ s->current_picture.pict_type= s->pict_type;
+ s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
/* skip everything if we are in a hurry>=5 */
- if(avctx->hurry_up >= 5) return get_consumed_bytes(s, buf_size);
- if((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
+ if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
+ ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
return get_consumed_bytes(s, buf_size);
@@ -674,20 +609,19 @@ retry:
ff_er_frame_start(s);
/* decode each macroblock */
- s->mb_x = 0;
- s->mb_y = 0;
+ s->mb_x=0;
+ s->mb_y=0;
- while(h->gob_number < (s->mb_height == 18 ? 12 : 5))
- {
- if(ff_h261_resync(h) < 0)
+ while(h->gob_number < (s->mb_height==18 ? 12 : 5)){
+ if(ff_h261_resync(h)<0)
break;
h261_decode_gob(h);
}
MPV_frame_end(s);
- assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
- assert(s->current_picture.pict_type == s->pict_type);
- *pict = *(AVFrame*)s->current_picture_ptr;
+assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
+assert(s->current_picture.pict_type == s->pict_type);
+ *pict= *(AVFrame*)s->current_picture_ptr;
ff_print_debug_info(s, pict);
*data_size = sizeof(AVFrame);
@@ -697,15 +631,14 @@ retry:
static av_cold int h261_decode_end(AVCodecContext *avctx)
{
- H261Context *h = avctx->priv_data;
+ H261Context *h= avctx->priv_data;
MpegEncContext *s = &h->s;
MPV_common_end(s);
return 0;
}
-AVCodec h261_decoder =
-{
+AVCodec h261_decoder = {
"h261",
CODEC_TYPE_VIDEO,
CODEC_ID_H261,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.c
index 06a7ddd28..a07c654e1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.c
@@ -46,43 +46,35 @@
uint8_t ff_h263_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
-void ff_h263_update_motion_val(MpegEncContext * s)
-{
+void ff_h263_update_motion_val(MpegEncContext * s){
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
- //FIXME a lot of that is only needed for !low_delay
+ //FIXME a lot of that is only needed for !low_delay
const int wrap = s->b8_stride;
const int xy = s->block_index[0];
- s->current_picture.mbskip_table[mb_xy] = s->mb_skipped;
+ s->current_picture.mbskip_table[mb_xy]= s->mb_skipped;
- if(s->mv_type != MV_TYPE_8X8)
- {
+ if(s->mv_type != MV_TYPE_8X8){
int motion_x, motion_y;
- if(s->mb_intra)
- {
+ if (s->mb_intra) {
motion_x = 0;
motion_y = 0;
- }
- else if(s->mv_type == MV_TYPE_16X16)
- {
+ } else if (s->mv_type == MV_TYPE_16X16) {
motion_x = s->mv[0][0][0];
motion_y = s->mv[0][0][1];
- }
- else /*if (s->mv_type == MV_TYPE_FIELD)*/
- {
+ } else /*if (s->mv_type == MV_TYPE_FIELD)*/ {
int i;
motion_x = s->mv[0][0][0] + s->mv[0][1][0];
motion_y = s->mv[0][0][1] + s->mv[0][1][1];
- motion_x = (motion_x >> 1) | (motion_x & 1);
- for(i = 0; i < 2; i++)
- {
- s->p_field_mv_table[i][0][mb_xy][0] = s->mv[0][i][0];
- s->p_field_mv_table[i][0][mb_xy][1] = s->mv[0][i][1];
+ motion_x = (motion_x>>1) | (motion_x&1);
+ for(i=0; i<2; i++){
+ s->p_field_mv_table[i][0][mb_xy][0]= s->mv[0][i][0];
+ s->p_field_mv_table[i][0][mb_xy][1]= s->mv[0][i][1];
}
- s->current_picture.ref_index[0][xy ] =
- s->current_picture.ref_index[0][xy + 1] = s->field_select[0][0];
- s->current_picture.ref_index[0][xy + wrap ] =
- s->current_picture.ref_index[0][xy + wrap + 1] = s->field_select[0][1];
+ s->current_picture.ref_index[0][xy ]=
+ s->current_picture.ref_index[0][xy + 1]= s->field_select[0][0];
+ s->current_picture.ref_index[0][xy + wrap ]=
+ s->current_picture.ref_index[0][xy + wrap + 1]= s->field_select[0][1];
}
/* no update if 8X8 because it has been done during parsing */
@@ -96,14 +88,13 @@ void ff_h263_update_motion_val(MpegEncContext * s)
s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;
}
- if(s->encoding) //FIXME encoding MUST be cleaned up
- {
- if(s->mv_type == MV_TYPE_8X8)
- s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
+ if(s->encoding){ //FIXME encoding MUST be cleaned up
+ if (s->mv_type == MV_TYPE_8X8)
+ s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_8x8;
else if(s->mb_intra)
- s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
+ s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA;
else
- s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
+ s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_16x16;
}
}
@@ -113,15 +104,12 @@ int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr)
int16_t *dc_val;
/* find prediction */
- if(n < 4)
- {
+ if (n < 4) {
x = 2 * s->mb_x + (n & 1);
y = 2 * s->mb_y + ((n & 2) >> 1);
wrap = s->b8_stride;
dc_val = s->dc_val[0];
- }
- else
- {
+ } else {
x = s->mb_x;
y = s->mb_y;
wrap = s->mb_stride;
@@ -134,15 +122,14 @@ int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr)
c = dc_val[(x) + (y - 1) * wrap];
/* No prediction outside GOB boundary */
- if(s->first_slice_line && n != 3)
- {
- if(n != 2) c = 1024;
- if(n != 1 && s->mb_x == s->resync_mb_x) a = 1024;
+ if(s->first_slice_line && n!=3){
+ if(n!=2) c= 1024;
+ if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024;
}
/* just DC prediction */
- if(a != 1024 && c != 1024)
+ if (a != 1024 && c != 1024)
pred_dc = (a + c) >> 1;
- else if(a != 1024)
+ else if (a != 1024)
pred_dc = a;
else
pred_dc = c;
@@ -152,15 +139,14 @@ int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr)
return pred_dc;
}
-void ff_h263_loop_filter(MpegEncContext * s)
-{
+void ff_h263_loop_filter(MpegEncContext * s){
int qp_c;
const int linesize = s->linesize;
- const int uvlinesize = s->uvlinesize;
+ const int uvlinesize= s->uvlinesize;
const int xy = s->mb_y * s->mb_stride + s->mb_x;
uint8_t *dest_y = s->dest[0];
- uint8_t *dest_cb = s->dest[1];
- uint8_t *dest_cr = s->dest[2];
+ uint8_t *dest_cb= s->dest[1];
+ uint8_t *dest_cr= s->dest[2];
// if(s->pict_type==FF_B_TYPE && !s->readable) return;
@@ -168,81 +154,71 @@ void ff_h263_loop_filter(MpegEncContext * s)
Diag Top
Left Center
*/
- if(!IS_SKIP(s->current_picture.mb_type[xy]))
- {
- qp_c = s->qscale;
- s->dsp.h263_v_loop_filter(dest_y + 8 * linesize , linesize, qp_c);
- s->dsp.h263_v_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c);
- }
- else
- qp_c = 0;
-
- if(s->mb_y)
- {
+ if(!IS_SKIP(s->current_picture.mb_type[xy])){
+ qp_c= s->qscale;
+ s->dsp.h263_v_loop_filter(dest_y+8*linesize , linesize, qp_c);
+ s->dsp.h263_v_loop_filter(dest_y+8*linesize+8, linesize, qp_c);
+ }else
+ qp_c= 0;
+
+ if(s->mb_y){
int qp_dt, qp_tt, qp_tc;
if(IS_SKIP(s->current_picture.mb_type[xy-s->mb_stride]))
- qp_tt = 0;
+ qp_tt=0;
else
- qp_tt = s->current_picture.qscale_table[xy-s->mb_stride];
+ qp_tt= s->current_picture.qscale_table[xy-s->mb_stride];
if(qp_c)
- qp_tc = qp_c;
+ qp_tc= qp_c;
else
- qp_tc = qp_tt;
+ qp_tc= qp_tt;
- if(qp_tc)
- {
- const int chroma_qp = s->chroma_qscale_table[qp_tc];
+ if(qp_tc){
+ const int chroma_qp= s->chroma_qscale_table[qp_tc];
s->dsp.h263_v_loop_filter(dest_y , linesize, qp_tc);
- s->dsp.h263_v_loop_filter(dest_y + 8, linesize, qp_tc);
+ s->dsp.h263_v_loop_filter(dest_y+8, linesize, qp_tc);
s->dsp.h263_v_loop_filter(dest_cb , uvlinesize, chroma_qp);
s->dsp.h263_v_loop_filter(dest_cr , uvlinesize, chroma_qp);
}
if(qp_tt)
- s->dsp.h263_h_loop_filter(dest_y - 8 * linesize + 8 , linesize, qp_tt);
+ s->dsp.h263_h_loop_filter(dest_y-8*linesize+8 , linesize, qp_tt);
- if(s->mb_x)
- {
+ if(s->mb_x){
if(qp_tt || IS_SKIP(s->current_picture.mb_type[xy-1-s->mb_stride]))
- qp_dt = qp_tt;
+ qp_dt= qp_tt;
else
- qp_dt = s->current_picture.qscale_table[xy-1-s->mb_stride];
-
- if(qp_dt)
- {
- const int chroma_qp = s->chroma_qscale_table[qp_dt];
- s->dsp.h263_h_loop_filter(dest_y - 8 * linesize , linesize, qp_dt);
- s->dsp.h263_h_loop_filter(dest_cb - 8 * uvlinesize, uvlinesize, chroma_qp);
- s->dsp.h263_h_loop_filter(dest_cr - 8 * uvlinesize, uvlinesize, chroma_qp);
+ qp_dt= s->current_picture.qscale_table[xy-1-s->mb_stride];
+
+ if(qp_dt){
+ const int chroma_qp= s->chroma_qscale_table[qp_dt];
+ s->dsp.h263_h_loop_filter(dest_y -8*linesize , linesize, qp_dt);
+ s->dsp.h263_h_loop_filter(dest_cb-8*uvlinesize, uvlinesize, chroma_qp);
+ s->dsp.h263_h_loop_filter(dest_cr-8*uvlinesize, uvlinesize, chroma_qp);
}
}
}
- if(qp_c)
- {
- s->dsp.h263_h_loop_filter(dest_y + 8, linesize, qp_c);
+ if(qp_c){
+ s->dsp.h263_h_loop_filter(dest_y +8, linesize, qp_c);
if(s->mb_y + 1 == s->mb_height)
- s->dsp.h263_h_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c);
+ s->dsp.h263_h_loop_filter(dest_y+8*linesize+8, linesize, qp_c);
}
- if(s->mb_x)
- {
+ if(s->mb_x){
int qp_lc;
if(qp_c || IS_SKIP(s->current_picture.mb_type[xy-1]))
- qp_lc = qp_c;
+ qp_lc= qp_c;
else
- qp_lc = s->current_picture.qscale_table[xy-1];
+ qp_lc= s->current_picture.qscale_table[xy-1];
- if(qp_lc)
- {
+ if(qp_lc){
s->dsp.h263_h_loop_filter(dest_y, linesize, qp_lc);
- if(s->mb_y + 1 == s->mb_height)
- {
- const int chroma_qp = s->chroma_qscale_table[qp_lc];
- s->dsp.h263_h_loop_filter(dest_y + 8 * linesize, linesize, qp_lc);
+ if(s->mb_y + 1 == s->mb_height){
+ const int chroma_qp= s->chroma_qscale_table[qp_lc];
+ s->dsp.h263_h_loop_filter(dest_y +8* linesize, linesize, qp_lc);
s->dsp.h263_h_loop_filter(dest_cb , uvlinesize, chroma_qp);
s->dsp.h263_h_loop_filter(dest_cr , uvlinesize, chroma_qp);
}
@@ -256,17 +232,14 @@ void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
int16_t *dc_val, *ac_val, *ac_val1;
/* find prediction */
- if(n < 4)
- {
+ if (n < 4) {
x = 2 * s->mb_x + (n & 1);
- y = 2 * s->mb_y + (n >> 1);
+ y = 2 * s->mb_y + (n>> 1);
wrap = s->b8_stride;
dc_val = s->dc_val[0];
ac_val = s->ac_val[0][0];
scale = s->y_dc_scale;
- }
- else
- {
+ } else {
x = s->mb_x;
y = s->mb_y;
wrap = s->mb_stride;
@@ -285,57 +258,46 @@ void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
c = dc_val[(x) + (y - 1) * wrap];
/* No prediction outside GOB boundary */
- if(s->first_slice_line && n != 3)
- {
- if(n != 2) c = 1024;
- if(n != 1 && s->mb_x == s->resync_mb_x) a = 1024;
+ if(s->first_slice_line && n!=3){
+ if(n!=2) c= 1024;
+ if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024;
}
- if(s->ac_pred)
- {
+ if (s->ac_pred) {
pred_dc = 1024;
- if(s->h263_aic_dir)
- {
+ if (s->h263_aic_dir) {
/* left prediction */
- if(a != 1024)
- {
+ if (a != 1024) {
ac_val -= 16;
- for(i = 1; i < 8; i++)
- {
+ for(i=1;i<8;i++) {
block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
}
pred_dc = a;
}
- }
- else
- {
+ } else {
/* top prediction */
- if(c != 1024)
- {
+ if (c != 1024) {
ac_val -= 16 * wrap;
- for(i = 1; i < 8; i++)
- {
+ for(i=1;i<8;i++) {
block[s->dsp.idct_permutation[i ]] += ac_val[i + 8];
}
pred_dc = c;
}
}
- }
- else
- {
+ } else {
/* just DC prediction */
- if(a != 1024 && c != 1024)
+ if (a != 1024 && c != 1024)
pred_dc = (a + c) >> 1;
- else if(a != 1024)
+ else if (a != 1024)
pred_dc = a;
else
pred_dc = c;
}
/* we assume pred is positive */
- block[0] = block[0] * scale + pred_dc;
+ block[0]=block[0]*scale + pred_dc;
- if(block[0] < 0)
+ if (block[0] < 0)
block[0] = 0;
else
block[0] |= 1;
@@ -344,82 +306,63 @@ void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
dc_val[(x) + (y) * wrap] = block[0];
/* left copy */
- for(i = 1; i < 8; i++)
+ for(i=1;i<8;i++)
ac_val1[i ] = block[s->dsp.idct_permutation[i<<3]];
/* top copy */
- for(i = 1; i < 8; i++)
+ for(i=1;i<8;i++)
ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]];
}
int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
- int *px, int *py)
+ int *px, int *py)
{
int wrap;
int16_t *A, *B, *C, (*mot_val)[2];
- static const int off[4] = {2, 1, 1, -1};
+ static const int off[4]= {2, 1, 1, -1};
wrap = s->b8_stride;
mot_val = s->current_picture.motion_val[dir] + s->block_index[block];
A = mot_val[ - 1];
/* special case for first (slice) line */
- if(s->first_slice_line && block < 3)
- {
+ if (s->first_slice_line && block<3) {
// we can't just change some MVs to simulate that as we need them for the B frames (and ME)
// and if we ever support non rectangular objects than we need to do a few ifs here anyway :(
- if(block == 0) //most common case
- {
- if(s->mb_x == s->resync_mb_x) //rare
- {
- *px = *py = 0;
- }
- else if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred) //rare
- {
+ if(block==0){ //most common case
+ if(s->mb_x == s->resync_mb_x){ //rare
+ *px= *py = 0;
+ }else if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare
C = mot_val[off[block] - wrap];
- if(s->mb_x == 0)
- {
+ if(s->mb_x==0){
*px = C[0];
*py = C[1];
- }
- else
- {
+ }else{
*px = mid_pred(A[0], 0, C[0]);
*py = mid_pred(A[1], 0, C[1]);
}
- }
- else
- {
+ }else{
*px = A[0];
*py = A[1];
}
- }
- else if(block == 1)
- {
- if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred) //rare
- {
+ }else if(block==1){
+ if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare
C = mot_val[off[block] - wrap];
*px = mid_pred(A[0], 0, C[0]);
*py = mid_pred(A[1], 0, C[1]);
- }
- else
- {
+ }else{
*px = A[0];
*py = A[1];
}
- }
- else /* block==2*/
- {
+ }else{ /* block==2*/
B = mot_val[ - wrap];
C = mot_val[off[block] - wrap];
if(s->mb_x == s->resync_mb_x) //rare
- A[0] = A[1] = 0;
+ A[0]=A[1]=0;
*px = mid_pred(A[0], B[0], C[0]);
*py = mid_pred(A[1], B[1], C[1]);
}
- }
- else
- {
+ } else {
B = mot_val[ - wrap];
C = mot_val[off[block] - wrap];
*px = mid_pred(A[0], B[0], C[0]);
@@ -432,11 +375,10 @@ int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
/**
* Get the GOB height based on picture height.
*/
-int ff_h263_get_gob_height(MpegEncContext *s)
-{
- if(s->height <= 400)
+int ff_h263_get_gob_height(MpegEncContext *s){
+ if (s->height <= 400)
return 1;
- else if(s->height <= 800)
+ else if (s->height <= 800)
return 2;
else
return 4;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.h
index 6af921c66..9adc17843 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263.h
@@ -63,8 +63,8 @@ int 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,
- const uint8_t *buf, int buf_size);
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size);
int ff_h263_decode_end(AVCodecContext *avctx);
void h263_encode_mb(MpegEncContext *s,
DCTELEM block[6][64],
@@ -72,7 +72,7 @@ void h263_encode_mb(MpegEncContext *s,
void h263_encode_picture_header(MpegEncContext *s, int picture_number);
void h263_encode_gob_header(MpegEncContext * s, int mb_line);
int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
- int *px, int *py);
+ int *px, int *py);
void h263_encode_init(MpegEncContext *s);
void h263_decode_init_vlc(MpegEncContext *s);
int h263_decode_picture_header(MpegEncContext *s);
@@ -110,20 +110,16 @@ int ff_h263_get_gob_height(MpegEncContext *s);
void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
-static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code)
-{
+static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){
int l, bit_size, code;
- if(val == 0)
- {
+ if (val == 0) {
return mvtab[0][1];
- }
- else
- {
+ } else {
bit_size = f_code - 1;
/* modulo encoding */
- l = INT_BIT - 6 - bit_size;
- val = (val << l)>>l;
+ l= INT_BIT - 6 - bit_size;
+ val = (val<<l)>>l;
val--;
code = (val >> bit_size) + 1;
@@ -131,84 +127,68 @@ static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code
}
}
-static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y, int f_code)
-{
- if(s->flags2 & CODEC_FLAG2_NO_OUTPUT)
- {
+static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y, int f_code){
+ if(s->flags2 & CODEC_FLAG2_NO_OUTPUT){
skip_put_bits(&s->pb,
- h263_get_motion_length(s, x, f_code)
- + h263_get_motion_length(s, y, f_code));
- }
- else
- {
+ h263_get_motion_length(s, x, f_code)
+ +h263_get_motion_length(s, y, f_code));
+ }else{
ff_h263_encode_motion(s, x, f_code);
ff_h263_encode_motion(s, y, f_code);
}
}
static inline int get_p_cbp(MpegEncContext * s,
- DCTELEM block[6][64],
- int motion_x, int motion_y)
-{
+ DCTELEM block[6][64],
+ int motion_x, int motion_y){
int cbp, i;
- if(s->flags & CODEC_FLAG_CBP_RD)
- {
- int best_cbpy_score = INT_MAX;
- int best_cbpc_score = INT_MAX;
- int cbpc = (-1), cbpy = (-1);
- const int offset = (s->mv_type == MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0);
- const int lambda = s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
-
- for(i = 0; i < 4; i++)
- {
- int score = ff_h263_inter_MCBPC_bits[i + offset] * lambda;
- if(i & 1) score += s->coded_score[5];
- if(i & 2) score += s->coded_score[4];
-
- if(score < best_cbpc_score)
- {
- best_cbpc_score = score;
- cbpc = i;
+ if(s->flags & CODEC_FLAG_CBP_RD){
+ int best_cbpy_score= INT_MAX;
+ int best_cbpc_score= INT_MAX;
+ int cbpc = (-1), cbpy= (-1);
+ const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0);
+ const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
+
+ for(i=0; i<4; i++){
+ int score= ff_h263_inter_MCBPC_bits[i + offset] * lambda;
+ if(i&1) score += s->coded_score[5];
+ if(i&2) score += s->coded_score[4];
+
+ if(score < best_cbpc_score){
+ best_cbpc_score= score;
+ cbpc= i;
}
}
- for(i = 0; i < 16; i++)
- {
- int score = ff_h263_cbpy_tab[i ^ 0xF][1] * lambda;
- if(i & 1) score += s->coded_score[3];
- if(i & 2) score += s->coded_score[2];
- if(i & 4) score += s->coded_score[1];
- if(i & 8) score += s->coded_score[0];
-
- if(score < best_cbpy_score)
- {
- best_cbpy_score = score;
- cbpy = i;
+ for(i=0; i<16; i++){
+ int score= ff_h263_cbpy_tab[i ^ 0xF][1] * lambda;
+ if(i&1) score += s->coded_score[3];
+ if(i&2) score += s->coded_score[2];
+ if(i&4) score += s->coded_score[1];
+ if(i&8) score += s->coded_score[0];
+
+ if(score < best_cbpy_score){
+ best_cbpy_score= score;
+ cbpy= i;
}
}
- cbp = cbpc + 4 * cbpy;
- if((motion_x | motion_y | s->dquant) == 0 && s->mv_type == MV_TYPE_16X16)
- {
- if(best_cbpy_score + best_cbpc_score + 2 * lambda >= 0)
- cbp = 0;
+ cbp= cbpc + 4*cbpy;
+ if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){
+ if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0)
+ cbp= 0;
}
- for(i = 0; i < 6; i++)
- {
- if(s->block_last_index[i] >= 0 && ((cbp >> (5 - i)) & 1) == 0)
- {
- s->block_last_index[i] = -1;
+ for (i = 0; i < 6; i++) {
+ if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
+ s->block_last_index[i]= -1;
s->dsp.clear_block(s->block[i]);
}
}
- }
- else
- {
- cbp = 0;
- for(i = 0; i < 6; i++)
- {
- if(s->block_last_index[i] >= 0)
+ }else{
+ cbp= 0;
+ for (i = 0; i < 6; i++) {
+ if (s->block_last_index[i] >= 0)
cbp |= 1 << (5 - i);
}
}
@@ -216,53 +196,41 @@ static inline int get_p_cbp(MpegEncContext * s,
}
static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
- int motion_x, int motion_y, int mb_type)
-{
- int cbp = 0, i;
+ int motion_x, int motion_y, int mb_type){
+ int cbp=0, i;
- if(s->flags & CODEC_FLAG_CBP_RD)
- {
- int score = 0;
- const int lambda = s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
+ if(s->flags & CODEC_FLAG_CBP_RD){
+ int score=0;
+ const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
- for(i = 0; i < 6; i++)
- {
- if(s->coded_score[i] < 0)
- {
+ for(i=0; i<6; i++){
+ if(s->coded_score[i] < 0){
score += s->coded_score[i];
cbp |= 1 << (5 - i);
}
}
- if(cbp)
- {
- int zero_score = -6;
- if((motion_x | motion_y | s->dquant | mb_type) == 0)
- {
- zero_score -= 4; //2*MV + mb_type + cbp bit
+ if(cbp){
+ int zero_score= -6;
+ if ((motion_x | motion_y | s->dquant | mb_type) == 0){
+ zero_score-= 4; //2*MV + mb_type + cbp bit
}
- zero_score *= lambda;
- if(zero_score <= score)
- {
- cbp = 0;
+ zero_score*= lambda;
+ if(zero_score <= score){
+ cbp=0;
}
}
- for(i = 0; i < 6; i++)
- {
- if(s->block_last_index[i] >= 0 && ((cbp >> (5 - i)) & 1) == 0)
- {
- s->block_last_index[i] = -1;
+ for (i = 0; i < 6; i++) {
+ if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
+ s->block_last_index[i]= -1;
s->dsp.clear_block(s->block[i]);
}
}
- }
- else
- {
- for(i = 0; i < 6; i++)
- {
- if(s->block_last_index[i] >= 0)
+ }else{
+ for (i = 0; i < 6; i++) {
+ if (s->block_last_index[i] >= 0)
cbp |= 1 << (5 - i);
}
}
@@ -272,7 +240,7 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
static inline void memsetw(short *tab, int val, int n)
{
int i;
- for(i = 0; i < n; i++)
+ for(i=0;i<n;i++)
tab[i] = val;
}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263_parser.c
index cf6e47ea1..44f632e92 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263_parser.c
@@ -26,44 +26,37 @@
#include "parser.h"
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
-{
+int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
int vop_found, i;
uint32_t state;
- vop_found = pc->frame_start_found;
- state = pc->state;
+ vop_found= pc->frame_start_found;
+ state= pc->state;
- i = 0;
- if(!vop_found)
- {
- for(i = 0; i < buf_size; i++)
- {
- state = (state << 8) | buf[i];
- if(state >> (32 - 22) == 0x20)
- {
+ i=0;
+ if(!vop_found){
+ for(i=0; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ if(state>>(32-22) == 0x20){
i++;
- vop_found = 1;
+ vop_found=1;
break;
}
}
}
- if(vop_found)
- {
- for(; i < buf_size; i++)
- {
- state = (state << 8) | buf[i];
- if(state >> (32 - 22) == 0x20)
- {
- pc->frame_start_found = 0;
- pc->state = -1;
- return i - 3;
- }
+ if(vop_found){
+ for(; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ if(state>>(32-22) == 0x20){
+ pc->frame_start_found=0;
+ pc->state=-1;
+ return i-3;
}
+ }
}
- pc->frame_start_found = vop_found;
- pc->state = state;
+ pc->frame_start_found= vop_found;
+ pc->state= state;
return END_NOT_FOUND;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263data.h
index 88102781b..0c0d307f2 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263data.h
@@ -38,8 +38,7 @@ const uint8_t ff_h263_intra_MCBPC_bits[9] = { 1, 3, 3, 3, 4, 6, 6, 6, 9 };
/* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */
/* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */
-const uint8_t ff_h263_inter_MCBPC_code[28] =
-{
+const uint8_t ff_h263_inter_MCBPC_code[28] = {
1, 3, 2, 5,
3, 4, 3, 3,
3, 7, 6, 5,
@@ -48,8 +47,7 @@ const uint8_t ff_h263_inter_MCBPC_code[28] =
1, 0, 0, 0, /* Stuffing */
2, 12, 14, 15,
};
-const uint8_t ff_h263_inter_MCBPC_bits[28] =
-{
+const uint8_t ff_h263_inter_MCBPC_bits[28] = {
1, 4, 4, 6, /* inter */
5, 8, 8, 7, /* intra */
3, 7, 7, 9, /* interQ */
@@ -59,115 +57,109 @@ const uint8_t ff_h263_inter_MCBPC_bits[28] =
11, 13, 13, 13,/* inter4Q*/
};
-const uint8_t h263_mbtype_b_tab[15][2] =
-{
- {1, 1},
- {3, 3},
- {1, 5},
- {4, 4},
- {5, 4},
- {6, 6},
- {2, 4},
- {3, 4},
- {7, 6},
- {4, 6},
- {5, 6},
- {1, 6},
- {1, 10},
- {1, 7},
- {1, 8},
+const uint8_t h263_mbtype_b_tab[15][2] = {
+ {1, 1},
+ {3, 3},
+ {1, 5},
+ {4, 4},
+ {5, 4},
+ {6, 6},
+ {2, 4},
+ {3, 4},
+ {7, 6},
+ {4, 6},
+ {5, 6},
+ {1, 6},
+ {1,10},
+ {1, 7},
+ {1, 8},
};
-const uint8_t cbpc_b_tab[4][2] =
-{
- {0, 1},
- {2, 2},
- {7, 3},
- {6, 3},
+const uint8_t cbpc_b_tab[4][2] = {
+{0, 1},
+{2, 2},
+{7, 3},
+{6, 3},
};
const uint8_t ff_h263_cbpy_tab[16][2] =
{
- {3, 4}, {5, 5}, {4, 5}, {9, 4}, {3, 5}, {7, 4}, {2, 6}, {11, 4},
- {2, 5}, {3, 6}, {5, 4}, {10, 4}, {4, 4}, {8, 4}, {6, 4}, {3, 2}
+ {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},
+ {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}
};
const uint8_t mvtab[33][2] =
{
- {1, 1}, {1, 2}, {1, 3}, {1, 4}, {3, 6}, {5, 7}, {4, 7}, {3, 7},
- {11, 9}, {10, 9}, {9, 9}, {17, 10}, {16, 10}, {15, 10}, {14, 10}, {13, 10},
- {12, 10}, {11, 10}, {10, 10}, {9, 10}, {8, 10}, {7, 10}, {6, 10}, {5, 10},
- {4, 10}, {7, 11}, {6, 11}, {5, 11}, {4, 11}, {3, 11}, {2, 11}, {3, 12},
- {2, 12}
+ {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
+ {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10},
+ {12,10}, {11,10}, {10,10}, {9,10}, {8,10}, {7,10}, {6,10}, {5,10},
+ {4,10}, {7,11}, {6,11}, {5,11}, {4,11}, {3,11}, {2,11}, {3,12},
+ {2,12}
};
/* third non intra table */
-const uint16_t inter_vlc[103][2] =
-{
- { 0x2, 2 }, { 0xf, 4 }, { 0x15, 6 }, { 0x17, 7 },
- { 0x1f, 8 }, { 0x25, 9 }, { 0x24, 9 }, { 0x21, 10 },
- { 0x20, 10 }, { 0x7, 11 }, { 0x6, 11 }, { 0x20, 11 },
- { 0x6, 3 }, { 0x14, 6 }, { 0x1e, 8 }, { 0xf, 10 },
- { 0x21, 11 }, { 0x50, 12 }, { 0xe, 4 }, { 0x1d, 8 },
- { 0xe, 10 }, { 0x51, 12 }, { 0xd, 5 }, { 0x23, 9 },
- { 0xd, 10 }, { 0xc, 5 }, { 0x22, 9 }, { 0x52, 12 },
- { 0xb, 5 }, { 0xc, 10 }, { 0x53, 12 }, { 0x13, 6 },
- { 0xb, 10 }, { 0x54, 12 }, { 0x12, 6 }, { 0xa, 10 },
- { 0x11, 6 }, { 0x9, 10 }, { 0x10, 6 }, { 0x8, 10 },
- { 0x16, 7 }, { 0x55, 12 }, { 0x15, 7 }, { 0x14, 7 },
- { 0x1c, 8 }, { 0x1b, 8 }, { 0x21, 9 }, { 0x20, 9 },
- { 0x1f, 9 }, { 0x1e, 9 }, { 0x1d, 9 }, { 0x1c, 9 },
- { 0x1b, 9 }, { 0x1a, 9 }, { 0x22, 11 }, { 0x23, 11 },
- { 0x56, 12 }, { 0x57, 12 }, { 0x7, 4 }, { 0x19, 9 },
- { 0x5, 11 }, { 0xf, 6 }, { 0x4, 11 }, { 0xe, 6 },
- { 0xd, 6 }, { 0xc, 6 }, { 0x13, 7 }, { 0x12, 7 },
- { 0x11, 7 }, { 0x10, 7 }, { 0x1a, 8 }, { 0x19, 8 },
- { 0x18, 8 }, { 0x17, 8 }, { 0x16, 8 }, { 0x15, 8 },
- { 0x14, 8 }, { 0x13, 8 }, { 0x18, 9 }, { 0x17, 9 },
- { 0x16, 9 }, { 0x15, 9 }, { 0x14, 9 }, { 0x13, 9 },
- { 0x12, 9 }, { 0x11, 9 }, { 0x7, 10 }, { 0x6, 10 },
- { 0x5, 10 }, { 0x4, 10 }, { 0x24, 11 }, { 0x25, 11 },
- { 0x26, 11 }, { 0x27, 11 }, { 0x58, 12 }, { 0x59, 12 },
- { 0x5a, 12 }, { 0x5b, 12 }, { 0x5c, 12 }, { 0x5d, 12 },
- { 0x5e, 12 }, { 0x5f, 12 }, { 0x3, 7 },
+const uint16_t inter_vlc[103][2] = {
+{ 0x2, 2 },{ 0xf, 4 },{ 0x15, 6 },{ 0x17, 7 },
+{ 0x1f, 8 },{ 0x25, 9 },{ 0x24, 9 },{ 0x21, 10 },
+{ 0x20, 10 },{ 0x7, 11 },{ 0x6, 11 },{ 0x20, 11 },
+{ 0x6, 3 },{ 0x14, 6 },{ 0x1e, 8 },{ 0xf, 10 },
+{ 0x21, 11 },{ 0x50, 12 },{ 0xe, 4 },{ 0x1d, 8 },
+{ 0xe, 10 },{ 0x51, 12 },{ 0xd, 5 },{ 0x23, 9 },
+{ 0xd, 10 },{ 0xc, 5 },{ 0x22, 9 },{ 0x52, 12 },
+{ 0xb, 5 },{ 0xc, 10 },{ 0x53, 12 },{ 0x13, 6 },
+{ 0xb, 10 },{ 0x54, 12 },{ 0x12, 6 },{ 0xa, 10 },
+{ 0x11, 6 },{ 0x9, 10 },{ 0x10, 6 },{ 0x8, 10 },
+{ 0x16, 7 },{ 0x55, 12 },{ 0x15, 7 },{ 0x14, 7 },
+{ 0x1c, 8 },{ 0x1b, 8 },{ 0x21, 9 },{ 0x20, 9 },
+{ 0x1f, 9 },{ 0x1e, 9 },{ 0x1d, 9 },{ 0x1c, 9 },
+{ 0x1b, 9 },{ 0x1a, 9 },{ 0x22, 11 },{ 0x23, 11 },
+{ 0x56, 12 },{ 0x57, 12 },{ 0x7, 4 },{ 0x19, 9 },
+{ 0x5, 11 },{ 0xf, 6 },{ 0x4, 11 },{ 0xe, 6 },
+{ 0xd, 6 },{ 0xc, 6 },{ 0x13, 7 },{ 0x12, 7 },
+{ 0x11, 7 },{ 0x10, 7 },{ 0x1a, 8 },{ 0x19, 8 },
+{ 0x18, 8 },{ 0x17, 8 },{ 0x16, 8 },{ 0x15, 8 },
+{ 0x14, 8 },{ 0x13, 8 },{ 0x18, 9 },{ 0x17, 9 },
+{ 0x16, 9 },{ 0x15, 9 },{ 0x14, 9 },{ 0x13, 9 },
+{ 0x12, 9 },{ 0x11, 9 },{ 0x7, 10 },{ 0x6, 10 },
+{ 0x5, 10 },{ 0x4, 10 },{ 0x24, 11 },{ 0x25, 11 },
+{ 0x26, 11 },{ 0x27, 11 },{ 0x58, 12 },{ 0x59, 12 },
+{ 0x5a, 12 },{ 0x5b, 12 },{ 0x5c, 12 },{ 0x5d, 12 },
+{ 0x5e, 12 },{ 0x5f, 12 },{ 0x3, 7 },
};
-const int8_t inter_level[102] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 1, 2, 3, 4,
- 5, 6, 1, 2, 3, 4, 1, 2,
- 3, 1, 2, 3, 1, 2, 3, 1,
- 2, 3, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 3, 1, 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,
+const int8_t inter_level[102] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 1, 2, 3, 4,
+ 5, 6, 1, 2, 3, 4, 1, 2,
+ 3, 1, 2, 3, 1, 2, 3, 1,
+ 2, 3, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 3, 1, 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,
};
-const int8_t inter_run[102] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1,
- 1, 1, 2, 2, 2, 2, 3, 3,
- 3, 4, 4, 4, 5, 5, 5, 6,
- 6, 6, 7, 7, 8, 8, 9, 9,
- 10, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 0, 0, 0, 1, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40,
+const int8_t inter_run[102] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 1, 2, 2, 2, 2, 3, 3,
+ 3, 4, 4, 4, 5, 5, 5, 6,
+ 6, 6, 7, 7, 8, 8, 9, 9,
+ 10, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 0, 0, 0, 1, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40,
};
-RLTable ff_h263_rl_inter =
-{
+RLTable ff_h263_rl_inter = {
102,
58,
inter_vlc,
@@ -175,72 +167,68 @@ RLTable ff_h263_rl_inter =
inter_level,
};
-static const uint16_t intra_vlc_aic[103][2] =
-{
- { 0x2, 2 }, { 0x6, 3 }, { 0xe, 4 }, { 0xc, 5 },
- { 0xd, 5 }, { 0x10, 6 }, { 0x11, 6 }, { 0x12, 6 },
- { 0x16, 7 }, { 0x1b, 8 }, { 0x20, 9 }, { 0x21, 9 },
- { 0x1a, 9 }, { 0x1b, 9 }, { 0x1c, 9 }, { 0x1d, 9 },
- { 0x1e, 9 }, { 0x1f, 9 }, { 0x23, 11 }, { 0x22, 11 },
- { 0x57, 12 }, { 0x56, 12 }, { 0x55, 12 }, { 0x54, 12 },
- { 0x53, 12 }, { 0xf, 4 }, { 0x14, 6 }, { 0x14, 7 },
- { 0x1e, 8 }, { 0xf, 10 }, { 0x21, 11 }, { 0x50, 12 },
- { 0xb, 5 }, { 0x15, 7 }, { 0xe, 10 }, { 0x9, 10 },
- { 0x15, 6 }, { 0x1d, 8 }, { 0xd, 10 }, { 0x51, 12 },
- { 0x13, 6 }, { 0x23, 9 }, { 0x7, 11 }, { 0x17, 7 },
- { 0x22, 9 }, { 0x52, 12 }, { 0x1c, 8 }, { 0xc, 10 },
- { 0x1f, 8 }, { 0xb, 10 }, { 0x25, 9 }, { 0xa, 10 },
- { 0x24, 9 }, { 0x6, 11 }, { 0x21, 10 }, { 0x20, 10 },
- { 0x8, 10 }, { 0x20, 11 }, { 0x7, 4 }, { 0xc, 6 },
- { 0x10, 7 }, { 0x13, 8 }, { 0x11, 9 }, { 0x12, 9 },
- { 0x4, 10 }, { 0x27, 11 }, { 0x26, 11 }, { 0x5f, 12 },
- { 0xf, 6 }, { 0x13, 9 }, { 0x5, 10 }, { 0x25, 11 },
- { 0xe, 6 }, { 0x14, 9 }, { 0x24, 11 }, { 0xd, 6 },
- { 0x6, 10 }, { 0x5e, 12 }, { 0x11, 7 }, { 0x7, 10 },
- { 0x13, 7 }, { 0x5d, 12 }, { 0x12, 7 }, { 0x5c, 12 },
- { 0x14, 8 }, { 0x5b, 12 }, { 0x15, 8 }, { 0x1a, 8 },
- { 0x19, 8 }, { 0x18, 8 }, { 0x17, 8 }, { 0x16, 8 },
- { 0x19, 9 }, { 0x15, 9 }, { 0x16, 9 }, { 0x18, 9 },
- { 0x17, 9 }, { 0x4, 11 }, { 0x5, 11 }, { 0x58, 12 },
- { 0x59, 12 }, { 0x5a, 12 }, { 0x3, 7 },
+static const uint16_t intra_vlc_aic[103][2] = {
+{ 0x2, 2 }, { 0x6, 3 }, { 0xe, 4 }, { 0xc, 5 },
+{ 0xd, 5 }, { 0x10, 6 }, { 0x11, 6 }, { 0x12, 6 },
+{ 0x16, 7 }, { 0x1b, 8 }, { 0x20, 9 }, { 0x21, 9 },
+{ 0x1a, 9 }, { 0x1b, 9 }, { 0x1c, 9 }, { 0x1d, 9 },
+{ 0x1e, 9 }, { 0x1f, 9 }, { 0x23, 11 }, { 0x22, 11 },
+{ 0x57, 12 }, { 0x56, 12 }, { 0x55, 12 }, { 0x54, 12 },
+{ 0x53, 12 }, { 0xf, 4 }, { 0x14, 6 }, { 0x14, 7 },
+{ 0x1e, 8 }, { 0xf, 10 }, { 0x21, 11 }, { 0x50, 12 },
+{ 0xb, 5 }, { 0x15, 7 }, { 0xe, 10 }, { 0x9, 10 },
+{ 0x15, 6 }, { 0x1d, 8 }, { 0xd, 10 }, { 0x51, 12 },
+{ 0x13, 6 }, { 0x23, 9 }, { 0x7, 11 }, { 0x17, 7 },
+{ 0x22, 9 }, { 0x52, 12 }, { 0x1c, 8 }, { 0xc, 10 },
+{ 0x1f, 8 }, { 0xb, 10 }, { 0x25, 9 }, { 0xa, 10 },
+{ 0x24, 9 }, { 0x6, 11 }, { 0x21, 10 }, { 0x20, 10 },
+{ 0x8, 10 }, { 0x20, 11 }, { 0x7, 4 }, { 0xc, 6 },
+{ 0x10, 7 }, { 0x13, 8 }, { 0x11, 9 }, { 0x12, 9 },
+{ 0x4, 10 }, { 0x27, 11 }, { 0x26, 11 }, { 0x5f, 12 },
+{ 0xf, 6 }, { 0x13, 9 }, { 0x5, 10 }, { 0x25, 11 },
+{ 0xe, 6 }, { 0x14, 9 }, { 0x24, 11 }, { 0xd, 6 },
+{ 0x6, 10 }, { 0x5e, 12 }, { 0x11, 7 }, { 0x7, 10 },
+{ 0x13, 7 }, { 0x5d, 12 }, { 0x12, 7 }, { 0x5c, 12 },
+{ 0x14, 8 }, { 0x5b, 12 }, { 0x15, 8 }, { 0x1a, 8 },
+{ 0x19, 8 }, { 0x18, 8 }, { 0x17, 8 }, { 0x16, 8 },
+{ 0x19, 9 }, { 0x15, 9 }, { 0x16, 9 }, { 0x18, 9 },
+{ 0x17, 9 }, { 0x4, 11 }, { 0x5, 11 }, { 0x58, 12 },
+{ 0x59, 12 }, { 0x5a, 12 }, { 0x3, 7 },
};
-static const int8_t intra_run_aic[102] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 3, 3, 3, 3,
- 4, 4, 4, 5, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 11,
- 12, 13, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1,
- 2, 2, 2, 3, 3, 3, 4, 4,
- 5, 5, 6, 6, 7, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23,
+static const int8_t intra_run_aic[102] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 5, 5, 5, 6, 6,
+ 7, 7, 8, 8, 9, 9, 10, 11,
+12, 13, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1,
+ 2, 2, 2, 3, 3, 3, 4, 4,
+ 5, 5, 6, 6, 7, 7, 8, 9,
+10, 11, 12, 13, 14, 15, 16, 17,
+18, 19, 20, 21, 22, 23,
};
-static const int8_t intra_level_aic[102] =
-{
- 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, 1, 2, 3, 4, 5, 6, 7,
- 1, 2, 3, 4, 1, 2, 3, 4,
- 1, 2, 3, 1, 2, 3, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 1,
- 1, 1, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 1, 2, 3, 4,
- 1, 2, 3, 1, 2, 3, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1,
+static const int8_t intra_level_aic[102] = {
+ 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, 1, 2, 3, 4, 5, 6, 7,
+ 1, 2, 3, 4, 1, 2, 3, 4,
+ 1, 2, 3, 1, 2, 3, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 1,
+ 1, 1, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 1, 2, 3, 4,
+ 1, 2, 3, 1, 2, 3, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1,
};
-RLTable rl_intra_aic =
-{
+RLTable rl_intra_aic = {
102,
58,
intra_vlc_aic,
@@ -248,8 +236,7 @@ RLTable rl_intra_aic =
intra_level_aic,
};
-const uint16_t h263_format[8][2] =
-{
+const uint16_t h263_format[8][2] = {
{ 0, 0 },
{ 128, 96 },
{ 176, 144 },
@@ -258,62 +245,55 @@ const uint16_t h263_format[8][2] =
{ 1408, 1152 },
};
-const uint8_t ff_aic_dc_scale_table[32] =
-{
+const uint8_t ff_aic_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, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62
+ 0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
};
-const uint8_t modified_quant_tab[2][32] =
-{
+const uint8_t modified_quant_tab[2][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, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
- }, {
- 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, 26
- }
+{
+ 0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28
+},{
+ 0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26
+}
};
-const uint8_t ff_h263_chroma_qscale_table[32] =
-{
+const uint8_t ff_h263_chroma_qscale_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, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15
+ 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,14,15,15,15,15,15
};
-uint16_t ff_mba_max[6] =
-{
- 47, 98, 395, 1583, 6335, 9215
+uint16_t ff_mba_max[6]={
+ 47, 98, 395,1583,6335,9215
};
-uint8_t ff_mba_length[7] =
-{
- 6, 7, 9, 11, 13, 14, 14
+uint8_t ff_mba_length[7]={
+ 6, 7, 9, 11, 13, 14, 14
};
-const uint8_t ff_h263_loop_filter_strength[32] =
-{
+const uint8_t ff_h263_loop_filter_strength[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, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12
+ 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
};
-const AVRational ff_h263_pixel_aspect[16] =
-{
- {0, 1},
- {1, 1},
- {12, 11},
- {10, 11},
- {16, 11},
- {40, 33},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
+const AVRational ff_h263_pixel_aspect[16]={
+ {0, 1},
+ {1, 1},
+ {12, 11},
+ {10, 11},
+ {16, 11},
+ {40, 33},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
+ {0, 1},
};
#endif /* AVCODEC_H263DATA_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263dec.c
index 54b4d9b10..4313e8b4b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h263dec.c
@@ -48,21 +48,20 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->width = avctx->coded_width;
s->height = avctx->coded_height;
- s->workaround_bugs = avctx->workaround_bugs;
+ s->workaround_bugs= avctx->workaround_bugs;
// set defaults
MPV_decode_defaults(s);
- s->quant_precision = 5;
- s->decode_mb = ff_h263_decode_mb;
- s->low_delay = 1;
- avctx->pix_fmt = PIX_FMT_YUV420P; /* ffdshow custom code */
- s->unrestricted_mv = 1;
+ s->quant_precision=5;
+ s->decode_mb= ff_h263_decode_mb;
+ s->low_delay= 1;
+ avctx->pix_fmt= PIX_FMT_YUV420P; /* ffdshow custom code */
+ s->unrestricted_mv= 1;
/* select sub codec */
- switch(avctx->codec->id)
- {
+ switch(avctx->codec->id) {
case CODEC_ID_H263:
- s->unrestricted_mv = 0;
+ s->unrestricted_mv= 0;
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
break;
case CODEC_ID_MPEG4:
@@ -70,33 +69,33 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
case CODEC_ID_MSMPEG4V1:
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
- s->msmpeg4_version = 1;
+ s->msmpeg4_version=1;
break;
case CODEC_ID_MSMPEG4V2:
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
- s->msmpeg4_version = 2;
+ s->msmpeg4_version=2;
break;
case CODEC_ID_MSMPEG4V3:
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
- s->msmpeg4_version = 3;
+ s->msmpeg4_version=3;
break;
case CODEC_ID_WMV1:
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
- s->msmpeg4_version = 4;
+ s->msmpeg4_version=4;
break;
case CODEC_ID_WMV2:
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
- s->msmpeg4_version = 5;
+ s->msmpeg4_version=5;
break;
case CODEC_ID_VC1:
case CODEC_ID_WMV3:
s->h263_msmpeg4 = 1;
s->h263_pred = 1;
- s->msmpeg4_version = 6;
+ s->msmpeg4_version=6;
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
break;
case CODEC_ID_H263I:
@@ -107,14 +106,14 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
default:
return -1;
}
- s->codec_id = avctx->codec->id;
+ s->codec_id= avctx->codec->id;
/* 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 != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
+ if (MPV_common_init(s) < 0)
return -1;
- h263_decode_init_vlc(s);
+ h263_decode_init_vlc(s);
return 0;
}
@@ -130,89 +129,74 @@ av_cold int ff_h263_decode_end(AVCodecContext *avctx)
/**
* returns the number of bytes consumed for building the current frame
*/
-static int get_consumed_bytes(MpegEncContext *s, int buf_size)
-{
- int pos = (get_bits_count(&s->gb) + 7) >> 3;
+static int get_consumed_bytes(MpegEncContext *s, int buf_size){
+ int pos= (get_bits_count(&s->gb)+7)>>3;
- if(s->divx_packed)
- {
+ if(s->divx_packed){
//we would have to scan through the whole buf to handle the weird reordering ...
return buf_size;
- }
- else if(s->flags & CODEC_FLAG_TRUNCATED)
- {
+ }else if(s->flags&CODEC_FLAG_TRUNCATED){
pos -= s->parse_context.last_index;
- if(pos < 0) pos = 0; // padding is not really read so this might be -1
+ if(pos<0) pos=0; // padding is not really read so this might be -1
return pos;
- }
- else
- {
- if(pos == 0) pos = 1; //avoid infinite loops (i doubt that is needed but ...)
- if(pos + 10 > buf_size) pos = buf_size; // oops ;)
+ }else{
+ 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;
}
}
-static int decode_slice(MpegEncContext *s)
-{
- const int part_mask = s->partitioned_frame ? (AC_END | AC_ERROR) : 0x7F;
- const int mb_size = 16 >> s->avctx->lowres;
- s->last_resync_gb = s->gb;
- s->first_slice_line = 1;
+static int decode_slice(MpegEncContext *s){
+ const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
+ const int mb_size= 16>>s->avctx->lowres;
+ s->last_resync_gb= s->gb;
+ s->first_slice_line= 1;
- s->resync_mb_x = s->mb_x;
- s->resync_mb_y = s->mb_y;
+ s->resync_mb_x= s->mb_x;
+ s->resync_mb_y= s->mb_y;
ff_set_qscale(s, s->qscale);
- if(s->partitioned_frame)
- {
- const int qscale = s->qscale;
+ 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==CODEC_ID_MPEG4){
if(ff_mpeg4_decode_partitions(s) < 0)
return -1;
}
/* restore variables which were modified */
- s->first_slice_line = 1;
- s->mb_x = s->resync_mb_x;
- s->mb_y = s->resync_mb_y;
+ s->first_slice_line=1;
+ s->mb_x= s->resync_mb_x;
+ s->mb_y= s->resync_mb_y;
ff_set_qscale(s, qscale);
}
- for(; s->mb_y < s->mb_height; s->mb_y++)
- {
+ for(; s->mb_y < s->mb_height; s->mb_y++) {
/* per-row end of slice checks */
- if(s->msmpeg4_version)
- {
- if(s->resync_mb_y + s->slice_height == s->mb_y)
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, AC_END | DC_END | MV_END);
+ if(s->msmpeg4_version){
+ if(s->resync_mb_y + s->slice_height == s->mb_y){
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
return 0;
}
}
- if(s->msmpeg4_version == 1)
- {
- s->last_dc[0] =
- s->last_dc[1] =
- s->last_dc[2] = 128;
+ if(s->msmpeg4_version==1){
+ s->last_dc[0]=
+ s->last_dc[1]=
+ s->last_dc[2]= 128;
}
ff_init_block_index(s);
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
+ for(; s->mb_x < s->mb_width; s->mb_x++) {
int ret;
ff_update_block_index(s);
- if(s->resync_mb_x == s->mb_x && s->resync_mb_y + 1 == s->mb_y)
- {
- s->first_slice_line = 0;
+ if(s->resync_mb_x == s->mb_x && s->resync_mb_y+1 == s->mb_y){
+ s->first_slice_line=0;
}
/* DCT & quantize */
@@ -221,41 +205,36 @@ static int decode_slice(MpegEncContext *s)
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));
- ret = s->decode_mb(s, s->block);
+ ret= s->decode_mb(s, s->block);
- if(s->pict_type != FF_B_TYPE)
+ if (s->pict_type!=FF_B_TYPE)
ff_h263_update_motion_val(s);
- if(ret < 0)
- {
- const int xy = s->mb_x + s->mb_y * s->mb_stride;
- if(ret == SLICE_END)
- {
+ 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);
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, (AC_END | DC_END | MV_END)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
s->padding_bug_score--;
- if(++s->mb_x >= s->mb_width)
- {
- s->mb_x = 0;
- ff_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
+ if(++s->mb_x >= s->mb_width){
+ s->mb_x=0;
+ ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
s->mb_y++;
}
return 0;
- }
- else if(ret == SLICE_NOEND)
- {
+ }else if(ret==SLICE_NOEND){
av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x + 1, s->mb_y, (AC_END | DC_END | MV_END)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
@@ -265,45 +244,40 @@ static int decode_slice(MpegEncContext *s)
ff_h263_loop_filter(s);
}
- ff_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
+ ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
- s->mb_x = 0;
+ s->mb_x= 0;
}
- assert(s->mb_x == 0 && s->mb_y == s->mb_height);
+ assert(s->mb_x==0 && s->mb_y==s->mb_height);
/* try to detect the padding bug */
- if(s->codec_id == CODEC_ID_MPEG4
- && (s->workaround_bugs & FF_BUG_AUTODETECT)
- && get_bits_left(&s->gb) >= 0
+ if( s->codec_id==CODEC_ID_MPEG4
+ && (s->workaround_bugs&FF_BUG_AUTODETECT)
+ && get_bits_left(&s->gb) >=0
&& get_bits_left(&s->gb) < 48
// && !s->resync_marker
- && !s->data_partitioning)
- {
+ && !s->data_partitioning){
- const int bits_count = get_bits_count(&s->gb);
+ const int bits_count= get_bits_count(&s->gb);
const int bits_left = s->gb.size_in_bits - bits_count;
- if(bits_left == 0)
- {
- s->padding_bug_score += 16;
- }
- else if(bits_left != 1)
- {
- int v = show_bits(&s->gb, 8);
- v |= 0x7F >> (7 - (bits_count & 7));
+ if(bits_left==0){
+ s->padding_bug_score+=16;
+ } else if(bits_left != 1){
+ int v= show_bits(&s->gb, 8);
+ v|= 0x7F >> (7-(bits_count&7));
- if(v == 0x7F && bits_left <= 8)
+ if(v==0x7F && bits_left<=8)
s->padding_bug_score--;
- else if(v == 0x7F && ((get_bits_count(&s->gb) + 8) & 8) && bits_left <= 16)
- s->padding_bug_score += 4;
+ else if(v==0x7F && ((get_bits_count(&s->gb)+8)&8) && bits_left<=16)
+ s->padding_bug_score+= 4;
else
s->padding_bug_score++;
}
}
- if(s->workaround_bugs & FF_BUG_AUTODETECT)
- {
+ if(s->workaround_bugs&FF_BUG_AUTODETECT){
if(s->padding_bug_score > -2 && !s->data_partitioning /*&& (s->divx_version || !s->resync_marker)*/)
s->workaround_bugs |= FF_BUG_NO_PADDING;
else
@@ -311,66 +285,60 @@ static int decode_slice(MpegEncContext *s)
}
// handle formats which don't have unique end markers
- if(s->msmpeg4_version || (s->workaround_bugs & FF_BUG_NO_PADDING)) //FIXME perhaps solve this more cleanly
- {
- int left = get_bits_left(&s->gb);
- int max_extra = 7;
+ if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly
+ int left= get_bits_left(&s->gb);
+ int max_extra=7;
/* no markers in M$ crap */
- if(s->msmpeg4_version && s->pict_type == FF_I_TYPE)
- max_extra += 17;
+ if(s->msmpeg4_version && s->pict_type==FF_I_TYPE)
+ max_extra+= 17;
/* buggy padding but the frame should still end approximately at the bitstream end */
- if((s->workaround_bugs & FF_BUG_NO_PADDING) && s->error_recognition >= 3)
- max_extra += 48;
- else if((s->workaround_bugs & FF_BUG_NO_PADDING))
- max_extra += 256 * 256 * 256 * 64;
+ if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_recognition>=3)
+ max_extra+= 48;
+ else if((s->workaround_bugs&FF_BUG_NO_PADDING))
+ max_extra+= 256*256*256*64;
- if(left > max_extra)
- {
+ if(left>max_extra){
av_log(s->avctx, AV_LOG_ERROR, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
}
- else if(left < 0)
- {
+ else if(left<0){
av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
- }
- else
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, AC_END | DC_END | MV_END);
+ }else
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
return 0;
}
av_log(s->avctx, AV_LOG_ERROR, "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
- get_bits_left(&s->gb),
- show_bits(&s->gb, 24), s->padding_bug_score);
+ get_bits_left(&s->gb),
+ show_bits(&s->gb, 24), s->padding_bug_score);
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
int ff_h263_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
MpegEncContext *s = avctx->priv_data;
int ret;
AVFrame *pict = data;
#ifdef PRINT_FRAME_TIME
- uint64_t time = rdtsc();
+uint64_t time= rdtsc();
#endif
- s->flags = avctx->flags;
- s->flags2 = avctx->flags2;
+ s->flags= avctx->flags;
+ s->flags2= avctx->flags2;
/* no supplementary picture */
- if(buf_size == 0)
- {
+ if (buf_size == 0) {
/* special case for last picture */
- if(s->low_delay == 0 && s->next_picture_ptr)
- {
- *pict = *(AVFrame*)s->next_picture_ptr;
- s->next_picture_ptr = NULL;
+ if (s->low_delay==0 && s->next_picture_ptr) {
+ *pict= *(AVFrame*)s->next_picture_ptr;
+ s->next_picture_ptr= NULL;
*data_size = sizeof(AVFrame);
}
@@ -378,204 +346,171 @@ int ff_h263_decode_frame(AVCodecContext *avctx,
return 0;
}
- if(s->flags & CODEC_FLAG_TRUNCATED)
- {
+ if(s->flags&CODEC_FLAG_TRUNCATED){
int next;
- if(CONFIG_MPEG4_DECODER && s->codec_id == 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)
- {
- next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
- }
- else
- {
+ if(CONFIG_MPEG4_DECODER && s->codec_id==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){
+ 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");
return -1;
}
- if(ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0)
+ if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
return buf_size;
}
retry:
- if(s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) //divx 5.01+/xvid frame reorder
- {
- init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size * 8);
- }
- else
- init_get_bits(&s->gb, buf, buf_size * 8);
- s->bitstream_buffer_size = 0;
+ if(s->bitstream_buffer_size && (s->divx_packed || buf_size<20)){ //divx 5.01+/xvid frame reorder
+ init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size*8);
+ }else
+ init_get_bits(&s->gb, buf, buf_size*8);
+ 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 (!s->context_initialized) {
+ if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
return -1;
}
/* We need to set current_picture_ptr before reading the header,
* otherwise we cannot store anyting in there */
- if(s->current_picture_ptr == NULL || s->current_picture_ptr->data[0])
- {
- int i = ff_find_unused_picture(s, 0);
- s->current_picture_ptr = &s->picture[i];
+ if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
+ int i= ff_find_unused_picture(s, 0);
+ s->current_picture_ptr= &s->picture[i];
}
/* let's go :-) */
- if(CONFIG_WMV2_DECODER && s->msmpeg4_version == 5)
- {
- ret = ff_wmv2_decode_picture_header(s);
- }
- else if(CONFIG_MSMPEG4_DECODER && s->msmpeg4_version)
- {
+ 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);
- }
- else if(CONFIG_MPEG4_DECODER && s->h263_pred)
- {
- if(s->avctx->extradata_size && s->picture_number == 0)
- {
+ } else if (CONFIG_MPEG4_DECODER && s->h263_pred) {
+ if(s->avctx->extradata_size && s->picture_number==0){
GetBitContext gb;
- init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size * 8);
+ init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);
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 == CODEC_ID_H263I) {
ret = ff_intel_h263_decode_picture_header(s);
- }
- else if(CONFIG_FLV_DECODER && s->h263_flv)
- {
+ } else if (CONFIG_FLV_DECODER && s->h263_flv) {
ret = ff_flv_decode_picture_header(s);
- }
- else
- {
+ } else {
ret = h263_decode_picture_header(s);
}
- if(ret == FRAME_SKIPPED) return get_consumed_bytes(s, buf_size);
+ if(ret==FRAME_SKIPPED) return get_consumed_bytes(s, buf_size);
/* skip if the header was thrashed */
- if(ret < 0)
- {
+ if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1;
}
- avctx->has_b_frames = !s->low_delay;
+ avctx->has_b_frames= !s->low_delay;
- if(s->xvid_build == 0 && s->divx_version == 0 && s->lavc_build == 0)
- {
+ if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){
if(s->stream_codec_tag == AV_RL32("XVID") ||
s->codec_tag == AV_RL32("XVID") || s->codec_tag == AV_RL32("XVIX") ||
s->codec_tag == AV_RL32("RMP4"))
- s->xvid_build = -1;
+ s->xvid_build= -1;
#if 0
- if(s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 && s->vol_control_parameters == 1
+ if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==1
&& s->padding_bug_score > 0 && s->low_delay) // XVID with modified fourcc
- s->xvid_build = -1;
+ s->xvid_build= -1;
#endif
}
- if(s->xvid_build == 0 && s->divx_version == 0 && s->lavc_build == 0)
- {
- if(s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 && s->vol_control_parameters == 0)
- s->divx_version = 400; //divx 4
+ if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){
+ if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==0)
+ s->divx_version= 400; //divx 4
}
- if(s->xvid_build && s->divx_version)
- {
- s->divx_version =
- s->divx_build = 0;
+ if(s->xvid_build && s->divx_version){
+ s->divx_version=
+ s->divx_build= 0;
}
- if(s->workaround_bugs & FF_BUG_AUTODETECT)
- {
+ if(s->workaround_bugs&FF_BUG_AUTODETECT){
if(s->codec_tag == AV_RL32("XVIX"))
- s->workaround_bugs |= FF_BUG_XVID_ILACE;
+ s->workaround_bugs|= FF_BUG_XVID_ILACE;
- if(s->codec_tag == AV_RL32("UMP4"))
- {
- s->workaround_bugs |= FF_BUG_UMP4;
+ if(s->codec_tag == AV_RL32("UMP4")){
+ s->workaround_bugs|= FF_BUG_UMP4;
}
- if(s->divx_version >= 500 && s->divx_build < 1814)
- {
- s->workaround_bugs |= FF_BUG_QPEL_CHROMA;
+ if(s->divx_version>=500 && s->divx_build<1814){
+ s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
}
- if(s->divx_version > 502 && s->divx_build < 1814)
- {
- s->workaround_bugs |= FF_BUG_QPEL_CHROMA2;
+ if(s->divx_version>502 && s->divx_build<1814){
+ s->workaround_bugs|= FF_BUG_QPEL_CHROMA2;
}
- if(s->xvid_build && s->xvid_build <= 3)
- s->padding_bug_score = 256 * 256 * 256 * 64;
+ if(s->xvid_build && s->xvid_build<=3)
+ s->padding_bug_score= 256*256*256*64;
- if(s->xvid_build && s->xvid_build <= 1)
- s->workaround_bugs |= FF_BUG_QPEL_CHROMA;
+ if(s->xvid_build && s->xvid_build<=1)
+ s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
- if(s->xvid_build && s->xvid_build <= 12)
- s->workaround_bugs |= FF_BUG_EDGE;
+ if(s->xvid_build && s->xvid_build<=12)
+ s->workaround_bugs|= FF_BUG_EDGE;
- if(s->xvid_build && s->xvid_build <= 32)
- s->workaround_bugs |= FF_BUG_DC_CLIP;
+ if(s->xvid_build && s->xvid_build<=32)
+ s->workaround_bugs|= FF_BUG_DC_CLIP;
#define SET_QPEL_FUNC(postfix1, postfix2) \
s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\
s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\
s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
- if(s->lavc_build && s->lavc_build < 4653)
- s->workaround_bugs |= FF_BUG_STD_QPEL;
+ if(s->lavc_build && s->lavc_build<4653)
+ s->workaround_bugs|= FF_BUG_STD_QPEL;
- if(s->lavc_build && s->lavc_build < 4655)
- s->workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
+ if(s->lavc_build && s->lavc_build<4655)
+ s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;
- if(s->lavc_build && s->lavc_build < 4670)
- {
- s->workaround_bugs |= FF_BUG_EDGE;
+ if(s->lavc_build && s->lavc_build<4670){
+ s->workaround_bugs|= FF_BUG_EDGE;
}
- if(s->lavc_build && s->lavc_build <= 4712)
- s->workaround_bugs |= FF_BUG_DC_CLIP;
+ if(s->lavc_build && s->lavc_build<=4712)
+ s->workaround_bugs|= FF_BUG_DC_CLIP;
if(s->divx_version)
- s->workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
+ 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;
+ if(s->divx_version==501 && s->divx_build==20020416)
+ s->padding_bug_score= 256*256*256*64;
- if(s->divx_version && s->divx_version < 500)
- {
- s->workaround_bugs |= FF_BUG_EDGE;
+ if(s->divx_version && s->divx_version<500){
+ s->workaround_bugs|= FF_BUG_EDGE;
}
if(s->divx_version)
- s->workaround_bugs |= FF_BUG_HPEL_CHROMA;
+ s->workaround_bugs|= FF_BUG_HPEL_CHROMA;
#if 0
- if(s->divx_version == 500)
- s->padding_bug_score = 256 * 256 * 256 * 64;
+ if(s->divx_version==500)
+ s->padding_bug_score= 256*256*256*64;
/* very ugly XVID padding bug detection FIXME/XXX solve this differently
* Let us hope this at least works.
*/
- if(s->resync_marker == 0 && s->data_partitioning == 0 && s->divx_version == 0
- && s->codec_id == CODEC_ID_MPEG4 && s->vo_type == 0)
- s->workaround_bugs |= FF_BUG_NO_PADDING;
+ if( s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==0
+ && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0)
+ s->workaround_bugs|= FF_BUG_NO_PADDING;
- if(s->lavc_build && s->lavc_build < 4609) //FIXME not sure about the version num but a 4609 file seems ok
- s->workaround_bugs |= FF_BUG_NO_PADDING;
+ if(s->lavc_build && s->lavc_build<4609) //FIXME not sure about the version num but a 4609 file seems ok
+ s->workaround_bugs|= FF_BUG_NO_PADDING;
#endif
}
- if(s->workaround_bugs & FF_BUG_STD_QPEL)
- {
+ if(s->workaround_bugs& FF_BUG_STD_QPEL){
SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_old_c)
SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_old_c)
SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_old_c)
@@ -597,84 +532,75 @@ retry:
s->divx_packed ? "p" : "");
#if 0 // dump bits per frame / qp / complexity
- {
- static FILE *f = NULL;
- if(!f) f = fopen("rate_qp_cplx.txt", "w");
- fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale);
- }
+{
+ static FILE *f=NULL;
+ if(!f) f=fopen("rate_qp_cplx.txt", "w");
+ fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale);
+}
#endif
#if HAVE_MMX
- if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build && avctx->idct_algo == FF_IDCT_AUTO && (mm_flags & FF_MM_MMX))
- {
- avctx->idct_algo = FF_IDCT_XVIDMMX;
- avctx->coded_width = 0; // force reinit
+ if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build && avctx->idct_algo == FF_IDCT_AUTO && (mm_flags & FF_MM_MMX)){
+ avctx->idct_algo= FF_IDCT_XVIDMMX;
+ avctx->coded_width= 0; // force reinit
// dsputil_init(&s->dsp, avctx);
- s->picture_number = 0;
+ s->picture_number=0;
}
#endif
- /* After H263 & mpeg4 header decode we have the height, width,*/
- /* and other parameters. So then we could init the picture */
- /* FIXME: By the way H263 decoder is evolving it should have */
- /* an H263EncContext */
+ /* After H263 & mpeg4 header decode we have the height, width,*/
+ /* and other parameters. So then we could init the picture */
+ /* FIXME: By the way H263 decoder is evolving it should have */
+ /* an H263EncContext */
- if(s->width != avctx->coded_width
- || s->height != avctx->coded_height)
- {
+ if ( s->width != avctx->coded_width
+ || s->height != avctx->coded_height) {
/* H.263 could change picture size any time */
- ParseContext pc = s->parse_context; //FIXME move these demuxng hack to avformat
- s->parse_context.buffer = 0;
+ ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
+ s->parse_context.buffer=0;
MPV_common_end(s);
- s->parse_context = pc;
+ s->parse_context= pc;
}
- if(!s->context_initialized)
- {
+ 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->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I))
s->gob_index = ff_h263_get_gob_height(s);
// for hurry_up==5
- s->current_picture.pict_type = s->pict_type;
- s->current_picture.key_frame = s->pict_type == FF_I_TYPE;
+ s->current_picture.pict_type= s->pict_type;
+ s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
/* skip B-frames if we don't have reference frames */
- if(s->last_picture_ptr == NULL && (s->pict_type == FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
+ if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
/* skip b frames if we are in a hurry */
- if(avctx->hurry_up && s->pict_type == FF_B_TYPE) return get_consumed_bytes(s, buf_size);
- if((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
+ if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
+ || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
return get_consumed_bytes(s, buf_size);
/* skip everything if we are in a hurry>=5 */
- if(avctx->hurry_up >= 5) return get_consumed_bytes(s, buf_size);
+ if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
- if(s->next_p_frame_damaged)
- {
- if(s->pict_type == FF_B_TYPE)
+ if(s->next_p_frame_damaged){
+ if(s->pict_type==FF_B_TYPE)
return get_consumed_bytes(s, buf_size);
else
- s->next_p_frame_damaged = 0;
+ s->next_p_frame_damaged=0;
}
- if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type == FF_B_TYPE)
- {
- s->me.qpel_put = s->dsp.put_2tap_qpel_pixels_tab;
- s->me.qpel_avg = s->dsp.avg_2tap_qpel_pixels_tab;
- }
- else if((!s->no_rounding) || s->pict_type == FF_B_TYPE)
- {
- s->me.qpel_put = s->dsp.put_qpel_pixels_tab;
- s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;
- }
- else
- {
- s->me.qpel_put = s->dsp.put_no_rnd_qpel_pixels_tab;
- s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;
+ if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type==FF_B_TYPE){
+ s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab;
+ s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab;
+ }else if((!s->no_rounding) || s->pict_type==FF_B_TYPE){
+ s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
+ s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
+ }else{
+ s->me.qpel_put= s->dsp.put_no_rnd_qpel_pixels_tab;
+ s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
}
if(MPV_frame_start(s, avctx) < 0)
@@ -684,78 +610,66 @@ retry:
//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()
- if(CONFIG_WMV2_DECODER && s->msmpeg4_version == 5)
- {
+ if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5){
ret = ff_wmv2_decode_secondary_picture_header(s);
- if(ret < 0) return ret;
- if(ret == 1) goto intrax8_decoded;
+ if(ret<0) return ret;
+ if(ret==1) goto intrax8_decoded;
}
/* decode each macroblock */
- s->mb_x = 0;
- s->mb_y = 0;
+ s->mb_x=0;
+ s->mb_y=0;
decode_slice(s);
- while(s->mb_y < s->mb_height)
- {
- if(s->msmpeg4_version)
- {
- if(s->slice_height == 0 || s->mb_x != 0 || (s->mb_y % s->slice_height) != 0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
+ while(s->mb_y<s->mb_height){
+ if(s->msmpeg4_version){
+ if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
break;
- }
- else
- {
- if(ff_h263_resync(s) < 0)
+ }else{
+ if(ff_h263_resync(s)<0)
break;
}
- if(s->msmpeg4_version < 4 && s->h263_pred)
+ if(s->msmpeg4_version<4 && s->h263_pred)
ff_mpeg4_clean_buffers(s);
decode_slice(s);
}
- if(s->h263_msmpeg4 && s->msmpeg4_version < 4 && s->pict_type == FF_I_TYPE)
- if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0)
- {
- s->error_status_table[s->mb_num-1] = AC_ERROR | DC_ERROR | MV_ERROR;
+ if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==FF_I_TYPE)
+ if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
+ s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR;
}
- assert(s->bitstream_buffer_size == 0);
+ assert(s->bitstream_buffer_size==0);
/* divx 5.01+ bistream reorder stuff */
- if(s->codec_id == CODEC_ID_MPEG4 && s->divx_packed)
- {
- int current_pos = get_bits_count(&s->gb) >> 3;
- int startcode_found = 0;
+ if(s->codec_id==CODEC_ID_MPEG4 && s->divx_packed){
+ int current_pos= get_bits_count(&s->gb)>>3;
+ int startcode_found=0;
- if(buf_size - current_pos > 5)
- {
+ if(buf_size - current_pos > 5){
int i;
- for(i = current_pos; i < buf_size - 3; i++)
- {
- if(buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 1 && buf[i+3] == 0xB6)
- {
- startcode_found = 1;
+ for(i=current_pos; i<buf_size-3; i++){
+ if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
+ startcode_found=1;
break;
}
}
}
- if(s->gb.buffer == s->bitstream_buffer && buf_size > 7 && s->xvid_build) //xvid style
- {
- startcode_found = 1;
- current_pos = 0;
+ if(s->gb.buffer == s->bitstream_buffer && buf_size>7 && s->xvid_build){ //xvid style
+ startcode_found=1;
+ current_pos=0;
}
- if(startcode_found)
- {
+ if(startcode_found){
av_fast_malloc(
&s->bitstream_buffer,
&s->allocated_bitstream_buffer_size,
buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE);
- if(!s->bitstream_buffer)
+ if (!s->bitstream_buffer)
return AVERROR(ENOMEM);
memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
- s->bitstream_buffer_size = buf_size - current_pos;
+ s->bitstream_buffer_size= buf_size - current_pos;
}
}
@@ -765,32 +679,27 @@ intrax8_decoded:
frame_end:
MPV_frame_end(s);
- assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
- assert(s->current_picture.pict_type == s->pict_type);
- if(s->pict_type == FF_B_TYPE || s->low_delay)
- {
- *pict = *(AVFrame*)s->current_picture_ptr;
- }
- else if(s->last_picture_ptr != NULL)
- {
- *pict = *(AVFrame*)s->last_picture_ptr;
+assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
+assert(s->current_picture.pict_type == s->pict_type);
+ if (s->pict_type == FF_B_TYPE || s->low_delay) {
+ *pict= *(AVFrame*)s->current_picture_ptr;
+ } else if (s->last_picture_ptr != NULL) {
+ *pict= *(AVFrame*)s->last_picture_ptr;
}
- if(s->last_picture_ptr || s->low_delay)
- {
+ if(s->last_picture_ptr || s->low_delay){
*data_size = sizeof(AVFrame);
ff_print_debug_info(s, pict);
}
#ifdef PRINT_FRAME_TIME
- av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc() - time);
+av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
#endif
return get_consumed_bytes(s, buf_size);
}
-AVCodec h263_decoder =
-{
+AVCodec h263_decoder = {
"h263",
CODEC_TYPE_VIDEO,
CODEC_ID_H263,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c
index e230fc8cf..3490e3af1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c
@@ -42,72 +42,57 @@
//#undef NDEBUG
#include <assert.h>
-static const uint8_t rem6[52] =
-{
- 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 rem6[52]={
+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[52] =
-{
- 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,
+static const uint8_t div6[52]={
+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,
};
-void ff_h264_write_back_intra_pred_mode(H264Context *h)
-{
- const int mb_xy = h->mb_xy;
-
- h->intra4x4_pred_mode[mb_xy][0] = h->intra4x4_pred_mode_cache[7+8*1];
- h->intra4x4_pred_mode[mb_xy][1] = h->intra4x4_pred_mode_cache[7+8*2];
- h->intra4x4_pred_mode[mb_xy][2] = h->intra4x4_pred_mode_cache[7+8*3];
- h->intra4x4_pred_mode[mb_xy][3] = h->intra4x4_pred_mode_cache[7+8*4];
- h->intra4x4_pred_mode[mb_xy][4] = h->intra4x4_pred_mode_cache[4+8*4];
- h->intra4x4_pred_mode[mb_xy][5] = h->intra4x4_pred_mode_cache[5+8*4];
- h->intra4x4_pred_mode[mb_xy][6] = h->intra4x4_pred_mode_cache[6+8*4];
+void ff_h264_write_back_intra_pred_mode(H264Context *h){
+ const int mb_xy= h->mb_xy;
+
+ h->intra4x4_pred_mode[mb_xy][0]= h->intra4x4_pred_mode_cache[7+8*1];
+ h->intra4x4_pred_mode[mb_xy][1]= h->intra4x4_pred_mode_cache[7+8*2];
+ h->intra4x4_pred_mode[mb_xy][2]= h->intra4x4_pred_mode_cache[7+8*3];
+ h->intra4x4_pred_mode[mb_xy][3]= h->intra4x4_pred_mode_cache[7+8*4];
+ h->intra4x4_pred_mode[mb_xy][4]= h->intra4x4_pred_mode_cache[4+8*4];
+ h->intra4x4_pred_mode[mb_xy][5]= h->intra4x4_pred_mode_cache[5+8*4];
+ h->intra4x4_pred_mode[mb_xy][6]= h->intra4x4_pred_mode_cache[6+8*4];
}
/**
* checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
*/
-int ff_h264_check_intra4x4_pred_mode(H264Context *h)
-{
+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};
+ 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)
- {
+ 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)
- {
+ 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;
}
}
}
@@ -119,37 +104,30 @@ int ff_h264_check_intra4x4_pred_mode(H264Context *h)
/**
* checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
*/
-int ff_h264_check_intra_pred_mode(H264Context *h, int mode)
-{
+int ff_h264_check_intra_pred_mode(H264Context *h, int mode){
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};
+ 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)
- {
+ 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)
- {
+ 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(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(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)
- {
+ 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;
}
@@ -158,122 +136,105 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode)
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;
+ h->nal_ref_idc= src[0]>>5;
+ h->nal_unit_type= src[0]&0x1F;
- src++;
- length--;
+ src++; length--;
#if 0
- for(i = 0; i < length; i++)
+ for(i=0; i<length; i++)
printf("%2X ", src[i]);
#endif
#if HAVE_FAST_UNALIGNED
# if HAVE_FAST_64BIT
# define RS 7
- for(i = 0; i + 1 < length; i += 9)
- {
- if(!((~*(const uint64_t*)(src + i) & (*(const uint64_t*)(src + i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
+ for(i=0; i+1<length; i+=9){
+ if(!((~*(const uint64_t*)(src+i) & (*(const uint64_t*)(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
# else
# define RS 3
- for(i = 0; i + 1 < length; i += 5)
- {
- if(!((~*(const uint32_t*)(src + i) & (*(const uint32_t*)(src + i) - 0x01000101U)) & 0x80008080U))
+ for(i=0; i+1<length; i+=5){
+ if(!((~*(const uint32_t*)(src+i) & (*(const uint32_t*)(src+i) - 0x01000101U)) & 0x80008080U))
# endif
continue;
- if(i > 0 && !src[i]) i--;
+ if(i>0 && !src[i]) i--;
while(src[i]) i++;
#else
# define RS 0
- for(i = 0; i + 1 < length; i += 2)
- {
+ for(i=0; i+1<length; i+=2){
if(src[i]) continue;
- if(i > 0 && src[i-1] == 0) i--;
+ if(i>0 && src[i-1]==0) i--;
#endif
- if(i + 2 < length && src[i+1] == 0 && src[i+2] <= 3)
- {
- if(src[i+2] != 3)
- {
+ 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;
+ length=i;
}
break;
}
- i -= RS;
+ i-= RS;
}
- 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];
+ 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)
- {
+ 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;
+ 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
+ *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;
}
-int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src)
-{
- int v = *src;
+int ff_h264_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;
}
@@ -282,194 +243,179 @@ int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src)
* IDCT transforms the 16 dc values and dequantizes them.
* @param qp quantization parameter
*/
-static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul)
-{
+static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){
#define stride 16
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};
+ 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};
//memset(block, 64, 2*256);
//return;
- 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) * qmul + 128) >> 8)); //FIXME think about merging this into decode_residual
- block[stride*2 +offset] = ((((z1 + z2) * qmul + 128) >> 8));
- block[stride*8 +offset] = ((((z1 - z2) * qmul + 128) >> 8));
- block[stride*10+offset] = ((((z0 - z3) * qmul + 128) >> 8));
+ 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)*qmul + 128 ) >> 8)); //FIXME think about merging this into decode_residual
+ block[stride*2 +offset]= ((((z1 + z2)*qmul + 128 ) >> 8));
+ block[stride*8 +offset]= ((((z1 - z2)*qmul + 128 ) >> 8));
+ block[stride*10+offset]= ((((z0 - z3)*qmul + 128 ) >> 8));
}
}
#undef xStride
#undef stride
-static void chroma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul)
-{
- 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) * qmul) >> 7;
- block[stride*0 + xStride*1] = ((e + b) * qmul) >> 7;
- block[stride*1 + xStride*0] = ((a - c) * qmul) >> 7;
- block[stride*1 + xStride*1] = ((e - b) * qmul) >> 7;
+static void chroma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){
+ 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)*qmul) >> 7;
+ block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;
+ block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;
+ block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;
}
static inline void mc_dir_part(H264Context *h, Picture *pic, int n, 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)
-{
+ 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){
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);
- uint8_t * src_y = pic->data[0] + (mx >> 2) + (my >> 2) * h->mb_linesize;
+ 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);
+ uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->mb_linesize;
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;
-
- if(mx & 7) extra_width -= 3;
- if(my & 7) extra_height -= 3;
-
- if(full_mx < 0 - extra_width
- || full_my < 0 - extra_height
+ 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;
+
+ 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)
- {
- ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 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 + 2 * h->mb_linesize;
- emu = 1;
+ || full_my + 16/*FIXME*/ > pic_height + extra_height){
+ ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 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 + 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(!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(MB_FIELD)
- {
+ if(MB_FIELD){
// chroma offset when predicting from a field of opposite parity
my += 2 * ((s->mb_y & 1) - (pic->reference - 1));
- emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
+ emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1);
}
- src_cb = pic->data[1] + (mx >> 3) + (my >> 3) * h->mb_uvlinesize;
- src_cr = pic->data[2] + (mx >> 3) + (my >> 3) * h->mb_uvlinesize;
+ src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->mb_uvlinesize;
+ src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize;
- if(emu)
- {
- ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx >> 3), (my >> 3), pic_width >> 1, pic_height >> 1);
- src_cb = s->edge_emu_buffer;
+ if(emu){
+ ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
+ src_cb= s->edge_emu_buffer;
}
- chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx & 7, my & 7);
+ chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7);
- if(emu)
- {
- ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx >> 3), (my >> 3), pic_width >> 1, pic_height >> 1);
- src_cr = s->edge_emu_buffer;
+ if(emu){
+ ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
+ src_cr= s->edge_emu_buffer;
}
- chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx & 7, my & 7);
+ chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7);
}
static inline void mc_part_std(H264Context *h, int n, 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,
- int list0, int list1)
-{
+ 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){
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 + 2 * y_offset * h-> mb_linesize;
- dest_cb += x_offset + y_offset * h->mb_uvlinesize;
- dest_cr += x_offset + y_offset * h->mb_uvlinesize;
- 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] ] ];
+ qpel_mc_func *qpix_op= qpix_put;
+ h264_chroma_mc_func chroma_op= chroma_put;
+
+ dest_y += 2*x_offset + 2*y_offset*h-> mb_linesize;
+ dest_cb += x_offset + y_offset*h->mb_uvlinesize;
+ dest_cr += x_offset + y_offset*h->mb_uvlinesize;
+ 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] ] ];
mc_dir_part(h, ref, n, square, chroma_height, delta, 0,
- dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_op, chroma_op);
+ dest_y, dest_cb, dest_cr, x_offset, y_offset,
+ qpix_op, chroma_op);
- 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, chroma_height, delta, 1,
- dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_op, chroma_op);
+ dest_y, dest_cb, dest_cr, x_offset, y_offset,
+ qpix_op, chroma_op);
}
}
static inline void mc_part_weighted(H264Context *h, int n, 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,
- 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)
-{
+ 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){
MpegEncContext * const s = &h->s;
- dest_y += 2 * x_offset + 2 * y_offset * h-> mb_linesize;
- dest_cb += x_offset + y_offset * h->mb_uvlinesize;
- dest_cr += x_offset + y_offset * h->mb_uvlinesize;
- x_offset += 8 * s->mb_x;
- y_offset += 8 * (s->mb_y >> MB_FIELD);
+ dest_y += 2*x_offset + 2*y_offset*h-> mb_linesize;
+ dest_cb += x_offset + y_offset*h->mb_uvlinesize;
+ dest_cr += x_offset + y_offset*h->mb_uvlinesize;
+ 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 + 8;
- uint8_t *tmp_y = s->obmc_scratchpad + 8 * h->mb_uvlinesize;
+ uint8_t *tmp_y = s->obmc_scratchpad + 8*h->mb_uvlinesize;
int refn0 = h->ref_cache[0][ scan8[n] ];
int refn1 = h->ref_cache[1][ scan8[n] ];
@@ -480,40 +426,34 @@ static inline void mc_part_weighted(H264Context *h, int n, int square, int chrom
tmp_y, tmp_cb, tmp_cr,
x_offset, y_offset, qpix_put, chroma_put);
- if(h->use_weight == 2)
- {
+ if(h->use_weight == 2){
int weight0 = h->implicit_weight[refn0][refn1];
int weight1 = 64 - weight0;
- luma_weight_avg(dest_y, tmp_y, h-> mb_linesize, 5, weight0, weight1, 0);
+ luma_weight_avg( dest_y, tmp_y, h-> mb_linesize, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, 5, weight0, weight1, 0);
- }
- else
- {
+ }else{
luma_weight_avg(dest_y, tmp_y, h->mb_linesize, h->luma_log2_weight_denom,
h->luma_weight[0][refn0], h->luma_weight[1][refn1],
h->luma_offset[0][refn0] + h->luma_offset[1][refn1]);
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom,
- h->chroma_weight[0][refn0][0], h->chroma_weight[1][refn1][0],
- h->chroma_offset[0][refn0][0] + h->chroma_offset[1][refn1][0]);
+ h->chroma_weight[0][refn0][0], h->chroma_weight[1][refn1][0],
+ h->chroma_offset[0][refn0][0] + h->chroma_offset[1][refn1][0]);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom,
- h->chroma_weight[0][refn0][1], h->chroma_weight[1][refn1][1],
- h->chroma_offset[0][refn0][1] + h->chroma_offset[1][refn1][1]);
+ h->chroma_weight[0][refn0][1], h->chroma_weight[1][refn1][1],
+ h->chroma_offset[0][refn0][1] + h->chroma_offset[1][refn1][1]);
}
- }
- else
- {
+ }else{
int list = list1 ? 1 : 0;
int refn = h->ref_cache[list][ scan8[n] ];
- Picture *ref = &h->ref_list[list][refn];
+ Picture *ref= &h->ref_list[list][refn];
mc_dir_part(h, ref, n, square, chroma_height, delta, list,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_put, chroma_put);
luma_weight_op(dest_y, h->mb_linesize, h->luma_log2_weight_denom,
h->luma_weight[list][refn], h->luma_offset[list][refn]);
- if(h->use_weight_chroma)
- {
+ if(h->use_weight_chroma){
chroma_weight_op(dest_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom,
h->chroma_weight[list][refn][0], h->chroma_offset[list][refn][0]);
chroma_weight_op(dest_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom,
@@ -528,11 +468,10 @@ static inline void mc_part(H264Context *h, int n, int square, int chroma_height,
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
+ 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]] ] != 32))
- || h->use_weight == 1)
+ || h->use_weight==1)
mc_part_weighted(h, n, square, chroma_height, delta, dest_y, dest_cb, dest_cr,
x_offset, y_offset, qpix_put, chroma_put,
weight_op[0], weight_op[3], weight_avg[0], weight_avg[3], list0, list1);
@@ -541,46 +480,40 @@ static inline void mc_part(H264Context *h, int n, int square, int chroma_height,
x_offset, y_offset, qpix_put, chroma_put, qpix_avg, chroma_avg, list0, list1);
}
-static inline void prefetch_motion(H264Context *h, int list)
-{
+static inline void prefetch_motion(H264Context *h, int list){
/* fetch pixels for estimated mv 4 macroblocks ahead
* optimized for 64byte cache lines */
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;
- uint8_t **src = h->ref_list[list][refn].data;
- int off = mx + (my + (s->mb_x & 3) * 4) * h->mb_linesize + 64;
- s->dsp.prefetch(src[0] + off, s->linesize, 4);
- off = (mx >> 1) + ((my >> 1) + (s->mb_x & 7)) * s->uvlinesize + 64;
- s->dsp.prefetch(src[1] + off, src[2] - src[1], 2);
+ 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].data;
+ int off= mx + (my + (s->mb_x&3)*4)*h->mb_linesize + 64;
+ s->dsp.prefetch(src[0]+off, s->linesize, 4);
+ off= (mx>>1) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + 64;
+ s->dsp.prefetch(src[1]+off, src[2]-src[1], 2);
}
}
static 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)
-{
+ 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.mb_type[mb_xy];
+ const int mb_xy= h->mb_xy;
+ const int mb_type= s->current_picture.mb_type[mb_xy];
assert(IS_INTER(mb_type));
prefetch_motion(h, 0);
- if(IS_16X16(mb_type))
- {
+ if(IS_16X16(mb_type)){
mc_part(h, 0, 1, 8, 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))
- {
+ }else if(IS_16X8(mb_type)){
mc_part(h, 0, 0, 4, 8, dest_y, dest_cb, dest_cr, 0, 0,
qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
&weight_op[1], &weight_avg[1],
@@ -589,72 +522,59 @@ static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
&weight_op[1], &weight_avg[1],
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
- }
- else if(IS_8X16(mb_type))
- {
- mc_part(h, 0, 0, 8, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
+ }else if(IS_8X16(mb_type)){
+ mc_part(h, 0, 0, 8, 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[2], &weight_avg[2],
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
- mc_part(h, 4, 0, 8, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
+ mc_part(h, 4, 0, 8, 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[2], &weight_avg[2],
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
- }
- else
- {
+ }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;
+ 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))
- {
+ if(IS_SUB_8X8(sub_mb_type)){
mc_part(h, n, 1, 4, 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[3], &weight_avg[3],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
- }
- else if(IS_SUB_8X4(sub_mb_type))
- {
+ qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
+ &weight_op[3], &weight_avg[3],
+ 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, 2, 4, dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
- &weight_op[4], &weight_avg[4],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
- mc_part(h, n + 2, 0, 2, 4, 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[4], &weight_avg[4],
- 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, 4, 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[5], &weight_avg[5],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
- mc_part(h, n + 1, 0, 4, 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[5], &weight_avg[5],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
- }
- else
- {
+ qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
+ &weight_op[4], &weight_avg[4],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ mc_part(h, n+2, 0, 2, 4, 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[4], &weight_avg[4],
+ 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, 4, 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[5], &weight_avg[5],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ mc_part(h, n+1, 0, 4, 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[5], &weight_avg[5],
+ 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, 2, 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[6], &weight_avg[6],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ 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, 2, 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[6], &weight_avg[6],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
}
}
}
@@ -664,8 +584,7 @@ static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
}
-static void free_tables(H264Context *h)
-{
+static void free_tables(H264Context *h){
int i;
H264Context *hx;
av_freep(&h->intra4x4_pred_mode);
@@ -676,14 +595,13 @@ static void free_tables(H264Context *h)
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->mb2b8_xy);
- for(i = 0; i < MAX_THREADS; i++)
- {
+ for(i = 0; i < MAX_THREADS; i++) {
hx = h->thread_context[i];
if(!hx) continue;
av_freep(&hx->top_borders[1]);
@@ -693,119 +611,105 @@ static void free_tables(H264Context *h)
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, q, x;
+static void init_dequant8_coeff_table(H264Context *h){
+ int i,q,x;
const int transpose = (h->s.dsp.h264_idct8_add != ff_h264_idct8_add_c); //FIXME ugly
h->dequant8_coeff[0] = h->dequant8_buffer[0];
h->dequant8_coeff[1] = h->dequant8_buffer[1];
- for(i = 0; i < 2; i++)
- {
- if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64 * sizeof(uint8_t)))
- {
+ for(i=0; i<2; i++ ){
+ if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){
h->dequant8_coeff[1] = h->dequant8_buffer[0];
break;
}
- for(q = 0; q < 52; q++)
- {
+ for(q=0; q<52; q++){
int shift = div6[q];
int idx = rem6[q];
- for(x = 0; x < 64; x++)
+ for(x=0; x<64; x++)
h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] =
((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] *
- h->pps.scaling_matrix8[i][x]) << shift;
+ h->pps.scaling_matrix8[i][x]) << shift;
}
}
}
-static void init_dequant4_coeff_table(H264Context *h)
-{
- int i, j, q, x;
+static void init_dequant4_coeff_table(H264Context *h){
+ int i,j,q,x;
const int transpose = (h->s.dsp.h264_idct_add != ff_h264_idct_add_c); //FIXME ugly
- for(i = 0; i < 6; i++)
- {
+ 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 < 52; q++)
- {
+ for(q=0; q<52; q++){
int shift = div6[q] + 2;
int idx = rem6[q];
- for(x = 0; x < 16; x++)
+ for(x=0; x<16; x++)
h->dequant4_coeff[i][q][transpose ? (x>>2)|((x<<2)&0xF) : x] =
((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] *
- h->pps.scaling_matrix4[i][x]) << shift;
+ 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)
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->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 < 2; i++)
- for(x = 0; x < 64; x++)
- h->dequant8_coeff[i][0][x] = 1 << 6;
+ for(i=0; i<2; i++)
+ for(x=0; x<64; x++)
+ h->dequant8_coeff[i][0][x] = 1<<6;
}
}
-int ff_h264_alloc_tables(H264Context *h)
-{
+int ff_h264_alloc_tables(H264Context *h){
MpegEncContext * const s = &h->s;
- const int big_mb_num = s->mb_stride * (s->mb_height + 1);
- int x, y;
+ const int big_mb_num= s->mb_stride * (s->mb_height+1);
+ int x,y;
FF_ALLOCZ_OR_GOTO(h->s.avctx, h->intra4x4_pred_mode, big_mb_num * 8 * sizeof(uint8_t), fail)
FF_ALLOCZ_OR_GOTO(h->s.avctx, h->non_zero_count , big_mb_num * 32 * 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->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], 32 * big_mb_num * sizeof(uint16_t), fail);
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[1], 32 * big_mb_num * sizeof(uint16_t), fail);
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->direct_table, 32 * big_mb_num * sizeof(uint8_t) , fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[0], 32*big_mb_num * sizeof(uint16_t), fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[1], 32*big_mb_num * sizeof(uint16_t), fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->direct_table, 32*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;
+ 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->mb2b8_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;
- const int b8_xy = 2 * x + 2 * y * h->b8_stride;
+ 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;
+ const int b8_xy= 2*x + 2*y*h->b8_stride;
- h->mb2b_xy [mb_xy] = b_xy;
- h->mb2b8_xy[mb_xy] = b8_xy;
+ h->mb2b_xy [mb_xy]= b_xy;
+ h->mb2b8_xy[mb_xy]= b8_xy;
}
}
@@ -823,8 +727,7 @@ fail:
/**
* Mimic alloc_tables(), but for every context thread.
*/
-static void clone_tables(H264Context *dst, H264Context *src)
-{
+static void clone_tables(H264Context *dst, H264Context *src){
dst->intra4x4_pred_mode = src->intra4x4_pred_mode;
dst->non_zero_count = src->non_zero_count;
dst->slice_table = src->slice_table;
@@ -845,53 +748,46 @@ static void clone_tables(H264Context *dst, H264Context *src)
* 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 + 8 + 8) * sizeof(uint8_t), fail)
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[1], h->s.mb_width *(16 + 8 + 8) * sizeof(uint8_t), fail)
+static int context_init(H264Context *h){
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[0], h->s.mb_width * (16+8+8) * sizeof(uint8_t), fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[1], h->s.mb_width * (16+8+8) * sizeof(uint8_t), fail)
return 0;
fail:
return -1; // free_tables will clean up for us
}
-static av_cold void common_init(H264Context *h)
-{
+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->codec_id= s->avctx->codec->id;
ff_h264_pred_init(&h->hpc, s->codec_id);
- h->dequant_coeff_pps = -1;
- s->unrestricted_mv = 1;
- s->decode = 1; //FIXME
+ h->dequant_coeff_pps= -1;
+ s->unrestricted_mv=1;
+ s->decode=1; //FIXME
dsputil_init(&s->dsp, s->avctx); // needed so that idct permutation is known early
- 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));
}
// ffdshow custom code - adapted for DirectShow
-av_cold int avcodec_h264_decode_init_is_avc(AVCodecContext *avctx)
-{
+av_cold int avcodec_h264_decode_init_is_avc(AVCodecContext *avctx){
if(avctx->extradata_size > 0 && avctx->extradata &&
- (*(char *)avctx->extradata == 1 || (avctx->codec_tag == 0x31637661 || avctx->codec_tag == 0x31435641)))
- {
+ (*(char *)avctx->extradata == 1 || (avctx->codec_tag == 0x31637661 || avctx->codec_tag == 0x31435641))){
return 1;
- }
- else
- {
+ } else {
return 0;
}
}
-av_cold int ff_h264_decode_init(AVCodecContext *avctx)
-{
- H264Context *h = avctx->priv_data;
+av_cold int ff_h264_decode_init(AVCodecContext *avctx){
+ H264Context *h= avctx->priv_data;
MpegEncContext * const s = &h->s;
MPV_decode_defaults(s);
@@ -900,19 +796,19 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
common_init(h);
s->out_format = FMT_H264;
- s->workaround_bugs = avctx->workaround_bugs;
+ s->workaround_bugs= avctx->workaround_bugs;
// set defaults
// s->decode_mb= ff_h263_decode_mb;
s->quarter_sample = 1;
if(!avctx->has_b_frames)
- s->low_delay = 1;
+ s->low_delay= 1;
/* ffdshow custom code (begin) */
if(avctx->codec_id == CODEC_ID_SVQ3)
- avctx->pix_fmt = PIX_FMT_YUVJ420P;
+ avctx->pix_fmt= PIX_FMT_YUVJ420P;
else
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt= PIX_FMT_YUV420P;
/* ffdshow custom code (end) */
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
@@ -925,13 +821,12 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
h->thread_context[0] = h;
h->outputed_poc = INT_MIN;
- h->prev_poc_msb = 1 << 16;
+ h->prev_poc_msb= 1<<16;
ff_h264_reset_sei(h);
return 0;
}
-int ff_h264_frame_start(H264Context *h)
-{
+int ff_h264_frame_start(H264Context *h){
MpegEncContext * const s = &h->s;
int i;
@@ -944,33 +839,31 @@ int ff_h264_frame_start(H264Context *h)
* Zero here; IDR markings per slice in frame or fields are ORed in later.
* See decode_nal_units().
*/
- s->current_picture_ptr->key_frame = 0;
- s->current_picture_ptr->mmco_reset = 0;
+ s->current_picture_ptr->key_frame= 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) + 4 * s->linesize * ((scan8[i] - scan8[0]) >> 3);
- h->block_offset[24+i] = 4 * ((scan8[i] - scan8[0]) & 7) + 8 * s->linesize * ((scan8[i] - scan8[0]) >> 3);
+ for(i=0; i<16; i++){
+ h->block_offset[i]= 4*((scan8[i] - scan8[0])&7) + 4*s->linesize*((scan8[i] - scan8[0])>>3);
+ h->block_offset[24+i]= 4*((scan8[i] - scan8[0])&7) + 8*s->linesize*((scan8[i] - scan8[0])>>3);
}
- for(i = 0; i < 4; i++)
- {
- h->block_offset[16+i] =
- h->block_offset[20+i] = 4 * ((scan8[i] - scan8[0]) & 7) + 4 * s->uvlinesize * ((scan8[i] - scan8[0]) >> 3);
- h->block_offset[24+16+i] =
- h->block_offset[24+20+i] = 4 * ((scan8[i] - scan8[0]) & 7) + 8 * s->uvlinesize * ((scan8[i] - scan8[0]) >> 3);
+ for(i=0; i<4; i++){
+ h->block_offset[16+i]=
+ h->block_offset[20+i]= 4*((scan8[i] - scan8[0])&7) + 4*s->uvlinesize*((scan8[i] - scan8[0])>>3);
+ h->block_offset[24+16+i]=
+ h->block_offset[24+20+i]= 4*((scan8[i] - scan8[0])&7) + 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->avctx->thread_count; i++)
if(!h->thread_context[i]->s.obmc_scratchpad)
- h->thread_context[i]->s.obmc_scratchpad = av_malloc(16 * 2 * s->linesize + 8 * 2 * s->uvlinesize);
+ h->thread_context[i]->s.obmc_scratchpad = av_malloc(16*2*s->linesize + 8*2*s->uvlinesize);
/* some macroblocks will be accessed before they're available */
if(FRAME_MBAFF || s->avctx->thread_count > 1)
- memset(h->slice_table, -1, (s->mb_height * s->mb_stride - 1) * sizeof(*h->slice_table));
+ 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.reference /*|| h->contains_intra*/ || 1;
@@ -981,17 +874,16 @@ int ff_h264_frame_start(H264Context *h)
// 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)
- s->current_picture_ptr->reference = 0;
+ s->current_picture_ptr->reference= 0;
- s->current_picture_ptr->field_poc[0] =
- s->current_picture_ptr->field_poc[1] = INT_MAX;
- assert(s->current_picture_ptr->long_ref == 0);
+ s->current_picture_ptr->field_poc[0]=
+ s->current_picture_ptr->field_poc[1]= INT_MAX;
+ assert(s->current_picture_ptr->long_ref==0);
return 0;
}
-static 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)
-{
+static 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){
MpegEncContext * const s = &h->s;
uint8_t *top_border;
int top_idx = 1;
@@ -1000,43 +892,34 @@ static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src
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);
- if(simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- AV_COPY64(top_border + 16, src_cb + 7 * uvlinesize);
- AV_COPY64(top_border + 24, src_cr + 7 * uvlinesize);
+ AV_COPY128(top_border, src_y + 15*linesize);
+ if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ 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);
+ AV_COPY128(top_border, src_y + 16*linesize);
- if(simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- AV_COPY64(top_border + 16, src_cb + 8 * uvlinesize);
- AV_COPY64(top_border + 24, src_cr + 8 * uvlinesize);
+ if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ AV_COPY64(top_border+16, src_cb+8*uvlinesize);
+ AV_COPY64(top_border+24, src_cr+8*uvlinesize);
}
}
-static 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 simple)
-{
+static 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 simple){
MpegEncContext * const s = &h->s;
int temp8, i;
uint64_t temp64;
@@ -1047,29 +930,22 @@ static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_c
uint8_t *top_border_m1;
uint8_t *top_border;
- if(!simple && FRAME_MBAFF)
- {
- if(s->mb_y & 1)
- {
+ 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) {
mb_xy = h->mb_xy;
deblock_left = h->slice_table[mb_xy] == h->slice_table[mb_xy - 1];
deblock_top = h->slice_table[mb_xy] == h->slice_table[h->top_mb_xy];
- }
- else
- {
+ } else {
deblock_left = (s->mb_x > 0);
- deblock_top = (s->mb_y > !!MB_FIELD);
+ deblock_top = (s->mb_y > !!MB_FIELD);
}
src_y -= linesize + 1;
@@ -1083,42 +959,35 @@ static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_c
if (xchg) AV_SWAP64(b,a);\
else AV_COPY64(b,a);
- if(deblock_top)
- {
- if(deblock_left)
- {
- XCHG(top_border_m1 + 8, src_y - 7, 1);
+ if(deblock_top){
+ if(deblock_left){
+ XCHG(top_border_m1+8, src_y -7, 1);
}
- XCHG(top_border + 0, src_y + 1, xchg);
- XCHG(top_border + 8, src_y + 9, 1);
- if(s->mb_x + 1 < s->mb_width)
- {
- XCHG(h->top_borders[top_idx][s->mb_x+1], src_y + 17, 1);
+ XCHG(top_border+0, src_y +1, xchg);
+ XCHG(top_border+8, src_y +9, 1);
+ if(s->mb_x+1 < s->mb_width){
+ XCHG(h->top_borders[top_idx][s->mb_x+1], src_y +17, 1);
}
}
- if(simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- if(deblock_top)
- {
- if(deblock_left)
- {
- XCHG(top_border_m1 + 16, src_cb - 7, 1);
- XCHG(top_border_m1 + 24, src_cr - 7, 1);
+ if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ if(deblock_top){
+ if(deblock_left){
+ XCHG(top_border_m1+16, src_cb -7, 1);
+ XCHG(top_border_m1+24, src_cr -7, 1);
}
- XCHG(top_border + 16, src_cb + 1, 1);
- XCHG(top_border + 24, src_cr + 1, 1);
+ XCHG(top_border+16, src_cb+1, 1);
+ XCHG(top_border+24, src_cr+1, 1);
}
}
}
-static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple)
-{
+static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
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.mb_type[mb_xy];
+ 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.mb_type[mb_xy];
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize /*dct_offset*/;
int i;
@@ -1126,199 +995,149 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple)
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);
- void (*idct_dc_add)(uint8_t * dst, DCTELEM * block, int stride);
+ void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
+ void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride);
- dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize) * 16;
+ dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize ) * 16;
dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8;
dest_cr = s->current_picture.data[2] + (mb_x + mb_y * s->uvlinesize) * 8;
- s->dsp.prefetch(dest_y + (s->mb_x & 3) * 4 * s->linesize + 64, s->linesize, 4);
- s->dsp.prefetch(dest_cb + (s->mb_x & 7)*s->uvlinesize + 64, dest_cr - dest_cb, 2);
+ s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + 64, s->linesize, 4);
+ s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + 64, dest_cr - dest_cb, 2);
- h->list_counts[mb_xy] = h->list_count;
+ h->list_counts[mb_xy]= h->list_count;
- if(!simple && MB_FIELD)
- {
+ if (!simple && MB_FIELD) {
linesize = h->mb_linesize = s->linesize * 2;
uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
block_offset = &h->block_offset[24];
- if(mb_y & 1) //FIXME move out of this function?
- {
- dest_y -= s->linesize * 15;
- dest_cb -= s->uvlinesize * 7;
- dest_cr -= s->uvlinesize * 7;
+ if(mb_y&1){ //FIXME move out of this function?
+ dest_y -= s->linesize*15;
+ dest_cb-= s->uvlinesize*7;
+ dest_cr-= s->uvlinesize*7;
}
- if(FRAME_MBAFF)
- {
+ if(FRAME_MBAFF) {
int list;
- for(list = 0; list < h->list_count; list++)
- {
+ for(list=0; list<h->list_count; list++){
if(!USES_LIST(mb_type, list))
continue;
- if(IS_16X16(mb_type))
- {
+ 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)
- {
+ 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);
+ fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16+ref)^(s->mb_y&1), 1);
}
}
}
}
- }
- else
- {
+ } 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))
- {
- for(i = 0; i < 16; i++)
- {
- memcpy(dest_y + i * linesize, h->mb + i * 8, 16);
+ if (!simple && IS_INTRA_PCM(mb_type)) {
+ for (i=0; i<16; i++) {
+ memcpy(dest_y + i* linesize, h->mb + i*8, 16);
}
- for(i = 0; i < 8; i++)
- {
- memcpy(dest_cb + i * uvlinesize, h->mb + 128 + i * 4, 8);
- memcpy(dest_cr + i * uvlinesize, h->mb + 160 + i * 4, 8);
+ for (i=0; i<8; 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))
- {
+ } else {
+ if(IS_INTRA(mb_type)){
if(h->deblocking_filter)
xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple);
- if(simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
+ 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);
}
- if(IS_INTRA4x4(mb_type))
- {
- if(simple || !s->encoding)
- {
- if(IS_8x8DCT(mb_type))
- {
- if(transform_bypass)
- {
+ 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_add = s->dsp.add_pixels8;
+ }else{
idct_dc_add = s->dsp.h264_idct8_dc_add;
idct_add = s->dsp.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, linesize);
- }
- else
- {
+ 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, linesize);
+ }else{
const int nnz = h->non_zero_count_cache[ scan8[i] ];
- h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available << i) & 0x8000,
- (h->topright_samples_available << i) & 0x4000, linesize);
- if(nnz)
- {
+ h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
+ (h->topright_samples_available<<i)&0x4000, linesize);
+ if(nnz){
if(nnz == 1 && h->mb[i*16])
- idct_dc_add(ptr, h->mb + i * 16, linesize);
+ idct_dc_add(ptr, h->mb + i*16, linesize);
else
- idct_add(ptr, h->mb + i * 16, linesize);
+ idct_add (ptr, h->mb + i*16, linesize);
}
}
}
- }
- else
- {
- if(transform_bypass)
- {
+ }else{
+ if(transform_bypass){
idct_dc_add =
- idct_add = s->dsp.add_pixels4;
- }
- else
- {
+ idct_add = s->dsp.add_pixels4;
+ }else{
idct_dc_add = s->dsp.h264_idct_dc_add;
idct_add = s->dsp.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] ];
-
- if(transform_bypass && h->sps.profile_idc == 244 && dir <= 1)
- {
- h->hpc.pred4x4_add[dir](ptr, h->mb + i * 16, linesize);
- }
- else
- {
+ 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, linesize);
+ }else{
uint8_t *topright;
int nnz, tr;
- 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(mb_y || linesize <= block_offset[i]);
- if(!topright_avail)
- {
- tr = ptr[3 - linesize] * 0x01010101;
- topright = (uint8_t*) &tr;
- }
- else
- topright = ptr + 4 - linesize;
- }
- else
- topright = NULL;
+ if(!topright_avail){
+ tr= ptr[3 - linesize]*0x01010101;
+ topright= (uint8_t*) &tr;
+ }else
+ topright= ptr + 4 - linesize;
+ }else
+ topright= NULL;
h->hpc.pred4x4[ dir ](ptr, topright, linesize);
nnz = h->non_zero_count_cache[ scan8[i] ];
- if(nnz)
- {
- if(is_h264)
- {
+ if(nnz){
+ if(is_h264){
if(nnz == 1 && h->mb[i*16])
- idct_dc_add(ptr, h->mb + i * 16, linesize);
+ idct_dc_add(ptr, h->mb + i*16, linesize);
else
- idct_add(ptr, h->mb + i * 16, linesize);
- }
- else
- ff_svq3_add_idct_c(ptr, h->mb + i * 16, linesize, s->qscale, 0);
+ idct_add (ptr, h->mb + i*16, linesize);
+ }else
+ ff_svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0);
}
}
}
}
}
- }
- else
- {
+ }else{
h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize);
- if(is_h264)
- {
+ if(is_h264){
if(!transform_bypass)
h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[0][s->qscale][0]);
- }
- else
+ }else
ff_svq3_luma_dc_dequant_idct_c(h->mb, s->qscale);
}
if(h->deblocking_filter)
xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple);
- }
- else if(is_h264)
- {
+ }else if(is_h264){
hl_motion(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,
@@ -1326,116 +1145,78 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple)
}
- 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))
- {
+ 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, linesize);
- }
- else
- {
- for(i = 0; i < 16; i++)
- {
+ }else{
+ for(i=0; i<16; i++){
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16])
- s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + i * 16, linesize);
+ s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + i*16, linesize);
}
}
+ }else{
+ s->dsp.h264_idct_add16intra(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
}
- else
- {
- s->dsp.h264_idct_add16intra(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
- }
- }
- else if(h->cbp & 15)
- {
- if(transform_bypass)
- {
+ }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] ])
- {
- idct_add(dest_y + block_offset[i], h->mb + i * 16, linesize);
+ 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] ]){
+ idct_add(dest_y + block_offset[i], h->mb + i*16, linesize);
}
}
- }
- else
- {
- if(IS_8x8DCT(mb_type))
- {
+ }else{
+ if(IS_8x8DCT(mb_type)){
s->dsp.h264_idct8_add4(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
- }
- else
- {
+ }else{
s->dsp.h264_idct_add16(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
}
}
}
- }
- else
- {
- for(i = 0; i < 16; i++)
- {
- if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]) //FIXME benchmark weird rule, & below
- {
- uint8_t * const ptr = dest_y + block_offset[i];
- ff_svq3_add_idct_c(ptr, h->mb + i * 16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0);
+ }else{
+ for(i=0; i<16; i++){
+ if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below
+ uint8_t * const ptr= dest_y + block_offset[i];
+ ff_svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0);
}
}
}
}
- if((simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) && (h->cbp & 0x30))
- {
+ 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, uvlinesize);
- h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + 20 * 16, uvlinesize);
- }
- else
- {
+ 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, uvlinesize);
+ h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + 20*16, uvlinesize);
+ }else{
idct_add = s->dsp.add_pixels4;
- for(i = 16; i < 16 + 8; i++)
- {
+ for(i=16; i<16+8; i++){
if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16])
- idct_add(dest[(i&4)>>2] + block_offset[i], h->mb + i * 16, uvlinesize);
+ idct_add (dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
}
}
- }
- else
- {
- chroma_dc_dequant_idct_c(h->mb + 16 * 16, h->chroma_qp[0], h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
- chroma_dc_dequant_idct_c(h->mb + 16 * 16 + 4 * 16, h->chroma_qp[1], h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
- if(is_h264)
- {
+ }else{
+ chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp[0], h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
+ chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp[1], h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
+ if(is_h264){
idct_add = s->dsp.h264_idct_add;
idct_dc_add = s->dsp.h264_idct_dc_add;
- for(i = 16; i < 16 + 8; i++)
- {
+ for(i=16; i<16+8; i++){
if(h->non_zero_count_cache[ scan8[i] ])
- idct_add(dest[(i&4)>>2] + block_offset[i], h->mb + i * 16, uvlinesize);
+ idct_add (dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
else if(h->mb[i*16])
- idct_dc_add(dest[(i&4)>>2] + block_offset[i], h->mb + i * 16, uvlinesize);
+ idct_dc_add(dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
}
- }
- else
- {
- for(i = 16; i < 16 + 8; i++)
- {
- if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16])
- {
- uint8_t * const ptr = dest[(i&4)>>2] + block_offset[i];
- ff_svq3_add_idct_c(ptr, h->mb + i * 16, uvlinesize, ff_h264_chroma_qp[s->qscale + 12] - 12, 2);
+ }else{
+ for(i=16; i<16+8; i++){
+ if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
+ uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];
+ ff_svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, ff_h264_chroma_qp[s->qscale + 12] - 12, 2);
}
}
}
@@ -1450,18 +1231,14 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple)
s->dsp.clear_blocks(h->mb);
#endif
- if(h->deblocking_filter && 0)
- {
+ if(h->deblocking_filter && 0) {
backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, simple);
fill_filter_caches(h, mb_type); //FIXME don't fill stuff which isn't used by filter_mb
h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
- if(!simple && FRAME_MBAFF)
- {
- ff_h264_filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
- }
- else
- {
+ if (!simple && FRAME_MBAFF) {
+ 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);
}
}
@@ -1470,148 +1247,124 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple)
/**
* Process a macroblock; this case avoids checks for expensive uncommon cases.
*/
-static void hl_decode_mb_simple(H264Context *h)
-{
+static void hl_decode_mb_simple(H264Context *h){
hl_decode_mb_internal(h, 1);
}
/**
* Process a macroblock; this handles edge cases, such as interlacing.
*/
-static void av_noinline hl_decode_mb_complex(H264Context *h)
-{
+static void av_noinline hl_decode_mb_complex(H264Context *h){
hl_decode_mb_internal(h, 0);
}
-void ff_h264_hl_decode_mb(H264Context *h)
-{
+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.mb_type[mb_xy];
+ const int mb_xy= h->mb_xy;
+ const int mb_type= s->current_picture.mb_type[mb_xy];
int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;
- if(is_complex)
+ if (is_complex)
hl_decode_mb_complex(h);
else hl_decode_mb_simple(h);
}
-static int pred_weight_table(H264Context *h)
-{
+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);
- 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);
+ 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[list][i] = get_se_golomb(&s->gb);
- h->luma_offset[list][i] = get_se_golomb(&s->gb);
- if(h->luma_weight[list][i] != luma_def
- || h->luma_offset[list][i] != 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[list][i]= get_se_golomb(&s->gb);
+ h->luma_offset[list][i]= get_se_golomb(&s->gb);
+ if( h->luma_weight[list][i] != luma_def
+ || h->luma_offset[list][i] != 0) {
+ h->use_weight= 1;
+ h->luma_weight_flag[list]= 1;
}
- }
- else
- {
- h->luma_weight[list][i] = luma_def;
- h->luma_offset[list][i] = 0;
+ }else{
+ h->luma_weight[list][i]= luma_def;
+ h->luma_offset[list][i]= 0;
}
- if(CHROMA)
- {
- chroma_weight_flag = get_bits1(&s->gb);
- if(chroma_weight_flag)
- {
+ if(CHROMA){
+ chroma_weight_flag= get_bits1(&s->gb);
+ if(chroma_weight_flag){
int j;
- for(j = 0; j < 2; j++)
- {
- h->chroma_weight[list][i][j] = get_se_golomb(&s->gb);
- h->chroma_offset[list][i][j] = get_se_golomb(&s->gb);
- if(h->chroma_weight[list][i][j] != chroma_def
- || h->chroma_offset[list][i][j] != 0)
- {
- h->use_weight_chroma = 1;
- h->chroma_weight_flag[list] = 1;
+ for(j=0; j<2; j++){
+ h->chroma_weight[list][i][j]= get_se_golomb(&s->gb);
+ h->chroma_offset[list][i][j]= get_se_golomb(&s->gb);
+ if( h->chroma_weight[list][i][j] != chroma_def
+ || h->chroma_offset[list][i][j] != 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[list][i][j] = chroma_def;
- h->chroma_offset[list][i][j] = 0;
+ for(j=0; j<2; j++){
+ h->chroma_weight[list][i][j]= chroma_def;
+ h->chroma_offset[list][i][j]= 0;
}
}
}
}
if(h->slice_type_nos != FF_B_TYPE) break;
}
- h->use_weight = h->use_weight || h->use_weight_chroma;
+ h->use_weight= h->use_weight || h->use_weight_chroma;
return 0;
}
-static void implicit_weight_table(H264Context *h)
-{
+static void implicit_weight_table(H264Context *h){
MpegEncContext * const s = &h->s;
int ref0, ref1, i;
int cur_poc = s->current_picture_ptr->poc;
- for(i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
h->luma_weight_flag[i] = 0;
h->chroma_weight_flag[i] = 0;
}
- if(h->ref_count[0] == 1 && h->ref_count[1] == 1
- && h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2 * cur_poc)
- {
- h->use_weight = 0;
- h->use_weight_chroma = 0;
+ if( h->ref_count[0] == 1 && h->ref_count[1] == 1
+ && 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;
}
- 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 = 0; ref0 < h->ref_count[0]; ref0++)
- {
+ for(ref0=0; ref0 < h->ref_count[0]; ref0++){
int poc0 = h->ref_list[0][ref0].poc;
- for(ref1 = 0; ref1 < h->ref_count[1]; ref1++)
- {
+ for(ref1=0; ref1 < h->ref_count[1]; ref1++){
int poc1 = h->ref_list[1][ref1].poc;
int td = av_clip(poc1 - poc0, -128, 127);
- if(td)
- {
+ if(td){
int tb = av_clip(cur_poc - poc0, -128, 127);
int tx = (16384 + (FFABS(td) >> 1)) / td;
- int dist_scale_factor = av_clip((tb * tx + 32) >> 6, -1024, 1023) >> 2;
+ int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2;
if(dist_scale_factor < -64 || dist_scale_factor > 128)
h->implicit_weight[ref0][ref1] = 32;
else
h->implicit_weight[ref0][ref1] = 64 - dist_scale_factor;
- }
- else
+ }else
h->implicit_weight[ref0][ref1] = 32;
}
}
@@ -1620,66 +1373,59 @@ static void implicit_weight_table(H264Context *h)
/**
* 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_dpb(AVCodecContext *avctx){
+ H264Context *h= avctx->priv_data;
int i;
- for(i = 0; i < MAX_DELAYED_PIC_COUNT; i++)
- {
+ for(i=0; i<MAX_DELAYED_PIC_COUNT; i++) {
if(h->delayed_pic[i])
- h->delayed_pic[i]->reference = 0;
- h->delayed_pic[i] = NULL;
+ h->delayed_pic[i]->reference= 0;
+ h->delayed_pic[i]= NULL;
}
- h->outputed_poc = INT_MIN;
+ h->outputed_poc= INT_MIN;
h->prev_interlaced_frame = 1;
idr(h);
if(h->s.current_picture_ptr)
- h->s.current_picture_ptr->reference = 0;
- h->s.first_field = 0;
+ h->s.current_picture_ptr->reference= 0;
+ h->s.first_field= 0;
ff_h264_reset_sei(h);
h->has_to_drop_first_non_ref = avctx->h264_has_to_drop_first_non_ref; /* ffdshow custom code */
ff_mpeg_flush(avctx);
}
-static int init_poc(H264Context *h)
-{
+static int init_poc(H264Context *h){
MpegEncContext * const s = &h->s;
- const int max_frame_num = 1 << h->sps.log2_max_frame_num;
+ 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;
+ 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;
+ field_poc[1] = h->poc_msb + h->poc_lsb;
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;
@@ -1688,23 +1434,21 @@ static int init_poc(H264Context *h)
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++)
+ 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
- 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 ];
- }
- else
+ } else
expectedpoc = 0;
if(h->nal_ref_idc == 0)
@@ -1715,23 +1459,21 @@ static int init_poc(H264Context *h)
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)
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];
+ 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]);
+ s->current_picture_ptr->field_poc[1]= field_poc[1];
+ cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]);
return 0;
}
@@ -1740,36 +1482,27 @@ static int init_poc(H264Context *h)
/**
* initialize scan tables
*/
-static void init_scan_tables(H264Context *h)
-{
+static void init_scan_tables(H264Context *h){
MpegEncContext * const s = &h->s;
int i;
- if(s->dsp.h264_idct_add == ff_h264_idct_add_c) //FIXME little ugly
- {
- memcpy(h->zigzag_scan, zigzag_scan, 16 * sizeof(uint8_t));
- memcpy(h-> field_scan, field_scan, 16 * sizeof(uint8_t));
- }
- else
- {
- for(i = 0; i < 16; i++)
- {
+ if(s->dsp.h264_idct_add == ff_h264_idct_add_c){ //FIXME little ugly
+ memcpy(h->zigzag_scan, zigzag_scan, 16*sizeof(uint8_t));
+ memcpy(h-> field_scan, field_scan, 16*sizeof(uint8_t));
+ }else{
+ 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
}
}
- if(s->dsp.h264_idct8_add == ff_h264_idct8_add_c)
- {
- memcpy(h->zigzag_scan8x8, ff_zigzag_direct, 64 * sizeof(uint8_t));
- memcpy(h->zigzag_scan8x8_cavlc, zigzag_scan8x8_cavlc, 64 * sizeof(uint8_t));
- memcpy(h->field_scan8x8, field_scan8x8, 64 * sizeof(uint8_t));
- memcpy(h->field_scan8x8_cavlc, field_scan8x8_cavlc, 64 * sizeof(uint8_t));
- }
- else
- {
- for(i = 0; i < 64; i++)
- {
+ if(s->dsp.h264_idct8_add == ff_h264_idct8_add_c){
+ memcpy(h->zigzag_scan8x8, ff_zigzag_direct, 64*sizeof(uint8_t));
+ memcpy(h->zigzag_scan8x8_cavlc, zigzag_scan8x8_cavlc, 64*sizeof(uint8_t));
+ memcpy(h->field_scan8x8, field_scan8x8, 64*sizeof(uint8_t));
+ memcpy(h->field_scan8x8_cavlc, field_scan8x8_cavlc, 64*sizeof(uint8_t));
+ }else{
+ 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]);
@@ -1778,17 +1511,14 @@ static void init_scan_tables(H264Context *h)
#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;
@@ -1798,23 +1528,21 @@ static void init_scan_tables(H264Context *h)
}
}
-static void field_end(H264Context *h)
-{
+static void field_end(H264Context *h){
MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx = s->avctx;
- s->mb_y = 0;
+ AVCodecContext * const avctx= s->avctx;
+ s->mb_y= 0;
- s->current_picture_ptr->qscale_type = FF_QSCALE_TYPE_H264;
- s->current_picture_ptr->pict_type = s->pict_type;
+ s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264;
+ s->current_picture_ptr->pict_type= s->pict_type;
- if(!s->dropable)
- {
+ if(!s->dropable) {
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->prev_frame_num_offset= h->frame_num_offset;
+ h->prev_frame_num= h->frame_num;
/*
* FIXME: Error handling code does not seem to support interlaced
@@ -1828,12 +1556,12 @@ static void field_end(H264Context *h)
* past end by one (callers fault) and resync_mb_y != 0
* causes problems for the first MB line, too.
*/
- if(!FIELD_PICTURE)
+ if (!FIELD_PICTURE)
ff_er_frame_end(s);
MPV_frame_end(s);
- h->current_slice = 0;
+ h->current_slice=0;
}
/**
@@ -1882,8 +1610,7 @@ static void clone_slice(H264Context *dst, H264Context *src, int full) /* ffdshow
/* weighted motion pred */
dst->use_weight = src->use_weight;
- if(dst->use_weight != 0)
- {
+ if(dst->use_weight != 0) {
dst->use_weight_chroma = src->use_weight_chroma;
dst->luma_log2_weight_denom = src->luma_log2_weight_denom;
dst->chroma_log2_weight_denom = src->chroma_log2_weight_denom;
@@ -1907,7 +1634,7 @@ static void clone_slice(H264Context *dst, H264Context *src, int full) /* ffdshow
dst->slice_type_nos = src->slice_type_nos;
// FIXME not sure if below are necessary
- dst->direct_spatial_mv_pred = src->direct_spatial_mv_pred;
+ dst->direct_spatial_mv_pred= src->direct_spatial_mv_pred;
dst->s.qscale = src->s.qscale;
dst->b_stride = src->b_stride;
dst->b8_stride = src->b8_stride;
@@ -1930,8 +1657,7 @@ static void clone_slice(H264Context *dst, H264Context *src, int full) /* ffdshow
*
* @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)
-{
+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;
@@ -1941,150 +1667,128 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
int default_ref_list_done = 0;
int last_pic_structure;
- s->dropable = h->nal_ref_idc == 0;
+ s->dropable= h->nal_ref_idc == 0;
- if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !h->nal_ref_idc)
- {
- 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){
+ 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);
}
h0->current_slice = 0;
- if(!s0->first_field)
- s->current_picture_ptr = NULL;
+ if (!s0->first_field)
+ s->current_picture_ptr= NULL;
}
- slice_type = get_ue_golomb_31(&s->gb);
- if(slice_type > 9)
- {
+ 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 == FF_I_TYPE
- || (h0->current_slice != 0 && slice_type == h0->last_slice_type))
- {
+ slice_type= golomb_to_pict_type[ slice_type ];
+ if (slice_type == FF_I_TYPE
+ || (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
- if(s->pict_type == FF_B_TYPE && s0->last_picture_ptr == NULL)
- {
+ s->pict_type= h->slice_type; // to make a few old functions happy, it's wrong though
+ if (s->pict_type == FF_B_TYPE && s0->last_picture_ptr == NULL) {
av_log(h->s.avctx, AV_LOG_ERROR,
"B picture before any references, skipping\n");
return -1;
}
- 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])
- {
+ 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])
- {
+ 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 == 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);
}
- s->mb_width = h->sps.mb_width;
- s->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
+ 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;
- h->b8_stride = s->mb_width * 2;
+ h->b_stride= s->mb_width*4;
+ h->b8_stride= s->mb_width*2;
- s->width = 16 * s->mb_width - 2 * FFMIN(h->sps.crop_right, 7);
+ s->width = 16*s->mb_width - 2*FFMIN(h->sps.crop_right, 7);
if(h->sps.frame_mbs_only_flag)
- s->height = 16 * s->mb_height - 2 * FFMIN(h->sps.crop_bottom, 7);
+ s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7);
else
- s->height = 16 * s->mb_height - 4 * FFMIN(h->sps.crop_bottom, 3);
+ s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
- if(s->context_initialized
- && (s->width != s->avctx->width || s->height != s->avctx->height))
- {
+ if (s->context_initialized
+ && ( s->width != s->avctx->width || s->height != s->avctx->height)) {
if(h != h0)
return -1; // width / height changed during parallelized decoding
free_tables(h);
flush_dpb(s->avctx);
MPV_common_end(s);
}
- if(!s->context_initialized)
- {
+ if (!s->context_initialized) {
if(h != h0)
return -1; // we cant (re-)initialize context during parallel decoding
avcodec_set_dimensions(s->avctx, s->width, s->height);
- s->avctx->sample_aspect_ratio = h->sps.sar;
+ s->avctx->sample_aspect_ratio= h->sps.sar;
if(!s->avctx->sample_aspect_ratio.den)
s->avctx->sample_aspect_ratio.den = 1;
- if(h->sps.video_signal_type_present_flag)
- {
+ 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(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->sps.timing_info_present_flag)
- {
-#if __STDC_VERSION__ >= 199901L
- s->avctx->time_base = (AVRational)
- {
- h->sps.num_units_in_tick * 2, h->sps.time_scale
- };
-#else
+ if(h->sps.timing_info_present_flag){
+ #if __STDC_VERSION__ >= 199901L
+ s->avctx->time_base= (AVRational){h->sps.num_units_in_tick * 2, h->sps.time_scale};
+ #else
s->avctx->time_base.num = h->sps.num_units_in_tick * 2;
s->avctx->time_base.den = h->sps.time_scale;
-#endif
+ #endif
if(h->x264_build > 0 && h->x264_build < 44)
s->avctx->time_base.den *= 2;
av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
- s->avctx->time_base.num, s->avctx->time_base.den, 1 << 30);
+ s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
}
- if(MPV_common_init(s) < 0)
+ if (MPV_common_init(s) < 0)
return -1;
s->first_field = 0;
h->prev_interlaced_frame = 1;
@@ -2092,8 +1796,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
init_scan_tables(h);
ff_h264_alloc_tables(h);
- for(i = 1; i < s->avctx->thread_count; i++)
- {
+ for(i = 1; i < s->avctx->thread_count; i++) {
H264Context *c;
c = h->thread_context[i] = av_malloc(sizeof(H264Context));
memcpy(c, h->s.thread_context[i], sizeof(MpegEncContext));
@@ -2109,28 +1812,22 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
return -1;
}
- 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;
last_pic_structure = s0->picture_structure;
- 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;
+ 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;
}
}
- h->mb_field_decoding_flag = s->picture_structure != PICT_FRAME;
+ h->mb_field_decoding_flag= s->picture_structure != PICT_FRAME;
/* ffdshow custom code begin */
//
@@ -2140,54 +1837,42 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
// This rule is applied only if h->has_to_drop_first_non_ref == 3.
// This is wrong because an unpaired field is allowed to be a reference field.
// And that's why this is optional and tried to be minimized.
- if(h->has_to_drop_first_non_ref == 1 && s->dropable)
- {
- if(FIELD_PICTURE)
- {
+ if (h->has_to_drop_first_non_ref == 1 && s->dropable){
+ if (FIELD_PICTURE){
h->has_to_drop_first_non_ref = 2;
- }
- else
- {
+ }else{
h->has_to_drop_first_non_ref = 0;
}
- }
- else if(h->has_to_drop_first_non_ref == 2)
- {
- if(FIELD_PICTURE && !s->dropable)
+ } else if (h->has_to_drop_first_non_ref == 2){
+ if (FIELD_PICTURE && !s->dropable)
h->has_to_drop_first_non_ref = 3;
- else if(!FIELD_PICTURE)
+ else if (!FIELD_PICTURE)
h->has_to_drop_first_non_ref = 0;
- }
- else if(h->has_to_drop_first_non_ref == 3)
- {
+ } else if (h->has_to_drop_first_non_ref == 3){
h->has_to_drop_first_non_ref = 0;
}
/* ffdshow custom code end */
- if(h0->current_slice == 0)
- {
+ if(h0->current_slice == 0){
while(h->frame_num != h->prev_frame_num &&
- h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num))
- {
+ h->frame_num != (h->prev_frame_num+1)%(1<<h->sps.log2_max_frame_num)){
av_log(NULL, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
- if(ff_h264_frame_start(h) < 0)
+ 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;
+ h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
+ s->current_picture_ptr->frame_num= h->prev_frame_num;
ff_h264_execute_ref_pic_marking(h, NULL, 0);
}
/* See if we have a decoded first field looking for a pair... */
- if(s0->first_field)
- {
+ if (s0->first_field) {
assert(s0->current_picture_ptr);
assert(s0->current_picture_ptr->data[0]);
assert(s0->current_picture_ptr->reference != DELAYED_PIC_REF);
/* figure out if we have a complementary field pair */
- if(!FIELD_PICTURE || s->picture_structure == last_pic_structure)
- {
+ 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.
@@ -2195,14 +1880,11 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
s0->current_picture_ptr = NULL;
s0->first_field = FIELD_PICTURE;
- }
- else
- {
- if((h->nal_ref_idc &&
- s0->current_picture_ptr->reference &&
- s0->current_picture_ptr->frame_num != h->frame_num) ||
- h->has_to_drop_first_non_ref == 3) /* ffdshow custom code */
- {
+ } else {
+ if ((h->nal_ref_idc &&
+ s0->current_picture_ptr->reference &&
+ s0->current_picture_ptr->frame_num != h->frame_num) ||
+ h->has_to_drop_first_non_ref == 3) { /* ffdshow custom code */
/*
* This and previous field were reference, but had
* different frame_nums. Consider this field first in
@@ -2212,24 +1894,19 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
s0->first_field = 1;
s0->current_picture_ptr = NULL;
- }
- else
- {
+ } else {
/* Second field in complementary pair */
s0->first_field = 0;
}
}
- }
- else
- {
+ } 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) && ff_h264_frame_start(h) < 0)
- {
+ if((!FIELD_PICTURE || s0->first_field) && ff_h264_frame_start(h) < 0) {
s0->first_field = 0;
return -1;
}
@@ -2237,124 +1914,105 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
if(h != h0)
clone_slice(h, h0, 0); /* ffdshow custom code */
- 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)
- {
+ 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_y = s->mb_y = (first_mb_in_slice / s->mb_width) << FIELD_OR_MBAFF_PICTURE;
- if(s->picture_structure == PICT_BOTTOM_FIELD)
+ 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);
+ 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];
+ h->ref_count[0]= h->pps.ref_count[0];
+ h->ref_count[1]= h->pps.ref_count[1];
- if(h->slice_type_nos != FF_I_TYPE)
- {
- if(h->slice_type_nos == FF_B_TYPE)
- {
- h->direct_spatial_mv_pred = get_bits1(&s->gb);
+ if(h->slice_type_nos != FF_I_TYPE){
+ if(h->slice_type_nos == FF_B_TYPE){
+ h->direct_spatial_mv_pred= get_bits1(&s->gb);
}
- num_ref_idx_active_override_flag = 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(h->slice_type_nos == FF_B_TYPE)
- h->ref_count[1] = 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->slice_type_nos==FF_B_TYPE)
+ h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
- if(h->ref_count[0] - 1 > 32 - 1 || h->ref_count[1] - 1 > 32 - 1)
- {
+ if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){
av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
- h->ref_count[0] = h->ref_count[1] = 1;
+ h->ref_count[0]= h->ref_count[1]= 1;
return -1;
}
}
if(h->slice_type_nos == FF_B_TYPE)
- h->list_count = 2;
+ h->list_count= 2;
else
- h->list_count = 1;
- }
- else
- h->list_count = 0;
+ h->list_count= 1;
+ }else
+ h->list_count= 0;
- if(!default_ref_list_done)
- {
+ if(!default_ref_list_done){
ff_h264_fill_default_ref_list(h);
}
- if(h->slice_type_nos != FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
+ if(h->slice_type_nos!=FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
return -1;
- if(h->slice_type_nos != FF_I_TYPE)
- {
- s->last_picture_ptr = &h->ref_list[0][0];
+ if(h->slice_type_nos!=FF_I_TYPE){
+ s->last_picture_ptr= &h->ref_list[0][0];
ff_copy_picture(&s->last_picture, s->last_picture_ptr);
}
- if(h->slice_type_nos == FF_B_TYPE)
- {
- s->next_picture_ptr = &h->ref_list[1][0];
+ if(h->slice_type_nos==FF_B_TYPE){
+ s->next_picture_ptr= &h->ref_list[1][0];
ff_copy_picture(&s->next_picture, s->next_picture_ptr);
}
- if((h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE)
- || (h->pps.weighted_bipred_idc == 1 && h->slice_type_nos == FF_B_TYPE))
+ if( (h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE )
+ || (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
pred_weight_table(h);
- else if(h->pps.weighted_bipred_idc == 2 && h->slice_type_nos == FF_B_TYPE)
+ else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE)
implicit_weight_table(h);
- else
- {
+ else {
h->use_weight = 0;
- for(i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
h->luma_weight_flag[i] = 0;
h->chroma_weight_flag[i] = 0;
}
@@ -2366,19 +2024,17 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
if(FRAME_MBAFF)
ff_h264_fill_mbaff_ref_list(h);
- if(h->slice_type_nos == FF_B_TYPE && !h->direct_spatial_mv_pred)
+ if(h->slice_type_nos==FF_B_TYPE && !h->direct_spatial_mv_pred)
ff_h264_direct_dist_scale_factor(h);
ff_h264_direct_ref_list_init(h);
- if(h->slice_type_nos != FF_I_TYPE && h->pps.cabac)
- {
+ if( h->slice_type_nos != FF_I_TYPE && 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;
@@ -2386,73 +2042,61 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h->slice_qp_delta = get_se_golomb(&s->gb);
tmp = h->pps.init_qp + h->slice_qp_delta;
// <== End patch MPC
- if(tmp > 51)
- {
+ if(tmp>51){
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 == FF_SP_TYPE)
- {
+ if(h->slice_type == FF_SP_TYPE){
get_bits1(&s->gb); /* sp_for_switch_flag */
}
- if(h->slice_type == FF_SP_TYPE || h->slice_type == FF_SI_TYPE)
- {
- // ==> Start patch MPC
+ if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){
+ // ==> Start patch MPC
h->slice_qs_delta = get_se_golomb(&s->gb); /* slice_qs_delta */
- // <== End patch MPC
+ // <== End patch MPC
}
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)
- {
+ 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;
+ h->deblocking_filter= tmp;
if(h->deblocking_filter < 2)
- h->deblocking_filter ^= 1; // 1<->0
+ 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)
- {
+ 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 != FF_I_TYPE)
- || (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
- || (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 != FF_I_TYPE)
+ ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
+ ||(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. */
h->deblocking_filter = 2;
- }
- else
- {
+ } else {
h0->max_contexts = 1;
- if(!h0->single_decode_warning)
- {
+ 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;
}
@@ -2460,79 +2104,72 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
return 1; // deblocking switched inside frame
}
}
- 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]);
+ 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]);
#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, ?);
+ 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
h0->last_slice_type = slice_type;
h->slice_num = ++h0->current_slice;
- if(h->slice_num >= MAX_SLICES)
- {
+ 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;
- if(h->ref_list[j][i].data[0])
- {
+ 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].data[0]){
int k;
- uint8_t *base = h->ref_list[j][i].base[0];
- for(k = 0; k < h->short_ref_count; k++)
- if(h->short_ref[k]->base[0] == base)
- {
- id_list[i] = k;
+ uint8_t *base= h->ref_list[j][i].base[0];
+ for(k=0; k<h->short_ref_count; k++)
+ if(h->short_ref[k]->base[0] == base){
+ id_list[i]= k;
break;
}
- for(k = 0; k < h->long_ref_count; k++)
- if(h->long_ref[k] && h->long_ref[k]->base[0] == base)
- {
- id_list[i] = h->short_ref_count + k;
+ for(k=0; k<h->long_ref_count; k++)
+ if(h->long_ref[k] && h->long_ref[k]->base[0] == base){
+ 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].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].reference & 3);
+ ref2frm[0]=
+ ref2frm[1]= -1;
+ for(i=0; i<16; i++)
+ ref2frm[i+2]= 4*id_list[i]
+ +(h->ref_list[j][i].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].reference&3);
}
- h->emu_edge_width = (s->flags & CODEC_FLAG_EMU_EDGE) ? 0 : 16;
- h->emu_edge_height = (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
+ h->emu_edge_width= (s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16;
+ h->emu_edge_height= (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
- s->avctx->refs = h->sps.ref_frame_count;
+ s->avctx->refs= h->sps.ref_frame_count;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ 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_pict_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],
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->use_weight==1 && h->use_weight_chroma ? "c" : "",
h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
- );
+ );
}
return 0;
@@ -2540,66 +2177,51 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
int ff_h264_get_slice_type(const H264Context *h)
{
- switch(h->slice_type)
- {
- case FF_P_TYPE:
- return 0;
- case FF_B_TYPE:
- return 1;
- case FF_I_TYPE:
- return 2;
- case FF_SP_TYPE:
- return 3;
- case FF_SI_TYPE:
- return 4;
- default:
- return -1;
+ switch (h->slice_type) {
+ case FF_P_TYPE: return 0;
+ case FF_B_TYPE: return 1;
+ case FF_I_TYPE: return 2;
+ case FF_SP_TYPE: return 3;
+ case FF_SI_TYPE: return 4;
+ default: return -1;
}
}
-static void loop_filter(H264Context *h)
-{
+static void loop_filter(H264Context *h){
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 end_mb_y= s->mb_y + FRAME_MBAFF;
+ const int old_slice_type= h->slice_type;
- if(h->deblocking_filter)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- for(mb_y = end_mb_y - FRAME_MBAFF; mb_y <= end_mb_y; mb_y++)
- {
+ if(h->deblocking_filter) {
+ for(mb_x= 0; mb_x<s->mb_width; mb_x++){
+ for(mb_y=end_mb_y - FRAME_MBAFF; mb_y<= end_mb_y; mb_y++){
int list, 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.mb_type[mb_xy];
- h->list_count = h->list_counts[mb_xy];
+ 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.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.data[0] + (mb_x + mb_y * s->linesize) * 16;
+ s->mb_x= mb_x;
+ s->mb_y= mb_y;
+ dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize ) * 16;
dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8;
dest_cr = s->current_picture.data[2] + (mb_x + mb_y * s->uvlinesize) * 8;
- //FIXME simplify above
+ //FIXME simplify above
- if(MB_FIELD)
- {
+ if (MB_FIELD) {
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 * 7;
- dest_cr -= s->uvlinesize * 7;
+ if(mb_y&1){ //FIXME move out of this function?
+ dest_y -= s->linesize*15;
+ dest_cb-= s->uvlinesize*7;
+ dest_cr-= s->uvlinesize*7;
}
- }
- else
- {
+ } else {
linesize = h->mb_linesize = s->linesize;
uvlinesize = h->mb_uvlinesize = s->uvlinesize;
}
@@ -2609,160 +2231,134 @@ static void loop_filter(H264Context *h)
h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
- if(FRAME_MBAFF)
- {
- ff_h264_filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
- }
- else
- {
+ if (FRAME_MBAFF) {
+ 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);
}
}
}
}
- h->slice_type = old_slice_type;
- s->mb_x = 0;
- s->mb_y = end_mb_y - FRAME_MBAFF;
+ h->slice_type= old_slice_type;
+ s->mb_x= 0;
+ s->mb_y= end_mb_y - FRAME_MBAFF;
}
-static int decode_slice(struct AVCodecContext *avctx, void *arg)
-{
+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 ? (AC_END | AC_ERROR) : 0x7F;
+ const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
- 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));
+ (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(;;)
- {
+ for(;;){
//START_TIMER
int ret = ff_h264_decode_mb_cabac(h);
int eos;
//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 ?
- {
+ if( ret >= 0 && FRAME_MBAFF ) { //FIXME optimal? or let mb_decode decode 16x32 ?
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);
+ eos = get_cabac_terminate( &h->cabac );
- if(ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2)
- {
+ 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 (%Id)\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, (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
- if(++s->mb_x >= s->mb_width)
- {
+ if( ++s->mb_x >= s->mb_width ) {
s->mb_x = 0;
loop_filter(h);
- ff_draw_horiz_band(s, 16 * s->mb_y, 16);
+ ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
- if(FIELD_OR_MBAFF_PICTURE)
- {
+ if(FIELD_OR_MBAFF_PICTURE) {
++s->mb_y;
}
}
- if(eos || s->mb_y >= s->mb_height)
- {
+ 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, (AC_END | DC_END | MV_END)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}
}
- }
- else
- {
- for(;;)
- {
+ } else {
+ 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 ?
- {
+ if(ret>=0 && FRAME_MBAFF){ //FIXME optimal? or let mb_decode decode 16x32 ?
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)
- {
+ 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, (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
- if(++s->mb_x >= s->mb_width)
- {
- s->mb_x = 0;
+ if(++s->mb_x >= s->mb_width){
+ s->mb_x=0;
loop_filter(h);
- ff_draw_horiz_band(s, 16 * s->mb_y, 16);
+ ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
- if(FIELD_OR_MBAFF_PICTURE)
- {
+ if(FIELD_OR_MBAFF_PICTURE) {
++s->mb_y;
}
- if(s->mb_y >= s->mb_height)
- {
+ 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_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, (AC_END | DC_END | MV_END)&part_mask);
+ if(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, (AC_END|DC_END|MV_END)&part_mask);
return 0;
- }
- else
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END)&part_mask);
+ }else{
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
}
}
- if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->mb_skip_run <= 0)
- {
+ if(get_bits_count(&s->gb) >= s->gb.size_in_bits && 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_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, (AC_END | DC_END | MV_END)&part_mask);
+ if(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, (AC_END|DC_END|MV_END)&part_mask);
return 0;
- }
- else
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ }else{
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
@@ -2771,60 +2367,48 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
}
#if 0
- for(; s->mb_y < s->mb_height; s->mb_y++)
- {
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
- int ret = decode_mb(h);
+ for(;s->mb_y < s->mb_height; s->mb_y++){
+ for(;s->mb_x < s->mb_width; s->mb_x++){
+ int ret= decode_mb(h);
ff_h264_hl_decode_mb(h);
- if(ret < 0)
- {
+ if(ret<0){
av_log(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, (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
- if(++s->mb_x >= s->mb_width)
- {
- s->mb_x = 0;
- if(++s->mb_y >= s->mb_height)
- {
- if(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, (AC_END | DC_END | MV_END)&part_mask);
+ if(++s->mb_x >= s->mb_width){
+ s->mb_x=0;
+ if(++s->mb_y >= s->mb_height){
+ if(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, (AC_END|DC_END|MV_END)&part_mask);
return 0;
- }
- else
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END)&part_mask);
+ }else{
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
}
}
- if(get_bits_count(s-> ? gb) >= s->gb ? .size_in_bits)
- {
- if(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, (AC_END | DC_END | MV_END)&part_mask);
+ if(get_bits_count(s->?gb) >= s->gb?.size_in_bits){
+ if(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, (AC_END|DC_END|MV_END)&part_mask);
return 0;
- }
- else
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ }else{
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
}
}
- s->mb_x = 0;
- ff_draw_horiz_band(s, 16 * s->mb_y, 16);
+ s->mb_x=0;
+ ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
#endif
return -1; //not reached
@@ -2848,8 +2432,7 @@ static void copy_context_to_mb(H264mb *dst, H264Context *src)
memcpy(dst->intra4x4_pred_mode_cache, src->intra4x4_pred_mode_cache, sizeof(src->intra4x4_pred_mode_cache));
memcpy(dst->non_zero_count_cache, src->non_zero_count_cache, sizeof(src->non_zero_count_cache));
- if(src->slice_type != FF_I_TYPE && src->slice_type != FF_SI_TYPE)
- {
+ if(src->slice_type != FF_I_TYPE && src->slice_type != FF_SI_TYPE) {
memcpy(dst->sub_mb_type, src->sub_mb_type, sizeof(src->sub_mb_type));
memcpy(dst->mv_cache, src->mv_cache, sizeof(src->mv_cache));
memcpy(dst->mvd_cache, src->mvd_cache, sizeof(src->mvd_cache));
@@ -2861,7 +2444,7 @@ static void copy_context_to_mb(H264mb *dst, H264Context *src)
dst->left_mb_xy[0] = src->left_mb_xy[0];
dst->left_mb_xy[1] = src->left_mb_xy[1];
dst->cbp = src->cbp;
-
+
dst->mb_xy = src->mb_xy;
/* FIXME not necessary? */
@@ -2885,8 +2468,7 @@ static void copy_mb_to_context(H264Context *dst, H264mb *src)
memcpy(dst->intra4x4_pred_mode_cache, src->intra4x4_pred_mode_cache, sizeof(src->intra4x4_pred_mode_cache));
memcpy(dst->non_zero_count_cache, src->non_zero_count_cache, sizeof(src->non_zero_count_cache));
- if(dst->slice_type != FF_I_TYPE && dst->slice_type != FF_SI_TYPE)
- {
+ if(dst->slice_type != FF_I_TYPE && dst->slice_type != FF_SI_TYPE) {
memcpy(dst->sub_mb_type, src->sub_mb_type, sizeof(src->sub_mb_type));
memcpy(dst->mv_cache, src->mv_cache, sizeof(src->mv_cache));
memcpy(dst->mvd_cache, src->mvd_cache, sizeof(src->mvd_cache));
@@ -2900,7 +2482,7 @@ static void copy_mb_to_context(H264Context *dst, H264mb *src)
dst->left_mb_xy[0] = src->left_mb_xy[0];
dst->left_mb_xy[1] = src->left_mb_xy[1];
dst->cbp = src->cbp;
-
+
dst->mb_xy = src->mb_xy;
/* FIXME not necessary? */
@@ -2915,29 +2497,25 @@ static int decode_mb_parallelized(struct AVCodecContext *avctx, void *arg)
H264Context *h = *(void**)arg;
H264Context *h0 = avctx->priv_data;
MpegEncContext * const s = &h->s;
- const int part_mask = s->partitioned_frame ? (AC_END | AC_ERROR) : 0x7F;
+ const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
int i, ret;
- if(h0 == h)
- {
+ if(h0 == h) {
/* first thread does entropy decode */
- for(i = 0; i < MAXBLOCKS; i++)
- {
+ for(i = 0; i < MAXBLOCKS; i++) {
ret = ff_h264_decode_mb_cabac(h);
- if(ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2)
- {
+ 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);
+ "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,
- (AC_ERROR | DC_ERROR | MV_ERROR)&part_mask);
+ (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
copy_context_to_mb(h->blocks[h->phaze] + i, h);
- if(++s->mb_x >= s->mb_width)
- {
+ if(++s->mb_x >= s->mb_width) {
s->mb_x = 0;
++s->mb_y;
}
@@ -2947,13 +2525,10 @@ static int decode_mb_parallelized(struct AVCodecContext *avctx, void *arg)
}
return 0;
- }
- else
- {
+ } else {
/* second thread does hl decode */
- for(i = 0; i < h0->todecode; i++)
- {
+ for(i = 0; i < h0->todecode; i++) {
copy_mb_to_context(h, h0->blocks[!h0->phaze] + i);
ff_h264_hl_decode_mb(h);
}
@@ -2961,62 +2536,58 @@ static int decode_mb_parallelized(struct AVCodecContext *avctx, void *arg)
}
}
-static int decode_slice2(struct AVCodecContext *avctx, void *arg)
-{
+static int decode_slice2(struct AVCodecContext *avctx, void *arg){
H264Context *h = *(void**)arg;
MpegEncContext * const s = &h->s;
- const int part_mask = s->partitioned_frame ? (AC_END | AC_ERROR) : 0x7F;
+ const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
H264Context *h2 = h->thread_context[1];
int i, rv[2];
h->is_complex = FRAME_MBAFF || s->picture_structure != PICT_FRAME || s->codec_id != CODEC_ID_H264 ||
- (CONFIG_GRAY && (s->flags & CODEC_FLAG_GRAY)) || (CONFIG_H264_ENCODER && s->encoding);
+ (CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)) || (CONFIG_H264_ENCODER && s->encoding);
clone_slice(h2, h, 1);
- if(!h->blocks[0])
- {
+ if(!h->blocks[0]) {
h->blocks[0] = av_malloc(sizeof(H264mb) * MAXBLOCKS);
h->blocks[1] = av_malloc(sizeof(H264mb) * MAXBLOCKS);
}
- s->mb_skip_run = -1;
+ s->mb_skip_run= -1;
/* 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,
- (s->gb.size_in_bits - get_bits_count(&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,
+ ( s->gb.size_in_bits - get_bits_count(&s->gb) + 7)/8);
ff_h264_init_cabac_states(h);
h->todecode = 0;
- while(1)
- {
- avctx->execute(avctx, (void *)decode_mb_parallelized,
- (void **)h->thread_context, rv, 2, sizeof(void*));
+ while(1) {
+ avctx->execute(avctx, (void *)decode_mb_parallelized,
+ (void **)h->thread_context, rv, 2, sizeof(void*));
- h->phaze = !h->phaze;
+ h->phaze = !h->phaze;
- if(rv[0] == -1)
- return -1;
- else if(rv[0] == 0)
- h->todecode = MAXBLOCKS;
- else
- break;
+ if(rv[0] == -1)
+ return -1;
+ else if(rv[0] == 0)
+ h->todecode = MAXBLOCKS;
+ else
+ break;
}
- for(i = 0; i < rv[0]; i++)
- {
- copy_mb_to_context(h2, h->blocks[!h->phaze] + i);
- ff_h264_hl_decode_mb(h2);
+ for(i = 0; i < rv[0]; i++) {
+ copy_mb_to_context(h2, h->blocks[!h->phaze] + i);
+ ff_h264_hl_decode_mb(h2);
}
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, (AC_END | DC_END | MV_END)&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}
#endif /* ENABLE_SLICE_MT_PATCH */
@@ -3027,33 +2598,25 @@ static int decode_slice2(struct AVCodecContext *avctx, void *arg)
* @param h h264 master context
* @param context_count number of contexts to execute
*/
-static void execute_decode_slices(H264Context *h, int context_count)
-{
+static void execute_decode_slices(H264Context *h, int context_count){
MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx = s->avctx;
+ AVCodecContext * const avctx= s->avctx;
H264Context *hx;
int i;
- if(context_count == 1)
- {
+ if(context_count == 1) {
/* ffdshow custom code, interlacing is not supported in multithreading mode */
-#if ENABLE_SLICE_MT_PATCH
- if(avctx->thread_count > 1 && h->pps.cabac && !(FIELD_OR_MBAFF_PICTURE))
- {
+ #if ENABLE_SLICE_MT_PATCH
+ if(avctx->thread_count > 1 && h->pps.cabac && !(FIELD_OR_MBAFF_PICTURE)) {
decode_slice2(avctx, &h);
- }
- else
- {
+ } else {
decode_slice(avctx, &h);
}
-#else
+ #else
decode_slice(avctx, &h);
-#endif
- }
- else
- {
- for(i = 1; i < context_count; i++)
- {
+ #endif
+ } else {
+ for(i = 1; i < context_count; i++) {
hx = h->thread_context[i];
hx->s.error_recognition = avctx->error_recognition;
hx->s.error_count = 0;
@@ -3074,33 +2637,29 @@ static void execute_decode_slices(H264Context *h, int context_count)
}
-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){
MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx = s->avctx;
- int buf_index = 0;
+ AVCodecContext * const avctx= s->avctx;
+ int buf_index=0;
H264Context *hx; ///< thread context
int context_count = 0;
- int next_avc = h->is_avc ? 0 : buf_size;
+ int next_avc= h->is_avc ? 0 : buf_size;
h->max_contexts = avctx->thread_count;
#if 0
int i;
- for(i = 0; i < 50; i++)
- {
- av_log(NULL, AV_LOG_ERROR, "%02X ", buf[i]);
+ for(i=0; i<50; i++){
+ av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]);
}
#endif
- 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;
+ if (!s->first_field)
+ s->current_picture_ptr= NULL;
ff_h264_reset_sei(h);
}
- for(;;)
- {
+ for(;;){
int consumed;
int dst_length;
int bit_length;
@@ -3108,109 +2667,95 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
int i, nalsize = 0;
int err;
- if(buf_index >= next_avc)
- {
+ if(buf_index >= next_avc) {
if(buf_index >= buf_size) break;
nalsize = 0;
for(i = 0; i < h->nal_length_size; i++)
nalsize = (nalsize << 8) | buf[buf_index++];
- if(nalsize <= 1 || nalsize > buf_size - buf_index)
- {
- if(nalsize == 1)
- {
+ if(nalsize <= 1 || nalsize > buf_size - buf_index){
+ if(nalsize == 1){
buf_index++;
continue;
- }
- else
- {
+ }else{
av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
break;
}
}
- next_avc = buf_index + nalsize;
- }
- else
- {
+ next_avc= buf_index + nalsize;
+ } else {
// start code prefix search
- for(; buf_index + 3 < next_avc; buf_index++)
- {
+ 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) break;
+ if(buf_index+3 >= buf_size) break;
- buf_index += 3;
+ 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)
- {
+ ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index);
+ if (ptr==NULL || dst_length < 0){
return -1;
}
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));
+ 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)
- {
+ 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)
- {
+ 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;
/* ffdshow custom code */
- if((s->hurry_up == 1 && hx->nal_ref_idc == 0) //FIXME do not discard SEI id
- || (avctx->skip_frame >= AVDISCARD_NONREF && hx->nal_ref_idc == 0))
+ if( (s->hurry_up == 1 && hx->nal_ref_idc == 0) //FIXME do not discard SEI id
+ ||(avctx->skip_frame >= AVDISCARD_NONREF && hx->nal_ref_idc == 0))
continue;
-again:
+ again:
err = 0;
- switch(hx->nal_unit_type)
- {
+ switch(hx->nal_unit_type){
case NAL_IDR_SLICE:
- if(h->nal_unit_type != 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");
return -1;
}
idr(h); //FIXME ensure we don't loose 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->intra_gb_ptr=
+ hx->inter_gb_ptr= &hx->s.gb;
hx->s.data_partitioning = 0;
if((err = decode_slice_header(hx, h)))
- break;
+ break;
s->current_picture_ptr->key_frame |=
- (hx->nal_unit_type == NAL_IDR_SLICE) ||
- (h->sei_recovery_frame_cnt >= 0);
- if(hx->redundant_pic_count == 0 && hx->s.hurry_up < 5
+ (hx->nal_unit_type == NAL_IDR_SLICE) ||
+ (h->sei_recovery_frame_cnt >= 0);
+ if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
- && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos != FF_B_TYPE)
- && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos == FF_I_TYPE)
- && avctx->skip_frame < AVDISCARD_ALL)
- {
- context_count++;
+ && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
+ && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
+ && avctx->skip_frame < AVDISCARD_ALL){
+ 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->intra_gb_ptr=
+ hx->inter_gb_ptr= NULL;
- if((err = decode_slice_header(hx, h)) < 0)
+ if ((err = decode_slice_header(hx, h)) < 0)
break;
hx->s.data_partitioning = 1;
@@ -3218,18 +2763,18 @@ again:
break;
case NAL_DPB:
init_get_bits(&hx->intra_gb, ptr, bit_length);
- hx->intra_gb_ptr = &hx->intra_gb;
+ 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;
+ hx->inter_gb_ptr= &hx->inter_gb;
- if(hx->redundant_pic_count == 0 && hx->intra_gb_ptr && hx->s.data_partitioning
+ if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
&& s->context_initialized
&& s->hurry_up < 5
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
- && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos != FF_B_TYPE)
- && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos == FF_I_TYPE)
+ && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
+ && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
&& avctx->skip_frame < AVDISCARD_ALL)
context_count++;
break;
@@ -3241,11 +2786,11 @@ again:
init_get_bits(&s->gb, ptr, bit_length);
ff_h264_decode_seq_parameter_set(h);
- if(s->flags & CODEC_FLAG_LOW_DELAY)
- s->low_delay = 1;
+ if(s->flags& CODEC_FLAG_LOW_DELAY)
+ s->low_delay=1;
if(avctx->has_b_frames < 2)
- avctx->has_b_frames = !s->low_delay;
+ avctx->has_b_frames= !s->low_delay;
break;
case NAL_PPS:
init_get_bits(&s->gb, ptr, bit_length);
@@ -3264,16 +2809,14 @@ again:
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)
- {
+ if(context_count == h->max_contexts) {
execute_decode_slices(h, context_count);
context_count = 0;
}
- if(err < 0)
+ if (err < 0)
av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
- else if(err == 1)
- {
+ 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
@@ -3292,92 +2835,82 @@ again:
/**
* returns 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,
- const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
AVFrame *pict = data;
int buf_index;
- 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 */
- if(buf_size == 0)
- {
+ /* end of stream, output what is still in the buffers */
+ if (buf_size == 0) {
Picture *out;
int i, out_idx;
//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]->key_frame && !h->delayed_pic[i]->mmco_reset; i++)
- if(h->delayed_pic[i]->poc < out->poc)
- {
+ for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->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++)
+ for(i=out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i+1];
- if(out)
- {
+ if(out){
*data_size = sizeof(AVFrame);
- *pict = *(AVFrame*)out;
+ *pict= *(AVFrame*)out;
}
return 0;
}
/* ffdshow custom code (begin) */
- if(h->is_avc && !h->got_avcC)
- {
+ if(h->is_avc && !h->got_avcC) {
int i, cnt, nalsize;
- unsigned char *p = avctx->extradata, *pend = p + avctx->extradata_size;
+ unsigned char *p = avctx->extradata, *pend=p+avctx->extradata_size;
h->nal_length_size = 2;
cnt = 1;
- for(i = 0; i < cnt; i++)
- {
+ for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
- if(decode_nal_units(h, p, nalsize) < 0)
- {
+ if(decode_nal_units(h, p, nalsize) < 0) {
av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
return -1;
}
p += nalsize;
}
// Decode pps from avcC
- for(i = 0; p < pend - 2; i++)
- {
+ for (i = 0; p<pend-2; i++) {
nalsize = AV_RB16(p) + 2;
- if(decode_nal_units(h, p, nalsize) != nalsize)
- {
+ if(decode_nal_units(h, p, nalsize) != nalsize) {
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
- h->nal_length_size = avctx->nal_length_size ? avctx->nal_length_size : 4; //((*(((char*)(avctx->extradata))+4))&0x03)+1;
+ h->nal_length_size = avctx->nal_length_size?avctx->nal_length_size:4;//((*(((char*)(avctx->extradata))+4))&0x03)+1;
// Do not reparse avcC
h->got_avcC = 1;
}
- if(!h->got_avcC && !h->is_avc && s->avctx->extradata_size)
- {
+ if(!h->got_avcC && !h->is_avc && s->avctx->extradata_size){
if(decode_nal_units(h, s->avctx->extradata, s->avctx->extradata_size) < 0)
return -1;
h->got_avcC = 1;
@@ -3385,42 +2918,36 @@ static int decode_frame(AVCodecContext *avctx,
}
/* ffdshow custom code (end) */
- buf_index = decode_nal_units(h, buf, buf_size);
+ buf_index=decode_nal_units(h, buf, buf_size);
if(buf_index < 0)
return -1;
- if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr)
- {
- if(avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
+ if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
+ if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) 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) || (s->mb_y >= s->mb_height && s->mb_height)){
Picture *out = s->current_picture_ptr;
Picture *cur = s->current_picture_ptr;
int i, pics, out_of_order, out_idx;
field_end(h);
- if(cur->field_poc[0] == INT_MAX || cur->field_poc[1] == INT_MAX)
- {
+ if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) {
/* Wait for second field. */
*data_size = 0;
- }
- else
- {
+ } else {
cur->interlaced_frame = 0;
cur->repeat_pict = 0;
/* Signal interlacing information externally. */
/* 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;
@@ -3430,7 +2957,7 @@ static int decode_frame(AVCodecContext *avctx,
break;
case SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP:
- if(FIELD_OR_MBAFF_PICTURE)
+ if (FIELD_OR_MBAFF_PICTURE)
cur->interlaced_frame = 1;
else
// try to flag soft telecine progressive
@@ -3451,34 +2978,26 @@ static int decode_frame(AVCodecContext *avctx,
break;
}
- if((h->sei_ct_type & 3) && h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
- cur->interlaced_frame = (h->sei_ct_type & (1 << 1)) != 0;
- }
- else
- {
+ if ((h->sei_ct_type & 3) && h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
+ cur->interlaced_frame = (h->sei_ct_type & (1<<1)) != 0;
+ }else{
/* Derive interlacing flag from used decoding process. */
cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE;
}
h->prev_interlaced_frame = cur->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->top_field_first = cur->field_poc[0] < cur->field_poc[1];
- }
- else
- {
- if(cur->interlaced_frame || h->sps.pic_struct_present_flag)
- {
+ }else{
+ if(cur->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)
+ || h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->top_field_first = 1;
else
cur->top_field_first = 0;
- }
- else
- {
+ }else{
/* Most likely progressive */
cur->top_field_first = 0;
}
@@ -3488,22 +3007,20 @@ static int decode_frame(AVCodecContext *avctx,
cur->video_full_range_flag = h->sps.full_range;
cur->YCbCr_RGB_matrix_coefficients = h->sps.colorspace;
- //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)
- {
+ && s->avctx->has_b_frames < h->sps.num_reorder_frames){
s->avctx->has_b_frames = h->sps.num_reorder_frames;
s->low_delay = 0;
}
- if(s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
- && !h->sps.bitstream_restriction_flag)
- {
- s->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT;
- s->low_delay = 0;
+ if( s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
+ && !h->sps.bitstream_restriction_flag){
+ s->avctx->has_b_frames= MAX_DELAYED_PIC_COUNT;
+ s->low_delay= 0;
}
pics = 0;
@@ -3517,47 +3034,40 @@ static int decode_frame(AVCodecContext *avctx,
out = h->delayed_pic[0];
out_idx = 0;
- for(i = 1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && !h->delayed_pic[i]->mmco_reset; i++)
- if(h->delayed_pic[i]->poc < out->poc)
- {
+ for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->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;
}
if(s->avctx->has_b_frames == 0 && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset))
- h->outputed_poc = INT_MIN;
+ h->outputed_poc= INT_MIN;
out_of_order = out->poc < h->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)
- || (s->low_delay &&
- ((h->outputed_poc != INT_MIN && out->poc > h->outputed_poc + 2)
- || cur->pict_type == FF_B_TYPE)))
+ else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT)
+ || (s->low_delay &&
+ ((h->outputed_poc != INT_MIN && out->poc > h->outputed_poc + 2)
+ || cur->pict_type == FF_B_TYPE)))
{
s->low_delay = 0;
s->avctx->has_b_frames++;
}
- if(out_of_order || pics > s->avctx->has_b_frames)
- {
+ if(out_of_order || pics > s->avctx->has_b_frames){
out->reference &= ~DELAYED_PIC_REF;
- for(i = out_idx; h->delayed_pic[i]; i++)
+ for(i=out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i+1];
}
- if(!out_of_order && pics > s->avctx->has_b_frames)
- {
+ if(!out_of_order && pics > s->avctx->has_b_frames){
*data_size = sizeof(AVFrame);
- if(out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset))
- {
+ if(out_idx==0 && h->delayed_pic[0] && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset)) {
h->outputed_poc = INT_MIN;
- }
- else
+ } else
h->outputed_poc = out->poc;
- *pict = *(AVFrame*)out;
- }
- else
- {
+ *pict= *(AVFrame*)out;
+ }else{
av_log(avctx, AV_LOG_DEBUG, "no picture\n");
}
}
@@ -3583,7 +3093,7 @@ static int decode_frame(AVCodecContext *avctx,
* @return 0: no recovery point, 1:I-frame 2:Recovery Point SEI (GDR), 3:IDR, -1:error
*/
int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size, int *recovery_frame_cnt)
+ const uint8_t *buf, int buf_size, int *recovery_frame_cnt)
{
H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
@@ -3594,8 +3104,7 @@ int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
h->nal_length_size = avctx->nal_length_size ? avctx->nal_length_size : 4;
- for(;;)
- {
+ for(;;){
int consumed;
int dst_length;
int bit_length;
@@ -3603,39 +3112,31 @@ int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
int i, nalsize = 0;
int err;
- if(h->is_avc)
- {
+ if(h->is_avc) {
if(buf_index >= buf_size) break;
nalsize = 0;
for(i = 0; i < h->nal_length_size; i++)
nalsize = (nalsize << 8) | buf[buf_index++];
- if(nalsize <= 1 || (nalsize + buf_index > buf_size))
- {
- if(nalsize == 1)
- {
+ if(nalsize <= 1 || (nalsize+buf_index > buf_size)){
+ if(nalsize == 1){
buf_index++;
continue;
- }
- else
- {
+ }else{
av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
break;
}
}
- }
- else
- {
+ } else {
// start code prefix search
- for(; buf_index + 3 < buf_size; buf_index++)
- {
+ for(; buf_index + 3 < buf_size; 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) break;
+ if(buf_index+3 >= buf_size) break;
- buf_index += 3;
+ buf_index+=3;
}
hx = h->thread_context[0];
@@ -3643,34 +3144,30 @@ int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
// h->nal_ref_idc = buf[buf_index] >> 5;
// h->nal_unit_type = src[buf_index] & 0x1F;
- ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, h->is_avc ? nalsize : buf_size - buf_index);
- if(ptr == NULL || dst_length < 0)
- {
+ ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, h->is_avc ? nalsize : buf_size - buf_index);
+ if (ptr==NULL || dst_length < 0){
return -1;
}
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));
+ bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));
- if(h->is_avc && (nalsize != consumed))
- {
+ if (h->is_avc && (nalsize != consumed)){
av_log(h->s.avctx, AV_LOG_ERROR, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize);
- consumed = nalsize;
+ consumed= nalsize;
}
buf_index += consumed;
- switch(hx->nal_unit_type)
- {
+ switch(hx->nal_unit_type){
case NAL_IDR_SLICE:
return 3;
case NAL_SEI:
- if(ptr[0] == 6/* Recovery Point SEI */)
- {
+ if (ptr[0] == 6/* Recovery Point SEI */){
init_get_bits(&s->gb, ptr, bit_length);
ff_h264_decode_sei(h);
- if(found < 2)
+ if (found < 2)
found = 2;
break;
}
@@ -3679,11 +3176,11 @@ int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
init_get_bits(&s->gb, ptr, bit_length);
ff_h264_decode_seq_parameter_set(h);
- if(s->flags & CODEC_FLAG_LOW_DELAY)
- s->low_delay = 1;
+ if(s->flags& CODEC_FLAG_LOW_DELAY)
+ s->low_delay=1;
if(avctx->has_b_frames < 2)
- avctx->has_b_frames = !s->low_delay;
+ avctx->has_b_frames= !s->low_delay;
break;
case NAL_PPS:
init_get_bits(&s->gb, ptr, bit_length);
@@ -3696,24 +3193,23 @@ int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
int primary_pic_type;
init_get_bits(&s->gb, ptr, bit_length);
primary_pic_type = get_bits(&s->gb, 3);
- if(found == 0 && (primary_pic_type == 0 || primary_pic_type == 3)) // I-frame (all I/SI slices)
+ if (found == 0 && (primary_pic_type == 0 || primary_pic_type == 3)) // I-frame (all I/SI slices)
found = 1;
break;
}
case NAL_SLICE:
case NAL_DPA:
// decode part of slice header and find I frame
- if(found == 0)
- {
+ if (found == 0){
unsigned int slice_type;
init_get_bits(&s->gb, ptr, bit_length);
get_ue_golomb(&s->gb); // first_mb_in_slice
- slice_type = get_ue_golomb(&s->gb);
- if(slice_type == 2 || slice_type == 4 || slice_type == 7 || slice_type == 9) // I/SI slice
- Islice_detected = 1;
+ slice_type= get_ue_golomb(&s->gb);
+ if (slice_type == 2 || slice_type == 4 || slice_type == 7 || slice_type == 9) // I/SI slice
+ Islice_detected = 1;
else
- return 0;
+ return 0;
break;
}
case NAL_DPB:
@@ -3729,8 +3225,8 @@ int avcodec_h264_search_recovery_point(AVCodecContext *avctx,
}
}
- if(found == 0 && Islice_detected)
- found = 1;
+ if (found == 0 && Islice_detected)
+ found = 1;
*recovery_frame_cnt = h->sei_recovery_frame_cnt;
return found;
}
@@ -3764,8 +3260,7 @@ av_cold int ff_h264_decode_end(AVCodecContext *avctx)
}
-AVCodec h264_decoder =
-{
+AVCodec h264_decoder = {
"h264",
CODEC_TYPE_VIDEO,
CODEC_ID_H264,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.h
index 936739e97..aaa704fd5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.h
@@ -109,9 +109,8 @@
/* NAL unit types */
-enum
-{
- NAL_SLICE = 1,
+enum {
+ NAL_SLICE=1,
NAL_DPA,
NAL_DPB,
NAL_DPC,
@@ -124,14 +123,13 @@ enum
NAL_END_STREAM,
NAL_FILLER_DATA,
NAL_SPS_EXT,
- NAL_AUXILIARY_SLICE = 19
+ NAL_AUXILIARY_SLICE=19
};
/**
* SEI message types
*/
-typedef enum
-{
+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
@@ -141,8 +139,7 @@ typedef enum
/**
* pic_struct in picture timing SEI message
*/
-typedef enum
-{
+typedef enum {
SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
@@ -157,8 +154,7 @@ typedef enum
/**
* Sequence parameter set
*/
-typedef struct SPS
-{
+typedef struct SPS{
int profile_idc;
int level_idc;
@@ -212,13 +208,12 @@ typedef struct SPS
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
-} 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
@@ -242,14 +237,13 @@ typedef struct PPS
int slice_group_change_direction_flag;
int slice_group_change_rate_minus1;
// <== End patch MPC
-} 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,
@@ -261,8 +255,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
@@ -272,8 +265,7 @@ typedef struct MMCO
*
*/
-typedef struct H264mb
-{
+typedef struct H264mb {
int mb_x, mb_y;
int qscale;
int chroma_qp[2]; //QPc
@@ -291,13 +283,13 @@ typedef struct H264mb
int cbp;
int top_mb_xy;
int left_mb_xy[2];
-
+
int mb_xy;
unsigned int sub_mb_type[4];
DCTELEM mb[16*24];
- unsigned int top_samples_available, left_samples_available;
+ unsigned int top_samples_available,left_samples_available;
int16_t mvd_cache[2][5*8][2];
uint8_t direct_cache[5*8];
} H264mb;
@@ -306,8 +298,7 @@ typedef struct H264mb
/**
* H264Context
*/
-typedef struct H264Context
-{
+typedef struct H264Context{
MpegEncContext s;
int nal_ref_idc;
int nal_unit_type;
@@ -527,7 +518,7 @@ typedef struct H264Context
/* chroma_pred_mode for i4x4 or i16x16, else 0 */
uint8_t *chroma_pred_mode_table;
int last_qscale_diff;
- int16_t (*mvd_table[2])[2];
+ int16_t (*mvd_table[2])[2];
DECLARE_ALIGNED_16(int16_t, mvd_cache)[2][5*8][2];
uint8_t *direct_table;
uint8_t direct_cache[5*8];
@@ -627,7 +618,7 @@ typedef struct H264Context
int sei_buffering_period_present; ///< Buffering period SEI flag
int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
-#if ENABLE_SLICE_MT_PATCH
+#if ENABLE_SLICE_MT_PATCH
/* experimental */
int phaze;
int todecode;
@@ -637,18 +628,18 @@ typedef struct H264Context
/* ffdshow custom stuff */
int has_to_drop_first_non_ref; // Workaround Haali's media splitter (http://forum.doom9.org/showthread.php?p=1226434#post1226434)
- // ==> Start patch MPC
+ // ==> Start patch MPC
int sp_for_switch_flag;
int slice_qs_delta;
int slice_qp_delta;
- unsigned int first_mb_in_slice;
- int bit_offset_to_slice_data;
- int raw_slice_type;
- int64_t outputed_rtstart;
- void* dxva_slice_long;
- int ref_pic_flag;
+ unsigned int first_mb_in_slice;
+ int bit_offset_to_slice_data;
+ int raw_slice_type;
+ int64_t outputed_rtstart;
+ void* dxva_slice_long;
+ int ref_pic_flag;
// <== End patch MPC
-} H264Context;
+}H264Context;
extern const uint8_t ff_h264_chroma_qp[52];
@@ -755,8 +746,8 @@ 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.
@@ -776,52 +767,47 @@ o-o o-o
o-o o-o
*/
//This table must be here because scan8[constant] must be known at compiletime
-static const uint8_t scan8[16 + 2*4] =
-{
- 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,
- 1 + 1 * 8, 2 + 1 * 8,
- 1 + 2 * 8, 2 + 2 * 8,
- 1 + 4 * 8, 2 + 4 * 8,
- 1 + 5 * 8, 2 + 5 * 8,
+static const uint8_t scan8[16 + 2*4]={
+ 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,
+ 1+1*8, 2+1*8,
+ 1+2*8, 2+2*8,
+ 1+4*8, 2+4*8,
+ 1+5*8, 2+5*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
}
/**
* gets the chroma qp.
*/
-static inline int get_chroma_qp(H264Context *h, int t, int qscale)
-{
+static inline int get_chroma_qp(H264Context *h, int t, int qscale){
return h->pps.chroma_qp_table[t][qscale];
}
static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my);
-static void fill_decode_caches(H264Context *h, int mb_type)
-{
+static void fill_decode_caches(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
- const int mb_xy = h->mb_xy;
+ const int mb_xy= h->mb_xy;
int topleft_xy, top_xy, topright_xy, left_xy[2];
int topleft_type, top_type, topright_type, left_type[2];
const uint8_t * left_block;
- int topleft_partition = -1;
+ int topleft_partition= -1;
int i;
- static const uint8_t left_block_options[4][16] =
- {
- {0, 1, 2, 3, 7, 10, 8, 11, 7 + 0 * 8, 7 + 1 * 8, 7 + 2 * 8, 7 + 3 * 8, 2 + 0 * 8, 2 + 3 * 8, 2 + 1 * 8, 2 + 2 * 8},
- {2, 2, 3, 3, 8, 11, 8, 11, 7 + 2 * 8, 7 + 2 * 8, 7 + 3 * 8, 7 + 3 * 8, 2 + 1 * 8, 2 + 2 * 8, 2 + 1 * 8, 2 + 2 * 8},
- {0, 0, 1, 1, 7, 10, 7, 10, 7 + 0 * 8, 7 + 0 * 8, 7 + 1 * 8, 7 + 1 * 8, 2 + 0 * 8, 2 + 3 * 8, 2 + 0 * 8, 2 + 3 * 8},
- {0, 2, 0, 2, 7, 10, 7, 10, 7 + 0 * 8, 7 + 2 * 8, 7 + 0 * 8, 7 + 2 * 8, 2 + 0 * 8, 2 + 3 * 8, 2 + 0 * 8, 2 + 3 * 8}
+ static const uint8_t left_block_options[4][16]={
+ {0,1,2,3,7,10,8,11,7+0*8, 7+1*8, 7+2*8, 7+3*8, 2+0*8, 2+3*8, 2+1*8, 2+2*8},
+ {2,2,3,3,8,11,8,11,7+2*8, 7+2*8, 7+3*8, 7+3*8, 2+1*8, 2+2*8, 2+1*8, 2+2*8},
+ {0,0,1,1,7,10,7,10,7+0*8, 7+0*8, 7+1*8, 7+1*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8},
+ {0,2,0,2,7,10,7,10,7+0*8, 7+2*8, 7+0*8, 7+2*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8}
};
top_xy = mb_xy - (s->mb_stride << MB_FIELD);
@@ -830,50 +816,37 @@ static void fill_decode_caches(H264Context *h, int mb_type)
* stuff, I can't imagine that these complex rules are worth it. */
topleft_xy = top_xy - 1;
- topright_xy = top_xy + 1;
- left_xy[1] = left_xy[0] = mb_xy - 1;
+ topright_xy= top_xy + 1;
+ left_xy[1] = left_xy[0] = mb_xy-1;
left_block = left_block_options[0];
- if(FRAME_MBAFF)
- {
+ if(FRAME_MBAFF){
const int left_mb_field_flag = IS_INTERLACED(s->current_picture.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)
- {
+ if(s->mb_y&1){
+ if (left_mb_field_flag != curr_mb_field_flag) {
left_xy[1] = left_xy[0] = mb_xy - s->mb_stride - 1;
- if(curr_mb_field_flag)
- {
+ if (curr_mb_field_flag) {
left_xy[1] += s->mb_stride;
left_block = left_block_options[3];
- }
- else
- {
+ } 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
topleft_partition = 0;
left_block = left_block_options[1];
}
}
- }
- else
- {
- if(curr_mb_field_flag)
- {
- topleft_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy - 1] >> 7) & 1) - 1);
- topright_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy + 1] >> 7) & 1) - 1);
- top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ] >> 7) & 1) - 1);
+ }else{
+ if(curr_mb_field_flag){
+ topleft_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy - 1]>>7)&1)-1);
+ topright_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy + 1]>>7)&1)-1);
+ top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ]>>7)&1)-1);
}
- if(left_mb_field_flag != curr_mb_field_flag)
- {
+ if (left_mb_field_flag != curr_mb_field_flag) {
left_xy[1] = left_xy[0] = mb_xy - 1;
- if(curr_mb_field_flag)
- {
+ if (curr_mb_field_flag) {
left_xy[1] += s->mb_stride;
left_block = left_block_options[3];
- }
- else
- {
+ } else {
left_block = left_block_options[2];
}
}
@@ -883,207 +856,162 @@ static void fill_decode_caches(H264Context *h, int mb_type)
h->top_mb_xy = top_xy;
h->left_mb_xy[0] = left_xy[0];
h->left_mb_xy[1] = left_xy[1];
- topleft_type = h->slice_table[topleft_xy ] == h->slice_num ? s->current_picture.mb_type[topleft_xy] : 0;
- top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0;
- topright_type = h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy] : 0;
- left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0;
- left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0;
-
- 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[0]))
- {
- if(IS_INTERLACED(mb_type))
- {
- if(!(left_type[0] & type_mask))
- {
- h->topleft_samples_available &= 0xDFFF;
- h->left_samples_available &= 0x5FFF;
- }
- if(!(left_type[1] & type_mask))
- {
- h->topleft_samples_available &= 0xFF5F;
- h->left_samples_available &= 0xFF5F;
- }
+ topleft_type = h->slice_table[topleft_xy ] == h->slice_num ? s->current_picture.mb_type[topleft_xy] : 0;
+ top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0;
+ topright_type= h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy]: 0;
+ left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0;
+ left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0;
+
+ 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;
}
- else
- {
- int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num
- ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0;
- assert(left_xy[0] == left_xy[1]);
- if(!((left_typei & type_mask) && (left_type[0] & type_mask)))
- {
- h->topleft_samples_available &= 0xDF5F;
- h->left_samples_available &= 0x5F5F;
+ if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
+ if(IS_INTERLACED(mb_type)){
+ if(!(left_type[0] & type_mask)){
+ h->topleft_samples_available&= 0xDFFF;
+ h->left_samples_available&= 0x5FFF;
+ }
+ if(!(left_type[1] & type_mask)){
+ h->topleft_samples_available&= 0xFF5F;
+ h->left_samples_available&= 0xFF5F;
+ }
+ }else{
+ int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num
+ ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0;
+ assert(left_xy[0] == left_xy[1]);
+ if(!((left_typei & type_mask) && (left_type[0] & type_mask))){
+ h->topleft_samples_available&= 0xDF5F;
+ h->left_samples_available&= 0x5F5F;
+ }
+ }
+ }else{
+ if(!(left_type[0] & type_mask)){
+ h->topleft_samples_available&= 0xDF5F;
+ h->left_samples_available&= 0x5F5F;
}
}
- }
- else
- {
- if(!(left_type[0] & 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))
- {
- h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[top_xy][4];
- h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[top_xy][5];
- h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[top_xy][6];
- h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[top_xy][3];
- }
- else
- {
- int pred;
- if(!(top_type & type_mask))
- pred = -1;
- else
- {
- pred = 2;
- }
- 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] = pred;
- }
- for(i = 0; i < 2; i++)
- {
- if(IS_INTRA4x4(left_type[i]))
- {
- h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i] = h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]];
- h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i] = h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]];
- }
- else
- {
+ if(IS_INTRA4x4(mb_type)){
+ if(IS_INTRA4x4(top_type)){
+ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4];
+ h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5];
+ h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6];
+ h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3];
+ }else{
int pred;
- if(!(left_type[i] & type_mask))
- pred = -1;
- else
- {
- pred = 2;
+ if(!(top_type & type_mask))
+ pred= -1;
+ else{
+ pred= 2;
+ }
+ 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]= pred;
+ }
+ for(i=0; i<2; i++){
+ if(IS_INTRA4x4(left_type[i])){
+ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]];
+ h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]];
+ }else{
+ int pred;
+ if(!(left_type[i] & type_mask))
+ pred= -1;
+ else{
+ pred= 2;
+ }
+ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
+ h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= pred;
}
- h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i] =
- h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i] = pred;
}
}
}
- }
- /*
- 0 . T T. T T T T
- 1 L . .L . . . .
- 2 L . .L . . . .
- 3 . T TL . . . .
- 4 L . .L . . . .
- 5 L . .. . . . .
- */
+/*
+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)
- if(top_type)
- {
- *(uint32_t*)&h->non_zero_count_cache[4+8*0] = *(uint32_t*)&h->non_zero_count[top_xy][4+3*8];
- h->non_zero_count_cache[1+8*0] = h->non_zero_count[top_xy][1+1*8];
- h->non_zero_count_cache[2+8*0] = h->non_zero_count[top_xy][2+1*8];
-
- h->non_zero_count_cache[1+8*3] = h->non_zero_count[top_xy][1+2*8];
- h->non_zero_count_cache[2+8*3] = h->non_zero_count[top_xy][2+2*8];
- }
- else
- {
- h->non_zero_count_cache[1+8*0] =
- h->non_zero_count_cache[2+8*0] =
-
- h->non_zero_count_cache[1+8*3] =
- h->non_zero_count_cache[2+8*3] =
- *(uint32_t*)&h->non_zero_count_cache[4+8*0] = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
+ if(top_type){
+ *(uint32_t*)&h->non_zero_count_cache[4+8*0]= *(uint32_t*)&h->non_zero_count[top_xy][4+3*8];
+ h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8];
+ h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8];
+
+ h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8];
+ h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8];
+ }else {
+ h->non_zero_count_cache[1+8*0]=
+ h->non_zero_count_cache[2+8*0]=
+
+ h->non_zero_count_cache[1+8*3]=
+ h->non_zero_count_cache[2+8*3]=
+ *(uint32_t*)&h->non_zero_count_cache[4+8*0]= CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
}
- for(i = 0; i < 2; i++)
- {
- if(left_type[i])
- {
- h->non_zero_count_cache[3+8*1 + 2*8*i] = h->non_zero_count[left_xy[i]][left_block[8+0+2*i]];
- h->non_zero_count_cache[3+8*2 + 2*8*i] = h->non_zero_count[left_xy[i]][left_block[8+1+2*i]];
- h->non_zero_count_cache[0+8*1 + 8*i] = h->non_zero_count[left_xy[i]][left_block[8+4+2*i]];
- h->non_zero_count_cache[0+8*4 + 8*i] = h->non_zero_count[left_xy[i]][left_block[8+5+2*i]];
- }
- else
- {
- h->non_zero_count_cache[3+8*1 + 2*8*i] =
- h->non_zero_count_cache[3+8*2 + 2*8*i] =
- h->non_zero_count_cache[0+8*1 + 8*i] =
- h->non_zero_count_cache[0+8*4 + 8*i] = CABAC && !IS_INTRA(mb_type) ? 0 : 64;
+ for (i=0; i<2; i++) {
+ if(left_type[i]){
+ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]];
+ h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]];
+ h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]];
+ h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]];
+ }else{
+ h->non_zero_count_cache[3+8*1 + 2*8*i]=
+ h->non_zero_count_cache[3+8*2 + 2*8*i]=
+ h->non_zero_count_cache[0+8*1 + 8*i]=
+ h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
}
}
- if(CABAC)
- {
+ if( CABAC ) {
// top_cbp
- if(top_type)
- {
+ if(top_type) {
h->top_cbp = h->cbp_table[top_xy];
- }
- else if(IS_INTRA(mb_type))
- {
+ } else if(IS_INTRA(mb_type)) {
h->top_cbp = 0x1C0;
- }
- else
- {
+ } else {
h->top_cbp = 0;
}
// left_cbp
- if(left_type[0])
- {
+ if (left_type[0]) {
h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0;
- }
- else if(IS_INTRA(mb_type))
- {
+ } else if(IS_INTRA(mb_type)) {
h->left_cbp = 0x1C0;
- }
- else
- {
+ } else {
h->left_cbp = 0;
}
- if(left_type[0])
- {
- h->left_cbp |= ((h->cbp_table[left_xy[0]] >> ((left_block[0] & (~1)) + 1)) & 0x1) << 1;
+ if (left_type[0]) {
+ h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1;
}
- if(left_type[1])
- {
- h->left_cbp |= ((h->cbp_table[left_xy[1]] >> ((left_block[2] & (~1)) + 1)) & 0x1) << 3;
+ if (left_type[1]) {
+ h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3;
}
}
#if 1
- if(IS_INTER(mb_type) || IS_DIRECT(mb_type))
- {
+ if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){
int list;
- for(list = 0; list < h->list_count; list++)
- {
- if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type))
- {
+ for(list=0; list<h->list_count; list++){
+ if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type)){
/*if(!h->mv_cache_clean[list]){
memset(h->mv_cache [list], 0, 8*5*2*sizeof(int16_t)); //FIXME clean only input? clean at all?
memset(h->ref_cache[list], PART_NOT_AVAILABLE, 8*5*sizeof(int8_t));
@@ -1091,165 +1019,135 @@ static void fill_decode_caches(H264Context *h, int mb_type)
}*/
continue;
}
- h->mv_cache_clean[list] = 0;
-
- if(USES_LIST(top_type, list))
- {
- const int b_xy = h->mb2b_xy[top_xy] + 3 * h->b_stride;
- const int b8_xy = h->mb2b8_xy[top_xy] + h->b8_stride;
- AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1 * 8], s->current_picture.motion_val[list][b_xy + 0]);
- h->ref_cache[list][scan8[0] + 0 - 1 * 8] =
- h->ref_cache[list][scan8[0] + 1 - 1 * 8] = s->current_picture.ref_index[list][b8_xy + 0];
- h->ref_cache[list][scan8[0] + 2 - 1 * 8] =
- h->ref_cache[list][scan8[0] + 3 - 1 * 8] = s->current_picture.ref_index[list][b8_xy + 1];
- }
- else
- {
- AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1 * 8]);
- *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1 * 8] = ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE) & 0xFF) * 0x01010101;
+ h->mv_cache_clean[list]= 0;
+
+ if(USES_LIST(top_type, list)){
+ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
+ const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride;
+ AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
+ h->ref_cache[list][scan8[0] + 0 - 1*8]=
+ h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0];
+ h->ref_cache[list][scan8[0] + 2 - 1*8]=
+ h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1];
+ }else{
+ AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
+ *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101;
}
- for(i = 0; i < 2; i++)
- {
- int cache_idx = scan8[0] - 1 + i * 2 * 8;
- if(USES_LIST(left_type[i], list))
- {
- const int b_xy = h->mb2b_xy[left_xy[i]] + 3;
- const int b8_xy = h->mb2b8_xy[left_xy[i]] + 1;
- *(uint32_t*)h->mv_cache[list][cache_idx ] = *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]];
- *(uint32_t*)h->mv_cache[list][cache_idx+8] = *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]];
- h->ref_cache[list][cache_idx ] = s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2] >> 1)];
- h->ref_cache[list][cache_idx+8] = s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2] >> 1)];
- }
- else
- {
- *(uint32_t*)h->mv_cache [list][cache_idx ] =
- *(uint32_t*)h->mv_cache [list][cache_idx+8] = 0;
- h->ref_cache[list][cache_idx ] =
- h->ref_cache[list][cache_idx+8] = (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ for(i=0; i<2; i++){
+ int cache_idx = scan8[0] - 1 + i*2*8;
+ if(USES_LIST(left_type[i], list)){
+ const int b_xy= h->mb2b_xy[left_xy[i]] + 3;
+ const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1;
+ *(uint32_t*)h->mv_cache[list][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]];
+ *(uint32_t*)h->mv_cache[list][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]];
+ h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)];
+ h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)];
+ }else{
+ *(uint32_t*)h->mv_cache [list][cache_idx ]=
+ *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0;
+ h->ref_cache[list][cache_idx ]=
+ h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
}
if((IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred) && !FRAME_MBAFF)
continue;
- if(USES_LIST(topleft_type, list))
- {
- const int b_xy = h->mb2b_xy[topleft_xy] + 3 + h->b_stride + (topleft_partition & 2 * h->b_stride);
- const int b8_xy = h->mb2b8_xy[topleft_xy] + 1 + (topleft_partition & h->b8_stride);
- *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1 * 8] = *(uint32_t*)s->current_picture.motion_val[list][b_xy];
- h->ref_cache[list][scan8[0] - 1 - 1 * 8] = s->current_picture.ref_index[list][b8_xy];
- }
- else
- {
- *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1 * 8] = 0;
- h->ref_cache[list][scan8[0] - 1 - 1 * 8] = topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ if(USES_LIST(topleft_type, list)){
+ const int b_xy = h->mb2b_xy[topleft_xy] + 3 + h->b_stride + (topleft_partition & 2*h->b_stride);
+ const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (topleft_partition & h->b8_stride);
+ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy];
+ h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy];
+ }else{
+ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= 0;
+ h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
- if(USES_LIST(topright_type, list))
- {
- const int b_xy = h->mb2b_xy[topright_xy] + 3 * h->b_stride;
- const int b8_xy = h->mb2b8_xy[topright_xy] + h->b8_stride;
- *(uint32_t*)h->mv_cache[list][scan8[0] + 4 - 1 * 8] = *(uint32_t*)s->current_picture.motion_val[list][b_xy];
- h->ref_cache[list][scan8[0] + 4 - 1 * 8] = s->current_picture.ref_index[list][b8_xy];
- }
- else
- {
- *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1 * 8] = 0;
- h->ref_cache[list][scan8[0] + 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*h->b_stride;
+ const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride;
+ *(uint32_t*)h->mv_cache[list][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy];
+ h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy];
+ }else{
+ *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1*8]= 0;
+ h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
if((IS_SKIP(mb_type) || IS_DIRECT(mb_type)) && !FRAME_MBAFF)
continue;
- h->ref_cache[list][scan8[5 ] + 1] =
- h->ref_cache[list][scan8[7 ] + 1] =
- h->ref_cache[list][scan8[13] + 1] = //FIXME remove past 3 (init somewhere else)
- h->ref_cache[list][scan8[4 ]] =
- h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE;
- *(uint32_t*)h->mv_cache [list][scan8[5 ] + 1] =
- *(uint32_t*)h->mv_cache [list][scan8[7 ] + 1] =
- *(uint32_t*)h->mv_cache [list][scan8[13] + 1] = //FIXME remove past 3 (init somewhere else)
- *(uint32_t*)h->mv_cache [list][scan8[4 ]] =
- *(uint32_t*)h->mv_cache [list][scan8[12]] = 0;
-
- if(CABAC)
- {
+ h->ref_cache[list][scan8[5 ]+1] =
+ h->ref_cache[list][scan8[7 ]+1] =
+ h->ref_cache[list][scan8[13]+1] = //FIXME remove past 3 (init somewhere else)
+ h->ref_cache[list][scan8[4 ]] =
+ h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE;
+ *(uint32_t*)h->mv_cache [list][scan8[5 ]+1]=
+ *(uint32_t*)h->mv_cache [list][scan8[7 ]+1]=
+ *(uint32_t*)h->mv_cache [list][scan8[13]+1]= //FIXME remove past 3 (init somewhere else)
+ *(uint32_t*)h->mv_cache [list][scan8[4 ]]=
+ *(uint32_t*)h->mv_cache [list][scan8[12]]= 0;
+
+ if( CABAC ) {
/* XXX beurk, Load mvd */
- if(USES_LIST(top_type, list))
- {
- const int b_xy = h->mb2b_xy[top_xy] + 3 * h->b_stride;
- AV_COPY128(h->mvd_cache[list][scan8[0] + 0 - 1 * 8], h->mvd_table[list][b_xy + 0]);
- }
- else
- {
- AV_ZERO128(h->mvd_cache[list][scan8[0] + 0 - 1 * 8]);
- }
- if(USES_LIST(left_type[0], list))
- {
- const int b_xy = h->mb2b_xy[left_xy[0]] + 3;
- *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 0 * 8] = *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[0]];
- *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 1 * 8] = *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[1]];
- }
- else
- {
- *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 0 * 8] =
- *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 1 * 8] = 0;
+ if(USES_LIST(top_type, list)){
+ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
+ AV_COPY128(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]);
+ }else{
+ AV_ZERO128(h->mvd_cache[list][scan8[0] + 0 - 1*8]);
}
- if(USES_LIST(left_type[1], list))
- {
- const int b_xy = h->mb2b_xy[left_xy[1]] + 3;
- *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 2 * 8] = *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[2]];
- *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 3 * 8] = *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[3]];
+ if(USES_LIST(left_type[0], list)){
+ const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
+ *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[0]];
+ *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[1]];
+ }else{
+ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 0*8]=
+ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 1*8]= 0;
}
- else
- {
- *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 2 * 8] =
- *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 3 * 8] = 0;
+ if(USES_LIST(left_type[1], list)){
+ const int b_xy= h->mb2b_xy[left_xy[1]] + 3;
+ *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[2]];
+ *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 3*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[3]];
+ }else{
+ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 2*8]=
+ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 3*8]= 0;
}
- *(uint32_t*)h->mvd_cache [list][scan8[5 ] + 1] =
- *(uint32_t*)h->mvd_cache [list][scan8[7 ] + 1] =
- *(uint32_t*)h->mvd_cache [list][scan8[13] + 1] = //FIXME remove past 3 (init somewhere else)
- *(uint32_t*)h->mvd_cache [list][scan8[4 ]] =
- *(uint32_t*)h->mvd_cache [list][scan8[12]] = 0;
-
- if(h->slice_type_nos == FF_B_TYPE)
- {
+ *(uint32_t*)h->mvd_cache [list][scan8[5 ]+1]=
+ *(uint32_t*)h->mvd_cache [list][scan8[7 ]+1]=
+ *(uint32_t*)h->mvd_cache [list][scan8[13]+1]= //FIXME remove past 3 (init somewhere else)
+ *(uint32_t*)h->mvd_cache [list][scan8[4 ]]=
+ *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0;
+
+ if(h->slice_type_nos == FF_B_TYPE){
fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1);
- if(IS_DIRECT(top_type))
- {
- *(uint32_t*)&h->direct_cache[scan8[0] - 1 * 8] = 0x01010101;
- }
- else if(IS_8X8(top_type))
- {
+ if(IS_DIRECT(top_type)){
+ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0x01010101;
+ }else if(IS_8X8(top_type)){
int b8_xy = h->mb2b8_xy[top_xy] + h->b8_stride;
- h->direct_cache[scan8[0] + 0 - 1 * 8] = h->direct_table[b8_xy];
- h->direct_cache[scan8[0] + 2 - 1 * 8] = h->direct_table[b8_xy + 1];
- }
- else
- {
- *(uint32_t*)&h->direct_cache[scan8[0] - 1 * 8] = 0;
+ h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy];
+ h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 1];
+ }else{
+ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0;
}
if(IS_DIRECT(left_type[0]))
- h->direct_cache[scan8[0] - 1 + 0 * 8] = 1;
+ h->direct_cache[scan8[0] - 1 + 0*8]= 1;
else if(IS_8X8(left_type[0]))
- h->direct_cache[scan8[0] - 1 + 0 * 8] = h->direct_table[h->mb2b8_xy[left_xy[0]] + 1 + h->b8_stride * (left_block[0] >> 1)];
+ h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[h->mb2b8_xy[left_xy[0]] + 1 + h->b8_stride*(left_block[0]>>1)];
else
- h->direct_cache[scan8[0] - 1 + 0 * 8] = 0;
+ h->direct_cache[scan8[0] - 1 + 0*8]= 0;
if(IS_DIRECT(left_type[1]))
- h->direct_cache[scan8[0] - 1 + 2 * 8] = 1;
+ h->direct_cache[scan8[0] - 1 + 2*8]= 1;
else if(IS_8X8(left_type[1]))
- h->direct_cache[scan8[0] - 1 + 2 * 8] = h->direct_table[h->mb2b8_xy[left_xy[1]] + 1 + h->b8_stride * (left_block[2] >> 1)];
+ h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[h->mb2b8_xy[left_xy[1]] + 1 + h->b8_stride*(left_block[2]>>1)];
else
- h->direct_cache[scan8[0] - 1 + 2 * 8] = 0;
+ h->direct_cache[scan8[0] - 1 + 2*8]= 0;
}
}
- if(FRAME_MBAFF)
- {
+ if(FRAME_MBAFF){
#define MAP_MVS\
MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\
MAP_F2F(scan8[0] + 0 - 1*8, top_type)\
@@ -1261,8 +1159,7 @@ static void fill_decode_caches(H264Context *h, int mb_type)
MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\
MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\
MAP_F2F(scan8[0] - 1 + 3*8, left_type[1])
- if(MB_FIELD)
- {
+ 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;\
@@ -1271,9 +1168,7 @@ static void fill_decode_caches(H264Context *h, int mb_type)
}
MAP_MVS
#undef MAP_F2F
- }
- else
- {
+ }else{
#define MAP_F2F(idx, mb_type)\
if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
h->ref_cache[list][idx] >>= 1;\
@@ -1288,17 +1183,16 @@ static void fill_decode_caches(H264Context *h, int mb_type)
}
#endif
- h->neighbor_transform_size = !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
+ h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
}
/**
*
* @returns non zero if the loop filter can be skiped
*/
-static int fill_filter_caches(H264Context *h, int mb_type)
-{
+static int fill_filter_caches(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
- const int mb_xy = h->mb_xy;
+ const int mb_xy= h->mb_xy;
int top_xy, left_xy[2];
int top_type, left_type[2];
int i;
@@ -1310,26 +1204,19 @@ static int fill_filter_caches(H264Context *h, int mb_type)
/* 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[1] = left_xy[0] = mb_xy - 1;
- if(FRAME_MBAFF)
- {
+ left_xy[1] = left_xy[0] = mb_xy-1;
+ if(FRAME_MBAFF){
const int left_mb_field_flag = IS_INTERLACED(s->current_picture.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)
- {
+ if(s->mb_y&1){
+ if (left_mb_field_flag != curr_mb_field_flag) {
left_xy[0] -= s->mb_stride;
}
- }
- else
- {
- if(curr_mb_field_flag)
- {
- top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ] >> 7) & 1) - 1);
+ }else{
+ if(curr_mb_field_flag){
+ top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ]>>7)&1)-1);
}
- if(left_mb_field_flag != curr_mb_field_flag)
- {
+ if (left_mb_field_flag != curr_mb_field_flag) {
left_xy[1] += s->mb_stride;
}
}
@@ -1344,188 +1231,165 @@ static int fill_filter_caches(H264Context *h, int mb_type)
int qp_thresh = h->qp_thresh; //FIXME strictly we should store qp_thresh for each mb of a slice
int qp = s->current_picture.qscale_table[mb_xy];
if(qp <= qp_thresh
- && (left_xy[0] < 0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1) >> 1) <= qp_thresh)
- && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1) >> 1) <= qp_thresh))
- {
+ && (left_xy[0]<0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1)>>1) <= qp_thresh)
+ && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){
if(!FRAME_MBAFF)
return 1;
- if((left_xy[0] < 0 || ((qp + s->current_picture.qscale_table[left_xy[1] ] + 1) >> 1) <= qp_thresh)
- && (top_xy < s->mb_stride || ((qp + s->current_picture.qscale_table[top_xy -s->mb_stride] + 1) >> 1) <= qp_thresh))
+ if( (left_xy[0]< 0 || ((qp + s->current_picture.qscale_table[left_xy[1] ] + 1)>>1) <= qp_thresh)
+ && (top_xy < s->mb_stride || ((qp + s->current_picture.qscale_table[top_xy -s->mb_stride] + 1)>>1) <= qp_thresh))
return 1;
}
}
- if(h->deblocking_filter == 2)
- {
+ if(h->deblocking_filter == 2){
h->top_type = top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0;
- h->left_type[0] = left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0;
- h->left_type[1] = left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0;
- }
- else
- {
+ h->left_type[0]= left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0;
+ h->left_type[1]= left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0;
+ }else{
h->top_type = top_type = h->slice_table[top_xy ] < 0xFFFF ? s->current_picture.mb_type[top_xy] : 0;
- h->left_type[0] = left_type[0] = h->slice_table[left_xy[0] ] < 0xFFFF ? s->current_picture.mb_type[left_xy[0]] : 0;
- h->left_type[1] = left_type[1] = h->slice_table[left_xy[1] ] < 0xFFFF ? s->current_picture.mb_type[left_xy[1]] : 0;
+ h->left_type[0]= left_type[0] = h->slice_table[left_xy[0] ] < 0xFFFF ? s->current_picture.mb_type[left_xy[0]] : 0;
+ h->left_type[1]= left_type[1] = h->slice_table[left_xy[1] ] < 0xFFFF ? s->current_picture.mb_type[left_xy[1]] : 0;
}
if(IS_INTRA(mb_type))
return 0;
AV_COPY64(&h->non_zero_count_cache[0+8*1], &h->non_zero_count[mb_xy][ 0]);
AV_COPY64(&h->non_zero_count_cache[0+8*2], &h->non_zero_count[mb_xy][ 8]);
- *((uint32_t*)&h->non_zero_count_cache[0+8*5]) = *((uint32_t*)&h->non_zero_count[mb_xy][16]);
- *((uint32_t*)&h->non_zero_count_cache[4+8*3]) = *((uint32_t*)&h->non_zero_count[mb_xy][20]);
+ *((uint32_t*)&h->non_zero_count_cache[0+8*5])= *((uint32_t*)&h->non_zero_count[mb_xy][16]);
+ *((uint32_t*)&h->non_zero_count_cache[4+8*3])= *((uint32_t*)&h->non_zero_count[mb_xy][20]);
AV_COPY64(&h->non_zero_count_cache[0+8*4], &h->non_zero_count[mb_xy][24]);
- h->cbp = h->cbp_table[mb_xy];
+ h->cbp= h->cbp_table[mb_xy];
{
int list;
- for(list = 0; list < h->list_count; list++)
- {
+ for(list=0; list<h->list_count; list++){
int8_t *ref;
int y, b_stride;
int16_t (*mv_dst)[2];
int16_t (*mv_src)[2];
- if(!USES_LIST(mb_type, list))
- {
- fill_rectangle(h->mv_cache[list][scan8[0]], 4, 4, 8, pack16to32(0, 0), 4);
+ if(!USES_LIST(mb_type, list)){
+ fill_rectangle( h->mv_cache[list][scan8[0]], 4, 4, 8, pack16to32(0,0), 4);
*(uint32_t*)&h->ref_cache[list][scan8[ 0]] =
- *(uint32_t*)&h->ref_cache[list][scan8[ 2]] =
- *(uint32_t*)&h->ref_cache[list][scan8[ 8]] =
- *(uint32_t*)&h->ref_cache[list][scan8[10]] = ((LIST_NOT_USED) & 0xFF) * 0x01010101;
+ *(uint32_t*)&h->ref_cache[list][scan8[ 2]] =
+ *(uint32_t*)&h->ref_cache[list][scan8[ 8]] =
+ *(uint32_t*)&h->ref_cache[list][scan8[10]] = ((LIST_NOT_USED)&0xFF)*0x01010101;
continue;
}
ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]];
{
- int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1)][0] + (MB_MBAFF ? 20 : 2);
+ int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
*(uint32_t*)&h->ref_cache[list][scan8[ 0]] =
- *(uint32_t*)&h->ref_cache[list][scan8[ 2]] = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
+ *(uint32_t*)&h->ref_cache[list][scan8[ 2]] = (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101;
ref += h->b8_stride;
*(uint32_t*)&h->ref_cache[list][scan8[ 8]] =
- *(uint32_t*)&h->ref_cache[list][scan8[10]] = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
+ *(uint32_t*)&h->ref_cache[list][scan8[10]] = (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101;
}
b_stride = h->b_stride;
mv_dst = &h->mv_cache[list][scan8[0]];
mv_src = &s->current_picture.motion_val[list][4*s->mb_x + 4*s->mb_y*b_stride];
- for(y = 0; y < 4; y++)
- {
- AV_COPY128(mv_dst + 8 * y, mv_src + y * b_stride);
+ for(y=0; y<4; y++){
+ AV_COPY128(mv_dst + 8*y, mv_src + y*b_stride);
}
}
}
- /*
- 0 . T T. T T T T
- 1 L . .L . . . .
- 2 L . .L . . . .
- 3 . T TL . . . .
- 4 L . .L . . . .
- 5 L . .. . . . .
- */
+/*
+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)
- if(top_type)
- {
- *(uint32_t*)&h->non_zero_count_cache[4+8*0] = *(uint32_t*)&h->non_zero_count[top_xy][4+3*8];
+ if(top_type){
+ *(uint32_t*)&h->non_zero_count_cache[4+8*0]= *(uint32_t*)&h->non_zero_count[top_xy][4+3*8];
}
- if(left_type[0])
- {
- h->non_zero_count_cache[3+8*1] = h->non_zero_count[left_xy[0]][7+0*8];
- h->non_zero_count_cache[3+8*2] = h->non_zero_count[left_xy[0]][7+1*8];
- h->non_zero_count_cache[3+8*3] = h->non_zero_count[left_xy[0]][7+2*8];
- h->non_zero_count_cache[3+8*4] = h->non_zero_count[left_xy[0]][7+3*8];
+ if(left_type[0]){
+ h->non_zero_count_cache[3+8*1]= h->non_zero_count[left_xy[0]][7+0*8];
+ h->non_zero_count_cache[3+8*2]= h->non_zero_count[left_xy[0]][7+1*8];
+ h->non_zero_count_cache[3+8*3]= h->non_zero_count[left_xy[0]][7+2*8];
+ h->non_zero_count_cache[3+8*4]= h->non_zero_count[left_xy[0]][7+3*8];
}
// 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))
- {
- h->non_zero_count_cache[4+8*0] =
- h->non_zero_count_cache[5+8*0] = h->cbp_table[top_xy] & 4;
- h->non_zero_count_cache[6+8*0] =
- h->non_zero_count_cache[7+8*0] = h->cbp_table[top_xy] & 8;
+ if(!CABAC && h->pps.transform_8x8_mode){
+ if(IS_8x8DCT(top_type)){
+ h->non_zero_count_cache[4+8*0]=
+ h->non_zero_count_cache[5+8*0]= h->cbp_table[top_xy] & 4;
+ h->non_zero_count_cache[6+8*0]=
+ h->non_zero_count_cache[7+8*0]= h->cbp_table[top_xy] & 8;
}
- if(IS_8x8DCT(left_type[0]))
- {
- h->non_zero_count_cache[3+8*1] =
- h->non_zero_count_cache[3+8*2] = h->cbp_table[left_xy[0]] & 2; //FIXME check MBAFF
+ if(IS_8x8DCT(left_type[0])){
+ h->non_zero_count_cache[3+8*1]=
+ h->non_zero_count_cache[3+8*2]= h->cbp_table[left_xy[0]]&2; //FIXME check MBAFF
}
- if(IS_8x8DCT(left_type[1]))
- {
- h->non_zero_count_cache[3+8*3] =
- h->non_zero_count_cache[3+8*4] = h->cbp_table[left_xy[1]] & 8; //FIXME check MBAFF
+ if(IS_8x8DCT(left_type[1])){
+ h->non_zero_count_cache[3+8*3]=
+ h->non_zero_count_cache[3+8*4]= h->cbp_table[left_xy[1]]&8; //FIXME check MBAFF
}
- if(IS_8x8DCT(mb_type))
- {
- h->non_zero_count_cache[scan8[0 ]] = h->non_zero_count_cache[scan8[1 ]] =
- h->non_zero_count_cache[scan8[2 ]] = h->non_zero_count_cache[scan8[3 ]] = h->cbp & 1;
+ if(IS_8x8DCT(mb_type)){
+ h->non_zero_count_cache[scan8[0 ]]= h->non_zero_count_cache[scan8[1 ]]=
+ h->non_zero_count_cache[scan8[2 ]]= h->non_zero_count_cache[scan8[3 ]]= h->cbp & 1;
- h->non_zero_count_cache[scan8[0+ 4]] = h->non_zero_count_cache[scan8[1+ 4]] =
- h->non_zero_count_cache[scan8[2+ 4]] = h->non_zero_count_cache[scan8[3+ 4]] = h->cbp & 2;
+ h->non_zero_count_cache[scan8[0+ 4]]= h->non_zero_count_cache[scan8[1+ 4]]=
+ h->non_zero_count_cache[scan8[2+ 4]]= h->non_zero_count_cache[scan8[3+ 4]]= h->cbp & 2;
- h->non_zero_count_cache[scan8[0+ 8]] = h->non_zero_count_cache[scan8[1+ 8]] =
- h->non_zero_count_cache[scan8[2+ 8]] = h->non_zero_count_cache[scan8[3+ 8]] = h->cbp & 4;
+ h->non_zero_count_cache[scan8[0+ 8]]= h->non_zero_count_cache[scan8[1+ 8]]=
+ h->non_zero_count_cache[scan8[2+ 8]]= h->non_zero_count_cache[scan8[3+ 8]]= h->cbp & 4;
- h->non_zero_count_cache[scan8[0+12]] = h->non_zero_count_cache[scan8[1+12]] =
- h->non_zero_count_cache[scan8[2+12]] = h->non_zero_count_cache[scan8[3+12]] = h->cbp & 8;
+ h->non_zero_count_cache[scan8[0+12]]= h->non_zero_count_cache[scan8[1+12]]=
+ h->non_zero_count_cache[scan8[2+12]]= h->non_zero_count_cache[scan8[3+12]]= h->cbp & 8;
}
}
- if(IS_INTER(mb_type) || IS_DIRECT(mb_type))
- {
+ if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){
int list;
- for(list = 0; list < h->list_count; list++)
- {
- if(USES_LIST(top_type, list))
- {
- const int b_xy = h->mb2b_xy[top_xy] + 3 * h->b_stride;
- const int b8_xy = h->mb2b8_xy[top_xy] + h->b8_stride;
- int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2);
- AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1 * 8], s->current_picture.motion_val[list][b_xy + 0]);
- h->ref_cache[list][scan8[0] + 0 - 1 * 8] =
- h->ref_cache[list][scan8[0] + 1 - 1 * 8] = ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]];
- h->ref_cache[list][scan8[0] + 2 - 1 * 8] =
- h->ref_cache[list][scan8[0] + 3 - 1 * 8] = ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]];
- }
- else
- {
- AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1 * 8]);
- *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1 * 8] = ((LIST_NOT_USED) & 0xFF) * 0x01010101;
+ for(list=0; list<h->list_count; list++){
+ if(USES_LIST(top_type, list)){
+ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
+ const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride;
+ int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
+ AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
+ h->ref_cache[list][scan8[0] + 0 - 1*8]=
+ h->ref_cache[list][scan8[0] + 1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]];
+ h->ref_cache[list][scan8[0] + 2 - 1*8]=
+ h->ref_cache[list][scan8[0] + 3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]];
+ }else{
+ AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
+ *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((LIST_NOT_USED)&0xFF)*0x01010101;
}
- if(!IS_INTERLACED(mb_type ^ left_type[0]))
- {
- if(USES_LIST(left_type[0], list))
- {
- const int b_xy = h->mb2b_xy[left_xy[0]] + 3;
- const int b8_xy = h->mb2b8_xy[left_xy[0]] + 1;
- int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[0]] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2);
- *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 0 ] = *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*0];
- *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 8 ] = *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*1];
- *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 16 ] = *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*2];
- *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 24 ] = *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*3];
- h->ref_cache[list][scan8[0] - 1 + 0 ] =
- h->ref_cache[list][scan8[0] - 1 + 8 ] = ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*0]];
- h->ref_cache[list][scan8[0] - 1 + 16 ] =
- h->ref_cache[list][scan8[0] - 1 + 24 ] = ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*1]];
- }
- else
- {
- *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 0 ] =
- *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 8 ] =
- *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 16 ] =
- *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 24 ] = 0;
- h->ref_cache[list][scan8[0] - 1 + 0 ] =
- h->ref_cache[list][scan8[0] - 1 + 8 ] =
- h->ref_cache[list][scan8[0] - 1 + 16 ] =
- h->ref_cache[list][scan8[0] - 1 + 24 ] = LIST_NOT_USED;
+ if(!IS_INTERLACED(mb_type^left_type[0])){
+ if(USES_LIST(left_type[0], list)){
+ const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
+ const int b8_xy= h->mb2b8_xy[left_xy[0]] + 1;
+ int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[0]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
+ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 0 ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*0];
+ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 8 ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*1];
+ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 +16 ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*2];
+ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 +24 ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*3];
+ h->ref_cache[list][scan8[0] - 1 + 0 ]=
+ h->ref_cache[list][scan8[0] - 1 + 8 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*0]];
+ h->ref_cache[list][scan8[0] - 1 +16 ]=
+ h->ref_cache[list][scan8[0] - 1 +24 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*1]];
+ }else{
+ *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 0 ]=
+ *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 8 ]=
+ *(uint32_t*)h->mv_cache [list][scan8[0] - 1 +16 ]=
+ *(uint32_t*)h->mv_cache [list][scan8[0] - 1 +24 ]= 0;
+ h->ref_cache[list][scan8[0] - 1 + 0 ]=
+ h->ref_cache[list][scan8[0] - 1 + 8 ]=
+ h->ref_cache[list][scan8[0] - 1 + 16 ]=
+ h->ref_cache[list][scan8[0] - 1 + 24 ]= LIST_NOT_USED;
}
}
}
@@ -1537,22 +1401,20 @@ static int fill_filter_caches(H264Context *h, int mb_type)
/**
* gets the predicted intra4x4 prediction mode.
*/
-static inline int pred_intra_mode(H264Context *h, int n)
-{
- const int index8 = scan8[n];
- const int left = h->intra4x4_pred_mode_cache[index8 - 1];
+static 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);
+ 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;
+ if(min<0) return DC_PRED;
else return min;
}
-static inline void write_back_non_zero_count(H264Context *h)
-{
- const int mb_xy = h->mb_xy;
+static inline void write_back_non_zero_count(H264Context *h){
+ const int mb_xy= h->mb_xy;
AV_COPY64(&h->non_zero_count[mb_xy][ 0], &h->non_zero_count_cache[0+8*1]);
AV_COPY64(&h->non_zero_count[mb_xy][ 8], &h->non_zero_count_cache[0+8*2]);
@@ -1561,18 +1423,16 @@ static inline void write_back_non_zero_count(H264Context *h)
AV_COPY64(&h->non_zero_count[mb_xy][24], &h->non_zero_count_cache[0+8*4]);
}
-static inline void write_back_motion(H264Context *h, int mb_type)
-{
+static inline void write_back_motion(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
- const int b_xy = 4 * s->mb_x + 4 * s->mb_y * h->b_stride;
- const int b8_xy = 2 * s->mb_x + 2 * s->mb_y * h->b8_stride;
+ const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
+ const int b8_xy= 2*s->mb_x + 2*s->mb_y*h->b8_stride;
int list;
if(!USES_LIST(mb_type, 0))
fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, h->b8_stride, (uint8_t)LIST_NOT_USED, 1);
- for(list = 0; list < h->list_count; list++)
- {
+ for(list=0; list<h->list_count; list++){
int y, b_stride;
int16_t (*mv_dst)[2];
int16_t (*mv_src)[2];
@@ -1583,36 +1443,31 @@ static inline void write_back_motion(H264Context *h, int mb_type)
b_stride = h->b_stride;
mv_dst = &s->current_picture.motion_val[list][b_xy];
mv_src = &h->mv_cache[list][scan8[0]];
- for(y = 0; y < 4; y++)
- {
- AV_COPY128(mv_dst + y * b_stride, mv_src + 8 * y);
+ for(y=0; y<4; y++){
+ AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y);
}
- if(CABAC)
- {
+ if( CABAC ) {
int16_t (*mvd_dst)[2] = &h->mvd_table[list][b_xy];
int16_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
if(IS_SKIP(mb_type))
fill_rectangle(mvd_dst, 4, 4, h->b_stride, 0, 4);
else
- for(y = 0; y < 4; y++)
- {
- AV_COPY128(mvd_dst + y * b_stride, mvd_src + 8 * y);
- }
+ for(y=0; y<4; y++){
+ AV_COPY128(mvd_dst + y*b_stride, mvd_src + 8*y);
+ }
}
{
int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
- ref_index[0+0*h->b8_stride] = h->ref_cache[list][scan8[0]];
- ref_index[1+0*h->b8_stride] = h->ref_cache[list][scan8[4]];
- ref_index[0+1*h->b8_stride] = h->ref_cache[list][scan8[8]];
- ref_index[1+1*h->b8_stride] = h->ref_cache[list][scan8[12]];
+ ref_index[0+0*h->b8_stride]= h->ref_cache[list][scan8[0]];
+ ref_index[1+0*h->b8_stride]= h->ref_cache[list][scan8[4]];
+ ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]];
+ ref_index[1+1*h->b8_stride]= h->ref_cache[list][scan8[12]];
}
}
- if(h->slice_type_nos == FF_B_TYPE && CABAC)
- {
- if(IS_8X8(mb_type))
- {
+ if(h->slice_type_nos == FF_B_TYPE && CABAC){
+ if(IS_8X8(mb_type)){
uint8_t *direct_table = &h->direct_table[b8_xy];
direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;
direct_table[0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0;
@@ -1621,66 +1476,63 @@ static inline void write_back_motion(H264Context *h, int mb_type)
}
}
-static inline int get_dct8x8_allowed(H264Context *h)
-{
+static inline int get_dct8x8_allowed(H264Context *h){
if(h->sps.direct_8x8_inference_flag)
- return !(*(uint64_t*)h->sub_mb_type & ((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8) * 0x0001000100010001ULL));
+ return !(*(uint64_t*)h->sub_mb_type & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8 )*0x0001000100010001ULL));
else
- return !(*(uint64_t*)h->sub_mb_type & ((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8 | MB_TYPE_DIRECT2) * 0x0001000100010001ULL));
+ return !(*(uint64_t*)h->sub_mb_type & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL));
}
-static void predict_field_decoding_flag(H264Context *h)
-{
+static void predict_field_decoding_flag(H264Context *h){
MpegEncContext * const s = &h->s;
- const int mb_xy = h->mb_xy;
+ const int mb_xy= h->mb_xy;
int mb_type = (h->slice_table[mb_xy-1] == h->slice_num)
- ? s->current_picture.mb_type[mb_xy-1]
- : (h->slice_table[mb_xy-s->mb_stride] == h->slice_num)
- ? s->current_picture.mb_type[mb_xy-s->mb_stride]
- : 0;
+ ? s->current_picture.mb_type[mb_xy-1]
+ : (h->slice_table[mb_xy-s->mb_stride] == h->slice_num)
+ ? s->current_picture.mb_type[mb_xy-s->mb_stride]
+ : 0;
h->mb_mbaff = h->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0;
}
/**
* decodes a P_SKIP or B_SKIP macroblock
*/
-static void decode_mb_skip(H264Context *h)
-{
+static void decode_mb_skip(H264Context *h){
MpegEncContext * const s = &h->s;
- const int mb_xy = h->mb_xy;
- int mb_type = 0;
+ const int mb_xy= h->mb_xy;
+ int mb_type=0;
memset(h->non_zero_count[mb_xy], 0, 32);
- memset(h->non_zero_count_cache + 8, 0, 8 * 5); //FIXME ugly, remove pfui
+ memset(h->non_zero_count_cache + 8, 0, 8*5); //FIXME ugly, remove pfui
if(MB_FIELD)
- mb_type |= MB_TYPE_INTERLACED;
+ mb_type|= MB_TYPE_INTERLACED;
- if(h->slice_type_nos == FF_B_TYPE)
+ if( h->slice_type_nos == FF_B_TYPE )
{
// just for fill_caches. pred_direct_motion will set the real mb_type
- mb_type |= MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2 | MB_TYPE_SKIP;
+ mb_type|= MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
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;
+ mb_type|= MB_TYPE_SKIP;
}
else
{
int mx, my;
- mb_type |= MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_SKIP;
+ mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
pred_pskip_motion(h, &mx, &my);
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 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);
}
write_back_motion(h, mb_type);
- s->current_picture.mb_type[mb_xy] = mb_type;
- s->current_picture.qscale_table[mb_xy] = s->qscale;
- h->slice_table[ mb_xy ] = h->slice_num;
- h->prev_mb_skipped = 1;
+ s->current_picture.mb_type[mb_xy]= mb_type;
+ s->current_picture.qscale_table[mb_xy]= s->qscale;
+ h->slice_table[ mb_xy ]= h->slice_num;
+ h->prev_mb_skipped= 1;
}
#include "h264_mvpred.h" //For pred_pskip_motion()
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cabac.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cabac.c
index 557215b21..7b2c8e87c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cabac.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cabac.c
@@ -49,7 +49,7 @@ static const int8_t cabac_context_init_I[460][2] =
{
/* 0 - 10 */
{ 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
+ { 2, 54 }, { 3, 74 }, { -28,127 }, { -23, 104 },
{ -6, 53 }, { -1, 54 }, { 7, 51 },
/* 11 - 23 unsused for I */
@@ -81,16 +81,16 @@ static const int8_t cabac_context_init_I[460][2] =
/* 70 -> 87 */
{ 0, 11 }, { 1, 55 }, { 0, 69 }, { -17, 127 },
- { -13, 102 }, { 0, 82 }, { -7, 74 }, { -21, 107 },
- { -27, 127 }, { -31, 127 }, { -24, 127 }, { -18, 95 },
- { -27, 127 }, { -21, 114 }, { -30, 127 }, { -17, 123 },
- { -12, 115 }, { -16, 122 },
+ { -13, 102 },{ 0, 82 }, { -7, 74 }, { -21, 107 },
+ { -27, 127 },{ -31, 127 },{ -24, 127 }, { -18, 95 },
+ { -27, 127 },{ -21, 114 },{ -30, 127 }, { -17, 123 },
+ { -12, 115 },{ -16, 122 },
/* 88 -> 104 */
- { -11, 115 }, { -12, 63 }, { -2, 68 }, { -15, 84 },
- { -13, 104 }, { -3, 70 }, { -8, 93 }, { -10, 90 },
- { -30, 127 }, { -1, 74 }, { -6, 97 }, { -7, 91 },
- { -20, 127 }, { -4, 56 }, { -5, 82 }, { -7, 76 },
+ { -11, 115 },{ -12, 63 }, { -2, 68 }, { -15, 84 },
+ { -13, 104 },{ -3, 70 }, { -8, 93 }, { -10, 90 },
+ { -30, 127 },{ -1, 74 }, { -6, 97 }, { -7, 91 },
+ { -20, 127 },{ -4, 56 }, { -5, 82 }, { -7, 76 },
{ -22, 125 },
/* 105 -> 135 */
@@ -101,10 +101,10 @@ static const int8_t cabac_context_init_I[460][2] =
{ 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
{ 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
{ 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 }, { -15, 100 },
+ { 14, 62 }, { -13, 108 },{ -15, 100 },
/* 136 -> 165 */
- { -13, 101 }, { -13, 91 }, { -12, 94 }, { -10, 88 },
+ { -13, 101 },{ -13, 91 }, { -12, 94 }, { -10, 88 },
{ -16, 84 }, { -10, 86 }, { -7, 83 }, { -13, 87 },
{ -19, 94 }, { 1, 70 }, { 0, 72 }, { -5, 74 },
{ 18, 59 }, { -8, 102 }, { -15, 100 }, { 0, 95 },
@@ -144,9 +144,9 @@ static const int8_t cabac_context_init_I[460][2] =
/* 252 -> 275 */
{ -12, 73 }, { -8, 76 }, { -7, 80 }, { -9, 88 },
- { -17, 110 }, { -11, 97 }, { -20, 84 }, { -11, 79 },
+ { -17, 110 },{ -11, 97 }, { -20, 84 }, { -11, 79 },
{ -6, 73 }, { -4, 74 }, { -13, 86 }, { -13, 96 },
- { -11, 97 }, { -19, 117 }, { -8, 78 }, { -5, 33 },
+ { -11, 97 }, { -19, 117 },{ -8, 78 }, { -5, 33 },
{ -4, 48 }, { -2, 53 }, { -3, 62 }, { -13, 71 },
{ -10, 79 }, { -12, 86 }, { -13, 90 }, { -14, 97 },
@@ -161,7 +161,7 @@ static const int8_t cabac_context_init_I[460][2] =
{ -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
{ 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
{ 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 }, { -11, 97 },
+ { 9, 64 }, { -12, 104 },{ -11, 97 },
/* 308 -> 337 */
{ -16, 96 }, { -7, 88 }, { -8, 85 }, { -7, 85 },
@@ -181,7 +181,7 @@ static const int8_t cabac_context_init_I[460][2] =
{ 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
{ 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
{ -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 }, { 36, -35 }, { 36, -34 },
+ { -12, 109 },{ 36, -35 }, { 36, -34 },
/* 369 -> 398 */
{ 32, -26 }, { 37, -30 }, { 44, -32 }, { 34, -18 },
@@ -392,14 +392,14 @@ static const int8_t cabac_context_init_PB[3][460][2] =
{ 6, 69 }, { -13, 90 }, { 0, 52 }, { 8, 43 },
/* 40 - 53 */
- { -2, 69 }, { -5, 82 }, { -10, 96 }, { 2, 59 },
- { 2, 75 }, { -3, 87 }, { -3, 100 }, { 1, 56 },
- { -3, 74 }, { -6, 85 }, { 0, 59 }, { -3, 81 },
- { -7, 86 }, { -5, 95 },
+ { -2, 69 },{ -5, 82 },{ -10, 96 },{ 2, 59 },
+ { 2, 75 },{ -3, 87 },{ -3, 100 },{ 1, 56 },
+ { -3, 74 },{ -6, 85 },{ 0, 59 },{ -3, 81 },
+ { -7, 86 },{ -5, 95 },
/* 54 - 59 */
- { -1, 66 }, { -1, 77 }, { 1, 70 }, { -2, 86 },
- { -5, 72 }, { 0, 61 },
+ { -1, 66 },{ -1, 77 },{ 1, 70 },{ -2, 86 },
+ { -5, 72 },{ 0, 61 },
/* 60 - 69 */
{ 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
@@ -548,14 +548,14 @@ static const int8_t cabac_context_init_PB[3][460][2] =
{ -6, 93 }, { -14, 88 }, { -6, 44 }, { 4, 55 },
/* 40 - 53 */
- { -11, 89 }, { -15, 103 }, { -21, 116 }, { 19, 57 },
- { 20, 58 }, { 4, 84 }, { 6, 96 }, { 1, 63 },
- { -5, 85 }, { -13, 106 }, { 5, 63 }, { 6, 75 },
- { -3, 90 }, { -1, 101 },
+ { -11, 89 },{ -15, 103 },{ -21, 116 },{ 19, 57 },
+ { 20, 58 },{ 4, 84 },{ 6, 96 },{ 1, 63 },
+ { -5, 85 },{ -13, 106 },{ 5, 63 },{ 6, 75 },
+ { -3, 90 },{ -1, 101 },
/* 54 - 59 */
- { 3, 55 }, { -4, 79 }, { -2, 75 }, { -12, 97 },
- { -7, 50 }, { 1, 60 },
+ { 3, 55 },{ -4, 79 },{ -2, 75 },{ -12, 97 },
+ { -7, 50 },{ 1, 60 },
/* 60 - 69 */
{ 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
@@ -685,206 +685,186 @@ static const int8_t cabac_context_init_PB[3][460][2] =
}
};
-void ff_h264_init_cabac_states(H264Context *h)
-{
+void ff_h264_init_cabac_states(H264Context *h) {
MpegEncContext * const s = &h->s;
int i;
/* calculate pre-state */
- for(i = 0; i < 460; i++)
- {
+ for( i= 0; i < 460; i++ ) {
int pre;
- if(h->slice_type_nos == FF_I_TYPE)
- pre = av_clip(((cabac_context_init_I[i][0] * s->qscale) >> 4) + cabac_context_init_I[i][1], 1, 126);
+ if( h->slice_type_nos == FF_I_TYPE )
+ pre = av_clip( ((cabac_context_init_I[i][0] * s->qscale) >>4 ) + cabac_context_init_I[i][1], 1, 126 );
else
- pre = av_clip(((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >> 4) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126);
+ pre = av_clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 );
- if(pre <= 63)
- h->cabac_state[i] = 2 * (63 - pre) + 0;
+ if( pre <= 63 )
+ h->cabac_state[i] = 2 * ( 63 - pre ) + 0;
else
- h->cabac_state[i] = 2 * (pre - 64) + 1;
+ h->cabac_state[i] = 2 * ( pre - 64 ) + 1;
}
}
-static int decode_cabac_field_decoding_flag(H264Context *h)
-{
+static int decode_cabac_field_decoding_flag(H264Context *h) {
MpegEncContext * const s = &h->s;
const long mba_xy = h->mb_xy - 1L;
- const long mbb_xy = h->mb_xy - 2L * s->mb_stride;
+ const long mbb_xy = h->mb_xy - 2L*s->mb_stride;
unsigned long ctx = 0;
- ctx += (s->current_picture.mb_type[mba_xy] >> 7) & (h->slice_table[mba_xy] == h->slice_num);
- ctx += (s->current_picture.mb_type[mbb_xy] >> 7) & (h->slice_table[mbb_xy] == h->slice_num);
+ ctx += (s->current_picture.mb_type[mba_xy]>>7)&(h->slice_table[mba_xy] == h->slice_num);
+ ctx += (s->current_picture.mb_type[mbb_xy]>>7)&(h->slice_table[mbb_xy] == h->slice_num);
- return get_cabac_noinline(&h->cabac, &(h->cabac_state + 70)[ctx]);
+ return get_cabac_noinline( &h->cabac, &(h->cabac_state+70)[ctx] );
}
-static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice)
-{
- uint8_t *state = &h->cabac_state[ctx_base];
+static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) {
+ uint8_t *state= &h->cabac_state[ctx_base];
int mb_type;
- if(intra_slice)
- {
+ if(intra_slice){
MpegEncContext * const s = &h->s;
const int mba_xy = h->left_mb_xy[0];
const int mbb_xy = h->top_mb_xy;
- int ctx = 0;
- if(h->slice_table[mba_xy] == h->slice_num && !IS_INTRA4x4(s->current_picture.mb_type[mba_xy]))
+ int ctx=0;
+ if( h->slice_table[mba_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mba_xy] ) )
ctx++;
- if(h->slice_table[mbb_xy] == h->slice_num && !IS_INTRA4x4(s->current_picture.mb_type[mbb_xy]))
+ if( h->slice_table[mbb_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) )
ctx++;
- if(get_cabac_noinline(&h->cabac, &state[ctx]) == 0)
+ if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 )
return 0; /* I4x4 */
state += 2;
- }
- else
- {
- if(get_cabac_noinline(&h->cabac, state) == 0)
+ }else{
+ if( get_cabac_noinline( &h->cabac, state ) == 0 )
return 0; /* I4x4 */
}
- if(get_cabac_terminate(&h->cabac))
+ if( get_cabac_terminate( &h->cabac ) )
return 25; /* PCM */
mb_type = 1; /* I16x16 */
- mb_type += 12 * get_cabac_noinline(&h->cabac, &state[1]); /* cbp_luma != 0 */
- if(get_cabac_noinline(&h->cabac, &state[2])) /* cbp_chroma */
- mb_type += 4 + 4 * get_cabac_noinline(&h->cabac, &state[2+intra_slice]);
- mb_type += 2 * get_cabac_noinline(&h->cabac, &state[3+intra_slice]);
- mb_type += 1 * get_cabac_noinline(&h->cabac, &state[3+2*intra_slice]);
+ mb_type += 12 * get_cabac_noinline( &h->cabac, &state[1] ); /* cbp_luma != 0 */
+ if( get_cabac_noinline( &h->cabac, &state[2] ) ) /* cbp_chroma */
+ mb_type += 4 + 4 * get_cabac_noinline( &h->cabac, &state[2+intra_slice] );
+ mb_type += 2 * get_cabac_noinline( &h->cabac, &state[3+intra_slice] );
+ mb_type += 1 * get_cabac_noinline( &h->cabac, &state[3+2*intra_slice] );
return mb_type;
}
-static int decode_cabac_mb_type_b(H264Context *h)
-{
+static int decode_cabac_mb_type_b( H264Context *h ) {
MpegEncContext * const s = &h->s;
- const int mba_xy = h->left_mb_xy[0];
- const int mbb_xy = h->top_mb_xy;
- int ctx = 0;
- int bits;
- assert(h->slice_type_nos == FF_B_TYPE);
-
- if(h->slice_table[mba_xy] == h->slice_num && !IS_DIRECT(s->current_picture.mb_type[mba_xy]))
- ctx++;
- if(h->slice_table[mbb_xy] == h->slice_num && !IS_DIRECT(s->current_picture.mb_type[mbb_xy]))
- ctx++;
+ const int mba_xy = h->left_mb_xy[0];
+ const int mbb_xy = h->top_mb_xy;
+ int ctx = 0;
+ int bits;
+ assert(h->slice_type_nos == FF_B_TYPE);
- if(!get_cabac_noinline(&h->cabac, &h->cabac_state[27+ctx]))
- return 0; /* B_Direct_16x16 */
+ if( h->slice_table[mba_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mba_xy] ) )
+ ctx++;
+ if( h->slice_table[mbb_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mbb_xy] ) )
+ ctx++;
- if(!get_cabac_noinline(&h->cabac, &h->cabac_state[27+3]))
- {
- return 1 + get_cabac_noinline(&h->cabac, &h->cabac_state[27+5]); /* B_L[01]_16x16 */
- }
+ if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) )
+ return 0; /* B_Direct_16x16 */
- bits = get_cabac_noinline(&h->cabac, &h->cabac_state[27+4]) << 3;
- bits |= get_cabac_noinline(&h->cabac, &h->cabac_state[27+5]) << 2;
- bits |= get_cabac_noinline(&h->cabac, &h->cabac_state[27+5]) << 1;
- bits |= get_cabac_noinline(&h->cabac, &h->cabac_state[27+5]);
- if(bits < 8)
- return bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */
- else if(bits == 13)
- {
- return decode_cabac_intra_mb_type(h, 32, 0) + 23;
- }
- else if(bits == 14)
- return 11; /* B_L1_L0_8x16 */
- else if(bits == 15)
- return 22; /* B_8x8 */
+ if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) {
+ return 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */
+ }
- bits = (bits << 1) | get_cabac_noinline(&h->cabac, &h->cabac_state[27+5]);
- return bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */
+ bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3;
+ bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2;
+ bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1;
+ bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
+ if( bits < 8 )
+ return bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */
+ else if( bits == 13 ) {
+ return decode_cabac_intra_mb_type(h, 32, 0) + 23;
+ } else if( bits == 14 )
+ return 11; /* B_L1_L0_8x16 */
+ else if( bits == 15 )
+ return 22; /* B_8x8 */
+
+ bits= ( bits<<1 ) | get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
+ return bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */
}
-static int decode_cabac_mb_skip(H264Context *h, int mb_x, int mb_y)
-{
+static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) {
MpegEncContext * const s = &h->s;
int mba_xy, mbb_xy;
int ctx = 0;
- if(FRAME_MBAFF) //FIXME merge with the stuff in fill_caches?
- {
- int mb_xy = mb_x + (mb_y&~1) * s->mb_stride;
+ if(FRAME_MBAFF){ //FIXME merge with the stuff in fill_caches?
+ int mb_xy = mb_x + (mb_y&~1)*s->mb_stride;
mba_xy = mb_xy - 1;
- if((mb_y & 1)
- && h->slice_table[mba_xy] == h->slice_num
- && MB_FIELD == !!IS_INTERLACED(s->current_picture.mb_type[mba_xy]))
+ if( (mb_y&1)
+ && h->slice_table[mba_xy] == h->slice_num
+ && MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) )
mba_xy += s->mb_stride;
- if(MB_FIELD)
- {
+ if( MB_FIELD ){
mbb_xy = mb_xy - s->mb_stride;
- if(!(mb_y & 1)
- && h->slice_table[mbb_xy] == h->slice_num
- && IS_INTERLACED(s->current_picture.mb_type[mbb_xy]))
+ if( !(mb_y&1)
+ && h->slice_table[mbb_xy] == h->slice_num
+ && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) )
mbb_xy -= s->mb_stride;
- }
- else
- mbb_xy = mb_x + (mb_y - 1) * s->mb_stride;
- }
- else
- {
+ }else
+ mbb_xy = mb_x + (mb_y-1)*s->mb_stride;
+ }else{
int mb_xy = h->mb_xy;
mba_xy = mb_xy - 1;
mbb_xy = mb_xy - (s->mb_stride << FIELD_PICTURE);
}
- if(h->slice_table[mba_xy] == h->slice_num && !IS_SKIP(s->current_picture.mb_type[mba_xy]))
+ if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] ))
ctx++;
- if(h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP(s->current_picture.mb_type[mbb_xy]))
+ if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] ))
ctx++;
- if(h->slice_type_nos == FF_B_TYPE)
+ if( h->slice_type_nos == FF_B_TYPE )
ctx += 13;
- return get_cabac_noinline(&h->cabac, &h->cabac_state[11+ctx]);
+ return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] );
}
-static int decode_cabac_mb_intra4x4_pred_mode(H264Context *h, int pred_mode)
-{
+static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) {
int mode = 0;
- if(get_cabac(&h->cabac, &h->cabac_state[68]))
+ if( get_cabac( &h->cabac, &h->cabac_state[68] ) )
return pred_mode;
- mode += 1 * get_cabac(&h->cabac, &h->cabac_state[69]);
- mode += 2 * get_cabac(&h->cabac, &h->cabac_state[69]);
- mode += 4 * get_cabac(&h->cabac, &h->cabac_state[69]);
+ mode += 1 * get_cabac( &h->cabac, &h->cabac_state[69] );
+ mode += 2 * get_cabac( &h->cabac, &h->cabac_state[69] );
+ mode += 4 * get_cabac( &h->cabac, &h->cabac_state[69] );
- if(mode >= pred_mode)
+ if( mode >= pred_mode )
return mode + 1;
else
return mode;
}
-static int decode_cabac_mb_chroma_pre_mode(H264Context *h)
-{
+static int decode_cabac_mb_chroma_pre_mode( H264Context *h) {
const int mba_xy = h->left_mb_xy[0];
const int mbb_xy = h->top_mb_xy;
int ctx = 0;
/* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */
- if(h->slice_table[mba_xy] == h->slice_num && h->chroma_pred_mode_table[mba_xy] != 0)
+ if( h->slice_table[mba_xy] == h->slice_num && h->chroma_pred_mode_table[mba_xy] != 0 )
ctx++;
- if(h->slice_table[mbb_xy] == h->slice_num && h->chroma_pred_mode_table[mbb_xy] != 0)
+ if( h->slice_table[mbb_xy] == h->slice_num && h->chroma_pred_mode_table[mbb_xy] != 0 )
ctx++;
- if(get_cabac_noinline(&h->cabac, &h->cabac_state[64+ctx]) == 0)
+ if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 )
return 0;
- if(get_cabac_noinline(&h->cabac, &h->cabac_state[64+3]) == 0)
+ if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 )
return 1;
- if(get_cabac_noinline(&h->cabac, &h->cabac_state[64+3]) == 0)
+ if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 )
return 2;
else
return 3;
}
-static int decode_cabac_mb_cbp_luma(H264Context *h)
-{
+static int decode_cabac_mb_cbp_luma( H264Context *h) {
int cbp_b, cbp_a, ctx, cbp = 0;
cbp_a = h->slice_table[h->left_mb_xy[0]] == h->slice_num ? h->left_cbp : -1;
@@ -900,225 +880,189 @@ static int decode_cabac_mb_cbp_luma(H264Context *h)
cbp |= get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 3;
return cbp;
}
-static int decode_cabac_mb_cbp_chroma(H264Context *h)
-{
+static int decode_cabac_mb_cbp_chroma( H264Context *h) {
int ctx;
int cbp_a, cbp_b;
- cbp_a = (h->left_cbp >> 4) & 0x03;
- cbp_b = (h-> top_cbp >> 4) & 0x03;
+ cbp_a = (h->left_cbp>>4)&0x03;
+ cbp_b = (h-> top_cbp>>4)&0x03;
ctx = 0;
- if(cbp_a > 0) ctx++;
- if(cbp_b > 0) ctx += 2;
- if(get_cabac_noinline(&h->cabac, &h->cabac_state[77 + ctx]) == 0)
+ if( cbp_a > 0 ) ctx++;
+ if( cbp_b > 0 ) ctx += 2;
+ if( get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] ) == 0 )
return 0;
ctx = 4;
- if(cbp_a == 2) ctx++;
- if(cbp_b == 2) ctx += 2;
- return 1 + get_cabac_noinline(&h->cabac, &h->cabac_state[77 + ctx]);
+ if( cbp_a == 2 ) ctx++;
+ if( cbp_b == 2 ) ctx += 2;
+ return 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] );
}
-static int decode_cabac_mb_dqp(H264Context *h)
-{
- int ctx = h->last_qscale_diff != 0;
+static int decode_cabac_mb_dqp( H264Context *h) {
+ int ctx= h->last_qscale_diff != 0;
int val = 0;
- while(get_cabac_noinline(&h->cabac, &h->cabac_state[60 + ctx]))
- {
- ctx = 2 + (ctx >> 1);
+ while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) {
+ ctx= 2+(ctx>>1);
val++;
if(val > 102) //prevent infinite loop
return INT_MIN;
}
- if(val & 0x01)
- return (val + 1) >> 1 ;
+ if( val&0x01 )
+ return (val + 1)>>1 ;
else
- return -((val + 1) >> 1);
+ return -((val + 1)>>1);
}
-static int decode_cabac_p_mb_sub_type(H264Context *h)
-{
- if(get_cabac(&h->cabac, &h->cabac_state[21]))
+static int decode_cabac_p_mb_sub_type( H264Context *h ) {
+ if( get_cabac( &h->cabac, &h->cabac_state[21] ) )
return 0; /* 8x8 */
- if(!get_cabac(&h->cabac, &h->cabac_state[22]))
+ if( !get_cabac( &h->cabac, &h->cabac_state[22] ) )
return 1; /* 8x4 */
- if(get_cabac(&h->cabac, &h->cabac_state[23]))
+ if( get_cabac( &h->cabac, &h->cabac_state[23] ) )
return 2; /* 4x8 */
return 3; /* 4x4 */
}
-static int decode_cabac_b_mb_sub_type(H264Context *h)
-{
+static int decode_cabac_b_mb_sub_type( H264Context *h ) {
int type;
- if(!get_cabac(&h->cabac, &h->cabac_state[36]))
+ if( !get_cabac( &h->cabac, &h->cabac_state[36] ) )
return 0; /* B_Direct_8x8 */
- if(!get_cabac(&h->cabac, &h->cabac_state[37]))
- return 1 + get_cabac(&h->cabac, &h->cabac_state[39]); /* B_L0_8x8, B_L1_8x8 */
+ if( !get_cabac( &h->cabac, &h->cabac_state[37] ) )
+ return 1 + get_cabac( &h->cabac, &h->cabac_state[39] ); /* B_L0_8x8, B_L1_8x8 */
type = 3;
- if(get_cabac(&h->cabac, &h->cabac_state[38]))
- {
- if(get_cabac(&h->cabac, &h->cabac_state[39]))
- return 11 + get_cabac(&h->cabac, &h->cabac_state[39]); /* B_L1_4x4, B_Bi_4x4 */
+ if( get_cabac( &h->cabac, &h->cabac_state[38] ) ) {
+ if( get_cabac( &h->cabac, &h->cabac_state[39] ) )
+ return 11 + get_cabac( &h->cabac, &h->cabac_state[39] ); /* B_L1_4x4, B_Bi_4x4 */
type += 4;
}
- type += 2 * get_cabac(&h->cabac, &h->cabac_state[39]);
- type += get_cabac(&h->cabac, &h->cabac_state[39]);
+ type += 2*get_cabac( &h->cabac, &h->cabac_state[39] );
+ type += get_cabac( &h->cabac, &h->cabac_state[39] );
return type;
}
-static inline int decode_cabac_mb_transform_size(H264Context *h)
-{
- return get_cabac_noinline(&h->cabac, &h->cabac_state[399 + h->neighbor_transform_size]);
+static inline int decode_cabac_mb_transform_size( H264Context *h ) {
+ return get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] );
}
-static int decode_cabac_mb_ref(H264Context *h, int list, int n)
-{
+static int decode_cabac_mb_ref( H264Context *h, int list, int n ) {
int refa = h->ref_cache[list][scan8[n] - 1];
int refb = h->ref_cache[list][scan8[n] - 8];
int ref = 0;
int ctx = 0;
- if(h->slice_type_nos == FF_B_TYPE)
- {
- if(refa > 0 && !h->direct_cache[scan8[n] - 1])
+ if( h->slice_type_nos == FF_B_TYPE) {
+ if( refa > 0 && !h->direct_cache[scan8[n] - 1] )
ctx++;
- if(refb > 0 && !h->direct_cache[scan8[n] - 8])
+ if( refb > 0 && !h->direct_cache[scan8[n] - 8] )
ctx += 2;
- }
- else
- {
- if(refa > 0)
+ } else {
+ if( refa > 0 )
ctx++;
- if(refb > 0)
+ if( refb > 0 )
ctx += 2;
}
- while(get_cabac(&h->cabac, &h->cabac_state[54+ctx]))
- {
+ while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) {
ref++;
- ctx = (ctx >> 2) + 4;
- if(ref >= 32 /*h->ref_list[list]*/)
- {
+ ctx = (ctx>>2)+4;
+ if(ref >= 32 /*h->ref_list[list]*/){
return -1;
}
}
return ref;
}
-static int decode_cabac_mb_mvd(H264Context *h, int list, int n, int l)
-{
- int amvd = abs(h->mvd_cache[list][scan8[n] - 1][l]) +
- abs(h->mvd_cache[list][scan8[n] - 8][l]);
+static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) {
+ int amvd = abs( h->mvd_cache[list][scan8[n] - 1][l] ) +
+ abs( h->mvd_cache[list][scan8[n] - 8][l] );
int ctxbase = (l == 0) ? 40 : 47;
int mvd;
- int ctx = (amvd > 2) + (amvd > 32);
+ int ctx = (amvd>2) + (amvd>32);
if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+ctx]))
return 0;
- mvd = 1;
- ctx = 3;
- while(mvd < 9 && get_cabac(&h->cabac, &h->cabac_state[ctxbase+ctx]))
- {
+ mvd= 1;
+ ctx= 3;
+ while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase+ctx] ) ) {
mvd++;
- if(ctx < 6)
+ if( ctx < 6 )
ctx++;
}
- if(mvd >= 9)
- {
+ if( mvd >= 9 ) {
int k = 3;
- while(get_cabac_bypass(&h->cabac))
- {
+ while( get_cabac_bypass( &h->cabac ) ) {
mvd += 1 << k;
k++;
- if(k > 24)
- {
+ if(k>24){
av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_mvd\n");
return INT_MIN;
}
}
- while(k--)
- {
- if(get_cabac_bypass(&h->cabac))
+ while( k-- ) {
+ if( get_cabac_bypass( &h->cabac ) )
mvd += 1 << k;
}
}
- return get_cabac_bypass_sign(&h->cabac, -mvd);
+ return get_cabac_bypass_sign( &h->cabac, -mvd );
}
-static av_always_inline int get_cabac_cbf_ctx(H264Context *h, int cat, int idx, int is_dc)
-{
+static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx, int is_dc ) {
int nza, nzb;
int ctx = 0;
- if(is_dc)
- {
- if(cat == 0)
- {
- nza = h->left_cbp & 0x100;
- nzb = h-> top_cbp & 0x100;
- }
- else
- {
- nza = (h->left_cbp >> (6 + idx)) & 0x01;
- nzb = (h-> top_cbp >> (6 + idx)) & 0x01;
+ if( is_dc ) {
+ if( cat == 0 ) {
+ nza = h->left_cbp&0x100;
+ nzb = h-> top_cbp&0x100;
+ } else {
+ nza = (h->left_cbp>>(6+idx))&0x01;
+ nzb = (h-> top_cbp>>(6+idx))&0x01;
}
- }
- else
- {
+ } else {
assert(cat == 1 || cat == 2 || cat == 4);
nza = h->non_zero_count_cache[scan8[idx] - 1];
nzb = h->non_zero_count_cache[scan8[idx] - 8];
}
- if(nza > 0)
+ if( nza > 0 )
ctx++;
- if(nzb > 0)
+ if( nzb > 0 )
ctx += 2;
return ctx + 4 * cat;
}
-DECLARE_ASM_CONST(1, uint8_t, last_coeff_flag_offset_8x8)[63] =
-{
+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, const uint32_t *qmul, int max_coeff, int is_dc)
-{
- static const int significant_coeff_flag_offset[2][6] =
- {
- { 105 + 0, 105 + 15, 105 + 29, 105 + 44, 105 + 47, 402 },
- { 277 + 0, 277 + 15, 277 + 29, 277 + 44, 277 + 47, 436 }
+static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc ) {
+ static const int significant_coeff_flag_offset[2][6] = {
+ { 105+0, 105+15, 105+29, 105+44, 105+47, 402 },
+ { 277+0, 277+15, 277+29, 277+44, 277+47, 436 }
};
- static const int last_coeff_flag_offset[2][6] =
- {
- { 166 + 0, 166 + 15, 166 + 29, 166 + 44, 166 + 47, 417 },
- { 338 + 0, 338 + 15, 338 + 29, 338 + 44, 338 + 47, 451 }
+ static const int last_coeff_flag_offset[2][6] = {
+ { 166+0, 166+15, 166+29, 166+44, 166+47, 417 },
+ { 338+0, 338+15, 338+29, 338+44, 338+47, 451 }
};
- static const int coeff_abs_level_m1_offset[6] =
- {
- 227 + 0, 227 + 10, 227 + 20, 227 + 30, 227 + 39, 426
+ static const int coeff_abs_level_m1_offset[6] = {
+ 227+0, 227+10, 227+20, 227+30, 227+39, 426
};
- static const uint8_t significant_coeff_flag_offset_8x8[2][63] =
- {
- {
- 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
- 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9, 10, 9, 8, 7,
- 7, 6, 11, 12, 13, 11, 6, 7, 8, 9, 14, 10, 9, 8, 6, 11,
- 12, 13, 11, 6, 9, 14, 10, 9, 11, 12, 13, 11, 14, 10, 12
- },
- {
- 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
- 6, 9, 10, 10, 8, 11, 12, 11, 9, 9, 10, 10, 8, 11, 12, 11,
- 9, 9, 10, 10, 8, 11, 12, 11, 9, 9, 10, 10, 8, 13, 13, 9,
- 9, 10, 10, 8, 13, 13, 9, 9, 10, 10, 14, 14, 14, 14, 14
- }
+ static const uint8_t significant_coeff_flag_offset_8x8[2][63] = {
+ { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
+ 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
+ 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
+ 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },
+ { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
+ 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
+ 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
+ 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }
};
/* node ctx: 0..3: abslevel1 (with abslevelgt1 == 0).
* 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter).
@@ -1126,11 +1070,10 @@ static av_always_inline void decode_cabac_residual_internal(H264Context *h, DCTE
static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };
/* map node ctx => cabac ctx for level>1 */
static const uint8_t coeff_abs_levelgt1_ctx[8] = { 5, 5, 5, 5, 6, 7, 8, 9 };
- static const uint8_t coeff_abs_level_transition[2][8] =
- {
- /* update node ctx after decoding a level=1 */
+ static const uint8_t coeff_abs_level_transition[2][8] = {
+ /* update node ctx after decoding a level=1 */
{ 1, 2, 3, 3, 4, 5, 6, 7 },
- /* update node ctx after decoding a level>1 */
+ /* update node ctx after decoding a level>1 */
{ 4, 4, 4, 4, 5, 6, 7, 7 }
};
@@ -1152,7 +1095,7 @@ static av_always_inline void decode_cabac_residual_internal(H264Context *h, DCTE
CABACContext cc;
cc.range = h->cabac.range;
cc.low = h->cabac.low;
- cc.bytestream = h->cabac.bytestream;
+ cc.bytestream= h->cabac.bytestream;
#else
#define CC &h->cabac
#endif
@@ -1167,31 +1110,28 @@ static av_always_inline void decode_cabac_residual_internal(H264Context *h, DCTE
*/
/* read coded block flag */
- if(is_dc || cat != 5)
- {
- if(get_cabac(CC, &h->cabac_state[85 + get_cabac_cbf_ctx(h, cat, n, is_dc)]) == 0)
- {
- if(!is_dc)
+ if( is_dc || cat != 5 ) {
+ if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) {
+ if( !is_dc )
h->non_zero_count_cache[scan8[n]] = 0;
#ifdef CABAC_ON_STACK
h->cabac.range = cc.range ;
h->cabac.low = cc.low ;
- h->cabac.bytestream = cc.bytestream;
+ h->cabac.bytestream= cc.bytestream;
#endif
return;
}
}
significant_coeff_ctx_base = h->cabac_state
- + significant_coeff_flag_offset[MB_FIELD][cat];
+ + significant_coeff_flag_offset[MB_FIELD][cat];
last_coeff_ctx_base = h->cabac_state
- + last_coeff_flag_offset[MB_FIELD][cat];
+ + last_coeff_flag_offset[MB_FIELD][cat];
abs_level_m1_ctx_base = h->cabac_state
- + coeff_abs_level_m1_offset[cat];
+ + coeff_abs_level_m1_offset[cat];
- if(!is_dc && cat == 5)
- {
+ if( !is_dc && cat == 5 ) {
#define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \
for(last= 0; last < coefs; last++) { \
uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \
@@ -1209,121 +1149,95 @@ static av_always_inline void decode_cabac_residual_internal(H264Context *h, DCTE
}
const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
- coeff_count = decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
- }
- else
- {
- coeff_count = decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);
+ coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
+ } else {
+ coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);
#else
- DECODE_SIGNIFICANCE(63, sig_off[last], last_coeff_flag_offset_8x8[last]);
- }
- else
- {
- DECODE_SIGNIFICANCE(max_coeff - 1, last, last);
+ DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] );
+ } else {
+ DECODE_SIGNIFICANCE( max_coeff - 1, last, last );
#endif
}
assert(coeff_count > 0);
- if(is_dc)
- {
- if(cat == 0)
+ if( is_dc ) {
+ if( cat == 0 )
h->cbp_table[h->mb_xy] |= 0x100;
else
h->cbp_table[h->mb_xy] |= 0x40 << n;
- }
- else
- {
- if(cat == 5)
+ } else {
+ if( cat == 5 )
fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
- else
- {
- assert(cat == 1 || cat == 2 || cat == 4);
+ else {
+ assert( cat == 1 || cat == 2 || cat == 4 );
h->non_zero_count_cache[scan8[n]] = coeff_count;
}
}
- do
- {
+ do {
uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base;
- int j = scantable[index[--coeff_count]];
+ int j= scantable[index[--coeff_count]];
- if(get_cabac(CC, ctx) == 0)
- {
+ if( get_cabac( CC, ctx ) == 0 ) {
node_ctx = coeff_abs_level_transition[0][node_ctx];
- if(is_dc)
- {
- block[j] = get_cabac_bypass_sign(CC, -1);
- }
- else
- {
- block[j] = (get_cabac_bypass_sign(CC, -qmul[j]) + 32) >> 6;
+ if( is_dc ) {
+ block[j] = get_cabac_bypass_sign( CC, -1);
+ }else{
+ block[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6;
}
- }
- else
- {
+ } else {
int coeff_abs = 2;
ctx = coeff_abs_levelgt1_ctx[node_ctx] + abs_level_m1_ctx_base;
node_ctx = coeff_abs_level_transition[1][node_ctx];
- while(coeff_abs < 15 && get_cabac(CC, ctx))
- {
+ while( coeff_abs < 15 && get_cabac( CC, ctx ) ) {
coeff_abs++;
}
- if(coeff_abs >= 15)
- {
+ if( coeff_abs >= 15 ) {
int j = 0;
- while(get_cabac_bypass(CC))
- {
+ while( get_cabac_bypass( CC ) ) {
j++;
}
- coeff_abs = 1;
- while(j--)
- {
- coeff_abs += coeff_abs + get_cabac_bypass(CC);
+ coeff_abs=1;
+ while( j-- ) {
+ coeff_abs += coeff_abs + get_cabac_bypass( CC );
}
- coeff_abs += 14;
+ coeff_abs+= 14;
}
- if(is_dc)
- {
- block[j] = get_cabac_bypass_sign(CC, -coeff_abs);
- }
- else
- {
- block[j] = (get_cabac_bypass_sign(CC, -coeff_abs) * qmul[j] + 32) >> 6;
+ if( is_dc ) {
+ block[j] = get_cabac_bypass_sign( CC, -coeff_abs );
+ }else{
+ block[j] = (get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32) >> 6;
}
}
- }
- while(coeff_count);
+ } while( coeff_count );
#ifdef CABAC_ON_STACK
- h->cabac.range = cc.range ;
- h->cabac.low = cc.low ;
- h->cabac.bytestream = cc.bytestream;
+ h->cabac.range = cc.range ;
+ h->cabac.low = cc.low ;
+ h->cabac.bytestream= cc.bytestream;
#endif
}
#if !CONFIG_SMALL
-static void decode_cabac_residual_dc(H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff)
-{
+static void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 1);
}
-static void decode_cabac_residual_nondc(H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff)
-{
+static void decode_cabac_residual_nondc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0);
}
#endif
-static void decode_cabac_residual(H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff)
-{
+static void decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
#if CONFIG_SMALL
decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, cat == 0 || cat == 3);
#else
- if(cat == 0 || cat == 3) decode_cabac_residual_dc(h, block, cat, n, scantable, qmul, max_coeff);
+ if( cat == 0 || cat == 3 ) decode_cabac_residual_dc(h, block, cat, n, scantable, qmul, max_coeff);
else decode_cabac_residual_nondc(h, block, cat, n, scantable, qmul, max_coeff);
#endif
}
@@ -1334,26 +1248,21 @@ static inline void compute_mb_neighbors(H264Context *h)
const int mb_xy = h->mb_xy;
h->top_mb_xy = mb_xy - s->mb_stride;
h->left_mb_xy[0] = mb_xy - 1;
- if(FRAME_MBAFF)
- {
- const int pair_xy = s->mb_x + (s->mb_y & ~1) * s->mb_stride;
+ if(FRAME_MBAFF){
+ const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride;
const int top_pair_xy = pair_xy - s->mb_stride;
const int top_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]);
const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]);
const int curr_mb_field_flag = MB_FIELD;
const int bottom = (s->mb_y & 1);
- if(curr_mb_field_flag && (bottom || top_mb_field_flag))
- {
+ if (curr_mb_field_flag && (bottom || top_mb_field_flag)){
h->top_mb_xy -= s->mb_stride;
}
- if(!left_mb_field_flag == curr_mb_field_flag)
- {
+ if (!left_mb_field_flag == curr_mb_field_flag) {
h->left_mb_xy[0] = pair_xy - 1;
}
- }
- else if(FIELD_PICTURE)
- {
+ } else if (FIELD_PICTURE) {
h->top_mb_xy -= s->mb_stride;
}
return;
@@ -1363,41 +1272,36 @@ static inline void compute_mb_neighbors(H264Context *h)
* decodes a macroblock
* @returns 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
*/
-int ff_h264_decode_mb_cabac(H264Context *h)
-{
+int ff_h264_decode_mb_cabac(H264Context *h) {
MpegEncContext * const s = &h->s;
int mb_xy;
int mb_type, partition_count, cbp = 0;
- int dct8x8_allowed = h->pps.transform_8x8_mode;
-
- mb_xy = h->mb_xy = s->mb_x + s->mb_y * s->mb_stride;
+ int dct8x8_allowed= h->pps.transform_8x8_mode;
+ mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
+
/* ffdshow custom code */
-#if ENABLE_SLICE_MT_PATCH
- if(s->avctx->thread_count > 1)
- {
+ #if ENABLE_SLICE_MT_PATCH
+ if(s->avctx->thread_count > 1) {
s->dsp.clear_blocks(h->mb);
}
-#endif
+ #endif
tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
- if(h->slice_type_nos != FF_I_TYPE)
- {
+ if( h->slice_type_nos != FF_I_TYPE ) {
int skip;
/* a skipped mb needs the aff flag from the following mb */
- if(FRAME_MBAFF && s->mb_x == 0 && (s->mb_y & 1) == 0)
+ if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 )
predict_field_decoding_flag(h);
- if(FRAME_MBAFF && (s->mb_y & 1) == 1 && h->prev_mb_skipped)
+ if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped )
skip = h->next_mb_skipped;
else
- skip = decode_cabac_mb_skip(h, s->mb_x, s->mb_y);
+ skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y );
/* read skip flags */
- if(skip)
- {
- if(FRAME_MBAFF && (s->mb_y & 1) == 0)
- {
+ if( skip ) {
+ if( FRAME_MBAFF && (s->mb_y&1)==0 ){
s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP;
- h->next_mb_skipped = decode_cabac_mb_skip(h, s->mb_x, s->mb_y + 1);
+ h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 );
if(!h->next_mb_skipped)
h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
}
@@ -1412,93 +1316,73 @@ int ff_h264_decode_mb_cabac(H264Context *h)
}
}
- if(FRAME_MBAFF)
- {
- if((s->mb_y & 1) == 0)
+ if(FRAME_MBAFF){
+ if( (s->mb_y&1) == 0 )
h->mb_mbaff =
- h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
+ h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
}
h->prev_mb_skipped = 0;
compute_mb_neighbors(h);
- if(h->slice_type_nos == FF_B_TYPE)
- {
- mb_type = decode_cabac_mb_type_b(h);
- if(mb_type < 23)
- {
- partition_count = b_mb_type_info[mb_type].partition_count;
- mb_type = b_mb_type_info[mb_type].type;
- }
- else
- {
+ if( h->slice_type_nos == FF_B_TYPE ) {
+ mb_type = decode_cabac_mb_type_b( h );
+ if( mb_type < 23 ){
+ partition_count= b_mb_type_info[mb_type].partition_count;
+ mb_type= b_mb_type_info[mb_type].type;
+ }else{
mb_type -= 23;
goto decode_intra_mb;
}
- }
- else if(h->slice_type_nos == FF_P_TYPE)
- {
- if(get_cabac_noinline(&h->cabac, &h->cabac_state[14]) == 0)
- {
+ } else if( h->slice_type_nos == FF_P_TYPE ) {
+ if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) {
/* P-type */
- if(get_cabac_noinline(&h->cabac, &h->cabac_state[15]) == 0)
- {
+ if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) {
/* P_L0_D16x16, P_8x8 */
- mb_type = 3 * get_cabac_noinline(&h->cabac, &h->cabac_state[16]);
- }
- else
- {
+ mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] );
+ } else {
/* P_L0_D8x16, P_L0_D16x8 */
- mb_type = 2 - get_cabac_noinline(&h->cabac, &h->cabac_state[17]);
+ mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] );
}
- partition_count = p_mb_type_info[mb_type].partition_count;
- mb_type = p_mb_type_info[mb_type].type;
- }
- else
- {
- mb_type = decode_cabac_intra_mb_type(h, 17, 0);
+ partition_count= p_mb_type_info[mb_type].partition_count;
+ mb_type= p_mb_type_info[mb_type].type;
+ } else {
+ mb_type= decode_cabac_intra_mb_type(h, 17, 0);
goto decode_intra_mb;
}
- }
- else
- {
- mb_type = decode_cabac_intra_mb_type(h, 3, 1);
+ } else {
+ mb_type= decode_cabac_intra_mb_type(h, 3, 1);
if(h->slice_type == FF_SI_TYPE && mb_type)
mb_type--;
assert(h->slice_type_nos == FF_I_TYPE);
decode_intra_mb:
partition_count = 0;
- cbp = i_mb_type_info[mb_type].cbp;
- h->intra16x16_pred_mode = i_mb_type_info[mb_type].pred_mode;
- mb_type = i_mb_type_info[mb_type].type;
+ cbp= i_mb_type_info[mb_type].cbp;
+ h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
+ mb_type= i_mb_type_info[mb_type].type;
}
if(MB_FIELD)
mb_type |= MB_TYPE_INTERLACED;
- h->slice_table[ mb_xy ] = h->slice_num;
+ h->slice_table[ mb_xy ]= h->slice_num;
- if(IS_INTRA_PCM(mb_type))
- {
+ if(IS_INTRA_PCM(mb_type)) {
const uint8_t *ptr;
// We assume these blocks are very rare so we do not optimize it.
// FIXME The two following lines get the bitstream position in the cabac
// decode, I think it should be done by a function in cabac.h (or cabac.c).
- ptr = h->cabac.bytestream;
- if(h->cabac.low & 0x1) ptr--;
- if(CABAC_BITS == 16)
- {
- if(h->cabac.low & 0x1FF) ptr--;
+ ptr= h->cabac.bytestream;
+ if(h->cabac.low&0x1) ptr--;
+ if(CABAC_BITS==16){
+ if(h->cabac.low&0x1FF) ptr--;
}
// The pixels are stored in the same order as levels in h->mb array.
- memcpy(h->mb, ptr, 256);
- ptr += 256;
- if(CHROMA)
- {
- memcpy(h->mb + 128, ptr, 128);
- ptr += 128;
+ memcpy(h->mb, ptr, 256); ptr+=256;
+ if(CHROMA){
+ memcpy(h->mb+128, ptr, 128); ptr+=128;
}
ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
@@ -1507,510 +1391,395 @@ decode_intra_mb:
h->cbp_table[mb_xy] = 0x1ef;
h->chroma_pred_mode_table[mb_xy] = 0;
// In deblocking, the quantizer is 0
- s->current_picture.qscale_table[mb_xy] = 0;
+ s->current_picture.qscale_table[mb_xy]= 0;
// All coeffs are present
memset(h->non_zero_count[mb_xy], 16, 32);
- s->current_picture.mb_type[mb_xy] = mb_type;
+ s->current_picture.mb_type[mb_xy]= mb_type;
h->last_qscale_diff = 0;
return 0;
}
- if(MB_MBAFF)
- {
+ if(MB_MBAFF){
h->ref_count[0] <<= 1;
h->ref_count[1] <<= 1;
}
fill_decode_caches(h, mb_type);
- if(IS_INTRA(mb_type))
- {
+ if( IS_INTRA( mb_type ) ) {
int i, pred_mode;
- if(IS_INTRA4x4(mb_type))
- {
- if(dct8x8_allowed && decode_cabac_mb_transform_size(h))
- {
+ if( IS_INTRA4x4( mb_type ) ) {
+ if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) {
mb_type |= MB_TYPE_8x8DCT;
- for(i = 0; i < 16; i += 4)
- {
- int pred = pred_intra_mode(h, i);
- int mode = decode_cabac_mb_intra4x4_pred_mode(h, pred);
- fill_rectangle(&h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1);
+ for( i = 0; i < 16; i+=4 ) {
+ int pred = pred_intra_mode( h, i );
+ int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred );
+ fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
}
- }
- else
- {
- for(i = 0; i < 16; i++)
- {
- 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] ] );
+ } else {
+ for( i = 0; i < 16; i++ ) {
+ 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] ] );
}
}
ff_h264_write_back_intra_pred_mode(h);
- if(ff_h264_check_intra4x4_pred_mode(h) < 0) return -1;
+ if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1;
+ } else {
+ h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode );
+ if( h->intra16x16_pred_mode < 0 ) return -1;
}
- else
- {
- h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode);
- if(h->intra16x16_pred_mode < 0) return -1;
- }
- if(CHROMA)
- {
+ if(CHROMA){
h->chroma_pred_mode_table[mb_xy] =
- pred_mode = decode_cabac_mb_chroma_pre_mode(h);
+ pred_mode = decode_cabac_mb_chroma_pre_mode( h );
- pred_mode = ff_h264_check_intra_pred_mode(h, pred_mode);
- if(pred_mode < 0) return -1;
- h->chroma_pred_mode = pred_mode;
+ pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode );
+ if( pred_mode < 0 ) return -1;
+ h->chroma_pred_mode= pred_mode;
}
- }
- else if(partition_count == 4)
- {
+ } else if( partition_count == 4 ) {
int i, j, sub_partition_count[4], list, ref[2][4];
- if(h->slice_type_nos == FF_B_TYPE)
- {
- for(i = 0; i < 4; i++)
- {
- h->sub_mb_type[i] = decode_cabac_b_mb_sub_type(h);
- sub_partition_count[i] = b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
- h->sub_mb_type[i] = b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
+ if( h->slice_type_nos == FF_B_TYPE ) {
+ for( i = 0; i < 4; i++ ) {
+ h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h );
+ sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
+ h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
}
- if(IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] |
- h->sub_mb_type[2] | h->sub_mb_type[3]))
- {
+ if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] |
+ h->sub_mb_type[2] | h->sub_mb_type[3]) ) {
ff_h264_pred_direct_motion(h, &mb_type);
h->ref_cache[0][scan8[4]] =
- h->ref_cache[1][scan8[4]] =
- h->ref_cache[0][scan8[12]] =
- h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
- if(h->ref_count[0] > 1 || h->ref_count[1] > 1)
- {
- for(i = 0; i < 4; i++)
- if(IS_DIRECT(h->sub_mb_type[i]))
- fill_rectangle(&h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1);
+ h->ref_cache[1][scan8[4]] =
+ h->ref_cache[0][scan8[12]] =
+ h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
+ if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) {
+ for( i = 0; i < 4; i++ )
+ if( IS_DIRECT(h->sub_mb_type[i]) )
+ fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 );
}
}
- }
- else
- {
- for(i = 0; i < 4; i++)
- {
- h->sub_mb_type[i] = decode_cabac_p_mb_sub_type(h);
- sub_partition_count[i] = p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
- h->sub_mb_type[i] = p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
+ } else {
+ for( i = 0; i < 4; i++ ) {
+ h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h );
+ sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
+ h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
}
}
- for(list = 0; list < h->list_count; list++)
- {
- 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)
- {
- 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]);
- return -1;
- }
+ for( list = 0; list < h->list_count; list++ ) {
+ 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 ){
+ 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]);
+ return -1;
+ }
+ }else
+ ref[list][i] = 0;
+ } else {
+ ref[list][i] = -1;
}
- else
- ref[list][i] = 0;
+ h->ref_cache[list][ scan8[4*i]+1 ]=
+ h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
}
- else
- {
- ref[list][i] = -1;
- }
- h->ref_cache[list][ scan8[4*i] + 1 ] =
- h->ref_cache[list][ scan8[4*i] + 8 ] = h->ref_cache[list][ scan8[4*i] + 9 ] = ref[list][i];
- }
}
if(dct8x8_allowed)
dct8x8_allowed = get_dct8x8_allowed(h);
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 4; i++)
- {
- h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i] + 1 ];
- if(IS_DIRECT(h->sub_mb_type[i]))
- {
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<4; i++){
+ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ];
+ if(IS_DIRECT(h->sub_mb_type[i])){
fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4);
continue;
}
- if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i]))
- {
- const int sub_mb_type = h->sub_mb_type[i];
- const int block_width = (sub_mb_type & (MB_TYPE_16x16 | MB_TYPE_16x8)) ? 2 : 1;
- for(j = 0; j < sub_partition_count[i]; j++)
- {
+ if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){
+ const int sub_mb_type= h->sub_mb_type[i];
+ const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
+ for(j=0; j<sub_partition_count[i]; j++){
int mpx, mpy;
int mx, my;
- const int index = 4 * i + block_width * j;
- int16_t (* mv_cache)[2] = &h->mv_cache[list][ scan8[index] ];
- int16_t (* mvd_cache)[2] = &h->mvd_cache[list][ scan8[index] ];
+ const int index= 4*i + block_width*j;
+ int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
+ int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ];
pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy);
- mx = mpx + decode_cabac_mb_mvd(h, list, index, 0);
- my = mpy + decode_cabac_mb_mvd(h, list, index, 1);
+ mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 );
+ my = mpy + decode_cabac_mb_mvd( h, list, index, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- if(IS_SUB_8X8(sub_mb_type))
- {
- mv_cache[ 1 ][0] =
- mv_cache[ 8 ][0] = mv_cache[ 9 ][0] = mx;
- mv_cache[ 1 ][1] =
- mv_cache[ 8 ][1] = mv_cache[ 9 ][1] = my;
-
- mvd_cache[ 1 ][0] =
- mvd_cache[ 8 ][0] = mvd_cache[ 9 ][0] = mx - mpx;
- mvd_cache[ 1 ][1] =
- mvd_cache[ 8 ][1] = mvd_cache[ 9 ][1] = my - mpy;
+ if(IS_SUB_8X8(sub_mb_type)){
+ mv_cache[ 1 ][0]=
+ mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
+ mv_cache[ 1 ][1]=
+ mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
+
+ mvd_cache[ 1 ][0]=
+ mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx;
+ mvd_cache[ 1 ][1]=
+ mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy;
+ }else if(IS_SUB_8X4(sub_mb_type)){
+ mv_cache[ 1 ][0]= mx;
+ mv_cache[ 1 ][1]= my;
+
+ mvd_cache[ 1 ][0]= mx - mpx;
+ mvd_cache[ 1 ][1]= my - mpy;
+ }else if(IS_SUB_4X8(sub_mb_type)){
+ mv_cache[ 8 ][0]= mx;
+ mv_cache[ 8 ][1]= my;
+
+ mvd_cache[ 8 ][0]= mx - mpx;
+ mvd_cache[ 8 ][1]= my - mpy;
}
- else if(IS_SUB_8X4(sub_mb_type))
- {
- mv_cache[ 1 ][0] = mx;
- mv_cache[ 1 ][1] = my;
+ mv_cache[ 0 ][0]= mx;
+ mv_cache[ 0 ][1]= my;
- mvd_cache[ 1 ][0] = mx - mpx;
- mvd_cache[ 1 ][1] = my - mpy;
- }
- else if(IS_SUB_4X8(sub_mb_type))
- {
- mv_cache[ 8 ][0] = mx;
- mv_cache[ 8 ][1] = my;
-
- mvd_cache[ 8 ][0] = mx - mpx;
- mvd_cache[ 8 ][1] = my - mpy;
- }
- mv_cache[ 0 ][0] = mx;
- mv_cache[ 0 ][1] = my;
-
- mvd_cache[ 0 ][0] = mx - mpx;
- mvd_cache[ 0 ][1] = my - mpy;
+ mvd_cache[ 0 ][0]= mx - mpx;
+ mvd_cache[ 0 ][1]= my - mpy;
}
- }
- else
- {
- uint32_t *p = (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
- uint32_t *pd = (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0];
+ }else{
+ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
+ uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0];
p[0] = p[1] = p[8] = p[9] = 0;
- pd[0] = pd[1] = pd[8] = pd[9] = 0;
+ pd[0]= pd[1]= pd[8]= pd[9]= 0;
}
}
}
- }
- else if(IS_DIRECT(mb_type))
- {
+ } else if( IS_DIRECT(mb_type) ) {
ff_h264_pred_direct_motion(h, &mb_type);
fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4);
fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4);
dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
- }
- else
- {
+ } else {
int list, mx, my, i, mpx, mpy;
- if(IS_16X16(mb_type))
- {
- for(list = 0; list < h->list_count; list++)
- {
- if(IS_DIR(mb_type, 0, list))
- {
+ 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)
- {
- ref = decode_cabac_mb_ref(h, list, 0);
- if(ref >= (unsigned)h->ref_count[list])
- {
+ if(h->ref_count[list] > 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]);
return -1;
}
- }
- else
- ref = 0;
- fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1);
- }
- else
+ }else
+ ref=0;
+ fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1);
+ }else
fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); //FIXME factorize and the other fill_rect below too
}
- for(list = 0; list < h->list_count; list++)
- {
- if(IS_DIR(mb_type, 0, list))
- {
+ for(list=0; list<h->list_count; list++){
+ if(IS_DIR(mb_type, 0, list)){
pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy);
- mx = mpx + decode_cabac_mb_mvd(h, list, 0, 0);
- my = mpy + decode_cabac_mb_mvd(h, list, 0, 1);
+ mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 );
+ my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx - mpx, my - mpy), 4);
- fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx, my), 4);
- }
- else
+ fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4);
+ fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
+ }else
fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4);
}
}
- else if(IS_16X8(mb_type))
- {
- 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)
- {
- 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]);
- return -1;
- }
- }
- else
- ref = 0;
- fill_rectangle(&h->ref_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, ref, 1);
+ else if(IS_16X8(mb_type)){
+ 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){
+ 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]);
+ return -1;
+ }
+ }else
+ ref=0;
+ fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1);
+ }else
+ fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);
}
- else
- fill_rectangle(&h->ref_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, (LIST_NOT_USED & 0xFF), 1);
- }
}
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 2; i++)
- {
- if(IS_DIR(mb_type, i, list))
- {
- pred_16x8_motion(h, 8 * i, list, h->ref_cache[list][scan8[0] + 16 * i], &mpx, &mpy);
- mx = mpx + decode_cabac_mb_mvd(h, list, 8 * i, 0);
- my = mpy + decode_cabac_mb_mvd(h, list, 8 * i, 1);
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<2; i++){
+ if(IS_DIR(mb_type, i, list)){
+ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy);
+ mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 );
+ my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- fill_rectangle(h->mvd_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, pack16to32(mx - mpx, my - mpy), 4);
- fill_rectangle(h->mv_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, pack16to32(mx, my), 4);
- }
- else
- {
- fill_rectangle(h->mvd_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, 0, 4);
- fill_rectangle(h-> mv_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, 0, 4);
+ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4);
+ fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
+ }else{
+ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
+ fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
}
}
}
- }
- else
- {
+ }else{
assert(IS_8X16(mb_type));
- 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)
- {
- 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]);
- return -1;
- }
- }
- else
- ref = 0;
- fill_rectangle(&h->ref_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, ref, 1);
+ 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){
+ 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]);
+ return -1;
+ }
+ }else
+ ref=0;
+ fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1);
+ }else
+ fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);
}
- else
- fill_rectangle(&h->ref_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, (LIST_NOT_USED & 0xFF), 1);
- }
}
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 2; i++)
- {
- if(IS_DIR(mb_type, i, list))
- {
- pred_8x16_motion(h, i * 4, list, h->ref_cache[list][ scan8[0] + 2 * i ], &mpx, &mpy);
- mx = mpx + decode_cabac_mb_mvd(h, list, 4 * i, 0);
- my = mpy + decode_cabac_mb_mvd(h, list, 4 * i, 1);
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<2; i++){
+ if(IS_DIR(mb_type, i, list)){
+ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy);
+ mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 );
+ my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- fill_rectangle(h->mvd_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, pack16to32(mx - mpx, my - mpy), 4);
- fill_rectangle(h->mv_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, pack16to32(mx, my), 4);
- }
- else
- {
- fill_rectangle(h->mvd_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, 0, 4);
- fill_rectangle(h-> mv_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, 0, 4);
+ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4);
+ fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
+ }else{
+ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
+ fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
}
}
}
}
}
- if(IS_INTER(mb_type))
- {
+ if( IS_INTER( mb_type ) ) {
h->chroma_pred_mode_table[mb_xy] = 0;
- write_back_motion(h, mb_type);
- }
+ write_back_motion( h, mb_type );
+ }
- if(!IS_INTRA16x16(mb_type))
- {
- cbp = decode_cabac_mb_cbp_luma(h);
+ if( !IS_INTRA16x16( mb_type ) ) {
+ cbp = decode_cabac_mb_cbp_luma( h );
if(CHROMA)
- cbp |= decode_cabac_mb_cbp_chroma(h) << 4;
+ cbp |= decode_cabac_mb_cbp_chroma( h ) << 4;
}
h->cbp_table[mb_xy] = h->cbp = cbp;
- if(dct8x8_allowed && (cbp & 15) && !IS_INTRA(mb_type))
- {
- if(decode_cabac_mb_transform_size(h))
+ if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) {
+ if( decode_cabac_mb_transform_size( h ) )
mb_type |= MB_TYPE_8x8DCT;
}
- s->current_picture.mb_type[mb_xy] = mb_type;
+ s->current_picture.mb_type[mb_xy]= mb_type;
- if(cbp || IS_INTRA16x16(mb_type))
- {
+ if( cbp || IS_INTRA16x16( mb_type ) ) {
const uint8_t *scan, *scan8x8, *dc_scan;
const uint32_t *qmul;
int dqp;
- if(IS_INTERLACED(mb_type))
- {
- scan8x8 = s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
- scan = s->qscale ? h->field_scan : h->field_scan_q0;
- dc_scan = luma_dc_field_scan;
- }
- else
- {
- scan8x8 = s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
- scan = s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
- dc_scan = luma_dc_zigzag_scan;
+ if(IS_INTERLACED(mb_type)){
+ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
+ scan= s->qscale ? h->field_scan : h->field_scan_q0;
+ dc_scan= luma_dc_field_scan;
+ }else{
+ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
+ scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
+ dc_scan= luma_dc_zigzag_scan;
}
- h->last_qscale_diff = dqp = decode_cabac_mb_dqp(h);
- if(dqp == INT_MIN)
- {
+ h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h );
+ if( dqp == INT_MIN ){
av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
s->qscale += dqp;
- if(((unsigned)s->qscale) > 51)
- {
- if(s->qscale < 0) s->qscale += 52;
- else s->qscale -= 52;
+ if(((unsigned)s->qscale) > 51){
+ if(s->qscale<0) s->qscale+= 52;
+ else s->qscale-= 52;
}
h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
- if(IS_INTRA16x16(mb_type))
- {
+ if( IS_INTRA16x16( mb_type ) ) {
int i;
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" );
- decode_cabac_residual(h, h->mb, 0, 0, dc_scan, NULL, 16);
+ decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16);
- if(cbp & 15)
- {
+ if( cbp&15 ) {
qmul = h->dequant4_coeff[0][s->qscale];
- for(i = 0; i < 16; i++)
- {
+ for( i = 0; i < 16; i++ ) {
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i );
- decode_cabac_residual(h, h->mb + 16 * i, 1, i, scan + 1, qmul, 15);
+ decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, qmul, 15);
}
- }
- else
- {
+ } else {
fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
}
- }
- else
- {
+ } else {
int i8x8, i4x4;
- for(i8x8 = 0; i8x8 < 4; i8x8++)
- {
- if(cbp & (1 << i8x8))
- {
- if(IS_8x8DCT(mb_type))
- {
- decode_cabac_residual(h, h->mb + 64 * i8x8, 5, 4 * i8x8,
- scan8x8, h->dequant8_coeff[IS_INTRA(mb_type) ? 0:1][s->qscale], 64);
- }
- else
- {
- qmul = h->dequant4_coeff[IS_INTRA(mb_type) ? 0:3][s->qscale];
- for(i4x4 = 0; i4x4 < 4; i4x4++)
- {
- const int index = 4 * i8x8 + i4x4;
+ for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
+ if( cbp & (1<<i8x8) ) {
+ if( IS_8x8DCT(mb_type) ) {
+ decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8,
+ scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64);
+ } else {
+ qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale];
+ for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
+ const int index = 4*i8x8 + i4x4;
//av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
//START_TIMER
- decode_cabac_residual(h, h->mb + 16 * index, 2, index, scan, qmul, 16);
+ decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, qmul, 16);
//STOP_TIMER("decode_residual")
}
}
- }
- else
- {
- uint8_t * const nnz = &h->non_zero_count_cache[ scan8[4*i8x8] ];
+ } else {
+ uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
}
}
}
- if(cbp & 0x30)
- {
+ if( cbp&0x30 ){
int c;
- for(c = 0; c < 2; c++)
- {
+ for( c = 0; c < 2; c++ ) {
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
- decode_cabac_residual(h, h->mb + 256 + 16 * 4 * c, 3, c, chroma_dc_scan, NULL, 4);
+ decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4);
}
}
- if(cbp & 0x20)
- {
+ if( cbp&0x20 ) {
int c, i;
- for(c = 0; c < 2; c++)
- {
- qmul = h->dequant4_coeff[c+1+(IS_INTRA(mb_type) ? 0:3)][h->chroma_qp[c]];
- for(i = 0; i < 4; i++)
- {
+ for( c = 0; c < 2; c++ ) {
+ 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 + 4 * c + i;
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
- decode_cabac_residual(h, h->mb + 16 * index, 4, index, scan + 1, qmul, 15);
+ decode_cabac_residual(h, h->mb + 16*index, 4, index, scan + 1, qmul, 15);
}
}
+ } else {
+ uint8_t * const nnz= &h->non_zero_count_cache[0];
+ nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
+ nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
}
- else
- {
- uint8_t * const nnz = &h->non_zero_count_cache[0];
- nnz[ scan8[16] + 0 ] = nnz[ scan8[16] + 1 ] = nnz[ scan8[16] + 8 ] = nnz[ scan8[16] + 9 ] =
- nnz[ scan8[20] + 0 ] = nnz[ scan8[20] + 1 ] = nnz[ scan8[20] + 8 ] = nnz[ scan8[20] + 9 ] = 0;
- }
- }
- else
- {
- uint8_t * const nnz = &h->non_zero_count_cache[0];
+ } else {
+ uint8_t * const nnz= &h->non_zero_count_cache[0];
fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);
- nnz[ scan8[16] + 0 ] = nnz[ scan8[16] + 1 ] = nnz[ scan8[16] + 8 ] = nnz[ scan8[16] + 9 ] =
- nnz[ scan8[20] + 0 ] = nnz[ scan8[20] + 1 ] = nnz[ scan8[20] + 8 ] = nnz[ scan8[20] + 9 ] = 0;
+ nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
+ nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
h->last_qscale_diff = 0;
}
- s->current_picture.qscale_table[mb_xy] = s->qscale;
+ s->current_picture.qscale_table[mb_xy]= s->qscale;
write_back_non_zero_count(h);
- if(MB_MBAFF)
- {
+ if(MB_MBAFF){
h->ref_count[0] >>= 1;
h->ref_count[1] >>= 1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cavlc.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cavlc.c
index 8146ae241..d2c4fbc05 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cavlc.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_cavlc.c
@@ -38,175 +38,163 @@
//#undef NDEBUG
#include <assert.h>
-static const uint8_t golomb_to_inter_cbp_gray[16] =
-{
- 0, 1, 2, 4, 8, 3, 5, 10, 12, 15, 7, 11, 13, 14, 6, 9,
+static const uint8_t golomb_to_inter_cbp_gray[16]={
+ 0, 1, 2, 4, 8, 3, 5,10,12,15, 7,11,13,14, 6, 9,
};
-static const uint8_t golomb_to_intra4x4_cbp_gray[16] =
-{
- 15, 0, 7, 11, 13, 14, 3, 5, 10, 12, 1, 2, 4, 8, 6, 9,
+static const uint8_t golomb_to_intra4x4_cbp_gray[16]={
+15, 0, 7,11,13,14, 3, 5,10,12, 1, 2, 4, 8, 6, 9,
};
-static const uint8_t chroma_dc_coeff_token_len[4*5] =
-{
- 2, 0, 0, 0,
- 6, 1, 0, 0,
- 6, 6, 3, 0,
- 6, 7, 7, 6,
- 6, 8, 8, 7,
+static const uint8_t chroma_dc_coeff_token_len[4*5]={
+ 2, 0, 0, 0,
+ 6, 1, 0, 0,
+ 6, 6, 3, 0,
+ 6, 7, 7, 6,
+ 6, 8, 8, 7,
};
-static const uint8_t chroma_dc_coeff_token_bits[4*5] =
-{
- 1, 0, 0, 0,
- 7, 1, 0, 0,
- 4, 6, 1, 0,
- 3, 3, 2, 5,
- 2, 3, 2, 0,
+static const uint8_t chroma_dc_coeff_token_bits[4*5]={
+ 1, 0, 0, 0,
+ 7, 1, 0, 0,
+ 4, 6, 1, 0,
+ 3, 3, 2, 5,
+ 2, 3, 2, 0,
};
-static const uint8_t coeff_token_len[4][4*17] =
+static const uint8_t coeff_token_len[4][4*17]={
{
- {
- 1, 0, 0, 0,
- 6, 2, 0, 0, 8, 6, 3, 0, 9, 8, 7, 5, 10, 9, 8, 6,
- 11, 10, 9, 7, 13, 11, 10, 8, 13, 13, 11, 9, 13, 13, 13, 10,
- 14, 14, 13, 11, 14, 14, 14, 13, 15, 15, 14, 14, 15, 15, 15, 14,
- 16, 15, 15, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 2, 0, 0, 0,
- 6, 2, 0, 0, 6, 5, 3, 0, 7, 6, 6, 4, 8, 6, 6, 4,
- 8, 7, 7, 5, 9, 8, 8, 6, 11, 9, 9, 6, 11, 11, 11, 7,
- 12, 11, 11, 9, 12, 12, 12, 11, 12, 12, 12, 11, 13, 13, 13, 12,
- 13, 13, 13, 13, 13, 14, 13, 13, 14, 14, 14, 13, 14, 14, 14, 14,
- },
- {
- 4, 0, 0, 0,
- 6, 4, 0, 0, 6, 5, 4, 0, 6, 5, 5, 4, 7, 5, 5, 4,
- 7, 5, 5, 4, 7, 6, 6, 4, 7, 6, 6, 4, 8, 7, 7, 5,
- 8, 8, 7, 6, 9, 8, 8, 7, 9, 9, 8, 8, 9, 9, 9, 8,
- 10, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- },
- {
- 6, 0, 0, 0,
- 6, 6, 0, 0, 6, 6, 6, 0, 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,
- }
+ 1, 0, 0, 0,
+ 6, 2, 0, 0, 8, 6, 3, 0, 9, 8, 7, 5, 10, 9, 8, 6,
+ 11,10, 9, 7, 13,11,10, 8, 13,13,11, 9, 13,13,13,10,
+ 14,14,13,11, 14,14,14,13, 15,15,14,14, 15,15,15,14,
+ 16,15,15,15, 16,16,16,15, 16,16,16,16, 16,16,16,16,
+},
+{
+ 2, 0, 0, 0,
+ 6, 2, 0, 0, 6, 5, 3, 0, 7, 6, 6, 4, 8, 6, 6, 4,
+ 8, 7, 7, 5, 9, 8, 8, 6, 11, 9, 9, 6, 11,11,11, 7,
+ 12,11,11, 9, 12,12,12,11, 12,12,12,11, 13,13,13,12,
+ 13,13,13,13, 13,14,13,13, 14,14,14,13, 14,14,14,14,
+},
+{
+ 4, 0, 0, 0,
+ 6, 4, 0, 0, 6, 5, 4, 0, 6, 5, 5, 4, 7, 5, 5, 4,
+ 7, 5, 5, 4, 7, 6, 6, 4, 7, 6, 6, 4, 8, 7, 7, 5,
+ 8, 8, 7, 6, 9, 8, 8, 7, 9, 9, 8, 8, 9, 9, 9, 8,
+ 10, 9, 9, 9, 10,10,10,10, 10,10,10,10, 10,10,10,10,
+},
+{
+ 6, 0, 0, 0,
+ 6, 6, 0, 0, 6, 6, 6, 0, 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,
+}
};
-static const uint8_t coeff_token_bits[4][4*17] =
+static const uint8_t coeff_token_bits[4][4*17]={
{
- {
- 1, 0, 0, 0,
- 5, 1, 0, 0, 7, 4, 1, 0, 7, 6, 5, 3, 7, 6, 5, 3,
- 7, 6, 5, 4, 15, 6, 5, 4, 11, 14, 5, 4, 8, 10, 13, 4,
- 15, 14, 9, 4, 11, 10, 13, 12, 15, 14, 9, 12, 11, 10, 13, 8,
- 15, 1, 9, 12, 11, 14, 13, 8, 7, 10, 9, 12, 4, 6, 5, 8,
- },
- {
- 3, 0, 0, 0,
- 11, 2, 0, 0, 7, 7, 3, 0, 7, 10, 9, 5, 7, 6, 5, 4,
- 4, 6, 5, 6, 7, 6, 5, 8, 15, 6, 5, 4, 11, 14, 13, 4,
- 15, 10, 9, 4, 11, 14, 13, 12, 8, 10, 9, 8, 15, 14, 13, 12,
- 11, 10, 9, 12, 7, 11, 6, 8, 9, 8, 10, 1, 7, 6, 5, 4,
- },
- {
- 15, 0, 0, 0,
- 15, 14, 0, 0, 11, 15, 13, 0, 8, 12, 14, 12, 15, 10, 11, 11,
- 11, 8, 9, 10, 9, 14, 13, 9, 8, 10, 9, 8, 15, 14, 13, 13,
- 11, 14, 10, 12, 15, 10, 13, 12, 11, 14, 9, 12, 8, 10, 13, 8,
- 13, 7, 9, 12, 9, 12, 11, 10, 5, 8, 7, 6, 1, 4, 3, 2,
- },
- {
- 3, 0, 0, 0,
- 0, 1, 0, 0, 4, 5, 6, 0, 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, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- }
+ 1, 0, 0, 0,
+ 5, 1, 0, 0, 7, 4, 1, 0, 7, 6, 5, 3, 7, 6, 5, 3,
+ 7, 6, 5, 4, 15, 6, 5, 4, 11,14, 5, 4, 8,10,13, 4,
+ 15,14, 9, 4, 11,10,13,12, 15,14, 9,12, 11,10,13, 8,
+ 15, 1, 9,12, 11,14,13, 8, 7,10, 9,12, 4, 6, 5, 8,
+},
+{
+ 3, 0, 0, 0,
+ 11, 2, 0, 0, 7, 7, 3, 0, 7,10, 9, 5, 7, 6, 5, 4,
+ 4, 6, 5, 6, 7, 6, 5, 8, 15, 6, 5, 4, 11,14,13, 4,
+ 15,10, 9, 4, 11,14,13,12, 8,10, 9, 8, 15,14,13,12,
+ 11,10, 9,12, 7,11, 6, 8, 9, 8,10, 1, 7, 6, 5, 4,
+},
+{
+ 15, 0, 0, 0,
+ 15,14, 0, 0, 11,15,13, 0, 8,12,14,12, 15,10,11,11,
+ 11, 8, 9,10, 9,14,13, 9, 8,10, 9, 8, 15,14,13,13,
+ 11,14,10,12, 15,10,13,12, 11,14, 9,12, 8,10,13, 8,
+ 13, 7, 9,12, 9,12,11,10, 5, 8, 7, 6, 1, 4, 3, 2,
+},
+{
+ 3, 0, 0, 0,
+ 0, 1, 0, 0, 4, 5, 6, 0, 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,43, 44,45,46,47,
+ 48,49,50,51, 52,53,54,55, 56,57,58,59, 60,61,62,63,
+}
};
-static const uint8_t total_zeros_len[16][16] =
-{
- {1, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9},
- {3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6},
- {4, 3, 3, 3, 4, 4, 3, 3, 4, 5, 5, 6, 5, 6},
- {5, 3, 4, 4, 3, 3, 3, 4, 3, 4, 5, 5, 5},
- {4, 4, 4, 3, 3, 3, 3, 3, 4, 5, 4, 5},
- {6, 5, 3, 3, 3, 3, 3, 3, 4, 3, 6},
- {6, 5, 3, 3, 3, 2, 3, 4, 3, 6},
- {6, 4, 5, 3, 2, 2, 3, 3, 6},
- {6, 6, 4, 2, 2, 3, 2, 5},
- {5, 5, 3, 2, 2, 2, 4},
- {4, 4, 3, 3, 1, 3},
- {4, 4, 2, 1, 3},
- {3, 3, 1, 2},
- {2, 2, 1},
- {1, 1},
+static const uint8_t total_zeros_len[16][16]= {
+ {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9},
+ {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6},
+ {4,3,3,3,4,4,3,3,4,5,5,6,5,6},
+ {5,3,4,4,3,3,3,4,3,4,5,5,5},
+ {4,4,4,3,3,3,3,3,4,5,4,5},
+ {6,5,3,3,3,3,3,3,4,3,6},
+ {6,5,3,3,3,2,3,4,3,6},
+ {6,4,5,3,2,2,3,3,6},
+ {6,6,4,2,2,3,2,5},
+ {5,5,3,2,2,2,4},
+ {4,4,3,3,1,3},
+ {4,4,2,1,3},
+ {3,3,1,2},
+ {2,2,1},
+ {1,1},
};
-static const uint8_t total_zeros_bits[16][16] =
-{
- {1, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 1},
- {7, 6, 5, 4, 3, 5, 4, 3, 2, 3, 2, 3, 2, 1, 0},
- {5, 7, 6, 5, 4, 3, 4, 3, 2, 3, 2, 1, 1, 0},
- {3, 7, 5, 4, 6, 5, 4, 3, 3, 2, 2, 1, 0},
- {5, 4, 3, 7, 6, 5, 4, 3, 2, 1, 1, 0},
- {1, 1, 7, 6, 5, 4, 3, 2, 1, 1, 0},
- {1, 1, 5, 4, 3, 3, 2, 1, 1, 0},
- {1, 1, 1, 3, 3, 2, 2, 1, 0},
- {1, 0, 1, 3, 2, 1, 1, 1},
- {1, 0, 1, 3, 2, 1, 1},
- {0, 1, 1, 2, 1, 3},
- {0, 1, 1, 1, 1},
- {0, 1, 1, 1},
- {0, 1, 1},
- {0, 1},
+static const uint8_t total_zeros_bits[16][16]= {
+ {1,3,2,3,2,3,2,3,2,3,2,3,2,3,2,1},
+ {7,6,5,4,3,5,4,3,2,3,2,3,2,1,0},
+ {5,7,6,5,4,3,4,3,2,3,2,1,1,0},
+ {3,7,5,4,6,5,4,3,3,2,2,1,0},
+ {5,4,3,7,6,5,4,3,2,1,1,0},
+ {1,1,7,6,5,4,3,2,1,1,0},
+ {1,1,5,4,3,3,2,1,1,0},
+ {1,1,1,3,3,2,2,1,0},
+ {1,0,1,3,2,1,1,1},
+ {1,0,1,3,2,1,1},
+ {0,1,1,2,1,3},
+ {0,1,1,1,1},
+ {0,1,1,1},
+ {0,1,1},
+ {0,1},
};
-static const uint8_t chroma_dc_total_zeros_len[3][4] =
-{
+static const uint8_t chroma_dc_total_zeros_len[3][4]= {
{ 1, 2, 3, 3,},
{ 1, 2, 2, 0,},
{ 1, 1, 0, 0,},
};
-static const uint8_t chroma_dc_total_zeros_bits[3][4] =
-{
+static const uint8_t chroma_dc_total_zeros_bits[3][4]= {
{ 1, 1, 1, 0,},
{ 1, 1, 0, 0,},
{ 1, 0, 0, 0,},
};
-static const uint8_t run_len[7][16] =
-{
- {1, 1},
- {1, 2, 2},
- {2, 2, 2, 2},
- {2, 2, 2, 3, 3},
- {2, 2, 3, 3, 3, 3},
- {2, 3, 3, 3, 3, 3, 3},
- {3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11},
+static const uint8_t run_len[7][16]={
+ {1,1},
+ {1,2,2},
+ {2,2,2,2},
+ {2,2,2,3,3},
+ {2,2,3,3,3,3},
+ {2,3,3,3,3,3,3},
+ {3,3,3,3,3,3,3,4,5,6,7,8,9,10,11},
};
-static const uint8_t run_bits[7][16] =
-{
- {1, 0},
- {1, 1, 0},
- {3, 2, 1, 0},
- {3, 2, 1, 1, 0},
- {3, 2, 3, 2, 1, 0},
- {3, 0, 1, 3, 2, 5, 4},
- {7, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+static const uint8_t run_bits[7][16]={
+ {1,0},
+ {1,1,0},
+ {3,2,1,0},
+ {3,2,1,1,0},
+ {3,2,3,2,1,0},
+ {3,0,1,3,2,5,4},
+ {7,6,5,4,3,2,1,1,1,1,1,1,1,1,1},
};
static VLC coeff_token_vlc[4];
static VLC_TYPE coeff_token_vlc_tables[520+332+280+256][2];
-static const int coeff_token_vlc_tables_size[4] = {520, 332, 280, 256};
+static const int coeff_token_vlc_tables_size[4]={520,332,280,256};
static VLC chroma_dc_coeff_token_vlc;
static VLC_TYPE chroma_dc_coeff_token_vlc_table[256][2];
@@ -236,76 +224,64 @@ static int8_t cavlc_level_tab[7][1<<LEVEL_TAB_BITS][2];
* gets the predicted number of non-zero coefficients.
* @param n block index
*/
-static inline int pred_non_zero_count(H264Context *h, int n)
-{
- const int index8 = scan8[n];
- const int left = h->non_zero_count_cache[index8 - 1];
+static inline int pred_non_zero_count(H264Context *h, int n){
+ const int index8= scan8[n];
+ const int left= h->non_zero_count_cache[index8 - 1];
const int top = h->non_zero_count_cache[index8 - 8];
- int i = left + top;
+ int i= left + top;
- if(i < 64) i = (i + 1) >> 1;
+ if(i<64) i= (i+1)>>1;
- tprintf(h->s.avctx, "pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i & 31);
+ tprintf(h->s.avctx, "pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
- return i & 31;
+ return i&31;
}
-static av_cold void init_cavlc_level_tab(void)
-{
+static av_cold void init_cavlc_level_tab(void){
int suffix_length, mask;
unsigned int i;
- for(suffix_length = 0; suffix_length < 7; suffix_length++)
- {
- for(i = 0; i < (1 << LEVEL_TAB_BITS); i++)
- {
- int prefix = LEVEL_TAB_BITS - av_log2(2 * i);
- int level_code = (prefix << suffix_length) + (i >> (LEVEL_TAB_BITS - prefix - 1 - suffix_length)) - (1 << suffix_length);
-
- mask = -(level_code & 1);
- level_code = (((2 + level_code) >> 1) ^ mask) - mask;
- if(prefix + 1 + suffix_length <= LEVEL_TAB_BITS)
- {
- cavlc_level_tab[suffix_length][i][0] = level_code;
- cavlc_level_tab[suffix_length][i][1] = prefix + 1 + suffix_length;
- }
- else if(prefix + 1 <= LEVEL_TAB_BITS)
- {
- cavlc_level_tab[suffix_length][i][0] = prefix + 100;
- cavlc_level_tab[suffix_length][i][1] = prefix + 1;
- }
- else
- {
- cavlc_level_tab[suffix_length][i][0] = LEVEL_TAB_BITS + 100;
- cavlc_level_tab[suffix_length][i][1] = LEVEL_TAB_BITS;
+ for(suffix_length=0; suffix_length<7; suffix_length++){
+ for(i=0; i<(1<<LEVEL_TAB_BITS); i++){
+ int prefix= LEVEL_TAB_BITS - av_log2(2*i);
+ int level_code= (prefix<<suffix_length) + (i>>(LEVEL_TAB_BITS-prefix-1-suffix_length)) - (1<<suffix_length);
+
+ mask= -(level_code&1);
+ level_code= (((2+level_code)>>1) ^ mask) - mask;
+ if(prefix + 1 + suffix_length <= LEVEL_TAB_BITS){
+ cavlc_level_tab[suffix_length][i][0]= level_code;
+ cavlc_level_tab[suffix_length][i][1]= prefix + 1 + suffix_length;
+ }else if(prefix + 1 <= LEVEL_TAB_BITS){
+ cavlc_level_tab[suffix_length][i][0]= prefix+100;
+ cavlc_level_tab[suffix_length][i][1]= prefix + 1;
+ }else{
+ cavlc_level_tab[suffix_length][i][0]= LEVEL_TAB_BITS+100;
+ cavlc_level_tab[suffix_length][i][1]= LEVEL_TAB_BITS;
}
}
}
}
-av_cold void ff_h264_decode_init_vlc(void)
-{
+av_cold void ff_h264_decode_init_vlc(void){
static int done = 0;
- if(!done)
- {
+ if (!done) {
int i;
int offset;
done = 1;
chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table;
chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size;
- init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4 * 5,
+ init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,
&chroma_dc_coeff_token_len [0], 1, 1,
&chroma_dc_coeff_token_bits[0], 1, 1,
INIT_VLC_USE_NEW_STATIC);
offset = 0;
- for(i = 0; i < 4; i++)
- {
- coeff_token_vlc[i].table = coeff_token_vlc_tables + offset;
+ for(i=0; i<4; i++){
+ coeff_token_vlc[i].table = coeff_token_vlc_tables+offset;
coeff_token_vlc[i].table_allocated = coeff_token_vlc_tables_size[i];
- init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4 * 17,
+ init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17,
&coeff_token_len [i][0], 1, 1,
&coeff_token_bits[i][0], 1, 1,
INIT_VLC_USE_NEW_STATIC);
@@ -318,8 +294,7 @@ av_cold void ff_h264_decode_init_vlc(void)
*/
assert(offset == FF_ARRAY_ELEMS(coeff_token_vlc_tables));
- for(i = 0; i < 3; i++)
- {
+ for(i=0; i<3; i++){
chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i];
chroma_dc_total_zeros_vlc[i].table_allocated = chroma_dc_total_zeros_vlc_tables_size;
init_vlc(&chroma_dc_total_zeros_vlc[i],
@@ -328,8 +303,7 @@ av_cold void ff_h264_decode_init_vlc(void)
&chroma_dc_total_zeros_bits[i][0], 1, 1,
INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < 15; i++)
- {
+ for(i=0; i<15; i++){
total_zeros_vlc[i].table = total_zeros_vlc_tables[i];
total_zeros_vlc[i].table_allocated = total_zeros_vlc_tables_size;
init_vlc(&total_zeros_vlc[i],
@@ -339,8 +313,7 @@ av_cold void ff_h264_decode_init_vlc(void)
INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < 6; i++)
- {
+ for(i=0; i<6; i++){
run_vlc[i].table = run_vlc_tables[i];
run_vlc[i].table_allocated = run_vlc_tables_size;
init_vlc(&run_vlc[i],
@@ -350,7 +323,7 @@ av_cold void ff_h264_decode_init_vlc(void)
INIT_VLC_USE_NEW_STATIC);
}
run7_vlc.table = run7_vlc_table,
- run7_vlc.table_allocated = run7_vlc_table_size;
+ run7_vlc.table_allocated = run7_vlc_table_size;
init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,
&run_len [6][0], 1, 1,
&run_bits[6][0], 1, 1,
@@ -363,25 +336,24 @@ av_cold void ff_h264_decode_init_vlc(void)
/**
*
*/
-static inline int get_level_prefix(GetBitContext *gb)
-{
+static inline int get_level_prefix(GetBitContext *gb){
unsigned int buf;
int log;
OPEN_READER(re, gb);
UPDATE_CACHE(re, gb);
- buf = GET_CACHE(re, gb);
+ buf=GET_CACHE(re, gb);
- log = 32 - av_log2(buf);
+ log= 32 - av_log2(buf);
#ifdef TRACE
- print_bin(buf >> (32 - log), log);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d lpr @%5d in %s get_level_prefix\n", buf >> (32 - log), log, log - 1, get_bits_count(gb), __FILE__);
+ print_bin(buf>>(32-log), log);
+ av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d lpr @%5d in %s get_level_prefix\n", buf>>(32-log), log, log-1, get_bits_count(gb), __FILE__);
#endif
LAST_SKIP_BITS(re, gb, log);
CLOSE_READER(re, gb);
- return log - 1;
+ return log-1;
}
/**
@@ -391,199 +363,163 @@ static inline int get_level_prefix(GetBitContext *gb)
* @param max_coeff number of coefficients in the block
* @return <0 if an error occurred
*/
-static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff)
-{
+static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){
MpegEncContext * const s = &h->s;
- static const int coeff_token_table_index[17] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};
+ static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};
int level[16];
int zeros_left, coeff_num, coeff_token, total_coeff, i, j, trailing_ones, run_before;
//FIXME put trailing_onex into the context
- if(n == CHROMA_DC_BLOCK_INDEX)
- {
- coeff_token = get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);
- total_coeff = coeff_token >> 2;
- }
- else
- {
- if(n == LUMA_DC_BLOCK_INDEX)
- {
- total_coeff = pred_non_zero_count(h, 0);
- coeff_token = get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
- total_coeff = coeff_token >> 2;
- }
- else
- {
- total_coeff = pred_non_zero_count(h, n);
- coeff_token = get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
- total_coeff = coeff_token >> 2;
- h->non_zero_count_cache[ scan8[n] ] = total_coeff;
+ if(n == CHROMA_DC_BLOCK_INDEX){
+ coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);
+ total_coeff= coeff_token>>2;
+ }else{
+ if(n == LUMA_DC_BLOCK_INDEX){
+ total_coeff= pred_non_zero_count(h, 0);
+ coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
+ total_coeff= coeff_token>>2;
+ }else{
+ total_coeff= pred_non_zero_count(h, n);
+ coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
+ total_coeff= coeff_token>>2;
+ h->non_zero_count_cache[ scan8[n] ]= total_coeff;
}
}
//FIXME set last_non_zero?
- if(total_coeff == 0)
+ if(total_coeff==0)
return 0;
- if(total_coeff > (unsigned)max_coeff)
- {
+ if(total_coeff > (unsigned)max_coeff) {
av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff);
return -1;
}
- trailing_ones = coeff_token & 3;
+ trailing_ones= coeff_token&3;
tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);
- assert(total_coeff <= 16);
+ assert(total_coeff<=16);
i = show_bits(gb, 3);
skip_bits(gb, trailing_ones);
- level[0] = 1 - ((i & 4) >> 1);
- level[1] = 1 - ((i & 2));
- level[2] = 1 - ((i & 1) << 1);
+ level[0] = 1-((i&4)>>1);
+ level[1] = 1-((i&2) );
+ level[2] = 1-((i&1)<<1);
- if(trailing_ones < total_coeff)
- {
+ if(trailing_ones<total_coeff) {
int mask, prefix;
int suffix_length = total_coeff > 10 & trailing_ones < 3;
- int bitsi = show_bits(gb, LEVEL_TAB_BITS);
- int level_code = cavlc_level_tab[suffix_length][bitsi][0];
+ int bitsi= show_bits(gb, LEVEL_TAB_BITS);
+ int level_code= cavlc_level_tab[suffix_length][bitsi][0];
skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
- if(level_code >= 100)
- {
- prefix = level_code - 100;
+ if(level_code >= 100){
+ prefix= level_code - 100;
if(prefix == LEVEL_TAB_BITS)
prefix += get_level_prefix(gb);
//first coefficient has suffix_length equal to 0 or 1
- if(prefix < 14) //FIXME try to build a large unified VLC table for all this
- {
+ if(prefix<14){ //FIXME try to build a large unified VLC table for all this
if(suffix_length)
- level_code = (prefix << 1) + get_bits1(gb); //part
+ level_code= (prefix<<1) + get_bits1(gb); //part
else
- level_code = prefix; //part
- }
- else if(prefix == 14)
- {
+ level_code= prefix; //part
+ }else if(prefix==14){
if(suffix_length)
- level_code = (prefix << 1) + get_bits1(gb); //part
+ level_code= (prefix<<1) + get_bits1(gb); //part
else
- level_code = prefix + get_bits(gb, 4); //part
- }
- else
- {
- level_code = 30 + get_bits(gb, prefix - 3); //part
- if(prefix >= 16)
- level_code += (1 << (prefix - 3)) - 4096;
+ level_code= prefix + get_bits(gb, 4); //part
+ }else{
+ level_code= 30 + get_bits(gb, prefix-3); //part
+ if(prefix>=16)
+ level_code += (1<<(prefix-3))-4096;
}
if(trailing_ones < 3) level_code += 2;
suffix_length = 2;
- mask = -(level_code & 1);
- level[trailing_ones] = (((2 + level_code) >> 1) ^ mask) - mask;
- }
- else
- {
- level_code += ((level_code >> 31) | 1) & -(trailing_ones < 3);
+ mask= -(level_code&1);
+ level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;
+ }else{
+ level_code += ((level_code>>31)|1) & -(trailing_ones < 3);
suffix_length = 1 + (level_code + 3U > 6U);
- level[trailing_ones] = level_code;
+ level[trailing_ones]= level_code;
}
//remaining coefficients have suffix_length > 0
- for(i = trailing_ones + 1; i < total_coeff; i++)
- {
- static const unsigned int suffix_limit[7] = {0, 3, 6, 12, 24, 48, INT_MAX };
- int bitsi = show_bits(gb, LEVEL_TAB_BITS);
- level_code = cavlc_level_tab[suffix_length][bitsi][0];
+ for(i=trailing_ones+1;i<total_coeff;i++) {
+ static const unsigned int suffix_limit[7] = {0,3,6,12,24,48,INT_MAX };
+ int bitsi= show_bits(gb, LEVEL_TAB_BITS);
+ level_code= cavlc_level_tab[suffix_length][bitsi][0];
skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
- if(level_code >= 100)
- {
- prefix = level_code - 100;
- if(prefix == LEVEL_TAB_BITS)
- {
+ if(level_code >= 100){
+ prefix= level_code - 100;
+ if(prefix == LEVEL_TAB_BITS){
prefix += get_level_prefix(gb);
}
- if(prefix < 15)
- {
- level_code = (prefix << suffix_length) + get_bits(gb, suffix_length);
- }
- else
- {
- level_code = (15 << suffix_length) + get_bits(gb, prefix - 3);
- if(prefix >= 16)
- level_code += (1 << (prefix - 3)) - 4096;
+ if(prefix<15){
+ level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);
+ }else{
+ level_code = (15<<suffix_length) + get_bits(gb, prefix-3);
+ if(prefix>=16)
+ level_code += (1<<(prefix-3))-4096;
}
- mask = -(level_code & 1);
- level_code = (((2 + level_code) >> 1) ^ mask) - mask;
+ mask= -(level_code&1);
+ level_code= (((2+level_code)>>1) ^ mask) - mask;
}
- level[i] = level_code;
- suffix_length += suffix_limit[suffix_length] + level_code > 2U * suffix_limit[suffix_length];
+ level[i]= level_code;
+ suffix_length+= suffix_limit[suffix_length] + level_code > 2U*suffix_limit[suffix_length];
}
}
if(total_coeff == max_coeff)
- zeros_left = 0;
- else
- {
+ zeros_left=0;
+ else{
if(n == CHROMA_DC_BLOCK_INDEX)
- zeros_left = get_vlc2(gb, (chroma_dc_total_zeros_vlc - 1)[ total_coeff ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);
+ zeros_left= get_vlc2(gb, (chroma_dc_total_zeros_vlc-1)[ total_coeff ].table, CHROMA_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-1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1);
}
coeff_num = zeros_left + total_coeff - 1;
j = scantable[coeff_num];
- if(n > 24)
- {
+ if(n > 24){
block[j] = level[0];
- for(i = 1; i < total_coeff; i++)
- {
+ for(i=1;i<total_coeff;i++) {
if(zeros_left <= 0)
run_before = 0;
- else if(zeros_left < 7)
- {
- run_before = get_vlc2(gb, (run_vlc - 1)[zeros_left].table, RUN_VLC_BITS, 1);
- }
- else
- {
- run_before = get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
+ else if(zeros_left < 7){
+ run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);
+ }else{
+ run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
}
zeros_left -= run_before;
coeff_num -= 1 + run_before;
- j = scantable[ coeff_num ];
+ j= scantable[ coeff_num ];
- block[j] = level[i];
+ block[j]= level[i];
}
- }
- else
- {
- block[j] = (level[0] * qmul[j] + 32) >> 6;
- for(i = 1; i < total_coeff; i++)
- {
+ }else{
+ block[j] = (level[0] * qmul[j] + 32)>>6;
+ for(i=1;i<total_coeff;i++) {
if(zeros_left <= 0)
run_before = 0;
- else if(zeros_left < 7)
- {
- run_before = get_vlc2(gb, (run_vlc - 1)[zeros_left].table, RUN_VLC_BITS, 1);
- }
- else
- {
- run_before = get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
+ else if(zeros_left < 7){
+ run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);
+ }else{
+ run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
}
zeros_left -= run_before;
coeff_num -= 1 + run_before;
- j = scantable[ coeff_num ];
+ j= scantable[ coeff_num ];
- block[j] = (level[i] * qmul[j] + 32) >> 6;
+ block[j]= (level[i] * qmul[j] + 32)>>6;
}
}
- if(zeros_left < 0)
- {
+ 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;
}
@@ -591,37 +527,32 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
return 0;
}
-int ff_h264_decode_mb_cavlc(H264Context *h)
-{
+int ff_h264_decode_mb_cavlc(H264Context *h){
MpegEncContext * const s = &h->s;
int mb_xy;
int partition_count;
unsigned int mb_type, cbp;
- int dct8x8_allowed = h->pps.transform_8x8_mode;
-
- mb_xy = h->mb_xy = s->mb_x + s->mb_y * s->mb_stride;
+ int dct8x8_allowed= h->pps.transform_8x8_mode;
+ mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
+
/* ffdshow custom code */
-#if ENABLE_SLICE_MT_PATCH
- if(s->avctx->thread_count > 1)
- {
+ #if ENABLE_SLICE_MT_PATCH
+ if(s->avctx->thread_count > 1) {
s->dsp.clear_blocks(h->mb);
}
-#endif
+ #endif
tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
cbp = 0; /* avoid warning. FIXME: find a solution without slowing
down the code */
- if(h->slice_type_nos != FF_I_TYPE)
- {
- if(s->mb_skip_run == -1)
- s->mb_skip_run = get_ue_golomb(&s->gb);
-
- if(s->mb_skip_run--)
- {
- if(FRAME_MBAFF && (s->mb_y & 1) == 0)
- {
- if(s->mb_skip_run == 0)
+ if(h->slice_type_nos != FF_I_TYPE){
+ if(s->mb_skip_run==-1)
+ s->mb_skip_run= get_ue_golomb(&s->gb);
+
+ if (s->mb_skip_run--) {
+ if(FRAME_MBAFF && (s->mb_y&1) == 0){
+ if(s->mb_skip_run==0)
h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
else
predict_field_decoding_flag(h);
@@ -630,87 +561,71 @@ int ff_h264_decode_mb_cavlc(H264Context *h)
return 0;
}
}
- if(FRAME_MBAFF)
- {
- if((s->mb_y & 1) == 0)
+ if(FRAME_MBAFF){
+ if( (s->mb_y&1) == 0 )
h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
}
- h->prev_mb_skipped = 0;
+ h->prev_mb_skipped= 0;
- mb_type = get_ue_golomb(&s->gb);
- if(h->slice_type_nos == FF_B_TYPE)
- {
- if(mb_type < 23)
- {
- partition_count = b_mb_type_info[mb_type].partition_count;
- mb_type = b_mb_type_info[mb_type].type;
- }
- else
- {
+ mb_type= get_ue_golomb(&s->gb);
+ if(h->slice_type_nos == FF_B_TYPE){
+ if(mb_type < 23){
+ partition_count= b_mb_type_info[mb_type].partition_count;
+ mb_type= b_mb_type_info[mb_type].type;
+ }else{
mb_type -= 23;
goto decode_intra_mb;
}
- }
- else if(h->slice_type_nos == FF_P_TYPE)
- {
- if(mb_type < 5)
- {
- partition_count = p_mb_type_info[mb_type].partition_count;
- mb_type = p_mb_type_info[mb_type].type;
- }
- else
- {
+ }else if(h->slice_type_nos == FF_P_TYPE){
+ if(mb_type < 5){
+ partition_count= p_mb_type_info[mb_type].partition_count;
+ mb_type= p_mb_type_info[mb_type].type;
+ }else{
mb_type -= 5;
goto decode_intra_mb;
}
- }
- else
- {
- assert(h->slice_type_nos == FF_I_TYPE);
+ }else{
+ assert(h->slice_type_nos == FF_I_TYPE);
if(h->slice_type == FF_SI_TYPE && mb_type)
mb_type--;
decode_intra_mb:
- if(mb_type > 25)
- {
+ if(mb_type > 25){
av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y);
return -1;
}
- partition_count = 0;
- cbp = i_mb_type_info[mb_type].cbp;
- h->intra16x16_pred_mode = i_mb_type_info[mb_type].pred_mode;
- mb_type = i_mb_type_info[mb_type].type;
+ partition_count=0;
+ cbp= i_mb_type_info[mb_type].cbp;
+ h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
+ mb_type= i_mb_type_info[mb_type].type;
}
if(MB_FIELD)
mb_type |= MB_TYPE_INTERLACED;
- h->slice_table[ mb_xy ] = h->slice_num;
+ h->slice_table[ mb_xy ]= h->slice_num;
- if(IS_INTRA_PCM(mb_type))
- {
+ if(IS_INTRA_PCM(mb_type)){
unsigned int x;
// We assume these blocks are very rare so we do not optimize it.
align_get_bits(&s->gb);
// The pixels are stored in the same order as levels in h->mb array.
- for(x = 0; x < (CHROMA ? 384 : 256); x++)
- {
- ((uint8_t*)h->mb)[x] = get_bits(&s->gb, 8);
+ for(x=0; x < (CHROMA ? 384 : 256); x++){
+ ((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8);
}
// In deblocking, the quantizer is 0
- s->current_picture.qscale_table[mb_xy] = 0;
+ s->current_picture.qscale_table[mb_xy]= 0;
// All coeffs are present
memset(h->non_zero_count[mb_xy], 16, 32);
- s->current_picture.mb_type[mb_xy] = mb_type;
+ s->current_picture.mb_type[mb_xy]= mb_type;
return 0;
}
- if(MB_MBAFF)
- {
+ if(MB_MBAFF){
h->ref_count[0] <<= 1;
h->ref_count[1] <<= 1;
}
@@ -718,127 +633,98 @@ decode_intra_mb:
fill_decode_caches(h, mb_type);
//mb_pred
- if(IS_INTRA(mb_type))
- {
+ if(IS_INTRA(mb_type)){
int pred_mode;
// init_top_left_availability(h);
- if(IS_INTRA4x4(mb_type))
- {
+ if(IS_INTRA4x4(mb_type)){
int i;
int di = 1;
- if(dct8x8_allowed && get_bits1(&s->gb))
- {
+ if(dct8x8_allowed && get_bits1(&s->gb)){
mb_type |= MB_TYPE_8x8DCT;
di = 4;
}
// fill_intra4x4_pred_table(h);
- for(i = 0; i < 16; i += di)
- {
- int mode = pred_intra_mode(h, i);
+ for(i=0; i<16; i+=di){
+ int mode= pred_intra_mode(h, i);
- if(!get_bits1(&s->gb))
- {
- const int rem_mode = get_bits(&s->gb, 3);
+ if(!get_bits1(&s->gb)){
+ const int rem_mode= get_bits(&s->gb, 3);
mode = rem_mode + (rem_mode >= mode);
}
- if(di == 4)
- fill_rectangle(&h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1);
+ if(di==4)
+ fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
else
h->intra4x4_pred_mode_cache[ scan8[i] ] = mode;
}
ff_h264_write_back_intra_pred_mode(h);
- if(ff_h264_check_intra4x4_pred_mode(h) < 0)
+ if( ff_h264_check_intra4x4_pred_mode(h) < 0)
return -1;
- }
- else
- {
- h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode);
+ }else{
+ h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode);
if(h->intra16x16_pred_mode < 0)
return -1;
}
- if(CHROMA)
- {
- pred_mode = ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb));
+ if(CHROMA){
+ pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb));
if(pred_mode < 0)
return -1;
- h->chroma_pred_mode = pred_mode;
+ h->chroma_pred_mode= pred_mode;
}
- }
- else if(partition_count == 4)
- {
+ }else if(partition_count==4){
int i, j, sub_partition_count[4], list, ref[2][4];
- if(h->slice_type_nos == FF_B_TYPE)
- {
- for(i = 0; i < 4; i++)
- {
- h->sub_mb_type[i] = get_ue_golomb_31(&s->gb);
- if(h->sub_mb_type[i] >= 13)
- {
+ if(h->slice_type_nos == FF_B_TYPE){
+ for(i=0; i<4; i++){
+ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
+ if(h->sub_mb_type[i] >=13){
av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
return -1;
}
- sub_partition_count[i] = b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
- h->sub_mb_type[i] = b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
+ sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
+ h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
}
- if(IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]))
- {
+ if( IS_DIRECT(h->sub_mb_type[0]|h->sub_mb_type[1]|h->sub_mb_type[2]|h->sub_mb_type[3])) {
ff_h264_pred_direct_motion(h, &mb_type);
h->ref_cache[0][scan8[4]] =
- h->ref_cache[1][scan8[4]] =
- h->ref_cache[0][scan8[12]] =
- h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
+ h->ref_cache[1][scan8[4]] =
+ h->ref_cache[0][scan8[12]] =
+ h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
}
- }
- else
- {
+ }else{
assert(h->slice_type_nos == FF_P_TYPE); //FIXME SP correct ?
- for(i = 0; i < 4; i++)
- {
- h->sub_mb_type[i] = get_ue_golomb_31(&s->gb);
- if(h->sub_mb_type[i] >= 4)
- {
+ for(i=0; i<4; i++){
+ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
+ if(h->sub_mb_type[i] >=4){
av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
return -1;
}
- sub_partition_count[i] = p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
- h->sub_mb_type[i] = p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
+ sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
+ h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
}
}
- for(list = 0; list < h->list_count; list++)
- {
- int ref_count = IS_REF0(mb_type) ? 1 : h->ref_count[list];
- for(i = 0; i < 4; i++)
- {
+ for(list=0; list<h->list_count; list++){
+ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list];
+ 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(IS_DIR(h->sub_mb_type[i], 0, list)){
unsigned int tmp;
- if(ref_count == 1)
- {
- tmp = 0;
- }
- else if(ref_count == 2)
- {
- tmp = get_bits1(&s->gb) ^ 1;
- }
- else
- {
- tmp = get_ue_golomb_31(&s->gb);
- if(tmp >= ref_count)
- {
+ if(ref_count == 1){
+ tmp= 0;
+ }else if(ref_count == 2){
+ tmp= get_bits1(&s->gb)^1;
+ }else{
+ tmp= get_ue_golomb_31(&s->gb);
+ if(tmp>=ref_count){
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp);
return -1;
}
}
- ref[list][i] = tmp;
- }
- else
- {
- //FIXME
+ ref[list][i]= tmp;
+ }else{
+ //FIXME
ref[list][i] = -1;
}
}
@@ -847,219 +733,159 @@ decode_intra_mb:
if(dct8x8_allowed)
dct8x8_allowed = get_dct8x8_allowed(h);
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 4; i++)
- {
- if(IS_DIRECT(h->sub_mb_type[i]))
- {
- h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i] + 1 ];
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<4; i++){
+ if(IS_DIRECT(h->sub_mb_type[i])) {
+ h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ];
continue;
}
- h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i] + 1 ] =
- h->ref_cache[list][ scan8[4*i] + 8 ] = h->ref_cache[list][ scan8[4*i] + 9 ] = ref[list][i];
-
- if(IS_DIR(h->sub_mb_type[i], 0, list))
- {
- const int sub_mb_type = h->sub_mb_type[i];
- const int block_width = (sub_mb_type & (MB_TYPE_16x16 | MB_TYPE_16x8)) ? 2 : 1;
- for(j = 0; j < sub_partition_count[i]; j++)
- {
+ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]=
+ h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
+
+ if(IS_DIR(h->sub_mb_type[i], 0, list)){
+ const int sub_mb_type= h->sub_mb_type[i];
+ const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
+ for(j=0; j<sub_partition_count[i]; j++){
int mx, my;
- const int index = 4 * i + block_width * j;
- int16_t (* mv_cache)[2] = &h->mv_cache[list][ scan8[index] ];
+ const int index= 4*i + block_width*j;
+ int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- if(IS_SUB_8X8(sub_mb_type))
- {
- mv_cache[ 1 ][0] =
- mv_cache[ 8 ][0] = mv_cache[ 9 ][0] = mx;
- mv_cache[ 1 ][1] =
- mv_cache[ 8 ][1] = mv_cache[ 9 ][1] = my;
- }
- else if(IS_SUB_8X4(sub_mb_type))
- {
- mv_cache[ 1 ][0] = mx;
- mv_cache[ 1 ][1] = my;
+ if(IS_SUB_8X8(sub_mb_type)){
+ mv_cache[ 1 ][0]=
+ mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
+ mv_cache[ 1 ][1]=
+ mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
+ }else if(IS_SUB_8X4(sub_mb_type)){
+ mv_cache[ 1 ][0]= mx;
+ mv_cache[ 1 ][1]= my;
+ }else if(IS_SUB_4X8(sub_mb_type)){
+ mv_cache[ 8 ][0]= mx;
+ mv_cache[ 8 ][1]= my;
}
- else if(IS_SUB_4X8(sub_mb_type))
- {
- mv_cache[ 8 ][0] = mx;
- mv_cache[ 8 ][1] = my;
- }
- mv_cache[ 0 ][0] = mx;
- mv_cache[ 0 ][1] = my;
+ mv_cache[ 0 ][0]= mx;
+ mv_cache[ 0 ][1]= my;
}
- }
- else
- {
- uint32_t *p = (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
- p[0] = p[1] =
- p[8] = p[9] = 0;
+ }else{
+ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
+ p[0] = p[1]=
+ p[8] = p[9]= 0;
}
}
}
- }
- else if(IS_DIRECT(mb_type))
- {
+ }else if(IS_DIRECT(mb_type)){
ff_h264_pred_direct_motion(h, &mb_type);
dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
- }
- else
- {
+ }else{
int list, mx, my, i;
- //FIXME we should set ref_idx_l? to 0 if we use that later ...
- if(IS_16X16(mb_type))
- {
- for(list = 0; list < h->list_count; list++)
- {
- unsigned int val;
- if(IS_DIR(mb_type, 0, list))
- {
- if(h->ref_count[list] == 1)
- {
- val = 0;
- }
- else if(h->ref_count[list] == 2)
- {
- val = get_bits1(&s->gb) ^ 1;
- }
- else
- {
- val = get_ue_golomb_31(&s->gb);
- if(val >= h->ref_count[list])
- {
- av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
- return -1;
+ //FIXME we should set ref_idx_l? to 0 if we use that later ...
+ if(IS_16X16(mb_type)){
+ for(list=0; list<h->list_count; list++){
+ unsigned int val;
+ if(IS_DIR(mb_type, 0, list)){
+ if(h->ref_count[list]==1){
+ val= 0;
+ }else if(h->ref_count[list]==2){
+ val= get_bits1(&s->gb)^1;
+ }else{
+ val= get_ue_golomb_31(&s->gb);
+ if(val >= h->ref_count[list]){
+ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
+ return -1;
+ }
}
- }
- }
- else
- val = LIST_NOT_USED & 0xFF;
- fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1);
+ }else
+ val= LIST_NOT_USED&0xFF;
+ fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1);
}
- for(list = 0; list < h->list_count; list++)
- {
+ for(list=0; list<h->list_count; list++){
unsigned int val;
- if(IS_DIR(mb_type, 0, list))
- {
+ if(IS_DIR(mb_type, 0, list)){
pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- val = pack16to32(mx, my);
- }
- else
- val = 0;
+ val= pack16to32(mx,my);
+ }else
+ val=0;
fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4);
}
}
- else if(IS_16X8(mb_type))
- {
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 2; i++)
- {
- unsigned int val;
- if(IS_DIR(mb_type, i, list))
- {
- if(h->ref_count[list] == 1)
- {
- val = 0;
- }
- else if(h->ref_count[list] == 2)
- {
- val = get_bits1(&s->gb) ^ 1;
- }
- else
- {
- val = get_ue_golomb_31(&s->gb);
- if(val >= h->ref_count[list])
- {
- av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
- return -1;
+ else if(IS_16X8(mb_type)){
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<2; i++){
+ unsigned int val;
+ if(IS_DIR(mb_type, i, list)){
+ if(h->ref_count[list] == 1){
+ val= 0;
+ }else if(h->ref_count[list] == 2){
+ val= get_bits1(&s->gb)^1;
+ }else{
+ val= get_ue_golomb_31(&s->gb);
+ if(val >= h->ref_count[list]){
+ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
+ return -1;
+ }
}
- }
+ }else
+ val= LIST_NOT_USED&0xFF;
+ fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1);
}
- else
- val = LIST_NOT_USED & 0xFF;
- fill_rectangle(&h->ref_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, val, 1);
- }
}
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 2; i++)
- {
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<2; i++){
unsigned int val;
- if(IS_DIR(mb_type, i, list))
- {
- pred_16x8_motion(h, 8 * i, list, h->ref_cache[list][scan8[0] + 16 * i], &mx, &my);
+ if(IS_DIR(mb_type, i, list)){
+ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- val = pack16to32(mx, my);
- }
- else
- val = 0;
- fill_rectangle(h->mv_cache[list][ scan8[0] + 16 * i ], 4, 2, 8, val, 4);
+ val= pack16to32(mx,my);
+ }else
+ val=0;
+ fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4);
}
}
- }
- else
- {
+ }else{
assert(IS_8X16(mb_type));
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 2; i++)
- {
- unsigned int val;
- if(IS_DIR(mb_type, i, list)) //FIXME optimize
- {
- if(h->ref_count[list] == 1)
- {
- val = 0;
- }
- else if(h->ref_count[list] == 2)
- {
- val = get_bits1(&s->gb) ^ 1;
- }
- else
- {
- val = get_ue_golomb_31(&s->gb);
- if(val >= h->ref_count[list])
- {
- av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
- return -1;
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<2; i++){
+ unsigned int val;
+ if(IS_DIR(mb_type, i, list)){ //FIXME optimize
+ if(h->ref_count[list]==1){
+ val= 0;
+ }else if(h->ref_count[list]==2){
+ val= get_bits1(&s->gb)^1;
+ }else{
+ val= get_ue_golomb_31(&s->gb);
+ if(val >= h->ref_count[list]){
+ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
+ return -1;
+ }
}
- }
+ }else
+ val= LIST_NOT_USED&0xFF;
+ fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1);
}
- else
- val = LIST_NOT_USED & 0xFF;
- fill_rectangle(&h->ref_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, val, 1);
- }
}
- for(list = 0; list < h->list_count; list++)
- {
- for(i = 0; i < 2; i++)
- {
+ for(list=0; list<h->list_count; list++){
+ for(i=0; i<2; i++){
unsigned int val;
- if(IS_DIR(mb_type, i, list))
- {
- pred_8x16_motion(h, i * 4, list, h->ref_cache[list][ scan8[0] + 2 * i ], &mx, &my);
+ if(IS_DIR(mb_type, i, list)){
+ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
- val = pack16to32(mx, my);
- }
- else
- val = 0;
- fill_rectangle(h->mv_cache[list][ scan8[0] + 2 * i ], 2, 4, 8, val, 4);
+ val= pack16to32(mx,my);
+ }else
+ val=0;
+ fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4);
}
}
}
@@ -1068,183 +894,140 @@ decode_intra_mb:
if(IS_INTER(mb_type))
write_back_motion(h, mb_type);
- if(!IS_INTRA16x16(mb_type))
- {
- cbp = get_ue_golomb(&s->gb);
- if(cbp > 47)
- {
+ if(!IS_INTRA16x16(mb_type)){
+ cbp= get_ue_golomb(&s->gb);
+ if(cbp > 47){
av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
- if(CHROMA)
- {
- if(IS_INTRA4x4(mb_type)) cbp = golomb_to_intra4x4_cbp[cbp];
- else cbp = golomb_to_inter_cbp [cbp];
- }
- else
- {
- if(IS_INTRA4x4(mb_type)) cbp = golomb_to_intra4x4_cbp_gray[cbp];
- else cbp = golomb_to_inter_cbp_gray[cbp];
+ if(CHROMA){
+ if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp];
+ else cbp= golomb_to_inter_cbp [cbp];
+ }else{
+ if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp];
+ else cbp= golomb_to_inter_cbp_gray[cbp];
}
}
- if(dct8x8_allowed && (cbp & 15) && !IS_INTRA(mb_type))
- {
- mb_type |= MB_TYPE_8x8DCT * get_bits1(&s->gb);
+ if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){
+ mb_type |= MB_TYPE_8x8DCT*get_bits1(&s->gb);
}
- h->cbp =
- h->cbp_table[mb_xy] = cbp;
- s->current_picture.mb_type[mb_xy] = mb_type;
+ h->cbp=
+ h->cbp_table[mb_xy]= cbp;
+ s->current_picture.mb_type[mb_xy]= mb_type;
- if(cbp || IS_INTRA16x16(mb_type))
- {
+ if(cbp || IS_INTRA16x16(mb_type)){
int i8x8, i4x4, chroma_idx;
int dquant;
- GetBitContext *gb = IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
+ GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
const uint8_t *scan, *scan8x8, *dc_scan;
- if(IS_INTERLACED(mb_type))
- {
- scan8x8 = s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
- scan = s->qscale ? h->field_scan : h->field_scan_q0;
- dc_scan = luma_dc_field_scan;
- }
- else
- {
- scan8x8 = s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
- scan = s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
- dc_scan = luma_dc_zigzag_scan;
+ if(IS_INTERLACED(mb_type)){
+ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
+ scan= s->qscale ? h->field_scan : h->field_scan_q0;
+ dc_scan= luma_dc_field_scan;
+ }else{
+ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
+ scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
+ dc_scan= luma_dc_zigzag_scan;
}
- dquant = get_se_golomb(&s->gb);
+ dquant= get_se_golomb(&s->gb);
s->qscale += dquant;
- if(((unsigned)s->qscale) > 51)
- {
- if(s->qscale < 0) s->qscale += 52;
- else s->qscale -= 52;
- if(((unsigned)s->qscale) > 51)
- {
+ if(((unsigned)s->qscale) > 51){
+ if(s->qscale<0) s->qscale+= 52;
+ else s->qscale-= 52;
+ if(((unsigned)s->qscale) > 51){
av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
return -1;
}
}
- h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
- h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
- if(IS_INTRA16x16(mb_type))
- {
- if(decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0)
- {
+ h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale);
+ h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale);
+ if(IS_INTRA16x16(mb_type)){
+ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){
return -1; //FIXME continue if partitioned and other return -1 too
}
- assert((cbp & 15) == 0 || (cbp & 15) == 15);
-
- if(cbp & 15)
- {
- for(i8x8 = 0; i8x8 < 4; i8x8++)
- {
- for(i4x4 = 0; i4x4 < 4; i4x4++)
- {
- const int index = i4x4 + 4 * i8x8;
- if(decode_residual(h, h->intra_gb_ptr, h->mb + 16 * index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0)
- {
+ assert((cbp&15) == 0 || (cbp&15) == 15);
+
+ if(cbp&15){
+ for(i8x8=0; i8x8<4; i8x8++){
+ for(i4x4=0; i4x4<4; i4x4++){
+ const int index= i4x4 + 4*i8x8;
+ if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){
return -1;
}
}
}
- }
- else
- {
+ }else{
fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
}
- }
- else
- {
- for(i8x8 = 0; i8x8 < 4; i8x8++)
- {
- if(cbp & (1 << i8x8))
- {
- if(IS_8x8DCT(mb_type))
- {
+ }else{
+ for(i8x8=0; i8x8<4; i8x8++){
+ if(cbp & (1<<i8x8)){
+ if(IS_8x8DCT(mb_type)){
DCTELEM *buf = &h->mb[64*i8x8];
uint8_t *nnz;
- for(i4x4 = 0; i4x4 < 4; i4x4++)
- {
- if(decode_residual(h, gb, buf, i4x4 + 4 * i8x8, scan8x8 + 16 * i4x4,
- h->dequant8_coeff[IS_INTRA(mb_type) ? 0:1][s->qscale], 16) < 0)
+ for(i4x4=0; i4x4<4; i4x4++){
+ if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4,
+ h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 )
return -1;
}
- nnz = &h->non_zero_count_cache[ scan8[4*i8x8] ];
+ nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
nnz[0] += nnz[1] + nnz[8] + nnz[9];
- }
- else
- {
- for(i4x4 = 0; i4x4 < 4; i4x4++)
- {
- const int index = i4x4 + 4 * i8x8;
-
- if(decode_residual(h, gb, h->mb + 16 * index, index, scan, h->dequant4_coeff[IS_INTRA(mb_type) ? 0:3][s->qscale], 16) < 0)
- {
+ }else{
+ for(i4x4=0; i4x4<4; i4x4++){
+ const int index= i4x4 + 4*i8x8;
+
+ if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){
return -1;
}
}
}
- }
- else
- {
- uint8_t * const nnz = &h->non_zero_count_cache[ scan8[4*i8x8] ];
+ }else{
+ uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
}
}
}
- if(cbp & 0x30)
- {
- for(chroma_idx = 0; chroma_idx < 2; chroma_idx++)
- if(decode_residual(h, gb, h->mb + 256 + 16 * 4 * chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0)
- {
+ if(cbp&0x30){
+ for(chroma_idx=0; chroma_idx<2; chroma_idx++)
+ if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){
return -1;
}
}
- if(cbp & 0x20)
- {
- for(chroma_idx = 0; chroma_idx < 2; chroma_idx++)
- {
- const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA(mb_type) ? 0:3)][h->chroma_qp[chroma_idx]];
- for(i4x4 = 0; i4x4 < 4; i4x4++)
- {
- const int index = 16 + 4 * chroma_idx + i4x4;
- if(decode_residual(h, gb, h->mb + 16 * index, index, scan + 1, qmul, 15) < 0)
- {
+ if(cbp&0x20){
+ for(chroma_idx=0; chroma_idx<2; chroma_idx++){
+ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
+ for(i4x4=0; i4x4<4; i4x4++){
+ const int index= 16 + 4*chroma_idx + i4x4;
+ if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 15) < 0){
return -1;
}
}
}
+ }else{
+ uint8_t * const nnz= &h->non_zero_count_cache[0];
+ nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
+ nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
}
- else
- {
- uint8_t * const nnz = &h->non_zero_count_cache[0];
- nnz[ scan8[16] + 0 ] = nnz[ scan8[16] + 1 ] = nnz[ scan8[16] + 8 ] = nnz[ scan8[16] + 9 ] =
- nnz[ scan8[20] + 0 ] = nnz[ scan8[20] + 1 ] = nnz[ scan8[20] + 8 ] = nnz[ scan8[20] + 9 ] = 0;
- }
- }
- else
- {
- uint8_t * const nnz = &h->non_zero_count_cache[0];
+ }else{
+ uint8_t * const nnz= &h->non_zero_count_cache[0];
fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);
- nnz[ scan8[16] + 0 ] = nnz[ scan8[16] + 1 ] = nnz[ scan8[16] + 8 ] = nnz[ scan8[16] + 9 ] =
- nnz[ scan8[20] + 0 ] = nnz[ scan8[20] + 1 ] = nnz[ scan8[20] + 8 ] = nnz[ scan8[20] + 9 ] = 0;
+ nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
+ nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
}
- s->current_picture.qscale_table[mb_xy] = s->qscale;
+ s->current_picture.qscale_table[mb_xy]= s->qscale;
write_back_non_zero_count(h);
- if(MB_MBAFF)
- {
+ if(MB_MBAFF){
h->ref_count[0] >>= 1;
h->ref_count[1] >>= 1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_direct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_direct.c
index 43e793daa..43b0d0d8a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_direct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_direct.c
@@ -37,70 +37,58 @@
#include <assert.h>
-static int get_scale_factor(H264Context * const h, int poc, int poc1, int i)
-{
+static int get_scale_factor(H264Context * const h, int poc, int poc1, int i){
int poc0 = h->ref_list[0][i].poc;
int td = av_clip(poc1 - poc0, -128, 127);
- if(td == 0 || h->ref_list[0][i].long_ref)
- {
+ if(td == 0 || h->ref_list[0][i].long_ref){
return 256;
- }
- else
- {
+ }else{
int tb = av_clip(poc - poc0, -128, 127);
int tx = (16384 + (FFABS(td) >> 1)) / td;
- return av_clip((tb * tx + 32) >> 6, -1024, 1023);
+ return av_clip((tb*tx + 32) >> 6, -1024, 1023);
}
}
-void ff_h264_direct_dist_scale_factor(H264Context * const h)
-{
+void ff_h264_direct_dist_scale_factor(H264Context * const h){
MpegEncContext * const s = &h->s;
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++)
- {
+ 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 < 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++)
- {
+ for(i=0; i<h->ref_count[0]; i++){
h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);
}
}
-static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field, int colfield, int mbafi)
-{
+static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field, int colfield, int mbafi){
MpegEncContext * const s = &h->s;
Picture * const ref1 = &h->ref_list[1][0];
int j, old_ref, rfield;
- int start = mbafi ? 16 : 0;
- int end = mbafi ? 16 + 2 * h->ref_count[list] : h->ref_count[list];
- int interl = mbafi || s->picture_structure != PICT_FRAME;
+ int start= mbafi ? 16 : 0;
+ int end = mbafi ? 16+2*h->ref_count[list] : h->ref_count[list];
+ int interl= mbafi || s->picture_structure != PICT_FRAME;
/* bogus; fills in for missing frames */
memset(map[list], 0, sizeof(map[list]));
- for(rfield = 0; rfield < 2; rfield++)
- {
- for(old_ref = 0; old_ref < ref1->ref_count[colfield][list]; old_ref++)
- {
+ for(rfield=0; rfield<2; rfield++){
+ for(old_ref=0; old_ref<ref1->ref_count[colfield][list]; old_ref++){
int poc = ref1->ref_poc[colfield][list][old_ref];
- if(!interl)
+ if (!interl)
poc |= 3;
- else if(interl && (poc & 3) == 3) //FIXME store all MBAFF references so this isnt needed
- poc = (poc&~3) + rfield + 1;
+ else if( interl && (poc&3) == 3) //FIXME store all MBAFF references so this isnt needed
+ poc= (poc&~3) + rfield + 1;
- for(j = start; j < end; j++)
- {
- if(4 * h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference & 3) == poc)
- {
- int cur_ref = mbafi ? (j - 16) ^ field : j;
+ for(j=start; j<end; j++){
+ if(4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3) == poc){
+ int cur_ref= mbafi ? (j-16)^field : j;
map[list][2*old_ref + (rfield^field) + 16] = cur_ref;
if(rfield == field)
map[list][old_ref] = cur_ref;
@@ -111,43 +99,38 @@ static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field,
}
}
-void ff_h264_direct_ref_list_init(H264Context * const h)
-{
+void ff_h264_direct_ref_list_init(H264Context * const h){
MpegEncContext * const s = &h->s;
Picture * const ref1 = &h->ref_list[1][0];
Picture * const cur = s->current_picture_ptr;
int list, j, field;
- int sidx = (s->picture_structure & 1) ^ 1;
- int ref1sidx = (ref1->reference & 1) ^ 1;
+ int sidx= (s->picture_structure&1)^1;
+ int ref1sidx= (ref1->reference&1)^1;
- for(list = 0; list < 2; list++)
- {
+ for(list=0; list<2; list++){
cur->ref_count[sidx][list] = h->ref_count[list];
- for(j = 0; j < h->ref_count[list]; j++)
- cur->ref_poc[sidx][list][j] = 4 * h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference & 3);
+ for(j=0; j<h->ref_count[list]; j++)
+ cur->ref_poc[sidx][list][j] = 4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3);
}
- if(s->picture_structure == PICT_FRAME)
- {
+ if(s->picture_structure == PICT_FRAME){
memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
memcpy(cur->ref_poc [1], cur->ref_poc [0], sizeof(cur->ref_poc [0]));
}
- cur->mbaff = FRAME_MBAFF;
+ cur->mbaff= FRAME_MBAFF;
if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred)
return;
- for(list = 0; list < 2; list++)
- {
+ for(list=0; list<2; list++){
fill_colmap(h, h->map_col_to_list0, list, sidx, ref1sidx, 0);
- for(field = 0; field < 2; field++)
+ for(field=0; field<2; field++)
fill_colmap(h, h->map_col_to_list0_field[field], list, field, field, 1);
}
}
-void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type)
-{
+void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type){
MpegEncContext * const s = &h->s;
int b8_stride = h->b8_stride;
int b4_stride = h->b_stride;
@@ -159,71 +142,54 @@ void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type)
unsigned int sub_mb_type;
int i8, i4;
- assert(h->ref_list[1][0].reference & 3);
+ assert(h->ref_list[1][0].reference&3);
#define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM)
- if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])) // AFL/AFR/FR/FL -> AFL/FL
- {
- if(!IS_INTERLACED(*mb_type)) // AFR/FR -> AFL/FL
- {
+ if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL
+ if(!IS_INTERLACED(*mb_type)){ // AFR/FR -> AFL/FL
int cur_poc = s->current_picture_ptr->poc;
int *col_poc = h->ref_list[1]->field_poc;
int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc);
- mb_xy = s->mb_x + ((s->mb_y&~1) + col_parity) * s->mb_stride;
+ mb_xy= s->mb_x + ((s->mb_y&~1) + col_parity)*s->mb_stride;
b8_stride = 0;
- }
- else if(!(s->picture_structure & h->ref_list[1][0].reference) && !h->ref_list[1][0].mbaff) // FL -> FL & differ parity
- {
- int fieldoff = 2 * (h->ref_list[1][0].reference) - 3;
- mb_xy += s->mb_stride * fieldoff;
+ }else if(!(s->picture_structure & h->ref_list[1][0].reference) && !h->ref_list[1][0].mbaff){// FL -> FL & differ parity
+ int fieldoff= 2*(h->ref_list[1][0].reference)-3;
+ mb_xy += s->mb_stride*fieldoff;
}
goto single_col;
- }
- else // AFL/AFR/FR/FL -> AFR/FR
- {
- if(IS_INTERLACED(*mb_type)) // AFL /FL -> AFR/FR
- {
- mb_xy = s->mb_x + (s->mb_y&~1) * s->mb_stride;
+ }else{ // AFL/AFR/FR/FL -> AFR/FR
+ if(IS_INTERLACED(*mb_type)){ // AFL /FL -> AFR/FR
+ mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride;
mb_type_col[0] = h->ref_list[1][0].mb_type[mb_xy];
mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride];
b8_stride *= 3;
b4_stride *= 6;
//FIXME IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag
- if((mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)
- && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA)
- && !is_b8x8)
- {
- sub_mb_type = MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2; /* B_SUB_8x8 */
- *mb_type |= MB_TYPE_16x8 | MB_TYPE_L0L1 | MB_TYPE_DIRECT2; /* B_16x8 */
- }
- else
- {
- sub_mb_type = MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2; /* B_SUB_8x8 */
- *mb_type |= MB_TYPE_8x8 | MB_TYPE_L0L1;
+ if( (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)
+ && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA)
+ && !is_b8x8){
+ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
+ *mb_type |= MB_TYPE_16x8 |MB_TYPE_L0L1|MB_TYPE_DIRECT2; /* B_16x8 */
+ }else{
+ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
+ *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
}
- }
- else // AFR/FR -> AFR/FR
- {
+ }else{ // AFR/FR -> AFR/FR
single_col:
mb_type_col[0] =
- mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
- if(IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag)
- {
+ mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
+ if(IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag){
/* FIXME save sub mb types from previous frames (or derive from MVs)
* so we know exactly what block size to use */
- sub_mb_type = MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2; /* B_SUB_4x4 */
- *mb_type |= MB_TYPE_8x8 | MB_TYPE_L0L1;
- }
- else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA))
- {
- sub_mb_type = MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2; /* B_SUB_8x8 */
- *mb_type |= MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2; /* B_16x16 */
- }
- else
- {
- sub_mb_type = MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_DIRECT2; /* B_SUB_8x8 */
- *mb_type |= MB_TYPE_8x8 | MB_TYPE_L0L1;
+ sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */
+ *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
+ }else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
+ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
+ *mb_type |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */
+ }else{
+ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
+ *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
}
}
}
@@ -232,19 +198,16 @@ single_col:
l1mv1 = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
l1ref0 = &h->ref_list[1][0].ref_index [0][h->mb2b8_xy[mb_xy]];
l1ref1 = &h->ref_list[1][0].ref_index [1][h->mb2b8_xy[mb_xy]];
- if(!b8_stride)
- {
- if(s->mb_y & 1)
- {
+ if(!b8_stride){
+ if(s->mb_y&1){
l1ref0 += h->b8_stride;
l1ref1 += h->b8_stride;
- l1mv0 += 2 * b4_stride;
- l1mv1 += 2 * b4_stride;
+ l1mv0 += 2*b4_stride;
+ l1mv1 += 2*b4_stride;
}
}
- if(h->direct_spatial_mv_pred)
- {
+ if(h->direct_spatial_mv_pred){
int ref[2];
int mv[2][2];
int list;
@@ -252,8 +215,7 @@ single_col:
/* FIXME interlacing + spatial direct uses wrong colocated block positions */
/* ref = min(neighbors) */
- for(list = 0; list < 2; list++)
- {
+ for(list=0; list<2; list++){
int refa = h->ref_cache[list][scan8[0] - 1];
int refb = h->ref_cache[list][scan8[0] - 8];
int refc = h->ref_cache[list][scan8[0] - 8 + 4];
@@ -264,16 +226,12 @@ single_col:
ref[list] = -1;
}
- if(ref[0] < 0 && ref[1] < 0)
- {
+ if(ref[0] < 0 && ref[1] < 0){
ref[0] = ref[1] = 0;
mv[0][0] = mv[0][1] =
- mv[1][0] = mv[1][1] = 0;
- }
- else
- {
- for(list = 0; list < 2; list++)
- {
+ mv[1][0] = mv[1][1] = 0;
+ }else{
+ for(list=0; list<2; list++){
if(ref[list] >= 0)
pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]);
else
@@ -281,28 +239,23 @@ single_col:
}
}
- if(ref[1] < 0)
- {
+ if(ref[1] < 0){
if(!is_b8x8)
*mb_type &= ~MB_TYPE_L1;
sub_mb_type &= ~MB_TYPE_L1;
- }
- else if(ref[0] < 0)
- {
+ }else if(ref[0] < 0){
if(!is_b8x8)
*mb_type &= ~MB_TYPE_L0;
sub_mb_type &= ~MB_TYPE_L0;
}
- if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0]))
- {
- for(i8 = 0; i8 < 4; i8++)
- {
- int x8 = i8 & 1;
- int y8 = i8 >> 1;
- int xy8 = x8 + y8 * b8_stride;
- int xy4 = 3 * x8 + y8 * b4_stride;
- int a = 0, b = 0;
+ if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){
+ for(i8=0; i8<4; i8++){
+ int x8 = i8&1;
+ int y8 = i8>>1;
+ int xy8 = x8+y8*b8_stride;
+ int xy4 = 3*x8+y8*b4_stride;
+ int a=0, b=0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
@@ -311,130 +264,107 @@ single_col:
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_type_col[y8])
- && ((l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1)
- || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1)))
- {
+ && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1)
+ || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){
if(ref[0] > 0)
- a = pack16to32(mv[0][0], mv[0][1]);
+ a= pack16to32(mv[0][0],mv[0][1]);
if(ref[1] > 0)
- b = pack16to32(mv[1][0], mv[1][1]);
- }
- else
- {
- a = pack16to32(mv[0][0], mv[0][1]);
- b = pack16to32(mv[1][0], mv[1][1]);
+ b= pack16to32(mv[1][0],mv[1][1]);
+ }else{
+ a= pack16to32(mv[0][0],mv[0][1]);
+ b= pack16to32(mv[1][0],mv[1][1]);
}
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4);
}
- }
- else if(IS_16X16(*mb_type))
- {
- int a = 0, b = 0;
+ }else if(IS_16X16(*mb_type)){
+ int a=0, b=0;
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_type_col[0])
- && ((l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)
+ && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)
|| (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1
- && (h->x264_build > 33 || !h->x264_build))))
- {
+ && (h->x264_build>33 || !h->x264_build)))){
if(ref[0] > 0)
- a = pack16to32(mv[0][0], mv[0][1]);
+ a= pack16to32(mv[0][0],mv[0][1]);
if(ref[1] > 0)
- b = pack16to32(mv[1][0], mv[1][1]);
- }
- else
- {
- a = pack16to32(mv[0][0], mv[0][1]);
- b = pack16to32(mv[1][0], mv[1][1]);
+ b= pack16to32(mv[1][0],mv[1][1]);
+ }else{
+ a= pack16to32(mv[0][0],mv[0][1]);
+ b= pack16to32(mv[1][0],mv[1][1]);
}
fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);
fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);
- }
- else
- {
- for(i8 = 0; i8 < 4; i8++)
- {
- const int x8 = i8 & 1;
- const int y8 = i8 >> 1;
+ }else{
+ for(i8=0; i8<4; i8++){
+ const int x8 = i8&1;
+ const int y8 = i8>>1;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
- fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0], mv[0][1]), 4);
- fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0], mv[1][1]), 4);
+ fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4);
+ fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4);
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
/* col_zero_flag */
- if(!IS_INTRA(mb_type_col[0]) && (l1ref0[x8 + y8*b8_stride] == 0
- || (l1ref0[x8 + y8*b8_stride] < 0 && l1ref1[x8 + y8*b8_stride] == 0
- && (h->x264_build > 33 || !h->x264_build))))
- {
- const int16_t (*l1mv)[2] = l1ref0[x8 + y8*b8_stride] == 0 ? l1mv0 : l1mv1;
- if(IS_SUB_8X8(sub_mb_type))
- {
+ if(!IS_INTRA(mb_type_col[0]) && ( l1ref0[x8 + y8*b8_stride] == 0
+ || (l1ref0[x8 + y8*b8_stride] < 0 && l1ref1[x8 + y8*b8_stride] == 0
+ && (h->x264_build>33 || !h->x264_build)))){
+ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*b8_stride] == 0 ? l1mv0 : l1mv1;
+ if(IS_SUB_8X8(sub_mb_type)){
const int16_t *mv_col = l1mv[x8*3 + y8*3*b4_stride];
- if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1)
- {
+ if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
if(ref[0] == 0)
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
if(ref[1] == 0)
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
}
- }
- else
- for(i4 = 0; i4 < 4; i4++)
- {
- const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride];
- if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1)
- {
- if(ref[0] == 0)
- *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0;
- if(ref[1] == 0)
- *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0;
- }
+ }else
+ for(i4=0; i4<4; i4++){
+ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride];
+ if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
+ if(ref[0] == 0)
+ *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0;
+ if(ref[1] == 0)
+ *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0;
}
+ }
}
}
}
- }
- else /* direct temporal mv pred */
- {
+ }else{ /* direct temporal mv pred */
const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]};
const int *dist_scale_factor = h->dist_scale_factor;
- int ref_offset = 0;
+ int ref_offset= 0;
- if(FRAME_MBAFF && IS_INTERLACED(*mb_type))
- {
+ if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){
map_col_to_list0[0] = h->map_col_to_list0_field[s->mb_y&1][0];
map_col_to_list0[1] = h->map_col_to_list0_field[s->mb_y&1][1];
- dist_scale_factor = h->dist_scale_factor_field[s->mb_y&1];
+ dist_scale_factor =h->dist_scale_factor_field[s->mb_y&1];
}
if(h->ref_list[1][0].mbaff && IS_INTERLACED(mb_type_col[0]))
ref_offset += 16;
- if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0]))
- {
+ if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){
/* FIXME assumes direct_8x8_inference == 1 */
- int y_shift = 2 * !IS_INTERLACED(*mb_type);
+ int y_shift = 2*!IS_INTERLACED(*mb_type);
- for(i8 = 0; i8 < 4; i8++)
- {
- const int x8 = i8 & 1;
- const int y8 = i8 >> 1;
+ for(i8=0; i8<4; i8++){
+ const int x8 = i8&1;
+ const int y8 = i8>>1;
int ref0, scale;
- const int16_t (*l1mv)[2] = l1mv0;
+ const int16_t (*l1mv)[2]= l1mv0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
- if(IS_INTRA(mb_type_col[y8]))
- {
+ if(IS_INTRA(mb_type_col[y8])){
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
@@ -444,21 +374,20 @@ single_col:
ref0 = l1ref0[x8 + y8*b8_stride];
if(ref0 >= 0)
ref0 = map_col_to_list0[0][ref0 + ref_offset];
- else
- {
+ else{
ref0 = map_col_to_list0[1][l1ref1[x8 + y8*b8_stride] + ref_offset];
- l1mv = l1mv1;
+ l1mv= l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
{
const int16_t *mv_col = l1mv[x8*3 + y8*b4_stride];
- int my_col = (mv_col[1] << y_shift) / 2;
+ int my_col = (mv_col[1]<<y_shift)/2;
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * my_col + 128) >> 8;
- fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx, my), 4);
- fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx - mv_col[0], my - my_col), 4);
+ fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
+ fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4);
}
}
return;
@@ -466,47 +395,39 @@ single_col:
/* one-to-one mv scaling */
- if(IS_16X16(*mb_type))
- {
+ if(IS_16X16(*mb_type)){
int ref, mv0, mv1;
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1);
- if(IS_INTRA(mb_type_col[0]))
- {
- ref = mv0 = mv1 = 0;
- }
- else
- {
+ if(IS_INTRA(mb_type_col[0])){
+ ref=mv0=mv1=0;
+ }else{
const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0] + ref_offset]
- : map_col_to_list0[1][l1ref1[0] + ref_offset];
+ : map_col_to_list0[1][l1ref1[0] + ref_offset];
const int scale = dist_scale_factor[ref0];
const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0];
int mv_l0[2];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
- ref = ref0;
- mv0 = pack16to32(mv_l0[0], mv_l0[1]);
- mv1 = pack16to32(mv_l0[0] - mv_col[0], mv_l0[1] - mv_col[1]);
+ ref= ref0;
+ mv0= pack16to32(mv_l0[0],mv_l0[1]);
+ mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
}
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4);
- }
- else
- {
- for(i8 = 0; i8 < 4; i8++)
- {
- const int x8 = i8 & 1;
- const int y8 = i8 >> 1;
+ }else{
+ for(i8=0; i8<4; i8++){
+ const int x8 = i8&1;
+ const int y8 = i8>>1;
int ref0, scale;
- const int16_t (*l1mv)[2] = l1mv0;
+ const int16_t (*l1mv)[2]= l1mv0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
- if(IS_INTRA(mb_type_col[0]))
- {
+ if(IS_INTRA(mb_type_col[0])){
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
@@ -516,32 +437,28 @@ single_col:
ref0 = l1ref0[x8 + y8*b8_stride] + ref_offset;
if(ref0 >= 0)
ref0 = map_col_to_list0[0][ref0];
- else
- {
+ else{
ref0 = map_col_to_list0[1][l1ref1[x8 + y8*b8_stride] + ref_offset];
- l1mv = l1mv1;
+ l1mv= l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
- if(IS_SUB_8X8(sub_mb_type))
- {
+ if(IS_SUB_8X8(sub_mb_type)){
const int16_t *mv_col = l1mv[x8*3 + y8*3*b4_stride];
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * mv_col[1] + 128) >> 8;
- fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx, my), 4);
- fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx - mv_col[0], my - mv_col[1]), 4);
+ fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
+ fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4);
+ }else
+ for(i4=0; i4<4; i4++){
+ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride];
+ int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]];
+ mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
+ mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
+ *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] =
+ pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
}
- else
- for(i4 = 0; i4 < 4; i4++)
- {
- const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride];
- int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]];
- mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
- mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
- *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] =
- pack16to32(mv_l0[0] - mv_col[0], mv_l0[1] - mv_col[1]);
- }
}
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_dxva.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_dxva.c
index 4921d5442..1e882039c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_dxva.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_dxva.c
@@ -25,94 +25,86 @@
#include <dxva.h>
-static void fill_dxva_slice_long(H264Context *h)
-{
+static void fill_dxva_slice_long(H264Context *h){
MpegEncContext* const s = &h->s;
- AVCodecContext* const avctx = s->avctx;
- DXVA_Slice_H264_Long* pSlice = &((DXVA_Slice_H264_Long*) h->dxva_slice_long)[h->current_slice-1];
- int field_pic_flag;
- unsigned int i, j, k;
-
- field_pic_flag = (h->s.picture_structure != PICT_FRAME);
-
- pSlice->slice_id = h->current_slice - 1;
- pSlice->first_mb_in_slice = h->first_mb_in_slice;
- pSlice->NumMbsForSlice = 0; // h->s.mb_num; // TODO : to be checked !
- pSlice->BitOffsetToSliceData = h->bit_offset_to_slice_data;
- pSlice->slice_type = h->raw_slice_type;
- pSlice->luma_log2_weight_denom = h->luma_log2_weight_denom;
- pSlice->chroma_log2_weight_denom = h->chroma_log2_weight_denom;
- pSlice->num_ref_idx_l0_active_minus1 = h->ref_count[0] - 1; // num_ref_idx_l0_active_minus1;
- pSlice->num_ref_idx_l1_active_minus1 = h->ref_count[1] - 1; // num_ref_idx_l1_active_minus1;
- pSlice->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2;
- pSlice->slice_beta_offset_div2 = h->slice_beta_offset / 2;
- pSlice->Reserved8Bits = 0;
-
- // Fill prediction weights
- memset(pSlice->Weights, 0, sizeof(pSlice->Weights));
- for(j = 0; j < 2; j++)
- {
- for(i = 0; i < h->ref_count[j]; i++)
- {
- // L0&L1 Y,Cb,Cr Weight,Offset
- // Weights [2] [32] [3] [2]
- pSlice->Weights[j][i][0][0] = h->luma_weight[j][i];
- pSlice->Weights[j][i][0][1] = h->luma_offset[j][i];
-
- for(k = 0; k < 2; k++)
- {
- pSlice->Weights[j][i][k+1][0] = h->chroma_weight[j][i][k];
- pSlice->Weights[j][i][k+1][1] = h->chroma_offset[j][i][k];
- }
- }
- }
-
- pSlice->slice_qs_delta = h->slice_qs_delta;
- pSlice->slice_qp_delta = h->slice_qp_delta;
- pSlice->redundant_pic_cnt = h->redundant_pic_count;
- pSlice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred;
- pSlice->cabac_init_idc = h->cabac_init_idc;
- pSlice->disable_deblocking_filter_idc = h->deblocking_filter;
-
- for(i = 0; i < 32; i++)
- {
- pSlice->RefPicList[0][i].AssociatedFlag = 1;
- pSlice->RefPicList[0][i].bPicEntry = 255;
- pSlice->RefPicList[0][i].Index7Bits = 127;
- pSlice->RefPicList[1][i].AssociatedFlag = 1;
- pSlice->RefPicList[1][i].bPicEntry = 255;
- pSlice->RefPicList[1][i].Index7Bits = 127;
- }
+ AVCodecContext* const avctx= s->avctx;
+ DXVA_Slice_H264_Long* pSlice = &((DXVA_Slice_H264_Long*) h->dxva_slice_long)[h->current_slice-1];
+ int field_pic_flag;
+ unsigned int i,j,k;
+
+ field_pic_flag = (h->s.picture_structure != PICT_FRAME);
+
+ pSlice->slice_id = h->current_slice-1;
+ pSlice->first_mb_in_slice = h->first_mb_in_slice;
+ pSlice->NumMbsForSlice = 0; // h->s.mb_num; // TODO : to be checked !
+ pSlice->BitOffsetToSliceData = h->bit_offset_to_slice_data;
+ pSlice->slice_type = h->raw_slice_type;
+ pSlice->luma_log2_weight_denom = h->luma_log2_weight_denom;
+ pSlice->chroma_log2_weight_denom = h->chroma_log2_weight_denom;
+ pSlice->num_ref_idx_l0_active_minus1 = h->ref_count[0]-1; // num_ref_idx_l0_active_minus1;
+ pSlice->num_ref_idx_l1_active_minus1 = h->ref_count[1]-1; // num_ref_idx_l1_active_minus1;
+ pSlice->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2;
+ pSlice->slice_beta_offset_div2 = h->slice_beta_offset / 2;
+ pSlice->Reserved8Bits = 0;
+
+ // Fill prediction weights
+ memset (pSlice->Weights, 0, sizeof(pSlice->Weights));
+ for(j=0; j<2; j++){
+ for(i=0; i<h->ref_count[j]; i++){
+ // L0&L1 Y,Cb,Cr Weight,Offset
+ // Weights [2] [32] [3] [2]
+ pSlice->Weights[j][i][0][0] = h->luma_weight[j][i];
+ pSlice->Weights[j][i][0][1] = h->luma_offset[j][i];
+
+ for(k=0; k<2; k++){
+ pSlice->Weights[j][i][k+1][0] = h->chroma_weight[j][i][k];
+ pSlice->Weights[j][i][k+1][1] = h->chroma_offset[j][i][k];
+ }
+ }
+ }
+
+ pSlice->slice_qs_delta = h->slice_qs_delta;
+ pSlice->slice_qp_delta = h->slice_qp_delta;
+ pSlice->redundant_pic_cnt = h->redundant_pic_count;
+ pSlice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred;
+ pSlice->cabac_init_idc = h->cabac_init_idc;
+ pSlice->disable_deblocking_filter_idc = h->deblocking_filter;
+
+ for(i=0; i<32; i++)
+ { pSlice->RefPicList[0][i].AssociatedFlag = 1;
+ pSlice->RefPicList[0][i].bPicEntry = 255;
+ pSlice->RefPicList[0][i].Index7Bits = 127;
+ pSlice->RefPicList[1][i].AssociatedFlag = 1;
+ pSlice->RefPicList[1][i].bPicEntry = 255;
+ pSlice->RefPicList[1][i].Index7Bits = 127;
+ }
}
-static void field_end_noexecute(H264Context *h)
-{
+static void field_end_noexecute(H264Context *h){
MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx = s->avctx;
- s->mb_y = 0;
+ AVCodecContext * const avctx= s->avctx;
+ s->mb_y= 0;
- s->current_picture_ptr->qscale_type = FF_QSCALE_TYPE_H264;
- s->current_picture_ptr->pict_type = s->pict_type;
+ s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264;
+ s->current_picture_ptr->pict_type= s->pict_type;
- if(!s->dropable)
- {
+ if(!s->dropable) {
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->prev_frame_num_offset= h->frame_num_offset;
+ h->prev_frame_num= h->frame_num;
MPV_frame_end(s);
- h->current_slice = 0;
+ h->current_slice=0;
}
-int decode_slice_header_noexecute(H264Context *h)
-{
- // ==> Start patch MPC DXVA
- H264Context *h0 = h;
- // <== End patch MPC DXVA
+int decode_slice_header_noexecute (H264Context *h){
+ // ==> Start patch MPC DXVA
+ H264Context *h0 = h;
+ // <== End patch MPC DXVA
MpegEncContext * const s = &h->s;
MpegEncContext * const s0 = &h0->s;
unsigned int pps_id;
@@ -121,157 +113,135 @@ int decode_slice_header_noexecute(H264Context *h)
int default_ref_list_done = 0;
int last_pic_structure;
- s->dropable = h->nal_ref_idc == 0;
+ s->dropable= h->nal_ref_idc == 0;
- if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !h->nal_ref_idc)
- {
- 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){
+ 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;
}
- // ==> Start patch MPC DXVA
- h->first_mb_in_slice = get_ue_golomb(&s->gb);
- // <== End patch MPC DXVA
+ // ==> Start patch MPC DXVA
+ h->first_mb_in_slice= get_ue_golomb(&s->gb);
+ // <== End patch MPC DXVA
- if(h->first_mb_in_slice == 0) //FIXME better field boundary detection
- {
- if(h0->current_slice && FIELD_PICTURE)
- {
- // ==> Start patch MPC DXVA
+ if(h->first_mb_in_slice == 0){ //FIXME better field boundary detection
+ if(h0->current_slice && FIELD_PICTURE){
+ // ==> Start patch MPC DXVA
field_end_noexecute(h);
- // <== End patch MPC DXVA
+ // <== End patch MPC DXVA
}
h0->current_slice = 0;
- if(!s0->first_field)
- s->current_picture_ptr = NULL;
+ if (!s0->first_field)
+ s->current_picture_ptr= NULL;
}
- slice_type = get_ue_golomb_31(&s->gb);
- if(slice_type > 9)
- {
+ 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;
-
- // ==> Start patch MPC DXVA
- h->raw_slice_type = slice_type;
- // <== End patch MPC DXVA
- slice_type = golomb_to_pict_type[ slice_type ];
- if(slice_type == FF_I_TYPE
- || (h0->current_slice != 0 && slice_type == h0->last_slice_type))
- {
+ h->slice_type_fixed=1;
+ }else
+ h->slice_type_fixed=0;
+
+ // ==> Start patch MPC DXVA
+ h->raw_slice_type = slice_type;
+ // <== End patch MPC DXVA
+ slice_type= golomb_to_pict_type[ slice_type ];
+ if (slice_type == FF_I_TYPE
+ || (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
- if(s->pict_type == FF_B_TYPE && s0->last_picture_ptr == NULL)
- {
+ s->pict_type= h->slice_type; // to make a few old functions happy, it's wrong though
+ if (s->pict_type == FF_B_TYPE && s0->last_picture_ptr == NULL) {
av_log(h->s.avctx, AV_LOG_ERROR,
"B picture before any references, skipping\n");
return -1;
}
- 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])
- {
+ 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])
- {
+ 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 == 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);
}
- s->mb_width = h->sps.mb_width;
- s->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
+ 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;
- h->b8_stride = s->mb_width * 2;
+ h->b_stride= s->mb_width*4;
+ h->b8_stride= s->mb_width*2;
- s->width = 16 * s->mb_width - 2 * FFMIN(h->sps.crop_right, 7);
+ s->width = 16*s->mb_width - 2*FFMIN(h->sps.crop_right, 7);
if(h->sps.frame_mbs_only_flag)
- s->height = 16 * s->mb_height - 2 * FFMIN(h->sps.crop_bottom, 7);
+ s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7);
else
- s->height = 16 * s->mb_height - 4 * FFMIN(h->sps.crop_bottom, 3);
+ s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
- if(s->context_initialized
- && (s->width != s->avctx->width || s->height != s->avctx->height))
- {
+ if (s->context_initialized
+ && ( s->width != s->avctx->width || s->height != s->avctx->height)) {
if(h != h0)
return -1; // width / height changed during parallelized decoding
free_tables(h);
flush_dpb(s->avctx);
MPV_common_end(s);
}
- if(!s->context_initialized)
- {
+ if (!s->context_initialized) {
if(h != h0)
return -1; // we cant (re-)initialize context during parallel decoding
avcodec_set_dimensions(s->avctx, s->width, s->height);
- s->avctx->sample_aspect_ratio = h->sps.sar;
+ s->avctx->sample_aspect_ratio= h->sps.sar;
if(!s->avctx->sample_aspect_ratio.den)
s->avctx->sample_aspect_ratio.den = 1;
- if(h->sps.video_signal_type_present_flag)
- {
+ 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(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->sps.timing_info_present_flag)
- {
-#if __STDC_VERSION__ >= 199901L
- s->avctx->time_base = (AVRational)
- {
- h->sps.num_units_in_tick * 2, h->sps.time_scale
- };
-#else
+ if(h->sps.timing_info_present_flag){
+ #if __STDC_VERSION__ >= 199901L
+ s->avctx->time_base= (AVRational){h->sps.num_units_in_tick * 2, h->sps.time_scale};
+ #else
s->avctx->time_base.num = h->sps.num_units_in_tick * 2;
s->avctx->time_base.den = h->sps.time_scale;
-#endif
+ #endif
if(h->x264_build > 0 && h->x264_build < 44)
s->avctx->time_base.den *= 2;
av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
- s->avctx->time_base.num, s->avctx->time_base.den, 1 << 30);
+ s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
}
- if(MPV_common_init(s) < 0)
+ if (MPV_common_init(s) < 0)
return -1;
s->first_field = 0;
h->prev_interlaced_frame = 1;
@@ -279,8 +249,7 @@ int decode_slice_header_noexecute(H264Context *h)
init_scan_tables(h);
ff_h264_alloc_tables(h);
- for(i = 1; i < s->avctx->thread_count; i++)
- {
+ for(i = 1; i < s->avctx->thread_count; i++) {
H264Context *c;
c = h->thread_context[i] = av_malloc(sizeof(H264Context));
memcpy(c, h->s.thread_context[i], sizeof(MpegEncContext));
@@ -296,28 +265,22 @@ int decode_slice_header_noexecute(H264Context *h)
return -1;
}
- 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;
last_pic_structure = s0->picture_structure;
- 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;
+ 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;
}
}
- h->mb_field_decoding_flag = s->picture_structure != PICT_FRAME;
+ h->mb_field_decoding_flag= s->picture_structure != PICT_FRAME;
/* ffdshow custom code begin */
//
@@ -327,54 +290,42 @@ int decode_slice_header_noexecute(H264Context *h)
// This rule is applied only if h->has_to_drop_first_non_ref == 3.
// This is wrong because an unpaired field is allowed to be a reference field.
// And that's why this is optional and tried to be minimized.
- if(h->has_to_drop_first_non_ref == 1 && s->dropable)
- {
- if(FIELD_PICTURE)
- {
+ if (h->has_to_drop_first_non_ref == 1 && s->dropable){
+ if (FIELD_PICTURE){
h->has_to_drop_first_non_ref = 2;
- }
- else
- {
+ }else{
h->has_to_drop_first_non_ref = 0;
}
- }
- else if(h->has_to_drop_first_non_ref == 2)
- {
- if(FIELD_PICTURE && !s->dropable)
+ } else if (h->has_to_drop_first_non_ref == 2){
+ if (FIELD_PICTURE && !s->dropable)
h->has_to_drop_first_non_ref = 3;
- else if(!FIELD_PICTURE)
+ else if (!FIELD_PICTURE)
h->has_to_drop_first_non_ref = 0;
- }
- else if(h->has_to_drop_first_non_ref == 3)
- {
+ } else if (h->has_to_drop_first_non_ref == 3){
h->has_to_drop_first_non_ref = 0;
}
/* ffdshow custom code end */
- if(h0->current_slice == 0)
- {
+ if(h0->current_slice == 0){
while(h->frame_num != h->prev_frame_num &&
- h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num))
- {
+ h->frame_num != (h->prev_frame_num+1)%(1<<h->sps.log2_max_frame_num)){
av_log(NULL, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
- if(ff_h264_frame_start(h) < 0)
+ 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;
+ h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
+ s->current_picture_ptr->frame_num= h->prev_frame_num;
ff_h264_execute_ref_pic_marking(h, NULL, 0);
}
/* See if we have a decoded first field looking for a pair... */
- if(s0->first_field)
- {
+ if (s0->first_field) {
assert(s0->current_picture_ptr);
assert(s0->current_picture_ptr->data[0]);
assert(s0->current_picture_ptr->reference != DELAYED_PIC_REF);
/* figure out if we have a complementary field pair */
- if(!FIELD_PICTURE || s->picture_structure == last_pic_structure)
- {
+ 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.
@@ -382,14 +333,11 @@ int decode_slice_header_noexecute(H264Context *h)
s0->current_picture_ptr = NULL;
s0->first_field = FIELD_PICTURE;
- }
- else
- {
- if((h->nal_ref_idc &&
- s0->current_picture_ptr->reference &&
- s0->current_picture_ptr->frame_num != h->frame_num) ||
- h->has_to_drop_first_non_ref == 3) /* ffdshow custom code */
- {
+ } else {
+ if ((h->nal_ref_idc &&
+ s0->current_picture_ptr->reference &&
+ s0->current_picture_ptr->frame_num != h->frame_num) ||
+ h->has_to_drop_first_non_ref == 3) { /* ffdshow custom code */
/*
* This and previous field were reference, but had
* different frame_nums. Consider this field first in
@@ -399,24 +347,19 @@ int decode_slice_header_noexecute(H264Context *h)
s0->first_field = 1;
s0->current_picture_ptr = NULL;
- }
- else
- {
+ } else {
/* Second field in complementary pair */
s0->first_field = 0;
}
}
- }
- else
- {
+ } 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) && ff_h264_frame_start(h) < 0)
- {
+ if((!FIELD_PICTURE || s0->first_field) && ff_h264_frame_start(h) < 0) {
s0->first_field = 0;
return -1;
}
@@ -424,124 +367,105 @@ int decode_slice_header_noexecute(H264Context *h)
if(h != h0)
clone_slice(h, h0, 0); /* ffdshow custom code */
- 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(h->first_mb_in_slice << FIELD_OR_MBAFF_PICTURE >= s->mb_num ||
- h->first_mb_in_slice >= s->mb_num)
- {
+ h->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 = h->first_mb_in_slice % s->mb_width;
s->resync_mb_y = s->mb_y = (h->first_mb_in_slice / s->mb_width) << FIELD_OR_MBAFF_PICTURE;
- if(s->picture_structure == PICT_BOTTOM_FIELD)
+ 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);
+ 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];
+ h->ref_count[0]= h->pps.ref_count[0];
+ h->ref_count[1]= h->pps.ref_count[1];
- if(h->slice_type_nos != FF_I_TYPE)
- {
- if(h->slice_type_nos == FF_B_TYPE)
- {
- h->direct_spatial_mv_pred = get_bits1(&s->gb);
+ if(h->slice_type_nos != FF_I_TYPE){
+ if(h->slice_type_nos == FF_B_TYPE){
+ h->direct_spatial_mv_pred= get_bits1(&s->gb);
}
- num_ref_idx_active_override_flag = 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(h->slice_type_nos == FF_B_TYPE)
- h->ref_count[1] = 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->slice_type_nos==FF_B_TYPE)
+ h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
- if(h->ref_count[0] - 1 > 32 - 1 || h->ref_count[1] - 1 > 32 - 1)
- {
+ if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){
av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
- h->ref_count[0] = h->ref_count[1] = 1;
+ h->ref_count[0]= h->ref_count[1]= 1;
return -1;
}
}
if(h->slice_type_nos == FF_B_TYPE)
- h->list_count = 2;
+ h->list_count= 2;
else
- h->list_count = 1;
- }
- else
- h->list_count = 0;
+ h->list_count= 1;
+ }else
+ h->list_count= 0;
- if(!default_ref_list_done)
- {
+ if(!default_ref_list_done){
ff_h264_fill_default_ref_list(h);
}
- if(h->slice_type_nos != FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
+ if(h->slice_type_nos!=FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
return -1;
- if(h->slice_type_nos != FF_I_TYPE)
- {
- s->last_picture_ptr = &h->ref_list[0][0];
+ if(h->slice_type_nos!=FF_I_TYPE){
+ s->last_picture_ptr= &h->ref_list[0][0];
ff_copy_picture(&s->last_picture, s->last_picture_ptr);
}
- if(h->slice_type_nos == FF_B_TYPE)
- {
- s->next_picture_ptr = &h->ref_list[1][0];
+ if(h->slice_type_nos==FF_B_TYPE){
+ s->next_picture_ptr= &h->ref_list[1][0];
ff_copy_picture(&s->next_picture, s->next_picture_ptr);
}
- if((h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE)
- || (h->pps.weighted_bipred_idc == 1 && h->slice_type_nos == FF_B_TYPE))
+ if( (h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE )
+ || (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
pred_weight_table(h);
- else if(h->pps.weighted_bipred_idc == 2 && h->slice_type_nos == FF_B_TYPE)
+ else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE)
implicit_weight_table(h);
- else
- {
+ else {
h->use_weight = 0;
- for(i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
h->luma_weight_flag[i] = 0;
h->chroma_weight_flag[i] = 0;
}
@@ -553,19 +477,17 @@ int decode_slice_header_noexecute(H264Context *h)
if(FRAME_MBAFF)
ff_h264_fill_mbaff_ref_list(h);
- if(h->slice_type_nos == FF_B_TYPE && !h->direct_spatial_mv_pred)
+ if(h->slice_type_nos==FF_B_TYPE && !h->direct_spatial_mv_pred)
ff_h264_direct_dist_scale_factor(h);
ff_h264_direct_ref_list_init(h);
- if(h->slice_type_nos != FF_I_TYPE && h->pps.cabac)
- {
+ if( h->slice_type_nos != FF_I_TYPE && 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;
@@ -573,73 +495,61 @@ int decode_slice_header_noexecute(H264Context *h)
h->slice_qp_delta = get_se_golomb(&s->gb);
tmp = h->pps.init_qp + h->slice_qp_delta;
// <== End patch MPC
- if(tmp > 51)
- {
+ if(tmp>51){
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 == FF_SP_TYPE)
- {
+ if(h->slice_type == FF_SP_TYPE){
get_bits1(&s->gb); /* sp_for_switch_flag */
}
- if(h->slice_type == FF_SP_TYPE || h->slice_type == FF_SI_TYPE)
- {
- // ==> Start patch MPC
+ if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){
+ // ==> Start patch MPC
h->slice_qs_delta = get_se_golomb(&s->gb); /* slice_qs_delta */
- // <== End patch MPC
+ // <== End patch MPC
}
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)
- {
+ 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;
+ h->deblocking_filter= tmp;
if(h->deblocking_filter < 2)
- h->deblocking_filter ^= 1; // 1<->0
+ 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)
- {
+ 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 != FF_I_TYPE)
- || (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
- || (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 != FF_I_TYPE)
+ ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
+ ||(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. */
h->deblocking_filter = 2;
- }
- else
- {
+ } else {
h0->max_contexts = 1;
- if(!h0->single_decode_warning)
- {
+ 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;
}
@@ -647,121 +557,110 @@ int decode_slice_header_noexecute(H264Context *h)
return 1; // deblocking switched inside frame
}
}
- 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]);
+ 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]);
#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, ?);
+ 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
- // ==> Start patch MPC
- // If entropy_coding_mode, align to 8 bits
- if(h->pps.cabac) align_get_bits(&s->gb);
+ // ==> Start patch MPC
+ // If entropy_coding_mode, align to 8 bits
+ if (h->pps.cabac) align_get_bits( &s->gb );
- h->bit_offset_to_slice_data = s->gb.index;
- // <== End patch MPC
+ h->bit_offset_to_slice_data = s->gb.index;
+ // <== End patch MPC
h0->last_slice_type = slice_type;
h->slice_num = ++h0->current_slice;
- if(h->slice_num >= MAX_SLICES)
- {
+ 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;
- if(h->ref_list[j][i].data[0])
- {
+ 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].data[0]){
int k;
- uint8_t *base = h->ref_list[j][i].base[0];
- for(k = 0; k < h->short_ref_count; k++)
- if(h->short_ref[k]->base[0] == base)
- {
- id_list[i] = k;
+ uint8_t *base= h->ref_list[j][i].base[0];
+ for(k=0; k<h->short_ref_count; k++)
+ if(h->short_ref[k]->base[0] == base){
+ id_list[i]= k;
break;
}
- for(k = 0; k < h->long_ref_count; k++)
- if(h->long_ref[k] && h->long_ref[k]->base[0] == base)
- {
- id_list[i] = h->short_ref_count + k;
+ for(k=0; k<h->long_ref_count; k++)
+ if(h->long_ref[k] && h->long_ref[k]->base[0] == base){
+ 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].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].reference & 3);
+ ref2frm[0]=
+ ref2frm[1]= -1;
+ for(i=0; i<16; i++)
+ ref2frm[i+2]= 4*id_list[i]
+ +(h->ref_list[j][i].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].reference&3);
}
- h->emu_edge_width = (s->flags & CODEC_FLAG_EMU_EDGE) ? 0 : 16;
- h->emu_edge_height = (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
+ h->emu_edge_width= (s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16;
+ h->emu_edge_height= (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
- s->avctx->refs = h->sps.ref_frame_count;
+ s->avctx->refs= h->sps.ref_frame_count;
- fill_dxva_slice_long(h);
+ fill_dxva_slice_long(h);
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ 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"),
h->first_mb_in_slice,
av_get_pict_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],
h->ref_count[0], h->ref_count[1],
s->qscale,
- h->deblocking_filter, h->slice_alpha_c0_offset / 2, h->slice_beta_offset / 2,
+ h->deblocking_filter, h->slice_alpha_c0_offset/2, h->slice_beta_offset/2,
h->use_weight,
- h->use_weight == 1 && h->use_weight_chroma ? "c" : "",
+ h->use_weight==1 && h->use_weight_chroma ? "c" : "",
h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
- );
+ );
}
return 0;
}
-static int decode_nal_units_noexecute(H264Context *h, uint8_t *buf, int buf_size)
-{
+static int decode_nal_units_noexecute(H264Context *h, uint8_t *buf, int buf_size){
MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx = s->avctx;
- int buf_index = 0;
+ AVCodecContext * const avctx= s->avctx;
+ int buf_index=0;
H264Context *hx; ///< thread context
int context_count = 0;
- int next_avc = h->is_avc ? 0 : buf_size;
+ int next_avc= h->is_avc ? 0 : buf_size;
h->max_contexts = avctx->thread_count;
#if 0
int i;
- for(i = 0; i < 50; i++)
- {
- av_log(NULL, AV_LOG_ERROR, "%02X ", buf[i]);
+ for(i=0; i<50; i++){
+ av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]);
}
#endif
- 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;
+ if (!s->first_field)
+ s->current_picture_ptr= NULL;
ff_h264_reset_sei(h);
}
- for(;;)
- {
+ for(;;){
int consumed;
int dst_length;
int bit_length;
@@ -769,131 +668,117 @@ static int decode_nal_units_noexecute(H264Context *h, uint8_t *buf, int buf_size
int i, nalsize = 0;
int err;
- if(buf_index >= next_avc)
- {
+ if(buf_index >= next_avc) {
if(buf_index >= buf_size) break;
nalsize = 0;
for(i = 0; i < h->nal_length_size; i++)
nalsize = (nalsize << 8) | buf[buf_index++];
- if(nalsize <= 1 || nalsize > buf_size - buf_index)
- {
- if(nalsize == 1)
- {
+ if(nalsize <= 1 || nalsize > buf_size - buf_index){
+ if(nalsize == 1){
buf_index++;
continue;
- }
- else
- {
+ }else{
av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
break;
}
}
- next_avc = buf_index + nalsize;
- }
- else
- {
+ next_avc= buf_index + nalsize;
+ } else {
// start code prefix search
- for(; buf_index + 3 < next_avc; buf_index++)
- {
+ 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) break;
+ if(buf_index+3 >= buf_size) break;
- buf_index += 3;
+ 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)
- {
+ ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index);
+ if (ptr==NULL || dst_length < 0){
return -1;
}
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));
+ 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)
- {
+ 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)
- {
+ 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;
/* ffdshow custom code */
- if((s->hurry_up == 1 && hx->nal_ref_idc == 0) //FIXME do not discard SEI id
- || (avctx->skip_frame >= AVDISCARD_NONREF && hx->nal_ref_idc == 0))
+ if( (s->hurry_up == 1 && hx->nal_ref_idc == 0) //FIXME do not discard SEI id
+ ||(avctx->skip_frame >= AVDISCARD_NONREF && hx->nal_ref_idc == 0))
continue;
-again:
+ again:
err = 0;
- switch(hx->nal_unit_type)
- {
+ switch(hx->nal_unit_type){
case NAL_IDR_SLICE:
- if(h->nal_unit_type != 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");
return -1;
}
idr(h); //FIXME ensure we don't loose 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->intra_gb_ptr=
+ hx->inter_gb_ptr= &hx->s.gb;
hx->s.data_partitioning = 0;
- // ==> Start patch MPC DXVA
- hx->ref_pic_flag = (h->nal_ref_idc != 0);
+ // ==> Start patch MPC DXVA
+ hx->ref_pic_flag = (h->nal_ref_idc != 0);
if((err = decode_slice_header_noexecute(hx)))
- break;
- // <== End patch MPC DXVA
+ break;
+ // <== End patch MPC DXVA
s->current_picture_ptr->key_frame |=
- (hx->nal_unit_type == NAL_IDR_SLICE) ||
- (h->sei_recovery_frame_cnt >= 0);
- if(hx->redundant_pic_count == 0 && hx->s.hurry_up < 5
+ (hx->nal_unit_type == NAL_IDR_SLICE) ||
+ (h->sei_recovery_frame_cnt >= 0);
+ if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
- && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos != FF_B_TYPE)
- && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos == FF_I_TYPE)
- && avctx->skip_frame < AVDISCARD_ALL)
- {
- context_count++;
+ && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
+ && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
+ && avctx->skip_frame < AVDISCARD_ALL){
+ context_count++;
}
break;
case NAL_DPA:
init_get_bits(&hx->s.gb, ptr, bit_length);
- hx->intra_gb_ptr =
- hx->inter_gb_ptr = NULL;
- // ==> Start patch MPC DXVA
- if((err = decode_slice_header_noexecute(hx)) < 0)
+ hx->intra_gb_ptr=
+ hx->inter_gb_ptr= NULL;
+ // ==> Start patch MPC DXVA
+ if ((err = decode_slice_header_noexecute(hx)) < 0)
break;
- // <== End patch MPC DXVA
+ // <== End patch MPC DXVA
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;
+ 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;
+ hx->inter_gb_ptr= &hx->inter_gb;
- if(hx->redundant_pic_count == 0 && hx->intra_gb_ptr && hx->s.data_partitioning
+ if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
&& s->context_initialized
&& s->hurry_up < 5
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
- && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos != FF_B_TYPE)
- && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos == FF_I_TYPE)
+ && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
+ && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
&& avctx->skip_frame < AVDISCARD_ALL)
context_count++;
break;
@@ -905,11 +790,11 @@ again:
init_get_bits(&s->gb, ptr, bit_length);
ff_h264_decode_seq_parameter_set(h);
- if(s->flags & CODEC_FLAG_LOW_DELAY)
- s->low_delay = 1;
+ if(s->flags& CODEC_FLAG_LOW_DELAY)
+ s->low_delay=1;
if(avctx->has_b_frames < 2)
- avctx->has_b_frames = !s->low_delay;
+ avctx->has_b_frames= !s->low_delay;
break;
case NAL_PPS:
init_get_bits(&s->gb, ptr, bit_length);
@@ -928,18 +813,16 @@ again:
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)
- {
- // ==> Start patch MPC DXVA
- // execute_decode_slices(h, context_count);
- // <== End patch MPC DXVA
+ if(context_count == h->max_contexts) {
+ // ==> Start patch MPC DXVA
+ // execute_decode_slices(h, context_count);
+ // <== End patch MPC DXVA
context_count = 0;
}
- if(err < 0)
+ if (err < 0)
av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
- else if(err == 1)
- {
+ 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
@@ -950,97 +833,88 @@ again:
goto again;
}
}
- // ==> Start patch MPC DXVA
+ // ==> Start patch MPC DXVA
//if(context_count)
// execute_decode_slices(h, context_count);
- // <== End patch MPC DXVA
+ // <== End patch MPC DXVA
return buf_index;
}
int av_h264_decode_frame(AVCodecContext *avctx,
- int* nOutPOC, int64_t* rtStartTime,
- const uint8_t *buf, int buf_size)
+ int* nOutPOC, int64_t* rtStartTime,
+ const uint8_t *buf, int buf_size)
{
H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
int buf_index;
- // ==> Start patch MPC DXVA
- if(nOutPOC) *nOutPOC = -1;
- // <== End patch MPC DXVA
+ // ==> Start patch MPC DXVA
+ if (nOutPOC) *nOutPOC = -1;
+ // <== End patch MPC DXVA
- 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 */
- if(buf_size == 0)
- {
+ /* end of stream, output what is still in the buffers */
+ if (buf_size == 0) {
Picture *out;
int i, out_idx;
//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]->key_frame && !h->delayed_pic[i]->mmco_reset; i++)
- if(h->delayed_pic[i]->poc < out->poc)
- {
+ for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->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++)
+ for(i=out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i+1];
- if(out)
- {
- // ==> Start patch MPC DXVA
- if(nOutPOC) *nOutPOC = out->poc;
- if(rtStartTime) *rtStartTime = out->reordered_opaque;
- // <== End patch MPC DXVA
+ if(out){
+ // ==> Start patch MPC DXVA
+ if (nOutPOC) *nOutPOC = out->poc;
+ if (rtStartTime) *rtStartTime = out->reordered_opaque;
+ // <== End patch MPC DXVA
}
return 0;
}
/* ffdshow custom code (begin) */
- if(h->is_avc && !h->got_avcC)
- {
+ if(h->is_avc && !h->got_avcC) {
int i, cnt, nalsize;
- unsigned char *p = avctx->extradata, *pend = p + avctx->extradata_size;
+ unsigned char *p = avctx->extradata, *pend=p+avctx->extradata_size;
h->nal_length_size = 2;
cnt = 1;
- for(i = 0; i < cnt; i++)
- {
+ for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
- if(decode_nal_units(h, p, nalsize) < 0)
- {
+ if(decode_nal_units(h, p, nalsize) < 0) {
av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
return -1;
}
p += nalsize;
}
// Decode pps from avcC
- for(i = 0; p < pend - 2; i++)
- {
+ for (i = 0; p<pend-2; i++) {
nalsize = AV_RB16(p) + 2;
- if(decode_nal_units(h, p, nalsize) != nalsize)
- {
+ if(decode_nal_units(h, p, nalsize) != nalsize) {
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
- h->nal_length_size = avctx->nal_length_size ? avctx->nal_length_size : 4; //((*(((char*)(avctx->extradata))+4))&0x03)+1;
+ h->nal_length_size = avctx->nal_length_size?avctx->nal_length_size:4;//((*(((char*)(avctx->extradata))+4))&0x03)+1;
// Do not reparse avcC
h->got_avcC = 1;
}
- if(!h->got_avcC && !h->is_avc && s->avctx->extradata_size)
- {
+ if(!h->got_avcC && !h->is_avc && s->avctx->extradata_size){
if(decode_nal_units(h, s->avctx->extradata, s->avctx->extradata_size) < 0)
return -1;
h->got_avcC = 1;
@@ -1048,48 +922,42 @@ int av_h264_decode_frame(AVCodecContext *avctx,
}
/* ffdshow custom code (end) */
- // ==> Start patch MPC DXVA
- buf_index = decode_nal_units_noexecute(h, buf, buf_size);
- // <== End patch MPC DXVA
+ // ==> Start patch MPC DXVA
+ buf_index=decode_nal_units_noexecute(h, buf, buf_size);
+ // <== End patch MPC DXVA
if(buf_index < 0)
return -1;
- if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr)
- {
- if(avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
+ if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
+ if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) 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) || (s->mb_y >= s->mb_height && s->mb_height)){
Picture *out = s->current_picture_ptr;
Picture *cur = s->current_picture_ptr;
int i, pics, out_of_order, out_idx;
- // ==> Start patch MPC DXVA
- field_end_noexecute(h);
- // <== End patch MPC DXVA
+ // ==> Start patch MPC DXVA
+ field_end_noexecute(h);
+ // <== End patch MPC DXVA
- if(cur->field_poc[0] == INT_MAX || cur->field_poc[1] == INT_MAX)
- {
+ if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) {
/* Wait for second field. */
- // ==> Start patch MPC DXVA
- //*data_size = 0;
- // <== End patch MPC DXVA
+ // ==> Start patch MPC DXVA
+ //*data_size = 0;
+ // <== End patch MPC DXVA
- }
- else
- {
+ } else {
cur->interlaced_frame = 0;
cur->repeat_pict = 0;
/* Signal interlacing information externally. */
/* 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;
@@ -1099,7 +967,7 @@ int av_h264_decode_frame(AVCodecContext *avctx,
break;
case SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP:
- if(FIELD_OR_MBAFF_PICTURE)
+ if (FIELD_OR_MBAFF_PICTURE)
cur->interlaced_frame = 1;
else
// try to flag soft telecine progressive
@@ -1120,34 +988,26 @@ int av_h264_decode_frame(AVCodecContext *avctx,
break;
}
- if((h->sei_ct_type & 3) && h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
- cur->interlaced_frame = (h->sei_ct_type & (1 << 1)) != 0;
- }
- else
- {
+ if ((h->sei_ct_type & 3) && h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
+ cur->interlaced_frame = (h->sei_ct_type & (1<<1)) != 0;
+ }else{
/* Derive interlacing flag from used decoding process. */
cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE;
}
h->prev_interlaced_frame = cur->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->top_field_first = cur->field_poc[0] < cur->field_poc[1];
- }
- else
- {
- if(cur->interlaced_frame || h->sps.pic_struct_present_flag)
- {
+ }else{
+ if(cur->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)
+ || h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->top_field_first = 1;
else
cur->top_field_first = 0;
- }
- else
- {
+ }else{
/* Most likely progressive */
cur->top_field_first = 0;
}
@@ -1157,22 +1017,20 @@ int av_h264_decode_frame(AVCodecContext *avctx,
cur->video_full_range_flag = h->sps.full_range;
cur->YCbCr_RGB_matrix_coefficients = h->sps.colorspace;
- //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)
- {
+ && s->avctx->has_b_frames < h->sps.num_reorder_frames){
s->avctx->has_b_frames = h->sps.num_reorder_frames;
s->low_delay = 0;
}
- if(s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
- && !h->sps.bitstream_restriction_flag)
- {
- s->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT;
- s->low_delay = 0;
+ if( s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
+ && !h->sps.bitstream_restriction_flag){
+ s->avctx->has_b_frames= MAX_DELAYED_PIC_COUNT;
+ s->low_delay= 0;
}
pics = 0;
@@ -1186,59 +1044,52 @@ int av_h264_decode_frame(AVCodecContext *avctx,
out = h->delayed_pic[0];
out_idx = 0;
- for(i = 1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && !h->delayed_pic[i]->mmco_reset; i++)
- if(h->delayed_pic[i]->poc < out->poc)
- {
+ for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->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;
}
if(s->avctx->has_b_frames == 0 && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset))
- h->outputed_poc = INT_MIN;
+ h->outputed_poc= INT_MIN;
out_of_order = out->poc < h->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)
- || (s->low_delay &&
- ((h->outputed_poc != INT_MIN && out->poc > h->outputed_poc + 2)
- || cur->pict_type == FF_B_TYPE)))
+ else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT)
+ || (s->low_delay &&
+ ((h->outputed_poc != INT_MIN && out->poc > h->outputed_poc + 2)
+ || cur->pict_type == FF_B_TYPE)))
{
s->low_delay = 0;
s->avctx->has_b_frames++;
}
- if(out_of_order || pics > s->avctx->has_b_frames)
- {
+ if(out_of_order || pics > s->avctx->has_b_frames){
out->reference &= ~DELAYED_PIC_REF;
- for(i = out_idx; h->delayed_pic[i]; i++)
+ for(i=out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i+1];
}
- // ==> Start patch MPC DXVA
- if(!out_of_order && pics > s->avctx->has_b_frames)
- {
+ // ==> Start patch MPC DXVA
+ if(!out_of_order && pics > s->avctx->has_b_frames){
- if(out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset))
- {
+ if(out_idx==0 && h->delayed_pic[0] && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset)) {
h->outputed_poc = INT_MIN;
- }
- else
+ } else
h->outputed_poc = out->poc;
- if(nOutPOC) *nOutPOC = out->poc;
- if(rtStartTime) *rtStartTime = out->reordered_opaque;
- }
- else
- {
+ if (nOutPOC) *nOutPOC = out->poc;
+ if (rtStartTime) *rtStartTime = out->reordered_opaque;
+ }else{
av_log(avctx, AV_LOG_DEBUG, "no picture\n");
}
- // <== End patch MPC DXVA
+ // <== End patch MPC DXVA
}
}
- // ==> Start patch MPC DXVA
+ // ==> Start patch MPC DXVA
//assert(pict->data[0] || !*data_size);
//ff_print_debug_info(s, pict);
- // <== End patch MPC DXVA
+ // <== End patch MPC DXVA
/* ffdshow custom code (begin) */
//pict->h264_poc_decoded = h->poc_lsb + h->poc_msb;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_loopfilter.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_loopfilter.c
index 91fc1e3bc..1a2ceb816 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_loopfilter.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_loopfilter.c
@@ -37,33 +37,31 @@
#include <assert.h>
/* Deblocking filter (p153) */
-static const uint8_t alpha_table[52*3] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 4, 5, 6,
- 7, 8, 9, 10, 12, 13, 15, 17, 20, 22,
+static const uint8_t alpha_table[52*3] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 4, 4, 5, 6,
+ 7, 8, 9, 10, 12, 13, 15, 17, 20, 22,
25, 28, 32, 36, 40, 45, 50, 56, 63, 71,
- 80, 90, 101, 113, 127, 144, 162, 182, 203, 226,
- 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 80, 90,101,113,127,144,162,182,203,226,
+ 255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,
};
-static const uint8_t beta_table[52*3] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 2, 2, 2, 3,
- 3, 3, 3, 4, 4, 4, 6, 6, 7, 7,
- 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
+static const uint8_t beta_table[52*3] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2, 2, 2, 3,
+ 3, 3, 3, 4, 4, 4, 6, 6, 7, 7,
+ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
@@ -71,97 +69,84 @@ static const uint8_t beta_table[52*3] =
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
};
-static const uint8_t tc0_table[52*3][4] =
-{
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
- { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 1 },
- { -1, 0, 0, 1 }, { -1, 0, 0, 1 }, { -1, 0, 0, 1 }, { -1, 0, 1, 1 }, { -1, 0, 1, 1 }, { -1, 1, 1, 1 },
- { -1, 1, 1, 1 }, { -1, 1, 1, 1 }, { -1, 1, 1, 1 }, { -1, 1, 1, 2 }, { -1, 1, 1, 2 }, { -1, 1, 1, 2 },
- { -1, 1, 1, 2 }, { -1, 1, 2, 3 }, { -1, 1, 2, 3 }, { -1, 2, 2, 3 }, { -1, 2, 2, 4 }, { -1, 2, 3, 4 },
- { -1, 2, 3, 4 }, { -1, 3, 3, 5 }, { -1, 3, 4, 6 }, { -1, 3, 4, 6 }, { -1, 4, 5, 7 }, { -1, 4, 5, 8 },
- { -1, 4, 6, 9 }, { -1, 5, 7, 10 }, { -1, 6, 8, 11 }, { -1, 6, 8, 13 }, { -1, 7, 10, 14 }, { -1, 8, 11, 16 },
- { -1, 9, 12, 18 }, { -1, 10, 13, 20 }, { -1, 11, 15, 23 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
- { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 },
+static const uint8_t tc0_table[52*3][4] = {
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
+ {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 },
+ {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 },
+ {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 },
+ {-1, 1, 1, 2 }, {-1, 1, 2, 3 }, {-1, 1, 2, 3 }, {-1, 2, 2, 3 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 },
+ {-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 },
+ {-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 },
+ {-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
+ {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
};
-static void av_always_inline filter_mb_edgev(uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h)
-{
+static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) {
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp + h->slice_beta_offset];
- if(alpha == 0 || beta == 0) return;
+ if (alpha ==0 || beta == 0) return;
- if(bS[0] < 4)
- {
+ if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]];
tc[1] = tc0_table[index_a][bS[1]];
tc[2] = tc0_table[index_a][bS[2]];
tc[3] = tc0_table[index_a][bS[3]];
h->s.dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);
- }
- else
- {
+ } else {
h->s.dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
}
}
-static void av_always_inline filter_mb_edgecv(uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h)
-{
+static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp + h->slice_beta_offset];
- if(alpha == 0 || beta == 0) return;
+ if (alpha ==0 || beta == 0) return;
- if(bS[0] < 4)
- {
+ if( bS[0] < 4 ) {
int8_t tc[4];
- tc[0] = tc0_table[index_a][bS[0]] + 1;
- tc[1] = tc0_table[index_a][bS[1]] + 1;
- tc[2] = tc0_table[index_a][bS[2]] + 1;
- tc[3] = tc0_table[index_a][bS[3]] + 1;
+ tc[0] = tc0_table[index_a][bS[0]]+1;
+ tc[1] = tc0_table[index_a][bS[1]]+1;
+ tc[2] = tc0_table[index_a][bS[2]]+1;
+ tc[3] = tc0_table[index_a][bS[3]]+1;
h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
- }
- else
- {
+ } else {
h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
}
}
-static void filter_mb_mbaff_edgev(H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp)
-{
+static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
int i;
int index_a = qp + h->slice_alpha_c0_offset;
int alpha = alpha_table[index_a];
int beta = beta_table[qp + h->slice_beta_offset];
- for(i = 0; i < 8; i++, pix += stride)
- {
+ for( i = 0; i < 8; i++, pix += stride) {
const int bS_index = (i >> 1) * bsi;
- if(bS[bS_index] == 0)
- {
+ if( bS[bS_index] == 0 ) {
continue;
}
- if(bS[bS_index] < 4)
- {
+ if( bS[bS_index] < 4 ) {
const int tc0 = tc0_table[index_a][bS[bS_index]];
const int p0 = pix[-1];
const int p1 = pix[-2];
@@ -170,34 +155,29 @@ static void filter_mb_mbaff_edgev(H264Context *h, uint8_t *pix, int stride, int1
const int q1 = pix[1];
const int q2 = pix[2];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
int tc = tc0;
int i_delta;
- if(FFABS(p2 - p0) < beta)
- {
+ if( FFABS( p2 - p0 ) < beta ) {
if(tc0)
- pix[-2] = p1 + av_clip((p2 + ((p0 + q0 + 1) >> 1) - (p1 << 1)) >> 1, -tc0, tc0);
+ pix[-2] = p1 + av_clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 );
tc++;
}
- if(FFABS(q2 - q0) < beta)
- {
+ if( FFABS( q2 - q0 ) < beta ) {
if(tc0)
- pix[1] = q1 + av_clip((q2 + ((p0 + q0 + 1) >> 1) - (q1 << 1)) >> 1, -tc0, tc0);
+ pix[1] = q1 + av_clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 );
tc++;
}
- i_delta = av_clip((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -tc, tc);
- pix[-1] = av_clip_uint8(p0 + i_delta); /* p0' */
- pix[0] = av_clip_uint8(q0 - i_delta); /* q0' */
+ i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
+ pix[-1] = av_clip_uint8( p0 + i_delta ); /* p0' */
+ pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */
tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
}
- }
- else
- {
+ }else{
const int p0 = pix[-1];
const int p1 = pix[-2];
const int p2 = pix[-3];
@@ -206,151 +186,126 @@ static void filter_mb_mbaff_edgev(H264Context *h, uint8_t *pix, int stride, int1
const int q1 = pix[1];
const int q2 = pix[2];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
- if(FFABS(p0 - q0) < ((alpha >> 2) + 2))
- {
- if(FFABS(p2 - p0) < beta)
+ if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
+ if( FFABS( p2 - p0 ) < beta)
{
const int p3 = pix[-4];
/* p0', p1', p2' */
- pix[-1] = (p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3;
- pix[-2] = (p2 + p1 + p0 + q0 + 2) >> 2;
- pix[-3] = (2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3;
- }
- else
- {
+ pix[-1] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
+ pix[-2] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
+ pix[-3] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
+ } else {
/* p0' */
- pix[-1] = (2 * p1 + p0 + q1 + 2) >> 2;
+ pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
}
- if(FFABS(q2 - q0) < beta)
+ if( FFABS( q2 - q0 ) < beta)
{
const int q3 = pix[3];
/* q0', q1', q2' */
- pix[0] = (p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3;
- pix[1] = (p0 + q0 + q1 + q2 + 2) >> 2;
- pix[2] = (2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3;
- }
- else
- {
+ pix[0] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
+ pix[1] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
+ pix[2] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
+ } else {
/* q0' */
- pix[0] = (2 * q1 + q0 + p1 + 2) >> 2;
+ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
}
- }
- else
- {
+ }else{
/* p0', q0' */
- pix[-1] = (2 * p1 + p0 + q1 + 2) >> 2;
- pix[ 0] = (2 * q1 + q0 + p1 + 2) >> 2;
+ pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
+ pix[ 0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
}
tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, p2, p1, p0, q0, q1, q2, pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
}
}
}
}
-static void filter_mb_mbaff_edgecv(H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp)
-{
+static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
int i;
int index_a = qp + h->slice_alpha_c0_offset;
int alpha = alpha_table[index_a];
int beta = beta_table[qp + h->slice_beta_offset];
- for(i = 0; i < 4; i++, pix += stride)
- {
- const int bS_index = i * bsi;
+ for( i = 0; i < 4; i++, pix += stride) {
+ const int bS_index = i*bsi;
- if(bS[bS_index] == 0)
- {
+ if( bS[bS_index] == 0 ) {
continue;
}
- if(bS[bS_index] < 4)
- {
+ if( bS[bS_index] < 4 ) {
const int tc = tc0_table[index_a][bS[bS_index]] + 1;
const int p0 = pix[-1];
const int p1 = pix[-2];
const int q0 = pix[0];
const int q1 = pix[1];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
- const int i_delta = av_clip((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -tc, tc);
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
+ const int i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
- pix[-1] = av_clip_uint8(p0 + i_delta); /* p0' */
- pix[0] = av_clip_uint8(q0 - i_delta); /* q0' */
+ pix[-1] = av_clip_uint8( p0 + i_delta ); /* p0' */
+ pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */
tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
}
- }
- else
- {
+ }else{
const int p0 = pix[-1];
const int p1 = pix[-2];
const int q0 = pix[0];
const int q1 = pix[1];
- if(FFABS(p0 - q0) < alpha &&
- FFABS(p1 - p0) < beta &&
- FFABS(q1 - q0) < beta)
- {
+ if( FFABS( p0 - q0 ) < alpha &&
+ FFABS( p1 - p0 ) < beta &&
+ FFABS( q1 - q0 ) < beta ) {
- pix[-1] = (2 * p1 + p0 + q1 + 2) >> 2; /* p0' */
- pix[0] = (2 * q1 + q0 + p1 + 2) >> 2; /* q0' */
+ pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */
+ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */
tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
}
}
}
}
-static void av_always_inline filter_mb_edgeh(uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h)
-{
+static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp + h->slice_beta_offset];
- if(alpha == 0 || beta == 0) return;
+ if (alpha ==0 || beta == 0) return;
- if(bS[0] < 4)
- {
+ if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]];
tc[1] = tc0_table[index_a][bS[1]];
tc[2] = tc0_table[index_a][bS[2]];
tc[3] = tc0_table[index_a][bS[3]];
h->s.dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc);
- }
- else
- {
+ } else {
h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta);
}
}
-static void av_always_inline filter_mb_edgech(uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h)
-{
+static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp + h->slice_beta_offset];
- if(alpha == 0 || beta == 0) return;
+ if (alpha ==0 || beta == 0) return;
- if(bS[0] < 4)
- {
+ if( bS[0] < 4 ) {
int8_t tc[4];
- tc[0] = tc0_table[index_a][bS[0]] + 1;
- tc[1] = tc0_table[index_a][bS[1]] + 1;
- tc[2] = tc0_table[index_a][bS[2]] + 1;
- tc[3] = tc0_table[index_a][bS[3]] + 1;
+ tc[0] = tc0_table[index_a][bS[0]]+1;
+ tc[1] = tc0_table[index_a][bS[1]]+1;
+ tc[2] = tc0_table[index_a][bS[2]]+1;
+ tc[3] = tc0_table[index_a][bS[3]]+1;
h->s.dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc);
- }
- else
- {
+ } else {
h->s.dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta);
}
}
-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_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) {
MpegEncContext * const s = &h->s;
int mb_xy;
int mb_type, left_type;
@@ -358,80 +313,69 @@ void ff_h264_filter_mb_fast(H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
mb_xy = h->mb_xy;
- if(!h->top_type || !s->dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff)
- {
+ if(!h->top_type || !s->dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) {
ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize);
return;
}
assert(!FRAME_MBAFF);
- left_type = h->left_type[0];
+ left_type= h->left_type[0];
mb_type = s->current_picture.mb_type[mb_xy];
qp = s->current_picture.qscale_table[mb_xy];
qp0 = s->current_picture.qscale_table[mb_xy-1];
qp1 = s->current_picture.qscale_table[h->top_mb_xy];
- qpc = get_chroma_qp(h, 0, qp);
- qpc0 = get_chroma_qp(h, 0, qp0);
- qpc1 = get_chroma_qp(h, 0, qp1);
+ qpc = get_chroma_qp( h, 0, qp );
+ qpc0 = get_chroma_qp( h, 0, qp0 );
+ qpc1 = get_chroma_qp( h, 0, qp1 );
qp0 = (qp + qp0 + 1) >> 1;
qp1 = (qp + qp1 + 1) >> 1;
qpc0 = (qpc + qpc0 + 1) >> 1;
qpc1 = (qpc + qpc1 + 1) >> 1;
- qp_thresh = 15 + 52 - h->slice_alpha_c0_offset;
+ qp_thresh = 15+52 - h->slice_alpha_c0_offset;
if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh &&
qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh)
return;
- if(IS_INTRA(mb_type))
- {
- int16_t bS4[4] = {4, 4, 4, 4};
- int16_t bS3[4] = {3, 3, 3, 3};
+ if( IS_INTRA(mb_type) ) {
+ int16_t bS4[4] = {4,4,4,4};
+ int16_t bS3[4] = {3,3,3,3};
int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;
- if(IS_8x8DCT(mb_type))
- {
+ if( IS_8x8DCT(mb_type) ) {
if(left_type)
- filter_mb_edgev(&img_y[4*0], linesize, bS4, qp0, h);
- filter_mb_edgev(&img_y[4*2], linesize, bS3, qp, h);
- filter_mb_edgeh(&img_y[4*0*linesize], linesize, bSH, qp1, h);
- filter_mb_edgeh(&img_y[4*2*linesize], linesize, bS3, qp, h);
- }
- else
- {
+ filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h);
+ filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
+ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
+ filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
+ } else {
if(left_type)
- filter_mb_edgev(&img_y[4*0], linesize, bS4, qp0, h);
- filter_mb_edgev(&img_y[4*1], linesize, bS3, qp, h);
- filter_mb_edgev(&img_y[4*2], linesize, bS3, qp, h);
- filter_mb_edgev(&img_y[4*3], linesize, bS3, qp, h);
- filter_mb_edgeh(&img_y[4*0*linesize], linesize, bSH, qp1, h);
- filter_mb_edgeh(&img_y[4*1*linesize], linesize, bS3, qp, h);
- filter_mb_edgeh(&img_y[4*2*linesize], linesize, bS3, qp, h);
- filter_mb_edgeh(&img_y[4*3*linesize], linesize, bS3, qp, h);
+ filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h);
+ filter_mb_edgev( &img_y[4*1], linesize, bS3, qp, h);
+ filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
+ filter_mb_edgev( &img_y[4*3], linesize, bS3, qp, h);
+ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
+ filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, h);
+ filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
+ filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h);
}
- if(left_type)
- {
- filter_mb_edgecv(&img_cb[2*0], uvlinesize, bS4, qpc0, h);
- filter_mb_edgecv(&img_cr[2*0], uvlinesize, bS4, qpc0, h);
+ if(left_type){
+ filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h);
+ filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h);
}
- filter_mb_edgecv(&img_cb[2*2], uvlinesize, bS3, qpc, h);
- filter_mb_edgecv(&img_cr[2*2], uvlinesize, bS3, qpc, h);
- filter_mb_edgech(&img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
- filter_mb_edgech(&img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
- filter_mb_edgech(&img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
- filter_mb_edgech(&img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
+ filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h);
+ filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h);
+ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
+ filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
return;
- }
- else
- {
+ } else {
DECLARE_ALIGNED_8(int16_t, bS)[2][4][4];
uint64_t (*bSv)[4] = (uint64_t(*)[4])bS;
int edges;
- if(IS_8x8DCT(mb_type) && (h->cbp & 7) == 7)
- {
+ if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) {
edges = 4;
bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL;
- }
- else
- {
+ } else {
int mask_edge1 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 :
(mb_type & MB_TYPE_16x8) ? 1 : 0;
int mask_edge0 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16))
@@ -439,12 +383,12 @@ void ff_h264_filter_mb_fast(H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
? 3 : 0;
int step = IS_8x8DCT(mb_type) ? 2 : 1;
edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
- s->dsp.h264_loop_filter_strength(bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache,
- h->list_count == 2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE);
+ s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache,
+ h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE);
}
- if(IS_INTRA(h->left_type[0]))
+ if( IS_INTRA(h->left_type[0]) )
bSv[0][0] = 0x0004000400040004ULL;
- if(IS_INTRA(h->top_type))
+ if( IS_INTRA(h->top_type) )
bSv[1][0] = FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL;
#define FILTER(hv,dir,edge)\
@@ -455,91 +399,79 @@ void ff_h264_filter_mb_fast(H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
}\
}
- if(edges == 1)
- {
+ if( edges == 1 ) {
if(left_type)
- FILTER(v, 0, 0);
- FILTER(h, 1, 0);
- }
- else if(IS_8x8DCT(mb_type))
- {
+ FILTER(v,0,0);
+ FILTER(h,1,0);
+ } else if( IS_8x8DCT(mb_type) ) {
if(left_type)
- FILTER(v, 0, 0);
- FILTER(v, 0, 2);
- FILTER(h, 1, 0);
- FILTER(h, 1, 2);
- }
- else
- {
+ FILTER(v,0,0);
+ FILTER(v,0,2);
+ FILTER(h,1,0);
+ FILTER(h,1,2);
+ } else {
if(left_type)
- FILTER(v, 0, 0);
- FILTER(v, 0, 1);
- FILTER(v, 0, 2);
- FILTER(v, 0, 3);
- FILTER(h, 1, 0);
- FILTER(h, 1, 1);
- FILTER(h, 1, 2);
- FILTER(h, 1, 3);
+ FILTER(v,0,0);
+ FILTER(v,0,1);
+ FILTER(v,0,2);
+ FILTER(v,0,3);
+ FILTER(h,1,0);
+ FILTER(h,1,1);
+ FILTER(h,1,2);
+ FILTER(h,1,3);
}
#undef FILTER
}
}
-static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit)
-{
+static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){
int v;
v = h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx] |
h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U |
- FFABS(h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1]) >= mvy_limit;
+ FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit;
- if(h->list_count == 2)
- {
+ if(h->list_count==2){
if(!v)
v = h->ref_cache[1][b_idx] != h->ref_cache[1][bn_idx] |
h->mv_cache[1][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U |
- FFABS(h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1]) >= mvy_limit;
+ FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit;
- if(v)
- {
+ if(v){
if(h->ref_cache[0][b_idx] != h->ref_cache[1][bn_idx] |
h->ref_cache[1][b_idx] != h->ref_cache[0][bn_idx])
return 1;
return
h->mv_cache[0][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U |
- FFABS(h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1]) >= mvy_limit |
+ FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit |
h->mv_cache[1][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U |
- FFABS(h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1]) >= mvy_limit;
+ FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit;
}
}
return v;
}
-static av_always_inline void filter_mb_dir(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, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int dir)
-{
+static av_always_inline void filter_mb_dir(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, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int dir) {
MpegEncContext * const s = &h->s;
int edge;
- const int mbm_xy = dir == 0 ? mb_xy - 1 : h->top_mb_xy;
+ const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy;
const int mbm_type = dir == 0 ? h->left_type[0] : h->top_type;
// how often to recheck mv-based bS when iterating between edges
- static const uint8_t mask_edge_tab[2][8] = {{0, 3, 3, 3, 1, 1, 1, 1},
- {0, 3, 1, 1, 3, 3, 3, 3}
- };
+ static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1},
+ {0,3,1,1,3,3,3,3}};
const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7];
- const int edges = mask_edge == 3 && !(h->cbp & 15) ? 1 : 4;
+ const int edges = mask_edge== 3 && !(h->cbp&15) ? 1 : 4;
// how often to recheck mv-based bS when iterating along each edge
const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));
- if(mbm_type && !first_vertical_edge_done)
- {
+ if(mbm_type && !first_vertical_edge_done){
- if(FRAME_MBAFF && (dir == 1) && ((mb_y & 1) == 0)
- && IS_INTERLACED(mbm_type&~mb_type)
- )
- {
+ if (FRAME_MBAFF && (dir == 1) && ((mb_y&1) == 0)
+ && IS_INTERLACED(mbm_type&~mb_type)
+ ) {
// This is a special case in the norm where the filtering must
// be done twice (one each of the field) even if we are in a
// frame macroblock.
@@ -549,66 +481,50 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
int mbn_xy = mb_xy - 2 * s->mb_stride;
int j;
- for(j = 0; j < 2; j++, mbn_xy += s->mb_stride)
- {
+ for(j=0; j<2; j++, mbn_xy += s->mb_stride){
DECLARE_ALIGNED_8(int16_t, bS)[4];
int qp;
- if(IS_INTRA(mb_type | s->current_picture.mb_type[mbn_xy]))
- {
- *(uint64_t*)bS = 0x0003000300030003ULL;
- }
- else
- {
- const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 4 + 3 * 8; //FIXME 8x8dct?
+ if( IS_INTRA(mb_type|s->current_picture.mb_type[mbn_xy]) ) {
+ *(uint64_t*)bS= 0x0003000300030003ULL;
+ } else {
+ const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 4+3*8; //FIXME 8x8dct?
int i;
- for(i = 0; i < 4; i++)
- {
- bS[i] = 1 + !!(h->non_zero_count_cache[scan8[0] + i] | mbn_nnz[i]);
+ for( i = 0; i < 4; i++ ) {
+ bS[i] = 1 + !!(h->non_zero_count_cache[scan8[0]+i] | mbn_nnz[i]);
}
}
// Do not use s->qscale as luma quantizer because it has not the same
// value in IPCM macroblocks.
- qp = (s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1) >> 1;
+ qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1 ) >> 1;
tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);
- {
- int i;
- for(i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]);
- tprintf(s->avctx, "\n");
- }
- filter_mb_edgeh(&img_y[j*linesize], tmp_linesize, bS, qp, h);
- filter_mb_edgech(&img_cb[j*uvlinesize], tmp_uvlinesize, bS,
- (h->chroma_qp[0] + get_chroma_qp(h, 0, s->current_picture.qscale_table[mbn_xy]) + 1) >> 1, h);
- filter_mb_edgech(&img_cr[j*uvlinesize], tmp_uvlinesize, bS,
- (h->chroma_qp[1] + get_chroma_qp(h, 1, s->current_picture.qscale_table[mbn_xy]) + 1) >> 1, h);
+ { int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
+ filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, h );
+ filter_mb_edgech( &img_cb[j*uvlinesize], tmp_uvlinesize, bS,
+ ( h->chroma_qp[0] + get_chroma_qp( h, 0, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1, h);
+ filter_mb_edgech( &img_cr[j*uvlinesize], tmp_uvlinesize, bS,
+ ( h->chroma_qp[1] + get_chroma_qp( h, 1, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1, h);
}
- }
- else
- {
+ }else{
DECLARE_ALIGNED_8(int16_t, bS)[4];
int qp;
- if(IS_INTRA(mb_type | mbm_type))
- {
- *(uint64_t*)bS = 0x0003000300030003ULL;
- if((!IS_INTERLACED(mb_type | mbm_type))
- || ((FRAME_MBAFF || (s->picture_structure != PICT_FRAME)) && (dir == 0))
- )
- *(uint64_t*)bS = 0x0004000400040004ULL;
- }
- else
- {
+ if( IS_INTRA(mb_type|mbm_type)) {
+ *(uint64_t*)bS= 0x0003000300030003ULL;
+ if ( (!IS_INTERLACED(mb_type|mbm_type))
+ || ((FRAME_MBAFF || (s->picture_structure != PICT_FRAME)) && (dir == 0))
+ )
+ *(uint64_t*)bS= 0x0004000400040004ULL;
+ } else {
int i, l;
int mv_done;
- if(FRAME_MBAFF && IS_INTERLACED(mb_type ^ mbm_type)) //FIXME not posible left
- {
- *(uint64_t*)bS = 0x0001000100010001ULL;
+ if( FRAME_MBAFF && IS_INTERLACED(mb_type ^ mbm_type)) { //FIXME not posible left
+ *(uint64_t*)bS= 0x0001000100010001ULL;
mv_done = 1;
}
- else if(mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))))
- {
- int b_idx = 8 + 4;
- int bn_idx = b_idx - (dir ? 8 : 1);
+ else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {
+ int b_idx= 8 + 4;
+ int bn_idx= b_idx - (dir ? 8:1);
bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, 8 + 4, bn_idx, mvy_limit);
mv_done = 1;
@@ -616,16 +532,14 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
else
mv_done = 0;
- for(i = 0; i < 4; i++)
- {
+ for( i = 0; i < 4; i++ ) {
int x = dir == 0 ? 0 : i;
int y = dir == 0 ? i : 0;
- int b_idx = 8 + 4 + x + 8 * y;
- int bn_idx = b_idx - (dir ? 8 : 1);
+ int b_idx= 8 + 4 + x + 8*y;
+ int bn_idx= b_idx - (dir ? 8:1);
- if(h->non_zero_count_cache[b_idx] |
- h->non_zero_count_cache[bn_idx])
- {
+ if( h->non_zero_count_cache[b_idx] |
+ h->non_zero_count_cache[bn_idx] ) {
bS[i] = 2;
}
else if(!mv_done)
@@ -638,32 +552,28 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
/* Filter edge */
// Do not use s->qscale as luma quantizer because it has not the same
// value in IPCM macroblocks.
- if(bS[0] + bS[1] + bS[2] + bS[3])
- {
- qp = (s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbm_xy] + 1) >> 1;
+ if(bS[0]+bS[1]+bS[2]+bS[3]){
+ qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.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"); }
- if(dir == 0)
- {
- filter_mb_edgev(&img_y[0], linesize, bS, qp, h);
+ if( dir == 0 ) {
+ filter_mb_edgev( &img_y[0], linesize, bS, qp, h );
{
- int qp = (h->chroma_qp[0] + get_chroma_qp(h, 0, s->current_picture.qscale_table[mbm_xy]) + 1) >> 1;
- filter_mb_edgecv(&img_cb[0], uvlinesize, bS, qp, h);
+ int qp= ( h->chroma_qp[0] + get_chroma_qp( h, 0, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
+ filter_mb_edgecv( &img_cb[0], uvlinesize, bS, qp, h);
if(h->pps.chroma_qp_diff)
- qp = (h->chroma_qp[1] + get_chroma_qp(h, 1, s->current_picture.qscale_table[mbm_xy]) + 1) >> 1;
- filter_mb_edgecv(&img_cr[0], uvlinesize, bS, qp, h);
+ qp= ( h->chroma_qp[1] + get_chroma_qp( h, 1, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
+ filter_mb_edgecv( &img_cr[0], uvlinesize, bS, qp, h);
}
- }
- else
- {
- filter_mb_edgeh(&img_y[0], linesize, bS, qp, h);
+ } else {
+ filter_mb_edgeh( &img_y[0], linesize, bS, qp, h );
{
- int qp = (h->chroma_qp[0] + get_chroma_qp(h, 0, s->current_picture.qscale_table[mbm_xy]) + 1) >> 1;
- filter_mb_edgech(&img_cb[0], uvlinesize, bS, qp, h);
+ int qp= ( h->chroma_qp[0] + get_chroma_qp( h, 0, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
+ filter_mb_edgech( &img_cb[0], uvlinesize, bS, qp, h);
if(h->pps.chroma_qp_diff)
- qp = (h->chroma_qp[1] + get_chroma_qp(h, 1, s->current_picture.qscale_table[mbm_xy]) + 1) >> 1;
- filter_mb_edgech(&img_cr[0], uvlinesize, bS, qp, h);
+ qp= ( h->chroma_qp[1] + get_chroma_qp( h, 1, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
+ filter_mb_edgech( &img_cr[0], uvlinesize, bS, qp, h);
}
}
}
@@ -671,32 +581,26 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
}
/* Calculate bS */
- for(edge = 1; edge < edges; edge++)
- {
+ for( edge = 1; edge < edges; edge++ ) {
DECLARE_ALIGNED_8(int16_t, bS)[4];
int qp;
- if(IS_8x8DCT(mb_type & (edge << 24))) // (edge&1) && IS_8x8DCT(mb_type)
+ if( IS_8x8DCT(mb_type & (edge<<24)) ) // (edge&1) && IS_8x8DCT(mb_type)
continue;
- if(IS_INTRA(mb_type))
- {
- *(uint64_t*)bS = 0x0003000300030003ULL;
- }
- else
- {
+ if( IS_INTRA(mb_type)) {
+ *(uint64_t*)bS= 0x0003000300030003ULL;
+ } else {
int i, l;
int mv_done;
- if(edge & mask_edge)
- {
- *(uint64_t*)bS = 0;
+ if( edge & mask_edge ) {
+ *(uint64_t*)bS= 0;
mv_done = 1;
}
- else if(mask_par0)
- {
- int b_idx = 8 + 4 + edge * (dir ? 8 : 1);
- int bn_idx = b_idx - (dir ? 8 : 1);
+ else if( mask_par0 ) {
+ int b_idx= 8 + 4 + edge * (dir ? 8:1);
+ int bn_idx= b_idx - (dir ? 8:1);
bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, b_idx, bn_idx, mvy_limit);
mv_done = 1;
@@ -704,16 +608,14 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
else
mv_done = 0;
- for(i = 0; i < 4; i++)
- {
+ for( i = 0; i < 4; i++ ) {
int x = dir == 0 ? edge : i;
int y = dir == 0 ? i : edge;
- int b_idx = 8 + 4 + x + 8 * y;
- int bn_idx = b_idx - (dir ? 8 : 1);
+ int b_idx= 8 + 4 + x + 8*y;
+ int bn_idx= b_idx - (dir ? 8:1);
- if(h->non_zero_count_cache[b_idx] |
- h->non_zero_count_cache[bn_idx])
- {
+ if( h->non_zero_count_cache[b_idx] |
+ h->non_zero_count_cache[bn_idx] ) {
bS[i] = 2;
}
else if(!mv_done)
@@ -722,7 +624,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
}
}
- if(bS[0] + bS[1] + bS[2] + bS[3] == 0)
+ if(bS[0]+bS[1]+bS[2]+bS[3] == 0)
continue;
}
@@ -733,43 +635,36 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
//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], linesize, bS, qp, h);
- if((edge & 1) == 0)
- {
- filter_mb_edgecv(&img_cb[2*edge], uvlinesize, bS, h->chroma_qp[0], h);
- filter_mb_edgecv(&img_cr[2*edge], uvlinesize, bS, h->chroma_qp[1], h);
+ if( dir == 0 ) {
+ filter_mb_edgev( &img_y[4*edge], linesize, bS, qp, h );
+ if( (edge&1) == 0 ) {
+ filter_mb_edgecv( &img_cb[2*edge], uvlinesize, bS, h->chroma_qp[0], h);
+ filter_mb_edgecv( &img_cr[2*edge], uvlinesize, bS, h->chroma_qp[1], h);
}
- }
- else
- {
- filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, h);
- if((edge & 1) == 0)
- {
- filter_mb_edgech(&img_cb[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], h);
- filter_mb_edgech(&img_cr[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], h);
+ } else {
+ filter_mb_edgeh( &img_y[4*edge*linesize], linesize, bS, qp, h );
+ if( (edge&1) == 0 ) {
+ filter_mb_edgech( &img_cb[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], h);
+ filter_mb_edgech( &img_cr[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], h);
}
}
}
}
-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( 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) {
MpegEncContext * const s = &h->s;
- const int mb_xy = mb_x + mb_y * s->mb_stride;
+ const int mb_xy= mb_x + mb_y*s->mb_stride;
const int mb_type = s->current_picture.mb_type[mb_xy];
const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4;
int first_vertical_edge_done = 0;
av_unused int dir;
int list;
- if(FRAME_MBAFF
- // and current and left pair do not have the same interlaced type
- && IS_INTERLACED(mb_type ^ h->left_type[0])
- // and left mb is in available to us
- && h->left_type[0])
- {
+ if (FRAME_MBAFF
+ // and current and left pair do not have the same interlaced type
+ && IS_INTERLACED(mb_type^h->left_type[0])
+ // and left mb is in available to us
+ && h->left_type[0]) {
/* First vertical edge is different in MBAFF frames
* There are 8 different bS to compute and 2 different Qp
*/
@@ -781,37 +676,33 @@ void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
int i;
first_vertical_edge_done = 1;
- if(IS_INTRA(mb_type))
- *(uint64_t*)&bS[0] =
- *(uint64_t*)&bS[4] = 0x0004000400040004ULL;
- else
- {
- static const uint8_t offset[2][2][8] =
- {
+ if( IS_INTRA(mb_type) )
+ *(uint64_t*)&bS[0]=
+ *(uint64_t*)&bS[4]= 0x0004000400040004ULL;
+ else {
+ static const uint8_t offset[2][2][8]={
{
- {7 + 8 * 0, 7 + 8 * 0, 7 + 8 * 0, 7 + 8 * 0, 7 + 8 * 1, 7 + 8 * 1, 7 + 8 * 1, 7 + 8 * 1},
- {7 + 8 * 2, 7 + 8 * 2, 7 + 8 * 2, 7 + 8 * 2, 7 + 8 * 3, 7 + 8 * 3, 7 + 8 * 3, 7 + 8 * 3},
- }, {
- {7 + 8 * 0, 7 + 8 * 1, 7 + 8 * 2, 7 + 8 * 3, 7 + 8 * 0, 7 + 8 * 1, 7 + 8 * 2, 7 + 8 * 3},
- {7 + 8 * 0, 7 + 8 * 1, 7 + 8 * 2, 7 + 8 * 3, 7 + 8 * 0, 7 + 8 * 1, 7 + 8 * 2, 7 + 8 * 3},
+ {7+8*0, 7+8*0, 7+8*0, 7+8*0, 7+8*1, 7+8*1, 7+8*1, 7+8*1},
+ {7+8*2, 7+8*2, 7+8*2, 7+8*2, 7+8*3, 7+8*3, 7+8*3, 7+8*3},
+ },{
+ {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3},
+ {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3},
}
};
- const uint8_t *off = offset[MB_FIELD][mb_y&1];
- for(i = 0; i < 8; i++)
- {
- int j = MB_FIELD ? i >> 2 : i & 1;
+ const uint8_t *off= offset[MB_FIELD][mb_y&1];
+ for( i = 0; i < 8; i++ ) {
+ int j= MB_FIELD ? i>>2 : i&1;
int mbn_xy = h->left_mb_xy[j];
- int mbn_type = h->left_type[j];
+ int mbn_type= h->left_type[j];
- if(IS_INTRA(mbn_type))
+ if( IS_INTRA( mbn_type ) )
bS[i] = 4;
- else
- {
+ else{
bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |
- ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
- (h->cbp_table[mbn_xy] & ((MB_FIELD ? (i & 2) : (mb_y & 1)) ? 8 : 2))
- :
- h->non_zero_count[mbn_xy][ off[i] ]));
+ ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
+ (h->cbp_table[mbn_xy] & ((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2))
+ :
+ h->non_zero_count[mbn_xy][ off[i] ]));
}
}
}
@@ -819,46 +710,39 @@ void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
mb_qp = s->current_picture.qscale_table[mb_xy];
mbn0_qp = s->current_picture.qscale_table[h->left_mb_xy[0]];
mbn1_qp = s->current_picture.qscale_table[h->left_mb_xy[1]];
- qp[0] = (mb_qp + mbn0_qp + 1) >> 1;
- bqp[0] = (get_chroma_qp(h, 0, mb_qp) +
- get_chroma_qp(h, 0, mbn0_qp) + 1) >> 1;
- rqp[0] = (get_chroma_qp(h, 1, mb_qp) +
- get_chroma_qp(h, 1, mbn0_qp) + 1) >> 1;
- qp[1] = (mb_qp + mbn1_qp + 1) >> 1;
- bqp[1] = (get_chroma_qp(h, 0, mb_qp) +
- get_chroma_qp(h, 0, mbn1_qp) + 1) >> 1;
- rqp[1] = (get_chroma_qp(h, 1, mb_qp) +
- get_chroma_qp(h, 1, mbn1_qp) + 1) >> 1;
+ qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1;
+ bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) +
+ get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1;
+ rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) +
+ get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1;
+ qp[1] = ( mb_qp + mbn1_qp + 1 ) >> 1;
+ bqp[1] = ( get_chroma_qp( h, 0, mb_qp ) +
+ get_chroma_qp( h, 0, mbn1_qp ) + 1 ) >> 1;
+ rqp[1] = ( get_chroma_qp( h, 1, mb_qp ) +
+ get_chroma_qp( h, 1, mbn1_qp ) + 1 ) >> 1;
/* Filter edge */
tprintf(s->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize);
- {
- int i;
- for(i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]);
- tprintf(s->avctx, "\n");
- }
- if(MB_FIELD)
- {
- filter_mb_mbaff_edgev(h, img_y , linesize, bS , 1, qp [0]);
- filter_mb_mbaff_edgev(h, img_y + 8 * linesize, linesize, bS + 4, 1, qp [1]);
- filter_mb_mbaff_edgecv(h, img_cb, uvlinesize, bS , 1, bqp[0]);
- filter_mb_mbaff_edgecv(h, img_cb + 4 * uvlinesize, uvlinesize, bS + 4, 1, bqp[1]);
- filter_mb_mbaff_edgecv(h, img_cr, uvlinesize, bS , 1, rqp[0]);
- filter_mb_mbaff_edgecv(h, img_cr + 4 * uvlinesize, uvlinesize, bS + 4, 1, rqp[1]);
- }
- else
- {
- filter_mb_mbaff_edgev(h, img_y , 2 * linesize, bS , 2, qp [0]);
- filter_mb_mbaff_edgev(h, img_y + linesize, 2 * linesize, bS + 1, 2, qp [1]);
- filter_mb_mbaff_edgecv(h, img_cb, 2 * uvlinesize, bS , 2, bqp[0]);
- filter_mb_mbaff_edgecv(h, img_cb + uvlinesize, 2 * uvlinesize, bS + 1, 2, bqp[1]);
- filter_mb_mbaff_edgecv(h, img_cr, 2 * uvlinesize, bS , 2, rqp[0]);
- filter_mb_mbaff_edgecv(h, img_cr + uvlinesize, 2 * uvlinesize, bS + 1, 2, rqp[1]);
+ { int i; for (i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
+ if(MB_FIELD){
+ filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0] );
+ filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1] );
+ filter_mb_mbaff_edgecv( h, img_cb, uvlinesize, bS , 1, bqp[0] );
+ filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );
+ filter_mb_mbaff_edgecv( h, img_cr, uvlinesize, bS , 1, rqp[0] );
+ filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );
+ }else{
+ filter_mb_mbaff_edgev ( h, img_y , 2* linesize, bS , 2, qp [0] );
+ filter_mb_mbaff_edgev ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1] );
+ filter_mb_mbaff_edgecv( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] );
+ filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );
+ filter_mb_mbaff_edgecv( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] );
+ filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );
}
}
#if CONFIG_SMALL
- for(dir = 0; dir < 2; dir++)
+ for( dir = 0; dir < 2; dir++ )
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, dir);
#else
filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, 0);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_mvpred.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_mvpred.h
index 1554deec5..c4e99c244 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_mvpred.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_mvpred.h
@@ -35,15 +35,13 @@
//#undef NDEBUG
#include <assert.h>
-static 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 ];
+static 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)
- {
+ if(FRAME_MBAFF){
#define SET_DIAG_MV(MV_OP, REF_OP, X4, Y4)\
const int x4 = X4, y4 = Y4;\
@@ -56,39 +54,33 @@ static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, in
return s->current_picture_ptr->ref_index[list][(x4>>1) + (y4>>1)*h->b8_stride] 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)
- {
+ && 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->mb_type;
const int16_t *mv;
- *(uint32_t*)h->mv_cache[list][scan8[0] - 2] = 0;
- *C = h->mv_cache[list][scan8[0] - 2];
+ *(uint32_t*)h->mv_cache[list][scan8[0]-2] = 0;
+ *C = h->mv_cache[list][scan8[0]-2];
if(!MB_FIELD
- && IS_INTERLACED(mb_types[h->left_mb_xy[0]]))
- {
- SET_DIAG_MV( * 2, >> 1, s->mb_x * 4 - 1, (s->mb_y | 1) * 4 + (s->mb_y & 1) * 2 + (i >> 4) - 1);
+ && IS_INTERLACED(mb_types[h->left_mb_xy[0]])){
+ SET_DIAG_MV(*2, >>1, s->mb_x*4-1, (s->mb_y|1)*4+(s->mb_y&1)*2+(i>>4)-1);
}
if(MB_FIELD
- && !IS_INTERLACED(mb_types[h->left_mb_xy[0]]))
- {
+ && !IS_INTERLACED(mb_types[h->left_mb_xy[0]])){
// left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK.
- SET_DIAG_MV( / 2, << 1, s->mb_x * 4 - 1, (s->mb_y&~1) * 4 - 1 + ((i - scan8[0]) >> 3) * 2);
+ SET_DIAG_MV(/2, <<1, s->mb_x*4-1, (s->mb_y&~1)*4 - 1 + ((i-scan8[0])>>3)*2);
}
}
#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 ];
+ *C= h->mv_cache[list][ i - 8 - 1 ];
return h->ref_cache[list][ i - 8 - 1 ];
}
}
@@ -100,63 +92,49 @@ static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, in
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static 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 ];
+static 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 . . . .
- */
+/* 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);
+ 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]);
}
}
@@ -169,33 +147,27 @@ static inline void pred_motion(H264Context * const h, int n, int part_width, int
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static 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 ];
+static 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];
+ 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);
- if(left_ref == ref)
- {
- *mx = A[0];
- *my = A[1];
+ if(left_ref == ref){
+ *mx= A[0];
+ *my= A[1];
return;
}
}
@@ -210,35 +182,29 @@ static inline void pred_16x8_motion(H264Context * const h, int n, int list, int
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static 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 ];
+static 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];
+ if(left_ref == ref){
+ *mx= A[0];
+ *my= A[1];
return;
}
- }
- else
- {
+ }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);
- if(diagonal_ref == ref)
- {
- *mx = C[0];
- *my = C[1];
+ if(diagonal_ref == ref){
+ *mx= C[0];
+ *my= C[1];
return;
}
}
@@ -247,17 +213,15 @@ static inline void pred_8x16_motion(H264Context * const h, int n, int list, int
pred_motion(h, n, 2, list, ref, mx, my);
}
-static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my)
-{
+static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my){
const int top_ref = h->ref_cache[0][ scan8[0] - 8 ];
- const int left_ref = h->ref_cache[0][ scan8[0] - 1 ];
+ const int left_ref= h->ref_cache[0][ scan8[0] - 1 ];
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(top_ref == PART_NOT_AVAILABLE || left_ref == PART_NOT_AVAILABLE
- || !(top_ref | *(uint32_t*)h->mv_cache[0][ scan8[0] - 8 ])
- || !(left_ref | *(uint32_t*)h->mv_cache[0][ scan8[0] - 1 ]))
- {
+ || !( top_ref | *(uint32_t*)h->mv_cache[0][ scan8[0] - 8 ])
+ || !(left_ref | *(uint32_t*)h->mv_cache[0][ scan8[0] - 1 ])){
*mx = *my = 0;
return;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_parser.c
index 4961492c2..08cb8f9fb 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_parser.c
@@ -40,78 +40,62 @@ int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
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)
- state = 7;
+ state= pc->state;
+ if(state>13)
+ state= 7;
- for(i = 0; i < buf_size; i++)
- {
- if(state == 7)
- {
+ for(i=0; i<buf_size; i++){
+ if(state==7){
#if HAVE_FAST_UNALIGNED
- /* we check i<buf_size instead of i+3/7 because its simpler
- * and there should be FF_INPUT_BUFFER_PADDING_SIZE bytes at the end
- */
+ /* we check i<buf_size instead of i+3/7 because its simpler
+ * and there should be FF_INPUT_BUFFER_PADDING_SIZE bytes at the end
+ */
# if HAVE_FAST_64BIT
- while(i < buf_size && !((~*(const uint64_t*)(buf + i) & (*(const uint64_t*)(buf + i) - 0x0101010101010101ULL)) & 0x8080808080808080ULL))
- i += 8;
+ while(i<buf_size && !((~*(const uint64_t*)(buf+i) & (*(const uint64_t*)(buf+i) - 0x0101010101010101ULL)) & 0x8080808080808080ULL))
+ i+=8;
# else
- while(i < buf_size && !((~*(const uint32_t*)(buf + i) & (*(const uint32_t*)(buf + i) - 0x01010101U)) & 0x80808080U))
- i += 4;
+ while(i<buf_size && !((~*(const uint32_t*)(buf+i) & (*(const uint32_t*)(buf+i) - 0x01010101U)) & 0x80808080U))
+ i+=4;
# endif
#endif
- for(; i < buf_size; i++)
- {
- if(!buf[i])
- {
- state = 2;
+ for(; i<buf_size; i++){
+ if(!buf[i]){
+ state=2;
break;
}
}
- }
- else if(state <= 2)
- {
- if(buf[i] == 1) state ^= 5; //2->7, 1->4, 0->5
+ }else if(state<=2){
+ if(buf[i]==1) state^= 5; //2->7, 1->4, 0->5
else if(buf[i]) state = 7;
- else state >>= 1; //2->1, 1->0, 0->0
- }
- else if(state <= 5)
- {
- int v = buf[i] & 0x1F;
- if(v == 6 || v == 7 || v == 8 || v == 9)
- {
- if(pc->frame_start_found)
- {
+ else state>>=1; //2->1, 1->0, 0->0
+ }else if(state<=5){
+ int v= buf[i] & 0x1F;
+ if(v==6 || v==7 || v==8 || v==9){
+ if(pc->frame_start_found){
i++;
goto found;
}
- }
- else if(v == 1 || v == 2 || v == 5)
- {
- if(pc->frame_start_found)
- {
- state += 8;
+ }else if(v==1 || v==2 || v==5){
+ if(pc->frame_start_found){
+ state+=8;
continue;
- }
- else
+ }else
pc->frame_start_found = 1;
}
- state = 7;
- }
- else
- {
+ state= 7;
+ }else{
if(buf[i] & 0x80)
goto found;
- state = 7;
+ state= 7;
}
}
- pc->state = state;
+ pc->state= state;
return END_NOT_FOUND;
found:
- pc->state = 7;
- pc->frame_start_found = 0;
- return i - (state & 5);
+ pc->state=7;
+ pc->frame_start_found= 0;
+ return i-(state&5);
}
/*!
@@ -137,36 +121,33 @@ static inline int parse_nal_units(AVCodecParserContext *s,
s->pict_type = FF_I_TYPE;
s->key_frame = 0;
- h->s.avctx = avctx;
+ h->s.avctx= avctx;
h->sei_recovery_frame_cnt = -1;
h->sei_dpb_output_delay = 0;
h->sei_cpb_removal_delay = -1;
h->sei_buffering_period_present = 0;
- for(;;)
- {
+ for(;;) {
int src_length, dst_length, consumed;
buf = ff_find_start_code(buf, buf_end, &state);
if(buf >= buf_end)
break;
--buf;
src_length = buf_end - buf;
- switch(state & 0x1f)
- {
+ switch (state & 0x1f) {
case NAL_SLICE:
case NAL_IDR_SLICE:
// Do not walk the whole buffer just to decode slice header
- if(src_length > 20)
+ if (src_length > 20)
src_length = 20;
break;
}
- ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
- if(ptr == NULL || dst_length < 0)
+ ptr= ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
+ if (ptr==NULL || dst_length < 0)
break;
- init_get_bits(&h->s.gb, ptr, 8 * dst_length);
- switch(h->nal_unit_type)
- {
+ init_get_bits(&h->s.gb, ptr, 8*dst_length);
+ switch(h->nal_unit_type) {
case NAL_SPS:
ff_h264_decode_seq_parameter_set(h);
break;
@@ -183,77 +164,63 @@ static inline int parse_nal_units(AVCodecParserContext *s,
get_ue_golomb(&h->s.gb); // skip first_mb_in_slice
slice_type = get_ue_golomb_31(&h->s.gb);
s->pict_type = golomb_to_pict_type[slice_type % 5];
- if(h->sei_recovery_frame_cnt >= 0)
- {
+ if (h->sei_recovery_frame_cnt >= 0) {
/* key frame, since recovery_frame_cnt is set */
s->key_frame = 1;
}
- pps_id = get_ue_golomb(&h->s.gb);
- if(pps_id >= MAX_PPS_COUNT)
- {
+ pps_id= get_ue_golomb(&h->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(!h->pps_buffers[pps_id])
- {
+ if(!h->pps_buffers[pps_id]) {
av_log(h->s.avctx, AV_LOG_ERROR, "non-existing PPS referenced\n");
return -1;
}
- h->pps = *h->pps_buffers[pps_id];
- if(!h->sps_buffers[h->pps.sps_id])
- {
+ h->pps= *h->pps_buffers[pps_id];
+ if(!h->sps_buffers[h->pps.sps_id]) {
av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS referenced\n");
return -1;
}
h->sps = *h->sps_buffers[h->pps.sps_id];
h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num);
- if(h->sps.frame_mbs_only_flag)
- {
- h->s.picture_structure = PICT_FRAME;
- }
- else
- {
- if(get_bits1(&h->s.gb)) //field_pic_flag
- {
- h->s.picture_structure = PICT_TOP_FIELD + get_bits1(&h->s.gb); //bottom_field_flag
- }
- else
- {
- h->s.picture_structure = PICT_FRAME;
+ if(h->sps.frame_mbs_only_flag){
+ h->s.picture_structure= PICT_FRAME;
+ }else{
+ if(get_bits1(&h->s.gb)) { //field_pic_flag
+ h->s.picture_structure= PICT_TOP_FIELD + get_bits1(&h->s.gb); //bottom_field_flag
+ } else {
+ h->s.picture_structure= PICT_FRAME;
}
}
- if(h->sps.pic_struct_present_flag)
- {
- switch(h->sei_pic_struct)
- {
- case SEI_PIC_STRUCT_TOP_FIELD:
- case SEI_PIC_STRUCT_BOTTOM_FIELD:
- s->repeat_pict = -1;
- break;
- case SEI_PIC_STRUCT_FRAME:
- case SEI_PIC_STRUCT_TOP_BOTTOM:
- case SEI_PIC_STRUCT_BOTTOM_TOP:
- s->repeat_pict = 0;
- break;
- case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
- case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
- s->repeat_pict = 1;
- break;
- case SEI_PIC_STRUCT_FRAME_DOUBLING:
- s->repeat_pict = 2;
- break;
- case SEI_PIC_STRUCT_FRAME_TRIPLING:
- s->repeat_pict = 4;
- break;
- default:
- s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 0 : -1;
- break;
+ if(h->sps.pic_struct_present_flag) {
+ switch (h->sei_pic_struct) {
+ case SEI_PIC_STRUCT_TOP_FIELD:
+ case SEI_PIC_STRUCT_BOTTOM_FIELD:
+ s->repeat_pict = -1;
+ break;
+ case SEI_PIC_STRUCT_FRAME:
+ case SEI_PIC_STRUCT_TOP_BOTTOM:
+ case SEI_PIC_STRUCT_BOTTOM_TOP:
+ s->repeat_pict = 0;
+ break;
+ case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
+ case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
+ s->repeat_pict = 1;
+ break;
+ case SEI_PIC_STRUCT_FRAME_DOUBLING:
+ s->repeat_pict = 2;
+ break;
+ case SEI_PIC_STRUCT_FRAME_TRIPLING:
+ s->repeat_pict = 4;
+ break;
+ default:
+ s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 0 : -1;
+ break;
}
- }
- else
- {
+ } else {
s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 0 : -1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_ps.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_ps.c
index c3f7914c0..7fe8f0f08 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_ps.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_ps.c
@@ -36,89 +36,78 @@
//#undef NDEBUG
#include <assert.h>
-static const AVRational pixel_aspect[17] =
-{
- {0, 1},
- {1, 1},
- {12, 11},
- {10, 11},
- {16, 11},
- {40, 33},
- {24, 11},
- {20, 11},
- {32, 11},
- {80, 33},
- {18, 11},
- {15, 11},
- {64, 33},
- {160, 99},
- {4, 3},
- {3, 2},
- {2, 1},
+static const AVRational pixel_aspect[17]={
+ {0, 1},
+ {1, 1},
+ {12, 11},
+ {10, 11},
+ {16, 11},
+ {40, 33},
+ {24, 11},
+ {20, 11},
+ {32, 11},
+ {80, 33},
+ {18, 11},
+ {15, 11},
+ {64, 33},
+ {160,99},
+ {4, 3},
+ {3, 2},
+ {2, 1},
};
-const uint8_t ff_h264_chroma_qp[52] =
-{
- 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, 29, 30, 31, 32, 32, 33, 34, 34, 35, 35, 36, 36, 37, 37,
- 37, 38, 38, 38, 39, 39, 39, 39
-};
-
-static const uint8_t default_scaling4[2][16] =
-{
- {
- 6, 13, 20, 28,
- 13, 20, 28, 32,
- 20, 28, 32, 37,
- 28, 32, 37, 42
- }, {
- 10, 14, 20, 24,
- 14, 20, 24, 27,
- 20, 24, 27, 30,
- 24, 27, 30, 34
- }
-};
-
-static const uint8_t default_scaling8[2][64] =
-{
- {
- 6, 10, 13, 16, 18, 23, 25, 27,
- 10, 11, 16, 18, 23, 25, 27, 29,
- 13, 16, 18, 23, 25, 27, 29, 31,
- 16, 18, 23, 25, 27, 29, 31, 33,
- 18, 23, 25, 27, 29, 31, 33, 36,
- 23, 25, 27, 29, 31, 33, 36, 38,
- 25, 27, 29, 31, 33, 36, 38, 40,
- 27, 29, 31, 33, 36, 38, 40, 42
- }, {
- 9, 13, 15, 17, 19, 21, 22, 24,
- 13, 13, 17, 19, 21, 22, 24, 25,
- 15, 17, 19, 21, 22, 24, 25, 27,
- 17, 19, 21, 22, 24, 25, 27, 28,
- 19, 21, 22, 24, 25, 27, 28, 30,
- 21, 22, 24, 25, 27, 28, 30, 32,
- 22, 24, 25, 27, 28, 30, 32, 33,
- 24, 25, 27, 28, 30, 32, 33, 35
- }
+const uint8_t ff_h264_chroma_qp[52]={
+ 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,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
+ 37,38,38,38,39,39,39,39
};
-static inline int decode_hrd_parameters(H264Context *h, SPS *sps)
-{
+static const uint8_t default_scaling4[2][16]={
+{ 6,13,20,28,
+ 13,20,28,32,
+ 20,28,32,37,
+ 28,32,37,42
+},{
+ 10,14,20,24,
+ 14,20,24,27,
+ 20,24,27,30,
+ 24,27,30,34
+}};
+
+static const uint8_t default_scaling8[2][64]={
+{ 6,10,13,16,18,23,25,27,
+ 10,11,16,18,23,25,27,29,
+ 13,16,18,23,25,27,29,31,
+ 16,18,23,25,27,29,31,33,
+ 18,23,25,27,29,31,33,36,
+ 23,25,27,29,31,33,36,38,
+ 25,27,29,31,33,36,38,40,
+ 27,29,31,33,36,38,40,42
+},{
+ 9,13,15,17,19,21,22,24,
+ 13,13,17,19,21,22,24,25,
+ 15,17,19,21,22,24,25,27,
+ 17,19,21,22,24,25,27,28,
+ 19,21,22,24,25,27,28,30,
+ 21,22,24,25,27,28,30,32,
+ 22,24,25,27,28,30,32,33,
+ 24,25,27,28,30,32,33,35
+}};
+
+static inline int decode_hrd_parameters(H264Context *h, SPS *sps){
MpegEncContext * const s = &h->s;
int cpb_count, i;
cpb_count = get_ue_golomb_31(&s->gb) + 1;
- if(cpb_count > 32U)
- {
+ if(cpb_count > 32U){
av_log(h->s.avctx, AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count);
return -1;
}
get_bits(&s->gb, 4); /* bit_rate_scale */
get_bits(&s->gb, 4); /* cpb_size_scale */
- for(i = 0; i < cpb_count; i++)
- {
+ for(i=0; i<cpb_count; i++){
get_ue_golomb(&s->gb); /* bit_rate_value_minus1 */
get_ue_golomb(&s->gb); /* cpb_size_value_minus1 */
get_bits1(&s->gb); /* cbr_flag */
@@ -131,78 +120,63 @@ static inline int decode_hrd_parameters(H264Context *h, SPS *sps)
return 0;
}
-static inline int decode_vui_parameters(H264Context *h, SPS *sps)
-{
+static inline int decode_vui_parameters(H264Context *h, SPS *sps){
MpegEncContext * const s = &h->s;
int aspect_ratio_info_present_flag;
unsigned int aspect_ratio_idc;
- aspect_ratio_info_present_flag = get_bits1(&s->gb);
+ aspect_ratio_info_present_flag= get_bits1(&s->gb);
- if(aspect_ratio_info_present_flag)
- {
- aspect_ratio_idc = get_bits(&s->gb, 8);
- if(aspect_ratio_idc == EXTENDED_SAR)
- {
- sps->sar.num = get_bits(&s->gb, 16);
- sps->sar.den = get_bits(&s->gb, 16);
- }
- else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect))
- {
- sps->sar = pixel_aspect[aspect_ratio_idc];
- }
- else
- {
+ if( aspect_ratio_info_present_flag ) {
+ aspect_ratio_idc= get_bits(&s->gb, 8);
+ if( aspect_ratio_idc == EXTENDED_SAR ) {
+ sps->sar.num= get_bits(&s->gb, 16);
+ sps->sar.den= get_bits(&s->gb, 16);
+ }else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
+ sps->sar= pixel_aspect[aspect_ratio_idc];
+ }else{
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return -1;
}
- }
- else
- {
- sps->sar.num =
- sps->sar.den = 0;
+ }else{
+ sps->sar.num=
+ sps->sar.den= 0;
}
// s->avctx->aspect_ratio= sar_width*s->width / (float)(s->height*sar_height);
- if(get_bits1(&s->gb)) /* overscan_info_present_flag */
- {
+ if(get_bits1(&s->gb)){ /* overscan_info_present_flag */
get_bits1(&s->gb); /* overscan_appropriate_flag */
}
sps->video_signal_type_present_flag = get_bits1(&s->gb);
- if(sps->video_signal_type_present_flag)
- {
+ if(sps->video_signal_type_present_flag){
get_bits(&s->gb, 3); /* video_format */
sps->full_range = get_bits1(&s->gb); /* video_full_range_flag */
sps->colour_description_present_flag = get_bits1(&s->gb);
- if(sps->colour_description_present_flag)
- {
+ if(sps->colour_description_present_flag){
sps->color_primaries = get_bits(&s->gb, 8); /* colour_primaries */
sps->color_trc = get_bits(&s->gb, 8); /* transfer_characteristics */
sps->colorspace = get_bits(&s->gb, 8); /* matrix_coefficients */
- if(sps->color_primaries >= AVCOL_PRI_NB)
+ if (sps->color_primaries >= AVCOL_PRI_NB)
sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
- if(sps->color_trc >= AVCOL_TRC_NB)
+ if (sps->color_trc >= AVCOL_TRC_NB)
sps->color_trc = AVCOL_TRC_UNSPECIFIED;
- if(sps->colorspace >= AVCOL_SPC_NB)
+ if (sps->colorspace >= AVCOL_SPC_NB)
sps->colorspace = AVCOL_SPC_UNSPECIFIED;
}
}
- if(get_bits1(&s->gb)) /* chroma_location_info_present_flag */
- {
- s->avctx->chroma_sample_location = get_ue_golomb(&s->gb) + 1; /* chroma_sample_location_type_top_field */
+ if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */
+ s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_sample_location_type_top_field */
get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */
}
sps->timing_info_present_flag = get_bits1(&s->gb);
- if(sps->timing_info_present_flag)
- {
+ if(sps->timing_info_present_flag){
sps->num_units_in_tick = get_bits_long(&s->gb, 32);
sps->time_scale = get_bits_long(&s->gb, 32);
- if(sps->num_units_in_tick - 1 > 0x7FFFFFFEU || sps->time_scale - 1 > 0x7FFFFFFEU)
- {
+ if(sps->num_units_in_tick-1 > 0x7FFFFFFEU || sps->time_scale-1 > 0x7FFFFFFEU){
av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
return -1;
}
@@ -222,18 +196,16 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
sps->pic_struct_present_flag = get_bits1(&s->gb);
sps->bitstream_restriction_flag = get_bits1(&s->gb);
- if(sps->bitstream_restriction_flag)
- {
+ if(sps->bitstream_restriction_flag){
get_bits1(&s->gb); /* motion_vectors_over_pic_boundaries_flag */
get_ue_golomb(&s->gb); /* max_bytes_per_pic_denom */
get_ue_golomb(&s->gb); /* max_bits_per_mb_denom */
get_ue_golomb(&s->gb); /* log2_max_mv_length_horizontal */
get_ue_golomb(&s->gb); /* log2_max_mv_length_vertical */
- sps->num_reorder_frames = get_ue_golomb(&s->gb);
+ sps->num_reorder_frames= get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb); /*max_dec_frame_buffering*/
- if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/)
- {
+ if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
return -1;
}
@@ -243,84 +215,75 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
}
static void decode_scaling_list(H264Context *h, uint8_t *factors, int size,
- const uint8_t *jvt_list, const uint8_t *fallback_list)
-{
+ const uint8_t *jvt_list, const uint8_t *fallback_list){
MpegEncContext * const s = &h->s;
int i, last = 8, next = 8;
const uint8_t *scan = size == 16 ? zigzag_scan : ff_zigzag_direct;
if(!get_bits1(&s->gb)) /* matrix not written, we use the predicted one */
- memcpy(factors, fallback_list, size * sizeof(uint8_t));
+ memcpy(factors, fallback_list, size*sizeof(uint8_t));
else
- for(i = 0; i < size; i++)
- {
- if(next)
- next = (last + get_se_golomb(&s->gb)) & 0xff;
- if(!i && !next) /* matrix not written, we use the preset one */
- {
- memcpy(factors, jvt_list, size * sizeof(uint8_t));
- break;
- }
- last = factors[scan[i]] = next ? next : last;
+ for(i=0;i<size;i++){
+ if(next)
+ next = (last + get_se_golomb(&s->gb)) & 0xff;
+ if(!i && !next){ /* matrix not written, we use the preset one */
+ memcpy(factors, jvt_list, size*sizeof(uint8_t));
+ break;
}
+ last = factors[scan[i]] = next ? next : last;
+ }
}
static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_sps,
- uint8_t (*scaling_matrix4)[16], uint8_t (*scaling_matrix8)[64])
-{
+ uint8_t (*scaling_matrix4)[16], uint8_t (*scaling_matrix8)[64]){
MpegEncContext * const s = &h->s;
int fallback_sps = !is_sps && sps->scaling_matrix_present;
- const uint8_t *fallback[4] =
- {
+ const uint8_t *fallback[4] = {
fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
fallback_sps ? sps->scaling_matrix8[1] : default_scaling8[1]
};
- if(get_bits1(&s->gb))
- {
+ if(get_bits1(&s->gb)){
sps->scaling_matrix_present |= is_sps;
- decode_scaling_list(h, scaling_matrix4[0], 16, default_scaling4[0], fallback[0]); // Intra, Y
- decode_scaling_list(h, scaling_matrix4[1], 16, default_scaling4[0], scaling_matrix4[0]); // Intra, Cr
- decode_scaling_list(h, scaling_matrix4[2], 16, default_scaling4[0], scaling_matrix4[1]); // Intra, Cb
- decode_scaling_list(h, scaling_matrix4[3], 16, default_scaling4[1], fallback[1]); // Inter, Y
- decode_scaling_list(h, scaling_matrix4[4], 16, default_scaling4[1], scaling_matrix4[3]); // Inter, Cr
- decode_scaling_list(h, scaling_matrix4[5], 16, default_scaling4[1], scaling_matrix4[4]); // Inter, Cb
- if(is_sps || pps->transform_8x8_mode)
- {
- decode_scaling_list(h, scaling_matrix8[0], 64, default_scaling8[0], fallback[2]); // Intra, Y
- decode_scaling_list(h, scaling_matrix8[1], 64, default_scaling8[1], fallback[3]); // Inter, Y
+ decode_scaling_list(h,scaling_matrix4[0],16,default_scaling4[0],fallback[0]); // Intra, Y
+ decode_scaling_list(h,scaling_matrix4[1],16,default_scaling4[0],scaling_matrix4[0]); // Intra, Cr
+ decode_scaling_list(h,scaling_matrix4[2],16,default_scaling4[0],scaling_matrix4[1]); // Intra, Cb
+ decode_scaling_list(h,scaling_matrix4[3],16,default_scaling4[1],fallback[1]); // Inter, Y
+ decode_scaling_list(h,scaling_matrix4[4],16,default_scaling4[1],scaling_matrix4[3]); // Inter, Cr
+ decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
+ if(is_sps || pps->transform_8x8_mode){
+ decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y
+ decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[1],fallback[3]); // Inter, Y
}
}
}
-int ff_h264_decode_seq_parameter_set(H264Context *h)
-{
+int ff_h264_decode_seq_parameter_set(H264Context *h){
MpegEncContext * const s = &h->s;
int profile_idc, level_idc;
unsigned int sps_id;
int i;
SPS *sps;
- profile_idc = get_bits(&s->gb, 8);
+ profile_idc= get_bits(&s->gb, 8);
get_bits1(&s->gb); //constraint_set0_flag
get_bits1(&s->gb); //constraint_set1_flag
get_bits1(&s->gb); //constraint_set2_flag
get_bits1(&s->gb); //constraint_set3_flag
get_bits(&s->gb, 4); // reserved
- level_idc = get_bits(&s->gb, 8);
- sps_id = get_ue_golomb_31(&s->gb);
+ level_idc= get_bits(&s->gb, 8);
+ sps_id= get_ue_golomb_31(&s->gb);
- if(sps_id >= MAX_SPS_COUNT)
- {
+ if(sps_id >= MAX_SPS_COUNT) {
av_log(h->s.avctx, AV_LOG_ERROR, "sps_id (%d) out of range\n", sps_id);
return -1;
}
- sps = av_mallocz(sizeof(SPS));
+ sps= av_mallocz(sizeof(SPS));
if(sps == NULL)
return -1;
- sps->profile_idc = profile_idc;
- sps->level_idc = level_idc;
+ sps->profile_idc= profile_idc;
+ sps->level_idc= level_idc;
sps->full_range = VIDEO_FULL_RANGE_INVALID; /* ffdshow custom code */
memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
@@ -334,112 +297,95 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
sps->bit_depth_chroma = 8; // bit_depth_chroma_minus8
sps->residual_color_transform_flag = 0;
// <== End patch MPC
-
- if(sps->profile_idc >= 100) //high profile
- {
- sps->chroma_format_idc = get_ue_golomb_31(&s->gb);
+
+ if(sps->profile_idc >= 100){ //high profile
+ sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
if(sps->chroma_format_idc == 3)
sps->residual_color_transform_flag = get_bits1(&s->gb);
sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8;
sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8;
sps->transform_bypass = get_bits1(&s->gb);
decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
- }
- else
- {
- sps->chroma_format_idc = 1;
+ }else{
+ sps->chroma_format_idc= 1;
sps->bit_depth_luma = 8;
sps->bit_depth_chroma = 8;
}
- sps->log2_max_frame_num = get_ue_golomb(&s->gb) + 4;
- sps->poc_type = get_ue_golomb_31(&s->gb);
+ sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4;
+ sps->poc_type= get_ue_golomb_31(&s->gb);
- if(sps->poc_type == 0) //FIXME #define
- {
- sps->log2_max_poc_lsb = get_ue_golomb(&s->gb) + 4;
- }
- else if(sps->poc_type == 1) //FIXME #define
- {
- sps->delta_pic_order_always_zero_flag = get_bits1(&s->gb);
- sps->offset_for_non_ref_pic = get_se_golomb(&s->gb);
- sps->offset_for_top_to_bottom_field = get_se_golomb(&s->gb);
+ if(sps->poc_type == 0){ //FIXME #define
+ sps->log2_max_poc_lsb= get_ue_golomb(&s->gb) + 4;
+ } else if(sps->poc_type == 1){//FIXME #define
+ sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb);
+ sps->offset_for_non_ref_pic= get_se_golomb(&s->gb);
+ sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
sps->poc_cycle_length = get_ue_golomb(&s->gb);
- if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame))
- {
+ if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", sps->poc_cycle_length);
goto fail;
}
- for(i = 0; i < sps->poc_cycle_length; i++)
- sps->offset_for_ref_frame[i] = get_se_golomb(&s->gb);
- }
- else if(sps->poc_type != 2)
- {
+ for(i=0; i<sps->poc_cycle_length; i++)
+ sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb);
+ }else if(sps->poc_type != 2){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
goto fail;
}
- sps->ref_frame_count = get_ue_golomb_31(&s->gb);
- if(sps->ref_frame_count > MAX_PICTURE_COUNT - 2 || sps->ref_frame_count >= 32U)
- {
+ sps->ref_frame_count= get_ue_golomb_31(&s->gb);
+ if(sps->ref_frame_count > MAX_PICTURE_COUNT-2 || sps->ref_frame_count >= 32U){
av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n");
goto fail;
}
- sps->gaps_in_frame_num_allowed_flag = get_bits1(&s->gb);
+ sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb);
sps->mb_width = get_ue_golomb(&s->gb) + 1;
- sps->mb_height = get_ue_golomb(&s->gb) + 1;
- if((unsigned)sps->mb_width >= INT_MAX / 16 || (unsigned)sps->mb_height >= INT_MAX / 16 ||
- avcodec_check_dimensions(NULL, 16 * sps->mb_width, 16 * sps->mb_height))
- {
+ sps->mb_height= get_ue_golomb(&s->gb) + 1;
+ if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 ||
+ avcodec_check_dimensions(NULL, 16*sps->mb_width, 16*sps->mb_height)){
av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
goto fail;
}
- sps->frame_mbs_only_flag = get_bits1(&s->gb);
+ sps->frame_mbs_only_flag= get_bits1(&s->gb);
if(!sps->frame_mbs_only_flag)
- sps->mb_aff = get_bits1(&s->gb);
+ sps->mb_aff= get_bits1(&s->gb);
else
- sps->mb_aff = 0;
+ sps->mb_aff= 0;
- sps->direct_8x8_inference_flag = get_bits1(&s->gb);
+ sps->direct_8x8_inference_flag= get_bits1(&s->gb);
#ifndef ALLOW_INTERLACE
if(sps->mb_aff)
av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n");
#endif
- sps->crop = get_bits1(&s->gb);
- if(sps->crop)
- {
+ sps->crop= get_bits1(&s->gb);
+ if(sps->crop){
sps->crop_left = get_ue_golomb(&s->gb);
sps->crop_right = get_ue_golomb(&s->gb);
sps->crop_top = get_ue_golomb(&s->gb);
- sps->crop_bottom = get_ue_golomb(&s->gb);
- if(sps->crop_left || sps->crop_top)
- {
+ sps->crop_bottom= get_ue_golomb(&s->gb);
+ if(sps->crop_left || sps->crop_top){
av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
}
- if(sps->crop_right >= 8 || sps->crop_bottom >= (8 >> !sps->frame_mbs_only_flag))
- {
+ if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){
av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
}
- }
- else
- {
+ }else{
sps->crop_left =
- sps->crop_right =
- sps->crop_top =
- sps->crop_bottom = 0;
+ sps->crop_right =
+ sps->crop_top =
+ sps->crop_bottom= 0;
}
- sps->vui_parameters_present_flag = get_bits1(&s->gb);
- if(sps->vui_parameters_present_flag)
- if(decode_vui_parameters(h, sps) < 0)
+ sps->vui_parameters_present_flag= get_bits1(&s->gb);
+ if( sps->vui_parameters_present_flag )
+ if (decode_vui_parameters(h, sps) < 0)
goto fail;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
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,
@@ -450,20 +396,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" : "",
-#if __STDC_VERSION__ >= 199901L
- ((const char*[])
- {"Gray", "420", "422", "444"
- })[sps->chroma_format_idc],
-#else
+ #if __STDC_VERSION__ >= 199901L
+ ((const char*[]){"Gray","420","422","444"})[sps->chroma_format_idc],
+ #else
"",
-#endif
+ #endif
sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
sps->timing_info_present_flag ? sps->time_scale : 0
- );
+ );
}
av_free(h->sps_buffers[sps_id]);
- h->sps_buffers[sps_id] = sps;
+ h->sps_buffers[sps_id]= sps;
h->sps = *sps;
return 0;
fail:
@@ -479,115 +423,104 @@ build_qp_table(PPS *pps, int t, int index)
pps->chroma_qp_table[t][i] = ff_h264_chroma_qp[av_clip(i + index, 0, 51)];
}
-int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
-{
+int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
MpegEncContext * const s = &h->s;
- unsigned int pps_id = get_ue_golomb(&s->gb);
+ unsigned int pps_id= get_ue_golomb(&s->gb);
PPS *pps;
- if(pps_id >= MAX_PPS_COUNT)
- {
+ if(pps_id >= MAX_PPS_COUNT) {
av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id);
return -1;
}
- pps = av_mallocz(sizeof(PPS));
+ pps= av_mallocz(sizeof(PPS));
if(pps == NULL)
return -1;
- pps->sps_id = get_ue_golomb_31(&s->gb);
- if((unsigned)pps->sps_id >= MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL)
- {
+ pps->sps_id= get_ue_golomb_31(&s->gb);
+ if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){
av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n");
goto fail;
}
- pps->cabac = get_bits1(&s->gb);
- pps->pic_order_present = get_bits1(&s->gb);
- pps->slice_group_count = get_ue_golomb(&s->gb) + 1;
- if(pps->slice_group_count > 1)
- {
- pps->mb_slice_group_map_type = get_ue_golomb(&s->gb);
+ pps->cabac= get_bits1(&s->gb);
+ pps->pic_order_present= get_bits1(&s->gb);
+ pps->slice_group_count= get_ue_golomb(&s->gb) + 1;
+ if(pps->slice_group_count > 1 ){
+ pps->mb_slice_group_map_type= get_ue_golomb(&s->gb);
av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n");
- switch(pps->mb_slice_group_map_type)
- {
+ switch(pps->mb_slice_group_map_type){
case 0:
#if 0
- | for(i = 0; i <= num_slice_groups_minus1; i++) | | |
- | run_length[ i ] | 1 | ue(v) |
+| for( i = 0; i <= num_slice_groups_minus1; i++ ) | | |
+| run_length[ i ] |1 |ue(v) |
#endif
- break;
+ break;
case 2:
#if 0
- | for(i = 0; i < num_slice_groups_minus1; i++) | | |
- | { | | |
- | top_left_mb[ i ] | 1 | ue(v) |
- | bottom_right_mb[ i ] | 1 | ue(v) |
- |
- } | | |
+| for( i = 0; i < num_slice_groups_minus1; i++ ) | | |
+|{ | | |
+| top_left_mb[ i ] |1 |ue(v) |
+| bottom_right_mb[ i ] |1 |ue(v) |
+| } | | |
#endif
- break;
+ break;
case 3:
case 4:
case 5:
#if 0
- | slice_group_change_direction_flag | 1 | u(1) |
- | slice_group_change_rate_minus1 | 1 | ue(v) |
+| slice_group_change_direction_flag |1 |u(1) |
+| slice_group_change_rate_minus1 |1 |ue(v) |
#endif
- // ==> Start patch MPC
- pps->slice_group_change_direction_flag = get_bits1(&s->gb); // |1 |u(1) |
- pps->slice_group_change_rate_minus1 = get_ue_golomb(&s->gb); // |1 |ue(v) |
- // <== End patch MPC
+ // ==> Start patch MPC
+ pps->slice_group_change_direction_flag=get_bits1(&s->gb); // |1 |u(1) |
+ pps->slice_group_change_rate_minus1=get_ue_golomb(&s->gb); // |1 |ue(v) |
+ // <== End patch MPC
break;
case 6:
#if 0
- | slice_group_id_cnt_minus1 | 1 | ue(v) |
- | for(i = 0; i <= slice_group_id_cnt_minus1; i++ | | |
- |) | | |
- | slice_group_id[ i ] | 1 | u(v) |
+| slice_group_id_cnt_minus1 |1 |ue(v) |
+| for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | |
+|) | | |
+| slice_group_id[ i ] |1 |u(v) |
#endif
- break;
+ break;
}
}
- pps->ref_count[0] = get_ue_golomb(&s->gb) + 1;
- pps->ref_count[1] = get_ue_golomb(&s->gb) + 1;
- if(pps->ref_count[0] - 1 > 32 - 1 || pps->ref_count[1] - 1 > 32 - 1)
- {
+ pps->ref_count[0]= get_ue_golomb(&s->gb) + 1;
+ pps->ref_count[1]= get_ue_golomb(&s->gb) + 1;
+ if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){
av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n");
goto fail;
}
- pps->weighted_pred = get_bits1(&s->gb);
- pps->weighted_bipred_idc = get_bits(&s->gb, 2);
- pps->init_qp = get_se_golomb(&s->gb) + 26;
- pps->init_qs = get_se_golomb(&s->gb) + 26;
- pps->chroma_qp_index_offset[0] = get_se_golomb(&s->gb);
- pps->deblocking_filter_parameters_present = get_bits1(&s->gb);
- pps->constrained_intra_pred = get_bits1(&s->gb);
+ pps->weighted_pred= get_bits1(&s->gb);
+ pps->weighted_bipred_idc= get_bits(&s->gb, 2);
+ pps->init_qp= get_se_golomb(&s->gb) + 26;
+ pps->init_qs= get_se_golomb(&s->gb) + 26;
+ pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb);
+ pps->deblocking_filter_parameters_present= get_bits1(&s->gb);
+ pps->constrained_intra_pred= get_bits1(&s->gb);
pps->redundant_pic_cnt_present = get_bits1(&s->gb);
- pps->transform_8x8_mode = 0;
- h->dequant_coeff_pps = -1; //contents of sps/pps can change even if id doesn't, so reinit
+ pps->transform_8x8_mode= 0;
+ h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit
memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4));
memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8));
- if(get_bits_count(&s->gb) < bit_length)
- {
- pps->transform_8x8_mode = get_bits1(&s->gb);
+ if(get_bits_count(&s->gb) < bit_length){
+ pps->transform_8x8_mode= get_bits1(&s->gb);
decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8);
- pps->chroma_qp_index_offset[1] = get_se_golomb(&s->gb); //second_chroma_qp_index_offset
- }
- else
- {
- pps->chroma_qp_index_offset[1] = pps->chroma_qp_index_offset[0];
+ pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); //second_chroma_qp_index_offset
+ } else {
+ pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0];
}
build_qp_table(pps, 0, pps->chroma_qp_index_offset[0]);
build_qp_table(pps, 1, pps->chroma_qp_index_offset[1]);
if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1])
- pps->chroma_qp_diff = 1;
+ pps->chroma_qp_diff= 1;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n",
pps_id, pps->sps_id,
pps->cabac ? "CABAC" : "CAVLC",
@@ -599,11 +532,11 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
pps->constrained_intra_pred ? "CONSTR" : "",
pps->redundant_pic_cnt_present ? "REDU" : "",
pps->transform_8x8_mode ? "8x8DCT" : ""
- );
+ );
}
av_free(h->pps_buffers[pps_id]);
- h->pps_buffers[pps_id] = pps;
+ h->pps_buffers[pps_id]= pps;
return 0;
fail:
av_free(pps);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_refs.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_refs.c
index 6349165b6..183f01526 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_refs.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_refs.c
@@ -35,29 +35,24 @@
#include <assert.h>
-static void pic_as_field(Picture *pic, const int parity)
-{
+static void pic_as_field(Picture *pic, const int parity){
int i;
- for(i = 0; i < 4; ++i)
- {
- if(parity == PICT_BOTTOM_FIELD)
+ for (i = 0; i < 4; ++i) {
+ if (parity == PICT_BOTTOM_FIELD)
pic->data[i] += pic->linesize[i];
pic->reference = parity;
pic->linesize[i] *= 2;
}
- pic->poc = pic->field_poc[parity == PICT_BOTTOM_FIELD];
+ pic->poc= pic->field_poc[parity == PICT_BOTTOM_FIELD];
}
static int split_field_copy(Picture *dest, Picture *src,
- int parity, int id_add)
-{
+ int parity, int id_add){
int match = !!(src->reference & parity);
- if(match)
- {
+ if (match) {
*dest = *src;
- if(parity != PICT_FRAME)
- {
+ if(parity != PICT_FRAME){
pic_as_field(dest, parity);
dest->pic_id *= 2;
dest->pic_id += id_add;
@@ -67,111 +62,94 @@ static int split_field_copy(Picture *dest, Picture *src,
return match;
}
-static int build_def_list(Picture *def, Picture **in, int len, int is_long, int sel)
-{
- int i[2] = {0};
- int index = 0;
+static int build_def_list(Picture *def, Picture **in, int len, int is_long, int sel){
+ int i[2]={0};
+ int index=0;
- while(i[0] < len || i[1] < len)
- {
- while(i[0] < len && !(in[ i[0] ] && (in[ i[0] ]->reference & sel)))
+ while(i[0]<len || i[1]<len){
+ while(i[0]<len && !(in[ i[0] ] && (in[ i[0] ]->reference & sel)))
i[0]++;
- while(i[1] < len && !(in[ i[1] ] && (in[ i[1] ]->reference & (sel ^ 3))))
+ while(i[1]<len && !(in[ i[1] ] && (in[ i[1] ]->reference & (sel^3))))
i[1]++;
- if(i[0] < len)
- {
- in[ i[0] ]->pic_id = is_long ? i[0] : in[ i[0] ]->frame_num;
+ if(i[0] < len){
+ in[ i[0] ]->pic_id= is_long ? i[0] : in[ i[0] ]->frame_num;
split_field_copy(&def[index++], in[ i[0]++ ], sel , 1);
}
- if(i[1] < len)
- {
- in[ i[1] ]->pic_id = is_long ? i[1] : in[ i[1] ]->frame_num;
- split_field_copy(&def[index++], in[ i[1]++ ], sel ^ 3, 0);
+ if(i[1] < len){
+ in[ i[1] ]->pic_id= is_long ? i[1] : in[ i[1] ]->frame_num;
+ split_field_copy(&def[index++], in[ i[1]++ ], sel^3, 0);
}
}
return index;
}
-static int add_sorted(Picture **sorted, Picture **src, int len, int limit, int dir)
-{
+static int add_sorted(Picture **sorted, Picture **src, int len, int limit, int dir){
int i, best_poc;
- int out_i = 0;
-
- for(;;)
- {
- best_poc = dir ? INT_MIN : INT_MAX;
-
- for(i = 0; i < len; i++)
- {
- const int poc = src[i]->poc;
- if(((poc > limit) ^ dir) && ((poc < best_poc) ^ dir))
- {
- best_poc = poc;
- sorted[out_i] = src[i];
+ int out_i= 0;
+
+ for(;;){
+ best_poc= dir ? INT_MIN : INT_MAX;
+
+ for(i=0; i<len; i++){
+ const int poc= src[i]->poc;
+ if(((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)){
+ best_poc= poc;
+ sorted[out_i]= src[i];
}
}
if(best_poc == (dir ? INT_MIN : INT_MAX))
break;
- limit = sorted[out_i++]->poc - dir;
+ limit= sorted[out_i++]->poc - dir;
}
return out_i;
}
-int ff_h264_fill_default_ref_list(H264Context *h)
-{
+int ff_h264_fill_default_ref_list(H264Context *h){
MpegEncContext * const s = &h->s;
int i, len;
- if(h->slice_type_nos == FF_B_TYPE)
- {
+ if(h->slice_type_nos==FF_B_TYPE){
Picture *sorted[32];
int cur_poc, list;
int lens[2];
if(FIELD_PICTURE)
- cur_poc = s->current_picture_ptr->field_poc[ s->picture_structure == PICT_BOTTOM_FIELD ];
+ cur_poc= s->current_picture_ptr->field_poc[ s->picture_structure == PICT_BOTTOM_FIELD ];
else
- cur_poc = s->current_picture_ptr->poc;
+ cur_poc= s->current_picture_ptr->poc;
- for(list = 0; list < 2; list++)
- {
- len = add_sorted(sorted , h->short_ref, h->short_ref_count, cur_poc, 1 ^ list);
- len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list);
- assert(len <= 32);
- len = build_def_list(h->default_ref_list[list] , sorted , len, 0, s->picture_structure);
- len += build_def_list(h->default_ref_list[list] + len, h->long_ref, 16 , 1, s->picture_structure);
- assert(len <= 32);
+ for(list= 0; list<2; list++){
+ len= add_sorted(sorted , h->short_ref, h->short_ref_count, cur_poc, 1^list);
+ len+=add_sorted(sorted+len, h->short_ref, h->short_ref_count, cur_poc, 0^list);
+ assert(len<=32);
+ len= build_def_list(h->default_ref_list[list] , sorted , len, 0, s->picture_structure);
+ len+=build_def_list(h->default_ref_list[list]+len, h->long_ref, 16 , 1, s->picture_structure);
+ assert(len<=32);
if(len < h->ref_count[list])
memset(&h->default_ref_list[list][len], 0, sizeof(Picture)*(h->ref_count[list] - len));
- lens[list] = len;
+ lens[list]= len;
}
- if(lens[0] == lens[1] && lens[1] > 1)
- {
- for(i = 0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0] && i < lens[0]; i++);
+ if(lens[0] == lens[1] && lens[1] > 1){
+ for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0] && i<lens[0]; i++);
if(i == lens[0])
FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]);
}
- }
- else
- {
+ }else{
len = build_def_list(h->default_ref_list[0] , h->short_ref, h->short_ref_count, 0, s->picture_structure);
- len += build_def_list(h->default_ref_list[0] + len, h-> long_ref, 16 , 1, s->picture_structure);
+ len+= build_def_list(h->default_ref_list[0]+len, h-> long_ref, 16 , 1, s->picture_structure);
assert(len <= 32);
if(len < h->ref_count[0])
memset(&h->default_ref_list[0][len], 0, sizeof(Picture)*(h->ref_count[0] - len));
}
#ifdef TRACE
- for(i = 0; i < h->ref_count[0]; i++)
- {
+ 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]);
}
- if(h->slice_type_nos == FF_B_TYPE)
- {
- for(i = 0; i < h->ref_count[1]; i++)
- {
+ if(h->slice_type_nos==FF_B_TYPE){
+ 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]);
}
}
@@ -192,14 +170,12 @@ static void print_long_term(H264Context *h);
* @return frame number (short term) or long term index of picture
* described by pic_num
*/
-static int pic_num_extract(H264Context *h, int pic_num, int *structure)
-{
+static int pic_num_extract(H264Context *h, int pic_num, int *structure){
MpegEncContext * const s = &h->s;
*structure = s->picture_structure;
- if(FIELD_PICTURE)
- {
- if(!(pic_num & 1))
+ if(FIELD_PICTURE){
+ if (!(pic_num & 1))
/* opposite field */
*structure ^= PICT_FRAME;
pic_num >>= 1;
@@ -208,137 +184,111 @@ static int pic_num_extract(H264Context *h, int pic_num, int *structure)
return pic_num;
}
-int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
-{
+int ff_h264_decode_ref_pic_list_reordering(H264Context *h){
MpegEncContext * const s = &h->s;
int list, index, pic_structure;
print_short_term(h);
print_long_term(h);
- for(list = 0; list < h->list_count; list++)
- {
+ for(list=0; list<h->list_count; list++){
memcpy(h->ref_list[list], h->default_ref_list[list], sizeof(Picture)*h->ref_count[list]);
- if(get_bits1(&s->gb))
- {
- int pred = h->curr_pic_num;
+ if(get_bits1(&s->gb)){
+ int pred= h->curr_pic_num;
- for(index = 0; ; index++)
- {
- unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&s->gb);
+ for(index=0; ; index++){
+ unsigned int reordering_of_pic_nums_idc= get_ue_golomb_31(&s->gb);
unsigned int pic_id;
int i;
Picture *ref = NULL;
- if(reordering_of_pic_nums_idc == 3)
+ if(reordering_of_pic_nums_idc==3)
break;
- if(index >= h->ref_count[list])
- {
+ if(index >= h->ref_count[list]){
av_log(h->s.avctx, AV_LOG_ERROR, "reference count overflow\n");
return -1;
}
- if(reordering_of_pic_nums_idc < 3)
- {
- if(reordering_of_pic_nums_idc < 2)
- {
- const unsigned int abs_diff_pic_num = get_ue_golomb(&s->gb) + 1;
+ if(reordering_of_pic_nums_idc<3){
+ if(reordering_of_pic_nums_idc<2){
+ const unsigned int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1;
int frame_num;
- if(abs_diff_pic_num > h->max_pic_num)
- {
+ if(abs_diff_pic_num > h->max_pic_num){
av_log(h->s.avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n");
return -1;
}
- if(reordering_of_pic_nums_idc == 0) pred -= abs_diff_pic_num;
- else pred += abs_diff_pic_num;
+ if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
+ else pred+= abs_diff_pic_num;
pred &= h->max_pic_num - 1;
frame_num = pic_num_extract(h, pred, &pic_structure);
- for(i = h->short_ref_count - 1; i >= 0; i--)
- {
+ for(i= h->short_ref_count-1; i>=0; i--){
ref = h->short_ref[i];
assert(ref->reference);
assert(!ref->long_ref);
if(
- ref->frame_num == frame_num &&
- (ref->reference & pic_structure)
- )
+ ref->frame_num == frame_num &&
+ (ref->reference & pic_structure)
+ )
break;
}
- if(i >= 0)
- ref->pic_id = pred;
- }
- else
- {
+ if(i>=0)
+ ref->pic_id= pred;
+ }else{
int long_idx;
- pic_id = get_ue_golomb(&s->gb); //long_term_pic_idx
+ pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
- long_idx = pic_num_extract(h, pic_id, &pic_structure);
+ long_idx= pic_num_extract(h, pic_id, &pic_structure);
- if(long_idx > 31)
- {
+ if(long_idx>31){
av_log(h->s.avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n");
return -1;
}
ref = h->long_ref[long_idx];
assert(!(ref && !ref->reference));
- if(ref && (ref->reference & pic_structure))
- {
- ref->pic_id = pic_id;
+ if(ref && (ref->reference & pic_structure)){
+ ref->pic_id= pic_id;
assert(ref->long_ref);
- i = 0;
- }
- else
- {
- i = -1;
+ i=0;
+ }else{
+ i=-1;
}
}
- if(i < 0)
- {
+ if (i < 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
- }
- else
- {
- for(i = index; i + 1 < h->ref_count[list]; i++)
- {
+ } else {
+ for(i=index; i+1<h->ref_count[list]; i++){
if(ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id)
break;
}
- for(; i > index; i--)
- {
- h->ref_list[list][i] = h->ref_list[list][i-1];
+ for(; i > index; i--){
+ h->ref_list[list][i]= h->ref_list[list][i-1];
}
- h->ref_list[list][index] = *ref;
- if(FIELD_PICTURE)
- {
+ h->ref_list[list][index]= *ref;
+ if (FIELD_PICTURE){
pic_as_field(&h->ref_list[list][index], pic_structure);
}
}
- }
- else
- {
+ }else{
av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n");
return -1;
}
}
}
}
- for(list = 0; list < h->list_count; list++)
- {
- for(index = 0; index < h->ref_count[list]; index++)
- {
- if(!h->ref_list[list][index].data[0])
- {
+ for(list=0; list<h->list_count; list++){
+ for(index= 0; index < h->ref_count[list]; index++){
+ if(!h->ref_list[list][index].data[0]){
av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture\n");
if(h->default_ref_list[list][0].data[0])
- h->ref_list[list][index] = h->default_ref_list[list][0];
+ h->ref_list[list][index]= h->default_ref_list[list][0];
else
return -1;
}
@@ -348,38 +298,33 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
return 0;
}
-void ff_h264_fill_mbaff_ref_list(H264Context *h)
-{
+void ff_h264_fill_mbaff_ref_list(H264Context *h){
int list, i, j;
- for(list = 0; list < 2; list++) //FIXME try list_count
- {
- for(i = 0; i < h->ref_count[list]; i++)
- {
+ for(list=0; list<2; list++){ //FIXME try list_count
+ for(i=0; i<h->ref_count[list]; i++){
Picture *frame = &h->ref_list[list][i];
Picture *field = &h->ref_list[list][16+2*i];
field[0] = *frame;
- for(j = 0; j < 3; j++)
+ for(j=0; j<3; j++)
field[0].linesize[j] <<= 1;
field[0].reference = PICT_TOP_FIELD;
- field[0].poc = field[0].field_poc[0];
+ field[0].poc= field[0].field_poc[0];
field[1] = field[0];
- for(j = 0; j < 3; j++)
+ for(j=0; j<3; j++)
field[1].data[j] += frame->linesize[j];
field[1].reference = PICT_BOTTOM_FIELD;
- field[1].poc = field[1].field_poc[1];
+ field[1].poc= field[1].field_poc[1];
h->luma_weight[list][16+2*i] = h->luma_weight[list][16+2*i+1] = h->luma_weight[list][i];
h->luma_offset[list][16+2*i] = h->luma_offset[list][16+2*i+1] = h->luma_offset[list][i];
- for(j = 0; j < 2; j++)
- {
+ for(j=0; j<2; j++){
h->chroma_weight[list][16+2*i][j] = h->chroma_weight[list][16+2*i+1][j] = h->chroma_weight[list][i][j];
h->chroma_offset[list][16+2*i][j] = h->chroma_offset[list][16+2*i+1][j] = h->chroma_offset[list][i][j];
}
}
}
- for(j = 0; j < h->ref_count[1]; j++)
- {
- for(i = 0; i < h->ref_count[0]; i++)
+ for(j=0; j<h->ref_count[1]; j++){
+ for(i=0; i<h->ref_count[0]; i++)
h->implicit_weight[j][16+2*i] = h->implicit_weight[j][16+2*i+1] = h->implicit_weight[j][i];
memcpy(h->implicit_weight[16+2*j], h->implicit_weight[j], sizeof(*h->implicit_weight));
memcpy(h->implicit_weight[16+2*j+1], h->implicit_weight[j], sizeof(*h->implicit_weight));
@@ -397,19 +342,14 @@ void ff_h264_fill_mbaff_ref_list(H264Context *h)
* for display purposes) zero if one of the fields remains in
* reference
*/
-static inline int unreference_pic(H264Context *h, Picture *pic, int refmask)
-{
+static inline int unreference_pic(H264Context *h, Picture *pic, int refmask){
int i;
- if(pic->reference &= refmask)
- {
+ if (pic->reference &= refmask) {
return 0;
- }
- else
- {
+ } else {
for(i = 0; h->delayed_pic[i]; i++)
- if(pic == h->delayed_pic[i])
- {
- pic->reference = DELAYED_PIC_REF;
+ if(pic == h->delayed_pic[i]){
+ pic->reference=DELAYED_PIC_REF;
break;
}
return 1;
@@ -424,18 +364,15 @@ static inline int unreference_pic(H264Context *h, Picture *pic, int refmask)
* @return pointer to the found picture, or NULL if no pic with the provided
* frame number is found
*/
-static Picture * find_short(H264Context *h, int frame_num, int *idx)
-{
+static Picture * find_short(H264Context *h, int frame_num, int *idx){
MpegEncContext * const s = &h->s;
int i;
- for(i = 0; i < h->short_ref_count; i++)
- {
- Picture *pic = h->short_ref[i];
- if(s->avctx->debug & FF_DEBUG_MMCO)
+ for(i=0; i<h->short_ref_count; i++){
+ Picture *pic= h->short_ref[i];
+ if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic);
- if(pic->frame_num == frame_num)
- {
+ if(pic->frame_num == frame_num) {
*idx = i;
return pic;
}
@@ -449,11 +386,10 @@ static Picture * find_short(H264Context *h, int frame_num, int *idx)
* to be valid. Other list entries are shifted down.
* @param i index into h->short_ref of picture to remove.
*/
-static void remove_short_at_index(H264Context *h, int i)
-{
+static void remove_short_at_index(H264Context *h, int i){
assert(i >= 0 && i < h->short_ref_count);
- h->short_ref[i] = NULL;
- if(--h->short_ref_count)
+ h->short_ref[i]= NULL;
+ if (--h->short_ref_count)
memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i)*sizeof(Picture*));
}
@@ -461,20 +397,18 @@ static void remove_short_at_index(H264Context *h, int i)
*
* @return the removed picture or NULL if an error occurs
*/
-static Picture * remove_short(H264Context *h, int frame_num, int ref_mask)
-{
+static Picture * remove_short(H264Context *h, int frame_num, int ref_mask){
MpegEncContext * const s = &h->s;
Picture *pic;
int i;
- if(s->avctx->debug & FF_DEBUG_MMCO)
+ if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "remove short %d count %d\n", frame_num, h->short_ref_count);
pic = find_short(h, frame_num, &i);
- if(pic)
- {
+ if (pic){
if(unreference_pic(h, pic, ref_mask))
- remove_short_at_index(h, i);
+ remove_short_at_index(h, i);
}
return pic;
@@ -485,18 +419,15 @@ static Picture * remove_short(H264Context *h, int frame_num, int ref_mask)
* that list.
* @return the removed picture or NULL if an error occurs
*/
-static Picture * remove_long(H264Context *h, int i, int ref_mask)
-{
+static Picture * remove_long(H264Context *h, int i, int ref_mask){
Picture *pic;
- pic = h->long_ref[i];
- if(pic)
- {
- if(unreference_pic(h, pic, ref_mask))
- {
+ pic= h->long_ref[i];
+ if (pic){
+ if(unreference_pic(h, pic, ref_mask)){
assert(h->long_ref[i]->long_ref == 1);
- h->long_ref[i]->long_ref = 0;
- h->long_ref[i] = NULL;
+ h->long_ref[i]->long_ref= 0;
+ h->long_ref[i]= NULL;
h->long_ref_count--;
}
}
@@ -504,36 +435,30 @@ static Picture * remove_long(H264Context *h, int i, int ref_mask)
return pic;
}
-void ff_h264_remove_all_refs(H264Context *h)
-{
+void ff_h264_remove_all_refs(H264Context *h){
int i;
- for(i = 0; i < 16; i++)
- {
+ for(i=0; i<16; i++){
remove_long(h, i, 0);
}
- assert(h->long_ref_count == 0);
+ assert(h->long_ref_count==0);
- for(i = 0; i < h->short_ref_count; i++)
- {
+ for(i=0; i<h->short_ref_count; i++){
unreference_pic(h, h->short_ref[i], 0);
- h->short_ref[i] = NULL;
+ h->short_ref[i]= NULL;
}
- h->short_ref_count = 0;
+ h->short_ref_count=0;
}
/**
* print short term list
*/
-static void print_short_term(H264Context *h)
-{
+static void print_short_term(H264Context *h) {
uint32_t i;
- if(h->s.avctx->debug & FF_DEBUG_MMCO)
- {
+ if(h->s.avctx->debug&FF_DEBUG_MMCO) {
av_log(h->s.avctx, AV_LOG_DEBUG, "short term list:\n");
- for(i = 0; i < h->short_ref_count; i++)
- {
- Picture *pic = h->short_ref[i];
+ for(i=0; i<h->short_ref_count; i++){
+ Picture *pic= h->short_ref[i];
av_log(h->s.avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n", i, pic->frame_num, pic->poc, pic->data[0]);
}
}
@@ -542,173 +467,148 @@ static void print_short_term(H264Context *h)
/**
* print long term list
*/
-static void print_long_term(H264Context *h)
-{
+static void print_long_term(H264Context *h) {
uint32_t i;
- if(h->s.avctx->debug & FF_DEBUG_MMCO)
- {
+ if(h->s.avctx->debug&FF_DEBUG_MMCO) {
av_log(h->s.avctx, AV_LOG_DEBUG, "long term list:\n");
- for(i = 0; i < 16; i++)
- {
- Picture *pic = h->long_ref[i];
- if(pic)
- {
+ for(i = 0; i < 16; i++){
+ Picture *pic= h->long_ref[i];
+ if (pic) {
av_log(h->s.avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n", i, pic->frame_num, pic->poc, pic->data[0]);
}
}
}
}
-int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
-{
+int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
MpegEncContext * const s = &h->s;
int i, av_uninit(j);
- int current_ref_assigned = 0;
+ int current_ref_assigned=0;
Picture *av_uninit(pic);
- if((s->avctx->debug & FF_DEBUG_MMCO) && mmco_count == 0)
+ if((s->avctx->debug&FF_DEBUG_MMCO) && mmco_count==0)
av_log(h->s.avctx, AV_LOG_DEBUG, "no mmco here\n");
- for(i = 0; i < mmco_count; i++)
- {
+ for(i=0; i<mmco_count; i++){
int av_uninit(structure), av_uninit(frame_num);
- if(s->avctx->debug & FF_DEBUG_MMCO)
+ if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_pic_num, h->mmco[i].long_arg);
- if(mmco[i].opcode == MMCO_SHORT2UNUSED
- || mmco[i].opcode == MMCO_SHORT2LONG)
- {
+ if( mmco[i].opcode == MMCO_SHORT2UNUSED
+ || mmco[i].opcode == MMCO_SHORT2LONG){
frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure);
pic = find_short(h, frame_num, &j);
- if(!pic)
- {
+ if(!pic){
if(mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg]
|| h->long_ref[mmco[i].long_arg]->frame_num != frame_num)
- av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
+ av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
continue;
}
}
- switch(mmco[i].opcode)
- {
+ switch(mmco[i].opcode){
case MMCO_SHORT2UNUSED:
- if(s->avctx->debug & FF_DEBUG_MMCO)
+ if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count);
remove_short(h, frame_num, structure ^ PICT_FRAME);
break;
case MMCO_SHORT2LONG:
- if(h->long_ref[mmco[i].long_arg] != pic)
- remove_long(h, mmco[i].long_arg, 0);
-
- remove_short_at_index(h, j);
- h->long_ref[ mmco[i].long_arg ] = pic;
- if(h->long_ref[ mmco[i].long_arg ])
- {
- h->long_ref[ mmco[i].long_arg ]->long_ref = 1;
- h->long_ref_count++;
- }
+ if (h->long_ref[mmco[i].long_arg] != pic)
+ remove_long(h, mmco[i].long_arg, 0);
+
+ remove_short_at_index(h, j);
+ h->long_ref[ mmco[i].long_arg ]= pic;
+ if (h->long_ref[ mmco[i].long_arg ]){
+ h->long_ref[ mmco[i].long_arg ]->long_ref=1;
+ h->long_ref_count++;
+ }
break;
case MMCO_LONG2UNUSED:
j = pic_num_extract(h, mmco[i].long_arg, &structure);
pic = h->long_ref[j];
- if(pic)
- {
+ if (pic) {
remove_long(h, j, structure ^ PICT_FRAME);
- }
- else if(s->avctx->debug & FF_DEBUG_MMCO)
+ } else if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref long failure\n");
break;
case MMCO_LONG:
- // Comment below left from previous code as it is an interresting note.
- /* First field in pair is in short term list or
- * at a different long term index.
- * This is not allowed; see 7.4.3.3, notes 2 and 3.
- * Report the problem and keep the pair where it is,
- * and mark this field valid.
- */
-
- if(h->long_ref[mmco[i].long_arg] != s->current_picture_ptr)
- {
+ // Comment below left from previous code as it is an interresting note.
+ /* First field in pair is in short term list or
+ * at a different long term index.
+ * This is not allowed; see 7.4.3.3, notes 2 and 3.
+ * Report the problem and keep the pair where it is,
+ * and mark this field valid.
+ */
+
+ if (h->long_ref[mmco[i].long_arg] != s->current_picture_ptr) {
remove_long(h, mmco[i].long_arg, 0);
- h->long_ref[ mmco[i].long_arg ] = s->current_picture_ptr;
- h->long_ref[ mmco[i].long_arg ]->long_ref = 1;
+ h->long_ref[ mmco[i].long_arg ]= s->current_picture_ptr;
+ h->long_ref[ mmco[i].long_arg ]->long_ref=1;
h->long_ref_count++;
}
s->current_picture_ptr->reference |= s->picture_structure;
- current_ref_assigned = 1;
+ current_ref_assigned=1;
break;
case MMCO_SET_MAX_LONG:
assert(mmco[i].long_arg <= 16);
// just remove the long term which index is greater than new max
- for(j = mmco[i].long_arg; j < 16; j++)
- {
+ for(j = mmco[i].long_arg; j<16; j++){
remove_long(h, j, 0);
}
break;
case MMCO_RESET:
- while(h->short_ref_count)
- {
+ while(h->short_ref_count){
remove_short(h, h->short_ref[0]->frame_num, 0);
}
- for(j = 0; j < 16; j++)
- {
+ for(j = 0; j < 16; j++) {
remove_long(h, j, 0);
}
- s->current_picture_ptr->poc =
- s->current_picture_ptr->field_poc[0] =
- s->current_picture_ptr->field_poc[1] =
- h->poc_lsb =
- h->poc_msb =
- h->frame_num =
- s->current_picture_ptr->frame_num = 0;
- s->current_picture_ptr->mmco_reset = 1;
+ s->current_picture_ptr->poc=
+ s->current_picture_ptr->field_poc[0]=
+ s->current_picture_ptr->field_poc[1]=
+ h->poc_lsb=
+ h->poc_msb=
+ h->frame_num=
+ s->current_picture_ptr->frame_num= 0;
+ s->current_picture_ptr->mmco_reset=1;
break;
- default:
- assert(0);
+ default: assert(0);
}
}
- if(!current_ref_assigned)
- {
+ if (!current_ref_assigned) {
/* Second field of complementary field pair; the first field of
* which is already referenced. If short referenced, it
* should be first entry in short_ref. If not, it must exist
* in long_ref; trying to put it on the short list here is an
* error in the encoded bit stream (ref: 7.4.3.3, NOTE 2 and 3).
*/
- if(h->short_ref_count && h->short_ref[0] == s->current_picture_ptr)
- {
+ if (h->short_ref_count && h->short_ref[0] == s->current_picture_ptr) {
/* Just mark the second field valid */
s->current_picture_ptr->reference = PICT_FRAME;
- }
- else if(s->current_picture_ptr->long_ref)
- {
+ } else if (s->current_picture_ptr->long_ref) {
av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term reference "
- "assignment for second field "
- "in complementary field pair "
- "(first field is long term)\n");
- }
- else
- {
- pic = remove_short(h, s->current_picture_ptr->frame_num, 0);
- if(pic)
- {
+ "assignment for second field "
+ "in complementary field pair "
+ "(first field is long term)\n");
+ } else {
+ pic= remove_short(h, s->current_picture_ptr->frame_num, 0);
+ if(pic){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n");
}
if(h->short_ref_count)
- memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count * sizeof(Picture*));
+ memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count*sizeof(Picture*));
- h->short_ref[0] = s->current_picture_ptr;
+ h->short_ref[0]= s->current_picture_ptr;
h->short_ref_count++;
s->current_picture_ptr->reference |= s->picture_structure;
}
}
- if(h->long_ref_count + h->short_ref_count > h->sps.ref_frame_count)
- {
+ if (h->long_ref_count + h->short_ref_count > h->sps.ref_frame_count){
/* We have too many reference frames, probably due to corrupted
* stream. Need to discard one frame. Prevents overrun of the
@@ -718,17 +618,14 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
"number of reference frames exceeds max (probably "
"corrupt input), discarding one\n");
- if(h->long_ref_count && !h->short_ref_count)
- {
- for(i = 0; i < 16; ++i)
- if(h->long_ref[i])
+ if (h->long_ref_count && !h->short_ref_count) {
+ for (i = 0; i < 16; ++i)
+ if (h->long_ref[i])
break;
assert(i < 16);
remove_long(h, i, 0);
- }
- else
- {
+ } else {
pic = h->short_ref[h->short_ref_count - 1];
remove_short(h, pic->frame_num, 0);
}
@@ -739,76 +636,61 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
return 0;
}
-int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb)
-{
+int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
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;
+ 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;
}
- }
- 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);
- return -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);
+ return -1;
+ }*/
}
- 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_LONG2UNUSED && FIELD_PICTURE)))
- {
+ 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_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;
+ h->mmco[i].long_arg= long_arg;
}
- if(opcode > (unsigned)MMCO_LONG)
- {
+ 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)
break;
}
- h->mmco_index = i;
- }
- else
- {
+ h->mmco_index= i;
+ }else{
assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);
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->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(FIELD_PICTURE)
- {
+ !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->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 (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;
+ h->mmco[1].opcode= MMCO_SHORT2UNUSED;
+ h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1;
+ h->mmco_index= 2;
}
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_sei.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_sei.c
index 5a1414a27..f98448130 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_sei.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264_sei.c
@@ -33,63 +33,51 @@
//#undef NDEBUG
#include <assert.h>
-static const uint8_t sei_num_clock_ts_table[9] =
-{
+static const uint8_t sei_num_clock_ts_table[9]={
1, 1, 1, 2, 2, 3, 3, 2, 3
};
-void ff_h264_reset_sei(H264Context *h)
-{
+void ff_h264_reset_sei(H264Context *h) {
h->sei_recovery_frame_cnt = -1;
h->sei_dpb_output_delay = 0;
h->sei_cpb_removal_delay = -1;
h->sei_buffering_period_present = 0;
}
-static int decode_picture_timing(H264Context *h)
-{
+static int decode_picture_timing(H264Context *h){
MpegEncContext * const s = &h->s;
- if(h->sps.nal_hrd_parameters_present_flag || h->sps.vcl_hrd_parameters_present_flag)
- {
+ if(h->sps.nal_hrd_parameters_present_flag || h->sps.vcl_hrd_parameters_present_flag){
h->sei_cpb_removal_delay = get_bits(&s->gb, h->sps.cpb_removal_delay_length);
h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length);
}
- if(h->sps.pic_struct_present_flag)
- {
+ if(h->sps.pic_struct_present_flag){
unsigned int i, num_clock_ts;
h->sei_pic_struct = get_bits(&s->gb, 4);
h->sei_ct_type = 0;
- if(h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING)
+ if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING)
return -1;
num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct];
- for(i = 0 ; i < num_clock_ts ; i++)
- {
- if(get_bits(&s->gb, 1)) /* clock_timestamp_flag */
- {
+ for (i = 0 ; i < num_clock_ts ; i++){
+ if(get_bits(&s->gb, 1)){ /* clock_timestamp_flag */
unsigned int full_timestamp_flag;
- h->sei_ct_type |= 1 << get_bits(&s->gb, 2);
+ h->sei_ct_type |= 1<<get_bits(&s->gb, 2);
skip_bits(&s->gb, 1); /* nuit_field_based_flag */
skip_bits(&s->gb, 5); /* counting_type */
full_timestamp_flag = get_bits(&s->gb, 1);
skip_bits(&s->gb, 1); /* discontinuity_flag */
skip_bits(&s->gb, 1); /* cnt_dropped_flag */
skip_bits(&s->gb, 8); /* n_frames */
- if(full_timestamp_flag)
- {
+ if(full_timestamp_flag){
skip_bits(&s->gb, 6); /* seconds_value 0..59 */
skip_bits(&s->gb, 6); /* minutes_value 0..59 */
skip_bits(&s->gb, 5); /* hours_value 0..23 */
- }
- else
- {
- if(get_bits(&s->gb, 1)) /* seconds_flag */
- {
+ }else{
+ if(get_bits(&s->gb, 1)){ /* seconds_flag */
skip_bits(&s->gb, 6); /* seconds_value range 0..59 */
- if(get_bits(&s->gb, 1)) /* minutes_flag */
- {
+ if(get_bits(&s->gb, 1)){ /* minutes_flag */
skip_bits(&s->gb, 6); /* minutes_value 0..59 */
if(get_bits(&s->gb, 1)) /* hours_flag */
skip_bits(&s->gb, 5); /* hours_value 0..23 */
@@ -107,36 +95,33 @@ static int decode_picture_timing(H264Context *h)
return 0;
}
-static int decode_unregistered_user_data(H264Context *h, int size)
-{
+static int decode_unregistered_user_data(H264Context *h, int size){
MpegEncContext * const s = &h->s;
uint8_t user_data[16+256];
int e, build, i;
- if(size < 16)
+ if(size<16)
return -1;
- for(i = 0; i < sizeof(user_data) - 1 && i < size; i++)
- {
- user_data[i] = get_bits(&s->gb, 8);
+ for(i=0; i<sizeof(user_data)-1 && i<size; i++){
+ user_data[i]= get_bits(&s->gb, 8);
}
- user_data[i] = 0;
- e = sscanf(user_data + 16, "x264 - core %d"/*%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html*/, &build);
- if(e == 1 && build >= 0)
- h->x264_build = build;
+ user_data[i]= 0;
+ e= sscanf(user_data+16, "x264 - core %d"/*%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html*/, &build);
+ if(e==1 && build>=0)
+ h->x264_build= build;
if(s->avctx->debug & FF_DEBUG_BUGS)
- av_log(s->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data + 16);
+ av_log(s->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data+16);
- for(; i < size; i++)
+ for(; i<size; i++)
skip_bits(&s->gb, 8);
return 0;
}
-static int decode_recovery_point(H264Context *h)
-{
+static int decode_recovery_point(H264Context *h){
MpegEncContext * const s = &h->s;
h->sei_recovery_frame_cnt = get_ue_golomb(&s->gb);
@@ -145,34 +130,28 @@ static int decode_recovery_point(H264Context *h)
return 0;
}
-static int decode_buffering_period(H264Context *h)
-{
+static int decode_buffering_period(H264Context *h){
MpegEncContext * const s = &h->s;
unsigned int sps_id;
int sched_sel_idx;
SPS *sps;
sps_id = get_ue_golomb_31(&s->gb);
- if(sps_id > 31 || !h->sps_buffers[sps_id])
- {
+ if(sps_id > 31 || !h->sps_buffers[sps_id]) {
av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS %d referenced in buffering period\n", sps_id);
return -1;
}
sps = h->sps_buffers[sps_id];
// NOTE: This is really so duplicated in the standard... See H.264, D.1.1
- if(sps->nal_hrd_parameters_present_flag)
- {
- for(sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++)
- {
+ if (sps->nal_hrd_parameters_present_flag) {
+ for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) {
h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length);
skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset
}
}
- if(sps->vcl_hrd_parameters_present_flag)
- {
- for(sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++)
- {
+ if (sps->vcl_hrd_parameters_present_flag) {
+ for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) {
h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length);
skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset
}
@@ -182,30 +161,23 @@ static int decode_buffering_period(H264Context *h)
return 0;
}
-int ff_h264_decode_sei(H264Context *h)
-{
+int ff_h264_decode_sei(H264Context *h){
MpegEncContext * const s = &h->s;
- while(get_bits_count(&s->gb) + 16 < s->gb.size_in_bits)
- {
+ while(get_bits_count(&s->gb) + 16 < s->gb.size_in_bits){
int size, type;
- type = 0;
- do
- {
- type += show_bits(&s->gb, 8);
- }
- while(get_bits(&s->gb, 8) == 255);
+ type=0;
+ do{
+ type+= show_bits(&s->gb, 8);
+ }while(get_bits(&s->gb, 8) == 255);
- size = 0;
- do
- {
- size += show_bits(&s->gb, 8);
- }
- while(get_bits(&s->gb, 8) == 255);
+ size=0;
+ do{
+ size+= show_bits(&s->gb, 8);
+ }while(get_bits(&s->gb, 8) == 255);
- switch(type)
- {
+ switch(type){
case SEI_TYPE_PIC_TIMING: // Picture timing SEI
if(decode_picture_timing(h) < 0)
return -1;
@@ -223,7 +195,7 @@ int ff_h264_decode_sei(H264Context *h)
return -1;
break;
default:
- skip_bits(&s->gb, 8 * size);
+ skip_bits(&s->gb, 8*size);
}
//FIXME check bits here
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264data.h
index 007f420bc..c08478eb0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264data.h
@@ -35,248 +35,228 @@
#include "h264.h"
-static const uint8_t golomb_to_pict_type[5] =
+static const uint8_t golomb_to_pict_type[5]=
{FF_P_TYPE, FF_B_TYPE, FF_I_TYPE, FF_SP_TYPE, FF_SI_TYPE};
-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, //FIXME
+static const uint8_t chroma_dc_scan[4]={
+ (0+0*2)*16, (1+0*2)*16,
+ (0+1*2)*16, (1+1*2)*16, //FIXME
};
// 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 , 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 , 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
+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
};
-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/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264idct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264idct.c
index 195c8d453..7de56b241 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264idct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264idct.c
@@ -27,83 +27,76 @@
#include "dsputil.h"
-static av_always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add)
-{
+static av_always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- block[0] += 1 << (shift - 1);
+ block[0] += 1<<(shift-1);
- for(i = 0; i < 4; i++)
- {
- const int z0 = block[0 + block_stride*i] + block[2 + block_stride*i];
- const int z1 = block[0 + block_stride*i] - block[2 + block_stride*i];
- const int z2 = (block[1 + block_stride*i] >> 1) - block[3 + block_stride*i];
- const int z3 = block[1 + block_stride*i] + (block[3 + block_stride*i] >> 1);
-
- block[0 + block_stride*i] = z0 + z3;
- block[1 + block_stride*i] = z1 + z2;
- block[2 + block_stride*i] = z1 - z2;
- block[3 + block_stride*i] = z0 - z3;
+ for(i=0; i<4; i++){
+ const int z0= block[0 + block_stride*i] + block[2 + block_stride*i];
+ const int z1= block[0 + block_stride*i] - block[2 + block_stride*i];
+ const int z2= (block[1 + block_stride*i]>>1) - block[3 + block_stride*i];
+ const int z3= block[1 + block_stride*i] + (block[3 + block_stride*i]>>1);
+
+ block[0 + block_stride*i]= z0 + z3;
+ block[1 + block_stride*i]= z1 + z2;
+ block[2 + block_stride*i]= z1 - z2;
+ block[3 + block_stride*i]= z0 - z3;
}
- for(i = 0; i < 4; i++)
- {
- const int z0 = block[i + block_stride*0] + block[i + block_stride*2];
- const int z1 = block[i + block_stride*0] - block[i + block_stride*2];
- const int z2 = (block[i + block_stride*1] >> 1) - block[i + block_stride*3];
- const int z3 = block[i + block_stride*1] + (block[i + block_stride*3] >> 1);
-
- dst[i + 0*stride] = cm[ add*dst[i + 0*stride] + ((z0 + z3) >> shift)];
- dst[i + 1*stride] = cm[ add*dst[i + 1*stride] + ((z1 + z2) >> shift)];
- dst[i + 2*stride] = cm[ add*dst[i + 2*stride] + ((z1 - z2) >> shift)];
- dst[i + 3*stride] = cm[ add*dst[i + 3*stride] + ((z0 - z3) >> shift)];
+ for(i=0; i<4; i++){
+ const int z0= block[i + block_stride*0] + block[i + block_stride*2];
+ const int z1= block[i + block_stride*0] - block[i + block_stride*2];
+ const int z2= (block[i + block_stride*1]>>1) - block[i + block_stride*3];
+ const int z3= block[i + block_stride*1] + (block[i + block_stride*3]>>1);
+
+ dst[i + 0*stride]= cm[ add*dst[i + 0*stride] + ((z0 + z3) >> shift) ];
+ dst[i + 1*stride]= cm[ add*dst[i + 1*stride] + ((z1 + z2) >> shift) ];
+ dst[i + 2*stride]= cm[ add*dst[i + 2*stride] + ((z1 - z2) >> shift) ];
+ dst[i + 3*stride]= cm[ add*dst[i + 3*stride] + ((z0 - z3) >> shift) ];
}
}
-void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride)
-{
+void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride){
idct_internal(dst, block, stride, 4, 6, 1);
}
-void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block)
-{
+void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){
idct_internal(dst, block, stride, 8, 3, 1);
}
-void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block)
-{
+void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block){
idct_internal(dst, block, stride, 8, 3, 0);
}
-void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride)
-{
+void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
block[0] += 32;
- for(i = 0; i < 8; i++)
+ for( i = 0; i < 8; i++ )
{
const int a0 = block[0+i*8] + block[4+i*8];
const int a2 = block[0+i*8] - block[4+i*8];
- const int a4 = (block[2+i*8] >> 1) - block[6+i*8];
- const int a6 = (block[6+i*8] >> 1) + block[2+i*8];
+ const int a4 = (block[2+i*8]>>1) - block[6+i*8];
+ const int a6 = (block[6+i*8]>>1) + block[2+i*8];
const int b0 = a0 + a6;
const int b2 = a2 + a4;
const int b4 = a2 - a4;
const int b6 = a0 - a6;
- const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8] >> 1);
- const int a3 = block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8] >> 1);
- const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8] >> 1);
- const int a7 = block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8] >> 1);
+ const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
+ const int a3 = block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
+ const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
+ const int a7 = block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
- const int b1 = (a7 >> 2) + a1;
- const int b3 = a3 + (a5 >> 2);
- const int b5 = (a3 >> 2) - a5;
- const int b7 = a7 - (a1 >> 2);
+ const int b1 = (a7>>2) + a1;
+ const int b3 = a3 + (a5>>2);
+ const int b5 = (a3>>2) - a5;
+ const int b7 = a7 - (a1>>2);
block[0+i*8] = b0 + b7;
block[7+i*8] = b0 - b7;
@@ -114,125 +107,112 @@ void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride)
block[3+i*8] = b6 + b1;
block[4+i*8] = b6 - b1;
}
- for(i = 0; i < 8; i++)
+ for( i = 0; i < 8; i++ )
{
const int a0 = block[i+0*8] + block[i+4*8];
const int a2 = block[i+0*8] - block[i+4*8];
- const int a4 = (block[i+2*8] >> 1) - block[i+6*8];
- const int a6 = (block[i+6*8] >> 1) + block[i+2*8];
+ const int a4 = (block[i+2*8]>>1) - block[i+6*8];
+ const int a6 = (block[i+6*8]>>1) + block[i+2*8];
const int b0 = a0 + a6;
const int b2 = a2 + a4;
const int b4 = a2 - a4;
const int b6 = a0 - a6;
- const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8] >> 1);
- const int a3 = block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8] >> 1);
- const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8] >> 1);
- const int a7 = block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8] >> 1);
-
- const int b1 = (a7 >> 2) + a1;
- const int b3 = a3 + (a5 >> 2);
- const int b5 = (a3 >> 2) - a5;
- const int b7 = a7 - (a1 >> 2);
-
- dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b7) >> 6)];
- dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b2 + b5) >> 6)];
- dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b4 + b3) >> 6)];
- dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b6 + b1) >> 6)];
- dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b6 - b1) >> 6)];
- dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b4 - b3) >> 6)];
- dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b2 - b5) >> 6)];
- dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b7) >> 6)];
+ const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
+ const int a3 = block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
+ const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
+ const int a7 = block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
+
+ const int b1 = (a7>>2) + a1;
+ const int b3 = a3 + (a5>>2);
+ const int b5 = (a3>>2) - a5;
+ const int b7 = a7 - (a1>>2);
+
+ dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b7) >> 6) ];
+ dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b2 + b5) >> 6) ];
+ dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b4 + b3) >> 6) ];
+ dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b6 + b1) >> 6) ];
+ dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b6 - b1) >> 6) ];
+ dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b4 - b3) >> 6) ];
+ dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b2 - b5) >> 6) ];
+ dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b7) >> 6) ];
}
}
// assumes all AC coefs are 0
-void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride)
-{
+void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
int i, j;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int dc = (block[0] + 32) >> 6;
- for(j = 0; j < 4; j++)
+ for( j = 0; j < 4; j++ )
{
- for(i = 0; i < 4; i++)
+ for( i = 0; i < 4; i++ )
dst[i] = cm[ dst[i] + dc ];
dst += stride;
}
}
-void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride)
-{
+void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
int i, j;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int dc = (block[0] + 32) >> 6;
- for(j = 0; j < 8; j++)
+ for( j = 0; j < 8; j++ )
{
- for(i = 0; i < 8; i++)
+ for( i = 0; i < 8; i++ )
dst[i] = cm[ dst[i] + dc ];
dst += stride;
}
}
//FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split
-static const uint8_t scan8[16 + 2*4] =
-{
- 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,
- 1 + 1 * 8, 2 + 1 * 8,
- 1 + 2 * 8, 2 + 2 * 8,
- 1 + 4 * 8, 2 + 4 * 8,
- 1 + 5 * 8, 2 + 5 * 8,
+static const uint8_t scan8[16 + 2*4]={
+ 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,
+ 1+1*8, 2+1*8,
+ 1+2*8, 2+2*8,
+ 1+4*8, 2+4*8,
+ 1+5*8, 2+5*8,
};
-void ff_h264_idct_add16_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+void ff_h264_idct_add16_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i++)
- {
+ for(i=0; i<16; i++){
int nnz = nnzc[ scan8[i] ];
- if(nnz)
- {
- if(nnz == 1 && block[i*16]) ff_h264_idct_dc_add_c(dst + block_offset[i], block + i * 16, stride);
- else idct_internal(dst + block_offset[i], block + i * 16, stride, 4, 6, 1);
+ if(nnz){
+ if(nnz==1 && block[i*16]) ff_h264_idct_dc_add_c(dst + block_offset[i], block + i*16, stride);
+ else idct_internal (dst + block_offset[i], block + i*16, stride, 4, 6, 1);
}
}
}
-void ff_h264_idct_add16intra_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+void ff_h264_idct_add16intra_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i++)
- {
- if(nnzc[ scan8[i] ]) idct_internal(dst + block_offset[i], block + i * 16, stride, 4, 6, 1);
- else if(block[i*16]) ff_h264_idct_dc_add_c(dst + block_offset[i], block + i * 16, stride);
+ for(i=0; i<16; i++){
+ if(nnzc[ scan8[i] ]) idct_internal (dst + block_offset[i], block + i*16, stride, 4, 6, 1);
+ else if(block[i*16]) ff_h264_idct_dc_add_c(dst + block_offset[i], block + i*16, stride);
}
}
-void ff_h264_idct8_add4_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+void ff_h264_idct8_add4_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i += 4)
- {
+ for(i=0; i<16; i+=4){
int nnz = nnzc[ scan8[i] ];
- if(nnz)
- {
- if(nnz == 1 && block[i*16]) ff_h264_idct8_dc_add_c(dst + block_offset[i], block + i * 16, stride);
- else ff_h264_idct8_add_c(dst + block_offset[i], block + i * 16, stride);
+ if(nnz){
+ if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_c(dst + block_offset[i], block + i*16, stride);
+ else ff_h264_idct8_add_c (dst + block_offset[i], block + i*16, stride);
}
}
}
-void ff_h264_idct_add8_c(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+void ff_h264_idct_add8_c(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 16; i < 16 + 8; i++)
- {
+ for(i=16; i<16+8; i++){
if(nnzc[ scan8[i] ])
- ff_h264_idct_add_c(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_add_c (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
else if(block[i*16])
- ff_h264_idct_dc_add_c(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_dc_add_c(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c
index 64cc99a1f..3b6fc8211 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c
@@ -29,60 +29,54 @@
#include "mpegvideo.h"
#include "h264pred.h"
-static void pred4x4_vertical_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const uint32_t a = ((uint32_t*)(src - stride))[0];
- ((uint32_t*)(src + 0 * stride))[0] = a;
- ((uint32_t*)(src + 1 * stride))[0] = a;
- ((uint32_t*)(src + 2 * stride))[0] = a;
- ((uint32_t*)(src + 3 * stride))[0] = a;
+static void pred4x4_vertical_c(uint8_t *src, uint8_t *topright, int stride){
+ const uint32_t a= ((uint32_t*)(src-stride))[0];
+ ((uint32_t*)(src+0*stride))[0]= a;
+ ((uint32_t*)(src+1*stride))[0]= a;
+ ((uint32_t*)(src+2*stride))[0]= a;
+ ((uint32_t*)(src+3*stride))[0]= a;
}
-static void pred4x4_horizontal_c(uint8_t *src, uint8_t *topright, int stride)
-{
- ((uint32_t*)(src + 0 * stride))[0] = src[-1+0*stride] * 0x01010101;
- ((uint32_t*)(src + 1 * stride))[0] = src[-1+1*stride] * 0x01010101;
- ((uint32_t*)(src + 2 * stride))[0] = src[-1+2*stride] * 0x01010101;
- ((uint32_t*)(src + 3 * stride))[0] = src[-1+3*stride] * 0x01010101;
+static void pred4x4_horizontal_c(uint8_t *src, uint8_t *topright, int stride){
+ ((uint32_t*)(src+0*stride))[0]= src[-1+0*stride]*0x01010101;
+ ((uint32_t*)(src+1*stride))[0]= src[-1+1*stride]*0x01010101;
+ ((uint32_t*)(src+2*stride))[0]= src[-1+2*stride]*0x01010101;
+ ((uint32_t*)(src+3*stride))[0]= src[-1+3*stride]*0x01010101;
}
-static void pred4x4_dc_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const int dc = (src[-stride] + src[1-stride] + src[2-stride] + src[3-stride]
- + src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 4) >> 3;
+static void pred4x4_dc_c(uint8_t *src, uint8_t *topright, int stride){
+ const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride]
+ + src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 4) >>3;
- ((uint32_t*)(src + 0 * stride))[0] =
- ((uint32_t*)(src + 1 * stride))[0] =
- ((uint32_t*)(src + 2 * stride))[0] =
- ((uint32_t*)(src + 3 * stride))[0] = dc * 0x01010101;
+ ((uint32_t*)(src+0*stride))[0]=
+ ((uint32_t*)(src+1*stride))[0]=
+ ((uint32_t*)(src+2*stride))[0]=
+ ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
}
-static void pred4x4_left_dc_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const int dc = (src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >> 2;
+static void pred4x4_left_dc_c(uint8_t *src, uint8_t *topright, int stride){
+ const int dc= ( src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2;
- ((uint32_t*)(src + 0 * stride))[0] =
- ((uint32_t*)(src + 1 * stride))[0] =
- ((uint32_t*)(src + 2 * stride))[0] =
- ((uint32_t*)(src + 3 * stride))[0] = dc * 0x01010101;
+ ((uint32_t*)(src+0*stride))[0]=
+ ((uint32_t*)(src+1*stride))[0]=
+ ((uint32_t*)(src+2*stride))[0]=
+ ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
}
-static void pred4x4_top_dc_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const int dc = (src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >> 2;
+static void pred4x4_top_dc_c(uint8_t *src, uint8_t *topright, int stride){
+ const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2;
- ((uint32_t*)(src + 0 * stride))[0] =
- ((uint32_t*)(src + 1 * stride))[0] =
- ((uint32_t*)(src + 2 * stride))[0] =
- ((uint32_t*)(src + 3 * stride))[0] = dc * 0x01010101;
+ ((uint32_t*)(src+0*stride))[0]=
+ ((uint32_t*)(src+1*stride))[0]=
+ ((uint32_t*)(src+2*stride))[0]=
+ ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
}
-static void pred4x4_128_dc_c(uint8_t *src, uint8_t *topright, int stride)
-{
- ((uint32_t*)(src + 0 * stride))[0] =
- ((uint32_t*)(src + 1 * stride))[0] =
- ((uint32_t*)(src + 2 * stride))[0] =
- ((uint32_t*)(src + 3 * stride))[0] = 128U * 0x01010101U;
+static void pred4x4_128_dc_c(uint8_t *src, uint8_t *topright, int stride){
+ ((uint32_t*)(src+0*stride))[0]=
+ ((uint32_t*)(src+1*stride))[0]=
+ ((uint32_t*)(src+2*stride))[0]=
+ ((uint32_t*)(src+3*stride))[0]= 128U*0x01010101U;
}
@@ -91,743 +85,664 @@ static void pred4x4_128_dc_c(uint8_t *src, uint8_t *topright, int stride)
const int av_unused t5= topright[1];\
const int av_unused t6= topright[2];\
const int av_unused t7= topright[3];\
-
+
#define LOAD_DOWN_LEFT_EDGE\
const int av_unused l4= src[-1+4*stride];\
const int av_unused l5= src[-1+5*stride];\
const int av_unused l6= src[-1+6*stride];\
const int av_unused l7= src[-1+7*stride];\
-
+
#define LOAD_LEFT_EDGE\
const int av_unused l0= src[-1+0*stride];\
const int av_unused l1= src[-1+1*stride];\
const int av_unused l2= src[-1+2*stride];\
const int av_unused l3= src[-1+3*stride];\
-
+
#define LOAD_TOP_EDGE\
const int av_unused t0= src[ 0-1*stride];\
const int av_unused t1= src[ 1-1*stride];\
const int av_unused t2= src[ 2-1*stride];\
const int av_unused t3= src[ 3-1*stride];\
-
-static void pred4x4_down_right_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const int lt = src[-1-1*stride];
+
+static void pred4x4_down_right_c(uint8_t *src, uint8_t *topright, int stride){
+ const int lt= src[-1-1*stride];
LOAD_TOP_EDGE
LOAD_LEFT_EDGE
- src[0+3*stride] = (l3 + 2 * l2 + l1 + 2) >> 2;
- src[0+2*stride] =
- src[1+3*stride] = (l2 + 2 * l1 + l0 + 2) >> 2;
- src[0+1*stride] =
- src[1+2*stride] =
- src[2+3*stride] = (l1 + 2 * l0 + lt + 2) >> 2;
- src[0+0*stride] =
- src[1+1*stride] =
- src[2+2*stride] =
- src[3+3*stride] = (l0 + 2 * lt + t0 + 2) >> 2;
- src[1+0*stride] =
- src[2+1*stride] =
- src[3+2*stride] = (lt + 2 * t0 + t1 + 2) >> 2;
- src[2+0*stride] =
- src[3+1*stride] = (t0 + 2 * t1 + t2 + 2) >> 2;
- src[3+0*stride] = (t1 + 2 * t2 + t3 + 2) >> 2;
-}
-
-static void pred4x4_down_left_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+3*stride]=(l3 + 2*l2 + l1 + 2)>>2;
+ src[0+2*stride]=
+ src[1+3*stride]=(l2 + 2*l1 + l0 + 2)>>2;
+ src[0+1*stride]=
+ src[1+2*stride]=
+ src[2+3*stride]=(l1 + 2*l0 + lt + 2)>>2;
+ src[0+0*stride]=
+ src[1+1*stride]=
+ src[2+2*stride]=
+ src[3+3*stride]=(l0 + 2*lt + t0 + 2)>>2;
+ src[1+0*stride]=
+ src[2+1*stride]=
+ src[3+2*stride]=(lt + 2*t0 + t1 + 2)>>2;
+ src[2+0*stride]=
+ src[3+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
+ src[3+0*stride]=(t1 + 2*t2 + t3 + 2)>>2;
+}
+
+static void pred4x4_down_left_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
// LOAD_LEFT_EDGE
- src[0+0*stride] = (t0 + t2 + 2 * t1 + 2) >> 2;
- src[1+0*stride] =
- src[0+1*stride] = (t1 + t3 + 2 * t2 + 2) >> 2;
- src[2+0*stride] =
- src[1+1*stride] =
- src[0+2*stride] = (t2 + t4 + 2 * t3 + 2) >> 2;
- src[3+0*stride] =
- src[2+1*stride] =
- src[1+2*stride] =
- src[0+3*stride] = (t3 + t5 + 2 * t4 + 2) >> 2;
- src[3+1*stride] =
- src[2+2*stride] =
- src[1+3*stride] = (t4 + t6 + 2 * t5 + 2) >> 2;
- src[3+2*stride] =
- src[2+3*stride] = (t5 + t7 + 2 * t6 + 2) >> 2;
- src[3+3*stride] = (t6 + 3 * t7 + 2) >> 2;
-}
-
-static void pred4x4_down_left_svq3_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+0*stride]=(t0 + t2 + 2*t1 + 2)>>2;
+ src[1+0*stride]=
+ src[0+1*stride]=(t1 + t3 + 2*t2 + 2)>>2;
+ src[2+0*stride]=
+ src[1+1*stride]=
+ src[0+2*stride]=(t2 + t4 + 2*t3 + 2)>>2;
+ src[3+0*stride]=
+ src[2+1*stride]=
+ src[1+2*stride]=
+ src[0+3*stride]=(t3 + t5 + 2*t4 + 2)>>2;
+ src[3+1*stride]=
+ src[2+2*stride]=
+ src[1+3*stride]=(t4 + t6 + 2*t5 + 2)>>2;
+ src[3+2*stride]=
+ src[2+3*stride]=(t5 + t7 + 2*t6 + 2)>>2;
+ src[3+3*stride]=(t6 + 3*t7 + 2)>>2;
+}
+
+static void pred4x4_down_left_svq3_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_TOP_EDGE
LOAD_LEFT_EDGE
- const av_unused int unu0 = t0;
- const av_unused int unu1 = l0;
-
- src[0+0*stride] = (l1 + t1) >> 1;
- src[1+0*stride] =
- src[0+1*stride] = (l2 + t2) >> 1;
- src[2+0*stride] =
- src[1+1*stride] =
- src[0+2*stride] =
- src[3+0*stride] =
- src[2+1*stride] =
- src[1+2*stride] =
- src[0+3*stride] =
- src[3+1*stride] =
- src[2+2*stride] =
- src[1+3*stride] =
- src[3+2*stride] =
- src[2+3*stride] =
- src[3+3*stride] = (l3 + t3) >> 1;
-}
-
-static void pred4x4_down_left_rv40_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ const av_unused int unu0= t0;
+ const av_unused int unu1= l0;
+
+ src[0+0*stride]=(l1 + t1)>>1;
+ src[1+0*stride]=
+ src[0+1*stride]=(l2 + t2)>>1;
+ src[2+0*stride]=
+ src[1+1*stride]=
+ src[0+2*stride]=
+ src[3+0*stride]=
+ src[2+1*stride]=
+ src[1+2*stride]=
+ src[0+3*stride]=
+ src[3+1*stride]=
+ src[2+2*stride]=
+ src[1+3*stride]=
+ src[3+2*stride]=
+ src[2+3*stride]=
+ src[3+3*stride]=(l3 + t3)>>1;
+}
+
+static void pred4x4_down_left_rv40_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
LOAD_LEFT_EDGE
LOAD_DOWN_LEFT_EDGE
- src[0+0*stride] = (t0 + t2 + 2 * t1 + 2 + l0 + l2 + 2 * l1 + 2) >> 3;
- src[1+0*stride] =
- src[0+1*stride] = (t1 + t3 + 2 * t2 + 2 + l1 + l3 + 2 * l2 + 2) >> 3;
- src[2+0*stride] =
- src[1+1*stride] =
- src[0+2*stride] = (t2 + t4 + 2 * t3 + 2 + l2 + l4 + 2 * l3 + 2) >> 3;
- src[3+0*stride] =
- src[2+1*stride] =
- src[1+2*stride] =
- src[0+3*stride] = (t3 + t5 + 2 * t4 + 2 + l3 + l5 + 2 * l4 + 2) >> 3;
- src[3+1*stride] =
- src[2+2*stride] =
- src[1+3*stride] = (t4 + t6 + 2 * t5 + 2 + l4 + l6 + 2 * l5 + 2) >> 3;
- src[3+2*stride] =
- src[2+3*stride] = (t5 + t7 + 2 * t6 + 2 + l5 + l7 + 2 * l6 + 2) >> 3;
- src[3+3*stride] = (t6 + t7 + 1 + l6 + l7 + 1) >> 2;
-}
-
-static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
+ src[1+0*stride]=
+ src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
+ src[2+0*stride]=
+ src[1+1*stride]=
+ src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
+ src[3+0*stride]=
+ src[2+1*stride]=
+ src[1+2*stride]=
+ src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
+ src[3+1*stride]=
+ src[2+2*stride]=
+ src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
+ src[3+2*stride]=
+ src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
+ src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2;
+}
+
+static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
LOAD_LEFT_EDGE
- src[0+0*stride] = (t0 + t2 + 2 * t1 + 2 + l0 + l2 + 2 * l1 + 2) >> 3;
- src[1+0*stride] =
- src[0+1*stride] = (t1 + t3 + 2 * t2 + 2 + l1 + l3 + 2 * l2 + 2) >> 3;
- src[2+0*stride] =
- src[1+1*stride] =
- src[0+2*stride] = (t2 + t4 + 2 * t3 + 2 + l2 + 3 * l3 + 2) >> 3;
- src[3+0*stride] =
- src[2+1*stride] =
- src[1+2*stride] =
- src[0+3*stride] = (t3 + t5 + 2 * t4 + 2 + l3 * 4 + 2) >> 3;
- src[3+1*stride] =
- src[2+2*stride] =
- src[1+3*stride] = (t4 + t6 + 2 * t5 + 2 + l3 * 4 + 2) >> 3;
- src[3+2*stride] =
- src[2+3*stride] = (t5 + t7 + 2 * t6 + 2 + l3 * 4 + 2) >> 3;
- src[3+3*stride] = (t6 + t7 + 1 + 2 * l3 + 1) >> 2;
-}
-
-static void pred4x4_vertical_right_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const int lt = src[-1-1*stride];
+ src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
+ src[1+0*stride]=
+ src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
+ src[2+0*stride]=
+ src[1+1*stride]=
+ src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3;
+ src[3+0*stride]=
+ src[2+1*stride]=
+ src[1+2*stride]=
+ src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3;
+ src[3+1*stride]=
+ src[2+2*stride]=
+ src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3;
+ src[3+2*stride]=
+ src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3;
+ src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2;
+}
+
+static void pred4x4_vertical_right_c(uint8_t *src, uint8_t *topright, int stride){
+ const int lt= src[-1-1*stride];
LOAD_TOP_EDGE
LOAD_LEFT_EDGE
- src[0+0*stride] =
- src[1+2*stride] = (lt + t0 + 1) >> 1;
- src[1+0*stride] =
- src[2+2*stride] = (t0 + t1 + 1) >> 1;
- src[2+0*stride] =
- src[3+2*stride] = (t1 + t2 + 1) >> 1;
- src[3+0*stride] = (t2 + t3 + 1) >> 1;
- src[0+1*stride] =
- src[1+3*stride] = (l0 + 2 * lt + t0 + 2) >> 2;
- src[1+1*stride] =
- src[2+3*stride] = (lt + 2 * t0 + t1 + 2) >> 2;
- src[2+1*stride] =
- src[3+3*stride] = (t0 + 2 * t1 + t2 + 2) >> 2;
- src[3+1*stride] = (t1 + 2 * t2 + t3 + 2) >> 2;
- src[0+2*stride] = (lt + 2 * l0 + l1 + 2) >> 2;
- src[0+3*stride] = (l0 + 2 * l1 + l2 + 2) >> 2;
-}
-
-static void pred4x4_vertical_left_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+0*stride]=
+ src[1+2*stride]=(lt + t0 + 1)>>1;
+ src[1+0*stride]=
+ src[2+2*stride]=(t0 + t1 + 1)>>1;
+ src[2+0*stride]=
+ src[3+2*stride]=(t1 + t2 + 1)>>1;
+ src[3+0*stride]=(t2 + t3 + 1)>>1;
+ src[0+1*stride]=
+ src[1+3*stride]=(l0 + 2*lt + t0 + 2)>>2;
+ src[1+1*stride]=
+ src[2+3*stride]=(lt + 2*t0 + t1 + 2)>>2;
+ src[2+1*stride]=
+ src[3+3*stride]=(t0 + 2*t1 + t2 + 2)>>2;
+ src[3+1*stride]=(t1 + 2*t2 + t3 + 2)>>2;
+ src[0+2*stride]=(lt + 2*l0 + l1 + 2)>>2;
+ src[0+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
+}
+
+static void pred4x4_vertical_left_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
- src[0+0*stride] = (t0 + t1 + 1) >> 1;
- src[1+0*stride] =
- src[0+2*stride] = (t1 + t2 + 1) >> 1;
- src[2+0*stride] =
- src[1+2*stride] = (t2 + t3 + 1) >> 1;
- src[3+0*stride] =
- src[2+2*stride] = (t3 + t4 + 1) >> 1;
- src[3+2*stride] = (t4 + t5 + 1) >> 1;
- src[0+1*stride] = (t0 + 2 * t1 + t2 + 2) >> 2;
- src[1+1*stride] =
- src[0+3*stride] = (t1 + 2 * t2 + t3 + 2) >> 2;
- src[2+1*stride] =
- src[1+3*stride] = (t2 + 2 * t3 + t4 + 2) >> 2;
- src[3+1*stride] =
- src[2+3*stride] = (t3 + 2 * t4 + t5 + 2) >> 2;
- src[3+3*stride] = (t4 + 2 * t5 + t6 + 2) >> 2;
+ src[0+0*stride]=(t0 + t1 + 1)>>1;
+ src[1+0*stride]=
+ src[0+2*stride]=(t1 + t2 + 1)>>1;
+ src[2+0*stride]=
+ src[1+2*stride]=(t2 + t3 + 1)>>1;
+ src[3+0*stride]=
+ src[2+2*stride]=(t3 + t4+ 1)>>1;
+ src[3+2*stride]=(t4 + t5+ 1)>>1;
+ src[0+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
+ src[1+1*stride]=
+ src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
+ src[2+1*stride]=
+ src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
+ src[3+1*stride]=
+ src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
+ src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
}
static void pred4x4_vertical_left_rv40(uint8_t *src, uint8_t *topright, int stride,
- const int l0, const int l1, const int l2, const int l3, const int l4)
-{
+ const int l0, const int l1, const int l2, const int l3, const int l4){
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
- src[0+0*stride] = (2 * t0 + 2 * t1 + l1 + 2 * l2 + l3 + 4) >> 3;
- src[1+0*stride] =
- src[0+2*stride] = (t1 + t2 + 1) >> 1;
- src[2+0*stride] =
- src[1+2*stride] = (t2 + t3 + 1) >> 1;
- src[3+0*stride] =
- src[2+2*stride] = (t3 + t4 + 1) >> 1;
- src[3+2*stride] = (t4 + t5 + 1) >> 1;
- src[0+1*stride] = (t0 + 2 * t1 + t2 + l2 + 2 * l3 + l4 + 4) >> 3;
- src[1+1*stride] =
- src[0+3*stride] = (t1 + 2 * t2 + t3 + 2) >> 2;
- src[2+1*stride] =
- src[1+3*stride] = (t2 + 2 * t3 + t4 + 2) >> 2;
- src[3+1*stride] =
- src[2+3*stride] = (t3 + 2 * t4 + t5 + 2) >> 2;
- src[3+3*stride] = (t4 + 2 * t5 + t6 + 2) >> 2;
-}
-
-static void pred4x4_vertical_left_rv40_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
+ src[1+0*stride]=
+ src[0+2*stride]=(t1 + t2 + 1)>>1;
+ src[2+0*stride]=
+ src[1+2*stride]=(t2 + t3 + 1)>>1;
+ src[3+0*stride]=
+ src[2+2*stride]=(t3 + t4+ 1)>>1;
+ src[3+2*stride]=(t4 + t5+ 1)>>1;
+ src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3;
+ src[1+1*stride]=
+ src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
+ src[2+1*stride]=
+ src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
+ src[3+1*stride]=
+ src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
+ src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
+}
+
+static void pred4x4_vertical_left_rv40_c(uint8_t *src, uint8_t *topright, int 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, uint8_t *topright, int stride)
-{
+static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_LEFT_EDGE
pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3);
}
-static void pred4x4_horizontal_up_c(uint8_t *src, uint8_t *topright, int stride)
-{
+static void pred4x4_horizontal_up_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_LEFT_EDGE
- src[0+0*stride] = (l0 + l1 + 1) >> 1;
- src[1+0*stride] = (l0 + 2 * l1 + l2 + 2) >> 2;
- src[2+0*stride] =
- src[0+1*stride] = (l1 + l2 + 1) >> 1;
- src[3+0*stride] =
- src[1+1*stride] = (l1 + 2 * l2 + l3 + 2) >> 2;
- src[2+1*stride] =
- src[0+2*stride] = (l2 + l3 + 1) >> 1;
- src[3+1*stride] =
- src[1+2*stride] = (l2 + 2 * l3 + l3 + 2) >> 2;
- src[3+2*stride] =
- src[1+3*stride] =
- src[0+3*stride] =
- src[2+2*stride] =
- src[2+3*stride] =
- src[3+3*stride] = l3;
-}
-
-static void pred4x4_horizontal_up_rv40_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+0*stride]=(l0 + l1 + 1)>>1;
+ src[1+0*stride]=(l0 + 2*l1 + l2 + 2)>>2;
+ src[2+0*stride]=
+ src[0+1*stride]=(l1 + l2 + 1)>>1;
+ src[3+0*stride]=
+ src[1+1*stride]=(l1 + 2*l2 + l3 + 2)>>2;
+ src[2+1*stride]=
+ src[0+2*stride]=(l2 + l3 + 1)>>1;
+ src[3+1*stride]=
+ src[1+2*stride]=(l2 + 2*l3 + l3 + 2)>>2;
+ src[3+2*stride]=
+ src[1+3*stride]=
+ src[0+3*stride]=
+ src[2+2*stride]=
+ src[2+3*stride]=
+ src[3+3*stride]=l3;
+}
+
+static void pred4x4_horizontal_up_rv40_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_LEFT_EDGE
LOAD_DOWN_LEFT_EDGE
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
- src[0+0*stride] = (t1 + 2 * t2 + t3 + 2 * l0 + 2 * l1 + 4) >> 3;
- src[1+0*stride] = (t2 + 2 * t3 + t4 + l0 + 2 * l1 + l2 + 4) >> 3;
- src[2+0*stride] =
- src[0+1*stride] = (t3 + 2 * t4 + t5 + 2 * l1 + 2 * l2 + 4) >> 3;
- src[3+0*stride] =
- src[1+1*stride] = (t4 + 2 * t5 + t6 + l1 + 2 * l2 + l3 + 4) >> 3;
- src[2+1*stride] =
- src[0+2*stride] = (t5 + 2 * t6 + t7 + 2 * l2 + 2 * l3 + 4) >> 3;
- src[3+1*stride] =
- src[1+2*stride] = (t6 + 3 * t7 + l2 + 3 * l3 + 4) >> 3;
- src[3+2*stride] =
- src[1+3*stride] = (l3 + 2 * l4 + l5 + 2) >> 2;
- src[0+3*stride] =
- src[2+2*stride] = (t6 + t7 + l3 + l4 + 2) >> 2;
- src[2+3*stride] = (l4 + l5 + 1) >> 1;
- src[3+3*stride] = (l4 + 2 * l5 + l6 + 2) >> 2;
-}
-
-static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride)
-{
+ src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
+ src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
+ src[2+0*stride]=
+ src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
+ src[3+0*stride]=
+ src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
+ src[2+1*stride]=
+ src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
+ src[3+1*stride]=
+ src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
+ src[3+2*stride]=
+ src[1+3*stride]=(l3 + 2*l4 + l5 + 2)>>2;
+ src[0+3*stride]=
+ src[2+2*stride]=(t6 + t7 + l3 + l4 + 2)>>2;
+ src[2+3*stride]=(l4 + l5 + 1)>>1;
+ src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2;
+}
+
+static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
LOAD_LEFT_EDGE
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
- src[0+0*stride] = (t1 + 2 * t2 + t3 + 2 * l0 + 2 * l1 + 4) >> 3;
- src[1+0*stride] = (t2 + 2 * t3 + t4 + l0 + 2 * l1 + l2 + 4) >> 3;
- src[2+0*stride] =
- src[0+1*stride] = (t3 + 2 * t4 + t5 + 2 * l1 + 2 * l2 + 4) >> 3;
- src[3+0*stride] =
- src[1+1*stride] = (t4 + 2 * t5 + t6 + l1 + 2 * l2 + l3 + 4) >> 3;
- src[2+1*stride] =
- src[0+2*stride] = (t5 + 2 * t6 + t7 + 2 * l2 + 2 * l3 + 4) >> 3;
- src[3+1*stride] =
- src[1+2*stride] = (t6 + 3 * t7 + l2 + 3 * l3 + 4) >> 3;
- src[3+2*stride] =
- src[1+3*stride] = l3;
- src[0+3*stride] =
- src[2+2*stride] = (t6 + t7 + 2 * l3 + 2) >> 2;
- src[2+3*stride] =
- src[3+3*stride] = l3;
-}
-
-static void pred4x4_horizontal_down_c(uint8_t *src, uint8_t *topright, int stride)
-{
- const int lt = src[-1-1*stride];
+ src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
+ src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
+ src[2+0*stride]=
+ src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
+ src[3+0*stride]=
+ src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
+ src[2+1*stride]=
+ src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
+ src[3+1*stride]=
+ src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
+ src[3+2*stride]=
+ src[1+3*stride]=l3;
+ src[0+3*stride]=
+ src[2+2*stride]=(t6 + t7 + 2*l3 + 2)>>2;
+ src[2+3*stride]=
+ src[3+3*stride]=l3;
+}
+
+static void pred4x4_horizontal_down_c(uint8_t *src, uint8_t *topright, int stride){
+ const int lt= src[-1-1*stride];
LOAD_TOP_EDGE
LOAD_LEFT_EDGE
- src[0+0*stride] =
- src[2+1*stride] = (lt + l0 + 1) >> 1;
- src[1+0*stride] =
- src[3+1*stride] = (l0 + 2 * lt + t0 + 2) >> 2;
- src[2+0*stride] = (lt + 2 * t0 + t1 + 2) >> 2;
- src[3+0*stride] = (t0 + 2 * t1 + t2 + 2) >> 2;
- src[0+1*stride] =
- src[2+2*stride] = (l0 + l1 + 1) >> 1;
- src[1+1*stride] =
- src[3+2*stride] = (lt + 2 * l0 + l1 + 2) >> 2;
- src[0+2*stride] =
- src[2+3*stride] = (l1 + l2 + 1) >> 1;
- src[1+2*stride] =
- src[3+3*stride] = (l0 + 2 * l1 + l2 + 2) >> 2;
- src[0+3*stride] = (l2 + l3 + 1) >> 1;
- src[1+3*stride] = (l1 + 2 * l2 + l3 + 2) >> 2;
-}
-
-static void pred16x16_vertical_c(uint8_t *src, int stride)
-{
+ src[0+0*stride]=
+ src[2+1*stride]=(lt + l0 + 1)>>1;
+ src[1+0*stride]=
+ src[3+1*stride]=(l0 + 2*lt + t0 + 2)>>2;
+ src[2+0*stride]=(lt + 2*t0 + t1 + 2)>>2;
+ src[3+0*stride]=(t0 + 2*t1 + t2 + 2)>>2;
+ src[0+1*stride]=
+ src[2+2*stride]=(l0 + l1 + 1)>>1;
+ src[1+1*stride]=
+ src[3+2*stride]=(lt + 2*l0 + l1 + 2)>>2;
+ src[0+2*stride]=
+ src[2+3*stride]=(l1 + l2+ 1)>>1;
+ src[1+2*stride]=
+ src[3+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
+ src[0+3*stride]=(l2 + l3 + 1)>>1;
+ src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2;
+}
+
+static void pred16x16_vertical_c(uint8_t *src, int stride){
int i;
- const uint32_t a = ((uint32_t*)(src - stride))[0];
- const uint32_t b = ((uint32_t*)(src - stride))[1];
- const uint32_t c = ((uint32_t*)(src - stride))[2];
- const uint32_t d = ((uint32_t*)(src - stride))[3];
-
- for(i = 0; i < 16; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = a;
- ((uint32_t*)(src + i * stride))[1] = b;
- ((uint32_t*)(src + i * stride))[2] = c;
- ((uint32_t*)(src + i * stride))[3] = d;
+ const uint32_t a= ((uint32_t*)(src-stride))[0];
+ const uint32_t b= ((uint32_t*)(src-stride))[1];
+ const uint32_t c= ((uint32_t*)(src-stride))[2];
+ const uint32_t d= ((uint32_t*)(src-stride))[3];
+
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]= a;
+ ((uint32_t*)(src+i*stride))[1]= b;
+ ((uint32_t*)(src+i*stride))[2]= c;
+ ((uint32_t*)(src+i*stride))[3]= d;
}
}
-static void pred16x16_horizontal_c(uint8_t *src, int stride)
-{
+static void pred16x16_horizontal_c(uint8_t *src, int stride){
int i;
- for(i = 0; i < 16; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] =
- ((uint32_t*)(src + i * stride))[2] =
- ((uint32_t*)(src + i * stride))[3] = src[-1+i*stride] * 0x01010101;
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= src[-1+i*stride]*0x01010101;
}
}
-static void pred16x16_dc_c(uint8_t *src, int stride)
-{
- int i, dc = 0;
+static void pred16x16_dc_c(uint8_t *src, int stride){
+ int i, dc=0;
- for(i = 0; i < 16; i++)
- {
- dc += src[-1+i*stride];
+ for(i=0;i<16; i++){
+ dc+= src[-1+i*stride];
}
- for(i = 0; i < 16; i++)
- {
- dc += src[i-stride];
+ for(i=0;i<16; i++){
+ dc+= src[i-stride];
}
- dc = 0x01010101 * ((dc + 16) >> 5);
+ dc= 0x01010101*((dc + 16)>>5);
- for(i = 0; i < 16; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] =
- ((uint32_t*)(src + i * stride))[2] =
- ((uint32_t*)(src + i * stride))[3] = dc;
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= dc;
}
}
-static void pred16x16_left_dc_c(uint8_t *src, int stride)
-{
- int i, dc = 0;
+static void pred16x16_left_dc_c(uint8_t *src, int stride){
+ int i, dc=0;
- for(i = 0; i < 16; i++)
- {
- dc += src[-1+i*stride];
+ for(i=0;i<16; i++){
+ dc+= src[-1+i*stride];
}
- dc = 0x01010101 * ((dc + 8) >> 4);
+ dc= 0x01010101*((dc + 8)>>4);
- for(i = 0; i < 16; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] =
- ((uint32_t*)(src + i * stride))[2] =
- ((uint32_t*)(src + i * stride))[3] = dc;
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= dc;
}
}
-static void pred16x16_top_dc_c(uint8_t *src, int stride)
-{
- int i, dc = 0;
+static void pred16x16_top_dc_c(uint8_t *src, int stride){
+ int i, dc=0;
- for(i = 0; i < 16; i++)
- {
- dc += src[i-stride];
+ for(i=0;i<16; i++){
+ dc+= src[i-stride];
}
- dc = 0x01010101 * ((dc + 8) >> 4);
-
- for(i = 0; i < 16; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] =
- ((uint32_t*)(src + i * stride))[2] =
- ((uint32_t*)(src + i * stride))[3] = dc;
+ dc= 0x01010101*((dc + 8)>>4);
+
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= dc;
}
}
-static void pred16x16_128_dc_c(uint8_t *src, int stride)
-{
+static void pred16x16_128_dc_c(uint8_t *src, int stride){
int i;
- for(i = 0; i < 16; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] =
- ((uint32_t*)(src + i * stride))[2] =
- ((uint32_t*)(src + i * stride))[3] = 0x01010101U * 128U;
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= 0x01010101U*128U;
}
}
-static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int svq3, const int rv40)
-{
- int i, j, k;
- int a;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- const uint8_t * const src0 = src + 7 - stride;
- const uint8_t *src1 = src + 8 * stride - 1;
- const uint8_t *src2 = src1 - 2 * stride; // == src+6*stride-1;
- int H = src0[1] - src0[-1];
- int V = src1[0] - src2[ 0];
- for(k = 2; k <= 8; ++k)
- {
- src1 += stride;
- src2 -= stride;
- H += k * (src0[k] - src0[-k]);
- V += k * (src1[0] - src2[ 0]);
- }
- if(svq3)
- {
- H = (5 * (H / 4)) / 16;
- V = (5 * (V / 4)) / 16;
-
- /* required for 100% accuracy */
- i = H;
- H = V;
- V = i;
- }
- else if(rv40)
- {
- H = (H + (H >> 2)) >> 4;
- V = (V + (V >> 2)) >> 4;
- }
- else
- {
- H = (5 * H + 32) >> 6;
- V = (5 * V + 32) >> 6;
- }
-
- a = 16 * (src1[0] + src2[16] + 1) - 7 * (V + H);
- for(j = 16; j > 0; --j)
- {
- int b = a;
- a += V;
- for(i = -16; i < 0; i += 4)
- {
- src[16+i] = cm[(b) >> 5 ];
- src[17+i] = cm[(b+ H) >> 5 ];
- src[18+i] = cm[(b+2*H) >> 5 ];
- src[19+i] = cm[(b+3*H) >> 5 ];
- b += 4 * H;
- }
- src += stride;
+static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int svq3, const int rv40){
+ int i, j, k;
+ int a;
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+ const uint8_t * const src0 = src+7-stride;
+ const uint8_t *src1 = src+8*stride-1;
+ const uint8_t *src2 = src1-2*stride; // == src+6*stride-1;
+ int H = src0[1] - src0[-1];
+ int V = src1[0] - src2[ 0];
+ for(k=2; k<=8; ++k) {
+ src1 += stride; src2 -= stride;
+ H += k*(src0[k] - src0[-k]);
+ V += k*(src1[0] - src2[ 0]);
+ }
+ if(svq3){
+ H = ( 5*(H/4) ) / 16;
+ V = ( 5*(V/4) ) / 16;
+
+ /* required for 100% accuracy */
+ i = H; H = V; V = i;
+ }else if(rv40){
+ H = ( H + (H>>2) ) >> 4;
+ V = ( V + (V>>2) ) >> 4;
+ }else{
+ H = ( 5*H+32 ) >> 6;
+ V = ( 5*V+32 ) >> 6;
+ }
+
+ a = 16*(src1[0] + src2[16] + 1) - 7*(V+H);
+ for(j=16; j>0; --j) {
+ int b = a;
+ a += V;
+ for(i=-16; i<0; i+=4) {
+ src[16+i] = cm[ (b ) >> 5 ];
+ src[17+i] = cm[ (b+ H) >> 5 ];
+ src[18+i] = cm[ (b+2*H) >> 5 ];
+ src[19+i] = cm[ (b+3*H) >> 5 ];
+ b += 4*H;
}
+ src += stride;
+ }
}
-static void pred16x16_plane_c(uint8_t *src, int stride)
-{
+static void pred16x16_plane_c(uint8_t *src, int stride){
pred16x16_plane_compat_c(src, stride, 0, 0);
}
-static void pred16x16_plane_svq3_c(uint8_t *src, int stride)
-{
+static void pred16x16_plane_svq3_c(uint8_t *src, int stride){
pred16x16_plane_compat_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, int stride){
pred16x16_plane_compat_c(src, stride, 0, 1);
}
-static void pred8x8_vertical_c(uint8_t *src, int stride)
-{
+static void pred8x8_vertical_c(uint8_t *src, int stride){
int i;
- const uint32_t a = ((uint32_t*)(src - stride))[0];
- const uint32_t b = ((uint32_t*)(src - stride))[1];
+ const uint32_t a= ((uint32_t*)(src-stride))[0];
+ const uint32_t b= ((uint32_t*)(src-stride))[1];
- for(i = 0; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = a;
- ((uint32_t*)(src + i * stride))[1] = b;
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]= a;
+ ((uint32_t*)(src+i*stride))[1]= b;
}
}
-static void pred8x8_horizontal_c(uint8_t *src, int stride)
-{
+static void pred8x8_horizontal_c(uint8_t *src, int stride){
int i;
- for(i = 0; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] = src[-1+i*stride] * 0x01010101;
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= src[-1+i*stride]*0x01010101;
}
}
-static void pred8x8_128_dc_c(uint8_t *src, int stride)
-{
+static void pred8x8_128_dc_c(uint8_t *src, int stride){
int i;
- for(i = 0; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] = 0x01010101U * 128U;
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= 0x01010101U*128U;
}
}
-static void pred8x8_left_dc_c(uint8_t *src, int stride)
-{
+static void pred8x8_left_dc_c(uint8_t *src, int stride){
int i;
int dc0, dc2;
- dc0 = dc2 = 0;
- for(i = 0; i < 4; i++)
- {
- dc0 += src[-1+i*stride];
- dc2 += src[-1+(i+4)*stride];
+ dc0=dc2=0;
+ for(i=0;i<4; i++){
+ dc0+= src[-1+i*stride];
+ dc2+= src[-1+(i+4)*stride];
}
- dc0 = 0x01010101 * ((dc0 + 2) >> 2);
- dc2 = 0x01010101 * ((dc2 + 2) >> 2);
+ dc0= 0x01010101*((dc0 + 2)>>2);
+ dc2= 0x01010101*((dc2 + 2)>>2);
- for(i = 0; i < 4; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] = dc0;
+ for(i=0; i<4; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= dc0;
}
- for(i = 4; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] = dc2;
+ for(i=4; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= dc2;
}
}
-static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride)
-{
+static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
int i;
int dc0;
- dc0 = 0;
- for(i = 0; i < 8; i++)
- dc0 += src[-1+i*stride];
- dc0 = 0x01010101 * ((dc0 + 4) >> 3);
+ dc0=0;
+ for(i=0;i<8; i++)
+ dc0+= src[-1+i*stride];
+ dc0= 0x01010101*((dc0 + 4)>>3);
- for(i = 0; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] = dc0;
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= dc0;
}
}
-static void pred8x8_top_dc_c(uint8_t *src, int stride)
-{
+static void pred8x8_top_dc_c(uint8_t *src, int stride){
int i;
int dc0, dc1;
- dc0 = dc1 = 0;
- for(i = 0; i < 4; i++)
- {
- dc0 += src[i-stride];
- dc1 += src[4+i-stride];
+ dc0=dc1=0;
+ for(i=0;i<4; i++){
+ dc0+= src[i-stride];
+ dc1+= src[4+i-stride];
}
- dc0 = 0x01010101 * ((dc0 + 2) >> 2);
- dc1 = 0x01010101 * ((dc1 + 2) >> 2);
+ dc0= 0x01010101*((dc0 + 2)>>2);
+ dc1= 0x01010101*((dc1 + 2)>>2);
- for(i = 0; i < 4; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = dc0;
- ((uint32_t*)(src + i * stride))[1] = dc1;
+ for(i=0; i<4; i++){
+ ((uint32_t*)(src+i*stride))[0]= dc0;
+ ((uint32_t*)(src+i*stride))[1]= dc1;
}
- for(i = 4; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = dc0;
- ((uint32_t*)(src + i * stride))[1] = dc1;
+ for(i=4; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]= dc0;
+ ((uint32_t*)(src+i*stride))[1]= dc1;
}
}
-static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride)
-{
+static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
int i;
int dc0;
- dc0 = 0;
- for(i = 0; i < 8; i++)
- dc0 += src[i-stride];
- dc0 = 0x01010101 * ((dc0 + 4) >> 3);
+ dc0=0;
+ for(i=0;i<8; i++)
+ dc0+= src[i-stride];
+ dc0= 0x01010101*((dc0 + 4)>>3);
- for(i = 0; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] =
- ((uint32_t*)(src + i * stride))[1] = dc0;
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= dc0;
}
}
-static void pred8x8_dc_c(uint8_t *src, int stride)
-{
+static void pred8x8_dc_c(uint8_t *src, int stride){
int i;
int dc0, dc1, dc2, dc3;
- dc0 = dc1 = dc2 = 0;
- for(i = 0; i < 4; i++)
- {
- dc0 += src[-1+i*stride] + src[i-stride];
- dc1 += src[4+i-stride];
- dc2 += src[-1+(i+4)*stride];
+ dc0=dc1=dc2=0;
+ for(i=0;i<4; i++){
+ dc0+= src[-1+i*stride] + src[i-stride];
+ dc1+= src[4+i-stride];
+ dc2+= src[-1+(i+4)*stride];
}
- dc3 = 0x01010101 * ((dc1 + dc2 + 4) >> 3);
- dc0 = 0x01010101 * ((dc0 + 4) >> 3);
- dc1 = 0x01010101 * ((dc1 + 2) >> 2);
- dc2 = 0x01010101 * ((dc2 + 2) >> 2);
-
- for(i = 0; i < 4; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = dc0;
- ((uint32_t*)(src + i * stride))[1] = dc1;
+ dc3= 0x01010101*((dc1 + dc2 + 4)>>3);
+ dc0= 0x01010101*((dc0 + 4)>>3);
+ dc1= 0x01010101*((dc1 + 2)>>2);
+ dc2= 0x01010101*((dc2 + 2)>>2);
+
+ for(i=0; i<4; i++){
+ ((uint32_t*)(src+i*stride))[0]= dc0;
+ ((uint32_t*)(src+i*stride))[1]= dc1;
}
- for(i = 4; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = dc2;
- ((uint32_t*)(src + i * stride))[1] = dc3;
+ for(i=4; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]= dc2;
+ ((uint32_t*)(src+i*stride))[1]= dc3;
}
}
//the following 4 function should not be optimized!
-static void pred8x8_mad_cow_dc_l0t(uint8_t *src, int stride)
-{
+static void pred8x8_mad_cow_dc_l0t(uint8_t *src, int stride){
pred8x8_top_dc_c(src, stride);
pred4x4_dc_c(src, NULL, stride);
}
-static void pred8x8_mad_cow_dc_0lt(uint8_t *src, int stride)
-{
+static void pred8x8_mad_cow_dc_0lt(uint8_t *src, int stride){
pred8x8_dc_c(src, stride);
pred4x4_top_dc_c(src, NULL, stride);
}
-static void pred8x8_mad_cow_dc_l00(uint8_t *src, int stride)
-{
+static void pred8x8_mad_cow_dc_l00(uint8_t *src, int stride){
pred8x8_left_dc_c(src, stride);
- pred4x4_128_dc_c(src + 4 * stride , NULL, stride);
- pred4x4_128_dc_c(src + 4 * stride + 4, NULL, stride);
+ pred4x4_128_dc_c(src + 4*stride , NULL, stride);
+ pred4x4_128_dc_c(src + 4*stride + 4, NULL, stride);
}
-static void pred8x8_mad_cow_dc_0l0(uint8_t *src, int stride)
-{
+static void pred8x8_mad_cow_dc_0l0(uint8_t *src, int stride){
pred8x8_left_dc_c(src, stride);
pred4x4_128_dc_c(src , NULL, stride);
pred4x4_128_dc_c(src + 4, NULL, stride);
}
-static void pred8x8_dc_rv40_c(uint8_t *src, int stride)
-{
+static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
int i;
- int dc0 = 0;
+ int dc0=0;
- for(i = 0; i < 4; i++)
- {
- dc0 += src[-1+i*stride] + src[i-stride];
- dc0 += src[4+i-stride];
- dc0 += src[-1+(i+4)*stride];
+ for(i=0;i<4; i++){
+ dc0+= src[-1+i*stride] + src[i-stride];
+ dc0+= src[4+i-stride];
+ dc0+= src[-1+(i+4)*stride];
}
- dc0 = 0x01010101 * ((dc0 + 8) >> 4);
+ dc0= 0x01010101*((dc0 + 8)>>4);
- for(i = 0; i < 4; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = dc0;
- ((uint32_t*)(src + i * stride))[1] = dc0;
+ for(i=0; i<4; i++){
+ ((uint32_t*)(src+i*stride))[0]= dc0;
+ ((uint32_t*)(src+i*stride))[1]= dc0;
}
- for(i = 4; i < 8; i++)
- {
- ((uint32_t*)(src + i * stride))[0] = dc0;
- ((uint32_t*)(src + i * stride))[1] = dc0;
+ for(i=4; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]= dc0;
+ ((uint32_t*)(src+i*stride))[1]= dc0;
}
}
-static void pred8x8_plane_c(uint8_t *src, int stride)
-{
- int j, k;
- int a;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- const uint8_t * const src0 = src + 3 - stride;
- const uint8_t *src1 = src + 4 * stride - 1;
- const uint8_t *src2 = src1 - 2 * stride; // == src+2*stride-1;
- int H = src0[1] - src0[-1];
- int V = src1[0] - src2[ 0];
- for(k = 2; k <= 4; ++k)
- {
- src1 += stride;
- src2 -= stride;
- H += k * (src0[k] - src0[-k]);
- V += k * (src1[0] - src2[ 0]);
- }
- H = (17 * H + 16) >> 5;
- V = (17 * V + 16) >> 5;
-
- a = 16 * (src1[0] + src2[8] + 1) - 3 * (V + H);
- for(j = 8; j > 0; --j)
- {
- int b = a;
- a += V;
- src[0] = cm[(b) >> 5 ];
- src[1] = cm[(b+ H) >> 5 ];
- src[2] = cm[(b+2*H) >> 5 ];
- src[3] = cm[(b+3*H) >> 5 ];
- src[4] = cm[(b+4*H) >> 5 ];
- src[5] = cm[(b+5*H) >> 5 ];
- src[6] = cm[(b+6*H) >> 5 ];
- src[7] = cm[(b+7*H) >> 5 ];
- src += stride;
- }
+static void pred8x8_plane_c(uint8_t *src, int stride){
+ int j, k;
+ int a;
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+ const uint8_t * const src0 = src+3-stride;
+ const uint8_t *src1 = src+4*stride-1;
+ const uint8_t *src2 = src1-2*stride; // == src+2*stride-1;
+ int H = src0[1] - src0[-1];
+ int V = src1[0] - src2[ 0];
+ for(k=2; k<=4; ++k) {
+ src1 += stride; src2 -= stride;
+ H += k*(src0[k] - src0[-k]);
+ V += k*(src1[0] - src2[ 0]);
+ }
+ H = ( 17*H+16 ) >> 5;
+ V = ( 17*V+16 ) >> 5;
+
+ a = 16*(src1[0] + src2[8]+1) - 3*(V+H);
+ for(j=8; j>0; --j) {
+ int b = a;
+ a += V;
+ src[0] = cm[ (b ) >> 5 ];
+ src[1] = cm[ (b+ H) >> 5 ];
+ src[2] = cm[ (b+2*H) >> 5 ];
+ src[3] = cm[ (b+3*H) >> 5 ];
+ src[4] = cm[ (b+4*H) >> 5 ];
+ src[5] = cm[ (b+5*H) >> 5 ];
+ src[6] = cm[ (b+6*H) >> 5 ];
+ src[7] = cm[ (b+7*H) >> 5 ];
+ src += stride;
+ }
}
#define SRC(x,y) src[(x)+(y)*stride]
@@ -875,21 +790,21 @@ static void pred8x8l_128_dc_c(uint8_t *src, int has_topleft, int has_topright, i
static void pred8x8l_left_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_LEFT;
- const uint32_t dc = ((l0 + l1 + l2 + l3 + l4 + l5 + l6 + l7 + 4) >> 3) * 0x01010101;
+ const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3) * 0x01010101;
PREDICT_8x8_DC(dc);
}
static void pred8x8l_top_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
- const uint32_t dc = ((t0 + t1 + t2 + t3 + t4 + t5 + t6 + t7 + 4) >> 3) * 0x01010101;
+ const uint32_t dc = ((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3) * 0x01010101;
PREDICT_8x8_DC(dc);
}
static void pred8x8l_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_LEFT;
PREDICT_8x8_LOAD_TOP;
- const uint32_t dc = ((l0 + l1 + l2 + l3 + l4 + l5 + l6 + l7
- + t0 + t1 + t2 + t3 + t4 + t5 + t6 + t7 + 8) >> 4) * 0x01010101;
+ const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7
+ +t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4) * 0x01010101;
PREDICT_8x8_DC(dc);
}
static void pred8x8l_horizontal_c(uint8_t *src, int has_topleft, int has_topright, int stride)
@@ -897,14 +812,7 @@ static void pred8x8l_horizontal_c(uint8_t *src, int has_topleft, int has_toprigh
PREDICT_8x8_LOAD_LEFT;
#define ROW(y) ((uint32_t*)(src+y*stride))[0] =\
((uint32_t*)(src+y*stride))[1] = 0x01010101 * l##y
- ROW(0);
- ROW(1);
- ROW(2);
- ROW(3);
- ROW(4);
- ROW(5);
- ROW(6);
- ROW(7);
+ ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7);
#undef ROW
}
static void pred8x8l_vertical_c(uint8_t *src, int has_topleft, int has_topright, int stride)
@@ -919,49 +827,49 @@ static void pred8x8l_vertical_c(uint8_t *src, int has_topleft, int has_topright,
src[5] = t5;
src[6] = t6;
src[7] = t7;
- for(y = 1; y < 8; y++)
- *(uint64_t*)(src + y * stride) = *(uint64_t*)src;
+ for( y = 1; y < 8; y++ )
+ *(uint64_t*)(src+y*stride) = *(uint64_t*)src;
}
static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_TOPRIGHT;
- SRC(0, 0) = (t0 + 2 * t1 + t2 + 2) >> 2;
- SRC(0, 1) = SRC(1, 0) = (t1 + 2 * t2 + t3 + 2) >> 2;
- SRC(0, 2) = SRC(1, 1) = SRC(2, 0) = (t2 + 2 * t3 + t4 + 2) >> 2;
- SRC(0, 3) = SRC(1, 2) = SRC(2, 1) = SRC(3, 0) = (t3 + 2 * t4 + t5 + 2) >> 2;
- SRC(0, 4) = SRC(1, 3) = SRC(2, 2) = SRC(3, 1) = SRC(4, 0) = (t4 + 2 * t5 + t6 + 2) >> 2;
- SRC(0, 5) = SRC(1, 4) = SRC(2, 3) = SRC(3, 2) = SRC(4, 1) = SRC(5, 0) = (t5 + 2 * t6 + t7 + 2) >> 2;
- SRC(0, 6) = SRC(1, 5) = SRC(2, 4) = SRC(3, 3) = SRC(4, 2) = SRC(5, 1) = SRC(6, 0) = (t6 + 2 * t7 + t8 + 2) >> 2;
- SRC(0, 7) = SRC(1, 6) = SRC(2, 5) = SRC(3, 4) = SRC(4, 3) = SRC(5, 2) = SRC(6, 1) = SRC(7, 0) = (t7 + 2 * t8 + t9 + 2) >> 2;
- SRC(1, 7) = SRC(2, 6) = SRC(3, 5) = SRC(4, 4) = SRC(5, 3) = SRC(6, 2) = SRC(7, 1) = (t8 + 2 * t9 + t10 + 2) >> 2;
- SRC(2, 7) = SRC(3, 6) = SRC(4, 5) = SRC(5, 4) = SRC(6, 3) = SRC(7, 2) = (t9 + 2 * t10 + t11 + 2) >> 2;
- SRC(3, 7) = SRC(4, 6) = SRC(5, 5) = SRC(6, 4) = SRC(7, 3) = (t10 + 2 * t11 + t12 + 2) >> 2;
- SRC(4, 7) = SRC(5, 6) = SRC(6, 5) = SRC(7, 4) = (t11 + 2 * t12 + t13 + 2) >> 2;
- SRC(5, 7) = SRC(6, 6) = SRC(7, 5) = (t12 + 2 * t13 + t14 + 2) >> 2;
- SRC(6, 7) = SRC(7, 6) = (t13 + 2 * t14 + t15 + 2) >> 2;
- SRC(7, 7) = (t14 + 3 * t15 + 2) >> 2;
+ SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2;
+ SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2;
+ SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2;
+ SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2;
+ SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2;
+ SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2;
+ SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2;
+ SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2;
+ SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= (t8 + 2*t9 + t10 + 2) >> 2;
+ SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2;
+ SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2;
+ SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2;
+ SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2;
+ SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2;
+ SRC(7,7)= (t14 + 3*t15 + 2) >> 2;
}
static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_LEFT;
PREDICT_8x8_LOAD_TOPLEFT;
- SRC(0, 7) = (l7 + 2 * l6 + l5 + 2) >> 2;
- SRC(0, 6) = SRC(1, 7) = (l6 + 2 * l5 + l4 + 2) >> 2;
- SRC(0, 5) = SRC(1, 6) = SRC(2, 7) = (l5 + 2 * l4 + l3 + 2) >> 2;
- SRC(0, 4) = SRC(1, 5) = SRC(2, 6) = SRC(3, 7) = (l4 + 2 * l3 + l2 + 2) >> 2;
- SRC(0, 3) = SRC(1, 4) = SRC(2, 5) = SRC(3, 6) = SRC(4, 7) = (l3 + 2 * l2 + l1 + 2) >> 2;
- SRC(0, 2) = SRC(1, 3) = SRC(2, 4) = SRC(3, 5) = SRC(4, 6) = SRC(5, 7) = (l2 + 2 * l1 + l0 + 2) >> 2;
- SRC(0, 1) = SRC(1, 2) = SRC(2, 3) = SRC(3, 4) = SRC(4, 5) = SRC(5, 6) = SRC(6, 7) = (l1 + 2 * l0 + lt + 2) >> 2;
- SRC(0, 0) = SRC(1, 1) = SRC(2, 2) = SRC(3, 3) = SRC(4, 4) = SRC(5, 5) = SRC(6, 6) = SRC(7, 7) = (l0 + 2 * lt + t0 + 2) >> 2;
- SRC(1, 0) = SRC(2, 1) = SRC(3, 2) = SRC(4, 3) = SRC(5, 4) = SRC(6, 5) = SRC(7, 6) = (lt + 2 * t0 + t1 + 2) >> 2;
- SRC(2, 0) = SRC(3, 1) = SRC(4, 2) = SRC(5, 3) = SRC(6, 4) = SRC(7, 5) = (t0 + 2 * t1 + t2 + 2) >> 2;
- SRC(3, 0) = SRC(4, 1) = SRC(5, 2) = SRC(6, 3) = SRC(7, 4) = (t1 + 2 * t2 + t3 + 2) >> 2;
- SRC(4, 0) = SRC(5, 1) = SRC(6, 2) = SRC(7, 3) = (t2 + 2 * t3 + t4 + 2) >> 2;
- SRC(5, 0) = SRC(6, 1) = SRC(7, 2) = (t3 + 2 * t4 + t5 + 2) >> 2;
- SRC(6, 0) = SRC(7, 1) = (t4 + 2 * t5 + t6 + 2) >> 2;
- SRC(7, 0) = (t5 + 2 * t6 + t7 + 2) >> 2;
+ SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2;
+ SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2;
+ SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2;
+ SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2;
+ SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2;
+ SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2;
+ SRC(0,1)=SRC(1,2)=SRC(2,3)=SRC(3,4)=SRC(4,5)=SRC(5,6)=SRC(6,7)= (l1 + 2*l0 + lt + 2) >> 2;
+ SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)=SRC(4,4)=SRC(5,5)=SRC(6,6)=SRC(7,7)= (l0 + 2*lt + t0 + 2) >> 2;
+ SRC(1,0)=SRC(2,1)=SRC(3,2)=SRC(4,3)=SRC(5,4)=SRC(6,5)=SRC(7,6)= (lt + 2*t0 + t1 + 2) >> 2;
+ SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2;
+ SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2;
+ SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2;
+ SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2;
+ SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2;
+ SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2;
}
static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
@@ -969,105 +877,105 @@ static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_top
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_LEFT;
PREDICT_8x8_LOAD_TOPLEFT;
- SRC(0, 6) = (l5 + 2 * l4 + l3 + 2) >> 2;
- SRC(0, 7) = (l6 + 2 * l5 + l4 + 2) >> 2;
- SRC(0, 4) = SRC(1, 6) = (l3 + 2 * l2 + l1 + 2) >> 2;
- SRC(0, 5) = SRC(1, 7) = (l4 + 2 * l3 + l2 + 2) >> 2;
- SRC(0, 2) = SRC(1, 4) = SRC(2, 6) = (l1 + 2 * l0 + lt + 2) >> 2;
- SRC(0, 3) = SRC(1, 5) = SRC(2, 7) = (l2 + 2 * l1 + l0 + 2) >> 2;
- SRC(0, 1) = SRC(1, 3) = SRC(2, 5) = SRC(3, 7) = (l0 + 2 * lt + t0 + 2) >> 2;
- SRC(0, 0) = SRC(1, 2) = SRC(2, 4) = SRC(3, 6) = (lt + t0 + 1) >> 1;
- SRC(1, 1) = SRC(2, 3) = SRC(3, 5) = SRC(4, 7) = (lt + 2 * t0 + t1 + 2) >> 2;
- SRC(1, 0) = SRC(2, 2) = SRC(3, 4) = SRC(4, 6) = (t0 + t1 + 1) >> 1;
- SRC(2, 1) = SRC(3, 3) = SRC(4, 5) = SRC(5, 7) = (t0 + 2 * t1 + t2 + 2) >> 2;
- SRC(2, 0) = SRC(3, 2) = SRC(4, 4) = SRC(5, 6) = (t1 + t2 + 1) >> 1;
- SRC(3, 1) = SRC(4, 3) = SRC(5, 5) = SRC(6, 7) = (t1 + 2 * t2 + t3 + 2) >> 2;
- SRC(3, 0) = SRC(4, 2) = SRC(5, 4) = SRC(6, 6) = (t2 + t3 + 1) >> 1;
- SRC(4, 1) = SRC(5, 3) = SRC(6, 5) = SRC(7, 7) = (t2 + 2 * t3 + t4 + 2) >> 2;
- SRC(4, 0) = SRC(5, 2) = SRC(6, 4) = SRC(7, 6) = (t3 + t4 + 1) >> 1;
- SRC(5, 1) = SRC(6, 3) = SRC(7, 5) = (t3 + 2 * t4 + t5 + 2) >> 2;
- SRC(5, 0) = SRC(6, 2) = SRC(7, 4) = (t4 + t5 + 1) >> 1;
- SRC(6, 1) = SRC(7, 3) = (t4 + 2 * t5 + t6 + 2) >> 2;
- SRC(6, 0) = SRC(7, 2) = (t5 + t6 + 1) >> 1;
- SRC(7, 1) = (t5 + 2 * t6 + t7 + 2) >> 2;
- SRC(7, 0) = (t6 + t7 + 1) >> 1;
+ SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2;
+ SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2;
+ SRC(0,4)=SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2;
+ SRC(0,5)=SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2;
+ SRC(0,2)=SRC(1,4)=SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2;
+ SRC(0,3)=SRC(1,5)=SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2;
+ SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= (l0 + 2*lt + t0 + 2) >> 2;
+ SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= (lt + t0 + 1) >> 1;
+ SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= (lt + 2*t0 + t1 + 2) >> 2;
+ SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= (t0 + t1 + 1) >> 1;
+ SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= (t0 + 2*t1 + t2 + 2) >> 2;
+ SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= (t1 + t2 + 1) >> 1;
+ SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= (t1 + 2*t2 + t3 + 2) >> 2;
+ SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= (t2 + t3 + 1) >> 1;
+ SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= (t2 + 2*t3 + t4 + 2) >> 2;
+ SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= (t3 + t4 + 1) >> 1;
+ SRC(5,1)=SRC(6,3)=SRC(7,5)= (t3 + 2*t4 + t5 + 2) >> 2;
+ SRC(5,0)=SRC(6,2)=SRC(7,4)= (t4 + t5 + 1) >> 1;
+ SRC(6,1)=SRC(7,3)= (t4 + 2*t5 + t6 + 2) >> 2;
+ SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1;
+ SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2;
+ SRC(7,0)= (t6 + t7 + 1) >> 1;
}
static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_LEFT;
PREDICT_8x8_LOAD_TOPLEFT;
- SRC(0, 7) = (l6 + l7 + 1) >> 1;
- SRC(1, 7) = (l5 + 2 * l6 + l7 + 2) >> 2;
- SRC(0, 6) = SRC(2, 7) = (l5 + l6 + 1) >> 1;
- SRC(1, 6) = SRC(3, 7) = (l4 + 2 * l5 + l6 + 2) >> 2;
- SRC(0, 5) = SRC(2, 6) = SRC(4, 7) = (l4 + l5 + 1) >> 1;
- SRC(1, 5) = SRC(3, 6) = SRC(5, 7) = (l3 + 2 * l4 + l5 + 2) >> 2;
- SRC(0, 4) = SRC(2, 5) = SRC(4, 6) = SRC(6, 7) = (l3 + l4 + 1) >> 1;
- SRC(1, 4) = SRC(3, 5) = SRC(5, 6) = SRC(7, 7) = (l2 + 2 * l3 + l4 + 2) >> 2;
- SRC(0, 3) = SRC(2, 4) = SRC(4, 5) = SRC(6, 6) = (l2 + l3 + 1) >> 1;
- SRC(1, 3) = SRC(3, 4) = SRC(5, 5) = SRC(7, 6) = (l1 + 2 * l2 + l3 + 2) >> 2;
- SRC(0, 2) = SRC(2, 3) = SRC(4, 4) = SRC(6, 5) = (l1 + l2 + 1) >> 1;
- SRC(1, 2) = SRC(3, 3) = SRC(5, 4) = SRC(7, 5) = (l0 + 2 * l1 + l2 + 2) >> 2;
- SRC(0, 1) = SRC(2, 2) = SRC(4, 3) = SRC(6, 4) = (l0 + l1 + 1) >> 1;
- SRC(1, 1) = SRC(3, 2) = SRC(5, 3) = SRC(7, 4) = (lt + 2 * l0 + l1 + 2) >> 2;
- SRC(0, 0) = SRC(2, 1) = SRC(4, 2) = SRC(6, 3) = (lt + l0 + 1) >> 1;
- SRC(1, 0) = SRC(3, 1) = SRC(5, 2) = SRC(7, 3) = (l0 + 2 * lt + t0 + 2) >> 2;
- SRC(2, 0) = SRC(4, 1) = SRC(6, 2) = (t1 + 2 * t0 + lt + 2) >> 2;
- SRC(3, 0) = SRC(5, 1) = SRC(7, 2) = (t2 + 2 * t1 + t0 + 2) >> 2;
- SRC(4, 0) = SRC(6, 1) = (t3 + 2 * t2 + t1 + 2) >> 2;
- SRC(5, 0) = SRC(7, 1) = (t4 + 2 * t3 + t2 + 2) >> 2;
- SRC(6, 0) = (t5 + 2 * t4 + t3 + 2) >> 2;
- SRC(7, 0) = (t6 + 2 * t5 + t4 + 2) >> 2;
+ SRC(0,7)= (l6 + l7 + 1) >> 1;
+ SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2;
+ SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1;
+ SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2;
+ SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1;
+ SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2;
+ SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1;
+ SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2;
+ SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1;
+ SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2;
+ SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1;
+ SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2;
+ SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1;
+ SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2;
+ SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1;
+ SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2;
+ SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2;
+ SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2;
+ SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2;
+ SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2;
+ SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2;
+ SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2;
}
static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_TOPRIGHT;
- SRC(0, 0) = (t0 + t1 + 1) >> 1;
- SRC(0, 1) = (t0 + 2 * t1 + t2 + 2) >> 2;
- SRC(0, 2) = SRC(1, 0) = (t1 + t2 + 1) >> 1;
- SRC(0, 3) = SRC(1, 1) = (t1 + 2 * t2 + t3 + 2) >> 2;
- SRC(0, 4) = SRC(1, 2) = SRC(2, 0) = (t2 + t3 + 1) >> 1;
- SRC(0, 5) = SRC(1, 3) = SRC(2, 1) = (t2 + 2 * t3 + t4 + 2) >> 2;
- SRC(0, 6) = SRC(1, 4) = SRC(2, 2) = SRC(3, 0) = (t3 + t4 + 1) >> 1;
- SRC(0, 7) = SRC(1, 5) = SRC(2, 3) = SRC(3, 1) = (t3 + 2 * t4 + t5 + 2) >> 2;
- SRC(1, 6) = SRC(2, 4) = SRC(3, 2) = SRC(4, 0) = (t4 + t5 + 1) >> 1;
- SRC(1, 7) = SRC(2, 5) = SRC(3, 3) = SRC(4, 1) = (t4 + 2 * t5 + t6 + 2) >> 2;
- SRC(2, 6) = SRC(3, 4) = SRC(4, 2) = SRC(5, 0) = (t5 + t6 + 1) >> 1;
- SRC(2, 7) = SRC(3, 5) = SRC(4, 3) = SRC(5, 1) = (t5 + 2 * t6 + t7 + 2) >> 2;
- SRC(3, 6) = SRC(4, 4) = SRC(5, 2) = SRC(6, 0) = (t6 + t7 + 1) >> 1;
- SRC(3, 7) = SRC(4, 5) = SRC(5, 3) = SRC(6, 1) = (t6 + 2 * t7 + t8 + 2) >> 2;
- SRC(4, 6) = SRC(5, 4) = SRC(6, 2) = SRC(7, 0) = (t7 + t8 + 1) >> 1;
- SRC(4, 7) = SRC(5, 5) = SRC(6, 3) = SRC(7, 1) = (t7 + 2 * t8 + t9 + 2) >> 2;
- SRC(5, 6) = SRC(6, 4) = SRC(7, 2) = (t8 + t9 + 1) >> 1;
- SRC(5, 7) = SRC(6, 5) = SRC(7, 3) = (t8 + 2 * t9 + t10 + 2) >> 2;
- SRC(6, 6) = SRC(7, 4) = (t9 + t10 + 1) >> 1;
- SRC(6, 7) = SRC(7, 5) = (t9 + 2 * t10 + t11 + 2) >> 2;
- SRC(7, 6) = (t10 + t11 + 1) >> 1;
- SRC(7, 7) = (t10 + 2 * t11 + t12 + 2) >> 2;
+ SRC(0,0)= (t0 + t1 + 1) >> 1;
+ SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2;
+ SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1;
+ SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2;
+ SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1;
+ SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2;
+ SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1;
+ SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2;
+ SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1;
+ SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2;
+ SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1;
+ SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2;
+ SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1;
+ SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2;
+ SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1;
+ SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2;
+ SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1;
+ SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2;
+ SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1;
+ SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2;
+ SRC(7,6)= (t10 + t11 + 1) >> 1;
+ SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2;
}
static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_LEFT;
- SRC(0, 0) = (l0 + l1 + 1) >> 1;
- SRC(1, 0) = (l0 + 2 * l1 + l2 + 2) >> 2;
- SRC(0, 1) = SRC(2, 0) = (l1 + l2 + 1) >> 1;
- SRC(1, 1) = SRC(3, 0) = (l1 + 2 * l2 + l3 + 2) >> 2;
- SRC(0, 2) = SRC(2, 1) = SRC(4, 0) = (l2 + l3 + 1) >> 1;
- SRC(1, 2) = SRC(3, 1) = SRC(5, 0) = (l2 + 2 * l3 + l4 + 2) >> 2;
- SRC(0, 3) = SRC(2, 2) = SRC(4, 1) = SRC(6, 0) = (l3 + l4 + 1) >> 1;
- SRC(1, 3) = SRC(3, 2) = SRC(5, 1) = SRC(7, 0) = (l3 + 2 * l4 + l5 + 2) >> 2;
- SRC(0, 4) = SRC(2, 3) = SRC(4, 2) = SRC(6, 1) = (l4 + l5 + 1) >> 1;
- SRC(1, 4) = SRC(3, 3) = SRC(5, 2) = SRC(7, 1) = (l4 + 2 * l5 + l6 + 2) >> 2;
- SRC(0, 5) = SRC(2, 4) = SRC(4, 3) = SRC(6, 2) = (l5 + l6 + 1) >> 1;
- SRC(1, 5) = SRC(3, 4) = SRC(5, 3) = SRC(7, 2) = (l5 + 2 * l6 + l7 + 2) >> 2;
- SRC(0, 6) = SRC(2, 5) = SRC(4, 4) = SRC(6, 3) = (l6 + l7 + 1) >> 1;
- SRC(1, 6) = SRC(3, 5) = SRC(5, 4) = SRC(7, 3) = (l6 + 3 * l7 + 2) >> 2;
- SRC(0, 7) = SRC(1, 7) = SRC(2, 6) = SRC(2, 7) = SRC(3, 6) =
- SRC(3, 7) = SRC(4, 5) = SRC(4, 6) = SRC(4, 7) = SRC(5, 5) =
- SRC(5, 6) = SRC(5, 7) = SRC(6, 4) = SRC(6, 5) = SRC(6, 6) =
- SRC(6, 7) = SRC(7, 4) = SRC(7, 5) = SRC(7, 6) = SRC(7, 7) = l7;
+ SRC(0,0)= (l0 + l1 + 1) >> 1;
+ SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2;
+ SRC(0,1)=SRC(2,0)= (l1 + l2 + 1) >> 1;
+ SRC(1,1)=SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2;
+ SRC(0,2)=SRC(2,1)=SRC(4,0)= (l2 + l3 + 1) >> 1;
+ SRC(1,2)=SRC(3,1)=SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2;
+ SRC(0,3)=SRC(2,2)=SRC(4,1)=SRC(6,0)= (l3 + l4 + 1) >> 1;
+ SRC(1,3)=SRC(3,2)=SRC(5,1)=SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2;
+ SRC(0,4)=SRC(2,3)=SRC(4,2)=SRC(6,1)= (l4 + l5 + 1) >> 1;
+ SRC(1,4)=SRC(3,3)=SRC(5,2)=SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2;
+ SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1;
+ SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2;
+ SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1;
+ SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2;
+ SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)=
+ SRC(3,7)=SRC(4,5)=SRC(4,6)=SRC(4,7)=SRC(5,5)=
+ SRC(5,6)=SRC(5,7)=SRC(6,4)=SRC(6,5)=SRC(6,6)=
+ SRC(6,7)=SRC(7,4)=SRC(7,5)=SRC(7,6)=SRC(7,7)= l7;
}
#undef PREDICT_8x8_LOAD_LEFT
#undef PREDICT_8x8_LOAD_TOP
@@ -1079,209 +987,189 @@ static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topr
#undef PL
#undef SRC
-static void pred4x4_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride)
-{
+static void pred4x4_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride){
int i;
pix -= stride;
- for(i = 0; i < 4; i++)
- {
+ for(i=0; i<4; i++){
uint8_t v = pix[0];
- pix[1*stride] = v += block[0];
- pix[2*stride] = v += block[4];
- pix[3*stride] = v += block[8];
- pix[4*stride] = v + block[12];
+ pix[1*stride]= v += block[0];
+ pix[2*stride]= v += block[4];
+ pix[3*stride]= v += block[8];
+ pix[4*stride]= v + block[12];
pix++;
block++;
}
}
-static void pred4x4_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride)
-{
+static void pred4x4_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride){
int i;
- for(i = 0; i < 4; i++)
- {
+ for(i=0; i<4; i++){
uint8_t v = pix[-1];
- pix[0] = v += block[0];
- pix[1] = v += block[1];
- pix[2] = v += block[2];
- pix[3] = v + block[3];
- pix += stride;
- block += 4;
+ pix[0]= v += block[0];
+ pix[1]= v += block[1];
+ pix[2]= v += block[2];
+ pix[3]= v + block[3];
+ pix+= stride;
+ block+= 4;
}
}
-static void pred8x8l_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride)
-{
+static void pred8x8l_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride){
int i;
pix -= stride;
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
uint8_t v = pix[0];
- pix[1*stride] = v += block[0];
- pix[2*stride] = v += block[8];
- pix[3*stride] = v += block[16];
- pix[4*stride] = v += block[24];
- pix[5*stride] = v += block[32];
- pix[6*stride] = v += block[40];
- pix[7*stride] = v += block[48];
- pix[8*stride] = v + block[56];
+ pix[1*stride]= v += block[0];
+ pix[2*stride]= v += block[8];
+ pix[3*stride]= v += block[16];
+ pix[4*stride]= v += block[24];
+ pix[5*stride]= v += block[32];
+ pix[6*stride]= v += block[40];
+ pix[7*stride]= v += block[48];
+ pix[8*stride]= v + block[56];
pix++;
block++;
}
}
-static void pred8x8l_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride)
-{
+static void pred8x8l_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride){
int i;
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
uint8_t v = pix[-1];
- pix[0] = v += block[0];
- pix[1] = v += block[1];
- pix[2] = v += block[2];
- pix[3] = v += block[3];
- pix[4] = v += block[4];
- pix[5] = v += block[5];
- pix[6] = v += block[6];
- pix[7] = v + block[7];
- pix += stride;
- block += 8;
+ pix[0]= v += block[0];
+ pix[1]= v += block[1];
+ pix[2]= v += block[2];
+ pix[3]= v += block[3];
+ pix[4]= v += block[4];
+ pix[5]= v += block[5];
+ pix[6]= v += block[6];
+ pix[7]= v + block[7];
+ pix+= stride;
+ block+= 8;
}
}
-static void pred16x16_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride)
-{
+static void pred16x16_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
int i;
- for(i = 0; i < 16; i++)
- pred4x4_vertical_add_c(pix + block_offset[i], block + i * 16, stride);
+ for(i=0; i<16; i++)
+ pred4x4_vertical_add_c(pix + block_offset[i], block + i*16, stride);
}
-static void pred16x16_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride)
-{
+static void pred16x16_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
int i;
- for(i = 0; i < 16; i++)
- pred4x4_horizontal_add_c(pix + block_offset[i], block + i * 16, stride);
+ for(i=0; i<16; i++)
+ pred4x4_horizontal_add_c(pix + block_offset[i], block + i*16, stride);
}
-static void pred8x8_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride)
-{
+static void pred8x8_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
int i;
- for(i = 0; i < 4; i++)
- pred4x4_vertical_add_c(pix + block_offset[i], block + i * 16, stride);
+ for(i=0; i<4; i++)
+ pred4x4_vertical_add_c(pix + block_offset[i], block + i*16, stride);
}
-static void pred8x8_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride)
-{
+static void pred8x8_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
int i;
- for(i = 0; i < 4; i++)
- pred4x4_horizontal_add_c(pix + block_offset[i], block + i * 16, stride);
+ for(i=0; i<4; i++)
+ pred4x4_horizontal_add_c(pix + block_offset[i], block + i*16, stride);
}
/**
* Sets the intra prediction function pointers.
*/
-void ff_h264_pred_init(H264PredContext *h, int codec_id)
-{
+void ff_h264_pred_init(H264PredContext *h, int codec_id){
// MpegEncContext * const s = &h->s;
- if(codec_id != CODEC_ID_RV40)
- {
- h->pred4x4[VERT_PRED ] = pred4x4_vertical_c;
- h->pred4x4[HOR_PRED ] = pred4x4_horizontal_c;
- h->pred4x4[DC_PRED ] = pred4x4_dc_c;
+ if(codec_id != CODEC_ID_RV40){
+ h->pred4x4[VERT_PRED ]= pred4x4_vertical_c;
+ h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c;
+ h->pred4x4[DC_PRED ]= pred4x4_dc_c;
if(codec_id == CODEC_ID_SVQ3)
- h->pred4x4[DIAG_DOWN_LEFT_PRED ] = pred4x4_down_left_svq3_c;
+ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_svq3_c;
else
- h->pred4x4[DIAG_DOWN_LEFT_PRED ] = pred4x4_down_left_c;
- h->pred4x4[DIAG_DOWN_RIGHT_PRED] = pred4x4_down_right_c;
- h->pred4x4[VERT_RIGHT_PRED ] = pred4x4_vertical_right_c;
- h->pred4x4[HOR_DOWN_PRED ] = pred4x4_horizontal_down_c;
- h->pred4x4[VERT_LEFT_PRED ] = pred4x4_vertical_left_c;
- h->pred4x4[HOR_UP_PRED ] = pred4x4_horizontal_up_c;
- h->pred4x4[LEFT_DC_PRED ] = pred4x4_left_dc_c;
- h->pred4x4[TOP_DC_PRED ] = pred4x4_top_dc_c;
- h->pred4x4[DC_128_PRED ] = pred4x4_128_dc_c;
- }
- else
- {
- h->pred4x4[VERT_PRED ] = pred4x4_vertical_c;
- h->pred4x4[HOR_PRED ] = pred4x4_horizontal_c;
- h->pred4x4[DC_PRED ] = pred4x4_dc_c;
- h->pred4x4[DIAG_DOWN_LEFT_PRED ] = pred4x4_down_left_rv40_c;
- h->pred4x4[DIAG_DOWN_RIGHT_PRED] = pred4x4_down_right_c;
- h->pred4x4[VERT_RIGHT_PRED ] = pred4x4_vertical_right_c;
- h->pred4x4[HOR_DOWN_PRED ] = pred4x4_horizontal_down_c;
- h->pred4x4[VERT_LEFT_PRED ] = pred4x4_vertical_left_rv40_c;
- h->pred4x4[HOR_UP_PRED ] = pred4x4_horizontal_up_rv40_c;
- h->pred4x4[LEFT_DC_PRED ] = pred4x4_left_dc_c;
- h->pred4x4[TOP_DC_PRED ] = pred4x4_top_dc_c;
- h->pred4x4[DC_128_PRED ] = pred4x4_128_dc_c;
- h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN] = pred4x4_down_left_rv40_nodown_c;
- h->pred4x4[HOR_UP_PRED_RV40_NODOWN] = pred4x4_horizontal_up_rv40_nodown_c;
- h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN] = pred4x4_vertical_left_rv40_nodown_c;
+ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_c;
+ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= pred4x4_down_right_c;
+ h->pred4x4[VERT_RIGHT_PRED ]= pred4x4_vertical_right_c;
+ h->pred4x4[HOR_DOWN_PRED ]= pred4x4_horizontal_down_c;
+ h->pred4x4[VERT_LEFT_PRED ]= pred4x4_vertical_left_c;
+ h->pred4x4[HOR_UP_PRED ]= pred4x4_horizontal_up_c;
+ h->pred4x4[LEFT_DC_PRED ]= pred4x4_left_dc_c;
+ h->pred4x4[TOP_DC_PRED ]= pred4x4_top_dc_c;
+ h->pred4x4[DC_128_PRED ]= pred4x4_128_dc_c;
+ }else{
+ h->pred4x4[VERT_PRED ]= pred4x4_vertical_c;
+ h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c;
+ h->pred4x4[DC_PRED ]= pred4x4_dc_c;
+ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_rv40_c;
+ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= pred4x4_down_right_c;
+ h->pred4x4[VERT_RIGHT_PRED ]= pred4x4_vertical_right_c;
+ h->pred4x4[HOR_DOWN_PRED ]= pred4x4_horizontal_down_c;
+ h->pred4x4[VERT_LEFT_PRED ]= pred4x4_vertical_left_rv40_c;
+ h->pred4x4[HOR_UP_PRED ]= pred4x4_horizontal_up_rv40_c;
+ h->pred4x4[LEFT_DC_PRED ]= pred4x4_left_dc_c;
+ h->pred4x4[TOP_DC_PRED ]= pred4x4_top_dc_c;
+ h->pred4x4[DC_128_PRED ]= pred4x4_128_dc_c;
+ h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= pred4x4_down_left_rv40_nodown_c;
+ h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= pred4x4_horizontal_up_rv40_nodown_c;
+ h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= pred4x4_vertical_left_rv40_nodown_c;
}
- h->pred8x8l[VERT_PRED ] = pred8x8l_vertical_c;
- h->pred8x8l[HOR_PRED ] = pred8x8l_horizontal_c;
- h->pred8x8l[DC_PRED ] = pred8x8l_dc_c;
- h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = pred8x8l_down_left_c;
- h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = pred8x8l_down_right_c;
- h->pred8x8l[VERT_RIGHT_PRED ] = pred8x8l_vertical_right_c;
- h->pred8x8l[HOR_DOWN_PRED ] = pred8x8l_horizontal_down_c;
- h->pred8x8l[VERT_LEFT_PRED ] = pred8x8l_vertical_left_c;
- h->pred8x8l[HOR_UP_PRED ] = pred8x8l_horizontal_up_c;
- h->pred8x8l[LEFT_DC_PRED ] = pred8x8l_left_dc_c;
- h->pred8x8l[TOP_DC_PRED ] = pred8x8l_top_dc_c;
- h->pred8x8l[DC_128_PRED ] = pred8x8l_128_dc_c;
-
- h->pred8x8[VERT_PRED8x8 ] = pred8x8_vertical_c;
- h->pred8x8[HOR_PRED8x8 ] = pred8x8_horizontal_c;
- h->pred8x8[PLANE_PRED8x8 ] = pred8x8_plane_c;
- if(codec_id != CODEC_ID_RV40)
- {
- h->pred8x8[DC_PRED8x8 ] = pred8x8_dc_c;
- h->pred8x8[LEFT_DC_PRED8x8] = pred8x8_left_dc_c;
- h->pred8x8[TOP_DC_PRED8x8 ] = pred8x8_top_dc_c;
- h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ] = pred8x8_mad_cow_dc_l0t;
- h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ] = pred8x8_mad_cow_dc_0lt;
- h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ] = pred8x8_mad_cow_dc_l00;
- h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ] = pred8x8_mad_cow_dc_0l0;
+ h->pred8x8l[VERT_PRED ]= pred8x8l_vertical_c;
+ h->pred8x8l[HOR_PRED ]= pred8x8l_horizontal_c;
+ h->pred8x8l[DC_PRED ]= pred8x8l_dc_c;
+ h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= pred8x8l_down_left_c;
+ h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= pred8x8l_down_right_c;
+ h->pred8x8l[VERT_RIGHT_PRED ]= pred8x8l_vertical_right_c;
+ h->pred8x8l[HOR_DOWN_PRED ]= pred8x8l_horizontal_down_c;
+ h->pred8x8l[VERT_LEFT_PRED ]= pred8x8l_vertical_left_c;
+ h->pred8x8l[HOR_UP_PRED ]= pred8x8l_horizontal_up_c;
+ h->pred8x8l[LEFT_DC_PRED ]= pred8x8l_left_dc_c;
+ h->pred8x8l[TOP_DC_PRED ]= pred8x8l_top_dc_c;
+ h->pred8x8l[DC_128_PRED ]= pred8x8l_128_dc_c;
+
+ h->pred8x8[VERT_PRED8x8 ]= pred8x8_vertical_c;
+ h->pred8x8[HOR_PRED8x8 ]= pred8x8_horizontal_c;
+ h->pred8x8[PLANE_PRED8x8 ]= pred8x8_plane_c;
+ if(codec_id != CODEC_ID_RV40){
+ h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_c;
+ h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_c;
+ h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c;
+ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= pred8x8_mad_cow_dc_l0t;
+ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= pred8x8_mad_cow_dc_0lt;
+ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= pred8x8_mad_cow_dc_l00;
+ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= pred8x8_mad_cow_dc_0l0;
+ }else{
+ h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_rv40_c;
+ h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_rv40_c;
+ h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_rv40_c;
}
- else
- {
- h->pred8x8[DC_PRED8x8 ] = pred8x8_dc_rv40_c;
- h->pred8x8[LEFT_DC_PRED8x8] = pred8x8_left_dc_rv40_c;
- h->pred8x8[TOP_DC_PRED8x8 ] = pred8x8_top_dc_rv40_c;
- }
- h->pred8x8[DC_128_PRED8x8 ] = pred8x8_128_dc_c;
-
- h->pred16x16[DC_PRED8x8 ] = pred16x16_dc_c;
- h->pred16x16[VERT_PRED8x8 ] = pred16x16_vertical_c;
- h->pred16x16[HOR_PRED8x8 ] = pred16x16_horizontal_c;
- h->pred16x16[PLANE_PRED8x8 ] = pred16x16_plane_c;
- switch(codec_id)
- {
+ h->pred8x8[DC_128_PRED8x8 ]= pred8x8_128_dc_c;
+
+ h->pred16x16[DC_PRED8x8 ]= pred16x16_dc_c;
+ h->pred16x16[VERT_PRED8x8 ]= pred16x16_vertical_c;
+ h->pred16x16[HOR_PRED8x8 ]= pred16x16_horizontal_c;
+ h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c;
+ switch(codec_id){
case CODEC_ID_SVQ3:
- h->pred16x16[PLANE_PRED8x8 ] = pred16x16_plane_svq3_c;
- break;
+ h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_svq3_c;
+ break;
case CODEC_ID_RV40:
- h->pred16x16[PLANE_PRED8x8 ] = pred16x16_plane_rv40_c;
- break;
+ h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_rv40_c;
+ break;
default:
- h->pred16x16[PLANE_PRED8x8 ] = pred16x16_plane_c;
+ h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c;
}
- h->pred16x16[LEFT_DC_PRED8x8] = pred16x16_left_dc_c;
- h->pred16x16[TOP_DC_PRED8x8 ] = pred16x16_top_dc_c;
- h->pred16x16[DC_128_PRED8x8 ] = pred16x16_128_dc_c;
+ h->pred16x16[LEFT_DC_PRED8x8]= pred16x16_left_dc_c;
+ h->pred16x16[TOP_DC_PRED8x8 ]= pred16x16_top_dc_c;
+ h->pred16x16[DC_128_PRED8x8 ]= pred16x16_128_dc_c;
//special lossless h/v prediction for h264
- h->pred4x4_add [VERT_PRED ] = pred4x4_vertical_add_c;
- h->pred4x4_add [ HOR_PRED ] = pred4x4_horizontal_add_c;
- h->pred8x8l_add [VERT_PRED ] = pred8x8l_vertical_add_c;
- h->pred8x8l_add [ HOR_PRED ] = pred8x8l_horizontal_add_c;
- h->pred8x8_add [VERT_PRED8x8] = pred8x8_vertical_add_c;
- h->pred8x8_add [ HOR_PRED8x8] = pred8x8_horizontal_add_c;
- h->pred16x16_add[VERT_PRED8x8] = pred16x16_vertical_add_c;
- h->pred16x16_add[ HOR_PRED8x8] = pred16x16_horizontal_add_c;
+ h->pred4x4_add [VERT_PRED ]= pred4x4_vertical_add_c;
+ h->pred4x4_add [ HOR_PRED ]= pred4x4_horizontal_add_c;
+ h->pred8x8l_add [VERT_PRED ]= pred8x8l_vertical_add_c;
+ h->pred8x8l_add [ HOR_PRED ]= pred8x8l_horizontal_add_c;
+ h->pred8x8_add [VERT_PRED8x8]= pred8x8_vertical_add_c;
+ h->pred8x8_add [ HOR_PRED8x8]= pred8x8_horizontal_add_c;
+ h->pred16x16_add[VERT_PRED8x8]= pred16x16_vertical_add_c;
+ h->pred16x16_add[ HOR_PRED8x8]= pred16x16_horizontal_add_c;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h
index f0a41843a..b0c2432c6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h
@@ -71,8 +71,7 @@
/**
* Context for storing H.264 prediction functions
*/
-typedef struct H264PredContext
-{
+typedef struct H264PredContext{
void (*pred4x4 [9+3+3])(uint8_t *src, 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);
@@ -82,7 +81,7 @@ typedef struct H264PredContext
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;
+}H264PredContext;
void ff_h264_pred_init(H264PredContext *h, int codec_id);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.c
index 83179301d..6b8ed4f75 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.c
@@ -33,21 +33,18 @@ static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat, Node *n
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);
pfx |= 1;
- get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0 + 1, pfx, pl, pos,
+ get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0+1, pfx, pl, pos,
no_zero_count);
}
}
@@ -76,40 +73,35 @@ 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)
- {
+ 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].n0 = i;
- for(j = cur_node; j > 0; j--)
- {
+ 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))))
+ 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]);
}
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/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.h
index 4b69763e3..d56c7274b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/huffman.h
@@ -26,8 +26,7 @@
#include "avcodec.h"
#include "get_bits.h"
-typedef struct
-{
+typedef struct {
int16_t sym;
int16_t n0;
uint32_t count;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c
index c38801ef3..6584fae99 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c
@@ -50,8 +50,7 @@
#define FF_PIXEL_PACKED 1 /**< only one components containing all the channels */
#define FF_PIXEL_PALETTE 2 /**< one components containing indexes for a palette */
-typedef struct PixFmtInfo
-{
+typedef struct PixFmtInfo {
const char *name;
uint8_t nb_channels; /**< number of channels (including alpha) */
uint8_t color_type; /**< color type (see FF_COLOR_xxx constants) */
@@ -65,8 +64,7 @@ typedef struct PixFmtInfo
/* this table gives more information about formats */
#if __STDC_VERSION__ >= 199901L
-static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] =
-{
+static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* YUV formats */
[PIX_FMT_YUV420P] = {
.name = "yuv420p",
@@ -400,322 +398,322 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB];
void avpicture_init_pixfmtinfo(void)
{
- pix_fmt_info[PIX_FMT_YUV420P].name = "yuv420p";
- pix_fmt_info[PIX_FMT_YUV420P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUV420P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUV420P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUV420P].depth = 8;
- pix_fmt_info[PIX_FMT_YUV420P].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_YUV420P].y_chroma_shift = 1;
-
- pix_fmt_info[PIX_FMT_YUV422P].name = "yuv422p";
- pix_fmt_info[PIX_FMT_YUV422P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUV422P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUV422P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUV422P].depth = 8,
- pix_fmt_info[PIX_FMT_YUV422P].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_YUV422P].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_YUV444P].name = "yuv444p";
- pix_fmt_info[PIX_FMT_YUV444P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUV444P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUV444P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUV444P].depth = 8;
- pix_fmt_info[PIX_FMT_YUV444P].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_YUV444P].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_YUYV422].name = "yuyv422";
- pix_fmt_info[PIX_FMT_YUYV422].nb_channels = 1;
- pix_fmt_info[PIX_FMT_YUYV422].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUYV422].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_YUYV422].depth = 8;
- pix_fmt_info[PIX_FMT_YUYV422].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_YUYV422].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_UYVY422].name = "uyvy422";
- pix_fmt_info[PIX_FMT_UYVY422].nb_channels = 1;
- pix_fmt_info[PIX_FMT_UYVY422].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_UYVY422].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_UYVY422].depth = 8;
- pix_fmt_info[PIX_FMT_UYVY422].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_UYVY422].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_YUV410P].name = "yuv410p";
- pix_fmt_info[PIX_FMT_YUV410P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUV410P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUV410P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUV410P].depth = 8;
- pix_fmt_info[PIX_FMT_YUV410P].x_chroma_shift = 2;
- pix_fmt_info[PIX_FMT_YUV410P].y_chroma_shift = 2;
-
- pix_fmt_info[PIX_FMT_YUV411P].name = "yuv411p";
- pix_fmt_info[PIX_FMT_YUV411P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUV411P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUV411P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUV411P].depth = 8;
- pix_fmt_info[PIX_FMT_YUV411P].x_chroma_shift = 2;
- pix_fmt_info[PIX_FMT_YUV411P].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_YUV440P].name = "yuv440p";
- pix_fmt_info[PIX_FMT_YUV440P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUV440P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUV440P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUV440P].depth = 8;
- pix_fmt_info[PIX_FMT_YUV440P].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_YUV440P].y_chroma_shift = 1;
-
- pix_fmt_info[PIX_FMT_YUVA420P].name = "yuva420p";
- pix_fmt_info[PIX_FMT_YUVA420P].nb_channels = 4;
- pix_fmt_info[PIX_FMT_YUVA420P].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_YUVA420P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUVA420P].depth = 8;
- pix_fmt_info[PIX_FMT_YUVA420P].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_YUVA420P].y_chroma_shift = 1;
-
- /* JPEG YUV */
- pix_fmt_info[PIX_FMT_YUVJ420P].name = "yuvj420p";
- pix_fmt_info[PIX_FMT_YUVJ420P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUVJ420P].color_type = FF_COLOR_YUV_JPEG;
- pix_fmt_info[PIX_FMT_YUVJ420P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUVJ420P].depth = 8;
- pix_fmt_info[PIX_FMT_YUVJ420P].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_YUVJ420P].y_chroma_shift = 1;
-
- pix_fmt_info[PIX_FMT_YUVJ422P].name = "yuvj422p";
- pix_fmt_info[PIX_FMT_YUVJ422P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUVJ422P].color_type = FF_COLOR_YUV_JPEG;
- pix_fmt_info[PIX_FMT_YUVJ422P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUVJ422P].depth = 8;
- pix_fmt_info[PIX_FMT_YUVJ422P].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_YUVJ422P].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_YUVJ444P].name = "yuvj444p";
- pix_fmt_info[PIX_FMT_YUVJ444P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUVJ444P].color_type = FF_COLOR_YUV_JPEG;
- pix_fmt_info[PIX_FMT_YUVJ444P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUVJ444P].depth = 8;
- pix_fmt_info[PIX_FMT_YUVJ444P].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_YUVJ444P].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_YUVJ440P].name = "yuvj440p";
- pix_fmt_info[PIX_FMT_YUVJ440P].nb_channels = 3;
- pix_fmt_info[PIX_FMT_YUVJ440P].color_type = FF_COLOR_YUV_JPEG;
- pix_fmt_info[PIX_FMT_YUVJ440P].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_YUVJ440P].depth = 8;
- pix_fmt_info[PIX_FMT_YUVJ440P].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_YUVJ440P].y_chroma_shift = 1;
-
- /* RGB formats */
- pix_fmt_info[PIX_FMT_RGB24].name = "rgb24";
- pix_fmt_info[PIX_FMT_RGB24].nb_channels = 3;
- pix_fmt_info[PIX_FMT_RGB24].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB24].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB24].depth = 8;
- pix_fmt_info[PIX_FMT_RGB24].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB24].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR24].name = "bgr24";
- pix_fmt_info[PIX_FMT_BGR24].nb_channels = 3;
- pix_fmt_info[PIX_FMT_BGR24].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR24].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR24].depth = 8;
- pix_fmt_info[PIX_FMT_BGR24].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR24].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB32].name = "rgb32";
- pix_fmt_info[PIX_FMT_RGB32].nb_channels = 4;
- pix_fmt_info[PIX_FMT_RGB32].is_alpha = 1;
- pix_fmt_info[PIX_FMT_RGB32].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB32].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB32].depth = 8;
- pix_fmt_info[PIX_FMT_RGB32].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB32].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB48BE].name = "rgb48be";
- pix_fmt_info[PIX_FMT_RGB48BE].nb_channels = 3;
- pix_fmt_info[PIX_FMT_RGB48BE].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB48BE].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB48BE].depth = 16;
- pix_fmt_info[PIX_FMT_RGB48BE].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB48BE].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB48LE].name = "rgb48le";
- pix_fmt_info[PIX_FMT_RGB48LE].nb_channels = 3;
- pix_fmt_info[PIX_FMT_RGB48LE].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB48LE].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB48LE].depth = 16;
- pix_fmt_info[PIX_FMT_RGB48LE].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB48LE].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB565].name = "rgb565";
- pix_fmt_info[PIX_FMT_RGB565].nb_channels = 3;
- pix_fmt_info[PIX_FMT_RGB565].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB565].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB565].depth = 5;
- pix_fmt_info[PIX_FMT_RGB565].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB565].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB555].name = "rgb555";
- pix_fmt_info[PIX_FMT_RGB555].nb_channels = 3;
- pix_fmt_info[PIX_FMT_RGB555].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB555].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB555].depth = 5;
- pix_fmt_info[PIX_FMT_RGB555].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB555].y_chroma_shift = 0;
-
- /* gray / mono formats */
- pix_fmt_info[PIX_FMT_GRAY16BE].name = "gray16be";
- pix_fmt_info[PIX_FMT_GRAY16BE].nb_channels = 1;
- pix_fmt_info[PIX_FMT_GRAY16BE].color_type = FF_COLOR_GRAY;
- pix_fmt_info[PIX_FMT_GRAY16BE].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_GRAY16BE].depth = 16;
-
- pix_fmt_info[PIX_FMT_GRAY16LE].name = "gray16le";
- pix_fmt_info[PIX_FMT_GRAY16LE].nb_channels = 1;
- pix_fmt_info[PIX_FMT_GRAY16LE].color_type = FF_COLOR_GRAY;
- pix_fmt_info[PIX_FMT_GRAY16LE].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_GRAY16LE].depth = 16;
-
- pix_fmt_info[PIX_FMT_GRAY8].name = "gray";
- pix_fmt_info[PIX_FMT_GRAY8].nb_channels = 1;
- pix_fmt_info[PIX_FMT_GRAY8].color_type = FF_COLOR_GRAY;
- pix_fmt_info[PIX_FMT_GRAY8].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_GRAY8].depth = 8;
-
- pix_fmt_info[PIX_FMT_MONOWHITE].name = "monow";
- pix_fmt_info[PIX_FMT_MONOWHITE].nb_channels = 1;
- pix_fmt_info[PIX_FMT_MONOWHITE].color_type = FF_COLOR_GRAY;
- pix_fmt_info[PIX_FMT_MONOWHITE].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_MONOWHITE].depth = 1;
-
- pix_fmt_info[PIX_FMT_MONOBLACK].name = "monob";
- pix_fmt_info[PIX_FMT_MONOBLACK].nb_channels = 1;
- pix_fmt_info[PIX_FMT_MONOBLACK].color_type = FF_COLOR_GRAY;
- pix_fmt_info[PIX_FMT_MONOBLACK].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_MONOBLACK].depth = 1;
-
- /* paletted formats */
- pix_fmt_info[PIX_FMT_PAL8].name = "pal8";
- pix_fmt_info[PIX_FMT_PAL8].nb_channels = 4;
- pix_fmt_info[PIX_FMT_PAL8].is_alpha = 1;
- pix_fmt_info[PIX_FMT_PAL8].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_PAL8].pixel_type = FF_PIXEL_PALETTE;
- pix_fmt_info[PIX_FMT_PAL8].depth = 8;
-
- pix_fmt_info[PIX_FMT_UYYVYY411].name = "uyyvyy411";
- pix_fmt_info[PIX_FMT_UYYVYY411].nb_channels = 1;
- pix_fmt_info[PIX_FMT_UYYVYY411].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_UYYVYY411].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_UYYVYY411].depth = 8;
- pix_fmt_info[PIX_FMT_UYYVYY411].x_chroma_shift = 2;
- pix_fmt_info[PIX_FMT_UYYVYY411].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR32].name = "bgr32";
- pix_fmt_info[PIX_FMT_BGR32].nb_channels = 4;
- pix_fmt_info[PIX_FMT_BGR32].is_alpha = 1;
- pix_fmt_info[PIX_FMT_BGR32].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR32].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR32].depth = 8;
- pix_fmt_info[PIX_FMT_BGR32].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR32].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR565].name = "bgr565";
- pix_fmt_info[PIX_FMT_BGR565].nb_channels = 3;
- pix_fmt_info[PIX_FMT_BGR565].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR565].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR565].depth = 5;
- pix_fmt_info[PIX_FMT_BGR565].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR565].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR555].name = "bgr555";
- pix_fmt_info[PIX_FMT_BGR555].nb_channels = 3;
- pix_fmt_info[PIX_FMT_BGR555].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR555].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR555].depth = 5;
- pix_fmt_info[PIX_FMT_BGR555].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR555].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB8].name = "rgb8";
- pix_fmt_info[PIX_FMT_RGB8].nb_channels = 1;
- pix_fmt_info[PIX_FMT_RGB8].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB8].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB8].depth = 8;
- pix_fmt_info[PIX_FMT_RGB8].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB8].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB4].name = "rgb4";
- pix_fmt_info[PIX_FMT_RGB4].nb_channels = 1;
- pix_fmt_info[PIX_FMT_RGB4].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB4].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB4].depth = 4;
- pix_fmt_info[PIX_FMT_RGB4].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB4].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB4_BYTE].name = "rgb4_byte";
- pix_fmt_info[PIX_FMT_RGB4_BYTE].nb_channels = 1;
- pix_fmt_info[PIX_FMT_RGB4_BYTE].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB4_BYTE].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB4_BYTE].depth = 8;
- pix_fmt_info[PIX_FMT_RGB4_BYTE].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB4_BYTE].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR8].name = "bgr8";
- pix_fmt_info[PIX_FMT_BGR8].nb_channels = 1;
- pix_fmt_info[PIX_FMT_BGR8].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR8].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR8].depth = 8;
- pix_fmt_info[PIX_FMT_BGR8].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR8].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR4].name = "bgr4";
- pix_fmt_info[PIX_FMT_BGR4].nb_channels = 1;
- pix_fmt_info[PIX_FMT_BGR4].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR4].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR4].depth = 4;
- pix_fmt_info[PIX_FMT_BGR4].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR4].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_BGR4_BYTE].name = "bgr4_byte";
- pix_fmt_info[PIX_FMT_BGR4_BYTE].nb_channels = 1;
- pix_fmt_info[PIX_FMT_BGR4_BYTE].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR4_BYTE].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR4_BYTE].depth = 8;
- pix_fmt_info[PIX_FMT_BGR4_BYTE].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR4_BYTE].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_NV12].name = "nv12";
- pix_fmt_info[PIX_FMT_NV12].nb_channels = 2;
- pix_fmt_info[PIX_FMT_NV12].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_NV12].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_NV12].depth = 8;
- pix_fmt_info[PIX_FMT_NV12].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_NV12].y_chroma_shift = 1;
-
- pix_fmt_info[PIX_FMT_NV21].name = "nv12";
- pix_fmt_info[PIX_FMT_NV21].nb_channels = 2;
- pix_fmt_info[PIX_FMT_NV21].color_type = FF_COLOR_YUV;
- pix_fmt_info[PIX_FMT_NV21].pixel_type = FF_PIXEL_PLANAR;
- pix_fmt_info[PIX_FMT_NV21].depth = 8;
- pix_fmt_info[PIX_FMT_NV21].x_chroma_shift = 1;
- pix_fmt_info[PIX_FMT_NV21].y_chroma_shift = 1;
-
- pix_fmt_info[PIX_FMT_BGR32_1].name = "bgr32_1";
- pix_fmt_info[PIX_FMT_BGR32_1].nb_channels = 4;
- pix_fmt_info[PIX_FMT_BGR32_1].is_alpha = 1;
- pix_fmt_info[PIX_FMT_BGR32_1].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_BGR32_1].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_BGR32_1].depth = 8;
- pix_fmt_info[PIX_FMT_BGR32_1].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_BGR32_1].y_chroma_shift = 0;
-
- pix_fmt_info[PIX_FMT_RGB32_1].name = "rgb32_1";
- pix_fmt_info[PIX_FMT_RGB32_1].nb_channels = 4;
- pix_fmt_info[PIX_FMT_RGB32_1].is_alpha = 1;
- pix_fmt_info[PIX_FMT_RGB32_1].color_type = FF_COLOR_RGB;
- pix_fmt_info[PIX_FMT_RGB32_1].pixel_type = FF_PIXEL_PACKED;
- pix_fmt_info[PIX_FMT_RGB32_1].depth = 8;
- pix_fmt_info[PIX_FMT_RGB32_1].x_chroma_shift = 0;
- pix_fmt_info[PIX_FMT_RGB32_1].y_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUV420P].name = "yuv420p";
+ pix_fmt_info[PIX_FMT_YUV420P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV420P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV420P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV420P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUV420P].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUV420P].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_YUV422P].name = "yuv422p";
+ pix_fmt_info[PIX_FMT_YUV422P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV422P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV422P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV422P].depth = 8,
+ pix_fmt_info[PIX_FMT_YUV422P].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUV422P].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUV444P].name = "yuv444p";
+ pix_fmt_info[PIX_FMT_YUV444P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV444P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV444P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV444P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUV444P].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUV444P].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUYV422].name = "yuyv422";
+ pix_fmt_info[PIX_FMT_YUYV422].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_YUYV422].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUYV422].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_YUYV422].depth = 8;
+ pix_fmt_info[PIX_FMT_YUYV422].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUYV422].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_UYVY422].name = "uyvy422";
+ pix_fmt_info[PIX_FMT_UYVY422].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_UYVY422].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_UYVY422].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_UYVY422].depth = 8;
+ pix_fmt_info[PIX_FMT_UYVY422].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_UYVY422].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUV410P].name = "yuv410p";
+ pix_fmt_info[PIX_FMT_YUV410P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV410P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV410P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV410P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUV410P].x_chroma_shift = 2;
+ pix_fmt_info[PIX_FMT_YUV410P].y_chroma_shift = 2;
+
+ pix_fmt_info[PIX_FMT_YUV411P].name = "yuv411p";
+ pix_fmt_info[PIX_FMT_YUV411P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV411P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV411P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV411P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUV411P].x_chroma_shift = 2;
+ pix_fmt_info[PIX_FMT_YUV411P].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUV440P].name = "yuv440p";
+ pix_fmt_info[PIX_FMT_YUV440P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV440P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV440P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV440P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUV440P].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUV440P].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_YUVA420P].name = "yuva420p";
+ pix_fmt_info[PIX_FMT_YUVA420P].nb_channels = 4;
+ pix_fmt_info[PIX_FMT_YUVA420P].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUVA420P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUVA420P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUVA420P].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUVA420P].y_chroma_shift = 1;
+
+ /* JPEG YUV */
+ pix_fmt_info[PIX_FMT_YUVJ420P].name = "yuvj420p";
+ pix_fmt_info[PIX_FMT_YUVJ420P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUVJ420P].color_type = FF_COLOR_YUV_JPEG;
+ pix_fmt_info[PIX_FMT_YUVJ420P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUVJ420P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUVJ420P].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUVJ420P].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_YUVJ422P].name = "yuvj422p";
+ pix_fmt_info[PIX_FMT_YUVJ422P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUVJ422P].color_type = FF_COLOR_YUV_JPEG;
+ pix_fmt_info[PIX_FMT_YUVJ422P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUVJ422P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUVJ422P].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUVJ422P].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUVJ444P].name = "yuvj444p";
+ pix_fmt_info[PIX_FMT_YUVJ444P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUVJ444P].color_type = FF_COLOR_YUV_JPEG;
+ pix_fmt_info[PIX_FMT_YUVJ444P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUVJ444P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUVJ444P].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUVJ444P].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUVJ440P].name = "yuvj440p";
+ pix_fmt_info[PIX_FMT_YUVJ440P].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUVJ440P].color_type = FF_COLOR_YUV_JPEG;
+ pix_fmt_info[PIX_FMT_YUVJ440P].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUVJ440P].depth = 8;
+ pix_fmt_info[PIX_FMT_YUVJ440P].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUVJ440P].y_chroma_shift = 1;
+
+ /* RGB formats */
+ pix_fmt_info[PIX_FMT_RGB24].name = "rgb24";
+ pix_fmt_info[PIX_FMT_RGB24].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_RGB24].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB24].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB24].depth = 8;
+ pix_fmt_info[PIX_FMT_RGB24].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB24].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR24].name = "bgr24";
+ pix_fmt_info[PIX_FMT_BGR24].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_BGR24].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR24].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR24].depth = 8;
+ pix_fmt_info[PIX_FMT_BGR24].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR24].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB32].name = "rgb32";
+ pix_fmt_info[PIX_FMT_RGB32].nb_channels = 4;
+ pix_fmt_info[PIX_FMT_RGB32].is_alpha = 1;
+ pix_fmt_info[PIX_FMT_RGB32].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB32].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB32].depth = 8;
+ pix_fmt_info[PIX_FMT_RGB32].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB32].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB48BE].name = "rgb48be";
+ pix_fmt_info[PIX_FMT_RGB48BE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_RGB48BE].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB48BE].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB48BE].depth = 16;
+ pix_fmt_info[PIX_FMT_RGB48BE].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB48BE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB48LE].name = "rgb48le";
+ pix_fmt_info[PIX_FMT_RGB48LE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_RGB48LE].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB48LE].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB48LE].depth = 16;
+ pix_fmt_info[PIX_FMT_RGB48LE].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB48LE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB565].name = "rgb565";
+ pix_fmt_info[PIX_FMT_RGB565].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_RGB565].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB565].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB565].depth = 5;
+ pix_fmt_info[PIX_FMT_RGB565].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB565].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB555].name = "rgb555";
+ pix_fmt_info[PIX_FMT_RGB555].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_RGB555].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB555].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB555].depth = 5;
+ pix_fmt_info[PIX_FMT_RGB555].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB555].y_chroma_shift = 0;
+
+ /* gray / mono formats */
+ pix_fmt_info[PIX_FMT_GRAY16BE].name = "gray16be";
+ pix_fmt_info[PIX_FMT_GRAY16BE].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_GRAY16BE].color_type = FF_COLOR_GRAY;
+ pix_fmt_info[PIX_FMT_GRAY16BE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_GRAY16BE].depth = 16;
+
+ pix_fmt_info[PIX_FMT_GRAY16LE].name = "gray16le";
+ pix_fmt_info[PIX_FMT_GRAY16LE].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_GRAY16LE].color_type = FF_COLOR_GRAY;
+ pix_fmt_info[PIX_FMT_GRAY16LE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_GRAY16LE].depth = 16;
+
+ pix_fmt_info[PIX_FMT_GRAY8].name = "gray";
+ pix_fmt_info[PIX_FMT_GRAY8].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_GRAY8].color_type = FF_COLOR_GRAY;
+ pix_fmt_info[PIX_FMT_GRAY8].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_GRAY8].depth = 8;
+
+ pix_fmt_info[PIX_FMT_MONOWHITE].name = "monow";
+ pix_fmt_info[PIX_FMT_MONOWHITE].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_MONOWHITE].color_type = FF_COLOR_GRAY;
+ pix_fmt_info[PIX_FMT_MONOWHITE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_MONOWHITE].depth = 1;
+
+ pix_fmt_info[PIX_FMT_MONOBLACK].name = "monob";
+ pix_fmt_info[PIX_FMT_MONOBLACK].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_MONOBLACK].color_type = FF_COLOR_GRAY;
+ pix_fmt_info[PIX_FMT_MONOBLACK].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_MONOBLACK].depth = 1;
+
+ /* paletted formats */
+ pix_fmt_info[PIX_FMT_PAL8].name = "pal8";
+ pix_fmt_info[PIX_FMT_PAL8].nb_channels = 4;
+ pix_fmt_info[PIX_FMT_PAL8].is_alpha = 1;
+ pix_fmt_info[PIX_FMT_PAL8].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_PAL8].pixel_type = FF_PIXEL_PALETTE;
+ pix_fmt_info[PIX_FMT_PAL8].depth = 8;
+
+ pix_fmt_info[PIX_FMT_UYYVYY411].name = "uyyvyy411";
+ pix_fmt_info[PIX_FMT_UYYVYY411].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_UYYVYY411].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_UYYVYY411].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_UYYVYY411].depth = 8;
+ pix_fmt_info[PIX_FMT_UYYVYY411].x_chroma_shift = 2;
+ pix_fmt_info[PIX_FMT_UYYVYY411].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR32].name = "bgr32";
+ pix_fmt_info[PIX_FMT_BGR32].nb_channels = 4;
+ pix_fmt_info[PIX_FMT_BGR32].is_alpha = 1;
+ pix_fmt_info[PIX_FMT_BGR32].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR32].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR32].depth = 8;
+ pix_fmt_info[PIX_FMT_BGR32].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR32].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR565].name = "bgr565";
+ pix_fmt_info[PIX_FMT_BGR565].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_BGR565].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR565].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR565].depth = 5;
+ pix_fmt_info[PIX_FMT_BGR565].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR565].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR555].name = "bgr555";
+ pix_fmt_info[PIX_FMT_BGR555].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_BGR555].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR555].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR555].depth = 5;
+ pix_fmt_info[PIX_FMT_BGR555].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR555].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB8].name = "rgb8";
+ pix_fmt_info[PIX_FMT_RGB8].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_RGB8].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB8].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB8].depth = 8;
+ pix_fmt_info[PIX_FMT_RGB8].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB8].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB4].name = "rgb4";
+ pix_fmt_info[PIX_FMT_RGB4].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_RGB4].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB4].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB4].depth = 4;
+ pix_fmt_info[PIX_FMT_RGB4].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB4].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].name = "rgb4_byte";
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].depth = 8;
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB4_BYTE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR8].name = "bgr8";
+ pix_fmt_info[PIX_FMT_BGR8].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_BGR8].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR8].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR8].depth = 8;
+ pix_fmt_info[PIX_FMT_BGR8].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR8].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR4].name = "bgr4";
+ pix_fmt_info[PIX_FMT_BGR4].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_BGR4].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR4].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR4].depth = 4;
+ pix_fmt_info[PIX_FMT_BGR4].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR4].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].name = "bgr4_byte";
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].nb_channels = 1;
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].depth = 8;
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR4_BYTE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_NV12].name = "nv12";
+ pix_fmt_info[PIX_FMT_NV12].nb_channels = 2;
+ pix_fmt_info[PIX_FMT_NV12].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_NV12].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_NV12].depth = 8;
+ pix_fmt_info[PIX_FMT_NV12].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_NV12].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_NV21].name = "nv12";
+ pix_fmt_info[PIX_FMT_NV21].nb_channels = 2;
+ pix_fmt_info[PIX_FMT_NV21].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_NV21].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_NV21].depth = 8;
+ pix_fmt_info[PIX_FMT_NV21].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_NV21].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_BGR32_1].name = "bgr32_1";
+ pix_fmt_info[PIX_FMT_BGR32_1].nb_channels = 4;
+ pix_fmt_info[PIX_FMT_BGR32_1].is_alpha = 1;
+ pix_fmt_info[PIX_FMT_BGR32_1].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_BGR32_1].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_BGR32_1].depth = 8;
+ pix_fmt_info[PIX_FMT_BGR32_1].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_BGR32_1].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_RGB32_1].name = "rgb32_1";
+ pix_fmt_info[PIX_FMT_RGB32_1].nb_channels = 4;
+ pix_fmt_info[PIX_FMT_RGB32_1].is_alpha = 1;
+ pix_fmt_info[PIX_FMT_RGB32_1].color_type = FF_COLOR_RGB;
+ pix_fmt_info[PIX_FMT_RGB32_1].pixel_type = FF_PIXEL_PACKED;
+ pix_fmt_info[PIX_FMT_RGB32_1].depth = 8;
+ pix_fmt_info[PIX_FMT_RGB32_1].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_RGB32_1].y_chroma_shift = 0;
}
#endif
@@ -725,43 +723,40 @@ void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift)
*v_shift = pix_fmt_info[pix_fmt].y_chroma_shift;
}
-int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt)
-{
+int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
int i;
- for(i = 0; i < 256; i++)
- {
- int r, g, b;
+ for(i=0; i<256; i++){
+ int r,g,b;
- switch(pix_fmt)
- {
+ switch(pix_fmt) {
case PIX_FMT_RGB8:
- r = (i >> 5) * 36;
- g = ((i >> 2) & 7) * 36;
- b = (i & 3) * 85;
+ r= (i>>5 )*36;
+ g= ((i>>2)&7)*36;
+ b= (i&3 )*85;
break;
case PIX_FMT_BGR8:
- b = (i >> 6) * 85;
- g = ((i >> 3) & 7) * 36;
- r = (i & 7) * 36;
+ b= (i>>6 )*85;
+ g= ((i>>3)&7)*36;
+ r= (i&7 )*36;
break;
case PIX_FMT_RGB4_BYTE:
- r = (i >> 3) * 255;
- g = ((i >> 1) & 3) * 85;
- b = (i & 1) * 255;
+ r= (i>>3 )*255;
+ g= ((i>>1)&3)*85;
+ b= (i&1 )*255;
break;
case PIX_FMT_BGR4_BYTE:
- b = (i >> 3) * 255;
- g = ((i >> 1) & 3) * 85;
- r = (i & 1) * 255;
+ b= (i>>3 )*255;
+ g= ((i>>1)&3)*85;
+ r= (i&1 )*255;
break;
case PIX_FMT_GRAY8:
- r = b = g = i;
+ r=b=g= i;
break;
default:
return -1;
}
- pal[i] = b + (g << 8) + (r << 16);
+ pal[i] = b + (g<<8) + (r<<16);
}
return 0;
@@ -775,8 +770,7 @@ int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
memset(picture->linesize, 0, sizeof(picture->linesize));
pinfo = &pix_fmt_info[pix_fmt];
- switch(pix_fmt)
- {
+ switch(pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P:
case PIX_FMT_YUV444P:
@@ -832,7 +826,7 @@ int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
picture->linesize[0] = width * 2;
break;
case PIX_FMT_UYYVYY411:
- picture->linesize[0] = width + width / 2;
+ picture->linesize[0] = width + width/2;
break;
case PIX_FMT_RGB4:
case PIX_FMT_BGR4:
@@ -864,8 +858,7 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
pinfo = &pix_fmt_info[pix_fmt];
size = picture->linesize[0] * height;
- switch(pix_fmt)
- {
+ switch(pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P:
case PIX_FMT_YUV444P:
@@ -948,13 +941,12 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
}
void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
- const uint8_t *src, int src_wrap,
- int width, int height)
+ const uint8_t *src, int src_wrap,
+ int width, int height)
{
if((!dst) || (!src))
return;
- for(; height > 0; height--)
- {
+ for(;height > 0; height--) {
memcpy(dst, src, width);
dst += dst_wrap;
src += src_wrap;
@@ -967,11 +959,9 @@ int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
pf = &pix_fmt_info[pix_fmt];
- switch(pf->pixel_type)
- {
+ switch(pf->pixel_type) {
case FF_PIXEL_PACKED:
- switch(pix_fmt)
- {
+ switch(pix_fmt) {
case PIX_FMT_YUYV422:
case PIX_FMT_UYVY422:
case PIX_FMT_RGB565:
@@ -990,13 +980,13 @@ int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
return (width * bits + 7) >> 3;
break;
case FF_PIXEL_PLANAR:
- if(plane == 1 || plane == 2)
- width = -((-width) >> pf->x_chroma_shift);
+ if (plane == 1 || plane == 2)
+ width= -((-width)>>pf->x_chroma_shift);
- return (width * pf->depth + 7) >> 3;
+ return (width * pf->depth + 7) >> 3;
break;
case FF_PIXEL_PALETTE:
- if(plane == 0)
+ if (plane == 0)
return width;
break;
}
@@ -1010,50 +1000,45 @@ void av_picture_copy(AVPicture *dst, const AVPicture *src,
int i;
const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
- switch(pf->pixel_type)
- {
+ switch(pf->pixel_type) {
case FF_PIXEL_PACKED:
case FF_PIXEL_PLANAR:
- for(i = 0; i < pf->nb_channels; i++)
- {
+ for(i = 0; i < pf->nb_channels; i++) {
int h;
int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i);
h = height;
- if(i == 1 || i == 2)
- {
- h = -((-height) >> pf->y_chroma_shift);
+ if (i == 1 || i == 2) {
+ h= -((-height)>>pf->y_chroma_shift);
}
ff_img_copy_plane(dst->data[i], dst->linesize[i],
- src->data[i], src->linesize[i],
- bwidth, h);
+ src->data[i], src->linesize[i],
+ bwidth, h);
}
break;
case FF_PIXEL_PALETTE:
ff_img_copy_plane(dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0],
- width, height);
+ src->data[0], src->linesize[0],
+ width, height);
/* copy the palette */
- memcpy(dst->data[1], src->data[1], 4 * 256);
+ memcpy(dst->data[1], src->data[1], 4*256);
break;
}
}
/* 2x2 -> 1x1 */
void ff_shrink22(uint8_t *dst, int dst_wrap,
- const uint8_t *src, int src_wrap,
- int width, int height)
+ const uint8_t *src, int src_wrap,
+ int width, int height)
{
int w;
const uint8_t *s1, *s2;
uint8_t *d;
- for(; height > 0; height--)
- {
+ for(;height > 0; height--) {
s1 = src;
s2 = s1 + src_wrap;
d = dst;
- for(w = width; w >= 4; w -= 4)
- {
+ for(w = width;w >= 4; w-=4) {
d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
@@ -1062,8 +1047,7 @@ void ff_shrink22(uint8_t *dst, int dst_wrap,
s2 += 8;
d += 4;
}
- for(; w > 0; w--)
- {
+ for(;w > 0; w--) {
d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
s1 += 2;
s2 += 2;
@@ -1076,22 +1060,20 @@ void ff_shrink22(uint8_t *dst, int dst_wrap,
/* 4x4 -> 1x1 */
void ff_shrink44(uint8_t *dst, int dst_wrap,
- const uint8_t *src, int src_wrap,
- int width, int height)
+ const uint8_t *src, int src_wrap,
+ int width, int height)
{
int w;
const uint8_t *s1, *s2, *s3, *s4;
uint8_t *d;
- for(; height > 0; height--)
- {
+ for(;height > 0; height--) {
s1 = src;
s2 = s1 + src_wrap;
s3 = s2 + src_wrap;
s4 = s3 + src_wrap;
d = dst;
- for(w = width; w > 0; w--)
- {
+ for(w = width;w > 0; w--) {
d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
s2[0] + s2[1] + s2[2] + s2[3] +
s3[0] + s3[1] + s3[2] + s3[3] +
@@ -1109,25 +1091,22 @@ void ff_shrink44(uint8_t *dst, int dst_wrap,
/* 8x8 -> 1x1 */
void ff_shrink88(uint8_t *dst, int dst_wrap,
- const uint8_t *src, int src_wrap,
- int width, int height)
+ const uint8_t *src, int src_wrap,
+ int width, int height)
{
int w, i;
- for(; height > 0; height--)
- {
- for(w = width; w > 0; w--)
- {
- int tmp = 0;
- for(i = 0; i < 8; i++)
- {
+ for(;height > 0; height--) {
+ for(w = width;w > 0; w--) {
+ int tmp=0;
+ for(i=0; i<8; i++){
tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
src += src_wrap;
}
- *(dst++) = (tmp + 32) >> 6;
- src += 8 - 8 * src_wrap;
+ *(dst++) = (tmp + 32)>>6;
+ src += 8 - 8*src_wrap;
}
- src += 8 * src_wrap - 8 * width;
+ src += 8*src_wrap - 8*width;
dst += dst_wrap - width;
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c
index d366c3f3d..30dcf7c55 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c
@@ -27,20 +27,17 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
int format;
/* picture header */
- if(get_bits_long(&s->gb, 22) != 0x20)
- {
+ if (get_bits_long(&s->gb, 22) != 0x20) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
- if(get_bits1(&s->gb) != 1)
- {
+ if (get_bits1(&s->gb) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
return -1; /* marker */
}
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
return -1; /* h263 id */
}
@@ -49,8 +46,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
skip_bits1(&s->gb); /* freeze picture release off */
format = get_bits(&s->gb, 3);
- if(format != 7)
- {
+ if (format != 7) {
av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n");
return -1;
}
@@ -61,19 +57,16 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
s->unrestricted_mv = get_bits1(&s->gb);
s->h263_long_vectors = s->unrestricted_mv;
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n");
return -1; /* SAC: off */
}
- s->obmc = get_bits1(&s->gb);
+ s->obmc= get_bits1(&s->gb);
s->pb_frame = get_bits1(&s->gb);
- if(format == 7)
- {
+ if(format == 7){
format = get_bits(&s->gb, 3);
- if(format == 0 || format == 7)
- {
+ if(format == 0 || format == 7){
av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n");
return -1;
}
@@ -89,45 +82,40 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
if(get_bits(&s->gb, 5) != 1)
av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n");
}
- if(format == 6)
- {
+ if(format == 6){
int ar = get_bits(&s->gb, 4);
skip_bits(&s->gb, 9); // display width
skip_bits1(&s->gb);
skip_bits(&s->gb, 9); // display height
- if(ar == 15)
- {
+ if(ar == 15){
skip_bits(&s->gb, 8); // aspect ratio - width
skip_bits(&s->gb, 8); // aspect ratio - height
}
}
- s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
+ s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
- if(s->pb_frame)
- {
+ if(s->pb_frame){
skip_bits(&s->gb, 3); //temporal reference for B-frame
skip_bits(&s->gb, 2); //dbquant
}
/* PEI */
- while(get_bits1(&s->gb) != 0)
- {
+ while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
}
s->f_code = 1;
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
ff_h263_show_pict_info(s);
return 0;
}
-AVCodec h263i_decoder =
-{
+AVCodec h263i_decoder = {
"h263i",
CODEC_TYPE_VIDEO,
CODEC_ID_H263I,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.c
index df5108d1a..70e3bff75 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.c
@@ -42,13 +42,11 @@ static VLC j_ac_vlc[2][2][8]; //[quant<13],[intra/inter],[select]
static VLC j_dc_vlc[2][8]; //[quant], [select]
static VLC j_orient_vlc[2][4]; //[quant], [select]
-static av_cold void x8_vlc_init(void)
-{
+static av_cold void x8_vlc_init(void){
int i;
int offset = 0;
int sizeidx = 0;
- static const uint16_t sizes[8*4 + 8*2 + 2 + 4] =
- {
+ static const uint16_t sizes[8*4 + 8*2 + 2 + 4] = {
576, 548, 582, 618, 546, 616, 560, 642,
584, 582, 704, 664, 512, 544, 656, 640,
512, 648, 582, 566, 532, 614, 596, 648,
@@ -57,8 +55,7 @@ static av_cold void x8_vlc_init(void)
528, 528, 526, 528, 536, 528, 526, 544,
544, 512, 512, 528, 528, 544, 512, 544,
- 128, 128, 128, 128, 128, 128
- };
+ 128, 128, 128, 128, 128, 128};
static VLC_TYPE table[28150][2];
@@ -72,12 +69,11 @@ static av_cold void x8_vlc_init(void)
&src[0],4,2, \
INIT_VLC_USE_NEW_STATIC)
//set ac tables
- for(i = 0; i < 8; i++)
- {
- init_ac_vlc(j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0]);
- init_ac_vlc(j_ac_vlc[0][1][i], x8_ac1_highquant_table[i][0]);
- init_ac_vlc(j_ac_vlc[1][0][i], x8_ac0_lowquant_table [i][0]);
- init_ac_vlc(j_ac_vlc[1][1][i], x8_ac1_lowquant_table [i][0]);
+ for(i=0;i<8;i++){
+ init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] );
+ init_ac_vlc( j_ac_vlc[0][1][i], x8_ac1_highquant_table[i][0] );
+ init_ac_vlc( j_ac_vlc[1][0][i], x8_ac0_lowquant_table [i][0] );
+ init_ac_vlc( j_ac_vlc[1][1][i], x8_ac1_lowquant_table [i][0] );
}
#undef init_ac_vlc
@@ -91,10 +87,9 @@ static av_cold void x8_vlc_init(void)
&src[1],4,2, \
&src[0],4,2, \
INIT_VLC_USE_NEW_STATIC);
- for(i = 0; i < 8; i++)
- {
- init_dc_vlc(j_dc_vlc[0][i], x8_dc_highquant_table[i][0]);
- init_dc_vlc(j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]);
+ for(i=0;i<8;i++){
+ init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]);
+ init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]);
}
#undef init_dc_vlc
@@ -108,48 +103,42 @@ static av_cold void x8_vlc_init(void)
&src[1],4,2, \
&src[0],4,2, \
INIT_VLC_USE_NEW_STATIC);
- for(i = 0; i < 2; i++)
- {
- init_or_vlc(j_orient_vlc[0][i], x8_orient_highquant_table[i][0]);
+ for(i=0;i<2;i++){
+ init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]);
}
- for(i = 0; i < 4; i++)
- {
- init_or_vlc(j_orient_vlc[1][i], x8_orient_lowquant_table [i][0])
+ for(i=0;i<4;i++){
+ init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0])
}
- if(offset != sizeof(table) / sizeof(VLC_TYPE) / 2)
- av_log(NULL, AV_LOG_ERROR, "table size %i does not match needed %i\n", (int)(sizeof(table) / sizeof(VLC_TYPE) / 2), offset);
+ if (offset != sizeof(table)/sizeof(VLC_TYPE)/2)
+ av_log(NULL, AV_LOG_ERROR, "table size %i does not match needed %i\n", (int)(sizeof(table)/sizeof(VLC_TYPE)/2), offset);
}
#undef init_or_vlc
-static void x8_reset_vlc_tables(IntraX8Context * w)
-{
- memset(w->j_dc_vlc, 0, sizeof(w->j_dc_vlc));
- memset(w->j_ac_vlc, 0, sizeof(w->j_ac_vlc));
- w->j_orient_vlc = NULL;
+static void x8_reset_vlc_tables(IntraX8Context * w){
+ memset(w->j_dc_vlc,0,sizeof(w->j_dc_vlc));
+ memset(w->j_ac_vlc,0,sizeof(w->j_ac_vlc));
+ w->j_orient_vlc=NULL;
}
-static inline void x8_select_ac_table(IntraX8Context * const w , int mode)
-{
- MpegEncContext * const s = w->s;
+static inline void x8_select_ac_table(IntraX8Context * const w , int mode){
+ MpegEncContext * const s= w->s;
int table_index;
- assert(mode < 4);
+ assert(mode<4);
- if(w->j_ac_vlc[mode]) return;
+ if( w->j_ac_vlc[mode] ) return;
table_index = get_bits(&s->gb, 3);
w->j_ac_vlc[mode] = &j_ac_vlc[w->quant<13][mode>>1][table_index];//2 modes use same tables
assert(w->j_ac_vlc[mode]);
}
-static inline int x8_get_orient_vlc(IntraX8Context * w)
-{
- MpegEncContext * const s = w->s;
+static inline int x8_get_orient_vlc(IntraX8Context * w){
+ MpegEncContext * const s= w->s;
int table_index;
- if(!w->j_orient_vlc)
- {
- table_index = get_bits(&s->gb, 1 + (w->quant < 13));
+ if(!w->j_orient_vlc ){
+ table_index = get_bits(&s->gb, 1+(w->quant<13) );
w->j_orient_vlc = &j_orient_vlc[w->quant<13][table_index];
}
assert(w->j_orient_vlc);
@@ -163,42 +152,41 @@ static inline int x8_get_orient_vlc(IntraX8Context * w)
#define extra_level (0x00<<8)
#define run_offset(r) ((r)<<16)
#define level_offset(l) ((l)<<24)
-static const uint32_t ac_decode_table[] =
-{
- /*46*/ extra_bits(3) | extra_run | run_offset(16) | level_offset(0),
- /*47*/ extra_bits(3) | extra_run | run_offset(24) | level_offset(0),
- /*48*/ extra_bits(2) | extra_run | run_offset(4) | level_offset(1),
- /*49*/ extra_bits(3) | extra_run | run_offset(8) | level_offset(1),
-
- /*50*/ extra_bits(5) | extra_run | run_offset(32) | level_offset(0),
- /*51*/ extra_bits(4) | extra_run | run_offset(16) | level_offset(1),
-
- /*52*/ extra_bits(2) | extra_level | run_offset(0) | level_offset(4),
- /*53*/ extra_bits(2) | extra_level | run_offset(0) | level_offset(8),
- /*54*/ extra_bits(2) | extra_level | run_offset(0) | level_offset(12),
- /*55*/ extra_bits(3) | extra_level | run_offset(0) | level_offset(16),
- /*56*/ extra_bits(3) | extra_level | run_offset(0) | level_offset(24),
-
- /*57*/ extra_bits(2) | extra_level | run_offset(1) | level_offset(3),
- /*58*/ extra_bits(3) | extra_level | run_offset(1) | level_offset(7),
-
- /*59*/ extra_bits(2) | extra_run | run_offset(16) | level_offset(0),
- /*60*/ extra_bits(2) | extra_run | run_offset(20) | level_offset(0),
- /*61*/ extra_bits(2) | extra_run | run_offset(24) | level_offset(0),
- /*62*/ extra_bits(2) | extra_run | run_offset(28) | level_offset(0),
- /*63*/ extra_bits(4) | extra_run | run_offset(32) | level_offset(0),
- /*64*/ extra_bits(4) | extra_run | run_offset(48) | level_offset(0),
-
- /*65*/ extra_bits(2) | extra_run | run_offset(4) | level_offset(1),
- /*66*/ extra_bits(3) | extra_run | run_offset(8) | level_offset(1),
- /*67*/ extra_bits(4) | extra_run | run_offset(16) | level_offset(1),
-
- /*68*/ extra_bits(2) | extra_level | run_offset(0) | level_offset(4),
- /*69*/ extra_bits(3) | extra_level | run_offset(0) | level_offset(8),
- /*70*/ extra_bits(4) | extra_level | run_offset(0) | level_offset(16),
-
- /*71*/ extra_bits(2) | extra_level | run_offset(1) | level_offset(3),
- /*72*/ extra_bits(3) | extra_level | run_offset(1) | level_offset(7),
+static const uint32_t ac_decode_table[]={
+ /*46*/ extra_bits(3) | extra_run | run_offset(16) | level_offset( 0),
+ /*47*/ extra_bits(3) | extra_run | run_offset(24) | level_offset( 0),
+ /*48*/ extra_bits(2) | extra_run | run_offset( 4) | level_offset( 1),
+ /*49*/ extra_bits(3) | extra_run | run_offset( 8) | level_offset( 1),
+
+ /*50*/ extra_bits(5) | extra_run | run_offset(32) | level_offset( 0),
+ /*51*/ extra_bits(4) | extra_run | run_offset(16) | level_offset( 1),
+
+ /*52*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset( 4),
+ /*53*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset( 8),
+ /*54*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset(12),
+ /*55*/ extra_bits(3) | extra_level | run_offset( 0) | level_offset(16),
+ /*56*/ extra_bits(3) | extra_level | run_offset( 0) | level_offset(24),
+
+ /*57*/ extra_bits(2) | extra_level | run_offset( 1) | level_offset( 3),
+ /*58*/ extra_bits(3) | extra_level | run_offset( 1) | level_offset( 7),
+
+ /*59*/ extra_bits(2) | extra_run | run_offset(16) | level_offset( 0),
+ /*60*/ extra_bits(2) | extra_run | run_offset(20) | level_offset( 0),
+ /*61*/ extra_bits(2) | extra_run | run_offset(24) | level_offset( 0),
+ /*62*/ extra_bits(2) | extra_run | run_offset(28) | level_offset( 0),
+ /*63*/ extra_bits(4) | extra_run | run_offset(32) | level_offset( 0),
+ /*64*/ extra_bits(4) | extra_run | run_offset(48) | level_offset( 0),
+
+ /*65*/ extra_bits(2) | extra_run | run_offset( 4) | level_offset( 1),
+ /*66*/ extra_bits(3) | extra_run | run_offset( 8) | level_offset( 1),
+ /*67*/ extra_bits(4) | extra_run | run_offset(16) | level_offset( 1),
+
+ /*68*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset( 4),
+ /*69*/ extra_bits(3) | extra_level | run_offset( 0) | level_offset( 8),
+ /*70*/ extra_bits(4) | extra_level | run_offset( 0) | level_offset(16),
+
+ /*71*/ extra_bits(2) | extra_level | run_offset( 1) | level_offset( 3),
+ /*72*/ extra_bits(3) | extra_level | run_offset( 1) | level_offset( 7),
};
//extra_bits = 3bits; extra_run/level = 1 bit; run_offset = 6bits; level_offset = 5 bits;
#undef extra_bits
@@ -208,343 +196,307 @@ static const uint32_t ac_decode_table[] =
#undef level_offset
static void x8_get_ac_rlf(IntraX8Context * const w, const int mode,
- int * const run, int * const level, int * const final)
-{
- MpegEncContext * const s = w->s;
- int i, e;
+ int * const run, int * const level, int * const final){
+ MpegEncContext * const s= w->s;
+ int i,e;
// x8_select_ac_table(w,mode);
i = get_vlc2(&s->gb, w->j_ac_vlc[mode]->table, AC_VLC_BITS, AC_VLC_MTD);
- if(i < 46) //[0-45]
- {
- int t, l;
- if(i < 0)
- {
- (*level) = (*final) = //prevent 'may be used unilitialized'
- (*run) = 64; //this would cause error exit in the ac loop
+ if(i<46){ //[0-45]
+ int t,l;
+ if(i<0){
+ (*level)=(*final)=//prevent 'may be used unilitialized'
+ (*run)=64;//this would cause error exit in the ac loop
return;
}
- (*final) = t = (i > 22);
- i -= 23 * t;
- /*
- i== 0-15 r=0-15 l=0 ;r=i& %01111
- i==16-19 r=0-3 l=1 ;r=i& %00011
- i==20-21 r=0-1 l=2 ;r=i& %00001
- i==22 r=0 l=3 ;r=i& %00000
- l=lut_l[i/2]={0,0,0,0,0,0,0,0,1,1,2,3}[i>>1];// 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000
- t=lut_mask[l]={0x0f,0x03,0x01,0x00}[l]; as i<256 the higher bits do not matter */
- l = (0xE50000 >> (i & (0x1E))) & 3; /*0x1E or (~1) or ((i>>1)<<1)*/
- t = (0x01030F >> (l << 3));
-
- (*run) = i & t;
+ (*final) = t = (i>22);
+ i-=23*t;
+/*
+ i== 0-15 r=0-15 l=0 ;r=i& %01111
+ i==16-19 r=0-3 l=1 ;r=i& %00011
+ i==20-21 r=0-1 l=2 ;r=i& %00001
+ i==22 r=0 l=3 ;r=i& %00000
+l=lut_l[i/2]={0,0,0,0,0,0,0,0,1,1,2,3}[i>>1];// 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000
+t=lut_mask[l]={0x0f,0x03,0x01,0x00}[l]; as i<256 the higher bits do not matter */
+ l=(0xE50000>>(i&(0x1E)))&3;/*0x1E or (~1) or ((i>>1)<<1)*/
+ t=(0x01030F>>(l<<3));
+
+ (*run) = i&t;
(*level) = l;
- }
- else if(i < 73) //[46-72]
- {
+ }else if(i<73){//[46-72]
uint32_t sm;
uint32_t mask;
- i -= 46;
- sm = ac_decode_table[i];
-
- e = get_bits(&s->gb, sm & 0xF);
- sm >>= 8; //3bits
- mask = sm & 0xff;
- sm >>= 8; //1bit
-
- (*run) = (sm & 0xff) + (e & (mask)); //6bits
- (*level) = (sm >> 8) + (e & (~mask)); //5bits
- (*final) = i > (58 - 46);
- }
- else if(i < 75) //[73-74]
- {
- static const uint8_t crazy_mix_runlevel[32] =
- {
- 0x22, 0x32, 0x33, 0x53, 0x23, 0x42, 0x43, 0x63,
- 0x24, 0x52, 0x34, 0x73, 0x25, 0x62, 0x44, 0x83,
- 0x26, 0x72, 0x35, 0x54, 0x27, 0x82, 0x45, 0x64,
- 0x28, 0x92, 0x36, 0x74, 0x29, 0xa2, 0x46, 0x84
- };
-
- (*final) = !(i & 1);
- e = get_bits(&s->gb, 5); //get the extra bits
- (*run) = crazy_mix_runlevel[e] >> 4;
- (*level) = crazy_mix_runlevel[e] & 0x0F;
- }
- else
- {
- (*level) = get_bits(&s->gb, 7 - 3 * (i & 1));
- (*run) = get_bits(&s->gb, 6);
- (*final) = get_bits1(&s->gb);
+ i-=46;
+ sm=ac_decode_table[i];
+
+ e=get_bits(&s->gb,sm&0xF);sm>>=8;//3bits
+ mask=sm&0xff;sm>>=8; //1bit
+
+ (*run) =(sm&0xff) + (e&( mask));//6bits
+ (*level)=(sm>>8) + (e&(~mask));//5bits
+ (*final)=i>(58-46);
+ }else if(i<75){//[73-74]
+ static const uint8_t crazy_mix_runlevel[32]={
+ 0x22,0x32,0x33,0x53,0x23,0x42,0x43,0x63,
+ 0x24,0x52,0x34,0x73,0x25,0x62,0x44,0x83,
+ 0x26,0x72,0x35,0x54,0x27,0x82,0x45,0x64,
+ 0x28,0x92,0x36,0x74,0x29,0xa2,0x46,0x84};
+
+ (*final)=!(i&1);
+ e=get_bits(&s->gb,5);//get the extra bits
+ (*run) =crazy_mix_runlevel[e]>>4;
+ (*level)=crazy_mix_runlevel[e]&0x0F;
+ }else{
+ (*level)=get_bits( &s->gb, 7-3*(i&1));
+ (*run) =get_bits( &s->gb, 6);
+ (*final)=get_bits1(&s->gb);
}
return;
}
//static const uint8_t dc_extra_sbits[] ={0, 1,1, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7 };
-static const uint8_t dc_index_offset[] = { 0, 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193};
+static const uint8_t dc_index_offset[] ={ 0, 1,2, 3,4, 5,7, 9,13, 17,25, 33,49, 65,97, 129,193};
-static int x8_get_dc_rlf(IntraX8Context * const w, int const mode, int * const level, int * const final)
-{
- MpegEncContext * const s = w->s;
- int i, e, c;
+static int x8_get_dc_rlf(IntraX8Context * const w,int const mode, int * const level, int * const final){
+ MpegEncContext * const s= w->s;
+ int i,e,c;
- assert(mode < 3);
- if(!w->j_dc_vlc[mode])
- {
+ assert(mode<3);
+ if( !w->j_dc_vlc[mode] ) {
int table_index;
table_index = get_bits(&s->gb, 3);
//4 modes, same table
- w->j_dc_vlc[mode] = &j_dc_vlc[w->quant<13][table_index];
+ w->j_dc_vlc[mode]= &j_dc_vlc[w->quant<13][table_index];
}
assert(w->j_dc_vlc);
assert(w->j_dc_vlc[mode]->table);
- i = get_vlc2(&s->gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD);
+ i=get_vlc2(&s->gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD);
/*(i>=17) {i-=17;final=1;}*/
- c = i > 16;
- (*final) = c;
- i -= 17 * c;
+ c= i>16;
+ (*final)=c;
+ i-=17*c;
- if(i <= 0)
- {
- (*level) = 0;
+ if(i<=0){
+ (*level)=0;
return -i;
}
- c = (i + 1) >> 1; //hackish way to calculate dc_extra_sbits[]
- c -= c > 1;
+ c=(i+1)>>1;//hackish way to calculate dc_extra_sbits[]
+ c-=c>1;
- e = get_bits(&s->gb, c); //get the extra bits
- i = dc_index_offset[i] + (e >> 1);
+ e=get_bits(&s->gb,c);//get the extra bits
+ i=dc_index_offset[i]+(e>>1);
- e = -(e & 1); //0,0xffffff
- (*level) = (i ^ e) - e; // (i^0)-0 , (i^0xff)-(-1)
+ e= -(e & 1);//0,0xffffff
+ (*level)= (i ^ e) - e;// (i^0)-0 , (i^0xff)-(-1)
return 0;
}
//end of huffman
-static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma)
-{
- MpegEncContext * const s = w->s;
+static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma){
+ MpegEncContext * const s= w->s;
int range;
int sum;
int quant;
s->dsp.x8_setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
- s->current_picture.linesize[chroma>0],
- &range, &sum, w->edges);
- if(chroma)
- {
- w->orient = w->chroma_orient;
- quant = w->quant_dc_chroma;
- }
- else
- {
- quant = w->quant;
- }
-
- w->flat_dc = 0;
- if(range < quant || range < 3)
- {
- w->orient = 0;
- if(range < 3) //yep you read right, a +-1 idct error may break decoding!
- {
- w->flat_dc = 1;
- sum += 9;
- w->predicted_dc = (sum * 6899) >> 17; //((1<<17)+9)/(8+8+1+2)=6899
+ s->current_picture.linesize[chroma>0],
+ &range, &sum, w->edges);
+ if(chroma){
+ w->orient=w->chroma_orient;
+ quant=w->quant_dc_chroma;
+ }else{
+ quant=w->quant;
+ }
+
+ w->flat_dc=0;
+ if(range < quant || range < 3){
+ w->orient=0;
+ if(range < 3){//yep you read right, a +-1 idct error may break decoding!
+ w->flat_dc=1;
+ sum+=9;
+ w->predicted_dc = (sum*6899)>>17;//((1<<17)+9)/(8+8+1+2)=6899
}
}
if(chroma)
return 0;
assert(w->orient < 3);
- if(range < 2 * w->quant)
- {
- if((w->edges & 3) == 0)
- {
- if(w->orient == 1) w->orient = 11;
- if(w->orient == 2) w->orient = 10;
- }
- else
- {
- w->orient = 0;
+ if(range < 2*w->quant){
+ if( (w->edges&3) == 0){
+ if(w->orient==1) w->orient=11;
+ if(w->orient==2) w->orient=10;
+ }else{
+ w->orient=0;
}
- w->raw_orient = 0;
- }
- else
- {
- static const uint8_t prediction_table[3][12] =
- {
- {0, 8, 4, 10, 11, 2, 6, 9, 1, 3, 5, 7},
- {4, 0, 8, 11, 10, 3, 5, 2, 6, 9, 1, 7},
- {8, 0, 4, 10, 11, 1, 7, 2, 6, 9, 3, 5}
+ w->raw_orient=0;
+ }else{
+ static const uint8_t prediction_table[3][12]={
+ {0,8,4, 10,11, 2,6,9,1,3,5,7},
+ {4,0,8, 11,10, 3,5,2,6,9,1,7},
+ {8,0,4, 10,11, 1,7,2,6,9,3,5}
};
- w->raw_orient = x8_get_orient_vlc(w);
- if(w->raw_orient < 0) return -1;
- assert(w->raw_orient < 12);
- assert(w->orient < 3);
- w->orient = prediction_table[w->orient][w->raw_orient];
+ w->raw_orient=x8_get_orient_vlc(w);
+ if(w->raw_orient<0) return -1;
+ assert(w->raw_orient < 12 );
+ assert(w->orient<3);
+ w->orient=prediction_table[w->orient][w->raw_orient];
}
return 0;
}
-static void x8_update_predictions(IntraX8Context * const w, const int orient, const int est_run)
-{
- MpegEncContext * const s = w->s;
+static void x8_update_predictions(IntraX8Context * const w, const int orient, const int est_run ){
+ MpegEncContext * const s= w->s;
- w->prediction_table[s->mb_x*2+(s->mb_y&1)] = (est_run << 2) + 1 * (orient == 4) + 2 * (orient == 8);
- /*
- y=2n+0 ->//0 2 4
- y=2n+1 ->//1 3 5
- */
+ w->prediction_table[s->mb_x*2+(s->mb_y&1)] = (est_run<<2) + 1*(orient==4) + 2*(orient==8);
+/*
+ y=2n+0 ->//0 2 4
+ y=2n+1 ->//1 3 5
+*/
}
-static void x8_get_prediction_chroma(IntraX8Context * const w)
-{
- MpegEncContext * const s = w->s;
+static void x8_get_prediction_chroma(IntraX8Context * const w){
+ MpegEncContext * const s= w->s;
- w->edges = 1 * (!(s->mb_x >> 1));
- w->edges |= 2 * (!(s->mb_y >> 1));
- w->edges |= 4 * (s->mb_x >= (2 * s->mb_width - 1)); //mb_x for chroma would always be odd
+ w->edges = 1*( !(s->mb_x>>1) );
+ w->edges|= 2*( !(s->mb_y>>1) );
+ w->edges|= 4*( s->mb_x >= (2*s->mb_width-1) );//mb_x for chroma would always be odd
- w->raw_orient = 0;
- if(w->edges & 3) //lut_co[8]={inv,4,8,8, inv,4,8,8}<- =>{1,1,0,0;1,1,0,0} => 0xCC
- {
- w->chroma_orient = 4 << ((0xCC>>w->edges) & 1);
+ w->raw_orient=0;
+ if(w->edges&3){//lut_co[8]={inv,4,8,8, inv,4,8,8}<- =>{1,1,0,0;1,1,0,0} => 0xCC
+ w->chroma_orient=4<<((0xCC>>w->edges)&1);
return;
}
- w->chroma_orient = (w->prediction_table[2*s->mb_x-2] & 0x03) << 2; //block[x-1][y|1-1)]
+ w->chroma_orient = (w->prediction_table[2*s->mb_x-2] & 0x03)<<2;//block[x-1][y|1-1)]
}
-static void x8_get_prediction(IntraX8Context * const w)
-{
- MpegEncContext * const s = w->s;
- int a, b, c, i;
-
- w->edges = 1 * (!s->mb_x);
- w->edges |= 2 * (!s->mb_y);
- w->edges |= 4 * (s->mb_x >= (2 * s->mb_width - 1));
-
- switch(w->edges & 3)
- {
- case 0:
- break;
- case 1:
- //take the one from the above block[0][y-1]
- w->est_run = w->prediction_table[!(s->mb_y&1)] >> 2;
- w->orient = 1;
- return;
- case 2:
- //take the one from the previous block[x-1][0]
- w->est_run = w->prediction_table[2*s->mb_x-2] >> 2;
- w->orient = 2;
- return;
- case 3:
- w->est_run = 16;
- w->orient = 0;
- return;
+static void x8_get_prediction(IntraX8Context * const w){
+ MpegEncContext * const s= w->s;
+ int a,b,c,i;
+
+ w->edges = 1*( !s->mb_x );
+ w->edges|= 2*( !s->mb_y );
+ w->edges|= 4*( s->mb_x >= (2*s->mb_width-1) );
+
+ switch(w->edges&3){
+ case 0:
+ break;
+ case 1:
+ //take the one from the above block[0][y-1]
+ w->est_run = w->prediction_table[!(s->mb_y&1)]>>2;
+ w->orient = 1;
+ return;
+ case 2:
+ //take the one from the previous block[x-1][0]
+ w->est_run = w->prediction_table[2*s->mb_x-2]>>2;
+ w->orient = 2;
+ return;
+ case 3:
+ w->est_run = 16;
+ w->orient = 0;
+ return;
}
//no edge cases
- b = w->prediction_table[2*s->mb_x + !(s->mb_y&1)];//block[x ][y-1]
- a = w->prediction_table[2*s->mb_x-2 + (s->mb_y&1)]; //block[x-1][y ]
- c = w->prediction_table[2*s->mb_x-2 + !(s->mb_y&1)];//block[x-1][y-1]
+ b= w->prediction_table[2*s->mb_x + !(s->mb_y&1) ];//block[x ][y-1]
+ a= w->prediction_table[2*s->mb_x-2 + (s->mb_y&1) ];//block[x-1][y ]
+ c= w->prediction_table[2*s->mb_x-2 + !(s->mb_y&1) ];//block[x-1][y-1]
- w->est_run = FFMIN(b, a);
+ w->est_run = FFMIN(b,a);
/* This condition has nothing to do with w->edges, even if it looks
similar it would trigger if e.g. x=3;y=2;
I guess somebody wrote something wrong and it became standard. */
- if((s->mb_x & s->mb_y) != 0) w->est_run = FFMIN(c, w->est_run);
- w->est_run >>= 2;
-
- a &= 3;
- b &= 3;
- c &= 3;
-
- i = (0xFFEAF4C4 >> (2 * b + 8 * a)) & 3;
- if(i != 3) w->orient = i;
- else w->orient = (0xFFEAD8 >> (2 * c + 8 * (w->quant > 12))) & 3;
- /*
- lut1[b][a]={
- ->{0, 1, 0, pad},
- {0, 1, X, pad},
- {2, 2, 2, pad}}
- pad 2 2 2; pad X 1 0; pad 0 1 0 <-
- -> 11 10 '10 10 '11 11'01 00 '11 00'01 00=>0xEAF4C4
-
- lut2[q>12][c]={
- ->{0,2,1,pad},
- {2,2,2,pad}}
- pad 2 2 2; pad 1 2 0 <-
- -> 11 10'10 10 '11 01'10 00=>0xEAD8
- */
+ if( (s->mb_x & s->mb_y) != 0 ) w->est_run=FFMIN(c,w->est_run);
+ w->est_run>>=2;
+
+ a&=3;
+ b&=3;
+ c&=3;
+
+ i=( 0xFFEAF4C4>>(2*b+8*a) )&3;
+ if(i!=3) w->orient=i;
+ else w->orient=( 0xFFEAD8>>(2*c+8*(w->quant>12)) )&3;
+/*
+lut1[b][a]={
+->{0, 1, 0, pad},
+ {0, 1, X, pad},
+ {2, 2, 2, pad}}
+ pad 2 2 2; pad X 1 0; pad 0 1 0 <-
+-> 11 10 '10 10 '11 11'01 00 '11 00'01 00=>0xEAF4C4
+
+lut2[q>12][c]={
+ ->{0,2,1,pad},
+ {2,2,2,pad}}
+ pad 2 2 2; pad 1 2 0 <-
+-> 11 10'10 10 '11 01'10 00=>0xEAD8
+*/
}
-static void x8_ac_compensation(IntraX8Context * const w, int const direction, int const dc_level)
-{
- MpegEncContext * const s = w->s;
+static void x8_ac_compensation(IntraX8Context * const w, int const direction, int const dc_level){
+ MpegEncContext * const s= w->s;
int t;
#define B(x,y) s->block[0][s->dsp.idct_permutation[(x)+(y)*8]]
#define T(x) ((x) * dc_level + 0x8000) >> 16;
- switch(direction)
- {
+ switch(direction){
case 0:
t = T(3811);//h
- B(1, 0) -= t;
- B(0, 1) -= t;
+ B(1,0) -= t;
+ B(0,1) -= t;
t = T(487);//e
- B(2, 0) -= t;
- B(0, 2) -= t;
+ B(2,0) -= t;
+ B(0,2) -= t;
t = T(506);//f
- B(3, 0) -= t;
- B(0, 3) -= t;
+ B(3,0) -= t;
+ B(0,3) -= t;
t = T(135);//c
- B(4, 0) -= t;
- B(0, 4) -= t;
- B(2, 1) += t;
- B(1, 2) += t;
- B(3, 1) += t;
- B(1, 3) += t;
+ B(4,0) -= t;
+ B(0,4) -= t;
+ B(2,1) += t;
+ B(1,2) += t;
+ B(3,1) += t;
+ B(1,3) += t;
t = T(173);//d
- B(5, 0) -= t;
- B(0, 5) -= t;
+ B(5,0) -= t;
+ B(0,5) -= t;
t = T(61);//b
- B(6, 0) -= t;
- B(0, 6) -= t;
- B(5, 1) += t;
- B(1, 5) += t;
+ B(6,0) -= t;
+ B(0,6) -= t;
+ B(5,1) += t;
+ B(1,5) += t;
t = T(42); //a
- B(7, 0) -= t;
- B(0, 7) -= t;
- B(4, 1) += t;
- B(1, 4) += t;
- B(4, 4) += t;
+ B(7,0) -= t;
+ B(0,7) -= t;
+ B(4,1) += t;
+ B(1,4) += t;
+ B(4,4) += t;
t = T(1084);//g
- B(1, 1) += t;
+ B(1,1) += t;
- s->block_last_index[0] = FFMAX(s->block_last_index[0], 7 * 8);
+ s->block_last_index[0] = FFMAX(s->block_last_index[0], 7*8);
break;
case 1:
- B(0, 1) -= T(6269);
- B(0, 3) -= T(708);
- B(0, 5) -= T(172);
- B(0, 7) -= T(73);
+ B(0,1) -= T(6269);
+ B(0,3) -= T( 708);
+ B(0,5) -= T( 172);
+ B(0,7) -= T( 73);
- s->block_last_index[0] = FFMAX(s->block_last_index[0], 7 * 8);
+ s->block_last_index[0] = FFMAX(s->block_last_index[0], 7*8);
break;
case 2:
- B(1, 0) -= T(6269);
- B(3, 0) -= T(708);
- B(5, 0) -= T(172);
- B(7, 0) -= T(73);
+ B(1,0) -= T(6269);
+ B(3,0) -= T( 708);
+ B(5,0) -= T( 172);
+ B(7,0) -= T( 73);
s->block_last_index[0] = FFMAX(s->block_last_index[0], 7);
break;
@@ -553,18 +505,15 @@ static void x8_ac_compensation(IntraX8Context * const w, int const direction, in
#undef T
}
-static void dsp_x8_put_solidcolor(uint8_t const pix, uint8_t * dst, int const linesize)
-{
+static void dsp_x8_put_solidcolor(uint8_t const pix, uint8_t * dst, int const linesize){
int k;
- for(k = 0; k < 8; k++)
- {
- memset(dst, pix, 8);
- dst += linesize;
+ for(k=0;k<8;k++){
+ memset(dst,pix,8);
+ dst+=linesize;
}
}
-static const int16_t quant_table[64] =
-{
+static const int16_t quant_table[64] = {
256, 256, 256, 256, 256, 256, 259, 262,
265, 269, 272, 275, 278, 282, 285, 288,
292, 295, 299, 303, 306, 310, 314, 317,
@@ -575,199 +524,163 @@ static const int16_t quant_table[64] =
470, 476, 482, 488, 493, 499, 505, 511
};
-static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma)
-{
- MpegEncContext * const s = w->s;
+static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
+ MpegEncContext * const s= w->s;
uint8_t * scantable;
- int final, run, level;
- int ac_mode, dc_mode, est_run, dc_level;
- int pos, n;
+ int final,run,level;
+ int ac_mode,dc_mode,est_run,dc_level;
+ int pos,n;
int zeros_only;
int use_quant_matrix;
int sign;
- assert(w->orient < 12);
+ assert(w->orient<12);
s->dsp.clear_block(s->block[0]);
- if(chroma)
- {
- dc_mode = 2;
- }
- else
- {
- dc_mode = !!w->est_run; //0,1
+ if(chroma){
+ dc_mode=2;
+ }else{
+ dc_mode=!!w->est_run;//0,1
}
if(x8_get_dc_rlf(w, dc_mode, &dc_level, &final)) return -1;
- n = 0;
- zeros_only = 0;
- if(!final) //decode ac
- {
- use_quant_matrix = w->use_quant_matrix;
- if(chroma)
- {
+ n=0;
+ zeros_only=0;
+ if(!final){//decode ac
+ use_quant_matrix=w->use_quant_matrix;
+ if(chroma){
ac_mode = 1;
est_run = 64;//not used
- }
- else
- {
- if(w->raw_orient < 3)
- {
+ }else{
+ if (w->raw_orient < 3){
use_quant_matrix = 0;
}
- if(w->raw_orient > 4)
- {
+ if(w->raw_orient > 4){
ac_mode = 0;
est_run = 64;
- }
- else
- {
- if(w->est_run > 1)
- {
+ }else{
+ if(w->est_run > 1){
ac_mode = 2;
- est_run = w->est_run;
- }
- else
- {
+ est_run=w->est_run;
+ }else{
ac_mode = 3;
est_run = 64;
}
}
}
- x8_select_ac_table(w, ac_mode);
+ x8_select_ac_table(w,ac_mode);
/*scantable_selector[12]={0,2,0,1,1,1,0,2,2,0,1,2};<-
-> 10'01' 00'10' 10'00' 01'01' 01'00' 10'00 =>0x928548 */
- scantable = w->scantable[(0x928548>>(2*w->orient))&3 ].permutated;
- pos = 0;
- do
- {
+ scantable = w->scantable[ (0x928548>>(2*w->orient))&3 ].permutated;
+ pos=0;
+ do {
n++;
- if(n >= est_run)
- {
- ac_mode = 3;
- x8_select_ac_table(w, 3);
+ if( n >= est_run ){
+ ac_mode=3;
+ x8_select_ac_table(w,3);
}
- x8_get_ac_rlf(w, ac_mode, &run, &level, &final);
+ x8_get_ac_rlf(w,ac_mode,&run,&level,&final);
- pos += run + 1;
- if(pos > 63)
- {
+ pos+=run+1;
+ if(pos>63){
//this also handles vlc error in x8_get_ac_rlf
return -1;
}
- level = (level + 1) * w->dquant;
- level += w->qsum;
+ level= (level+1) * w->dquant;
+ level+= w->qsum;
sign = - get_bits1(&s->gb);
level = (level ^ sign) - sign;
- if(use_quant_matrix)
- {
- level = (level * quant_table[pos]) >> 8;
+ if(use_quant_matrix){
+ level = (level*quant_table[pos])>>8;
}
- s->block[0][ scantable[pos] ] = level;
- }
- while(!final);
-
- s->block_last_index[0] = pos;
- }
- else //DC only
- {
- s->block_last_index[0] = 0;
- if(w->flat_dc && ((unsigned)(dc_level + 1)) < 3) //[-1;1]
- {
- int32_t divide_quant = !chroma ? w->divide_quant_dc_luma :
- w->divide_quant_dc_chroma;
- int32_t dc_quant = !chroma ? w->quant :
- w->quant_dc_chroma;
+ s->block[0][ scantable[pos] ]=level;
+ }while(!final);
+
+ s->block_last_index[0]=pos;
+ }else{//DC only
+ s->block_last_index[0]=0;
+ if(w->flat_dc && ((unsigned)(dc_level+1)) < 3){//[-1;1]
+ int32_t divide_quant= !chroma ? w->divide_quant_dc_luma:
+ w->divide_quant_dc_chroma;
+ int32_t dc_quant = !chroma ? w->quant:
+ w->quant_dc_chroma;
//original intent dc_level+=predicted_dc/quant; but it got lost somewhere in the rounding
- dc_level += (w->predicted_dc * divide_quant + (1 << 12))>>13;
+ dc_level+= (w->predicted_dc*divide_quant + (1<<12) )>>13;
- dsp_x8_put_solidcolor(av_clip_uint8((dc_level * dc_quant + 4) >> 3),
- s->dest[chroma], s->current_picture.linesize[!!chroma]);
+ dsp_x8_put_solidcolor( av_clip_uint8((dc_level*dc_quant+4)>>3),
+ s->dest[chroma], s->current_picture.linesize[!!chroma]);
goto block_placed;
}
zeros_only = (dc_level == 0);
}
- if(!chroma)
- {
- s->block[0][0] = dc_level * w->quant;
- }
- else
- {
- s->block[0][0] = dc_level * w->quant_dc_chroma;
+ if(!chroma){
+ s->block[0][0] = dc_level*w->quant;
+ }else{
+ s->block[0][0] = dc_level*w->quant_dc_chroma;
}
//there is !zero_only check in the original, but dc_level check is enough
- if((unsigned int)(dc_level + 1) >= 3 && (w->edges & 3) != 3)
- {
+ if( (unsigned int)(dc_level+1) >= 3 && (w->edges&3) != 3 ){
int direction;
/*ac_comp_direction[orient] = { 0, 3, 3, 1, 1, 0, 0, 0, 2, 2, 2, 1 };<-
-> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 =>0x6A017C */
- direction = (0x6A017C >> (w->orient * 2)) & 3;
- if(direction != 3)
- {
+ direction= (0x6A017C>>(w->orient*2))&3;
+ if (direction != 3){
x8_ac_compensation(w, direction, s->block[0][0]);//modify block_last[]
}
}
- if(w->flat_dc)
- {
+ if(w->flat_dc){
dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.linesize[!!chroma]);
- }
- else
- {
- s->dsp.x8_spatial_compensation[w->orient](s->edge_emu_buffer,
- s->dest[chroma],
- s->current_picture.linesize[!!chroma]);
+ }else{
+ s->dsp.x8_spatial_compensation[w->orient]( s->edge_emu_buffer,
+ s->dest[chroma],
+ s->current_picture.linesize[!!chroma] );
}
if(!zeros_only)
- s->dsp.idct_add(s->dest[chroma],
- s->current_picture.linesize[!!chroma],
- s->block[0]);
+ s->dsp.idct_add ( s->dest[chroma],
+ s->current_picture.linesize[!!chroma],
+ s->block[0] );
block_placed:
- if(!chroma)
- {
- x8_update_predictions(w, w->orient, n);
+ if(!chroma){
+ x8_update_predictions(w,w->orient,n);
}
- if(s->loop_filter)
- {
+ if(s->loop_filter){
uint8_t* ptr = s->dest[chroma];
int linesize = s->current_picture.linesize[!!chroma];
- if(!((w->edges & 2) || (zeros_only && (w->orient | 4) == 4)))
- {
+ if(!( (w->edges&2) || ( zeros_only && (w->orient|4)==4 ) )){
s->dsp.x8_h_loop_filter(ptr, linesize, w->quant);
}
- if(!((w->edges & 1) || (zeros_only && (w->orient | 8) == 8)))
- {
+ if(!( (w->edges&1) || ( zeros_only && (w->orient|8)==8 ) )){
s->dsp.x8_v_loop_filter(ptr, linesize, w->quant);
}
}
return 0;
}
-static void x8_init_block_index(MpegEncContext *s) //FIXME maybe merge with ff_*
-{
+static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_*
//not s->linesize as this would be wrong for field pics
//not that IntraX8 has interlacing support ;)
const int linesize = s->current_picture.linesize[0];
- const int uvlinesize = s->current_picture.linesize[1];
+ const int uvlinesize= s->current_picture.linesize[1];
s->dest[0] = s->current_picture.data[0];
s->dest[1] = s->current_picture.data[1];
s->dest[2] = s->current_picture.data[2];
s->dest[0] += s->mb_y * linesize << 3;
- s->dest[1] += (s->mb_y & (~1)) * uvlinesize << 2;//chroma blocks are on add rows
- s->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
+ s->dest[1] += ( s->mb_y&(~1) ) * uvlinesize << 2;//chroma blocks are on add rows
+ s->dest[2] += ( s->mb_y&(~1) ) * uvlinesize << 2;
}
/**
@@ -776,13 +689,12 @@ static void x8_init_block_index(MpegEncContext *s) //FIXME maybe merge with ff_
* @param w pointer to IntraX8Context
* @param s pointer to MpegEncContext of the parent codec
*/
-av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s)
-{
+av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s){
- w->s = s;
+ w->s=s;
x8_vlc_init();
- assert(s->mb_width > 0);
- w->prediction_table = av_mallocz(s->mb_width * 2 * 2); //two rows, 2 blocks per cannon mb
+ 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]);
@@ -810,9 +722,8 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w)
* @param quant_offset offset away from zero
*/
//FIXME extern uint8_t wmv3_dc_scale_table[32];
-int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_offset)
-{
- MpegEncContext * const s = w->s;
+int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_offset){
+ MpegEncContext * const s= w->s;
int mb_xy;
assert(s);
w->use_quant_matrix = get_bits1(&s->gb);
@@ -821,65 +732,58 @@ int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_of
w->quant = dquant >> 1;
w->qsum = quant_offset;
- w->divide_quant_dc_luma = ((1 << 16) + (w->quant >> 1)) / w->quant;
- if(w->quant < 5)
- {
+ w->divide_quant_dc_luma = ((1<<16) + (w->quant>>1)) / w->quant;
+ if(w->quant < 5){
w->quant_dc_chroma = w->quant;
w->divide_quant_dc_chroma = w->divide_quant_dc_luma;
- }
- else
- {
- w->quant_dc_chroma = w->quant + ((w->quant + 3) >> 3);
- w->divide_quant_dc_chroma = ((1 << 16) + (w->quant_dc_chroma >> 1)) / w->quant_dc_chroma;
+ }else{
+ w->quant_dc_chroma = w->quant+((w->quant+3)>>3);
+ w->divide_quant_dc_chroma = ((1<<16) + (w->quant_dc_chroma>>1)) / w->quant_dc_chroma;
}
x8_reset_vlc_tables(w);
- s->resync_mb_x = 0;
- s->resync_mb_y = 0;
+ s->resync_mb_x=0;
+ s->resync_mb_y=0;
- for(s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++)
- {
+ for(s->mb_y=0; s->mb_y < s->mb_height*2; s->mb_y++){
x8_init_block_index(s);
- mb_xy = (s->mb_y >> 1) * s->mb_stride;
+ mb_xy=(s->mb_y>>1)*s->mb_stride;
- for(s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++)
- {
+ for(s->mb_x=0; s->mb_x < s->mb_width*2; s->mb_x++){
x8_get_prediction(w);
- if(x8_setup_spatial_predictor(w, 0)) goto error;
- if(x8_decode_intra_mb(w, 0)) goto error;
+ if(x8_setup_spatial_predictor(w,0)) goto error;
+ if(x8_decode_intra_mb(w,0)) goto error;
- if(s->mb_x & s->mb_y & 1)
- {
+ if( s->mb_x & s->mb_y & 1 ){
x8_get_prediction_chroma(w);
/*when setting up chroma, no vlc is read,
so no error condition can be reached*/
- x8_setup_spatial_predictor(w, 1);
- if(x8_decode_intra_mb(w, 1)) goto error;
+ x8_setup_spatial_predictor(w,1);
+ if(x8_decode_intra_mb(w,1)) goto error;
- x8_setup_spatial_predictor(w, 2);
- if(x8_decode_intra_mb(w, 2)) goto error;
+ x8_setup_spatial_predictor(w,2);
+ if(x8_decode_intra_mb(w,2)) goto error;
- s->dest[1] += 8;
- s->dest[2] += 8;
+ s->dest[1]+= 8;
+ s->dest[2]+= 8;
/*emulate MB info in the relevant tables*/
- s->mbskip_table [mb_xy] = 0;
- s->mbintra_table[mb_xy] = 1;
- s->current_picture.qscale_table[mb_xy] = w->quant;
+ s->mbskip_table [mb_xy]=0;
+ s->mbintra_table[mb_xy]=1;
+ s->current_picture.qscale_table[mb_xy]=w->quant;
mb_xy++;
}
- s->dest[0] += 8;
+ s->dest[0]+= 8;
}
- if(s->mb_y & 1)
- {
- ff_draw_horiz_band(s, (s->mb_y - 1) * 8, 16);
+ if(s->mb_y&1){
+ ff_draw_horiz_band(s, (s->mb_y-1)*8, 16);
}
}
error:
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
- (s->mb_x >> 1) - 1, (s->mb_y >> 1) - 1,
- (AC_END | DC_END | MV_END));
+ (s->mb_x>>1)-1, (s->mb_y>>1)-1,
+ (AC_END|DC_END|MV_END) );
return 0;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.h
index c7cac25bc..8ce4f8d09 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8.h
@@ -22,8 +22,7 @@
#include "get_bits.h"
#include "mpegvideo.h"
-typedef struct
-{
+typedef struct{
VLC * j_ac_vlc[4];//they point to the static j_mb_vlc
VLC * j_orient_vlc;
VLC * j_dc_vlc[3];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8dsp.c
index e85d7bed7..05d6f66fb 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8dsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8dsp.c
@@ -62,97 +62,81 @@ area positions, #3 is 1 pixel only, other are 8 pixels
4 - mb_x>= (mb_width-1) last block in the row, interpolate area #5;
*/
static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst, int linesize,
- int * range, int * psum, int edges)
-{
+ int * range, int * psum, int edges){
uint8_t * ptr;
int sum;
int i;
- int min_pix, max_pix;
+ int min_pix,max_pix;
uint8_t c;
- if((edges & 3) == 3)
- {
- *psum = 0x80 * (8 + 1 + 8 + 2);
- *range = 0;
- memset(dst, 0x80, 16 + 1 + 16 + 8);
+ if((edges&3)==3){
+ *psum=0x80*(8+1+8+2);
+ *range=0;
+ memset(dst,0x80,16+1+16+8);
//this triggers flat_dc for sure.
//flat_dc avoids all (other) prediction modes, but requires dc_level decoding.
return;
}
- min_pix = 256;
- max_pix = -1;
+ min_pix=256;
+ max_pix=-1;
- sum = 0;
+ sum=0;
- if(!(edges & 1)) //(mb_x!=0)//there is previous block on this row
- {
- ptr = src - 1; //left column, area 2
- for(i = 7; i >= 0; i--)
- {
- c = *(ptr - 1); //area1, same mb as area2, no need to check
- dst[area1+i] = c;
- c = *(ptr);
+ if(!(edges&1)){//(mb_x!=0)//there is previous block on this row
+ ptr=src-1;//left column, area 2
+ for(i=7;i>=0;i--){
+ c=*(ptr-1);//area1, same mb as area2, no need to check
+ dst[area1+i]=c;
+ c=*(ptr);
- sum += c;
- min_pix = FFMIN(min_pix, c);
- max_pix = FFMAX(max_pix, c);
- dst[area2+i] = c;
+ sum+=c;
+ min_pix=FFMIN(min_pix,c);
+ max_pix=FFMAX(max_pix,c);
+ dst[area2+i]=c;
- ptr += linesize;
+ ptr+=linesize;
}
}
- if(!(edges & 2)) //(mb_y!=0)//there is row above
- {
- ptr = src - linesize; //top line
- for(i = 0; i < 8; i++)
- {
- c = *(ptr + i);
- sum += c;
- min_pix = FFMIN(min_pix, c);
- max_pix = FFMAX(max_pix, c);
- }
- if(edges & 4) //last block on the row?
- {
- memset(dst + area5, c, 8); //set with last pixel fr
- memcpy(dst + area4, ptr, 8);
+ if(!(edges&2)){ //(mb_y!=0)//there is row above
+ ptr=src-linesize;//top line
+ for(i=0;i<8;i++){
+ c=*(ptr+i);
+ sum+=c;
+ min_pix=FFMIN(min_pix, c);
+ max_pix=FFMAX(max_pix, c);
}
- else
- {
- memcpy(dst + area4, ptr, 16); //both area4 and 5
+ if(edges&4){//last block on the row?
+ memset(dst+area5,c,8);//set with last pixel fr
+ memcpy(dst+area4, ptr, 8);
+ }else{
+ memcpy(dst+area4, ptr, 16);//both area4 and 5
}
- memcpy(dst + area6, ptr - linesize, 8); //area6 always present in the above block
+ memcpy(dst+area6, ptr-linesize, 8);//area6 always present in the above block
}
//now calculate the stuff we need
- if(edges & 3) //mb_x==0 || mb_y==0){
- {
- int avg = (sum + 4) >> 3;
- if(edges & 1) //(mb_x==0) {//implies mb_y!=0
- {
- memset(dst + area1, avg, 8 + 8 + 1); //areas 1,2 and 3 are averaged
- }
- else //implies y==0 x!=0
- {
- memset(dst + area3, avg, 1 + 16 + 8); //areas 3, 4,5,6
+ if(edges&3){//mb_x==0 || mb_y==0){
+ int avg=(sum+4)>>3;
+ if(edges&1){ //(mb_x==0) {//implies mb_y!=0
+ memset(dst+area1,avg,8+8+1);//areas 1,2 and 3 are averaged
+ }else{//implies y==0 x!=0
+ memset(dst+area3,avg, 1+16+8);//areas 3, 4,5,6
}
- sum += avg * 9;
- }
- else
- {
- uint8_t c = *(src - 1 - linesize); //the edge pixel, in the top line and left column
- dst[area3] = c;
- sum += c;
+ sum+=avg*9;
+ }else{
+ uint8_t c=*(src-1-linesize);//the edge pixel, in the top line and left column
+ dst[area3]=c;
+ sum+=c;
//edge pixel is not part of min/max
}
(*range) = max_pix - min_pix;
- sum += *(dst + area5) + *(dst + area5 + 1);
+ sum += *(dst+area5) + *(dst+area5+1);
*psum = sum;
}
-static const uint16_t zero_prediction_weights[64*2] =
-{
+static const uint16_t zero_prediction_weights[64*2] = {
640, 640, 669, 480, 708, 354, 748, 257, 792, 198, 760, 143, 808, 101, 772, 72,
480, 669, 537, 537, 598, 416, 661, 316, 719, 250, 707, 185, 768, 134, 745, 97,
354, 708, 416, 598, 488, 488, 564, 388, 634, 317, 642, 241, 716, 179, 706, 132,
@@ -163,321 +147,255 @@ static const uint16_t zero_prediction_weights[64*2] =
110, 1172, 144, 1107, 193, 1028, 254, 932, 317, 846, 366, 731, 458, 611, 499, 499
};
-static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize)
-{
- int i, j;
- int x, y;
+static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
+ int i,j;
+ 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));
-
- for(i = 0; i < 8; i++)
- {
- a = src[area2+7-i] << 4;
- for(j = 0; j < 8; j++)
- {
- p = abs(i - j);
- left_sum[p&1][j] += a >> (p >> 1);
+ memset(left_sum,0,2*8*sizeof(uint16_t));
+ memset( top_sum,0,2*8*sizeof(uint16_t));
+
+ for(i=0;i<8;i++){
+ a=src[area2+7-i]<<4;
+ for(j=0;j<8;j++){
+ p=abs(i-j);
+ left_sum[p&1][j]+= a>>(p>>1);
}
}
- for(i = 0; i < 8; i++)
- {
- a = src[area4+i] << 4;
- for(j = 0; j < 8; j++)
- {
- p = abs(i - j);
- top_sum[p&1][j] += a >> (p >> 1);
+ for(i=0;i<8;i++){
+ a=src[area4+i]<<4;
+ for(j=0;j<8;j++){
+ p=abs(i-j);
+ top_sum[p&1][j]+= a>>(p>>1);
}
}
- for(; i < 10; i++)
- {
- a = src[area4+i] << 4;
- for(j = 5; j < 8; j++)
- {
- p = abs(i - j);
- top_sum[p&1][j] += a >> (p >> 1);
+ for(;i<10;i++){
+ a=src[area4+i]<<4;
+ for(j=5;j<8;j++){
+ p=abs(i-j);
+ top_sum[p&1][j]+= a>>(p>>1);
}
}
- for(; i < 12; i++)
- {
- a = src[area4+i] << 4;
- for(j = 7; j < 8; j++)
- {
- p = abs(i - j);
- top_sum[p&1][j] += a >> (p >> 1);
+ for(;i<12;i++){
+ a=src[area4+i]<<4;
+ for(j=7;j<8;j++){
+ p=abs(i-j);
+ top_sum[p&1][j]+= a>>(p>>1);
}
}
- for(i = 0; i < 8; i++)
- {
- top_sum [0][i] += (top_sum [1][i] * 181 + 128) >> 8; //181 is sqrt(2)/2
- left_sum[0][i] += (left_sum[1][i] * 181 + 128) >> 8;
+ for(i=0;i<8;i++){
+ top_sum [0][i]+=(top_sum [1][i]*181 + 128 )>>8;//181 is sqrt(2)/2
+ left_sum[0][i]+=(left_sum[1][i]*181 + 128 )>>8;
}
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
dst[x] = (
- (uint32_t)top_sum [0][x] * zero_prediction_weights[y*16+x*2+0] +
- (uint32_t)left_sum[0][y] * zero_prediction_weights[y*16+x*2+1] +
- 0x8000
- ) >> 16;
+ (uint32_t)top_sum [0][x]*zero_prediction_weights[y*16+x*2+0] +
+ (uint32_t)left_sum[0][y]*zero_prediction_weights[y*16+x*2+1] +
+ 0x8000
+ )>>16;
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_1(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_1(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = src[area4 + FFMIN(2*y+x+2, 15)];
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=src[area4 + FFMIN(2*y+x+2, 15) ];
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_2(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_2(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = src[area4 +1+y+x];
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=src[area4 +1+y+x];
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_3(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_3(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = src[area4 +((y+1)>>1)+x];
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=src[area4 +((y+1)>>1)+x];
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_4(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_4(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = (src[area4+x] + src[area6+x] + 1) >> 1;
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=( src[area4+x] + src[area6+x] + 1 )>>1;
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_5(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
-
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- if(2 * x - y < 0)
- {
- dst[x] = src[area2+9+2*x-y];
- }
- else
- {
- dst[x] = src[area4 +x-((y+1)>>1)];
+static void spatial_compensation_5(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
+
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ if(2*x-y<0){
+ dst[x]=src[area2+9+2*x-y];
+ }else{
+ dst[x]=src[area4 +x-((y+1)>>1)];
}
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_6(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_6(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = src[area3+x-y];
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=src[area3+x-y];
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_7(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
-
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- if(x - 2 * y > 0)
- {
- dst[x] = (src[area3-1+x-2*y] + src[area3+x-2*y] + 1) >> 1;
- }
- else
- {
- dst[x] = src[area2+8-y +(x>>1)];
+static void spatial_compensation_7(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
+
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ if(x-2*y>0){
+ dst[x]=( src[area3-1+x-2*y] + src[area3+x-2*y] + 1)>>1;
+ }else{
+ dst[x]=src[area2+8-y +(x>>1)];
}
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_8(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_8(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = (src[area1+7-y] + src[area2+7-y] + 1) >> 1;
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=( src[area1+7-y] + src[area2+7-y] + 1 )>>1;
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_9(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_9(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = src[area2+6-FFMIN(x+y, 6)];
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=src[area2+6-FFMIN(x+y,6)];
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_10(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_10(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = (src[area2+7-y] * (8 - x) + src[area4+x] * x + 4) >> 3;
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=(src[area2+7-y]*(8-x)+src[area4+x]*x+4)>>3;
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void spatial_compensation_11(uint8_t *src , uint8_t *dst, int linesize)
-{
- int x, y;
+static void spatial_compensation_11(uint8_t *src , uint8_t *dst, int linesize){
+ int x,y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = (src[area2+7-y] * y + src[area4+x] * (8 - y) + 4) >> 3;
+ for(y=0;y<8;y++){
+ for(x=0;x<8;x++){
+ dst[x]=(src[area2+7-y]*y+src[area4+x]*(8-y)+4)>>3;
}
- dst += linesize;
+ dst+=linesize;
}
}
-static void x8_loop_filter(uint8_t * ptr, const int a_stride, const int b_stride, int quant)
-{
- int i, t;
- int p0, p1, p2, p3, p4, p5, p6, p7, p8, p9;
- int ql = (quant + 10) >> 3;
-
- for(i = 0; i < 8; i++, ptr += b_stride)
- {
- p0 = ptr[-5*a_stride];
- p1 = ptr[-4*a_stride];
- p2 = ptr[-3*a_stride];
- p3 = ptr[-2*a_stride];
- p4 = ptr[-1*a_stride];
- p5 = ptr[ 0 ];
- p6 = ptr[ 1*a_stride];
- p7 = ptr[ 2*a_stride];
- p8 = ptr[ 3*a_stride];
- p9 = ptr[ 4*a_stride];
-
- t =
- (FFABS(p1 - p2) <= ql) +
- (FFABS(p2 - p3) <= ql) +
- (FFABS(p3 - p4) <= ql) +
- (FFABS(p4 - p5) <= ql);
- if(t > 0) //You need at least 1 to be able to reach a total score of 6.
- {
- t +=
- (FFABS(p5 - p6) <= ql) +
- (FFABS(p6 - p7) <= ql) +
- (FFABS(p7 - p8) <= ql) +
- (FFABS(p8 - p9) <= ql) +
- (FFABS(p0 - p1) <= ql);
- if(t >= 6)
- {
- int min, max;
-
- min = max = p1;
- min = FFMIN(min, p3);
- max = FFMAX(max, p3);
- min = FFMIN(min, p5);
- max = FFMAX(max, p5);
- min = FFMIN(min, p8);
- max = FFMAX(max, p8);
- if(max - min < 2 * quant) //early stop
- {
- min = FFMIN(min, p2);
- max = FFMAX(max, p2);
- min = FFMIN(min, p4);
- max = FFMAX(max, p4);
- min = FFMIN(min, p6);
- max = FFMAX(max, p6);
- min = FFMIN(min, p7);
- max = FFMAX(max, p7);
- if(max - min < 2 * quant)
- {
- ptr[-2*a_stride] = (4 * p2 + 3 * p3 + 1 * p7 + 4) >> 3;
- ptr[-1*a_stride] = (3 * p2 + 3 * p4 + 2 * p7 + 4) >> 3;
- ptr[ 0 ] = (2 * p2 + 3 * p5 + 3 * p7 + 4) >> 3;
- ptr[ 1*a_stride] = (1 * p2 + 3 * p6 + 4 * p7 + 4) >> 3;
+static void x8_loop_filter(uint8_t * ptr, const int a_stride, const int b_stride, int quant){
+ int i,t;
+ int p0,p1,p2,p3,p4,p5,p6,p7,p8,p9;
+ int ql=(quant+10)>>3;
+
+ for(i=0; i<8; i++,ptr+=b_stride){
+ p0=ptr[-5*a_stride];
+ p1=ptr[-4*a_stride];
+ p2=ptr[-3*a_stride];
+ p3=ptr[-2*a_stride];
+ p4=ptr[-1*a_stride];
+ p5=ptr[ 0 ];
+ p6=ptr[ 1*a_stride];
+ p7=ptr[ 2*a_stride];
+ p8=ptr[ 3*a_stride];
+ p9=ptr[ 4*a_stride];
+
+ t=
+ (FFABS(p1-p2) <= ql) +
+ (FFABS(p2-p3) <= ql) +
+ (FFABS(p3-p4) <= ql) +
+ (FFABS(p4-p5) <= ql);
+ if(t>0){//You need at least 1 to be able to reach a total score of 6.
+ t+=
+ (FFABS(p5-p6) <= ql) +
+ (FFABS(p6-p7) <= ql) +
+ (FFABS(p7-p8) <= ql) +
+ (FFABS(p8-p9) <= ql) +
+ (FFABS(p0-p1) <= ql);
+ if(t>=6){
+ int min,max;
+
+ min=max=p1;
+ min=FFMIN(min,p3); max=FFMAX(max,p3);
+ min=FFMIN(min,p5); max=FFMAX(max,p5);
+ min=FFMIN(min,p8); max=FFMAX(max,p8);
+ if(max-min<2*quant){//early stop
+ min=FFMIN(min,p2); max=FFMAX(max,p2);
+ min=FFMIN(min,p4); max=FFMAX(max,p4);
+ min=FFMIN(min,p6); max=FFMAX(max,p6);
+ min=FFMIN(min,p7); max=FFMAX(max,p7);
+ if(max-min<2*quant){
+ ptr[-2*a_stride]=(4*p2 + 3*p3 + 1*p7 + 4)>>3;
+ ptr[-1*a_stride]=(3*p2 + 3*p4 + 2*p7 + 4)>>3;
+ ptr[ 0 ]=(2*p2 + 3*p5 + 3*p7 + 4)>>3;
+ ptr[ 1*a_stride]=(1*p2 + 3*p6 + 4*p7 + 4)>>3;
continue;
};
}
}
}
{
- int x, x0, x1, x2;
+ int x,x0,x1,x2;
int m;
- x0 = (2 * p3 - 5 * p4 + 5 * p5 - 2 * p6 + 4) >> 3;
- if(FFABS(x0) < quant)
- {
- x1 = (2 * p1 - 5 * p2 + 5 * p3 - 2 * p4 + 4) >> 3;
- x2 = (2 * p5 - 5 * p6 + 5 * p7 - 2 * p8 + 4) >> 3;
+ x0 = (2*p3 - 5*p4 + 5*p5 - 2*p6 + 4)>>3;
+ if(FFABS(x0) < quant){
+ x1=(2*p1 - 5*p2 + 5*p3 - 2*p4 + 4)>>3;
+ x2=(2*p5 - 5*p6 + 5*p7 - 2*p8 + 4)>>3;
- x = FFABS(x0) - FFMIN(FFABS(x1), FFABS(x2));
- m = p4 - p5;
+ x=FFABS(x0) - FFMIN( FFABS(x1), FFABS(x2) );
+ m=p4-p5;
- if(x > 0 && (m ^ x0) < 0)
- {
+ if( x > 0 && (m^x0) <0){
int32_t sign;
- sign = m >> 31;
- m = (m ^ sign) - sign; //abs(m)
- m >>= 1;
+ sign=m>>31;
+ m=(m^sign)-sign;//abs(m)
+ m>>=1;
- x = (5 * x) >> 3;
+ x=(5*x)>>3;
- if(x > m) x = m;
+ if(x>m) x=m;
- x = (x ^ sign) - sign;
+ x=(x^sign)-sign;
ptr[-1*a_stride] -= x;
ptr[ 0] += x;
@@ -487,31 +405,28 @@ static void x8_loop_filter(uint8_t * ptr, const int a_stride, const int b_stride
}
}
-static void x8_h_loop_filter(uint8_t *src, int stride, int qscale)
-{
+static void x8_h_loop_filter(uint8_t *src, int stride, int qscale){
x8_loop_filter(src, stride, 1, qscale);
}
-static void x8_v_loop_filter(uint8_t *src, int stride, int qscale)
-{
+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(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;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8huf.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8huf.h
index 3832848b7..375906bab 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8huf.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intrax8huf.h
@@ -22,36 +22,32 @@
#include <inttypes.h>
-static const uint16_t x8_orient_lowquant_table[4][12][2] =
-{
- {
- //0
+static const uint16_t x8_orient_lowquant_table[4][12][2]={
+ {//0
{0x0000, 1}, {0x0004, 3}, {0x0005, 3}, {0x000C, 4},
{0x000D, 4}, {0x0038, 6}, {0x001D, 5}, {0x0039, 6},
{0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x003F, 6},
- }, { //1
+ },{//1
{0x0000, 5}, {0x0001, 5}, {0x0002, 5}, {0x0001, 2},
{0x0002, 2}, {0x0002, 4}, {0x0003, 5}, {0x0006, 3},
{0x0003, 4}, {0x000E, 4}, {0x001E, 5}, {0x001F, 5},
- }, { //2
+ },{//2
{0x0000, 2}, {0x0001, 2}, {0x0004, 3}, {0x0005, 3},
{0x0006, 3}, {0x0038, 6}, {0x0039, 6}, {0x001D, 5},
{0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x003F, 6},
- }, { //3
+ },{//3
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0001, 2},
{0x0002, 2}, {0x0018, 5}, {0x0019, 5}, {0x000D, 4},
{0x001C, 5}, {0x001D, 5}, {0x001E, 5}, {0x001F, 5},
}
};
-static const uint16_t x8_orient_highquant_table[2][12][2] =
-{
- {
- //0
+static const uint16_t x8_orient_highquant_table[2][12][2]={
+ {//0
{0x0000, 2}, {0x0001, 2}, {0x0004, 3}, {0x0005, 3},
{0x0006, 3}, {0x0038, 6}, {0x001D, 5}, {0x0039, 6},
{0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x003F, 6},
- }, { //1
+ },{//1
{0x0000, 1}, {0x0002, 2}, {0x0006, 3}, {0x001C, 5},
{0x001D, 5}, {0x0078, 7}, {0x003D, 6}, {0x0079, 7},
{0x007C, 7}, {0x007D, 7}, {0x007E, 7}, {0x007F, 7},
@@ -60,10 +56,8 @@ static const uint16_t x8_orient_highquant_table[2][12][2] =
#define MAX_OR_VLC_BITS 7
-static const uint16_t x8_dc_lowquant_table[8][34][2] =
-{
- {
- //0
+static const uint16_t x8_dc_lowquant_table[8][34][2]={
+ {//0
{0x0000, 5}, {0x0001, 4}, {0x0001, 5}, {0x0004, 5},
{0x0005, 5}, {0x0006, 5}, {0x000E, 6}, {0x000F, 6},
{0x0040, 8}, {0x0041, 8}, {0x0840, 13}, {0x0841, 13},
@@ -73,7 +67,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x0085, 9}, {0x0847, 13}, {0x0848, 13}, {0x0849, 13},
{0x084A, 13}, {0x084B, 13}, {0x084C, 13}, {0x084D, 13},
{0x084E, 13}, {0x084F, 13},
- }, { //1
+ },{//1
{0x0000, 4}, {0x0001, 3}, {0x0002, 3}, {0x0001, 4},
{0x0006, 4}, {0x0004, 3}, {0x0007, 4}, {0x0005, 3},
{0x000C, 4}, {0x000D, 4}, {0x001C, 5}, {0x003A, 6},
@@ -83,7 +77,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x01FE, 9}, {0x1DA3, 13}, {0x1DA4, 13}, {0x1DA5, 13},
{0x0ED3, 12}, {0x0ED4, 12}, {0x01FF, 9}, {0x0ED5, 12},
{0x0ED6, 12}, {0x0ED7, 12},
- }, { //2
+ },{//2
{0x0000, 4}, {0x0001, 3}, {0x0002, 3}, {0x0001, 4},
{0x0006, 4}, {0x0007, 4}, {0x0008, 4}, {0x0009, 4},
{0x0028, 6}, {0x0029, 6}, {0x0054, 7}, {0x0055, 7},
@@ -93,7 +87,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x00AD, 8}, {0x0AC5, 12}, {0x0AC6, 12}, {0x0AC7, 12},
{0x0AC8, 12}, {0x0AC9, 12}, {0x0ACA, 12}, {0x0ACB, 12},
{0x0566, 11}, {0x0567, 11},
- }, { //3
+ },{//3
{0x0000, 4}, {0x0001, 2}, {0x0001, 3}, {0x0004, 3},
{0x0005, 3}, {0x0006, 3}, {0x0001, 4}, {0x000E, 4},
{0x003C, 6}, {0x003D, 6}, {0x007C, 7}, {0x00FA, 8},
@@ -103,7 +97,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x1F66, 13}, {0x1F67, 13}, {0x1F68, 13}, {0x1F69, 13},
{0x1F6A, 13}, {0x1F6B, 13}, {0x1F6C, 13}, {0x1F6D, 13},
{0x1F6E, 13}, {0x1F6F, 13},
- }, { //4
+ },{//4
{0x0000, 7}, {0x0001, 7}, {0x0002, 7}, {0x0003, 7},
{0x0004, 7}, {0x0005, 7}, {0x0006, 7}, {0x0007, 7},
{0x0008, 7}, {0x0009, 7}, {0x000A, 7}, {0x000B, 7},
@@ -113,7 +107,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x0016, 7}, {0x0017, 7}, {0x0018, 7}, {0x0019, 7},
{0x001A, 7}, {0x001B, 7}, {0x001C, 7}, {0x001D, 7},
{0x001E, 7}, {0x001F, 7},
- }, { //5
+ },{//5
{0x0000, 5}, {0x0001, 4}, {0x0001, 5}, {0x0008, 6},
{0x0009, 6}, {0x000A, 6}, {0x0016, 7}, {0x000C, 6},
{0x0017, 7}, {0x000D, 6}, {0x0038, 8}, {0x001D, 7},
@@ -123,7 +117,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x0785, 13}, {0x0786, 13}, {0x0787, 13}, {0x0788, 13},
{0x0789, 13}, {0x078A, 13}, {0x078B, 13}, {0x078C, 13},
{0x078D, 13}, {0x03C7, 12},
- }, { //6
+ },{//6
{0x0000, 4}, {0x0001, 2}, {0x0001, 3}, {0x0004, 3},
{0x0001, 4}, {0x000A, 4}, {0x0016, 5}, {0x002E, 6},
{0x005E, 7}, {0x005F, 7}, {0x00C0, 8}, {0x3040, 14},
@@ -133,7 +127,7 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
{0x3045, 14}, {0x3046, 14}, {0x3047, 14}, {0x3048, 14},
{0x3049, 14}, {0x304A, 14}, {0x304B, 14}, {0x304C, 14},
{0x304D, 14}, {0x1827, 13},
- }, { //7
+ },{//7
{0x0000, 6}, {0x0001, 6}, {0x0002, 6}, {0x0006, 7},
{0x0007, 7}, {0x0004, 6}, {0x0005, 6}, {0x0006, 6},
{0x000E, 7}, {0x001E, 8}, {0x001F, 8}, {0x0040, 9},
@@ -146,10 +140,8 @@ static const uint16_t x8_dc_lowquant_table[8][34][2] =
}
};
-static const uint16_t x8_dc_highquant_table[8][34][2] =
-{
- {
- //0
+static const uint16_t x8_dc_highquant_table[8][34][2]={
+ {//0
{0x0000, 5}, {0x0001, 4}, {0x0002, 4}, {0x0001, 5},
{0x0006, 5}, {0x0004, 4}, {0x0007, 5}, {0x000A, 5},
{0x002C, 7}, {0x002D, 7}, {0x05C0, 12}, {0x05C1, 12},
@@ -159,7 +151,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x005D, 8}, {0x05C7, 12}, {0x05C8, 12}, {0x05C9, 12},
{0x05CA, 12}, {0x05CB, 12}, {0x05CC, 12}, {0x05CD, 12},
{0x05CE, 12}, {0x05CF, 12},
- }, { //1
+ },{//1
{0x0000, 3}, {0x0001, 3}, {0x0002, 3}, {0x0006, 4},
{0x0007, 4}, {0x0004, 3}, {0x000A, 4}, {0x000B, 4},
{0x0030, 6}, {0x0062, 7}, {0x0063, 7}, {0x0640, 11},
@@ -169,7 +161,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x007A, 7}, {0x0646, 11}, {0x007B, 7}, {0x0647, 11},
{0x0648, 11}, {0x0649, 11}, {0x064A, 11}, {0x064B, 11},
{0x0326, 10}, {0x0327, 10},
- }, { //2
+ },{//2
{0x0000, 7}, {0x0001, 7}, {0x0001, 6}, {0x0004, 7},
{0x0003, 6}, {0x0005, 7}, {0x0010, 8}, {0x0011, 8},
{0x0240, 13}, {0x0241, 13}, {0x0242, 13}, {0x0243, 13},
@@ -179,7 +171,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x0126, 12}, {0x0127, 12}, {0x0128, 12}, {0x0129, 12},
{0x012A, 12}, {0x012B, 12}, {0x012C, 12}, {0x012D, 12},
{0x012E, 12}, {0x012F, 12},
- }, { //3
+ },{//3
{0x0000, 4}, {0x0001, 3}, {0x0002, 3}, {0x0001, 4},
{0x0006, 4}, {0x0004, 3}, {0x0005, 3}, {0x0006, 3},
{0x000E, 5}, {0x000F, 5}, {0x0070, 7}, {0x0710, 11},
@@ -189,7 +181,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x007E, 7}, {0x0716, 11}, {0x0717, 11}, {0x0718, 11},
{0x007F, 7}, {0x0719, 11}, {0x071A, 11}, {0x071B, 11},
{0x038E, 10}, {0x038F, 10},
- }, { //4
+ },{//4
{0x0000, 8}, {0x0001, 7}, {0x0002, 7}, {0x0003, 7},
{0x0002, 9}, {0x0008, 8}, {0x0003, 9}, {0x0240, 14},
{0x0241, 14}, {0x0242, 14}, {0x0243, 14}, {0x0244, 14},
@@ -199,7 +191,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x0126, 13}, {0x0127, 13}, {0x0128, 13}, {0x0129, 13},
{0x012A, 13}, {0x012B, 13}, {0x012C, 13}, {0x012D, 13},
{0x012E, 13}, {0x012F, 13},
- }, { //5
+ },{//5
{0x0000, 7}, {0x0001, 7}, {0x0001, 6}, {0x0002, 6},
{0x0003, 6}, {0x0004, 6}, {0x0005, 6}, {0x0006, 6},
{0x0007, 6}, {0x0008, 6}, {0x0009, 6}, {0x000A, 6},
@@ -209,7 +201,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x0017, 6}, {0x0018, 6}, {0x0019, 6}, {0x0001, 1},
{0x001A, 6}, {0x001B, 6}, {0x001C, 6}, {0x001D, 6},
{0x001E, 6}, {0x001F, 6},
- }, { //6
+ },{//6
{0x0000, 5}, {0x0001, 4}, {0x0001, 5}, {0x0004, 5},
{0x000A, 6}, {0x0006, 5}, {0x000B, 6}, {0x000E, 6},
{0x003C, 8}, {0x003D, 8}, {0x07C0, 13}, {0x07C1, 13},
@@ -219,7 +211,7 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
{0x007D, 9}, {0x07C7, 13}, {0x07C8, 13}, {0x07C9, 13},
{0x07CA, 13}, {0x07CB, 13}, {0x07CC, 13}, {0x07CD, 13},
{0x07CE, 13}, {0x07CF, 13},
- }, { //7
+ },{//7
{0x0000, 7}, {0x0001, 7}, {0x0002, 7}, {0x0003, 7},
{0x0004, 7}, {0x0005, 7}, {0x0006, 7}, {0x0007, 7},
{0x0008, 7}, {0x0009, 7}, {0x000A, 7}, {0x000B, 7},
@@ -234,10 +226,8 @@ static const uint16_t x8_dc_highquant_table[8][34][2] =
#define MAX_DC_VLC_BITS 14
-static const uint16_t x8_ac0_lowquant_table[8][77][2] =
-{
- {
- //0
+static const uint16_t x8_ac0_lowquant_table[8][77][2]={
+ {//0
{0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5},
{0x001E, 6}, {0x003E, 7}, {0x003F, 7}, {0x0040, 7},
{0x0104, 9}, {0x0083, 8}, {0x0084, 8}, {0x0085, 8},
@@ -258,7 +248,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x3ED2, 14}, {0x3ED3, 14}, {0x3ED4, 14}, {0x3ED5, 14},
{0x1F6B, 13}, {0x1F6C, 13}, {0x1F6D, 13}, {0x1F6E, 13},
{0x1F6F, 13},
- }, { //1
+ },{//1
{0x0000, 3}, {0x0004, 5}, {0x0014, 7}, {0x000B, 6},
{0x000C, 6}, {0x002A, 8}, {0x002B, 8}, {0x0034, 8},
{0x0D40, 14}, {0x0D41, 14}, {0x001B, 7}, {0x0D42, 14},
@@ -279,7 +269,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x06B7, 13}, {0x06B8, 13}, {0x06B9, 13}, {0x06BA, 13},
{0x06BB, 13}, {0x06BC, 13}, {0x06BD, 13}, {0x06BE, 13},
{0x06BF, 13},
- }, { //2
+ },{//2
{0x0000, 2}, {0x0002, 3}, {0x0003, 3}, {0x0008, 4},
{0x0012, 5}, {0x0013, 5}, {0x0028, 6}, {0x0029, 6},
{0x0054, 7}, {0x0055, 7}, {0x0056, 7}, {0x00AE, 8},
@@ -300,7 +290,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x7CB8, 15}, {0x7CB9, 15}, {0x7CBA, 15}, {0x7CBB, 15},
{0x7CBC, 15}, {0x01F7, 9}, {0x7CBD, 15}, {0x7CBE, 15},
{0x7CBF, 15},
- }, { //3
+ },{//3
{0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5},
{0x000F, 5}, {0x0020, 6}, {0x0021, 6}, {0x0044, 7},
{0x0045, 7}, {0x008C, 8}, {0x008D, 8}, {0x011C, 9},
@@ -321,7 +311,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x75F9, 15}, {0x75FA, 15}, {0x75FB, 15}, {0x75FC, 15},
{0x75FD, 15}, {0x007F, 7}, {0x3AFF, 14}, {0x0F9E, 12},
{0x0F9F, 12},
- }, { //4
+ },{//4
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0012, 6}, {0x0013, 6}, {0x0014, 6}, {0x002A, 7},
{0x0016, 6}, {0x002B, 7}, {0x005C, 8}, {0x005D, 8},
@@ -342,7 +332,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x03DD, 10}, {0x6715, 15}, {0x338B, 14}, {0x338C, 14},
{0x338D, 14}, {0x001F, 5}, {0x01EF, 9}, {0x338E, 14},
{0x338F, 14},
- }, { //5
+ },{//5
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5},
{0x0018, 6}, {0x0019, 6}, {0x0034, 7}, {0x006A, 8},
{0x006B, 8}, {0x006C, 8}, {0x00DA, 9}, {0x036C, 11},
@@ -363,7 +353,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x3787, 15}, {0x1BC4, 14}, {0x1BC5, 14}, {0x1BC6, 14},
{0x1BC7, 14}, {0x001F, 5}, {0x03DD, 10}, {0x07B3, 11},
{0x01EF, 9},
- }, { //6
+ },{//6
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x0016, 6},
{0x0017, 6}, {0x0060, 8}, {0x00C2, 9}, {0x0186, 10},
{0x0187, 10}, {0x00C4, 9}, {0x3140, 15}, {0x3141, 15},
@@ -384,7 +374,7 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
{0x3155, 15}, {0x3156, 15}, {0x3157, 15}, {0x3158, 15},
{0x3159, 15}, {0x00FF, 8}, {0x18AD, 14}, {0x18AE, 14},
{0x18AF, 14},
- }, { //7
+ },{//7
{0x0000, 4}, {0x0080, 11}, {0x0081, 11}, {0x0082, 11},
{0x0083, 11}, {0x0084, 11}, {0x0085, 11}, {0x0086, 11},
{0x0087, 11}, {0x0088, 11}, {0x0089, 11}, {0x008A, 11},
@@ -408,10 +398,8 @@ static const uint16_t x8_ac0_lowquant_table[8][77][2] =
}
};
-static const uint16_t x8_ac0_highquant_table[8][77][2] =
-{
- {
- //0
+static const uint16_t x8_ac0_highquant_table[8][77][2]={
+ {//0
{0x0000, 3}, {0x0002, 4}, {0x000C, 6}, {0x000D, 6},
{0x001C, 7}, {0x000F, 6}, {0x1D00, 15}, {0x003B, 8},
{0x1D01, 15}, {0x0075, 9}, {0x1D02, 15}, {0x0080, 9},
@@ -432,7 +420,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x01FE, 9}, {0x0E99, 14}, {0x0E9A, 14}, {0x0E9B, 14},
{0x0E9C, 14}, {0x01FF, 9}, {0x0E9D, 14}, {0x0E9E, 14},
{0x0E9F, 14},
- }, { //1
+ },{//1
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0012, 6}, {0x0013, 6}, {0x0014, 6}, {0x0015, 6},
{0x002C, 7}, {0x005A, 8}, {0x005B, 8}, {0x005C, 8},
@@ -453,7 +441,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x178B, 14}, {0x178C, 14}, {0x178D, 14}, {0x01EC, 9},
{0x178E, 14}, {0x001F, 5}, {0x00F7, 8}, {0x01ED, 9},
{0x178F, 14},
- }, { //2
+ },{//2
{0x0000, 4}, {0x0002, 5}, {0x0180, 12}, {0x0181, 12},
{0x0182, 12}, {0x0183, 12}, {0x0184, 12}, {0x0185, 12},
{0x0186, 12}, {0x0187, 12}, {0x0188, 12}, {0x0189, 12},
@@ -474,7 +462,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x00F7, 11}, {0x00F8, 11}, {0x00F9, 11}, {0x00FA, 11},
{0x00FB, 11}, {0x00FC, 11}, {0x00FD, 11}, {0x00FE, 11},
{0x00FF, 11},
- }, { //3
+ },{//3
{0x0000, 8}, {0x0001, 8}, {0x0002, 8}, {0x0003, 8},
{0x0004, 8}, {0x0005, 8}, {0x0006, 8}, {0x0007, 8},
{0x0008, 8}, {0x0009, 8}, {0x000A, 8}, {0x000B, 8},
@@ -495,7 +483,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x0037, 7}, {0x0038, 7}, {0x0039, 7}, {0x003A, 7},
{0x003B, 7}, {0x003C, 7}, {0x003D, 7}, {0x003E, 7},
{0x003F, 7},
- }, { //4
+ },{//4
{0x0000, 9}, {0x0001, 9}, {0x0002, 9}, {0x0003, 9},
{0x0004, 9}, {0x0005, 9}, {0x0006, 9}, {0x0007, 9},
{0x0008, 9}, {0x0009, 9}, {0x000A, 9}, {0x000B, 9},
@@ -516,7 +504,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x0037, 8}, {0x0038, 8}, {0x0039, 8}, {0x003A, 8},
{0x003B, 8}, {0x003C, 8}, {0x003D, 8}, {0x003E, 8},
{0x003F, 8},
- }, { //5
+ },{//5
{0x0000, 10}, {0x0001, 10}, {0x0002, 10}, {0x0003, 10},
{0x0004, 10}, {0x0005, 10}, {0x0006, 10}, {0x0007, 10},
{0x0008, 10}, {0x0009, 10}, {0x000A, 10}, {0x000B, 10},
@@ -537,7 +525,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x0037, 9}, {0x0038, 9}, {0x0039, 9}, {0x003A, 9},
{0x003B, 9}, {0x003C, 9}, {0x003D, 9}, {0x003E, 9},
{0x003F, 9},
- }, { //6
+ },{//6
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5},
{0x0018, 6}, {0x0019, 6}, {0x0034, 7}, {0x006A, 8},
{0x006B, 8}, {0x006C, 8}, {0x00DA, 9}, {0x00DB, 9},
@@ -558,7 +546,7 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
{0x1BC9, 14}, {0x1BCA, 14}, {0x1BCB, 14}, {0x1BCC, 14},
{0x1BCD, 14}, {0x001F, 5}, {0x036B, 10}, {0x1BCE, 14},
{0x1BCF, 14},
- }, { //7
+ },{//7
{0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x0007, 5},
{0x0010, 6}, {0x0044, 8}, {0x0023, 7}, {0x0012, 6},
{0x0026, 7}, {0x08A0, 13}, {0x004E, 8}, {0x004F, 8},
@@ -582,10 +570,8 @@ static const uint16_t x8_ac0_highquant_table[8][77][2] =
}
};
-static const uint16_t x8_ac1_lowquant_table[8][77][2] =
-{
- {
- //0
+static const uint16_t x8_ac1_lowquant_table[8][77][2]={
+ {//0
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0012, 6}, {0x0026, 7}, {0x0014, 6}, {0x004E, 8},
{0x004F, 8}, {0x00A8, 9}, {0x0152, 10}, {0x00AA, 9},
@@ -606,7 +592,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x3E82, 14}, {0x3E83, 14}, {0x3E84, 14}, {0x3E85, 14},
{0x3E86, 14}, {0x003F, 6}, {0x01F5, 9}, {0x07D1, 11},
{0x3E87, 14},
- }, { //1
+ },{//1
{0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5},
{0x001E, 6}, {0x001F, 6}, {0x0040, 7}, {0x0082, 8},
{0x0083, 8}, {0x0084, 8}, {0x010A, 9}, {0x010B, 9},
@@ -627,7 +613,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x3DDB, 14}, {0x3DDC, 14}, {0x3DDD, 14}, {0x3DDE, 14},
{0x3DDF, 14}, {0x003F, 6}, {0x07BC, 11}, {0x07BD, 11},
{0x03DF, 10},
- }, { //2
+ },{//2
{0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x000E, 6},
{0x001E, 7}, {0x003E, 8}, {0x003F, 8}, {0x0040, 8},
{0x0104, 10}, {0x0083, 9}, {0x0105, 10}, {0x0108, 10},
@@ -648,7 +634,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x212B, 15}, {0x212C, 15}, {0x212D, 15}, {0x212E, 15},
{0x212F, 15}, {0x001F, 5}, {0x0597, 11}, {0x00BE, 8},
{0x00BF, 8},
- }, { //3
+ },{//3
{0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x0007, 4},
{0x0010, 5}, {0x0011, 5}, {0x0024, 6}, {0x0025, 6},
{0x0026, 6}, {0x0027, 6}, {0x0050, 7}, {0x0051, 7},
@@ -669,7 +655,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x7882, 15}, {0x7883, 15}, {0x3C42, 14}, {0x3C43, 14},
{0x3C44, 14}, {0x00FD, 8}, {0x3C45, 14}, {0x3C46, 14},
{0x3C47, 14},
- }, { //4
+ },{//4
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x0016, 6},
{0x0017, 6}, {0x0030, 7}, {0x0031, 7}, {0x0064, 8},
{0x0065, 8}, {0x0066, 8}, {0x00CE, 9}, {0x00CF, 9},
@@ -690,7 +676,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x07D4, 11}, {0x1A21, 14}, {0x1A22, 14}, {0x07D5, 11},
{0x1A23, 14}, {0x003F, 6}, {0x01F6, 9}, {0x01F7, 9},
{0x03EB, 10},
- }, { //5
+ },{//5
{0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5},
{0x000F, 5}, {0x0020, 6}, {0x0021, 6}, {0x0044, 7},
{0x0045, 7}, {0x0046, 7}, {0x008E, 8}, {0x008F, 8},
@@ -711,7 +697,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x7E59, 15}, {0x7E5A, 15}, {0x7E5B, 15}, {0x7E5C, 15},
{0x7E5D, 15}, {0x007F, 7}, {0x3F2F, 14}, {0x07E6, 11},
{0x07E7, 11},
- }, { //6
+ },{//6
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0009, 5}, {0x0014, 6}, {0x0015, 6}, {0x002C, 7},
{0x005A, 8}, {0x005B, 8}, {0x005C, 8}, {0x00BA, 9},
@@ -732,7 +718,7 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
{0x6E96, 15}, {0x6E97, 15}, {0x374C, 14}, {0x374D, 14},
{0x374E, 14}, {0x001F, 5}, {0x03D7, 10}, {0x01EF, 9},
{0x374F, 14},
- }, { //7
+ },{//7
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x0016, 6},
{0x002E, 7}, {0x002F, 7}, {0x0060, 8}, {0x0061, 8},
{0x00C4, 9}, {0x00C5, 9}, {0x00C6, 9}, {0x018E, 10},
@@ -756,10 +742,8 @@ static const uint16_t x8_ac1_lowquant_table[8][77][2] =
}
};
-static const uint16_t x8_ac1_highquant_table[8][77][2] =
-{
- {
- //0
+static const uint16_t x8_ac1_highquant_table[8][77][2]={
+ {//0
{0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x0007, 5},
{0x0008, 5}, {0x0009, 5}, {0x0014, 6}, {0x002A, 7},
{0x0016, 6}, {0x002B, 7}, {0x005C, 8}, {0x002F, 7},
@@ -780,7 +764,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x03E8, 10}, {0x368C, 14}, {0x368D, 14}, {0x03E9, 10},
{0x368E, 14}, {0x003F, 6}, {0x01F5, 9}, {0x00FB, 8},
{0x368F, 14},
- }, { //1
+ },{//1
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5},
{0x0018, 6}, {0x0032, 7}, {0x0033, 7}, {0x0034, 7},
{0x006A, 8}, {0x00D6, 9}, {0x00D7, 9}, {0x00D8, 9},
@@ -801,7 +785,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x37C8, 14}, {0x37C9, 14}, {0x37CA, 14}, {0x37CB, 14},
{0x37CC, 14}, {0x001F, 5}, {0x37CD, 14}, {0x37CE, 14},
{0x37CF, 14},
- }, { //2
+ },{//2
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0012, 6}, {0x0026, 7}, {0x0014, 6}, {0x0027, 7},
{0x00A8, 9}, {0x00A9, 9}, {0x0055, 8}, {0x2B00, 15},
@@ -822,7 +806,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x03E3, 10}, {0x158C, 14}, {0x158D, 14}, {0x01F4, 9},
{0x158E, 14}, {0x003F, 6}, {0x00FB, 8}, {0x01F5, 9},
{0x158F, 14},
- }, { //3
+ },{//3
{0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x0007, 5},
{0x0010, 6}, {0x0011, 6}, {0x0024, 7}, {0x0025, 7},
{0x0013, 6}, {0x0014, 6}, {0x002A, 7}, {0x002B, 7},
@@ -843,7 +827,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x1C49, 13}, {0x1C4A, 13}, {0x1C4B, 13}, {0x1C4C, 13},
{0x1C4D, 13}, {0x00F5, 8}, {0x1C4E, 13}, {0x01E9, 9},
{0x1C4F, 13},
- }, { //4
+ },{//4
{0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5},
{0x0018, 6}, {0x0019, 6}, {0x0034, 7}, {0x0035, 7},
{0x0036, 7}, {0x006E, 8}, {0x00DE, 9}, {0x00DF, 9},
@@ -864,7 +848,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x0FA4, 12}, {0x7D09, 15}, {0x7D0A, 15}, {0x7D0B, 15},
{0x3E86, 14}, {0x003F, 6}, {0x0FA5, 12}, {0x07D3, 11},
{0x3E87, 14},
- }, { //5
+ },{//5
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0009, 5}, {0x0014, 6}, {0x002A, 7}, {0x0056, 8},
{0x02B8, 11}, {0x00AF, 9}, {0x02B9, 11}, {0x015D, 10},
@@ -885,7 +869,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x3D52, 14}, {0x3D53, 14}, {0x3D54, 14}, {0x01FA, 9},
{0x3D55, 14}, {0x007F, 7}, {0x01FB, 9}, {0x3D56, 14},
{0x3D57, 14},
- }, { //6
+ },{//6
{0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5},
{0x0009, 5}, {0x000A, 5}, {0x000B, 5}, {0x0018, 6},
{0x0032, 7}, {0x000D, 5}, {0x0033, 7}, {0x0E00, 13},
@@ -906,7 +890,7 @@ static const uint16_t x8_ac1_highquant_table[8][77][2] =
{0x0719, 12}, {0x071A, 12}, {0x071B, 12}, {0x071C, 12},
{0x071D, 12}, {0x001F, 5}, {0x071E, 12}, {0x0071, 7},
{0x071F, 12},
- }, { //7
+ },{//7
{0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x000E, 6},
{0x000F, 6}, {0x0040, 8}, {0x0041, 8}, {0x0042, 8},
{0x0218, 11}, {0x2190, 15}, {0x2191, 15}, {0x2192, 15},
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ituh263dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ituh263dec.c
index 8284f1e08..fc997f080 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ituh263dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ituh263dec.c
@@ -50,43 +50,40 @@
#define H263_MBTYPE_B_VLC_BITS 6
#define CBPC_B_VLC_BITS 3
-static const int h263_mb_type_b_map[15] =
-{
+static const int h263_mb_type_b_map[15]= {
MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP,
MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT,
- MB_TYPE_L0 | MB_TYPE_16x16,
- MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_16x16,
- MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
- MB_TYPE_L1 | MB_TYPE_16x16,
- MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_16x16,
- MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
- MB_TYPE_L0L1 | MB_TYPE_16x16,
- MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_16x16,
- MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
+ MB_TYPE_L0 | MB_TYPE_16x16,
+ MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_16x16,
+ MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
+ MB_TYPE_L1 | MB_TYPE_16x16,
+ MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_16x16,
+ MB_TYPE_L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
+ MB_TYPE_L0L1 | MB_TYPE_16x16,
+ MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_16x16,
+ MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
0, //stuffing
MB_TYPE_INTRA4x4 | MB_TYPE_CBP,
MB_TYPE_INTRA4x4 | MB_TYPE_CBP | MB_TYPE_QUANT,
};
-void ff_h263_show_pict_info(MpegEncContext *s)
-{
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
- av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s%s%s %d/%d\n",
- s->qscale, av_get_pict_type_char(s->pict_type),
- s->gb.size_in_bits, 1 - s->no_rounding,
- s->obmc ? " AP" : "",
- s->umvplus ? " UMV" : "",
- s->h263_long_vectors ? " LONG" : "",
- s->h263_plus ? " +" : "",
- s->h263_aic ? " AIC" : "",
- s->alt_inter_vlc ? " AIV" : "",
- s->modified_quant ? " MQ" : "",
- s->loop_filter ? " LOOP" : "",
- s->h263_slice_structured ? " SS" : "",
- s->avctx->time_base.den, s->avctx->time_base.num
- );
+void ff_h263_show_pict_info(MpegEncContext *s){
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
+ av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s%s%s %d/%d\n",
+ s->qscale, av_get_pict_type_char(s->pict_type),
+ s->gb.size_in_bits, 1-s->no_rounding,
+ s->obmc ? " AP" : "",
+ s->umvplus ? " UMV" : "",
+ s->h263_long_vectors ? " LONG" : "",
+ s->h263_plus ? " +" : "",
+ s->h263_aic ? " AIC" : "",
+ s->alt_inter_vlc ? " AIV" : "",
+ s->modified_quant ? " MQ" : "",
+ s->loop_filter ? " LOOP" : "",
+ s->h263_slice_structured ? " SS" : "",
+ s->avctx->time_base.den, s->avctx->time_base.num
+ );
}
}
@@ -107,32 +104,31 @@ void h263_decode_init_vlc(MpegEncContext *s)
{
static int done = 0;
- if(!done)
- {
+ if (!done) {
done = 1;
INIT_VLC_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9,
- ff_h263_intra_MCBPC_bits, 1, 1,
- ff_h263_intra_MCBPC_code, 1, 1, 72);
+ ff_h263_intra_MCBPC_bits, 1, 1,
+ ff_h263_intra_MCBPC_code, 1, 1, 72);
INIT_VLC_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28,
- ff_h263_inter_MCBPC_bits, 1, 1,
- ff_h263_inter_MCBPC_code, 1, 1, 198);
+ ff_h263_inter_MCBPC_bits, 1, 1,
+ ff_h263_inter_MCBPC_code, 1, 1, 198);
INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
- &ff_h263_cbpy_tab[0][1], 2, 1,
- &ff_h263_cbpy_tab[0][0], 2, 1, 64);
+ &ff_h263_cbpy_tab[0][1], 2, 1,
+ &ff_h263_cbpy_tab[0][0], 2, 1, 64);
INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33,
- &mvtab[0][1], 2, 1,
- &mvtab[0][0], 2, 1, 538);
+ &mvtab[0][1], 2, 1,
+ &mvtab[0][0], 2, 1, 538);
init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
init_rl(&rl_intra_aic, ff_h263_static_rl_table_store[1]);
INIT_VLC_RL(ff_h263_rl_inter, 554);
INIT_VLC_RL(rl_intra_aic, 554);
INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
- &h263_mbtype_b_tab[0][1], 2, 1,
- &h263_mbtype_b_tab[0][0], 2, 1, 80);
+ &h263_mbtype_b_tab[0][1], 2, 1,
+ &h263_mbtype_b_tab[0][0], 2, 1, 80);
INIT_VLC_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4,
- &cbpc_b_tab[0][1], 2, 1,
- &cbpc_b_tab[0][0], 2, 1, 8);
+ &cbpc_b_tab[0][1], 2, 1,
+ &cbpc_b_tab[0][0], 2, 1, 8);
}
}
@@ -140,13 +136,12 @@ int ff_h263_decode_mba(MpegEncContext *s)
{
int i, mb_pos;
- for(i = 0; i < 6; i++)
- {
- if(s->mb_num - 1 <= ff_mba_max[i]) break;
+ for(i=0; i<6; i++){
+ if(s->mb_num-1 <= ff_mba_max[i]) break;
}
- mb_pos = get_bits(&s->gb, ff_mba_length[i]);
- s->mb_x = mb_pos % s->mb_width;
- s->mb_y = mb_pos / s->mb_width;
+ mb_pos= get_bits(&s->gb, ff_mba_length[i]);
+ s->mb_x= mb_pos % s->mb_width;
+ s->mb_y= mb_pos / s->mb_width;
return mb_pos;
}
@@ -165,38 +160,34 @@ static int h263_decode_gob_header(MpegEncContext *s)
if(val)
return -1;
- /* We have a GBSC probably with GSTUFF */
+ /* We have a GBSC probably with GSTUFF */
skip_bits(&s->gb, 16); /* Drop the zeros */
- left = get_bits_left(&s->gb);
+ left= get_bits_left(&s->gb);
//MN: we must check the bits left or we might end in a infinite loop (or segfault)
- for(; left > 13; left--)
- {
+ for(;left>13; left--){
if(get_bits1(&s->gb)) break; /* Seek the '1' bit */
}
- if(left <= 13)
+ if(left<=13)
return -1;
- if(s->h263_slice_structured)
- {
- if(get_bits1(&s->gb) == 0)
+ if(s->h263_slice_structured){
+ if(get_bits1(&s->gb)==0)
return -1;
ff_h263_decode_mba(s);
if(s->mb_num > 1583)
- if(get_bits1(&s->gb) == 0)
+ if(get_bits1(&s->gb)==0)
return -1;
s->qscale = get_bits(&s->gb, 5); /* SQUANT */
- if(get_bits1(&s->gb) == 0)
+ if(get_bits1(&s->gb)==0)
return -1;
gfid = get_bits(&s->gb, 2); /* GFID */
- }
- else
- {
+ }else{
gob_number = get_bits(&s->gb, 5); /* GN */
- s->mb_x = 0;
- s->mb_y = s->gob_index * gob_number;
+ s->mb_x= 0;
+ s->mb_y= s->gob_index* gob_number;
gfid = get_bits(&s->gb, 2); /* GFID */
s->qscale = get_bits(&s->gb, 5); /* GQUANT */
}
@@ -204,7 +195,7 @@ static int h263_decode_gob_header(MpegEncContext *s)
if(s->mb_y >= s->mb_height)
return -1;
- if(s->qscale == 0)
+ if(s->qscale==0)
return -1;
return 0;
@@ -220,63 +211,56 @@ const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8
{
assert(p < end);
- end -= 2;
+ end-=2;
p++;
- for(; p < end; p += 2)
- {
- if(!*p)
- {
- if(!p[-1] && p[1]) return p - 1;
+ for(;p<end; p+=2){
+ if(!*p){
+ if (!p[-1] && p[1]) return p - 1;
else if(!p[ 1] && p[2]) return p;
}
}
- return end + 2;
+ return end+2;
}
/**
* decodes the group of blocks / video packet header.
* @return bit position of the resync_marker, or <0 if none was found
*/
-int ff_h263_resync(MpegEncContext *s)
-{
+int ff_h263_resync(MpegEncContext *s){
int left, pos, ret;
- if(s->codec_id == CODEC_ID_MPEG4)
- {
+ if(s->codec_id==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(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);
else
- ret = h263_decode_gob_header(s);
- if(ret >= 0)
+ ret= h263_decode_gob_header(s);
+ if(ret>=0)
return pos;
}
//OK, it's not where it is supposed to be ...
- s->gb = s->last_resync_gb;
+ s->gb= s->last_resync_gb;
align_get_bits(&s->gb);
- left = get_bits_left(&s->gb);
+ left= get_bits_left(&s->gb);
- for(; left > 16 + 1 + 5 + 5; left -= 8)
- {
- if(show_bits(&s->gb, 16) == 0)
- {
- GetBitContext bak = s->gb;
+ for(;left>16+1+5+5; left-=8){
+ if(show_bits(&s->gb, 16)==0){
+ 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);
+ pos= get_bits_count(&s->gb);
+ if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
+ ret= mpeg4_decode_video_packet_header(s);
else
- ret = h263_decode_gob_header(s);
- if(ret >= 0)
+ ret= h263_decode_gob_header(s);
+ if(ret>=0)
return pos;
- s->gb = bak;
+ s->gb= bak;
}
skip_bits(&s->gb, 8);
}
@@ -289,36 +273,32 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
int code, val, sign, shift, l;
code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
- if(code == 0)
+ if (code == 0)
return pred;
- if(code < 0)
+ if (code < 0)
return 0xffff;
sign = get_bits1(&s->gb);
shift = f_code - 1;
val = code;
- if(shift)
- {
+ if (shift) {
val = (val - 1) << shift;
val |= get_bits(&s->gb, shift);
val++;
}
- if(sign)
+ if (sign)
val = -val;
val += pred;
/* modulo decoding */
- if(!s->h263_long_vectors)
- {
+ if (!s->h263_long_vectors) {
l = INT_BIT - 5 - f_code;
- val = (val << l)>>l;
- }
- else
- {
+ val = (val<<l)>>l;
+ } else {
/* horrible h263 long vector mode */
- if(pred < -31 && val < -63)
+ if (pred < -31 && val < -63)
val += 64;
- if(pred > 32 && val > 63)
+ if (pred > 32 && val > 63)
val -= 64;
}
@@ -329,120 +309,106 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
/* Decodes RVLC of H.263+ UMV */
static int h263p_decode_umotion(MpegEncContext * s, int pred)
{
- int code = 0, sign;
+ int code = 0, sign;
- if(get_bits1(&s->gb)) /* Motion difference = 0 */
- return pred;
+ if (get_bits1(&s->gb)) /* Motion difference = 0 */
+ return pred;
- code = 2 + get_bits1(&s->gb);
+ code = 2 + get_bits1(&s->gb);
- while(get_bits1(&s->gb))
- {
- code <<= 1;
- code += get_bits1(&s->gb);
- }
- sign = code & 1;
- code >>= 1;
+ while (get_bits1(&s->gb))
+ {
+ code <<= 1;
+ code += get_bits1(&s->gb);
+ }
+ sign = code & 1;
+ code >>= 1;
- code = (sign) ? (pred - code) : (pred + code);
- dprintf(s->avctx, "H.263+ UMV Motion = %d\n", code);
- return code;
+ code = (sign) ? (pred - code) : (pred + code);
+ dprintf(s->avctx,"H.263+ UMV Motion = %d\n", code);
+ return code;
}
/**
* read the next MVs for OBMC. yes this is a ugly hack, feel free to send a patch :)
*/
-static void preview_obmc(MpegEncContext *s)
-{
- GetBitContext gb = s->gb;
+static void preview_obmc(MpegEncContext *s){
+ GetBitContext gb= s->gb;
int cbpc, i, pred_x, pred_y, mx, my;
int16_t *mot_val;
- const int xy = s->mb_x + 1 + s->mb_y * s->mb_stride;
- const int stride = s->b8_stride * 2;
+ const int xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
+ const int stride= s->b8_stride*2;
- for(i = 0; i < 4; i++)
- s->block_index[i] += 2;
- for(i = 4; i < 6; i++)
- s->block_index[i] += 1;
+ for(i=0; i<4; i++)
+ s->block_index[i]+= 2;
+ for(i=4; i<6; i++)
+ s->block_index[i]+= 1;
s->mb_x++;
assert(s->pict_type == FF_P_TYPE);
- do
- {
- if(get_bits1(&s->gb))
- {
+ do{
+ if (get_bits1(&s->gb)) {
/* skip mb */
mot_val = s->current_picture.motion_val[0][ s->block_index[0] ];
- mot_val[0 ] = mot_val[2 ] =
- mot_val[0+stride] = mot_val[2+stride] = 0;
- mot_val[1 ] = mot_val[3 ] =
- mot_val[1+stride] = mot_val[3+stride] = 0;
+ mot_val[0 ]= mot_val[2 ]=
+ mot_val[0+stride]= mot_val[2+stride]= 0;
+ mot_val[1 ]= mot_val[3 ]=
+ mot_val[1+stride]= mot_val[3+stride]= 0;
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
goto end;
}
cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
- }
- while(cbpc == 20);
+ }while(cbpc == 20);
- if(cbpc & 4)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
- }
- else
- {
+ if(cbpc & 4){
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
+ }else{
get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpc & 8)
- {
- if(s->modified_quant)
- {
+ if (cbpc & 8) {
+ if(s->modified_quant){
if(get_bits1(&s->gb)) skip_bits(&s->gb, 1);
else skip_bits(&s->gb, 5);
- }
- else
+ }else
skip_bits(&s->gb, 2);
}
- if((cbpc & 16) == 0)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
- /* 16x16 motion prediction */
- mot_val = h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
- if(s->umvplus)
- mx = h263p_decode_umotion(s, pred_x);
- else
- mx = h263_decode_motion(s, pred_x, 1);
-
- if(s->umvplus)
- my = h263p_decode_umotion(s, pred_y);
- else
- my = h263_decode_motion(s, pred_y, 1);
+ if ((cbpc & 16) == 0) {
+ s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
+ /* 16x16 motion prediction */
+ mot_val= h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
+ if (s->umvplus)
+ mx = h263p_decode_umotion(s, pred_x);
+ else
+ mx = h263_decode_motion(s, pred_x, 1);
- mot_val[0 ] = mot_val[2 ] =
- mot_val[0+stride] = mot_val[2+stride] = mx;
- mot_val[1 ] = mot_val[3 ] =
- mot_val[1+stride] = mot_val[3+stride] = my;
- }
- else
- {
- s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0;
- for(i = 0; i < 4; i++)
- {
+ if (s->umvplus)
+ my = h263p_decode_umotion(s, pred_y);
+ else
+ my = h263_decode_motion(s, pred_y, 1);
+
+ mot_val[0 ]= mot_val[2 ]=
+ mot_val[0+stride]= mot_val[2+stride]= mx;
+ mot_val[1 ]= mot_val[3 ]=
+ mot_val[1+stride]= mot_val[3+stride]= my;
+ } else {
+ s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
+ for(i=0;i<4;i++) {
mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
- if(s->umvplus)
- mx = h263p_decode_umotion(s, pred_x);
+ if (s->umvplus)
+ mx = h263p_decode_umotion(s, pred_x);
else
- mx = h263_decode_motion(s, pred_x, 1);
+ mx = h263_decode_motion(s, pred_x, 1);
- if(s->umvplus)
- my = h263p_decode_umotion(s, pred_y);
+ if (s->umvplus)
+ my = h263p_decode_umotion(s, pred_y);
else
- my = h263_decode_motion(s, pred_y, 1);
- if(s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
- skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
+ my = h263_decode_motion(s, pred_y, 1);
+ if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
+ skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
mot_val[0] = mx;
mot_val[1] = my;
}
@@ -450,27 +416,24 @@ static void preview_obmc(MpegEncContext *s)
}
end:
- for(i = 0; i < 4; i++)
- s->block_index[i] -= 2;
- for(i = 4; i < 6; i++)
- s->block_index[i] -= 1;
+ for(i=0; i<4; i++)
+ s->block_index[i]-= 2;
+ for(i=4; i<6; i++)
+ s->block_index[i]-= 1;
s->mb_x--;
- s->gb = gb;
+ s->gb= gb;
}
-static void h263_decode_dquant(MpegEncContext *s)
-{
+static void h263_decode_dquant(MpegEncContext *s){
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
- if(s->modified_quant)
- {
+ if(s->modified_quant){
if(get_bits1(&s->gb))
- s->qscale = modified_quant_tab[get_bits1(&s->gb)][ s->qscale ];
+ s->qscale= modified_quant_tab[get_bits1(&s->gb)][ s->qscale ];
else
- s->qscale = get_bits(&s->gb, 5);
- }
- else
+ s->qscale= get_bits(&s->gb, 5);
+ }else
s->qscale += quant_tab[get_bits(&s->gb, 2)];
ff_set_qscale(s, s->qscale);
}
@@ -481,133 +444,102 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
int code, level, i, j, last, run;
RLTable *rl = &ff_h263_rl_inter;
const uint8_t *scan_table;
- GetBitContext gb = s->gb;
+ GetBitContext gb= s->gb;
scan_table = s->intra_scantable.permutated;
- if(s->h263_aic && s->mb_intra)
- {
+ if (s->h263_aic && s->mb_intra) {
rl = &rl_intra_aic;
i = 0;
- if(s->ac_pred)
- {
- if(s->h263_aic_dir)
+ if (s->ac_pred) {
+ if (s->h263_aic_dir)
scan_table = s->intra_v_scantable.permutated; /* left */
else
scan_table = s->intra_h_scantable.permutated; /* top */
}
- }
- else if(s->mb_intra)
- {
+ } else if (s->mb_intra) {
/* DC coef */
- if(s->codec_id == CODEC_ID_RV10)
- {
+ if(s->codec_id == CODEC_ID_RV10){
#if CONFIG_RV10_DECODER
- if(s->rv10_version == 3 && s->pict_type == FF_I_TYPE)
- {
- 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);
- if(diff == 0xffff)
- return -1;
- level += diff;
- level = level & 0xff; /* handle wrap round */
- s->last_dc[component] = level;
- }
- else
- {
- s->rv10_first_dc_coded[component] = 1;
- }
+ if (s->rv10_version == 3 && s->pict_type == FF_I_TYPE) {
+ 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);
+ if (diff == 0xffff)
+ return -1;
+ level += diff;
+ level = level & 0xff; /* handle wrap round */
+ s->last_dc[component] = level;
+ } else {
+ s->rv10_first_dc_coded[component] = 1;
}
- else
- {
+ } else {
level = get_bits(&s->gb, 8);
- if(level == 255)
+ if (level == 255)
level = 128;
- }
+ }
#endif
- }
- else
- {
+ }else{
level = get_bits(&s->gb, 8);
- if((level & 0x7F) == 0)
- {
+ if((level&0x7F) == 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
if(s->error_recognition >= FF_ER_COMPLIANT)
return -1;
}
- if(level == 255)
+ if (level == 255)
level = 128;
}
block[0] = level;
i = 1;
- }
- else
- {
+ } else {
i = 0;
}
- if(!coded)
- {
- if(s->mb_intra && s->h263_aic)
+ if (!coded) {
+ if (s->mb_intra && s->h263_aic)
goto not_coded;
s->block_last_index[n] = i - 1;
return 0;
}
retry:
- for(;;)
- {
+ for(;;) {
code = get_vlc2(&s->gb, rl->vlc.table, TEX_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
- if(code == rl->n)
- {
+ if (code == rl->n) {
/* escape */
- if(CONFIG_FLV_DECODER && s->h263_flv > 1)
- {
+ if (CONFIG_FLV_DECODER && s->h263_flv > 1) {
ff_flv2_decode_ac_esc(&s->gb, &level, &run, &last);
- }
- else
- {
+ } else {
last = get_bits1(&s->gb);
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(level == -128){
+ if (s->codec_id == CODEC_ID_RV10) {
/* XXX: should patch encoder too */
level = get_sbits(&s->gb, 12);
- }
- else
- {
+ }else{
level = get_bits(&s->gb, 5);
- level |= get_sbits(&s->gb, 6) << 5;
+ level |= get_sbits(&s->gb, 6)<<5;
}
}
}
- }
- else
- {
+ } else {
run = rl->table_run[code];
level = rl->table_level[code];
last = code >= rl->last;
- if(get_bits1(&s->gb))
+ if (get_bits1(&s->gb))
level = -level;
}
i += run;
- if(i >= 64)
- {
- if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra)
- {
+ if (i >= 64){
+ if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){
//Looks like a hack but no, it's the way it is supposed to work ...
rl = &rl_intra_aic;
i = 0;
- s->gb = gb;
+ s->gb= gb;
s->dsp.clear_block(block);
goto retry;
}
@@ -616,13 +548,12 @@ retry:
}
j = scan_table[i];
block[j] = level;
- if(last)
+ if (last)
break;
i++;
}
not_coded:
- if(s->mb_intra && s->h263_aic)
- {
+ if (s->mb_intra && s->h263_aic) {
h263_pred_acdc(s, block, n);
i = 63;
}
@@ -640,11 +571,10 @@ static int h263_skip_b_part(MpegEncContext *s, int cbp)
*/
mbi = s->mb_intra;
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
- {
- if(h263_decode_block(s, dblock, i, cbp & 32) < 0)
+ for (i = 0; i < 6; i++) {
+ if (h263_decode_block(s, dblock, i, cbp&32) < 0)
return -1;
- cbp += cbp;
+ cbp+=cbp;
}
s->mb_intra = mbi;
return 0;
@@ -654,14 +584,11 @@ static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
{
int c, mv = 1;
- if(pb_frame < 3) // h.263 Annex G and i263 PB-frame
- {
+ if (pb_frame < 3) { // h.263 Annex G and i263 PB-frame
c = get_bits1(gb);
- if(pb_frame == 2 && c)
+ if (pb_frame == 2 && c)
mv = !get_bits1(gb);
- }
- else // h.263 Annex M improved PB-frame
- {
+ } else { // h.263 Annex M improved PB-frame
mv = get_unary(gb, 0, 4) + 1;
c = mv & 1;
mv = !!(mv & 2);
@@ -676,189 +603,165 @@ int ff_h263_decode_mb(MpegEncContext *s,
{
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
int16_t *mot_val;
- const int xy = s->mb_x + s->mb_y * s->mb_stride;
+ const int xy= s->mb_x + s->mb_y * s->mb_stride;
int cbpb = 0, pb_mv_count = 0;
assert(!s->h263_pred);
- if(s->pict_type == FF_P_TYPE)
- {
- do
- {
- if(get_bits1(&s->gb))
- {
+ if (s->pict_type == FF_P_TYPE) {
+ do{
+ if (get_bits1(&s->gb)) {
/* skip mb */
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
s->mb_skipped = !(s->obmc | s->loop_filter);
goto end;
}
cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
- if(cbpc < 0)
- {
+ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- }
- while(cbpc == 20);
+ }while(cbpc == 20);
s->dsp.clear_blocks(s->block[0]);
dquant = cbpc & 8;
s->mb_intra = ((cbpc & 4) != 0);
- if(s->mb_intra) goto intra;
+ if (s->mb_intra) goto intra;
if(s->pb_frame && get_bits1(&s->gb))
pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(s->alt_inter_vlc == 0 || (cbpc & 3) != 3)
+ if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
cbpy ^= 0xF;
cbp = (cbpc & 3) | (cbpy << 2);
- if(dquant)
- {
+ if (dquant) {
h263_decode_dquant(s);
}
s->mv_dir = MV_DIR_FORWARD;
- if((cbpc & 16) == 0)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
+ if ((cbpc & 16) == 0) {
+ s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
/* 16x16 motion prediction */
s->mv_type = MV_TYPE_16X16;
h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
- if(s->umvplus)
- mx = h263p_decode_umotion(s, pred_x);
+ if (s->umvplus)
+ mx = h263p_decode_umotion(s, pred_x);
else
- mx = h263_decode_motion(s, pred_x, 1);
+ mx = h263_decode_motion(s, pred_x, 1);
- if(mx >= 0xffff)
+ if (mx >= 0xffff)
return -1;
- if(s->umvplus)
- my = h263p_decode_umotion(s, pred_y);
+ if (s->umvplus)
+ my = h263p_decode_umotion(s, pred_y);
else
- my = h263_decode_motion(s, pred_y, 1);
+ my = h263_decode_motion(s, pred_y, 1);
- if(my >= 0xffff)
+ if (my >= 0xffff)
return -1;
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
- if(s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
- skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
- }
- else
- {
- s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0;
+ if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
+ skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
+ } else {
+ s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
s->mv_type = MV_TYPE_8X8;
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
- if(s->umvplus)
- mx = h263p_decode_umotion(s, pred_x);
+ if (s->umvplus)
+ mx = h263p_decode_umotion(s, pred_x);
else
- mx = h263_decode_motion(s, pred_x, 1);
- if(mx >= 0xffff)
+ mx = h263_decode_motion(s, pred_x, 1);
+ if (mx >= 0xffff)
return -1;
- if(s->umvplus)
- my = h263p_decode_umotion(s, pred_y);
+ if (s->umvplus)
+ my = h263p_decode_umotion(s, pred_y);
else
- my = h263_decode_motion(s, pred_y, 1);
- if(my >= 0xffff)
+ my = h263_decode_motion(s, pred_y, 1);
+ if (my >= 0xffff)
return -1;
s->mv[0][i][0] = mx;
s->mv[0][i][1] = my;
- if(s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
- skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
+ if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
+ skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
mot_val[0] = mx;
mot_val[1] = my;
}
}
- }
- else if(s->pict_type == FF_B_TYPE)
- {
+ } else if(s->pict_type==FF_B_TYPE) {
int mb_type;
- const int stride = s->b8_stride;
- int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride)];
- int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride)];
+ const int stride= s->b8_stride;
+ int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride) ];
+ int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride) ];
// const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
//FIXME ugly
- mot_val0[0 ] = mot_val0[2 ] = mot_val0[0+2*stride] = mot_val0[2+2*stride] =
- mot_val0[1 ] = mot_val0[3 ] = mot_val0[1+2*stride] = mot_val0[3+2*stride] =
- mot_val1[0 ] = mot_val1[2 ] = mot_val1[0+2*stride] = mot_val1[2+2*stride] =
- mot_val1[1 ] = mot_val1[3 ] = mot_val1[1+2*stride] = mot_val1[3+2*stride] = 0;
-
- do
- {
- mb_type = get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2);
- if(mb_type < 0)
- {
+ mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]=
+ mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]=
+ mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]=
+ mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0;
+
+ do{
+ mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2);
+ if (mb_type < 0){
av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- mb_type = h263_mb_type_b_map[ mb_type ];
- }
- while(!mb_type);
+ mb_type= h263_mb_type_b_map[ mb_type ];
+ }while(!mb_type);
s->mb_intra = IS_INTRA(mb_type);
- if(HAS_CBP(mb_type))
- {
+ if(HAS_CBP(mb_type)){
s->dsp.clear_blocks(s->block[0]);
cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1);
- if(s->mb_intra)
- {
+ if(s->mb_intra){
dquant = IS_QUANT(mb_type);
goto intra;
}
cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ if (cbpy < 0){
av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- if(s->alt_inter_vlc == 0 || (cbpc & 3) != 3)
+ if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
cbpy ^= 0xF;
cbp = (cbpc & 3) | (cbpy << 2);
- }
- else
- cbp = 0;
+ }else
+ cbp=0;
assert(!s->mb_intra);
- if(IS_QUANT(mb_type))
- {
+ if(IS_QUANT(mb_type)){
h263_decode_dquant(s);
}
- if(IS_DIRECT(mb_type))
- {
+ if(IS_DIRECT(mb_type)){
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
mb_type |= ff_mpeg4_set_direct_mv(s, 0, 0);
- }
- else
- {
+ }else{
s->mv_dir = 0;
- s->mv_type = MV_TYPE_16X16;
+ s->mv_type= MV_TYPE_16X16;
//FIXME UMV
- if(USES_LIST(mb_type, 0))
- {
- int16_t *mot_val = h263_pred_motion(s, 0, 0, &mx, &my);
+ if(USES_LIST(mb_type, 0)){
+ int16_t *mot_val= h263_pred_motion(s, 0, 0, &mx, &my);
s->mv_dir = MV_DIR_FORWARD;
mx = h263_decode_motion(s, mx, 1);
@@ -866,13 +769,12 @@ int ff_h263_decode_mb(MpegEncContext *s,
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
- mot_val[0 ] = mot_val[2 ] = mot_val[0+2*stride] = mot_val[2+2*stride] = mx;
- mot_val[1 ] = mot_val[3 ] = mot_val[1+2*stride] = mot_val[3+2*stride] = my;
+ mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
+ mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
}
- if(USES_LIST(mb_type, 1))
- {
- int16_t *mot_val = h263_pred_motion(s, 0, 1, &mx, &my);
+ if(USES_LIST(mb_type, 1)){
+ int16_t *mot_val= h263_pred_motion(s, 0, 1, &mx, &my);
s->mv_dir |= MV_DIR_BACKWARD;
mx = h263_decode_motion(s, mx, 1);
@@ -880,95 +782,81 @@ int ff_h263_decode_mb(MpegEncContext *s,
s->mv[1][0][0] = mx;
s->mv[1][0][1] = my;
- mot_val[0 ] = mot_val[2 ] = mot_val[0+2*stride] = mot_val[2+2*stride] = mx;
- mot_val[1 ] = mot_val[3 ] = mot_val[1+2*stride] = mot_val[3+2*stride] = my;
+ mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
+ mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
}
}
- s->current_picture.mb_type[xy] = mb_type;
- }
- else /* I-Frame */
- {
- do
- {
+ s->current_picture.mb_type[xy]= mb_type;
+ } else { /* I-Frame */
+ do{
cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
- if(cbpc < 0)
- {
+ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- }
- while(cbpc == 8);
+ }while(cbpc == 8);
s->dsp.clear_blocks(s->block[0]);
dquant = cbpc & 4;
s->mb_intra = 1;
intra:
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
- if(s->h263_aic)
- {
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
+ if (s->h263_aic) {
s->ac_pred = get_bits1(&s->gb);
- if(s->ac_pred)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED;
+ if(s->ac_pred){
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA | MB_TYPE_ACPRED;
s->h263_aic_dir = get_bits1(&s->gb);
}
- }
- else
+ }else
s->ac_pred = 0;
if(s->pb_frame && get_bits1(&s->gb))
pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
cbp = (cbpc & 3) | (cbpy << 2);
- if(dquant)
- {
+ if (dquant) {
h263_decode_dquant(s);
}
pb_mv_count += !!s->pb_frame;
}
- while(pb_mv_count--)
- {
+ while(pb_mv_count--){
h263_decode_motion(s, 0, 1);
h263_decode_motion(s, 0, 1);
}
/* decode each block */
- for(i = 0; i < 6; i++)
- {
- if(h263_decode_block(s, block[i], i, cbp & 32) < 0)
+ for (i = 0; i < 6; i++) {
+ if (h263_decode_block(s, block[i], i, cbp&32) < 0)
return -1;
- cbp += cbp;
+ cbp+=cbp;
}
if(s->pb_frame && h263_skip_b_part(s, cbpb) < 0)
return -1;
- if(s->obmc && !s->mb_intra)
- {
- if(s->pict_type == FF_P_TYPE && s->mb_x + 1 < s->mb_width && s->mb_num_left != 1)
+ if(s->obmc && !s->mb_intra){
+ if(s->pict_type == FF_P_TYPE && s->mb_x+1<s->mb_width && s->mb_num_left != 1)
preview_obmc(s);
}
end:
- /* per-MB end of slice check */
+ /* per-MB end of slice check */
{
- int v = show_bits(&s->gb, 16);
+ int v= show_bits(&s->gb, 16);
- if(get_bits_count(&s->gb) + 16 > s->gb.size_in_bits)
- {
- v >>= get_bits_count(&s->gb) + 16 - s->gb.size_in_bits;
+ if(get_bits_count(&s->gb) + 16 > s->gb.size_in_bits){
+ v>>= get_bits_count(&s->gb) + 16 - s->gb.size_in_bits;
}
- if(v == 0)
+ if(v==0)
return SLICE_END;
}
@@ -983,37 +871,33 @@ int h263_decode_picture_header(MpegEncContext *s)
align_get_bits(&s->gb);
- startcode = get_bits(&s->gb, 22 - 8);
+ startcode= get_bits(&s->gb, 22-8);
- for(i = get_bits_left(&s->gb); i > 24; i -= 8)
- {
+ for(i= get_bits_left(&s->gb); i>24; i-=8) {
startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;
if(startcode == 0x20)
break;
}
- if(startcode != 0x20)
- {
+ if (startcode != 0x20) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
/* temporal reference */
i = get_bits(&s->gb, 8); /* picture timestamp */
- if((s->picture_number&~0xFF) + i < s->picture_number)
- i += 256;
- s->current_picture_ptr->pts =
- s->picture_number = (s->picture_number&~0xFF) + i;
+ if( (s->picture_number&~0xFF)+i < s->picture_number)
+ i+= 256;
+ s->current_picture_ptr->pts=
+ s->picture_number= (s->picture_number&~0xFF) + i;
/* PTYPE starts here */
- if(get_bits1(&s->gb) != 1)
- {
+ if (get_bits1(&s->gb) != 1) {
/* marker */
av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
return -1;
}
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
return -1; /* h263 id */
}
@@ -1029,40 +913,34 @@ int h263_decode_picture_header(MpegEncContext *s)
7 extended PTYPE (PLUSPTYPE)
*/
- if(format != 7 && format != 6)
- {
+ if (format != 7 && format != 6) {
s->h263_plus = 0;
/* H.263v1 */
width = h263_format[format][0];
height = h263_format[format][1];
- if(!width)
+ if (!width)
return -1;
s->pict_type = FF_I_TYPE + get_bits1(&s->gb);
s->h263_long_vectors = get_bits1(&s->gb);
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n");
return -1; /* SAC: off */
}
- s->obmc = get_bits1(&s->gb); /* Advanced prediction mode */
+ s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
s->unrestricted_mv = s->h263_long_vectors || s->obmc;
s->pb_frame = get_bits1(&s->gb);
- s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
+ s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
s->width = width;
s->height = height;
- s->avctx->sample_aspect_ratio.num = 12;
- s->avctx->sample_aspect_ratio.den = 11; // = (AVRational){12,11};
- s->avctx->time_base.num = 1001;
- s->avctx->time_base.den = 30000; // (AVRational){1001, 30000};
- }
- else
- {
+ s->avctx->sample_aspect_ratio.num=12;s->avctx->sample_aspect_ratio.den=11;// = (AVRational){12,11};
+ s->avctx->time_base.num=1001;s->avctx->time_base.den=30000;// (AVRational){1001, 30000};
+ } else {
int ufep;
/* H.263v2 */
@@ -1070,66 +948,48 @@ int h263_decode_picture_header(MpegEncContext *s)
ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */
/* ufep other than 0 and 1 are reserved */
- if(ufep == 1)
- {
+ if (ufep == 1) {
/* OPPTYPE */
format = get_bits(&s->gb, 3);
dprintf(s->avctx, "ufep=1, format: %d\n", format);
- s->custom_pcf = get_bits1(&s->gb);
+ s->custom_pcf= get_bits1(&s->gb);
s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
}
- s->obmc = get_bits1(&s->gb); /* Advanced prediction mode */
+ s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */
- s->loop_filter = get_bits1(&s->gb);
+ s->loop_filter= get_bits1(&s->gb);
s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter;
- s->h263_slice_structured = get_bits1(&s->gb);
- if(get_bits1(&s->gb) != 0)
- {
+ s->h263_slice_structured= get_bits1(&s->gb);
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");
}
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");
}
- s->alt_inter_vlc = get_bits1(&s->gb);
- s->modified_quant = get_bits1(&s->gb);
+ s->alt_inter_vlc= get_bits1(&s->gb);
+ s->modified_quant= get_bits1(&s->gb);
if(s->modified_quant)
- s->chroma_qscale_table = ff_h263_chroma_qscale_table;
+ s->chroma_qscale_table= ff_h263_chroma_qscale_table;
skip_bits(&s->gb, 1); /* Prevent start code emulation */
skip_bits(&s->gb, 3); /* Reserved */
- }
- else if(ufep != 0)
- {
+ } else if (ufep != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);
return -1;
}
/* MPPTYPE */
s->pict_type = get_bits(&s->gb, 3);
- switch(s->pict_type)
- {
- case 0:
- s->pict_type = FF_I_TYPE;
- break;
- case 1:
- s->pict_type = FF_P_TYPE;
- break;
- case 2:
- s->pict_type = FF_P_TYPE;
- s->pb_frame = 3;
- break;
- case 3:
- s->pict_type = FF_B_TYPE;
- break;
- case 7:
- s->pict_type = FF_I_TYPE;
- break; //ZYGO
+ switch(s->pict_type){
+ case 0: s->pict_type= FF_I_TYPE;break;
+ case 1: s->pict_type= FF_P_TYPE;break;
+ case 2: s->pict_type= FF_P_TYPE;s->pb_frame = 3;break;
+ case 3: s->pict_type= FF_B_TYPE;break;
+ case 7: s->pict_type= FF_I_TYPE;break; //ZYGO
default:
return -1;
}
@@ -1138,10 +998,8 @@ int h263_decode_picture_header(MpegEncContext *s)
skip_bits(&s->gb, 4);
/* Get the picture dimensions */
- if(ufep)
- {
- if(format == 6)
- {
+ if (ufep) {
+ if (format == 6) {
/* Custom Picture Format (CPFMT) */
s->aspect_ratio_info = get_bits(&s->gb, 4);
dprintf(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
@@ -1157,72 +1015,55 @@ int h263_decode_picture_header(MpegEncContext *s)
width = (get_bits(&s->gb, 9) + 1) * 4;
skip_bits1(&s->gb);
height = get_bits(&s->gb, 9) * 4;
- dprintf(s->avctx, "\nH.263+ Custom picture: %dx%d\n", width, height);
- if(s->aspect_ratio_info == FF_ASPECT_EXTENDED)
- {
+ dprintf(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height);
+ if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
/* aspected dimensions */
- s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 8);
- s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 8);
- }
- else
- {
- s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[s->aspect_ratio_info];
+ s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);
+ s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8);
+ }else{
+ s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info];
}
- }
- else
- {
+ } else {
width = h263_format[format][0];
height = h263_format[format][1];
- s->avctx->sample_aspect_ratio.num = 12;
- s->avctx->sample_aspect_ratio.den = 11; //(AVRational){12,11};
+ s->avctx->sample_aspect_ratio.num=12;s->avctx->sample_aspect_ratio.den=11; //(AVRational){12,11};
}
- if((width == 0) || (height == 0))
+ if ((width == 0) || (height == 0))
return -1;
s->width = width;
s->height = height;
- if(s->custom_pcf)
- {
+ if(s->custom_pcf){
int gcd;
- s->avctx->time_base.den = 1800000;
- s->avctx->time_base.num = 1000 + get_bits1(&s->gb);
- s->avctx->time_base.num *= get_bits(&s->gb, 7);
- if(s->avctx->time_base.num == 0)
- {
+ s->avctx->time_base.den= 1800000;
+ s->avctx->time_base.num= 1000 + get_bits1(&s->gb);
+ s->avctx->time_base.num*= get_bits(&s->gb, 7);
+ if(s->avctx->time_base.num == 0){
av_log(s, AV_LOG_ERROR, "zero framerate\n");
return -1;
}
- gcd = av_gcd(s->avctx->time_base.den, s->avctx->time_base.num);
+ gcd= av_gcd(s->avctx->time_base.den, s->avctx->time_base.num);
s->avctx->time_base.den /= gcd;
s->avctx->time_base.num /= gcd;
- }
- else
- {
- s->avctx->time_base.num = 1001;
- s->avctx->time_base.den = 30000; // (AVRational){1001, 30000};
+ }else{
+ s->avctx->time_base.num=1001;s->avctx->time_base.den=30000;// (AVRational){1001, 30000};
}
}
- if(s->custom_pcf)
- {
+ if(s->custom_pcf){
skip_bits(&s->gb, 2); //extended Temporal reference
}
- if(ufep)
- {
- if(s->umvplus)
- {
- if(get_bits1(&s->gb) == 0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
+ if (ufep) {
+ if (s->umvplus) {
+ if(get_bits1(&s->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
skip_bits1(&s->gb);
}
- if(s->h263_slice_structured)
- {
- if(get_bits1(&s->gb) != 0)
- {
+ if(s->h263_slice_structured){
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n");
}
- if(get_bits1(&s->gb) != 0)
- {
+ if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n");
}
}
@@ -1235,66 +1076,55 @@ int h263_decode_picture_header(MpegEncContext *s)
s->mb_height = (s->height + 15) / 16;
s->mb_num = s->mb_width * s->mb_height;
- if(s->pb_frame)
- {
+ if (s->pb_frame) {
skip_bits(&s->gb, 3); /* Temporal reference for B-pictures */
- if(s->custom_pcf)
+ if (s->custom_pcf)
skip_bits(&s->gb, 2); //extended Temporal reference
skip_bits(&s->gb, 2); /* Quantization information for B-pictures */
}
/* PEI */
- while(get_bits1(&s->gb) != 0)
- {
+ while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
}
- if(s->h263_slice_structured)
- {
- if(get_bits1(&s->gb) != 1)
- {
+ if(s->h263_slice_structured){
+ if (get_bits1(&s->gb) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n");
return -1;
}
ff_h263_decode_mba(s);
- if(get_bits1(&s->gb) != 1)
- {
+ if (get_bits1(&s->gb) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n");
return -1;
}
}
s->f_code = 1;
- if(s->h263_aic)
- {
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_aic_dc_scale_table;
- }
- else
- {
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+ if(s->h263_aic){
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_aic_dc_scale_table;
+ }else{
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
}
- ff_h263_show_pict_info(s);
- if(s->pict_type == FF_I_TYPE && s->codec_tag == AV_RL32("ZYGO"))
- {
- int i, j;
- for(i = 0; i < 85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
+ ff_h263_show_pict_info(s);
+ if (s->pict_type == FF_I_TYPE && s->codec_tag == AV_RL32("ZYGO")){
+ int i,j;
+ for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
av_log(s->avctx, AV_LOG_DEBUG, "\n");
- for(i = 0; i < 13; i++)
- {
- for(j = 0; j < 3; j++)
- {
- int v = get_bits(&s->gb, 8);
- v |= get_sbits(&s->gb, 8) << 8;
+ for(i=0; i<13; i++){
+ for(j=0; j<3; j++){
+ int v= get_bits(&s->gb, 8);
+ v |= get_sbits(&s->gb, 8)<<8;
av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);
}
av_log(s->avctx, AV_LOG_DEBUG, "\n");
}
- for(i = 0; i < 50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
+ for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
}
return 0;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.c
index 34f228a3e..732f45d80 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.c
@@ -27,8 +27,7 @@
#include "jpegls.h"
-void ff_jpegls_init_state(JLSState *state)
-{
+void ff_jpegls_init_state(JLSState *state){
int i;
state->twonear = state->near * 2 + 1;
@@ -42,8 +41,7 @@ void ff_jpegls_init_state(JLSState *state)
else
state->limit = (4 * state->bpp) - state->qbpp;
- for(i = 0; i < 367; i++)
- {
+ for(i = 0; i < 367; i++) {
state->A[i] = FFMAX((state->range + 32) >> 6, 2);
state->N[i] = 1;
}
@@ -53,44 +51,39 @@ void ff_jpegls_init_state(JLSState *state)
/**
* Custom value clipping function used in T1, T2, T3 calculation
*/
-static inline int iso_clip(int v, int vmin, int vmax)
-{
+static inline int iso_clip(int v, int vmin, int vmax){
if(v > vmax || v < vmin) return vmin;
else return v;
}
-void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all)
-{
- const int basic_t1 = 3;
- const int basic_t2 = 7;
- const int basic_t3 = 21;
+void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){
+ const int basic_t1= 3;
+ const int basic_t2= 7;
+ const int basic_t3= 21;
int factor;
- if(s->maxval == 0 || reset_all) s->maxval = (1 << s->bpp) - 1;
+ if(s->maxval==0 || reset_all) s->maxval= (1 << s->bpp) - 1;
- if(s->maxval >= 128)
- {
- factor = (FFMIN(s->maxval, 4095) + 128) >> 8;
+ if(s->maxval >=128){
+ factor= (FFMIN(s->maxval, 4095) + 128)>>8;
- if(s->T1 == 0 || reset_all)
- s->T1 = iso_clip(factor * (basic_t1 - 2) + 2 + 3 * s->near, s->near + 1, s->maxval);
- if(s->T2 == 0 || reset_all)
- s->T2 = iso_clip(factor * (basic_t2 - 3) + 3 + 5 * s->near, s->T1, s->maxval);
- if(s->T3 == 0 || reset_all)
- s->T3 = iso_clip(factor * (basic_t3 - 4) + 4 + 7 * s->near, s->T2, s->maxval);
- }
- else
- {
- factor = 256 / (s->maxval + 1);
+ if(s->T1==0 || reset_all)
+ s->T1= iso_clip(factor*(basic_t1-2) + 2 + 3*s->near, s->near+1, s->maxval);
+ if(s->T2==0 || reset_all)
+ s->T2= iso_clip(factor*(basic_t2-3) + 3 + 5*s->near, s->T1, s->maxval);
+ if(s->T3==0 || reset_all)
+ s->T3= iso_clip(factor*(basic_t3-4) + 4 + 7*s->near, s->T2, s->maxval);
+ }else{
+ factor= 256 / (s->maxval + 1);
- if(s->T1 == 0 || reset_all)
- s->T1 = iso_clip(FFMAX(2, basic_t1 / factor + 3 * s->near), s->near + 1, s->maxval);
- if(s->T2 == 0 || reset_all)
- s->T2 = iso_clip(FFMAX(3, basic_t2 / factor + 5 * s->near), s->T1, s->maxval);
- if(s->T3 == 0 || reset_all)
- s->T3 = iso_clip(FFMAX(4, basic_t3 / factor + 7 * s->near), s->T2, s->maxval);
+ if(s->T1==0 || reset_all)
+ s->T1= iso_clip(FFMAX(2, basic_t1/factor + 3*s->near), s->near+1, s->maxval);
+ if(s->T2==0 || reset_all)
+ s->T2= iso_clip(FFMAX(3, basic_t2/factor + 5*s->near), s->T1, s->maxval);
+ if(s->T3==0 || reset_all)
+ s->T3= iso_clip(FFMAX(4, basic_t3/factor + 7*s->near), s->T2, s->maxval);
}
- if(s->reset == 0 || reset_all) s->reset = 64;
+ 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);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.h
index 2efd2ab40..61d64cd1c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpegls.h
@@ -30,20 +30,18 @@
#include "avcodec.h"
-typedef struct JpeglsContext
-{
+typedef struct JpeglsContext{
AVCodecContext *avctx;
AVFrame picture;
-} JpeglsContext;
+}JpeglsContext;
-typedef struct JLSState
-{
+typedef struct JLSState{
int T1, T2, T3;
int A[367], B[367], C[365], N[367];
int limit, reset, bpp, qbpp, maxval, range;
int near, twonear;
int run_index[3];
-} JLSState;
+}JLSState;
extern const uint8_t ff_log2_run[32];
@@ -55,19 +53,15 @@ void ff_jpegls_init_state(JLSState *state);
/**
* Calculate quantized gradient value, used for context determination
*/
-static inline int ff_jpegls_quantize(JLSState *s, int v) //FIXME optimize
-{
- if(v == 0) return 0;
- if(v < 0)
- {
+static inline int ff_jpegls_quantize(JLSState *s, int v){ //FIXME optimize
+ if(v==0) return 0;
+ if(v < 0){
if(v <= -s->T3) return -4;
if(v <= -s->T2) return -3;
if(v <= -s->T1) return -2;
if(v < -s->near) return -1;
return 0;
- }
- else
- {
+ }else{
if(v <= s->near) return 0;
if(v < s->T1) return 1;
if(v < s->T2) return 2;
@@ -82,34 +76,28 @@ static inline int ff_jpegls_quantize(JLSState *s, int v) //FIXME optimize
void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all);
-static inline void ff_jpegls_downscale_state(JLSState *state, int Q)
-{
- if(state->N[Q] == state->reset)
- {
- state->A[Q] >>= 1;
- state->B[Q] >>= 1;
- state->N[Q] >>= 1;
+static inline void ff_jpegls_downscale_state(JLSState *state, int Q){
+ if(state->N[Q] == state->reset){
+ state->A[Q] >>=1;
+ state->B[Q] >>=1;
+ state->N[Q] >>=1;
}
state->N[Q]++;
}
-static inline int ff_jpegls_update_state_regular(JLSState *state, int Q, int err)
-{
+static inline int ff_jpegls_update_state_regular(JLSState *state, int Q, int err){
state->A[Q] += FFABS(err);
err *= state->twonear;
state->B[Q] += err;
ff_jpegls_downscale_state(state, Q);
- if(state->B[Q] <= -state->N[Q])
- {
- state->B[Q] = FFMAX(state->B[Q] + state->N[Q], 1 - state->N[Q]);
+ if(state->B[Q] <= -state->N[Q]) {
+ state->B[Q]= FFMAX(state->B[Q] + state->N[Q], 1-state->N[Q]);
if(state->C[Q] > -128)
state->C[Q]--;
- }
- else if(state->B[Q] > 0)
- {
- state->B[Q] = FFMIN(state->B[Q] - state->N[Q], 0);
+ }else if(state->B[Q] > 0){
+ state->B[Q]= FFMIN(state->B[Q] - state->N[Q], 0);
if(state->C[Q] < 127)
state->C[Q]++;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpeglsdec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpeglsdec.c
index ec89d9798..d363f3702 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpeglsdec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jpeglsdec.c
@@ -57,14 +57,13 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
len = get_bits(&s->gb, 16);
id = get_bits(&s->gb, 8);
- switch(id)
- {
+ switch(id){
case 1:
- s->maxval = get_bits(&s->gb, 16);
- s->t1 = get_bits(&s->gb, 16);
- s->t2 = get_bits(&s->gb, 16);
- s->t3 = get_bits(&s->gb, 16);
- s->reset = get_bits(&s->gb, 16);
+ s->maxval= get_bits(&s->gb, 16);
+ s->t1= get_bits(&s->gb, 16);
+ s->t2= get_bits(&s->gb, 16);
+ s->t3= get_bits(&s->gb, 16);
+ s->reset= get_bits(&s->gb, 16);
// ff_jpegls_reset_coding_parameters(s, 0);
//FIXME quant table?
@@ -88,8 +87,7 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
/**
* Get context-dependent Golomb code, decode it and update context
*/
-static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
-{
+static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q){
int k, ret;
for(k = 0; (state->N[Q] << k) < state->A[Q]; k++);
@@ -109,7 +107,7 @@ static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
if(!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
ret = -(ret + 1);
- ret = ff_jpegls_update_state_regular(state, Q, ret);
+ ret= ff_jpegls_update_state_regular(state, Q, ret);
return ret;
}
@@ -117,12 +115,11 @@ static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
/**
* Get Golomb code, decode it and update state for run termination
*/
-static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RItype, int limit_add)
-{
+static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RItype, int limit_add){
int k, ret, temp, map;
int Q = 365 + RItype;
- temp = state->A[Q];
+ temp= state->A[Q];
if(RItype)
temp += state->N[Q] >> 1;
@@ -139,13 +136,10 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI
map = 1;
ret += RItype + map;
- if(ret & 1)
- {
+ if(ret & 1){
ret = map - ((ret + 1) >> 1);
state->B[Q]++;
- }
- else
- {
+ } else {
ret = ret >> 1;
}
@@ -160,14 +154,12 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI
/**
* Decode one line of image
*/
-static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits)
-{
+static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits){
int i, x = 0;
int Ra, Rb, Rc, Rd;
int D0, D1, D2;
- while(x < w)
- {
+ while(x < w) {
int err, pred;
/* compute gradients */
@@ -179,22 +171,18 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
D1 = Rb - Rc;
D2 = Rc - Ra;
/* run mode */
- if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near))
- {
+ if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) {
int r;
int RItype;
/* decode full runs while available */
- while(get_bits1(&s->gb))
- {
+ while(get_bits1(&s->gb)) {
int r;
r = 1 << ff_log2_run[state->run_index[comp]];
- if(x + r * stride > w)
- {
+ if(x + r * stride > w) {
r = (w - x) / stride;
}
- for(i = 0; i < r; i++)
- {
+ for(i = 0; i < r; i++) {
W(dst, x, Ra);
x += stride;
}
@@ -210,8 +198,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
r = ff_log2_run[state->run_index[comp]];
if(r)
r = get_bits_long(&s->gb, r);
- for(i = 0; i < r; i++)
- {
+ for(i = 0; i < r; i++) {
W(dst, x, Ra);
x += stride;
}
@@ -223,42 +210,31 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
if(state->run_index[comp])
state->run_index[comp]--;
- if(state->near && RItype)
- {
+ if(state->near && RItype){
pred = Ra + err;
- }
- else
- {
+ } else {
if(Rb < Ra)
pred = Rb - err;
else
pred = Rb + err;
}
- }
- else /* regular mode */
- {
+ } else { /* regular mode */
int context, sign;
context = ff_jpegls_quantize(state, D0) * 81 + ff_jpegls_quantize(state, D1) * 9 + ff_jpegls_quantize(state, D2);
pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
- if(context < 0)
- {
+ if(context < 0){
context = -context;
sign = 1;
- }
- else
- {
+ }else{
sign = 0;
}
- if(sign)
- {
+ if(sign){
pred = av_clip(pred - state->C[context], 0, state->maxval);
err = -ls_get_code_regular(&s->gb, state, context);
- }
- else
- {
+ } else {
pred = av_clip(pred + state->C[context], 0, state->maxval);
err = ls_get_code_regular(&s->gb, state, context);
}
@@ -266,8 +242,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
/* we have to do something more for near-lossless coding */
pred += err;
}
- if(state->near)
- {
+ if(state->near){
if(pred < -state->near)
pred += state->range * state->twonear;
else if(pred > state->maxval + state->near)
@@ -281,8 +256,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
}
}
-int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv)
-{
+int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv){
int i, t = 0;
uint8_t *zero, *last, *cur;
JLSState *state;
@@ -311,49 +285,38 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
// 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);
- if(ilv == 0) /* separate planes */
- {
+ if(ilv == 0) { /* separate planes */
off = s->cur_scan - 1;
stride = (s->nb_components > 1) ? 3 : 1;
width = s->width * stride;
cur += off;
- for(i = 0; i < s->height; i++)
- {
- if(s->bits <= 8)
- {
+ for(i = 0; i < s->height; i++) {
+ if(s->bits <= 8){
ls_decode_line(state, s, last, cur, t, width, stride, off, 8);
t = last[0];
- }
- else
- {
+ }else{
ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
t = *((uint16_t*)last);
}
last = cur;
cur += s->picture.linesize[0];
- if(s->restart_interval && !--s->restart_count)
- {
+ if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16); /* skip RSTn */
}
}
- }
- else if(ilv == 1) /* line interleaving */
- {
+ } else if(ilv == 1) { /* line interleaving */
int j;
int Rc[3] = {0, 0, 0};
memset(cur, 0, s->picture.linesize[0]);
width = s->width * 3;
- for(i = 0; i < s->height; i++)
- {
- for(j = 0; j < 3; j++)
- {
+ for(i = 0; i < s->height; i++) {
+ for(j = 0; j < 3; j++) {
ls_decode_line(state, s, last + j, cur + j, Rc[j], width, 3, j, 8);
Rc[j] = last[j];
- if(s->restart_interval && !--s->restart_count)
- {
+ if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16); /* skip RSTn */
}
@@ -361,45 +324,35 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
last = cur;
cur += s->picture.linesize[0];
}
- }
- else if(ilv == 2) /* sample interleaving */
- {
+ } else if(ilv == 2) { /* sample interleaving */
av_log(s->avctx, AV_LOG_ERROR, "Sample interleaved images are not supported.\n");
av_free(state);
av_free(zero);
return -1;
}
- if(shift) /* we need to do point transform or normalize samples */
- {
+ if(shift){ /* we need to do point transform or normalize samples */
int x, w;
w = s->width * s->nb_components;
- if(s->bits <= 8)
- {
+ if(s->bits <= 8){
uint8_t *src = s->picture.data[0];
- for(i = 0; i < s->height; i++)
- {
- for(x = off; x < w; x += stride)
- {
+ for(i = 0; i < s->height; i++){
+ for(x = off; x < w; x+= stride){
src[x] <<= shift;
}
src += s->picture.linesize[0];
}
- }
- else
- {
+ }else{
uint16_t *src = (uint16_t*) s->picture.data[0];
- for(i = 0; i < s->height; i++)
- {
- for(x = 0; x < w; x++)
- {
+ for(i = 0; i < s->height; i++){
+ for(x = 0; x < w; x++){
src[x] <<= shift;
}
- src += s->picture.linesize[0] / 2;
+ src += s->picture.linesize[0]/2;
}
}
}
@@ -410,8 +363,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
}
-AVCodec jpegls_decoder =
-{
+AVCodec jpegls_decoder = {
"jpegls",
CODEC_TYPE_VIDEO,
CODEC_ID_JPEGLS,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jrevdct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jrevdct.c
index 1ddc28e83..46a692bd8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jrevdct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/jrevdct.c
@@ -85,7 +85,7 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2];
*/
#if DCTSIZE != 8
-Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+ Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
#endif
@@ -211,69 +211,64 @@ ones here or successive P-frames will drift too much with Reference frame coding
void j_rev_dct(DCTBLOCK data)
{
- int32_t tmp0, tmp1, tmp2, tmp3;
- int32_t tmp10, tmp11, tmp12, tmp13;
- int32_t z1, z2, z3, z4, z5;
- int32_t d0, d1, d2, d3, d4, d5, d6, d7;
- 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. */
-
- 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;
-
- /* WARNING: we do the same permutation as MMX idct to simplify the
- video core */
- d0 = dataptr[0];
- d2 = dataptr[1];
- d4 = dataptr[2];
- d6 = dataptr[3];
- d1 = dataptr[4];
- d3 = dataptr[5];
- d5 = dataptr[6];
- d7 = dataptr[7];
-
- if((d1 | d2 | d3 | d4 | d5 | d6 | d7) == 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;
- idataptr[2] = v;
- idataptr[3] = v;
- }
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
+ int32_t tmp0, tmp1, tmp2, tmp3;
+ int32_t tmp10, tmp11, tmp12, tmp13;
+ int32_t z1, z2, z3, z4, z5;
+ int32_t d0, d1, d2, d3, d4, d5, d6, d7;
+ 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. */
+
+ 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;
+
+ /* WARNING: we do the same permutation as MMX idct to simplify the
+ video core */
+ d0 = dataptr[0];
+ d2 = dataptr[1];
+ d4 = dataptr[2];
+ d6 = dataptr[3];
+ d1 = dataptr[4];
+ d3 = dataptr[5];
+ d5 = dataptr[6];
+ d7 = dataptr[7];
+
+ if ((d1 | d2 | d3 | d4 | d5 | d6 | d7) == 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;
+ idataptr[2] = v;
+ idataptr[3] = v;
+ }
+
+ dataptr += DCTSIZE; /* 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)
- {
+ /* 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);
@@ -286,9 +281,7 @@ void j_rev_dct(DCTBLOCK data)
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- }
- else
- {
+ } else {
/* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
tmp2 = MULTIPLY(-d6, FIX_1_306562965);
tmp3 = MULTIPLY(d6, FIX_0_541196100);
@@ -300,12 +293,9 @@ void j_rev_dct(DCTBLOCK data)
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- }
}
- else
- {
- if(d2)
- {
+ } else {
+ if (d2) {
/* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
tmp2 = MULTIPLY(d2, FIX_0_541196100);
tmp3 = MULTIPLY(d2, FIX_1_306562965);
@@ -317,742 +307,640 @@ void j_rev_dct(DCTBLOCK data)
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- }
- else
- {
+ } else {
/* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
- }
}
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
-
- if(d7)
- {
- if(d5)
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z2 = d5 + d3;
- z3 = d7 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-z1, FIX_0_899976223);
- z2 = MULTIPLY(-z2, FIX_2_562915447);
- z3 = MULTIPLY(-z3, FIX_1_961570560);
- z4 = MULTIPLY(-z4, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
- z2 = d5 + d3;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- z1 = MULTIPLY(-d7, FIX_0_899976223);
- z2 = MULTIPLY(-z2, FIX_2_562915447);
- z3 = MULTIPLY(-z3, FIX_1_961570560);
- z4 = MULTIPLY(-d5, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 = z1 + z4;
- }
- }
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z4 = d5 + d1;
- z5 = MULTIPLY(d7 + z4, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-z1, FIX_0_899976223);
- z2 = MULTIPLY(-d5, FIX_2_562915447);
- z3 = MULTIPLY(-d7, FIX_1_961570560);
- z4 = MULTIPLY(-z4, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 = z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
- tmp0 = MULTIPLY(-d7, FIX_0_601344887);
- z1 = MULTIPLY(-d7, FIX_0_899976223);
- z3 = MULTIPLY(-d7, FIX_1_961570560);
- tmp1 = MULTIPLY(-d5, FIX_0_509795579);
- z2 = MULTIPLY(-d5, FIX_2_562915447);
- z4 = MULTIPLY(-d5, FIX_0_390180644);
- z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z3;
- tmp1 += z4;
- tmp2 = z2 + z3;
- tmp3 = z1 + z4;
- }
- }
+ }
+
+ /* Odd part per figure 8; the matrix is unitary and hence its
+ * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
+ */
+
+ if (d7) {
+ if (d5) {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
+ z1 = d7 + d1;
+ z2 = d5 + d3;
+ z3 = d7 + d3;
+ z4 = d5 + d1;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-z1, FIX_0_899976223);
+ z2 = MULTIPLY(-z2, FIX_2_562915447);
+ z3 = MULTIPLY(-z3, FIX_1_961570560);
+ z4 = MULTIPLY(-z4, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
+ z2 = d5 + d3;
+ z3 = d7 + d3;
+ z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ z1 = MULTIPLY(-d7, FIX_0_899976223);
+ z2 = MULTIPLY(-z2, FIX_2_562915447);
+ z3 = MULTIPLY(-z3, FIX_1_961570560);
+ z4 = MULTIPLY(-d5, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 = z1 + z4;
}
- else
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-z1, FIX_0_899976223);
- z2 = MULTIPLY(-d3, FIX_2_562915447);
- z3 = MULTIPLY(-z3, FIX_1_961570560);
- z4 = MULTIPLY(-d1, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 = z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
- z3 = d7 + d3;
-
- tmp0 = MULTIPLY(-d7, FIX_0_601344887);
- z1 = MULTIPLY(-d7, FIX_0_899976223);
- tmp2 = MULTIPLY(d3, FIX_0_509795579);
- z2 = MULTIPLY(-d3, FIX_2_562915447);
- z5 = MULTIPLY(z3, FIX_1_175875602);
- z3 = MULTIPLY(-z3, FIX_0_785694958);
-
- tmp0 += z3;
- tmp1 = z2 + z5;
- tmp2 += z3;
- tmp3 = z1 + z5;
- }
- }
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z5 = MULTIPLY(z1, FIX_1_175875602);
-
- z1 = MULTIPLY(z1, FIX_0_275899380);
- z3 = MULTIPLY(-d7, FIX_1_961570560);
- tmp0 = MULTIPLY(-d7, FIX_1_662939225);
- z4 = MULTIPLY(-d1, FIX_0_390180644);
- tmp3 = MULTIPLY(d1, FIX_1_111140466);
-
- tmp0 += z1;
- tmp1 = z4 + z5;
- tmp2 = z3 + z5;
- tmp3 += z1;
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
- tmp0 = MULTIPLY(-d7, FIX_1_387039845);
- tmp1 = MULTIPLY(d7, FIX_1_175875602);
- tmp2 = MULTIPLY(-d7, FIX_0_785694958);
- tmp3 = MULTIPLY(d7, FIX_0_275899380);
- }
- }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
+ z1 = d7 + d1;
+ z4 = d5 + d1;
+ z5 = MULTIPLY(d7 + z4, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-z1, FIX_0_899976223);
+ z2 = MULTIPLY(-d5, FIX_2_562915447);
+ z3 = MULTIPLY(-d7, FIX_1_961570560);
+ z4 = MULTIPLY(-z4, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 = z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
+ tmp0 = MULTIPLY(-d7, FIX_0_601344887);
+ z1 = MULTIPLY(-d7, FIX_0_899976223);
+ z3 = MULTIPLY(-d7, FIX_1_961570560);
+ tmp1 = MULTIPLY(-d5, FIX_0_509795579);
+ z2 = MULTIPLY(-d5, FIX_2_562915447);
+ z4 = MULTIPLY(-d5, FIX_0_390180644);
+ z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z3;
+ tmp1 += z4;
+ tmp2 = z2 + z3;
+ tmp3 = z1 + z4;
}
}
- else
- {
- if(d5)
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
-
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-d1, FIX_0_899976223);
- z2 = MULTIPLY(-z2, FIX_2_562915447);
- z3 = MULTIPLY(-d3, FIX_1_961570560);
- z4 = MULTIPLY(-z4, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 = z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
-
- z5 = MULTIPLY(z2, FIX_1_175875602);
- tmp1 = MULTIPLY(d5, FIX_1_662939225);
- z4 = MULTIPLY(-d5, FIX_0_390180644);
- z2 = MULTIPLY(-z2, FIX_1_387039845);
- tmp2 = MULTIPLY(d3, FIX_1_111140466);
- z3 = MULTIPLY(-d3, FIX_1_961570560);
-
- tmp0 = z3 + z5;
- tmp1 += z2;
- tmp2 += z2;
- tmp3 = z4 + z5;
- }
- }
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
- z4 = d5 + d1;
-
- z5 = MULTIPLY(z4, FIX_1_175875602);
- z1 = MULTIPLY(-d1, FIX_0_899976223);
- tmp3 = MULTIPLY(d1, FIX_0_601344887);
- tmp1 = MULTIPLY(-d5, FIX_0_509795579);
- z2 = MULTIPLY(-d5, FIX_2_562915447);
- z4 = MULTIPLY(z4, FIX_0_785694958);
-
- tmp0 = z1 + z5;
- tmp1 += z4;
- tmp2 = z2 + z5;
- tmp3 += z4;
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
- tmp0 = MULTIPLY(d5, FIX_1_175875602);
- tmp1 = MULTIPLY(d5, FIX_0_275899380);
- tmp2 = MULTIPLY(-d5, FIX_1_387039845);
- tmp3 = MULTIPLY(d5, FIX_0_785694958);
- }
- }
+ } else {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
+ z1 = d7 + d1;
+ z3 = d7 + d3;
+ z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-z1, FIX_0_899976223);
+ z2 = MULTIPLY(-d3, FIX_2_562915447);
+ z3 = MULTIPLY(-z3, FIX_1_961570560);
+ z4 = MULTIPLY(-d1, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 = z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
+ z3 = d7 + d3;
+
+ tmp0 = MULTIPLY(-d7, FIX_0_601344887);
+ z1 = MULTIPLY(-d7, FIX_0_899976223);
+ tmp2 = MULTIPLY(d3, FIX_0_509795579);
+ z2 = MULTIPLY(-d3, FIX_2_562915447);
+ z5 = MULTIPLY(z3, FIX_1_175875602);
+ z3 = MULTIPLY(-z3, FIX_0_785694958);
+
+ tmp0 += z3;
+ tmp1 = z2 + z5;
+ tmp2 += z3;
+ tmp3 = z1 + z5;
}
- else
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
- z5 = d1 + d3;
- tmp3 = MULTIPLY(d1, FIX_0_211164243);
- tmp2 = MULTIPLY(-d3, FIX_1_451774981);
- z1 = MULTIPLY(d1, FIX_1_061594337);
- z2 = MULTIPLY(-d3, FIX_2_172734803);
- z4 = MULTIPLY(z5, FIX_0_785694958);
- z5 = MULTIPLY(z5, FIX_1_175875602);
-
- tmp0 = z1 - z4;
- tmp1 = z2 + z4;
- tmp2 += z5;
- tmp3 += z5;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(-d3, FIX_0_785694958);
- tmp1 = MULTIPLY(-d3, FIX_1_387039845);
- tmp2 = MULTIPLY(-d3, FIX_0_275899380);
- tmp3 = MULTIPLY(d3, FIX_1_175875602);
- }
- }
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(d1, FIX_0_275899380);
- tmp1 = MULTIPLY(d1, FIX_0_785694958);
- tmp2 = MULTIPLY(d1, FIX_1_175875602);
- tmp3 = MULTIPLY(d1, FIX_1_387039845);
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = tmp1 = tmp2 = tmp3 = 0;
- }
- }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
+ z1 = d7 + d1;
+ z5 = MULTIPLY(z1, FIX_1_175875602);
+
+ z1 = MULTIPLY(z1, FIX_0_275899380);
+ z3 = MULTIPLY(-d7, FIX_1_961570560);
+ tmp0 = MULTIPLY(-d7, FIX_1_662939225);
+ z4 = MULTIPLY(-d1, FIX_0_390180644);
+ tmp3 = MULTIPLY(d1, FIX_1_111140466);
+
+ tmp0 += z1;
+ tmp1 = z4 + z5;
+ tmp2 = z3 + z5;
+ tmp3 += z1;
+ } else {
+ /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
+ tmp0 = MULTIPLY(-d7, FIX_1_387039845);
+ tmp1 = MULTIPLY(d7, FIX_1_175875602);
+ tmp2 = MULTIPLY(-d7, FIX_0_785694958);
+ tmp3 = MULTIPLY(d7, FIX_0_275899380);
}
}
}
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
- dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
- dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
- dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
- dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
- dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
-
- dataptr += DCTSIZE; /* 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[DCTSIZE*0];
- d1 = dataptr[DCTSIZE*1];
- d2 = dataptr[DCTSIZE*2];
- d3 = dataptr[DCTSIZE*3];
- d4 = dataptr[DCTSIZE*4];
- d5 = dataptr[DCTSIZE*5];
- d6 = dataptr[DCTSIZE*6];
- d7 = dataptr[DCTSIZE*7];
-
- /* 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 {
+ if (d5) {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
+ z2 = d5 + d3;
+ z4 = d5 + d1;
+ z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
+
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-d1, FIX_0_899976223);
+ z2 = MULTIPLY(-z2, FIX_2_562915447);
+ z3 = MULTIPLY(-d3, FIX_1_961570560);
+ z4 = MULTIPLY(-z4, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 = z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
+ z2 = d5 + d3;
+
+ z5 = MULTIPLY(z2, FIX_1_175875602);
+ tmp1 = MULTIPLY(d5, FIX_1_662939225);
+ z4 = MULTIPLY(-d5, FIX_0_390180644);
+ z2 = MULTIPLY(-z2, FIX_1_387039845);
+ tmp2 = MULTIPLY(d3, FIX_1_111140466);
+ z3 = MULTIPLY(-d3, FIX_1_961570560);
+
+ tmp0 = z3 + z5;
+ tmp1 += z2;
+ tmp2 += z2;
+ tmp3 = z4 + z5;
+ }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
+ z4 = d5 + d1;
+
+ z5 = MULTIPLY(z4, FIX_1_175875602);
+ z1 = MULTIPLY(-d1, FIX_0_899976223);
+ tmp3 = MULTIPLY(d1, FIX_0_601344887);
+ tmp1 = MULTIPLY(-d5, FIX_0_509795579);
+ z2 = MULTIPLY(-d5, FIX_2_562915447);
+ z4 = MULTIPLY(z4, FIX_0_785694958);
+
+ tmp0 = z1 + z5;
+ tmp1 += z4;
+ tmp2 = z2 + z5;
+ tmp3 += z4;
+ } else {
+ /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
+ tmp0 = MULTIPLY(d5, FIX_1_175875602);
+ tmp1 = MULTIPLY(d5, FIX_0_275899380);
+ tmp2 = MULTIPLY(-d5, FIX_1_387039845);
+ tmp3 = MULTIPLY(d5, FIX_0_785694958);
+ }
}
- 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 (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
+ z5 = d1 + d3;
+ tmp3 = MULTIPLY(d1, FIX_0_211164243);
+ tmp2 = MULTIPLY(-d3, FIX_1_451774981);
+ z1 = MULTIPLY(d1, FIX_1_061594337);
+ z2 = MULTIPLY(-d3, FIX_2_172734803);
+ z4 = MULTIPLY(z5, FIX_0_785694958);
+ z5 = MULTIPLY(z5, FIX_1_175875602);
+
+ tmp0 = z1 - z4;
+ tmp1 = z2 + z4;
+ tmp2 += z5;
+ tmp3 += z5;
+ } else {
+ /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
+ tmp0 = MULTIPLY(-d3, FIX_0_785694958);
+ tmp1 = MULTIPLY(-d3, FIX_1_387039845);
+ tmp2 = MULTIPLY(-d3, FIX_0_275899380);
+ tmp3 = MULTIPLY(d3, FIX_1_175875602);
+ }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
+ tmp0 = MULTIPLY(d1, FIX_0_275899380);
+ tmp1 = MULTIPLY(d1, FIX_0_785694958);
+ tmp2 = MULTIPLY(d1, FIX_1_175875602);
+ tmp3 = MULTIPLY(d1, FIX_1_387039845);
+ } else {
+ /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
+ tmp0 = tmp1 = tmp2 = tmp3 = 0;
+ }
}
}
- 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;
+ }
+}
+ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+
+ dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
+ dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
+ dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
+ dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
+ dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
+ dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
+ dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
+ dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
+
+ dataptr += DCTSIZE; /* 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[DCTSIZE*0];
+ d1 = dataptr[DCTSIZE*1];
+ d2 = dataptr[DCTSIZE*2];
+ d3 = dataptr[DCTSIZE*3];
+ d4 = dataptr[DCTSIZE*4];
+ d5 = dataptr[DCTSIZE*5];
+ d6 = dataptr[DCTSIZE*6];
+ d7 = dataptr[DCTSIZE*7];
+
+ /* 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
- {
- /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
- tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
+ } 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;
}
- }
+ }
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
- if(d7)
- {
- if(d5)
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z2 = d5 + d3;
- z3 = d7 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-z1, FIX_0_899976223);
- z2 = MULTIPLY(-z2, FIX_2_562915447);
- z3 = MULTIPLY(-z3, FIX_1_961570560);
- z4 = MULTIPLY(-z4, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
- z2 = d5 + d3;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- z1 = MULTIPLY(-d7, FIX_0_899976223);
- z2 = MULTIPLY(-z2, FIX_2_562915447);
- z3 = MULTIPLY(-z3, FIX_1_961570560);
- z4 = MULTIPLY(-d5, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 = z1 + z4;
- }
+ /* Odd part per figure 8; the matrix is unitary and hence its
+ * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
+ */
+ if (d7) {
+ if (d5) {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
+ z1 = d7 + d1;
+ z2 = d5 + d3;
+ z3 = d7 + d3;
+ z4 = d5 + d1;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-z1, FIX_0_899976223);
+ z2 = MULTIPLY(-z2, FIX_2_562915447);
+ z3 = MULTIPLY(-z3, FIX_1_961570560);
+ z4 = MULTIPLY(-z4, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
+ z2 = d5 + d3;
+ z3 = d7 + d3;
+ z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ z1 = MULTIPLY(-d7, FIX_0_899976223);
+ z2 = MULTIPLY(-z2, FIX_2_562915447);
+ z3 = MULTIPLY(-z3, FIX_1_961570560);
+ z4 = MULTIPLY(-d5, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 = z1 + z4;
}
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z3 = d7;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-z1, FIX_0_899976223);
- z2 = MULTIPLY(-d5, FIX_2_562915447);
- z3 = MULTIPLY(-d7, FIX_1_961570560);
- z4 = MULTIPLY(-z4, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 = z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
- tmp0 = MULTIPLY(-d7, FIX_0_601344887);
- z1 = MULTIPLY(-d7, FIX_0_899976223);
- z3 = MULTIPLY(-d7, FIX_1_961570560);
- tmp1 = MULTIPLY(-d5, FIX_0_509795579);
- z2 = MULTIPLY(-d5, FIX_2_562915447);
- z4 = MULTIPLY(-d5, FIX_0_390180644);
- z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z3;
- tmp1 += z4;
- tmp2 = z2 + z3;
- tmp3 = z1 + z4;
- }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
+ z1 = d7 + d1;
+ z3 = d7;
+ z4 = d5 + d1;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-z1, FIX_0_899976223);
+ z2 = MULTIPLY(-d5, FIX_2_562915447);
+ z3 = MULTIPLY(-d7, FIX_1_961570560);
+ z4 = MULTIPLY(-z4, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 = z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
+ tmp0 = MULTIPLY(-d7, FIX_0_601344887);
+ z1 = MULTIPLY(-d7, FIX_0_899976223);
+ z3 = MULTIPLY(-d7, FIX_1_961570560);
+ tmp1 = MULTIPLY(-d5, FIX_0_509795579);
+ z2 = MULTIPLY(-d5, FIX_2_562915447);
+ z4 = MULTIPLY(-d5, FIX_0_390180644);
+ z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z3;
+ tmp1 += z4;
+ tmp2 = z2 + z3;
+ tmp3 = z1 + z4;
}
}
- else
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
-
- tmp0 = MULTIPLY(d7, FIX_0_298631336);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-z1, FIX_0_899976223);
- z2 = MULTIPLY(-d3, FIX_2_562915447);
- z3 = MULTIPLY(-z3, FIX_1_961570560);
- z4 = MULTIPLY(-d1, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 = z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
- z3 = d7 + d3;
-
- tmp0 = MULTIPLY(-d7, FIX_0_601344887);
- z1 = MULTIPLY(-d7, FIX_0_899976223);
- tmp2 = MULTIPLY(d3, FIX_0_509795579);
- z2 = MULTIPLY(-d3, FIX_2_562915447);
- z5 = MULTIPLY(z3, FIX_1_175875602);
- z3 = MULTIPLY(-z3, FIX_0_785694958);
-
- tmp0 += z3;
- tmp1 = z2 + z5;
- tmp2 += z3;
- tmp3 = z1 + z5;
- }
+ } else {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
+ z1 = d7 + d1;
+ z3 = d7 + d3;
+ z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
+
+ tmp0 = MULTIPLY(d7, FIX_0_298631336);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-z1, FIX_0_899976223);
+ z2 = MULTIPLY(-d3, FIX_2_562915447);
+ z3 = MULTIPLY(-z3, FIX_1_961570560);
+ z4 = MULTIPLY(-d1, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 = z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
+ z3 = d7 + d3;
+
+ tmp0 = MULTIPLY(-d7, FIX_0_601344887);
+ z1 = MULTIPLY(-d7, FIX_0_899976223);
+ tmp2 = MULTIPLY(d3, FIX_0_509795579);
+ z2 = MULTIPLY(-d3, FIX_2_562915447);
+ z5 = MULTIPLY(z3, FIX_1_175875602);
+ z3 = MULTIPLY(-z3, FIX_0_785694958);
+
+ tmp0 += z3;
+ tmp1 = z2 + z5;
+ tmp2 += z3;
+ tmp3 = z1 + z5;
}
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z5 = MULTIPLY(z1, FIX_1_175875602);
-
- z1 = MULTIPLY(z1, FIX_0_275899380);
- z3 = MULTIPLY(-d7, FIX_1_961570560);
- tmp0 = MULTIPLY(-d7, FIX_1_662939225);
- z4 = MULTIPLY(-d1, FIX_0_390180644);
- tmp3 = MULTIPLY(d1, FIX_1_111140466);
-
- tmp0 += z1;
- tmp1 = z4 + z5;
- tmp2 = z3 + z5;
- tmp3 += z1;
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
- tmp0 = MULTIPLY(-d7, FIX_1_387039845);
- tmp1 = MULTIPLY(d7, FIX_1_175875602);
- tmp2 = MULTIPLY(-d7, FIX_0_785694958);
- tmp3 = MULTIPLY(d7, FIX_0_275899380);
- }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
+ z1 = d7 + d1;
+ z5 = MULTIPLY(z1, FIX_1_175875602);
+
+ z1 = MULTIPLY(z1, FIX_0_275899380);
+ z3 = MULTIPLY(-d7, FIX_1_961570560);
+ tmp0 = MULTIPLY(-d7, FIX_1_662939225);
+ z4 = MULTIPLY(-d1, FIX_0_390180644);
+ tmp3 = MULTIPLY(d1, FIX_1_111140466);
+
+ tmp0 += z1;
+ tmp1 = z4 + z5;
+ tmp2 = z3 + z5;
+ tmp3 += z1;
+ } else {
+ /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
+ tmp0 = MULTIPLY(-d7, FIX_1_387039845);
+ tmp1 = MULTIPLY(d7, FIX_1_175875602);
+ tmp2 = MULTIPLY(-d7, FIX_0_785694958);
+ tmp3 = MULTIPLY(d7, FIX_0_275899380);
}
}
}
- else
- {
- if(d5)
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
-
- tmp1 = MULTIPLY(d5, FIX_2_053119869);
- tmp2 = MULTIPLY(d3, FIX_3_072711026);
- tmp3 = MULTIPLY(d1, FIX_1_501321110);
- z1 = MULTIPLY(-d1, FIX_0_899976223);
- z2 = MULTIPLY(-z2, FIX_2_562915447);
- z3 = MULTIPLY(-d3, FIX_1_961570560);
- z4 = MULTIPLY(-z4, FIX_0_390180644);
-
- z3 += z5;
- z4 += z5;
-
- tmp0 = z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
-
- z5 = MULTIPLY(z2, FIX_1_175875602);
- tmp1 = MULTIPLY(d5, FIX_1_662939225);
- z4 = MULTIPLY(-d5, FIX_0_390180644);
- z2 = MULTIPLY(-z2, FIX_1_387039845);
- tmp2 = MULTIPLY(d3, FIX_1_111140466);
- z3 = MULTIPLY(-d3, FIX_1_961570560);
-
- tmp0 = z3 + z5;
- tmp1 += z2;
- tmp2 += z2;
- tmp3 = z4 + z5;
- }
+ } else {
+ if (d5) {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
+ z2 = d5 + d3;
+ z4 = d5 + d1;
+ z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
+
+ tmp1 = MULTIPLY(d5, FIX_2_053119869);
+ tmp2 = MULTIPLY(d3, FIX_3_072711026);
+ tmp3 = MULTIPLY(d1, FIX_1_501321110);
+ z1 = MULTIPLY(-d1, FIX_0_899976223);
+ z2 = MULTIPLY(-z2, FIX_2_562915447);
+ z3 = MULTIPLY(-d3, FIX_1_961570560);
+ z4 = MULTIPLY(-z4, FIX_0_390180644);
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 = z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+ } else {
+ /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
+ z2 = d5 + d3;
+
+ z5 = MULTIPLY(z2, FIX_1_175875602);
+ tmp1 = MULTIPLY(d5, FIX_1_662939225);
+ z4 = MULTIPLY(-d5, FIX_0_390180644);
+ z2 = MULTIPLY(-z2, FIX_1_387039845);
+ tmp2 = MULTIPLY(d3, FIX_1_111140466);
+ z3 = MULTIPLY(-d3, FIX_1_961570560);
+
+ tmp0 = z3 + z5;
+ tmp1 += z2;
+ tmp2 += z2;
+ tmp3 = z4 + z5;
}
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
- z4 = d5 + d1;
-
- z5 = MULTIPLY(z4, FIX_1_175875602);
- z1 = MULTIPLY(-d1, FIX_0_899976223);
- tmp3 = MULTIPLY(d1, FIX_0_601344887);
- tmp1 = MULTIPLY(-d5, FIX_0_509795579);
- z2 = MULTIPLY(-d5, FIX_2_562915447);
- z4 = MULTIPLY(z4, FIX_0_785694958);
-
- tmp0 = z1 + z5;
- tmp1 += z4;
- tmp2 = z2 + z5;
- tmp3 += z4;
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
- tmp0 = MULTIPLY(d5, FIX_1_175875602);
- tmp1 = MULTIPLY(d5, FIX_0_275899380);
- tmp2 = MULTIPLY(-d5, FIX_1_387039845);
- tmp3 = MULTIPLY(d5, FIX_0_785694958);
- }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
+ z4 = d5 + d1;
+
+ z5 = MULTIPLY(z4, FIX_1_175875602);
+ z1 = MULTIPLY(-d1, FIX_0_899976223);
+ tmp3 = MULTIPLY(d1, FIX_0_601344887);
+ tmp1 = MULTIPLY(-d5, FIX_0_509795579);
+ z2 = MULTIPLY(-d5, FIX_2_562915447);
+ z4 = MULTIPLY(z4, FIX_0_785694958);
+
+ tmp0 = z1 + z5;
+ tmp1 += z4;
+ tmp2 = z2 + z5;
+ tmp3 += z4;
+ } else {
+ /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
+ tmp0 = MULTIPLY(d5, FIX_1_175875602);
+ tmp1 = MULTIPLY(d5, FIX_0_275899380);
+ tmp2 = MULTIPLY(-d5, FIX_1_387039845);
+ tmp3 = MULTIPLY(d5, FIX_0_785694958);
}
}
- else
- {
- if(d3)
- {
- if(d1)
- {
- /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
- z5 = d1 + d3;
- tmp3 = MULTIPLY(d1, FIX_0_211164243);
- tmp2 = MULTIPLY(-d3, FIX_1_451774981);
- z1 = MULTIPLY(d1, FIX_1_061594337);
- z2 = MULTIPLY(-d3, FIX_2_172734803);
- z4 = MULTIPLY(z5, FIX_0_785694958);
- z5 = MULTIPLY(z5, FIX_1_175875602);
-
- tmp0 = z1 - z4;
- tmp1 = z2 + z4;
- tmp2 += z5;
- tmp3 += z5;
- }
- else
- {
- /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(-d3, FIX_0_785694958);
- tmp1 = MULTIPLY(-d3, FIX_1_387039845);
- tmp2 = MULTIPLY(-d3, FIX_0_275899380);
- tmp3 = MULTIPLY(d3, FIX_1_175875602);
- }
+ } else {
+ if (d3) {
+ if (d1) {
+ /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
+ z5 = d1 + d3;
+ tmp3 = MULTIPLY(d1, FIX_0_211164243);
+ tmp2 = MULTIPLY(-d3, FIX_1_451774981);
+ z1 = MULTIPLY(d1, FIX_1_061594337);
+ z2 = MULTIPLY(-d3, FIX_2_172734803);
+ z4 = MULTIPLY(z5, FIX_0_785694958);
+ z5 = MULTIPLY(z5, FIX_1_175875602);
+
+ tmp0 = z1 - z4;
+ tmp1 = z2 + z4;
+ tmp2 += z5;
+ tmp3 += z5;
+ } else {
+ /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
+ tmp0 = MULTIPLY(-d3, FIX_0_785694958);
+ tmp1 = MULTIPLY(-d3, FIX_1_387039845);
+ tmp2 = MULTIPLY(-d3, FIX_0_275899380);
+ tmp3 = MULTIPLY(d3, FIX_1_175875602);
}
- else
- {
- if(d1)
- {
- /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(d1, FIX_0_275899380);
- tmp1 = MULTIPLY(d1, FIX_0_785694958);
- tmp2 = MULTIPLY(d1, FIX_1_175875602);
- tmp3 = MULTIPLY(d1, FIX_1_387039845);
- }
- else
- {
- /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = tmp1 = tmp2 = tmp3 = 0;
- }
+ } else {
+ if (d1) {
+ /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
+ tmp0 = MULTIPLY(d1, FIX_0_275899380);
+ tmp1 = MULTIPLY(d1, FIX_0_785694958);
+ tmp2 = MULTIPLY(d1, FIX_1_175875602);
+ tmp3 = MULTIPLY(d1, FIX_1_387039845);
+ } else {
+ /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
+ tmp0 = tmp1 = tmp2 = tmp3 = 0;
}
}
}
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
- CONST_BITS + PASS1_BITS + 3);
- dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
- CONST_BITS + PASS1_BITS + 3);
-
- dataptr++; /* advance pointer to next column */
}
+
+ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+
+ dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
+ CONST_BITS+PASS1_BITS+3);
+
+ dataptr++; /* advance pointer to next column */
+ }
}
#undef DCTSIZE
@@ -1061,232 +949,208 @@ void j_rev_dct(DCTBLOCK data)
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;
- }
+ 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;
+ }
- 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);
- /* 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;
+ 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
- {
- /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
- tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
+ } 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);
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+ tmp0 = (d0 + d4) << CONST_BITS;
+ tmp1 = (d0 - d4) << CONST_BITS;
- 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);
+ 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);
- dataptr += DCTSTRIDE; /* advance pointer to next row */
- }
+ tmp0 = (d0 + d4) << CONST_BITS;
+ tmp1 = (d0 - d4) << CONST_BITS;
- /* 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;
+ 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;
+ } 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 */
+ /* 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[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 */
- }
+ 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_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;
+void j_rev_dct1(DCTBLOCK data){
+ data[0] = (data[0] + 4)>>3;
}
#undef FIX
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/libamr.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/libamr.c
index b46a28f19..695fc4ca7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/libamr.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/libamr.c
@@ -19,35 +19,35 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/** @file
-* Adaptive Multi-Rate (AMR) Audio decoder stub.
-*
-* This code implements both an AMR-NarrowBand (AMR-NB) and an AMR-WideBand
-* (AMR-WB) audio encoder/decoder through external reference code from
-* http://www.3gpp.org/. The license of the code from 3gpp is unclear so you
-* have to download the code separately.
-*
-* \section AMR-NB
-*
-* The float version (default) can be downloaded from:
-* http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip
-*
-* \subsection Specification
-* The specification for AMR-NB can be found in TS 26.071
-* (http://www.3gpp.org/ftp/Specs/html-info/26071.htm) and some other
-* info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
-*
-* \section AMR-WB
-*
-* The reference code can be downloaded from:
-* http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip
-*
-* \subsection Specification
-* The specification for AMR-WB can be found in TS 26.171
-* (http://www.3gpp.org/ftp/Specs/html-info/26171.htm) and some other
-* info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
-*
-*/
+ /** @file
+ * Adaptive Multi-Rate (AMR) Audio decoder stub.
+ *
+ * This code implements both an AMR-NarrowBand (AMR-NB) and an AMR-WideBand
+ * (AMR-WB) audio encoder/decoder through external reference code from
+ * http://www.3gpp.org/. The license of the code from 3gpp is unclear so you
+ * have to download the code separately.
+ *
+ * \section AMR-NB
+ *
+ * The float version (default) can be downloaded from:
+ * http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip
+ *
+ * \subsection Specification
+ * The specification for AMR-NB can be found in TS 26.071
+ * (http://www.3gpp.org/ftp/Specs/html-info/26071.htm) and some other
+ * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
+ *
+ * \section AMR-WB
+ *
+ * The reference code can be downloaded from:
+ * http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip
+ *
+ * \subsection Specification
+ * The specification for AMR-WB can be found in TS 26.171
+ * (http://www.3gpp.org/ftp/Specs/html-info/26171.htm) and some other
+ * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
+ *
+ */
#include "avcodec.h"
@@ -56,10 +56,10 @@ static void 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;
- if(!avctx->sample_rate)
+ if (!avctx->sample_rate)
avctx->sample_rate = 8000 * is_amr_wb;
- if(!avctx->channels)
+ if (!avctx->channels)
avctx->channels = 1;
avctx->frame_size = 160 * is_amr_wb;
@@ -74,8 +74,7 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx)
static const char nb_bitrate_unsupported[] =
"bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n";
-typedef struct AMR_bitrates
-{
+typedef struct AMR_bitrates {
int rate;
enum Mode mode;
} AMR_bitrates;
@@ -85,25 +84,23 @@ static int getBitrateMode(int bitrate)
{
/* make the correspondance between bitrate and mode */
AMR_bitrates rates[] = { { 4750, MR475},
- { 5150, MR515},
- { 5900, MR59},
- { 6700, MR67},
- { 7400, MR74},
- { 7950, MR795},
- {10200, MR102},
- {12200, MR122},
- };
+ { 5150, MR515},
+ { 5900, MR59},
+ { 6700, MR67},
+ { 7400, MR74},
+ { 7950, MR795},
+ {10200, MR102},
+ {12200, MR122}, };
int i;
- for(i = 0; i < 8; i++)
- if(rates[i].rate == bitrate)
+ for (i = 0; i < 8; i++)
+ if (rates[i].rate == bitrate)
return rates[i].mode;
/* no bitrate matching, return an error */
return -1;
}
-typedef struct AMRContext
-{
+typedef struct AMRContext {
int frameCount;
void *decState;
int *enstate;
@@ -116,16 +113,14 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
s->frameCount = 0;
s->decState = Decoder_Interface_init();
- if(!s->decState)
- {
+ if (!s->decState) {
av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
return -1;
}
amr_decode_fix_avctx(avctx);
- if(avctx->channels > 1)
- {
+ if (avctx->channels > 1) {
av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
return -1;
}
@@ -156,8 +151,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, void *data,
dec_mode = (buf[0] >> 3) & 0x000F;
packet_size = block_size[dec_mode] + 1;
- if(packet_size > buf_size)
- {
+ if (packet_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",
buf_size, packet_size);
return -1;
@@ -173,8 +167,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, void *data,
return packet_size;
}
-AVCodec libamr_nb_decoder =
-{
+AVCodec libamr_nb_decoder = {
"libamr_nb",
CODEC_TYPE_AUDIO,
CODEC_ID_AMR_NB,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mathops.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mathops.h
index 3e2b40215..acccd645b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mathops.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mathops.h
@@ -38,16 +38,14 @@
//gcc 3.4 creates an incredibly bloated mess out of this
//# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32)
-static av_always_inline int MULH(int a, int b)
-{
- return ((int64_t)(a) * (int64_t)(b)) >> 32;
+static av_always_inline int MULH(int a, int b){
+ return ((int64_t)(a) * (int64_t)(b))>>32;
}
#endif
#ifndef UMULH
-static av_always_inline unsigned UMULH(unsigned a, unsigned b)
-{
- return ((uint64_t)(a) * (uint64_t)(b)) >> 32;
+static av_always_inline unsigned UMULH(unsigned a, unsigned b){
+ return ((uint64_t)(a) * (uint64_t)(b))>>32;
}
#endif
@@ -83,28 +81,23 @@ static av_always_inline unsigned UMULH(unsigned a, unsigned b)
static inline av_const int mid_pred(int a, int b, int c)
{
#if 0
- int t = (a - b) & ((a - b) >> 31);
- a -= t;
- b += t;
- b -= (b - c) & ((b - c) >> 31);
- b += (a - b) & ((a - b) >> 31);
+ int t= (a-b)&((a-b)>>31);
+ a-=t;
+ b+=t;
+ b-= (b-c)&((b-c)>>31);
+ b+= (a-b)&((a-b)>>31);
return b;
#else
- if(a > b)
- {
- if(c > b)
- {
- if(c > a) b = a;
- else b = c;
+ if(a>b){
+ if(c>b){
+ if(c>a) b=a;
+ else b=c;
}
- }
- else
- {
- if(b > c)
- {
- if(c > a) b = c;
- else b = a;
+ }else{
+ if(b>c){
+ if(c>a) b=c;
+ else b=a;
}
}
return b;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct.c
index 34357d481..3bf953134 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct.c
@@ -33,28 +33,27 @@
#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
av_cold void ff_kbd_window_init(float *window, float alpha, int n)
{
- int i, j;
- double sum = 0.0, bessel, tmp;
+ int i, j;
+ double sum = 0.0, bessel, tmp;
#if __STDC_VERSION__ >= 199901L
- double local_window[n];
+ double local_window[n];
#else
- double *local_window = _alloca(n * sizeof(double));
+ double *local_window = _alloca(n * sizeof(double));
#endif
- double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
-
- for(i = 0; i < n; i++)
- {
- tmp = i * (n - i) * alpha2;
- bessel = 1.0;
- for(j = BESSEL_I0_ITER; j > 0; j--)
- bessel = bessel * tmp / (j * j) + 1;
- sum += bessel;
- local_window[i] = sum;
- }
-
- sum++;
- for(i = 0; i < n; i++)
- window[i] = sqrt(local_window[i] / sum);
+ double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
+
+ for (i = 0; i < n; i++) {
+ tmp = i * (n - i) * alpha2;
+ bessel = 1.0;
+ for (j = BESSEL_I0_ITER; j > 0; j--)
+ bessel = bessel * tmp / (j * j) + 1;
+ sum += bessel;
+ local_window[i] = sum;
+ }
+
+ sum++;
+ for (i = 0; i < n; i++)
+ window[i] = sqrt(local_window[i] / sum);
}
//#include "mdct_tablegen.h"
@@ -75,15 +74,14 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
n4 = n >> 2;
s->permutation = FF_MDCT_PERM_NONE;
- if(ff_fft_init(s, s->mdct_bits - 2, inverse) < 0)
+ if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0)
goto fail;
- s->tcos = av_malloc(n / 2 * sizeof(FFTSample));
- if(!s->tcos)
+ s->tcos = av_malloc(n/2 * sizeof(FFTSample));
+ if (!s->tcos)
goto fail;
- switch(s->permutation)
- {
+ switch (s->permutation) {
case FF_MDCT_PERM_NONE:
s->tsin = s->tcos + n4;
tstep = 1;
@@ -98,14 +96,13 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
theta = 1.0 / 8.0 + (scale < 0 ? n4 : 0);
scale = sqrt(fabs(scale));
- for(i = 0; i < n4; i++)
- {
+ for(i=0;i<n4;i++) {
alpha = 2 * M_PI * (i + theta) / n;
s->tcos[i*tstep] = -cos(alpha) * scale;
s->tsin[i*tstep] = -sin(alpha) * scale;
}
return 0;
-fail:
+ fail:
ff_mdct_end(s);
return -1;
}
@@ -144,9 +141,8 @@ void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input)
/* pre rotation */
in1 = input;
in2 = input + n2 - 1;
- for(k = 0; k < n4; k++)
- {
- j = revtab[k];
+ for(k = 0; k < n4; k++) {
+ j=revtab[k];
CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]);
in1 += 2;
in2 -= 2;
@@ -154,8 +150,7 @@ void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input)
ff_fft_calc(s, z);
/* post rotation + reordering */
- for(k = 0; k < n8; k++)
- {
+ for(k = 0; k < n8; k++) {
FFTSample r0, i0, r1, i1;
CMUL(r0, i1, z[n8-k-1].im, z[n8-k-1].re, tsin[n8-k-1], tcos[n8-k-1]);
CMUL(r1, i0, z[n8+k ].im, z[n8+k ].re, tsin[n8+k ], tcos[n8+k ]);
@@ -178,10 +173,9 @@ void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input)
int n2 = n >> 1;
int n4 = n >> 2;
- ff_imdct_half_c(s, output + n4, input);
+ ff_imdct_half_c(s, output+n4, input);
- for(k = 0; k < n4; k++)
- {
+ for(k = 0; k < n4; k++) {
output[k] = -output[n2-k-1];
output[n-k-1] = output[n2+k];
}
@@ -208,8 +202,7 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
n3 = 3 * n4;
/* pre rotation */
- for(i = 0; i < n8; i++)
- {
+ for(i=0;i<n8;i++) {
re = -input[2*i+3*n4] - input[n3-1-2*i];
im = -input[n4+2*i] + input[n4-1-2*i];
j = revtab[i];
@@ -224,8 +217,7 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
ff_fft_calc(s, x);
/* post rotation */
- for(i = 0; i < n8; i++)
- {
+ for(i=0;i<n8;i++) {
FFTSample r0, i0, r1, i1;
CMUL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]);
CMUL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.c
index df3085514..f04502f18 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.c
@@ -36,7 +36,7 @@
void tableinit(void)
{
int i;
- for(i = 5; i <= 12; i++)
+ for (i = 5; i <= 12; i++)
ff_init_ff_sine_windows(i);
}
@@ -48,17 +48,14 @@ void tableinit(void)
size \
},
-const struct tabledef tables[] =
-{
- SINE_TABLE_DEF(32)
- SINE_TABLE_DEF(64)
- SINE_TABLE_DEF(128)
- SINE_TABLE_DEF(256)
- SINE_TABLE_DEF(512)
+const struct tabledef tables[] = {
+ SINE_TABLE_DEF( 32)
+ SINE_TABLE_DEF( 64)
+ SINE_TABLE_DEF( 128)
+ SINE_TABLE_DEF( 256)
+ SINE_TABLE_DEF( 512)
SINE_TABLE_DEF(1024)
SINE_TABLE_DEF(2048)
SINE_TABLE_DEF(4096)
- {
- NULL
- }
+ { NULL }
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.h
index 126ebf8ba..af652e745 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mdct_tablegen.h
@@ -26,11 +26,11 @@
#include <math.h>
#if !CONFIG_HARDCODED_TABLES
-SINETABLE(32);
-SINETABLE(64);
-SINETABLE(128);
-SINETABLE(256);
-SINETABLE(512);
+SINETABLE( 32);
+SINETABLE( 64);
+SINETABLE( 128);
+SINETABLE( 256);
+SINETABLE( 512);
SINETABLE(1024);
SINETABLE(2048);
SINETABLE(4096);
@@ -38,23 +38,20 @@ SINETABLE(4096);
#include "libavcodec/mdct_tables.h"
#endif
-SINETABLE_CONST float * const ff_sine_windows[] =
-{
+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
};
// Generate a sine window.
-av_cold void ff_sine_window_init(float *window, int n)
-{
+av_cold void ff_sine_window_init(float *window, int n) {
int i;
for(i = 0; i < n; i++)
window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
}
-av_cold void ff_init_ff_sine_windows(int index)
-{
+av_cold void ff_init_ff_sine_windows(int index) {
assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows));
#if !CONFIG_HARDCODED_TABLES
ff_sine_window_init(ff_sine_windows[index], 1 << index);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.c
index b6ff6b8c6..69b8a507d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.c
@@ -38,8 +38,7 @@
* The spec says that the values given produce "good" quality, and
* when divided by 2, "very good" quality.
*/
-const unsigned char std_luminance_quant_tbl[64] =
-{
+const unsigned char std_luminance_quant_tbl[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,
@@ -49,8 +48,7 @@ const unsigned char std_luminance_quant_tbl[64] =
49, 64, 78, 87, 103, 121, 120, 101,
72, 92, 95, 98, 112, 100, 103, 99
};
-const unsigned char std_chrominance_quant_tbl[64] =
-{
+const unsigned char std_chrominance_quant_tbl[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,
@@ -75,56 +73,54 @@ const uint8_t ff_mjpeg_bits_dc_chrominance[17] =
const uint8_t ff_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[] =
-{
- 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
+{ 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
};
const uint8_t ff_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[] =
-{
- 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
+{ 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
};
/* isn't this function nicer than the one in the libjpeg ? */
@@ -132,15 +128,13 @@ void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
const uint8_t *bits_table,
const uint8_t *val_table)
{
- int i, j, k, nb, code, sym;
+ int i, j, k,nb, code, sym;
code = 0;
k = 0;
- for(i = 1; i <= 16; i++)
- {
+ for(i=1;i<=16;i++) {
nb = bits_table[i];
- for(j = 0; j < nb; j++)
- {
+ for(j=0;j<nb;j++) {
sym = val_table[k++];
huff_size[sym] = i;
huff_code[sym] = code;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.h
index a90717595..b59fb785b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpeg.h
@@ -38,8 +38,7 @@
/* JPEG marker codes */
-typedef enum
-{
+typedef enum {
/* start of frame */
SOF0 = 0xc0, /* baseline */
SOF1 = 0xc1, /* extended sequential, huffman */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.c
index c5f40e062..49c04107e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.c
@@ -41,7 +41,7 @@
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)
+ int nb_codes, int use_static, int is_ac)
{
uint8_t huff_size[256+16];
uint16_t huff_code[256+16];
@@ -51,20 +51,18 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab
memset(huff_size, 0, sizeof(huff_size));
ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
- if(is_ac)
- {
- memmove(huff_size + 16, huff_size, sizeof(uint8_t)*nb_codes);
- memmove(huff_code + 16, huff_code, sizeof(uint16_t)*nb_codes);
- memset(huff_size, 0, sizeof(uint8_t) * 16);
- memset(huff_code, 0, sizeof(uint16_t) * 16);
+ if(is_ac){
+ memmove(huff_size+16, huff_size, sizeof(uint8_t)*nb_codes);
+ memmove(huff_code+16, huff_code, sizeof(uint16_t)*nb_codes);
+ memset(huff_size, 0, sizeof(uint8_t)*16);
+ memset(huff_code, 0, sizeof(uint16_t)*16);
nb_codes += 16;
}
return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, use_static);
}
-static void build_basic_mjpeg_vlc(MJpegDecodeContext * s)
-{
+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,
@@ -91,26 +89,23 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
build_basic_mjpeg_vlc(s);
- if(avctx->flags & CODEC_FLAG_EXTERN_HUFF)
+ if (avctx->flags & CODEC_FLAG_EXTERN_HUFF)
{
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))
- {
+ init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
+ if (ff_mjpeg_decode_dht(s)) {
av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table, switching back to internal\n");
build_basic_mjpeg_vlc(s);
}
}
- if(avctx->extradata_size > 9 &&
- AV_RL32(avctx->extradata + 4) == MKTAG('f', 'i', 'e', 'l'))
- {
- if(avctx->extradata[9] == 6) /* quicktime icefloe 019 */
- {
+ if (avctx->extradata_size > 9 &&
+ AV_RL32(avctx->extradata + 4) == MKTAG('f','i','e','l')) {
+ if (avctx->extradata[9] == 6) { /* 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 == CODEC_ID_AMV)
s->flipped = 1;
return 0;
@@ -124,29 +119,27 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
len = get_bits(&s->gb, 16) - 2;
- while(len >= 65)
- {
+ while (len >= 65) {
/* only 8 bit precision handled */
- if(get_bits(&s->gb, 4) != 0)
+ if (get_bits(&s->gb, 4) != 0)
{
av_log(s->avctx, AV_LOG_ERROR, "dqt: 16bit precision\n");
return -1;
}
index = get_bits(&s->gb, 4);
- if(index >= 4)
+ if (index >= 4)
return -1;
av_log(s->avctx, AV_LOG_DEBUG, "index=%d\n", index);
/* read quant table */
- for(i = 0; i < 64; i++)
- {
+ for(i=0;i<64;i++) {
j = s->scantable.permutated[i];
s->quant_matrixes[index][j] = get_bits(&s->gb, 8);
}
//XXX FIXME finetune, and perhaps add dc too
- s->qscale[index] = FFMAX(
- s->quant_matrixes[index][s->scantable.permutated[1]],
- s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
+ s->qscale[index]= FFMAX(
+ s->quant_matrixes[index][s->scantable.permutated[1]],
+ s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n", index, s->qscale[index]);
len -= 65;
}
@@ -163,31 +156,28 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
len = get_bits(&s->gb, 16) - 2;
- while(len > 0)
- {
- if(len < 17)
+ while (len > 0) {
+ if (len < 17)
return -1;
class = get_bits(&s->gb, 4);
- if(class >= 2)
+ if (class >= 2)
return -1;
index = get_bits(&s->gb, 4);
- if(index >= 4)
+ if (index >= 4)
return -1;
n = 0;
- for(i = 1; i <= 16; i++)
- {
+ for(i=1;i<=16;i++) {
bits_table[i] = get_bits(&s->gb, 8);
n += bits_table[i];
}
len -= 17;
- if(len < n || n > 256)
+ if (len < n || n > 256)
return -1;
code_max = 0;
- for(i = 0; i < n; i++)
- {
+ for(i=0;i<n;i++) {
v = get_bits(&s->gb, 8);
- if(v > code_max)
+ if (v > code_max)
code_max = v;
val_table[i] = v;
}
@@ -197,8 +187,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
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)
- {
+ if(build_vlc(&s->vlcs[class][index], bits_table, val_table, code_max + 1, 0, class > 0) < 0){
return -1;
}
}
@@ -211,13 +200,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
- s->bits = get_bits(&s->gb, 8);
+ s->bits= get_bits(&s->gb, 8);
- if(s->pegasus_rct) s->bits = 9;
- if(s->bits == 9 && !s->pegasus_rct) s->rct = 1; //FIXME ugly
+ if(s->pegasus_rct) s->bits=9;
+ if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
- if(s->bits != 8 && !s->lossless)
- {
+ if (s->bits != 8 && !s->lossless){
av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
return -1;
}
@@ -227,54 +215,50 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
//HACK for odd_height.mov
if(s->interlaced && s->width == width && s->height == height + 1)
- height = s->height;
+ height= s->height;
av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
if(avcodec_check_dimensions(s->avctx, width, height))
return -1;
nb_components = get_bits(&s->gb, 8);
- if(nb_components <= 0 ||
- nb_components > MAX_COMPONENTS)
+ if (nb_components <= 0 ||
+ nb_components > MAX_COMPONENTS)
return -1;
- if(s->ls && !(s->bits <= 8 || nb_components == 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;
}
s->nb_components = nb_components;
s->h_max = 1;
s->v_max = 1;
- for(i = 0; i < nb_components; i++)
- {
+ for(i=0;i<nb_components;i++) {
/* component id */
s->component_id[i] = get_bits(&s->gb, 8) - 1;
s->h_count[i] = get_bits(&s->gb, 4);
s->v_count[i] = get_bits(&s->gb, 4);
/* compute hmax and vmax (only used in interleaved case) */
- if(s->h_count[i] > s->h_max)
+ if (s->h_count[i] > s->h_max)
s->h_max = s->h_count[i];
- if(s->v_count[i] > s->v_max)
+ if (s->v_count[i] > s->v_max)
s->v_max = s->v_count[i];
s->quant_index[i] = get_bits(&s->gb, 8);
- if(s->quant_index[i] >= 4)
+ if (s->quant_index[i] >= 4)
return -1;
av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n", i, s->h_count[i],
s->v_count[i], s->component_id[i], s->quant_index[i]);
}
- if(s->ls && (s->h_max > 1 || s->v_max > 1))
- {
+ 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;
}
- if(s->v_max == 1 && s->h_max == 1 && s->lossless == 1) s->rgb = 1;
+ if(s->v_max==1 && s->h_max==1 && s->lossless==1) s->rgb=1;
/* if different size, realloc/alloc picture */
/* XXX: also check h_count and v_count */
- if(width != s->width || height != s->height)
- {
+ if (width != s->width || height != s->height) {
av_freep(&s->qscale_table);
s->width = width;
@@ -282,10 +266,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->interlaced = 0;
/* test interlaced mode */
- if(s->first_picture &&
- s->org_height != 0 &&
- s->height < ((s->org_height * 3) / 4))
- {
+ if (s->first_picture &&
+ s->org_height != 0 &&
+ s->height < ((s->org_height * 3) / 4)) {
s->interlaced = 1;
s->bottom_field = s->interlace_polarity;
s->picture.interlaced_frame = 1;
@@ -295,7 +278,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
avcodec_set_dimensions(s->avctx, width, height);
- s->qscale_table = av_mallocz((s->width + 15) / 16);
+ s->qscale_table= av_mallocz((s->width+15)/16);
s->first_picture = 0;
}
@@ -311,20 +294,17 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id);
//NOTE we do not allocate pictures large enough for the possible padding of h/v_count being 4
if(!(pix_fmt_id & 0xD0D0D0D0))
- pix_fmt_id -= (pix_fmt_id & 0xF0F0F0F0) >> 1;
+ pix_fmt_id-= (pix_fmt_id & 0xF0F0F0F0)>>1;
if(!(pix_fmt_id & 0x0D0D0D0D))
- pix_fmt_id -= (pix_fmt_id & 0x0F0F0F0F) >> 1;
+ pix_fmt_id-= (pix_fmt_id & 0x0F0F0F0F)>>1;
- switch(pix_fmt_id)
- {
+ switch(pix_fmt_id){
case 0x11111100:
- if(s->rgb)
- {
+ if(s->rgb){
s->avctx->pix_fmt = PIX_FMT_BGRA;
- }
- else
+ }else
s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV444P : PIX_FMT_YUVJ444P;
- assert(s->nb_components == 3);
+ assert(s->nb_components==3);
break;
case 0x11000000:
s->avctx->pix_fmt = PIX_FMT_GRAY8;
@@ -342,8 +322,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id);
return -1;
}
- if(s->ls)
- {
+ if(s->ls){
if(s->nb_components > 1)
s->avctx->pix_fmt = PIX_FMT_RGB24;
else if(s->bits <= 8)
@@ -355,35 +334,31 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if(s->picture.data[0])
s->avctx->release_buffer(s->avctx, &s->picture);
- s->picture.reference = 0;
- if(s->avctx->get_buffer(s->avctx, &s->picture) < 0)
- {
+ s->picture.reference= 0;
+ if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
- s->picture.pict_type = FF_I_TYPE;
- s->picture.key_frame = 1;
+ s->picture.pict_type= FF_I_TYPE;
+ s->picture.key_frame= 1;
s->got_picture = 1;
- for(i = 0; i < 3; i++)
- {
- s->linesize[i] = s->picture.linesize[i] << s->interlaced;
+ for(i=0; i<3; i++){
+ s->linesize[i]= s->picture.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);
- if(len != (8 + (3 * nb_components)))
+ if (len != (8+(3*nb_components)))
{
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
}
/* totally blank picture as progressive JPEG will only add details to it */
- if(s->progressive)
- {
- int bw = (width + s->h_max * 8 - 1) / (s->h_max * 8);
- int bh = (height + s->v_max * 8 - 1) / (s->v_max * 8);
- for(i = 0; i < s->nb_components; i++)
- {
+ if(s->progressive){
+ int bw = (width + s->h_max*8-1) / (s->h_max*8);
+ int bh = (height + s->v_max*8-1) / (s->v_max*8);
+ for(i=0; i<s->nb_components; i++) {
int size = bw * bh * s->h_count[i] * s->v_count[i];
av_freep(&s->blocks[i]);
av_freep(&s->last_nnz[i]);
@@ -400,7 +375,7 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)
{
int code;
code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2);
- if(code < 0)
+ if (code < 0)
{
av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n", 0, dc_index,
&s->vlcs[0][dc_index]);
@@ -421,8 +396,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
/* DC coef */
val = mjpeg_decode_dc(s, dc_index);
- if(val == 0xffff)
- {
+ if (val == 0xffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
return -1;
}
@@ -431,49 +405,42 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
block[0] = val;
/* AC coefs */
i = 0;
- {
- OPEN_READER(re, &s->gb)
- for(;;)
- {
- UPDATE_CACHE(re, &s->gb);
- GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
+ {OPEN_READER(re, &s->gb)
+ for(;;) {
+ UPDATE_CACHE(re, &s->gb);
+ GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
- /* EOB */
- if(code == 0x10)
- break;
- i += ((unsigned)code) >> 4;
- if(code != 0x100)
+ /* EOB */
+ if (code == 0x10)
+ break;
+ i += ((unsigned)code) >> 4;
+ if(code != 0x100){
+ code &= 0xf;
+ if(code > MIN_CACHE_BITS - 16){
+ UPDATE_CACHE(re, &s->gb)
+ }
{
- code &= 0xf;
- if(code > MIN_CACHE_BITS - 16)
- {
- UPDATE_CACHE(re, &s->gb)
- }
- {
- int cache = GET_CACHE(re, &s->gb);
- int sign = (~cache) >> 31;
- level = (NEG_USR32(sign ^ cache, code) ^ sign) - sign;
- }
+ int cache=GET_CACHE(re,&s->gb);
+ int sign=(~cache)>>31;
+ level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
+ }
- LAST_SKIP_BITS(re, &s->gb, code)
+ LAST_SKIP_BITS(re, &s->gb, code)
- if(i >= 63)
- {
- if(i == 63)
- {
- j = s->scantable.permutated[63];
- block[j] = level * quant_matrix[j];
- break;
- }
- av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
- return -1;
+ if (i >= 63) {
+ if(i == 63){
+ j = s->scantable.permutated[63];
+ block[j] = level * quant_matrix[j];
+ break;
}
- j = s->scantable.permutated[i];
- block[j] = level * quant_matrix[j];
+ av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
+ return -1;
}
+ j = s->scantable.permutated[i];
+ block[j] = level * quant_matrix[j];
}
- CLOSE_READER(re, &s->gb)
}
+ CLOSE_READER(re, &s->gb)}
return 0;
}
@@ -484,8 +451,7 @@ static int decode_dc_progressive(MJpegDecodeContext *s, DCTELEM *block, int comp
int val;
s->dsp.clear_block(block);
val = mjpeg_decode_dc(s, dc_index);
- if(val == 0xffff)
- {
+ if (val == 0xffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
return -1;
}
@@ -502,71 +468,58 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
{
int code, i, j, level, val, run;
- if(*EOBRUN)
- {
+ if(*EOBRUN){
(*EOBRUN)--;
return 0;
}
- {
- OPEN_READER(re, &s->gb)
- for(i = ss;; i++)
- {
- UPDATE_CACHE(re, &s->gb);
- GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
- /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
- code -= 16;
- if(code & 0xF)
+ {OPEN_READER(re, &s->gb)
+ for(i=ss;;i++) {
+ UPDATE_CACHE(re, &s->gb);
+ GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
+ /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
+ code -= 16;
+ if(code & 0xF) {
+ i += ((unsigned) code) >> 4;
+ code &= 0xf;
+ if(code > MIN_CACHE_BITS - 16){
+ UPDATE_CACHE(re, &s->gb)
+ }
{
- i += ((unsigned) code) >> 4;
- code &= 0xf;
- if(code > MIN_CACHE_BITS - 16)
- {
- UPDATE_CACHE(re, &s->gb)
- }
- {
- int cache = GET_CACHE(re, &s->gb);
- int sign = (~cache) >> 31;
- level = (NEG_USR32(sign ^ cache, code) ^ sign) - sign;
- }
+ int cache=GET_CACHE(re,&s->gb);
+ int sign=(~cache)>>31;
+ level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
+ }
- LAST_SKIP_BITS(re, &s->gb, code)
+ LAST_SKIP_BITS(re, &s->gb, code)
- if(i >= se)
- {
- if(i == se)
- {
- j = s->scantable.permutated[se];
- block[j] = level * quant_matrix[j] << Al;
- break;
- }
- av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
- return -1;
- }
- j = s->scantable.permutated[i];
- block[j] = level * quant_matrix[j] << Al;
- }
- else
- {
- run = ((unsigned) code) >> 4;
- if(run == 0xF) // ZRL - skip 15 coefficients
- {
- i += 15;
- }
- else
- {
- val = run;
- run = (1 << run);
- UPDATE_CACHE(re, &s->gb);
- run += (GET_CACHE(re, &s->gb) >> (32 - val)) & (run - 1);
- if(val)
- LAST_SKIP_BITS(re, &s->gb, val);
- *EOBRUN = run - 1;
+ if (i >= se) {
+ if(i == se){
+ j = s->scantable.permutated[se];
+ block[j] = level * quant_matrix[j] << Al;
break;
}
+ av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
+ return -1;
+ }
+ j = s->scantable.permutated[i];
+ block[j] = level * quant_matrix[j] << Al;
+ }else{
+ run = ((unsigned) code) >> 4;
+ if(run == 0xF){// ZRL - skip 15 coefficients
+ i += 15;
+ }else{
+ val = run;
+ run = (1 << run);
+ UPDATE_CACHE(re, &s->gb);
+ run += (GET_CACHE(re, &s->gb) >> (32 - val)) & (run - 1);
+ if(val)
+ LAST_SKIP_BITS(re, &s->gb, val);
+ *EOBRUN = run - 1;
+ break;
}
}
- CLOSE_READER(re, &s->gb)
}
+ CLOSE_READER(re, &s->gb)}
if(i > *last_nnz)
*last_nnz = i;
return 0;
@@ -598,25 +551,22 @@ for(;;i++) {\
/* decode block and dequantize - progressive JPEG refinement pass */
static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_t *last_nnz,
- int ac_index, int16_t *quant_matrix,
- int ss, int se, int Al, int *EOBRUN)
+ int ac_index, int16_t *quant_matrix,
+ int ss, int se, int Al, int *EOBRUN)
{
- int code, i = ss, j, sign, val, run;
+ int code, i=ss, j, sign, val, run;
int last = FFMIN(se, *last_nnz);
OPEN_READER(re, &s->gb);
if(*EOBRUN)
(*EOBRUN)--;
- else
- {
- for(;; i++)
- {
+ else {
+ for(;;i++) {
UPDATE_CACHE(re, &s->gb);
GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
/* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
code -= 16;
- if(code & 0xF)
- {
+ if(code & 0xF) {
run = ((unsigned) code) >> 4;
UPDATE_CACHE(re, &s->gb);
val = SHOW_UBITS(re, &s->gb, 1);
@@ -624,28 +574,21 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
ZERO_RUN;
j = s->scantable.permutated[i];
val--;
- block[j] = ((quant_matrix[j] ^ val) - val) << Al;
- if(i == se)
- {
+ block[j] = ((quant_matrix[j]^val)-val) << Al;
+ if(i == se) {
if(i > *last_nnz)
*last_nnz = i;
CLOSE_READER(re, &s->gb)
return 0;
}
- }
- else
- {
+ }else{
run = ((unsigned) code) >> 4;
- if(run == 0xF)
- {
+ if(run == 0xF){
ZERO_RUN;
- }
- else
- {
+ }else{
val = run;
run = (1 << run);
- if(val)
- {
+ if(val) {
UPDATE_CACHE(re, &s->gb);
run += SHOW_UBITS(re, &s->gb, val);
LAST_SKIP_BITS(re, &s->gb, val);
@@ -660,12 +603,11 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
*last_nnz = i;
}
- for(; i <= last; i++)
- {
+ for(;i<=last;i++) {
j = s->scantable.permutated[i];
if(block[j])
REFINE_BIT(j)
- }
+ }
CLOSE_READER(re, &s->gb);
return 0;
@@ -673,80 +615,65 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
#undef REFINE_BIT
#undef ZERO_RUN
-static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point_transform)
-{
+static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point_transform){
int i, mb_x, mb_y;
uint16_t (*buffer)[4];
int left[3], top[3], topleft[3];
- const int linesize = s->linesize[0];
- const int mask = (1 << s->bits) - 1;
+ const int linesize= s->linesize[0];
+ const int mask= (1<<s->bits)-1;
av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size, (unsigned)s->mb_width * 4 * sizeof(s->ljpeg_buffer[0][0]));
- buffer = s->ljpeg_buffer;
+ buffer= s->ljpeg_buffer;
- for(i = 0; i < 3; i++)
- {
- buffer[0][i] = 1 << (s->bits + point_transform - 1);
+ for(i=0; i<3; i++){
+ buffer[0][i]= 1 << (s->bits + point_transform - 1);
}
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- const int modified_predictor = mb_y ? predictor : 1;
+ for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
+ const int modified_predictor= mb_y ? predictor : 1;
uint8_t *ptr = s->picture.data[0] + (linesize * mb_y);
- if(s->interlaced && s->bottom_field)
+ if (s->interlaced && s->bottom_field)
ptr += linesize >> 1;
- for(i = 0; i < 3; i++)
- {
- top[i] = left[i] = topleft[i] = buffer[0][i];
+ for(i=0; i<3; i++){
+ top[i]= left[i]= topleft[i]= buffer[0][i];
}
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- if(s->restart_interval && !s->restart_count)
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
+ if (s->restart_interval && !s->restart_count)
s->restart_count = s->restart_interval;
- for(i = 0; i < 3; i++)
- {
+ for(i=0;i<3;i++) {
int pred;
- topleft[i] = top[i];
- top[i] = buffer[mb_x][i];
+ topleft[i]= top[i];
+ top[i]= buffer[mb_x][i];
PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
- left[i] =
- buffer[mb_x][i] = mask & (pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform));
+ left[i]=
+ buffer[mb_x][i]= mask & (pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform));
}
- if(s->restart_interval && !--s->restart_count)
- {
+ if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16); /* skip RSTn */
}
}
- if(s->rct)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2] - 0x200) >> 2);
+ if(s->rct){
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
+ ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2] - 0x200)>>2);
ptr[4*mb_x+0] = buffer[mb_x][1] + ptr[4*mb_x+1];
ptr[4*mb_x+2] = buffer[mb_x][2] + ptr[4*mb_x+1];
}
- }
- else if(s->pegasus_rct)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2]) >> 2);
+ }else if(s->pegasus_rct){
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
+ ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2])>>2);
ptr[4*mb_x+0] = buffer[mb_x][1] + ptr[4*mb_x+1];
ptr[4*mb_x+2] = buffer[mb_x][2] + ptr[4*mb_x+1];
}
- }
- else
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
+ }else{
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
ptr[4*mb_x+0] = buffer[mb_x][2];
ptr[4*mb_x+1] = buffer[mb_x][1];
ptr[4*mb_x+2] = buffer[mb_x][0];
@@ -756,22 +683,17 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point
return 0;
}
-static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform)
-{
+static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform){
int i, mb_x, mb_y;
- const int nb_components = 3;
+ const int nb_components=3;
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- if(s->restart_interval && !s->restart_count)
+ for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
+ if (s->restart_interval && !s->restart_count)
s->restart_count = s->restart_interval;
- if(mb_x == 0 || mb_y == 0 || s->interlaced)
- {
- for(i = 0; i < nb_components; i++)
- {
+ if(mb_x==0 || mb_y==0 || s->interlaced){
+ for(i=0;i<nb_components;i++) {
uint8_t *ptr;
int n, h, v, x, y, c, j, linesize;
n = s->nb_blocks[i];
@@ -780,52 +702,38 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
v = s->v_scount[i];
x = 0;
y = 0;
- linesize = s->linesize[c];
+ linesize= s->linesize[c];
- for(j = 0; j < n; j++)
- {
+ for(j=0; j<n; j++) {
int pred;
ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
- if(y == 0 && mb_y == 0)
- {
- if(x == 0 && mb_x == 0)
- {
- pred = 128 << point_transform;
- }
- else
- {
- pred = ptr[-1];
+ if(y==0 && mb_y==0){
+ if(x==0 && mb_x==0){
+ pred= 128 << point_transform;
+ }else{
+ pred= ptr[-1];
}
- }
- else
- {
- if(x == 0 && mb_x == 0)
- {
- pred = ptr[-linesize];
- }
- else
- {
+ }else{
+ if(x==0 && mb_x==0){
+ pred= ptr[-linesize];
+ }else{
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
}
}
- if(s->interlaced && s->bottom_field)
+ if (s->interlaced && s->bottom_field)
ptr += linesize >> 1;
- *ptr = pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
+ *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
- if(++x == h)
- {
+ if (++x == h) {
x = 0;
y++;
}
}
}
- }
- else
- {
- for(i = 0; i < nb_components; i++)
- {
+ }else{
+ for(i=0;i<nb_components;i++) {
uint8_t *ptr;
int n, h, v, x, y, c, j, linesize;
n = s->nb_blocks[i];
@@ -834,25 +742,22 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
v = s->v_scount[i];
x = 0;
y = 0;
- linesize = s->linesize[c];
+ linesize= s->linesize[c];
- for(j = 0; j < n; j++)
- {
+ for(j=0; j<n; j++) {
int pred;
ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
- *ptr = pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
- if(++x == h)
- {
+ *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
+ if (++x == h) {
x = 0;
y++;
}
}
}
}
- if(s->restart_interval && !--s->restart_count)
- {
+ if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16); /* skip RSTn */
}
@@ -861,40 +766,33 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
return 0;
}
-static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int Al)
-{
+static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int Al){
int i, mb_x, mb_y;
uint8_t* data[MAX_COMPONENTS];
int linesize[MAX_COMPONENTS];
- if(s->flipped && s->avctx->flags & CODEC_FLAG_EMU_EDGE)
- {
+ if(s->flipped && s->avctx->flags & CODEC_FLAG_EMU_EDGE) {
av_log(s->avctx, AV_LOG_ERROR, "Can not flip image with CODEC_FLAG_EMU_EDGE set!\n");
s->flipped = 0;
}
- for(i = 0; i < nb_components; i++)
- {
+ for(i=0; i < nb_components; i++) {
int c = s->comp_index[i];
data[c] = s->picture.data[c];
- linesize[c] = s->linesize[c];
+ linesize[c]=s->linesize[c];
s->coefs_finished[c] |= 1;
- if(s->flipped)
- {
+ if(s->flipped) {
//picture should be flipped upside-down for this codec
- data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height - ((s->height / s->v_max) & 7)) - 1));
+ data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
linesize[c] *= -1;
}
}
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- if(s->restart_interval && !s->restart_count)
+ for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
+ if (s->restart_interval && !s->restart_count)
s->restart_count = s->restart_interval;
- for(i = 0; i < nb_components; i++)
- {
+ for(i=0;i<nb_components;i++) {
uint8_t *ptr;
int n, h, v, x, y, c, j;
n = s->nb_blocks[i];
@@ -903,52 +801,44 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
v = s->v_scount[i];
x = 0;
y = 0;
- for(j = 0; j < n; j++)
- {
+ for(j=0;j<n;j++) {
ptr = data[c] +
- (((linesize[c] * (v * mb_y + y) * 8) +
- (h * mb_x + x) * 8) >> s->avctx->lowres);
+ (((linesize[c] * (v * mb_y + y) * 8) +
+ (h * mb_x + x) * 8) >> s->avctx->lowres);
if(s->interlaced && s->bottom_field)
ptr += linesize[c] >> 1;
- if(!s->progressive)
- {
+ if(!s->progressive) {
s->dsp.clear_block(s->block);
if(decode_block(s, s->block, i,
- s->dc_index[i], s->ac_index[i],
- s->quant_matrixes[ s->quant_index[c] ]) < 0)
- {
+ s->dc_index[i], s->ac_index[i],
+ 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;
}
s->dsp.idct_put(ptr, linesize[c], s->block);
- }
- else
- {
+ } else {
int block_idx = s->block_stride[c] * (v * mb_y + y) + (h * mb_x + x);
DCTELEM *block = s->blocks[c][block_idx];
if(Ah)
block[0] += get_bits1(&s->gb) * s->quant_matrixes[ s->quant_index[c] ][0] << Al;
- else if(decode_dc_progressive(s, block, i, s->dc_index[i], s->quant_matrixes[ s->quant_index[c] ], Al) < 0)
- {
+ else if(decode_dc_progressive(s, block, i, s->dc_index[i], s->quant_matrixes[ s->quant_index[c] ], Al) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
return -1;
}
}
// 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);
- if(++x == h)
- {
+ if (++x == h) {
x = 0;
y++;
}
}
}
- if(s->restart_interval && !--s->restart_count)
- {
+ if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16); /* skip RSTn */
- for(i = 0; i < nb_components; i++) /* reset dc */
+ for (i=0; i<nb_components; i++) /* reset dc */
s->last_dc[i] = 1024;
}
}
@@ -956,8 +846,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
return 0;
}
-static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al)
-{
+static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al){
int mb_x, mb_y;
int EOBRUN = 0;
int c = s->comp_index[0];
@@ -966,23 +855,20 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int s
int last_scan = 0;
int16_t *quant_matrix = s->quant_matrixes[ s->quant_index[c] ];
- if(!Al)
- {
- s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss);
+ if(!Al) {
+ s->coefs_finished[c] |= (1LL<<(se+1))-(1LL<<ss);
last_scan = !~s->coefs_finished[c];
}
if(s->interlaced && s->bottom_field)
data += linesize >> 1;
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres);
+ for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
+ uint8_t *ptr = data + (mb_y*linesize*8 >> s->avctx->lowres);
int block_idx = mb_y * s->block_stride[c];
- DCTELEM(*block)[64] = &s->blocks[c][block_idx];
+ DCTELEM (*block)[64] = &s->blocks[c][block_idx];
uint8_t *last_nnz = &s->last_nnz[c][block_idx];
- for(mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++)
- {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) {
int ret;
if(Ah)
ret = decode_block_refinement(s, *block, last_nnz, s->ac_index[0],
@@ -990,13 +876,11 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int s
else
ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0],
quant_matrix, ss, se, Al, &EOBRUN);
- if(ret < 0)
- {
+ if(ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
return -1;
}
- if(last_scan)
- {
+ if(last_scan) {
s->dsp.idct_put(ptr, linesize, *block);
ptr += 8 >> s->avctx->lowres;
}
@@ -1009,38 +893,36 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s)
{
int len, nb_components, i, h, v, predictor, point_transform;
int index, id;
- const int block_size = s->lossless ? 1 : 8;
+ const int block_size= s->lossless ? 1 : 8;
int ilv, prev_shift;
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
nb_components = get_bits(&s->gb, 8);
- if(nb_components == 0 || nb_components > MAX_COMPONENTS)
- {
+ 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;
}
- if(len != 6 + 2 * nb_components)
+ if (len != 6+2*nb_components)
{
av_log(s->avctx, AV_LOG_ERROR, "decode_sos: invalid len (%d)\n", len);
return -1;
}
- for(i = 0; i < nb_components; i++)
- {
+ for(i=0;i<nb_components;i++) {
id = get_bits(&s->gb, 8) - 1;
av_log(s->avctx, AV_LOG_DEBUG, "component: %d\n", id);
/* find component index */
- for(index = 0; index < s->nb_components; index++)
- if(id == s->component_id[index])
+ for(index=0;index<s->nb_components;index++)
+ if (id == s->component_id[index])
break;
- if(index == s->nb_components)
+ if (index == s->nb_components)
{
av_log(s->avctx, AV_LOG_ERROR, "decode_sos: index(%d) out of components\n", index);
return -1;
}
/* Metasoft MJPEG codec has Cb and Cr swapped */
- if(s->avctx->codec_tag == MKTAG('M', 'T', 'S', 'J')
- && nb_components == 3 && s->nb_components == 3 && i)
+ if (s->avctx->codec_tag == MKTAG('M', 'T', 'S', 'J')
+ && nb_components == 3 && s->nb_components == 3 && i)
index = 3 - i;
s->comp_index[i] = index;
@@ -1052,29 +934,26 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s)
s->dc_index[i] = get_bits(&s->gb, 4);
s->ac_index[i] = get_bits(&s->gb, 4);
- if(s->dc_index[i] < 0 || s->ac_index[i] < 0 ||
- s->dc_index[i] >= 4 || s->ac_index[i] >= 4)
+ if (s->dc_index[i] < 0 || s->ac_index[i] < 0 ||
+ s->dc_index[i] >= 4 || s->ac_index[i] >= 4)
goto out_of_range;
- if(!s->vlcs[0][s->dc_index[i]].table || !s->vlcs[1][s->ac_index[i]].table)
+ if (!s->vlcs[0][s->dc_index[i]].table || !s->vlcs[1][s->ac_index[i]].table)
goto out_of_range;
}
- predictor = get_bits(&s->gb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */
- ilv = get_bits(&s->gb, 8); /* JPEG Se / JPEG-LS ILV */
+ predictor= get_bits(&s->gb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */
+ ilv= get_bits(&s->gb, 8); /* JPEG Se / JPEG-LS ILV */
prev_shift = get_bits(&s->gb, 4); /* Ah */
- point_transform = get_bits(&s->gb, 4); /* Al */
+ point_transform= get_bits(&s->gb, 4); /* Al */
- for(i = 0; i < nb_components; i++)
+ for(i=0;i<nb_components;i++)
s->last_dc[i] = 1024;
- if(nb_components > 1)
- {
+ if (nb_components > 1) {
/* interleaved stream */
s->mb_width = (s->width + s->h_max * block_size - 1) / (s->h_max * block_size);
s->mb_height = (s->height + s->v_max * block_size - 1) / (s->v_max * block_size);
- }
- else if(!s->ls) /* skip this for JPEG-LS */
- {
+ } else if(!s->ls) { /* skip this for JPEG-LS */
h = s->h_max / s->h_scount[0];
v = s->v_max / s->v_scount[0];
s->mb_width = (s->width + h * block_size - 1) / (h * block_size);
@@ -1091,53 +970,41 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s)
/* mjpeg-b can have padding bytes between sos and image data, skip them */
- for(i = s->mjpb_skiptosod; i > 0; i--)
+ for (i = s->mjpb_skiptosod; i > 0; i--)
skip_bits(&s->gb, 8);
- if(s->lossless)
- {
- if(CONFIG_JPEGLS_DECODER && s->ls)
- {
+ if(s->lossless){
+ if(CONFIG_JPEGLS_DECODER && s->ls){
if(ff_jpegls_decode_picture(s, predictor, point_transform, ilv) < 0)
return -1;
- }
- else
- {
- if(s->rgb)
- {
+ }else{
+ if(s->rgb){
if(ljpeg_decode_rgb_scan(s, predictor, point_transform) < 0)
return -1;
- }
- else
- {
+ }else{
if(ljpeg_decode_yuv_scan(s, predictor, point_transform) < 0)
return -1;
}
}
- }
- else
- {
- if(s->progressive && predictor)
- {
+ }else{
+ if(s->progressive && predictor) {
if(mjpeg_decode_scan_progressive_ac(s, predictor, ilv, prev_shift, point_transform) < 0)
return -1;
- }
- else
- {
+ } else {
if(mjpeg_decode_scan(s, nb_components, prev_shift, point_transform) < 0)
return -1;
}
}
emms_c();
return 0;
-out_of_range:
+ out_of_range:
av_log(s->avctx, AV_LOG_ERROR, "decode_sos: ac/dc index out of range\n");
return -1;
}
static int mjpeg_decode_dri(MJpegDecodeContext *s)
{
- if(get_bits(&s->gb, 16) != 4)
+ if (get_bits(&s->gb, 16) != 4)
return -1;
s->restart_interval = get_bits(&s->gb, 16);
s->restart_count = 0;
@@ -1151,67 +1018,66 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
int len, id, i;
len = get_bits(&s->gb, 16);
- if(len < 5)
+ if (len < 5)
return -1;
- if(8 * len + get_bits_count(&s->gb) > s->gb.size_in_bits)
+ if(8*len + get_bits_count(&s->gb) > s->gb.size_in_bits)
return -1;
id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
id = be2me_32(id);
len -= 6;
- if(s->avctx->debug & FF_DEBUG_STARTCODE)
- {
+ if(s->avctx->debug & FF_DEBUG_STARTCODE){
av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
}
/* buggy AVID, it puts EOI only at every 10th frame */
/* also this fourcc is used by non-avid files too, it holds some
informations, but it's always present in AVID creates files */
- if(id == AV_RL32("AVI1"))
+ if (id == AV_RL32("AVI1"))
{
- s->buggy_avid = 1;
+ s->buggy_avid = 1;
i = get_bits(&s->gb, 8);
- if(i == 2) s->bottom_field = 1;
- else if(i == 1) s->bottom_field = 0;
+ if (i==2) s->bottom_field= 1;
+ else if(i==1) s->bottom_field= 0;
goto out;
}
- if(id == AV_RL32("JFIF"))
+ if (id == AV_RL32("JFIF"))
{
int t_w, t_h, v1, v2;
skip_bits(&s->gb, 8); /* the trailing zero-byte */
- v1 = get_bits(&s->gb, 8);
- v2 = get_bits(&s->gb, 8);
+ v1= get_bits(&s->gb, 8);
+ v2= get_bits(&s->gb, 8);
skip_bits(&s->gb, 8);
- s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16);
- s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16);
+ s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 16);
+ s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 16);
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n",
- v1, v2,
- s->avctx->sample_aspect_ratio.num,
- s->avctx->sample_aspect_ratio.den
- );
+ v1, v2,
+ s->avctx->sample_aspect_ratio.num,
+ s->avctx->sample_aspect_ratio.den
+ );
t_w = get_bits(&s->gb, 8);
t_h = get_bits(&s->gb, 8);
- if(t_w && t_h)
+ if (t_w && t_h)
{
/* skip thumbnail */
- if(len - 10 - (t_w * t_h * 3) > 0)
- len -= t_w * t_h * 3;
+ if (len-10-(t_w*t_h*3) > 0)
+ len -= t_w*t_h*3;
}
len -= 10;
goto out;
}
- if(id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e'))
+ if (id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e'))
{
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
skip_bits(&s->gb, 16); /* version */
skip_bits(&s->gb, 16); /* flags0 */
@@ -1221,23 +1087,21 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
goto out;
}
- if(id == AV_RL32("LJIF"))
- {
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if (id == AV_RL32("LJIF")){
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
skip_bits(&s->gb, 16); /* version ? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
- switch(get_bits(&s->gb, 8))
- {
+ switch( get_bits(&s->gb, 8)){
case 1:
- s->rgb = 1;
- s->pegasus_rct = 0;
+ s->rgb= 1;
+ s->pegasus_rct=0;
break;
case 2:
- s->rgb = 1;
- s->pegasus_rct = 1;
+ s->rgb= 1;
+ s->pegasus_rct=1;
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace\n");
@@ -1247,21 +1111,21 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
}
/* Apple MJPEG-A */
- if((s->start_code == APP1) && (len > (0x28 - 8)))
+ if ((s->start_code == APP1) && (len > (0x28 - 8)))
{
id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
id = be2me_32(id);
len -= 4;
- if(id == AV_RL32("mjpg")) /* Apple MJPEG-A */
+ if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */
{
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n");
}
}
out:
/* slow but needed for extreme adobe jpegs */
- if(len < 0)
+ if (len < 0)
av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n");
while(--len > 0)
skip_bits(&s->gb, 8);
@@ -1272,15 +1136,13 @@ out:
static int mjpeg_decode_com(MJpegDecodeContext *s)
{
int len = get_bits(&s->gb, 16);
- if(len >= 2 && 8 * len - 16 + get_bits_count(&s->gb) <= s->gb.size_in_bits)
- {
+ if (len >= 2 && 8*len - 16 + get_bits_count(&s->gb) <= s->gb.size_in_bits) {
char *cbuf = av_malloc(len - 1);
- if(cbuf)
- {
+ if (cbuf) {
int i;
- for(i = 0; i < len - 2; i++)
+ for (i = 0; i < len - 2; i++)
cbuf[i] = get_bits(&s->gb, 8);
- if(i > 0 && cbuf[i-1] == '\n')
+ if (i > 0 && cbuf[i-1] == '\n')
cbuf[i-1] = 0;
else
cbuf[i] = 0;
@@ -1289,19 +1151,17 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);
/* buggy avid, it puts EOI only at every 10th frame */
- if(!strcmp(cbuf, "AVID"))
+ 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(!strcmp(cbuf, "CS=ITU601")){
+ s->cs_itu601= 1;
}
else if((len > 20 && !strncmp(cbuf, "Intel(R) JPEG Library", 21)) ||
- (len > 19 && !strncmp(cbuf, "Metasoft MJPEG Codec", 20)))
- {
+ (len > 19 && !strncmp(cbuf, "Metasoft MJPEG Codec", 20))){
s->flipped = 1;
}
@@ -1320,16 +1180,14 @@ static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
unsigned int v, v2;
int val;
#ifdef DEBUG
- int skipped = 0;
+ int skipped=0;
#endif
buf_ptr = *pbuf_ptr;
- while(buf_ptr < buf_end)
- {
+ while (buf_ptr < buf_end) {
v = *buf_ptr++;
v2 = *buf_ptr;
- if((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end)
- {
+ if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) {
val = *buf_ptr++;
goto found;
}
@@ -1345,8 +1203,8 @@ found:
}
int ff_mjpeg_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
MJpegDecodeContext *s = avctx->priv_data;
const uint8_t *buf_end, *buf_ptr;
@@ -1356,61 +1214,55 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
s->got_picture = 0; // picture from previous image can not be reused
buf_ptr = buf;
buf_end = buf + buf_size;
- while(buf_ptr < buf_end)
- {
+ while (buf_ptr < buf_end) {
/* find start next marker */
start_code = find_marker(&buf_ptr, buf_end);
{
/* EOF */
- if(start_code < 0)
- {
+ if (start_code < 0) {
goto the_end;
- }
- else
- {
+ } else {
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr);
- if((buf_end - buf_ptr) > s->buffer_size)
+ if ((buf_end - buf_ptr) > s->buffer_size)
{
av_free(s->buffer);
- s->buffer_size = buf_end - buf_ptr;
+ s->buffer_size = buf_end-buf_ptr;
s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
av_log(avctx, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
- s->buffer_size);
+ s->buffer_size);
}
/* unescape buffer of SOS, use special treatment for JPEG-LS */
- if(start_code == SOS && !s->ls)
+ if (start_code == SOS && !s->ls)
{
const uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;
- while(src < buf_end)
+ while (src<buf_end)
{
uint8_t x = *(src++);
*(dst++) = x;
//if (avctx->codec_id != CODEC_ID_THP)
- //{
- if(x == 0xff)
- {
- while(src < buf_end && x == 0xff)
- x = *(src++);
-
- if(x >= 0xd0 && x <= 0xd7)
- *(dst++) = x;
- else if(x)
- break;
- }
+ //{
+ if (x == 0xff) {
+ while (src < buf_end && x == 0xff)
+ x = *(src++);
+
+ if (x >= 0xd0 && x <= 0xd7)
+ *(dst++) = x;
+ else if (x)
+ break;
+ }
//}
}
- init_get_bits(&s->gb, s->buffer, (dst - s->buffer) * 8);
+ init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
(buf_end - buf_ptr) - (dst - s->buffer));
}
- else if(start_code == SOS && s->ls)
- {
+ else if(start_code == SOS && s->ls){
const uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;
int bit_count = 0;
@@ -1420,15 +1272,12 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
s->cur_scan++;
/* find marker */
- while(src + t < buf_end)
- {
+ while (src + t < buf_end){
uint8_t x = src[t++];
- if(x == 0xff)
- {
+ if (x == 0xff){
while((src + t < buf_end) && x == 0xff)
x = src[t++];
- if(x & 0x80)
- {
+ if (x & 0x80) {
t -= 2;
break;
}
@@ -1439,12 +1288,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
init_put_bits(&pb, dst, t);
/* unescape bitstream */
- while(b < t)
- {
+ while(b < t){
uint8_t x = src[b++];
put_bits(&pb, 8, x);
- if(x == 0xFF)
- {
+ if(x == 0xFF){
x = src[b++];
put_bits(&pb, 7, x);
bit_count--;
@@ -1455,32 +1302,25 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
init_get_bits(&s->gb, dst, bit_count);
}
else
- init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr) * 8);
+ init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8);
s->start_code = start_code;
- if(s->avctx->debug & FF_DEBUG_STARTCODE)
- {
+ if(s->avctx->debug & FF_DEBUG_STARTCODE){
av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
}
/* process markers */
- if(start_code >= 0xd0 && start_code <= 0xd7)
- {
- av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code & 0x0f);
+ if (start_code >= 0xd0 && start_code <= 0xd7) {
+ av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code&0x0f);
/* APP fields */
- }
- else if(start_code >= APP0 && start_code <= APP15)
- {
+ } else if (start_code >= APP0 && start_code <= APP15) {
mjpeg_decode_app(s);
/* Comment */
- }
- else if(start_code == COM)
- {
+ } else if (start_code == COM){
mjpeg_decode_com(s);
}
- switch(start_code)
- {
+ switch(start_code) {
case SOI:
s->restart_interval = 0;
@@ -1491,90 +1331,85 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
ff_mjpeg_decode_dqt(s);
break;
case DHT:
- if(ff_mjpeg_decode_dht(s) < 0)
- {
+ if(ff_mjpeg_decode_dht(s) < 0){
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
return -1;
}
break;
case SOF0:
case SOF1:
- s->lossless = 0;
- s->ls = 0;
- s->progressive = 0;
- if(ff_mjpeg_decode_sof(s) < 0)
+ s->lossless=0;
+ s->ls=0;
+ s->progressive=0;
+ if (ff_mjpeg_decode_sof(s) < 0)
return -1;
break;
case SOF2:
- s->lossless = 0;
- s->ls = 0;
- s->progressive = 1;
- if(ff_mjpeg_decode_sof(s) < 0)
+ s->lossless=0;
+ s->ls=0;
+ s->progressive=1;
+ if (ff_mjpeg_decode_sof(s) < 0)
return -1;
break;
case SOF3:
- s->lossless = 1;
- s->ls = 0;
- s->progressive = 0;
- if(ff_mjpeg_decode_sof(s) < 0)
+ s->lossless=1;
+ s->ls=0;
+ s->progressive=0;
+ if (ff_mjpeg_decode_sof(s) < 0)
return -1;
break;
case SOF48:
- s->lossless = 1;
- s->ls = 1;
- s->progressive = 0;
- if(ff_mjpeg_decode_sof(s) < 0)
+ s->lossless=1;
+ s->ls=1;
+ s->progressive=0;
+ if (ff_mjpeg_decode_sof(s) < 0)
return -1;
break;
case LSE:
- if(!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
+ if (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
return -1;
break;
case EOI:
s->cur_scan = 0;
- if((s->buggy_avid && !s->interlaced) || s->restart_interval)
+ if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
break;
eoi_parser:
- if(!s->got_picture)
- {
+ if (!s->got_picture) {
av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
break;
}
{
- if(s->interlaced)
- {
+ if (s->interlaced) {
s->bottom_field ^= 1;
/* if not bottom field, do not output image yet */
- if(s->bottom_field == !s->interlace_polarity)
+ if (s->bottom_field == !s->interlace_polarity)
goto not_the_end;
}
*picture = s->picture;
*data_size = sizeof(AVFrame);
- if(!s->lossless)
- {
- picture->quality = FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
- picture->qstride = 0;
- picture->qscale_table = s->qscale_table;
- memset(picture->qscale_table, picture->quality, (s->width + 15) / 16);
+ if(!s->lossless){
+ picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
+ picture->qstride= 0;
+ picture->qscale_table= s->qscale_table;
+ memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP)
av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
- picture->quality *= FF_QP2LAMBDA;
+ picture->quality*= FF_QP2LAMBDA;
}
goto the_end;
}
break;
case SOS:
- if(!s->got_picture)
- {
+ if (!s->got_picture) {
av_log(avctx, AV_LOG_WARNING, "Can not process SOS before SOF, skipping\n");
break;
}
ff_mjpeg_decode_sos(s);
/* buggy avid puts EOI every 10-20th frame */
/* if restart period is over process EOI */
- if((s->buggy_avid && !s->interlaced) || s->restart_interval)
+ if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
goto eoi_parser;
break;
case DRI:
@@ -1599,14 +1434,13 @@ eoi_parser:
not_the_end:
/* eof process start code */
- buf_ptr += (get_bits_count(&s->gb) + 7) / 8;
+ buf_ptr += (get_bits_count(&s->gb)+7)/8;
av_log(avctx, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n",
- (get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb));
+ (get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb));
}
}
}
- if(s->got_picture)
- {
+ if (s->got_picture) {
av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n");
goto eoi_parser;
}
@@ -1623,29 +1457,26 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
MJpegDecodeContext *s = avctx->priv_data;
int i, j;
- if(s->picture.data[0])
+ if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
av_free(s->buffer);
av_free(s->qscale_table);
av_freep(&s->ljpeg_buffer);
- s->ljpeg_buffer_size = 0;
+ s->ljpeg_buffer_size=0;
- for(i = 0; i < 2; i++)
- {
- for(j = 0; j < 4; j++)
+ for(i=0;i<2;i++) {
+ for(j=0;j<4;j++)
free_vlc(&s->vlcs[i][j]);
}
- for(i = 0; i < MAX_COMPONENTS; i++)
- {
+ for(i=0; i<MAX_COMPONENTS; i++) {
av_freep(&s->blocks[i]);
av_freep(&s->last_nnz[i]);
}
return 0;
}
-AVCodec mjpeg_decoder =
-{
+AVCodec mjpeg_decoder = {
"mjpeg",
CODEC_TYPE_VIDEO,
CODEC_ID_MJPEG,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.h
index 0a2f92428..b786d8e77 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegdec.h
@@ -35,8 +35,7 @@
#define MAX_COMPONENTS 4
-typedef struct MJpegDecodeContext
-{
+typedef struct MJpegDecodeContext {
AVCodecContext *avctx;
GetBitContext gb;
@@ -62,7 +61,7 @@ typedef struct MJpegDecodeContext
int maxval;
int near; ///< near lossless bound (si 0 for lossless)
- int t1, t2, t3;
+ int t1,t2,t3;
int reset; ///< context halfing intervall ?rename
int width, height;
@@ -86,7 +85,7 @@ typedef struct MJpegDecodeContext
int linesize[MAX_COMPONENTS]; ///< linesize << interlaced
int8_t *qscale_table;
DECLARE_ALIGNED_16(DCTELEM, block)[64];
- DCTELEM(*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode)
+ DCTELEM (*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode)
uint8_t *last_nnz[MAX_COMPONENTS];
uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
ScanTable scantable;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegenc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegenc.h
index 0d6cfca90..15cefa9db 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegenc.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mjpegenc.h
@@ -36,8 +36,7 @@
#include "dsputil.h"
#include "mpegvideo.h"
-typedef struct MJpegContext
-{
+typedef struct MJpegContext {
uint8_t huff_size_dc_luminance[12]; //FIXME use array [3] instead of lumi / chrom, for easier addressing
uint16_t huff_code_dc_luminance[12];
uint8_t huff_size_dc_chrominance[12];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.c
index db506853e..87f7c7713 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.c
@@ -25,8 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "mlp.h"
-const uint8_t ff_mlp_huffman_tables[3][18][2] =
-{
+const uint8_t ff_mlp_huffman_tables[3][18][2] = {
{ /* Huffman table 0, -7 - +10 */
{0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
{0x04, 3}, {0x05, 3}, {0x06, 3}, {0x07, 3},
@@ -54,8 +53,7 @@ static AVCRC crc_2D[CRC_TABLE_SIZE];
av_cold void ff_mlp_init_crc(void)
{
- if(!crc_init)
- {
+ if (!crc_init) {
av_crc_init(crc_63, 0, 8, 0x63, sizeof(crc_63));
av_crc_init(crc_1D, 0, 8, 0x1D, sizeof(crc_1D));
av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
@@ -88,10 +86,9 @@ uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size)
crc = av_crc(crc_1D, crc, buf + 1, num_bytes - 2);
crc ^= buf[num_bytes - 1];
- for(i = 0; i < ((bit_size + 2) & 7); i++)
- {
+ for (i = 0; i < ((bit_size + 2) & 7); i++) {
crc <<= 1;
- if(crc & 0x100)
+ if (crc & 0x100)
crc ^= 0x11D;
crc ^= (buf[num_bytes] >> (7 - i)) & 1;
}
@@ -104,14 +101,14 @@ uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size)
uint32_t scratch = 0;
const uint8_t *buf_end = buf + buf_size;
- for(; ((intptr_t) buf & 3) && buf < buf_end; buf++)
+ for (; ((intptr_t) buf & 3) && buf < buf_end; buf++)
scratch ^= *buf;
- for(; buf < buf_end - 3; buf += 4)
+ for (; buf < buf_end - 3; buf += 4)
scratch ^= *((const uint32_t*)buf);
scratch = xor_32_to_8(scratch);
- for(; buf < buf_end; buf++)
+ for (; buf < buf_end; buf++)
scratch ^= *buf;
return scratch;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.h
index 247e3ed4e..628b58d31 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp.h
@@ -71,8 +71,7 @@
#define IIR 1
/** filter data */
-typedef struct
-{
+typedef struct {
uint8_t order; ///< number of taps in filter
uint8_t shift; ///< Right shift to apply to output of filter.
@@ -80,8 +79,7 @@ typedef struct
} FilterParams;
/** sample data coding information */
-typedef struct
-{
+typedef struct {
FilterParams filter_params[NUM_FILTERS];
int32_t coeff[NUM_FILTERS][MAX_FIR_ORDER];
@@ -103,7 +101,7 @@ extern const uint8_t ff_mlp_huffman_tables[3][18][2];
* We can implement this behavior using a standard av_crc on all but the
* last element, then XOR that with the last element.
*/
-uint8_t ff_mlp_checksum8(const uint8_t *buf, unsigned int buf_size);
+uint8_t ff_mlp_checksum8 (const uint8_t *buf, unsigned int buf_size);
uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size);
/** Calculate an 8-bit checksum over a restart header -- a non-multiple-of-8
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp_parser.c
index 06a5ece19..34c1850fe 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlp_parser.c
@@ -32,27 +32,24 @@
#include "mlp_parser.h"
#include "mlp.h"
-static const uint8_t mlp_quants[16] =
-{
+static const uint8_t mlp_quants[16] = {
16, 20, 24, 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 mlp_channels[32] =
-{
+static const uint8_t mlp_channels[32] = {
1, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 4, 5, 4,
5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-static const uint8_t thd_chancount[13] =
-{
+static const uint8_t thd_chancount[13] = {
// LR C LFE LRs LRvh LRc LRrs Cs Ts LRsd LRw Cvh LFE2
- 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1
+ 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1
};
static int mlp_samplerate(int in)
{
- if(in == 0xF)
+ if (in == 0xF)
return 0;
return (in & 8 ? 44100 : 48000) << (in & 7) ;
@@ -62,7 +59,7 @@ static int truehd_channels(int chanmap)
{
int channels = 0, i;
- for(i = 0; i < 13; i++)
+ for (i = 0; i < 13; i++)
channels += thd_chancount[i] * ((chanmap >> i) & 1);
return channels;
@@ -81,8 +78,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
assert(get_bits_count(gb) == 0);
- if(gb->size_in_bits < 28 << 3)
- {
+ if (gb->size_in_bits < 28 << 3) {
av_log(log, AV_LOG_ERROR, "packet too short, unable to read major sync\n");
return -1;
}
@@ -95,13 +91,12 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
}
*/
- if(get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
+ if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
return -1;
mh->stream_type = get_bits(gb, 8);
- if(mh->stream_type == 0xbb)
- {
+ if (mh->stream_type == 0xbb) {
mh->group1_bits = mlp_quants[get_bits(gb, 4)];
mh->group2_bits = mlp_quants[get_bits(gb, 4)];
@@ -112,9 +107,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
skip_bits(gb, 11);
mh->channels_mlp = get_bits(gb, 5);
- }
- else if(mh->stream_type == 0xba)
- {
+ } else if (mh->stream_type == 0xba) {
mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
mh->group2_bits = 0;
@@ -129,8 +122,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
skip_bits(gb, 2);
mh->channels_thd_stream2 = get_bits(gb, 13);
- }
- else
+ } else
return -1;
mh->access_unit_size = 40 << (ratebits & 7);
@@ -178,28 +170,24 @@ static int mlp_parse(AVCodecParserContext *s,
int i, p = 0;
*poutbuf_size = 0;
- if(buf_size == 0)
+ if (buf_size == 0)
return 0;
- if(!mp->in_sync)
- {
+ if (!mp->in_sync) {
// Not in sync - find a major sync header
- for(i = 0; i < buf_size; i++)
- {
+ for (i = 0; i < buf_size; i++) {
mp->pc.state = (mp->pc.state << 8) | buf[i];
- if((mp->pc.state & 0xfffffffe) == 0xf8726fba &&
- // ignore if we do not have the data for the start of header
- mp->pc.index + i >= 7)
- {
+ if ((mp->pc.state & 0xfffffffe) == 0xf8726fba &&
+ // ignore if we do not have the data for the start of header
+ mp->pc.index + i >= 7) {
mp->in_sync = 1;
mp->bytes_left = 0;
break;
}
}
- if(!mp->in_sync)
- {
+ if (!mp->in_sync) {
ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
return buf_size;
}
@@ -209,32 +197,28 @@ static int mlp_parse(AVCodecParserContext *s,
return i - 7;
}
- if(mp->bytes_left == 0)
- {
+ if (mp->bytes_left == 0) {
// Find length of this packet
/* Copy overread bytes from last frame into buffer. */
- for(; mp->pc.overread > 0; mp->pc.overread--)
- {
- mp->pc.buffer[mp->pc.index++] = mp->pc.buffer[mp->pc.overread_index++];
+ for(; mp->pc.overread>0; mp->pc.overread--) {
+ mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++];
}
- if(mp->pc.index + buf_size < 2)
- {
+ if (mp->pc.index + buf_size < 2) {
ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
return buf_size;
}
mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8)
- | (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]);
+ | (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]);
mp->bytes_left = (mp->bytes_left & 0xfff) * 2;
mp->bytes_left -= mp->pc.index;
}
next = (mp->bytes_left > buf_size) ? END_NOT_FOUND : mp->bytes_left;
- if(ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0)
- {
+ if (ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0) {
mp->bytes_left -= buf_size;
return buf_size;
}
@@ -243,20 +227,17 @@ static int mlp_parse(AVCodecParserContext *s,
sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba;
- if(!sync_present)
- {
+ if (!sync_present) {
/* The first nibble of a frame is a parity check of the 4-byte
* access unit header and all the 2- or 4-byte substream headers. */
// Only check when this isn't a sync frame - syncs have a checksum.
parity_bits = 0;
- for(i = -1; i < mp->num_substreams; i++)
- {
+ for (i = -1; i < mp->num_substreams; i++) {
parity_bits ^= buf[p++];
parity_bits ^= buf[p++];
- if(i < 0 || buf[p-2] & 0x80)
- {
+ if (i < 0 || buf[p-2] & 0x80) {
parity_bits ^= buf[p++];
parity_bits ^= buf[p++];
}
@@ -268,39 +249,34 @@ static int mlp_parse(AVCodecParserContext *s,
goto lost_sync;
}
*/
- }
- else
- {
+ } else {
GetBitContext gb;
MLPHeaderInfo mh;
init_get_bits(&gb, buf + 4, (buf_size - 4) << 3);
- if(ff_mlp_read_major_sync(avctx, &mh, &gb) < 0)
+ if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0)
goto lost_sync;
avctx->bits_per_raw_sample = mh.group1_bits;
- if(avctx->bits_per_raw_sample > 16)
+ if (avctx->bits_per_raw_sample > 16)
avctx->sample_fmt = SAMPLE_FMT_S32;
else
avctx->sample_fmt = SAMPLE_FMT_S16;
avctx->sample_rate = mh.group1_samplerate;
avctx->frame_size = mh.access_unit_size;
- if(mh.stream_type == 0xbb)
- {
+ if (mh.stream_type == 0xbb) {
/* MLP stream */
avctx->channels = mlp_channels[mh.channels_mlp];
- }
- else /* mh.stream_type == 0xba */
- {
+ } else { /* mh.stream_type == 0xba */
/* TrueHD stream */
- if(mh.channels_thd_stream2)
+ if (mh.channels_thd_stream2)
avctx->channels = truehd_channels(mh.channels_thd_stream2);
else
avctx->channels = truehd_channels(mh.channels_thd_stream1);
}
- if(!mh.is_vbr) /* Stream is CBR */
+ if (!mh.is_vbr) /* Stream is CBR */
avctx->bit_rate = mh.peak_bitrate;
mp->num_substreams = mh.num_substreams;
@@ -316,8 +292,7 @@ lost_sync:
return 1;
}
-AVCodecParser mlp_parser =
-{
+AVCodecParser mlp_parser = {
{ CODEC_ID_MLP, CODEC_ID_TRUEHD },
sizeof(MLPParseContext),
mlp_init,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdec.c
index ac41e5441..a5ba3d0b6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdec.c
@@ -44,8 +44,7 @@ static const char* sample_message =
"http://ffmpeg.org/bugreports.html and include "
"a sample of this file.";
-typedef struct SubStream
-{
+typedef struct SubStream {
//! Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
uint8_t restart_seen;
@@ -116,8 +115,7 @@ typedef struct SubStream
} SubStream;
-typedef struct MLPDecodeContext
-{
+typedef struct MLPDecodeContext {
AVCodecContext *avctx;
//! Current access unit being read has a major sync.
@@ -157,24 +155,23 @@ static VLC huff_vlc[3];
static av_cold void init_static(void)
{
- if(!huff_vlc[0].bits)
- {
+ if (!huff_vlc[0].bits) {
INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18,
- &ff_mlp_huffman_tables[0][0][1], 2, 1,
- &ff_mlp_huffman_tables[0][0][0], 2, 1, 512);
+ &ff_mlp_huffman_tables[0][0][1], 2, 1,
+ &ff_mlp_huffman_tables[0][0][0], 2, 1, 512);
INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16,
- &ff_mlp_huffman_tables[1][0][1], 2, 1,
- &ff_mlp_huffman_tables[1][0][0], 2, 1, 512);
+ &ff_mlp_huffman_tables[1][0][1], 2, 1,
+ &ff_mlp_huffman_tables[1][0][0], 2, 1, 512);
INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15,
- &ff_mlp_huffman_tables[2][0][1], 2, 1,
- &ff_mlp_huffman_tables[2][0][0], 2, 1, 512);
+ &ff_mlp_huffman_tables[2][0][1], 2, 1,
+ &ff_mlp_huffman_tables[2][0][0], 2, 1, 512);
}
ff_mlp_init_crc();
}
static inline int32_t calculate_sign_huff(MLPDecodeContext *m,
- unsigned int substr, unsigned int ch)
+ unsigned int substr, unsigned int ch)
{
ChannelParams *cp = &m->channel_params[ch];
SubStream *s = &m->substream[substr];
@@ -182,10 +179,10 @@ static inline int32_t calculate_sign_huff(MLPDecodeContext *m,
int sign_shift = lsb_bits + (cp->codebook ? 2 - cp->codebook : -1);
int32_t sign_huff_offset = cp->huff_offset;
- if(cp->codebook > 0)
+ if (cp->codebook > 0)
sign_huff_offset -= 7 << lsb_bits;
- if(sign_shift >= 0)
+ if (sign_shift >= 0)
sign_huff_offset -= 1 << sign_shift;
return sign_huff_offset;
@@ -200,26 +197,25 @@ static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
SubStream *s = &m->substream[substr];
unsigned int mat, channel;
- for(mat = 0; mat < s->num_primitive_matrices; mat++)
- if(s->lsb_bypass[mat])
+ for (mat = 0; mat < s->num_primitive_matrices; mat++)
+ if (s->lsb_bypass[mat])
m->bypassed_lsbs[pos + s->blockpos][mat] = get_bits1(gbp);
- for(channel = s->min_channel; channel <= s->max_channel; channel++)
- {
+ for (channel = s->min_channel; channel <= s->max_channel; channel++) {
ChannelParams *cp = &m->channel_params[channel];
int codebook = cp->codebook;
int quant_step_size = s->quant_step_size[channel];
int lsb_bits = cp->huff_lsbs - quant_step_size;
int result = 0;
- if(codebook > 0)
+ if (codebook > 0)
result = get_vlc2(gbp, huff_vlc[codebook-1].table,
- VLC_BITS, (9 + VLC_BITS - 1) / VLC_BITS);
+ VLC_BITS, (9 + VLC_BITS - 1) / VLC_BITS);
- if(result < 0)
+ if (result < 0)
return -1;
- if(lsb_bits > 0)
+ if (lsb_bits > 0)
result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
result += cp->sign_huff_offset;
@@ -238,7 +234,7 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx)
init_static();
m->avctx = avctx;
- for(substr = 0; substr < MAX_SUBSTREAMS; substr++)
+ for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
m->substream[substr].lossless_check_data = 0xffffffff;
dsputil_init(&m->dsp, avctx);
@@ -255,64 +251,55 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
MLPHeaderInfo mh;
int substr;
- if(ff_mlp_read_major_sync(m->avctx, &mh, gb) != 0)
+ if (ff_mlp_read_major_sync(m->avctx, &mh, gb) != 0)
return -1;
- if(mh.group1_bits == 0)
- {
+ if (mh.group1_bits == 0) {
av_log(m->avctx, AV_LOG_ERROR, "invalid/unknown bits per sample\n");
return -1;
}
- if(mh.group2_bits > mh.group1_bits)
- {
+ if (mh.group2_bits > mh.group1_bits) {
av_log(m->avctx, AV_LOG_ERROR,
"Channel group 2 cannot have more bits per sample than group 1.\n");
return -1;
}
- if(mh.group2_samplerate && mh.group2_samplerate != mh.group1_samplerate)
- {
+ if (mh.group2_samplerate && mh.group2_samplerate != mh.group1_samplerate) {
av_log(m->avctx, AV_LOG_ERROR,
"Channel groups with differing sample rates are not currently supported.\n");
return -1;
}
- if(mh.group1_samplerate == 0)
- {
+ if (mh.group1_samplerate == 0) {
av_log(m->avctx, AV_LOG_ERROR, "invalid/unknown sampling rate\n");
return -1;
}
- if(mh.group1_samplerate > MAX_SAMPLERATE)
- {
+ if (mh.group1_samplerate > MAX_SAMPLERATE) {
av_log(m->avctx, AV_LOG_ERROR,
"Sampling rate %d is greater than the supported maximum (%d).\n",
mh.group1_samplerate, MAX_SAMPLERATE);
return -1;
}
- if(mh.access_unit_size > MAX_BLOCKSIZE)
- {
+ if (mh.access_unit_size > MAX_BLOCKSIZE) {
av_log(m->avctx, AV_LOG_ERROR,
"Block size %d is greater than the supported maximum (%d).\n",
mh.access_unit_size, MAX_BLOCKSIZE);
return -1;
}
- if(mh.access_unit_size_pow2 > MAX_BLOCKSIZE_POW2)
- {
+ if (mh.access_unit_size_pow2 > MAX_BLOCKSIZE_POW2) {
av_log(m->avctx, AV_LOG_ERROR,
"Block size pow2 %d is greater than the supported maximum (%d).\n",
mh.access_unit_size_pow2, MAX_BLOCKSIZE_POW2);
return -1;
}
- if(mh.num_substreams == 0)
+ if (mh.num_substreams == 0)
return -1;
- if(m->avctx->codec_id == CODEC_ID_MLP && mh.num_substreams > 2)
- {
+ if (m->avctx->codec_id == CODEC_ID_MLP && mh.num_substreams > 2) {
av_log(m->avctx, AV_LOG_ERROR, "MLP only supports up to 2 substreams.\n");
return -1;
}
- if(mh.num_substreams > MAX_SUBSTREAMS)
- {
+ if (mh.num_substreams > MAX_SUBSTREAMS) {
av_log(m->avctx, AV_LOG_ERROR,
"Number of substreams %d is larger than the maximum supported "
"by the decoder. %s\n", mh.num_substreams, sample_message);
@@ -329,13 +316,13 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m->avctx->frame_size = mh.access_unit_size;
m->avctx->bits_per_raw_sample = mh.group1_bits;
- if(mh.group1_bits > 16)
+ if (mh.group1_bits > 16)
m->avctx->sample_fmt = SAMPLE_FMT_S32;
else
m->avctx->sample_fmt = SAMPLE_FMT_S16;
m->params_valid = 1;
- for(substr = 0; substr < MAX_SUBSTREAMS; substr++)
+ for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
m->substream[substr].restart_seen = 0;
return 0;
@@ -355,13 +342,12 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
uint8_t lossless_check;
int start_count = get_bits_count(gbp);
const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP
- ? MAX_MATRIX_CHANNEL_MLP
- : MAX_MATRIX_CHANNEL_TRUEHD;
+ ? MAX_MATRIX_CHANNEL_MLP
+ : MAX_MATRIX_CHANNEL_TRUEHD;
sync_word = get_bits(gbp, 13);
- if(sync_word != 0x31ea >> 1)
- {
+ if (sync_word != 0x31ea >> 1) {
av_log(m->avctx, AV_LOG_ERROR,
"restart header sync incorrect (got 0x%04x)\n", sync_word);
return -1;
@@ -369,8 +355,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 == CODEC_ID_MLP && s->noise_type) {
av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n");
return -1;
}
@@ -381,16 +366,14 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
s->max_channel = get_bits(gbp, 4);
s->max_matrix_channel = get_bits(gbp, 4);
- if(s->max_matrix_channel > max_matrix_channel)
- {
+ if (s->max_matrix_channel > max_matrix_channel) {
av_log(m->avctx, AV_LOG_ERROR,
"Max matrix channel cannot be greater than %d.\n",
max_matrix_channel);
return -1;
}
- if(s->max_channel != s->max_matrix_channel)
- {
+ if (s->max_channel != s->max_matrix_channel) {
av_log(m->avctx, AV_LOG_ERROR,
"Max channel must be equal max matrix channel.\n");
return -1;
@@ -398,25 +381,22 @@ 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)
- {
+ if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {
av_log(m->avctx, AV_LOG_ERROR,
"Number of channels %d is larger than the maximum supported "
- "by the decoder. %s\n", s->max_channel + 2, sample_message);
+ "by the decoder. %s\n", s->max_channel+2, sample_message);
return -1;
}
- if(s->min_channel > s->max_channel)
- {
+ if (s->min_channel > s->max_channel) {
av_log(m->avctx, AV_LOG_ERROR,
"Substream min channel cannot be greater than max channel.\n");
return -1;
}
- if(m->avctx->request_channels > 0
- && s->max_channel + 1 >= m->avctx->request_channels
- && substr < m->max_decoded_substream)
- {
+ if (m->avctx->request_channels > 0
+ && s->max_channel + 1 >= m->avctx->request_channels
+ && substr < m->max_decoded_substream) {
av_log(m->avctx, AV_LOG_INFO,
"Extracting %d channel downmix from substream %d. "
"Further substreams will be skipped.\n",
@@ -431,11 +411,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
s->data_check_present = get_bits1(gbp);
lossless_check = get_bits(gbp, 8);
- if(substr == m->max_decoded_substream
- && s->lossless_check_data != 0xffffffff)
- {
+ if (substr == m->max_decoded_substream
+ && s->lossless_check_data != 0xffffffff) {
tmp = xor_32_to_8(s->lossless_check_data);
- if(tmp != lossless_check)
+ if (tmp != lossless_check)
av_log(m->avctx, AV_LOG_WARNING,
"Lossless check failed - expected %02x, calculated %02x.\n",
lossless_check, tmp);
@@ -445,11 +424,9 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
memset(s->ch_assign, 0, sizeof(s->ch_assign));
- for(ch = 0; ch <= s->max_matrix_channel; ch++)
- {
+ for (ch = 0; ch <= s->max_matrix_channel; ch++) {
int ch_assign = get_bits(gbp, 6);
- if(ch_assign > s->max_matrix_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);
@@ -460,7 +437,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count);
- if(checksum != get_bits(gbp, 8))
+ if (checksum != get_bits(gbp, 8))
av_log(m->avctx, AV_LOG_ERROR, "restart header checksum error\n");
/* Set default decoding parameters. */
@@ -469,11 +446,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
s->blocksize = 8;
s->lossless_check_data = 0;
- memset(s->output_shift , 0, sizeof(s->output_shift));
+ memset(s->output_shift , 0, sizeof(s->output_shift ));
memset(s->quant_step_size, 0, sizeof(s->quant_step_size));
- for(ch = s->min_channel; ch <= s->max_channel; ch++)
- {
+ for (ch = s->min_channel; ch <= s->max_channel; ch++) {
ChannelParams *cp = &m->channel_params[ch];
cp->filter_params[FIR].order = 0;
cp->filter_params[IIR].order = 0;
@@ -487,7 +463,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
cp->huff_lsbs = 24;
}
- if(substr == m->max_decoded_substream)
+ if (substr == m->max_decoded_substream)
m->avctx->channels = s->max_matrix_channel + 1;
return 0;
@@ -506,15 +482,13 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
// Filter is 0 for FIR, 1 for IIR.
assert(filter < 2);
- if(m->filter_changed[channel][filter]++ > 1)
- {
+ if (m->filter_changed[channel][filter]++ > 1) {
av_log(m->avctx, AV_LOG_ERROR, "Filters may change only once per access unit.\n");
return -1;
}
order = get_bits(gbp, 4);
- if(order > max_order)
- {
+ if (order > max_order) {
av_log(m->avctx, AV_LOG_ERROR,
"%cIR filter order %d is greater than maximum %d.\n",
fchar, order, max_order);
@@ -522,8 +496,7 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
}
fp->order = order;
- if(order > 0)
- {
+ if (order > 0) {
int32_t *fcoeff = m->channel_params[channel].coeff[filter];
int coeff_bits, coeff_shift;
@@ -531,30 +504,26 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
coeff_bits = get_bits(gbp, 5);
coeff_shift = get_bits(gbp, 3);
- if(coeff_bits < 1 || coeff_bits > 16)
- {
+ if (coeff_bits < 1 || coeff_bits > 16) {
av_log(m->avctx, AV_LOG_ERROR,
"%cIR filter coeff_bits must be between 1 and 16.\n",
fchar);
return -1;
}
- if(coeff_bits + coeff_shift > 16)
- {
+ if (coeff_bits + coeff_shift > 16) {
av_log(m->avctx, AV_LOG_ERROR,
"Sum of coeff_bits and coeff_shift for %cIR filter must be 16 or less.\n",
fchar);
return -1;
}
- for(i = 0; i < order; i++)
+ for (i = 0; i < order; i++)
fcoeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift;
- if(get_bits1(gbp))
- {
+ if (get_bits1(gbp)) {
int state_bits, state_shift;
- if(filter == FIR)
- {
+ if (filter == FIR) {
av_log(m->avctx, AV_LOG_ERROR,
"FIR filter has state data specified.\n");
return -1;
@@ -565,7 +534,7 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
/* TODO: Check validity of state data. */
- for(i = 0; i < order; i++)
+ for (i = 0; i < order; i++)
fp->state[i] = get_sbits(gbp, state_bits) << state_shift;
}
}
@@ -580,60 +549,54 @@ 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
- ? MAX_MATRICES_MLP
- : MAX_MATRICES_TRUEHD;
+ ? MAX_MATRICES_MLP
+ : MAX_MATRICES_TRUEHD;
- if(m->matrix_changed++ > 1)
- {
+ if (m->matrix_changed++ > 1) {
av_log(m->avctx, AV_LOG_ERROR, "Matrices may change only once per access unit.\n");
return -1;
}
s->num_primitive_matrices = get_bits(gbp, 4);
- if(s->num_primitive_matrices > max_primitive_matrices)
- {
+ if (s->num_primitive_matrices > max_primitive_matrices) {
av_log(m->avctx, AV_LOG_ERROR,
"Number of primitive matrices cannot be greater than %d.\n",
max_primitive_matrices);
return -1;
}
- for(mat = 0; mat < s->num_primitive_matrices; mat++)
- {
+ for (mat = 0; mat < s->num_primitive_matrices; mat++) {
int frac_bits, max_chan;
s->matrix_out_ch[mat] = get_bits(gbp, 4);
frac_bits = get_bits(gbp, 4);
s->lsb_bypass [mat] = get_bits1(gbp);
- if(s->matrix_out_ch[mat] > s->max_matrix_channel)
- {
+ if (s->matrix_out_ch[mat] > s->max_matrix_channel) {
av_log(m->avctx, AV_LOG_ERROR,
- "Invalid channel %d specified as output from matrix.\n",
- s->matrix_out_ch[mat]);
+ "Invalid channel %d specified as output from matrix.\n",
+ s->matrix_out_ch[mat]);
return -1;
}
- if(frac_bits > 14)
- {
+ if (frac_bits > 14) {
av_log(m->avctx, AV_LOG_ERROR,
- "Too many fractional bits specified.\n");
+ "Too many fractional bits specified.\n");
return -1;
}
max_chan = s->max_matrix_channel;
- if(!s->noise_type)
- max_chan += 2;
+ if (!s->noise_type)
+ max_chan+=2;
- for(ch = 0; ch <= max_chan; ch++)
- {
+ for (ch = 0; ch <= max_chan; ch++) {
int coeff_val = 0;
- if(get_bits1(gbp))
+ if (get_bits1(gbp))
coeff_val = get_sbits(gbp, frac_bits + 2);
s->matrix_coeff[mat][ch] = coeff_val << (14 - frac_bits);
}
- if(s->noise_type)
+ if (s->noise_type)
s->matrix_noise_shift[mat] = get_bits(gbp, 4);
else
s->matrix_noise_shift[mat] = 0;
@@ -652,27 +615,25 @@ static int read_channel_params(MLPDecodeContext *m, unsigned int substr,
FilterParams *iir = &cp->filter_params[IIR];
SubStream *s = &m->substream[substr];
- if(s->param_presence_flags & PARAM_FIR)
- if(get_bits1(gbp))
- if(read_filter_params(m, gbp, ch, FIR) < 0)
+ if (s->param_presence_flags & PARAM_FIR)
+ if (get_bits1(gbp))
+ if (read_filter_params(m, gbp, ch, FIR) < 0)
return -1;
- if(s->param_presence_flags & PARAM_IIR)
- if(get_bits1(gbp))
- if(read_filter_params(m, gbp, ch, IIR) < 0)
+ if (s->param_presence_flags & PARAM_IIR)
+ if (get_bits1(gbp))
+ if (read_filter_params(m, gbp, ch, IIR) < 0)
return -1;
- if(fir->order + iir->order > 8)
- {
+ if (fir->order + iir->order > 8) {
av_log(m->avctx, AV_LOG_ERROR, "Total filter orders too high.\n");
return -1;
}
- if(fir->order && iir->order &&
- fir->shift != iir->shift)
- {
+ if (fir->order && iir->order &&
+ fir->shift != iir->shift) {
av_log(m->avctx, AV_LOG_ERROR,
- "FIR and IIR filters must use the same precision.\n");
+ "FIR and IIR filters must use the same precision.\n");
return -1;
}
/* The FIR and IIR filters must have the same precision.
@@ -680,18 +641,17 @@ static int read_channel_params(MLPDecodeContext *m, unsigned int substr,
* FIR filter is considered. If only the IIR filter is employed,
* the FIR filter precision is set to that of the IIR filter, so
* that the filtering code can use it. */
- if(!fir->order && iir->order)
+ if (!fir->order && iir->order)
fir->shift = iir->shift;
- if(s->param_presence_flags & PARAM_HUFFOFFSET)
- if(get_bits1(gbp))
+ if (s->param_presence_flags & PARAM_HUFFOFFSET)
+ if (get_bits1(gbp))
cp->huff_offset = get_sbits(gbp, 15);
cp->codebook = get_bits(gbp, 2);
cp->huff_lsbs = get_bits(gbp, 5);
- if(cp->huff_lsbs > 24)
- {
+ if (cp->huff_lsbs > 24) {
av_log(m->avctx, AV_LOG_ERROR, "Invalid huff_lsbs.\n");
return -1;
}
@@ -710,36 +670,33 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
SubStream *s = &m->substream[substr];
unsigned int ch;
- if(s->param_presence_flags & PARAM_PRESENCE)
- if(get_bits1(gbp))
+ if (s->param_presence_flags & PARAM_PRESENCE)
+ if (get_bits1(gbp))
s->param_presence_flags = get_bits(gbp, 8);
- if(s->param_presence_flags & PARAM_BLOCKSIZE)
- if(get_bits1(gbp))
- {
+ if (s->param_presence_flags & PARAM_BLOCKSIZE)
+ if (get_bits1(gbp)) {
s->blocksize = get_bits(gbp, 9);
- if(s->blocksize < 8 || s->blocksize > m->access_unit_size)
- {
+ if (s->blocksize < 8 || s->blocksize > m->access_unit_size) {
av_log(m->avctx, AV_LOG_ERROR, "Invalid blocksize.");
s->blocksize = 0;
return -1;
}
}
- if(s->param_presence_flags & PARAM_MATRIX)
- if(get_bits1(gbp))
- if(read_matrix_params(m, substr, gbp) < 0)
+ if (s->param_presence_flags & PARAM_MATRIX)
+ if (get_bits1(gbp))
+ if (read_matrix_params(m, substr, gbp) < 0)
return -1;
- if(s->param_presence_flags & PARAM_OUTSHIFT)
- if(get_bits1(gbp))
- for(ch = 0; ch <= s->max_matrix_channel; ch++)
+ if (s->param_presence_flags & PARAM_OUTSHIFT)
+ if (get_bits1(gbp))
+ for (ch = 0; ch <= s->max_matrix_channel; ch++)
s->output_shift[ch] = get_sbits(gbp, 4);
- if(s->param_presence_flags & PARAM_QUANTSTEP)
- if(get_bits1(gbp))
- for(ch = 0; ch <= s->max_channel; ch++)
- {
+ if (s->param_presence_flags & PARAM_QUANTSTEP)
+ if (get_bits1(gbp))
+ for (ch = 0; ch <= s->max_channel; ch++) {
ChannelParams *cp = &m->channel_params[ch];
s->quant_step_size[ch] = get_bits(gbp, 4);
@@ -747,9 +704,9 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
cp->sign_huff_offset = calculate_sign_huff(m, substr, ch);
}
- for(ch = s->min_channel; ch <= s->max_channel; ch++)
- if(get_bits1(gbp))
- if(read_channel_params(m, substr, gbp, ch) < 0)
+ for (ch = s->min_channel; ch <= s->max_channel; ch++)
+ if (get_bits1(gbp))
+ if (read_channel_params(m, substr, gbp, ch) < 0)
return -1;
return 0;
@@ -793,16 +750,14 @@ static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp,
SubStream *s = &m->substream[substr];
unsigned int i, ch, expected_stream_pos = 0;
- if(s->data_check_present)
- {
+ 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);
}
- if(s->blockpos + s->blocksize > m->access_unit_size)
- {
+ if (s->blockpos + s->blocksize > m->access_unit_size) {
av_log(m->avctx, AV_LOG_ERROR, "too many audio samples in frame\n");
return -1;
}
@@ -810,18 +765,17 @@ static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp,
memset(&m->bypassed_lsbs[s->blockpos][0], 0,
s->blocksize * sizeof(m->bypassed_lsbs[0]));
- for(i = 0; i < s->blocksize; i++)
- if(read_huff_channels(m, gbp, substr, i) < 0)
+ for (i = 0; i < s->blocksize; i++)
+ if (read_huff_channels(m, gbp, substr, i) < 0)
return -1;
- for(ch = s->min_channel; ch <= s->max_channel; ch++)
+ for (ch = s->min_channel; ch <= s->max_channel; ch++)
filter_channel(m, substr, ch);
s->blockpos += s->blocksize;
- if(s->data_check_present)
- {
- if(get_bits_count(gbp) != expected_stream_pos)
+ if (s->data_check_present) {
+ if (get_bits_count(gbp) != expected_stream_pos)
av_log(m->avctx, AV_LOG_ERROR, "block data length mismatch\n");
skip_bits(gbp, 8);
}
@@ -831,23 +785,22 @@ static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp,
/** Data table used for TrueHD noise generation function. */
-static const int8_t noise_table[256] =
-{
- 30, 51, 22, 54, 3, 7, -4, 38, 14, 55, 46, 81, 22, 58, -3, 2,
- 52, 31, -7, 51, 15, 44, 74, 30, 85, -17, 10, 33, 18, 80, 28, 62,
- 10, 32, 23, 69, 72, 26, 35, 17, 73, 60, 8, 56, 2, 6, -2, -5,
- 51, 4, 11, 50, 66, 76, 21, 44, 33, 47, 1, 26, 64, 48, 57, 40,
- 38, 16, -10, -28, 92, 22, -18, 29, -10, 5, -13, 49, 19, 24, 70, 34,
- 61, 48, 30, 14, -6, 25, 58, 33, 42, 60, 67, 17, 54, 17, 22, 30,
- 67, 44, -9, 50, -11, 43, 40, 32, 59, 82, 13, 49, -14, 55, 60, 36,
- 48, 49, 31, 47, 15, 12, 4, 65, 1, 23, 29, 39, 45, -2, 84, 69,
- 0, 72, 37, 57, 27, 41, -15, -16, 35, 31, 14, 61, 24, 0, 27, 24,
- 16, 41, 55, 34, 53, 9, 56, 12, 25, 29, 53, 5, 20, -20, -8, 20,
- 13, 28, -3, 78, 38, 16, 11, 62, 46, 29, 21, 24, 46, 65, 43, -23,
- 89, 18, 74, 21, 38, -12, 19, 12, -19, 8, 15, 33, 4, 57, 9, -8,
- 36, 35, 26, 28, 7, 83, 63, 79, 75, 11, 3, 87, 37, 47, 34, 40,
- 39, 19, 20, 42, 27, 34, 39, 77, 13, 42, 59, 64, 45, -1, 32, 37,
- 45, -5, 53, -6, 7, 36, 50, 23, 6, 32, 9, -21, 18, 71, 27, 52,
+static const int8_t noise_table[256] = {
+ 30, 51, 22, 54, 3, 7, -4, 38, 14, 55, 46, 81, 22, 58, -3, 2,
+ 52, 31, -7, 51, 15, 44, 74, 30, 85, -17, 10, 33, 18, 80, 28, 62,
+ 10, 32, 23, 69, 72, 26, 35, 17, 73, 60, 8, 56, 2, 6, -2, -5,
+ 51, 4, 11, 50, 66, 76, 21, 44, 33, 47, 1, 26, 64, 48, 57, 40,
+ 38, 16, -10, -28, 92, 22, -18, 29, -10, 5, -13, 49, 19, 24, 70, 34,
+ 61, 48, 30, 14, -6, 25, 58, 33, 42, 60, 67, 17, 54, 17, 22, 30,
+ 67, 44, -9, 50, -11, 43, 40, 32, 59, 82, 13, 49, -14, 55, 60, 36,
+ 48, 49, 31, 47, 15, 12, 4, 65, 1, 23, 29, 39, 45, -2, 84, 69,
+ 0, 72, 37, 57, 27, 41, -15, -16, 35, 31, 14, 61, 24, 0, 27, 24,
+ 16, 41, 55, 34, 53, 9, 56, 12, 25, 29, 53, 5, 20, -20, -8, 20,
+ 13, 28, -3, 78, 38, 16, 11, 62, 46, 29, 21, 24, 46, 65, 43, -23,
+ 89, 18, 74, 21, 38, -12, 19, 12, -19, 8, 15, 33, 4, 57, 9, -8,
+ 36, 35, 26, 28, 7, 83, 63, 79, 75, 11, 3, 87, 37, 47, 34, 40,
+ 39, 19, 20, 42, 27, 34, 39, 77, 13, 42, 59, 64, 45, -1, 32, 37,
+ 45, -5, 53, -6, 7, 36, 50, 23, 6, 32, 9, -21, 18, 71, 27, 52,
-25, 31, 35, 42, -1, 68, 63, 52, 26, 43, 66, 37, 41, 25, 40, 70,
};
@@ -868,13 +821,12 @@ static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
uint32_t seed = s->noisegen_seed;
unsigned int maxchan = s->max_matrix_channel;
- for(i = 0; i < s->blockpos; i++)
- {
+ for (i = 0; i < s->blockpos; i++) {
uint16_t seed_shr7 = seed >> 7;
m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) << s->noise_shift;
m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7) << s->noise_shift;
- seed = (seed << 16) ^ seed_shr7 ^(seed_shr7 << 5);
+ seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
}
s->noisegen_seed = seed;
@@ -888,11 +840,10 @@ static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
unsigned int i;
uint32_t seed = s->noisegen_seed;
- for(i = 0; i < m->access_unit_size_pow2; i++)
- {
+ for (i = 0; i < m->access_unit_size_pow2; i++) {
uint8_t seed_shr15 = seed >> 15;
m->noise_buffer[i] = noise_table[seed_shr15];
- seed = (seed << 8) ^ seed_shr15 ^(seed_shr15 << 5);
+ seed = (seed << 8) ^ seed_shr15 ^ (seed_shr15 << 5);
}
s->noisegen_seed = seed;
@@ -909,18 +860,14 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
unsigned int maxchan;
maxchan = s->max_matrix_channel;
- if(!s->noise_type)
- {
+ if (!s->noise_type) {
generate_2_noise_channels(m, substr);
maxchan += 2;
- }
- else
- {
+ } else {
fill_noise_buffer(m, substr);
}
- for(mat = 0; mat < s->num_primitive_matrices; mat++)
- {
+ for (mat = 0; mat < s->num_primitive_matrices; mat++) {
int matrix_noise_shift = s->matrix_noise_shift[mat];
unsigned int dest_ch = s->matrix_out_ch[mat];
int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]);
@@ -930,17 +877,15 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
/* TODO: DSPContext? */
- for(i = 0; i < s->blockpos; i++)
- {
+ for (i = 0; i < s->blockpos; i++) {
int32_t bypassed_lsb = m->bypassed_lsbs[i][mat];
int32_t *samples = m->sample_buffer[i];
int64_t accum = 0;
- for(src_ch = 0; src_ch <= maxchan; src_ch++)
+ for (src_ch = 0; src_ch <= maxchan; src_ch++)
accum += (int64_t) samples[src_ch] * coeffs[src_ch];
- if(matrix_noise_shift)
- {
+ if (matrix_noise_shift) {
index &= m->access_unit_size_pow2 - 1;
accum += m->noise_buffer[index] << (matrix_noise_shift + 7);
index += index2;
@@ -961,18 +906,16 @@ static int output_data_internal(MLPDecodeContext *m, unsigned int substr,
int32_t *data_32 = (int32_t*) data;
int16_t *data_16 = (int16_t*) data;
- if(*data_size < (s->max_channel + 1) * s->blockpos *(is32 ? 4 : 2))
+ if (*data_size < (s->max_channel + 1) * s->blockpos * (is32 ? 4 : 2))
return -1;
- for(i = 0; i < s->blockpos; i++)
- {
- for(out_ch = 0; out_ch <= s->max_matrix_channel; out_ch++)
- {
+ for (i = 0; i < s->blockpos; i++) {
+ for (out_ch = 0; out_ch <= s->max_matrix_channel; out_ch++) {
int mat_ch = s->ch_assign[out_ch];
int32_t sample = m->sample_buffer[i][mat_ch]
- << s->output_shift[mat_ch];
+ << s->output_shift[mat_ch];
s->lossless_check_data ^= (sample & 0xffffff) << mat_ch;
- if(is32) *data_32++ = sample << 8;
+ if (is32) *data_32++ = sample << 8;
else *data_16++ = sample >> 8;
}
}
@@ -985,7 +928,7 @@ static int output_data_internal(MLPDecodeContext *m, unsigned int substr,
static int output_data(MLPDecodeContext *m, unsigned int substr,
uint8_t *data, unsigned int *data_size)
{
- if(m->avctx->sample_fmt == SAMPLE_FMT_S32)
+ if (m->avctx->sample_fmt == SAMPLE_FMT_S32)
return output_data_internal(m, substr, data, data_size, 1);
else
return output_data_internal(m, substr, data, data_size, 0);
@@ -1009,27 +952,25 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
uint16_t substream_data_len[MAX_SUBSTREAMS];
uint8_t parity_bits;
- if(buf_size < 4)
+ if (buf_size < 4)
return 0;
length = (AV_RB16(buf) & 0xfff) * 2;
- if(length < 4 || length > buf_size)
+ if (length < 4 || length > buf_size)
return -1;
init_get_bits(&gb, (buf + 4), (length - 4) * 8);
m->is_major_sync_unit = 0;
- if(show_bits_long(&gb, 31) == (0xf8726fba >> 1))
- {
- if(read_major_sync(m, &gb) < 0)
+ if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
+ if (read_major_sync(m, &gb) < 0)
goto error;
m->is_major_sync_unit = 1;
header_size += 28;
}
- if(!m->params_valid)
- {
+ if (!m->params_valid) {
av_log(m->avctx, AV_LOG_WARNING,
"Stream parameters not seen; skipping frame.\n");
*data_size = 0;
@@ -1038,8 +979,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
substream_start = 0;
- for(substr = 0; substr < m->num_substreams; substr++)
- {
+ for (substr = 0; substr < m->num_substreams; substr++) {
int extraword_present, checkdata_present, end, nonrestart_substr;
extraword_present = get_bits1(&gb);
@@ -1051,10 +991,8 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
substr_header_size += 2;
- if(extraword_present)
- {
- if(m->avctx->codec_id == CODEC_ID_MLP)
- {
+ if (extraword_present) {
+ if (m->avctx->codec_id == CODEC_ID_MLP) {
av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
goto error;
}
@@ -1062,22 +1000,19 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
substr_header_size += 2;
}
- if(!(nonrestart_substr ^ m->is_major_sync_unit))
- {
+ if (!(nonrestart_substr ^ m->is_major_sync_unit)) {
av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n");
goto error;
}
- if(end + header_size + substr_header_size > length)
- {
+ if (end + header_size + substr_header_size > length) {
av_log(m->avctx, AV_LOG_ERROR,
"Indicated length of substream %d data goes off end of "
"packet.\n", substr);
end = length - header_size - substr_header_size;
}
- if(end < substream_start)
- {
+ if (end < substream_start) {
av_log(avctx, AV_LOG_ERROR,
"Indicated end offset of substream %d data "
"is smaller than calculated start offset.\n",
@@ -1085,7 +1020,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
goto error;
}
- if(substr > m->max_decoded_substream)
+ if (substr > m->max_decoded_substream)
continue;
substream_parity_present[substr] = checkdata_present;
@@ -1105,8 +1040,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
buf += header_size + substr_header_size;
- for(substr = 0; substr <= m->max_decoded_substream; substr++)
- {
+ for (substr = 0; substr <= m->max_decoded_substream; substr++) {
SubStream *s = &m->substream[substr];
init_get_bits(&gb, buf, substream_data_len[substr] * 8);
@@ -1114,76 +1048,70 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
memset(m->filter_changed, 0, sizeof(m->filter_changed));
s->blockpos = 0;
- do
- {
- if(get_bits1(&gb))
- {
- if(get_bits1(&gb))
- {
+ do {
+ if (get_bits1(&gb)) {
+ if (get_bits1(&gb)) {
/* A restart header should be present. */
- if(read_restart_header(m, &gb, buf, substr) < 0)
+ if (read_restart_header(m, &gb, buf, substr) < 0)
goto next_substr;
s->restart_seen = 1;
}
- if(!s->restart_seen)
+ if (!s->restart_seen)
goto next_substr;
- if(read_decoding_params(m, &gb, substr) < 0)
+ if (read_decoding_params(m, &gb, substr) < 0)
goto next_substr;
}
- if(!s->restart_seen)
+ if (!s->restart_seen)
goto next_substr;
- if(read_block_data(m, &gb, substr) < 0)
+ if (read_block_data(m, &gb, substr) < 0)
return -1;
- if(get_bits_count(&gb) >= substream_data_len[substr] * 8)
+ if (get_bits_count(&gb) >= substream_data_len[substr] * 8)
goto substream_length_mismatch;
- }
- while(!get_bits1(&gb));
+ } while (!get_bits1(&gb));
skip_bits(&gb, (-get_bits_count(&gb)) & 15);
- if(substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32)
- {
+ if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) {
int shorten_by;
- if(get_bits(&gb, 16) != 0xD234)
+ if (get_bits(&gb, 16) != 0xD234)
return -1;
shorten_by = get_bits(&gb, 16);
- if(m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)
+ if (m->avctx->codec_id == 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 == CODEC_ID_MLP && shorten_by != 0xD234)
return -1;
- if(substr == m->max_decoded_substream)
+ if (substr == m->max_decoded_substream)
av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
}
- if(substream_parity_present[substr])
- {
+ if (substream_parity_present[substr]) {
uint8_t parity, checksum;
- if(substream_data_len[substr] * 8 - get_bits_count(&gb) != 16)
+ if (substream_data_len[substr] * 8 - get_bits_count(&gb) != 16)
goto substream_length_mismatch;
parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2);
- checksum = ff_mlp_checksum8(buf, substream_data_len[substr] - 2);
+ checksum = ff_mlp_checksum8 (buf, substream_data_len[substr] - 2);
- if((get_bits(&gb, 8) ^ parity) != 0xa9)
+ if ((get_bits(&gb, 8) ^ parity) != 0xa9 )
av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr);
- if(get_bits(&gb, 8) != checksum)
+ if ( get_bits(&gb, 8) != checksum)
av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr);
}
- if(substream_data_len[substr] * 8 != get_bits_count(&gb))
+ if (substream_data_len[substr] * 8 != get_bits_count(&gb))
goto substream_length_mismatch;
next_substr:
- if(!s->restart_seen)
+ if (!s->restart_seen)
av_log(m->avctx, AV_LOG_ERROR,
"No restart header present in substream %d.\n", substr);
@@ -1192,7 +1120,7 @@ next_substr:
rematrix_channels(m, m->max_decoded_substream);
- if(output_data(m, m->max_decoded_substream, data, data_size) < 0)
+ if (output_data(m, m->max_decoded_substream, data, data_size) < 0)
return -1;
return length;
@@ -1206,8 +1134,7 @@ error:
return -1;
}
-AVCodec mlp_decoder =
-{
+AVCodec mlp_decoder = {
"mlp",
CODEC_TYPE_AUDIO,
CODEC_ID_MLP,
@@ -1225,8 +1152,7 @@ AVCodec mlp_decoder =
};
#if CONFIG_TRUEHD_DECODER
-AVCodec truehd_decoder =
-{
+AVCodec truehd_decoder = {
"truehd",
CODEC_TYPE_AUDIO,
CODEC_ID_TRUEHD,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdsp.c
index 2291610a3..129a01187 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mlpdsp.c
@@ -33,16 +33,15 @@ static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff,
const int32_t *iircoeff = coeff + MAX_FIR_ORDER;
int i;
- for(i = 0; i < blocksize; i++)
- {
+ for (i = 0; i < blocksize; i++) {
int32_t residual = *sample_buffer;
unsigned int order;
int64_t accum = 0;
int32_t result;
- for(order = 0; order < firorder; order++)
+ for (order = 0; order < firorder; order++)
accum += (int64_t) firbuf[order] * fircoeff[order];
- for(order = 0; order < iirorder; order++)
+ for (order = 0; order < iirorder; order++)
accum += (int64_t) iirbuf[order] * iircoeff[order];
accum = accum >> filter_shift;
@@ -62,7 +61,7 @@ void ff_mlp_init(DSPContext* c, AVCodecContext *avctx)
{
c->mlp_filter_channel = ff_mlp_filter_channel;
#if HAVE_MMX
- if(ARCH_X86)
+ if (ARCH_X86)
ff_mlp_init_x86(c, avctx);
#endif
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpc_helper.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpc_helper.c
index 5c205ef05..e11a54606 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpc_helper.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpc_helper.c
@@ -31,70 +31,63 @@
int FFGetChannelMap(struct AVCodecContext * avctx)
{
- switch(avctx->codec_id)
- {
- case CODEC_ID_EAC3 :
- case CODEC_ID_AC3 :
- {
- AC3DecodeContext *s = avctx->priv_data;
+ switch (avctx->codec_id)
+ {
+ case CODEC_ID_EAC3 :
+ case CODEC_ID_AC3 :
+ {
+ AC3DecodeContext *s = avctx->priv_data;
- // Mapping index for s_scmap_ac3
- switch(s->channel_mode)
- {
- case AC3_CHMODE_DUALMONO:
- return 0;
- case AC3_CHMODE_MONO :
- return 1;
- case AC3_CHMODE_STEREO :
- return 2;
- case AC3_CHMODE_3F :
- return 3;
- case AC3_CHMODE_2F1R :
- return 4;
- case AC3_CHMODE_3F1R :
- return 5;
- case AC3_CHMODE_2F2R :
- return 6;
- case AC3_CHMODE_3F2R :
- return (s->lfe_on ? 8 : 7);
- }
- }
- break;
- case CODEC_ID_MLP :
- {
- // Mapping index for s_scmap_lpcm
- if(avctx->channels <= 8)
- return avctx->channels - 1;
- else
- return -1;
- }
- default :
- return 2;
- }
- return -1;
+ // Mapping index for s_scmap_ac3
+ switch (s->channel_mode)
+ {
+ case AC3_CHMODE_DUALMONO: return 0;
+ case AC3_CHMODE_MONO : return 1;
+ case AC3_CHMODE_STEREO : return 2;
+ case AC3_CHMODE_3F : return 3;
+ case AC3_CHMODE_2F1R : return 4;
+ case AC3_CHMODE_3F1R : return 5;
+ case AC3_CHMODE_2F2R : return 6;
+ case AC3_CHMODE_3F2R : return (s->lfe_on ? 8 : 7);
+ }
+ }
+ break;
+ case CODEC_ID_MLP :
+ {
+ // Mapping index for s_scmap_lpcm
+ if (avctx->channels<=8)
+ return avctx->channels-1;
+ else
+ return -1;
+ }
+ default :
+ return 2;
+ }
+ return -1;
}
void* FF_aligned_malloc(size_t size, size_t alignment)
{
- return _aligned_malloc(size, alignment);
+ return _aligned_malloc(size,alignment);
}
void FF_aligned_free(void* mem_ptr)
{
- if(mem_ptr)
- _aligned_free(mem_ptr);
+ if (mem_ptr)
+ _aligned_free(mem_ptr);
}
-void* FF_aligned_realloc(void *ptr, size_t size, size_t alignment)
+void* FF_aligned_realloc(void *ptr,size_t size,size_t alignment)
{
- if(!ptr)
- return FF_aligned_malloc(size, alignment);
- else if(size == 0)
- {
- FF_aligned_free(ptr);
- return NULL;
- }
- else
- return _aligned_realloc(ptr, size, alignment);
+ if (!ptr)
+ return FF_aligned_malloc(size,alignment);
+ else
+ if (size==0)
+ {
+ FF_aligned_free(ptr);
+ return NULL;
+ }
+ else
+ return _aligned_realloc(ptr,size,alignment);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c
index 5b1121529..9837ffcb4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c
@@ -52,18 +52,18 @@
#define MB_BTYPE_VLC_BITS 6
static inline int mpeg1_decode_block_intra(MpegEncContext *s,
- DCTELEM *block,
- int n);
+ DCTELEM *block,
+ int n);
static inline int mpeg1_decode_block_inter(MpegEncContext *s,
- DCTELEM *block,
- int n);
+ DCTELEM *block,
+ int n);
static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n);
static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
- DCTELEM *block,
- int n);
+ DCTELEM *block,
+ int n);
static inline int mpeg2_decode_block_intra(MpegEncContext *s,
- DCTELEM *block,
- int n);
+ DCTELEM *block,
+ int n);
static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n);
static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n);
static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred);
@@ -87,56 +87,44 @@ static void init_2d_vlc_rl(RLTable *rl)
{
int i;
- for(i = 0; i < rl->vlc.table_size; i++)
- {
- int code = rl->vlc.table[i][0];
+ for(i=0; i<rl->vlc.table_size; i++){
+ int code= rl->vlc.table[i][0];
int len = rl->vlc.table[i][1];
int level, run;
- if(len == 0) // illegal code
- {
- run = 65;
- level = MAX_LEVEL;
- }
- else if(len < 0) //more bits needed
- {
- run = 0;
- level = code;
- }
- else
- {
- if(code == rl->n) //esc
- {
- run = 65;
- level = 0;
- }
- else if(code == rl->n + 1) //eob
- {
- run = 0;
- level = 127;
- }
- else
- {
- run = rl->table_run [code] + 1;
- level = rl->table_level[code];
+ if(len==0){ // illegal code
+ run= 65;
+ level= MAX_LEVEL;
+ }else if(len<0){ //more bits needed
+ run= 0;
+ level= code;
+ }else{
+ if(code==rl->n){ //esc
+ run= 65;
+ level= 0;
+ }else if(code==rl->n+1){ //eob
+ run= 0;
+ level= 127;
+ }else{
+ run= rl->table_run [code] + 1;
+ level= rl->table_level[code];
}
}
- rl->rl_vlc[0][i].len = len;
- rl->rl_vlc[0][i].level = level;
- rl->rl_vlc[0][i].run = run;
+ rl->rl_vlc[0][i].len= len;
+ rl->rl_vlc[0][i].level= level;
+ rl->rl_vlc[0][i].run= run;
}
}
void ff_mpeg12_common_init(MpegEncContext *s)
{
- s->y_dc_scale_table =
- s->c_dc_scale_table = mpeg2_dc_scale_table[s->intra_dc_precision];
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= mpeg2_dc_scale_table[s->intra_dc_precision];
}
-void ff_mpeg1_clean_buffers(MpegEncContext *s)
-{
+void ff_mpeg1_clean_buffers(MpegEncContext *s){
s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
s->last_dc[1] = s->last_dc[0];
s->last_dc[2] = s->last_dc[0];
@@ -157,32 +145,31 @@ av_cold void ff_mpeg12_init_vlcs(void)
{
static int done = 0;
- if(!done)
- {
+ if (!done) {
done = 1;
INIT_VLC_STATIC(&dc_lum_vlc, DC_VLC_BITS, 12,
- ff_mpeg12_vlc_dc_lum_bits, 1, 1,
- ff_mpeg12_vlc_dc_lum_code, 2, 2, 512);
+ ff_mpeg12_vlc_dc_lum_bits, 1, 1,
+ ff_mpeg12_vlc_dc_lum_code, 2, 2, 512);
INIT_VLC_STATIC(&dc_chroma_vlc, DC_VLC_BITS, 12,
- ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
- ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514);
+ ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
+ ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514);
INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 17,
- &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1,
- &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 518);
+ &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1,
+ &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 518);
INIT_VLC_STATIC(&mbincr_vlc, MBINCR_VLC_BITS, 36,
- &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1,
- &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538);
+ &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1,
+ &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538);
INIT_VLC_STATIC(&mb_pat_vlc, MB_PAT_VLC_BITS, 64,
- &ff_mpeg12_mbPatTable[0][1], 2, 1,
- &ff_mpeg12_mbPatTable[0][0], 2, 1, 512);
+ &ff_mpeg12_mbPatTable[0][1], 2, 1,
+ &ff_mpeg12_mbPatTable[0][0], 2, 1, 512);
INIT_VLC_STATIC(&mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7,
- &table_mb_ptype[0][1], 2, 1,
- &table_mb_ptype[0][0], 2, 1, 64);
+ &table_mb_ptype[0][1], 2, 1,
+ &table_mb_ptype[0][0], 2, 1, 64);
INIT_VLC_STATIC(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11,
- &table_mb_btype[0][1], 2, 1,
- &table_mb_btype[0][0], 2, 1, 64);
+ &table_mb_btype[0][1], 2, 1,
+ &table_mb_btype[0][0], 2, 1, 64);
init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
@@ -202,12 +189,9 @@ static inline int get_dmv(MpegEncContext *s)
static inline int get_qscale(MpegEncContext *s)
{
int qscale = get_bits(&s->gb, 5);
- if(s->q_scale_type)
- {
+ if (s->q_scale_type) {
return non_linear_qscale[qscale];
- }
- else
- {
+ } else {
return qscale << 1;
}
}
@@ -222,63 +206,53 @@ static int mpeg_decode_mb(MpegEncContext *s,
DCTELEM block[12][64])
{
int i, j, k, cbp, val, mb_type, motion_type;
- const int mb_block_count = 4 + (1 << s->chroma_format);
+ const int mb_block_count = 4 + (1<< s->chroma_format);
dprintf(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
- assert(s->mb_skipped == 0);
+ assert(s->mb_skipped==0);
- if(s->mb_skip_run-- != 0)
- {
- if(s->pict_type == FF_P_TYPE)
- {
+ if (s->mb_skip_run-- != 0) {
+ if (s->pict_type == FF_P_TYPE) {
s->mb_skipped = 1;
- s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ] = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
- }
- else
- {
+ s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
+ } else {
int mb_type;
if(s->mb_x)
- mb_type = s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1];
+ mb_type= s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1];
else
- mb_type = s->current_picture.mb_type[ s->mb_width + (s->mb_y-1)*s->mb_stride - 1]; // FIXME not sure if this is allowed in MPEG at all
+ mb_type= s->current_picture.mb_type[ s->mb_width + (s->mb_y-1)*s->mb_stride - 1]; // FIXME not sure if this is allowed in MPEG at all
if(IS_INTRA(mb_type))
return -1;
- s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ] =
+ s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]=
mb_type | MB_TYPE_SKIP;
// assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8));
- if((s->mv[0][0][0] | s->mv[0][0][1] | s->mv[1][0][0] | s->mv[1][0][1]) == 0)
+ if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0)
s->mb_skipped = 1;
}
return 0;
}
- switch(s->pict_type)
- {
+ switch(s->pict_type) {
default:
case FF_I_TYPE:
- if(get_bits1(&s->gb) == 0)
- {
- if(get_bits1(&s->gb) == 0)
- {
+ if (get_bits1(&s->gb) == 0) {
+ if (get_bits1(&s->gb) == 0){
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA;
- }
- else
- {
+ } else {
mb_type = MB_TYPE_INTRA;
}
break;
case FF_P_TYPE:
mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);
- if(mb_type < 0)
- {
+ if (mb_type < 0){
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -286,8 +260,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
break;
case FF_B_TYPE:
mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);
- if(mb_type < 0)
- {
+ if (mb_type < 0){
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -296,90 +269,70 @@ static int mpeg_decode_mb(MpegEncContext *s,
}
dprintf(s->avctx, "mb_type=%x\n", mb_type);
// motion_type = 0; /* avoid warning */
- if(IS_INTRA(mb_type))
- {
+ if (IS_INTRA(mb_type)) {
s->dsp.clear_blocks(s->block[0]);
- if(!s->chroma_y_shift)
- {
+ if(!s->chroma_y_shift){
s->dsp.clear_blocks(s->block[6]);
}
/* compute DCT type */
- if(s->picture_structure == PICT_FRAME && //FIXME add an interlaced_dct coded var?
- !s->frame_pred_frame_dct)
- {
+ if (s->picture_structure == PICT_FRAME && //FIXME add an interlaced_dct coded var?
+ !s->frame_pred_frame_dct) {
s->interlaced_dct = get_bits1(&s->gb);
}
- if(IS_QUANT(mb_type))
+ if (IS_QUANT(mb_type))
s->qscale = get_qscale(s);
- if(s->concealment_motion_vectors)
- {
+ if (s->concealment_motion_vectors) {
/* just parse them */
- if(s->picture_structure != PICT_FRAME)
+ if (s->picture_structure != PICT_FRAME)
skip_bits1(&s->gb); /* field select */
- s->mv[0][0][0] = s->last_mv[0][0][0] = s->last_mv[0][1][0] =
- mpeg_decode_motion(s, s->mpeg_f_code[0][0], s->last_mv[0][0][0]);
- s->mv[0][0][1] = s->last_mv[0][0][1] = s->last_mv[0][1][1] =
- mpeg_decode_motion(s, s->mpeg_f_code[0][1], s->last_mv[0][0][1]);
+ s->mv[0][0][0]= s->last_mv[0][0][0]= s->last_mv[0][1][0] =
+ mpeg_decode_motion(s, s->mpeg_f_code[0][0], s->last_mv[0][0][0]);
+ s->mv[0][0][1]= s->last_mv[0][0][1]= s->last_mv[0][1][1] =
+ mpeg_decode_motion(s, s->mpeg_f_code[0][1], s->last_mv[0][0][1]);
skip_bits1(&s->gb); /* marker */
- }
- else
+ }else
memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */
s->mb_intra = 1;
- if(s->codec_id == CODEC_ID_MPEG2VIDEO)
- {
- if(s->flags2 & CODEC_FLAG2_FAST)
- {
- for(i = 0; i < 6; i++)
- {
+ if (s->codec_id == 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);
}
- }
- else
- {
- for(i = 0; i < mb_block_count; i++)
- {
- if(mpeg2_decode_block_intra(s, *s->pblocks[i], i) < 0)
+ }else{
+ for(i=0;i<mb_block_count;i++) {
+ if (mpeg2_decode_block_intra(s, *s->pblocks[i], i) < 0)
return -1;
}
}
- }
- else
- {
- for(i = 0; i < 6; i++)
- {
- if(mpeg1_decode_block_intra(s, *s->pblocks[i], i) < 0)
+ } else {
+ for(i=0;i<6;i++) {
+ if (mpeg1_decode_block_intra(s, *s->pblocks[i], i) < 0)
return -1;
}
}
- }
- else
- {
- if(mb_type & MB_TYPE_ZERO_MV)
- {
+ } else {
+ if (mb_type & MB_TYPE_ZERO_MV){
assert(mb_type & MB_TYPE_CBP);
s->mv_dir = MV_DIR_FORWARD;
- if(s->picture_structure == PICT_FRAME)
- {
+ if(s->picture_structure == PICT_FRAME){
if(!s->frame_pred_frame_dct)
s->interlaced_dct = get_bits1(&s->gb);
s->mv_type = MV_TYPE_16X16;
- }
- else
- {
+ }else{
s->mv_type = MV_TYPE_FIELD;
mb_type |= MB_TYPE_INTERLACED;
- s->field_select[0][0] = s->picture_structure - 1;
+ s->field_select[0][0]= s->picture_structure - 1;
}
- if(IS_QUANT(mb_type))
+ if (IS_QUANT(mb_type))
s->qscale = get_qscale(s);
s->last_mv[0][0][0] = 0;
@@ -388,66 +341,52 @@ static int mpeg_decode_mb(MpegEncContext *s,
s->last_mv[0][1][1] = 0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
- }
- else
- {
+ }else{
assert(mb_type & MB_TYPE_L0L1);
//FIXME decide if MBs in field pictures are MB_TYPE_INTERLACED
/* get additional motion vector type */
- if(s->frame_pred_frame_dct)
+ if (s->frame_pred_frame_dct)
motion_type = MT_FRAME;
- else
- {
+ else{
motion_type = get_bits(&s->gb, 2);
- if(s->picture_structure == PICT_FRAME && HAS_CBP(mb_type))
+ if (s->picture_structure == PICT_FRAME && HAS_CBP(mb_type))
s->interlaced_dct = get_bits1(&s->gb);
}
- if(IS_QUANT(mb_type))
+ if (IS_QUANT(mb_type))
s->qscale = get_qscale(s);
/* motion vectors */
- s->mv_dir = (mb_type >> 13) & 3;
+ s->mv_dir= (mb_type>>13)&3;
dprintf(s->avctx, "motion_type=%d\n", motion_type);
- switch(motion_type)
- {
+ switch(motion_type) {
case MT_FRAME: /* or MT_16X8 */
- if(s->picture_structure == PICT_FRAME)
- {
+ if (s->picture_structure == PICT_FRAME) {
mb_type |= MB_TYPE_16x16;
s->mv_type = MV_TYPE_16X16;
- for(i = 0; i < 2; i++)
- {
- if(USES_LIST(mb_type, i))
- {
+ for(i=0;i<2;i++) {
+ if (USES_LIST(mb_type, i)) {
/* MT_FRAME */
- s->mv[i][0][0] = s->last_mv[i][0][0] = s->last_mv[i][1][0] =
- mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]);
- s->mv[i][0][1] = s->last_mv[i][0][1] = s->last_mv[i][1][1] =
- mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]);
+ s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] =
+ mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]);
+ s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] =
+ mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]);
/* full_pel: only for MPEG-1 */
- if(s->full_pel[i])
- {
+ if (s->full_pel[i]){
s->mv[i][0][0] <<= 1;
s->mv[i][0][1] <<= 1;
}
}
}
- }
- else
- {
+ } else {
mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
s->mv_type = MV_TYPE_16X8;
- for(i = 0; i < 2; i++)
- {
- if(USES_LIST(mb_type, i))
- {
+ for(i=0;i<2;i++) {
+ if (USES_LIST(mb_type, i)) {
/* MT_16X8 */
- for(j = 0; j < 2; j++)
- {
+ for(j=0;j<2;j++) {
s->field_select[i][j] = get_bits1(&s->gb);
- for(k = 0; k < 2; k++)
- {
+ for(k=0;k<2;k++) {
val = mpeg_decode_motion(s, s->mpeg_f_code[i][k],
s->last_mv[i][j][k]);
s->last_mv[i][j][k] = val;
@@ -460,15 +399,11 @@ static int mpeg_decode_mb(MpegEncContext *s,
break;
case MT_FIELD:
s->mv_type = MV_TYPE_FIELD;
- if(s->picture_structure == PICT_FRAME)
- {
+ if (s->picture_structure == PICT_FRAME) {
mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
- for(i = 0; i < 2; i++)
- {
- if(USES_LIST(mb_type, i))
- {
- for(j = 0; j < 2; j++)
- {
+ for(i=0;i<2;i++) {
+ if (USES_LIST(mb_type, i)) {
+ for(j=0;j<2;j++) {
s->field_select[i][j] = get_bits1(&s->gb);
val = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
s->last_mv[i][j][0]);
@@ -483,17 +418,12 @@ static int mpeg_decode_mb(MpegEncContext *s,
}
}
}
- }
- else
- {
+ } else {
mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
- for(i = 0; i < 2; i++)
- {
- if(USES_LIST(mb_type, i))
- {
+ for(i=0;i<2;i++) {
+ if (USES_LIST(mb_type, i)) {
s->field_select[i][0] = get_bits1(&s->gb);
- for(k = 0; k < 2; k++)
- {
+ for(k=0;k<2;k++) {
val = mpeg_decode_motion(s, s->mpeg_f_code[i][k],
s->last_mv[i][0][k]);
s->last_mv[i][0][k] = val;
@@ -506,12 +436,10 @@ static int mpeg_decode_mb(MpegEncContext *s,
break;
case MT_DMV:
s->mv_type = MV_TYPE_DMV;
- for(i = 0; i < 2; i++)
- {
- if(USES_LIST(mb_type, i))
- {
+ for(i=0;i<2;i++) {
+ if (USES_LIST(mb_type, i)) {
int dmx, dmy, mx, my, m;
- const int my_shift = s->picture_structure == PICT_FRAME;
+ const int my_shift= s->picture_structure == PICT_FRAME;
mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
s->last_mv[i][0][0]);
@@ -523,16 +451,15 @@ static int mpeg_decode_mb(MpegEncContext *s,
dmy = get_dmv(s);
- s->last_mv[i][0][1] = my << my_shift;
- s->last_mv[i][1][1] = my << my_shift;
+ s->last_mv[i][0][1] = my<<my_shift;
+ s->last_mv[i][1][1] = my<<my_shift;
s->mv[i][0][0] = mx;
s->mv[i][0][1] = my;
s->mv[i][1][0] = mx;//not used
s->mv[i][1][1] = my;//not used
- if(s->picture_structure == PICT_FRAME)
- {
+ if (s->picture_structure == PICT_FRAME) {
mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
//m = 1 + 2 * s->top_field_first;
@@ -544,9 +471,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
m = 4 - m;
s->mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
s->mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1;
- }
- else
- {
+ } else {
mb_type |= MB_TYPE_16x16;
s->mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx;
@@ -566,102 +491,72 @@ static int mpeg_decode_mb(MpegEncContext *s,
}
s->mb_intra = 0;
- if(HAS_CBP(mb_type))
- {
+ if (HAS_CBP(mb_type)) {
s->dsp.clear_blocks(s->block[0]);
cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
- if(mb_block_count > 6)
- {
- cbp <<= mb_block_count - 6;
- cbp |= get_bits(&s->gb, mb_block_count - 6);
- s->dsp.clear_blocks(s->block[6]);
+ if(mb_block_count > 6){
+ cbp<<= mb_block_count-6;
+ cbp |= get_bits(&s->gb, mb_block_count-6);
+ s->dsp.clear_blocks(s->block[6]);
}
- if(cbp <= 0)
- {
+ if (cbp <= 0){
av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- if(s->codec_id == CODEC_ID_MPEG2VIDEO)
- {
- if(s->flags2 & CODEC_FLAG2_FAST)
- {
- for(i = 0; i < 6; i++)
- {
- if(cbp & 32)
- {
+ if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if(s->flags2 & CODEC_FLAG2_FAST){
+ for(i=0;i<6;i++) {
+ if(cbp & 32) {
mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i);
- }
- else
- {
+ } else {
s->block_last_index[i] = -1;
}
- cbp += cbp;
+ cbp+=cbp;
}
- }
- else
- {
- cbp <<= 12 - mb_block_count;
-
- for(i = 0; i < mb_block_count; i++)
- {
- if(cbp & (1 << 11))
- {
- if(mpeg2_decode_block_non_intra(s, *s->pblocks[i], i) < 0)
+ }else{
+ cbp<<= 12-mb_block_count;
+
+ for(i=0;i<mb_block_count;i++) {
+ if ( cbp & (1<<11) ) {
+ if (mpeg2_decode_block_non_intra(s, *s->pblocks[i], i) < 0)
return -1;
- }
- else
- {
+ } else {
s->block_last_index[i] = -1;
}
- cbp += cbp;
+ cbp+=cbp;
}
}
- }
- else
- {
- if(s->flags2 & CODEC_FLAG2_FAST)
- {
- for(i = 0; i < 6; i++)
- {
- if(cbp & 32)
- {
+ } else {
+ if(s->flags2 & CODEC_FLAG2_FAST){
+ for(i=0;i<6;i++) {
+ if (cbp & 32) {
mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i);
- }
- else
- {
+ } else {
s->block_last_index[i] = -1;
}
- cbp += cbp;
+ cbp+=cbp;
}
- }
- else
- {
- for(i = 0; i < 6; i++)
- {
- if(cbp & 32)
- {
- if(mpeg1_decode_block_inter(s, *s->pblocks[i], i) < 0)
+ }else{
+ for(i=0;i<6;i++) {
+ if (cbp & 32) {
+ if (mpeg1_decode_block_inter(s, *s->pblocks[i], i) < 0)
return -1;
- }
- else
- {
+ } else {
s->block_last_index[i] = -1;
}
- cbp += cbp;
+ cbp+=cbp;
}
}
}
- }
- else
- {
- for(i = 0; i < 12; i++)
+ }else{
+ for(i=0;i<12;i++)
s->block_last_index[i] = -1;
}
}
- s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ] = mb_type;
+ s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= mb_type;
return 0;
}
@@ -672,112 +567,92 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
int code, sign, val, l, shift;
code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
- if(code == 0)
- {
+ if (code == 0) {
return pred;
}
- if(code < 0)
- {
+ if (code < 0) {
return 0xffff;
}
sign = get_bits1(&s->gb);
shift = fcode - 1;
val = code;
- if(shift)
- {
+ if (shift) {
val = (val - 1) << shift;
val |= get_bits(&s->gb, shift);
val++;
}
- if(sign)
+ if (sign)
val = -val;
val += pred;
/* modulo decoding */
- l = INT_BIT - 5 - shift;
- val = (val << l)>>l;
+ l= INT_BIT - 5 - shift;
+ val = (val<<l)>>l;
return val;
}
static inline int mpeg1_decode_block_intra(MpegEncContext *s,
- DCTELEM *block,
- int n)
+ DCTELEM *block,
+ int n)
{
int level, dc, diff, i, j, run;
int component;
RLTable *rl = &ff_rl_mpeg1;
- uint8_t * const scantable = s->intra_scantable.permutated;
- const uint16_t *quant_matrix = s->intra_matrix;
- const int qscale = s->qscale;
+ uint8_t * const scantable= s->intra_scantable.permutated;
+ const uint16_t *quant_matrix= s->intra_matrix;
+ const int qscale= s->qscale;
/* DC coefficient */
component = (n <= 3 ? 0 : n - 4 + 1);
diff = decode_dc(&s->gb, component);
- if(diff >= 0xffff)
+ if (diff >= 0xffff)
return -1;
dc = s->last_dc[component];
dc += diff;
s->last_dc[component] = dc;
- block[0] = dc * quant_matrix[0];
+ block[0] = dc*quant_matrix[0];
dprintf(s->avctx, "dc=%d diff=%d\n", dc, diff);
i = 0;
{
OPEN_READER(re, &s->gb);
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level == 127)
- {
+ if(level == 127){
break;
- }
- else if(level != 0)
- {
+ } else if(level != 0) {
i += run;
j = scantable[i];
- level = (level * qscale * quant_matrix[j]) >> 4;
- level = (level - 1) | 1;
+ level= (level*qscale*quant_matrix[j])>>4;
+ level= (level-1)|1;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 8);
- SKIP_BITS(re, &s->gb, 8);
- if(level == -128)
- {
- level = SHOW_UBITS(re, &s->gb, 8) - 256;
- LAST_SKIP_BITS(re, &s->gb, 8);
- }
- else if(level == 0)
- {
- level = SHOW_UBITS(re, &s->gb, 8) ;
- LAST_SKIP_BITS(re, &s->gb, 8);
+ level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8);
+ if (level == -128) {
+ level = SHOW_UBITS(re, &s->gb, 8) - 256; LAST_SKIP_BITS(re, &s->gb, 8);
+ } else if (level == 0) {
+ level = SHOW_UBITS(re, &s->gb, 8) ; LAST_SKIP_BITS(re, &s->gb, 8);
}
i += run;
j = scantable[i];
- if(level < 0)
- {
- level = -level;
- level = (level * qscale * quant_matrix[j]) >> 4;
- level = (level - 1) | 1;
- level = -level;
- }
- else
- {
- level = (level * qscale * quant_matrix[j]) >> 4;
- level = (level - 1) | 1;
+ if(level<0){
+ level= -level;
+ level= (level*qscale*quant_matrix[j])>>4;
+ level= (level-1)|1;
+ level= -level;
+ }else{
+ level= (level*qscale*quant_matrix[j])>>4;
+ level= (level-1)|1;
}
}
- if(i > 63)
- {
+ if (i > 63){
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -787,7 +662,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
CLOSE_READER(re, &s->gb);
}
s->block_last_index[n] = i;
- return 0;
+ return 0;
}
int ff_mpeg1_decode_block_intra(MpegEncContext *s,
@@ -798,26 +673,25 @@ int ff_mpeg1_decode_block_intra(MpegEncContext *s,
}
static inline int mpeg1_decode_block_inter(MpegEncContext *s,
- DCTELEM *block,
- int n)
+ DCTELEM *block,
+ int n)
{
int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1;
- uint8_t * const scantable = s->intra_scantable.permutated;
- const uint16_t *quant_matrix = s->inter_matrix;
- const int qscale = s->qscale;
+ uint8_t * const scantable= s->intra_scantable.permutated;
+ const uint16_t *quant_matrix= s->inter_matrix;
+ const int qscale= s->qscale;
{
OPEN_READER(re, &s->gb);
i = -1;
// special case for first coefficient, no need to add second VLC table
UPDATE_CACHE(re, &s->gb);
- if(((int32_t)GET_CACHE(re, &s->gb)) < 0)
- {
- level = (3 * qscale * quant_matrix[0]) >> 5;
- level = (level - 1) | 1;
- if(GET_CACHE(re, &s->gb) & 0x40000000)
- level = -level;
+ if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
+ level= (3*qscale*quant_matrix[0])>>5;
+ level= (level-1)|1;
+ if(GET_CACHE(re, &s->gb)&0x40000000)
+ level= -level;
block[0] = level;
i++;
SKIP_BITS(re, &s->gb, 2);
@@ -826,54 +700,39 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
}
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level != 0)
- {
+ if(level != 0) {
i += run;
j = scantable[i];
- level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
- level = (level - 1) | 1;
+ level= ((level*2+1)*qscale*quant_matrix[j])>>5;
+ level= (level-1)|1;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 8);
- SKIP_BITS(re, &s->gb, 8);
- if(level == -128)
- {
- level = SHOW_UBITS(re, &s->gb, 8) - 256;
- SKIP_BITS(re, &s->gb, 8);
- }
- else if(level == 0)
- {
- level = SHOW_UBITS(re, &s->gb, 8) ;
- SKIP_BITS(re, &s->gb, 8);
+ level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8);
+ if (level == -128) {
+ level = SHOW_UBITS(re, &s->gb, 8) - 256; SKIP_BITS(re, &s->gb, 8);
+ } else if (level == 0) {
+ level = SHOW_UBITS(re, &s->gb, 8) ; SKIP_BITS(re, &s->gb, 8);
}
i += run;
j = scantable[i];
- if(level < 0)
- {
- level = -level;
- level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
- level = (level - 1) | 1;
- level = -level;
- }
- else
- {
- level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
- level = (level - 1) | 1;
+ if(level<0){
+ level= -level;
+ level= ((level*2+1)*qscale*quant_matrix[j])>>5;
+ level= (level-1)|1;
+ level= -level;
+ }else{
+ level= ((level*2+1)*qscale*quant_matrix[j])>>5;
+ level= (level-1)|1;
}
}
- if(i > 63)
- {
+ if (i > 63){
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -895,20 +754,19 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc
{
int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1;
- uint8_t * const scantable = s->intra_scantable.permutated;
- const int qscale = s->qscale;
+ uint8_t * const scantable= s->intra_scantable.permutated;
+ const int qscale= s->qscale;
{
OPEN_READER(re, &s->gb);
i = -1;
// special case for first coefficient, no need to add second VLC table
UPDATE_CACHE(re, &s->gb);
- if(((int32_t)GET_CACHE(re, &s->gb)) < 0)
- {
- level = (3 * qscale) >> 1;
- level = (level - 1) | 1;
- if(GET_CACHE(re, &s->gb) & 0x40000000)
- level = -level;
+ if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
+ level= (3*qscale)>>1;
+ level= (level-1)|1;
+ if(GET_CACHE(re, &s->gb)&0x40000000)
+ level= -level;
block[0] = level;
i++;
SKIP_BITS(re, &s->gb, 2);
@@ -917,50 +775,36 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc
}
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level != 0)
- {
+ if(level != 0) {
i += run;
j = scantable[i];
- level = ((level * 2 + 1) * qscale) >> 1;
- level = (level - 1) | 1;
+ level= ((level*2+1)*qscale)>>1;
+ level= (level-1)|1;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 8);
- SKIP_BITS(re, &s->gb, 8);
- if(level == -128)
- {
- level = SHOW_UBITS(re, &s->gb, 8) - 256;
- SKIP_BITS(re, &s->gb, 8);
- }
- else if(level == 0)
- {
- level = SHOW_UBITS(re, &s->gb, 8) ;
- SKIP_BITS(re, &s->gb, 8);
+ level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8);
+ if (level == -128) {
+ level = SHOW_UBITS(re, &s->gb, 8) - 256; SKIP_BITS(re, &s->gb, 8);
+ } else if (level == 0) {
+ level = SHOW_UBITS(re, &s->gb, 8) ; SKIP_BITS(re, &s->gb, 8);
}
i += run;
j = scantable[i];
- if(level < 0)
- {
- level = -level;
- level = ((level * 2 + 1) * qscale) >> 1;
- level = (level - 1) | 1;
- level = -level;
- }
- else
- {
- level = ((level * 2 + 1) * qscale) >> 1;
- level = (level - 1) | 1;
+ if(level<0){
+ level= -level;
+ level= ((level*2+1)*qscale)>>1;
+ level= (level-1)|1;
+ level= -level;
+ }else{
+ level= ((level*2+1)*qscale)>>1;
+ level= (level-1)|1;
}
}
@@ -979,14 +823,14 @@ end:
static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
- DCTELEM *block,
- int n)
+ DCTELEM *block,
+ int n)
{
int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1;
- uint8_t * const scantable = s->intra_scantable.permutated;
+ uint8_t * const scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix;
- const int qscale = s->qscale;
+ const int qscale= s->qscale;
int mismatch;
mismatch = 1;
@@ -994,18 +838,17 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
{
OPEN_READER(re, &s->gb);
i = -1;
- if(n < 4)
+ if (n < 4)
quant_matrix = s->inter_matrix;
else
quant_matrix = s->chroma_inter_matrix;
// special case for first coefficient, no need to add second VLC table
UPDATE_CACHE(re, &s->gb);
- if(((int32_t)GET_CACHE(re, &s->gb)) < 0)
- {
- level = (3 * qscale * quant_matrix[0]) >> 5;
- if(GET_CACHE(re, &s->gb) & 0x40000000)
- level = -level;
+ if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
+ level= (3*qscale*quant_matrix[0])>>5;
+ if(GET_CACHE(re, &s->gb)&0x40000000)
+ level= -level;
block[0] = level;
mismatch ^= level;
i++;
@@ -1015,41 +858,31 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
}
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level != 0)
- {
+ if(level != 0) {
i += run;
j = scantable[i];
- level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
+ level= ((level*2+1)*qscale*quant_matrix[j])>>5;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 12);
- SKIP_BITS(re, &s->gb, 12);
+ level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
i += run;
j = scantable[i];
- if(level < 0)
- {
- level = ((-level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
- level = -level;
- }
- else
- {
- level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
+ if(level<0){
+ level= ((-level*2+1)*qscale*quant_matrix[j])>>5;
+ level= -level;
+ }else{
+ level= ((level*2+1)*qscale*quant_matrix[j])>>5;
}
}
- if(i > 63)
- {
+ if (i > 63){
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -1071,23 +904,22 @@ end:
}
static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
- DCTELEM *block,
- int n)
+ DCTELEM *block,
+ int n)
{
int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1;
- uint8_t * const scantable = s->intra_scantable.permutated;
- const int qscale = s->qscale;
+ uint8_t * const scantable= s->intra_scantable.permutated;
+ const int qscale= s->qscale;
OPEN_READER(re, &s->gb);
i = -1;
// special case for first coefficient, no need to add second VLC table
UPDATE_CACHE(re, &s->gb);
- if(((int32_t)GET_CACHE(re, &s->gb)) < 0)
- {
- level = (3 * qscale) >> 1;
- if(GET_CACHE(re, &s->gb) & 0x40000000)
- level = -level;
+ if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
+ level= (3*qscale)>>1;
+ if(GET_CACHE(re, &s->gb)&0x40000000)
+ level= -level;
block[0] = level;
i++;
SKIP_BITS(re, &s->gb, 2);
@@ -1096,37 +928,28 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
}
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level != 0)
- {
+ if(level != 0) {
i += run;
j = scantable[i];
- level = ((level * 2 + 1) * qscale) >> 1;
+ level= ((level*2+1)*qscale)>>1;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 12);
- SKIP_BITS(re, &s->gb, 12);
+ level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
i += run;
j = scantable[i];
- if(level < 0)
- {
- level = ((-level * 2 + 1) * qscale) >> 1;
- level = -level;
- }
- else
- {
- level = ((level * 2 + 1) * qscale) >> 1;
+ if(level<0){
+ level= ((-level*2+1)*qscale)>>1;
+ level= -level;
+ }else{
+ level= ((level*2+1)*qscale)>>1;
}
}
@@ -1144,30 +967,27 @@ end:
static inline int mpeg2_decode_block_intra(MpegEncContext *s,
- DCTELEM *block,
- int n)
+ DCTELEM *block,
+ int n)
{
int level, dc, diff, i, j, run;
int component;
RLTable *rl;
- uint8_t * const scantable = s->intra_scantable.permutated;
+ uint8_t * const scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix;
- const int qscale = s->qscale;
+ const int qscale= s->qscale;
int mismatch;
/* DC coefficient */
- if(n < 4)
- {
+ if (n < 4){
quant_matrix = s->intra_matrix;
component = 0;
- }
- else
- {
+ }else{
quant_matrix = s->chroma_intra_matrix;
- component = (n & 1) + 1;
+ component = (n&1) + 1;
}
diff = decode_dc(&s->gb, component);
- if(diff >= 0xffff)
+ if (diff >= 0xffff)
return -1;
dc = s->last_dc[component];
dc += diff;
@@ -1176,7 +996,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
dprintf(s->avctx, "dc=%d\n", block[0]);
mismatch = block[0] ^ 1;
i = 0;
- if(s->intra_vlc_format)
+ if (s->intra_vlc_format)
rl = &ff_rl_mpeg2;
else
rl = &ff_rl_mpeg1;
@@ -1184,90 +1004,75 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
{
OPEN_READER(re, &s->gb);
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level == 127)
- {
+ if(level == 127){
break;
- }
- else if(level != 0)
- {
+ } else if(level != 0) {
i += run;
j = scantable[i];
- level = (level * qscale * quant_matrix[j]) >> 4;
+ level= (level*qscale*quant_matrix[j])>>4;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 12);
- SKIP_BITS(re, &s->gb, 12);
+ level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
i += run;
j = scantable[i];
- if(level < 0)
- {
- level = (-level * qscale * quant_matrix[j]) >> 4;
- level = -level;
- }
- else
- {
- level = (level * qscale * quant_matrix[j]) >> 4;
+ if(level<0){
+ level= (-level*qscale*quant_matrix[j])>>4;
+ level= -level;
+ }else{
+ level= (level*qscale*quant_matrix[j])>>4;
}
}
- if(i > 63)
- {
+ if (i > 63){
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- mismatch ^= level;
+ mismatch^= level;
block[j] = level;
}
CLOSE_READER(re, &s->gb);
}
- block[63] ^= mismatch & 1;
+ block[63]^= mismatch&1;
s->block_last_index[n] = i;
return 0;
}
static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s,
- DCTELEM *block,
- int n)
+ DCTELEM *block,
+ int n)
{
int level, dc, diff, j, run;
int component;
RLTable *rl;
- uint8_t * scantable = s->intra_scantable.permutated;
+ uint8_t * scantable= s->intra_scantable.permutated;
const uint16_t *quant_matrix;
- const int qscale = s->qscale;
+ const int qscale= s->qscale;
/* DC coefficient */
- if(n < 4)
- {
+ if (n < 4){
quant_matrix = s->intra_matrix;
component = 0;
- }
- else
- {
+ }else{
quant_matrix = s->chroma_intra_matrix;
- component = (n & 1) + 1;
+ component = (n&1) + 1;
}
diff = decode_dc(&s->gb, component);
- if(diff >= 0xffff)
+ if (diff >= 0xffff)
return -1;
dc = s->last_dc[component];
dc += diff;
s->last_dc[component] = dc;
block[0] = dc << (3 - s->intra_dc_precision);
- if(s->intra_vlc_format)
+ if (s->intra_vlc_format)
rl = &ff_rl_mpeg2;
else
rl = &ff_rl_mpeg1;
@@ -1275,41 +1080,30 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s,
{
OPEN_READER(re, &s->gb);
/* now quantify & encode AC coefficients */
- for(;;)
- {
+ for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
- if(level == 127)
- {
+ if(level == 127){
break;
- }
- else if(level != 0)
- {
+ } else if(level != 0) {
scantable += run;
j = *scantable;
- level = (level * qscale * quant_matrix[j]) >> 4;
+ level= (level*qscale*quant_matrix[j])>>4;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
- }
- else
- {
+ } else {
/* escape */
- run = SHOW_UBITS(re, &s->gb, 6) + 1;
- LAST_SKIP_BITS(re, &s->gb, 6);
+ run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
UPDATE_CACHE(re, &s->gb);
- level = SHOW_SBITS(re, &s->gb, 12);
- SKIP_BITS(re, &s->gb, 12);
+ level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
scantable += run;
j = *scantable;
- if(level < 0)
- {
- level = (-level * qscale * quant_matrix[j]) >> 4;
- level = -level;
- }
- else
- {
- level = (level * qscale * quant_matrix[j]) >> 4;
+ if(level<0){
+ level= (-level*qscale*quant_matrix[j])>>4;
+ level= -level;
+ }else{
+ level= (level*qscale*quant_matrix[j])>>4;
}
}
@@ -1322,8 +1116,7 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s,
return 0;
}
-typedef struct Mpeg1Context
-{
+typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx;
int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
int repeat_field; /* true if we must repeat the field */
@@ -1334,10 +1127,10 @@ typedef struct Mpeg1Context
int save_width, save_height, save_progressive_seq;
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
- // ==> Start patch MPC
- DXVA_SliceInfo* pSliceInfo;
- uint8_t* prev_slice;
- // <== End patch MPC
+ // ==> Start patch MPC
+ DXVA_SliceInfo* pSliceInfo;
+ uint8_t* prev_slice;
+ // <== End patch MPC
} Mpeg1Context;
static av_cold int mpeg_decode_init(AVCodecContext *avctx)
@@ -1348,23 +1141,23 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
/* we need some permutation to store matrices,
* until MPV_common_init() sets the real permutation. */
- for(i = 0; i < 64; i++)
- s2->dsp.idct_permutation[i] = i;
+ for(i=0;i<64;i++)
+ s2->dsp.idct_permutation[i]=i;
MPV_decode_defaults(s2);
- s->mpeg_enc_ctx.avctx = avctx;
- s->mpeg_enc_ctx.flags = avctx->flags;
- s->mpeg_enc_ctx.flags2 = avctx->flags2;
+ s->mpeg_enc_ctx.avctx= avctx;
+ s->mpeg_enc_ctx.flags= avctx->flags;
+ s->mpeg_enc_ctx.flags2= avctx->flags2;
ff_mpeg12_common_init(&s->mpeg_enc_ctx);
ff_mpeg12_init_vlcs();
s->mpeg_enc_ctx_allocated = 0;
s->mpeg_enc_ctx.picture_number = 0;
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)
+ s->mpeg_enc_ctx.codec_id= avctx->codec->id;
+ avctx->color_range= AVCOL_RANGE_MPEG;
+ if (avctx->codec->id == CODEC_ID_MPEG1VIDEO)
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
else
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
@@ -1372,60 +1165,55 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
}
static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
- const uint8_t *new_perm)
-{
+ const uint8_t *new_perm){
uint16_t temp_matrix[64];
int i;
- memcpy(temp_matrix, matrix, 64 * sizeof(uint16_t));
+ memcpy(temp_matrix,matrix,64*sizeof(uint16_t));
- for(i = 0; i < 64; i++)
- {
+ for(i=0;i<64;i++){
matrix[new_perm[i]] = temp_matrix[old_perm[i]];
}
}
-static enum PixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
-{
+static enum PixelFormat mpeg_get_pixelformat(AVCodecContext *avctx){
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
- if(s->chroma_format < 2)
- return PIX_FMT_YUV420P;
- else if(s->chroma_format == 2)
- return PIX_FMT_YUV422P;
- else
- return PIX_FMT_YUV444P;
+ if(s->chroma_format < 2)
+ return PIX_FMT_YUV420P;
+ else if(s->chroma_format == 2)
+ return PIX_FMT_YUV422P;
+ else
+ return PIX_FMT_YUV444P;
}
/* Call this function when we know all parameters.
* It may be called in different places for MPEG-1 and MPEG-2. */
-static int mpeg_decode_postinit(AVCodecContext *avctx)
-{
+static int mpeg_decode_postinit(AVCodecContext *avctx){
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
uint8_t old_permutation[64];
- if(
- (s1->mpeg_enc_ctx_allocated == 0) ||
+ if (
+ (s1->mpeg_enc_ctx_allocated == 0)||
avctx->coded_width != s->width ||
- avctx->coded_height != s->height ||
+ avctx->coded_height != s->height||
s1->save_width != s->width ||
s1->save_height != s->height ||
- s1->save_aspect_info != s->aspect_ratio_info ||
+ s1->save_aspect_info != s->aspect_ratio_info||
s1->save_progressive_seq != s->progressive_sequence ||
0)
{
- if(s1->mpeg_enc_ctx_allocated)
- {
- ParseContext pc = s->parse_context;
- s->parse_context.buffer = 0;
+ if (s1->mpeg_enc_ctx_allocated) {
+ ParseContext pc= s->parse_context;
+ s->parse_context.buffer=0;
MPV_common_end(s);
- s->parse_context = pc;
+ s->parse_context= pc;
}
- if((s->width == 0) || (s->height == 0))
+ if( (s->width == 0 )||(s->height == 0))
return -2;
avcodec_set_dimensions(avctx, s->width, s->height);
@@ -1439,31 +1227,27 @@ 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)
- {
+ assert((avctx->sub_id==1) == (avctx->codec_id==CODEC_ID_MPEG1VIDEO));
+ if(avctx->codec_id==CODEC_ID_MPEG1VIDEO){
//MPEG-1 fps
- avctx->time_base.den = ff_frame_rate_tab[s->frame_rate_index].num;
- avctx->time_base.num = ff_frame_rate_tab[s->frame_rate_index].den;
+ avctx->time_base.den= ff_frame_rate_tab[s->frame_rate_index].num;
+ avctx->time_base.num= ff_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->sample_aspect_ratio= av_d2q(
+ 1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255);
- }
- else //MPEG-2
- {
+ }else{//MPEG-2
#if 0 // ffdshow custom code (move this block to mpeg_decode_sequence_extension)
- //MPEG-2 fps
+ //MPEG-2 fps
av_reduce(
&s->avctx->time_base.den,
&s->avctx->time_base.num,
ff_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num,
ff_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
- 1 << 30);
+ 1<<30);
#endif
- //MPEG-2 aspect
- if(s->aspect_ratio_info > 1)
- {
+ //MPEG-2 aspect
+ if(s->aspect_ratio_info > 1){
//we ignore the spec here as reality does not match the spec, see for example
// res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg
@@ -1474,37 +1258,32 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
* wrong spec-value in sample_aspect_ratio2.
* Let ffdshow guess which is likely.
*/
- AVRational r1 = {s->width, s->height};
- AVRational r2 = {s1->pan_scan.width, s1->pan_scan.height};
- if((s1->pan_scan.width == 0) || (s1->pan_scan.height == 0))
- {
- s->avctx->sample_aspect_ratio =
- s->avctx->sample_aspect_ratio2 =
- av_div_q(
- ff_mpeg2_aspect[s->aspect_ratio_info],
- r1
- );
- }
- else
- {
- s->avctx->sample_aspect_ratio =
+ AVRational r1={s->width, s->height};
+ AVRational r2={s1->pan_scan.width, s1->pan_scan.height};
+ if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0)){
+ s->avctx->sample_aspect_ratio=
+ s->avctx->sample_aspect_ratio2=
av_div_q(
- ff_mpeg2_aspect[s->aspect_ratio_info],
- r2
+ ff_mpeg2_aspect[s->aspect_ratio_info],
+ r1
+ );
+ }else{
+ s->avctx->sample_aspect_ratio=
+ av_div_q(
+ ff_mpeg2_aspect[s->aspect_ratio_info],
+ r2
);
- s->avctx->sample_aspect_ratio2 =
+ s->avctx->sample_aspect_ratio2=
// Dity workaround
// This is wrong, but often used. Let ffdshow chose either r2 or r1.
av_div_q(
- ff_mpeg2_aspect[s->aspect_ratio_info],
- r1
+ ff_mpeg2_aspect[s->aspect_ratio_info],
+ r1
);
}
/* ffdshow custom code end */
- }
- else
- {
- s->avctx->sample_aspect_ratio =
+ }else{
+ s->avctx->sample_aspect_ratio=
ff_mpeg2_aspect[s->aspect_ratio_info];
}
}//MPEG-2
@@ -1513,15 +1292,15 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
/* Quantization matrices may need reordering
* if DCT permutation is changed. */
- memcpy(old_permutation, s->dsp.idct_permutation, 64 * sizeof(uint8_t));
+ memcpy(old_permutation,s->dsp.idct_permutation,64*sizeof(uint8_t));
- if(MPV_common_init(s) < 0)
+ if (MPV_common_init(s) < 0)
return -2;
- quant_matrix_rebuild(s->intra_matrix, old_permutation, s->dsp.idct_permutation);
- quant_matrix_rebuild(s->inter_matrix, old_permutation, s->dsp.idct_permutation);
- quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->dsp.idct_permutation);
- quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->dsp.idct_permutation);
+ quant_matrix_rebuild(s->intra_matrix, old_permutation,s->dsp.idct_permutation);
+ quant_matrix_rebuild(s->inter_matrix, old_permutation,s->dsp.idct_permutation);
+ quant_matrix_rebuild(s->chroma_intra_matrix,old_permutation,s->dsp.idct_permutation);
+ quant_matrix_rebuild(s->chroma_inter_matrix,old_permutation,s->dsp.idct_permutation);
s1->mpeg_enc_ctx_allocated = 1;
}
@@ -1535,34 +1314,32 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
MpegEncContext *s = &s1->mpeg_enc_ctx;
int ref, f_code, vbv_delay;
- init_get_bits(&s->gb, buf, buf_size * 8);
+ init_get_bits(&s->gb, buf, buf_size*8);
ref = get_bits(&s->gb, 10); /* temporal ref */
s->pict_type = get_bits(&s->gb, 3);
if(s->pict_type == 0 || s->pict_type > 3)
return -1;
- vbv_delay = get_bits(&s->gb, 16);
- if(s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE)
- {
+ vbv_delay= get_bits(&s->gb, 16);
+ if (s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE) {
s->full_pel[0] = get_bits1(&s->gb);
f_code = get_bits(&s->gb, 3);
- if(f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
+ if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
return -1;
s->mpeg_f_code[0][0] = f_code;
s->mpeg_f_code[0][1] = f_code;
}
- if(s->pict_type == FF_B_TYPE)
- {
+ if (s->pict_type == FF_B_TYPE) {
s->full_pel[1] = get_bits1(&s->gb);
f_code = get_bits(&s->gb, 3);
- if(f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
+ if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
return -1;
s->mpeg_f_code[1][0] = f_code;
s->mpeg_f_code[1][1] = f_code;
}
- s->current_picture.pict_type = s->pict_type;
- s->current_picture.key_frame = s->pict_type == FF_I_TYPE;
+ s->current_picture.pict_type= s->pict_type;
+ s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
if(avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type);
@@ -1574,13 +1351,13 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
{
- MpegEncContext *s = &s1->mpeg_enc_ctx;
+ MpegEncContext *s= &s1->mpeg_enc_ctx;
int horiz_size_ext, vert_size_ext;
int bit_rate_ext;
skip_bits(&s->gb, 1); /* profile and level esc*/
- s->avctx->profile = get_bits(&s->gb, 3);
- s->avctx->level = get_bits(&s->gb, 4);
+ s->avctx->profile= get_bits(&s->gb, 3);
+ s->avctx->level= get_bits(&s->gb, 4);
s->progressive_sequence = get_bits1(&s->gb); /* progressive_sequence */
s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */
horiz_size_ext = get_bits(&s->gb, 2);
@@ -1590,13 +1367,13 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
bit_rate_ext = get_bits(&s->gb, 12); /* XXX: handle it */
s->bit_rate += (bit_rate_ext << 18) * 400;
skip_bits1(&s->gb); /* marker */
- s->avctx->rc_buffer_size += get_bits(&s->gb, 8) * 1024 * 16 << 10;
+ s->avctx->rc_buffer_size += get_bits(&s->gb, 8)*1024*16<<10;
s->low_delay = get_bits1(&s->gb);
- if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1;
+ if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1;
- s1->frame_rate_ext.num = get_bits(&s->gb, 2) + 1;
- s1->frame_rate_ext.den = get_bits(&s->gb, 5) + 1;
+ s1->frame_rate_ext.num = get_bits(&s->gb, 2)+1;
+ s1->frame_rate_ext.den = get_bits(&s->gb, 5)+1;
// ffdshow custom code begin (moved from mpeg_decode_postinit)
// MPEG-2 fps
av_reduce(
@@ -1604,11 +1381,11 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
&s->avctx->time_base.num,
ff_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num,
ff_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
- 1 << 30);
+ 1<<30);
// ffdshow custom code end
dprintf(s->avctx, "sequence extension\n");
- s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG2VIDEO;
+ s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
s->avctx->sub_id = 2; /* indicates MPEG-2 found */
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
@@ -1619,24 +1396,23 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
{
- MpegEncContext *s = &s1->mpeg_enc_ctx;
+ MpegEncContext *s= &s1->mpeg_enc_ctx;
int color_description, w, h;
skip_bits(&s->gb, 3); /* video format */
- color_description = get_bits1(&s->gb);
- if(color_description)
- {
- s->avctx->color_primaries = get_bits(&s->gb, 8);
+ color_description= get_bits1(&s->gb);
+ if(color_description){
+ s->avctx->color_primaries= get_bits(&s->gb, 8);
s->avctx->color_trc = get_bits(&s->gb, 8);
s->avctx->colorspace = get_bits(&s->gb, 8);
}
- w = get_bits(&s->gb, 14);
+ w= get_bits(&s->gb, 14);
skip_bits(&s->gb, 1); //marker
- h = get_bits(&s->gb, 14);
+ h= get_bits(&s->gb, 14);
skip_bits(&s->gb, 1); //marker
- s1->pan_scan.width = 16 * w;
- s1->pan_scan.height = 16 * h;
+ s1->pan_scan.width= 16*w;
+ s1->pan_scan.height=16*h;
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h);
@@ -1644,61 +1420,51 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
{
- MpegEncContext *s = &s1->mpeg_enc_ctx;
- int i, nofco;
+ MpegEncContext *s= &s1->mpeg_enc_ctx;
+ int i,nofco;
nofco = 1;
- if(s->progressive_sequence)
- {
- if(s->repeat_first_field)
- {
+ if(s->progressive_sequence){
+ if(s->repeat_first_field){
nofco++;
if(s->top_field_first)
nofco++;
}
- }
- else
- {
- if(s->picture_structure == PICT_FRAME)
- {
+ }else{
+ if(s->picture_structure == PICT_FRAME){
nofco++;
if(s->repeat_first_field)
nofco++;
}
}
- for(i = 0; i < nofco; i++)
- {
- s1->pan_scan.position[i][0] = get_sbits(&s->gb, 16);
+ for(i=0; i<nofco; i++){
+ s1->pan_scan.position[i][0]= get_sbits(&s->gb, 16);
skip_bits(&s->gb, 1); //marker
- s1->pan_scan.position[i][1] = get_sbits(&s->gb, 16);
+ s1->pan_scan.position[i][1]= get_sbits(&s->gb, 16);
skip_bits(&s->gb, 1); //marker
}
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "pde (%d,%d) (%d,%d) (%d,%d)\n",
- s1->pan_scan.position[0][0], s1->pan_scan.position[0][1],
- s1->pan_scan.position[1][0], s1->pan_scan.position[1][1],
- s1->pan_scan.position[2][0], s1->pan_scan.position[2][1]
- );
+ s1->pan_scan.position[0][0], s1->pan_scan.position[0][1],
+ s1->pan_scan.position[1][0], s1->pan_scan.position[1][1],
+ s1->pan_scan.position[2][0], s1->pan_scan.position[2][1]
+ );
}
-static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], uint16_t matrix2[64], int intra, int ffdshow_custom)
-{
+static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], uint16_t matrix2[64], int intra, int ffdshow_custom){
int i;
- for(i = 0; i < 64; i++)
- {
+ for(i=0; i<64; i++) {
int j = s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
int v = get_bits(&s->gb, 8);
- if(v == 0)
- {
+ if(v==0){
av_log(s->avctx, AV_LOG_ERROR, "matrix damaged\n");
return -1;
}
- if(intra && i == 0 && v != 8)
- {
+ if(intra && i==0 && v!=8){
av_log(s->avctx, AV_LOG_ERROR, "intra matrix invalid, ignoring\n");
- v = 8; // needed by pink.mpg / issue1046
+ v= 8; // needed by pink.mpg / issue1046
}
matrix0[j] = v;
if(matrix1)
@@ -1721,27 +1487,24 @@ static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
{
- MpegEncContext *s = &s1->mpeg_enc_ctx;
+ MpegEncContext *s= &s1->mpeg_enc_ctx;
s->full_pel[0] = s->full_pel[1] = 0;
s->mpeg_f_code[0][0] = get_bits(&s->gb, 4);
s->mpeg_f_code[0][1] = get_bits(&s->gb, 4);
s->mpeg_f_code[1][0] = get_bits(&s->gb, 4);
s->mpeg_f_code[1][1] = get_bits(&s->gb, 4);
- if(!s->pict_type && s1->mpeg_enc_ctx_allocated)
- {
+ if(!s->pict_type && s1->mpeg_enc_ctx_allocated){
av_log(s->avctx, AV_LOG_ERROR, "Missing picture start code, guessing missing values\n");
- if(s->mpeg_f_code[1][0] == 15 && s->mpeg_f_code[1][1] == 15)
- {
+ if(s->mpeg_f_code[1][0] == 15 && s->mpeg_f_code[1][1]==15){
if(s->mpeg_f_code[0][0] == 15 && s->mpeg_f_code[0][1] == 15)
- s->pict_type = FF_I_TYPE;
+ s->pict_type= FF_I_TYPE;
else
- s->pict_type = FF_P_TYPE;
- }
- else
- s->pict_type = FF_B_TYPE;
- s->current_picture.pict_type = s->pict_type;
- s->current_picture.key_frame = s->pict_type == FF_I_TYPE;
+ s->pict_type= FF_P_TYPE;
+ }else
+ s->pict_type= FF_B_TYPE;
+ s->current_picture.pict_type= s->pict_type;
+ s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
}
s->intra_dc_precision = get_bits(&s->gb, 2);
s->picture_structure = get_bits(&s->gb, 2);
@@ -1755,43 +1518,34 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
s->chroma_420_type = get_bits1(&s->gb);
s->progressive_frame = get_bits1(&s->gb);
- if(s->progressive_sequence && !s->progressive_frame)
- {
- s->progressive_frame = 1;
+ if(s->progressive_sequence && !s->progressive_frame){
+ s->progressive_frame= 1;
av_log(s->avctx, AV_LOG_ERROR, "interlaced frame in progressive sequence, ignoring\n");
}
- if(s->picture_structure == 0 || (s->progressive_frame && s->picture_structure != PICT_FRAME))
- {
+ if(s->picture_structure==0 || (s->progressive_frame && s->picture_structure!=PICT_FRAME)){
av_log(s->avctx, AV_LOG_ERROR, "picture_structure %d invalid, ignoring\n", s->picture_structure);
- s->picture_structure = PICT_FRAME;
+ s->picture_structure= PICT_FRAME;
}
- if(s->progressive_sequence && !s->frame_pred_frame_dct)
- {
+ 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;
+ s->frame_pred_frame_dct= 1;
}
- if(s->picture_structure == PICT_FRAME)
- {
- s->first_field = 0;
- s->v_edge_pos = 16 * s->mb_height;
- }
- else
- {
+ if(s->picture_structure == PICT_FRAME){
+ s->first_field=0;
+ s->v_edge_pos= 16*s->mb_height;
+ }else{
s->first_field ^= 1;
- s->v_edge_pos = 8 * s->mb_height;
- memset(s->mbskip_table, 0, s->mb_stride * s->mb_height);
+ s->v_edge_pos= 8*s->mb_height;
+ memset(s->mbskip_table, 0, s->mb_stride*s->mb_height);
}
- if(s->alternate_scan)
- {
+ if(s->alternate_scan){
ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_alternate_vertical_scan);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_alternate_vertical_scan);
- }
- else
- {
+ }else{
ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_zigzag_direct);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_zigzag_direct);
}
@@ -1808,23 +1562,20 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
dprintf(s->avctx, "progressive_frame=%d\n", s->progressive_frame);
}
-static void exchange_uv(MpegEncContext *s)
-{
- DCTELEM(*tmp)[64];
+static void exchange_uv(MpegEncContext *s){
+ DCTELEM (*tmp)[64];
tmp = s->pblocks[4];
s->pblocks[4] = s->pblocks[5];
s->pblocks[5] = tmp;
}
-static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
-{
- AVCodecContext *avctx = s->avctx;
+static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size){
+ AVCodecContext *avctx= s->avctx;
Mpeg1Context *s1 = (Mpeg1Context*)s;
/* start frame decoding */
- if(s->first_field || s->picture_structure == PICT_FRAME)
- {
+ if(s->first_field || s->picture_structure==PICT_FRAME){
if(MPV_frame_start(s, avctx) < 0)
return -1;
@@ -1833,41 +1584,32 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
/* first check if we must repeat the frame */
s->current_picture_ptr->repeat_pict = 0;
- if(s->repeat_first_field)
- {
- if(s->progressive_sequence)
- {
- if(s->top_field_first)
+ if (s->repeat_first_field) {
+ if (s->progressive_sequence) {
+ if (s->top_field_first)
s->current_picture_ptr->repeat_pict = 4;
else
s->current_picture_ptr->repeat_pict = 2;
- }
- else if(s->progressive_frame)
- {
+ } else if (s->progressive_frame) {
s->current_picture_ptr->repeat_pict = 1;
}
}
- *s->current_picture_ptr->pan_scan = s1->pan_scan;
- }
- else //second field
- {
- int i;
+ *s->current_picture_ptr->pan_scan= s1->pan_scan;
+ }else{ //second field
+ int i;
- if(!s->current_picture_ptr)
- {
- av_log(s->avctx, AV_LOG_ERROR, "first field missing\n");
- return -1;
- }
+ if(!s->current_picture_ptr){
+ av_log(s->avctx, AV_LOG_ERROR, "first field missing\n");
+ return -1;
+ }
- for(i = 0; i < 4; i++)
- {
- s->current_picture.data[i] = s->current_picture_ptr->data[i];
- if(s->picture_structure == PICT_BOTTOM_FIELD)
- {
- s->current_picture.data[i] += s->current_picture_ptr->linesize[i];
+ for(i=0; i<4; i++){
+ s->current_picture.data[i] = s->current_picture_ptr->data[i];
+ if(s->picture_structure == PICT_BOTTOM_FIELD){
+ s->current_picture.data[i] += s->current_picture_ptr->linesize[i];
+ }
}
- }
}
return 0;
@@ -1885,147 +1627,124 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
const uint8_t **buf, int buf_size)
{
MpegEncContext *s = &s1->mpeg_enc_ctx;
- AVCodecContext *avctx = s->avctx;
- const int field_pic = s->picture_structure != PICT_FRAME;
- const int lowres = s->avctx->lowres;
+ AVCodecContext *avctx= s->avctx;
+ const int field_pic= s->picture_structure != PICT_FRAME;
+ const int lowres= s->avctx->lowres;
- s->resync_mb_x =
- s->resync_mb_y = -1;
+ s->resync_mb_x=
+ s->resync_mb_y= -1;
assert(mb_y < s->mb_height);
- init_get_bits(&s->gb, *buf, buf_size * 8);
+ init_get_bits(&s->gb, *buf, buf_size*8);
ff_mpeg1_clean_buffers(s);
s->interlaced_dct = 0;
- // ==> Start patch MPC
- // DXVA need raw syntax element
- if(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
- s->qscale = get_bits(&s->gb, 5);
- else
- s->qscale = get_qscale(s);
- // <== End patch MPC
+ // ==> Start patch MPC
+ // DXVA need raw syntax element
+ if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ s->qscale = get_bits(&s->gb, 5);
+ else
+ s->qscale = get_qscale(s);
+ // <== End patch MPC
- if(s->qscale == 0)
- {
+ if(s->qscale == 0){
av_log(s->avctx, AV_LOG_ERROR, "qscale == 0\n");
return -1;
}
/* extra slice info */
- while(get_bits1(&s->gb) != 0)
- {
+ while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
}
- // ==> Start patch MPC
- if(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
- {
- // Fill DXVA structure and return
- // s1->pSliceInfo[s1->slice_count].wHorizontalPosition = // TODO : horizontal ?
- s1->pSliceInfo[s1->slice_count].wVerticalPosition = s1->slice_count;
- s1->pSliceInfo[s1->slice_count].wMBbitOffset = s->gb.index + 32; // Current pos + Slice Start Code
- s1->pSliceInfo[s1->slice_count].wNumberMBsInSlice = s->mb_width;
- s1->pSliceInfo[s1->slice_count].wQuantizerScaleCode = s->qscale;// >> 1;
- s1->pSliceInfo[s1->slice_count].dwSliceBitsInBuffer = (buf_size * 8) + 32;
-
- if(s1->slice_count > 0)
- {
- s1->pSliceInfo[s1->slice_count-1].dwSliceBitsInBuffer = (*buf - s1->prev_slice) * 8;
- s1->pSliceInfo[s1->slice_count].dwSliceDataLocation = s1->pSliceInfo[s1->slice_count-1].dwSliceDataLocation +
- s1->pSliceInfo[s1->slice_count-1].dwSliceBitsInBuffer / 8;
- }
+ // ==> Start patch MPC
+ if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ {
+ // Fill DXVA structure and return
+ // s1->pSliceInfo[s1->slice_count].wHorizontalPosition = // TODO : horizontal ?
+ s1->pSliceInfo[s1->slice_count].wVerticalPosition = s1->slice_count;
+ s1->pSliceInfo[s1->slice_count].wMBbitOffset = s->gb.index + 32; // Current pos + Slice Start Code
+ s1->pSliceInfo[s1->slice_count].wNumberMBsInSlice = s->mb_width;
+ s1->pSliceInfo[s1->slice_count].wQuantizerScaleCode = s->qscale;// >> 1;
+ s1->pSliceInfo[s1->slice_count].dwSliceBitsInBuffer = (buf_size*8)+32;
- s1->prev_slice = (uint8_t*) * buf;
- s1->slice_count++;
+ if (s1->slice_count>0)
+ {
+ s1->pSliceInfo[s1->slice_count-1].dwSliceBitsInBuffer = (*buf - s1->prev_slice)*8;
+ s1->pSliceInfo[s1->slice_count].dwSliceDataLocation = s1->pSliceInfo[s1->slice_count-1].dwSliceDataLocation +
+ s1->pSliceInfo[s1->slice_count-1].dwSliceBitsInBuffer/8;
+ }
- return 0;
- }
- // <== End patch MPC
+ s1->prev_slice = (uint8_t*)*buf;
+ s1->slice_count++;
- s->mb_x = 0;
+ return 0;
+ }
+ // <== End patch MPC
- if(mb_y == 0 && s->codec_tag == AV_RL32("SLIF"))
- {
+ s->mb_x=0;
+
+ if(mb_y==0 && s->codec_tag == AV_RL32("SLIF")){
skip_bits1(&s->gb);
- }
- else
- {
- for(;;)
- {
+ }else{
+ for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0){
av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");
return -1;
}
- if(code >= 33)
- {
- if(code == 33)
- {
+ if (code >= 33) {
+ if (code == 33) {
s->mb_x += 33;
}
/* otherwise, stuffing, nothing to do */
- }
- else
- {
+ } else {
s->mb_x += code;
break;
}
}
}
- if(s->mb_x >= (unsigned)s->mb_width)
- {
+ if(s->mb_x >= (unsigned)s->mb_width){
av_log(s->avctx, AV_LOG_ERROR, "initial skip overflow\n");
return -1;
}
- s->resync_mb_x = s->mb_x;
- s->resync_mb_y = s->mb_y = mb_y;
- s->mb_skip_run = 0;
+ s->resync_mb_x= s->mb_x;
+ s->resync_mb_y= s->mb_y= mb_y;
+ s->mb_skip_run= 0;
ff_init_block_index(s);
- if(s->mb_y == 0 && s->mb_x == 0 && (s->first_field || s->picture_structure == PICT_FRAME))
- {
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
- av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
- s->qscale, s->mpeg_f_code[0][0], s->mpeg_f_code[0][1], s->mpeg_f_code[1][0], s->mpeg_f_code[1][1],
- s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
- s->progressive_sequence ? "ps" : "", s->progressive_frame ? "pf" : "", s->alternate_scan ? "alt" : "", s->top_field_first ? "top" : "",
- s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,
- s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" : "");
+ if (s->mb_y==0 && s->mb_x==0 && (s->first_field || s->picture_structure==PICT_FRAME)) {
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
+ av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
+ s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
+ s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
+ s->progressive_sequence ? "ps" :"", s->progressive_frame ? "pf" : "", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"",
+ s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,
+ s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :"");
}
}
- for(;;)
- {
+ for(;;) {
if(mpeg_decode_mb(s, s->block) < 0)
return -1;
- if(s->current_picture.motion_val[0] && !s->encoding) //note motion_val is normally NULL unless we want to extract the MVs
- {
+ if(s->current_picture.motion_val[0] && !s->encoding){ //note motion_val is normally NULL unless we want to extract the MVs
const int wrap = s->b8_stride;
- int xy = s->mb_x * 2 + s->mb_y * 2 * wrap;
+ int xy = s->mb_x*2 + s->mb_y*2*wrap;
int motion_x, motion_y, dir, i;
- for(i = 0; i < 2; i++)
- {
- for(dir = 0; dir < 2; dir++)
- {
- if(s->mb_intra || (dir == 1 && s->pict_type != FF_B_TYPE))
- {
+ for(i=0; i<2; i++){
+ for(dir=0; dir<2; dir++){
+ if (s->mb_intra || (dir==1 && s->pict_type != FF_B_TYPE)) {
motion_x = motion_y = 0;
- }
- else if(s->mv_type == MV_TYPE_16X16 || (s->mv_type == MV_TYPE_FIELD && field_pic))
- {
+ }else if (s->mv_type == MV_TYPE_16X16 || (s->mv_type == MV_TYPE_FIELD && field_pic)){
motion_x = s->mv[dir][0][0];
motion_y = s->mv[dir][0][1];
- }
- else /*if ((s->mv_type == MV_TYPE_FIELD) || (s->mv_type == MV_TYPE_16X8))*/
- {
+ } else /*if ((s->mv_type == MV_TYPE_FIELD) || (s->mv_type == MV_TYPE_16X8))*/ {
motion_x = s->mv[dir][i][0];
motion_y = s->mv[dir][i][1];
}
@@ -2034,43 +1753,39 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
s->current_picture.motion_val[dir][xy ][1] = motion_y;
s->current_picture.motion_val[dir][xy + 1][0] = motion_x;
s->current_picture.motion_val[dir][xy + 1][1] = motion_y;
- s->current_picture.ref_index [dir][xy ] =
- s->current_picture.ref_index [dir][xy + 1] = s->field_select[dir][i];
- assert(s->field_select[dir][i] == 0 || s->field_select[dir][i] == 1);
+ s->current_picture.ref_index [dir][xy ]=
+ s->current_picture.ref_index [dir][xy + 1]= s->field_select[dir][i];
+ assert(s->field_select[dir][i]==0 || s->field_select[dir][i]==1);
}
xy += wrap;
}
}
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[1] +=(16 >> lowres) >> s->chroma_x_shift;
+ s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;
MPV_decode_mb(s, s->block);
- if(++s->mb_x >= s->mb_width)
- {
- const int mb_size = 16 >> s->avctx->lowres;
+ if (++s->mb_x >= s->mb_width) {
+ const int mb_size= 16>>s->avctx->lowres;
- ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);
+ ff_draw_horiz_band(s, mb_size*(s->mb_y>>field_pic), mb_size);
s->mb_x = 0;
- s->mb_y += 1 << field_pic;
+ s->mb_y += 1<<field_pic;
- if(s->mb_y >= s->mb_height)
- {
- int left = get_bits_left(&s->gb);
- int is_d10 = s->chroma_format == 2 && s->pict_type == FF_I_TYPE && avctx->profile == 0 && avctx->level == 5
- && s->intra_dc_precision == 2 && s->q_scale_type == 1 && s->alternate_scan == 0
- && s->progressive_frame == 0 /* vbv_delay == 0xBBB || 0xE10*/;
+ if(s->mb_y >= s->mb_height){
+ int left= get_bits_left(&s->gb);
+ int is_d10= s->chroma_format==2 && s->pict_type==FF_I_TYPE && avctx->profile==0 && avctx->level==5
+ && s->intra_dc_precision == 2 && s->q_scale_type == 1 && s->alternate_scan == 0
+ && s->progressive_frame == 0 /* vbv_delay == 0xBBB || 0xE10*/;
if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)) && !is_d10)
- || (avctx->error_recognition >= FF_ER_AGGRESSIVE && left > 8))
- {
+ || (avctx->error_recognition >= FF_ER_AGGRESSIVE && left>8)){
av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n", left, show_bits(&s->gb, FFMIN(left, 23)));
return -1;
- }
- else
+ }else
goto eos;
}
@@ -2078,69 +1793,54 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
}
/* skip mb handling */
- if(s->mb_skip_run == -1)
- {
+ if (s->mb_skip_run == -1) {
/* read increment again */
s->mb_skip_run = 0;
- for(;;)
- {
+ for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0){
av_log(s->avctx, AV_LOG_ERROR, "mb incr damaged\n");
return -1;
}
- if(code >= 33)
- {
- if(code == 33)
- {
+ if (code >= 33) {
+ if (code == 33) {
s->mb_skip_run += 33;
- }
- else if(code == 35)
- {
- if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0)
- {
+ }else if(code == 35){
+ if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0){
av_log(s->avctx, AV_LOG_ERROR, "slice mismatch\n");
return -1;
}
goto eos; /* end of slice */
}
/* otherwise, stuffing, nothing to do */
- }
- else
- {
+ } else {
s->mb_skip_run += code;
break;
}
}
- if(s->mb_skip_run)
- {
+ if(s->mb_skip_run){
int i;
- if(s->pict_type == FF_I_TYPE)
- {
+ if(s->pict_type == FF_I_TYPE){
av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
/* skip mb */
s->mb_intra = 0;
- for(i = 0; i < 12; i++)
+ for(i=0;i<12;i++)
s->block_last_index[i] = -1;
if(s->picture_structure == PICT_FRAME)
s->mv_type = MV_TYPE_16X16;
else
s->mv_type = MV_TYPE_FIELD;
- if(s->pict_type == FF_P_TYPE)
- {
+ if (s->pict_type == FF_P_TYPE) {
/* if P type, zero motion vector is implied */
s->mv_dir = MV_DIR_FORWARD;
s->mv[0][0][0] = s->mv[0][0][1] = 0;
s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0;
s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0;
- s->field_select[0][0] = (s->picture_structure - 1) & 1;
- }
- else
- {
+ s->field_select[0][0]= (s->picture_structure - 1) & 1;
+ } else {
/* if B type, reuse previous vectors and directions */
s->mv[0][0][0] = s->last_mv[0][0][0];
s->mv[0][0][1] = s->last_mv[0][0][1];
@@ -2151,45 +1851,40 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
}
}
eos: // end of slice
- *buf += (get_bits_count(&s->gb) - 1) / 8;
+ *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);
return 0;
}
-static int slice_decode_thread(AVCodecContext *c, void *arg)
-{
- MpegEncContext *s = *(void**)arg;
- const uint8_t *buf = s->gb.buffer;
- int mb_y = s->start_mb_y;
- const int field_pic = s->picture_structure != PICT_FRAME;
+static int slice_decode_thread(AVCodecContext *c, void *arg){
+ MpegEncContext *s= *(void**)arg;
+ const uint8_t *buf= s->gb.buffer;
+ int mb_y= s->start_mb_y;
+ const int field_pic= s->picture_structure != PICT_FRAME;
- s->error_count = (3 * (s->end_mb_y - s->start_mb_y) * s->mb_width) >> field_pic;
+ s->error_count= (3*(s->end_mb_y - s->start_mb_y)*s->mb_width) >> field_pic;
- for(;;)
- {
+ for(;;){
uint32_t start_code;
int ret;
- ret = mpeg_decode_slice((Mpeg1Context*)s, mb_y, &buf, s->gb.buffer_end - buf);
+ ret= mpeg_decode_slice((Mpeg1Context*)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);
- if(ret < 0)
- {
- if(s->resync_mb_x >= 0 && s->resync_mb_y >= 0)
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, AC_ERROR | DC_ERROR | MV_ERROR);
- }
- else
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, AC_END | DC_END | MV_END);
+ if(ret < 0){
+ if(s->resync_mb_x>=0 && s->resync_mb_y>=0)
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
+ }else{
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
}
if(s->mb_y == s->end_mb_y)
return 0;
- start_code = -1;
+ start_code= -1;
buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code);
- mb_y = start_code - SLICE_MIN_START_CODE;
+ mb_y= start_code - SLICE_MIN_START_CODE;
if(mb_y < 0 || mb_y >= s->end_mb_y)
return -1;
}
@@ -2206,44 +1901,37 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
- if(!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr)
+ if (!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr)
return 0;
/* end of slice reached */
- if(/*s->mb_y<<field_pic == s->mb_height &&*/ !s->first_field)
- {
+ if (/*s->mb_y<<field_pic == s->mb_height &&*/ !s->first_field) {
/* end of image */
- s->current_picture_ptr->qscale_type = FF_QSCALE_TYPE_MPEG2;
+ s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_MPEG2;
- // ==> Start patch MPC
- if(!s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
- ff_er_frame_end(s);
- // <== End patch MPC
+ // ==> Start patch MPC
+ if (!s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ ff_er_frame_end(s);
+ // <== End patch MPC
MPV_frame_end(s);
- if(s->pict_type == FF_B_TYPE || s->low_delay)
- {
- *pict = *(AVFrame*)s->current_picture_ptr;
+ if (s->pict_type == FF_B_TYPE || s->low_delay) {
+ *pict= *(AVFrame*)s->current_picture_ptr;
ff_print_debug_info(s, pict);
- }
- else
- {
+ } else {
s->picture_number++;
/* 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;
- ff_print_debug_info(s, pict);
+ if (s->last_picture_ptr != NULL) {
+ *pict= *(AVFrame*)s->last_picture_ptr;
+ ff_print_debug_info(s, pict);
}
}
return 1;
- }
- else
- {
+ } else {
return 0;
}
}
@@ -2253,68 +1941,58 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
{
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
- int width, height;
+ int width,height;
int i, v, j;
- init_get_bits(&s->gb, buf, buf_size * 8);
+ init_get_bits(&s->gb, buf, buf_size*8);
width = get_bits(&s->gb, 12);
height = get_bits(&s->gb, 12);
- if(width <= 0 || height <= 0)
+ if (width <= 0 || height <= 0)
return -1;
- s->aspect_ratio_info = get_bits(&s->gb, 4);
- if(s->aspect_ratio_info == 0)
- {
+ s->aspect_ratio_info= get_bits(&s->gb, 4);
+ if (s->aspect_ratio_info == 0) {
av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n");
- if(avctx->error_recognition >= FF_ER_COMPLIANT)
+ if (avctx->error_recognition >= FF_ER_COMPLIANT)
return -1;
}
s->frame_rate_index = get_bits(&s->gb, 4);
- if(s->frame_rate_index == 0 || s->frame_rate_index > 13)
+ if (s->frame_rate_index == 0 || s->frame_rate_index > 13)
return -1;
s->bit_rate = get_bits(&s->gb, 18) * 400;
- if(get_bits1(&s->gb) == 0) /* marker */
+ if (get_bits1(&s->gb) == 0) /* marker */
return -1;
s->width = width;
s->height = height;
- s->avctx->rc_buffer_size = get_bits(&s->gb, 10) * 1024 * 16;
+ s->avctx->rc_buffer_size= get_bits(&s->gb, 10) * 1024*16;
skip_bits(&s->gb, 1);
/* get matrix */
- if(get_bits1(&s->gb))
- {
+ if (get_bits1(&s->gb)) {
load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, s->avctx->intra_matrix, 1, 1);
- }
- else
- {
- for(i = 0; i < 64; i++)
- {
+ } else {
+ for(i=0;i<64;i++) {
j = s->dsp.idct_permutation[i];
v = ff_mpeg1_default_intra_matrix[i];
- s->avctx->intra_matrix[i] = v;
+ s->avctx->intra_matrix[i]=v;
s->intra_matrix[j] = v;
s->chroma_intra_matrix[j] = v;
}
}
- if(get_bits1(&s->gb))
- {
+ if (get_bits1(&s->gb)) {
load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, s->avctx->inter_matrix, 0, 1);
- }
- else
- {
- for(i = 0; i < 64; i++)
- {
- int j = s->dsp.idct_permutation[i];
+ } else {
+ for(i=0;i<64;i++) {
+ int j= s->dsp.idct_permutation[i];
v = ff_mpeg1_default_non_intra_matrix[i];
- s->avctx->inter_matrix[i] = v;
+ s->avctx->inter_matrix[i]=v;
s->inter_matrix[j] = v;
s->chroma_inter_matrix[j] = v;
}
}
- if(show_bits(&s->gb, 23) != 0)
- {
+ if(show_bits(&s->gb, 23) != 0){
av_log(s->avctx, AV_LOG_ERROR, "sequence header damaged\n");
return -1;
}
@@ -2325,11 +2003,11 @@ 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;
+ s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG1VIDEO;
avctx->sub_id = 1; /* indicates MPEG-1 */
s->out_format = FMT_MPEG1;
s->swap_uv = 0;//AFAIK VCR2 does not have SEQ_HEADER
- if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1;
+ if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1;
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%d\n",
@@ -2346,26 +2024,24 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
/* start new MPEG-1 context decoding */
s->out_format = FMT_MPEG1;
- if(s1->mpeg_enc_ctx_allocated)
- {
+ if (s1->mpeg_enc_ctx_allocated) {
MPV_common_end(s);
}
s->width = avctx->coded_width;
s->height = avctx->coded_height;
- avctx->has_b_frames = 0; //true?
- s->low_delay = 1;
+ avctx->has_b_frames= 0; //true?
+ s->low_delay= 1;
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
- if(MPV_common_init(s) < 0)
+ if (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
s1->mpeg_enc_ctx_allocated = 1;
- for(i = 0; i < 64; i++)
- {
- int j = s->dsp.idct_permutation[i];
+ for(i=0;i<64;i++) {
+ int j= s->dsp.idct_permutation[i];
v = ff_mpeg1_default_intra_matrix[i];
s->intra_matrix[j] = v;
s->chroma_intra_matrix[j] = v;
@@ -2380,7 +2056,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;
+ s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
avctx->sub_id = 2; /* indicates MPEG-2 */
s1->save_width = s->width;
s1->save_height = s->height;
@@ -2393,29 +2069,25 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
const uint8_t *p, int buf_size)
{
const uint8_t *buf = p;
- const uint8_t *buf_end = p + buf_size;
+ const uint8_t *buf_end = p+buf_size;
/* we parse the DTG active format information */
- if(buf_end - p >= 5 &&
- p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1')
- {
+ if (buf_end - p >= 5 &&
+ p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1') {
int flags = p[4];
p += 5;
- if(flags & 0x80)
- {
+ if (flags & 0x80) {
/* skip event id */
p += 2;
}
- if(flags & 0x40)
- {
- if(buf_end - p < 1)
+ if (flags & 0x40) {
+ if (buf_end - p < 1)
return;
avctx->dtg_active_format = p[0] & 0x0f;
}
}
/* ffdshow custom code */
- else if(avctx->handle_user_data)
- {
+ else if (avctx->handle_user_data) {
uint32_t state;
uint8_t *user_data_end = ff_find_start_code(buf, buf + buf_size, &state);
avctx->handle_user_data(avctx, buf, user_data_end - buf);
@@ -2423,8 +2095,7 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
}
static void mpeg_decode_gop(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size)
-{
+ const uint8_t *buf, int buf_size){
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -2433,15 +2104,15 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
int time_code_seconds, time_code_pictures;
int broken_link;
- init_get_bits(&s->gb, buf, buf_size * 8);
+ init_get_bits(&s->gb, buf, buf_size*8);
drop_frame_flag = get_bits1(&s->gb);
- time_code_hours = get_bits(&s->gb, 5);
- time_code_minutes = get_bits(&s->gb, 6);
+ time_code_hours=get_bits(&s->gb,5);
+ time_code_minutes = get_bits(&s->gb,6);
skip_bits1(&s->gb);//marker bit
- time_code_seconds = get_bits(&s->gb, 6);
- time_code_pictures = get_bits(&s->gb, 6);
+ time_code_seconds = get_bits(&s->gb,6);
+ time_code_pictures = get_bits(&s->gb,6);
s->closed_gop = get_bits1(&s->gb);
/*broken_link indicate that after editing the
@@ -2451,8 +2122,8 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "GOP (%2d:%02d:%02d.[%02d]) closed_gop=%d broken_link=%d\n",
- time_code_hours, time_code_minutes, time_code_seconds,
- time_code_pictures, s->closed_gop, broken_link);
+ time_code_hours, time_code_minutes, time_code_seconds,
+ time_code_pictures, s->closed_gop, broken_link);
}
/**
* Finds the end of the current frame in the bitstream.
@@ -2461,82 +2132,72 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s, int64_t *rtStart, AVCodecContext *avctx) /* rtStart,avctx: ffdshow custom code */
{
int i;
- uint32_t state = pc->state;
+ uint32_t state= pc->state;
/* EOF considered as end of frame */
- if(buf_size == 0)
+ if (buf_size == 0)
return 0;
- /*
- 0 frame start -> 1/4
- 1 first_SEQEXT -> 0/2
- 2 first field start -> 3/0
- 3 second_SEQEXT -> 2/0
- 4 searching end
- */
-
- for(i = 0; i < buf_size; i++)
- {
- assert(pc->frame_start_found >= 0 && pc->frame_start_found <= 4);
- if(pc->frame_start_found & 1)
- {
- if(state == EXT_START_CODE && (buf[i] & 0xF0) != 0x80)
+/*
+ 0 frame start -> 1/4
+ 1 first_SEQEXT -> 0/2
+ 2 first field start -> 3/0
+ 3 second_SEQEXT -> 2/0
+ 4 searching end
+*/
+
+ for(i=0; i<buf_size; i++){
+ assert(pc->frame_start_found>=0 && pc->frame_start_found<=4);
+ if(pc->frame_start_found&1){
+ if(state == EXT_START_CODE && (buf[i]&0xF0) != 0x80)
pc->frame_start_found--;
- else if(state == EXT_START_CODE + 2)
- {
- if((buf[i] & 3) == 3) pc->frame_start_found = 0;
- else pc->frame_start_found = (pc->frame_start_found + 1) & 3;
+ else if(state == EXT_START_CODE+2){
+ if((buf[i]&3) == 3) pc->frame_start_found= 0;
+ else pc->frame_start_found= (pc->frame_start_found+1)&3;
}
state++;
- }
- else
- {
- i = ff_find_start_code(buf + i, buf + buf_size, &state) - buf - 1;
- if(pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE)
- {
+ }else{
+ i= ff_find_start_code(buf+i, buf+buf_size, &state) - buf - 1;
+ if(pc->frame_start_found==0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE){
i++;
- pc->frame_start_found = 4;
-
- pc->rtStart = *rtStart; /* ffdshow custom code */
- *rtStart = _I64_MIN; /* ffdshow custom code */
+ pc->frame_start_found=4;
+
+ pc->rtStart=*rtStart; /* ffdshow custom code */
+ *rtStart=_I64_MIN; /* ffdshow custom code */
}
- if(state == SEQ_END_CODE)
- {
- pc->state = -1;
+ if(state == SEQ_END_CODE){
+ pc->state=-1;
/* ffdshow custom code (i-3 instead of i+1) */
/* DVDs won't send the next frame start on still images */
/* SEQ_END_CODE will have to stay at the beginning of the next frame */
- if(avctx->isDVD)
- return i - 3;
+ if (avctx->isDVD)
+ return i-3;
else
- return i + 1;
+ return i+1;
}
- if(pc->frame_start_found == 2 && state == SEQ_START_CODE)
- pc->frame_start_found = 0;
- if(pc->frame_start_found < 4 && state == EXT_START_CODE)
+ if(pc->frame_start_found==2 && state == SEQ_START_CODE)
+ pc->frame_start_found= 0;
+ if(pc->frame_start_found<4 && state == EXT_START_CODE)
pc->frame_start_found++;
- if(pc->frame_start_found == 4 && (state & 0xFFFFFF00) == 0x100)
- {
- if(state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE)
- {
- pc->frame_start_found = 0;
- pc->state = -1;
- return i - 3;
+ if(pc->frame_start_found == 4 && (state&0xFFFFFF00) == 0x100){
+ if(state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE){
+ pc->frame_start_found=0;
+ pc->state=-1;
+ return i-3;
}
}
- if(s && state == PICTURE_START_CODE)
- {
- ff_fetch_timestamp(s, i - 3, 1);
+ if(s && state == PICTURE_START_CODE){
+ ff_fetch_timestamp(s, i-3, 1);
}
}
}
- pc->state = state;
+ pc->state= state;
return END_NOT_FOUND;
}
static int decode_chunks(AVCodecContext *avctx,
- AVFrame *picture, int *data_size,
- const uint8_t *buf, int buf_size);
+ AVFrame *picture, int *data_size,
+ const uint8_t *buf, int buf_size);
/* handle buffering and image synchronisation */
static int mpeg_decode_frame(AVCodecContext *avctx,
@@ -2548,13 +2209,11 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
MpegEncContext *s2 = &s->mpeg_enc_ctx;
dprintf(avctx, "fill_buffer\n");
- if(buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE))
- {
+ 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;
+ if (s2->low_delay==0 && s2->next_picture_ptr) {
+ *picture= *(AVFrame*)s2->next_picture_ptr;
+ s2->next_picture_ptr= NULL;
picture->mpeg2_sequence_end_flag = 1; /* ffdshow custom code */
*data_size = sizeof(AVFrame);
@@ -2562,32 +2221,29 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
return buf_size;
}
- if(s2->flags & CODEC_FLAG_TRUNCATED)
- {
+ if(s2->flags&CODEC_FLAG_TRUNCATED){
int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL, avctx->parserRtStart, avctx); /* avctx->parserRtStart: ffdshow custom code */
- if(ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0)
+ if( ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
return buf_size;
}
#if 0
- if(s->repeat_field % 2 == 1)
- {
+ if (s->repeat_field % 2 == 1) {
s->repeat_field++;
//fprintf(stderr,"\nRepeating last frame: %d -> %d! pict: %d %d", avctx->frame_number-1, avctx->frame_number,
// s2->picture_number, s->repeat_field);
- if(avctx->flags & CODEC_FLAG_REPEAT_FIELD)
- {
+ if (avctx->flags & CODEC_FLAG_REPEAT_FIELD) {
*data_size = sizeof(AVPicture);
goto the_end;
}
}
#endif
- if(s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))
+ if(s->mpeg_enc_ctx_allocated==0 && avctx->codec_tag == AV_RL32("VCR2"))
vcr2_init_sequence(avctx);
- s->slice_count = 0;
+ s->slice_count= 0;
if(avctx->extradata && !avctx->frame_number)
decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
@@ -2596,100 +2252,82 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
}
static int decode_chunks(AVCodecContext *avctx,
- AVFrame *picture, int *data_size,
- const uint8_t *buf, int buf_size)
+ AVFrame *picture, int *data_size,
+ const uint8_t *buf, int buf_size)
{
Mpeg1Context *s = avctx->priv_data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
const uint8_t *buf_ptr = buf;
const uint8_t *buf_end = buf + buf_size;
int ret, input_size;
- int last_code = 0;
+ int last_code= 0;
- for(;;)
- {
+ for(;;) {
/* find next start code */
uint32_t start_code = -1;
- buf_ptr = ff_find_start_code(buf_ptr, buf_end, &start_code);
- if(start_code > 0x1ff)
- {
- if(s2->pict_type != FF_B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT)
- {
- if(avctx->thread_count > 1)
- {
+ buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code);
+ if (start_code > 0x1ff){
+ if(s2->pict_type != FF_B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){
+ if(avctx->thread_count > 1){
int i;
avctx->execute(avctx, slice_decode_thread, &s2->thread_context[0], NULL, s->slice_count, sizeof(void*));
- for(i = 0; i < s->slice_count; i++)
+ for(i=0; i<s->slice_count; i++)
s2->error_count += s2->thread_context[i]->error_count;
}
- if(slice_end(avctx, picture))
- {
+ 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);
}
}
- s2->pict_type = 0;
+ s2->pict_type= 0;
return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index);
}
input_size = buf_end - buf_ptr;
- if(avctx->debug & FF_DEBUG_STARTCODE)
- {
- av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr - buf, input_size);
+ if(avctx->debug & FF_DEBUG_STARTCODE){
+ av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr-buf, input_size);
}
/* prepare data for next start code */
- switch(start_code)
- {
+ switch(start_code) {
case SEQ_START_CODE:
- if(last_code == 0)
- {
- mpeg1_decode_sequence(avctx, buf_ptr,
- input_size);
- s->sync = 1;
- }
- else
- {
+ if(last_code == 0){
+ mpeg1_decode_sequence(avctx, buf_ptr,
+ input_size);
+ s->sync=1;
+ }else{
av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", last_code);
}
break;
case PICTURE_START_CODE:
- if(last_code == 0 || last_code == SLICE_MIN_START_CODE)
- {
- if(mpeg_decode_postinit(avctx) < 0)
- {
- av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n");
- return -1;
- }
+ if(last_code == 0 || last_code == SLICE_MIN_START_CODE){
+ if(mpeg_decode_postinit(avctx) < 0){
+ av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n");
+ return -1;
+ }
- /* we have a complete image: we try to decompress it */
- if(mpeg1_decode_picture(avctx,
- buf_ptr, input_size) < 0)
- s2->pict_type = 0;
+ /* we have a complete image: we try to decompress it */
+ if(mpeg1_decode_picture(avctx,
+ buf_ptr, input_size) < 0)
+ s2->pict_type=0;
s2->first_slice = 1;
- last_code = PICTURE_START_CODE;
- }
- else
- {
+ last_code= PICTURE_START_CODE;
+ }else{
av_log(avctx, AV_LOG_ERROR, "ignoring pic after %X\n", last_code);
}
break;
case EXT_START_CODE:
- init_get_bits(&s2->gb, buf_ptr, input_size * 8);
+ init_get_bits(&s2->gb, buf_ptr, input_size*8);
- switch(get_bits(&s2->gb, 4))
- {
+ switch(get_bits(&s2->gb, 4)) {
case 0x1:
- if(last_code == 0)
- {
- mpeg_decode_sequence_extension(s);
- }
- else
- {
+ if(last_code == 0){
+ mpeg_decode_sequence_extension(s);
+ }else{
av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", last_code);
}
break;
@@ -2703,12 +2341,9 @@ static int decode_chunks(AVCodecContext *avctx,
mpeg_decode_picture_display_extension(s);
break;
case 0x8:
- if(last_code == PICTURE_START_CODE)
- {
- mpeg_decode_picture_coding_extension(s);
- }
- else
- {
+ if(last_code == PICTURE_START_CODE){
+ mpeg_decode_picture_coding_extension(s);
+ }else{
av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", last_code);
}
break;
@@ -2716,122 +2351,104 @@ static int decode_chunks(AVCodecContext *avctx,
break;
case USER_START_CODE:
mpeg_decode_user_data(avctx,
- buf_ptr, input_size);
+ buf_ptr, input_size);
break;
case GOP_START_CODE:
- if(last_code == 0)
- {
- s2->first_field = 0;
- mpeg_decode_gop(avctx,
- buf_ptr, input_size);
- s->sync = 1;
- }
- else
- {
+ if(last_code == 0){
+ s2->first_field=0;
+ mpeg_decode_gop(avctx,
+ buf_ptr, input_size);
+ s->sync=1;
+ }else{
av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", last_code);
}
break;
default:
- if(start_code >= SLICE_MIN_START_CODE &&
- start_code <= SLICE_MAX_START_CODE && last_code != 0)
- {
- const int field_pic = s2->picture_structure != PICT_FRAME;
- int mb_y = (start_code - SLICE_MIN_START_CODE) << field_pic;
- last_code = SLICE_MIN_START_CODE;
+ if (start_code >= SLICE_MIN_START_CODE &&
+ start_code <= SLICE_MAX_START_CODE && last_code!=0) {
+ const int field_pic= s2->picture_structure != PICT_FRAME;
+ int mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
+ last_code= SLICE_MIN_START_CODE;
if(s2->picture_structure == PICT_BOTTOM_FIELD)
mb_y++;
- if(mb_y >= s2->mb_height)
- {
+ if (mb_y >= s2->mb_height){
av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
return -1;
}
- if(s2->last_picture_ptr == NULL)
- {
- /* Skip B-frames if we do not have reference frames and gop is not closed */
- if(s2->pict_type == FF_B_TYPE)
- {
+ if(s2->last_picture_ptr==NULL){
+ /* Skip B-frames if we do not have reference frames and gop is not closed */
+ if(s2->pict_type==FF_B_TYPE){
if(!s2->closed_gop)
break;
}
}
- if(s2->pict_type == FF_I_TYPE)
- s->sync = 1;
- if(s2->next_picture_ptr == NULL)
- {
- /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
- if(s2->pict_type == FF_P_TYPE && !s->sync) break;
+ if(s2->pict_type==FF_I_TYPE)
+ s->sync=1;
+ if(s2->next_picture_ptr==NULL){
+ /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
+ if(s2->pict_type==FF_P_TYPE && !s->sync) break;
}
/* Skip B-frames if we are in a hurry. */
- if(avctx->hurry_up && s2->pict_type == FF_B_TYPE) break;
- if((avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type != FF_I_TYPE)
- || avctx->skip_frame >= AVDISCARD_ALL)
+ if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
+ ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
+ || avctx->skip_frame >= AVDISCARD_ALL)
break;
/* Skip everything if we are in a hurry>=5. */
- if(avctx->hurry_up >= 5) break;
+ if(avctx->hurry_up>=5) break;
- if(!s->mpeg_enc_ctx_allocated) break;
+ if (!s->mpeg_enc_ctx_allocated) break;
- if(s2->codec_id == CODEC_ID_MPEG2VIDEO)
- {
+ if(s2->codec_id == CODEC_ID_MPEG2VIDEO){
if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom)
break;
}
- if(!s2->pict_type)
- {
+ if(!s2->pict_type){
av_log(avctx, AV_LOG_ERROR, "Missing picture start code\n");
break;
}
- if(s2->first_slice)
- {
- s2->first_slice = 0;
+ if(s2->first_slice){
+ s2->first_slice=0;
if(mpeg_field_start(s2, buf, buf_size) < 0)
return -1;
}
- if(!s2->current_picture_ptr)
- {
+ if(!s2->current_picture_ptr){
av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n");
return -1;
}
- if(avctx->thread_count > 1)
- {
- int threshold = (s2->mb_height * s->slice_count + avctx->thread_count / 2) / avctx->thread_count;
- if(threshold <= mb_y)
- {
- MpegEncContext *thread_context = s2->thread_context[s->slice_count];
+ if(avctx->thread_count > 1){
+ int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count;
+ if(threshold <= mb_y){
+ MpegEncContext *thread_context= s2->thread_context[s->slice_count];
- thread_context->start_mb_y = mb_y;
+ thread_context->start_mb_y= mb_y;
thread_context->end_mb_y = s2->mb_height;
- if(s->slice_count)
- {
- s2->thread_context[s->slice_count-1]->end_mb_y = mb_y;
+ if(s->slice_count){
+ s2->thread_context[s->slice_count-1]->end_mb_y= mb_y;
ff_update_duplicate_context(thread_context, s2);
}
- init_get_bits(&thread_context->gb, buf_ptr, input_size * 8);
+ init_get_bits(&thread_context->gb, buf_ptr, input_size*8);
s->slice_count++;
}
buf_ptr += 2; //FIXME add minimum number of bytes per slice
- }
- else
- {
+ }else{
ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size);
emms_c();
- if(ret < 0)
- {
- if(s2->resync_mb_x >= 0 && s2->resync_mb_y >= 0)
- ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR | DC_ERROR | MV_ERROR);
- // ==> Start patch MPC
- else if(!s2->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
- //}else{
- // <== End patch MPC
- ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x - 1, s2->mb_y, AC_END | DC_END | MV_END);
+ if(ret < 0){
+ if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0)
+ ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
+ // ==> Start patch MPC
+ else if (!s2->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ //}else{
+ // <== End patch MPC
+ ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END);
}
}
}
@@ -2840,11 +2457,10 @@ static int decode_chunks(AVCodecContext *avctx,
}
}
-static void flush(AVCodecContext *avctx)
-{
+static void flush(AVCodecContext *avctx){
Mpeg1Context *s = avctx->priv_data;
- s->sync = 0;
+ s->sync=0;
ff_mpeg_flush(avctx);
}
@@ -2853,13 +2469,12 @@ static int mpeg_decode_end(AVCodecContext *avctx)
{
Mpeg1Context *s = avctx->priv_data;
- if(s->mpeg_enc_ctx_allocated)
+ if (s->mpeg_enc_ctx_allocated)
MPV_common_end(&s->mpeg_enc_ctx);
return 0;
}
-AVCodec mpeg1video_decoder =
-{
+AVCodec mpeg1video_decoder = {
"mpeg1video",
CODEC_TYPE_VIDEO,
CODEC_ID_MPEG1VIDEO,
@@ -2876,8 +2491,7 @@ AVCodec mpeg1video_decoder =
/*.long_name= */NULL_IF_CONFIG_SMALL("MPEG-1 video"),
};
-AVCodec mpeg2video_decoder =
-{
+AVCodec mpeg2video_decoder = {
"mpeg2video",
CODEC_TYPE_VIDEO,
CODEC_ID_MPEG2VIDEO,
@@ -2891,12 +2505,11 @@ AVCodec mpeg2video_decoder =
/*.flush=*/flush,
/*.supported_framerates = */NULL,
/*.pix_fmts = */NULL,
- /*.long_name= */NULL_IF_CONFIG_SMALL("MPEG-2 video"),
+/*.long_name= */NULL_IF_CONFIG_SMALL("MPEG-2 video"),
};
//legacy decoder
-AVCodec mpegvideo_decoder =
-{
+AVCodec mpegvideo_decoder = {
"mpegvideo",
CODEC_TYPE_VIDEO,
CODEC_ID_MPEG2VIDEO,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h
index 352ad8ed4..30bb675d3 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h
@@ -39,25 +39,18 @@ static inline int decode_dc(GetBitContext *gb, int component)
{
int code, diff;
- if(component == 0)
- {
+ if (component == 0) {
code = get_vlc2(gb, dc_lum_vlc.table, DC_VLC_BITS, 2);
- }
- else
- {
+ } else {
code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2);
}
- if(code < 0)
- {
+ if (code < 0){
av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
return 0xffff;
}
- if(code == 0)
- {
+ if (code == 0) {
diff = 0;
- }
- else
- {
+ } else {
diff = get_xbits(gb, code);
}
return diff;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12data.c
index f3f40109a..229ec3ba2 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12data.c
@@ -27,20 +27,18 @@
#include "mpeg12data.h"
-const uint16_t ff_mpeg1_default_intra_matrix[64] =
-{
- 8, 16, 19, 22, 26, 27, 29, 34,
- 16, 16, 22, 24, 27, 29, 34, 37,
- 19, 22, 26, 27, 29, 34, 34, 38,
- 22, 22, 26, 27, 29, 34, 37, 40,
- 22, 26, 27, 29, 32, 35, 40, 48,
- 26, 27, 29, 32, 35, 40, 48, 58,
- 26, 27, 29, 34, 38, 46, 56, 69,
- 27, 29, 35, 38, 46, 56, 69, 83
+const uint16_t ff_mpeg1_default_intra_matrix[64] = {
+ 8, 16, 19, 22, 26, 27, 29, 34,
+ 16, 16, 22, 24, 27, 29, 34, 37,
+ 19, 22, 26, 27, 29, 34, 34, 38,
+ 22, 22, 26, 27, 29, 34, 37, 40,
+ 22, 26, 27, 29, 32, 35, 40, 48,
+ 26, 27, 29, 32, 35, 40, 48, 58,
+ 26, 27, 29, 34, 38, 46, 56, 69,
+ 27, 29, 35, 38, 46, 56, 69, 83
};
-const uint16_t ff_mpeg1_default_non_intra_matrix[64] =
-{
+const uint16_t ff_mpeg1_default_non_intra_matrix[64] = {
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
@@ -51,130 +49,121 @@ const uint16_t ff_mpeg1_default_non_intra_matrix[64] =
16, 16, 16, 16, 16, 16, 16, 16,
};
-const uint16_t ff_mpeg12_vlc_dc_lum_code[12] =
-{
+const uint16_t ff_mpeg12_vlc_dc_lum_code[12] = {
0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
};
-const unsigned char ff_mpeg12_vlc_dc_lum_bits[12] =
-{
+const unsigned char ff_mpeg12_vlc_dc_lum_bits[12] = {
3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
};
-const uint16_t ff_mpeg12_vlc_dc_chroma_code[12] =
-{
+const uint16_t ff_mpeg12_vlc_dc_chroma_code[12] = {
0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
};
-const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12] =
-{
+const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12] = {
2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
};
-static const uint16_t mpeg1_vlc[113][2] =
-{
- { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
- { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
- { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
- { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
- { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
- { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 },
- { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 },
- { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 },
- { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 },
- { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 },
- { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 },
- { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 },
- { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 },
- { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 },
- { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 },
- { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 },
- { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 },
- { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 },
- { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 },
- { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 },
- { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
- { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 },
- { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 },
- { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 },
- { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 },
- { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 },
- { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 },
- { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
- { 0x1, 6 }, /* escape */
- { 0x2, 2 }, /* EOB */
+static const uint16_t mpeg1_vlc[113][2] = {
+ { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
+ { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
+ { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
+ { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
+ { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
+ { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 },
+ { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 },
+ { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 },
+ { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 },
+ { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 },
+ { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 },
+ { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 },
+ { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 },
+ { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 },
+ { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 },
+ { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 },
+ { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 },
+ { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 },
+ { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 },
+ { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 },
+ { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
+ { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 },
+ { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 },
+ { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 },
+ { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 },
+ { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 },
+ { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 },
+ { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
+ { 0x1, 6 }, /* escape */
+ { 0x2, 2 }, /* EOB */
};
-static const uint16_t mpeg2_vlc[113][2] =
-{
- {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
- {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
- {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
- {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f, 14},
- {0x1e, 14}, {0x1d, 14}, {0x1c, 14}, {0x1b, 14},
- {0x1a, 14}, {0x19, 14}, {0x18, 14}, {0x17, 14},
- {0x16, 14}, {0x15, 14}, {0x14, 14}, {0x13, 14},
- {0x12, 14}, {0x11, 14}, {0x10, 14}, {0x18, 15},
- {0x17, 15}, {0x16, 15}, {0x15, 15}, {0x14, 15},
- {0x13, 15}, {0x12, 15}, {0x11, 15}, {0x10, 15},
- {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
- {0x20, 8}, {0x16, 13}, {0x15, 13}, {0x1f, 15},
- {0x1e, 15}, {0x1d, 15}, {0x1c, 15}, {0x1b, 15},
- {0x1a, 15}, {0x19, 15}, {0x13, 16}, {0x12, 16},
- {0x11, 16}, {0x10, 16}, {0x05, 5}, {0x07, 7},
- {0xfc, 8}, {0x0c, 10}, {0x14, 13}, {0x07, 5},
- {0x26, 8}, {0x1c, 12}, {0x13, 13}, {0x06, 6},
- {0xfd, 8}, {0x12, 12}, {0x07, 6}, {0x04, 9},
- {0x12, 13}, {0x06, 7}, {0x1e, 12}, {0x14, 16},
- {0x04, 7}, {0x15, 12}, {0x05, 7}, {0x11, 12},
- {0x78, 7}, {0x11, 13}, {0x7a, 7}, {0x10, 13},
- {0x21, 8}, {0x1a, 16}, {0x25, 8}, {0x19, 16},
- {0x24, 8}, {0x18, 16}, {0x05, 9}, {0x17, 16},
- {0x07, 9}, {0x16, 16}, {0x0d, 10}, {0x15, 16},
- {0x1f, 12}, {0x1a, 12}, {0x19, 12}, {0x17, 12},
- {0x16, 12}, {0x1f, 13}, {0x1e, 13}, {0x1d, 13},
- {0x1c, 13}, {0x1b, 13}, {0x1f, 16}, {0x1e, 16},
- {0x1d, 16}, {0x1c, 16}, {0x1b, 16},
- {0x01, 6}, /* escape */
- {0x06, 4}, /* EOB */
+static const uint16_t mpeg2_vlc[113][2] = {
+ {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
+ {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
+ {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
+ {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
+ {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
+ {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
+ {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
+ {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
+ {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
+ {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15},
+ {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
+ {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
+ {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
+ {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
+ {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
+ {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
+ {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
+ {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
+ {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
+ {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
+ {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
+ {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
+ {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
+ {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
+ {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
+ {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
+ {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
+ {0x1d,16}, {0x1c,16}, {0x1b,16},
+ {0x01,6}, /* escape */
+ {0x06,4}, /* EOB */
};
-static const int8_t mpeg1_level[111] =
-{
- 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,
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 1, 2, 3, 4, 5, 1,
- 2, 3, 4, 1, 2, 3, 1, 2,
- 3, 1, 2, 3, 1, 2, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
+static const int8_t mpeg1_level[111] = {
+ 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,
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 1, 2, 3, 4, 5, 1,
+ 2, 3, 4, 1, 2, 3, 1, 2,
+ 3, 1, 2, 3, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1,
};
-static const int8_t mpeg1_run[111] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 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, 1, 1,
- 1, 1, 2, 2, 2, 2, 2, 3,
- 3, 3, 3, 4, 4, 4, 5, 5,
- 5, 6, 6, 6, 7, 7, 8, 8,
- 9, 9, 10, 10, 11, 11, 12, 12,
- 13, 13, 14, 14, 15, 15, 16, 16,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31,
+static const int8_t mpeg1_run[111] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 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, 1, 1,
+ 1, 1, 2, 2, 2, 2, 2, 3,
+ 3, 3, 3, 4, 4, 4, 5, 5,
+ 5, 6, 6, 6, 7, 7, 8, 8,
+ 9, 9, 10, 10, 11, 11, 12, 12,
+ 13, 13, 14, 14, 15, 15, 16, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31,
};
-RLTable ff_rl_mpeg1 =
-{
+RLTable ff_rl_mpeg1 = {
111,
111,
mpeg1_vlc,
@@ -182,8 +171,7 @@ RLTable ff_rl_mpeg1 =
mpeg1_level,
};
-RLTable ff_rl_mpeg2 =
-{
+RLTable ff_rl_mpeg2 = {
111,
111,
mpeg2_vlc,
@@ -191,8 +179,7 @@ RLTable ff_rl_mpeg2 =
mpeg1_level,
};
-const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] =
-{
+const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] = {
{0x1, 1},
{0x3, 3},
{0x2, 3},
@@ -231,8 +218,7 @@ const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] =
{0x0, 8}, /* end (and 15 more 0 bits should follow) */
};
-const uint8_t ff_mpeg12_mbPatTable[64][2] =
-{
+const uint8_t ff_mpeg12_mbPatTable[64][2] = {
{0x1, 9},
{0xb, 5},
{0x9, 5},
@@ -299,29 +285,27 @@ const uint8_t ff_mpeg12_mbPatTable[64][2] =
{0xc, 6}
};
-const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] =
-{
- { 0x1, 1 },
- { 0x1, 2 },
- { 0x1, 3 },
- { 0x1, 4 },
- { 0x3, 6 },
- { 0x5, 7 },
- { 0x4, 7 },
- { 0x3, 7 },
- { 0xb, 9 },
- { 0xa, 9 },
- { 0x9, 9 },
- { 0x11, 10 },
- { 0x10, 10 },
- { 0xf, 10 },
- { 0xe, 10 },
- { 0xd, 10 },
- { 0xc, 10 },
+const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = {
+{ 0x1, 1 },
+{ 0x1, 2 },
+{ 0x1, 3 },
+{ 0x1, 4 },
+{ 0x3, 6 },
+{ 0x5, 7 },
+{ 0x4, 7 },
+{ 0x3, 7 },
+{ 0xb, 9 },
+{ 0xa, 9 },
+{ 0x9, 9 },
+{ 0x11, 10 },
+{ 0x10, 10 },
+{ 0xf, 10 },
+{ 0xe, 10 },
+{ 0xd, 10 },
+{ 0xc, 10 },
};
-const AVRational ff_frame_rate_tab[] =
-{
+const AVRational ff_frame_rate_tab[] = {
{ 0, 0},
{24000, 1001},
{ 24, 1},
@@ -331,9 +315,9 @@ const AVRational ff_frame_rate_tab[] =
{ 50, 1},
{60000, 1001},
{ 60, 1},
- // Xing's 15fps: (9)
+ // Xing's 15fps: (9)
{ 15, 1},
- // libmpeg3's "Unofficial economy rates": (10-13)
+ // libmpeg3's "Unofficial economy rates": (10-13)
{ 5, 1},
{ 10, 1},
{ 12, 1},
@@ -341,8 +325,7 @@ const AVRational ff_frame_rate_tab[] =
{ 0, 0},
};
-const float ff_mpeg1_aspect[16] =
-{
+const float ff_mpeg1_aspect[16]={
0.0000,
1.0000,
0.6735,
@@ -363,22 +346,21 @@ const float ff_mpeg1_aspect[16] =
1.2015,
};
-const AVRational ff_mpeg2_aspect[16] =
-{
- {0, 1},
- {1, 1},
- {4, 3},
- {16, 9},
- {221, 100},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
+const AVRational ff_mpeg2_aspect[16]={
+ {0,1},
+ {1,1},
+ {4,3},
+ {16,9},
+ {221,100},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12decdata.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12decdata.h
index 4e1b43852..b3da369b1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12decdata.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12decdata.h
@@ -35,8 +35,7 @@
#define MB_TYPE_ZERO_MV 0x20000000
#define IS_ZERO_MV(a) ((a)&MB_TYPE_ZERO_MV)
-static const uint8_t table_mb_ptype[7][2] =
-{
+static const uint8_t table_mb_ptype[7][2] = {
{ 3, 5 }, // 0x01 MB_INTRA
{ 1, 2 }, // 0x02 MB_PAT
{ 1, 3 }, // 0x08 MB_FOR
@@ -46,19 +45,17 @@ static const uint8_t table_mb_ptype[7][2] =
{ 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
};
-static const uint32_t ptype2mb_type[7] =
-{
- MB_TYPE_INTRA,
- MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
- MB_TYPE_L0,
- MB_TYPE_L0 | MB_TYPE_CBP,
+static const uint32_t ptype2mb_type[7] = {
+ MB_TYPE_INTRA,
+ MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
+ MB_TYPE_L0,
+ MB_TYPE_L0 | MB_TYPE_CBP,
MB_TYPE_QUANT | MB_TYPE_INTRA,
MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
};
-static const uint8_t table_mb_btype[11][2] =
-{
+static const uint8_t table_mb_btype[11][2] = {
{ 3, 5 }, // 0x01 MB_INTRA
{ 2, 3 }, // 0x04 MB_BACK
{ 3, 3 }, // 0x06 MB_BACK|MB_PAT
@@ -72,31 +69,28 @@ static const uint8_t table_mb_btype[11][2] =
{ 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
};
-static const uint32_t btype2mb_type[11] =
-{
- MB_TYPE_INTRA,
- MB_TYPE_L1,
- MB_TYPE_L1 | MB_TYPE_CBP,
- MB_TYPE_L0,
- MB_TYPE_L0 | MB_TYPE_CBP,
- MB_TYPE_L0L1,
- MB_TYPE_L0L1 | MB_TYPE_CBP,
+static const uint32_t btype2mb_type[11] = {
+ MB_TYPE_INTRA,
+ MB_TYPE_L1,
+ MB_TYPE_L1 | MB_TYPE_CBP,
+ MB_TYPE_L0,
+ MB_TYPE_L0 | MB_TYPE_CBP,
+ MB_TYPE_L0L1,
+ MB_TYPE_L0L1 | MB_TYPE_CBP,
MB_TYPE_QUANT | MB_TYPE_INTRA,
MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP,
MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
};
-static const uint8_t non_linear_qscale[32] =
-{
+static const uint8_t non_linear_qscale[32] = {
0, 1, 2, 3, 4, 5, 6, 7,
- 8, 10, 12, 14, 16, 18, 20, 22,
- 24, 28, 32, 36, 40, 44, 48, 52,
- 56, 64, 72, 80, 88, 96, 104, 112,
+ 8,10,12,14,16,18,20,22,
+ 24,28,32,36,40,44,48,52,
+ 56,64,72,80,88,96,104,112,
};
-static const uint8_t mpeg2_dc_scale_table1[128] =
-{
+static const uint8_t mpeg2_dc_scale_table1[128]={
// 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
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@@ -104,8 +98,7 @@ static const uint8_t mpeg2_dc_scale_table1[128] =
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
};
-static const uint8_t mpeg2_dc_scale_table2[128] =
-{
+static const uint8_t mpeg2_dc_scale_table2[128]={
// 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
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -113,8 +106,7 @@ static const uint8_t mpeg2_dc_scale_table2[128] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
};
-static const uint8_t mpeg2_dc_scale_table3[128] =
-{
+static const uint8_t mpeg2_dc_scale_table3[128]={
// 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
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -122,8 +114,7 @@ static const uint8_t mpeg2_dc_scale_table3[128] =
1, 1, 1, 1, 1, 1, 1, 1, 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 uint8_t * const mpeg2_dc_scale_table[4] =
-{
+static const uint8_t * const mpeg2_dc_scale_table[4]={
ff_mpeg1_dc_scale_table,
mpeg2_dc_scale_table1,
mpeg2_dc_scale_table2,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4data.h
index 973bc07ae..e127d76c1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4data.h
@@ -34,83 +34,79 @@
/* dc encoding for mpeg4 */
const uint8_t ff_mpeg4_DCtab_lum[13][2] =
{
- {3, 3}, {3, 2}, {2, 2}, {2, 3}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7},
- {1, 8}, {1, 9}, {1, 10}, {1, 11},
+ {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7},
+ {1,8}, {1,9}, {1,10}, {1,11},
};
const uint8_t ff_mpeg4_DCtab_chrom[13][2] =
{
- {3, 2}, {2, 2}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8},
- {1, 9}, {1, 10}, {1, 11}, {1, 12},
+ {3,2}, {2,2}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8},
+ {1,9}, {1,10}, {1,11}, {1,12},
};
-const uint16_t ff_mpeg4_intra_vlc[103][2] =
-{
- { 0x2, 2 },
- { 0x6, 3 }, { 0xf, 4 }, { 0xd, 5 }, { 0xc, 5 },
- { 0x15, 6 }, { 0x13, 6 }, { 0x12, 6 }, { 0x17, 7 },
- { 0x1f, 8 }, { 0x1e, 8 }, { 0x1d, 8 }, { 0x25, 9 },
- { 0x24, 9 }, { 0x23, 9 }, { 0x21, 9 }, { 0x21, 10 },
- { 0x20, 10 }, { 0xf, 10 }, { 0xe, 10 }, { 0x7, 11 },
- { 0x6, 11 }, { 0x20, 11 }, { 0x21, 11 }, { 0x50, 12 },
- { 0x51, 12 }, { 0x52, 12 }, { 0xe, 4 }, { 0x14, 6 },
- { 0x16, 7 }, { 0x1c, 8 }, { 0x20, 9 }, { 0x1f, 9 },
- { 0xd, 10 }, { 0x22, 11 }, { 0x53, 12 }, { 0x55, 12 },
- { 0xb, 5 }, { 0x15, 7 }, { 0x1e, 9 }, { 0xc, 10 },
- { 0x56, 12 }, { 0x11, 6 }, { 0x1b, 8 }, { 0x1d, 9 },
- { 0xb, 10 }, { 0x10, 6 }, { 0x22, 9 }, { 0xa, 10 },
- { 0xd, 6 }, { 0x1c, 9 }, { 0x8, 10 }, { 0x12, 7 },
- { 0x1b, 9 }, { 0x54, 12 }, { 0x14, 7 }, { 0x1a, 9 },
- { 0x57, 12 }, { 0x19, 8 }, { 0x9, 10 }, { 0x18, 8 },
- { 0x23, 11 }, { 0x17, 8 }, { 0x19, 9 }, { 0x18, 9 },
- { 0x7, 10 }, { 0x58, 12 }, { 0x7, 4 }, { 0xc, 6 },
- { 0x16, 8 }, { 0x17, 9 }, { 0x6, 10 }, { 0x5, 11 },
- { 0x4, 11 }, { 0x59, 12 }, { 0xf, 6 }, { 0x16, 9 },
- { 0x5, 10 }, { 0xe, 6 }, { 0x4, 10 }, { 0x11, 7 },
- { 0x24, 11 }, { 0x10, 7 }, { 0x25, 11 }, { 0x13, 7 },
- { 0x5a, 12 }, { 0x15, 8 }, { 0x5b, 12 }, { 0x14, 8 },
- { 0x13, 8 }, { 0x1a, 8 }, { 0x15, 9 }, { 0x14, 9 },
- { 0x13, 9 }, { 0x12, 9 }, { 0x11, 9 }, { 0x26, 11 },
- { 0x27, 11 }, { 0x5c, 12 }, { 0x5d, 12 }, { 0x5e, 12 },
- { 0x5f, 12 }, { 0x3, 7 },
+const uint16_t ff_mpeg4_intra_vlc[103][2] = {
+{ 0x2, 2 },
+{ 0x6, 3 },{ 0xf, 4 },{ 0xd, 5 },{ 0xc, 5 },
+{ 0x15, 6 },{ 0x13, 6 },{ 0x12, 6 },{ 0x17, 7 },
+{ 0x1f, 8 },{ 0x1e, 8 },{ 0x1d, 8 },{ 0x25, 9 },
+{ 0x24, 9 },{ 0x23, 9 },{ 0x21, 9 },{ 0x21, 10 },
+{ 0x20, 10 },{ 0xf, 10 },{ 0xe, 10 },{ 0x7, 11 },
+{ 0x6, 11 },{ 0x20, 11 },{ 0x21, 11 },{ 0x50, 12 },
+{ 0x51, 12 },{ 0x52, 12 },{ 0xe, 4 },{ 0x14, 6 },
+{ 0x16, 7 },{ 0x1c, 8 },{ 0x20, 9 },{ 0x1f, 9 },
+{ 0xd, 10 },{ 0x22, 11 },{ 0x53, 12 },{ 0x55, 12 },
+{ 0xb, 5 },{ 0x15, 7 },{ 0x1e, 9 },{ 0xc, 10 },
+{ 0x56, 12 },{ 0x11, 6 },{ 0x1b, 8 },{ 0x1d, 9 },
+{ 0xb, 10 },{ 0x10, 6 },{ 0x22, 9 },{ 0xa, 10 },
+{ 0xd, 6 },{ 0x1c, 9 },{ 0x8, 10 },{ 0x12, 7 },
+{ 0x1b, 9 },{ 0x54, 12 },{ 0x14, 7 },{ 0x1a, 9 },
+{ 0x57, 12 },{ 0x19, 8 },{ 0x9, 10 },{ 0x18, 8 },
+{ 0x23, 11 },{ 0x17, 8 },{ 0x19, 9 },{ 0x18, 9 },
+{ 0x7, 10 },{ 0x58, 12 },{ 0x7, 4 },{ 0xc, 6 },
+{ 0x16, 8 },{ 0x17, 9 },{ 0x6, 10 },{ 0x5, 11 },
+{ 0x4, 11 },{ 0x59, 12 },{ 0xf, 6 },{ 0x16, 9 },
+{ 0x5, 10 },{ 0xe, 6 },{ 0x4, 10 },{ 0x11, 7 },
+{ 0x24, 11 },{ 0x10, 7 },{ 0x25, 11 },{ 0x13, 7 },
+{ 0x5a, 12 },{ 0x15, 8 },{ 0x5b, 12 },{ 0x14, 8 },
+{ 0x13, 8 },{ 0x1a, 8 },{ 0x15, 9 },{ 0x14, 9 },
+{ 0x13, 9 },{ 0x12, 9 },{ 0x11, 9 },{ 0x26, 11 },
+{ 0x27, 11 },{ 0x5c, 12 },{ 0x5d, 12 },{ 0x5e, 12 },
+{ 0x5f, 12 },{ 0x3, 7 },
};
-const int8_t ff_mpeg4_intra_level[102] =
-{
- 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, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 1, 2, 3,
- 4, 5, 1, 2, 3, 4, 1, 2,
- 3, 1, 2, 3, 1, 2, 3, 1,
- 2, 3, 1, 2, 1, 2, 1, 1,
- 1, 1, 1, 1, 2, 3, 4, 5,
- 6, 7, 8, 1, 2, 3, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1,
+const int8_t ff_mpeg4_intra_level[102] = {
+ 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, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 1, 2, 3,
+ 4, 5, 1, 2, 3, 4, 1, 2,
+ 3, 1, 2, 3, 1, 2, 3, 1,
+ 2, 3, 1, 2, 1, 2, 1, 1,
+ 1, 1, 1, 1, 2, 3, 4, 5,
+ 6, 7, 8, 1, 2, 3, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1,
};
-const int8_t ff_mpeg4_intra_run[102] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 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, 2, 2, 2,
- 2, 2, 3, 3, 3, 3, 4, 4,
- 4, 5, 5, 5, 6, 6, 6, 7,
- 7, 7, 8, 8, 9, 9, 10, 11,
- 12, 13, 14, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 2, 2,
- 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20,
+const int8_t ff_mpeg4_intra_run[102] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 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, 2, 2, 2,
+ 2, 2, 3, 3, 3, 3, 4, 4,
+ 4, 5, 5, 5, 6, 6, 6, 7,
+ 7, 7, 8, 8, 9, 9, 10, 11,
+ 12, 13, 14, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 2, 2,
+ 3, 3, 4, 4, 5, 5, 6, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20,
};
-RLTable ff_mpeg4_rl_intra =
-{
+RLTable ff_mpeg4_rl_intra = {
102,
67,
ff_mpeg4_intra_vlc,
@@ -119,107 +115,103 @@ RLTable ff_mpeg4_rl_intra =
};
/* Note this is identical to the intra rvlc except that it is reordered. */
-const uint16_t inter_rvlc[170][2] =
-{
- {0x0006, 3}, {0x0001, 4}, {0x0004, 5}, {0x001C, 7},
- {0x003C, 8}, {0x003D, 8}, {0x007C, 9}, {0x00FC, 10},
- {0x00FD, 10}, {0x01FC, 11}, {0x01FD, 11}, {0x03FC, 12},
- {0x07FC, 13}, {0x07FD, 13}, {0x0BFC, 13}, {0x0BFD, 13},
- {0x0FFC, 14}, {0x0FFD, 14}, {0x1FFC, 15}, {0x0007, 3},
- {0x000C, 6}, {0x005C, 8}, {0x007D, 9}, {0x017C, 10},
- {0x02FC, 11}, {0x03FD, 12}, {0x0DFC, 13}, {0x17FC, 14},
- {0x17FD, 14}, {0x000A, 4}, {0x001D, 7}, {0x00BC, 9},
- {0x02FD, 11}, {0x05FC, 12}, {0x1BFC, 14}, {0x1BFD, 14},
- {0x0005, 5}, {0x005D, 8}, {0x017D, 10}, {0x05FD, 12},
- {0x0DFD, 13}, {0x1DFC, 14}, {0x1FFD, 15}, {0x0008, 5},
- {0x006C, 8}, {0x037C, 11}, {0x0EFC, 13}, {0x2FFC, 15},
- {0x0009, 5}, {0x00BD, 9}, {0x037D, 11}, {0x0EFD, 13},
- {0x000D, 6}, {0x01BC, 10}, {0x06FC, 12}, {0x1DFD, 14},
- {0x0014, 6}, {0x01BD, 10}, {0x06FD, 12}, {0x2FFD, 15},
- {0x0015, 6}, {0x01DC, 10}, {0x0F7C, 13}, {0x002C, 7},
- {0x01DD, 10}, {0x1EFC, 14}, {0x002D, 7}, {0x03BC, 11},
- {0x0034, 7}, {0x077C, 12}, {0x006D, 8}, {0x0F7D, 13},
- {0x0074, 8}, {0x1EFD, 14}, {0x0075, 8}, {0x1F7C, 14},
- {0x00DC, 9}, {0x1F7D, 14}, {0x00DD, 9}, {0x1FBC, 14},
- {0x00EC, 9}, {0x37FC, 15}, {0x01EC, 10}, {0x01ED, 10},
- {0x01F4, 10}, {0x03BD, 11}, {0x03DC, 11}, {0x03DD, 11},
- {0x03EC, 11}, {0x03ED, 11}, {0x03F4, 11}, {0x077D, 12},
- {0x07BC, 12}, {0x07BD, 12}, {0x0FBC, 13}, {0x0FBD, 13},
- {0x0FDC, 13}, {0x0FDD, 13}, {0x1FBD, 14}, {0x1FDC, 14},
- {0x1FDD, 14}, {0x37FD, 15}, {0x3BFC, 15},
- {0x000B, 4}, {0x0078, 8}, {0x03F5, 11}, {0x0FEC, 13},
- {0x1FEC, 14}, {0x0012, 5}, {0x00ED, 9}, {0x07DC, 12},
- {0x1FED, 14}, {0x3BFD, 15}, {0x0013, 5}, {0x03F8, 11},
- {0x3DFC, 15}, {0x0018, 6}, {0x07DD, 12}, {0x0019, 6},
- {0x07EC, 12}, {0x0022, 6}, {0x0FED, 13}, {0x0023, 6},
- {0x0FF4, 13}, {0x0035, 7}, {0x0FF5, 13}, {0x0038, 7},
- {0x0FF8, 13}, {0x0039, 7}, {0x0FF9, 13}, {0x0042, 7},
- {0x1FF4, 14}, {0x0043, 7}, {0x1FF5, 14}, {0x0079, 8},
- {0x1FF8, 14}, {0x0082, 8}, {0x3DFD, 15}, {0x0083, 8},
- {0x00F4, 9}, {0x00F5, 9}, {0x00F8, 9}, {0x00F9, 9},
- {0x0102, 9}, {0x0103, 9}, {0x01F5, 10}, {0x01F8, 10},
- {0x01F9, 10}, {0x0202, 10}, {0x0203, 10}, {0x03F9, 11},
- {0x0402, 11}, {0x0403, 11}, {0x07ED, 12}, {0x07F4, 12},
- {0x07F5, 12}, {0x07F8, 12}, {0x07F9, 12}, {0x0802, 12},
- {0x0803, 12}, {0x1002, 13}, {0x1003, 13}, {0x1FF9, 14},
- {0x2002, 14}, {0x2003, 14}, {0x3EFC, 15}, {0x3EFD, 15},
- {0x3F7C, 15}, {0x3F7D, 15}, {0x0000, 4}
+const uint16_t inter_rvlc[170][2]={
+{0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7},
+{0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10},
+{0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12},
+{0x07FC, 13},{0x07FD, 13},{0x0BFC, 13},{0x0BFD, 13},
+{0x0FFC, 14},{0x0FFD, 14},{0x1FFC, 15},{0x0007, 3},
+{0x000C, 6},{0x005C, 8},{0x007D, 9},{0x017C, 10},
+{0x02FC, 11},{0x03FD, 12},{0x0DFC, 13},{0x17FC, 14},
+{0x17FD, 14},{0x000A, 4},{0x001D, 7},{0x00BC, 9},
+{0x02FD, 11},{0x05FC, 12},{0x1BFC, 14},{0x1BFD, 14},
+{0x0005, 5},{0x005D, 8},{0x017D, 10},{0x05FD, 12},
+{0x0DFD, 13},{0x1DFC, 14},{0x1FFD, 15},{0x0008, 5},
+{0x006C, 8},{0x037C, 11},{0x0EFC, 13},{0x2FFC, 15},
+{0x0009, 5},{0x00BD, 9},{0x037D, 11},{0x0EFD, 13},
+{0x000D, 6},{0x01BC, 10},{0x06FC, 12},{0x1DFD, 14},
+{0x0014, 6},{0x01BD, 10},{0x06FD, 12},{0x2FFD, 15},
+{0x0015, 6},{0x01DC, 10},{0x0F7C, 13},{0x002C, 7},
+{0x01DD, 10},{0x1EFC, 14},{0x002D, 7},{0x03BC, 11},
+{0x0034, 7},{0x077C, 12},{0x006D, 8},{0x0F7D, 13},
+{0x0074, 8},{0x1EFD, 14},{0x0075, 8},{0x1F7C, 14},
+{0x00DC, 9},{0x1F7D, 14},{0x00DD, 9},{0x1FBC, 14},
+{0x00EC, 9},{0x37FC, 15},{0x01EC, 10},{0x01ED, 10},
+{0x01F4, 10},{0x03BD, 11},{0x03DC, 11},{0x03DD, 11},
+{0x03EC, 11},{0x03ED, 11},{0x03F4, 11},{0x077D, 12},
+{0x07BC, 12},{0x07BD, 12},{0x0FBC, 13},{0x0FBD, 13},
+{0x0FDC, 13},{0x0FDD, 13},{0x1FBD, 14},{0x1FDC, 14},
+{0x1FDD, 14},{0x37FD, 15},{0x3BFC, 15},
+{0x000B, 4},{0x0078, 8},{0x03F5, 11},{0x0FEC, 13},
+{0x1FEC, 14},{0x0012, 5},{0x00ED, 9},{0x07DC, 12},
+{0x1FED, 14},{0x3BFD, 15},{0x0013, 5},{0x03F8, 11},
+{0x3DFC, 15},{0x0018, 6},{0x07DD, 12},{0x0019, 6},
+{0x07EC, 12},{0x0022, 6},{0x0FED, 13},{0x0023, 6},
+{0x0FF4, 13},{0x0035, 7},{0x0FF5, 13},{0x0038, 7},
+{0x0FF8, 13},{0x0039, 7},{0x0FF9, 13},{0x0042, 7},
+{0x1FF4, 14},{0x0043, 7},{0x1FF5, 14},{0x0079, 8},
+{0x1FF8, 14},{0x0082, 8},{0x3DFD, 15},{0x0083, 8},
+{0x00F4, 9},{0x00F5, 9},{0x00F8, 9},{0x00F9, 9},
+{0x0102, 9},{0x0103, 9},{0x01F5, 10},{0x01F8, 10},
+{0x01F9, 10},{0x0202, 10},{0x0203, 10},{0x03F9, 11},
+{0x0402, 11},{0x0403, 11},{0x07ED, 12},{0x07F4, 12},
+{0x07F5, 12},{0x07F8, 12},{0x07F9, 12},{0x0802, 12},
+{0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14},
+{0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15},
+{0x3F7C, 15},{0x3F7D, 15},{0x0000, 4}
};
-static const int8_t inter_rvlc_run[169] =
-{
- 0, 0, 0, 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, 2, 2, 2,
- 2, 2, 2, 2, 3, 3, 3, 3,
- 3, 3, 3, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 6, 6, 6, 6,
- 7, 7, 7, 7, 8, 8, 8, 9,
- 9, 9, 10, 10, 11, 11, 12, 12,
- 13, 13, 14, 14, 15, 15, 16, 16,
- 17, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38,
- 0, 0, 0, 0, 0, 1, 1, 1,
- 1, 1, 2, 2, 2, 3, 3, 4,
- 4, 5, 5, 6, 6, 7, 7, 8,
- 8, 9, 9, 10, 10, 11, 11, 12,
- 12, 13, 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,
- 43, 44,
+static const int8_t inter_rvlc_run[169]={
+ 0, 0, 0, 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, 2, 2, 2,
+ 2, 2, 2, 2, 3, 3, 3, 3,
+ 3, 3, 3, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 6, 6, 6, 6,
+ 7, 7, 7, 7, 8, 8, 8, 9,
+ 9, 9, 10, 10, 11, 11, 12, 12,
+13, 13, 14, 14, 15, 15, 16, 16,
+17, 17, 18, 19, 20, 21, 22, 23,
+24, 25, 26, 27, 28, 29, 30, 31,
+32, 33, 34, 35, 36, 37, 38,
+ 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 2, 2, 2, 3, 3, 4,
+ 4, 5, 5, 6, 6, 7, 7, 8,
+ 8, 9, 9, 10, 10, 11, 11, 12,
+12, 13, 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,
+43, 44,
};
-static const int8_t inter_rvlc_level[169] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 1, 2, 3,
- 4, 5, 6, 7, 1, 2, 3, 4,
- 5, 6, 7, 1, 2, 3, 4, 5,
- 1, 2, 3, 4, 1, 2, 3, 4,
- 1, 2, 3, 4, 1, 2, 3, 1,
- 2, 3, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 3, 4, 5, 1, 2, 3,
- 4, 5, 1, 2, 3, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 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,
+static const int8_t inter_rvlc_level[169]={
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16,
+17, 18, 19, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 1, 2, 3,
+ 4, 5, 6, 7, 1, 2, 3, 4,
+ 5, 6, 7, 1, 2, 3, 4, 5,
+ 1, 2, 3, 4, 1, 2, 3, 4,
+ 1, 2, 3, 4, 1, 2, 3, 1,
+ 2, 3, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 3, 4, 5, 1, 2, 3,
+ 4, 5, 1, 2, 3, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 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,
};
-RLTable rvlc_rl_inter =
-{
+RLTable rvlc_rl_inter = {
169,
103,
inter_rvlc,
@@ -227,107 +219,103 @@ RLTable rvlc_rl_inter =
inter_rvlc_level,
};
-const uint16_t intra_rvlc[170][2] =
-{
- {0x0006, 3}, {0x0007, 3}, {0x000A, 4}, {0x0009, 5},
- {0x0014, 6}, {0x0015, 6}, {0x0034, 7}, {0x0074, 8},
- {0x0075, 8}, {0x00DD, 9}, {0x00EC, 9}, {0x01EC, 10},
- {0x01ED, 10}, {0x01F4, 10}, {0x03EC, 11}, {0x03ED, 11},
- {0x03F4, 11}, {0x077D, 12}, {0x07BC, 12}, {0x0FBD, 13},
- {0x0FDC, 13}, {0x07BD, 12}, {0x0FDD, 13}, {0x1FBD, 14},
- {0x1FDC, 14}, {0x1FDD, 14}, {0x1FFC, 15}, {0x0001, 4},
- {0x0008, 5}, {0x002D, 7}, {0x006C, 8}, {0x006D, 8},
- {0x00DC, 9}, {0x01DD, 10}, {0x03DC, 11}, {0x03DD, 11},
- {0x077C, 12}, {0x0FBC, 13}, {0x1F7D, 14}, {0x1FBC, 14},
- {0x0004, 5}, {0x002C, 7}, {0x00BC, 9}, {0x01DC, 10},
- {0x03BC, 11}, {0x03BD, 11}, {0x0EFD, 13}, {0x0F7C, 13},
- {0x0F7D, 13}, {0x1EFD, 14}, {0x1F7C, 14}, {0x0005, 5},
- {0x005C, 8}, {0x00BD, 9}, {0x037D, 11}, {0x06FC, 12},
- {0x0EFC, 13}, {0x1DFD, 14}, {0x1EFC, 14}, {0x1FFD, 15},
- {0x000C, 6}, {0x005D, 8}, {0x01BD, 10}, {0x03FD, 12},
- {0x06FD, 12}, {0x1BFD, 14}, {0x000D, 6}, {0x007D, 9},
- {0x02FC, 11}, {0x05FC, 12}, {0x1BFC, 14}, {0x1DFC, 14},
- {0x001C, 7}, {0x017C, 10}, {0x02FD, 11}, {0x05FD, 12},
- {0x2FFC, 15}, {0x001D, 7}, {0x017D, 10}, {0x037C, 11},
- {0x0DFD, 13}, {0x2FFD, 15}, {0x003C, 8}, {0x01BC, 10},
- {0x0BFD, 13}, {0x17FD, 14}, {0x003D, 8}, {0x01FD, 11},
- {0x0DFC, 13}, {0x37FC, 15}, {0x007C, 9}, {0x03FC, 12},
- {0x00FC, 10}, {0x0BFC, 13}, {0x00FD, 10}, {0x37FD, 15},
- {0x01FC, 11}, {0x07FC, 13}, {0x07FD, 13}, {0x0FFC, 14},
- {0x0FFD, 14}, {0x17FC, 14}, {0x3BFC, 15},
- {0x000B, 4}, {0x0078, 8}, {0x03F5, 11}, {0x0FEC, 13},
- {0x1FEC, 14}, {0x0012, 5}, {0x00ED, 9}, {0x07DC, 12},
- {0x1FED, 14}, {0x3BFD, 15}, {0x0013, 5}, {0x03F8, 11},
- {0x3DFC, 15}, {0x0018, 6}, {0x07DD, 12}, {0x0019, 6},
- {0x07EC, 12}, {0x0022, 6}, {0x0FED, 13}, {0x0023, 6},
- {0x0FF4, 13}, {0x0035, 7}, {0x0FF5, 13}, {0x0038, 7},
- {0x0FF8, 13}, {0x0039, 7}, {0x0FF9, 13}, {0x0042, 7},
- {0x1FF4, 14}, {0x0043, 7}, {0x1FF5, 14}, {0x0079, 8},
- {0x1FF8, 14}, {0x0082, 8}, {0x3DFD, 15}, {0x0083, 8},
- {0x00F4, 9}, {0x00F5, 9}, {0x00F8, 9}, {0x00F9, 9},
- {0x0102, 9}, {0x0103, 9}, {0x01F5, 10}, {0x01F8, 10},
- {0x01F9, 10}, {0x0202, 10}, {0x0203, 10}, {0x03F9, 11},
- {0x0402, 11}, {0x0403, 11}, {0x07ED, 12}, {0x07F4, 12},
- {0x07F5, 12}, {0x07F8, 12}, {0x07F9, 12}, {0x0802, 12},
- {0x0803, 12}, {0x1002, 13}, {0x1003, 13}, {0x1FF9, 14},
- {0x2002, 14}, {0x2003, 14}, {0x3EFC, 15}, {0x3EFD, 15},
- {0x3F7C, 15}, {0x3F7D, 15}, {0x0000, 4}
+const uint16_t intra_rvlc[170][2]={
+{0x0006, 3},{0x0007, 3},{0x000A, 4},{0x0009, 5},
+{0x0014, 6},{0x0015, 6},{0x0034, 7},{0x0074, 8},
+{0x0075, 8},{0x00DD, 9},{0x00EC, 9},{0x01EC, 10},
+{0x01ED, 10},{0x01F4, 10},{0x03EC, 11},{0x03ED, 11},
+{0x03F4, 11},{0x077D, 12},{0x07BC, 12},{0x0FBD, 13},
+{0x0FDC, 13},{0x07BD, 12},{0x0FDD, 13},{0x1FBD, 14},
+{0x1FDC, 14},{0x1FDD, 14},{0x1FFC, 15},{0x0001, 4},
+{0x0008, 5},{0x002D, 7},{0x006C, 8},{0x006D, 8},
+{0x00DC, 9},{0x01DD, 10},{0x03DC, 11},{0x03DD, 11},
+{0x077C, 12},{0x0FBC, 13},{0x1F7D, 14},{0x1FBC, 14},
+{0x0004, 5},{0x002C, 7},{0x00BC, 9},{0x01DC, 10},
+{0x03BC, 11},{0x03BD, 11},{0x0EFD, 13},{0x0F7C, 13},
+{0x0F7D, 13},{0x1EFD, 14},{0x1F7C, 14},{0x0005, 5},
+{0x005C, 8},{0x00BD, 9},{0x037D, 11},{0x06FC, 12},
+{0x0EFC, 13},{0x1DFD, 14},{0x1EFC, 14},{0x1FFD, 15},
+{0x000C, 6},{0x005D, 8},{0x01BD, 10},{0x03FD, 12},
+{0x06FD, 12},{0x1BFD, 14},{0x000D, 6},{0x007D, 9},
+{0x02FC, 11},{0x05FC, 12},{0x1BFC, 14},{0x1DFC, 14},
+{0x001C, 7},{0x017C, 10},{0x02FD, 11},{0x05FD, 12},
+{0x2FFC, 15},{0x001D, 7},{0x017D, 10},{0x037C, 11},
+{0x0DFD, 13},{0x2FFD, 15},{0x003C, 8},{0x01BC, 10},
+{0x0BFD, 13},{0x17FD, 14},{0x003D, 8},{0x01FD, 11},
+{0x0DFC, 13},{0x37FC, 15},{0x007C, 9},{0x03FC, 12},
+{0x00FC, 10},{0x0BFC, 13},{0x00FD, 10},{0x37FD, 15},
+{0x01FC, 11},{0x07FC, 13},{0x07FD, 13},{0x0FFC, 14},
+{0x0FFD, 14},{0x17FC, 14},{0x3BFC, 15},
+{0x000B, 4},{0x0078, 8},{0x03F5, 11},{0x0FEC, 13},
+{0x1FEC, 14},{0x0012, 5},{0x00ED, 9},{0x07DC, 12},
+{0x1FED, 14},{0x3BFD, 15},{0x0013, 5},{0x03F8, 11},
+{0x3DFC, 15},{0x0018, 6},{0x07DD, 12},{0x0019, 6},
+{0x07EC, 12},{0x0022, 6},{0x0FED, 13},{0x0023, 6},
+{0x0FF4, 13},{0x0035, 7},{0x0FF5, 13},{0x0038, 7},
+{0x0FF8, 13},{0x0039, 7},{0x0FF9, 13},{0x0042, 7},
+{0x1FF4, 14},{0x0043, 7},{0x1FF5, 14},{0x0079, 8},
+{0x1FF8, 14},{0x0082, 8},{0x3DFD, 15},{0x0083, 8},
+{0x00F4, 9},{0x00F5, 9},{0x00F8, 9},{0x00F9, 9},
+{0x0102, 9},{0x0103, 9},{0x01F5, 10},{0x01F8, 10},
+{0x01F9, 10},{0x0202, 10},{0x0203, 10},{0x03F9, 11},
+{0x0402, 11},{0x0403, 11},{0x07ED, 12},{0x07F4, 12},
+{0x07F5, 12},{0x07F8, 12},{0x07F9, 12},{0x0802, 12},
+{0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14},
+{0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15},
+{0x3F7C, 15},{0x3F7D, 15},{0x0000, 4}
};
-static const int8_t intra_rvlc_run[169] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 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,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 5, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 7, 7, 7,
- 7, 7, 8, 8, 8, 8, 9, 9,
- 9, 9, 10, 10, 11, 11, 12, 12,
- 13, 14, 15, 16, 17, 18, 19,
- 0, 0, 0, 0, 0, 1, 1, 1,
- 1, 1, 2, 2, 2, 3, 3, 4,
- 4, 5, 5, 6, 6, 7, 7, 8,
- 8, 9, 9, 10, 10, 11, 11, 12,
- 12, 13, 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,
- 43, 44,
+static const int8_t intra_rvlc_run[169]={
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 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,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 4, 4, 4, 4,
+ 4, 4, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 7, 7, 7,
+ 7, 7, 8, 8, 8, 8, 9, 9,
+ 9, 9, 10, 10, 11, 11, 12, 12,
+13, 14, 15, 16, 17, 18, 19,
+ 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 2, 2, 2, 3, 3, 4,
+ 4, 5, 5, 6, 6, 7, 7, 8,
+ 8, 9, 9, 10, 10, 11, 11, 12,
+12, 13, 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,
+43, 44,
};
-static const int8_t intra_rvlc_level[169] =
-{
- 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, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13,
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 1, 2, 3, 4,
- 5, 6, 1, 2, 3, 4, 5, 6,
- 1, 2, 3, 4, 5, 1, 2, 3,
- 4, 5, 1, 2, 3, 4, 1, 2,
- 3, 4, 1, 2, 1, 2, 1, 2,
- 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 3, 4, 5, 1, 2, 3,
- 4, 5, 1, 2, 3, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 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,
+static const int8_t intra_rvlc_level[169]={
+ 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, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13,
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 1, 2, 3, 4,
+ 5, 6, 1, 2, 3, 4, 5, 6,
+ 1, 2, 3, 4, 5, 1, 2, 3,
+ 4, 5, 1, 2, 3, 4, 1, 2,
+ 3, 4, 1, 2, 1, 2, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 3, 4, 5, 1, 2, 3,
+ 4, 5, 1, 2, 3, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 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,
};
-RLTable rvlc_rl_intra =
-{
+RLTable rvlc_rl_intra = {
169,
103,
intra_rvlc,
@@ -335,61 +323,53 @@ RLTable rvlc_rl_intra =
intra_rvlc_level,
};
-const uint16_t 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 uint16_t 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] =
-{
- {1, 1}, {1, 2}, {1, 3}, {1, 4},
+const uint8_t mb_type_b_tab[4][2] = {
+ {1, 1}, {1, 2}, {1, 3}, {1, 4},
};
/* these matrixes will be permuted for the idct */
-const int16_t ff_mpeg4_default_intra_matrix[64] =
-{
- 8, 17, 18, 19, 21, 23, 25, 27,
- 17, 18, 19, 21, 23, 25, 27, 28,
- 20, 21, 22, 23, 24, 26, 28, 30,
- 21, 22, 23, 24, 26, 28, 30, 32,
- 22, 23, 24, 26, 28, 30, 32, 35,
- 23, 24, 26, 28, 30, 32, 35, 38,
- 25, 26, 28, 30, 32, 35, 38, 41,
- 27, 28, 30, 32, 35, 38, 41, 45,
+const int16_t ff_mpeg4_default_intra_matrix[64] = {
+ 8, 17, 18, 19, 21, 23, 25, 27,
+ 17, 18, 19, 21, 23, 25, 27, 28,
+ 20, 21, 22, 23, 24, 26, 28, 30,
+ 21, 22, 23, 24, 26, 28, 30, 32,
+ 22, 23, 24, 26, 28, 30, 32, 35,
+ 23, 24, 26, 28, 30, 32, 35, 38,
+ 25, 26, 28, 30, 32, 35, 38, 41,
+ 27, 28, 30, 32, 35, 38, 41, 45,
};
-const int16_t ff_mpeg4_default_non_intra_matrix[64] =
-{
- 16, 17, 18, 19, 20, 21, 22, 23,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 18, 19, 20, 21, 22, 23, 24, 25,
- 19, 20, 21, 22, 23, 24, 26, 27,
- 20, 21, 22, 23, 25, 26, 27, 28,
- 21, 22, 23, 24, 26, 27, 28, 30,
- 22, 23, 24, 26, 27, 28, 30, 31,
- 23, 24, 25, 27, 28, 30, 31, 33,
+const int16_t ff_mpeg4_default_non_intra_matrix[64] = {
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 17, 18, 19, 20, 21, 22, 23, 24,
+ 18, 19, 20, 21, 22, 23, 24, 25,
+ 19, 20, 21, 22, 23, 24, 26, 27,
+ 20, 21, 22, 23, 25, 26, 27, 28,
+ 21, 22, 23, 24, 26, 27, 28, 30,
+ 22, 23, 24, 26, 27, 28, 30, 31,
+ 23, 24, 25, 27, 28, 30, 31, 33,
};
-const uint8_t ff_mpeg4_y_dc_scale_table[32] =
-{
+const uint8_t ff_mpeg4_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, 34, 36, 38, 40, 42, 44, 46
+ 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,34,36,38,40,42,44,46
};
-const uint8_t ff_mpeg4_c_dc_scale_table[32] =
-{
+const uint8_t ff_mpeg4_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, 20, 21, 22, 23, 24, 25
+ 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,20,21,22,23,24,25
};
-const uint16_t ff_mpeg4_resync_prefix[8] =
-{
+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 mpeg4_dc_threshold[8]={
99, 13, 15, 17, 19, 21, 23, 0
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.c
index 6226ae1ac..a647960a5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.c
@@ -26,19 +26,17 @@
uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
-int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s)
-{
- switch(s->pict_type)
- {
- case FF_I_TYPE:
- return 16;
- case FF_P_TYPE:
- case FF_S_TYPE:
- return s->f_code + 15;
- case FF_B_TYPE:
- return FFMAX3(s->f_code, s->b_code, 2) + 15;
- default:
- return -1;
+int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
+ switch(s->pict_type){
+ case FF_I_TYPE:
+ return 16;
+ case FF_P_TYPE:
+ case FF_S_TYPE:
+ return s->f_code+15;
+ case FF_B_TYPE:
+ return FFMAX3(s->f_code, s->b_code, 2) + 15;
+ default:
+ return -1;
}
}
@@ -46,79 +44,70 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s)
{
int c_wrap, c_xy, l_wrap, l_xy;
- l_wrap = s->b8_stride;
- l_xy = (2 * s->mb_y - 1) * l_wrap + s->mb_x * 2 - 1;
- c_wrap = s->mb_stride;
- c_xy = (s->mb_y - 1) * c_wrap + s->mb_x - 1;
+ l_wrap= s->b8_stride;
+ l_xy= (2*s->mb_y-1)*l_wrap + s->mb_x*2 - 1;
+ c_wrap= s->mb_stride;
+ c_xy= (s->mb_y-1)*c_wrap + s->mb_x - 1;
#if 0
/* clean DC */
- memsetw(s->dc_val[0] + l_xy, 1024, l_wrap * 2 + 1);
- memsetw(s->dc_val[1] + c_xy, 1024, c_wrap + 1);
- memsetw(s->dc_val[2] + c_xy, 1024, c_wrap + 1);
+ memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1);
+ memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1);
+ memsetw(s->dc_val[2] + c_xy, 1024, c_wrap+1);
#endif
/* clean AC */
- memset(s->ac_val[0] + l_xy, 0, (l_wrap * 2 + 1) * 16 * sizeof(int16_t));
- memset(s->ac_val[1] + c_xy, 0, (c_wrap + 1) * 16 * sizeof(int16_t));
- memset(s->ac_val[2] + c_xy, 0, (c_wrap + 1) * 16 * sizeof(int16_t));
+ memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(int16_t));
+ memset(s->ac_val[1] + c_xy, 0, (c_wrap +1)*16*sizeof(int16_t));
+ memset(s->ac_val[2] + c_xy, 0, (c_wrap +1)*16*sizeof(int16_t));
/* clean MV */
// we can't clear the MVs as they might be needed by a b frame
// memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(int16_t));
// memset(s->motion_val, 0, 2*sizeof(int16_t)*(2 + s->mb_width*2)*(2 + s->mb_height*2));
- s->last_mv[0][0][0] =
- s->last_mv[0][0][1] =
- s->last_mv[1][0][0] =
- s->last_mv[1][0][1] = 0;
+ s->last_mv[0][0][0]=
+ s->last_mv[0][0][1]=
+ s->last_mv[1][0][0]=
+ s->last_mv[1][0][1]= 0;
}
#define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
#define tab_bias (tab_size/2)
//used by mpeg4 and rv10 decoder
-void ff_mpeg4_init_direct_mv(MpegEncContext *s)
-{
+void ff_mpeg4_init_direct_mv(MpegEncContext *s){
int i;
- for(i = 0; i < tab_size; i++)
- {
- s->direct_scale_mv[0][i] = (i - tab_bias) * s->pb_time / s->pp_time;
- s->direct_scale_mv[1][i] = (i - tab_bias) * (s->pb_time - s->pp_time) / s->pp_time;
+ for(i=0; i<tab_size; i++){
+ s->direct_scale_mv[0][i] = (i-tab_bias)*s->pb_time/s->pp_time;
+ s->direct_scale_mv[1][i] = (i-tab_bias)*(s->pb_time-s->pp_time)/s->pp_time;
}
}
-static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i)
-{
- int xy = s->block_index[i];
- uint16_t time_pp = s->pp_time;
- uint16_t time_pb = s->pb_time;
+static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i){
+ int xy= s->block_index[i];
+ uint16_t time_pp= s->pp_time;
+ uint16_t time_pb= s->pb_time;
int p_mx, p_my;
- p_mx = s->next_picture.motion_val[0][xy][0];
- if((unsigned)(p_mx + tab_bias) < tab_size)
- {
+ p_mx= s->next_picture.motion_val[0][xy][0];
+ if((unsigned)(p_mx + tab_bias) < tab_size){
s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx;
s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx
- : s->direct_scale_mv[1][p_mx + tab_bias];
- }
- else
- {
- s->mv[0][i][0] = p_mx * time_pb / time_pp + mx;
+ : s->direct_scale_mv[1][p_mx + tab_bias];
+ }else{
+ s->mv[0][i][0] = p_mx*time_pb/time_pp + mx;
s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx
- : p_mx * (time_pb - time_pp) / time_pp;
+ : p_mx*(time_pb - time_pp)/time_pp;
}
- p_my = s->next_picture.motion_val[0][xy][1];
- if((unsigned)(p_my + tab_bias) < tab_size)
- {
+ p_my= s->next_picture.motion_val[0][xy][1];
+ if((unsigned)(p_my + tab_bias) < tab_size){
s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my;
s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my
- : s->direct_scale_mv[1][p_my + tab_bias];
- }
- else
- {
- s->mv[0][i][1] = p_my * time_pb / time_pp + my;
+ : s->direct_scale_mv[1][p_my + tab_bias];
+ }else{
+ s->mv[0][i][1] = p_my*time_pb/time_pp + my;
s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my
- : p_my * (time_pb - time_pp) / time_pp;
+ : p_my*(time_pb - time_pp)/time_pp;
}
}
@@ -129,10 +118,9 @@ static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my,
*
* @return the mb_type
*/
-int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my)
-{
- const int mb_index = s->mb_x + s->mb_y * s->mb_stride;
- const int colocated_mb_type = s->next_picture.mb_type[mb_index];
+int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
+ const int mb_index= s->mb_x + s->mb_y*s->mb_stride;
+ const int colocated_mb_type= s->next_picture.mb_type[mb_index];
uint16_t time_pp;
uint16_t time_pb;
int i;
@@ -140,53 +128,43 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my)
//FIXME avoid divides
// try special case with shifts for 1 and 3 B-frames?
- if(IS_8X8(colocated_mb_type))
- {
+ if(IS_8X8(colocated_mb_type)){
s->mv_type = MV_TYPE_8X8;
- for(i = 0; i < 4; i++)
- {
+ for(i=0; i<4; i++){
ff_mpeg4_set_one_direct_mv(s, mx, my, i);
}
return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_L0L1;
- }
- else if(IS_INTERLACED(colocated_mb_type))
- {
+ } else if(IS_INTERLACED(colocated_mb_type)){
s->mv_type = MV_TYPE_FIELD;
- for(i = 0; i < 2; i++)
- {
- int field_select = s->next_picture.ref_index[0][s->block_index[2*i]];
- s->field_select[0][i] = field_select;
- s->field_select[1][i] = i;
- if(s->top_field_first)
- {
- time_pp = s->pp_field_time - field_select + i;
- time_pb = s->pb_field_time - field_select + i;
+ for(i=0; i<2; i++){
+ int field_select= s->next_picture.ref_index[0][s->block_index[2*i]];
+ s->field_select[0][i]= field_select;
+ s->field_select[1][i]= i;
+ if(s->top_field_first){
+ time_pp= s->pp_field_time - field_select + i;
+ time_pb= s->pb_field_time - field_select + i;
+ }else{
+ time_pp= s->pp_field_time + field_select - i;
+ time_pb= s->pb_field_time + field_select - i;
}
- else
- {
- time_pp = s->pp_field_time + field_select - i;
- time_pb = s->pb_field_time + field_select - i;
- }
- s->mv[0][i][0] = s->p_field_mv_table[i][0][mb_index][0] * time_pb / time_pp + mx;
- s->mv[0][i][1] = s->p_field_mv_table[i][0][mb_index][1] * time_pb / time_pp + my;
+ s->mv[0][i][0] = s->p_field_mv_table[i][0][mb_index][0]*time_pb/time_pp + mx;
+ s->mv[0][i][1] = s->p_field_mv_table[i][0][mb_index][1]*time_pb/time_pp + my;
s->mv[1][i][0] = mx ? s->mv[0][i][0] - s->p_field_mv_table[i][0][mb_index][0]
- : s->p_field_mv_table[i][0][mb_index][0] * (time_pb - time_pp) / time_pp;
+ : s->p_field_mv_table[i][0][mb_index][0]*(time_pb - time_pp)/time_pp;
s->mv[1][i][1] = my ? s->mv[0][i][1] - s->p_field_mv_table[i][0][mb_index][1]
- : s->p_field_mv_table[i][0][mb_index][1] * (time_pb - time_pp) / time_pp;
+ : s->p_field_mv_table[i][0][mb_index][1]*(time_pb - time_pp)/time_pp;
}
return MB_TYPE_DIRECT2 | MB_TYPE_16x8 | MB_TYPE_L0L1 | MB_TYPE_INTERLACED;
- }
- else
- {
+ }else{
ff_mpeg4_set_one_direct_mv(s, mx, my, 0);
s->mv[0][1][0] = s->mv[0][2][0] = s->mv[0][3][0] = s->mv[0][0][0];
s->mv[0][1][1] = s->mv[0][2][1] = s->mv[0][3][1] = s->mv[0][0][1];
s->mv[1][1][0] = s->mv[1][2][0] = s->mv[1][3][0] = s->mv[1][0][0];
s->mv[1][1][1] = s->mv[1][2][1] = s->mv[1][3][1] = s->mv[1][0][1];
if((s->avctx->workaround_bugs & FF_BUG_DIRECT_BLOCKSIZE) || !s->quarter_sample)
- s->mv_type = MV_TYPE_16X16;
+ s->mv_type= MV_TYPE_16X16;
else
- s->mv_type = MV_TYPE_8X8;
+ s->mv_type= MV_TYPE_8X8;
return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1; //Note see prev line
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.h
index 5d22919cc..bf8762657 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video.h
@@ -81,8 +81,8 @@ extern const uint16_t ff_mpeg4_resync_prefix[8];
extern const uint8_t mpeg4_dc_threshold[8];
void mpeg4_encode_mb(MpegEncContext *s,
- DCTELEM block[6][64],
- int motion_x, int motion_y);
+ DCTELEM block[6][64],
+ int motion_x, int motion_y);
void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
int dir);
void ff_set_mpeg4_time(MpegEncContext * s);
@@ -129,18 +129,15 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di
int16_t *dc_val;
/* find prediction */
- if(n < 4)
- {
+ if (n < 4) {
scale = s->y_dc_scale;
- }
- else
- {
+ } else {
scale = s->c_dc_scale;
}
if(IS_3IV1)
- scale = 8;
+ scale= 8;
- wrap = s->block_wrap[n];
+ wrap= s->block_wrap[n];
dc_val = s->dc_val[0] + s->block_index[n];
/* B C
@@ -151,61 +148,49 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di
c = dc_val[ - wrap];
/* outside slice handling (we can't do that by memset as we need the dc for error resilience) */
- if(s->first_slice_line && n != 3)
- {
- if(n != 2) b = c = 1024;
- if(n != 1 && s->mb_x == s->resync_mb_x) b = a = 1024;
+ if(s->first_slice_line && n!=3){
+ if(n!=2) b=c= 1024;
+ if(n!=1 && s->mb_x == s->resync_mb_x) b=a= 1024;
}
- if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1)
- {
- if(n == 0 || n == 4 || n == 5)
- b = 1024;
+ if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1){
+ if(n==0 || n==4 || n==5)
+ b=1024;
}
- if(abs(a - b) < abs(b - c))
- {
+ if (abs(a - b) < abs(b - c)) {
pred = c;
*dir_ptr = 1; /* top */
- }
- else
- {
+ } else {
pred = a;
*dir_ptr = 0; /* left */
}
/* we assume pred is positive */
pred = FASTDIV((pred + (scale >> 1)), scale);
- if(encoding)
- {
+ if(encoding){
ret = level - pred;
- }
- else
- {
+ }else{
level += pred;
- ret = level;
- if(s->error_recognition >= 3)
- {
- if(level < 0)
- {
+ ret= level;
+ if(s->error_recognition>=3){
+ if(level<0){
av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
- if(level * scale > 2048 + scale)
- {
+ if(level*scale > 2048 + scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
}
}
- level *= scale;
- if(level&(~2047))
- {
- if(level < 0)
- level = 0;
- else if(!(s->workaround_bugs & FF_BUG_DC_CLIP))
- level = 2047;
+ level *=scale;
+ if(level&(~2047)){
+ if(level<0)
+ level=0;
+ else if(!(s->workaround_bugs&FF_BUG_DC_CLIP))
+ level=2047;
}
- dc_val[0] = level;
+ dc_val[0]= level;
return ret;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video_parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video_parser.c
index 5aa65ab9f..cde2499ab 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video_parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4video_parser.c
@@ -25,46 +25,39 @@
#include "mpeg4video_parser.h"
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
-{
+int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
int vop_found, i;
uint32_t state;
- vop_found = pc->frame_start_found;
- state = pc->state;
+ vop_found= pc->frame_start_found;
+ state= pc->state;
- i = 0;
- if(!vop_found)
- {
- for(i = 0; i < buf_size; i++)
- {
- state = (state << 8) | buf[i];
- if(state == 0x1B6)
- {
+ i=0;
+ if(!vop_found){
+ for(i=0; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ if(state == 0x1B6){
i++;
- vop_found = 1;
+ vop_found=1;
break;
}
}
}
- if(vop_found)
- {
+ if(vop_found){
/* EOF considered as end of frame */
- if(buf_size == 0)
+ if (buf_size == 0)
return 0;
- for(; i < buf_size; i++)
- {
- state = (state << 8) | buf[i];
- if((state & 0xFFFFFF00) == 0x100)
- {
- pc->frame_start_found = 0;
- pc->state = -1;
- return i - 3;
+ for(; i<buf_size; i++){
+ state= (state<<8) | buf[i];
+ if((state&0xFFFFFF00) == 0x100){
+ pc->frame_start_found=0;
+ pc->state=-1;
+ return i-3;
}
}
}
- pc->frame_start_found = vop_found;
- pc->state = state;
+ pc->frame_start_found= vop_found;
+ pc->state= state;
return END_NOT_FOUND;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c
index 44be6e1c6..fc9006413 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c
@@ -37,8 +37,7 @@ static VLC dc_lum, dc_chrom;
static VLC sprite_trajectory;
static VLC mb_type_b_vlc;
-static const int mb_type_b_map[4] =
-{
+static const int mb_type_b_map[4]= {
MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
MB_TYPE_L0L1 | MB_TYPE_16x16,
MB_TYPE_L1 | MB_TYPE_16x16,
@@ -55,66 +54,52 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
{
int i;
int16_t *ac_val, *ac_val1;
- int8_t * const qscale_table = s->current_picture.qscale_table;
+ int8_t * const qscale_table= s->current_picture.qscale_table;
/* find prediction */
ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
ac_val1 = ac_val;
- if(s->ac_pred)
- {
- if(dir == 0)
- {
- const int xy = s->mb_x - 1 + s->mb_y * s->mb_stride;
+ if (s->ac_pred) {
+ if (dir == 0) {
+ const int xy= s->mb_x-1 + s->mb_y*s->mb_stride;
/* left prediction */
ac_val -= 16;
- if(s->mb_x == 0 || s->qscale == qscale_table[xy] || n == 1 || n == 3)
- {
+ if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
/* same qscale */
- for(i = 1; i < 8; i++)
- {
+ for(i=1;i<8;i++) {
block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
}
- }
- else
- {
+ }else{
/* different qscale, we must rescale */
- for(i = 1; i < 8; i++)
- {
- block[s->dsp.idct_permutation[i<<3]] += ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale);
+ for(i=1;i<8;i++) {
+ block[s->dsp.idct_permutation[i<<3]] += ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
}
}
- }
- else
- {
- const int xy = s->mb_x + s->mb_y * s->mb_stride - s->mb_stride;
+ } else {
+ const int xy= s->mb_x + s->mb_y*s->mb_stride - s->mb_stride;
/* top prediction */
ac_val -= 16 * s->block_wrap[n];
- if(s->mb_y == 0 || s->qscale == qscale_table[xy] || n == 2 || n == 3)
- {
+ if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
/* same qscale */
- for(i = 1; i < 8; i++)
- {
+ for(i=1;i<8;i++) {
block[s->dsp.idct_permutation[i]] += ac_val[i + 8];
}
- }
- else
- {
+ }else{
/* different qscale, we must rescale */
- for(i = 1; i < 8; i++)
- {
- block[s->dsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale);
+ for(i=1;i<8;i++) {
+ block[s->dsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
}
}
}
}
/* left copy */
- for(i = 1; i < 8; i++)
+ for(i=1;i<8;i++)
ac_val1[i ] = block[s->dsp.idct_permutation[i<<3]];
/* top copy */
- for(i = 1; i < 8; i++)
+ for(i=1;i<8;i++)
ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]];
}
@@ -123,51 +108,43 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
* check if the next stuff is a resync marker or the end.
* @return 0 if not
*/
-static inline int mpeg4_is_resync(MpegEncContext *s)
-{
- int bits_count = get_bits_count(&s->gb);
- int v = show_bits(&s->gb, 16);
+static inline int mpeg4_is_resync(MpegEncContext *s){
+ int bits_count= get_bits_count(&s->gb);
+ int v= show_bits(&s->gb, 16);
- if(s->workaround_bugs & FF_BUG_NO_PADDING)
- {
+ if(s->workaround_bugs&FF_BUG_NO_PADDING){
return 0;
}
- while(v <= 0xFF)
- {
- if(s->pict_type == FF_B_TYPE || (v >> (8 - s->pict_type) != 1) || s->partitioned_frame)
+ while(v<=0xFF){
+ if(s->pict_type==FF_B_TYPE || (v>>(8-s->pict_type)!=1) || s->partitioned_frame)
break;
- skip_bits(&s->gb, 8 + s->pict_type);
- bits_count += 8 + s->pict_type;
- v = show_bits(&s->gb, 16);
+ skip_bits(&s->gb, 8+s->pict_type);
+ bits_count+= 8+s->pict_type;
+ v= show_bits(&s->gb, 16);
}
- if(bits_count + 8 >= s->gb.size_in_bits)
- {
- v >>= 8;
- v |= 0x7F >> (7 - (bits_count & 7));
+ if(bits_count + 8 >= s->gb.size_in_bits){
+ v>>=8;
+ v|= 0x7F >> (7-(bits_count&7));
- if(v == 0x7F)
+ if(v==0x7F)
return 1;
- }
- else
- {
- if(v == ff_mpeg4_resync_prefix[bits_count&7])
- {
+ }else{
+ if(v == ff_mpeg4_resync_prefix[bits_count&7]){
int len;
- GetBitContext gb = s->gb;
+ GetBitContext gb= s->gb;
skip_bits(&s->gb, 1);
align_get_bits(&s->gb);
- for(len = 0; len < 32; len++)
- {
+ for(len=0; len<32; len++){
if(get_bits1(&s->gb)) break;
}
- s->gb = gb;
+ s->gb= gb;
- if(len >= ff_mpeg4_get_video_packet_prefix_length(s))
+ if(len>=ff_mpeg4_get_video_packet_prefix_length(s))
return 1;
}
}
@@ -177,198 +154,190 @@ static inline int mpeg4_is_resync(MpegEncContext *s)
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb)
{
int i;
- int a = 2 << s->sprite_warping_accuracy;
- int rho = 3 - s->sprite_warping_accuracy;
- int r = 16 / a;
- const int vop_ref[4][2] = {{0, 0}, {s->width, 0}, {0, s->height}, {s->width, s->height}}; // only true for rectangle shapes
- int d[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ int a= 2<<s->sprite_warping_accuracy;
+ int rho= 3-s->sprite_warping_accuracy;
+ int r=16/a;
+ const int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; // only true for rectangle shapes
+ int d[4][2]={{0,0}, {0,0}, {0,0}, {0,0}};
int sprite_ref[4][2];
int virtual_ref[2][2];
int w2, h2, w3, h3;
- int alpha = 0, beta = 0;
- int w = s->width;
- int h = s->height;
+ int alpha=0, beta=0;
+ int w= s->width;
+ int h= s->height;
int min_ab;
- for(i = 0; i < s->num_sprite_warping_points; i++)
- {
+ for(i=0; i<s->num_sprite_warping_points; i++){
int length;
- int x = 0, y = 0;
+ int x=0, y=0;
- length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
- if(length)
- {
- x = get_xbits(gb, length);
+ length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
+ if(length){
+ x= get_xbits(gb, length);
}
- if(!(s->divx_version == 500 && s->divx_build == 413)) skip_bits1(gb); /* marker bit */
+ if(!(s->divx_version==500 && s->divx_build==413)) skip_bits1(gb); /* marker bit */
- length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
- if(length)
- {
- y = get_xbits(gb, length);
+ length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
+ if(length){
+ y=get_xbits(gb, length);
}
skip_bits1(gb); /* marker bit */
- s->sprite_traj[i][0] = d[i][0] = x;
- s->sprite_traj[i][1] = d[i][1] = y;
+ s->sprite_traj[i][0]= d[i][0]= x;
+ s->sprite_traj[i][1]= d[i][1]= y;
}
- for(; i < 4; i++)
- s->sprite_traj[i][0] = s->sprite_traj[i][1] = 0;
+ for(; i<4; i++)
+ s->sprite_traj[i][0]= s->sprite_traj[i][1]= 0;
- while((1 << alpha) < w) alpha++;
- while((1 << beta) < h) beta++; // there seems to be a typo in the mpeg4 std for the definition of w' and h'
- w2 = 1 << alpha;
- h2 = 1 << beta;
+ while((1<<alpha)<w) alpha++;
+ while((1<<beta )<h) beta++; // there seems to be a typo in the mpeg4 std for the definition of w' and h'
+ w2= 1<<alpha;
+ h2= 1<<beta;
// Note, the 4th point isn't used for GMC
- if(s->divx_version == 500 && s->divx_build == 413)
- {
- sprite_ref[0][0] = a * vop_ref[0][0] + d[0][0];
- sprite_ref[0][1] = a * vop_ref[0][1] + d[0][1];
- sprite_ref[1][0] = a * vop_ref[1][0] + d[0][0] + d[1][0];
- sprite_ref[1][1] = a * vop_ref[1][1] + d[0][1] + d[1][1];
- sprite_ref[2][0] = a * vop_ref[2][0] + d[0][0] + d[2][0];
- sprite_ref[2][1] = a * vop_ref[2][1] + d[0][1] + d[2][1];
- }
- else
- {
- sprite_ref[0][0] = (a >> 1) * (2 * vop_ref[0][0] + d[0][0]);
- sprite_ref[0][1] = (a >> 1) * (2 * vop_ref[0][1] + d[0][1]);
- sprite_ref[1][0] = (a >> 1) * (2 * vop_ref[1][0] + d[0][0] + d[1][0]);
- sprite_ref[1][1] = (a >> 1) * (2 * vop_ref[1][1] + d[0][1] + d[1][1]);
- sprite_ref[2][0] = (a >> 1) * (2 * vop_ref[2][0] + d[0][0] + d[2][0]);
- sprite_ref[2][1] = (a >> 1) * (2 * vop_ref[2][1] + d[0][1] + d[2][1]);
- }
- /* sprite_ref[3][0]= (a>>1)*(2*vop_ref[3][0] + d[0][0] + d[1][0] + d[2][0] + d[3][0]);
- sprite_ref[3][1]= (a>>1)*(2*vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] + d[3][1]); */
+ if(s->divx_version==500 && s->divx_build==413){
+ sprite_ref[0][0]= a*vop_ref[0][0] + d[0][0];
+ sprite_ref[0][1]= a*vop_ref[0][1] + d[0][1];
+ sprite_ref[1][0]= a*vop_ref[1][0] + d[0][0] + d[1][0];
+ sprite_ref[1][1]= a*vop_ref[1][1] + d[0][1] + d[1][1];
+ sprite_ref[2][0]= a*vop_ref[2][0] + d[0][0] + d[2][0];
+ sprite_ref[2][1]= a*vop_ref[2][1] + d[0][1] + d[2][1];
+ } else {
+ sprite_ref[0][0]= (a>>1)*(2*vop_ref[0][0] + d[0][0]);
+ sprite_ref[0][1]= (a>>1)*(2*vop_ref[0][1] + d[0][1]);
+ sprite_ref[1][0]= (a>>1)*(2*vop_ref[1][0] + d[0][0] + d[1][0]);
+ sprite_ref[1][1]= (a>>1)*(2*vop_ref[1][1] + d[0][1] + d[1][1]);
+ sprite_ref[2][0]= (a>>1)*(2*vop_ref[2][0] + d[0][0] + d[2][0]);
+ sprite_ref[2][1]= (a>>1)*(2*vop_ref[2][1] + d[0][1] + d[2][1]);
+ }
+/* sprite_ref[3][0]= (a>>1)*(2*vop_ref[3][0] + d[0][0] + d[1][0] + d[2][0] + d[3][0]);
+ sprite_ref[3][1]= (a>>1)*(2*vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] + d[3][1]); */
// this is mostly identical to the mpeg4 std (and is totally unreadable because of that ...)
// perhaps it should be reordered to be more readable ...
// the idea behind this virtual_ref mess is to be able to use shifts later per pixel instead of divides
// so the distance between points is converted from w&h based to w2&h2 based which are of the 2^x form
- virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2)
- + ROUNDED_DIV(((w - w2) * (r * sprite_ref[0][0] - 16 * vop_ref[0][0]) + w2 * (r * sprite_ref[1][0] - 16 * vop_ref[1][0])), w);
- virtual_ref[0][1] = 16 * vop_ref[0][1]
- + ROUNDED_DIV(((w - w2) * (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) + w2 * (r * sprite_ref[1][1] - 16 * vop_ref[1][1])), w);
- virtual_ref[1][0] = 16 * vop_ref[0][0]
- + ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16 * vop_ref[0][0]) + h2 * (r * sprite_ref[2][0] - 16 * vop_ref[2][0])), h);
- virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2)
- + ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) + h2 * (r * sprite_ref[2][1] - 16 * vop_ref[2][1])), h);
+ virtual_ref[0][0]= 16*(vop_ref[0][0] + w2)
+ + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + w2*(r*sprite_ref[1][0] - 16*vop_ref[1][0])),w);
+ virtual_ref[0][1]= 16*vop_ref[0][1]
+ + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + w2*(r*sprite_ref[1][1] - 16*vop_ref[1][1])),w);
+ virtual_ref[1][0]= 16*vop_ref[0][0]
+ + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + h2*(r*sprite_ref[2][0] - 16*vop_ref[2][0])),h);
+ virtual_ref[1][1]= 16*(vop_ref[0][1] + h2)
+ + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + h2*(r*sprite_ref[2][1] - 16*vop_ref[2][1])),h);
switch(s->num_sprite_warping_points)
{
- case 0:
- s->sprite_offset[0][0] = 0;
- s->sprite_offset[0][1] = 0;
- s->sprite_offset[1][0] = 0;
- s->sprite_offset[1][1] = 0;
- s->sprite_delta[0][0] = a;
- s->sprite_delta[0][1] = 0;
- s->sprite_delta[1][0] = 0;
- s->sprite_delta[1][1] = a;
- s->sprite_shift[0] = 0;
- s->sprite_shift[1] = 0;
- break;
- case 1: //GMC only
- s->sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0];
- s->sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1];
- s->sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) - a * (vop_ref[0][0] / 2);
- s->sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) - a * (vop_ref[0][1] / 2);
- s->sprite_delta[0][0] = a;
- s->sprite_delta[0][1] = 0;
- s->sprite_delta[1][0] = 0;
- s->sprite_delta[1][1] = a;
- s->sprite_shift[0] = 0;
- s->sprite_shift[1] = 0;
- break;
- case 2:
- s->sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + rho))
- + (-r * sprite_ref[0][0] + virtual_ref[0][0]) * (-vop_ref[0][0])
- + (r * sprite_ref[0][1] - virtual_ref[0][1]) * (-vop_ref[0][1])
- + (1 << (alpha + rho - 1));
- s->sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + rho))
- + (-r * sprite_ref[0][1] + virtual_ref[0][1]) * (-vop_ref[0][0])
- + (-r * sprite_ref[0][0] + virtual_ref[0][0]) * (-vop_ref[0][1])
- + (1 << (alpha + rho - 1));
- s->sprite_offset[1][0] = ((-r * sprite_ref[0][0] + virtual_ref[0][0]) * (-2 * vop_ref[0][0] + 1)
- + (r * sprite_ref[0][1] - virtual_ref[0][1]) * (-2 * vop_ref[0][1] + 1)
- + 2 * w2 * r * sprite_ref[0][0]
- - 16 * w2
- + (1 << (alpha + rho + 1)));
- s->sprite_offset[1][1] = ((-r * sprite_ref[0][1] + virtual_ref[0][1]) * (-2 * vop_ref[0][0] + 1)
- + (-r * sprite_ref[0][0] + virtual_ref[0][0]) * (-2 * vop_ref[0][1] + 1)
- + 2 * w2 * r * sprite_ref[0][1]
- - 16 * w2
- + (1 << (alpha + rho + 1)));
- s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
- s->sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]);
- s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]);
- s->sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
-
- s->sprite_shift[0] = alpha + rho;
- s->sprite_shift[1] = alpha + rho + 2;
- break;
- case 3:
- min_ab = FFMIN(alpha, beta);
- w3 = w2 >> min_ab;
- h3 = h2 >> min_ab;
- s->sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + beta + rho - min_ab))
- + (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-vop_ref[0][0])
- + (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-vop_ref[0][1])
- + (1 << (alpha + beta + rho - min_ab - 1));
- s->sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + beta + rho - min_ab))
- + (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-vop_ref[0][0])
- + (-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-vop_ref[0][1])
- + (1 << (alpha + beta + rho - min_ab - 1));
- s->sprite_offset[1][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-2 * vop_ref[0][0] + 1)
- + (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-2 * vop_ref[0][1] + 1)
- + 2 * w2 * h3 * r * sprite_ref[0][0]
- - 16 * w2 * h3
- + (1 << (alpha + beta + rho - min_ab + 1));
- s->sprite_offset[1][1] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-2 * vop_ref[0][0] + 1)
- + (-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1)
- + 2 * w2 * h3 * r * sprite_ref[0][1]
- - 16 * w2 * h3
- + (1 << (alpha + beta + rho - min_ab + 1));
- s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3;
- s->sprite_delta[0][1] = (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3;
- s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3;
- s->sprite_delta[1][1] = (-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3;
-
- s->sprite_shift[0] = alpha + beta + rho - min_ab;
- s->sprite_shift[1] = alpha + beta + rho - min_ab + 2;
- break;
+ case 0:
+ s->sprite_offset[0][0]= 0;
+ s->sprite_offset[0][1]= 0;
+ s->sprite_offset[1][0]= 0;
+ s->sprite_offset[1][1]= 0;
+ s->sprite_delta[0][0]= a;
+ s->sprite_delta[0][1]= 0;
+ s->sprite_delta[1][0]= 0;
+ s->sprite_delta[1][1]= a;
+ s->sprite_shift[0]= 0;
+ s->sprite_shift[1]= 0;
+ break;
+ case 1: //GMC only
+ s->sprite_offset[0][0]= sprite_ref[0][0] - a*vop_ref[0][0];
+ s->sprite_offset[0][1]= sprite_ref[0][1] - a*vop_ref[0][1];
+ s->sprite_offset[1][0]= ((sprite_ref[0][0]>>1)|(sprite_ref[0][0]&1)) - a*(vop_ref[0][0]/2);
+ s->sprite_offset[1][1]= ((sprite_ref[0][1]>>1)|(sprite_ref[0][1]&1)) - a*(vop_ref[0][1]/2);
+ s->sprite_delta[0][0]= a;
+ s->sprite_delta[0][1]= 0;
+ s->sprite_delta[1][0]= 0;
+ s->sprite_delta[1][1]= a;
+ s->sprite_shift[0]= 0;
+ s->sprite_shift[1]= 0;
+ break;
+ case 2:
+ s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+rho))
+ + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][0])
+ + ( r*sprite_ref[0][1] - virtual_ref[0][1])*(-vop_ref[0][1])
+ + (1<<(alpha+rho-1));
+ s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+rho))
+ + (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-vop_ref[0][0])
+ + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][1])
+ + (1<<(alpha+rho-1));
+ s->sprite_offset[1][0]= ( (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][0] + 1)
+ +( r*sprite_ref[0][1] - virtual_ref[0][1])*(-2*vop_ref[0][1] + 1)
+ +2*w2*r*sprite_ref[0][0]
+ - 16*w2
+ + (1<<(alpha+rho+1)));
+ s->sprite_offset[1][1]= ( (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-2*vop_ref[0][0] + 1)
+ +(-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][1] + 1)
+ +2*w2*r*sprite_ref[0][1]
+ - 16*w2
+ + (1<<(alpha+rho+1)));
+ s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0]);
+ s->sprite_delta[0][1]= (+r*sprite_ref[0][1] - virtual_ref[0][1]);
+ s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1]);
+ s->sprite_delta[1][1]= (-r*sprite_ref[0][0] + virtual_ref[0][0]);
+
+ s->sprite_shift[0]= alpha+rho;
+ s->sprite_shift[1]= alpha+rho+2;
+ break;
+ case 3:
+ min_ab= FFMIN(alpha, beta);
+ w3= w2>>min_ab;
+ h3= h2>>min_ab;
+ s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+beta+rho-min_ab))
+ + (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-vop_ref[0][0])
+ + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-vop_ref[0][1])
+ + (1<<(alpha+beta+rho-min_ab-1));
+ s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+beta+rho-min_ab))
+ + (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-vop_ref[0][0])
+ + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-vop_ref[0][1])
+ + (1<<(alpha+beta+rho-min_ab-1));
+ s->sprite_offset[1][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-2*vop_ref[0][0] + 1)
+ + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-2*vop_ref[0][1] + 1)
+ + 2*w2*h3*r*sprite_ref[0][0]
+ - 16*w2*h3
+ + (1<<(alpha+beta+rho-min_ab+1));
+ s->sprite_offset[1][1]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-2*vop_ref[0][0] + 1)
+ + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-2*vop_ref[0][1] + 1)
+ + 2*w2*h3*r*sprite_ref[0][1]
+ - 16*w2*h3
+ + (1<<(alpha+beta+rho-min_ab+1));
+ s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3;
+ s->sprite_delta[0][1]= (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3;
+ s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3;
+ s->sprite_delta[1][1]= (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3;
+
+ s->sprite_shift[0]= alpha + beta + rho - min_ab;
+ s->sprite_shift[1]= alpha + beta + rho - min_ab + 2;
+ break;
}
/* try to simplify the situation */
- if(s->sprite_delta[0][0] == a << s->sprite_shift[0]
- && s->sprite_delta[0][1] == 0
- && s->sprite_delta[1][0] == 0
- && s->sprite_delta[1][1] == a << s->sprite_shift[0])
- {
- s->sprite_offset[0][0] >>= s->sprite_shift[0];
- s->sprite_offset[0][1] >>= s->sprite_shift[0];
- s->sprite_offset[1][0] >>= s->sprite_shift[1];
- s->sprite_offset[1][1] >>= s->sprite_shift[1];
- s->sprite_delta[0][0] = a;
- s->sprite_delta[0][1] = 0;
- s->sprite_delta[1][0] = 0;
- s->sprite_delta[1][1] = a;
- s->sprite_shift[0] = 0;
- s->sprite_shift[1] = 0;
- s->real_sprite_warping_points = 1;
- }
- else
- {
- int shift_y = 16 - s->sprite_shift[0];
- int shift_c = 16 - s->sprite_shift[1];
- for(i = 0; i < 2; i++)
- {
- s->sprite_offset[0][i] <<= shift_y;
- s->sprite_offset[1][i] <<= shift_c;
- s->sprite_delta[0][i] <<= shift_y;
- s->sprite_delta[1][i] <<= shift_y;
- s->sprite_shift[i] = 16;
- }
- s->real_sprite_warping_points = s->num_sprite_warping_points;
+ if( s->sprite_delta[0][0] == a<<s->sprite_shift[0]
+ && s->sprite_delta[0][1] == 0
+ && s->sprite_delta[1][0] == 0
+ && s->sprite_delta[1][1] == a<<s->sprite_shift[0])
+ {
+ s->sprite_offset[0][0]>>=s->sprite_shift[0];
+ s->sprite_offset[0][1]>>=s->sprite_shift[0];
+ s->sprite_offset[1][0]>>=s->sprite_shift[1];
+ s->sprite_offset[1][1]>>=s->sprite_shift[1];
+ s->sprite_delta[0][0]= a;
+ s->sprite_delta[0][1]= 0;
+ s->sprite_delta[1][0]= 0;
+ s->sprite_delta[1][1]= a;
+ s->sprite_shift[0]= 0;
+ s->sprite_shift[1]= 0;
+ s->real_sprite_warping_points=1;
+ }
+ else{
+ int shift_y= 16 - s->sprite_shift[0];
+ int shift_c= 16 - s->sprite_shift[1];
+ for(i=0; i<2; i++){
+ s->sprite_offset[0][i]<<= shift_y;
+ s->sprite_offset[1][i]<<= shift_c;
+ s->sprite_delta[0][i]<<= shift_y;
+ s->sprite_delta[1][i]<<= shift_y;
+ s->sprite_shift[i]= 16;
+ }
+ s->real_sprite_warping_points= s->num_sprite_warping_points;
}
}
@@ -378,95 +347,81 @@ static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb
*/
int 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;
+ int mb_num_bits= av_log2(s->mb_num - 1) + 1;
+ int header_extension=0, mb_num, len;
/* is there enough space left for a video packet + header */
- if(get_bits_count(&s->gb) > s->gb.size_in_bits - 20) return -1;
+ if( get_bits_count(&s->gb) > s->gb.size_in_bits-20) return -1;
- for(len = 0; len < 32; len++)
- {
+ for(len=0; len<32; len++){
if(get_bits1(&s->gb)) break;
}
- if(len != ff_mpeg4_get_video_packet_prefix_length(s))
- {
+ if(len!=ff_mpeg4_get_video_packet_prefix_length(s)){
av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n");
return -1;
}
- if(s->shape != RECT_SHAPE)
- {
- header_extension = get_bits1(&s->gb);
+ if(s->shape != RECT_SHAPE){
+ header_extension= get_bits1(&s->gb);
//FIXME more stuff here
}
- mb_num = get_bits(&s->gb, mb_num_bits);
- if(mb_num >= s->mb_num)
- {
+ mb_num= get_bits(&s->gb, mb_num_bits);
+ if(mb_num>=s->mb_num){
av_log(s->avctx, AV_LOG_ERROR, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num);
return -1;
}
- if(s->pict_type == FF_B_TYPE)
- {
+ if(s->pict_type == FF_B_TYPE){
while(s->next_picture.mbskip_table[ s->mb_index2xy[ mb_num ] ]) mb_num++;
if(mb_num >= s->mb_num) return -1; // slice contains just skipped MBs which where already decoded
}
- s->mb_x = mb_num % s->mb_width;
- s->mb_y = mb_num / s->mb_width;
+ s->mb_x= mb_num % s->mb_width;
+ s->mb_y= mb_num / s->mb_width;
- if(s->shape != BIN_ONLY_SHAPE)
- {
- int qscale = get_bits(&s->gb, s->quant_precision);
+ if(s->shape != BIN_ONLY_SHAPE){
+ int qscale= get_bits(&s->gb, s->quant_precision);
if(qscale)
- s->chroma_qscale = s->qscale = qscale;
+ s->chroma_qscale=s->qscale= qscale;
}
- if(s->shape == RECT_SHAPE)
- {
- header_extension = get_bits1(&s->gb);
+ if(s->shape == RECT_SHAPE){
+ header_extension= get_bits1(&s->gb);
}
- if(header_extension)
- {
+ if(header_extension){
int time_increment;
- int time_incr = 0;
+ int time_incr=0;
- while(get_bits1(&s->gb) != 0)
+ while (get_bits1(&s->gb) != 0)
time_incr++;
check_marker(&s->gb, "before time_increment in video packed header");
- time_increment = get_bits(&s->gb, s->time_increment_bits);
+ time_increment= get_bits(&s->gb, s->time_increment_bits);
check_marker(&s->gb, "before vop_coding_type in video packed header");
skip_bits(&s->gb, 2); /* vop coding type */
//FIXME not rect stuff here
- if(s->shape != BIN_ONLY_SHAPE)
- {
+ if(s->shape != BIN_ONLY_SHAPE){
skip_bits(&s->gb, 3); /* intra dc vlc threshold */
//FIXME don't just ignore everything
- if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE)
- {
+ if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
mpeg4_decode_sprite_trajectory(s, &s->gb);
av_log(s->avctx, AV_LOG_ERROR, "untested\n");
}
//FIXME reduced res stuff here
- if(s->pict_type != FF_I_TYPE)
- {
+ if (s->pict_type != FF_I_TYPE) {
int f_code = get_bits(&s->gb, 3); /* fcode_for */
- if(f_code == 0)
- {
+ if(f_code==0){
av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (f_code=0)\n");
}
}
- if(s->pict_type == FF_B_TYPE)
- {
+ if (s->pict_type == FF_B_TYPE) {
int b_code = get_bits(&s->gb, 3);
- if(b_code == 0)
- {
+ if(b_code==0){
av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (b_code=0)\n");
}
}
@@ -482,49 +437,43 @@ int mpeg4_decode_video_packet_header(MpegEncContext *s)
* @param n either 0 for the x component or 1 for y
* @returns the average MV for a GMC MB
*/
-static inline int get_amv(MpegEncContext *s, int n)
-{
+static inline int get_amv(MpegEncContext *s, int n){
int x, y, mb_v, sum, dx, dy, shift;
int len = 1 << (s->f_code + 4);
- const int a = s->sprite_warping_accuracy;
+ const int a= s->sprite_warping_accuracy;
if(s->workaround_bugs & FF_BUG_AMV)
len >>= s->quarter_sample;
- if(s->real_sprite_warping_points == 1)
- {
- if(s->divx_version == 500 && s->divx_build == 413)
- sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample));
+ if(s->real_sprite_warping_points==1){
+ if(s->divx_version==500 && s->divx_build==413)
+ sum= s->sprite_offset[0][n] / (1<<(a - s->quarter_sample));
else
- sum = RSHIFT(s->sprite_offset[0][n] << s->quarter_sample, a);
- }
- else
- {
- dx = s->sprite_delta[n][0];
- dy = s->sprite_delta[n][1];
- shift = s->sprite_shift[0];
- if(n) dy -= 1 << (shift + a + 1);
- else dx -= 1 << (shift + a + 1);
- mb_v = s->sprite_offset[0][n] + dx * s->mb_x * 16 + dy * s->mb_y * 16;
-
- sum = 0;
- for(y = 0; y < 16; y++)
- {
+ sum= RSHIFT(s->sprite_offset[0][n]<<s->quarter_sample, a);
+ }else{
+ dx= s->sprite_delta[n][0];
+ dy= s->sprite_delta[n][1];
+ shift= s->sprite_shift[0];
+ if(n) dy -= 1<<(shift + a + 1);
+ else dx -= 1<<(shift + a + 1);
+ mb_v= s->sprite_offset[0][n] + dx*s->mb_x*16 + dy*s->mb_y*16;
+
+ sum=0;
+ for(y=0; y<16; y++){
int v;
- v = mb_v + dy * y;
+ v= mb_v + dy*y;
//XXX FIXME optimize
- for(x = 0; x < 16; x++)
- {
- sum += v >> shift;
- v += dx;
+ for(x=0; x<16; x++){
+ sum+= v>>shift;
+ v+= dx;
}
}
- sum = RSHIFT(sum, a + 8 - s->quarter_sample);
+ sum= RSHIFT(sum, a+8-s->quarter_sample);
}
- if(sum < -len) sum = -len;
- else if(sum >= len) sum = len - 1;
+ if (sum < -len) sum= -len;
+ else if (sum >= len) sum= len-1;
return sum;
}
@@ -539,44 +488,33 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
{
int level, code;
- if(n < 4)
+ if (n < 4)
code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1);
else
code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);
- if(code < 0 || code > 9 /* && s->nbit<9 */)
- {
+ if (code < 0 || code > 9 /* && s->nbit<9 */){
av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
return -1;
}
- if(code == 0)
- {
+ if (code == 0) {
level = 0;
- }
- else
- {
- if(IS_3IV1)
- {
- if(code == 1)
- level = 2 * get_bits1(&s->gb) - 1;
- else
- {
+ } else {
+ if(IS_3IV1){
+ if(code==1)
+ level= 2*get_bits1(&s->gb)-1;
+ else{
if(get_bits1(&s->gb))
- level = get_bits(&s->gb, code - 1) + (1 << (code - 1));
+ level = get_bits(&s->gb, code-1) + (1<<(code-1));
else
- level = -get_bits(&s->gb, code - 1) - (1 << (code - 1));
+ level = -get_bits(&s->gb, code-1) - (1<<(code-1));
}
- }
- else
- {
+ }else{
level = get_xbits(&s->gb, code);
}
- if(code > 8)
- {
- if(get_bits1(&s->gb) == 0) /* marker */
- {
- if(s->error_recognition >= 2)
- {
+ if (code > 8){
+ if(get_bits1(&s->gb)==0){ /* marker */
+ if(s->error_recognition>=2){
av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n");
return -1;
}
@@ -591,104 +529,86 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
* decodes first partition.
* @return number of MBs decoded or <0 if an error occurred
*/
-static int mpeg4_decode_partition_a(MpegEncContext *s)
-{
+static int mpeg4_decode_partition_a(MpegEncContext *s){
int mb_num;
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
/* decode first partition */
- mb_num = 0;
- s->first_slice_line = 1;
- for(; s->mb_y < s->mb_height; s->mb_y++)
- {
+ mb_num=0;
+ s->first_slice_line=1;
+ for(; s->mb_y<s->mb_height; s->mb_y++){
ff_init_block_index(s);
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
- const int xy = s->mb_x + s->mb_y * s->mb_stride;
+ for(; s->mb_x<s->mb_width; s->mb_x++){
+ const int xy= s->mb_x + s->mb_y*s->mb_stride;
int cbpc;
- int dir = 0;
+ int dir=0;
mb_num++;
ff_update_block_index(s);
- if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1)
- s->first_slice_line = 0;
+ if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1)
+ s->first_slice_line=0;
- if(s->pict_type == FF_I_TYPE)
- {
+ if(s->pict_type==FF_I_TYPE){
int i;
- do
- {
- if(show_bits_long(&s->gb, 19) == DC_MARKER)
- {
- return mb_num - 1;
+ do{
+ if(show_bits_long(&s->gb, 19)==DC_MARKER){
+ return mb_num-1;
}
cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
- if(cbpc < 0)
- {
+ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- }
- while(cbpc == 8);
+ }while(cbpc == 8);
- s->cbp_table[xy] = cbpc & 3;
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
+ s->cbp_table[xy]= cbpc & 3;
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
s->mb_intra = 1;
- if(cbpc & 4)
- {
+ if(cbpc & 4) {
ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
}
- s->current_picture.qscale_table[xy] = s->qscale;
+ s->current_picture.qscale_table[xy]= s->qscale;
- s->mbintra_table[xy] = 1;
- for(i = 0; i < 6; i++)
- {
+ s->mbintra_table[xy]= 1;
+ for(i=0; i<6; i++){
int dc_pred_dir;
- int dc = mpeg4_decode_dc(s, i, &dc_pred_dir);
- if(dc < 0)
- {
+ int dc= mpeg4_decode_dc(s, i, &dc_pred_dir);
+ if(dc < 0){
av_log(s->avctx, AV_LOG_ERROR, "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- dir <<= 1;
- if(dc_pred_dir) dir |= 1;
+ dir<<=1;
+ if(dc_pred_dir) dir|=1;
}
- s->pred_dir_table[xy] = dir;
- }
- else /* P/S_TYPE */
- {
+ s->pred_dir_table[xy]= dir;
+ }else{ /* P/S_TYPE */
int mx, my, pred_x, pred_y, bits;
- int16_t * const mot_val = s->current_picture.motion_val[0][s->block_index[0]];
- const int stride = s->b8_stride * 2;
+ int16_t * const mot_val= s->current_picture.motion_val[0][s->block_index[0]];
+ const int stride= s->b8_stride*2;
try_again:
- bits = show_bits(&s->gb, 17);
- if(bits == MOTION_MARKER)
- {
- return mb_num - 1;
+ bits= show_bits(&s->gb, 17);
+ if(bits==MOTION_MARKER){
+ return mb_num-1;
}
skip_bits1(&s->gb);
- if(bits & 0x10000)
- {
+ if(bits&0x10000){
/* skip mb */
- if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
- mx = get_amv(s, 0);
- my = get_amv(s, 1);
- }
- else
- {
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
- mx = my = 0;
+ if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
+ mx= get_amv(s, 0);
+ my= get_amv(s, 1);
+ }else{
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ mx=my=0;
}
- mot_val[0 ] = mot_val[2 ] =
- mot_val[0+stride] = mot_val[2+stride] = mx;
- mot_val[1 ] = mot_val[3 ] =
- mot_val[1+stride] = mot_val[3+stride] = my;
+ mot_val[0 ]= mot_val[2 ]=
+ mot_val[0+stride]= mot_val[2+stride]= mx;
+ mot_val[1 ]= mot_val[3 ]=
+ mot_val[1+stride]= mot_val[3+stride]= my;
if(s->mbintra_table[xy])
ff_clean_intra_table_entries(s);
@@ -696,77 +616,66 @@ try_again:
}
cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
- if(cbpc < 0)
- {
+ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if(cbpc == 20)
goto try_again;
- s->cbp_table[xy] = cbpc & (8 + 3); //8 is dquant
+ s->cbp_table[xy]= cbpc&(8+3); //8 is dquant
s->mb_intra = ((cbpc & 4) != 0);
- if(s->mb_intra)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
- s->mbintra_table[xy] = 1;
- mot_val[0 ] = mot_val[2 ] =
- mot_val[0+stride] = mot_val[2+stride] = 0;
- mot_val[1 ] = mot_val[3 ] =
- mot_val[1+stride] = mot_val[3+stride] = 0;
- }
- else
- {
+ if(s->mb_intra){
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
+ s->mbintra_table[xy]= 1;
+ mot_val[0 ]= mot_val[2 ]=
+ mot_val[0+stride]= mot_val[2+stride]= 0;
+ mot_val[1 ]= mot_val[3 ]=
+ mot_val[1+stride]= mot_val[3+stride]= 0;
+ }else{
if(s->mbintra_table[xy])
ff_clean_intra_table_entries(s);
- if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE && (cbpc & 16) == 0)
- s->mcsel = get_bits1(&s->gb);
- else s->mcsel = 0;
+ if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE && (cbpc & 16) == 0)
+ s->mcsel= get_bits1(&s->gb);
+ else s->mcsel= 0;
- if((cbpc & 16) == 0)
- {
+ if ((cbpc & 16) == 0) {
/* 16x16 motion prediction */
h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
- if(!s->mcsel)
- {
+ if(!s->mcsel){
mx = h263_decode_motion(s, pred_x, s->f_code);
- if(mx >= 0xffff)
+ if (mx >= 0xffff)
return -1;
my = h263_decode_motion(s, pred_y, s->f_code);
- if(my >= 0xffff)
+ if (my >= 0xffff)
return -1;
- s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
- }
- else
- {
+ s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
+ } else {
mx = get_amv(s, 0);
my = get_amv(s, 1);
- s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
+ s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
}
- mot_val[0 ] = mot_val[2 ] =
- mot_val[0+stride] = mot_val[2+stride] = mx;
- mot_val[1 ] = mot_val[3 ] =
- mot_val[1+stride] = mot_val[3+stride] = my;
- }
- else
- {
+ mot_val[0 ]= mot_val[2 ] =
+ mot_val[0+stride]= mot_val[2+stride]= mx;
+ mot_val[1 ]= mot_val[3 ]=
+ mot_val[1+stride]= mot_val[3+stride]= my;
+ } else {
int i;
- s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0;
- for(i = 0; i < 4; i++)
- {
- int16_t *mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
+ s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
+ for(i=0;i<4;i++) {
+ int16_t *mot_val= h263_pred_motion(s, i, 0, &pred_x, &pred_y);
mx = h263_decode_motion(s, pred_x, s->f_code);
- if(mx >= 0xffff)
+ if (mx >= 0xffff)
return -1;
my = h263_decode_motion(s, pred_y, s->f_code);
- if(my >= 0xffff)
+ if (my >= 0xffff)
return -1;
mot_val[0] = mx;
mot_val[1] = my;
@@ -775,7 +684,7 @@ try_again:
}
}
}
- s->mb_x = 0;
+ s->mb_x= 0;
}
return mb_num;
@@ -785,103 +694,85 @@ try_again:
* decode second partition.
* @return <0 if an error occurred
*/
-static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
-{
- int mb_num = 0;
+static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
+ int mb_num=0;
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
- s->mb_x = s->resync_mb_x;
- s->first_slice_line = 1;
- for(s->mb_y = s->resync_mb_y; mb_num < mb_count; s->mb_y++)
- {
+ s->mb_x= s->resync_mb_x;
+ s->first_slice_line=1;
+ for(s->mb_y= s->resync_mb_y; mb_num < mb_count; s->mb_y++){
ff_init_block_index(s);
- for(; mb_num < mb_count && s->mb_x < s->mb_width; s->mb_x++)
- {
- const int xy = s->mb_x + s->mb_y * s->mb_stride;
+ for(; mb_num < mb_count && s->mb_x<s->mb_width; s->mb_x++){
+ const int xy= s->mb_x + s->mb_y*s->mb_stride;
mb_num++;
ff_update_block_index(s);
- if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1)
- s->first_slice_line = 0;
+ if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1)
+ s->first_slice_line=0;
- if(s->pict_type == FF_I_TYPE)
- {
- int ac_pred = get_bits1(&s->gb);
+ if(s->pict_type==FF_I_TYPE){
+ int ac_pred= get_bits1(&s->gb);
int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- s->cbp_table[xy] |= cbpy << 2;
- s->current_picture.mb_type[xy] |= ac_pred * MB_TYPE_ACPRED;
- }
- else /* P || S_TYPE */
- {
- if(IS_INTRA(s->current_picture.mb_type[xy]))
- {
- int dir = 0, i;
+ s->cbp_table[xy]|= cbpy<<2;
+ s->current_picture.mb_type[xy] |= ac_pred*MB_TYPE_ACPRED;
+ }else{ /* P || S_TYPE */
+ if(IS_INTRA(s->current_picture.mb_type[xy])){
+ int dir=0,i;
int ac_pred = get_bits1(&s->gb);
int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- if(s->cbp_table[xy] & 8)
- {
+ if(s->cbp_table[xy] & 8) {
ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
}
- s->current_picture.qscale_table[xy] = s->qscale;
+ s->current_picture.qscale_table[xy]= s->qscale;
- for(i = 0; i < 6; i++)
- {
+ for(i=0; i<6; i++){
int dc_pred_dir;
- int dc = mpeg4_decode_dc(s, i, &dc_pred_dir);
- if(dc < 0)
- {
+ int dc= mpeg4_decode_dc(s, i, &dc_pred_dir);
+ if(dc < 0){
av_log(s->avctx, AV_LOG_ERROR, "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- dir <<= 1;
- if(dc_pred_dir) dir |= 1;
+ dir<<=1;
+ if(dc_pred_dir) dir|=1;
}
- s->cbp_table[xy] &= 3; //remove dquant
- s->cbp_table[xy] |= cbpy << 2;
- s->current_picture.mb_type[xy] |= ac_pred * MB_TYPE_ACPRED;
- s->pred_dir_table[xy] = dir;
- }
- else if(IS_SKIP(s->current_picture.mb_type[xy]))
- {
- s->current_picture.qscale_table[xy] = s->qscale;
- s->cbp_table[xy] = 0;
- }
- else
- {
+ s->cbp_table[xy]&= 3; //remove dquant
+ s->cbp_table[xy]|= cbpy<<2;
+ s->current_picture.mb_type[xy] |= ac_pred*MB_TYPE_ACPRED;
+ s->pred_dir_table[xy]= dir;
+ }else if(IS_SKIP(s->current_picture.mb_type[xy])){
+ s->current_picture.qscale_table[xy]= s->qscale;
+ s->cbp_table[xy]= 0;
+ }else{
int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- if(s->cbp_table[xy] & 8)
- {
+ if(s->cbp_table[xy] & 8) {
ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
}
- s->current_picture.qscale_table[xy] = s->qscale;
+ s->current_picture.qscale_table[xy]= s->qscale;
- s->cbp_table[xy] &= 3; //remove dquant
- s->cbp_table[xy] |= (cbpy ^ 0xf) << 2;
+ s->cbp_table[xy]&= 3; //remove dquant
+ s->cbp_table[xy]|= (cbpy^0xf)<<2;
}
}
}
if(mb_num >= mb_count) return 0;
- s->mb_x = 0;
+ s->mb_x= 0;
}
return 0;
}
@@ -893,57 +784,47 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count)
int ff_mpeg4_decode_partitions(MpegEncContext *s)
{
int mb_num;
- const int part_a_error = s->pict_type == FF_I_TYPE ? (DC_ERROR | MV_ERROR) : MV_ERROR;
- const int part_a_end = s->pict_type == FF_I_TYPE ? (DC_END | MV_END) : MV_END;
+ const int part_a_error= s->pict_type==FF_I_TYPE ? (DC_ERROR|MV_ERROR) : MV_ERROR;
+ const int part_a_end = s->pict_type==FF_I_TYPE ? (DC_END |MV_END) : MV_END;
- mb_num = mpeg4_decode_partition_a(s);
- if(mb_num < 0)
- {
+ mb_num= mpeg4_decode_partition_a(s);
+ if(mb_num<0){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
return -1;
}
- if(s->resync_mb_x + s->resync_mb_y * s->mb_width + mb_num > s->mb_num)
- {
+ if(s->resync_mb_x + s->resync_mb_y*s->mb_width + mb_num > s->mb_num){
av_log(s->avctx, AV_LOG_ERROR, "slice below monitor ...\n");
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
return -1;
}
- s->mb_num_left = mb_num;
+ s->mb_num_left= mb_num;
- if(s->pict_type == FF_I_TYPE)
- {
+ if(s->pict_type==FF_I_TYPE){
while(show_bits(&s->gb, 9) == 1)
skip_bits(&s->gb, 9);
- if(get_bits_long(&s->gb, 19) != DC_MARKER)
- {
+ if(get_bits_long(&s->gb, 19)!=DC_MARKER){
av_log(s->avctx, AV_LOG_ERROR, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- }
- else
- {
+ }else{
while(show_bits(&s->gb, 10) == 1)
skip_bits(&s->gb, 10);
- if(get_bits(&s->gb, 17) != MOTION_MARKER)
- {
+ if(get_bits(&s->gb, 17)!=MOTION_MARKER){
av_log(s->avctx, AV_LOG_ERROR, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, part_a_end);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, part_a_end);
- if(mpeg4_decode_partition_b(s, mb_num) < 0)
- {
- if(s->pict_type == FF_P_TYPE)
+ if( mpeg4_decode_partition_b(s, mb_num) < 0){
+ if(s->pict_type==FF_P_TYPE)
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, DC_ERROR);
return -1;
- }
- else
- {
- if(s->pict_type == FF_P_TYPE)
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, DC_END);
+ }else{
+ if(s->pict_type==FF_P_TYPE)
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, DC_END);
}
return 0;
@@ -954,7 +835,7 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s)
* @return <0 if an error occurred
*/
static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
-int n, int coded, int intra, int rvlc)
+ int n, int coded, int intra, int rvlc)
{
int level, i, last, run;
int dc_pred_dir;
@@ -965,64 +846,48 @@ int n, int coded, int intra, int rvlc)
//Note intra & rvlc should be optimized away if this is inlined
- if(intra)
- {
- if(s->use_intra_dc_vlc)
- {
- /* DC coef */
- if(s->partitioned_frame)
- {
- level = s->dc_val[0][ s->block_index[n] ];
- if(n < 4) level = FASTDIV((level + (s->y_dc_scale >> 1)), s->y_dc_scale);
- else level = FASTDIV((level + (s->c_dc_scale >> 1)), s->c_dc_scale);
- dc_pred_dir = (s->pred_dir_table[s->mb_x + s->mb_y*s->mb_stride] << n) & 32;
- }
- else
- {
- level = mpeg4_decode_dc(s, n, &dc_pred_dir);
- if(level < 0)
- return -1;
- }
- block[0] = level;
- i = 0;
+ if(intra) {
+ if(s->use_intra_dc_vlc){
+ /* DC coef */
+ if(s->partitioned_frame){
+ level = s->dc_val[0][ s->block_index[n] ];
+ if(n<4) level= FASTDIV((level + (s->y_dc_scale>>1)), s->y_dc_scale);
+ else level= FASTDIV((level + (s->c_dc_scale>>1)), s->c_dc_scale);
+ dc_pred_dir= (s->pred_dir_table[s->mb_x + s->mb_y*s->mb_stride]<<n)&32;
+ }else{
+ level = mpeg4_decode_dc(s, n, &dc_pred_dir);
+ if (level < 0)
+ return -1;
}
- else
- {
+ block[0] = level;
+ i = 0;
+ }else{
i = -1;
ff_mpeg4_pred_dc(s, n, 0, &dc_pred_dir, 0);
- }
- if(!coded)
- goto not_coded;
-
- if(rvlc)
- {
- rl = &rvlc_rl_intra;
- rl_vlc = rvlc_rl_intra.rl_vlc[0];
- }
- else
- {
- rl = &ff_mpeg4_rl_intra;
- rl_vlc = ff_mpeg4_rl_intra.rl_vlc[0];
- }
- if(s->ac_pred)
- {
- if(dc_pred_dir == 0)
- scan_table = s->intra_v_scantable.permutated; /* left */
- else
- scan_table = s->intra_h_scantable.permutated; /* top */
- }
- else
- {
+ }
+ if (!coded)
+ goto not_coded;
+
+ if(rvlc){
+ rl = &rvlc_rl_intra;
+ rl_vlc = rvlc_rl_intra.rl_vlc[0];
+ }else{
+ rl = &ff_mpeg4_rl_intra;
+ rl_vlc = ff_mpeg4_rl_intra.rl_vlc[0];
+ }
+ if (s->ac_pred) {
+ if (dc_pred_dir == 0)
+ scan_table = s->intra_v_scantable.permutated; /* left */
+ else
+ scan_table = s->intra_h_scantable.permutated; /* top */
+ } else {
scan_table = s->intra_scantable.permutated;
- }
- qmul = 1;
- qadd = 0;
- }
- else
- {
+ }
+ qmul=1;
+ qadd=0;
+ } else {
i = -1;
- if(!coded)
- {
+ if (!coded) {
s->block_last_index[n] = i;
return 0;
}
@@ -1031,246 +896,189 @@ int n, int coded, int intra, int rvlc)
scan_table = s->intra_scantable.permutated;
- if(s->mpeg_quant)
- {
- qmul = 1;
- qadd = 0;
- if(rvlc)
- {
+ if(s->mpeg_quant){
+ qmul=1;
+ qadd=0;
+ if(rvlc){
rl_vlc = rvlc_rl_inter.rl_vlc[0];
- }
- else
- {
+ }else{
rl_vlc = ff_h263_rl_inter.rl_vlc[0];
}
- }
- else
- {
+ }else{
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
- if(rvlc)
- {
+ if(rvlc){
rl_vlc = rvlc_rl_inter.rl_vlc[s->qscale];
- }
- else
- {
+ }else{
rl_vlc = ff_h263_rl_inter.rl_vlc[s->qscale];
}
}
}
- {
- OPEN_READER(re, &s->gb);
- for(;;)
- {
- UPDATE_CACHE(re, &s->gb);
- GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
- if(level == 0)
- {
- /* escape */
- if(rvlc)
- {
- if(SHOW_UBITS(re, &s->gb, 1) == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in rvlc esc\n");
- return -1;
- };
- SKIP_CACHE(re, &s->gb, 1);
-
- last = SHOW_UBITS(re, &s->gb, 1);
- SKIP_CACHE(re, &s->gb, 1);
- run = SHOW_UBITS(re, &s->gb, 6);
- LAST_SKIP_CACHE(re, &s->gb, 6);
- SKIP_COUNTER(re, &s->gb, 1 + 1 + 6);
- UPDATE_CACHE(re, &s->gb);
+ {
+ OPEN_READER(re, &s->gb);
+ for(;;) {
+ UPDATE_CACHE(re, &s->gb);
+ GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
+ if (level==0) {
+ /* escape */
+ if(rvlc){
+ if(SHOW_UBITS(re, &s->gb, 1)==0){
+ av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in rvlc esc\n");
+ return -1;
+ }; SKIP_CACHE(re, &s->gb, 1);
- if(SHOW_UBITS(re, &s->gb, 1) == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in rvlc esc\n");
- return -1;
- };
- SKIP_CACHE(re, &s->gb, 1);
+ last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
+ run= SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6);
+ SKIP_COUNTER(re, &s->gb, 1+1+6);
+ UPDATE_CACHE(re, &s->gb);
- level = SHOW_UBITS(re, &s->gb, 11);
- SKIP_CACHE(re, &s->gb, 11);
+ if(SHOW_UBITS(re, &s->gb, 1)==0){
+ av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in rvlc esc\n");
+ return -1;
+ }; SKIP_CACHE(re, &s->gb, 1);
- if(SHOW_UBITS(re, &s->gb, 5) != 0x10)
- {
- av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n");
- return -1;
- };
- SKIP_CACHE(re, &s->gb, 5);
+ level= SHOW_UBITS(re, &s->gb, 11); SKIP_CACHE(re, &s->gb, 11);
- level = level * qmul + qadd;
- level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
- LAST_SKIP_CACHE(re, &s->gb, 1);
- SKIP_COUNTER(re, &s->gb, 1 + 11 + 5 + 1);
+ if(SHOW_UBITS(re, &s->gb, 5)!=0x10){
+ av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n");
+ return -1;
+ }; SKIP_CACHE(re, &s->gb, 5);
+
+ level= level * qmul + qadd;
+ level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_CACHE(re, &s->gb, 1);
+ SKIP_COUNTER(re, &s->gb, 1+11+5+1);
+
+ i+= run + 1;
+ if(last) i+=192;
+ }else{
+ int cache;
+ cache= GET_CACHE(re, &s->gb);
+
+ if(IS_3IV1)
+ cache ^= 0xC0000000;
+
+ if (cache&0x80000000) {
+ if (cache&0x40000000) {
+ /* third escape */
+ SKIP_CACHE(re, &s->gb, 2);
+ last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
+ run= SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6);
+ SKIP_COUNTER(re, &s->gb, 2+1+6);
+ UPDATE_CACHE(re, &s->gb);
- i += run + 1;
- if(last) i += 192;
- }
- else
- {
- int cache;
- cache = GET_CACHE(re, &s->gb);
-
- if(IS_3IV1)
- cache ^= 0xC0000000;
-
- if(cache & 0x80000000)
- {
- if(cache & 0x40000000)
- {
- /* third escape */
- SKIP_CACHE(re, &s->gb, 2);
- last = SHOW_UBITS(re, &s->gb, 1);
- SKIP_CACHE(re, &s->gb, 1);
- run = SHOW_UBITS(re, &s->gb, 6);
- LAST_SKIP_CACHE(re, &s->gb, 6);
- SKIP_COUNTER(re, &s->gb, 2 + 1 + 6);
- UPDATE_CACHE(re, &s->gb);
-
- if(IS_3IV1)
- {
- level = SHOW_SBITS(re, &s->gb, 12);
- LAST_SKIP_BITS(re, &s->gb, 12);
- }
- else
- {
- if(SHOW_UBITS(re, &s->gb, 1) == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in 3. esc\n");
- return -1;
- };
- SKIP_CACHE(re, &s->gb, 1);
+ if(IS_3IV1){
+ level= SHOW_SBITS(re, &s->gb, 12); LAST_SKIP_BITS(re, &s->gb, 12);
+ }else{
+ if(SHOW_UBITS(re, &s->gb, 1)==0){
+ av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in 3. esc\n");
+ return -1;
+ }; SKIP_CACHE(re, &s->gb, 1);
- level = SHOW_SBITS(re, &s->gb, 12);
- SKIP_CACHE(re, &s->gb, 12);
+ level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12);
- if(SHOW_UBITS(re, &s->gb, 1) == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in 3. esc\n");
- return -1;
- };
- LAST_SKIP_CACHE(re, &s->gb, 1);
+ if(SHOW_UBITS(re, &s->gb, 1)==0){
+ av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in 3. esc\n");
+ return -1;
+ }; LAST_SKIP_CACHE(re, &s->gb, 1);
- SKIP_COUNTER(re, &s->gb, 1 + 12 + 1);
- }
+ SKIP_COUNTER(re, &s->gb, 1+12+1);
+ }
#if 0
- if(s->error_recognition >= FF_ER_COMPLIANT)
- {
- const int abs_level = FFABS(level);
- if(abs_level <= MAX_LEVEL && run <= MAX_RUN)
- {
- const int run1 = run - rl->max_run[last][abs_level] - 1;
- if(abs_level <= rl->max_level[last][run])
- {
- av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
- return -1;
- }
- if(s->error_recognition > FF_ER_COMPLIANT)
- {
- if(abs_level <= rl->max_level[last][run] * 2)
- {
- av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
- return -1;
- }
- if(run1 >= 0 && abs_level <= rl->max_level[last][run1])
- {
- av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
- return -1;
- }
- }
- }
+ if(s->error_recognition >= FF_ER_COMPLIANT){
+ const int abs_level= FFABS(level);
+ if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
+ const int run1= run - rl->max_run[last][abs_level] - 1;
+ if(abs_level <= rl->max_level[last][run]){
+ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
+ return -1;
}
-#endif
- if(level > 0) level = level * qmul + qadd;
- else level = level * qmul - qadd;
-
- if((unsigned)(level + 2048) > 4095)
- {
- if(s->error_recognition > FF_ER_COMPLIANT)
- {
- if(level > 2560 || level < -2560)
- {
- av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale);
- return -1;
- }
+ if(s->error_recognition > FF_ER_COMPLIANT){
+ if(abs_level <= rl->max_level[last][run]*2){
+ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
+ return -1;
+ }
+ if(run1 >= 0 && abs_level <= rl->max_level[last][run1]){
+ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
+ return -1;
}
- level = level < 0 ? -2048 : 2047;
}
+ }
+ }
+#endif
+ if (level>0) level= level * qmul + qadd;
+ else level= level * qmul - qadd;
- i += run + 1;
- if(last) i += 192;
+ if((unsigned)(level + 2048) > 4095){
+ if(s->error_recognition > FF_ER_COMPLIANT){
+ if(level > 2560 || level<-2560){
+ av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale);
+ return -1;
+ }
}
- else
- {
- /* second escape */
+ level= level<0 ? -2048 : 2047;
+ }
+
+ i+= run + 1;
+ if(last) i+=192;
+ } else {
+ /* second escape */
#if MIN_CACHE_BITS < 20
- LAST_SKIP_BITS(re, &s->gb, 2);
- UPDATE_CACHE(re, &s->gb);
+ LAST_SKIP_BITS(re, &s->gb, 2);
+ UPDATE_CACHE(re, &s->gb);
#else
- SKIP_BITS(re, &s->gb, 2);
+ SKIP_BITS(re, &s->gb, 2);
#endif
- GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
- i += run + rl->max_run[run>>7][level/qmul] + 1; //FIXME opt indexing
- level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
- LAST_SKIP_BITS(re, &s->gb, 1);
- }
- }
- else
- {
- /* first escape */
+ GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
+ i+= run + rl->max_run[run>>7][level/qmul] +1; //FIXME opt indexing
+ level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
+ LAST_SKIP_BITS(re, &s->gb, 1);
+ }
+ } else {
+ /* first escape */
#if MIN_CACHE_BITS < 19
- LAST_SKIP_BITS(re, &s->gb, 1);
- UPDATE_CACHE(re, &s->gb);
+ LAST_SKIP_BITS(re, &s->gb, 1);
+ UPDATE_CACHE(re, &s->gb);
#else
- SKIP_BITS(re, &s->gb, 1);
+ SKIP_BITS(re, &s->gb, 1);
#endif
- GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
- i += run;
- level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
- level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
- LAST_SKIP_BITS(re, &s->gb, 1);
- }
- }
- }
- else
- {
- i += run;
+ GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
+ i+= run;
+ level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
}
- if(i > 62)
- {
- i -= 192;
- if(i&(~63))
- {
- av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
- return -1;
- }
-
- block[scan_table[i]] = level;
- break;
+ }
+ } else {
+ i+= run;
+ level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
+ LAST_SKIP_BITS(re, &s->gb, 1);
+ }
+ if (i > 62){
+ i-= 192;
+ if(i&(~63)){
+ av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
+ return -1;
}
block[scan_table[i]] = level;
+ break;
}
- CLOSE_READER(re, &s->gb);
+
+ block[scan_table[i]] = level;
}
-not_coded:
- if(intra)
- {
- if(!s->use_intra_dc_vlc)
- {
+ CLOSE_READER(re, &s->gb);
+ }
+ not_coded:
+ if (intra) {
+ if(!s->use_intra_dc_vlc){
block[0] = ff_mpeg4_pred_dc(s, n, block[0], &dc_pred_dir, 0);
- i -= i >> 31; //if(i == -1) i=0;
+ i -= i>>31; //if(i == -1) i=0;
}
mpeg4_pred_ac(s, block, n, dc_pred_dir);
- if(s->ac_pred)
- {
+ if (s->ac_pred) {
i = 63; /* XXX: not optimal */
}
}
@@ -1285,101 +1093,78 @@ not_coded:
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64])
{
int cbp, mb_type;
- const int xy = s->mb_x + s->mb_y * s->mb_stride;
+ const int xy= s->mb_x + s->mb_y*s->mb_stride;
- mb_type = s->current_picture.mb_type[xy];
+ mb_type= s->current_picture.mb_type[xy];
cbp = s->cbp_table[xy];
- s->use_intra_dc_vlc = s->qscale < s->intra_dc_threshold;
+ s->use_intra_dc_vlc= s->qscale < s->intra_dc_threshold;
- if(s->current_picture.qscale_table[xy] != s->qscale)
- {
- ff_set_qscale(s, s->current_picture.qscale_table[xy]);
+ if(s->current_picture.qscale_table[xy] != s->qscale){
+ ff_set_qscale(s, s->current_picture.qscale_table[xy] );
}
- if(s->pict_type == FF_P_TYPE || s->pict_type == FF_S_TYPE)
- {
+ if (s->pict_type == FF_P_TYPE || s->pict_type==FF_S_TYPE) {
int i;
- for(i = 0; i < 4; i++)
- {
+ for(i=0; i<4; i++){
s->mv[0][i][0] = s->current_picture.motion_val[0][ s->block_index[i] ][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][ s->block_index[i] ][1];
}
s->mb_intra = IS_INTRA(mb_type);
- if(IS_SKIP(mb_type))
- {
+ if (IS_SKIP(mb_type)) {
/* skip mb */
- for(i = 0; i < 6; i++)
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
- if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE)
- {
- s->mcsel = 1;
+ if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
+ s->mcsel=1;
s->mb_skipped = 0;
- }
- else
- {
- s->mcsel = 0;
+ }else{
+ s->mcsel=0;
s->mb_skipped = 1;
}
- }
- else if(s->mb_intra)
- {
+ }else if(s->mb_intra){
s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]);
- }
- else if(!s->mb_intra)
- {
+ }else if(!s->mb_intra){
// s->mcsel= 0; //FIXME do we need to init that
s->mv_dir = MV_DIR_FORWARD;
- if(IS_8X8(mb_type))
- {
+ if (IS_8X8(mb_type)) {
s->mv_type = MV_TYPE_8X8;
- }
- else
- {
+ } else {
s->mv_type = MV_TYPE_16X16;
}
}
- }
- else /* I-Frame */
- {
+ } else { /* I-Frame */
s->mb_intra = 1;
s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]);
}
- if(!IS_SKIP(mb_type))
- {
+ if (!IS_SKIP(mb_type)) {
int i;
s->dsp.clear_blocks(s->block[0]);
/* decode each block */
- for(i = 0; i < 6; i++)
- {
- if(mpeg4_decode_block(s, block[i], i, cbp & 32, s->mb_intra, s->rvlc) < 0)
- {
+ for (i = 0; i < 6; i++) {
+ if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){
av_log(s->avctx, AV_LOG_ERROR, "texture corrupted at %d %d %d\n", s->mb_x, s->mb_y, s->mb_intra);
return -1;
}
- cbp += cbp;
+ cbp+=cbp;
}
}
/* per-MB end of slice check */
- if(--s->mb_num_left <= 0)
- {
+ if(--s->mb_num_left <= 0){
if(mpeg4_is_resync(s))
return SLICE_END;
else
return SLICE_NOEND;
- }
- else
- {
- if(mpeg4_is_resync(s))
- {
- const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
+ }else{
+ if(mpeg4_is_resync(s)){
+ const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
if(s->cbp_table[xy+delta])
return SLICE_END;
}
@@ -1388,40 +1173,34 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64])
}
static int mpeg4_decode_mb(MpegEncContext *s,
-DCTELEM block[6][64])
+ DCTELEM block[6][64])
{
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
int16_t *mot_val;
static int8_t quant_tab[4] = { -1, -2, 1, 2 };
- const int xy = s->mb_x + s->mb_y * s->mb_stride;
+ const int xy= s->mb_x + s->mb_y * s->mb_stride;
assert(s->h263_pred);
- if(s->pict_type == FF_P_TYPE || s->pict_type == FF_S_TYPE)
- {
- do
- {
- if(get_bits1(&s->gb))
- {
+ if (s->pict_type == FF_P_TYPE || s->pict_type==FF_S_TYPE) {
+ do{
+ if (get_bits1(&s->gb)) {
/* skip mb */
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
- if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0;
- s->mcsel = 1;
- s->mv[0][0][0] = get_amv(s, 0);
- s->mv[0][0][1] = get_amv(s, 1);
+ if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0;
+ s->mcsel=1;
+ s->mv[0][0][0]= get_amv(s, 0);
+ s->mv[0][0][1]= get_amv(s, 1);
s->mb_skipped = 0;
- }
- else
- {
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
- s->mcsel = 0;
+ }else{
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ s->mcsel=0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
s->mb_skipped = 1;
@@ -1429,102 +1208,89 @@ DCTELEM block[6][64])
goto end;
}
cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
- if(cbpc < 0)
- {
+ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- }
- while(cbpc == 20);
+ }while(cbpc == 20);
s->dsp.clear_blocks(s->block[0]);
dquant = cbpc & 8;
s->mb_intra = ((cbpc & 4) != 0);
- if(s->mb_intra) goto intra;
+ if (s->mb_intra) goto intra;
- if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE && (cbpc & 16) == 0)
- s->mcsel = get_bits1(&s->gb);
- else s->mcsel = 0;
+ if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE && (cbpc & 16) == 0)
+ s->mcsel= get_bits1(&s->gb);
+ else s->mcsel= 0;
cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1) ^ 0x0F;
cbp = (cbpc & 3) | (cbpy << 2);
- if(dquant)
- {
+ if (dquant) {
ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
}
- if((!s->progressive_sequence) && (cbp || (s->workaround_bugs & FF_BUG_XVID_ILACE)))
- s->interlaced_dct = get_bits1(&s->gb);
+ if((!s->progressive_sequence) && (cbp || (s->workaround_bugs&FF_BUG_XVID_ILACE)))
+ s->interlaced_dct= get_bits1(&s->gb);
s->mv_dir = MV_DIR_FORWARD;
- if((cbpc & 16) == 0)
- {
- if(s->mcsel)
- {
- s->current_picture.mb_type[xy] = MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0;
+ if ((cbpc & 16) == 0) {
+ if(s->mcsel){
+ s->current_picture.mb_type[xy]= MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0;
/* 16x16 global motion prediction */
s->mv_type = MV_TYPE_16X16;
- mx = get_amv(s, 0);
- my = get_amv(s, 1);
+ mx= get_amv(s, 0);
+ my= get_amv(s, 1);
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
- }
- else if((!s->progressive_sequence) && get_bits1(&s->gb))
- {
- s->current_picture.mb_type[xy] = MB_TYPE_16x8 | MB_TYPE_L0 | MB_TYPE_INTERLACED;
+ }else if((!s->progressive_sequence) && get_bits1(&s->gb)){
+ s->current_picture.mb_type[xy]= MB_TYPE_16x8 | MB_TYPE_L0 | MB_TYPE_INTERLACED;
/* 16x8 field motion prediction */
- s->mv_type = MV_TYPE_FIELD;
+ s->mv_type= MV_TYPE_FIELD;
- s->field_select[0][0] = get_bits1(&s->gb);
- s->field_select[0][1] = get_bits1(&s->gb);
+ s->field_select[0][0]= get_bits1(&s->gb);
+ s->field_select[0][1]= get_bits1(&s->gb);
h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
- for(i = 0; i < 2; i++)
- {
+ for(i=0; i<2; i++){
mx = h263_decode_motion(s, pred_x, s->f_code);
- if(mx >= 0xffff)
+ if (mx >= 0xffff)
return -1;
- my = h263_decode_motion(s, pred_y / 2, s->f_code);
- if(my >= 0xffff)
+ my = h263_decode_motion(s, pred_y/2, s->f_code);
+ if (my >= 0xffff)
return -1;
s->mv[0][i][0] = mx;
s->mv[0][i][1] = my;
}
- }
- else
- {
- s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
+ }else{
+ s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
/* 16x16 motion prediction */
s->mv_type = MV_TYPE_16X16;
h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
mx = h263_decode_motion(s, pred_x, s->f_code);
- if(mx >= 0xffff)
+ if (mx >= 0xffff)
return -1;
my = h263_decode_motion(s, pred_y, s->f_code);
- if(my >= 0xffff)
+ if (my >= 0xffff)
return -1;
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
}
- }
- else
- {
- s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0;
+ } else {
+ s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
s->mv_type = MV_TYPE_8X8;
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
mx = h263_decode_motion(s, pred_x, s->f_code);
- if(mx >= 0xffff)
+ if (mx >= 0xffff)
return -1;
my = h263_decode_motion(s, pred_y, s->f_code);
- if(my >= 0xffff)
+ if (my >= 0xffff)
return -1;
s->mv[0][i][0] = mx;
s->mv[0][i][1] = my;
@@ -1532,34 +1298,29 @@ DCTELEM block[6][64])
mot_val[1] = my;
}
}
- }
- else if(s->pict_type == FF_B_TYPE)
- {
+ } else if(s->pict_type==FF_B_TYPE) {
int modb1; // first bit of modb
int modb2; // second bit of modb
int mb_type;
s->mb_intra = 0; //B-frames never contain intra blocks
- s->mcsel = 0; // ... true gmc blocks
-
- if(s->mb_x == 0)
- {
- for(i = 0; i < 2; i++)
- {
- s->last_mv[i][0][0] =
- s->last_mv[i][0][1] =
- s->last_mv[i][1][0] =
- s->last_mv[i][1][1] = 0;
+ s->mcsel=0; // ... true gmc blocks
+
+ if(s->mb_x==0){
+ for(i=0; i<2; i++){
+ s->last_mv[i][0][0]=
+ s->last_mv[i][0][1]=
+ s->last_mv[i][1][0]=
+ s->last_mv[i][1][1]= 0;
}
}
/* if we skipped it in the future P Frame than skip it now too */
- s->mb_skipped = s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]; // Note, skiptab=0 if last was GMC
+ s->mb_skipped= s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]; // Note, skiptab=0 if last was GMC
- if(s->mb_skipped)
- {
- /* skip mb */
- for(i = 0; i < 6; i++)
+ if(s->mb_skipped){
+ /* skip mb */
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
@@ -1568,127 +1329,105 @@ DCTELEM block[6][64])
s->mv[0][0][1] = 0;
s->mv[1][0][0] = 0;
s->mv[1][0][1] = 0;
- s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
goto end;
}
- modb1 = get_bits1(&s->gb);
- if(modb1)
- {
- mb_type = MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; //like MB_TYPE_B_DIRECT but no vectors coded
- cbp = 0;
- }
- else
- {
- modb2 = get_bits1(&s->gb);
- mb_type = get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1);
- if(mb_type < 0)
- {
+ modb1= get_bits1(&s->gb);
+ if(modb1){
+ mb_type= MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; //like MB_TYPE_B_DIRECT but no vectors coded
+ cbp=0;
+ }else{
+ modb2= get_bits1(&s->gb);
+ mb_type= get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1);
+ if(mb_type<0){
av_log(s->avctx, AV_LOG_ERROR, "illegal MB_type\n");
return -1;
}
- mb_type = mb_type_b_map[ mb_type ];
- if(modb2) cbp = 0;
- else
- {
+ mb_type= mb_type_b_map[ mb_type ];
+ if(modb2) cbp= 0;
+ else{
s->dsp.clear_blocks(s->block[0]);
- cbp = get_bits(&s->gb, 6);
+ cbp= get_bits(&s->gb, 6);
}
- if((!IS_DIRECT(mb_type)) && cbp)
- {
- if(get_bits1(&s->gb))
- {
- ff_set_qscale(s, s->qscale + get_bits1(&s->gb) * 4 - 2);
+ if ((!IS_DIRECT(mb_type)) && cbp) {
+ if(get_bits1(&s->gb)){
+ ff_set_qscale(s, s->qscale + get_bits1(&s->gb)*4 - 2);
}
}
- if(!s->progressive_sequence)
- {
+ if(!s->progressive_sequence){
if(cbp)
- s->interlaced_dct = get_bits1(&s->gb);
+ s->interlaced_dct= get_bits1(&s->gb);
- if(!IS_DIRECT(mb_type) && get_bits1(&s->gb))
- {
+ if(!IS_DIRECT(mb_type) && get_bits1(&s->gb)){
mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
mb_type &= ~MB_TYPE_16x16;
- if(USES_LIST(mb_type, 0))
- {
- s->field_select[0][0] = get_bits1(&s->gb);
- s->field_select[0][1] = get_bits1(&s->gb);
+ if(USES_LIST(mb_type, 0)){
+ s->field_select[0][0]= get_bits1(&s->gb);
+ s->field_select[0][1]= get_bits1(&s->gb);
}
- if(USES_LIST(mb_type, 1))
- {
- s->field_select[1][0] = get_bits1(&s->gb);
- s->field_select[1][1] = get_bits1(&s->gb);
+ if(USES_LIST(mb_type, 1)){
+ s->field_select[1][0]= get_bits1(&s->gb);
+ s->field_select[1][1]= get_bits1(&s->gb);
}
}
}
s->mv_dir = 0;
- if((mb_type & (MB_TYPE_DIRECT2 | MB_TYPE_INTERLACED)) == 0)
- {
- s->mv_type = MV_TYPE_16X16;
+ if((mb_type & (MB_TYPE_DIRECT2|MB_TYPE_INTERLACED)) == 0){
+ s->mv_type= MV_TYPE_16X16;
- if(USES_LIST(mb_type, 0))
- {
+ if(USES_LIST(mb_type, 0)){
s->mv_dir = MV_DIR_FORWARD;
mx = h263_decode_motion(s, s->last_mv[0][0][0], s->f_code);
my = h263_decode_motion(s, s->last_mv[0][0][1], s->f_code);
- s->last_mv[0][1][0] = s->last_mv[0][0][0] = s->mv[0][0][0] = mx;
- s->last_mv[0][1][1] = s->last_mv[0][0][1] = s->mv[0][0][1] = my;
+ s->last_mv[0][1][0]= s->last_mv[0][0][0]= s->mv[0][0][0] = mx;
+ s->last_mv[0][1][1]= s->last_mv[0][0][1]= s->mv[0][0][1] = my;
}
- if(USES_LIST(mb_type, 1))
- {
+ if(USES_LIST(mb_type, 1)){
s->mv_dir |= MV_DIR_BACKWARD;
mx = h263_decode_motion(s, s->last_mv[1][0][0], s->b_code);
my = h263_decode_motion(s, s->last_mv[1][0][1], s->b_code);
- s->last_mv[1][1][0] = s->last_mv[1][0][0] = s->mv[1][0][0] = mx;
- s->last_mv[1][1][1] = s->last_mv[1][0][1] = s->mv[1][0][1] = my;
+ s->last_mv[1][1][0]= s->last_mv[1][0][0]= s->mv[1][0][0] = mx;
+ s->last_mv[1][1][1]= s->last_mv[1][0][1]= s->mv[1][0][1] = my;
}
- }
- else if(!IS_DIRECT(mb_type))
- {
- s->mv_type = MV_TYPE_FIELD;
+ }else if(!IS_DIRECT(mb_type)){
+ s->mv_type= MV_TYPE_FIELD;
- if(USES_LIST(mb_type, 0))
- {
+ if(USES_LIST(mb_type, 0)){
s->mv_dir = MV_DIR_FORWARD;
- for(i = 0; i < 2; i++)
- {
+ for(i=0; i<2; i++){
mx = h263_decode_motion(s, s->last_mv[0][i][0] , s->f_code);
- my = h263_decode_motion(s, s->last_mv[0][i][1] / 2, s->f_code);
- s->last_mv[0][i][0] = s->mv[0][i][0] = mx;
- s->last_mv[0][i][1] = (s->mv[0][i][1] = my) * 2;
+ my = h263_decode_motion(s, s->last_mv[0][i][1]/2, s->f_code);
+ s->last_mv[0][i][0]= s->mv[0][i][0] = mx;
+ s->last_mv[0][i][1]= (s->mv[0][i][1] = my)*2;
}
}
- if(USES_LIST(mb_type, 1))
- {
+ if(USES_LIST(mb_type, 1)){
s->mv_dir |= MV_DIR_BACKWARD;
- for(i = 0; i < 2; i++)
- {
+ for(i=0; i<2; i++){
mx = h263_decode_motion(s, s->last_mv[1][i][0] , s->b_code);
- my = h263_decode_motion(s, s->last_mv[1][i][1] / 2, s->b_code);
- s->last_mv[1][i][0] = s->mv[1][i][0] = mx;
- s->last_mv[1][i][1] = (s->mv[1][i][1] = my) * 2;
+ my = h263_decode_motion(s, s->last_mv[1][i][1]/2, s->b_code);
+ s->last_mv[1][i][0]= s->mv[1][i][0] = mx;
+ s->last_mv[1][i][1]= (s->mv[1][i][1] = my)*2;
}
}
}
}
- if(IS_DIRECT(mb_type))
- {
+ if(IS_DIRECT(mb_type)){
if(IS_SKIP(mb_type))
- mx = my = 0;
- else
- {
+ mx=my=0;
+ else{
mx = h263_decode_motion(s, 0, 1);
my = h263_decode_motion(s, 0, 1);
}
@@ -1696,75 +1435,64 @@ DCTELEM block[6][64])
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
mb_type |= ff_mpeg4_set_direct_mv(s, mx, my);
}
- s->current_picture.mb_type[xy] = mb_type;
- }
- else /* I-Frame */
- {
- do
- {
+ s->current_picture.mb_type[xy]= mb_type;
+ } else { /* I-Frame */
+ do{
cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
- if(cbpc < 0)
- {
+ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- }
- while(cbpc == 8);
+ }while(cbpc == 8);
dquant = cbpc & 4;
s->mb_intra = 1;
intra:
s->ac_pred = get_bits1(&s->gb);
if(s->ac_pred)
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED;
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA | MB_TYPE_ACPRED;
else
- s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
+ s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
cbp = (cbpc & 3) | (cbpy << 2);
- s->use_intra_dc_vlc = s->qscale < s->intra_dc_threshold;
+ s->use_intra_dc_vlc= s->qscale < s->intra_dc_threshold;
- if(dquant)
- {
+ if (dquant) {
ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
}
if(!s->progressive_sequence)
- s->interlaced_dct = get_bits1(&s->gb);
+ s->interlaced_dct= get_bits1(&s->gb);
s->dsp.clear_blocks(s->block[0]);
/* decode each block */
- for(i = 0; i < 6; i++)
- {
- if(mpeg4_decode_block(s, block[i], i, cbp & 32, 1, 0) < 0)
+ for (i = 0; i < 6; i++) {
+ if (mpeg4_decode_block(s, block[i], i, cbp&32, 1, 0) < 0)
return -1;
- cbp += cbp;
+ cbp+=cbp;
}
goto end;
}
/* decode each block */
- for(i = 0; i < 6; i++)
- {
- if(mpeg4_decode_block(s, block[i], i, cbp & 32, 0, 0) < 0)
+ for (i = 0; i < 6; i++) {
+ if (mpeg4_decode_block(s, block[i], i, cbp&32, 0, 0) < 0)
return -1;
- cbp += cbp;
+ cbp+=cbp;
}
end:
- /* per-MB end of slice check */
- if(s->codec_id == CODEC_ID_MPEG4)
- {
- if(mpeg4_is_resync(s))
- {
- const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
- if(s->pict_type == FF_B_TYPE && s->next_picture.mbskip_table[xy + delta])
+ /* per-MB end of slice check */
+ if(s->codec_id==CODEC_ID_MPEG4){
+ if(mpeg4_is_resync(s)){
+ const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
+ if(s->pict_type==FF_B_TYPE && s->next_picture.mbskip_table[xy + delta])
return SLICE_OK;
return SLICE_END;
}
@@ -1774,16 +1502,15 @@ end:
}
-static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb)
-{
+static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb){
int hours, minutes, seconds;
- hours = get_bits(gb, 5);
- minutes = get_bits(gb, 6);
+ hours= get_bits(gb, 5);
+ minutes= get_bits(gb, 6);
skip_bits1(gb);
- seconds = get_bits(gb, 6);
+ seconds= get_bits(gb, 6);
- s->time_base = seconds + 60 * (minutes + 60 * hours);
+ s->time_base= seconds + 60*(minutes + 60*hours);
skip_bits1(gb);
skip_bits1(gb);
@@ -1791,43 +1518,33 @@ static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb)
return 0;
}
-static int decode_vol_header(MpegEncContext *s, GetBitContext *gb)
-{
+static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
int width, height, vo_ver_id;
/* vol header */
skip_bits(gb, 1); /* random access */
- s->vo_type = get_bits(gb, 8);
- if(get_bits1(gb) != 0) /* is_ol_id */
- {
+ s->vo_type= get_bits(gb, 8);
+ if (get_bits1(gb) != 0) { /* is_ol_id */
vo_ver_id = get_bits(gb, 4); /* vo_ver_id */
skip_bits(gb, 3); /* vo_priority */
- }
- else
- {
+ } else {
vo_ver_id = 1;
}
- s->aspect_ratio_info = get_bits(gb, 4);
- if(s->aspect_ratio_info == FF_ASPECT_EXTENDED)
- {
- s->avctx->sample_aspect_ratio.num = get_bits(gb, 8); // par_width
- s->avctx->sample_aspect_ratio.den = get_bits(gb, 8); // par_height
- }
- else
- {
- s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[s->aspect_ratio_info];
+ s->aspect_ratio_info= get_bits(gb, 4);
+ if(s->aspect_ratio_info == FF_ASPECT_EXTENDED){
+ s->avctx->sample_aspect_ratio.num= get_bits(gb, 8); // par_width
+ s->avctx->sample_aspect_ratio.den= get_bits(gb, 8); // par_height
+ }else{
+ s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info];
}
- if((s->vol_control_parameters = get_bits1(gb))) /* vol control parameter */
- {
- int chroma_format = get_bits(gb, 2);
- if(chroma_format != CHROMA_420)
- {
+ if ((s->vol_control_parameters=get_bits1(gb))) { /* vol control parameter */
+ int chroma_format= get_bits(gb, 2);
+ if(chroma_format!=CHROMA_420){
av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n");
}
- s->low_delay = get_bits1(gb);
- if(get_bits1(gb)) /* vbv parameters */
- {
+ s->low_delay= get_bits1(gb);
+ if(get_bits1(gb)){ /* vbv parameters */
get_bits(gb, 15); /* first_half_bitrate */
skip_bits1(gb); /* marker */
get_bits(gb, 15); /* latter_half_bitrate */
@@ -1840,18 +1557,15 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb)
get_bits(gb, 15); /* latter_half_vbv_occupancy */
skip_bits1(gb); /* marker */
}
- }
- else
- {
+ }else{
// set low delay flag only once the smartest? low delay detection won't be overriden
- if(s->picture_number == 0)
- s->low_delay = 0;
+ if(s->picture_number==0)
+ s->low_delay=0;
}
s->shape = get_bits(gb, 2); /* vol shape */
if(s->shape != RECT_SHAPE) av_log(s->avctx, AV_LOG_ERROR, "only rectangular vol supported\n");
- if(s->shape == GRAY_SHAPE && vo_ver_id != 1)
- {
+ if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
av_log(s->avctx, AV_LOG_ERROR, "Gray shape not supported\n");
skip_bits(gb, 4); //video_object_layer_shape_extension
}
@@ -1859,167 +1573,144 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb)
check_marker(gb, "before time_increment_resolution");
s->avctx->time_base.den = get_bits(gb, 16);
- if(!s->avctx->time_base.den)
- {
+ if(!s->avctx->time_base.den){
av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n");
return -1;
}
s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;
- if(s->time_increment_bits < 1)
+ if (s->time_increment_bits < 1)
s->time_increment_bits = 1;
check_marker(gb, "before fixed_vop_rate");
- if(get_bits1(gb) != 0) /* fixed_vop_rate */
- {
+ if (get_bits1(gb) != 0) { /* fixed_vop_rate */
s->avctx->time_base.num = get_bits(gb, s->time_increment_bits);
- }
- else
+ }else
s->avctx->time_base.num = 1;
- s->t_frame = 0;
+ s->t_frame=0;
- if(s->shape != BIN_ONLY_SHAPE)
- {
- if(s->shape == RECT_SHAPE)
- {
+ if (s->shape != BIN_ONLY_SHAPE) {
+ if (s->shape == RECT_SHAPE) {
skip_bits1(gb); /* marker */
width = get_bits(gb, 13);
skip_bits1(gb); /* marker */
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(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */
s->width = width;
s->height = height;
}
}
- s->progressive_sequence =
- s->progressive_frame = get_bits1(gb) ^ 1;
- s->interlaced_dct = 0;
+ s->progressive_sequence=
+ s->progressive_frame= get_bits1(gb)^1;
+ s->interlaced_dct=0;
if(!get_bits1(gb) && (s->avctx->debug & FF_DEBUG_PICT_INFO))
av_log(s->avctx, AV_LOG_INFO, "MPEG4 OBMC not supported (very likely buggy encoder)\n"); /* OBMC Disable */
- if(vo_ver_id == 1)
- {
+ if (vo_ver_id == 1) {
s->vol_sprite_usage = get_bits1(gb); /* vol_sprite_usage */
- }
- else
- {
+ } else {
s->vol_sprite_usage = get_bits(gb, 2); /* vol_sprite_usage */
}
- if(s->vol_sprite_usage == STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "Static Sprites not supported\n");
- if(s->vol_sprite_usage == STATIC_SPRITE || s->vol_sprite_usage == GMC_SPRITE)
- {
- if(s->vol_sprite_usage == STATIC_SPRITE)
- {
+ if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "Static Sprites not supported\n");
+ if(s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE){
+ if(s->vol_sprite_usage==STATIC_SPRITE){
s->sprite_width = get_bits(gb, 13);
skip_bits1(gb); /* marker */
- s->sprite_height = get_bits(gb, 13);
+ s->sprite_height= get_bits(gb, 13);
skip_bits1(gb); /* marker */
s->sprite_left = get_bits(gb, 13);
skip_bits1(gb); /* marker */
s->sprite_top = get_bits(gb, 13);
skip_bits1(gb); /* marker */
}
- s->num_sprite_warping_points = get_bits(gb, 6);
- if(s->num_sprite_warping_points > 3)
- {
+ s->num_sprite_warping_points= get_bits(gb, 6);
+ if(s->num_sprite_warping_points > 3){
av_log(s->avctx, AV_LOG_ERROR, "%d sprite_warping_points\n", s->num_sprite_warping_points);
- s->num_sprite_warping_points = 0;
+ s->num_sprite_warping_points= 0;
return -1;
}
s->sprite_warping_accuracy = get_bits(gb, 2);
- s->sprite_brightness_change = get_bits1(gb);
- if(s->vol_sprite_usage == STATIC_SPRITE)
- s->low_latency_sprite = get_bits1(gb);
+ s->sprite_brightness_change= get_bits1(gb);
+ if(s->vol_sprite_usage==STATIC_SPRITE)
+ s->low_latency_sprite= get_bits1(gb);
}
// FIXME sadct disable bit if verid!=1 && shape not rect
- if(get_bits1(gb) == 1) /* not_8_bit */
- {
+ if (get_bits1(gb) == 1) { /* not_8_bit */
s->quant_precision = get_bits(gb, 4); /* quant_precision */
- if(get_bits(gb, 4) != 8) av_log(s->avctx, AV_LOG_ERROR, "N-bit not supported\n"); /* bits_per_pixel */
- if(s->quant_precision != 5) av_log(s->avctx, AV_LOG_ERROR, "quant precision %d\n", s->quant_precision);
- }
- else
- {
+ if(get_bits(gb, 4)!=8) av_log(s->avctx, AV_LOG_ERROR, "N-bit not supported\n"); /* bits_per_pixel */
+ if(s->quant_precision!=5) av_log(s->avctx, AV_LOG_ERROR, "quant precision %d\n", s->quant_precision);
+ } else {
s->quant_precision = 5;
}
// FIXME a bunch of grayscale shape things
- if((s->mpeg_quant = get_bits1(gb))) /* vol_quant_type */
- {
+ if((s->mpeg_quant=get_bits1(gb))){ /* vol_quant_type */
int i, v;
/* load default matrixes */
- for(i = 0; i < 64; i++)
- {
- int j = s->dsp.idct_permutation[i];
- v = ff_mpeg4_default_intra_matrix[i];
- s->avctx->intra_matrix[i] = v;
- s->intra_matrix[j] = v;
- s->chroma_intra_matrix[j] = v;
-
- v = ff_mpeg4_default_non_intra_matrix[i];
- s->avctx->inter_matrix[i] = v;
- s->inter_matrix[j] = v;
- s->chroma_inter_matrix[j] = v;
+ for(i=0; i<64; i++){
+ int j= s->dsp.idct_permutation[i];
+ v= ff_mpeg4_default_intra_matrix[i];
+ s->avctx->intra_matrix[i]=v;
+ s->intra_matrix[j]= v;
+ s->chroma_intra_matrix[j]= v;
+
+ v= ff_mpeg4_default_non_intra_matrix[i];
+ s->avctx->inter_matrix[i]=v;
+ s->inter_matrix[j]= v;
+ s->chroma_inter_matrix[j]= v;
}
/* load custom intra matrix */
- if(get_bits1(gb))
- {
- int last = 0;
- for(i = 0; i < 64; i++)
- {
+ if(get_bits1(gb)){
+ int last=0;
+ for(i=0; i<64; i++){
int j;
- v = get_bits(gb, 8);
- if(v == 0) break;
-
- last = v;
- j = s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
- s->avctx->intra_matrix[ff_zigzag_direct[i]] = v;
- s->intra_matrix[j] = v;
- s->chroma_intra_matrix[j] = v;
+ v= get_bits(gb, 8);
+ if(v==0) break;
+
+ last= v;
+ j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
+ s->avctx->intra_matrix[ff_zigzag_direct[i]]=v;
+ s->intra_matrix[j]= v;
+ s->chroma_intra_matrix[j]= v;
}
/* replicate last value */
- for(; i < 64; i++)
- {
- int j = s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
- s->avctx->intra_matrix[ff_zigzag_direct[i]] = last;
- s->intra_matrix[j] = last;
- s->chroma_intra_matrix[j] = last;
+ for(; i<64; i++){
+ int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
+ s->avctx->intra_matrix[ff_zigzag_direct[i]]=last;
+ s->intra_matrix[j]= last;
+ s->chroma_intra_matrix[j]= last;
}
}
/* load custom non intra matrix */
- if(get_bits1(gb))
- {
- int last = 0;
- for(i = 0; i < 64; i++)
- {
+ if(get_bits1(gb)){
+ int last=0;
+ for(i=0; i<64; i++){
int j;
- v = get_bits(gb, 8);
- if(v == 0) break;
-
- last = v;
- j = s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
- s->avctx->inter_matrix[ff_zigzag_direct[i]] = v;
- s->inter_matrix[j] = v;
- s->chroma_inter_matrix[j] = v;
+ v= get_bits(gb, 8);
+ if(v==0) break;
+
+ last= v;
+ j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
+ s->avctx->inter_matrix[ff_zigzag_direct[i]]=v;
+ s->inter_matrix[j]= v;
+ s->chroma_inter_matrix[j]= v;
}
/* replicate last value */
- for(; i < 64; i++)
- {
- int j = s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
- s->avctx->inter_matrix[ff_zigzag_direct[i]] = last;
- s->inter_matrix[j] = last;
- s->chroma_inter_matrix[j] = last;
+ for(; i<64; i++){
+ int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
+ s->avctx->inter_matrix[ff_zigzag_direct[i]]=last;
+ s->inter_matrix[j]= last;
+ s->chroma_inter_matrix[j]= last;
}
}
@@ -2027,105 +1718,88 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb)
}
if(vo_ver_id != 1)
- s->quarter_sample = get_bits1(gb);
- else s->quarter_sample = 0;
-
- if(!get_bits1(gb))
- {
- int pos = get_bits_count(gb);
- int estimation_method = get_bits(gb, 2);
- if(estimation_method < 2)
- {
- if(!get_bits1(gb))
- {
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //opaque
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //transparent
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //intra_cae
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //inter_cae
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //no_update
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //upampling
+ s->quarter_sample= get_bits1(gb);
+ else s->quarter_sample=0;
+
+ if(!get_bits1(gb)){
+ int pos= get_bits_count(gb);
+ int estimation_method= get_bits(gb, 2);
+ if(estimation_method<2){
+ if(!get_bits1(gb)){
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //opaque
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //transparent
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //intra_cae
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //inter_cae
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //no_update
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //upampling
}
- if(!get_bits1(gb))
- {
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //intra_blocks
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //inter_blocks
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //inter4v_blocks
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //not coded blocks
+ if(!get_bits1(gb)){
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //intra_blocks
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //inter_blocks
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //inter4v_blocks
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //not coded blocks
}
- if(!check_marker(gb, "in complexity estimation part 1"))
- {
+ if(!check_marker(gb, "in complexity estimation part 1")){
skip_bits_long(gb, pos - get_bits_count(gb));
goto no_cplx_est;
}
- if(!get_bits1(gb))
- {
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //dct_coeffs
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //dct_lines
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //vlc_syms
- s->cplx_estimation_trash_i += 4 * get_bits1(gb); //vlc_bits
+ if(!get_bits1(gb)){
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //dct_coeffs
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //dct_lines
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //vlc_syms
+ s->cplx_estimation_trash_i += 4*get_bits1(gb); //vlc_bits
}
- if(!get_bits1(gb))
- {
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //apm
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //npm
- s->cplx_estimation_trash_b += 8 * get_bits1(gb); //interpolate_mc_q
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //forwback_mc_q
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //halfpel2
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //halfpel4
+ if(!get_bits1(gb)){
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //apm
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //npm
+ s->cplx_estimation_trash_b += 8*get_bits1(gb); //interpolate_mc_q
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //forwback_mc_q
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //halfpel2
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //halfpel4
}
- if(!check_marker(gb, "in complexity estimation part 2"))
- {
+ if(!check_marker(gb, "in complexity estimation part 2")){
skip_bits_long(gb, pos - get_bits_count(gb));
goto no_cplx_est;
}
- if(estimation_method == 1)
- {
- s->cplx_estimation_trash_i += 8 * get_bits1(gb); //sadct
- s->cplx_estimation_trash_p += 8 * get_bits1(gb); //qpel
+ if(estimation_method==1){
+ s->cplx_estimation_trash_i += 8*get_bits1(gb); //sadct
+ s->cplx_estimation_trash_p += 8*get_bits1(gb); //qpel
}
- }
- else
+ }else
av_log(s->avctx, AV_LOG_ERROR, "Invalid Complexity estimation method %d\n", estimation_method);
- }
- else
- {
+ }else{
no_cplx_est:
- s->cplx_estimation_trash_i =
- s->cplx_estimation_trash_p =
- s->cplx_estimation_trash_b = 0;
+ s->cplx_estimation_trash_i=
+ s->cplx_estimation_trash_p=
+ s->cplx_estimation_trash_b= 0;
}
- s->resync_marker = !get_bits1(gb); /* resync_marker_disabled */
+ s->resync_marker= !get_bits1(gb); /* resync_marker_disabled */
- s->data_partitioning = get_bits1(gb);
- if(s->data_partitioning)
- {
- s->rvlc = get_bits1(gb);
+ s->data_partitioning= get_bits1(gb);
+ if(s->data_partitioning){
+ s->rvlc= get_bits1(gb);
}
- if(vo_ver_id != 1)
- {
- s->new_pred = get_bits1(gb);
- if(s->new_pred)
- {
+ if(vo_ver_id != 1) {
+ s->new_pred= get_bits1(gb);
+ if(s->new_pred){
av_log(s->avctx, AV_LOG_ERROR, "new pred not supported\n");
skip_bits(gb, 2); /* requested upstream message type */
skip_bits1(gb); /* newpred segment type */
}
- s->reduced_res_vop = get_bits1(gb);
+ s->reduced_res_vop= get_bits1(gb);
if(s->reduced_res_vop) av_log(s->avctx, AV_LOG_ERROR, "reduced resolution VOP not supported\n");
}
- else
- {
- s->new_pred = 0;
- s->reduced_res_vop = 0;
+ else{
+ s->new_pred=0;
+ s->reduced_res_vop= 0;
}
- s->scalability = get_bits1(gb);
+ s->scalability= get_bits1(gb);
- if(s->scalability)
- {
- GetBitContext bak = *gb;
+ if (s->scalability) {
+ GetBitContext bak= *gb;
int ref_layer_id;
int ref_layer_sampling_dir;
int h_sampling_factor_n;
@@ -2133,24 +1807,22 @@ no_cplx_est:
int v_sampling_factor_n;
int v_sampling_factor_m;
- s->hierachy_type = get_bits1(gb);
- ref_layer_id = get_bits(gb, 4);
- ref_layer_sampling_dir = get_bits1(gb);
- h_sampling_factor_n = get_bits(gb, 5);
- h_sampling_factor_m = get_bits(gb, 5);
- v_sampling_factor_n = get_bits(gb, 5);
- v_sampling_factor_m = get_bits(gb, 5);
- s->enhancement_type = get_bits1(gb);
-
- if(h_sampling_factor_n == 0 || h_sampling_factor_m == 0
- || v_sampling_factor_n == 0 || v_sampling_factor_m == 0)
- {
+ s->hierachy_type= get_bits1(gb);
+ ref_layer_id= get_bits(gb, 4);
+ ref_layer_sampling_dir= get_bits1(gb);
+ h_sampling_factor_n= get_bits(gb, 5);
+ h_sampling_factor_m= get_bits(gb, 5);
+ v_sampling_factor_n= get_bits(gb, 5);
+ v_sampling_factor_m= get_bits(gb, 5);
+ s->enhancement_type= get_bits1(gb);
+
+ if( h_sampling_factor_n==0 || h_sampling_factor_m==0
+ || v_sampling_factor_n==0 || v_sampling_factor_m==0){
/* illegal scalability header (VERY broken encoder),
* trying to workaround */
- s->scalability = 0;
- *gb = bak;
- }
- else
+ s->scalability=0;
+ *gb= bak;
+ }else
av_log(s->avctx, AV_LOG_ERROR, "scalability not supported\n");
// bin shape stuff FIXME
@@ -2163,322 +1835,271 @@ no_cplx_est:
* decodes the user data stuff in the header.
* Also initializes divx/xvid/lavc_version/build.
*/
-static int decode_user_data(MpegEncContext *s, GetBitContext *gb)
-{
+static int decode_user_data(MpegEncContext *s, GetBitContext *gb){
char buf[256];
int i;
int e;
int ver = 0, build = 0, ver2 = 0, ver3 = 0;
char last;
- for(i = 0; i < 255 && get_bits_count(gb) < gb->size_in_bits; i++)
- {
+ for(i=0; i<255 && get_bits_count(gb) < gb->size_in_bits; i++){
if(show_bits(gb, 23) == 0) break;
- buf[i] = get_bits(gb, 8);
+ buf[i]= get_bits(gb, 8);
}
- buf[i] = 0;
+ buf[i]=0;
/* divx detection */
- e = sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last);
- if(e < 2)
- e = sscanf(buf, "DivX%db%d%c", &ver, &build, &last);
- if(e >= 2)
- {
- s->divx_version = ver;
- s->divx_build = build;
- s->divx_packed = e == 3 && last == 'p';
- if(s->divx_packed && !s->showed_packed_warning)
- {
+ e=sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last);
+ if(e<2)
+ e=sscanf(buf, "DivX%db%d%c", &ver, &build, &last);
+ if(e>=2){
+ s->divx_version= ver;
+ s->divx_build= build;
+ s->divx_packed= e==3 && last=='p';
+ if(s->divx_packed && !s->showed_packed_warning) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid and inefficient vfw-avi packed B frames detected\n");
- s->showed_packed_warning = 1;
+ s->showed_packed_warning=1;
}
}
/* ffmpeg detection */
- e = sscanf(buf, "FFmpe%*[^b]b%d", &build) + 3;
- if(e != 4)
- e = sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
- if(e != 4)
- {
- e = sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3) + 1;
- if(e > 1)
- build = (ver << 16) + (ver2 << 8) + ver3;
+ e=sscanf(buf, "FFmpe%*[^b]b%d", &build)+3;
+ if(e!=4)
+ e=sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
+ if(e!=4){
+ e=sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3)+1;
+ if (e>1)
+ build= (ver<<16) + (ver2<<8) + ver3;
}
- if(e != 4)
- {
- if(strcmp(buf, "ffmpeg") == 0)
- {
- s->lavc_build = 4600;
+ if(e!=4){
+ if(strcmp(buf, "ffmpeg")==0){
+ s->lavc_build= 4600;
}
}
- if(e == 4)
- {
- s->lavc_build = build;
+ if(e==4){
+ s->lavc_build= build;
}
/* Xvid detection */
- e = sscanf(buf, "XviD%d", &build);
- if(e == 1)
- {
- s->xvid_build = build;
+ e=sscanf(buf, "XviD%d", &build);
+ if(e==1){
+ s->xvid_build= build;
}
return 0;
}
-static int decode_vop_header(MpegEncContext *s, GetBitContext *gb)
-{
+static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
int time_incr, time_increment;
s->pict_type = get_bits(gb, 2) + FF_I_TYPE; /* pict type: I = 0 , P = 1 */
- if(s->pict_type == FF_B_TYPE && s->low_delay && s->vol_control_parameters == 0 && !(s->flags & CODEC_FLAG_LOW_DELAY))
- {
+ if(s->pict_type==FF_B_TYPE && s->low_delay && s->vol_control_parameters==0 && !(s->flags & CODEC_FLAG_LOW_DELAY)){
av_log(s->avctx, AV_LOG_ERROR, "low_delay flag incorrectly, clearing it\n");
- s->low_delay = 0;
+ s->low_delay=0;
}
- s->partitioned_frame = s->data_partitioning && s->pict_type != FF_B_TYPE;
+ s->partitioned_frame= s->data_partitioning && s->pict_type!=FF_B_TYPE;
if(s->partitioned_frame)
- s->decode_mb = mpeg4_decode_partitioned_mb;
+ s->decode_mb= mpeg4_decode_partitioned_mb;
else
- s->decode_mb = mpeg4_decode_mb;
+ s->decode_mb= mpeg4_decode_mb;
- time_incr = 0;
- while(get_bits1(gb) != 0)
+ time_incr=0;
+ while (get_bits1(gb) != 0)
time_incr++;
check_marker(gb, "before time_increment");
- if(s->time_increment_bits == 0 || !(show_bits(gb, s->time_increment_bits + 1) & 1))
- {
+ if(s->time_increment_bits==0 || !(show_bits(gb, s->time_increment_bits+1)&1)){
av_log(s->avctx, AV_LOG_ERROR, "hmm, seems the headers are not complete, trying to guess time_increment_bits\n");
- for(s->time_increment_bits = 1 ; s->time_increment_bits < 16; s->time_increment_bits++)
- {
- if(s->pict_type == FF_P_TYPE
- || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE))
- {
- if((show_bits(gb, s->time_increment_bits + 6) & 0x37) == 0x30) break;
- }
- else if((show_bits(gb, s->time_increment_bits + 5) & 0x1F) == 0x18) break;
+ for(s->time_increment_bits=1 ;s->time_increment_bits<16; s->time_increment_bits++){
+ if ( s->pict_type == FF_P_TYPE
+ || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE)) {
+ if((show_bits(gb, s->time_increment_bits+6)&0x37) == 0x30) break;
+ }else
+ if((show_bits(gb, s->time_increment_bits+5)&0x1F) == 0x18) break;
}
- av_log(s->avctx, AV_LOG_ERROR, "my guess is %d bits ;)\n", s->time_increment_bits);
+ av_log(s->avctx, AV_LOG_ERROR, "my guess is %d bits ;)\n",s->time_increment_bits);
}
- if(IS_3IV1) time_increment = get_bits1(gb); //FIXME investigate further
- else time_increment = get_bits(gb, s->time_increment_bits);
+ if(IS_3IV1) time_increment= get_bits1(gb); //FIXME investigate further
+ else time_increment= get_bits(gb, s->time_increment_bits);
- if(s->pict_type != FF_B_TYPE)
- {
- s->last_time_base = s->time_base;
- s->time_base += time_incr;
- s->time = s->time_base * s->avctx->time_base.den + time_increment;
- if(s->workaround_bugs & FF_BUG_UMP4)
- {
- if(s->time < s->last_non_b_time)
- {
+ if(s->pict_type!=FF_B_TYPE){
+ s->last_time_base= s->time_base;
+ s->time_base+= time_incr;
+ s->time= s->time_base*s->avctx->time_base.den + time_increment;
+ if(s->workaround_bugs&FF_BUG_UMP4){
+ if(s->time < s->last_non_b_time){
/* header is not mpeg-4-compatible, broken encoder,
* trying to workaround */
s->time_base++;
- s->time += s->avctx->time_base.den;
+ s->time+= s->avctx->time_base.den;
}
}
- s->pp_time = s->time - s->last_non_b_time;
- s->last_non_b_time = s->time;
- }
- else
- {
- s->time = (s->last_time_base + time_incr) * s->avctx->time_base.den + time_increment;
- 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= s->time - s->last_non_b_time;
+ s->last_non_b_time= s->time;
+ }else{
+ s->time= (s->last_time_base + time_incr)*s->avctx->time_base.den + time_increment;
+ 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){
/* messed up order, maybe after seeking? skipping current b-frame */
return FRAME_SKIPPED;
}
ff_mpeg4_init_direct_mv(s);
- if(s->t_frame == 0) s->t_frame = s->pb_time;
- if(s->t_frame == 0) s->t_frame = 1; // 1/0 protection
- s->pp_field_time = (ROUNDED_DIV(s->last_non_b_time, s->t_frame)
- - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame)) * 2;
- s->pb_field_time = (ROUNDED_DIV(s->time, s->t_frame)
- - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame)) * 2;
- if(!s->progressive_sequence)
- {
+ if(s->t_frame==0) s->t_frame= s->pb_time;
+ if(s->t_frame==0) s->t_frame=1; // 1/0 protection
+ s->pp_field_time= ( ROUNDED_DIV(s->last_non_b_time, s->t_frame)
+ - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2;
+ s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame)
+ - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2;
+ if(!s->progressive_sequence){
if(s->pp_field_time <= s->pb_field_time || s->pb_field_time <= 1)
return FRAME_SKIPPED;
}
}
if(s->avctx->time_base.num)
- s->current_picture_ptr->pts = (s->time + s->avctx->time_base.num / 2) / s->avctx->time_base.num;
+ s->current_picture_ptr->pts= (s->time + s->avctx->time_base.num/2) / s->avctx->time_base.num;
else
- s->current_picture_ptr->pts = AV_NOPTS_VALUE;
- if(s->avctx->debug & FF_DEBUG_PTS)
+ s->current_picture_ptr->pts= AV_NOPTS_VALUE;
+ if(s->avctx->debug&FF_DEBUG_PTS)
av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %"PRId64"\n", s->current_picture_ptr->pts);
check_marker(gb, "before vop_coded");
/* vop coded */
- if(get_bits1(gb) != 1)
- {
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if (get_bits1(gb) != 1){
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n");
return FRAME_SKIPPED;
}
- if(s->shape != BIN_ONLY_SHAPE && (s->pict_type == FF_P_TYPE
- || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage == GMC_SPRITE)))
- {
+ if (s->shape != BIN_ONLY_SHAPE && ( s->pict_type == FF_P_TYPE
+ || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE))) {
/* rounding type for motion estimation */
s->no_rounding = get_bits1(gb);
- }
- else
- {
+ } else {
s->no_rounding = 0;
}
//FIXME reduced res stuff
- if(s->shape != RECT_SHAPE)
- {
- if(s->vol_sprite_usage != 1 || s->pict_type != FF_I_TYPE)
- {
- int width, height, hor_spat_ref, ver_spat_ref;
-
- width = get_bits(gb, 13);
- skip_bits1(gb); /* marker */
- height = get_bits(gb, 13);
- skip_bits1(gb); /* marker */
- hor_spat_ref = get_bits(gb, 13); /* hor_spat_ref */
- skip_bits1(gb); /* marker */
- ver_spat_ref = get_bits(gb, 13); /* ver_spat_ref */
- }
- skip_bits1(gb); /* change_CR_disable */
-
- if(get_bits1(gb) != 0)
- {
- skip_bits(gb, 8); /* constant_alpha_value */
- }
- }
+ if (s->shape != RECT_SHAPE) {
+ if (s->vol_sprite_usage != 1 || s->pict_type != FF_I_TYPE) {
+ int width, height, hor_spat_ref, ver_spat_ref;
+
+ width = get_bits(gb, 13);
+ skip_bits1(gb); /* marker */
+ height = get_bits(gb, 13);
+ skip_bits1(gb); /* marker */
+ hor_spat_ref = get_bits(gb, 13); /* hor_spat_ref */
+ skip_bits1(gb); /* marker */
+ ver_spat_ref = get_bits(gb, 13); /* ver_spat_ref */
+ }
+ skip_bits1(gb); /* change_CR_disable */
+
+ if (get_bits1(gb) != 0) {
+ skip_bits(gb, 8); /* constant_alpha_value */
+ }
+ }
//FIXME complexity estimation stuff
- if(s->shape != BIN_ONLY_SHAPE)
- {
- skip_bits_long(gb, s->cplx_estimation_trash_i);
- if(s->pict_type != FF_I_TYPE)
+ if (s->shape != BIN_ONLY_SHAPE) {
+ skip_bits_long(gb, s->cplx_estimation_trash_i);
+ if(s->pict_type != FF_I_TYPE)
skip_bits_long(gb, s->cplx_estimation_trash_p);
- if(s->pict_type == FF_B_TYPE)
+ if(s->pict_type == FF_B_TYPE)
skip_bits_long(gb, s->cplx_estimation_trash_b);
- s->intra_dc_threshold = mpeg4_dc_threshold[ get_bits(gb, 3)];
- if(!s->progressive_sequence)
- {
- s->top_field_first = get_bits1(gb);
- s->alternate_scan = get_bits1(gb);
- }
- else
- s->alternate_scan = 0;
- }
-
- if(s->alternate_scan)
- {
- ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_alternate_vertical_scan);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_alternate_vertical_scan);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
- }
- else
- {
- ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_zigzag_direct);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_zigzag_direct);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
- }
-
- if(s->pict_type == FF_S_TYPE && (s->vol_sprite_usage == STATIC_SPRITE || s->vol_sprite_usage == GMC_SPRITE))
- {
- mpeg4_decode_sprite_trajectory(s, gb);
- if(s->sprite_brightness_change) av_log(s->avctx, AV_LOG_ERROR, "sprite_brightness_change not supported\n");
- if(s->vol_sprite_usage == STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
- }
-
- if(s->shape != BIN_ONLY_SHAPE)
- {
- s->chroma_qscale = s->qscale = get_bits(gb, s->quant_precision);
- if(s->qscale == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (qscale=0)\n");
- return -1; // makes no sense to continue, as there is nothing left from the image then
- }
-
- if(s->pict_type != FF_I_TYPE)
- {
- s->f_code = get_bits(gb, 3); /* fcode_for */
- if(s->f_code == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (f_code=0)\n");
- return -1; // makes no sense to continue, as the MV decoding will break very quickly
- }
- }
- else
- s->f_code = 1;
-
- if(s->pict_type == FF_B_TYPE)
- {
- s->b_code = get_bits(gb, 3);
- }
- else
- s->b_code = 1;
-
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
- av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d\n",
- s->qscale, s->f_code, s->b_code,
- s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
- gb->size_in_bits, s->progressive_sequence, s->alternate_scan, s->top_field_first,
- s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
- s->sprite_warping_accuracy, 1 - s->no_rounding, s->vo_type, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold, s->cplx_estimation_trash_i, s->cplx_estimation_trash_p, s->cplx_estimation_trash_b);
- }
-
- if(!s->scalability)
- {
- if(s->shape != RECT_SHAPE && s->pict_type != FF_I_TYPE)
- {
- skip_bits1(gb); // vop shape coding type
- }
- }
- else
- {
- if(s->enhancement_type)
- {
- int load_backward_shape = get_bits1(gb);
- if(load_backward_shape)
- {
- av_log(s->avctx, AV_LOG_ERROR, "load backward shape isn't supported\n");
- }
- }
- skip_bits(gb, 2); //ref_select_code
- }
- }
- /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/opendivx)*/
- // note we cannot detect divx5 without b-frames easily (although it's buggy too)
- if(s->vo_type == 0 && s->vol_control_parameters == 0 && s->divx_version == 0 && s->picture_number == 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
- s->low_delay = 1;
- }
-
- s->picture_number++; // better than pic number==0 always ;)
-
- s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table; //FIXME add short header support
- s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table;
-
- if(s->workaround_bugs & FF_BUG_EDGE)
- {
- s->h_edge_pos = s->width;
- s->v_edge_pos = s->height;
- }
- return 0;
+ s->intra_dc_threshold= mpeg4_dc_threshold[ get_bits(gb, 3) ];
+ if(!s->progressive_sequence){
+ s->top_field_first= get_bits1(gb);
+ s->alternate_scan= get_bits1(gb);
+ }else
+ s->alternate_scan= 0;
+ }
+
+ if(s->alternate_scan){
+ ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_alternate_vertical_scan);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_alternate_vertical_scan);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ } else{
+ ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_zigzag_direct);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_zigzag_direct);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
+ }
+
+ if(s->pict_type == FF_S_TYPE && (s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE)){
+ mpeg4_decode_sprite_trajectory(s, gb);
+ if(s->sprite_brightness_change) av_log(s->avctx, AV_LOG_ERROR, "sprite_brightness_change not supported\n");
+ if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
+ }
+
+ if (s->shape != BIN_ONLY_SHAPE) {
+ s->chroma_qscale= s->qscale = get_bits(gb, s->quant_precision);
+ if(s->qscale==0){
+ av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (qscale=0)\n");
+ return -1; // makes no sense to continue, as there is nothing left from the image then
+ }
+
+ if (s->pict_type != FF_I_TYPE) {
+ s->f_code = get_bits(gb, 3); /* fcode_for */
+ if(s->f_code==0){
+ av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (f_code=0)\n");
+ return -1; // makes no sense to continue, as the MV decoding will break very quickly
+ }
+ }else
+ s->f_code=1;
+
+ if (s->pict_type == FF_B_TYPE) {
+ s->b_code = get_bits(gb, 3);
+ }else
+ s->b_code=1;
+
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
+ av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d\n",
+ s->qscale, s->f_code, s->b_code,
+ s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
+ gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first,
+ s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
+ s->sprite_warping_accuracy, 1-s->no_rounding, s->vo_type, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold, s->cplx_estimation_trash_i, s->cplx_estimation_trash_p, s->cplx_estimation_trash_b);
+ }
+
+ if(!s->scalability){
+ if (s->shape!=RECT_SHAPE && s->pict_type!=FF_I_TYPE) {
+ skip_bits1(gb); // vop shape coding type
+ }
+ }else{
+ if(s->enhancement_type){
+ int load_backward_shape= get_bits1(gb);
+ if(load_backward_shape){
+ av_log(s->avctx, AV_LOG_ERROR, "load backward shape isn't supported\n");
+ }
+ }
+ skip_bits(gb, 2); //ref_select_code
+ }
+ }
+ /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/opendivx)*/
+ // note we cannot detect divx5 without b-frames easily (although it's buggy too)
+ if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==0 && s->picture_number==0){
+ av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
+ s->low_delay=1;
+ }
+
+ s->picture_number++; // better than pic number==0 always ;)
+
+ s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; //FIXME add short header support
+ s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
+
+ if(s->workaround_bugs&FF_BUG_EDGE){
+ s->h_edge_pos= s->width;
+ s->v_edge_pos= s->height;
+ }
+ return 0;
}
/**
@@ -2494,24 +2115,19 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
/* search next start code */
align_get_bits(gb);
- if(s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630)
- {
+ if(s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630){
skip_bits(gb, 24);
if(get_bits(gb, 8) == 0xF0)
goto end;
}
startcode = 0xff;
- for(;;)
- {
- if(get_bits_count(gb) >= gb->size_in_bits)
- {
- if(gb->size_in_bits == 8 && (s->divx_version || s->xvid_build))
- {
+ for(;;) {
+ if(get_bits_count(gb) >= gb->size_in_bits){
+ if(gb->size_in_bits==8 && (s->divx_version || s->xvid_build)){
av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bits);
return FRAME_SKIPPED; //divx bug
- }
- else
+ }else
return -1; //end of stream
}
@@ -2519,57 +2135,52 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
v = get_bits(gb, 8);
startcode = ((startcode << 8) | v) & 0xffffffff;
- if((startcode & 0xFFFFFF00) != 0x100)
+ if((startcode&0xFFFFFF00) != 0x100)
continue; //no startcode
- if(s->avctx->debug & FF_DEBUG_STARTCODE)
- {
+ if(s->avctx->debug&FF_DEBUG_STARTCODE){
av_log(s->avctx, AV_LOG_DEBUG, "startcode: %3X ", startcode);
- if(startcode <= 0x11F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Start");
- else if(startcode <= 0x12F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Layer Start");
- else if(startcode <= 0x13F) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
- else if(startcode <= 0x15F) av_log(s->avctx, AV_LOG_DEBUG, "FGS bp start");
- else if(startcode <= 0x1AF) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
- else if(startcode == 0x1B0) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq Start");
- else if(startcode == 0x1B1) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq End");
- else if(startcode == 0x1B2) av_log(s->avctx, AV_LOG_DEBUG, "User Data");
- else if(startcode == 0x1B3) av_log(s->avctx, AV_LOG_DEBUG, "Group of VOP start");
- else if(startcode == 0x1B4) av_log(s->avctx, AV_LOG_DEBUG, "Video Session Error");
- else if(startcode == 0x1B5) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Start");
- else if(startcode == 0x1B6) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Plane start");
- else if(startcode == 0x1B7) av_log(s->avctx, AV_LOG_DEBUG, "slice start");
- else if(startcode == 0x1B8) av_log(s->avctx, AV_LOG_DEBUG, "extension start");
- else if(startcode == 0x1B9) av_log(s->avctx, AV_LOG_DEBUG, "fgs start");
- else if(startcode == 0x1BA) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object start");
- else if(startcode == 0x1BB) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object Plane start");
- else if(startcode == 0x1BC) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object start");
- else if(startcode == 0x1BD) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object Plane start");
- else if(startcode == 0x1BE) av_log(s->avctx, AV_LOG_DEBUG, "Still Texture Object start");
- else if(startcode == 0x1BF) av_log(s->avctx, AV_LOG_DEBUG, "Texture Spatial Layer start");
- else if(startcode == 0x1C0) av_log(s->avctx, AV_LOG_DEBUG, "Texture SNR Layer start");
- else if(startcode == 0x1C1) av_log(s->avctx, AV_LOG_DEBUG, "Texture Tile start");
- else if(startcode == 0x1C2) av_log(s->avctx, AV_LOG_DEBUG, "Texture Shape Layer start");
- else if(startcode == 0x1C3) av_log(s->avctx, AV_LOG_DEBUG, "stuffing start");
- else if(startcode <= 0x1C5) av_log(s->avctx, AV_LOG_DEBUG, "reserved");
- else if(startcode <= 0x1FF) av_log(s->avctx, AV_LOG_DEBUG, "System start");
+ if (startcode<=0x11F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Start");
+ else if(startcode<=0x12F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Layer Start");
+ else if(startcode<=0x13F) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
+ else if(startcode<=0x15F) av_log(s->avctx, AV_LOG_DEBUG, "FGS bp start");
+ else if(startcode<=0x1AF) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
+ else if(startcode==0x1B0) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq Start");
+ else if(startcode==0x1B1) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq End");
+ else if(startcode==0x1B2) av_log(s->avctx, AV_LOG_DEBUG, "User Data");
+ else if(startcode==0x1B3) av_log(s->avctx, AV_LOG_DEBUG, "Group of VOP start");
+ else if(startcode==0x1B4) av_log(s->avctx, AV_LOG_DEBUG, "Video Session Error");
+ else if(startcode==0x1B5) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Start");
+ else if(startcode==0x1B6) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Plane start");
+ else if(startcode==0x1B7) av_log(s->avctx, AV_LOG_DEBUG, "slice start");
+ else if(startcode==0x1B8) av_log(s->avctx, AV_LOG_DEBUG, "extension start");
+ else if(startcode==0x1B9) av_log(s->avctx, AV_LOG_DEBUG, "fgs start");
+ else if(startcode==0x1BA) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object start");
+ else if(startcode==0x1BB) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object Plane start");
+ else if(startcode==0x1BC) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object start");
+ else if(startcode==0x1BD) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object Plane start");
+ else if(startcode==0x1BE) av_log(s->avctx, AV_LOG_DEBUG, "Still Texture Object start");
+ else if(startcode==0x1BF) av_log(s->avctx, AV_LOG_DEBUG, "Texture Spatial Layer start");
+ else if(startcode==0x1C0) av_log(s->avctx, AV_LOG_DEBUG, "Texture SNR Layer start");
+ else if(startcode==0x1C1) av_log(s->avctx, AV_LOG_DEBUG, "Texture Tile start");
+ else if(startcode==0x1C2) av_log(s->avctx, AV_LOG_DEBUG, "Texture Shape Layer start");
+ else if(startcode==0x1C3) av_log(s->avctx, AV_LOG_DEBUG, "stuffing start");
+ else if(startcode<=0x1C5) av_log(s->avctx, AV_LOG_DEBUG, "reserved");
+ else if(startcode<=0x1FF) av_log(s->avctx, AV_LOG_DEBUG, "System start");
av_log(s->avctx, AV_LOG_DEBUG, " at %d\n", get_bits_count(gb));
}
- if(startcode >= 0x120 && startcode <= 0x12F)
- {
+ if(startcode >= 0x120 && startcode <= 0x12F){
if(decode_vol_header(s, gb) < 0)
return -1;
}
- else if(startcode == USER_DATA_STARTCODE)
- {
+ else if(startcode == USER_DATA_STARTCODE){
decode_user_data(s, gb);
}
- else if(startcode == GOP_STARTCODE)
- {
+ else if(startcode == GOP_STARTCODE){
mpeg4_decode_gop_header(s, gb);
}
- else if(startcode == VOP_STARTCODE)
- {
+ else if(startcode == VOP_STARTCODE){
break;
}
@@ -2577,9 +2188,9 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
startcode = 0xff;
}
end:
- if(s->flags & CODEC_FLAG_LOW_DELAY)
- s->low_delay = 1;
- s->avctx->has_b_frames = !s->low_delay;
+ if(s->flags& CODEC_FLAG_LOW_DELAY)
+ s->low_delay=1;
+ s->avctx->has_b_frames= !s->low_delay;
return decode_vop_header(s, gb);
}
@@ -2589,11 +2200,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
int ret;
static int done = 0;
- if((ret = ff_h263_decode_init(avctx)) < 0)
+ if((ret=ff_h263_decode_init(avctx)) < 0)
return ret;
- if(!done)
- {
+ if (!done) {
done = 1;
init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
@@ -2603,30 +2213,29 @@ static av_cold int decode_init(AVCodecContext *avctx)
INIT_VLC_RL(rvlc_rl_inter, 1072);
INIT_VLC_RL(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);
+ &ff_mpeg4_DCtab_lum[0][1], 2, 1,
+ &ff_mpeg4_DCtab_lum[0][0], 2, 1, 512);
INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */,
- &ff_mpeg4_DCtab_chrom[0][1], 2, 1,
- &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512);
+ &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);
+ &sprite_trajectory_tab[0][1], 4, 2,
+ &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);
+ &mb_type_b_tab[0][1], 2, 1,
+ &mb_type_b_tab[0][0], 2, 1, 16);
}
s->h263_pred = 1;
s->low_delay = 0; //default, might be overriden in the vol header during header parsing
- s->decode_mb = mpeg4_decode_mb;
+ s->decode_mb= mpeg4_decode_mb;
s->time_increment_bits = 4; /* default value for broken headers */
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
return 0;
}
-AVCodec mpeg4_decoder =
-{
+AVCodec mpeg4_decoder = {
"mpeg4",
CODEC_TYPE_VIDEO,
CODEC_ID_MPEG4,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c
index 70ec2c762..72c0892d8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c
@@ -40,19 +40,19 @@
//#include <assert.h>
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
static void dct_unquantize_h263_intra_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
static void dct_unquantize_h263_inter_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale);
+ DCTELEM *block, int n, int qscale);
/* enable all paranoid tests for rounding, overflows, etc... */
@@ -61,14 +61,12 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
//#define DEBUG
-static const uint8_t ff_default_chroma_qscale_table[32] =
-{
+static const uint8_t ff_default_chroma_qscale_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, 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, 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
};
-const uint8_t ff_mpeg1_dc_scale_table[128] =
-{
+const uint8_t ff_mpeg1_dc_scale_table[128]={
// 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
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -77,38 +75,34 @@ const uint8_t ff_mpeg1_dc_scale_table[128] =
};
-const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state)
-{
+const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
int i;
- assert(p <= end);
- if(p >= end)
+ assert(p<=end);
+ if(p>=end)
return end;
- for(i = 0; i < 3; i++)
- {
- uint32_t tmp = *state << 8;
- *state = tmp + *(p++);
- if(tmp == 0x100 || p == end)
+ for(i=0; i<3; i++){
+ uint32_t tmp= *state << 8;
+ *state= tmp + *(p++);
+ if(tmp == 0x100 || p==end)
return p;
}
- while(p < end)
- {
- if(p[-1] > 1) p += 3;
- else if(p[-2]) p += 2;
- else if(p[-3] | (p[-1] - 1)) p++;
- else
- {
+ while(p<end){
+ if (p[-1] > 1 ) p+= 3;
+ else if(p[-2] ) p+= 2;
+ else if(p[-3]|(p[-1]-1)) p++;
+ else{
p++;
break;
}
}
- p = FFMIN(p, end) - 4;
- *state = AV_RB32(p);
+ p= FFMIN(p, end)-4;
+ *state= AV_RB32(p);
- return p + 4;
+ return p+4;
}
/* init common dct for both encoder and decoder */
@@ -130,13 +124,10 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
/* load & permutate scantables
note: only wmv uses different ones
*/
- if(s->alternate_scan)
- {
+ if(s->alternate_scan){
ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_alternate_vertical_scan);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_alternate_vertical_scan);
- }
- else
- {
+ }else{
ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_zigzag_direct);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_zigzag_direct);
}
@@ -146,10 +137,9 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
return 0;
}
-void ff_copy_picture(Picture *dst, Picture *src)
-{
+void ff_copy_picture(Picture *dst, Picture *src){
*dst = *src;
- dst->type = FF_BUFFER_TYPE_COPY;
+ dst->type= FF_BUFFER_TYPE_COPY;
}
/**
@@ -169,21 +159,18 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
- if(r < 0 || !pic->age || !pic->type || !pic->data[0])
- {
+ if (r<0 || !pic->age || !pic->type || !pic->data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
return -1;
}
- if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1]))
- {
+ if (s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n");
free_frame_buffer(s, pic);
return -1;
}
- if(pic->linesize[1] != pic->linesize[2])
- {
+ if (pic->linesize[1] != pic->linesize[2]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n");
free_frame_buffer(s, pic);
return -1;
@@ -196,83 +183,71 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
* allocates a Picture
* The pixels are allocated/set by calling get_buffer() if shared=0
*/
-int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
-{
- const int big_mb_num = s->mb_stride * (s->mb_height + 1) + 1; //the +1 is needed so memset(,,stride*height) does not sig11
- const int mb_array_size = s->mb_stride * s->mb_height;
- const int b8_array_size = s->b8_stride * s->mb_height * 2;
- const int b4_array_size = s->b4_stride * s->mb_height * 4;
+int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){
+ const int big_mb_num= s->mb_stride*(s->mb_height+1) + 1; //the +1 is needed so memset(,,stride*height) does not sig11
+ const int mb_array_size= s->mb_stride*s->mb_height;
+ const int b8_array_size= s->b8_stride*s->mb_height*2;
+ const int b4_array_size= s->b4_stride*s->mb_height*4;
int i;
- int r = -1;
+ int r= -1;
- if(shared)
- {
+ if(shared){
assert(pic->data[0]);
assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED);
- pic->type = FF_BUFFER_TYPE_SHARED;
- }
- else
- {
+ pic->type= FF_BUFFER_TYPE_SHARED;
+ }else{
assert(!pic->data[0]);
- if(alloc_frame_buffer(s, pic) < 0)
+ if (alloc_frame_buffer(s, pic) < 0)
return -1;
s->linesize = pic->linesize[0];
- s->uvlinesize = pic->linesize[1];
+ s->uvlinesize= pic->linesize[1];
}
- if(pic->qscale_table == NULL)
- {
- if(s->encoding)
- {
+ if(pic->qscale_table==NULL){
+ if (s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_var , mb_array_size * sizeof(int16_t) , fail)
FF_ALLOCZ_OR_GOTO(s->avctx, pic->mc_mb_var, mb_array_size * sizeof(int16_t) , fail)
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_mean , mb_array_size * sizeof(int8_t) , fail)
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_mean , mb_array_size * sizeof(int8_t ) , fail)
}
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(uint8_t) + 2, fail) //the +2 is for the slice end check
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2, fail) //the +2 is for the slice end check
FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(uint8_t) , fail)
FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stride) * sizeof(uint32_t), fail)
- pic->mb_type = pic->mb_type_base + 2 * s->mb_stride + 1;
- if(s->out_format == FMT_H264)
- {
- for(i = 0; i < 2; i++)
- {
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 *(b4_array_size + 4) * sizeof(int16_t), fail)
- pic->motion_val[i] = pic->motion_val_base[i] + 4;
+ pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1;
+ if(s->out_format == FMT_H264){
+ for(i=0; i<2; i++){
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_array_size+4) * sizeof(int16_t), fail)
+ pic->motion_val[i]= pic->motion_val_base[i]+4;
FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * sizeof(uint8_t), fail)
}
- pic->motion_subsample_log2 = 2;
- }
- else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug & FF_DEBUG_MV) || (s->avctx->debug_mv))
- {
- for(i = 0; i < 2; i++)
- {
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 *(b8_array_size + 4) * sizeof(int16_t), fail)
- pic->motion_val[i] = pic->motion_val_base[i] + 4;
+ pic->motion_subsample_log2= 2;
+ }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){
+ for(i=0; i<2; i++){
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t), fail)
+ pic->motion_val[i]= pic->motion_val_base[i]+4;
FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * sizeof(uint8_t), fail)
}
- pic->motion_subsample_log2 = 3;
+ pic->motion_subsample_log2= 3;
}
- if(s->avctx->debug & FF_DEBUG_DCT_COEFF)
- {
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM) * 6, fail)
+ if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6, fail)
}
- pic->qstride = s->mb_stride;
+ pic->qstride= s->mb_stride;
FF_ALLOCZ_OR_GOTO(s->avctx, pic->pan_scan , 1 * sizeof(AVPanScan), fail)
}
/* It might be nicer if the application would keep track of these
* but it would require an API change. */
- memmove(s->prev_pict_types + 1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE - 1);
- s->prev_pict_types[0] = s->dropable ? FF_B_TYPE : s->pict_type;
+ memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1);
+ s->prev_pict_types[0]= s->dropable ? FF_B_TYPE : s->pict_type;
if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == FF_B_TYPE)
- pic->age = INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway.
+ pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway.
return 0;
fail: //for the FF_ALLOCZ_OR_GOTO macro
- if(r >= 0)
+ if(r>=0)
free_frame_buffer(s, pic);
return -1;
}
@@ -280,12 +255,10 @@ fail: //for the FF_ALLOCZ_OR_GOTO macro
/**
* deallocates a picture
*/
-static void free_picture(MpegEncContext *s, Picture *pic)
-{
+static void free_picture(MpegEncContext *s, Picture *pic){
int i;
- if(pic->data[0] && pic->type != FF_BUFFER_TYPE_SHARED)
- {
+ if(pic->data[0] && pic->type!=FF_BUFFER_TYPE_SHARED){
free_frame_buffer(s, pic);
}
@@ -297,52 +270,45 @@ static void free_picture(MpegEncContext *s, Picture *pic)
av_freep(&pic->mb_type_base);
av_freep(&pic->dct_coeff);
av_freep(&pic->pan_scan);
- pic->mb_type = NULL;
- for(i = 0; i < 2; i++)
- {
+ pic->mb_type= NULL;
+ for(i=0; i<2; i++){
av_freep(&pic->motion_val_base[i]);
av_freep(&pic->ref_index[i]);
}
- if(pic->type == FF_BUFFER_TYPE_SHARED)
- {
- for(i = 0; i < 4; i++)
- {
- pic->base[i] =
- pic->data[i] = NULL;
+ if(pic->type == FF_BUFFER_TYPE_SHARED){
+ for(i=0; i<4; i++){
+ pic->base[i]=
+ pic->data[i]= NULL;
}
- pic->type = 0;
+ pic->type= 0;
}
}
-static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base)
-{
+static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){
int i;
// edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)
- FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width + 64) * 2 * 21 * 2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
- s->edge_emu_buffer = s->allocated_edge_emu_buffer + (s->width + 64) * 2 * 21;
-
- //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)
- FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE * sizeof(uint32_t), fail)
- if(s->avctx->noise_reduction)
- {
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
+ s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;
+
+ //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)
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail)
+ if(s->avctx->noise_reduction){
FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_error_sum, 2 * 64 * sizeof(int), fail)
}
}
- FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64 * 12 * 2 * sizeof(DCTELEM), fail)
- s->block = s->blocks[0];
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64*12*2 * sizeof(DCTELEM), fail)
+ s->block= s->blocks[0];
- for(i = 0; i < 12; i++)
- {
+ for(i=0;i<12;i++){
s->pblocks[i] = &s->block[i];
}
return 0;
@@ -350,27 +316,24 @@ fail:
return -1; //free() through MPV_common_end()
}
-static void free_duplicate_context(MpegEncContext *s)
-{
- if(s == NULL) return;
+static void free_duplicate_context(MpegEncContext *s){
+ if(s==NULL) return;
- av_freep(&s->allocated_edge_emu_buffer);
- s->edge_emu_buffer = NULL;
+ av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL;
av_freep(&s->me.scratchpad);
- s->me.temp =
- s->rd_scratchpad =
- s->b_scratchpad =
- s->obmc_scratchpad = NULL;
+ s->me.temp=
+ s->rd_scratchpad=
+ s->b_scratchpad=
+ s->obmc_scratchpad= NULL;
av_freep(&s->dct_error_sum);
av_freep(&s->me.map);
av_freep(&s->me.score_map);
av_freep(&s->blocks);
- s->block = NULL;
+ s->block= NULL;
}
-static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src)
-{
+static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src){
#define COPY(a) bak->a= src->a
COPY(allocated_edge_emu_buffer);
COPY(edge_emu_buffer);
@@ -393,8 +356,7 @@ static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src)
#undef COPY
}
-void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
-{
+void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){
MpegEncContext bak;
int i;
//FIXME copy only needed parts
@@ -402,8 +364,7 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
backup_duplicate_context(&bak, dst);
memcpy(dst, src, sizeof(MpegEncContext));
backup_duplicate_context(dst, &bak);
- for(i = 0; i < 12; i++)
- {
+ for(i=0;i<12;i++){
dst->pblocks[i] = &dst->block[i];
}
//STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
@@ -413,14 +374,13 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
* sets 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)
-{
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
- s->chroma_qscale_table = ff_default_chroma_qscale_table;
- s->progressive_frame = 1;
- s->progressive_sequence = 1;
- s->picture_structure = PICT_FRAME;
+void MPV_common_defaults(MpegEncContext *s){
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
+ s->chroma_qscale_table= ff_default_chroma_qscale_table;
+ s->progressive_frame= 1;
+ s->progressive_sequence= 1;
+ s->picture_structure= PICT_FRAME;
s->coded_picture_number = 0;
s->picture_number = 0;
@@ -436,8 +396,7 @@ void MPV_common_defaults(MpegEncContext *s)
* sets the given MpegEncContext to defaults for decoding.
* the changed fields will not depend upon the prior state of the MpegEncContext.
*/
-void MPV_decode_defaults(MpegEncContext *s)
-{
+void MPV_decode_defaults(MpegEncContext *s){
MPV_common_defaults(s);
}
@@ -454,14 +413,12 @@ av_cold int MPV_common_init(MpegEncContext *s)
else
s->mb_height = (s->height + 15) / 16;
- if(s->avctx->pix_fmt == PIX_FMT_NONE)
- {
+ if(s->avctx->pix_fmt == PIX_FMT_NONE){
av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supported.\n");
return -1;
}
- if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))
- {
+ if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){
av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
return -1;
}
@@ -472,62 +429,59 @@ av_cold int MPV_common_init(MpegEncContext *s)
dsputil_init(&s->dsp, s->avctx);
ff_dct_common_init(s);
- s->flags = s->avctx->flags;
- s->flags2 = s->avctx->flags2;
+ s->flags= s->avctx->flags;
+ s->flags2= s->avctx->flags2;
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;
+ 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));
+ 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->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;
+ 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;
/* convert fourcc to upper case */
- s->codec_tag = toupper(s->avctx->codec_tag & 0xFF)
- + (toupper((s->avctx->codec_tag >> 8) & 0xFF) << 8)
- + (toupper((s->avctx->codec_tag >> 16) & 0xFF) << 16)
- + (toupper((s->avctx->codec_tag >> 24) & 0xFF) << 24);
-
- s->stream_codec_tag = toupper(s->avctx->stream_codec_tag & 0xFF)
- + (toupper((s->avctx->stream_codec_tag >> 8) & 0xFF) << 8)
- + (toupper((s->avctx->stream_codec_tag >> 16) & 0xFF) << 16)
- + (toupper((s->avctx->stream_codec_tag >> 24) & 0xFF) << 24);
-
- 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->codec_tag= toupper( s->avctx->codec_tag &0xFF)
+ + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )
+ + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)
+ + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);
+
+ s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF)
+ + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )
+ + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)
+ + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);
+
+ 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->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed?
- if(s->encoding)
- {
+ 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)
@@ -538,13 +492,12 @@ av_cold int MPV_common_init(MpegEncContext *s)
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_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)*(MAX_RUN + 1) * 2 * sizeof(int), fail);
+ if(s->msmpeg4_version){
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail);
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
@@ -553,48 +506,41 @@ av_cold int MPV_common_init(MpegEncContext *s)
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 , 64 * 32 * sizeof(int), fail)
- FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail)
- FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64 * 32 * 2 * sizeof(uint16_t), 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 , 64*32 * sizeof(int), fail)
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t), fail)
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)
FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)
- if(s->avctx->noise_reduction)
- {
+ if(s->avctx->noise_reduction){
FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail)
}
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail)
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
+ for(i = 0; i < MAX_PICTURE_COUNT; i++) {
avcodec_get_frame_defaults((AVFrame *)&s->picture[i]);
}
- FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table, 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 == CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME))
- {
+ 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;
+ 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->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)
}
- 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)
- {
+ if (s->out_format == FMT_H263) {
/* ac values */
FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail);
s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;
@@ -603,22 +549,21 @@ av_cold int MPV_common_init(MpegEncContext *s)
/* 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;
+ 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)
- {
+ 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++)
+ for(i=0;i<yc_size;i++)
s->dc_val_base[i] = 1024;
}
@@ -627,39 +572,36 @@ av_cold int MPV_common_init(MpegEncContext *s)
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);
+ 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
FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, 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->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;
- s->thread_context[0] = s;
+ s->thread_context[0]= s;
threads = s->avctx->thread_count;
- for(i = 1; i < threads; i++)
- {
- s->thread_context[i] = av_malloc(sizeof(MpegEncContext));
+ for(i=1; i<threads; i++){
+ s->thread_context[i]= av_malloc(sizeof(MpegEncContext));
memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
}
- for(i = 0; i < threads; i++)
- {
+ for(i=0; i<threads; i++){
if(init_duplicate_context(s->thread_context[i], s) < 0)
- goto fail;
- s->thread_context[i]->start_mb_y = (s->mb_height * (i) + s->avctx->thread_count / 2) / s->avctx->thread_count;
- s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) + s->avctx->thread_count / 2) / s->avctx->thread_count;
+ goto fail;
+ s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->thread_count/2) / s->avctx->thread_count;
+ s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count;
}
return 0;
-fail:
+ fail:
MPV_common_end(s);
return -1;
}
@@ -669,17 +611,15 @@ void MPV_common_end(MpegEncContext *s)
{
int i, j, k;
- for(i = 0; i < s->avctx->thread_count; i++)
- {
+ for(i=0; i<s->avctx->thread_count; i++){
free_duplicate_context(s->thread_context[i]);
}
- for(i = 1; i < s->avctx->thread_count; i++)
- {
+ for(i=1; i<s->avctx->thread_count; i++){
av_freep(&s->thread_context[i]);
}
av_freep(&s->parse_context.buffer);
- s->parse_context.buffer_size = 0;
+ s->parse_context.buffer_size=0;
av_freep(&s->mb_type);
av_freep(&s->p_mv_table_base);
@@ -688,24 +628,21 @@ void MPV_common_end(MpegEncContext *s)
av_freep(&s->b_bidir_forw_mv_table_base);
av_freep(&s->b_bidir_back_mv_table_base);
av_freep(&s->b_direct_mv_table_base);
- s->p_mv_table = NULL;
- s->b_forw_mv_table = NULL;
- s->b_back_mv_table = NULL;
- s->b_bidir_forw_mv_table = NULL;
- s->b_bidir_back_mv_table = NULL;
- s->b_direct_mv_table = NULL;
- for(i = 0; i < 2; i++)
- {
- for(j = 0; j < 2; j++)
- {
- for(k = 0; k < 2; k++)
- {
+ s->p_mv_table= NULL;
+ s->b_forw_mv_table= NULL;
+ s->b_back_mv_table= NULL;
+ s->b_bidir_forw_mv_table= NULL;
+ s->b_bidir_back_mv_table= NULL;
+ s->b_direct_mv_table= NULL;
+ for(i=0; i<2; i++){
+ for(j=0; j<2; j++){
+ for(k=0; k<2; k++){
av_freep(&s->b_field_mv_table_base[i][j][k]);
- s->b_field_mv_table[i][j][k] = NULL;
+ s->b_field_mv_table[i][j][k]=NULL;
}
av_freep(&s->b_field_select_table[i][j]);
av_freep(&s->p_field_mv_table_base[i][j]);
- s->p_field_mv_table[i][j] = NULL;
+ s->p_field_mv_table[i][j]=NULL;
}
av_freep(&s->p_field_select_table[i]);
}
@@ -720,7 +657,7 @@ void MPV_common_end(MpegEncContext *s)
av_freep(&s->mbskip_table);
av_freep(&s->prev_pict_types);
av_freep(&s->bitstream_buffer);
- s->allocated_bitstream_buffer_size = 0;
+ s->allocated_bitstream_buffer_size=0;
av_freep(&s->avctx->stats_out);
av_freep(&s->ac_stats);
@@ -735,21 +672,19 @@ void MPV_common_end(MpegEncContext *s)
av_freep(&s->reordered_input_picture);
av_freep(&s->dct_offset);
- if(s->picture)
- {
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
+ if(s->picture){
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
free_picture(s, &s->picture[i]);
}
}
av_freep(&s->picture);
s->context_initialized = 0;
- s->last_picture_ptr =
- s->next_picture_ptr =
- s->current_picture_ptr = NULL;
- s->linesize = s->uvlinesize = 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++)
+ for(i=0; i<3; i++)
av_freep(&s->visualization_buffer[i]);
avcodec_default_free_buffers(s->avctx);
@@ -766,15 +701,11 @@ void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3])
return;
/* compute max_level[], max_run[] and index_run[] */
- for(last = 0; last < 2; last++)
- {
- if(last == 0)
- {
+ for(last=0;last<2;last++) {
+ if (last == 0) {
start = 0;
end = rl->last;
- }
- else
- {
+ } else {
start = rl->last;
end = rl->n;
}
@@ -782,15 +713,14 @@ void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3])
memset(max_level, 0, MAX_RUN + 1);
memset(max_run, 0, MAX_LEVEL + 1);
memset(index_run, rl->n, MAX_RUN + 1);
- for(i = start; i < end; i++)
- {
+ for(i=start;i<end;i++) {
run = rl->table_run[i];
level = rl->table_level[i];
- if(index_run[run] == rl->n)
+ if (index_run[run] == rl->n)
index_run[run] = i;
- if(level > max_level[run])
+ if (level > max_level[run])
max_level[run] = level;
- if(run > max_run[level])
+ if (run > max_run[level])
max_run[level] = run;
}
if(static_store)
@@ -815,73 +745,55 @@ void init_vlc_rl(RLTable *rl)
{
int i, q;
- for(q = 0; q < 32; q++)
- {
- int qmul = q * 2;
- int qadd = (q - 1) | 1;
+ for(q=0; q<32; q++){
+ int qmul= q*2;
+ int qadd= (q-1)|1;
- if(q == 0)
- {
- qmul = 1;
- qadd = 0;
+ if(q==0){
+ qmul=1;
+ qadd=0;
}
- for(i = 0; i < rl->vlc.table_size; i++)
- {
- int code = rl->vlc.table[i][0];
+ for(i=0; i<rl->vlc.table_size; i++){
+ int code= rl->vlc.table[i][0];
int len = rl->vlc.table[i][1];
int level, run;
- if(len == 0) // illegal code
- {
- run = 66;
- level = MAX_LEVEL;
- }
- else if(len < 0) //more bits needed
- {
- run = 0;
- level = code;
- }
- else
- {
- if(code == rl->n) //esc
- {
- run = 66;
- level = 0;
- }
- else
- {
- run = rl->table_run [code] + 1;
- level = rl->table_level[code] * qmul + qadd;
- if(code >= rl->last) run += 192;
+ if(len==0){ // illegal code
+ run= 66;
+ level= MAX_LEVEL;
+ }else if(len<0){ //more bits needed
+ run= 0;
+ level= code;
+ }else{
+ if(code==rl->n){ //esc
+ run= 66;
+ level= 0;
+ }else{
+ run= rl->table_run [code] + 1;
+ level= rl->table_level[code] * qmul + qadd;
+ if(code >= rl->last) run+=192;
}
}
- rl->rl_vlc[q][i].len = len;
- rl->rl_vlc[q][i].level = level;
- rl->rl_vlc[q][i].run = run;
+ rl->rl_vlc[q][i].len= len;
+ rl->rl_vlc[q][i].level= level;
+ rl->rl_vlc[q][i].run= run;
}
}
}
-int ff_find_unused_picture(MpegEncContext *s, int shared)
-{
+int ff_find_unused_picture(MpegEncContext *s, int shared){
int i;
- if(shared)
- {
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] == NULL && s->picture[i].type == 0) return i;
+ if(shared){
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i;
}
- }
- else
- {
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] == NULL && s->picture[i].type != 0) return i; //FIXME
+ }else{
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME
}
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] == NULL) return i;
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0]==NULL) return i;
}
}
@@ -901,24 +813,19 @@ int ff_find_unused_picture(MpegEncContext *s, int shared)
return -1;
}
-static void update_noise_reduction(MpegEncContext *s)
-{
+static void update_noise_reduction(MpegEncContext *s){
int intra, i;
- for(intra = 0; intra < 2; intra++)
- {
- if(s->dct_count[intra] > (1 << 16))
- {
- for(i = 0; i < 64; i++)
- {
- s->dct_error_sum[intra][i] >>= 1;
+ for(intra=0; intra<2; intra++){
+ if(s->dct_count[intra] > (1<<16)){
+ for(i=0; i<64; i++){
+ s->dct_error_sum[intra][i] >>=1;
}
s->dct_count[intra] >>= 1;
}
- for(i = 0; i < 64; i++)
- {
- s->dct_offset[intra][i] = (s->avctx->noise_reduction * s->dct_count[intra] + s->dct_error_sum[intra][i] / 2) / (s->dct_error_sum[intra][i] + 1);
+ for(i=0; i<64; i++){
+ s->dct_offset[intra][i]= (s->avctx->noise_reduction * s->dct_count[intra] + s->dct_error_sum[intra][i]/2) / (s->dct_error_sum[intra][i]+1);
}
}
}
@@ -932,104 +839,90 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
Picture *pic;
s->mb_skipped = 0;
- assert(s->last_picture_ptr == NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3);
+ assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3);
/* mark&release old frames */
- if(s->pict_type != FF_B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0])
- {
- if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3)
- {
- free_frame_buffer(s, s->last_picture_ptr);
-
- /* release forgotten pictures */
- /* if(mpeg124/h263) */
- if(!s->encoding)
- {
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference)
- {
- av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
- free_frame_buffer(s, &s->picture[i]);
- }
+ if (s->pict_type != FF_B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) {
+ if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){
+ free_frame_buffer(s, s->last_picture_ptr);
+
+ /* release forgotten pictures */
+ /* if(mpeg124/h263) */
+ if(!s->encoding){
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){
+ av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
+ free_frame_buffer(s, &s->picture[i]);
}
}
}
+ }
}
- if(!s->encoding)
- {
+ if(!s->encoding){
/* release non reference frames */
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/)
- {
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
free_frame_buffer(s, &s->picture[i]);
}
}
- if(s->current_picture_ptr && s->current_picture_ptr->data[0] == NULL)
- pic = s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header)
- else
- {
- i = ff_find_unused_picture(s, 0);
- pic = &s->picture[i];
+ if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL)
+ pic= s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header)
+ else{
+ i= ff_find_unused_picture(s, 0);
+ pic= &s->picture[i];
}
- pic->reference = 0;
- if(!s->dropable)
- {
- if(s->codec_id == CODEC_ID_H264)
+ pic->reference= 0;
+ if (!s->dropable){
+ if (s->codec_id == CODEC_ID_H264)
pic->reference = s->picture_structure;
- else if(s->pict_type != FF_B_TYPE)
+ else if (s->pict_type != FF_B_TYPE)
pic->reference = 3;
}
- pic->coded_picture_number = s->coded_picture_number++;
+ pic->coded_picture_number= s->coded_picture_number++;
if(ff_alloc_picture(s, pic, 0) < 0)
return -1;
- s->current_picture_ptr = pic;
- s->current_picture_ptr->top_field_first = s->top_field_first; //FIXME use only the vars from current_pic
- s->current_picture_ptr->interlaced_frame = !s->progressive_frame && !s->progressive_sequence;
+ s->current_picture_ptr= pic;
+ s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic
+ s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence;
}
- s->current_picture_ptr->pict_type = s->pict_type;
+ s->current_picture_ptr->pict_type= s->pict_type;
// if(s->flags && CODEC_FLAG_QSCALE)
- // s->current_picture_ptr->quality= s->new_picture_ptr->quality;
- s->current_picture_ptr->key_frame = s->pict_type == FF_I_TYPE;
+ // s->current_picture_ptr->quality= s->new_picture_ptr->quality;
+ s->current_picture_ptr->key_frame= s->pict_type == FF_I_TYPE;
ff_copy_picture(&s->current_picture, s->current_picture_ptr);
- if(s->pict_type != FF_B_TYPE)
- {
- s->last_picture_ptr = s->next_picture_ptr;
+ if (s->pict_type != FF_B_TYPE) {
+ s->last_picture_ptr= s->next_picture_ptr;
if(!s->dropable)
- s->next_picture_ptr = s->current_picture_ptr;
+ 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->data[0] : NULL,
- s->next_picture_ptr ? s->next_picture_ptr->data[0] : NULL,
- s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL,
- s->pict_type, s->dropable);*/
+/* 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->data[0] : NULL,
+ s->next_picture_ptr ? s->next_picture_ptr->data[0] : NULL,
+ s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL,
+ s->pict_type, s->dropable);*/
- if(s->codec_id != CODEC_ID_H264)
- {
- if((s->last_picture_ptr == NULL || s->last_picture_ptr->data[0] == NULL) && s->pict_type != FF_I_TYPE)
- {
+ if(s->codec_id != CODEC_ID_H264){
+ if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && s->pict_type!=FF_I_TYPE){
av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
/* Allocate a dummy frame */
- i = ff_find_unused_picture(s, 0);
- s->last_picture_ptr = &s->picture[i];
+ i= ff_find_unused_picture(s, 0);
+ s->last_picture_ptr= &s->picture[i];
if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
return -1;
}
- if((s->next_picture_ptr == NULL || s->next_picture_ptr->data[0] == NULL) && s->pict_type == FF_B_TYPE)
- {
+ if((s->next_picture_ptr==NULL || s->next_picture_ptr->data[0]==NULL) && s->pict_type==FF_B_TYPE){
/* Allocate a dummy frame */
- i = ff_find_unused_picture(s, 0);
- s->next_picture_ptr = &s->picture[i];
+ i= ff_find_unused_picture(s, 0);
+ s->next_picture_ptr= &s->picture[i];
if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)
return -1;
}
@@ -1040,44 +933,35 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
assert(s->pict_type == FF_I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0]));
- if(s->picture_structure != PICT_FRAME && s->out_format != FMT_H264)
- {
+ if(s->picture_structure!=PICT_FRAME && s->out_format != FMT_H264){
int i;
- for(i = 0; i < 4; i++)
- {
- if(s->picture_structure == PICT_BOTTOM_FIELD)
- {
- s->current_picture.data[i] += s->current_picture.linesize[i];
+ for(i=0; i<4; i++){
+ if(s->picture_structure == PICT_BOTTOM_FIELD){
+ s->current_picture.data[i] += s->current_picture.linesize[i];
}
s->current_picture.linesize[i] *= 2;
- s->last_picture.linesize[i] *= 2;
- s->next_picture.linesize[i] *= 2;
+ s->last_picture.linesize[i] *=2;
+ s->next_picture.linesize[i] *=2;
}
}
- s->hurry_up = s->avctx->hurry_up;
- s->error_recognition = avctx->error_recognition;
+ s->hurry_up= s->avctx->hurry_up;
+ s->error_recognition= avctx->error_recognition;
/* 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 == 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)
- {
+ }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){
s->dct_unquantize_intra = s->dct_unquantize_h263_intra;
s->dct_unquantize_inter = s->dct_unquantize_h263_inter;
- }
- else
- {
+ }else{
s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter;
}
- if(s->dct_error_sum)
- {
+ if(s->dct_error_sum){
assert(s->avctx->noise_reduction && s->encoding);
update_noise_reduction(s);
@@ -1096,40 +980,33 @@ void MPV_frame_end(MpegEncContext *s)
&& s->unrestricted_mv
&& s->current_picture.reference
&& !s->intra_only
- && !(s->flags & CODEC_FLAG_EMU_EDGE))
- {
- s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , s->v_edge_pos , EDGE_WIDTH);
- s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos >> 1, s->v_edge_pos >> 1, EDGE_WIDTH / 2);
- s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos >> 1, s->v_edge_pos >> 1, EDGE_WIDTH / 2);
+ && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
+ s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , s->v_edge_pos , EDGE_WIDTH );
+ s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
+ s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
}
emms_c();
s->last_pict_type = s->pict_type;
- s->last_lambda_for[s->pict_type] = s->current_picture_ptr->quality;
- if(s->pict_type != FF_B_TYPE)
- {
- s->last_non_b_pict_type = s->pict_type;
+ s->last_lambda_for[s->pict_type]= s->current_picture_ptr->quality;
+ if(s->pict_type!=FF_B_TYPE){
+ s->last_non_b_pict_type= s->pict_type;
}
#if 0
- /* copy back current_picture variables */
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] == s->current_picture.data[0])
- {
- s->picture[i] = s->current_picture;
+ /* copy back current_picture variables */
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] == s->current_picture.data[0]){
+ s->picture[i]= s->current_picture;
break;
}
}
- assert(i < MAX_PICTURE_COUNT);
+ assert(i<MAX_PICTURE_COUNT);
#endif
- if(s->encoding)
- {
+ if(s->encoding){
/* release non-reference frames */
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/)
- {
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
free_frame_buffer(s, &s->picture[i]);
}
}
@@ -1140,71 +1017,67 @@ 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= (AVFrame*)s->current_picture_ptr;
}
/**
* prints debuging info for the given picture.
*/
-void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
-{
+void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
if(!pict || !pict->mb_type) return;
- if(s->avctx->debug_mv && pict->motion_val)
- {
- pict->mb_height = s->mb_height;
- pict->mb_width = s->mb_width;
- pict->mb_stride = s->mb_stride;
- pict->b8_stride = s->b8_stride;
+ if (s->avctx->debug_mv && pict->motion_val) {
+ pict->mb_height=s->mb_height;
+ pict->mb_width=s->mb_width;
+ pict->mb_stride=s->mb_stride;
+ pict->b8_stride=s->b8_stride;
}
- if(pict)
+ if (pict)
{
- pict->play_flags = (s->quarter_sample ? CODEC_FLAG_QPEL : 0);
- pict->num_sprite_warping_points = s->num_sprite_warping_points;
- pict->real_sprite_warping_points = s->real_sprite_warping_points;
+ pict->play_flags=(s->quarter_sample?CODEC_FLAG_QPEL:0);
+ pict->num_sprite_warping_points=s->num_sprite_warping_points;
+ pict->real_sprite_warping_points=s->real_sprite_warping_points;
}
}
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)
+ 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;
+ 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;
+ 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);
+ 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 > h_edge_pos - (!!sx) - w
- || (unsigned)src_y > (v_edge_pos >> field_based) - (!!sy) - h)
- {
- ff_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;
+ if( (unsigned)src_x > h_edge_pos - (!!sx) - w
+ || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
+ ff_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;
+ sx= (sx << 2) >> lowres;
+ sy= (sy << 2) >> lowres;
if(field_select)
src += s->linesize;
pix_op[op_index](dest, src, stride, h, sx, sy);
@@ -1213,108 +1086,96 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
/* 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 *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 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.linesize[0] << field_based;
uvlinesize = s->current_picture.linesize[1] << field_based;
- if(s->quarter_sample) //FIXME obviously not perfect but qpel will not work in lowres anyway
- {
- motion_x /= 2;
- motion_y /= 2;
+ if(s->quarter_sample){ //FIXME obviously not perfect but qpel will not work in lowres anyway
+ motion_x/=2;
+ motion_y/=2;
}
- if(field_based)
- {
- motion_y += (bottom_field - field_select) * ((1 << lowres) - 1);
+ 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));
+ 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
- {
+ 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
- {
+ 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));
+ 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 > h_edge_pos - (!!sx) - 2 * block_s
- || (unsigned)src_y > (v_edge_pos >> field_based) - (!!sy) - h)
- {
- ff_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;
- ff_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);
- ff_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;
- }
+ if( (unsigned)src_x > h_edge_pos - (!!sx) - 2*block_s
+ || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
+ ff_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;
+ ff_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);
+ ff_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;
+ }
}
- if(bottom_field) //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
- {
+ 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;
+ dest_cb+= s->uvlinesize;
+ dest_cr+= s->uvlinesize;
}
- if(field_select)
- {
+ if(field_select){
ptr_y += s->linesize;
- ptr_cb += s->uvlinesize;
- ptr_cr += s->uvlinesize;
+ ptr_cb+= s->uvlinesize;
+ ptr_cr+= s->uvlinesize;
}
- sx = (sx << 2) >> lowres;
- sy = (sy << 2) >> lowres;
+ 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;
+ 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);
}
@@ -1322,57 +1183,52 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
}
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 *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;
+ 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);
+ 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));
+ 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 > h_edge_pos - (!!sx) - block_s
- || (unsigned)src_y > v_edge_pos - (!!sy) - block_s)
- {
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x > h_edge_pos - (!!sx) - block_s
+ || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){
ff_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;
+ ptr= s->edge_emu_buffer;
+ emu=1;
}
}
- sx = (sx << 2) >> lowres;
- sy = (sy << 2) >> lowres;
+ 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)
- {
+ if(emu){
ff_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;
+ ptr= s->edge_emu_buffer;
}
pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
}
@@ -1389,135 +1245,117 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
* 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)
+ 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;
+ 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)
- {
+ 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);
+ 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];
- }
+ 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))
+ 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)
- {
+ 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);
+ 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 != FF_B_TYPE && !s->first_field)
- {
- ref_picture = s->current_picture_ptr->data;
+ 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 != FF_B_TYPE && !s->first_field){
+ ref_picture= s->current_picture_ptr->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);
+ 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++)
- {
+ for(i=0; i<2; i++){
uint8_t ** ref2picture;
- if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == FF_B_TYPE || s->first_field)
- {
- ref2picture = ref_picture;
- }
- else
- {
- ref2picture = s->current_picture_ptr->data;
+ if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == FF_B_TYPE || s->first_field){
+ ref2picture= ref_picture;
+ }else{
+ ref2picture= s->current_picture_ptr->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);
+ 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;
+ 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++)
- {
+ if(s->picture_structure == PICT_FRAME){
+ for(i=0; i<2; i++){
int j;
- for(j = 0; j < 2; 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);
+ 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++)
- {
+ }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);
+ 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)
- {
+ if(!s->first_field){
ref_picture = s->current_picture_ptr->data;
}
}
}
- break;
- default:
- assert(0);
+ break;
+ default: assert(0);
}
}
@@ -1526,27 +1364,25 @@ static inline void put_dct(MpegEncContext *s,
DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
{
s->dct_unquantize_intra(s, block, i, qscale);
- s->dsp.idct_put(dest, line_size, block);
+ s->dsp.idct_put (dest, line_size, block);
}
/* add block[] to dest[] */
static inline void add_dct(MpegEncContext *s,
DCTELEM *block, int i, uint8_t *dest, int line_size)
{
- if(s->block_last_index[i] >= 0)
- {
- s->dsp.idct_add(dest, line_size, block);
+ if (s->block_last_index[i] >= 0) {
+ s->dsp.idct_add (dest, line_size, block);
}
}
static inline void add_dequant_dct(MpegEncContext *s,
- DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
+ DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
{
- if(s->block_last_index[i] >= 0)
- {
+ if (s->block_last_index[i] >= 0) {
s->dct_unquantize_inter(s, block, i, qscale);
- s->dsp.idct_add(dest, line_size, block);
+ s->dsp.idct_add (dest, line_size, block);
}
}
@@ -1559,29 +1395,28 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
int xy = s->block_index[0];
s->dc_val[0][xy ] =
- s->dc_val[0][xy + 1 ] =
- s->dc_val[0][xy + wrap] =
- s->dc_val[0][xy + 1 + wrap] = 1024;
+ s->dc_val[0][xy + 1 ] =
+ s->dc_val[0][xy + wrap] =
+ s->dc_val[0][xy + 1 + wrap] = 1024;
/* ac pred */
memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t));
memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t));
- if(s->msmpeg4_version >= 3)
- {
+ if (s->msmpeg4_version>=3) {
s->coded_block[xy ] =
- s->coded_block[xy + 1 ] =
- s->coded_block[xy + wrap] =
- s->coded_block[xy + 1 + wrap] = 0;
+ s->coded_block[xy + 1 ] =
+ s->coded_block[xy + wrap] =
+ s->coded_block[xy + 1 + wrap] = 0;
}
/* chroma */
wrap = s->mb_stride;
xy = s->mb_x + s->mb_y * wrap;
s->dc_val[1][xy] =
- s->dc_val[2][xy] = 1024;
+ s->dc_val[2][xy] = 1024;
/* ac pred */
memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t));
memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t));
- s->mbintra_table[xy] = 0;
+ s->mbintra_table[xy]= 0;
}
/* generic function called after a macroblock has been parsed by the
@@ -1600,271 +1435,215 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
{
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
- if(s->avctx->debug & FF_DEBUG_DCT_COEFF)
- {
- /* save DCT coefficients */
- int i, j;
- DCTELEM *dct = &s->current_picture.dct_coeff[mb_xy*64*6];
- for(i = 0; i < 6; i++)
- for(j = 0; j < 64; j++)
- *dct++ = block[i][s->dsp.idct_permutation[j]];
+ if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
+ /* save DCT coefficients */
+ int i,j;
+ DCTELEM *dct = &s->current_picture.dct_coeff[mb_xy*64*6];
+ for(i=0; i<6; i++)
+ for(j=0; j<64; j++)
+ *dct++ = block[i][s->dsp.idct_permutation[j]];
}
- s->current_picture.qscale_table[mb_xy] = s->qscale;
+ s->current_picture.qscale_table[mb_xy]= s->qscale;
/* update DC predictors for P macroblocks */
- if(!s->mb_intra)
- {
- if(!is_mpeg12 && (s->h263_pred || s->h263_aic))
- {
+ if (!s->mb_intra) {
+ if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) {
if(s->mbintra_table[mb_xy])
ff_clean_intra_table_entries(s);
- }
- else
- {
+ } else {
s->last_dc[0] =
- s->last_dc[1] =
- s->last_dc[2] = 128 << s->intra_dc_precision;
+ s->last_dc[1] =
+ s->last_dc[2] = 128 << s->intra_dc_precision;
}
}
- else if(!is_mpeg12 && (s->h263_pred || s->h263_aic))
- s->mbintra_table[mb_xy] = 1;
+ else if (!is_mpeg12 && (s->h263_pred || s->h263_aic))
+ s->mbintra_table[mb_xy]=1;
- if((s->flags & CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type == FF_B_TYPE) && s->avctx->mb_decision != FF_MB_DECISION_RD)) //FIXME precalc
- {
+ if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==FF_B_TYPE) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc
uint8_t *dest_y, *dest_cb, *dest_cr;
int dct_linesize, dct_offset;
- op_pixels_func(*op_pix)[4];
- qpel_mc_func(*op_qpix)[16];
- const int linesize = s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
- const int uvlinesize = s->current_picture.linesize[1];
- const int readable = s->pict_type != FF_B_TYPE || s->encoding || s->avctx->draw_horiz_band || lowres_flag;
- const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8;
+ op_pixels_func (*op_pix)[4];
+ qpel_mc_func (*op_qpix)[16];
+ const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
+ const int uvlinesize= s->current_picture.linesize[1];
+ const int readable= s->pict_type != FF_B_TYPE || s->encoding || s->avctx->draw_horiz_band || lowres_flag;
+ const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8;
/* avoid copy if macroblock skipped in last frame too */
/* skip only during decoding as we might trash the buffers during encoding a bit */
- if(!s->encoding)
- {
+ if(!s->encoding){
uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
- const int age = s->current_picture.age;
+ const int age= s->current_picture.age;
assert(age);
- if(s->mb_skipped)
- {
- s->mb_skipped = 0;
- assert(s->pict_type != FF_I_TYPE);
+ if (s->mb_skipped) {
+ s->mb_skipped= 0;
+ assert(s->pict_type!=FF_I_TYPE);
(*mbskip_ptr) ++; /* indicate that this time we skipped it */
- if(*mbskip_ptr > 99) *mbskip_ptr = 99;
+ if(*mbskip_ptr >99) *mbskip_ptr= 99;
/* if previous was skipped too, then nothing to do ! */
- if(*mbskip_ptr >= age && s->current_picture.reference)
- {
+ if (*mbskip_ptr >= age && s->current_picture.reference){
return;
}
- }
- else if(!s->current_picture.reference)
- {
+ } else if(!s->current_picture.reference){
(*mbskip_ptr) ++; /* increase counter so the age can be compared cleanly */
- if(*mbskip_ptr > 99) *mbskip_ptr = 99;
- }
- else
- {
+ if(*mbskip_ptr >99) *mbskip_ptr= 99;
+ } else{
*mbskip_ptr = 0; /* not skipped */
}
}
dct_linesize = linesize << s->interlaced_dct;
- dct_offset = (s->interlaced_dct) ? linesize : linesize * block_size;
+ dct_offset =(s->interlaced_dct)? linesize : linesize*block_size;
- if(readable)
- {
- dest_y = s->dest[0];
- dest_cb = s->dest[1];
- dest_cr = s->dest[2];
- }
- else
- {
+ if(readable){
+ dest_y= s->dest[0];
+ dest_cb= s->dest[1];
+ dest_cr= s->dest[2];
+ }else{
dest_y = s->b_scratchpad;
- dest_cb = s->b_scratchpad + 16 * linesize;
- dest_cr = s->b_scratchpad + 32 * linesize;
+ dest_cb= s->b_scratchpad+16*linesize;
+ dest_cr= s->b_scratchpad+32*linesize;
}
- if(!s->mb_intra)
- {
+ if (!s->mb_intra) {
/* motion handling */
/* decoding or more than one mb_type (MC was already done otherwise) */
- if(!s->encoding)
- {
- if(lowres_flag)
- {
+ if(!s->encoding){
+ if(lowres_flag){
h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab;
- if(s->mv_dir & MV_DIR_FORWARD)
- {
+ if (s->mv_dir & MV_DIR_FORWARD) {
MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix);
op_pix = s->dsp.avg_h264_chroma_pixels_tab;
}
- if(s->mv_dir & MV_DIR_BACKWARD)
- {
+ if (s->mv_dir & MV_DIR_BACKWARD) {
MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix);
}
- }
- else
- {
- op_qpix = s->me.qpel_put;
- if((!s->no_rounding) || s->pict_type == FF_B_TYPE)
- {
+ }else{
+ op_qpix= s->me.qpel_put;
+ if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
op_pix = s->dsp.put_pixels_tab;
- }
- else
- {
+ }else{
op_pix = s->dsp.put_no_rnd_pixels_tab;
}
- if(s->mv_dir & MV_DIR_FORWARD)
- {
+ if (s->mv_dir & MV_DIR_FORWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
op_pix = s->dsp.avg_pixels_tab;
- op_qpix = s->me.qpel_avg;
+ op_qpix= s->me.qpel_avg;
}
- if(s->mv_dir & MV_DIR_BACKWARD)
- {
+ if (s->mv_dir & MV_DIR_BACKWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
}
}
}
/* skip dequant / idct if we are really late ;) */
- if(s->hurry_up > 1) goto skip_idct;
- if(s->avctx->skip_idct)
- {
- if((s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
- || (s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
+ if(s->hurry_up>1) goto skip_idct;
+ if(s->avctx->skip_idct){
+ if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
+ ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
|| s->avctx->skip_idct >= AVDISCARD_ALL)
goto skip_idct;
}
/* add dct residue */
- if(s->encoding || !(s->h263_msmpeg4 || 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->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
+ || (s->codec_id==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);
add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
- if(!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- if(s->chroma_y_shift)
- {
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ if (s->chroma_y_shift){
add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
- }
- else
- {
+ }else{
dct_linesize >>= 1;
- dct_offset >>= 1;
+ dct_offset >>=1;
add_dequant_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale);
add_dequant_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale);
add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
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 != 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);
add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
- if(!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- if(s->chroma_y_shift) //Chroma420
- {
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ if(s->chroma_y_shift){//Chroma420
add_dct(s, block[4], 4, dest_cb, uvlinesize);
add_dct(s, block[5], 5, dest_cr, uvlinesize);
- }
- else
- {
+ }else{
//chroma422
dct_linesize = uvlinesize << s->interlaced_dct;
- dct_offset = (s->interlaced_dct) ? uvlinesize : uvlinesize * 8;
+ dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;
add_dct(s, block[4], 4, dest_cb, dct_linesize);
add_dct(s, block[5], 5, dest_cr, dct_linesize);
- add_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize);
- add_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize);
- if(!s->chroma_x_shift) //Chroma444
- {
- add_dct(s, block[8], 8, dest_cb + 8, dct_linesize);
- add_dct(s, block[9], 9, dest_cr + 8, dct_linesize);
- add_dct(s, block[10], 10, dest_cb + 8 + dct_offset, dct_linesize);
- add_dct(s, block[11], 11, dest_cr + 8 + dct_offset, dct_linesize);
+ add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
+ add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
+ if(!s->chroma_x_shift){//Chroma444
+ add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
+ add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
+ add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
+ add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
}
}
}//fi gray
}
- else if(CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER)
- {
+ else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {
ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
}
- }
- else
- {
+ } 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==CODEC_ID_MPEG1VIDEO || s->codec_id==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);
put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
- if(!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- if(s->chroma_y_shift)
- {
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ if(s->chroma_y_shift){
put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
- }
- else
- {
- dct_offset >>= 1;
- dct_linesize >>= 1;
+ }else{
+ dct_offset >>=1;
+ dct_linesize >>=1;
put_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale);
put_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale);
put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
}
}
- }
- else
- {
+ }else{
s->dsp.idct_put(dest_y , dct_linesize, block[0]);
s->dsp.idct_put(dest_y + block_size, dct_linesize, block[1]);
s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]);
s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
- if(!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
- if(s->chroma_y_shift)
- {
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ if(s->chroma_y_shift){
s->dsp.idct_put(dest_cb, uvlinesize, block[4]);
s->dsp.idct_put(dest_cr, uvlinesize, block[5]);
- }
- else
- {
+ }else{
dct_linesize = uvlinesize << s->interlaced_dct;
- dct_offset = (s->interlaced_dct) ? uvlinesize : uvlinesize * 8;
+ dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;
s->dsp.idct_put(dest_cb, dct_linesize, block[4]);
s->dsp.idct_put(dest_cr, dct_linesize, block[5]);
s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
- if(!s->chroma_x_shift) //Chroma444
- {
+ if(!s->chroma_x_shift){//Chroma444
s->dsp.idct_put(dest_cb + 8, dct_linesize, block[8]);
s->dsp.idct_put(dest_cr + 8, dct_linesize, block[9]);
s->dsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
@@ -1875,70 +1654,60 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
}
}
skip_idct:
- if(!readable)
- {
- s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize, 16);
- s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize, 16 >> s->chroma_y_shift);
- s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize, 16 >> s->chroma_y_shift);
+ if(!readable){
+ s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16);
+ s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift);
+ s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift);
}
}
}
-void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
-{
+void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
#if !CONFIG_SMALL
- if(s->out_format == FMT_MPEG1)
- {
+ 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);
- }
- else
+ } else
#endif
- if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0);
- else MPV_decode_mb_internal(s, block, 0, 0);
+ if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0);
+ else MPV_decode_mb_internal(s, block, 0, 0);
}
/**
*
* @param h is the normal height, this will be reduced automatically if needed for the last row
*/
-void ff_draw_horiz_band(MpegEncContext *s, int y, int h)
-{
- if(s->avctx->draw_horiz_band)
- {
+void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
+ if (s->avctx->draw_horiz_band) {
AVFrame *src;
- const int field_pic = s->picture_structure != PICT_FRAME;
+ const int field_pic= s->picture_structure != PICT_FRAME;
int offset[4];
- h = FFMIN(h, (s->avctx->height >> field_pic) - y);
+ h= FFMIN(h, (s->avctx->height>>field_pic) - y);
- if(field_pic && !(s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD))
- {
+ if(field_pic && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)){
h <<= 1;
y <<= 1;
if(s->first_field) return;
}
- if(s->pict_type == FF_B_TYPE || s->low_delay || (s->avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
- src = (AVFrame*)s->current_picture_ptr;
+ if(s->pict_type==FF_B_TYPE || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
+ src= (AVFrame*)s->current_picture_ptr;
else if(s->last_picture_ptr)
- src = (AVFrame*)s->last_picture_ptr;
+ src= (AVFrame*)s->last_picture_ptr;
else
return;
- if(s->pict_type == FF_B_TYPE && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264)
- {
- offset[0] =
- offset[1] =
- offset[2] =
- offset[3] = 0;
- }
- else
- {
- offset[0] = y * s->linesize;
- offset[1] =
- offset[2] = (y >> s->chroma_y_shift) * s->uvlinesize;
- offset[3] = 0;
+ if(s->pict_type==FF_B_TYPE && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){
+ offset[0]=
+ offset[1]=
+ offset[2]=
+ offset[3]= 0;
+ }else{
+ offset[0]= y * s->linesize;
+ offset[1]=
+ offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;
+ offset[3]= 0;
}
emms_c();
@@ -1948,100 +1717,89 @@ 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.linesize[0]; //not s->linesize as this would be wrong for field pics
- const int uvlinesize = s->current_picture.linesize[1];
- const int mb_size = 4 - s->avctx->lowres;
-
- 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;
- s->block_index[2] = s->b8_stride * (s->mb_y * 2 + 1) - 2 + s->mb_x * 2;
- s->block_index[3] = s->b8_stride * (s->mb_y * 2 + 1) - 1 + s->mb_x * 2;
- s->block_index[4] = s->mb_stride * (s->mb_y + 1) + s->b8_stride * s->mb_height * 2 + s->mb_x - 1;
- s->block_index[5] = s->mb_stride * (s->mb_y + s->mb_height + 2) + s->b8_stride * s->mb_height * 2 + s->mb_x - 1;
+void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
+ const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
+ const int uvlinesize= s->current_picture.linesize[1];
+ const int mb_size= 4 - s->avctx->lowres;
+
+ 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;
+ s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;
+ s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
+ s->block_index[4]= s->mb_stride*(s->mb_y + 1) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
+ s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
//block_index is not used by mpeg2, so it is not affected by chroma_format
s->dest[0] = s->current_picture.data[0] + ((s->mb_x - 1) << mb_size);
s->dest[1] = s->current_picture.data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
s->dest[2] = s->current_picture.data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
- if(!(s->pict_type == FF_B_TYPE && s->avctx->draw_horiz_band && s->picture_structure == PICT_FRAME))
- {
- if(s->picture_structure == PICT_FRAME)
- {
- s->dest[0] += s->mb_y * linesize << mb_size;
- s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
- s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
- }
- else
- {
- s->dest[0] += (s->mb_y >> 1) * linesize << mb_size;
- s->dest[1] += (s->mb_y >> 1) * uvlinesize << (mb_size - s->chroma_y_shift);
- s->dest[2] += (s->mb_y >> 1) * uvlinesize << (mb_size - s->chroma_y_shift);
- assert((s->mb_y & 1) == (s->picture_structure == PICT_BOTTOM_FIELD));
+ if(!(s->pict_type==FF_B_TYPE && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME))
+ {
+ if(s->picture_structure==PICT_FRAME){
+ s->dest[0] += s->mb_y * linesize << mb_size;
+ s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
+ s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
+ }else{
+ s->dest[0] += (s->mb_y>>1) * linesize << mb_size;
+ s->dest[1] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);
+ s->dest[2] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);
+ assert((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD));
}
}
}
-void ff_mpeg_flush(AVCodecContext *avctx)
-{
+void ff_mpeg_flush(AVCodecContext *avctx){
int i;
MpegEncContext *s = avctx->priv_data;
- if(s == NULL || s->picture == NULL)
+ if(s==NULL || s->picture==NULL)
return;
- for(i = 0; i < MAX_PICTURE_COUNT; i++)
- {
- if(s->picture[i].data[0] && (s->picture[i].type == FF_BUFFER_TYPE_INTERNAL
- || s->picture[i].type == FF_BUFFER_TYPE_USER))
- free_frame_buffer(s, &s->picture[i]);
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && ( s->picture[i].type == FF_BUFFER_TYPE_INTERNAL
+ || s->picture[i].type == FF_BUFFER_TYPE_USER))
+ free_frame_buffer(s, &s->picture[i]);
}
s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL;
- s->mb_x = s->mb_y = 0;
- s->closed_gop = 0;
-
- s->parse_context.state = -1;
- s->parse_context.frame_start_found = 0;
- s->parse_context.overread = 0;
- s->parse_context.overread_index = 0;
- s->parse_context.index = 0;
- s->parse_context.last_index = 0;
- s->bitstream_buffer_size = 0;
- s->pp_time = 0;
+ s->mb_x= s->mb_y= 0;
+ s->closed_gop= 0;
+
+ s->parse_context.state= -1;
+ s->parse_context.frame_start_found= 0;
+ s->parse_context.overread= 0;
+ s->parse_context.overread_index= 0;
+ s->parse_context.index= 0;
+ s->parse_context.last_index= 0;
+ s->bitstream_buffer_size=0;
+ s->pp_time=0;
}
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
- nCoeffs = s->block_last_index[n];
+ nCoeffs= s->block_last_index[n];
- if(n < 4)
+ if (n < 4)
block[0] = block[0] * s->y_dc_scale;
else
block[0] = block[0] * s->c_dc_scale;
/* XXX: only mpeg1 */
quant_matrix = s->intra_matrix;
- for(i = 1; i <= nCoeffs; i++)
- {
- int j = s->intra_scantable.permutated[i];
+ for(i=1;i<=nCoeffs;i++) {
+ int j= s->intra_scantable.permutated[i];
level = block[j];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = -level;
level = (int)(level * qscale * quant_matrix[j]) >> 3;
level = (level - 1) | 1;
level = -level;
- }
- else
- {
+ } else {
level = (int)(level * qscale * quant_matrix[j]) >> 3;
level = (level - 1) | 1;
}
@@ -2051,32 +1809,27 @@ static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
}
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
- nCoeffs = s->block_last_index[n];
+ nCoeffs= s->block_last_index[n];
quant_matrix = s->inter_matrix;
- for(i = 0; i <= nCoeffs; i++)
- {
- int j = s->intra_scantable.permutated[i];
+ for(i=0; i<=nCoeffs; i++) {
+ int j= s->intra_scantable.permutated[i];
level = block[j];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = -level;
level = (((level << 1) + 1) * qscale *
- ((int)(quant_matrix[j]))) >> 4;
+ ((int) (quant_matrix[j]))) >> 4;
level = (level - 1) | 1;
level = -level;
- }
- else
- {
+ } else {
level = (((level << 1) + 1) * qscale *
- ((int)(quant_matrix[j]))) >> 4;
+ ((int) (quant_matrix[j]))) >> 4;
level = (level - 1) | 1;
}
block[j] = level;
@@ -2085,33 +1838,28 @@ static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
}
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
- if(s->alternate_scan) nCoeffs = 63;
- else nCoeffs = s->block_last_index[n];
+ if(s->alternate_scan) nCoeffs= 63;
+ else nCoeffs= s->block_last_index[n];
- if(n < 4)
+ if (n < 4)
block[0] = block[0] * s->y_dc_scale;
else
block[0] = block[0] * s->c_dc_scale;
quant_matrix = s->intra_matrix;
- for(i = 1; i <= nCoeffs; i++)
- {
- int j = s->intra_scantable.permutated[i];
+ for(i=1;i<=nCoeffs;i++) {
+ int j= s->intra_scantable.permutated[i];
level = block[j];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = -level;
level = (int)(level * qscale * quant_matrix[j]) >> 3;
level = -level;
- }
- else
- {
+ } else {
level = (int)(level * qscale * quant_matrix[j]) >> 3;
}
block[j] = level;
@@ -2120,117 +1868,99 @@ static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
}
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
- int sum = -1;
+ int sum=-1;
- if(s->alternate_scan) nCoeffs = 63;
- else nCoeffs = s->block_last_index[n];
+ if(s->alternate_scan) nCoeffs= 63;
+ else nCoeffs= s->block_last_index[n];
- if(n < 4)
+ if (n < 4)
block[0] = block[0] * s->y_dc_scale;
else
block[0] = block[0] * s->c_dc_scale;
quant_matrix = s->intra_matrix;
- for(i = 1; i <= nCoeffs; i++)
- {
- int j = s->intra_scantable.permutated[i];
+ for(i=1;i<=nCoeffs;i++) {
+ int j= s->intra_scantable.permutated[i];
level = block[j];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = -level;
level = (int)(level * qscale * quant_matrix[j]) >> 3;
level = -level;
- }
- else
- {
+ } else {
level = (int)(level * qscale * quant_matrix[j]) >> 3;
}
block[j] = level;
- sum += level;
+ sum+=level;
}
}
- block[63] ^= sum & 1;
+ block[63]^=sum&1;
}
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
- int sum = -1;
+ int sum=-1;
- if(s->alternate_scan) nCoeffs = 63;
- else nCoeffs = s->block_last_index[n];
+ if(s->alternate_scan) nCoeffs= 63;
+ else nCoeffs= s->block_last_index[n];
quant_matrix = s->inter_matrix;
- for(i = 0; i <= nCoeffs; i++)
- {
- int j = s->intra_scantable.permutated[i];
+ for(i=0; i<=nCoeffs; i++) {
+ int j= s->intra_scantable.permutated[i];
level = block[j];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = -level;
level = (((level << 1) + 1) * qscale *
- ((int)(quant_matrix[j]))) >> 4;
+ ((int) (quant_matrix[j]))) >> 4;
level = -level;
- }
- else
- {
+ } else {
level = (((level << 1) + 1) * qscale *
- ((int)(quant_matrix[j]))) >> 4;
+ ((int) (quant_matrix[j]))) >> 4;
}
block[j] = level;
- sum += level;
+ sum+=level;
}
}
- block[63] ^= sum & 1;
+ block[63]^=sum&1;
}
static void dct_unquantize_h263_intra_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, qmul, qadd;
int nCoeffs;
- assert(s->block_last_index[n] >= 0);
+ assert(s->block_last_index[n]>=0);
qmul = qscale << 1;
- if(!s->h263_aic)
- {
- if(n < 4)
+ if (!s->h263_aic) {
+ if (n < 4)
block[0] = block[0] * s->y_dc_scale;
else
block[0] = block[0] * s->c_dc_scale;
qadd = (qscale - 1) | 1;
- }
- else
- {
+ }else{
qadd = 0;
}
if(s->ac_pred)
- nCoeffs = 63;
+ nCoeffs=63;
else
- nCoeffs = s->inter_scantable.raster_end[ s->block_last_index[n] ];
+ nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
- for(i = 1; i <= nCoeffs; i++)
- {
+ for(i=1; i<=nCoeffs; i++) {
level = block[i];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = level * qmul - qadd;
- }
- else
- {
+ } else {
level = level * qmul + qadd;
}
block[i] = level;
@@ -2239,29 +1969,24 @@ static void dct_unquantize_h263_intra_c(MpegEncContext *s,
}
static void dct_unquantize_h263_inter_c(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
int i, level, qmul, qadd;
int nCoeffs;
- assert(s->block_last_index[n] >= 0);
+ assert(s->block_last_index[n]>=0);
qadd = (qscale - 1) | 1;
qmul = qscale << 1;
- nCoeffs = s->inter_scantable.raster_end[ s->block_last_index[n] ];
+ nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
- for(i = 0; i <= nCoeffs; i++)
- {
+ for(i=0; i<=nCoeffs; i++) {
level = block[i];
- if(level)
- {
- if(level < 0)
- {
+ if (level) {
+ if (level < 0) {
level = level * qmul - qadd;
- }
- else
- {
+ } else {
level = level * qmul + qadd;
}
block[i] = level;
@@ -2274,14 +1999,14 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
*/
void ff_set_qscale(MpegEncContext * s, int qscale)
{
- if(qscale < 1)
+ if (qscale < 1)
qscale = 1;
- else if(qscale > 31)
+ else if (qscale > 31)
qscale = 31;
s->qscale = qscale;
- s->chroma_qscale = s->chroma_qscale_table[qscale];
+ s->chroma_qscale= s->chroma_qscale_table[qscale];
- s->y_dc_scale = s->y_dc_scale_table[ qscale ];
- s->c_dc_scale = s->c_dc_scale_table[ s->chroma_qscale ];
+ s->y_dc_scale= s->y_dc_scale_table[ qscale ];
+ s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ];
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.h
index 48f9af2d3..d011a943e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.h
@@ -38,8 +38,7 @@
#define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded
-enum OutputFormat
-{
+enum OutputFormat {
FMT_MPEG1,
FMT_H261,
FMT_H263,
@@ -80,8 +79,7 @@ enum OutputFormat
/**
* Picture.
*/
-typedef struct Picture
-{
+typedef struct Picture{
FF_COMMON_FRAME
/**
@@ -140,8 +138,7 @@ struct MpegEncContext;
/**
* Motion estimation context.
*/
-typedef struct MotionEstContext
-{
+typedef struct MotionEstContext{
AVCodecContext *avctx;
int skip; ///< set if ME is skipped for the current MB
int co_located_mv[4][2]; ///< mv from last P-frame for direct mode ME
@@ -181,24 +178,23 @@ typedef struct MotionEstContext
int mc_mb_var_sum_temp;
int mb_var_sum_temp;
int scene_change_score;
- /* cmp, chroma_cmp;*/
- op_pixels_func(*hpel_put)[4];
- op_pixels_func(*hpel_avg)[4];
- qpel_mc_func(*qpel_put)[16];
- qpel_mc_func(*qpel_avg)[16];
+/* cmp, chroma_cmp;*/
+ op_pixels_func (*hpel_put)[4];
+ op_pixels_func (*hpel_avg)[4];
+ qpel_mc_func (*qpel_put)[16];
+ qpel_mc_func (*qpel_avg)[16];
uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV
uint8_t *current_mv_penalty;
int (*sub_motion_search)(struct MpegEncContext * s,
- int *mx_ptr, int *my_ptr, int dmin,
- int src_index, int ref_index,
- int size, int h);
-} MotionEstContext;
+ int *mx_ptr, int *my_ptr, int dmin,
+ int src_index, int ref_index,
+ int size, int h);
+}MotionEstContext;
/**
* MpegEncContext.
*/
-typedef struct MpegEncContext
-{
+typedef struct MpegEncContext {
struct AVCodecContext *avctx;
/* the following parameters must be initialized before encoding */
int width, height;///< picture size. must be a multiple of 16
@@ -209,7 +205,7 @@ typedef struct MpegEncContext
int h263_pred; ///< use mpeg4/h263 ac/dc predictions
int pb_frame; ///< PB frame mode (0 = none, 1 = base, 2 = improved)
- /* the following codec id fields are deprecated in favor of codec_id */
+/* the following codec id fields are deprecated in favor of codec_id */
int h263_plus; ///< h263 plus headers
int h263_msmpeg4; ///< generate MSMPEG4 compatible stream (deprecated, use msmpeg4_version instead)
int h263_flv; ///< use flv h263 header
@@ -613,7 +609,7 @@ typedef struct MpegEncContext
int progressive_sequence;
int mpeg_f_code[2][2];
int picture_structure;
- /* picture type */
+/* picture type */
#define PICT_TOP_FIELD 1
#define PICT_BOTTOM_FIELD 2
#define PICT_FRAME 3
@@ -645,10 +641,10 @@ typedef struct MpegEncContext
uint8_t *ptr_lastgob;
int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped
- DCTELEM(*pblocks[12])[64];
+ DCTELEM (*pblocks[12])[64];
- DCTELEM(*block)[64]; ///< points to one of the following blocks
- DCTELEM(*blocks)[8][64]; // for HQ mode we need to keep the best block
+ DCTELEM (*block)[64]; ///< points to one of the following blocks
+ DCTELEM (*blocks)[8][64]; // for HQ mode we need to keep the best block
int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]); // used by some codecs to avoid a switch()
#define SLICE_OK 0
#define SLICE_ERROR -1
@@ -656,25 +652,25 @@ typedef struct MpegEncContext
#define SLICE_NOEND -3 ///<no end marker or error found but mb count exceeded
void (*dct_unquantize_mpeg1_intra)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_mpeg1_inter)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_mpeg2_intra)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_mpeg2_inter)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h263_intra)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h263_inter)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h261_intra)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_h261_inter)(struct MpegEncContext *s,
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
- DCTELEM *block/*align 16*/, int n, int qscale);
+ DCTELEM *block/*align 16*/, int n, int qscale);
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);
@@ -718,36 +714,32 @@ void ff_copy_picture(Picture *dst, Picture *src);
*/
int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared);
-static inline void ff_update_block_index(MpegEncContext *s)
-{
- const int block_size = 8 >> s->avctx->lowres;
+static inline void ff_update_block_index(MpegEncContext *s){
+ const int block_size= 8>>s->avctx->lowres;
- s->block_index[0] += 2;
- s->block_index[1] += 2;
- s->block_index[2] += 2;
- s->block_index[3] += 2;
+ s->block_index[0]+=2;
+ s->block_index[1]+=2;
+ s->block_index[2]+=2;
+ s->block_index[3]+=2;
s->block_index[4]++;
s->block_index[5]++;
- s->dest[0] += 2 * block_size;
- s->dest[1] += block_size;
- s->dest[2] += block_size;
+ s->dest[0]+= 2*block_size;
+ s->dest[1]+= block_size;
+ s->dest[2]+= block_size;
}
-static inline int get_bits_diff(MpegEncContext *s)
-{
- const int bits = put_bits_count(&s->pb);
- const int last = s->last_bits;
+static inline int get_bits_diff(MpegEncContext *s){
+ const int bits= put_bits_count(&s->pb);
+ const int last= s->last_bits;
s->last_bits = bits;
return bits - last;
}
-static inline int ff_h263_round_chroma(int x)
-{
- static const uint8_t h263_chroma_roundtab[16] =
- {
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+static inline int ff_h263_round_chroma(int x){
+ static const uint8_t h263_chroma_roundtab[16] = {
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
};
return h263_chroma_roundtab[x & 0xf] + (x >> 3);
@@ -755,9 +747,9 @@ static inline int ff_h263_round_chroma(int x)
/* motion_est.c */
void ff_estimate_p_frame_motion(MpegEncContext * s,
- int mb_x, int mb_y);
+ int mb_x, int mb_y);
void ff_estimate_b_frame_motion(MpegEncContext * s,
- int mb_x, int mb_y);
+ int mb_x, int mb_y);
int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type);
void ff_fix_long_p_mvs(MpegEncContext * s);
void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select,
@@ -765,10 +757,10 @@ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_
int ff_init_me(MpegEncContext *s);
int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y);
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 P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
+ int ref_mv_scale, int size, int h);
int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
- int ref_index, int size, int h, int add_rate);
+ int ref_index, int size, int h, int add_rate);
/* mpeg12.c */
extern const uint8_t ff_mpeg1_dc_scale_table[128];
@@ -790,8 +782,8 @@ extern const uint8_t ff_h263_loop_filter_strength[32];
void ff_h261_loop_filter(MpegEncContext *s);
void ff_h261_reorder_mb_index(MpegEncContext* s);
void ff_h261_encode_mb(MpegEncContext *s,
- DCTELEM block[6][64],
- int motion_x, int motion_y);
+ DCTELEM block[6][64],
+ int motion_x, int motion_y);
void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number);
void ff_h261_encode_init(MpegEncContext *s);
int ff_h261_get_picture_format(int width, int height);
@@ -817,9 +809,9 @@ int ff_wmv2_decode_picture_header(MpegEncContext * s);
int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s);
void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);
void ff_mspel_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- uint8_t **ref_picture, op_pixels_func(*pix_op)[4],
- int motion_x, int motion_y, int h);
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
+ int motion_x, int motion_y, int h);
int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
void ff_wmv2_encode_mb(MpegEncContext * s,
DCTELEM block[6][64],
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo_common.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo_common.h
index 3d54bc63d..6174a7219 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo_common.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo_common.h
@@ -62,103 +62,92 @@ static inline void gmc1_motion(MpegEncContext *s,
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);
+ 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;
+ 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;
+ 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 >= s->h_edge_pos - 17
- || (unsigned)src_y >= s->v_edge_pos - 17)
- {
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x >= s->h_edge_pos - 17
+ || (unsigned)src_y >= s->v_edge_pos - 17){
ff_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;
+ 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
- {
+ 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)
- {
+ 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
- {
+ }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;
+ 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 >= (s->h_edge_pos >> 1) - 9
- || (unsigned)src_y >= (s->v_edge_pos >> 1) - 9)
- {
- ff_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;
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x >= (s->h_edge_pos>>1) - 9
+ || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){
+ ff_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);
+ 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)
- {
- ff_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;
+ if(emu){
+ ff_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);
+ 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 *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;
+ const int a= s->sprite_warping_accuracy;
int ox, oy;
linesize = s->linesize;
@@ -166,59 +155,59 @@ static inline void gmc_motion(MpegEncContext *s,
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;
+ 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;
+ 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);
+ 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);
+ 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)
+ 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;
+ int emu=0;
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
src_x += motion_x >> 1;
@@ -226,22 +215,20 @@ static inline int hpel_motion(MpegEncContext *s,
/* WARNING: do no forget half pels */
src_x = av_clip(src_x, -16, width); //FIXME unneeded for emu?
- if(src_x == width)
+ if (src_x == width)
dxy &= ~1;
src_y = av_clip(src_y, -16, height);
- if(src_y == 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 > h_edge_pos - (motion_x & 1) - w
- || (unsigned)src_y > v_edge_pos - (motion_y & 1) - h)
- {
- ff_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(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
+ if( (unsigned)src_x > h_edge_pos - (motion_x&1) - w
+ || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
+ ff_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)
@@ -252,21 +239,21 @@ static inline int hpel_motion(MpegEncContext *s,
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 *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;
- }
+if(s->quarter_sample)
+{
+ motion_x>>=1;
+ motion_y>>=1;
+}
#endif
v_edge_pos = s->v_edge_pos >> field_based;
@@ -274,57 +261,43 @@ void mpeg_motion_internal(MpegEncContext *s,
uvlinesize = s->current_picture.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);
+ 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;
+ 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
- {
+ 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;
+ 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
- {
+ }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)
- {
+ 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
+ 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_x = s->mb_x* 8 + (mx >> 1);
uvsrc_y = src_y;
- }
- else
- {
- //Chroma444
+ } else {
+ //Chroma444
uvdxy = dxy;
uvsrc_x = src_x;
uvsrc_y = src_y;
@@ -336,65 +309,58 @@ void mpeg_motion_internal(MpegEncContext *s,
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
- if((unsigned)src_x > s->h_edge_pos - (motion_x & 1) - 16
- || (unsigned)src_y > v_edge_pos - (motion_y & 1) - h)
- {
- 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;
- }
- ff_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;
- ff_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);
- ff_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( (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
+ || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
+ 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;
+ }
+ ff_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;
+ ff_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);
+ ff_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
- {
+ 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;
+ dest_cb+= s->uvlinesize;
+ dest_cr+= s->uvlinesize;
}
- if(field_select)
- {
+ if(field_select){
ptr_y += s->linesize;
- ptr_cb += s->uvlinesize;
- ptr_cr += s->uvlinesize;
+ 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))
- {
+ 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);
+ (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);
+ (dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
}
if(!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) &&
- s->out_format == FMT_H261)
- {
+ s->out_format == FMT_H261){
ff_h261_loop_filter(s);
}
}
@@ -403,30 +369,29 @@ 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],
+ 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);
+ 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);
+ 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)
-{
+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];
+ 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)\
@@ -435,40 +400,40 @@ static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride)
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;
+ 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+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_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 */
@@ -482,17 +447,13 @@ static inline void obmc_motion(MpegEncContext *s,
int i;
uint8_t *ptr[5];
- assert(s->quarter_sample == 0);
+ 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);
+ 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,
@@ -508,8 +469,8 @@ static inline void obmc_motion(MpegEncContext *s,
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],
+ 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;
@@ -523,33 +484,26 @@ static inline void qpel_motion(MpegEncContext *s,
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;
+ 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);
+ mx= (mx>>1)|(mx&1);
+ my= (my>>1)|(my&1);
- uvdxy = (mx & 1) | ((my & 1) << 1);
- mx >>= 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;
@@ -558,42 +512,37 @@ static inline void qpel_motion(MpegEncContext *s,
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
- if((unsigned)src_x > s->h_edge_pos - (motion_x & 3) - 16
- || (unsigned)src_y > v_edge_pos - (motion_y & 3) - h)
- {
+ if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 16
+ || (unsigned)src_y > v_edge_pos - (motion_y&3) - h ){
ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
- 17, 17 + field_based, src_x, src_y << field_based,
+ 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;
+ ptr_y= s->edge_emu_buffer;
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
ff_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);
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
ff_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;
+ 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)
- {
+ else{
+ if(bottom_field){
dest_y += s->linesize;
- dest_cb += s->uvlinesize;
- dest_cr += s->uvlinesize;
+ dest_cb+= s->uvlinesize;
+ dest_cr+= s->uvlinesize;
}
- if(field_select)
- {
+ if(field_select){
ptr_y += s->linesize;
ptr_cb += s->uvlinesize;
ptr_cr += s->uvlinesize;
@@ -601,10 +550,9 @@ static inline void qpel_motion(MpegEncContext *s,
//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);
+ qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
}
- if(!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- {
+ 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);
}
@@ -617,15 +565,14 @@ 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;
+ 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);
+ mx= ff_h263_round_chroma(mx);
+ my= ff_h263_round_chroma(my);
dxy = ((my & 1) << 1) | (mx & 1);
mx >>= 1;
@@ -633,51 +580,47 @@ static inline void chroma_4mv_motion(MpegEncContext *s,
src_x = s->mb_x * 8 + mx;
src_y = s->mb_y * 8 + my;
- src_x = av_clip(src_x, -8, s->width / 2);
- if(src_x == s->width / 2)
+ src_x = av_clip(src_x, -8, s->width/2);
+ if (src_x == s->width/2)
dxy &= ~1;
- src_y = av_clip(src_y, -8, s->height / 2);
- if(src_y == s->height / 2)
+ src_y = av_clip(src_y, -8, s->height/2);
+ if (src_y == s->height/2)
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 > (s->h_edge_pos >> 1) - (dxy & 1) - 8
- || (unsigned)src_y > (s->v_edge_pos >> 1) - (dxy >> 1) - 8)
- {
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
+ || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){
ff_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;
+ 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)
- {
+ if(emu){
ff_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;
+ 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)
-{
+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);
+ 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);
}
/**
@@ -693,11 +636,11 @@ static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir)
* 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)
+ 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;
@@ -708,110 +651,87 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
prefetch_motion(s, ref_picture, dir);
- if(!is_mpeg12 && s->obmc && s->pict_type != FF_B_TYPE)
- {
+ if(!is_mpeg12 && s->obmc && s->pict_type != FF_B_TYPE){
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;
+ 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.motion_val[0][mot_xy ], sizeof(int16_t) * 4);
- memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t) * 4);
- memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t) * 4);
+ memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy ], sizeof(int16_t)*4);
+ memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
+ memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
- if(mb_y == 0 || IS_INTRA(s->current_picture.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.motion_val[0][mot_xy-mot_stride], sizeof(int16_t) * 4);
+ if(mb_y==0 || IS_INTRA(s->current_picture.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.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4);
}
- if(mb_x == 0 || IS_INTRA(s->current_picture.mb_type[xy-1]))
- {
- *(int32_t*)mv_cache[1][0] = *(int32_t*)mv_cache[1][1];
- *(int32_t*)mv_cache[2][0] = *(int32_t*)mv_cache[2][1];
- }
- else
- {
- *(int32_t*)mv_cache[1][0] = *(int32_t*)s->current_picture.motion_val[0][mot_xy-1];
- *(int32_t*)mv_cache[2][0] = *(int32_t*)s->current_picture.motion_val[0][mot_xy-1+mot_stride];
+ if(mb_x==0 || IS_INTRA(s->current_picture.mb_type[xy-1])){
+ *(int32_t*)mv_cache[1][0]= *(int32_t*)mv_cache[1][1];
+ *(int32_t*)mv_cache[2][0]= *(int32_t*)mv_cache[2][1];
+ }else{
+ *(int32_t*)mv_cache[1][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1];
+ *(int32_t*)mv_cache[2][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1+mot_stride];
}
- if(mb_x + 1 >= s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1]))
- {
- *(int32_t*)mv_cache[1][3] = *(int32_t*)mv_cache[1][2];
- *(int32_t*)mv_cache[2][3] = *(int32_t*)mv_cache[2][2];
- }
- else
- {
- *(int32_t*)mv_cache[1][3] = *(int32_t*)s->current_picture.motion_val[0][mot_xy+2];
- *(int32_t*)mv_cache[2][3] = *(int32_t*)s->current_picture.motion_val[0][mot_xy+2+mot_stride];
+ if(mb_x+1>=s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1])){
+ *(int32_t*)mv_cache[1][3]= *(int32_t*)mv_cache[1][2];
+ *(int32_t*)mv_cache[2][3]= *(int32_t*)mv_cache[2][2];
+ }else{
+ *(int32_t*)mv_cache[1][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2];
+ *(int32_t*)mv_cache[2][3]= *(int32_t*)s->current_picture.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] =
- {
+ 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]}
- };
+ {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,
+ 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))
+ 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)
- {
+ switch(s->mv_type) {
case MV_TYPE_16X16:
- if(s->mcsel)
- {
- if(s->real_sprite_warping_points == 1)
- {
+ if(s->mcsel){
+ if(s->real_sprite_warping_points==1){
gmc1_motion(s, dest_y, dest_cb, dest_cr,
ref_picture);
- }
- else
- {
+ }else{
gmc_motion(s, dest_y, dest_cb, dest_cr,
- ref_picture);
+ ref_picture);
}
- }
- else if(!is_mpeg12 && s->quarter_sample)
- {
+ }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)
- {
+ }else if(!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel){
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
+ 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,
@@ -820,85 +740,72 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
}
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 > s->h_edge_pos - (motion_x & 3) - 8
- || (unsigned)src_y > s->v_edge_pos - (motion_y & 3) - 8)
- {
- ff_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;
- }
+ 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 > s->h_edge_pos - (motion_x&3) - 8
+ || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){
+ ff_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;
}
+ 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];
- }
+ }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);
}
+
+ 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++)
- {
+ 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
- {
+ }else{
/* top field */
mpeg_motion(s, dest_y, dest_cb, dest_cr,
1, 0, s->field_select[dir][0],
@@ -910,83 +817,68 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
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 != FF_B_TYPE && !s->first_field)
- {
- ref_picture = s->current_picture_ptr->data;
+ } else {
+ if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != FF_B_TYPE && !s->first_field){
+ ref_picture= s->current_picture_ptr->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);
+ 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++)
- {
+ for(i=0; i<2; i++){
uint8_t ** ref2picture;
if(s->picture_structure == s->field_select[dir][i] + 1
- || s->pict_type == FF_B_TYPE || s->first_field)
- {
- ref2picture = ref_picture;
- }
- else
- {
- ref2picture = s->current_picture_ptr->data;
+ || s->pict_type == FF_B_TYPE || s->first_field){
+ ref2picture= ref_picture;
+ }else{
+ ref2picture= s->current_picture_ptr->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);
+ 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;
+ 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++)
- {
+ if(s->picture_structure == PICT_FRAME){
+ for(i=0; i<2; i++){
int j;
- for(j = 0; j < 2; j++)
- {
+ for(j=0; j<2; j++){
mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 1, j, j ^ i,
+ 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++)
- {
+ }else{
+ for(i=0; i<2; i++){
mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->picture_structure != i + 1,
+ 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);
+ 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;
+ pix_op=s->dsp.avg_pixels_tab;
//opposite parity is always in the same frame if this is second field
- if(!s->first_field)
- {
+ if(!s->first_field){
ref_picture = s->current_picture_ptr->data;
}
}
}
- break;
- default:
- assert(0);
+ break;
+ default: assert(0);
}
}
@@ -994,8 +886,8 @@ 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])
+ op_pixels_func (*pix_op)[4],
+ qpel_mc_func (*qpix_op)[16])
{
#if !CONFIG_SMALL
if(s->out_format == FMT_MPEG1)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4.c
index f97c64f4a..32c0a95a6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4.c
@@ -78,108 +78,93 @@ static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3]
* except that it is inverted. */
static av_cold void init_h263_dc_for_msmpeg4(void)
{
- int level, uni_code, uni_len;
-
- for(level = -256; level < 256; level++)
- {
- int size, v, l;
- /* find number of bits */
- size = 0;
- v = abs(level);
- while(v)
- {
- v >>= 1;
- size++;
- }
-
- if(level < 0)
- l = (-level) ^((1 << size) - 1);
- else
- l = level;
-
- /* luminance h263 */
- uni_code = ff_mpeg4_DCtab_lum[size][0];
- uni_len = ff_mpeg4_DCtab_lum[size][1];
- uni_code ^= (1 << uni_len) - 1; //M$ does not like compatibility
-
- if(size > 0)
- {
- uni_code <<= size;
- uni_code |= l;
- uni_len += size;
- if(size > 8)
- {
- uni_code <<= 1;
- uni_code |= 1;
- uni_len++;
+ int level, uni_code, uni_len;
+
+ for(level=-256; level<256; level++){
+ int size, v, l;
+ /* find number of bits */
+ size = 0;
+ v = abs(level);
+ while (v) {
+ v >>= 1;
+ size++;
}
- }
- v2_dc_lum_table[level+256][0] = uni_code;
- v2_dc_lum_table[level+256][1] = uni_len;
-
- /* chrominance h263 */
- uni_code = ff_mpeg4_DCtab_chrom[size][0];
- uni_len = ff_mpeg4_DCtab_chrom[size][1];
- uni_code ^= (1 << uni_len) - 1; //M$ does not like compatibility
- if(size > 0)
- {
- uni_code <<= size;
- uni_code |= l;
- uni_len += size;
- if(size > 8)
- {
- uni_code <<= 1;
- uni_code |= 1;
- uni_len++;
+ if (level < 0)
+ l= (-level) ^ ((1 << size) - 1);
+ else
+ l= level;
+
+ /* luminance h263 */
+ uni_code= ff_mpeg4_DCtab_lum[size][0];
+ uni_len = ff_mpeg4_DCtab_lum[size][1];
+ uni_code ^= (1<<uni_len)-1; //M$ does not like compatibility
+
+ if (size > 0) {
+ uni_code<<=size; uni_code|=l;
+ uni_len+=size;
+ if (size > 8){
+ uni_code<<=1; uni_code|=1;
+ uni_len++;
+ }
}
- }
- v2_dc_chroma_table[level+256][0] = uni_code;
- v2_dc_chroma_table[level+256][1] = uni_len;
+ v2_dc_lum_table[level+256][0]= uni_code;
+ v2_dc_lum_table[level+256][1]= uni_len;
+
+ /* chrominance h263 */
+ uni_code= ff_mpeg4_DCtab_chrom[size][0];
+ uni_len = ff_mpeg4_DCtab_chrom[size][1];
+ uni_code ^= (1<<uni_len)-1; //M$ does not like compatibility
+
+ if (size > 0) {
+ uni_code<<=size; uni_code|=l;
+ uni_len+=size;
+ if (size > 8){
+ uni_code<<=1; uni_code|=1;
+ uni_len++;
+ }
+ }
+ v2_dc_chroma_table[level+256][0]= uni_code;
+ v2_dc_chroma_table[level+256][1]= uni_len;
- }
+ }
}
static av_cold void common_init(MpegEncContext * s)
{
- static int initialized = 0;
+ static int initialized=0;
- switch(s->msmpeg4_version)
- {
+ switch(s->msmpeg4_version){
case 1:
case 2:
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
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;
- }
- else
- {
- s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table;
- s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table;
+ 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;
+ } else{
+ s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
+ s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
}
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= wmv1_y_dc_scale_table;
+ s->c_dc_scale_table= 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= wmv3_dc_scale_table;
+ s->c_dc_scale_table= wmv3_dc_scale_table;
break;
#endif
}
- if(s->msmpeg4_version >= 4)
- {
+ 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]);
@@ -187,9 +172,8 @@ static av_cold void common_init(MpegEncContext * s)
}
//Note the default tables are set in common_init in mpegvideo.c
- if(!initialized)
- {
- initialized = 1;
+ if(!initialized){
+ initialized=1;
init_h263_dc_for_msmpeg4();
}
@@ -204,11 +188,10 @@ static void init_mv_table(MVTable *tab)
tab->table_mv_index = av_malloc(sizeof(uint16_t) * 4096);
/* mark all entries as not used */
- for(i = 0; i < 4096; i++)
+ for(i=0;i<4096;i++)
tab->table_mv_index[i] = tab->n;
- for(i = 0; i < tab->n; i++)
- {
+ 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;
@@ -217,63 +200,50 @@ static void init_mv_table(MVTable *tab)
void ff_msmpeg4_code012(PutBitContext *pb, int n)
{
- if(n == 0)
- {
+ if (n == 0) {
put_bits(pb, 1, 0);
- }
- else
- {
+ } 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;
+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;
+ int run_diff= intra ? 0 : 1;
code = get_rl_index(rl, last, run, level);
- size += rl->table_vlc[code][1];
- if(code == rl->n)
- {
+ size+= rl->table_vlc[code][1];
+ if (code == rl->n) {
int level1, run1;
level1 = level - rl->max_level[last][run];
- if(level1 < 1)
+ if (level1 < 1)
goto esc2;
code = get_rl_index(rl, last, run, level1);
- if(code == rl->n)
- {
-esc2:
+ if (code == rl->n) {
+ esc2:
size++;
- if(level > MAX_LEVEL)
+ if (level > MAX_LEVEL)
goto esc3;
run1 = run - rl->max_run[last][level] - run_diff;
- if(run1 < 0)
+ if (run1 < 0)
goto esc3;
code = get_rl_index(rl, last, run1, level);
- if(code == rl->n)
- {
-esc3:
+ if (code == rl->n) {
+ esc3:
/* third escape */
- size += 1 + 1 + 6 + 8;
- }
- else
- {
+ size+=1+1+6+8;
+ } else {
/* second escape */
- size += 1 + 1 + rl->table_vlc[code][1];
+ size+= 1+1+ rl->table_vlc[code][1];
}
- }
- else
- {
+ } else {
/* first escape */
- size += 1 + 1 + rl->table_vlc[code][1];
+ size+= 1+1+ rl->table_vlc[code][1];
}
- }
- else
- {
+ } else {
size++;
}
return size;
@@ -281,37 +251,31 @@ esc3:
av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
{
- static int init_done = 0;
+ static int init_done=0;
int i;
common_init(s);
- if(s->msmpeg4_version >= 4)
- {
- s->min_qcoeff = -255;
- s->max_qcoeff = 255;
+ if(s->msmpeg4_version>=4){
+ s->min_qcoeff= -255;
+ s->max_qcoeff= 255;
}
- if(!init_done)
- {
+ 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++)
+ for(i=0;i<NB_RL_TABLES;i++)
init_rl(&rl_table[i], static_rl_table_store[i]);
- for(i = 0; i < NB_RL_TABLES; i++)
- {
+ for(i=0; i<NB_RL_TABLES; i++){
int level;
- for(level = 0; level <= MAX_LEVEL; level++)
- {
+ for(level=0; level<=MAX_LEVEL; level++){
int run;
- for(run = 0; run <= MAX_RUN; 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);
+ for(last=0; last<2; last++){
+ rl_length[i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level, 0);
}
}
}
@@ -322,77 +286,66 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
static void find_best_tables(MpegEncContext * s)
{
int i;
- int best = -1, best_size = 9999999;
- int chroma_best = -1, best_chroma_size = 9999999;
+ int best =-1, best_size =9999999;
+ int chroma_best=-1, best_chroma_size=9999999;
- for(i = 0; i < 3; i++)
- {
+ for(i=0; i<3; i++){
int level;
- int chroma_size = 0;
- int size = 0;
+ int chroma_size=0;
+ int size=0;
- if(i > 0) // ;)
- {
+ if(i>0){// ;)
size++;
chroma_size++;
}
- for(level = 0; level <= MAX_LEVEL; level++)
- {
+ for(level=0; level<=MAX_LEVEL; level++){
int run;
- for(run = 0; run <= MAX_RUN; run++)
- {
+ for(run=0; run<=MAX_RUN; run++){
int last;
- const int last_size = size + chroma_size;
- for(last = 0; last < 2; 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 == FF_I_TYPE)
- {
- 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];
+ int intra_chroma_count= s->ac_stats[1][1][level][run][last];
+
+ if(s->pict_type==FF_I_TYPE){
+ 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(last_size == size+chroma_size) break;
}
}
- if(size < best_size)
- {
- best_size = size;
- best = i;
+ if(size<best_size){
+ best_size= size;
+ best= i;
}
- if(chroma_size < best_chroma_size)
- {
- best_chroma_size = chroma_size;
- chroma_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 == FF_P_TYPE) chroma_best = best;
+ if(s->pict_type==FF_P_TYPE) chroma_best= best;
- memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL + 1)*(MAX_RUN + 1) * 2 * 2 * 2);
+ 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;
+ 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 == FF_I_TYPE)
- s->rl_chroma_table_index = 1;
+ if(s->pict_type != s->last_non_b_pict_type){
+ s->rl_table_index= 2;
+ if(s->pict_type==FF_I_TYPE)
+ s->rl_chroma_table_index= 1;
else
- s->rl_chroma_table_index = 2;
+ s->rl_chroma_table_index= 2;
}
}
@@ -406,8 +359,7 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
put_bits(&s->pb, 2, s->pict_type - 1);
put_bits(&s->pb, 5, s->qscale);
- if(s->msmpeg4_version <= 2)
- {
+ if(s->msmpeg4_version<=2){
s->rl_table_index = 2;
s->rl_chroma_table_index = 2;
}
@@ -416,42 +368,35 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
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 == FF_P_TYPE);
+ if(s->msmpeg4_version==4)
+ s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==FF_P_TYPE);
//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 == FF_I_TYPE)
- {
- s->slice_height = s->mb_height / 1;
- put_bits(&s->pb, 5, 0x16 + s->mb_height / s->slice_height);
+ if (s->pict_type == FF_I_TYPE) {
+ s->slice_height= s->mb_height/1;
+ put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height);
- if(s->msmpeg4_version == 4)
- {
+ if(s->msmpeg4_version==4){
msmpeg4_encode_ext_header(s);
- if(s->bit_rate > MBAC_BITRATE)
+ 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)
- {
+ 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
- {
+ } else {
put_bits(&s->pb, 1, s->use_skip_mb_code);
- if(s->msmpeg4_version == 4 && s->bit_rate > MBAC_BITRATE)
+ 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->msmpeg4_version>2){
if(!s->per_mb_rl_table)
ff_msmpeg4_code012(&s->pb, s->rl_table_index);
@@ -461,20 +406,20 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
}
}
- s->esc3_level_length = 0;
- s->esc3_run_length = 0;
+ 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, 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));
+ 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);
+ if(s->msmpeg4_version>=3)
+ put_bits(&s->pb, 1, s->flipflop_rounding);
+ else
+ assert(s->flipflop_rounding==0);
}
#endif //CONFIG_ENCODERS
@@ -494,12 +439,9 @@ int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block
b = s->coded_block[xy - 1 - wrap];
c = s->coded_block[xy - wrap];
- if(b == c)
- {
+ if (b == c) {
pred = a;
- }
- else
- {
+ } else {
pred = c;
}
@@ -512,7 +454,7 @@ int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block
#if CONFIG_ENCODERS
void ff_msmpeg4_encode_motion(MpegEncContext * s,
- int mx, int my)
+ int mx, int my)
{
int code;
MVTable *mv;
@@ -520,20 +462,20 @@ void ff_msmpeg4_encode_motion(MpegEncContext * s,
/* 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)
+ if (mx <= -64)
mx += 64;
- else if(mx >= 64)
+ else if (mx >= 64)
mx -= 64;
- if(my <= -64)
+ if (my <= -64)
my += 64;
- else if(my >= 64)
+ else if (my >= 64)
my -= 64;
mx += 32;
my += 32;
#if 0
- if((unsigned)mx >= 64 ||
- (unsigned)my >= 64)
+ 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];
@@ -542,28 +484,21 @@ void ff_msmpeg4_encode_motion(MpegEncContext * s,
put_bits(&s->pb,
mv->table_mv_bits[code],
mv->table_mv_code[code]);
- if(code == mv->n)
- {
+ 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)
- {
+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
- {
+ } else {
s->first_slice_line = 0;
}
}
@@ -573,27 +508,21 @@ static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
{
int range, bit_size, sign, code, bits;
- if(val == 0)
- {
+ if (val == 0) {
/* zero vector */
code = 0;
put_bits(&s->pb, mvtab[code][1], mvtab[code][0]);
- }
- else
- {
+ } else {
bit_size = s->f_code - 1;
range = 1 << bit_size;
- if(val <= -64)
+ if (val <= -64)
val += 64;
- else if(val >= 64)
+ else if (val >= 64)
val -= 64;
- if(val >= 0)
- {
+ if (val >= 0) {
sign = 0;
- }
- else
- {
+ } else {
val = -val;
sign = 1;
}
@@ -602,8 +531,7 @@ static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
bits = val & (range - 1);
put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign);
- if(bit_size > 0)
- {
+ if (bit_size > 0) {
put_bits(&s->pb, bit_size, bits);
}
}
@@ -619,17 +547,14 @@ void msmpeg4_encode_mb(MpegEncContext * s,
ff_msmpeg4_handle_slices(s);
- if(!s->mb_intra)
- {
+ if (!s->mb_intra) {
/* compute cbp */
cbp = 0;
- for(i = 0; i < 6; i++)
- {
- if(s->block_last_index[i] >= 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)
- {
+ if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) {
/* skip macroblock */
put_bits(&s->pb, 1, 1);
s->last_bits++;
@@ -638,16 +563,15 @@ void msmpeg4_encode_mb(MpegEncContext * s,
return;
}
- if(s->use_skip_mb_code)
+ if (s->use_skip_mb_code)
put_bits(&s->pb, 1, 0); /* mb coded */
- if(s->msmpeg4_version <= 2)
- {
+ 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;
+ if((cbp&3) != 3) coded_cbp= cbp ^ 0x3C;
+ else coded_cbp= cbp;
put_bits(&s->pb,
ff_h263_cbpy_tab[coded_cbp>>2][1],
@@ -658,9 +582,7 @@ void msmpeg4_encode_mb(MpegEncContext * s,
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
- {
+ }else{
put_bits(&s->pb,
table_mb_non_intra[cbp + 64][1],
table_mb_non_intra[cbp + 64][0]);
@@ -670,29 +592,24 @@ void msmpeg4_encode_mb(MpegEncContext * s,
/* motion vector */
h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
ff_msmpeg4_encode_motion(s, motion_x - pred_x,
- motion_y - pred_y);
+ motion_y - pred_y);
}
s->mv_bits += get_bits_diff(s);
- for(i = 0; i < 6; i++)
- {
+ for (i = 0; i < 6; i++) {
ff_msmpeg4_encode_block(s, block[i], i);
}
s->p_tex_bits += get_bits_diff(s);
- }
- else
- {
+ } else {
/* compute cbp */
cbp = 0;
coded_cbp = 0;
- for(i = 0; i < 6; i++)
- {
+ for (i = 0; i < 6; i++) {
int val, pred;
val = (s->block_last_index[i] >= 1);
cbp |= val << (5 - i);
- if(i < 4)
- {
+ if (i < 4) {
/* predict value for close blocks only for luma */
pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block);
*coded_block = val;
@@ -701,20 +618,16 @@ void msmpeg4_encode_mb(MpegEncContext * s,
coded_cbp |= val << (5 - i);
}
#if 0
- if(coded_cbp)
+ if (coded_cbp)
printf("cbp=%x %x\n", cbp, coded_cbp);
#endif
- if(s->msmpeg4_version <= 2)
- {
- if(s->pict_type == FF_I_TYPE)
- {
+ if(s->msmpeg4_version<=2){
+ if (s->pict_type == FF_I_TYPE) {
put_bits(&s->pb,
v2_intra_cbpc[cbp&3][1], v2_intra_cbpc[cbp&3][0]);
- }
- else
- {
- if(s->use_skip_mb_code)
+ } 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],
@@ -724,33 +637,26 @@ void msmpeg4_encode_mb(MpegEncContext * s,
put_bits(&s->pb,
ff_h263_cbpy_tab[cbp>>2][1],
ff_h263_cbpy_tab[cbp>>2][0]);
- }
- else
- {
- if(s->pict_type == FF_I_TYPE)
- {
+ }else{
+ if (s->pict_type == FF_I_TYPE) {
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)
+ } 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;
+ 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++)
- {
+ for (i = 0; i < 6; i++) {
ff_msmpeg4_encode_block(s, block[i], i);
}
s->i_tex_bits += get_bits_diff(s);
@@ -765,53 +671,45 @@ static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
{
int i;
- if(n < 4)
- {
- i = 0;
- }
- else
- {
- i = n - 3;
+ if (n < 4) {
+ i= 0;
+ } else {
+ i= n-3;
}
- *dc_val_ptr = &s->last_dc[i];
+ *dc_val_ptr= &s->last_dc[i];
return s->last_dc[i];
}
static int get_dc(uint8_t *src, int stride, int scale)
{
int y;
- int sum = 0;
- for(y = 0; y < 8; y++)
- {
+ int sum=0;
+ for(y=0; y<8; y++){
int x;
- for(x = 0; x < 8; x++)
- {
- sum += src[x + y*stride];
+ for(x=0; x<8; x++){
+ sum+=src[x + y*stride];
}
}
- return FASTDIV((sum + (scale >> 1)), scale);
+ return FASTDIV((sum + (scale>>1)), 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)
+ int16_t **dc_val_ptr, int *dir_ptr)
{
int a, b, c, wrap, pred, scale;
int16_t *dc_val;
/* find prediction */
- if(n < 4)
- {
+ if (n < 4) {
scale = s->y_dc_scale;
- }
- else
- {
+ } else {
scale = s->c_dc_scale;
}
wrap = s->block_wrap[n];
- dc_val = s->dc_val[0] + s->block_index[n];
+ dc_val= s->dc_val[0] + s->block_index[n];
/* B C
* A X
@@ -820,9 +718,8 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
b = dc_val[ - 1 - wrap];
c = dc_val[ - wrap];
- if(s->first_slice_line && (n & 2) == 0 && s->msmpeg4_version < 4)
- {
- b = c = 1024;
+ if(s->first_slice_line && (n&2)==0 && s->msmpeg4_version<4){
+ b=c=1024;
}
/* XXX: the following solution consumes divisions, but it does not
@@ -844,8 +741,8 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
"movl %2, %%eax \n\t"
"mull %4 \n\t"
"movl %%edx, %2 \n\t"
- : "+b"(a), "+c"(b), "+D"(c)
- : "g"(scale), "S"(ff_inverse[scale])
+ : "+b" (a), "+c" (b), "+D" (c)
+ : "g" (scale), "S" (ff_inverse[scale])
: "%eax", "%edx"
);
#else
@@ -853,14 +750,11 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
/* Divisions are extremely costly on Alpha; optimize the most
common case. But they are costly everywhere...
*/
- if(scale == 8)
- {
+ if (scale == 8) {
a = (a + (8 >> 1)) / 8;
b = (b + (8 >> 1)) / 8;
c = (c + (8 >> 1)) / 8;
- }
- else
- {
+ } else {
a = FASTDIV((a + (scale >> 1)), scale);
b = FASTDIV((b + (scale >> 1)), scale);
c = FASTDIV((c + (scale >> 1)), scale);
@@ -868,114 +762,76 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
#endif
/* XXX: WARNING: they did not choose the same test as MPEG4. This
is very important ! */
- if(s->msmpeg4_version > 3)
- {
- if(s->inter_intra_pred)
- {
+ if(s->msmpeg4_version>3){
+ if(s->inter_intra_pred){
uint8_t *dest;
int wrap;
- if(n == 1)
- {
- pred = a;
+ if(n==1){
+ pred=a;
*dir_ptr = 0;
- }
- else if(n == 2)
- {
- pred = c;
+ }else if(n==2){
+ pred=c;
*dir_ptr = 1;
- }
- else if(n == 3)
- {
- if(abs(a - b) < abs(b - c))
- {
+ }else if(n==3){
+ if (abs(a - b) < abs(b - c)) {
pred = c;
*dir_ptr = 1;
- }
- else
- {
+ } else {
pred = a;
*dir_ptr = 0;
}
- }
- else
- {
- if(n < 4)
- {
- wrap = s->linesize;
- dest = s->current_picture.data[0] + (((n >> 1) + 2 * s->mb_y) * 8 * wrap) + ((n & 1) + 2 * s->mb_x) * 8;
- }
- else
- {
- wrap = s->uvlinesize;
- dest = s->current_picture.data[n-3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
+ }else{
+ if(n<4){
+ wrap= s->linesize;
+ dest= s->current_picture.data[0] + (((n>>1) + 2*s->mb_y) * 8* wrap ) + ((n&1) + 2*s->mb_x) * 8;
+ }else{
+ wrap= s->uvlinesize;
+ dest= s->current_picture.data[n-3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
}
- if(s->mb_x == 0) a = (1024 + (scale >> 1)) / scale;
- else a = get_dc(dest - 8, wrap, scale * 8);
- if(s->mb_y == 0) c = (1024 + (scale >> 1)) / scale;
- else c = get_dc(dest - 8 * wrap, wrap, scale * 8);
+ if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
+ else a= get_dc(dest-8, wrap, scale*8);
+ if(s->mb_y==0) c= (1024 + (scale>>1))/scale;
+ else c= get_dc(dest-8*wrap, wrap, scale*8);
- if(s->h263_aic_dir == 0)
- {
- pred = a;
+ if (s->h263_aic_dir==0) {
+ pred= a;
*dir_ptr = 0;
- }
- else if(s->h263_aic_dir == 1)
- {
- if(n == 0)
- {
- pred = c;
+ }else if (s->h263_aic_dir==1) {
+ if(n==0){
+ pred= c;
*dir_ptr = 1;
- }
- else
- {
- pred = a;
+ }else{
+ pred= a;
*dir_ptr = 0;
}
- }
- else if(s->h263_aic_dir == 2)
- {
- if(n == 0)
- {
- pred = a;
+ }else if (s->h263_aic_dir==2) {
+ if(n==0){
+ pred= a;
*dir_ptr = 0;
- }
- else
- {
- pred = c;
+ }else{
+ pred= c;
*dir_ptr = 1;
}
- }
- else
- {
- pred = c;
+ } else {
+ pred= c;
*dir_ptr = 1;
}
}
- }
- else
- {
- if(abs(a - b) < abs(b - c))
- {
+ }else{
+ if (abs(a - b) < abs(b - c)) {
pred = c;
*dir_ptr = 1;
- }
- else
- {
+ } else {
pred = a;
*dir_ptr = 0;
}
}
- }
- else
- {
- if(abs(a - b) <= abs(b - c))
- {
+ }else{
+ if (abs(a - b) <= abs(b - c)) {
pred = c;
*dir_ptr = 1;
- }
- else
- {
+ } else {
pred = a;
*dir_ptr = 0;
}
@@ -994,26 +850,20 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
int pred, extquant;
int extrabits = 0;
- if(s->msmpeg4_version == 1)
- {
+ if(s->msmpeg4_version==1){
int32_t *dc_val;
pred = msmpeg4v1_pred_dc(s, n, &dc_val);
/* update predictor */
- *dc_val = level;
- }
- else
- {
+ *dc_val= level;
+ }else{
int16_t *dc_val;
pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
/* update predictor */
- if(n < 4)
- {
+ if (n < 4) {
*dc_val = level * s->y_dc_scale;
- }
- else
- {
+ } else {
*dc_val = level * s->c_dc_scale;
}
}
@@ -1021,79 +871,58 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
/* do the prediction */
level -= pred;
- if(s->msmpeg4_version <= 2)
- {
- if(n < 4)
- {
+ 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
- {
+ }else{
put_bits(&s->pb,
v2_dc_chroma_table[level+256][1],
v2_dc_chroma_table[level+256][0]);
}
- }
- else
- {
+ }else{
sign = 0;
- if(level < 0)
- {
+ if (level < 0) {
level = -level;
sign = 1;
}
code = level;
- if(code > DC_MAX)
+ if (code > DC_MAX)
code = DC_MAX;
- else if(s->msmpeg4_version >= 6)
- {
- if(s->qscale == 1)
- {
+ else if( s->msmpeg4_version>=6 ) {
+ if( s->qscale == 1 ) {
extquant = (level + 3) & 0x3;
- code = ((level + 3) >> 2);
- }
- else if(s->qscale == 2)
- {
+ code = ((level+3)>>2);
+ } else if( s->qscale == 2 ) {
extquant = (level + 1) & 0x1;
- code = ((level + 1) >> 1);
+ code = ((level+1)>>1);
}
}
- if(s->dc_table_index == 0)
- {
- if(n < 4)
- {
+ 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
- {
+ } else {
put_bits(&s->pb, ff_table0_dc_chroma[code][1], ff_table0_dc_chroma[code][0]);
}
- }
- else
- {
- if(n < 4)
- {
+ } else {
+ if (n < 4) {
put_bits(&s->pb, ff_table1_dc_lum[code][1], ff_table1_dc_lum[code][0]);
- }
- else
- {
+ } 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)
+ if(s->msmpeg4_version>=6 && s->qscale<=2)
extrabits = 3 - s->qscale;
- if(code == DC_MAX)
+ 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)
- {
+ if (level != 0) {
put_bits(&s->pb, 1, sign);
}
}
@@ -1110,138 +939,112 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n)
const RLTable *rl;
const uint8_t *scantable;
- if(s->mb_intra)
- {
+ if (s->mb_intra) {
msmpeg4_encode_dc(s, block[0], n, &dc_pred_dir);
i = 1;
- if(n < 4)
- {
+ if (n < 4) {
rl = &rl_table[s->rl_table_index];
- }
- else
- {
+ } else {
rl = &rl_table[3 + s->rl_chroma_table_index];
}
- run_diff = s->msmpeg4_version >= 4;
- scantable = s->intra_scantable.permutated;
- }
- else
- {
+ 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)
+ if(s->msmpeg4_version<=2)
run_diff = 0;
else
run_diff = 1;
- scantable = s->inter_scantable.permutated;
+ 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(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
+ 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++)
- {
+ for (; i <= last_index; i++) {
j = scantable[i];
level = block[j];
- if(level)
- {
+ if (level) {
run = i - last_non_zero - 1;
last = (i == last_index);
sign = 0;
slevel = level;
- if(level < 0)
- {
+ if (level < 0) {
sign = 1;
level = -level;
}
- if(level <= MAX_LEVEL && run <= MAX_RUN)
- {
+ if(level<=MAX_LEVEL && run<=MAX_RUN){
s->ac_stats[s->mb_intra][n>3][level][run][last]++;
}
#if 0
- else
- s->ac_stats[s->mb_intra][n>3][40][63][0]++; //esc3 like
+else
+ s->ac_stats[s->mb_intra][n>3][40][63][0]++; //esc3 like
#endif
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)
- {
+ if (code == rl->n) {
int level1, run1;
level1 = level - rl->max_level[last][run];
- if(level1 < 1)
+ if (level1 < 1)
goto esc2;
code = get_rl_index(rl, last, run, level1);
- if(code == rl->n)
- {
-esc2:
+ if (code == rl->n) {
+ esc2:
put_bits(&s->pb, 1, 0);
- if(level > MAX_LEVEL)
+ if (level > MAX_LEVEL)
goto esc3;
run1 = run - rl->max_run[last][level] - run_diff;
- if(run1 < 0)
+ if (run1 < 0)
goto esc3;
- code = get_rl_index(rl, last, run1 + 1, level);
- if(s->msmpeg4_version == 4 && code == rl->n)
+ 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:
+ 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;
+ 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);
+ 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
- {
+ }else{
put_bits(&s->pb, 6, run);
put_sbits(&s->pb, 8, slevel);
}
- }
- else
- {
+ } 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
- {
+ } 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
- {
+ } else {
put_bits(&s->pb, 1, sign);
}
last_non_zero = i;
@@ -1267,27 +1070,26 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
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);
- if(code < 0)
+ if (code < 0)
return 0xffff;
- if(code == 0)
+ if (code == 0)
return pred;
sign = get_bits1(&s->gb);
shift = f_code - 1;
val = code;
- if(shift)
- {
+ if (shift) {
val = (val - 1) << shift;
val |= get_bits(&s->gb, shift);
val++;
}
- if(sign)
+ if (sign)
val = -val;
val += pred;
- if(val <= -64)
+ if (val <= -64)
val += 64;
- else if(val >= 64)
+ else if (val >= 64)
val -= 64;
return val;
@@ -1297,15 +1099,12 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
{
int cbp, code, i;
- if(s->pict_type == FF_P_TYPE)
- {
- if(s->use_skip_mb_code)
- {
- if(get_bits1(&s->gb))
- {
+ if (s->pict_type == FF_P_TYPE) {
+ if (s->use_skip_mb_code) {
+ if (get_bits1(&s->gb)) {
/* skip mb */
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
@@ -1316,79 +1115,67 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
}
}
- if(s->msmpeg4_version == 2)
+ if(s->msmpeg4_version==2)
code = get_vlc2(&s->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1);
else
code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
- if(code < 0 || code > 7)
- {
+ if(code<0 || code>7){
av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y);
return -1;
}
- s->mb_intra = code >> 2;
+ s->mb_intra = code >>2;
cbp = code & 0x3;
- }
- else
- {
+ } else {
s->mb_intra = 1;
- if(s->msmpeg4_version == 2)
- cbp = get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1);
+ if(s->msmpeg4_version==2)
+ cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1);
else
- cbp = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);
- if(cbp < 0 || cbp > 3)
- {
+ cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);
+ if(cbp<0 || cbp>3){
av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
}
- if(!s->mb_intra)
- {
+ if (!s->mb_intra) {
int mx, my, cbpy;
- cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
- if(cbpy < 0)
- {
+ cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
+ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
- cbp |= cbpy << 2;
- if(s->msmpeg4_version == 1 || (cbp & 3) != 3) cbp ^= 0x3C;
+ cbp|= cbpy<<2;
+ if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C;
h263_pred_motion(s, 0, 0, &mx, &my);
- mx = msmpeg4v2_decode_motion(s, mx, 1);
- my = msmpeg4v2_decode_motion(s, my, 1);
+ mx= msmpeg4v2_decode_motion(s, mx, 1);
+ my= msmpeg4v2_decode_motion(s, my, 1);
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
- }
- else
- {
- if(s->msmpeg4_version == 2)
- {
+ } else {
+ if(s->msmpeg4_version==2){
s->ac_pred = get_bits1(&s->gb);
- cbp |= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1) << 2; //FIXME check errors
- }
- else
- {
+ cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
+ } else{
s->ac_pred = 0;
- cbp |= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1) << 2; //FIXME check errors
- if(s->pict_type == FF_P_TYPE) cbp ^= 0x3C;
+ cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
+ if(s->pict_type==FF_P_TYPE) cbp^=0x3C;
}
}
s->dsp.clear_blocks(s->block[0]);
- for(i = 0; i < 6; i++)
- {
- if(ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
+ for (i = 0; i < 6; i++) {
+ if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{
- av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
- return -1;
+ av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
+ return -1;
}
}
return 0;
@@ -1398,17 +1185,14 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
{
int cbp, code, i;
uint8_t *coded_val;
- uint32_t * const mb_type_ptr = &s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ];
+ uint32_t * const mb_type_ptr= &s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ];
- if(s->pict_type == FF_P_TYPE)
- {
- if(s->use_skip_mb_code)
- {
- if(get_bits1(&s->gb))
- {
+ if (s->pict_type == FF_P_TYPE) {
+ if (s->use_skip_mb_code) {
+ if (get_bits1(&s->gb)) {
/* skip mb */
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
@@ -1422,26 +1206,22 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
}
code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX].table, MB_NON_INTRA_VLC_BITS, 3);
- if(code < 0)
+ if (code < 0)
return -1;
//s->mb_intra = (code & 0x40) ? 0 : 1;
s->mb_intra = (~code & 0x40) >> 6;
cbp = code & 0x3f;
- }
- else
- {
+ } else {
s->mb_intra = 1;
code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
- if(code < 0)
+ if (code < 0)
return -1;
/* predict coded block pattern */
cbp = 0;
- for(i = 0; i < 6; i++)
- {
+ for(i=0;i<6;i++) {
int val = ((code >> (5 - i)) & 1);
- if(i < 4)
- {
+ if (i < 4) {
int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
val = val ^ pred;
*coded_val = val;
@@ -1450,45 +1230,38 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
}
}
- if(!s->mb_intra)
- {
+ 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)
- {
+ if(s->per_mb_rl_table && cbp){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
}
h263_pred_motion(s, 0, 0, &mx, &my);
- if(ff_msmpeg4_decode_motion(s, &mx, &my) < 0)
+ if (ff_msmpeg4_decode_motion(s, &mx, &my) < 0)
return -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
- }
- else
- {
+ } 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));
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);
+ 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);
}
- if(s->per_mb_rl_table && cbp)
- {
+ if(s->per_mb_rl_table && cbp){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
}
}
s->dsp.clear_blocks(s->block[0]);
- for(i = 0; i < 6; i++)
- {
- if(ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
+ for (i = 0; i < 6; i++) {
+ if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
@@ -1510,12 +1283,10 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
common_init(s);
- if(!done)
- {
+ if (!done) {
done = 1;
- for(i = 0; i < NB_RL_TABLES; i++)
- {
+ for(i=0;i<NB_RL_TABLES;i++) {
init_rl(&rl_table[i], static_rl_table_store[i]);
}
INIT_VLC_RL(rl_table[0], 642);
@@ -1527,84 +1298,83 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
mv = &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->table_mv_bits, 1, 1,
+ mv->table_mv_code, 2, 2, 3714);
mv = &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);
+ mv->table_mv_bits, 1, 1,
+ mv->table_mv_code, 2, 2, 2694);
INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], DC_VLC_BITS, 120,
- &ff_table0_dc_lum[0][1], 8, 4,
- &ff_table0_dc_lum[0][0], 8, 4, 1158);
+ &ff_table0_dc_lum[0][1], 8, 4,
+ &ff_table0_dc_lum[0][0], 8, 4, 1158);
INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], DC_VLC_BITS, 120,
- &ff_table0_dc_chroma[0][1], 8, 4,
- &ff_table0_dc_chroma[0][0], 8, 4, 1118);
+ &ff_table0_dc_chroma[0][1], 8, 4,
+ &ff_table0_dc_chroma[0][0], 8, 4, 1118);
INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], DC_VLC_BITS, 120,
- &ff_table1_dc_lum[0][1], 8, 4,
- &ff_table1_dc_lum[0][0], 8, 4, 1476);
+ &ff_table1_dc_lum[0][1], 8, 4,
+ &ff_table1_dc_lum[0][0], 8, 4, 1476);
INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], DC_VLC_BITS, 120,
- &ff_table1_dc_chroma[0][1], 8, 4,
- &ff_table1_dc_chroma[0][0], 8, 4, 1216);
+ &ff_table1_dc_chroma[0][1], 8, 4,
+ &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);
+ &v2_dc_lum_table[0][1], 8, 4,
+ &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);
+ &v2_dc_chroma_table[0][1], 8, 4,
+ &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);
+ &v2_intra_cbpc[0][1], 2, 1,
+ &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);
+ &v2_mb_type[0][1], 2, 1,
+ &v2_mb_type[0][0], 2, 1, 128);
INIT_VLC_STATIC(&v2_mv_vlc, V2_MV_VLC_BITS, 33,
- &mvtab[0][1], 2, 1,
- &mvtab[0][0], 2, 1, 538);
+ &mvtab[0][1], 2, 1,
+ &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);
+ &wmv2_inter_table[0][0][1], 8, 4,
+ &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);
+ &wmv2_inter_table[1][0][1], 8, 4,
+ &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);
+ &wmv2_inter_table[2][0][1], 8, 4,
+ &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);
+ &wmv2_inter_table[3][0][1], 8, 4,
+ &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);
+ &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);
+ &table_inter_intra[0][1], 2, 1,
+ &table_inter_intra[0][0], 2, 1, 8);
}
- switch(s->msmpeg4_version)
- {
+ switch(s->msmpeg4_version){
case 1:
case 2:
- s->decode_mb = msmpeg4v12_decode_mb;
+ s->decode_mb= msmpeg4v12_decode_mb;
break;
case 3:
case 4:
- s->decode_mb = msmpeg4v34_decode_mb;
+ s->decode_mb= msmpeg4v34_decode_mb;
break;
case 5:
- if(CONFIG_WMV2_DECODER)
- s->decode_mb = ff_wmv2_decode_mb;
+ if (CONFIG_WMV2_DECODER)
+ s->decode_mb= ff_wmv2_decode_mb;
case 6:
//FIXME + TODO VC1 decode mb
break;
}
- s->slice_height = s->mb_height; //to avoid 1/0 if the first frame is not a keyframe
+ s->slice_height= s->mb_height; //to avoid 1/0 if the first frame is not a keyframe
return 0;
}
@@ -1614,22 +1384,20 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
int code;
#if 0
- {
- int i;
- for(i = 0; i < s->gb.size_in_bits; i++)
- av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
+{
+int i;
+for(i=0; i<s->gb.size_in_bits; i++)
+ av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
// get_bits1(&s->gb);
- av_log(s->avctx, AV_LOG_DEBUG, "END\n");
- return -1;
- }
+av_log(s->avctx, AV_LOG_DEBUG, "END\n");
+return -1;
+}
#endif
- if(s->msmpeg4_version == 1)
- {
+ if(s->msmpeg4_version==1){
int start_code;
- start_code = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
- if(start_code != 0x00000100)
- {
+ start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16);
+ if(start_code!=0x00000100){
av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n");
return -1;
}
@@ -1638,44 +1406,36 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
}
s->pict_type = get_bits(&s->gb, 2) + 1;
- if(s->pict_type != FF_I_TYPE &&
- s->pict_type != FF_P_TYPE)
- {
+ if (s->pict_type != FF_I_TYPE &&
+ s->pict_type != FF_P_TYPE){
av_log(s->avctx, AV_LOG_ERROR, "invalid picture type\n");
return -1;
}
#if 0
- {
- static int had_i = 0;
- if(s->pict_type == FF_I_TYPE) had_i = 1;
- if(!had_i) return -1;
- }
+{
+ static int had_i=0;
+ if(s->pict_type == FF_I_TYPE) had_i=1;
+ if(!had_i) return -1;
+}
#endif
- s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
- if(s->qscale == 0)
- {
+ s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
+ if(s->qscale==0){
av_log(s->avctx, AV_LOG_ERROR, "invalid qscale\n");
return -1;
}
- if(s->pict_type == FF_I_TYPE)
- {
+ if (s->pict_type == FF_I_TYPE) {
code = get_bits(&s->gb, 5);
- if(s->msmpeg4_version == 1)
- {
- if(code == 0 || code > s->mb_height)
- {
+ if(s->msmpeg4_version==1){
+ if(code==0 || code>s->mb_height){
av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code);
return -1;
}
s->slice_height = code;
- }
- else
- {
+ }else{
/* 0x17: one slice, 0x18: two slices, ... */
- if(code < 0x17)
- {
+ if (code < 0x17){
av_log(s->avctx, AV_LOG_ERROR, "error, slice code was %X\n", code);
return -1;
}
@@ -1683,8 +1443,7 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
s->slice_height = s->mb_height / (code - 0x16);
}
- switch(s->msmpeg4_version)
- {
+ switch(s->msmpeg4_version){
case 1:
case 2:
s->rl_chroma_table_index = 2;
@@ -1699,38 +1458,34 @@ 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);
+ 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;
+ if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
+ else s->per_mb_rl_table= 0;
- if(!s->per_mb_rl_table)
- {
+ if(!s->per_mb_rl_table){
s->rl_chroma_table_index = decode012(&s->gb);
s->rl_table_index = decode012(&s->gb);
}
s->dc_table_index = get_bits1(&s->gb);
- s->inter_intra_pred = 0;
+ s->inter_intra_pred= 0;
break;
}
s->no_rounding = 1;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n",
- s->qscale,
- s->rl_chroma_table_index,
- s->rl_table_index,
- s->dc_table_index,
- s->per_mb_rl_table,
- s->slice_height);
- }
- else
- {
- switch(s->msmpeg4_version)
- {
+ s->qscale,
+ s->rl_chroma_table_index,
+ s->rl_table_index,
+ s->dc_table_index,
+ s->per_mb_rl_table,
+ s->slice_height);
+ } else {
+ switch(s->msmpeg4_version){
case 1:
case 2:
- if(s->msmpeg4_version == 1)
+ if(s->msmpeg4_version==1)
s->use_skip_mb_code = 1;
else
s->use_skip_mb_code = get_bits1(&s->gb);
@@ -1751,11 +1506,10 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
case 4:
s->use_skip_mb_code = get_bits1(&s->gb);
- if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table = get_bits1(&s->gb);
- else s->per_mb_rl_table = 0;
+ if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
+ else s->per_mb_rl_table= 0;
- if(!s->per_mb_rl_table)
- {
+ if(!s->per_mb_rl_table){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
}
@@ -1763,58 +1517,55 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
s->dc_table_index = get_bits1(&s->gb);
s->mv_table_index = get_bits1(&s->gb);
- s->inter_intra_pred = (s->width*s->height < 320 * 240 && s->bit_rate <= II_BITRATE);
+ s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
break;
}
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n",
- s->use_skip_mb_code,
- s->rl_table_index,
- s->rl_chroma_table_index,
- s->dc_table_index,
- s->mv_table_index,
- s->per_mb_rl_table,
- s->qscale);
-
- if(s->flipflop_rounding)
- {
+ s->use_skip_mb_code,
+ s->rl_table_index,
+ s->rl_chroma_table_index,
+ s->dc_table_index,
+ s->mv_table_index,
+ s->per_mb_rl_table,
+ s->qscale);
+
+ if(s->flipflop_rounding){
s->no_rounding ^= 1;
- }
- else
- {
+ }else{
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);
- s->esc3_level_length = 0;
- s->esc3_run_length = 0;
+ s->esc3_level_length= 0;
+ s->esc3_run_length= 0;
return 0;
}
int 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;
+ int left= buf_size*8 - get_bits_count(&s->gb);
+ int length= s->msmpeg4_version>=3 ? 17 : 16;
/* the alt_bitstream reader could read over the end so we need to check it */
- if(left >= length && left < length + 8)
+ if(left>=length && left<length+8)
{
int fps;
- fps = get_bits(&s->gb, 5);
- s->bit_rate = get_bits(&s->gb, 11) * 1024;
- if(s->msmpeg4_version >= 3)
- s->flipflop_rounding = get_bits1(&s->gb);
+ fps= get_bits(&s->gb, 5);
+ s->bit_rate= get_bits(&s->gb, 11)*1024;
+ if(s->msmpeg4_version>=3)
+ s->flipflop_rounding= get_bits1(&s->gb);
else
- s->flipflop_rounding = 0;
+ 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)
+ else if(left<length+8)
{
- s->flipflop_rounding = 0;
+ s->flipflop_rounding= 0;
if(s->msmpeg4_version != 2)
av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
}
@@ -1830,71 +1581,52 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
{
int level, pred;
- if(s->msmpeg4_version <= 2)
- {
- if(n < 4)
- {
+ if(s->msmpeg4_version<=2){
+ if (n < 4) {
level = get_vlc2(&s->gb, v2_dc_lum_vlc.table, DC_VLC_BITS, 3);
- }
- else
- {
+ } else {
level = get_vlc2(&s->gb, v2_dc_chroma_vlc.table, DC_VLC_BITS, 3);
}
- if(level < 0)
+ if (level < 0)
return -1;
- level -= 256;
- }
- else //FIXME optimize use unified tables & index
- {
- if(n < 4)
- {
+ level-=256;
+ }else{ //FIXME optimize use unified tables & index
+ if (n < 4) {
level = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
- }
- else
- {
+ } else {
level = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
- if(level < 0)
- {
+ if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
return -1;
}
- if(level == DC_MAX)
- {
+ if (level == DC_MAX) {
level = get_bits(&s->gb, 8);
- if(get_bits1(&s->gb))
+ if (get_bits1(&s->gb))
level = -level;
- }
- else if(level != 0)
- {
- if(get_bits1(&s->gb))
+ } else if (level != 0) {
+ if (get_bits1(&s->gb))
level = -level;
}
}
- if(s->msmpeg4_version == 1)
- {
+ if(s->msmpeg4_version==1){
int32_t *dc_val;
pred = msmpeg4v1_pred_dc(s, n, &dc_val);
level += pred;
/* update predictor */
- *dc_val = level;
- }
- else
- {
+ *dc_val= level;
+ }else{
int16_t *dc_val;
pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
level += pred;
/* update predictor */
- if(n < 4)
- {
+ if (n < 4) {
*dc_val = level * s->y_dc_scale;
- }
- else
- {
+ } else {
*dc_val = level * s->c_dc_scale;
}
}
@@ -1904,7 +1636,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
//#define ERROR_DETAILS
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
- int n, int coded, const uint8_t *scan_table)
+ int n, int coded, const uint8_t *scan_table)
{
int level, i, last, run, run_diff;
int av_uninit(dc_pred_dir);
@@ -1912,34 +1644,27 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
RL_VLC_ELEM *rl_vlc;
int qmul, qadd;
- if(s->mb_intra)
- {
- qmul = 1;
- qadd = 0;
+ if (s->mb_intra) {
+ qmul=1;
+ qadd=0;
/* DC coef */
level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
- if(level < 0)
- {
+ if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
- if(s->inter_intra_pred) level = 0;
+ if(s->inter_intra_pred) level=0;
else return -1;
}
- if(n < 4)
- {
+ if (n < 4) {
rl = &rl_table[s->rl_table_index];
- if(level > 256 * s->y_dc_scale)
- {
+ 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
- {
+ } else {
rl = &rl_table[3 + s->rl_chroma_table_index];
- if(level > 256 * s->c_dc_scale)
- {
+ 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;
}
@@ -1948,261 +1673,217 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
run_diff = s->msmpeg4_version >= 4;
i = 0;
- if(!coded)
- {
+ if (!coded) {
goto not_coded;
}
- if(s->ac_pred)
- {
- if(dc_pred_dir == 0)
+ if (s->ac_pred) {
+ if (dc_pred_dir == 0)
scan_table = s->intra_v_scantable.permutated; /* left */
else
scan_table = s->intra_h_scantable.permutated; /* top */
- }
- else
- {
+ } else {
scan_table = s->intra_scantable.permutated;
}
- rl_vlc = rl->rl_vlc[0];
- }
- else
- {
+ rl_vlc= rl->rl_vlc[0];
+ } else {
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
i = -1;
rl = &rl_table[3 + s->rl_table_index];
- if(s->msmpeg4_version == 2)
+ if(s->msmpeg4_version==2)
run_diff = 0;
else
run_diff = 1;
- if(!coded)
- {
+ if (!coded) {
s->block_last_index[n] = i;
return 0;
}
if(!scan_table)
scan_table = s->inter_scantable.permutated;
- rl_vlc = rl->rl_vlc[s->qscale];
- }
- {
- OPEN_READER(re, &s->gb);
- for(;;)
- {
- UPDATE_CACHE(re, &s->gb);
- GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
- if(level == 0)
- {
- int cache;
- cache = GET_CACHE(re, &s->gb);
- /* escape */
- if(s->msmpeg4_version == 1 || (cache & 0x80000000) == 0)
- {
- if(s->msmpeg4_version == 1 || (cache & 0x40000000) == 0)
- {
- /* third escape */
- if(s->msmpeg4_version != 1) LAST_SKIP_BITS(re, &s->gb, 2);
- UPDATE_CACHE(re, &s->gb);
- if(s->msmpeg4_version <= 3)
- {
- last = SHOW_UBITS(re, &s->gb, 1);
- SKIP_CACHE(re, &s->gb, 1);
- run = SHOW_UBITS(re, &s->gb, 6);
- SKIP_CACHE(re, &s->gb, 6);
- level = SHOW_SBITS(re, &s->gb, 8);
- LAST_SKIP_CACHE(re, &s->gb, 8);
- SKIP_COUNTER(re, &s->gb, 1 + 6 + 8);
- }
- else
- {
- int sign;
- 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);
- if(s->qscale < 8)
- {
- ll = SHOW_UBITS(re, &s->gb, 3);
- SKIP_BITS(re, &s->gb, 3);
- if(ll == 0)
- {
- if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
- SKIP_BITS(re, &s->gb, 1);
- ll = 8;
- }
+ rl_vlc= rl->rl_vlc[s->qscale];
+ }
+ {
+ OPEN_READER(re, &s->gb);
+ for(;;) {
+ UPDATE_CACHE(re, &s->gb);
+ GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
+ if (level==0) {
+ int cache;
+ cache= GET_CACHE(re, &s->gb);
+ /* escape */
+ if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
+ if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
+ /* third escape */
+ if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
+ UPDATE_CACHE(re, &s->gb);
+ if(s->msmpeg4_version<=3){
+ last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
+ run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
+ level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8);
+ SKIP_COUNTER(re, &s->gb, 1+6+8);
+ }else{
+ int sign;
+ 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);
+ if(s->qscale<8){
+ ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
+ if(ll==0){
+ if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
+ SKIP_BITS(re, &s->gb, 1);
+ ll=8;
}
- else
- {
- ll = 2;
- while(ll < 8 && SHOW_UBITS(re, &s->gb, 1) == 0)
- {
- ll++;
- SKIP_BITS(re, &s->gb, 1);
- }
- if(ll < 8) SKIP_BITS(re, &s->gb, 1);
+ }else{
+ ll=2;
+ while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
+ ll++;
+ SKIP_BITS(re, &s->gb, 1);
}
+ if(ll<8) SKIP_BITS(re, &s->gb, 1);
+ }
- s->esc3_level_length = ll;
- s->esc3_run_length = SHOW_UBITS(re, &s->gb, 2) + 3;
- SKIP_BITS(re, &s->gb, 2);
+ 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);
- SKIP_BITS(re, &s->gb, s->esc3_run_length);
+ UPDATE_CACHE(re, &s->gb);
+ }
+ run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
+ SKIP_BITS(re, &s->gb, s->esc3_run_length);
- sign = SHOW_UBITS(re, &s->gb, 1);
- SKIP_BITS(re, &s->gb, 1);
+ sign= SHOW_UBITS(re, &s->gb, 1);
+ SKIP_BITS(re, &s->gb, 1);
- level = SHOW_UBITS(re, &s->gb, s->esc3_level_length);
- SKIP_BITS(re, &s->gb, s->esc3_level_length);
- if(sign) level = -level;
- }
+ level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
+ 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);
- const int run1 = run - rl->max_run[last][abs_level] - run_diff;
- if(abs_level <= MAX_LEVEL && run <= MAX_RUN)
- {
- if(abs_level <= rl->max_level[last][run])
- {
- av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
- return DECODING_AC_LOST;
- }
- if(abs_level <= rl->max_level[last][run] * 2)
- {
- av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
- return DECODING_AC_LOST;
- }
- if(run1 >= 0 && abs_level <= rl->max_level[last][run1])
- {
- av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
- return DECODING_AC_LOST;
- }
+ {
+ const int abs_level= FFABS(level);
+ const int run1= run - rl->max_run[last][abs_level] - run_diff;
+ if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
+ if(abs_level <= rl->max_level[last][run]){
+ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
+ return DECODING_AC_LOST;
+ }
+ if(abs_level <= rl->max_level[last][run]*2){
+ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
+ return DECODING_AC_LOST;
+ }
+ if(run1>=0 && abs_level <= rl->max_level[last][run1]){
+ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
+ return DECODING_AC_LOST;
}
}
+ }
#endif
- //level = level * qmul + (level>0) * qadd - (level<=0) * qadd ;
- if(level > 0) level = level * qmul + qadd;
- else level = level * qmul - qadd;
+ //level = level * qmul + (level>0) * qadd - (level<=0) * qadd ;
+ if (level>0) level= level * qmul + qadd;
+ else level= level * qmul - qadd;
#if 0 // waste of time too :(
- if(level > 2048 || level < -2048)
- {
- av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
- return DECODING_AC_LOST;
- }
-#endif
- i += run + 1;
- if(last) i += 192;
-#ifdef ERROR_DETAILS
- if(run == 66)
- av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
- else if((i > 62 && i < 192) || i > 192 + 63)
- av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
-#endif
+ if(level>2048 || level<-2048){
+ av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
+ return DECODING_AC_LOST;
}
- else
- {
- /* second escape */
-#if MIN_CACHE_BITS < 23
- LAST_SKIP_BITS(re, &s->gb, 2);
- UPDATE_CACHE(re, &s->gb);
-#else
- SKIP_BITS(re, &s->gb, 2);
#endif
- GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
- i += run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing
- level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
- LAST_SKIP_BITS(re, &s->gb, 1);
+ i+= run + 1;
+ if(last) i+=192;
#ifdef ERROR_DETAILS
- if(run == 66)
- av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
- else if((i > 62 && i < 192) || i > 192 + 63)
- av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
+ if(run==66)
+ av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
+ else if((i>62 && i<192) || i>192+63)
+ av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
#endif
- }
- }
- else
- {
- /* first escape */
-#if MIN_CACHE_BITS < 22
- LAST_SKIP_BITS(re, &s->gb, 1);
+ } else {
+ /* second escape */
+#if MIN_CACHE_BITS < 23
+ LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
#else
- SKIP_BITS(re, &s->gb, 1);
+ SKIP_BITS(re, &s->gb, 2);
#endif
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
- i += run;
- level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
+ i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
- if(run == 66)
- av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
- else if((i > 62 && i < 192) || i > 192 + 63)
- av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
+ if(run==66)
+ av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
+ else if((i>62 && i<192) || i>192+63)
+ av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
#endif
}
- }
- else
- {
- i += run;
+ } else {
+ /* first escape */
+#if MIN_CACHE_BITS < 22
+ LAST_SKIP_BITS(re, &s->gb, 1);
+ UPDATE_CACHE(re, &s->gb);
+#else
+ SKIP_BITS(re, &s->gb, 1);
+#endif
+ GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
+ i+= run;
+ level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
- if(run == 66)
+ if(run==66)
+ av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
+ else if((i>62 && i<192) || i>192+63)
+ av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
+#endif
+ }
+ } else {
+ i+= run;
+ level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
+ LAST_SKIP_BITS(re, &s->gb, 1);
+#ifdef ERROR_DETAILS
+ if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
- else if((i > 62 && i < 192) || i > 192 + 63)
+ else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
#endif
- }
- if(i > 62)
- {
- i -= 192;
- if(i&(~63))
- {
- const int left = get_bits_left(&s->gb);
- if(((i + 192 == 64 && level / qmul == -1) || s->error_recognition <= 1) && left >= 0)
- {
- av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
- break;
- }
- else
- {
- av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
- return -1;
- }
+ }
+ if (i > 62){
+ i-= 192;
+ if(i&(~63)){
+ const int left= get_bits_left(&s->gb);
+ if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){
+ av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
+ break;
+ }else{
+ av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
+ return -1;
}
-
- block[scan_table[i]] = level;
- break;
}
block[scan_table[i]] = level;
+ break;
}
- CLOSE_READER(re, &s->gb);
+
+ block[scan_table[i]] = level;
}
-not_coded:
- if(s->mb_intra)
- {
+ CLOSE_READER(re, &s->gb);
+ }
+ not_coded:
+ if (s->mb_intra) {
mpeg4_pred_ac(s, block, n, dc_pred_dir);
- if(s->ac_pred)
- {
+ if (s->ac_pred) {
i = 63; /* XXX: not optimal */
}
}
- if(s->msmpeg4_version >= 4 && i > 0) i = 63; //FIXME/XXX optimize
+ if(s->msmpeg4_version>=4 && i>0) i=63; //FIXME/XXX optimize
s->block_last_index[n] = i;
return 0;
}
int ff_msmpeg4_decode_motion(MpegEncContext * s,
- int *mx_ptr, int *my_ptr)
+ int *mx_ptr, int *my_ptr)
{
MVTable *mv;
int code, mx, my;
@@ -2210,19 +1891,15 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
mv = &mv_tables[s->mv_table_index];
code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0){
av_log(s->avctx, AV_LOG_ERROR, "illegal MV code at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- if(code == mv->n)
- {
+ 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
- {
+ } else {
mx = mv->table_mvx[code];
my = mv->table_mvy[code];
}
@@ -2230,22 +1907,21 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
mx += *mx_ptr - 32;
my += *my_ptr - 32;
/* WARNING : they do not do exactly modulo encoding */
- if(mx <= -64)
+ if (mx <= -64)
mx += 64;
- else if(mx >= 64)
+ else if (mx >= 64)
mx -= 64;
- if(my <= -64)
+ if (my <= -64)
my += 64;
- else if(my >= 64)
+ else if (my >= 64)
my -= 64;
*mx_ptr = mx;
*my_ptr = my;
return 0;
}
-AVCodec msmpeg4v1_decoder =
-{
+AVCodec msmpeg4v1_decoder = {
"msmpeg4v1",
CODEC_TYPE_VIDEO,
CODEC_ID_MSMPEG4V1,
@@ -2262,8 +1938,7 @@ AVCodec msmpeg4v1_decoder =
/*.long_name = */NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
};
-AVCodec msmpeg4v2_decoder =
-{
+AVCodec msmpeg4v2_decoder = {
"msmpeg4v2",
CODEC_TYPE_VIDEO,
CODEC_ID_MSMPEG4V2,
@@ -2280,8 +1955,7 @@ AVCodec msmpeg4v2_decoder =
/*.long_name = */NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
};
-AVCodec msmpeg4v3_decoder =
-{
+AVCodec msmpeg4v3_decoder = {
"msmpeg4",
CODEC_TYPE_VIDEO,
CODEC_ID_MSMPEG4V3,
@@ -2298,8 +1972,7 @@ AVCodec msmpeg4v3_decoder =
/*.long_name = */NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
};
-AVCodec wmv1_decoder =
-{
+AVCodec wmv1_decoder = {
"wmv1",
CODEC_TYPE_VIDEO,
CODEC_ID_WMV1,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.c
index 5cf0699e2..cfef62b12 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.c
@@ -34,580 +34,562 @@ VLC ff_msmp4_dc_luma_vlc[2];
VLC ff_msmp4_dc_chroma_vlc[2];
/* intra picture macroblock coded block pattern */
-const uint16_t ff_msmp4_mb_i_table[64][2] =
-{
- { 0x1, 1 }, { 0x17, 6 }, { 0x9, 5 }, { 0x5, 5 },
- { 0x6, 5 }, { 0x47, 9 }, { 0x20, 7 }, { 0x10, 7 },
- { 0x2, 5 }, { 0x7c, 9 }, { 0x3a, 7 }, { 0x1d, 7 },
- { 0x2, 6 }, { 0xec, 9 }, { 0x77, 8 }, { 0x0, 8 },
- { 0x3, 5 }, { 0xb7, 9 }, { 0x2c, 7 }, { 0x13, 7 },
- { 0x1, 6 }, { 0x168, 10 }, { 0x46, 8 }, { 0x3f, 8 },
- { 0x1e, 6 }, { 0x712, 13 }, { 0xb5, 9 }, { 0x42, 8 },
- { 0x22, 7 }, { 0x1c5, 11 }, { 0x11e, 10 }, { 0x87, 9 },
- { 0x6, 4 }, { 0x3, 9 }, { 0x1e, 7 }, { 0x1c, 6 },
- { 0x12, 7 }, { 0x388, 12 }, { 0x44, 9 }, { 0x70, 9 },
- { 0x1f, 6 }, { 0x23e, 11 }, { 0x39, 8 }, { 0x8e, 9 },
- { 0x1, 7 }, { 0x1c6, 11 }, { 0xb6, 9 }, { 0x45, 9 },
- { 0x14, 6 }, { 0x23f, 11 }, { 0x7d, 9 }, { 0x18, 9 },
- { 0x7, 7 }, { 0x1c7, 11 }, { 0x86, 9 }, { 0x19, 9 },
- { 0x15, 6 }, { 0x1db, 10 }, { 0x2, 9 }, { 0x46, 9 },
- { 0xd, 8 }, { 0x713, 13 }, { 0x1da, 10 }, { 0x169, 10 },
+const uint16_t ff_msmp4_mb_i_table[64][2] = {
+{ 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 },
+{ 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 },
+{ 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 },
+{ 0x2, 6 },{ 0xec, 9 },{ 0x77, 8 },{ 0x0, 8 },
+{ 0x3, 5 },{ 0xb7, 9 },{ 0x2c, 7 },{ 0x13, 7 },
+{ 0x1, 6 },{ 0x168, 10 },{ 0x46, 8 },{ 0x3f, 8 },
+{ 0x1e, 6 },{ 0x712, 13 },{ 0xb5, 9 },{ 0x42, 8 },
+{ 0x22, 7 },{ 0x1c5, 11 },{ 0x11e, 10 },{ 0x87, 9 },
+{ 0x6, 4 },{ 0x3, 9 },{ 0x1e, 7 },{ 0x1c, 6 },
+{ 0x12, 7 },{ 0x388, 12 },{ 0x44, 9 },{ 0x70, 9 },
+{ 0x1f, 6 },{ 0x23e, 11 },{ 0x39, 8 },{ 0x8e, 9 },
+{ 0x1, 7 },{ 0x1c6, 11 },{ 0xb6, 9 },{ 0x45, 9 },
+{ 0x14, 6 },{ 0x23f, 11 },{ 0x7d, 9 },{ 0x18, 9 },
+{ 0x7, 7 },{ 0x1c7, 11 },{ 0x86, 9 },{ 0x19, 9 },
+{ 0x15, 6 },{ 0x1db, 10 },{ 0x2, 9 },{ 0x46, 9 },
+{ 0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 },
};
/* non intra picture macroblock coded block pattern + mb type */
-const uint32_t 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 },
- { 0x79, 13 }, { 0xa82, 18 }, { 0x969d, 16 }, { 0x2a4, 16 },
- { 0x978, 12 }, { 0x543, 17 }, { 0x41df, 15 }, { 0x7f9, 17 },
- { 0x12f3, 13 }, { 0x25a6b, 18 }, { 0x25ef9, 18 }, { 0x3fa, 16 },
- { 0x20ee, 14 }, { 0x969ab, 20 }, { 0x969c, 16 }, { 0x25ef8, 18 },
- { 0x12d2, 13 }, { 0xa85, 18 }, { 0x969e, 16 }, { 0x4bc8, 15 },
- { 0x3d, 12 }, { 0x12f7f, 17 }, { 0x2a2, 16 }, { 0x969f, 16 },
- { 0x25ee, 14 }, { 0x12d355, 21 }, { 0x12f7d, 17 }, { 0x12f7e, 17 },
- { 0x9e5, 12 }, { 0xa81, 18 }, { 0x4b4d4, 19 }, { 0x83bd, 16 },
- { 0x78, 13 }, { 0x969b, 16 }, { 0x3fe, 16 }, { 0x2a5, 16 },
- { 0x7e, 13 }, { 0xa80, 18 }, { 0x2a3, 16 }, { 0x3fb, 16 },
- { 0x1076, 13 }, { 0xa84, 18 }, { 0x153, 15 }, { 0x4bc9, 15 },
- { 0x55, 13 }, { 0x12d354, 21 }, { 0x4bde, 15 }, { 0x25e5, 14 },
- { 0x25b, 10 }, { 0x4b4c, 15 }, { 0x96b, 12 }, { 0x96a, 12 },
- { 0x1, 2 }, { 0x0, 7 }, { 0x26, 6 }, { 0x12b, 9 },
- { 0x7, 3 }, { 0x20f, 10 }, { 0x4, 9 }, { 0x28, 12 },
- { 0x6, 3 }, { 0x20a, 10 }, { 0x128, 9 }, { 0x2b, 12 },
- { 0x11, 5 }, { 0x1b, 11 }, { 0x13a, 9 }, { 0x4ff, 11 },
- { 0x3, 4 }, { 0x277, 10 }, { 0x106, 9 }, { 0x839, 12 },
- { 0xb, 4 }, { 0x27b, 10 }, { 0x12c, 9 }, { 0x4bf, 11 },
- { 0x9, 6 }, { 0x35, 12 }, { 0x27e, 10 }, { 0x13c8, 13 },
- { 0x1, 6 }, { 0x4aa, 11 }, { 0x208, 10 }, { 0x29, 12 },
- { 0x1, 4 }, { 0x254, 10 }, { 0x12e, 9 }, { 0x838, 12 },
- { 0x24, 6 }, { 0x4f3, 11 }, { 0x276, 10 }, { 0x12f6, 13 },
- { 0x1, 5 }, { 0x27a, 10 }, { 0x13e, 9 }, { 0x3e, 12 },
- { 0x8, 6 }, { 0x413, 11 }, { 0xc, 10 }, { 0x4be, 11 },
- { 0x14, 5 }, { 0x412, 11 }, { 0x253, 10 }, { 0x97a, 12 },
- { 0x21, 6 }, { 0x4ab, 11 }, { 0x20b, 10 }, { 0x34, 12 },
- { 0x15, 5 }, { 0x278, 10 }, { 0x252, 10 }, { 0x968, 12 },
- { 0x5, 5 }, { 0xb, 10 }, { 0x9c, 8 }, { 0xe, 10 },
+const uint32_t 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 },
+{ 0x79, 13 },{ 0xa82, 18 },{ 0x969d, 16 },{ 0x2a4, 16 },
+{ 0x978, 12 },{ 0x543, 17 },{ 0x41df, 15 },{ 0x7f9, 17 },
+{ 0x12f3, 13 },{ 0x25a6b, 18 },{ 0x25ef9, 18 },{ 0x3fa, 16 },
+{ 0x20ee, 14 },{ 0x969ab, 20 },{ 0x969c, 16 },{ 0x25ef8, 18 },
+{ 0x12d2, 13 },{ 0xa85, 18 },{ 0x969e, 16 },{ 0x4bc8, 15 },
+{ 0x3d, 12 },{ 0x12f7f, 17 },{ 0x2a2, 16 },{ 0x969f, 16 },
+{ 0x25ee, 14 },{ 0x12d355, 21 },{ 0x12f7d, 17 },{ 0x12f7e, 17 },
+{ 0x9e5, 12 },{ 0xa81, 18 },{ 0x4b4d4, 19 },{ 0x83bd, 16 },
+{ 0x78, 13 },{ 0x969b, 16 },{ 0x3fe, 16 },{ 0x2a5, 16 },
+{ 0x7e, 13 },{ 0xa80, 18 },{ 0x2a3, 16 },{ 0x3fb, 16 },
+{ 0x1076, 13 },{ 0xa84, 18 },{ 0x153, 15 },{ 0x4bc9, 15 },
+{ 0x55, 13 },{ 0x12d354, 21 },{ 0x4bde, 15 },{ 0x25e5, 14 },
+{ 0x25b, 10 },{ 0x4b4c, 15 },{ 0x96b, 12 },{ 0x96a, 12 },
+{ 0x1, 2 },{ 0x0, 7 },{ 0x26, 6 },{ 0x12b, 9 },
+{ 0x7, 3 },{ 0x20f, 10 },{ 0x4, 9 },{ 0x28, 12 },
+{ 0x6, 3 },{ 0x20a, 10 },{ 0x128, 9 },{ 0x2b, 12 },
+{ 0x11, 5 },{ 0x1b, 11 },{ 0x13a, 9 },{ 0x4ff, 11 },
+{ 0x3, 4 },{ 0x277, 10 },{ 0x106, 9 },{ 0x839, 12 },
+{ 0xb, 4 },{ 0x27b, 10 },{ 0x12c, 9 },{ 0x4bf, 11 },
+{ 0x9, 6 },{ 0x35, 12 },{ 0x27e, 10 },{ 0x13c8, 13 },
+{ 0x1, 6 },{ 0x4aa, 11 },{ 0x208, 10 },{ 0x29, 12 },
+{ 0x1, 4 },{ 0x254, 10 },{ 0x12e, 9 },{ 0x838, 12 },
+{ 0x24, 6 },{ 0x4f3, 11 },{ 0x276, 10 },{ 0x12f6, 13 },
+{ 0x1, 5 },{ 0x27a, 10 },{ 0x13e, 9 },{ 0x3e, 12 },
+{ 0x8, 6 },{ 0x413, 11 },{ 0xc, 10 },{ 0x4be, 11 },
+{ 0x14, 5 },{ 0x412, 11 },{ 0x253, 10 },{ 0x97a, 12 },
+{ 0x21, 6 },{ 0x4ab, 11 },{ 0x20b, 10 },{ 0x34, 12 },
+{ 0x15, 5 },{ 0x278, 10 },{ 0x252, 10 },{ 0x968, 12 },
+{ 0x5, 5 },{ 0xb, 10 },{ 0x9c, 8 },{ 0xe, 10 },
};
/* dc table 0 */
-const uint32_t ff_table0_dc_lum[120][2] =
-{
- { 0x1, 1 }, { 0x1, 2 }, { 0x1, 4 }, { 0x1, 5 },
- { 0x5, 5 }, { 0x7, 5 }, { 0x8, 6 }, { 0xc, 6 },
- { 0x0, 7 }, { 0x2, 7 }, { 0x12, 7 }, { 0x1a, 7 },
- { 0x3, 8 }, { 0x7, 8 }, { 0x27, 8 }, { 0x37, 8 },
- { 0x5, 9 }, { 0x4c, 9 }, { 0x6c, 9 }, { 0x6d, 9 },
- { 0x8, 10 }, { 0x19, 10 }, { 0x9b, 10 }, { 0x1b, 10 },
- { 0x9a, 10 }, { 0x13, 11 }, { 0x34, 11 }, { 0x35, 11 },
- { 0x61, 12 }, { 0x48, 13 }, { 0xc4, 13 }, { 0x4a, 13 },
- { 0xc6, 13 }, { 0xc7, 13 }, { 0x92, 14 }, { 0x18b, 14 },
- { 0x93, 14 }, { 0x183, 14 }, { 0x182, 14 }, { 0x96, 14 },
- { 0x97, 14 }, { 0x180, 14 }, { 0x314, 15 }, { 0x315, 15 },
- { 0x605, 16 }, { 0x604, 16 }, { 0x606, 16 }, { 0xc0e, 17 },
- { 0x303cd, 23 }, { 0x303c9, 23 }, { 0x303c8, 23 }, { 0x303ca, 23 },
- { 0x303cb, 23 }, { 0x303cc, 23 }, { 0x303ce, 23 }, { 0x303cf, 23 },
- { 0x303d0, 23 }, { 0x303d1, 23 }, { 0x303d2, 23 }, { 0x303d3, 23 },
- { 0x303d4, 23 }, { 0x303d5, 23 }, { 0x303d6, 23 }, { 0x303d7, 23 },
- { 0x303d8, 23 }, { 0x303d9, 23 }, { 0x303da, 23 }, { 0x303db, 23 },
- { 0x303dc, 23 }, { 0x303dd, 23 }, { 0x303de, 23 }, { 0x303df, 23 },
- { 0x303e0, 23 }, { 0x303e1, 23 }, { 0x303e2, 23 }, { 0x303e3, 23 },
- { 0x303e4, 23 }, { 0x303e5, 23 }, { 0x303e6, 23 }, { 0x303e7, 23 },
- { 0x303e8, 23 }, { 0x303e9, 23 }, { 0x303ea, 23 }, { 0x303eb, 23 },
- { 0x303ec, 23 }, { 0x303ed, 23 }, { 0x303ee, 23 }, { 0x303ef, 23 },
- { 0x303f0, 23 }, { 0x303f1, 23 }, { 0x303f2, 23 }, { 0x303f3, 23 },
- { 0x303f4, 23 }, { 0x303f5, 23 }, { 0x303f6, 23 }, { 0x303f7, 23 },
- { 0x303f8, 23 }, { 0x303f9, 23 }, { 0x303fa, 23 }, { 0x303fb, 23 },
- { 0x303fc, 23 }, { 0x303fd, 23 }, { 0x303fe, 23 }, { 0x303ff, 23 },
- { 0x60780, 24 }, { 0x60781, 24 }, { 0x60782, 24 }, { 0x60783, 24 },
- { 0x60784, 24 }, { 0x60785, 24 }, { 0x60786, 24 }, { 0x60787, 24 },
- { 0x60788, 24 }, { 0x60789, 24 }, { 0x6078a, 24 }, { 0x6078b, 24 },
- { 0x6078c, 24 }, { 0x6078d, 24 }, { 0x6078e, 24 }, { 0x6078f, 24 },
+const uint32_t ff_table0_dc_lum[120][2] = {
+{ 0x1, 1 },{ 0x1, 2 },{ 0x1, 4 },{ 0x1, 5 },
+{ 0x5, 5 },{ 0x7, 5 },{ 0x8, 6 },{ 0xc, 6 },
+{ 0x0, 7 },{ 0x2, 7 },{ 0x12, 7 },{ 0x1a, 7 },
+{ 0x3, 8 },{ 0x7, 8 },{ 0x27, 8 },{ 0x37, 8 },
+{ 0x5, 9 },{ 0x4c, 9 },{ 0x6c, 9 },{ 0x6d, 9 },
+{ 0x8, 10 },{ 0x19, 10 },{ 0x9b, 10 },{ 0x1b, 10 },
+{ 0x9a, 10 },{ 0x13, 11 },{ 0x34, 11 },{ 0x35, 11 },
+{ 0x61, 12 },{ 0x48, 13 },{ 0xc4, 13 },{ 0x4a, 13 },
+{ 0xc6, 13 },{ 0xc7, 13 },{ 0x92, 14 },{ 0x18b, 14 },
+{ 0x93, 14 },{ 0x183, 14 },{ 0x182, 14 },{ 0x96, 14 },
+{ 0x97, 14 },{ 0x180, 14 },{ 0x314, 15 },{ 0x315, 15 },
+{ 0x605, 16 },{ 0x604, 16 },{ 0x606, 16 },{ 0xc0e, 17 },
+{ 0x303cd, 23 },{ 0x303c9, 23 },{ 0x303c8, 23 },{ 0x303ca, 23 },
+{ 0x303cb, 23 },{ 0x303cc, 23 },{ 0x303ce, 23 },{ 0x303cf, 23 },
+{ 0x303d0, 23 },{ 0x303d1, 23 },{ 0x303d2, 23 },{ 0x303d3, 23 },
+{ 0x303d4, 23 },{ 0x303d5, 23 },{ 0x303d6, 23 },{ 0x303d7, 23 },
+{ 0x303d8, 23 },{ 0x303d9, 23 },{ 0x303da, 23 },{ 0x303db, 23 },
+{ 0x303dc, 23 },{ 0x303dd, 23 },{ 0x303de, 23 },{ 0x303df, 23 },
+{ 0x303e0, 23 },{ 0x303e1, 23 },{ 0x303e2, 23 },{ 0x303e3, 23 },
+{ 0x303e4, 23 },{ 0x303e5, 23 },{ 0x303e6, 23 },{ 0x303e7, 23 },
+{ 0x303e8, 23 },{ 0x303e9, 23 },{ 0x303ea, 23 },{ 0x303eb, 23 },
+{ 0x303ec, 23 },{ 0x303ed, 23 },{ 0x303ee, 23 },{ 0x303ef, 23 },
+{ 0x303f0, 23 },{ 0x303f1, 23 },{ 0x303f2, 23 },{ 0x303f3, 23 },
+{ 0x303f4, 23 },{ 0x303f5, 23 },{ 0x303f6, 23 },{ 0x303f7, 23 },
+{ 0x303f8, 23 },{ 0x303f9, 23 },{ 0x303fa, 23 },{ 0x303fb, 23 },
+{ 0x303fc, 23 },{ 0x303fd, 23 },{ 0x303fe, 23 },{ 0x303ff, 23 },
+{ 0x60780, 24 },{ 0x60781, 24 },{ 0x60782, 24 },{ 0x60783, 24 },
+{ 0x60784, 24 },{ 0x60785, 24 },{ 0x60786, 24 },{ 0x60787, 24 },
+{ 0x60788, 24 },{ 0x60789, 24 },{ 0x6078a, 24 },{ 0x6078b, 24 },
+{ 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 },
};
-const uint32_t ff_table0_dc_chroma[120][2] =
-{
- { 0x0, 2 }, { 0x1, 2 }, { 0x5, 3 }, { 0x9, 4 },
- { 0xd, 4 }, { 0x11, 5 }, { 0x1d, 5 }, { 0x1f, 5 },
- { 0x21, 6 }, { 0x31, 6 }, { 0x38, 6 }, { 0x33, 6 },
- { 0x39, 6 }, { 0x3d, 6 }, { 0x61, 7 }, { 0x79, 7 },
- { 0x80, 8 }, { 0xc8, 8 }, { 0xca, 8 }, { 0xf0, 8 },
- { 0x81, 8 }, { 0xc0, 8 }, { 0xc9, 8 }, { 0x107, 9 },
- { 0x106, 9 }, { 0x196, 9 }, { 0x183, 9 }, { 0x1e3, 9 },
- { 0x1e2, 9 }, { 0x20a, 10 }, { 0x20b, 10 }, { 0x609, 11 },
- { 0x412, 11 }, { 0x413, 11 }, { 0x60b, 11 }, { 0x411, 11 },
- { 0x60a, 11 }, { 0x65f, 11 }, { 0x410, 11 }, { 0x65d, 11 },
- { 0x65e, 11 }, { 0xcb8, 12 }, { 0xc10, 12 }, { 0xcb9, 12 },
- { 0x1823, 13 }, { 0x3045, 14 }, { 0x6089, 15 }, { 0xc110, 16 },
- { 0x304448, 22 }, { 0x304449, 22 }, { 0x30444a, 22 }, { 0x30444b, 22 },
- { 0x30444c, 22 }, { 0x30444d, 22 }, { 0x30444e, 22 }, { 0x30444f, 22 },
- { 0x304450, 22 }, { 0x304451, 22 }, { 0x304452, 22 }, { 0x304453, 22 },
- { 0x304454, 22 }, { 0x304455, 22 }, { 0x304456, 22 }, { 0x304457, 22 },
- { 0x304458, 22 }, { 0x304459, 22 }, { 0x30445a, 22 }, { 0x30445b, 22 },
- { 0x30445c, 22 }, { 0x30445d, 22 }, { 0x30445e, 22 }, { 0x30445f, 22 },
- { 0x304460, 22 }, { 0x304461, 22 }, { 0x304462, 22 }, { 0x304463, 22 },
- { 0x304464, 22 }, { 0x304465, 22 }, { 0x304466, 22 }, { 0x304467, 22 },
- { 0x304468, 22 }, { 0x304469, 22 }, { 0x30446a, 22 }, { 0x30446b, 22 },
- { 0x30446c, 22 }, { 0x30446d, 22 }, { 0x30446e, 22 }, { 0x30446f, 22 },
- { 0x304470, 22 }, { 0x304471, 22 }, { 0x304472, 22 }, { 0x304473, 22 },
- { 0x304474, 22 }, { 0x304475, 22 }, { 0x304476, 22 }, { 0x304477, 22 },
- { 0x304478, 22 }, { 0x304479, 22 }, { 0x30447a, 22 }, { 0x30447b, 22 },
- { 0x30447c, 22 }, { 0x30447d, 22 }, { 0x30447e, 22 }, { 0x30447f, 22 },
- { 0x608880, 23 }, { 0x608881, 23 }, { 0x608882, 23 }, { 0x608883, 23 },
- { 0x608884, 23 }, { 0x608885, 23 }, { 0x608886, 23 }, { 0x608887, 23 },
- { 0x608888, 23 }, { 0x608889, 23 }, { 0x60888a, 23 }, { 0x60888b, 23 },
- { 0x60888c, 23 }, { 0x60888d, 23 }, { 0x60888e, 23 }, { 0x60888f, 23 },
+const uint32_t ff_table0_dc_chroma[120][2] = {
+{ 0x0, 2 },{ 0x1, 2 },{ 0x5, 3 },{ 0x9, 4 },
+{ 0xd, 4 },{ 0x11, 5 },{ 0x1d, 5 },{ 0x1f, 5 },
+{ 0x21, 6 },{ 0x31, 6 },{ 0x38, 6 },{ 0x33, 6 },
+{ 0x39, 6 },{ 0x3d, 6 },{ 0x61, 7 },{ 0x79, 7 },
+{ 0x80, 8 },{ 0xc8, 8 },{ 0xca, 8 },{ 0xf0, 8 },
+{ 0x81, 8 },{ 0xc0, 8 },{ 0xc9, 8 },{ 0x107, 9 },
+{ 0x106, 9 },{ 0x196, 9 },{ 0x183, 9 },{ 0x1e3, 9 },
+{ 0x1e2, 9 },{ 0x20a, 10 },{ 0x20b, 10 },{ 0x609, 11 },
+{ 0x412, 11 },{ 0x413, 11 },{ 0x60b, 11 },{ 0x411, 11 },
+{ 0x60a, 11 },{ 0x65f, 11 },{ 0x410, 11 },{ 0x65d, 11 },
+{ 0x65e, 11 },{ 0xcb8, 12 },{ 0xc10, 12 },{ 0xcb9, 12 },
+{ 0x1823, 13 },{ 0x3045, 14 },{ 0x6089, 15 },{ 0xc110, 16 },
+{ 0x304448, 22 },{ 0x304449, 22 },{ 0x30444a, 22 },{ 0x30444b, 22 },
+{ 0x30444c, 22 },{ 0x30444d, 22 },{ 0x30444e, 22 },{ 0x30444f, 22 },
+{ 0x304450, 22 },{ 0x304451, 22 },{ 0x304452, 22 },{ 0x304453, 22 },
+{ 0x304454, 22 },{ 0x304455, 22 },{ 0x304456, 22 },{ 0x304457, 22 },
+{ 0x304458, 22 },{ 0x304459, 22 },{ 0x30445a, 22 },{ 0x30445b, 22 },
+{ 0x30445c, 22 },{ 0x30445d, 22 },{ 0x30445e, 22 },{ 0x30445f, 22 },
+{ 0x304460, 22 },{ 0x304461, 22 },{ 0x304462, 22 },{ 0x304463, 22 },
+{ 0x304464, 22 },{ 0x304465, 22 },{ 0x304466, 22 },{ 0x304467, 22 },
+{ 0x304468, 22 },{ 0x304469, 22 },{ 0x30446a, 22 },{ 0x30446b, 22 },
+{ 0x30446c, 22 },{ 0x30446d, 22 },{ 0x30446e, 22 },{ 0x30446f, 22 },
+{ 0x304470, 22 },{ 0x304471, 22 },{ 0x304472, 22 },{ 0x304473, 22 },
+{ 0x304474, 22 },{ 0x304475, 22 },{ 0x304476, 22 },{ 0x304477, 22 },
+{ 0x304478, 22 },{ 0x304479, 22 },{ 0x30447a, 22 },{ 0x30447b, 22 },
+{ 0x30447c, 22 },{ 0x30447d, 22 },{ 0x30447e, 22 },{ 0x30447f, 22 },
+{ 0x608880, 23 },{ 0x608881, 23 },{ 0x608882, 23 },{ 0x608883, 23 },
+{ 0x608884, 23 },{ 0x608885, 23 },{ 0x608886, 23 },{ 0x608887, 23 },
+{ 0x608888, 23 },{ 0x608889, 23 },{ 0x60888a, 23 },{ 0x60888b, 23 },
+{ 0x60888c, 23 },{ 0x60888d, 23 },{ 0x60888e, 23 },{ 0x60888f, 23 },
};
/* dc table 1 */
-const uint32_t ff_table1_dc_lum[120][2] =
-{
- { 0x2, 2 }, { 0x3, 2 }, { 0x3, 3 }, { 0x2, 4 },
- { 0x5, 4 }, { 0x1, 5 }, { 0x3, 5 }, { 0x8, 5 },
- { 0x0, 6 }, { 0x5, 6 }, { 0xd, 6 }, { 0xf, 6 },
- { 0x13, 6 }, { 0x8, 7 }, { 0x18, 7 }, { 0x1c, 7 },
- { 0x24, 7 }, { 0x4, 8 }, { 0x6, 8 }, { 0x12, 8 },
- { 0x32, 8 }, { 0x3b, 8 }, { 0x4a, 8 }, { 0x4b, 8 },
- { 0xb, 9 }, { 0x26, 9 }, { 0x27, 9 }, { 0x66, 9 },
- { 0x74, 9 }, { 0x75, 9 }, { 0x14, 10 }, { 0x1c, 10 },
- { 0x1f, 10 }, { 0x1d, 10 }, { 0x2b, 11 }, { 0x3d, 11 },
- { 0x19d, 11 }, { 0x19f, 11 }, { 0x54, 12 }, { 0x339, 12 },
- { 0x338, 12 }, { 0x33d, 12 }, { 0xab, 13 }, { 0xf1, 13 },
- { 0x678, 13 }, { 0xf2, 13 }, { 0x1e0, 14 }, { 0x1e1, 14 },
- { 0x154, 14 }, { 0xcf2, 14 }, { 0x3cc, 15 }, { 0x2ab, 15 },
- { 0x19e7, 15 }, { 0x3ce, 15 }, { 0x19e6, 15 }, { 0x554, 16 },
- { 0x79f, 16 }, { 0x555, 16 }, { 0xf3d, 17 }, { 0xf37, 17 },
- { 0xf3c, 17 }, { 0xf35, 17 }, { 0x1e6d, 18 }, { 0x1e68, 18 },
- { 0x3cd8, 19 }, { 0x3cd3, 19 }, { 0x3cd9, 19 }, { 0x79a4, 20 },
- { 0xf34ba, 25 }, { 0xf34b4, 25 }, { 0xf34b5, 25 }, { 0xf34b6, 25 },
- { 0xf34b7, 25 }, { 0xf34b8, 25 }, { 0xf34b9, 25 }, { 0xf34bb, 25 },
- { 0xf34bc, 25 }, { 0xf34bd, 25 }, { 0xf34be, 25 }, { 0xf34bf, 25 },
- { 0x1e6940, 26 }, { 0x1e6941, 26 }, { 0x1e6942, 26 }, { 0x1e6943, 26 },
- { 0x1e6944, 26 }, { 0x1e6945, 26 }, { 0x1e6946, 26 }, { 0x1e6947, 26 },
- { 0x1e6948, 26 }, { 0x1e6949, 26 }, { 0x1e694a, 26 }, { 0x1e694b, 26 },
- { 0x1e694c, 26 }, { 0x1e694d, 26 }, { 0x1e694e, 26 }, { 0x1e694f, 26 },
- { 0x1e6950, 26 }, { 0x1e6951, 26 }, { 0x1e6952, 26 }, { 0x1e6953, 26 },
- { 0x1e6954, 26 }, { 0x1e6955, 26 }, { 0x1e6956, 26 }, { 0x1e6957, 26 },
- { 0x1e6958, 26 }, { 0x1e6959, 26 }, { 0x1e695a, 26 }, { 0x1e695b, 26 },
- { 0x1e695c, 26 }, { 0x1e695d, 26 }, { 0x1e695e, 26 }, { 0x1e695f, 26 },
- { 0x1e6960, 26 }, { 0x1e6961, 26 }, { 0x1e6962, 26 }, { 0x1e6963, 26 },
- { 0x1e6964, 26 }, { 0x1e6965, 26 }, { 0x1e6966, 26 }, { 0x1e6967, 26 },
+const uint32_t ff_table1_dc_lum[120][2] = {
+{ 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 },
+{ 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 },
+{ 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 },
+{ 0x13, 6 },{ 0x8, 7 },{ 0x18, 7 },{ 0x1c, 7 },
+{ 0x24, 7 },{ 0x4, 8 },{ 0x6, 8 },{ 0x12, 8 },
+{ 0x32, 8 },{ 0x3b, 8 },{ 0x4a, 8 },{ 0x4b, 8 },
+{ 0xb, 9 },{ 0x26, 9 },{ 0x27, 9 },{ 0x66, 9 },
+{ 0x74, 9 },{ 0x75, 9 },{ 0x14, 10 },{ 0x1c, 10 },
+{ 0x1f, 10 },{ 0x1d, 10 },{ 0x2b, 11 },{ 0x3d, 11 },
+{ 0x19d, 11 },{ 0x19f, 11 },{ 0x54, 12 },{ 0x339, 12 },
+{ 0x338, 12 },{ 0x33d, 12 },{ 0xab, 13 },{ 0xf1, 13 },
+{ 0x678, 13 },{ 0xf2, 13 },{ 0x1e0, 14 },{ 0x1e1, 14 },
+{ 0x154, 14 },{ 0xcf2, 14 },{ 0x3cc, 15 },{ 0x2ab, 15 },
+{ 0x19e7, 15 },{ 0x3ce, 15 },{ 0x19e6, 15 },{ 0x554, 16 },
+{ 0x79f, 16 },{ 0x555, 16 },{ 0xf3d, 17 },{ 0xf37, 17 },
+{ 0xf3c, 17 },{ 0xf35, 17 },{ 0x1e6d, 18 },{ 0x1e68, 18 },
+{ 0x3cd8, 19 },{ 0x3cd3, 19 },{ 0x3cd9, 19 },{ 0x79a4, 20 },
+{ 0xf34ba, 25 },{ 0xf34b4, 25 },{ 0xf34b5, 25 },{ 0xf34b6, 25 },
+{ 0xf34b7, 25 },{ 0xf34b8, 25 },{ 0xf34b9, 25 },{ 0xf34bb, 25 },
+{ 0xf34bc, 25 },{ 0xf34bd, 25 },{ 0xf34be, 25 },{ 0xf34bf, 25 },
+{ 0x1e6940, 26 },{ 0x1e6941, 26 },{ 0x1e6942, 26 },{ 0x1e6943, 26 },
+{ 0x1e6944, 26 },{ 0x1e6945, 26 },{ 0x1e6946, 26 },{ 0x1e6947, 26 },
+{ 0x1e6948, 26 },{ 0x1e6949, 26 },{ 0x1e694a, 26 },{ 0x1e694b, 26 },
+{ 0x1e694c, 26 },{ 0x1e694d, 26 },{ 0x1e694e, 26 },{ 0x1e694f, 26 },
+{ 0x1e6950, 26 },{ 0x1e6951, 26 },{ 0x1e6952, 26 },{ 0x1e6953, 26 },
+{ 0x1e6954, 26 },{ 0x1e6955, 26 },{ 0x1e6956, 26 },{ 0x1e6957, 26 },
+{ 0x1e6958, 26 },{ 0x1e6959, 26 },{ 0x1e695a, 26 },{ 0x1e695b, 26 },
+{ 0x1e695c, 26 },{ 0x1e695d, 26 },{ 0x1e695e, 26 },{ 0x1e695f, 26 },
+{ 0x1e6960, 26 },{ 0x1e6961, 26 },{ 0x1e6962, 26 },{ 0x1e6963, 26 },
+{ 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 },
};
-const uint32_t ff_table1_dc_chroma[120][2] =
-{
- { 0x0, 2 }, { 0x1, 2 }, { 0x4, 3 }, { 0x7, 3 },
- { 0xb, 4 }, { 0xd, 4 }, { 0x15, 5 }, { 0x28, 6 },
- { 0x30, 6 }, { 0x32, 6 }, { 0x52, 7 }, { 0x62, 7 },
- { 0x66, 7 }, { 0xa6, 8 }, { 0xc6, 8 }, { 0xcf, 8 },
- { 0x14f, 9 }, { 0x18e, 9 }, { 0x19c, 9 }, { 0x29d, 10 },
- { 0x33a, 10 }, { 0x538, 11 }, { 0x63c, 11 }, { 0x63e, 11 },
- { 0x63f, 11 }, { 0x676, 11 }, { 0xa73, 12 }, { 0xc7a, 12 },
- { 0xcef, 12 }, { 0x14e5, 13 }, { 0x19dd, 13 }, { 0x29c8, 14 },
- { 0x29c9, 14 }, { 0x63dd, 15 }, { 0x33b8, 14 }, { 0x33b9, 14 },
- { 0xc7b6, 16 }, { 0x63d8, 15 }, { 0x63df, 15 }, { 0xc7b3, 16 },
- { 0xc7b4, 16 }, { 0xc7b5, 16 }, { 0x63de, 15 }, { 0xc7b7, 16 },
- { 0xc7b8, 16 }, { 0xc7b9, 16 }, { 0x18f65, 17 }, { 0x31ec8, 18 },
- { 0xc7b248, 24 }, { 0xc7b249, 24 }, { 0xc7b24a, 24 }, { 0xc7b24b, 24 },
- { 0xc7b24c, 24 }, { 0xc7b24d, 24 }, { 0xc7b24e, 24 }, { 0xc7b24f, 24 },
- { 0xc7b250, 24 }, { 0xc7b251, 24 }, { 0xc7b252, 24 }, { 0xc7b253, 24 },
- { 0xc7b254, 24 }, { 0xc7b255, 24 }, { 0xc7b256, 24 }, { 0xc7b257, 24 },
- { 0xc7b258, 24 }, { 0xc7b259, 24 }, { 0xc7b25a, 24 }, { 0xc7b25b, 24 },
- { 0xc7b25c, 24 }, { 0xc7b25d, 24 }, { 0xc7b25e, 24 }, { 0xc7b25f, 24 },
- { 0xc7b260, 24 }, { 0xc7b261, 24 }, { 0xc7b262, 24 }, { 0xc7b263, 24 },
- { 0xc7b264, 24 }, { 0xc7b265, 24 }, { 0xc7b266, 24 }, { 0xc7b267, 24 },
- { 0xc7b268, 24 }, { 0xc7b269, 24 }, { 0xc7b26a, 24 }, { 0xc7b26b, 24 },
- { 0xc7b26c, 24 }, { 0xc7b26d, 24 }, { 0xc7b26e, 24 }, { 0xc7b26f, 24 },
- { 0xc7b270, 24 }, { 0xc7b271, 24 }, { 0xc7b272, 24 }, { 0xc7b273, 24 },
- { 0xc7b274, 24 }, { 0xc7b275, 24 }, { 0xc7b276, 24 }, { 0xc7b277, 24 },
- { 0xc7b278, 24 }, { 0xc7b279, 24 }, { 0xc7b27a, 24 }, { 0xc7b27b, 24 },
- { 0xc7b27c, 24 }, { 0xc7b27d, 24 }, { 0xc7b27e, 24 }, { 0xc7b27f, 24 },
- { 0x18f6480, 25 }, { 0x18f6481, 25 }, { 0x18f6482, 25 }, { 0x18f6483, 25 },
- { 0x18f6484, 25 }, { 0x18f6485, 25 }, { 0x18f6486, 25 }, { 0x18f6487, 25 },
- { 0x18f6488, 25 }, { 0x18f6489, 25 }, { 0x18f648a, 25 }, { 0x18f648b, 25 },
- { 0x18f648c, 25 }, { 0x18f648d, 25 }, { 0x18f648e, 25 }, { 0x18f648f, 25 },
+const uint32_t ff_table1_dc_chroma[120][2] = {
+{ 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 },
+{ 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 },
+{ 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 },
+{ 0x66, 7 },{ 0xa6, 8 },{ 0xc6, 8 },{ 0xcf, 8 },
+{ 0x14f, 9 },{ 0x18e, 9 },{ 0x19c, 9 },{ 0x29d, 10 },
+{ 0x33a, 10 },{ 0x538, 11 },{ 0x63c, 11 },{ 0x63e, 11 },
+{ 0x63f, 11 },{ 0x676, 11 },{ 0xa73, 12 },{ 0xc7a, 12 },
+{ 0xcef, 12 },{ 0x14e5, 13 },{ 0x19dd, 13 },{ 0x29c8, 14 },
+{ 0x29c9, 14 },{ 0x63dd, 15 },{ 0x33b8, 14 },{ 0x33b9, 14 },
+{ 0xc7b6, 16 },{ 0x63d8, 15 },{ 0x63df, 15 },{ 0xc7b3, 16 },
+{ 0xc7b4, 16 },{ 0xc7b5, 16 },{ 0x63de, 15 },{ 0xc7b7, 16 },
+{ 0xc7b8, 16 },{ 0xc7b9, 16 },{ 0x18f65, 17 },{ 0x31ec8, 18 },
+{ 0xc7b248, 24 },{ 0xc7b249, 24 },{ 0xc7b24a, 24 },{ 0xc7b24b, 24 },
+{ 0xc7b24c, 24 },{ 0xc7b24d, 24 },{ 0xc7b24e, 24 },{ 0xc7b24f, 24 },
+{ 0xc7b250, 24 },{ 0xc7b251, 24 },{ 0xc7b252, 24 },{ 0xc7b253, 24 },
+{ 0xc7b254, 24 },{ 0xc7b255, 24 },{ 0xc7b256, 24 },{ 0xc7b257, 24 },
+{ 0xc7b258, 24 },{ 0xc7b259, 24 },{ 0xc7b25a, 24 },{ 0xc7b25b, 24 },
+{ 0xc7b25c, 24 },{ 0xc7b25d, 24 },{ 0xc7b25e, 24 },{ 0xc7b25f, 24 },
+{ 0xc7b260, 24 },{ 0xc7b261, 24 },{ 0xc7b262, 24 },{ 0xc7b263, 24 },
+{ 0xc7b264, 24 },{ 0xc7b265, 24 },{ 0xc7b266, 24 },{ 0xc7b267, 24 },
+{ 0xc7b268, 24 },{ 0xc7b269, 24 },{ 0xc7b26a, 24 },{ 0xc7b26b, 24 },
+{ 0xc7b26c, 24 },{ 0xc7b26d, 24 },{ 0xc7b26e, 24 },{ 0xc7b26f, 24 },
+{ 0xc7b270, 24 },{ 0xc7b271, 24 },{ 0xc7b272, 24 },{ 0xc7b273, 24 },
+{ 0xc7b274, 24 },{ 0xc7b275, 24 },{ 0xc7b276, 24 },{ 0xc7b277, 24 },
+{ 0xc7b278, 24 },{ 0xc7b279, 24 },{ 0xc7b27a, 24 },{ 0xc7b27b, 24 },
+{ 0xc7b27c, 24 },{ 0xc7b27d, 24 },{ 0xc7b27e, 24 },{ 0xc7b27f, 24 },
+{ 0x18f6480, 25 },{ 0x18f6481, 25 },{ 0x18f6482, 25 },{ 0x18f6483, 25 },
+{ 0x18f6484, 25 },{ 0x18f6485, 25 },{ 0x18f6486, 25 },{ 0x18f6487, 25 },
+{ 0x18f6488, 25 },{ 0x18f6489, 25 },{ 0x18f648a, 25 },{ 0x18f648b, 25 },
+{ 0x18f648c, 25 },{ 0x18f648d, 25 },{ 0x18f648e, 25 },{ 0x18f648f, 25 },
};
/* vlc table 0, for intra luma */
-static const uint16_t table0_vlc[133][2] =
-{
- { 0x1, 2 }, { 0x6, 3 }, { 0xf, 4 }, { 0x16, 5 },
- { 0x20, 6 }, { 0x18, 7 }, { 0x8, 8 }, { 0x9a, 8 },
- { 0x56, 9 }, { 0x13e, 9 }, { 0xf0, 10 }, { 0x3a5, 10 },
- { 0x77, 11 }, { 0x1ef, 11 }, { 0x9a, 12 }, { 0x5d, 13 },
- { 0x1, 4 }, { 0x11, 5 }, { 0x2, 7 }, { 0xb, 8 },
- { 0x12, 9 }, { 0x1d6, 9 }, { 0x27e, 10 }, { 0x191, 11 },
- { 0xea, 12 }, { 0x3dc, 12 }, { 0x13b, 13 }, { 0x4, 5 },
- { 0x14, 7 }, { 0x9e, 8 }, { 0x9, 10 }, { 0x1ac, 11 },
- { 0x1e2, 11 }, { 0x3ca, 12 }, { 0x5f, 13 }, { 0x17, 5 },
- { 0x4e, 7 }, { 0x5e, 9 }, { 0xf3, 10 }, { 0x1ad, 11 },
- { 0xec, 12 }, { 0x5f0, 13 }, { 0xe, 6 }, { 0xe1, 8 },
- { 0x3a4, 10 }, { 0x9c, 12 }, { 0x13d, 13 }, { 0x3b, 6 },
- { 0x1c, 9 }, { 0x14, 11 }, { 0x9be, 12 }, { 0x6, 7 },
- { 0x7a, 9 }, { 0x190, 11 }, { 0x137, 13 }, { 0x1b, 7 },
- { 0x8, 10 }, { 0x75c, 11 }, { 0x71, 7 }, { 0xd7, 10 },
- { 0x9bf, 12 }, { 0x7, 8 }, { 0xaf, 10 }, { 0x4cc, 11 },
- { 0x34, 8 }, { 0x265, 10 }, { 0x9f, 12 }, { 0xe0, 8 },
- { 0x16, 11 }, { 0x327, 12 }, { 0x15, 9 }, { 0x17d, 11 },
- { 0xebb, 12 }, { 0x14, 9 }, { 0xf6, 10 }, { 0x1e4, 11 },
- { 0xcb, 10 }, { 0x99d, 12 }, { 0xca, 10 }, { 0x2fc, 12 },
- { 0x17f, 11 }, { 0x4cd, 11 }, { 0x2fd, 12 }, { 0x4fe, 11 },
- { 0x13a, 13 }, { 0xa, 4 }, { 0x42, 7 }, { 0x1d3, 9 },
- { 0x4dd, 11 }, { 0x12, 5 }, { 0xe8, 8 }, { 0x4c, 11 },
- { 0x136, 13 }, { 0x39, 6 }, { 0x264, 10 }, { 0xeba, 12 },
- { 0x0, 7 }, { 0xae, 10 }, { 0x99c, 12 }, { 0x1f, 7 },
- { 0x4de, 11 }, { 0x43, 7 }, { 0x4dc, 11 }, { 0x3, 8 },
- { 0x3cb, 12 }, { 0x6, 8 }, { 0x99e, 12 }, { 0x2a, 8 },
- { 0x5f1, 13 }, { 0xf, 8 }, { 0x9fe, 12 }, { 0x33, 8 },
- { 0x9ff, 12 }, { 0x98, 8 }, { 0x99f, 12 }, { 0xea, 8 },
- { 0x13c, 13 }, { 0x2e, 8 }, { 0x192, 11 }, { 0x136, 9 },
- { 0x6a, 9 }, { 0x15, 11 }, { 0x3af, 10 }, { 0x1e3, 11 },
- { 0x74, 11 }, { 0xeb, 12 }, { 0x2f9, 12 }, { 0x5c, 13 },
- { 0xed, 12 }, { 0x3dd, 12 }, { 0x326, 12 }, { 0x5e, 13 },
- { 0x16, 7 },
+static const uint16_t table0_vlc[133][2] = {
+{ 0x1, 2 },{ 0x6, 3 },{ 0xf, 4 },{ 0x16, 5 },
+{ 0x20, 6 },{ 0x18, 7 },{ 0x8, 8 },{ 0x9a, 8 },
+{ 0x56, 9 },{ 0x13e, 9 },{ 0xf0, 10 },{ 0x3a5, 10 },
+{ 0x77, 11 },{ 0x1ef, 11 },{ 0x9a, 12 },{ 0x5d, 13 },
+{ 0x1, 4 },{ 0x11, 5 },{ 0x2, 7 },{ 0xb, 8 },
+{ 0x12, 9 },{ 0x1d6, 9 },{ 0x27e, 10 },{ 0x191, 11 },
+{ 0xea, 12 },{ 0x3dc, 12 },{ 0x13b, 13 },{ 0x4, 5 },
+{ 0x14, 7 },{ 0x9e, 8 },{ 0x9, 10 },{ 0x1ac, 11 },
+{ 0x1e2, 11 },{ 0x3ca, 12 },{ 0x5f, 13 },{ 0x17, 5 },
+{ 0x4e, 7 },{ 0x5e, 9 },{ 0xf3, 10 },{ 0x1ad, 11 },
+{ 0xec, 12 },{ 0x5f0, 13 },{ 0xe, 6 },{ 0xe1, 8 },
+{ 0x3a4, 10 },{ 0x9c, 12 },{ 0x13d, 13 },{ 0x3b, 6 },
+{ 0x1c, 9 },{ 0x14, 11 },{ 0x9be, 12 },{ 0x6, 7 },
+{ 0x7a, 9 },{ 0x190, 11 },{ 0x137, 13 },{ 0x1b, 7 },
+{ 0x8, 10 },{ 0x75c, 11 },{ 0x71, 7 },{ 0xd7, 10 },
+{ 0x9bf, 12 },{ 0x7, 8 },{ 0xaf, 10 },{ 0x4cc, 11 },
+{ 0x34, 8 },{ 0x265, 10 },{ 0x9f, 12 },{ 0xe0, 8 },
+{ 0x16, 11 },{ 0x327, 12 },{ 0x15, 9 },{ 0x17d, 11 },
+{ 0xebb, 12 },{ 0x14, 9 },{ 0xf6, 10 },{ 0x1e4, 11 },
+{ 0xcb, 10 },{ 0x99d, 12 },{ 0xca, 10 },{ 0x2fc, 12 },
+{ 0x17f, 11 },{ 0x4cd, 11 },{ 0x2fd, 12 },{ 0x4fe, 11 },
+{ 0x13a, 13 },{ 0xa, 4 },{ 0x42, 7 },{ 0x1d3, 9 },
+{ 0x4dd, 11 },{ 0x12, 5 },{ 0xe8, 8 },{ 0x4c, 11 },
+{ 0x136, 13 },{ 0x39, 6 },{ 0x264, 10 },{ 0xeba, 12 },
+{ 0x0, 7 },{ 0xae, 10 },{ 0x99c, 12 },{ 0x1f, 7 },
+{ 0x4de, 11 },{ 0x43, 7 },{ 0x4dc, 11 },{ 0x3, 8 },
+{ 0x3cb, 12 },{ 0x6, 8 },{ 0x99e, 12 },{ 0x2a, 8 },
+{ 0x5f1, 13 },{ 0xf, 8 },{ 0x9fe, 12 },{ 0x33, 8 },
+{ 0x9ff, 12 },{ 0x98, 8 },{ 0x99f, 12 },{ 0xea, 8 },
+{ 0x13c, 13 },{ 0x2e, 8 },{ 0x192, 11 },{ 0x136, 9 },
+{ 0x6a, 9 },{ 0x15, 11 },{ 0x3af, 10 },{ 0x1e3, 11 },
+{ 0x74, 11 },{ 0xeb, 12 },{ 0x2f9, 12 },{ 0x5c, 13 },
+{ 0xed, 12 },{ 0x3dd, 12 },{ 0x326, 12 },{ 0x5e, 13 },
+{ 0x16, 7 },
};
-static const int8_t table0_level[132] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16,
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 1, 2, 3, 4, 5,
- 6, 7, 8, 1, 2, 3, 4, 5,
- 6, 7, 1, 2, 3, 4, 5, 1,
- 2, 3, 4, 1, 2, 3, 4, 1,
- 2, 3, 1, 2, 3, 1, 2, 3,
- 1, 2, 3, 1, 2, 3, 1, 2,
- 3, 1, 2, 3, 1, 2, 1, 2,
- 1, 1, 1, 1, 1, 1, 2, 3,
- 4, 1, 2, 3, 4, 1, 2, 3,
- 1, 2, 3, 1, 2, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1,
+static const int8_t table0_level[132] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16,
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 1, 2, 3, 4, 5,
+ 6, 7, 8, 1, 2, 3, 4, 5,
+ 6, 7, 1, 2, 3, 4, 5, 1,
+ 2, 3, 4, 1, 2, 3, 4, 1,
+ 2, 3, 1, 2, 3, 1, 2, 3,
+ 1, 2, 3, 1, 2, 3, 1, 2,
+ 3, 1, 2, 3, 1, 2, 1, 2,
+ 1, 1, 1, 1, 1, 1, 2, 3,
+ 4, 1, 2, 3, 4, 1, 2, 3,
+ 1, 2, 3, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1,
};
-static const int8_t table0_run[132] =
-{
- 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, 2, 2, 2, 2, 2,
- 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 4, 4, 4, 4, 4, 5,
- 5, 5, 5, 6, 6, 6, 6, 7,
- 7, 7, 8, 8, 8, 9, 9, 9,
- 10, 10, 10, 11, 11, 11, 12, 12,
- 12, 13, 13, 13, 14, 14, 15, 15,
- 16, 17, 18, 19, 20, 0, 0, 0,
- 0, 1, 1, 1, 1, 2, 2, 2,
- 3, 3, 3, 4, 4, 5, 5, 6,
- 6, 7, 7, 8, 8, 9, 9, 10,
- 10, 11, 11, 12, 12, 13, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26,
+static const int8_t table0_run[132] = {
+ 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, 2, 2, 2, 2, 2,
+ 2, 2, 2, 3, 3, 3, 3, 3,
+ 3, 3, 4, 4, 4, 4, 4, 5,
+ 5, 5, 5, 6, 6, 6, 6, 7,
+ 7, 7, 8, 8, 8, 9, 9, 9,
+ 10, 10, 10, 11, 11, 11, 12, 12,
+ 12, 13, 13, 13, 14, 14, 15, 15,
+ 16, 17, 18, 19, 20, 0, 0, 0,
+ 0, 1, 1, 1, 1, 2, 2, 2,
+ 3, 3, 3, 4, 4, 5, 5, 6,
+ 6, 7, 7, 8, 8, 9, 9, 10,
+ 10, 11, 11, 12, 12, 13, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26,
};
/* vlc table 1, for intra chroma and P macroblocks */
-static const uint16_t table1_vlc[149][2] =
-{
- { 0x4, 3 }, { 0x14, 5 }, { 0x17, 7 }, { 0x7f, 8 },
- { 0x154, 9 }, { 0x1f2, 10 }, { 0xbf, 11 }, { 0x65, 12 },
- { 0xaaa, 12 }, { 0x630, 13 }, { 0x1597, 13 }, { 0x3b7, 14 },
- { 0x2b22, 14 }, { 0xbe6, 15 }, { 0xb, 4 }, { 0x37, 7 },
- { 0x62, 9 }, { 0x7, 11 }, { 0x166, 12 }, { 0xce, 13 },
- { 0x1590, 13 }, { 0x5f6, 14 }, { 0xbe7, 15 }, { 0x7, 5 },
- { 0x6d, 8 }, { 0x3, 11 }, { 0x31f, 12 }, { 0x5f2, 14 },
- { 0x2, 6 }, { 0x61, 9 }, { 0x55, 12 }, { 0x1df, 14 },
- { 0x1a, 6 }, { 0x1e, 10 }, { 0xac9, 12 }, { 0x2b23, 14 },
- { 0x1e, 6 }, { 0x1f, 10 }, { 0xac3, 12 }, { 0x2b2b, 14 },
- { 0x6, 7 }, { 0x4, 11 }, { 0x2f8, 13 }, { 0x19, 7 },
- { 0x6, 11 }, { 0x63d, 13 }, { 0x57, 7 }, { 0x182, 11 },
- { 0x2aa2, 14 }, { 0x4, 8 }, { 0x180, 11 }, { 0x59c, 14 },
- { 0x7d, 8 }, { 0x164, 12 }, { 0x76d, 15 }, { 0x2, 9 },
- { 0x18d, 11 }, { 0x1581, 13 }, { 0xad, 8 }, { 0x60, 12 },
- { 0xc67, 14 }, { 0x1c, 9 }, { 0xee, 13 }, { 0x3, 9 },
- { 0x2cf, 13 }, { 0xd9, 9 }, { 0x1580, 13 }, { 0x2, 11 },
- { 0x183, 11 }, { 0x57, 12 }, { 0x61, 12 }, { 0x31, 11 },
- { 0x66, 12 }, { 0x631, 13 }, { 0x632, 13 }, { 0xac, 13 },
- { 0x31d, 12 }, { 0x76, 12 }, { 0x3a, 11 }, { 0x165, 12 },
- { 0xc66, 14 }, { 0x3, 2 }, { 0x54, 7 }, { 0x2ab, 10 },
- { 0x16, 13 }, { 0x5f7, 14 }, { 0x5, 4 }, { 0xf8, 9 },
- { 0xaa9, 12 }, { 0x5f, 15 }, { 0x4, 4 }, { 0x1c, 10 },
- { 0x1550, 13 }, { 0x4, 5 }, { 0x77, 11 }, { 0x76c, 15 },
- { 0xe, 5 }, { 0xa, 12 }, { 0xc, 5 }, { 0x562, 11 },
- { 0x4, 6 }, { 0x31c, 12 }, { 0x6, 6 }, { 0xc8, 13 },
- { 0xd, 6 }, { 0x1da, 13 }, { 0x7, 6 }, { 0xc9, 13 },
- { 0x1, 7 }, { 0x2e, 14 }, { 0x14, 7 }, { 0x1596, 13 },
- { 0xa, 7 }, { 0xac2, 12 }, { 0x16, 7 }, { 0x15b, 14 },
- { 0x15, 7 }, { 0x15a, 14 }, { 0xf, 8 }, { 0x5e, 15 },
- { 0x7e, 8 }, { 0xab, 8 }, { 0x2d, 9 }, { 0xd8, 9 },
- { 0xb, 9 }, { 0x14, 10 }, { 0x2b3, 10 }, { 0x1f3, 10 },
- { 0x3a, 10 }, { 0x0, 10 }, { 0x58, 10 }, { 0x2e, 9 },
- { 0x5e, 10 }, { 0x563, 11 }, { 0xec, 12 }, { 0x54, 12 },
- { 0xac1, 12 }, { 0x1556, 13 }, { 0x2fa, 13 }, { 0x181, 11 },
- { 0x1557, 13 }, { 0x59d, 14 }, { 0x2aa3, 14 }, { 0x2b2a, 14 },
- { 0x1de, 14 }, { 0x63c, 13 }, { 0xcf, 13 }, { 0x1594, 13 },
- { 0xd, 9 },
+static const uint16_t table1_vlc[149][2] = {
+{ 0x4, 3 },{ 0x14, 5 },{ 0x17, 7 },{ 0x7f, 8 },
+{ 0x154, 9 },{ 0x1f2, 10 },{ 0xbf, 11 },{ 0x65, 12 },
+{ 0xaaa, 12 },{ 0x630, 13 },{ 0x1597, 13 },{ 0x3b7, 14 },
+{ 0x2b22, 14 },{ 0xbe6, 15 },{ 0xb, 4 },{ 0x37, 7 },
+{ 0x62, 9 },{ 0x7, 11 },{ 0x166, 12 },{ 0xce, 13 },
+{ 0x1590, 13 },{ 0x5f6, 14 },{ 0xbe7, 15 },{ 0x7, 5 },
+{ 0x6d, 8 },{ 0x3, 11 },{ 0x31f, 12 },{ 0x5f2, 14 },
+{ 0x2, 6 },{ 0x61, 9 },{ 0x55, 12 },{ 0x1df, 14 },
+{ 0x1a, 6 },{ 0x1e, 10 },{ 0xac9, 12 },{ 0x2b23, 14 },
+{ 0x1e, 6 },{ 0x1f, 10 },{ 0xac3, 12 },{ 0x2b2b, 14 },
+{ 0x6, 7 },{ 0x4, 11 },{ 0x2f8, 13 },{ 0x19, 7 },
+{ 0x6, 11 },{ 0x63d, 13 },{ 0x57, 7 },{ 0x182, 11 },
+{ 0x2aa2, 14 },{ 0x4, 8 },{ 0x180, 11 },{ 0x59c, 14 },
+{ 0x7d, 8 },{ 0x164, 12 },{ 0x76d, 15 },{ 0x2, 9 },
+{ 0x18d, 11 },{ 0x1581, 13 },{ 0xad, 8 },{ 0x60, 12 },
+{ 0xc67, 14 },{ 0x1c, 9 },{ 0xee, 13 },{ 0x3, 9 },
+{ 0x2cf, 13 },{ 0xd9, 9 },{ 0x1580, 13 },{ 0x2, 11 },
+{ 0x183, 11 },{ 0x57, 12 },{ 0x61, 12 },{ 0x31, 11 },
+{ 0x66, 12 },{ 0x631, 13 },{ 0x632, 13 },{ 0xac, 13 },
+{ 0x31d, 12 },{ 0x76, 12 },{ 0x3a, 11 },{ 0x165, 12 },
+{ 0xc66, 14 },{ 0x3, 2 },{ 0x54, 7 },{ 0x2ab, 10 },
+{ 0x16, 13 },{ 0x5f7, 14 },{ 0x5, 4 },{ 0xf8, 9 },
+{ 0xaa9, 12 },{ 0x5f, 15 },{ 0x4, 4 },{ 0x1c, 10 },
+{ 0x1550, 13 },{ 0x4, 5 },{ 0x77, 11 },{ 0x76c, 15 },
+{ 0xe, 5 },{ 0xa, 12 },{ 0xc, 5 },{ 0x562, 11 },
+{ 0x4, 6 },{ 0x31c, 12 },{ 0x6, 6 },{ 0xc8, 13 },
+{ 0xd, 6 },{ 0x1da, 13 },{ 0x7, 6 },{ 0xc9, 13 },
+{ 0x1, 7 },{ 0x2e, 14 },{ 0x14, 7 },{ 0x1596, 13 },
+{ 0xa, 7 },{ 0xac2, 12 },{ 0x16, 7 },{ 0x15b, 14 },
+{ 0x15, 7 },{ 0x15a, 14 },{ 0xf, 8 },{ 0x5e, 15 },
+{ 0x7e, 8 },{ 0xab, 8 },{ 0x2d, 9 },{ 0xd8, 9 },
+{ 0xb, 9 },{ 0x14, 10 },{ 0x2b3, 10 },{ 0x1f3, 10 },
+{ 0x3a, 10 },{ 0x0, 10 },{ 0x58, 10 },{ 0x2e, 9 },
+{ 0x5e, 10 },{ 0x563, 11 },{ 0xec, 12 },{ 0x54, 12 },
+{ 0xac1, 12 },{ 0x1556, 13 },{ 0x2fa, 13 },{ 0x181, 11 },
+{ 0x1557, 13 },{ 0x59d, 14 },{ 0x2aa3, 14 },{ 0x2b2a, 14 },
+{ 0x1de, 14 },{ 0x63c, 13 },{ 0xcf, 13 },{ 0x1594, 13 },
+{ 0xd, 9 },
};
-static const int8_t table1_level[148] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 1,
- 2, 3, 4, 5, 1, 2, 3, 4,
- 1, 2, 3, 4, 1, 2, 3, 4,
- 1, 2, 3, 1, 2, 3, 1, 2,
- 3, 1, 2, 3, 1, 2, 3, 1,
- 2, 3, 1, 2, 3, 1, 2, 1,
- 2, 1, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 3, 4, 5, 1, 2,
- 3, 4, 1, 2, 3, 1, 2, 3,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 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,
+static const int8_t table1_level[148] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 1,
+ 2, 3, 4, 5, 1, 2, 3, 4,
+ 1, 2, 3, 4, 1, 2, 3, 4,
+ 1, 2, 3, 1, 2, 3, 1, 2,
+ 3, 1, 2, 3, 1, 2, 3, 1,
+ 2, 3, 1, 2, 3, 1, 2, 1,
+ 2, 1, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 3, 4, 5, 1, 2,
+ 3, 4, 1, 2, 3, 1, 2, 3,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 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,
};
-static const int8_t table1_run[148] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1,
- 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, 9, 10, 10, 10, 11,
- 11, 11, 12, 12, 12, 13, 13, 14,
- 14, 15, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 0, 0, 0, 0, 0, 1, 1,
- 1, 1, 2, 2, 2, 3, 3, 3,
- 4, 4, 5, 5, 6, 6, 7, 7,
- 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13, 14, 14, 15, 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, 43,
+static const int8_t table1_run[148] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1,
+ 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, 9, 10, 10, 10, 11,
+ 11, 11, 12, 12, 12, 13, 13, 14,
+ 14, 15, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 2, 2, 2, 3, 3, 3,
+ 4, 4, 5, 5, 6, 6, 7, 7,
+ 8, 8, 9, 9, 10, 10, 11, 11,
+ 12, 12, 13, 13, 14, 14, 15, 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, 43,
};
/* third vlc table */
-static const uint16_t table2_vlc[186][2] =
-{
- { 0x1, 2 }, { 0x5, 3 }, { 0xd, 4 }, { 0x12, 5 },
- { 0xe, 6 }, { 0x15, 7 }, { 0x13, 8 }, { 0x3f, 8 },
- { 0x4b, 9 }, { 0x11f, 9 }, { 0xb8, 10 }, { 0x3e3, 10 },
- { 0x172, 11 }, { 0x24d, 12 }, { 0x3da, 12 }, { 0x2dd, 13 },
- { 0x1f55, 13 }, { 0x5b9, 14 }, { 0x3eae, 14 }, { 0x0, 4 },
- { 0x10, 5 }, { 0x8, 7 }, { 0x20, 8 }, { 0x29, 9 },
- { 0x1f4, 9 }, { 0x233, 10 }, { 0x1e0, 11 }, { 0x12a, 12 },
- { 0x3dd, 12 }, { 0x50a, 13 }, { 0x1f29, 13 }, { 0xa42, 14 },
- { 0x1272, 15 }, { 0x1737, 15 }, { 0x3, 5 }, { 0x11, 7 },
- { 0xc4, 8 }, { 0x4b, 10 }, { 0xb4, 11 }, { 0x7d4, 11 },
- { 0x345, 12 }, { 0x2d7, 13 }, { 0x7bf, 13 }, { 0x938, 14 },
- { 0xbbb, 14 }, { 0x95e, 15 }, { 0x13, 5 }, { 0x78, 7 },
- { 0x69, 9 }, { 0x232, 10 }, { 0x461, 11 }, { 0x3ec, 12 },
- { 0x520, 13 }, { 0x1f2a, 13 }, { 0x3e50, 14 }, { 0x3e51, 14 },
- { 0x1486, 15 }, { 0xc, 6 }, { 0x24, 9 }, { 0x94, 11 },
- { 0x8c0, 12 }, { 0xf09, 14 }, { 0x1ef0, 15 }, { 0x3d, 6 },
- { 0x53, 9 }, { 0x1a0, 11 }, { 0x2d6, 13 }, { 0xf08, 14 },
- { 0x13, 7 }, { 0x7c, 9 }, { 0x7c1, 11 }, { 0x4ac, 14 },
- { 0x1b, 7 }, { 0xa0, 10 }, { 0x344, 12 }, { 0xf79, 14 },
- { 0x79, 7 }, { 0x3e1, 10 }, { 0x2d4, 13 }, { 0x2306, 14 },
- { 0x21, 8 }, { 0x23c, 10 }, { 0xfae, 12 }, { 0x23de, 14 },
- { 0x35, 8 }, { 0x175, 11 }, { 0x7b3, 13 }, { 0xc5, 8 },
- { 0x174, 11 }, { 0x785, 13 }, { 0x48, 9 }, { 0x1a3, 11 },
- { 0x49e, 13 }, { 0x2c, 9 }, { 0xfa, 10 }, { 0x7d6, 11 },
- { 0x92, 10 }, { 0x5cc, 13 }, { 0x1ef1, 15 }, { 0xa3, 10 },
- { 0x3ed, 12 }, { 0x93e, 14 }, { 0x1e2, 11 }, { 0x1273, 15 },
- { 0x7c4, 11 }, { 0x1487, 15 }, { 0x291, 12 }, { 0x293, 12 },
- { 0xf8a, 12 }, { 0x509, 13 }, { 0x508, 13 }, { 0x78d, 13 },
- { 0x7be, 13 }, { 0x78c, 13 }, { 0x4ae, 14 }, { 0xbba, 14 },
- { 0x2307, 14 }, { 0xb9a, 14 }, { 0x1736, 15 }, { 0xe, 4 },
- { 0x45, 7 }, { 0x1f3, 9 }, { 0x47a, 11 }, { 0x5dc, 13 },
- { 0x23df, 14 }, { 0x19, 5 }, { 0x28, 9 }, { 0x176, 11 },
- { 0x49d, 13 }, { 0x23dd, 14 }, { 0x30, 6 }, { 0xa2, 10 },
- { 0x2ef, 12 }, { 0x5b8, 14 }, { 0x3f, 6 }, { 0xa5, 10 },
- { 0x3db, 12 }, { 0x93f, 14 }, { 0x44, 7 }, { 0x7cb, 11 },
- { 0x95f, 15 }, { 0x63, 7 }, { 0x3c3, 12 }, { 0x15, 8 },
- { 0x8f6, 12 }, { 0x17, 8 }, { 0x498, 13 }, { 0x2c, 8 },
- { 0x7b2, 13 }, { 0x2f, 8 }, { 0x1f54, 13 }, { 0x8d, 8 },
- { 0x7bd, 13 }, { 0x8e, 8 }, { 0x1182, 13 }, { 0xfb, 8 },
- { 0x50b, 13 }, { 0x2d, 8 }, { 0x7c0, 11 }, { 0x79, 9 },
- { 0x1f5f, 13 }, { 0x7a, 9 }, { 0x1f56, 13 }, { 0x231, 10 },
- { 0x3e4, 10 }, { 0x1a1, 11 }, { 0x143, 11 }, { 0x1f7, 11 },
- { 0x16f, 12 }, { 0x292, 12 }, { 0x2e7, 12 }, { 0x16c, 12 },
- { 0x16d, 12 }, { 0x3dc, 12 }, { 0xf8b, 12 }, { 0x499, 13 },
- { 0x3d8, 12 }, { 0x78e, 13 }, { 0x2d5, 13 }, { 0x1f5e, 13 },
- { 0x1f2b, 13 }, { 0x78f, 13 }, { 0x4ad, 14 }, { 0x3eaf, 14 },
- { 0x23dc, 14 }, { 0x4a, 9 },
+static const uint16_t table2_vlc[186][2] = {
+{ 0x1, 2 },{ 0x5, 3 },{ 0xd, 4 },{ 0x12, 5 },
+{ 0xe, 6 },{ 0x15, 7 },{ 0x13, 8 },{ 0x3f, 8 },
+{ 0x4b, 9 },{ 0x11f, 9 },{ 0xb8, 10 },{ 0x3e3, 10 },
+{ 0x172, 11 },{ 0x24d, 12 },{ 0x3da, 12 },{ 0x2dd, 13 },
+{ 0x1f55, 13 },{ 0x5b9, 14 },{ 0x3eae, 14 },{ 0x0, 4 },
+{ 0x10, 5 },{ 0x8, 7 },{ 0x20, 8 },{ 0x29, 9 },
+{ 0x1f4, 9 },{ 0x233, 10 },{ 0x1e0, 11 },{ 0x12a, 12 },
+{ 0x3dd, 12 },{ 0x50a, 13 },{ 0x1f29, 13 },{ 0xa42, 14 },
+{ 0x1272, 15 },{ 0x1737, 15 },{ 0x3, 5 },{ 0x11, 7 },
+{ 0xc4, 8 },{ 0x4b, 10 },{ 0xb4, 11 },{ 0x7d4, 11 },
+{ 0x345, 12 },{ 0x2d7, 13 },{ 0x7bf, 13 },{ 0x938, 14 },
+{ 0xbbb, 14 },{ 0x95e, 15 },{ 0x13, 5 },{ 0x78, 7 },
+{ 0x69, 9 },{ 0x232, 10 },{ 0x461, 11 },{ 0x3ec, 12 },
+{ 0x520, 13 },{ 0x1f2a, 13 },{ 0x3e50, 14 },{ 0x3e51, 14 },
+{ 0x1486, 15 },{ 0xc, 6 },{ 0x24, 9 },{ 0x94, 11 },
+{ 0x8c0, 12 },{ 0xf09, 14 },{ 0x1ef0, 15 },{ 0x3d, 6 },
+{ 0x53, 9 },{ 0x1a0, 11 },{ 0x2d6, 13 },{ 0xf08, 14 },
+{ 0x13, 7 },{ 0x7c, 9 },{ 0x7c1, 11 },{ 0x4ac, 14 },
+{ 0x1b, 7 },{ 0xa0, 10 },{ 0x344, 12 },{ 0xf79, 14 },
+{ 0x79, 7 },{ 0x3e1, 10 },{ 0x2d4, 13 },{ 0x2306, 14 },
+{ 0x21, 8 },{ 0x23c, 10 },{ 0xfae, 12 },{ 0x23de, 14 },
+{ 0x35, 8 },{ 0x175, 11 },{ 0x7b3, 13 },{ 0xc5, 8 },
+{ 0x174, 11 },{ 0x785, 13 },{ 0x48, 9 },{ 0x1a3, 11 },
+{ 0x49e, 13 },{ 0x2c, 9 },{ 0xfa, 10 },{ 0x7d6, 11 },
+{ 0x92, 10 },{ 0x5cc, 13 },{ 0x1ef1, 15 },{ 0xa3, 10 },
+{ 0x3ed, 12 },{ 0x93e, 14 },{ 0x1e2, 11 },{ 0x1273, 15 },
+{ 0x7c4, 11 },{ 0x1487, 15 },{ 0x291, 12 },{ 0x293, 12 },
+{ 0xf8a, 12 },{ 0x509, 13 },{ 0x508, 13 },{ 0x78d, 13 },
+{ 0x7be, 13 },{ 0x78c, 13 },{ 0x4ae, 14 },{ 0xbba, 14 },
+{ 0x2307, 14 },{ 0xb9a, 14 },{ 0x1736, 15 },{ 0xe, 4 },
+{ 0x45, 7 },{ 0x1f3, 9 },{ 0x47a, 11 },{ 0x5dc, 13 },
+{ 0x23df, 14 },{ 0x19, 5 },{ 0x28, 9 },{ 0x176, 11 },
+{ 0x49d, 13 },{ 0x23dd, 14 },{ 0x30, 6 },{ 0xa2, 10 },
+{ 0x2ef, 12 },{ 0x5b8, 14 },{ 0x3f, 6 },{ 0xa5, 10 },
+{ 0x3db, 12 },{ 0x93f, 14 },{ 0x44, 7 },{ 0x7cb, 11 },
+{ 0x95f, 15 },{ 0x63, 7 },{ 0x3c3, 12 },{ 0x15, 8 },
+{ 0x8f6, 12 },{ 0x17, 8 },{ 0x498, 13 },{ 0x2c, 8 },
+{ 0x7b2, 13 },{ 0x2f, 8 },{ 0x1f54, 13 },{ 0x8d, 8 },
+{ 0x7bd, 13 },{ 0x8e, 8 },{ 0x1182, 13 },{ 0xfb, 8 },
+{ 0x50b, 13 },{ 0x2d, 8 },{ 0x7c0, 11 },{ 0x79, 9 },
+{ 0x1f5f, 13 },{ 0x7a, 9 },{ 0x1f56, 13 },{ 0x231, 10 },
+{ 0x3e4, 10 },{ 0x1a1, 11 },{ 0x143, 11 },{ 0x1f7, 11 },
+{ 0x16f, 12 },{ 0x292, 12 },{ 0x2e7, 12 },{ 0x16c, 12 },
+{ 0x16d, 12 },{ 0x3dc, 12 },{ 0xf8b, 12 },{ 0x499, 13 },
+{ 0x3d8, 12 },{ 0x78e, 13 },{ 0x2d5, 13 },{ 0x1f5e, 13 },
+{ 0x1f2b, 13 },{ 0x78f, 13 },{ 0x4ad, 14 },{ 0x3eaf, 14 },
+{ 0x23dc, 14 },{ 0x4a, 9 },
};
-static const int8_t table2_level[185] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 1, 2, 3, 4, 5, 6, 1,
- 2, 3, 4, 5, 1, 2, 3, 4,
- 1, 2, 3, 4, 1, 2, 3, 4,
- 1, 2, 3, 4, 1, 2, 3, 1,
- 2, 3, 1, 2, 3, 1, 2, 3,
- 1, 2, 3, 1, 2, 3, 1, 2,
- 1, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 3, 4, 5, 6, 1, 2, 3,
- 4, 5, 1, 2, 3, 4, 1, 2,
- 3, 4, 1, 2, 3, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 2, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1,
+static const int8_t table2_level[185] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 1, 2, 3, 4, 5, 6, 1,
+ 2, 3, 4, 5, 1, 2, 3, 4,
+ 1, 2, 3, 4, 1, 2, 3, 4,
+ 1, 2, 3, 4, 1, 2, 3, 1,
+ 2, 3, 1, 2, 3, 1, 2, 3,
+ 1, 2, 3, 1, 2, 3, 1, 2,
+ 1, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 3, 4, 5, 6, 1, 2, 3,
+ 4, 5, 1, 2, 3, 4, 1, 2,
+ 3, 4, 1, 2, 3, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
-static const int8_t table2_run[185] =
-{
- 0, 0, 0, 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, 1, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 4, 4, 4, 4, 4, 4, 5,
- 5, 5, 5, 5, 6, 6, 6, 6,
- 7, 7, 7, 7, 8, 8, 8, 8,
- 9, 9, 9, 9, 10, 10, 10, 11,
- 11, 11, 12, 12, 12, 13, 13, 13,
- 14, 14, 14, 15, 15, 15, 16, 16,
- 17, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 0,
- 0, 0, 0, 0, 0, 1, 1, 1,
- 1, 1, 2, 2, 2, 2, 3, 3,
- 3, 3, 4, 4, 4, 5, 5, 6,
- 6, 7, 7, 8, 8, 9, 9, 10,
- 10, 11, 11, 12, 12, 13, 13, 14,
- 14, 15, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36,
- 37,
+static const int8_t table2_run[185] = {
+ 0, 0, 0, 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, 1, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 4, 4, 4, 4, 4, 4, 5,
+ 5, 5, 5, 5, 6, 6, 6, 6,
+ 7, 7, 7, 7, 8, 8, 8, 8,
+ 9, 9, 9, 9, 10, 10, 10, 11,
+ 11, 11, 12, 12, 12, 13, 13, 13,
+ 14, 14, 14, 15, 15, 15, 16, 16,
+ 17, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 2, 2, 2, 2, 3, 3,
+ 3, 3, 4, 4, 4, 5, 5, 6,
+ 6, 7, 7, 8, 8, 9, 9, 10,
+ 10, 11, 11, 12, 12, 13, 13, 14,
+ 14, 15, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36,
+ 37,
};
/* second non intra vlc table */
-static const uint16_t table4_vlc[169][2] =
-{
- { 0x0, 3 }, { 0x3, 4 }, { 0xb, 5 }, { 0x14, 6 },
- { 0x3f, 6 }, { 0x5d, 7 }, { 0xa2, 8 }, { 0xac, 9 },
- { 0x16e, 9 }, { 0x20a, 10 }, { 0x2e2, 10 }, { 0x432, 11 },
- { 0x5c9, 11 }, { 0x827, 12 }, { 0xb54, 12 }, { 0x4e6, 13 },
- { 0x105f, 13 }, { 0x172a, 13 }, { 0x20b2, 14 }, { 0x2d4e, 14 },
- { 0x39f0, 14 }, { 0x4175, 15 }, { 0x5a9e, 15 }, { 0x4, 4 },
- { 0x1e, 5 }, { 0x42, 7 }, { 0xb6, 8 }, { 0x173, 9 },
- { 0x395, 10 }, { 0x72e, 11 }, { 0xb94, 12 }, { 0x16a4, 13 },
- { 0x20b3, 14 }, { 0x2e45, 14 }, { 0x5, 5 }, { 0x40, 7 },
- { 0x49, 9 }, { 0x28f, 10 }, { 0x5cb, 11 }, { 0x48a, 13 },
- { 0x9dd, 14 }, { 0x73e2, 15 }, { 0x18, 5 }, { 0x25, 8 },
- { 0x8a, 10 }, { 0x51b, 11 }, { 0xe5f, 12 }, { 0x9c9, 14 },
- { 0x139c, 15 }, { 0x29, 6 }, { 0x4f, 9 }, { 0x412, 11 },
- { 0x48d, 13 }, { 0x2e41, 14 }, { 0x38, 6 }, { 0x10e, 9 },
- { 0x5a8, 11 }, { 0x105c, 13 }, { 0x39f2, 14 }, { 0x58, 7 },
- { 0x21f, 10 }, { 0xe7e, 12 }, { 0x39ff, 14 }, { 0x23, 8 },
- { 0x2e3, 10 }, { 0x4e5, 13 }, { 0x2e40, 14 }, { 0xa1, 8 },
- { 0x5be, 11 }, { 0x9c8, 14 }, { 0x83, 8 }, { 0x13a, 11 },
- { 0x1721, 13 }, { 0x44, 9 }, { 0x276, 12 }, { 0x39f6, 14 },
- { 0x8b, 10 }, { 0x4ef, 13 }, { 0x5a9b, 15 }, { 0x208, 10 },
- { 0x1cfe, 13 }, { 0x399, 10 }, { 0x1cb4, 13 }, { 0x39e, 10 },
- { 0x39f3, 14 }, { 0x5ab, 11 }, { 0x73e3, 15 }, { 0x737, 11 },
- { 0x5a9f, 15 }, { 0x82d, 12 }, { 0xe69, 12 }, { 0xe68, 12 },
- { 0x433, 11 }, { 0xb7b, 12 }, { 0x2df8, 14 }, { 0x2e56, 14 },
- { 0x2e57, 14 }, { 0x39f7, 14 }, { 0x51a5, 15 }, { 0x3, 3 },
- { 0x2a, 6 }, { 0xe4, 8 }, { 0x28e, 10 }, { 0x735, 11 },
- { 0x1058, 13 }, { 0x1cfa, 13 }, { 0x2df9, 14 }, { 0x4174, 15 },
- { 0x9, 4 }, { 0x54, 8 }, { 0x398, 10 }, { 0x48b, 13 },
- { 0x139d, 15 }, { 0xd, 4 }, { 0xad, 9 }, { 0x826, 12 },
- { 0x2d4c, 14 }, { 0x11, 5 }, { 0x16b, 9 }, { 0xb7f, 12 },
- { 0x51a4, 15 }, { 0x19, 5 }, { 0x21b, 10 }, { 0x16fd, 13 },
- { 0x1d, 5 }, { 0x394, 10 }, { 0x28d3, 14 }, { 0x2b, 6 },
- { 0x5bc, 11 }, { 0x5a9a, 15 }, { 0x2f, 6 }, { 0x247, 12 },
- { 0x10, 7 }, { 0xa35, 12 }, { 0x3e, 6 }, { 0xb7a, 12 },
- { 0x59, 7 }, { 0x105e, 13 }, { 0x26, 8 }, { 0x9cf, 14 },
- { 0x55, 8 }, { 0x1cb5, 13 }, { 0x57, 8 }, { 0xe5b, 12 },
- { 0xa0, 8 }, { 0x1468, 13 }, { 0x170, 9 }, { 0x90, 10 },
- { 0x1ce, 9 }, { 0x21a, 10 }, { 0x218, 10 }, { 0x168, 9 },
- { 0x21e, 10 }, { 0x244, 12 }, { 0x736, 11 }, { 0x138, 11 },
- { 0x519, 11 }, { 0xe5e, 12 }, { 0x72c, 11 }, { 0xb55, 12 },
- { 0x9dc, 14 }, { 0x20bb, 14 }, { 0x48c, 13 }, { 0x1723, 13 },
- { 0x2e44, 14 }, { 0x16a5, 13 }, { 0x518, 11 }, { 0x39fe, 14 },
- { 0x169, 9 },
+static const uint16_t table4_vlc[169][2] = {
+{ 0x0, 3 },{ 0x3, 4 },{ 0xb, 5 },{ 0x14, 6 },
+{ 0x3f, 6 },{ 0x5d, 7 },{ 0xa2, 8 },{ 0xac, 9 },
+{ 0x16e, 9 },{ 0x20a, 10 },{ 0x2e2, 10 },{ 0x432, 11 },
+{ 0x5c9, 11 },{ 0x827, 12 },{ 0xb54, 12 },{ 0x4e6, 13 },
+{ 0x105f, 13 },{ 0x172a, 13 },{ 0x20b2, 14 },{ 0x2d4e, 14 },
+{ 0x39f0, 14 },{ 0x4175, 15 },{ 0x5a9e, 15 },{ 0x4, 4 },
+{ 0x1e, 5 },{ 0x42, 7 },{ 0xb6, 8 },{ 0x173, 9 },
+{ 0x395, 10 },{ 0x72e, 11 },{ 0xb94, 12 },{ 0x16a4, 13 },
+{ 0x20b3, 14 },{ 0x2e45, 14 },{ 0x5, 5 },{ 0x40, 7 },
+{ 0x49, 9 },{ 0x28f, 10 },{ 0x5cb, 11 },{ 0x48a, 13 },
+{ 0x9dd, 14 },{ 0x73e2, 15 },{ 0x18, 5 },{ 0x25, 8 },
+{ 0x8a, 10 },{ 0x51b, 11 },{ 0xe5f, 12 },{ 0x9c9, 14 },
+{ 0x139c, 15 },{ 0x29, 6 },{ 0x4f, 9 },{ 0x412, 11 },
+{ 0x48d, 13 },{ 0x2e41, 14 },{ 0x38, 6 },{ 0x10e, 9 },
+{ 0x5a8, 11 },{ 0x105c, 13 },{ 0x39f2, 14 },{ 0x58, 7 },
+{ 0x21f, 10 },{ 0xe7e, 12 },{ 0x39ff, 14 },{ 0x23, 8 },
+{ 0x2e3, 10 },{ 0x4e5, 13 },{ 0x2e40, 14 },{ 0xa1, 8 },
+{ 0x5be, 11 },{ 0x9c8, 14 },{ 0x83, 8 },{ 0x13a, 11 },
+{ 0x1721, 13 },{ 0x44, 9 },{ 0x276, 12 },{ 0x39f6, 14 },
+{ 0x8b, 10 },{ 0x4ef, 13 },{ 0x5a9b, 15 },{ 0x208, 10 },
+{ 0x1cfe, 13 },{ 0x399, 10 },{ 0x1cb4, 13 },{ 0x39e, 10 },
+{ 0x39f3, 14 },{ 0x5ab, 11 },{ 0x73e3, 15 },{ 0x737, 11 },
+{ 0x5a9f, 15 },{ 0x82d, 12 },{ 0xe69, 12 },{ 0xe68, 12 },
+{ 0x433, 11 },{ 0xb7b, 12 },{ 0x2df8, 14 },{ 0x2e56, 14 },
+{ 0x2e57, 14 },{ 0x39f7, 14 },{ 0x51a5, 15 },{ 0x3, 3 },
+{ 0x2a, 6 },{ 0xe4, 8 },{ 0x28e, 10 },{ 0x735, 11 },
+{ 0x1058, 13 },{ 0x1cfa, 13 },{ 0x2df9, 14 },{ 0x4174, 15 },
+{ 0x9, 4 },{ 0x54, 8 },{ 0x398, 10 },{ 0x48b, 13 },
+{ 0x139d, 15 },{ 0xd, 4 },{ 0xad, 9 },{ 0x826, 12 },
+{ 0x2d4c, 14 },{ 0x11, 5 },{ 0x16b, 9 },{ 0xb7f, 12 },
+{ 0x51a4, 15 },{ 0x19, 5 },{ 0x21b, 10 },{ 0x16fd, 13 },
+{ 0x1d, 5 },{ 0x394, 10 },{ 0x28d3, 14 },{ 0x2b, 6 },
+{ 0x5bc, 11 },{ 0x5a9a, 15 },{ 0x2f, 6 },{ 0x247, 12 },
+{ 0x10, 7 },{ 0xa35, 12 },{ 0x3e, 6 },{ 0xb7a, 12 },
+{ 0x59, 7 },{ 0x105e, 13 },{ 0x26, 8 },{ 0x9cf, 14 },
+{ 0x55, 8 },{ 0x1cb5, 13 },{ 0x57, 8 },{ 0xe5b, 12 },
+{ 0xa0, 8 },{ 0x1468, 13 },{ 0x170, 9 },{ 0x90, 10 },
+{ 0x1ce, 9 },{ 0x21a, 10 },{ 0x218, 10 },{ 0x168, 9 },
+{ 0x21e, 10 },{ 0x244, 12 },{ 0x736, 11 },{ 0x138, 11 },
+{ 0x519, 11 },{ 0xe5e, 12 },{ 0x72c, 11 },{ 0xb55, 12 },
+{ 0x9dc, 14 },{ 0x20bb, 14 },{ 0x48c, 13 },{ 0x1723, 13 },
+{ 0x2e44, 14 },{ 0x16a5, 13 },{ 0x518, 11 },{ 0x39fe, 14 },
+{ 0x169, 9 },
};
-static const int8_t table4_level[168] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 1,
- 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 1, 2, 3, 4, 5, 6,
- 7, 8, 1, 2, 3, 4, 5, 6,
- 7, 1, 2, 3, 4, 5, 1, 2,
- 3, 4, 5, 1, 2, 3, 4, 1,
- 2, 3, 4, 1, 2, 3, 1, 2,
- 3, 1, 2, 3, 1, 2, 3, 1,
- 2, 1, 2, 1, 2, 1, 2, 1,
- 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 1, 2, 3, 4,
- 5, 1, 2, 3, 4, 1, 2, 3,
- 4, 1, 2, 3, 1, 2, 3, 1,
- 2, 3, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 2, 1, 2, 1, 2,
- 1, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
+static const int8_t table4_level[168] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 1,
+ 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 1, 2, 3, 4, 5, 6,
+ 7, 8, 1, 2, 3, 4, 5, 6,
+ 7, 1, 2, 3, 4, 5, 1, 2,
+ 3, 4, 5, 1, 2, 3, 4, 1,
+ 2, 3, 4, 1, 2, 3, 1, 2,
+ 3, 1, 2, 3, 1, 2, 3, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 1, 2, 3, 4,
+ 5, 1, 2, 3, 4, 1, 2, 3,
+ 4, 1, 2, 3, 1, 2, 3, 1,
+ 2, 3, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
};
-static const int8_t table4_run[168] =
-{
- 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2,
- 2, 2, 3, 3, 3, 3, 3, 3,
- 3, 4, 4, 4, 4, 4, 5, 5,
- 5, 5, 5, 6, 6, 6, 6, 7,
- 7, 7, 7, 8, 8, 8, 9, 9,
- 9, 10, 10, 10, 11, 11, 11, 12,
- 12, 13, 13, 14, 14, 15, 15, 16,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 3, 3, 3,
- 3, 4, 4, 4, 5, 5, 5, 6,
- 6, 6, 7, 7, 8, 8, 9, 9,
- 10, 10, 11, 11, 12, 12, 13, 13,
- 14, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36,
+static const int8_t table4_run[168] = {
+ 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2,
+ 2, 2, 3, 3, 3, 3, 3, 3,
+ 3, 4, 4, 4, 4, 4, 5, 5,
+ 5, 5, 5, 6, 6, 6, 6, 7,
+ 7, 7, 7, 8, 8, 8, 9, 9,
+ 9, 10, 10, 10, 11, 11, 11, 12,
+ 12, 13, 13, 14, 14, 15, 15, 16,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 2, 2, 2, 2, 3, 3, 3,
+ 3, 4, 4, 4, 5, 5, 5, 6,
+ 6, 6, 7, 7, 8, 8, 9, 9,
+ 10, 10, 11, 11, 12, 12, 13, 13,
+ 14, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36,
};
extern const uint16_t inter_vlc[103][2];
@@ -618,8 +600,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 rl_table[NB_RL_TABLES] = {
/* intra luminance tables */
/* low motion */
{
@@ -674,1145 +655,1136 @@ RLTable rl_table[NB_RL_TABLES] =
/* motion vector table 0 */
-static const uint16_t table0_mv_code[1100] =
-{
- 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001,
- 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f,
- 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b,
- 0x004d, 0x0003, 0x0022, 0x0023, 0x0025, 0x0027, 0x0042, 0x0048,
- 0x0049, 0x0050, 0x005c, 0x0091, 0x009f, 0x000e, 0x0043, 0x004c,
- 0x0054, 0x0056, 0x008c, 0x0098, 0x009a, 0x009b, 0x00b1, 0x00b2,
- 0x0120, 0x0121, 0x0126, 0x0133, 0x0139, 0x01a1, 0x01a4, 0x01a5,
- 0x01a6, 0x01a7, 0x01ae, 0x01af, 0x000b, 0x0019, 0x0085, 0x0090,
- 0x009b, 0x00aa, 0x00af, 0x010c, 0x010e, 0x011c, 0x011e, 0x0133,
- 0x0144, 0x0160, 0x0174, 0x0175, 0x0177, 0x0178, 0x0249, 0x024b,
- 0x0252, 0x0261, 0x0265, 0x0270, 0x0352, 0x0353, 0x0355, 0x0359,
- 0x0010, 0x0011, 0x0013, 0x0034, 0x0035, 0x0036, 0x0037, 0x003d,
- 0x003e, 0x0109, 0x0126, 0x0156, 0x021a, 0x021e, 0x023a, 0x023e,
- 0x028e, 0x028f, 0x02cf, 0x0491, 0x0494, 0x049f, 0x04a0, 0x04a3,
- 0x04a6, 0x04a7, 0x04ad, 0x04ae, 0x04c0, 0x04c4, 0x04c6, 0x04c8,
- 0x04c9, 0x04f5, 0x04f6, 0x04f7, 0x0680, 0x0682, 0x0683, 0x0688,
- 0x0689, 0x068d, 0x068e, 0x068f, 0x06a2, 0x06a3, 0x06a9, 0x06b0,
- 0x06b1, 0x06b4, 0x06b5, 0x0024, 0x0060, 0x0063, 0x0078, 0x0079,
- 0x0211, 0x0244, 0x0245, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b,
- 0x026b, 0x02af, 0x02b8, 0x02bb, 0x0436, 0x0476, 0x0477, 0x047e,
- 0x04c8, 0x04c9, 0x04ca, 0x0514, 0x0586, 0x0587, 0x0598, 0x059d,
- 0x05d9, 0x05da, 0x0920, 0x0921, 0x093b, 0x093c, 0x093d, 0x0942,
- 0x0943, 0x0944, 0x0945, 0x0959, 0x095e, 0x095f, 0x0982, 0x0983,
- 0x098e, 0x098f, 0x09c4, 0x09e7, 0x09e8, 0x09e9, 0x0d02, 0x0d17,
- 0x0d18, 0x0d19, 0x0d41, 0x0d42, 0x0d43, 0x0d50, 0x0d5f, 0x0d6d,
- 0x0d6e, 0x0d6f, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x041e, 0x041f, 0x0420, 0x0421,
- 0x048c, 0x048d, 0x04d3, 0x04d4, 0x04d5, 0x055c, 0x055d, 0x0572,
- 0x0573, 0x0574, 0x0575, 0x08de, 0x08df, 0x08fe, 0x08ff, 0x0996,
- 0x0a36, 0x0a37, 0x0b08, 0x0b09, 0x0b0a, 0x0b0b, 0x0b32, 0x0b33,
- 0x0b34, 0x0b35, 0x0b36, 0x0b37, 0x0b38, 0x0b39, 0x0bb0, 0x0bf7,
- 0x0bf8, 0x0bf9, 0x0bfa, 0x0bfb, 0x0bfc, 0x0bfd, 0x0bfe, 0x0bff,
- 0x1254, 0x1255, 0x1256, 0x1257, 0x1270, 0x1271, 0x1272, 0x1273,
- 0x1274, 0x1275, 0x12ab, 0x12ac, 0x12ad, 0x12ae, 0x12af, 0x12b0,
- 0x12b1, 0x1315, 0x1316, 0x1317, 0x13bf, 0x13c0, 0x13c1, 0x13c2,
- 0x13c3, 0x13c4, 0x13c5, 0x13c6, 0x13c7, 0x13c8, 0x13c9, 0x13ca,
- 0x13cb, 0x13cc, 0x13cd, 0x1a06, 0x1a07, 0x1a28, 0x1a29, 0x1a2a,
- 0x1a2b, 0x1a2c, 0x1a2d, 0x1a80, 0x1abb, 0x1abc, 0x1abd, 0x1ad8,
- 0x1ad9, 0x0094, 0x0095, 0x0096, 0x0097, 0x00a0, 0x00a1, 0x00a2,
- 0x00a3, 0x0831, 0x0832, 0x0833, 0x0834, 0x0835, 0x0836, 0x0837,
- 0x0838, 0x0839, 0x083a, 0x083b, 0x0939, 0x093a, 0x093b, 0x093c,
- 0x093d, 0x093e, 0x093f, 0x09a0, 0x09a1, 0x09a2, 0x09a3, 0x09a4,
- 0x09a5, 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2,
- 0x11b3, 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba,
- 0x11bb, 0x132f, 0x1454, 0x1455, 0x1456, 0x1457, 0x1458, 0x1459,
- 0x145a, 0x145b, 0x145c, 0x145d, 0x145e, 0x145f, 0x1460, 0x1461,
- 0x1462, 0x1463, 0x1464, 0x1465, 0x1466, 0x1467, 0x1468, 0x1469,
- 0x146a, 0x146b, 0x17de, 0x17df, 0x17e0, 0x17e1, 0x17e2, 0x17e3,
- 0x17e4, 0x17e5, 0x17e6, 0x17e7, 0x17e8, 0x17e9, 0x17ea, 0x17eb,
- 0x17ec, 0x17ed, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545,
- 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d,
- 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555,
- 0x2628, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c,
- 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2772, 0x2773, 0x2774,
- 0x2775, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c,
- 0x277d, 0x3503, 0x3544, 0x3545, 0x3546, 0x3547, 0x3560, 0x3561,
- 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, 0x3569,
- 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, 0x3571,
- 0x3572, 0x3573, 0x3574, 0x3575, 0x03f0, 0x103d, 0x103e, 0x103f,
- 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047,
- 0x1048, 0x1049, 0x104a, 0x104b, 0x104c, 0x104d, 0x104e, 0x104f,
- 0x1050, 0x1051, 0x1052, 0x1053, 0x1054, 0x1055, 0x1056, 0x1057,
- 0x1058, 0x1059, 0x105a, 0x105b, 0x105c, 0x105d, 0x105e, 0x105f,
- 0x1060, 0x1061, 0x1270, 0x1271, 0x21b8, 0x21b9, 0x21ba, 0x21bb,
- 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x21f0, 0x21f1, 0x21f2, 0x21f3,
- 0x21f4, 0x21f5, 0x21f6, 0x21f7, 0x21f8, 0x21f9, 0x21fa, 0x21fb,
- 0x21fc, 0x21fd, 0x21fe, 0x21ff, 0x2340, 0x2341, 0x2342, 0x2343,
- 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b,
- 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353,
- 0x2354, 0x2355, 0x2356, 0x2357, 0x265c, 0x2f88, 0x2f89, 0x2f8a,
- 0x2f8b, 0x2f8c, 0x2f8d, 0x2f8e, 0x2f8f, 0x2f90, 0x2f91, 0x2f92,
- 0x2f93, 0x2f94, 0x2f95, 0x2f96, 0x2f97, 0x2f98, 0x2f99, 0x2f9a,
- 0x2f9b, 0x2f9c, 0x2f9d, 0x2f9e, 0x2f9f, 0x2fa0, 0x2fa1, 0x2fa2,
- 0x2fa3, 0x2fa4, 0x2fa5, 0x2fa6, 0x2fa7, 0x2fa8, 0x2fa9, 0x2faa,
- 0x2fab, 0x2fac, 0x2fad, 0x2fae, 0x2faf, 0x2fb0, 0x2fb1, 0x2fb2,
- 0x2fb3, 0x2fb4, 0x2fb5, 0x2fb6, 0x2fb7, 0x2fb8, 0x2fb9, 0x2fba,
- 0x2fbb, 0x4c52, 0x4c53, 0x4e28, 0x4e29, 0x4e2a, 0x4e2b, 0x4e2c,
- 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, 0x4e33, 0x4e34,
- 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, 0x4e3b, 0x4e3c,
- 0x4e3d, 0x4e3e, 0x4e3f, 0x4e80, 0x4e81, 0x4e82, 0x4e83, 0x4e84,
- 0x4e85, 0x4e86, 0x4e87, 0x4e88, 0x4e89, 0x4e8a, 0x4e8b, 0x4e8c,
- 0x4e8d, 0x4e8e, 0x4e8f, 0x4e90, 0x4e91, 0x4e92, 0x4e93, 0x4e94,
- 0x4e95, 0x4e96, 0x4e97, 0x4e98, 0x4e99, 0x4e9a, 0x4e9b, 0x4e9c,
- 0x4e9d, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea1, 0x4ea2, 0x4ea3, 0x4ea4,
- 0x4ea5, 0x4ea6, 0x4ea7, 0x4ea8, 0x4ea9, 0x4eaa, 0x4eab, 0x4eac,
- 0x4ead, 0x4eae, 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb2, 0x4eb3, 0x4eb4,
- 0x4eb5, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, 0x4eba, 0x4ebb, 0x4ebc,
- 0x4ebd, 0x4ebe, 0x4ebf, 0x4ec0, 0x4ec1, 0x4ec2, 0x4ec3, 0x4ec4,
- 0x4ec5, 0x4ec6, 0x4ec7, 0x4ec8, 0x4ec9, 0x4eca, 0x4ecb, 0x6a04,
- 0x6a05, 0x07e2, 0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, 0x07e8,
- 0x07e9, 0x07ea, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0,
- 0x07f1, 0x07f2, 0x07f3, 0x07f4, 0x07f5, 0x07f6, 0x07f7, 0x07f8,
- 0x07f9, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x07fe, 0x07ff, 0x2000,
- 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
- 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x200e, 0x200f, 0x2010,
- 0x2011, 0x2012, 0x2013, 0x2014, 0x2015, 0x2016, 0x2017, 0x2018,
- 0x2019, 0x201a, 0x201b, 0x201c, 0x201d, 0x201e, 0x201f, 0x2020,
- 0x2021, 0x2022, 0x2023, 0x2024, 0x2025, 0x2026, 0x2027, 0x2028,
- 0x2029, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0x202f, 0x2030,
- 0x2031, 0x2032, 0x2033, 0x2034, 0x2035, 0x2036, 0x2037, 0x2038,
- 0x2039, 0x203a, 0x203b, 0x203c, 0x203d, 0x203e, 0x203f, 0x2040,
- 0x2041, 0x2042, 0x2043, 0x2044, 0x2045, 0x2046, 0x2047, 0x2048,
- 0x2049, 0x204a, 0x204b, 0x204c, 0x204d, 0x204e, 0x204f, 0x2050,
- 0x2051, 0x2052, 0x2053, 0x2054, 0x2055, 0x2056, 0x2057, 0x2058,
- 0x2059, 0x205a, 0x205b, 0x205c, 0x205d, 0x205e, 0x205f, 0x2060,
- 0x2061, 0x2062, 0x2063, 0x2064, 0x2065, 0x2066, 0x2067, 0x2068,
- 0x2069, 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0x2070,
- 0x2071, 0x2072, 0x2073, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078,
- 0x2079, 0x4cba, 0x4cbb, 0x5d88, 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c,
- 0x5d8d, 0x5d8e, 0x5d8f, 0x5db0, 0x5db1, 0x5db2, 0x5db3, 0x5db4,
- 0x5db5, 0x5db6, 0x5db7, 0x5db8, 0x5db9, 0x5dba, 0x5dbb, 0x5dbc,
- 0x5dbd, 0x5dbe, 0x5dbf, 0x5e40, 0x5e41, 0x5e42, 0x5e43, 0x5e44,
- 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4c,
- 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, 0x5e51, 0x5e52, 0x5e53, 0x5e54,
- 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, 0x5e5b, 0x5e5c,
- 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, 0x5e62, 0x5e63, 0x5e64,
- 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c,
- 0x5e6d, 0x5e6e, 0x5e6f, 0x5e70, 0x5e71, 0x5e72, 0x5e73, 0x5e74,
- 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, 0x5e7a, 0x5e7b, 0x5e7c,
- 0x5e7d, 0x5e7e, 0x5e7f, 0x5e80, 0x5e81, 0x5e82, 0x5e83, 0x5e84,
- 0x5e85, 0x5e86, 0x5e87, 0x5e88, 0x5e89, 0x5e8a, 0x5e8b, 0x5e8c,
- 0x5e8d, 0x5e8e, 0x5e8f, 0x5e90, 0x5e91, 0x5e92, 0x5e93, 0x5e94,
- 0x5e95, 0x5e96, 0x5e97, 0x5e98, 0x5e99, 0x5e9a, 0x5e9b, 0x5e9c,
- 0x5e9d, 0x5e9e, 0x5e9f, 0x5ea0, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4,
- 0x5ea5, 0x5ea6, 0x5ea7, 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac,
- 0x5ead, 0x5eae, 0x5eaf, 0x5eb0, 0x5eb1, 0x5eb2, 0x5eb3, 0x5eb4,
- 0x5eb5, 0x5eb6, 0x5eb7, 0x5eb8, 0x5eb9, 0x5eba, 0x5ebb, 0x5ebc,
- 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4,
- 0x5ec5, 0x5ec6, 0x5ec7, 0x5ec8, 0x5ec9, 0x5eca, 0x5ecb, 0x5ecc,
- 0x5ecd, 0x5ece, 0x5ecf, 0x5ed0, 0x5ed1, 0x5ed2, 0x5ed3, 0x5ed4,
- 0x5ed5, 0x5ed6, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edb, 0x5edc,
- 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4,
- 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee8, 0x5ee9, 0x5eea, 0x5eeb, 0x5eec,
- 0x5eed, 0x5eee, 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef4,
- 0x5ef5, 0x5ef6, 0x5ef7, 0x5ef8, 0x5ef9, 0x5efa, 0x5efb, 0x5efc,
- 0x5efd, 0x5efe, 0x5eff, 0x5f00, 0x5f01, 0x5f02, 0x5f03, 0x5f04,
- 0x5f05, 0x5f06, 0x5f07, 0x5f08, 0x5f09, 0x5f0a, 0x5f0b, 0x5f0c,
- 0x5f0d, 0x5f0e, 0x5f0f, 0x0000,
+static const uint16_t table0_mv_code[1100] = {
+ 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001,
+ 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f,
+ 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b,
+ 0x004d, 0x0003, 0x0022, 0x0023, 0x0025, 0x0027, 0x0042, 0x0048,
+ 0x0049, 0x0050, 0x005c, 0x0091, 0x009f, 0x000e, 0x0043, 0x004c,
+ 0x0054, 0x0056, 0x008c, 0x0098, 0x009a, 0x009b, 0x00b1, 0x00b2,
+ 0x0120, 0x0121, 0x0126, 0x0133, 0x0139, 0x01a1, 0x01a4, 0x01a5,
+ 0x01a6, 0x01a7, 0x01ae, 0x01af, 0x000b, 0x0019, 0x0085, 0x0090,
+ 0x009b, 0x00aa, 0x00af, 0x010c, 0x010e, 0x011c, 0x011e, 0x0133,
+ 0x0144, 0x0160, 0x0174, 0x0175, 0x0177, 0x0178, 0x0249, 0x024b,
+ 0x0252, 0x0261, 0x0265, 0x0270, 0x0352, 0x0353, 0x0355, 0x0359,
+ 0x0010, 0x0011, 0x0013, 0x0034, 0x0035, 0x0036, 0x0037, 0x003d,
+ 0x003e, 0x0109, 0x0126, 0x0156, 0x021a, 0x021e, 0x023a, 0x023e,
+ 0x028e, 0x028f, 0x02cf, 0x0491, 0x0494, 0x049f, 0x04a0, 0x04a3,
+ 0x04a6, 0x04a7, 0x04ad, 0x04ae, 0x04c0, 0x04c4, 0x04c6, 0x04c8,
+ 0x04c9, 0x04f5, 0x04f6, 0x04f7, 0x0680, 0x0682, 0x0683, 0x0688,
+ 0x0689, 0x068d, 0x068e, 0x068f, 0x06a2, 0x06a3, 0x06a9, 0x06b0,
+ 0x06b1, 0x06b4, 0x06b5, 0x0024, 0x0060, 0x0063, 0x0078, 0x0079,
+ 0x0211, 0x0244, 0x0245, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b,
+ 0x026b, 0x02af, 0x02b8, 0x02bb, 0x0436, 0x0476, 0x0477, 0x047e,
+ 0x04c8, 0x04c9, 0x04ca, 0x0514, 0x0586, 0x0587, 0x0598, 0x059d,
+ 0x05d9, 0x05da, 0x0920, 0x0921, 0x093b, 0x093c, 0x093d, 0x0942,
+ 0x0943, 0x0944, 0x0945, 0x0959, 0x095e, 0x095f, 0x0982, 0x0983,
+ 0x098e, 0x098f, 0x09c4, 0x09e7, 0x09e8, 0x09e9, 0x0d02, 0x0d17,
+ 0x0d18, 0x0d19, 0x0d41, 0x0d42, 0x0d43, 0x0d50, 0x0d5f, 0x0d6d,
+ 0x0d6e, 0x0d6f, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
+ 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x041e, 0x041f, 0x0420, 0x0421,
+ 0x048c, 0x048d, 0x04d3, 0x04d4, 0x04d5, 0x055c, 0x055d, 0x0572,
+ 0x0573, 0x0574, 0x0575, 0x08de, 0x08df, 0x08fe, 0x08ff, 0x0996,
+ 0x0a36, 0x0a37, 0x0b08, 0x0b09, 0x0b0a, 0x0b0b, 0x0b32, 0x0b33,
+ 0x0b34, 0x0b35, 0x0b36, 0x0b37, 0x0b38, 0x0b39, 0x0bb0, 0x0bf7,
+ 0x0bf8, 0x0bf9, 0x0bfa, 0x0bfb, 0x0bfc, 0x0bfd, 0x0bfe, 0x0bff,
+ 0x1254, 0x1255, 0x1256, 0x1257, 0x1270, 0x1271, 0x1272, 0x1273,
+ 0x1274, 0x1275, 0x12ab, 0x12ac, 0x12ad, 0x12ae, 0x12af, 0x12b0,
+ 0x12b1, 0x1315, 0x1316, 0x1317, 0x13bf, 0x13c0, 0x13c1, 0x13c2,
+ 0x13c3, 0x13c4, 0x13c5, 0x13c6, 0x13c7, 0x13c8, 0x13c9, 0x13ca,
+ 0x13cb, 0x13cc, 0x13cd, 0x1a06, 0x1a07, 0x1a28, 0x1a29, 0x1a2a,
+ 0x1a2b, 0x1a2c, 0x1a2d, 0x1a80, 0x1abb, 0x1abc, 0x1abd, 0x1ad8,
+ 0x1ad9, 0x0094, 0x0095, 0x0096, 0x0097, 0x00a0, 0x00a1, 0x00a2,
+ 0x00a3, 0x0831, 0x0832, 0x0833, 0x0834, 0x0835, 0x0836, 0x0837,
+ 0x0838, 0x0839, 0x083a, 0x083b, 0x0939, 0x093a, 0x093b, 0x093c,
+ 0x093d, 0x093e, 0x093f, 0x09a0, 0x09a1, 0x09a2, 0x09a3, 0x09a4,
+ 0x09a5, 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2,
+ 0x11b3, 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba,
+ 0x11bb, 0x132f, 0x1454, 0x1455, 0x1456, 0x1457, 0x1458, 0x1459,
+ 0x145a, 0x145b, 0x145c, 0x145d, 0x145e, 0x145f, 0x1460, 0x1461,
+ 0x1462, 0x1463, 0x1464, 0x1465, 0x1466, 0x1467, 0x1468, 0x1469,
+ 0x146a, 0x146b, 0x17de, 0x17df, 0x17e0, 0x17e1, 0x17e2, 0x17e3,
+ 0x17e4, 0x17e5, 0x17e6, 0x17e7, 0x17e8, 0x17e9, 0x17ea, 0x17eb,
+ 0x17ec, 0x17ed, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545,
+ 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d,
+ 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555,
+ 0x2628, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c,
+ 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2772, 0x2773, 0x2774,
+ 0x2775, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c,
+ 0x277d, 0x3503, 0x3544, 0x3545, 0x3546, 0x3547, 0x3560, 0x3561,
+ 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, 0x3569,
+ 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, 0x3571,
+ 0x3572, 0x3573, 0x3574, 0x3575, 0x03f0, 0x103d, 0x103e, 0x103f,
+ 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047,
+ 0x1048, 0x1049, 0x104a, 0x104b, 0x104c, 0x104d, 0x104e, 0x104f,
+ 0x1050, 0x1051, 0x1052, 0x1053, 0x1054, 0x1055, 0x1056, 0x1057,
+ 0x1058, 0x1059, 0x105a, 0x105b, 0x105c, 0x105d, 0x105e, 0x105f,
+ 0x1060, 0x1061, 0x1270, 0x1271, 0x21b8, 0x21b9, 0x21ba, 0x21bb,
+ 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x21f0, 0x21f1, 0x21f2, 0x21f3,
+ 0x21f4, 0x21f5, 0x21f6, 0x21f7, 0x21f8, 0x21f9, 0x21fa, 0x21fb,
+ 0x21fc, 0x21fd, 0x21fe, 0x21ff, 0x2340, 0x2341, 0x2342, 0x2343,
+ 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b,
+ 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353,
+ 0x2354, 0x2355, 0x2356, 0x2357, 0x265c, 0x2f88, 0x2f89, 0x2f8a,
+ 0x2f8b, 0x2f8c, 0x2f8d, 0x2f8e, 0x2f8f, 0x2f90, 0x2f91, 0x2f92,
+ 0x2f93, 0x2f94, 0x2f95, 0x2f96, 0x2f97, 0x2f98, 0x2f99, 0x2f9a,
+ 0x2f9b, 0x2f9c, 0x2f9d, 0x2f9e, 0x2f9f, 0x2fa0, 0x2fa1, 0x2fa2,
+ 0x2fa3, 0x2fa4, 0x2fa5, 0x2fa6, 0x2fa7, 0x2fa8, 0x2fa9, 0x2faa,
+ 0x2fab, 0x2fac, 0x2fad, 0x2fae, 0x2faf, 0x2fb0, 0x2fb1, 0x2fb2,
+ 0x2fb3, 0x2fb4, 0x2fb5, 0x2fb6, 0x2fb7, 0x2fb8, 0x2fb9, 0x2fba,
+ 0x2fbb, 0x4c52, 0x4c53, 0x4e28, 0x4e29, 0x4e2a, 0x4e2b, 0x4e2c,
+ 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, 0x4e33, 0x4e34,
+ 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, 0x4e3b, 0x4e3c,
+ 0x4e3d, 0x4e3e, 0x4e3f, 0x4e80, 0x4e81, 0x4e82, 0x4e83, 0x4e84,
+ 0x4e85, 0x4e86, 0x4e87, 0x4e88, 0x4e89, 0x4e8a, 0x4e8b, 0x4e8c,
+ 0x4e8d, 0x4e8e, 0x4e8f, 0x4e90, 0x4e91, 0x4e92, 0x4e93, 0x4e94,
+ 0x4e95, 0x4e96, 0x4e97, 0x4e98, 0x4e99, 0x4e9a, 0x4e9b, 0x4e9c,
+ 0x4e9d, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea1, 0x4ea2, 0x4ea3, 0x4ea4,
+ 0x4ea5, 0x4ea6, 0x4ea7, 0x4ea8, 0x4ea9, 0x4eaa, 0x4eab, 0x4eac,
+ 0x4ead, 0x4eae, 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb2, 0x4eb3, 0x4eb4,
+ 0x4eb5, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, 0x4eba, 0x4ebb, 0x4ebc,
+ 0x4ebd, 0x4ebe, 0x4ebf, 0x4ec0, 0x4ec1, 0x4ec2, 0x4ec3, 0x4ec4,
+ 0x4ec5, 0x4ec6, 0x4ec7, 0x4ec8, 0x4ec9, 0x4eca, 0x4ecb, 0x6a04,
+ 0x6a05, 0x07e2, 0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, 0x07e8,
+ 0x07e9, 0x07ea, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0,
+ 0x07f1, 0x07f2, 0x07f3, 0x07f4, 0x07f5, 0x07f6, 0x07f7, 0x07f8,
+ 0x07f9, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x07fe, 0x07ff, 0x2000,
+ 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
+ 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x200e, 0x200f, 0x2010,
+ 0x2011, 0x2012, 0x2013, 0x2014, 0x2015, 0x2016, 0x2017, 0x2018,
+ 0x2019, 0x201a, 0x201b, 0x201c, 0x201d, 0x201e, 0x201f, 0x2020,
+ 0x2021, 0x2022, 0x2023, 0x2024, 0x2025, 0x2026, 0x2027, 0x2028,
+ 0x2029, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0x202f, 0x2030,
+ 0x2031, 0x2032, 0x2033, 0x2034, 0x2035, 0x2036, 0x2037, 0x2038,
+ 0x2039, 0x203a, 0x203b, 0x203c, 0x203d, 0x203e, 0x203f, 0x2040,
+ 0x2041, 0x2042, 0x2043, 0x2044, 0x2045, 0x2046, 0x2047, 0x2048,
+ 0x2049, 0x204a, 0x204b, 0x204c, 0x204d, 0x204e, 0x204f, 0x2050,
+ 0x2051, 0x2052, 0x2053, 0x2054, 0x2055, 0x2056, 0x2057, 0x2058,
+ 0x2059, 0x205a, 0x205b, 0x205c, 0x205d, 0x205e, 0x205f, 0x2060,
+ 0x2061, 0x2062, 0x2063, 0x2064, 0x2065, 0x2066, 0x2067, 0x2068,
+ 0x2069, 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0x2070,
+ 0x2071, 0x2072, 0x2073, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078,
+ 0x2079, 0x4cba, 0x4cbb, 0x5d88, 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c,
+ 0x5d8d, 0x5d8e, 0x5d8f, 0x5db0, 0x5db1, 0x5db2, 0x5db3, 0x5db4,
+ 0x5db5, 0x5db6, 0x5db7, 0x5db8, 0x5db9, 0x5dba, 0x5dbb, 0x5dbc,
+ 0x5dbd, 0x5dbe, 0x5dbf, 0x5e40, 0x5e41, 0x5e42, 0x5e43, 0x5e44,
+ 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4c,
+ 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, 0x5e51, 0x5e52, 0x5e53, 0x5e54,
+ 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, 0x5e5b, 0x5e5c,
+ 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, 0x5e62, 0x5e63, 0x5e64,
+ 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c,
+ 0x5e6d, 0x5e6e, 0x5e6f, 0x5e70, 0x5e71, 0x5e72, 0x5e73, 0x5e74,
+ 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, 0x5e7a, 0x5e7b, 0x5e7c,
+ 0x5e7d, 0x5e7e, 0x5e7f, 0x5e80, 0x5e81, 0x5e82, 0x5e83, 0x5e84,
+ 0x5e85, 0x5e86, 0x5e87, 0x5e88, 0x5e89, 0x5e8a, 0x5e8b, 0x5e8c,
+ 0x5e8d, 0x5e8e, 0x5e8f, 0x5e90, 0x5e91, 0x5e92, 0x5e93, 0x5e94,
+ 0x5e95, 0x5e96, 0x5e97, 0x5e98, 0x5e99, 0x5e9a, 0x5e9b, 0x5e9c,
+ 0x5e9d, 0x5e9e, 0x5e9f, 0x5ea0, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4,
+ 0x5ea5, 0x5ea6, 0x5ea7, 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac,
+ 0x5ead, 0x5eae, 0x5eaf, 0x5eb0, 0x5eb1, 0x5eb2, 0x5eb3, 0x5eb4,
+ 0x5eb5, 0x5eb6, 0x5eb7, 0x5eb8, 0x5eb9, 0x5eba, 0x5ebb, 0x5ebc,
+ 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4,
+ 0x5ec5, 0x5ec6, 0x5ec7, 0x5ec8, 0x5ec9, 0x5eca, 0x5ecb, 0x5ecc,
+ 0x5ecd, 0x5ece, 0x5ecf, 0x5ed0, 0x5ed1, 0x5ed2, 0x5ed3, 0x5ed4,
+ 0x5ed5, 0x5ed6, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edb, 0x5edc,
+ 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4,
+ 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee8, 0x5ee9, 0x5eea, 0x5eeb, 0x5eec,
+ 0x5eed, 0x5eee, 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef4,
+ 0x5ef5, 0x5ef6, 0x5ef7, 0x5ef8, 0x5ef9, 0x5efa, 0x5efb, 0x5efc,
+ 0x5efd, 0x5efe, 0x5eff, 0x5f00, 0x5f01, 0x5f02, 0x5f03, 0x5f04,
+ 0x5f05, 0x5f06, 0x5f07, 0x5f08, 0x5f09, 0x5f0a, 0x5f0b, 0x5f0c,
+ 0x5f0d, 0x5f0e, 0x5f0f, 0x0000,
};
-static const uint8_t table0_mv_bits[1100] =
-{
- 1, 4, 4, 4, 5, 5, 5, 6,
- 6, 6, 7, 7, 7, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 8,
+static const uint8_t table0_mv_bits[1100] = {
+ 1, 4, 4, 4, 5, 5, 5, 6,
+ 6, 6, 7, 7, 7, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 8,
};
-static const uint8_t table0_mvx[1099] =
-{
- 32, 32, 31, 32, 33, 31, 33, 31,
- 33, 32, 34, 32, 30, 32, 31, 34,
- 35, 32, 34, 33, 29, 33, 30, 30,
- 31, 31, 35, 29, 33, 35, 33, 34,
- 31, 29, 30, 34, 30, 36, 28, 32,
- 34, 37, 30, 27, 32, 25, 39, 32,
- 34, 32, 35, 35, 35, 31, 35, 29,
- 32, 29, 30, 29, 37, 27, 36, 38,
- 37, 33, 32, 31, 29, 31, 28, 36,
- 33, 30, 34, 33, 33, 28, 27, 25,
- 31, 26, 39, 32, 32, 31, 33, 39,
- 31, 38, 28, 36, 21, 23, 43, 36,
- 34, 41, 30, 25, 28, 31, 30, 34,
- 38, 35, 61, 34, 28, 30, 37, 37,
- 35, 27, 36, 3, 59, 38, 37, 32,
- 31, 29, 26, 33, 37, 33, 27, 27,
- 35, 34, 34, 40, 42, 33, 32, 29,
- 4, 5, 28, 24, 25, 35, 39, 38,
- 32, 23, 27, 32, 30, 35, 26, 34,
- 60, 36, 29, 22, 26, 41, 7, 30,
- 38, 30, 36, 29, 30, 41, 26, 25,
- 32, 34, 24, 39, 1, 25, 39, 32,
- 28, 29, 32, 38, 26, 36, 28, 63,
- 28, 39, 23, 21, 26, 35, 31, 35,
- 57, 31, 29, 29, 28, 30, 27, 35,
- 2, 38, 40, 34, 37, 29, 38, 43,
- 26, 32, 33, 42, 24, 40, 28, 32,
- 32, 32, 36, 32, 43, 25, 21, 31,
- 30, 31, 41, 29, 33, 37, 26, 37,
- 27, 59, 23, 33, 35, 31, 31, 37,
- 38, 39, 32, 23, 32, 27, 37, 36,
- 31, 40, 25, 27, 38, 31, 36, 28,
- 31, 36, 25, 45, 3, 34, 38, 39,
- 40, 38, 30, 32, 19, 24, 25, 26,
- 45, 20, 24, 33, 33, 31, 41, 34,
- 39, 47, 40, 58, 59, 41, 33, 3,
- 17, 61, 42, 30, 26, 29, 36, 61,
- 33, 37, 62, 28, 25, 38, 25, 38,
- 17, 23, 34, 33, 21, 33, 49, 27,
- 32, 23, 27, 22, 24, 22, 39, 43,
- 27, 37, 6, 42, 47, 26, 30, 31,
- 41, 39, 33, 22, 45, 36, 32, 45,
- 19, 22, 30, 5, 5, 17, 29, 22,
- 31, 31, 43, 37, 27, 32, 32, 32,
- 33, 34, 43, 35, 29, 26, 22, 32,
- 19, 32, 25, 31, 41, 49, 28, 34,
- 28, 39, 34, 19, 37, 38, 29, 21,
- 36, 42, 24, 48, 16, 28, 49, 22,
- 34, 31, 38, 39, 44, 11, 35, 30,
- 33, 33, 23, 28, 33, 46, 15, 13,
- 24, 41, 24, 34, 34, 30, 26, 24,
- 14, 60, 21, 29, 39, 23, 35, 37,
- 63, 45, 33, 34, 47, 41, 22, 42,
- 35, 35, 23, 32, 35, 43, 32, 7,
- 31, 41, 20, 31, 16, 13, 63, 25,
- 30, 32, 35, 30, 30, 31, 42, 47,
- 39, 38, 40, 40, 51, 55, 56, 18,
- 21, 39, 39, 33, 17, 41, 23, 24,
- 43, 25, 31, 20, 19, 45, 1, 34,
- 31, 22, 35, 15, 46, 46, 35, 31,
- 28, 29, 29, 23, 41, 27, 14, 53,
- 53, 27, 24, 32, 57, 32, 17, 42,
- 37, 29, 33, 1, 25, 32, 32, 63,
- 26, 40, 44, 36, 31, 39, 20, 20,
- 44, 23, 33, 34, 35, 33, 33, 28,
- 41, 23, 41, 41, 29, 25, 26, 49,
- 29, 24, 37, 49, 50, 51, 51, 26,
- 39, 25, 26, 15, 39, 18, 42, 17,
- 4, 31, 32, 32, 60, 1, 42, 32,
- 0, 12, 19, 35, 21, 41, 17, 26,
- 20, 45, 46, 32, 37, 22, 47, 29,
- 31, 27, 29, 30, 21, 33, 35, 18,
- 25, 33, 50, 51, 42, 2, 15, 51,
- 53, 33, 25, 29, 55, 37, 38, 33,
- 38, 59, 38, 33, 39, 13, 32, 40,
- 61, 61, 32, 9, 44, 3, 31, 29,
- 25, 31, 27, 23, 9, 25, 9, 29,
- 20, 30, 30, 42, 18, 28, 25, 28,
- 28, 21, 29, 43, 29, 43, 26, 44,
- 44, 21, 38, 21, 24, 45, 45, 35,
- 39, 22, 35, 36, 34, 34, 45, 34,
- 29, 31, 46, 25, 46, 16, 17, 31,
- 20, 32, 47, 47, 47, 32, 49, 49,
- 49, 31, 1, 27, 28, 39, 39, 21,
- 36, 23, 51, 2, 40, 51, 32, 53,
- 24, 30, 24, 30, 21, 40, 57, 57,
- 31, 41, 58, 32, 12, 4, 32, 34,
- 59, 31, 32, 13, 9, 35, 26, 35,
- 37, 61, 37, 63, 26, 29, 41, 38,
- 23, 20, 41, 26, 41, 42, 42, 42,
- 26, 26, 26, 26, 1, 26, 37, 37,
- 37, 23, 34, 42, 27, 43, 34, 27,
- 31, 24, 33, 16, 3, 31, 24, 33,
- 24, 4, 44, 44, 11, 44, 31, 13,
- 13, 44, 45, 13, 25, 22, 38, 26,
- 38, 38, 39, 32, 30, 39, 30, 22,
- 32, 26, 30, 47, 47, 47, 19, 47,
- 30, 31, 35, 8, 23, 47, 47, 27,
- 35, 47, 31, 48, 35, 19, 36, 49,
- 49, 33, 31, 39, 27, 39, 49, 49,
- 50, 50, 50, 39, 31, 51, 51, 39,
- 28, 33, 33, 21, 40, 31, 52, 53,
- 40, 53, 9, 33, 31, 53, 54, 54,
- 54, 55, 55, 34, 15, 56, 25, 56,
- 21, 21, 40, 40, 25, 40, 58, 36,
- 5, 41, 41, 12, 60, 41, 41, 37,
- 22, 61, 18, 29, 29, 30, 61, 30,
- 61, 62, 62, 30, 30, 63, 18, 13,
- 30, 23, 19, 20, 20, 41, 13, 2,
- 5, 5, 1, 5, 32, 6, 32, 35,
- 20, 35, 27, 35, 35, 36, 36, 13,
- 36, 41, 41, 41, 3, 30, 42, 27,
- 20, 30, 27, 28, 30, 21, 33, 33,
- 14, 24, 30, 42, 24, 33, 25, 42,
- 43, 14, 43, 43, 14, 43, 7, 36,
- 37, 37, 37, 37, 7, 14, 25, 43,
- 43, 44, 15, 37, 7, 7, 3, 1,
- 8, 15, 15, 8, 44, 44, 44, 45,
- 45, 45, 45, 8, 8, 45, 21, 45,
- 28, 28, 28, 21, 28, 28, 22, 37,
- 46, 46, 37, 8, 29, 37, 29, 22,
- 46, 37, 22, 29, 47, 47, 38, 38,
- 16, 38, 38, 33, 38, 22, 47, 47,
- 29, 25, 16, 0, 48, 1, 34, 48,
- 48, 34, 25, 26, 26, 49, 49, 26,
- 1, 49, 4, 26, 4, 49, 1, 9,
- 49, 49, 49, 10, 49, 17, 38, 17,
- 17, 50, 38, 50, 50, 22, 38, 51,
- 38, 38, 51, 39, 39, 18, 22, 39,
- 51, 22, 52, 52, 52, 39, 53, 53,
- 10, 23, 18, 29, 10, 53, 29, 54,
- 11, 54, 11, 11, 55, 1, 18, 55,
- 55, 55, 55, 55, 55, 29, 34, 18,
- 29, 56, 56, 34, 57, 34, 34, 29,
- 29, 57, 57, 35, 35, 35, 35, 35,
- 39, 35, 59, 59, 18, 59, 39, 30,
- 18, 40, 60, 60, 61, 30, 18, 61,
- 61, 19, 19,
+static const uint8_t table0_mvx[1099] = {
+ 32, 32, 31, 32, 33, 31, 33, 31,
+ 33, 32, 34, 32, 30, 32, 31, 34,
+ 35, 32, 34, 33, 29, 33, 30, 30,
+ 31, 31, 35, 29, 33, 35, 33, 34,
+ 31, 29, 30, 34, 30, 36, 28, 32,
+ 34, 37, 30, 27, 32, 25, 39, 32,
+ 34, 32, 35, 35, 35, 31, 35, 29,
+ 32, 29, 30, 29, 37, 27, 36, 38,
+ 37, 33, 32, 31, 29, 31, 28, 36,
+ 33, 30, 34, 33, 33, 28, 27, 25,
+ 31, 26, 39, 32, 32, 31, 33, 39,
+ 31, 38, 28, 36, 21, 23, 43, 36,
+ 34, 41, 30, 25, 28, 31, 30, 34,
+ 38, 35, 61, 34, 28, 30, 37, 37,
+ 35, 27, 36, 3, 59, 38, 37, 32,
+ 31, 29, 26, 33, 37, 33, 27, 27,
+ 35, 34, 34, 40, 42, 33, 32, 29,
+ 4, 5, 28, 24, 25, 35, 39, 38,
+ 32, 23, 27, 32, 30, 35, 26, 34,
+ 60, 36, 29, 22, 26, 41, 7, 30,
+ 38, 30, 36, 29, 30, 41, 26, 25,
+ 32, 34, 24, 39, 1, 25, 39, 32,
+ 28, 29, 32, 38, 26, 36, 28, 63,
+ 28, 39, 23, 21, 26, 35, 31, 35,
+ 57, 31, 29, 29, 28, 30, 27, 35,
+ 2, 38, 40, 34, 37, 29, 38, 43,
+ 26, 32, 33, 42, 24, 40, 28, 32,
+ 32, 32, 36, 32, 43, 25, 21, 31,
+ 30, 31, 41, 29, 33, 37, 26, 37,
+ 27, 59, 23, 33, 35, 31, 31, 37,
+ 38, 39, 32, 23, 32, 27, 37, 36,
+ 31, 40, 25, 27, 38, 31, 36, 28,
+ 31, 36, 25, 45, 3, 34, 38, 39,
+ 40, 38, 30, 32, 19, 24, 25, 26,
+ 45, 20, 24, 33, 33, 31, 41, 34,
+ 39, 47, 40, 58, 59, 41, 33, 3,
+ 17, 61, 42, 30, 26, 29, 36, 61,
+ 33, 37, 62, 28, 25, 38, 25, 38,
+ 17, 23, 34, 33, 21, 33, 49, 27,
+ 32, 23, 27, 22, 24, 22, 39, 43,
+ 27, 37, 6, 42, 47, 26, 30, 31,
+ 41, 39, 33, 22, 45, 36, 32, 45,
+ 19, 22, 30, 5, 5, 17, 29, 22,
+ 31, 31, 43, 37, 27, 32, 32, 32,
+ 33, 34, 43, 35, 29, 26, 22, 32,
+ 19, 32, 25, 31, 41, 49, 28, 34,
+ 28, 39, 34, 19, 37, 38, 29, 21,
+ 36, 42, 24, 48, 16, 28, 49, 22,
+ 34, 31, 38, 39, 44, 11, 35, 30,
+ 33, 33, 23, 28, 33, 46, 15, 13,
+ 24, 41, 24, 34, 34, 30, 26, 24,
+ 14, 60, 21, 29, 39, 23, 35, 37,
+ 63, 45, 33, 34, 47, 41, 22, 42,
+ 35, 35, 23, 32, 35, 43, 32, 7,
+ 31, 41, 20, 31, 16, 13, 63, 25,
+ 30, 32, 35, 30, 30, 31, 42, 47,
+ 39, 38, 40, 40, 51, 55, 56, 18,
+ 21, 39, 39, 33, 17, 41, 23, 24,
+ 43, 25, 31, 20, 19, 45, 1, 34,
+ 31, 22, 35, 15, 46, 46, 35, 31,
+ 28, 29, 29, 23, 41, 27, 14, 53,
+ 53, 27, 24, 32, 57, 32, 17, 42,
+ 37, 29, 33, 1, 25, 32, 32, 63,
+ 26, 40, 44, 36, 31, 39, 20, 20,
+ 44, 23, 33, 34, 35, 33, 33, 28,
+ 41, 23, 41, 41, 29, 25, 26, 49,
+ 29, 24, 37, 49, 50, 51, 51, 26,
+ 39, 25, 26, 15, 39, 18, 42, 17,
+ 4, 31, 32, 32, 60, 1, 42, 32,
+ 0, 12, 19, 35, 21, 41, 17, 26,
+ 20, 45, 46, 32, 37, 22, 47, 29,
+ 31, 27, 29, 30, 21, 33, 35, 18,
+ 25, 33, 50, 51, 42, 2, 15, 51,
+ 53, 33, 25, 29, 55, 37, 38, 33,
+ 38, 59, 38, 33, 39, 13, 32, 40,
+ 61, 61, 32, 9, 44, 3, 31, 29,
+ 25, 31, 27, 23, 9, 25, 9, 29,
+ 20, 30, 30, 42, 18, 28, 25, 28,
+ 28, 21, 29, 43, 29, 43, 26, 44,
+ 44, 21, 38, 21, 24, 45, 45, 35,
+ 39, 22, 35, 36, 34, 34, 45, 34,
+ 29, 31, 46, 25, 46, 16, 17, 31,
+ 20, 32, 47, 47, 47, 32, 49, 49,
+ 49, 31, 1, 27, 28, 39, 39, 21,
+ 36, 23, 51, 2, 40, 51, 32, 53,
+ 24, 30, 24, 30, 21, 40, 57, 57,
+ 31, 41, 58, 32, 12, 4, 32, 34,
+ 59, 31, 32, 13, 9, 35, 26, 35,
+ 37, 61, 37, 63, 26, 29, 41, 38,
+ 23, 20, 41, 26, 41, 42, 42, 42,
+ 26, 26, 26, 26, 1, 26, 37, 37,
+ 37, 23, 34, 42, 27, 43, 34, 27,
+ 31, 24, 33, 16, 3, 31, 24, 33,
+ 24, 4, 44, 44, 11, 44, 31, 13,
+ 13, 44, 45, 13, 25, 22, 38, 26,
+ 38, 38, 39, 32, 30, 39, 30, 22,
+ 32, 26, 30, 47, 47, 47, 19, 47,
+ 30, 31, 35, 8, 23, 47, 47, 27,
+ 35, 47, 31, 48, 35, 19, 36, 49,
+ 49, 33, 31, 39, 27, 39, 49, 49,
+ 50, 50, 50, 39, 31, 51, 51, 39,
+ 28, 33, 33, 21, 40, 31, 52, 53,
+ 40, 53, 9, 33, 31, 53, 54, 54,
+ 54, 55, 55, 34, 15, 56, 25, 56,
+ 21, 21, 40, 40, 25, 40, 58, 36,
+ 5, 41, 41, 12, 60, 41, 41, 37,
+ 22, 61, 18, 29, 29, 30, 61, 30,
+ 61, 62, 62, 30, 30, 63, 18, 13,
+ 30, 23, 19, 20, 20, 41, 13, 2,
+ 5, 5, 1, 5, 32, 6, 32, 35,
+ 20, 35, 27, 35, 35, 36, 36, 13,
+ 36, 41, 41, 41, 3, 30, 42, 27,
+ 20, 30, 27, 28, 30, 21, 33, 33,
+ 14, 24, 30, 42, 24, 33, 25, 42,
+ 43, 14, 43, 43, 14, 43, 7, 36,
+ 37, 37, 37, 37, 7, 14, 25, 43,
+ 43, 44, 15, 37, 7, 7, 3, 1,
+ 8, 15, 15, 8, 44, 44, 44, 45,
+ 45, 45, 45, 8, 8, 45, 21, 45,
+ 28, 28, 28, 21, 28, 28, 22, 37,
+ 46, 46, 37, 8, 29, 37, 29, 22,
+ 46, 37, 22, 29, 47, 47, 38, 38,
+ 16, 38, 38, 33, 38, 22, 47, 47,
+ 29, 25, 16, 0, 48, 1, 34, 48,
+ 48, 34, 25, 26, 26, 49, 49, 26,
+ 1, 49, 4, 26, 4, 49, 1, 9,
+ 49, 49, 49, 10, 49, 17, 38, 17,
+ 17, 50, 38, 50, 50, 22, 38, 51,
+ 38, 38, 51, 39, 39, 18, 22, 39,
+ 51, 22, 52, 52, 52, 39, 53, 53,
+ 10, 23, 18, 29, 10, 53, 29, 54,
+ 11, 54, 11, 11, 55, 1, 18, 55,
+ 55, 55, 55, 55, 55, 29, 34, 18,
+ 29, 56, 56, 34, 57, 34, 34, 29,
+ 29, 57, 57, 35, 35, 35, 35, 35,
+ 39, 35, 59, 59, 18, 59, 39, 30,
+ 18, 40, 60, 60, 61, 30, 18, 61,
+ 61, 19, 19,
};
-static const uint8_t table0_mvy[1099] =
-{
- 32, 31, 32, 33, 32, 31, 31, 33,
- 33, 34, 32, 30, 32, 35, 34, 31,
- 32, 29, 33, 30, 32, 34, 33, 31,
- 30, 35, 31, 31, 29, 33, 35, 30,
- 29, 33, 34, 34, 30, 32, 32, 36,
- 29, 32, 35, 32, 28, 32, 32, 27,
- 35, 37, 34, 29, 30, 36, 35, 34,
- 25, 30, 29, 35, 33, 31, 31, 32,
- 31, 28, 39, 28, 29, 37, 31, 33,
- 27, 36, 28, 36, 37, 33, 33, 31,
- 27, 32, 31, 38, 26, 25, 25, 33,
- 39, 31, 34, 30, 32, 32, 32, 34,
- 36, 32, 28, 33, 30, 38, 37, 27,
- 33, 28, 32, 37, 35, 38, 29, 34,
- 27, 29, 29, 32, 32, 34, 35, 3,
- 26, 36, 31, 38, 30, 26, 35, 34,
- 37, 26, 25, 32, 32, 39, 23, 37,
- 32, 32, 29, 32, 29, 36, 29, 30,
- 41, 31, 30, 21, 39, 25, 34, 38,
- 32, 35, 39, 32, 33, 33, 32, 27,
- 29, 25, 28, 27, 26, 31, 30, 35,
- 24, 24, 31, 34, 32, 30, 35, 40,
- 28, 38, 5, 35, 29, 36, 36, 32,
- 38, 30, 33, 31, 35, 26, 23, 38,
- 32, 41, 28, 25, 37, 40, 37, 39,
- 32, 36, 33, 39, 25, 26, 28, 31,
- 28, 42, 23, 31, 33, 31, 39, 1,
- 59, 22, 27, 4, 33, 34, 33, 24,
- 41, 3, 35, 41, 41, 28, 36, 36,
- 28, 33, 35, 21, 23, 21, 22, 37,
- 27, 27, 43, 29, 60, 39, 27, 25,
- 59, 34, 27, 27, 26, 40, 37, 27,
- 61, 26, 39, 33, 31, 22, 37, 25,
- 30, 25, 24, 61, 31, 34, 25, 38,
- 32, 32, 30, 3, 61, 43, 29, 23,
- 28, 32, 28, 32, 31, 34, 5, 33,
- 32, 33, 33, 42, 37, 23, 38, 31,
- 40, 26, 32, 26, 37, 38, 36, 24,
- 29, 30, 20, 22, 29, 24, 32, 41,
- 2, 34, 25, 33, 29, 31, 39, 35,
- 36, 24, 32, 30, 33, 27, 44, 60,
- 30, 36, 19, 34, 31, 24, 16, 35,
- 32, 38, 21, 33, 31, 31, 21, 35,
- 5, 17, 29, 38, 38, 18, 58, 19,
- 43, 41, 30, 41, 43, 39, 29, 7,
- 29, 17, 28, 19, 28, 31, 25, 19,
- 40, 26, 21, 33, 39, 23, 40, 30,
- 39, 34, 35, 32, 32, 24, 33, 30,
- 40, 47, 39, 37, 32, 33, 24, 23,
- 45, 47, 27, 23, 42, 32, 32, 33,
- 36, 37, 37, 17, 18, 22, 40, 38,
- 32, 31, 35, 24, 17, 25, 17, 23,
- 33, 34, 51, 42, 31, 36, 36, 29,
- 21, 22, 37, 44, 43, 25, 47, 33,
- 45, 27, 31, 58, 31, 32, 31, 38,
- 43, 20, 47, 45, 54, 1, 26, 34,
- 38, 14, 22, 24, 33, 34, 32, 32,
- 37, 21, 23, 49, 35, 23, 28, 39,
- 39, 23, 55, 33, 30, 30, 63, 16,
- 42, 28, 13, 33, 33, 35, 19, 46,
- 43, 17, 19, 36, 39, 24, 31, 32,
- 33, 26, 28, 62, 33, 63, 33, 39,
- 19, 49, 17, 31, 43, 13, 15, 29,
- 25, 35, 33, 23, 49, 41, 28, 29,
- 34, 38, 7, 61, 11, 50, 13, 41,
- 19, 47, 25, 26, 15, 42, 41, 29,
- 45, 27, 17, 35, 32, 29, 32, 24,
- 13, 26, 26, 31, 24, 33, 28, 30,
- 31, 11, 45, 46, 33, 33, 35, 57,
- 32, 32, 35, 45, 34, 11, 37, 42,
- 39, 37, 31, 49, 21, 27, 29, 47,
- 53, 40, 51, 16, 26, 1, 40, 30,
- 41, 44, 34, 25, 27, 31, 35, 35,
- 31, 15, 49, 1, 35, 40, 5, 58,
- 21, 29, 22, 59, 45, 31, 9, 26,
- 9, 29, 11, 32, 30, 3, 13, 20,
- 18, 20, 11, 3, 29, 40, 31, 53,
- 30, 17, 20, 37, 31, 42, 47, 47,
- 54, 38, 9, 34, 13, 37, 21, 25,
- 27, 43, 42, 45, 40, 25, 27, 46,
- 22, 25, 53, 20, 2, 14, 39, 15,
- 22, 44, 34, 21, 38, 33, 27, 48,
- 34, 52, 35, 47, 49, 54, 2, 13,
- 23, 52, 29, 45, 22, 49, 54, 21,
- 40, 42, 31, 30, 29, 34, 0, 25,
- 23, 51, 24, 59, 28, 38, 29, 31,
- 2, 13, 31, 8, 31, 33, 12, 45,
- 41, 7, 14, 30, 25, 18, 43, 20,
- 43, 35, 44, 1, 49, 42, 42, 18,
- 41, 38, 41, 44, 53, 11, 20, 25,
- 45, 46, 47, 48, 39, 52, 46, 49,
- 63, 55, 44, 38, 13, 13, 57, 22,
- 51, 16, 12, 28, 35, 57, 25, 20,
- 26, 28, 28, 29, 32, 31, 62, 34,
- 35, 35, 19, 49, 48, 39, 40, 18,
- 43, 46, 11, 6, 48, 19, 49, 41,
- 10, 23, 58, 17, 21, 23, 34, 30,
- 60, 0, 44, 34, 26, 37, 46, 43,
- 49, 59, 4, 34, 59, 37, 22, 25,
- 28, 46, 6, 40, 59, 42, 36, 61,
- 28, 30, 31, 43, 10, 22, 23, 47,
- 20, 52, 55, 36, 25, 16, 1, 11,
- 27, 29, 5, 63, 18, 41, 31, 34,
- 38, 1, 5, 13, 28, 31, 17, 38,
- 39, 41, 36, 37, 22, 39, 33, 43,
- 43, 15, 17, 49, 30, 21, 22, 20,
- 10, 17, 25, 54, 57, 3, 34, 8,
- 36, 25, 31, 14, 15, 19, 29, 25,
- 18, 39, 53, 22, 27, 20, 29, 33,
- 41, 42, 35, 62, 50, 29, 53, 50,
- 35, 55, 42, 61, 63, 4, 7, 42,
- 21, 46, 47, 49, 27, 46, 17, 55,
- 41, 50, 63, 4, 56, 18, 8, 10,
- 18, 51, 63, 36, 55, 18, 5, 55,
- 9, 29, 17, 21, 30, 27, 1, 59,
- 7, 11, 12, 15, 5, 42, 24, 41,
- 43, 7, 27, 22, 25, 31, 30, 37,
- 22, 39, 53, 29, 36, 37, 48, 0,
- 5, 13, 17, 31, 32, 26, 46, 28,
- 44, 45, 46, 53, 49, 51, 3, 41,
- 3, 22, 42, 33, 5, 45, 7, 22,
- 40, 53, 24, 14, 25, 27, 10, 12,
- 34, 16, 17, 53, 20, 26, 39, 45,
- 18, 45, 35, 33, 31, 49, 4, 39,
- 42, 11, 51, 5, 13, 26, 27, 17,
- 52, 30, 0, 22, 12, 34, 62, 36,
- 38, 41, 47, 30, 63, 38, 41, 43,
- 59, 33, 45, 37, 38, 40, 47, 24,
- 48, 49, 30, 1, 10, 22, 49, 15,
- 39, 59, 31, 32, 33, 18, 13, 15,
- 31, 21, 27, 44, 42, 39, 46, 17,
- 26, 32, 30, 31, 0, 30, 34, 9,
- 12, 13, 25, 31, 32, 55, 43, 35,
- 61, 33, 35, 46, 25, 47, 48, 62,
- 63, 38, 61, 1, 2, 5, 7, 9,
- 46, 10, 34, 35, 36, 55, 51, 7,
- 40, 23, 34, 37, 5, 13, 42, 18,
- 25, 27, 28,
+static const uint8_t table0_mvy[1099] = {
+ 32, 31, 32, 33, 32, 31, 31, 33,
+ 33, 34, 32, 30, 32, 35, 34, 31,
+ 32, 29, 33, 30, 32, 34, 33, 31,
+ 30, 35, 31, 31, 29, 33, 35, 30,
+ 29, 33, 34, 34, 30, 32, 32, 36,
+ 29, 32, 35, 32, 28, 32, 32, 27,
+ 35, 37, 34, 29, 30, 36, 35, 34,
+ 25, 30, 29, 35, 33, 31, 31, 32,
+ 31, 28, 39, 28, 29, 37, 31, 33,
+ 27, 36, 28, 36, 37, 33, 33, 31,
+ 27, 32, 31, 38, 26, 25, 25, 33,
+ 39, 31, 34, 30, 32, 32, 32, 34,
+ 36, 32, 28, 33, 30, 38, 37, 27,
+ 33, 28, 32, 37, 35, 38, 29, 34,
+ 27, 29, 29, 32, 32, 34, 35, 3,
+ 26, 36, 31, 38, 30, 26, 35, 34,
+ 37, 26, 25, 32, 32, 39, 23, 37,
+ 32, 32, 29, 32, 29, 36, 29, 30,
+ 41, 31, 30, 21, 39, 25, 34, 38,
+ 32, 35, 39, 32, 33, 33, 32, 27,
+ 29, 25, 28, 27, 26, 31, 30, 35,
+ 24, 24, 31, 34, 32, 30, 35, 40,
+ 28, 38, 5, 35, 29, 36, 36, 32,
+ 38, 30, 33, 31, 35, 26, 23, 38,
+ 32, 41, 28, 25, 37, 40, 37, 39,
+ 32, 36, 33, 39, 25, 26, 28, 31,
+ 28, 42, 23, 31, 33, 31, 39, 1,
+ 59, 22, 27, 4, 33, 34, 33, 24,
+ 41, 3, 35, 41, 41, 28, 36, 36,
+ 28, 33, 35, 21, 23, 21, 22, 37,
+ 27, 27, 43, 29, 60, 39, 27, 25,
+ 59, 34, 27, 27, 26, 40, 37, 27,
+ 61, 26, 39, 33, 31, 22, 37, 25,
+ 30, 25, 24, 61, 31, 34, 25, 38,
+ 32, 32, 30, 3, 61, 43, 29, 23,
+ 28, 32, 28, 32, 31, 34, 5, 33,
+ 32, 33, 33, 42, 37, 23, 38, 31,
+ 40, 26, 32, 26, 37, 38, 36, 24,
+ 29, 30, 20, 22, 29, 24, 32, 41,
+ 2, 34, 25, 33, 29, 31, 39, 35,
+ 36, 24, 32, 30, 33, 27, 44, 60,
+ 30, 36, 19, 34, 31, 24, 16, 35,
+ 32, 38, 21, 33, 31, 31, 21, 35,
+ 5, 17, 29, 38, 38, 18, 58, 19,
+ 43, 41, 30, 41, 43, 39, 29, 7,
+ 29, 17, 28, 19, 28, 31, 25, 19,
+ 40, 26, 21, 33, 39, 23, 40, 30,
+ 39, 34, 35, 32, 32, 24, 33, 30,
+ 40, 47, 39, 37, 32, 33, 24, 23,
+ 45, 47, 27, 23, 42, 32, 32, 33,
+ 36, 37, 37, 17, 18, 22, 40, 38,
+ 32, 31, 35, 24, 17, 25, 17, 23,
+ 33, 34, 51, 42, 31, 36, 36, 29,
+ 21, 22, 37, 44, 43, 25, 47, 33,
+ 45, 27, 31, 58, 31, 32, 31, 38,
+ 43, 20, 47, 45, 54, 1, 26, 34,
+ 38, 14, 22, 24, 33, 34, 32, 32,
+ 37, 21, 23, 49, 35, 23, 28, 39,
+ 39, 23, 55, 33, 30, 30, 63, 16,
+ 42, 28, 13, 33, 33, 35, 19, 46,
+ 43, 17, 19, 36, 39, 24, 31, 32,
+ 33, 26, 28, 62, 33, 63, 33, 39,
+ 19, 49, 17, 31, 43, 13, 15, 29,
+ 25, 35, 33, 23, 49, 41, 28, 29,
+ 34, 38, 7, 61, 11, 50, 13, 41,
+ 19, 47, 25, 26, 15, 42, 41, 29,
+ 45, 27, 17, 35, 32, 29, 32, 24,
+ 13, 26, 26, 31, 24, 33, 28, 30,
+ 31, 11, 45, 46, 33, 33, 35, 57,
+ 32, 32, 35, 45, 34, 11, 37, 42,
+ 39, 37, 31, 49, 21, 27, 29, 47,
+ 53, 40, 51, 16, 26, 1, 40, 30,
+ 41, 44, 34, 25, 27, 31, 35, 35,
+ 31, 15, 49, 1, 35, 40, 5, 58,
+ 21, 29, 22, 59, 45, 31, 9, 26,
+ 9, 29, 11, 32, 30, 3, 13, 20,
+ 18, 20, 11, 3, 29, 40, 31, 53,
+ 30, 17, 20, 37, 31, 42, 47, 47,
+ 54, 38, 9, 34, 13, 37, 21, 25,
+ 27, 43, 42, 45, 40, 25, 27, 46,
+ 22, 25, 53, 20, 2, 14, 39, 15,
+ 22, 44, 34, 21, 38, 33, 27, 48,
+ 34, 52, 35, 47, 49, 54, 2, 13,
+ 23, 52, 29, 45, 22, 49, 54, 21,
+ 40, 42, 31, 30, 29, 34, 0, 25,
+ 23, 51, 24, 59, 28, 38, 29, 31,
+ 2, 13, 31, 8, 31, 33, 12, 45,
+ 41, 7, 14, 30, 25, 18, 43, 20,
+ 43, 35, 44, 1, 49, 42, 42, 18,
+ 41, 38, 41, 44, 53, 11, 20, 25,
+ 45, 46, 47, 48, 39, 52, 46, 49,
+ 63, 55, 44, 38, 13, 13, 57, 22,
+ 51, 16, 12, 28, 35, 57, 25, 20,
+ 26, 28, 28, 29, 32, 31, 62, 34,
+ 35, 35, 19, 49, 48, 39, 40, 18,
+ 43, 46, 11, 6, 48, 19, 49, 41,
+ 10, 23, 58, 17, 21, 23, 34, 30,
+ 60, 0, 44, 34, 26, 37, 46, 43,
+ 49, 59, 4, 34, 59, 37, 22, 25,
+ 28, 46, 6, 40, 59, 42, 36, 61,
+ 28, 30, 31, 43, 10, 22, 23, 47,
+ 20, 52, 55, 36, 25, 16, 1, 11,
+ 27, 29, 5, 63, 18, 41, 31, 34,
+ 38, 1, 5, 13, 28, 31, 17, 38,
+ 39, 41, 36, 37, 22, 39, 33, 43,
+ 43, 15, 17, 49, 30, 21, 22, 20,
+ 10, 17, 25, 54, 57, 3, 34, 8,
+ 36, 25, 31, 14, 15, 19, 29, 25,
+ 18, 39, 53, 22, 27, 20, 29, 33,
+ 41, 42, 35, 62, 50, 29, 53, 50,
+ 35, 55, 42, 61, 63, 4, 7, 42,
+ 21, 46, 47, 49, 27, 46, 17, 55,
+ 41, 50, 63, 4, 56, 18, 8, 10,
+ 18, 51, 63, 36, 55, 18, 5, 55,
+ 9, 29, 17, 21, 30, 27, 1, 59,
+ 7, 11, 12, 15, 5, 42, 24, 41,
+ 43, 7, 27, 22, 25, 31, 30, 37,
+ 22, 39, 53, 29, 36, 37, 48, 0,
+ 5, 13, 17, 31, 32, 26, 46, 28,
+ 44, 45, 46, 53, 49, 51, 3, 41,
+ 3, 22, 42, 33, 5, 45, 7, 22,
+ 40, 53, 24, 14, 25, 27, 10, 12,
+ 34, 16, 17, 53, 20, 26, 39, 45,
+ 18, 45, 35, 33, 31, 49, 4, 39,
+ 42, 11, 51, 5, 13, 26, 27, 17,
+ 52, 30, 0, 22, 12, 34, 62, 36,
+ 38, 41, 47, 30, 63, 38, 41, 43,
+ 59, 33, 45, 37, 38, 40, 47, 24,
+ 48, 49, 30, 1, 10, 22, 49, 15,
+ 39, 59, 31, 32, 33, 18, 13, 15,
+ 31, 21, 27, 44, 42, 39, 46, 17,
+ 26, 32, 30, 31, 0, 30, 34, 9,
+ 12, 13, 25, 31, 32, 55, 43, 35,
+ 61, 33, 35, 46, 25, 47, 48, 62,
+ 63, 38, 61, 1, 2, 5, 7, 9,
+ 46, 10, 34, 35, 36, 55, 51, 7,
+ 40, 23, 34, 37, 5, 13, 42, 18,
+ 25, 27, 28,
};
/* motion vector table 1 */
-static const uint16_t table1_mv_code[1100] =
-{
- 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c,
- 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041,
- 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069,
- 0x006b, 0x00a6, 0x00c1, 0x00cb, 0x00cc, 0x00ce, 0x00da, 0x00e8,
- 0x00ee, 0x0087, 0x0090, 0x009e, 0x009f, 0x00ba, 0x00ca, 0x00d8,
- 0x00db, 0x00df, 0x0104, 0x0109, 0x010c, 0x0143, 0x0145, 0x014a,
- 0x0156, 0x015c, 0x01b3, 0x01d3, 0x01da, 0x0103, 0x0109, 0x010b,
- 0x0122, 0x0127, 0x0134, 0x0161, 0x0164, 0x0176, 0x0184, 0x018d,
- 0x018e, 0x018f, 0x0190, 0x0193, 0x0196, 0x019d, 0x019e, 0x019f,
- 0x01a9, 0x01b2, 0x01b4, 0x01ba, 0x01bb, 0x01bc, 0x0201, 0x0202,
- 0x0205, 0x0207, 0x020d, 0x0210, 0x0211, 0x0215, 0x021b, 0x021f,
- 0x0281, 0x0285, 0x0290, 0x029c, 0x029d, 0x02a2, 0x02a7, 0x02a8,
- 0x02aa, 0x02b0, 0x02b1, 0x02b4, 0x02bc, 0x02bf, 0x0320, 0x0326,
- 0x0327, 0x0329, 0x032a, 0x0336, 0x0360, 0x0362, 0x0363, 0x0372,
- 0x03b2, 0x03bc, 0x03bd, 0x0203, 0x0205, 0x021a, 0x0249, 0x024a,
- 0x024c, 0x02c7, 0x02ca, 0x02ce, 0x02ef, 0x030d, 0x0322, 0x0325,
- 0x0338, 0x0373, 0x037a, 0x0409, 0x0415, 0x0416, 0x0418, 0x0428,
- 0x042d, 0x042f, 0x0434, 0x0508, 0x0509, 0x0510, 0x0511, 0x051c,
- 0x051e, 0x0524, 0x0541, 0x0543, 0x0546, 0x0547, 0x054d, 0x0557,
- 0x055f, 0x056a, 0x056c, 0x056d, 0x056f, 0x0576, 0x0577, 0x057a,
- 0x057b, 0x057c, 0x057d, 0x0600, 0x0601, 0x0603, 0x0614, 0x0616,
- 0x0617, 0x061c, 0x061f, 0x0642, 0x0648, 0x0649, 0x064a, 0x064b,
- 0x0657, 0x0668, 0x0669, 0x066b, 0x066e, 0x067f, 0x06c2, 0x06c8,
- 0x06cb, 0x06de, 0x06df, 0x06e2, 0x06e3, 0x06ef, 0x0748, 0x074b,
- 0x076e, 0x076f, 0x077c, 0x0409, 0x0423, 0x0428, 0x0429, 0x042a,
- 0x042b, 0x0432, 0x0433, 0x0496, 0x049a, 0x04d5, 0x04db, 0x0581,
- 0x0582, 0x058b, 0x058c, 0x058d, 0x0598, 0x0599, 0x059a, 0x059e,
- 0x05dd, 0x0619, 0x0632, 0x0633, 0x0648, 0x0672, 0x06a1, 0x06a2,
- 0x06a3, 0x06af, 0x06e2, 0x06e3, 0x06e4, 0x0800, 0x0801, 0x0802,
- 0x0803, 0x081a, 0x081b, 0x0829, 0x082f, 0x0832, 0x083e, 0x083f,
- 0x0852, 0x0853, 0x0858, 0x086b, 0x0877, 0x0878, 0x0879, 0x087a,
- 0x087b, 0x0a00, 0x0a01, 0x0a0d, 0x0a0e, 0x0a0f, 0x0a24, 0x0a37,
- 0x0a3a, 0x0a3b, 0x0a3e, 0x0a46, 0x0a47, 0x0a4a, 0x0a4b, 0x0a5f,
- 0x0a79, 0x0a7a, 0x0a7b, 0x0a80, 0x0a81, 0x0a84, 0x0a85, 0x0a99,
- 0x0aa5, 0x0aa6, 0x0ab8, 0x0aba, 0x0abb, 0x0abc, 0x0abd, 0x0ac8,
- 0x0ace, 0x0acf, 0x0ad7, 0x0adc, 0x0aeb, 0x0c04, 0x0c25, 0x0c26,
- 0x0c27, 0x0c2a, 0x0c2b, 0x0c3a, 0x0c3b, 0x0c3c, 0x0c3d, 0x0ca0,
- 0x0cad, 0x0cd4, 0x0cd5, 0x0cfc, 0x0cfd, 0x0d86, 0x0d92, 0x0d93,
- 0x0d94, 0x0d95, 0x0db0, 0x0db8, 0x0db9, 0x0dba, 0x0dbb, 0x0dc0,
- 0x0dc2, 0x0dc3, 0x0dda, 0x0ddb, 0x0ddc, 0x0ddd, 0x0e92, 0x0e93,
- 0x0e94, 0x0e95, 0x0ec7, 0x0ecc, 0x0ece, 0x0ecf, 0x0ed8, 0x0ed9,
- 0x0eda, 0x0edb, 0x0808, 0x0809, 0x080a, 0x0810, 0x0811, 0x0844,
- 0x0845, 0x0861, 0x0862, 0x0863, 0x086c, 0x0922, 0x0923, 0x092e,
- 0x092f, 0x0936, 0x0937, 0x09b1, 0x09b2, 0x09b3, 0x09b4, 0x09b5,
- 0x09b8, 0x09b9, 0x09ba, 0x09bb, 0x09bc, 0x09bd, 0x09be, 0x09bf,
- 0x0b00, 0x0b15, 0x0b2c, 0x0b2d, 0x0b2e, 0x0b2f, 0x0b36, 0x0bb9,
- 0x0c28, 0x0c2a, 0x0c2b, 0x0c2c, 0x0c2d, 0x0c2e, 0x0c2f, 0x0c30,
- 0x0c31, 0x0c38, 0x0c60, 0x0c61, 0x0c62, 0x0c63, 0x0c8d, 0x0c8e,
- 0x0c8f, 0x0c92, 0x0cbe, 0x0cbf, 0x0ce6, 0x0ce7, 0x0d40, 0x0d41,
- 0x0d57, 0x0d58, 0x0d59, 0x0d5a, 0x0d5b, 0x0d5c, 0x0d5d, 0x0d98,
- 0x0d99, 0x0d9a, 0x0d9b, 0x0d9c, 0x0d9d, 0x0dad, 0x0dae, 0x0daf,
- 0x0dc0, 0x0dc1, 0x0dc2, 0x0dc3, 0x0dca, 0x0dcb, 0x0dec, 0x0ded,
- 0x0dee, 0x0def, 0x1018, 0x1022, 0x1023, 0x1030, 0x1031, 0x1032,
- 0x1033, 0x1050, 0x1051, 0x105c, 0x1074, 0x1075, 0x1076, 0x1077,
- 0x1078, 0x1079, 0x107a, 0x107b, 0x10b2, 0x10b3, 0x10b8, 0x10b9,
- 0x10ba, 0x10bb, 0x10d4, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x1404,
- 0x1405, 0x1406, 0x1407, 0x1410, 0x1411, 0x1412, 0x1413, 0x1414,
- 0x1415, 0x1416, 0x1417, 0x1418, 0x1419, 0x1466, 0x1467, 0x1468,
- 0x1469, 0x146a, 0x146b, 0x146c, 0x146d, 0x147e, 0x147f, 0x1488,
- 0x1489, 0x148a, 0x148b, 0x14b6, 0x14b7, 0x14b8, 0x14b9, 0x14ba,
- 0x14bb, 0x14bc, 0x14bd, 0x14f0, 0x14f1, 0x14f8, 0x14f9, 0x14fa,
- 0x14fb, 0x14fc, 0x14fd, 0x14fe, 0x14ff, 0x152a, 0x152b, 0x152c,
- 0x152d, 0x152e, 0x152f, 0x1530, 0x1531, 0x1548, 0x1549, 0x154e,
- 0x154f, 0x1558, 0x1559, 0x155a, 0x155b, 0x1572, 0x159a, 0x159b,
- 0x15ac, 0x15ba, 0x15bb, 0x15d0, 0x15d1, 0x15d2, 0x15d3, 0x15d4,
- 0x15d5, 0x181d, 0x181e, 0x181f, 0x1840, 0x1841, 0x1842, 0x1843,
- 0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x1861, 0x1862,
- 0x1863, 0x1864, 0x1865, 0x1866, 0x1867, 0x1868, 0x1869, 0x186a,
- 0x186b, 0x186c, 0x186d, 0x186e, 0x191b, 0x191c, 0x191d, 0x191e,
- 0x191f, 0x1942, 0x1943, 0x1944, 0x1945, 0x1946, 0x1947, 0x1958,
- 0x1959, 0x19ed, 0x19ee, 0x19ef, 0x19f0, 0x19f1, 0x19f2, 0x19f3,
- 0x19f4, 0x19f5, 0x19f6, 0x19f7, 0x1b0e, 0x1b0f, 0x1b62, 0x1b63,
- 0x1b64, 0x1b65, 0x1b66, 0x1b67, 0x1b68, 0x1b69, 0x1b6a, 0x1b6b,
- 0x1b6c, 0x1b6d, 0x1b6e, 0x1b6f, 0x1b82, 0x1ba8, 0x1ba9, 0x1baa,
- 0x1bab, 0x1bac, 0x1bad, 0x1bae, 0x1baf, 0x1bb0, 0x1bb1, 0x1bb2,
- 0x1bb3, 0x1d80, 0x1d81, 0x1d82, 0x1d83, 0x1d84, 0x1d85, 0x1d86,
- 0x1d87, 0x1d88, 0x1d89, 0x1d8a, 0x1d8b, 0x1d8c, 0x1d8d, 0x1007,
- 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x100e, 0x100f,
- 0x1016, 0x1080, 0x1081, 0x1082, 0x1083, 0x1084, 0x1085, 0x1086,
- 0x1087, 0x10c0, 0x123a, 0x123b, 0x123c, 0x123d, 0x123e, 0x123f,
- 0x1240, 0x1241, 0x1242, 0x1243, 0x1350, 0x1352, 0x1353, 0x1358,
- 0x1359, 0x135a, 0x135b, 0x135c, 0x135d, 0x135e, 0x135f, 0x1360,
- 0x1361, 0x1602, 0x1603, 0x160c, 0x160d, 0x160e, 0x160f, 0x1620,
- 0x1621, 0x1622, 0x1623, 0x1624, 0x1625, 0x1626, 0x1627, 0x1628,
- 0x1629, 0x166e, 0x166f, 0x167c, 0x167d, 0x167e, 0x167f, 0x1770,
- 0x1771, 0x1852, 0x1853, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876,
- 0x1877, 0x1878, 0x1879, 0x187a, 0x187b, 0x187c, 0x187d, 0x187e,
- 0x187f, 0x1918, 0x1919, 0x1926, 0x1927, 0x1970, 0x1971, 0x1972,
- 0x1973, 0x1974, 0x1975, 0x1976, 0x1977, 0x1978, 0x1979, 0x197a,
- 0x197b, 0x1aa0, 0x1aa1, 0x1aa2, 0x1aa3, 0x1aa4, 0x1aa5, 0x1aa6,
- 0x1aa7, 0x1aa8, 0x1aa9, 0x1aaa, 0x1aab, 0x1aac, 0x1aad, 0x1b3c,
- 0x1b3d, 0x1b3e, 0x1b3f, 0x1b50, 0x1b51, 0x1b52, 0x1b53, 0x1b54,
- 0x1b55, 0x1b56, 0x1b57, 0x1b58, 0x1b59, 0x2032, 0x2033, 0x2034,
- 0x2035, 0x2036, 0x2037, 0x2038, 0x2039, 0x203a, 0x203b, 0x203c,
- 0x203d, 0x203e, 0x203f, 0x2040, 0x2041, 0x2042, 0x2043, 0x20ba,
- 0x20bb, 0x20cc, 0x20cd, 0x20ce, 0x20cf, 0x20e0, 0x20e1, 0x20e2,
- 0x20e3, 0x20e4, 0x20e5, 0x20e6, 0x20e7, 0x21aa, 0x21ab, 0x21c0,
- 0x21c1, 0x21c2, 0x21c3, 0x21c4, 0x21c5, 0x21c6, 0x21c7, 0x21c8,
- 0x21c9, 0x21ca, 0x21cb, 0x21cc, 0x21cd, 0x21ce, 0x21cf, 0x21d0,
- 0x21d1, 0x21d2, 0x21d3, 0x2894, 0x2895, 0x2896, 0x2897, 0x2898,
- 0x2899, 0x289a, 0x289b, 0x289c, 0x289d, 0x289e, 0x289f, 0x28c0,
- 0x28c1, 0x28c2, 0x28c3, 0x28c4, 0x28c5, 0x28c6, 0x28c7, 0x28c8,
- 0x28c9, 0x28ca, 0x28cb, 0x2930, 0x2931, 0x2932, 0x2933, 0x2934,
- 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c,
- 0x293d, 0x293e, 0x293f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964,
- 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x2a40,
- 0x2a41, 0x2a42, 0x2a43, 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48,
- 0x2a49, 0x2a4a, 0x2a4b, 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50,
- 0x2a51, 0x2a52, 0x2a53, 0x2ae6, 0x2ae7, 0x2b24, 0x2b25, 0x2b26,
- 0x2b27, 0x2b28, 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e,
- 0x2b2f, 0x2b30, 0x2b31, 0x2b32, 0x2b33, 0x2b5a, 0x2b5b, 0x3014,
- 0x3015, 0x3016, 0x3017, 0x3020, 0x3021, 0x3022, 0x3023, 0x3024,
- 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c,
- 0x302d, 0x302e, 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034,
- 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x30c0, 0x30c1, 0x30de,
- 0x30df, 0x3218, 0x3219, 0x321a, 0x321b, 0x321c, 0x321d, 0x321e,
- 0x321f, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226,
- 0x3227, 0x3228, 0x3229, 0x322a, 0x322b, 0x322c, 0x322d, 0x322e,
- 0x322f, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3378,
- 0x3379, 0x337a, 0x337b, 0x337c, 0x337d, 0x337e, 0x337f, 0x33c0,
- 0x33c1, 0x33c2, 0x33c3, 0x33c4, 0x33c5, 0x33c6, 0x33c7, 0x33c8,
- 0x33c9, 0x33ca, 0x33cb, 0x33cc, 0x33cd, 0x33ce, 0x33cf, 0x33d0,
- 0x33d1, 0x33d2, 0x33d3, 0x33d4, 0x33d5, 0x33d6, 0x33d7, 0x33d8,
- 0x33d9, 0x3706, 0x3707, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734,
- 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c,
- 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744,
- 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c,
- 0x374d, 0x374e, 0x374f, 0x3b34, 0x3b35, 0x3b36, 0x3b37, 0x3be8,
- 0x3be9, 0x3bea, 0x3beb, 0x3bec, 0x3bed, 0x3bee, 0x3bef, 0x3bf0,
- 0x3bf1, 0x3bf2, 0x3bf3, 0x3bf4, 0x3bf5, 0x3bf6, 0x3bf7, 0x3bf8,
- 0x3bf9, 0x3bfa, 0x3bfb, 0x3bfc, 0x3bfd, 0x3bfe, 0x3bff, 0x2000,
- 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
- 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x202e, 0x202f, 0x2182,
- 0x2183, 0x21b4, 0x21b5, 0x21b6, 0x21b7, 0x21b8, 0x21b9, 0x21ba,
- 0x21bb, 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x2460, 0x2461, 0x2462,
- 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a,
- 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472,
- 0x2473, 0x26a2, 0x26a3, 0x000b,
+static const uint16_t table1_mv_code[1100] = {
+ 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c,
+ 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041,
+ 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069,
+ 0x006b, 0x00a6, 0x00c1, 0x00cb, 0x00cc, 0x00ce, 0x00da, 0x00e8,
+ 0x00ee, 0x0087, 0x0090, 0x009e, 0x009f, 0x00ba, 0x00ca, 0x00d8,
+ 0x00db, 0x00df, 0x0104, 0x0109, 0x010c, 0x0143, 0x0145, 0x014a,
+ 0x0156, 0x015c, 0x01b3, 0x01d3, 0x01da, 0x0103, 0x0109, 0x010b,
+ 0x0122, 0x0127, 0x0134, 0x0161, 0x0164, 0x0176, 0x0184, 0x018d,
+ 0x018e, 0x018f, 0x0190, 0x0193, 0x0196, 0x019d, 0x019e, 0x019f,
+ 0x01a9, 0x01b2, 0x01b4, 0x01ba, 0x01bb, 0x01bc, 0x0201, 0x0202,
+ 0x0205, 0x0207, 0x020d, 0x0210, 0x0211, 0x0215, 0x021b, 0x021f,
+ 0x0281, 0x0285, 0x0290, 0x029c, 0x029d, 0x02a2, 0x02a7, 0x02a8,
+ 0x02aa, 0x02b0, 0x02b1, 0x02b4, 0x02bc, 0x02bf, 0x0320, 0x0326,
+ 0x0327, 0x0329, 0x032a, 0x0336, 0x0360, 0x0362, 0x0363, 0x0372,
+ 0x03b2, 0x03bc, 0x03bd, 0x0203, 0x0205, 0x021a, 0x0249, 0x024a,
+ 0x024c, 0x02c7, 0x02ca, 0x02ce, 0x02ef, 0x030d, 0x0322, 0x0325,
+ 0x0338, 0x0373, 0x037a, 0x0409, 0x0415, 0x0416, 0x0418, 0x0428,
+ 0x042d, 0x042f, 0x0434, 0x0508, 0x0509, 0x0510, 0x0511, 0x051c,
+ 0x051e, 0x0524, 0x0541, 0x0543, 0x0546, 0x0547, 0x054d, 0x0557,
+ 0x055f, 0x056a, 0x056c, 0x056d, 0x056f, 0x0576, 0x0577, 0x057a,
+ 0x057b, 0x057c, 0x057d, 0x0600, 0x0601, 0x0603, 0x0614, 0x0616,
+ 0x0617, 0x061c, 0x061f, 0x0642, 0x0648, 0x0649, 0x064a, 0x064b,
+ 0x0657, 0x0668, 0x0669, 0x066b, 0x066e, 0x067f, 0x06c2, 0x06c8,
+ 0x06cb, 0x06de, 0x06df, 0x06e2, 0x06e3, 0x06ef, 0x0748, 0x074b,
+ 0x076e, 0x076f, 0x077c, 0x0409, 0x0423, 0x0428, 0x0429, 0x042a,
+ 0x042b, 0x0432, 0x0433, 0x0496, 0x049a, 0x04d5, 0x04db, 0x0581,
+ 0x0582, 0x058b, 0x058c, 0x058d, 0x0598, 0x0599, 0x059a, 0x059e,
+ 0x05dd, 0x0619, 0x0632, 0x0633, 0x0648, 0x0672, 0x06a1, 0x06a2,
+ 0x06a3, 0x06af, 0x06e2, 0x06e3, 0x06e4, 0x0800, 0x0801, 0x0802,
+ 0x0803, 0x081a, 0x081b, 0x0829, 0x082f, 0x0832, 0x083e, 0x083f,
+ 0x0852, 0x0853, 0x0858, 0x086b, 0x0877, 0x0878, 0x0879, 0x087a,
+ 0x087b, 0x0a00, 0x0a01, 0x0a0d, 0x0a0e, 0x0a0f, 0x0a24, 0x0a37,
+ 0x0a3a, 0x0a3b, 0x0a3e, 0x0a46, 0x0a47, 0x0a4a, 0x0a4b, 0x0a5f,
+ 0x0a79, 0x0a7a, 0x0a7b, 0x0a80, 0x0a81, 0x0a84, 0x0a85, 0x0a99,
+ 0x0aa5, 0x0aa6, 0x0ab8, 0x0aba, 0x0abb, 0x0abc, 0x0abd, 0x0ac8,
+ 0x0ace, 0x0acf, 0x0ad7, 0x0adc, 0x0aeb, 0x0c04, 0x0c25, 0x0c26,
+ 0x0c27, 0x0c2a, 0x0c2b, 0x0c3a, 0x0c3b, 0x0c3c, 0x0c3d, 0x0ca0,
+ 0x0cad, 0x0cd4, 0x0cd5, 0x0cfc, 0x0cfd, 0x0d86, 0x0d92, 0x0d93,
+ 0x0d94, 0x0d95, 0x0db0, 0x0db8, 0x0db9, 0x0dba, 0x0dbb, 0x0dc0,
+ 0x0dc2, 0x0dc3, 0x0dda, 0x0ddb, 0x0ddc, 0x0ddd, 0x0e92, 0x0e93,
+ 0x0e94, 0x0e95, 0x0ec7, 0x0ecc, 0x0ece, 0x0ecf, 0x0ed8, 0x0ed9,
+ 0x0eda, 0x0edb, 0x0808, 0x0809, 0x080a, 0x0810, 0x0811, 0x0844,
+ 0x0845, 0x0861, 0x0862, 0x0863, 0x086c, 0x0922, 0x0923, 0x092e,
+ 0x092f, 0x0936, 0x0937, 0x09b1, 0x09b2, 0x09b3, 0x09b4, 0x09b5,
+ 0x09b8, 0x09b9, 0x09ba, 0x09bb, 0x09bc, 0x09bd, 0x09be, 0x09bf,
+ 0x0b00, 0x0b15, 0x0b2c, 0x0b2d, 0x0b2e, 0x0b2f, 0x0b36, 0x0bb9,
+ 0x0c28, 0x0c2a, 0x0c2b, 0x0c2c, 0x0c2d, 0x0c2e, 0x0c2f, 0x0c30,
+ 0x0c31, 0x0c38, 0x0c60, 0x0c61, 0x0c62, 0x0c63, 0x0c8d, 0x0c8e,
+ 0x0c8f, 0x0c92, 0x0cbe, 0x0cbf, 0x0ce6, 0x0ce7, 0x0d40, 0x0d41,
+ 0x0d57, 0x0d58, 0x0d59, 0x0d5a, 0x0d5b, 0x0d5c, 0x0d5d, 0x0d98,
+ 0x0d99, 0x0d9a, 0x0d9b, 0x0d9c, 0x0d9d, 0x0dad, 0x0dae, 0x0daf,
+ 0x0dc0, 0x0dc1, 0x0dc2, 0x0dc3, 0x0dca, 0x0dcb, 0x0dec, 0x0ded,
+ 0x0dee, 0x0def, 0x1018, 0x1022, 0x1023, 0x1030, 0x1031, 0x1032,
+ 0x1033, 0x1050, 0x1051, 0x105c, 0x1074, 0x1075, 0x1076, 0x1077,
+ 0x1078, 0x1079, 0x107a, 0x107b, 0x10b2, 0x10b3, 0x10b8, 0x10b9,
+ 0x10ba, 0x10bb, 0x10d4, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x1404,
+ 0x1405, 0x1406, 0x1407, 0x1410, 0x1411, 0x1412, 0x1413, 0x1414,
+ 0x1415, 0x1416, 0x1417, 0x1418, 0x1419, 0x1466, 0x1467, 0x1468,
+ 0x1469, 0x146a, 0x146b, 0x146c, 0x146d, 0x147e, 0x147f, 0x1488,
+ 0x1489, 0x148a, 0x148b, 0x14b6, 0x14b7, 0x14b8, 0x14b9, 0x14ba,
+ 0x14bb, 0x14bc, 0x14bd, 0x14f0, 0x14f1, 0x14f8, 0x14f9, 0x14fa,
+ 0x14fb, 0x14fc, 0x14fd, 0x14fe, 0x14ff, 0x152a, 0x152b, 0x152c,
+ 0x152d, 0x152e, 0x152f, 0x1530, 0x1531, 0x1548, 0x1549, 0x154e,
+ 0x154f, 0x1558, 0x1559, 0x155a, 0x155b, 0x1572, 0x159a, 0x159b,
+ 0x15ac, 0x15ba, 0x15bb, 0x15d0, 0x15d1, 0x15d2, 0x15d3, 0x15d4,
+ 0x15d5, 0x181d, 0x181e, 0x181f, 0x1840, 0x1841, 0x1842, 0x1843,
+ 0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x1861, 0x1862,
+ 0x1863, 0x1864, 0x1865, 0x1866, 0x1867, 0x1868, 0x1869, 0x186a,
+ 0x186b, 0x186c, 0x186d, 0x186e, 0x191b, 0x191c, 0x191d, 0x191e,
+ 0x191f, 0x1942, 0x1943, 0x1944, 0x1945, 0x1946, 0x1947, 0x1958,
+ 0x1959, 0x19ed, 0x19ee, 0x19ef, 0x19f0, 0x19f1, 0x19f2, 0x19f3,
+ 0x19f4, 0x19f5, 0x19f6, 0x19f7, 0x1b0e, 0x1b0f, 0x1b62, 0x1b63,
+ 0x1b64, 0x1b65, 0x1b66, 0x1b67, 0x1b68, 0x1b69, 0x1b6a, 0x1b6b,
+ 0x1b6c, 0x1b6d, 0x1b6e, 0x1b6f, 0x1b82, 0x1ba8, 0x1ba9, 0x1baa,
+ 0x1bab, 0x1bac, 0x1bad, 0x1bae, 0x1baf, 0x1bb0, 0x1bb1, 0x1bb2,
+ 0x1bb3, 0x1d80, 0x1d81, 0x1d82, 0x1d83, 0x1d84, 0x1d85, 0x1d86,
+ 0x1d87, 0x1d88, 0x1d89, 0x1d8a, 0x1d8b, 0x1d8c, 0x1d8d, 0x1007,
+ 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x100e, 0x100f,
+ 0x1016, 0x1080, 0x1081, 0x1082, 0x1083, 0x1084, 0x1085, 0x1086,
+ 0x1087, 0x10c0, 0x123a, 0x123b, 0x123c, 0x123d, 0x123e, 0x123f,
+ 0x1240, 0x1241, 0x1242, 0x1243, 0x1350, 0x1352, 0x1353, 0x1358,
+ 0x1359, 0x135a, 0x135b, 0x135c, 0x135d, 0x135e, 0x135f, 0x1360,
+ 0x1361, 0x1602, 0x1603, 0x160c, 0x160d, 0x160e, 0x160f, 0x1620,
+ 0x1621, 0x1622, 0x1623, 0x1624, 0x1625, 0x1626, 0x1627, 0x1628,
+ 0x1629, 0x166e, 0x166f, 0x167c, 0x167d, 0x167e, 0x167f, 0x1770,
+ 0x1771, 0x1852, 0x1853, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876,
+ 0x1877, 0x1878, 0x1879, 0x187a, 0x187b, 0x187c, 0x187d, 0x187e,
+ 0x187f, 0x1918, 0x1919, 0x1926, 0x1927, 0x1970, 0x1971, 0x1972,
+ 0x1973, 0x1974, 0x1975, 0x1976, 0x1977, 0x1978, 0x1979, 0x197a,
+ 0x197b, 0x1aa0, 0x1aa1, 0x1aa2, 0x1aa3, 0x1aa4, 0x1aa5, 0x1aa6,
+ 0x1aa7, 0x1aa8, 0x1aa9, 0x1aaa, 0x1aab, 0x1aac, 0x1aad, 0x1b3c,
+ 0x1b3d, 0x1b3e, 0x1b3f, 0x1b50, 0x1b51, 0x1b52, 0x1b53, 0x1b54,
+ 0x1b55, 0x1b56, 0x1b57, 0x1b58, 0x1b59, 0x2032, 0x2033, 0x2034,
+ 0x2035, 0x2036, 0x2037, 0x2038, 0x2039, 0x203a, 0x203b, 0x203c,
+ 0x203d, 0x203e, 0x203f, 0x2040, 0x2041, 0x2042, 0x2043, 0x20ba,
+ 0x20bb, 0x20cc, 0x20cd, 0x20ce, 0x20cf, 0x20e0, 0x20e1, 0x20e2,
+ 0x20e3, 0x20e4, 0x20e5, 0x20e6, 0x20e7, 0x21aa, 0x21ab, 0x21c0,
+ 0x21c1, 0x21c2, 0x21c3, 0x21c4, 0x21c5, 0x21c6, 0x21c7, 0x21c8,
+ 0x21c9, 0x21ca, 0x21cb, 0x21cc, 0x21cd, 0x21ce, 0x21cf, 0x21d0,
+ 0x21d1, 0x21d2, 0x21d3, 0x2894, 0x2895, 0x2896, 0x2897, 0x2898,
+ 0x2899, 0x289a, 0x289b, 0x289c, 0x289d, 0x289e, 0x289f, 0x28c0,
+ 0x28c1, 0x28c2, 0x28c3, 0x28c4, 0x28c5, 0x28c6, 0x28c7, 0x28c8,
+ 0x28c9, 0x28ca, 0x28cb, 0x2930, 0x2931, 0x2932, 0x2933, 0x2934,
+ 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c,
+ 0x293d, 0x293e, 0x293f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964,
+ 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x2a40,
+ 0x2a41, 0x2a42, 0x2a43, 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48,
+ 0x2a49, 0x2a4a, 0x2a4b, 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50,
+ 0x2a51, 0x2a52, 0x2a53, 0x2ae6, 0x2ae7, 0x2b24, 0x2b25, 0x2b26,
+ 0x2b27, 0x2b28, 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e,
+ 0x2b2f, 0x2b30, 0x2b31, 0x2b32, 0x2b33, 0x2b5a, 0x2b5b, 0x3014,
+ 0x3015, 0x3016, 0x3017, 0x3020, 0x3021, 0x3022, 0x3023, 0x3024,
+ 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c,
+ 0x302d, 0x302e, 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034,
+ 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x30c0, 0x30c1, 0x30de,
+ 0x30df, 0x3218, 0x3219, 0x321a, 0x321b, 0x321c, 0x321d, 0x321e,
+ 0x321f, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226,
+ 0x3227, 0x3228, 0x3229, 0x322a, 0x322b, 0x322c, 0x322d, 0x322e,
+ 0x322f, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3378,
+ 0x3379, 0x337a, 0x337b, 0x337c, 0x337d, 0x337e, 0x337f, 0x33c0,
+ 0x33c1, 0x33c2, 0x33c3, 0x33c4, 0x33c5, 0x33c6, 0x33c7, 0x33c8,
+ 0x33c9, 0x33ca, 0x33cb, 0x33cc, 0x33cd, 0x33ce, 0x33cf, 0x33d0,
+ 0x33d1, 0x33d2, 0x33d3, 0x33d4, 0x33d5, 0x33d6, 0x33d7, 0x33d8,
+ 0x33d9, 0x3706, 0x3707, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734,
+ 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c,
+ 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744,
+ 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c,
+ 0x374d, 0x374e, 0x374f, 0x3b34, 0x3b35, 0x3b36, 0x3b37, 0x3be8,
+ 0x3be9, 0x3bea, 0x3beb, 0x3bec, 0x3bed, 0x3bee, 0x3bef, 0x3bf0,
+ 0x3bf1, 0x3bf2, 0x3bf3, 0x3bf4, 0x3bf5, 0x3bf6, 0x3bf7, 0x3bf8,
+ 0x3bf9, 0x3bfa, 0x3bfb, 0x3bfc, 0x3bfd, 0x3bfe, 0x3bff, 0x2000,
+ 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
+ 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x202e, 0x202f, 0x2182,
+ 0x2183, 0x21b4, 0x21b5, 0x21b6, 0x21b7, 0x21b8, 0x21b9, 0x21ba,
+ 0x21bb, 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x2460, 0x2461, 0x2462,
+ 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a,
+ 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472,
+ 0x2473, 0x26a2, 0x26a3, 0x000b,
};
-static const uint8_t table1_mv_bits[1100] =
-{
- 2, 4, 4, 4, 5, 5, 5, 5,
- 6, 6, 7, 7, 7, 7, 7, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 4,
+static const uint8_t table1_mv_bits[1100] = {
+ 2, 4, 4, 4, 5, 5, 5, 5,
+ 6, 6, 7, 7, 7, 7, 7, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 4,
};
-static const uint8_t table1_mvx[1099] =
-{
- 32, 31, 32, 31, 33, 32, 33, 33,
- 31, 34, 30, 32, 32, 34, 35, 32,
- 34, 33, 29, 30, 30, 32, 31, 31,
- 33, 35, 35, 33, 31, 29, 29, 33,
- 34, 30, 31, 28, 36, 30, 34, 32,
- 32, 37, 32, 32, 25, 27, 39, 32,
- 32, 32, 38, 35, 36, 32, 37, 61,
- 26, 32, 34, 35, 3, 35, 27, 28,
- 29, 34, 28, 37, 31, 36, 32, 27,
- 31, 30, 29, 39, 33, 29, 33, 35,
- 25, 25, 29, 33, 31, 31, 31, 33,
- 32, 30, 32, 32, 41, 39, 33, 36,
- 32, 28, 34, 36, 38, 24, 60, 31,
- 23, 28, 32, 33, 59, 32, 40, 30,
- 5, 34, 32, 38, 32, 30, 43, 4,
- 32, 32, 42, 31, 31, 32, 26, 38,
- 26, 22, 21, 37, 61, 63, 37, 31,
- 32, 33, 2, 1, 23, 33, 41, 27,
- 35, 30, 38, 23, 33, 3, 28, 34,
- 34, 27, 41, 29, 39, 35, 36, 29,
- 32, 27, 30, 32, 24, 61, 37, 26,
- 59, 25, 35, 27, 36, 37, 30, 31,
- 34, 40, 3, 28, 34, 39, 32, 31,
- 32, 30, 24, 28, 35, 36, 26, 32,
- 31, 33, 29, 33, 39, 25, 30, 24,
- 35, 59, 29, 34, 25, 30, 21, 35,
- 43, 40, 32, 29, 5, 28, 31, 62,
- 33, 33, 25, 31, 21, 31, 43, 31,
- 34, 33, 20, 40, 39, 31, 31, 57,
- 38, 32, 42, 33, 32, 31, 32, 29,
- 30, 44, 5, 31, 22, 34, 36, 17,
- 38, 58, 38, 35, 32, 60, 35, 24,
- 32, 38, 16, 45, 42, 32, 31, 29,
- 4, 30, 17, 40, 46, 48, 63, 32,
- 42, 19, 41, 22, 28, 36, 45, 33,
- 33, 32, 29, 7, 41, 42, 18, 33,
- 33, 32, 22, 37, 1, 26, 22, 23,
- 49, 28, 26, 27, 32, 33, 27, 23,
- 28, 36, 15, 6, 34, 27, 31, 26,
- 23, 2, 33, 32, 34, 41, 28, 32,
- 41, 0, 36, 38, 34, 31, 47, 32,
- 17, 31, 39, 33, 37, 51, 30, 47,
- 32, 50, 32, 19, 63, 30, 25, 27,
- 33, 62, 24, 31, 27, 30, 37, 31,
- 45, 32, 39, 20, 46, 47, 35, 19,
- 34, 1, 49, 21, 21, 14, 51, 26,
- 23, 31, 36, 35, 58, 29, 29, 21,
- 20, 42, 13, 28, 12, 40, 31, 33,
- 39, 60, 32, 44, 33, 31, 28, 37,
- 29, 32, 30, 49, 43, 28, 39, 25,
- 32, 48, 2, 15, 20, 25, 31, 28,
- 21, 24, 25, 15, 31, 17, 37, 43,
- 18, 32, 33, 24, 33, 36, 13, 33,
- 31, 39, 11, 31, 33, 32, 39, 37,
- 32, 32, 29, 17, 44, 46, 36, 35,
- 26, 37, 58, 32, 34, 38, 8, 38,
- 38, 22, 29, 25, 16, 35, 32, 35,
- 33, 43, 18, 46, 38, 50, 33, 18,
- 53, 60, 13, 32, 36, 33, 51, 36,
- 43, 45, 27, 42, 29, 24, 30, 25,
- 31, 52, 31, 35, 38, 9, 22, 34,
- 4, 17, 28, 55, 42, 25, 17, 20,
- 47, 34, 33, 16, 40, 25, 16, 30,
- 53, 29, 10, 11, 14, 26, 33, 4,
- 35, 44, 26, 16, 31, 26, 34, 38,
- 29, 31, 30, 24, 22, 61, 32, 9,
- 45, 34, 31, 19, 9, 31, 46, 31,
- 35, 54, 29, 57, 30, 50, 3, 31,
- 63, 34, 47, 41, 51, 18, 31, 14,
- 37, 38, 31, 24, 32, 31, 50, 33,
- 31, 54, 27, 9, 33, 23, 19, 32,
- 29, 29, 33, 28, 47, 49, 30, 47,
- 33, 27, 25, 54, 44, 45, 50, 58,
- 51, 48, 33, 59, 33, 34, 57, 13,
- 26, 33, 13, 48, 30, 11, 7, 56,
- 34, 55, 26, 0, 26, 35, 1, 51,
- 33, 53, 31, 45, 12, 29, 29, 51,
- 31, 48, 2, 6, 34, 30, 28, 33,
- 60, 40, 27, 46, 31, 9, 35, 29,
- 31, 39, 55, 46, 19, 37, 62, 34,
- 30, 16, 19, 49, 41, 41, 39, 37,
- 14, 5, 13, 35, 55, 30, 40, 40,
- 42, 8, 20, 25, 45, 35, 33, 36,
- 54, 38, 27, 37, 62, 40, 15, 59,
- 49, 31, 29, 34, 34, 39, 24, 29,
- 25, 29, 21, 29, 10, 61, 33, 49,
- 35, 34, 3, 38, 39, 29, 7, 41,
- 1, 35, 4, 23, 15, 23, 11, 37,
- 28, 35, 30, 30, 24, 1, 43, 56,
- 8, 34, 42, 24, 45, 30, 20, 23,
- 8, 38, 22, 33, 17, 52, 34, 22,
- 53, 43, 44, 1, 27, 31, 41, 43,
- 41, 30, 31, 36, 30, 5, 55, 31,
- 33, 30, 40, 23, 15, 29, 34, 34,
- 59, 34, 30, 11, 13, 38, 5, 0,
- 30, 42, 5, 30, 29, 34, 10, 44,
- 30, 63, 35, 12, 3, 26, 15, 17,
- 25, 34, 43, 39, 34, 56, 29, 23,
- 30, 12, 30, 10, 35, 9, 24, 58,
- 10, 12, 54, 33, 37, 20, 41, 35,
- 29, 18, 61, 30, 40, 24, 39, 53,
- 62, 26, 29, 33, 34, 53, 49, 21,
- 27, 11, 63, 20, 26, 23, 7, 13,
- 6, 47, 29, 30, 9, 51, 22, 34,
- 21, 25, 33, 56, 57, 30, 38, 51,
- 51, 38, 63, 28, 40, 35, 33, 18,
- 33, 33, 24, 58, 58, 34, 49, 29,
- 43, 4, 1, 4, 42, 35, 35, 30,
- 17, 5, 56, 61, 25, 37, 36, 55,
- 28, 35, 29, 50, 48, 52, 2, 42,
- 34, 40, 46, 46, 43, 35, 29, 48,
- 20, 29, 31, 41, 7, 30, 35, 19,
- 14, 21, 8, 39, 39, 40, 46, 55,
- 34, 6, 30, 34, 37, 25, 37, 33,
- 22, 44, 52, 17, 35, 29, 36, 35,
- 40, 37, 28, 30, 50, 14, 28, 55,
- 6, 23, 19, 14, 30, 3, 30, 28,
- 28, 61, 61, 47, 45, 48, 40, 40,
- 34, 34, 25, 30, 29, 35, 4, 26,
- 53, 50, 26, 41, 27, 59, 27, 38,
- 39, 3, 50, 43, 47, 23, 33, 55,
- 35, 21, 23, 35, 61, 33, 46, 52,
- 35, 34, 24, 30, 43, 16, 37, 21,
- 2, 24, 45, 34, 30, 55, 55, 1,
- 29, 29, 26, 28, 25, 31, 36, 22,
- 17, 30, 52, 2, 44, 44, 57, 26,
- 62, 41, 39, 57, 26, 46, 49, 11,
- 16, 19, 5, 59, 38, 39, 58, 38,
- 25, 49, 50, 22, 28, 59, 9, 59,
- 7, 28, 55, 17, 4, 35, 50, 21,
- 29, 44, 47, 18, 24, 19, 25, 42,
- 35, 3, 51, 35, 16, 35, 30, 63,
- 57, 39, 39, 25, 35, 38, 9, 16,
- 36, 45, 31, 60, 14, 34, 42, 24,
- 0, 37, 18, 61, 57, 37, 28, 53,
- 20, 46, 14, 47, 38, 38, 38, 9,
- 34, 39, 43, 17, 39, 59, 5, 27,
- 0, 12, 27,
+static const uint8_t table1_mvx[1099] = {
+ 32, 31, 32, 31, 33, 32, 33, 33,
+ 31, 34, 30, 32, 32, 34, 35, 32,
+ 34, 33, 29, 30, 30, 32, 31, 31,
+ 33, 35, 35, 33, 31, 29, 29, 33,
+ 34, 30, 31, 28, 36, 30, 34, 32,
+ 32, 37, 32, 32, 25, 27, 39, 32,
+ 32, 32, 38, 35, 36, 32, 37, 61,
+ 26, 32, 34, 35, 3, 35, 27, 28,
+ 29, 34, 28, 37, 31, 36, 32, 27,
+ 31, 30, 29, 39, 33, 29, 33, 35,
+ 25, 25, 29, 33, 31, 31, 31, 33,
+ 32, 30, 32, 32, 41, 39, 33, 36,
+ 32, 28, 34, 36, 38, 24, 60, 31,
+ 23, 28, 32, 33, 59, 32, 40, 30,
+ 5, 34, 32, 38, 32, 30, 43, 4,
+ 32, 32, 42, 31, 31, 32, 26, 38,
+ 26, 22, 21, 37, 61, 63, 37, 31,
+ 32, 33, 2, 1, 23, 33, 41, 27,
+ 35, 30, 38, 23, 33, 3, 28, 34,
+ 34, 27, 41, 29, 39, 35, 36, 29,
+ 32, 27, 30, 32, 24, 61, 37, 26,
+ 59, 25, 35, 27, 36, 37, 30, 31,
+ 34, 40, 3, 28, 34, 39, 32, 31,
+ 32, 30, 24, 28, 35, 36, 26, 32,
+ 31, 33, 29, 33, 39, 25, 30, 24,
+ 35, 59, 29, 34, 25, 30, 21, 35,
+ 43, 40, 32, 29, 5, 28, 31, 62,
+ 33, 33, 25, 31, 21, 31, 43, 31,
+ 34, 33, 20, 40, 39, 31, 31, 57,
+ 38, 32, 42, 33, 32, 31, 32, 29,
+ 30, 44, 5, 31, 22, 34, 36, 17,
+ 38, 58, 38, 35, 32, 60, 35, 24,
+ 32, 38, 16, 45, 42, 32, 31, 29,
+ 4, 30, 17, 40, 46, 48, 63, 32,
+ 42, 19, 41, 22, 28, 36, 45, 33,
+ 33, 32, 29, 7, 41, 42, 18, 33,
+ 33, 32, 22, 37, 1, 26, 22, 23,
+ 49, 28, 26, 27, 32, 33, 27, 23,
+ 28, 36, 15, 6, 34, 27, 31, 26,
+ 23, 2, 33, 32, 34, 41, 28, 32,
+ 41, 0, 36, 38, 34, 31, 47, 32,
+ 17, 31, 39, 33, 37, 51, 30, 47,
+ 32, 50, 32, 19, 63, 30, 25, 27,
+ 33, 62, 24, 31, 27, 30, 37, 31,
+ 45, 32, 39, 20, 46, 47, 35, 19,
+ 34, 1, 49, 21, 21, 14, 51, 26,
+ 23, 31, 36, 35, 58, 29, 29, 21,
+ 20, 42, 13, 28, 12, 40, 31, 33,
+ 39, 60, 32, 44, 33, 31, 28, 37,
+ 29, 32, 30, 49, 43, 28, 39, 25,
+ 32, 48, 2, 15, 20, 25, 31, 28,
+ 21, 24, 25, 15, 31, 17, 37, 43,
+ 18, 32, 33, 24, 33, 36, 13, 33,
+ 31, 39, 11, 31, 33, 32, 39, 37,
+ 32, 32, 29, 17, 44, 46, 36, 35,
+ 26, 37, 58, 32, 34, 38, 8, 38,
+ 38, 22, 29, 25, 16, 35, 32, 35,
+ 33, 43, 18, 46, 38, 50, 33, 18,
+ 53, 60, 13, 32, 36, 33, 51, 36,
+ 43, 45, 27, 42, 29, 24, 30, 25,
+ 31, 52, 31, 35, 38, 9, 22, 34,
+ 4, 17, 28, 55, 42, 25, 17, 20,
+ 47, 34, 33, 16, 40, 25, 16, 30,
+ 53, 29, 10, 11, 14, 26, 33, 4,
+ 35, 44, 26, 16, 31, 26, 34, 38,
+ 29, 31, 30, 24, 22, 61, 32, 9,
+ 45, 34, 31, 19, 9, 31, 46, 31,
+ 35, 54, 29, 57, 30, 50, 3, 31,
+ 63, 34, 47, 41, 51, 18, 31, 14,
+ 37, 38, 31, 24, 32, 31, 50, 33,
+ 31, 54, 27, 9, 33, 23, 19, 32,
+ 29, 29, 33, 28, 47, 49, 30, 47,
+ 33, 27, 25, 54, 44, 45, 50, 58,
+ 51, 48, 33, 59, 33, 34, 57, 13,
+ 26, 33, 13, 48, 30, 11, 7, 56,
+ 34, 55, 26, 0, 26, 35, 1, 51,
+ 33, 53, 31, 45, 12, 29, 29, 51,
+ 31, 48, 2, 6, 34, 30, 28, 33,
+ 60, 40, 27, 46, 31, 9, 35, 29,
+ 31, 39, 55, 46, 19, 37, 62, 34,
+ 30, 16, 19, 49, 41, 41, 39, 37,
+ 14, 5, 13, 35, 55, 30, 40, 40,
+ 42, 8, 20, 25, 45, 35, 33, 36,
+ 54, 38, 27, 37, 62, 40, 15, 59,
+ 49, 31, 29, 34, 34, 39, 24, 29,
+ 25, 29, 21, 29, 10, 61, 33, 49,
+ 35, 34, 3, 38, 39, 29, 7, 41,
+ 1, 35, 4, 23, 15, 23, 11, 37,
+ 28, 35, 30, 30, 24, 1, 43, 56,
+ 8, 34, 42, 24, 45, 30, 20, 23,
+ 8, 38, 22, 33, 17, 52, 34, 22,
+ 53, 43, 44, 1, 27, 31, 41, 43,
+ 41, 30, 31, 36, 30, 5, 55, 31,
+ 33, 30, 40, 23, 15, 29, 34, 34,
+ 59, 34, 30, 11, 13, 38, 5, 0,
+ 30, 42, 5, 30, 29, 34, 10, 44,
+ 30, 63, 35, 12, 3, 26, 15, 17,
+ 25, 34, 43, 39, 34, 56, 29, 23,
+ 30, 12, 30, 10, 35, 9, 24, 58,
+ 10, 12, 54, 33, 37, 20, 41, 35,
+ 29, 18, 61, 30, 40, 24, 39, 53,
+ 62, 26, 29, 33, 34, 53, 49, 21,
+ 27, 11, 63, 20, 26, 23, 7, 13,
+ 6, 47, 29, 30, 9, 51, 22, 34,
+ 21, 25, 33, 56, 57, 30, 38, 51,
+ 51, 38, 63, 28, 40, 35, 33, 18,
+ 33, 33, 24, 58, 58, 34, 49, 29,
+ 43, 4, 1, 4, 42, 35, 35, 30,
+ 17, 5, 56, 61, 25, 37, 36, 55,
+ 28, 35, 29, 50, 48, 52, 2, 42,
+ 34, 40, 46, 46, 43, 35, 29, 48,
+ 20, 29, 31, 41, 7, 30, 35, 19,
+ 14, 21, 8, 39, 39, 40, 46, 55,
+ 34, 6, 30, 34, 37, 25, 37, 33,
+ 22, 44, 52, 17, 35, 29, 36, 35,
+ 40, 37, 28, 30, 50, 14, 28, 55,
+ 6, 23, 19, 14, 30, 3, 30, 28,
+ 28, 61, 61, 47, 45, 48, 40, 40,
+ 34, 34, 25, 30, 29, 35, 4, 26,
+ 53, 50, 26, 41, 27, 59, 27, 38,
+ 39, 3, 50, 43, 47, 23, 33, 55,
+ 35, 21, 23, 35, 61, 33, 46, 52,
+ 35, 34, 24, 30, 43, 16, 37, 21,
+ 2, 24, 45, 34, 30, 55, 55, 1,
+ 29, 29, 26, 28, 25, 31, 36, 22,
+ 17, 30, 52, 2, 44, 44, 57, 26,
+ 62, 41, 39, 57, 26, 46, 49, 11,
+ 16, 19, 5, 59, 38, 39, 58, 38,
+ 25, 49, 50, 22, 28, 59, 9, 59,
+ 7, 28, 55, 17, 4, 35, 50, 21,
+ 29, 44, 47, 18, 24, 19, 25, 42,
+ 35, 3, 51, 35, 16, 35, 30, 63,
+ 57, 39, 39, 25, 35, 38, 9, 16,
+ 36, 45, 31, 60, 14, 34, 42, 24,
+ 0, 37, 18, 61, 57, 37, 28, 53,
+ 20, 46, 14, 47, 38, 38, 38, 9,
+ 34, 39, 43, 17, 39, 59, 5, 27,
+ 0, 12, 27,
};
-static const uint8_t table1_mvy[1099] =
-{
- 32, 32, 31, 31, 32, 33, 31, 33,
- 33, 32, 32, 30, 34, 31, 32, 29,
- 33, 30, 32, 33, 31, 35, 34, 30,
- 34, 31, 33, 29, 29, 31, 33, 35,
- 30, 30, 35, 32, 32, 34, 34, 28,
- 25, 32, 36, 27, 32, 32, 32, 37,
- 39, 3, 32, 30, 31, 26, 31, 32,
- 32, 38, 29, 29, 32, 34, 31, 31,
- 34, 35, 33, 33, 28, 33, 1, 33,
- 27, 29, 30, 31, 28, 29, 37, 35,
- 31, 33, 35, 27, 36, 37, 25, 25,
- 61, 35, 4, 5, 32, 33, 36, 30,
- 23, 30, 28, 34, 31, 32, 32, 39,
- 32, 34, 21, 39, 32, 59, 32, 28,
- 32, 36, 60, 33, 24, 36, 32, 32,
- 41, 2, 32, 38, 26, 22, 33, 30,
- 31, 32, 32, 30, 31, 32, 29, 3,
- 40, 38, 32, 32, 33, 26, 31, 34,
- 28, 38, 34, 31, 3, 31, 35, 38,
- 27, 35, 33, 28, 29, 27, 29, 27,
- 43, 29, 37, 63, 31, 33, 34, 30,
- 31, 30, 37, 30, 35, 35, 26, 41,
- 37, 31, 33, 28, 26, 30, 42, 24,
- 7, 27, 33, 29, 36, 28, 34, 57,
- 23, 41, 36, 23, 35, 34, 25, 30,
- 25, 33, 25, 25, 29, 24, 33, 39,
- 33, 33, 0, 37, 31, 36, 21, 32,
- 61, 24, 35, 61, 31, 5, 31, 59,
- 39, 21, 32, 30, 34, 22, 40, 32,
- 29, 16, 31, 5, 62, 2, 20, 39,
- 39, 32, 33, 1, 31, 24, 36, 32,
- 36, 32, 28, 26, 6, 31, 38, 34,
- 58, 35, 32, 33, 33, 17, 43, 26,
- 31, 40, 31, 34, 32, 32, 31, 19,
- 30, 32, 29, 33, 38, 38, 32, 59,
- 40, 18, 38, 32, 35, 34, 32, 17,
- 1, 15, 30, 28, 31, 28, 34, 29,
- 32, 27, 35, 27, 49, 22, 37, 34,
- 37, 26, 32, 32, 22, 28, 45, 29,
- 30, 31, 43, 46, 41, 30, 26, 13,
- 34, 32, 27, 38, 42, 42, 33, 47,
- 33, 60, 27, 42, 25, 32, 22, 32,
- 48, 32, 45, 33, 33, 41, 27, 25,
- 19, 31, 35, 19, 36, 42, 27, 17,
- 31, 44, 28, 33, 33, 31, 23, 31,
- 40, 33, 31, 34, 30, 32, 33, 36,
- 35, 47, 37, 41, 31, 23, 41, 29,
- 30, 35, 32, 25, 32, 28, 58, 2,
- 37, 33, 14, 33, 49, 20, 39, 36,
- 21, 9, 23, 33, 35, 24, 39, 37,
- 11, 33, 30, 31, 31, 28, 51, 40,
- 35, 29, 25, 33, 46, 35, 37, 30,
- 30, 8, 63, 28, 15, 40, 33, 45,
- 49, 25, 32, 4, 47, 51, 36, 39,
- 53, 10, 24, 29, 30, 31, 25, 40,
- 38, 38, 33, 56, 23, 27, 32, 37,
- 26, 29, 43, 36, 33, 24, 55, 43,
- 9, 29, 34, 34, 24, 33, 18, 33,
- 33, 30, 31, 50, 24, 60, 30, 39,
- 34, 30, 39, 28, 22, 38, 2, 26,
- 63, 32, 57, 21, 39, 33, 28, 18,
- 30, 34, 22, 33, 29, 41, 30, 34,
- 35, 21, 13, 34, 35, 39, 30, 46,
- 32, 42, 32, 31, 33, 26, 11, 33,
- 22, 31, 25, 31, 53, 27, 43, 25,
- 40, 50, 21, 36, 38, 30, 12, 31,
- 34, 20, 15, 29, 32, 62, 30, 13,
- 17, 32, 19, 31, 20, 31, 30, 7,
- 1, 17, 34, 37, 31, 31, 44, 34,
- 26, 40, 16, 37, 52, 48, 30, 20,
- 18, 33, 38, 29, 7, 25, 30, 54,
- 45, 47, 46, 41, 29, 29, 16, 30,
- 14, 26, 38, 34, 34, 29, 34, 30,
- 29, 30, 57, 30, 4, 46, 33, 29,
- 39, 44, 30, 31, 50, 33, 31, 32,
- 19, 32, 40, 31, 37, 47, 1, 35,
- 16, 31, 0, 35, 33, 1, 17, 34,
- 9, 34, 33, 31, 49, 43, 42, 51,
- 34, 29, 23, 29, 14, 30, 45, 49,
- 11, 24, 31, 28, 35, 41, 30, 44,
- 18, 29, 34, 35, 36, 25, 26, 21,
- 31, 30, 34, 19, 34, 44, 36, 38,
- 25, 31, 28, 23, 37, 3, 55, 41,
- 30, 22, 41, 24, 33, 26, 35, 35,
- 30, 55, 51, 47, 48, 38, 24, 15,
- 21, 50, 25, 46, 30, 29, 10, 34,
- 42, 45, 29, 42, 22, 3, 33, 27,
- 34, 1, 34, 28, 34, 36, 35, 23,
- 23, 13, 58, 3, 26, 63, 25, 31,
- 34, 61, 38, 39, 25, 61, 29, 37,
- 30, 41, 26, 48, 28, 33, 50, 35,
- 30, 37, 29, 29, 40, 6, 39, 28,
- 28, 19, 8, 22, 45, 34, 35, 10,
- 58, 17, 37, 39, 30, 18, 54, 14,
- 29, 16, 59, 30, 35, 23, 35, 30,
- 47, 36, 29, 55, 20, 12, 31, 35,
- 14, 29, 18, 34, 34, 24, 29, 26,
- 22, 2, 27, 23, 8, 30, 55, 38,
- 60, 31, 4, 34, 49, 34, 27, 34,
- 33, 30, 31, 54, 42, 35, 38, 46,
- 44, 26, 27, 9, 39, 25, 21, 29,
- 28, 42, 13, 0, 5, 34, 37, 28,
- 24, 29, 63, 26, 22, 27, 29, 25,
- 33, 25, 61, 0, 35, 25, 36, 15,
- 27, 40, 53, 33, 3, 10, 16, 37,
- 38, 18, 30, 46, 27, 9, 6, 29,
- 62, 8, 42, 28, 29, 3, 25, 16,
- 26, 29, 35, 28, 27, 51, 61, 48,
- 37, 9, 34, 7, 49, 45, 20, 29,
- 21, 5, 5, 29, 28, 34, 29, 24,
- 10, 24, 35, 36, 38, 55, 11, 36,
- 38, 53, 54, 26, 30, 49, 20, 27,
- 30, 39, 33, 41, 49, 22, 38, 38,
- 4, 30, 8, 9, 3, 24, 22, 50,
- 37, 36, 31, 27, 2, 9, 42, 63,
- 25, 19, 44, 1, 28, 28, 48, 30,
- 34, 41, 41, 38, 12, 27, 15, 0,
- 16, 34, 35, 38, 28, 29, 40, 42,
- 51, 52, 45, 54, 59, 59, 42, 44,
- 37, 26, 46, 24, 15, 39, 22, 46,
- 19, 35, 38, 17, 37, 23, 52, 55,
- 50, 37, 26, 11, 37, 12, 24, 30,
- 16, 13, 22, 13, 36, 35, 40, 41,
- 34, 41, 26, 53, 51, 5, 21, 30,
- 2, 63, 41, 20, 1, 56, 21, 24,
- 25, 5, 28, 35, 26, 28, 30, 18,
- 29, 23, 40, 34, 20, 42, 39, 34,
- 28, 61, 38, 27, 62, 9, 36, 17,
- 9, 49, 24, 25, 54, 34, 39, 37,
- 3, 1, 25, 38, 38, 44, 35, 36,
- 12, 60, 36, 38, 40, 25, 43, 39,
- 53, 28, 39, 57, 46, 10, 52, 27,
- 35, 42, 45, 59, 15, 60, 38, 24,
- 23, 39, 12, 29, 24, 0, 20, 16,
- 28, 43, 35, 28, 1, 49, 4, 21,
- 42, 39, 29, 3, 44, 21, 53, 55,
- 11, 5, 3, 39, 53, 28, 25, 19,
- 34, 28, 21,
+static const uint8_t table1_mvy[1099] = {
+ 32, 32, 31, 31, 32, 33, 31, 33,
+ 33, 32, 32, 30, 34, 31, 32, 29,
+ 33, 30, 32, 33, 31, 35, 34, 30,
+ 34, 31, 33, 29, 29, 31, 33, 35,
+ 30, 30, 35, 32, 32, 34, 34, 28,
+ 25, 32, 36, 27, 32, 32, 32, 37,
+ 39, 3, 32, 30, 31, 26, 31, 32,
+ 32, 38, 29, 29, 32, 34, 31, 31,
+ 34, 35, 33, 33, 28, 33, 1, 33,
+ 27, 29, 30, 31, 28, 29, 37, 35,
+ 31, 33, 35, 27, 36, 37, 25, 25,
+ 61, 35, 4, 5, 32, 33, 36, 30,
+ 23, 30, 28, 34, 31, 32, 32, 39,
+ 32, 34, 21, 39, 32, 59, 32, 28,
+ 32, 36, 60, 33, 24, 36, 32, 32,
+ 41, 2, 32, 38, 26, 22, 33, 30,
+ 31, 32, 32, 30, 31, 32, 29, 3,
+ 40, 38, 32, 32, 33, 26, 31, 34,
+ 28, 38, 34, 31, 3, 31, 35, 38,
+ 27, 35, 33, 28, 29, 27, 29, 27,
+ 43, 29, 37, 63, 31, 33, 34, 30,
+ 31, 30, 37, 30, 35, 35, 26, 41,
+ 37, 31, 33, 28, 26, 30, 42, 24,
+ 7, 27, 33, 29, 36, 28, 34, 57,
+ 23, 41, 36, 23, 35, 34, 25, 30,
+ 25, 33, 25, 25, 29, 24, 33, 39,
+ 33, 33, 0, 37, 31, 36, 21, 32,
+ 61, 24, 35, 61, 31, 5, 31, 59,
+ 39, 21, 32, 30, 34, 22, 40, 32,
+ 29, 16, 31, 5, 62, 2, 20, 39,
+ 39, 32, 33, 1, 31, 24, 36, 32,
+ 36, 32, 28, 26, 6, 31, 38, 34,
+ 58, 35, 32, 33, 33, 17, 43, 26,
+ 31, 40, 31, 34, 32, 32, 31, 19,
+ 30, 32, 29, 33, 38, 38, 32, 59,
+ 40, 18, 38, 32, 35, 34, 32, 17,
+ 1, 15, 30, 28, 31, 28, 34, 29,
+ 32, 27, 35, 27, 49, 22, 37, 34,
+ 37, 26, 32, 32, 22, 28, 45, 29,
+ 30, 31, 43, 46, 41, 30, 26, 13,
+ 34, 32, 27, 38, 42, 42, 33, 47,
+ 33, 60, 27, 42, 25, 32, 22, 32,
+ 48, 32, 45, 33, 33, 41, 27, 25,
+ 19, 31, 35, 19, 36, 42, 27, 17,
+ 31, 44, 28, 33, 33, 31, 23, 31,
+ 40, 33, 31, 34, 30, 32, 33, 36,
+ 35, 47, 37, 41, 31, 23, 41, 29,
+ 30, 35, 32, 25, 32, 28, 58, 2,
+ 37, 33, 14, 33, 49, 20, 39, 36,
+ 21, 9, 23, 33, 35, 24, 39, 37,
+ 11, 33, 30, 31, 31, 28, 51, 40,
+ 35, 29, 25, 33, 46, 35, 37, 30,
+ 30, 8, 63, 28, 15, 40, 33, 45,
+ 49, 25, 32, 4, 47, 51, 36, 39,
+ 53, 10, 24, 29, 30, 31, 25, 40,
+ 38, 38, 33, 56, 23, 27, 32, 37,
+ 26, 29, 43, 36, 33, 24, 55, 43,
+ 9, 29, 34, 34, 24, 33, 18, 33,
+ 33, 30, 31, 50, 24, 60, 30, 39,
+ 34, 30, 39, 28, 22, 38, 2, 26,
+ 63, 32, 57, 21, 39, 33, 28, 18,
+ 30, 34, 22, 33, 29, 41, 30, 34,
+ 35, 21, 13, 34, 35, 39, 30, 46,
+ 32, 42, 32, 31, 33, 26, 11, 33,
+ 22, 31, 25, 31, 53, 27, 43, 25,
+ 40, 50, 21, 36, 38, 30, 12, 31,
+ 34, 20, 15, 29, 32, 62, 30, 13,
+ 17, 32, 19, 31, 20, 31, 30, 7,
+ 1, 17, 34, 37, 31, 31, 44, 34,
+ 26, 40, 16, 37, 52, 48, 30, 20,
+ 18, 33, 38, 29, 7, 25, 30, 54,
+ 45, 47, 46, 41, 29, 29, 16, 30,
+ 14, 26, 38, 34, 34, 29, 34, 30,
+ 29, 30, 57, 30, 4, 46, 33, 29,
+ 39, 44, 30, 31, 50, 33, 31, 32,
+ 19, 32, 40, 31, 37, 47, 1, 35,
+ 16, 31, 0, 35, 33, 1, 17, 34,
+ 9, 34, 33, 31, 49, 43, 42, 51,
+ 34, 29, 23, 29, 14, 30, 45, 49,
+ 11, 24, 31, 28, 35, 41, 30, 44,
+ 18, 29, 34, 35, 36, 25, 26, 21,
+ 31, 30, 34, 19, 34, 44, 36, 38,
+ 25, 31, 28, 23, 37, 3, 55, 41,
+ 30, 22, 41, 24, 33, 26, 35, 35,
+ 30, 55, 51, 47, 48, 38, 24, 15,
+ 21, 50, 25, 46, 30, 29, 10, 34,
+ 42, 45, 29, 42, 22, 3, 33, 27,
+ 34, 1, 34, 28, 34, 36, 35, 23,
+ 23, 13, 58, 3, 26, 63, 25, 31,
+ 34, 61, 38, 39, 25, 61, 29, 37,
+ 30, 41, 26, 48, 28, 33, 50, 35,
+ 30, 37, 29, 29, 40, 6, 39, 28,
+ 28, 19, 8, 22, 45, 34, 35, 10,
+ 58, 17, 37, 39, 30, 18, 54, 14,
+ 29, 16, 59, 30, 35, 23, 35, 30,
+ 47, 36, 29, 55, 20, 12, 31, 35,
+ 14, 29, 18, 34, 34, 24, 29, 26,
+ 22, 2, 27, 23, 8, 30, 55, 38,
+ 60, 31, 4, 34, 49, 34, 27, 34,
+ 33, 30, 31, 54, 42, 35, 38, 46,
+ 44, 26, 27, 9, 39, 25, 21, 29,
+ 28, 42, 13, 0, 5, 34, 37, 28,
+ 24, 29, 63, 26, 22, 27, 29, 25,
+ 33, 25, 61, 0, 35, 25, 36, 15,
+ 27, 40, 53, 33, 3, 10, 16, 37,
+ 38, 18, 30, 46, 27, 9, 6, 29,
+ 62, 8, 42, 28, 29, 3, 25, 16,
+ 26, 29, 35, 28, 27, 51, 61, 48,
+ 37, 9, 34, 7, 49, 45, 20, 29,
+ 21, 5, 5, 29, 28, 34, 29, 24,
+ 10, 24, 35, 36, 38, 55, 11, 36,
+ 38, 53, 54, 26, 30, 49, 20, 27,
+ 30, 39, 33, 41, 49, 22, 38, 38,
+ 4, 30, 8, 9, 3, 24, 22, 50,
+ 37, 36, 31, 27, 2, 9, 42, 63,
+ 25, 19, 44, 1, 28, 28, 48, 30,
+ 34, 41, 41, 38, 12, 27, 15, 0,
+ 16, 34, 35, 38, 28, 29, 40, 42,
+ 51, 52, 45, 54, 59, 59, 42, 44,
+ 37, 26, 46, 24, 15, 39, 22, 46,
+ 19, 35, 38, 17, 37, 23, 52, 55,
+ 50, 37, 26, 11, 37, 12, 24, 30,
+ 16, 13, 22, 13, 36, 35, 40, 41,
+ 34, 41, 26, 53, 51, 5, 21, 30,
+ 2, 63, 41, 20, 1, 56, 21, 24,
+ 25, 5, 28, 35, 26, 28, 30, 18,
+ 29, 23, 40, 34, 20, 42, 39, 34,
+ 28, 61, 38, 27, 62, 9, 36, 17,
+ 9, 49, 24, 25, 54, 34, 39, 37,
+ 3, 1, 25, 38, 38, 44, 35, 36,
+ 12, 60, 36, 38, 40, 25, 43, 39,
+ 53, 28, 39, 57, 46, 10, 52, 27,
+ 35, 42, 45, 59, 15, 60, 38, 24,
+ 23, 39, 12, 29, 24, 0, 20, 16,
+ 28, 43, 35, 28, 1, 49, 4, 21,
+ 42, 39, 29, 3, 44, 21, 53, 55,
+ 11, 5, 3, 39, 53, 28, 25, 19,
+ 34, 28, 21,
};
-MVTable mv_tables[2] =
-{
+MVTable mv_tables[2] = {
{
1099,
table0_mv_code,
@@ -1829,214 +1801,201 @@ MVTable mv_tables[2] =
}
};
-const uint8_t 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_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] =
-{
- {1, 1}, {0, 3}, {1, 3}, {1, 2},
+const uint8_t 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 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
+ 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 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
+ 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 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
+ 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] =
-{
- {
- 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
- 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
- 0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05,
- 0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A,
- 0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F,
- 0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34,
- 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35,
- 0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F,
- },
- {
- 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
- 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
- 0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D,
- 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A,
- 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D,
- 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25,
- 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35,
- 0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F,
- },
- {
- 0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18,
- 0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20,
- 0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07,
- 0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39,
- 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D,
- 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E,
- 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35,
- 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F,
- },
- {
- 0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09,
- 0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29,
- 0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13,
- 0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C,
- 0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24,
- 0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E,
- 0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35,
- 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F,
- }
+const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
+ {
+ 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
+ 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
+ 0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05,
+ 0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A,
+ 0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F,
+ 0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34,
+ 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35,
+ 0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F,
+ },
+ {
+ 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
+ 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
+ 0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D,
+ 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A,
+ 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D,
+ 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25,
+ 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35,
+ 0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F,
+ },
+ {
+ 0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18,
+ 0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20,
+ 0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07,
+ 0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39,
+ 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D,
+ 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E,
+ 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35,
+ 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F,
+ },
+ {
+ 0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09,
+ 0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29,
+ 0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13,
+ 0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C,
+ 0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24,
+ 0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E,
+ 0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35,
+ 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F,
+ }
};
-const uint8_t table_inter_intra[4][2] =
-{
- {0, 1} /*Luma-Left Chroma-Left*/,
- {2, 2} /*Luma-Top Chroma-Left*/,
- {6, 3} /*luma-Left Chroma-Top */,
- {7, 3} /*luma-Top Chroma-Top */
+const uint8_t table_inter_intra[4][2]={
+ {0,1} /*Luma-Left Chroma-Left*/,
+ {2,2} /*Luma-Top Chroma-Left*/,
+ {6,3} /*luma-Left Chroma-Top */,
+ {7,3} /*luma-Top Chroma-Top */
};
-static const uint32_t table_mb_non_intra2[128][2] =
-{
- {0x0000A7, 14}, {0x01B2B8, 18}, {0x01B28E, 18}, {0x036575, 19},
- {0x006CAC, 16}, {0x000A69, 18}, {0x002934, 20}, {0x00526B, 21},
- {0x006CA1, 16}, {0x01B2B9, 18}, {0x0029AD, 20}, {0x029353, 24},
- {0x006CA7, 16}, {0x006CAB, 16}, {0x01B2BB, 18}, {0x00029B, 16},
- {0x00D944, 17}, {0x000A6A, 18}, {0x0149A8, 23}, {0x03651F, 19},
- {0x006CAF, 16}, {0x000A4C, 18}, {0x03651E, 19}, {0x000A48, 18},
- {0x00299C, 20}, {0x00299F, 20}, {0x029352, 24}, {0x0029AC, 20},
- {0x000296, 16}, {0x00D946, 17}, {0x000A68, 18}, {0x000298, 16},
- {0x000527, 17}, {0x00D94D, 17}, {0x0014D7, 19}, {0x036574, 19},
- {0x000A5C, 18}, {0x01B299, 18}, {0x00299D, 20}, {0x00299E, 20},
- {0x000525, 17}, {0x000A66, 18}, {0x00A4D5, 22}, {0x00149B, 19},
- {0x000295, 16}, {0x006CAD, 16}, {0x000A49, 18}, {0x000521, 17},
- {0x006CAA, 16}, {0x00D945, 17}, {0x01B298, 18}, {0x00052F, 17},
- {0x003654, 15}, {0x006CA0, 16}, {0x000532, 17}, {0x000291, 16},
- {0x003652, 15}, {0x000520, 17}, {0x000A5D, 18}, {0x000294, 16},
- {0x00009B, 11}, {0x0006E2, 12}, {0x000028, 12}, {0x0001B0, 10},
- {0x000001, 3}, {0x000010, 8}, {0x00002F, 6}, {0x00004C, 10},
- {0x00000D, 4}, {0x000000, 10}, {0x000006, 9}, {0x000134, 12},
- {0x00000C, 4}, {0x000007, 10}, {0x000007, 9}, {0x0006E1, 12},
- {0x00000E, 5}, {0x0000DA, 9}, {0x000022, 9}, {0x000364, 11},
- {0x00000F, 4}, {0x000006, 10}, {0x00000F, 9}, {0x000135, 12},
- {0x000014, 5}, {0x0000DD, 9}, {0x000004, 9}, {0x000015, 11},
- {0x00001A, 6}, {0x0001B3, 10}, {0x000005, 10}, {0x0006E3, 12},
- {0x00000C, 5}, {0x0000B9, 8}, {0x000004, 8}, {0x0000DB, 9},
- {0x00000E, 4}, {0x00000B, 10}, {0x000023, 9}, {0x0006CB, 12},
- {0x000005, 6}, {0x0001B1, 10}, {0x000001, 10}, {0x0006E0, 12},
- {0x000011, 5}, {0x0000DF, 9}, {0x00000E, 9}, {0x000373, 11},
- {0x000003, 5}, {0x0000B8, 8}, {0x000006, 8}, {0x000175, 9},
- {0x000015, 5}, {0x000174, 9}, {0x000027, 9}, {0x000372, 11},
- {0x000010, 5}, {0x0000BB, 8}, {0x000005, 8}, {0x0000DE, 9},
- {0x00000F, 5}, {0x000001, 9}, {0x000012, 8}, {0x000004, 10},
- {0x000002, 3}, {0x000016, 5}, {0x000009, 4}, {0x000001, 5},
+static const uint32_t table_mb_non_intra2[128][2] = {
+{0x0000A7, 14}, {0x01B2B8, 18}, {0x01B28E, 18}, {0x036575, 19},
+{0x006CAC, 16}, {0x000A69, 18}, {0x002934, 20}, {0x00526B, 21},
+{0x006CA1, 16}, {0x01B2B9, 18}, {0x0029AD, 20}, {0x029353, 24},
+{0x006CA7, 16}, {0x006CAB, 16}, {0x01B2BB, 18}, {0x00029B, 16},
+{0x00D944, 17}, {0x000A6A, 18}, {0x0149A8, 23}, {0x03651F, 19},
+{0x006CAF, 16}, {0x000A4C, 18}, {0x03651E, 19}, {0x000A48, 18},
+{0x00299C, 20}, {0x00299F, 20}, {0x029352, 24}, {0x0029AC, 20},
+{0x000296, 16}, {0x00D946, 17}, {0x000A68, 18}, {0x000298, 16},
+{0x000527, 17}, {0x00D94D, 17}, {0x0014D7, 19}, {0x036574, 19},
+{0x000A5C, 18}, {0x01B299, 18}, {0x00299D, 20}, {0x00299E, 20},
+{0x000525, 17}, {0x000A66, 18}, {0x00A4D5, 22}, {0x00149B, 19},
+{0x000295, 16}, {0x006CAD, 16}, {0x000A49, 18}, {0x000521, 17},
+{0x006CAA, 16}, {0x00D945, 17}, {0x01B298, 18}, {0x00052F, 17},
+{0x003654, 15}, {0x006CA0, 16}, {0x000532, 17}, {0x000291, 16},
+{0x003652, 15}, {0x000520, 17}, {0x000A5D, 18}, {0x000294, 16},
+{0x00009B, 11}, {0x0006E2, 12}, {0x000028, 12}, {0x0001B0, 10},
+{0x000001, 3}, {0x000010, 8}, {0x00002F, 6}, {0x00004C, 10},
+{0x00000D, 4}, {0x000000, 10}, {0x000006, 9}, {0x000134, 12},
+{0x00000C, 4}, {0x000007, 10}, {0x000007, 9}, {0x0006E1, 12},
+{0x00000E, 5}, {0x0000DA, 9}, {0x000022, 9}, {0x000364, 11},
+{0x00000F, 4}, {0x000006, 10}, {0x00000F, 9}, {0x000135, 12},
+{0x000014, 5}, {0x0000DD, 9}, {0x000004, 9}, {0x000015, 11},
+{0x00001A, 6}, {0x0001B3, 10}, {0x000005, 10}, {0x0006E3, 12},
+{0x00000C, 5}, {0x0000B9, 8}, {0x000004, 8}, {0x0000DB, 9},
+{0x00000E, 4}, {0x00000B, 10}, {0x000023, 9}, {0x0006CB, 12},
+{0x000005, 6}, {0x0001B1, 10}, {0x000001, 10}, {0x0006E0, 12},
+{0x000011, 5}, {0x0000DF, 9}, {0x00000E, 9}, {0x000373, 11},
+{0x000003, 5}, {0x0000B8, 8}, {0x000006, 8}, {0x000175, 9},
+{0x000015, 5}, {0x000174, 9}, {0x000027, 9}, {0x000372, 11},
+{0x000010, 5}, {0x0000BB, 8}, {0x000005, 8}, {0x0000DE, 9},
+{0x00000F, 5}, {0x000001, 9}, {0x000012, 8}, {0x000004, 10},
+{0x000002, 3}, {0x000016, 5}, {0x000009, 4}, {0x000001, 5},
};
-static const uint32_t table_mb_non_intra3[128][2] =
-{
- {0x0002A1, 10}, {0x005740, 15}, {0x01A0BF, 18}, {0x015D19, 17},
- {0x001514, 13}, {0x00461E, 15}, {0x015176, 17}, {0x015177, 17},
- {0x0011AD, 13}, {0x00682E, 16}, {0x0682F9, 20}, {0x03417D, 19},
- {0x001A36, 14}, {0x002A2D, 14}, {0x00D05E, 17}, {0x006824, 16},
- {0x001515, 13}, {0x00545C, 15}, {0x0230E9, 18}, {0x011AFA, 17},
- {0x0015D7, 13}, {0x005747, 15}, {0x008D79, 16}, {0x006825, 16},
- {0x002BA2, 14}, {0x00A8BA, 16}, {0x0235F6, 18}, {0x015D18, 17},
- {0x0011AE, 13}, {0x00346F, 15}, {0x008C3B, 16}, {0x00346E, 15},
- {0x000D1A, 13}, {0x00461F, 15}, {0x0682F8, 20}, {0x011875, 17},
- {0x002BA1, 14}, {0x008D61, 16}, {0x0235F7, 18}, {0x0230E8, 18},
- {0x001513, 13}, {0x008D7B, 16}, {0x011AF4, 17}, {0x011AF5, 17},
- {0x001185, 13}, {0x0046BF, 15}, {0x008D60, 16}, {0x008D7C, 16},
- {0x001512, 13}, {0x00461C, 15}, {0x00AE8D, 16}, {0x008D78, 16},
- {0x000D0E, 13}, {0x003413, 15}, {0x0046B1, 15}, {0x003416, 15},
- {0x000AEA, 12}, {0x002A2C, 14}, {0x005741, 15}, {0x002A2F, 14},
- {0x000158, 9}, {0x0008D2, 12}, {0x00054C, 11}, {0x000686, 12},
- {0x000000, 2}, {0x000069, 8}, {0x00006B, 8}, {0x00068C, 12},
- {0x000007, 3}, {0x00015E, 9}, {0x0002A3, 10}, {0x000AE9, 12},
- {0x000006, 3}, {0x000231, 10}, {0x0002B8, 10}, {0x001A08, 14},
- {0x000010, 5}, {0x0001A9, 10}, {0x000342, 11}, {0x000A88, 12},
- {0x000004, 4}, {0x0001A2, 10}, {0x0002A4, 10}, {0x001184, 13},
- {0x000012, 5}, {0x000232, 10}, {0x0002B2, 10}, {0x000680, 12},
- {0x00001B, 6}, {0x00046A, 11}, {0x00068E, 12}, {0x002359, 14},
- {0x000016, 5}, {0x00015F, 9}, {0x0002A0, 10}, {0x00054D, 11},
- {0x000005, 4}, {0x000233, 10}, {0x0002B9, 10}, {0x0015D6, 13},
- {0x000022, 6}, {0x000468, 11}, {0x000683, 12}, {0x001A0A, 14},
- {0x000013, 5}, {0x000236, 10}, {0x0002BB, 10}, {0x001186, 13},
- {0x000017, 5}, {0x0001AB, 10}, {0x0002A7, 10}, {0x0008D3, 12},
- {0x000014, 5}, {0x000237, 10}, {0x000460, 11}, {0x000D0F, 13},
- {0x000019, 6}, {0x0001AA, 10}, {0x0002B3, 10}, {0x000681, 12},
- {0x000018, 6}, {0x0001A8, 10}, {0x0002A5, 10}, {0x00068F, 12},
- {0x000007, 4}, {0x000055, 7}, {0x000047, 7}, {0x0000AD, 8},
+static const uint32_t table_mb_non_intra3[128][2] = {
+{0x0002A1, 10}, {0x005740, 15}, {0x01A0BF, 18}, {0x015D19, 17},
+{0x001514, 13}, {0x00461E, 15}, {0x015176, 17}, {0x015177, 17},
+{0x0011AD, 13}, {0x00682E, 16}, {0x0682F9, 20}, {0x03417D, 19},
+{0x001A36, 14}, {0x002A2D, 14}, {0x00D05E, 17}, {0x006824, 16},
+{0x001515, 13}, {0x00545C, 15}, {0x0230E9, 18}, {0x011AFA, 17},
+{0x0015D7, 13}, {0x005747, 15}, {0x008D79, 16}, {0x006825, 16},
+{0x002BA2, 14}, {0x00A8BA, 16}, {0x0235F6, 18}, {0x015D18, 17},
+{0x0011AE, 13}, {0x00346F, 15}, {0x008C3B, 16}, {0x00346E, 15},
+{0x000D1A, 13}, {0x00461F, 15}, {0x0682F8, 20}, {0x011875, 17},
+{0x002BA1, 14}, {0x008D61, 16}, {0x0235F7, 18}, {0x0230E8, 18},
+{0x001513, 13}, {0x008D7B, 16}, {0x011AF4, 17}, {0x011AF5, 17},
+{0x001185, 13}, {0x0046BF, 15}, {0x008D60, 16}, {0x008D7C, 16},
+{0x001512, 13}, {0x00461C, 15}, {0x00AE8D, 16}, {0x008D78, 16},
+{0x000D0E, 13}, {0x003413, 15}, {0x0046B1, 15}, {0x003416, 15},
+{0x000AEA, 12}, {0x002A2C, 14}, {0x005741, 15}, {0x002A2F, 14},
+{0x000158, 9}, {0x0008D2, 12}, {0x00054C, 11}, {0x000686, 12},
+{0x000000, 2}, {0x000069, 8}, {0x00006B, 8}, {0x00068C, 12},
+{0x000007, 3}, {0x00015E, 9}, {0x0002A3, 10}, {0x000AE9, 12},
+{0x000006, 3}, {0x000231, 10}, {0x0002B8, 10}, {0x001A08, 14},
+{0x000010, 5}, {0x0001A9, 10}, {0x000342, 11}, {0x000A88, 12},
+{0x000004, 4}, {0x0001A2, 10}, {0x0002A4, 10}, {0x001184, 13},
+{0x000012, 5}, {0x000232, 10}, {0x0002B2, 10}, {0x000680, 12},
+{0x00001B, 6}, {0x00046A, 11}, {0x00068E, 12}, {0x002359, 14},
+{0x000016, 5}, {0x00015F, 9}, {0x0002A0, 10}, {0x00054D, 11},
+{0x000005, 4}, {0x000233, 10}, {0x0002B9, 10}, {0x0015D6, 13},
+{0x000022, 6}, {0x000468, 11}, {0x000683, 12}, {0x001A0A, 14},
+{0x000013, 5}, {0x000236, 10}, {0x0002BB, 10}, {0x001186, 13},
+{0x000017, 5}, {0x0001AB, 10}, {0x0002A7, 10}, {0x0008D3, 12},
+{0x000014, 5}, {0x000237, 10}, {0x000460, 11}, {0x000D0F, 13},
+{0x000019, 6}, {0x0001AA, 10}, {0x0002B3, 10}, {0x000681, 12},
+{0x000018, 6}, {0x0001A8, 10}, {0x0002A5, 10}, {0x00068F, 12},
+{0x000007, 4}, {0x000055, 7}, {0x000047, 7}, {0x0000AD, 8},
};
-static const uint32_t table_mb_non_intra4[128][2] =
-{
- {0x0000D4, 8}, {0x0021C5, 14}, {0x00F18A, 16}, {0x00D5BC, 16},
- {0x000879, 12}, {0x00354D, 14}, {0x010E3F, 17}, {0x010F54, 17},
- {0x000866, 12}, {0x00356E, 14}, {0x010F55, 17}, {0x010E3E, 17},
- {0x0010CE, 13}, {0x003C84, 14}, {0x00D5BD, 16}, {0x00F18B, 16},
- {0x000868, 12}, {0x00438C, 15}, {0x0087AB, 16}, {0x00790B, 15},
- {0x000F10, 12}, {0x00433D, 15}, {0x006AD3, 15}, {0x00790A, 15},
- {0x001AA7, 13}, {0x0043D4, 15}, {0x00871E, 16}, {0x006ADF, 15},
- {0x000D7C, 12}, {0x003C94, 14}, {0x00438D, 15}, {0x006AD2, 15},
- {0x0006BC, 11}, {0x0021E9, 14}, {0x006ADA, 15}, {0x006A99, 15},
- {0x0010F7, 13}, {0x004389, 15}, {0x006ADB, 15}, {0x0078C4, 15},
- {0x000D56, 12}, {0x0035F7, 14}, {0x00438E, 15}, {0x006A98, 15},
- {0x000D52, 12}, {0x003C95, 14}, {0x004388, 15}, {0x00433C, 15},
- {0x000D54, 12}, {0x001E4B, 13}, {0x003C63, 14}, {0x003C83, 14},
- {0x000861, 12}, {0x0021EB, 14}, {0x00356C, 14}, {0x0035F6, 14},
- {0x000863, 12}, {0x00219F, 14}, {0x003568, 14}, {0x003C82, 14},
- {0x0001AE, 9}, {0x0010C0, 13}, {0x000F11, 12}, {0x001AFA, 13},
- {0x000000, 1}, {0x0000F0, 8}, {0x0001AD, 9}, {0x0010C1, 13},
- {0x00000A, 4}, {0x0003C5, 10}, {0x000789, 11}, {0x001AB5, 13},
- {0x000009, 4}, {0x000435, 11}, {0x000793, 11}, {0x001E40, 13},
- {0x00001D, 5}, {0x0003CB, 10}, {0x000878, 12}, {0x001AAF, 13},
- {0x00000B, 4}, {0x0003C7, 10}, {0x000791, 11}, {0x001AAB, 13},
- {0x00001F, 5}, {0x000436, 11}, {0x0006BF, 11}, {0x000F19, 12},
- {0x00003D, 6}, {0x000D51, 12}, {0x0010C4, 13}, {0x0021E8, 14},
- {0x000036, 6}, {0x000437, 11}, {0x0006AF, 11}, {0x0010C5, 13},
- {0x00000C, 4}, {0x000432, 11}, {0x000794, 11}, {0x001E30, 13},
- {0x000042, 7}, {0x000870, 12}, {0x000F24, 12}, {0x001E43, 13},
- {0x000020, 6}, {0x00043E, 11}, {0x000795, 11}, {0x001AAA, 13},
- {0x000037, 6}, {0x0006AC, 11}, {0x0006AE, 11}, {0x0010F6, 13},
- {0x000034, 6}, {0x00043A, 11}, {0x000D50, 12}, {0x001AAE, 13},
- {0x000039, 6}, {0x00043F, 11}, {0x00078D, 11}, {0x0010D2, 13},
- {0x000038, 6}, {0x00043B, 11}, {0x0006BD, 11}, {0x0010D3, 13},
- {0x000011, 5}, {0x0001AC, 9}, {0x0000F3, 8}, {0x000439, 11},
+static const uint32_t table_mb_non_intra4[128][2] = {
+{0x0000D4, 8}, {0x0021C5, 14}, {0x00F18A, 16}, {0x00D5BC, 16},
+{0x000879, 12}, {0x00354D, 14}, {0x010E3F, 17}, {0x010F54, 17},
+{0x000866, 12}, {0x00356E, 14}, {0x010F55, 17}, {0x010E3E, 17},
+{0x0010CE, 13}, {0x003C84, 14}, {0x00D5BD, 16}, {0x00F18B, 16},
+{0x000868, 12}, {0x00438C, 15}, {0x0087AB, 16}, {0x00790B, 15},
+{0x000F10, 12}, {0x00433D, 15}, {0x006AD3, 15}, {0x00790A, 15},
+{0x001AA7, 13}, {0x0043D4, 15}, {0x00871E, 16}, {0x006ADF, 15},
+{0x000D7C, 12}, {0x003C94, 14}, {0x00438D, 15}, {0x006AD2, 15},
+{0x0006BC, 11}, {0x0021E9, 14}, {0x006ADA, 15}, {0x006A99, 15},
+{0x0010F7, 13}, {0x004389, 15}, {0x006ADB, 15}, {0x0078C4, 15},
+{0x000D56, 12}, {0x0035F7, 14}, {0x00438E, 15}, {0x006A98, 15},
+{0x000D52, 12}, {0x003C95, 14}, {0x004388, 15}, {0x00433C, 15},
+{0x000D54, 12}, {0x001E4B, 13}, {0x003C63, 14}, {0x003C83, 14},
+{0x000861, 12}, {0x0021EB, 14}, {0x00356C, 14}, {0x0035F6, 14},
+{0x000863, 12}, {0x00219F, 14}, {0x003568, 14}, {0x003C82, 14},
+{0x0001AE, 9}, {0x0010C0, 13}, {0x000F11, 12}, {0x001AFA, 13},
+{0x000000, 1}, {0x0000F0, 8}, {0x0001AD, 9}, {0x0010C1, 13},
+{0x00000A, 4}, {0x0003C5, 10}, {0x000789, 11}, {0x001AB5, 13},
+{0x000009, 4}, {0x000435, 11}, {0x000793, 11}, {0x001E40, 13},
+{0x00001D, 5}, {0x0003CB, 10}, {0x000878, 12}, {0x001AAF, 13},
+{0x00000B, 4}, {0x0003C7, 10}, {0x000791, 11}, {0x001AAB, 13},
+{0x00001F, 5}, {0x000436, 11}, {0x0006BF, 11}, {0x000F19, 12},
+{0x00003D, 6}, {0x000D51, 12}, {0x0010C4, 13}, {0x0021E8, 14},
+{0x000036, 6}, {0x000437, 11}, {0x0006AF, 11}, {0x0010C5, 13},
+{0x00000C, 4}, {0x000432, 11}, {0x000794, 11}, {0x001E30, 13},
+{0x000042, 7}, {0x000870, 12}, {0x000F24, 12}, {0x001E43, 13},
+{0x000020, 6}, {0x00043E, 11}, {0x000795, 11}, {0x001AAA, 13},
+{0x000037, 6}, {0x0006AC, 11}, {0x0006AE, 11}, {0x0010F6, 13},
+{0x000034, 6}, {0x00043A, 11}, {0x000D50, 12}, {0x001AAE, 13},
+{0x000039, 6}, {0x00043F, 11}, {0x00078D, 11}, {0x0010D2, 13},
+{0x000038, 6}, {0x00043B, 11}, {0x0006BD, 11}, {0x0010D3, 13},
+{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 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,
};
-const uint8_t 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_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] =
-{
- 0x00, 0x08, 0x01, 0x10, 0x09, 0x18, 0x11, 0x02,
- 0x20, 0x0A, 0x19, 0x28, 0x12, 0x30, 0x21, 0x1A,
- 0x38, 0x29, 0x22, 0x03, 0x31, 0x39, 0x0B, 0x2A,
- 0x13, 0x32, 0x1B, 0x3A, 0x23, 0x2B, 0x33, 0x3B,
+const uint8_t 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,
+0x13, 0x32, 0x1B, 0x3A, 0x23, 0x2B, 0x33, 0x3B,
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.h
index 334517172..9baa9370d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/msmpeg4data.h
@@ -35,8 +35,7 @@
#include "rl.h"
/* motion vector table */
-typedef struct MVTable
-{
+typedef struct MVTable {
int n;
const uint16_t *table_mv_code;
const uint8_t *table_mv_bits;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoser.c
index adc32bbaf..08559e68c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoser.c
@@ -38,59 +38,54 @@
#define ALT_BITSTREAM_READER_LE
#include "get_bits.h"
-const float ff_nelly_dequantization_table[127] =
-{
- 0.0000000000,
+const float ff_nelly_dequantization_table[127] = {
+ 0.0000000000,
- -0.8472560048, 0.7224709988,
+-0.8472560048, 0.7224709988,
- -1.5247479677, -0.4531480074, 0.3753609955, 1.4717899561,
+-1.5247479677,-0.4531480074, 0.3753609955, 1.4717899561,
- -1.9822579622, -1.1929379702, -0.5829370022, -0.0693780035, 0.3909569979, 0.9069200158, 1.4862740040, 2.2215409279,
+-1.9822579622,-1.1929379702,-0.5829370022,-0.0693780035, 0.3909569979, 0.9069200158, 1.4862740040, 2.2215409279,
- -2.3887870312, -1.8067539930, -1.4105420113, -1.0773609877, -0.7995010018, -0.5558109879, -0.3334020078, -0.1324490011,
- 0.0568020009, 0.2548770010, 0.4773550034, 0.7386850119, 1.0443060398, 1.3954459429, 1.8098750114, 2.3918759823,
+-2.3887870312,-1.8067539930,-1.4105420113,-1.0773609877,-0.7995010018,-0.5558109879,-0.3334020078,-0.1324490011,
+ 0.0568020009, 0.2548770010, 0.4773550034, 0.7386850119, 1.0443060398, 1.3954459429, 1.8098750114, 2.3918759823,
- -2.3893830776, -1.9884680510, -1.7514040470, -1.5643119812, -1.3922129869, -1.2164649963, -1.0469499826, -0.8905100226,
- -0.7645580173, -0.6454579830, -0.5259280205, -0.4059549868, -0.3029719889, -0.2096900046, -0.1239869967, -0.0479229987,
- 0.0257730000, 0.1001340002, 0.1737180054, 0.2585540116, 0.3522900045, 0.4569880068, 0.5767750144, 0.7003160119,
- 0.8425520062, 1.0093879700, 1.1821349859, 1.3534560204, 1.5320819616, 1.7332619429, 1.9722349644, 2.3978140354,
+-2.3893830776,-1.9884680510,-1.7514040470,-1.5643119812,-1.3922129869,-1.2164649963,-1.0469499826,-0.8905100226,
+-0.7645580173,-0.6454579830,-0.5259280205,-0.4059549868,-0.3029719889,-0.2096900046,-0.1239869967,-0.0479229987,
+ 0.0257730000, 0.1001340002, 0.1737180054, 0.2585540116, 0.3522900045, 0.4569880068, 0.5767750144, 0.7003160119,
+ 0.8425520062, 1.0093879700, 1.1821349859, 1.3534560204, 1.5320819616, 1.7332619429, 1.9722349644, 2.3978140354,
- -2.5756309032, -2.0573320389, -1.8984919786, -1.7727810144, -1.6662600040, -1.5742180347, -1.4993319511, -1.4316639900,
- -1.3652280569, -1.3000990152, -1.2280930281, -1.1588579416, -1.0921250582, -1.0135740042, -0.9202849865, -0.8287050128,
- -0.7374889851, -0.6447759867, -0.5590940118, -0.4857139885, -0.4110319912, -0.3459700048, -0.2851159871, -0.2341620028,
- -0.1870580018, -0.1442500055, -0.1107169986, -0.0739680007, -0.0365610011, -0.0073290002, 0.0203610007, 0.0479039997,
- 0.0751969963, 0.0980999991, 0.1220389977, 0.1458999962, 0.1694349945, 0.1970459968, 0.2252430022, 0.2556869984,
- 0.2870100141, 0.3197099864, 0.3525829911, 0.3889069855, 0.4334920049, 0.4769459963, 0.5204820037, 0.5644530058,
- 0.6122040153, 0.6685929894, 0.7341650128, 0.8032159805, 0.8784040213, 0.9566209912, 1.0397069454, 1.1293770075,
- 1.2211159468, 1.3080279827, 1.4024800062, 1.5056819916, 1.6227730513, 1.7724959850, 1.9430880547, 2.2903931141
+-2.5756309032,-2.0573320389,-1.8984919786,-1.7727810144,-1.6662600040,-1.5742180347,-1.4993319511,-1.4316639900,
+-1.3652280569,-1.3000990152,-1.2280930281,-1.1588579416,-1.0921250582,-1.0135740042,-0.9202849865,-0.8287050128,
+-0.7374889851,-0.6447759867,-0.5590940118,-0.4857139885,-0.4110319912,-0.3459700048,-0.2851159871,-0.2341620028,
+-0.1870580018,-0.1442500055,-0.1107169986,-0.0739680007,-0.0365610011,-0.0073290002, 0.0203610007, 0.0479039997,
+ 0.0751969963, 0.0980999991, 0.1220389977, 0.1458999962, 0.1694349945, 0.1970459968, 0.2252430022, 0.2556869984,
+ 0.2870100141, 0.3197099864, 0.3525829911, 0.3889069855, 0.4334920049, 0.4769459963, 0.5204820037, 0.5644530058,
+ 0.6122040153, 0.6685929894, 0.7341650128, 0.8032159805, 0.8784040213, 0.9566209912, 1.0397069454, 1.1293770075,
+ 1.2211159468, 1.3080279827, 1.4024800062, 1.5056819916, 1.6227730513, 1.7724959850, 1.9430880547, 2.2903931141
};
-const uint8_t ff_nelly_band_sizes_table[NELLY_BANDS] =
-{
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 12, 14, 15
+const uint8_t ff_nelly_band_sizes_table[NELLY_BANDS] = {
+2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 12, 14, 15
};
-const uint16_t ff_nelly_init_table[64] =
-{
- 3134, 5342, 6870, 7792, 8569, 9185, 9744, 10191, 10631, 11061, 11434, 11770,
- 12116, 12513, 12925, 13300, 13674, 14027, 14352, 14716, 15117, 15477, 15824,
- 16157, 16513, 16804, 17090, 17401, 17679, 17948, 18238, 18520, 18764, 19078,
- 19381, 19640, 19921, 20205, 20500, 20813, 21162, 21465, 21794, 22137, 22453,
- 22756, 23067, 23350, 23636, 23926, 24227, 24521, 24819, 25107, 25414, 25730,
- 26120, 26497, 26895, 27344, 27877, 28463, 29426, 31355
+const uint16_t ff_nelly_init_table[64] = {
+3134, 5342, 6870, 7792, 8569, 9185, 9744, 10191, 10631, 11061, 11434, 11770,
+12116, 12513, 12925, 13300, 13674, 14027, 14352, 14716, 15117, 15477, 15824,
+16157, 16513, 16804, 17090, 17401, 17679, 17948, 18238, 18520, 18764, 19078,
+19381, 19640, 19921, 20205, 20500, 20813, 21162, 21465, 21794, 22137, 22453,
+22756, 23067, 23350, 23636, 23926, 24227, 24521, 24819, 25107, 25414, 25730,
+26120, 26497, 26895, 27344, 27877, 28463, 29426, 31355
};
-const int16_t ff_nelly_delta_table[32] =
-{
- -11725, -9420, -7910, -6801, -5948, -5233, -4599, -4039, -3507, -3030, -2596,
- -2170, -1774, -1383, -1016, -660, -329, -1, 337, 696, 1085, 1512, 1962, 2433,
- 2968, 3569, 4314, 5279, 6622, 8154, 10076, 12975
+const int16_t ff_nelly_delta_table[32] = {
+-11725, -9420, -7910, -6801, -5948, -5233, -4599, -4039, -3507, -3030, -2596,
+-2170, -1774, -1383, -1016, -660, -329, -1, 337, 696, 1085, 1512, 1962, 2433,
+2968, 3569, 4314, 5279, 6622, 8154, 10076, 12975
};
-static inline int signed_shift(int i, int shift)
-{
- if(shift > 0)
+static inline int signed_shift(int i, int shift) {
+ if (shift > 0)
return i << shift;
return i >> -shift;
}
@@ -99,10 +94,9 @@ static int sum_bits(short *buf, short shift, short off)
{
int i, ret = 0;
- for(i = 0; i < NELLY_FILL_LEN; i++)
- {
- int b = buf[i] - off;
- b = ((b >> (shift - 1)) + 1) >> 1;
+ for (i = 0; i < NELLY_FILL_LEN; i++) {
+ int b = buf[i]-off;
+ b = ((b>>(shift-1))+1)>>1;
ret += av_clip(b, 0, NELLY_BIT_CAP);
}
@@ -112,8 +106,7 @@ static int sum_bits(short *buf, short shift, short off)
static int headroom(int *la)
{
int l;
- if(*la == 0)
- {
+ if (*la == 0) {
return 31;
}
l = 30 - av_log2(FFABS(*la));
@@ -133,18 +126,16 @@ void ff_nelly_get_sample_bits(const float *buf, int *bits)
int off;
max = 0;
- for(i = 0; i < NELLY_FILL_LEN; i++)
- {
+ for (i = 0; i < NELLY_FILL_LEN; i++) {
max = FFMAX(max, buf[i]);
}
shift = -16;
shift += headroom(&max);
sum = 0;
- for(i = 0; i < NELLY_FILL_LEN; i++)
- {
+ for (i = 0; i < NELLY_FILL_LEN; i++) {
sbuf[i] = signed_shift(buf[i], shift);
- sbuf[i] = (3 * sbuf[i]) >> 2;
+ sbuf[i] = (3*sbuf[i])>>2;
sum += sbuf[i];
}
@@ -152,92 +143,77 @@ void ff_nelly_get_sample_bits(const float *buf, int *bits)
shift_saved = shift;
sum -= NELLY_DETAIL_BITS << shift;
shift += headroom(&sum);
- small_off = (NELLY_BASE_OFF * (sum >> 16)) >> 15;
- shift = shift_saved - (NELLY_BASE_SHIFT + shift - 31);
+ small_off = (NELLY_BASE_OFF * (sum>>16)) >> 15;
+ shift = shift_saved - (NELLY_BASE_SHIFT+shift-31);
small_off = signed_shift(small_off, shift);
bitsum = sum_bits(sbuf, shift_saved, small_off);
- if(bitsum != NELLY_DETAIL_BITS)
- {
+ if (bitsum != NELLY_DETAIL_BITS) {
off = bitsum - NELLY_DETAIL_BITS;
- for(shift = 0; FFABS(off) <= 16383; shift++)
+ for(shift=0; FFABS(off) <= 16383; shift++)
off *= 2;
off = (off * NELLY_BASE_OFF) >> 15;
- shift = shift_saved - (NELLY_BASE_SHIFT + shift - 15);
+ shift = shift_saved-(NELLY_BASE_SHIFT+shift-15);
off = signed_shift(off, shift);
- for(j = 1; j < 20; j++)
- {
+ for (j = 1; j < 20; j++) {
last_off = small_off;
small_off += off;
last_bitsum = bitsum;
bitsum = sum_bits(sbuf, shift_saved, small_off);
- if((bitsum - NELLY_DETAIL_BITS) *(last_bitsum - NELLY_DETAIL_BITS) <= 0)
+ if ((bitsum-NELLY_DETAIL_BITS) * (last_bitsum-NELLY_DETAIL_BITS) <= 0)
break;
}
- if(bitsum > NELLY_DETAIL_BITS)
- {
+ if (bitsum > NELLY_DETAIL_BITS) {
big_off = small_off;
small_off = last_off;
- big_bitsum = bitsum;
- small_bitsum = last_bitsum;
- }
- else
- {
+ big_bitsum=bitsum;
+ small_bitsum=last_bitsum;
+ } else {
big_off = last_off;
- big_bitsum = last_bitsum;
- small_bitsum = bitsum;
+ big_bitsum=last_bitsum;
+ small_bitsum=bitsum;
}
- while(bitsum != NELLY_DETAIL_BITS && j <= 19)
- {
- off = (big_off + small_off) >> 1;
+ while (bitsum != NELLY_DETAIL_BITS && j <= 19) {
+ off = (big_off+small_off)>>1;
bitsum = sum_bits(sbuf, shift_saved, off);
- if(bitsum > NELLY_DETAIL_BITS)
- {
- big_off = off;
- big_bitsum = bitsum;
- }
- else
- {
+ if (bitsum > NELLY_DETAIL_BITS) {
+ big_off=off;
+ big_bitsum=bitsum;
+ } else {
small_off = off;
- small_bitsum = bitsum;
+ small_bitsum=bitsum;
}
j++;
}
- if(abs(big_bitsum - NELLY_DETAIL_BITS) >=
- abs(small_bitsum - NELLY_DETAIL_BITS))
- {
+ if (abs(big_bitsum-NELLY_DETAIL_BITS) >=
+ abs(small_bitsum-NELLY_DETAIL_BITS)) {
bitsum = small_bitsum;
- }
- else
- {
+ } else {
small_off = big_off;
bitsum = big_bitsum;
}
}
- for(i = 0; i < NELLY_FILL_LEN; i++)
- {
- tmp = sbuf[i] - small_off;
- tmp = ((tmp >> (shift_saved - 1)) + 1) >> 1;
+ for (i = 0; i < NELLY_FILL_LEN; i++) {
+ tmp = sbuf[i]-small_off;
+ tmp = ((tmp>>(shift_saved-1))+1)>>1;
bits[i] = av_clip(tmp, 0, NELLY_BIT_CAP);
}
- if(bitsum > NELLY_DETAIL_BITS)
- {
+ if (bitsum > NELLY_DETAIL_BITS) {
tmp = i = 0;
- while(tmp < NELLY_DETAIL_BITS)
- {
+ while (tmp < NELLY_DETAIL_BITS) {
tmp += bits[i];
i++;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoserdec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoserdec.c
index d0dae1d86..942f8de30 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoserdec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/nellymoserdec.c
@@ -45,10 +45,9 @@
#endif
-typedef struct NellyMoserDecodeContext
-{
+typedef struct NellyMoserDecodeContext {
AVCodecContext* avctx;
- DECLARE_ALIGNED_16(float, float_buf)[NELLY_SAMPLES];
+ DECLARE_ALIGNED_16(float,float_buf)[NELLY_SAMPLES];
float state[128];
AVLFG random_state;
GetBitContext gb;
@@ -56,7 +55,7 @@ typedef struct NellyMoserDecodeContext
float scale_bias;
DSPContext dsp;
FFTContext imdct_ctx;
- DECLARE_ALIGNED_16(float, imdct_out)[NELLY_BUF_LEN * 2];
+ DECLARE_ALIGNED_16(float,imdct_out)[NELLY_BUF_LEN * 2];
} NellyMoserDecodeContext;
static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *audio, float *a_in)
@@ -64,12 +63,11 @@ static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *
int bot, top;
bot = 0;
- top = NELLY_BUF_LEN - 1;
+ top = NELLY_BUF_LEN-1;
- while(bot < NELLY_BUF_LEN)
- {
- audio[bot] = a_in [bot] * ff_sine_128[bot]
- + state[bot] * ff_sine_128[top] + s->add_bias;
+ while (bot < NELLY_BUF_LEN) {
+ audio[bot] = a_in [bot]*ff_sine_128[bot]
+ +state[bot]*ff_sine_128[top] + s->add_bias;
bot++;
top--;
@@ -81,7 +79,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
const unsigned char block[NELLY_BLOCK_LEN],
float audio[NELLY_SAMPLES])
{
- int i, j;
+ int i,j;
float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];
float *aptr, *bptr, *pptr, val, pval;
int bits[NELLY_BUF_LEN];
@@ -92,13 +90,11 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
bptr = buf;
pptr = pows;
val = ff_nelly_init_table[get_bits(&s->gb, 6)];
- for(i = 0 ; i < NELLY_BANDS ; i++)
- {
- if(i > 0)
+ for (i=0 ; i<NELLY_BANDS ; i++) {
+ if (i > 0)
val += ff_nelly_delta_table[get_bits(&s->gb, 5)];
- pval = -pow(2, val / 2048) * s->scale_bias;
- for(j = 0; j < ff_nelly_band_sizes_table[i]; j++)
- {
+ pval = -pow(2, val/2048) * s->scale_bias;
+ for (j = 0; j < ff_nelly_band_sizes_table[i]; j++) {
*bptr++ = val;
*pptr++ = pval;
}
@@ -107,25 +103,20 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
ff_nelly_get_sample_bits(buf, bits);
- for(i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
aptr = audio + i * NELLY_BUF_LEN;
init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);
- skip_bits_long(&s->gb, NELLY_HEADER_BITS + i * NELLY_DETAIL_BITS);
-
- for(j = 0; j < NELLY_FILL_LEN; j++)
- {
- if(bits[j] <= 0)
- {
- aptr[j] = M_SQRT1_2 * pows[j];
- if(av_lfg_get(&s->random_state) & 1)
+ skip_bits_long(&s->gb, NELLY_HEADER_BITS + i*NELLY_DETAIL_BITS);
+
+ for (j = 0; j < NELLY_FILL_LEN; j++) {
+ if (bits[j] <= 0) {
+ aptr[j] = M_SQRT1_2*pows[j];
+ if (av_lfg_get(&s->random_state) & 1)
aptr[j] *= -1.0;
- }
- else
- {
+ } else {
v = get_bits(&s->gb, bits[j]);
- aptr[j] = ff_nelly_dequantization_table[(1<<bits[j]) - 1 + v] * pows[j];
+ aptr[j] = ff_nelly_dequantization_table[(1<<bits[j])-1+v]*pows[j];
}
}
memset(&aptr[NELLY_FILL_LEN], 0,
@@ -138,8 +129,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
}
}
-static av_cold int decode_init(AVCodecContext * avctx)
-{
+static av_cold int decode_init(AVCodecContext * avctx) {
NellyMoserDecodeContext *s = avctx->priv_data;
s->avctx = avctx;
@@ -148,19 +138,16 @@ static av_cold int decode_init(AVCodecContext * avctx)
dsputil_init(&s->dsp, avctx);
- if(s->dsp.float_to_int16 == ff_float_to_int16_c)
- {
+ if(s->dsp.float_to_int16 == ff_float_to_int16_c) {
s->add_bias = 385;
- s->scale_bias = 1.0 / (8 * 32768);
- }
- else
- {
+ s->scale_bias = 1.0/(8*32768);
+ } else {
s->add_bias = 0;
- s->scale_bias = 1.0 / (1 * 8);
+ s->scale_bias = 1.0/(1*8);
}
/* Generate overlap window */
- if(!ff_sine_128[127])
+ if (!ff_sine_128[127])
ff_init_ff_sine_windows(7);
avctx->sample_fmt = SAMPLE_FMT_S16;
@@ -170,59 +157,49 @@ static av_cold int decode_init(AVCodecContext * avctx)
static int decode_tag(AVCodecContext * avctx,
void *data, int *data_size,
- const uint8_t * buf, int buf_size)
-{
+ const uint8_t * buf, int buf_size) {
NellyMoserDecodeContext *s = avctx->priv_data;
int blocks, i;
int16_t* samples;
*data_size = 0;
samples = (int16_t*)data;
- if(buf_size < avctx->block_align)
+ if (buf_size < avctx->block_align)
return buf_size;
- switch(buf_size)
- {
- case 64: // 8000Hz
- blocks = 1;
- break;
- case 128: // 11025Hz
- blocks = 2;
- break;
- case 192: // 16000Hz
- blocks = 3;
- break;
- case 256: // 22050Hz
- blocks = 4;
- break;
- case 512: // 44100Hz
- blocks = 8;
- break;
- default:
- av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
- return buf_size;
+ switch (buf_size) {
+ case 64: // 8000Hz
+ blocks = 1; break;
+ case 128: // 11025Hz
+ blocks = 2; break;
+ case 192: // 16000Hz
+ blocks = 3; break;
+ case 256: // 22050Hz
+ blocks = 4; break;
+ case 512: // 44100Hz
+ blocks = 8; break;
+ default:
+ av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
+ return buf_size;
}
- for(i = 0 ; i < blocks ; i++)
- {
+ for (i=0 ; i<blocks ; i++) {
nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
- *data_size += NELLY_SAMPLES * sizeof(int16_t);
+ *data_size += NELLY_SAMPLES*sizeof(int16_t);
}
return buf_size;
}
-static av_cold int decode_end(AVCodecContext * avctx)
-{
+static av_cold int decode_end(AVCodecContext * avctx) {
NellyMoserDecodeContext *s = avctx->priv_data;
ff_mdct_end(&s->imdct_ctx);
return 0;
}
-AVCodec nellymoser_decoder =
-{
+AVCodec nellymoser_decoder = {
"nellymoser",
CODEC_TYPE_AUDIO,
CODEC_ID_NELLYMOSER,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/options.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/options.c
index d03286e40..ae6ee4785 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/options.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/options.c
@@ -26,9 +26,8 @@
#include "avcodec.h"
-static const char* context_to_name(void* ptr)
-{
- AVCodecContext *avc = ptr;
+static const char* context_to_name(void* ptr) {
+ AVCodecContext *avc= ptr;
if(avc && avc->codec && avc->codec->name)
return avc->codec->name;
@@ -38,63 +37,60 @@ static const char* context_to_name(void* ptr)
static AVClass av_codec_context_class = { "AVCodecContext", context_to_name };
-void avcodec_get_context_defaults(AVCodecContext *s)
-{
+void avcodec_get_context_defaults(AVCodecContext *s){
memset(s, 0, sizeof(AVCodecContext));
- s->av_class = &av_codec_context_class;
+ s->av_class= &av_codec_context_class;
- s->time_base.num = 0;
- s->time_base.den = 1;
+ s->time_base.num=0; s->time_base.den=1;
- s->get_buffer = avcodec_default_get_buffer;
- s->release_buffer = avcodec_default_release_buffer;
- s->get_format = avcodec_default_get_format;
- s->execute = avcodec_default_execute;
- s->execute2 = avcodec_default_execute2;
- s->sample_aspect_ratio.num = 0;
- s->sample_aspect_ratio.den = 1;
- s->pix_fmt = PIX_FMT_NONE;
- s->sample_fmt = SAMPLE_FMT_S16; // FIXME: set to NONE
+ s->get_buffer= avcodec_default_get_buffer;
+ s->release_buffer= avcodec_default_release_buffer;
+ s->get_format= avcodec_default_get_format;
+ s->execute= avcodec_default_execute;
+ s->execute2= avcodec_default_execute2;
+ s->sample_aspect_ratio.num=0; s->sample_aspect_ratio.den=1;
+ s->pix_fmt= PIX_FMT_NONE;
+ s->sample_fmt= SAMPLE_FMT_S16; // FIXME: set to NONE
s->palctrl = NULL;
- s->reget_buffer = avcodec_default_reget_buffer;
-
- s->bit_rate = 800 * 1000;
- s->bit_rate_tolerance = s->bit_rate * 10;
- s->qmin = 2;
- s->qmax = 31;
- s->mb_lmin = FF_QP2LAMBDA * 2;
- s->mb_lmax = FF_QP2LAMBDA * 31;
+ s->reget_buffer= avcodec_default_reget_buffer;
+
+ s->bit_rate= 800*1000;
+ s->bit_rate_tolerance= s->bit_rate*10;
+ s->qmin= 2;
+ s->qmax= 31;
+ s->mb_lmin= FF_QP2LAMBDA * 2;
+ s->mb_lmax= FF_QP2LAMBDA * 31;
s->cqp = -1;
s->refs = 1;
s->directpred = 2;
- s->qcompress = 0.5;
+ s->qcompress= 0.5;
s->complexityblur = 20.0;
s->keyint_min = 25;
s->flags2 = CODEC_FLAG2_FASTPSKIP;
- s->max_qdiff = 3;
- s->b_quant_factor = 1.25;
- s->b_quant_offset = 1.25;
- s->i_quant_factor = -0.8;
- s->i_quant_offset = 0.0;
- s->error_concealment = 3;
- s->error_recognition = 1;
- s->workaround_bugs = FF_BUG_AUTODETECT;
- s->gop_size = 50;
- s->me_method = ME_EPZS;
- s->thread_count = 1;
- s->me_subpel_quality = 8;
- s->lmin = FF_QP2LAMBDA * s->qmin;
- s->lmax = FF_QP2LAMBDA * s->qmax;
- s->ildct_cmp = FF_CMP_VSAD;
- s->profile = FF_PROFILE_UNKNOWN;
- s->level = FF_LEVEL_UNKNOWN;
- s->me_penalty_compensation = 256;
- s->frame_skip_cmp = FF_CMP_DCTMAX;
- s->nsse_weight = 8;
- s->mv0_threshold = 256;
- s->b_sensitivity = 40;
+ s->max_qdiff= 3;
+ s->b_quant_factor=1.25;
+ s->b_quant_offset=1.25;
+ s->i_quant_factor=-0.8;
+ s->i_quant_offset=0.0;
+ s->error_concealment= 3;
+ s->error_recognition= 1;
+ s->workaround_bugs= FF_BUG_AUTODETECT;
+ s->gop_size= 50;
+ s->me_method= ME_EPZS;
+ s->thread_count=1;
+ s->me_subpel_quality=8;
+ s->lmin= FF_QP2LAMBDA * s->qmin;
+ s->lmax= FF_QP2LAMBDA * s->qmax;
+ s->ildct_cmp= FF_CMP_VSAD;
+ s->profile= FF_PROFILE_UNKNOWN;
+ s->level= FF_LEVEL_UNKNOWN;
+ s->me_penalty_compensation= 256;
+ s->frame_skip_cmp= FF_CMP_DCTMAX;
+ s->nsse_weight= 8;
+ s->mv0_threshold= 256;
+ s->b_sensitivity= 40;
s->compression_level = FF_COMPRESSION_DEFAULT;
s->use_lpc = -1;
s->min_prediction_order = -1;
@@ -102,17 +98,16 @@ void avcodec_get_context_defaults(AVCodecContext *s)
s->prediction_order_method = -1;
s->min_partition_order = -1;
s->max_partition_order = -1;
- s->intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
- s->inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
- s->rc_max_available_vbv_use = 1.0 / 3;
+ s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
+ s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
+ s->rc_max_available_vbv_use = 1.0/3;
s->rc_min_vbv_overflow_use = 3;
}
-AVCodecContext *avcodec_alloc_context(void)
-{
- AVCodecContext *avctx = av_malloc(sizeof(AVCodecContext));
+AVCodecContext *avcodec_alloc_context(void){
+ AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
- if(avctx == NULL) return NULL;
+ if(avctx==NULL) return NULL;
avcodec_get_context_defaults(avctx);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.c
index 5789d959f..3b5097950 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.c
@@ -24,8 +24,7 @@
static AVCodecParser *av_first_parser = NULL;
-AVCodecParser* av_parser_next(AVCodecParser *p)
-{
+AVCodecParser* av_parser_next(AVCodecParser *p){
if(p) return p->next;
else return av_first_parser;
}
@@ -45,38 +44,34 @@ AVCodecParserContext *av_parser_init(int codec_id)
if(codec_id == CODEC_ID_NONE)
return NULL;
- for(parser = av_first_parser; parser != NULL; parser = parser->next)
- {
- if(parser->codec_ids[0] == codec_id ||
- parser->codec_ids[1] == codec_id ||
- parser->codec_ids[2] == codec_id ||
- parser->codec_ids[3] == codec_id ||
- parser->codec_ids[4] == codec_id)
+ for(parser = av_first_parser; parser != NULL; parser = parser->next) {
+ if (parser->codec_ids[0] == codec_id ||
+ parser->codec_ids[1] == codec_id ||
+ parser->codec_ids[2] == codec_id ||
+ parser->codec_ids[3] == codec_id ||
+ parser->codec_ids[4] == codec_id)
goto found;
}
return NULL;
-found:
+ found:
s = av_mallocz(sizeof(AVCodecParserContext));
- if(!s)
+ if (!s)
return NULL;
s->parser = parser;
s->priv_data = av_mallocz(parser->priv_data_size);
- if(!s->priv_data)
- {
+ if (!s->priv_data) {
av_free(s);
return NULL;
}
- if(parser->parser_init)
- {
+ if (parser->parser_init) {
ret = parser->parser_init(s);
- if(ret != 0)
- {
+ if (ret != 0) {
av_free(s->priv_data);
av_free(s);
return NULL;
}
}
- s->fetch_timestamp = 1;
+ s->fetch_timestamp=1;
s->pict_type = FF_I_TYPE;
s->key_frame = -1;
s->convergence_duration = AV_NOPTS_VALUE;
@@ -86,27 +81,24 @@ found:
return s;
}
-void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove)
-{
+void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
int i;
- s->dts = s->pts = AV_NOPTS_VALUE;
- s->pos = -1;
- s->offset = 0;
- for(i = 0; i < AV_PARSER_PTS_NB; i++)
- {
- 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 becausue mpeg-ts doesnt 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];
- s->pos = s->cur_frame_pos[i];
+ s->dts= s->pts= AV_NOPTS_VALUE;
+ s->pos= -1;
+ s->offset= 0;
+ for(i = 0; i < AV_PARSER_PTS_NB; i++) {
+ 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 becausue mpeg-ts doesnt 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];
+ s->pos= s->cur_frame_pos[i];
s->offset = s->next_frame_offset - s->cur_frame_offset[i];
if(remove)
- s->cur_frame_offset[i] = INT64_MAX;
+ s->cur_frame_offset[i]= INT64_MAX;
if(s->cur_offset + off < s->cur_frame_end[i])
break;
}
@@ -158,28 +150,24 @@ int av_parser_parse2(AVCodecParserContext *s,
int index, i;
uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE];
- if(buf_size == 0)
- {
+ if (buf_size == 0) {
/* padding is always necessary even if EOF, so we add it here */
memset(dummy_buf, 0, sizeof(dummy_buf));
buf = dummy_buf;
- }
- else if(s->cur_offset + buf_size !=
- s->cur_frame_end[s->cur_frame_start_index]) /* skip remainder packets */
- {
+ } else if (s->cur_offset + buf_size !=
+ s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */
/* add a new packet descriptor */
- i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
- s->cur_frame_start_index = i;
- s->cur_frame_offset[i] = s->cur_offset;
- s->cur_frame_end[i] = s->cur_offset + buf_size;
- s->cur_frame_pts[i] = pts;
- s->cur_frame_dts[i] = dts;
- s->cur_frame_pos[i] = pos;
+ i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
+ s->cur_frame_start_index = i;
+ s->cur_frame_offset[i] = s->cur_offset;
+ s->cur_frame_end[i] = s->cur_offset + buf_size;
+ s->cur_frame_pts[i] = pts;
+ s->cur_frame_dts[i] = dts;
+ s->cur_frame_pos[i] = pos;
}
- if(s->fetch_timestamp)
- {
- s->fetch_timestamp = 0;
+ if (s->fetch_timestamp){
+ s->fetch_timestamp=0;
s->last_pts = s->pts;
s->last_dts = s->dts;
s->last_pos = s->pos;
@@ -190,16 +178,15 @@ int av_parser_parse2(AVCodecParserContext *s,
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)
- {
+ if (*poutbuf_size) {
/* fill the data for the current frame */
s->frame_offset = s->next_frame_offset;
/* offset of the next frame */
s->next_frame_offset = s->cur_offset + index;
- s->fetch_timestamp = 1;
+ s->fetch_timestamp=1;
}
- if(index < 0)
+ if (index < 0)
index = 0;
s->cur_offset += index;
return index;
@@ -213,31 +200,26 @@ int av_parser_parse2(AVCodecParserContext *s,
int av_parser_change(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size, int keyframe)
-{
+ const uint8_t *buf, int buf_size, int keyframe){
- if(s && s->parser->split)
- {
- if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
- {
- int i = s->parser->split(avctx, buf, buf_size);
+ if(s && s->parser->split){
+ if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
+ int i= s->parser->split(avctx, buf, buf_size);
buf += i;
buf_size -= i;
}
}
/* cast to avoid warning about discarding qualifiers */
- *poutbuf = (uint8_t *) buf;
- *poutbuf_size = buf_size;
- if(avctx->extradata)
- {
- if((keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
- /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
- /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/)
- {
- int size = buf_size + avctx->extradata_size;
- *poutbuf_size = size;
- *poutbuf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ *poutbuf= (uint8_t *) buf;
+ *poutbuf_size= buf_size;
+ if(avctx->extradata){
+ if( (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
+ /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
+ /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
+ int size= buf_size + avctx->extradata_size;
+ *poutbuf_size= size;
+ *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -250,9 +232,8 @@ int av_parser_change(AVCodecParserContext *s,
void av_parser_close(AVCodecParserContext *s)
{
- if(s)
- {
- if(s->parser->parser_close)
+ if(s){
+ if (s->parser->parser_close)
s->parser->parser_close(s);
av_free(s->priv_data);
av_free(s);
@@ -268,30 +249,26 @@ void av_parser_close(AVCodecParserContext *s)
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
{
#if 0
- if(pc->overread)
- {
+ if(pc->overread){
printf("overread %d, state:%X next:%d index:%d o_index:%d\n", pc->overread, pc->state, next, pc->index, pc->overread_index);
- printf("%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
+ printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
}
#endif
/* Copy overread bytes from last frame into buffer. */
- for(; pc->overread > 0; pc->overread--)
- {
- pc->buffer[pc->index++] = pc->buffer[pc->overread_index++];
+ for(; pc->overread>0; pc->overread--){
+ pc->buffer[pc->index++]= pc->buffer[pc->overread_index++];
}
/* flush remaining if EOF */
- if(!*buf_size && next == END_NOT_FOUND)
- {
- next = 0;
+ if(!*buf_size && next == END_NOT_FOUND){
+ next= 0;
}
- pc->last_index = pc->index;
+ pc->last_index= pc->index;
/* copy into buffer end return */
- if(next == END_NOT_FOUND)
- {
+ if(next == END_NOT_FOUND){
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
if(!new_buffer)
@@ -302,35 +279,32 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
return -1;
}
- *buf_size =
- pc->overread_index = pc->index + next;
+ *buf_size=
+ pc->overread_index= pc->index + next;
/* append to buffer */
- if(pc->index)
- {
+ if(pc->index){
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
if(!new_buffer)
return AVERROR(ENOMEM);
pc->buffer = new_buffer;
- memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE );
pc->index = 0;
- *buf = pc->buffer;
+ *buf= pc->buffer;
}
/* store overread bytes */
- for(; next < 0; next++)
- {
- pc->state = (pc->state << 8) | pc->buffer[pc->last_index + next];
- pc->state64 = (pc->state64 << 8) | pc->buffer[pc->last_index + next];
+ for(;next < 0; next++){
+ pc->state = (pc->state<<8) | pc->buffer[pc->last_index + next];
+ pc->state64 = (pc->state64<<8) | pc->buffer[pc->last_index + next];
pc->overread++;
}
#if 0
- if(pc->overread)
- {
+ if(pc->overread){
printf("overread %d, state:%X next:%d index:%d o_index:%d\n", pc->overread, pc->state, next, pc->index, pc->overread_index);
- printf("%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
+ printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
}
#endif
@@ -355,16 +329,15 @@ void ff_parse1_close(AVCodecParserContext *s)
/*************************/
int ff_mpeg4video_split(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
int i;
- uint32_t state = -1;
+ uint32_t state= -1;
- for(i = 0; i < buf_size; i++)
- {
- state = (state << 8) | buf[i];
+ for(i=0; i<buf_size; i++){
+ state= (state<<8) | buf[i];
if(state == 0x1B3 || state == 0x1B6)
- return i - 3;
+ return i-3;
}
return 0;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.h
index e6bade85f..200b13be5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/parser.h
@@ -25,8 +25,7 @@
#include "avcodec.h"
-typedef struct ParseContext
-{
+typedef struct ParseContext{
uint8_t *buffer;
int index;
int last_index;
@@ -41,10 +40,9 @@ typedef struct ParseContext
struct MpegEncContext;
-typedef struct ParseContext1
-{
+typedef struct ParseContext1{
ParseContext pc;
- /* XXX/FIXME PC1 vs. PC */
+/* XXX/FIXME PC1 vs. PC */
/* MPEG-2-specific */
AVRational frame_rate;
int progressive_sequence;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h
index e47b0ec6a..c02027857 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h
@@ -39,8 +39,7 @@
//#define ALIGNED_BITSTREAM_WRITER
/* buf and buf_end must be present and used by every alternative writer. */
-typedef struct PutBitContext
-{
+typedef struct PutBitContext {
#ifdef ALT_BITSTREAM_WRITER
uint8_t *buf, *buf_end;
int index;
@@ -60,23 +59,22 @@ typedef struct PutBitContext
*/
static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
{
- if(buffer_size < 0)
- {
+ if(buffer_size < 0) {
buffer_size = 0;
buffer = NULL;
}
- s->size_in_bits = 8 * buffer_size;
+ s->size_in_bits= 8*buffer_size;
s->buf = buffer;
s->buf_end = s->buf + buffer_size;
#ifdef ALT_BITSTREAM_WRITER
- s->index = 0;
- ((uint32_t*)(s->buf))[0] = 0;
+ s->index=0;
+ ((uint32_t*)(s->buf))[0]=0;
// memset(buffer, 0, buffer_size);
#else
s->buf_ptr = s->buf;
- s->bit_left = 32;
- s->bit_buf = 0;
+ s->bit_left=32;
+ s->bit_buf=0;
#endif
}
@@ -101,22 +99,21 @@ static inline void flush_put_bits(PutBitContext *s)
align_put_bits(s);
#else
#ifndef BITSTREAM_WRITER_LE
- s->bit_buf <<= s->bit_left;
+ s->bit_buf<<= s->bit_left;
#endif
- while(s->bit_left < 32)
- {
+ while (s->bit_left < 32) {
/* XXX: should test end of buffer */
#ifdef BITSTREAM_WRITER_LE
- *s->buf_ptr++ = s->bit_buf;
- s->bit_buf >>= 8;
+ *s->buf_ptr++=s->bit_buf;
+ s->bit_buf>>=8;
#else
- *s->buf_ptr++ = s->bit_buf >> 24;
- s->bit_buf <<= 8;
+ *s->buf_ptr++=s->bit_buf >> 24;
+ s->bit_buf<<=8;
#endif
- s->bit_left += 8;
+ s->bit_left+=8;
}
- s->bit_left = 32;
- s->bit_buf = 0;
+ s->bit_left=32;
+ s->bit_buf=0;
#endif
}
@@ -165,42 +162,34 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
/* XXX: optimize */
#ifdef BITSTREAM_WRITER_LE
bit_buf |= value << (32 - bit_left);
- if(n >= bit_left)
- {
+ if (n >= bit_left) {
#if !HAVE_FAST_UNALIGNED
- if(3 & (intptr_t) s->buf_ptr)
- {
+ if (3 & (intptr_t) s->buf_ptr) {
AV_WL32(s->buf_ptr, bit_buf);
- }
- else
+ } else
#endif
- *(uint32_t *)s->buf_ptr = le2me_32(bit_buf);
- s->buf_ptr += 4;
- bit_buf = (bit_left == 32) ? 0 : value >> bit_left;
- bit_left += 32;
+ *(uint32_t *)s->buf_ptr = le2me_32(bit_buf);
+ s->buf_ptr+=4;
+ bit_buf = (bit_left==32)?0:value >> bit_left;
+ bit_left+=32;
}
- bit_left -= n;
+ bit_left-=n;
#else
- if(n < bit_left)
- {
- bit_buf = (bit_buf << n) | value;
- bit_left -= n;
- }
- else
- {
- bit_buf <<= bit_left;
+ if (n < bit_left) {
+ bit_buf = (bit_buf<<n) | value;
+ bit_left-=n;
+ } else {
+ bit_buf<<=bit_left;
bit_buf |= value >> (n - bit_left);
#if !HAVE_FAST_UNALIGNED
- if(3 & (intptr_t) s->buf_ptr)
- {
+ if (3 & (intptr_t) s->buf_ptr) {
AV_WB32(s->buf_ptr, bit_buf);
- }
- else
+ } else
#endif
- *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
+ *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
//printf("bitbuf = %08x\n", bit_buf);
- s->buf_ptr += 4;
- bit_left += 32 - n;
+ s->buf_ptr+=4;
+ bit_left+=32 - n;
bit_buf = value;
}
#endif
@@ -225,49 +214,49 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
"bswapl %%eax \n\t"
"addl %3, %0 \n\t"
"movl %%eax, 4(%2, %%ecx) \n\t"
- : "=&r"(s->index), "=&r"(value)
- : "r"(s->buf), "r"(n), "0"(s->index), "1"(value<<(-n))
+ : "=&r" (s->index), "=&r" (value)
+ : "r" (s->buf), "r" (n), "0" (s->index), "1" (value<<(-n))
: "%eax", "%ecx"
);
# else
-int index = s->index;
-uint32_t *ptr = ((uint32_t *)s->buf) + (index >> 5);
+ int index= s->index;
+ uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5);
-value <<= 32 - n;
+ value<<= 32-n;
-ptr[0] |= be2me_32(value >> (index & 31));
-ptr[1] = be2me_32(value << (32 - (index & 31)));
+ ptr[0] |= be2me_32(value>>(index&31));
+ ptr[1] = be2me_32(value<<(32-(index&31)));
//if(n>24) printf("%d %d\n", n, value);
-index += n;
-s->index = index;
+ index+= n;
+ s->index= index;
# endif
# else //ALIGNED_BITSTREAM_WRITER
# if ARCH_X86
-__asm__ volatile(
- "movl $7, %%ecx \n\t"
- "andl %0, %%ecx \n\t"
- "addl %3, %%ecx \n\t"
- "negl %%ecx \n\t"
- "shll %%cl, %1 \n\t"
- "bswapl %1 \n\t"
- "movl %0, %%ecx \n\t"
- "shrl $3, %%ecx \n\t"
- "orl %1, (%%ecx, %2) \n\t"
- "addl %3, %0 \n\t"
- "movl $0, 4(%%ecx, %2) \n\t"
- : "=&r"(s->index), "=&r"(value)
- : "r"(s->buf), "r"(n), "0"(s->index), "1"(value)
- : "%ecx"
-);
+ __asm__ volatile(
+ "movl $7, %%ecx \n\t"
+ "andl %0, %%ecx \n\t"
+ "addl %3, %%ecx \n\t"
+ "negl %%ecx \n\t"
+ "shll %%cl, %1 \n\t"
+ "bswapl %1 \n\t"
+ "movl %0, %%ecx \n\t"
+ "shrl $3, %%ecx \n\t"
+ "orl %1, (%%ecx, %2) \n\t"
+ "addl %3, %0 \n\t"
+ "movl $0, 4(%%ecx, %2) \n\t"
+ : "=&r" (s->index), "=&r" (value)
+ : "r" (s->buf), "r" (n), "0" (s->index), "1" (value)
+ : "%ecx"
+ );
# else
-int index = s->index;
-uint32_t *ptr = (uint32_t*)(((uint8_t *)s->buf) + (index >> 3));
+ int index= s->index;
+ uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3));
-ptr[0] |= be2me_32(value << (32 - n - (index & 7)));
-ptr[1] = 0;
+ ptr[0] |= be2me_32(value<<(32-n-(index&7) ));
+ ptr[1] = 0;
//if(n>24) printf("%d %d\n", n, value);
-index += n;
-s->index = index;
+ index+= n;
+ s->index= index;
# endif
# endif //!ALIGNED_BITSTREAM_WRITER
}
@@ -277,7 +266,7 @@ static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
{
assert(n >= 0 && n <= 31);
- put_bits(pb, n, value & ((1 << n) - 1));
+ put_bits(pb, n, value & ((1<<n)-1));
}
/**
@@ -303,9 +292,9 @@ static void av_unused put_bits32(PutBitContext *s, uint32_t value)
static inline uint8_t* put_bits_ptr(PutBitContext *s)
{
#ifdef ALT_BITSTREAM_WRITER
- return s->buf + (s->index >> 3);
+ return s->buf + (s->index>>3);
#else
- return s->buf_ptr;
+ return s->buf_ptr;
#endif
}
@@ -315,13 +304,13 @@ static inline uint8_t* put_bits_ptr(PutBitContext *s)
*/
static inline void skip_put_bytes(PutBitContext *s, int n)
{
- assert((put_bits_count(s) & 7) == 0);
+ assert((put_bits_count(s)&7)==0);
#ifdef ALT_BITSTREAM_WRITER
- FIXME may need some cleaning of the buffer
- s->index += n << 3;
+ FIXME may need some cleaning of the buffer
+ s->index += n<<3;
#else
- assert(s->bit_left == 32);
- s->buf_ptr += n;
+ assert(s->bit_left==32);
+ s->buf_ptr += n;
#endif
}
@@ -336,7 +325,7 @@ static inline void skip_put_bits(PutBitContext *s, int n)
s->index += n;
#else
s->bit_left -= n;
- s->buf_ptr -= 4 * (s->bit_left >> 5);
+ s->buf_ptr-= 4*(s->bit_left>>5);
s->bit_left &= 31;
#endif
}
@@ -348,7 +337,7 @@ static inline void skip_put_bits(PutBitContext *s, int n)
*/
static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
{
- s->buf_end = s->buf + size;
+ s->buf_end= s->buf + size;
}
#endif /* AVCODEC_PUT_BITS_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rangecoder.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rangecoder.h
index 149a5cec3..f5ce3684f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rangecoder.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rangecoder.h
@@ -31,8 +31,7 @@
#include <assert.h>
#include "libavutil/common.h"
-typedef struct RangeCoder
-{
+typedef struct RangeCoder{
int low;
int range;
int outstanding_count;
@@ -42,120 +41,100 @@ typedef struct RangeCoder
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)
-{
+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)
- {
+ 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;
+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
- {
+ *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+= 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
- {
+ }else{
c->low -= c->range;
- *state = c->one_state[*state];
+ *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->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/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ratecontrol.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ratecontrol.h
index 5bc816677..9a070e997 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ratecontrol.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ratecontrol.h
@@ -32,16 +32,14 @@
#include <stdint.h>
#include "eval.h"
-typedef struct Predictor
-{
+typedef struct Predictor{
double coeff;
double count;
double decay;
} Predictor;
-typedef struct RateControlEntry
-{
- int rcOverrideIndex1, rcOverrideQscale; //Milan Cutka - don't obey qmin/qmax in RcOverride sections
+typedef struct RateControlEntry{
+ int rcOverrideIndex1,rcOverrideQscale; //Milan Cutka - don't obey qmin/qmax in RcOverride sections
int pict_type;
float qscale;
int mv_bits;
@@ -58,13 +56,12 @@ typedef struct RateControlEntry
int skip_count;
int f_code;
int b_code;
-} RateControlEntry;
+}RateControlEntry;
/**
* rate control context.
*/
-typedef struct RateControlContext
-{
+typedef struct RateControlContext{
FILE *stats_file;
int num_entries; ///< number of RateControlEntries
RateControlEntry *entry;
@@ -89,7 +86,7 @@ typedef struct RateControlContext
float dry_run_qscale; ///< for xvid rc
int last_picture_number; ///< for xvid rc
AVEvalExpr * rc_eq_eval;
-} RateControlContext;
+}RateControlContext;
struct MpegEncContext;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rectangle.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rectangle.h
index d7969fa57..f0574261e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rectangle.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rectangle.h
@@ -39,97 +39,86 @@
* @param w width of the rectangle, should be a constant
* @param size the size of val (1 or 4), should be a constant
*/
-static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size)
-{
- uint8_t *p = (uint8_t*)vp;
- assert(size == 1 || size == 4);
- assert(w <= 4);
+static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){
+ uint8_t *p= (uint8_t*)vp;
+ assert(size==1 || size==4);
+ assert(w<=4);
w *= size;
stride *= size;
- assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN) - 1)) == 0);
- assert((stride&(w - 1)) == 0);
- if(w == 2)
- {
- const uint16_t v = size == 4 ? val : val * 0x0101;
- *(uint16_t*)(p + 0 * stride) = v;
- if(h == 1) return;
- *(uint16_t*)(p + 1 * stride) = v;
- if(h == 2) return;
- *(uint16_t*)(p + 2 * stride) = v;
- *(uint16_t*)(p + 3 * stride) = v;
- }
- else if(w == 4)
- {
- const uint32_t v = size == 4 ? val : val * 0x01010101;
- *(uint32_t*)(p + 0 * stride) = v;
- if(h == 1) return;
- *(uint32_t*)(p + 1 * stride) = v;
- if(h == 2) return;
- *(uint32_t*)(p + 2 * stride) = v;
- *(uint32_t*)(p + 3 * stride) = v;
- }
- else if(w == 8)
- {
- //gcc can't optimize 64bit math on x86_32
+ assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0);
+ assert((stride&(w-1))==0);
+ if(w==2){
+ const uint16_t v= size==4 ? val : val*0x0101;
+ *(uint16_t*)(p + 0*stride)= v;
+ if(h==1) return;
+ *(uint16_t*)(p + 1*stride)= v;
+ if(h==2) return;
+ *(uint16_t*)(p + 2*stride)= v;
+ *(uint16_t*)(p + 3*stride)= v;
+ }else if(w==4){
+ const uint32_t v= size==4 ? val : val*0x01010101;
+ *(uint32_t*)(p + 0*stride)= v;
+ if(h==1) return;
+ *(uint32_t*)(p + 1*stride)= v;
+ if(h==2) return;
+ *(uint32_t*)(p + 2*stride)= v;
+ *(uint32_t*)(p + 3*stride)= v;
+ }else if(w==8){
+ //gcc can't optimize 64bit math on x86_32
#if HAVE_FAST_64BIT
- const uint64_t v = val * 0x0100000001ULL;
- *(uint64_t*)(p + 0 * stride) = v;
- if(h == 1) return;
- *(uint64_t*)(p + 1 * stride) = v;
- if(h == 2) return;
- *(uint64_t*)(p + 2 * stride) = v;
- *(uint64_t*)(p + 3 * stride) = v;
- }
- else if(w == 16)
- {
- const uint64_t v = val * 0x0100000001ULL;
- *(uint64_t*)(p + 0 + 0 * stride) = v;
- *(uint64_t*)(p + 8 + 0 * stride) = v;
- *(uint64_t*)(p + 0 + 1 * stride) = v;
- *(uint64_t*)(p + 8 + 1 * stride) = v;
- if(h == 2) return;
- *(uint64_t*)(p + 0 + 2 * stride) = v;
- *(uint64_t*)(p + 8 + 2 * stride) = v;
- *(uint64_t*)(p + 0 + 3 * stride) = v;
- *(uint64_t*)(p + 8 + 3 * stride) = v;
+ const uint64_t v= val*0x0100000001ULL;
+ *(uint64_t*)(p + 0*stride)= v;
+ if(h==1) return;
+ *(uint64_t*)(p + 1*stride)= v;
+ if(h==2) return;
+ *(uint64_t*)(p + 2*stride)= v;
+ *(uint64_t*)(p + 3*stride)= v;
+ }else if(w==16){
+ const uint64_t v= val*0x0100000001ULL;
+ *(uint64_t*)(p + 0+0*stride)= v;
+ *(uint64_t*)(p + 8+0*stride)= v;
+ *(uint64_t*)(p + 0+1*stride)= v;
+ *(uint64_t*)(p + 8+1*stride)= v;
+ if(h==2) return;
+ *(uint64_t*)(p + 0+2*stride)= v;
+ *(uint64_t*)(p + 8+2*stride)= v;
+ *(uint64_t*)(p + 0+3*stride)= v;
+ *(uint64_t*)(p + 8+3*stride)= v;
#else
- *(uint32_t*)(p + 0 + 0 * stride) = val;
- *(uint32_t*)(p + 4 + 0 * stride) = val;
- if(h == 1) return;
- *(uint32_t*)(p + 0 + 1 * stride) = val;
- *(uint32_t*)(p + 4 + 1 * stride) = val;
- if(h == 2) return;
- *(uint32_t*)(p + 0 + 2 * stride) = val;
- *(uint32_t*)(p + 4 + 2 * stride) = val;
- *(uint32_t*)(p + 0 + 3 * stride) = val;
- *(uint32_t*)(p + 4 + 3 * stride) = val;
- }
- else if(w == 16)
- {
- *(uint32_t*)(p + 0 + 0 * stride) = val;
- *(uint32_t*)(p + 4 + 0 * stride) = val;
- *(uint32_t*)(p + 8 + 0 * stride) = val;
- *(uint32_t*)(p + 12 + 0 * stride) = val;
- *(uint32_t*)(p + 0 + 1 * stride) = val;
- *(uint32_t*)(p + 4 + 1 * stride) = val;
- *(uint32_t*)(p + 8 + 1 * stride) = val;
- *(uint32_t*)(p + 12 + 1 * stride) = val;
- if(h == 2) return;
- *(uint32_t*)(p + 0 + 2 * stride) = val;
- *(uint32_t*)(p + 4 + 2 * stride) = val;
- *(uint32_t*)(p + 8 + 2 * stride) = val;
- *(uint32_t*)(p + 12 + 2 * stride) = val;
- *(uint32_t*)(p + 0 + 3 * stride) = val;
- *(uint32_t*)(p + 4 + 3 * stride) = val;
- *(uint32_t*)(p + 8 + 3 * stride) = val;
- *(uint32_t*)(p + 12 + 3 * stride) = val;
+ *(uint32_t*)(p + 0+0*stride)= val;
+ *(uint32_t*)(p + 4+0*stride)= val;
+ if(h==1) return;
+ *(uint32_t*)(p + 0+1*stride)= val;
+ *(uint32_t*)(p + 4+1*stride)= val;
+ if(h==2) return;
+ *(uint32_t*)(p + 0+2*stride)= val;
+ *(uint32_t*)(p + 4+2*stride)= val;
+ *(uint32_t*)(p + 0+3*stride)= val;
+ *(uint32_t*)(p + 4+3*stride)= val;
+ }else if(w==16){
+ *(uint32_t*)(p + 0+0*stride)= val;
+ *(uint32_t*)(p + 4+0*stride)= val;
+ *(uint32_t*)(p + 8+0*stride)= val;
+ *(uint32_t*)(p +12+0*stride)= val;
+ *(uint32_t*)(p + 0+1*stride)= val;
+ *(uint32_t*)(p + 4+1*stride)= val;
+ *(uint32_t*)(p + 8+1*stride)= val;
+ *(uint32_t*)(p +12+1*stride)= val;
+ if(h==2) return;
+ *(uint32_t*)(p + 0+2*stride)= val;
+ *(uint32_t*)(p + 4+2*stride)= val;
+ *(uint32_t*)(p + 8+2*stride)= val;
+ *(uint32_t*)(p +12+2*stride)= val;
+ *(uint32_t*)(p + 0+3*stride)= val;
+ *(uint32_t*)(p + 4+3*stride)= val;
+ *(uint32_t*)(p + 8+3*stride)= val;
+ *(uint32_t*)(p +12+3*stride)= val;
#endif
- }
- else
+ }else
assert(0);
- assert(h == 4);
+ assert(h==4);
}
#endif /* AVCODEC_RECTANGLE_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rl.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rl.h
index 2f8de5a61..773d96e49 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rl.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rl.h
@@ -35,8 +35,7 @@
#define MAX_LEVEL 64
/** RLTable. */
-typedef struct RLTable
-{
+typedef struct RLTable {
int n; ///< number of entries of table_vlc minus 1
int last; ///< number of values for last = 0
const uint16_t (*table_vlc)[2];
@@ -77,9 +76,9 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
{
int index;
index = rl->index_run[last][run];
- if(index >= rl->n)
+ if (index >= rl->n)
return rl->n;
- if(level > rl->max_level[last][run])
+ if (level > rl->max_level[last][run])
return rl->n;
return index + level - 1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv10.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv10.c
index e35e4e4b5..11397049b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv10.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv10.c
@@ -36,146 +36,146 @@
static const uint16_t rv_lum_code[256] =
{
- 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
- 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
- 0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16,
- 0x0f17, 0x0f18, 0x0f19, 0x0f1a, 0x0f1b, 0x0f1c, 0x0f1d, 0x0f1e,
- 0x0f1f, 0x0f20, 0x0f21, 0x0f22, 0x0f23, 0x0f24, 0x0f25, 0x0f26,
- 0x0f27, 0x0f28, 0x0f29, 0x0f2a, 0x0f2b, 0x0f2c, 0x0f2d, 0x0f2e,
- 0x0f2f, 0x0f30, 0x0f31, 0x0f32, 0x0f33, 0x0f34, 0x0f35, 0x0f36,
- 0x0f37, 0x0f38, 0x0f39, 0x0f3a, 0x0f3b, 0x0f3c, 0x0f3d, 0x0f3e,
- 0x0f3f, 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0386,
- 0x0387, 0x0388, 0x0389, 0x038a, 0x038b, 0x038c, 0x038d, 0x038e,
- 0x038f, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396,
- 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e,
- 0x039f, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6,
- 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce,
- 0x00cf, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056,
- 0x0057, 0x0020, 0x0021, 0x0022, 0x0023, 0x000c, 0x000d, 0x0004,
- 0x0000, 0x0005, 0x000e, 0x000f, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
- 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
- 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7,
- 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
- 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
- 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
- 0x0f40, 0x0f41, 0x0f42, 0x0f43, 0x0f44, 0x0f45, 0x0f46, 0x0f47,
- 0x0f48, 0x0f49, 0x0f4a, 0x0f4b, 0x0f4c, 0x0f4d, 0x0f4e, 0x0f4f,
- 0x0f50, 0x0f51, 0x0f52, 0x0f53, 0x0f54, 0x0f55, 0x0f56, 0x0f57,
- 0x0f58, 0x0f59, 0x0f5a, 0x0f5b, 0x0f5c, 0x0f5d, 0x0f5e, 0x0f5f,
- 0x0f60, 0x0f61, 0x0f62, 0x0f63, 0x0f64, 0x0f65, 0x0f66, 0x0f67,
- 0x0f68, 0x0f69, 0x0f6a, 0x0f6b, 0x0f6c, 0x0f6d, 0x0f6e, 0x0f6f,
- 0x0f70, 0x0f71, 0x0f72, 0x0f73, 0x0f74, 0x0f75, 0x0f76, 0x0f77,
- 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
+ 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
+ 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
+ 0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16,
+ 0x0f17, 0x0f18, 0x0f19, 0x0f1a, 0x0f1b, 0x0f1c, 0x0f1d, 0x0f1e,
+ 0x0f1f, 0x0f20, 0x0f21, 0x0f22, 0x0f23, 0x0f24, 0x0f25, 0x0f26,
+ 0x0f27, 0x0f28, 0x0f29, 0x0f2a, 0x0f2b, 0x0f2c, 0x0f2d, 0x0f2e,
+ 0x0f2f, 0x0f30, 0x0f31, 0x0f32, 0x0f33, 0x0f34, 0x0f35, 0x0f36,
+ 0x0f37, 0x0f38, 0x0f39, 0x0f3a, 0x0f3b, 0x0f3c, 0x0f3d, 0x0f3e,
+ 0x0f3f, 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0386,
+ 0x0387, 0x0388, 0x0389, 0x038a, 0x038b, 0x038c, 0x038d, 0x038e,
+ 0x038f, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396,
+ 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e,
+ 0x039f, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6,
+ 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce,
+ 0x00cf, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056,
+ 0x0057, 0x0020, 0x0021, 0x0022, 0x0023, 0x000c, 0x000d, 0x0004,
+ 0x0000, 0x0005, 0x000e, 0x000f, 0x0024, 0x0025, 0x0026, 0x0027,
+ 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
+ 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
+ 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7,
+ 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
+ 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
+ 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
+ 0x0f40, 0x0f41, 0x0f42, 0x0f43, 0x0f44, 0x0f45, 0x0f46, 0x0f47,
+ 0x0f48, 0x0f49, 0x0f4a, 0x0f4b, 0x0f4c, 0x0f4d, 0x0f4e, 0x0f4f,
+ 0x0f50, 0x0f51, 0x0f52, 0x0f53, 0x0f54, 0x0f55, 0x0f56, 0x0f57,
+ 0x0f58, 0x0f59, 0x0f5a, 0x0f5b, 0x0f5c, 0x0f5d, 0x0f5e, 0x0f5f,
+ 0x0f60, 0x0f61, 0x0f62, 0x0f63, 0x0f64, 0x0f65, 0x0f66, 0x0f67,
+ 0x0f68, 0x0f69, 0x0f6a, 0x0f6b, 0x0f6c, 0x0f6d, 0x0f6e, 0x0f6f,
+ 0x0f70, 0x0f71, 0x0f72, 0x0f73, 0x0f74, 0x0f75, 0x0f76, 0x0f77,
+ 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
};
static const uint8_t rv_lum_bits[256] =
{
- 14, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 7, 7, 7, 7, 7, 7, 7,
- 7, 6, 6, 6, 6, 5, 5, 4,
- 2, 4, 5, 5, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
+ 14, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 7, 7, 7, 7, 7, 7, 7,
+ 7, 6, 6, 6, 6, 5, 5, 4,
+ 2, 4, 5, 5, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
};
static const uint16_t rv_chrom_code[256] =
{
- 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
- 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
- 0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16,
- 0x3f17, 0x3f18, 0x3f19, 0x3f1a, 0x3f1b, 0x3f1c, 0x3f1d, 0x3f1e,
- 0x3f1f, 0x3f20, 0x3f21, 0x3f22, 0x3f23, 0x3f24, 0x3f25, 0x3f26,
- 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, 0x3f2d, 0x3f2e,
- 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, 0x3f35, 0x3f36,
- 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, 0x3f3d, 0x3f3e,
- 0x3f3f, 0x0f80, 0x0f81, 0x0f82, 0x0f83, 0x0f84, 0x0f85, 0x0f86,
- 0x0f87, 0x0f88, 0x0f89, 0x0f8a, 0x0f8b, 0x0f8c, 0x0f8d, 0x0f8e,
- 0x0f8f, 0x0f90, 0x0f91, 0x0f92, 0x0f93, 0x0f94, 0x0f95, 0x0f96,
- 0x0f97, 0x0f98, 0x0f99, 0x0f9a, 0x0f9b, 0x0f9c, 0x0f9d, 0x0f9e,
- 0x0f9f, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6,
- 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce,
- 0x03cf, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6,
- 0x00e7, 0x0030, 0x0031, 0x0032, 0x0033, 0x0008, 0x0009, 0x0002,
- 0x0000, 0x0003, 0x000a, 0x000b, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- 0x03d0, 0x03d1, 0x03d2, 0x03d3, 0x03d4, 0x03d5, 0x03d6, 0x03d7,
- 0x03d8, 0x03d9, 0x03da, 0x03db, 0x03dc, 0x03dd, 0x03de, 0x03df,
- 0x0fa0, 0x0fa1, 0x0fa2, 0x0fa3, 0x0fa4, 0x0fa5, 0x0fa6, 0x0fa7,
- 0x0fa8, 0x0fa9, 0x0faa, 0x0fab, 0x0fac, 0x0fad, 0x0fae, 0x0faf,
- 0x0fb0, 0x0fb1, 0x0fb2, 0x0fb3, 0x0fb4, 0x0fb5, 0x0fb6, 0x0fb7,
- 0x0fb8, 0x0fb9, 0x0fba, 0x0fbb, 0x0fbc, 0x0fbd, 0x0fbe, 0x0fbf,
- 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, 0x3f45, 0x3f46, 0x3f47,
- 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, 0x3f4d, 0x3f4e, 0x3f4f,
- 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, 0x3f55, 0x3f56, 0x3f57,
- 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, 0x3f5d, 0x3f5e, 0x3f5f,
- 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, 0x3f65, 0x3f66, 0x3f67,
- 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f,
- 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77,
- 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
+ 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
+ 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
+ 0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16,
+ 0x3f17, 0x3f18, 0x3f19, 0x3f1a, 0x3f1b, 0x3f1c, 0x3f1d, 0x3f1e,
+ 0x3f1f, 0x3f20, 0x3f21, 0x3f22, 0x3f23, 0x3f24, 0x3f25, 0x3f26,
+ 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, 0x3f2d, 0x3f2e,
+ 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, 0x3f35, 0x3f36,
+ 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, 0x3f3d, 0x3f3e,
+ 0x3f3f, 0x0f80, 0x0f81, 0x0f82, 0x0f83, 0x0f84, 0x0f85, 0x0f86,
+ 0x0f87, 0x0f88, 0x0f89, 0x0f8a, 0x0f8b, 0x0f8c, 0x0f8d, 0x0f8e,
+ 0x0f8f, 0x0f90, 0x0f91, 0x0f92, 0x0f93, 0x0f94, 0x0f95, 0x0f96,
+ 0x0f97, 0x0f98, 0x0f99, 0x0f9a, 0x0f9b, 0x0f9c, 0x0f9d, 0x0f9e,
+ 0x0f9f, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6,
+ 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce,
+ 0x03cf, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6,
+ 0x00e7, 0x0030, 0x0031, 0x0032, 0x0033, 0x0008, 0x0009, 0x0002,
+ 0x0000, 0x0003, 0x000a, 0x000b, 0x0034, 0x0035, 0x0036, 0x0037,
+ 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
+ 0x03d0, 0x03d1, 0x03d2, 0x03d3, 0x03d4, 0x03d5, 0x03d6, 0x03d7,
+ 0x03d8, 0x03d9, 0x03da, 0x03db, 0x03dc, 0x03dd, 0x03de, 0x03df,
+ 0x0fa0, 0x0fa1, 0x0fa2, 0x0fa3, 0x0fa4, 0x0fa5, 0x0fa6, 0x0fa7,
+ 0x0fa8, 0x0fa9, 0x0faa, 0x0fab, 0x0fac, 0x0fad, 0x0fae, 0x0faf,
+ 0x0fb0, 0x0fb1, 0x0fb2, 0x0fb3, 0x0fb4, 0x0fb5, 0x0fb6, 0x0fb7,
+ 0x0fb8, 0x0fb9, 0x0fba, 0x0fbb, 0x0fbc, 0x0fbd, 0x0fbe, 0x0fbf,
+ 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, 0x3f45, 0x3f46, 0x3f47,
+ 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, 0x3f4d, 0x3f4e, 0x3f4f,
+ 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, 0x3f55, 0x3f56, 0x3f57,
+ 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, 0x3f5d, 0x3f5e, 0x3f5f,
+ 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, 0x3f65, 0x3f66, 0x3f67,
+ 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f,
+ 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77,
+ 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
};
static const uint8_t rv_chrom_bits[256] =
{
- 16, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 8, 8, 8, 8, 8, 8, 8,
- 8, 6, 6, 6, 6, 4, 4, 3,
- 2, 3, 4, 4, 6, 6, 6, 6,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
+ 16, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 8, 8, 8, 8, 8, 8, 8,
+ 8, 6, 6, 6, 6, 4, 4, 3,
+ 2, 3, 4, 4, 6, 6, 6, 6,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
};
static VLC rv_dc_lum, rv_dc_chrom;
@@ -184,69 +184,46 @@ int rv_decode_dc(MpegEncContext *s, int n)
{
int code;
- if(n < 4)
- {
+ if (n < 4) {
code = get_vlc2(&s->gb, rv_dc_lum.table, DC_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0) {
/* XXX: I don't understand why they use LONGER codes than
necessary. The following code would be completely useless
if they had thought about it !!! */
code = get_bits(&s->gb, 7);
- if(code == 0x7c)
- {
+ if (code == 0x7c) {
code = (int8_t)(get_bits(&s->gb, 7) + 1);
- }
- else if(code == 0x7d)
- {
+ } else if (code == 0x7d) {
code = -128 + get_bits(&s->gb, 7);
- }
- else if(code == 0x7e)
- {
- if(get_bits1(&s->gb) == 0)
+ } else if (code == 0x7e) {
+ if (get_bits1(&s->gb) == 0)
code = (int8_t)(get_bits(&s->gb, 8) + 1);
else
code = (int8_t)(get_bits(&s->gb, 8));
- }
- else if(code == 0x7f)
- {
+ } else if (code == 0x7f) {
skip_bits(&s->gb, 11);
code = 1;
}
- }
- else
- {
+ } else {
code -= 128;
}
- }
- else
- {
+ } else {
code = get_vlc2(&s->gb, rv_dc_chrom.table, DC_VLC_BITS, 2);
/* same remark */
- if(code < 0)
- {
+ if (code < 0) {
code = get_bits(&s->gb, 9);
- if(code == 0x1fc)
- {
+ if (code == 0x1fc) {
code = (int8_t)(get_bits(&s->gb, 7) + 1);
- }
- else if(code == 0x1fd)
- {
+ } else if (code == 0x1fd) {
code = -128 + get_bits(&s->gb, 7);
- }
- else if(code == 0x1fe)
- {
+ } else if (code == 0x1fe) {
skip_bits(&s->gb, 9);
code = 1;
- }
- else
- {
+ } else {
av_log(s->avctx, AV_LOG_ERROR, "chroma dc error\n");
return 0xffff;
}
- }
- else
- {
+ } else {
code -= 128;
}
}
@@ -260,7 +237,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
marker = get_bits1(&s->gb);
- if(get_bits1(&s->gb))
+ if (get_bits1(&s->gb))
s->pict_type = FF_P_TYPE;
else
s->pict_type = FF_I_TYPE;
@@ -269,23 +246,19 @@ static int rv10_decode_picture_header(MpegEncContext *s)
dprintf(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
- if(pb_frame)
- {
+ if (pb_frame){
av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n");
return -1;
}
s->qscale = get_bits(&s->gb, 5);
- if(s->qscale == 0)
- {
+ if(s->qscale==0){
av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
return -1;
}
- if(s->pict_type == FF_I_TYPE)
- {
- if(s->rv10_version == 3)
- {
+ if (s->pict_type == FF_I_TYPE) {
+ if (s->rv10_version == 3) {
/* specific MPEG like DC coding not used */
s->last_dc[0] = get_bits(&s->gb, 8);
s->last_dc[1] = get_bits(&s->gb, 8);
@@ -297,20 +270,17 @@ static int rv10_decode_picture_header(MpegEncContext *s)
/* if multiple packets per frame are sent, the position at which
to display the macroblocks is coded here */
- mb_xy = s->mb_x + s->mb_y * s->mb_width;
- if(show_bits(&s->gb, 12) == 0 || (mb_xy && mb_xy < s->mb_num))
- {
+ mb_xy= s->mb_x + s->mb_y*s->mb_width;
+ if(show_bits(&s->gb, 12)==0 || (mb_xy && mb_xy < s->mb_num)){
s->mb_x = get_bits(&s->gb, 6); /* mb_x */
s->mb_y = get_bits(&s->gb, 6); /* mb_y */
mb_count = get_bits(&s->gb, 12);
- }
- else
- {
+ } else {
s->mb_x = 0;
s->mb_y = 0;
mb_count = s->mb_width * s->mb_height;
}
- unk = get_bits(&s->gb, 3); /* ignored */
+ unk= get_bits(&s->gb, 3); /* ignored */
s->f_code = 1;
s->unrestricted_mv = 1;
@@ -322,151 +292,119 @@ static int rv20_decode_picture_header(MpegEncContext *s)
int seq, mb_pos, i;
#if 0
- GetBitContext gb = s->gb;
- for(i = 0; i < 64; i++)
- {
+ GetBitContext gb= s->gb;
+ for(i=0; i<64; i++){
av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb));
- if(i % 4 == 3) av_log(s->avctx, AV_LOG_DEBUG, " ");
+ if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
}
av_log(s->avctx, AV_LOG_DEBUG, "\n");
#endif
#if 0
- av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width / 4, s->height / 4);
- for(i = 0; i < s->avctx->extradata_size; i++)
- {
+ av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4);
+ for(i=0; i<s->avctx->extradata_size; i++){
av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]);
- if(i % 4 == 3) av_log(s->avctx, AV_LOG_DEBUG, " ");
+ if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
}
av_log(s->avctx, AV_LOG_DEBUG, "\n");
#endif
- if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002)
- {
- if(get_bits(&s->gb, 3))
- {
+ if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){
+ if (get_bits(&s->gb, 3)){
av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n");
return -1;
}
}
- i = get_bits(&s->gb, 2);
- switch(i)
- {
- case 0:
- s->pict_type = FF_I_TYPE;
- break;
- case 1:
- s->pict_type = FF_I_TYPE;
- break; //hmm ...
- case 2:
- s->pict_type = FF_P_TYPE;
- break;
- case 3:
- s->pict_type = FF_B_TYPE;
- break;
+ i= get_bits(&s->gb, 2);
+ switch(i){
+ case 0: s->pict_type= FF_I_TYPE; break;
+ case 1: s->pict_type= FF_I_TYPE; break; //hmm ...
+ case 2: s->pict_type= FF_P_TYPE; break;
+ case 3: s->pict_type= FF_B_TYPE; break;
default:
av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n");
return -1;
}
- if(s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
- {
+ if(s->last_picture_ptr==NULL && s->pict_type==FF_B_TYPE){
av_log(s->avctx, AV_LOG_ERROR, "early B pix\n");
return -1;
}
- if(get_bits1(&s->gb))
- {
+ if (get_bits1(&s->gb)){
av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n");
return -1;
}
s->qscale = get_bits(&s->gb, 5);
- if(s->qscale == 0)
- {
+ if(s->qscale==0){
av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
return -1;
}
- if(s->avctx->sub_id == 0x30203002)
- {
- if(get_bits1(&s->gb))
- {
+ if(s->avctx->sub_id == 0x30203002){
+ if (get_bits1(&s->gb)){
av_log(s->avctx, AV_LOG_ERROR, "unknown bit2 set\n");
return -1;
}
}
- if(s->avctx->has_b_frames)
- {
+ if(s->avctx->has_b_frames){
int f, new_w, new_h;
- int v = s->avctx->extradata_size >= 4 ? 7 & ((uint8_t*)s->avctx->extradata)[1] : 0;
+ int v= s->avctx->extradata_size >= 4 ? 7&((uint8_t*)s->avctx->extradata)[1] : 0;
- if(get_bits1(&s->gb))
- {
+ if (get_bits1(&s->gb)){
av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n");
}
- seq = get_bits(&s->gb, 13) << 2;
+ seq= get_bits(&s->gb, 13)<<2;
- f = get_bits(&s->gb, av_log2(v) + 1);
+ f= get_bits(&s->gb, av_log2(v)+1);
- if(f)
- {
- new_w = 4 * ((uint8_t*)s->avctx->extradata)[6+2*f];
- new_h = 4 * ((uint8_t*)s->avctx->extradata)[7+2*f];
+ if(f){
+ new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f];
+ new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f];
+ }else{
+ new_w= s->orig_width ;
+ new_h= s->orig_height;
}
- else
- {
- new_w = s->orig_width ;
- new_h = s->orig_height;
- }
- if(new_w != s->width || new_h != s->height)
- {
+ if(new_w != s->width || new_h != s->height){
av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);
- if(avcodec_check_dimensions(s->avctx, new_w, new_h) < 0)
+ if (avcodec_check_dimensions(s->avctx, new_w, new_h) < 0)
return -1;
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 (MPV_common_init(s) < 0)
return -1;
}
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ if(s->avctx->debug & FF_DEBUG_PICT_INFO){
av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, v);
}
- }
- else
- {
- seq = get_bits(&s->gb, 8) * 128;
+ }else{
+ seq= get_bits(&s->gb, 8)*128;
}
// if(s->avctx->sub_id <= 0x20201002){ //0x20201002 definitely needs this
- mb_pos = ff_h263_decode_mba(s);
- /* }else{
- mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1);
- s->mb_x= mb_pos % s->mb_width;
- s->mb_y= mb_pos / s->mb_width;
- }*/
+ mb_pos= ff_h263_decode_mba(s);
+/* }else{
+ mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1);
+ s->mb_x= mb_pos % s->mb_width;
+ s->mb_y= mb_pos / s->mb_width;
+ }*/
//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;
- if(seq != s->time)
- {
- if(s->pict_type != FF_B_TYPE)
- {
- s->time = seq;
- s->pp_time = s->time - s->last_non_b_time;
- s->last_non_b_time = s->time;
- }
- else
- {
- s->time = seq;
- 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)
- {
+ if(seq != s->time){
+ if(s->pict_type!=FF_B_TYPE){
+ s->time= seq;
+ s->pp_time= s->time - s->last_non_b_time;
+ s->last_non_b_time= s->time;
+ }else{
+ s->time= seq;
+ 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){
av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n");
return FRAME_SKIPPED;
}
@@ -474,118 +412,100 @@ static int rv20_decode_picture_header(MpegEncContext *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);
+/*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);
s->f_code = 1;
s->unrestricted_mv = 1;
- s->h263_aic = s->pict_type == FF_I_TYPE;
+ s->h263_aic= s->pict_type == FF_I_TYPE;
// s->alt_inter_vlc=1;
// s->obmc=1;
// s->umvplus=1;
- s->modified_quant = 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",
- seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding);
+ 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",
+ seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding);
}
assert(s->pict_type != FF_B_TYPE || !s->low_delay);
- return s->mb_width * s->mb_height - mb_pos;
+ return s->mb_width*s->mb_height - mb_pos;
}
static av_cold int rv10_decode_init(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
- static int done = 0;
+ static int done=0;
- if(avctx->extradata_size < 8)
- {
+ if (avctx->extradata_size < 8) {
av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
return -1;
}
MPV_decode_defaults(s);
- s->avctx = avctx;
+ s->avctx= avctx;
s->out_format = FMT_H263;
- s->codec_id = avctx->codec_id;
+ s->codec_id= avctx->codec_id;
s->orig_width = s->width = avctx->coded_width;
- 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);
-
- if(avctx->sub_id == 0x10000000)
- {
- s->rv10_version = 0;
- s->low_delay = 1;
- }
- else if(avctx->sub_id == 0x10001000)
- {
- s->rv10_version = 3;
- s->low_delay = 1;
- }
- else if(avctx->sub_id == 0x10002000)
- {
- s->rv10_version = 3;
- s->low_delay = 1;
- s->obmc = 1;
- }
- else if(avctx->sub_id == 0x10003000)
- {
- s->rv10_version = 3;
- s->low_delay = 1;
- }
- else if(avctx->sub_id == 0x10003001)
- {
- s->rv10_version = 3;
- s->low_delay = 1;
- }
- else if(avctx->sub_id == 0x20001000
- || (avctx->sub_id >= 0x20100000 && avctx->sub_id < 0x201a0000))
- {
- s->low_delay = 1;
- }
- else if(avctx->sub_id == 0x30202002
- || avctx->sub_id == 0x30203002
- || (avctx->sub_id >= 0x20200002 && avctx->sub_id < 0x20300000))
- {
- s->low_delay = 0;
- s->avctx->has_b_frames = 1;
- }
- else
+ 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);
+
+ if (avctx->sub_id == 0x10000000) {
+ s->rv10_version= 0;
+ s->low_delay=1;
+ } else if (avctx->sub_id == 0x10001000) {
+ s->rv10_version= 3;
+ s->low_delay=1;
+ } else if (avctx->sub_id == 0x10002000) {
+ s->rv10_version= 3;
+ s->low_delay=1;
+ s->obmc=1;
+ } else if (avctx->sub_id == 0x10003000) {
+ s->rv10_version= 3;
+ s->low_delay=1;
+ } else if (avctx->sub_id == 0x10003001) {
+ s->rv10_version= 3;
+ s->low_delay=1;
+ } else if ( avctx->sub_id == 0x20001000
+ || (avctx->sub_id >= 0x20100000 && avctx->sub_id < 0x201a0000)) {
+ s->low_delay=1;
+ } else if ( avctx->sub_id == 0x30202002
+ || avctx->sub_id == 0x30203002
+ || (avctx->sub_id >= 0x20200002 && avctx->sub_id < 0x20300000)) {
+ s->low_delay=0;
+ s->avctx->has_b_frames=1;
+ } else
av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
- if(avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ 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);
}
avctx->pix_fmt = PIX_FMT_YUV420P;
- if(MPV_common_init(s) < 0)
+ if (MPV_common_init(s) < 0)
return -1;
h263_decode_init_vlc(s);
/* init rv vlc */
- if(!done)
- {
+ if (!done) {
INIT_VLC_STATIC(&rv_dc_lum, DC_VLC_BITS, 256,
- rv_lum_bits, 1, 1,
- rv_lum_code, 2, 2, 16384);
+ rv_lum_bits, 1, 1,
+ rv_lum_code, 2, 2, 16384);
INIT_VLC_STATIC(&rv_dc_chrom, DC_VLC_BITS, 256,
- rv_chrom_bits, 1, 1,
- rv_chrom_code, 2, 2, 16388);
+ rv_chrom_bits, 1, 1,
+ rv_chrom_code, 2, 2, 16388);
done = 1;
}
@@ -601,43 +521,38 @@ static av_cold int rv10_decode_end(AVCodecContext *avctx)
}
static int rv10_decode_packet(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size, int buf_size2)
+ const uint8_t *buf, int buf_size, int buf_size2)
{
MpegEncContext *s = avctx->priv_data;
int mb_count, mb_pos, left, start_mb_x;
- init_get_bits(&s->gb, buf, buf_size * 8);
- if(s->codec_id == CODEC_ID_RV10)
+ init_get_bits(&s->gb, buf, buf_size*8);
+ if(s->codec_id ==CODEC_ID_RV10)
mb_count = rv10_decode_picture_header(s);
else
mb_count = rv20_decode_picture_header(s);
- if(mb_count < 0)
- {
+ if (mb_count < 0) {
av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
return -1;
}
- if(s->mb_x >= s->mb_width ||
- s->mb_y >= s->mb_height)
- {
+ if (s->mb_x >= s->mb_width ||
+ s->mb_y >= s->mb_height) {
av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_pos = s->mb_y * s->mb_width + s->mb_x;
left = s->mb_width * s->mb_height - mb_pos;
- if(mb_count > left)
- {
+ if (mb_count > left) {
av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
return -1;
}
- 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?
- {
+ 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);
- s->mb_x = s->mb_y = s->resync_mb_x = s->resync_mb_y = 0;
+ s->mb_x= s->mb_y = s->resync_mb_x = s->resync_mb_y= 0;
}
if(MPV_frame_start(s, avctx) < 0)
return -1;
@@ -647,64 +562,55 @@ static int rv10_decode_packet(AVCodecContext *avctx,
dprintf(avctx, "qscale=%d\n", s->qscale);
/* default quantization values */
- if(s->codec_id == CODEC_ID_RV10)
- {
- if(s->mb_y == 0) s->first_slice_line = 1;
- }
- else
- {
- s->first_slice_line = 1;
- s->resync_mb_x = s->mb_x;
- }
- start_mb_x = s->mb_x;
- s->resync_mb_y = s->mb_y;
- if(s->h263_aic)
- {
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_aic_dc_scale_table;
- }
- else
- {
- s->y_dc_scale_table =
- s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
+ if(s->codec_id== CODEC_ID_RV10){
+ if(s->mb_y==0) s->first_slice_line=1;
+ }else{
+ s->first_slice_line=1;
+ s->resync_mb_x= s->mb_x;
+ }
+ start_mb_x= s->mb_x;
+ s->resync_mb_y= s->mb_y;
+ if(s->h263_aic){
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_aic_dc_scale_table;
+ }else{
+ s->y_dc_scale_table=
+ s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
}
if(s->modified_quant)
- s->chroma_qscale_table = ff_h263_chroma_qscale_table;
+ s->chroma_qscale_table= ff_h263_chroma_qscale_table;
ff_set_qscale(s, s->qscale);
s->rv10_first_dc_coded[0] = 0;
s->rv10_first_dc_coded[1] = 0;
s->rv10_first_dc_coded[2] = 0;
- 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;
+ 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;
ff_init_block_index(s);
/* decode each macroblock */
- for(s->mb_num_left = mb_count; s->mb_num_left > 0; s->mb_num_left--)
- {
+ for(s->mb_num_left= mb_count; s->mb_num_left>0; s->mb_num_left--) {
int ret;
ff_update_block_index(s);
dprintf(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y);
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
- ret = ff_h263_decode_mb(s, s->block);
+ ret=ff_h263_decode_mb(s, s->block);
- if(ret != SLICE_ERROR && s->gb.size_in_bits < get_bits_count(&s->gb) && 8 * buf_size2 >= get_bits_count(&s->gb))
- {
- av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", s->gb.size_in_bits, 8 * buf_size2);
- s->gb.size_in_bits = 8 * buf_size2;
- ret = SLICE_OK;
+ if (ret != SLICE_ERROR && s->gb.size_in_bits < get_bits_count(&s->gb) && 8*buf_size2 >= get_bits_count(&s->gb)){
+ av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", s->gb.size_in_bits, 8*buf_size2);
+ s->gb.size_in_bits= 8*buf_size2;
+ ret= SLICE_OK;
}
- if(ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb))
- {
+ if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) {
av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
@@ -714,18 +620,17 @@ static int rv10_decode_packet(AVCodecContext *avctx,
if(s->loop_filter)
ff_h263_loop_filter(s);
- if(++s->mb_x == s->mb_width)
- {
+ if (++s->mb_x == s->mb_width) {
s->mb_x = 0;
s->mb_y++;
ff_init_block_index(s);
}
if(s->mb_x == s->resync_mb_x)
- s->first_slice_line = 0;
+ s->first_slice_line=0;
if(ret == SLICE_END) break;
}
- ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, AC_END | DC_END | MV_END);
+ ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
return s->gb.size_in_bits;
}
@@ -733,7 +638,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
{
if(avctx->slice_count) return avctx->slice_offset[n];
- else return AV_RL32(buf + n * 8);
+ else return AV_RL32(buf + n*8);
}
static int rv10_decode_frame(AVCodecContext *avctx,
@@ -749,66 +654,56 @@ static int rv10_decode_frame(AVCodecContext *avctx,
dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
/* no supplementary picture */
- if(buf_size == 0)
- {
+ if (buf_size == 0) {
return 0;
}
- if(!avctx->slice_count)
- {
+ if(!avctx->slice_count){
slice_count = (*buf++) + 1;
slices_hdr = buf + 4;
buf += 8 * slice_count;
- }
- else
+ }else
slice_count = avctx->slice_count;
- for(i = 0; i < slice_count; i++)
- {
- int offset = get_slice_offset(avctx, slices_hdr, i);
+ for(i=0; i<slice_count; i++){
+ int offset= get_slice_offset(avctx, slices_hdr, i);
int size, size2;
- if(i + 1 == slice_count)
- size = buf_size - offset;
+ if(i+1 == slice_count)
+ size= buf_size - offset;
else
- size = get_slice_offset(avctx, slices_hdr, i + 1) - offset;
+ size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
- if(i + 2 >= slice_count)
- size2 = buf_size - offset;
+ if(i+2 >= slice_count)
+ size2= buf_size - offset;
else
- size2 = get_slice_offset(avctx, slices_hdr, i + 2) - offset;
+ size2= get_slice_offset(avctx, slices_hdr, i+2) - offset;
- if(rv10_decode_packet(avctx, buf + offset, size, size2) > 8 * size)
+ if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size)
i++;
}
- if(s->current_picture_ptr != NULL && s->mb_y >= s->mb_height)
- {
+ if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
ff_er_frame_end(s);
MPV_frame_end(s);
- if(s->pict_type == FF_B_TYPE || s->low_delay)
- {
- *pict = *(AVFrame*)s->current_picture_ptr;
- }
- else if(s->last_picture_ptr != NULL)
- {
- *pict = *(AVFrame*)s->last_picture_ptr;
+ if (s->pict_type == FF_B_TYPE || s->low_delay) {
+ *pict= *(AVFrame*)s->current_picture_ptr;
+ } else if (s->last_picture_ptr != NULL) {
+ *pict= *(AVFrame*)s->last_picture_ptr;
}
- if(s->last_picture_ptr || s->low_delay)
- {
+ if(s->last_picture_ptr || s->low_delay){
*data_size = sizeof(AVFrame);
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 wasnt called (find some nicer solution...)
}
return buf_size;
}
-AVCodec rv10_decoder =
-{
+AVCodec rv10_decoder = {
"rv10",
CODEC_TYPE_VIDEO,
CODEC_ID_RV10,
@@ -825,8 +720,7 @@ AVCodec rv10_decoder =
/*.long_name = */NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
};
-AVCodec rv20_decoder =
-{
+AVCodec rv20_decoder = {
"rv20",
CODEC_TYPE_VIDEO,
CODEC_ID_RV20,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30.c
index 6b1a4ab98..f97c326f8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30.c
@@ -51,8 +51,7 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn
skip_bits1(gb);
si->pts = get_bits(gb, 13);
rpr = get_bits(gb, r->rpr);
- if(rpr)
- {
+ if(rpr){
w = r->s.avctx->extradata[6 + rpr*2] << 2;
h = r->s.avctx->extradata[7 + rpr*2] << 2;
}
@@ -72,23 +71,18 @@ static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
{
int i, j, k;
- for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4)
- {
- for(j = 0; j < 4; j += 2)
- {
+ 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;
- if(code >= 81 * 2)
- {
+ if(code >= 81*2){
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
return -1;
}
- for(k = 0; k < 2; k++)
- {
+ for(k = 0; k < 2; k++){
int A = dst[-r->intra_types_stride] + 1;
int B = dst[-1] + 1;
*dst++ = rv30_itype_from_context[A * 90 + B * 9 + rv30_itype_code[code + k]];
- if(dst[-1] == 9)
- {
+ if(dst[-1] == 9){
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction mode\n");
return -1;
}
@@ -109,13 +103,11 @@ static int rv30_decode_mb_info(RV34DecContext *r)
GetBitContext *gb = &s->gb;
int 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;
}
- if(code > 5)
- {
+ if(code > 5){
av_log(s->avctx, AV_LOG_ERROR, "dquant needed\n");
code -= 6;
}
@@ -126,14 +118,13 @@ static int rv30_decode_mb_info(RV34DecContext *r)
}
static inline void rv30_weak_loop_filter(uint8_t *src, const int step,
- const int stride, const int lim)
+ const int stride, const int lim)
{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i, diff;
- for(i = 0; i < 4; i++)
- {
- diff = ((src[-2*step] - src[1*step]) - (src[-1*step] - src[0*step]) * 4) >> 3;
+ for(i = 0; i < 4; i++){
+ diff = ((src[-2*step] - src[1*step]) - (src[-1*step] - src[0*step])*4) >> 3;
diff = av_clip(diff, -lim, lim);
src[-1*step] = cm[src[-1*step] + diff];
src[ 0*step] = cm[src[ 0*step] - diff];
@@ -150,8 +141,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
int loc_lim, cur_lim, left_lim = 0, top_lim = 0;
mb_pos = row * s->mb_stride;
- for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++)
- {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int mbtype = s->current_picture_ptr->mb_type[mb_pos];
if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
r->deblock_coefs[mb_pos] = 0xFFFF;
@@ -163,46 +153,40 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
* and horizontal edges are filtered on the next iteration
*/
mb_pos = row * s->mb_stride;
- for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++)
- {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]];
if(mb_x)
left_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - 1]];
- for(j = 0; j < 16; j += 4)
- {
- Y = s->current_picture_ptr->data[0] + mb_x * 16 + (row * 16 + j) * s->linesize + 4 * !mb_x;
- for(i = !mb_x; i < 4; i++, Y += 4)
- {
+ for(j = 0; j < 16; j += 4){
+ Y = s->current_picture_ptr->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;
+ for(i = !mb_x; i < 4; i++, Y += 4){
int ij = i + j;
loc_lim = 0;
if(r->deblock_coefs[mb_pos] & (1 << ij))
loc_lim = cur_lim;
else if(!i && r->deblock_coefs[mb_pos - 1] & (1 << (ij + 3)))
loc_lim = left_lim;
- else if(i && r->deblock_coefs[mb_pos] & (1 << (ij - 1)))
+ else if( i && r->deblock_coefs[mb_pos] & (1 << (ij - 1)))
loc_lim = cur_lim;
if(loc_lim)
rv30_weak_loop_filter(Y, 1, s->linesize, loc_lim);
}
}
- for(k = 0; k < 2; k++)
- {
+ for(k = 0; k < 2; k++){
int cur_cbp, left_cbp = 0;
- cur_cbp = (r->cbp_chroma[mb_pos] >> (k * 4)) & 0xF;
+ cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF;
if(mb_x)
- left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k * 4)) & 0xF;
- for(j = 0; j < 8; j += 4)
- {
- C = s->current_picture_ptr->data[k+1] + mb_x * 8 + (row * 8 + j) * s->uvlinesize + 4 * !mb_x;
- for(i = !mb_x; i < 2; i++, C += 4)
- {
+ left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF;
+ for(j = 0; j < 8; j += 4){
+ C = s->current_picture_ptr->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;
+ for(i = !mb_x; i < 2; i++, C += 4){
int ij = i + (j >> 1);
loc_lim = 0;
if(cur_cbp && (1 << ij))
loc_lim = cur_lim;
else if(!i && left_cbp & (1 << (ij + 1)))
loc_lim = left_lim;
- else if(i && cur_cbp & (1 << (ij - 1)))
+ else if( i && cur_cbp & (1 << (ij - 1)))
loc_lim = cur_lim;
if(loc_lim)
rv30_weak_loop_filter(C, 1, s->uvlinesize, loc_lim);
@@ -211,46 +195,40 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
}
}
mb_pos = row * s->mb_stride;
- for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++)
- {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]];
if(row)
top_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - s->mb_stride]];
- for(j = 4 * !row; j < 16; j += 4)
- {
- Y = s->current_picture_ptr->data[0] + mb_x * 16 + (row * 16 + j) * s->linesize;
- for(i = 0; i < 4; i++, Y += 4)
- {
+ for(j = 4*!row; j < 16; j += 4){
+ Y = s->current_picture_ptr->data[0] + mb_x*16 + (row*16 + j) * s->linesize;
+ for(i = 0; i < 4; i++, Y += 4){
int ij = i + j;
loc_lim = 0;
if(r->deblock_coefs[mb_pos] & (1 << ij))
loc_lim = cur_lim;
else if(!j && r->deblock_coefs[mb_pos - s->mb_stride] & (1 << (ij + 12)))
loc_lim = top_lim;
- else if(j && r->deblock_coefs[mb_pos] & (1 << (ij - 4)))
+ else if( j && r->deblock_coefs[mb_pos] & (1 << (ij - 4)))
loc_lim = cur_lim;
if(loc_lim)
rv30_weak_loop_filter(Y, s->linesize, 1, loc_lim);
}
}
- for(k = 0; k < 2; k++)
- {
+ for(k = 0; k < 2; k++){
int cur_cbp, top_cbp = 0;
- cur_cbp = (r->cbp_chroma[mb_pos] >> (k * 4)) & 0xF;
+ cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF;
if(row)
- top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k * 4)) & 0xF;
- for(j = 4 * !row; j < 8; j += 4)
- {
- C = s->current_picture_ptr->data[k+1] + mb_x * 8 + (row * 8 + j) * s->uvlinesize;
- for(i = 0; i < 2; i++, C += 4)
- {
+ top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF;
+ for(j = 4*!row; j < 8; j += 4){
+ C = s->current_picture_ptr->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;
+ for(i = 0; i < 2; i++, C += 4){
int ij = i + (j >> 1);
loc_lim = 0;
if(r->cbp_chroma[mb_pos] && (1 << ij))
loc_lim = cur_lim;
else if(!j && top_cbp & (1 << (ij + 2)))
loc_lim = top_lim;
- else if(j && cur_cbp & (1 << (ij - 2)))
+ else if( j && cur_cbp & (1 << (ij - 2)))
loc_lim = cur_lim;
if(loc_lim)
rv30_weak_loop_filter(C, s->uvlinesize, 1, loc_lim);
@@ -269,15 +247,13 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
r->rv30 = 1;
ff_rv34_decode_init(avctx);
- if(avctx->extradata_size < 2)
- {
+ if(avctx->extradata_size < 2){
av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
return -1;
}
r->rpr = (avctx->extradata[1] & 7) >> 1;
r->rpr = FFMIN(r->rpr + 1, 3);
- if(avctx->extradata_size - 8 < (r->rpr - 1) * 2)
- {
+ if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){
av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n",
6 + r->rpr * 2, avctx->extradata_size);
}
@@ -290,8 +266,7 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
return 0;
}
-AVCodec rv30_decoder =
-{
+AVCodec rv30_decoder = {
"rv30",
CODEC_TYPE_VIDEO,
CODEC_ID_RV30,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30data.h
index 5fb3e5b08..1662fd7af 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30data.h
@@ -30,9 +30,8 @@
#include <stdint.h>
/** DC quantizer mapping for RV30 */
-static const uint8_t rv30_luma_dc_quant[32] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+static const uint8_t rv30_luma_dc_quant[32] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25
};
@@ -40,8 +39,7 @@ static const uint8_t rv30_luma_dc_quant[32] =
* This table is used for storing the differences
* between the predicted and the real intra type.
*/
-static const uint8_t rv30_itype_code[9*9*2] =
-{
+static const uint8_t rv30_itype_code[9*9*2] = {
0, 0, 0, 1, 1, 0, 1, 1, 0, 2, 2, 0, 0, 3, 3, 0, 1, 2,
2, 1, 0, 4, 4, 0, 3, 1, 1, 3, 0, 5, 5, 0, 2, 2, 1, 4,
4, 1, 0, 6, 3, 2, 1, 5, 2, 3, 5, 1, 6, 0, 0, 7, 4, 2,
@@ -62,8 +60,7 @@ static const uint8_t rv30_itype_code[9*9*2] =
* [-1..9][-1..9][0..9]. The first and second coordinates are
* detemined by the top and left neighbors (-1 if unavailable).
*/
-static const uint8_t rv30_itype_from_context[900] =
-{
+static const uint8_t rv30_itype_from_context[900] = {
0, 9, 9, 9, 9, 9, 9, 9, 9,
0, 2, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9,
@@ -178,8 +175,7 @@ static const uint8_t rv30_itype_from_context[900] =
/**
* Loop filter limits are taken from this table.
*/
-static const uint8_t rv30_loop_filt_lim[32] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5
+static const uint8_t rv30_loop_filt_lim[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5
};
#endif /* AVCODEC_RV30DATA_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30dsp.c
index b745e1d0b..bf2dc18b8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30dsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv30dsp.c
@@ -206,7 +206,7 @@ static void OPNAME ## rv30_tpel16_hhvv_lowpass(uint8_t *dst, uint8_t *src, int d
OPNAME ## rv30_tpel8_hhvv_lowpass(dst+8, src+8, dstStride, srcStride);\
}\
\
-
+
#define RV30_MC(OPNAME, SIZE) \
static void OPNAME ## rv30_tpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## rv30_tpel ## SIZE ## _h_lowpass(dst, src, stride, stride, 12, 6);\
@@ -240,7 +240,7 @@ static void OPNAME ## rv30_tpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, i
OPNAME ## rv30_tpel ## SIZE ## _hhvv_lowpass(dst, src, stride, stride);\
}\
\
-
+
#define op_avg(a, b) a = (((a)+cm[b]+1)>>1)
#define op_put(a, b) a = cm[b]
@@ -251,8 +251,7 @@ RV30_MC(put_, 16)
RV30_MC(avg_, 8)
RV30_MC(avg_, 16)
-av_cold void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx)
-{
+av_cold void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx) {
c->put_rv30_tpel_pixels_tab[0][ 0] = c->put_h264_qpel_pixels_tab[0][0];
c->put_rv30_tpel_pixels_tab[0][ 1] = put_rv30_tpel16_mc10_c;
c->put_rv30_tpel_pixels_tab[0][ 2] = put_rv30_tpel16_mc20_c;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.c
index 78b87e25d..8948c90b9 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.c
@@ -40,12 +40,11 @@
static inline void ZERO8x2(void* dst, int stride)
{
fill_rectangle(dst, 1, 2, stride, 0, 4);
- fill_rectangle(((uint8_t*)(dst)) + 4, 1, 2, stride, 0, 4);
+ fill_rectangle(((uint8_t*)(dst))+4, 1, 2, stride, 0, 4);
}
/** translation of RV30/40 macroblock types to lavc ones */
-static const int rv34_mb_type_to_lavc[12] =
-{
+static const int rv34_mb_type_to_lavc[12] = {
MB_TYPE_INTRA,
MB_TYPE_INTRA16x16 | MB_TYPE_SEPARATE_DC,
MB_TYPE_16x16 | MB_TYPE_L0,
@@ -68,26 +67,25 @@ static RV34VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES];
* @{
*/
-static const int table_offs[] =
-{
- 0, 1818, 3622, 4144, 4698, 5234, 5804, 5868, 5900, 5932,
- 5996, 6252, 6316, 6348, 6380, 7674, 8944, 10274, 11668, 12250,
- 14060, 15846, 16372, 16962, 17512, 18148, 18180, 18212, 18244, 18308,
- 18564, 18628, 18660, 18692, 20036, 21314, 22648, 23968, 24614, 26384,
- 28190, 28736, 29366, 29938, 30608, 30640, 30672, 30704, 30768, 31024,
- 31088, 31120, 31184, 32570, 33898, 35236, 36644, 37286, 39020, 40802,
- 41368, 42052, 42692, 43348, 43380, 43412, 43444, 43476, 43604, 43668,
- 43700, 43732, 45100, 46430, 47778, 49160, 49802, 51550, 53340, 53972,
- 54648, 55348, 55994, 56122, 56154, 56186, 56218, 56346, 56410, 56442,
- 56474, 57878, 59290, 60636, 62036, 62682, 64460, 64524, 64588, 64716,
- 64844, 66076, 67466, 67978, 68542, 69064, 69648, 70296, 72010, 72074,
- 72138, 72202, 72330, 73572, 74936, 75454, 76030, 76566, 77176, 77822,
- 79582, 79646, 79678, 79742, 79870, 81180, 82536, 83064, 83672, 84242,
- 84934, 85576, 87384, 87448, 87480, 87544, 87672, 88982, 90340, 90902,
- 91598, 92182, 92846, 93488, 95246, 95278, 95310, 95374, 95502, 96878,
- 98266, 98848, 99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416,
- 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398,
- 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592
+static const int table_offs[] = {
+ 0, 1818, 3622, 4144, 4698, 5234, 5804, 5868, 5900, 5932,
+ 5996, 6252, 6316, 6348, 6380, 7674, 8944, 10274, 11668, 12250,
+ 14060, 15846, 16372, 16962, 17512, 18148, 18180, 18212, 18244, 18308,
+ 18564, 18628, 18660, 18692, 20036, 21314, 22648, 23968, 24614, 26384,
+ 28190, 28736, 29366, 29938, 30608, 30640, 30672, 30704, 30768, 31024,
+ 31088, 31120, 31184, 32570, 33898, 35236, 36644, 37286, 39020, 40802,
+ 41368, 42052, 42692, 43348, 43380, 43412, 43444, 43476, 43604, 43668,
+ 43700, 43732, 45100, 46430, 47778, 49160, 49802, 51550, 53340, 53972,
+ 54648, 55348, 55994, 56122, 56154, 56186, 56218, 56346, 56410, 56442,
+ 56474, 57878, 59290, 60636, 62036, 62682, 64460, 64524, 64588, 64716,
+ 64844, 66076, 67466, 67978, 68542, 69064, 69648, 70296, 72010, 72074,
+ 72138, 72202, 72330, 73572, 74936, 75454, 76030, 76566, 77176, 77822,
+ 79582, 79646, 79678, 79742, 79870, 81180, 82536, 83064, 83672, 84242,
+ 84934, 85576, 87384, 87448, 87480, 87544, 87672, 88982, 90340, 90902,
+ 91598, 92182, 92846, 93488, 95246, 95278, 95310, 95374, 95502, 96878,
+ 98266, 98848, 99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416,
+ 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398,
+ 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592
};
static VLC_TYPE table_data[117592][2];
@@ -105,20 +103,18 @@ static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t
{
int i;
int counts[17] = {0}, codes[17];
-#if __STDC_VERSION__ >= 199901L
+ #if __STDC_VERSION__ >= 199901L
uint16_t cw[size], syms[size];
uint8_t bits2[size];
-#else
+ #else
uint16_t *cw = _alloca(sizeof(uint16_t) * size);
uint16_t *syms = _alloca(sizeof(uint16_t) * size);
uint8_t *bits2 = _alloca(sizeof(uint8_t) * size);
-#endif
+ #endif
int maxbits = 0, realsize = 0;
- for(i = 0; i < size; i++)
- {
- if(bits[i])
- {
+ for(i = 0; i < size; i++){
+ if(bits[i]){
bits2[realsize] = bits[i];
syms[realsize] = insyms ? insyms[i] : i;
realsize++;
@@ -148,39 +144,32 @@ static av_cold void rv34_init_tables(void)
{
int i, j, k;
- for(i = 0; i < NUM_INTRA_TABLES; i++)
- {
- for(j = 0; j < 2; j++)
- {
- rv34_gen_vlc(rv34_table_intra_cbppat [i][j], CBPPAT_VLC_SIZE, &intra_vlcs[i].cbppattern[j], NULL, 19 * i + 0 + j);
- rv34_gen_vlc(rv34_table_intra_secondpat[i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].second_pattern[j], NULL, 19 * i + 2 + j);
- rv34_gen_vlc(rv34_table_intra_thirdpat [i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].third_pattern[j], NULL, 19 * i + 4 + j);
- for(k = 0; k < 4; k++)
- {
- rv34_gen_vlc(rv34_table_intra_cbp[i][j+k*2], CBP_VLC_SIZE, &intra_vlcs[i].cbp[j][k], rv34_cbp_code, 19 * i + 6 + j * 4 + k);
+ for(i = 0; i < NUM_INTRA_TABLES; i++){
+ for(j = 0; j < 2; j++){
+ rv34_gen_vlc(rv34_table_intra_cbppat [i][j], CBPPAT_VLC_SIZE, &intra_vlcs[i].cbppattern[j], NULL, 19*i + 0 + j);
+ rv34_gen_vlc(rv34_table_intra_secondpat[i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].second_pattern[j], NULL, 19*i + 2 + j);
+ rv34_gen_vlc(rv34_table_intra_thirdpat [i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].third_pattern[j], NULL, 19*i + 4 + j);
+ for(k = 0; k < 4; k++){
+ rv34_gen_vlc(rv34_table_intra_cbp[i][j+k*2], CBP_VLC_SIZE, &intra_vlcs[i].cbp[j][k], rv34_cbp_code, 19*i + 6 + j*4 + k);
}
}
- for(j = 0; j < 4; j++)
- {
- rv34_gen_vlc(rv34_table_intra_firstpat[i][j], FIRSTBLK_VLC_SIZE, &intra_vlcs[i].first_pattern[j], NULL, 19 * i + 14 + j);
+ for(j = 0; j < 4; j++){
+ rv34_gen_vlc(rv34_table_intra_firstpat[i][j], FIRSTBLK_VLC_SIZE, &intra_vlcs[i].first_pattern[j], NULL, 19*i + 14 + j);
}
- rv34_gen_vlc(rv34_intra_coeff[i], COEFF_VLC_SIZE, &intra_vlcs[i].coefficient, NULL, 19 * i + 18);
+ rv34_gen_vlc(rv34_intra_coeff[i], COEFF_VLC_SIZE, &intra_vlcs[i].coefficient, NULL, 19*i + 18);
}
- for(i = 0; i < NUM_INTER_TABLES; i++)
- {
- rv34_gen_vlc(rv34_inter_cbppat[i], CBPPAT_VLC_SIZE, &inter_vlcs[i].cbppattern[0], NULL, i * 12 + 95);
- for(j = 0; j < 4; j++)
- {
- rv34_gen_vlc(rv34_inter_cbp[i][j], CBP_VLC_SIZE, &inter_vlcs[i].cbp[0][j], rv34_cbp_code, i * 12 + 96 + j);
+ for(i = 0; i < NUM_INTER_TABLES; i++){
+ rv34_gen_vlc(rv34_inter_cbppat[i], CBPPAT_VLC_SIZE, &inter_vlcs[i].cbppattern[0], NULL, i*12 + 95);
+ for(j = 0; j < 4; j++){
+ rv34_gen_vlc(rv34_inter_cbp[i][j], CBP_VLC_SIZE, &inter_vlcs[i].cbp[0][j], rv34_cbp_code, i*12 + 96 + j);
}
- for(j = 0; j < 2; j++)
- {
- rv34_gen_vlc(rv34_table_inter_firstpat [i][j], FIRSTBLK_VLC_SIZE, &inter_vlcs[i].first_pattern[j], NULL, i * 12 + 100 + j);
- rv34_gen_vlc(rv34_table_inter_secondpat[i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].second_pattern[j], NULL, i * 12 + 102 + j);
- rv34_gen_vlc(rv34_table_inter_thirdpat [i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].third_pattern[j], NULL, i * 12 + 104 + j);
+ for(j = 0; j < 2; j++){
+ rv34_gen_vlc(rv34_table_inter_firstpat [i][j], FIRSTBLK_VLC_SIZE, &inter_vlcs[i].first_pattern[j], NULL, i*12 + 100 + j);
+ rv34_gen_vlc(rv34_table_inter_secondpat[i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].second_pattern[j], NULL, i*12 + 102 + j);
+ rv34_gen_vlc(rv34_table_inter_thirdpat [i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].third_pattern[j], NULL, i*12 + 104 + j);
}
- rv34_gen_vlc(rv34_inter_coeff[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL, i * 12 + 106);
+ rv34_gen_vlc(rv34_inter_coeff[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL, i*12 + 106);
}
}
@@ -196,17 +185,16 @@ static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
{
int i;
- for(i = 0; i < 4; i++)
- {
- const int z0 = 13 * (block[i+8*0] + block[i+8*2]);
- const int z1 = 13 * (block[i+8*0] - block[i+8*2]);
- const int z2 = 7 * block[i+8*1] - 17 * block[i+8*3];
- const int z3 = 17 * block[i+8*1] + 7 * block[i+8*3];
-
- temp[4*i+0] = z0 + z3;
- temp[4*i+1] = z1 + z2;
- temp[4*i+2] = z1 - z2;
- temp[4*i+3] = z0 - z3;
+ for(i=0; i<4; i++){
+ const int z0= 13*(block[i+8*0] + block[i+8*2]);
+ const int z1= 13*(block[i+8*0] - block[i+8*2]);
+ const int z2= 7* block[i+8*1] - 17*block[i+8*3];
+ const int z3= 17* block[i+8*1] + 7*block[i+8*3];
+
+ temp[4*i+0]= z0+z3;
+ temp[4*i+1]= z1+z2;
+ temp[4*i+2]= z1-z2;
+ temp[4*i+3]= z0-z3;
}
}
@@ -214,24 +202,22 @@ static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
* Real Video 3.0/4.0 inverse transform
* Code is almost the same as in SVQ3, only scaling is different.
*/
-static void rv34_inv_transform(DCTELEM *block)
-{
+static void rv34_inv_transform(DCTELEM *block){
int temp[16];
int i;
rv34_row_transform(temp, block);
- for(i = 0; i < 4; i++)
- {
- const int z0 = 13 * (temp[4*0+i] + temp[4*2+i]) + 0x200;
- const int z1 = 13 * (temp[4*0+i] - temp[4*2+i]) + 0x200;
- const int z2 = 7 * temp[4*1+i] - 17 * temp[4*3+i];
- const int z3 = 17 * temp[4*1+i] + 7 * temp[4*3+i];
-
- block[i*8+0] = (z0 + z3) >> 10;
- block[i*8+1] = (z1 + z2) >> 10;
- block[i*8+2] = (z1 - z2) >> 10;
- block[i*8+3] = (z0 - z3) >> 10;
+ for(i=0; i<4; i++){
+ const int z0= 13*(temp[4*0+i] + temp[4*2+i]) + 0x200;
+ const int z1= 13*(temp[4*0+i] - temp[4*2+i]) + 0x200;
+ const int z2= 7* temp[4*1+i] - 17*temp[4*3+i];
+ const int z3= 17* temp[4*1+i] + 7*temp[4*3+i];
+
+ block[i*8+0]= (z0 + z3)>>10;
+ block[i*8+1]= (z1 + z2)>>10;
+ block[i*8+2]= (z1 - z2)>>10;
+ block[i*8+3]= (z0 - z3)>>10;
}
}
@@ -242,24 +228,22 @@ static void rv34_inv_transform(DCTELEM *block)
* Code is almost the same as rv34_inv_transform()
* but final coefficients are multiplied by 1.5 and have no rounding.
*/
-static void rv34_inv_transform_noround(DCTELEM *block)
-{
+static void rv34_inv_transform_noround(DCTELEM *block){
int temp[16];
int i;
rv34_row_transform(temp, block);
- for(i = 0; i < 4; i++)
- {
- const int z0 = 13 * (temp[4*0+i] + temp[4*2+i]);
- const int z1 = 13 * (temp[4*0+i] - temp[4*2+i]);
- const int z2 = 7 * temp[4*1+i] - 17 * temp[4*3+i];
- const int z3 = 17 * temp[4*1+i] + 7 * temp[4*3+i];
-
- block[i*8+0] = ((z0 + z3) * 3) >> 11;
- block[i*8+1] = ((z1 + z2) * 3) >> 11;
- block[i*8+2] = ((z1 - z2) * 3) >> 11;
- block[i*8+3] = ((z0 - z3) * 3) >> 11;
+ for(i=0; i<4; i++){
+ const int z0= 13*(temp[4*0+i] + temp[4*2+i]);
+ const int z1= 13*(temp[4*0+i] - temp[4*2+i]);
+ const int z2= 7* temp[4*1+i] - 17*temp[4*3+i];
+ const int z3= 17* temp[4*1+i] + 7*temp[4*3+i];
+
+ block[i*8+0]= ((z0 + z3)*3)>>11;
+ block[i*8+1]= ((z1 + z2)*3)>>11;
+ block[i*8+2]= ((z1 - z2)*3)>>11;
+ block[i*8+3]= ((z0 - z3)*3)>>11;
}
}
@@ -277,7 +261,7 @@ static void rv34_inv_transform_noround(DCTELEM *block)
*/
static int rv34_decode_cbp(GetBitContext *gb, RV34VLC *vlc, int table)
{
- int pattern, code, cbp = 0;
+ int pattern, code, cbp=0;
int ones;
static const int cbp_masks[3] = {0x100000, 0x010000, 0x110000};
static const int shifts[4] = { 0, 2, 8, 10 };
@@ -290,14 +274,12 @@ static int rv34_decode_cbp(GetBitContext *gb, RV34VLC *vlc, int table)
ones = rv34_count_ones[pattern];
- for(mask = 8; mask; mask >>= 1, curshift++)
- {
+ for(mask = 8; mask; mask >>= 1, curshift++){
if(pattern & mask)
cbp |= get_vlc2(gb, vlc->cbp[table][ones].table, vlc->cbp[table][ones].bits, 1) << curshift[0];
}
- for(i = 0; i < 4; i++)
- {
+ for(i = 0; i < 4; i++){
t = modulo_three_table[code][i];
if(t == 1)
cbp |= cbp_masks[get_bits1(gb)] << i;
@@ -312,13 +294,10 @@ static int rv34_decode_cbp(GetBitContext *gb, RV34VLC *vlc, int table)
*/
static inline void decode_coeff(DCTELEM *dst, int coef, int esc, GetBitContext *gb, VLC* vlc)
{
- if(coef)
- {
- if(coef == esc)
- {
+ if(coef){
+ if(coef == esc){
coef = get_vlc2(gb, vlc->table, 9, 2);
- if(coef > 23)
- {
+ if(coef > 23){
coef -= 23;
coef = 22 + ((1 << coef) | get_bits(gb, coef));
}
@@ -342,17 +321,14 @@ static inline void decode_subblock(DCTELEM *dst, int code, const int is_block2,
coeffs[2] = modulo_three_table[code][2];
coeffs[3] = modulo_three_table[code][3];
decode_coeff(dst , coeffs[0], 3, gb, vlc);
- if(is_block2)
- {
- decode_coeff(dst + 8, coeffs[1], 2, gb, vlc);
- decode_coeff(dst + 1, coeffs[2], 2, gb, vlc);
- }
- else
- {
- decode_coeff(dst + 1, coeffs[1], 2, gb, vlc);
- decode_coeff(dst + 8, coeffs[2], 2, gb, vlc);
- }
- decode_coeff(dst + 9, coeffs[3], 2, gb, vlc);
+ if(is_block2){
+ decode_coeff(dst+8, coeffs[1], 2, gb, vlc);
+ decode_coeff(dst+1, coeffs[2], 2, gb, vlc);
+ }else{
+ decode_coeff(dst+1, coeffs[1], 2, gb, vlc);
+ decode_coeff(dst+8, coeffs[2], 2, gb, vlc);
+ }
+ decode_coeff(dst+9, coeffs[3], 2, gb, vlc);
}
/**
@@ -377,20 +353,17 @@ static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *r
code >>= 3;
decode_subblock(dst, code, 0, gb, &rvlc->coefficient);
- if(pattern & 4)
- {
+ if(pattern & 4){
code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
decode_subblock(dst + 2, code, 0, gb, &rvlc->coefficient);
}
- if(pattern & 2) // Looks like coefficients 1 and 2 are swapped for this block
- {
+ if(pattern & 2){ // Looks like coefficients 1 and 2 are swapped for this block
code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
- decode_subblock(dst + 8 * 2, code, 1, gb, &rvlc->coefficient);
+ decode_subblock(dst + 8*2, code, 1, gb, &rvlc->coefficient);
}
- if(pattern & 1)
- {
+ if(pattern & 1){
code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2);
- decode_subblock(dst + 8 * 2 + 2, code, 0, gb, &rvlc->coefficient);
+ decode_subblock(dst + 8*2+2, code, 0, gb, &rvlc->coefficient);
}
}
@@ -418,9 +391,9 @@ static inline void rv34_dequant4x4_16x16(DCTELEM *block, int Qdc, int Q)
int i;
for(i = 0; i < 3; i++)
- block[rv34_dezigzag[i]] = (block[rv34_dezigzag[i]] * Qdc + 8) >> 4;
+ block[rv34_dezigzag[i]] = (block[rv34_dezigzag[i]] * Qdc + 8) >> 4;
for(; i < 16; i++)
- block[rv34_dezigzag[i]] = (block[rv34_dezigzag[i]] * Q + 8) >> 4;
+ block[rv34_dezigzag[i]] = (block[rv34_dezigzag[i]] * Q + 8) >> 4;
}
/** @} */ //block functions
@@ -451,7 +424,7 @@ static inline RV34VLC* choose_vlc_set(int quant, int mod, int type)
if(mod == 2 && quant < 19) quant += 10;
else if(mod && quant < 26) quant += 5;
return type ? &inter_vlcs[rv34_quant_to_vlc_set[1][av_clip(quant, 0, 30)]]
- : &intra_vlcs[rv34_quant_to_vlc_set[0][av_clip(quant, 0, 30)]];
+ : &intra_vlcs[rv34_quant_to_vlc_set[0][av_clip(quant, 0, 30)]];
}
/**
@@ -498,40 +471,30 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int
int avail_index = avail_indexes[subblock_no];
int c_off = part_sizes_w[block_type];
- mv_pos += (subblock_no & 1) + (subblock_no >> 1) * s->b8_stride;
+ 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(r->avail_cache[avail_index - 1]){
A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0];
A[1] = s->current_picture_ptr->motion_val[0][mv_pos-1][1];
}
- if(r->avail_cache[avail_index - 4])
- {
+ if(r->avail_cache[avail_index - 4]){
B[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][0];
B[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][1];
- }
- else
- {
+ }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(!r->avail_cache[avail_index - 4 + c_off]){
+ if(r->avail_cache[avail_index - 4] && (r->avail_cache[avail_index - 1] || r->rv30)){
C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][0];
C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][1];
- }
- else
- {
+ }else{
C[0] = A[0];
C[1] = A[1];
}
- }
- else
- {
+ }else{
C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][0];
C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][1];
}
@@ -539,10 +502,8 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int
my = mid_pred(A[1], B[1], C[1]);
mx += r->dmv[dmv_no][0];
my += r->dmv[dmv_no][1];
- for(j = 0; j < part_sizes_h[block_type]; j++)
- {
- for(i = 0; i < part_sizes_w[block_type]; i++)
- {
+ for(j = 0; j < part_sizes_h[block_type]; j++){
+ for(i = 0; i < part_sizes_w[block_type]; i++){
s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx;
s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my;
}
@@ -572,18 +533,14 @@ static inline void rv34_pred_b_vector(int A[2], int B[2], int C[2],
int A_avail, int B_avail, int C_avail,
int *mx, int *my)
{
- if(A_avail + B_avail + C_avail != 3)
- {
+ if(A_avail + B_avail + C_avail != 3){
*mx = A[0] + B[0] + C[0];
*my = A[1] + B[1] + C[1];
- if(A_avail + B_avail + C_avail == 2)
- {
+ if(A_avail + B_avail + C_avail == 2){
*mx /= 2;
*my /= 2;
}
- }
- else
- {
+ }else{
*mx = mid_pred(A[0], B[0], C[0]);
*my = mid_pred(A[1], B[1], C[1]);
}
@@ -608,26 +565,21 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
memset(A, 0, sizeof(A));
memset(B, 0, sizeof(B));
memset(C, 0, sizeof(C));
- if((r->avail_cache[6-1] & type) & mask)
- {
+ if((r->avail_cache[6-1] & type) & mask){
A[0] = cur_pic->motion_val[dir][mv_pos - 1][0];
A[1] = cur_pic->motion_val[dir][mv_pos - 1][1];
has_A = 1;
}
- if((r->avail_cache[6-4] & type) & mask)
- {
+ if((r->avail_cache[6-4] & type) & mask){
B[0] = cur_pic->motion_val[dir][mv_pos - s->b8_stride][0];
B[1] = cur_pic->motion_val[dir][mv_pos - s->b8_stride][1];
has_B = 1;
}
- if(r->avail_cache[6-4] && (r->avail_cache[6-2] & type) & mask)
- {
+ if(r->avail_cache[6-4] && (r->avail_cache[6-2] & type) & mask){
C[0] = cur_pic->motion_val[dir][mv_pos - s->b8_stride + 2][0];
C[1] = cur_pic->motion_val[dir][mv_pos - s->b8_stride + 2][1];
has_C = 1;
- }
- else if((s->mb_x + 1) == s->mb_width && (r->avail_cache[6-5] & type) & mask)
- {
+ }else if((s->mb_x+1) == s->mb_width && (r->avail_cache[6-5] & type) & mask){
C[0] = cur_pic->motion_val[dir][mv_pos - s->b8_stride - 1][0];
C[1] = cur_pic->motion_val[dir][mv_pos - s->b8_stride - 1][1];
has_C = 1;
@@ -638,16 +590,13 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
mx += r->dmv[dir][0];
my += r->dmv[dir][1];
- for(j = 0; j < 2; j++)
- {
- for(i = 0; i < 2; i++)
- {
+ for(j = 0; j < 2; j++){
+ for(i = 0; i < 2; i++){
cur_pic->motion_val[dir][mv_pos + i + j*s->b8_stride][0] = mx;
cur_pic->motion_val[dir][mv_pos + i + j*s->b8_stride][1] = my;
}
}
- if(block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD)
- {
+ if(block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD){
ZERO8x2(cur_pic->motion_val[!dir][mv_pos], s->b8_stride);
}
}
@@ -664,36 +613,26 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir)
int mx, my;
int avail_index = avail_indexes[0];
- if(r->avail_cache[avail_index - 1])
- {
+ if(r->avail_cache[avail_index - 1]){
A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0];
A[1] = s->current_picture_ptr->motion_val[0][mv_pos-1][1];
}
- if(r->avail_cache[avail_index - 4])
- {
+ if(r->avail_cache[avail_index - 4]){
B[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][0];
B[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][1];
- }
- else
- {
+ }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(!r->avail_cache[avail_index - 4 + 2]){
+ if(r->avail_cache[avail_index - 4] && (r->avail_cache[avail_index - 1])){
C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][0];
C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][1];
- }
- else
- {
+ }else{
C[0] = A[0];
C[1] = A[1];
}
- }
- else
- {
+ }else{
C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+2][0];
C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+2][1];
}
@@ -701,12 +640,9 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir)
my = mid_pred(A[1], B[1], C[1]);
mx += r->dmv[0][0];
my += r->dmv[0][1];
- for(j = 0; j < 2; j++)
- {
- for(i = 0; i < 2; i++)
- {
- for(k = 0; k < 2; k++)
- {
+ for(j = 0; j < 2; j++){
+ for(i = 0; i < 2; i++){
+ for(k = 0; k < 2; k++){
s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx;
s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my;
}
@@ -732,11 +668,11 @@ static const int chroma_coeffs[3] = { 0, 3, 5 };
* @param chroma_mc a set of functions used to perform chroma motion compensation
*/
static inline void rv34_mc(RV34DecContext *r, const int block_type,
- const int xoff, const int yoff, int mv_off,
- const int width, const int height, int dir,
- const int thirdpel,
- qpel_mc_func(*qpel_mc)[16],
- h264_chroma_mc_func(*chroma_mc))
+ const int xoff, const int yoff, int mv_off,
+ const int width, const int height, int dir,
+ const int thirdpel,
+ qpel_mc_func (*qpel_mc)[16],
+ h264_chroma_mc_func (*chroma_mc))
{
MpegEncContext *s = &r->s;
uint8_t *Y, *U, *V, *srcY, *srcU, *srcV;
@@ -744,8 +680,7 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off;
int is16x16 = 1;
- if(thirdpel)
- {
+ if(thirdpel){
int chroma_mx, chroma_my;
mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24);
my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24);
@@ -757,9 +692,7 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3];
uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3];
- }
- else
- {
+ }else{
int cx, cy;
mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2;
my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2;
@@ -775,7 +708,7 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
if(uvmx == 6 && uvmy == 6)
uvmx = uvmy = 4;
}
- dxy = ly * 4 + lx;
+ dxy = ly*4 + lx;
srcY = dir ? s->next_picture_ptr->data[0] : s->last_picture_ptr->data[0];
srcU = dir ? s->next_picture_ptr->data[1] : s->last_picture_ptr->data[1];
srcV = dir ? s->next_picture_ptr->data[2] : s->last_picture_ptr->data[2];
@@ -786,42 +719,38 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
srcY += src_y * s->linesize + src_x;
srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
- if((unsigned)(src_x - !!lx * 2) > s->h_edge_pos - !!lx * 2 - (width << 3) - 4
- || (unsigned)(src_y - !!ly * 2) > s->v_edge_pos - !!ly * 2 - (height << 3) - 4)
- {
- uint8_t *uvbuf = s->edge_emu_buffer + 22 * s->linesize;
+ if( (unsigned)(src_x - !!lx*2) > s->h_edge_pos - !!lx*2 - (width <<3) - 4
+ || (unsigned)(src_y - !!ly*2) > s->v_edge_pos - !!ly*2 - (height<<3) - 4){
+ uint8_t *uvbuf= s->edge_emu_buffer + 22 * s->linesize;
- srcY -= 2 + 2 * s->linesize;
- ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width << 3) + 6, (height << 3) + 6,
+ srcY -= 2 + 2*s->linesize;
+ ff_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;
- ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width << 2) + 1, (height << 2) + 1,
+ srcY = s->edge_emu_buffer + 2 + 2*s->linesize;
+ ff_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);
- ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width << 2) + 1, (height << 2) + 1,
+ ff_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;
}
- Y = s->dest[0] + xoff + yoff * s->linesize;
- U = s->dest[1] + (xoff >> 1) + (yoff >> 1) * s->uvlinesize;
- V = s->dest[2] + (xoff >> 1) + (yoff >> 1) * s->uvlinesize;
+ Y = s->dest[0] + xoff + yoff *s->linesize;
+ U = s->dest[1] + (xoff>>1) + (yoff>>1)*s->uvlinesize;
+ V = s->dest[2] + (xoff>>1) + (yoff>>1)*s->uvlinesize;
- if(block_type == RV34_MB_P_16x8)
- {
+ if(block_type == RV34_MB_P_16x8){
qpel_mc[1][dxy](Y, srcY, s->linesize);
Y += 8;
srcY += 8;
- }
- else if(block_type == RV34_MB_P_8x16)
- {
+ }else if(block_type == RV34_MB_P_8x16){
qpel_mc[1][dxy](Y, srcY, s->linesize);
Y += 8 * s->linesize;
srcY += 8 * s->linesize;
}
is16x16 = (block_type != RV34_MB_P_8x8) && (block_type != RV34_MB_P_16x8) && (block_type != RV34_MB_P_8x16);
qpel_mc[!is16x16][dxy](Y, srcY, s->linesize);
- chroma_mc[2-width](U, srcU, s->uvlinesize, height * 4, uvmx, uvmy);
- chroma_mc[2-width](V, srcV, s->uvlinesize, height * 4, uvmx, uvmy);
+ chroma_mc[2-width] (U, srcU, s->uvlinesize, height*4, uvmx, uvmy);
+ chroma_mc[2-width] (V, srcV, s->uvlinesize, height*4, uvmx, uvmy);
}
static void rv34_mc_1mv(RV34DecContext *r, const int block_type,
@@ -830,41 +759,40 @@ static void rv34_mc_1mv(RV34DecContext *r, const int block_type,
{
rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->rv30,
r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab
- : r->s.dsp.put_rv40_qpel_pixels_tab,
+ : r->s.dsp.put_rv40_qpel_pixels_tab,
r->rv30 ? r->s.dsp.put_h264_chroma_pixels_tab
- : r->s.dsp.put_rv40_chroma_pixels_tab);
+ : r->s.dsp.put_rv40_chroma_pixels_tab);
}
static void rv34_mc_2mv(RV34DecContext *r, const int block_type)
{
rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->rv30,
r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab
- : r->s.dsp.put_rv40_qpel_pixels_tab,
+ : r->s.dsp.put_rv40_qpel_pixels_tab,
r->rv30 ? r->s.dsp.put_h264_chroma_pixels_tab
- : r->s.dsp.put_rv40_chroma_pixels_tab);
+ : r->s.dsp.put_rv40_chroma_pixels_tab);
rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->rv30,
r->rv30 ? r->s.dsp.avg_rv30_tpel_pixels_tab
- : r->s.dsp.avg_rv40_qpel_pixels_tab,
+ : r->s.dsp.avg_rv40_qpel_pixels_tab,
r->rv30 ? r->s.dsp.avg_h264_chroma_pixels_tab
- : r->s.dsp.avg_rv40_chroma_pixels_tab);
+ : r->s.dsp.avg_rv40_chroma_pixels_tab);
}
static void rv34_mc_2mv_skip(RV34DecContext *r)
{
int i, j;
for(j = 0; j < 2; j++)
- for(i = 0; i < 2; i++)
- {
- rv34_mc(r, RV34_MB_P_8x8, i * 8, j * 8, i + j * r->s.b8_stride, 1, 1, 0, r->rv30,
+ for(i = 0; i < 2; i++){
+ rv34_mc(r, RV34_MB_P_8x8, i*8, j*8, i+j*r->s.b8_stride, 1, 1, 0, r->rv30,
r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab
- : r->s.dsp.put_rv40_qpel_pixels_tab,
+ : r->s.dsp.put_rv40_qpel_pixels_tab,
r->rv30 ? r->s.dsp.put_h264_chroma_pixels_tab
- : r->s.dsp.put_rv40_chroma_pixels_tab);
- rv34_mc(r, RV34_MB_P_8x8, i * 8, j * 8, i + j * r->s.b8_stride, 1, 1, 1, r->rv30,
+ : r->s.dsp.put_rv40_chroma_pixels_tab);
+ rv34_mc(r, RV34_MB_P_8x8, i*8, j*8, i+j*r->s.b8_stride, 1, 1, 1, r->rv30,
r->rv30 ? r->s.dsp.avg_rv30_tpel_pixels_tab
- : r->s.dsp.avg_rv40_qpel_pixels_tab,
+ : r->s.dsp.avg_rv40_qpel_pixels_tab,
r->rv30 ? r->s.dsp.avg_h264_chroma_pixels_tab
- : r->s.dsp.avg_rv40_chroma_pixels_tab);
+ : r->s.dsp.avg_rv40_chroma_pixels_tab);
}
}
@@ -884,33 +812,28 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
int next_bt;
memset(r->dmv, 0, sizeof(r->dmv));
- for(i = 0; i < num_mvs[block_type]; i++)
- {
+ for(i = 0; i < num_mvs[block_type]; i++){
r->dmv[i][0] = svq3_get_se_golomb(gb);
r->dmv[i][1] = svq3_get_se_golomb(gb);
}
- switch(block_type)
- {
+ switch(block_type){
case RV34_MB_TYPE_INTRA:
case RV34_MB_TYPE_INTRA16x16:
ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
return 0;
case RV34_MB_SKIP:
- if(s->pict_type == FF_P_TYPE)
- {
+ if(s->pict_type == FF_P_TYPE){
ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
- rv34_mc_1mv(r, block_type, 0, 0, 0, 2, 2, 0);
+ rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0);
break;
}
case RV34_MB_B_DIRECT:
//surprisingly, it uses motion scheme from next reference frame
next_bt = s->next_picture_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride];
- if(IS_INTRA(next_bt) || IS_SKIP(next_bt))
- {
+ if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){
ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
ZERO8x2(s->current_picture_ptr->motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
- }
- else
+ }else
for(j = 0; j < 2; j++)
for(i = 0; i < 2; i++)
for(k = 0; k < 2; k++)
@@ -925,7 +848,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
case RV34_MB_P_16x16:
case RV34_MB_P_MIX16x16:
rv34_pred_mv(r, block_type, 0, 0);
- rv34_mc_1mv(r, block_type, 0, 0, 0, 2, 2, 0);
+ rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0);
break;
case RV34_MB_B_FORWARD:
case RV34_MB_B_BACKWARD:
@@ -934,34 +857,31 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
if(r->rv30)
rv34_pred_mv_rv3(r, block_type, block_type == RV34_MB_B_BACKWARD);
else
- rv34_pred_mv_b(r, block_type, block_type == RV34_MB_B_BACKWARD);
- rv34_mc_1mv(r, block_type, 0, 0, 0, 2, 2, block_type == RV34_MB_B_BACKWARD);
+ rv34_pred_mv_b (r, block_type, block_type == RV34_MB_B_BACKWARD);
+ rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, block_type == RV34_MB_B_BACKWARD);
break;
case RV34_MB_P_16x8:
case RV34_MB_P_8x16:
rv34_pred_mv(r, block_type, 0, 0);
rv34_pred_mv(r, block_type, 1 + (block_type == RV34_MB_P_16x8), 1);
- if(block_type == RV34_MB_P_16x8)
- {
+ if(block_type == RV34_MB_P_16x8){
rv34_mc_1mv(r, block_type, 0, 0, 0, 2, 1, 0);
rv34_mc_1mv(r, block_type, 0, 8, s->b8_stride, 2, 1, 0);
}
- if(block_type == RV34_MB_P_8x16)
- {
+ if(block_type == RV34_MB_P_8x16){
rv34_mc_1mv(r, block_type, 0, 0, 0, 1, 2, 0);
rv34_mc_1mv(r, block_type, 8, 0, 1, 1, 2, 0);
}
break;
case RV34_MB_B_BIDIR:
- rv34_pred_mv_b(r, block_type, 0);
- rv34_pred_mv_b(r, block_type, 1);
- rv34_mc_2mv(r, block_type);
+ rv34_pred_mv_b (r, block_type, 0);
+ rv34_pred_mv_b (r, block_type, 1);
+ rv34_mc_2mv (r, block_type);
break;
case RV34_MB_P_8x8:
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i< 4;i++){
rv34_pred_mv(r, block_type, i, i);
- rv34_mc_1mv(r, block_type, (i & 1) << 3, (i & 2) << 2, (i & 1) + (i >> 1)*s->b8_stride, 1, 1, 0);
+ rv34_mc_1mv (r, block_type, (i&1)<<3, (i&2)<<2, (i&1)+(i>>1)*s->b8_stride, 1, 1, 0);
}
break;
}
@@ -975,16 +895,14 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
* @{
*/
/** mapping of RV30/40 intra prediction types to standard H.264 types */
-static const int ittrans[9] =
-{
- DC_PRED, VERT_PRED, HOR_PRED, DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_LEFT_PRED,
- VERT_RIGHT_PRED, VERT_LEFT_PRED, HOR_UP_PRED, HOR_DOWN_PRED,
+static const int ittrans[9] = {
+ DC_PRED, VERT_PRED, HOR_PRED, DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_LEFT_PRED,
+ VERT_RIGHT_PRED, VERT_LEFT_PRED, HOR_UP_PRED, HOR_DOWN_PRED,
};
/** mapping of RV30/40 intra 16x16 prediction types to standard H.264 types */
-static const int ittrans16[4] =
-{
- DC_PRED8x8, VERT_PRED8x8, HOR_PRED8x8, PLANE_PRED8x8,
+static const int ittrans16[4] = {
+ DC_PRED8x8, VERT_PRED8x8, HOR_PRED8x8, PLANE_PRED8x8,
};
/**
@@ -997,25 +915,20 @@ static void rv34_pred_4x4_block(RV34DecContext *r, uint8_t *dst, int stride, int
if(!up && !left)
itype = DC_128_PRED;
- else if(!up)
- {
+ else if(!up){
if(itype == VERT_PRED) itype = HOR_PRED;
if(itype == DC_PRED) itype = LEFT_DC_PRED;
- }
- else if(!left)
- {
+ }else if(!left){
if(itype == HOR_PRED) itype = VERT_PRED;
if(itype == DC_PRED) itype = TOP_DC_PRED;
if(itype == DIAG_DOWN_LEFT_PRED) itype = DIAG_DOWN_LEFT_PRED_RV40_NODOWN;
}
- if(!down)
- {
+ if(!down){
if(itype == DIAG_DOWN_LEFT_PRED) itype = DIAG_DOWN_LEFT_PRED_RV40_NODOWN;
if(itype == HOR_UP_PRED) itype = HOR_UP_PRED_RV40_NODOWN;
if(itype == VERT_LEFT_PRED) itype = VERT_LEFT_PRED_RV40_NODOWN;
}
- if(!right && up)
- {
+ if(!right && up){
topleft = dst[-stride + 3] * 0x01010101;
prev = (uint8_t*)&topleft;
}
@@ -1035,14 +948,11 @@ static inline int adjust_pred16(int itype, int up, int left)
{
if(!up && !left)
itype = DC_128_PRED8x8;
- else if(!up)
- {
+ else if(!up){
if(itype == PLANE_PRED8x8)itype = HOR_PRED8x8;
if(itype == VERT_PRED8x8) itype = HOR_PRED8x8;
if(itype == DC_PRED8x8) itype = LEFT_DC_PRED8x8;
- }
- else if(!left)
- {
+ }else if(!left){
if(itype == PLANE_PRED8x8)itype = VERT_PRED8x8;
if(itype == HOR_PRED8x8) itype = VERT_PRED8x8;
if(itype == DC_PRED8x8) itype = TOP_DC_PRED8x8;
@@ -1077,40 +987,33 @@ static void rv34_output_macroblock(RV34DecContext *r, int8_t *intra_types, int c
Y = s->dest[0];
U = s->dest[1];
V = s->dest[2];
- if(!is16)
- {
- for(j = 0; j < 4; j++)
- {
- idx = 9 + j * 8;
- for(i = 0; i < 4; i++, cbp >>= 1, Y += 4, idx++)
- {
+ if(!is16){
+ for(j = 0; j < 4; j++){
+ idx = 9 + j*8;
+ for(i = 0; i < 4; i++, cbp >>= 1, Y += 4, idx++){
rv34_pred_4x4_block(r, Y, s->linesize, ittrans[intra_types[i]], avail[idx-8], avail[idx-1], avail[idx+7], avail[idx-7]);
avail[idx] = 1;
if(cbp & 1)
- rv34_add_4x4_block(Y, s->linesize, s->block[(i>>1)+(j&2)], (i & 1) * 4 + (j & 1) * 32);
+ rv34_add_4x4_block(Y, s->linesize, s->block[(i>>1)+(j&2)], (i&1)*4+(j&1)*32);
}
- Y += s->linesize * 4 - 4 * 4;
+ Y += s->linesize * 4 - 4*4;
intra_types += r->intra_types_stride;
}
intra_types -= r->intra_types_stride * 4;
fill_rectangle(r->avail_cache + 6, 2, 2, 4, 0, 4);
- for(j = 0; j < 2; j++)
- {
- idx = 6 + j * 4;
- for(i = 0; i < 2; i++, cbp >>= 1, idx++)
- {
- rv34_pred_4x4_block(r, U + i * 4 + j * 4 * s->uvlinesize, s->uvlinesize, ittrans[intra_types[i*2+j*2*r->intra_types_stride]], r->avail_cache[idx-4], r->avail_cache[idx-1], !i && !j, r->avail_cache[idx-3]);
- rv34_pred_4x4_block(r, V + i * 4 + j * 4 * s->uvlinesize, s->uvlinesize, ittrans[intra_types[i*2+j*2*r->intra_types_stride]], r->avail_cache[idx-4], r->avail_cache[idx-1], !i && !j, r->avail_cache[idx-3]);
+ for(j = 0; j < 2; j++){
+ idx = 6 + j*4;
+ for(i = 0; i < 2; i++, cbp >>= 1, idx++){
+ rv34_pred_4x4_block(r, U + i*4 + j*4*s->uvlinesize, s->uvlinesize, ittrans[intra_types[i*2+j*2*r->intra_types_stride]], r->avail_cache[idx-4], r->avail_cache[idx-1], !i && !j, r->avail_cache[idx-3]);
+ rv34_pred_4x4_block(r, V + i*4 + j*4*s->uvlinesize, s->uvlinesize, ittrans[intra_types[i*2+j*2*r->intra_types_stride]], r->avail_cache[idx-4], r->avail_cache[idx-1], !i && !j, r->avail_cache[idx-3]);
r->avail_cache[idx] = 1;
if(cbp & 0x01)
- rv34_add_4x4_block(U + i * 4 + j * 4 * s->uvlinesize, s->uvlinesize, s->block[4], i * 4 + j * 32);
+ rv34_add_4x4_block(U + i*4 + j*4*s->uvlinesize, s->uvlinesize, s->block[4], i*4+j*32);
if(cbp & 0x10)
- rv34_add_4x4_block(V + i * 4 + j * 4 * s->uvlinesize, s->uvlinesize, s->block[5], i * 4 + j * 32);
+ rv34_add_4x4_block(V + i*4 + j*4*s->uvlinesize, s->uvlinesize, s->block[5], i*4+j*32);
}
}
- }
- else
- {
+ }else{
itype = ittrans16[intra_types[0]];
itype = adjust_pred16(itype, r->avail_cache[6-4], r->avail_cache[6-1]);
r->h.pred16x16[itype](Y, s->linesize);
@@ -1143,26 +1046,21 @@ static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types)
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int i, t;
- if(!r->si.type)
- {
+ if(!r->si.type){
r->is16 = get_bits1(gb);
- if(!r->is16 && !r->rv30)
- {
+ if(!r->is16 && !r->rv30){
if(!get_bits1(gb))
av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n");
}
s->current_picture_ptr->mb_type[mb_pos] = r->is16 ? MB_TYPE_INTRA16x16 : MB_TYPE_INTRA;
r->block_type = r->is16 ? RV34_MB_TYPE_INTRA16x16 : RV34_MB_TYPE_INTRA;
- }
- else
- {
+ }else{
r->block_type = r->decode_mb_info(r);
if(r->block_type == -1)
return -1;
s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type];
r->mb_type[mb_pos] = r->block_type;
- if(r->block_type == RV34_MB_SKIP)
- {
+ if(r->block_type == RV34_MB_SKIP){
if(s->pict_type == FF_P_TYPE)
r->mb_type[mb_pos] = RV34_MB_P_16x16;
if(s->pict_type == FF_B_TYPE)
@@ -1170,38 +1068,30 @@ static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types)
}
r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]);
rv34_decode_mv(r, r->block_type);
- if(r->block_type == RV34_MB_SKIP)
- {
+ if(r->block_type == RV34_MB_SKIP){
fill_rectangle(intra_types, 4, 4, r->intra_types_stride, 0, sizeof(intra_types[0]));
return 0;
}
r->chroma_vlc = 1;
r->luma_vlc = 0;
}
- if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos]))
- {
- if(r->is16)
- {
+ if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){
+ if(r->is16){
t = get_bits(gb, 2);
fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));
r->luma_vlc = 2;
- }
- else
- {
+ }else{
if(r->decode_intra_types(r, gb, intra_types) < 0)
return -1;
r->luma_vlc = 1;
}
r->chroma_vlc = 0;
r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
- }
- else
- {
+ }else{
for(i = 0; i < 16; i++)
intra_types[(i & 3) + (i>>2) * r->intra_types_stride] = 0;
r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
- if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16)
- {
+ if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16){
r->is16 = 1;
r->chroma_vlc = 1;
r->luma_vlc = 2;
@@ -1234,7 +1124,7 @@ static void rv34_apply_differences(RV34DecContext *r, int cbp)
for(i = 0; i < 4; i++)
if((cbp & (LUMA_CBP_BLOCK_MASK << shifts[i])) || r->block_type == RV34_MB_P_MIX16x16)
- s->dsp.add_pixels_clamped(s->block[i], s->dest[0] + (i & 1) * 8 + (i & 2) * 4 * s->linesize, s->linesize);
+ s->dsp.add_pixels_clamped(s->block[i], s->dest[0] + (i & 1)*8 + (i&2)*4*s->linesize, s->linesize);
if(cbp & U_CBP_MASK)
s->dsp.add_pixels_clamped(s->block[4], s->dest[1], s->uvlinesize);
if(cbp & V_CBP_MASK)
@@ -1259,14 +1149,12 @@ static int rv34_set_deblock_coef(RV34DecContext *r)
int hmvmask = 0, vmvmask = 0, i, j;
int midx = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
int16_t (*motion_val)[2] = s->current_picture_ptr->motion_val[0][midx];
- for(j = 0; j < 16; j += 8)
- {
- for(i = 0; i < 2; i++)
- {
+ for(j = 0; j < 16; j += 8){
+ for(i = 0; i < 2; i++){
if(is_mv_diff_gt_3(motion_val + i, 1))
- vmvmask |= 0x11 << (j + i * 2);
+ vmvmask |= 0x11 << (j + i*2);
if((j || s->mb_y) && is_mv_diff_gt_3(motion_val + i, s->b8_stride))
- hmvmask |= 0x03 << (j + i * 2);
+ hmvmask |= 0x03 << (j + i*2);
}
motion_val += s->b8_stride;
}
@@ -1274,8 +1162,7 @@ static int rv34_set_deblock_coef(RV34DecContext *r)
hmvmask &= ~0x000F;
if(!s->mb_x)
vmvmask &= ~0x1111;
- if(r->rv30) //RV30 marks both subblocks on the edge for filtering
- {
+ if(r->rv30){ //RV30 marks both subblocks on the edge for filtering
vmvmask |= (vmvmask & 0x4444) >> 1;
hmvmask |= (hmvmask & 0x0F00) >> 4;
if(s->mb_x)
@@ -1303,11 +1190,11 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;
if(s->mb_x && dist)
r->avail_cache[5] =
- r->avail_cache[9] = s->current_picture_ptr->mb_type[mb_pos - 1];
+ r->avail_cache[9] = s->current_picture_ptr->mb_type[mb_pos - 1];
if(dist >= s->mb_width)
r->avail_cache[2] =
- r->avail_cache[3] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride];
- if(((s->mb_x + 1) < s->mb_width) && dist >= s->mb_width - 1)
+ r->avail_cache[3] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride];
+ if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)
r->avail_cache[4] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride + 1];
if(s->mb_x && dist > s->mb_width)
r->avail_cache[1] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride - 1];
@@ -1326,35 +1213,32 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
return -1;
luma_dc_quant = r->block_type == RV34_MB_P_MIX16x16 ? r->luma_dc_quant_p[s->qscale] : r->luma_dc_quant_i[s->qscale];
- if(r->is16)
- {
+ if(r->is16){
memset(block16, 0, sizeof(block16));
rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0);
- rv34_dequant4x4_16x16(block16, rv34_qscale_tab[luma_dc_quant], rv34_qscale_tab[s->qscale]);
+ rv34_dequant4x4_16x16(block16, rv34_qscale_tab[luma_dc_quant],rv34_qscale_tab[s->qscale]);
rv34_inv_transform_noround(block16);
}
- for(i = 0; i < 16; i++, cbp >>= 1)
- {
+ for(i = 0; i < 16; i++, cbp >>= 1){
if(!r->is16 && !(cbp & 1)) continue;
blknum = ((i & 2) >> 1) + ((i & 8) >> 2);
blkoff = ((i & 1) << 2) + ((i & 4) << 3);
if(cbp & 1)
rv34_decode_block(s->block[blknum] + blkoff, gb, r->cur_vlcs, r->luma_vlc, 0);
- rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[s->qscale], rv34_qscale_tab[s->qscale]);
+ rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[s->qscale],rv34_qscale_tab[s->qscale]);
if(r->is16) //FIXME: optimize
s->block[blknum][blkoff] = block16[(i & 3) | ((i & 0xC) << 1)];
rv34_inv_transform(s->block[blknum] + blkoff);
}
if(r->block_type == RV34_MB_P_MIX16x16)
r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
- for(; i < 24; i++, cbp >>= 1)
- {
+ for(; i < 24; i++, cbp >>= 1){
if(!(cbp & 1)) continue;
blknum = ((i & 4) >> 2) + 4;
blkoff = ((i & 1) << 2) + ((i & 2) << 4);
rv34_decode_block(s->block[blknum] + blkoff, gb, r->cur_vlcs, r->chroma_vlc, 1);
- rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[rv34_chroma_quant[1][s->qscale]], rv34_qscale_tab[rv34_chroma_quant[0][s->qscale]]);
+ rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[rv34_chroma_quant[1][s->qscale]],rv34_qscale_tab[rv34_chroma_quant[0][s->qscale]]);
rv34_inv_transform(s->block[blknum] + blkoff);
}
if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos]))
@@ -1385,7 +1269,7 @@ static inline int slice_compare(SliceInfo *si1, SliceInfo *si2)
return si1->type != si2->type ||
si1->start >= si2->start ||
si1->width != si2->width ||
- si1->height != si2->height ||
+ si1->height != si2->height||
si1->pts != si2->pts;
}
@@ -1396,26 +1280,23 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
int mb_pos;
int res;
- init_get_bits(&r->s.gb, buf, buf_size * 8);
+ init_get_bits(&r->s.gb, buf, buf_size*8);
res = r->parse_slice_header(r, gb, &r->si);
- if(res < 0)
- {
+ if(res < 0){
av_log(s->avctx, AV_LOG_ERROR, "Incorrect or unknown slice header\n");
return -1;
}
- if((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr == NULL)
- {
- if(s->width != r->si.width || s->height != r->si.height)
- {
- av_log(s->avctx, AV_LOG_DEBUG, "Changing dimensions to %dx%d\n", r->si.width, r->si.height);
+ if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
+ if(s->width != r->si.width || s->height != r->si.height){
+ av_log(s->avctx, AV_LOG_DEBUG, "Changing dimensions to %dx%d\n", r->si.width,r->si.height);
MPV_common_end(s);
s->width = r->si.width;
s->height = r->si.height;
avcodec_set_dimensions(s->avctx, s->width, s->height);
if(MPV_common_init(s) < 0)
return -1;
- r->intra_types_stride = s->mb_width * 4 + 4;
+ r->intra_types_stride = s->mb_width*4 + 4;
r->intra_types_hist = av_realloc(r->intra_types_hist, r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist));
r->intra_types = r->intra_types_hist + r->intra_types_stride * 4;
r->mb_type = av_realloc(r->mb_type, r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type));
@@ -1428,8 +1309,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
return -1;
ff_er_frame_start(s);
r->cur_pts = r->si.pts;
- if(s->pict_type != FF_B_TYPE)
- {
+ if(s->pict_type != FF_B_TYPE){
r->last_pts = r->next_pts;
r->next_pts = r->cur_pts;
}
@@ -1438,35 +1318,31 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
r->si.end = end;
s->qscale = r->si.quant;
- r->bits = buf_size * 8;
+ r->bits = buf_size*8;
s->mb_num_left = r->si.end - r->si.start;
r->s.mb_skip_run = 0;
mb_pos = s->mb_x + s->mb_y * s->mb_width;
- if(r->si.start != mb_pos)
- {
+ if(r->si.start != mb_pos){
av_log(s->avctx, AV_LOG_ERROR, "Slice indicates MB offset %d, got %d\n", r->si.start, mb_pos);
s->mb_x = r->si.start % s->mb_width;
s->mb_y = r->si.start / s->mb_width;
}
memset(r->intra_types_hist, -1, r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist));
s->first_slice_line = 1;
- s->resync_mb_x = s->mb_x;
- s->resync_mb_y = s->mb_y;
+ s->resync_mb_x= s->mb_x;
+ s->resync_mb_y= s->mb_y;
ff_init_block_index(s);
- while(!check_slice_end(r, s))
- {
+ while(!check_slice_end(r, s)) {
ff_update_block_index(s);
s->dsp.clear_blocks(s->block[0]);
- if(rv34_decode_macroblock(r, r->intra_types + s->mb_x * 4 + 4) < 0)
- {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, AC_ERROR | DC_ERROR | MV_ERROR);
+ if(rv34_decode_macroblock(r, r->intra_types + s->mb_x * 4 + 4) < 0){
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
return -1;
}
- if(++s->mb_x == s->mb_width)
- {
+ if (++s->mb_x == s->mb_width) {
s->mb_x = 0;
s->mb_y++;
ff_init_block_index(s);
@@ -1478,10 +1354,10 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
r->loop_filter(r, s->mb_y - 2);
}
if(s->mb_x == s->resync_mb_x)
- s->first_slice_line = 0;
+ s->first_slice_line=0;
s->mb_num_left--;
}
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1, s->mb_y, AC_END | DC_END | MV_END);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
return s->mb_y == s->mb_height;
}
@@ -1497,9 +1373,9 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
MpegEncContext *s = &r->s;
MPV_decode_defaults(s);
- s->avctx = avctx;
+ s->avctx= avctx;
s->out_format = FMT_H263;
- s->codec_id = avctx->codec_id;
+ s->codec_id= avctx->codec_id;
s->width = avctx->width;
s->height = avctx->height;
@@ -1511,12 +1387,12 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
avctx->has_b_frames = 1;
s->low_delay = 0;
- if(MPV_common_init(s) < 0)
+ if (MPV_common_init(s) < 0)
return -1;
ff_h264_pred_init(&r->h, CODEC_ID_RV40);
- r->intra_types_stride = 4 * s->mb_stride + 4;
+ r->intra_types_stride = 4*s->mb_stride + 4;
r->intra_types_hist = av_malloc(r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist));
r->intra_types = r->intra_types_hist + r->intra_types_stride * 4;
@@ -1535,12 +1411,12 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
{
if(avctx->slice_count) return avctx->slice_offset[n];
- else return AV_RL32(buf + n * 8 - 4) == 1 ? AV_RL32(buf + n * 8) : AV_RB32(buf + n * 8);
+ else return AV_RL32(buf + n*8 - 4) == 1 ? AV_RL32(buf + n*8) : AV_RB32(buf + n*8);
}
int ff_rv34_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
RV34DecContext *r = avctx->priv_data;
MpegEncContext *s = &r->s;
@@ -1552,108 +1428,92 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
int last = 0;
/* no supplementary picture */
- if(buf_size == 0)
- {
+ if (buf_size == 0) {
/* special case for last picture */
- if(s->low_delay == 0 && s->next_picture_ptr)
- {
- *pict = *(AVFrame*)s->next_picture_ptr;
- s->next_picture_ptr = NULL;
+ if (s->low_delay==0 && s->next_picture_ptr) {
+ *pict= *(AVFrame*)s->next_picture_ptr;
+ s->next_picture_ptr= NULL;
*data_size = sizeof(AVFrame);
}
return 0;
}
- if(!avctx->slice_count)
- {
+ if(!avctx->slice_count){
slice_count = (*buf++) + 1;
slices_hdr = buf + 4;
buf += 8 * slice_count;
- }
- else
+ }else
slice_count = avctx->slice_count;
//parse first slice header to check whether this frame can be decoded
- if(get_slice_offset(avctx, slices_hdr, 0) > buf_size)
- {
+ if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
return -1;
}
- init_get_bits(&s->gb, buf + get_slice_offset(avctx, slices_hdr, 0), buf_size - get_slice_offset(avctx, slices_hdr, 0));
- if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start)
- {
+ init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), buf_size-get_slice_offset(avctx, slices_hdr, 0));
+ if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){
av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
return -1;
}
if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
return -1;
/* skip b frames if we are in a hurry */
- if(avctx->hurry_up && si.type == FF_B_TYPE) return buf_size;
- if((avctx->skip_frame >= AVDISCARD_NONREF && si.type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type != FF_I_TYPE)
+ if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
+ || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
return buf_size;
/* skip everything if we are in a hurry>=5 */
- if(avctx->hurry_up >= 5)
+ if(avctx->hurry_up>=5)
return buf_size;
- for(i = 0; i < slice_count; i++)
- {
- int offset = get_slice_offset(avctx, slices_hdr, i);
+ for(i=0; i<slice_count; i++){
+ int offset= get_slice_offset(avctx, slices_hdr, i);
int size;
- if(i + 1 == slice_count)
- size = buf_size - offset;
+ if(i+1 == slice_count)
+ size= buf_size - offset;
else
- size = get_slice_offset(avctx, slices_hdr, i + 1) - offset;
+ size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
- if(offset > buf_size)
- {
+ if(offset > buf_size){
av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
break;
}
r->si.end = s->mb_width * s->mb_height;
- if(i + 1 < slice_count)
- {
- init_get_bits(&s->gb, buf + get_slice_offset(avctx, slices_hdr, i + 1), (buf_size - get_slice_offset(avctx, slices_hdr, i + 1)) * 8);
- if(r->parse_slice_header(r, &r->s.gb, &si) < 0)
- {
- if(i + 2 < slice_count)
- size = get_slice_offset(avctx, slices_hdr, i + 2) - offset;
+ if(i+1 < slice_count){
+ init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8);
+ if(r->parse_slice_header(r, &r->s.gb, &si) < 0){
+ if(i+2 < slice_count)
+ size = get_slice_offset(avctx, slices_hdr, i+2) - offset;
else
size = buf_size - offset;
- }
- else
+ }else
r->si.end = si.start;
}
last = rv34_decode_slice(r, r->si.end, buf + offset, size);
- s->mb_num_left = r->s.mb_x + r->s.mb_y * r->s.mb_width - r->si.start;
+ s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;
if(last)
break;
}
- if(last)
- {
+ if(last){
if(r->loop_filter)
r->loop_filter(r, s->mb_height - 1);
ff_er_frame_end(s);
MPV_frame_end(s);
- if(s->pict_type == FF_B_TYPE || s->low_delay)
- {
- *pict = *(AVFrame*)s->current_picture_ptr;
- }
- else if(s->last_picture_ptr != NULL)
- {
- *pict = *(AVFrame*)s->last_picture_ptr;
+ if (s->pict_type == FF_B_TYPE || s->low_delay) {
+ *pict= *(AVFrame*)s->current_picture_ptr;
+ } else if (s->last_picture_ptr != NULL) {
+ *pict= *(AVFrame*)s->last_picture_ptr;
}
- if(s->last_picture_ptr || s->low_delay)
- {
+ if(s->last_picture_ptr || s->low_delay){
*data_size = sizeof(AVFrame);
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 wasnt called (find some nicer solution...)
}
return buf_size;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.h
index c891ae720..c199ea97f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34.h
@@ -39,8 +39,7 @@
/**
* RV30 and RV40 Macroblock types
*/
-enum RV40BlockTypes
-{
+enum RV40BlockTypes{
RV34_MB_TYPE_INTRA, ///< Intra macroblock
RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block
RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame
@@ -61,19 +60,17 @@ enum RV40BlockTypes
*
* Intra frame VLC sets do not contain some of those tables.
*/
-typedef struct RV34VLC
-{
+typedef struct RV34VLC{
VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding
VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding
VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock
VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3
VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock
VLC coefficient; ///< VLCs used for decoding big coefficients
-} RV34VLC;
+}RV34VLC;
/** essential slice information */
-typedef struct SliceInfo
-{
+typedef struct SliceInfo{
int type; ///< slice type (intra, inter)
int quant; ///< quantizer used for this slice
int vlc_set; ///< VLCs used for this slice
@@ -81,11 +78,10 @@ typedef struct SliceInfo
int width; ///< coded width
int height; ///< coded height
int pts; ///< frame timestamp
-} SliceInfo;
+}SliceInfo;
/** decoder context */
-typedef struct RV34DecContext
-{
+typedef struct RV34DecContext{
MpegEncContext s;
int8_t *intra_types_hist;///< old block types, used for prediction
int8_t *intra_types; ///< block types
@@ -121,7 +117,7 @@ typedef struct RV34DecContext
int (*decode_mb_info)(struct RV34DecContext *r);
int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
void (*loop_filter)(struct RV34DecContext *r, int row);
-} RV34DecContext;
+}RV34DecContext;
/**
* common decoding functions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34data.h
index 39b26a2f1..95e5572df 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34data.h
@@ -32,16 +32,14 @@
/**
* number of ones in nibble minus one
*/
-static const uint8_t rv34_count_ones[16] =
-{
+static const uint8_t rv34_count_ones[16] = {
0, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 3
};
/**
* values used to reconstruct coded block pattern
*/
-static const uint8_t rv34_cbp_code[16] =
-{
+static const uint8_t rv34_cbp_code[16] = {
0x00, 0x20, 0x10, 0x30, 0x02, 0x22, 0x12, 0x32,
0x01, 0x21, 0x11, 0x31, 0x03, 0x23, 0x13, 0x33
};
@@ -52,102 +50,88 @@ static const uint8_t rv34_cbp_code[16] =
* A lot of four-tuples in RV40 are represented as c0*27+c1*9+c2*3+c3.
* This table allows conversion from a value back to a vector.
*/
-static const uint8_t modulo_three_table[108][4] =
-{
- { 0, 0, 0, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 2 }, { 0, 0, 1, 0 },
- { 0, 0, 1, 1 }, { 0, 0, 1, 2 }, { 0, 0, 2, 0 }, { 0, 0, 2, 1 },
- { 0, 0, 2, 2 }, { 0, 1, 0, 0 }, { 0, 1, 0, 1 }, { 0, 1, 0, 2 },
- { 0, 1, 1, 0 }, { 0, 1, 1, 1 }, { 0, 1, 1, 2 }, { 0, 1, 2, 0 },
- { 0, 1, 2, 1 }, { 0, 1, 2, 2 }, { 0, 2, 0, 0 }, { 0, 2, 0, 1 },
- { 0, 2, 0, 2 }, { 0, 2, 1, 0 }, { 0, 2, 1, 1 }, { 0, 2, 1, 2 },
- { 0, 2, 2, 0 }, { 0, 2, 2, 1 }, { 0, 2, 2, 2 }, { 1, 0, 0, 0 },
- { 1, 0, 0, 1 }, { 1, 0, 0, 2 }, { 1, 0, 1, 0 }, { 1, 0, 1, 1 },
- { 1, 0, 1, 2 }, { 1, 0, 2, 0 }, { 1, 0, 2, 1 }, { 1, 0, 2, 2 },
- { 1, 1, 0, 0 }, { 1, 1, 0, 1 }, { 1, 1, 0, 2 }, { 1, 1, 1, 0 },
- { 1, 1, 1, 1 }, { 1, 1, 1, 2 }, { 1, 1, 2, 0 }, { 1, 1, 2, 1 },
- { 1, 1, 2, 2 }, { 1, 2, 0, 0 }, { 1, 2, 0, 1 }, { 1, 2, 0, 2 },
- { 1, 2, 1, 0 }, { 1, 2, 1, 1 }, { 1, 2, 1, 2 }, { 1, 2, 2, 0 },
- { 1, 2, 2, 1 }, { 1, 2, 2, 2 }, { 2, 0, 0, 0 }, { 2, 0, 0, 1 },
- { 2, 0, 0, 2 }, { 2, 0, 1, 0 }, { 2, 0, 1, 1 }, { 2, 0, 1, 2 },
- { 2, 0, 2, 0 }, { 2, 0, 2, 1 }, { 2, 0, 2, 2 }, { 2, 1, 0, 0 },
- { 2, 1, 0, 1 }, { 2, 1, 0, 2 }, { 2, 1, 1, 0 }, { 2, 1, 1, 1 },
- { 2, 1, 1, 2 }, { 2, 1, 2, 0 }, { 2, 1, 2, 1 }, { 2, 1, 2, 2 },
- { 2, 2, 0, 0 }, { 2, 2, 0, 1 }, { 2, 2, 0, 2 }, { 2, 2, 1, 0 },
- { 2, 2, 1, 1 }, { 2, 2, 1, 2 }, { 2, 2, 2, 0 }, { 2, 2, 2, 1 },
- { 2, 2, 2, 2 }, { 3, 0, 0, 0 }, { 3, 0, 0, 1 }, { 3, 0, 0, 2 },
- { 3, 0, 1, 0 }, { 3, 0, 1, 1 }, { 3, 0, 1, 2 }, { 3, 0, 2, 0 },
- { 3, 0, 2, 1 }, { 3, 0, 2, 2 }, { 3, 1, 0, 0 }, { 3, 1, 0, 1 },
- { 3, 1, 0, 2 }, { 3, 1, 1, 0 }, { 3, 1, 1, 1 }, { 3, 1, 1, 2 },
- { 3, 1, 2, 0 }, { 3, 1, 2, 1 }, { 3, 1, 2, 2 }, { 3, 2, 0, 0 },
- { 3, 2, 0, 1 }, { 3, 2, 0, 2 }, { 3, 2, 1, 0 }, { 3, 2, 1, 1 },
- { 3, 2, 1, 2 }, { 3, 2, 2, 0 }, { 3, 2, 2, 1 }, { 3, 2, 2, 2 },
+static const uint8_t modulo_three_table[108][4] = {
+ { 0, 0, 0, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 2 }, { 0, 0, 1, 0 },
+ { 0, 0, 1, 1 }, { 0, 0, 1, 2 }, { 0, 0, 2, 0 }, { 0, 0, 2, 1 },
+ { 0, 0, 2, 2 }, { 0, 1, 0, 0 }, { 0, 1, 0, 1 }, { 0, 1, 0, 2 },
+ { 0, 1, 1, 0 }, { 0, 1, 1, 1 }, { 0, 1, 1, 2 }, { 0, 1, 2, 0 },
+ { 0, 1, 2, 1 }, { 0, 1, 2, 2 }, { 0, 2, 0, 0 }, { 0, 2, 0, 1 },
+ { 0, 2, 0, 2 }, { 0, 2, 1, 0 }, { 0, 2, 1, 1 }, { 0, 2, 1, 2 },
+ { 0, 2, 2, 0 }, { 0, 2, 2, 1 }, { 0, 2, 2, 2 }, { 1, 0, 0, 0 },
+ { 1, 0, 0, 1 }, { 1, 0, 0, 2 }, { 1, 0, 1, 0 }, { 1, 0, 1, 1 },
+ { 1, 0, 1, 2 }, { 1, 0, 2, 0 }, { 1, 0, 2, 1 }, { 1, 0, 2, 2 },
+ { 1, 1, 0, 0 }, { 1, 1, 0, 1 }, { 1, 1, 0, 2 }, { 1, 1, 1, 0 },
+ { 1, 1, 1, 1 }, { 1, 1, 1, 2 }, { 1, 1, 2, 0 }, { 1, 1, 2, 1 },
+ { 1, 1, 2, 2 }, { 1, 2, 0, 0 }, { 1, 2, 0, 1 }, { 1, 2, 0, 2 },
+ { 1, 2, 1, 0 }, { 1, 2, 1, 1 }, { 1, 2, 1, 2 }, { 1, 2, 2, 0 },
+ { 1, 2, 2, 1 }, { 1, 2, 2, 2 }, { 2, 0, 0, 0 }, { 2, 0, 0, 1 },
+ { 2, 0, 0, 2 }, { 2, 0, 1, 0 }, { 2, 0, 1, 1 }, { 2, 0, 1, 2 },
+ { 2, 0, 2, 0 }, { 2, 0, 2, 1 }, { 2, 0, 2, 2 }, { 2, 1, 0, 0 },
+ { 2, 1, 0, 1 }, { 2, 1, 0, 2 }, { 2, 1, 1, 0 }, { 2, 1, 1, 1 },
+ { 2, 1, 1, 2 }, { 2, 1, 2, 0 }, { 2, 1, 2, 1 }, { 2, 1, 2, 2 },
+ { 2, 2, 0, 0 }, { 2, 2, 0, 1 }, { 2, 2, 0, 2 }, { 2, 2, 1, 0 },
+ { 2, 2, 1, 1 }, { 2, 2, 1, 2 }, { 2, 2, 2, 0 }, { 2, 2, 2, 1 },
+ { 2, 2, 2, 2 }, { 3, 0, 0, 0 }, { 3, 0, 0, 1 }, { 3, 0, 0, 2 },
+ { 3, 0, 1, 0 }, { 3, 0, 1, 1 }, { 3, 0, 1, 2 }, { 3, 0, 2, 0 },
+ { 3, 0, 2, 1 }, { 3, 0, 2, 2 }, { 3, 1, 0, 0 }, { 3, 1, 0, 1 },
+ { 3, 1, 0, 2 }, { 3, 1, 1, 0 }, { 3, 1, 1, 1 }, { 3, 1, 1, 2 },
+ { 3, 1, 2, 0 }, { 3, 1, 2, 1 }, { 3, 1, 2, 2 }, { 3, 2, 0, 0 },
+ { 3, 2, 0, 1 }, { 3, 2, 0, 2 }, { 3, 2, 1, 0 }, { 3, 2, 1, 1 },
+ { 3, 2, 1, 2 }, { 3, 2, 2, 0 }, { 3, 2, 2, 1 }, { 3, 2, 2, 2 },
};
/**
* quantizer values used for AC and DC coefficients in chroma blocks
*/
-static const uint8_t rv34_chroma_quant[2][32] =
-{
- {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25
- },
- {
- 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23
- }
+static const uint8_t rv34_chroma_quant[2][32] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25 },
+ { 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23 }
};
/**
* This table is used for dequantizing.
*/
-static const uint16_t rv34_qscale_tab[32] =
-{
- 60, 67, 76, 85, 96, 108, 121, 136,
- 152, 171, 192, 216, 242, 272, 305, 341,
- 383, 432, 481, 544, 606, 683, 767, 854,
- 963, 1074, 1212, 1392, 1566, 1708, 1978, 2211
+static const uint16_t rv34_qscale_tab[32] = {
+ 60, 67, 76, 85, 96, 108, 121, 136,
+ 152, 171, 192, 216, 242, 272, 305, 341,
+ 383, 432, 481, 544, 606, 683, 767, 854,
+ 963, 1074, 1212, 1392, 1566, 1708, 1978, 2211
};
/**
* 4x4 dezigzag pattern
*/
-static const uint8_t rv34_dezigzag[16] =
-{
- 0, 1, 8, 16,
- 9, 2, 3, 10,
- 17, 24, 25, 18,
- 11, 19, 26, 27
+static const uint8_t rv34_dezigzag[16] = {
+ 0, 1, 8, 16,
+ 9, 2, 3, 10,
+ 17, 24, 25, 18,
+ 11, 19, 26, 27
};
/**
* tables used to translate a quantizer value into a VLC set for decoding
* The first table is used for intraframes.
*/
-static const uint8_t rv34_quant_to_vlc_set[2][31] =
-{
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3,
- 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6
- },
+static const uint8_t rv34_quant_to_vlc_set[2][31] = {
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3,
+ 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 },
};
/**
* table for obtaining the quantizer difference
* @todo Use with modified_quant_tab from h263data.h.
*/
-static const uint8_t rv34_dquant_tab[2][32] =
-{
+static const uint8_t rv34_dquant_tab[2][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, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
- }, {
- 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, 26
- }
+{
+ 0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28
+},{
+ 0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26
+}
};
/**
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34vlc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34vlc.h
index cf1b2337d..ffee907f9 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34vlc.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv34vlc.h
@@ -38,4029 +38,4017 @@
#define OTHERBLK_VLC_SIZE 108
#define COEFF_VLC_SIZE 32
-static const uint8_t rv34_table_intra_cbppat[NUM_INTRA_TABLES][2][CBPPAT_VLC_SIZE] =
-{
- {
- {
- 8, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 6,
- 12, 12, 13, 12, 13, 12, 13, 11, 13, 13, 13, 12, 13, 12, 12, 8,
- 14, 13, 16, 13, 15, 13, 16, 12, 16, 16, 16, 14, 16, 13, 14, 10,
- 12, 13, 12, 12, 13, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12, 8,
- 13, 14, 14, 12, 14, 14, 14, 12, 14, 15, 14, 12, 14, 13, 13, 8,
- 16, 16, 16, 12, 16, 16, 16, 13, 16, 16, 16, 13, 16, 14, 14, 9,
- 14, 16, 13, 13, 16, 16, 16, 14, 15, 16, 14, 13, 15, 15, 14, 10,
- 16, 16, 14, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 15, 14, 10,
- 16, 16, 16, 11, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 15, 9,
- 12, 13, 13, 13, 12, 12, 14, 12, 12, 14, 13, 12, 12, 12, 12, 8,
- 14, 14, 16, 14, 13, 12, 14, 12, 14, 15, 14, 13, 13, 12, 13, 8,
- 16, 16, 16, 15, 16, 13, 16, 13, 16, 16, 16, 15, 16, 13, 15, 10,
- 14, 16, 14, 14, 14, 14, 15, 13, 14, 16, 14, 13, 13, 13, 13, 9,
- 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 14, 13, 14, 13, 13, 8,
- 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 14, 16, 14, 14, 9,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 14, 10,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 14, 16, 15, 14, 9,
- 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 16, 13, 16, 15, 15, 8,
- 14, 16, 16, 16, 14, 14, 16, 14, 16, 16, 16, 15, 13, 13, 14, 10,
- 16, 16, 16, 16, 15, 13, 16, 13, 16, 16, 16, 16, 16, 13, 14, 10,
- 16, 16, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16, 12, 16, 9,
- 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 14, 14, 10,
- 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 15, 16, 13, 14, 9,
- 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16, 13, 14, 8,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 11,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14, 9,
- 16, 16, 16, 14, 16, 15, 16, 11, 16, 16, 16, 14, 16, 14, 14, 8,
- 12, 13, 13, 13, 13, 13, 14, 12, 12, 13, 12, 12, 12, 12, 12, 8,
- 14, 14, 16, 14, 15, 14, 16, 13, 14, 15, 14, 13, 14, 13, 13, 9,
- 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 14, 16, 14, 16, 10,
- 14, 15, 14, 14, 15, 14, 15, 13, 14, 14, 13, 12, 13, 13, 13, 9,
- 15, 16, 15, 14, 16, 16, 16, 13, 15, 16, 14, 12, 14, 13, 13, 8,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 13, 16, 14, 14, 9,
- 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 13, 13, 16, 16, 14, 10,
- 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 13, 16, 14, 14, 9,
- 16, 16, 16, 12, 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 15, 8,
- 13, 14, 14, 14, 14, 14, 16, 13, 13, 14, 14, 13, 12, 12, 12, 8,
- 16, 16, 16, 14, 15, 14, 16, 13, 15, 16, 14, 13, 13, 12, 13, 8,
- 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 14, 16, 13, 14, 9,
- 15, 16, 16, 15, 16, 15, 16, 13, 14, 16, 14, 13, 13, 13, 12, 8,
- 16, 16, 16, 14, 16, 14, 15, 12, 15, 15, 14, 12, 13, 12, 12, 7,
- 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 13, 16, 13, 13, 7,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 14, 14, 16, 14, 13, 9,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 14, 12, 16, 13, 12, 7,
- 16, 16, 16, 12, 16, 16, 16, 11, 16, 16, 15, 12, 16, 13, 13, 6,
- 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 13, 13, 14, 10,
- 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 14, 13, 14, 9,
- 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 16, 16, 12, 14, 8,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14, 13, 13, 9,
- 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 13, 14, 12, 12, 7,
- 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13, 6,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 14, 9,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 15, 13, 12, 7,
- 16, 16, 16, 13, 16, 14, 16, 11, 16, 16, 16, 12, 16, 12, 12, 5,
- 14, 16, 15, 16, 16, 16, 16, 15, 14, 15, 14, 14, 13, 14, 13, 10,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 16, 10,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 14, 15, 14, 13, 10,
- 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14, 13, 16, 14, 14, 9,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 9,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 13, 16, 16, 13, 10,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 16, 13, 9,
- 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 12, 16, 16, 14, 8,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 15, 14, 13, 13, 13, 9,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14, 13, 13, 9,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 15, 9,
- 16, 16, 16, 16, 16, 16, 16, 15, 15, 16, 14, 14, 14, 13, 13, 9,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 12, 13, 12, 12, 7,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 16, 13, 13, 7,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 14, 13, 9,
- 16, 16, 16, 15, 16, 16, 16, 13, 16, 16, 13, 12, 14, 13, 12, 6,
- 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 14, 10, 15, 12, 12, 5,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 13, 13, 9,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 13, 12, 13, 8,
- 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 15, 12, 14, 8,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 13, 13, 13, 8,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 15, 13, 12, 11, 12, 6,
- 16, 16, 16, 15, 16, 14, 16, 12, 16, 16, 16, 12, 13, 10, 12, 5,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 13, 14, 12, 8,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 13, 12, 13, 12, 10, 5,
- 16, 16, 16, 13, 16, 13, 16, 10, 16, 16, 13, 10, 13, 10, 10, 1,
- },
- {
- 2, 7, 7, 8, 7, 8, 9, 8, 7, 9, 8, 8, 8, 8, 9, 7,
- 6, 9, 10, 10, 10, 10, 11, 10, 10, 11, 11, 11, 10, 11, 11, 9,
- 9, 11, 12, 12, 12, 13, 14, 13, 13, 14, 14, 13, 13, 13, 14, 11,
- 6, 10, 9, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 11, 11, 9,
- 6, 9, 10, 10, 10, 11, 12, 11, 10, 12, 11, 11, 11, 11, 11, 8,
- 9, 11, 12, 12, 12, 13, 13, 13, 12, 14, 14, 13, 13, 13, 13, 10,
- 9, 13, 11, 13, 13, 14, 14, 13, 13, 14, 13, 13, 14, 14, 14, 12,
- 9, 12, 12, 12, 12, 14, 14, 13, 13, 14, 13, 13, 13, 14, 13, 11,
- 8, 12, 12, 11, 12, 14, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
- 6, 10, 10, 11, 9, 10, 12, 11, 10, 12, 11, 11, 10, 11, 11, 9,
- 7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 11, 9,
- 9, 12, 13, 13, 12, 12, 14, 13, 13, 14, 14, 13, 14, 13, 14, 11,
- 8, 11, 11, 12, 11, 12, 12, 12, 11, 13, 12, 12, 12, 12, 12, 10,
- 7, 10, 10, 11, 10, 11, 12, 11, 10, 12, 11, 11, 11, 11, 11, 8,
- 9, 11, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 13, 12, 13, 10,
- 10, 13, 13, 14, 14, 14, 15, 14, 14, 15, 14, 15, 14, 14, 14, 12,
- 9, 12, 12, 13, 12, 13, 14, 13, 12, 13, 13, 12, 13, 13, 13, 10,
- 9, 12, 12, 12, 12, 13, 14, 12, 12, 14, 13, 12, 13, 13, 13, 10,
- 9, 12, 13, 13, 11, 13, 14, 13, 13, 14, 14, 14, 12, 13, 13, 11,
- 10, 12, 13, 13, 12, 12, 14, 13, 13, 14, 14, 14, 13, 13, 14, 11,
- 10, 13, 14, 14, 13, 12, 15, 13, 14, 14, 14, 14, 15, 13, 14, 11,
- 11, 14, 14, 14, 13, 14, 15, 14, 14, 15, 15, 14, 13, 14, 14, 12,
- 10, 13, 12, 13, 12, 12, 14, 13, 13, 14, 13, 13, 13, 13, 13, 10,
- 10, 12, 13, 13, 13, 12, 14, 12, 13, 14, 14, 13, 13, 13, 13, 10,
- 13, 15, 16, 16, 15, 15, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
- 11, 14, 14, 14, 14, 14, 15, 14, 14, 15, 15, 14, 14, 14, 15, 11,
- 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 14, 13, 13, 13, 13, 10,
- 6, 10, 10, 11, 10, 11, 12, 11, 10, 12, 10, 11, 10, 11, 11, 9,
- 8, 11, 11, 12, 11, 12, 13, 12, 11, 12, 12, 12, 12, 12, 12, 10,
- 11, 13, 14, 14, 13, 14, 15, 14, 13, 15, 15, 14, 14, 14, 15, 12,
- 7, 11, 10, 12, 11, 12, 12, 12, 11, 12, 11, 12, 11, 12, 12, 10,
- 7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 11, 9,
- 10, 12, 13, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13, 13, 13, 10,
- 10, 13, 12, 14, 13, 14, 14, 14, 13, 14, 12, 14, 15, 14, 14, 11,
- 10, 12, 12, 12, 12, 13, 14, 13, 13, 14, 13, 12, 13, 13, 13, 10,
- 9, 12, 13, 13, 13, 14, 14, 13, 13, 14, 14, 13, 13, 13, 13, 10,
- 7, 10, 10, 11, 10, 11, 12, 11, 10, 12, 12, 11, 9, 11, 11, 9,
- 7, 10, 11, 11, 10, 11, 12, 11, 10, 12, 12, 11, 11, 11, 11, 9,
- 10, 12, 13, 13, 13, 13, 15, 13, 13, 14, 13, 13, 13, 13, 13, 10,
- 8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 12, 11, 9,
- 6, 9, 9, 10, 9, 10, 10, 10, 9, 11, 10, 10, 9, 10, 10, 7,
- 8, 10, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 11, 11, 8,
- 10, 13, 13, 13, 13, 14, 14, 13, 13, 14, 13, 13, 13, 13, 13, 11,
- 8, 11, 11, 11, 11, 12, 12, 11, 11, 12, 11, 11, 11, 11, 11, 8,
- 8, 11, 11, 11, 11, 12, 12, 10, 11, 12, 12, 11, 11, 11, 11, 8,
- 10, 13, 13, 13, 12, 13, 14, 13, 12, 14, 14, 14, 10, 13, 13, 11,
- 10, 12, 12, 13, 12, 13, 14, 12, 12, 13, 13, 13, 12, 12, 13, 10,
- 11, 13, 14, 14, 13, 13, 14, 13, 13, 15, 14, 13, 13, 13, 13, 10,
- 10, 12, 13, 13, 12, 13, 14, 13, 13, 14, 14, 13, 12, 13, 13, 11,
- 8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 11, 11, 8,
- 9, 11, 12, 12, 11, 11, 12, 11, 12, 12, 12, 11, 12, 11, 11, 8,
- 12, 15, 14, 14, 14, 15, 15, 14, 14, 15, 15, 14, 14, 14, 15, 12,
- 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 12, 12, 12, 9,
- 9, 11, 11, 11, 11, 11, 12, 10, 11, 12, 12, 11, 11, 11, 11, 7,
- 10, 13, 13, 13, 13, 14, 15, 14, 13, 14, 14, 14, 12, 14, 15, 12,
- 11, 14, 14, 14, 14, 15, 15, 14, 14, 15, 15, 15, 14, 15, 15, 12,
- 13, 16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 14,
- 10, 13, 13, 14, 13, 15, 14, 14, 13, 15, 13, 14, 14, 14, 14, 12,
- 10, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 13, 13, 13, 14, 11,
- 12, 14, 14, 14, 14, 15, 15, 14, 14, 15, 15, 14, 15, 14, 14, 12,
- 11, 14, 14, 15, 14, 15, 15, 14, 14, 15, 12, 14, 15, 16, 15, 12,
- 11, 13, 13, 14, 13, 14, 14, 14, 14, 14, 13, 13, 14, 14, 14, 11,
- 11, 14, 14, 14, 14, 15, 15, 14, 14, 16, 14, 13, 14, 14, 14, 11,
- 10, 13, 13, 13, 12, 14, 14, 14, 12, 15, 14, 14, 11, 13, 13, 12,
- 10, 12, 13, 14, 12, 13, 14, 13, 13, 14, 14, 13, 12, 13, 13, 11,
- 12, 14, 14, 15, 14, 15, 16, 15, 15, 15, 15, 15, 14, 14, 15, 12,
- 10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 13, 13, 12, 13, 13, 11,
- 9, 11, 11, 12, 11, 12, 12, 11, 11, 12, 12, 11, 11, 11, 11, 9,
- 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 13, 12, 12, 9,
- 11, 13, 13, 15, 14, 14, 15, 14, 14, 15, 14, 14, 14, 14, 14, 11,
- 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 11, 11, 12, 12, 12, 8,
- 9, 12, 12, 11, 12, 12, 13, 11, 12, 12, 12, 11, 12, 11, 11, 8,
- 10, 13, 13, 14, 12, 14, 15, 14, 13, 15, 15, 14, 10, 13, 13, 11,
- 11, 13, 14, 13, 13, 14, 14, 13, 13, 14, 14, 14, 11, 13, 13, 11,
- 12, 14, 14, 14, 14, 14, 15, 14, 15, 16, 15, 14, 13, 13, 14, 11,
- 11, 14, 13, 14, 13, 14, 15, 14, 13, 15, 14, 14, 11, 13, 13, 11,
- 9, 12, 12, 12, 11, 12, 13, 11, 12, 13, 12, 11, 10, 11, 11, 8,
- 10, 12, 12, 12, 12, 12, 13, 11, 12, 12, 12, 11, 11, 11, 11, 8,
- 12, 15, 14, 15, 14, 15, 16, 15, 15, 15, 15, 14, 14, 14, 14, 12,
- 10, 12, 12, 12, 12, 12, 13, 11, 12, 13, 12, 11, 11, 11, 11, 8,
- 8, 10, 10, 10, 10, 10, 11, 9, 10, 11, 10, 9, 10, 9, 9, 5,
- },
- },
- {
- {
- 12, 12, 11, 9, 11, 10, 11, 9, 11, 11, 10, 9, 9, 8, 9, 5,
- 14, 13, 14, 11, 14, 11, 13, 10, 14, 13, 12, 10, 12, 10, 11, 6,
- 16, 13, 16, 12, 16, 12, 16, 11, 16, 14, 16, 12, 15, 12, 13, 8,
- 14, 14, 12, 11, 14, 12, 13, 10, 13, 13, 11, 10, 12, 11, 10, 6,
- 16, 15, 14, 11, 16, 13, 14, 10, 15, 14, 13, 10, 13, 11, 11, 7,
- 16, 16, 16, 11, 16, 14, 16, 11, 16, 16, 15, 12, 15, 13, 13, 8,
- 16, 16, 13, 12, 16, 16, 15, 12, 16, 16, 12, 11, 15, 13, 12, 8,
- 16, 16, 14, 11, 16, 16, 16, 11, 16, 16, 14, 11, 15, 14, 13, 8,
- 16, 16, 15, 10, 16, 16, 16, 10, 16, 16, 15, 11, 16, 14, 14, 8,
- 14, 14, 14, 12, 13, 11, 13, 10, 13, 13, 12, 11, 11, 10, 10, 6,
- 16, 15, 16, 13, 13, 11, 14, 11, 15, 14, 13, 11, 12, 10, 11, 7,
- 16, 15, 16, 14, 16, 11, 16, 11, 16, 16, 16, 13, 16, 12, 13, 8,
- 16, 16, 14, 13, 15, 13, 14, 11, 14, 15, 13, 11, 13, 11, 11, 7,
- 16, 16, 15, 13, 15, 13, 14, 11, 16, 15, 14, 11, 13, 11, 11, 7,
- 16, 16, 16, 13, 16, 13, 16, 11, 16, 16, 16, 12, 16, 12, 13, 8,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 14, 13, 15, 14, 13, 9,
- 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 14, 12, 15, 13, 13, 8,
- 16, 16, 16, 12, 16, 16, 16, 11, 16, 16, 15, 12, 16, 13, 13, 7,
- 16, 16, 16, 16, 13, 12, 16, 12, 16, 16, 14, 13, 12, 11, 12, 8,
- 16, 16, 16, 15, 14, 11, 16, 11, 16, 16, 16, 13, 14, 11, 13, 8,
- 16, 16, 16, 16, 15, 10, 16, 11, 16, 16, 16, 14, 15, 11, 13, 8,
- 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 14, 14, 14, 12, 13, 9,
- 16, 16, 16, 15, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13, 8,
- 16, 16, 16, 14, 16, 12, 16, 11, 16, 16, 16, 13, 15, 12, 13, 7,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 14, 13, 9,
- 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 14, 16, 13, 13, 8,
- 16, 16, 16, 14, 16, 14, 16, 10, 16, 16, 16, 13, 16, 13, 13, 7,
- 14, 14, 13, 12, 13, 12, 13, 11, 12, 13, 11, 10, 11, 10, 10, 6,
- 16, 16, 15, 13, 16, 13, 15, 11, 14, 14, 13, 11, 13, 11, 11, 7,
- 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 13, 16, 13, 14, 9,
- 16, 16, 13, 13, 15, 14, 14, 11, 13, 14, 11, 11, 12, 11, 11, 7,
- 16, 16, 15, 12, 16, 14, 15, 11, 14, 14, 12, 11, 13, 11, 11, 7,
- 16, 16, 16, 13, 16, 14, 16, 12, 16, 16, 14, 12, 16, 13, 13, 8,
- 16, 16, 14, 14, 16, 16, 16, 13, 16, 16, 12, 11, 15, 13, 12, 8,
- 16, 16, 15, 13, 16, 16, 16, 12, 16, 16, 13, 11, 16, 13, 12, 8,
- 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 14, 11, 16, 14, 13, 7,
- 16, 16, 15, 13, 14, 13, 14, 11, 14, 14, 12, 11, 11, 10, 11, 7,
- 16, 16, 16, 13, 14, 12, 15, 11, 15, 14, 13, 11, 12, 11, 11, 7,
- 16, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13, 8,
- 16, 16, 15, 13, 15, 14, 14, 12, 14, 14, 12, 11, 12, 11, 11, 7,
- 16, 16, 14, 12, 15, 13, 14, 11, 15, 14, 13, 11, 12, 11, 11, 6,
- 16, 16, 16, 13, 16, 13, 16, 11, 16, 15, 14, 11, 14, 11, 12, 6,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13, 12, 14, 13, 12, 8,
- 16, 16, 15, 13, 16, 14, 15, 11, 16, 16, 13, 11, 14, 12, 11, 6,
- 16, 16, 16, 12, 16, 14, 15, 11, 16, 16, 13, 10, 14, 12, 12, 6,
- 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 14, 13, 12, 11, 12, 8,
- 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 15, 13, 13, 11, 12, 8,
- 16, 16, 16, 15, 16, 12, 16, 12, 16, 16, 16, 14, 14, 11, 13, 7,
- 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 14, 13, 13, 12, 12, 8,
- 16, 16, 16, 14, 15, 13, 15, 11, 16, 15, 14, 12, 13, 11, 11, 6,
- 16, 16, 16, 14, 16, 12, 15, 11, 16, 16, 15, 12, 14, 11, 12, 6,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 15, 13, 14, 13, 12, 8,
- 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 14, 12, 13, 12, 11, 6,
- 16, 16, 16, 13, 16, 13, 15, 10, 16, 16, 14, 11, 14, 11, 11, 5,
- 16, 16, 15, 14, 16, 16, 16, 13, 14, 14, 12, 12, 12, 12, 12, 8,
- 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 13, 14, 13, 13, 9,
- 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 16, 13, 15, 9,
- 16, 16, 14, 15, 16, 16, 16, 14, 14, 16, 12, 12, 13, 13, 12, 8,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 15, 13, 12, 14, 12, 12, 8,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 12, 16, 13, 13, 8,
- 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 11, 11, 15, 14, 12, 8,
- 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 12, 11, 15, 13, 12, 8,
- 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 13, 10, 16, 13, 12, 7,
- 16, 16, 16, 16, 16, 15, 16, 13, 14, 16, 13, 13, 12, 12, 12, 8,
- 16, 16, 16, 15, 16, 14, 16, 13, 16, 16, 14, 13, 13, 12, 12, 8,
- 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 13, 15, 12, 14, 8,
- 16, 16, 16, 15, 16, 16, 16, 13, 14, 16, 13, 12, 12, 12, 11, 8,
- 16, 16, 16, 14, 16, 14, 16, 12, 14, 14, 13, 11, 13, 11, 11, 6,
- 16, 16, 16, 14, 16, 14, 16, 12, 16, 15, 14, 11, 14, 11, 12, 6,
- 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 12, 12, 14, 13, 11, 8,
- 16, 16, 15, 14, 16, 16, 16, 12, 16, 15, 12, 11, 13, 12, 11, 6,
- 16, 16, 16, 13, 16, 14, 16, 11, 16, 14, 13, 10, 14, 11, 11, 5,
- 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 15, 13, 11, 11, 11, 8,
- 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 13, 12, 11, 12, 7,
- 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 13, 13, 11, 13, 7,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 13, 12, 12, 11, 7,
- 16, 16, 16, 15, 16, 14, 15, 12, 16, 14, 13, 12, 12, 11, 11, 6,
- 16, 16, 16, 14, 16, 13, 15, 11, 16, 14, 14, 11, 13, 10, 11, 5,
- 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 13, 12, 12, 12, 11, 7,
- 16, 16, 16, 14, 16, 14, 15, 12, 16, 15, 12, 11, 12, 11, 10, 5,
- 16, 16, 16, 13, 16, 13, 14, 10, 16, 14, 12, 9, 12, 10, 9, 3,
- },
- {
- 2, 6, 6, 7, 6, 7, 8, 7, 7, 8, 7, 8, 7, 8, 8, 5,
- 5, 8, 9, 9, 9, 9, 12, 10, 10, 11, 10, 10, 10, 11, 11, 8,
- 9, 10, 13, 12, 13, 12, 15, 13, 13, 14, 13, 14, 13, 13, 14, 11,
- 5, 10, 9, 10, 10, 10, 12, 10, 10, 12, 10, 11, 11, 11, 11, 8,
- 6, 9, 10, 9, 10, 11, 12, 10, 10, 12, 11, 11, 10, 11, 11, 8,
- 9, 11, 12, 11, 12, 13, 14, 12, 13, 14, 14, 12, 13, 13, 13, 11,
- 10, 13, 11, 12, 14, 14, 15, 13, 13, 15, 12, 13, 14, 14, 14, 12,
- 9, 12, 12, 12, 13, 13, 15, 13, 13, 14, 13, 13, 14, 13, 15, 11,
- 8, 11, 12, 10, 12, 13, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
- 5, 9, 10, 10, 9, 10, 12, 11, 10, 12, 11, 11, 9, 11, 11, 9,
- 6, 10, 10, 11, 10, 10, 12, 11, 11, 12, 11, 11, 11, 11, 11, 9,
- 9, 11, 13, 13, 12, 11, 14, 12, 13, 15, 13, 13, 14, 13, 14, 11,
- 8, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 13, 12, 12, 12, 10,
- 7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 12, 9,
- 9, 12, 12, 12, 12, 12, 14, 12, 13, 14, 13, 13, 13, 13, 13, 11,
- 11, 14, 13, 15, 15, 16, 16, 15, 15, 16, 15, 15, 16, 16, 15, 13,
- 10, 12, 13, 13, 13, 14, 15, 13, 13, 14, 13, 13, 14, 14, 14, 11,
- 9, 12, 12, 12, 13, 13, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
- 9, 13, 13, 13, 11, 12, 15, 13, 13, 15, 14, 14, 11, 13, 14, 11,
- 10, 13, 13, 13, 12, 12, 15, 13, 13, 15, 14, 14, 13, 13, 14, 11,
- 10, 12, 13, 13, 12, 11, 14, 12, 13, 15, 13, 13, 13, 13, 14, 11,
- 11, 14, 15, 15, 13, 14, 16, 14, 14, 16, 16, 14, 14, 15, 15, 13,
- 10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 14, 14, 13, 13, 14, 11,
- 10, 12, 13, 13, 13, 12, 14, 13, 13, 14, 14, 13, 13, 13, 13, 11,
- 13, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 12, 15, 15, 15, 14, 15, 16, 14, 15, 16, 16, 15, 16, 15, 15, 13,
- 10, 12, 12, 12, 13, 13, 14, 12, 13, 14, 13, 13, 13, 13, 13, 11,
- 6, 10, 10, 11, 10, 11, 12, 11, 10, 12, 11, 11, 10, 11, 11, 9,
- 8, 11, 12, 12, 12, 12, 13, 12, 12, 13, 12, 13, 12, 13, 13, 10,
- 11, 13, 15, 14, 15, 14, 16, 14, 15, 16, 16, 14, 15, 15, 15, 13,
- 7, 11, 10, 12, 11, 11, 13, 11, 11, 13, 10, 11, 12, 12, 12, 10,
- 7, 11, 11, 11, 11, 11, 13, 11, 11, 13, 11, 12, 12, 12, 12, 9,
- 10, 12, 13, 13, 13, 13, 15, 13, 14, 15, 14, 14, 14, 14, 15, 11,
- 10, 13, 12, 14, 14, 14, 15, 13, 13, 15, 12, 13, 15, 15, 14, 12,
- 10, 13, 12, 12, 13, 13, 15, 14, 13, 15, 13, 13, 14, 14, 14, 11,
- 10, 13, 13, 12, 13, 14, 15, 13, 13, 15, 13, 13, 14, 14, 14, 11,
- 7, 10, 11, 11, 10, 11, 12, 11, 10, 12, 12, 12, 9, 11, 12, 9,
- 7, 11, 11, 11, 11, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 9,
- 10, 12, 14, 13, 13, 13, 16, 13, 14, 16, 14, 14, 13, 13, 14, 11,
- 8, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
- 6, 9, 9, 10, 9, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 8,
- 8, 11, 11, 11, 12, 11, 13, 11, 12, 13, 12, 12, 12, 12, 12, 10,
- 11, 14, 13, 14, 14, 14, 16, 14, 14, 16, 14, 14, 15, 15, 14, 12,
- 9, 12, 11, 12, 12, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
- 8, 11, 11, 11, 11, 11, 13, 11, 12, 12, 12, 12, 12, 12, 12, 9,
- 10, 13, 14, 13, 11, 13, 14, 14, 13, 15, 15, 14, 10, 13, 14, 11,
- 10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 14, 14, 13, 13, 13, 11,
- 10, 13, 14, 13, 13, 12, 15, 13, 14, 15, 14, 14, 14, 13, 14, 12,
- 11, 14, 14, 14, 13, 13, 15, 14, 14, 15, 14, 15, 13, 14, 14, 12,
- 9, 11, 12, 12, 11, 11, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
- 9, 11, 12, 12, 12, 11, 13, 11, 12, 13, 12, 12, 12, 12, 12, 10,
- 13, 15, 15, 16, 15, 16, 16, 15, 16, 16, 16, 15, 15, 15, 16, 14,
- 10, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 13, 13, 13, 13, 11,
- 8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 12, 11, 12, 9,
- 11, 14, 14, 15, 14, 15, 15, 14, 13, 15, 14, 15, 12, 14, 15, 13,
- 12, 15, 15, 15, 15, 15, 16, 15, 15, 16, 16, 16, 15, 16, 15, 13,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 11, 14, 13, 15, 14, 14, 16, 14, 14, 16, 13, 14, 15, 14, 15, 12,
- 11, 14, 13, 14, 14, 14, 16, 15, 14, 16, 14, 14, 15, 15, 15, 12,
- 13, 15, 15, 15, 15, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 13,
- 11, 14, 13, 14, 14, 14, 15, 14, 14, 16, 12, 14, 16, 16, 14, 12,
- 11, 14, 14, 14, 14, 15, 16, 15, 14, 16, 13, 14, 16, 15, 14, 12,
- 12, 14, 14, 14, 14, 14, 16, 14, 15, 16, 14, 14, 14, 15, 15, 12,
- 11, 14, 14, 14, 13, 14, 16, 15, 13, 16, 15, 15, 11, 14, 14, 12,
- 11, 14, 14, 15, 14, 14, 16, 14, 14, 15, 14, 14, 13, 15, 15, 12,
- 13, 15, 16, 15, 15, 15, 16, 15, 16, 16, 16, 16, 15, 15, 16, 13,
- 11, 14, 14, 14, 14, 14, 15, 14, 14, 16, 14, 14, 14, 15, 14, 12,
- 9, 12, 12, 12, 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 12, 10,
- 11, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 14, 13, 13, 14, 11,
- 12, 15, 14, 15, 15, 15, 16, 15, 14, 16, 14, 14, 16, 16, 14, 13,
- 10, 12, 12, 12, 12, 12, 14, 12, 13, 13, 12, 12, 13, 13, 13, 10,
- 10, 12, 12, 12, 12, 12, 14, 12, 12, 13, 12, 12, 12, 12, 12, 10,
- 10, 14, 14, 14, 12, 14, 16, 14, 13, 16, 16, 16, 10, 13, 14, 12,
- 11, 14, 14, 14, 13, 14, 16, 14, 14, 16, 15, 14, 12, 13, 14, 12,
- 12, 14, 14, 14, 14, 14, 16, 14, 14, 16, 15, 15, 14, 14, 15, 12,
- 12, 14, 15, 15, 14, 15, 16, 14, 15, 15, 15, 15, 13, 15, 14, 12,
- 9, 12, 12, 12, 12, 13, 13, 12, 12, 13, 13, 12, 11, 12, 12, 10,
- 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
- 13, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 15, 13,
- 10, 12, 12, 13, 12, 13, 13, 12, 13, 14, 13, 13, 12, 13, 13, 10,
- 7, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 7,
- },
- },
- {
- {
- 10, 10, 9, 8, 9, 8, 9, 7, 9, 9, 8, 7, 8, 7, 7, 4,
- 13, 11, 12, 9, 12, 9, 12, 9, 12, 11, 11, 9, 10, 9, 9, 6,
- 15, 12, 15, 11, 14, 10, 14, 10, 14, 13, 13, 11, 13, 11, 12, 7,
- 13, 12, 11, 9, 12, 11, 12, 9, 12, 12, 10, 9, 10, 10, 9, 6,
- 14, 13, 12, 10, 13, 12, 13, 9, 13, 12, 11, 10, 12, 11, 10, 6,
- 16, 14, 14, 10, 15, 13, 14, 10, 15, 15, 14, 11, 14, 12, 12, 8,
- 15, 14, 12, 11, 15, 14, 13, 11, 14, 14, 11, 10, 13, 12, 11, 8,
- 15, 16, 13, 11, 16, 14, 14, 11, 15, 15, 12, 10, 14, 13, 12, 8,
- 16, 15, 14, 10, 16, 14, 14, 10, 16, 15, 14, 10, 14, 13, 12, 7,
- 13, 12, 12, 11, 11, 9, 12, 9, 12, 12, 11, 10, 10, 9, 9, 6,
- 13, 13, 14, 12, 12, 10, 12, 10, 14, 13, 12, 11, 11, 10, 10, 7,
- 16, 14, 16, 13, 14, 11, 15, 10, 16, 15, 14, 12, 14, 11, 12, 8,
- 14, 14, 13, 12, 13, 12, 13, 10, 13, 13, 12, 11, 11, 10, 10, 7,
- 15, 14, 14, 12, 14, 12, 13, 10, 14, 13, 12, 11, 12, 11, 11, 7,
- 16, 15, 16, 13, 15, 13, 15, 10, 16, 15, 14, 12, 14, 12, 12, 7,
- 15, 16, 14, 13, 16, 14, 14, 12, 15, 15, 12, 12, 13, 12, 12, 8,
- 16, 16, 14, 13, 16, 14, 14, 11, 15, 15, 14, 11, 14, 12, 12, 8,
- 16, 16, 15, 12, 16, 14, 15, 10, 16, 16, 13, 12, 14, 13, 12, 7,
- 14, 14, 14, 13, 13, 11, 13, 11, 14, 14, 13, 12, 11, 10, 11, 8,
- 16, 15, 16, 13, 13, 11, 14, 11, 15, 14, 14, 13, 12, 11, 12, 8,
- 15, 15, 16, 14, 14, 10, 14, 10, 16, 15, 15, 13, 14, 10, 12, 8,
- 16, 16, 16, 14, 15, 13, 14, 12, 15, 15, 13, 13, 13, 12, 12, 8,
- 16, 16, 16, 14, 15, 13, 14, 11, 16, 16, 14, 13, 13, 12, 12, 8,
- 16, 16, 16, 14, 16, 12, 15, 11, 16, 15, 15, 13, 14, 12, 12, 8,
- 16, 16, 16, 16, 16, 15, 15, 13, 16, 16, 14, 13, 14, 13, 12, 9,
- 16, 16, 16, 14, 16, 15, 15, 11, 16, 16, 14, 13, 15, 13, 12, 8,
- 16, 16, 16, 14, 16, 14, 14, 10, 16, 16, 15, 13, 14, 12, 12, 7,
- 12, 12, 12, 11, 12, 11, 12, 10, 11, 11, 10, 9, 9, 9, 9, 6,
- 14, 13, 14, 12, 13, 12, 13, 10, 13, 13, 12, 10, 12, 10, 11, 7,
- 16, 14, 16, 13, 15, 13, 16, 12, 15, 14, 14, 12, 14, 12, 13, 8,
- 14, 14, 13, 11, 14, 12, 13, 11, 12, 12, 10, 10, 11, 10, 10, 7,
- 14, 14, 13, 12, 14, 12, 13, 11, 13, 13, 12, 10, 12, 11, 10, 7,
- 16, 15, 15, 12, 16, 14, 15, 11, 16, 14, 13, 11, 14, 12, 12, 8,
- 16, 16, 13, 13, 16, 15, 14, 12, 14, 14, 11, 11, 13, 12, 11, 8,
- 16, 16, 14, 12, 16, 14, 14, 12, 15, 14, 12, 11, 14, 12, 12, 8,
- 16, 15, 14, 11, 16, 15, 15, 11, 16, 15, 13, 11, 14, 13, 12, 8,
- 14, 13, 13, 12, 13, 11, 13, 10, 12, 13, 11, 10, 10, 10, 10, 7,
- 15, 14, 14, 13, 13, 12, 13, 11, 14, 13, 12, 11, 12, 10, 11, 7,
- 16, 15, 16, 14, 15, 12, 15, 11, 16, 14, 14, 12, 14, 11, 12, 8,
- 14, 15, 13, 12, 14, 13, 13, 11, 13, 13, 11, 11, 11, 10, 10, 7,
- 14, 14, 14, 12, 14, 13, 13, 10, 14, 13, 12, 10, 12, 10, 10, 6,
- 16, 15, 15, 13, 16, 13, 15, 11, 15, 14, 13, 11, 13, 11, 11, 7,
- 16, 16, 14, 13, 16, 15, 14, 12, 15, 15, 12, 11, 13, 12, 11, 8,
- 16, 16, 14, 13, 16, 14, 14, 11, 15, 14, 12, 11, 13, 12, 11, 7,
- 16, 16, 15, 12, 16, 14, 14, 11, 15, 15, 13, 11, 14, 12, 11, 6,
- 16, 15, 15, 14, 14, 12, 14, 12, 13, 14, 13, 12, 11, 11, 11, 8,
- 16, 16, 16, 14, 14, 12, 15, 12, 15, 14, 14, 12, 12, 11, 12, 8,
- 16, 16, 16, 15, 14, 12, 15, 12, 16, 15, 14, 13, 13, 11, 12, 8,
- 16, 16, 16, 15, 15, 14, 15, 12, 14, 14, 13, 12, 12, 11, 11, 8,
- 16, 16, 15, 14, 14, 12, 14, 11, 14, 14, 13, 12, 12, 11, 11, 7,
- 16, 16, 16, 14, 15, 12, 14, 11, 15, 15, 14, 12, 13, 11, 12, 7,
- 16, 16, 16, 16, 16, 15, 16, 13, 15, 15, 14, 12, 13, 12, 11, 8,
- 16, 16, 16, 14, 15, 14, 14, 12, 16, 15, 13, 12, 13, 12, 11, 7,
- 16, 16, 16, 13, 16, 13, 14, 10, 16, 15, 14, 11, 13, 11, 11, 6,
- 14, 15, 13, 13, 14, 13, 14, 12, 12, 13, 11, 11, 11, 11, 10, 8,
- 16, 16, 15, 13, 16, 14, 16, 13, 14, 14, 13, 12, 13, 12, 12, 8,
- 16, 16, 16, 14, 16, 14, 16, 13, 16, 14, 15, 13, 15, 13, 13, 9,
- 15, 15, 14, 14, 15, 14, 14, 12, 13, 14, 11, 11, 12, 12, 11, 8,
- 15, 16, 15, 13, 15, 14, 14, 12, 14, 14, 12, 11, 13, 12, 12, 8,
- 16, 16, 16, 13, 16, 15, 15, 13, 16, 15, 14, 11, 15, 12, 13, 8,
- 16, 16, 14, 13, 16, 15, 15, 13, 14, 14, 10, 11, 14, 12, 11, 8,
- 16, 16, 15, 13, 16, 16, 15, 13, 15, 14, 12, 11, 14, 13, 12, 8,
- 16, 16, 15, 13, 16, 15, 16, 12, 16, 14, 13, 10, 15, 13, 12, 7,
- 15, 15, 15, 14, 14, 14, 15, 12, 13, 14, 12, 12, 11, 11, 11, 8,
- 16, 15, 16, 14, 15, 13, 15, 12, 14, 14, 13, 12, 12, 11, 12, 8,
- 16, 16, 16, 15, 16, 14, 16, 13, 16, 15, 14, 12, 14, 11, 13, 8,
- 16, 16, 15, 14, 16, 14, 15, 13, 14, 14, 12, 11, 12, 11, 11, 8,
- 15, 16, 15, 14, 15, 14, 14, 12, 14, 13, 12, 11, 12, 11, 11, 7,
- 16, 16, 16, 14, 16, 13, 16, 12, 15, 14, 13, 11, 13, 11, 12, 7,
- 16, 16, 15, 14, 16, 15, 15, 13, 14, 15, 11, 11, 13, 12, 11, 8,
- 16, 16, 15, 13, 16, 14, 15, 12, 15, 14, 12, 11, 13, 11, 11, 7,
- 16, 16, 15, 13, 16, 14, 16, 12, 15, 14, 13, 10, 13, 11, 11, 6,
- 16, 16, 16, 14, 14, 14, 15, 13, 14, 14, 14, 12, 11, 11, 11, 8,
- 16, 16, 16, 14, 15, 14, 16, 13, 15, 14, 14, 13, 12, 11, 11, 7,
- 16, 16, 16, 16, 15, 13, 16, 12, 15, 15, 14, 12, 13, 10, 12, 7,
- 16, 16, 16, 14, 15, 15, 14, 13, 14, 14, 13, 12, 12, 11, 11, 8,
- 16, 15, 16, 14, 16, 13, 15, 12, 14, 14, 13, 12, 12, 10, 10, 6,
- 16, 15, 16, 14, 16, 13, 16, 11, 16, 14, 13, 11, 13, 10, 11, 6,
- 16, 16, 16, 15, 16, 16, 15, 13, 14, 16, 12, 12, 12, 12, 10, 7,
- 16, 16, 16, 14, 16, 14, 14, 12, 15, 15, 12, 11, 12, 11, 10, 6,
- 16, 16, 16, 13, 16, 13, 15, 10, 15, 14, 13, 10, 13, 10, 10, 4,
- },
- {
- 1, 6, 6, 7, 6, 7, 9, 8, 7, 9, 7, 8, 7, 8, 8, 6,
- 6, 9, 10, 10, 10, 10, 12, 11, 10, 12, 11, 11, 11, 11, 12, 9,
- 9, 10, 13, 11, 13, 12, 14, 13, 14, 14, 14, 14, 14, 14, 14, 12,
- 6, 10, 9, 10, 10, 11, 13, 11, 11, 13, 10, 12, 11, 12, 12, 9,
- 6, 10, 10, 10, 10, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 9,
- 9, 11, 13, 12, 13, 14, 15, 13, 14, 16, 14, 14, 14, 14, 15, 12,
- 10, 13, 11, 13, 14, 14, 16, 14, 14, 15, 13, 14, 15, 15, 16, 12,
- 9, 13, 12, 12, 14, 14, 16, 14, 14, 15, 14, 14, 15, 15, 15, 12,
- 8, 11, 12, 11, 13, 14, 15, 13, 13, 15, 14, 14, 13, 15, 15, 11,
- 6, 10, 10, 11, 9, 10, 13, 11, 10, 13, 11, 12, 10, 12, 12, 9,
- 6, 10, 10, 11, 11, 10, 13, 11, 11, 13, 11, 12, 12, 12, 13, 10,
- 9, 12, 13, 13, 13, 12, 16, 13, 14, 15, 14, 14, 15, 14, 15, 12,
- 8, 12, 12, 13, 12, 13, 15, 14, 13, 15, 13, 14, 13, 13, 14, 11,
- 7, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 13, 12, 13, 13, 10,
- 9, 12, 13, 13, 13, 13, 16, 13, 13, 15, 14, 14, 14, 15, 15, 12,
- 11, 15, 14, 15, 15, 16, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
- 10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 15, 15, 15, 15, 16, 13,
- 9, 12, 13, 13, 13, 14, 16, 14, 13, 15, 14, 14, 14, 16, 15, 12,
- 10, 13, 14, 14, 11, 13, 16, 14, 14, 16, 15, 15, 12, 14, 15, 12,
- 10, 13, 14, 14, 12, 12, 16, 15, 14, 16, 15, 15, 14, 14, 16, 12,
- 9, 12, 13, 14, 13, 11, 16, 13, 14, 15, 13, 14, 14, 14, 15, 12,
- 11, 15, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 13, 14, 14, 13, 14, 16, 15, 14, 16, 16, 16, 14, 15, 16, 13,
- 10, 13, 13, 14, 13, 13, 16, 13, 13, 14, 14, 15, 15, 14, 15, 13,
- 13, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 12, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 12, 13, 14, 13, 13, 14, 13, 13, 14, 13, 14, 14, 14, 15, 12,
- 6, 10, 11, 11, 10, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 10,
- 8, 12, 13, 13, 12, 13, 14, 14, 13, 15, 14, 14, 14, 14, 15, 12,
- 12, 14, 16, 15, 15, 15, 16, 15, 16, 16, 16, 16, 16, 16, 16, 14,
- 7, 11, 11, 12, 12, 12, 14, 13, 12, 14, 11, 12, 13, 13, 13, 11,
- 8, 11, 12, 12, 12, 12, 14, 13, 12, 14, 12, 13, 13, 14, 14, 11,
- 11, 13, 14, 14, 14, 14, 16, 15, 15, 16, 15, 15, 16, 16, 16, 13,
- 10, 14, 12, 14, 14, 15, 16, 15, 13, 16, 12, 14, 16, 16, 15, 13,
- 10, 13, 13, 14, 14, 15, 16, 15, 14, 16, 14, 15, 15, 16, 16, 12,
- 10, 13, 14, 13, 14, 14, 16, 15, 14, 16, 15, 15, 14, 16, 16, 13,
- 7, 11, 11, 11, 10, 12, 14, 13, 11, 14, 13, 13, 10, 12, 13, 10,
- 8, 11, 12, 12, 11, 12, 14, 13, 12, 15, 13, 13, 12, 13, 14, 11,
- 11, 13, 14, 14, 14, 14, 16, 15, 14, 16, 15, 16, 16, 16, 16, 14,
- 8, 12, 12, 13, 12, 13, 15, 14, 12, 15, 13, 13, 13, 14, 14, 11,
- 6, 10, 10, 11, 10, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 9,
- 9, 12, 13, 13, 13, 13, 14, 13, 13, 15, 14, 14, 14, 14, 14, 12,
- 11, 15, 14, 15, 14, 15, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
- 9, 13, 12, 13, 13, 13, 15, 14, 13, 14, 13, 14, 14, 15, 14, 12,
- 9, 12, 12, 12, 12, 13, 14, 13, 13, 14, 13, 13, 13, 13, 14, 11,
- 10, 13, 15, 14, 12, 14, 16, 14, 14, 16, 15, 15, 12, 14, 16, 12,
- 10, 14, 14, 14, 13, 14, 16, 15, 14, 16, 16, 16, 13, 14, 16, 13,
- 11, 13, 14, 14, 14, 13, 16, 14, 14, 16, 15, 15, 15, 15, 16, 13,
- 11, 15, 15, 15, 14, 15, 16, 16, 15, 16, 16, 16, 14, 16, 16, 13,
- 9, 13, 13, 13, 12, 13, 15, 14, 13, 15, 14, 14, 13, 14, 15, 11,
- 9, 12, 12, 13, 12, 12, 14, 13, 13, 14, 13, 14, 14, 14, 14, 11,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 11, 14, 14, 15, 15, 14, 16, 16, 14, 16, 14, 15, 15, 16, 16, 12,
- 9, 12, 12, 13, 12, 12, 14, 12, 12, 14, 13, 13, 13, 13, 14, 11,
- 11, 14, 14, 16, 14, 16, 16, 16, 13, 16, 14, 16, 14, 16, 16, 13,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 15, 14, 16, 14, 15, 16, 16, 15, 16, 14, 15, 16, 16, 16, 13,
- 11, 15, 14, 16, 15, 16, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 11, 14, 13, 14, 15, 14, 16, 15, 14, 16, 12, 14, 16, 16, 15, 13,
- 11, 14, 14, 16, 14, 15, 16, 16, 15, 16, 14, 15, 16, 16, 16, 14,
- 12, 14, 14, 15, 14, 16, 16, 15, 14, 16, 15, 15, 15, 16, 16, 13,
- 11, 14, 15, 15, 13, 15, 16, 16, 14, 16, 16, 16, 12, 15, 15, 13,
- 11, 15, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 11, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 14, 15, 14, 14, 15, 12,
- 12, 15, 14, 16, 14, 15, 16, 15, 15, 16, 15, 15, 16, 15, 16, 13,
- 12, 16, 14, 16, 15, 16, 16, 16, 16, 16, 14, 15, 16, 16, 16, 14,
- 10, 13, 13, 14, 14, 13, 16, 14, 13, 16, 13, 14, 15, 15, 15, 12,
- 10, 13, 13, 14, 13, 13, 16, 14, 14, 15, 14, 14, 14, 14, 15, 12,
- 10, 14, 15, 14, 13, 15, 16, 15, 14, 16, 16, 16, 11, 14, 16, 12,
- 11, 14, 14, 16, 14, 15, 16, 15, 15, 16, 16, 16, 13, 15, 16, 13,
- 12, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13,
- 12, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
- 10, 13, 14, 14, 13, 14, 16, 14, 13, 16, 15, 14, 12, 14, 16, 11,
- 10, 13, 13, 14, 13, 14, 16, 14, 14, 15, 14, 14, 13, 14, 14, 11,
- 13, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 11, 13, 14, 15, 14, 14, 16, 15, 14, 16, 14, 15, 14, 15, 16, 12,
- 8, 11, 11, 11, 11, 12, 13, 12, 11, 13, 11, 12, 11, 12, 12, 9,
- },
- },
- {
- {
- 8, 8, 8, 7, 8, 7, 8, 6, 8, 8, 7, 6, 7, 6, 6, 4,
- 11, 10, 11, 9, 11, 9, 11, 8, 11, 10, 10, 9, 10, 8, 9, 6,
- 13, 11, 13, 10, 12, 10, 13, 9, 13, 12, 13, 10, 12, 10, 11, 7,
- 11, 11, 10, 9, 11, 10, 11, 9, 10, 11, 9, 8, 10, 9, 9, 6,
- 12, 12, 11, 9, 12, 11, 12, 9, 12, 12, 11, 9, 11, 10, 10, 7,
- 14, 13, 13, 10, 15, 12, 13, 10, 15, 13, 13, 10, 13, 12, 12, 8,
- 13, 13, 11, 10, 14, 13, 12, 10, 13, 13, 10, 10, 12, 11, 10, 8,
- 15, 14, 13, 10, 14, 13, 13, 10, 14, 13, 12, 10, 13, 12, 11, 8,
- 14, 14, 13, 10, 16, 13, 13, 10, 15, 14, 13, 10, 13, 12, 12, 8,
- 11, 11, 11, 10, 10, 9, 10, 9, 10, 10, 10, 9, 9, 8, 9, 6,
- 12, 12, 12, 11, 11, 9, 12, 9, 12, 12, 11, 10, 11, 9, 10, 7,
- 14, 13, 14, 12, 13, 10, 13, 10, 15, 13, 14, 12, 12, 10, 12, 8,
- 13, 13, 12, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10, 7,
- 14, 13, 13, 11, 13, 12, 12, 10, 13, 13, 12, 11, 12, 10, 10, 7,
- 16, 15, 15, 12, 14, 12, 13, 10, 15, 14, 13, 12, 13, 12, 12, 8,
- 15, 15, 13, 13, 14, 14, 14, 12, 14, 14, 12, 11, 13, 12, 11, 8,
- 15, 16, 14, 12, 15, 14, 13, 11, 15, 15, 13, 12, 13, 12, 11, 8,
- 16, 15, 15, 12, 16, 14, 14, 10, 15, 15, 14, 12, 14, 12, 12, 8,
- 13, 13, 13, 13, 11, 10, 12, 10, 12, 13, 12, 11, 10, 10, 10, 8,
- 14, 13, 14, 13, 12, 10, 13, 10, 14, 14, 13, 12, 12, 10, 11, 8,
- 15, 14, 16, 14, 13, 10, 14, 10, 16, 14, 14, 13, 13, 10, 12, 8,
- 15, 15, 14, 14, 14, 13, 13, 12, 14, 14, 13, 12, 12, 11, 11, 9,
- 15, 15, 15, 14, 14, 12, 14, 11, 15, 14, 13, 13, 13, 11, 11, 8,
- 16, 15, 16, 14, 15, 12, 14, 11, 16, 16, 15, 13, 14, 12, 12, 8,
- 16, 16, 16, 14, 15, 14, 14, 12, 15, 15, 14, 13, 13, 12, 11, 9,
- 16, 16, 15, 15, 16, 14, 14, 11, 16, 16, 14, 13, 14, 12, 12, 8,
- 16, 16, 16, 13, 15, 13, 14, 10, 16, 16, 15, 13, 14, 12, 12, 8,
- 11, 11, 11, 10, 11, 10, 11, 9, 10, 10, 9, 8, 9, 9, 9, 6,
- 12, 12, 13, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10, 7,
- 15, 13, 15, 12, 14, 13, 14, 11, 14, 13, 13, 11, 13, 11, 12, 8,
- 12, 13, 12, 11, 13, 11, 12, 10, 11, 12, 10, 9, 11, 10, 10, 7,
- 14, 13, 13, 11, 14, 12, 13, 11, 12, 12, 11, 10, 12, 11, 10, 7,
- 15, 14, 15, 12, 15, 13, 15, 11, 15, 14, 13, 11, 13, 12, 12, 8,
- 14, 14, 13, 12, 15, 14, 13, 12, 13, 13, 11, 10, 13, 12, 11, 8,
- 16, 15, 13, 12, 15, 14, 14, 12, 14, 14, 12, 11, 14, 12, 11, 8,
- 16, 15, 14, 12, 16, 15, 15, 11, 15, 14, 13, 11, 14, 13, 12, 8,
- 12, 12, 12, 11, 12, 11, 12, 10, 11, 11, 11, 10, 10, 9, 9, 7,
- 13, 13, 14, 12, 13, 11, 13, 11, 13, 12, 12, 11, 11, 10, 10, 7,
- 15, 14, 16, 13, 14, 12, 14, 11, 14, 14, 14, 12, 13, 11, 12, 8,
- 13, 13, 13, 12, 13, 12, 13, 11, 12, 12, 11, 10, 11, 10, 10, 7,
- 14, 14, 13, 12, 13, 12, 13, 10, 13, 13, 11, 10, 12, 10, 10, 7,
- 16, 15, 15, 13, 15, 12, 14, 11, 15, 14, 13, 11, 13, 11, 11, 7,
- 15, 16, 14, 13, 15, 14, 14, 12, 14, 14, 12, 11, 13, 12, 11, 8,
- 16, 15, 14, 13, 15, 14, 14, 11, 14, 14, 12, 11, 13, 12, 11, 7,
- 16, 15, 15, 12, 16, 14, 14, 11, 15, 14, 13, 11, 14, 12, 11, 7,
- 14, 15, 14, 14, 13, 12, 13, 12, 13, 13, 12, 12, 11, 10, 11, 8,
- 15, 15, 15, 14, 13, 12, 14, 12, 14, 14, 13, 12, 12, 11, 11, 8,
- 16, 15, 16, 14, 14, 12, 15, 12, 16, 14, 14, 13, 13, 11, 12, 8,
- 15, 15, 15, 14, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 8,
- 15, 15, 15, 14, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 7,
- 16, 15, 16, 14, 15, 12, 15, 11, 15, 14, 14, 12, 13, 11, 12, 7,
- 16, 16, 16, 15, 16, 15, 14, 13, 15, 15, 13, 12, 13, 12, 11, 9,
- 16, 16, 16, 14, 15, 14, 14, 12, 15, 15, 13, 12, 14, 12, 11, 8,
- 16, 16, 16, 14, 16, 14, 14, 11, 15, 15, 14, 12, 14, 12, 11, 7,
- 13, 13, 13, 12, 13, 12, 13, 11, 11, 12, 11, 10, 10, 10, 10, 8,
- 15, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 13, 11, 11, 8,
- 16, 15, 16, 14, 16, 14, 16, 13, 15, 14, 14, 12, 14, 12, 13, 9,
- 14, 15, 13, 13, 14, 13, 14, 12, 12, 13, 11, 11, 12, 11, 11, 8,
- 15, 15, 14, 13, 15, 14, 14, 12, 13, 13, 12, 11, 13, 12, 11, 8,
- 16, 16, 16, 13, 16, 15, 16, 13, 15, 14, 14, 12, 14, 13, 13, 9,
- 14, 15, 13, 13, 16, 15, 15, 13, 13, 14, 11, 11, 13, 12, 11, 9,
- 16, 16, 14, 13, 16, 15, 16, 13, 14, 14, 12, 11, 14, 13, 12, 8,
- 16, 16, 15, 12, 16, 15, 15, 12, 15, 14, 13, 11, 14, 13, 12, 8,
- 14, 14, 14, 13, 14, 13, 14, 12, 12, 13, 12, 11, 11, 11, 11, 8,
- 15, 15, 15, 14, 14, 13, 15, 12, 14, 13, 13, 12, 12, 11, 11, 8,
- 16, 16, 16, 15, 15, 14, 16, 13, 15, 14, 14, 12, 14, 12, 12, 9,
- 15, 15, 14, 14, 14, 14, 14, 13, 13, 14, 12, 11, 12, 11, 11, 8,
- 15, 15, 15, 13, 15, 14, 14, 12, 13, 13, 12, 11, 12, 11, 11, 7,
- 16, 15, 16, 14, 16, 14, 15, 12, 15, 14, 14, 12, 13, 12, 12, 8,
- 16, 16, 15, 14, 16, 15, 15, 13, 14, 14, 12, 11, 13, 12, 11, 8,
- 16, 16, 15, 13, 16, 14, 14, 12, 14, 15, 12, 11, 13, 12, 11, 7,
- 16, 16, 16, 13, 16, 15, 15, 12, 15, 14, 13, 11, 14, 12, 11, 7,
- 15, 15, 15, 14, 13, 13, 14, 13, 13, 14, 13, 12, 11, 11, 11, 8,
- 16, 16, 16, 14, 15, 13, 15, 12, 14, 14, 14, 13, 12, 11, 12, 8,
- 16, 16, 16, 14, 15, 13, 15, 12, 15, 14, 14, 12, 13, 11, 12, 8,
- 15, 16, 16, 14, 15, 14, 15, 13, 14, 14, 12, 12, 11, 11, 11, 8,
- 16, 15, 15, 14, 15, 14, 14, 12, 14, 14, 13, 12, 12, 11, 11, 7,
- 16, 16, 16, 13, 15, 13, 15, 12, 15, 14, 14, 12, 13, 11, 11, 7,
- 16, 16, 16, 15, 15, 16, 15, 13, 14, 14, 12, 12, 12, 12, 11, 8,
- 16, 16, 16, 14, 16, 14, 14, 12, 15, 15, 13, 11, 12, 11, 10, 7,
- 16, 16, 15, 13, 16, 14, 14, 11, 15, 14, 13, 10, 13, 11, 10, 5,
- },
- {
- 1, 6, 6, 7, 6, 7, 9, 7, 6, 9, 7, 8, 7, 8, 8, 5,
- 5, 8, 10, 10, 10, 10, 12, 11, 11, 12, 11, 11, 11, 12, 12, 9,
- 9, 10, 12, 11, 13, 12, 15, 13, 14, 15, 15, 14, 14, 15, 15, 12,
- 6, 10, 9, 10, 10, 11, 13, 12, 11, 13, 11, 12, 12, 12, 12, 10,
- 6, 10, 10, 10, 11, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 10,
- 9, 12, 13, 12, 13, 13, 16, 13, 14, 16, 15, 14, 14, 15, 16, 12,
- 9, 13, 11, 13, 14, 14, 16, 15, 14, 16, 13, 15, 15, 15, 15, 12,
- 9, 13, 12, 13, 14, 15, 16, 15, 14, 16, 15, 15, 15, 15, 16, 12,
- 8, 12, 12, 11, 13, 14, 15, 13, 13, 15, 14, 14, 14, 14, 14, 12,
- 6, 10, 10, 11, 9, 10, 13, 11, 11, 13, 12, 12, 10, 12, 12, 9,
- 6, 10, 11, 11, 11, 10, 13, 12, 11, 13, 12, 12, 12, 12, 13, 10,
- 9, 12, 13, 13, 13, 12, 16, 13, 14, 16, 14, 15, 16, 14, 15, 12,
- 8, 12, 13, 13, 13, 13, 16, 14, 13, 16, 13, 14, 14, 14, 14, 12,
- 7, 11, 11, 12, 11, 12, 14, 13, 12, 14, 13, 13, 12, 13, 13, 11,
- 9, 12, 13, 13, 13, 13, 15, 14, 14, 16, 16, 15, 15, 15, 16, 12,
- 11, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 14, 14, 15, 15, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
- 9, 13, 13, 13, 14, 14, 16, 14, 14, 16, 15, 14, 14, 16, 16, 13,
- 9, 13, 14, 14, 11, 13, 16, 14, 13, 16, 15, 16, 13, 14, 15, 12,
- 10, 13, 14, 15, 13, 12, 16, 14, 14, 16, 15, 15, 14, 14, 16, 13,
- 9, 12, 13, 14, 12, 11, 15, 13, 13, 15, 13, 14, 15, 14, 16, 12,
- 11, 15, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13,
- 11, 14, 14, 15, 13, 14, 16, 15, 15, 16, 16, 16, 16, 16, 16, 13,
- 10, 12, 13, 14, 13, 13, 16, 14, 14, 14, 14, 16, 15, 14, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 9, 12, 13, 14, 13, 13, 16, 13, 13, 15, 15, 16, 15, 15, 16, 12,
- 6, 11, 11, 12, 10, 12, 13, 12, 11, 13, 11, 12, 11, 12, 13, 10,
- 9, 12, 13, 13, 13, 13, 16, 14, 14, 15, 14, 14, 14, 14, 14, 12,
- 12, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 7, 11, 11, 12, 12, 12, 14, 13, 12, 14, 11, 13, 13, 13, 13, 11,
- 8, 12, 12, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13, 14, 14, 11,
- 11, 14, 14, 15, 16, 15, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13,
- 10, 14, 12, 14, 15, 15, 16, 16, 14, 16, 12, 15, 16, 16, 16, 13,
- 11, 14, 13, 15, 15, 15, 16, 16, 14, 16, 14, 14, 16, 16, 16, 13,
- 11, 14, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 13,
- 7, 11, 12, 11, 10, 12, 14, 13, 12, 14, 13, 13, 10, 12, 13, 10,
- 8, 12, 12, 13, 12, 12, 15, 13, 13, 14, 13, 13, 13, 13, 14, 11,
- 11, 13, 15, 16, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 9, 12, 13, 13, 13, 13, 15, 14, 13, 15, 13, 14, 13, 14, 14, 12,
- 7, 11, 11, 11, 11, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 10,
- 9, 12, 13, 13, 13, 13, 16, 13, 14, 16, 15, 14, 14, 14, 16, 12,
- 12, 14, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
- 10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 14, 14, 16, 15, 15, 12,
- 9, 12, 13, 13, 13, 15, 16, 14, 13, 16, 14, 13, 13, 14, 14, 11,
- 10, 14, 15, 14, 12, 14, 16, 15, 13, 16, 16, 16, 12, 14, 16, 12,
- 11, 14, 14, 14, 14, 14, 16, 15, 15, 16, 16, 16, 14, 15, 16, 13,
- 11, 14, 14, 16, 14, 13, 16, 15, 14, 16, 15, 16, 15, 15, 16, 13,
- 12, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14,
- 10, 13, 14, 14, 13, 14, 16, 14, 13, 16, 15, 15, 13, 14, 14, 12,
- 9, 12, 13, 14, 13, 12, 16, 14, 13, 16, 14, 14, 14, 14, 15, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 9, 12, 13, 13, 13, 13, 14, 13, 12, 15, 14, 14, 14, 14, 14, 11,
- 11, 14, 14, 16, 14, 16, 16, 16, 13, 16, 14, 16, 14, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 14, 14, 16, 16, 15, 16, 16, 15, 16, 14, 16, 16, 16, 16, 14,
- 12, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 14, 12, 15, 15, 15, 16, 16, 14, 16, 12, 14, 16, 16, 15, 14,
- 12, 15, 14, 16, 16, 16, 16, 16, 15, 16, 14, 16, 16, 16, 16, 14,
- 12, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14,
- 11, 15, 15, 16, 14, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 11, 15, 14, 16, 14, 14, 16, 15, 14, 16, 15, 16, 15, 16, 16, 12,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 12, 16, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
- 10, 14, 13, 14, 15, 14, 16, 15, 14, 16, 13, 16, 16, 16, 15, 13,
- 10, 14, 14, 14, 13, 14, 16, 15, 15, 16, 14, 14, 14, 16, 16, 12,
- 10, 14, 15, 14, 13, 16, 16, 15, 13, 16, 16, 16, 12, 14, 16, 12,
- 11, 16, 16, 16, 14, 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
- 12, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14,
- 11, 14, 14, 14, 14, 15, 16, 14, 14, 16, 16, 16, 13, 15, 15, 12,
- 10, 14, 13, 14, 14, 14, 16, 15, 14, 16, 15, 15, 14, 14, 16, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 12, 14, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 13,
- 8, 11, 11, 12, 12, 12, 13, 12, 11, 13, 12, 12, 12, 13, 12, 10,
- },
- },
- {
- {
- 5, 6, 6, 6, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 4,
- 9, 9, 9, 8, 9, 8, 10, 8, 10, 10, 9, 9, 9, 8, 9, 6,
- 11, 10, 12, 10, 11, 10, 12, 9, 12, 11, 11, 10, 11, 10, 11, 8,
- 9, 10, 9, 8, 10, 10, 10, 9, 9, 10, 8, 8, 9, 9, 8, 7,
- 10, 11, 10, 9, 11, 11, 11, 9, 11, 11, 10, 9, 10, 10, 10, 7,
- 13, 12, 12, 10, 13, 12, 13, 10, 13, 12, 12, 11, 13, 12, 11, 9,
- 11, 12, 10, 10, 12, 12, 11, 10, 11, 12, 10, 10, 11, 11, 10, 8,
- 12, 12, 11, 10, 13, 13, 13, 10, 13, 13, 12, 11, 13, 12, 11, 9,
- 12, 12, 12, 10, 13, 13, 13, 10, 13, 13, 12, 10, 13, 12, 12, 9,
- 9, 9, 10, 10, 9, 8, 10, 9, 9, 10, 9, 9, 8, 8, 9, 6,
- 10, 11, 11, 11, 10, 9, 11, 9, 11, 11, 11, 10, 10, 9, 10, 7,
- 12, 12, 13, 12, 12, 10, 13, 10, 13, 13, 13, 12, 12, 11, 11, 9,
- 11, 12, 11, 11, 11, 11, 11, 10, 11, 12, 10, 10, 10, 10, 10, 8,
- 12, 12, 12, 11, 12, 11, 11, 10, 12, 12, 11, 11, 11, 11, 10, 8,
- 14, 13, 13, 12, 13, 12, 13, 10, 14, 14, 13, 12, 13, 12, 12, 9,
- 13, 14, 13, 12, 13, 13, 13, 12, 13, 13, 12, 12, 12, 12, 11, 9,
- 14, 14, 13, 12, 13, 13, 13, 11, 14, 14, 13, 12, 13, 12, 12, 9,
- 14, 15, 14, 12, 15, 13, 13, 11, 15, 14, 14, 12, 14, 13, 12, 9,
- 11, 11, 12, 12, 10, 10, 12, 11, 11, 12, 11, 11, 10, 10, 10, 8,
- 12, 12, 14, 13, 11, 10, 12, 11, 13, 13, 13, 12, 12, 10, 11, 9,
- 13, 13, 14, 14, 12, 10, 13, 11, 14, 14, 14, 13, 12, 11, 12, 9,
- 13, 13, 13, 13, 12, 13, 13, 12, 13, 14, 12, 12, 12, 12, 11, 9,
- 13, 14, 14, 13, 13, 12, 13, 11, 14, 14, 13, 12, 13, 12, 12, 9,
- 14, 14, 14, 14, 14, 12, 13, 11, 15, 15, 15, 13, 14, 12, 12, 9,
- 14, 15, 15, 13, 14, 14, 13, 12, 13, 14, 13, 13, 12, 12, 11, 10,
- 16, 16, 15, 14, 15, 14, 13, 11, 15, 15, 14, 13, 13, 13, 12, 9,
- 15, 15, 15, 13, 14, 13, 13, 11, 15, 15, 15, 13, 14, 13, 12, 9,
- 8, 9, 9, 9, 9, 9, 10, 9, 8, 10, 9, 9, 8, 8, 9, 7,
- 11, 11, 11, 11, 11, 11, 12, 10, 11, 11, 11, 10, 10, 10, 10, 8,
- 13, 13, 14, 12, 13, 12, 14, 11, 13, 13, 13, 12, 13, 11, 12, 9,
- 10, 11, 10, 11, 11, 11, 12, 10, 10, 11, 10, 10, 10, 10, 10, 8,
- 12, 12, 12, 11, 12, 12, 12, 11, 11, 12, 11, 10, 11, 11, 10, 8,
- 14, 13, 14, 12, 14, 13, 14, 12, 14, 13, 13, 11, 13, 12, 12, 9,
- 12, 13, 12, 12, 13, 13, 13, 12, 12, 13, 11, 11, 12, 12, 11, 9,
- 13, 14, 13, 12, 14, 14, 14, 12, 14, 13, 12, 11, 13, 12, 12, 9,
- 14, 14, 13, 12, 15, 14, 15, 12, 14, 14, 13, 11, 13, 13, 12, 9,
- 10, 11, 11, 11, 10, 10, 12, 10, 10, 11, 10, 10, 9, 9, 10, 7,
- 12, 12, 13, 12, 12, 11, 12, 11, 12, 12, 12, 11, 11, 10, 10, 8,
- 14, 13, 14, 13, 14, 12, 13, 12, 14, 13, 14, 12, 13, 11, 12, 9,
- 12, 13, 12, 12, 12, 12, 12, 11, 11, 12, 11, 10, 10, 10, 10, 8,
- 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 11, 10, 11, 10, 10, 7,
- 14, 14, 14, 12, 14, 12, 14, 11, 14, 13, 13, 11, 13, 11, 11, 8,
- 13, 15, 13, 13, 14, 14, 14, 12, 13, 14, 12, 12, 12, 12, 11, 9,
- 14, 15, 13, 12, 14, 13, 13, 11, 13, 13, 12, 11, 13, 12, 11, 8,
- 15, 15, 15, 12, 15, 14, 14, 11, 14, 14, 13, 11, 13, 12, 12, 8,
- 12, 13, 13, 13, 12, 12, 13, 12, 12, 13, 12, 12, 11, 11, 11, 9,
- 13, 14, 15, 14, 13, 12, 14, 12, 13, 13, 14, 12, 12, 11, 12, 9,
- 14, 14, 15, 14, 14, 12, 14, 12, 14, 14, 14, 13, 13, 11, 12, 9,
- 13, 14, 14, 14, 13, 13, 14, 13, 13, 13, 12, 12, 12, 12, 11, 9,
- 14, 14, 14, 13, 13, 13, 13, 12, 13, 14, 13, 12, 12, 11, 11, 8,
- 15, 14, 15, 14, 14, 13, 14, 11, 15, 14, 14, 12, 13, 11, 12, 8,
- 14, 15, 14, 14, 15, 14, 14, 13, 14, 15, 13, 13, 12, 12, 11, 10,
- 16, 15, 14, 14, 14, 14, 13, 12, 14, 14, 13, 12, 13, 12, 11, 9,
- 15, 15, 15, 14, 16, 14, 14, 11, 15, 15, 14, 12, 13, 12, 11, 8,
- 11, 12, 11, 12, 12, 12, 12, 11, 10, 11, 10, 10, 10, 10, 10, 8,
- 13, 13, 13, 13, 13, 13, 14, 12, 12, 12, 12, 12, 12, 11, 12, 9,
- 14, 14, 14, 13, 15, 13, 15, 13, 14, 14, 14, 12, 14, 12, 13, 10,
- 12, 13, 12, 13, 13, 13, 13, 12, 11, 12, 11, 11, 12, 11, 11, 9,
- 14, 14, 13, 13, 14, 14, 14, 12, 12, 13, 12, 11, 13, 12, 12, 9,
- 14, 14, 15, 13, 15, 15, 15, 13, 15, 13, 13, 12, 14, 12, 13, 10,
- 13, 15, 12, 13, 14, 14, 14, 13, 12, 13, 11, 11, 13, 12, 11, 10,
- 14, 15, 14, 13, 15, 14, 15, 13, 14, 14, 12, 11, 13, 13, 12, 9,
- 14, 15, 14, 13, 15, 14, 15, 13, 14, 14, 13, 11, 14, 13, 12, 9,
- 12, 13, 13, 13, 12, 13, 13, 12, 11, 12, 12, 11, 11, 11, 11, 9,
- 13, 14, 14, 13, 14, 13, 14, 12, 13, 13, 13, 12, 12, 11, 11, 9,
- 15, 15, 16, 14, 15, 14, 14, 13, 15, 14, 14, 13, 13, 12, 13, 10,
- 13, 14, 14, 13, 13, 14, 14, 13, 12, 13, 12, 12, 11, 11, 11, 9,
- 14, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 12, 11, 11, 8,
- 15, 15, 15, 13, 15, 14, 14, 12, 14, 13, 13, 12, 13, 12, 12, 9,
- 14, 15, 14, 14, 15, 15, 14, 13, 13, 14, 12, 12, 13, 12, 12, 9,
- 15, 15, 14, 13, 15, 14, 14, 13, 14, 14, 12, 11, 13, 12, 11, 8,
- 15, 16, 14, 13, 15, 15, 15, 12, 14, 14, 13, 11, 14, 12, 12, 8,
- 12, 14, 13, 13, 13, 13, 14, 12, 12, 13, 12, 12, 10, 11, 11, 9,
- 14, 15, 15, 14, 13, 13, 15, 13, 13, 14, 14, 12, 12, 11, 12, 9,
- 15, 15, 16, 14, 14, 13, 15, 13, 14, 14, 14, 13, 13, 11, 12, 9,
- 14, 15, 14, 14, 14, 14, 14, 13, 13, 14, 13, 12, 12, 12, 11, 9,
- 14, 15, 15, 14, 14, 14, 14, 12, 13, 14, 13, 12, 12, 11, 11, 8,
- 15, 15, 15, 14, 14, 13, 15, 12, 15, 14, 14, 12, 13, 11, 11, 8,
- 14, 16, 14, 14, 14, 15, 14, 13, 13, 14, 12, 12, 12, 12, 11, 9,
- 15, 15, 15, 14, 15, 14, 14, 12, 14, 14, 13, 12, 12, 11, 11, 8,
- 15, 15, 14, 13, 15, 13, 14, 12, 14, 14, 13, 11, 13, 11, 11, 7,
- },
- {
- 1, 5, 6, 7, 6, 7, 9, 8, 6, 9, 8, 8, 7, 8, 8, 6,
- 5, 8, 10, 10, 10, 11, 13, 12, 11, 13, 12, 12, 12, 12, 13, 10,
- 8, 10, 13, 12, 13, 13, 16, 14, 14, 16, 16, 14, 16, 16, 16, 12,
- 5, 10, 9, 11, 11, 12, 13, 12, 11, 13, 11, 12, 12, 12, 13, 10,
- 6, 10, 11, 11, 11, 12, 14, 12, 11, 13, 13, 13, 12, 13, 13, 11,
- 8, 12, 13, 12, 14, 14, 16, 14, 14, 16, 16, 16, 16, 16, 16, 13,
- 9, 13, 11, 14, 14, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
- 9, 13, 13, 13, 14, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 14,
- 8, 12, 13, 12, 13, 14, 16, 14, 14, 16, 16, 16, 14, 16, 16, 13,
- 5, 10, 11, 12, 9, 11, 13, 12, 11, 13, 13, 13, 11, 12, 13, 10,
- 6, 10, 11, 12, 11, 11, 14, 13, 12, 14, 12, 13, 13, 13, 13, 11,
- 9, 12, 14, 15, 13, 13, 16, 16, 14, 16, 16, 16, 16, 16, 16, 13,
- 8, 13, 13, 14, 13, 14, 16, 16, 14, 16, 14, 16, 14, 16, 14, 13,
- 7, 11, 12, 13, 12, 12, 14, 13, 12, 14, 13, 14, 13, 14, 14, 12,
- 9, 13, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 15, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 9, 13, 14, 14, 14, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
- 9, 13, 14, 15, 11, 13, 16, 14, 14, 16, 16, 16, 13, 14, 16, 13,
- 9, 13, 14, 16, 13, 13, 16, 16, 14, 16, 16, 16, 16, 15, 16, 14,
- 8, 12, 13, 16, 13, 12, 16, 14, 13, 16, 14, 16, 16, 16, 16, 13,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 14, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 9, 13, 16, 16, 14, 14, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 13, 14, 15, 14, 14, 16, 14, 13, 16, 16, 16, 14, 16, 16, 14,
- 6, 11, 11, 12, 11, 12, 14, 13, 11, 14, 12, 13, 12, 13, 13, 11,
- 9, 13, 13, 14, 13, 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 13,
- 11, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 7, 11, 11, 13, 12, 13, 16, 14, 12, 16, 12, 14, 14, 14, 14, 12,
- 8, 12, 12, 13, 12, 14, 16, 14, 13, 16, 14, 14, 14, 14, 14, 12,
- 11, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 14, 13, 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16,
- 10, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 7, 11, 12, 12, 11, 13, 16, 14, 12, 15, 14, 14, 11, 13, 13, 12,
- 8, 12, 12, 13, 13, 13, 16, 14, 13, 16, 13, 15, 13, 14, 14, 12,
- 11, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 8, 12, 13, 14, 13, 14, 16, 16, 14, 16, 14, 16, 14, 16, 15, 13,
- 6, 11, 11, 12, 11, 12, 13, 13, 11, 13, 12, 13, 12, 13, 13, 11,
- 9, 13, 14, 14, 14, 14, 16, 14, 14, 16, 16, 16, 16, 16, 14, 13,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 14, 13, 14, 14, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
- 9, 13, 14, 13, 13, 16, 16, 14, 13, 16, 16, 16, 13, 16, 14, 13,
- 10, 14, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 13, 14, 16, 14,
- 11, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 14, 16, 16, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 14, 14, 14, 14, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 13,
- 9, 13, 13, 16, 14, 14, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 13, 14, 14, 13, 16, 16, 14, 13, 16, 14, 16, 14, 14, 16, 12,
- 10, 14, 14, 16, 16, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 14,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 14, 13, 16, 16, 16, 16, 16, 14, 16, 12, 16, 16, 16, 16, 14,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 14,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
- 11, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 15, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 14,
- 10, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 10, 14, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 14,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 15, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
- 10, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 8, 12, 12, 13, 12, 14, 14, 14, 12, 16, 13, 14, 12, 14, 14, 11,
- },
- },
+static const uint8_t rv34_table_intra_cbppat[NUM_INTRA_TABLES][2][CBPPAT_VLC_SIZE] = {
+ {
+ {
+ 8, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 6,
+ 12, 12, 13, 12, 13, 12, 13, 11, 13, 13, 13, 12, 13, 12, 12, 8,
+ 14, 13, 16, 13, 15, 13, 16, 12, 16, 16, 16, 14, 16, 13, 14, 10,
+ 12, 13, 12, 12, 13, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12, 8,
+ 13, 14, 14, 12, 14, 14, 14, 12, 14, 15, 14, 12, 14, 13, 13, 8,
+ 16, 16, 16, 12, 16, 16, 16, 13, 16, 16, 16, 13, 16, 14, 14, 9,
+ 14, 16, 13, 13, 16, 16, 16, 14, 15, 16, 14, 13, 15, 15, 14, 10,
+ 16, 16, 14, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 15, 14, 10,
+ 16, 16, 16, 11, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 15, 9,
+ 12, 13, 13, 13, 12, 12, 14, 12, 12, 14, 13, 12, 12, 12, 12, 8,
+ 14, 14, 16, 14, 13, 12, 14, 12, 14, 15, 14, 13, 13, 12, 13, 8,
+ 16, 16, 16, 15, 16, 13, 16, 13, 16, 16, 16, 15, 16, 13, 15, 10,
+ 14, 16, 14, 14, 14, 14, 15, 13, 14, 16, 14, 13, 13, 13, 13, 9,
+ 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 14, 13, 14, 13, 13, 8,
+ 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 14, 16, 14, 14, 9,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 14, 10,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 14, 16, 15, 14, 9,
+ 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 16, 13, 16, 15, 15, 8,
+ 14, 16, 16, 16, 14, 14, 16, 14, 16, 16, 16, 15, 13, 13, 14, 10,
+ 16, 16, 16, 16, 15, 13, 16, 13, 16, 16, 16, 16, 16, 13, 14, 10,
+ 16, 16, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16, 12, 16, 9,
+ 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 14, 14, 10,
+ 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 15, 16, 13, 14, 9,
+ 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16, 13, 14, 8,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 11,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14, 9,
+ 16, 16, 16, 14, 16, 15, 16, 11, 16, 16, 16, 14, 16, 14, 14, 8,
+ 12, 13, 13, 13, 13, 13, 14, 12, 12, 13, 12, 12, 12, 12, 12, 8,
+ 14, 14, 16, 14, 15, 14, 16, 13, 14, 15, 14, 13, 14, 13, 13, 9,
+ 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 14, 16, 14, 16, 10,
+ 14, 15, 14, 14, 15, 14, 15, 13, 14, 14, 13, 12, 13, 13, 13, 9,
+ 15, 16, 15, 14, 16, 16, 16, 13, 15, 16, 14, 12, 14, 13, 13, 8,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 13, 16, 14, 14, 9,
+ 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 13, 13, 16, 16, 14, 10,
+ 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 13, 16, 14, 14, 9,
+ 16, 16, 16, 12, 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 15, 8,
+ 13, 14, 14, 14, 14, 14, 16, 13, 13, 14, 14, 13, 12, 12, 12, 8,
+ 16, 16, 16, 14, 15, 14, 16, 13, 15, 16, 14, 13, 13, 12, 13, 8,
+ 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 14, 16, 13, 14, 9,
+ 15, 16, 16, 15, 16, 15, 16, 13, 14, 16, 14, 13, 13, 13, 12, 8,
+ 16, 16, 16, 14, 16, 14, 15, 12, 15, 15, 14, 12, 13, 12, 12, 7,
+ 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 13, 16, 13, 13, 7,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 14, 14, 16, 14, 13, 9,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 14, 12, 16, 13, 12, 7,
+ 16, 16, 16, 12, 16, 16, 16, 11, 16, 16, 15, 12, 16, 13, 13, 6,
+ 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 13, 13, 14, 10,
+ 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 14, 13, 14, 9,
+ 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 16, 16, 12, 14, 8,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14, 13, 13, 9,
+ 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 13, 14, 12, 12, 7,
+ 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13, 6,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 14, 9,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 15, 13, 12, 7,
+ 16, 16, 16, 13, 16, 14, 16, 11, 16, 16, 16, 12, 16, 12, 12, 5,
+ 14, 16, 15, 16, 16, 16, 16, 15, 14, 15, 14, 14, 13, 14, 13, 10,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 16, 10,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 14, 15, 14, 13, 10,
+ 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14, 13, 16, 14, 14, 9,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 9,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 13, 16, 16, 13, 10,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 16, 13, 9,
+ 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 12, 16, 16, 14, 8,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 15, 14, 13, 13, 13, 9,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14, 13, 13, 9,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 15, 9,
+ 16, 16, 16, 16, 16, 16, 16, 15, 15, 16, 14, 14, 14, 13, 13, 9,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 12, 13, 12, 12, 7,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 16, 13, 13, 7,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 14, 13, 9,
+ 16, 16, 16, 15, 16, 16, 16, 13, 16, 16, 13, 12, 14, 13, 12, 6,
+ 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 14, 10, 15, 12, 12, 5,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 13, 13, 9,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 13, 12, 13, 8,
+ 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 15, 12, 14, 8,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 13, 13, 13, 8,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 15, 13, 12, 11, 12, 6,
+ 16, 16, 16, 15, 16, 14, 16, 12, 16, 16, 16, 12, 13, 10, 12, 5,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 13, 14, 12, 8,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 13, 12, 13, 12, 10, 5,
+ 16, 16, 16, 13, 16, 13, 16, 10, 16, 16, 13, 10, 13, 10, 10, 1,
+ },
+ {
+ 2, 7, 7, 8, 7, 8, 9, 8, 7, 9, 8, 8, 8, 8, 9, 7,
+ 6, 9, 10, 10, 10, 10, 11, 10, 10, 11, 11, 11, 10, 11, 11, 9,
+ 9, 11, 12, 12, 12, 13, 14, 13, 13, 14, 14, 13, 13, 13, 14, 11,
+ 6, 10, 9, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 11, 11, 9,
+ 6, 9, 10, 10, 10, 11, 12, 11, 10, 12, 11, 11, 11, 11, 11, 8,
+ 9, 11, 12, 12, 12, 13, 13, 13, 12, 14, 14, 13, 13, 13, 13, 10,
+ 9, 13, 11, 13, 13, 14, 14, 13, 13, 14, 13, 13, 14, 14, 14, 12,
+ 9, 12, 12, 12, 12, 14, 14, 13, 13, 14, 13, 13, 13, 14, 13, 11,
+ 8, 12, 12, 11, 12, 14, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
+ 6, 10, 10, 11, 9, 10, 12, 11, 10, 12, 11, 11, 10, 11, 11, 9,
+ 7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 11, 9,
+ 9, 12, 13, 13, 12, 12, 14, 13, 13, 14, 14, 13, 14, 13, 14, 11,
+ 8, 11, 11, 12, 11, 12, 12, 12, 11, 13, 12, 12, 12, 12, 12, 10,
+ 7, 10, 10, 11, 10, 11, 12, 11, 10, 12, 11, 11, 11, 11, 11, 8,
+ 9, 11, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 13, 12, 13, 10,
+ 10, 13, 13, 14, 14, 14, 15, 14, 14, 15, 14, 15, 14, 14, 14, 12,
+ 9, 12, 12, 13, 12, 13, 14, 13, 12, 13, 13, 12, 13, 13, 13, 10,
+ 9, 12, 12, 12, 12, 13, 14, 12, 12, 14, 13, 12, 13, 13, 13, 10,
+ 9, 12, 13, 13, 11, 13, 14, 13, 13, 14, 14, 14, 12, 13, 13, 11,
+ 10, 12, 13, 13, 12, 12, 14, 13, 13, 14, 14, 14, 13, 13, 14, 11,
+ 10, 13, 14, 14, 13, 12, 15, 13, 14, 14, 14, 14, 15, 13, 14, 11,
+ 11, 14, 14, 14, 13, 14, 15, 14, 14, 15, 15, 14, 13, 14, 14, 12,
+ 10, 13, 12, 13, 12, 12, 14, 13, 13, 14, 13, 13, 13, 13, 13, 10,
+ 10, 12, 13, 13, 13, 12, 14, 12, 13, 14, 14, 13, 13, 13, 13, 10,
+ 13, 15, 16, 16, 15, 15, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
+ 11, 14, 14, 14, 14, 14, 15, 14, 14, 15, 15, 14, 14, 14, 15, 11,
+ 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 14, 13, 13, 13, 13, 10,
+ 6, 10, 10, 11, 10, 11, 12, 11, 10, 12, 10, 11, 10, 11, 11, 9,
+ 8, 11, 11, 12, 11, 12, 13, 12, 11, 12, 12, 12, 12, 12, 12, 10,
+ 11, 13, 14, 14, 13, 14, 15, 14, 13, 15, 15, 14, 14, 14, 15, 12,
+ 7, 11, 10, 12, 11, 12, 12, 12, 11, 12, 11, 12, 11, 12, 12, 10,
+ 7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 11, 9,
+ 10, 12, 13, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13, 13, 13, 10,
+ 10, 13, 12, 14, 13, 14, 14, 14, 13, 14, 12, 14, 15, 14, 14, 11,
+ 10, 12, 12, 12, 12, 13, 14, 13, 13, 14, 13, 12, 13, 13, 13, 10,
+ 9, 12, 13, 13, 13, 14, 14, 13, 13, 14, 14, 13, 13, 13, 13, 10,
+ 7, 10, 10, 11, 10, 11, 12, 11, 10, 12, 12, 11, 9, 11, 11, 9,
+ 7, 10, 11, 11, 10, 11, 12, 11, 10, 12, 12, 11, 11, 11, 11, 9,
+ 10, 12, 13, 13, 13, 13, 15, 13, 13, 14, 13, 13, 13, 13, 13, 10,
+ 8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 12, 11, 9,
+ 6, 9, 9, 10, 9, 10, 10, 10, 9, 11, 10, 10, 9, 10, 10, 7,
+ 8, 10, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 11, 11, 8,
+ 10, 13, 13, 13, 13, 14, 14, 13, 13, 14, 13, 13, 13, 13, 13, 11,
+ 8, 11, 11, 11, 11, 12, 12, 11, 11, 12, 11, 11, 11, 11, 11, 8,
+ 8, 11, 11, 11, 11, 12, 12, 10, 11, 12, 12, 11, 11, 11, 11, 8,
+ 10, 13, 13, 13, 12, 13, 14, 13, 12, 14, 14, 14, 10, 13, 13, 11,
+ 10, 12, 12, 13, 12, 13, 14, 12, 12, 13, 13, 13, 12, 12, 13, 10,
+ 11, 13, 14, 14, 13, 13, 14, 13, 13, 15, 14, 13, 13, 13, 13, 10,
+ 10, 12, 13, 13, 12, 13, 14, 13, 13, 14, 14, 13, 12, 13, 13, 11,
+ 8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 11, 11, 8,
+ 9, 11, 12, 12, 11, 11, 12, 11, 12, 12, 12, 11, 12, 11, 11, 8,
+ 12, 15, 14, 14, 14, 15, 15, 14, 14, 15, 15, 14, 14, 14, 15, 12,
+ 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 12, 12, 12, 9,
+ 9, 11, 11, 11, 11, 11, 12, 10, 11, 12, 12, 11, 11, 11, 11, 7,
+ 10, 13, 13, 13, 13, 14, 15, 14, 13, 14, 14, 14, 12, 14, 15, 12,
+ 11, 14, 14, 14, 14, 15, 15, 14, 14, 15, 15, 15, 14, 15, 15, 12,
+ 13, 16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 14,
+ 10, 13, 13, 14, 13, 15, 14, 14, 13, 15, 13, 14, 14, 14, 14, 12,
+ 10, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 13, 13, 13, 14, 11,
+ 12, 14, 14, 14, 14, 15, 15, 14, 14, 15, 15, 14, 15, 14, 14, 12,
+ 11, 14, 14, 15, 14, 15, 15, 14, 14, 15, 12, 14, 15, 16, 15, 12,
+ 11, 13, 13, 14, 13, 14, 14, 14, 14, 14, 13, 13, 14, 14, 14, 11,
+ 11, 14, 14, 14, 14, 15, 15, 14, 14, 16, 14, 13, 14, 14, 14, 11,
+ 10, 13, 13, 13, 12, 14, 14, 14, 12, 15, 14, 14, 11, 13, 13, 12,
+ 10, 12, 13, 14, 12, 13, 14, 13, 13, 14, 14, 13, 12, 13, 13, 11,
+ 12, 14, 14, 15, 14, 15, 16, 15, 15, 15, 15, 15, 14, 14, 15, 12,
+ 10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 13, 13, 12, 13, 13, 11,
+ 9, 11, 11, 12, 11, 12, 12, 11, 11, 12, 12, 11, 11, 11, 11, 9,
+ 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 13, 12, 12, 9,
+ 11, 13, 13, 15, 14, 14, 15, 14, 14, 15, 14, 14, 14, 14, 14, 11,
+ 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 11, 11, 12, 12, 12, 8,
+ 9, 12, 12, 11, 12, 12, 13, 11, 12, 12, 12, 11, 12, 11, 11, 8,
+ 10, 13, 13, 14, 12, 14, 15, 14, 13, 15, 15, 14, 10, 13, 13, 11,
+ 11, 13, 14, 13, 13, 14, 14, 13, 13, 14, 14, 14, 11, 13, 13, 11,
+ 12, 14, 14, 14, 14, 14, 15, 14, 15, 16, 15, 14, 13, 13, 14, 11,
+ 11, 14, 13, 14, 13, 14, 15, 14, 13, 15, 14, 14, 11, 13, 13, 11,
+ 9, 12, 12, 12, 11, 12, 13, 11, 12, 13, 12, 11, 10, 11, 11, 8,
+ 10, 12, 12, 12, 12, 12, 13, 11, 12, 12, 12, 11, 11, 11, 11, 8,
+ 12, 15, 14, 15, 14, 15, 16, 15, 15, 15, 15, 14, 14, 14, 14, 12,
+ 10, 12, 12, 12, 12, 12, 13, 11, 12, 13, 12, 11, 11, 11, 11, 8,
+ 8, 10, 10, 10, 10, 10, 11, 9, 10, 11, 10, 9, 10, 9, 9, 5,
+ },
+ },
+ {
+ {
+ 12, 12, 11, 9, 11, 10, 11, 9, 11, 11, 10, 9, 9, 8, 9, 5,
+ 14, 13, 14, 11, 14, 11, 13, 10, 14, 13, 12, 10, 12, 10, 11, 6,
+ 16, 13, 16, 12, 16, 12, 16, 11, 16, 14, 16, 12, 15, 12, 13, 8,
+ 14, 14, 12, 11, 14, 12, 13, 10, 13, 13, 11, 10, 12, 11, 10, 6,
+ 16, 15, 14, 11, 16, 13, 14, 10, 15, 14, 13, 10, 13, 11, 11, 7,
+ 16, 16, 16, 11, 16, 14, 16, 11, 16, 16, 15, 12, 15, 13, 13, 8,
+ 16, 16, 13, 12, 16, 16, 15, 12, 16, 16, 12, 11, 15, 13, 12, 8,
+ 16, 16, 14, 11, 16, 16, 16, 11, 16, 16, 14, 11, 15, 14, 13, 8,
+ 16, 16, 15, 10, 16, 16, 16, 10, 16, 16, 15, 11, 16, 14, 14, 8,
+ 14, 14, 14, 12, 13, 11, 13, 10, 13, 13, 12, 11, 11, 10, 10, 6,
+ 16, 15, 16, 13, 13, 11, 14, 11, 15, 14, 13, 11, 12, 10, 11, 7,
+ 16, 15, 16, 14, 16, 11, 16, 11, 16, 16, 16, 13, 16, 12, 13, 8,
+ 16, 16, 14, 13, 15, 13, 14, 11, 14, 15, 13, 11, 13, 11, 11, 7,
+ 16, 16, 15, 13, 15, 13, 14, 11, 16, 15, 14, 11, 13, 11, 11, 7,
+ 16, 16, 16, 13, 16, 13, 16, 11, 16, 16, 16, 12, 16, 12, 13, 8,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 14, 13, 15, 14, 13, 9,
+ 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 14, 12, 15, 13, 13, 8,
+ 16, 16, 16, 12, 16, 16, 16, 11, 16, 16, 15, 12, 16, 13, 13, 7,
+ 16, 16, 16, 16, 13, 12, 16, 12, 16, 16, 14, 13, 12, 11, 12, 8,
+ 16, 16, 16, 15, 14, 11, 16, 11, 16, 16, 16, 13, 14, 11, 13, 8,
+ 16, 16, 16, 16, 15, 10, 16, 11, 16, 16, 16, 14, 15, 11, 13, 8,
+ 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 14, 14, 14, 12, 13, 9,
+ 16, 16, 16, 15, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13, 8,
+ 16, 16, 16, 14, 16, 12, 16, 11, 16, 16, 16, 13, 15, 12, 13, 7,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 14, 13, 9,
+ 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 14, 16, 13, 13, 8,
+ 16, 16, 16, 14, 16, 14, 16, 10, 16, 16, 16, 13, 16, 13, 13, 7,
+ 14, 14, 13, 12, 13, 12, 13, 11, 12, 13, 11, 10, 11, 10, 10, 6,
+ 16, 16, 15, 13, 16, 13, 15, 11, 14, 14, 13, 11, 13, 11, 11, 7,
+ 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 13, 16, 13, 14, 9,
+ 16, 16, 13, 13, 15, 14, 14, 11, 13, 14, 11, 11, 12, 11, 11, 7,
+ 16, 16, 15, 12, 16, 14, 15, 11, 14, 14, 12, 11, 13, 11, 11, 7,
+ 16, 16, 16, 13, 16, 14, 16, 12, 16, 16, 14, 12, 16, 13, 13, 8,
+ 16, 16, 14, 14, 16, 16, 16, 13, 16, 16, 12, 11, 15, 13, 12, 8,
+ 16, 16, 15, 13, 16, 16, 16, 12, 16, 16, 13, 11, 16, 13, 12, 8,
+ 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 14, 11, 16, 14, 13, 7,
+ 16, 16, 15, 13, 14, 13, 14, 11, 14, 14, 12, 11, 11, 10, 11, 7,
+ 16, 16, 16, 13, 14, 12, 15, 11, 15, 14, 13, 11, 12, 11, 11, 7,
+ 16, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13, 8,
+ 16, 16, 15, 13, 15, 14, 14, 12, 14, 14, 12, 11, 12, 11, 11, 7,
+ 16, 16, 14, 12, 15, 13, 14, 11, 15, 14, 13, 11, 12, 11, 11, 6,
+ 16, 16, 16, 13, 16, 13, 16, 11, 16, 15, 14, 11, 14, 11, 12, 6,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13, 12, 14, 13, 12, 8,
+ 16, 16, 15, 13, 16, 14, 15, 11, 16, 16, 13, 11, 14, 12, 11, 6,
+ 16, 16, 16, 12, 16, 14, 15, 11, 16, 16, 13, 10, 14, 12, 12, 6,
+ 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 14, 13, 12, 11, 12, 8,
+ 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 15, 13, 13, 11, 12, 8,
+ 16, 16, 16, 15, 16, 12, 16, 12, 16, 16, 16, 14, 14, 11, 13, 7,
+ 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 14, 13, 13, 12, 12, 8,
+ 16, 16, 16, 14, 15, 13, 15, 11, 16, 15, 14, 12, 13, 11, 11, 6,
+ 16, 16, 16, 14, 16, 12, 15, 11, 16, 16, 15, 12, 14, 11, 12, 6,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 15, 13, 14, 13, 12, 8,
+ 16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 14, 12, 13, 12, 11, 6,
+ 16, 16, 16, 13, 16, 13, 15, 10, 16, 16, 14, 11, 14, 11, 11, 5,
+ 16, 16, 15, 14, 16, 16, 16, 13, 14, 14, 12, 12, 12, 12, 12, 8,
+ 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 13, 14, 13, 13, 9,
+ 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 16, 13, 15, 9,
+ 16, 16, 14, 15, 16, 16, 16, 14, 14, 16, 12, 12, 13, 13, 12, 8,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 15, 13, 12, 14, 12, 12, 8,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 12, 16, 13, 13, 8,
+ 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 11, 11, 15, 14, 12, 8,
+ 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 12, 11, 15, 13, 12, 8,
+ 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 13, 10, 16, 13, 12, 7,
+ 16, 16, 16, 16, 16, 15, 16, 13, 14, 16, 13, 13, 12, 12, 12, 8,
+ 16, 16, 16, 15, 16, 14, 16, 13, 16, 16, 14, 13, 13, 12, 12, 8,
+ 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 13, 15, 12, 14, 8,
+ 16, 16, 16, 15, 16, 16, 16, 13, 14, 16, 13, 12, 12, 12, 11, 8,
+ 16, 16, 16, 14, 16, 14, 16, 12, 14, 14, 13, 11, 13, 11, 11, 6,
+ 16, 16, 16, 14, 16, 14, 16, 12, 16, 15, 14, 11, 14, 11, 12, 6,
+ 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 12, 12, 14, 13, 11, 8,
+ 16, 16, 15, 14, 16, 16, 16, 12, 16, 15, 12, 11, 13, 12, 11, 6,
+ 16, 16, 16, 13, 16, 14, 16, 11, 16, 14, 13, 10, 14, 11, 11, 5,
+ 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 15, 13, 11, 11, 11, 8,
+ 16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 13, 12, 11, 12, 7,
+ 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 13, 13, 11, 13, 7,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 13, 12, 12, 11, 7,
+ 16, 16, 16, 15, 16, 14, 15, 12, 16, 14, 13, 12, 12, 11, 11, 6,
+ 16, 16, 16, 14, 16, 13, 15, 11, 16, 14, 14, 11, 13, 10, 11, 5,
+ 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 13, 12, 12, 12, 11, 7,
+ 16, 16, 16, 14, 16, 14, 15, 12, 16, 15, 12, 11, 12, 11, 10, 5,
+ 16, 16, 16, 13, 16, 13, 14, 10, 16, 14, 12, 9, 12, 10, 9, 3,
+ },
+ {
+ 2, 6, 6, 7, 6, 7, 8, 7, 7, 8, 7, 8, 7, 8, 8, 5,
+ 5, 8, 9, 9, 9, 9, 12, 10, 10, 11, 10, 10, 10, 11, 11, 8,
+ 9, 10, 13, 12, 13, 12, 15, 13, 13, 14, 13, 14, 13, 13, 14, 11,
+ 5, 10, 9, 10, 10, 10, 12, 10, 10, 12, 10, 11, 11, 11, 11, 8,
+ 6, 9, 10, 9, 10, 11, 12, 10, 10, 12, 11, 11, 10, 11, 11, 8,
+ 9, 11, 12, 11, 12, 13, 14, 12, 13, 14, 14, 12, 13, 13, 13, 11,
+ 10, 13, 11, 12, 14, 14, 15, 13, 13, 15, 12, 13, 14, 14, 14, 12,
+ 9, 12, 12, 12, 13, 13, 15, 13, 13, 14, 13, 13, 14, 13, 15, 11,
+ 8, 11, 12, 10, 12, 13, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
+ 5, 9, 10, 10, 9, 10, 12, 11, 10, 12, 11, 11, 9, 11, 11, 9,
+ 6, 10, 10, 11, 10, 10, 12, 11, 11, 12, 11, 11, 11, 11, 11, 9,
+ 9, 11, 13, 13, 12, 11, 14, 12, 13, 15, 13, 13, 14, 13, 14, 11,
+ 8, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 13, 12, 12, 12, 10,
+ 7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 12, 9,
+ 9, 12, 12, 12, 12, 12, 14, 12, 13, 14, 13, 13, 13, 13, 13, 11,
+ 11, 14, 13, 15, 15, 16, 16, 15, 15, 16, 15, 15, 16, 16, 15, 13,
+ 10, 12, 13, 13, 13, 14, 15, 13, 13, 14, 13, 13, 14, 14, 14, 11,
+ 9, 12, 12, 12, 13, 13, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
+ 9, 13, 13, 13, 11, 12, 15, 13, 13, 15, 14, 14, 11, 13, 14, 11,
+ 10, 13, 13, 13, 12, 12, 15, 13, 13, 15, 14, 14, 13, 13, 14, 11,
+ 10, 12, 13, 13, 12, 11, 14, 12, 13, 15, 13, 13, 13, 13, 14, 11,
+ 11, 14, 15, 15, 13, 14, 16, 14, 14, 16, 16, 14, 14, 15, 15, 13,
+ 10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 14, 14, 13, 13, 14, 11,
+ 10, 12, 13, 13, 13, 12, 14, 13, 13, 14, 14, 13, 13, 13, 13, 11,
+ 13, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 12, 15, 15, 15, 14, 15, 16, 14, 15, 16, 16, 15, 16, 15, 15, 13,
+ 10, 12, 12, 12, 13, 13, 14, 12, 13, 14, 13, 13, 13, 13, 13, 11,
+ 6, 10, 10, 11, 10, 11, 12, 11, 10, 12, 11, 11, 10, 11, 11, 9,
+ 8, 11, 12, 12, 12, 12, 13, 12, 12, 13, 12, 13, 12, 13, 13, 10,
+ 11, 13, 15, 14, 15, 14, 16, 14, 15, 16, 16, 14, 15, 15, 15, 13,
+ 7, 11, 10, 12, 11, 11, 13, 11, 11, 13, 10, 11, 12, 12, 12, 10,
+ 7, 11, 11, 11, 11, 11, 13, 11, 11, 13, 11, 12, 12, 12, 12, 9,
+ 10, 12, 13, 13, 13, 13, 15, 13, 14, 15, 14, 14, 14, 14, 15, 11,
+ 10, 13, 12, 14, 14, 14, 15, 13, 13, 15, 12, 13, 15, 15, 14, 12,
+ 10, 13, 12, 12, 13, 13, 15, 14, 13, 15, 13, 13, 14, 14, 14, 11,
+ 10, 13, 13, 12, 13, 14, 15, 13, 13, 15, 13, 13, 14, 14, 14, 11,
+ 7, 10, 11, 11, 10, 11, 12, 11, 10, 12, 12, 12, 9, 11, 12, 9,
+ 7, 11, 11, 11, 11, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 9,
+ 10, 12, 14, 13, 13, 13, 16, 13, 14, 16, 14, 14, 13, 13, 14, 11,
+ 8, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
+ 6, 9, 9, 10, 9, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 8,
+ 8, 11, 11, 11, 12, 11, 13, 11, 12, 13, 12, 12, 12, 12, 12, 10,
+ 11, 14, 13, 14, 14, 14, 16, 14, 14, 16, 14, 14, 15, 15, 14, 12,
+ 9, 12, 11, 12, 12, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
+ 8, 11, 11, 11, 11, 11, 13, 11, 12, 12, 12, 12, 12, 12, 12, 9,
+ 10, 13, 14, 13, 11, 13, 14, 14, 13, 15, 15, 14, 10, 13, 14, 11,
+ 10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 14, 14, 13, 13, 13, 11,
+ 10, 13, 14, 13, 13, 12, 15, 13, 14, 15, 14, 14, 14, 13, 14, 12,
+ 11, 14, 14, 14, 13, 13, 15, 14, 14, 15, 14, 15, 13, 14, 14, 12,
+ 9, 11, 12, 12, 11, 11, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
+ 9, 11, 12, 12, 12, 11, 13, 11, 12, 13, 12, 12, 12, 12, 12, 10,
+ 13, 15, 15, 16, 15, 16, 16, 15, 16, 16, 16, 15, 15, 15, 16, 14,
+ 10, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 13, 13, 13, 13, 11,
+ 8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 12, 11, 12, 9,
+ 11, 14, 14, 15, 14, 15, 15, 14, 13, 15, 14, 15, 12, 14, 15, 13,
+ 12, 15, 15, 15, 15, 15, 16, 15, 15, 16, 16, 16, 15, 16, 15, 13,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 11, 14, 13, 15, 14, 14, 16, 14, 14, 16, 13, 14, 15, 14, 15, 12,
+ 11, 14, 13, 14, 14, 14, 16, 15, 14, 16, 14, 14, 15, 15, 15, 12,
+ 13, 15, 15, 15, 15, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 13,
+ 11, 14, 13, 14, 14, 14, 15, 14, 14, 16, 12, 14, 16, 16, 14, 12,
+ 11, 14, 14, 14, 14, 15, 16, 15, 14, 16, 13, 14, 16, 15, 14, 12,
+ 12, 14, 14, 14, 14, 14, 16, 14, 15, 16, 14, 14, 14, 15, 15, 12,
+ 11, 14, 14, 14, 13, 14, 16, 15, 13, 16, 15, 15, 11, 14, 14, 12,
+ 11, 14, 14, 15, 14, 14, 16, 14, 14, 15, 14, 14, 13, 15, 15, 12,
+ 13, 15, 16, 15, 15, 15, 16, 15, 16, 16, 16, 16, 15, 15, 16, 13,
+ 11, 14, 14, 14, 14, 14, 15, 14, 14, 16, 14, 14, 14, 15, 14, 12,
+ 9, 12, 12, 12, 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 12, 10,
+ 11, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 14, 13, 13, 14, 11,
+ 12, 15, 14, 15, 15, 15, 16, 15, 14, 16, 14, 14, 16, 16, 14, 13,
+ 10, 12, 12, 12, 12, 12, 14, 12, 13, 13, 12, 12, 13, 13, 13, 10,
+ 10, 12, 12, 12, 12, 12, 14, 12, 12, 13, 12, 12, 12, 12, 12, 10,
+ 10, 14, 14, 14, 12, 14, 16, 14, 13, 16, 16, 16, 10, 13, 14, 12,
+ 11, 14, 14, 14, 13, 14, 16, 14, 14, 16, 15, 14, 12, 13, 14, 12,
+ 12, 14, 14, 14, 14, 14, 16, 14, 14, 16, 15, 15, 14, 14, 15, 12,
+ 12, 14, 15, 15, 14, 15, 16, 14, 15, 15, 15, 15, 13, 15, 14, 12,
+ 9, 12, 12, 12, 12, 13, 13, 12, 12, 13, 13, 12, 11, 12, 12, 10,
+ 10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
+ 13, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 15, 13,
+ 10, 12, 12, 13, 12, 13, 13, 12, 13, 14, 13, 13, 12, 13, 13, 10,
+ 7, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 7,
+ },
+ },
+ {
+ {
+ 10, 10, 9, 8, 9, 8, 9, 7, 9, 9, 8, 7, 8, 7, 7, 4,
+ 13, 11, 12, 9, 12, 9, 12, 9, 12, 11, 11, 9, 10, 9, 9, 6,
+ 15, 12, 15, 11, 14, 10, 14, 10, 14, 13, 13, 11, 13, 11, 12, 7,
+ 13, 12, 11, 9, 12, 11, 12, 9, 12, 12, 10, 9, 10, 10, 9, 6,
+ 14, 13, 12, 10, 13, 12, 13, 9, 13, 12, 11, 10, 12, 11, 10, 6,
+ 16, 14, 14, 10, 15, 13, 14, 10, 15, 15, 14, 11, 14, 12, 12, 8,
+ 15, 14, 12, 11, 15, 14, 13, 11, 14, 14, 11, 10, 13, 12, 11, 8,
+ 15, 16, 13, 11, 16, 14, 14, 11, 15, 15, 12, 10, 14, 13, 12, 8,
+ 16, 15, 14, 10, 16, 14, 14, 10, 16, 15, 14, 10, 14, 13, 12, 7,
+ 13, 12, 12, 11, 11, 9, 12, 9, 12, 12, 11, 10, 10, 9, 9, 6,
+ 13, 13, 14, 12, 12, 10, 12, 10, 14, 13, 12, 11, 11, 10, 10, 7,
+ 16, 14, 16, 13, 14, 11, 15, 10, 16, 15, 14, 12, 14, 11, 12, 8,
+ 14, 14, 13, 12, 13, 12, 13, 10, 13, 13, 12, 11, 11, 10, 10, 7,
+ 15, 14, 14, 12, 14, 12, 13, 10, 14, 13, 12, 11, 12, 11, 11, 7,
+ 16, 15, 16, 13, 15, 13, 15, 10, 16, 15, 14, 12, 14, 12, 12, 7,
+ 15, 16, 14, 13, 16, 14, 14, 12, 15, 15, 12, 12, 13, 12, 12, 8,
+ 16, 16, 14, 13, 16, 14, 14, 11, 15, 15, 14, 11, 14, 12, 12, 8,
+ 16, 16, 15, 12, 16, 14, 15, 10, 16, 16, 13, 12, 14, 13, 12, 7,
+ 14, 14, 14, 13, 13, 11, 13, 11, 14, 14, 13, 12, 11, 10, 11, 8,
+ 16, 15, 16, 13, 13, 11, 14, 11, 15, 14, 14, 13, 12, 11, 12, 8,
+ 15, 15, 16, 14, 14, 10, 14, 10, 16, 15, 15, 13, 14, 10, 12, 8,
+ 16, 16, 16, 14, 15, 13, 14, 12, 15, 15, 13, 13, 13, 12, 12, 8,
+ 16, 16, 16, 14, 15, 13, 14, 11, 16, 16, 14, 13, 13, 12, 12, 8,
+ 16, 16, 16, 14, 16, 12, 15, 11, 16, 15, 15, 13, 14, 12, 12, 8,
+ 16, 16, 16, 16, 16, 15, 15, 13, 16, 16, 14, 13, 14, 13, 12, 9,
+ 16, 16, 16, 14, 16, 15, 15, 11, 16, 16, 14, 13, 15, 13, 12, 8,
+ 16, 16, 16, 14, 16, 14, 14, 10, 16, 16, 15, 13, 14, 12, 12, 7,
+ 12, 12, 12, 11, 12, 11, 12, 10, 11, 11, 10, 9, 9, 9, 9, 6,
+ 14, 13, 14, 12, 13, 12, 13, 10, 13, 13, 12, 10, 12, 10, 11, 7,
+ 16, 14, 16, 13, 15, 13, 16, 12, 15, 14, 14, 12, 14, 12, 13, 8,
+ 14, 14, 13, 11, 14, 12, 13, 11, 12, 12, 10, 10, 11, 10, 10, 7,
+ 14, 14, 13, 12, 14, 12, 13, 11, 13, 13, 12, 10, 12, 11, 10, 7,
+ 16, 15, 15, 12, 16, 14, 15, 11, 16, 14, 13, 11, 14, 12, 12, 8,
+ 16, 16, 13, 13, 16, 15, 14, 12, 14, 14, 11, 11, 13, 12, 11, 8,
+ 16, 16, 14, 12, 16, 14, 14, 12, 15, 14, 12, 11, 14, 12, 12, 8,
+ 16, 15, 14, 11, 16, 15, 15, 11, 16, 15, 13, 11, 14, 13, 12, 8,
+ 14, 13, 13, 12, 13, 11, 13, 10, 12, 13, 11, 10, 10, 10, 10, 7,
+ 15, 14, 14, 13, 13, 12, 13, 11, 14, 13, 12, 11, 12, 10, 11, 7,
+ 16, 15, 16, 14, 15, 12, 15, 11, 16, 14, 14, 12, 14, 11, 12, 8,
+ 14, 15, 13, 12, 14, 13, 13, 11, 13, 13, 11, 11, 11, 10, 10, 7,
+ 14, 14, 14, 12, 14, 13, 13, 10, 14, 13, 12, 10, 12, 10, 10, 6,
+ 16, 15, 15, 13, 16, 13, 15, 11, 15, 14, 13, 11, 13, 11, 11, 7,
+ 16, 16, 14, 13, 16, 15, 14, 12, 15, 15, 12, 11, 13, 12, 11, 8,
+ 16, 16, 14, 13, 16, 14, 14, 11, 15, 14, 12, 11, 13, 12, 11, 7,
+ 16, 16, 15, 12, 16, 14, 14, 11, 15, 15, 13, 11, 14, 12, 11, 6,
+ 16, 15, 15, 14, 14, 12, 14, 12, 13, 14, 13, 12, 11, 11, 11, 8,
+ 16, 16, 16, 14, 14, 12, 15, 12, 15, 14, 14, 12, 12, 11, 12, 8,
+ 16, 16, 16, 15, 14, 12, 15, 12, 16, 15, 14, 13, 13, 11, 12, 8,
+ 16, 16, 16, 15, 15, 14, 15, 12, 14, 14, 13, 12, 12, 11, 11, 8,
+ 16, 16, 15, 14, 14, 12, 14, 11, 14, 14, 13, 12, 12, 11, 11, 7,
+ 16, 16, 16, 14, 15, 12, 14, 11, 15, 15, 14, 12, 13, 11, 12, 7,
+ 16, 16, 16, 16, 16, 15, 16, 13, 15, 15, 14, 12, 13, 12, 11, 8,
+ 16, 16, 16, 14, 15, 14, 14, 12, 16, 15, 13, 12, 13, 12, 11, 7,
+ 16, 16, 16, 13, 16, 13, 14, 10, 16, 15, 14, 11, 13, 11, 11, 6,
+ 14, 15, 13, 13, 14, 13, 14, 12, 12, 13, 11, 11, 11, 11, 10, 8,
+ 16, 16, 15, 13, 16, 14, 16, 13, 14, 14, 13, 12, 13, 12, 12, 8,
+ 16, 16, 16, 14, 16, 14, 16, 13, 16, 14, 15, 13, 15, 13, 13, 9,
+ 15, 15, 14, 14, 15, 14, 14, 12, 13, 14, 11, 11, 12, 12, 11, 8,
+ 15, 16, 15, 13, 15, 14, 14, 12, 14, 14, 12, 11, 13, 12, 12, 8,
+ 16, 16, 16, 13, 16, 15, 15, 13, 16, 15, 14, 11, 15, 12, 13, 8,
+ 16, 16, 14, 13, 16, 15, 15, 13, 14, 14, 10, 11, 14, 12, 11, 8,
+ 16, 16, 15, 13, 16, 16, 15, 13, 15, 14, 12, 11, 14, 13, 12, 8,
+ 16, 16, 15, 13, 16, 15, 16, 12, 16, 14, 13, 10, 15, 13, 12, 7,
+ 15, 15, 15, 14, 14, 14, 15, 12, 13, 14, 12, 12, 11, 11, 11, 8,
+ 16, 15, 16, 14, 15, 13, 15, 12, 14, 14, 13, 12, 12, 11, 12, 8,
+ 16, 16, 16, 15, 16, 14, 16, 13, 16, 15, 14, 12, 14, 11, 13, 8,
+ 16, 16, 15, 14, 16, 14, 15, 13, 14, 14, 12, 11, 12, 11, 11, 8,
+ 15, 16, 15, 14, 15, 14, 14, 12, 14, 13, 12, 11, 12, 11, 11, 7,
+ 16, 16, 16, 14, 16, 13, 16, 12, 15, 14, 13, 11, 13, 11, 12, 7,
+ 16, 16, 15, 14, 16, 15, 15, 13, 14, 15, 11, 11, 13, 12, 11, 8,
+ 16, 16, 15, 13, 16, 14, 15, 12, 15, 14, 12, 11, 13, 11, 11, 7,
+ 16, 16, 15, 13, 16, 14, 16, 12, 15, 14, 13, 10, 13, 11, 11, 6,
+ 16, 16, 16, 14, 14, 14, 15, 13, 14, 14, 14, 12, 11, 11, 11, 8,
+ 16, 16, 16, 14, 15, 14, 16, 13, 15, 14, 14, 13, 12, 11, 11, 7,
+ 16, 16, 16, 16, 15, 13, 16, 12, 15, 15, 14, 12, 13, 10, 12, 7,
+ 16, 16, 16, 14, 15, 15, 14, 13, 14, 14, 13, 12, 12, 11, 11, 8,
+ 16, 15, 16, 14, 16, 13, 15, 12, 14, 14, 13, 12, 12, 10, 10, 6,
+ 16, 15, 16, 14, 16, 13, 16, 11, 16, 14, 13, 11, 13, 10, 11, 6,
+ 16, 16, 16, 15, 16, 16, 15, 13, 14, 16, 12, 12, 12, 12, 10, 7,
+ 16, 16, 16, 14, 16, 14, 14, 12, 15, 15, 12, 11, 12, 11, 10, 6,
+ 16, 16, 16, 13, 16, 13, 15, 10, 15, 14, 13, 10, 13, 10, 10, 4,
+ },
+ {
+ 1, 6, 6, 7, 6, 7, 9, 8, 7, 9, 7, 8, 7, 8, 8, 6,
+ 6, 9, 10, 10, 10, 10, 12, 11, 10, 12, 11, 11, 11, 11, 12, 9,
+ 9, 10, 13, 11, 13, 12, 14, 13, 14, 14, 14, 14, 14, 14, 14, 12,
+ 6, 10, 9, 10, 10, 11, 13, 11, 11, 13, 10, 12, 11, 12, 12, 9,
+ 6, 10, 10, 10, 10, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 9,
+ 9, 11, 13, 12, 13, 14, 15, 13, 14, 16, 14, 14, 14, 14, 15, 12,
+ 10, 13, 11, 13, 14, 14, 16, 14, 14, 15, 13, 14, 15, 15, 16, 12,
+ 9, 13, 12, 12, 14, 14, 16, 14, 14, 15, 14, 14, 15, 15, 15, 12,
+ 8, 11, 12, 11, 13, 14, 15, 13, 13, 15, 14, 14, 13, 15, 15, 11,
+ 6, 10, 10, 11, 9, 10, 13, 11, 10, 13, 11, 12, 10, 12, 12, 9,
+ 6, 10, 10, 11, 11, 10, 13, 11, 11, 13, 11, 12, 12, 12, 13, 10,
+ 9, 12, 13, 13, 13, 12, 16, 13, 14, 15, 14, 14, 15, 14, 15, 12,
+ 8, 12, 12, 13, 12, 13, 15, 14, 13, 15, 13, 14, 13, 13, 14, 11,
+ 7, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 13, 12, 13, 13, 10,
+ 9, 12, 13, 13, 13, 13, 16, 13, 13, 15, 14, 14, 14, 15, 15, 12,
+ 11, 15, 14, 15, 15, 16, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
+ 10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 15, 15, 15, 15, 16, 13,
+ 9, 12, 13, 13, 13, 14, 16, 14, 13, 15, 14, 14, 14, 16, 15, 12,
+ 10, 13, 14, 14, 11, 13, 16, 14, 14, 16, 15, 15, 12, 14, 15, 12,
+ 10, 13, 14, 14, 12, 12, 16, 15, 14, 16, 15, 15, 14, 14, 16, 12,
+ 9, 12, 13, 14, 13, 11, 16, 13, 14, 15, 13, 14, 14, 14, 15, 12,
+ 11, 15, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 13, 14, 14, 13, 14, 16, 15, 14, 16, 16, 16, 14, 15, 16, 13,
+ 10, 13, 13, 14, 13, 13, 16, 13, 13, 14, 14, 15, 15, 14, 15, 13,
+ 13, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 12, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 12, 13, 14, 13, 13, 14, 13, 13, 14, 13, 14, 14, 14, 15, 12,
+ 6, 10, 11, 11, 10, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 10,
+ 8, 12, 13, 13, 12, 13, 14, 14, 13, 15, 14, 14, 14, 14, 15, 12,
+ 12, 14, 16, 15, 15, 15, 16, 15, 16, 16, 16, 16, 16, 16, 16, 14,
+ 7, 11, 11, 12, 12, 12, 14, 13, 12, 14, 11, 12, 13, 13, 13, 11,
+ 8, 11, 12, 12, 12, 12, 14, 13, 12, 14, 12, 13, 13, 14, 14, 11,
+ 11, 13, 14, 14, 14, 14, 16, 15, 15, 16, 15, 15, 16, 16, 16, 13,
+ 10, 14, 12, 14, 14, 15, 16, 15, 13, 16, 12, 14, 16, 16, 15, 13,
+ 10, 13, 13, 14, 14, 15, 16, 15, 14, 16, 14, 15, 15, 16, 16, 12,
+ 10, 13, 14, 13, 14, 14, 16, 15, 14, 16, 15, 15, 14, 16, 16, 13,
+ 7, 11, 11, 11, 10, 12, 14, 13, 11, 14, 13, 13, 10, 12, 13, 10,
+ 8, 11, 12, 12, 11, 12, 14, 13, 12, 15, 13, 13, 12, 13, 14, 11,
+ 11, 13, 14, 14, 14, 14, 16, 15, 14, 16, 15, 16, 16, 16, 16, 14,
+ 8, 12, 12, 13, 12, 13, 15, 14, 12, 15, 13, 13, 13, 14, 14, 11,
+ 6, 10, 10, 11, 10, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 9,
+ 9, 12, 13, 13, 13, 13, 14, 13, 13, 15, 14, 14, 14, 14, 14, 12,
+ 11, 15, 14, 15, 14, 15, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
+ 9, 13, 12, 13, 13, 13, 15, 14, 13, 14, 13, 14, 14, 15, 14, 12,
+ 9, 12, 12, 12, 12, 13, 14, 13, 13, 14, 13, 13, 13, 13, 14, 11,
+ 10, 13, 15, 14, 12, 14, 16, 14, 14, 16, 15, 15, 12, 14, 16, 12,
+ 10, 14, 14, 14, 13, 14, 16, 15, 14, 16, 16, 16, 13, 14, 16, 13,
+ 11, 13, 14, 14, 14, 13, 16, 14, 14, 16, 15, 15, 15, 15, 16, 13,
+ 11, 15, 15, 15, 14, 15, 16, 16, 15, 16, 16, 16, 14, 16, 16, 13,
+ 9, 13, 13, 13, 12, 13, 15, 14, 13, 15, 14, 14, 13, 14, 15, 11,
+ 9, 12, 12, 13, 12, 12, 14, 13, 13, 14, 13, 14, 14, 14, 14, 11,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 11, 14, 14, 15, 15, 14, 16, 16, 14, 16, 14, 15, 15, 16, 16, 12,
+ 9, 12, 12, 13, 12, 12, 14, 12, 12, 14, 13, 13, 13, 13, 14, 11,
+ 11, 14, 14, 16, 14, 16, 16, 16, 13, 16, 14, 16, 14, 16, 16, 13,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 15, 14, 16, 14, 15, 16, 16, 15, 16, 14, 15, 16, 16, 16, 13,
+ 11, 15, 14, 16, 15, 16, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 11, 14, 13, 14, 15, 14, 16, 15, 14, 16, 12, 14, 16, 16, 15, 13,
+ 11, 14, 14, 16, 14, 15, 16, 16, 15, 16, 14, 15, 16, 16, 16, 14,
+ 12, 14, 14, 15, 14, 16, 16, 15, 14, 16, 15, 15, 15, 16, 16, 13,
+ 11, 14, 15, 15, 13, 15, 16, 16, 14, 16, 16, 16, 12, 15, 15, 13,
+ 11, 15, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 11, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 14, 15, 14, 14, 15, 12,
+ 12, 15, 14, 16, 14, 15, 16, 15, 15, 16, 15, 15, 16, 15, 16, 13,
+ 12, 16, 14, 16, 15, 16, 16, 16, 16, 16, 14, 15, 16, 16, 16, 14,
+ 10, 13, 13, 14, 14, 13, 16, 14, 13, 16, 13, 14, 15, 15, 15, 12,
+ 10, 13, 13, 14, 13, 13, 16, 14, 14, 15, 14, 14, 14, 14, 15, 12,
+ 10, 14, 15, 14, 13, 15, 16, 15, 14, 16, 16, 16, 11, 14, 16, 12,
+ 11, 14, 14, 16, 14, 15, 16, 15, 15, 16, 16, 16, 13, 15, 16, 13,
+ 12, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13,
+ 12, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
+ 10, 13, 14, 14, 13, 14, 16, 14, 13, 16, 15, 14, 12, 14, 16, 11,
+ 10, 13, 13, 14, 13, 14, 16, 14, 14, 15, 14, 14, 13, 14, 14, 11,
+ 13, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 11, 13, 14, 15, 14, 14, 16, 15, 14, 16, 14, 15, 14, 15, 16, 12,
+ 8, 11, 11, 11, 11, 12, 13, 12, 11, 13, 11, 12, 11, 12, 12, 9,
+ },
+ },
+ {
+ {
+ 8, 8, 8, 7, 8, 7, 8, 6, 8, 8, 7, 6, 7, 6, 6, 4,
+ 11, 10, 11, 9, 11, 9, 11, 8, 11, 10, 10, 9, 10, 8, 9, 6,
+ 13, 11, 13, 10, 12, 10, 13, 9, 13, 12, 13, 10, 12, 10, 11, 7,
+ 11, 11, 10, 9, 11, 10, 11, 9, 10, 11, 9, 8, 10, 9, 9, 6,
+ 12, 12, 11, 9, 12, 11, 12, 9, 12, 12, 11, 9, 11, 10, 10, 7,
+ 14, 13, 13, 10, 15, 12, 13, 10, 15, 13, 13, 10, 13, 12, 12, 8,
+ 13, 13, 11, 10, 14, 13, 12, 10, 13, 13, 10, 10, 12, 11, 10, 8,
+ 15, 14, 13, 10, 14, 13, 13, 10, 14, 13, 12, 10, 13, 12, 11, 8,
+ 14, 14, 13, 10, 16, 13, 13, 10, 15, 14, 13, 10, 13, 12, 12, 8,
+ 11, 11, 11, 10, 10, 9, 10, 9, 10, 10, 10, 9, 9, 8, 9, 6,
+ 12, 12, 12, 11, 11, 9, 12, 9, 12, 12, 11, 10, 11, 9, 10, 7,
+ 14, 13, 14, 12, 13, 10, 13, 10, 15, 13, 14, 12, 12, 10, 12, 8,
+ 13, 13, 12, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10, 7,
+ 14, 13, 13, 11, 13, 12, 12, 10, 13, 13, 12, 11, 12, 10, 10, 7,
+ 16, 15, 15, 12, 14, 12, 13, 10, 15, 14, 13, 12, 13, 12, 12, 8,
+ 15, 15, 13, 13, 14, 14, 14, 12, 14, 14, 12, 11, 13, 12, 11, 8,
+ 15, 16, 14, 12, 15, 14, 13, 11, 15, 15, 13, 12, 13, 12, 11, 8,
+ 16, 15, 15, 12, 16, 14, 14, 10, 15, 15, 14, 12, 14, 12, 12, 8,
+ 13, 13, 13, 13, 11, 10, 12, 10, 12, 13, 12, 11, 10, 10, 10, 8,
+ 14, 13, 14, 13, 12, 10, 13, 10, 14, 14, 13, 12, 12, 10, 11, 8,
+ 15, 14, 16, 14, 13, 10, 14, 10, 16, 14, 14, 13, 13, 10, 12, 8,
+ 15, 15, 14, 14, 14, 13, 13, 12, 14, 14, 13, 12, 12, 11, 11, 9,
+ 15, 15, 15, 14, 14, 12, 14, 11, 15, 14, 13, 13, 13, 11, 11, 8,
+ 16, 15, 16, 14, 15, 12, 14, 11, 16, 16, 15, 13, 14, 12, 12, 8,
+ 16, 16, 16, 14, 15, 14, 14, 12, 15, 15, 14, 13, 13, 12, 11, 9,
+ 16, 16, 15, 15, 16, 14, 14, 11, 16, 16, 14, 13, 14, 12, 12, 8,
+ 16, 16, 16, 13, 15, 13, 14, 10, 16, 16, 15, 13, 14, 12, 12, 8,
+ 11, 11, 11, 10, 11, 10, 11, 9, 10, 10, 9, 8, 9, 9, 9, 6,
+ 12, 12, 13, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10, 7,
+ 15, 13, 15, 12, 14, 13, 14, 11, 14, 13, 13, 11, 13, 11, 12, 8,
+ 12, 13, 12, 11, 13, 11, 12, 10, 11, 12, 10, 9, 11, 10, 10, 7,
+ 14, 13, 13, 11, 14, 12, 13, 11, 12, 12, 11, 10, 12, 11, 10, 7,
+ 15, 14, 15, 12, 15, 13, 15, 11, 15, 14, 13, 11, 13, 12, 12, 8,
+ 14, 14, 13, 12, 15, 14, 13, 12, 13, 13, 11, 10, 13, 12, 11, 8,
+ 16, 15, 13, 12, 15, 14, 14, 12, 14, 14, 12, 11, 14, 12, 11, 8,
+ 16, 15, 14, 12, 16, 15, 15, 11, 15, 14, 13, 11, 14, 13, 12, 8,
+ 12, 12, 12, 11, 12, 11, 12, 10, 11, 11, 11, 10, 10, 9, 9, 7,
+ 13, 13, 14, 12, 13, 11, 13, 11, 13, 12, 12, 11, 11, 10, 10, 7,
+ 15, 14, 16, 13, 14, 12, 14, 11, 14, 14, 14, 12, 13, 11, 12, 8,
+ 13, 13, 13, 12, 13, 12, 13, 11, 12, 12, 11, 10, 11, 10, 10, 7,
+ 14, 14, 13, 12, 13, 12, 13, 10, 13, 13, 11, 10, 12, 10, 10, 7,
+ 16, 15, 15, 13, 15, 12, 14, 11, 15, 14, 13, 11, 13, 11, 11, 7,
+ 15, 16, 14, 13, 15, 14, 14, 12, 14, 14, 12, 11, 13, 12, 11, 8,
+ 16, 15, 14, 13, 15, 14, 14, 11, 14, 14, 12, 11, 13, 12, 11, 7,
+ 16, 15, 15, 12, 16, 14, 14, 11, 15, 14, 13, 11, 14, 12, 11, 7,
+ 14, 15, 14, 14, 13, 12, 13, 12, 13, 13, 12, 12, 11, 10, 11, 8,
+ 15, 15, 15, 14, 13, 12, 14, 12, 14, 14, 13, 12, 12, 11, 11, 8,
+ 16, 15, 16, 14, 14, 12, 15, 12, 16, 14, 14, 13, 13, 11, 12, 8,
+ 15, 15, 15, 14, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 8,
+ 15, 15, 15, 14, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 7,
+ 16, 15, 16, 14, 15, 12, 15, 11, 15, 14, 14, 12, 13, 11, 12, 7,
+ 16, 16, 16, 15, 16, 15, 14, 13, 15, 15, 13, 12, 13, 12, 11, 9,
+ 16, 16, 16, 14, 15, 14, 14, 12, 15, 15, 13, 12, 14, 12, 11, 8,
+ 16, 16, 16, 14, 16, 14, 14, 11, 15, 15, 14, 12, 14, 12, 11, 7,
+ 13, 13, 13, 12, 13, 12, 13, 11, 11, 12, 11, 10, 10, 10, 10, 8,
+ 15, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 13, 11, 11, 8,
+ 16, 15, 16, 14, 16, 14, 16, 13, 15, 14, 14, 12, 14, 12, 13, 9,
+ 14, 15, 13, 13, 14, 13, 14, 12, 12, 13, 11, 11, 12, 11, 11, 8,
+ 15, 15, 14, 13, 15, 14, 14, 12, 13, 13, 12, 11, 13, 12, 11, 8,
+ 16, 16, 16, 13, 16, 15, 16, 13, 15, 14, 14, 12, 14, 13, 13, 9,
+ 14, 15, 13, 13, 16, 15, 15, 13, 13, 14, 11, 11, 13, 12, 11, 9,
+ 16, 16, 14, 13, 16, 15, 16, 13, 14, 14, 12, 11, 14, 13, 12, 8,
+ 16, 16, 15, 12, 16, 15, 15, 12, 15, 14, 13, 11, 14, 13, 12, 8,
+ 14, 14, 14, 13, 14, 13, 14, 12, 12, 13, 12, 11, 11, 11, 11, 8,
+ 15, 15, 15, 14, 14, 13, 15, 12, 14, 13, 13, 12, 12, 11, 11, 8,
+ 16, 16, 16, 15, 15, 14, 16, 13, 15, 14, 14, 12, 14, 12, 12, 9,
+ 15, 15, 14, 14, 14, 14, 14, 13, 13, 14, 12, 11, 12, 11, 11, 8,
+ 15, 15, 15, 13, 15, 14, 14, 12, 13, 13, 12, 11, 12, 11, 11, 7,
+ 16, 15, 16, 14, 16, 14, 15, 12, 15, 14, 14, 12, 13, 12, 12, 8,
+ 16, 16, 15, 14, 16, 15, 15, 13, 14, 14, 12, 11, 13, 12, 11, 8,
+ 16, 16, 15, 13, 16, 14, 14, 12, 14, 15, 12, 11, 13, 12, 11, 7,
+ 16, 16, 16, 13, 16, 15, 15, 12, 15, 14, 13, 11, 14, 12, 11, 7,
+ 15, 15, 15, 14, 13, 13, 14, 13, 13, 14, 13, 12, 11, 11, 11, 8,
+ 16, 16, 16, 14, 15, 13, 15, 12, 14, 14, 14, 13, 12, 11, 12, 8,
+ 16, 16, 16, 14, 15, 13, 15, 12, 15, 14, 14, 12, 13, 11, 12, 8,
+ 15, 16, 16, 14, 15, 14, 15, 13, 14, 14, 12, 12, 11, 11, 11, 8,
+ 16, 15, 15, 14, 15, 14, 14, 12, 14, 14, 13, 12, 12, 11, 11, 7,
+ 16, 16, 16, 13, 15, 13, 15, 12, 15, 14, 14, 12, 13, 11, 11, 7,
+ 16, 16, 16, 15, 15, 16, 15, 13, 14, 14, 12, 12, 12, 12, 11, 8,
+ 16, 16, 16, 14, 16, 14, 14, 12, 15, 15, 13, 11, 12, 11, 10, 7,
+ 16, 16, 15, 13, 16, 14, 14, 11, 15, 14, 13, 10, 13, 11, 10, 5,
+ },
+ {
+ 1, 6, 6, 7, 6, 7, 9, 7, 6, 9, 7, 8, 7, 8, 8, 5,
+ 5, 8, 10, 10, 10, 10, 12, 11, 11, 12, 11, 11, 11, 12, 12, 9,
+ 9, 10, 12, 11, 13, 12, 15, 13, 14, 15, 15, 14, 14, 15, 15, 12,
+ 6, 10, 9, 10, 10, 11, 13, 12, 11, 13, 11, 12, 12, 12, 12, 10,
+ 6, 10, 10, 10, 11, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 10,
+ 9, 12, 13, 12, 13, 13, 16, 13, 14, 16, 15, 14, 14, 15, 16, 12,
+ 9, 13, 11, 13, 14, 14, 16, 15, 14, 16, 13, 15, 15, 15, 15, 12,
+ 9, 13, 12, 13, 14, 15, 16, 15, 14, 16, 15, 15, 15, 15, 16, 12,
+ 8, 12, 12, 11, 13, 14, 15, 13, 13, 15, 14, 14, 14, 14, 14, 12,
+ 6, 10, 10, 11, 9, 10, 13, 11, 11, 13, 12, 12, 10, 12, 12, 9,
+ 6, 10, 11, 11, 11, 10, 13, 12, 11, 13, 12, 12, 12, 12, 13, 10,
+ 9, 12, 13, 13, 13, 12, 16, 13, 14, 16, 14, 15, 16, 14, 15, 12,
+ 8, 12, 13, 13, 13, 13, 16, 14, 13, 16, 13, 14, 14, 14, 14, 12,
+ 7, 11, 11, 12, 11, 12, 14, 13, 12, 14, 13, 13, 12, 13, 13, 11,
+ 9, 12, 13, 13, 13, 13, 15, 14, 14, 16, 16, 15, 15, 15, 16, 12,
+ 11, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 14, 14, 15, 15, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
+ 9, 13, 13, 13, 14, 14, 16, 14, 14, 16, 15, 14, 14, 16, 16, 13,
+ 9, 13, 14, 14, 11, 13, 16, 14, 13, 16, 15, 16, 13, 14, 15, 12,
+ 10, 13, 14, 15, 13, 12, 16, 14, 14, 16, 15, 15, 14, 14, 16, 13,
+ 9, 12, 13, 14, 12, 11, 15, 13, 13, 15, 13, 14, 15, 14, 16, 12,
+ 11, 15, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13,
+ 11, 14, 14, 15, 13, 14, 16, 15, 15, 16, 16, 16, 16, 16, 16, 13,
+ 10, 12, 13, 14, 13, 13, 16, 14, 14, 14, 14, 16, 15, 14, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 9, 12, 13, 14, 13, 13, 16, 13, 13, 15, 15, 16, 15, 15, 16, 12,
+ 6, 11, 11, 12, 10, 12, 13, 12, 11, 13, 11, 12, 11, 12, 13, 10,
+ 9, 12, 13, 13, 13, 13, 16, 14, 14, 15, 14, 14, 14, 14, 14, 12,
+ 12, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 7, 11, 11, 12, 12, 12, 14, 13, 12, 14, 11, 13, 13, 13, 13, 11,
+ 8, 12, 12, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13, 14, 14, 11,
+ 11, 14, 14, 15, 16, 15, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13,
+ 10, 14, 12, 14, 15, 15, 16, 16, 14, 16, 12, 15, 16, 16, 16, 13,
+ 11, 14, 13, 15, 15, 15, 16, 16, 14, 16, 14, 14, 16, 16, 16, 13,
+ 11, 14, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 13,
+ 7, 11, 12, 11, 10, 12, 14, 13, 12, 14, 13, 13, 10, 12, 13, 10,
+ 8, 12, 12, 13, 12, 12, 15, 13, 13, 14, 13, 13, 13, 13, 14, 11,
+ 11, 13, 15, 16, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 9, 12, 13, 13, 13, 13, 15, 14, 13, 15, 13, 14, 13, 14, 14, 12,
+ 7, 11, 11, 11, 11, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 10,
+ 9, 12, 13, 13, 13, 13, 16, 13, 14, 16, 15, 14, 14, 14, 16, 12,
+ 12, 14, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
+ 10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 14, 14, 16, 15, 15, 12,
+ 9, 12, 13, 13, 13, 15, 16, 14, 13, 16, 14, 13, 13, 14, 14, 11,
+ 10, 14, 15, 14, 12, 14, 16, 15, 13, 16, 16, 16, 12, 14, 16, 12,
+ 11, 14, 14, 14, 14, 14, 16, 15, 15, 16, 16, 16, 14, 15, 16, 13,
+ 11, 14, 14, 16, 14, 13, 16, 15, 14, 16, 15, 16, 15, 15, 16, 13,
+ 12, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14,
+ 10, 13, 14, 14, 13, 14, 16, 14, 13, 16, 15, 15, 13, 14, 14, 12,
+ 9, 12, 13, 14, 13, 12, 16, 14, 13, 16, 14, 14, 14, 14, 15, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 9, 12, 13, 13, 13, 13, 14, 13, 12, 15, 14, 14, 14, 14, 14, 11,
+ 11, 14, 14, 16, 14, 16, 16, 16, 13, 16, 14, 16, 14, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 14, 14, 16, 16, 15, 16, 16, 15, 16, 14, 16, 16, 16, 16, 14,
+ 12, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 14, 12, 15, 15, 15, 16, 16, 14, 16, 12, 14, 16, 16, 15, 14,
+ 12, 15, 14, 16, 16, 16, 16, 16, 15, 16, 14, 16, 16, 16, 16, 14,
+ 12, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14,
+ 11, 15, 15, 16, 14, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 11, 15, 14, 16, 14, 14, 16, 15, 14, 16, 15, 16, 15, 16, 16, 12,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 12, 16, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
+ 10, 14, 13, 14, 15, 14, 16, 15, 14, 16, 13, 16, 16, 16, 15, 13,
+ 10, 14, 14, 14, 13, 14, 16, 15, 15, 16, 14, 14, 14, 16, 16, 12,
+ 10, 14, 15, 14, 13, 16, 16, 15, 13, 16, 16, 16, 12, 14, 16, 12,
+ 11, 16, 16, 16, 14, 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
+ 12, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14,
+ 11, 14, 14, 14, 14, 15, 16, 14, 14, 16, 16, 16, 13, 15, 15, 12,
+ 10, 14, 13, 14, 14, 14, 16, 15, 14, 16, 15, 15, 14, 14, 16, 12,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 12, 14, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 13,
+ 8, 11, 11, 12, 12, 12, 13, 12, 11, 13, 12, 12, 12, 13, 12, 10,
+ },
+ },
+ {
+ {
+ 5, 6, 6, 6, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 4,
+ 9, 9, 9, 8, 9, 8, 10, 8, 10, 10, 9, 9, 9, 8, 9, 6,
+ 11, 10, 12, 10, 11, 10, 12, 9, 12, 11, 11, 10, 11, 10, 11, 8,
+ 9, 10, 9, 8, 10, 10, 10, 9, 9, 10, 8, 8, 9, 9, 8, 7,
+ 10, 11, 10, 9, 11, 11, 11, 9, 11, 11, 10, 9, 10, 10, 10, 7,
+ 13, 12, 12, 10, 13, 12, 13, 10, 13, 12, 12, 11, 13, 12, 11, 9,
+ 11, 12, 10, 10, 12, 12, 11, 10, 11, 12, 10, 10, 11, 11, 10, 8,
+ 12, 12, 11, 10, 13, 13, 13, 10, 13, 13, 12, 11, 13, 12, 11, 9,
+ 12, 12, 12, 10, 13, 13, 13, 10, 13, 13, 12, 10, 13, 12, 12, 9,
+ 9, 9, 10, 10, 9, 8, 10, 9, 9, 10, 9, 9, 8, 8, 9, 6,
+ 10, 11, 11, 11, 10, 9, 11, 9, 11, 11, 11, 10, 10, 9, 10, 7,
+ 12, 12, 13, 12, 12, 10, 13, 10, 13, 13, 13, 12, 12, 11, 11, 9,
+ 11, 12, 11, 11, 11, 11, 11, 10, 11, 12, 10, 10, 10, 10, 10, 8,
+ 12, 12, 12, 11, 12, 11, 11, 10, 12, 12, 11, 11, 11, 11, 10, 8,
+ 14, 13, 13, 12, 13, 12, 13, 10, 14, 14, 13, 12, 13, 12, 12, 9,
+ 13, 14, 13, 12, 13, 13, 13, 12, 13, 13, 12, 12, 12, 12, 11, 9,
+ 14, 14, 13, 12, 13, 13, 13, 11, 14, 14, 13, 12, 13, 12, 12, 9,
+ 14, 15, 14, 12, 15, 13, 13, 11, 15, 14, 14, 12, 14, 13, 12, 9,
+ 11, 11, 12, 12, 10, 10, 12, 11, 11, 12, 11, 11, 10, 10, 10, 8,
+ 12, 12, 14, 13, 11, 10, 12, 11, 13, 13, 13, 12, 12, 10, 11, 9,
+ 13, 13, 14, 14, 12, 10, 13, 11, 14, 14, 14, 13, 12, 11, 12, 9,
+ 13, 13, 13, 13, 12, 13, 13, 12, 13, 14, 12, 12, 12, 12, 11, 9,
+ 13, 14, 14, 13, 13, 12, 13, 11, 14, 14, 13, 12, 13, 12, 12, 9,
+ 14, 14, 14, 14, 14, 12, 13, 11, 15, 15, 15, 13, 14, 12, 12, 9,
+ 14, 15, 15, 13, 14, 14, 13, 12, 13, 14, 13, 13, 12, 12, 11, 10,
+ 16, 16, 15, 14, 15, 14, 13, 11, 15, 15, 14, 13, 13, 13, 12, 9,
+ 15, 15, 15, 13, 14, 13, 13, 11, 15, 15, 15, 13, 14, 13, 12, 9,
+ 8, 9, 9, 9, 9, 9, 10, 9, 8, 10, 9, 9, 8, 8, 9, 7,
+ 11, 11, 11, 11, 11, 11, 12, 10, 11, 11, 11, 10, 10, 10, 10, 8,
+ 13, 13, 14, 12, 13, 12, 14, 11, 13, 13, 13, 12, 13, 11, 12, 9,
+ 10, 11, 10, 11, 11, 11, 12, 10, 10, 11, 10, 10, 10, 10, 10, 8,
+ 12, 12, 12, 11, 12, 12, 12, 11, 11, 12, 11, 10, 11, 11, 10, 8,
+ 14, 13, 14, 12, 14, 13, 14, 12, 14, 13, 13, 11, 13, 12, 12, 9,
+ 12, 13, 12, 12, 13, 13, 13, 12, 12, 13, 11, 11, 12, 12, 11, 9,
+ 13, 14, 13, 12, 14, 14, 14, 12, 14, 13, 12, 11, 13, 12, 12, 9,
+ 14, 14, 13, 12, 15, 14, 15, 12, 14, 14, 13, 11, 13, 13, 12, 9,
+ 10, 11, 11, 11, 10, 10, 12, 10, 10, 11, 10, 10, 9, 9, 10, 7,
+ 12, 12, 13, 12, 12, 11, 12, 11, 12, 12, 12, 11, 11, 10, 10, 8,
+ 14, 13, 14, 13, 14, 12, 13, 12, 14, 13, 14, 12, 13, 11, 12, 9,
+ 12, 13, 12, 12, 12, 12, 12, 11, 11, 12, 11, 10, 10, 10, 10, 8,
+ 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 11, 10, 11, 10, 10, 7,
+ 14, 14, 14, 12, 14, 12, 14, 11, 14, 13, 13, 11, 13, 11, 11, 8,
+ 13, 15, 13, 13, 14, 14, 14, 12, 13, 14, 12, 12, 12, 12, 11, 9,
+ 14, 15, 13, 12, 14, 13, 13, 11, 13, 13, 12, 11, 13, 12, 11, 8,
+ 15, 15, 15, 12, 15, 14, 14, 11, 14, 14, 13, 11, 13, 12, 12, 8,
+ 12, 13, 13, 13, 12, 12, 13, 12, 12, 13, 12, 12, 11, 11, 11, 9,
+ 13, 14, 15, 14, 13, 12, 14, 12, 13, 13, 14, 12, 12, 11, 12, 9,
+ 14, 14, 15, 14, 14, 12, 14, 12, 14, 14, 14, 13, 13, 11, 12, 9,
+ 13, 14, 14, 14, 13, 13, 14, 13, 13, 13, 12, 12, 12, 12, 11, 9,
+ 14, 14, 14, 13, 13, 13, 13, 12, 13, 14, 13, 12, 12, 11, 11, 8,
+ 15, 14, 15, 14, 14, 13, 14, 11, 15, 14, 14, 12, 13, 11, 12, 8,
+ 14, 15, 14, 14, 15, 14, 14, 13, 14, 15, 13, 13, 12, 12, 11, 10,
+ 16, 15, 14, 14, 14, 14, 13, 12, 14, 14, 13, 12, 13, 12, 11, 9,
+ 15, 15, 15, 14, 16, 14, 14, 11, 15, 15, 14, 12, 13, 12, 11, 8,
+ 11, 12, 11, 12, 12, 12, 12, 11, 10, 11, 10, 10, 10, 10, 10, 8,
+ 13, 13, 13, 13, 13, 13, 14, 12, 12, 12, 12, 12, 12, 11, 12, 9,
+ 14, 14, 14, 13, 15, 13, 15, 13, 14, 14, 14, 12, 14, 12, 13, 10,
+ 12, 13, 12, 13, 13, 13, 13, 12, 11, 12, 11, 11, 12, 11, 11, 9,
+ 14, 14, 13, 13, 14, 14, 14, 12, 12, 13, 12, 11, 13, 12, 12, 9,
+ 14, 14, 15, 13, 15, 15, 15, 13, 15, 13, 13, 12, 14, 12, 13, 10,
+ 13, 15, 12, 13, 14, 14, 14, 13, 12, 13, 11, 11, 13, 12, 11, 10,
+ 14, 15, 14, 13, 15, 14, 15, 13, 14, 14, 12, 11, 13, 13, 12, 9,
+ 14, 15, 14, 13, 15, 14, 15, 13, 14, 14, 13, 11, 14, 13, 12, 9,
+ 12, 13, 13, 13, 12, 13, 13, 12, 11, 12, 12, 11, 11, 11, 11, 9,
+ 13, 14, 14, 13, 14, 13, 14, 12, 13, 13, 13, 12, 12, 11, 11, 9,
+ 15, 15, 16, 14, 15, 14, 14, 13, 15, 14, 14, 13, 13, 12, 13, 10,
+ 13, 14, 14, 13, 13, 14, 14, 13, 12, 13, 12, 12, 11, 11, 11, 9,
+ 14, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 12, 11, 11, 8,
+ 15, 15, 15, 13, 15, 14, 14, 12, 14, 13, 13, 12, 13, 12, 12, 9,
+ 14, 15, 14, 14, 15, 15, 14, 13, 13, 14, 12, 12, 13, 12, 12, 9,
+ 15, 15, 14, 13, 15, 14, 14, 13, 14, 14, 12, 11, 13, 12, 11, 8,
+ 15, 16, 14, 13, 15, 15, 15, 12, 14, 14, 13, 11, 14, 12, 12, 8,
+ 12, 14, 13, 13, 13, 13, 14, 12, 12, 13, 12, 12, 10, 11, 11, 9,
+ 14, 15, 15, 14, 13, 13, 15, 13, 13, 14, 14, 12, 12, 11, 12, 9,
+ 15, 15, 16, 14, 14, 13, 15, 13, 14, 14, 14, 13, 13, 11, 12, 9,
+ 14, 15, 14, 14, 14, 14, 14, 13, 13, 14, 13, 12, 12, 12, 11, 9,
+ 14, 15, 15, 14, 14, 14, 14, 12, 13, 14, 13, 12, 12, 11, 11, 8,
+ 15, 15, 15, 14, 14, 13, 15, 12, 15, 14, 14, 12, 13, 11, 11, 8,
+ 14, 16, 14, 14, 14, 15, 14, 13, 13, 14, 12, 12, 12, 12, 11, 9,
+ 15, 15, 15, 14, 15, 14, 14, 12, 14, 14, 13, 12, 12, 11, 11, 8,
+ 15, 15, 14, 13, 15, 13, 14, 12, 14, 14, 13, 11, 13, 11, 11, 7,
+ },
+ {
+ 1, 5, 6, 7, 6, 7, 9, 8, 6, 9, 8, 8, 7, 8, 8, 6,
+ 5, 8, 10, 10, 10, 11, 13, 12, 11, 13, 12, 12, 12, 12, 13, 10,
+ 8, 10, 13, 12, 13, 13, 16, 14, 14, 16, 16, 14, 16, 16, 16, 12,
+ 5, 10, 9, 11, 11, 12, 13, 12, 11, 13, 11, 12, 12, 12, 13, 10,
+ 6, 10, 11, 11, 11, 12, 14, 12, 11, 13, 13, 13, 12, 13, 13, 11,
+ 8, 12, 13, 12, 14, 14, 16, 14, 14, 16, 16, 16, 16, 16, 16, 13,
+ 9, 13, 11, 14, 14, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
+ 9, 13, 13, 13, 14, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 14,
+ 8, 12, 13, 12, 13, 14, 16, 14, 14, 16, 16, 16, 14, 16, 16, 13,
+ 5, 10, 11, 12, 9, 11, 13, 12, 11, 13, 13, 13, 11, 12, 13, 10,
+ 6, 10, 11, 12, 11, 11, 14, 13, 12, 14, 12, 13, 13, 13, 13, 11,
+ 9, 12, 14, 15, 13, 13, 16, 16, 14, 16, 16, 16, 16, 16, 16, 13,
+ 8, 13, 13, 14, 13, 14, 16, 16, 14, 16, 14, 16, 14, 16, 14, 13,
+ 7, 11, 12, 13, 12, 12, 14, 13, 12, 14, 13, 14, 13, 14, 14, 12,
+ 9, 13, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 15, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 9, 13, 14, 14, 14, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
+ 9, 13, 14, 15, 11, 13, 16, 14, 14, 16, 16, 16, 13, 14, 16, 13,
+ 9, 13, 14, 16, 13, 13, 16, 16, 14, 16, 16, 16, 16, 15, 16, 14,
+ 8, 12, 13, 16, 13, 12, 16, 14, 13, 16, 14, 16, 16, 16, 16, 13,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 14, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 9, 13, 16, 16, 14, 14, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 13, 14, 15, 14, 14, 16, 14, 13, 16, 16, 16, 14, 16, 16, 14,
+ 6, 11, 11, 12, 11, 12, 14, 13, 11, 14, 12, 13, 12, 13, 13, 11,
+ 9, 13, 13, 14, 13, 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 13,
+ 11, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 7, 11, 11, 13, 12, 13, 16, 14, 12, 16, 12, 14, 14, 14, 14, 12,
+ 8, 12, 12, 13, 12, 14, 16, 14, 13, 16, 14, 14, 14, 14, 14, 12,
+ 11, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 14, 13, 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16,
+ 10, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 7, 11, 12, 12, 11, 13, 16, 14, 12, 15, 14, 14, 11, 13, 13, 12,
+ 8, 12, 12, 13, 13, 13, 16, 14, 13, 16, 13, 15, 13, 14, 14, 12,
+ 11, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 8, 12, 13, 14, 13, 14, 16, 16, 14, 16, 14, 16, 14, 16, 15, 13,
+ 6, 11, 11, 12, 11, 12, 13, 13, 11, 13, 12, 13, 12, 13, 13, 11,
+ 9, 13, 14, 14, 14, 14, 16, 14, 14, 16, 16, 16, 16, 16, 14, 13,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 14, 13, 14, 14, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
+ 9, 13, 14, 13, 13, 16, 16, 14, 13, 16, 16, 16, 13, 16, 14, 13,
+ 10, 14, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 13, 14, 16, 14,
+ 11, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 14, 16, 16, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 14, 14, 14, 14, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 13,
+ 9, 13, 13, 16, 14, 14, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 13, 14, 14, 13, 16, 16, 14, 13, 16, 14, 16, 14, 14, 16, 12,
+ 10, 14, 14, 16, 16, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 14,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 14, 13, 16, 16, 16, 16, 16, 14, 16, 12, 16, 16, 16, 16, 14,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 14,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
+ 11, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 15, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 14,
+ 10, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 10, 14, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 14,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
+ 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 15, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
+ 10, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 8, 12, 12, 13, 12, 14, 14, 14, 12, 16, 13, 14, 12, 14, 14, 11,
+ },
+ },
};
-static const uint8_t rv34_table_intra_cbp[NUM_INTRA_TABLES][8][CBP_VLC_SIZE] =
-{
- {
- { 0, 3, 3, 4, 3, 5, 5, 5, 2, 5, 4, 6, 4, 6, 6, 6, },
- { 0, 2, 3, 4, 2, 5, 6, 7, 3, 6, 5, 7, 4, 7, 8, 8, },
- { 0, 3, 4, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 3, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 6, 3, 5, 6, 5, },
- { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 4, 5, 4, 4, 4, 2, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 6, 6, 5, 6, 5, 6, 4, 6, 6, 5, 4, 4, 4, 4, 1, },
- { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
- },
- {
- { 0, 4, 3, 4, 3, 4, 5, 4, 3, 5, 4, 5, 3, 5, 5, 5, },
- { 0, 2, 3, 4, 2, 5, 6, 7, 3, 6, 5, 7, 4, 7, 8, 8, },
- { 0, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 3, 4, 4, 3, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 6, 3, 5, 6, 5, },
- { 0, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 5, 4, 4, 4, 2, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 5, 6, 5, 5, 5, 6, 4, 6, 6, 5, 4, 5, 4, 4, 1, },
- { 0, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 4, 4, 4, 5, 2, },
- },
- {
- { 0, 3, 3, 4, 3, 4, 4, 5, 3, 5, 4, 5, 4, 5, 5, 5, },
- { 0, 2, 3, 4, 2, 4, 6, 7, 3, 6, 5, 7, 5, 7, 8, 8, },
- { 0, 4, 4, 4, 4, 4, 5, 4, 3, 5, 4, 4, 4, 4, 4, 3, },
- { 0, 3, 3, 4, 3, 3, 6, 6, 3, 6, 4, 6, 3, 6, 6, 5, },
- { 0, 4, 4, 4, 3, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 5, 5, 4, 4, 1, },
- { 0, 4, 4, 4, 4, 4, 6, 4, 4, 6, 5, 4, 4, 4, 4, 2, },
- },
- {
- { 0, 3, 3, 4, 3, 4, 4, 5, 3, 5, 4, 5, 4, 5, 5, 5, },
- { 0, 2, 3, 4, 2, 4, 7, 6, 3, 7, 5, 7, 5, 7, 7, 7, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 3, 3, 3, 3, 4, 6, 6, 3, 6, 4, 6, 3, 6, 6, 5, },
- { 0, 3, 4, 4, 3, 4, 5, 4, 4, 5, 4, 5, 4, 5, 4, 3, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 4, 5, 4, 4, 4, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
- { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
- },
- {
- { 0, 3, 3, 4, 3, 4, 5, 6, 2, 5, 4, 7, 4, 6, 6, 7, },
- { 0, 2, 3, 4, 2, 4, 6, 7, 3, 7, 5, 7, 5, 7, 7, 7, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 2, 3, 4, 3, 4, 6, 5, 3, 6, 4, 6, 4, 6, 6, 6, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
- { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
- { 0, 3, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3, },
- },
+static const uint8_t rv34_table_intra_cbp[NUM_INTRA_TABLES][8][CBP_VLC_SIZE] = {
+ {
+ { 0, 3, 3, 4, 3, 5, 5, 5, 2, 5, 4, 6, 4, 6, 6, 6, },
+ { 0, 2, 3, 4, 2, 5, 6, 7, 3, 6, 5, 7, 4, 7, 8, 8, },
+ { 0, 3, 4, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 3, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 6, 3, 5, 6, 5, },
+ { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 4, 5, 4, 4, 4, 2, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 6, 6, 5, 6, 5, 6, 4, 6, 6, 5, 4, 4, 4, 4, 1, },
+ { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
+ },
+ {
+ { 0, 4, 3, 4, 3, 4, 5, 4, 3, 5, 4, 5, 3, 5, 5, 5, },
+ { 0, 2, 3, 4, 2, 5, 6, 7, 3, 6, 5, 7, 4, 7, 8, 8, },
+ { 0, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 3, 4, 4, 3, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 6, 3, 5, 6, 5, },
+ { 0, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 5, 4, 4, 4, 2, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 5, 6, 5, 5, 5, 6, 4, 6, 6, 5, 4, 5, 4, 4, 1, },
+ { 0, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 4, 4, 4, 5, 2, },
+ },
+ {
+ { 0, 3, 3, 4, 3, 4, 4, 5, 3, 5, 4, 5, 4, 5, 5, 5, },
+ { 0, 2, 3, 4, 2, 4, 6, 7, 3, 6, 5, 7, 5, 7, 8, 8, },
+ { 0, 4, 4, 4, 4, 4, 5, 4, 3, 5, 4, 4, 4, 4, 4, 3, },
+ { 0, 3, 3, 4, 3, 3, 6, 6, 3, 6, 4, 6, 3, 6, 6, 5, },
+ { 0, 4, 4, 4, 3, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 5, 5, 4, 4, 1, },
+ { 0, 4, 4, 4, 4, 4, 6, 4, 4, 6, 5, 4, 4, 4, 4, 2, },
+ },
+ {
+ { 0, 3, 3, 4, 3, 4, 4, 5, 3, 5, 4, 5, 4, 5, 5, 5, },
+ { 0, 2, 3, 4, 2, 4, 7, 6, 3, 7, 5, 7, 5, 7, 7, 7, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 3, 3, 3, 3, 4, 6, 6, 3, 6, 4, 6, 3, 6, 6, 5, },
+ { 0, 3, 4, 4, 3, 4, 5, 4, 4, 5, 4, 5, 4, 5, 4, 3, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 4, 5, 4, 4, 4, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
+ { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
+ },
+ {
+ { 0, 3, 3, 4, 3, 4, 5, 6, 2, 5, 4, 7, 4, 6, 6, 7, },
+ { 0, 2, 3, 4, 2, 4, 6, 7, 3, 7, 5, 7, 5, 7, 7, 7, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 2, 3, 4, 3, 4, 6, 5, 3, 6, 4, 6, 4, 6, 6, 6, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, },
+ { 0, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 2, },
+ { 0, 3, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3, },
+ },
};
-static const uint8_t rv34_table_intra_firstpat[NUM_INTRA_TABLES][4][FIRSTBLK_VLC_SIZE] =
-{
- {
- {
- 0, 10, 5, 10, 7, 12, 9, 11, 8, 13, 9, 12, 10, 13, 11, 12,
- 16, 16, 14, 15, 15, 16, 13, 14, 5, 12, 6, 11, 9, 13, 10, 11,
- 9, 14, 9, 12, 11, 14, 11, 12, 16, 16, 14, 15, 15, 16, 13, 13,
- 10, 15, 9, 12, 12, 16, 11, 12, 12, 16, 10, 13, 13, 16, 11, 12,
- 16, 16, 13, 14, 15, 16, 13, 12, 6, 12, 8, 11, 8, 12, 10, 11,
- 9, 14, 10, 12, 10, 13, 11, 12, 15, 16, 14, 15, 14, 16, 13, 13,
- 8, 13, 9, 12, 10, 13, 10, 12, 10, 14, 9, 12, 11, 14, 10, 12,
- 15, 16, 13, 15, 14, 16, 13, 13, 11, 16, 10, 13, 13, 16, 11, 12,
- 12, 16, 11, 13, 13, 16, 11, 12, 16, 16, 13, 14, 15, 16, 12, 12,
- 10, 16, 12, 14, 10, 14, 11, 12, 12, 16, 13, 14, 11, 14, 12, 12,
- 16, 16, 15, 16, 14, 15, 13, 13, 11, 16, 12, 14, 11, 14, 11, 12,
- 12, 16, 12, 14, 11, 14, 11, 12, 16, 16, 14, 15, 13, 15, 13, 12,
- 14, 16, 13, 14, 13, 16, 12, 12, 14, 16, 13, 14, 13, 16, 12, 12,
- 16, 16, 14, 14, 14, 15, 12, 11, 2, 10, 6, 10, 7, 12, 9, 11,
- 8, 12, 9, 11, 10, 13, 10, 11, 15, 16, 14, 15, 14, 16, 13, 13,
- 5, 12, 6, 11, 9, 13, 10, 11, 9, 13, 9, 11, 10, 13, 10, 11,
- 15, 16, 13, 14, 14, 16, 13, 13, 9, 15, 8, 12, 12, 15, 11, 11,
- 11, 16, 10, 12, 13, 15, 11, 11, 15, 16, 13, 14, 15, 16, 12, 12,
- 6, 12, 8, 11, 8, 12, 9, 11, 9, 14, 9, 12, 10, 13, 10, 11,
- 15, 16, 14, 15, 14, 16, 13, 13, 7, 13, 8, 11, 9, 13, 10, 11,
- 9, 14, 9, 12, 10, 13, 10, 11, 14, 16, 13, 14, 13, 16, 12, 12,
- 11, 16, 10, 12, 12, 15, 11, 11, 11, 16, 10, 12, 12, 15, 11, 11,
- 15, 16, 12, 13, 14, 16, 12, 11, 9, 15, 11, 13, 9, 13, 11, 12,
- 11, 16, 12, 14, 10, 14, 11, 12, 16, 16, 14, 15, 13, 15, 12, 12,
- 11, 16, 11, 14, 10, 14, 11, 12, 11, 16, 12, 13, 11, 14, 11, 11,
- 15, 16, 14, 15, 13, 14, 12, 12, 13, 16, 12, 14, 13, 15, 11, 11,
- 13, 16, 12, 14, 13, 15, 11, 11, 16, 16, 13, 14, 13, 15, 11, 10,
- 5, 12, 7, 11, 8, 13, 10, 11, 9, 13, 9, 12, 10, 14, 11, 12,
- 16, 16, 14, 15, 14, 16, 13, 13, 7, 13, 7, 11, 9, 13, 10, 11,
- 9, 14, 9, 12, 11, 14, 11, 12, 16, 16, 14, 14, 14, 16, 13, 13,
- 9, 15, 8, 12, 12, 15, 11, 12, 11, 16, 10, 12, 13, 16, 11, 12,
- 16, 16, 13, 14, 15, 16, 12, 12, 7, 13, 8, 12, 9, 13, 10, 11,
- 10, 14, 10, 12, 10, 14, 11, 12, 16, 16, 14, 15, 14, 16, 13, 13,
- 8, 14, 9, 12, 10, 13, 10, 11, 9, 14, 9, 12, 10, 14, 10, 11,
- 15, 16, 13, 14, 14, 16, 12, 12, 11, 16, 10, 12, 12, 15, 11, 12,
- 11, 16, 10, 12, 12, 15, 11, 11, 15, 16, 12, 14, 14, 16, 12, 11,
- 10, 16, 11, 13, 9, 14, 11, 12, 12, 16, 12, 14, 11, 14, 11, 12,
- 16, 16, 14, 16, 14, 15, 13, 12, 11, 16, 11, 14, 10, 14, 11, 12,
- 11, 16, 12, 14, 11, 14, 11, 11, 15, 16, 14, 15, 13, 15, 12, 12,
- 13, 16, 12, 14, 13, 15, 11, 11, 13, 16, 12, 14, 12, 14, 11, 11,
- 15, 16, 12, 13, 13, 14, 11, 10, 6, 13, 8, 11, 9, 13, 10, 11,
- 10, 14, 10, 12, 10, 13, 10, 11, 15, 16, 13, 13, 13, 14, 12, 11,
- 7, 13, 8, 11, 9, 13, 9, 11, 10, 14, 9, 11, 10, 13, 10, 11,
- 15, 16, 13, 13, 13, 14, 11, 11, 9, 14, 8, 11, 10, 13, 9, 10,
- 11, 15, 9, 11, 11, 13, 9, 10, 15, 16, 12, 13, 13, 14, 10, 9,
- 7, 13, 8, 11, 9, 13, 9, 11, 10, 14, 10, 12, 10, 13, 10, 11,
- 15, 16, 13, 13, 13, 14, 11, 11, 8, 13, 8, 11, 9, 13, 9, 10,
- 9, 14, 9, 11, 10, 13, 9, 10, 14, 16, 12, 13, 13, 14, 11, 10,
- 9, 14, 8, 11, 10, 13, 9, 9, 10, 14, 8, 11, 10, 13, 9, 9,
- 14, 16, 11, 12, 12, 14, 10, 9, 9, 14, 9, 12, 8, 12, 9, 10,
- 11, 15, 10, 12, 10, 13, 9, 10, 15, 16, 13, 13, 12, 13, 11, 10,
- 9, 14, 9, 12, 9, 12, 9, 10, 10, 14, 10, 12, 9, 12, 9, 9,
- 14, 16, 12, 13, 11, 13, 10, 9, 10, 14, 9, 11, 10, 12, 8, 8,
- 10, 14, 9, 11, 10, 12, 8, 8, 12, 14, 9, 10, 10, 11, 8, 7,
- },
- {
- 0, 9, 6, 9, 6, 10, 8, 9, 7, 11, 8, 11, 9, 11, 9, 10,
- 14, 16, 13, 14, 13, 14, 12, 11, 5, 11, 7, 10, 8, 10, 8, 9,
- 8, 12, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
- 10, 14, 9, 11, 11, 13, 10, 10, 11, 15, 9, 11, 12, 13, 10, 10,
- 15, 16, 12, 12, 13, 14, 11, 9, 6, 11, 7, 10, 7, 10, 8, 9,
- 8, 12, 9, 11, 9, 11, 9, 10, 14, 16, 13, 13, 13, 14, 11, 11,
- 7, 12, 8, 11, 8, 11, 9, 9, 9, 13, 9, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 12, 14, 11, 10, 11, 14, 10, 12, 11, 13, 10, 10,
- 12, 15, 10, 12, 12, 13, 10, 10, 15, 16, 12, 12, 13, 14, 10, 9,
- 10, 14, 11, 13, 9, 12, 10, 10, 11, 15, 12, 13, 10, 12, 10, 10,
- 14, 16, 13, 14, 12, 13, 11, 10, 11, 14, 11, 13, 10, 12, 10, 10,
- 12, 15, 11, 13, 10, 12, 10, 10, 15, 16, 13, 13, 12, 13, 11, 9,
- 13, 16, 12, 13, 12, 13, 10, 9, 14, 16, 12, 13, 12, 13, 10, 9,
- 16, 16, 12, 12, 13, 13, 10, 7, 4, 10, 6, 9, 7, 10, 8, 9,
- 8, 12, 9, 11, 9, 11, 9, 9, 14, 16, 13, 13, 13, 14, 11, 11,
- 6, 11, 7, 10, 8, 11, 8, 9, 9, 12, 9, 11, 9, 12, 9, 9,
- 14, 16, 12, 13, 13, 14, 11, 10, 10, 14, 9, 11, 11, 13, 9, 9,
- 11, 14, 9, 11, 11, 13, 10, 9, 14, 16, 11, 12, 13, 14, 10, 9,
- 6, 11, 8, 10, 7, 10, 8, 9, 9, 12, 9, 11, 9, 11, 9, 9,
- 14, 16, 13, 13, 12, 13, 11, 10, 8, 12, 8, 10, 8, 11, 9, 9,
- 9, 12, 9, 11, 9, 11, 9, 9, 14, 16, 12, 13, 12, 13, 11, 10,
- 11, 14, 10, 11, 11, 13, 9, 9, 11, 14, 10, 11, 11, 13, 9, 9,
- 14, 16, 11, 12, 13, 14, 10, 8, 10, 14, 11, 12, 9, 12, 10, 10,
- 11, 14, 11, 13, 10, 12, 10, 10, 14, 16, 13, 14, 12, 13, 11, 9,
- 11, 14, 11, 12, 10, 12, 10, 10, 11, 14, 11, 12, 10, 12, 10, 9,
- 14, 16, 13, 13, 11, 12, 10, 9, 13, 16, 12, 13, 12, 13, 10, 9,
- 13, 16, 11, 12, 11, 13, 10, 8, 15, 16, 12, 12, 12, 12, 9, 7,
- 8, 12, 8, 11, 9, 12, 9, 10, 10, 14, 10, 12, 11, 13, 10, 10,
- 16, 16, 14, 14, 14, 14, 12, 11, 8, 13, 8, 11, 9, 12, 10, 10,
- 11, 14, 10, 12, 11, 13, 10, 10, 16, 16, 13, 14, 14, 14, 12, 11,
- 11, 14, 9, 12, 11, 13, 10, 10, 12, 15, 10, 12, 12, 14, 10, 10,
- 15, 16, 12, 12, 14, 14, 11, 9, 9, 13, 9, 11, 9, 12, 10, 10,
- 11, 14, 10, 12, 10, 12, 10, 10, 15, 16, 14, 14, 13, 14, 12, 11,
- 9, 13, 9, 11, 10, 12, 10, 10, 10, 14, 10, 12, 10, 12, 10, 10,
- 15, 16, 13, 13, 13, 14, 11, 10, 11, 15, 10, 12, 11, 13, 10, 10,
- 11, 15, 10, 12, 12, 13, 10, 9, 15, 16, 11, 12, 13, 14, 10, 9,
- 11, 15, 11, 13, 10, 12, 10, 10, 12, 16, 12, 13, 11, 13, 10, 10,
- 16, 16, 14, 14, 12, 13, 11, 9, 11, 15, 11, 13, 10, 13, 10, 10,
- 12, 15, 12, 13, 10, 12, 10, 10, 14, 16, 13, 13, 12, 13, 10, 9,
- 13, 16, 12, 13, 12, 13, 10, 9, 13, 16, 11, 12, 11, 13, 10, 9,
- 14, 16, 11, 12, 12, 12, 9, 7, 10, 15, 10, 12, 11, 13, 10, 10,
- 12, 16, 12, 13, 12, 13, 11, 10, 16, 16, 14, 14, 14, 15, 12, 10,
- 10, 14, 10, 12, 10, 13, 10, 10, 12, 15, 11, 12, 11, 13, 10, 10,
- 16, 16, 14, 13, 14, 14, 11, 9, 11, 14, 10, 11, 11, 12, 9, 9,
- 12, 15, 10, 11, 11, 13, 9, 8, 16, 16, 12, 12, 13, 13, 10, 7,
- 10, 15, 10, 12, 10, 13, 10, 10, 12, 15, 11, 12, 11, 13, 10, 10,
- 16, 16, 14, 13, 14, 14, 11, 9, 10, 14, 10, 12, 10, 12, 10, 10,
- 12, 15, 11, 12, 11, 13, 10, 10, 16, 16, 13, 13, 13, 14, 11, 9,
- 11, 14, 10, 11, 10, 12, 9, 8, 11, 14, 9, 11, 11, 12, 9, 8,
- 14, 16, 10, 11, 12, 13, 9, 7, 11, 15, 11, 12, 10, 12, 10, 9,
- 13, 16, 11, 12, 11, 12, 10, 9, 16, 16, 13, 13, 12, 13, 10, 7,
- 11, 15, 10, 12, 10, 12, 9, 8, 12, 15, 11, 12, 10, 12, 9, 8,
- 14, 16, 12, 12, 11, 12, 9, 7, 11, 14, 10, 11, 10, 12, 8, 7,
- 11, 14, 9, 10, 10, 11, 8, 6, 12, 15, 9, 9, 9, 10, 7, 4,
- },
- {
- 0, 6, 3, 7, 3, 7, 6, 7, 5, 9, 6, 9, 7, 9, 8, 8,
- 16, 16, 16, 16, 16, 16, 16, 11, 3, 8, 5, 8, 6, 8, 7, 7,
- 7, 11, 7, 10, 8, 10, 8, 9, 16, 16, 16, 16, 16, 16, 14, 10,
- 8, 16, 7, 11, 10, 16, 9, 9, 11, 16, 9, 14, 16, 16, 10, 9,
- 16, 16, 16, 16, 16, 16, 16, 10, 3, 8, 5, 8, 5, 8, 7, 7,
- 7, 11, 8, 10, 8, 10, 8, 9, 16, 16, 16, 16, 16, 16, 16, 11,
- 6, 10, 7, 9, 7, 10, 8, 8, 8, 11, 8, 10, 8, 11, 8, 8,
- 16, 16, 16, 16, 16, 16, 11, 10, 10, 16, 9, 13, 11, 16, 10, 9,
- 11, 16, 9, 11, 16, 16, 10, 9, 16, 16, 11, 16, 16, 16, 11, 9,
- 9, 16, 10, 11, 8, 11, 9, 9, 11, 16, 12, 16, 10, 16, 10, 10,
- 16, 16, 16, 16, 16, 16, 16, 10, 10, 16, 11, 16, 10, 16, 10, 10,
- 11, 16, 11, 16, 10, 16, 10, 9, 16, 16, 16, 16, 16, 16, 11, 9,
- 16, 16, 16, 16, 16, 16, 11, 9, 16, 16, 16, 16, 16, 16, 11, 9,
- 16, 16, 11, 16, 16, 16, 9, 7, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 2, 8, 5, 9, 6, 9, 8, 8, 8, 12, 9, 11, 9, 11, 10, 10,
- 16, 16, 14, 16, 14, 16, 14, 12, 5, 10, 6, 9, 8, 10, 8, 9,
- 9, 12, 9, 11, 10, 12, 10, 10, 16, 16, 14, 15, 15, 16, 13, 12,
- 10, 13, 9, 12, 11, 12, 10, 10, 12, 15, 11, 12, 12, 13, 11, 10,
- 16, 16, 15, 14, 15, 16, 13, 12, 6, 10, 8, 10, 7, 10, 8, 9,
- 9, 13, 10, 11, 10, 12, 10, 10, 16, 16, 14, 16, 14, 16, 13, 12,
- 7, 11, 8, 11, 9, 11, 9, 9, 10, 13, 10, 11, 10, 12, 10, 9,
- 16, 16, 14, 14, 14, 15, 12, 11, 11, 14, 11, 12, 11, 13, 10, 10,
- 12, 15, 11, 13, 12, 13, 11, 10, 16, 16, 14, 16, 15, 15, 13, 11,
- 10, 13, 11, 12, 10, 12, 10, 10, 12, 15, 12, 13, 11, 13, 11, 11,
- 16, 16, 15, 16, 14, 15, 13, 11, 11, 14, 11, 13, 11, 12, 11, 10,
- 12, 16, 12, 13, 12, 13, 11, 10, 16, 16, 15, 16, 13, 15, 12, 11,
- 13, 15, 12, 13, 13, 14, 11, 11, 14, 16, 13, 13, 13, 14, 11, 11,
- 16, 16, 15, 14, 15, 15, 12, 10, 3, 8, 6, 9, 7, 9, 8, 8,
- 8, 12, 9, 11, 9, 11, 9, 9, 16, 16, 15, 15, 15, 16, 13, 12,
- 6, 10, 7, 9, 8, 10, 8, 8, 9, 12, 9, 11, 10, 12, 10, 9,
- 16, 16, 14, 14, 14, 15, 13, 11, 10, 13, 9, 11, 11, 12, 10, 10,
- 12, 14, 11, 12, 12, 13, 11, 10, 16, 16, 14, 14, 15, 15, 13, 11,
- 6, 10, 8, 10, 7, 10, 8, 9, 10, 12, 10, 11, 10, 11, 10, 9,
- 16, 16, 14, 15, 14, 15, 13, 11, 8, 11, 8, 10, 9, 11, 9, 9,
- 9, 13, 9, 11, 10, 11, 9, 9, 16, 16, 13, 14, 14, 14, 12, 10,
- 11, 14, 10, 12, 11, 12, 10, 10, 12, 14, 11, 12, 12, 13, 10, 10,
- 16, 16, 13, 14, 15, 15, 12, 10, 10, 13, 11, 12, 10, 12, 10, 10,
- 12, 14, 12, 13, 11, 13, 11, 10, 16, 16, 15, 14, 14, 14, 12, 11,
- 11, 14, 11, 12, 10, 12, 10, 10, 12, 15, 12, 12, 11, 13, 10, 10,
- 16, 16, 14, 15, 13, 14, 12, 10, 13, 15, 12, 13, 12, 13, 11, 10,
- 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 15, 11, 9,
- 6, 10, 8, 10, 8, 11, 9, 10, 11, 13, 11, 12, 11, 13, 11, 10,
- 16, 16, 16, 16, 16, 16, 13, 12, 8, 11, 9, 11, 9, 11, 10, 10,
- 11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 15, 15, 16, 16, 13, 12,
- 11, 14, 10, 12, 12, 13, 11, 10, 13, 16, 12, 13, 13, 14, 11, 11,
- 16, 16, 15, 16, 16, 16, 13, 12, 8, 12, 9, 11, 9, 11, 10, 10,
- 11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 16, 16, 16, 16, 13, 12,
- 9, 12, 10, 11, 10, 12, 10, 10, 11, 14, 11, 12, 11, 13, 10, 10,
- 16, 16, 15, 14, 15, 15, 13, 11, 12, 14, 11, 13, 12, 13, 11, 10,
- 12, 15, 11, 12, 13, 13, 11, 10, 16, 16, 14, 15, 16, 15, 13, 11,
- 11, 15, 12, 13, 11, 13, 11, 10, 13, 16, 13, 14, 12, 14, 11, 11,
- 16, 16, 16, 16, 15, 15, 13, 12, 12, 14, 12, 13, 11, 13, 11, 10,
- 13, 15, 12, 13, 11, 13, 11, 10, 16, 16, 15, 15, 13, 15, 13, 11,
- 13, 16, 13, 13, 13, 13, 12, 11, 13, 16, 13, 13, 13, 13, 11, 10,
- 16, 16, 13, 15, 14, 14, 12, 9, 9, 13, 10, 12, 11, 13, 11, 11,
- 13, 16, 13, 14, 13, 14, 12, 11, 16, 16, 16, 16, 16, 16, 14, 12,
- 10, 14, 11, 13, 11, 13, 11, 10, 13, 16, 13, 13, 13, 14, 12, 11,
- 16, 16, 16, 16, 16, 16, 14, 12, 11, 15, 11, 13, 12, 13, 11, 10,
- 14, 16, 12, 13, 13, 14, 12, 10, 16, 16, 15, 16, 16, 16, 13, 11,
- 10, 14, 11, 12, 11, 13, 11, 10, 13, 16, 12, 13, 12, 14, 12, 11,
- 16, 16, 16, 16, 16, 16, 14, 12, 11, 14, 11, 12, 11, 13, 11, 10,
- 13, 15, 12, 13, 12, 13, 11, 10, 16, 16, 15, 15, 16, 16, 13, 11,
- 12, 15, 12, 13, 12, 13, 11, 10, 13, 16, 12, 13, 13, 13, 11, 10,
- 16, 16, 14, 14, 16, 15, 13, 10, 12, 15, 12, 13, 12, 13, 11, 10,
- 14, 16, 13, 14, 13, 14, 12, 11, 16, 16, 16, 16, 15, 16, 13, 11,
- 12, 16, 12, 13, 12, 13, 11, 10, 13, 16, 13, 13, 12, 14, 11, 10,
- 16, 16, 15, 16, 14, 15, 13, 10, 12, 15, 12, 14, 12, 13, 11, 10,
- 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 14, 11, 8,
- },
- },
- {
- {
- 0, 11, 5, 11, 7, 13, 10, 12, 7, 13, 9, 13, 10, 14, 12, 13,
- 16, 16, 15, 16, 16, 16, 15, 15, 4, 13, 6, 12, 10, 14, 11, 12,
- 8, 14, 9, 13, 11, 15, 12, 13, 16, 16, 15, 16, 15, 16, 15, 14,
- 9, 16, 9, 13, 13, 16, 12, 13, 12, 16, 10, 14, 14, 16, 13, 13,
- 16, 16, 14, 16, 16, 16, 14, 14, 5, 13, 8, 13, 8, 13, 11, 12,
- 9, 14, 10, 13, 10, 14, 12, 13, 16, 16, 15, 16, 15, 16, 14, 15,
- 7, 14, 9, 13, 10, 14, 11, 13, 9, 15, 10, 13, 11, 14, 12, 13,
- 16, 16, 14, 16, 15, 16, 14, 14, 11, 16, 11, 14, 13, 16, 12, 13,
- 12, 16, 11, 14, 14, 16, 12, 13, 16, 16, 14, 15, 16, 16, 14, 13,
- 10, 16, 12, 15, 10, 15, 12, 14, 12, 16, 13, 16, 11, 15, 13, 14,
- 16, 16, 16, 16, 14, 16, 14, 14, 11, 16, 12, 15, 11, 16, 12, 13,
- 12, 16, 13, 15, 12, 16, 12, 13, 16, 16, 16, 16, 14, 16, 14, 14,
- 14, 16, 13, 15, 14, 16, 13, 13, 14, 16, 14, 15, 14, 16, 13, 13,
- 16, 16, 15, 16, 15, 16, 13, 13, 2, 12, 6, 11, 7, 13, 10, 12,
- 7, 13, 9, 12, 10, 14, 11, 12, 16, 16, 15, 16, 15, 16, 14, 15,
- 5, 13, 6, 12, 9, 13, 10, 12, 8, 14, 9, 13, 11, 14, 11, 13,
- 16, 16, 14, 16, 15, 16, 14, 14, 9, 16, 8, 13, 12, 16, 11, 13,
- 11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 15, 16, 16, 13, 13,
- 5, 13, 8, 12, 7, 13, 10, 12, 8, 14, 10, 13, 10, 14, 11, 13,
- 16, 16, 14, 16, 15, 16, 14, 14, 7, 14, 8, 12, 9, 14, 11, 12,
- 8, 14, 9, 13, 10, 14, 11, 12, 15, 16, 14, 15, 14, 16, 13, 14,
- 11, 16, 10, 13, 13, 16, 12, 13, 11, 16, 10, 13, 13, 16, 12, 13,
- 16, 16, 13, 15, 15, 16, 13, 13, 9, 16, 12, 15, 9, 14, 11, 13,
- 11, 16, 13, 15, 11, 14, 12, 13, 16, 16, 15, 16, 14, 16, 14, 14,
- 11, 16, 12, 14, 11, 15, 12, 13, 11, 16, 12, 14, 11, 15, 12, 13,
- 16, 16, 15, 16, 14, 16, 13, 13, 13, 16, 13, 15, 13, 16, 12, 13,
- 14, 16, 13, 15, 13, 16, 12, 12, 16, 16, 14, 15, 14, 16, 12, 12,
- 4, 13, 7, 12, 8, 14, 11, 12, 9, 14, 10, 13, 11, 14, 12, 13,
- 16, 16, 15, 16, 16, 16, 15, 15, 6, 14, 7, 12, 10, 14, 11, 12,
- 9, 15, 10, 13, 11, 15, 12, 13, 16, 16, 15, 16, 16, 16, 14, 14,
- 9, 16, 8, 13, 12, 16, 11, 13, 12, 16, 10, 14, 13, 16, 12, 13,
- 16, 16, 14, 16, 16, 16, 14, 14, 6, 14, 8, 13, 8, 14, 11, 13,
- 9, 15, 10, 13, 11, 14, 12, 13, 16, 16, 15, 16, 16, 16, 14, 14,
- 7, 15, 9, 13, 10, 14, 11, 13, 9, 15, 10, 13, 11, 14, 11, 13,
- 16, 16, 14, 16, 15, 16, 14, 14, 10, 16, 10, 13, 12, 16, 12, 13,
- 11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 14, 15, 16, 13, 13,
- 9, 16, 12, 14, 9, 14, 11, 13, 12, 16, 12, 15, 11, 15, 12, 13,
- 16, 16, 16, 16, 15, 16, 14, 14, 10, 16, 12, 15, 11, 15, 12, 13,
- 11, 16, 12, 14, 11, 15, 12, 13, 16, 16, 14, 16, 13, 16, 13, 13,
- 13, 16, 13, 15, 13, 16, 12, 13, 13, 16, 12, 14, 13, 16, 12, 12,
- 15, 16, 13, 14, 13, 16, 12, 12, 6, 14, 8, 13, 9, 14, 10, 12,
- 10, 15, 10, 12, 11, 14, 11, 12, 16, 16, 14, 14, 14, 16, 13, 13,
- 7, 15, 8, 13, 9, 14, 10, 12, 10, 15, 10, 13, 11, 14, 11, 12,
- 16, 16, 14, 14, 14, 16, 13, 12, 9, 16, 8, 12, 11, 14, 10, 11,
- 11, 16, 10, 13, 11, 14, 10, 11, 16, 16, 13, 14, 14, 16, 12, 11,
- 7, 14, 9, 13, 9, 14, 10, 12, 10, 16, 10, 13, 11, 14, 11, 12,
- 16, 16, 14, 14, 14, 15, 13, 12, 7, 14, 9, 13, 9, 14, 10, 12,
- 9, 14, 10, 12, 10, 14, 11, 12, 15, 16, 13, 14, 14, 15, 12, 12,
- 9, 15, 9, 12, 11, 14, 10, 11, 10, 15, 9, 12, 11, 14, 10, 11,
- 14, 16, 11, 13, 13, 15, 11, 11, 9, 16, 10, 13, 9, 14, 10, 11,
- 11, 16, 11, 13, 10, 14, 10, 11, 16, 16, 14, 15, 13, 15, 12, 12,
- 9, 16, 10, 13, 9, 13, 10, 11, 10, 15, 10, 13, 10, 13, 10, 11,
- 14, 16, 13, 14, 12, 14, 11, 11, 11, 16, 10, 13, 11, 13, 9, 10,
- 11, 14, 10, 12, 10, 13, 9, 9, 13, 15, 10, 11, 11, 12, 9, 8,
- },
- {
- 0, 10, 5, 10, 6, 11, 8, 10, 7, 12, 8, 11, 9, 12, 9, 10,
- 14, 16, 13, 13, 13, 14, 12, 11, 5, 12, 6, 10, 8, 12, 9, 10,
- 8, 13, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
- 9, 15, 8, 12, 11, 14, 10, 10, 11, 16, 9, 12, 12, 14, 10, 10,
- 14, 16, 11, 12, 13, 14, 11, 10, 5, 12, 8, 11, 7, 11, 9, 10,
- 8, 13, 9, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
- 7, 13, 8, 11, 9, 12, 9, 10, 9, 13, 9, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 12, 13, 11, 10, 11, 15, 10, 12, 12, 14, 10, 10,
- 12, 16, 10, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 10, 9,
- 10, 15, 11, 13, 9, 13, 10, 10, 11, 15, 12, 13, 10, 12, 10, 10,
- 14, 16, 13, 14, 12, 13, 11, 10, 11, 16, 11, 13, 10, 13, 10, 10,
- 11, 16, 11, 13, 10, 13, 10, 10, 14, 16, 13, 14, 12, 13, 11, 9,
- 13, 16, 12, 13, 12, 14, 11, 10, 14, 16, 12, 13, 12, 14, 10, 9,
- 16, 16, 12, 13, 13, 13, 10, 8, 3, 11, 6, 10, 7, 11, 9, 10,
- 8, 12, 8, 11, 9, 12, 9, 10, 14, 16, 13, 13, 13, 14, 11, 11,
- 5, 12, 6, 10, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 13, 14, 11, 10, 9, 14, 8, 11, 11, 14, 10, 10,
- 11, 15, 9, 11, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 9,
- 6, 12, 8, 11, 7, 11, 9, 10, 8, 13, 9, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 13, 13, 11, 10, 7, 13, 8, 11, 8, 12, 9, 10,
- 9, 13, 9, 11, 9, 12, 9, 9, 14, 16, 12, 13, 12, 13, 11, 10,
- 10, 15, 9, 12, 11, 14, 10, 10, 11, 15, 9, 11, 11, 13, 10, 9,
- 14, 16, 11, 12, 13, 14, 10, 9, 9, 15, 11, 13, 9, 12, 10, 10,
- 11, 15, 11, 13, 9, 12, 10, 10, 14, 16, 13, 14, 12, 13, 11, 10,
- 10, 15, 11, 13, 10, 13, 10, 10, 11, 15, 11, 13, 10, 12, 10, 10,
- 14, 16, 12, 13, 11, 12, 10, 9, 13, 16, 12, 13, 12, 14, 10, 9,
- 13, 16, 11, 12, 12, 13, 10, 9, 14, 16, 11, 12, 12, 13, 9, 8,
- 7, 13, 8, 12, 9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 11,
- 16, 16, 13, 14, 14, 14, 12, 11, 8, 14, 8, 12, 9, 13, 10, 10,
- 10, 14, 10, 12, 11, 13, 10, 10, 16, 16, 13, 13, 14, 14, 12, 11,
- 10, 15, 9, 12, 11, 14, 10, 10, 12, 16, 10, 12, 12, 14, 10, 10,
- 16, 16, 12, 13, 14, 15, 11, 10, 8, 14, 9, 12, 9, 13, 10, 11,
- 10, 15, 10, 12, 10, 13, 10, 11, 16, 16, 13, 14, 14, 14, 12, 11,
- 8, 14, 9, 12, 9, 13, 10, 10, 10, 14, 10, 12, 10, 13, 10, 10,
- 15, 16, 13, 13, 13, 14, 11, 10, 10, 15, 10, 12, 12, 14, 10, 10,
- 11, 16, 9, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 10, 9,
- 11, 16, 11, 13, 10, 13, 10, 10, 12, 16, 12, 13, 10, 13, 11, 10,
- 15, 16, 14, 14, 12, 13, 11, 10, 11, 16, 11, 13, 10, 13, 10, 10,
- 11, 16, 12, 13, 10, 12, 10, 10, 14, 16, 13, 14, 11, 13, 11, 9,
- 13, 16, 12, 13, 12, 14, 10, 10, 12, 16, 11, 12, 12, 13, 10, 9,
- 14, 16, 11, 12, 11, 12, 9, 8, 10, 16, 10, 13, 11, 14, 11, 11,
- 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 13, 14, 14, 12, 10,
- 10, 15, 10, 13, 10, 13, 10, 11, 12, 16, 11, 13, 11, 13, 11, 10,
- 16, 16, 14, 13, 14, 14, 12, 10, 11, 15, 9, 12, 11, 13, 10, 9,
- 12, 16, 10, 12, 12, 13, 10, 9, 16, 16, 12, 12, 13, 14, 10, 8,
- 10, 16, 10, 13, 10, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 10,
- 16, 16, 14, 13, 14, 14, 12, 10, 9, 15, 9, 12, 10, 13, 10, 10,
- 11, 16, 10, 12, 11, 13, 10, 10, 16, 16, 13, 13, 13, 14, 11, 9,
- 10, 15, 9, 11, 11, 13, 9, 9, 11, 15, 9, 11, 11, 13, 9, 8,
- 14, 16, 10, 11, 13, 13, 10, 8, 11, 16, 11, 13, 10, 13, 10, 9,
- 13, 16, 11, 13, 11, 13, 10, 9, 16, 16, 13, 13, 13, 13, 10, 8,
- 11, 16, 10, 12, 10, 13, 10, 9, 11, 16, 11, 12, 10, 12, 9, 9,
- 15, 16, 12, 13, 11, 12, 10, 8, 11, 16, 10, 12, 11, 12, 9, 8,
- 11, 15, 9, 11, 10, 12, 9, 7, 13, 15, 9, 9, 10, 10, 7, 5,
- },
- {
- 0, 7, 3, 8, 4, 9, 7, 8, 5, 10, 7, 10, 8, 11, 8, 9,
- 16, 16, 16, 16, 16, 16, 11, 10, 2, 10, 4, 9, 7, 10, 7, 8,
- 7, 16, 7, 10, 9, 16, 8, 9, 16, 16, 16, 16, 16, 16, 11, 10,
- 8, 16, 7, 10, 10, 16, 9, 8, 10, 16, 9, 11, 16, 16, 9, 9,
- 16, 16, 16, 16, 16, 16, 11, 9, 3, 10, 6, 9, 6, 11, 8, 8,
- 7, 16, 8, 10, 9, 16, 9, 9, 16, 16, 16, 16, 16, 16, 11, 10,
- 5, 16, 7, 10, 8, 11, 8, 8, 8, 16, 8, 10, 9, 16, 8, 8,
- 16, 16, 11, 16, 16, 16, 10, 9, 9, 16, 9, 11, 11, 16, 9, 9,
- 11, 16, 9, 11, 11, 16, 9, 8, 16, 16, 10, 16, 16, 16, 10, 9,
- 8, 16, 10, 16, 8, 16, 10, 9, 12, 16, 11, 16, 10, 16, 10, 9,
- 16, 16, 16, 16, 16, 16, 12, 10, 10, 16, 11, 16, 10, 16, 10, 9,
- 11, 16, 11, 16, 10, 16, 10, 9, 16, 16, 16, 16, 16, 16, 11, 9,
- 16, 16, 16, 16, 16, 16, 10, 9, 16, 16, 11, 16, 16, 16, 10, 9,
- 16, 16, 10, 11, 11, 16, 9, 7, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 2, 9, 6, 9, 6, 10, 8, 9, 8, 12, 9, 11, 9, 12, 10, 10,
- 16, 16, 14, 14, 15, 15, 13, 12, 5, 11, 7, 10, 8, 11, 9, 9,
- 9, 13, 9, 11, 10, 12, 10, 10, 15, 16, 14, 14, 14, 16, 12, 11,
- 10, 14, 9, 11, 11, 13, 10, 10, 12, 15, 10, 12, 12, 13, 11, 10,
- 16, 16, 14, 15, 14, 15, 12, 11, 5, 11, 8, 10, 7, 11, 9, 9,
- 9, 13, 9, 12, 9, 12, 10, 10, 15, 16, 13, 14, 13, 16, 12, 11,
- 7, 12, 8, 11, 9, 11, 9, 10, 9, 13, 9, 11, 10, 12, 9, 9,
- 16, 16, 13, 14, 13, 14, 11, 11, 10, 14, 10, 12, 11, 13, 10, 10,
- 11, 16, 11, 12, 12, 13, 10, 10, 16, 16, 13, 14, 13, 14, 12, 11,
- 10, 14, 11, 13, 10, 13, 10, 11, 12, 16, 12, 13, 10, 12, 11, 11,
- 16, 16, 14, 15, 13, 14, 12, 11, 11, 15, 11, 13, 11, 13, 10, 10,
- 12, 15, 12, 13, 11, 13, 11, 10, 15, 16, 14, 15, 13, 15, 12, 11,
- 12, 16, 12, 13, 12, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 10,
- 16, 16, 13, 14, 13, 14, 11, 10, 3, 10, 6, 9, 7, 10, 8, 9,
- 9, 12, 9, 11, 10, 12, 9, 10, 15, 16, 14, 14, 14, 14, 12, 11,
- 6, 11, 7, 10, 8, 10, 9, 9, 9, 13, 9, 11, 10, 12, 9, 9,
- 15, 16, 13, 14, 14, 15, 12, 11, 10, 14, 9, 11, 11, 12, 10, 10,
- 12, 14, 10, 12, 11, 13, 10, 10, 15, 16, 13, 14, 14, 16, 12, 11,
- 6, 11, 8, 10, 7, 11, 9, 9, 9, 13, 9, 11, 9, 12, 9, 9,
- 15, 16, 14, 14, 13, 14, 12, 11, 7, 11, 8, 11, 8, 11, 9, 9,
- 9, 12, 9, 11, 9, 12, 9, 9, 15, 16, 13, 13, 13, 14, 11, 10,
- 10, 13, 10, 12, 11, 13, 10, 10, 11, 15, 10, 12, 11, 13, 10, 10,
- 14, 16, 12, 13, 13, 14, 11, 10, 10, 14, 11, 12, 9, 12, 10, 10,
- 11, 15, 11, 13, 10, 13, 10, 10, 15, 16, 14, 14, 13, 14, 12, 11,
- 10, 14, 10, 12, 10, 12, 10, 10, 11, 15, 11, 12, 10, 12, 10, 10,
- 15, 16, 13, 14, 12, 14, 11, 10, 12, 16, 11, 13, 12, 14, 11, 10,
- 12, 16, 12, 13, 11, 13, 10, 10, 15, 16, 12, 14, 12, 14, 11, 9,
- 7, 12, 9, 11, 9, 12, 10, 10, 11, 14, 11, 12, 11, 13, 11, 11,
- 16, 16, 15, 16, 15, 16, 13, 12, 8, 12, 9, 11, 9, 12, 10, 10,
- 11, 14, 11, 12, 11, 13, 10, 10, 16, 16, 14, 15, 15, 16, 13, 12,
- 11, 14, 10, 12, 11, 13, 10, 10, 12, 16, 11, 13, 12, 14, 11, 10,
- 16, 16, 14, 15, 14, 16, 12, 11, 8, 13, 9, 11, 9, 12, 10, 10,
- 11, 14, 11, 12, 11, 13, 10, 10, 16, 16, 15, 15, 14, 15, 13, 12,
- 9, 13, 9, 12, 9, 12, 10, 10, 11, 14, 10, 12, 10, 12, 10, 10,
- 16, 16, 14, 15, 14, 14, 12, 11, 11, 15, 11, 12, 11, 13, 11, 10,
- 12, 16, 11, 12, 12, 13, 11, 10, 16, 16, 13, 15, 14, 15, 11, 11,
- 11, 16, 11, 13, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
- 16, 16, 14, 15, 14, 15, 13, 11, 11, 16, 11, 13, 11, 13, 11, 10,
- 12, 16, 12, 13, 10, 13, 11, 10, 16, 16, 14, 14, 12, 14, 12, 10,
- 12, 16, 12, 14, 12, 14, 11, 11, 13, 16, 12, 14, 12, 14, 11, 10,
- 15, 16, 12, 14, 12, 14, 11, 9, 9, 14, 11, 13, 11, 13, 11, 11,
- 13, 16, 12, 14, 13, 14, 12, 11, 16, 16, 16, 16, 16, 16, 14, 12,
- 9, 14, 10, 12, 10, 13, 11, 11, 12, 16, 12, 13, 13, 14, 11, 11,
- 16, 16, 16, 16, 16, 14, 13, 12, 10, 15, 11, 13, 11, 14, 11, 10,
- 13, 16, 12, 13, 12, 15, 11, 10, 16, 16, 14, 16, 15, 16, 13, 11,
- 10, 14, 10, 13, 11, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 11,
- 16, 16, 16, 16, 15, 16, 13, 12, 10, 14, 10, 12, 10, 13, 10, 11,
- 12, 15, 12, 13, 12, 13, 11, 10, 16, 16, 14, 14, 15, 15, 13, 11,
- 11, 16, 11, 13, 11, 14, 11, 10, 12, 16, 11, 13, 12, 14, 11, 10,
- 16, 16, 13, 14, 14, 15, 12, 10, 11, 16, 12, 13, 11, 14, 11, 10,
- 13, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 15, 15, 12, 11,
- 11, 16, 12, 13, 11, 14, 11, 10, 13, 16, 12, 13, 11, 14, 11, 10,
- 16, 16, 14, 15, 13, 14, 12, 10, 12, 16, 12, 14, 12, 14, 10, 10,
- 12, 16, 11, 13, 11, 14, 10, 10, 14, 16, 11, 13, 12, 13, 10, 8,
- },
- },
- {
- {
- 0, 12, 6, 13, 7, 14, 11, 14, 8, 14, 10, 14, 11, 15, 13, 15,
- 16, 16, 16, 16, 16, 16, 16, 16, 5, 14, 7, 13, 10, 16, 12, 14,
- 9, 16, 10, 14, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 9, 14, 14, 16, 13, 16, 12, 16, 11, 16, 16, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 5, 14, 9, 14, 8, 14, 12, 14,
- 9, 16, 11, 14, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 14, 11, 16, 12, 14, 10, 16, 11, 15, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 14, 16,
- 13, 16, 12, 16, 15, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 13, 16, 11, 16, 14, 16, 13, 16, 14, 16, 13, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 14, 16, 13, 16, 14, 16,
- 13, 16, 14, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 12, 6, 12, 8, 14, 11, 13,
- 8, 14, 10, 13, 11, 14, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 14, 7, 13, 10, 14, 11, 14, 9, 16, 10, 14, 12, 16, 13, 15,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 14, 13, 16, 13, 14,
- 12, 16, 11, 15, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 14, 9, 13, 8, 14, 12, 14, 9, 16, 11, 14, 11, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 15, 9, 14, 10, 16, 12, 14,
- 9, 16, 10, 14, 11, 16, 12, 14, 16, 16, 16, 16, 16, 16, 15, 16,
- 11, 16, 11, 15, 14, 16, 13, 15, 12, 16, 11, 15, 14, 16, 13, 14,
- 16, 16, 14, 16, 16, 16, 14, 16, 10, 16, 13, 16, 10, 16, 13, 16,
- 12, 16, 14, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 15, 16, 14, 16, 14, 16, 16, 16, 14, 16,
- 15, 16, 14, 16, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 14,
- 4, 14, 8, 13, 9, 16, 12, 14, 9, 16, 11, 14, 11, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 15, 8, 13, 10, 16, 12, 14,
- 10, 16, 11, 14, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 9, 14, 13, 16, 13, 15, 12, 16, 11, 16, 14, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 9, 14, 9, 16, 12, 14,
- 10, 16, 11, 15, 12, 16, 13, 15, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 14, 11, 16, 12, 14, 10, 16, 11, 14, 12, 16, 13, 15,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 15, 14, 16, 13, 15,
- 12, 16, 11, 15, 14, 16, 13, 14, 16, 16, 14, 16, 16, 16, 14, 16,
- 10, 16, 13, 16, 10, 16, 13, 15, 13, 16, 14, 16, 12, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 12, 16, 13, 16,
- 12, 16, 13, 16, 11, 16, 13, 16, 16, 16, 16, 16, 15, 16, 15, 16,
- 14, 16, 14, 16, 15, 16, 14, 16, 14, 16, 14, 16, 14, 16, 14, 14,
- 16, 16, 14, 16, 15, 16, 14, 14, 6, 16, 9, 14, 10, 16, 12, 14,
- 10, 16, 11, 13, 12, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
- 7, 16, 9, 14, 10, 16, 12, 13, 11, 16, 11, 14, 12, 16, 12, 14,
- 16, 16, 16, 16, 16, 16, 14, 14, 9, 16, 9, 14, 12, 16, 11, 13,
- 12, 16, 11, 14, 12, 16, 12, 13, 16, 16, 14, 16, 16, 16, 13, 14,
- 7, 16, 10, 14, 10, 16, 12, 14, 11, 16, 11, 14, 11, 16, 12, 14,
- 16, 16, 16, 16, 16, 16, 14, 14, 8, 16, 10, 14, 10, 16, 11, 13,
- 10, 16, 11, 13, 11, 16, 12, 13, 16, 16, 14, 16, 16, 16, 14, 14,
- 10, 16, 9, 13, 12, 16, 11, 13, 11, 16, 10, 13, 12, 16, 11, 12,
- 16, 16, 13, 15, 15, 16, 13, 13, 9, 16, 11, 14, 9, 16, 11, 13,
- 12, 16, 12, 16, 12, 16, 12, 13, 16, 16, 16, 16, 15, 16, 14, 14,
- 10, 16, 11, 14, 10, 16, 11, 13, 11, 16, 12, 14, 10, 15, 11, 13,
- 16, 16, 15, 16, 13, 16, 13, 13, 12, 16, 11, 13, 12, 16, 11, 12,
- 12, 16, 11, 13, 11, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 11,
- },
- {
- 0, 10, 5, 10, 6, 11, 8, 10, 7, 12, 8, 11, 8, 12, 9, 10,
- 14, 16, 13, 13, 13, 14, 12, 11, 4, 12, 6, 10, 8, 12, 9, 10,
- 8, 13, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
- 9, 15, 8, 12, 12, 14, 10, 11, 11, 16, 9, 12, 12, 14, 10, 10,
- 14, 16, 11, 13, 13, 15, 11, 11, 4, 12, 8, 11, 6, 11, 9, 10,
- 8, 13, 9, 11, 8, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
- 7, 13, 8, 11, 9, 12, 9, 10, 8, 13, 9, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 12, 13, 11, 10, 11, 16, 10, 12, 12, 14, 10, 11,
- 11, 16, 10, 12, 12, 14, 10, 10, 15, 16, 11, 13, 13, 14, 11, 10,
- 10, 16, 11, 13, 9, 13, 10, 11, 11, 15, 12, 13, 10, 12, 10, 11,
- 15, 16, 13, 14, 12, 13, 11, 11, 11, 16, 11, 13, 10, 13, 10, 11,
- 12, 16, 11, 13, 10, 13, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
- 13, 16, 12, 13, 13, 14, 11, 11, 14, 16, 12, 13, 12, 14, 11, 10,
- 16, 16, 13, 13, 13, 14, 11, 9, 3, 11, 6, 10, 6, 11, 9, 10,
- 8, 12, 8, 11, 9, 12, 9, 10, 14, 16, 13, 13, 13, 13, 12, 11,
- 5, 12, 6, 10, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 13, 14, 11, 11, 9, 15, 8, 11, 11, 14, 10, 10,
- 11, 15, 9, 11, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 10,
- 5, 12, 8, 11, 7, 11, 9, 10, 8, 13, 9, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 13, 13, 11, 11, 7, 13, 8, 11, 8, 12, 9, 10,
- 8, 13, 8, 11, 9, 12, 9, 9, 13, 16, 11, 13, 12, 13, 11, 10,
- 10, 15, 9, 12, 11, 14, 10, 10, 11, 15, 9, 11, 11, 13, 10, 10,
- 14, 16, 11, 12, 13, 14, 10, 10, 9, 16, 11, 13, 9, 12, 10, 10,
- 11, 16, 11, 13, 9, 12, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
- 11, 16, 11, 13, 10, 13, 10, 10, 11, 15, 11, 13, 9, 12, 10, 10,
- 14, 16, 12, 13, 11, 13, 10, 10, 13, 16, 12, 13, 12, 14, 11, 10,
- 13, 16, 11, 13, 12, 13, 10, 10, 14, 16, 11, 12, 12, 13, 10, 9,
- 7, 14, 8, 12, 9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 11,
- 16, 16, 14, 14, 14, 14, 12, 12, 7, 14, 8, 12, 9, 13, 10, 11,
- 10, 14, 10, 12, 11, 13, 10, 11, 16, 16, 13, 13, 14, 14, 12, 11,
- 10, 15, 9, 12, 12, 14, 10, 10, 12, 16, 9, 12, 12, 14, 10, 10,
- 16, 16, 12, 13, 14, 15, 12, 11, 8, 14, 9, 12, 9, 13, 10, 11,
- 10, 15, 10, 12, 10, 13, 10, 11, 16, 16, 14, 14, 14, 14, 12, 11,
- 8, 14, 9, 12, 9, 13, 10, 11, 10, 14, 10, 12, 10, 13, 10, 10,
- 15, 16, 13, 13, 13, 14, 12, 11, 10, 15, 10, 12, 12, 14, 10, 10,
- 11, 16, 9, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 10,
- 11, 16, 11, 14, 9, 13, 10, 11, 12, 16, 12, 14, 10, 13, 11, 11,
- 16, 16, 14, 15, 13, 14, 12, 11, 11, 16, 12, 14, 10, 13, 11, 11,
- 11, 16, 11, 13, 10, 13, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
- 13, 16, 12, 14, 13, 14, 11, 10, 12, 16, 11, 13, 12, 13, 10, 10,
- 14, 16, 11, 12, 11, 13, 10, 9, 10, 16, 10, 13, 11, 14, 11, 11,
- 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 13, 14, 15, 12, 11,
- 10, 16, 10, 13, 10, 14, 11, 11, 12, 16, 11, 13, 11, 14, 11, 11,
- 16, 16, 14, 13, 14, 14, 12, 11, 11, 15, 9, 12, 11, 14, 10, 10,
- 13, 16, 10, 12, 12, 14, 10, 10, 16, 16, 13, 13, 14, 14, 11, 10,
- 10, 16, 10, 13, 11, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
- 16, 16, 14, 14, 14, 14, 12, 11, 9, 16, 10, 13, 10, 14, 11, 11,
- 11, 15, 11, 12, 11, 13, 11, 11, 16, 16, 13, 13, 14, 14, 12, 10,
- 10, 15, 9, 12, 11, 14, 10, 10, 11, 16, 9, 11, 11, 13, 10, 9,
- 15, 16, 11, 12, 13, 14, 10, 9, 11, 16, 11, 13, 10, 13, 10, 10,
- 13, 16, 12, 13, 11, 13, 10, 10, 16, 16, 14, 14, 13, 13, 11, 10,
- 11, 16, 11, 13, 10, 13, 10, 10, 12, 16, 11, 13, 10, 13, 10, 10,
- 15, 16, 13, 13, 12, 13, 11, 9, 11, 16, 11, 12, 11, 13, 10, 9,
- 11, 15, 10, 11, 11, 12, 9, 8, 13, 15, 10, 10, 10, 11, 8, 7,
- },
- {
- 0, 9, 3, 8, 5, 9, 7, 8, 5, 11, 6, 9, 8, 11, 8, 9,
- 16, 16, 16, 16, 16, 16, 11, 10, 2, 10, 4, 9, 7, 10, 7, 8,
- 7, 16, 7, 10, 9, 11, 8, 9, 16, 16, 11, 16, 16, 16, 11, 10,
- 7, 16, 7, 10, 10, 16, 8, 9, 10, 16, 8, 10, 11, 16, 9, 9,
- 16, 16, 16, 16, 16, 16, 11, 10, 3, 11, 6, 9, 6, 11, 8, 8,
- 7, 16, 8, 10, 8, 11, 8, 9, 16, 16, 15, 16, 16, 16, 11, 10,
- 5, 11, 7, 9, 8, 11, 8, 8, 7, 16, 7, 10, 8, 11, 8, 8,
- 16, 16, 11, 16, 16, 16, 10, 9, 9, 16, 8, 11, 11, 16, 9, 9,
- 10, 16, 8, 11, 11, 16, 9, 9, 16, 16, 10, 16, 16, 16, 10, 9,
- 8, 16, 10, 11, 8, 16, 9, 9, 11, 16, 11, 16, 10, 16, 10, 9,
- 16, 16, 16, 16, 16, 16, 11, 10, 9, 16, 10, 16, 10, 16, 9, 9,
- 10, 16, 10, 16, 9, 16, 9, 9, 16, 16, 16, 16, 15, 16, 10, 9,
- 16, 16, 11, 16, 16, 16, 10, 10, 13, 16, 11, 16, 11, 16, 10, 9,
- 16, 16, 10, 11, 11, 16, 9, 8, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 10, 6, 10, 7, 11, 9, 10, 8, 12, 9, 12, 9, 12, 10, 10,
- 16, 16, 14, 16, 14, 15, 13, 12, 5, 12, 7, 10, 9, 11, 9, 10,
- 9, 13, 9, 12, 10, 13, 10, 10, 16, 16, 14, 15, 14, 14, 13, 12,
- 10, 15, 10, 12, 12, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
- 16, 16, 14, 16, 15, 16, 13, 12, 6, 12, 8, 11, 8, 11, 10, 10,
- 9, 13, 10, 12, 10, 12, 10, 10, 15, 16, 13, 15, 13, 14, 12, 12,
- 7, 13, 9, 11, 9, 12, 10, 10, 9, 14, 10, 12, 10, 13, 10, 10,
- 15, 16, 13, 15, 13, 14, 12, 11, 11, 15, 11, 13, 12, 14, 11, 11,
- 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 11,
- 10, 16, 12, 14, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
- 16, 16, 15, 16, 14, 16, 13, 12, 11, 16, 12, 14, 11, 14, 11, 11,
- 12, 16, 12, 14, 11, 14, 11, 11, 16, 16, 14, 15, 13, 15, 12, 12,
- 13, 16, 13, 15, 13, 15, 12, 12, 13, 16, 12, 15, 12, 15, 11, 11,
- 16, 16, 13, 16, 13, 15, 12, 11, 4, 11, 7, 10, 7, 11, 9, 10,
- 9, 13, 9, 12, 10, 12, 10, 10, 15, 16, 14, 15, 14, 15, 13, 12,
- 6, 12, 7, 11, 9, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 10,
- 15, 16, 14, 15, 14, 15, 12, 12, 10, 15, 9, 12, 12, 13, 11, 11,
- 12, 15, 11, 13, 12, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 12,
- 6, 12, 8, 11, 8, 11, 9, 10, 9, 14, 10, 12, 10, 12, 10, 10,
- 14, 16, 13, 14, 13, 14, 12, 12, 8, 13, 9, 11, 9, 12, 10, 10,
- 9, 13, 9, 12, 9, 12, 9, 10, 14, 16, 13, 14, 13, 14, 12, 11,
- 11, 15, 11, 13, 11, 14, 11, 11, 12, 16, 10, 13, 12, 13, 11, 10,
- 15, 16, 12, 15, 13, 16, 12, 11, 10, 15, 11, 13, 10, 13, 11, 11,
- 12, 16, 12, 14, 11, 13, 11, 11, 16, 16, 14, 15, 13, 16, 13, 12,
- 11, 16, 11, 14, 11, 13, 11, 11, 12, 16, 12, 14, 10, 13, 11, 11,
- 15, 16, 13, 16, 12, 14, 12, 11, 12, 16, 12, 14, 12, 15, 11, 11,
- 13, 16, 12, 14, 12, 14, 11, 11, 15, 16, 13, 15, 13, 15, 11, 10,
- 7, 13, 9, 12, 10, 13, 11, 11, 11, 15, 12, 13, 12, 13, 11, 11,
- 16, 16, 15, 16, 16, 16, 14, 13, 8, 13, 9, 12, 10, 13, 11, 11,
- 12, 15, 11, 13, 12, 13, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
- 11, 16, 11, 13, 12, 14, 11, 11, 13, 16, 12, 14, 13, 15, 12, 11,
- 16, 16, 14, 16, 15, 16, 13, 12, 9, 15, 10, 13, 10, 13, 11, 11,
- 12, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 16, 16, 16, 13, 12,
- 9, 14, 10, 13, 10, 13, 11, 11, 11, 14, 11, 13, 11, 13, 11, 11,
- 16, 16, 14, 16, 14, 16, 12, 12, 11, 16, 11, 14, 12, 14, 12, 11,
- 12, 16, 11, 13, 13, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 11,
- 12, 16, 12, 14, 11, 14, 11, 11, 13, 16, 13, 14, 12, 15, 12, 11,
- 16, 16, 16, 16, 14, 16, 13, 12, 12, 16, 12, 14, 11, 14, 12, 11,
- 12, 16, 12, 15, 11, 14, 11, 11, 16, 16, 14, 16, 13, 15, 12, 12,
- 13, 16, 13, 16, 13, 16, 12, 12, 13, 16, 12, 15, 12, 16, 11, 11,
- 14, 16, 12, 15, 12, 15, 11, 10, 9, 16, 11, 14, 12, 14, 12, 12,
- 13, 16, 13, 15, 14, 16, 12, 12, 16, 16, 16, 16, 16, 16, 14, 13,
- 10, 16, 11, 14, 12, 14, 12, 12, 13, 16, 13, 14, 13, 16, 12, 12,
- 16, 16, 15, 16, 16, 16, 13, 12, 11, 16, 11, 14, 12, 15, 12, 11,
- 13, 16, 12, 14, 13, 16, 12, 11, 16, 16, 14, 16, 16, 16, 13, 12,
- 11, 16, 11, 14, 12, 14, 12, 12, 13, 16, 12, 15, 13, 16, 12, 12,
- 16, 16, 16, 16, 16, 16, 14, 13, 10, 16, 11, 14, 11, 15, 11, 11,
- 13, 16, 12, 14, 12, 14, 12, 11, 16, 16, 14, 16, 16, 16, 13, 12,
- 11, 16, 11, 15, 12, 15, 12, 11, 13, 16, 11, 14, 13, 15, 12, 11,
- 16, 16, 13, 16, 14, 16, 12, 11, 12, 16, 12, 15, 11, 15, 12, 11,
- 14, 16, 13, 15, 12, 16, 12, 11, 16, 16, 15, 16, 14, 16, 13, 12,
- 11, 16, 12, 15, 11, 15, 11, 11, 13, 16, 13, 16, 11, 15, 11, 11,
- 16, 16, 14, 16, 13, 15, 12, 11, 12, 16, 12, 15, 12, 16, 11, 11,
- 12, 16, 11, 15, 12, 14, 11, 11, 13, 16, 12, 13, 11, 13, 10, 9,
- },
- },
- {
- {
- 0, 13, 6, 13, 8, 14, 12, 16, 8, 16, 11, 16, 12, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 16, 7, 14, 11, 16, 13, 16,
- 9, 16, 11, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 10, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 5, 16, 10, 16, 8, 16, 13, 16,
- 10, 16, 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 16, 11, 16, 13, 16, 10, 16, 12, 16, 12, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 16, 16, 16, 16,
- 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 11, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
- 14, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 13, 7, 13, 8, 16, 12, 16,
- 8, 16, 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 4, 16, 7, 14, 10, 16, 12, 16, 9, 16, 10, 16, 12, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 9, 16, 14, 16, 14, 16,
- 13, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 9, 16, 8, 16, 12, 16, 9, 16, 11, 16, 11, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 10, 16, 11, 16, 13, 16,
- 9, 16, 11, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 12, 16, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 13, 16, 11, 16, 14, 16,
- 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 14, 16, 13, 16, 14, 16, 13, 16, 14, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 4, 16, 8, 16, 9, 16, 13, 16, 10, 16, 11, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 8, 16, 11, 16, 13, 16,
- 10, 16, 11, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 9, 16, 13, 16, 13, 16, 13, 16, 12, 16, 16, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 10, 16, 13, 16,
- 10, 16, 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 16, 11, 16, 13, 16, 10, 16, 11, 16, 12, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 14, 16,
- 12, 16, 11, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 13, 16, 10, 16, 13, 16, 13, 16, 16, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 12, 16, 14, 16,
- 12, 16, 15, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 10, 16, 13, 16,
- 11, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 9, 16, 11, 16, 12, 16, 11, 16, 11, 16, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 16, 12, 16, 12, 16,
- 13, 16, 11, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 16, 10, 16, 12, 16, 11, 16, 12, 16, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 10, 16, 11, 16, 12, 16,
- 10, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 10, 14, 12, 16, 12, 16, 11, 16, 10, 14, 13, 16, 12, 14,
- 16, 16, 14, 16, 16, 16, 14, 16, 9, 16, 12, 16, 10, 16, 12, 16,
- 13, 16, 13, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 11, 16, 12, 16, 11, 16, 12, 16, 11, 16, 12, 15,
- 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 12, 16, 13, 16, 12, 13,
- 12, 16, 12, 16, 12, 16, 12, 13, 16, 16, 13, 14, 13, 16, 13, 13,
- },
- {
- 0, 10, 5, 10, 5, 10, 8, 10, 6, 11, 8, 11, 8, 11, 9, 10,
- 14, 16, 13, 14, 13, 14, 12, 12, 4, 12, 5, 10, 8, 12, 9, 10,
- 7, 12, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 12, 12,
- 9, 16, 8, 12, 12, 14, 10, 11, 11, 16, 9, 12, 12, 14, 11, 11,
- 14, 16, 12, 13, 14, 15, 12, 12, 4, 12, 7, 11, 6, 11, 9, 10,
- 8, 12, 9, 11, 8, 11, 9, 10, 14, 16, 12, 14, 13, 14, 12, 12,
- 7, 13, 8, 11, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 12, 13, 11, 11, 11, 16, 10, 12, 12, 14, 11, 11,
- 12, 16, 10, 12, 12, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 11,
- 10, 16, 11, 14, 9, 13, 10, 11, 11, 16, 12, 14, 10, 13, 11, 11,
- 15, 16, 13, 14, 13, 14, 12, 12, 11, 16, 12, 14, 10, 13, 11, 11,
- 12, 16, 12, 14, 11, 13, 11, 11, 15, 16, 13, 14, 13, 14, 12, 11,
- 14, 16, 13, 14, 13, 15, 12, 12, 14, 16, 12, 14, 13, 15, 11, 11,
- 16, 16, 13, 14, 14, 15, 12, 11, 3, 11, 5, 10, 6, 11, 9, 10,
- 7, 12, 8, 11, 9, 11, 9, 10, 14, 16, 13, 13, 13, 14, 12, 12,
- 5, 12, 6, 10, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
- 14, 16, 12, 13, 13, 14, 12, 12, 9, 16, 8, 11, 11, 14, 10, 11,
- 11, 16, 9, 12, 12, 14, 10, 11, 15, 16, 12, 13, 14, 15, 12, 11,
- 5, 12, 7, 11, 6, 11, 9, 10, 8, 13, 9, 11, 8, 11, 9, 10,
- 14, 16, 12, 14, 13, 13, 12, 12, 7, 13, 8, 11, 8, 12, 9, 10,
- 8, 12, 8, 11, 9, 12, 9, 10, 13, 16, 12, 13, 12, 13, 11, 11,
- 10, 16, 9, 12, 12, 14, 10, 11, 11, 15, 9, 12, 12, 14, 10, 11,
- 14, 16, 11, 13, 13, 14, 11, 11, 9, 16, 11, 14, 8, 13, 10, 11,
- 11, 16, 12, 13, 10, 13, 10, 11, 16, 16, 13, 15, 13, 14, 12, 12,
- 11, 16, 11, 14, 10, 13, 10, 11, 11, 16, 11, 13, 10, 13, 10, 11,
- 14, 16, 13, 14, 12, 13, 11, 11, 14, 16, 12, 14, 13, 15, 11, 11,
- 13, 16, 12, 13, 12, 14, 11, 11, 14, 16, 12, 13, 12, 13, 11, 10,
- 6, 14, 8, 12, 9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 12,
- 16, 16, 14, 14, 14, 14, 13, 12, 7, 14, 8, 12, 9, 13, 10, 11,
- 10, 14, 10, 12, 11, 13, 11, 11, 16, 16, 13, 14, 14, 15, 13, 12,
- 10, 16, 8, 12, 12, 14, 10, 11, 12, 16, 10, 12, 13, 15, 11, 11,
- 16, 16, 13, 14, 15, 16, 12, 12, 8, 15, 9, 13, 9, 13, 10, 11,
- 10, 15, 10, 13, 10, 13, 11, 11, 16, 16, 14, 14, 14, 14, 13, 12,
- 8, 15, 9, 12, 10, 13, 10, 11, 10, 14, 10, 12, 10, 13, 10, 11,
- 16, 16, 13, 14, 13, 14, 12, 12, 10, 16, 10, 13, 12, 15, 11, 11,
- 11, 16, 9, 12, 12, 14, 11, 11, 14, 16, 11, 13, 14, 16, 12, 11,
- 10, 16, 12, 14, 9, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
- 16, 16, 15, 16, 14, 14, 13, 12, 11, 16, 12, 14, 11, 14, 11, 11,
- 11, 16, 12, 14, 10, 13, 11, 11, 15, 16, 13, 15, 12, 14, 12, 11,
- 14, 16, 13, 14, 13, 16, 12, 12, 12, 16, 12, 13, 12, 14, 11, 11,
- 14, 16, 11, 12, 12, 13, 10, 10, 9, 16, 10, 14, 11, 15, 12, 12,
- 12, 16, 11, 13, 12, 15, 12, 12, 16, 16, 14, 13, 15, 15, 13, 12,
- 10, 16, 10, 14, 11, 15, 11, 12, 12, 16, 11, 13, 12, 14, 12, 12,
- 16, 16, 14, 13, 15, 14, 13, 12, 11, 16, 9, 12, 12, 14, 11, 11,
- 13, 16, 11, 13, 13, 15, 11, 11, 16, 16, 14, 14, 16, 16, 12, 12,
- 10, 16, 10, 14, 11, 14, 11, 12, 12, 16, 11, 13, 12, 14, 12, 12,
- 16, 16, 14, 14, 15, 15, 13, 12, 10, 16, 10, 13, 11, 14, 11, 12,
- 11, 16, 11, 13, 11, 14, 11, 12, 16, 16, 14, 14, 14, 14, 13, 12,
- 11, 16, 10, 12, 12, 15, 11, 11, 12, 16, 9, 12, 12, 14, 10, 11,
- 16, 16, 12, 13, 14, 15, 11, 11, 11, 16, 12, 14, 10, 14, 11, 11,
- 13, 16, 12, 14, 12, 14, 11, 11, 16, 16, 15, 15, 14, 15, 12, 12,
- 11, 16, 12, 14, 11, 14, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
- 16, 16, 14, 14, 13, 14, 12, 11, 12, 16, 11, 13, 12, 14, 10, 10,
- 12, 15, 11, 12, 12, 13, 10, 10, 14, 15, 11, 11, 12, 12, 10, 9,
- },
- {
- 0, 8, 3, 8, 5, 9, 7, 8, 5, 10, 6, 10, 8, 11, 8, 9,
- 16, 16, 15, 16, 16, 16, 11, 11, 2, 10, 4, 9, 7, 10, 7, 8,
- 7, 16, 7, 10, 9, 11, 8, 9, 16, 16, 15, 16, 16, 16, 11, 11,
- 7, 16, 6, 11, 10, 16, 9, 10, 10, 16, 9, 11, 11, 16, 9, 10,
- 16, 16, 16, 16, 16, 16, 16, 11, 3, 10, 6, 9, 5, 10, 7, 9,
- 7, 16, 8, 10, 8, 11, 8, 9, 16, 16, 16, 16, 16, 16, 11, 11,
- 5, 11, 7, 10, 8, 11, 8, 9, 7, 14, 7, 10, 8, 11, 8, 9,
- 16, 16, 11, 16, 16, 16, 10, 11, 9, 16, 9, 11, 11, 16, 9, 10,
- 10, 16, 8, 11, 11, 16, 9, 10, 16, 16, 11, 16, 16, 16, 11, 10,
- 8, 16, 9, 16, 7, 16, 9, 10, 11, 16, 11, 16, 10, 16, 10, 10,
- 16, 16, 16, 16, 16, 16, 16, 11, 9, 16, 10, 16, 9, 16, 9, 10,
- 10, 16, 10, 16, 9, 16, 9, 10, 16, 16, 16, 16, 11, 16, 11, 11,
- 16, 16, 16, 16, 16, 16, 10, 10, 11, 16, 11, 16, 11, 16, 10, 10,
- 16, 16, 11, 16, 11, 16, 10, 9, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 10, 6, 10, 7, 11, 9, 10, 8, 12, 9, 12, 9, 12, 10, 10,
- 15, 16, 14, 15, 14, 16, 13, 12, 5, 12, 7, 11, 8, 11, 9, 10,
- 9, 13, 9, 12, 10, 12, 10, 10, 16, 16, 14, 15, 13, 16, 13, 12,
- 10, 15, 10, 13, 12, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
- 16, 16, 14, 16, 14, 16, 13, 12, 5, 12, 8, 11, 7, 11, 9, 10,
- 9, 13, 10, 12, 9, 12, 10, 10, 14, 16, 14, 15, 13, 14, 13, 12,
- 7, 13, 9, 12, 9, 12, 10, 10, 9, 13, 9, 12, 9, 12, 10, 10,
- 14, 16, 13, 14, 13, 15, 12, 12, 11, 16, 11, 13, 12, 14, 11, 11,
- 12, 16, 11, 14, 12, 14, 11, 11, 16, 16, 14, 16, 14, 16, 13, 12,
- 10, 16, 11, 14, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
- 15, 16, 15, 16, 14, 16, 13, 12, 11, 16, 12, 14, 11, 14, 11, 12,
- 12, 16, 12, 14, 11, 14, 11, 11, 15, 16, 14, 16, 13, 16, 13, 12,
- 13, 16, 13, 16, 13, 16, 12, 12, 13, 16, 13, 16, 13, 16, 12, 12,
- 16, 16, 14, 15, 14, 16, 13, 12, 4, 11, 7, 10, 7, 11, 9, 10,
- 9, 13, 9, 11, 9, 12, 10, 10, 15, 16, 14, 15, 14, 15, 13, 12,
- 6, 12, 7, 11, 8, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 10,
- 15, 16, 13, 14, 14, 15, 12, 12, 10, 14, 10, 12, 12, 13, 11, 11,
- 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
- 6, 12, 8, 11, 8, 11, 9, 10, 9, 13, 10, 12, 9, 12, 10, 10,
- 16, 16, 14, 15, 13, 14, 12, 12, 8, 13, 9, 11, 9, 12, 9, 10,
- 9, 13, 9, 12, 9, 12, 9, 10, 14, 16, 13, 14, 13, 14, 12, 11,
- 11, 15, 11, 13, 12, 14, 11, 11, 11, 16, 10, 13, 12, 14, 11, 11,
- 15, 16, 13, 15, 14, 16, 12, 11, 10, 16, 12, 13, 10, 13, 11, 11,
- 11, 16, 12, 14, 10, 13, 11, 11, 16, 16, 14, 16, 13, 16, 13, 12,
- 11, 16, 12, 14, 10, 14, 11, 11, 11, 16, 12, 14, 10, 13, 11, 11,
- 16, 16, 14, 16, 12, 15, 12, 11, 13, 16, 13, 15, 13, 15, 12, 12,
- 13, 16, 12, 15, 12, 15, 12, 11, 15, 16, 13, 16, 13, 16, 12, 11,
- 8, 14, 9, 12, 10, 13, 11, 11, 11, 16, 11, 13, 11, 13, 11, 11,
- 16, 16, 16, 16, 16, 16, 14, 13, 9, 14, 10, 12, 10, 13, 11, 11,
- 11, 16, 11, 13, 12, 13, 11, 11, 16, 16, 15, 16, 15, 16, 14, 12,
- 11, 16, 11, 13, 12, 14, 12, 11, 13, 16, 12, 14, 13, 14, 12, 11,
- 16, 16, 15, 16, 16, 16, 14, 13, 9, 14, 10, 13, 10, 13, 11, 11,
- 11, 16, 11, 13, 11, 13, 11, 11, 16, 16, 15, 16, 14, 15, 14, 13,
- 9, 14, 10, 13, 10, 13, 11, 11, 11, 15, 11, 13, 11, 13, 11, 11,
- 16, 16, 14, 16, 14, 16, 13, 12, 12, 16, 12, 14, 13, 14, 12, 11,
- 12, 16, 11, 14, 12, 15, 12, 11, 16, 16, 13, 16, 15, 16, 13, 11,
- 11, 16, 12, 14, 11, 14, 12, 11, 13, 16, 13, 15, 12, 14, 12, 12,
- 16, 16, 16, 16, 14, 16, 14, 13, 12, 16, 13, 15, 11, 14, 12, 12,
- 12, 16, 13, 14, 11, 15, 12, 11, 16, 16, 15, 16, 13, 15, 13, 12,
- 13, 16, 13, 15, 13, 16, 12, 12, 13, 16, 13, 15, 13, 15, 12, 12,
- 15, 16, 13, 16, 13, 15, 11, 10, 10, 16, 12, 14, 12, 15, 12, 12,
- 14, 16, 13, 15, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 15, 13,
- 10, 16, 12, 14, 12, 15, 12, 12, 13, 16, 13, 15, 13, 15, 13, 12,
- 16, 16, 16, 16, 16, 16, 14, 13, 11, 16, 12, 15, 13, 16, 12, 12,
- 14, 16, 13, 16, 13, 16, 12, 12, 16, 16, 15, 16, 15, 16, 14, 12,
- 11, 16, 12, 14, 12, 16, 12, 12, 14, 16, 13, 15, 13, 15, 13, 12,
- 16, 16, 16, 16, 16, 16, 15, 13, 11, 16, 12, 14, 12, 15, 12, 12,
- 13, 16, 12, 14, 12, 15, 12, 12, 16, 16, 16, 16, 16, 16, 14, 12,
- 12, 16, 12, 15, 13, 16, 12, 12, 13, 16, 12, 15, 13, 15, 12, 11,
- 16, 16, 14, 16, 15, 16, 13, 12, 12, 16, 13, 16, 12, 16, 12, 12,
- 15, 16, 14, 16, 13, 16, 12, 12, 16, 16, 16, 16, 16, 16, 14, 13,
- 12, 16, 13, 15, 12, 16, 12, 12, 13, 16, 13, 15, 12, 15, 12, 12,
- 16, 16, 15, 16, 14, 16, 13, 12, 13, 16, 13, 16, 12, 16, 12, 12,
- 13, 16, 12, 16, 12, 15, 12, 12, 14, 16, 12, 14, 12, 14, 11, 10,
- },
- },
- {
- {
- 0, 16, 6, 16, 8, 16, 16, 16, 9, 16, 11, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 16, 7, 16, 11, 16, 16, 16,
- 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 10, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 5, 16, 10, 16, 9, 16, 16, 16,
- 10, 16, 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 11, 16, 12, 16, 16, 16, 10, 16, 12, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 7, 16, 8, 16, 13, 16,
- 9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 4, 16, 7, 16, 11, 16, 13, 16, 9, 16, 11, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 16, 16, 16, 16, 16,
- 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 4, 16, 10, 16, 8, 16, 16, 16, 10, 16, 12, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 10, 16, 11, 16, 16, 16,
- 9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 12, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 16, 16, 11, 16, 16, 16,
- 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 4, 16, 8, 16, 10, 16, 16, 16, 10, 16, 11, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 8, 16, 11, 16, 16, 16,
- 10, 16, 12, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 9, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 10, 16, 16, 16,
- 11, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 11, 16, 11, 16, 16, 16, 10, 16, 12, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16,
- 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 12, 16, 16, 16,
- 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 11, 16, 16, 16,
- 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 9, 16, 11, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 16, 13, 16, 12, 16,
- 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 16, 10, 16, 14, 16, 12, 16, 12, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 11, 16, 13, 16,
- 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 10, 16, 13, 16, 12, 16, 12, 16, 11, 16, 16, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 12, 16, 10, 16, 13, 16,
- 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 13, 16, 11, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 12, 16,
- 13, 16, 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 0, 10, 4, 10, 5, 11, 9, 11, 6, 11, 8, 11, 8, 12, 10, 12,
- 15, 16, 13, 15, 14, 15, 13, 14, 4, 12, 5, 11, 8, 12, 9, 11,
- 7, 13, 8, 12, 9, 13, 10, 12, 15, 16, 13, 15, 14, 16, 13, 14,
- 10, 16, 9, 13, 12, 16, 11, 13, 11, 16, 10, 14, 13, 16, 12, 13,
- 16, 16, 14, 16, 15, 16, 14, 15, 4, 12, 7, 12, 6, 12, 9, 11,
- 8, 13, 9, 12, 9, 12, 10, 12, 15, 16, 13, 15, 14, 15, 13, 14,
- 7, 13, 8, 12, 9, 13, 10, 12, 8, 13, 9, 12, 9, 13, 10, 12,
- 14, 16, 13, 15, 13, 15, 13, 14, 12, 16, 11, 14, 13, 16, 12, 13,
- 12, 16, 11, 14, 13, 16, 12, 13, 16, 16, 14, 16, 15, 16, 14, 15,
- 10, 16, 12, 16, 10, 14, 12, 13, 12, 16, 13, 16, 11, 14, 12, 13,
- 16, 16, 16, 16, 15, 16, 14, 15, 12, 16, 13, 16, 11, 15, 12, 13,
- 13, 16, 13, 16, 12, 15, 12, 14, 16, 16, 16, 16, 14, 16, 13, 14,
- 16, 16, 14, 16, 14, 16, 13, 15, 16, 16, 14, 16, 14, 16, 13, 15,
- 16, 16, 16, 16, 16, 16, 14, 16, 2, 11, 5, 11, 6, 11, 9, 11,
- 7, 12, 8, 11, 9, 12, 10, 12, 15, 16, 14, 14, 14, 14, 13, 14,
- 4, 13, 6, 11, 8, 12, 9, 11, 8, 13, 8, 12, 10, 13, 10, 12,
- 15, 16, 13, 15, 14, 15, 13, 14, 9, 16, 8, 13, 12, 15, 11, 12,
- 11, 16, 10, 14, 13, 16, 12, 13, 16, 16, 14, 16, 16, 16, 14, 15,
- 5, 13, 8, 12, 7, 12, 9, 11, 8, 13, 9, 12, 9, 12, 10, 12,
- 16, 16, 14, 15, 14, 15, 13, 13, 7, 13, 8, 12, 9, 13, 10, 12,
- 8, 13, 8, 12, 9, 13, 10, 12, 14, 16, 13, 14, 13, 15, 12, 13,
- 11, 16, 10, 14, 13, 16, 12, 13, 11, 16, 10, 13, 12, 15, 11, 13,
- 14, 16, 12, 14, 14, 16, 13, 14, 10, 16, 12, 15, 9, 14, 11, 13,
- 12, 16, 12, 16, 11, 14, 12, 13, 16, 16, 15, 16, 16, 16, 14, 15,
- 11, 16, 12, 15, 11, 15, 12, 13, 12, 16, 12, 15, 11, 14, 12, 13,
- 16, 16, 14, 16, 13, 15, 13, 14, 15, 16, 14, 16, 14, 16, 13, 14,
- 14, 16, 13, 16, 14, 16, 13, 14, 16, 16, 14, 16, 14, 16, 13, 14,
- 7, 15, 8, 13, 9, 14, 11, 13, 10, 14, 10, 13, 11, 14, 12, 13,
- 16, 16, 15, 16, 15, 16, 15, 14, 7, 16, 8, 13, 10, 14, 11, 13,
- 11, 15, 10, 13, 12, 14, 12, 13, 16, 16, 16, 16, 16, 16, 15, 15,
- 10, 16, 9, 13, 13, 16, 12, 13, 13, 16, 11, 14, 14, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 15, 16, 8, 16, 10, 14, 9, 14, 11, 13,
- 11, 16, 11, 14, 11, 14, 12, 13, 16, 16, 16, 16, 16, 16, 14, 15,
- 8, 16, 10, 14, 10, 14, 11, 13, 10, 15, 10, 14, 11, 14, 12, 13,
- 16, 16, 14, 16, 15, 16, 14, 14, 11, 16, 10, 14, 13, 16, 12, 13,
- 11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 16, 16, 16, 14, 14,
- 11, 16, 12, 16, 10, 15, 12, 13, 14, 16, 14, 16, 12, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 11, 16, 12, 14,
- 12, 16, 13, 16, 11, 14, 12, 13, 16, 16, 16, 16, 14, 16, 14, 14,
- 15, 16, 14, 16, 16, 16, 13, 14, 13, 16, 13, 15, 14, 16, 13, 14,
- 14, 16, 13, 14, 14, 15, 13, 14, 9, 16, 11, 16, 12, 16, 13, 14,
- 12, 16, 12, 15, 13, 16, 13, 14, 16, 16, 16, 15, 16, 16, 15, 15,
- 10, 16, 10, 16, 12, 16, 12, 14, 12, 16, 12, 14, 13, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 15, 15, 11, 16, 10, 14, 14, 16, 12, 13,
- 14, 16, 12, 16, 14, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 15,
- 10, 16, 12, 16, 11, 16, 12, 14, 13, 16, 12, 15, 13, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 16, 15, 10, 16, 11, 16, 12, 16, 12, 14,
- 12, 16, 12, 15, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
- 11, 16, 10, 14, 14, 16, 12, 13, 13, 16, 11, 14, 14, 16, 12, 13,
- 16, 16, 15, 16, 16, 16, 14, 14, 12, 16, 13, 16, 11, 16, 12, 14,
- 15, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 16,
- 12, 16, 13, 16, 12, 16, 12, 14, 13, 16, 13, 16, 12, 16, 12, 13,
- 16, 16, 16, 16, 16, 16, 14, 15, 13, 16, 13, 16, 14, 16, 12, 13,
- 13, 16, 13, 14, 14, 16, 12, 13, 16, 16, 14, 14, 14, 15, 13, 13,
- },
- {
- 0, 9, 3, 9, 5, 9, 7, 9, 5, 10, 7, 11, 8, 11, 9, 10,
- 16, 16, 16, 16, 16, 16, 16, 16, 2, 11, 4, 10, 7, 11, 8, 10,
- 7, 16, 7, 11, 9, 16, 9, 11, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 7, 16, 11, 16, 10, 11, 11, 16, 10, 16, 16, 16, 11, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 2, 11, 6, 10, 6, 10, 8, 10,
- 7, 16, 8, 16, 8, 11, 9, 11, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 13, 7, 11, 8, 11, 9, 11, 6, 12, 8, 12, 8, 12, 9, 11,
- 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 10, 16, 12, 16, 10, 13,
- 10, 16, 9, 16, 11, 16, 11, 12, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 16, 8, 16, 10, 12, 11, 16, 12, 16, 10, 16, 11, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 11, 16, 10, 16, 11, 16,
- 11, 16, 12, 16, 10, 16, 11, 12, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 10, 5, 10, 6, 10, 9, 10, 7, 12, 9, 12, 9, 12, 10, 10,
- 16, 16, 15, 16, 14, 16, 13, 13, 5, 12, 7, 11, 8, 11, 9, 10,
- 8, 13, 9, 12, 10, 12, 10, 11, 16, 16, 16, 16, 14, 16, 13, 12,
- 10, 16, 10, 13, 12, 14, 12, 12, 12, 16, 11, 14, 13, 15, 12, 12,
- 16, 16, 16, 15, 16, 16, 14, 13, 5, 12, 8, 11, 7, 11, 9, 10,
- 8, 13, 10, 12, 9, 12, 10, 10, 15, 16, 14, 15, 14, 14, 13, 13,
- 7, 13, 9, 12, 9, 12, 10, 10, 9, 13, 10, 13, 10, 13, 10, 10,
- 14, 16, 14, 15, 14, 16, 13, 12, 11, 16, 12, 14, 12, 15, 12, 12,
- 12, 16, 12, 15, 13, 16, 12, 12, 16, 16, 15, 16, 16, 16, 14, 13,
- 10, 16, 12, 14, 10, 14, 12, 12, 12, 16, 13, 14, 11, 14, 12, 12,
- 16, 16, 16, 16, 14, 16, 14, 13, 11, 16, 12, 14, 11, 14, 12, 12,
- 12, 16, 13, 16, 11, 15, 12, 12, 16, 16, 16, 16, 14, 16, 14, 13,
- 13, 16, 14, 16, 14, 16, 13, 13, 13, 16, 13, 16, 13, 16, 13, 12,
- 16, 16, 16, 16, 16, 16, 13, 13, 4, 11, 7, 10, 7, 11, 9, 10,
- 8, 12, 9, 12, 9, 12, 10, 11, 15, 16, 14, 15, 14, 16, 13, 13,
- 6, 12, 7, 11, 8, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 10,
- 16, 16, 15, 16, 15, 16, 13, 12, 10, 16, 10, 13, 12, 14, 12, 11,
- 12, 16, 11, 14, 13, 14, 12, 12, 16, 16, 16, 14, 16, 16, 14, 13,
- 6, 12, 8, 11, 7, 11, 9, 10, 9, 14, 10, 12, 9, 12, 10, 10,
- 15, 16, 14, 16, 14, 16, 14, 13, 7, 13, 9, 12, 9, 12, 10, 10,
- 9, 13, 9, 12, 9, 12, 10, 10, 14, 16, 13, 14, 14, 16, 12, 11,
- 11, 16, 11, 14, 12, 14, 12, 12, 12, 16, 11, 14, 12, 14, 12, 11,
- 16, 16, 13, 16, 14, 16, 13, 12, 10, 16, 12, 14, 10, 14, 11, 11,
- 12, 16, 13, 14, 11, 14, 12, 12, 16, 16, 16, 16, 14, 16, 13, 13,
- 11, 16, 12, 16, 11, 14, 12, 12, 12, 16, 12, 14, 11, 14, 12, 11,
- 16, 16, 15, 16, 13, 15, 13, 12, 13, 16, 14, 16, 13, 16, 13, 12,
- 13, 16, 13, 16, 13, 16, 13, 12, 16, 16, 14, 16, 14, 16, 12, 11,
- 8, 13, 10, 12, 10, 13, 11, 11, 11, 14, 12, 14, 12, 14, 12, 12,
- 16, 16, 16, 16, 16, 16, 14, 13, 9, 14, 10, 13, 10, 13, 11, 11,
- 12, 16, 12, 13, 12, 13, 12, 11, 16, 16, 16, 16, 16, 16, 15, 14,
- 12, 16, 11, 14, 13, 15, 12, 12, 13, 16, 12, 15, 14, 15, 13, 12,
- 16, 16, 16, 16, 16, 16, 15, 13, 9, 14, 11, 13, 10, 13, 11, 11,
- 11, 16, 12, 14, 12, 14, 12, 12, 16, 16, 16, 16, 16, 16, 16, 13,
- 10, 15, 11, 13, 11, 14, 12, 11, 11, 16, 12, 14, 11, 14, 12, 11,
- 16, 16, 16, 16, 16, 16, 14, 12, 12, 16, 12, 14, 13, 15, 13, 12,
- 12, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 16, 16, 16, 14, 12,
- 12, 16, 13, 16, 11, 14, 12, 12, 14, 16, 14, 16, 12, 16, 13, 12,
- 16, 16, 16, 16, 16, 16, 16, 13, 12, 16, 13, 16, 12, 16, 13, 12,
- 12, 16, 13, 16, 12, 16, 12, 12, 16, 16, 16, 16, 14, 16, 14, 12,
- 14, 16, 14, 16, 14, 16, 14, 13, 13, 16, 13, 16, 13, 16, 13, 12,
- 16, 16, 13, 16, 13, 16, 12, 11, 9, 16, 12, 15, 13, 16, 13, 12,
- 13, 16, 14, 16, 14, 16, 14, 13, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 16, 12, 15, 12, 15, 13, 12, 13, 16, 14, 16, 13, 16, 13, 12,
- 16, 16, 16, 16, 16, 16, 16, 13, 12, 16, 12, 16, 13, 16, 13, 12,
- 14, 16, 13, 16, 14, 16, 13, 12, 16, 16, 16, 16, 16, 16, 16, 13,
- 11, 16, 12, 15, 12, 16, 13, 12, 14, 16, 14, 16, 13, 16, 13, 13,
- 16, 16, 16, 16, 16, 16, 15, 13, 11, 16, 12, 16, 12, 16, 13, 12,
- 13, 16, 13, 15, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 15, 13,
- 12, 16, 12, 16, 13, 16, 13, 12, 13, 16, 12, 16, 13, 16, 13, 12,
- 16, 16, 14, 16, 16, 16, 14, 12, 12, 16, 14, 16, 11, 16, 13, 12,
- 14, 16, 14, 16, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 16, 13,
- 12, 16, 13, 16, 12, 16, 13, 12, 13, 16, 13, 16, 12, 16, 13, 12,
- 16, 16, 16, 16, 14, 16, 14, 12, 13, 16, 13, 16, 13, 16, 13, 13,
- 13, 16, 12, 16, 12, 16, 12, 12, 14, 16, 13, 15, 13, 16, 12, 11,
- },
- },
+static const uint8_t rv34_table_intra_firstpat[NUM_INTRA_TABLES][4][FIRSTBLK_VLC_SIZE] = {
+ {
+ {
+ 0, 10, 5, 10, 7, 12, 9, 11, 8, 13, 9, 12, 10, 13, 11, 12,
+ 16, 16, 14, 15, 15, 16, 13, 14, 5, 12, 6, 11, 9, 13, 10, 11,
+ 9, 14, 9, 12, 11, 14, 11, 12, 16, 16, 14, 15, 15, 16, 13, 13,
+ 10, 15, 9, 12, 12, 16, 11, 12, 12, 16, 10, 13, 13, 16, 11, 12,
+ 16, 16, 13, 14, 15, 16, 13, 12, 6, 12, 8, 11, 8, 12, 10, 11,
+ 9, 14, 10, 12, 10, 13, 11, 12, 15, 16, 14, 15, 14, 16, 13, 13,
+ 8, 13, 9, 12, 10, 13, 10, 12, 10, 14, 9, 12, 11, 14, 10, 12,
+ 15, 16, 13, 15, 14, 16, 13, 13, 11, 16, 10, 13, 13, 16, 11, 12,
+ 12, 16, 11, 13, 13, 16, 11, 12, 16, 16, 13, 14, 15, 16, 12, 12,
+ 10, 16, 12, 14, 10, 14, 11, 12, 12, 16, 13, 14, 11, 14, 12, 12,
+ 16, 16, 15, 16, 14, 15, 13, 13, 11, 16, 12, 14, 11, 14, 11, 12,
+ 12, 16, 12, 14, 11, 14, 11, 12, 16, 16, 14, 15, 13, 15, 13, 12,
+ 14, 16, 13, 14, 13, 16, 12, 12, 14, 16, 13, 14, 13, 16, 12, 12,
+ 16, 16, 14, 14, 14, 15, 12, 11, 2, 10, 6, 10, 7, 12, 9, 11,
+ 8, 12, 9, 11, 10, 13, 10, 11, 15, 16, 14, 15, 14, 16, 13, 13,
+ 5, 12, 6, 11, 9, 13, 10, 11, 9, 13, 9, 11, 10, 13, 10, 11,
+ 15, 16, 13, 14, 14, 16, 13, 13, 9, 15, 8, 12, 12, 15, 11, 11,
+ 11, 16, 10, 12, 13, 15, 11, 11, 15, 16, 13, 14, 15, 16, 12, 12,
+ 6, 12, 8, 11, 8, 12, 9, 11, 9, 14, 9, 12, 10, 13, 10, 11,
+ 15, 16, 14, 15, 14, 16, 13, 13, 7, 13, 8, 11, 9, 13, 10, 11,
+ 9, 14, 9, 12, 10, 13, 10, 11, 14, 16, 13, 14, 13, 16, 12, 12,
+ 11, 16, 10, 12, 12, 15, 11, 11, 11, 16, 10, 12, 12, 15, 11, 11,
+ 15, 16, 12, 13, 14, 16, 12, 11, 9, 15, 11, 13, 9, 13, 11, 12,
+ 11, 16, 12, 14, 10, 14, 11, 12, 16, 16, 14, 15, 13, 15, 12, 12,
+ 11, 16, 11, 14, 10, 14, 11, 12, 11, 16, 12, 13, 11, 14, 11, 11,
+ 15, 16, 14, 15, 13, 14, 12, 12, 13, 16, 12, 14, 13, 15, 11, 11,
+ 13, 16, 12, 14, 13, 15, 11, 11, 16, 16, 13, 14, 13, 15, 11, 10,
+ 5, 12, 7, 11, 8, 13, 10, 11, 9, 13, 9, 12, 10, 14, 11, 12,
+ 16, 16, 14, 15, 14, 16, 13, 13, 7, 13, 7, 11, 9, 13, 10, 11,
+ 9, 14, 9, 12, 11, 14, 11, 12, 16, 16, 14, 14, 14, 16, 13, 13,
+ 9, 15, 8, 12, 12, 15, 11, 12, 11, 16, 10, 12, 13, 16, 11, 12,
+ 16, 16, 13, 14, 15, 16, 12, 12, 7, 13, 8, 12, 9, 13, 10, 11,
+ 10, 14, 10, 12, 10, 14, 11, 12, 16, 16, 14, 15, 14, 16, 13, 13,
+ 8, 14, 9, 12, 10, 13, 10, 11, 9, 14, 9, 12, 10, 14, 10, 11,
+ 15, 16, 13, 14, 14, 16, 12, 12, 11, 16, 10, 12, 12, 15, 11, 12,
+ 11, 16, 10, 12, 12, 15, 11, 11, 15, 16, 12, 14, 14, 16, 12, 11,
+ 10, 16, 11, 13, 9, 14, 11, 12, 12, 16, 12, 14, 11, 14, 11, 12,
+ 16, 16, 14, 16, 14, 15, 13, 12, 11, 16, 11, 14, 10, 14, 11, 12,
+ 11, 16, 12, 14, 11, 14, 11, 11, 15, 16, 14, 15, 13, 15, 12, 12,
+ 13, 16, 12, 14, 13, 15, 11, 11, 13, 16, 12, 14, 12, 14, 11, 11,
+ 15, 16, 12, 13, 13, 14, 11, 10, 6, 13, 8, 11, 9, 13, 10, 11,
+ 10, 14, 10, 12, 10, 13, 10, 11, 15, 16, 13, 13, 13, 14, 12, 11,
+ 7, 13, 8, 11, 9, 13, 9, 11, 10, 14, 9, 11, 10, 13, 10, 11,
+ 15, 16, 13, 13, 13, 14, 11, 11, 9, 14, 8, 11, 10, 13, 9, 10,
+ 11, 15, 9, 11, 11, 13, 9, 10, 15, 16, 12, 13, 13, 14, 10, 9,
+ 7, 13, 8, 11, 9, 13, 9, 11, 10, 14, 10, 12, 10, 13, 10, 11,
+ 15, 16, 13, 13, 13, 14, 11, 11, 8, 13, 8, 11, 9, 13, 9, 10,
+ 9, 14, 9, 11, 10, 13, 9, 10, 14, 16, 12, 13, 13, 14, 11, 10,
+ 9, 14, 8, 11, 10, 13, 9, 9, 10, 14, 8, 11, 10, 13, 9, 9,
+ 14, 16, 11, 12, 12, 14, 10, 9, 9, 14, 9, 12, 8, 12, 9, 10,
+ 11, 15, 10, 12, 10, 13, 9, 10, 15, 16, 13, 13, 12, 13, 11, 10,
+ 9, 14, 9, 12, 9, 12, 9, 10, 10, 14, 10, 12, 9, 12, 9, 9,
+ 14, 16, 12, 13, 11, 13, 10, 9, 10, 14, 9, 11, 10, 12, 8, 8,
+ 10, 14, 9, 11, 10, 12, 8, 8, 12, 14, 9, 10, 10, 11, 8, 7,
+ },
+ {
+ 0, 9, 6, 9, 6, 10, 8, 9, 7, 11, 8, 11, 9, 11, 9, 10,
+ 14, 16, 13, 14, 13, 14, 12, 11, 5, 11, 7, 10, 8, 10, 8, 9,
+ 8, 12, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
+ 10, 14, 9, 11, 11, 13, 10, 10, 11, 15, 9, 11, 12, 13, 10, 10,
+ 15, 16, 12, 12, 13, 14, 11, 9, 6, 11, 7, 10, 7, 10, 8, 9,
+ 8, 12, 9, 11, 9, 11, 9, 10, 14, 16, 13, 13, 13, 14, 11, 11,
+ 7, 12, 8, 11, 8, 11, 9, 9, 9, 13, 9, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 12, 14, 11, 10, 11, 14, 10, 12, 11, 13, 10, 10,
+ 12, 15, 10, 12, 12, 13, 10, 10, 15, 16, 12, 12, 13, 14, 10, 9,
+ 10, 14, 11, 13, 9, 12, 10, 10, 11, 15, 12, 13, 10, 12, 10, 10,
+ 14, 16, 13, 14, 12, 13, 11, 10, 11, 14, 11, 13, 10, 12, 10, 10,
+ 12, 15, 11, 13, 10, 12, 10, 10, 15, 16, 13, 13, 12, 13, 11, 9,
+ 13, 16, 12, 13, 12, 13, 10, 9, 14, 16, 12, 13, 12, 13, 10, 9,
+ 16, 16, 12, 12, 13, 13, 10, 7, 4, 10, 6, 9, 7, 10, 8, 9,
+ 8, 12, 9, 11, 9, 11, 9, 9, 14, 16, 13, 13, 13, 14, 11, 11,
+ 6, 11, 7, 10, 8, 11, 8, 9, 9, 12, 9, 11, 9, 12, 9, 9,
+ 14, 16, 12, 13, 13, 14, 11, 10, 10, 14, 9, 11, 11, 13, 9, 9,
+ 11, 14, 9, 11, 11, 13, 10, 9, 14, 16, 11, 12, 13, 14, 10, 9,
+ 6, 11, 8, 10, 7, 10, 8, 9, 9, 12, 9, 11, 9, 11, 9, 9,
+ 14, 16, 13, 13, 12, 13, 11, 10, 8, 12, 8, 10, 8, 11, 9, 9,
+ 9, 12, 9, 11, 9, 11, 9, 9, 14, 16, 12, 13, 12, 13, 11, 10,
+ 11, 14, 10, 11, 11, 13, 9, 9, 11, 14, 10, 11, 11, 13, 9, 9,
+ 14, 16, 11, 12, 13, 14, 10, 8, 10, 14, 11, 12, 9, 12, 10, 10,
+ 11, 14, 11, 13, 10, 12, 10, 10, 14, 16, 13, 14, 12, 13, 11, 9,
+ 11, 14, 11, 12, 10, 12, 10, 10, 11, 14, 11, 12, 10, 12, 10, 9,
+ 14, 16, 13, 13, 11, 12, 10, 9, 13, 16, 12, 13, 12, 13, 10, 9,
+ 13, 16, 11, 12, 11, 13, 10, 8, 15, 16, 12, 12, 12, 12, 9, 7,
+ 8, 12, 8, 11, 9, 12, 9, 10, 10, 14, 10, 12, 11, 13, 10, 10,
+ 16, 16, 14, 14, 14, 14, 12, 11, 8, 13, 8, 11, 9, 12, 10, 10,
+ 11, 14, 10, 12, 11, 13, 10, 10, 16, 16, 13, 14, 14, 14, 12, 11,
+ 11, 14, 9, 12, 11, 13, 10, 10, 12, 15, 10, 12, 12, 14, 10, 10,
+ 15, 16, 12, 12, 14, 14, 11, 9, 9, 13, 9, 11, 9, 12, 10, 10,
+ 11, 14, 10, 12, 10, 12, 10, 10, 15, 16, 14, 14, 13, 14, 12, 11,
+ 9, 13, 9, 11, 10, 12, 10, 10, 10, 14, 10, 12, 10, 12, 10, 10,
+ 15, 16, 13, 13, 13, 14, 11, 10, 11, 15, 10, 12, 11, 13, 10, 10,
+ 11, 15, 10, 12, 12, 13, 10, 9, 15, 16, 11, 12, 13, 14, 10, 9,
+ 11, 15, 11, 13, 10, 12, 10, 10, 12, 16, 12, 13, 11, 13, 10, 10,
+ 16, 16, 14, 14, 12, 13, 11, 9, 11, 15, 11, 13, 10, 13, 10, 10,
+ 12, 15, 12, 13, 10, 12, 10, 10, 14, 16, 13, 13, 12, 13, 10, 9,
+ 13, 16, 12, 13, 12, 13, 10, 9, 13, 16, 11, 12, 11, 13, 10, 9,
+ 14, 16, 11, 12, 12, 12, 9, 7, 10, 15, 10, 12, 11, 13, 10, 10,
+ 12, 16, 12, 13, 12, 13, 11, 10, 16, 16, 14, 14, 14, 15, 12, 10,
+ 10, 14, 10, 12, 10, 13, 10, 10, 12, 15, 11, 12, 11, 13, 10, 10,
+ 16, 16, 14, 13, 14, 14, 11, 9, 11, 14, 10, 11, 11, 12, 9, 9,
+ 12, 15, 10, 11, 11, 13, 9, 8, 16, 16, 12, 12, 13, 13, 10, 7,
+ 10, 15, 10, 12, 10, 13, 10, 10, 12, 15, 11, 12, 11, 13, 10, 10,
+ 16, 16, 14, 13, 14, 14, 11, 9, 10, 14, 10, 12, 10, 12, 10, 10,
+ 12, 15, 11, 12, 11, 13, 10, 10, 16, 16, 13, 13, 13, 14, 11, 9,
+ 11, 14, 10, 11, 10, 12, 9, 8, 11, 14, 9, 11, 11, 12, 9, 8,
+ 14, 16, 10, 11, 12, 13, 9, 7, 11, 15, 11, 12, 10, 12, 10, 9,
+ 13, 16, 11, 12, 11, 12, 10, 9, 16, 16, 13, 13, 12, 13, 10, 7,
+ 11, 15, 10, 12, 10, 12, 9, 8, 12, 15, 11, 12, 10, 12, 9, 8,
+ 14, 16, 12, 12, 11, 12, 9, 7, 11, 14, 10, 11, 10, 12, 8, 7,
+ 11, 14, 9, 10, 10, 11, 8, 6, 12, 15, 9, 9, 9, 10, 7, 4,
+ },
+ {
+ 0, 6, 3, 7, 3, 7, 6, 7, 5, 9, 6, 9, 7, 9, 8, 8,
+ 16, 16, 16, 16, 16, 16, 16, 11, 3, 8, 5, 8, 6, 8, 7, 7,
+ 7, 11, 7, 10, 8, 10, 8, 9, 16, 16, 16, 16, 16, 16, 14, 10,
+ 8, 16, 7, 11, 10, 16, 9, 9, 11, 16, 9, 14, 16, 16, 10, 9,
+ 16, 16, 16, 16, 16, 16, 16, 10, 3, 8, 5, 8, 5, 8, 7, 7,
+ 7, 11, 8, 10, 8, 10, 8, 9, 16, 16, 16, 16, 16, 16, 16, 11,
+ 6, 10, 7, 9, 7, 10, 8, 8, 8, 11, 8, 10, 8, 11, 8, 8,
+ 16, 16, 16, 16, 16, 16, 11, 10, 10, 16, 9, 13, 11, 16, 10, 9,
+ 11, 16, 9, 11, 16, 16, 10, 9, 16, 16, 11, 16, 16, 16, 11, 9,
+ 9, 16, 10, 11, 8, 11, 9, 9, 11, 16, 12, 16, 10, 16, 10, 10,
+ 16, 16, 16, 16, 16, 16, 16, 10, 10, 16, 11, 16, 10, 16, 10, 10,
+ 11, 16, 11, 16, 10, 16, 10, 9, 16, 16, 16, 16, 16, 16, 11, 9,
+ 16, 16, 16, 16, 16, 16, 11, 9, 16, 16, 16, 16, 16, 16, 11, 9,
+ 16, 16, 11, 16, 16, 16, 9, 7, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 2, 8, 5, 9, 6, 9, 8, 8, 8, 12, 9, 11, 9, 11, 10, 10,
+ 16, 16, 14, 16, 14, 16, 14, 12, 5, 10, 6, 9, 8, 10, 8, 9,
+ 9, 12, 9, 11, 10, 12, 10, 10, 16, 16, 14, 15, 15, 16, 13, 12,
+ 10, 13, 9, 12, 11, 12, 10, 10, 12, 15, 11, 12, 12, 13, 11, 10,
+ 16, 16, 15, 14, 15, 16, 13, 12, 6, 10, 8, 10, 7, 10, 8, 9,
+ 9, 13, 10, 11, 10, 12, 10, 10, 16, 16, 14, 16, 14, 16, 13, 12,
+ 7, 11, 8, 11, 9, 11, 9, 9, 10, 13, 10, 11, 10, 12, 10, 9,
+ 16, 16, 14, 14, 14, 15, 12, 11, 11, 14, 11, 12, 11, 13, 10, 10,
+ 12, 15, 11, 13, 12, 13, 11, 10, 16, 16, 14, 16, 15, 15, 13, 11,
+ 10, 13, 11, 12, 10, 12, 10, 10, 12, 15, 12, 13, 11, 13, 11, 11,
+ 16, 16, 15, 16, 14, 15, 13, 11, 11, 14, 11, 13, 11, 12, 11, 10,
+ 12, 16, 12, 13, 12, 13, 11, 10, 16, 16, 15, 16, 13, 15, 12, 11,
+ 13, 15, 12, 13, 13, 14, 11, 11, 14, 16, 13, 13, 13, 14, 11, 11,
+ 16, 16, 15, 14, 15, 15, 12, 10, 3, 8, 6, 9, 7, 9, 8, 8,
+ 8, 12, 9, 11, 9, 11, 9, 9, 16, 16, 15, 15, 15, 16, 13, 12,
+ 6, 10, 7, 9, 8, 10, 8, 8, 9, 12, 9, 11, 10, 12, 10, 9,
+ 16, 16, 14, 14, 14, 15, 13, 11, 10, 13, 9, 11, 11, 12, 10, 10,
+ 12, 14, 11, 12, 12, 13, 11, 10, 16, 16, 14, 14, 15, 15, 13, 11,
+ 6, 10, 8, 10, 7, 10, 8, 9, 10, 12, 10, 11, 10, 11, 10, 9,
+ 16, 16, 14, 15, 14, 15, 13, 11, 8, 11, 8, 10, 9, 11, 9, 9,
+ 9, 13, 9, 11, 10, 11, 9, 9, 16, 16, 13, 14, 14, 14, 12, 10,
+ 11, 14, 10, 12, 11, 12, 10, 10, 12, 14, 11, 12, 12, 13, 10, 10,
+ 16, 16, 13, 14, 15, 15, 12, 10, 10, 13, 11, 12, 10, 12, 10, 10,
+ 12, 14, 12, 13, 11, 13, 11, 10, 16, 16, 15, 14, 14, 14, 12, 11,
+ 11, 14, 11, 12, 10, 12, 10, 10, 12, 15, 12, 12, 11, 13, 10, 10,
+ 16, 16, 14, 15, 13, 14, 12, 10, 13, 15, 12, 13, 12, 13, 11, 10,
+ 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 15, 11, 9,
+ 6, 10, 8, 10, 8, 11, 9, 10, 11, 13, 11, 12, 11, 13, 11, 10,
+ 16, 16, 16, 16, 16, 16, 13, 12, 8, 11, 9, 11, 9, 11, 10, 10,
+ 11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 15, 15, 16, 16, 13, 12,
+ 11, 14, 10, 12, 12, 13, 11, 10, 13, 16, 12, 13, 13, 14, 11, 11,
+ 16, 16, 15, 16, 16, 16, 13, 12, 8, 12, 9, 11, 9, 11, 10, 10,
+ 11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 16, 16, 16, 16, 13, 12,
+ 9, 12, 10, 11, 10, 12, 10, 10, 11, 14, 11, 12, 11, 13, 10, 10,
+ 16, 16, 15, 14, 15, 15, 13, 11, 12, 14, 11, 13, 12, 13, 11, 10,
+ 12, 15, 11, 12, 13, 13, 11, 10, 16, 16, 14, 15, 16, 15, 13, 11,
+ 11, 15, 12, 13, 11, 13, 11, 10, 13, 16, 13, 14, 12, 14, 11, 11,
+ 16, 16, 16, 16, 15, 15, 13, 12, 12, 14, 12, 13, 11, 13, 11, 10,
+ 13, 15, 12, 13, 11, 13, 11, 10, 16, 16, 15, 15, 13, 15, 13, 11,
+ 13, 16, 13, 13, 13, 13, 12, 11, 13, 16, 13, 13, 13, 13, 11, 10,
+ 16, 16, 13, 15, 14, 14, 12, 9, 9, 13, 10, 12, 11, 13, 11, 11,
+ 13, 16, 13, 14, 13, 14, 12, 11, 16, 16, 16, 16, 16, 16, 14, 12,
+ 10, 14, 11, 13, 11, 13, 11, 10, 13, 16, 13, 13, 13, 14, 12, 11,
+ 16, 16, 16, 16, 16, 16, 14, 12, 11, 15, 11, 13, 12, 13, 11, 10,
+ 14, 16, 12, 13, 13, 14, 12, 10, 16, 16, 15, 16, 16, 16, 13, 11,
+ 10, 14, 11, 12, 11, 13, 11, 10, 13, 16, 12, 13, 12, 14, 12, 11,
+ 16, 16, 16, 16, 16, 16, 14, 12, 11, 14, 11, 12, 11, 13, 11, 10,
+ 13, 15, 12, 13, 12, 13, 11, 10, 16, 16, 15, 15, 16, 16, 13, 11,
+ 12, 15, 12, 13, 12, 13, 11, 10, 13, 16, 12, 13, 13, 13, 11, 10,
+ 16, 16, 14, 14, 16, 15, 13, 10, 12, 15, 12, 13, 12, 13, 11, 10,
+ 14, 16, 13, 14, 13, 14, 12, 11, 16, 16, 16, 16, 15, 16, 13, 11,
+ 12, 16, 12, 13, 12, 13, 11, 10, 13, 16, 13, 13, 12, 14, 11, 10,
+ 16, 16, 15, 16, 14, 15, 13, 10, 12, 15, 12, 14, 12, 13, 11, 10,
+ 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 14, 11, 8,
+ },
+ },
+ {
+ {
+ 0, 11, 5, 11, 7, 13, 10, 12, 7, 13, 9, 13, 10, 14, 12, 13,
+ 16, 16, 15, 16, 16, 16, 15, 15, 4, 13, 6, 12, 10, 14, 11, 12,
+ 8, 14, 9, 13, 11, 15, 12, 13, 16, 16, 15, 16, 15, 16, 15, 14,
+ 9, 16, 9, 13, 13, 16, 12, 13, 12, 16, 10, 14, 14, 16, 13, 13,
+ 16, 16, 14, 16, 16, 16, 14, 14, 5, 13, 8, 13, 8, 13, 11, 12,
+ 9, 14, 10, 13, 10, 14, 12, 13, 16, 16, 15, 16, 15, 16, 14, 15,
+ 7, 14, 9, 13, 10, 14, 11, 13, 9, 15, 10, 13, 11, 14, 12, 13,
+ 16, 16, 14, 16, 15, 16, 14, 14, 11, 16, 11, 14, 13, 16, 12, 13,
+ 12, 16, 11, 14, 14, 16, 12, 13, 16, 16, 14, 15, 16, 16, 14, 13,
+ 10, 16, 12, 15, 10, 15, 12, 14, 12, 16, 13, 16, 11, 15, 13, 14,
+ 16, 16, 16, 16, 14, 16, 14, 14, 11, 16, 12, 15, 11, 16, 12, 13,
+ 12, 16, 13, 15, 12, 16, 12, 13, 16, 16, 16, 16, 14, 16, 14, 14,
+ 14, 16, 13, 15, 14, 16, 13, 13, 14, 16, 14, 15, 14, 16, 13, 13,
+ 16, 16, 15, 16, 15, 16, 13, 13, 2, 12, 6, 11, 7, 13, 10, 12,
+ 7, 13, 9, 12, 10, 14, 11, 12, 16, 16, 15, 16, 15, 16, 14, 15,
+ 5, 13, 6, 12, 9, 13, 10, 12, 8, 14, 9, 13, 11, 14, 11, 13,
+ 16, 16, 14, 16, 15, 16, 14, 14, 9, 16, 8, 13, 12, 16, 11, 13,
+ 11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 15, 16, 16, 13, 13,
+ 5, 13, 8, 12, 7, 13, 10, 12, 8, 14, 10, 13, 10, 14, 11, 13,
+ 16, 16, 14, 16, 15, 16, 14, 14, 7, 14, 8, 12, 9, 14, 11, 12,
+ 8, 14, 9, 13, 10, 14, 11, 12, 15, 16, 14, 15, 14, 16, 13, 14,
+ 11, 16, 10, 13, 13, 16, 12, 13, 11, 16, 10, 13, 13, 16, 12, 13,
+ 16, 16, 13, 15, 15, 16, 13, 13, 9, 16, 12, 15, 9, 14, 11, 13,
+ 11, 16, 13, 15, 11, 14, 12, 13, 16, 16, 15, 16, 14, 16, 14, 14,
+ 11, 16, 12, 14, 11, 15, 12, 13, 11, 16, 12, 14, 11, 15, 12, 13,
+ 16, 16, 15, 16, 14, 16, 13, 13, 13, 16, 13, 15, 13, 16, 12, 13,
+ 14, 16, 13, 15, 13, 16, 12, 12, 16, 16, 14, 15, 14, 16, 12, 12,
+ 4, 13, 7, 12, 8, 14, 11, 12, 9, 14, 10, 13, 11, 14, 12, 13,
+ 16, 16, 15, 16, 16, 16, 15, 15, 6, 14, 7, 12, 10, 14, 11, 12,
+ 9, 15, 10, 13, 11, 15, 12, 13, 16, 16, 15, 16, 16, 16, 14, 14,
+ 9, 16, 8, 13, 12, 16, 11, 13, 12, 16, 10, 14, 13, 16, 12, 13,
+ 16, 16, 14, 16, 16, 16, 14, 14, 6, 14, 8, 13, 8, 14, 11, 13,
+ 9, 15, 10, 13, 11, 14, 12, 13, 16, 16, 15, 16, 16, 16, 14, 14,
+ 7, 15, 9, 13, 10, 14, 11, 13, 9, 15, 10, 13, 11, 14, 11, 13,
+ 16, 16, 14, 16, 15, 16, 14, 14, 10, 16, 10, 13, 12, 16, 12, 13,
+ 11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 14, 15, 16, 13, 13,
+ 9, 16, 12, 14, 9, 14, 11, 13, 12, 16, 12, 15, 11, 15, 12, 13,
+ 16, 16, 16, 16, 15, 16, 14, 14, 10, 16, 12, 15, 11, 15, 12, 13,
+ 11, 16, 12, 14, 11, 15, 12, 13, 16, 16, 14, 16, 13, 16, 13, 13,
+ 13, 16, 13, 15, 13, 16, 12, 13, 13, 16, 12, 14, 13, 16, 12, 12,
+ 15, 16, 13, 14, 13, 16, 12, 12, 6, 14, 8, 13, 9, 14, 10, 12,
+ 10, 15, 10, 12, 11, 14, 11, 12, 16, 16, 14, 14, 14, 16, 13, 13,
+ 7, 15, 8, 13, 9, 14, 10, 12, 10, 15, 10, 13, 11, 14, 11, 12,
+ 16, 16, 14, 14, 14, 16, 13, 12, 9, 16, 8, 12, 11, 14, 10, 11,
+ 11, 16, 10, 13, 11, 14, 10, 11, 16, 16, 13, 14, 14, 16, 12, 11,
+ 7, 14, 9, 13, 9, 14, 10, 12, 10, 16, 10, 13, 11, 14, 11, 12,
+ 16, 16, 14, 14, 14, 15, 13, 12, 7, 14, 9, 13, 9, 14, 10, 12,
+ 9, 14, 10, 12, 10, 14, 11, 12, 15, 16, 13, 14, 14, 15, 12, 12,
+ 9, 15, 9, 12, 11, 14, 10, 11, 10, 15, 9, 12, 11, 14, 10, 11,
+ 14, 16, 11, 13, 13, 15, 11, 11, 9, 16, 10, 13, 9, 14, 10, 11,
+ 11, 16, 11, 13, 10, 14, 10, 11, 16, 16, 14, 15, 13, 15, 12, 12,
+ 9, 16, 10, 13, 9, 13, 10, 11, 10, 15, 10, 13, 10, 13, 10, 11,
+ 14, 16, 13, 14, 12, 14, 11, 11, 11, 16, 10, 13, 11, 13, 9, 10,
+ 11, 14, 10, 12, 10, 13, 9, 9, 13, 15, 10, 11, 11, 12, 9, 8,
+ },
+ {
+ 0, 10, 5, 10, 6, 11, 8, 10, 7, 12, 8, 11, 9, 12, 9, 10,
+ 14, 16, 13, 13, 13, 14, 12, 11, 5, 12, 6, 10, 8, 12, 9, 10,
+ 8, 13, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
+ 9, 15, 8, 12, 11, 14, 10, 10, 11, 16, 9, 12, 12, 14, 10, 10,
+ 14, 16, 11, 12, 13, 14, 11, 10, 5, 12, 8, 11, 7, 11, 9, 10,
+ 8, 13, 9, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
+ 7, 13, 8, 11, 9, 12, 9, 10, 9, 13, 9, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 12, 13, 11, 10, 11, 15, 10, 12, 12, 14, 10, 10,
+ 12, 16, 10, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 10, 9,
+ 10, 15, 11, 13, 9, 13, 10, 10, 11, 15, 12, 13, 10, 12, 10, 10,
+ 14, 16, 13, 14, 12, 13, 11, 10, 11, 16, 11, 13, 10, 13, 10, 10,
+ 11, 16, 11, 13, 10, 13, 10, 10, 14, 16, 13, 14, 12, 13, 11, 9,
+ 13, 16, 12, 13, 12, 14, 11, 10, 14, 16, 12, 13, 12, 14, 10, 9,
+ 16, 16, 12, 13, 13, 13, 10, 8, 3, 11, 6, 10, 7, 11, 9, 10,
+ 8, 12, 8, 11, 9, 12, 9, 10, 14, 16, 13, 13, 13, 14, 11, 11,
+ 5, 12, 6, 10, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 13, 14, 11, 10, 9, 14, 8, 11, 11, 14, 10, 10,
+ 11, 15, 9, 11, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 9,
+ 6, 12, 8, 11, 7, 11, 9, 10, 8, 13, 9, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 13, 13, 11, 10, 7, 13, 8, 11, 8, 12, 9, 10,
+ 9, 13, 9, 11, 9, 12, 9, 9, 14, 16, 12, 13, 12, 13, 11, 10,
+ 10, 15, 9, 12, 11, 14, 10, 10, 11, 15, 9, 11, 11, 13, 10, 9,
+ 14, 16, 11, 12, 13, 14, 10, 9, 9, 15, 11, 13, 9, 12, 10, 10,
+ 11, 15, 11, 13, 9, 12, 10, 10, 14, 16, 13, 14, 12, 13, 11, 10,
+ 10, 15, 11, 13, 10, 13, 10, 10, 11, 15, 11, 13, 10, 12, 10, 10,
+ 14, 16, 12, 13, 11, 12, 10, 9, 13, 16, 12, 13, 12, 14, 10, 9,
+ 13, 16, 11, 12, 12, 13, 10, 9, 14, 16, 11, 12, 12, 13, 9, 8,
+ 7, 13, 8, 12, 9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 11,
+ 16, 16, 13, 14, 14, 14, 12, 11, 8, 14, 8, 12, 9, 13, 10, 10,
+ 10, 14, 10, 12, 11, 13, 10, 10, 16, 16, 13, 13, 14, 14, 12, 11,
+ 10, 15, 9, 12, 11, 14, 10, 10, 12, 16, 10, 12, 12, 14, 10, 10,
+ 16, 16, 12, 13, 14, 15, 11, 10, 8, 14, 9, 12, 9, 13, 10, 11,
+ 10, 15, 10, 12, 10, 13, 10, 11, 16, 16, 13, 14, 14, 14, 12, 11,
+ 8, 14, 9, 12, 9, 13, 10, 10, 10, 14, 10, 12, 10, 13, 10, 10,
+ 15, 16, 13, 13, 13, 14, 11, 10, 10, 15, 10, 12, 12, 14, 10, 10,
+ 11, 16, 9, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 10, 9,
+ 11, 16, 11, 13, 10, 13, 10, 10, 12, 16, 12, 13, 10, 13, 11, 10,
+ 15, 16, 14, 14, 12, 13, 11, 10, 11, 16, 11, 13, 10, 13, 10, 10,
+ 11, 16, 12, 13, 10, 12, 10, 10, 14, 16, 13, 14, 11, 13, 11, 9,
+ 13, 16, 12, 13, 12, 14, 10, 10, 12, 16, 11, 12, 12, 13, 10, 9,
+ 14, 16, 11, 12, 11, 12, 9, 8, 10, 16, 10, 13, 11, 14, 11, 11,
+ 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 13, 14, 14, 12, 10,
+ 10, 15, 10, 13, 10, 13, 10, 11, 12, 16, 11, 13, 11, 13, 11, 10,
+ 16, 16, 14, 13, 14, 14, 12, 10, 11, 15, 9, 12, 11, 13, 10, 9,
+ 12, 16, 10, 12, 12, 13, 10, 9, 16, 16, 12, 12, 13, 14, 10, 8,
+ 10, 16, 10, 13, 10, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 10,
+ 16, 16, 14, 13, 14, 14, 12, 10, 9, 15, 9, 12, 10, 13, 10, 10,
+ 11, 16, 10, 12, 11, 13, 10, 10, 16, 16, 13, 13, 13, 14, 11, 9,
+ 10, 15, 9, 11, 11, 13, 9, 9, 11, 15, 9, 11, 11, 13, 9, 8,
+ 14, 16, 10, 11, 13, 13, 10, 8, 11, 16, 11, 13, 10, 13, 10, 9,
+ 13, 16, 11, 13, 11, 13, 10, 9, 16, 16, 13, 13, 13, 13, 10, 8,
+ 11, 16, 10, 12, 10, 13, 10, 9, 11, 16, 11, 12, 10, 12, 9, 9,
+ 15, 16, 12, 13, 11, 12, 10, 8, 11, 16, 10, 12, 11, 12, 9, 8,
+ 11, 15, 9, 11, 10, 12, 9, 7, 13, 15, 9, 9, 10, 10, 7, 5,
+ },
+ {
+ 0, 7, 3, 8, 4, 9, 7, 8, 5, 10, 7, 10, 8, 11, 8, 9,
+ 16, 16, 16, 16, 16, 16, 11, 10, 2, 10, 4, 9, 7, 10, 7, 8,
+ 7, 16, 7, 10, 9, 16, 8, 9, 16, 16, 16, 16, 16, 16, 11, 10,
+ 8, 16, 7, 10, 10, 16, 9, 8, 10, 16, 9, 11, 16, 16, 9, 9,
+ 16, 16, 16, 16, 16, 16, 11, 9, 3, 10, 6, 9, 6, 11, 8, 8,
+ 7, 16, 8, 10, 9, 16, 9, 9, 16, 16, 16, 16, 16, 16, 11, 10,
+ 5, 16, 7, 10, 8, 11, 8, 8, 8, 16, 8, 10, 9, 16, 8, 8,
+ 16, 16, 11, 16, 16, 16, 10, 9, 9, 16, 9, 11, 11, 16, 9, 9,
+ 11, 16, 9, 11, 11, 16, 9, 8, 16, 16, 10, 16, 16, 16, 10, 9,
+ 8, 16, 10, 16, 8, 16, 10, 9, 12, 16, 11, 16, 10, 16, 10, 9,
+ 16, 16, 16, 16, 16, 16, 12, 10, 10, 16, 11, 16, 10, 16, 10, 9,
+ 11, 16, 11, 16, 10, 16, 10, 9, 16, 16, 16, 16, 16, 16, 11, 9,
+ 16, 16, 16, 16, 16, 16, 10, 9, 16, 16, 11, 16, 16, 16, 10, 9,
+ 16, 16, 10, 11, 11, 16, 9, 7, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 2, 9, 6, 9, 6, 10, 8, 9, 8, 12, 9, 11, 9, 12, 10, 10,
+ 16, 16, 14, 14, 15, 15, 13, 12, 5, 11, 7, 10, 8, 11, 9, 9,
+ 9, 13, 9, 11, 10, 12, 10, 10, 15, 16, 14, 14, 14, 16, 12, 11,
+ 10, 14, 9, 11, 11, 13, 10, 10, 12, 15, 10, 12, 12, 13, 11, 10,
+ 16, 16, 14, 15, 14, 15, 12, 11, 5, 11, 8, 10, 7, 11, 9, 9,
+ 9, 13, 9, 12, 9, 12, 10, 10, 15, 16, 13, 14, 13, 16, 12, 11,
+ 7, 12, 8, 11, 9, 11, 9, 10, 9, 13, 9, 11, 10, 12, 9, 9,
+ 16, 16, 13, 14, 13, 14, 11, 11, 10, 14, 10, 12, 11, 13, 10, 10,
+ 11, 16, 11, 12, 12, 13, 10, 10, 16, 16, 13, 14, 13, 14, 12, 11,
+ 10, 14, 11, 13, 10, 13, 10, 11, 12, 16, 12, 13, 10, 12, 11, 11,
+ 16, 16, 14, 15, 13, 14, 12, 11, 11, 15, 11, 13, 11, 13, 10, 10,
+ 12, 15, 12, 13, 11, 13, 11, 10, 15, 16, 14, 15, 13, 15, 12, 11,
+ 12, 16, 12, 13, 12, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 10,
+ 16, 16, 13, 14, 13, 14, 11, 10, 3, 10, 6, 9, 7, 10, 8, 9,
+ 9, 12, 9, 11, 10, 12, 9, 10, 15, 16, 14, 14, 14, 14, 12, 11,
+ 6, 11, 7, 10, 8, 10, 9, 9, 9, 13, 9, 11, 10, 12, 9, 9,
+ 15, 16, 13, 14, 14, 15, 12, 11, 10, 14, 9, 11, 11, 12, 10, 10,
+ 12, 14, 10, 12, 11, 13, 10, 10, 15, 16, 13, 14, 14, 16, 12, 11,
+ 6, 11, 8, 10, 7, 11, 9, 9, 9, 13, 9, 11, 9, 12, 9, 9,
+ 15, 16, 14, 14, 13, 14, 12, 11, 7, 11, 8, 11, 8, 11, 9, 9,
+ 9, 12, 9, 11, 9, 12, 9, 9, 15, 16, 13, 13, 13, 14, 11, 10,
+ 10, 13, 10, 12, 11, 13, 10, 10, 11, 15, 10, 12, 11, 13, 10, 10,
+ 14, 16, 12, 13, 13, 14, 11, 10, 10, 14, 11, 12, 9, 12, 10, 10,
+ 11, 15, 11, 13, 10, 13, 10, 10, 15, 16, 14, 14, 13, 14, 12, 11,
+ 10, 14, 10, 12, 10, 12, 10, 10, 11, 15, 11, 12, 10, 12, 10, 10,
+ 15, 16, 13, 14, 12, 14, 11, 10, 12, 16, 11, 13, 12, 14, 11, 10,
+ 12, 16, 12, 13, 11, 13, 10, 10, 15, 16, 12, 14, 12, 14, 11, 9,
+ 7, 12, 9, 11, 9, 12, 10, 10, 11, 14, 11, 12, 11, 13, 11, 11,
+ 16, 16, 15, 16, 15, 16, 13, 12, 8, 12, 9, 11, 9, 12, 10, 10,
+ 11, 14, 11, 12, 11, 13, 10, 10, 16, 16, 14, 15, 15, 16, 13, 12,
+ 11, 14, 10, 12, 11, 13, 10, 10, 12, 16, 11, 13, 12, 14, 11, 10,
+ 16, 16, 14, 15, 14, 16, 12, 11, 8, 13, 9, 11, 9, 12, 10, 10,
+ 11, 14, 11, 12, 11, 13, 10, 10, 16, 16, 15, 15, 14, 15, 13, 12,
+ 9, 13, 9, 12, 9, 12, 10, 10, 11, 14, 10, 12, 10, 12, 10, 10,
+ 16, 16, 14, 15, 14, 14, 12, 11, 11, 15, 11, 12, 11, 13, 11, 10,
+ 12, 16, 11, 12, 12, 13, 11, 10, 16, 16, 13, 15, 14, 15, 11, 11,
+ 11, 16, 11, 13, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
+ 16, 16, 14, 15, 14, 15, 13, 11, 11, 16, 11, 13, 11, 13, 11, 10,
+ 12, 16, 12, 13, 10, 13, 11, 10, 16, 16, 14, 14, 12, 14, 12, 10,
+ 12, 16, 12, 14, 12, 14, 11, 11, 13, 16, 12, 14, 12, 14, 11, 10,
+ 15, 16, 12, 14, 12, 14, 11, 9, 9, 14, 11, 13, 11, 13, 11, 11,
+ 13, 16, 12, 14, 13, 14, 12, 11, 16, 16, 16, 16, 16, 16, 14, 12,
+ 9, 14, 10, 12, 10, 13, 11, 11, 12, 16, 12, 13, 13, 14, 11, 11,
+ 16, 16, 16, 16, 16, 14, 13, 12, 10, 15, 11, 13, 11, 14, 11, 10,
+ 13, 16, 12, 13, 12, 15, 11, 10, 16, 16, 14, 16, 15, 16, 13, 11,
+ 10, 14, 10, 13, 11, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 11,
+ 16, 16, 16, 16, 15, 16, 13, 12, 10, 14, 10, 12, 10, 13, 10, 11,
+ 12, 15, 12, 13, 12, 13, 11, 10, 16, 16, 14, 14, 15, 15, 13, 11,
+ 11, 16, 11, 13, 11, 14, 11, 10, 12, 16, 11, 13, 12, 14, 11, 10,
+ 16, 16, 13, 14, 14, 15, 12, 10, 11, 16, 12, 13, 11, 14, 11, 10,
+ 13, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 15, 15, 12, 11,
+ 11, 16, 12, 13, 11, 14, 11, 10, 13, 16, 12, 13, 11, 14, 11, 10,
+ 16, 16, 14, 15, 13, 14, 12, 10, 12, 16, 12, 14, 12, 14, 10, 10,
+ 12, 16, 11, 13, 11, 14, 10, 10, 14, 16, 11, 13, 12, 13, 10, 8,
+ },
+ },
+ {
+ {
+ 0, 12, 6, 13, 7, 14, 11, 14, 8, 14, 10, 14, 11, 15, 13, 15,
+ 16, 16, 16, 16, 16, 16, 16, 16, 5, 14, 7, 13, 10, 16, 12, 14,
+ 9, 16, 10, 14, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 9, 14, 14, 16, 13, 16, 12, 16, 11, 16, 16, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 5, 14, 9, 14, 8, 14, 12, 14,
+ 9, 16, 11, 14, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 14, 11, 16, 12, 14, 10, 16, 11, 15, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 14, 16,
+ 13, 16, 12, 16, 15, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 13, 16, 11, 16, 14, 16, 13, 16, 14, 16, 13, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 14, 16, 13, 16, 14, 16,
+ 13, 16, 14, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 12, 6, 12, 8, 14, 11, 13,
+ 8, 14, 10, 13, 11, 14, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 14, 7, 13, 10, 14, 11, 14, 9, 16, 10, 14, 12, 16, 13, 15,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 14, 13, 16, 13, 14,
+ 12, 16, 11, 15, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 14, 9, 13, 8, 14, 12, 14, 9, 16, 11, 14, 11, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 15, 9, 14, 10, 16, 12, 14,
+ 9, 16, 10, 14, 11, 16, 12, 14, 16, 16, 16, 16, 16, 16, 15, 16,
+ 11, 16, 11, 15, 14, 16, 13, 15, 12, 16, 11, 15, 14, 16, 13, 14,
+ 16, 16, 14, 16, 16, 16, 14, 16, 10, 16, 13, 16, 10, 16, 13, 16,
+ 12, 16, 14, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 15, 16, 14, 16, 14, 16, 16, 16, 14, 16,
+ 15, 16, 14, 16, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 14,
+ 4, 14, 8, 13, 9, 16, 12, 14, 9, 16, 11, 14, 11, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 15, 8, 13, 10, 16, 12, 14,
+ 10, 16, 11, 14, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 9, 14, 13, 16, 13, 15, 12, 16, 11, 16, 14, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 9, 14, 9, 16, 12, 14,
+ 10, 16, 11, 15, 12, 16, 13, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 14, 11, 16, 12, 14, 10, 16, 11, 14, 12, 16, 13, 15,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 15, 14, 16, 13, 15,
+ 12, 16, 11, 15, 14, 16, 13, 14, 16, 16, 14, 16, 16, 16, 14, 16,
+ 10, 16, 13, 16, 10, 16, 13, 15, 13, 16, 14, 16, 12, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 12, 16, 13, 16,
+ 12, 16, 13, 16, 11, 16, 13, 16, 16, 16, 16, 16, 15, 16, 15, 16,
+ 14, 16, 14, 16, 15, 16, 14, 16, 14, 16, 14, 16, 14, 16, 14, 14,
+ 16, 16, 14, 16, 15, 16, 14, 14, 6, 16, 9, 14, 10, 16, 12, 14,
+ 10, 16, 11, 13, 12, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
+ 7, 16, 9, 14, 10, 16, 12, 13, 11, 16, 11, 14, 12, 16, 12, 14,
+ 16, 16, 16, 16, 16, 16, 14, 14, 9, 16, 9, 14, 12, 16, 11, 13,
+ 12, 16, 11, 14, 12, 16, 12, 13, 16, 16, 14, 16, 16, 16, 13, 14,
+ 7, 16, 10, 14, 10, 16, 12, 14, 11, 16, 11, 14, 11, 16, 12, 14,
+ 16, 16, 16, 16, 16, 16, 14, 14, 8, 16, 10, 14, 10, 16, 11, 13,
+ 10, 16, 11, 13, 11, 16, 12, 13, 16, 16, 14, 16, 16, 16, 14, 14,
+ 10, 16, 9, 13, 12, 16, 11, 13, 11, 16, 10, 13, 12, 16, 11, 12,
+ 16, 16, 13, 15, 15, 16, 13, 13, 9, 16, 11, 14, 9, 16, 11, 13,
+ 12, 16, 12, 16, 12, 16, 12, 13, 16, 16, 16, 16, 15, 16, 14, 14,
+ 10, 16, 11, 14, 10, 16, 11, 13, 11, 16, 12, 14, 10, 15, 11, 13,
+ 16, 16, 15, 16, 13, 16, 13, 13, 12, 16, 11, 13, 12, 16, 11, 12,
+ 12, 16, 11, 13, 11, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 11,
+ },
+ {
+ 0, 10, 5, 10, 6, 11, 8, 10, 7, 12, 8, 11, 8, 12, 9, 10,
+ 14, 16, 13, 13, 13, 14, 12, 11, 4, 12, 6, 10, 8, 12, 9, 10,
+ 8, 13, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
+ 9, 15, 8, 12, 12, 14, 10, 11, 11, 16, 9, 12, 12, 14, 10, 10,
+ 14, 16, 11, 13, 13, 15, 11, 11, 4, 12, 8, 11, 6, 11, 9, 10,
+ 8, 13, 9, 11, 8, 12, 9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
+ 7, 13, 8, 11, 9, 12, 9, 10, 8, 13, 9, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 12, 13, 11, 10, 11, 16, 10, 12, 12, 14, 10, 11,
+ 11, 16, 10, 12, 12, 14, 10, 10, 15, 16, 11, 13, 13, 14, 11, 10,
+ 10, 16, 11, 13, 9, 13, 10, 11, 11, 15, 12, 13, 10, 12, 10, 11,
+ 15, 16, 13, 14, 12, 13, 11, 11, 11, 16, 11, 13, 10, 13, 10, 11,
+ 12, 16, 11, 13, 10, 13, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
+ 13, 16, 12, 13, 13, 14, 11, 11, 14, 16, 12, 13, 12, 14, 11, 10,
+ 16, 16, 13, 13, 13, 14, 11, 9, 3, 11, 6, 10, 6, 11, 9, 10,
+ 8, 12, 8, 11, 9, 12, 9, 10, 14, 16, 13, 13, 13, 13, 12, 11,
+ 5, 12, 6, 10, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 13, 14, 11, 11, 9, 15, 8, 11, 11, 14, 10, 10,
+ 11, 15, 9, 11, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 10,
+ 5, 12, 8, 11, 7, 11, 9, 10, 8, 13, 9, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 13, 13, 11, 11, 7, 13, 8, 11, 8, 12, 9, 10,
+ 8, 13, 8, 11, 9, 12, 9, 9, 13, 16, 11, 13, 12, 13, 11, 10,
+ 10, 15, 9, 12, 11, 14, 10, 10, 11, 15, 9, 11, 11, 13, 10, 10,
+ 14, 16, 11, 12, 13, 14, 10, 10, 9, 16, 11, 13, 9, 12, 10, 10,
+ 11, 16, 11, 13, 9, 12, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
+ 11, 16, 11, 13, 10, 13, 10, 10, 11, 15, 11, 13, 9, 12, 10, 10,
+ 14, 16, 12, 13, 11, 13, 10, 10, 13, 16, 12, 13, 12, 14, 11, 10,
+ 13, 16, 11, 13, 12, 13, 10, 10, 14, 16, 11, 12, 12, 13, 10, 9,
+ 7, 14, 8, 12, 9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 11,
+ 16, 16, 14, 14, 14, 14, 12, 12, 7, 14, 8, 12, 9, 13, 10, 11,
+ 10, 14, 10, 12, 11, 13, 10, 11, 16, 16, 13, 13, 14, 14, 12, 11,
+ 10, 15, 9, 12, 12, 14, 10, 10, 12, 16, 9, 12, 12, 14, 10, 10,
+ 16, 16, 12, 13, 14, 15, 12, 11, 8, 14, 9, 12, 9, 13, 10, 11,
+ 10, 15, 10, 12, 10, 13, 10, 11, 16, 16, 14, 14, 14, 14, 12, 11,
+ 8, 14, 9, 12, 9, 13, 10, 11, 10, 14, 10, 12, 10, 13, 10, 10,
+ 15, 16, 13, 13, 13, 14, 12, 11, 10, 15, 10, 12, 12, 14, 10, 10,
+ 11, 16, 9, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 10,
+ 11, 16, 11, 14, 9, 13, 10, 11, 12, 16, 12, 14, 10, 13, 11, 11,
+ 16, 16, 14, 15, 13, 14, 12, 11, 11, 16, 12, 14, 10, 13, 11, 11,
+ 11, 16, 11, 13, 10, 13, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
+ 13, 16, 12, 14, 13, 14, 11, 10, 12, 16, 11, 13, 12, 13, 10, 10,
+ 14, 16, 11, 12, 11, 13, 10, 9, 10, 16, 10, 13, 11, 14, 11, 11,
+ 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 13, 14, 15, 12, 11,
+ 10, 16, 10, 13, 10, 14, 11, 11, 12, 16, 11, 13, 11, 14, 11, 11,
+ 16, 16, 14, 13, 14, 14, 12, 11, 11, 15, 9, 12, 11, 14, 10, 10,
+ 13, 16, 10, 12, 12, 14, 10, 10, 16, 16, 13, 13, 14, 14, 11, 10,
+ 10, 16, 10, 13, 11, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
+ 16, 16, 14, 14, 14, 14, 12, 11, 9, 16, 10, 13, 10, 14, 11, 11,
+ 11, 15, 11, 12, 11, 13, 11, 11, 16, 16, 13, 13, 14, 14, 12, 10,
+ 10, 15, 9, 12, 11, 14, 10, 10, 11, 16, 9, 11, 11, 13, 10, 9,
+ 15, 16, 11, 12, 13, 14, 10, 9, 11, 16, 11, 13, 10, 13, 10, 10,
+ 13, 16, 12, 13, 11, 13, 10, 10, 16, 16, 14, 14, 13, 13, 11, 10,
+ 11, 16, 11, 13, 10, 13, 10, 10, 12, 16, 11, 13, 10, 13, 10, 10,
+ 15, 16, 13, 13, 12, 13, 11, 9, 11, 16, 11, 12, 11, 13, 10, 9,
+ 11, 15, 10, 11, 11, 12, 9, 8, 13, 15, 10, 10, 10, 11, 8, 7,
+ },
+ {
+ 0, 9, 3, 8, 5, 9, 7, 8, 5, 11, 6, 9, 8, 11, 8, 9,
+ 16, 16, 16, 16, 16, 16, 11, 10, 2, 10, 4, 9, 7, 10, 7, 8,
+ 7, 16, 7, 10, 9, 11, 8, 9, 16, 16, 11, 16, 16, 16, 11, 10,
+ 7, 16, 7, 10, 10, 16, 8, 9, 10, 16, 8, 10, 11, 16, 9, 9,
+ 16, 16, 16, 16, 16, 16, 11, 10, 3, 11, 6, 9, 6, 11, 8, 8,
+ 7, 16, 8, 10, 8, 11, 8, 9, 16, 16, 15, 16, 16, 16, 11, 10,
+ 5, 11, 7, 9, 8, 11, 8, 8, 7, 16, 7, 10, 8, 11, 8, 8,
+ 16, 16, 11, 16, 16, 16, 10, 9, 9, 16, 8, 11, 11, 16, 9, 9,
+ 10, 16, 8, 11, 11, 16, 9, 9, 16, 16, 10, 16, 16, 16, 10, 9,
+ 8, 16, 10, 11, 8, 16, 9, 9, 11, 16, 11, 16, 10, 16, 10, 9,
+ 16, 16, 16, 16, 16, 16, 11, 10, 9, 16, 10, 16, 10, 16, 9, 9,
+ 10, 16, 10, 16, 9, 16, 9, 9, 16, 16, 16, 16, 15, 16, 10, 9,
+ 16, 16, 11, 16, 16, 16, 10, 10, 13, 16, 11, 16, 11, 16, 10, 9,
+ 16, 16, 10, 11, 11, 16, 9, 8, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 1, 10, 6, 10, 7, 11, 9, 10, 8, 12, 9, 12, 9, 12, 10, 10,
+ 16, 16, 14, 16, 14, 15, 13, 12, 5, 12, 7, 10, 9, 11, 9, 10,
+ 9, 13, 9, 12, 10, 13, 10, 10, 16, 16, 14, 15, 14, 14, 13, 12,
+ 10, 15, 10, 12, 12, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
+ 16, 16, 14, 16, 15, 16, 13, 12, 6, 12, 8, 11, 8, 11, 10, 10,
+ 9, 13, 10, 12, 10, 12, 10, 10, 15, 16, 13, 15, 13, 14, 12, 12,
+ 7, 13, 9, 11, 9, 12, 10, 10, 9, 14, 10, 12, 10, 13, 10, 10,
+ 15, 16, 13, 15, 13, 14, 12, 11, 11, 15, 11, 13, 12, 14, 11, 11,
+ 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 11,
+ 10, 16, 12, 14, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
+ 16, 16, 15, 16, 14, 16, 13, 12, 11, 16, 12, 14, 11, 14, 11, 11,
+ 12, 16, 12, 14, 11, 14, 11, 11, 16, 16, 14, 15, 13, 15, 12, 12,
+ 13, 16, 13, 15, 13, 15, 12, 12, 13, 16, 12, 15, 12, 15, 11, 11,
+ 16, 16, 13, 16, 13, 15, 12, 11, 4, 11, 7, 10, 7, 11, 9, 10,
+ 9, 13, 9, 12, 10, 12, 10, 10, 15, 16, 14, 15, 14, 15, 13, 12,
+ 6, 12, 7, 11, 9, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 10,
+ 15, 16, 14, 15, 14, 15, 12, 12, 10, 15, 9, 12, 12, 13, 11, 11,
+ 12, 15, 11, 13, 12, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 12,
+ 6, 12, 8, 11, 8, 11, 9, 10, 9, 14, 10, 12, 10, 12, 10, 10,
+ 14, 16, 13, 14, 13, 14, 12, 12, 8, 13, 9, 11, 9, 12, 10, 10,
+ 9, 13, 9, 12, 9, 12, 9, 10, 14, 16, 13, 14, 13, 14, 12, 11,
+ 11, 15, 11, 13, 11, 14, 11, 11, 12, 16, 10, 13, 12, 13, 11, 10,
+ 15, 16, 12, 15, 13, 16, 12, 11, 10, 15, 11, 13, 10, 13, 11, 11,
+ 12, 16, 12, 14, 11, 13, 11, 11, 16, 16, 14, 15, 13, 16, 13, 12,
+ 11, 16, 11, 14, 11, 13, 11, 11, 12, 16, 12, 14, 10, 13, 11, 11,
+ 15, 16, 13, 16, 12, 14, 12, 11, 12, 16, 12, 14, 12, 15, 11, 11,
+ 13, 16, 12, 14, 12, 14, 11, 11, 15, 16, 13, 15, 13, 15, 11, 10,
+ 7, 13, 9, 12, 10, 13, 11, 11, 11, 15, 12, 13, 12, 13, 11, 11,
+ 16, 16, 15, 16, 16, 16, 14, 13, 8, 13, 9, 12, 10, 13, 11, 11,
+ 12, 15, 11, 13, 12, 13, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
+ 11, 16, 11, 13, 12, 14, 11, 11, 13, 16, 12, 14, 13, 15, 12, 11,
+ 16, 16, 14, 16, 15, 16, 13, 12, 9, 15, 10, 13, 10, 13, 11, 11,
+ 12, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 16, 16, 16, 13, 12,
+ 9, 14, 10, 13, 10, 13, 11, 11, 11, 14, 11, 13, 11, 13, 11, 11,
+ 16, 16, 14, 16, 14, 16, 12, 12, 11, 16, 11, 14, 12, 14, 12, 11,
+ 12, 16, 11, 13, 13, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 11,
+ 12, 16, 12, 14, 11, 14, 11, 11, 13, 16, 13, 14, 12, 15, 12, 11,
+ 16, 16, 16, 16, 14, 16, 13, 12, 12, 16, 12, 14, 11, 14, 12, 11,
+ 12, 16, 12, 15, 11, 14, 11, 11, 16, 16, 14, 16, 13, 15, 12, 12,
+ 13, 16, 13, 16, 13, 16, 12, 12, 13, 16, 12, 15, 12, 16, 11, 11,
+ 14, 16, 12, 15, 12, 15, 11, 10, 9, 16, 11, 14, 12, 14, 12, 12,
+ 13, 16, 13, 15, 14, 16, 12, 12, 16, 16, 16, 16, 16, 16, 14, 13,
+ 10, 16, 11, 14, 12, 14, 12, 12, 13, 16, 13, 14, 13, 16, 12, 12,
+ 16, 16, 15, 16, 16, 16, 13, 12, 11, 16, 11, 14, 12, 15, 12, 11,
+ 13, 16, 12, 14, 13, 16, 12, 11, 16, 16, 14, 16, 16, 16, 13, 12,
+ 11, 16, 11, 14, 12, 14, 12, 12, 13, 16, 12, 15, 13, 16, 12, 12,
+ 16, 16, 16, 16, 16, 16, 14, 13, 10, 16, 11, 14, 11, 15, 11, 11,
+ 13, 16, 12, 14, 12, 14, 12, 11, 16, 16, 14, 16, 16, 16, 13, 12,
+ 11, 16, 11, 15, 12, 15, 12, 11, 13, 16, 11, 14, 13, 15, 12, 11,
+ 16, 16, 13, 16, 14, 16, 12, 11, 12, 16, 12, 15, 11, 15, 12, 11,
+ 14, 16, 13, 15, 12, 16, 12, 11, 16, 16, 15, 16, 14, 16, 13, 12,
+ 11, 16, 12, 15, 11, 15, 11, 11, 13, 16, 13, 16, 11, 15, 11, 11,
+ 16, 16, 14, 16, 13, 15, 12, 11, 12, 16, 12, 15, 12, 16, 11, 11,
+ 12, 16, 11, 15, 12, 14, 11, 11, 13, 16, 12, 13, 11, 13, 10, 9,
+ },
+ },
+ {
+ {
+ 0, 13, 6, 13, 8, 14, 12, 16, 8, 16, 11, 16, 12, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 16, 7, 14, 11, 16, 13, 16,
+ 9, 16, 11, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 10, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 5, 16, 10, 16, 8, 16, 13, 16,
+ 10, 16, 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 16, 11, 16, 13, 16, 10, 16, 12, 16, 12, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 16, 16, 16, 16,
+ 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 11, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
+ 14, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 13, 7, 13, 8, 16, 12, 16,
+ 8, 16, 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 16, 7, 14, 10, 16, 12, 16, 9, 16, 10, 16, 12, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 9, 16, 14, 16, 14, 16,
+ 13, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 9, 16, 8, 16, 12, 16, 9, 16, 11, 16, 11, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 10, 16, 11, 16, 13, 16,
+ 9, 16, 11, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 12, 16, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 13, 16, 11, 16, 14, 16,
+ 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 14, 16, 13, 16, 14, 16, 13, 16, 14, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 16, 8, 16, 9, 16, 13, 16, 10, 16, 11, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 8, 16, 11, 16, 13, 16,
+ 10, 16, 11, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 9, 16, 13, 16, 13, 16, 13, 16, 12, 16, 16, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 10, 16, 13, 16,
+ 10, 16, 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 16, 11, 16, 13, 16, 10, 16, 11, 16, 12, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 14, 16,
+ 12, 16, 11, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 13, 16, 10, 16, 13, 16, 13, 16, 16, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 12, 16, 14, 16,
+ 12, 16, 15, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 10, 16, 13, 16,
+ 11, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 9, 16, 11, 16, 12, 16, 11, 16, 11, 16, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 16, 12, 16, 12, 16,
+ 13, 16, 11, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 16, 10, 16, 12, 16, 11, 16, 12, 16, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 10, 16, 11, 16, 12, 16,
+ 10, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 10, 14, 12, 16, 12, 16, 11, 16, 10, 14, 13, 16, 12, 14,
+ 16, 16, 14, 16, 16, 16, 14, 16, 9, 16, 12, 16, 10, 16, 12, 16,
+ 13, 16, 13, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 11, 16, 12, 16, 11, 16, 12, 16, 11, 16, 12, 15,
+ 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 12, 16, 13, 16, 12, 13,
+ 12, 16, 12, 16, 12, 16, 12, 13, 16, 16, 13, 14, 13, 16, 13, 13,
+ },
+ {
+ 0, 10, 5, 10, 5, 10, 8, 10, 6, 11, 8, 11, 8, 11, 9, 10,
+ 14, 16, 13, 14, 13, 14, 12, 12, 4, 12, 5, 10, 8, 12, 9, 10,
+ 7, 12, 8, 11, 9, 12, 9, 10, 14, 16, 12, 13, 13, 14, 12, 12,
+ 9, 16, 8, 12, 12, 14, 10, 11, 11, 16, 9, 12, 12, 14, 11, 11,
+ 14, 16, 12, 13, 14, 15, 12, 12, 4, 12, 7, 11, 6, 11, 9, 10,
+ 8, 12, 9, 11, 8, 11, 9, 10, 14, 16, 12, 14, 13, 14, 12, 12,
+ 7, 13, 8, 11, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 12, 13, 11, 11, 11, 16, 10, 12, 12, 14, 11, 11,
+ 12, 16, 10, 12, 12, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 11,
+ 10, 16, 11, 14, 9, 13, 10, 11, 11, 16, 12, 14, 10, 13, 11, 11,
+ 15, 16, 13, 14, 13, 14, 12, 12, 11, 16, 12, 14, 10, 13, 11, 11,
+ 12, 16, 12, 14, 11, 13, 11, 11, 15, 16, 13, 14, 13, 14, 12, 11,
+ 14, 16, 13, 14, 13, 15, 12, 12, 14, 16, 12, 14, 13, 15, 11, 11,
+ 16, 16, 13, 14, 14, 15, 12, 11, 3, 11, 5, 10, 6, 11, 9, 10,
+ 7, 12, 8, 11, 9, 11, 9, 10, 14, 16, 13, 13, 13, 14, 12, 12,
+ 5, 12, 6, 10, 8, 12, 9, 10, 8, 13, 8, 11, 9, 12, 9, 10,
+ 14, 16, 12, 13, 13, 14, 12, 12, 9, 16, 8, 11, 11, 14, 10, 11,
+ 11, 16, 9, 12, 12, 14, 10, 11, 15, 16, 12, 13, 14, 15, 12, 11,
+ 5, 12, 7, 11, 6, 11, 9, 10, 8, 13, 9, 11, 8, 11, 9, 10,
+ 14, 16, 12, 14, 13, 13, 12, 12, 7, 13, 8, 11, 8, 12, 9, 10,
+ 8, 12, 8, 11, 9, 12, 9, 10, 13, 16, 12, 13, 12, 13, 11, 11,
+ 10, 16, 9, 12, 12, 14, 10, 11, 11, 15, 9, 12, 12, 14, 10, 11,
+ 14, 16, 11, 13, 13, 14, 11, 11, 9, 16, 11, 14, 8, 13, 10, 11,
+ 11, 16, 12, 13, 10, 13, 10, 11, 16, 16, 13, 15, 13, 14, 12, 12,
+ 11, 16, 11, 14, 10, 13, 10, 11, 11, 16, 11, 13, 10, 13, 10, 11,
+ 14, 16, 13, 14, 12, 13, 11, 11, 14, 16, 12, 14, 13, 15, 11, 11,
+ 13, 16, 12, 13, 12, 14, 11, 11, 14, 16, 12, 13, 12, 13, 11, 10,
+ 6, 14, 8, 12, 9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 12,
+ 16, 16, 14, 14, 14, 14, 13, 12, 7, 14, 8, 12, 9, 13, 10, 11,
+ 10, 14, 10, 12, 11, 13, 11, 11, 16, 16, 13, 14, 14, 15, 13, 12,
+ 10, 16, 8, 12, 12, 14, 10, 11, 12, 16, 10, 12, 13, 15, 11, 11,
+ 16, 16, 13, 14, 15, 16, 12, 12, 8, 15, 9, 13, 9, 13, 10, 11,
+ 10, 15, 10, 13, 10, 13, 11, 11, 16, 16, 14, 14, 14, 14, 13, 12,
+ 8, 15, 9, 12, 10, 13, 10, 11, 10, 14, 10, 12, 10, 13, 10, 11,
+ 16, 16, 13, 14, 13, 14, 12, 12, 10, 16, 10, 13, 12, 15, 11, 11,
+ 11, 16, 9, 12, 12, 14, 11, 11, 14, 16, 11, 13, 14, 16, 12, 11,
+ 10, 16, 12, 14, 9, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
+ 16, 16, 15, 16, 14, 14, 13, 12, 11, 16, 12, 14, 11, 14, 11, 11,
+ 11, 16, 12, 14, 10, 13, 11, 11, 15, 16, 13, 15, 12, 14, 12, 11,
+ 14, 16, 13, 14, 13, 16, 12, 12, 12, 16, 12, 13, 12, 14, 11, 11,
+ 14, 16, 11, 12, 12, 13, 10, 10, 9, 16, 10, 14, 11, 15, 12, 12,
+ 12, 16, 11, 13, 12, 15, 12, 12, 16, 16, 14, 13, 15, 15, 13, 12,
+ 10, 16, 10, 14, 11, 15, 11, 12, 12, 16, 11, 13, 12, 14, 12, 12,
+ 16, 16, 14, 13, 15, 14, 13, 12, 11, 16, 9, 12, 12, 14, 11, 11,
+ 13, 16, 11, 13, 13, 15, 11, 11, 16, 16, 14, 14, 16, 16, 12, 12,
+ 10, 16, 10, 14, 11, 14, 11, 12, 12, 16, 11, 13, 12, 14, 12, 12,
+ 16, 16, 14, 14, 15, 15, 13, 12, 10, 16, 10, 13, 11, 14, 11, 12,
+ 11, 16, 11, 13, 11, 14, 11, 12, 16, 16, 14, 14, 14, 14, 13, 12,
+ 11, 16, 10, 12, 12, 15, 11, 11, 12, 16, 9, 12, 12, 14, 10, 11,
+ 16, 16, 12, 13, 14, 15, 11, 11, 11, 16, 12, 14, 10, 14, 11, 11,
+ 13, 16, 12, 14, 12, 14, 11, 11, 16, 16, 15, 15, 14, 15, 12, 12,
+ 11, 16, 12, 14, 11, 14, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
+ 16, 16, 14, 14, 13, 14, 12, 11, 12, 16, 11, 13, 12, 14, 10, 10,
+ 12, 15, 11, 12, 12, 13, 10, 10, 14, 15, 11, 11, 12, 12, 10, 9,
+ },
+ {
+ 0, 8, 3, 8, 5, 9, 7, 8, 5, 10, 6, 10, 8, 11, 8, 9,
+ 16, 16, 15, 16, 16, 16, 11, 11, 2, 10, 4, 9, 7, 10, 7, 8,
+ 7, 16, 7, 10, 9, 11, 8, 9, 16, 16, 15, 16, 16, 16, 11, 11,
+ 7, 16, 6, 11, 10, 16, 9, 10, 10, 16, 9, 11, 11, 16, 9, 10,
+ 16, 16, 16, 16, 16, 16, 16, 11, 3, 10, 6, 9, 5, 10, 7, 9,
+ 7, 16, 8, 10, 8, 11, 8, 9, 16, 16, 16, 16, 16, 16, 11, 11,
+ 5, 11, 7, 10, 8, 11, 8, 9, 7, 14, 7, 10, 8, 11, 8, 9,
+ 16, 16, 11, 16, 16, 16, 10, 11, 9, 16, 9, 11, 11, 16, 9, 10,
+ 10, 16, 8, 11, 11, 16, 9, 10, 16, 16, 11, 16, 16, 16, 11, 10,
+ 8, 16, 9, 16, 7, 16, 9, 10, 11, 16, 11, 16, 10, 16, 10, 10,
+ 16, 16, 16, 16, 16, 16, 16, 11, 9, 16, 10, 16, 9, 16, 9, 10,
+ 10, 16, 10, 16, 9, 16, 9, 10, 16, 16, 16, 16, 11, 16, 11, 11,
+ 16, 16, 16, 16, 16, 16, 10, 10, 11, 16, 11, 16, 11, 16, 10, 10,
+ 16, 16, 11, 16, 11, 16, 10, 9, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 1, 10, 6, 10, 7, 11, 9, 10, 8, 12, 9, 12, 9, 12, 10, 10,
+ 15, 16, 14, 15, 14, 16, 13, 12, 5, 12, 7, 11, 8, 11, 9, 10,
+ 9, 13, 9, 12, 10, 12, 10, 10, 16, 16, 14, 15, 13, 16, 13, 12,
+ 10, 15, 10, 13, 12, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
+ 16, 16, 14, 16, 14, 16, 13, 12, 5, 12, 8, 11, 7, 11, 9, 10,
+ 9, 13, 10, 12, 9, 12, 10, 10, 14, 16, 14, 15, 13, 14, 13, 12,
+ 7, 13, 9, 12, 9, 12, 10, 10, 9, 13, 9, 12, 9, 12, 10, 10,
+ 14, 16, 13, 14, 13, 15, 12, 12, 11, 16, 11, 13, 12, 14, 11, 11,
+ 12, 16, 11, 14, 12, 14, 11, 11, 16, 16, 14, 16, 14, 16, 13, 12,
+ 10, 16, 11, 14, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
+ 15, 16, 15, 16, 14, 16, 13, 12, 11, 16, 12, 14, 11, 14, 11, 12,
+ 12, 16, 12, 14, 11, 14, 11, 11, 15, 16, 14, 16, 13, 16, 13, 12,
+ 13, 16, 13, 16, 13, 16, 12, 12, 13, 16, 13, 16, 13, 16, 12, 12,
+ 16, 16, 14, 15, 14, 16, 13, 12, 4, 11, 7, 10, 7, 11, 9, 10,
+ 9, 13, 9, 11, 9, 12, 10, 10, 15, 16, 14, 15, 14, 15, 13, 12,
+ 6, 12, 7, 11, 8, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 10,
+ 15, 16, 13, 14, 14, 15, 12, 12, 10, 14, 10, 12, 12, 13, 11, 11,
+ 12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
+ 6, 12, 8, 11, 8, 11, 9, 10, 9, 13, 10, 12, 9, 12, 10, 10,
+ 16, 16, 14, 15, 13, 14, 12, 12, 8, 13, 9, 11, 9, 12, 9, 10,
+ 9, 13, 9, 12, 9, 12, 9, 10, 14, 16, 13, 14, 13, 14, 12, 11,
+ 11, 15, 11, 13, 12, 14, 11, 11, 11, 16, 10, 13, 12, 14, 11, 11,
+ 15, 16, 13, 15, 14, 16, 12, 11, 10, 16, 12, 13, 10, 13, 11, 11,
+ 11, 16, 12, 14, 10, 13, 11, 11, 16, 16, 14, 16, 13, 16, 13, 12,
+ 11, 16, 12, 14, 10, 14, 11, 11, 11, 16, 12, 14, 10, 13, 11, 11,
+ 16, 16, 14, 16, 12, 15, 12, 11, 13, 16, 13, 15, 13, 15, 12, 12,
+ 13, 16, 12, 15, 12, 15, 12, 11, 15, 16, 13, 16, 13, 16, 12, 11,
+ 8, 14, 9, 12, 10, 13, 11, 11, 11, 16, 11, 13, 11, 13, 11, 11,
+ 16, 16, 16, 16, 16, 16, 14, 13, 9, 14, 10, 12, 10, 13, 11, 11,
+ 11, 16, 11, 13, 12, 13, 11, 11, 16, 16, 15, 16, 15, 16, 14, 12,
+ 11, 16, 11, 13, 12, 14, 12, 11, 13, 16, 12, 14, 13, 14, 12, 11,
+ 16, 16, 15, 16, 16, 16, 14, 13, 9, 14, 10, 13, 10, 13, 11, 11,
+ 11, 16, 11, 13, 11, 13, 11, 11, 16, 16, 15, 16, 14, 15, 14, 13,
+ 9, 14, 10, 13, 10, 13, 11, 11, 11, 15, 11, 13, 11, 13, 11, 11,
+ 16, 16, 14, 16, 14, 16, 13, 12, 12, 16, 12, 14, 13, 14, 12, 11,
+ 12, 16, 11, 14, 12, 15, 12, 11, 16, 16, 13, 16, 15, 16, 13, 11,
+ 11, 16, 12, 14, 11, 14, 12, 11, 13, 16, 13, 15, 12, 14, 12, 12,
+ 16, 16, 16, 16, 14, 16, 14, 13, 12, 16, 13, 15, 11, 14, 12, 12,
+ 12, 16, 13, 14, 11, 15, 12, 11, 16, 16, 15, 16, 13, 15, 13, 12,
+ 13, 16, 13, 15, 13, 16, 12, 12, 13, 16, 13, 15, 13, 15, 12, 12,
+ 15, 16, 13, 16, 13, 15, 11, 10, 10, 16, 12, 14, 12, 15, 12, 12,
+ 14, 16, 13, 15, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 15, 13,
+ 10, 16, 12, 14, 12, 15, 12, 12, 13, 16, 13, 15, 13, 15, 13, 12,
+ 16, 16, 16, 16, 16, 16, 14, 13, 11, 16, 12, 15, 13, 16, 12, 12,
+ 14, 16, 13, 16, 13, 16, 12, 12, 16, 16, 15, 16, 15, 16, 14, 12,
+ 11, 16, 12, 14, 12, 16, 12, 12, 14, 16, 13, 15, 13, 15, 13, 12,
+ 16, 16, 16, 16, 16, 16, 15, 13, 11, 16, 12, 14, 12, 15, 12, 12,
+ 13, 16, 12, 14, 12, 15, 12, 12, 16, 16, 16, 16, 16, 16, 14, 12,
+ 12, 16, 12, 15, 13, 16, 12, 12, 13, 16, 12, 15, 13, 15, 12, 11,
+ 16, 16, 14, 16, 15, 16, 13, 12, 12, 16, 13, 16, 12, 16, 12, 12,
+ 15, 16, 14, 16, 13, 16, 12, 12, 16, 16, 16, 16, 16, 16, 14, 13,
+ 12, 16, 13, 15, 12, 16, 12, 12, 13, 16, 13, 15, 12, 15, 12, 12,
+ 16, 16, 15, 16, 14, 16, 13, 12, 13, 16, 13, 16, 12, 16, 12, 12,
+ 13, 16, 12, 16, 12, 15, 12, 12, 14, 16, 12, 14, 12, 14, 11, 10,
+ },
+ },
+ {
+ {
+ 0, 16, 6, 16, 8, 16, 16, 16, 9, 16, 11, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 16, 7, 16, 11, 16, 16, 16,
+ 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 10, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 5, 16, 10, 16, 9, 16, 16, 16,
+ 10, 16, 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 11, 16, 12, 16, 16, 16, 10, 16, 12, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 7, 16, 8, 16, 13, 16,
+ 9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 16, 7, 16, 11, 16, 13, 16, 9, 16, 11, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 16, 16, 16, 16, 16,
+ 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 16, 10, 16, 8, 16, 16, 16, 10, 16, 12, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 10, 16, 11, 16, 16, 16,
+ 9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 12, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 16, 16, 11, 16, 16, 16,
+ 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 16, 8, 16, 10, 16, 16, 16, 10, 16, 11, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 8, 16, 11, 16, 16, 16,
+ 10, 16, 12, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 9, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 10, 16, 16, 16,
+ 11, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 11, 16, 11, 16, 16, 16, 10, 16, 12, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16,
+ 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 12, 16, 16, 16,
+ 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 11, 16, 16, 16,
+ 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 9, 16, 11, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 9, 16, 13, 16, 12, 16,
+ 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 16, 10, 16, 14, 16, 12, 16, 12, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 11, 16, 13, 16,
+ 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 10, 16, 13, 16, 12, 16, 12, 16, 11, 16, 16, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 12, 16, 10, 16, 13, 16,
+ 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 13, 16, 11, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 12, 16,
+ 13, 16, 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 0, 10, 4, 10, 5, 11, 9, 11, 6, 11, 8, 11, 8, 12, 10, 12,
+ 15, 16, 13, 15, 14, 15, 13, 14, 4, 12, 5, 11, 8, 12, 9, 11,
+ 7, 13, 8, 12, 9, 13, 10, 12, 15, 16, 13, 15, 14, 16, 13, 14,
+ 10, 16, 9, 13, 12, 16, 11, 13, 11, 16, 10, 14, 13, 16, 12, 13,
+ 16, 16, 14, 16, 15, 16, 14, 15, 4, 12, 7, 12, 6, 12, 9, 11,
+ 8, 13, 9, 12, 9, 12, 10, 12, 15, 16, 13, 15, 14, 15, 13, 14,
+ 7, 13, 8, 12, 9, 13, 10, 12, 8, 13, 9, 12, 9, 13, 10, 12,
+ 14, 16, 13, 15, 13, 15, 13, 14, 12, 16, 11, 14, 13, 16, 12, 13,
+ 12, 16, 11, 14, 13, 16, 12, 13, 16, 16, 14, 16, 15, 16, 14, 15,
+ 10, 16, 12, 16, 10, 14, 12, 13, 12, 16, 13, 16, 11, 14, 12, 13,
+ 16, 16, 16, 16, 15, 16, 14, 15, 12, 16, 13, 16, 11, 15, 12, 13,
+ 13, 16, 13, 16, 12, 15, 12, 14, 16, 16, 16, 16, 14, 16, 13, 14,
+ 16, 16, 14, 16, 14, 16, 13, 15, 16, 16, 14, 16, 14, 16, 13, 15,
+ 16, 16, 16, 16, 16, 16, 14, 16, 2, 11, 5, 11, 6, 11, 9, 11,
+ 7, 12, 8, 11, 9, 12, 10, 12, 15, 16, 14, 14, 14, 14, 13, 14,
+ 4, 13, 6, 11, 8, 12, 9, 11, 8, 13, 8, 12, 10, 13, 10, 12,
+ 15, 16, 13, 15, 14, 15, 13, 14, 9, 16, 8, 13, 12, 15, 11, 12,
+ 11, 16, 10, 14, 13, 16, 12, 13, 16, 16, 14, 16, 16, 16, 14, 15,
+ 5, 13, 8, 12, 7, 12, 9, 11, 8, 13, 9, 12, 9, 12, 10, 12,
+ 16, 16, 14, 15, 14, 15, 13, 13, 7, 13, 8, 12, 9, 13, 10, 12,
+ 8, 13, 8, 12, 9, 13, 10, 12, 14, 16, 13, 14, 13, 15, 12, 13,
+ 11, 16, 10, 14, 13, 16, 12, 13, 11, 16, 10, 13, 12, 15, 11, 13,
+ 14, 16, 12, 14, 14, 16, 13, 14, 10, 16, 12, 15, 9, 14, 11, 13,
+ 12, 16, 12, 16, 11, 14, 12, 13, 16, 16, 15, 16, 16, 16, 14, 15,
+ 11, 16, 12, 15, 11, 15, 12, 13, 12, 16, 12, 15, 11, 14, 12, 13,
+ 16, 16, 14, 16, 13, 15, 13, 14, 15, 16, 14, 16, 14, 16, 13, 14,
+ 14, 16, 13, 16, 14, 16, 13, 14, 16, 16, 14, 16, 14, 16, 13, 14,
+ 7, 15, 8, 13, 9, 14, 11, 13, 10, 14, 10, 13, 11, 14, 12, 13,
+ 16, 16, 15, 16, 15, 16, 15, 14, 7, 16, 8, 13, 10, 14, 11, 13,
+ 11, 15, 10, 13, 12, 14, 12, 13, 16, 16, 16, 16, 16, 16, 15, 15,
+ 10, 16, 9, 13, 13, 16, 12, 13, 13, 16, 11, 14, 14, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 15, 16, 8, 16, 10, 14, 9, 14, 11, 13,
+ 11, 16, 11, 14, 11, 14, 12, 13, 16, 16, 16, 16, 16, 16, 14, 15,
+ 8, 16, 10, 14, 10, 14, 11, 13, 10, 15, 10, 14, 11, 14, 12, 13,
+ 16, 16, 14, 16, 15, 16, 14, 14, 11, 16, 10, 14, 13, 16, 12, 13,
+ 11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 16, 16, 16, 14, 14,
+ 11, 16, 12, 16, 10, 15, 12, 13, 14, 16, 14, 16, 12, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 11, 16, 12, 14,
+ 12, 16, 13, 16, 11, 14, 12, 13, 16, 16, 16, 16, 14, 16, 14, 14,
+ 15, 16, 14, 16, 16, 16, 13, 14, 13, 16, 13, 15, 14, 16, 13, 14,
+ 14, 16, 13, 14, 14, 15, 13, 14, 9, 16, 11, 16, 12, 16, 13, 14,
+ 12, 16, 12, 15, 13, 16, 13, 14, 16, 16, 16, 15, 16, 16, 15, 15,
+ 10, 16, 10, 16, 12, 16, 12, 14, 12, 16, 12, 14, 13, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 15, 15, 11, 16, 10, 14, 14, 16, 12, 13,
+ 14, 16, 12, 16, 14, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 15,
+ 10, 16, 12, 16, 11, 16, 12, 14, 13, 16, 12, 15, 13, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 16, 15, 10, 16, 11, 16, 12, 16, 12, 14,
+ 12, 16, 12, 15, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
+ 11, 16, 10, 14, 14, 16, 12, 13, 13, 16, 11, 14, 14, 16, 12, 13,
+ 16, 16, 15, 16, 16, 16, 14, 14, 12, 16, 13, 16, 11, 16, 12, 14,
+ 15, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 16,
+ 12, 16, 13, 16, 12, 16, 12, 14, 13, 16, 13, 16, 12, 16, 12, 13,
+ 16, 16, 16, 16, 16, 16, 14, 15, 13, 16, 13, 16, 14, 16, 12, 13,
+ 13, 16, 13, 14, 14, 16, 12, 13, 16, 16, 14, 14, 14, 15, 13, 13,
+ },
+ {
+ 0, 9, 3, 9, 5, 9, 7, 9, 5, 10, 7, 11, 8, 11, 9, 10,
+ 16, 16, 16, 16, 16, 16, 16, 16, 2, 11, 4, 10, 7, 11, 8, 10,
+ 7, 16, 7, 11, 9, 16, 9, 11, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 7, 16, 11, 16, 10, 11, 11, 16, 10, 16, 16, 16, 11, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 2, 11, 6, 10, 6, 10, 8, 10,
+ 7, 16, 8, 16, 8, 11, 9, 11, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 13, 7, 11, 8, 11, 9, 11, 6, 12, 8, 12, 8, 12, 9, 11,
+ 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 10, 16, 12, 16, 10, 13,
+ 10, 16, 9, 16, 11, 16, 11, 12, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 16, 8, 16, 10, 12, 11, 16, 12, 16, 10, 16, 11, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 11, 16, 10, 16, 11, 16,
+ 11, 16, 12, 16, 10, 16, 11, 12, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 1, 10, 5, 10, 6, 10, 9, 10, 7, 12, 9, 12, 9, 12, 10, 10,
+ 16, 16, 15, 16, 14, 16, 13, 13, 5, 12, 7, 11, 8, 11, 9, 10,
+ 8, 13, 9, 12, 10, 12, 10, 11, 16, 16, 16, 16, 14, 16, 13, 12,
+ 10, 16, 10, 13, 12, 14, 12, 12, 12, 16, 11, 14, 13, 15, 12, 12,
+ 16, 16, 16, 15, 16, 16, 14, 13, 5, 12, 8, 11, 7, 11, 9, 10,
+ 8, 13, 10, 12, 9, 12, 10, 10, 15, 16, 14, 15, 14, 14, 13, 13,
+ 7, 13, 9, 12, 9, 12, 10, 10, 9, 13, 10, 13, 10, 13, 10, 10,
+ 14, 16, 14, 15, 14, 16, 13, 12, 11, 16, 12, 14, 12, 15, 12, 12,
+ 12, 16, 12, 15, 13, 16, 12, 12, 16, 16, 15, 16, 16, 16, 14, 13,
+ 10, 16, 12, 14, 10, 14, 12, 12, 12, 16, 13, 14, 11, 14, 12, 12,
+ 16, 16, 16, 16, 14, 16, 14, 13, 11, 16, 12, 14, 11, 14, 12, 12,
+ 12, 16, 13, 16, 11, 15, 12, 12, 16, 16, 16, 16, 14, 16, 14, 13,
+ 13, 16, 14, 16, 14, 16, 13, 13, 13, 16, 13, 16, 13, 16, 13, 12,
+ 16, 16, 16, 16, 16, 16, 13, 13, 4, 11, 7, 10, 7, 11, 9, 10,
+ 8, 12, 9, 12, 9, 12, 10, 11, 15, 16, 14, 15, 14, 16, 13, 13,
+ 6, 12, 7, 11, 8, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 10,
+ 16, 16, 15, 16, 15, 16, 13, 12, 10, 16, 10, 13, 12, 14, 12, 11,
+ 12, 16, 11, 14, 13, 14, 12, 12, 16, 16, 16, 14, 16, 16, 14, 13,
+ 6, 12, 8, 11, 7, 11, 9, 10, 9, 14, 10, 12, 9, 12, 10, 10,
+ 15, 16, 14, 16, 14, 16, 14, 13, 7, 13, 9, 12, 9, 12, 10, 10,
+ 9, 13, 9, 12, 9, 12, 10, 10, 14, 16, 13, 14, 14, 16, 12, 11,
+ 11, 16, 11, 14, 12, 14, 12, 12, 12, 16, 11, 14, 12, 14, 12, 11,
+ 16, 16, 13, 16, 14, 16, 13, 12, 10, 16, 12, 14, 10, 14, 11, 11,
+ 12, 16, 13, 14, 11, 14, 12, 12, 16, 16, 16, 16, 14, 16, 13, 13,
+ 11, 16, 12, 16, 11, 14, 12, 12, 12, 16, 12, 14, 11, 14, 12, 11,
+ 16, 16, 15, 16, 13, 15, 13, 12, 13, 16, 14, 16, 13, 16, 13, 12,
+ 13, 16, 13, 16, 13, 16, 13, 12, 16, 16, 14, 16, 14, 16, 12, 11,
+ 8, 13, 10, 12, 10, 13, 11, 11, 11, 14, 12, 14, 12, 14, 12, 12,
+ 16, 16, 16, 16, 16, 16, 14, 13, 9, 14, 10, 13, 10, 13, 11, 11,
+ 12, 16, 12, 13, 12, 13, 12, 11, 16, 16, 16, 16, 16, 16, 15, 14,
+ 12, 16, 11, 14, 13, 15, 12, 12, 13, 16, 12, 15, 14, 15, 13, 12,
+ 16, 16, 16, 16, 16, 16, 15, 13, 9, 14, 11, 13, 10, 13, 11, 11,
+ 11, 16, 12, 14, 12, 14, 12, 12, 16, 16, 16, 16, 16, 16, 16, 13,
+ 10, 15, 11, 13, 11, 14, 12, 11, 11, 16, 12, 14, 11, 14, 12, 11,
+ 16, 16, 16, 16, 16, 16, 14, 12, 12, 16, 12, 14, 13, 15, 13, 12,
+ 12, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 16, 16, 16, 14, 12,
+ 12, 16, 13, 16, 11, 14, 12, 12, 14, 16, 14, 16, 12, 16, 13, 12,
+ 16, 16, 16, 16, 16, 16, 16, 13, 12, 16, 13, 16, 12, 16, 13, 12,
+ 12, 16, 13, 16, 12, 16, 12, 12, 16, 16, 16, 16, 14, 16, 14, 12,
+ 14, 16, 14, 16, 14, 16, 14, 13, 13, 16, 13, 16, 13, 16, 13, 12,
+ 16, 16, 13, 16, 13, 16, 12, 11, 9, 16, 12, 15, 13, 16, 13, 12,
+ 13, 16, 14, 16, 14, 16, 14, 13, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 16, 12, 15, 12, 15, 13, 12, 13, 16, 14, 16, 13, 16, 13, 12,
+ 16, 16, 16, 16, 16, 16, 16, 13, 12, 16, 12, 16, 13, 16, 13, 12,
+ 14, 16, 13, 16, 14, 16, 13, 12, 16, 16, 16, 16, 16, 16, 16, 13,
+ 11, 16, 12, 15, 12, 16, 13, 12, 14, 16, 14, 16, 13, 16, 13, 13,
+ 16, 16, 16, 16, 16, 16, 15, 13, 11, 16, 12, 16, 12, 16, 13, 12,
+ 13, 16, 13, 15, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 15, 13,
+ 12, 16, 12, 16, 13, 16, 13, 12, 13, 16, 12, 16, 13, 16, 13, 12,
+ 16, 16, 14, 16, 16, 16, 14, 12, 12, 16, 14, 16, 11, 16, 13, 12,
+ 14, 16, 14, 16, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 16, 13,
+ 12, 16, 13, 16, 12, 16, 13, 12, 13, 16, 13, 16, 12, 16, 13, 12,
+ 16, 16, 16, 16, 14, 16, 14, 12, 13, 16, 13, 16, 13, 16, 13, 13,
+ 13, 16, 12, 16, 12, 16, 12, 12, 14, 16, 13, 15, 13, 16, 12, 11,
+ },
+ },
};
-static const uint8_t rv34_table_intra_secondpat[NUM_INTRA_TABLES][2][OTHERBLK_VLC_SIZE] =
-{
- {
- {
- 0, 5, 10, 3, 6, 10, 7, 8, 9, 4, 6, 10, 6, 7, 9, 8,
- 8, 9, 8, 8, 9, 8, 9, 9, 9, 9, 8, 3, 6, 10, 4, 6,
- 10, 7, 7, 9, 5, 7, 10, 6, 7, 9, 7, 7, 8, 7, 8, 9,
- 8, 8, 9, 8, 8, 7, 6, 8, 10, 6, 8, 10, 7, 8, 9, 7,
- 8, 10, 7, 8, 10, 8, 8, 8, 8, 9, 9, 8, 8, 9, 9, 8,
- 7, 7, 8, 9, 7, 8, 9, 7, 7, 7, 8, 8, 9, 7, 8, 9,
- 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 6, 5,
- },
- {
- 0, 5, 11, 3, 6, 11, 8, 9, 11, 3, 6, 10, 6, 7, 11, 9,
- 9, 11, 7, 9, 11, 9, 9, 11, 10, 10, 11, 2, 6, 10, 4, 7,
- 10, 7, 9, 11, 4, 7, 11, 6, 7, 10, 9, 9, 11, 7, 9, 11,
- 8, 9, 10, 10, 10, 10, 5, 8, 11, 6, 8, 11, 8, 9, 11, 6,
- 8, 11, 7, 8, 11, 9, 9, 11, 8, 10, 11, 9, 9, 11, 10, 10,
- 10, 8, 9, 11, 8, 9, 11, 9, 9, 10, 8, 9, 11, 8, 9, 11,
- 9, 9, 10, 8, 9, 10, 9, 9, 10, 9, 9, 8,
- },
- },
- {
- {
- 0, 5, 10, 4, 6, 10, 7, 8, 10, 4, 6, 10, 6, 7, 9, 8,
- 8, 9, 8, 8, 9, 8, 9, 9, 9, 9, 9, 2, 6, 10, 4, 6,
- 10, 7, 7, 9, 5, 7, 10, 6, 7, 9, 7, 7, 9, 7, 8, 9,
- 8, 8, 9, 9, 8, 8, 6, 8, 10, 6, 8, 10, 7, 8, 9, 6,
- 8, 10, 7, 8, 10, 8, 8, 9, 8, 9, 10, 8, 8, 9, 9, 9,
- 8, 8, 8, 10, 7, 8, 9, 7, 8, 8, 7, 8, 10, 7, 8, 9,
- 7, 7, 8, 8, 8, 9, 8, 8, 8, 7, 7, 6,
- },
- {
- 0, 5, 12, 4, 7, 12, 8, 10, 13, 4, 7, 12, 6, 8, 12, 10,
- 10, 12, 8, 9, 12, 10, 10, 12, 12, 12, 12, 1, 6, 12, 4, 7,
- 12, 8, 9, 12, 4, 7, 12, 6, 8, 11, 9, 10, 12, 8, 9, 12,
- 9, 10, 11, 11, 11, 12, 6, 8, 12, 7, 9, 12, 9, 10, 13, 6,
- 9, 12, 8, 9, 12, 10, 10, 12, 9, 10, 12, 10, 10, 12, 12, 12,
- 12, 8, 10, 12, 9, 10, 12, 10, 10, 12, 8, 10, 12, 9, 10, 12,
- 10, 10, 11, 9, 10, 12, 10, 10, 11, 11, 10, 10,
- },
- },
- {
- {
- 0, 5, 10, 3, 6, 10, 7, 8, 11, 4, 6, 10, 6, 7, 10, 8,
- 9, 10, 8, 8, 10, 9, 9, 10, 10, 10, 10, 2, 6, 10, 4, 6,
- 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8, 8, 10, 7, 8, 10,
- 8, 8, 9, 10, 9, 9, 5, 8, 11, 6, 8, 10, 7, 9, 10, 6,
- 8, 11, 7, 8, 10, 8, 8, 10, 8, 9, 11, 9, 9, 10, 10, 9,
- 9, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 8, 10,
- 8, 8, 9, 8, 9, 10, 8, 8, 9, 9, 8, 8,
- },
- {
- 0, 6, 13, 4, 7, 14, 9, 11, 14, 3, 7, 13, 7, 8, 13, 11,
- 11, 14, 8, 10, 13, 10, 11, 13, 13, 13, 14, 1, 6, 12, 4, 8,
- 13, 9, 10, 15, 4, 8, 13, 7, 8, 12, 11, 11, 14, 8, 10, 13,
- 10, 10, 13, 13, 13, 14, 5, 9, 13, 7, 9, 13, 10, 11, 14, 6,
- 10, 14, 8, 10, 14, 11, 11, 14, 9, 11, 14, 11, 11, 13, 13, 13,
- 14, 9, 10, 14, 9, 11, 13, 11, 12, 14, 9, 11, 13, 9, 11, 14,
- 11, 12, 13, 10, 12, 15, 11, 11, 13, 13, 12, 13,
- },
- },
- {
- {
- 0, 5, 11, 3, 6, 11, 7, 9, 12, 3, 6, 11, 6, 7, 11, 9,
- 9, 11, 8, 9, 11, 9, 9, 11, 11, 11, 12, 2, 6, 11, 4, 6,
- 11, 7, 9, 11, 4, 7, 11, 5, 7, 10, 9, 9, 11, 7, 8, 11,
- 9, 9, 10, 11, 11, 11, 5, 8, 11, 6, 8, 11, 8, 9, 12, 6,
- 8, 11, 7, 8, 11, 9, 9, 11, 8, 9, 12, 9, 9, 11, 11, 11,
- 11, 8, 10, 12, 8, 10, 11, 9, 10, 12, 8, 10, 12, 8, 9, 12,
- 10, 10, 12, 9, 10, 12, 9, 9, 11, 11, 10, 11,
- },
- {
- 0, 6, 13, 3, 8, 14, 10, 12, 16, 3, 8, 15, 7, 9, 15, 12,
- 13, 15, 9, 11, 15, 11, 12, 16, 14, 16, 16, 1, 7, 13, 4, 8,
- 14, 9, 11, 15, 4, 8, 14, 7, 9, 14, 12, 13, 15, 8, 10, 14,
- 11, 11, 14, 16, 14, 16, 6, 9, 14, 7, 10, 14, 11, 13, 15, 7,
- 10, 14, 9, 10, 13, 12, 12, 15, 10, 11, 14, 11, 11, 14, 14, 14,
- 16, 9, 11, 14, 10, 11, 14, 13, 14, 15, 9, 12, 14, 10, 12, 16,
- 13, 14, 16, 10, 13, 16, 12, 12, 14, 15, 14, 15,
- },
- },
- {
- {
- 0, 6, 12, 3, 7, 12, 9, 11, 13, 4, 7, 12, 6, 8, 12, 10,
- 11, 13, 8, 10, 13, 10, 11, 13, 13, 13, 14, 1, 6, 12, 4, 7,
- 12, 9, 10, 14, 4, 7, 12, 6, 7, 12, 10, 11, 13, 8, 9, 13,
- 10, 10, 12, 13, 13, 14, 6, 9, 13, 7, 9, 13, 10, 12, 14, 7,
- 9, 13, 8, 10, 13, 11, 11, 14, 9, 11, 13, 11, 11, 14, 13, 13,
- 14, 10, 12, 14, 10, 12, 14, 12, 13, 15, 10, 12, 14, 10, 12, 14,
- 12, 13, 15, 11, 13, 15, 12, 12, 15, 14, 14, 14,
- },
- {
- 0, 6, 16, 3, 8, 16, 10, 13, 16, 3, 8, 16, 7, 9, 16, 13,
- 16, 16, 8, 10, 16, 11, 13, 16, 16, 16, 16, 1, 7, 14, 4, 8,
- 16, 10, 12, 16, 4, 8, 13, 7, 9, 16, 13, 14, 16, 8, 10, 16,
- 11, 11, 14, 16, 16, 16, 6, 9, 14, 8, 10, 14, 12, 16, 16, 6,
- 10, 13, 9, 11, 16, 13, 14, 16, 9, 12, 16, 12, 11, 16, 16, 16,
- 16, 10, 12, 16, 11, 12, 16, 16, 14, 16, 9, 12, 16, 11, 12, 16,
- 16, 15, 16, 10, 13, 16, 12, 13, 16, 16, 16, 16,
- },
- },
+static const uint8_t rv34_table_intra_secondpat[NUM_INTRA_TABLES][2][OTHERBLK_VLC_SIZE] = {
+ {
+ {
+ 0, 5, 10, 3, 6, 10, 7, 8, 9, 4, 6, 10, 6, 7, 9, 8,
+ 8, 9, 8, 8, 9, 8, 9, 9, 9, 9, 8, 3, 6, 10, 4, 6,
+ 10, 7, 7, 9, 5, 7, 10, 6, 7, 9, 7, 7, 8, 7, 8, 9,
+ 8, 8, 9, 8, 8, 7, 6, 8, 10, 6, 8, 10, 7, 8, 9, 7,
+ 8, 10, 7, 8, 10, 8, 8, 8, 8, 9, 9, 8, 8, 9, 9, 8,
+ 7, 7, 8, 9, 7, 8, 9, 7, 7, 7, 8, 8, 9, 7, 8, 9,
+ 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 6, 5,
+ },
+ {
+ 0, 5, 11, 3, 6, 11, 8, 9, 11, 3, 6, 10, 6, 7, 11, 9,
+ 9, 11, 7, 9, 11, 9, 9, 11, 10, 10, 11, 2, 6, 10, 4, 7,
+ 10, 7, 9, 11, 4, 7, 11, 6, 7, 10, 9, 9, 11, 7, 9, 11,
+ 8, 9, 10, 10, 10, 10, 5, 8, 11, 6, 8, 11, 8, 9, 11, 6,
+ 8, 11, 7, 8, 11, 9, 9, 11, 8, 10, 11, 9, 9, 11, 10, 10,
+ 10, 8, 9, 11, 8, 9, 11, 9, 9, 10, 8, 9, 11, 8, 9, 11,
+ 9, 9, 10, 8, 9, 10, 9, 9, 10, 9, 9, 8,
+ },
+ },
+ {
+ {
+ 0, 5, 10, 4, 6, 10, 7, 8, 10, 4, 6, 10, 6, 7, 9, 8,
+ 8, 9, 8, 8, 9, 8, 9, 9, 9, 9, 9, 2, 6, 10, 4, 6,
+ 10, 7, 7, 9, 5, 7, 10, 6, 7, 9, 7, 7, 9, 7, 8, 9,
+ 8, 8, 9, 9, 8, 8, 6, 8, 10, 6, 8, 10, 7, 8, 9, 6,
+ 8, 10, 7, 8, 10, 8, 8, 9, 8, 9, 10, 8, 8, 9, 9, 9,
+ 8, 8, 8, 10, 7, 8, 9, 7, 8, 8, 7, 8, 10, 7, 8, 9,
+ 7, 7, 8, 8, 8, 9, 8, 8, 8, 7, 7, 6,
+ },
+ {
+ 0, 5, 12, 4, 7, 12, 8, 10, 13, 4, 7, 12, 6, 8, 12, 10,
+ 10, 12, 8, 9, 12, 10, 10, 12, 12, 12, 12, 1, 6, 12, 4, 7,
+ 12, 8, 9, 12, 4, 7, 12, 6, 8, 11, 9, 10, 12, 8, 9, 12,
+ 9, 10, 11, 11, 11, 12, 6, 8, 12, 7, 9, 12, 9, 10, 13, 6,
+ 9, 12, 8, 9, 12, 10, 10, 12, 9, 10, 12, 10, 10, 12, 12, 12,
+ 12, 8, 10, 12, 9, 10, 12, 10, 10, 12, 8, 10, 12, 9, 10, 12,
+ 10, 10, 11, 9, 10, 12, 10, 10, 11, 11, 10, 10,
+ },
+ },
+ {
+ {
+ 0, 5, 10, 3, 6, 10, 7, 8, 11, 4, 6, 10, 6, 7, 10, 8,
+ 9, 10, 8, 8, 10, 9, 9, 10, 10, 10, 10, 2, 6, 10, 4, 6,
+ 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8, 8, 10, 7, 8, 10,
+ 8, 8, 9, 10, 9, 9, 5, 8, 11, 6, 8, 10, 7, 9, 10, 6,
+ 8, 11, 7, 8, 10, 8, 8, 10, 8, 9, 11, 9, 9, 10, 10, 9,
+ 9, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 8, 10,
+ 8, 8, 9, 8, 9, 10, 8, 8, 9, 9, 8, 8,
+ },
+ {
+ 0, 6, 13, 4, 7, 14, 9, 11, 14, 3, 7, 13, 7, 8, 13, 11,
+ 11, 14, 8, 10, 13, 10, 11, 13, 13, 13, 14, 1, 6, 12, 4, 8,
+ 13, 9, 10, 15, 4, 8, 13, 7, 8, 12, 11, 11, 14, 8, 10, 13,
+ 10, 10, 13, 13, 13, 14, 5, 9, 13, 7, 9, 13, 10, 11, 14, 6,
+ 10, 14, 8, 10, 14, 11, 11, 14, 9, 11, 14, 11, 11, 13, 13, 13,
+ 14, 9, 10, 14, 9, 11, 13, 11, 12, 14, 9, 11, 13, 9, 11, 14,
+ 11, 12, 13, 10, 12, 15, 11, 11, 13, 13, 12, 13,
+ },
+ },
+ {
+ {
+ 0, 5, 11, 3, 6, 11, 7, 9, 12, 3, 6, 11, 6, 7, 11, 9,
+ 9, 11, 8, 9, 11, 9, 9, 11, 11, 11, 12, 2, 6, 11, 4, 6,
+ 11, 7, 9, 11, 4, 7, 11, 5, 7, 10, 9, 9, 11, 7, 8, 11,
+ 9, 9, 10, 11, 11, 11, 5, 8, 11, 6, 8, 11, 8, 9, 12, 6,
+ 8, 11, 7, 8, 11, 9, 9, 11, 8, 9, 12, 9, 9, 11, 11, 11,
+ 11, 8, 10, 12, 8, 10, 11, 9, 10, 12, 8, 10, 12, 8, 9, 12,
+ 10, 10, 12, 9, 10, 12, 9, 9, 11, 11, 10, 11,
+ },
+ {
+ 0, 6, 13, 3, 8, 14, 10, 12, 16, 3, 8, 15, 7, 9, 15, 12,
+ 13, 15, 9, 11, 15, 11, 12, 16, 14, 16, 16, 1, 7, 13, 4, 8,
+ 14, 9, 11, 15, 4, 8, 14, 7, 9, 14, 12, 13, 15, 8, 10, 14,
+ 11, 11, 14, 16, 14, 16, 6, 9, 14, 7, 10, 14, 11, 13, 15, 7,
+ 10, 14, 9, 10, 13, 12, 12, 15, 10, 11, 14, 11, 11, 14, 14, 14,
+ 16, 9, 11, 14, 10, 11, 14, 13, 14, 15, 9, 12, 14, 10, 12, 16,
+ 13, 14, 16, 10, 13, 16, 12, 12, 14, 15, 14, 15,
+ },
+ },
+ {
+ {
+ 0, 6, 12, 3, 7, 12, 9, 11, 13, 4, 7, 12, 6, 8, 12, 10,
+ 11, 13, 8, 10, 13, 10, 11, 13, 13, 13, 14, 1, 6, 12, 4, 7,
+ 12, 9, 10, 14, 4, 7, 12, 6, 7, 12, 10, 11, 13, 8, 9, 13,
+ 10, 10, 12, 13, 13, 14, 6, 9, 13, 7, 9, 13, 10, 12, 14, 7,
+ 9, 13, 8, 10, 13, 11, 11, 14, 9, 11, 13, 11, 11, 14, 13, 13,
+ 14, 10, 12, 14, 10, 12, 14, 12, 13, 15, 10, 12, 14, 10, 12, 14,
+ 12, 13, 15, 11, 13, 15, 12, 12, 15, 14, 14, 14,
+ },
+ {
+ 0, 6, 16, 3, 8, 16, 10, 13, 16, 3, 8, 16, 7, 9, 16, 13,
+ 16, 16, 8, 10, 16, 11, 13, 16, 16, 16, 16, 1, 7, 14, 4, 8,
+ 16, 10, 12, 16, 4, 8, 13, 7, 9, 16, 13, 14, 16, 8, 10, 16,
+ 11, 11, 14, 16, 16, 16, 6, 9, 14, 8, 10, 14, 12, 16, 16, 6,
+ 10, 13, 9, 11, 16, 13, 14, 16, 9, 12, 16, 12, 11, 16, 16, 16,
+ 16, 10, 12, 16, 11, 12, 16, 16, 14, 16, 9, 12, 16, 11, 12, 16,
+ 16, 15, 16, 10, 13, 16, 12, 13, 16, 16, 16, 16,
+ },
+ },
};
-static const uint8_t rv34_table_intra_thirdpat[NUM_INTRA_TABLES][2][OTHERBLK_VLC_SIZE] =
-{
- {
- {
- 0, 5, 10, 3, 6, 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8,
- 8, 10, 8, 9, 10, 9, 9, 10, 9, 9, 9, 2, 6, 10, 4, 7,
- 10, 7, 8, 9, 5, 7, 10, 6, 7, 10, 8, 8, 9, 8, 9, 10,
- 8, 8, 9, 9, 9, 8, 6, 8, 11, 6, 8, 10, 7, 8, 10, 6,
- 8, 11, 7, 8, 10, 8, 8, 9, 8, 9, 10, 9, 9, 10, 9, 9,
- 9, 7, 8, 10, 7, 8, 10, 7, 8, 8, 7, 8, 10, 7, 8, 9,
- 7, 8, 8, 8, 8, 9, 8, 8, 8, 7, 7, 7,
- },
- {
- 0, 4, 10, 3, 6, 10, 7, 8, 11, 3, 6, 10, 5, 7, 10, 9,
- 9, 11, 9, 10, 11, 9, 10, 11, 11, 11, 11, 2, 6, 10, 4, 6,
- 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8, 9, 10, 8, 9, 11,
- 9, 9, 11, 10, 10, 11, 6, 8, 11, 6, 8, 11, 8, 9, 11, 7,
- 9, 11, 7, 8, 11, 9, 9, 11, 9, 10, 12, 10, 10, 12, 11, 11,
- 11, 8, 9, 11, 8, 9, 11, 9, 9, 11, 9, 10, 11, 9, 10, 11,
- 9, 10, 11, 10, 11, 12, 10, 10, 12, 10, 10, 10,
- },
- },
- {
- {
- 0, 5, 10, 3, 6, 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8,
- 9, 10, 8, 9, 11, 8, 9, 10, 10, 10, 10, 2, 6, 10, 4, 6,
- 10, 7, 8, 10, 4, 7, 10, 5, 7, 10, 8, 8, 10, 8, 9, 10,
- 8, 9, 10, 9, 9, 9, 5, 7, 11, 6, 8, 11, 7, 8, 11, 6,
- 8, 11, 7, 8, 10, 8, 9, 10, 8, 9, 11, 9, 9, 10, 10, 9,
- 10, 7, 8, 10, 7, 8, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10,
- 8, 8, 10, 9, 9, 10, 9, 9, 10, 9, 9, 9,
- },
- {
- 0, 5, 11, 3, 6, 11, 8, 9, 12, 4, 7, 12, 6, 7, 12, 9,
- 10, 13, 10, 11, 13, 10, 11, 14, 12, 13, 14, 1, 6, 11, 4, 7,
- 11, 8, 9, 12, 5, 7, 11, 6, 8, 12, 9, 10, 13, 10, 11, 14,
- 10, 11, 13, 12, 12, 14, 6, 8, 12, 7, 9, 13, 9, 10, 14, 7,
- 10, 13, 8, 10, 12, 11, 11, 13, 11, 13, 14, 11, 12, 14, 13, 13,
- 15, 9, 10, 12, 9, 11, 14, 10, 11, 14, 11, 11, 13, 10, 11, 13,
- 11, 12, 14, 12, 14, 15, 13, 13, 14, 13, 13, 14,
- },
- },
- {
- {
- 0, 5, 11, 3, 6, 11, 7, 9, 11, 4, 6, 11, 5, 7, 10, 9,
- 9, 11, 8, 9, 11, 9, 10, 11, 11, 11, 11, 2, 6, 10, 3, 6,
- 10, 7, 9, 11, 4, 7, 10, 5, 7, 10, 8, 9, 11, 8, 9, 11,
- 9, 9, 11, 11, 11, 11, 5, 8, 11, 6, 8, 11, 8, 10, 12, 6,
- 8, 11, 7, 8, 11, 9, 10, 11, 9, 10, 12, 9, 10, 11, 11, 11,
- 11, 8, 9, 11, 8, 10, 12, 9, 11, 12, 8, 10, 12, 9, 10, 12,
- 10, 11, 12, 10, 11, 12, 10, 10, 11, 11, 11, 11,
- },
- {
- 0, 5, 13, 2, 7, 16, 9, 11, 16, 4, 8, 16, 7, 9, 16, 12,
- 12, 16, 12, 16, 16, 12, 16, 16, 16, 16, 16, 1, 6, 13, 4, 8,
- 16, 9, 11, 16, 6, 9, 16, 7, 10, 16, 13, 13, 16, 13, 15, 16,
- 12, 16, 16, 16, 16, 16, 7, 9, 16, 8, 11, 15, 11, 13, 16, 10,
- 12, 16, 10, 12, 16, 16, 13, 16, 16, 16, 16, 14, 16, 16, 16, 16,
- 16, 12, 12, 16, 12, 16, 16, 16, 16, 16, 13, 14, 16, 12, 13, 16,
- 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 6, 11, 3, 7, 11, 8, 10, 12, 4, 7, 11, 6, 8, 11, 10,
- 11, 12, 9, 10, 12, 10, 10, 12, 12, 12, 13, 1, 6, 11, 4, 7,
- 11, 8, 10, 12, 4, 7, 11, 6, 8, 11, 10, 10, 12, 9, 10, 12,
- 10, 10, 12, 13, 13, 13, 6, 8, 12, 7, 10, 12, 10, 12, 13, 7,
- 9, 12, 8, 10, 12, 11, 11, 13, 11, 12, 14, 11, 11, 13, 13, 13,
- 13, 9, 11, 13, 10, 12, 14, 12, 13, 15, 10, 12, 14, 11, 12, 14,
- 13, 13, 14, 12, 13, 15, 13, 13, 14, 14, 14, 14,
- },
- {
- 0, 5, 16, 2, 6, 16, 10, 14, 16, 4, 8, 16, 7, 9, 16, 11,
- 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 1, 6, 12, 4, 8,
- 12, 12, 12, 16, 6, 8, 16, 8, 10, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 12, 16, 16, 7, 10, 16, 8, 11, 14, 16, 16, 16, 10,
- 12, 16, 10, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 5, 11, 3, 6, 11, 10, 10, 12, 3, 7, 11, 6, 8, 11, 11,
- 11, 12, 10, 10, 12, 11, 11, 13, 14, 13, 14, 1, 6, 11, 4, 7,
- 11, 10, 11, 13, 5, 7, 11, 7, 8, 11, 11, 11, 13, 10, 11, 13,
- 11, 11, 12, 13, 13, 14, 7, 10, 12, 9, 11, 13, 12, 13, 14, 9,
- 10, 13, 9, 10, 13, 12, 11, 13, 12, 13, 16, 12, 13, 13, 14, 14,
- 14, 11, 14, 16, 12, 14, 15, 14, 13, 16, 13, 13, 15, 13, 14, 16,
- 14, 13, 16, 13, 13, 16, 13, 14, 15, 15, 14, 15,
- },
- {
- 0, 4, 16, 2, 7, 16, 10, 16, 16, 4, 10, 16, 7, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 6, 13, 4, 11,
- 16, 16, 16, 16, 6, 10, 16, 8, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 8, 16, 16, 10, 16, 16, 16, 16, 16, 10,
- 16, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
+static const uint8_t rv34_table_intra_thirdpat[NUM_INTRA_TABLES][2][OTHERBLK_VLC_SIZE] = {
+ {
+ {
+ 0, 5, 10, 3, 6, 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8,
+ 8, 10, 8, 9, 10, 9, 9, 10, 9, 9, 9, 2, 6, 10, 4, 7,
+ 10, 7, 8, 9, 5, 7, 10, 6, 7, 10, 8, 8, 9, 8, 9, 10,
+ 8, 8, 9, 9, 9, 8, 6, 8, 11, 6, 8, 10, 7, 8, 10, 6,
+ 8, 11, 7, 8, 10, 8, 8, 9, 8, 9, 10, 9, 9, 10, 9, 9,
+ 9, 7, 8, 10, 7, 8, 10, 7, 8, 8, 7, 8, 10, 7, 8, 9,
+ 7, 8, 8, 8, 8, 9, 8, 8, 8, 7, 7, 7,
+ },
+ {
+ 0, 4, 10, 3, 6, 10, 7, 8, 11, 3, 6, 10, 5, 7, 10, 9,
+ 9, 11, 9, 10, 11, 9, 10, 11, 11, 11, 11, 2, 6, 10, 4, 6,
+ 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8, 9, 10, 8, 9, 11,
+ 9, 9, 11, 10, 10, 11, 6, 8, 11, 6, 8, 11, 8, 9, 11, 7,
+ 9, 11, 7, 8, 11, 9, 9, 11, 9, 10, 12, 10, 10, 12, 11, 11,
+ 11, 8, 9, 11, 8, 9, 11, 9, 9, 11, 9, 10, 11, 9, 10, 11,
+ 9, 10, 11, 10, 11, 12, 10, 10, 12, 10, 10, 10,
+ },
+ },
+ {
+ {
+ 0, 5, 10, 3, 6, 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8,
+ 9, 10, 8, 9, 11, 8, 9, 10, 10, 10, 10, 2, 6, 10, 4, 6,
+ 10, 7, 8, 10, 4, 7, 10, 5, 7, 10, 8, 8, 10, 8, 9, 10,
+ 8, 9, 10, 9, 9, 9, 5, 7, 11, 6, 8, 11, 7, 8, 11, 6,
+ 8, 11, 7, 8, 10, 8, 9, 10, 8, 9, 11, 9, 9, 10, 10, 9,
+ 10, 7, 8, 10, 7, 8, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10,
+ 8, 8, 10, 9, 9, 10, 9, 9, 10, 9, 9, 9,
+ },
+ {
+ 0, 5, 11, 3, 6, 11, 8, 9, 12, 4, 7, 12, 6, 7, 12, 9,
+ 10, 13, 10, 11, 13, 10, 11, 14, 12, 13, 14, 1, 6, 11, 4, 7,
+ 11, 8, 9, 12, 5, 7, 11, 6, 8, 12, 9, 10, 13, 10, 11, 14,
+ 10, 11, 13, 12, 12, 14, 6, 8, 12, 7, 9, 13, 9, 10, 14, 7,
+ 10, 13, 8, 10, 12, 11, 11, 13, 11, 13, 14, 11, 12, 14, 13, 13,
+ 15, 9, 10, 12, 9, 11, 14, 10, 11, 14, 11, 11, 13, 10, 11, 13,
+ 11, 12, 14, 12, 14, 15, 13, 13, 14, 13, 13, 14,
+ },
+ },
+ {
+ {
+ 0, 5, 11, 3, 6, 11, 7, 9, 11, 4, 6, 11, 5, 7, 10, 9,
+ 9, 11, 8, 9, 11, 9, 10, 11, 11, 11, 11, 2, 6, 10, 3, 6,
+ 10, 7, 9, 11, 4, 7, 10, 5, 7, 10, 8, 9, 11, 8, 9, 11,
+ 9, 9, 11, 11, 11, 11, 5, 8, 11, 6, 8, 11, 8, 10, 12, 6,
+ 8, 11, 7, 8, 11, 9, 10, 11, 9, 10, 12, 9, 10, 11, 11, 11,
+ 11, 8, 9, 11, 8, 10, 12, 9, 11, 12, 8, 10, 12, 9, 10, 12,
+ 10, 11, 12, 10, 11, 12, 10, 10, 11, 11, 11, 11,
+ },
+ {
+ 0, 5, 13, 2, 7, 16, 9, 11, 16, 4, 8, 16, 7, 9, 16, 12,
+ 12, 16, 12, 16, 16, 12, 16, 16, 16, 16, 16, 1, 6, 13, 4, 8,
+ 16, 9, 11, 16, 6, 9, 16, 7, 10, 16, 13, 13, 16, 13, 15, 16,
+ 12, 16, 16, 16, 16, 16, 7, 9, 16, 8, 11, 15, 11, 13, 16, 10,
+ 12, 16, 10, 12, 16, 16, 13, 16, 16, 16, 16, 14, 16, 16, 16, 16,
+ 16, 12, 12, 16, 12, 16, 16, 16, 16, 16, 13, 14, 16, 12, 13, 16,
+ 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 6, 11, 3, 7, 11, 8, 10, 12, 4, 7, 11, 6, 8, 11, 10,
+ 11, 12, 9, 10, 12, 10, 10, 12, 12, 12, 13, 1, 6, 11, 4, 7,
+ 11, 8, 10, 12, 4, 7, 11, 6, 8, 11, 10, 10, 12, 9, 10, 12,
+ 10, 10, 12, 13, 13, 13, 6, 8, 12, 7, 10, 12, 10, 12, 13, 7,
+ 9, 12, 8, 10, 12, 11, 11, 13, 11, 12, 14, 11, 11, 13, 13, 13,
+ 13, 9, 11, 13, 10, 12, 14, 12, 13, 15, 10, 12, 14, 11, 12, 14,
+ 13, 13, 14, 12, 13, 15, 13, 13, 14, 14, 14, 14,
+ },
+ {
+ 0, 5, 16, 2, 6, 16, 10, 14, 16, 4, 8, 16, 7, 9, 16, 11,
+ 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 1, 6, 12, 4, 8,
+ 12, 12, 12, 16, 6, 8, 16, 8, 10, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 12, 16, 16, 7, 10, 16, 8, 11, 14, 16, 16, 16, 10,
+ 12, 16, 10, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 5, 11, 3, 6, 11, 10, 10, 12, 3, 7, 11, 6, 8, 11, 11,
+ 11, 12, 10, 10, 12, 11, 11, 13, 14, 13, 14, 1, 6, 11, 4, 7,
+ 11, 10, 11, 13, 5, 7, 11, 7, 8, 11, 11, 11, 13, 10, 11, 13,
+ 11, 11, 12, 13, 13, 14, 7, 10, 12, 9, 11, 13, 12, 13, 14, 9,
+ 10, 13, 9, 10, 13, 12, 11, 13, 12, 13, 16, 12, 13, 13, 14, 14,
+ 14, 11, 14, 16, 12, 14, 15, 14, 13, 16, 13, 13, 15, 13, 14, 16,
+ 14, 13, 16, 13, 13, 16, 13, 14, 15, 15, 14, 15,
+ },
+ {
+ 0, 4, 16, 2, 7, 16, 10, 16, 16, 4, 10, 16, 7, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 6, 13, 4, 11,
+ 16, 16, 16, 16, 6, 10, 16, 8, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 8, 16, 16, 10, 16, 16, 16, 16, 16, 10,
+ 16, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
};
-static const uint8_t rv34_intra_coeff[NUM_INTRA_TABLES][COEFF_VLC_SIZE] =
+static const uint8_t rv34_intra_coeff[NUM_INTRA_TABLES][COEFF_VLC_SIZE] = {
{
- {
- 1, 3, 3, 4, 4, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9,
- 9, 9, 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 13, 14, 15, 15,
- },
- {
- 1, 2, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 10, 11,
- 11, 11, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 10, 10, 11, 12, 12, 12,
- 13, 13, 14, 14, 14, 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 10, 10, 11, 12, 12, 12,
- 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 14, 12, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 7, 7, 8, 8, 9, 10, 10, 12, 11, 13, 12,
- 15, 13, 14, 13, 12, 15, 14, 13, 12, 12, 10, 11, 16, 16, 16, 16,
- }
+ 1, 3, 3, 4, 4, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9,
+ 9, 9, 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 13, 14, 15, 15,
+},
+{
+ 1, 2, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 10, 11,
+ 11, 11, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 10, 10, 11, 12, 12, 12,
+ 13, 13, 14, 14, 14, 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 10, 10, 11, 12, 12, 12,
+ 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 14, 12, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 7, 7, 8, 8, 9, 10, 10, 12, 11, 13, 12,
+ 15, 13, 14, 13, 12, 15, 14, 13, 12, 12, 10, 11, 16, 16, 16, 16,
+}
};
-static const uint8_t rv34_inter_cbppat[NUM_INTER_TABLES][CBPPAT_VLC_SIZE] =
+static const uint8_t rv34_inter_cbppat[NUM_INTER_TABLES][CBPPAT_VLC_SIZE] = {
{
- {
- 7, 9, 9, 8, 9, 8, 9, 8, 9, 9, 8, 8, 8, 8, 8, 4,
- 7, 10, 11, 10, 11, 10, 12, 10, 12, 11, 11, 10, 11, 10, 10, 7,
- 10, 11, 15, 12, 15, 12, 15, 12, 15, 14, 14, 12, 14, 12, 14, 9,
- 7, 11, 10, 10, 12, 11, 11, 10, 11, 12, 10, 10, 11, 10, 10, 7,
- 8, 12, 12, 11, 13, 12, 12, 10, 13, 13, 12, 10, 12, 11, 11, 7,
- 11, 13, 15, 11, 15, 13, 15, 12, 16, 14, 14, 12, 15, 13, 13, 9,
- 10, 15, 11, 12, 15, 14, 14, 12, 15, 15, 12, 12, 14, 14, 12, 9,
- 11, 15, 13, 12, 16, 15, 14, 12, 15, 15, 13, 12, 15, 14, 13, 9,
- 13, 15, 14, 10, 16, 15, 16, 11, 16, 16, 15, 12, 16, 15, 15, 9,
- 7, 11, 11, 11, 11, 10, 11, 10, 11, 12, 11, 10, 10, 10, 10, 7,
- 9, 12, 13, 12, 12, 11, 13, 10, 13, 13, 12, 11, 12, 10, 11, 7,
- 12, 13, 16, 14, 15, 12, 16, 12, 16, 15, 15, 13, 15, 12, 14, 9,
- 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 7,
- 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 13, 11, 12, 11, 11, 7,
- 12, 14, 15, 13, 16, 13, 15, 11, 16, 14, 15, 12, 15, 12, 13, 8,
- 12, 16, 14, 14, 16, 15, 15, 13, 16, 15, 14, 13, 15, 14, 13, 9,
- 12, 15, 14, 13, 15, 14, 15, 12, 16, 15, 14, 12, 14, 13, 13, 8,
- 13, 16, 16, 12, 16, 14, 16, 11, 16, 16, 15, 12, 16, 14, 14, 8,
- 10, 15, 15, 15, 12, 12, 14, 12, 14, 15, 15, 14, 12, 12, 13, 9,
- 11, 15, 16, 14, 13, 12, 15, 12, 16, 15, 15, 14, 14, 12, 13, 9,
- 14, 15, 16, 16, 15, 11, 16, 12, 16, 16, 16, 15, 16, 12, 15, 9,
- 12, 16, 16, 15, 14, 14, 14, 13, 16, 16, 15, 14, 14, 13, 13, 9,
- 12, 15, 15, 14, 14, 13, 15, 12, 16, 15, 14, 13, 14, 13, 13, 8,
- 13, 16, 16, 15, 16, 12, 16, 11, 16, 16, 16, 14, 16, 13, 14, 8,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 15, 16, 15, 14, 11,
- 13, 16, 16, 15, 16, 15, 15, 12, 16, 16, 16, 14, 15, 14, 14, 9,
- 14, 16, 16, 13, 16, 14, 16, 10, 16, 16, 16, 13, 16, 14, 14, 8,
- 7, 12, 11, 11, 11, 11, 12, 10, 11, 11, 10, 10, 10, 10, 10, 7,
- 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 8,
- 12, 14, 16, 14, 16, 14, 16, 13, 16, 14, 15, 13, 15, 13, 14, 9,
- 9, 13, 12, 12, 13, 12, 13, 11, 12, 13, 11, 10, 12, 11, 11, 7,
- 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 7,
- 12, 14, 16, 13, 16, 14, 15, 12, 15, 15, 14, 12, 15, 13, 13, 8,
- 11, 15, 13, 14, 15, 15, 14, 13, 15, 15, 12, 12, 14, 14, 12, 9,
- 11, 15, 14, 13, 15, 14, 14, 12, 15, 14, 13, 11, 14, 13, 12, 8,
- 13, 16, 15, 12, 16, 15, 16, 12, 16, 16, 14, 11, 15, 14, 14, 8,
- 8, 13, 13, 12, 12, 12, 13, 11, 12, 13, 12, 11, 11, 10, 10, 7,
- 9, 13, 14, 12, 13, 12, 13, 11, 13, 13, 13, 11, 12, 11, 11, 7,
- 12, 14, 16, 14, 15, 13, 15, 12, 15, 15, 15, 13, 14, 12, 13, 8,
- 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 7,
- 9, 13, 12, 12, 13, 12, 12, 10, 13, 13, 12, 10, 12, 10, 10, 6,
- 11, 14, 14, 12, 14, 12, 14, 11, 14, 14, 13, 11, 13, 11, 12, 7,
- 12, 16, 14, 14, 15, 15, 14, 13, 15, 15, 13, 12, 14, 13, 12, 8,
- 11, 14, 13, 12, 14, 13, 13, 11, 14, 14, 13, 11, 13, 12, 11, 7,
- 11, 14, 14, 12, 15, 13, 14, 11, 15, 14, 13, 11, 14, 12, 12, 6,
- 11, 16, 15, 15, 13, 14, 15, 13, 14, 15, 15, 13, 12, 12, 12, 9,
- 12, 15, 15, 14, 14, 13, 15, 12, 15, 15, 14, 13, 13, 11, 12, 8,
- 13, 16, 16, 15, 16, 13, 16, 13, 16, 16, 15, 14, 14, 12, 14, 8,
- 11, 16, 15, 14, 14, 14, 14, 13, 15, 15, 14, 13, 13, 12, 12, 8,
- 11, 14, 14, 13, 13, 12, 14, 11, 14, 14, 13, 12, 12, 11, 11, 7,
- 12, 14, 15, 13, 14, 12, 14, 11, 15, 14, 14, 12, 13, 11, 12, 7,
- 13, 16, 16, 16, 16, 15, 16, 14, 16, 16, 15, 14, 15, 14, 13, 9,
- 12, 15, 14, 13, 15, 13, 14, 12, 15, 15, 13, 12, 13, 12, 12, 7,
- 11, 15, 14, 12, 14, 13, 14, 10, 15, 14, 13, 11, 13, 11, 11, 5,
- 10, 15, 15, 15, 15, 14, 15, 13, 12, 14, 12, 12, 12, 13, 12, 9,
- 12, 16, 16, 15, 16, 15, 16, 14, 14, 15, 14, 13, 14, 13, 13, 9,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 11,
- 11, 15, 15, 14, 15, 15, 15, 14, 14, 15, 12, 12, 13, 13, 12, 9,
- 12, 15, 15, 14, 16, 14, 15, 13, 14, 14, 13, 12, 14, 13, 12, 8,
- 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 15, 12, 16, 14, 14, 9,
- 13, 16, 14, 16, 16, 16, 16, 15, 15, 16, 11, 12, 16, 15, 12, 9,
- 13, 16, 15, 14, 16, 15, 16, 14, 15, 16, 12, 11, 15, 14, 13, 8,
- 13, 16, 16, 13, 16, 16, 16, 13, 16, 16, 13, 11, 16, 14, 14, 8,
- 11, 15, 15, 15, 14, 14, 15, 13, 13, 15, 14, 13, 12, 12, 12, 9,
- 11, 15, 16, 14, 15, 14, 15, 13, 14, 14, 14, 13, 13, 12, 13, 8,
- 13, 16, 16, 16, 16, 15, 16, 14, 16, 16, 16, 13, 15, 12, 14, 9,
- 11, 16, 15, 14, 14, 14, 15, 13, 14, 14, 13, 12, 13, 12, 11, 8,
- 11, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 12, 11, 11, 7,
- 12, 15, 15, 13, 15, 14, 15, 12, 15, 14, 14, 11, 13, 12, 12, 7,
- 13, 16, 15, 15, 16, 16, 16, 14, 15, 16, 12, 12, 14, 14, 12, 8,
- 11, 15, 14, 13, 15, 13, 14, 12, 14, 14, 12, 11, 13, 12, 11, 6,
- 11, 14, 14, 12, 15, 13, 14, 11, 15, 14, 12, 10, 13, 11, 11, 5,
- 12, 16, 16, 16, 15, 15, 16, 15, 14, 16, 15, 15, 10, 12, 12, 9,
- 13, 16, 16, 16, 15, 14, 16, 13, 15, 15, 15, 14, 12, 11, 13, 8,
- 14, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 14, 14, 11, 14, 8,
- 13, 16, 16, 15, 15, 15, 15, 14, 15, 16, 14, 13, 12, 12, 11, 8,
- 11, 15, 15, 13, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 6,
- 11, 15, 15, 13, 15, 12, 14, 11, 14, 14, 13, 11, 12, 10, 11, 5,
- 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 14, 14, 13, 11, 8,
- 11, 14, 14, 13, 14, 13, 14, 11, 14, 14, 12, 11, 12, 11, 10, 5,
- 10, 13, 13, 11, 13, 12, 13, 9, 13, 13, 12, 9, 12, 10, 10, 3,
- },
- {
- 5, 7, 7, 7, 7, 7, 8, 7, 7, 8, 7, 7, 7, 7, 7, 4,
- 7, 9, 11, 9, 11, 9, 11, 9, 11, 10, 10, 9, 10, 9, 10, 6,
- 11, 11, 14, 11, 14, 11, 14, 11, 15, 13, 14, 12, 14, 12, 13, 9,
- 6, 11, 10, 9, 11, 10, 11, 9, 11, 11, 9, 9, 10, 10, 9, 6,
- 8, 11, 11, 10, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11, 7,
- 11, 13, 14, 11, 15, 13, 15, 11, 15, 14, 14, 12, 14, 13, 13, 9,
- 10, 14, 11, 11, 15, 14, 13, 12, 14, 14, 11, 11, 14, 13, 12, 9,
- 11, 14, 13, 11, 15, 14, 14, 11, 15, 15, 13, 11, 14, 14, 13, 9,
- 12, 14, 14, 10, 16, 15, 16, 11, 16, 16, 15, 11, 16, 15, 14, 9,
- 6, 10, 11, 10, 10, 9, 11, 9, 10, 11, 10, 10, 9, 9, 9, 6,
- 9, 12, 12, 11, 12, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11, 7,
- 12, 13, 15, 13, 14, 11, 15, 11, 15, 15, 14, 13, 14, 12, 14, 9,
- 9, 12, 12, 11, 12, 11, 12, 11, 12, 13, 11, 11, 12, 11, 11, 7,
- 9, 12, 12, 11, 13, 11, 12, 10, 13, 13, 12, 11, 12, 11, 11, 7,
- 12, 14, 15, 12, 15, 12, 14, 11, 15, 15, 14, 12, 14, 13, 13, 8,
- 12, 15, 14, 13, 15, 14, 14, 13, 16, 16, 14, 13, 15, 14, 13, 9,
- 12, 15, 14, 13, 15, 14, 14, 12, 15, 15, 13, 12, 14, 13, 13, 9,
- 13, 15, 15, 12, 16, 14, 15, 11, 16, 16, 15, 12, 15, 14, 14, 9,
- 10, 14, 14, 14, 12, 11, 13, 12, 14, 15, 14, 13, 12, 11, 12, 9,
- 12, 14, 15, 14, 13, 11, 14, 12, 15, 15, 15, 14, 13, 11, 13, 9,
- 13, 15, 16, 15, 14, 11, 16, 11, 16, 16, 16, 14, 15, 12, 15, 9,
- 12, 15, 15, 14, 14, 14, 14, 13, 15, 15, 14, 14, 14, 13, 13, 9,
- 12, 15, 15, 14, 14, 13, 14, 12, 15, 15, 14, 13, 14, 13, 13, 9,
- 13, 15, 16, 14, 15, 13, 16, 11, 16, 16, 15, 14, 15, 13, 14, 9,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 16, 16, 16, 14, 11,
- 14, 16, 16, 14, 16, 15, 15, 12, 16, 16, 16, 14, 15, 14, 14, 9,
- 14, 16, 16, 14, 16, 14, 16, 11, 16, 16, 16, 14, 16, 14, 14, 9,
- 6, 11, 10, 10, 10, 10, 11, 10, 10, 11, 9, 9, 9, 9, 9, 6,
- 9, 12, 12, 11, 13, 11, 13, 11, 12, 12, 11, 11, 12, 11, 11, 7,
- 12, 14, 16, 13, 16, 14, 16, 13, 15, 14, 15, 12, 15, 13, 14, 9,
- 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10, 7,
- 9, 12, 12, 11, 13, 12, 13, 11, 13, 12, 11, 10, 12, 11, 11, 7,
- 12, 14, 15, 12, 15, 14, 15, 12, 15, 14, 14, 12, 14, 13, 13, 9,
- 11, 15, 13, 13, 15, 14, 14, 13, 14, 15, 11, 11, 14, 14, 12, 9,
- 11, 14, 13, 12, 15, 14, 14, 12, 14, 14, 12, 11, 14, 13, 12, 8,
- 13, 15, 15, 12, 16, 15, 15, 12, 15, 15, 14, 11, 15, 14, 14, 8,
- 8, 12, 12, 11, 11, 11, 12, 11, 11, 12, 11, 11, 10, 10, 10, 7,
- 9, 13, 13, 12, 13, 11, 13, 11, 12, 13, 12, 11, 11, 10, 11, 7,
- 12, 14, 15, 14, 15, 13, 15, 12, 15, 14, 14, 13, 14, 12, 13, 9,
- 9, 13, 12, 12, 12, 12, 12, 11, 12, 13, 11, 11, 11, 11, 10, 7,
- 9, 12, 12, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10, 7,
- 11, 13, 14, 12, 14, 12, 14, 11, 14, 13, 13, 11, 13, 11, 12, 7,
- 12, 15, 14, 13, 15, 14, 14, 13, 15, 15, 13, 12, 13, 13, 12, 9,
- 11, 14, 13, 12, 14, 13, 13, 11, 14, 14, 12, 11, 13, 12, 11, 7,
- 11, 14, 14, 12, 14, 13, 14, 11, 14, 14, 13, 11, 13, 12, 12, 7,
- 11, 15, 15, 14, 13, 13, 14, 13, 14, 15, 14, 13, 11, 11, 12, 9,
- 12, 15, 15, 14, 14, 12, 14, 12, 14, 14, 14, 13, 12, 11, 12, 8,
- 13, 16, 16, 15, 15, 12, 16, 13, 16, 15, 15, 14, 14, 12, 14, 9,
- 12, 15, 15, 14, 14, 14, 14, 13, 15, 15, 14, 13, 12, 12, 12, 9,
- 11, 14, 14, 13, 13, 12, 13, 11, 14, 13, 13, 12, 12, 11, 11, 7,
- 12, 14, 15, 13, 14, 12, 14, 11, 15, 14, 13, 12, 13, 11, 12, 7,
- 13, 16, 16, 15, 16, 15, 15, 14, 16, 16, 15, 14, 14, 14, 12, 9,
- 12, 15, 14, 13, 14, 13, 14, 12, 15, 14, 13, 12, 13, 12, 12, 8,
- 12, 14, 14, 13, 15, 13, 14, 11, 14, 14, 13, 12, 13, 12, 12, 6,
- 10, 14, 14, 13, 14, 14, 14, 13, 12, 13, 12, 12, 12, 12, 11, 9,
- 12, 15, 15, 14, 15, 14, 16, 14, 14, 14, 13, 12, 14, 13, 13, 9,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 16, 11,
- 11, 15, 14, 14, 15, 14, 14, 14, 13, 14, 11, 12, 13, 13, 12, 9,
- 12, 15, 14, 14, 15, 14, 15, 13, 14, 14, 13, 12, 14, 13, 13, 9,
- 13, 16, 16, 14, 16, 15, 16, 14, 16, 15, 15, 12, 16, 14, 14, 9,
- 13, 16, 14, 15, 16, 16, 16, 14, 14, 16, 11, 12, 15, 14, 12, 9,
- 13, 16, 15, 14, 16, 15, 16, 14, 15, 15, 12, 11, 15, 14, 13, 9,
- 14, 16, 16, 13, 16, 16, 16, 14, 16, 15, 13, 11, 16, 14, 14, 9,
- 11, 15, 15, 14, 14, 14, 14, 13, 13, 14, 13, 13, 11, 11, 11, 9,
- 12, 15, 15, 14, 15, 14, 15, 13, 14, 14, 13, 13, 13, 12, 12, 9,
- 13, 16, 16, 16, 16, 14, 16, 14, 16, 15, 16, 14, 15, 12, 14, 9,
- 11, 15, 14, 14, 15, 14, 14, 13, 14, 14, 12, 12, 12, 12, 11, 8,
- 11, 14, 14, 13, 14, 13, 13, 12, 13, 13, 12, 11, 12, 11, 11, 7,
- 12, 14, 15, 13, 15, 13, 14, 13, 14, 14, 13, 12, 13, 12, 12, 8,
- 13, 16, 15, 15, 16, 15, 15, 14, 15, 16, 12, 12, 14, 14, 11, 9,
- 12, 15, 14, 13, 15, 13, 14, 12, 14, 14, 12, 11, 13, 12, 11, 7,
- 12, 14, 14, 13, 15, 13, 14, 12, 15, 14, 13, 10, 13, 12, 12, 6,
- 12, 16, 16, 15, 14, 14, 15, 14, 13, 15, 14, 14, 10, 11, 11, 9,
- 13, 16, 16, 15, 15, 14, 15, 14, 15, 15, 15, 14, 12, 11, 12, 8,
- 14, 16, 16, 16, 16, 14, 16, 14, 16, 15, 15, 14, 14, 11, 14, 8,
- 12, 16, 16, 15, 15, 14, 15, 14, 14, 16, 14, 14, 12, 12, 11, 8,
- 11, 14, 14, 13, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 7,
- 12, 14, 15, 13, 14, 13, 14, 12, 14, 14, 13, 12, 13, 11, 12, 6,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 14, 13, 13, 13, 11, 8,
- 12, 15, 15, 13, 15, 13, 14, 12, 14, 14, 13, 12, 13, 12, 10, 6,
- 11, 14, 13, 12, 14, 12, 13, 10, 14, 13, 12, 10, 12, 10, 10, 4,
- },
- {
- 4, 6, 6, 6, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 3,
- 6, 9, 10, 9, 10, 9, 11, 9, 10, 10, 10, 9, 10, 9, 10, 6,
- 10, 11, 14, 11, 14, 11, 14, 11, 14, 13, 14, 11, 14, 11, 13, 9,
- 6, 10, 9, 9, 10, 10, 10, 9, 10, 11, 9, 9, 10, 10, 9, 6,
- 8, 11, 11, 9, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11, 7,
- 11, 13, 14, 11, 15, 13, 15, 11, 15, 14, 14, 11, 15, 13, 14, 9,
- 10, 13, 11, 11, 14, 14, 13, 11, 14, 14, 11, 11, 13, 13, 11, 9,
- 11, 14, 12, 11, 15, 14, 14, 11, 15, 15, 13, 11, 14, 14, 13, 9,
- 12, 14, 13, 10, 16, 15, 16, 11, 16, 16, 14, 11, 16, 14, 14, 9,
- 6, 10, 10, 10, 9, 9, 10, 9, 10, 11, 10, 10, 9, 9, 9, 6,
- 8, 11, 12, 11, 11, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11, 7,
- 11, 13, 15, 13, 14, 11, 15, 11, 15, 14, 14, 13, 14, 12, 14, 9,
- 8, 12, 12, 12, 12, 12, 12, 11, 12, 13, 11, 11, 11, 11, 11, 8,
- 9, 12, 12, 11, 12, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 8,
- 11, 14, 15, 13, 14, 13, 15, 11, 15, 15, 14, 13, 15, 13, 14, 9,
- 12, 16, 14, 14, 15, 15, 14, 12, 15, 16, 14, 13, 14, 14, 13, 10,
- 11, 15, 14, 13, 15, 14, 15, 12, 15, 16, 14, 13, 15, 14, 13, 9,
- 13, 15, 15, 12, 16, 15, 16, 12, 16, 16, 15, 13, 15, 14, 14, 9,
- 10, 14, 14, 14, 11, 11, 13, 11, 14, 14, 14, 13, 11, 11, 11, 9,
- 11, 14, 15, 14, 13, 11, 14, 12, 15, 15, 15, 14, 13, 11, 13, 9,
- 13, 14, 16, 15, 14, 11, 16, 12, 16, 16, 16, 14, 15, 12, 15, 10,
- 12, 16, 15, 15, 14, 14, 14, 12, 16, 16, 14, 14, 14, 13, 13, 10,
- 12, 15, 15, 14, 14, 13, 14, 12, 15, 16, 14, 14, 14, 13, 13, 9,
- 13, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 14, 16, 13, 15, 10,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 16, 16, 16, 14, 11,
- 13, 16, 16, 15, 16, 16, 16, 13, 16, 16, 16, 15, 16, 15, 14, 10,
- 14, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 15, 16, 15, 15, 10,
- 6, 10, 10, 10, 10, 10, 11, 10, 9, 10, 9, 9, 9, 9, 9, 6,
- 9, 12, 12, 11, 12, 11, 13, 11, 12, 12, 11, 10, 12, 11, 11, 8,
- 12, 14, 15, 14, 15, 14, 16, 13, 15, 14, 14, 12, 15, 13, 14, 10,
- 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10, 7,
- 9, 12, 12, 11, 13, 12, 13, 11, 12, 13, 11, 10, 12, 12, 11, 8,
- 11, 14, 14, 13, 15, 14, 15, 13, 15, 14, 14, 12, 15, 13, 14, 9,
- 11, 15, 12, 13, 15, 15, 14, 13, 14, 15, 11, 11, 14, 14, 12, 9,
- 11, 14, 13, 13, 15, 14, 15, 13, 15, 15, 13, 11, 15, 14, 13, 9,
- 13, 15, 15, 12, 16, 15, 16, 13, 16, 15, 14, 11, 16, 15, 14, 9,
- 8, 12, 12, 11, 11, 11, 12, 11, 11, 12, 11, 11, 9, 10, 10, 7,
- 9, 12, 13, 12, 12, 11, 13, 11, 12, 13, 12, 12, 11, 11, 11, 8,
- 12, 14, 15, 14, 15, 13, 16, 13, 15, 14, 15, 13, 14, 12, 14, 9,
- 9, 13, 12, 12, 12, 12, 13, 12, 12, 13, 11, 11, 11, 11, 10, 8,
- 9, 12, 12, 12, 12, 12, 13, 11, 12, 13, 11, 11, 12, 11, 11, 7,
- 11, 13, 14, 13, 14, 13, 15, 12, 14, 14, 14, 12, 14, 12, 13, 8,
- 12, 15, 14, 14, 15, 15, 14, 13, 15, 16, 13, 13, 14, 14, 12, 9,
- 11, 14, 13, 13, 14, 14, 14, 12, 14, 15, 13, 12, 14, 13, 12, 8,
- 11, 14, 14, 13, 15, 14, 15, 12, 15, 15, 14, 12, 14, 13, 13, 8,
- 11, 14, 14, 14, 13, 13, 14, 13, 13, 14, 14, 13, 11, 11, 11, 9,
- 11, 15, 15, 14, 14, 13, 15, 13, 14, 15, 14, 14, 13, 11, 13, 9,
- 13, 16, 16, 16, 15, 13, 16, 13, 16, 16, 16, 15, 15, 12, 15, 10,
- 11, 15, 15, 15, 14, 14, 14, 13, 15, 15, 14, 14, 13, 13, 12, 9,
- 11, 14, 14, 13, 13, 13, 14, 12, 14, 14, 13, 13, 13, 12, 12, 8,
- 12, 15, 15, 14, 15, 13, 15, 12, 15, 15, 14, 13, 14, 12, 13, 8,
- 13, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 15, 15, 15, 13, 10,
- 12, 15, 15, 14, 15, 14, 15, 13, 15, 16, 14, 13, 14, 14, 13, 9,
- 12, 15, 15, 14, 15, 14, 15, 12, 15, 15, 14, 13, 14, 13, 13, 8,
- 10, 14, 13, 13, 14, 13, 14, 13, 11, 13, 11, 11, 11, 11, 11, 9,
- 12, 15, 16, 14, 15, 14, 16, 14, 14, 14, 14, 13, 14, 13, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13, 16, 14, 16, 11,
- 11, 15, 14, 14, 15, 14, 15, 14, 13, 14, 11, 12, 13, 13, 11, 9,
- 12, 15, 15, 14, 15, 15, 16, 14, 14, 14, 13, 12, 14, 13, 13, 9,
- 13, 16, 16, 15, 16, 16, 16, 15, 16, 15, 15, 12, 16, 14, 15, 10,
- 12, 16, 14, 15, 16, 16, 16, 14, 14, 16, 11, 12, 14, 15, 12, 9,
- 13, 16, 15, 14, 16, 16, 16, 14, 15, 16, 13, 12, 15, 15, 13, 9,
- 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 14, 12, 16, 15, 15, 10,
- 11, 14, 14, 14, 14, 14, 14, 13, 12, 14, 13, 13, 11, 11, 11, 9,
- 11, 15, 15, 14, 14, 14, 16, 14, 14, 14, 14, 13, 13, 12, 13, 9,
- 13, 16, 16, 16, 16, 15, 16, 15, 16, 15, 16, 14, 15, 13, 15, 10,
- 11, 15, 15, 14, 14, 14, 15, 14, 14, 15, 13, 13, 12, 13, 11, 9,
- 11, 14, 14, 13, 14, 14, 14, 13, 13, 14, 13, 12, 13, 12, 12, 8,
- 12, 15, 15, 14, 16, 14, 16, 14, 15, 15, 15, 13, 14, 13, 14, 9,
- 13, 16, 15, 16, 16, 16, 16, 15, 15, 16, 13, 13, 14, 14, 12, 9,
- 12, 15, 14, 14, 15, 15, 15, 13, 14, 15, 13, 12, 14, 13, 12, 8,
- 12, 15, 14, 14, 15, 15, 15, 13, 15, 15, 14, 12, 14, 13, 13, 8,
- 12, 16, 15, 15, 13, 14, 15, 14, 13, 15, 14, 14, 10, 11, 11, 9,
- 12, 16, 16, 15, 15, 14, 16, 14, 15, 15, 15, 14, 13, 12, 13, 9,
- 14, 16, 16, 16, 16, 14, 16, 15, 16, 15, 16, 15, 14, 12, 15, 10,
- 12, 16, 15, 15, 15, 15, 15, 14, 15, 16, 14, 14, 12, 13, 11, 9,
- 11, 15, 15, 14, 14, 14, 15, 13, 14, 15, 14, 13, 13, 12, 12, 8,
- 12, 15, 15, 14, 15, 14, 15, 13, 15, 15, 14, 13, 14, 12, 13, 8,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14, 14, 14, 14, 11, 9,
- 12, 15, 15, 14, 15, 15, 15, 13, 15, 15, 14, 13, 14, 13, 12, 8,
- 11, 14, 14, 13, 14, 13, 14, 12, 13, 14, 13, 12, 13, 12, 12, 7,
- },
- {
- 2, 6, 6, 5, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 3,
- 6, 9, 10, 9, 10, 9, 11, 9, 10, 10, 10, 9, 10, 9, 10, 7,
- 10, 11, 14, 11, 14, 11, 14, 11, 14, 13, 14, 12, 14, 12, 13, 9,
- 6, 10, 9, 9, 10, 10, 10, 9, 10, 11, 9, 9, 10, 10, 9, 7,
- 8, 11, 11, 9, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11, 8,
- 11, 13, 14, 11, 16, 13, 15, 12, 16, 14, 14, 12, 15, 13, 14, 10,
- 10, 13, 11, 11, 14, 14, 13, 11, 13, 14, 11, 11, 13, 13, 11, 9,
- 11, 13, 13, 11, 15, 14, 14, 12, 15, 15, 13, 12, 15, 14, 13, 10,
- 12, 14, 14, 11, 16, 15, 16, 12, 16, 16, 15, 12, 16, 15, 15, 10,
- 6, 10, 10, 10, 9, 9, 10, 9, 10, 11, 10, 10, 9, 9, 9, 7,
- 8, 11, 12, 11, 11, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11, 8,
- 12, 13, 16, 13, 14, 11, 16, 12, 16, 15, 15, 13, 14, 12, 14, 10,
- 9, 13, 12, 12, 12, 12, 12, 11, 13, 13, 12, 12, 12, 12, 11, 8,
- 10, 13, 13, 12, 13, 12, 13, 11, 14, 14, 13, 12, 13, 12, 12, 9,
- 12, 14, 16, 13, 15, 13, 15, 12, 16, 16, 16, 13, 16, 14, 14, 10,
- 12, 16, 14, 14, 16, 15, 14, 13, 16, 16, 14, 14, 15, 15, 13, 11,
- 12, 16, 15, 14, 16, 15, 15, 12, 16, 16, 15, 14, 16, 15, 14, 10,
- 14, 16, 16, 14, 16, 15, 16, 13, 16, 16, 16, 14, 16, 16, 15, 11,
- 10, 14, 14, 13, 11, 11, 13, 12, 14, 14, 13, 13, 11, 11, 12, 9,
- 12, 14, 16, 14, 13, 11, 14, 12, 16, 15, 15, 14, 14, 12, 13, 10,
- 13, 14, 16, 15, 14, 11, 16, 12, 16, 16, 16, 15, 16, 13, 15, 11,
- 12, 16, 15, 15, 14, 14, 14, 13, 16, 16, 15, 15, 14, 14, 13, 11,
- 13, 16, 16, 15, 14, 14, 15, 13, 16, 16, 16, 15, 15, 14, 14, 11,
- 14, 16, 16, 15, 16, 14, 16, 13, 16, 16, 16, 15, 16, 14, 15, 11,
- 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14, 12,
- 15, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 15, 12,
- 15, 16, 16, 15, 16, 15, 16, 13, 16, 16, 16, 16, 16, 16, 16, 11,
- 6, 10, 10, 10, 10, 10, 11, 10, 9, 10, 9, 9, 9, 9, 9, 7,
- 9, 12, 13, 12, 13, 12, 14, 12, 12, 12, 12, 11, 12, 11, 11, 8,
- 12, 14, 16, 14, 16, 14, 16, 14, 15, 14, 15, 13, 16, 13, 14, 11,
- 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10, 8,
- 10, 13, 13, 12, 14, 13, 14, 12, 13, 13, 12, 11, 13, 12, 12, 9,
- 12, 15, 15, 13, 16, 15, 16, 14, 16, 15, 15, 12, 16, 14, 15, 10,
- 11, 15, 13, 13, 16, 15, 14, 13, 14, 15, 11, 12, 14, 14, 12, 10,
- 12, 16, 14, 13, 16, 16, 16, 14, 16, 15, 13, 12, 15, 15, 14, 10,
- 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 13, 16, 16, 15, 11,
- 8, 12, 12, 12, 11, 11, 12, 11, 11, 12, 11, 11, 9, 10, 10, 8,
- 10, 13, 14, 13, 13, 12, 14, 12, 13, 13, 13, 12, 12, 11, 12, 9,
- 13, 15, 16, 15, 16, 14, 16, 14, 16, 15, 16, 14, 15, 13, 15, 11,
- 10, 13, 13, 13, 13, 13, 13, 12, 13, 14, 12, 12, 12, 12, 11, 9,
- 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 13, 12, 12, 12, 12, 9,
- 12, 15, 15, 14, 16, 14, 16, 13, 16, 15, 15, 13, 15, 13, 14, 10,
- 13, 16, 15, 15, 16, 16, 15, 14, 16, 16, 13, 14, 15, 15, 12, 10,
- 12, 16, 14, 14, 16, 16, 15, 13, 16, 16, 14, 13, 15, 14, 13, 10,
- 13, 16, 16, 14, 16, 15, 16, 13, 16, 16, 16, 13, 16, 15, 15, 10,
- 11, 15, 15, 14, 13, 13, 14, 13, 13, 15, 14, 14, 11, 12, 12, 10,
- 12, 15, 16, 15, 14, 13, 16, 14, 16, 15, 16, 14, 13, 12, 13, 10,
- 14, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16, 13, 16, 11,
- 12, 16, 16, 16, 15, 15, 15, 14, 15, 16, 14, 14, 13, 14, 12, 10,
- 12, 16, 16, 15, 15, 14, 16, 13, 16, 16, 15, 14, 14, 13, 13, 10,
- 13, 16, 16, 15, 16, 14, 16, 13, 16, 16, 16, 15, 16, 14, 15, 10,
- 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 15, 14, 11,
- 14, 16, 16, 15, 16, 16, 16, 13, 16, 16, 16, 15, 16, 15, 14, 10,
- 10, 14, 13, 13, 13, 13, 14, 13, 11, 13, 11, 11, 11, 11, 11, 9,
- 12, 15, 16, 15, 16, 15, 16, 14, 14, 14, 14, 13, 14, 13, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 16, 12,
- 11, 15, 14, 14, 15, 15, 15, 14, 13, 14, 11, 12, 13, 13, 12, 10,
- 13, 16, 15, 15, 16, 16, 16, 15, 15, 15, 13, 12, 15, 14, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 12,
- 13, 16, 14, 15, 16, 16, 16, 15, 14, 16, 11, 12, 15, 15, 12, 10,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 16, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 11,
- 11, 15, 15, 14, 13, 14, 14, 14, 13, 14, 13, 13, 11, 12, 11, 10,
- 12, 16, 16, 16, 16, 15, 16, 15, 15, 15, 15, 14, 13, 12, 14, 10,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 16, 12,
- 12, 16, 15, 15, 16, 16, 16, 14, 14, 15, 13, 13, 13, 13, 12, 10,
- 12, 16, 16, 15, 15, 15, 16, 14, 14, 15, 14, 13, 14, 13, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 11,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 15, 15, 12, 11,
- 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 13, 16, 14, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 10,
- 12, 16, 16, 15, 14, 15, 16, 14, 13, 15, 14, 14, 11, 12, 12, 10,
- 13, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 13, 12, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 11,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 15, 15, 13, 14, 12, 11,
- 13, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 14, 13, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 15, 14, 14, 10,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 15, 16, 13, 11,
- 14, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 14, 15, 14, 13, 10,
- 12, 15, 15, 14, 15, 14, 16, 14, 14, 16, 15, 13, 14, 13, 13, 9,
- },
- {
- 2, 5, 5, 5, 5, 5, 6, 6, 5, 6, 5, 6, 5, 6, 6, 4,
- 6, 8, 10, 8, 10, 9, 11, 9, 10, 10, 10, 9, 10, 9, 10, 8,
- 10, 11, 13, 11, 13, 11, 14, 11, 14, 13, 13, 12, 13, 12, 13, 10,
- 6, 10, 8, 9, 10, 10, 10, 9, 10, 11, 9, 9, 10, 10, 9, 7,
- 8, 11, 11, 10, 12, 11, 12, 10, 12, 12, 11, 10, 12, 12, 11, 9,
- 11, 13, 14, 11, 15, 14, 15, 12, 16, 14, 14, 12, 15, 14, 14, 11,
- 10, 13, 11, 11, 14, 13, 13, 12, 13, 14, 11, 11, 13, 13, 12, 10,
- 11, 14, 13, 11, 16, 14, 14, 12, 15, 15, 14, 12, 15, 14, 14, 11,
- 12, 14, 14, 11, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 15, 12,
- 6, 10, 10, 10, 8, 9, 10, 9, 10, 11, 10, 10, 9, 9, 9, 8,
- 8, 11, 12, 12, 11, 10, 12, 11, 12, 12, 12, 12, 12, 11, 12, 9,
- 11, 13, 16, 14, 14, 12, 15, 12, 16, 15, 16, 14, 14, 13, 14, 11,
- 9, 13, 12, 12, 12, 12, 12, 11, 13, 13, 12, 12, 12, 12, 11, 10,
- 10, 13, 13, 12, 13, 12, 13, 11, 14, 14, 13, 13, 13, 13, 12, 10,
- 13, 14, 16, 14, 15, 14, 16, 13, 16, 16, 16, 14, 16, 14, 15, 12,
- 12, 16, 14, 14, 16, 15, 14, 13, 16, 16, 14, 14, 15, 15, 13, 12,
- 13, 16, 15, 14, 16, 16, 15, 13, 16, 16, 15, 14, 16, 16, 14, 12,
- 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 12,
- 10, 13, 14, 13, 11, 11, 13, 12, 13, 14, 13, 13, 11, 12, 12, 10,
- 11, 14, 15, 15, 13, 12, 14, 13, 16, 16, 16, 15, 14, 13, 14, 11,
- 12, 14, 16, 16, 14, 12, 16, 13, 16, 16, 16, 16, 15, 13, 16, 12,
- 12, 16, 15, 16, 14, 15, 14, 14, 16, 16, 15, 16, 14, 14, 13, 12,
- 13, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16, 14, 15, 12,
- 14, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16, 15, 16, 13,
- 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 15, 13,
- 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 13,
- 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 13,
- 6, 10, 10, 10, 10, 10, 10, 10, 8, 10, 9, 9, 8, 9, 9, 7,
- 9, 12, 13, 12, 13, 12, 13, 12, 12, 12, 12, 11, 12, 11, 12, 10,
- 12, 14, 16, 14, 16, 14, 16, 14, 16, 15, 15, 14, 16, 14, 15, 12,
- 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 12, 10, 9,
- 10, 13, 13, 12, 14, 13, 14, 12, 13, 13, 12, 11, 13, 13, 12, 10,
- 13, 15, 16, 14, 16, 16, 16, 14, 16, 15, 15, 13, 16, 15, 15, 12,
- 11, 15, 13, 13, 15, 15, 15, 14, 14, 14, 11, 12, 14, 14, 12, 11,
- 13, 16, 14, 14, 16, 16, 16, 14, 16, 15, 13, 13, 16, 14, 14, 11,
- 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 12,
- 8, 12, 12, 12, 11, 11, 12, 12, 11, 12, 11, 11, 9, 10, 10, 9,
- 10, 13, 14, 13, 13, 12, 14, 13, 13, 13, 13, 13, 12, 11, 12, 10,
- 13, 15, 16, 15, 16, 14, 16, 14, 16, 16, 16, 15, 16, 13, 15, 12,
- 10, 14, 13, 13, 13, 13, 13, 13, 13, 14, 12, 12, 12, 12, 11, 10,
- 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 13, 12, 13, 12, 12, 10,
- 13, 16, 16, 14, 16, 15, 16, 14, 16, 16, 15, 14, 16, 14, 15, 11,
- 13, 16, 15, 16, 16, 16, 15, 14, 16, 16, 14, 14, 15, 15, 13, 12,
- 13, 16, 15, 14, 16, 16, 16, 14, 16, 16, 14, 14, 15, 15, 14, 11,
- 14, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 15, 16, 16, 15, 12,
- 11, 14, 15, 14, 13, 13, 14, 14, 13, 15, 14, 14, 11, 12, 12, 11,
- 13, 16, 16, 16, 14, 14, 16, 14, 16, 16, 16, 15, 14, 13, 14, 12,
- 14, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13,
- 13, 16, 16, 16, 15, 16, 15, 15, 16, 16, 15, 16, 14, 14, 13, 12,
- 13, 16, 16, 15, 15, 14, 16, 14, 16, 16, 16, 15, 14, 14, 14, 11,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 16, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 13,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
- 9, 13, 13, 13, 13, 13, 14, 13, 10, 12, 11, 12, 11, 12, 11, 10,
- 12, 15, 16, 15, 16, 16, 16, 16, 14, 14, 14, 13, 14, 13, 14, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14,
- 11, 15, 14, 14, 15, 14, 15, 14, 13, 14, 11, 12, 13, 13, 12, 11,
- 13, 16, 16, 15, 16, 16, 16, 15, 15, 15, 14, 13, 16, 15, 14, 12,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 13,
- 12, 16, 14, 15, 16, 16, 16, 16, 14, 16, 11, 13, 15, 16, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 16, 15, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 13,
- 11, 15, 14, 14, 13, 14, 15, 14, 12, 14, 13, 13, 11, 12, 12, 11,
- 13, 16, 16, 16, 16, 15, 16, 16, 15, 15, 15, 15, 14, 13, 14, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 15, 14, 16, 13, 14, 13, 14, 13, 11,
- 13, 16, 16, 16, 16, 16, 16, 15, 15, 16, 15, 14, 14, 14, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 15, 16, 16, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 16, 15, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
- 11, 16, 16, 15, 13, 15, 16, 15, 13, 15, 15, 15, 11, 12, 12, 11,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 15, 12,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 14, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 12,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 13,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 12,
- 12, 14, 14, 14, 14, 15, 16, 14, 14, 16, 15, 14, 14, 15, 14, 11,
- },
- {
- 1, 5, 5, 6, 5, 6, 7, 7, 5, 7, 6, 7, 5, 6, 6, 6,
- 6, 9, 10, 9, 10, 9, 11, 10, 11, 11, 11, 10, 11, 10, 11, 9,
- 10, 11, 14, 12, 14, 12, 16, 12, 16, 13, 16, 13, 14, 13, 16, 12,
- 6, 10, 9, 9, 10, 11, 11, 10, 10, 11, 9, 10, 10, 11, 10, 9,
- 8, 11, 11, 10, 13, 12, 13, 12, 13, 13, 12, 12, 13, 13, 13, 11,
- 11, 13, 16, 12, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 13,
- 10, 14, 11, 12, 14, 14, 13, 13, 13, 16, 12, 13, 14, 16, 13, 12,
- 11, 14, 13, 12, 16, 16, 16, 14, 16, 16, 14, 14, 16, 16, 16, 13,
- 12, 14, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 6, 10, 10, 11, 9, 9, 11, 10, 10, 11, 11, 11, 9, 10, 10, 9,
- 9, 12, 13, 12, 12, 11, 13, 12, 13, 13, 13, 13, 12, 12, 13, 11,
- 12, 13, 16, 16, 16, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 13,
- 9, 13, 13, 13, 13, 13, 13, 13, 13, 14, 13, 13, 13, 13, 12, 11,
- 10, 14, 14, 13, 14, 13, 14, 13, 16, 16, 14, 15, 14, 14, 14, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 14, 14, 16, 11, 12, 14, 13, 14, 16, 16, 16, 12, 13, 13, 12,
- 12, 16, 16, 16, 13, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 13,
- 13, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 6, 10, 10, 10, 10, 11, 11, 11, 9, 11, 9, 10, 9, 10, 10, 9,
- 9, 13, 13, 13, 13, 13, 14, 13, 12, 13, 13, 12, 13, 12, 13, 11,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 8, 13, 12, 12, 13, 13, 13, 13, 11, 13, 10, 12, 12, 13, 12, 11,
- 10, 14, 13, 13, 16, 16, 16, 14, 14, 14, 13, 13, 14, 14, 14, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 11, 16, 13, 16, 16, 16, 16, 16, 14, 16, 12, 13, 16, 16, 14, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 13, 13, 13, 11, 12, 13, 13, 11, 13, 12, 13, 10, 12, 12, 11,
- 10, 14, 16, 16, 14, 13, 16, 14, 14, 16, 16, 14, 13, 13, 14, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 16, 14, 16, 14, 14, 14, 14, 13, 16, 13, 14, 13, 14, 12, 12,
- 10, 14, 14, 14, 14, 16, 16, 14, 14, 16, 14, 14, 14, 14, 14, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 14, 14, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 14, 13, 14, 13, 14, 16, 16, 11, 13, 12, 13, 11, 13, 12, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 14, 16, 16, 16, 16, 16, 13, 16, 12, 13, 14, 16, 13, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 14, 16, 12, 16, 16, 16, 14, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 14, 16, 16, 16, 13, 16, 14, 16, 12, 13, 13, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 12, 16, 14, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- },
- {
- 1, 5, 5, 6, 5, 6, 7, 8, 5, 7, 6, 8, 6, 7, 7, 7,
- 5, 9, 10, 10, 10, 10, 12, 11, 10, 11, 11, 11, 10, 11, 12, 10,
- 9, 11, 13, 12, 13, 12, 16, 14, 16, 14, 16, 16, 16, 13, 16, 13,
- 5, 10, 9, 10, 10, 11, 11, 11, 10, 11, 9, 11, 10, 11, 11, 10,
- 8, 11, 11, 11, 12, 13, 13, 13, 12, 13, 12, 12, 13, 13, 13, 12,
- 11, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 14, 11, 12, 14, 16, 13, 14, 13, 16, 12, 14, 16, 16, 13, 13,
- 11, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 14, 14, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 10, 11, 11, 9, 10, 11, 11, 10, 12, 11, 12, 9, 11, 11, 11,
- 8, 12, 13, 13, 11, 11, 14, 13, 13, 14, 13, 16, 12, 12, 13, 12,
- 11, 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 13, 12, 13, 12, 13, 13, 14, 13, 16, 13, 16, 13, 16, 13, 13,
- 10, 14, 13, 14, 13, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 14, 16, 16, 11, 12, 14, 16, 13, 16, 16, 16, 12, 14, 13, 13,
- 11, 16, 16, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 14, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 10, 10, 11, 10, 11, 12, 12, 8, 11, 10, 11, 9, 11, 11, 11,
- 9, 12, 13, 13, 13, 13, 16, 16, 12, 13, 13, 13, 13, 13, 16, 13,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 13, 11, 13, 12, 13, 13, 14, 11, 13, 10, 13, 12, 14, 12, 12,
- 10, 14, 13, 14, 16, 16, 16, 16, 13, 16, 13, 14, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 13, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 13, 13, 13, 11, 13, 14, 16, 11, 13, 13, 14, 10, 12, 12, 12,
- 10, 14, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 13, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 14, 16, 13, 16, 16, 16, 13, 16, 13, 16, 13, 16, 13, 14,
- 10, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 14, 13, 16, 13, 16, 16, 16, 10, 14, 12, 14, 11, 13, 13, 13,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
- }
+ 7, 9, 9, 8, 9, 8, 9, 8, 9, 9, 8, 8, 8, 8, 8, 4,
+ 7, 10, 11, 10, 11, 10, 12, 10, 12, 11, 11, 10, 11, 10, 10, 7,
+ 10, 11, 15, 12, 15, 12, 15, 12, 15, 14, 14, 12, 14, 12, 14, 9,
+ 7, 11, 10, 10, 12, 11, 11, 10, 11, 12, 10, 10, 11, 10, 10, 7,
+ 8, 12, 12, 11, 13, 12, 12, 10, 13, 13, 12, 10, 12, 11, 11, 7,
+ 11, 13, 15, 11, 15, 13, 15, 12, 16, 14, 14, 12, 15, 13, 13, 9,
+ 10, 15, 11, 12, 15, 14, 14, 12, 15, 15, 12, 12, 14, 14, 12, 9,
+ 11, 15, 13, 12, 16, 15, 14, 12, 15, 15, 13, 12, 15, 14, 13, 9,
+ 13, 15, 14, 10, 16, 15, 16, 11, 16, 16, 15, 12, 16, 15, 15, 9,
+ 7, 11, 11, 11, 11, 10, 11, 10, 11, 12, 11, 10, 10, 10, 10, 7,
+ 9, 12, 13, 12, 12, 11, 13, 10, 13, 13, 12, 11, 12, 10, 11, 7,
+ 12, 13, 16, 14, 15, 12, 16, 12, 16, 15, 15, 13, 15, 12, 14, 9,
+ 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 7,
+ 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 13, 11, 12, 11, 11, 7,
+ 12, 14, 15, 13, 16, 13, 15, 11, 16, 14, 15, 12, 15, 12, 13, 8,
+ 12, 16, 14, 14, 16, 15, 15, 13, 16, 15, 14, 13, 15, 14, 13, 9,
+ 12, 15, 14, 13, 15, 14, 15, 12, 16, 15, 14, 12, 14, 13, 13, 8,
+ 13, 16, 16, 12, 16, 14, 16, 11, 16, 16, 15, 12, 16, 14, 14, 8,
+ 10, 15, 15, 15, 12, 12, 14, 12, 14, 15, 15, 14, 12, 12, 13, 9,
+ 11, 15, 16, 14, 13, 12, 15, 12, 16, 15, 15, 14, 14, 12, 13, 9,
+ 14, 15, 16, 16, 15, 11, 16, 12, 16, 16, 16, 15, 16, 12, 15, 9,
+ 12, 16, 16, 15, 14, 14, 14, 13, 16, 16, 15, 14, 14, 13, 13, 9,
+ 12, 15, 15, 14, 14, 13, 15, 12, 16, 15, 14, 13, 14, 13, 13, 8,
+ 13, 16, 16, 15, 16, 12, 16, 11, 16, 16, 16, 14, 16, 13, 14, 8,
+ 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 15, 16, 15, 14, 11,
+ 13, 16, 16, 15, 16, 15, 15, 12, 16, 16, 16, 14, 15, 14, 14, 9,
+ 14, 16, 16, 13, 16, 14, 16, 10, 16, 16, 16, 13, 16, 14, 14, 8,
+ 7, 12, 11, 11, 11, 11, 12, 10, 11, 11, 10, 10, 10, 10, 10, 7,
+ 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 8,
+ 12, 14, 16, 14, 16, 14, 16, 13, 16, 14, 15, 13, 15, 13, 14, 9,
+ 9, 13, 12, 12, 13, 12, 13, 11, 12, 13, 11, 10, 12, 11, 11, 7,
+ 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 7,
+ 12, 14, 16, 13, 16, 14, 15, 12, 15, 15, 14, 12, 15, 13, 13, 8,
+ 11, 15, 13, 14, 15, 15, 14, 13, 15, 15, 12, 12, 14, 14, 12, 9,
+ 11, 15, 14, 13, 15, 14, 14, 12, 15, 14, 13, 11, 14, 13, 12, 8,
+ 13, 16, 15, 12, 16, 15, 16, 12, 16, 16, 14, 11, 15, 14, 14, 8,
+ 8, 13, 13, 12, 12, 12, 13, 11, 12, 13, 12, 11, 11, 10, 10, 7,
+ 9, 13, 14, 12, 13, 12, 13, 11, 13, 13, 13, 11, 12, 11, 11, 7,
+ 12, 14, 16, 14, 15, 13, 15, 12, 15, 15, 15, 13, 14, 12, 13, 8,
+ 9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 7,
+ 9, 13, 12, 12, 13, 12, 12, 10, 13, 13, 12, 10, 12, 10, 10, 6,
+ 11, 14, 14, 12, 14, 12, 14, 11, 14, 14, 13, 11, 13, 11, 12, 7,
+ 12, 16, 14, 14, 15, 15, 14, 13, 15, 15, 13, 12, 14, 13, 12, 8,
+ 11, 14, 13, 12, 14, 13, 13, 11, 14, 14, 13, 11, 13, 12, 11, 7,
+ 11, 14, 14, 12, 15, 13, 14, 11, 15, 14, 13, 11, 14, 12, 12, 6,
+ 11, 16, 15, 15, 13, 14, 15, 13, 14, 15, 15, 13, 12, 12, 12, 9,
+ 12, 15, 15, 14, 14, 13, 15, 12, 15, 15, 14, 13, 13, 11, 12, 8,
+ 13, 16, 16, 15, 16, 13, 16, 13, 16, 16, 15, 14, 14, 12, 14, 8,
+ 11, 16, 15, 14, 14, 14, 14, 13, 15, 15, 14, 13, 13, 12, 12, 8,
+ 11, 14, 14, 13, 13, 12, 14, 11, 14, 14, 13, 12, 12, 11, 11, 7,
+ 12, 14, 15, 13, 14, 12, 14, 11, 15, 14, 14, 12, 13, 11, 12, 7,
+ 13, 16, 16, 16, 16, 15, 16, 14, 16, 16, 15, 14, 15, 14, 13, 9,
+ 12, 15, 14, 13, 15, 13, 14, 12, 15, 15, 13, 12, 13, 12, 12, 7,
+ 11, 15, 14, 12, 14, 13, 14, 10, 15, 14, 13, 11, 13, 11, 11, 5,
+ 10, 15, 15, 15, 15, 14, 15, 13, 12, 14, 12, 12, 12, 13, 12, 9,
+ 12, 16, 16, 15, 16, 15, 16, 14, 14, 15, 14, 13, 14, 13, 13, 9,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 11,
+ 11, 15, 15, 14, 15, 15, 15, 14, 14, 15, 12, 12, 13, 13, 12, 9,
+ 12, 15, 15, 14, 16, 14, 15, 13, 14, 14, 13, 12, 14, 13, 12, 8,
+ 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 15, 12, 16, 14, 14, 9,
+ 13, 16, 14, 16, 16, 16, 16, 15, 15, 16, 11, 12, 16, 15, 12, 9,
+ 13, 16, 15, 14, 16, 15, 16, 14, 15, 16, 12, 11, 15, 14, 13, 8,
+ 13, 16, 16, 13, 16, 16, 16, 13, 16, 16, 13, 11, 16, 14, 14, 8,
+ 11, 15, 15, 15, 14, 14, 15, 13, 13, 15, 14, 13, 12, 12, 12, 9,
+ 11, 15, 16, 14, 15, 14, 15, 13, 14, 14, 14, 13, 13, 12, 13, 8,
+ 13, 16, 16, 16, 16, 15, 16, 14, 16, 16, 16, 13, 15, 12, 14, 9,
+ 11, 16, 15, 14, 14, 14, 15, 13, 14, 14, 13, 12, 13, 12, 11, 8,
+ 11, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 12, 11, 11, 7,
+ 12, 15, 15, 13, 15, 14, 15, 12, 15, 14, 14, 11, 13, 12, 12, 7,
+ 13, 16, 15, 15, 16, 16, 16, 14, 15, 16, 12, 12, 14, 14, 12, 8,
+ 11, 15, 14, 13, 15, 13, 14, 12, 14, 14, 12, 11, 13, 12, 11, 6,
+ 11, 14, 14, 12, 15, 13, 14, 11, 15, 14, 12, 10, 13, 11, 11, 5,
+ 12, 16, 16, 16, 15, 15, 16, 15, 14, 16, 15, 15, 10, 12, 12, 9,
+ 13, 16, 16, 16, 15, 14, 16, 13, 15, 15, 15, 14, 12, 11, 13, 8,
+ 14, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 14, 14, 11, 14, 8,
+ 13, 16, 16, 15, 15, 15, 15, 14, 15, 16, 14, 13, 12, 12, 11, 8,
+ 11, 15, 15, 13, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 6,
+ 11, 15, 15, 13, 15, 12, 14, 11, 14, 14, 13, 11, 12, 10, 11, 5,
+ 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 14, 14, 13, 11, 8,
+ 11, 14, 14, 13, 14, 13, 14, 11, 14, 14, 12, 11, 12, 11, 10, 5,
+ 10, 13, 13, 11, 13, 12, 13, 9, 13, 13, 12, 9, 12, 10, 10, 3,
+},
+{
+ 5, 7, 7, 7, 7, 7, 8, 7, 7, 8, 7, 7, 7, 7, 7, 4,
+ 7, 9, 11, 9, 11, 9, 11, 9, 11, 10, 10, 9, 10, 9, 10, 6,
+ 11, 11, 14, 11, 14, 11, 14, 11, 15, 13, 14, 12, 14, 12, 13, 9,
+ 6, 11, 10, 9, 11, 10, 11, 9, 11, 11, 9, 9, 10, 10, 9, 6,
+ 8, 11, 11, 10, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11, 7,
+ 11, 13, 14, 11, 15, 13, 15, 11, 15, 14, 14, 12, 14, 13, 13, 9,
+ 10, 14, 11, 11, 15, 14, 13, 12, 14, 14, 11, 11, 14, 13, 12, 9,
+ 11, 14, 13, 11, 15, 14, 14, 11, 15, 15, 13, 11, 14, 14, 13, 9,
+ 12, 14, 14, 10, 16, 15, 16, 11, 16, 16, 15, 11, 16, 15, 14, 9,
+ 6, 10, 11, 10, 10, 9, 11, 9, 10, 11, 10, 10, 9, 9, 9, 6,
+ 9, 12, 12, 11, 12, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11, 7,
+ 12, 13, 15, 13, 14, 11, 15, 11, 15, 15, 14, 13, 14, 12, 14, 9,
+ 9, 12, 12, 11, 12, 11, 12, 11, 12, 13, 11, 11, 12, 11, 11, 7,
+ 9, 12, 12, 11, 13, 11, 12, 10, 13, 13, 12, 11, 12, 11, 11, 7,
+ 12, 14, 15, 12, 15, 12, 14, 11, 15, 15, 14, 12, 14, 13, 13, 8,
+ 12, 15, 14, 13, 15, 14, 14, 13, 16, 16, 14, 13, 15, 14, 13, 9,
+ 12, 15, 14, 13, 15, 14, 14, 12, 15, 15, 13, 12, 14, 13, 13, 9,
+ 13, 15, 15, 12, 16, 14, 15, 11, 16, 16, 15, 12, 15, 14, 14, 9,
+ 10, 14, 14, 14, 12, 11, 13, 12, 14, 15, 14, 13, 12, 11, 12, 9,
+ 12, 14, 15, 14, 13, 11, 14, 12, 15, 15, 15, 14, 13, 11, 13, 9,
+ 13, 15, 16, 15, 14, 11, 16, 11, 16, 16, 16, 14, 15, 12, 15, 9,
+ 12, 15, 15, 14, 14, 14, 14, 13, 15, 15, 14, 14, 14, 13, 13, 9,
+ 12, 15, 15, 14, 14, 13, 14, 12, 15, 15, 14, 13, 14, 13, 13, 9,
+ 13, 15, 16, 14, 15, 13, 16, 11, 16, 16, 15, 14, 15, 13, 14, 9,
+ 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 16, 16, 16, 14, 11,
+ 14, 16, 16, 14, 16, 15, 15, 12, 16, 16, 16, 14, 15, 14, 14, 9,
+ 14, 16, 16, 14, 16, 14, 16, 11, 16, 16, 16, 14, 16, 14, 14, 9,
+ 6, 11, 10, 10, 10, 10, 11, 10, 10, 11, 9, 9, 9, 9, 9, 6,
+ 9, 12, 12, 11, 13, 11, 13, 11, 12, 12, 11, 11, 12, 11, 11, 7,
+ 12, 14, 16, 13, 16, 14, 16, 13, 15, 14, 15, 12, 15, 13, 14, 9,
+ 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10, 7,
+ 9, 12, 12, 11, 13, 12, 13, 11, 13, 12, 11, 10, 12, 11, 11, 7,
+ 12, 14, 15, 12, 15, 14, 15, 12, 15, 14, 14, 12, 14, 13, 13, 9,
+ 11, 15, 13, 13, 15, 14, 14, 13, 14, 15, 11, 11, 14, 14, 12, 9,
+ 11, 14, 13, 12, 15, 14, 14, 12, 14, 14, 12, 11, 14, 13, 12, 8,
+ 13, 15, 15, 12, 16, 15, 15, 12, 15, 15, 14, 11, 15, 14, 14, 8,
+ 8, 12, 12, 11, 11, 11, 12, 11, 11, 12, 11, 11, 10, 10, 10, 7,
+ 9, 13, 13, 12, 13, 11, 13, 11, 12, 13, 12, 11, 11, 10, 11, 7,
+ 12, 14, 15, 14, 15, 13, 15, 12, 15, 14, 14, 13, 14, 12, 13, 9,
+ 9, 13, 12, 12, 12, 12, 12, 11, 12, 13, 11, 11, 11, 11, 10, 7,
+ 9, 12, 12, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10, 7,
+ 11, 13, 14, 12, 14, 12, 14, 11, 14, 13, 13, 11, 13, 11, 12, 7,
+ 12, 15, 14, 13, 15, 14, 14, 13, 15, 15, 13, 12, 13, 13, 12, 9,
+ 11, 14, 13, 12, 14, 13, 13, 11, 14, 14, 12, 11, 13, 12, 11, 7,
+ 11, 14, 14, 12, 14, 13, 14, 11, 14, 14, 13, 11, 13, 12, 12, 7,
+ 11, 15, 15, 14, 13, 13, 14, 13, 14, 15, 14, 13, 11, 11, 12, 9,
+ 12, 15, 15, 14, 14, 12, 14, 12, 14, 14, 14, 13, 12, 11, 12, 8,
+ 13, 16, 16, 15, 15, 12, 16, 13, 16, 15, 15, 14, 14, 12, 14, 9,
+ 12, 15, 15, 14, 14, 14, 14, 13, 15, 15, 14, 13, 12, 12, 12, 9,
+ 11, 14, 14, 13, 13, 12, 13, 11, 14, 13, 13, 12, 12, 11, 11, 7,
+ 12, 14, 15, 13, 14, 12, 14, 11, 15, 14, 13, 12, 13, 11, 12, 7,
+ 13, 16, 16, 15, 16, 15, 15, 14, 16, 16, 15, 14, 14, 14, 12, 9,
+ 12, 15, 14, 13, 14, 13, 14, 12, 15, 14, 13, 12, 13, 12, 12, 8,
+ 12, 14, 14, 13, 15, 13, 14, 11, 14, 14, 13, 12, 13, 12, 12, 6,
+ 10, 14, 14, 13, 14, 14, 14, 13, 12, 13, 12, 12, 12, 12, 11, 9,
+ 12, 15, 15, 14, 15, 14, 16, 14, 14, 14, 13, 12, 14, 13, 13, 9,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 16, 11,
+ 11, 15, 14, 14, 15, 14, 14, 14, 13, 14, 11, 12, 13, 13, 12, 9,
+ 12, 15, 14, 14, 15, 14, 15, 13, 14, 14, 13, 12, 14, 13, 13, 9,
+ 13, 16, 16, 14, 16, 15, 16, 14, 16, 15, 15, 12, 16, 14, 14, 9,
+ 13, 16, 14, 15, 16, 16, 16, 14, 14, 16, 11, 12, 15, 14, 12, 9,
+ 13, 16, 15, 14, 16, 15, 16, 14, 15, 15, 12, 11, 15, 14, 13, 9,
+ 14, 16, 16, 13, 16, 16, 16, 14, 16, 15, 13, 11, 16, 14, 14, 9,
+ 11, 15, 15, 14, 14, 14, 14, 13, 13, 14, 13, 13, 11, 11, 11, 9,
+ 12, 15, 15, 14, 15, 14, 15, 13, 14, 14, 13, 13, 13, 12, 12, 9,
+ 13, 16, 16, 16, 16, 14, 16, 14, 16, 15, 16, 14, 15, 12, 14, 9,
+ 11, 15, 14, 14, 15, 14, 14, 13, 14, 14, 12, 12, 12, 12, 11, 8,
+ 11, 14, 14, 13, 14, 13, 13, 12, 13, 13, 12, 11, 12, 11, 11, 7,
+ 12, 14, 15, 13, 15, 13, 14, 13, 14, 14, 13, 12, 13, 12, 12, 8,
+ 13, 16, 15, 15, 16, 15, 15, 14, 15, 16, 12, 12, 14, 14, 11, 9,
+ 12, 15, 14, 13, 15, 13, 14, 12, 14, 14, 12, 11, 13, 12, 11, 7,
+ 12, 14, 14, 13, 15, 13, 14, 12, 15, 14, 13, 10, 13, 12, 12, 6,
+ 12, 16, 16, 15, 14, 14, 15, 14, 13, 15, 14, 14, 10, 11, 11, 9,
+ 13, 16, 16, 15, 15, 14, 15, 14, 15, 15, 15, 14, 12, 11, 12, 8,
+ 14, 16, 16, 16, 16, 14, 16, 14, 16, 15, 15, 14, 14, 11, 14, 8,
+ 12, 16, 16, 15, 15, 14, 15, 14, 14, 16, 14, 14, 12, 12, 11, 8,
+ 11, 14, 14, 13, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11, 7,
+ 12, 14, 15, 13, 14, 13, 14, 12, 14, 14, 13, 12, 13, 11, 12, 6,
+ 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 14, 13, 13, 13, 11, 8,
+ 12, 15, 15, 13, 15, 13, 14, 12, 14, 14, 13, 12, 13, 12, 10, 6,
+ 11, 14, 13, 12, 14, 12, 13, 10, 14, 13, 12, 10, 12, 10, 10, 4,
+},
+{
+ 4, 6, 6, 6, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 3,
+ 6, 9, 10, 9, 10, 9, 11, 9, 10, 10, 10, 9, 10, 9, 10, 6,
+ 10, 11, 14, 11, 14, 11, 14, 11, 14, 13, 14, 11, 14, 11, 13, 9,
+ 6, 10, 9, 9, 10, 10, 10, 9, 10, 11, 9, 9, 10, 10, 9, 6,
+ 8, 11, 11, 9, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11, 7,
+ 11, 13, 14, 11, 15, 13, 15, 11, 15, 14, 14, 11, 15, 13, 14, 9,
+ 10, 13, 11, 11, 14, 14, 13, 11, 14, 14, 11, 11, 13, 13, 11, 9,
+ 11, 14, 12, 11, 15, 14, 14, 11, 15, 15, 13, 11, 14, 14, 13, 9,
+ 12, 14, 13, 10, 16, 15, 16, 11, 16, 16, 14, 11, 16, 14, 14, 9,
+ 6, 10, 10, 10, 9, 9, 10, 9, 10, 11, 10, 10, 9, 9, 9, 6,
+ 8, 11, 12, 11, 11, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11, 7,
+ 11, 13, 15, 13, 14, 11, 15, 11, 15, 14, 14, 13, 14, 12, 14, 9,
+ 8, 12, 12, 12, 12, 12, 12, 11, 12, 13, 11, 11, 11, 11, 11, 8,
+ 9, 12, 12, 11, 12, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11, 8,
+ 11, 14, 15, 13, 14, 13, 15, 11, 15, 15, 14, 13, 15, 13, 14, 9,
+ 12, 16, 14, 14, 15, 15, 14, 12, 15, 16, 14, 13, 14, 14, 13, 10,
+ 11, 15, 14, 13, 15, 14, 15, 12, 15, 16, 14, 13, 15, 14, 13, 9,
+ 13, 15, 15, 12, 16, 15, 16, 12, 16, 16, 15, 13, 15, 14, 14, 9,
+ 10, 14, 14, 14, 11, 11, 13, 11, 14, 14, 14, 13, 11, 11, 11, 9,
+ 11, 14, 15, 14, 13, 11, 14, 12, 15, 15, 15, 14, 13, 11, 13, 9,
+ 13, 14, 16, 15, 14, 11, 16, 12, 16, 16, 16, 14, 15, 12, 15, 10,
+ 12, 16, 15, 15, 14, 14, 14, 12, 16, 16, 14, 14, 14, 13, 13, 10,
+ 12, 15, 15, 14, 14, 13, 14, 12, 15, 16, 14, 14, 14, 13, 13, 9,
+ 13, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 14, 16, 13, 15, 10,
+ 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 16, 16, 16, 14, 11,
+ 13, 16, 16, 15, 16, 16, 16, 13, 16, 16, 16, 15, 16, 15, 14, 10,
+ 14, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 15, 16, 15, 15, 10,
+ 6, 10, 10, 10, 10, 10, 11, 10, 9, 10, 9, 9, 9, 9, 9, 6,
+ 9, 12, 12, 11, 12, 11, 13, 11, 12, 12, 11, 10, 12, 11, 11, 8,
+ 12, 14, 15, 14, 15, 14, 16, 13, 15, 14, 14, 12, 15, 13, 14, 10,
+ 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10, 7,
+ 9, 12, 12, 11, 13, 12, 13, 11, 12, 13, 11, 10, 12, 12, 11, 8,
+ 11, 14, 14, 13, 15, 14, 15, 13, 15, 14, 14, 12, 15, 13, 14, 9,
+ 11, 15, 12, 13, 15, 15, 14, 13, 14, 15, 11, 11, 14, 14, 12, 9,
+ 11, 14, 13, 13, 15, 14, 15, 13, 15, 15, 13, 11, 15, 14, 13, 9,
+ 13, 15, 15, 12, 16, 15, 16, 13, 16, 15, 14, 11, 16, 15, 14, 9,
+ 8, 12, 12, 11, 11, 11, 12, 11, 11, 12, 11, 11, 9, 10, 10, 7,
+ 9, 12, 13, 12, 12, 11, 13, 11, 12, 13, 12, 12, 11, 11, 11, 8,
+ 12, 14, 15, 14, 15, 13, 16, 13, 15, 14, 15, 13, 14, 12, 14, 9,
+ 9, 13, 12, 12, 12, 12, 13, 12, 12, 13, 11, 11, 11, 11, 10, 8,
+ 9, 12, 12, 12, 12, 12, 13, 11, 12, 13, 11, 11, 12, 11, 11, 7,
+ 11, 13, 14, 13, 14, 13, 15, 12, 14, 14, 14, 12, 14, 12, 13, 8,
+ 12, 15, 14, 14, 15, 15, 14, 13, 15, 16, 13, 13, 14, 14, 12, 9,
+ 11, 14, 13, 13, 14, 14, 14, 12, 14, 15, 13, 12, 14, 13, 12, 8,
+ 11, 14, 14, 13, 15, 14, 15, 12, 15, 15, 14, 12, 14, 13, 13, 8,
+ 11, 14, 14, 14, 13, 13, 14, 13, 13, 14, 14, 13, 11, 11, 11, 9,
+ 11, 15, 15, 14, 14, 13, 15, 13, 14, 15, 14, 14, 13, 11, 13, 9,
+ 13, 16, 16, 16, 15, 13, 16, 13, 16, 16, 16, 15, 15, 12, 15, 10,
+ 11, 15, 15, 15, 14, 14, 14, 13, 15, 15, 14, 14, 13, 13, 12, 9,
+ 11, 14, 14, 13, 13, 13, 14, 12, 14, 14, 13, 13, 13, 12, 12, 8,
+ 12, 15, 15, 14, 15, 13, 15, 12, 15, 15, 14, 13, 14, 12, 13, 8,
+ 13, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 15, 15, 15, 13, 10,
+ 12, 15, 15, 14, 15, 14, 15, 13, 15, 16, 14, 13, 14, 14, 13, 9,
+ 12, 15, 15, 14, 15, 14, 15, 12, 15, 15, 14, 13, 14, 13, 13, 8,
+ 10, 14, 13, 13, 14, 13, 14, 13, 11, 13, 11, 11, 11, 11, 11, 9,
+ 12, 15, 16, 14, 15, 14, 16, 14, 14, 14, 14, 13, 14, 13, 13, 10,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13, 16, 14, 16, 11,
+ 11, 15, 14, 14, 15, 14, 15, 14, 13, 14, 11, 12, 13, 13, 11, 9,
+ 12, 15, 15, 14, 15, 15, 16, 14, 14, 14, 13, 12, 14, 13, 13, 9,
+ 13, 16, 16, 15, 16, 16, 16, 15, 16, 15, 15, 12, 16, 14, 15, 10,
+ 12, 16, 14, 15, 16, 16, 16, 14, 14, 16, 11, 12, 14, 15, 12, 9,
+ 13, 16, 15, 14, 16, 16, 16, 14, 15, 16, 13, 12, 15, 15, 13, 9,
+ 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 14, 12, 16, 15, 15, 10,
+ 11, 14, 14, 14, 14, 14, 14, 13, 12, 14, 13, 13, 11, 11, 11, 9,
+ 11, 15, 15, 14, 14, 14, 16, 14, 14, 14, 14, 13, 13, 12, 13, 9,
+ 13, 16, 16, 16, 16, 15, 16, 15, 16, 15, 16, 14, 15, 13, 15, 10,
+ 11, 15, 15, 14, 14, 14, 15, 14, 14, 15, 13, 13, 12, 13, 11, 9,
+ 11, 14, 14, 13, 14, 14, 14, 13, 13, 14, 13, 12, 13, 12, 12, 8,
+ 12, 15, 15, 14, 16, 14, 16, 14, 15, 15, 15, 13, 14, 13, 14, 9,
+ 13, 16, 15, 16, 16, 16, 16, 15, 15, 16, 13, 13, 14, 14, 12, 9,
+ 12, 15, 14, 14, 15, 15, 15, 13, 14, 15, 13, 12, 14, 13, 12, 8,
+ 12, 15, 14, 14, 15, 15, 15, 13, 15, 15, 14, 12, 14, 13, 13, 8,
+ 12, 16, 15, 15, 13, 14, 15, 14, 13, 15, 14, 14, 10, 11, 11, 9,
+ 12, 16, 16, 15, 15, 14, 16, 14, 15, 15, 15, 14, 13, 12, 13, 9,
+ 14, 16, 16, 16, 16, 14, 16, 15, 16, 15, 16, 15, 14, 12, 15, 10,
+ 12, 16, 15, 15, 15, 15, 15, 14, 15, 16, 14, 14, 12, 13, 11, 9,
+ 11, 15, 15, 14, 14, 14, 15, 13, 14, 15, 14, 13, 13, 12, 12, 8,
+ 12, 15, 15, 14, 15, 14, 15, 13, 15, 15, 14, 13, 14, 12, 13, 8,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14, 14, 14, 14, 11, 9,
+ 12, 15, 15, 14, 15, 15, 15, 13, 15, 15, 14, 13, 14, 13, 12, 8,
+ 11, 14, 14, 13, 14, 13, 14, 12, 13, 14, 13, 12, 13, 12, 12, 7,
+},
+{
+ 2, 6, 6, 5, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 3,
+ 6, 9, 10, 9, 10, 9, 11, 9, 10, 10, 10, 9, 10, 9, 10, 7,
+ 10, 11, 14, 11, 14, 11, 14, 11, 14, 13, 14, 12, 14, 12, 13, 9,
+ 6, 10, 9, 9, 10, 10, 10, 9, 10, 11, 9, 9, 10, 10, 9, 7,
+ 8, 11, 11, 9, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11, 8,
+ 11, 13, 14, 11, 16, 13, 15, 12, 16, 14, 14, 12, 15, 13, 14, 10,
+ 10, 13, 11, 11, 14, 14, 13, 11, 13, 14, 11, 11, 13, 13, 11, 9,
+ 11, 13, 13, 11, 15, 14, 14, 12, 15, 15, 13, 12, 15, 14, 13, 10,
+ 12, 14, 14, 11, 16, 15, 16, 12, 16, 16, 15, 12, 16, 15, 15, 10,
+ 6, 10, 10, 10, 9, 9, 10, 9, 10, 11, 10, 10, 9, 9, 9, 7,
+ 8, 11, 12, 11, 11, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11, 8,
+ 12, 13, 16, 13, 14, 11, 16, 12, 16, 15, 15, 13, 14, 12, 14, 10,
+ 9, 13, 12, 12, 12, 12, 12, 11, 13, 13, 12, 12, 12, 12, 11, 8,
+ 10, 13, 13, 12, 13, 12, 13, 11, 14, 14, 13, 12, 13, 12, 12, 9,
+ 12, 14, 16, 13, 15, 13, 15, 12, 16, 16, 16, 13, 16, 14, 14, 10,
+ 12, 16, 14, 14, 16, 15, 14, 13, 16, 16, 14, 14, 15, 15, 13, 11,
+ 12, 16, 15, 14, 16, 15, 15, 12, 16, 16, 15, 14, 16, 15, 14, 10,
+ 14, 16, 16, 14, 16, 15, 16, 13, 16, 16, 16, 14, 16, 16, 15, 11,
+ 10, 14, 14, 13, 11, 11, 13, 12, 14, 14, 13, 13, 11, 11, 12, 9,
+ 12, 14, 16, 14, 13, 11, 14, 12, 16, 15, 15, 14, 14, 12, 13, 10,
+ 13, 14, 16, 15, 14, 11, 16, 12, 16, 16, 16, 15, 16, 13, 15, 11,
+ 12, 16, 15, 15, 14, 14, 14, 13, 16, 16, 15, 15, 14, 14, 13, 11,
+ 13, 16, 16, 15, 14, 14, 15, 13, 16, 16, 16, 15, 15, 14, 14, 11,
+ 14, 16, 16, 15, 16, 14, 16, 13, 16, 16, 16, 15, 16, 14, 15, 11,
+ 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14, 12,
+ 15, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 15, 12,
+ 15, 16, 16, 15, 16, 15, 16, 13, 16, 16, 16, 16, 16, 16, 16, 11,
+ 6, 10, 10, 10, 10, 10, 11, 10, 9, 10, 9, 9, 9, 9, 9, 7,
+ 9, 12, 13, 12, 13, 12, 14, 12, 12, 12, 12, 11, 12, 11, 11, 8,
+ 12, 14, 16, 14, 16, 14, 16, 14, 15, 14, 15, 13, 16, 13, 14, 11,
+ 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10, 8,
+ 10, 13, 13, 12, 14, 13, 14, 12, 13, 13, 12, 11, 13, 12, 12, 9,
+ 12, 15, 15, 13, 16, 15, 16, 14, 16, 15, 15, 12, 16, 14, 15, 10,
+ 11, 15, 13, 13, 16, 15, 14, 13, 14, 15, 11, 12, 14, 14, 12, 10,
+ 12, 16, 14, 13, 16, 16, 16, 14, 16, 15, 13, 12, 15, 15, 14, 10,
+ 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 13, 16, 16, 15, 11,
+ 8, 12, 12, 12, 11, 11, 12, 11, 11, 12, 11, 11, 9, 10, 10, 8,
+ 10, 13, 14, 13, 13, 12, 14, 12, 13, 13, 13, 12, 12, 11, 12, 9,
+ 13, 15, 16, 15, 16, 14, 16, 14, 16, 15, 16, 14, 15, 13, 15, 11,
+ 10, 13, 13, 13, 13, 13, 13, 12, 13, 14, 12, 12, 12, 12, 11, 9,
+ 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 13, 12, 12, 12, 12, 9,
+ 12, 15, 15, 14, 16, 14, 16, 13, 16, 15, 15, 13, 15, 13, 14, 10,
+ 13, 16, 15, 15, 16, 16, 15, 14, 16, 16, 13, 14, 15, 15, 12, 10,
+ 12, 16, 14, 14, 16, 16, 15, 13, 16, 16, 14, 13, 15, 14, 13, 10,
+ 13, 16, 16, 14, 16, 15, 16, 13, 16, 16, 16, 13, 16, 15, 15, 10,
+ 11, 15, 15, 14, 13, 13, 14, 13, 13, 15, 14, 14, 11, 12, 12, 10,
+ 12, 15, 16, 15, 14, 13, 16, 14, 16, 15, 16, 14, 13, 12, 13, 10,
+ 14, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16, 13, 16, 11,
+ 12, 16, 16, 16, 15, 15, 15, 14, 15, 16, 14, 14, 13, 14, 12, 10,
+ 12, 16, 16, 15, 15, 14, 16, 13, 16, 16, 15, 14, 14, 13, 13, 10,
+ 13, 16, 16, 15, 16, 14, 16, 13, 16, 16, 16, 15, 16, 14, 15, 10,
+ 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13, 12,
+ 14, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 15, 14, 11,
+ 14, 16, 16, 15, 16, 16, 16, 13, 16, 16, 16, 15, 16, 15, 14, 10,
+ 10, 14, 13, 13, 13, 13, 14, 13, 11, 13, 11, 11, 11, 11, 11, 9,
+ 12, 15, 16, 15, 16, 15, 16, 14, 14, 14, 14, 13, 14, 13, 14, 11,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 16, 12,
+ 11, 15, 14, 14, 15, 15, 15, 14, 13, 14, 11, 12, 13, 13, 12, 10,
+ 13, 16, 15, 15, 16, 16, 16, 15, 15, 15, 13, 12, 15, 14, 13, 10,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 12,
+ 13, 16, 14, 15, 16, 16, 16, 15, 14, 16, 11, 12, 15, 15, 12, 10,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 16, 14, 11,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 11,
+ 11, 15, 15, 14, 13, 14, 14, 14, 13, 14, 13, 13, 11, 12, 11, 10,
+ 12, 16, 16, 16, 16, 15, 16, 15, 15, 15, 15, 14, 13, 12, 14, 10,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 16, 12,
+ 12, 16, 15, 15, 16, 16, 16, 14, 14, 15, 13, 13, 13, 13, 12, 10,
+ 12, 16, 16, 15, 15, 15, 16, 14, 14, 15, 14, 13, 14, 13, 13, 10,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 11,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 15, 15, 12, 11,
+ 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 13, 16, 14, 13, 10,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 10,
+ 12, 16, 16, 15, 14, 15, 16, 14, 13, 15, 14, 14, 11, 12, 12, 10,
+ 13, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 13, 12, 14, 11,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 11,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 15, 15, 13, 14, 12, 11,
+ 13, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 14, 13, 13, 10,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 15, 14, 14, 10,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 15, 16, 13, 11,
+ 14, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 14, 15, 14, 13, 10,
+ 12, 15, 15, 14, 15, 14, 16, 14, 14, 16, 15, 13, 14, 13, 13, 9,
+},
+{
+ 2, 5, 5, 5, 5, 5, 6, 6, 5, 6, 5, 6, 5, 6, 6, 4,
+ 6, 8, 10, 8, 10, 9, 11, 9, 10, 10, 10, 9, 10, 9, 10, 8,
+ 10, 11, 13, 11, 13, 11, 14, 11, 14, 13, 13, 12, 13, 12, 13, 10,
+ 6, 10, 8, 9, 10, 10, 10, 9, 10, 11, 9, 9, 10, 10, 9, 7,
+ 8, 11, 11, 10, 12, 11, 12, 10, 12, 12, 11, 10, 12, 12, 11, 9,
+ 11, 13, 14, 11, 15, 14, 15, 12, 16, 14, 14, 12, 15, 14, 14, 11,
+ 10, 13, 11, 11, 14, 13, 13, 12, 13, 14, 11, 11, 13, 13, 12, 10,
+ 11, 14, 13, 11, 16, 14, 14, 12, 15, 15, 14, 12, 15, 14, 14, 11,
+ 12, 14, 14, 11, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 15, 12,
+ 6, 10, 10, 10, 8, 9, 10, 9, 10, 11, 10, 10, 9, 9, 9, 8,
+ 8, 11, 12, 12, 11, 10, 12, 11, 12, 12, 12, 12, 12, 11, 12, 9,
+ 11, 13, 16, 14, 14, 12, 15, 12, 16, 15, 16, 14, 14, 13, 14, 11,
+ 9, 13, 12, 12, 12, 12, 12, 11, 13, 13, 12, 12, 12, 12, 11, 10,
+ 10, 13, 13, 12, 13, 12, 13, 11, 14, 14, 13, 13, 13, 13, 12, 10,
+ 13, 14, 16, 14, 15, 14, 16, 13, 16, 16, 16, 14, 16, 14, 15, 12,
+ 12, 16, 14, 14, 16, 15, 14, 13, 16, 16, 14, 14, 15, 15, 13, 12,
+ 13, 16, 15, 14, 16, 16, 15, 13, 16, 16, 15, 14, 16, 16, 14, 12,
+ 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 12,
+ 10, 13, 14, 13, 11, 11, 13, 12, 13, 14, 13, 13, 11, 12, 12, 10,
+ 11, 14, 15, 15, 13, 12, 14, 13, 16, 16, 16, 15, 14, 13, 14, 11,
+ 12, 14, 16, 16, 14, 12, 16, 13, 16, 16, 16, 16, 15, 13, 16, 12,
+ 12, 16, 15, 16, 14, 15, 14, 14, 16, 16, 15, 16, 14, 14, 13, 12,
+ 13, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16, 14, 15, 12,
+ 14, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16, 15, 16, 13,
+ 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 15, 13,
+ 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 13,
+ 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 13,
+ 6, 10, 10, 10, 10, 10, 10, 10, 8, 10, 9, 9, 8, 9, 9, 7,
+ 9, 12, 13, 12, 13, 12, 13, 12, 12, 12, 12, 11, 12, 11, 12, 10,
+ 12, 14, 16, 14, 16, 14, 16, 14, 16, 15, 15, 14, 16, 14, 15, 12,
+ 8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 12, 10, 9,
+ 10, 13, 13, 12, 14, 13, 14, 12, 13, 13, 12, 11, 13, 13, 12, 10,
+ 13, 15, 16, 14, 16, 16, 16, 14, 16, 15, 15, 13, 16, 15, 15, 12,
+ 11, 15, 13, 13, 15, 15, 15, 14, 14, 14, 11, 12, 14, 14, 12, 11,
+ 13, 16, 14, 14, 16, 16, 16, 14, 16, 15, 13, 13, 16, 14, 14, 11,
+ 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 12,
+ 8, 12, 12, 12, 11, 11, 12, 12, 11, 12, 11, 11, 9, 10, 10, 9,
+ 10, 13, 14, 13, 13, 12, 14, 13, 13, 13, 13, 13, 12, 11, 12, 10,
+ 13, 15, 16, 15, 16, 14, 16, 14, 16, 16, 16, 15, 16, 13, 15, 12,
+ 10, 14, 13, 13, 13, 13, 13, 13, 13, 14, 12, 12, 12, 12, 11, 10,
+ 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 13, 12, 13, 12, 12, 10,
+ 13, 16, 16, 14, 16, 15, 16, 14, 16, 16, 15, 14, 16, 14, 15, 11,
+ 13, 16, 15, 16, 16, 16, 15, 14, 16, 16, 14, 14, 15, 15, 13, 12,
+ 13, 16, 15, 14, 16, 16, 16, 14, 16, 16, 14, 14, 15, 15, 14, 11,
+ 14, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 15, 16, 16, 15, 12,
+ 11, 14, 15, 14, 13, 13, 14, 14, 13, 15, 14, 14, 11, 12, 12, 11,
+ 13, 16, 16, 16, 14, 14, 16, 14, 16, 16, 16, 15, 14, 13, 14, 12,
+ 14, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13,
+ 13, 16, 16, 16, 15, 16, 15, 15, 16, 16, 15, 16, 14, 14, 13, 12,
+ 13, 16, 16, 15, 15, 14, 16, 14, 16, 16, 16, 15, 14, 14, 14, 11,
+ 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 16, 12,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 13,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
+ 9, 13, 13, 13, 13, 13, 14, 13, 10, 12, 11, 12, 11, 12, 11, 10,
+ 12, 15, 16, 15, 16, 16, 16, 16, 14, 14, 14, 13, 14, 13, 14, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14,
+ 11, 15, 14, 14, 15, 14, 15, 14, 13, 14, 11, 12, 13, 13, 12, 11,
+ 13, 16, 16, 15, 16, 16, 16, 15, 15, 15, 14, 13, 16, 15, 14, 12,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 13,
+ 12, 16, 14, 15, 16, 16, 16, 16, 14, 16, 11, 13, 15, 16, 13, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 16, 15, 12,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 13,
+ 11, 15, 14, 14, 13, 14, 15, 14, 12, 14, 13, 13, 11, 12, 12, 11,
+ 13, 16, 16, 16, 16, 15, 16, 16, 15, 15, 15, 15, 14, 13, 14, 12,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 15, 14, 16, 13, 14, 13, 14, 13, 11,
+ 13, 16, 16, 16, 16, 16, 16, 15, 15, 16, 15, 14, 14, 14, 14, 11,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 15, 16, 16, 13, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 16, 15, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
+ 11, 16, 16, 15, 13, 15, 16, 15, 13, 15, 15, 15, 11, 12, 12, 11,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 15, 12,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 14, 13, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 12,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 13,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 12,
+ 12, 14, 14, 14, 14, 15, 16, 14, 14, 16, 15, 14, 14, 15, 14, 11,
+},
+{
+ 1, 5, 5, 6, 5, 6, 7, 7, 5, 7, 6, 7, 5, 6, 6, 6,
+ 6, 9, 10, 9, 10, 9, 11, 10, 11, 11, 11, 10, 11, 10, 11, 9,
+ 10, 11, 14, 12, 14, 12, 16, 12, 16, 13, 16, 13, 14, 13, 16, 12,
+ 6, 10, 9, 9, 10, 11, 11, 10, 10, 11, 9, 10, 10, 11, 10, 9,
+ 8, 11, 11, 10, 13, 12, 13, 12, 13, 13, 12, 12, 13, 13, 13, 11,
+ 11, 13, 16, 12, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 13,
+ 10, 14, 11, 12, 14, 14, 13, 13, 13, 16, 12, 13, 14, 16, 13, 12,
+ 11, 14, 13, 12, 16, 16, 16, 14, 16, 16, 14, 14, 16, 16, 16, 13,
+ 12, 14, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 6, 10, 10, 11, 9, 9, 11, 10, 10, 11, 11, 11, 9, 10, 10, 9,
+ 9, 12, 13, 12, 12, 11, 13, 12, 13, 13, 13, 13, 12, 12, 13, 11,
+ 12, 13, 16, 16, 16, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 13,
+ 9, 13, 13, 13, 13, 13, 13, 13, 13, 14, 13, 13, 13, 13, 12, 11,
+ 10, 14, 14, 13, 14, 13, 14, 13, 16, 16, 14, 15, 14, 14, 14, 12,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 14, 14, 16, 11, 12, 14, 13, 14, 16, 16, 16, 12, 13, 13, 12,
+ 12, 16, 16, 16, 13, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 13,
+ 13, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 6, 10, 10, 10, 10, 11, 11, 11, 9, 11, 9, 10, 9, 10, 10, 9,
+ 9, 13, 13, 13, 13, 13, 14, 13, 12, 13, 13, 12, 13, 12, 13, 11,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 8, 13, 12, 12, 13, 13, 13, 13, 11, 13, 10, 12, 12, 13, 12, 11,
+ 10, 14, 13, 13, 16, 16, 16, 14, 14, 14, 13, 13, 14, 14, 14, 12,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 11, 16, 13, 16, 16, 16, 16, 16, 14, 16, 12, 13, 16, 16, 14, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 13, 13, 13, 11, 12, 13, 13, 11, 13, 12, 13, 10, 12, 12, 11,
+ 10, 14, 16, 16, 14, 13, 16, 14, 14, 16, 16, 14, 13, 13, 14, 12,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 16, 14, 16, 14, 14, 14, 14, 13, 16, 13, 14, 13, 14, 12, 12,
+ 10, 14, 14, 14, 14, 16, 16, 14, 14, 16, 14, 14, 14, 14, 14, 12,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 14, 14, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 14, 13, 14, 13, 14, 16, 16, 11, 13, 12, 13, 11, 13, 12, 12,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 14, 16, 16, 16, 16, 16, 13, 16, 12, 13, 14, 16, 13, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 14, 16, 12, 16, 16, 16, 14, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 14, 16, 16, 16, 13, 16, 14, 16, 12, 13, 13, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 12, 16, 14, 14,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
+},
+{
+ 1, 5, 5, 6, 5, 6, 7, 8, 5, 7, 6, 8, 6, 7, 7, 7,
+ 5, 9, 10, 10, 10, 10, 12, 11, 10, 11, 11, 11, 10, 11, 12, 10,
+ 9, 11, 13, 12, 13, 12, 16, 14, 16, 14, 16, 16, 16, 13, 16, 13,
+ 5, 10, 9, 10, 10, 11, 11, 11, 10, 11, 9, 11, 10, 11, 11, 10,
+ 8, 11, 11, 11, 12, 13, 13, 13, 12, 13, 12, 12, 13, 13, 13, 12,
+ 11, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 14, 11, 12, 14, 16, 13, 14, 13, 16, 12, 14, 16, 16, 13, 13,
+ 11, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 14, 14, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 10, 11, 11, 9, 10, 11, 11, 10, 12, 11, 12, 9, 11, 11, 11,
+ 8, 12, 13, 13, 11, 11, 14, 13, 13, 14, 13, 16, 12, 12, 13, 12,
+ 11, 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 13, 12, 13, 12, 13, 13, 14, 13, 16, 13, 16, 13, 16, 13, 13,
+ 10, 14, 13, 14, 13, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 14, 16, 16, 11, 12, 14, 16, 13, 16, 16, 16, 12, 14, 13, 13,
+ 11, 16, 16, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 14, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 10, 10, 11, 10, 11, 12, 12, 8, 11, 10, 11, 9, 11, 11, 11,
+ 9, 12, 13, 13, 13, 13, 16, 16, 12, 13, 13, 13, 13, 13, 16, 13,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 13, 11, 13, 12, 13, 13, 14, 11, 13, 10, 13, 12, 14, 12, 12,
+ 10, 14, 13, 14, 16, 16, 16, 16, 13, 16, 13, 14, 16, 16, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 13, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 13, 13, 13, 11, 13, 14, 16, 11, 13, 13, 14, 10, 12, 12, 12,
+ 10, 14, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 13, 16, 14,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 14, 16, 13, 16, 16, 16, 13, 16, 13, 16, 13, 16, 13, 14,
+ 10, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 14, 13, 16, 13, 16, 16, 16, 10, 14, 12, 14, 11, 13, 13, 13,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
+}
};
-static const uint8_t rv34_inter_cbp[NUM_INTER_TABLES][4][CBP_VLC_SIZE] =
+static const uint8_t rv34_inter_cbp[NUM_INTER_TABLES][4][CBP_VLC_SIZE] = {
{
- {
- { 0, 6, 6, 3, 6, 4, 5, 3, 6, 5, 4, 3, 3, 4, 4, 3 },
- { 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 },
- { 0, 7, 7, 4, 7, 5, 5, 4, 7, 5, 5, 4, 5, 4, 4, 1 },
- { 0, 7, 7, 5, 7, 5, 6, 4, 7, 6, 5, 3, 5, 4, 4, 1 }
- },
- {
- { 0, 6, 6, 3, 6, 3, 5, 4, 6, 5, 3, 4, 3, 4, 4, 3 },
- { 0, 6, 6, 4, 6, 4, 4, 4, 6, 4, 4, 3, 4, 4, 4, 2 },
- { 0, 6, 6, 4, 6, 4, 5, 4, 6, 5, 4, 3, 4, 4, 3, 2 },
- { 0, 7, 7, 5, 7, 5, 6, 4, 7, 6, 5, 3, 5, 4, 4, 1 }
- },
- {
- { 0, 6, 6, 3, 6, 3, 5, 4, 6, 5, 3, 4, 3, 4, 4, 3 },
- { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2 },
- { 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 },
- { 0, 7, 7, 5, 7, 5, 6, 4, 7, 6, 5, 3, 5, 4, 4, 1 }
- },
- {
- { 0, 6, 6, 3, 6, 3, 5, 4, 6, 5, 3, 4, 3, 4, 4, 3 },
- { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2 },
- { 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 },
- { 0, 7, 7, 4, 7, 5, 6, 4, 7, 6, 5, 4, 4, 4, 4, 1 }
- },
- {
- { 0, 5, 5, 3, 5, 3, 5, 4, 5, 5, 3, 4, 3, 4, 4, 4 },
- { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 3, 4, 3, 4, 4, 3 },
- { 0, 6, 6, 4, 6, 4, 5, 4, 6, 5, 4, 3, 4, 4, 3, 2 },
- { 0, 7, 7, 4, 7, 5, 6, 4, 7, 6, 5, 4, 4, 4, 4, 1 }
- },
- {
- { 0, 5, 5, 3, 5, 3, 5, 4, 5, 5, 3, 4, 3, 4, 4, 4 },
- { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 3, 4, 3, 4, 4, 3 },
- { 0, 5, 5, 3, 5, 4, 4, 4, 5, 4, 4, 4, 3, 4, 4, 3 },
- { 0, 6, 6, 4, 6, 4, 5, 4, 6, 5, 4, 3, 4, 4, 3, 2 }
- },
- {
- { 0, 4, 4, 3, 4, 3, 5, 5, 4, 5, 3, 5, 3, 5, 4, 5 },
- { 0, 4, 4, 3, 4, 4, 5, 4, 4, 5, 3, 5, 3, 5, 4, 4 },
- { 0, 4, 4, 3, 4, 4, 5, 4, 4, 5, 4, 4, 3, 4, 4, 4 },
- { 0, 4, 4, 3, 5, 4, 5, 4, 5, 5, 4, 4, 3, 4, 4, 3 }
- }
+ { 0, 6, 6, 3, 6, 4, 5, 3, 6, 5, 4, 3, 3, 4, 4, 3 },
+ { 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 },
+ { 0, 7, 7, 4, 7, 5, 5, 4, 7, 5, 5, 4, 5, 4, 4, 1 },
+ { 0, 7, 7, 5, 7, 5, 6, 4, 7, 6, 5, 3, 5, 4, 4, 1 }
+},
+{
+ { 0, 6, 6, 3, 6, 3, 5, 4, 6, 5, 3, 4, 3, 4, 4, 3 },
+ { 0, 6, 6, 4, 6, 4, 4, 4, 6, 4, 4, 3, 4, 4, 4, 2 },
+ { 0, 6, 6, 4, 6, 4, 5, 4, 6, 5, 4, 3, 4, 4, 3, 2 },
+ { 0, 7, 7, 5, 7, 5, 6, 4, 7, 6, 5, 3, 5, 4, 4, 1 }
+},
+{
+ { 0, 6, 6, 3, 6, 3, 5, 4, 6, 5, 3, 4, 3, 4, 4, 3 },
+ { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2 },
+ { 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 },
+ { 0, 7, 7, 5, 7, 5, 6, 4, 7, 6, 5, 3, 5, 4, 4, 1 }
+},
+{
+ { 0, 6, 6, 3, 6, 3, 5, 4, 6, 5, 3, 4, 3, 4, 4, 3 },
+ { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2 },
+ { 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 },
+ { 0, 7, 7, 4, 7, 5, 6, 4, 7, 6, 5, 4, 4, 4, 4, 1 }
+},
+{
+ { 0, 5, 5, 3, 5, 3, 5, 4, 5, 5, 3, 4, 3, 4, 4, 4 },
+ { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 3, 4, 3, 4, 4, 3 },
+ { 0, 6, 6, 4, 6, 4, 5, 4, 6, 5, 4, 3, 4, 4, 3, 2 },
+ { 0, 7, 7, 4, 7, 5, 6, 4, 7, 6, 5, 4, 4, 4, 4, 1 }
+},
+{
+ { 0, 5, 5, 3, 5, 3, 5, 4, 5, 5, 3, 4, 3, 4, 4, 4 },
+ { 0, 5, 5, 3, 5, 4, 5, 4, 5, 5, 3, 4, 3, 4, 4, 3 },
+ { 0, 5, 5, 3, 5, 4, 4, 4, 5, 4, 4, 4, 3, 4, 4, 3 },
+ { 0, 6, 6, 4, 6, 4, 5, 4, 6, 5, 4, 3, 4, 4, 3, 2 }
+},
+{
+ { 0, 4, 4, 3, 4, 3, 5, 5, 4, 5, 3, 5, 3, 5, 4, 5 },
+ { 0, 4, 4, 3, 4, 4, 5, 4, 4, 5, 3, 5, 3, 5, 4, 4 },
+ { 0, 4, 4, 3, 4, 4, 5, 4, 4, 5, 4, 4, 3, 4, 4, 4 },
+ { 0, 4, 4, 3, 5, 4, 5, 4, 5, 5, 4, 4, 3, 4, 4, 3 }
+}
};
-static const uint8_t rv34_table_inter_firstpat[NUM_INTER_TABLES][2][FIRSTBLK_VLC_SIZE] =
-{
- {
- {
- 0, 7, 5, 7, 5, 7, 6, 6, 7, 10, 7, 9, 8, 9, 8, 7,
- 12, 14, 11, 12, 12, 12, 11, 9, 6, 9, 6, 8, 7, 9, 7, 7,
- 8, 11, 8, 9, 9, 10, 9, 8, 13, 15, 12, 12, 12, 13, 11, 9,
- 10, 13, 9, 10, 11, 12, 9, 8, 12, 14, 10, 11, 12, 13, 10, 9,
- 16, 16, 12, 12, 14, 13, 11, 9, 6, 9, 7, 9, 7, 9, 8, 7,
- 9, 11, 9, 10, 9, 10, 9, 8, 14, 16, 12, 12, 13, 13, 11, 9,
- 8, 11, 8, 10, 9, 10, 9, 8, 10, 13, 10, 11, 10, 11, 9, 8,
- 14, 16, 12, 12, 13, 13, 11, 9, 12, 14, 10, 11, 12, 13, 10, 9,
- 13, 16, 11, 12, 13, 13, 10, 9, 16, 16, 13, 12, 14, 14, 11, 9,
- 11, 13, 11, 12, 10, 11, 10, 9, 13, 14, 12, 12, 11, 12, 10, 9,
- 16, 16, 13, 13, 13, 13, 11, 9, 12, 15, 12, 12, 11, 12, 10, 9,
- 13, 16, 13, 13, 12, 12, 11, 9, 16, 16, 14, 13, 13, 13, 11, 9,
- 14, 16, 13, 13, 13, 14, 11, 9, 16, 16, 13, 13, 14, 14, 11, 9,
- 16, 16, 13, 13, 14, 13, 11, 8, 4, 9, 6, 8, 6, 9, 7, 7,
- 8, 11, 8, 9, 9, 10, 8, 8, 13, 15, 12, 12, 13, 13, 11, 9,
- 7, 10, 7, 9, 8, 10, 8, 8, 9, 12, 9, 10, 10, 11, 9, 8,
- 14, 16, 12, 12, 13, 13, 11, 9, 11, 13, 9, 10, 11, 12, 9, 8,
- 12, 14, 10, 11, 12, 13, 10, 9, 16, 16, 13, 12, 14, 14, 11, 9,
- 7, 10, 8, 9, 8, 10, 8, 8, 10, 12, 10, 11, 10, 11, 9, 8,
- 14, 16, 13, 13, 13, 13, 11, 9, 9, 12, 9, 10, 9, 11, 9, 8,
- 11, 13, 10, 11, 10, 11, 10, 9, 15, 16, 13, 13, 13, 13, 11, 9,
- 12, 14, 11, 11, 12, 13, 10, 9, 13, 16, 11, 12, 13, 13, 10, 9,
- 16, 16, 12, 12, 14, 13, 11, 8, 11, 14, 11, 12, 10, 11, 10, 9,
- 13, 15, 12, 13, 11, 12, 10, 9, 16, 16, 14, 13, 13, 13, 11, 9,
- 12, 15, 12, 13, 11, 12, 10, 9, 13, 16, 13, 13, 12, 12, 11, 9,
- 16, 16, 14, 13, 13, 13, 11, 9, 15, 16, 13, 13, 13, 13, 11, 9,
- 16, 16, 13, 13, 13, 13, 11, 9, 16, 16, 13, 12, 13, 13, 10, 7,
- 8, 11, 8, 10, 9, 11, 9, 9, 10, 13, 10, 11, 11, 12, 10, 9,
- 15, 16, 13, 13, 14, 14, 12, 10, 9, 12, 9, 11, 10, 11, 9, 9,
- 12, 14, 11, 11, 11, 12, 10, 9, 16, 16, 13, 13, 14, 14, 12, 10,
- 12, 14, 10, 11, 12, 13, 10, 9, 14, 16, 11, 12, 13, 14, 10, 9,
- 16, 16, 13, 13, 15, 14, 11, 9, 9, 12, 10, 11, 9, 11, 10, 9,
- 12, 14, 11, 12, 11, 12, 10, 9, 16, 16, 14, 13, 14, 14, 12, 10,
- 11, 14, 10, 12, 11, 12, 10, 9, 12, 15, 11, 12, 12, 13, 11, 10,
- 16, 16, 14, 13, 14, 14, 12, 10, 13, 16, 11, 12, 13, 14, 11, 9,
- 14, 16, 12, 12, 13, 14, 11, 9, 16, 16, 13, 13, 14, 14, 11, 9,
- 12, 15, 12, 13, 10, 12, 10, 9, 14, 16, 13, 13, 11, 12, 11, 10,
- 16, 16, 14, 14, 14, 13, 12, 9, 13, 16, 13, 13, 12, 13, 11, 10,
- 14, 16, 13, 13, 12, 13, 11, 10, 16, 16, 14, 14, 13, 13, 12, 9,
- 15, 16, 13, 13, 13, 14, 11, 9, 16, 16, 13, 13, 13, 14, 11, 9,
- 16, 16, 13, 12, 13, 13, 10, 8, 10, 13, 10, 11, 10, 12, 10, 9,
- 12, 14, 11, 12, 12, 13, 11, 10, 16, 16, 13, 13, 14, 14, 12, 9,
- 11, 14, 10, 11, 11, 12, 10, 9, 13, 16, 11, 12, 12, 13, 11, 10,
- 16, 16, 14, 13, 14, 14, 12, 9, 12, 15, 10, 11, 12, 13, 9, 8,
- 14, 16, 11, 11, 13, 14, 10, 8, 16, 16, 12, 12, 14, 14, 10, 8,
- 11, 14, 11, 12, 11, 12, 10, 9, 13, 16, 12, 13, 12, 13, 11, 10,
- 16, 16, 14, 13, 14, 14, 12, 9, 12, 15, 11, 12, 11, 13, 10, 10,
- 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 14, 13, 14, 14, 12, 9,
- 13, 16, 11, 11, 13, 13, 10, 8, 14, 16, 11, 12, 13, 14, 10, 8,
- 16, 16, 12, 12, 14, 14, 10, 8, 12, 15, 12, 13, 10, 11, 10, 9,
- 14, 16, 13, 13, 11, 12, 10, 9, 16, 16, 14, 13, 13, 13, 11, 8,
- 13, 16, 12, 13, 11, 12, 10, 9, 14, 16, 13, 13, 12, 12, 10, 9,
- 16, 16, 14, 13, 13, 12, 10, 8, 14, 16, 12, 12, 12, 13, 10, 8,
- 14, 16, 12, 12, 12, 13, 10, 7, 16, 16, 11, 11, 12, 11, 8, 5,
- },
- {
- 0, 7, 4, 8, 5, 8, 7, 8, 6, 10, 7, 10, 8, 10, 9, 9,
- 13, 16, 12, 13, 13, 14, 12, 12, 4, 10, 6, 9, 8, 11, 8, 9,
- 8, 12, 8, 11, 10, 12, 10, 10, 14, 16, 12, 13, 14, 15, 12, 12,
- 9, 14, 9, 11, 12, 14, 11, 11, 11, 15, 10, 12, 13, 14, 11, 11,
- 15, 16, 13, 14, 15, 16, 13, 12, 5, 10, 7, 10, 7, 10, 9, 9,
- 8, 12, 9, 11, 10, 11, 10, 10, 14, 16, 13, 14, 14, 14, 12, 12,
- 8, 12, 8, 11, 10, 12, 10, 10, 10, 14, 10, 12, 11, 13, 10, 11,
- 15, 16, 13, 14, 14, 15, 13, 12, 11, 16, 10, 12, 13, 15, 11, 11,
- 13, 16, 11, 13, 14, 15, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
- 11, 15, 11, 13, 11, 13, 11, 11, 13, 16, 12, 14, 12, 13, 12, 12,
- 16, 16, 14, 15, 15, 15, 13, 12, 12, 16, 12, 14, 12, 14, 12, 12,
- 14, 16, 13, 14, 13, 14, 12, 12, 16, 16, 14, 16, 16, 16, 13, 12,
- 14, 16, 13, 14, 15, 16, 13, 12, 16, 16, 14, 15, 16, 16, 13, 12,
- 16, 16, 15, 16, 16, 16, 13, 12, 2, 9, 5, 8, 6, 9, 8, 9,
- 7, 11, 8, 10, 9, 11, 9, 10, 13, 16, 12, 13, 14, 14, 12, 12,
- 5, 11, 6, 10, 9, 11, 9, 9, 9, 13, 9, 11, 10, 12, 10, 10,
- 14, 16, 12, 14, 14, 15, 12, 12, 9, 14, 9, 11, 12, 14, 10, 11,
- 11, 16, 10, 12, 13, 14, 11, 11, 16, 16, 13, 14, 15, 16, 13, 12,
- 6, 11, 7, 10, 8, 11, 9, 9, 9, 13, 9, 11, 10, 12, 10, 10,
- 14, 16, 13, 14, 14, 14, 12, 12, 8, 13, 8, 11, 10, 12, 10, 10,
- 10, 13, 10, 12, 11, 13, 10, 11, 14, 16, 13, 14, 14, 15, 12, 12,
- 11, 15, 10, 12, 13, 15, 11, 11, 12, 16, 11, 13, 13, 15, 12, 11,
- 16, 16, 13, 14, 15, 16, 13, 12, 11, 15, 11, 13, 10, 13, 11, 11,
- 13, 16, 12, 14, 12, 13, 12, 11, 16, 16, 14, 15, 15, 15, 13, 12,
- 12, 16, 12, 13, 12, 14, 12, 12, 13, 16, 12, 14, 13, 14, 12, 12,
- 16, 16, 14, 15, 15, 15, 13, 12, 14, 16, 13, 14, 15, 16, 12, 12,
- 16, 16, 13, 14, 15, 16, 12, 12, 16, 16, 14, 15, 16, 16, 13, 12,
- 6, 12, 7, 10, 9, 12, 9, 10, 9, 13, 9, 12, 11, 13, 11, 11,
- 14, 16, 13, 14, 15, 15, 13, 12, 8, 13, 8, 11, 10, 13, 10, 10,
- 10, 14, 10, 12, 12, 14, 11, 11, 15, 16, 13, 14, 16, 16, 13, 12,
- 10, 15, 9, 12, 12, 15, 11, 11, 12, 16, 11, 13, 14, 16, 12, 12,
- 16, 16, 14, 14, 16, 16, 13, 12, 8, 13, 9, 11, 10, 12, 10, 11,
- 11, 14, 11, 12, 11, 13, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
- 10, 14, 10, 12, 11, 13, 11, 11, 11, 15, 11, 13, 12, 14, 11, 11,
- 15, 16, 13, 14, 15, 16, 13, 12, 12, 16, 11, 13, 13, 16, 12, 12,
- 13, 16, 11, 13, 14, 16, 12, 12, 16, 16, 13, 14, 16, 16, 13, 12,
- 12, 16, 12, 14, 11, 13, 11, 11, 13, 16, 13, 14, 12, 14, 12, 12,
- 16, 16, 15, 16, 16, 16, 14, 13, 13, 16, 12, 14, 12, 14, 12, 12,
- 14, 16, 13, 14, 13, 14, 12, 12, 16, 16, 14, 16, 14, 16, 13, 12,
- 15, 16, 13, 15, 15, 16, 13, 12, 15, 16, 13, 15, 14, 16, 13, 12,
- 16, 16, 14, 15, 15, 16, 13, 11, 8, 13, 8, 11, 10, 13, 10, 11,
- 11, 15, 10, 12, 12, 14, 11, 11, 15, 16, 13, 14, 15, 15, 13, 12,
- 9, 14, 9, 12, 11, 14, 10, 11, 11, 16, 10, 12, 13, 14, 11, 11,
- 16, 16, 13, 14, 15, 16, 13, 12, 11, 15, 9, 12, 12, 14, 10, 10,
- 12, 16, 11, 12, 14, 15, 11, 11, 16, 16, 13, 14, 16, 16, 12, 11,
- 9, 14, 10, 12, 11, 13, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
- 16, 16, 14, 14, 15, 15, 13, 12, 10, 15, 10, 12, 12, 14, 11, 11,
- 12, 16, 11, 13, 13, 14, 11, 11, 16, 16, 14, 14, 15, 16, 13, 12,
- 12, 16, 10, 12, 13, 15, 11, 11, 13, 16, 11, 13, 14, 15, 11, 11,
- 16, 16, 13, 13, 15, 16, 12, 11, 12, 16, 11, 13, 10, 13, 11, 11,
- 14, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 14, 15, 13, 11,
- 13, 16, 12, 14, 12, 14, 11, 11, 13, 16, 12, 14, 12, 14, 11, 11,
- 16, 16, 14, 15, 14, 14, 12, 11, 14, 16, 12, 13, 13, 15, 11, 11,
- 14, 16, 12, 13, 13, 14, 11, 11, 15, 16, 12, 13, 13, 13, 10, 9,
- },
- },
- {
- {
- 0, 7, 4, 7, 5, 7, 6, 6, 6, 10, 7, 8, 8, 9, 8, 7,
- 13, 14, 11, 12, 12, 12, 11, 9, 5, 9, 6, 8, 7, 9, 7, 7,
- 8, 11, 8, 9, 9, 10, 9, 8, 13, 16, 12, 12, 12, 13, 11, 9,
- 10, 13, 8, 10, 11, 12, 9, 9, 12, 14, 10, 11, 12, 13, 10, 9,
- 15, 16, 12, 12, 14, 14, 11, 9, 6, 10, 7, 9, 7, 9, 8, 7,
- 8, 11, 9, 10, 9, 10, 9, 8, 14, 16, 12, 12, 13, 12, 11, 9,
- 8, 11, 8, 10, 9, 10, 9, 8, 10, 13, 10, 11, 10, 11, 9, 9,
- 14, 16, 12, 12, 13, 13, 11, 9, 12, 15, 10, 11, 12, 13, 10, 9,
- 13, 16, 11, 12, 13, 13, 10, 9, 16, 16, 12, 13, 14, 14, 11, 9,
- 10, 14, 11, 12, 9, 11, 10, 9, 12, 15, 12, 13, 11, 12, 11, 9,
- 16, 16, 13, 13, 13, 13, 11, 9, 12, 15, 12, 13, 11, 12, 11, 9,
- 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 13, 13, 13, 11, 9,
- 14, 16, 13, 13, 13, 14, 11, 10, 16, 16, 13, 13, 13, 14, 11, 10,
- 16, 16, 13, 13, 14, 14, 11, 9, 4, 9, 6, 8, 6, 9, 7, 7,
- 8, 11, 8, 9, 9, 10, 9, 8, 13, 15, 12, 12, 13, 13, 11, 9,
- 6, 10, 7, 9, 8, 10, 8, 8, 9, 12, 9, 10, 10, 11, 9, 8,
- 14, 16, 12, 12, 13, 13, 11, 10, 10, 13, 8, 10, 11, 12, 9, 9,
- 12, 15, 10, 11, 12, 13, 10, 9, 16, 16, 12, 12, 14, 14, 11, 9,
- 7, 11, 8, 9, 7, 10, 8, 8, 9, 12, 10, 11, 9, 11, 9, 9,
- 14, 16, 12, 13, 13, 13, 11, 10, 9, 12, 9, 10, 9, 11, 9, 9,
- 10, 13, 10, 11, 10, 11, 10, 9, 14, 16, 12, 13, 13, 13, 11, 9,
- 12, 15, 10, 11, 12, 13, 10, 9, 13, 16, 11, 12, 13, 13, 10, 9,
- 16, 16, 12, 12, 14, 14, 11, 9, 10, 14, 11, 12, 9, 11, 10, 9,
- 12, 16, 12, 13, 11, 12, 11, 9, 16, 16, 14, 14, 13, 13, 11, 9,
- 12, 16, 12, 13, 11, 12, 10, 10, 13, 16, 12, 13, 11, 12, 11, 10,
- 16, 16, 13, 13, 13, 13, 11, 9, 14, 16, 13, 13, 13, 14, 11, 9,
- 15, 16, 13, 13, 13, 14, 11, 9, 16, 16, 13, 13, 13, 13, 10, 8,
- 7, 11, 8, 10, 9, 11, 9, 9, 10, 13, 10, 11, 11, 12, 10, 10,
- 15, 16, 13, 13, 14, 14, 12, 10, 9, 13, 9, 11, 10, 12, 10, 9,
- 11, 14, 10, 12, 12, 13, 10, 10, 16, 16, 13, 13, 14, 14, 12, 10,
- 11, 15, 9, 11, 12, 13, 10, 9, 13, 16, 11, 12, 13, 14, 11, 10,
- 16, 16, 13, 13, 15, 15, 11, 10, 9, 13, 10, 11, 9, 11, 10, 9,
- 11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 14, 14, 14, 14, 12, 10,
- 10, 14, 10, 12, 11, 12, 10, 10, 12, 15, 11, 12, 12, 13, 11, 10,
- 16, 16, 13, 13, 14, 14, 12, 10, 13, 16, 11, 12, 13, 14, 11, 10,
- 13, 16, 11, 12, 13, 14, 11, 10, 16, 16, 12, 13, 14, 14, 11, 9,
- 11, 15, 12, 13, 10, 12, 10, 10, 13, 16, 13, 14, 11, 13, 11, 10,
- 16, 16, 14, 14, 14, 14, 12, 10, 13, 16, 13, 13, 11, 13, 11, 10,
- 14, 16, 13, 14, 12, 13, 11, 10, 16, 16, 14, 14, 13, 13, 12, 10,
- 15, 16, 13, 14, 14, 14, 11, 10, 15, 16, 13, 13, 13, 14, 11, 10,
- 16, 16, 12, 13, 13, 13, 10, 8, 9, 13, 10, 11, 10, 12, 10, 10,
- 12, 15, 11, 12, 12, 13, 11, 10, 16, 16, 14, 13, 14, 14, 12, 10,
- 10, 14, 10, 12, 11, 13, 10, 10, 13, 16, 11, 12, 12, 14, 11, 10,
- 16, 16, 13, 13, 14, 14, 12, 10, 12, 16, 9, 11, 12, 14, 10, 9,
- 13, 16, 10, 12, 13, 14, 10, 9, 16, 16, 12, 12, 14, 14, 11, 9,
- 10, 14, 11, 12, 10, 12, 10, 10, 13, 16, 12, 13, 12, 13, 11, 10,
- 16, 16, 14, 14, 14, 14, 12, 10, 11, 16, 11, 12, 11, 13, 11, 10,
- 13, 16, 12, 13, 12, 14, 11, 10, 16, 16, 14, 14, 14, 14, 12, 10,
- 13, 16, 11, 12, 13, 14, 10, 9, 14, 16, 11, 12, 13, 14, 10, 9,
- 16, 16, 12, 12, 14, 14, 10, 8, 12, 16, 12, 13, 10, 12, 10, 9,
- 14, 16, 13, 13, 11, 12, 11, 9, 16, 16, 14, 14, 13, 13, 11, 9,
- 13, 16, 12, 13, 11, 12, 10, 9, 14, 16, 13, 13, 11, 13, 11, 9,
- 16, 16, 14, 14, 13, 13, 11, 9, 14, 16, 12, 13, 12, 13, 10, 8,
- 14, 16, 12, 12, 12, 13, 10, 8, 15, 16, 11, 11, 11, 12, 9, 6,
- },
- {
- 0, 7, 4, 7, 5, 8, 7, 8, 5, 10, 7, 10, 8, 10, 9, 10,
- 13, 16, 12, 14, 14, 14, 13, 12, 4, 10, 6, 9, 8, 11, 9, 9,
- 8, 12, 8, 11, 10, 12, 10, 10, 14, 16, 13, 14, 14, 15, 13, 12,
- 9, 14, 9, 12, 12, 14, 11, 11, 12, 16, 11, 13, 13, 15, 12, 12,
- 15, 16, 14, 15, 15, 16, 13, 13, 5, 10, 7, 10, 7, 10, 9, 9,
- 8, 12, 9, 11, 9, 11, 10, 10, 14, 16, 13, 14, 14, 15, 13, 12,
- 7, 12, 8, 11, 10, 12, 10, 10, 10, 13, 10, 12, 11, 13, 11, 11,
- 15, 16, 13, 15, 14, 16, 13, 13, 11, 16, 11, 13, 13, 16, 12, 12,
- 13, 16, 12, 14, 14, 16, 12, 12, 16, 16, 14, 16, 16, 16, 14, 13,
- 11, 15, 12, 14, 11, 13, 11, 12, 13, 16, 12, 14, 12, 14, 12, 12,
- 16, 16, 14, 16, 14, 16, 13, 13, 13, 16, 12, 14, 12, 14, 12, 12,
- 14, 16, 13, 15, 13, 15, 13, 13, 16, 16, 15, 16, 16, 16, 14, 13,
- 15, 16, 13, 16, 15, 16, 13, 13, 16, 16, 14, 16, 16, 16, 14, 13,
- 16, 16, 16, 16, 16, 16, 14, 13, 2, 9, 5, 8, 6, 9, 8, 9,
- 7, 11, 8, 10, 9, 11, 9, 10, 14, 16, 13, 14, 14, 15, 13, 12,
- 5, 11, 6, 10, 9, 11, 9, 10, 8, 13, 9, 11, 11, 12, 10, 11,
- 14, 16, 13, 14, 14, 16, 13, 13, 9, 15, 9, 12, 12, 14, 11, 11,
- 12, 16, 11, 13, 13, 15, 12, 12, 16, 16, 14, 15, 16, 16, 14, 13,
- 6, 11, 7, 10, 8, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 11,
- 14, 16, 13, 14, 14, 15, 13, 13, 8, 12, 8, 11, 10, 12, 10, 11,
- 9, 13, 10, 12, 11, 13, 11, 11, 14, 16, 13, 14, 14, 16, 13, 13,
- 12, 16, 11, 13, 13, 15, 12, 12, 13, 16, 11, 13, 14, 16, 12, 12,
- 16, 16, 14, 15, 16, 16, 13, 13, 11, 15, 11, 14, 10, 13, 11, 12,
- 13, 16, 13, 15, 12, 14, 12, 12, 16, 16, 15, 16, 15, 16, 14, 13,
- 12, 16, 12, 14, 12, 14, 12, 12, 13, 16, 13, 15, 13, 14, 12, 13,
- 16, 16, 15, 16, 15, 16, 13, 13, 15, 16, 13, 16, 15, 16, 13, 13,
- 16, 16, 14, 16, 16, 16, 13, 13, 16, 16, 15, 16, 16, 16, 14, 13,
- 5, 12, 7, 10, 9, 12, 10, 10, 9, 13, 9, 12, 11, 13, 11, 11,
- 15, 16, 13, 14, 15, 15, 13, 13, 7, 13, 8, 11, 10, 13, 10, 11,
- 10, 14, 10, 12, 12, 14, 11, 12, 16, 16, 14, 15, 16, 16, 14, 13,
- 10, 16, 9, 12, 13, 15, 11, 12, 13, 16, 11, 13, 14, 16, 12, 12,
- 16, 16, 14, 16, 16, 16, 14, 13, 8, 13, 9, 12, 9, 12, 10, 11,
- 11, 15, 11, 13, 11, 13, 11, 12, 16, 16, 14, 16, 16, 16, 14, 13,
- 9, 14, 10, 12, 11, 13, 11, 12, 11, 15, 11, 13, 12, 14, 12, 12,
- 16, 16, 14, 16, 15, 16, 14, 13, 12, 16, 11, 14, 14, 16, 12, 12,
- 13, 16, 12, 14, 14, 16, 13, 13, 16, 16, 13, 15, 16, 16, 14, 13,
- 11, 16, 12, 14, 10, 13, 12, 12, 13, 16, 13, 15, 12, 14, 12, 13,
- 16, 16, 16, 16, 16, 16, 14, 14, 13, 16, 13, 15, 12, 15, 12, 13,
- 13, 16, 13, 15, 12, 15, 13, 13, 16, 16, 15, 16, 14, 16, 14, 13,
- 16, 16, 14, 16, 16, 16, 14, 13, 15, 16, 14, 16, 15, 16, 14, 13,
- 16, 16, 14, 16, 15, 16, 13, 12, 8, 14, 9, 12, 10, 14, 11, 12,
- 11, 16, 10, 13, 12, 14, 12, 12, 16, 16, 14, 15, 15, 16, 14, 13,
- 9, 15, 9, 12, 12, 14, 11, 12, 12, 16, 11, 13, 13, 15, 12, 12,
- 16, 16, 14, 15, 16, 16, 14, 13, 11, 16, 9, 12, 13, 15, 11, 11,
- 13, 16, 11, 13, 14, 16, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
- 9, 15, 10, 13, 11, 14, 11, 12, 12, 16, 11, 14, 12, 14, 12, 12,
- 16, 16, 14, 16, 16, 16, 14, 13, 10, 16, 10, 13, 12, 15, 12, 12,
- 12, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 16, 16, 16, 14, 13,
- 12, 16, 11, 13, 13, 16, 12, 12, 13, 16, 11, 13, 14, 16, 12, 12,
- 16, 16, 13, 14, 16, 16, 13, 12, 11, 16, 12, 14, 10, 13, 11, 12,
- 13, 16, 13, 15, 12, 14, 12, 12, 16, 16, 16, 16, 15, 16, 13, 12,
- 12, 16, 12, 15, 12, 14, 12, 12, 13, 16, 13, 15, 12, 14, 12, 12,
- 16, 16, 15, 16, 14, 15, 13, 12, 14, 16, 13, 14, 13, 16, 12, 12,
- 13, 16, 12, 14, 13, 15, 12, 12, 14, 16, 12, 13, 13, 14, 11, 10,
- },
- },
- {
- {
- 0, 7, 4, 7, 5, 7, 6, 6, 6, 10, 7, 8, 8, 9, 8, 8,
- 13, 14, 11, 12, 12, 12, 11, 10, 5, 9, 6, 8, 7, 9, 7, 7,
- 8, 11, 8, 9, 9, 10, 9, 8, 13, 16, 12, 12, 13, 13, 11, 10,
- 10, 14, 8, 10, 11, 13, 9, 9, 12, 15, 10, 11, 12, 13, 10, 10,
- 16, 16, 12, 13, 14, 14, 11, 10, 5, 10, 7, 9, 6, 9, 8, 8,
- 8, 11, 9, 10, 9, 10, 9, 8, 14, 16, 12, 12, 13, 13, 11, 10,
- 8, 12, 8, 10, 9, 10, 9, 9, 10, 13, 9, 11, 10, 11, 9, 9,
- 14, 16, 12, 13, 13, 13, 11, 10, 12, 16, 10, 12, 12, 13, 10, 10,
- 13, 16, 11, 12, 13, 14, 11, 10, 16, 16, 12, 13, 14, 14, 11, 10,
- 10, 14, 11, 13, 9, 11, 10, 10, 12, 16, 12, 13, 11, 12, 11, 10,
- 16, 16, 13, 14, 13, 13, 12, 10, 12, 16, 12, 13, 11, 13, 11, 10,
- 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 14, 12, 10,
- 14, 16, 13, 14, 13, 14, 12, 11, 16, 16, 13, 14, 14, 15, 12, 11,
- 16, 16, 13, 14, 14, 14, 11, 10, 3, 9, 5, 8, 6, 9, 7, 7,
- 8, 11, 8, 10, 9, 10, 9, 8, 14, 15, 12, 12, 13, 13, 11, 10,
- 6, 11, 6, 9, 8, 10, 8, 8, 9, 12, 9, 10, 10, 11, 9, 9,
- 14, 16, 12, 13, 13, 13, 11, 10, 10, 14, 8, 11, 12, 13, 9, 9,
- 12, 16, 10, 11, 12, 13, 10, 10, 16, 16, 12, 13, 14, 14, 11, 10,
- 6, 11, 8, 10, 7, 10, 8, 8, 9, 12, 10, 11, 9, 11, 9, 9,
- 14, 16, 12, 13, 13, 13, 12, 10, 9, 12, 9, 11, 9, 11, 9, 9,
- 10, 13, 10, 11, 10, 12, 10, 9, 14, 16, 12, 13, 13, 13, 11, 10,
- 12, 16, 10, 12, 12, 14, 10, 10, 13, 16, 10, 12, 13, 14, 11, 10,
- 16, 16, 12, 13, 14, 14, 11, 10, 10, 15, 11, 13, 9, 11, 10, 10,
- 12, 16, 12, 13, 11, 12, 11, 10, 16, 16, 14, 14, 13, 14, 12, 10,
- 12, 16, 12, 13, 11, 13, 11, 10, 13, 16, 12, 13, 11, 13, 11, 10,
- 16, 16, 13, 14, 13, 13, 12, 10, 14, 16, 13, 14, 14, 14, 11, 11,
- 15, 16, 13, 14, 13, 14, 11, 10, 16, 16, 13, 13, 13, 14, 11, 9,
- 7, 12, 8, 11, 9, 11, 9, 10, 10, 14, 10, 12, 11, 12, 11, 10,
- 16, 16, 13, 13, 14, 14, 12, 11, 9, 13, 9, 11, 10, 12, 10, 10,
- 11, 15, 10, 12, 12, 13, 11, 10, 16, 16, 13, 14, 14, 14, 12, 11,
- 11, 16, 9, 11, 12, 14, 10, 10, 13, 16, 10, 12, 13, 14, 11, 10,
- 16, 16, 13, 14, 16, 16, 12, 11, 9, 13, 10, 12, 9, 12, 10, 10,
- 11, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 14, 14, 14, 13, 11,
- 10, 14, 10, 12, 11, 13, 11, 10, 12, 16, 11, 13, 12, 13, 11, 11,
- 16, 16, 13, 14, 14, 14, 12, 11, 13, 16, 11, 13, 13, 14, 11, 11,
- 13, 16, 11, 13, 13, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 10,
- 11, 16, 12, 14, 10, 12, 11, 10, 13, 16, 13, 14, 11, 13, 11, 11,
- 16, 16, 15, 16, 14, 14, 13, 11, 13, 16, 13, 14, 12, 13, 11, 11,
- 13, 16, 13, 14, 12, 13, 11, 11, 16, 16, 14, 14, 13, 14, 12, 11,
- 15, 16, 13, 14, 14, 16, 12, 11, 14, 16, 13, 14, 13, 14, 12, 11,
- 16, 16, 12, 13, 13, 14, 11, 9, 9, 14, 10, 12, 10, 13, 11, 11,
- 12, 16, 12, 13, 12, 14, 12, 11, 16, 16, 14, 14, 14, 14, 13, 11,
- 10, 16, 10, 13, 12, 14, 11, 11, 13, 16, 12, 13, 13, 14, 12, 11,
- 16, 16, 14, 14, 15, 15, 13, 11, 12, 16, 9, 12, 13, 14, 10, 10,
- 14, 16, 11, 12, 13, 15, 11, 10, 16, 16, 13, 13, 15, 16, 11, 10,
- 10, 16, 11, 13, 11, 13, 11, 11, 13, 16, 12, 14, 12, 14, 12, 11,
- 16, 16, 14, 14, 14, 14, 13, 11, 11, 16, 11, 13, 12, 14, 11, 11,
- 13, 16, 12, 14, 13, 14, 12, 11, 16, 16, 14, 14, 14, 15, 13, 11,
- 13, 16, 11, 13, 13, 14, 11, 10, 14, 16, 11, 13, 13, 14, 11, 10,
- 16, 16, 12, 13, 14, 15, 11, 9, 12, 16, 12, 14, 10, 13, 11, 10,
- 14, 16, 13, 14, 11, 13, 11, 10, 16, 16, 14, 15, 13, 14, 12, 10,
- 13, 16, 13, 14, 11, 13, 11, 10, 14, 16, 13, 14, 12, 13, 11, 10,
- 16, 16, 14, 14, 13, 13, 11, 10, 14, 16, 12, 13, 13, 14, 11, 9,
- 14, 16, 12, 13, 12, 13, 10, 9, 14, 16, 11, 11, 12, 12, 9, 7,
- },
- {
- 0, 7, 3, 8, 5, 8, 7, 9, 5, 10, 7, 10, 8, 11, 10, 10,
- 14, 16, 14, 15, 14, 16, 14, 14, 4, 10, 6, 10, 8, 11, 9, 10,
- 8, 12, 9, 11, 10, 12, 11, 11, 15, 16, 14, 16, 15, 16, 14, 14,
- 10, 16, 10, 13, 13, 16, 12, 13, 13, 16, 12, 14, 14, 16, 13, 13,
- 16, 16, 16, 16, 16, 16, 14, 15, 4, 10, 7, 10, 7, 10, 9, 10,
- 8, 12, 9, 12, 10, 12, 11, 12, 14, 16, 14, 16, 15, 16, 14, 14,
- 8, 12, 9, 12, 10, 13, 11, 12, 10, 14, 11, 13, 11, 14, 12, 13,
- 16, 16, 14, 16, 16, 16, 14, 15, 12, 16, 12, 14, 14, 16, 13, 14,
- 14, 16, 13, 16, 16, 16, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 12, 16, 11, 14, 13, 13, 13, 16, 13, 16, 13, 15, 13, 14,
- 16, 16, 16, 16, 16, 16, 15, 16, 13, 16, 13, 16, 13, 16, 13, 14,
- 14, 16, 14, 16, 14, 16, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 2, 9, 5, 9, 6, 10, 8, 10,
- 7, 11, 8, 11, 9, 12, 10, 11, 14, 16, 14, 16, 15, 16, 14, 14,
- 5, 11, 6, 10, 9, 12, 10, 11, 9, 13, 9, 12, 11, 13, 11, 12,
- 16, 16, 14, 16, 16, 16, 14, 14, 10, 16, 9, 13, 13, 16, 12, 13,
- 13, 16, 12, 14, 14, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 14,
- 5, 11, 8, 11, 7, 11, 10, 11, 9, 13, 10, 13, 10, 13, 11, 12,
- 16, 16, 14, 16, 16, 16, 14, 14, 8, 13, 9, 12, 10, 13, 11, 12,
- 10, 14, 10, 13, 11, 14, 12, 12, 16, 16, 14, 16, 15, 16, 14, 14,
- 12, 16, 12, 14, 14, 16, 13, 14, 14, 16, 12, 16, 15, 16, 13, 14,
- 16, 16, 15, 16, 16, 16, 15, 15, 11, 16, 12, 16, 10, 14, 12, 13,
- 13, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 15, 16,
- 13, 16, 13, 16, 13, 16, 13, 14, 14, 16, 14, 16, 13, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16,
- 5, 13, 7, 12, 9, 13, 11, 12, 10, 14, 10, 13, 11, 13, 12, 13,
- 16, 16, 16, 16, 16, 16, 16, 15, 7, 14, 8, 12, 11, 14, 11, 12,
- 11, 16, 11, 13, 13, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 10, 14, 14, 16, 12, 13, 13, 16, 12, 15, 16, 16, 14, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 14, 10, 13, 9, 13, 11, 12,
- 11, 16, 12, 14, 12, 14, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 11, 14, 12, 14, 12, 13, 11, 16, 12, 14, 12, 15, 13, 13,
- 16, 16, 15, 16, 16, 16, 15, 16, 13, 16, 12, 16, 15, 16, 14, 14,
- 13, 16, 12, 16, 16, 16, 14, 14, 16, 16, 14, 16, 16, 16, 14, 16,
- 11, 16, 13, 16, 10, 14, 12, 13, 14, 16, 14, 16, 13, 16, 14, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 14, 16, 13, 16, 14, 15,
- 13, 16, 14, 16, 13, 16, 14, 15, 16, 16, 16, 16, 15, 16, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 16,
- 16, 16, 15, 16, 16, 16, 14, 14, 8, 16, 10, 14, 11, 16, 12, 13,
- 12, 16, 12, 14, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 16, 10, 14, 12, 16, 12, 13, 13, 16, 12, 15, 14, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 16, 15, 11, 16, 10, 13, 13, 16, 12, 13,
- 14, 16, 12, 14, 15, 16, 13, 13, 16, 16, 16, 16, 16, 16, 15, 14,
- 10, 16, 11, 14, 11, 16, 12, 13, 13, 16, 13, 16, 13, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 16, 15, 11, 16, 12, 14, 13, 16, 13, 14,
- 13, 16, 13, 16, 14, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 15,
- 13, 16, 12, 14, 14, 16, 13, 13, 13, 16, 12, 15, 14, 16, 13, 13,
- 16, 16, 14, 16, 16, 16, 14, 13, 11, 16, 12, 16, 11, 15, 12, 13,
- 14, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
- 12, 16, 13, 16, 12, 16, 13, 14, 13, 16, 14, 16, 13, 16, 13, 14,
- 16, 16, 16, 16, 14, 16, 14, 14, 14, 16, 13, 16, 14, 16, 13, 13,
- 13, 16, 13, 16, 14, 16, 13, 13, 15, 16, 13, 14, 13, 15, 12, 12,
- },
- },
- {
- {
- 0, 7, 4, 6, 4, 7, 6, 7, 6, 9, 7, 8, 7, 9, 8, 8,
- 13, 14, 12, 12, 12, 13, 11, 11, 5, 9, 5, 8, 7, 9, 7, 8,
- 8, 11, 8, 10, 9, 10, 9, 9, 13, 15, 12, 13, 12, 13, 11, 11,
- 9, 14, 8, 11, 11, 13, 10, 10, 11, 15, 10, 12, 12, 13, 10, 11,
- 14, 16, 12, 13, 14, 14, 12, 11, 5, 9, 7, 9, 6, 9, 8, 8,
- 8, 11, 8, 10, 8, 10, 9, 9, 13, 16, 12, 13, 13, 13, 11, 11,
- 7, 11, 8, 10, 9, 11, 9, 9, 9, 13, 9, 11, 10, 11, 10, 10,
- 14, 16, 12, 13, 13, 13, 12, 11, 11, 16, 10, 12, 12, 14, 11, 11,
- 13, 16, 11, 13, 13, 14, 11, 11, 16, 16, 13, 14, 14, 15, 12, 11,
- 10, 15, 11, 13, 9, 12, 10, 10, 12, 16, 12, 13, 11, 12, 11, 11,
- 15, 16, 13, 14, 13, 14, 12, 11, 12, 16, 12, 14, 11, 13, 11, 11,
- 13, 16, 12, 14, 12, 13, 12, 11, 16, 16, 13, 14, 14, 14, 12, 11,
- 14, 16, 13, 14, 14, 15, 12, 12, 16, 16, 13, 14, 14, 16, 12, 12,
- 16, 16, 14, 14, 14, 15, 12, 11, 3, 9, 5, 8, 6, 9, 7, 8,
- 7, 11, 8, 10, 9, 10, 9, 9, 13, 14, 12, 13, 13, 13, 12, 11,
- 6, 11, 6, 9, 8, 10, 8, 9, 9, 12, 8, 10, 10, 11, 9, 10,
- 14, 16, 12, 13, 13, 14, 12, 11, 9, 14, 8, 11, 11, 13, 10, 10,
- 12, 16, 10, 12, 12, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 11,
- 6, 11, 8, 10, 7, 10, 8, 9, 9, 12, 9, 11, 9, 11, 10, 10,
- 14, 16, 13, 13, 13, 14, 12, 11, 8, 12, 9, 11, 9, 11, 9, 10,
- 10, 13, 9, 11, 10, 12, 10, 10, 14, 16, 12, 13, 13, 14, 12, 11,
- 12, 16, 10, 12, 12, 14, 11, 11, 12, 16, 10, 12, 13, 14, 11, 11,
- 15, 16, 12, 13, 14, 14, 11, 11, 10, 15, 11, 13, 9, 12, 10, 10,
- 12, 16, 12, 14, 11, 13, 11, 11, 16, 16, 14, 14, 14, 14, 12, 11,
- 12, 16, 12, 14, 11, 13, 11, 11, 13, 16, 12, 14, 11, 13, 11, 11,
- 16, 16, 13, 14, 13, 14, 12, 11, 14, 16, 13, 14, 14, 15, 12, 11,
- 14, 16, 13, 14, 13, 15, 12, 11, 16, 16, 13, 14, 13, 14, 11, 10,
- 6, 13, 8, 11, 9, 12, 10, 10, 10, 14, 10, 12, 11, 13, 11, 11,
- 16, 16, 13, 14, 14, 14, 13, 12, 8, 14, 8, 12, 10, 13, 10, 11,
- 11, 15, 10, 12, 12, 13, 11, 11, 16, 16, 14, 14, 15, 16, 13, 12,
- 11, 16, 9, 12, 12, 14, 11, 11, 13, 16, 11, 13, 13, 16, 11, 11,
- 16, 16, 13, 14, 16, 16, 13, 12, 8, 14, 10, 12, 9, 12, 10, 11,
- 11, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 15, 14, 15, 13, 12,
- 10, 15, 10, 13, 11, 13, 11, 11, 11, 15, 11, 13, 12, 13, 11, 11,
- 16, 16, 13, 15, 14, 15, 13, 12, 12, 16, 11, 13, 13, 15, 11, 11,
- 13, 16, 11, 13, 13, 15, 11, 11, 16, 16, 12, 14, 14, 16, 12, 11,
- 11, 16, 12, 14, 10, 13, 11, 11, 13, 16, 13, 15, 12, 14, 12, 12,
- 16, 16, 15, 16, 14, 15, 13, 12, 12, 16, 13, 14, 12, 14, 12, 12,
- 13, 16, 13, 14, 12, 14, 12, 12, 16, 16, 14, 15, 13, 14, 12, 12,
- 15, 16, 13, 15, 14, 16, 12, 12, 14, 16, 13, 14, 13, 15, 12, 12,
- 15, 16, 12, 13, 13, 14, 11, 10, 9, 15, 10, 13, 11, 14, 11, 12,
- 12, 16, 12, 14, 12, 14, 12, 12, 16, 16, 14, 14, 14, 15, 13, 12,
- 10, 16, 10, 13, 12, 14, 12, 12, 13, 16, 12, 14, 13, 15, 12, 12,
- 16, 16, 14, 14, 15, 16, 13, 12, 11, 16, 9, 12, 13, 15, 11, 11,
- 14, 16, 11, 13, 14, 16, 11, 11, 16, 16, 13, 14, 16, 16, 12, 11,
- 10, 16, 11, 14, 11, 14, 12, 12, 13, 16, 13, 14, 12, 14, 12, 12,
- 16, 16, 14, 15, 15, 15, 13, 12, 11, 16, 12, 14, 12, 15, 12, 12,
- 13, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 15, 15, 16, 13, 12,
- 12, 16, 11, 13, 13, 15, 11, 11, 13, 16, 11, 13, 13, 15, 11, 11,
- 16, 16, 12, 13, 14, 16, 12, 10, 11, 16, 12, 14, 10, 13, 11, 11,
- 14, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 14, 14, 12, 11,
- 12, 16, 13, 14, 11, 14, 11, 11, 13, 16, 13, 14, 12, 14, 11, 11,
- 16, 16, 14, 15, 13, 14, 12, 11, 14, 16, 12, 14, 13, 14, 11, 10,
- 13, 16, 12, 13, 12, 14, 11, 10, 14, 16, 11, 12, 12, 12, 10, 8,
- },
- {
- 0, 8, 4, 9, 5, 9, 8, 10, 6, 11, 8, 11, 9, 12, 11, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 6, 11, 9, 12, 10, 12,
- 9, 13, 10, 13, 11, 16, 12, 13, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 11, 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 8, 12, 7, 12, 10, 12,
- 8, 13, 10, 13, 10, 13, 12, 14, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 13, 10, 14, 11, 16, 12, 14, 11, 16, 12, 16, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 14, 16, 12, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 10, 5, 10, 7, 11, 9, 11,
- 8, 12, 9, 12, 10, 13, 12, 13, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 12, 7, 12, 10, 13, 11, 12, 9, 16, 10, 13, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 14, 16,
- 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 6, 12, 9, 13, 8, 12, 11, 13, 10, 16, 11, 16, 11, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 10, 14, 11, 16, 12, 16,
- 10, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 14, 16, 11, 16, 14, 16,
- 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 6, 16, 9, 13, 10, 16, 12, 14, 11, 16, 12, 16, 12, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 9, 14, 12, 16, 13, 16,
- 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 10, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 10, 16, 12, 16,
- 12, 16, 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 13, 16, 14, 16, 11, 16, 13, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16,
- 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 11, 16, 14, 16, 16, 16, 16, 16, 14, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 12, 16, 13, 16,
- 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 11, 16, 13, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 13, 16,
- 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 12, 16, 13, 16, 13, 16, 16, 16, 14, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 14, 16, 16, 16,
- 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 12, 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 11, 16, 13, 16,
- 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 15,
- },
- },
- {
- {
- 0, 7, 3, 7, 4, 7, 6, 7, 6, 9, 7, 9, 7, 9, 8, 9,
- 13, 14, 12, 13, 13, 13, 12, 12, 4, 9, 5, 9, 7, 9, 8, 9,
- 7, 11, 8, 10, 9, 11, 9, 10, 13, 16, 12, 14, 13, 14, 12, 12,
- 9, 14, 8, 12, 12, 14, 10, 11, 11, 16, 10, 13, 13, 14, 11, 12,
- 15, 16, 13, 14, 14, 16, 12, 12, 5, 10, 7, 9, 6, 9, 8, 9,
- 8, 11, 8, 11, 8, 10, 9, 10, 14, 16, 12, 14, 13, 14, 12, 12,
- 7, 12, 8, 11, 9, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 11,
- 14, 16, 12, 14, 13, 14, 12, 12, 12, 16, 11, 13, 13, 15, 11, 12,
- 13, 16, 11, 14, 13, 15, 12, 12, 15, 16, 13, 15, 14, 16, 13, 13,
- 10, 15, 12, 14, 9, 13, 11, 12, 12, 16, 12, 14, 11, 13, 12, 12,
- 15, 16, 13, 15, 14, 15, 13, 13, 12, 16, 12, 14, 12, 14, 12, 12,
- 13, 16, 13, 14, 12, 14, 12, 12, 16, 16, 14, 15, 14, 16, 13, 13,
- 15, 16, 13, 15, 14, 16, 12, 13, 16, 16, 14, 16, 14, 16, 13, 13,
- 16, 16, 14, 16, 15, 16, 13, 13, 3, 9, 5, 9, 6, 9, 8, 9,
- 7, 11, 8, 10, 9, 11, 9, 10, 14, 15, 13, 14, 13, 14, 12, 12,
- 5, 11, 6, 10, 8, 11, 9, 10, 9, 12, 9, 11, 10, 12, 10, 11,
- 14, 16, 13, 14, 14, 15, 13, 13, 9, 15, 8, 12, 12, 14, 10, 11,
- 12, 16, 10, 13, 13, 15, 11, 12, 15, 16, 13, 14, 14, 16, 13, 13,
- 6, 11, 8, 11, 7, 10, 9, 10, 9, 13, 10, 12, 9, 12, 10, 11,
- 14, 16, 13, 14, 14, 14, 13, 13, 8, 13, 9, 12, 9, 12, 10, 11,
- 9, 13, 9, 12, 10, 12, 10, 11, 14, 16, 12, 14, 13, 14, 12, 12,
- 12, 16, 11, 13, 13, 15, 11, 12, 12, 16, 11, 13, 13, 15, 11, 12,
- 14, 16, 12, 14, 14, 15, 12, 12, 10, 15, 11, 14, 9, 13, 11, 12,
- 12, 16, 12, 14, 11, 14, 12, 12, 16, 16, 14, 16, 14, 15, 13, 13,
- 12, 16, 12, 14, 11, 14, 12, 12, 12, 16, 13, 14, 11, 14, 12, 12,
- 15, 16, 14, 15, 13, 15, 12, 13, 14, 16, 13, 15, 14, 16, 13, 13,
- 14, 16, 13, 15, 14, 16, 12, 13, 15, 16, 13, 15, 13, 15, 12, 12,
- 6, 13, 8, 12, 9, 12, 10, 11, 10, 14, 11, 13, 11, 13, 12, 12,
- 15, 16, 14, 15, 15, 15, 14, 13, 8, 14, 9, 12, 11, 13, 11, 12,
- 11, 15, 11, 13, 12, 14, 12, 12, 16, 16, 14, 15, 15, 16, 14, 14,
- 10, 16, 9, 13, 12, 15, 11, 12, 13, 16, 11, 14, 13, 16, 12, 12,
- 16, 16, 14, 15, 16, 16, 13, 13, 8, 14, 10, 13, 9, 13, 11, 12,
- 11, 15, 12, 14, 11, 14, 12, 12, 16, 16, 15, 16, 15, 16, 14, 14,
- 10, 15, 10, 13, 11, 14, 11, 12, 11, 15, 11, 14, 12, 14, 12, 12,
- 15, 16, 14, 15, 14, 16, 13, 13, 12, 16, 11, 14, 13, 16, 12, 12,
- 12, 16, 11, 14, 13, 15, 12, 12, 15, 16, 12, 14, 15, 16, 13, 13,
- 11, 16, 12, 14, 10, 14, 11, 12, 13, 16, 13, 16, 12, 14, 12, 13,
- 16, 16, 16, 16, 15, 16, 14, 13, 12, 16, 13, 15, 12, 14, 12, 13,
- 13, 16, 13, 15, 12, 14, 12, 13, 16, 16, 14, 16, 13, 15, 13, 13,
- 15, 16, 14, 16, 14, 16, 13, 13, 14, 16, 13, 15, 13, 16, 13, 13,
- 14, 16, 12, 14, 13, 14, 12, 12, 9, 16, 11, 14, 11, 15, 12, 13,
- 13, 16, 12, 14, 12, 15, 13, 13, 16, 16, 14, 15, 15, 15, 14, 13,
- 11, 16, 11, 14, 12, 16, 12, 13, 13, 16, 12, 14, 13, 16, 13, 13,
- 16, 16, 14, 15, 16, 16, 14, 13, 11, 16, 10, 13, 13, 16, 11, 12,
- 14, 16, 11, 14, 14, 16, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
- 11, 16, 12, 14, 11, 15, 12, 13, 13, 16, 13, 15, 13, 16, 13, 13,
- 16, 16, 15, 16, 15, 16, 14, 13, 11, 16, 12, 15, 12, 16, 12, 13,
- 13, 16, 13, 15, 13, 16, 13, 13, 16, 16, 15, 16, 15, 16, 14, 13,
- 12, 16, 11, 14, 13, 16, 12, 12, 13, 16, 11, 14, 13, 16, 12, 12,
- 16, 16, 13, 14, 15, 16, 12, 12, 11, 16, 12, 14, 10, 14, 11, 12,
- 14, 16, 13, 15, 12, 15, 12, 12, 16, 16, 16, 16, 14, 15, 13, 12,
- 12, 16, 13, 15, 12, 14, 12, 12, 13, 16, 13, 15, 12, 14, 12, 12,
- 16, 16, 14, 16, 14, 15, 12, 12, 14, 16, 13, 15, 13, 16, 11, 12,
- 13, 16, 12, 14, 13, 15, 11, 11, 14, 16, 12, 13, 12, 13, 11, 10,
- },
- {
- 0, 8, 4, 9, 5, 10, 9, 11, 5, 11, 9, 12, 9, 13, 12, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 6, 12, 9, 13, 11, 13,
- 9, 16, 10, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 12, 8, 13, 7, 12, 11, 16,
- 8, 16, 11, 16, 11, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 10, 16, 11, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 10, 6, 11, 7, 12, 10, 13,
- 7, 12, 10, 13, 10, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 13, 7, 12, 10, 16, 12, 16, 10, 16, 11, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 16, 16,
- 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 13, 9, 16, 8, 16, 12, 16, 9, 16, 12, 16, 11, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 12, 16, 13, 16,
- 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 6, 16, 9, 16, 10, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 9, 16, 12, 16, 13, 16,
- 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 10, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 11, 16, 13, 16,
- 12, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 13, 16, 16, 16, 11, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 11, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 16, 16,
- 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 7, 4, 8, 4, 8, 7, 8, 6, 10, 7, 10, 8, 10, 9, 10,
- 13, 16, 13, 15, 13, 15, 13, 14, 4, 10, 5, 10, 7, 10, 9, 10,
- 7, 12, 8, 11, 9, 12, 10, 11, 13, 16, 13, 15, 13, 16, 13, 14,
- 9, 16, 9, 13, 12, 16, 11, 13, 11, 16, 11, 14, 13, 16, 12, 14,
- 15, 16, 14, 16, 15, 16, 14, 14, 4, 10, 7, 10, 6, 10, 9, 10,
- 8, 12, 9, 12, 9, 11, 10, 12, 13, 16, 13, 16, 14, 16, 13, 14,
- 7, 12, 8, 12, 9, 12, 10, 12, 9, 13, 10, 13, 10, 13, 11, 12,
- 14, 16, 13, 16, 14, 16, 13, 14, 12, 16, 11, 14, 13, 16, 12, 14,
- 13, 16, 12, 16, 14, 16, 13, 14, 16, 16, 14, 16, 15, 16, 14, 14,
- 10, 16, 12, 15, 10, 14, 12, 13, 12, 16, 13, 16, 12, 14, 13, 14,
- 15, 16, 14, 16, 14, 16, 14, 14, 12, 16, 13, 16, 12, 16, 13, 14,
- 13, 16, 13, 16, 13, 16, 13, 14, 16, 16, 14, 16, 15, 16, 14, 15,
- 15, 16, 14, 16, 15, 16, 13, 15, 16, 16, 14, 16, 15, 16, 14, 15,
- 16, 16, 16, 16, 16, 16, 15, 15, 2, 9, 5, 10, 6, 10, 8, 10,
- 7, 11, 8, 11, 9, 11, 10, 11, 14, 16, 13, 15, 14, 15, 14, 14,
- 5, 11, 6, 11, 8, 12, 9, 11, 8, 13, 9, 12, 10, 13, 11, 12,
- 14, 16, 13, 15, 14, 16, 14, 14, 9, 16, 8, 13, 12, 16, 11, 13,
- 12, 16, 11, 14, 13, 16, 12, 13, 16, 16, 14, 16, 15, 16, 14, 15,
- 5, 12, 8, 11, 7, 11, 9, 11, 9, 13, 10, 13, 10, 13, 11, 12,
- 14, 16, 14, 16, 14, 16, 14, 15, 8, 13, 9, 13, 10, 13, 11, 12,
- 9, 13, 10, 13, 10, 13, 11, 13, 13, 16, 13, 15, 13, 16, 13, 14,
- 12, 16, 11, 14, 13, 16, 12, 14, 12, 16, 11, 14, 13, 16, 12, 14,
- 14, 16, 13, 16, 14, 16, 13, 14, 10, 16, 12, 15, 9, 14, 11, 13,
- 12, 16, 13, 16, 12, 15, 12, 14, 16, 16, 15, 16, 15, 16, 14, 14,
- 12, 16, 13, 16, 12, 16, 12, 14, 12, 16, 13, 16, 12, 15, 13, 14,
- 15, 16, 14, 16, 14, 16, 14, 14, 15, 16, 14, 16, 14, 16, 14, 15,
- 14, 16, 13, 16, 14, 16, 13, 14, 16, 16, 14, 16, 14, 16, 13, 14,
- 6, 14, 9, 13, 9, 14, 11, 12, 10, 14, 11, 13, 11, 14, 12, 13,
- 16, 16, 15, 16, 15, 16, 14, 15, 8, 15, 9, 13, 11, 14, 11, 13,
- 11, 16, 11, 14, 12, 15, 12, 14, 16, 16, 15, 16, 16, 16, 15, 16,
- 10, 16, 9, 14, 12, 16, 12, 13, 13, 16, 11, 15, 14, 16, 13, 14,
- 16, 16, 15, 16, 16, 16, 15, 16, 8, 15, 10, 13, 10, 14, 11, 13,
- 11, 16, 12, 14, 12, 14, 12, 14, 16, 16, 16, 16, 16, 16, 15, 16,
- 10, 16, 11, 14, 11, 15, 12, 13, 11, 16, 11, 14, 12, 15, 12, 14,
- 16, 16, 14, 16, 15, 16, 14, 15, 12, 16, 11, 15, 13, 16, 13, 14,
- 12, 16, 11, 14, 13, 16, 13, 14, 15, 16, 13, 16, 16, 16, 14, 15,
- 10, 16, 12, 15, 10, 15, 12, 13, 13, 16, 13, 16, 12, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 15, 15, 12, 16, 13, 16, 12, 16, 13, 14,
- 12, 16, 13, 16, 12, 16, 13, 14, 16, 16, 15, 16, 14, 16, 14, 15,
- 15, 16, 14, 16, 15, 16, 14, 15, 14, 16, 13, 16, 14, 16, 13, 14,
- 14, 16, 13, 15, 14, 16, 13, 14, 9, 16, 11, 16, 11, 16, 12, 14,
- 13, 16, 12, 16, 13, 16, 13, 14, 16, 16, 15, 16, 16, 16, 15, 15,
- 11, 16, 11, 16, 12, 16, 13, 14, 13, 16, 12, 16, 13, 16, 13, 14,
- 16, 16, 15, 16, 16, 16, 15, 15, 11, 16, 10, 15, 13, 16, 12, 13,
- 14, 16, 12, 16, 14, 16, 13, 14, 16, 16, 15, 16, 16, 16, 14, 14,
- 11, 16, 12, 16, 11, 16, 13, 14, 13, 16, 13, 16, 13, 16, 13, 14,
- 16, 16, 16, 16, 16, 16, 15, 15, 11, 16, 12, 16, 12, 16, 13, 14,
- 13, 16, 13, 16, 13, 16, 13, 14, 16, 16, 15, 16, 16, 16, 15, 14,
- 12, 16, 12, 15, 13, 16, 12, 14, 13, 16, 12, 16, 14, 16, 13, 14,
- 16, 16, 14, 16, 16, 16, 14, 14, 11, 16, 12, 16, 11, 16, 12, 14,
- 14, 16, 14, 16, 12, 16, 13, 14, 16, 16, 16, 16, 16, 16, 15, 14,
- 12, 16, 13, 16, 12, 16, 12, 14, 13, 16, 13, 16, 12, 16, 13, 14,
- 16, 16, 16, 16, 15, 16, 14, 14, 14, 16, 13, 16, 14, 16, 12, 14,
- 13, 16, 13, 16, 13, 16, 12, 13, 15, 16, 13, 14, 14, 15, 13, 13,
- },
- {
- 0, 8, 4, 10, 5, 11, 10, 16, 5, 12, 9, 16, 10, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 12, 7, 12, 9, 16, 12, 16,
- 9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 12, 9, 16, 8, 16, 12, 16,
- 8, 16, 11, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 8, 16, 11, 16, 12, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 11, 6, 12, 7, 16, 11, 16,
- 7, 16, 10, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 7, 16, 10, 16, 12, 16, 9, 16, 11, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 10, 16, 8, 16, 12, 16, 9, 16, 12, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 12, 16, 16, 16,
- 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 9, 16, 10, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 9, 16, 12, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 11, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 12, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 9, 16, 16, 16, 16, 16,
- 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 8, 4, 10, 5, 9, 8, 10, 6, 11, 8, 12, 8, 11, 10, 13,
- 14, 16, 14, 16, 14, 16, 16, 16, 3, 11, 5, 11, 8, 12, 10, 12,
- 7, 12, 9, 13, 10, 13, 11, 13, 14, 16, 14, 16, 16, 16, 16, 16,
- 9, 16, 9, 16, 12, 16, 12, 16, 11, 16, 11, 16, 14, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 7, 12, 6, 11, 10, 12,
- 8, 13, 9, 13, 9, 13, 11, 14, 13, 16, 14, 16, 14, 16, 16, 16,
- 7, 13, 9, 13, 9, 13, 11, 13, 9, 14, 10, 16, 11, 16, 12, 16,
- 15, 16, 14, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 13, 16,
- 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 10, 16, 13, 16, 12, 16, 13, 16, 12, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 13, 16, 14, 16,
- 13, 16, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 2, 10, 5, 11, 6, 11, 9, 11,
- 7, 12, 9, 13, 9, 13, 11, 13, 14, 16, 16, 16, 16, 16, 16, 16,
- 4, 12, 6, 12, 8, 13, 10, 13, 8, 13, 9, 13, 11, 16, 12, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 8, 16, 12, 16, 12, 16,
- 12, 16, 11, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 12, 8, 13, 7, 13, 10, 13, 8, 14, 10, 14, 10, 14, 12, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 14, 9, 16, 10, 16, 11, 14,
- 8, 14, 10, 16, 11, 16, 12, 16, 13, 16, 14, 16, 16, 16, 16, 16,
- 11, 16, 11, 16, 13, 16, 13, 16, 12, 16, 12, 16, 14, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 12, 16, 10, 16, 12, 16,
- 12, 16, 13, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 13, 16, 12, 16, 14, 16, 12, 16, 13, 16, 12, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 6, 16, 8, 16, 9, 16, 11, 13, 10, 16, 11, 16, 11, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 9, 16, 10, 16, 12, 16,
- 11, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 9, 16, 12, 16, 13, 16, 13, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 10, 16, 9, 16, 12, 16,
- 11, 16, 12, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 11, 16, 11, 16, 12, 16, 11, 16, 12, 16, 13, 16, 13, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 14, 16,
- 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 10, 16, 13, 16, 13, 16, 14, 16, 13, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 12, 16, 14, 16,
- 12, 16, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 11, 16, 13, 16,
- 12, 16, 13, 16, 13, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 11, 16, 13, 16, 13, 16, 13, 16, 13, 16, 14, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 14, 16, 13, 16,
- 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 12, 16, 12, 16, 13, 16, 13, 16, 13, 16, 13, 16, 14, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 12, 16, 13, 16, 14, 16,
- 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 12, 16, 14, 16, 14, 16, 14, 16, 14, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 11, 16, 14, 16,
- 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 14, 16, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 0, 10, 4, 12, 5, 16, 11, 16, 6, 16, 10, 16, 11, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 3, 16, 7, 16, 10, 16, 16, 16,
- 9, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 4, 16, 10, 16, 9, 16, 16, 16,
- 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 12, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 6, 16, 8, 16, 16, 16,
- 8, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 8, 16, 11, 16, 16, 16, 10, 16, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 11, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 11, 16, 9, 16, 16, 16, 10, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 12, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 5, 16, 9, 16, 11, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 10, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 16, 16, 11, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 11, 16, 15, 16, 16, 16,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 9, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 9, 16, 16, 16, 16, 16,
- 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
+static const uint8_t rv34_table_inter_firstpat[NUM_INTER_TABLES][2][FIRSTBLK_VLC_SIZE] = {
+ {
+ {
+ 0, 7, 5, 7, 5, 7, 6, 6, 7, 10, 7, 9, 8, 9, 8, 7,
+ 12, 14, 11, 12, 12, 12, 11, 9, 6, 9, 6, 8, 7, 9, 7, 7,
+ 8, 11, 8, 9, 9, 10, 9, 8, 13, 15, 12, 12, 12, 13, 11, 9,
+ 10, 13, 9, 10, 11, 12, 9, 8, 12, 14, 10, 11, 12, 13, 10, 9,
+ 16, 16, 12, 12, 14, 13, 11, 9, 6, 9, 7, 9, 7, 9, 8, 7,
+ 9, 11, 9, 10, 9, 10, 9, 8, 14, 16, 12, 12, 13, 13, 11, 9,
+ 8, 11, 8, 10, 9, 10, 9, 8, 10, 13, 10, 11, 10, 11, 9, 8,
+ 14, 16, 12, 12, 13, 13, 11, 9, 12, 14, 10, 11, 12, 13, 10, 9,
+ 13, 16, 11, 12, 13, 13, 10, 9, 16, 16, 13, 12, 14, 14, 11, 9,
+ 11, 13, 11, 12, 10, 11, 10, 9, 13, 14, 12, 12, 11, 12, 10, 9,
+ 16, 16, 13, 13, 13, 13, 11, 9, 12, 15, 12, 12, 11, 12, 10, 9,
+ 13, 16, 13, 13, 12, 12, 11, 9, 16, 16, 14, 13, 13, 13, 11, 9,
+ 14, 16, 13, 13, 13, 14, 11, 9, 16, 16, 13, 13, 14, 14, 11, 9,
+ 16, 16, 13, 13, 14, 13, 11, 8, 4, 9, 6, 8, 6, 9, 7, 7,
+ 8, 11, 8, 9, 9, 10, 8, 8, 13, 15, 12, 12, 13, 13, 11, 9,
+ 7, 10, 7, 9, 8, 10, 8, 8, 9, 12, 9, 10, 10, 11, 9, 8,
+ 14, 16, 12, 12, 13, 13, 11, 9, 11, 13, 9, 10, 11, 12, 9, 8,
+ 12, 14, 10, 11, 12, 13, 10, 9, 16, 16, 13, 12, 14, 14, 11, 9,
+ 7, 10, 8, 9, 8, 10, 8, 8, 10, 12, 10, 11, 10, 11, 9, 8,
+ 14, 16, 13, 13, 13, 13, 11, 9, 9, 12, 9, 10, 9, 11, 9, 8,
+ 11, 13, 10, 11, 10, 11, 10, 9, 15, 16, 13, 13, 13, 13, 11, 9,
+ 12, 14, 11, 11, 12, 13, 10, 9, 13, 16, 11, 12, 13, 13, 10, 9,
+ 16, 16, 12, 12, 14, 13, 11, 8, 11, 14, 11, 12, 10, 11, 10, 9,
+ 13, 15, 12, 13, 11, 12, 10, 9, 16, 16, 14, 13, 13, 13, 11, 9,
+ 12, 15, 12, 13, 11, 12, 10, 9, 13, 16, 13, 13, 12, 12, 11, 9,
+ 16, 16, 14, 13, 13, 13, 11, 9, 15, 16, 13, 13, 13, 13, 11, 9,
+ 16, 16, 13, 13, 13, 13, 11, 9, 16, 16, 13, 12, 13, 13, 10, 7,
+ 8, 11, 8, 10, 9, 11, 9, 9, 10, 13, 10, 11, 11, 12, 10, 9,
+ 15, 16, 13, 13, 14, 14, 12, 10, 9, 12, 9, 11, 10, 11, 9, 9,
+ 12, 14, 11, 11, 11, 12, 10, 9, 16, 16, 13, 13, 14, 14, 12, 10,
+ 12, 14, 10, 11, 12, 13, 10, 9, 14, 16, 11, 12, 13, 14, 10, 9,
+ 16, 16, 13, 13, 15, 14, 11, 9, 9, 12, 10, 11, 9, 11, 10, 9,
+ 12, 14, 11, 12, 11, 12, 10, 9, 16, 16, 14, 13, 14, 14, 12, 10,
+ 11, 14, 10, 12, 11, 12, 10, 9, 12, 15, 11, 12, 12, 13, 11, 10,
+ 16, 16, 14, 13, 14, 14, 12, 10, 13, 16, 11, 12, 13, 14, 11, 9,
+ 14, 16, 12, 12, 13, 14, 11, 9, 16, 16, 13, 13, 14, 14, 11, 9,
+ 12, 15, 12, 13, 10, 12, 10, 9, 14, 16, 13, 13, 11, 12, 11, 10,
+ 16, 16, 14, 14, 14, 13, 12, 9, 13, 16, 13, 13, 12, 13, 11, 10,
+ 14, 16, 13, 13, 12, 13, 11, 10, 16, 16, 14, 14, 13, 13, 12, 9,
+ 15, 16, 13, 13, 13, 14, 11, 9, 16, 16, 13, 13, 13, 14, 11, 9,
+ 16, 16, 13, 12, 13, 13, 10, 8, 10, 13, 10, 11, 10, 12, 10, 9,
+ 12, 14, 11, 12, 12, 13, 11, 10, 16, 16, 13, 13, 14, 14, 12, 9,
+ 11, 14, 10, 11, 11, 12, 10, 9, 13, 16, 11, 12, 12, 13, 11, 10,
+ 16, 16, 14, 13, 14, 14, 12, 9, 12, 15, 10, 11, 12, 13, 9, 8,
+ 14, 16, 11, 11, 13, 14, 10, 8, 16, 16, 12, 12, 14, 14, 10, 8,
+ 11, 14, 11, 12, 11, 12, 10, 9, 13, 16, 12, 13, 12, 13, 11, 10,
+ 16, 16, 14, 13, 14, 14, 12, 9, 12, 15, 11, 12, 11, 13, 10, 10,
+ 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 14, 13, 14, 14, 12, 9,
+ 13, 16, 11, 11, 13, 13, 10, 8, 14, 16, 11, 12, 13, 14, 10, 8,
+ 16, 16, 12, 12, 14, 14, 10, 8, 12, 15, 12, 13, 10, 11, 10, 9,
+ 14, 16, 13, 13, 11, 12, 10, 9, 16, 16, 14, 13, 13, 13, 11, 8,
+ 13, 16, 12, 13, 11, 12, 10, 9, 14, 16, 13, 13, 12, 12, 10, 9,
+ 16, 16, 14, 13, 13, 12, 10, 8, 14, 16, 12, 12, 12, 13, 10, 8,
+ 14, 16, 12, 12, 12, 13, 10, 7, 16, 16, 11, 11, 12, 11, 8, 5,
+ },
+ {
+ 0, 7, 4, 8, 5, 8, 7, 8, 6, 10, 7, 10, 8, 10, 9, 9,
+ 13, 16, 12, 13, 13, 14, 12, 12, 4, 10, 6, 9, 8, 11, 8, 9,
+ 8, 12, 8, 11, 10, 12, 10, 10, 14, 16, 12, 13, 14, 15, 12, 12,
+ 9, 14, 9, 11, 12, 14, 11, 11, 11, 15, 10, 12, 13, 14, 11, 11,
+ 15, 16, 13, 14, 15, 16, 13, 12, 5, 10, 7, 10, 7, 10, 9, 9,
+ 8, 12, 9, 11, 10, 11, 10, 10, 14, 16, 13, 14, 14, 14, 12, 12,
+ 8, 12, 8, 11, 10, 12, 10, 10, 10, 14, 10, 12, 11, 13, 10, 11,
+ 15, 16, 13, 14, 14, 15, 13, 12, 11, 16, 10, 12, 13, 15, 11, 11,
+ 13, 16, 11, 13, 14, 15, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
+ 11, 15, 11, 13, 11, 13, 11, 11, 13, 16, 12, 14, 12, 13, 12, 12,
+ 16, 16, 14, 15, 15, 15, 13, 12, 12, 16, 12, 14, 12, 14, 12, 12,
+ 14, 16, 13, 14, 13, 14, 12, 12, 16, 16, 14, 16, 16, 16, 13, 12,
+ 14, 16, 13, 14, 15, 16, 13, 12, 16, 16, 14, 15, 16, 16, 13, 12,
+ 16, 16, 15, 16, 16, 16, 13, 12, 2, 9, 5, 8, 6, 9, 8, 9,
+ 7, 11, 8, 10, 9, 11, 9, 10, 13, 16, 12, 13, 14, 14, 12, 12,
+ 5, 11, 6, 10, 9, 11, 9, 9, 9, 13, 9, 11, 10, 12, 10, 10,
+ 14, 16, 12, 14, 14, 15, 12, 12, 9, 14, 9, 11, 12, 14, 10, 11,
+ 11, 16, 10, 12, 13, 14, 11, 11, 16, 16, 13, 14, 15, 16, 13, 12,
+ 6, 11, 7, 10, 8, 11, 9, 9, 9, 13, 9, 11, 10, 12, 10, 10,
+ 14, 16, 13, 14, 14, 14, 12, 12, 8, 13, 8, 11, 10, 12, 10, 10,
+ 10, 13, 10, 12, 11, 13, 10, 11, 14, 16, 13, 14, 14, 15, 12, 12,
+ 11, 15, 10, 12, 13, 15, 11, 11, 12, 16, 11, 13, 13, 15, 12, 11,
+ 16, 16, 13, 14, 15, 16, 13, 12, 11, 15, 11, 13, 10, 13, 11, 11,
+ 13, 16, 12, 14, 12, 13, 12, 11, 16, 16, 14, 15, 15, 15, 13, 12,
+ 12, 16, 12, 13, 12, 14, 12, 12, 13, 16, 12, 14, 13, 14, 12, 12,
+ 16, 16, 14, 15, 15, 15, 13, 12, 14, 16, 13, 14, 15, 16, 12, 12,
+ 16, 16, 13, 14, 15, 16, 12, 12, 16, 16, 14, 15, 16, 16, 13, 12,
+ 6, 12, 7, 10, 9, 12, 9, 10, 9, 13, 9, 12, 11, 13, 11, 11,
+ 14, 16, 13, 14, 15, 15, 13, 12, 8, 13, 8, 11, 10, 13, 10, 10,
+ 10, 14, 10, 12, 12, 14, 11, 11, 15, 16, 13, 14, 16, 16, 13, 12,
+ 10, 15, 9, 12, 12, 15, 11, 11, 12, 16, 11, 13, 14, 16, 12, 12,
+ 16, 16, 14, 14, 16, 16, 13, 12, 8, 13, 9, 11, 10, 12, 10, 11,
+ 11, 14, 11, 12, 11, 13, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
+ 10, 14, 10, 12, 11, 13, 11, 11, 11, 15, 11, 13, 12, 14, 11, 11,
+ 15, 16, 13, 14, 15, 16, 13, 12, 12, 16, 11, 13, 13, 16, 12, 12,
+ 13, 16, 11, 13, 14, 16, 12, 12, 16, 16, 13, 14, 16, 16, 13, 12,
+ 12, 16, 12, 14, 11, 13, 11, 11, 13, 16, 13, 14, 12, 14, 12, 12,
+ 16, 16, 15, 16, 16, 16, 14, 13, 13, 16, 12, 14, 12, 14, 12, 12,
+ 14, 16, 13, 14, 13, 14, 12, 12, 16, 16, 14, 16, 14, 16, 13, 12,
+ 15, 16, 13, 15, 15, 16, 13, 12, 15, 16, 13, 15, 14, 16, 13, 12,
+ 16, 16, 14, 15, 15, 16, 13, 11, 8, 13, 8, 11, 10, 13, 10, 11,
+ 11, 15, 10, 12, 12, 14, 11, 11, 15, 16, 13, 14, 15, 15, 13, 12,
+ 9, 14, 9, 12, 11, 14, 10, 11, 11, 16, 10, 12, 13, 14, 11, 11,
+ 16, 16, 13, 14, 15, 16, 13, 12, 11, 15, 9, 12, 12, 14, 10, 10,
+ 12, 16, 11, 12, 14, 15, 11, 11, 16, 16, 13, 14, 16, 16, 12, 11,
+ 9, 14, 10, 12, 11, 13, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
+ 16, 16, 14, 14, 15, 15, 13, 12, 10, 15, 10, 12, 12, 14, 11, 11,
+ 12, 16, 11, 13, 13, 14, 11, 11, 16, 16, 14, 14, 15, 16, 13, 12,
+ 12, 16, 10, 12, 13, 15, 11, 11, 13, 16, 11, 13, 14, 15, 11, 11,
+ 16, 16, 13, 13, 15, 16, 12, 11, 12, 16, 11, 13, 10, 13, 11, 11,
+ 14, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 14, 15, 13, 11,
+ 13, 16, 12, 14, 12, 14, 11, 11, 13, 16, 12, 14, 12, 14, 11, 11,
+ 16, 16, 14, 15, 14, 14, 12, 11, 14, 16, 12, 13, 13, 15, 11, 11,
+ 14, 16, 12, 13, 13, 14, 11, 11, 15, 16, 12, 13, 13, 13, 10, 9,
+ },
+ },
+ {
+ {
+ 0, 7, 4, 7, 5, 7, 6, 6, 6, 10, 7, 8, 8, 9, 8, 7,
+ 13, 14, 11, 12, 12, 12, 11, 9, 5, 9, 6, 8, 7, 9, 7, 7,
+ 8, 11, 8, 9, 9, 10, 9, 8, 13, 16, 12, 12, 12, 13, 11, 9,
+ 10, 13, 8, 10, 11, 12, 9, 9, 12, 14, 10, 11, 12, 13, 10, 9,
+ 15, 16, 12, 12, 14, 14, 11, 9, 6, 10, 7, 9, 7, 9, 8, 7,
+ 8, 11, 9, 10, 9, 10, 9, 8, 14, 16, 12, 12, 13, 12, 11, 9,
+ 8, 11, 8, 10, 9, 10, 9, 8, 10, 13, 10, 11, 10, 11, 9, 9,
+ 14, 16, 12, 12, 13, 13, 11, 9, 12, 15, 10, 11, 12, 13, 10, 9,
+ 13, 16, 11, 12, 13, 13, 10, 9, 16, 16, 12, 13, 14, 14, 11, 9,
+ 10, 14, 11, 12, 9, 11, 10, 9, 12, 15, 12, 13, 11, 12, 11, 9,
+ 16, 16, 13, 13, 13, 13, 11, 9, 12, 15, 12, 13, 11, 12, 11, 9,
+ 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 13, 13, 13, 11, 9,
+ 14, 16, 13, 13, 13, 14, 11, 10, 16, 16, 13, 13, 13, 14, 11, 10,
+ 16, 16, 13, 13, 14, 14, 11, 9, 4, 9, 6, 8, 6, 9, 7, 7,
+ 8, 11, 8, 9, 9, 10, 9, 8, 13, 15, 12, 12, 13, 13, 11, 9,
+ 6, 10, 7, 9, 8, 10, 8, 8, 9, 12, 9, 10, 10, 11, 9, 8,
+ 14, 16, 12, 12, 13, 13, 11, 10, 10, 13, 8, 10, 11, 12, 9, 9,
+ 12, 15, 10, 11, 12, 13, 10, 9, 16, 16, 12, 12, 14, 14, 11, 9,
+ 7, 11, 8, 9, 7, 10, 8, 8, 9, 12, 10, 11, 9, 11, 9, 9,
+ 14, 16, 12, 13, 13, 13, 11, 10, 9, 12, 9, 10, 9, 11, 9, 9,
+ 10, 13, 10, 11, 10, 11, 10, 9, 14, 16, 12, 13, 13, 13, 11, 9,
+ 12, 15, 10, 11, 12, 13, 10, 9, 13, 16, 11, 12, 13, 13, 10, 9,
+ 16, 16, 12, 12, 14, 14, 11, 9, 10, 14, 11, 12, 9, 11, 10, 9,
+ 12, 16, 12, 13, 11, 12, 11, 9, 16, 16, 14, 14, 13, 13, 11, 9,
+ 12, 16, 12, 13, 11, 12, 10, 10, 13, 16, 12, 13, 11, 12, 11, 10,
+ 16, 16, 13, 13, 13, 13, 11, 9, 14, 16, 13, 13, 13, 14, 11, 9,
+ 15, 16, 13, 13, 13, 14, 11, 9, 16, 16, 13, 13, 13, 13, 10, 8,
+ 7, 11, 8, 10, 9, 11, 9, 9, 10, 13, 10, 11, 11, 12, 10, 10,
+ 15, 16, 13, 13, 14, 14, 12, 10, 9, 13, 9, 11, 10, 12, 10, 9,
+ 11, 14, 10, 12, 12, 13, 10, 10, 16, 16, 13, 13, 14, 14, 12, 10,
+ 11, 15, 9, 11, 12, 13, 10, 9, 13, 16, 11, 12, 13, 14, 11, 10,
+ 16, 16, 13, 13, 15, 15, 11, 10, 9, 13, 10, 11, 9, 11, 10, 9,
+ 11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 14, 14, 14, 14, 12, 10,
+ 10, 14, 10, 12, 11, 12, 10, 10, 12, 15, 11, 12, 12, 13, 11, 10,
+ 16, 16, 13, 13, 14, 14, 12, 10, 13, 16, 11, 12, 13, 14, 11, 10,
+ 13, 16, 11, 12, 13, 14, 11, 10, 16, 16, 12, 13, 14, 14, 11, 9,
+ 11, 15, 12, 13, 10, 12, 10, 10, 13, 16, 13, 14, 11, 13, 11, 10,
+ 16, 16, 14, 14, 14, 14, 12, 10, 13, 16, 13, 13, 11, 13, 11, 10,
+ 14, 16, 13, 14, 12, 13, 11, 10, 16, 16, 14, 14, 13, 13, 12, 10,
+ 15, 16, 13, 14, 14, 14, 11, 10, 15, 16, 13, 13, 13, 14, 11, 10,
+ 16, 16, 12, 13, 13, 13, 10, 8, 9, 13, 10, 11, 10, 12, 10, 10,
+ 12, 15, 11, 12, 12, 13, 11, 10, 16, 16, 14, 13, 14, 14, 12, 10,
+ 10, 14, 10, 12, 11, 13, 10, 10, 13, 16, 11, 12, 12, 14, 11, 10,
+ 16, 16, 13, 13, 14, 14, 12, 10, 12, 16, 9, 11, 12, 14, 10, 9,
+ 13, 16, 10, 12, 13, 14, 10, 9, 16, 16, 12, 12, 14, 14, 11, 9,
+ 10, 14, 11, 12, 10, 12, 10, 10, 13, 16, 12, 13, 12, 13, 11, 10,
+ 16, 16, 14, 14, 14, 14, 12, 10, 11, 16, 11, 12, 11, 13, 11, 10,
+ 13, 16, 12, 13, 12, 14, 11, 10, 16, 16, 14, 14, 14, 14, 12, 10,
+ 13, 16, 11, 12, 13, 14, 10, 9, 14, 16, 11, 12, 13, 14, 10, 9,
+ 16, 16, 12, 12, 14, 14, 10, 8, 12, 16, 12, 13, 10, 12, 10, 9,
+ 14, 16, 13, 13, 11, 12, 11, 9, 16, 16, 14, 14, 13, 13, 11, 9,
+ 13, 16, 12, 13, 11, 12, 10, 9, 14, 16, 13, 13, 11, 13, 11, 9,
+ 16, 16, 14, 14, 13, 13, 11, 9, 14, 16, 12, 13, 12, 13, 10, 8,
+ 14, 16, 12, 12, 12, 13, 10, 8, 15, 16, 11, 11, 11, 12, 9, 6,
+ },
+ {
+ 0, 7, 4, 7, 5, 8, 7, 8, 5, 10, 7, 10, 8, 10, 9, 10,
+ 13, 16, 12, 14, 14, 14, 13, 12, 4, 10, 6, 9, 8, 11, 9, 9,
+ 8, 12, 8, 11, 10, 12, 10, 10, 14, 16, 13, 14, 14, 15, 13, 12,
+ 9, 14, 9, 12, 12, 14, 11, 11, 12, 16, 11, 13, 13, 15, 12, 12,
+ 15, 16, 14, 15, 15, 16, 13, 13, 5, 10, 7, 10, 7, 10, 9, 9,
+ 8, 12, 9, 11, 9, 11, 10, 10, 14, 16, 13, 14, 14, 15, 13, 12,
+ 7, 12, 8, 11, 10, 12, 10, 10, 10, 13, 10, 12, 11, 13, 11, 11,
+ 15, 16, 13, 15, 14, 16, 13, 13, 11, 16, 11, 13, 13, 16, 12, 12,
+ 13, 16, 12, 14, 14, 16, 12, 12, 16, 16, 14, 16, 16, 16, 14, 13,
+ 11, 15, 12, 14, 11, 13, 11, 12, 13, 16, 12, 14, 12, 14, 12, 12,
+ 16, 16, 14, 16, 14, 16, 13, 13, 13, 16, 12, 14, 12, 14, 12, 12,
+ 14, 16, 13, 15, 13, 15, 13, 13, 16, 16, 15, 16, 16, 16, 14, 13,
+ 15, 16, 13, 16, 15, 16, 13, 13, 16, 16, 14, 16, 16, 16, 14, 13,
+ 16, 16, 16, 16, 16, 16, 14, 13, 2, 9, 5, 8, 6, 9, 8, 9,
+ 7, 11, 8, 10, 9, 11, 9, 10, 14, 16, 13, 14, 14, 15, 13, 12,
+ 5, 11, 6, 10, 9, 11, 9, 10, 8, 13, 9, 11, 11, 12, 10, 11,
+ 14, 16, 13, 14, 14, 16, 13, 13, 9, 15, 9, 12, 12, 14, 11, 11,
+ 12, 16, 11, 13, 13, 15, 12, 12, 16, 16, 14, 15, 16, 16, 14, 13,
+ 6, 11, 7, 10, 8, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 11,
+ 14, 16, 13, 14, 14, 15, 13, 13, 8, 12, 8, 11, 10, 12, 10, 11,
+ 9, 13, 10, 12, 11, 13, 11, 11, 14, 16, 13, 14, 14, 16, 13, 13,
+ 12, 16, 11, 13, 13, 15, 12, 12, 13, 16, 11, 13, 14, 16, 12, 12,
+ 16, 16, 14, 15, 16, 16, 13, 13, 11, 15, 11, 14, 10, 13, 11, 12,
+ 13, 16, 13, 15, 12, 14, 12, 12, 16, 16, 15, 16, 15, 16, 14, 13,
+ 12, 16, 12, 14, 12, 14, 12, 12, 13, 16, 13, 15, 13, 14, 12, 13,
+ 16, 16, 15, 16, 15, 16, 13, 13, 15, 16, 13, 16, 15, 16, 13, 13,
+ 16, 16, 14, 16, 16, 16, 13, 13, 16, 16, 15, 16, 16, 16, 14, 13,
+ 5, 12, 7, 10, 9, 12, 10, 10, 9, 13, 9, 12, 11, 13, 11, 11,
+ 15, 16, 13, 14, 15, 15, 13, 13, 7, 13, 8, 11, 10, 13, 10, 11,
+ 10, 14, 10, 12, 12, 14, 11, 12, 16, 16, 14, 15, 16, 16, 14, 13,
+ 10, 16, 9, 12, 13, 15, 11, 12, 13, 16, 11, 13, 14, 16, 12, 12,
+ 16, 16, 14, 16, 16, 16, 14, 13, 8, 13, 9, 12, 9, 12, 10, 11,
+ 11, 15, 11, 13, 11, 13, 11, 12, 16, 16, 14, 16, 16, 16, 14, 13,
+ 9, 14, 10, 12, 11, 13, 11, 12, 11, 15, 11, 13, 12, 14, 12, 12,
+ 16, 16, 14, 16, 15, 16, 14, 13, 12, 16, 11, 14, 14, 16, 12, 12,
+ 13, 16, 12, 14, 14, 16, 13, 13, 16, 16, 13, 15, 16, 16, 14, 13,
+ 11, 16, 12, 14, 10, 13, 12, 12, 13, 16, 13, 15, 12, 14, 12, 13,
+ 16, 16, 16, 16, 16, 16, 14, 14, 13, 16, 13, 15, 12, 15, 12, 13,
+ 13, 16, 13, 15, 12, 15, 13, 13, 16, 16, 15, 16, 14, 16, 14, 13,
+ 16, 16, 14, 16, 16, 16, 14, 13, 15, 16, 14, 16, 15, 16, 14, 13,
+ 16, 16, 14, 16, 15, 16, 13, 12, 8, 14, 9, 12, 10, 14, 11, 12,
+ 11, 16, 10, 13, 12, 14, 12, 12, 16, 16, 14, 15, 15, 16, 14, 13,
+ 9, 15, 9, 12, 12, 14, 11, 12, 12, 16, 11, 13, 13, 15, 12, 12,
+ 16, 16, 14, 15, 16, 16, 14, 13, 11, 16, 9, 12, 13, 15, 11, 11,
+ 13, 16, 11, 13, 14, 16, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
+ 9, 15, 10, 13, 11, 14, 11, 12, 12, 16, 11, 14, 12, 14, 12, 12,
+ 16, 16, 14, 16, 16, 16, 14, 13, 10, 16, 10, 13, 12, 15, 12, 12,
+ 12, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 16, 16, 16, 14, 13,
+ 12, 16, 11, 13, 13, 16, 12, 12, 13, 16, 11, 13, 14, 16, 12, 12,
+ 16, 16, 13, 14, 16, 16, 13, 12, 11, 16, 12, 14, 10, 13, 11, 12,
+ 13, 16, 13, 15, 12, 14, 12, 12, 16, 16, 16, 16, 15, 16, 13, 12,
+ 12, 16, 12, 15, 12, 14, 12, 12, 13, 16, 13, 15, 12, 14, 12, 12,
+ 16, 16, 15, 16, 14, 15, 13, 12, 14, 16, 13, 14, 13, 16, 12, 12,
+ 13, 16, 12, 14, 13, 15, 12, 12, 14, 16, 12, 13, 13, 14, 11, 10,
+ },
+ },
+ {
+ {
+ 0, 7, 4, 7, 5, 7, 6, 6, 6, 10, 7, 8, 8, 9, 8, 8,
+ 13, 14, 11, 12, 12, 12, 11, 10, 5, 9, 6, 8, 7, 9, 7, 7,
+ 8, 11, 8, 9, 9, 10, 9, 8, 13, 16, 12, 12, 13, 13, 11, 10,
+ 10, 14, 8, 10, 11, 13, 9, 9, 12, 15, 10, 11, 12, 13, 10, 10,
+ 16, 16, 12, 13, 14, 14, 11, 10, 5, 10, 7, 9, 6, 9, 8, 8,
+ 8, 11, 9, 10, 9, 10, 9, 8, 14, 16, 12, 12, 13, 13, 11, 10,
+ 8, 12, 8, 10, 9, 10, 9, 9, 10, 13, 9, 11, 10, 11, 9, 9,
+ 14, 16, 12, 13, 13, 13, 11, 10, 12, 16, 10, 12, 12, 13, 10, 10,
+ 13, 16, 11, 12, 13, 14, 11, 10, 16, 16, 12, 13, 14, 14, 11, 10,
+ 10, 14, 11, 13, 9, 11, 10, 10, 12, 16, 12, 13, 11, 12, 11, 10,
+ 16, 16, 13, 14, 13, 13, 12, 10, 12, 16, 12, 13, 11, 13, 11, 10,
+ 13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 14, 12, 10,
+ 14, 16, 13, 14, 13, 14, 12, 11, 16, 16, 13, 14, 14, 15, 12, 11,
+ 16, 16, 13, 14, 14, 14, 11, 10, 3, 9, 5, 8, 6, 9, 7, 7,
+ 8, 11, 8, 10, 9, 10, 9, 8, 14, 15, 12, 12, 13, 13, 11, 10,
+ 6, 11, 6, 9, 8, 10, 8, 8, 9, 12, 9, 10, 10, 11, 9, 9,
+ 14, 16, 12, 13, 13, 13, 11, 10, 10, 14, 8, 11, 12, 13, 9, 9,
+ 12, 16, 10, 11, 12, 13, 10, 10, 16, 16, 12, 13, 14, 14, 11, 10,
+ 6, 11, 8, 10, 7, 10, 8, 8, 9, 12, 10, 11, 9, 11, 9, 9,
+ 14, 16, 12, 13, 13, 13, 12, 10, 9, 12, 9, 11, 9, 11, 9, 9,
+ 10, 13, 10, 11, 10, 12, 10, 9, 14, 16, 12, 13, 13, 13, 11, 10,
+ 12, 16, 10, 12, 12, 14, 10, 10, 13, 16, 10, 12, 13, 14, 11, 10,
+ 16, 16, 12, 13, 14, 14, 11, 10, 10, 15, 11, 13, 9, 11, 10, 10,
+ 12, 16, 12, 13, 11, 12, 11, 10, 16, 16, 14, 14, 13, 14, 12, 10,
+ 12, 16, 12, 13, 11, 13, 11, 10, 13, 16, 12, 13, 11, 13, 11, 10,
+ 16, 16, 13, 14, 13, 13, 12, 10, 14, 16, 13, 14, 14, 14, 11, 11,
+ 15, 16, 13, 14, 13, 14, 11, 10, 16, 16, 13, 13, 13, 14, 11, 9,
+ 7, 12, 8, 11, 9, 11, 9, 10, 10, 14, 10, 12, 11, 12, 11, 10,
+ 16, 16, 13, 13, 14, 14, 12, 11, 9, 13, 9, 11, 10, 12, 10, 10,
+ 11, 15, 10, 12, 12, 13, 11, 10, 16, 16, 13, 14, 14, 14, 12, 11,
+ 11, 16, 9, 11, 12, 14, 10, 10, 13, 16, 10, 12, 13, 14, 11, 10,
+ 16, 16, 13, 14, 16, 16, 12, 11, 9, 13, 10, 12, 9, 12, 10, 10,
+ 11, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 14, 14, 14, 13, 11,
+ 10, 14, 10, 12, 11, 13, 11, 10, 12, 16, 11, 13, 12, 13, 11, 11,
+ 16, 16, 13, 14, 14, 14, 12, 11, 13, 16, 11, 13, 13, 14, 11, 11,
+ 13, 16, 11, 13, 13, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 10,
+ 11, 16, 12, 14, 10, 12, 11, 10, 13, 16, 13, 14, 11, 13, 11, 11,
+ 16, 16, 15, 16, 14, 14, 13, 11, 13, 16, 13, 14, 12, 13, 11, 11,
+ 13, 16, 13, 14, 12, 13, 11, 11, 16, 16, 14, 14, 13, 14, 12, 11,
+ 15, 16, 13, 14, 14, 16, 12, 11, 14, 16, 13, 14, 13, 14, 12, 11,
+ 16, 16, 12, 13, 13, 14, 11, 9, 9, 14, 10, 12, 10, 13, 11, 11,
+ 12, 16, 12, 13, 12, 14, 12, 11, 16, 16, 14, 14, 14, 14, 13, 11,
+ 10, 16, 10, 13, 12, 14, 11, 11, 13, 16, 12, 13, 13, 14, 12, 11,
+ 16, 16, 14, 14, 15, 15, 13, 11, 12, 16, 9, 12, 13, 14, 10, 10,
+ 14, 16, 11, 12, 13, 15, 11, 10, 16, 16, 13, 13, 15, 16, 11, 10,
+ 10, 16, 11, 13, 11, 13, 11, 11, 13, 16, 12, 14, 12, 14, 12, 11,
+ 16, 16, 14, 14, 14, 14, 13, 11, 11, 16, 11, 13, 12, 14, 11, 11,
+ 13, 16, 12, 14, 13, 14, 12, 11, 16, 16, 14, 14, 14, 15, 13, 11,
+ 13, 16, 11, 13, 13, 14, 11, 10, 14, 16, 11, 13, 13, 14, 11, 10,
+ 16, 16, 12, 13, 14, 15, 11, 9, 12, 16, 12, 14, 10, 13, 11, 10,
+ 14, 16, 13, 14, 11, 13, 11, 10, 16, 16, 14, 15, 13, 14, 12, 10,
+ 13, 16, 13, 14, 11, 13, 11, 10, 14, 16, 13, 14, 12, 13, 11, 10,
+ 16, 16, 14, 14, 13, 13, 11, 10, 14, 16, 12, 13, 13, 14, 11, 9,
+ 14, 16, 12, 13, 12, 13, 10, 9, 14, 16, 11, 11, 12, 12, 9, 7,
+ },
+ {
+ 0, 7, 3, 8, 5, 8, 7, 9, 5, 10, 7, 10, 8, 11, 10, 10,
+ 14, 16, 14, 15, 14, 16, 14, 14, 4, 10, 6, 10, 8, 11, 9, 10,
+ 8, 12, 9, 11, 10, 12, 11, 11, 15, 16, 14, 16, 15, 16, 14, 14,
+ 10, 16, 10, 13, 13, 16, 12, 13, 13, 16, 12, 14, 14, 16, 13, 13,
+ 16, 16, 16, 16, 16, 16, 14, 15, 4, 10, 7, 10, 7, 10, 9, 10,
+ 8, 12, 9, 12, 10, 12, 11, 12, 14, 16, 14, 16, 15, 16, 14, 14,
+ 8, 12, 9, 12, 10, 13, 11, 12, 10, 14, 11, 13, 11, 14, 12, 13,
+ 16, 16, 14, 16, 16, 16, 14, 15, 12, 16, 12, 14, 14, 16, 13, 14,
+ 14, 16, 13, 16, 16, 16, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 12, 16, 11, 14, 13, 13, 13, 16, 13, 16, 13, 15, 13, 14,
+ 16, 16, 16, 16, 16, 16, 15, 16, 13, 16, 13, 16, 13, 16, 13, 14,
+ 14, 16, 14, 16, 14, 16, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 2, 9, 5, 9, 6, 10, 8, 10,
+ 7, 11, 8, 11, 9, 12, 10, 11, 14, 16, 14, 16, 15, 16, 14, 14,
+ 5, 11, 6, 10, 9, 12, 10, 11, 9, 13, 9, 12, 11, 13, 11, 12,
+ 16, 16, 14, 16, 16, 16, 14, 14, 10, 16, 9, 13, 13, 16, 12, 13,
+ 13, 16, 12, 14, 14, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 14,
+ 5, 11, 8, 11, 7, 11, 10, 11, 9, 13, 10, 13, 10, 13, 11, 12,
+ 16, 16, 14, 16, 16, 16, 14, 14, 8, 13, 9, 12, 10, 13, 11, 12,
+ 10, 14, 10, 13, 11, 14, 12, 12, 16, 16, 14, 16, 15, 16, 14, 14,
+ 12, 16, 12, 14, 14, 16, 13, 14, 14, 16, 12, 16, 15, 16, 13, 14,
+ 16, 16, 15, 16, 16, 16, 15, 15, 11, 16, 12, 16, 10, 14, 12, 13,
+ 13, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 15, 16,
+ 13, 16, 13, 16, 13, 16, 13, 14, 14, 16, 14, 16, 13, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 15, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16,
+ 5, 13, 7, 12, 9, 13, 11, 12, 10, 14, 10, 13, 11, 13, 12, 13,
+ 16, 16, 16, 16, 16, 16, 16, 15, 7, 14, 8, 12, 11, 14, 11, 12,
+ 11, 16, 11, 13, 13, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 10, 14, 14, 16, 12, 13, 13, 16, 12, 15, 16, 16, 14, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 14, 10, 13, 9, 13, 11, 12,
+ 11, 16, 12, 14, 12, 14, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 11, 14, 12, 14, 12, 13, 11, 16, 12, 14, 12, 15, 13, 13,
+ 16, 16, 15, 16, 16, 16, 15, 16, 13, 16, 12, 16, 15, 16, 14, 14,
+ 13, 16, 12, 16, 16, 16, 14, 14, 16, 16, 14, 16, 16, 16, 14, 16,
+ 11, 16, 13, 16, 10, 14, 12, 13, 14, 16, 14, 16, 13, 16, 14, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 14, 16, 13, 16, 14, 15,
+ 13, 16, 14, 16, 13, 16, 14, 15, 16, 16, 16, 16, 15, 16, 15, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 16,
+ 16, 16, 15, 16, 16, 16, 14, 14, 8, 16, 10, 14, 11, 16, 12, 13,
+ 12, 16, 12, 14, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 14,
+ 10, 16, 10, 14, 12, 16, 12, 13, 13, 16, 12, 15, 14, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 16, 15, 11, 16, 10, 13, 13, 16, 12, 13,
+ 14, 16, 12, 14, 15, 16, 13, 13, 16, 16, 16, 16, 16, 16, 15, 14,
+ 10, 16, 11, 14, 11, 16, 12, 13, 13, 16, 13, 16, 13, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 16, 15, 11, 16, 12, 14, 13, 16, 13, 14,
+ 13, 16, 13, 16, 14, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 15,
+ 13, 16, 12, 14, 14, 16, 13, 13, 13, 16, 12, 15, 14, 16, 13, 13,
+ 16, 16, 14, 16, 16, 16, 14, 13, 11, 16, 12, 16, 11, 15, 12, 13,
+ 14, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
+ 12, 16, 13, 16, 12, 16, 13, 14, 13, 16, 14, 16, 13, 16, 13, 14,
+ 16, 16, 16, 16, 14, 16, 14, 14, 14, 16, 13, 16, 14, 16, 13, 13,
+ 13, 16, 13, 16, 14, 16, 13, 13, 15, 16, 13, 14, 13, 15, 12, 12,
+ },
+ },
+ {
+ {
+ 0, 7, 4, 6, 4, 7, 6, 7, 6, 9, 7, 8, 7, 9, 8, 8,
+ 13, 14, 12, 12, 12, 13, 11, 11, 5, 9, 5, 8, 7, 9, 7, 8,
+ 8, 11, 8, 10, 9, 10, 9, 9, 13, 15, 12, 13, 12, 13, 11, 11,
+ 9, 14, 8, 11, 11, 13, 10, 10, 11, 15, 10, 12, 12, 13, 10, 11,
+ 14, 16, 12, 13, 14, 14, 12, 11, 5, 9, 7, 9, 6, 9, 8, 8,
+ 8, 11, 8, 10, 8, 10, 9, 9, 13, 16, 12, 13, 13, 13, 11, 11,
+ 7, 11, 8, 10, 9, 11, 9, 9, 9, 13, 9, 11, 10, 11, 10, 10,
+ 14, 16, 12, 13, 13, 13, 12, 11, 11, 16, 10, 12, 12, 14, 11, 11,
+ 13, 16, 11, 13, 13, 14, 11, 11, 16, 16, 13, 14, 14, 15, 12, 11,
+ 10, 15, 11, 13, 9, 12, 10, 10, 12, 16, 12, 13, 11, 12, 11, 11,
+ 15, 16, 13, 14, 13, 14, 12, 11, 12, 16, 12, 14, 11, 13, 11, 11,
+ 13, 16, 12, 14, 12, 13, 12, 11, 16, 16, 13, 14, 14, 14, 12, 11,
+ 14, 16, 13, 14, 14, 15, 12, 12, 16, 16, 13, 14, 14, 16, 12, 12,
+ 16, 16, 14, 14, 14, 15, 12, 11, 3, 9, 5, 8, 6, 9, 7, 8,
+ 7, 11, 8, 10, 9, 10, 9, 9, 13, 14, 12, 13, 13, 13, 12, 11,
+ 6, 11, 6, 9, 8, 10, 8, 9, 9, 12, 8, 10, 10, 11, 9, 10,
+ 14, 16, 12, 13, 13, 14, 12, 11, 9, 14, 8, 11, 11, 13, 10, 10,
+ 12, 16, 10, 12, 12, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 11,
+ 6, 11, 8, 10, 7, 10, 8, 9, 9, 12, 9, 11, 9, 11, 10, 10,
+ 14, 16, 13, 13, 13, 14, 12, 11, 8, 12, 9, 11, 9, 11, 9, 10,
+ 10, 13, 9, 11, 10, 12, 10, 10, 14, 16, 12, 13, 13, 14, 12, 11,
+ 12, 16, 10, 12, 12, 14, 11, 11, 12, 16, 10, 12, 13, 14, 11, 11,
+ 15, 16, 12, 13, 14, 14, 11, 11, 10, 15, 11, 13, 9, 12, 10, 10,
+ 12, 16, 12, 14, 11, 13, 11, 11, 16, 16, 14, 14, 14, 14, 12, 11,
+ 12, 16, 12, 14, 11, 13, 11, 11, 13, 16, 12, 14, 11, 13, 11, 11,
+ 16, 16, 13, 14, 13, 14, 12, 11, 14, 16, 13, 14, 14, 15, 12, 11,
+ 14, 16, 13, 14, 13, 15, 12, 11, 16, 16, 13, 14, 13, 14, 11, 10,
+ 6, 13, 8, 11, 9, 12, 10, 10, 10, 14, 10, 12, 11, 13, 11, 11,
+ 16, 16, 13, 14, 14, 14, 13, 12, 8, 14, 8, 12, 10, 13, 10, 11,
+ 11, 15, 10, 12, 12, 13, 11, 11, 16, 16, 14, 14, 15, 16, 13, 12,
+ 11, 16, 9, 12, 12, 14, 11, 11, 13, 16, 11, 13, 13, 16, 11, 11,
+ 16, 16, 13, 14, 16, 16, 13, 12, 8, 14, 10, 12, 9, 12, 10, 11,
+ 11, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 15, 14, 15, 13, 12,
+ 10, 15, 10, 13, 11, 13, 11, 11, 11, 15, 11, 13, 12, 13, 11, 11,
+ 16, 16, 13, 15, 14, 15, 13, 12, 12, 16, 11, 13, 13, 15, 11, 11,
+ 13, 16, 11, 13, 13, 15, 11, 11, 16, 16, 12, 14, 14, 16, 12, 11,
+ 11, 16, 12, 14, 10, 13, 11, 11, 13, 16, 13, 15, 12, 14, 12, 12,
+ 16, 16, 15, 16, 14, 15, 13, 12, 12, 16, 13, 14, 12, 14, 12, 12,
+ 13, 16, 13, 14, 12, 14, 12, 12, 16, 16, 14, 15, 13, 14, 12, 12,
+ 15, 16, 13, 15, 14, 16, 12, 12, 14, 16, 13, 14, 13, 15, 12, 12,
+ 15, 16, 12, 13, 13, 14, 11, 10, 9, 15, 10, 13, 11, 14, 11, 12,
+ 12, 16, 12, 14, 12, 14, 12, 12, 16, 16, 14, 14, 14, 15, 13, 12,
+ 10, 16, 10, 13, 12, 14, 12, 12, 13, 16, 12, 14, 13, 15, 12, 12,
+ 16, 16, 14, 14, 15, 16, 13, 12, 11, 16, 9, 12, 13, 15, 11, 11,
+ 14, 16, 11, 13, 14, 16, 11, 11, 16, 16, 13, 14, 16, 16, 12, 11,
+ 10, 16, 11, 14, 11, 14, 12, 12, 13, 16, 13, 14, 12, 14, 12, 12,
+ 16, 16, 14, 15, 15, 15, 13, 12, 11, 16, 12, 14, 12, 15, 12, 12,
+ 13, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 15, 15, 16, 13, 12,
+ 12, 16, 11, 13, 13, 15, 11, 11, 13, 16, 11, 13, 13, 15, 11, 11,
+ 16, 16, 12, 13, 14, 16, 12, 10, 11, 16, 12, 14, 10, 13, 11, 11,
+ 14, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 14, 14, 12, 11,
+ 12, 16, 13, 14, 11, 14, 11, 11, 13, 16, 13, 14, 12, 14, 11, 11,
+ 16, 16, 14, 15, 13, 14, 12, 11, 14, 16, 12, 14, 13, 14, 11, 10,
+ 13, 16, 12, 13, 12, 14, 11, 10, 14, 16, 11, 12, 12, 12, 10, 8,
+ },
+ {
+ 0, 8, 4, 9, 5, 9, 8, 10, 6, 11, 8, 11, 9, 12, 11, 12,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 6, 11, 9, 12, 10, 12,
+ 9, 13, 10, 13, 11, 16, 12, 13, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 11, 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 8, 12, 7, 12, 10, 12,
+ 8, 13, 10, 13, 10, 13, 12, 14, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 13, 10, 14, 11, 16, 12, 14, 11, 16, 12, 16, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 14, 16, 12, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 10, 5, 10, 7, 11, 9, 11,
+ 8, 12, 9, 12, 10, 13, 12, 13, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 12, 7, 12, 10, 13, 11, 12, 9, 16, 10, 13, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 14, 16,
+ 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 6, 12, 9, 13, 8, 12, 11, 13, 10, 16, 11, 16, 11, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 10, 14, 11, 16, 12, 16,
+ 10, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 14, 16, 11, 16, 14, 16,
+ 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 6, 16, 9, 13, 10, 16, 12, 14, 11, 16, 12, 16, 12, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 9, 14, 12, 16, 13, 16,
+ 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 10, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 10, 16, 12, 16,
+ 12, 16, 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 13, 16, 14, 16, 11, 16, 13, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16,
+ 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 11, 16, 14, 16, 16, 16, 16, 16, 14, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 12, 16, 13, 16,
+ 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 11, 16, 13, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 13, 16,
+ 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 12, 16, 13, 16, 13, 16, 16, 16, 14, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 14, 16, 16, 16,
+ 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 12, 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 11, 16, 13, 16,
+ 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 15,
+ },
+ },
+ {
+ {
+ 0, 7, 3, 7, 4, 7, 6, 7, 6, 9, 7, 9, 7, 9, 8, 9,
+ 13, 14, 12, 13, 13, 13, 12, 12, 4, 9, 5, 9, 7, 9, 8, 9,
+ 7, 11, 8, 10, 9, 11, 9, 10, 13, 16, 12, 14, 13, 14, 12, 12,
+ 9, 14, 8, 12, 12, 14, 10, 11, 11, 16, 10, 13, 13, 14, 11, 12,
+ 15, 16, 13, 14, 14, 16, 12, 12, 5, 10, 7, 9, 6, 9, 8, 9,
+ 8, 11, 8, 11, 8, 10, 9, 10, 14, 16, 12, 14, 13, 14, 12, 12,
+ 7, 12, 8, 11, 9, 11, 9, 10, 9, 13, 9, 12, 10, 12, 10, 11,
+ 14, 16, 12, 14, 13, 14, 12, 12, 12, 16, 11, 13, 13, 15, 11, 12,
+ 13, 16, 11, 14, 13, 15, 12, 12, 15, 16, 13, 15, 14, 16, 13, 13,
+ 10, 15, 12, 14, 9, 13, 11, 12, 12, 16, 12, 14, 11, 13, 12, 12,
+ 15, 16, 13, 15, 14, 15, 13, 13, 12, 16, 12, 14, 12, 14, 12, 12,
+ 13, 16, 13, 14, 12, 14, 12, 12, 16, 16, 14, 15, 14, 16, 13, 13,
+ 15, 16, 13, 15, 14, 16, 12, 13, 16, 16, 14, 16, 14, 16, 13, 13,
+ 16, 16, 14, 16, 15, 16, 13, 13, 3, 9, 5, 9, 6, 9, 8, 9,
+ 7, 11, 8, 10, 9, 11, 9, 10, 14, 15, 13, 14, 13, 14, 12, 12,
+ 5, 11, 6, 10, 8, 11, 9, 10, 9, 12, 9, 11, 10, 12, 10, 11,
+ 14, 16, 13, 14, 14, 15, 13, 13, 9, 15, 8, 12, 12, 14, 10, 11,
+ 12, 16, 10, 13, 13, 15, 11, 12, 15, 16, 13, 14, 14, 16, 13, 13,
+ 6, 11, 8, 11, 7, 10, 9, 10, 9, 13, 10, 12, 9, 12, 10, 11,
+ 14, 16, 13, 14, 14, 14, 13, 13, 8, 13, 9, 12, 9, 12, 10, 11,
+ 9, 13, 9, 12, 10, 12, 10, 11, 14, 16, 12, 14, 13, 14, 12, 12,
+ 12, 16, 11, 13, 13, 15, 11, 12, 12, 16, 11, 13, 13, 15, 11, 12,
+ 14, 16, 12, 14, 14, 15, 12, 12, 10, 15, 11, 14, 9, 13, 11, 12,
+ 12, 16, 12, 14, 11, 14, 12, 12, 16, 16, 14, 16, 14, 15, 13, 13,
+ 12, 16, 12, 14, 11, 14, 12, 12, 12, 16, 13, 14, 11, 14, 12, 12,
+ 15, 16, 14, 15, 13, 15, 12, 13, 14, 16, 13, 15, 14, 16, 13, 13,
+ 14, 16, 13, 15, 14, 16, 12, 13, 15, 16, 13, 15, 13, 15, 12, 12,
+ 6, 13, 8, 12, 9, 12, 10, 11, 10, 14, 11, 13, 11, 13, 12, 12,
+ 15, 16, 14, 15, 15, 15, 14, 13, 8, 14, 9, 12, 11, 13, 11, 12,
+ 11, 15, 11, 13, 12, 14, 12, 12, 16, 16, 14, 15, 15, 16, 14, 14,
+ 10, 16, 9, 13, 12, 15, 11, 12, 13, 16, 11, 14, 13, 16, 12, 12,
+ 16, 16, 14, 15, 16, 16, 13, 13, 8, 14, 10, 13, 9, 13, 11, 12,
+ 11, 15, 12, 14, 11, 14, 12, 12, 16, 16, 15, 16, 15, 16, 14, 14,
+ 10, 15, 10, 13, 11, 14, 11, 12, 11, 15, 11, 14, 12, 14, 12, 12,
+ 15, 16, 14, 15, 14, 16, 13, 13, 12, 16, 11, 14, 13, 16, 12, 12,
+ 12, 16, 11, 14, 13, 15, 12, 12, 15, 16, 12, 14, 15, 16, 13, 13,
+ 11, 16, 12, 14, 10, 14, 11, 12, 13, 16, 13, 16, 12, 14, 12, 13,
+ 16, 16, 16, 16, 15, 16, 14, 13, 12, 16, 13, 15, 12, 14, 12, 13,
+ 13, 16, 13, 15, 12, 14, 12, 13, 16, 16, 14, 16, 13, 15, 13, 13,
+ 15, 16, 14, 16, 14, 16, 13, 13, 14, 16, 13, 15, 13, 16, 13, 13,
+ 14, 16, 12, 14, 13, 14, 12, 12, 9, 16, 11, 14, 11, 15, 12, 13,
+ 13, 16, 12, 14, 12, 15, 13, 13, 16, 16, 14, 15, 15, 15, 14, 13,
+ 11, 16, 11, 14, 12, 16, 12, 13, 13, 16, 12, 14, 13, 16, 13, 13,
+ 16, 16, 14, 15, 16, 16, 14, 13, 11, 16, 10, 13, 13, 16, 11, 12,
+ 14, 16, 11, 14, 14, 16, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
+ 11, 16, 12, 14, 11, 15, 12, 13, 13, 16, 13, 15, 13, 16, 13, 13,
+ 16, 16, 15, 16, 15, 16, 14, 13, 11, 16, 12, 15, 12, 16, 12, 13,
+ 13, 16, 13, 15, 13, 16, 13, 13, 16, 16, 15, 16, 15, 16, 14, 13,
+ 12, 16, 11, 14, 13, 16, 12, 12, 13, 16, 11, 14, 13, 16, 12, 12,
+ 16, 16, 13, 14, 15, 16, 12, 12, 11, 16, 12, 14, 10, 14, 11, 12,
+ 14, 16, 13, 15, 12, 15, 12, 12, 16, 16, 16, 16, 14, 15, 13, 12,
+ 12, 16, 13, 15, 12, 14, 12, 12, 13, 16, 13, 15, 12, 14, 12, 12,
+ 16, 16, 14, 16, 14, 15, 12, 12, 14, 16, 13, 15, 13, 16, 11, 12,
+ 13, 16, 12, 14, 13, 15, 11, 11, 14, 16, 12, 13, 12, 13, 11, 10,
+ },
+ {
+ 0, 8, 4, 9, 5, 10, 9, 11, 5, 11, 9, 12, 9, 13, 12, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 6, 12, 9, 13, 11, 13,
+ 9, 16, 10, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 12, 8, 13, 7, 12, 11, 16,
+ 8, 16, 11, 16, 11, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 10, 16, 11, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 10, 6, 11, 7, 12, 10, 13,
+ 7, 12, 10, 13, 10, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 13, 7, 12, 10, 16, 12, 16, 10, 16, 11, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 16, 16,
+ 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 13, 9, 16, 8, 16, 12, 16, 9, 16, 12, 16, 11, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 12, 16, 13, 16,
+ 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 6, 16, 9, 16, 10, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 9, 16, 12, 16, 13, 16,
+ 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 10, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 11, 16, 13, 16,
+ 12, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 13, 16, 16, 16, 11, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 11, 16, 12, 16, 16, 16,
+ 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 16, 16,
+ 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 7, 4, 8, 4, 8, 7, 8, 6, 10, 7, 10, 8, 10, 9, 10,
+ 13, 16, 13, 15, 13, 15, 13, 14, 4, 10, 5, 10, 7, 10, 9, 10,
+ 7, 12, 8, 11, 9, 12, 10, 11, 13, 16, 13, 15, 13, 16, 13, 14,
+ 9, 16, 9, 13, 12, 16, 11, 13, 11, 16, 11, 14, 13, 16, 12, 14,
+ 15, 16, 14, 16, 15, 16, 14, 14, 4, 10, 7, 10, 6, 10, 9, 10,
+ 8, 12, 9, 12, 9, 11, 10, 12, 13, 16, 13, 16, 14, 16, 13, 14,
+ 7, 12, 8, 12, 9, 12, 10, 12, 9, 13, 10, 13, 10, 13, 11, 12,
+ 14, 16, 13, 16, 14, 16, 13, 14, 12, 16, 11, 14, 13, 16, 12, 14,
+ 13, 16, 12, 16, 14, 16, 13, 14, 16, 16, 14, 16, 15, 16, 14, 14,
+ 10, 16, 12, 15, 10, 14, 12, 13, 12, 16, 13, 16, 12, 14, 13, 14,
+ 15, 16, 14, 16, 14, 16, 14, 14, 12, 16, 13, 16, 12, 16, 13, 14,
+ 13, 16, 13, 16, 13, 16, 13, 14, 16, 16, 14, 16, 15, 16, 14, 15,
+ 15, 16, 14, 16, 15, 16, 13, 15, 16, 16, 14, 16, 15, 16, 14, 15,
+ 16, 16, 16, 16, 16, 16, 15, 15, 2, 9, 5, 10, 6, 10, 8, 10,
+ 7, 11, 8, 11, 9, 11, 10, 11, 14, 16, 13, 15, 14, 15, 14, 14,
+ 5, 11, 6, 11, 8, 12, 9, 11, 8, 13, 9, 12, 10, 13, 11, 12,
+ 14, 16, 13, 15, 14, 16, 14, 14, 9, 16, 8, 13, 12, 16, 11, 13,
+ 12, 16, 11, 14, 13, 16, 12, 13, 16, 16, 14, 16, 15, 16, 14, 15,
+ 5, 12, 8, 11, 7, 11, 9, 11, 9, 13, 10, 13, 10, 13, 11, 12,
+ 14, 16, 14, 16, 14, 16, 14, 15, 8, 13, 9, 13, 10, 13, 11, 12,
+ 9, 13, 10, 13, 10, 13, 11, 13, 13, 16, 13, 15, 13, 16, 13, 14,
+ 12, 16, 11, 14, 13, 16, 12, 14, 12, 16, 11, 14, 13, 16, 12, 14,
+ 14, 16, 13, 16, 14, 16, 13, 14, 10, 16, 12, 15, 9, 14, 11, 13,
+ 12, 16, 13, 16, 12, 15, 12, 14, 16, 16, 15, 16, 15, 16, 14, 14,
+ 12, 16, 13, 16, 12, 16, 12, 14, 12, 16, 13, 16, 12, 15, 13, 14,
+ 15, 16, 14, 16, 14, 16, 14, 14, 15, 16, 14, 16, 14, 16, 14, 15,
+ 14, 16, 13, 16, 14, 16, 13, 14, 16, 16, 14, 16, 14, 16, 13, 14,
+ 6, 14, 9, 13, 9, 14, 11, 12, 10, 14, 11, 13, 11, 14, 12, 13,
+ 16, 16, 15, 16, 15, 16, 14, 15, 8, 15, 9, 13, 11, 14, 11, 13,
+ 11, 16, 11, 14, 12, 15, 12, 14, 16, 16, 15, 16, 16, 16, 15, 16,
+ 10, 16, 9, 14, 12, 16, 12, 13, 13, 16, 11, 15, 14, 16, 13, 14,
+ 16, 16, 15, 16, 16, 16, 15, 16, 8, 15, 10, 13, 10, 14, 11, 13,
+ 11, 16, 12, 14, 12, 14, 12, 14, 16, 16, 16, 16, 16, 16, 15, 16,
+ 10, 16, 11, 14, 11, 15, 12, 13, 11, 16, 11, 14, 12, 15, 12, 14,
+ 16, 16, 14, 16, 15, 16, 14, 15, 12, 16, 11, 15, 13, 16, 13, 14,
+ 12, 16, 11, 14, 13, 16, 13, 14, 15, 16, 13, 16, 16, 16, 14, 15,
+ 10, 16, 12, 15, 10, 15, 12, 13, 13, 16, 13, 16, 12, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 15, 15, 12, 16, 13, 16, 12, 16, 13, 14,
+ 12, 16, 13, 16, 12, 16, 13, 14, 16, 16, 15, 16, 14, 16, 14, 15,
+ 15, 16, 14, 16, 15, 16, 14, 15, 14, 16, 13, 16, 14, 16, 13, 14,
+ 14, 16, 13, 15, 14, 16, 13, 14, 9, 16, 11, 16, 11, 16, 12, 14,
+ 13, 16, 12, 16, 13, 16, 13, 14, 16, 16, 15, 16, 16, 16, 15, 15,
+ 11, 16, 11, 16, 12, 16, 13, 14, 13, 16, 12, 16, 13, 16, 13, 14,
+ 16, 16, 15, 16, 16, 16, 15, 15, 11, 16, 10, 15, 13, 16, 12, 13,
+ 14, 16, 12, 16, 14, 16, 13, 14, 16, 16, 15, 16, 16, 16, 14, 14,
+ 11, 16, 12, 16, 11, 16, 13, 14, 13, 16, 13, 16, 13, 16, 13, 14,
+ 16, 16, 16, 16, 16, 16, 15, 15, 11, 16, 12, 16, 12, 16, 13, 14,
+ 13, 16, 13, 16, 13, 16, 13, 14, 16, 16, 15, 16, 16, 16, 15, 14,
+ 12, 16, 12, 15, 13, 16, 12, 14, 13, 16, 12, 16, 14, 16, 13, 14,
+ 16, 16, 14, 16, 16, 16, 14, 14, 11, 16, 12, 16, 11, 16, 12, 14,
+ 14, 16, 14, 16, 12, 16, 13, 14, 16, 16, 16, 16, 16, 16, 15, 14,
+ 12, 16, 13, 16, 12, 16, 12, 14, 13, 16, 13, 16, 12, 16, 13, 14,
+ 16, 16, 16, 16, 15, 16, 14, 14, 14, 16, 13, 16, 14, 16, 12, 14,
+ 13, 16, 13, 16, 13, 16, 12, 13, 15, 16, 13, 14, 14, 15, 13, 13,
+ },
+ {
+ 0, 8, 4, 10, 5, 11, 10, 16, 5, 12, 9, 16, 10, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 12, 7, 12, 9, 16, 12, 16,
+ 9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 12, 9, 16, 8, 16, 12, 16,
+ 8, 16, 11, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 16, 11, 16, 12, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 11, 6, 12, 7, 16, 11, 16,
+ 7, 16, 10, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 7, 16, 10, 16, 12, 16, 9, 16, 11, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 10, 16, 8, 16, 12, 16, 9, 16, 12, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 12, 16, 16, 16,
+ 10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 9, 16, 10, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 9, 16, 12, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 11, 16, 11, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 11, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 10, 16, 12, 16, 16, 16,
+ 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 9, 16, 16, 16, 16, 16,
+ 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 8, 4, 10, 5, 9, 8, 10, 6, 11, 8, 12, 8, 11, 10, 13,
+ 14, 16, 14, 16, 14, 16, 16, 16, 3, 11, 5, 11, 8, 12, 10, 12,
+ 7, 12, 9, 13, 10, 13, 11, 13, 14, 16, 14, 16, 16, 16, 16, 16,
+ 9, 16, 9, 16, 12, 16, 12, 16, 11, 16, 11, 16, 14, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 11, 7, 12, 6, 11, 10, 12,
+ 8, 13, 9, 13, 9, 13, 11, 14, 13, 16, 14, 16, 14, 16, 16, 16,
+ 7, 13, 9, 13, 9, 13, 11, 13, 9, 14, 10, 16, 11, 16, 12, 16,
+ 15, 16, 14, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 13, 16,
+ 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 10, 16, 13, 16, 12, 16, 13, 16, 12, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 13, 16, 14, 16,
+ 13, 16, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 2, 10, 5, 11, 6, 11, 9, 11,
+ 7, 12, 9, 13, 9, 13, 11, 13, 14, 16, 16, 16, 16, 16, 16, 16,
+ 4, 12, 6, 12, 8, 13, 10, 13, 8, 13, 9, 13, 11, 16, 12, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 8, 16, 12, 16, 12, 16,
+ 12, 16, 11, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 12, 8, 13, 7, 13, 10, 13, 8, 14, 10, 14, 10, 14, 12, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 14, 9, 16, 10, 16, 11, 14,
+ 8, 14, 10, 16, 11, 16, 12, 16, 13, 16, 14, 16, 16, 16, 16, 16,
+ 11, 16, 11, 16, 13, 16, 13, 16, 12, 16, 12, 16, 14, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 12, 16, 10, 16, 12, 16,
+ 12, 16, 13, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 13, 16, 12, 16, 14, 16, 12, 16, 13, 16, 12, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 6, 16, 8, 16, 9, 16, 11, 13, 10, 16, 11, 16, 11, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 9, 16, 10, 16, 12, 16,
+ 11, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 9, 16, 12, 16, 13, 16, 13, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 7, 16, 10, 16, 9, 16, 12, 16,
+ 11, 16, 12, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 11, 16, 11, 16, 12, 16, 11, 16, 12, 16, 13, 16, 13, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 14, 16,
+ 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 10, 16, 13, 16, 13, 16, 14, 16, 13, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 12, 16, 14, 16,
+ 12, 16, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 11, 16, 11, 16, 13, 16,
+ 12, 16, 13, 16, 13, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 11, 16, 13, 16, 13, 16, 13, 16, 13, 16, 14, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 14, 16, 13, 16,
+ 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 12, 16, 12, 16, 13, 16, 13, 16, 13, 16, 13, 16, 14, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 12, 16, 13, 16, 14, 16,
+ 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 12, 16, 14, 16, 14, 16, 14, 16, 14, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 11, 16, 14, 16,
+ 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 14, 16, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 0, 10, 4, 12, 5, 16, 11, 16, 6, 16, 10, 16, 11, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 3, 16, 7, 16, 10, 16, 16, 16,
+ 9, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 4, 16, 10, 16, 9, 16, 16, 16,
+ 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 12, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 6, 16, 8, 16, 16, 16,
+ 8, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 8, 16, 11, 16, 16, 16, 10, 16, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 11, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 11, 16, 9, 16, 16, 16, 10, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 9, 16, 12, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 5, 16, 9, 16, 11, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 10, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 16, 16, 16, 11, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 12, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 6, 16, 11, 16, 15, 16, 16, 16,
+ 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 9, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 9, 16, 16, 16, 16, 16,
+ 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
};
-static const uint8_t rv34_table_inter_secondpat[NUM_INTER_TABLES][2][OTHERBLK_VLC_SIZE] =
-{
- {
- {
- 0, 4, 8, 3, 6, 8, 6, 7, 8, 4, 6, 8, 6, 7, 8, 7,
- 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 3, 6, 8, 4, 6,
- 9, 7, 7, 8, 5, 7, 9, 6, 7, 9, 8, 8, 8, 7, 8, 8,
- 8, 8, 8, 8, 8, 7, 6, 8, 9, 7, 8, 9, 7, 8, 9, 7,
- 8, 9, 7, 8, 9, 8, 8, 9, 8, 8, 9, 8, 9, 9, 8, 8,
- 8, 8, 9, 9, 8, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, 9,
- 8, 8, 8, 7, 8, 8, 8, 8, 8, 7, 7, 6,
- },
- {
- 0, 4, 9, 3, 6, 9, 7, 8, 10, 3, 6, 9, 5, 7, 10, 9,
- 9, 10, 7, 8, 10, 8, 9, 10, 10, 10, 10, 2, 6, 9, 4, 7,
- 10, 8, 9, 10, 4, 7, 10, 6, 7, 10, 9, 9, 10, 7, 8, 10,
- 8, 9, 10, 10, 10, 10, 6, 8, 10, 7, 9, 11, 9, 10, 11, 7,
- 9, 11, 8, 9, 11, 10, 10, 11, 8, 9, 11, 9, 10, 11, 11, 11,
- 10, 8, 10, 11, 9, 10, 11, 9, 10, 11, 8, 10, 11, 9, 10, 11,
- 10, 10, 11, 8, 10, 11, 9, 10, 10, 10, 10, 9,
- },
- },
- {
- {
- 0, 4, 8, 3, 6, 8, 6, 7, 9, 4, 6, 8, 5, 7, 8, 8,
- 8, 9, 7, 7, 8, 8, 8, 8, 8, 9, 8, 3, 6, 8, 4, 6,
- 9, 7, 7, 9, 5, 6, 9, 6, 7, 9, 8, 8, 9, 7, 8, 8,
- 8, 8, 8, 8, 8, 8, 6, 8, 9, 7, 8, 10, 7, 8, 9, 7,
- 8, 10, 7, 8, 10, 8, 8, 9, 7, 8, 9, 8, 9, 9, 9, 9,
- 8, 7, 9, 10, 8, 9, 10, 8, 8, 8, 8, 9, 10, 8, 9, 9,
- 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 7, 6,
- },
- {
- 0, 4, 9, 3, 6, 10, 8, 9, 11, 3, 5, 9, 5, 7, 10, 9,
- 10, 11, 7, 8, 10, 9, 9, 11, 11, 11, 12, 2, 5, 10, 4, 7,
- 10, 8, 9, 11, 4, 6, 10, 6, 7, 10, 9, 10, 11, 7, 9, 10,
- 9, 9, 11, 11, 11, 11, 6, 8, 11, 7, 9, 11, 9, 10, 12, 7,
- 9, 11, 8, 9, 12, 10, 10, 12, 8, 10, 11, 10, 10, 11, 12, 11,
- 11, 8, 10, 12, 9, 11, 12, 10, 11, 12, 9, 10, 12, 10, 11, 12,
- 11, 11, 12, 9, 10, 12, 10, 10, 11, 11, 11, 10,
- },
- },
- {
- {
- 0, 4, 8, 3, 6, 9, 7, 8, 9, 4, 6, 8, 5, 7, 9, 8,
- 9, 9, 7, 8, 9, 8, 8, 9, 9, 9, 9, 2, 6, 9, 4, 6,
- 9, 7, 8, 10, 5, 7, 9, 6, 7, 9, 8, 8, 9, 7, 8, 9,
- 8, 8, 9, 9, 9, 9, 6, 8, 10, 7, 8, 10, 8, 9, 10, 6,
- 8, 10, 8, 8, 10, 9, 9, 10, 8, 9, 10, 9, 9, 10, 10, 10,
- 9, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 9, 9, 10,
- 9, 9, 9, 8, 9, 9, 8, 9, 9, 9, 9, 8,
- },
- {
- 0, 4, 10, 3, 6, 10, 8, 10, 12, 2, 6, 10, 6, 8, 11, 10,
- 11, 12, 7, 9, 11, 9, 10, 12, 12, 13, 13, 2, 6, 10, 4, 7,
- 11, 9, 10, 13, 4, 7, 11, 7, 8, 11, 10, 11, 12, 8, 9, 12,
- 10, 10, 12, 12, 12, 13, 6, 9, 12, 8, 10, 13, 10, 12, 14, 7,
- 10, 13, 9, 10, 13, 11, 11, 13, 9, 11, 13, 11, 11, 13, 13, 13,
- 13, 9, 11, 13, 10, 12, 14, 11, 12, 14, 9, 11, 14, 11, 12, 14,
- 12, 12, 14, 9, 12, 13, 11, 12, 13, 13, 12, 12,
- },
- },
- {
- {
- 0, 4, 9, 3, 6, 9, 7, 8, 10, 3, 6, 9, 6, 7, 9, 9,
- 9, 10, 7, 8, 9, 8, 9, 10, 10, 10, 11, 2, 6, 9, 4, 7,
- 10, 7, 9, 10, 4, 7, 10, 6, 7, 10, 9, 9, 10, 7, 8, 10,
- 8, 9, 10, 10, 10, 10, 6, 8, 11, 7, 9, 11, 8, 10, 11, 6,
- 9, 11, 8, 9, 11, 9, 9, 11, 8, 9, 11, 9, 10, 11, 11, 10,
- 10, 8, 10, 11, 9, 10, 11, 9, 10, 11, 8, 10, 11, 9, 10, 11,
- 10, 10, 11, 8, 10, 11, 9, 10, 11, 10, 10, 10,
- },
- {
- 0, 4, 12, 3, 7, 12, 10, 11, 14, 3, 6, 12, 7, 9, 13, 12,
- 13, 14, 8, 11, 13, 11, 12, 14, 14, 14, 14, 1, 7, 12, 5, 8,
- 13, 10, 12, 14, 4, 8, 13, 8, 9, 13, 12, 13, 14, 9, 11, 14,
- 11, 12, 14, 14, 14, 14, 7, 10, 14, 9, 11, 14, 11, 13, 16, 8,
- 11, 14, 10, 12, 14, 13, 13, 16, 10, 12, 15, 12, 13, 15, 15, 15,
- 15, 10, 13, 15, 12, 13, 14, 13, 15, 15, 10, 13, 15, 12, 13, 15,
- 13, 14, 15, 10, 13, 14, 12, 13, 14, 14, 14, 14,
- },
- },
- {
- {
- 0, 4, 9, 3, 6, 10, 7, 9, 11, 3, 5, 9, 5, 7, 10, 9,
- 10, 12, 7, 8, 10, 9, 10, 11, 11, 12, 12, 2, 6, 10, 4, 7,
- 10, 7, 9, 12, 4, 7, 10, 6, 7, 11, 9, 10, 12, 7, 9, 11,
- 9, 9, 11, 11, 11, 12, 5, 8, 11, 7, 9, 12, 9, 10, 13, 6,
- 9, 12, 8, 9, 12, 10, 10, 12, 8, 10, 12, 10, 10, 12, 12, 12,
- 12, 8, 10, 12, 9, 11, 13, 10, 11, 13, 9, 11, 13, 10, 11, 13,
- 11, 11, 13, 9, 11, 12, 10, 11, 12, 11, 11, 12,
- },
- {
- 0, 4, 12, 3, 7, 13, 10, 12, 15, 3, 7, 13, 7, 9, 14, 12,
- 12, 13, 8, 11, 14, 11, 13, 15, 15, 14, 14, 1, 6, 13, 5, 8,
- 13, 10, 13, 15, 4, 8, 13, 8, 9, 14, 13, 13, 15, 8, 11, 14,
- 12, 12, 15, 15, 14, 14, 7, 10, 13, 9, 11, 13, 12, 14, 16, 8,
- 11, 14, 10, 12, 15, 13, 13, 16, 10, 12, 15, 12, 13, 15, 15, 14,
- 15, 11, 12, 14, 12, 14, 14, 13, 15, 15, 10, 12, 14, 12, 13, 15,
- 14, 15, 15, 10, 13, 13, 12, 13, 15, 14, 14, 15,
- },
- },
- {
- {
- 0, 5, 10, 3, 7, 11, 9, 11, 14, 3, 7, 11, 7, 8, 12, 11,
- 12, 14, 7, 9, 12, 10, 11, 14, 13, 14, 16, 1, 7, 11, 5, 8,
- 12, 9, 11, 15, 4, 8, 12, 7, 9, 13, 11, 12, 15, 8, 10, 13,
- 10, 11, 14, 14, 14, 16, 6, 9, 13, 8, 11, 14, 10, 13, 16, 7,
- 10, 14, 9, 11, 15, 12, 13, 16, 9, 11, 15, 12, 12, 15, 14, 14,
- 16, 10, 12, 14, 11, 13, 15, 12, 14, 16, 10, 12, 15, 11, 13, 16,
- 13, 14, 16, 10, 13, 16, 12, 13, 15, 14, 15, 16,
- },
- {
- 0, 5, 16, 3, 8, 14, 11, 13, 14, 2, 8, 14, 8, 10, 16, 13,
- 13, 14, 9, 13, 16, 12, 13, 16, 16, 14, 16, 1, 7, 14, 6, 10,
- 14, 12, 16, 16, 5, 9, 14, 9, 11, 16, 15, 16, 16, 10, 12, 16,
- 13, 13, 16, 16, 14, 16, 8, 11, 14, 11, 13, 14, 14, 14, 16, 8,
- 12, 14, 11, 13, 16, 16, 16, 16, 10, 12, 15, 13, 14, 16, 16, 16,
- 16, 11, 14, 14, 14, 15, 16, 16, 15, 16, 10, 13, 16, 13, 14, 14,
- 16, 16, 16, 10, 13, 16, 13, 14, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 5, 11, 3, 7, 13, 9, 12, 16, 3, 7, 12, 6, 9, 14, 11,
- 13, 16, 7, 10, 16, 11, 12, 16, 16, 16, 16, 1, 6, 12, 5, 9,
- 16, 9, 13, 16, 4, 8, 16, 7, 10, 16, 12, 15, 16, 7, 11, 16,
- 11, 12, 16, 16, 16, 16, 6, 10, 15, 8, 11, 16, 11, 14, 16, 7,
- 11, 16, 10, 12, 16, 13, 16, 16, 9, 13, 16, 13, 14, 16, 16, 16,
- 16, 10, 12, 16, 12, 16, 16, 16, 16, 16, 11, 13, 16, 13, 16, 16,
- 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 0, 5, 16, 3, 8, 16, 12, 12, 16, 2, 8, 16, 8, 10, 16, 13,
- 13, 16, 9, 13, 16, 12, 13, 16, 16, 16, 16, 1, 8, 16, 6, 10,
- 16, 12, 16, 16, 5, 9, 16, 9, 11, 16, 13, 16, 16, 9, 12, 14,
- 12, 12, 16, 16, 16, 16, 8, 11, 13, 11, 12, 16, 14, 16, 16, 8,
- 12, 16, 11, 13, 16, 16, 15, 16, 9, 13, 14, 12, 13, 16, 16, 16,
- 16, 10, 12, 13, 14, 13, 16, 16, 16, 16, 9, 13, 16, 13, 12, 16,
- 16, 16, 16, 10, 12, 16, 14, 15, 16, 16, 16, 16,
- },
- },
+static const uint8_t rv34_table_inter_secondpat[NUM_INTER_TABLES][2][OTHERBLK_VLC_SIZE] = {
+ {
+ {
+ 0, 4, 8, 3, 6, 8, 6, 7, 8, 4, 6, 8, 6, 7, 8, 7,
+ 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 3, 6, 8, 4, 6,
+ 9, 7, 7, 8, 5, 7, 9, 6, 7, 9, 8, 8, 8, 7, 8, 8,
+ 8, 8, 8, 8, 8, 7, 6, 8, 9, 7, 8, 9, 7, 8, 9, 7,
+ 8, 9, 7, 8, 9, 8, 8, 9, 8, 8, 9, 8, 9, 9, 8, 8,
+ 8, 8, 9, 9, 8, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, 9,
+ 8, 8, 8, 7, 8, 8, 8, 8, 8, 7, 7, 6,
+ },
+ {
+ 0, 4, 9, 3, 6, 9, 7, 8, 10, 3, 6, 9, 5, 7, 10, 9,
+ 9, 10, 7, 8, 10, 8, 9, 10, 10, 10, 10, 2, 6, 9, 4, 7,
+ 10, 8, 9, 10, 4, 7, 10, 6, 7, 10, 9, 9, 10, 7, 8, 10,
+ 8, 9, 10, 10, 10, 10, 6, 8, 10, 7, 9, 11, 9, 10, 11, 7,
+ 9, 11, 8, 9, 11, 10, 10, 11, 8, 9, 11, 9, 10, 11, 11, 11,
+ 10, 8, 10, 11, 9, 10, 11, 9, 10, 11, 8, 10, 11, 9, 10, 11,
+ 10, 10, 11, 8, 10, 11, 9, 10, 10, 10, 10, 9,
+ },
+ },
+ {
+ {
+ 0, 4, 8, 3, 6, 8, 6, 7, 9, 4, 6, 8, 5, 7, 8, 8,
+ 8, 9, 7, 7, 8, 8, 8, 8, 8, 9, 8, 3, 6, 8, 4, 6,
+ 9, 7, 7, 9, 5, 6, 9, 6, 7, 9, 8, 8, 9, 7, 8, 8,
+ 8, 8, 8, 8, 8, 8, 6, 8, 9, 7, 8, 10, 7, 8, 9, 7,
+ 8, 10, 7, 8, 10, 8, 8, 9, 7, 8, 9, 8, 9, 9, 9, 9,
+ 8, 7, 9, 10, 8, 9, 10, 8, 8, 8, 8, 9, 10, 8, 9, 9,
+ 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 7, 6,
+ },
+ {
+ 0, 4, 9, 3, 6, 10, 8, 9, 11, 3, 5, 9, 5, 7, 10, 9,
+ 10, 11, 7, 8, 10, 9, 9, 11, 11, 11, 12, 2, 5, 10, 4, 7,
+ 10, 8, 9, 11, 4, 6, 10, 6, 7, 10, 9, 10, 11, 7, 9, 10,
+ 9, 9, 11, 11, 11, 11, 6, 8, 11, 7, 9, 11, 9, 10, 12, 7,
+ 9, 11, 8, 9, 12, 10, 10, 12, 8, 10, 11, 10, 10, 11, 12, 11,
+ 11, 8, 10, 12, 9, 11, 12, 10, 11, 12, 9, 10, 12, 10, 11, 12,
+ 11, 11, 12, 9, 10, 12, 10, 10, 11, 11, 11, 10,
+ },
+ },
+ {
+ {
+ 0, 4, 8, 3, 6, 9, 7, 8, 9, 4, 6, 8, 5, 7, 9, 8,
+ 9, 9, 7, 8, 9, 8, 8, 9, 9, 9, 9, 2, 6, 9, 4, 6,
+ 9, 7, 8, 10, 5, 7, 9, 6, 7, 9, 8, 8, 9, 7, 8, 9,
+ 8, 8, 9, 9, 9, 9, 6, 8, 10, 7, 8, 10, 8, 9, 10, 6,
+ 8, 10, 8, 8, 10, 9, 9, 10, 8, 9, 10, 9, 9, 10, 10, 10,
+ 9, 8, 9, 10, 8, 9, 10, 8, 9, 10, 8, 9, 10, 9, 9, 10,
+ 9, 9, 9, 8, 9, 9, 8, 9, 9, 9, 9, 8,
+ },
+ {
+ 0, 4, 10, 3, 6, 10, 8, 10, 12, 2, 6, 10, 6, 8, 11, 10,
+ 11, 12, 7, 9, 11, 9, 10, 12, 12, 13, 13, 2, 6, 10, 4, 7,
+ 11, 9, 10, 13, 4, 7, 11, 7, 8, 11, 10, 11, 12, 8, 9, 12,
+ 10, 10, 12, 12, 12, 13, 6, 9, 12, 8, 10, 13, 10, 12, 14, 7,
+ 10, 13, 9, 10, 13, 11, 11, 13, 9, 11, 13, 11, 11, 13, 13, 13,
+ 13, 9, 11, 13, 10, 12, 14, 11, 12, 14, 9, 11, 14, 11, 12, 14,
+ 12, 12, 14, 9, 12, 13, 11, 12, 13, 13, 12, 12,
+ },
+ },
+ {
+ {
+ 0, 4, 9, 3, 6, 9, 7, 8, 10, 3, 6, 9, 6, 7, 9, 9,
+ 9, 10, 7, 8, 9, 8, 9, 10, 10, 10, 11, 2, 6, 9, 4, 7,
+ 10, 7, 9, 10, 4, 7, 10, 6, 7, 10, 9, 9, 10, 7, 8, 10,
+ 8, 9, 10, 10, 10, 10, 6, 8, 11, 7, 9, 11, 8, 10, 11, 6,
+ 9, 11, 8, 9, 11, 9, 9, 11, 8, 9, 11, 9, 10, 11, 11, 10,
+ 10, 8, 10, 11, 9, 10, 11, 9, 10, 11, 8, 10, 11, 9, 10, 11,
+ 10, 10, 11, 8, 10, 11, 9, 10, 11, 10, 10, 10,
+ },
+ {
+ 0, 4, 12, 3, 7, 12, 10, 11, 14, 3, 6, 12, 7, 9, 13, 12,
+ 13, 14, 8, 11, 13, 11, 12, 14, 14, 14, 14, 1, 7, 12, 5, 8,
+ 13, 10, 12, 14, 4, 8, 13, 8, 9, 13, 12, 13, 14, 9, 11, 14,
+ 11, 12, 14, 14, 14, 14, 7, 10, 14, 9, 11, 14, 11, 13, 16, 8,
+ 11, 14, 10, 12, 14, 13, 13, 16, 10, 12, 15, 12, 13, 15, 15, 15,
+ 15, 10, 13, 15, 12, 13, 14, 13, 15, 15, 10, 13, 15, 12, 13, 15,
+ 13, 14, 15, 10, 13, 14, 12, 13, 14, 14, 14, 14,
+ },
+ },
+ {
+ {
+ 0, 4, 9, 3, 6, 10, 7, 9, 11, 3, 5, 9, 5, 7, 10, 9,
+ 10, 12, 7, 8, 10, 9, 10, 11, 11, 12, 12, 2, 6, 10, 4, 7,
+ 10, 7, 9, 12, 4, 7, 10, 6, 7, 11, 9, 10, 12, 7, 9, 11,
+ 9, 9, 11, 11, 11, 12, 5, 8, 11, 7, 9, 12, 9, 10, 13, 6,
+ 9, 12, 8, 9, 12, 10, 10, 12, 8, 10, 12, 10, 10, 12, 12, 12,
+ 12, 8, 10, 12, 9, 11, 13, 10, 11, 13, 9, 11, 13, 10, 11, 13,
+ 11, 11, 13, 9, 11, 12, 10, 11, 12, 11, 11, 12,
+ },
+ {
+ 0, 4, 12, 3, 7, 13, 10, 12, 15, 3, 7, 13, 7, 9, 14, 12,
+ 12, 13, 8, 11, 14, 11, 13, 15, 15, 14, 14, 1, 6, 13, 5, 8,
+ 13, 10, 13, 15, 4, 8, 13, 8, 9, 14, 13, 13, 15, 8, 11, 14,
+ 12, 12, 15, 15, 14, 14, 7, 10, 13, 9, 11, 13, 12, 14, 16, 8,
+ 11, 14, 10, 12, 15, 13, 13, 16, 10, 12, 15, 12, 13, 15, 15, 14,
+ 15, 11, 12, 14, 12, 14, 14, 13, 15, 15, 10, 12, 14, 12, 13, 15,
+ 14, 15, 15, 10, 13, 13, 12, 13, 15, 14, 14, 15,
+ },
+ },
+ {
+ {
+ 0, 5, 10, 3, 7, 11, 9, 11, 14, 3, 7, 11, 7, 8, 12, 11,
+ 12, 14, 7, 9, 12, 10, 11, 14, 13, 14, 16, 1, 7, 11, 5, 8,
+ 12, 9, 11, 15, 4, 8, 12, 7, 9, 13, 11, 12, 15, 8, 10, 13,
+ 10, 11, 14, 14, 14, 16, 6, 9, 13, 8, 11, 14, 10, 13, 16, 7,
+ 10, 14, 9, 11, 15, 12, 13, 16, 9, 11, 15, 12, 12, 15, 14, 14,
+ 16, 10, 12, 14, 11, 13, 15, 12, 14, 16, 10, 12, 15, 11, 13, 16,
+ 13, 14, 16, 10, 13, 16, 12, 13, 15, 14, 15, 16,
+ },
+ {
+ 0, 5, 16, 3, 8, 14, 11, 13, 14, 2, 8, 14, 8, 10, 16, 13,
+ 13, 14, 9, 13, 16, 12, 13, 16, 16, 14, 16, 1, 7, 14, 6, 10,
+ 14, 12, 16, 16, 5, 9, 14, 9, 11, 16, 15, 16, 16, 10, 12, 16,
+ 13, 13, 16, 16, 14, 16, 8, 11, 14, 11, 13, 14, 14, 14, 16, 8,
+ 12, 14, 11, 13, 16, 16, 16, 16, 10, 12, 15, 13, 14, 16, 16, 16,
+ 16, 11, 14, 14, 14, 15, 16, 16, 15, 16, 10, 13, 16, 13, 14, 14,
+ 16, 16, 16, 10, 13, 16, 13, 14, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 5, 11, 3, 7, 13, 9, 12, 16, 3, 7, 12, 6, 9, 14, 11,
+ 13, 16, 7, 10, 16, 11, 12, 16, 16, 16, 16, 1, 6, 12, 5, 9,
+ 16, 9, 13, 16, 4, 8, 16, 7, 10, 16, 12, 15, 16, 7, 11, 16,
+ 11, 12, 16, 16, 16, 16, 6, 10, 15, 8, 11, 16, 11, 14, 16, 7,
+ 11, 16, 10, 12, 16, 13, 16, 16, 9, 13, 16, 13, 14, 16, 16, 16,
+ 16, 10, 12, 16, 12, 16, 16, 16, 16, 16, 11, 13, 16, 13, 16, 16,
+ 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 0, 5, 16, 3, 8, 16, 12, 12, 16, 2, 8, 16, 8, 10, 16, 13,
+ 13, 16, 9, 13, 16, 12, 13, 16, 16, 16, 16, 1, 8, 16, 6, 10,
+ 16, 12, 16, 16, 5, 9, 16, 9, 11, 16, 13, 16, 16, 9, 12, 14,
+ 12, 12, 16, 16, 16, 16, 8, 11, 13, 11, 12, 16, 14, 16, 16, 8,
+ 12, 16, 11, 13, 16, 16, 15, 16, 9, 13, 14, 12, 13, 16, 16, 16,
+ 16, 10, 12, 13, 14, 13, 16, 16, 16, 16, 9, 13, 16, 13, 12, 16,
+ 16, 16, 16, 10, 12, 16, 14, 15, 16, 16, 16, 16,
+ },
+ },
};
-static const uint8_t rv34_table_inter_thirdpat[NUM_INTER_TABLES][2][OTHERBLK_VLC_SIZE] =
-{
- {
- {
- 0, 5, 8, 3, 6, 9, 6, 7, 9, 4, 6, 9, 6, 7, 9, 8,
- 8, 9, 7, 8, 9, 8, 9, 9, 9, 9, 9, 2, 6, 9, 4, 7,
- 9, 7, 8, 9, 5, 7, 9, 6, 7, 9, 8, 8, 9, 7, 8, 9,
- 8, 9, 9, 9, 9, 8, 5, 8, 10, 6, 8, 10, 8, 9, 9, 7,
- 8, 10, 7, 9, 10, 8, 9, 9, 8, 9, 10, 9, 9, 10, 9, 9,
- 9, 7, 9, 10, 8, 9, 10, 8, 8, 9, 8, 9, 10, 8, 9, 10,
- 8, 8, 9, 8, 9, 9, 8, 9, 9, 8, 8, 7,
- },
- {
- 0, 4, 9, 2, 6, 10, 7, 8, 10, 3, 6, 10, 6, 7, 10, 9,
- 9, 10, 8, 9, 11, 9, 10, 11, 10, 11, 11, 2, 6, 10, 4, 7,
- 10, 8, 9, 10, 5, 7, 10, 7, 8, 10, 9, 9, 10, 9, 10, 11,
- 10, 10, 11, 11, 11, 11, 6, 9, 11, 7, 9, 11, 9, 10, 12, 8,
- 9, 11, 8, 10, 11, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11,
- 11, 9, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12,
- 11, 11, 12, 11, 12, 12, 11, 12, 12, 12, 11, 11,
- },
- },
- {
- {
- 0, 4, 9, 3, 6, 9, 6, 8, 9, 4, 6, 9, 5, 7, 9, 8,
- 8, 9, 7, 8, 10, 8, 9, 10, 9, 9, 9, 2, 6, 9, 4, 7,
- 9, 7, 8, 9, 5, 7, 9, 6, 7, 10, 8, 9, 9, 7, 9, 10,
- 8, 9, 10, 9, 9, 9, 5, 8, 10, 6, 8, 10, 8, 9, 10, 7,
- 8, 10, 7, 9, 11, 9, 9, 10, 8, 9, 10, 9, 10, 10, 10, 10,
- 9, 7, 9, 10, 8, 9, 11, 8, 9, 10, 8, 9, 11, 8, 9, 11,
- 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 9, 8,
- },
- {
- 0, 4, 9, 2, 5, 10, 7, 8, 11, 3, 6, 10, 6, 7, 10, 9,
- 10, 11, 8, 9, 11, 9, 10, 11, 11, 11, 12, 2, 6, 10, 4, 7,
- 10, 8, 9, 11, 5, 7, 10, 6, 8, 10, 9, 10, 11, 9, 10, 12,
- 10, 10, 12, 11, 12, 12, 6, 9, 11, 8, 9, 12, 9, 11, 13, 8,
- 10, 12, 9, 10, 12, 11, 11, 12, 10, 12, 13, 11, 12, 13, 13, 12,
- 13, 10, 11, 13, 10, 12, 13, 11, 12, 13, 11, 12, 13, 11, 12, 13,
- 12, 12, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13,
- },
- },
- {
- {
- 0, 4, 9, 3, 6, 9, 7, 8, 10, 3, 6, 9, 5, 7, 10, 8,
- 9, 10, 7, 9, 10, 8, 9, 10, 10, 10, 10, 2, 6, 9, 4, 7,
- 10, 7, 9, 10, 4, 7, 10, 6, 8, 10, 8, 9, 10, 8, 9, 10,
- 9, 9, 10, 10, 10, 10, 5, 8, 11, 7, 9, 11, 8, 10, 11, 7,
- 9, 11, 8, 9, 11, 9, 10, 11, 9, 10, 11, 10, 10, 11, 11, 11,
- 11, 8, 10, 11, 9, 10, 11, 9, 10, 11, 9, 10, 12, 9, 10, 12,
- 10, 11, 11, 9, 10, 11, 10, 11, 11, 10, 10, 10,
- },
- {
- 0, 4, 10, 3, 6, 11, 8, 10, 12, 3, 6, 11, 6, 8, 11, 10,
- 11, 13, 9, 10, 13, 11, 12, 14, 13, 13, 14, 1, 6, 10, 5, 8,
- 12, 9, 10, 13, 5, 8, 11, 7, 9, 12, 11, 11, 13, 10, 12, 13,
- 11, 12, 14, 14, 13, 15, 7, 10, 12, 9, 11, 14, 11, 12, 15, 9,
- 11, 13, 10, 11, 14, 12, 12, 14, 12, 14, 16, 13, 13, 16, 14, 14,
- 16, 12, 13, 15, 12, 14, 15, 13, 14, 16, 13, 14, 16, 14, 14, 16,
- 14, 15, 16, 14, 16, 16, 15, 16, 16, 15, 15, 16,
- },
- },
- {
- {
- 0, 4, 9, 2, 6, 9, 7, 9, 11, 3, 6, 10, 6, 7, 10, 9,
- 10, 11, 7, 9, 10, 9, 10, 11, 11, 11, 12, 2, 6, 10, 4, 7,
- 10, 8, 9, 11, 5, 7, 10, 7, 8, 10, 9, 10, 11, 8, 9, 11,
- 9, 10, 11, 11, 12, 11, 6, 9, 11, 7, 10, 12, 9, 11, 12, 7,
- 10, 12, 9, 10, 12, 11, 11, 12, 9, 11, 12, 10, 11, 12, 12, 12,
- 12, 9, 11, 12, 9, 11, 13, 11, 12, 13, 9, 11, 13, 10, 12, 13,
- 11, 12, 13, 11, 12, 13, 11, 12, 13, 12, 13, 12,
- },
- {
- 0, 4, 11, 2, 6, 12, 9, 11, 16, 4, 7, 12, 7, 9, 15, 11,
- 12, 16, 10, 11, 16, 11, 13, 16, 16, 16, 16, 1, 6, 11, 5, 8,
- 16, 9, 12, 16, 6, 9, 15, 8, 10, 16, 12, 13, 16, 12, 14, 16,
- 12, 16, 16, 16, 16, 16, 8, 11, 14, 10, 12, 16, 12, 16, 16, 10,
- 13, 16, 12, 16, 16, 13, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16,
- 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 5, 9, 3, 6, 10, 8, 10, 12, 3, 6, 10, 6, 8, 10, 10,
- 11, 12, 8, 9, 11, 10, 10, 12, 13, 13, 13, 1, 6, 10, 5, 8,
- 11, 9, 11, 13, 5, 8, 11, 7, 9, 11, 11, 11, 13, 8, 9, 11,
- 10, 10, 12, 13, 13, 14, 6, 9, 12, 8, 11, 13, 11, 13, 15, 8,
- 10, 13, 10, 11, 13, 12, 13, 15, 10, 12, 13, 12, 12, 13, 14, 14,
- 14, 9, 12, 14, 11, 13, 15, 13, 15, 16, 11, 13, 15, 12, 14, 15,
- 14, 15, 16, 13, 14, 15, 14, 14, 15, 15, 16, 16,
- },
- {
- 0, 4, 16, 2, 7, 16, 10, 13, 16, 3, 8, 16, 7, 10, 16, 16,
- 16, 16, 12, 16, 16, 15, 16, 16, 16, 16, 16, 1, 7, 16, 6, 9,
- 16, 10, 16, 16, 7, 12, 16, 9, 13, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 9, 16, 16, 11, 13, 16, 16, 16, 16, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 4, 9, 3, 6, 11, 9, 12, 16, 3, 6, 10, 6, 8, 11, 12,
- 13, 16, 8, 9, 12, 10, 11, 13, 16, 16, 16, 1, 6, 10, 5, 8,
- 12, 10, 13, 16, 5, 8, 11, 8, 9, 13, 13, 14, 16, 9, 10, 14,
- 11, 12, 15, 16, 16, 16, 6, 10, 13, 9, 12, 16, 14, 16, 16, 9,
- 12, 14, 11, 13, 16, 16, 16, 16, 12, 14, 16, 14, 16, 16, 16, 16,
- 16, 11, 16, 16, 13, 16, 16, 16, 16, 16, 12, 16, 16, 13, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 0, 4, 16, 2, 8, 16, 10, 16, 16, 3, 9, 16, 8, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 7, 16, 5, 10,
- 16, 16, 16, 16, 7, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 10, 15, 16, 10, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
- {
- {
- 0, 3, 9, 3, 7, 11, 11, 15, 16, 3, 6, 11, 7, 9, 12, 16,
- 16, 16, 8, 10, 16, 11, 16, 16, 16, 16, 16, 1, 6, 11, 6, 9,
- 15, 16, 16, 16, 5, 8, 16, 9, 11, 16, 16, 16, 16, 10, 16, 16,
- 16, 16, 16, 16, 16, 16, 7, 11, 16, 11, 16, 16, 16, 16, 16, 11,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 0, 4, 16, 2, 8, 16, 16, 16, 16, 3, 12, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 7, 16, 5, 12,
- 16, 16, 16, 16, 6, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- },
+static const uint8_t rv34_table_inter_thirdpat[NUM_INTER_TABLES][2][OTHERBLK_VLC_SIZE] = {
+ {
+ {
+ 0, 5, 8, 3, 6, 9, 6, 7, 9, 4, 6, 9, 6, 7, 9, 8,
+ 8, 9, 7, 8, 9, 8, 9, 9, 9, 9, 9, 2, 6, 9, 4, 7,
+ 9, 7, 8, 9, 5, 7, 9, 6, 7, 9, 8, 8, 9, 7, 8, 9,
+ 8, 9, 9, 9, 9, 8, 5, 8, 10, 6, 8, 10, 8, 9, 9, 7,
+ 8, 10, 7, 9, 10, 8, 9, 9, 8, 9, 10, 9, 9, 10, 9, 9,
+ 9, 7, 9, 10, 8, 9, 10, 8, 8, 9, 8, 9, 10, 8, 9, 10,
+ 8, 8, 9, 8, 9, 9, 8, 9, 9, 8, 8, 7,
+ },
+ {
+ 0, 4, 9, 2, 6, 10, 7, 8, 10, 3, 6, 10, 6, 7, 10, 9,
+ 9, 10, 8, 9, 11, 9, 10, 11, 10, 11, 11, 2, 6, 10, 4, 7,
+ 10, 8, 9, 10, 5, 7, 10, 7, 8, 10, 9, 9, 10, 9, 10, 11,
+ 10, 10, 11, 11, 11, 11, 6, 9, 11, 7, 9, 11, 9, 10, 12, 8,
+ 9, 11, 8, 10, 11, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11,
+ 11, 9, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12,
+ 11, 11, 12, 11, 12, 12, 11, 12, 12, 12, 11, 11,
+ },
+ },
+ {
+ {
+ 0, 4, 9, 3, 6, 9, 6, 8, 9, 4, 6, 9, 5, 7, 9, 8,
+ 8, 9, 7, 8, 10, 8, 9, 10, 9, 9, 9, 2, 6, 9, 4, 7,
+ 9, 7, 8, 9, 5, 7, 9, 6, 7, 10, 8, 9, 9, 7, 9, 10,
+ 8, 9, 10, 9, 9, 9, 5, 8, 10, 6, 8, 10, 8, 9, 10, 7,
+ 8, 10, 7, 9, 11, 9, 9, 10, 8, 9, 10, 9, 10, 10, 10, 10,
+ 9, 7, 9, 10, 8, 9, 11, 8, 9, 10, 8, 9, 11, 8, 9, 11,
+ 9, 9, 10, 9, 9, 10, 9, 9, 10, 9, 9, 8,
+ },
+ {
+ 0, 4, 9, 2, 5, 10, 7, 8, 11, 3, 6, 10, 6, 7, 10, 9,
+ 10, 11, 8, 9, 11, 9, 10, 11, 11, 11, 12, 2, 6, 10, 4, 7,
+ 10, 8, 9, 11, 5, 7, 10, 6, 8, 10, 9, 10, 11, 9, 10, 12,
+ 10, 10, 12, 11, 12, 12, 6, 9, 11, 8, 9, 12, 9, 11, 13, 8,
+ 10, 12, 9, 10, 12, 11, 11, 12, 10, 12, 13, 11, 12, 13, 13, 12,
+ 13, 10, 11, 13, 10, 12, 13, 11, 12, 13, 11, 12, 13, 11, 12, 13,
+ 12, 12, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13,
+ },
+ },
+ {
+ {
+ 0, 4, 9, 3, 6, 9, 7, 8, 10, 3, 6, 9, 5, 7, 10, 8,
+ 9, 10, 7, 9, 10, 8, 9, 10, 10, 10, 10, 2, 6, 9, 4, 7,
+ 10, 7, 9, 10, 4, 7, 10, 6, 8, 10, 8, 9, 10, 8, 9, 10,
+ 9, 9, 10, 10, 10, 10, 5, 8, 11, 7, 9, 11, 8, 10, 11, 7,
+ 9, 11, 8, 9, 11, 9, 10, 11, 9, 10, 11, 10, 10, 11, 11, 11,
+ 11, 8, 10, 11, 9, 10, 11, 9, 10, 11, 9, 10, 12, 9, 10, 12,
+ 10, 11, 11, 9, 10, 11, 10, 11, 11, 10, 10, 10,
+ },
+ {
+ 0, 4, 10, 3, 6, 11, 8, 10, 12, 3, 6, 11, 6, 8, 11, 10,
+ 11, 13, 9, 10, 13, 11, 12, 14, 13, 13, 14, 1, 6, 10, 5, 8,
+ 12, 9, 10, 13, 5, 8, 11, 7, 9, 12, 11, 11, 13, 10, 12, 13,
+ 11, 12, 14, 14, 13, 15, 7, 10, 12, 9, 11, 14, 11, 12, 15, 9,
+ 11, 13, 10, 11, 14, 12, 12, 14, 12, 14, 16, 13, 13, 16, 14, 14,
+ 16, 12, 13, 15, 12, 14, 15, 13, 14, 16, 13, 14, 16, 14, 14, 16,
+ 14, 15, 16, 14, 16, 16, 15, 16, 16, 15, 15, 16,
+ },
+ },
+ {
+ {
+ 0, 4, 9, 2, 6, 9, 7, 9, 11, 3, 6, 10, 6, 7, 10, 9,
+ 10, 11, 7, 9, 10, 9, 10, 11, 11, 11, 12, 2, 6, 10, 4, 7,
+ 10, 8, 9, 11, 5, 7, 10, 7, 8, 10, 9, 10, 11, 8, 9, 11,
+ 9, 10, 11, 11, 12, 11, 6, 9, 11, 7, 10, 12, 9, 11, 12, 7,
+ 10, 12, 9, 10, 12, 11, 11, 12, 9, 11, 12, 10, 11, 12, 12, 12,
+ 12, 9, 11, 12, 9, 11, 13, 11, 12, 13, 9, 11, 13, 10, 12, 13,
+ 11, 12, 13, 11, 12, 13, 11, 12, 13, 12, 13, 12,
+ },
+ {
+ 0, 4, 11, 2, 6, 12, 9, 11, 16, 4, 7, 12, 7, 9, 15, 11,
+ 12, 16, 10, 11, 16, 11, 13, 16, 16, 16, 16, 1, 6, 11, 5, 8,
+ 16, 9, 12, 16, 6, 9, 15, 8, 10, 16, 12, 13, 16, 12, 14, 16,
+ 12, 16, 16, 16, 16, 16, 8, 11, 14, 10, 12, 16, 12, 16, 16, 10,
+ 13, 16, 12, 16, 16, 13, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16,
+ 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 5, 9, 3, 6, 10, 8, 10, 12, 3, 6, 10, 6, 8, 10, 10,
+ 11, 12, 8, 9, 11, 10, 10, 12, 13, 13, 13, 1, 6, 10, 5, 8,
+ 11, 9, 11, 13, 5, 8, 11, 7, 9, 11, 11, 11, 13, 8, 9, 11,
+ 10, 10, 12, 13, 13, 14, 6, 9, 12, 8, 11, 13, 11, 13, 15, 8,
+ 10, 13, 10, 11, 13, 12, 13, 15, 10, 12, 13, 12, 12, 13, 14, 14,
+ 14, 9, 12, 14, 11, 13, 15, 13, 15, 16, 11, 13, 15, 12, 14, 15,
+ 14, 15, 16, 13, 14, 15, 14, 14, 15, 15, 16, 16,
+ },
+ {
+ 0, 4, 16, 2, 7, 16, 10, 13, 16, 3, 8, 16, 7, 10, 16, 16,
+ 16, 16, 12, 16, 16, 15, 16, 16, 16, 16, 16, 1, 7, 16, 6, 9,
+ 16, 10, 16, 16, 7, 12, 16, 9, 13, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 9, 16, 16, 11, 13, 16, 16, 16, 16, 12,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 4, 9, 3, 6, 11, 9, 12, 16, 3, 6, 10, 6, 8, 11, 12,
+ 13, 16, 8, 9, 12, 10, 11, 13, 16, 16, 16, 1, 6, 10, 5, 8,
+ 12, 10, 13, 16, 5, 8, 11, 8, 9, 13, 13, 14, 16, 9, 10, 14,
+ 11, 12, 15, 16, 16, 16, 6, 10, 13, 9, 12, 16, 14, 16, 16, 9,
+ 12, 14, 11, 13, 16, 16, 16, 16, 12, 14, 16, 14, 16, 16, 16, 16,
+ 16, 11, 16, 16, 13, 16, 16, 16, 16, 16, 12, 16, 16, 13, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 0, 4, 16, 2, 8, 16, 10, 16, 16, 3, 9, 16, 8, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 7, 16, 5, 10,
+ 16, 16, 16, 16, 7, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 10, 15, 16, 10, 16, 16, 16, 16, 16, 14,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
+ {
+ {
+ 0, 3, 9, 3, 7, 11, 11, 15, 16, 3, 6, 11, 7, 9, 12, 16,
+ 16, 16, 8, 10, 16, 11, 16, 16, 16, 16, 16, 1, 6, 11, 6, 9,
+ 15, 16, 16, 16, 5, 8, 16, 9, 11, 16, 16, 16, 16, 10, 16, 16,
+ 16, 16, 16, 16, 16, 16, 7, 11, 16, 11, 16, 16, 16, 16, 16, 11,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ {
+ 0, 4, 16, 2, 8, 16, 16, 16, 16, 3, 12, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 7, 16, 5, 12,
+ 16, 16, 16, 16, 6, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ },
+ },
};
-static const uint8_t rv34_inter_coeff[NUM_INTER_TABLES][COEFF_VLC_SIZE] =
+static const uint8_t rv34_inter_coeff[NUM_INTER_TABLES][COEFF_VLC_SIZE] = {
{
- {
- 1, 2, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10,
- 10, 10, 10, 11, 11, 11, 11, 12, 11, 11, 11, 13, 14, 15, 16, 16,
- },
- {
- 1, 2, 3, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10,
- 11, 11, 12, 12, 12, 12, 13, 13, 12, 12, 13, 14, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12,
- 12, 12, 13, 13, 13, 14, 14, 15, 14, 14, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
- 13, 13, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 6, 7, 8, 10, 10, 11, 11, 13, 12, 12, 13,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- },
- {
- 1, 2, 3, 4, 5, 6, 7, 8, 10, 10, 10, 11, 14, 13, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
- }
+ 1, 2, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10,
+ 10, 10, 10, 11, 11, 11, 11, 12, 11, 11, 11, 13, 14, 15, 16, 16,
+},
+{
+ 1, 2, 3, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10,
+ 11, 11, 12, 12, 12, 12, 13, 13, 12, 12, 13, 14, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12,
+ 12, 12, 13, 13, 13, 14, 14, 15, 14, 14, 16, 16, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
+ 13, 13, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 6, 7, 8, 10, 10, 11, 11, 13, 12, 12, 13,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+},
+{
+ 1, 2, 3, 4, 5, 6, 7, 8, 10, 10, 10, 11, 14, 13, 15, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
+}
};
#endif /* AVCODEC_RV34VLC_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40.c
index 17d65e3e6..3738d2d45 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40.c
@@ -37,9 +37,8 @@ static VLC aic_top_vlc;
static VLC aic_mode1_vlc[AIC_MODE1_NUM], aic_mode2_vlc[AIC_MODE2_NUM];
static VLC ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS];
-static const int16_t mode2_offs[] =
-{
- 0, 614, 1222, 1794, 2410, 3014, 3586, 4202, 4792, 5382, 5966, 6542,
+static const int16_t mode2_offs[] = {
+ 0, 614, 1222, 1794, 2410, 3014, 3586, 4202, 4792, 5382, 5966, 6542,
7138, 7716, 8292, 8864, 9444, 10030, 10642, 11212, 11814
};
@@ -60,8 +59,7 @@ static av_cold void rv40_init_tables(void)
init_vlc(&aic_top_vlc, AIC_TOP_BITS, AIC_TOP_SIZE,
rv40_aic_top_vlc_bits, 1, 1,
rv40_aic_top_vlc_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
- for(i = 0; i < AIC_MODE1_NUM; i++)
- {
+ for(i = 0; i < AIC_MODE1_NUM; i++){
// Every tenth VLC table is empty
if((i % 10) == 9) continue;
aic_mode1_vlc[i].table = &aic_mode1_table[i << AIC_MODE1_BITS];
@@ -70,31 +68,28 @@ static av_cold void rv40_init_tables(void)
aic_mode1_vlc_bits[i], 1, 1,
aic_mode1_vlc_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < AIC_MODE2_NUM; i++)
- {
+ for(i = 0; i < AIC_MODE2_NUM; i++){
aic_mode2_vlc[i].table = &aic_mode2_table[mode2_offs[i]];
aic_mode2_vlc[i].table_allocated = mode2_offs[i + 1] - mode2_offs[i];
init_vlc(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE,
aic_mode2_vlc_bits[i], 1, 1,
aic_mode2_vlc_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < NUM_PTYPE_VLCS; i++)
- {
+ for(i = 0; i < NUM_PTYPE_VLCS; i++){
ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS];
ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS;
init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE,
- ptype_vlc_bits[i], 1, 1,
- ptype_vlc_codes[i], 1, 1,
- ptype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC);
+ ptype_vlc_bits[i], 1, 1,
+ ptype_vlc_codes[i], 1, 1,
+ ptype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < NUM_BTYPE_VLCS; i++)
- {
+ for(i = 0; i < NUM_BTYPE_VLCS; i++){
btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS];
btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS;
init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE,
- btype_vlc_bits[i], 1, 1,
- btype_vlc_codes[i], 1, 1,
- btype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC);
+ btype_vlc_bits[i], 1, 1,
+ btype_vlc_codes[i], 1, 1,
+ btype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC);
}
}
@@ -110,14 +105,11 @@ static int get_dimension(GetBitContext *gb, const int *dim)
int val = dim[t];
if(val < 0)
val = dim[get_bits1(gb) - val];
- if(!val)
- {
- do
- {
+ if(!val){
+ do{
t = get_bits(gb, 8);
val += t << 2;
- }
- while(t == 0xFF);
+ }while(t == 0xFF);
}
return val;
}
@@ -172,10 +164,8 @@ static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
int pattern;
int8_t *ptr;
- for(i = 0; i < 4; i++, dst += r->intra_types_stride)
- {
- if(!i && s->first_slice_line)
- {
+ for(i = 0; i < 4; i++, dst += r->intra_types_stride){
+ if(!i && s->first_slice_line){
pattern = get_vlc2(gb, aic_top_vlc.table, AIC_TOP_BITS, 1);
dst[0] = (pattern >> 2) & 2;
dst[1] = (pattern >> 1) & 2;
@@ -184,8 +174,7 @@ static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
continue;
}
ptr = dst;
- for(j = 0; j < 4; j++)
- {
+ for(j = 0; j < 4; j++){
/* Coefficients are read using VLC chosen by the prediction pattern
* The first one (used for retrieving a pair of coefficients) is
* constructed from the top, top right and left coefficients
@@ -199,22 +188,17 @@ static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
for(k = 0; k < MODE2_PATTERNS_NUM; k++)
if(pattern == rv40_aic_table_index[k])
break;
- if(j < 3 && k < MODE2_PATTERNS_NUM) //pattern is found, decoding 2 coefficients
- {
+ if(j < 3 && k < MODE2_PATTERNS_NUM){ //pattern is found, decoding 2 coefficients
v = get_vlc2(gb, aic_mode2_vlc[k].table, AIC_MODE2_BITS, 2);
- *ptr++ = v / 9;
- *ptr++ = v % 9;
+ *ptr++ = v/9;
+ *ptr++ = v%9;
j++;
- }
- else
- {
+ }else{
if(B != -1 && C != -1)
v = get_vlc2(gb, aic_mode1_vlc[B + C*10].table, AIC_MODE1_BITS, 1);
- else // tricky decoding
- {
+ else{ // tricky decoding
v = 0;
- switch(C)
- {
+ switch(C){
case -1: // code 0 -> 1, 1 -> 0
if(B < 2)
v = get_bits1(gb) ^ 1;
@@ -249,12 +233,11 @@ static int rv40_decode_mb_info(RV34DecContext *r)
r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
if(--r->s.mb_skip_run)
- return RV34_MB_SKIP;
+ return RV34_MB_SKIP;
if(r->avail_cache[6-1])
blocks[r->mb_type[mb_pos - 1]]++;
- if(r->avail_cache[6-4])
- {
+ if(r->avail_cache[6-4]){
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]]++;
@@ -262,25 +245,20 @@ static int rv40_decode_mb_info(RV34DecContext *r)
blocks[r->mb_type[mb_pos - s->mb_stride - 1]]++;
}
- for(i = 0; i < RV34_MB_TYPES; i++)
- {
- if(blocks[i] > count)
- {
+ for(i = 0; i < RV34_MB_TYPES; i++){
+ if(blocks[i] > count){
count = blocks[i];
prev_type = i;
}
}
- if(s->pict_type == FF_P_TYPE)
- {
+ if(s->pict_type == FF_P_TYPE){
prev_type = block_num_to_ptype_vlc_num[prev_type];
q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
if(q < PBTYPE_ESCAPE)
return q;
q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
av_log(s->avctx, AV_LOG_ERROR, "Dquant for P-frame\n");
- }
- else
- {
+ }else{
prev_type = block_num_to_btype_vlc_num[prev_type];
q = get_vlc2(gb, btype_vlc[prev_type].table, BTYPE_VLC_BITS, 1);
if(q < PBTYPE_ESCAPE)
@@ -296,12 +274,12 @@ static int rv40_decode_mb_info(RV34DecContext *r)
* weaker deblocking very similar to the one described in 4.4.2 of JVT-A003r1
*/
static inline void rv40_weak_loop_filter(uint8_t *src, const int step,
- const int filter_p1, const int filter_q1,
- const int alpha, const int beta,
- const int lim_p0q0,
- const int lim_q1, const int lim_p1,
- const int diff_p1p0, const int diff_q1q0,
- const int diff_p1p2, const int diff_q1q2)
+ const int filter_p1, const int filter_q1,
+ const int alpha, const int beta,
+ const int lim_p0q0,
+ const int lim_q1, const int lim_p1,
+ const int diff_p1p0, const int diff_q1q0,
+ const int diff_p1p2, const int diff_q1q2)
{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int t, u, diff;
@@ -319,24 +297,22 @@ static inline void rv40_weak_loop_filter(uint8_t *src, const int step,
diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0);
src[-1*step] = cm[src[-1*step] + diff];
src[ 0*step] = cm[src[ 0*step] - diff];
- if(FFABS(diff_p1p2) <= beta && filter_p1)
- {
+ if(FFABS(diff_p1p2) <= beta && filter_p1){
t = (diff_p1p0 + diff_p1p2 - diff) >> 1;
src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)];
}
- if(FFABS(diff_q1q2) <= beta && filter_q1)
- {
+ if(FFABS(diff_q1q2) <= beta && filter_q1){
t = (diff_q1q0 + diff_q1q2 + diff) >> 1;
src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)];
}
}
static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
- const int stride, const int dmode,
- const int lim_q1, const int lim_p1,
- const int alpha,
- const int beta, const int beta2,
- const int chroma, const int edge)
+ const int stride, const int dmode,
+ const int lim_q1, const int lim_p1,
+ const int alpha,
+ const int beta, const int beta2,
+ const int chroma, const int edge)
{
int diff_p1p0[4], diff_q1q0[4], diff_p1p2[4], diff_q1q2[4];
int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;
@@ -346,41 +322,34 @@ static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
int i;
int lims;
- for(i = 0, ptr = src; i < 4; i++, ptr += stride)
- {
+ for(i = 0, ptr = src; i < 4; i++, ptr += stride){
diff_p1p0[i] = ptr[-2*step] - ptr[-1*step];
diff_q1q0[i] = ptr[ 1*step] - ptr[ 0*step];
sum_p1p0 += diff_p1p0[i];
sum_q1q0 += diff_q1q0[i];
}
- filter_p1 = FFABS(sum_p1p0) < (beta << 2);
- filter_q1 = FFABS(sum_q1q0) < (beta << 2);
+ filter_p1 = FFABS(sum_p1p0) < (beta<<2);
+ filter_q1 = FFABS(sum_q1q0) < (beta<<2);
if(!filter_p1 && !filter_q1)
return;
- for(i = 0, ptr = src; i < 4; i++, ptr += stride)
- {
+ for(i = 0, ptr = src; i < 4; i++, ptr += stride){
diff_p1p2[i] = ptr[-2*step] - ptr[-3*step];
diff_q1q2[i] = ptr[ 1*step] - ptr[ 2*step];
sum_p1p2 += diff_p1p2[i];
sum_q1q2 += diff_q1q2[i];
}
- if(edge)
- {
+ if(edge){
flag_strong0 = filter_p1 && (FFABS(sum_p1p2) < beta2);
flag_strong1 = filter_q1 && (FFABS(sum_q1q2) < beta2);
- }
- else
- {
+ }else{
flag_strong0 = flag_strong1 = 0;
}
lims = filter_p1 + filter_q1 + ((lim_q1 + lim_p1) >> 1) + 1;
- if(flag_strong0 && flag_strong1) /* strong filtering */
- {
- for(i = 0; i < 4; i++, src += stride)
- {
+ if(flag_strong0 && flag_strong1){ /* strong filtering */
+ for(i = 0; i < 4; i++, src += stride){
int sflag, p0, q0, p1, q1;
int t = src[0*step] - src[-1*step];
@@ -388,25 +357,23 @@ static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
sflag = (alpha * FFABS(t)) >> 7;
if(sflag > 1) continue;
- p0 = (25 * src[-3*step] + 26 * src[-2*step]
- + 26 * src[-1*step]
- + 26 * src[ 0*step] + 25 * src[ 1*step] + rv40_dither_l[dmode + i]) >> 7;
- q0 = (25 * src[-2*step] + 26 * src[-1*step]
- + 26 * src[ 0*step]
- + 26 * src[ 1*step] + 25 * src[ 2*step] + rv40_dither_r[dmode + i]) >> 7;
- if(sflag)
- {
+ p0 = (25*src[-3*step] + 26*src[-2*step]
+ + 26*src[-1*step]
+ + 26*src[ 0*step] + 25*src[ 1*step] + rv40_dither_l[dmode + i]) >> 7;
+ q0 = (25*src[-2*step] + 26*src[-1*step]
+ + 26*src[ 0*step]
+ + 26*src[ 1*step] + 25*src[ 2*step] + rv40_dither_r[dmode + i]) >> 7;
+ if(sflag){
p0 = av_clip(p0, src[-1*step] - lims, src[-1*step] + lims);
q0 = av_clip(q0, src[ 0*step] - lims, src[ 0*step] + lims);
}
- p1 = (25 * src[-4*step] + 26 * src[-3*step]
- + 26 * src[-2*step]
- + 26 * p0 + 25 * src[ 0*step] + rv40_dither_l[dmode + i]) >> 7;
- q1 = (25 * src[-1*step] + 26 * q0
- + 26 * src[ 1*step]
- + 26 * src[ 2*step] + 25 * src[ 3*step] + rv40_dither_r[dmode + i]) >> 7;
- if(sflag)
- {
+ p1 = (25*src[-4*step] + 26*src[-3*step]
+ + 26*src[-2*step]
+ + 26*p0 + 25*src[ 0*step] + rv40_dither_l[dmode + i]) >> 7;
+ q1 = (25*src[-1*step] + 26*q0
+ + 26*src[ 1*step]
+ + 26*src[ 2*step] + 25*src[ 3*step] + rv40_dither_r[dmode + i]) >> 7;
+ if(sflag){
p1 = av_clip(p1, src[-2*step] - lims, src[-2*step] + lims);
q1 = av_clip(q1, src[ 1*step] - lims, src[ 1*step] + lims);
}
@@ -414,45 +381,37 @@ static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
src[-1*step] = p0;
src[ 0*step] = q0;
src[ 1*step] = q1;
- if(!chroma)
- {
- src[-3*step] = (25 * src[-1*step] + 26 * src[-2*step] + 51 * src[-3*step] + 26 * src[-4*step] + 64) >> 7;
- src[ 2*step] = (25 * src[ 0*step] + 26 * src[ 1*step] + 51 * src[ 2*step] + 26 * src[ 3*step] + 64) >> 7;
+ if(!chroma){
+ src[-3*step] = (25*src[-1*step] + 26*src[-2*step] + 51*src[-3*step] + 26*src[-4*step] + 64) >> 7;
+ src[ 2*step] = (25*src[ 0*step] + 26*src[ 1*step] + 51*src[ 2*step] + 26*src[ 3*step] + 64) >> 7;
}
}
- }
- else if(filter_p1 && filter_q1)
- {
+ }else if(filter_p1 && filter_q1){
for(i = 0; i < 4; i++, src += stride)
rv40_weak_loop_filter(src, step, 1, 1, alpha, beta, lims, lim_q1, lim_p1,
diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
- }
- else
- {
+ }else{
for(i = 0; i < 4; i++, src += stride)
rv40_weak_loop_filter(src, step, filter_p1, filter_q1,
- alpha, beta, lims >> 1, lim_q1 >> 1, lim_p1 >> 1,
+ alpha, beta, lims>>1, lim_q1>>1, lim_p1>>1,
diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
}
}
static void rv40_v_loop_filter(uint8_t *src, int stride, int dmode,
int lim_q1, int lim_p1,
- int alpha, int beta, int beta2, int chroma, int edge)
-{
+ int alpha, int beta, int beta2, int chroma, int edge){
rv40_adaptive_loop_filter(src, 1, stride, dmode, lim_q1, lim_p1,
alpha, beta, beta2, chroma, edge);
}
static void rv40_h_loop_filter(uint8_t *src, int stride, int dmode,
int lim_q1, int lim_p1,
- int alpha, int beta, int beta2, int chroma, int edge)
-{
+ int alpha, int beta, int beta2, int chroma, int edge){
rv40_adaptive_loop_filter(src, stride, 1, dmode, lim_q1, lim_p1,
alpha, beta, beta2, chroma, edge);
}
-enum RV40BlockPos
-{
+enum RV40BlockPos{
POS_CUR,
POS_TOP,
POS_LEFT,
@@ -513,8 +472,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
int mvmasks[4];
mb_pos = row * s->mb_stride;
- for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++)
- {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int mbtype = s->current_picture_ptr->mb_type[mb_pos];
if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;
@@ -522,8 +480,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
r->cbp_chroma[mb_pos] = 0xFF;
}
mb_pos = row * s->mb_stride;
- for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++)
- {
+ for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
int y_h_deblock, y_v_deblock;
int c_v_deblock[2], c_h_deblock[2];
int clip_left;
@@ -534,26 +491,22 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
alpha = rv40_alpha_tab[q];
beta = rv40_beta_tab [q];
betaY = betaC = beta * 3;
- if(s->width * s->height <= 176 * 144)
+ if(s->width * s->height <= 176*144)
betaY += beta;
avail[0] = 1;
avail[1] = row;
avail[2] = mb_x;
avail[3] = row < s->mb_height - 1;
- for(i = 0; i < 4; i++)
- {
- if(avail[i])
- {
- int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i] * s->mb_stride;
+ for(i = 0; i < 4; i++){
+ if(avail[i]){
+ int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride;
mvmasks[i] = r->deblock_coefs[pos];
mbtype [i] = s->current_picture_ptr->mb_type[pos];
cbp [i] = r->cbp_luma[pos];
uvcbp[i][0] = r->cbp_chroma[pos] & 0xF;
uvcbp[i][1] = r->cbp_chroma[pos] >> 4;
- }
- else
- {
+ }else{
mvmasks[i] = 0;
mbtype [i] = mbtype[0];
cbp [i] = 0;
@@ -563,7 +516,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q];
}
y_to_deblock = mvmasks[POS_CUR]
- | (mvmasks[POS_BOTTOM] << 16);
+ | (mvmasks[POS_BOTTOM] << 16);
/* This pattern contains bits signalling that horizontal edges of
* the current block can be filtered.
* That happens when either of adjacent subblocks is coded or lies on
@@ -571,8 +524,8 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
* 3/4 pel in any component (any edge orientation for some reason).
*/
y_h_deblock = y_to_deblock
- | ((cbp[POS_CUR] << 4) & ~MASK_Y_TOP_ROW)
- | ((cbp[POS_TOP] & MASK_Y_LAST_ROW) >> 12);
+ | ((cbp[POS_CUR] << 4) & ~MASK_Y_TOP_ROW)
+ | ((cbp[POS_TOP] & MASK_Y_LAST_ROW) >> 12);
/* This pattern contains bits signalling that vertical edges of
* the current block can be filtered.
* That happens when either of adjacent subblocks is coded or lies on
@@ -580,8 +533,8 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
* 3/4 pel in any component (any edge orientation for some reason).
*/
y_v_deblock = y_to_deblock
- | ((cbp[POS_CUR] << 1) & ~MASK_Y_LEFT_COL)
- | ((cbp[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);
+ | ((cbp[POS_CUR] << 1) & ~MASK_Y_LEFT_COL)
+ | ((cbp[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);
if(!mb_x)
y_v_deblock &= ~MASK_Y_LEFT_COL;
if(!row)
@@ -591,15 +544,14 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
/* Calculating chroma patterns is similar and easier since there is
* no motion vector pattern for them.
*/
- for(i = 0; i < 2; i++)
- {
+ for(i = 0; i < 2; i++){
c_to_deblock[i] = (uvcbp[POS_BOTTOM][i] << 4) | uvcbp[POS_CUR][i];
c_v_deblock[i] = c_to_deblock[i]
- | ((uvcbp[POS_CUR] [i] << 1) & ~MASK_C_LEFT_COL)
- | ((uvcbp[POS_LEFT][i] & MASK_C_RIGHT_COL) >> 1);
+ | ((uvcbp[POS_CUR] [i] << 1) & ~MASK_C_LEFT_COL)
+ | ((uvcbp[POS_LEFT][i] & MASK_C_RIGHT_COL) >> 1);
c_h_deblock[i] = c_to_deblock[i]
- | ((uvcbp[POS_TOP][i] & MASK_C_LAST_ROW) >> 2)
- | (uvcbp[POS_CUR][i] << 2);
+ | ((uvcbp[POS_TOP][i] & MASK_C_LAST_ROW) >> 2)
+ | (uvcbp[POS_CUR][i] << 2);
if(!mb_x)
c_v_deblock[i] &= ~MASK_C_LEFT_COL;
if(!row)
@@ -608,47 +560,41 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
c_h_deblock[i] &= ~(MASK_C_TOP_ROW << 4);
}
- for(j = 0; j < 16; j += 4)
- {
- Y = s->current_picture_ptr->data[0] + mb_x * 16 + (row * 16 + j) * s->linesize;
- for(i = 0; i < 4; i++, Y += 4)
- {
+ for(j = 0; j < 16; j += 4){
+ Y = s->current_picture_ptr->data[0] + mb_x*16 + (row*16 + j) * s->linesize;
+ for(i = 0; i < 4; i++, Y += 4){
int ij = i + j;
int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
- int dither = j ? ij : i * 4;
+ int dither = j ? ij : i*4;
// if bottom block is coded then we can filter its top edge
// (or bottom edge of this block, which is the same)
- if(y_h_deblock & (MASK_BOTTOM << ij))
- {
- rv40_h_loop_filter(Y + 4 * s->linesize, s->linesize, dither,
+ if(y_h_deblock & (MASK_BOTTOM << ij)){
+ rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
y_to_deblock & (MASK_BOTTOM << ij) ? clip[POS_CUR] : 0,
clip_cur,
alpha, beta, betaY, 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
- clip_left = y_to_deblock & (MASK_CUR << (ij - 1)) ? clip[POS_CUR] : 0;
+ clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
rv40_v_loop_filter(Y, s->linesize, dither,
clip_cur,
clip_left,
alpha, beta, betaY, 0, 0);
}
// 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_h_loop_filter(Y, s->linesize, dither,
clip_cur,
mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
alpha, beta, betaY, 0, 1);
}
// 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_v_loop_filter(Y, s->linesize, dither,
clip_cur,
@@ -657,46 +603,39 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
}
}
}
- for(k = 0; k < 2; k++)
- {
- for(j = 0; j < 2; j++)
- {
- C = s->current_picture_ptr->data[k+1] + mb_x * 8 + (row * 8 + j * 4) * s->uvlinesize;
- for(i = 0; i < 2; i++, C += 4)
- {
- int ij = i + j * 2;
+ for(k = 0; k < 2; k++){
+ for(j = 0; j < 2; j++){
+ C = s->current_picture_ptr->data[k+1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
+ for(i = 0; i < 2; i++, C += 4){
+ int ij = i + j*2;
int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
- if(c_h_deblock[k] & (MASK_CUR << (ij + 2)))
- {
- int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij + 2)) ? clip[POS_CUR] : 0;
- rv40_h_loop_filter(C + 4 * s->uvlinesize, s->uvlinesize, i * 8,
+ if(c_h_deblock[k] & (MASK_CUR << (ij+2))){
+ int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij+2)) ? clip[POS_CUR] : 0;
+ rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8,
clip_bot,
clip_cur,
alpha, beta, betaC, 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]))){
if(!i)
- clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2 * j + 1)) ? clip[POS_LEFT] : 0;
+ clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
else
- clip_left = c_to_deblock[k] & (MASK_CUR << (ij - 1)) ? clip[POS_CUR] : 0;
- rv40_v_loop_filter(C, s->uvlinesize, j * 8,
+ clip_left = c_to_deblock[k] & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
+ rv40_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 0);
}
- 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_h_loop_filter(C, s->uvlinesize, i * 8,
+ 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_h_loop_filter(C, s->uvlinesize, i*8,
clip_cur,
clip_top,
alpha, beta, betaC, 1, 1);
}
- 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_v_loop_filter(C, s->uvlinesize, j * 8,
+ 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_v_loop_filter(C, s->uvlinesize, j*8,
clip_cur,
clip_left,
alpha, beta, betaC, 1, 1);
@@ -727,8 +666,7 @@ static av_cold int rv40_decode_init(AVCodecContext *avctx)
return 0;
}
-AVCodec rv40_decoder =
-{
+AVCodec rv40_decoder = {
"rv40",
CODEC_TYPE_VIDEO,
CODEC_ID_RV40,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40data.h
index e0fea8803..b81b39318 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40data.h
@@ -44,30 +44,24 @@ static const int rv40_standard_heights[] = { 120, 132, 144, 240, 288, 480, -8,
* These values are actually coded 3-tuples
* used for detecting standard block configurations.
*/
-static const uint16_t rv40_aic_table_index[MODE2_PATTERNS_NUM] =
-{
- 0x000, 0x100, 0x200,
- 0x011, 0x111, 0x211, 0x511, 0x611,
- 0x022, 0x122, 0x222, 0x722,
- 0x272, 0x227,
- 0x822, 0x282, 0x228,
- 0x112, 0x116, 0x221
+static const uint16_t rv40_aic_table_index[MODE2_PATTERNS_NUM] = {
+ 0x000, 0x100, 0x200,
+ 0x011, 0x111, 0x211, 0x511, 0x611,
+ 0x022, 0x122, 0x222, 0x722,
+ 0x272, 0x227,
+ 0x822, 0x282, 0x228,
+ 0x112, 0x116, 0x221
};
/**
* luma quantizer values
* The second table is used for inter blocks.
*/
-static const uint8_t rv40_luma_dc_quant[2][32] =
-{
- {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 22, 22, 22, 22
- },
- {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 20, 21, 21, 22, 23, 23, 23, 24, 24, 24, 24
- }
+static const uint8_t rv40_luma_dc_quant[2][32] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 22, 22, 22, 22 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 20, 21, 21, 22, 23, 23, 23, 24, 24, 24, 24 }
};
/**
@@ -77,37 +71,32 @@ static const uint8_t rv40_luma_dc_quant[2][32] =
/**
* dither values for deblocking filter - left/top values
*/
-static const uint8_t rv40_dither_l[16] =
-{
+static const uint8_t rv40_dither_l[16] = {
0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
};
/**
* dither values for deblocking filter - right/bottom values
*/
-static const uint8_t rv40_dither_r[16] =
-{
+static const uint8_t rv40_dither_r[16] = {
0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
};
/** alpha parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
-static const uint8_t rv40_alpha_tab[32] =
-{
+static const uint8_t rv40_alpha_tab[32] = {
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 122, 96, 75, 59, 47, 37,
- 29, 23, 18, 15, 13, 11, 10, 9,
- 8, 7, 6, 5, 4, 3, 2, 1
+ 29, 23, 18, 15, 13, 11, 10, 9,
+ 8, 7, 6, 5, 4, 3, 2, 1
};
/** beta parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
-static const uint8_t rv40_beta_tab[32] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 6, 6,
- 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17
+static const uint8_t rv40_beta_tab[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 6, 6,
+ 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17
};
/** clip table for RV40 loop filter - the same as in JVT-A003r1 */
-static const uint8_t rv40_filter_clip_tbl[3][32] =
-{
+static const uint8_t rv40_filter_clip_tbl[3][32] = {
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40dsp.c
index 9ac2344bf..b48c4e85b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40dsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40dsp.c
@@ -99,7 +99,7 @@ static void OPNAME ## rv40_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstS
OPNAME ## rv40_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, h-8, C1, C2, SHIFT);\
}\
\
-
+
#define RV40_MC(OPNAME, SIZE) \
static void OPNAME ## rv40_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
OPNAME ## rv40_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride, SIZE, 52, 20, 6);\
@@ -181,7 +181,7 @@ static void OPNAME ## rv40_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, i
OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 20, 52, 6);\
}\
\
-
+
#define op_avg(a, b) a = (((a)+cm[b]+1)>>1)
#define op_put(a, b) a = cm[b]
@@ -196,8 +196,7 @@ RV40_MC(put_, 16)
RV40_MC(avg_, 8)
RV40_MC(avg_, 16)
-static const int rv40_bias[4][4] =
-{
+static const int rv40_bias[4][4] = {
{ 0, 16, 32, 16 },
{ 32, 28, 32, 28 },
{ 0, 32, 16, 32 },
@@ -285,8 +284,7 @@ static void OPNAME ## rv40_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a
RV40_CHROMA_MC(put_, op_put)
RV40_CHROMA_MC(avg_, op_avg)
-void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx)
-{
+void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx) {
c->put_rv40_qpel_pixels_tab[0][ 0] = c->put_h264_qpel_pixels_tab[0][0];
c->put_rv40_qpel_pixels_tab[0][ 1] = put_rv40_qpel16_mc10_c;
c->put_rv40_qpel_pixels_tab[0][ 2] = put_rv40_qpel16_mc20_c;
@@ -348,8 +346,8 @@ void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx)
c->avg_rv40_qpel_pixels_tab[1][13] = avg_rv40_qpel8_mc13_c;
c->avg_rv40_qpel_pixels_tab[1][14] = avg_rv40_qpel8_mc23_c;
- c->put_rv40_chroma_pixels_tab[0] = put_rv40_chroma_mc8_c;
- c->put_rv40_chroma_pixels_tab[1] = put_rv40_chroma_mc4_c;
- c->avg_rv40_chroma_pixels_tab[0] = avg_rv40_chroma_mc8_c;
- c->avg_rv40_chroma_pixels_tab[1] = avg_rv40_chroma_mc4_c;
+ c->put_rv40_chroma_pixels_tab[0]= put_rv40_chroma_mc8_c;
+ c->put_rv40_chroma_pixels_tab[1]= put_rv40_chroma_mc4_c;
+ c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_c;
+ c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_c;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40vlc2.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40vlc2.h
index deb7059c6..3b17d8faa 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40vlc2.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/rv40vlc2.h
@@ -35,15 +35,13 @@
//@{
#define AIC_TOP_BITS 8
#define AIC_TOP_SIZE 16
-static const uint8_t rv40_aic_top_vlc_codes[AIC_TOP_SIZE] =
-{
- 0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02,
- 0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01
+static const uint8_t rv40_aic_top_vlc_codes[AIC_TOP_SIZE] = {
+ 0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02,
+ 0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01
};
-static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] =
-{
- 1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3
+static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] = {
+ 1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3
};
//@}
@@ -55,452 +53,370 @@ static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] =
#define AIC_MODE2_SIZE 81
#define AIC_MODE2_BITS 9
-static const uint16_t aic_mode2_vlc_codes[AIC_MODE2_NUM][AIC_MODE2_SIZE] =
-{
- {
- 0x0001, 0x0001, 0x0005, 0x01F5, 0x0011, 0x0049, 0x0000, 0x0048, 0x004B,
- 0x0035, 0x0003, 0x0034, 0x03C9, 0x01F4, 0x00C9, 0x004A, 0x0FD9, 0x03C8,
- 0x0010, 0x0037, 0x0001, 0x00C8, 0x0075, 0x01F7, 0x00CB, 0x0074, 0x0002,
- 0x01F6, 0x00CA, 0x01F1, 0x01F0, 0x1F81, 0x07F9, 0x1F80, 0x1F83, 0x07F8,
- 0x0077, 0x00F5, 0x0036, 0x07FB, 0x0076, 0x1F82, 0x00F4, 0x00F7, 0x07FA,
- 0x0071, 0x00F6, 0x03CB, 0x03CA, 0x0FD8, 0x00F1, 0x03F5, 0x1F8D, 0x07E5,
- 0x0013, 0x0031, 0x00F0, 0x0FDB, 0x00F3, 0x07E4, 0x0030, 0x01F3, 0x07E7,
- 0x03F4, 0x07E6, 0x0070, 0x3F19, 0x01F2, 0x3F18, 0x0FDA, 0x0033, 0x07E1,
- 0x01FD, 0x01FC, 0x0073, 0x01FF, 0x0FC5, 0x0FC4, 0x0FC7, 0x03F7, 0x0072,
- },
- {
- 0x0005, 0x0005, 0x0005, 0x0079, 0x0005, 0x000D, 0x001D, 0x0078, 0x0069,
- 0x0004, 0x0001, 0x0007, 0x0068, 0x001C, 0x001F, 0x0004, 0x006B, 0x000C,
- 0x0004, 0x001E, 0x0006, 0x006A, 0x0015, 0x000F, 0x0014, 0x0017, 0x0007,
- 0x0016, 0x000E, 0x0011, 0x0009, 0x00D1, 0x00D0, 0x0181, 0x00D3, 0x007B,
- 0x0010, 0x0013, 0x0004, 0x00D2, 0x0007, 0x0319, 0x0008, 0x007A, 0x00DD,
- 0x0019, 0x0006, 0x000B, 0x0065, 0x00DC, 0x0012, 0x0064, 0x0180, 0x00DF,
- 0x0006, 0x0018, 0x0001, 0x00DE, 0x001D, 0x00D9, 0x001B, 0x0067, 0x000A,
- 0x00D8, 0x00DB, 0x001C, 0x0318, 0x00DA, 0x0635, 0x0183, 0x0000, 0x00C5,
- 0x0066, 0x0061, 0x0035, 0x00C4, 0x0182, 0x0634, 0x031B, 0x00C7, 0x001F,
- },
- {
- 0x0005, 0x0001, 0x001D, 0x01C1, 0x0035, 0x00F1, 0x006D, 0x00F0, 0x0049,
- 0x0000, 0x0004, 0x0003, 0x00F3, 0x0048, 0x0034, 0x006C, 0x01C0, 0x01C3,
- 0x0007, 0x0006, 0x0001, 0x006F, 0x0002, 0x004B, 0x006E, 0x001C, 0x0005,
- 0x0069, 0x0068, 0x006B, 0x0037, 0x01C2, 0x00F2, 0x0395, 0x01CD, 0x00FD,
- 0x006A, 0x0036, 0x0015, 0x01CC, 0x0014, 0x0394, 0x004A, 0x00FC, 0x00FF,
- 0x0017, 0x0031, 0x00FE, 0x01CF, 0x0397, 0x00F9, 0x01CE, 0x0725, 0x0396,
- 0x0016, 0x0030, 0x0075, 0x0724, 0x00F8, 0x0727, 0x0033, 0x0391, 0x0390,
- 0x0011, 0x0032, 0x001F, 0x00FB, 0x0074, 0x0726, 0x00FA, 0x001E, 0x0077,
- 0x0019, 0x0018, 0x0004, 0x0010, 0x003D, 0x0076, 0x0071, 0x0013, 0x0001,
- },
- {
- 0x000D, 0x0019, 0x0011, 0x0015, 0x0061, 0x0019, 0x0014, 0x01AD, 0x0060,
- 0x0018, 0x0001, 0x0005, 0x001B, 0x0010, 0x0019, 0x0005, 0x0017, 0x0018,
- 0x0016, 0x0004, 0x0004, 0x0013, 0x000C, 0x0012, 0x001A, 0x0018, 0x0005,
- 0x000F, 0x001B, 0x0004, 0x001D, 0x0011, 0x001C, 0x0010, 0x000E, 0x001B,
- 0x0013, 0x001F, 0x001A, 0x0029, 0x0005, 0x0063, 0x001E, 0x0009, 0x0062,
- 0x0008, 0x0007, 0x0007, 0x0019, 0x0004, 0x001A, 0x0018, 0x006D, 0x0007,
- 0x001B, 0x0007, 0x001A, 0x006C, 0x0006, 0x0012, 0x0005, 0x006F, 0x000B,
- 0x006E, 0x0069, 0x001D, 0x0359, 0x0028, 0x002B, 0x002A, 0x001C, 0x00D5,
- 0x0358, 0x001F, 0x0001, 0x001E, 0x0068, 0x00D4, 0x00D7, 0x0019, 0x0000,
- },
- {
- 0x00B9, 0x0061, 0x0060, 0x00B8, 0x02B5, 0x01AD, 0x00BB, 0x0AF5, 0x0151,
- 0x0001, 0x0001, 0x0005, 0x0000, 0x0003, 0x0005, 0x0004, 0x0063, 0x0025,
- 0x00BA, 0x0004, 0x0007, 0x0062, 0x00A5, 0x0024, 0x006D, 0x0002, 0x006C,
- 0x02B4, 0x000D, 0x006F, 0x0027, 0x00A4, 0x0026, 0x01AC, 0x0150, 0x01AF,
- 0x01AE, 0x0021, 0x006E, 0x02B7, 0x0020, 0x0153, 0x0023, 0x00A7, 0x0152,
- 0x00A6, 0x0006, 0x000C, 0x0022, 0x01A9, 0x0019, 0x002D, 0x02B6, 0x01A8,
- 0x000F, 0x0007, 0x000E, 0x00A1, 0x0069, 0x002C, 0x0001, 0x01AB, 0x00A0,
- 0x02B1, 0x00A3, 0x002F, 0x0AF4, 0x02B0, 0x0AF7, 0x02B3, 0x0068, 0x015D,
- 0x0AF6, 0x01AA, 0x0055, 0x015C, 0x02B2, 0x0579, 0x0578, 0x015F, 0x00A2,
- },
- {
- 0x0905, 0x013D, 0x013C, 0x0904, 0x121D, 0x049D, 0x049C, 0x243D, 0x0907,
- 0x00ED, 0x0001, 0x0015, 0x0041, 0x013F, 0x0031, 0x0014, 0x025D, 0x025C,
- 0x013E, 0x000D, 0x0000, 0x0040, 0x0139, 0x0043, 0x0030, 0x0017, 0x0033,
- 0x0906, 0x0032, 0x0042, 0x00EC, 0x025F, 0x00EF, 0x025E, 0x049F, 0x0138,
- 0x0901, 0x013B, 0x0259, 0x121C, 0x049E, 0x0900, 0x0258, 0x243C, 0x121F,
- 0x0903, 0x003D, 0x00EE, 0x025B, 0x025A, 0x004D, 0x013A, 0x0902, 0x0245,
- 0x00E9, 0x0016, 0x00E8, 0x0499, 0x0125, 0x0244, 0x004C, 0x0498, 0x090D,
- 0x00EB, 0x003C, 0x0011, 0x049B, 0x049A, 0x0485, 0x00EA, 0x003F, 0x0124,
- 0x090C, 0x003E, 0x0039, 0x0095, 0x0247, 0x0246, 0x0484, 0x0094, 0x0038,
- },
- {
- 0x0F09, 0x00CD, 0x01FD, 0x0791, 0x1E6D, 0x0790, 0x03D9, 0x3CD1, 0x3CD0,
- 0x0075, 0x0001, 0x0001, 0x0035, 0x00CC, 0x0011, 0x0000, 0x03D8, 0x01FC,
- 0x03DB, 0x0010, 0x0003, 0x00CF, 0x03DA, 0x00CE, 0x0074, 0x0034, 0x0077,
- 0x0793, 0x0013, 0x0076, 0x0071, 0x03C5, 0x0070, 0x01FF, 0x0792, 0x01FE,
- 0x01F9, 0x0037, 0x00C9, 0x0F08, 0x01F8, 0x03C4, 0x00C8, 0x0F0B, 0x079D,
- 0x03C7, 0x0001, 0x0012, 0x0073, 0x00CB, 0x0005, 0x0036, 0x03C6, 0x0072,
- 0x007D, 0x0002, 0x00CA, 0x079C, 0x01FB, 0x00F5, 0x0031, 0x079F, 0x0F0A,
- 0x0F35, 0x079E, 0x01FA, 0x1E6C, 0x1E6F, 0x3CD3, 0x0799, 0x03C1, 0x1E6E,
- 0x3CD2, 0x0030, 0x00F4, 0x007C, 0x03C0, 0x03C3, 0x0798, 0x01E5, 0x00F7,
- },
- {
- 0x01A5, 0x0001, 0x001D, 0x0021, 0x00A1, 0x000D, 0x0061, 0x06B9, 0x00A0,
- 0x0060, 0x0001, 0x0005, 0x000C, 0x0020, 0x001C, 0x0004, 0x01A4, 0x01A7,
- 0x00A3, 0x001F, 0x001E, 0x0023, 0x0022, 0x002D, 0x002C, 0x0063, 0x0062,
- 0x1A81, 0x01A6, 0x01A1, 0x06B8, 0x06BB, 0x00A2, 0x06BA, 0x0D59, 0x06A5,
- 0x01A0, 0x000F, 0x006D, 0x06A4, 0x002F, 0x00AD, 0x006C, 0x06A7, 0x00AC,
- 0x0D58, 0x000E, 0x01A3, 0x00AF, 0x00AE, 0x006F, 0x01A2, 0x0D5B, 0x00A9,
- 0x0019, 0x0001, 0x0009, 0x00A8, 0x006E, 0x002E, 0x0000, 0x01AD, 0x00AB,
- 0x00AA, 0x0355, 0x0029, 0x1A80, 0x1A83, 0x1A82, 0x0354, 0x01AC, 0x0D5A,
- 0x1A8D, 0x01AF, 0x0357, 0x0D45, 0x0D44, 0x0D47, 0x1A8C, 0x06A6, 0x06A1,
- },
- {
- 0x0001, 0x0011, 0x0005, 0x0775, 0x00F9, 0x00F8, 0x0031, 0x0030, 0x0049,
- 0x00FB, 0x0010, 0x0033, 0x0EC9, 0x038D, 0x038C, 0x00FA, 0x038F, 0x0774,
- 0x0048, 0x0032, 0x0000, 0x01D5, 0x00E5, 0x038E, 0x00E4, 0x0013, 0x000D,
- 0x0389, 0x0777, 0x0388, 0x038B, 0x1DF9, 0x0EC8, 0x3BC9, 0x1DF8, 0x038A,
- 0x03B5, 0x0776, 0x00E7, 0x3BC8, 0x01D4, 0x3BCB, 0x0ECB, 0x0771, 0x0ECA,
- 0x01D7, 0x03B4, 0x01D6, 0x1DFB, 0x0EF5, 0x0770, 0x0EF4, 0x3BCA, 0x0773,
- 0x00E6, 0x03B7, 0x004B, 0x1DFA, 0x03B6, 0x0EF7, 0x00E1, 0x0EF6, 0x0EF1,
- 0x03B1, 0x01D1, 0x003D, 0x0EF0, 0x0772, 0x077D, 0x077C, 0x003C, 0x01D0,
- 0x03B0, 0x01D3, 0x003F, 0x03B3, 0x01D2, 0x0EF3, 0x077F, 0x00E0, 0x004A,
- },
- {
- 0x0015, 0x0049, 0x0014, 0x07D1, 0x03FD, 0x03FC, 0x01C1, 0x01C0, 0x00F1,
- 0x0017, 0x0001, 0x0001, 0x01C3, 0x0048, 0x004B, 0x0016, 0x0031, 0x01C2,
- 0x004A, 0x0011, 0x0000, 0x01CD, 0x00F0, 0x01CC, 0x0075, 0x0010, 0x000D,
- 0x03FF, 0x01CF, 0x01CE, 0x07D0, 0x0F81, 0x07D3, 0x1F1D, 0x0F80, 0x07D2,
- 0x01C9, 0x03FE, 0x0074, 0x07DD, 0x00F3, 0x1F1C, 0x07DC, 0x03F9, 0x07DF,
- 0x00F2, 0x00FD, 0x0077, 0x07DE, 0x07D9, 0x01C8, 0x07D8, 0x0F83, 0x03F8,
- 0x0030, 0x0076, 0x0013, 0x0F82, 0x00FC, 0x03FB, 0x0033, 0x03FA, 0x03E5,
- 0x03E4, 0x01CB, 0x0032, 0x1F1F, 0x03E7, 0x07DB, 0x07DA, 0x003D, 0x01CA,
- 0x07C5, 0x03E6, 0x0071, 0x0F8D, 0x07C4, 0x1F1E, 0x0F8C, 0x03E1, 0x01F5,
- },
- {
- 0x0019, 0x0065, 0x0018, 0x0351, 0x0350, 0x0353, 0x0021, 0x0020, 0x0064,
- 0x001D, 0x0005, 0x0005, 0x01A5, 0x0023, 0x0067, 0x0005, 0x0066, 0x0022,
- 0x001B, 0x0004, 0x0001, 0x0004, 0x001C, 0x0061, 0x001A, 0x0005, 0x0004,
- 0x0007, 0x002D, 0x0006, 0x002C, 0x01A4, 0x002F, 0x0352, 0x035D, 0x0060,
- 0x0001, 0x002E, 0x001F, 0x035C, 0x0000, 0x06B1, 0x01A7, 0x0029, 0x01A6,
- 0x0028, 0x0063, 0x0062, 0x035F, 0x01A1, 0x002B, 0x06B0, 0x06B3, 0x01A0,
- 0x0003, 0x006D, 0x001E, 0x035E, 0x006C, 0x06B2, 0x0002, 0x01A3, 0x01A2,
- 0x000D, 0x0005, 0x0007, 0x01AD, 0x006F, 0x002A, 0x006E, 0x0004, 0x0004,
- 0x000C, 0x0007, 0x0006, 0x000F, 0x000E, 0x00D5, 0x0009, 0x0006, 0x0007,
- },
- {
- 0x0065, 0x0181, 0x0064, 0x36C9, 0x06D5, 0x0DB5, 0x0379, 0x0180, 0x0183,
- 0x00D5, 0x001D, 0x001C, 0x0DB4, 0x0182, 0x0378, 0x00D4, 0x00D7, 0x06D4,
- 0x0067, 0x001F, 0x0001, 0x00D6, 0x00D1, 0x018D, 0x0066, 0x0001, 0x0000,
- 0x037B, 0x06D7, 0x037A, 0x0DB7, 0x36C8, 0x06D6, 0x0DB6, 0x1B79, 0x0DB1,
- 0x018C, 0x0365, 0x00D0, 0x1B78, 0x00D3, 0x1B7B, 0x0364, 0x06D1, 0x06D0,
- 0x018F, 0x018E, 0x00D2, 0x36CB, 0x0367, 0x0366, 0x06D3, 0x0DB0, 0x06D2,
- 0x0361, 0x06DD, 0x0189, 0x36CA, 0x0360, 0x36F5, 0x0188, 0x0DB3, 0x36F4,
- 0x0009, 0x0008, 0x0005, 0x06DC, 0x00DD, 0x018B, 0x00DC, 0x0004, 0x000B,
- 0x018A, 0x0061, 0x0003, 0x0363, 0x00DF, 0x06DF, 0x0362, 0x000A, 0x001E,
- },
- {
- 0x001D, 0x0061, 0x000D, 0x0D55, 0x06B9, 0x06B8, 0x01A5, 0x0021, 0x0020,
- 0x0023, 0x000C, 0x0060, 0x0D54, 0x00AD, 0x00AC, 0x0022, 0x00AF, 0x06BB,
- 0x000F, 0x001C, 0x0001, 0x002D, 0x0063, 0x01A4, 0x000E, 0x0001, 0x0005,
- 0x01A7, 0x06BA, 0x01A6, 0x06A5, 0x0D57, 0x0D56, 0x1ABD, 0x0D51, 0x00AE,
- 0x002C, 0x00A9, 0x002F, 0x0D50, 0x01A1, 0x1ABC, 0x06A4, 0x06A7, 0x06A6,
- 0x00A8, 0x06A1, 0x01A0, 0x1ABF, 0x0D53, 0x06A0, 0x0D52, 0x1ABE, 0x06A3,
- 0x0062, 0x002E, 0x0009, 0x0D5D, 0x01A3, 0x0D5C, 0x006D, 0x00AB, 0x06A2,
- 0x006C, 0x001F, 0x0001, 0x06AD, 0x0029, 0x01A2, 0x0028, 0x0004, 0x001E,
- 0x01AD, 0x006F, 0x0000, 0x01AC, 0x01AF, 0x06AC, 0x00AA, 0x006E, 0x0019,
- },
- {
- 0x0019, 0x007D, 0x0018, 0x01B5, 0x000D, 0x01B4, 0x007C, 0x007F, 0x01B7,
- 0x000C, 0x001B, 0x001A, 0x01B6, 0x000F, 0x00D5, 0x0019, 0x007E, 0x00D4,
- 0x0018, 0x001B, 0x0001, 0x000E, 0x0011, 0x0009, 0x0005, 0x0005, 0x0005,
- 0x00D7, 0x01B1, 0x0008, 0x01B0, 0x0079, 0x06FD, 0x0371, 0x0370, 0x00D6,
- 0x0078, 0x01B3, 0x0010, 0x0373, 0x0013, 0x06FC, 0x007B, 0x007A, 0x00D1,
- 0x00D0, 0x00D3, 0x0065, 0x0372, 0x06FF, 0x0064, 0x06FE, 0x037D, 0x00D2,
- 0x00DD, 0x0067, 0x0004, 0x037C, 0x0012, 0x01B2, 0x0007, 0x0066, 0x01BD,
- 0x0006, 0x0061, 0x0004, 0x01BC, 0x001A, 0x0060, 0x001D, 0x0004, 0x001C,
- 0x0063, 0x0001, 0x0007, 0x000B, 0x0000, 0x0062, 0x000A, 0x0005, 0x0007,
- },
- {
- 0x0069, 0x0045, 0x0068, 0x04BD, 0x0255, 0x04BC, 0x00E5, 0x00E4, 0x0031,
- 0x0030, 0x0019, 0x0001, 0x0121, 0x00E7, 0x00E6, 0x0033, 0x00E1, 0x00E0,
- 0x006B, 0x0018, 0x0001, 0x0044, 0x0032, 0x0047, 0x006A, 0x001B, 0x0005,
- 0x003D, 0x0046, 0x0015, 0x0041, 0x0120, 0x0123, 0x04BF, 0x0122, 0x0040,
- 0x003C, 0x00E3, 0x0014, 0x0254, 0x0043, 0x0975, 0x012D, 0x00E2, 0x00ED,
- 0x0042, 0x00EC, 0x004D, 0x0257, 0x0256, 0x0251, 0x04BE, 0x0974, 0x0250,
- 0x00EF, 0x00EE, 0x004C, 0x04B9, 0x012C, 0x04B8, 0x004F, 0x04BB, 0x0253,
- 0x003F, 0x0017, 0x0001, 0x0252, 0x00E9, 0x00E8, 0x00EB, 0x0000, 0x0003,
- 0x0016, 0x0002, 0x0004, 0x004E, 0x003E, 0x00EA, 0x0049, 0x000D, 0x0007,
- },
- {
- 0x000D, 0x01BD, 0x000C, 0x0D31, 0x0D30, 0x0D33, 0x0359, 0x0358, 0x002D,
- 0x0065, 0x001D, 0x001C, 0x0D32, 0x035B, 0x035A, 0x002C, 0x01BC, 0x0345,
- 0x000F, 0x001F, 0x0001, 0x002F, 0x0064, 0x01BF, 0x0067, 0x0001, 0x0005,
- 0x0066, 0x002E, 0x0061, 0x0029, 0x0695, 0x0694, 0x0697, 0x0696, 0x0060,
- 0x01BE, 0x0D3D, 0x0028, 0x1A49, 0x0344, 0x1A48, 0x1A4B, 0x0D3C, 0x0691,
- 0x002B, 0x01B9, 0x002A, 0x0D3F, 0x0690, 0x0347, 0x0D3E, 0x1A4A, 0x0346,
- 0x00D5, 0x0341, 0x0063, 0x0D39, 0x0340, 0x0D38, 0x01B8, 0x0D3B, 0x0D3A,
- 0x00D4, 0x0062, 0x0000, 0x0693, 0x01BB, 0x0343, 0x0342, 0x001E, 0x000E,
- 0x006D, 0x0009, 0x0001, 0x006C, 0x00D7, 0x034D, 0x01BA, 0x0008, 0x0004,
- },
- {
- 0x0075, 0x00CD, 0x0035, 0x03C1, 0x03C0, 0x07F9, 0x03C3, 0x1F8D, 0x00CC,
- 0x0074, 0x0011, 0x0010, 0x03C2, 0x0FD9, 0x01F1, 0x00CF, 0x03CD, 0x00CE,
- 0x0034, 0x0001, 0x0001, 0x0037, 0x00C9, 0x00C8, 0x0036, 0x0000, 0x0001,
- 0x0FD8, 0x03CC, 0x00CB, 0x01F0, 0x07F8, 0x03CF, 0x07FB, 0x07FA, 0x00CA,
- 0x01F3, 0x03CE, 0x00F5, 0x0FDB, 0x00F4, 0x07E5, 0x07E4, 0x07E7, 0x01F2,
- 0x07E6, 0x03C9, 0x01FD, 0x0FDA, 0x1F8C, 0x07E1, 0x1F8F, 0x1F8E, 0x03C8,
- 0x03CB, 0x0077, 0x0076, 0x0FC5, 0x03CA, 0x07E0, 0x00F7, 0x0FC4, 0x03F5,
- 0x00F6, 0x01FC, 0x0003, 0x03F4, 0x0071, 0x03F7, 0x00F1, 0x0013, 0x0031,
- 0x0030, 0x0070, 0x0005, 0x0012, 0x0073, 0x01FF, 0x0072, 0x007D, 0x0002,
- },
- {
- 0x0061, 0x0055, 0x0060, 0x02C9, 0x02C8, 0x02CB, 0x0171, 0x00B5, 0x0054,
- 0x0001, 0x0001, 0x0001, 0x0057, 0x0001, 0x0063, 0x001D, 0x0062, 0x0039,
- 0x006D, 0x0000, 0x0005, 0x0038, 0x0056, 0x00B4, 0x006C, 0x0003, 0x001C,
- 0x006F, 0x003B, 0x0002, 0x003A, 0x0170, 0x00B7, 0x0173, 0x0051, 0x006E,
- 0x0025, 0x0050, 0x0069, 0x02CA, 0x0024, 0x0027, 0x0172, 0x00B6, 0x00B1,
- 0x000D, 0x000C, 0x001F, 0x017D, 0x0026, 0x0068, 0x0053, 0x017C, 0x006B,
- 0x001E, 0x000F, 0x0004, 0x017F, 0x006A, 0x02F5, 0x0019, 0x0021, 0x0052,
- 0x02F4, 0x02F7, 0x0020, 0x0BCD, 0x05E5, 0x05E4, 0x0BCC, 0x0023, 0x00B0,
- 0x02F6, 0x00B3, 0x0022, 0x02F1, 0x02F0, 0x0BCF, 0x0BCE, 0x017E, 0x005D,
- },
- {
- 0x00BD, 0x0025, 0x01A1, 0x0159, 0x0299, 0x00BC, 0x0024, 0x0505, 0x0504,
- 0x01A0, 0x0001, 0x001D, 0x006D, 0x001C, 0x0001, 0x0005, 0x0027, 0x01A3,
- 0x0158, 0x001F, 0x001E, 0x01A2, 0x0026, 0x0021, 0x000D, 0x0020, 0x0023,
- 0x0298, 0x006C, 0x0022, 0x00BF, 0x00BE, 0x01AD, 0x002D, 0x029B, 0x00B9,
- 0x01AC, 0x00B8, 0x01AF, 0x029A, 0x006F, 0x015B, 0x006E, 0x0285, 0x0284,
- 0x01AE, 0x0019, 0x002C, 0x01A9, 0x01A8, 0x000C, 0x000F, 0x015A, 0x00BB,
- 0x000E, 0x0000, 0x0069, 0x01AB, 0x0018, 0x01AA, 0x0004, 0x0055, 0x00BA,
- 0x0507, 0x0145, 0x0054, 0x0506, 0x00A5, 0x0501, 0x00A4, 0x0057, 0x0500,
- 0x0A05, 0x0144, 0x00A7, 0x0287, 0x0286, 0x0503, 0x0147, 0x0A04, 0x0146,
- },
- {
- 0x0759, 0x0041, 0x00E5, 0x03BD, 0x0E9D, 0x012D, 0x012C, 0x3A1D, 0x03BC,
- 0x012F, 0x000D, 0x0040, 0x00E4, 0x03BF, 0x0043, 0x0042, 0x0758, 0x03BE,
- 0x00E7, 0x0001, 0x0000, 0x003D, 0x00E6, 0x0015, 0x0014, 0x0017, 0x003C,
- 0x743D, 0x012E, 0x03B9, 0x03B8, 0x0E9C, 0x03BB, 0x075B, 0x3A1C, 0x0E9F,
- 0x0129, 0x00E1, 0x0128, 0x0E9E, 0x012B, 0x075A, 0x00E0, 0x0E99, 0x0745,
- 0x3A1F, 0x03BA, 0x0744, 0x0E98, 0x1D0D, 0x03A5, 0x0E9B, 0x743C, 0x0E9A,
- 0x012A, 0x004D, 0x00E3, 0x0E85, 0x01D5, 0x0E84, 0x004C, 0x0747, 0x1D0C,
- 0x01D4, 0x003F, 0x0016, 0x0746, 0x03A4, 0x0741, 0x004F, 0x003E, 0x01D7,
- 0x0740, 0x000C, 0x0011, 0x004E, 0x00E2, 0x00ED, 0x00EC, 0x0049, 0x0048,
- },
+static const uint16_t aic_mode2_vlc_codes[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
+{ 0x0001, 0x0001, 0x0005, 0x01F5, 0x0011, 0x0049, 0x0000, 0x0048, 0x004B,
+ 0x0035, 0x0003, 0x0034, 0x03C9, 0x01F4, 0x00C9, 0x004A, 0x0FD9, 0x03C8,
+ 0x0010, 0x0037, 0x0001, 0x00C8, 0x0075, 0x01F7, 0x00CB, 0x0074, 0x0002,
+ 0x01F6, 0x00CA, 0x01F1, 0x01F0, 0x1F81, 0x07F9, 0x1F80, 0x1F83, 0x07F8,
+ 0x0077, 0x00F5, 0x0036, 0x07FB, 0x0076, 0x1F82, 0x00F4, 0x00F7, 0x07FA,
+ 0x0071, 0x00F6, 0x03CB, 0x03CA, 0x0FD8, 0x00F1, 0x03F5, 0x1F8D, 0x07E5,
+ 0x0013, 0x0031, 0x00F0, 0x0FDB, 0x00F3, 0x07E4, 0x0030, 0x01F3, 0x07E7,
+ 0x03F4, 0x07E6, 0x0070, 0x3F19, 0x01F2, 0x3F18, 0x0FDA, 0x0033, 0x07E1,
+ 0x01FD, 0x01FC, 0x0073, 0x01FF, 0x0FC5, 0x0FC4, 0x0FC7, 0x03F7, 0x0072, },
+{ 0x0005, 0x0005, 0x0005, 0x0079, 0x0005, 0x000D, 0x001D, 0x0078, 0x0069,
+ 0x0004, 0x0001, 0x0007, 0x0068, 0x001C, 0x001F, 0x0004, 0x006B, 0x000C,
+ 0x0004, 0x001E, 0x0006, 0x006A, 0x0015, 0x000F, 0x0014, 0x0017, 0x0007,
+ 0x0016, 0x000E, 0x0011, 0x0009, 0x00D1, 0x00D0, 0x0181, 0x00D3, 0x007B,
+ 0x0010, 0x0013, 0x0004, 0x00D2, 0x0007, 0x0319, 0x0008, 0x007A, 0x00DD,
+ 0x0019, 0x0006, 0x000B, 0x0065, 0x00DC, 0x0012, 0x0064, 0x0180, 0x00DF,
+ 0x0006, 0x0018, 0x0001, 0x00DE, 0x001D, 0x00D9, 0x001B, 0x0067, 0x000A,
+ 0x00D8, 0x00DB, 0x001C, 0x0318, 0x00DA, 0x0635, 0x0183, 0x0000, 0x00C5,
+ 0x0066, 0x0061, 0x0035, 0x00C4, 0x0182, 0x0634, 0x031B, 0x00C7, 0x001F, },
+{ 0x0005, 0x0001, 0x001D, 0x01C1, 0x0035, 0x00F1, 0x006D, 0x00F0, 0x0049,
+ 0x0000, 0x0004, 0x0003, 0x00F3, 0x0048, 0x0034, 0x006C, 0x01C0, 0x01C3,
+ 0x0007, 0x0006, 0x0001, 0x006F, 0x0002, 0x004B, 0x006E, 0x001C, 0x0005,
+ 0x0069, 0x0068, 0x006B, 0x0037, 0x01C2, 0x00F2, 0x0395, 0x01CD, 0x00FD,
+ 0x006A, 0x0036, 0x0015, 0x01CC, 0x0014, 0x0394, 0x004A, 0x00FC, 0x00FF,
+ 0x0017, 0x0031, 0x00FE, 0x01CF, 0x0397, 0x00F9, 0x01CE, 0x0725, 0x0396,
+ 0x0016, 0x0030, 0x0075, 0x0724, 0x00F8, 0x0727, 0x0033, 0x0391, 0x0390,
+ 0x0011, 0x0032, 0x001F, 0x00FB, 0x0074, 0x0726, 0x00FA, 0x001E, 0x0077,
+ 0x0019, 0x0018, 0x0004, 0x0010, 0x003D, 0x0076, 0x0071, 0x0013, 0x0001, },
+{ 0x000D, 0x0019, 0x0011, 0x0015, 0x0061, 0x0019, 0x0014, 0x01AD, 0x0060,
+ 0x0018, 0x0001, 0x0005, 0x001B, 0x0010, 0x0019, 0x0005, 0x0017, 0x0018,
+ 0x0016, 0x0004, 0x0004, 0x0013, 0x000C, 0x0012, 0x001A, 0x0018, 0x0005,
+ 0x000F, 0x001B, 0x0004, 0x001D, 0x0011, 0x001C, 0x0010, 0x000E, 0x001B,
+ 0x0013, 0x001F, 0x001A, 0x0029, 0x0005, 0x0063, 0x001E, 0x0009, 0x0062,
+ 0x0008, 0x0007, 0x0007, 0x0019, 0x0004, 0x001A, 0x0018, 0x006D, 0x0007,
+ 0x001B, 0x0007, 0x001A, 0x006C, 0x0006, 0x0012, 0x0005, 0x006F, 0x000B,
+ 0x006E, 0x0069, 0x001D, 0x0359, 0x0028, 0x002B, 0x002A, 0x001C, 0x00D5,
+ 0x0358, 0x001F, 0x0001, 0x001E, 0x0068, 0x00D4, 0x00D7, 0x0019, 0x0000, },
+{ 0x00B9, 0x0061, 0x0060, 0x00B8, 0x02B5, 0x01AD, 0x00BB, 0x0AF5, 0x0151,
+ 0x0001, 0x0001, 0x0005, 0x0000, 0x0003, 0x0005, 0x0004, 0x0063, 0x0025,
+ 0x00BA, 0x0004, 0x0007, 0x0062, 0x00A5, 0x0024, 0x006D, 0x0002, 0x006C,
+ 0x02B4, 0x000D, 0x006F, 0x0027, 0x00A4, 0x0026, 0x01AC, 0x0150, 0x01AF,
+ 0x01AE, 0x0021, 0x006E, 0x02B7, 0x0020, 0x0153, 0x0023, 0x00A7, 0x0152,
+ 0x00A6, 0x0006, 0x000C, 0x0022, 0x01A9, 0x0019, 0x002D, 0x02B6, 0x01A8,
+ 0x000F, 0x0007, 0x000E, 0x00A1, 0x0069, 0x002C, 0x0001, 0x01AB, 0x00A0,
+ 0x02B1, 0x00A3, 0x002F, 0x0AF4, 0x02B0, 0x0AF7, 0x02B3, 0x0068, 0x015D,
+ 0x0AF6, 0x01AA, 0x0055, 0x015C, 0x02B2, 0x0579, 0x0578, 0x015F, 0x00A2, },
+{ 0x0905, 0x013D, 0x013C, 0x0904, 0x121D, 0x049D, 0x049C, 0x243D, 0x0907,
+ 0x00ED, 0x0001, 0x0015, 0x0041, 0x013F, 0x0031, 0x0014, 0x025D, 0x025C,
+ 0x013E, 0x000D, 0x0000, 0x0040, 0x0139, 0x0043, 0x0030, 0x0017, 0x0033,
+ 0x0906, 0x0032, 0x0042, 0x00EC, 0x025F, 0x00EF, 0x025E, 0x049F, 0x0138,
+ 0x0901, 0x013B, 0x0259, 0x121C, 0x049E, 0x0900, 0x0258, 0x243C, 0x121F,
+ 0x0903, 0x003D, 0x00EE, 0x025B, 0x025A, 0x004D, 0x013A, 0x0902, 0x0245,
+ 0x00E9, 0x0016, 0x00E8, 0x0499, 0x0125, 0x0244, 0x004C, 0x0498, 0x090D,
+ 0x00EB, 0x003C, 0x0011, 0x049B, 0x049A, 0x0485, 0x00EA, 0x003F, 0x0124,
+ 0x090C, 0x003E, 0x0039, 0x0095, 0x0247, 0x0246, 0x0484, 0x0094, 0x0038, },
+{ 0x0F09, 0x00CD, 0x01FD, 0x0791, 0x1E6D, 0x0790, 0x03D9, 0x3CD1, 0x3CD0,
+ 0x0075, 0x0001, 0x0001, 0x0035, 0x00CC, 0x0011, 0x0000, 0x03D8, 0x01FC,
+ 0x03DB, 0x0010, 0x0003, 0x00CF, 0x03DA, 0x00CE, 0x0074, 0x0034, 0x0077,
+ 0x0793, 0x0013, 0x0076, 0x0071, 0x03C5, 0x0070, 0x01FF, 0x0792, 0x01FE,
+ 0x01F9, 0x0037, 0x00C9, 0x0F08, 0x01F8, 0x03C4, 0x00C8, 0x0F0B, 0x079D,
+ 0x03C7, 0x0001, 0x0012, 0x0073, 0x00CB, 0x0005, 0x0036, 0x03C6, 0x0072,
+ 0x007D, 0x0002, 0x00CA, 0x079C, 0x01FB, 0x00F5, 0x0031, 0x079F, 0x0F0A,
+ 0x0F35, 0x079E, 0x01FA, 0x1E6C, 0x1E6F, 0x3CD3, 0x0799, 0x03C1, 0x1E6E,
+ 0x3CD2, 0x0030, 0x00F4, 0x007C, 0x03C0, 0x03C3, 0x0798, 0x01E5, 0x00F7, },
+{ 0x01A5, 0x0001, 0x001D, 0x0021, 0x00A1, 0x000D, 0x0061, 0x06B9, 0x00A0,
+ 0x0060, 0x0001, 0x0005, 0x000C, 0x0020, 0x001C, 0x0004, 0x01A4, 0x01A7,
+ 0x00A3, 0x001F, 0x001E, 0x0023, 0x0022, 0x002D, 0x002C, 0x0063, 0x0062,
+ 0x1A81, 0x01A6, 0x01A1, 0x06B8, 0x06BB, 0x00A2, 0x06BA, 0x0D59, 0x06A5,
+ 0x01A0, 0x000F, 0x006D, 0x06A4, 0x002F, 0x00AD, 0x006C, 0x06A7, 0x00AC,
+ 0x0D58, 0x000E, 0x01A3, 0x00AF, 0x00AE, 0x006F, 0x01A2, 0x0D5B, 0x00A9,
+ 0x0019, 0x0001, 0x0009, 0x00A8, 0x006E, 0x002E, 0x0000, 0x01AD, 0x00AB,
+ 0x00AA, 0x0355, 0x0029, 0x1A80, 0x1A83, 0x1A82, 0x0354, 0x01AC, 0x0D5A,
+ 0x1A8D, 0x01AF, 0x0357, 0x0D45, 0x0D44, 0x0D47, 0x1A8C, 0x06A6, 0x06A1, },
+{ 0x0001, 0x0011, 0x0005, 0x0775, 0x00F9, 0x00F8, 0x0031, 0x0030, 0x0049,
+ 0x00FB, 0x0010, 0x0033, 0x0EC9, 0x038D, 0x038C, 0x00FA, 0x038F, 0x0774,
+ 0x0048, 0x0032, 0x0000, 0x01D5, 0x00E5, 0x038E, 0x00E4, 0x0013, 0x000D,
+ 0x0389, 0x0777, 0x0388, 0x038B, 0x1DF9, 0x0EC8, 0x3BC9, 0x1DF8, 0x038A,
+ 0x03B5, 0x0776, 0x00E7, 0x3BC8, 0x01D4, 0x3BCB, 0x0ECB, 0x0771, 0x0ECA,
+ 0x01D7, 0x03B4, 0x01D6, 0x1DFB, 0x0EF5, 0x0770, 0x0EF4, 0x3BCA, 0x0773,
+ 0x00E6, 0x03B7, 0x004B, 0x1DFA, 0x03B6, 0x0EF7, 0x00E1, 0x0EF6, 0x0EF1,
+ 0x03B1, 0x01D1, 0x003D, 0x0EF0, 0x0772, 0x077D, 0x077C, 0x003C, 0x01D0,
+ 0x03B0, 0x01D3, 0x003F, 0x03B3, 0x01D2, 0x0EF3, 0x077F, 0x00E0, 0x004A, },
+{ 0x0015, 0x0049, 0x0014, 0x07D1, 0x03FD, 0x03FC, 0x01C1, 0x01C0, 0x00F1,
+ 0x0017, 0x0001, 0x0001, 0x01C3, 0x0048, 0x004B, 0x0016, 0x0031, 0x01C2,
+ 0x004A, 0x0011, 0x0000, 0x01CD, 0x00F0, 0x01CC, 0x0075, 0x0010, 0x000D,
+ 0x03FF, 0x01CF, 0x01CE, 0x07D0, 0x0F81, 0x07D3, 0x1F1D, 0x0F80, 0x07D2,
+ 0x01C9, 0x03FE, 0x0074, 0x07DD, 0x00F3, 0x1F1C, 0x07DC, 0x03F9, 0x07DF,
+ 0x00F2, 0x00FD, 0x0077, 0x07DE, 0x07D9, 0x01C8, 0x07D8, 0x0F83, 0x03F8,
+ 0x0030, 0x0076, 0x0013, 0x0F82, 0x00FC, 0x03FB, 0x0033, 0x03FA, 0x03E5,
+ 0x03E4, 0x01CB, 0x0032, 0x1F1F, 0x03E7, 0x07DB, 0x07DA, 0x003D, 0x01CA,
+ 0x07C5, 0x03E6, 0x0071, 0x0F8D, 0x07C4, 0x1F1E, 0x0F8C, 0x03E1, 0x01F5, },
+{ 0x0019, 0x0065, 0x0018, 0x0351, 0x0350, 0x0353, 0x0021, 0x0020, 0x0064,
+ 0x001D, 0x0005, 0x0005, 0x01A5, 0x0023, 0x0067, 0x0005, 0x0066, 0x0022,
+ 0x001B, 0x0004, 0x0001, 0x0004, 0x001C, 0x0061, 0x001A, 0x0005, 0x0004,
+ 0x0007, 0x002D, 0x0006, 0x002C, 0x01A4, 0x002F, 0x0352, 0x035D, 0x0060,
+ 0x0001, 0x002E, 0x001F, 0x035C, 0x0000, 0x06B1, 0x01A7, 0x0029, 0x01A6,
+ 0x0028, 0x0063, 0x0062, 0x035F, 0x01A1, 0x002B, 0x06B0, 0x06B3, 0x01A0,
+ 0x0003, 0x006D, 0x001E, 0x035E, 0x006C, 0x06B2, 0x0002, 0x01A3, 0x01A2,
+ 0x000D, 0x0005, 0x0007, 0x01AD, 0x006F, 0x002A, 0x006E, 0x0004, 0x0004,
+ 0x000C, 0x0007, 0x0006, 0x000F, 0x000E, 0x00D5, 0x0009, 0x0006, 0x0007, },
+{ 0x0065, 0x0181, 0x0064, 0x36C9, 0x06D5, 0x0DB5, 0x0379, 0x0180, 0x0183,
+ 0x00D5, 0x001D, 0x001C, 0x0DB4, 0x0182, 0x0378, 0x00D4, 0x00D7, 0x06D4,
+ 0x0067, 0x001F, 0x0001, 0x00D6, 0x00D1, 0x018D, 0x0066, 0x0001, 0x0000,
+ 0x037B, 0x06D7, 0x037A, 0x0DB7, 0x36C8, 0x06D6, 0x0DB6, 0x1B79, 0x0DB1,
+ 0x018C, 0x0365, 0x00D0, 0x1B78, 0x00D3, 0x1B7B, 0x0364, 0x06D1, 0x06D0,
+ 0x018F, 0x018E, 0x00D2, 0x36CB, 0x0367, 0x0366, 0x06D3, 0x0DB0, 0x06D2,
+ 0x0361, 0x06DD, 0x0189, 0x36CA, 0x0360, 0x36F5, 0x0188, 0x0DB3, 0x36F4,
+ 0x0009, 0x0008, 0x0005, 0x06DC, 0x00DD, 0x018B, 0x00DC, 0x0004, 0x000B,
+ 0x018A, 0x0061, 0x0003, 0x0363, 0x00DF, 0x06DF, 0x0362, 0x000A, 0x001E, },
+{ 0x001D, 0x0061, 0x000D, 0x0D55, 0x06B9, 0x06B8, 0x01A5, 0x0021, 0x0020,
+ 0x0023, 0x000C, 0x0060, 0x0D54, 0x00AD, 0x00AC, 0x0022, 0x00AF, 0x06BB,
+ 0x000F, 0x001C, 0x0001, 0x002D, 0x0063, 0x01A4, 0x000E, 0x0001, 0x0005,
+ 0x01A7, 0x06BA, 0x01A6, 0x06A5, 0x0D57, 0x0D56, 0x1ABD, 0x0D51, 0x00AE,
+ 0x002C, 0x00A9, 0x002F, 0x0D50, 0x01A1, 0x1ABC, 0x06A4, 0x06A7, 0x06A6,
+ 0x00A8, 0x06A1, 0x01A0, 0x1ABF, 0x0D53, 0x06A0, 0x0D52, 0x1ABE, 0x06A3,
+ 0x0062, 0x002E, 0x0009, 0x0D5D, 0x01A3, 0x0D5C, 0x006D, 0x00AB, 0x06A2,
+ 0x006C, 0x001F, 0x0001, 0x06AD, 0x0029, 0x01A2, 0x0028, 0x0004, 0x001E,
+ 0x01AD, 0x006F, 0x0000, 0x01AC, 0x01AF, 0x06AC, 0x00AA, 0x006E, 0x0019, },
+{ 0x0019, 0x007D, 0x0018, 0x01B5, 0x000D, 0x01B4, 0x007C, 0x007F, 0x01B7,
+ 0x000C, 0x001B, 0x001A, 0x01B6, 0x000F, 0x00D5, 0x0019, 0x007E, 0x00D4,
+ 0x0018, 0x001B, 0x0001, 0x000E, 0x0011, 0x0009, 0x0005, 0x0005, 0x0005,
+ 0x00D7, 0x01B1, 0x0008, 0x01B0, 0x0079, 0x06FD, 0x0371, 0x0370, 0x00D6,
+ 0x0078, 0x01B3, 0x0010, 0x0373, 0x0013, 0x06FC, 0x007B, 0x007A, 0x00D1,
+ 0x00D0, 0x00D3, 0x0065, 0x0372, 0x06FF, 0x0064, 0x06FE, 0x037D, 0x00D2,
+ 0x00DD, 0x0067, 0x0004, 0x037C, 0x0012, 0x01B2, 0x0007, 0x0066, 0x01BD,
+ 0x0006, 0x0061, 0x0004, 0x01BC, 0x001A, 0x0060, 0x001D, 0x0004, 0x001C,
+ 0x0063, 0x0001, 0x0007, 0x000B, 0x0000, 0x0062, 0x000A, 0x0005, 0x0007, },
+{ 0x0069, 0x0045, 0x0068, 0x04BD, 0x0255, 0x04BC, 0x00E5, 0x00E4, 0x0031,
+ 0x0030, 0x0019, 0x0001, 0x0121, 0x00E7, 0x00E6, 0x0033, 0x00E1, 0x00E0,
+ 0x006B, 0x0018, 0x0001, 0x0044, 0x0032, 0x0047, 0x006A, 0x001B, 0x0005,
+ 0x003D, 0x0046, 0x0015, 0x0041, 0x0120, 0x0123, 0x04BF, 0x0122, 0x0040,
+ 0x003C, 0x00E3, 0x0014, 0x0254, 0x0043, 0x0975, 0x012D, 0x00E2, 0x00ED,
+ 0x0042, 0x00EC, 0x004D, 0x0257, 0x0256, 0x0251, 0x04BE, 0x0974, 0x0250,
+ 0x00EF, 0x00EE, 0x004C, 0x04B9, 0x012C, 0x04B8, 0x004F, 0x04BB, 0x0253,
+ 0x003F, 0x0017, 0x0001, 0x0252, 0x00E9, 0x00E8, 0x00EB, 0x0000, 0x0003,
+ 0x0016, 0x0002, 0x0004, 0x004E, 0x003E, 0x00EA, 0x0049, 0x000D, 0x0007, },
+{ 0x000D, 0x01BD, 0x000C, 0x0D31, 0x0D30, 0x0D33, 0x0359, 0x0358, 0x002D,
+ 0x0065, 0x001D, 0x001C, 0x0D32, 0x035B, 0x035A, 0x002C, 0x01BC, 0x0345,
+ 0x000F, 0x001F, 0x0001, 0x002F, 0x0064, 0x01BF, 0x0067, 0x0001, 0x0005,
+ 0x0066, 0x002E, 0x0061, 0x0029, 0x0695, 0x0694, 0x0697, 0x0696, 0x0060,
+ 0x01BE, 0x0D3D, 0x0028, 0x1A49, 0x0344, 0x1A48, 0x1A4B, 0x0D3C, 0x0691,
+ 0x002B, 0x01B9, 0x002A, 0x0D3F, 0x0690, 0x0347, 0x0D3E, 0x1A4A, 0x0346,
+ 0x00D5, 0x0341, 0x0063, 0x0D39, 0x0340, 0x0D38, 0x01B8, 0x0D3B, 0x0D3A,
+ 0x00D4, 0x0062, 0x0000, 0x0693, 0x01BB, 0x0343, 0x0342, 0x001E, 0x000E,
+ 0x006D, 0x0009, 0x0001, 0x006C, 0x00D7, 0x034D, 0x01BA, 0x0008, 0x0004, },
+{ 0x0075, 0x00CD, 0x0035, 0x03C1, 0x03C0, 0x07F9, 0x03C3, 0x1F8D, 0x00CC,
+ 0x0074, 0x0011, 0x0010, 0x03C2, 0x0FD9, 0x01F1, 0x00CF, 0x03CD, 0x00CE,
+ 0x0034, 0x0001, 0x0001, 0x0037, 0x00C9, 0x00C8, 0x0036, 0x0000, 0x0001,
+ 0x0FD8, 0x03CC, 0x00CB, 0x01F0, 0x07F8, 0x03CF, 0x07FB, 0x07FA, 0x00CA,
+ 0x01F3, 0x03CE, 0x00F5, 0x0FDB, 0x00F4, 0x07E5, 0x07E4, 0x07E7, 0x01F2,
+ 0x07E6, 0x03C9, 0x01FD, 0x0FDA, 0x1F8C, 0x07E1, 0x1F8F, 0x1F8E, 0x03C8,
+ 0x03CB, 0x0077, 0x0076, 0x0FC5, 0x03CA, 0x07E0, 0x00F7, 0x0FC4, 0x03F5,
+ 0x00F6, 0x01FC, 0x0003, 0x03F4, 0x0071, 0x03F7, 0x00F1, 0x0013, 0x0031,
+ 0x0030, 0x0070, 0x0005, 0x0012, 0x0073, 0x01FF, 0x0072, 0x007D, 0x0002, },
+{ 0x0061, 0x0055, 0x0060, 0x02C9, 0x02C8, 0x02CB, 0x0171, 0x00B5, 0x0054,
+ 0x0001, 0x0001, 0x0001, 0x0057, 0x0001, 0x0063, 0x001D, 0x0062, 0x0039,
+ 0x006D, 0x0000, 0x0005, 0x0038, 0x0056, 0x00B4, 0x006C, 0x0003, 0x001C,
+ 0x006F, 0x003B, 0x0002, 0x003A, 0x0170, 0x00B7, 0x0173, 0x0051, 0x006E,
+ 0x0025, 0x0050, 0x0069, 0x02CA, 0x0024, 0x0027, 0x0172, 0x00B6, 0x00B1,
+ 0x000D, 0x000C, 0x001F, 0x017D, 0x0026, 0x0068, 0x0053, 0x017C, 0x006B,
+ 0x001E, 0x000F, 0x0004, 0x017F, 0x006A, 0x02F5, 0x0019, 0x0021, 0x0052,
+ 0x02F4, 0x02F7, 0x0020, 0x0BCD, 0x05E5, 0x05E4, 0x0BCC, 0x0023, 0x00B0,
+ 0x02F6, 0x00B3, 0x0022, 0x02F1, 0x02F0, 0x0BCF, 0x0BCE, 0x017E, 0x005D, },
+{ 0x00BD, 0x0025, 0x01A1, 0x0159, 0x0299, 0x00BC, 0x0024, 0x0505, 0x0504,
+ 0x01A0, 0x0001, 0x001D, 0x006D, 0x001C, 0x0001, 0x0005, 0x0027, 0x01A3,
+ 0x0158, 0x001F, 0x001E, 0x01A2, 0x0026, 0x0021, 0x000D, 0x0020, 0x0023,
+ 0x0298, 0x006C, 0x0022, 0x00BF, 0x00BE, 0x01AD, 0x002D, 0x029B, 0x00B9,
+ 0x01AC, 0x00B8, 0x01AF, 0x029A, 0x006F, 0x015B, 0x006E, 0x0285, 0x0284,
+ 0x01AE, 0x0019, 0x002C, 0x01A9, 0x01A8, 0x000C, 0x000F, 0x015A, 0x00BB,
+ 0x000E, 0x0000, 0x0069, 0x01AB, 0x0018, 0x01AA, 0x0004, 0x0055, 0x00BA,
+ 0x0507, 0x0145, 0x0054, 0x0506, 0x00A5, 0x0501, 0x00A4, 0x0057, 0x0500,
+ 0x0A05, 0x0144, 0x00A7, 0x0287, 0x0286, 0x0503, 0x0147, 0x0A04, 0x0146, },
+{ 0x0759, 0x0041, 0x00E5, 0x03BD, 0x0E9D, 0x012D, 0x012C, 0x3A1D, 0x03BC,
+ 0x012F, 0x000D, 0x0040, 0x00E4, 0x03BF, 0x0043, 0x0042, 0x0758, 0x03BE,
+ 0x00E7, 0x0001, 0x0000, 0x003D, 0x00E6, 0x0015, 0x0014, 0x0017, 0x003C,
+ 0x743D, 0x012E, 0x03B9, 0x03B8, 0x0E9C, 0x03BB, 0x075B, 0x3A1C, 0x0E9F,
+ 0x0129, 0x00E1, 0x0128, 0x0E9E, 0x012B, 0x075A, 0x00E0, 0x0E99, 0x0745,
+ 0x3A1F, 0x03BA, 0x0744, 0x0E98, 0x1D0D, 0x03A5, 0x0E9B, 0x743C, 0x0E9A,
+ 0x012A, 0x004D, 0x00E3, 0x0E85, 0x01D5, 0x0E84, 0x004C, 0x0747, 0x1D0C,
+ 0x01D4, 0x003F, 0x0016, 0x0746, 0x03A4, 0x0741, 0x004F, 0x003E, 0x01D7,
+ 0x0740, 0x000C, 0x0011, 0x004E, 0x00E2, 0x00ED, 0x00EC, 0x0049, 0x0048, },
};
-static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] =
-{
- {
- 1, 5, 4, 10, 6, 8, 5, 8, 8,
- 7, 5, 7, 11, 10, 9, 8, 13, 11,
- 6, 7, 3, 9, 8, 10, 9, 8, 5,
- 10, 9, 10, 10, 14, 12, 14, 14, 12,
- 8, 9, 7, 12, 8, 14, 9, 9, 12,
- 8, 9, 11, 11, 13, 9, 11, 14, 12,
- 6, 7, 9, 13, 9, 12, 7, 10, 12,
- 11, 12, 8, 15, 10, 15, 13, 7, 12,
- 10, 10, 8, 10, 13, 13, 13, 11, 8,
- },
- {
- 4, 6, 5, 11, 8, 10, 7, 11, 9,
- 4, 1, 4, 9, 7, 7, 5, 9, 10,
- 6, 7, 4, 9, 9, 10, 9, 9, 6,
- 9, 10, 9, 10, 12, 12, 13, 12, 11,
- 9, 9, 8, 12, 8, 14, 10, 11, 12,
- 7, 8, 10, 11, 12, 9, 11, 13, 12,
- 6, 7, 8, 12, 9, 12, 7, 11, 10,
- 12, 12, 9, 14, 12, 15, 13, 8, 12,
- 11, 11, 10, 12, 13, 15, 14, 12, 9,
- },
- {
- 5, 7, 6, 12, 9, 11, 8, 11, 10,
- 7, 5, 7, 11, 10, 9, 8, 12, 12,
- 5, 5, 1, 8, 7, 10, 8, 6, 4,
- 8, 8, 8, 9, 12, 11, 13, 12, 11,
- 8, 9, 8, 12, 8, 13, 10, 11, 11,
- 8, 9, 11, 12, 13, 11, 12, 14, 13,
- 8, 9, 10, 14, 11, 14, 9, 13, 13,
- 8, 9, 6, 11, 10, 14, 11, 6, 10,
- 6, 6, 4, 8, 9, 10, 10, 8, 5,
- },
- {
- 11, 7, 8, 10, 12, 9, 10, 14, 12,
- 7, 1, 5, 7, 8, 6, 4, 10, 9,
- 10, 5, 4, 8, 11, 8, 7, 6, 7,
- 11, 6, 7, 8, 10, 8, 10, 11, 9,
- 10, 8, 9, 13, 9, 12, 8, 11, 12,
- 11, 4, 7, 8, 9, 6, 8, 12, 9,
- 8, 5, 8, 12, 9, 10, 6, 12, 11,
- 12, 12, 10, 15, 13, 13, 13, 10, 13,
- 15, 10, 9, 10, 12, 13, 13, 10, 9,
- },
- {
- 11, 8, 8, 11, 13, 10, 11, 15, 12,
- 7, 1, 4, 7, 7, 5, 4, 8, 9,
- 11, 5, 5, 8, 11, 9, 8, 7, 8,
- 13, 7, 8, 9, 11, 9, 10, 12, 10,
- 10, 9, 8, 13, 9, 12, 9, 11, 12,
- 11, 5, 7, 9, 10, 6, 9, 13, 10,
- 7, 4, 7, 11, 8, 9, 5, 10, 11,
- 13, 11, 9, 15, 13, 15, 13, 8, 12,
- 15, 10, 10, 12, 13, 14, 14, 12, 11,
- },
- {
- 12, 9, 9, 12, 13, 11, 11, 14, 12,
- 8, 2, 5, 7, 9, 6, 5, 10, 10,
- 9, 4, 2, 7, 9, 7, 6, 5, 6,
- 12, 6, 7, 8, 10, 8, 10, 11, 9,
- 12, 9, 10, 13, 11, 12, 10, 14, 13,
- 12, 6, 8, 10, 10, 7, 9, 12, 10,
- 8, 5, 8, 11, 9, 10, 7, 11, 12,
- 8, 6, 5, 11, 11, 11, 8, 6, 9,
- 12, 6, 6, 8, 10, 10, 11, 8, 6,
- },
- {
- 13, 9, 10, 12, 14, 12, 11, 15, 15,
- 8, 1, 5, 7, 9, 6, 5, 11, 10,
- 11, 6, 5, 9, 11, 9, 8, 7, 8,
- 12, 6, 8, 8, 11, 8, 10, 12, 10,
- 10, 7, 9, 13, 10, 11, 9, 13, 12,
- 11, 3, 6, 8, 9, 4, 7, 11, 8,
- 8, 5, 9, 12, 10, 9, 7, 12, 13,
- 13, 12, 10, 14, 14, 15, 12, 11, 14,
- 15, 7, 9, 8, 11, 11, 12, 10, 9,
- },
- {
- 10, 5, 6, 9, 11, 7, 8, 12, 11,
- 8, 1, 4, 7, 9, 6, 4, 10, 10,
- 11, 6, 6, 9, 9, 9, 9, 8, 8,
- 14, 10, 10, 12, 12, 11, 12, 13, 12,
- 10, 7, 8, 12, 9, 11, 8, 12, 11,
- 13, 7, 10, 11, 11, 8, 10, 13, 11,
- 6, 3, 7, 11, 8, 9, 5, 10, 11,
- 11, 11, 9, 14, 14, 14, 11, 10, 13,
- 14, 10, 11, 13, 13, 13, 14, 12, 12,
- },
- {
- 2, 5, 3, 11, 8, 8, 6, 6, 7,
- 8, 5, 6, 12, 10, 10, 8, 10, 11,
- 7, 6, 2, 9, 8, 10, 8, 5, 4,
- 10, 11, 10, 10, 13, 12, 14, 13, 10,
- 10, 11, 8, 14, 9, 14, 12, 11, 12,
- 9, 10, 9, 13, 12, 11, 12, 14, 11,
- 8, 10, 7, 13, 10, 12, 8, 12, 12,
- 10, 9, 6, 12, 11, 11, 11, 6, 9,
- 10, 9, 6, 10, 9, 12, 11, 8, 7,
- },
- {
- 6, 8, 6, 12, 11, 11, 10, 10, 9,
- 6, 1, 3, 10, 8, 8, 6, 7, 10,
- 8, 6, 3, 10, 9, 10, 8, 6, 5,
- 11, 10, 10, 12, 13, 12, 14, 13, 12,
- 10, 11, 8, 12, 9, 14, 12, 11, 12,
- 9, 9, 8, 12, 12, 10, 12, 13, 11,
- 7, 8, 6, 13, 9, 11, 7, 11, 11,
- 11, 10, 7, 14, 11, 12, 12, 7, 10,
- 12, 11, 8, 13, 12, 14, 13, 11, 10,
- },
- {
- 7, 10, 7, 13, 13, 13, 11, 11, 10,
- 8, 5, 6, 12, 11, 10, 9, 10, 11,
- 7, 5, 1, 9, 8, 10, 7, 4, 4,
- 9, 11, 9, 11, 12, 11, 13, 13, 10,
- 9, 11, 8, 13, 9, 14, 12, 11, 12,
- 11, 10, 10, 13, 12, 11, 14, 14, 12,
- 9, 10, 8, 13, 10, 14, 9, 12, 12,
- 9, 7, 4, 12, 10, 11, 10, 6, 7,
- 9, 7, 4, 9, 9, 11, 9, 7, 5,
- },
- {
- 7, 9, 7, 14, 11, 12, 10, 9, 9,
- 8, 5, 5, 12, 9, 10, 8, 8, 11,
- 7, 5, 2, 8, 8, 9, 7, 4, 4,
- 10, 11, 10, 12, 14, 11, 12, 13, 12,
- 9, 10, 8, 13, 8, 13, 10, 11, 11,
- 9, 9, 8, 14, 10, 10, 11, 12, 11,
- 10, 11, 9, 14, 10, 14, 9, 12, 14,
- 6, 6, 3, 11, 8, 9, 8, 3, 6,
- 9, 7, 4, 10, 8, 11, 10, 6, 5,
- },
- {
- 6, 8, 7, 13, 12, 12, 10, 9, 9,
- 9, 7, 8, 13, 11, 11, 9, 11, 12,
- 7, 6, 1, 9, 8, 10, 7, 5, 4,
- 10, 12, 10, 12, 13, 13, 14, 13, 11,
- 9, 11, 9, 13, 10, 14, 12, 12, 12,
- 11, 12, 10, 14, 13, 12, 13, 14, 12,
- 8, 9, 7, 13, 10, 13, 8, 11, 12,
- 8, 6, 3, 12, 9, 10, 9, 4, 6,
- 10, 8, 5, 10, 10, 12, 11, 8, 6,
- },
- {
- 7, 10, 7, 12, 9, 12, 10, 10, 12,
- 9, 7, 7, 12, 9, 11, 6, 10, 11,
- 6, 6, 1, 9, 8, 9, 7, 4, 5,
- 11, 12, 9, 12, 10, 14, 13, 13, 11,
- 10, 12, 8, 13, 8, 14, 10, 10, 11,
- 11, 11, 10, 13, 14, 10, 14, 13, 11,
- 11, 10, 7, 13, 8, 12, 7, 10, 12,
- 7, 10, 4, 12, 6, 10, 8, 5, 8,
- 10, 7, 4, 9, 7, 10, 9, 6, 5,
- },
- {
- 7, 9, 7, 13, 12, 13, 10, 10, 8,
- 8, 5, 6, 11, 10, 10, 8, 10, 10,
- 7, 5, 2, 9, 8, 9, 7, 5, 3,
- 8, 9, 7, 9, 11, 11, 13, 11, 9,
- 8, 10, 7, 12, 9, 14, 11, 10, 10,
- 9, 10, 9, 12, 12, 12, 13, 14, 12,
- 10, 10, 9, 13, 11, 13, 9, 13, 12,
- 8, 7, 4, 12, 10, 10, 10, 6, 6,
- 7, 6, 3, 9, 8, 10, 9, 6, 3,
- },
- {
- 7, 10, 7, 13, 13, 13, 11, 11, 9,
- 8, 6, 6, 13, 11, 11, 9, 10, 11,
- 7, 6, 1, 9, 8, 10, 8, 5, 4,
- 8, 9, 8, 9, 12, 12, 12, 12, 8,
- 10, 13, 9, 14, 11, 14, 14, 13, 12,
- 9, 10, 9, 13, 12, 11, 13, 14, 11,
- 9, 11, 8, 13, 11, 13, 10, 13, 13,
- 9, 8, 5, 12, 10, 11, 11, 6, 7,
- 8, 7, 3, 8, 9, 11, 10, 7, 4,
- },
- {
- 8, 9, 7, 11, 11, 12, 11, 14, 9,
- 8, 6, 6, 11, 13, 10, 9, 11, 9,
- 7, 5, 1, 7, 9, 9, 7, 5, 3,
- 13, 11, 9, 10, 12, 11, 12, 12, 9,
- 10, 11, 9, 13, 9, 12, 12, 12, 10,
- 12, 11, 10, 13, 14, 12, 14, 14, 11,
- 11, 8, 8, 13, 11, 12, 9, 13, 11,
- 9, 10, 5, 11, 8, 11, 9, 6, 7,
- 7, 8, 4, 6, 8, 10, 8, 8, 5,
- },
- {
- 8, 10, 8, 13, 13, 13, 12, 11, 10,
- 5, 1, 3, 10, 7, 8, 6, 8, 9,
- 8, 7, 4, 9, 10, 11, 8, 7, 6,
- 8, 9, 7, 9, 12, 11, 12, 10, 8,
- 9, 10, 8, 13, 9, 9, 12, 11, 11,
- 7, 7, 6, 12, 9, 8, 10, 12, 8,
- 6, 7, 4, 12, 8, 13, 6, 9, 10,
- 13, 13, 9, 15, 14, 14, 15, 9, 11,
- 13, 11, 9, 13, 13, 15, 15, 12, 10,
- },
- {
- 10, 8, 9, 11, 12, 10, 8, 13, 13,
- 9, 2, 5, 7, 5, 4, 3, 8, 9,
- 11, 5, 5, 9, 8, 8, 6, 8, 8,
- 12, 7, 8, 10, 10, 9, 8, 12, 10,
- 9, 10, 9, 12, 7, 11, 7, 12, 12,
- 9, 5, 8, 9, 9, 6, 6, 11, 10,
- 6, 4, 7, 9, 5, 9, 3, 9, 10,
- 13, 11, 9, 13, 10, 13, 10, 9, 13,
- 14, 11, 10, 12, 12, 13, 11, 14, 11,
- },
- {
- 11, 7, 8, 10, 12, 9, 9, 14, 10,
- 9, 4, 7, 8, 10, 7, 7, 11, 10,
- 8, 2, 2, 6, 8, 5, 5, 5, 6,
- 15, 9, 10, 10, 12, 10, 11, 14, 12,
- 9, 8, 9, 12, 9, 11, 8, 12, 11,
- 14, 10, 11, 12, 13, 10, 12, 15, 12,
- 9, 7, 8, 12, 9, 12, 7, 11, 13,
- 9, 6, 5, 11, 10, 11, 7, 6, 9,
- 11, 4, 5, 7, 8, 8, 8, 7, 7,
- },
+static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
+{ 1, 5, 4, 10, 6, 8, 5, 8, 8,
+ 7, 5, 7, 11, 10, 9, 8, 13, 11,
+ 6, 7, 3, 9, 8, 10, 9, 8, 5,
+ 10, 9, 10, 10, 14, 12, 14, 14, 12,
+ 8, 9, 7, 12, 8, 14, 9, 9, 12,
+ 8, 9, 11, 11, 13, 9, 11, 14, 12,
+ 6, 7, 9, 13, 9, 12, 7, 10, 12,
+ 11, 12, 8, 15, 10, 15, 13, 7, 12,
+ 10, 10, 8, 10, 13, 13, 13, 11, 8, },
+{ 4, 6, 5, 11, 8, 10, 7, 11, 9,
+ 4, 1, 4, 9, 7, 7, 5, 9, 10,
+ 6, 7, 4, 9, 9, 10, 9, 9, 6,
+ 9, 10, 9, 10, 12, 12, 13, 12, 11,
+ 9, 9, 8, 12, 8, 14, 10, 11, 12,
+ 7, 8, 10, 11, 12, 9, 11, 13, 12,
+ 6, 7, 8, 12, 9, 12, 7, 11, 10,
+ 12, 12, 9, 14, 12, 15, 13, 8, 12,
+ 11, 11, 10, 12, 13, 15, 14, 12, 9, },
+{ 5, 7, 6, 12, 9, 11, 8, 11, 10,
+ 7, 5, 7, 11, 10, 9, 8, 12, 12,
+ 5, 5, 1, 8, 7, 10, 8, 6, 4,
+ 8, 8, 8, 9, 12, 11, 13, 12, 11,
+ 8, 9, 8, 12, 8, 13, 10, 11, 11,
+ 8, 9, 11, 12, 13, 11, 12, 14, 13,
+ 8, 9, 10, 14, 11, 14, 9, 13, 13,
+ 8, 9, 6, 11, 10, 14, 11, 6, 10,
+ 6, 6, 4, 8, 9, 10, 10, 8, 5, },
+{ 11, 7, 8, 10, 12, 9, 10, 14, 12,
+ 7, 1, 5, 7, 8, 6, 4, 10, 9,
+ 10, 5, 4, 8, 11, 8, 7, 6, 7,
+ 11, 6, 7, 8, 10, 8, 10, 11, 9,
+ 10, 8, 9, 13, 9, 12, 8, 11, 12,
+ 11, 4, 7, 8, 9, 6, 8, 12, 9,
+ 8, 5, 8, 12, 9, 10, 6, 12, 11,
+ 12, 12, 10, 15, 13, 13, 13, 10, 13,
+ 15, 10, 9, 10, 12, 13, 13, 10, 9, },
+{ 11, 8, 8, 11, 13, 10, 11, 15, 12,
+ 7, 1, 4, 7, 7, 5, 4, 8, 9,
+ 11, 5, 5, 8, 11, 9, 8, 7, 8,
+ 13, 7, 8, 9, 11, 9, 10, 12, 10,
+ 10, 9, 8, 13, 9, 12, 9, 11, 12,
+ 11, 5, 7, 9, 10, 6, 9, 13, 10,
+ 7, 4, 7, 11, 8, 9, 5, 10, 11,
+ 13, 11, 9, 15, 13, 15, 13, 8, 12,
+ 15, 10, 10, 12, 13, 14, 14, 12, 11, },
+{ 12, 9, 9, 12, 13, 11, 11, 14, 12,
+ 8, 2, 5, 7, 9, 6, 5, 10, 10,
+ 9, 4, 2, 7, 9, 7, 6, 5, 6,
+ 12, 6, 7, 8, 10, 8, 10, 11, 9,
+ 12, 9, 10, 13, 11, 12, 10, 14, 13,
+ 12, 6, 8, 10, 10, 7, 9, 12, 10,
+ 8, 5, 8, 11, 9, 10, 7, 11, 12,
+ 8, 6, 5, 11, 11, 11, 8, 6, 9,
+ 12, 6, 6, 8, 10, 10, 11, 8, 6, },
+{ 13, 9, 10, 12, 14, 12, 11, 15, 15,
+ 8, 1, 5, 7, 9, 6, 5, 11, 10,
+ 11, 6, 5, 9, 11, 9, 8, 7, 8,
+ 12, 6, 8, 8, 11, 8, 10, 12, 10,
+ 10, 7, 9, 13, 10, 11, 9, 13, 12,
+ 11, 3, 6, 8, 9, 4, 7, 11, 8,
+ 8, 5, 9, 12, 10, 9, 7, 12, 13,
+ 13, 12, 10, 14, 14, 15, 12, 11, 14,
+ 15, 7, 9, 8, 11, 11, 12, 10, 9, },
+{ 10, 5, 6, 9, 11, 7, 8, 12, 11,
+ 8, 1, 4, 7, 9, 6, 4, 10, 10,
+ 11, 6, 6, 9, 9, 9, 9, 8, 8,
+ 14, 10, 10, 12, 12, 11, 12, 13, 12,
+ 10, 7, 8, 12, 9, 11, 8, 12, 11,
+ 13, 7, 10, 11, 11, 8, 10, 13, 11,
+ 6, 3, 7, 11, 8, 9, 5, 10, 11,
+ 11, 11, 9, 14, 14, 14, 11, 10, 13,
+ 14, 10, 11, 13, 13, 13, 14, 12, 12, },
+{ 2, 5, 3, 11, 8, 8, 6, 6, 7,
+ 8, 5, 6, 12, 10, 10, 8, 10, 11,
+ 7, 6, 2, 9, 8, 10, 8, 5, 4,
+ 10, 11, 10, 10, 13, 12, 14, 13, 10,
+ 10, 11, 8, 14, 9, 14, 12, 11, 12,
+ 9, 10, 9, 13, 12, 11, 12, 14, 11,
+ 8, 10, 7, 13, 10, 12, 8, 12, 12,
+ 10, 9, 6, 12, 11, 11, 11, 6, 9,
+ 10, 9, 6, 10, 9, 12, 11, 8, 7, },
+{ 6, 8, 6, 12, 11, 11, 10, 10, 9,
+ 6, 1, 3, 10, 8, 8, 6, 7, 10,
+ 8, 6, 3, 10, 9, 10, 8, 6, 5,
+ 11, 10, 10, 12, 13, 12, 14, 13, 12,
+ 10, 11, 8, 12, 9, 14, 12, 11, 12,
+ 9, 9, 8, 12, 12, 10, 12, 13, 11,
+ 7, 8, 6, 13, 9, 11, 7, 11, 11,
+ 11, 10, 7, 14, 11, 12, 12, 7, 10,
+ 12, 11, 8, 13, 12, 14, 13, 11, 10, },
+{ 7, 10, 7, 13, 13, 13, 11, 11, 10,
+ 8, 5, 6, 12, 11, 10, 9, 10, 11,
+ 7, 5, 1, 9, 8, 10, 7, 4, 4,
+ 9, 11, 9, 11, 12, 11, 13, 13, 10,
+ 9, 11, 8, 13, 9, 14, 12, 11, 12,
+ 11, 10, 10, 13, 12, 11, 14, 14, 12,
+ 9, 10, 8, 13, 10, 14, 9, 12, 12,
+ 9, 7, 4, 12, 10, 11, 10, 6, 7,
+ 9, 7, 4, 9, 9, 11, 9, 7, 5, },
+{ 7, 9, 7, 14, 11, 12, 10, 9, 9,
+ 8, 5, 5, 12, 9, 10, 8, 8, 11,
+ 7, 5, 2, 8, 8, 9, 7, 4, 4,
+ 10, 11, 10, 12, 14, 11, 12, 13, 12,
+ 9, 10, 8, 13, 8, 13, 10, 11, 11,
+ 9, 9, 8, 14, 10, 10, 11, 12, 11,
+ 10, 11, 9, 14, 10, 14, 9, 12, 14,
+ 6, 6, 3, 11, 8, 9, 8, 3, 6,
+ 9, 7, 4, 10, 8, 11, 10, 6, 5, },
+{ 6, 8, 7, 13, 12, 12, 10, 9, 9,
+ 9, 7, 8, 13, 11, 11, 9, 11, 12,
+ 7, 6, 1, 9, 8, 10, 7, 5, 4,
+ 10, 12, 10, 12, 13, 13, 14, 13, 11,
+ 9, 11, 9, 13, 10, 14, 12, 12, 12,
+ 11, 12, 10, 14, 13, 12, 13, 14, 12,
+ 8, 9, 7, 13, 10, 13, 8, 11, 12,
+ 8, 6, 3, 12, 9, 10, 9, 4, 6,
+ 10, 8, 5, 10, 10, 12, 11, 8, 6, },
+{ 7, 10, 7, 12, 9, 12, 10, 10, 12,
+ 9, 7, 7, 12, 9, 11, 6, 10, 11,
+ 6, 6, 1, 9, 8, 9, 7, 4, 5,
+ 11, 12, 9, 12, 10, 14, 13, 13, 11,
+ 10, 12, 8, 13, 8, 14, 10, 10, 11,
+ 11, 11, 10, 13, 14, 10, 14, 13, 11,
+ 11, 10, 7, 13, 8, 12, 7, 10, 12,
+ 7, 10, 4, 12, 6, 10, 8, 5, 8,
+ 10, 7, 4, 9, 7, 10, 9, 6, 5, },
+{ 7, 9, 7, 13, 12, 13, 10, 10, 8,
+ 8, 5, 6, 11, 10, 10, 8, 10, 10,
+ 7, 5, 2, 9, 8, 9, 7, 5, 3,
+ 8, 9, 7, 9, 11, 11, 13, 11, 9,
+ 8, 10, 7, 12, 9, 14, 11, 10, 10,
+ 9, 10, 9, 12, 12, 12, 13, 14, 12,
+ 10, 10, 9, 13, 11, 13, 9, 13, 12,
+ 8, 7, 4, 12, 10, 10, 10, 6, 6,
+ 7, 6, 3, 9, 8, 10, 9, 6, 3, },
+{ 7, 10, 7, 13, 13, 13, 11, 11, 9,
+ 8, 6, 6, 13, 11, 11, 9, 10, 11,
+ 7, 6, 1, 9, 8, 10, 8, 5, 4,
+ 8, 9, 8, 9, 12, 12, 12, 12, 8,
+ 10, 13, 9, 14, 11, 14, 14, 13, 12,
+ 9, 10, 9, 13, 12, 11, 13, 14, 11,
+ 9, 11, 8, 13, 11, 13, 10, 13, 13,
+ 9, 8, 5, 12, 10, 11, 11, 6, 7,
+ 8, 7, 3, 8, 9, 11, 10, 7, 4, },
+{ 8, 9, 7, 11, 11, 12, 11, 14, 9,
+ 8, 6, 6, 11, 13, 10, 9, 11, 9,
+ 7, 5, 1, 7, 9, 9, 7, 5, 3,
+ 13, 11, 9, 10, 12, 11, 12, 12, 9,
+ 10, 11, 9, 13, 9, 12, 12, 12, 10,
+ 12, 11, 10, 13, 14, 12, 14, 14, 11,
+ 11, 8, 8, 13, 11, 12, 9, 13, 11,
+ 9, 10, 5, 11, 8, 11, 9, 6, 7,
+ 7, 8, 4, 6, 8, 10, 8, 8, 5, },
+{ 8, 10, 8, 13, 13, 13, 12, 11, 10,
+ 5, 1, 3, 10, 7, 8, 6, 8, 9,
+ 8, 7, 4, 9, 10, 11, 8, 7, 6,
+ 8, 9, 7, 9, 12, 11, 12, 10, 8,
+ 9, 10, 8, 13, 9, 9, 12, 11, 11,
+ 7, 7, 6, 12, 9, 8, 10, 12, 8,
+ 6, 7, 4, 12, 8, 13, 6, 9, 10,
+ 13, 13, 9, 15, 14, 14, 15, 9, 11,
+ 13, 11, 9, 13, 13, 15, 15, 12, 10, },
+{ 10, 8, 9, 11, 12, 10, 8, 13, 13,
+ 9, 2, 5, 7, 5, 4, 3, 8, 9,
+ 11, 5, 5, 9, 8, 8, 6, 8, 8,
+ 12, 7, 8, 10, 10, 9, 8, 12, 10,
+ 9, 10, 9, 12, 7, 11, 7, 12, 12,
+ 9, 5, 8, 9, 9, 6, 6, 11, 10,
+ 6, 4, 7, 9, 5, 9, 3, 9, 10,
+ 13, 11, 9, 13, 10, 13, 10, 9, 13,
+ 14, 11, 10, 12, 12, 13, 11, 14, 11, },
+{ 11, 7, 8, 10, 12, 9, 9, 14, 10,
+ 9, 4, 7, 8, 10, 7, 7, 11, 10,
+ 8, 2, 2, 6, 8, 5, 5, 5, 6,
+ 15, 9, 10, 10, 12, 10, 11, 14, 12,
+ 9, 8, 9, 12, 9, 11, 8, 12, 11,
+ 14, 10, 11, 12, 13, 10, 12, 15, 12,
+ 9, 7, 8, 12, 9, 12, 7, 11, 13,
+ 9, 6, 5, 11, 10, 11, 7, 6, 9,
+ 11, 4, 5, 7, 8, 8, 8, 7, 7, },
};
//@}
@@ -512,208 +428,206 @@ static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] =
#define AIC_MODE1_SIZE 9
#define AIC_MODE1_BITS 7
-static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] =
-{
- { 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,},
- { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,},
- { 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,},
- { 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,},
- { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,},
- { 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,},
- { 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,},
- { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,},
- { 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,},
- { 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,},
- { 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,},
- { 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,},
- { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,},
- { 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,},
- { 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,},
- { 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,},
- { 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,},
- { 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,},
- { 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,},
- { 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,},
- { 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,},
- { 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,},
- { 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,},
- { 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,},
- { 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,},
- { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,},
- { 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,},
- { 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,},
- { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,},
- { 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,},
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,},
- { 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,},
- { 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,},
- { 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,},
- { 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,},
- { 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,},
- { 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,},
- { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,},
- { 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,},
- { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
- { 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,},
- { 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,},
- { 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,},
- { 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,},
- { 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
- { 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,},
- { 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,},
- { 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,},
- { 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,},
- { 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,},
- { 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,},
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
- { 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,},
- { 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,},
- { 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,},
- { 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,},
- { 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,},
- { 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,},
- { 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,},
- { 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
+ { 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,},
+ { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
+ { 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,},
+ { 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,},
+ { 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,},
+ { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
+ { 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,},
+ { 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,},
+ { 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,},
+ { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
+ { 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,},
+ { 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,},
+ { 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,},
+ { 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,},
+ { 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,},
+ { 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,},
+ { 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,},
+ { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,},
+ { 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,},
+ { 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,},
+ { 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,},
+ { 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,},
+ { 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,},
+ { 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,},
+ { 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,},
+ { 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,},
+ { 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,},
+ { 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,},
+ { 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,},
+ { 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,},
+ { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,},
+ { 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,},
+ { 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,},
+ { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,},
+ { 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,},
+ { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,},
+ { 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,},
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
+ { 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,},
+ { 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,},
+ { 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,},
+ { 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,},
+ { 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,},
+ { 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,},
+ { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,},
+ { 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,},
+ { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
+ { 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,},
+ { 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,},
+ { 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,},
+ { 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,},
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
+ { 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,},
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
+ { 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,},
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
+ { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,},
+ { 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
+ { 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,},
+ { 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,},
+ { 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,},
+ { 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,},
+ { 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,},
+ { 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,},
+ { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
+ { 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+
+ { 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,},
+ { 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,},
+ { 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,},
+ { 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,},
+ { 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,},
+ { 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,},
+ { 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,},
+ { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,},
+ { 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
};
-static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] =
-{
- { 1, 4, 2, 7, 4, 6, 4, 7, 5,},
- { 5, 1, 3, 4, 6, 3, 3, 7, 7,},
- { 1, 4, 2, 7, 6, 7, 5, 4, 4,},
- { 1, 3, 3, 3, 7, 4, 5, 7, 6,},
- { 2, 4, 2, 6, 4, 5, 2, 4, 6,},
- { 7, 2, 3, 4, 7, 1, 5, 7, 7,},
- { 5, 1, 3, 6, 5, 5, 2, 7, 7,},
- { 2, 5, 1, 7, 3, 7, 5, 5, 6,},
- { 2, 4, 1, 4, 5, 7, 6, 7, 4,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 2, 1, 3, 6, 5, 5, 5, 7, 7,},
- { 5, 1, 3, 4, 6, 3, 3, 7, 7,},
- { 4, 1, 2, 6, 5, 5, 4, 5, 6,},
- { 3, 1, 3, 4, 6, 3, 5, 7, 7,},
- { 4, 1, 3, 6, 3, 5, 3, 7, 7,},
- { 6, 1, 4, 4, 5, 2, 4, 7, 7,},
- { 7, 1, 5, 7, 4, 3, 2, 7, 7,},
- { 5, 3, 2, 7, 5, 6, 1, 5, 7,},
- { 4, 1, 2, 6, 7, 5, 4, 7, 4,},
- { 1, 0, 1, 0, 0, 0, 0, 0, 0,},
-
- { 3, 3, 1, 5, 5, 6, 6, 5, 3,},
- { 6, 2, 1, 5, 6, 5, 4, 4, 5,},
- { 6, 4, 1, 7, 6, 7, 6, 3, 2,},
- { 4, 3, 1, 4, 6, 4, 6, 5, 3,},
- { 6, 5, 1, 7, 4, 7, 3, 3, 3,},
- { 7, 2, 2, 3, 7, 2, 4, 6, 5,},
- { 6, 2, 2, 6, 4, 5, 2, 4, 4,},
- { 4, 4, 1, 7, 6, 7, 5, 2, 4,},
- { 5, 4, 1, 5, 6, 6, 5, 4, 2,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 2, 2, 2, 3, 5, 5, 6, 6, 5,},
- { 7, 1, 3, 3, 6, 3, 4, 7, 5,},
- { 2, 4, 1, 4, 6, 7, 7, 5, 4,},
- { 7, 4, 3, 1, 5, 3, 6, 7, 3,},
- { 4, 3, 3, 4, 1, 6, 4, 6, 5,},
- { 7, 4, 4, 2, 6, 1, 4, 7, 5,},
- { 5, 2, 3, 4, 4, 3, 2, 5, 4,},
- { 3, 5, 2, 3, 2, 5, 5, 5, 3,},
- { 6, 4, 4, 2, 5, 4, 7, 7, 1,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 2, 2, 2, 7, 3, 7, 4, 5, 6,},
- { 4, 1, 3, 6, 4, 4, 3, 6, 5,},
- { 2, 4, 1, 7, 3, 7, 6, 6, 6,},
- { 3, 4, 3, 5, 1, 4, 4, 6, 6,},
- { 4, 5, 2, 7, 1, 7, 3, 7, 7,},
- { 6, 2, 3, 5, 3, 3, 2, 6, 4,},
- { 4, 4, 4, 7, 2, 5, 1, 6, 7,},
- { 4, 5, 2, 7, 1, 7, 4, 4, 6,},
- { 2, 4, 2, 6, 2, 4, 6, 5, 4,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 1, 3, 3, 5, 6, 3, 5, 6, 5,},
- { 7, 1, 4, 4, 6, 2, 4, 7, 5,},
- { 2, 2, 2, 6, 5, 3, 5, 6, 5,},
- { 7, 4, 4, 2, 6, 1, 5, 7, 4,},
- { 3, 2, 2, 4, 4, 3, 4, 5, 5,},
- { 7, 2, 5, 3, 7, 1, 4, 7, 7,},
- { 6, 2, 3, 4, 5, 2, 2, 7, 7,},
- { 3, 2, 2, 5, 5, 4, 4, 4, 3,},
- { 3, 2, 2, 4, 6, 3, 5, 6, 3,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 1, 3, 3, 7, 4, 6, 3, 5, 7,},
- { 4, 1, 4, 7, 4, 5, 2, 6, 7,},
- { 2, 4, 1, 7, 5, 7, 3, 7, 7,},
- { 3, 2, 3, 5, 3, 4, 2, 6, 6,},
- { 3, 5, 4, 7, 2, 7, 1, 7, 7,},
- { 4, 1, 3, 6, 5, 3, 3, 7, 7,},
- { 4, 2, 5, 7, 3, 7, 1, 7, 7,},
- { 7, 4, 1, 7, 3, 7, 2, 5, 7,},
- { 4, 2, 2, 6, 4, 5, 2, 6, 4,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 3, 4, 1, 7, 6, 7, 6, 2, 6,},
- { 4, 2, 2, 6, 6, 5, 4, 2, 4,},
- { 4, 4, 1, 7, 5, 7, 6, 2, 4,},
- { 3, 3, 2, 5, 4, 4, 5, 2, 4,},
- { 4, 5, 2, 7, 2, 7, 3, 2, 6,},
- { 4, 3, 2, 5, 5, 4, 3, 2, 4,},
- { 7, 4, 2, 7, 2, 5, 3, 2, 6,},
- { 4, 6, 2, 7, 3, 7, 6, 1, 6,},
- { 5, 5, 1, 6, 4, 6, 5, 2, 4,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
-
- { 3, 3, 2, 3, 5, 6, 6, 4, 2,},
- { 7, 1, 3, 3, 6, 5, 7, 4, 3,},
- { 5, 4, 1, 5, 5, 6, 6, 4, 2,},
- { 6, 4, 2, 2, 6, 3, 6, 6, 2,},
- { 6, 4, 2, 5, 3, 6, 3, 3, 2,},
- { 6, 3, 2, 3, 5, 2, 4, 6, 3,},
- { 6, 2, 2, 4, 3, 5, 3, 6, 3,},
- { 7, 5, 1, 7, 4, 7, 7, 3, 2,},
- { 5, 5, 2, 3, 6, 7, 7, 5, 1,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
+ { 1, 4, 2, 7, 4, 6, 4, 7, 5,},
+ { 5, 1, 3, 4, 6, 3, 3, 7, 7,},
+ { 1, 4, 2, 7, 6, 7, 5, 4, 4,},
+ { 1, 3, 3, 3, 7, 4, 5, 7, 6,},
+ { 2, 4, 2, 6, 4, 5, 2, 4, 6,},
+ { 7, 2, 3, 4, 7, 1, 5, 7, 7,},
+ { 5, 1, 3, 6, 5, 5, 2, 7, 7,},
+ { 2, 5, 1, 7, 3, 7, 5, 5, 6,},
+ { 2, 4, 1, 4, 5, 7, 6, 7, 4,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 2, 1, 3, 6, 5, 5, 5, 7, 7,},
+ { 5, 1, 3, 4, 6, 3, 3, 7, 7,},
+ { 4, 1, 2, 6, 5, 5, 4, 5, 6,},
+ { 3, 1, 3, 4, 6, 3, 5, 7, 7,},
+ { 4, 1, 3, 6, 3, 5, 3, 7, 7,},
+ { 6, 1, 4, 4, 5, 2, 4, 7, 7,},
+ { 7, 1, 5, 7, 4, 3, 2, 7, 7,},
+ { 5, 3, 2, 7, 5, 6, 1, 5, 7,},
+ { 4, 1, 2, 6, 7, 5, 4, 7, 4,},
+ { 1, 0, 1, 0, 0, 0, 0, 0, 0,},
+
+ { 3, 3, 1, 5, 5, 6, 6, 5, 3,},
+ { 6, 2, 1, 5, 6, 5, 4, 4, 5,},
+ { 6, 4, 1, 7, 6, 7, 6, 3, 2,},
+ { 4, 3, 1, 4, 6, 4, 6, 5, 3,},
+ { 6, 5, 1, 7, 4, 7, 3, 3, 3,},
+ { 7, 2, 2, 3, 7, 2, 4, 6, 5,},
+ { 6, 2, 2, 6, 4, 5, 2, 4, 4,},
+ { 4, 4, 1, 7, 6, 7, 5, 2, 4,},
+ { 5, 4, 1, 5, 6, 6, 5, 4, 2,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 2, 2, 2, 3, 5, 5, 6, 6, 5,},
+ { 7, 1, 3, 3, 6, 3, 4, 7, 5,},
+ { 2, 4, 1, 4, 6, 7, 7, 5, 4,},
+ { 7, 4, 3, 1, 5, 3, 6, 7, 3,},
+ { 4, 3, 3, 4, 1, 6, 4, 6, 5,},
+ { 7, 4, 4, 2, 6, 1, 4, 7, 5,},
+ { 5, 2, 3, 4, 4, 3, 2, 5, 4,},
+ { 3, 5, 2, 3, 2, 5, 5, 5, 3,},
+ { 6, 4, 4, 2, 5, 4, 7, 7, 1,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 2, 2, 2, 7, 3, 7, 4, 5, 6,},
+ { 4, 1, 3, 6, 4, 4, 3, 6, 5,},
+ { 2, 4, 1, 7, 3, 7, 6, 6, 6,},
+ { 3, 4, 3, 5, 1, 4, 4, 6, 6,},
+ { 4, 5, 2, 7, 1, 7, 3, 7, 7,},
+ { 6, 2, 3, 5, 3, 3, 2, 6, 4,},
+ { 4, 4, 4, 7, 2, 5, 1, 6, 7,},
+ { 4, 5, 2, 7, 1, 7, 4, 4, 6,},
+ { 2, 4, 2, 6, 2, 4, 6, 5, 4,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 1, 3, 3, 5, 6, 3, 5, 6, 5,},
+ { 7, 1, 4, 4, 6, 2, 4, 7, 5,},
+ { 2, 2, 2, 6, 5, 3, 5, 6, 5,},
+ { 7, 4, 4, 2, 6, 1, 5, 7, 4,},
+ { 3, 2, 2, 4, 4, 3, 4, 5, 5,},
+ { 7, 2, 5, 3, 7, 1, 4, 7, 7,},
+ { 6, 2, 3, 4, 5, 2, 2, 7, 7,},
+ { 3, 2, 2, 5, 5, 4, 4, 4, 3,},
+ { 3, 2, 2, 4, 6, 3, 5, 6, 3,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 1, 3, 3, 7, 4, 6, 3, 5, 7,},
+ { 4, 1, 4, 7, 4, 5, 2, 6, 7,},
+ { 2, 4, 1, 7, 5, 7, 3, 7, 7,},
+ { 3, 2, 3, 5, 3, 4, 2, 6, 6,},
+ { 3, 5, 4, 7, 2, 7, 1, 7, 7,},
+ { 4, 1, 3, 6, 5, 3, 3, 7, 7,},
+ { 4, 2, 5, 7, 3, 7, 1, 7, 7,},
+ { 7, 4, 1, 7, 3, 7, 2, 5, 7,},
+ { 4, 2, 2, 6, 4, 5, 2, 6, 4,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 3, 4, 1, 7, 6, 7, 6, 2, 6,},
+ { 4, 2, 2, 6, 6, 5, 4, 2, 4,},
+ { 4, 4, 1, 7, 5, 7, 6, 2, 4,},
+ { 3, 3, 2, 5, 4, 4, 5, 2, 4,},
+ { 4, 5, 2, 7, 2, 7, 3, 2, 6,},
+ { 4, 3, 2, 5, 5, 4, 3, 2, 4,},
+ { 7, 4, 2, 7, 2, 5, 3, 2, 6,},
+ { 4, 6, 2, 7, 3, 7, 6, 1, 6,},
+ { 5, 5, 1, 6, 4, 6, 5, 2, 4,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+
+ { 3, 3, 2, 3, 5, 6, 6, 4, 2,},
+ { 7, 1, 3, 3, 6, 5, 7, 4, 3,},
+ { 5, 4, 1, 5, 5, 6, 6, 4, 2,},
+ { 6, 4, 2, 2, 6, 3, 6, 6, 2,},
+ { 6, 4, 2, 5, 3, 6, 3, 3, 2,},
+ { 6, 3, 2, 3, 5, 2, 4, 6, 3,},
+ { 6, 2, 2, 4, 3, 5, 3, 6, 3,},
+ { 7, 5, 1, 7, 4, 7, 7, 3, 2,},
+ { 5, 5, 2, 3, 6, 7, 7, 5, 1,},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0,},
};
//@}
@@ -726,37 +640,33 @@ static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] =
#define PTYPE_VLC_SIZE 8
#define PTYPE_VLC_BITS 7
-static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] =
-{
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C },
- { 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
+static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C },
+ { 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
};
-static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] =
-{
- { 1, 2, 3, 6, 5, 4, 7, 7 },
- { 3, 1, 2, 7, 6, 5, 4, 7 },
- { 5, 4, 1, 4, 3, 3, 4, 5 },
- { 4, 5, 2, 2, 3, 2, 6, 6 },
- { 5, 6, 1, 4, 2, 3, 7, 7 },
- { 5, 6, 1, 4, 3, 2, 7, 7 },
- { 6, 3, 2, 7, 5, 4, 1, 7 }
+static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
+ { 1, 2, 3, 6, 5, 4, 7, 7 },
+ { 3, 1, 2, 7, 6, 5, 4, 7 },
+ { 5, 4, 1, 4, 3, 3, 4, 5 },
+ { 4, 5, 2, 2, 3, 2, 6, 6 },
+ { 5, 6, 1, 4, 2, 3, 7, 7 },
+ { 5, 6, 1, 4, 3, 2, 7, 7 },
+ { 6, 3, 2, 7, 5, 4, 1, 7 }
};
-static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] =
-{
- 0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE
+static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] = {
+ 0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE
};
/** reverse of ptype_vlc_syms */
-static const uint8_t block_num_to_ptype_vlc_num[12] =
-{
- 0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6
+static const uint8_t block_num_to_ptype_vlc_num[12] = {
+ 0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6
};
//@}
@@ -766,35 +676,31 @@ static const uint8_t block_num_to_ptype_vlc_num[12] =
#define BTYPE_VLC_SIZE 7
#define BTYPE_VLC_BITS 6
-static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] =
-{
- { 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
+static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] = {
+ { 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
};
-static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] =
-{
- { 2, 3, 2, 2, 5, 4, 5 },
- { 4, 1, 3, 2, 6, 5, 6 },
- { 6, 4, 1, 2, 5, 3, 6 },
- { 5, 3, 3, 1, 4, 3, 5 },
- { 6, 5, 3, 2, 4, 1, 6 },
- { 6, 5, 3, 1, 4, 2, 6 }
+static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] = {
+ { 2, 3, 2, 2, 5, 4, 5 },
+ { 4, 1, 3, 2, 6, 5, 6 },
+ { 6, 4, 1, 2, 5, 3, 6 },
+ { 5, 3, 3, 1, 4, 3, 5 },
+ { 6, 5, 3, 2, 4, 1, 6 },
+ { 6, 5, 3, 1, 4, 2, 6 }
};
-static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] =
-{
- 0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE
+static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] = {
+ 0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE
};
/** reverse of btype_vlc_syms */
-static const uint8_t block_num_to_btype_vlc_num[12] =
-{
- 0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
+static const uint8_t block_num_to_btype_vlc_num[12] = {
+ 0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
};
//@}
#endif /* AVCODEC_RV40VLC2_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/simple_idct.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/simple_idct.c
index 1a996e8e6..659863d6a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/simple_idct.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/simple_idct.c
@@ -56,13 +56,13 @@
#define COL_SHIFT 20 // 6
#endif
-static inline void idctRowCondDC(DCTELEM * row)
+static inline void idctRowCondDC (DCTELEM * row)
{
- int a0, a1, a2, a3, b0, b1, b2, b3;
+ int a0, a1, a2, a3, b0, b1, b2, b3;
#if HAVE_FAST_64BIT
- uint64_t temp;
+ uint64_t temp;
#else
- uint32_t temp;
+ uint32_t temp;
#endif
#if HAVE_FAST_64BIT
@@ -71,353 +71,330 @@ static inline void idctRowCondDC(DCTELEM * row)
#else
#define ROW0_MASK 0xffffLL
#endif
- if(sizeof(DCTELEM) == 2)
- {
- if(((((uint64_t *)row)[0] & ~ROW0_MASK) |
- ((uint64_t *)row)[1]) == 0)
- {
- temp = (row[0] << 3) & 0xffff;
- temp += temp << 16;
- temp += temp << 32;
- ((uint64_t *)row)[0] = temp;
- ((uint64_t *)row)[1] = temp;
- return;
+ if(sizeof(DCTELEM)==2){
+ if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
+ ((uint64_t *)row)[1]) == 0) {
+ temp = (row[0] << 3) & 0xffff;
+ temp += temp << 16;
+ temp += temp << 32;
+ ((uint64_t *)row)[0] = temp;
+ ((uint64_t *)row)[1] = temp;
+ return;
+ }
+ }else{
+ if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
+ row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
+ return;
+ }
}
- }
- else
- {
- if(!(row[1] | row[2] | row[3] | row[4] | row[5] | row[6] | row[7]))
- {
- row[0] = row[1] = row[2] = row[3] = row[4] = row[5] = row[6] = row[7] = row[0] << 3;
- return;
- }
- }
#else
- if(sizeof(DCTELEM) == 2)
- {
- if(!(((uint32_t*)row)[1] |
- ((uint32_t*)row)[2] |
- ((uint32_t*)row)[3] |
- row[1]))
- {
- temp = (row[0] << 3) & 0xffff;
- temp += temp << 16;
- ((uint32_t*)row)[0] = ((uint32_t*)row)[1] =
- ((uint32_t*)row)[2] = ((uint32_t*)row)[3] = temp;
- return;
+ if(sizeof(DCTELEM)==2){
+ if (!(((uint32_t*)row)[1] |
+ ((uint32_t*)row)[2] |
+ ((uint32_t*)row)[3] |
+ row[1])) {
+ temp = (row[0] << 3) & 0xffff;
+ temp += temp << 16;
+ ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
+ ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
+ return;
+ }
+ }else{
+ if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
+ row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
+ return;
+ }
}
- }
- else
- {
- if(!(row[1] | row[2] | row[3] | row[4] | row[5] | row[6] | row[7]))
- {
- row[0] = row[1] = row[2] = row[3] = row[4] = row[5] = row[6] = row[7] = row[0] << 3;
- return;
- }
- }
#endif
- a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
- a1 = a0;
- a2 = a0;
- a3 = a0;
-
- /* no need to optimize : gcc does it */
- a0 += W2 * row[2];
- a1 += W6 * row[2];
- a2 -= W6 * row[2];
- a3 -= W2 * row[2];
-
- b0 = MUL16(W1, row[1]);
- MAC16(b0, W3, row[3]);
- b1 = MUL16(W3, row[1]);
- MAC16(b1, -W7, row[3]);
- b2 = MUL16(W5, row[1]);
- MAC16(b2, -W1, row[3]);
- b3 = MUL16(W7, row[1]);
- MAC16(b3, -W5, row[3]);
+ a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
+ a1 = a0;
+ a2 = a0;
+ a3 = a0;
+
+ /* no need to optimize : gcc does it */
+ a0 += W2 * row[2];
+ a1 += W6 * row[2];
+ a2 -= W6 * row[2];
+ a3 -= W2 * row[2];
+
+ b0 = MUL16(W1, row[1]);
+ MAC16(b0, W3, row[3]);
+ b1 = MUL16(W3, row[1]);
+ MAC16(b1, -W7, row[3]);
+ b2 = MUL16(W5, row[1]);
+ MAC16(b2, -W1, row[3]);
+ b3 = MUL16(W7, row[1]);
+ MAC16(b3, -W5, row[3]);
#if HAVE_FAST_64BIT
- temp = ((uint64_t*)row)[1];
+ temp = ((uint64_t*)row)[1];
#else
- temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
+ temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
#endif
- if(temp != 0)
- {
- a0 += W4 * row[4] + W6 * row[6];
- a1 += - W4 * row[4] - W2 * row[6];
- a2 += - W4 * row[4] + W2 * row[6];
- a3 += W4 * row[4] - W6 * row[6];
+ if (temp != 0) {
+ a0 += W4*row[4] + W6*row[6];
+ a1 += - W4*row[4] - W2*row[6];
+ a2 += - W4*row[4] + W2*row[6];
+ a3 += W4*row[4] - W6*row[6];
- MAC16(b0, W5, row[5]);
- MAC16(b0, W7, row[7]);
+ MAC16(b0, W5, row[5]);
+ MAC16(b0, W7, row[7]);
- MAC16(b1, -W1, row[5]);
- MAC16(b1, -W5, row[7]);
+ MAC16(b1, -W1, row[5]);
+ MAC16(b1, -W5, row[7]);
- MAC16(b2, W7, row[5]);
- MAC16(b2, W3, row[7]);
+ MAC16(b2, W7, row[5]);
+ MAC16(b2, W3, row[7]);
- MAC16(b3, W3, row[5]);
- MAC16(b3, -W1, row[7]);
- }
+ MAC16(b3, W3, row[5]);
+ MAC16(b3, -W1, row[7]);
+ }
- row[0] = (a0 + b0) >> ROW_SHIFT;
- row[7] = (a0 - b0) >> ROW_SHIFT;
- row[1] = (a1 + b1) >> ROW_SHIFT;
- row[6] = (a1 - b1) >> ROW_SHIFT;
- row[2] = (a2 + b2) >> ROW_SHIFT;
- row[5] = (a2 - b2) >> ROW_SHIFT;
- row[3] = (a3 + b3) >> ROW_SHIFT;
- row[4] = (a3 - b3) >> ROW_SHIFT;
+ row[0] = (a0 + b0) >> ROW_SHIFT;
+ row[7] = (a0 - b0) >> ROW_SHIFT;
+ row[1] = (a1 + b1) >> ROW_SHIFT;
+ row[6] = (a1 - b1) >> ROW_SHIFT;
+ row[2] = (a2 + b2) >> ROW_SHIFT;
+ row[5] = (a2 - b2) >> ROW_SHIFT;
+ row[3] = (a3 + b3) >> ROW_SHIFT;
+ row[4] = (a3 - b3) >> ROW_SHIFT;
}
-static inline void idctSparseColPut(uint8_t *dest, int line_size,
- DCTELEM * col)
+static inline void idctSparseColPut (uint8_t *dest, int line_size,
+ DCTELEM * col)
{
- int a0, a1, a2, a3, b0, b1, b2, b3;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
- /* XXX: I did that only to give same values as previous code */
- a0 = W4 * (col[8*0] + ((1 << (COL_SHIFT - 1)) / W4));
- a1 = a0;
- a2 = a0;
- a3 = a0;
-
- a0 += + W2 * col[8*2];
- a1 += + W6 * col[8*2];
- a2 += - W6 * col[8*2];
- a3 += - W2 * col[8*2];
-
- b0 = MUL16(W1, col[8*1]);
- b1 = MUL16(W3, col[8*1]);
- b2 = MUL16(W5, col[8*1]);
- b3 = MUL16(W7, col[8*1]);
-
- MAC16(b0, + W3, col[8*3]);
- MAC16(b1, - W7, col[8*3]);
- MAC16(b2, - W1, col[8*3]);
- MAC16(b3, - W5, col[8*3]);
-
- if(col[8*4])
- {
- a0 += + W4 * col[8*4];
- a1 += - W4 * col[8*4];
- a2 += - W4 * col[8*4];
- a3 += + W4 * col[8*4];
- }
+ int a0, a1, a2, a3, b0, b1, b2, b3;
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+
+ /* XXX: I did that only to give same values as previous code */
+ a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
+ a1 = a0;
+ a2 = a0;
+ a3 = a0;
+
+ a0 += + W2*col[8*2];
+ a1 += + W6*col[8*2];
+ a2 += - W6*col[8*2];
+ a3 += - W2*col[8*2];
+
+ b0 = MUL16(W1, col[8*1]);
+ b1 = MUL16(W3, col[8*1]);
+ b2 = MUL16(W5, col[8*1]);
+ b3 = MUL16(W7, col[8*1]);
+
+ MAC16(b0, + W3, col[8*3]);
+ MAC16(b1, - W7, col[8*3]);
+ MAC16(b2, - W1, col[8*3]);
+ MAC16(b3, - W5, col[8*3]);
+
+ if(col[8*4]){
+ a0 += + W4*col[8*4];
+ a1 += - W4*col[8*4];
+ a2 += - W4*col[8*4];
+ a3 += + W4*col[8*4];
+ }
- if(col[8*5])
- {
- MAC16(b0, + W5, col[8*5]);
- MAC16(b1, - W1, col[8*5]);
- MAC16(b2, + W7, col[8*5]);
- MAC16(b3, + W3, col[8*5]);
- }
+ if (col[8*5]) {
+ MAC16(b0, + W5, col[8*5]);
+ MAC16(b1, - W1, col[8*5]);
+ MAC16(b2, + W7, col[8*5]);
+ MAC16(b3, + W3, col[8*5]);
+ }
- if(col[8*6])
- {
- a0 += + W6 * col[8*6];
- a1 += - W2 * col[8*6];
- a2 += + W2 * col[8*6];
- a3 += - W6 * col[8*6];
- }
+ if(col[8*6]){
+ a0 += + W6*col[8*6];
+ a1 += - W2*col[8*6];
+ a2 += + W2*col[8*6];
+ a3 += - W6*col[8*6];
+ }
- if(col[8*7])
- {
- MAC16(b0, + W7, col[8*7]);
- MAC16(b1, - W5, col[8*7]);
- MAC16(b2, + W3, col[8*7]);
- MAC16(b3, - W1, col[8*7]);
- }
+ if (col[8*7]) {
+ MAC16(b0, + W7, col[8*7]);
+ MAC16(b1, - W5, col[8*7]);
+ MAC16(b2, + W3, col[8*7]);
+ MAC16(b3, - W1, col[8*7]);
+ }
- dest[0] = cm[(a0 + b0) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a1 + b1) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a2 + b2) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a3 + b3) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a3 - b3) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a2 - b2) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a1 - b1) >> COL_SHIFT];
- dest += line_size;
- dest[0] = cm[(a0 - b0) >> COL_SHIFT];
+ dest[0] = cm[(a0 + b0) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a1 + b1) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a2 + b2) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a3 + b3) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a3 - b3) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a2 - b2) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a1 - b1) >> COL_SHIFT];
+ dest += line_size;
+ dest[0] = cm[(a0 - b0) >> COL_SHIFT];
}
-static inline void idctSparseColAdd(uint8_t *dest, int line_size,
- DCTELEM * col)
+static inline void idctSparseColAdd (uint8_t *dest, int line_size,
+ DCTELEM * col)
{
- int a0, a1, a2, a3, b0, b1, b2, b3;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
- /* XXX: I did that only to give same values as previous code */
- a0 = W4 * (col[8*0] + ((1 << (COL_SHIFT - 1)) / W4));
- a1 = a0;
- a2 = a0;
- a3 = a0;
-
- a0 += + W2 * col[8*2];
- a1 += + W6 * col[8*2];
- a2 += - W6 * col[8*2];
- a3 += - W2 * col[8*2];
-
- b0 = MUL16(W1, col[8*1]);
- b1 = MUL16(W3, col[8*1]);
- b2 = MUL16(W5, col[8*1]);
- b3 = MUL16(W7, col[8*1]);
-
- MAC16(b0, + W3, col[8*3]);
- MAC16(b1, - W7, col[8*3]);
- MAC16(b2, - W1, col[8*3]);
- MAC16(b3, - W5, col[8*3]);
-
- if(col[8*4])
- {
- a0 += + W4 * col[8*4];
- a1 += - W4 * col[8*4];
- a2 += - W4 * col[8*4];
- a3 += + W4 * col[8*4];
- }
+ int a0, a1, a2, a3, b0, b1, b2, b3;
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+
+ /* XXX: I did that only to give same values as previous code */
+ a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
+ a1 = a0;
+ a2 = a0;
+ a3 = a0;
+
+ a0 += + W2*col[8*2];
+ a1 += + W6*col[8*2];
+ a2 += - W6*col[8*2];
+ a3 += - W2*col[8*2];
+
+ b0 = MUL16(W1, col[8*1]);
+ b1 = MUL16(W3, col[8*1]);
+ b2 = MUL16(W5, col[8*1]);
+ b3 = MUL16(W7, col[8*1]);
+
+ MAC16(b0, + W3, col[8*3]);
+ MAC16(b1, - W7, col[8*3]);
+ MAC16(b2, - W1, col[8*3]);
+ MAC16(b3, - W5, col[8*3]);
+
+ if(col[8*4]){
+ a0 += + W4*col[8*4];
+ a1 += - W4*col[8*4];
+ a2 += - W4*col[8*4];
+ a3 += + W4*col[8*4];
+ }
- if(col[8*5])
- {
- MAC16(b0, + W5, col[8*5]);
- MAC16(b1, - W1, col[8*5]);
- MAC16(b2, + W7, col[8*5]);
- MAC16(b3, + W3, col[8*5]);
- }
+ if (col[8*5]) {
+ MAC16(b0, + W5, col[8*5]);
+ MAC16(b1, - W1, col[8*5]);
+ MAC16(b2, + W7, col[8*5]);
+ MAC16(b3, + W3, col[8*5]);
+ }
- if(col[8*6])
- {
- a0 += + W6 * col[8*6];
- a1 += - W2 * col[8*6];
- a2 += + W2 * col[8*6];
- a3 += - W6 * col[8*6];
- }
+ if(col[8*6]){
+ a0 += + W6*col[8*6];
+ a1 += - W2*col[8*6];
+ a2 += + W2*col[8*6];
+ a3 += - W6*col[8*6];
+ }
- if(col[8*7])
- {
- MAC16(b0, + W7, col[8*7]);
- MAC16(b1, - W5, col[8*7]);
- MAC16(b2, + W3, col[8*7]);
- MAC16(b3, - W1, col[8*7]);
- }
+ if (col[8*7]) {
+ MAC16(b0, + W7, col[8*7]);
+ MAC16(b1, - W5, col[8*7]);
+ MAC16(b2, + W3, col[8*7]);
+ MAC16(b3, - W1, col[8*7]);
+ }
- dest[0] = cm[dest[0] + ((a0 + b0) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a1 + b1) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a2 + b2) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a3 + b3) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a3 - b3) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a2 - b2) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a1 - b1) >> COL_SHIFT)];
- dest += line_size;
- dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
+ dest[0] = cm[dest[0] + ((a0 + b0) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a1 + b1) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a2 + b2) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a3 + b3) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a3 - b3) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a2 - b2) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a1 - b1) >> COL_SHIFT)];
+ dest += line_size;
+ dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
}
-static inline void idctSparseCol(DCTELEM * col)
+static inline void idctSparseCol (DCTELEM * col)
{
- int a0, a1, a2, a3, b0, b1, b2, b3;
-
- /* XXX: I did that only to give same values as previous code */
- a0 = W4 * (col[8*0] + ((1 << (COL_SHIFT - 1)) / W4));
- a1 = a0;
- a2 = a0;
- a3 = a0;
-
- a0 += + W2 * col[8*2];
- a1 += + W6 * col[8*2];
- a2 += - W6 * col[8*2];
- a3 += - W2 * col[8*2];
-
- b0 = MUL16(W1, col[8*1]);
- b1 = MUL16(W3, col[8*1]);
- b2 = MUL16(W5, col[8*1]);
- b3 = MUL16(W7, col[8*1]);
-
- MAC16(b0, + W3, col[8*3]);
- MAC16(b1, - W7, col[8*3]);
- MAC16(b2, - W1, col[8*3]);
- MAC16(b3, - W5, col[8*3]);
-
- if(col[8*4])
- {
- a0 += + W4 * col[8*4];
- a1 += - W4 * col[8*4];
- a2 += - W4 * col[8*4];
- a3 += + W4 * col[8*4];
- }
+ int a0, a1, a2, a3, b0, b1, b2, b3;
+
+ /* XXX: I did that only to give same values as previous code */
+ a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
+ a1 = a0;
+ a2 = a0;
+ a3 = a0;
+
+ a0 += + W2*col[8*2];
+ a1 += + W6*col[8*2];
+ a2 += - W6*col[8*2];
+ a3 += - W2*col[8*2];
+
+ b0 = MUL16(W1, col[8*1]);
+ b1 = MUL16(W3, col[8*1]);
+ b2 = MUL16(W5, col[8*1]);
+ b3 = MUL16(W7, col[8*1]);
+
+ MAC16(b0, + W3, col[8*3]);
+ MAC16(b1, - W7, col[8*3]);
+ MAC16(b2, - W1, col[8*3]);
+ MAC16(b3, - W5, col[8*3]);
+
+ if(col[8*4]){
+ a0 += + W4*col[8*4];
+ a1 += - W4*col[8*4];
+ a2 += - W4*col[8*4];
+ a3 += + W4*col[8*4];
+ }
- if(col[8*5])
- {
- MAC16(b0, + W5, col[8*5]);
- MAC16(b1, - W1, col[8*5]);
- MAC16(b2, + W7, col[8*5]);
- MAC16(b3, + W3, col[8*5]);
- }
+ if (col[8*5]) {
+ MAC16(b0, + W5, col[8*5]);
+ MAC16(b1, - W1, col[8*5]);
+ MAC16(b2, + W7, col[8*5]);
+ MAC16(b3, + W3, col[8*5]);
+ }
- if(col[8*6])
- {
- a0 += + W6 * col[8*6];
- a1 += - W2 * col[8*6];
- a2 += + W2 * col[8*6];
- a3 += - W6 * col[8*6];
- }
+ if(col[8*6]){
+ a0 += + W6*col[8*6];
+ a1 += - W2*col[8*6];
+ a2 += + W2*col[8*6];
+ a3 += - W6*col[8*6];
+ }
- if(col[8*7])
- {
- MAC16(b0, + W7, col[8*7]);
- MAC16(b1, - W5, col[8*7]);
- MAC16(b2, + W3, col[8*7]);
- MAC16(b3, - W1, col[8*7]);
- }
+ if (col[8*7]) {
+ MAC16(b0, + W7, col[8*7]);
+ MAC16(b1, - W5, col[8*7]);
+ MAC16(b2, + W3, col[8*7]);
+ MAC16(b3, - W1, col[8*7]);
+ }
- col[0 ] = ((a0 + b0) >> COL_SHIFT);
- col[8 ] = ((a1 + b1) >> COL_SHIFT);
- col[16] = ((a2 + b2) >> COL_SHIFT);
- col[24] = ((a3 + b3) >> COL_SHIFT);
- col[32] = ((a3 - b3) >> COL_SHIFT);
- col[40] = ((a2 - b2) >> COL_SHIFT);
- col[48] = ((a1 - b1) >> COL_SHIFT);
- col[56] = ((a0 - b0) >> COL_SHIFT);
+ col[0 ] = ((a0 + b0) >> COL_SHIFT);
+ col[8 ] = ((a1 + b1) >> COL_SHIFT);
+ col[16] = ((a2 + b2) >> COL_SHIFT);
+ col[24] = ((a3 + b3) >> COL_SHIFT);
+ col[32] = ((a3 - b3) >> COL_SHIFT);
+ col[40] = ((a2 - b2) >> COL_SHIFT);
+ col[48] = ((a1 - b1) >> COL_SHIFT);
+ col[56] = ((a0 - b0) >> COL_SHIFT);
}
void ff_simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
int i;
- for(i = 0; i < 8; i++)
- idctRowCondDC(block + i * 8);
+ for(i=0; i<8; i++)
+ idctRowCondDC(block + i*8);
- for(i = 0; i < 8; i++)
+ for(i=0; i<8; i++)
idctSparseColPut(dest + i, line_size, block + i);
}
void ff_simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
int i;
- for(i = 0; i < 8; i++)
- idctRowCondDC(block + i * 8);
+ for(i=0; i<8; i++)
+ idctRowCondDC(block + i*8);
- for(i = 0; i < 8; i++)
+ for(i=0; i<8; i++)
idctSparseColAdd(dest + i, line_size, block + i);
}
void ff_simple_idct(DCTELEM *block)
{
int i;
- for(i = 0; i < 8; i++)
- idctRowCondDC(block + i * 8);
+ for(i=0; i<8; i++)
+ idctRowCondDC(block + i*8);
- for(i = 0; i < 8; i++)
+ for(i=0; i<8; i++)
idctSparseCol(block + i);
}
@@ -476,8 +453,7 @@ void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block)
/* butterfly */
ptr = block;
- for(i = 0; i < 4; i++)
- {
+ for(i=0;i<4;i++) {
BF(0);
BF(1);
BF(2);
@@ -490,14 +466,12 @@ void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block)
}
/* IDCT8 on each line */
- for(i = 0; i < 8; i++)
- {
- idctRowCondDC(block + i * 8);
+ for(i=0; i<8; i++) {
+ idctRowCondDC(block + i*8);
}
/* IDCT4 and store */
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
idct4col_put(dest + i, 2 * line_size, block + i);
idct4col_put(dest + line_size + i, 2 * line_size, block + 8 + i);
}
@@ -524,8 +498,8 @@ static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col
a1 = col[8*1];
a2 = col[8*2];
a3 = col[8*3];
- c0 = (a0 + a2) * C3 + (1 << (C_SHIFT - 1));
- c2 = (a0 - a2) * C3 + (1 << (C_SHIFT - 1));
+ c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1));
+ c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1));
c1 = a1 * C1 + a3 * C2;
c3 = a1 * C2 - a3 * C1;
dest[0] = cm[dest[0] + ((c0 + c1) >> C_SHIFT)];
@@ -552,14 +526,14 @@ static inline void idct4row(DCTELEM *row)
a1 = row[1];
a2 = row[2];
a3 = row[3];
- c0 = (a0 + a2) * R3 + (1 << (R_SHIFT - 1));
- c2 = (a0 - a2) * R3 + (1 << (R_SHIFT - 1));
+ c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1));
+ c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1));
c1 = a1 * R1 + a3 * R2;
c3 = a1 * R2 - a3 * R1;
- row[0] = (c0 + c1) >> R_SHIFT;
- row[1] = (c2 + c3) >> R_SHIFT;
- row[2] = (c2 - c3) >> R_SHIFT;
- row[3] = (c0 - c1) >> R_SHIFT;
+ row[0]= (c0 + c1) >> R_SHIFT;
+ row[1]= (c2 + c3) >> R_SHIFT;
+ row[2]= (c2 - c3) >> R_SHIFT;
+ row[3]= (c0 - c1) >> R_SHIFT;
}
void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block)
@@ -567,14 +541,12 @@ void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block)
int i;
/* IDCT8 on each line */
- for(i = 0; i < 4; i++)
- {
- idctRowCondDC(block + i * 8);
+ for(i=0; i<4; i++) {
+ idctRowCondDC(block + i*8);
}
/* IDCT4 and store */
- for(i = 0; i < 8; i++)
- {
+ for(i=0;i<8;i++) {
idct4col_add(dest + i, line_size, block + i);
}
}
@@ -584,14 +556,12 @@ void ff_simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block)
int i;
/* IDCT4 on each line */
- for(i = 0; i < 8; i++)
- {
- idct4row(block + i * 8);
+ for(i=0; i<8; i++) {
+ idct4row(block + i*8);
}
/* IDCT8 and store */
- for(i = 0; i < 4; i++)
- {
+ for(i=0; i<4; i++){
idctSparseColAdd(dest + i, line_size, block + i);
}
}
@@ -601,14 +571,12 @@ void ff_simple_idct44_add(uint8_t *dest, int line_size, DCTELEM *block)
int i;
/* IDCT4 on each line */
- for(i = 0; i < 4; i++)
- {
- idct4row(block + i * 8);
+ for(i=0; i<4; i++) {
+ idct4row(block + i*8);
}
/* IDCT4 and store */
- for(i = 0; i < 4; i++)
- {
+ for(i=0; i<4; i++){
idct4col_add(dest + i, line_size, block + i);
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5x.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5x.h
index cede58172..fab31e269 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5x.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5x.h
@@ -74,8 +74,7 @@ static const uint8_t sp5x_data_dqt[] =
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22
};
-static const uint8_t sp5x_data_dht[] =
-{
+static const uint8_t sp5x_data_dht[] = {
0xFF, 0xC4, /* DHT */
0x01, 0xA2, /* len */
0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01,
@@ -133,147 +132,107 @@ static const uint8_t sp5x_data_dht[] =
};
-static const uint8_t sp5x_quant_table[20][64] =
+static const uint8_t sp5x_quant_table[20][64]=
{
/* index 0, Q50 */
- {
- 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
- },
- {
- 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
- },
+ { 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 },
+ { 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 },
/* index 1, Q70 */
- {
- 10, 7, 7, 8, 7, 6, 10, 8, 8, 8, 11, 10, 10, 11, 14, 24,
- 16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31,
- 34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52,
- 57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59
- },
- {
- 10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59
- },
+ { 10, 7, 7, 8, 7, 6, 10, 8, 8, 8, 11, 10, 10, 11, 14, 24,
+ 16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31,
+ 34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52,
+ 57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59 },
+ { 10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
/* index 2, Q80 */
- {
- 6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16,
- 10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20,
- 22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35,
- 38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40
- },
- {
- 7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40
- },
+ { 6, 4, 5, 6, 5, 4, 6, 6, 5, 6, 7, 7, 6, 8, 10, 16,
+ 10, 10, 9, 9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20,
+ 22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35,
+ 38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40 },
+ { 7, 7, 7, 10, 8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
/* index 3, Q85 */
- {
- 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12,
+ { 5, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 5, 5, 6, 7, 12,
8, 7, 7, 7, 7, 15, 11, 11, 9, 12, 17, 15, 18, 18, 17, 15,
- 17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26,
- 29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30
- },
- {
- 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
- },
+ 17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26,
+ 29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30 },
+ { 5, 5, 5, 7, 6, 7, 14, 8, 8, 14, 30, 20, 17, 20, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
/* index 4, Q90 */
- {
- 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 4, 3, 3, 4, 5, 8,
+ { 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 4, 3, 3, 4, 5, 8,
5, 5, 4, 4, 5, 10, 7, 7, 6, 8, 12, 10, 12, 12, 11, 10,
- 11, 11, 13, 14, 18, 16, 13, 14, 17, 14, 11, 11, 16, 22, 16, 17,
- 19, 20, 21, 21, 21, 12, 15, 23, 24, 22, 20, 24, 18, 20, 21, 20
- },
- {
- 3, 4, 4, 5, 4, 5, 9, 5, 5, 9, 20, 13, 11, 13, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
- },
+ 11, 11, 13, 14, 18, 16, 13, 14, 17, 14, 11, 11, 16, 22, 16, 17,
+ 19, 20, 21, 21, 21, 12, 15, 23, 24, 22, 20, 24, 18, 20, 21, 20 },
+ { 3, 4, 4, 5, 4, 5, 9, 5, 5, 9, 20, 13, 11, 13, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
/* index 5, Q60 */
- {
- 13, 9, 10, 11, 10, 8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32,
- 21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41,
- 45, 44, 51, 58, 74, 62, 51, 54, 70, 55, 44, 45, 64, 87, 65, 70,
- 76, 78, 82, 83, 82, 50, 62, 90, 97, 90, 80, 96, 74, 81, 82, 79
- },
- {
- 14, 14, 14, 19, 17, 19, 38, 21, 21, 38, 79, 53, 45, 53, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79
- },
+ { 13, 9, 10, 11, 10, 8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32,
+ 21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41,
+ 45, 44, 51, 58, 74, 62, 51, 54, 70, 55, 44, 45, 64, 87, 65, 70,
+ 76, 78, 82, 83, 82, 50, 62, 90, 97, 90, 80, 96, 74, 81, 82, 79 },
+ { 14, 14, 14, 19, 17, 19, 38, 21, 21, 38, 79, 53, 45, 53, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
/* index 6, Q25 */
- {
- 32, 22, 24, 28, 24, 20, 32, 28, 26, 28, 36, 34, 32, 38, 48, 80,
- 52, 48, 44, 44, 48, 98, 70, 74, 58, 80, 116, 102, 122, 120, 114, 102,
- 112, 110, 128, 144, 184, 156, 128, 136, 174, 138, 110, 112, 160, 218, 162, 174,
- 190, 196, 206, 208, 206, 124, 154, 226, 242, 224, 200, 240, 184, 202, 206, 198
- },
- {
- 34, 36, 36, 48, 42, 48, 94, 52, 52, 94, 198, 132, 112, 132, 198, 198,
- 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
- 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
- 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198
- },
+ { 32, 22, 24, 28, 24, 20, 32, 28, 26, 28, 36, 34, 32, 38, 48, 80,
+ 52, 48, 44, 44, 48, 98, 70, 74, 58, 80,116,102,122,120,114,102,
+ 112,110,128,144,184,156,128,136,174,138,110,112,160,218,162,174,
+ 190,196,206,208,206,124,154,226,242,224,200,240,184,202,206,198 },
+ { 34, 36, 36, 48, 42, 48, 94, 52, 52, 94,198,132,112,132,198,198,
+ 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
+ 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
+ 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
/* index 7, Q95 */
- {
- 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 4,
+ { 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 4,
3, 2, 2, 2, 2, 5, 4, 4, 3, 4, 6, 5, 6, 6, 6, 5,
6, 6, 6, 7, 9, 8, 6, 7, 9, 7, 6, 6, 8, 11, 8, 9,
- 10, 10, 10, 10, 10, 6, 8, 11, 12, 11, 10, 12, 9, 10, 10, 10
- },
- {
- 2, 2, 2, 2, 2, 2, 5, 3, 3, 5, 10, 7, 6, 7, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
- },
+ 10, 10, 10, 10, 10, 6, 8, 11, 12, 11, 10, 12, 9, 10, 10, 10 },
+ { 2, 2, 2, 2, 2, 2, 5, 3, 3, 5, 10, 7, 6, 7, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
/* index 8, Q93 */
- {
- 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 3, 3, 6,
+ { 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 3, 3, 6,
4, 3, 3, 3, 3, 7, 5, 5, 4, 6, 8, 7, 9, 8, 8, 7,
8, 8, 9, 10, 13, 11, 9, 10, 12, 10, 8, 8, 11, 15, 11, 12,
- 13, 14, 14, 15, 14, 9, 11, 16, 17, 16, 14, 17, 13, 14, 14, 14
- },
- {
- 2, 3, 3, 3, 3, 3, 7, 4, 4, 7, 14, 9, 8, 9, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
- },
+ 13, 14, 14, 15, 14, 9, 11, 16, 17, 16, 14, 17, 13, 14, 14, 14 },
+ { 2, 3, 3, 3, 3, 3, 7, 4, 4, 7, 14, 9, 8, 9, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 },
/* index 9, Q40 */
- {
- 20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50,
- 33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64,
- 70, 69, 80, 90, 115, 98, 80, 85, 109, 86, 69, 70, 100, 136, 101, 109,
- 119, 123, 129, 130, 129, 78, 96, 141, 151, 140, 125, 150, 115, 126, 129, 124
- },
- {
- 21, 23, 23, 30, 26, 30, 59, 33, 33, 59, 124, 83, 70, 83, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124
- }
+ { 20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50,
+ 33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64,
+ 70, 69, 80, 90,115, 98, 80, 85,109, 86, 69, 70,100,136,101,109,
+ 119,123,129,130,129, 78, 96,141,151,140,125,150,115,126,129,124 },
+ { 21, 23, 23, 30, 26, 30, 59, 33, 33, 59,124, 83, 70, 83,124,124,
+ 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
+ 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
+ 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 }
};
#if 0
@@ -281,130 +240,94 @@ static const uint8_t sp5x_quant_table[20][64] =
static const uint8_t sp5x_quant_table_orig[18][64] =
{
/* index 0, Q50 */
- {
- 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
- },
- {
- 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
- },
+ { 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 },
+ { 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 },
/* index 1, Q70 */
- {
- 10, 7, 6, 10, 14, 24, 31, 37, 7, 7, 8, 11, 16, 35, 36, 33,
+ { 10, 7, 6, 10, 14, 24, 31, 37, 7, 7, 8, 11, 16, 35, 36, 33,
8, 8, 10, 14, 24, 34, 41, 34, 8, 10, 13, 17, 31, 52, 48, 37,
- 11, 13, 22, 34, 41, 65, 62, 46, 14, 21, 33, 38, 49, 62, 68, 55,
- 29, 38, 47, 52, 62, 73, 72, 61, 43, 55, 57, 59, 67, 60, 62, 59
- },
- {
- 10, 11, 14, 28, 59, 59, 59, 59, 11, 13, 16, 40, 59, 59, 59, 59,
- 14, 16, 34, 59, 59, 59, 59, 59, 28, 40, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59
- },
+ 11, 13, 22, 34, 41, 65, 62, 46, 14, 21, 33, 38, 49, 62, 68, 55,
+ 29, 38, 47, 52, 62, 73, 72, 61, 43, 55, 57, 59, 67, 60, 62, 59 },
+ { 10, 11, 14, 28, 59, 59, 59, 59, 11, 13, 16, 40, 59, 59, 59, 59,
+ 14, 16, 34, 59, 59, 59, 59, 59, 28, 40, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
/* index 2, Q80 */
- {
- 6, 4, 4, 6, 10, 16, 20, 24, 5, 5, 6, 8, 10, 23, 24, 22,
+ { 6, 4, 4, 6, 10, 16, 20, 24, 5, 5, 6, 8, 10, 23, 24, 22,
6, 5, 6, 10, 16, 23, 28, 22, 6, 7, 9, 12, 20, 35, 32, 25,
7, 9, 15, 22, 27, 44, 41, 31, 10, 14, 22, 26, 32, 42, 45, 37,
- 20, 26, 31, 35, 41, 48, 48, 40, 29, 37, 38, 39, 45, 40, 41, 40
- },
- {
- 7, 7, 10, 19, 40, 40, 40, 40, 7, 8, 10, 26, 40, 40, 40, 40,
- 10, 10, 22, 40, 40, 40, 40, 40, 19, 26, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40
- },
+ 20, 26, 31, 35, 41, 48, 48, 40, 29, 37, 38, 39, 45, 40, 41, 40 },
+ { 7, 7, 10, 19, 40, 40, 40, 40, 7, 8, 10, 26, 40, 40, 40, 40,
+ 10, 10, 22, 40, 40, 40, 40, 40, 19, 26, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
/* index 3, Q85 */
- {
- 5, 3, 3, 5, 7, 12, 15, 18, 4, 4, 4, 6, 8, 17, 18, 17,
+ { 5, 3, 3, 5, 7, 12, 15, 18, 4, 4, 4, 6, 8, 17, 18, 17,
4, 4, 5, 7, 12, 17, 21, 17, 4, 5, 7, 9, 15, 26, 24, 19,
5, 7, 11, 17, 20, 33, 31, 23, 7, 11, 17, 19, 24, 31, 34, 28,
- 15, 19, 23, 26, 31, 36, 36, 30, 22, 28, 29, 29, 34, 30, 31, 30
- },
- {
- 5, 5, 7, 14, 30, 30, 30, 30, 5, 6, 8, 20, 30, 30, 30, 30,
+ 15, 19, 23, 26, 31, 36, 36, 30, 22, 28, 29, 29, 34, 30, 31, 30 },
+ { 5, 5, 7, 14, 30, 30, 30, 30, 5, 6, 8, 20, 30, 30, 30, 30,
7, 8, 17, 30, 30, 30, 30, 30, 14, 20, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
- },
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
/* index 4, Q90 */
- {
- 3, 2, 2, 3, 5, 8, 10, 12, 2, 2, 3, 4, 5, 12, 12, 11,
+ { 3, 2, 2, 3, 5, 8, 10, 12, 2, 2, 3, 4, 5, 12, 12, 11,
3, 3, 3, 5, 8, 11, 14, 11, 3, 3, 4, 6, 10, 17, 16, 12,
4, 4, 7, 11, 14, 22, 21, 15, 5, 7, 11, 13, 16, 21, 23, 18,
- 10, 13, 16, 17, 21, 24, 24, 20, 14, 18, 19, 20, 22, 20, 21, 20
- },
- {
- 3, 4, 5, 9, 20, 20, 20, 20, 4, 4, 5, 13, 20, 20, 20, 20,
+ 10, 13, 16, 17, 21, 24, 24, 20, 14, 18, 19, 20, 22, 20, 21, 20 },
+ { 3, 4, 5, 9, 20, 20, 20, 20, 4, 4, 5, 13, 20, 20, 20, 20,
5, 5, 11, 20, 20, 20, 20, 20, 9, 13, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
- },
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
/* index 5, Q60 */
- {
- 13, 9, 8, 13, 19, 32, 41, 49, 10, 10, 11, 15, 21, 46, 48, 44,
- 11, 10, 13, 19, 32, 46, 55, 45, 11, 14, 18, 23, 41, 70, 64, 50,
- 14, 18, 30, 45, 54, 87, 82, 62, 19, 28, 44, 51, 65, 83, 90, 74,
- 39, 51, 62, 70, 82, 97, 96, 81, 58, 74, 76, 78, 90, 80, 82, 79
- },
- {
- 14, 14, 19, 38, 79, 79, 79, 79, 14, 17, 21, 53, 79, 79, 79, 79,
- 19, 21, 45, 79, 79, 79, 79, 79, 38, 53, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79
- },
+ { 13, 9, 8, 13, 19, 32, 41, 49, 10, 10, 11, 15, 21, 46, 48, 44,
+ 11, 10, 13, 19, 32, 46, 55, 45, 11, 14, 18, 23, 41, 70, 64, 50,
+ 14, 18, 30, 45, 54, 87, 82, 62, 19, 28, 44, 51, 65, 83, 90, 74,
+ 39, 51, 62, 70, 82, 97, 96, 81, 58, 74, 76, 78, 90, 80, 82, 79 },
+ { 14, 14, 19, 38, 79, 79, 79, 79, 14, 17, 21, 53, 79, 79, 79, 79,
+ 19, 21, 45, 79, 79, 79, 79, 79, 38, 53, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
/* index 6, Q25 */
- {
- 32, 22, 20, 32, 48, 80, 102, 122, 24, 24, 28, 38, 52, 116, 120, 110,
- 28, 26, 32, 48, 80, 114, 138, 112, 28, 34, 44, 58, 102, 174, 160, 124,
- 36, 44, 74, 112, 136, 218, 206, 154, 48, 70, 110, 128, 162, 208, 226, 184,
- 98, 128, 156, 174, 206, 242, 240, 202, 144, 184, 190, 196, 224, 200, 206, 198
- },
- {
- 34, 36, 48, 94, 198, 198, 198, 198, 36, 42, 52, 132, 198, 198, 198, 198,
- 48, 52, 112, 198, 198, 198, 198, 198, 94, 132, 198, 198, 198, 198, 198, 198,
- 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
- 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198
- },
+ { 32, 22, 20, 32, 48, 80,102,122, 24, 24, 28, 38, 52,116,120,110,
+ 28, 26, 32, 48, 80,114,138,112, 28, 34, 44, 58,102,174,160,124,
+ 36, 44, 74,112,136,218,206,154, 48, 70,110,128,162,208,226,184,
+ 98,128,156,174,206,242,240,202,144,184,190,196,224,200,206,198 },
+ { 34, 36, 48, 94,198,198,198,198, 36, 42, 52,132,198,198,198,198,
+ 48, 52,112,198,198,198,198,198, 94,132,198,198,198,198,198,198,
+ 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
+ 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
/* index 7, Q95 */
- {
- 2, 1, 1, 2, 2, 4, 5, 6, 1, 1, 1, 2, 3, 6, 6, 6,
+ { 2, 1, 1, 2, 2, 4, 5, 6, 1, 1, 1, 2, 3, 6, 6, 6,
1, 1, 2, 2, 4, 6, 7, 6, 1, 2, 2, 3, 5, 9, 8, 6,
2, 2, 4, 6, 7, 11, 10, 8, 2, 4, 6, 6, 8, 10, 11, 9,
- 5, 6, 8, 9, 10, 12, 12, 10, 7, 9, 10, 10, 11, 10, 10, 10
- },
- {
- 2, 2, 2, 5, 10, 10, 10, 10, 2, 2, 3, 7, 10, 10, 10, 10,
+ 5, 6, 8, 9, 10, 12, 12, 10, 7, 9, 10, 10, 11, 10, 10, 10 },
+ { 2, 2, 2, 5, 10, 10, 10, 10, 2, 2, 3, 7, 10, 10, 10, 10,
2, 3, 6, 10, 10, 10, 10, 10, 5, 7, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
- },
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
/* index 8, Q93 */
- {
- 2, 2, 1, 2, 3, 6, 7, 9, 2, 2, 2, 3, 4, 8, 8, 8,
+ { 2, 2, 1, 2, 3, 6, 7, 9, 2, 2, 2, 3, 4, 8, 8, 8,
2, 2, 2, 3, 6, 8, 10, 8, 2, 2, 3, 4, 7, 12, 11, 9,
3, 3, 5, 8, 10, 15, 14, 11, 3, 5, 8, 9, 11, 15, 16, 13,
- 7, 9, 11, 12, 14, 17, 17, 14, 10, 13, 13, 14, 16, 14, 14, 14
- },
- {
- 2, 3, 3, 7, 14, 14, 14, 14, 3, 3, 4, 9, 14, 14, 14, 14,
+ 7, 9, 11, 12, 14, 17, 17, 14, 10, 13, 13, 14, 16, 14, 14, 14 },
+ { 2, 3, 3, 7, 14, 14, 14, 14, 3, 3, 4, 9, 14, 14, 14, 14,
3, 4, 8, 14, 14, 14, 14, 14, 7, 9, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
- }
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }
};
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5xdec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5xdec.c
index 5e59032ac..4d7c9f765 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5xdec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/sp5xdec.c
@@ -31,8 +31,8 @@
static int sp5x_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
#if 0
MJpegDecodeContext *s = avctx->priv_data;
@@ -42,46 +42,46 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
uint8_t *recoded;
int i = 0, j = 0;
- if(!avctx->width || !avctx->height)
+ if (!avctx->width || !avctx->height)
return -1;
buf_ptr = buf;
#if 1
recoded = av_mallocz(buf_size + 1024);
- if(!recoded)
+ if (!recoded)
return -1;
/* SOI */
recoded[j++] = 0xFF;
recoded[j++] = 0xD8;
- memcpy(recoded + j, &sp5x_data_dqt[0], sizeof(sp5x_data_dqt));
- memcpy(recoded + j + 5, &sp5x_quant_table[qscale * 2], 64);
- memcpy(recoded + j + 70, &sp5x_quant_table[(qscale * 2) + 1], 64);
+ memcpy(recoded+j, &sp5x_data_dqt[0], sizeof(sp5x_data_dqt));
+ memcpy(recoded+j+5, &sp5x_quant_table[qscale * 2], 64);
+ memcpy(recoded+j+70, &sp5x_quant_table[(qscale * 2) + 1], 64);
j += sizeof(sp5x_data_dqt);
- memcpy(recoded + j, &sp5x_data_dht[0], sizeof(sp5x_data_dht));
+ memcpy(recoded+j, &sp5x_data_dht[0], sizeof(sp5x_data_dht));
j += sizeof(sp5x_data_dht);
- memcpy(recoded + j, &sp5x_data_sof[0], sizeof(sp5x_data_sof));
- AV_WB16(recoded + j + 5, avctx->coded_height);
- AV_WB16(recoded + j + 7, avctx->coded_width);
+ memcpy(recoded+j, &sp5x_data_sof[0], sizeof(sp5x_data_sof));
+ AV_WB16(recoded+j+5, avctx->coded_height);
+ AV_WB16(recoded+j+7, avctx->coded_width);
j += sizeof(sp5x_data_sof);
- memcpy(recoded + j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
+ memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
j += sizeof(sp5x_data_sos);
- if(avctx->codec_id == CODEC_ID_AMV)
- for(i = 2; i < buf_size - 2 && j < buf_size + 1024 - 2; i++)
+ if(avctx->codec_id==CODEC_ID_AMV)
+ for (i = 2; i < buf_size-2 && j < buf_size+1024-2; i++)
recoded[j++] = buf[i];
else
- for(i = 14; i < buf_size && j < buf_size + 1024 - 2; i++)
- {
- recoded[j++] = buf[i];
- if(buf[i] == 0xff)
- recoded[j++] = 0;
- }
+ for (i = 14; i < buf_size && j < buf_size+1024-2; i++)
+ {
+ recoded[j++] = buf[i];
+ if (buf[i] == 0xff)
+ recoded[j++] = 0;
+ }
/* EOI */
recoded[j++] = 0xFF;
@@ -113,12 +113,12 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s->h_max = 2;
s->v_max = 2;
- s->qscale_table = av_mallocz((s->width + 15) / 16);
+ s->qscale_table = av_mallocz((s->width+15)/16);
avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420;
s->interlaced = 0;
s->picture.reference = 0;
- if(avctx->get_buffer(avctx, &s->picture) < 0)
+ if (avctx->get_buffer(avctx, &s->picture) < 0)
{
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
@@ -127,27 +127,27 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s->picture.pict_type = FF_I_TYPE;
s->picture.key_frame = 1;
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
s->linesize[i] = s->picture.linesize[i] << s->interlaced;
/* DQT */
- for(i = 0; i < 64; i++)
+ for (i = 0; i < 64; i++)
{
j = s->scantable.permutated[i];
s->quant_matrixes[0][j] = sp5x_quant_table[(qscale * 2) + i];
}
s->qscale[0] = FFMAX(
- s->quant_matrixes[0][s->scantable.permutated[1]],
- s->quant_matrixes[0][s->scantable.permutated[8]]) >> 1;
+ s->quant_matrixes[0][s->scantable.permutated[1]],
+ s->quant_matrixes[0][s->scantable.permutated[8]]) >> 1;
- for(i = 0; i < 64; i++)
+ for (i = 0; i < 64; i++)
{
j = s->scantable.permutated[i];
s->quant_matrixes[1][j] = sp5x_quant_table[(qscale * 2) + 1 + i];
}
s->qscale[1] = FFMAX(
- s->quant_matrixes[1][s->scantable.permutated[1]],
- s->quant_matrixes[1][s->scantable.permutated[8]]) >> 1;
+ s->quant_matrixes[1][s->scantable.permutated[1]],
+ s->quant_matrixes[1][s->scantable.permutated[8]]) >> 1;
/* DHT */
@@ -173,13 +173,13 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s->dc_index[2] = 1;
s->ac_index[2] = 1;
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
s->last_dc[i] = 1024;
- s->mb_width = (s->width * s->h_max * 8 - 1) / (s->h_max * 8);
- s->mb_height = (s->height * s->v_max * 8 - 1) / (s->v_max * 8);
+ s->mb_width = (s->width * s->h_max * 8 -1) / (s->h_max * 8);
+ s->mb_height = (s->height * s->v_max * 8 -1) / (s->v_max * 8);
- init_get_bits(&s->gb, buf + 14, (buf_size - 14) * 8);
+ init_get_bits(&s->gb, buf+14, (buf_size-14)*8);
return mjpeg_decode_scan(s);
#endif
@@ -187,8 +187,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
return i;
}
-AVCodec sp5x_decoder =
-{
+AVCodec sp5x_decoder = {
"sp5x",
CODEC_TYPE_VIDEO,
CODEC_ID_SP5X,
@@ -205,8 +204,7 @@ AVCodec sp5x_decoder =
/*.long_name = */NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
};
-AVCodec amv_decoder =
-{
+AVCodec amv_decoder = {
"amv",
CODEC_TYPE_VIDEO,
CODEC_ID_AMV,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.c
index ebe20eee7..a1583fef8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.c
@@ -38,8 +38,7 @@
#include "svq1_vlc.h"
/* 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 }
+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 }
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.h
index 55a9e577f..e89d1c384 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1.h
@@ -40,14 +40,13 @@
#define SVQ1_BLOCK_INTER_4V 2
#define SVQ1_BLOCK_INTRA 3
-struct svq1_frame_size
-{
+struct svq1_frame_size {
uint16_t width;
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];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_cb.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_cb.h
index 327c23cdb..504066961 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_cb.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_cb.h
@@ -37,366 +37,362 @@
#include "libavutil/mem.h"
/* 6x16-entry codebook for inter-coded 4x2 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x2)[768] =
-{
+DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x2)[768] = {
7, 2, -6, -7, 7, 3, -3, -4, -7, -2, 7, 8, -8, -4, 3, 4,
- 19, 17, 9, 3, -14, -16, -12, -8, -18, -16, -8, -3, 11, 14, 12, 8,
- 7, -16, -10, 20, 7, -17, -10, 20, -6, 18, 8, -21, -7, 18, 9, -20,
- 25, 3, -20, -14, 29, 7, -18, -13, -29, -4, 21, 14, -31, -6, 20, 14,
- -19, -26, -28, -24, 31, 32, 22, 10, 15, 24, 31, 28, -32, -32, -22, -13,
- 2, -8, -23, -26, -9, 3, 27, 35, 3, 11, 21, 21, 8, -4, -27, -34,
- -30, -31, 12, 47, -29, -30, 13, 47, 38, 30, -17, -46, 34, 26, -19, -46,
- -42, -50, -51, -43, 34, 48, 55, 48, 48, 54, 51, 42, -44, -52, -53, -47,
- 4, 5, 0, -6, -2, -2, 0, 1, -11, -6, -1, -2, 1, 8, 9, 1,
- 0, 1, -6, 5, 8, 1, -12, 2, 7, -14, -7, 8, 5, -8, 0, 8,
- 1, 4, 11, 8, -12, -8, 0, -5, -1, 1, 0, 4, -15, -8, 3, 16,
- 17, 8, -4, -6, 9, -4, -13, -8, 2, 6, 1, -18, -1, 11, 11, -12,
- 6, 0, 2, 0, 14, 6, -7, -21, 1, -1, -13, -20, 1, 1, 10, 21,
- -22, -5, 7, 13, -11, -1, 4, 12, -7, 0, 14, 19, -4, 3, -5, -19,
- -26, -14, 10, 15, 18, 4, -6, -2, 25, 19, -5, -18, -20, -7, 4, 2,
- -13, -6, -1, -4, 25, 37, -2, -35, 5, 4, 1, 1, -21, -36, 2, 43,
+ 19, 17, 9, 3,-14,-16,-12, -8,-18,-16, -8, -3, 11, 14, 12, 8,
+ 7,-16,-10, 20, 7,-17,-10, 20, -6, 18, 8,-21, -7, 18, 9,-20,
+ 25, 3,-20,-14, 29, 7,-18,-13,-29, -4, 21, 14,-31, -6, 20, 14,
+ -19,-26,-28,-24, 31, 32, 22, 10, 15, 24, 31, 28,-32,-32,-22,-13,
+ 2, -8,-23,-26, -9, 3, 27, 35, 3, 11, 21, 21, 8, -4,-27,-34,
+ -30,-31, 12, 47,-29,-30, 13, 47, 38, 30,-17,-46, 34, 26,-19,-46,
+ -42,-50,-51,-43, 34, 48, 55, 48, 48, 54, 51, 42,-44,-52,-53,-47,
+ 4, 5, 0, -6, -2, -2, 0, 1,-11, -6, -1, -2, 1, 8, 9, 1,
+ 0, 1, -6, 5, 8, 1,-12, 2, 7,-14, -7, 8, 5, -8, 0, 8,
+ 1, 4, 11, 8,-12, -8, 0, -5, -1, 1, 0, 4,-15, -8, 3, 16,
+ 17, 8, -4, -6, 9, -4,-13, -8, 2, 6, 1,-18, -1, 11, 11,-12,
+ 6, 0, 2, 0, 14, 6, -7,-21, 1, -1,-13,-20, 1, 1, 10, 21,
+ -22, -5, 7, 13,-11, -1, 4, 12, -7, 0, 14, 19, -4, 3, -5,-19,
+ -26,-14, 10, 15, 18, 4, -6, -2, 25, 19, -5,-18,-20, -7, 4, 2,
+ -13, -6, -1, -4, 25, 37, -2,-35, 5, 4, 1, 1,-21,-36, 2, 43,
2, -2, -1, 3, 8, -2, -6, -1, -2, -3, 2, 12, -5, -2, -2, -1,
- -3, -1, -1, -5, -1, 7, 8, -2, 2, 7, 5, -3, 1, 1, -3, -8,
- -3, -1, -3, -2, -2, -3, 2, 13, 15, 0, -11, -6, 3, 0, 0, 0,
- -6, -9, -5, -4, 18, 4, 1, 3, 12, 3, 0, 4, -16, -3, 3, -3,
- -17, 3, 18, 2, -1, -3, -1, -1, -6, 16, -8, 0, -9, 14, -7, 0,
- 3, -13, 14, -5, 3, -13, 14, -4, -7, 20, 14, -23, 8, -7, -8, 4,
- 8, -15, -19, 16, -10, 13, 11, -3, 9, -1, 1, 26, 5, -15, -27, 2,
- -20, 7, 16, -4, -40, 9, 31, 1, 26, -12, -30, -7, 40, -2, -19, 4,
+ -3, -1, -1, -5, -1, 7, 8, -2, 2, 7, 5, -3, 1, 1, -3, -8,
+ -3, -1, -3, -2, -2, -3, 2, 13, 15, 0,-11, -6, 3, 0, 0, 0,
+ -6, -9, -5, -4, 18, 4, 1, 3, 12, 3, 0, 4,-16, -3, 3, -3,
+ -17, 3, 18, 2, -1, -3, -1, -1, -6, 16, -8, 0, -9, 14, -7, 0,
+ 3,-13, 14, -5, 3,-13, 14, -4, -7, 20, 14,-23, 8, -7, -8, 4,
+ 8,-15,-19, 16,-10, 13, 11, -3, 9, -1, 1, 26, 5,-15,-27, 2,
+ -20, 7, 16, -4,-40, 9, 31, 1, 26,-12,-30, -7, 40, -2,-19, 4,
6, 0, 0, 0, -6, -2, 1, 2, 0, -1, 0, -6, 9, 0, -2, -1,
- -7, 8, 2, -3, -1, 2, -3, 2, 7, -4, -2, 4, 2, 0, 0, -6,
- -3, -2, 9, 2, -2, -1, 0, -4, -3, -3, 0, -3, -6, 2, 10, 4,
- 3, 0, -10, 8, 0, 0, -4, 4, -1, 1, 4, 2, 3, -7, -9, 7,
- 2, 1, -9, -4, -1, 12, 0, 0, 3, -1, 7, -4, 3, -14, 4, 2,
- -12, -9, 1, 11, 2, 5, 1, 0, 3, 1, 0, 2, 0, 8, 6, -19,
- -6, -10, -7, -4, 9, 7, 5, 7, 6, 21, 3, -3, -11, -9, -5, -2,
- -4, -9, -16, -1, -2, -5, 1, 36, 8, 11, 19, 0, 2, 5, -4, -41,
- -1, -1, -2, -1, -2, -2, 1, 6, 0, 4, 1, -8, 1, 1, 1, 0,
- -2, -3, 4, 0, 2, -1, 3, -3, 1, 3, -4, 1, -1, 3, 0, -5,
+ -7, 8, 2, -3, -1, 2, -3, 2, 7, -4, -2, 4, 2, 0, 0, -6,
+ -3, -2, 9, 2, -2, -1, 0, -4, -3, -3, 0, -3, -6, 2, 10, 4,
+ 3, 0,-10, 8, 0, 0, -4, 4, -1, 1, 4, 2, 3, -7, -9, 7,
+ 2, 1, -9, -4, -1, 12, 0, 0, 3, -1, 7, -4, 3,-14, 4, 2,
+ -12, -9, 1, 11, 2, 5, 1, 0, 3, 1, 0, 2, 0, 8, 6,-19,
+ -6,-10, -7, -4, 9, 7, 5, 7, 6, 21, 3, -3,-11, -9, -5, -2,
+ -4, -9,-16, -1, -2, -5, 1, 36, 8, 11, 19, 0, 2, 5, -4,-41,
+ -1, -1, -2, -1, -2, -2, 1, 6, 0, 4, 1, -8, 1, 1, 1, 0,
+ -2, -3, 4, 0, 2, -1, 3, -3, 1, 3, -4, 1, -1, 3, 0, -5,
3, 4, 2, 3, -2, -3, -6, -1, -2, -3, -2, 2, -4, 8, 1, 0,
- -7, 4, 2, 6, -7, -1, 1, 0, -2, 2, -4, 1, 8, -6, 2, -1,
- -6, 2, 0, 2, 5, 4, -8, -1, -1, -11, 0, 9, 0, -2, 2, 2,
- 17, -5, -4, -1, -1, -4, -2, -2, 0, -13, 9, -3, -1, 12, -7, 2,
- 0, -2, -5, 2, -7, -5, 20, -3, 7, 7, -1, -30, 3, 5, 8, 1,
- -6, 3, -1, -4, 2, -2, -11, 18, 0, -7, 3, 14, 20, -3, -18, -9,
+ -7, 4, 2, 6, -7, -1, 1, 0, -2, 2, -4, 1, 8, -6, 2, -1,
+ -6, 2, 0, 2, 5, 4, -8, -1, -1,-11, 0, 9, 0, -2, 2, 2,
+ 17, -5, -4, -1, -1, -4, -2, -2, 0,-13, 9, -3, -1, 12, -7, 2,
+ 0, -2, -5, 2, -7, -5, 20, -3, 7, 7, -1,-30, 3, 5, 8, 1,
+ -6, 3, -1, -4, 2, -2,-11, 18, 0, -7, 3, 14, 20, -3,-18, -9,
7, -2, 0, -1, -2, 0, 0, -1, -4, -1, 1, 0, -2, 2, 0, 4,
1, -3, 2, 1, 3, 1, -5, 1, -3, 0, -1, -2, 7, 1, 0, -3,
2, 5, 0, -2, 2, -5, -1, 1, -1, -2, 4, -1, 0, -3, 5, 0,
0, 3, -1, -2, -4, 1, 5, -1, -1, 0, -1, 9, -1, -2, -1, -1,
- -2, 5, 5, -1, -2, 2, -3, -2, 1, 2, -11, 1, 2, 1, 3, 2,
- 2, -10, -1, -2, 4, 2, 4, 1, 4, 5, -5, 1, 0, 6, -11, 1,
- 1, 0, 6, 6, 0, 2, 1, -15, 7, 3, 5, 9, -30, 2, 2, 2,
- -34, 1, 9, 2, 5, 8, 8, 2, 7, 2, 6, 6, 2, -27, 1, 4
+ -2, 5, 5, -1, -2, 2, -3, -2, 1, 2,-11, 1, 2, 1, 3, 2,
+ 2,-10, -1, -2, 4, 2, 4, 1, 4, 5, -5, 1, 0, 6,-11, 1,
+ 1, 0, 6, 6, 0, 2, 1,-15, 7, 3, 5, 9,-30, 2, 2, 2,
+ -34, 1, 9, 2, 5, 8, 8, 2, 7, 2, 6, 6, 2,-27, 1, 4
};
/* 6x16-entry codebook for inter-coded 4x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x4)[1536] =
-{
- 4, 0, -6, -7, -4, -8, -13, -9, -8, -8, -1, 6, -2, 5, 22, 27,
- -16, -7, 11, 10, -18, -7, 13, 10, -15, -4, 12, 8, -9, -1, 9, 5,
- -2, 2, 15, -16, -3, 2, 19, -19, -3, 2, 19, -19, -2, 3, 15, -14,
- 17, 22, 22, 16, -6, -7, -5, -2, -12, -16, -16, -12, 1, 1, -1, -3,
- 11, -17, 0, 8, 14, -21, -1, 9, 14, -21, -2, 8, 11, -16, -2, 6,
- 7, -2, -16, 11, 9, -2, -21, 14, 10, -1, -22, 14, 8, -1, -18, 10,
- -10, 16, 3, -9, -13, 20, 4, -11, -14, 21, 4, -10, -11, 16, 3, -8,
- 11, 4, -9, -9, 15, 6, -12, -14, 17, 8, -12, -14, 16, 10, -7, -11,
- 4, 10, 14, 13, -1, 7, 15, 16, -12, -7, 3, 8, -20, -23, -18, -10,
- -10, -18, -26, -25, 4, 1, -6, -11, 13, 15, 11, 3, 12, 15, 13, 8,
- -16, -19, -16, -11, 7, 12, 15, 11, 11, 16, 16, 11, -6, -9, -11, -10,
- 18, 19, 12, 5, 18, 16, 5, -4, 6, 0, -10, -15, -9, -17, -23, -22,
- -10, -14, -1, 21, -11, -17, 0, 29, -11, -16, 1, 30, -10, -14, 0, 23,
- -16, -17, -12, -6, -19, -19, -14, -7, -3, -1, 1, 2, 27, 35, 29, 19,
- -37, -8, 23, 23, -42, -9, 28, 29, -43, -10, 26, 28, -38, -11, 19, 22,
- 32, 16, -16, -33, 39, 20, -18, -37, 38, 19, -19, -38, 32, 15, -17, -34,
- 24, 9, -6, -4, -1, -10, -6, 3, -8, -9, -1, 3, 3, 7, 2, -6,
- -1, -3, -1, 0, -1, 4, 2, -7, -3, 11, 3, -16, 1, 20, 9, -18,
- -3, -8, 6, 12, -5, -10, 7, 13, -6, -9, 5, 7, -5, -5, 2, -1,
- -8, 12, -3, -1, -10, 15, -3, 1, -11, 13, -4, 1, -11, 8, -3, 2,
- 9, 6, -5, -12, 3, 0, -8, -13, -4, -4, -1, -1, -4, 1, 15, 18,
- 9, 13, 14, 12, 4, 3, -1, -2, -2, -5, -8, -5, -7, -11, -9, -4,
+DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x4)[1536] = {
+ 4, 0, -6, -7, -4, -8,-13, -9, -8, -8, -1, 6, -2, 5, 22, 27,
+ -16, -7, 11, 10,-18, -7, 13, 10,-15, -4, 12, 8, -9, -1, 9, 5,
+ -2, 2, 15,-16, -3, 2, 19,-19, -3, 2, 19,-19, -2, 3, 15,-14,
+ 17, 22, 22, 16, -6, -7, -5, -2,-12,-16,-16,-12, 1, 1, -1, -3,
+ 11,-17, 0, 8, 14,-21, -1, 9, 14,-21, -2, 8, 11,-16, -2, 6,
+ 7, -2,-16, 11, 9, -2,-21, 14, 10, -1,-22, 14, 8, -1,-18, 10,
+ -10, 16, 3, -9,-13, 20, 4,-11,-14, 21, 4,-10,-11, 16, 3, -8,
+ 11, 4, -9, -9, 15, 6,-12,-14, 17, 8,-12,-14, 16, 10, -7,-11,
+ 4, 10, 14, 13, -1, 7, 15, 16,-12, -7, 3, 8,-20,-23,-18,-10,
+ -10,-18,-26,-25, 4, 1, -6,-11, 13, 15, 11, 3, 12, 15, 13, 8,
+ -16,-19,-16,-11, 7, 12, 15, 11, 11, 16, 16, 11, -6, -9,-11,-10,
+ 18, 19, 12, 5, 18, 16, 5, -4, 6, 0,-10,-15, -9,-17,-23,-22,
+ -10,-14, -1, 21,-11,-17, 0, 29,-11,-16, 1, 30,-10,-14, 0, 23,
+ -16,-17,-12, -6,-19,-19,-14, -7, -3, -1, 1, 2, 27, 35, 29, 19,
+ -37, -8, 23, 23,-42, -9, 28, 29,-43,-10, 26, 28,-38,-11, 19, 22,
+ 32, 16,-16,-33, 39, 20,-18,-37, 38, 19,-19,-38, 32, 15,-17,-34,
+ 24, 9, -6, -4, -1,-10, -6, 3, -8, -9, -1, 3, 3, 7, 2, -6,
+ -1, -3, -1, 0, -1, 4, 2, -7, -3, 11, 3,-16, 1, 20, 9,-18,
+ -3, -8, 6, 12, -5,-10, 7, 13, -6, -9, 5, 7, -5, -5, 2, -1,
+ -8, 12, -3, -1,-10, 15, -3, 1,-11, 13, -4, 1,-11, 8, -3, 2,
+ 9, 6, -5,-12, 3, 0, -8,-13, -4, -4, -1, -1, -4, 1, 15, 18,
+ 9, 13, 14, 12, 4, 3, -1, -2, -2, -5, -8, -5, -7,-11, -9, -4,
7, -5, -7, -4, 14, -2, -7, -4, 17, 0, -8, -5, 15, 1, -7, -5,
- -10, -1, 6, 4, -15, -9, 2, 4, 2, -1, -3, 0, 25, 13, -8, -10,
- 7, 11, -3, -16, 7, 11, -3, -15, 6, 7, -2, -9, 4, 2, -3, -5,
- -7, -1, -1, 0, -9, -2, 2, 6, -12, -4, 6, 14, -13, -6, 8, 19,
- -18, -18, -11, -5, -3, 0, 3, 4, 6, 8, 6, 6, 6, 6, 6, 6,
- -5, 3, 13, -10, -6, 1, 15, -9, -6, -3, 15, -6, -6, -6, 10, -3,
- 9, 1, -9, -9, 11, 9, 6, 5, 0, 3, 8, 7, -15, -14, -6, -5,
- -11, -6, 11, 19, -2, -5, -9, -8, 6, 2, -9, -10, 6, 5, 4, 5,
- -7, -3, 8, 15, -1, 3, 10, 15, 5, 5, -1, -2, 4, -2, -21, -25,
- 6, -6, -6, 5, 8, -9, -7, 9, 8, -12, -7, 13, 4, -14, -7, 14,
- -4, -3, 1, 1, -3, -5, -2, -3, 7, 0, -2, -4, 20, 7, -4, -4,
- -3, -20, -6, 10, 6, 0, 0, 1, 5, 8, 5, -1, -3, 0, 0, -2,
- 13, 6, -1, 2, 5, 3, 2, 3, -3, 0, 3, 0, -16, -8, -2, -5,
- -2, -7, -6, 0, -3, -6, -3, 1, -5, -1, 2, -1, -1, 12, 16, 5,
- -7, 1, 9, 8, -10, -2, 5, 3, -6, 2, 7, 3, -4, 0, -1, -7,
- 3, 4, -9, -24, 0, 2, 6, 3, -1, -1, 4, 7, 5, 3, -1, -2,
- 3, 6, -9, 2, 1, 6, -13, 1, 1, 8, -10, 2, 1, 8, -7, 1,
- -3, -3, 2, 22, -2, -3, -5, 12, -2, -3, -10, 2, -3, -1, -4, 2,
- 11, 12, 8, 2, -5, -5, -5, -8, -6, -4, 0, -3, -2, -1, 3, 3,
- 12, -6, -2, -1, 12, -8, -2, -2, 9, -7, 0, -3, 4, -6, 2, -2,
- -19, 1, 12, -3, -4, 4, 5, -4, 6, 1, -2, -1, 4, -4, -2, 7,
- -3, -4, -7, -8, -4, -4, -2, 0, -1, 2, 14, 16, -4, -2, 4, 4,
- -1, 7, 2, -5, -2, 0, -1, 1, 4, -3, -1, 13, 6, -12, -14, 8,
- -1, 5, 4, -5, -2, 5, 3, -9, -2, 7, 4, -12, -1, 7, 4, -9,
- -6, -3, 1, 1, 11, 11, 0, -6, 6, 4, -2, -7, -12, -10, 3, 10,
- -2, -3, -3, -2, 6, 11, 14, 10, -9, -11, -10, -10, 2, 2, 3, 2,
- -7, -5, -7, -1, -1, 2, 0, 7, -1, 1, 0, 9, 3, 4, -5, -1,
- 10, -1, -15, -1, 4, 1, -5, 2, -3, 1, -1, 1, -3, 1, 4, 4,
- 2, -1, 4, 10, 6, 2, -1, 0, 2, 2, -7, -12, -4, 2, 0, -3,
- -1, -4, -1, -8, 3, -1, 2, -9, 4, 0, 5, -5, 2, 0, 8, 3,
- 3, 2, 1, 1, 4, -2, 0, 3, 2, -1, 4, 1, 0, 6, -1, -25,
- -1, -2, -2, -4, -3, 0, -1, -4, -1, -1, -4, 2, 0, -6, 2, 25,
- -11, -1, 5, 0, 7, 0, -2, 2, 10, -1, -3, 4, -5, -5, -2, -1,
- 0, 6, 3, -1, -2, -1, -1, 1, -1, -7, -12, -5, 8, 6, 2, 4,
+ -10, -1, 6, 4,-15, -9, 2, 4, 2, -1, -3, 0, 25, 13, -8,-10,
+ 7, 11, -3,-16, 7, 11, -3,-15, 6, 7, -2, -9, 4, 2, -3, -5,
+ -7, -1, -1, 0, -9, -2, 2, 6,-12, -4, 6, 14,-13, -6, 8, 19,
+ -18,-18,-11, -5, -3, 0, 3, 4, 6, 8, 6, 6, 6, 6, 6, 6,
+ -5, 3, 13,-10, -6, 1, 15, -9, -6, -3, 15, -6, -6, -6, 10, -3,
+ 9, 1, -9, -9, 11, 9, 6, 5, 0, 3, 8, 7,-15,-14, -6, -5,
+ -11, -6, 11, 19, -2, -5, -9, -8, 6, 2, -9,-10, 6, 5, 4, 5,
+ -7, -3, 8, 15, -1, 3, 10, 15, 5, 5, -1, -2, 4, -2,-21,-25,
+ 6, -6, -6, 5, 8, -9, -7, 9, 8,-12, -7, 13, 4,-14, -7, 14,
+ -4, -3, 1, 1, -3, -5, -2, -3, 7, 0, -2, -4, 20, 7, -4, -4,
+ -3,-20, -6, 10, 6, 0, 0, 1, 5, 8, 5, -1, -3, 0, 0, -2,
+ 13, 6, -1, 2, 5, 3, 2, 3, -3, 0, 3, 0,-16, -8, -2, -5,
+ -2, -7, -6, 0, -3, -6, -3, 1, -5, -1, 2, -1, -1, 12, 16, 5,
+ -7, 1, 9, 8,-10, -2, 5, 3, -6, 2, 7, 3, -4, 0, -1, -7,
+ 3, 4, -9,-24, 0, 2, 6, 3, -1, -1, 4, 7, 5, 3, -1, -2,
+ 3, 6, -9, 2, 1, 6,-13, 1, 1, 8,-10, 2, 1, 8, -7, 1,
+ -3, -3, 2, 22, -2, -3, -5, 12, -2, -3,-10, 2, -3, -1, -4, 2,
+ 11, 12, 8, 2, -5, -5, -5, -8, -6, -4, 0, -3, -2, -1, 3, 3,
+ 12, -6, -2, -1, 12, -8, -2, -2, 9, -7, 0, -3, 4, -6, 2, -2,
+ -19, 1, 12, -3, -4, 4, 5, -4, 6, 1, -2, -1, 4, -4, -2, 7,
+ -3, -4, -7, -8, -4, -4, -2, 0, -1, 2, 14, 16, -4, -2, 4, 4,
+ -1, 7, 2, -5, -2, 0, -1, 1, 4, -3, -1, 13, 6,-12,-14, 8,
+ -1, 5, 4, -5, -2, 5, 3, -9, -2, 7, 4,-12, -1, 7, 4, -9,
+ -6, -3, 1, 1, 11, 11, 0, -6, 6, 4, -2, -7,-12,-10, 3, 10,
+ -2, -3, -3, -2, 6, 11, 14, 10, -9,-11,-10,-10, 2, 2, 3, 2,
+ -7, -5, -7, -1, -1, 2, 0, 7, -1, 1, 0, 9, 3, 4, -5, -1,
+ 10, -1,-15, -1, 4, 1, -5, 2, -3, 1, -1, 1, -3, 1, 4, 4,
+ 2, -1, 4, 10, 6, 2, -1, 0, 2, 2, -7,-12, -4, 2, 0, -3,
+ -1, -4, -1, -8, 3, -1, 2, -9, 4, 0, 5, -5, 2, 0, 8, 3,
+ 3, 2, 1, 1, 4, -2, 0, 3, 2, -1, 4, 1, 0, 6, -1,-25,
+ -1, -2, -2, -4, -3, 0, -1, -4, -1, -1, -4, 2, 0, -6, 2, 25,
+ -11, -1, 5, 0, 7, 0, -2, 2, 10, -1, -3, 4, -5, -5, -2, -1,
+ 0, 6, 3, -1, -2, -1, -1, 1, -1, -7,-12, -5, 8, 6, 2, 4,
2, 6, -1, -6, 9, 10, -1, -4, 1, 0, -4, 0, 3, -2, -9, -5,
- -4, 3, 4, 0, -4, 3, 3, 0, -11, 0, 3, 2, -11, 3, 7, 2,
- 2, -4, 7, 3, 1, -8, 7, 1, -1, -12, 4, 1, 3, -9, 2, 2,
- 2, -2, -2, 9, -17, -3, 3, 1, -4, 7, 1, -6, 5, 4, -1, 3,
- -1, 2, 0, -4, -7, 8, 12, -1, -2, 5, 4, -5, 3, -5, -8, -2,
+ -4, 3, 4, 0, -4, 3, 3, 0,-11, 0, 3, 2,-11, 3, 7, 2,
+ 2, -4, 7, 3, 1, -8, 7, 1, -1,-12, 4, 1, 3, -9, 2, 2,
+ 2, -2, -2, 9,-17, -3, 3, 1, -4, 7, 1, -6, 5, 4, -1, 3,
+ -1, 2, 0, -4, -7, 8, 12, -1, -2, 5, 4, -5, 3, -5, -8, -2,
0, 0, -5, -2, -2, -8, 3, 27, -1, -4, -3, 6, -3, 1, -2, -7,
- 4, 4, 1, -1, -7, -10, -7, -3, 10, 10, 5, 3, -2, -2, -4, -3,
- 0, 1, 5, 7, 4, -2, -16, -20, 0, 4, 7, 8, 2, 0, -2, -1,
- -2, 1, 3, 17, -3, 1, -2, -1, -1, -2, -1, -2, -1, -5, -1, 0,
- 5, -3, 1, 0, 6, -2, 0, 0, -1, -2, 0, -3, -11, 1, 8, -1,
- 3, 0, 0, 0, 0, 2, 4, 1, 2, 0, 6, 1, -2, -18, -3, 2,
- -14, 0, 6, 1, -5, -2, -1, 1, -1, 1, 0, 1, 1, 7, 4, 0,
- -1, 0, 1, -4, 1, 8, 3, -4, -3, 4, 1, 3, -6, 1, -4, 1,
- 1, -12, 3, 3, -1, -10, 0, -1, 2, 0, 2, 1, 3, 2, 2, 4,
- 3, 0, 0, 3, 2, 0, -2, 1, 5, 2, -5, 0, 6, -1, -14, -1,
- -2, -6, -3, -3, 2, -1, 4, 5, 6, -1, -2, 0, 4, 4, -1, -5,
- -4, 1, -11, 0, -1, 2, -4, 1, 2, -3, 3, -1, 1, -2, 15, 0,
+ 4, 4, 1, -1, -7,-10, -7, -3, 10, 10, 5, 3, -2, -2, -4, -3,
+ 0, 1, 5, 7, 4, -2,-16,-20, 0, 4, 7, 8, 2, 0, -2, -1,
+ -2, 1, 3, 17, -3, 1, -2, -1, -1, -2, -1, -2, -1, -5, -1, 0,
+ 5, -3, 1, 0, 6, -2, 0, 0, -1, -2, 0, -3,-11, 1, 8, -1,
+ 3, 0, 0, 0, 0, 2, 4, 1, 2, 0, 6, 1, -2,-18, -3, 2,
+ -14, 0, 6, 1, -5, -2, -1, 1, -1, 1, 0, 1, 1, 7, 4, 0,
+ -1, 0, 1, -4, 1, 8, 3, -4, -3, 4, 1, 3, -6, 1, -4, 1,
+ 1,-12, 3, 3, -1,-10, 0, -1, 2, 0, 2, 1, 3, 2, 2, 4,
+ 3, 0, 0, 3, 2, 0, -2, 1, 5, 2, -5, 0, 6, -1,-14, -1,
+ -2, -6, -3, -3, 2, -1, 4, 5, 6, -1, -2, 0, 4, 4, -1, -5,
+ -4, 1,-11, 0, -1, 2, -4, 1, 2, -3, 3, -1, 1, -2, 15, 0,
1, -1, 0, -2, 1, -4, -7, 1, -2, -6, -1, 21, -2, 2, -1, 1,
- 21, -1, -2, 0, -1, -3, 1, -2, -9, -2, 2, -1, 2, 1, -4, -1,
- 1, 8, 2, -6, -10, -1, 4, 0, -4, -3, 3, 3, 5, 0, -1, -1,
- 3, 2, 1, -2, -2, -2, 4, 3, 5, 2, -4, -17, 0, -2, 4, 3,
- -7, -4, 0, 3, 9, 9, 2, -1, -11, -6, 0, -1, 5, 1, 0, 1,
- 0, 17, 5, -11, 3, -2, -6, 0, 2, -2, -4, 1, -4, 1, 2, -1,
- -5, -1, -5, -3, -3, 5, -3, -2, 4, 16, 2, -5, -2, 5, -1, -1,
+ 21, -1, -2, 0, -1, -3, 1, -2, -9, -2, 2, -1, 2, 1, -4, -1,
+ 1, 8, 2, -6,-10, -1, 4, 0, -4, -3, 3, 3, 5, 0, -1, -1,
+ 3, 2, 1, -2, -2, -2, 4, 3, 5, 2, -4,-17, 0, -2, 4, 3,
+ -7, -4, 0, 3, 9, 9, 2, -1,-11, -6, 0, -1, 5, 1, 0, 1,
+ 0, 17, 5,-11, 3, -2, -6, 0, 2, -2, -4, 1, -4, 1, 2, -1,
+ -5, -1, -5, -3, -3, 5, -3, -2, 4, 16, 2, -5, -2, 5, -1, -1,
0, 0, -4, 1, -1, 2, 5, 11, -1, -1, -2, 1, -4, -2, -3, -1,
- -5, -1, 10, 0, 6, 1, 0, -3, 0, -4, 1, 0, -2, -4, 3, -1,
+ -5, -1, 10, 0, 6, 1, 0, -3, 0, -4, 1, 0, -2, -4, 3, -1,
6, 9, 3, 0, -2, 1, -2, 0, -2, -3, -2, -2, 1, 0, 1, -6,
- 1, 0, 2, 1, -1, 3, -2, 1, 0, -1, -15, 0, -1, 5, 2, 6,
- 2, 0, 2, 2, 0, -12, -4, 6, 0, 1, 4, -1, 1, 2, 1, -4,
+ 1, 0, 2, 1, -1, 3, -2, 1, 0, -1,-15, 0, -1, 5, 2, 6,
+ 2, 0, 2, 2, 0,-12, -4, 6, 0, 1, 4, -1, 1, 2, 1, -4,
1, -2, -7, 0, 0, 0, 0, -1, -5, 2, 11, 3, 1, 3, 0, -6,
0, -3, -9, -4, 1, 3, -1, 0, 4, 1, -2, 0, 7, -3, -1, 6,
- 1, -2, 6, 2, 0, -1, 3, -2, -2, 4, 0, 2, -1, 2, -14, 2,
- 2, 2, 0, -1, -2, 3, -3, -14, 0, 2, 3, -3, 5, 1, 3, 2,
- 1, -3, 4, -14, 1, -2, 11, -1, 0, -1, 3, 0, -1, 1, 0, 2,
- -2, 3, -3, 2, -4, -1, -4, 3, -1, 2, 1, 3, -6, -2, 2, 7,
- -2, 1, 2, 0, -2, 0, 0, -1, 12, 5, -1, 2, -8, -1, 1, -7,
- 2, -2, -4, 2, 11, 0, -11, -2, 3, 1, -3, -1, 0, 3, 1, -1,
+ 1, -2, 6, 2, 0, -1, 3, -2, -2, 4, 0, 2, -1, 2,-14, 2,
+ 2, 2, 0, -1, -2, 3, -3,-14, 0, 2, 3, -3, 5, 1, 3, 2,
+ 1, -3, 4,-14, 1, -2, 11, -1, 0, -1, 3, 0, -1, 1, 0, 2,
+ -2, 3, -3, 2, -4, -1, -4, 3, -1, 2, 1, 3, -6, -2, 2, 7,
+ -2, 1, 2, 0, -2, 0, 0, -1, 12, 5, -1, 2, -8, -1, 1, -7,
+ 2, -2, -4, 2, 11, 0,-11, -2, 3, 1, -3, -1, 0, 3, 1, -1,
0, 3, 0, -2, 0, -6, -1, -3, 12, -7, -2, 0, 7, -2, 1, 1,
- 1, 2, 2, 2, -1, 2, 0, 2, -23, 0, 4, 0, 3, 2, 1, 3,
- -4, -5, -1, 5, -3, 5, 10, -1, 0, 0, 3, -4, 1, -1, 2, -5
+ 1, 2, 2, 2, -1, 2, 0, 2,-23, 0, 4, 0, 3, 2, 1, 3,
+ -4, -5, -1, 5, -3, 5, 10, -1, 0, 0, 3, -4, 1, -1, 2, -5
};
/* 6x16-entry codebook for inter-coded 8x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x4)[3072] =
-{
+DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x4)[3072] = {
9, 8, 4, 0, -3, -4, -4, -3, 9, 8, 4, -1, -4, -5, -5, -3,
8, 7, 3, -2, -5, -5, -5, -4, 6, 4, 1, -2, -4, -5, -4, -3,
- -12, -14, -11, -4, 1, 5, 6, 6, -8, -10, -7, -5, -2, 1, 1, 1,
+ -12,-14,-11, -4, 1, 5, 6, 6, -8,-10, -7, -5, -2, 1, 1, 1,
5, 4, 3, 1, 0, 0, -1, -1, 13, 13, 9, 6, 3, 0, -1, -2,
- -4, -4, -3, -1, 1, 4, 8, 11, -5, -6, -4, -2, 0, 3, 8, 12,
- -7, -7, -6, -4, -2, 2, 7, 10, -7, -7, -5, -4, -2, 1, 5, 8,
- -3, -2, -1, 1, 3, 6, 7, 6, 2, 3, 5, 7, 8, 8, 6, 4,
- 4, 5, 4, 3, 1, -2, -6, -7, 1, 0, -2, -7, -10, -14, -17, -16,
- -5, -4, 1, 8, 9, 3, -3, -7, -7, -6, 1, 11, 12, 5, -3, -8,
- -8, -7, 0, 9, 11, 5, -3, -7, -8, -6, -1, 5, 8, 4, -2, -6,
- -4, -5, -7, -8, -9, -9, -8, -6, -4, -5, -6, -7, -7, -6, -4, -2,
+ -4, -4, -3, -1, 1, 4, 8, 11, -5, -6, -4, -2, 0, 3, 8, 12,
+ -7, -7, -6, -4, -2, 2, 7, 10, -7, -7, -5, -4, -2, 1, 5, 8,
+ -3, -2, -1, 1, 3, 6, 7, 6, 2, 3, 5, 7, 8, 8, 6, 4,
+ 4, 5, 4, 3, 1, -2, -6, -7, 1, 0, -2, -7,-10,-14,-17,-16,
+ -5, -4, 1, 8, 9, 3, -3, -7, -7, -6, 1, 11, 12, 5, -3, -8,
+ -8, -7, 0, 9, 11, 5, -3, -7, -8, -6, -1, 5, 8, 4, -2, -6,
+ -4, -5, -7, -8, -9, -9, -8, -6, -4, -5, -6, -7, -7, -6, -4, -2,
0, 1, 2, 3, 5, 8, 10, 9, 1, 2, 3, 6, 9, 12, 14, 13,
5, 6, 6, 5, 4, 3, 2, 1, 5, 6, 7, 7, 6, 6, 6, 4,
- -1, 0, 1, 1, 3, 5, 5, 5, -13, -16, -17, -17, -14, -10, -6, -4,
+ -1, 0, 1, 1, 3, 5, 5, 5,-13,-16,-17,-17,-14,-10, -6, -4,
9, 11, 13, 16, 15, 13, 12, 10, -4, -5, -6, -7, -7, -7, -6, -5,
- -6, -6, -7, -7, -7, -7, -6, -5, -2, -1, 0, 0, 0, 0, 0, -1,
- -11, -13, -15, -16, -16, -14, -12, -10, 2, 3, 4, 5, 4, 3, 3, 3,
+ -6, -6, -7, -7, -7, -7, -6, -5, -2, -1, 0, 0, 0, 0, 0, -1,
+ -11,-13,-15,-16,-16,-14,-12,-10, 2, 3, 4, 5, 4, 3, 3, 3,
6, 7, 8, 8, 8, 7, 6, 5, 3, 4, 3, 3, 3, 3, 3, 3,
- 3, 4, 4, 1, -2, -7, -13, -17, 5, 7, 7, 5, 1, -5, -13, -19,
- 6, 8, 9, 8, 5, -1, -9, -16, 6, 8, 10, 10, 7, 2, -4, -11,
- 18, 9, -1, -10, -13, -9, -4, 0, 22, 12, -1, -12, -15, -10, -4, 2,
- 23, 13, 0, -10, -13, -9, -3, 2, 20, 12, 2, -6, -9, -6, -2, 2,
- -6, -6, -6, -7, -7, -7, -7, -6, -6, -7, -8, -8, -9, -9, -9, -8,
- -3, -3, -3, -3, -3, -3, -3, -3, 12, 15, 18, 21, 21, 19, 17, 14,
- 14, 16, 18, 18, 18, 16, 15, 13, 5, 6, 6, 5, 5, 4, 4, 3,
- -6, -7, -9, -10, -10, -10, -9, -7, -10, -11, -13, -14, -14, -13, -12, -10,
- -27, -17, -4, 5, 9, 10, 10, 7, -32, -19, -3, 7, 11, 12, 11, 8,
- -30, -16, -2, 8, 12, 12, 10, 7, -23, -12, 0, 7, 10, 11, 9, 6,
- 16, 17, 16, 12, 6, -1, -8, -12, 17, 18, 15, 10, 1, -8, -15, -18,
- 15, 14, 10, 4, -5, -14, -20, -23, 10, 8, 4, -1, -9, -16, -21, -22,
- -10, -12, -12, -11, -5, 4, 14, 20, -11, -13, -15, -12, -4, 7, 19, 27,
- -11, -13, -14, -11, -3, 8, 21, 28, -10, -11, -12, -9, -2, 8, 18, 25,
- -1, -1, -1, 1, 4, 6, 6, 5, 0, 0, 0, 2, 4, 3, 1, -2,
- 0, 0, 2, 4, 4, -1, -7, -10, 0, 0, 3, 5, 3, -3, -11, -15,
- -14, -13, -8, -1, 3, 3, -1, -4, -5, -4, -1, 4, 8, 8, 3, 0,
+ 3, 4, 4, 1, -2, -7,-13,-17, 5, 7, 7, 5, 1, -5,-13,-19,
+ 6, 8, 9, 8, 5, -1, -9,-16, 6, 8, 10, 10, 7, 2, -4,-11,
+ 18, 9, -1,-10,-13, -9, -4, 0, 22, 12, -1,-12,-15,-10, -4, 2,
+ 23, 13, 0,-10,-13, -9, -3, 2, 20, 12, 2, -6, -9, -6, -2, 2,
+ -6, -6, -6, -7, -7, -7, -7, -6, -6, -7, -8, -8, -9, -9, -9, -8,
+ -3, -3, -3, -3, -3, -3, -3, -3, 12, 15, 18, 21, 21, 19, 17, 14,
+ 14, 16, 18, 18, 18, 16, 15, 13, 5, 6, 6, 5, 5, 4, 4, 3,
+ -6, -7, -9,-10,-10,-10, -9, -7,-10,-11,-13,-14,-14,-13,-12,-10,
+ -27,-17, -4, 5, 9, 10, 10, 7,-32,-19, -3, 7, 11, 12, 11, 8,
+ -30,-16, -2, 8, 12, 12, 10, 7,-23,-12, 0, 7, 10, 11, 9, 6,
+ 16, 17, 16, 12, 6, -1, -8,-12, 17, 18, 15, 10, 1, -8,-15,-18,
+ 15, 14, 10, 4, -5,-14,-20,-23, 10, 8, 4, -1, -9,-16,-21,-22,
+ -10,-12,-12,-11, -5, 4, 14, 20,-11,-13,-15,-12, -4, 7, 19, 27,
+ -11,-13,-14,-11, -3, 8, 21, 28,-10,-11,-12, -9, -2, 8, 18, 25,
+ -1, -1, -1, 1, 4, 6, 6, 5, 0, 0, 0, 2, 4, 3, 1, -2,
+ 0, 0, 2, 4, 4, -1, -7,-10, 0, 0, 3, 5, 3, -3,-11,-15,
+ -14,-13, -8, -1, 3, 3, -1, -4, -5, -4, -1, 4, 8, 8, 3, 0,
3, 2, 2, 3, 4, 5, 3, 1, 5, 3, 0, -2, -2, -1, -1, -1,
9, 1, -6, -6, -5, -3, -2, -1, 12, 1, -6, -6, -4, -2, -1, 0,
- 14, 4, -4, -4, -2, -2, -1, -1, 14, 6, -1, -1, -1, -1, -1, -1,
+ 14, 4, -4, -4, -2, -2, -1, -1, 14, 6, -1, -1, -1, -1, -1, -1,
4, 6, 8, 10, 11, 9, 7, 5, -1, -1, -1, 0, 0, -1, -1, -2,
- -2, -4, -4, -5, -5, -5, -5, -4, -2, -3, -3, -4, -4, -3, -2, -1,
+ -2, -4, -4, -5, -5, -5, -5, -4, -2, -3, -3, -4, -4, -3, -2, -1,
2, 3, 4, 4, 3, 1, 0, 0, -1, 1, 4, 5, 6, 5, 4, 3,
- -8, -6, -2, 2, 3, 4, 4, 3, -14, -13, -9, -5, -2, -1, 0, 0,
- -3, -4, -5, -4, 0, 7, 12, 13, -3, -4, -5, -5, -2, 4, 9, 10,
- -2, -3, -4, -5, -4, -1, 3, 4, -1, -1, -2, -3, -3, -2, 0, 1,
- 9, 5, -2, -8, -11, -10, -7, -4, 12, 10, 6, 2, 0, -1, 0, 0,
+ -8, -6, -2, 2, 3, 4, 4, 3,-14,-13, -9, -5, -2, -1, 0, 0,
+ -3, -4, -5, -4, 0, 7, 12, 13, -3, -4, -5, -5, -2, 4, 9, 10,
+ -2, -3, -4, -5, -4, -1, 3, 4, -1, -1, -2, -3, -3, -2, 0, 1,
+ 9, 5, -2, -8,-11,-10, -7, -4, 12, 10, 6, 2, 0, -1, 0, 0,
2, 2, 3, 4, 3, 1, 1, 1, -9, -8, -4, 0, 1, 2, 1, 0,
- 6, 8, 8, 5, 1, -5, -11, -13, 0, 1, 2, 2, -1, -4, -8, -11,
- -3, -2, 1, 3, 3, 1, -1, -4, -2, -1, 2, 5, 6, 6, 4, 1,
+ 6, 8, 8, 5, 1, -5,-11,-13, 0, 1, 2, 2, -1, -4, -8,-11,
+ -3, -2, 1, 3, 3, 1, -1, -4, -2, -1, 2, 5, 6, 6, 4, 1,
3, 4, 5, 5, 4, 1, -3, -6, 5, 6, 4, 2, 2, 2, 0, -3,
- 6, 5, 0, -5, -5, -2, -1, -2, 7, 4, -3, -11, -12, -7, -3, -2,
+ 6, 5, 0, -5, -5, -2, -1, -2, 7, 4, -3,-11,-12, -7, -3, -2,
1, 0, -1, -1, -1, 0, 0, 0, 2, 3, 4, 4, 5, 5, 4, 3,
- -7, -9, -9, -10, -10, -9, -7, -6, 3, 4, 5, 6, 5, 5, 5, 5,
- -7, -7, -7, -7, -6, -6, -5, -4, -5, -4, -3, -1, -1, -1, 0, 0,
- -3, -2, 1, 4, 5, 5, 5, 5, -2, -1, 3, 6, 9, 10, 10, 9,
- -14, 1, 10, 3, -2, 0, 1, 1, -16, 2, 13, 3, -3, -1, 1, 0,
- -15, 2, 12, 3, -4, -2, 1, 1, -10, 3, 10, 2, -3, -1, 1, 1,
- 0, 1, 4, 2, -5, -10, -3, 11, -1, 1, 4, 2, -6, -13, -2, 15,
- -1, 0, 3, 1, -6, -12, -1, 15, -1, 1, 2, 1, -4, -8, 0, 11,
- 10, 5, -2, -2, 2, 5, 1, -4, 7, 0, -8, -6, 1, 5, 2, -4,
- 2, -5, -12, -7, 2, 7, 4, -1, -1, -7, -10, -4, 4, 9, 7, 2,
- -5, -5, -4, -6, -6, -5, -5, -3, -1, -2, -2, -4, -5, -6, -5, -4,
+ -7, -9, -9,-10,-10, -9, -7, -6, 3, 4, 5, 6, 5, 5, 5, 5,
+ -7, -7, -7, -7, -6, -6, -5, -4, -5, -4, -3, -1, -1, -1, 0, 0,
+ -3, -2, 1, 4, 5, 5, 5, 5, -2, -1, 3, 6, 9, 10, 10, 9,
+ -14, 1, 10, 3, -2, 0, 1, 1,-16, 2, 13, 3, -3, -1, 1, 0,
+ -15, 2, 12, 3, -4, -2, 1, 1,-10, 3, 10, 2, -3, -1, 1, 1,
+ 0, 1, 4, 2, -5,-10, -3, 11, -1, 1, 4, 2, -6,-13, -2, 15,
+ -1, 0, 3, 1, -6,-12, -1, 15, -1, 1, 2, 1, -4, -8, 0, 11,
+ 10, 5, -2, -2, 2, 5, 1, -4, 7, 0, -8, -6, 1, 5, 2, -4,
+ 2, -5,-12, -7, 2, 7, 4, -1, -1, -7,-10, -4, 4, 9, 7, 2,
+ -5, -5, -4, -6, -6, -5, -5, -3, -1, -2, -2, -4, -5, -6, -5, -4,
6, 7, 7, 4, 0, -2, -3, -3, 13, 14, 13, 10, 5, 1, -1, -2,
1, 1, 2, 2, 2, 2, 2, 2, -5, -6, -8, -9, -9, -8, -7, -6,
7, 9, 10, 11, 11, 9, 7, 5, -1, -2, -3, -3, -4, -4, -4, -3,
- -1, -1, 0, 0, 0, 0, -1, -1, -3, -3, -4, -5, -4, -3, -3, -2,
+ -1, -1, 0, 0, 0, 0, -1, -1, -3, -3, -4, -5, -4, -3, -3, -2,
2, 1, -1, -3, -3, -2, -1, 0, 12, 12, 8, 3, 1, 0, 0, 1,
- -6, -8, -8, -6, -2, 2, 6, 8, 1, 1, -1, -2, 0, 3, 5, 7,
+ -6, -8, -8, -6, -2, 2, 6, 8, 1, 1, -1, -2, 0, 3, 5, 7,
3, 3, 1, -1, -1, 0, 0, 2, 0, 1, 0, -1, -1, -1, -2, -1,
1, 0, 0, 0, 0, 0, 2, 4, 2, 1, 3, 4, 3, 1, 0, 2,
- 2, 1, 0, 0, -1, -1, 0, 3, 5, 1, -6, -12, -13, -8, -1, 4,
- -2, 0, -1, -2, -1, 0, 2, 3, -6, -3, -2, 0, 1, 1, 1, 1,
- -9, -5, 0, 4, 5, 3, 1, 0, -8, -3, 3, 7, 8, 4, 1, 0,
+ 2, 1, 0, 0, -1, -1, 0, 3, 5, 1, -6,-12,-13, -8, -1, 4,
+ -2, 0, -1, -2, -1, 0, 2, 3, -6, -3, -2, 0, 1, 1, 1, 1,
+ -9, -5, 0, 4, 5, 3, 1, 0, -8, -3, 3, 7, 8, 4, 1, 0,
1, 2, 2, 3, 3, 1, -1, -3, 4, 5, 5, 6, 6, 5, 2, 0,
0, 0, 0, 0, 1, 0, -2, -4, -3, -3, -4, -3, -3, -4, -7, -8,
- 14, 12, 6, -1, -3, -3, 0, 0, 7, 5, 1, -3, -5, -4, -2, -1,
- -2, -2, -2, -2, -2, -2, -1, -1, -6, -4, -1, 1, 1, 1, 0, -1,
+ 14, 12, 6, -1, -3, -3, 0, 0, 7, 5, 1, -3, -5, -4, -2, -1,
+ -2, -2, -2, -2, -2, -2, -1, -1, -6, -4, -1, 1, 1, 1, 0, -1,
2, 2, 1, -3, -6, -7, -6, -3, 1, 0, -1, -3, -2, 1, 4, 6,
0, 0, 1, 2, 4, 7, 8, 7, 0, 0, 0, 0, -1, -4, -7, -8,
0, 2, 1, -2, -3, -3, -2, -1, -1, 1, 0, -3, -5, -2, 0, 2,
- -2, -1, -2, -5, -4, 1, 6, 9, -3, -2, -3, -4, -2, 5, 11, 13,
- -4, -2, 2, 6, 4, -3, -10, -14, -2, -1, 1, 4, 4, 1, -1, -2,
+ -2, -1, -2, -5, -4, 1, 6, 9, -3, -2, -3, -4, -2, 5, 11, 13,
+ -4, -2, 2, 6, 4, -3,-10,-14, -2, -1, 1, 4, 4, 1, -1, -2,
0, 0, -1, -2, -2, 0, 4, 6, 2, 2, 0, -3, -3, 0, 5, 9,
- -4, -4, -2, 1, 6, 9, 3, -7, -2, -2, -2, -1, 4, 8, 0, -11,
- 1, 1, 0, 0, 2, 6, -1, -10, 2, 2, 1, 0, 2, 4, 0, -7,
- -1, -2, -3, -6, -7, -8, -8, -8, 2, 3, 3, 1, -1, -2, -3, -4,
+ -4, -4, -2, 1, 6, 9, 3, -7, -2, -2, -2, -1, 4, 8, 0,-11,
+ 1, 1, 0, 0, 2, 6, -1,-10, 2, 2, 1, 0, 2, 4, 0, -7,
+ -1, -2, -3, -6, -7, -8, -8, -8, 2, 3, 3, 1, -1, -2, -3, -4,
5, 5, 5, 4, 3, 2, 0, -1, 3, 3, 3, 3, 2, 2, 1, 1,
3, 3, 2, -2, -3, 0, 7, 10, 1, 2, 2, -2, -5, -4, 0, 3,
0, 3, 4, 2, -3, -5, -6, -4, 0, 2, 4, 4, 1, -4, -7, -7,
2, 4, 5, 5, 5, 5, 6, 6, -4, -4, -3, -5, -5, -3, -3, -2,
- -3, -4, -4, -5, -4, -2, -2, -2, 1, 1, 0, 0, 2, 4, 5, 4,
- -2, 0, 3, 4, 4, 3, 2, 2, -9, -7, -4, 0, 3, 6, 6, 6,
- -5, -5, -3, -2, 0, 1, 3, 4, 5, 5, 2, -2, -4, -6, -5, -3,
+ -3, -4, -4, -5, -4, -2, -2, -2, 1, 1, 0, 0, 2, 4, 5, 4,
+ -2, 0, 3, 4, 4, 3, 2, 2, -9, -7, -4, 0, 3, 6, 6, 6,
+ -5, -5, -3, -2, 0, 1, 3, 4, 5, 5, 2, -2, -4, -6, -5, -3,
1, -6, -4, 7, 5, -2, -2, 1, 5, -5, -4, 6, 4, -5, -4, 1,
5, -5, -4, 6, 4, -5, -3, 1, 1, -7, -3, 8, 7, -1, -3, 1,
- -8, -7, -4, 0, 2, 4, 5, 5, 5, 6, 5, 2, -1, -5, -7, -7,
+ -8, -7, -4, 0, 2, 4, 5, 5, 5, 6, 5, 2, -1, -5, -7, -7,
5, 6, 4, 1, -3, -5, -6, -5, -7, -7, -5, -2, 1, 6, 9, 10,
- 6, 3, 0, 1, 3, 0, -8, -14, 3, 0, -1, 1, 4, 3, 0, -4,
+ 6, 3, 0, 1, 3, 0, -8,-14, 3, 0, -1, 1, 4, 3, 0, -4,
1, 0, 0, 1, 2, 1, 1, 1, -1, -1, 1, 2, 1, -1, -1, 0,
1, 1, 1, 1, 0, -2, -3, 0, 1, 2, 1, 0, -2, -8, -9, -4,
1, 3, 3, 2, 1, -3, -3, 1, 0, 1, 1, 1, 1, 1, 4, 8,
2, 5, 9, 7, 2, -1, -1, 1, -4, -1, 1, 0, -3, -4, -1, 2,
- -3, 0, 3, 3, 0, -1, 0, 2, -4, -1, 1, 1, -2, -4, -5, -4,
+ -3, 0, 3, 3, 0, -1, 0, 2, -4, -1, 1, 1, -2, -4, -5, -4,
1, -1, -2, -2, -1, 2, 4, 5, 2, 1, 1, 0, -1, -1, 0, 0,
2, 3, 4, 5, 4, 2, 1, 0, -9, -9, -6, -3, -1, -1, -1, -1,
- -6, -6, 4, 7, 0, -2, -1, -2, -1, -2, 5, 6, -1, -2, 0, -1,
+ -6, -6, 4, 7, 0, -2, -1, -2, -1, -2, 5, 6, -1, -2, 0, -1,
4, -1, 1, 0, -4, -2, 0, -2, 7, 1, -1, -2, -3, 1, 3, 1,
4, 2, 1, 3, 3, 1, 1, 2, 2, -2, -4, 0, 3, 1, 0, 0,
1, -4, -8, -4, 1, 2, 1, 0, 2, -3, -9, -6, 0, 3, 3, 2,
- -1, -1, 0, -1, -1, 0, 1, 2, 3, 1, -4, -8, -7, -3, 1, 2,
+ -1, -1, 0, -1, -1, 0, 1, 2, 3, 1, -4, -8, -7, -3, 1, 2,
2, -1, -3, -2, -1, 0, 1, 0, -1, 0, 5, 11, 9, 3, -1, -3,
- -1, -2, -2, -1, 1, 1, 1, 1, 0, -1, 0, 3, 6, 6, 5, 5,
+ -1, -2, -2, -1, 1, 1, 1, 1, 0, -1, 0, 3, 6, 6, 5, 5,
2, 1, -1, -1, -2, -5, -6, -4, 2, 2, 2, 1, -1, -4, -5, -5,
- -1, -3, -6, -7, -6, -4, -1, 1, 5, 5, 3, 4, 4, 3, 4, 5,
- -1, -2, -3, -2, -2, -2, 0, 1, 0, 0, 0, 0, 0, 1, 2, 3,
- -6, -6, -4, -1, 2, 2, 2, 2, -6, -7, -5, -2, 0, -1, -1, 0,
+ -1, -3, -6, -7, -6, -4, -1, 1, 5, 5, 3, 4, 4, 3, 4, 5,
+ -1, -2, -3, -2, -2, -2, 0, 1, 0, 0, 0, 0, 0, 1, 2, 3,
+ -6, -6, -4, -1, 2, 2, 2, 2, -6, -7, -5, -2, 0, -1, -1, 0,
2, 2, 2, 4, 4, 3, 3, 4, 2, 1, 0, -1, 0, 0, 2, 4,
- 12, 5, -5, -8, -5, 0, 2, 2, 2, -3, -6, -3, 0, 0, -1, -2,
- -2, -3, -1, 3, 4, 1, -2, -3, 2, 2, 3, 4, 3, 1, -1, -1,
+ 12, 5, -5, -8, -5, 0, 2, 2, 2, -3, -6, -3, 0, 0, -1, -2,
+ -2, -3, -1, 3, 4, 1, -2, -3, 2, 2, 3, 4, 3, 1, -1, -1,
3, 2, 1, 0, 1, 4, 3, 0, 4, 3, 0, -5, -6, 0, 3, 3,
- 2, 3, 1, -7, -12, -6, 1, 3, 1, 3, 4, -1, -6, -4, 0, 1,
- -9, -4, 2, 6, 7, 4, 1, 0, -7, -1, 4, 6, 4, 0, -3, -3,
- -6, 0, 4, 4, 1, -2, -3, -2, -4, 1, 3, 2, 0, -2, -1, 0,
+ 2, 3, 1, -7,-12, -6, 1, 3, 1, 3, 4, -1, -6, -4, 0, 1,
+ -9, -4, 2, 6, 7, 4, 1, 0, -7, -1, 4, 6, 4, 0, -3, -3,
+ -6, 0, 4, 4, 1, -2, -3, -2, -4, 1, 3, 2, 0, -2, -1, 0,
0, 5, 2, -5, -3, 3, 1, -4, -2, 4, 2, -6, -3, 6, 4, -3,
- -1, 5, 3, -5, -1, 7, 3, -4, -1, 2, 0, -6, -3, 5, 3, -3,
- -8, -3, 3, 5, 3, 1, -2, -2, 2, 4, 4, -2, -4, -3, 1, 3,
+ -1, 5, 3, -5, -1, 7, 3, -4, -1, 2, 0, -6, -3, 5, 3, -3,
+ -8, -3, 3, 5, 3, 1, -2, -2, 2, 4, 4, -2, -4, -3, 1, 3,
2, 1, -3, -5, -3, 3, 4, 3, -5, -6, -5, 3, 10, 8, -1, -5,
0, 3, 2, -4, -9, -7, 0, 6, -5, -1, 5, 7, 4, -1, -3, -3,
- -5, -5, -2, 3, 6, 5, -1, -4, 9, 6, 0, -4, -2, 1, 1, -1,
- -1, -1, -1, 1, 1, 0, -1, 0, -1, 0, 0, 0, 0, -1, -1, 0,
+ -5, -5, -2, 3, 6, 5, -1, -4, 9, 6, 0, -4, -2, 1, 1, -1,
+ -1, -1, -1, 1, 1, 0, -1, 0, -1, 0, 0, 0, 0, -1, -1, 0,
2, 1, -2, -1, 1, 1, 0, 0, 12, 8, 2, -1, -1, -4, -7, -7,
2, 1, 3, 6, 7, 4, 2, 0, 1, 0, -1, 0, -1, -4, -7, -8,
0, 0, -1, 0, 0, 0, -1, -3, 0, 0, 0, 0, 1, 1, 0, -2,
- -1, 0, 1, 1, 0, 0, -1, -2, 0, 0, -1, -3, -4, -3, -1, 1,
- -1, 0, 0, 0, 1, 4, 10, 12, -1, 0, -2, -2, -3, -3, -1, 1,
- -3, -1, -2, -4, 2, 9, 9, 7, -3, 0, -1, -3, 0, 2, -1, 1,
- -1, 1, -2, -3, 0, -1, -3, 0, 0, 0, -3, -2, 0, -1, -1, 1,
- -1, -2, -1, -1, -2, -1, -1, -2, 2, -1, -2, -1, 0, 1, 0, -2,
+ -1, 0, 1, 1, 0, 0, -1, -2, 0, 0, -1, -3, -4, -3, -1, 1,
+ -1, 0, 0, 0, 1, 4, 10, 12, -1, 0, -2, -2, -3, -3, -1, 1,
+ -3, -1, -2, -4, 2, 9, 9, 7, -3, 0, -1, -3, 0, 2, -1, 1,
+ -1, 1, -2, -3, 0, -1, -3, 0, 0, 0, -3, -2, 0, -1, -1, 1,
+ -1, -2, -1, -1, -2, -1, -1, -2, 2, -1, -2, -1, 0, 1, 0, -2,
3, -1, -2, 2, 5, 3, -1, -3, 1, -5, -5, 1, 6, 6, 2, 0,
1, 2, 0, -1, 0, 1, 0, -2, -5, -3, -1, 0, 1, 2, 1, -2,
- -7, -5, -2, -2, -2, -2, 0, 1, -1, 0, 1, 1, 0, 3, 9, 12,
+ -7, -5, -2, -2, -2, -2, 0, 1, -1, 0, 1, 1, 0, 3, 9, 12,
0, 6, 5, 1, -2, -3, 0, 3, 0, 6, 5, 1, 1, 1, 2, 3,
- -5, -2, -2, -3, 0, 0, 0, 0, -6, -3, -3, -2, 0, 0, -1, -2,
+ -5, -2, -2, -3, 0, 0, 0, 0, -6, -3, -3, -2, 0, 0, -1, -2,
4, 4, 2, 1, 0, -1, -1, 0, -2, -2, 0, 1, 2, 1, 1, 0,
- 2, 2, 1, -1, -3, -5, -9, -10, 2, 1, -1, -1, 1, 4, 4, 1,
+ 2, 2, 1, -1, -3, -5, -9,-10, 2, 1, -1, -1, 1, 4, 4, 1,
4, 0, -2, -2, -2, -2, -1, 0, 7, 1, -4, -3, -2, 0, 1, 1,
- 10, 5, -1, -2, 0, 1, 1, 0, 5, 1, -3, -4, -3, -1, -1, -2,
+ 10, 5, -1, -2, 0, 1, 1, 0, 5, 1, -3, -4, -3, -1, -1, -2,
2, 1, -1, -3, -3, 1, 1, -1, -2, -1, 3, 0, -1, 1, 1, 0,
- -3, 1, 7, 2, -3, -2, -1, 0, -2, 4, 8, -1, -8, -5, 0, 2,
- -4, -1, 1, 2, 1, -3, -4, -2, -5, -3, -2, 1, 4, 4, 4, 6,
- -3, -2, -4, -3, 0, 1, 1, 2, 2, 2, 2, 1, 2, 1, -1, -1,
- -4, -1, 0, -1, -3, -3, -1, -1, 1, 4, 4, 2, 0, -1, -2, -3,
+ -3, 1, 7, 2, -3, -2, -1, 0, -2, 4, 8, -1, -8, -5, 0, 2,
+ -4, -1, 1, 2, 1, -3, -4, -2, -5, -3, -2, 1, 4, 4, 4, 6,
+ -3, -2, -4, -3, 0, 1, 1, 2, 2, 2, 2, 1, 2, 1, -1, -1,
+ -4, -1, 0, -1, -3, -3, -1, -1, 1, 4, 4, 2, 0, -1, -2, -3,
4, 6, 5, 3, 2, 1, -2, -4, 0, 1, 1, 1, 1, -1, -4, -6,
1, 2, 2, -1, -6, -5, -1, 2, -3, -2, 1, 1, -4, -3, 2, 5,
- -2, -1, 2, 2, -3, -4, 0, 3, -2, -2, 2, 6, 5, 2, 1, 2,
+ -2, -1, 2, 2, -3, -4, 0, 3, -2, -2, 2, 6, 5, 2, 1, 2,
2, -3, -3, 0, 0, 2, 3, 1, 3, -1, 1, 3, 1, 2, -1, -5,
- -5, -7, -4, -2, 1, 8, 8, 1, -1, 0, 2, 0, -3, 0, 1, -3,
- -2, -5, -5, -2, -3, -1, 0, -2, -1, -4, 0, 4, 0, 2, 4, 0,
+ -5, -7, -4, -2, 1, 8, 8, 1, -1, 0, 2, 0, -3, 0, 1, -3,
+ -2, -5, -5, -2, -3, -1, 0, -2, -1, -4, 0, 4, 0, 2, 4, 0,
0, 0, 8, 10, 2, 1, 3, -1, -4, -3, 2, 3, -3, -3, 1, -1,
1, -2, -4, 2, 7, 3, -2, -1, 6, 4, -2, -1, 2, 0, -1, 3,
1, 1, -2, -2, -2, -5, -3, 4, -6, -2, 1, 1, -1, -4, -2, 4,
- -2, -1, -2, -2, 0, 1, 0, -2, -1, 1, 0, -1, 0, 0, -1, -3,
+ -2, -1, -2, -2, 0, 1, 0, -2, -1, 1, 0, -1, 0, 0, -1, -3,
0, 1, -2, -4, -3, -1, 0, 0, 6, 8, 5, 0, 0, 1, 2, 3,
- -2, -2, 2, 5, 2, 0, 0, 1, 2, -2, -2, -1, -1, 1, 2, 4,
+ -2, -2, 2, 5, 2, 0, 0, 1, 2, -2, -2, -1, -1, 1, 2, 4,
2, -1, 0, 1, 0, 0, 0, 1, -8, -7, -1, 1, -1, -1, 1, 3,
- 0, 3, 6, 2, -2, 1, 2, 0, -10, -7, -1, 0, -3, -1, 2, 1,
+ 0, 3, 6, 2, -2, 1, 2, 0,-10, -7, -1, 0, -3, -1, 2, 1,
0, 0, 2, 2, 1, 1, 1, -1, 3, 0, -2, -2, 0, 2, 1, 0,
8, 1, 0, 0, -2, -3, -1, 0, 2, -2, 2, 5, 1, -2, -1, 1,
- -3, -6, -3, -1, -3, -3, -1, 2, 2, 0, 1, 2, 2, 1, 0, 0,
+ -3, -6, -3, -1, -3, -3, -1, 2, 2, 0, 1, 2, 2, 1, 0, 0,
1, -1, -1, -2, -1, 0, 1, 0, 15, 9, 2, -1, -2, -3, -3, -3,
0, -3, -2, 0, 0, -1, -1, -1, 1, 0, 1, 0, 0, -1, -1, -1,
0, 2, 2, -2, -3, -3, -7, -8, 0, 2, 2, 0, 1, 2, 1, 1,
1, 2, 2, 2, 3, 1, 0, 3, 1, 0, -1, -2, -1, -2, 0, 5,
- -11, -6, -1, 1, 2, 3, 1, -3, 1, 4, 3, -1, -2, 1, 2, -1,
+ -11, -6, -1, 1, 2, 3, 1, -3, 1, 4, 3, -1, -2, 1, 2, -1,
2, 2, 1, -1, -2, 0, 1, -1, 0, 0, -1, -1, 0, 2, 3, 2,
1, 1, 2, 1, -1, 1, 0, -4, 0, 0, 0, -2, -2, 2, 4, -2,
- -2, -3, 0, 0, -1, 2, 1, -6, 0, 2, 5, 5, 3, 2, -1, -7,
+ -2, -3, 0, 0, -1, 2, 1, -6, 0, 2, 5, 5, 3, 2, -1, -7,
4, 2, 0, 0, 3, 3, 1, -1, 0, -1, -1, 3, 6, 4, 1, -1,
- -2, -2, 0, 2, 2, 0, -2, -2, -1, 0, -1, -5, -7, -5, -1, 1,
+ -2, -2, 0, 2, 2, 0, -2, -2, -1, 0, -1, -5, -7, -5, -1, 1,
5, -1, -2, 0, 2, 4, 2, -5, 0, -5, -2, 2, 1, 2, 0, -6,
6, 1, 0, 1, -2, -1, 4, 2, 2, -3, -3, 0, -1, -2, 0, 0,
1, -1, 0, 2, 0, 0, 6, 11, 2, -1, -1, 0, -3, -2, 3, 5,
0, -2, -1, 0, -1, 0, 0, -3, 1, -1, -1, -1, -2, -1, -3, -7,
1, 1, -2, -2, 1, 3, 1, -2, -1, 2, 0, -1, -1, 1, 0, 0,
- -4, 2, 3, -1, -2, -2, 0, 1, -11, -2, 4, 5, 6, 2, -1, -2,
- -6, -2, 1, -1, -3, -4, 1, 9, -3, 0, 3, 3, 2, -3, -3, 3,
+ -4, 2, 3, -1, -2, -2, 0, 1,-11, -2, 4, 5, 6, 2, -1, -2,
+ -6, -2, 1, -1, -3, -4, 1, 9, -3, 0, 3, 3, 2, -3, -3, 3,
1, 1, 0, 0, 1, -1, -2, 3, 2, 0, -3, -3, 0, -1, -1, 3,
1, -1, -3, 1, 2, -6, -4, 6, 0, -2, -5, -2, 0, -3, -2, 3,
2, 2, 1, -2, -2, 1, 2, -1, -1, 1, 1, -2, -1, 6, 7, -1,
1, 0, -4, -2, 1, -2, -3, 1, -4, 0, -3, -2, 2, 0, -3, 0,
- -3, 4, 3, 1, 8, 7, 0, -1, -3, 4, 1, -4, 2, 3, -2, -3,
- -3, 6, 1, -4, 1, 1, -1, -1, -2, 4, -3, -3, 3, 0, -1, -1,
+ -3, 4, 3, 1, 8, 7, 0, -1, -3, 4, 1, -4, 2, 3, -2, -3,
+ -3, 6, 1, -4, 1, 1, -1, -1, -2, 4, -3, -3, 3, 0, -1, -1,
1, 2, -4, 2, 4, -3, -1, 2, 3, -1, -4, 5, 4, -6, -3, 2
};
/* 6x16-entry codebook for inter-coded 8x8 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
-{
- -4, -3, 4, 5, 2, 1, 1, 0, -5, -3, 5, 5, 2, 1, 0, 0,
- -6, -4, 5, 5, 2, 1, 0, 0, -7, -4, 4, 5, 2, 1, 0, 0,
- -8, -5, 3, 4, 2, 1, 0, 0, -8, -6, 3, 4, 1, 1, 1, 0,
- -8, -6, 2, 4, 2, 1, 1, 0, -8, -6, 2, 4, 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, -2, -3, -3, -3, -3, -3, -4, -3,
- -2, -2, -2, -2, -2, -3, -3, -2, 1, 1, 1, 1, 1, 0, -1, -1,
+DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] = {
+ -4, -3, 4, 5, 2, 1, 1, 0, -5, -3, 5, 5, 2, 1, 0, 0,
+ -6, -4, 5, 5, 2, 1, 0, 0, -7, -4, 4, 5, 2, 1, 0, 0,
+ -8, -5, 3, 4, 2, 1, 0, 0, -8, -6, 3, 4, 1, 1, 1, 0,
+ -8, -6, 2, 4, 2, 1, 1, 0, -8, -6, 2, 4, 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, -2, -3, -3, -3, -3, -3, -4, -3,
+ -2, -2, -2, -2, -2, -3, -3, -2, 1, 1, 1, 1, 1, 0, -1, -1,
4, 5, 5, 5, 4, 3, 3, 2, 7, 7, 8, 8, 8, 7, 6, 5,
2, 1, 2, 4, 4, 0, -4, -6, 1, 1, 2, 5, 5, 1, -5, -7,
1, 2, 1, 4, 5, 1, -5, -8, 1, 1, 1, 5, 5, 0, -6, -8,
@@ -409,51 +405,51 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
2, 2, 2, 2, 1, 0, 0, -1, 4, 4, 4, 3, 2, 1, 1, 0,
4, 5, 4, 4, 3, 3, 2, 1, 4, 4, 4, 4, 4, 3, 2, 2,
2, 3, 3, 3, 3, 3, 2, 1, -1, -1, -1, -1, 0, 0, 0, 0,
- -5, -6, -6, -5, -5, -4, -3, -3, -7, -9, -9, -8, -7, -6, -6, -5,
+ -5, -6, -6, -5, -5, -4, -3, -3, -7, -9, -9, -8, -7, -6, -6, -5,
6, 6, 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2,
0, -1, -1, -1, -2, -2, -1, -1, -3, -5, -6, -6, -6, -6, -5, -4,
- -3, -5, -6, -7, -6, -6, -5, -4, -1, -2, -2, -2, -2, -2, -1, -1,
+ -3, -5, -6, -7, -6, -6, -5, -4, -1, -2, -2, -2, -2, -2, -1, -1,
0, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
2, 1, -2, -5, -4, 0, 2, 5, 2, 1, -2, -6, -5, 0, 3, 5,
2, 1, -2, -6, -6, -1, 3, 6, 3, 2, -2, -7, -6, 0, 4, 7,
2, 1, -2, -7, -5, 0, 5, 7, 2, 1, -2, -6, -5, 0, 4, 7,
2, 1, -2, -6, -4, 0, 4, 6, 1, 1, -2, -5, -4, 0, 3, 6,
- -10, -9, -6, -4, -1, 2, 3, 2, -10, -9, -5, -3, 0, 4, 4, 3,
- -9, -7, -3, -1, 2, 5, 5, 3, -7, -5, -2, 0, 3, 5, 5, 3,
- -6, -3, 0, 1, 4, 6, 5, 3, -4, -2, 1, 2, 3, 5, 4, 2,
- -2, 0, 1, 2, 2, 4, 3, 1, -1, 1, 2, 2, 2, 3, 3, 1,
- -4, -5, -5, -6, -6, -6, -6, -5, -3, -3, -4, -4, -4, -4, -4, -4,
+ -10, -9, -6, -4, -1, 2, 3, 2,-10, -9, -5, -3, 0, 4, 4, 3,
+ -9, -7, -3, -1, 2, 5, 5, 3, -7, -5, -2, 0, 3, 5, 5, 3,
+ -6, -3, 0, 1, 4, 6, 5, 3, -4, -2, 1, 2, 3, 5, 4, 2,
+ -2, 0, 1, 2, 2, 4, 3, 1, -1, 1, 2, 2, 2, 3, 3, 1,
+ -4, -5, -5, -6, -6, -6, -6, -5, -3, -3, -4, -4, -4, -4, -4, -4,
0, 0, 0, 0, -1, -1, -1, -1, 5, 5, 6, 5, 5, 4, 3, 2,
5, 6, 7, 7, 7, 6, 5, 4, 3, 3, 4, 4, 4, 4, 3, 2,
0, -1, 0, 0, -1, -1, 0, -1, -3, -3, -4, -4, -4, -4, -3, -3,
1, -2, -5, 1, 5, 4, 2, 0, 1, -3, -6, 1, 6, 5, 2, 0,
0, -4, -7, 0, 6, 6, 2, 1, -1, -5, -9, -1, 6, 6, 3, 1,
- -1, -6, -10, -2, 6, 6, 3, 1, -1, -6, -9, -2, 5, 6, 3, 1,
- -2, -6, -9, -2, 5, 5, 3, 1, -2, -6, -7, -2, 4, 4, 2, 1,
- -5, -7, -8, -9, -9, -8, -7, -6, -5, -6, -6, -7, -7, -6, -6, -5,
- -3, -3, -3, -4, -5, -5, -4, -4, -1, 0, 0, -1, -1, -1, -1, -1,
+ -1, -6,-10, -2, 6, 6, 3, 1, -1, -6, -9, -2, 5, 6, 3, 1,
+ -2, -6, -9, -2, 5, 5, 3, 1, -2, -6, -7, -2, 4, 4, 2, 1,
+ -5, -7, -8, -9, -9, -8, -7, -6, -5, -6, -6, -7, -7, -6, -6, -5,
+ -3, -3, -3, -4, -5, -5, -4, -4, -1, 0, 0, -1, -1, -1, -1, -1,
0, 1, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 5, 5, 5, 4,
3, 4, 5, 6, 8, 8, 8, 7, 3, 4, 5, 6, 7, 7, 7, 6,
5, 6, 7, 8, 9, 10, 10, 9, 3, 4, 6, 7, 8, 9, 9, 8,
0, 1, 2, 3, 4, 5, 5, 5, -1, -2, -1, -1, 0, 1, 2, 2,
- -2, -3, -3, -3, -3, -2, -1, 0, -3, -4, -5, -5, -5, -5, -5, -4,
- -4, -5, -5, -6, -7, -7, -6, -5, -3, -4, -5, -6, -7, -7, -6, -6,
- 13, 7, 0, -3, -3, -4, -4, -5, 14, 7, 0, -3, -3, -4, -4, -4,
- 15, 8, -1, -4, -4, -4, -5, -4, 15, 8, -1, -4, -4, -5, -4, -3,
- 15, 7, -1, -4, -5, -5, -5, -4, 14, 7, -1, -4, -4, -4, -4, -3,
- 12, 6, -1, -4, -4, -4, -4, -3, 11, 5, -1, -4, -4, -4, -4, -3,
- -17, -4, 5, 4, 4, 4, 3, 3, -18, -5, 5, 4, 4, 4, 3, 3,
- -19, -5, 6, 4, 4, 4, 3, 2, -20, -5, 6, 4, 4, 4, 3, 3,
- -20, -4, 6, 4, 4, 5, 3, 3, -19, -5, 6, 4, 4, 5, 3, 3,
- -18, -4, 5, 4, 4, 4, 3, 2, -17, -5, 4, 3, 4, 4, 3, 3,
- -6, -6, -6, -4, -2, 1, 6, 11, -6, -7, -7, -4, -2, 2, 8, 13,
- -8, -8, -7, -4, -2, 3, 9, 14, -8, -8, -7, -5, -1, 4, 10, 16,
- -8, -8, -7, -5, -1, 4, 10, 17, -8, -8, -7, -4, 0, 5, 10, 16,
- -8, -8, -6, -3, 0, 4, 9, 15, -7, -7, -5, -3, 0, 4, 8, 12,
- 8, 7, 7, 5, 2, -2, -8, -14, 8, 8, 7, 5, 2, -2, -8, -15,
- 8, 8, 7, 5, 1, -3, -9, -16, 8, 8, 7, 5, 1, -3, -10, -17,
- 8, 9, 8, 5, 1, -3, -10, -17, 8, 8, 7, 4, 1, -4, -10, -16,
- 7, 7, 7, 4, 1, -3, -9, -14, 6, 7, 6, 3, 0, -3, -9, -13,
+ -2, -3, -3, -3, -3, -2, -1, 0, -3, -4, -5, -5, -5, -5, -5, -4,
+ -4, -5, -5, -6, -7, -7, -6, -5, -3, -4, -5, -6, -7, -7, -6, -6,
+ 13, 7, 0, -3, -3, -4, -4, -5, 14, 7, 0, -3, -3, -4, -4, -4,
+ 15, 8, -1, -4, -4, -4, -5, -4, 15, 8, -1, -4, -4, -5, -4, -3,
+ 15, 7, -1, -4, -5, -5, -5, -4, 14, 7, -1, -4, -4, -4, -4, -3,
+ 12, 6, -1, -4, -4, -4, -4, -3, 11, 5, -1, -4, -4, -4, -4, -3,
+ -17, -4, 5, 4, 4, 4, 3, 3,-18, -5, 5, 4, 4, 4, 3, 3,
+ -19, -5, 6, 4, 4, 4, 3, 2,-20, -5, 6, 4, 4, 4, 3, 3,
+ -20, -4, 6, 4, 4, 5, 3, 3,-19, -5, 6, 4, 4, 5, 3, 3,
+ -18, -4, 5, 4, 4, 4, 3, 2,-17, -5, 4, 3, 4, 4, 3, 3,
+ -6, -6, -6, -4, -2, 1, 6, 11, -6, -7, -7, -4, -2, 2, 8, 13,
+ -8, -8, -7, -4, -2, 3, 9, 14, -8, -8, -7, -5, -1, 4, 10, 16,
+ -8, -8, -7, -5, -1, 4, 10, 17, -8, -8, -7, -4, 0, 5, 10, 16,
+ -8, -8, -6, -3, 0, 4, 9, 15, -7, -7, -5, -3, 0, 4, 8, 12,
+ 8, 7, 7, 5, 2, -2, -8,-14, 8, 8, 7, 5, 2, -2, -8,-15,
+ 8, 8, 7, 5, 1, -3, -9,-16, 8, 8, 7, 5, 1, -3,-10,-17,
+ 8, 9, 8, 5, 1, -3,-10,-17, 8, 8, 7, 4, 1, -4,-10,-16,
+ 7, 7, 7, 4, 1, -3, -9,-14, 6, 7, 6, 3, 0, -3, -9,-13,
5, 1, -4, -4, -3, -1, 0, 0, 7, 2, -3, -3, -2, -1, 1, 0,
7, 1, -3, -3, -1, 0, 1, 1, 6, 1, -3, -2, -1, 1, 1, 0,
6, 0, -4, -2, -1, 0, 1, 0, 5, 0, -4, -3, -1, 0, 0, -1,
@@ -462,22 +458,22 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
1, 1, 1, 0, -1, -3, -5, -5, 0, 0, 0, 0, -1, -1, -1, -2,
0, -1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 3, 2,
2, 1, 1, 1, 2, 3, 4, 3, 3, 3, 3, 3, 4, 4, 5, 4,
- -4, -4, -3, -2, 0, 0, 1, 1, -4, -4, -3, -2, -1, 0, 0, 1,
- -2, -2, -2, -1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1,
+ -4, -4, -3, -2, 0, 0, 1, 1, -4, -4, -3, -2, -1, 0, 0, 1,
+ -2, -2, -2, -1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1,
2, 2, 2, 2, 2, 2, 1, 1, 3, 4, 4, 4, 4, 4, 4, 3,
1, 1, 1, 3, 3, 4, 3, 3, -5, -6, -5, -4, -3, -3, -2, -2,
- -4, -2, -1, -1, -1, -1, 0, 1, -4, -2, -1, -1, -1, -1, 0, 1,
- -3, -2, -1, -1, -1, 0, 1, 2, -4, -3, -2, -1, -1, 1, 3, 3,
- -4, -3, -3, -1, -1, 1, 4, 5, -4, -3, -2, -2, -1, 1, 4, 7,
- -2, -2, -1, -1, 0, 2, 6, 8, -1, 0, 0, 1, 1, 4, 7, 8,
- -3, -3, -3, -2, -2, -1, -1, 0, -1, -1, 0, 1, 2, 2, 3, 3,
+ -4, -2, -1, -1, -1, -1, 0, 1, -4, -2, -1, -1, -1, -1, 0, 1,
+ -3, -2, -1, -1, -1, 0, 1, 2, -4, -3, -2, -1, -1, 1, 3, 3,
+ -4, -3, -3, -1, -1, 1, 4, 5, -4, -3, -2, -2, -1, 1, 4, 7,
+ -2, -2, -1, -1, 0, 2, 6, 8, -1, 0, 0, 1, 1, 4, 7, 8,
+ -3, -3, -3, -2, -2, -1, -1, 0, -1, -1, 0, 1, 2, 2, 3, 3,
0, 1, 2, 4, 5, 6, 6, 5, -1, 0, 2, 3, 5, 6, 5, 3,
- -1, -1, 0, 2, 3, 3, 2, 1, -2, -2, -1, 0, -1, -3, -4, -4,
+ -1, -1, 0, 2, 3, 3, 2, 1, -2, -2, -1, 0, -1, -3, -4, -4,
0, 0, -1, -1, -2, -4, -8, -7, 1, 2, 1, 0, -1, -4, -6, -7,
- -2, 4, 1, -6, 0, 3, 0, 0, -2, 5, 1, -7, 0, 3, 0, 0,
- -3, 5, 1, -8, 0, 3, -1, -1, -2, 6, 1, -9, 0, 3, 0, -1,
- -2, 6, 2, -8, 0, 4, 0, -1, -3, 5, 1, -7, 1, 4, 0, 0,
- -2, 4, 1, -7, 0, 4, 1, 0, -1, 4, 1, -6, 0, 3, 1, 0,
+ -2, 4, 1, -6, 0, 3, 0, 0, -2, 5, 1, -7, 0, 3, 0, 0,
+ -3, 5, 1, -8, 0, 3, -1, -1, -2, 6, 1, -9, 0, 3, 0, -1,
+ -2, 6, 2, -8, 0, 4, 0, -1, -3, 5, 1, -7, 1, 4, 0, 0,
+ -2, 4, 1, -7, 0, 4, 1, 0, -1, 4, 1, -6, 0, 3, 1, 0,
0, 0, 0, 3, 4, 5, 4, 1, 1, 1, 1, 2, 3, 3, 2, 0,
2, 2, 1, 2, 2, 1, -1, -2, 4, 3, 1, 1, 0, -1, -3, -5,
5, 3, 1, -1, -2, -3, -4, -6, 5, 3, 0, -2, -3, -5, -6, -7,
@@ -488,59 +484,59 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
0, -1, 0, 1, -1, -6, -3, 8, 0, 0, 0, 1, 0, -5, -2, 7,
2, 3, 3, 2, 1, 0, -1, -1, 3, 4, 3, 2, 1, 0, -1, -2,
3, 4, 4, 2, 1, -1, -2, -3, 2, 3, 3, 2, 0, -1, -2, -3,
- -1, 0, 1, 1, 0, -1, -2, -2, -5, -4, -3, -1, 0, 1, 1, 1,
- -8, -8, -5, -1, 1, 3, 4, 3, -10, -9, -5, 0, 3, 5, 6, 5,
- -5, -1, 4, 5, 3, 1, 0, 0, -6, -1, 4, 5, 2, 0, -1, -2,
- -6, -1, 5, 4, 2, -1, -2, -2, -7, -1, 4, 4, 1, -2, -3, -3,
- -6, -1, 5, 4, 1, -2, -3, -3, -5, 0, 4, 4, 1, -1, -2, -2,
- -4, 0, 5, 4, 1, -1, -1, -2, -3, 1, 4, 3, 1, -1, -1, -2,
- -2, -3, -2, 1, 4, 6, 5, 3, -3, -4, -4, 0, 3, 5, 4, 2,
- -3, -5, -5, -1, 2, 4, 3, 1, -4, -6, -4, -1, 2, 4, 2, -1,
- -2, -4, -3, 1, 2, 4, 2, -1, -2, -4, -2, 1, 3, 3, 1, -2,
- -2, -3, -2, 1, 3, 3, 1, -2, -2, -2, -1, 1, 3, 3, 0, -2,
- -4, -4, -3, -2, -1, 2, 5, 7, -4, -4, -3, -3, -2, 1, 5, 7,
- -2, -3, -2, -3, -3, -1, 3, 5, -1, -1, 0, -2, -3, -2, 2, 4,
+ -1, 0, 1, 1, 0, -1, -2, -2, -5, -4, -3, -1, 0, 1, 1, 1,
+ -8, -8, -5, -1, 1, 3, 4, 3,-10, -9, -5, 0, 3, 5, 6, 5,
+ -5, -1, 4, 5, 3, 1, 0, 0, -6, -1, 4, 5, 2, 0, -1, -2,
+ -6, -1, 5, 4, 2, -1, -2, -2, -7, -1, 4, 4, 1, -2, -3, -3,
+ -6, -1, 5, 4, 1, -2, -3, -3, -5, 0, 4, 4, 1, -1, -2, -2,
+ -4, 0, 5, 4, 1, -1, -1, -2, -3, 1, 4, 3, 1, -1, -1, -2,
+ -2, -3, -2, 1, 4, 6, 5, 3, -3, -4, -4, 0, 3, 5, 4, 2,
+ -3, -5, -5, -1, 2, 4, 3, 1, -4, -6, -4, -1, 2, 4, 2, -1,
+ -2, -4, -3, 1, 2, 4, 2, -1, -2, -4, -2, 1, 3, 3, 1, -2,
+ -2, -3, -2, 1, 3, 3, 1, -2, -2, -2, -1, 1, 3, 3, 0, -2,
+ -4, -4, -3, -2, -1, 2, 5, 7, -4, -4, -3, -3, -2, 1, 5, 7,
+ -2, -3, -2, -3, -3, -1, 3, 5, -1, -1, 0, -2, -3, -2, 2, 4,
1, 1, 1, -1, -4, -3, 1, 3, 4, 3, 2, -1, -4, -3, -1, 1,
6, 4, 3, 0, -3, -3, -2, 0, 6, 5, 3, 1, -2, -3, -2, -1,
- 12, 11, 8, 4, 0, -2, -2, -1, 10, 9, 6, 2, -1, -2, -1, 0,
+ 12, 11, 8, 4, 0, -2, -2, -1, 10, 9, 6, 2, -1, -2, -1, 0,
4, 3, 2, 0, -1, -1, 0, 1, -1, -1, -1, -1, -2, 0, 1, 2,
- -3, -5, -4, -2, -2, 0, 2, 3, -5, -5, -4, -2, -1, 0, 1, 2,
- -5, -5, -4, -2, -1, 0, 1, 1, -4, -4, -3, -2, -2, -1, 0, 0,
+ -3, -5, -4, -2, -2, 0, 2, 3, -5, -5, -4, -2, -1, 0, 1, 2,
+ -5, -5, -4, -2, -1, 0, 1, 1, -4, -4, -3, -2, -2, -1, 0, 0,
3, 3, 2, -1, -3, -4, -3, -2, 3, 2, 0, -2, -4, -4, -3, -2,
2, 2, 1, -1, -3, -5, -4, -3, 3, 3, 3, 1, -2, -3, -3, -3,
4, 4, 4, 3, 0, -2, -2, -2, 5, 5, 5, 3, 0, -1, -2, -2,
5, 5, 4, 2, -1, -2, -3, -2, 3, 3, 3, 0, -2, -4, -4, -4,
- -1, -1, 4, -2, -2, 6, 2, -5, -1, 0, 4, -2, -3, 6, 2, -6,
- -1, 0, 4, -2, -3, 7, 3, -7, -1, -1, 4, -3, -4, 8, 3, -7,
+ -1, -1, 4, -2, -2, 6, 2, -5, -1, 0, 4, -2, -3, 6, 2, -6,
+ -1, 0, 4, -2, -3, 7, 3, -7, -1, -1, 4, -3, -4, 8, 3, -7,
0, -1, 4, -3, -4, 7, 3, -6, -1, -1, 4, -3, -4, 7, 3, -6,
- -1, -1, 3, -3, -4, 6, 3, -6, -1, 0, 3, -2, -3, 6, 3, -5,
+ -1, -1, 3, -3, -4, 6, 3, -6, -1, 0, 3, -2, -3, 6, 3, -5,
1, -2, -7, 2, 5, -2, -1, 1, 1, -2, -8, 3, 6, -3, -1, 2,
2, -2, -9, 4, 7, -4, -2, 2, 3, -1, -9, 5, 7, -4, -1, 3,
3, -1, -9, 4, 7, -4, -2, 2, 3, -1, -7, 4, 6, -4, -2, 1,
2, 0, -6, 4, 6, -4, -1, 1, 2, 0, -5, 3, 4, -3, -1, 1,
- -2, 2, 2, 0, 0, -1, -3, -4, -2, 2, 2, 1, 1, 0, -2, -4,
- -2, 2, 2, 2, 2, 1, -1, -2, -3, 2, 3, 3, 4, 2, 0, -2,
- -3, 2, 3, 2, 4, 2, 0, -3, -4, 1, 2, 1, 2, 1, -1, -3,
- -5, 0, 1, 0, 1, 1, -2, -3, -4, 0, 0, 0, 1, 0, -2, -3,
+ -2, 2, 2, 0, 0, -1, -3, -4, -2, 2, 2, 1, 1, 0, -2, -4,
+ -2, 2, 2, 2, 2, 1, -1, -2, -3, 2, 3, 3, 4, 2, 0, -2,
+ -3, 2, 3, 2, 4, 2, 0, -3, -4, 1, 2, 1, 2, 1, -1, -3,
+ -5, 0, 1, 0, 1, 1, -2, -3, -4, 0, 0, 0, 1, 0, -2, -3,
0, 0, -1, -2, -2, 2, 7, 8, 0, 0, -1, -3, -2, 1, 6, 7,
0, 1, -1, -3, -3, 0, 4, 5, 0, 1, 0, -1, -1, 0, 1, 3,
0, 2, 1, 1, 0, -1, 0, 1, -2, 0, 1, 2, 1, 0, -1, -1,
- -5, -2, 0, 1, 1, 0, -3, -3, -6, -4, -1, 1, 1, -1, -3, -4,
- -4, -2, 2, 5, 6, 4, 3, 2, -5, -3, 1, 4, 4, 2, 0, 0,
- -4, -2, 0, 2, 1, -1, -2, -2, -2, -1, 0, 1, 0, -2, -3, -2,
- -2, 0, 0, 0, -1, -1, -2, -1, -2, -1, -1, 0, 0, 0, 1, 2,
- -2, -2, -1, -1, 0, 1, 3, 4, -2, -3, -2, -1, 0, 2, 4, 5,
+ -5, -2, 0, 1, 1, 0, -3, -3, -6, -4, -1, 1, 1, -1, -3, -4,
+ -4, -2, 2, 5, 6, 4, 3, 2, -5, -3, 1, 4, 4, 2, 0, 0,
+ -4, -2, 0, 2, 1, -1, -2, -2, -2, -1, 0, 1, 0, -2, -3, -2,
+ -2, 0, 0, 0, -1, -1, -2, -1, -2, -1, -1, 0, 0, 0, 1, 2,
+ -2, -2, -1, -1, 0, 1, 3, 4, -2, -3, -2, -1, 0, 2, 4, 5,
2, 1, -2, -2, -1, 0, 1, 0, 1, 0, -3, -3, -1, 0, 1, 0,
0, -1, -3, -3, -1, 1, 1, 1, 0, 0, -3, -1, 1, 2, 3, 3,
0, -1, -3, -1, 1, 3, 3, 3, -2, -2, -4, -2, 1, 3, 4, 4,
- -3, -3, -4, -2, 1, 3, 3, 4, -2, -3, -5, -2, 1, 2, 3, 3,
+ -3, -3, -4, -2, 1, 3, 3, 4, -2, -3, -5, -2, 1, 2, 3, 3,
4, 5, 3, 4, 4, 4, 4, 5, 3, 3, 1, 0, 0, 0, 0, 1,
1, 1, -1, -2, -3, -4, -3, -2, 2, 2, 0, -2, -2, -4, -3, -2,
2, 3, 1, -1, -1, -3, -3, -2, 1, 2, 0, 0, -1, -2, -2, -1,
0, 1, 0, -1, -1, -3, -2, -1, 1, 1, 0, -1, -1, -2, -2, -2,
- -2, -1, -1, 0, 1, 2, 1, 0, 1, 2, 3, 5, 6, 5, 5, 3,
+ -2, -1, -1, 0, 1, 2, 1, 0, 1, 2, 3, 5, 6, 5, 5, 3,
1, 2, 3, 4, 5, 5, 4, 3, -2, -2, -3, -3, -2, -1, 0, 0,
- -3, -3, -4, -5, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1, 0, 0,
+ -3, -3, -4, -5, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1, 0, 0,
0, 1, 0, -1, -1, 0, 0, 1, -1, 0, -1, -2, -3, -2, -2, -1,
7, 7, 6, 5, 4, 2, -1, -2, 3, 3, 2, 2, 1, 0, -2, -3,
0, -1, -1, -1, 0, -1, -2, -2, -1, -3, -2, -1, 0, 0, 0, 1,
@@ -548,19 +544,19 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
3, 1, -2, -3, -2, -1, 1, 2, 1, -2, -5, -6, -5, -3, -2, 0,
0, -1, -2, -3, -1, 0, -2, -2, 0, 0, -1, -1, 0, 1, -1, -2,
0, 0, -2, -1, 0, 0, 0, -2, -1, -2, -3, -3, -2, -1, -3, -3,
- -1, -2, -3, -3, -2, -2, -3, -4, 2, 2, 0, 0, 0, 0, -1, -2,
+ -1, -2, -3, -3, -2, -2, -3, -4, 2, 2, 0, 0, 0, 0, -1, -2,
5, 5, 3, 2, 2, 2, 0, -1, 8, 8, 6, 5, 4, 4, 2, 1,
- -7, -8, -6, -3, -1, -1, -2, -1, -5, -5, -3, 0, 2, 1, 0, 0,
- -1, -1, 0, 3, 4, 3, 1, 1, 2, 1, 1, 3, 4, 3, 2, 2,
+ -7, -8, -6, -3, -1, -1, -2, -1, -5, -5, -3, 0, 2, 1, 0, 0,
+ -1, -1, 0, 3, 4, 3, 1, 1, 2, 1, 1, 3, 4, 3, 2, 2,
3, 2, 0, 2, 3, 2, 1, 2, 4, 2, -1, -1, 0, 1, 1, 1,
3, 2, -2, -3, -2, -1, 0, 1, 3, 1, -3, -4, -3, -2, 0, 1,
- -4, -2, -1, 2, 3, 3, 1, 0, -7, -5, -4, -2, 0, 0, -1, -2,
- -6, -5, -5, -4, -2, -2, -2, -3, -1, 0, -1, -1, 0, 0, 0, -1,
+ -4, -2, -1, 2, 3, 3, 1, 0, -7, -5, -4, -2, 0, 0, -1, -2,
+ -6, -5, -5, -4, -2, -2, -2, -3, -1, 0, -1, -1, 0, 0, 0, -1,
2, 3, 2, 2, 2, 2, 1, 0, 3, 5, 4, 3, 1, 0, 1, 0,
3, 4, 3, 2, 0, -1, -1, -1, 5, 5, 3, 1, 0, -1, -1, -1,
1, 1, 0, -1, -3, -5, -6, -4, 1, 1, 0, 0, 0, -3, -3, -1,
0, -1, -1, 0, 1, 0, 1, 3, -2, -2, -3, -1, 2, 2, 4, 7,
- -2, -2, -2, 0, 2, 2, 3, 6, -1, 0, 0, 1, 1, 0, 0, 3,
+ -2, -2, -2, 0, 2, 2, 3, 6, -1, 0, 0, 1, 1, 0, 0, 3,
0, 3, 3, 3, 1, -2, -3, -1, 1, 3, 4, 3, 0, -3, -5, -4,
0, 2, 0, -1, -3, -4, -2, -2, 1, 4, 2, 0, -2, -3, -2, -1,
3, 6, 3, 1, -2, -2, 0, -1, 4, 7, 4, 1, -2, -3, -1, 0,
@@ -570,14 +566,14 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
1, -1, -2, 0, 1, 0, -2, -3, 0, -2, -1, 1, 3, 1, -3, -5,
0, -2, -1, 2, 5, 2, -3, -5, 0, -2, -1, 4, 6, 3, -2, -5,
0, -2, 0, 4, 7, 4, -2, -4, 0, -2, 0, 4, 6, 4, -2, -4,
- -2, -2, -3, -4, -3, -2, -1, 0, 1, 1, 0, -1, -1, -1, 0, 1,
+ -2, -2, -3, -4, -3, -2, -1, 0, 1, 1, 0, -1, -1, -1, 0, 1,
3, 3, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 0, 0, 1,
0, 0, 0, 0, -1, -1, -1, -1, -4, -4, -4, -4, -4, -4, -4, -3,
- -3, -3, -2, -3, -2, -1, -1, 0, 3, 4, 4, 5, 5, 6, 6, 7,
- -1, -2, 7, -2, -4, -1, -1, 0, -1, -2, 9, -1, -4, -1, -1, 0,
- -1, -3, 10, -1, -4, -1, -1, 1, -1, -3, 10, -2, -3, -1, -1, 2,
- -1, -2, 10, -2, -4, -1, -1, 2, -1, -2, 9, -2, -4, -1, -1, 2,
- -1, -2, 8, -2, -4, 0, -1, 1, 0, -2, 7, -2, -3, -1, 0, 2,
+ -3, -3, -2, -3, -2, -1, -1, 0, 3, 4, 4, 5, 5, 6, 6, 7,
+ -1, -2, 7, -2, -4, -1, -1, 0, -1, -2, 9, -1, -4, -1, -1, 0,
+ -1, -3, 10, -1, -4, -1, -1, 1, -1, -3, 10, -2, -3, -1, -1, 2,
+ -1, -2, 10, -2, -4, -1, -1, 2, -1, -2, 9, -2, -4, -1, -1, 2,
+ -1, -2, 8, -2, -4, 0, -1, 1, 0, -2, 7, -2, -3, -1, 0, 2,
3, -4, 1, 3, -3, -2, 1, 0, 3, -5, 1, 4, -3, -2, 1, 0,
3, -6, 2, 5, -3, -1, 3, 0, 3, -6, 2, 5, -3, -1, 2, 0,
3, -6, 1, 5, -4, -2, 3, 0, 3, -6, 1, 5, -3, -2, 2, 0,
@@ -590,45 +586,45 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
1, 0, 0, -1, 0, 0, -2, -5, 2, 1, 1, 1, 1, 2, -1, -3,
1, 1, 2, 1, 2, 2, 1, -1, 1, 1, 2, 1, 1, 1, 1, 1,
0, 0, 2, 1, 0, 0, 2, 2, 0, 1, 2, 2, 0, 0, 2, 2,
- -4, -3, 0, 1, 4, 6, 4, 3, -3, -2, 0, 0, 2, 4, 1, 0,
- -1, -1, 0, 0, 1, 1, -2, -3, 1, 1, 1, 0, 1, 1, -3, -5,
+ -4, -3, 0, 1, 4, 6, 4, 3, -3, -2, 0, 0, 2, 4, 1, 0,
+ -1, -1, 0, 0, 1, 1, -2, -3, 1, 1, 1, 0, 1, 1, -3, -5,
1, 1, 1, 0, 1, 1, -3, -5, -1, 0, 0, -1, 1, 1, -2, -4,
- -1, 0, 0, -1, 1, 2, 0, -2, -1, 0, 0, 0, 2, 3, 1, 0,
- -1, 0, 3, 4, 0, -4, -5, -5, 0, 0, 4, 5, 2, -2, -3, -2,
+ -1, 0, 0, -1, 1, 2, 0, -2, -1, 0, 0, 0, 2, 3, 1, 0,
+ -1, 0, 3, 4, 0, -4, -5, -5, 0, 0, 4, 5, 2, -2, -3, -2,
0, -1, 2, 4, 2, -1, -1, 0, 0, -2, -1, 1, 0, -2, 0, 1,
1, -2, -2, 0, 0, -1, -1, 1, 1, -2, -3, 0, 1, 0, -1, 0,
1, -2, -2, 1, 3, 1, 0, 0, 1, -2, -1, 2, 4, 2, 0, 0,
1, 2, 3, 2, 0, 2, 2, 1, -1, 0, 1, 0, -3, 1, 1, 1,
- -1, 0, 0, -2, -4, 0, 2, 1, -1, 2, 2, -1, -5, 0, 2, 1,
- -1, 3, 4, -1, -5, 0, 2, 1, -2, 2, 4, 0, -4, -1, 0, 0,
- -4, 0, 2, 0, -4, -2, 0, 0, -5, -1, 2, 1, -2, 1, 3, 2,
+ -1, 0, 0, -2, -4, 0, 2, 1, -1, 2, 2, -1, -5, 0, 2, 1,
+ -1, 3, 4, -1, -5, 0, 2, 1, -2, 2, 4, 0, -4, -1, 0, 0,
+ -4, 0, 2, 0, -4, -2, 0, 0, -5, -1, 2, 1, -2, 1, 3, 2,
1, 0, 1, 0, 1, 2, -1, -2, 2, 0, -1, -2, 1, 3, 0, -1,
3, 0, -2, -4, 0, 3, 1, 0, 5, 1, -3, -5, -2, 2, 1, 1,
6, 1, -2, -5, -2, 1, 0, 1, 5, 1, -1, -5, -2, 0, -1, 0,
3, 0, -2, -4, -2, 0, -1, 0, 1, -1, 0, -2, 0, 1, 0, 1,
1, 1, 2, 3, 2, 1, 1, 2, -1, -1, 0, 1, 1, 0, 1, 1,
- -4, -3, 0, 0, 1, 1, 1, 2, -4, -3, 0, 2, 2, 2, 3, 2,
- -5, -4, 0, 1, 1, 1, 1, 2, -5, -4, -1, -1, -2, -2, -1, 0,
- -3, -2, 0, 0, -2, -3, -2, -1, 2, 3, 4, 4, 2, 0, 0, 0,
- -4, -2, 0, 1, 0, 0, 0, 0, -3, -1, 1, 1, 0, 0, 0, 0,
- -2, 0, 2, 2, 0, 0, 0, 2, -1, 1, 2, 1, -1, 0, 3, 5,
+ -4, -3, 0, 0, 1, 1, 1, 2, -4, -3, 0, 2, 2, 2, 3, 2,
+ -5, -4, 0, 1, 1, 1, 1, 2, -5, -4, -1, -1, -2, -2, -1, 0,
+ -3, -2, 0, 0, -2, -3, -2, -1, 2, 3, 4, 4, 2, 0, 0, 0,
+ -4, -2, 0, 1, 0, 0, 0, 0, -3, -1, 1, 1, 0, 0, 0, 0,
+ -2, 0, 2, 2, 0, 0, 0, 2, -1, 1, 2, 1, -1, 0, 3, 5,
0, 2, 1, -1, -2, 0, 5, 6, 0, 1, 0, -3, -3, 0, 4, 6,
1, 1, -2, -4, -4, -3, 1, 2, 1, 0, -2, -4, -5, -4, -2, 0,
- -1, -3, -3, -3, -3, -2, -1, -1, 3, 2, 1, 0, 0, 1, 1, 1,
+ -1, -3, -3, -3, -3, -2, -1, -1, 3, 2, 1, 0, 0, 1, 1, 1,
5, 4, 3, 2, 1, 1, 2, 2, 2, 1, 0, -2, -2, -2, -1, -1,
0, 0, 0, -1, -2, -2, -2, -2, 0, 1, 3, 3, 2, 1, -1, -1,
0, 1, 3, 4, 3, 2, 1, -1, -4, -3, -1, 1, 0, -2, -3, -3,
- -3, -4, -7, -8, -7, -4, -1, 2, 0, -1, -3, -4, -4, -2, 0, 2,
+ -3, -4, -7, -8, -7, -4, -1, 2, 0, -1, -3, -4, -4, -2, 0, 2,
1, 0, 0, -1, -3, -2, 0, 2, 2, 1, 1, 0, -1, -1, 0, 2,
1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 1, 2, 3, 3, 2, 2, 0, 0, 1, 3, 4, 4, 3, 2,
3, 3, 3, 0, -1, 0, 1, 2, 1, 1, 1, -1, -2, -1, -1, 1,
- -2, -2, -1, -3, -3, -2, -2, 0, -4, -4, -2, -2, -2, -2, -3, 0,
- -4, -4, -1, 1, 1, 0, -1, 2, -3, -1, 2, 3, 4, 3, 3, 5,
- -2, 0, 2, 3, 3, 3, 3, 3, -2, -2, 0, 0, 0, 0, 0, 1,
+ -2, -2, -1, -3, -3, -2, -2, 0, -4, -4, -2, -2, -2, -2, -3, 0,
+ -4, -4, -1, 1, 1, 0, -1, 2, -3, -1, 2, 3, 4, 3, 3, 5,
+ -2, 0, 2, 3, 3, 3, 3, 3, -2, -2, 0, 0, 0, 0, 0, 1,
0, 2, 1, -1, -3, -1, 3, -2, -1, 0, -1, -1, -3, 0, 4, -2,
- -2, -2, -2, -2, -2, 1, 5, -2, -3, -2, -3, -1, -2, 1, 4, -3,
- -2, 0, -1, 0, -1, 0, 3, -5, 1, 2, 1, 2, 0, 0, 2, -5,
+ -2, -2, -2, -2, -2, 1, 5, -2, -3, -2, -3, -1, -2, 1, 4, -3,
+ -2, 0, -1, 0, -1, 0, 3, -5, 1, 2, 1, 2, 0, 0, 2, -5,
2, 4, 2, 3, 1, 1, 3, -3, 1, 2, 1, 1, 0, 1, 4, -2,
4, -3, -4, -1, 3, 3, 1, 3, 4, -4, -4, -1, 3, 2, 0, 2,
4, -3, -4, 0, 2, 2, -1, 1, 4, -3, -2, 1, 2, 1, -2, 0,
@@ -637,15 +633,15 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
2, 2, 3, 4, 3, 1, 0, -1, 1, 0, 1, 2, 1, -1, -2, -2,
2, 1, 2, 1, 1, 0, -1, -1, 4, 3, 4, 3, 2, 1, 1, 1,
3, 2, 2, 2, 1, 1, 1, 1, -1, -2, -1, 0, -1, -1, -1, -1,
- -3, -3, -2, -1, -2, -2, -2, -2, -4, -4, -3, -3, -4, -4, -3, -3,
+ -3, -3, -2, -1, -2, -2, -2, -2, -4, -4, -3, -3, -4, -4, -3, -3,
2, 1, -1, -3, -4, -2, 3, 4, 2, 2, 1, -1, -3, -2, 1, 2,
1, 2, 3, 3, 0, -2, -1, -2, -1, 0, 2, 4, 2, 0, -1, -3,
- -2, -2, 0, 3, 3, 2, 0, -3, 0, -2, -3, -1, 1, 2, 2, -1,
+ -2, -2, 0, 3, 3, 2, 0, -3, 0, -2, -3, -1, 1, 2, 2, -1,
3, -1, -4, -5, -3, 0, 2, 0, 6, 3, -2, -6, -5, 0, 3, 1,
- -2, 3, -2, 0, 3, -2, -2, 1, -3, 4, -3, 0, 3, -2, -1, 2,
- -3, 5, -3, 0, 4, -2, -1, 2, -2, 4, -4, -1, 3, -3, -2, 2,
- -3, 4, -3, 0, 3, -3, -1, 2, -2, 5, -2, 0, 3, -3, -1, 2,
- -2, 4, -3, 1, 3, -2, -1, 2, -2, 3, -2, 1, 3, -2, 0, 2,
+ -2, 3, -2, 0, 3, -2, -2, 1, -3, 4, -3, 0, 3, -2, -1, 2,
+ -3, 5, -3, 0, 4, -2, -1, 2, -2, 4, -4, -1, 3, -3, -2, 2,
+ -3, 4, -3, 0, 3, -3, -1, 2, -2, 5, -2, 0, 3, -3, -1, 2,
+ -2, 4, -3, 1, 3, -2, -1, 2, -2, 3, -2, 1, 3, -2, 0, 2,
1, 0, 0, -1, 1, 2, -4, -1, 2, 0, 0, -1, 1, 2, -4, -2,
1, 1, 1, -1, 2, 4, -2, 0, 0, -1, 1, -1, 2, 5, -1, 1,
0, -1, 0, -2, 1, 5, -1, 1, 0, -1, -1, -2, 0, 3, -3, -1,
@@ -653,400 +649,396 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] =
1, 0, -1, 1, 1, 2, 4, 5, 1, 0, -1, 1, 1, 1, 5, 7,
0, 0, -2, -1, -1, 0, 3, 5, 0, -1, -2, -1, -1, -1, 2, 3,
0, -1, -3, -1, -1, -1, 1, 2, -1, -2, -4, -2, -2, -2, 0, 0,
- -1, -2, -2, -1, -2, -2, 0, 0, 0, -1, -1, 0, -1, -1, 0, 0,
+ -1, -2, -2, -1, -2, -2, 0, 0, 0, -1, -1, 0, -1, -1, 0, 0,
3, 3, 0, -1, -1, 1, 4, 4, 2, 3, 0, -2, -2, 0, 1, 1,
2, 3, 1, -1, -1, 0, 1, 0, 1, 2, 0, -1, -1, -1, 0, -2,
0, 1, 0, -1, -2, -1, 0, -2, 0, 1, 0, -1, -2, -1, 1, 0,
1, 1, -1, -3, -4, -3, 1, 3, 1, 2, -1, -3, -5, -4, 1, 3,
- -3, -2, 0, 1, 1, 1, 0, -2, 0, 1, 1, 1, 0, 0, -1, -3,
+ -3, -2, 0, 1, 1, 1, 0, -2, 0, 1, 1, 1, 0, 0, -1, -3,
1, 2, 1, 1, 0, -1, -1, -2, 0, -1, -3, -1, -1, -1, 0, -1,
0, -3, -6, -3, -2, -1, 1, 1, 2, -1, -4, -3, -2, 0, 2, 2,
5, 4, 1, 1, 0, 1, 3, 2, 5, 4, 2, 1, 0, -1, 0, 1,
- -2, 0, -2, -5, -6, -3, 0, 0, -2, 0, 1, 0, -1, 1, 2, 2,
- -2, 0, 1, 3, 2, 2, 2, 1, -2, 0, 2, 4, 3, 2, 1, 1,
- -2, 0, 2, 3, 2, 0, -1, 0, -3, -1, 1, 1, 0, -1, -1, 1,
- -4, -1, 1, 0, -1, -2, 0, 2, -4, -1, 0, -1, -1, -2, 1, 4,
- -3, 0, 0, -1, 1, 1, 1, 0, -3, 1, 0, -1, 0, 0, -1, -1,
- -1, 3, 3, 0, 1, 0, 0, 1, -3, 2, 2, -2, -1, 0, 0, 1,
- -5, 0, 0, -2, -1, 1, 0, 2, -7, -2, 1, 0, 1, 2, 2, 2,
- -5, 0, 3, 2, 3, 3, 2, 2, -3, 2, 4, 1, 0, 0, -2, -3,
+ -2, 0, -2, -5, -6, -3, 0, 0, -2, 0, 1, 0, -1, 1, 2, 2,
+ -2, 0, 1, 3, 2, 2, 2, 1, -2, 0, 2, 4, 3, 2, 1, 1,
+ -2, 0, 2, 3, 2, 0, -1, 0, -3, -1, 1, 1, 0, -1, -1, 1,
+ -4, -1, 1, 0, -1, -2, 0, 2, -4, -1, 0, -1, -1, -2, 1, 4,
+ -3, 0, 0, -1, 1, 1, 1, 0, -3, 1, 0, -1, 0, 0, -1, -1,
+ -1, 3, 3, 0, 1, 0, 0, 1, -3, 2, 2, -2, -1, 0, 0, 1,
+ -5, 0, 0, -2, -1, 1, 0, 2, -7, -2, 1, 0, 1, 2, 2, 2,
+ -5, 0, 3, 2, 3, 3, 2, 2, -3, 2, 4, 1, 0, 0, -2, -3,
5, 2, -2, -2, 0, -1, -1, -1, 2, -1, -4, -3, -1, -2, -1, -1,
0, -2, -2, 1, 2, -1, 0, 1, -1, -2, -1, 3, 3, -1, 0, 2,
1, 0, 0, 3, 3, -2, -1, 2, 2, 1, 1, 3, 2, -2, -2, 0,
1, 0, -1, 1, 1, -3, -3, -2, 1, 0, 1, 2, 3, 0, 0, 0,
- -4, -5, -3, 0, 1, -1, -2, -1, -2, -3, -1, 1, 2, 0, 0, 0,
+ -4, -5, -3, 0, 1, -1, -2, -1, -2, -3, -1, 1, 2, 0, 0, 0,
1, 1, 2, 1, 2, 1, 1, 1, 3, 4, 3, 1, 0, -2, -1, -1,
3, 3, 2, 0, -2, -3, -3, -2, 1, 1, 0, -1, -2, -4, -2, -2,
2, 1, 0, 0, 0, -1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 3,
0, 0, 0, -1, -2, -1, 1, 0, -2, -1, -1, -2, -3, -2, 0, 0,
- -1, 0, 0, -1, -2, 0, 1, 1, 1, 1, 0, -1, -1, 1, 3, 1,
+ -1, 0, 0, -1, -2, 0, 1, 1, 1, 1, 0, -1, -1, 1, 3, 1,
2, 2, 0, -2, -1, 2, 3, 0, 3, 1, -1, -1, 1, 4, 2, -2,
2, 0, -3, -1, 3, 5, 0, -5, 1, -1, -2, 0, 3, 3, -1, -6,
- -1, 0, 3, 4, 2, 0, 1, 2, -2, -1, 0, 1, -1, -2, 0, 1,
- -2, -3, -2, -3, -6, -7, -6, -3, 2, 2, 3, 1, -1, -2, -3, -2,
+ -1, 0, 3, 4, 2, 0, 1, 2, -2, -1, 0, 1, -1, -2, 0, 1,
+ -2, -3, -2, -3, -6, -7, -6, -3, 2, 2, 3, 1, -1, -2, -3, -2,
2, 2, 3, 1, 0, 0, 0, 0, 2, 1, 1, 0, 1, 1, 0, 1,
1, 0, 0, 0, 0, 1, 1, 2, 1, 0, -1, 0, 0, 2, 2, 1,
1, 1, 3, 1, -1, -1, -1, 1, -2, -1, 0, 0, -2, -2, -1, 2,
- -2, -2, 1, 1, 1, 0, 1, 3, -2, -2, 0, -1, 0, -1, 0, 2,
+ -2, -2, 1, 1, 1, 0, 1, 3, -2, -2, 0, -1, 0, -1, 0, 2,
0, 0, 1, 0, -1, -1, -2, 1, 3, 2, 2, 1, 0, -2, -2, 1,
5, 3, 3, 2, 1, 1, 1, 4, 0, -3, -4, -5, -4, -3, -1, 1,
- -6, -4, -1, 2, 2, 0, 0, -1, -4, -2, 1, 3, 3, 2, 2, 0,
- -3, -2, -1, 2, 3, 3, 2, 0, -3, -2, -2, 1, 2, 1, 1, -1,
- -2, -2, -2, 0, 2, 2, 1, -1, -1, -1, -1, 1, 2, 3, 2, 0,
- -1, -1, -2, 1, 2, 2, 2, -1, 0, -1, -2, 0, 2, 1, 0, -1,
+ -6, -4, -1, 2, 2, 0, 0, -1, -4, -2, 1, 3, 3, 2, 2, 0,
+ -3, -2, -1, 2, 3, 3, 2, 0, -3, -2, -2, 1, 2, 1, 1, -1,
+ -2, -2, -2, 0, 2, 2, 1, -1, -1, -1, -1, 1, 2, 3, 2, 0,
+ -1, -1, -2, 1, 2, 2, 2, -1, 0, -1, -2, 0, 2, 1, 0, -1,
6, 4, 2, 1, 0, 0, 0, 1, 4, 2, -1, -2, -2, -2, -1, -1,
2, 1, -1, -2, -2, -2, -2, -1, 2, 2, 0, -2, -2, -2, -1, 0,
0, 0, -1, -2, -2, -1, 0, 1, -3, -3, -2, -1, -1, -2, -1, 0,
- -3, -2, 2, 3, 2, 0, -1, -2, -2, 0, 4, 5, 5, 2, 0, -1,
+ -3, -2, 2, 3, 2, 0, -1, -2, -2, 0, 4, 5, 5, 2, 0, -1,
5, 4, 2, 0, -1, -2, -1, -1, 4, 3, 2, 1, 0, -1, 0, -1,
1, 1, 0, 1, 1, 0, 1, -1, -2, -1, -1, 0, 0, -2, -2, -3,
- -1, 0, 0, 0, -1, -3, -3, -5, 0, 1, 1, -1, -1, -2, -2, -3,
- -1, -1, -1, -2, -1, 1, 3, 1, -1, -2, -2, -1, 2, 5, 6, 5,
- -3, -3, -2, 1, 1, -2, -1, -1, 1, 2, 3, 4, 1, -3, -1, -3,
+ -1, 0, 0, 0, -1, -3, -3, -5, 0, 1, 1, -1, -1, -2, -2, -3,
+ -1, -1, -1, -2, -1, 1, 3, 1, -1, -2, -2, -1, 2, 5, 6, 5,
+ -3, -3, -2, 1, 1, -2, -1, -1, 1, 2, 3, 4, 1, -3, -1, -3,
3, 2, 0, 1, -1, -3, -1, -3, 1, 0, -1, 0, -1, -1, 1, 0,
1, 1, 0, 1, 2, 2, 5, 3, 1, 1, 1, 2, 2, 2, 3, 0,
- -3, -1, -2, -2, -3, -3, -1, -3, -1, 1, 1, 0, -1, -1, 0, -2,
+ -3, -1, -2, -2, -3, -3, -1, -3, -1, 1, 1, 0, -1, -1, 0, -2,
2, 0, -2, -2, 2, 4, 1, -2, 1, 0, -2, -1, 3, 5, 2, -1,
- -1, -2, -3, -2, 1, 3, 1, -2, -1, -2, -1, -1, 0, 2, 1, -1,
+ -1, -2, -3, -2, 1, 3, 1, -2, -1, -2, -1, -1, 0, 2, 1, -1,
0, 0, 1, 1, 1, 2, 2, 0, 0, 1, 4, 4, 2, 2, 3, 1,
- -2, -1, 2, 1, -2, -3, -2, -3, -1, 0, 1, 0, -3, -4, -4, -5,
+ -2, -1, 2, 1, -2, -3, -2, -3, -1, 0, 1, 0, -3, -4, -4, -5,
4, 0, -3, -4, -4, -4, -2, -1, 5, 0, -1, 0, -1, -3, -2, -1,
4, 0, 0, 1, 1, 0, 0, 0, 0, -3, -2, -1, 0, 0, 1, 0,
0, -2, 0, 0, 1, 1, 2, 1, 2, 0, 0, 0, 1, 1, 1, 0,
2, 0, -1, -1, 1, 1, 1, 0, 1, -1, -2, -2, 0, 2, 2, 2,
- -3, -5, -2, 0, -1, -3, -3, 0, 0, -2, 0, 2, 2, 0, 0, 3,
+ -3, -5, -2, 0, -1, -3, -3, 0, 0, -2, 0, 2, 2, 0, 0, 3,
2, -1, -2, 0, 0, -1, -1, 2, 5, 2, -1, -1, -1, -1, -1, 2,
5, 2, 0, -1, -1, 0, -1, 2, 2, 1, 0, 0, 0, 1, 0, 2,
- -1, -1, 1, 1, 2, 2, 1, 2, -3, -2, 0, 0, 0, 0, -2, -1,
+ -1, -1, 1, 1, 2, 2, 1, 2, -3, -2, 0, 0, 0, 0, -2, -1,
0, 3, 2, 0, -2, -3, -3, -3, 0, 3, 3, 1, 0, 0, 1, 2,
- -1, 0, -1, -2, -1, -1, 1, 3, -1, 0, -1, -2, -1, -1, 0, 2,
- -1, 0, -1, -2, 0, 0, -1, 2, -1, 0, -1, -2, -1, -1, -2, 1,
+ -1, 0, -1, -2, -1, -1, 1, 3, -1, 0, -1, -2, -1, -1, 0, 2,
+ -1, 0, -1, -2, 0, 0, -1, 2, -1, 0, -1, -2, -1, -1, -2, 1,
0, 1, 0, -3, -1, -1, -1, 2, 5, 5, 2, -1, -1, -1, 1, 3,
0, 0, 1, -1, -3, -2, 0, 2, 1, 1, 3, 0, -2, -2, 0, 1,
1, 1, 3, 1, 0, 0, -1, -1, 0, -1, 2, 1, 1, 0, -1, -3,
- -1, -2, 1, 1, 1, 0, -2, -4, -1, 0, 2, 1, 1, 0, -1, -3,
+ -1, -2, 1, 1, 1, 0, -2, -4, -1, 0, 2, 1, 1, 0, -1, -3,
1, 1, 3, 2, 1, 0, -2, -3, 2, 2, 4, 2, 1, -1, -2, -4,
1, 2, 2, 2, 0, -2, 0, 2, -1, -1, -2, -3, -4, -5, -3, 1,
0, 1, 1, 0, -1, -1, -1, 1, 0, 1, 1, 1, 0, 0, 0, 2,
0, 1, 1, 2, 1, 1, 1, 2, -1, -1, 0, 2, 2, 2, 2, 3,
- -2, -4, -4, -1, -2, -2, -2, 0, 1, 0, 0, 1, 0, 0, 0, 1,
+ -2, -4, -4, -1, -2, -2, -2, 0, 1, 0, 0, 1, 0, 0, 0, 1,
0, -1, -3, -2, 0, 2, 2, 1, 0, -1, -2, -3, 0, 1, 1, 2,
1, 0, -2, -3, -1, 0, 0, 1, -1, 0, -1, -2, 0, 0, -1, 0,
- -1, 1, 1, 0, 2, 2, 0, 0, 0, 2, 3, 1, 3, 5, 3, 2,
- -1, 1, 1, -2, 0, 3, 1, 1, -1, 0, 0, -4, -4, -1, -1, -1,
- -1, 1, 1, 0, 1, 2, 1, 2, -3, 0, 1, 0, 1, 1, 0, 2,
- -5, -3, -1, -1, 0, 1, 0, 1, -4, -3, -2, -3, -2, -1, -1, 0,
+ -1, 1, 1, 0, 2, 2, 0, 0, 0, 2, 3, 1, 3, 5, 3, 2,
+ -1, 1, 1, -2, 0, 3, 1, 1, -1, 0, 0, -4, -4, -1, -1, -1,
+ -1, 1, 1, 0, 1, 2, 1, 2, -3, 0, 1, 0, 1, 1, 0, 2,
+ -5, -3, -1, -1, 0, 1, 0, 1, -4, -3, -2, -3, -2, -1, -1, 0,
0, 0, -1, -2, -2, -2, -2, 0, 3, 4, 2, 0, 0, 0, 0, 1,
2, 1, 0, 0, 0, 0, -1, 0, 0, 1, 2, 3, 4, 4, 3, 2,
- -1, 4, 7, 4, 0, 0, 0, 0, -1, 4, 6, 3, 0, 1, 1, 1,
+ -1, 4, 7, 4, 0, 0, 0, 0, -1, 4, 6, 3, 0, 1, 1, 1,
0, 3, 4, 0, -1, 0, 0, 1, 0, 1, 1, -2, -1, 0, -1, -1,
- -1, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0,
- -1, -3, -3, 0, 1, -1, -2, -1, -3, -4, -4, -2, -1, -2, -2, -1,
+ -1, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0,
+ -1, -3, -3, 0, 1, -1, -2, -1, -3, -4, -4, -2, -1, -2, -2, -1,
2, 2, 1, 0, 1, 1, 0, -3, -2, -1, 0, 0, 1, 1, 0, -3,
- -2, -1, 0, 1, 2, 1, 1, -2, 1, 2, 2, 2, 3, 3, 2, -1,
+ -2, -1, 0, 1, 2, 1, 1, -2, 1, 2, 2, 2, 3, 3, 2, -1,
1, 2, 1, 0, 1, 1, 2, -1, 0, 1, -2, -4, -2, 0, 1, -1,
1, 1, -1, -3, -2, 0, -1, -3, 1, 2, 0, -1, 0, 1, -1, -4,
- -1, -1, -2, -2, 0, 3, 4, 3, 1, 1, -1, -3, -2, 0, 0, 0,
+ -1, -1, -2, -2, 0, 3, 4, 3, 1, 1, -1, -3, -2, 0, 0, 0,
2, 2, 2, 2, 2, 1, -1, -1, 1, 1, 1, 3, 3, 0, -2, -2,
0, -1, -1, -1, 0, -2, -1, -1, -1, -3, -4, -3, -2, -2, 0, 2,
- -1, -1, 0, 1, 2, 2, 3, 5, -2, -1, -1, 0, 0, 0, 0, 1,
- -2, -3, 2, 0, 0, 1, 1, -1, -1, -4, 1, -2, -1, 2, 2, 0,
+ -1, -1, 0, 1, 2, 2, 3, 5, -2, -1, -1, 0, 0, 0, 0, 1,
+ -2, -3, 2, 0, 0, 1, 1, -1, -1, -4, 1, -2, -1, 2, 2, 0,
1, -4, 0, -2, -2, 1, 1, -1, 2, -3, 1, -1, -1, 1, 1, -1,
3, -2, 3, 1, 0, 1, 1, -1, 1, -3, 2, 1, 0, 1, 0, -1,
- -1, -5, 1, 0, -1, 0, 1, 1, 0, -3, 3, 3, 1, 2, 3, 3,
+ -1, -5, 1, 0, -1, 0, 1, 1, 0, -3, 3, 3, 1, 2, 3, 3,
0, -1, -2, 1, 5, 5, 2, -1, 1, -1, -2, -1, 1, 1, -2, -5,
1, 1, -1, -2, -1, -1, -1, -3, 1, 1, -1, -1, -1, 2, 4, 3,
- -1, -1, -1, -1, -1, 0, 4, 3, -1, -1, 0, 1, -1, -3, -1, -1,
+ -1, -1, -1, -1, -1, 0, 4, 3, -1, -1, 0, 1, -1, -3, -1, -1,
0, 0, 0, 2, 2, 0, 0, -1, 0, -2, -3, 0, 1, 1, 3, 2,
2, 3, 2, 1, 0, 0, -2, -2, 2, 3, 0, 1, 1, 3, 3, 2,
0, 0, -3, -1, -1, 2, 2, 3, -2, -2, -3, 1, 1, 2, 1, 1,
- -2, -1, -2, 2, 1, 1, -1, -2, 0, 1, 0, 2, 0, 0, -2, -2,
+ -2, -1, -2, 2, 1, 1, -1, -2, 0, 1, 0, 2, 0, 0, -2, -2,
0, 1, 0, 2, 0, 0, -2, -2, -3, -2, -2, 0, -1, -2, -2, -3,
0, 1, -1, 3, -1, 1, 3, -1, 0, 1, -1, 3, -1, -1, 2, -3,
1, 1, -2, 3, -1, -3, 0, -3, 2, 2, -2, 3, 0, -2, 1, -2,
1, 1, -3, 3, -1, -2, 1, -3, 1, 1, -3, 3, 0, -1, 1, -2,
1, 2, -1, 4, 0, -1, 1, -2, 0, 1, -1, 3, -1, -3, 0, -3,
- -3, -3, -1, 1, 2, 1, -1, -2, -2, -2, 0, 2, 1, 0, -2, -2,
- -3, -2, 1, 2, 1, -1, -2, -1, -3, -2, 2, 4, 0, -2, -2, 1,
- -3, -1, 2, 4, 0, -2, -2, 2, -1, 1, 4, 3, -1, -3, -2, 2,
+ -3, -3, -1, 1, 2, 1, -1, -2, -2, -2, 0, 2, 1, 0, -2, -2,
+ -3, -2, 1, 2, 1, -1, -2, -1, -3, -2, 2, 4, 0, -2, -2, 1,
+ -3, -1, 2, 4, 0, -2, -2, 2, -1, 1, 4, 3, -1, -3, -2, 2,
0, 2, 4, 2, -1, -2, -1, 2, 0, 1, 2, 0, -1, 0, 1, 3,
3, 0, -5, 1, 4, 0, 0, 1, 1, -2, -5, 2, 5, -1, -2, 1,
- -1, 0, 0, 3, 3, 1, 0, -1, -2, 3, 4, -2, -3, -1, 0, -2,
- -3, 3, 5, -3, -3, 0, 0, -2, -1, 3, 2, -2, -2, 2, 2, -1,
+ -1, 0, 0, 3, 3, 1, 0, -1, -2, 3, 4, -2, -3, -1, 0, -2,
+ -3, 3, 5, -3, -3, 0, 0, -2, -1, 3, 2, -2, -2, 2, 2, -1,
2, 0, 0, -1, 0, 0, 0, 0, 0, -3, -2, 1, 3, 0, -2, -2
};
/* list of codebooks for inter-coded vectors */
-const int8_t* const ff_svq1_inter_codebooks[6] =
-{
+const int8_t* const ff_svq1_inter_codebooks[6] = {
svq1_inter_codebook_4x2, svq1_inter_codebook_4x4,
svq1_inter_codebook_8x4, svq1_inter_codebook_8x8,
NULL, NULL,
};
/* 6x16-entry codebook for intra-coded 4x2 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x2)[768] =
-{
- 12, 13, 13, 11, -7, -10, -15, -17, -16, -15, -12, -10, 11, 15, 15, 12,
- 2, 17, 20, 15, -45, -24, 2, 13, 21, 20, -6, -36, 12, 16, -1, -27,
- -18, -21, 10, 45, -11, -20, -7, 21, 43, -8, -28, 0, 33, -16, -28, 3,
- -12, -18, -18, -6, -20, -10, 28, 55, -5, -18, -21, -18, 56, 30, -6, -20,
- -34, 27, 29, -22, -30, 29, 26, -25, 30, 34, 33, 26, -25, -31, -35, -33,
- -31, -35, -36, -32, 29, 36, 37, 31, -71, -12, 38, 34, -63, -1, 42, 33,
- 58, 37, -31, -60, 55, 34, -33, -61, -57, -57, 22, 93, -57, -58, 21, 93,
- 59, 69, 70, 62, -63, -68, -68, -60, -64, -71, -71, -64, 63, 73, 72, 62,
- -2, 0, 7, 15, -11, -10, -3, 5, -5, -8, -10, -10, 1, 9, 14, 9,
- 15, 8, -4, -11, 12, 2, -11, -12, -8, 0, 19, 28, 4, -1, -15, -26,
- -15, 27, 2, -14, -14, 22, 1, -9, -4, -6, -13, -10, -6, -14, 6, 47,
- -35, -20, 6, 23, 6, 9, 6, 4, -6, 2, 23, -22, -7, 4, 28, -21,
- 20, -22, -2, 6, 22, -28, -5, 8, -10, -18, -16, -12, 36, 19, 2, -1,
- -3, 0, 4, 8, -45, -10, 23, 23, 40, 15, -20, -35, -4, -1, 4, 1,
- 9, -5, -33, 24, 8, 3, -26, 19, -1, 4, 6, -3, 32, 25, -13, -49,
- 24, 24, 15, 7, -17, -27, -19, -7, -47, 0, 39, 24, -21, -6, 7, 4,
- -1, 0, -10, -13, 1, 1, 5, 16, 20, 5, -3, -9, -1, -4, -2, -6,
- -17, -7, 1, 4, 12, 7, 0, 0, 3, 0, 12, 11, -3, 1, 0, -23,
- 4, 17, -6, 0, 6, 3, -25, 0, -17, 10, 8, 5, -14, 4, 1, 4,
- 13, 10, 4, 2, -23, -9, 1, 2, 3, -3, 1, 7, 1, -23, -7, 20,
- -7, -18, 2, 12, -5, -4, 10, 9, 4, 10, 7, -24, 6, 3, 4, -10,
- 22, -14, -22, 6, 0, 5, 5, -1, -4, 3, -11, -4, -7, 31, 7, -14,
- -5, -16, -1, 42, -4, -2, -9, -5, 5, -8, -6, -3, 42, -4, -21, -5,
- -18, 12, 20, -12, 13, -13, -10, 7, -8, -9, -2, -18, -16, 6, 40, 8,
- 10, -1, 0, 4, -3, 4, -1, -13, -2, 6, 1, -15, 5, 3, 1, 2,
- -4, -2, 1, 3, 15, 0, -9, -4, -3, -4, -4, -4, -3, 5, 16, -3,
- 2, 13, 3, 4, -3, -8, -10, 0, -6, -2, -4, -1, -2, -3, -6, 23,
- 6, -6, 7, 1, 4, -18, 5, 1, -1, 1, -15, 14, -5, 6, -4, 4,
- 2, 2, 2, 6, -24, 2, 7, 3, -26, 0, 3, 3, 5, 7, 1, 6,
- 14, -2, -18, -3, 7, 5, -4, 2, -6, 3, 32, 1, -6, -6, -6, -12,
- 5, -36, 7, 6, 9, -1, 11, 0, 4, 4, 5, 3, 4, 15, 3, -38,
- 10, 23, -5, -42, 0, 4, 4, 4, 23, 17, -6, -13, -13, -37, 1, 29,
- 5, -14, -1, 1, 5, 0, 3, 1, 0, 4, -5, 2, 8, 0, 0, -10,
- 4, 7, -2, -3, -10, 3, 1, 1, -12, -1, 13, 3, 0, -1, 1, -3,
+DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x2)[768] = {
+ 12, 13, 13, 11, -7,-10,-15,-17,-16,-15,-12,-10, 11, 15, 15, 12,
+ 2, 17, 20, 15,-45,-24, 2, 13, 21, 20, -6,-36, 12, 16, -1,-27,
+ -18,-21, 10, 45,-11,-20, -7, 21, 43, -8,-28, 0, 33,-16,-28, 3,
+ -12,-18,-18, -6,-20,-10, 28, 55, -5,-18,-21,-18, 56, 30, -6,-20,
+ -34, 27, 29,-22,-30, 29, 26,-25, 30, 34, 33, 26,-25,-31,-35,-33,
+ -31,-35,-36,-32, 29, 36, 37, 31,-71,-12, 38, 34,-63, -1, 42, 33,
+ 58, 37,-31,-60, 55, 34,-33,-61,-57,-57, 22, 93,-57,-58, 21, 93,
+ 59, 69, 70, 62,-63,-68,-68,-60,-64,-71,-71,-64, 63, 73, 72, 62,
+ -2, 0, 7, 15,-11,-10, -3, 5, -5, -8,-10,-10, 1, 9, 14, 9,
+ 15, 8, -4,-11, 12, 2,-11,-12, -8, 0, 19, 28, 4, -1,-15,-26,
+ -15, 27, 2,-14,-14, 22, 1, -9, -4, -6,-13,-10, -6,-14, 6, 47,
+ -35,-20, 6, 23, 6, 9, 6, 4, -6, 2, 23,-22, -7, 4, 28,-21,
+ 20,-22, -2, 6, 22,-28, -5, 8,-10,-18,-16,-12, 36, 19, 2, -1,
+ -3, 0, 4, 8,-45,-10, 23, 23, 40, 15,-20,-35, -4, -1, 4, 1,
+ 9, -5,-33, 24, 8, 3,-26, 19, -1, 4, 6, -3, 32, 25,-13,-49,
+ 24, 24, 15, 7,-17,-27,-19, -7,-47, 0, 39, 24,-21, -6, 7, 4,
+ -1, 0,-10,-13, 1, 1, 5, 16, 20, 5, -3, -9, -1, -4, -2, -6,
+ -17, -7, 1, 4, 12, 7, 0, 0, 3, 0, 12, 11, -3, 1, 0,-23,
+ 4, 17, -6, 0, 6, 3,-25, 0,-17, 10, 8, 5,-14, 4, 1, 4,
+ 13, 10, 4, 2,-23, -9, 1, 2, 3, -3, 1, 7, 1,-23, -7, 20,
+ -7,-18, 2, 12, -5, -4, 10, 9, 4, 10, 7,-24, 6, 3, 4,-10,
+ 22,-14,-22, 6, 0, 5, 5, -1, -4, 3,-11, -4, -7, 31, 7,-14,
+ -5,-16, -1, 42, -4, -2, -9, -5, 5, -8, -6, -3, 42, -4,-21, -5,
+ -18, 12, 20,-12, 13,-13,-10, 7, -8, -9, -2,-18,-16, 6, 40, 8,
+ 10, -1, 0, 4, -3, 4, -1,-13, -2, 6, 1,-15, 5, 3, 1, 2,
+ -4, -2, 1, 3, 15, 0, -9, -4, -3, -4, -4, -4, -3, 5, 16, -3,
+ 2, 13, 3, 4, -3, -8,-10, 0, -6, -2, -4, -1, -2, -3, -6, 23,
+ 6, -6, 7, 1, 4,-18, 5, 1, -1, 1,-15, 14, -5, 6, -4, 4,
+ 2, 2, 2, 6,-24, 2, 7, 3,-26, 0, 3, 3, 5, 7, 1, 6,
+ 14, -2,-18, -3, 7, 5, -4, 2, -6, 3, 32, 1, -6, -6, -6,-12,
+ 5,-36, 7, 6, 9, -1, 11, 0, 4, 4, 5, 3, 4, 15, 3,-38,
+ 10, 23, -5,-42, 0, 4, 4, 4, 23, 17, -6,-13,-13,-37, 1, 29,
+ 5,-14, -1, 1, 5, 0, 3, 1, 0, 4, -5, 2, 8, 0, 0,-10,
+ 4, 7, -2, -3,-10, 3, 1, 1,-12, -1, 13, 3, 0, -1, 1, -3,
0, -1, 3, 1, -6, -9, 3, 9, -6, 1, -4, -6, 8, -1, 0, 8,
- -3, -3, 0, 18, -5, -1, -4, -1, -8, -2, 3, -4, 0, 17, -1, -5,
- 5, -2, 9, -10, 1, -5, 6, -5, 4, 2, 2, 3, 10, -14, -8, 1,
- -1, -2, -18, -1, -1, 20, 1, 2, -1, 1, -9, 1, -1, -9, 22, -4,
- 6, -4, 8, -3, -1, 7, -19, 5, -7, 31, -4, -4, -6, 0, -5, -5,
- -7, -8, -19, -4, 1, 1, 4, 32, 38, -1, -8, 4, -7, -8, -6, -12,
- -1, 0, -7, 1, -1, 9, -1, 0, 9, -1, -1, 0, 2, -6, 1, -3,
- -12, 0, 2, 1, 1, 1, 8, 0, 9, 1, 0, 2, -2, 1, -11, 0,
- 0, 8, 2, -10, -1, 2, -1, 0, -2, -4, 0, -5, -2, -1, -1, 14,
- -3, 7, -1, 5, 0, -10, 1, 1, -1, -5, 14, -1, -2, 1, -3, -2,
- -6, 0, 0, 6, 2, 3, -9, 4, 4, -5, -1, -1, -7, 3, 8, -1,
- 2, -4, -1, -11, 11, 2, 1, 0, -1, 2, 3, 9, 0, 2, 0, -15,
- 3, 5, -20, 3, 3, -1, 3, 3, 1, -1, 16, 1, 2, -29, 9, 2,
- -13, -6, -1, -3, 36, -1, -8, -3, 2, 5, 4, 2, -37, 9, 11, 3
+ -3, -3, 0, 18, -5, -1, -4, -1, -8, -2, 3, -4, 0, 17, -1, -5,
+ 5, -2, 9,-10, 1, -5, 6, -5, 4, 2, 2, 3, 10,-14, -8, 1,
+ -1, -2,-18, -1, -1, 20, 1, 2, -1, 1, -9, 1, -1, -9, 22, -4,
+ 6, -4, 8, -3, -1, 7,-19, 5, -7, 31, -4, -4, -6, 0, -5, -5,
+ -7, -8,-19, -4, 1, 1, 4, 32, 38, -1, -8, 4, -7, -8, -6,-12,
+ -1, 0, -7, 1, -1, 9, -1, 0, 9, -1, -1, 0, 2, -6, 1, -3,
+ -12, 0, 2, 1, 1, 1, 8, 0, 9, 1, 0, 2, -2, 1,-11, 0,
+ 0, 8, 2,-10, -1, 2, -1, 0, -2, -4, 0, -5, -2, -1, -1, 14,
+ -3, 7, -1, 5, 0,-10, 1, 1, -1, -5, 14, -1, -2, 1, -3, -2,
+ -6, 0, 0, 6, 2, 3, -9, 4, 4, -5, -1, -1, -7, 3, 8, -1,
+ 2, -4, -1,-11, 11, 2, 1, 0, -1, 2, 3, 9, 0, 2, 0,-15,
+ 3, 5,-20, 3, 3, -1, 3, 3, 1, -1, 16, 1, 2,-29, 9, 2,
+ -13, -6, -1, -3, 36, -1, -8, -3, 2, 5, 4, 2,-37, 9, 11, 3
};
/* 6x16-entry codebook for intra-coded 4x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x4)[1536] =
-{
- -11, -3, 3, 6, -10, -1, 5, 7, -9, -1, 6, 7, -9, -1, 4, 6,
- 5, 7, 0, -14, 6, 9, 2, -15, 6, 9, 2, -15, 4, 6, 0, -14,
- 16, 3, -5, -6, 16, 1, -8, -8, 14, -1, -9, -9, 12, 0, -8, -8,
- 8, 12, 16, 17, -2, 2, 6, 9, -10, -8, -4, 0, -15, -14, -11, -7,
- -7, -10, -2, 16, -7, -11, -3, 18, -7, -11, -1, 20, -6, -8, 1, 19,
- -9, -13, -16, -17, 2, -2, -7, -9, 11, 8, 4, -1, 16, 15, 11, 7,
- -22, -2, 13, 15, -24, -2, 14, 16, -25, -4, 13, 15, -25, -6, 10, 13,
- 26, 26, 22, 16, 17, 15, 9, 3, -2, -6, -11, -14, -20, -25, -28, -28,
- -27, -27, -25, -21, -16, -15, -11, -7, 3, 8, 12, 13, 23, 28, 31, 30,
- 20, 16, -7, -33, 22, 19, -6, -35, 22, 19, -6, -34, 20, 17, -6, -32,
- -20, -20, 2, 38, -21, -22, 2, 40, -21, -22, 2, 40, -20, -20, 3, 38,
- -47, -4, 24, 26, -50, -3, 26, 27, -50, -3, 26, 27, -47, -4, 24, 26,
- 45, 6, -23, -27, 48, 5, -25, -28, 48, 5, -26, -28, 44, 6, -24, -27,
- -30, -36, -10, 76, -31, -37, -11, 78, -31, -37, -11, 78, -31, -36, -10, 77,
- -53, -32, 35, 52, -54, -34, 36, 52, -54, -34, 36, 52, -53, -33, 34, 51,
- -93, -34, 62, 65, -93, -34, 62, 66, -93, -34, 62, 65, -93, -34, 60, 64,
- -7, 0, 2, 2, -8, -1, 3, 3, -8, 0, 4, 5, -6, 1, 5, 5,
- 3, 7, 11, 11, 2, 2, 3, 3, 1, -2, -6, -7, 1, -5, -11, -13,
+DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x4)[1536] = {
+ -11, -3, 3, 6,-10, -1, 5, 7, -9, -1, 6, 7, -9, -1, 4, 6,
+ 5, 7, 0,-14, 6, 9, 2,-15, 6, 9, 2,-15, 4, 6, 0,-14,
+ 16, 3, -5, -6, 16, 1, -8, -8, 14, -1, -9, -9, 12, 0, -8, -8,
+ 8, 12, 16, 17, -2, 2, 6, 9,-10, -8, -4, 0,-15,-14,-11, -7,
+ -7,-10, -2, 16, -7,-11, -3, 18, -7,-11, -1, 20, -6, -8, 1, 19,
+ -9,-13,-16,-17, 2, -2, -7, -9, 11, 8, 4, -1, 16, 15, 11, 7,
+ -22, -2, 13, 15,-24, -2, 14, 16,-25, -4, 13, 15,-25, -6, 10, 13,
+ 26, 26, 22, 16, 17, 15, 9, 3, -2, -6,-11,-14,-20,-25,-28,-28,
+ -27,-27,-25,-21,-16,-15,-11, -7, 3, 8, 12, 13, 23, 28, 31, 30,
+ 20, 16, -7,-33, 22, 19, -6,-35, 22, 19, -6,-34, 20, 17, -6,-32,
+ -20,-20, 2, 38,-21,-22, 2, 40,-21,-22, 2, 40,-20,-20, 3, 38,
+ -47, -4, 24, 26,-50, -3, 26, 27,-50, -3, 26, 27,-47, -4, 24, 26,
+ 45, 6,-23,-27, 48, 5,-25,-28, 48, 5,-26,-28, 44, 6,-24,-27,
+ -30,-36,-10, 76,-31,-37,-11, 78,-31,-37,-11, 78,-31,-36,-10, 77,
+ -53,-32, 35, 52,-54,-34, 36, 52,-54,-34, 36, 52,-53,-33, 34, 51,
+ -93,-34, 62, 65,-93,-34, 62, 66,-93,-34, 62, 65,-93,-34, 60, 64,
+ -7, 0, 2, 2, -8, -1, 3, 3, -8, 0, 4, 5, -6, 1, 5, 5,
+ 3, 7, 11, 11, 2, 2, 3, 3, 1, -2, -6, -7, 1, -5,-11,-13,
3, -2, -4, -3, 7, 0, -5, -5, 12, 4, -5, -7, 14, 6, -4, -7,
- 18, 14, 3, -2, 6, 4, 0, -3, -8, -5, -2, 0, -16, -11, -2, 2,
- -8, -6, 7, 18, -7, -8, 2, 13, -4, -6, -2, 6, 0, -4, -3, 1,
- 1, -3, -13, -18, 0, -1, -5, -7, -1, 1, 6, 7, -2, 4, 15, 17,
- -15, -14, -7, -2, -6, -5, -1, 0, 6, 6, 3, 1, 15, 13, 6, 1,
- 2, -2, -11, 10, 2, -1, -12, 11, 3, -1, -12, 11, 2, -2, -11, 11,
- -9, 14, -1, -5, -9, 15, -2, -5, -8, 16, -2, -5, -7, 15, -1, -4,
- 2, 6, 8, 8, -2, 3, 9, 12, -11, -5, 4, 10, -19, -16, -8, 0,
- 14, 8, -7, -15, 12, 7, -7, -14, 8, 5, -4, -9, 5, 3, -1, -4,
- 12, -14, -2, 2, 13, -15, -1, 3, 14, -15, -1, 3, 13, -14, -1, 3,
- 0, 6, 10, -13, 0, 6, 10, -15, 0, 7, 9, -17, 1, 6, 8, -16,
- -8, -5, 15, -2, -8, -6, 17, -2, -8, -6, 16, -3, -8, -5, 15, -2,
- -9, -11, -11, -10, 9, 10, 9, 8, 8, 10, 10, 9, -8, -9, -8, -7,
- 9, 10, 9, 7, -8, -10, -10, -10, -7, -10, -11, -11, 11, 12, 11, 8,
+ 18, 14, 3, -2, 6, 4, 0, -3, -8, -5, -2, 0,-16,-11, -2, 2,
+ -8, -6, 7, 18, -7, -8, 2, 13, -4, -6, -2, 6, 0, -4, -3, 1,
+ 1, -3,-13,-18, 0, -1, -5, -7, -1, 1, 6, 7, -2, 4, 15, 17,
+ -15,-14, -7, -2, -6, -5, -1, 0, 6, 6, 3, 1, 15, 13, 6, 1,
+ 2, -2,-11, 10, 2, -1,-12, 11, 3, -1,-12, 11, 2, -2,-11, 11,
+ -9, 14, -1, -5, -9, 15, -2, -5, -8, 16, -2, -5, -7, 15, -1, -4,
+ 2, 6, 8, 8, -2, 3, 9, 12,-11, -5, 4, 10,-19,-16, -8, 0,
+ 14, 8, -7,-15, 12, 7, -7,-14, 8, 5, -4, -9, 5, 3, -1, -4,
+ 12,-14, -2, 2, 13,-15, -1, 3, 14,-15, -1, 3, 13,-14, -1, 3,
+ 0, 6, 10,-13, 0, 6, 10,-15, 0, 7, 9,-17, 1, 6, 8,-16,
+ -8, -5, 15, -2, -8, -6, 17, -2, -8, -6, 16, -3, -8, -5, 15, -2,
+ -9,-11,-11,-10, 9, 10, 9, 8, 8, 10, 10, 9, -8, -9, -8, -7,
+ 9, 10, 9, 7, -8,-10,-10,-10, -7,-10,-11,-11, 11, 12, 11, 8,
0, 10, 7, 0, 0, 7, 0, -6, 0, 2, -5, -6, -2, -1, -4, -1,
5, 0, -6, -9, 2, 2, 2, 1, -2, 0, 5, 7, -6, -5, 1, 4,
3, -8, 2, -1, 4, -9, 3, 0, 5, -7, 3, 0, 7, -5, 3, 0,
- -5, -3, 2, 9, -6, -3, 1, 8, -6, -3, 1, 7, -5, -2, 0, 4,
- 13, 8, 3, 1, -3, -5, -4, -1, -8, -7, -3, 0, -1, 1, 3, 2,
- 3, 2, -5, -12, 4, 3, -2, -9, 3, 4, 1, -4, 3, 5, 4, -1,
- -9, -8, -4, 0, 8, 6, 2, 0, 10, 8, 3, 0, -6, -5, -3, -1,
- -3, -9, -12, -5, 0, -3, -5, 0, 2, 3, 2, 4, 5, 8, 7, 6,
- -1, -2, 5, 12, -1, -1, 5, 9, 2, 1, -1, -2, 2, -1, -11, -17,
- -7, 3, 3, -1, -9, 3, 4, -1, -10, 4, 6, -1, -9, 5, 7, 0,
- -18, -7, 2, 2, -8, 1, 5, 3, 3, 4, 1, 0, 9, 5, -2, -3,
- -2, 0, 6, 8, -4, -5, -5, -3, 1, -2, -6, -8, 10, 9, 3, -1,
+ -5, -3, 2, 9, -6, -3, 1, 8, -6, -3, 1, 7, -5, -2, 0, 4,
+ 13, 8, 3, 1, -3, -5, -4, -1, -8, -7, -3, 0, -1, 1, 3, 2,
+ 3, 2, -5,-12, 4, 3, -2, -9, 3, 4, 1, -4, 3, 5, 4, -1,
+ -9, -8, -4, 0, 8, 6, 2, 0, 10, 8, 3, 0, -6, -5, -3, -1,
+ -3, -9,-12, -5, 0, -3, -5, 0, 2, 3, 2, 4, 5, 8, 7, 6,
+ -1, -2, 5, 12, -1, -1, 5, 9, 2, 1, -1, -2, 2, -1,-11,-17,
+ -7, 3, 3, -1, -9, 3, 4, -1,-10, 4, 6, -1, -9, 5, 7, 0,
+ -18, -7, 2, 2, -8, 1, 5, 3, 3, 4, 1, 0, 9, 5, -2, -3,
+ -2, 0, 6, 8, -4, -5, -5, -3, 1, -2, -6, -8, 10, 9, 3, -1,
0, -2, -2, 0, 0, -4, -5, 0, -2, -8, -4, 8, -5, -7, 6, 24,
- 9, 1, -7, 1, 9, 1, -8, 1, 8, 0, -10, 1, 8, -1, -11, -1,
- 8, 8, 6, 3, 5, 4, 3, 2, -2, -3, -1, 0, -10, -13, -8, -4,
- 0, 4, 2, -3, 0, 6, 3, -5, 3, 10, 2, -12, 5, 10, -4, -22,
+ 9, 1, -7, 1, 9, 1, -8, 1, 8, 0,-10, 1, 8, -1,-11, -1,
+ 8, 8, 6, 3, 5, 4, 3, 2, -2, -3, -1, 0,-10,-13, -8, -4,
+ 0, 4, 2, -3, 0, 6, 3, -5, 3, 10, 2,-12, 5, 10, -4,-22,
0, -4, -1, 3, 1, -4, -1, 5, 1, -5, 0, 8, -1, -6, -2, 7,
- -1, -1, -2, -4, -1, -2, -4, -6, -1, -1, -1, -2, 1, 5, 10, 9,
- 10, 3, 0, -2, 6, -1, -2, -5, 3, -1, -2, -6, 2, 0, 0, -5,
+ -1, -1, -2, -4, -1, -2, -4, -6, -1, -1, -1, -2, 1, 5, 10, 9,
+ 10, 3, 0, -2, 6, -1, -2, -5, 3, -1, -2, -6, 2, 0, 0, -5,
6, 3, 0, 0, 6, 3, 1, 1, 4, -2, -2, 1, 0, -9, -9, -2,
- -11, -3, 1, 2, -6, 2, 4, 5, -3, 2, 3, 4, -2, 1, 1, 2,
- -6, -4, -1, -2, 2, -1, -1, -2, 10, 2, -2, -2, 11, 2, -4, -1,
- 6, 0, -2, 2, 3, 3, 0, 0, -6, 3, 3, 0, -17, -1, 5, 0,
- -1, 4, 10, 11, -3, -2, 0, 1, -3, -4, -5, -3, -1, -2, -2, -1,
- 2, -3, -9, -12, 3, 3, 3, 2, 2, 2, 4, 4, 2, 1, -1, -2,
- -2, 9, 5, -10, -3, 5, 5, -5, -2, 1, 2, 0, -1, -2, -2, 1,
- -2, -3, 7, -2, -1, -3, 7, -3, -1, -2, 8, -4, -2, -2, 7, -3,
+ -11, -3, 1, 2, -6, 2, 4, 5, -3, 2, 3, 4, -2, 1, 1, 2,
+ -6, -4, -1, -2, 2, -1, -1, -2, 10, 2, -2, -2, 11, 2, -4, -1,
+ 6, 0, -2, 2, 3, 3, 0, 0, -6, 3, 3, 0,-17, -1, 5, 0,
+ -1, 4, 10, 11, -3, -2, 0, 1, -3, -4, -5, -3, -1, -2, -2, -1,
+ 2, -3, -9,-12, 3, 3, 3, 2, 2, 2, 4, 4, 2, 1, -1, -2,
+ -2, 9, 5,-10, -3, 5, 5, -5, -2, 1, 2, 0, -1, -2, -2, 1,
+ -2, -3, 7, -2, -1, -3, 7, -3, -1, -2, 8, -4, -2, -2, 7, -3,
1, -8, -3, 12, 2, -2, -2, 4, 1, 3, 0, -5, -1, 5, 2, -7,
- -1, 3, 1, -5, -7, -2, 3, 1, -2, -7, -2, 2, 20, 3, -5, -1,
+ -1, 3, 1, -5, -7, -2, 3, 1, -2, -7, -2, 2, 20, 3, -5, -1,
5, 0, -3, -2, -7, -7, 0, 6, -6, 0, 7, 6, 2, 6, 0, -7,
- -2, 6, -7, 1, -2, 7, -8, 3, -2, 7, -7, 3, -1, 7, -6, 2,
- -5, -2, 5, 7, 4, 1, -4, -8, 6, 3, -2, -5, -7, -5, 3, 7,
- -1, -1, 6, 5, 0, -1, 1, -4, 2, 1, 0, -7, 1, 0, 0, -4,
- -8, 0, 3, 1, -2, 1, -1, -1, 1, -1, -3, 1, 1, -2, 1, 9,
+ -2, 6, -7, 1, -2, 7, -8, 3, -2, 7, -7, 3, -1, 7, -6, 2,
+ -5, -2, 5, 7, 4, 1, -4, -8, 6, 3, -2, -5, -7, -5, 3, 7,
+ -1, -1, 6, 5, 0, -1, 1, -4, 2, 1, 0, -7, 1, 0, 0, -4,
+ -8, 0, 3, 1, -2, 1, -1, -1, 1, -1, -3, 1, 1, -2, 1, 9,
5, 2, -3, -4, -1, 0, -1, -3, -3, 1, 3, 1, -4, 0, 4, 2,
2, -2, -2, 12, 0, -2, -5, 3, -1, 0, -3, 1, -3, -1, -2, 1,
1, 5, 3, 0, -6, -4, -2, 1, 0, -2, -2, 2, 6, 1, -4, -1,
- -3, -5, -5, -1, 3, 5, 5, 4, 0, 3, 1, -1, -2, 1, -2, -3,
+ -3, -5, -5, -1, 3, 5, 5, 4, 0, 3, 1, -1, -2, 1, -2, -3,
2, -4, -5, -3, 4, -2, -3, -2, 6, 0, -1, -1, 7, 1, 0, 0,
- -3, -2, -2, 0, -2, -3, -5, -1, -2, 2, 0, -1, -1, 11, 9, -1,
- 0, 1, -1, -10, -1, 1, 0, -6, 1, 0, 1, 4, 2, -5, -1, 13,
- -2, 4, 5, 0, -5, 1, 6, 3, -6, -2, 3, 2, -5, -2, 0, -2,
- -1, 1, 1, -2, -1, -2, 0, 2, 5, 5, 5, 7, 0, -4, -8, -7,
- 0, 2, -1, -5, -1, 2, 2, -3, 0, 5, 3, -5, 3, 8, 2, -12,
+ -3, -2, -2, 0, -2, -3, -5, -1, -2, 2, 0, -1, -1, 11, 9, -1,
+ 0, 1, -1,-10, -1, 1, 0, -6, 1, 0, 1, 4, 2, -5, -1, 13,
+ -2, 4, 5, 0, -5, 1, 6, 3, -6, -2, 3, 2, -5, -2, 0, -2,
+ -1, 1, 1, -2, -1, -2, 0, 2, 5, 5, 5, 7, 0, -4, -8, -7,
+ 0, 2, -1, -5, -1, 2, 2, -3, 0, 5, 3, -5, 3, 8, 2,-12,
8, 4, 0, -2, 10, -1, -4, -1, 3, -6, -3, 0, -4, -5, 0, 0,
- 0, -10, -4, 2, -1, -6, 3, 5, -1, -3, 6, 4, 0, -2, 4, 2,
+ 0,-10, -4, 2, -1, -6, 3, 5, -1, -3, 6, 4, 0, -2, 4, 2,
0, 8, 1, -1, 0, 11, 1, -3, -1, 6, -2, -4, -3, -2, -7, -4,
0, -1, -1, -1, 4, 5, 6, 5, -5, -9, -8, -5, 2, 2, 3, 2,
0, 2, 6, 1, 2, 0, 3, 0, 1, -2, -1, -2, 0, -1, -3, -6,
0, 0, 2, 0, 4, 0, 2, 1, 5, -2, 0, 0, -2, -9, -1, 2,
- 0, 1, 0, -10, -1, 1, 8, 0, -1, -2, 4, 0, 1, -1, 2, -1,
- -3, -2, 2, -1, -3, -1, 2, -3, 0, -1, 1, 0, 8, 1, -1, 3,
+ 0, 1, 0,-10, -1, 1, 8, 0, -1, -2, 4, 0, 1, -1, 2, -1,
+ -3, -2, 2, -1, -3, -1, 2, -3, 0, -1, 1, 0, 8, 1, -1, 3,
0, 1, 1, 2, 0, -4, -2, 0, -1, -5, 1, -1, -2, -1, 11, 2,
1, 5, -2, -2, 0, 2, -4, 0, -2, 1, -5, 1, 0, 5, 0, 1,
- -5, -3, 0, 6, -4, 2, 0, 0, -3, 5, 1, 0, -3, 3, 0, 0,
+ -5, -3, 0, 6, -4, 2, 0, 0, -3, 5, 1, 0, -3, 3, 0, 0,
3, -2, -3, 1, 1, -4, 0, 8, -2, -3, -2, 3, 1, 2, -1, -1,
- 1, 1, 0, 2, 2, 0, 1, 6, 1, -1, 2, 1, 0, 3, 0, -19,
+ 1, 1, 0, 2, 2, 0, 1, 6, 1, -1, 2, 1, 0, 3, 0,-19,
1, -3, -2, 2, 6, 5, -2, -7, -3, 1, 3, 1, -1, -1, 0, 2,
- -8, -1, -1, -4, 1, 1, -1, 2, 4, 3, 2, 3, -5, 1, 3, 0,
+ -8, -1, -1, -4, 1, 1, -1, 2, 4, 3, 2, 3, -5, 1, 3, 0,
0, 2, -1, 1, -3, 0, 0, 5, -5, -2, 0, 8, -4, -4, -4, 6,
- 1, 2, 1, 2, 2, 2, -3, 2, 4, 0, -9, 0, 7, 0, -11, 1,
- 0, 0, 0, -2, 3, 3, -1, -6, 4, 3, -3, -10, -1, 2, 6, 2,
+ 1, 2, 1, 2, 2, 2, -3, 2, 4, 0, -9, 0, 7, 0,-11, 1,
+ 0, 0, 0, -2, 3, 3, -1, -6, 4, 3, -3,-10, -1, 2, 6, 2,
7, -2, -3, 5, -4, 0, 3, -1, -4, 2, 1, -7, 2, -1, -1, 3,
3, 2, 2, 2, -5, -7, -7, -5, 5, 6, 4, 2, -2, -1, 0, 1
};
/* 6x16-entry codebook for intra-coded 8x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] =
-{
+DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] = {
5, 6, 6, 6, 7, 7, 8, 8, 0, 0, 0, 0, 0, 1, 2, 3,
- -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3,
+ -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3,
1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 4, 4, 5, 5, 5,
- -1, 0, 1, 1, 2, 3, 4, 4, -9, -10, -9, -9, -8, -7, -6, -5,
- -4, -4, -5, -6, -6, -7, -7, -7, 0, -1, -2, -2, -3, -3, -4, -4,
+ -1, 0, 1, 1, 2, 3, 4, 4, -9,-10, -9, -9, -8, -7, -6, -5,
+ -4, -4, -5, -6, -6, -7, -7, -7, 0, -1, -2, -2, -3, -3, -4, -4,
4, 4, 3, 3, 2, 1, 1, 0, 7, 7, 7, 6, 6, 5, 4, 4,
2, 4, 5, 6, 4, 1, -3, -6, 3, 4, 5, 5, 4, 0, -5, -8,
- 2, 3, 4, 4, 2, -2, -7, -10, 2, 2, 2, 1, 0, -4, -9, -12,
- -9, -7, -3, 1, 4, 4, 3, 3, -10, -7, -2, 3, 5, 5, 3, 3,
- -9, -6, -2, 3, 6, 5, 4, 3, -8, -6, -1, 3, 4, 4, 3, 2,
- -5, -5, -5, -5, -3, 1, 4, 7, -5, -5, -5, -4, -2, 1, 6, 8,
- -4, -5, -4, -3, -1, 3, 8, 10, -3, -4, -3, -2, 1, 5, 9, 11,
- -2, -2, -2, -2, -2, -2, -2, -2, -4, -5, -5, -5, -5, -5, -5, -4,
- -3, -4, -4, -4, -4, -4, -4, -3, 9, 10, 10, 11, 11, 11, 10, 10,
- 7, 4, 1, -2, -4, -6, -9, -10, 9, 7, 3, 0, -2, -4, -8, -9,
- 11, 8, 4, 2, 0, -3, -6, -8, 11, 9, 5, 3, 1, -2, -5, -7,
- -13, -13, -13, -12, -11, -10, -8, -8, 0, 1, 2, 3, 4, 4, 4, 3,
+ 2, 3, 4, 4, 2, -2, -7,-10, 2, 2, 2, 1, 0, -4, -9,-12,
+ -9, -7, -3, 1, 4, 4, 3, 3,-10, -7, -2, 3, 5, 5, 3, 3,
+ -9, -6, -2, 3, 6, 5, 4, 3, -8, -6, -1, 3, 4, 4, 3, 2,
+ -5, -5, -5, -5, -3, 1, 4, 7, -5, -5, -5, -4, -2, 1, 6, 8,
+ -4, -5, -4, -3, -1, 3, 8, 10, -3, -4, -3, -2, 1, 5, 9, 11,
+ -2, -2, -2, -2, -2, -2, -2, -2, -4, -5, -5, -5, -5, -5, -5, -4,
+ -3, -4, -4, -4, -4, -4, -4, -3, 9, 10, 10, 11, 11, 11, 10, 10,
+ 7, 4, 1, -2, -4, -6, -9,-10, 9, 7, 3, 0, -2, -4, -8, -9,
+ 11, 8, 4, 2, 0, -3, -6, -8, 11, 9, 5, 3, 1, -2, -5, -7,
+ -13,-13,-13,-12,-11,-10, -8, -8, 0, 1, 2, 3, 4, 4, 4, 3,
3, 4, 5, 6, 6, 6, 5, 4, 3, 4, 4, 4, 3, 3, 3, 2,
- 10, 10, 11, 10, 9, 9, 8, 7, 6, 6, 6, 6, 5, 4, 3, 2,
- 0, 0, 0, -1, -2, -3, -4, -4, -10, -10, -11, -12, -13, -14, -14, -14,
- 16, 16, 17, 16, 15, 13, 12, 11, -1, -2, -3, -4, -4, -4, -4, -3,
- -4, -5, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -6, -6, -5, -5,
- -13, -13, -13, -12, -11, -10, -8, -6, -9, -8, -7, -6, -4, -2, 0, 1,
- -2, -1, 1, 3, 5, 7, 8, 9, 5, 7, 9, 11, 13, 14, 15, 15,
- 16, 14, 11, 7, 2, -3, -7, -9, 14, 12, 8, 3, -1, -6, -9, -11,
- 11, 9, 4, 0, -4, -8, -11, -13, 8, 5, 1, -3, -6, -10, -12, -14,
- -18, -15, -9, -3, 1, 6, 9, 11, -17, -13, -7, -1, 3, 7, 11, 12,
- -15, -11, -5, 1, 5, 9, 12, 13, -13, -9, -3, 2, 5, 9, 11, 13,
- 22, 21, 19, 15, 10, 3, -4, -9, 20, 18, 15, 9, 2, -5, -12, -17,
- 16, 13, 8, 1, -7, -14, -20, -24, 10, 6, -1, -8, -15, -21, -25, -27,
- -25, -23, -20, -14, -7, 1, 9, 14, -23, -21, -16, -9, 0, 9, 16, 21,
- -20, -16, -10, -1, 8, 16, 22, 25, -15, -11, -3, 6, 14, 20, 25, 27,
- -4, -2, 0, 1, 2, 2, 2, 2, -5, -2, 0, 2, 3, 3, 3, 3,
- -6, -4, -1, 1, 2, 3, 3, 3, -7, -5, -2, 0, 1, 1, 2, 2,
+ 10, 10, 11, 10, 9, 9, 8, 7, 6, 6, 6, 6, 5, 4, 3, 2,
+ 0, 0, 0, -1, -2, -3, -4, -4,-10,-10,-11,-12,-13,-14,-14,-14,
+ 16, 16, 17, 16, 15, 13, 12, 11, -1, -2, -3, -4, -4, -4, -4, -3,
+ -4, -5, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -6, -6, -5, -5,
+ -13,-13,-13,-12,-11,-10, -8, -6, -9, -8, -7, -6, -4, -2, 0, 1,
+ -2, -1, 1, 3, 5, 7, 8, 9, 5, 7, 9, 11, 13, 14, 15, 15,
+ 16, 14, 11, 7, 2, -3, -7, -9, 14, 12, 8, 3, -1, -6, -9,-11,
+ 11, 9, 4, 0, -4, -8,-11,-13, 8, 5, 1, -3, -6,-10,-12,-14,
+ -18,-15, -9, -3, 1, 6, 9, 11,-17,-13, -7, -1, 3, 7, 11, 12,
+ -15,-11, -5, 1, 5, 9, 12, 13,-13, -9, -3, 2, 5, 9, 11, 13,
+ 22, 21, 19, 15, 10, 3, -4, -9, 20, 18, 15, 9, 2, -5,-12,-17,
+ 16, 13, 8, 1, -7,-14,-20,-24, 10, 6, -1, -8,-15,-21,-25,-27,
+ -25,-23,-20,-14, -7, 1, 9, 14,-23,-21,-16, -9, 0, 9, 16, 21,
+ -20,-16,-10, -1, 8, 16, 22, 25,-15,-11, -3, 6, 14, 20, 25, 27,
+ -4, -2, 0, 1, 2, 2, 2, 2, -5, -2, 0, 2, 3, 3, 3, 3,
+ -6, -4, -1, 1, 2, 3, 3, 3, -7, -5, -2, 0, 1, 1, 2, 2,
2, 1, 1, 1, 1, 0, -2, -3, 3, 3, 2, 1, 0, -1, -3, -4,
4, 3, 2, 1, 0, -2, -4, -6, 5, 4, 3, 1, -1, -3, -5, -6,
5, 6, 6, 4, 2, 0, -2, -3, 3, 4, 4, 4, 3, 1, 0, -1,
- -2, -2, -1, -1, -1, -1, -2, -2, -5, -4, -3, -2, -2, -2, -3, -3,
- -1, -1, -1, -1, -1, -1, -1, -1, -3, -4, -4, -4, -3, -3, -3, -3,
- -1, -1, -1, -1, -1, -1, -1, -2, 5, 6, 6, 6, 6, 5, 4, 3,
+ -2, -2, -1, -1, -1, -1, -2, -2, -5, -4, -3, -2, -2, -2, -3, -3,
+ -1, -1, -1, -1, -1, -1, -1, -1, -3, -4, -4, -4, -3, -3, -3, -3,
+ -1, -1, -1, -1, -1, -1, -1, -2, 5, 6, 6, 6, 6, 5, 4, 3,
4, 4, 4, 4, 4, 5, 6, 7, 0, -1, -1, -1, -1, 0, 1, 2,
- -2, -3, -3, -3, -3, -2, -1, 0, -3, -3, -4, -4, -4, -3, -2, -1,
+ -2, -3, -3, -3, -3, -2, -1, 0, -3, -3, -4, -4, -4, -3, -2, -1,
0, -2, -4, -4, -2, 0, 2, 3, 0, -2, -3, -3, -1, 2, 4, 5,
- -1, -2, -4, -3, 0, 3, 5, 6, -2, -3, -4, -3, -1, 2, 4, 5,
+ -1, -2, -4, -3, 0, 3, 5, 6, -2, -3, -4, -3, -1, 2, 4, 5,
9, 4, 0, -3, -3, -1, 0, 1, 8, 4, -1, -4, -3, -1, 1, 2,
6, 2, -3, -5, -4, -2, 0, 1, 5, 1, -3, -4, -4, -2, 0, 1,
- 5, 3, 1, -1, -4, -8, -10, -10, 3, 3, 2, 1, 0, -2, -3, -4,
+ 5, 3, 1, -1, -4, -8,-10,-10, 3, 3, 2, 1, 0, -2, -3, -4,
1, 1, 1, 2, 3, 2, 1, 0, -1, 0, 1, 2, 3, 4, 3, 2,
0, 1, 2, 2, 1, -1, -3, -3, 0, 1, 1, 1, -1, -2, -4, -3,
- -3, -3, -3, -3, -3, -3, -1, 2, -4, -4, -3, 0, 3, 7, 12, 14,
- -5, -5, -6, -6, -6, -6, -6, -5, 2, 2, 2, 1, 0, 0, 0, 0,
+ -3, -3, -3, -3, -3, -3, -1, 2, -4, -4, -3, 0, 3, 7, 12, 14,
+ -5, -5, -6, -6, -6, -6, -6, -5, 2, 2, 2, 1, 0, 0, 0, 0,
4, 4, 3, 2, 1, 0, 0, 0, 6, 6, 5, 4, 2, 2, 1, 1,
- -7, -7, -6, -3, 0, 4, 7, 8, -1, -2, -3, -3, -2, -1, 1, 2,
+ -7, -7, -6, -3, 0, 4, 7, 8, -1, -2, -3, -3, -2, -1, 1, 2,
3, 3, 1, -1, -2, -2, -2, -1, 6, 6, 4, 2, 0, -2, -2, -2,
- -6, -5, -2, 2, 5, 9, 11, 12, -4, -4, -2, 0, 2, 4, 5, 6,
- -3, -2, -2, -2, -2, -1, 0, 1, -2, -2, -2, -3, -3, -3, -3, -2,
- -7, -3, 1, 3, 3, 0, -3, -5, -6, -2, 3, 5, 4, 1, -3, -5,
- -5, -1, 4, 6, 5, 2, -3, -4, -4, 0, 5, 7, 6, 3, -1, -3,
+ -6, -5, -2, 2, 5, 9, 11, 12, -4, -4, -2, 0, 2, 4, 5, 6,
+ -3, -2, -2, -2, -2, -1, 0, 1, -2, -2, -2, -3, -3, -3, -3, -2,
+ -7, -3, 1, 3, 3, 0, -3, -5, -6, -2, 3, 5, 4, 1, -3, -5,
+ -5, -1, 4, 6, 5, 2, -3, -4, -4, 0, 5, 7, 6, 3, -1, -3,
0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3, -3, -3, -3, -2, -1,
6, 7, 8, 9, 9, 8, 7, 6, -4, -4, -5, -5, -6, -6, -5, -4,
- -9, -8, -6, -4, 0, 3, 6, 6, -5, -4, -1, 3, 5, 6, 5, 3,
- 1, 3, 6, 6, 4, 1, -2, -5, 6, 7, 5, 1, -3, -7, -10, -11,
- 10, 9, 5, 1, -3, -6, -6, -4, 5, 3, -1, -5, -6, -5, -2, 2,
- -2, -4, -6, -6, -4, 1, 6, 10, -6, -7, -7, -4, 1, 7, 11, 12,
+ -9, -8, -6, -4, 0, 3, 6, 6, -5, -4, -1, 3, 5, 6, 5, 3,
+ 1, 3, 6, 6, 4, 1, -2, -5, 6, 7, 5, 1, -3, -7,-10,-11,
+ 10, 9, 5, 1, -3, -6, -6, -4, 5, 3, -1, -5, -6, -5, -2, 2,
+ -2, -4, -6, -6, -4, 1, 6, 10, -6, -7, -7, -4, 1, 7, 11, 12,
6, 5, 3, 2, 0, 0, 0, 0, 2, 1, -1, -2, -3, -2, -1, -1,
0, -1, -2, -4, -4, -2, -1, 1, 0, 0, -1, -2, -1, 0, 2, 3,
0, -1, -2, -2, -2, -2, -1, -1, 5, 4, 2, 1, 0, 0, 0, 0,
6, 5, 3, 1, 0, 0, 0, 0, 2, 0, -2, -4, -4, -3, -2, -2,
- -7, -4, 0, 2, 2, 2, 2, 1, -7, -3, 0, 0, 0, 0, 0, 0,
- -4, -1, 1, 1, 0, 0, 0, 1, -1, 1, 2, 2, 2, 2, 3, 3,
- -2, 0, 2, 2, 1, 1, 1, 1, -1, 1, 2, 2, 1, 0, 0, -1,
+ -7, -4, 0, 2, 2, 2, 2, 1, -7, -3, 0, 0, 0, 0, 0, 0,
+ -4, -1, 1, 1, 0, 0, 0, 1, -1, 1, 2, 2, 2, 2, 3, 3,
+ -2, 0, 2, 2, 1, 1, 1, 1, -1, 1, 2, 2, 1, 0, 0, -1,
0, 2, 4, 2, 0, -1, -2, -3, 1, 2, 3, 1, -2, -4, -6, -6,
1, 2, 2, 4, 5, 6, 4, 1, 0, -1, -1, -1, 0, 0, -2, -4,
0, 0, -1, -2, -2, -2, -4, -6, 2, 1, 0, 0, 1, 1, -1, -3,
1, 1, 1, 1, 1, 2, 3, 3, 0, 0, 1, 0, 1, 2, 4, 4,
- -1, -1, -1, -1, 0, 1, 2, 3, -4, -4, -5, -5, -5, -3, -1, 0,
- -6, -5, -5, -4, -3, -2, -1, -1, -1, 0, 0, 1, 1, 2, 3, 3,
+ -1, -1, -1, -1, 0, 1, 2, 3, -4, -4, -5, -5, -5, -3, -1, 0,
+ -6, -5, -5, -4, -3, -2, -1, -1, -1, 0, 0, 1, 1, 2, 3, 3,
0, 1, 1, 1, 2, 2, 3, 4, 0, 0, -1, -1, 0, 1, 2, 3,
0, 1, 1, 1, 0, 0, -1, -1, 1, 3, 3, 2, 1, -1, -2, -2,
- -2, 0, 2, 2, 2, 2, 1, 1, -9, -8, -4, -2, 1, 3, 3, 3,
- -1, -1, -1, -2, -3, -3, -3, -4, 0, 0, 0, -1, -2, -2, -3, -3,
+ -2, 0, 2, 2, 2, 2, 1, 1, -9, -8, -4, -2, 1, 3, 3, 3,
+ -1, -1, -1, -2, -3, -3, -3, -4, 0, 0, 0, -1, -2, -2, -3, -3,
2, 2, 2, 0, -1, -1, -1, -1, 5, 5, 4, 3, 2, 2, 2, 2,
6, 3, -1, -4, -3, -1, 1, 1, 2, -1, -3, -4, -1, 2, 2, 0,
- -1, -2, -2, 1, 4, 4, 1, -3, -2, -1, 1, 4, 6, 3, -3, -8,
+ -1, -2, -2, 1, 4, 4, 1, -3, -2, -1, 1, 4, 6, 3, -3, -8,
3, 3, 2, 1, -1, -2, -2, -2, -4, -4, -2, -1, 1, 3, 4, 4,
- -4, -5, -5, -4, -2, 0, 2, 2, 7, 7, 4, 1, -1, -2, -3, -2,
- -1, 1, 3, 0, -4, -6, 0, 6, -2, 1, 4, 1, -4, -6, -1, 7,
- -3, 1, 4, 2, -3, -6, -1, 6, -2, 0, 3, 2, -2, -5, -1, 4,
+ -4, -5, -5, -4, -2, 0, 2, 2, 7, 7, 4, 1, -1, -2, -3, -2,
+ -1, 1, 3, 0, -4, -6, 0, 6, -2, 1, 4, 1, -4, -6, -1, 7,
+ -3, 1, 4, 2, -3, -6, -1, 6, -2, 0, 3, 2, -2, -5, -1, 4,
1, -1, -2, 1, 4, 4, -1, -7, 1, -1, -4, -1, 5, 6, 0, -6,
3, 0, -4, -3, 3, 6, 2, -4, 3, 0, -5, -4, 1, 4, 1, -3,
2, 2, 3, 3, 3, 3, 2, 2, -4, -5, -6, -7, -7, -7, -7, -6,
1, 2, 3, 3, 3, 3, 2, 2, 0, 0, 1, 1, 1, 2, 2, 1,
3, -3, -3, 3, 4, -2, -2, 2, 3, -4, -4, 4, 4, -4, -4, 2,
4, -4, -4, 4, 4, -4, -3, 3, 3, -3, -4, 3, 3, -3, -3, 3,
- -2, -2, -2, -2, -2, -2, -1, -1, 6, 7, 8, 8, 8, 7, 6, 5,
- -5, -6, -7, -7, -8, -7, -6, -5, 1, 1, 2, 2, 2, 2, 1, 1,
+ -2, -2, -2, -2, -2, -2, -1, -1, 6, 7, 8, 8, 8, 7, 6, 5,
+ -5, -6, -7, -7, -8, -7, -6, -5, 1, 1, 2, 2, 2, 2, 1, 1,
0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0,
- -2, -3, -2, -2, -2, -3, -3, -3, 2, 3, 5, 6, 4, 2, 1, 0,
+ -2, -3, -2, -2, -2, -3, -3, -3, 2, 3, 5, 6, 4, 2, 1, 0,
8, 6, 2, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, -1, -1, -1,
1, -1, 0, 0, 0, -1, -2, -3, -2, -2, -1, 0, 0, -2, -4, -5,
3, 1, -1, -2, -3, -4, -5, -5, 2, 1, 0, 0, 1, 1, 0, 0,
0, -1, -1, 0, 2, 2, 2, 2, -1, -2, -1, 1, 2, 2, 2, 2,
0, -1, -2, -1, -1, -1, -1, 0, -1, -2, -2, -1, -1, 0, 0, 1,
2, 1, 1, 2, 2, 1, 1, 0, 6, 5, 3, 1, 0, -2, -4, -4,
- -3, -2, -1, 0, 1, 1, 0, -1, 0, 1, 3, 4, 5, 5, 3, 1,
- -1, -1, -1, 0, 1, 0, -1, -2, -2, -2, -2, -1, 0, -1, -2, -3,
+ -3, -2, -1, 0, 1, 1, 0, -1, 0, 1, 3, 4, 5, 5, 3, 1,
+ -1, -1, -1, 0, 1, 0, -1, -2, -2, -2, -2, -1, 0, -1, -2, -3,
0, -1, -2, -2, -1, -1, 0, 2, 1, -1, -2, -1, -1, -1, 0, 2,
1, 0, -2, -2, -2, -2, 1, 5, 1, -1, -2, -2, -2, 0, 5, 10,
0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0, 1, 2,
@@ -1054,23 +1046,23 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] =
1, -1, -2, -2, 0, 3, 5, 7, 2, 0, -2, -3, -2, 0, 2, 3,
3, 1, -2, -3, -3, -2, -1, -1, 3, 1, 0, -1, -1, -1, -1, -1,
1, 3, 5, 4, 2, -1, -3, -4, -3, -2, 1, 2, 1, 0, -1, -2,
- -5, -3, 0, 2, 2, 1, 0, 0, -3, -1, 1, 2, 2, 1, 0, 0,
+ -5, -3, 0, 2, 2, 1, 0, 0, -3, -1, 1, 2, 2, 1, 0, 0,
0, -1, -1, -1, 1, 2, 3, 4, -3, -4, -4, -3, -1, 0, 0, 1,
- -2, -3, -2, -1, 1, 1, 1, 1, -2, -2, 0, 3, 4, 4, 3, 2,
- -4, -4, -3, -2, -1, 1, 2, 3, 0, 1, 1, 1, -1, -2, -3, -3,
+ -2, -3, -2, -1, 1, 1, 1, 1, -2, -2, 0, 3, 4, 4, 3, 2,
+ -4, -4, -3, -2, -1, 1, 2, 3, 0, 1, 1, 1, -1, -2, -3, -3,
3, 4, 5, 4, 2, -1, -3, -3, -2, -2, 0, 2, 2, 2, 1, 0,
- -4, 0, 5, 7, 4, -1, -4, -4, -1, 2, 4, 3, 0, -3, -3, -2,
+ -4, 0, 5, 7, 4, -1, -4, -4, -1, 2, 4, 3, 0, -3, -3, -2,
2, 1, 0, -1, -2, -2, 0, 1, 0, 0, -1, -2, -2, -1, 1, 2,
- -4, -3, -2, -1, 0, 1, 2, 2, 10, 9, 5, 0, -3, -4, -3, -2,
+ -4, -3, -2, -1, 0, 1, 2, 2, 10, 9, 5, 0, -3, -4, -3, -2,
1, -1, -2, -2, -1, 0, 0, 0, -2, -2, -1, 1, 1, 1, 0, -1,
- -5, -3, 0, 3, 4, 2, 0, -2, -2, -1, 0, 1, 1, 0, -1, -1,
+ -5, -3, 0, 3, 4, 2, 0, -2, -2, -1, 0, 1, 1, 0, -1, -1,
3, 2, -1, -2, -2, -1, 1, 1, 7, 5, -1, -5, -6, -2, 2, 4,
- -2, 3, 3, -3, -4, 1, 2, -2, -3, 3, 4, -3, -4, 2, 3, -2,
- -3, 3, 4, -3, -4, 2, 3, -2, -4, 2, 4, -2, -3, 1, 2, -1,
+ -2, 3, 3, -3, -4, 1, 2, -2, -3, 3, 4, -3, -4, 2, 3, -2,
+ -3, 3, 4, -3, -4, 2, 3, -2, -4, 2, 4, -2, -3, 1, 2, -1,
4, 3, -1, -3, -3, -1, 1, 2, -4, -6, -4, 0, 4, 5, 4, 1,
0, 2, 5, 6, 2, -3, -5, -4, 1, 1, -1, -3, -5, -2, 2, 4,
- -1, 0, 1, 2, 2, 3, 3, 4, -1, 0, 1, 1, 0, -1, -1, -1,
- -1, 0, 1, 2, 2, 1, -1, -2, -3, -2, -1, 0, 0, -1, -2, -3,
+ -1, 0, 1, 2, 2, 3, 3, 4, -1, 0, 1, 1, 0, -1, -1, -1,
+ -1, 0, 1, 2, 2, 1, -1, -2, -3, -2, -1, 0, 0, -1, -2, -3,
1, 1, 1, 1, 0, 0, 1, 2, 1, 0, -1, 0, 0, 1, 1, 0,
1, -2, -4, -1, 1, 2, 1, 0, 1, -4, -7, -3, 1, 3, 2, 1,
1, 1, 1, 1, 1, 1, 0, -1, 1, 1, 1, 0, 1, 2, 2, 0,
@@ -1079,55 +1071,55 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] =
0, 1, 1, 1, -1, -3, -2, 0, -7, -5, 1, 6, 6, 2, -1, -1,
3, 1, -1, -3, -4, -2, 1, 4, 2, 0, -2, -3, -4, -3, -1, 2,
2, 2, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1,
- -1, 1, 1, -2, -5, -6, -4, -1, -1, 1, 4, 3, 2, 0, 1, 2,
- -1, 0, 2, 3, 1, 0, 0, 1, -1, 0, 1, 0, 0, -1, -1, 0,
+ -1, 1, 1, -2, -5, -6, -4, -1, -1, 1, 4, 3, 2, 0, 1, 2,
+ -1, 0, 2, 3, 1, 0, 0, 1, -1, 0, 1, 0, 0, -1, -1, 0,
0, 1, 2, 2, 0, -2, -1, 1, -2, -1, -1, -2, -1, 2, 6, 8,
- -1, -1, -2, -3, -2, 0, 1, 2, -1, 0, 0, -1, -1, 0, -1, -1,
+ -1, -1, -2, -3, -2, 0, 1, 2, -1, 0, 0, -1, -1, 0, -1, -1,
2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, -1, -1, 1,
- -1, 0, 2, 2, -1, -3, -2, 3, 0, 2, 3, 0, -5, -7, -2, 4,
- -1, 0, 0, 0, -1, -2, -3, -3, -1, 0, -1, -2, -2, -2, -2, -2,
+ -1, 0, 2, 2, -1, -3, -2, 3, 0, 2, 3, 0, -5, -7, -2, 4,
+ -1, 0, 0, 0, -1, -2, -3, -3, -1, 0, -1, -2, -2, -2, -2, -2,
1, 1, 0, 0, 1, 2, 0, -1, 1, 2, 1, 2, 5, 6, 2, 0,
- -2, -4, -3, 0, 2, 2, 0, -3, 3, 1, 0, 1, 2, 1, -2, -3,
+ -2, -4, -3, 0, 2, 2, 0, -3, 3, 1, 0, 1, 2, 1, -2, -3,
3, 1, 0, 0, 0, 0, 0, -1, 1, -1, -2, -2, -1, 1, 3, 3,
3, 2, 1, 2, 4, 3, 1, -2, -2, -4, -4, -3, -1, 0, -2, -3,
1, 0, -1, -1, 0, 1, 0, -1, 3, 2, 0, 0, 0, 1, 1, 0,
1, 1, 0, 0, 0, 0, 0, 0, 2, 3, 3, 2, 2, 2, 1, 1,
0, -1, -2, -3, -5, -5, -5, -4, 1, 1, 0, -1, 0, 1, 3, 3,
- -9, -6, -2, 0, 1, 1, 2, 2, -6, -2, 1, 2, 1, 1, 0, 1,
- -2, 1, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1,
+ -9, -6, -2, 0, 1, 1, 2, 2, -6, -2, 1, 2, 1, 1, 0, 1,
+ -2, 1, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1,
1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, -3, -2, 0,
- -3, -3, -3, -2, -1, 3, 7, 9, 1, 2, 2, 2, 0, -2, -4, -3,
+ -3, -3, -3, -2, -1, 3, 7, 9, 1, 2, 2, 2, 0, -2, -4, -3,
2, 0, -2, -1, 3, 4, -1, -6, 1, 0, -2, -3, -1, 3, 3, 0,
0, 3, 3, 0, -2, -1, 1, 1, -6, -1, 3, 2, -1, -2, 0, 1,
5, 3, 0, -2, -3, 0, 2, 1, 1, 1, 2, 2, 0, -2, -4, -7,
- -3, -2, 1, 2, 2, 1, -1, -4, 2, 2, 0, -2, -2, 0, 2, 2,
+ -3, -2, 1, 2, 2, 1, -1, -4, 2, 2, 0, -2, -2, 0, 2, 2,
0, 0, -2, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
- -2, -1, 0, 1, 0, 1, 2, 3, -4, -2, 0, 0, -1, 0, 2, 3,
- -2, -2, -2, -1, -1, 0, 2, 4, 0, 0, 0, 0, -1, -1, 0, 1,
+ -2, -1, 0, 1, 0, 1, 2, 3, -4, -2, 0, 0, -1, 0, 2, 3,
+ -2, -2, -2, -1, -1, 0, 2, 4, 0, 0, 0, 0, -1, -1, 0, 1,
0, -1, -1, -1, -1, -1, 0, 0, 6, 4, 2, 0, -1, -2, -1, -1,
- 0, 1, 1, 1, 1, -1, -5, -10, 1, 1, 1, 1, 1, 1, 0, -4,
+ 0, 1, 1, 1, 1, -1, -5,-10, 1, 1, 1, 1, 1, 1, 0, -4,
1, 0, 1, 1, 1, 1, 1, -1, 2, 1, 1, 1, 0, 0, 0, 0,
- -3, 1, 4, 3, 3, 1, -1, 0, -4, 0, 1, 0, -1, 0, 0, 0,
- -5, 0, 2, 1, 1, 1, 0, -1, -1, 2, 1, -2, -2, -1, 0, -1,
+ -3, 1, 4, 3, 3, 1, -1, 0, -4, 0, 1, 0, -1, 0, 0, 0,
+ -5, 0, 2, 1, 1, 1, 0, -1, -1, 2, 1, -2, -2, -1, 0, -1,
2, 4, 5, 3, 0, -1, 1, 2, 0, 0, 1, 0, -2, -2, -1, -1,
- -2, -2, -2, -2, -3, -2, -1, 0, 0, 0, 1, 0, 0, 0, 1, 2,
+ -2, -2, -2, -2, -3, -2, -1, 0, 0, 0, 1, 0, 0, 0, 1, 2,
0, -2, -2, -3, -1, 2, 2, -1, 1, 0, 0, 0, 1, 5, 3, -2,
- -1, -1, 0, -1, 0, 2, 0, -5, -1, 0, 1, 0, 0, 2, 2, -2,
+ -1, -1, 0, -1, 0, 2, 0, -5, -1, 0, 1, 0, 0, 2, 2, -2,
3, 1, -1, -1, 0, 1, 1, 2, 1, 0, 0, 1, 1, 1, 1, 1,
- -10, -8, -2, 1, 2, 1, 1, 1, -1, 1, 2, 1, 0, 0, 0, 0,
- -1, -1, 0, 1, 2, 2, 2, 1, -1, -1, -1, 0, -1, -3, -5, -4,
+ -10, -8, -2, 1, 2, 1, 1, 1, -1, 1, 2, 1, 0, 0, 0, 0,
+ -1, -1, 0, 1, 2, 2, 2, 1, -1, -1, -1, 0, -1, -3, -5, -4,
1, 1, 2, 1, 1, 0, 0, 2, -1, -2, -1, -1, -1, 0, 2, 4,
- -3, -7, -5, 0, 2, 0, 0, 0, 3, -1, -2, 1, 2, 1, 1, 2,
+ -3, -7, -5, 0, 2, 0, 0, 0, 3, -1, -2, 1, 2, 1, 1, 2,
1, -2, -1, 1, 2, 1, 0, 1, 0, -1, 0, 3, 2, -1, -1, -1,
2, 1, 1, 0, 0, 0, 0, 0, -9, -7, -2, 3, 3, 2, 1, 1,
3, 2, 0, -2, -2, -1, 1, 1, 0, -1, 0, 0, 1, 1, 0, 0,
- -2, -1, 1, 1, 1, 0, 0, 0, 1, 2, 1, -2, -4, -3, 1, 2,
+ -2, -1, 1, 1, 1, 0, 0, 0, 1, 2, 1, -2, -4, -3, 1, 2,
1, 2, 1, -2, -3, 0, 3, 1, -1, -1, 0, 0, 1, 3, 0, -4,
2, 0, -1, 1, 2, -2, -2, 3, 2, 0, -1, 2, 3, -2, -4, 1,
0, 1, 1, 1, 2, -2, -6, -2, -1, 0, 0, 0, 2, 0, -2, -1,
- -1, -1, 1, 2, 1, -2, -3, -2, 3, -1, -2, -1, -1, 0, 1, 2,
- 10, 4, 0, 0, -1, -2, -2, -1, 3, -1, -2, -1, 0, -1, -1, 0,
- -5, 2, 7, 1, -4, -2, 1, 0, -2, 2, 3, -1, -3, 0, 2, 0,
+ -1, -1, 1, 2, 1, -2, -3, -2, 3, -1, -2, -1, -1, 0, 1, 2,
+ 10, 4, 0, 0, -1, -2, -2, -1, 3, -1, -2, -1, 0, -1, -1, 0,
+ -5, 2, 7, 1, -4, -2, 1, 0, -2, 2, 3, -1, -3, 0, 2, 0,
2, 1, 0, 0, 1, 1, -1, -2, 1, -2, -2, -1, -1, -2, 0, 0,
0, 3, -2, -7, -1, 3, 0, 0, 1, 3, -3, -5, 2, 3, -1, 0,
0, 2, -2, -2, 4, 2, -2, 0, -1, 1, -1, 0, 2, -1, -2, 1,
@@ -1136,137 +1128,136 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] =
};
/* 6x16-entry codebook for intra-coded 8x8 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
-{
+DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] = {
4, 4, 3, 2, 2, 1, 0, -1, 4, 3, 3, 2, 1, 0, -1, -1,
3, 3, 2, 2, 1, 0, -1, -2, 3, 2, 2, 1, 0, -1, -2, -3,
2, 2, 1, 0, -1, -1, -2, -3, 2, 1, 0, 0, -1, -2, -3, -4,
1, 0, 0, -1, -2, -3, -4, -4, 0, 0, -1, -2, -2, -3, -4, -4,
2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3,
1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1,
- -1, 0, 0, 0, 0, 0, 1, 1, -2, -2, -1, -1, -1, -1, -1, -1,
- -3, -3, -3, -3, -3, -3, -2, -2, -5, -4, -4, -4, -4, -4, -4, -3,
- -4, -2, -1, 0, 1, 2, 2, 3, -4, -2, -1, 0, 1, 2, 3, 3,
- -4, -3, -1, 0, 1, 2, 3, 3, -4, -3, -1, 0, 1, 2, 3, 3,
- -5, -3, -1, 0, 1, 2, 3, 3, -5, -3, -1, 0, 1, 2, 3, 3,
- -5, -3, -1, 0, 1, 1, 2, 3, -5, -3, -2, -1, 0, 1, 2, 3,
+ -1, 0, 0, 0, 0, 0, 1, 1, -2, -2, -1, -1, -1, -1, -1, -1,
+ -3, -3, -3, -3, -3, -3, -2, -2, -5, -4, -4, -4, -4, -4, -4, -3,
+ -4, -2, -1, 0, 1, 2, 2, 3, -4, -2, -1, 0, 1, 2, 3, 3,
+ -4, -3, -1, 0, 1, 2, 3, 3, -4, -3, -1, 0, 1, 2, 3, 3,
+ -5, -3, -1, 0, 1, 2, 3, 3, -5, -3, -1, 0, 1, 2, 3, 3,
+ -5, -3, -1, 0, 1, 1, 2, 3, -5, -3, -2, -1, 0, 1, 2, 3,
4, 4, 5, 5, 6, 6, 7, 7, 2, 2, 2, 3, 3, 4, 4, 4,
0, 0, 0, 0, 1, 1, 1, 2, -2, -2, -2, -2, -1, -1, -1, 0,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -1, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -1, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -2, -2, -2, -2,
5, 3, 1, -1, -2, -3, -3, -3, 5, 3, 1, -1, -2, -3, -3, -3,
5, 3, 1, -1, -2, -3, -3, -3, 5, 3, 1, -1, -2, -3, -3, -3,
5, 4, 1, 0, -2, -3, -3, -3, 6, 4, 2, 0, -2, -2, -3, -3,
6, 4, 2, 0, -1, -2, -2, -3, 6, 4, 2, 1, -1, -2, -2, -2,
- -1, 1, 3, 3, 2, 0, -3, -6, -1, 1, 3, 4, 3, 0, -3, -6,
- -1, 1, 4, 4, 3, 1, -3, -6, -1, 1, 3, 4, 3, 1, -3, -6,
- -2, 1, 3, 4, 3, 1, -3, -6, -2, 1, 3, 4, 3, 1, -3, -7,
- -2, 1, 3, 3, 2, 0, -3, -7, -2, 0, 2, 3, 2, 0, -3, -6,
- 10, 9, 8, 6, 6, 5, 4, 4, 6, 5, 4, 3, 2, 2, 2, 1,
+ -1, 1, 3, 3, 2, 0, -3, -6, -1, 1, 3, 4, 3, 0, -3, -6,
+ -1, 1, 4, 4, 3, 1, -3, -6, -1, 1, 3, 4, 3, 1, -3, -6,
+ -2, 1, 3, 4, 3, 1, -3, -6, -2, 1, 3, 4, 3, 1, -3, -7,
+ -2, 1, 3, 3, 2, 0, -3, -7, -2, 0, 2, 3, 2, 0, -3, -6,
+ 10, 9, 8, 6, 6, 5, 4, 4, 6, 5, 4, 3, 2, 2, 2, 1,
2, 1, 0, -1, -2, -2, -2, -1, -1, -2, -3, -4, -4, -4, -4, -3,
- -2, -3, -4, -4, -5, -4, -4, -3, -2, -2, -3, -3, -3, -3, -2, -2,
- -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 1, 1, 1, 1, 1, 2,
- -2, -1, 1, 2, 4, 5, 7, 8, -3, -2, 0, 1, 3, 5, 7, 8,
- -4, -3, -1, 0, 2, 4, 6, 7, -5, -4, -2, -1, 1, 3, 5, 7,
- -6, -5, -3, -2, 0, 2, 4, 6, -6, -5, -4, -2, -1, 1, 3, 5,
- -7, -6, -5, -3, -2, 0, 2, 3, -8, -7, -5, -4, -3, -1, 1, 2,
- 11, 9, 7, 5, 3, 1, -1, -1, 10, 8, 6, 3, 1, 0, -2, -2,
+ -2, -3, -4, -4, -5, -4, -4, -3, -2, -2, -3, -3, -3, -3, -2, -2,
+ -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 1, 1, 1, 1, 1, 2,
+ -2, -1, 1, 2, 4, 5, 7, 8, -3, -2, 0, 1, 3, 5, 7, 8,
+ -4, -3, -1, 0, 2, 4, 6, 7, -5, -4, -2, -1, 1, 3, 5, 7,
+ -6, -5, -3, -2, 0, 2, 4, 6, -6, -5, -4, -2, -1, 1, 3, 5,
+ -7, -6, -5, -3, -2, 0, 2, 3, -8, -7, -5, -4, -3, -1, 1, 2,
+ 11, 9, 7, 5, 3, 1, -1, -1, 10, 8, 6, 3, 1, 0, -2, -2,
9, 7, 5, 2, 0, -2, -3, -4, 8, 6, 3, 1, -1, -3, -4, -4,
6, 4, 2, -1, -3, -4, -5, -5, 5, 3, 0, -2, -4, -5, -6, -6,
3, 1, -1, -3, -5, -6, -7, -7, 2, 0, -2, -4, -6, -6, -7, -7,
5, 6, 7, 7, 7, 8, 8, 8, 3, 4, 5, 5, 6, 6, 6, 6,
0, 2, 2, 3, 4, 4, 4, 5, -2, -1, 0, 1, 2, 2, 3, 3,
- -4, -3, -2, -1, 0, 1, 1, 2, -6, -5, -4, -3, -2, -2, -1, 0,
- -8, -7, -6, -6, -5, -4, -3, -3, -10, -9, -8, -8, -7, -6, -6, -5,
+ -4, -3, -2, -1, 0, 1, 1, 2, -6, -5, -4, -3, -2, -2, -1, 0,
+ -8, -7, -6, -6, -5, -4, -3, -3,-10, -9, -8, -8, -7, -6, -6, -5,
6, 5, 3, 1, -1, -3, -6, -8, 6, 5, 4, 2, -1, -3, -6, -8,
6, 5, 4, 2, 0, -3, -6, -8, 6, 5, 4, 2, 0, -3, -6, -8,
6, 6, 4, 2, 0, -3, -6, -8, 6, 5, 4, 2, 0, -3, -6, -8,
6, 5, 4, 2, 0, -3, -6, -8, 6, 5, 4, 2, -1, -3, -5, -8,
- 11, 10, 9, 8, 7, 6, 5, 4, 8, 8, 7, 6, 5, 4, 3, 2,
+ 11, 10, 9, 8, 7, 6, 5, 4, 8, 8, 7, 6, 5, 4, 3, 2,
6, 5, 4, 4, 2, 2, 1, 0, 3, 3, 2, 1, 0, 0, -1, -2,
1, 1, 0, -1, -2, -2, -3, -3, -1, -1, -2, -3, -4, -4, -5, -5,
- -3, -4, -4, -5, -6, -6, -7, -7, -5, -5, -6, -7, -8, -8, -8, -8,
- -14, -13, -12, -11, -9, -7, -6, -4, -12, -11, -10, -9, -7, -5, -3, -1,
- -10, -9, -7, -6, -3, -2, 0, 2, -8, -6, -4, -2, 0, 2, 4, 5,
- -5, -3, 0, 2, 4, 5, 7, 8, -2, 0, 2, 4, 6, 8, 9, 10,
+ -3, -4, -4, -5, -6, -6, -7, -7, -5, -5, -6, -7, -8, -8, -8, -8,
+ -14,-13,-12,-11, -9, -7, -6, -4,-12,-11,-10, -9, -7, -5, -3, -1,
+ -10, -9, -7, -6, -3, -2, 0, 2, -8, -6, -4, -2, 0, 2, 4, 5,
+ -5, -3, 0, 2, 4, 5, 7, 8, -2, 0, 2, 4, 6, 8, 9, 10,
0, 3, 5, 7, 8, 10, 11, 12, 3, 5, 7, 8, 10, 11, 12, 12,
- -19, -19, -18, -18, -17, -16, -15, -14, -15, -15, -14, -13, -12, -11, -10, -9,
- -11, -10, -9, -8, -6, -5, -4, -3, -6, -5, -3, -2, -1, 0, 1, 2,
- -1, 0, 2, 3, 4, 5, 6, 6, 4, 6, 7, 8, 9, 10, 10, 10,
+ -19,-19,-18,-18,-17,-16,-15,-14,-15,-15,-14,-13,-12,-11,-10, -9,
+ -11,-10, -9, -8, -6, -5, -4, -3, -6, -5, -3, -2, -1, 0, 1, 2,
+ -1, 0, 2, 3, 4, 5, 6, 6, 4, 6, 7, 8, 9, 10, 10, 10,
9, 10, 11, 12, 13, 14, 14, 14, 12, 14, 14, 15, 16, 16, 16, 16,
- 22, 21, 19, 17, 14, 11, 9, 5, 20, 19, 17, 14, 11, 8, 4, 1,
- 17, 15, 13, 10, 6, 3, 0, -4, 13, 11, 8, 5, 1, -2, -5, -9,
- 9, 6, 3, -1, -4, -7, -11, -13, 4, 0, -3, -6, -9, -12, -15, -17,
- -2, -5, -8, -11, -14, -16, -18, -20, -8, -10, -13, -16, -17, -19, -21, -22,
- 17, 18, 18, 18, 17, 16, 16, 14, 16, 16, 15, 15, 14, 13, 12, 11,
- 12, 12, 11, 10, 9, 8, 7, 5, 7, 6, 6, 4, 3, 2, 1, -1,
- 1, 0, -1, -2, -3, -4, -5, -6, -5, -6, -7, -8, -9, -10, -11, -12,
- -11, -12, -13, -14, -15, -16, -16, -17, -16, -17, -17, -18, -19, -20, -20, -20,
+ 22, 21, 19, 17, 14, 11, 9, 5, 20, 19, 17, 14, 11, 8, 4, 1,
+ 17, 15, 13, 10, 6, 3, 0, -4, 13, 11, 8, 5, 1, -2, -5, -9,
+ 9, 6, 3, -1, -4, -7,-11,-13, 4, 0, -3, -6, -9,-12,-15,-17,
+ -2, -5, -8,-11,-14,-16,-18,-20, -8,-10,-13,-16,-17,-19,-21,-22,
+ 17, 18, 18, 18, 17, 16, 16, 14, 16, 16, 15, 15, 14, 13, 12, 11,
+ 12, 12, 11, 10, 9, 8, 7, 5, 7, 6, 6, 4, 3, 2, 1, -1,
+ 1, 0, -1, -2, -3, -4, -5, -6, -5, -6, -7, -8, -9,-10,-11,-12,
+ -11,-12,-13,-14,-15,-16,-16,-17,-16,-17,-17,-18,-19,-20,-20,-20,
0, 0, 0, 0, -1, -1, -2, -3, 1, 0, 0, 0, 0, -1, -2, -3,
1, 1, 0, 0, -1, -1, -2, -2, 1, 1, 1, 0, 0, -1, -1, -2,
2, 1, 1, 1, 0, -1, -1, -2, 2, 2, 1, 1, 0, 0, -1, -2,
2, 2, 1, 1, 1, 0, -1, -1, 2, 2, 1, 1, 1, 0, 0, -2,
0, -1, -1, 0, 0, 1, 2, 3, 0, -1, -1, 0, 1, 1, 2, 2,
- -1, -1, -1, -1, 0, 1, 2, 2, -1, -1, -2, -1, 0, 1, 1, 2,
- -1, -2, -2, -1, 0, 0, 1, 2, -1, -2, -2, -2, -1, 0, 1, 2,
- -1, -1, -2, -1, 0, 0, 1, 2, -1, -1, -1, -1, 0, 1, 1, 2,
+ -1, -1, -1, -1, 0, 1, 2, 2, -1, -1, -2, -1, 0, 1, 1, 2,
+ -1, -2, -2, -1, 0, 0, 1, 2, -1, -2, -2, -2, -1, 0, 1, 2,
+ -1, -1, -2, -1, 0, 0, 1, 2, -1, -1, -1, -1, 0, 1, 1, 2,
3, 2, 2, 2, 1, 1, 0, 0, 3, 2, 2, 2, 2, 1, 0, 0,
2, 2, 2, 1, 1, 1, 0, 0, 2, 2, 1, 1, 1, 0, 0, -1,
1, 1, 1, 0, 0, 0, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -2, -2, -2, -2,
5, 2, 0, 0, -1, 0, 0, 0, 4, 2, 0, -1, -1, -1, 0, -1,
4, 1, -1, -1, -2, -1, -1, -1, 4, 1, -1, -1, -2, -1, -1, -1,
4, 1, -1, -2, -2, -1, -1, -1, 4, 1, -1, -2, -2, -1, -1, -1,
4, 1, -1, -1, -1, -1, -1, -1, 4, 2, 0, -1, 0, 0, 0, -1,
- -2, -1, 0, 1, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 1, 1,
- -3, -1, 0, 1, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 1, 1,
- -3, -2, 0, 1, 2, 2, 1, 1, -4, -2, 0, 1, 2, 2, 2, 2,
- -5, -3, -1, 1, 1, 2, 1, 2, -5, -3, -2, 0, 1, 1, 1, 1,
+ -2, -1, 0, 1, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 1, 1,
+ -3, -1, 0, 1, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 1, 1,
+ -3, -2, 0, 1, 2, 2, 1, 1, -4, -2, 0, 1, 2, 2, 2, 2,
+ -5, -3, -1, 1, 1, 2, 1, 2, -5, -3, -2, 0, 1, 1, 1, 1,
3, 3, 1, 0, -2, -4, -4, -5, 3, 3, 2, 0, -1, -2, -3, -4,
2, 2, 1, 1, 0, -1, -2, -2, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, -2, -1, -1, 0, 0, 1, 2, 2,
- -3, -2, -2, -1, 0, 1, 2, 3, -3, -3, -2, -1, 0, 1, 2, 3,
- -3, -3, -3, -3, -3, -2, -2, -2, -3, -3, -2, -2, -2, -1, -1, -1,
- -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
+ -3, -2, -2, -1, 0, 1, 2, 3, -3, -3, -2, -1, 0, 1, 2, 3,
+ -3, -3, -3, -3, -3, -2, -2, -2, -3, -3, -2, -2, -2, -1, -1, -1,
+ -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 2, 2, 2, 2,
1, 1, 1, 2, 2, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
- -8, -7, -5, -3, -2, -1, 0, -1, -4, -3, -1, 0, 1, 2, 1, 1,
- -1, 1, 2, 3, 3, 2, 2, 1, 1, 2, 3, 3, 2, 2, 1, 0,
+ -8, -7, -5, -3, -2, -1, 0, -1, -4, -3, -1, 0, 1, 2, 1, 1,
+ -1, 1, 2, 3, 3, 2, 2, 1, 1, 2, 3, 3, 2, 2, 1, 0,
2, 3, 3, 2, 1, 0, 0, -1, 1, 2, 1, 0, -1, -1, -1, -1,
1, 1, 0, -1, -1, -2, -2, -1, 1, 1, 0, 0, -1, -1, 0, -1,
- -4, -3, -2, 0, 1, 2, 3, 3, -4, -3, -2, 0, 1, 2, 2, 2,
- -3, -3, -2, -1, 0, 1, 1, 1, -2, -2, -2, -1, -1, 0, 0, 0,
+ -4, -3, -2, 0, 1, 2, 3, 3, -4, -3, -2, 0, 1, 2, 2, 2,
+ -3, -3, -2, -1, 0, 1, 1, 1, -2, -2, -2, -1, -1, 0, 0, 0,
0, -1, -1, -1, -1, -1, -1, -1, 2, 1, 1, 0, 0, -1, -1, -2,
3, 3, 3, 1, 0, -1, -2, -2, 5, 4, 4, 2, 1, 0, -1, -2,
0, 0, 0, 0, 1, 2, 3, 3, 0, -1, 0, 0, 1, 2, 3, 3,
0, -1, 0, 0, 1, 2, 3, 2, 0, 0, 0, 1, 1, 2, 2, 2,
2, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 1, 0, 0, -1, -2,
2, 1, 0, 0, -2, -3, -5, -6, 0, -1, -1, -3, -5, -6, -8, -9,
- -2, 0, 1, 2, 2, 1, -1, -4, -2, 0, 2, 2, 2, 1, -1, -4,
- -2, 0, 2, 2, 2, 1, -1, -3, -2, 0, 2, 2, 2, 1, -1, -3,
- -2, -1, 2, 2, 2, 1, -1, -3, -2, -1, 1, 2, 2, 1, -1, -3,
- -3, -1, 1, 2, 2, 1, -1, -3, -2, -1, 1, 2, 2, 1, -1, -3,
- -1, 1, 1, -1, -3, -3, 0, 4, -1, 1, 1, -1, -3, -3, 0, 4,
- -1, 1, 1, 0, -3, -3, 0, 4, -1, 1, 2, 0, -3, -3, 0, 5,
+ -2, 0, 1, 2, 2, 1, -1, -4, -2, 0, 2, 2, 2, 1, -1, -4,
+ -2, 0, 2, 2, 2, 1, -1, -3, -2, 0, 2, 2, 2, 1, -1, -3,
+ -2, -1, 2, 2, 2, 1, -1, -3, -2, -1, 1, 2, 2, 1, -1, -3,
+ -3, -1, 1, 2, 2, 1, -1, -3, -2, -1, 1, 2, 2, 1, -1, -3,
+ -1, 1, 1, -1, -3, -3, 0, 4, -1, 1, 1, -1, -3, -3, 0, 4,
+ -1, 1, 1, 0, -3, -3, 0, 4, -1, 1, 2, 0, -3, -3, 0, 5,
0, 1, 2, 0, -3, -4, 0, 4, 0, 1, 2, 0, -3, -4, 0, 5,
0, 1, 2, 0, -3, -3, 0, 4, 0, 1, 2, -1, -2, -2, 0, 4,
6, 6, 5, 6, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -1, -1, -2, -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,
+ -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0,
- -1, -2, -2, -2, -2, -2, -2, -1, -3, -3, -3, -3, -3, -3, -3, -2,
- -3, -4, -4, -3, -3, -3, -2, -2, -2, -2, -2, -2, -1, -1, 0, 0,
+ -1, -2, -2, -2, -2, -2, -2, -1, -3, -3, -3, -3, -3, -3, -3, -2,
+ -3, -4, -4, -3, -3, -3, -2, -2, -2, -2, -2, -2, -1, -1, 0, 0,
0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6,
4, 1, -2, -3, -3, -1, 1, 3, 4, 1, -2, -4, -3, -1, 1, 3,
5, 1, -2, -4, -3, -1, 1, 4, 5, 1, -2, -3, -3, -1, 2, 4,
5, 1, -2, -3, -3, -1, 2, 4, 4, 0, -3, -4, -3, -1, 2, 4,
4, 0, -3, -3, -3, -1, 1, 3, 3, 0, -2, -3, -2, -1, 1, 3,
- -3, -4, -4, -4, -4, -4, -4, -4, -1, -1, -1, -1, -1, -1, -2, -2,
+ -3, -4, -4, -4, -4, -4, -4, -4, -1, -1, -1, -1, -1, -1, -2, -2,
2, 1, 1, 2, 2, 1, 1, 1, 3, 3, 3, 4, 4, 3, 3, 3,
3, 3, 3, 4, 4, 4, 3, 3, 1, 2, 1, 2, 2, 2, 2, 2,
- -2, -2, -2, -1, -1, -1, 0, 0, -4, -4, -4, -4, -3, -3, -3, -3,
- -1, -2, -3, -3, -2, -2, -1, 0, 0, -1, -2, -2, -2, -1, 0, 1,
+ -2, -2, -2, -1, -1, -1, 0, 0, -4, -4, -4, -4, -3, -3, -3, -3,
+ -1, -2, -3, -3, -2, -2, -1, 0, 0, -1, -2, -2, -2, -1, 0, 1,
2, 1, -1, -1, -1, -1, 0, 1, 3, 1, 0, -1, -1, 0, 0, 1,
3, 2, 0, -1, 0, 0, 0, 1, 3, 1, 0, -1, 0, 0, 0, 1,
3, 1, 0, -1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 1,
@@ -1276,94 +1267,94 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
2, 2, 1, 0, -1, -1, -1, -1, 3, 3, 2, 1, 0, -1, -1, 0,
1, 0, 1, 0, 0, -1, -2, -1, 0, 0, 0, 0, -1, -1, -2, -1,
0, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
- -1, -1, -1, 0, 0, 0, 1, 1, -1, -1, -1, 0, 1, 1, 2, 3,
- -2, -2, -1, 0, 1, 2, 3, 4, -2, -2, -1, 0, 1, 2, 4, 5,
- -3, -1, 1, 0, 0, -1, 0, 1, -3, 0, 1, 0, -1, -1, 0, 2,
- -3, 0, 1, 0, -1, -1, 0, 2, -2, 1, 2, 0, -1, -1, 0, 2,
- -2, 1, 2, 0, -1, -1, 0, 2, -2, 1, 2, 0, -1, -1, 0, 2,
- -1, 2, 2, 0, -1, -1, 0, 2, -1, 1, 1, 0, -1, -1, -1, 1,
- -2, -2, -1, 1, 3, 4, 3, 1, -2, -2, -1, 0, 2, 3, 2, 0,
- -2, -2, -1, 0, 1, 2, 1, -1, -1, -1, -1, 0, 1, 2, 1, -1,
- -1, -1, -1, 0, 1, 1, 0, -2, 0, -1, -1, 0, 1, 1, 0, -1,
+ -1, -1, -1, 0, 0, 0, 1, 1, -1, -1, -1, 0, 1, 1, 2, 3,
+ -2, -2, -1, 0, 1, 2, 3, 4, -2, -2, -1, 0, 1, 2, 4, 5,
+ -3, -1, 1, 0, 0, -1, 0, 1, -3, 0, 1, 0, -1, -1, 0, 2,
+ -3, 0, 1, 0, -1, -1, 0, 2, -2, 1, 2, 0, -1, -1, 0, 2,
+ -2, 1, 2, 0, -1, -1, 0, 2, -2, 1, 2, 0, -1, -1, 0, 2,
+ -1, 2, 2, 0, -1, -1, 0, 2, -1, 1, 1, 0, -1, -1, -1, 1,
+ -2, -2, -1, 1, 3, 4, 3, 1, -2, -2, -1, 0, 2, 3, 2, 0,
+ -2, -2, -1, 0, 1, 2, 1, -1, -1, -1, -1, 0, 1, 2, 1, -1,
+ -1, -1, -1, 0, 1, 1, 0, -2, 0, -1, -1, 0, 1, 1, 0, -1,
0, -1, -1, 0, 1, 1, 1, -1, 0, -1, -1, 0, 0, 1, 0, -1,
- -2, -1, 0, 1, 1, 1, 1, 1, -2, -1, 0, 0, 0, 0, 0, 0,
- -2, -1, -1, 0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -2, -2, -3,
- -1, 0, 1, 1, 0, -1, -2, -2, 1, 2, 3, 3, 2, 1, 0, 0,
+ -2, -1, 0, 1, 1, 1, 1, 1, -2, -1, 0, 0, 0, 0, 0, 0,
+ -2, -1, -1, 0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -2, -2, -3,
+ -1, 0, 1, 1, 0, -1, -2, -2, 1, 2, 3, 3, 2, 1, 0, 0,
1, 2, 3, 3, 3, 2, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0,
0, -1, -1, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, -1, 0, 0, 1, 1, 0, 0, 0,
- -3, -2, -1, -1, -1, -1, 0, -1, -5, -5, -4, -3, -2, -2, -2, -1,
+ -3, -2, -1, -1, -1, -1, 0, -1, -5, -5, -4, -3, -2, -2, -2, -1,
1, 1, 1, 1, 2, 1, 0, -1, 1, 1, 1, 2, 1, 1, 0, -1,
1, 1, 1, 1, 1, 1, 0, -2, 2, 1, 1, 1, 1, 1, 0, -2,
1, 1, 0, 0, 0, 0, -1, -3, 1, 1, 0, 0, 0, -1, -2, -3,
1, 1, 0, 0, -1, -1, -2, -4, 1, 0, 0, -1, -2, -2, -3, -4,
8, 7, 5, 3, 2, 1, 1, 1, 2, 1, 0, 0, -1, -1, -2, -1,
- -1, -1, -1, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, -1, -1, 0,
+ -1, -1, -1, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, -1, -1, 0,
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
- -1, 0, 0, 0, 0, 0, -1, -1, -2, -2, -1, -1, -1, -2, -2, -1,
+ -1, 0, 0, 0, 0, 0, -1, -1, -2, -2, -1, -1, -1, -2, -2, -1,
9, 4, 0, -2, -2, -2, -1, -1, 7, 2, -1, -2, -2, -1, 0, 0,
4, 0, -2, -2, -1, 0, 1, 1, 1, -2, -2, -2, -1, 0, 1, 1,
- -1, -2, -2, -1, 0, 1, 1, 1, -1, -2, -1, 0, 1, 1, 1, 0,
- -1, -1, 0, 1, 1, 1, 0, -1, 0, -1, 0, 1, 0, 0, -1, -1,
+ -1, -2, -2, -1, 0, 1, 1, 1, -1, -2, -1, 0, 1, 1, 1, 0,
+ -1, -1, 0, 1, 1, 1, 0, -1, 0, -1, 0, 1, 0, 0, -1, -1,
0, 1, 1, 1, 1, 1, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0,
2, 2, 2, 2, 1, 0, -1, -1, 1, 1, 1, 0, -1, -2, -2, -2,
0, 0, 0, -1, -2, -3, -2, -2, -1, -1, -1, -2, -2, -2, -1, 0,
- -1, -1, -1, -1, 0, 0, 1, 2, -1, -1, -1, 0, 1, 2, 3, 4,
- -1, -1, 0, 0, -1, -2, -3, -3, -1, -1, 0, 0, 0, -1, -1, -1,
- -2, -2, -1, 0, 1, 1, 1, 1, -2, -2, -2, 0, 1, 2, 3, 3,
- -1, -1, -1, 0, 1, 3, 3, 3, 1, 0, 0, 0, 1, 1, 2, 2,
+ -1, -1, -1, -1, 0, 0, 1, 2, -1, -1, -1, 0, 1, 2, 3, 4,
+ -1, -1, 0, 0, -1, -2, -3, -3, -1, -1, 0, 0, 0, -1, -1, -1,
+ -2, -2, -1, 0, 1, 1, 1, 1, -2, -2, -2, 0, 1, 2, 3, 3,
+ -1, -1, -1, 0, 1, 3, 3, 3, 1, 0, 0, 0, 1, 1, 2, 2,
2, 2, 1, 0, 0, -1, -1, -1, 3, 2, 1, 0, -1, -2, -3, -3,
- -1, -1, -1, -2, -2, -3, -4, -5, 0, 0, 0, -1, -1, -3, -3, -4,
+ -1, -1, -1, -2, -2, -3, -4, -5, 0, 0, 0, -1, -1, -3, -3, -4,
1, 1, 1, 0, 0, -1, -2, -3, 2, 2, 2, 1, 1, 0, -1, -1,
2, 2, 2, 2, 1, 1, 0, -1, 2, 2, 2, 2, 2, 1, 0, 0,
1, 1, 2, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, -1,
- -2, 2, 3, 1, -1, 1, 1, -1, -3, 2, 3, 0, -1, 1, 1, -1,
- -3, 2, 3, 0, -1, 1, 1, -1, -4, 2, 3, 0, -1, 1, 1, -2,
- -4, 1, 3, 0, -1, 1, 1, -2, -4, 1, 3, -1, -2, 1, 1, -2,
- -3, 1, 2, 0, -1, 1, 1, -2, -3, 1, 2, 0, -1, 1, 1, -1,
- -1, -1, -1, -2, -2, -2, -2, -2, 1, 1, 1, 1, 0, 0, 0, 0,
+ -2, 2, 3, 1, -1, 1, 1, -1, -3, 2, 3, 0, -1, 1, 1, -1,
+ -3, 2, 3, 0, -1, 1, 1, -1, -4, 2, 3, 0, -1, 1, 1, -2,
+ -4, 1, 3, 0, -1, 1, 1, -2, -4, 1, 3, -1, -2, 1, 1, -2,
+ -3, 1, 2, 0, -1, 1, 1, -2, -3, 1, 2, 0, -1, 1, 1, -1,
+ -1, -1, -1, -2, -2, -2, -2, -2, 1, 1, 1, 1, 0, 0, 0, 0,
1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 2,
- -2, -2, -1, -1, -1, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, -2,
- -1, -1, -1, -1, -2, -2, -2, -2, 4, 4, 4, 4, 4, 3, 3, 2,
- -3, -3, -2, -1, 0, 1, 2, 5, -3, -3, -3, -2, -1, 1, 3, 6,
- -3, -3, -2, -2, 0, 2, 3, 5, -3, -2, -2, -2, 0, 1, 3, 5,
- -2, -2, -2, -1, -1, 1, 3, 5, -2, -2, -1, -1, 0, 1, 2, 4,
- -1, -1, -1, -1, 0, 1, 1, 4, -1, -1, -1, -1, 0, 1, 2, 3,
+ -2, -2, -1, -1, -1, 0, 0, 0, -3, -3, -3, -3, -3, -3, -3, -2,
+ -1, -1, -1, -1, -2, -2, -2, -2, 4, 4, 4, 4, 4, 3, 3, 2,
+ -3, -3, -2, -1, 0, 1, 2, 5, -3, -3, -3, -2, -1, 1, 3, 6,
+ -3, -3, -2, -2, 0, 2, 3, 5, -3, -2, -2, -2, 0, 1, 3, 5,
+ -2, -2, -2, -1, -1, 1, 3, 5, -2, -2, -1, -1, 0, 1, 2, 4,
+ -1, -1, -1, -1, 0, 1, 1, 4, -1, -1, -1, -1, 0, 1, 2, 3,
0, -1, 0, 1, 1, 0, -1, -1, 0, 0, 0, 1, 2, 0, -1, -1,
1, 0, -1, 0, 1, 0, 0, 0, 1, -1, -2, -1, 0, 0, 0, 0,
1, -2, -3, -1, 0, 0, 0, 1, 1, -1, -3, -2, 0, 1, 1, 2,
1, -1, -2, -1, 0, 1, 1, 2, 2, 0, -1, 0, 1, 1, 2, 2,
1, 1, 1, 1, 0, 0, 1, 2, -1, 0, 0, -1, 0, 0, 0, 1,
- -3, -2, -1, -1, -1, 0, 1, 1, -4, -2, -1, 0, 0, 1, 1, 1,
- -3, -2, 0, 0, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 0, 0,
- -1, 0, 1, 1, 1, 0, 0, -1, 0, 1, 2, 2, 1, 0, 0, -1,
- -4, -4, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1, 0, 0, 0, 0,
- -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
+ -3, -2, -1, -1, -1, 0, 1, 1, -4, -2, -1, 0, 0, 1, 1, 1,
+ -3, -2, 0, 0, 1, 1, 1, 1, -3, -1, 0, 1, 1, 1, 0, 0,
+ -1, 0, 1, 1, 1, 0, 0, -1, 0, 1, 2, 2, 1, 0, 0, -1,
+ -4, -4, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1, 0, 0, 0, 0,
+ -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
0, 0, 1, 1, 2, 2, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0,
0, 0, 0, 1, 1, 1, 1, 0, -1, 0, 0, 1, 1, 1, 0, 0,
1, 2, 2, 2, 1, -1, -2, -4, 1, 1, 2, 2, 1, 0, -2, -4,
0, 1, 1, 1, 1, 0, -1, -3, -1, 0, 1, 1, 0, 0, -1, -2,
- -1, 0, 1, 1, 1, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, -1,
- -1, -1, 0, 1, 1, 0, 0, 0, -1, 0, 1, 1, 1, 1, 1, 0,
+ -1, 0, 1, 1, 1, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, -1,
+ -1, -1, 0, 1, 1, 0, 0, 0, -1, 0, 1, 1, 1, 1, 1, 0,
2, 2, 0, -1, -2, -1, -1, -2, 1, 1, -1, -2, -2, -1, -1, -2,
1, 1, -1, -2, -2, 0, 0, -1, 1, 1, 0, -2, -1, 1, 1, 0,
1, 1, 0, -1, -1, 1, 2, 1, 1, 1, 0, -1, -1, 1, 2, 1,
1, 1, 0, -1, -1, 1, 1, 1, 1, 1, 0, -1, 0, 1, 1, 1,
0, 0, -1, -2, -4, -4, -4, -4, 3, 3, 3, 2, 1, 0, 0, 0,
3, 3, 3, 3, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 1,
- -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0,
+ -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0,
- -1, -1, 0, -1, -1, 1, 2, -1, 1, 1, 0, 0, 0, 2, 3, -1,
+ -1, -1, 0, -1, -1, 1, 2, -1, 1, 1, 0, 0, 0, 2, 3, -1,
1, 1, 0, -1, -1, 1, 3, -1, 1, 1, 0, -2, -2, 0, 1, -2,
1, 0, 0, -2, -2, 0, 1, -3, 0, 0, 0, 0, -1, 1, 1, -3,
0, 1, 1, 0, 1, 2, 1, -3, -1, 0, 1, 1, 1, 2, 1, -4,
- -4, -3, 0, 1, 1, 1, 0, 0, -4, -2, 0, 1, 1, 1, 0, -1,
- -3, -1, 1, 1, 1, 0, -1, -1, -1, 1, 1, 1, 1, 0, -1, 0,
+ -4, -3, 0, 1, 1, 1, 0, 0, -4, -2, 0, 1, 1, 1, 0, -1,
+ -3, -1, 1, 1, 1, 0, -1, -1, -1, 1, 1, 1, 1, 0, -1, 0,
1, 2, 2, 1, 0, -1, 0, 0, 2, 2, 1, 0, -1, -1, 0, 1,
2, 1, 0, -1, -2, -1, 0, 1, 2, 2, 0, -1, -2, -1, 1, 1,
1, 1, 0, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1,
1, 0, 0, -1, -1, -1, -1, -1, 2, 1, 0, 0, -1, -1, -1, -1,
5, 3, 2, 1, 0, 0, 0, 0, 6, 5, 3, 2, 1, 0, 0, 0,
4, 4, 3, 1, 0, 0, 0, 1, 3, 3, 2, 1, 0, 0, 0, 1,
@@ -1373,12 +1364,12 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
0, 0, -1, -1, -1, 0, 2, 3, 0, -1, -2, -2, -1, -1, 1, 2,
1, 0, -1, -1, -1, 0, 0, 0, 1, 1, 1, 0, 0, 0, -1, -1,
1, 2, 1, 0, 0, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1,
- -3, -2, -1, -1, 0, 1, 1, 2, -4, -3, -1, 1, 2, 3, 5, 5,
+ -3, -2, -1, -1, 0, 1, 1, 2, -4, -3, -1, 1, 2, 3, 5, 5,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, -1, 0, 0, 0, 1, -1, -1, -2, -2, -2, -1, -1, 0,
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
1, 1, 1, 1, 2, 2, 1, 1, -4, -3, -4, -4, -4, -4, -3, -3,
- -1, 0, 1, 2, 2, 3, 3, 3, -1, -1, -1, -1, 0, 0, 0, 0,
+ -1, 0, 1, 2, 2, 3, 3, 3, -1, -1, -1, -1, 0, 0, 0, 0,
0, 0, -1, -2, -2, -3, -3, -2, 3, 2, 1, 0, -1, -2, -2, -2,
4, 3, 2, 1, 1, 0, 0, 0, 2, 2, 1, 1, 0, 1, 1, 1,
0, -1, -1, -1, -1, 0, 0, 1, -2, -2, -2, -2, -2, -1, 0, 0,
@@ -1388,15 +1379,15 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
0, -2, 0, 2, 1, -2, -2, 1, 0, -1, 0, 2, 1, -2, -1, 1,
0, 1, 2, 2, 3, 3, 2, 2, 0, 1, 1, 2, 3, 3, 2, 1,
0, 0, 1, 2, 2, 2, 2, 1, -1, 0, 0, 1, 1, 1, 1, 1,
- -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1,
- -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -1,
+ -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1,
+ -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -1,
0, 0, -1, -2, -1, 0, 3, 5, 0, 0, -1, -1, -1, 0, 2, 4,
1, 1, 0, 0, -1, -1, 1, 2, 1, 2, 1, 1, 0, -1, -1, 0,
0, 1, 2, 1, 0, -1, -2, -2, -1, 0, 1, 2, 1, 0, -3, -3,
- -2, -1, 1, 2, 2, 0, -2, -4, -2, -1, 0, 2, 2, 1, -1, -3,
+ -2, -1, 1, 2, 2, 0, -2, -4, -2, -1, 0, 2, 2, 1, -1, -3,
0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, 0, 0,
- -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0,
- -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, 0, 0, 0, -1, -1, 0,
+ -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0,
+ -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, 0, 0, 0, -1, -1, 0,
0, 0, 1, 1, 0, 0, 0, 1, 3, 3, 3, 4, 3, 3, 3, 3,
5, 1, -2, -2, 0, 0, 0, -1, 4, -1, -3, -1, 0, 0, 0, -1,
3, -1, -1, 0, 1, 1, 0, -1, 2, 0, 0, 1, 1, 1, 0, -2,
@@ -1410,49 +1401,49 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -1, 0, 0, 1, 1, 0,
0, 0, -1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0,
0, 0, 1, 1, 2, 1, -1, -3, 0, 0, 0, 1, 1, -1, -4, -5,
- -2, -2, -2, -1, 0, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 0,
+ -2, -2, -2, -1, 0, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 0, -2, -3, 0, 0, 1, 1, 0, -1, -3, -4,
- -1, -1, 0, 1, 0, 0, -2, -3, -1, -1, 0, 1, 1, 1, 0, -1,
+ -1, -1, 0, 1, 0, 0, -2, -3, -1, -1, 0, 1, 1, 1, 0, -1,
0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
0, 1, 0, 0, 1, 1, 1, 2, 1, 2, 0, 0, 0, 0, -1, 1,
0, 2, 0, -1, 1, 0, -1, 0, 0, 1, 0, 0, 2, 1, 0, 1,
0, 1, -1, 0, 2, 2, 0, 1, -1, 0, -1, -1, 2, 1, 1, 2,
- -2, -2, -3, -2, 0, 1, 1, 1, -2, -2, -3, -3, -1, -1, -1, 0,
- -3, -1, 0, 1, 2, 1, 1, 0, -3, -1, 0, 1, 2, 1, 1, 1,
- -2, 0, 0, 1, 1, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0,
- -2, 0, 0, 0, 0, -1, -1, 0, -2, 0, 0, 0, 0, 0, -1, -1,
- -3, 0, 1, 1, 1, 1, 0, 1, -5, -2, 0, 1, 2, 2, 1, 2,
- -2, -1, -1, 0, 0, 1, 2, 3, 0, 0, 1, 1, 0, 0, 1, 2,
+ -2, -2, -3, -2, 0, 1, 1, 1, -2, -2, -3, -3, -1, -1, -1, 0,
+ -3, -1, 0, 1, 2, 1, 1, 0, -3, -1, 0, 1, 2, 1, 1, 1,
+ -2, 0, 0, 1, 1, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0,
+ -2, 0, 0, 0, 0, -1, -1, 0, -2, 0, 0, 0, 0, 0, -1, -1,
+ -3, 0, 1, 1, 1, 1, 0, 1, -5, -2, 0, 1, 2, 2, 1, 2,
+ -2, -1, -1, 0, 0, 1, 2, 3, 0, 0, 1, 1, 0, 0, 1, 2,
0, 0, 1, 0, -1, -1, 0, 1, -1, -1, -1, -1, -2, -2, -1, 0,
- -2, -2, -2, -2, -2, -1, 0, 1, 0, 0, 0, -1, 0, 1, 2, 2,
+ -2, -2, -2, -2, -2, -1, 0, 1, 0, 0, 0, -1, 0, 1, 2, 2,
2, 1, 0, 0, 0, 1, 2, 2, 2, 1, 0, -1, -1, -1, 0, 0,
0, 1, 1, 1, 1, 1, -1, -4, -1, -1, 0, 1, 1, 1, 0, -3,
- -2, -1, 0, 0, 1, 2, 2, -2, -1, 0, 0, 0, 0, 2, 3, -1,
- -1, 0, 0, 0, 0, 1, 2, 0, 0, 0, -1, -2, -1, 1, 1, 0,
+ -2, -1, 0, 0, 1, 2, 2, -2, -1, 0, 0, 0, 0, 2, 3, -1,
+ -1, 0, 0, 0, 0, 1, 2, 0, 0, 0, -1, -2, -1, 1, 1, 0,
0, 0, -1, -2, -2, 0, 2, 1, 0, 0, -1, -2, -1, 1, 2, 2,
1, 0, 0, 0, -2, -3, -2, -3, 0, 0, 1, 0, -2, -2, -1, -1,
0, -1, 1, 1, -1, -1, 0, 0, 0, -1, 1, 1, -1, -1, 0, 0,
0, 1, 2, 1, -1, -1, 0, 1, 1, 2, 3, 2, 0, 0, 1, 2,
- -1, 0, 2, 1, 0, 0, 2, 3, -2, -1, 0, 0, -1, 0, 1, 2,
+ -1, 0, 2, 1, 0, 0, 2, 3, -2, -1, 0, 0, -1, 0, 1, 2,
1, 1, 0, -1, -2, -2, -1, 1, 1, 1, 1, -1, -2, -2, 0, 2,
1, 1, 1, -1, -1, -1, 0, 2, 0, 0, 0, 0, 0, 0, 1, 2,
- -1, -1, -1, 0, 0, 0, 1, 2, -1, -2, -1, 1, 1, 1, 0, 0,
- -1, -2, -1, 1, 2, 2, 0, -1, -1, -2, -1, 2, 2, 2, 0, -1,
- -1, -1, -1, -2, -1, -1, 0, 1, 0, 0, -1, -1, -1, 0, 1, 2,
+ -1, -1, -1, 0, 0, 0, 1, 2, -1, -2, -1, 1, 1, 1, 0, 0,
+ -1, -2, -1, 1, 2, 2, 0, -1, -1, -2, -1, 2, 2, 2, 0, -1,
+ -1, -1, -1, -2, -1, -1, 0, 1, 0, 0, -1, -1, -1, 0, 1, 2,
1, 0, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 1, 1, 1, 1,
1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, -1, -1, -1,
1, 2, 1, 0, -1, -2, -2, -3, 2, 2, 1, 0, -2, -3, -4, -4,
- -4, -2, 1, 1, 1, 1, 0, 0, -2, 0, 1, 0, 0, 0, 0, 0,
+ -4, -2, 1, 1, 1, 1, 0, 0, -2, 0, 1, 0, 0, 0, 0, 0,
0, 1, 1, -2, -2, -1, 0, 1, 2, 2, 1, -2, -2, -1, 1, 2,
1, 2, 1, -2, -2, -1, 1, 2, -1, 1, 1, -1, -1, -1, 0, 1,
- -2, 0, 1, 1, 0, -1, -1, 0, -2, 0, 2, 2, 1, -1, -1, 0,
+ -2, 0, 1, 1, 0, -1, -1, 0, -2, 0, 2, 2, 1, -1, -1, 0,
1, 1, 0, 0, 0, 1, 0, 0, -2, -3, -3, -2, -2, -1, 0, 0,
- -3, -4, -3, -2, -1, 0, 0, 0, -1, -1, 0, 1, 2, 3, 2, 1,
+ -3, -4, -3, -2, -1, 0, 0, 0, -1, -1, 0, 1, 2, 3, 2, 1,
0, 1, 2, 3, 3, 3, 2, 1, 1, 1, 1, 2, 1, 0, 0, -1,
0, 0, 0, 0, -1, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0,
1, 1, 0, 0, -1, -1, 0, 2, 0, 0, 1, 0, -1, -1, 1, 1,
- -2, -1, 0, 1, 1, 1, 1, 1, -3, -3, 0, 2, 2, 1, 1, 0,
- -2, -2, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, -1,
+ -2, -1, 0, 1, 1, 1, 1, 1, -3, -3, 0, 2, 2, 1, 1, 0,
+ -2, -2, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, -1,
3, 1, -1, -3, -2, -1, 0, 1, 4, 2, -1, -3, -3, -1, 1, 2,
0, 0, 0, -1, -1, -1, -1, -1, 1, 2, 1, 0, 0, 0, -1, -1,
2, 3, 3, 2, 1, 0, -1, -1, 3, 4, 4, 2, 1, 0, -1, -2,
@@ -1462,49 +1453,49 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
0, 0, 0, 1, 1, 0, -1, -2, 0, 0, 0, 0, 1, 0, -1, -4,
1, 0, 0, 0, 0, 0, -2, -5, 1, 0, 0, 0, 0, 0, -1, -4,
1, 0, -1, 0, 0, 0, -1, -3, 0, -1, -1, 0, 1, 1, 1, -1,
- -2, -1, 0, 0, -1, -1, -1, -2, -1, 0, 0, 0, -1, -1, -2, -2,
+ -2, -1, 0, 0, -1, -1, -1, -2, -1, 0, 0, 0, -1, -1, -2, -2,
0, 1, 1, 0, -1, -1, -1, -2, 0, 1, 1, 0, 0, 0, -1, -1,
0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 2, 2, 1,
1, 1, 0, 0, 1, 2, 2, 1, 1, 1, 0, -1, 0, 1, 1, 0,
4, 2, 1, 0, 0, 1, 1, 1, 4, 2, 1, 0, 0, 0, 0, 1,
3, 1, 0, 0, -1, -1, -1, 0, 1, 0, 0, -1, -1, -2, -1, 0,
0, 0, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, -1, -1, 0, 1,
- -2, -1, 0, -1, -1, 0, 0, 1, -2, -2, -1, -2, -1, 0, 0, 1,
+ -2, -1, 0, -1, -1, 0, 0, 1, -2, -2, -1, -2, -1, 0, 0, 1,
0, 1, 1, 1, 2, 1, 0, -1, -1, -1, -1, 0, 0, -1, -2, -2,
- -1, 0, -1, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 1, 2,
+ -1, 0, -1, 0, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 1, 2,
0, 0, 0, 0, 0, 0, 2, 3, -1, 0, -1, -1, -1, -1, 0, 3,
- -1, 0, 0, -1, -1, -2, 0, 3, 0, 0, 0, 0, -1, -1, 1, 4,
+ -1, 0, 0, -1, -1, -2, 0, 3, 0, 0, 0, 0, -1, -1, 1, 4,
2, 2, 0, 0, 0, 0, 0, 1, 1, 1, -1, -2, -1, -2, -1, 1,
- -1, -1, -2, -2, -2, -3, -2, 0, -1, 0, -1, -1, -1, -2, -1, 1,
+ -1, -1, -2, -2, -2, -3, -2, 0, -1, 0, -1, -1, -1, -2, -1, 1,
1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 0, 0, 1, 0, 0, 1,
2, 2, 0, 0, 0, 0, -1, -1, 2, 2, 0, 0, 1, 0, -1, -1,
- -1, 0, 1, 1, 0, -1, -1, -1, 1, 2, 3, 2, 1, 0, 0, 0,
+ -1, 0, 1, 1, 0, -1, -1, -1, 1, 2, 3, 2, 1, 0, 0, 0,
0, 1, 1, 1, 0, -1, 0, 0, -2, -2, -1, 0, 1, 0, 0, 0,
- -2, -2, -1, 2, 2, 2, 1, 0, -2, -1, 0, 1, 1, 0, 0, -1,
- -1, -1, 0, 0, -1, -2, -1, -2, 0, 1, 1, 1, 0, 0, 1, 1,
- -3, -3, -3, -2, -1, -1, -2, -2, -1, -1, 0, 1, 2, 1, 0, 0,
+ -2, -2, -1, 2, 2, 2, 1, 0, -2, -1, 0, 1, 1, 0, 0, -1,
+ -1, -1, 0, 0, -1, -2, -1, -2, 0, 1, 1, 1, 0, 0, 1, 1,
+ -3, -3, -3, -2, -1, -1, -2, -2, -1, -1, 0, 1, 2, 1, 0, 0,
1, 1, 1, 2, 2, 1, 0, 0, 1, 1, 1, 1, 1, 0, -1, 1,
1, 0, -1, -1, 0, 0, -1, 1, 0, -1, -1, -1, 0, -1, -1, 1,
1, 0, -1, 0, 0, -1, 0, 2, 2, 0, -1, 0, 0, 0, 0, 2,
1, 0, -2, -1, 0, 1, 1, 0, 2, 0, -1, -1, 0, 1, 1, 0,
1, 0, -2, -1, 0, 1, 0, -1, 1, 0, -1, -1, 0, 1, 0, -1,
0, 1, 1, 0, 1, 1, 0, 0, -2, 1, 2, 1, 0, 0, 0, 1,
- -5, 0, 2, 1, 0, -1, 0, 1, -6, -1, 2, 1, 0, -1, 0, 0,
+ -5, 0, 2, 1, 0, -1, 0, 1, -6, -1, 2, 1, 0, -1, 0, 0,
5, 3, 0, -1, -2, -1, -1, -1, 1, 1, 0, -1, -1, 0, -1, -1,
- -1, 0, 1, 1, 2, 2, 1, 0, -2, -1, 0, 1, 2, 1, 1, 1,
- -2, -1, -1, -1, 0, -1, 0, 1, 0, 1, 0, 0, -1, -1, 0, 0,
+ -1, 0, 1, 1, 2, 2, 1, 0, -2, -1, 0, 1, 2, 1, 1, 1,
+ -2, -1, -1, -1, 0, -1, 0, 1, 0, 1, 0, 0, -1, -1, 0, 0,
0, 1, 1, 1, 1, 0, 0, 0, -3, -2, 0, 1, 1, 0, 0, -1,
- -1, 0, 1, 0, -1, 0, 2, 3, -1, 0, 0, -2, -4, -2, -1, 0,
+ -1, 0, 1, 0, -1, 0, 2, 3, -1, 0, 0, -2, -4, -2, -1, 0,
0, 1, 1, 0, -2, -1, 0, -1, 1, 2, 3, 1, 0, 1, 1, 0,
- -1, 0, 1, 1, 1, 1, 1, 0, -2, -3, -2, 0, 0, 0, 1, 0,
- -1, -2, -2, 0, 1, 0, 0, -1, 3, 1, 0, 0, 1, 0, -1, -1,
- -2, -1, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, 0, 1, 1, 1,
- -1, -1, -1, 0, 1, 1, 1, 1, 0, -2, -3, -1, 1, 0, 0, 0,
+ -1, 0, 1, 1, 1, 1, 1, 0, -2, -3, -2, 0, 0, 0, 1, 0,
+ -1, -2, -2, 0, 1, 0, 0, -1, 3, 1, 0, 0, 1, 0, -1, -1,
+ -2, -1, 0, 0, -1, -1, 0, 0, -1, 0, 0, 0, 0, 1, 1, 1,
+ -1, -1, -1, 0, 1, 1, 1, 1, 0, -2, -3, -1, 1, 0, 0, 0,
1, -1, -3, -1, 1, 1, 0, -1, 3, 1, -1, 1, 2, 2, 0, -1,
3, 1, 0, 1, 2, 1, 1, 0, 0, -2, -2, -1, -1, 0, 0, 0,
1, 0, -1, -1, 1, 2, 1, 0, 0, -1, -2, -1, 1, 2, 2, 1,
- -1, -1, -1, 0, 0, 1, 2, 0, -2, 0, 0, 0, 0, 0, 1, -1,
- -1, 0, 1, 0, -1, -1, -1, -1, 0, 1, 1, 2, 0, -2, -1, 0,
+ -1, -1, -1, 0, 0, 1, 2, 0, -2, 0, 0, 0, 0, 0, 1, -1,
+ -1, 0, 1, 0, -1, -1, -1, -1, 0, 1, 1, 2, 0, -2, -1, 0,
1, 2, 2, 2, 1, -1, -1, 0, 0, 1, 1, 1, 0, -2, -2, -1,
0, 0, -1, -1, -1, -1, -2, -2, 0, 0, -1, 0, 1, 2, 2, 1,
0, 0, -1, -1, 0, 1, 2, 2, 1, 1, -1, -2, -1, -1, -1, -1,
@@ -1517,16 +1508,15 @@ DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] =
1, 1, 1, 1, 1, -1, -1, -2, 0, 0, 0, 1, 1, 1, 1, 1,
0, 0, 0, 1, 1, 1, 2, 3, 1, 0, 0, -1, 0, 0, 1, 2,
0, -1, -1, -2, -1, 0, 1, 2, -2, -2, -2, -2, -1, 0, 1, 1,
- -1, -1, -1, -1, 0, 0, 0, -1, 2, 2, 2, 0, -1, -1, -2, -4,
- -1, -2, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, 0, 1, 2, 3,
+ -1, -1, -1, -1, 0, 0, 0, -1, 2, 2, 2, 0, -1, -1, -2, -4,
+ -1, -2, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, 0, 1, 2, 3,
1, 0, -1, 0, -1, 0, 1, 2, 1, 0, 0, 0, -1, 0, 2, 2,
1, 0, -1, -1, -2, 0, 1, 2, 0, -2, -2, -2, -3, -1, 0, 1,
0, -2, -2, -2, -2, -1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 2
};
/* list of codebooks for intra-coded vectors */
-const int8_t* const ff_svq1_intra_codebooks[6] =
-{
+const int8_t* const ff_svq1_intra_codebooks[6] = {
svq1_intra_codebook_4x2, svq1_intra_codebook_4x4,
svq1_intra_codebook_8x4, svq1_intra_codebook_8x8,
NULL, NULL,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_vlc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_vlc.h
index 2ac099d27..b89562620 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_vlc.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1_vlc.h
@@ -24,67 +24,63 @@
#include <stdint.h>
/* 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 } */
+const uint8_t ff_svq1_block_type_vlc[4][2] = {
+ /* { 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] =
+const uint8_t ff_svq1_intra_multistage_vlc[6][8][2] = {
+ /* { code, length } */
{
- /* { 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 }
- }
+ { 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] =
+const uint8_t ff_svq1_inter_multistage_vlc[6][8][2] = {
+ /* { code, length } */
{
- /* { 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 }
- }
+ { 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 } */
+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 },
@@ -152,9 +148,8 @@ const uint16_t ff_svq1_intra_mean_vlc[256][2] =
};
/* 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 } */
+const uint16_t ff_svq1_inter_mean_vlc[512][2] = {
+ /* { 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 },
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1dec.c
index 2d74b963d..9c810cdc7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq1dec.c
@@ -52,82 +52,79 @@ static VLC svq1_intra_mean;
static VLC svq1_inter_mean;
/* motion vector (prediction) */
-typedef struct svq1_pmv_s
-{
- int x;
- int y;
+typedef struct svq1_pmv_s {
+ 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
+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
};
-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
+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
};
#define SVQ1_PROCESS_VECTOR()\
@@ -205,628 +202,566 @@ static const uint8_t string_table[256] =
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 */
+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 */
+ }
- if((stages > 0) && (level >= 4))
- {
+ if ((stages > 0) && (level >= 4)) {
#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n", stages, level);
+ av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",stages,level);
#endif
- return -1; /* invalid vector */
- }
+ return -1; /* invalid vector */
+ }
- mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
+ 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);
- SVQ1_DO_CODEBOOK_INTRA()
- }
+ 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()
}
+ }
- 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();
+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;
- /* destination address and vector size */
- dst = (uint32_t *) list[i];
- width = 1 << ((4 + level) / 2);
- height = 1 << ((3 + level) / 2);
+ /* recursively process vector */
+ for (i=0, m=1, n=1, level=5; i < n; i++) {
+ SVQ1_PROCESS_VECTOR();
- /* get number of stages (-1 skips vector, 0 for mean only) */
- stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 1;
+ /* destination address and vector size */
+ dst = (uint32_t *) list[i];
+ width = 1 << ((4 + level) /2);
+ height = 1 << ((3 + level) /2);
- if(stages == -1) continue; /* skip vector */
+ /* 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 > 0) && (level >= 4))
- {
+ if (stages == -1) continue; /* skip vector */
+
+ if ((stages > 0) && (level >= 4)) {
#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n", stages, level);
+ av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",stages,level);
#endif
- return -1; /* invalid vector */
- }
+ return -1; /* invalid vector */
+ }
- mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
+ mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
- SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks);
- SVQ1_DO_CODEBOOK_NONINTRA()
- }
- return 0;
+ SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks);
+ SVQ1_DO_CODEBOOK_NONINTRA()
+ }
+ 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 -1;
- else if(diff)
- {
- if(get_bits1(bitbuf)) diff = -diff;
- }
-
- /* add median of motion vector predictors and clip result */
- if(i == 1)
- mv->y = ((diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y)) << 26) >> 26;
- else
- mv->x = ((diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x)) << 26) >> 26;
+ /* 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;
}
- return 0;
+ /* add median of motion vector predictors and clip result */
+ if (i == 1)
+ mv->y = ((diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y)) << 26) >> 26;
+ else
+ mv->x = ((diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x)) << 26) >> 26;
+ }
+
+ 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 (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;
- 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;
+ 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;
- if(y + (mv.y >> 1) < 0)
- mv.y = 0;
- if(x + (mv.x >> 1) < 0)
- mv.x = 0;
+ if(y + (mv.y >> 1)<0)
+ mv.y= 0;
+ if(x + (mv.x >> 1)<0)
+ mv.x= 0;
#if 0
- int w = (s->width + 15)&~15;
- int h = (s->height + 15)&~15;
- if(x + (mv.x >> 1) < 0 || y + (mv.y >> 1) < 0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16 > h)
- av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1));
+ int w= (s->width+15)&~15;
+ int h= (s->height+15)&~15;
+ if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16> h)
+ av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1));
#endif
- src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];
- dst = current;
+ src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];
+ dst = current;
- s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst, src, pitch, 16);
+ s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16);
- return 0;
+ return 0;
}
-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;
-
- /* 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);
+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;
- if(result != 0)
- return result;
+ /* 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;
- /* predict and decode motion vector (2) */
- pmv[1] = &motion[0];
- pmv[2] = &motion[(x / 8) + 1];
+ /* predict and decode motion vector (2) */
+ pmv[1] = &motion[0];
+ pmv[2] = &motion[(x / 8) + 1];
- result = svq1_decode_motion_vector(bitbuf, &motion[(x / 8) + 2], pmv);
+ result = svq1_decode_motion_vector (bitbuf, &motion[(x / 8) + 2], 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 (3) */
+ pmv[2] = &motion[(x / 8) + 2];
+ pmv[3] = &motion[(x / 8) + 3];
- result = svq1_decode_motion_vector(bitbuf, pmv[3], pmv);
+ result = svq1_decode_motion_vector (bitbuf, pmv[3], pmv);
- if(result != 0)
- return result;
+ if (result != 0)
+ return result;
- /* form predictions */
- for(i = 0; i < 4; i++)
- {
- int mvx = pmv[i]->x + (i & 1) * 16;
- int mvy = pmv[i]->y + (i >> 1) * 16;
+ /* form predictions */
+ for (i=0; i < 4; i++) {
+ int mvx= pmv[i]->x + (i&1)*16;
+ int mvy= pmv[i]->y + (i>>1)*16;
- ///XXX /FIXME clipping or padding?
- if(y + (mvy >> 1) < 0)
- mvy = 0;
- if(x + (mvx >> 1) < 0)
- mvx = 0;
+ ///XXX /FIXME clipping or padding?
+ if(y + (mvy >> 1)<0)
+ mvy= 0;
+ if(x + (mvx >> 1)<0)
+ mvx= 0;
#if 0
- int w = (s->width + 15)&~15;
- int h = (s->height + 15)&~15;
- if(x + (mvx >> 1) < 0 || y + (mvy >> 1) < 0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8 > h)
- av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1));
+ int w= (s->width+15)&~15;
+ int h= (s->height+15)&~15;
+ if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8> h)
+ av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1));
#endif
- src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch];
- dst = current;
+ src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch];
+ dst = current;
- s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst, src, pitch, 8);
+ s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst,src,pitch,8);
- /* select next block */
- if(i & 1)
- {
- current += 8 * (pitch - 1);
- }
- else
- {
- current += 8;
- }
+ /* select next block */
+ if (i & 1) {
+ current += 8*(pitch - 1);
+ } else {
+ current += 8;
}
+ }
- return 0;
+ return 0;
}
-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)
+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);
+
+ if (result != 0)
{
- 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);
-
- if(result != 0)
- {
#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_block %i\n", result);
+ av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_block %i\n",result);
#endif
- break;
- }
- result = svq1_decode_block_non_intra(bitbuf, current, pitch);
- break;
+ break;
+ }
+ result = svq1_decode_block_non_intra (bitbuf, current, pitch);
+ break;
- case SVQ1_BLOCK_INTER_4V:
- result = svq1_motion_inter_4v_block(s, bitbuf, current, previous, pitch, motion, x, y);
+ case SVQ1_BLOCK_INTER_4V:
+ result = svq1_motion_inter_4v_block (s, bitbuf, current, previous, pitch, motion, x, y);
- if(result != 0)
- {
+ if (result != 0)
+ {
#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_4v_block %i\n", result);
+ av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_4v_block %i\n",result);
#endif
- break;
- }
- result = svq1_decode_block_non_intra(bitbuf, current, pitch);
- break;
-
- case SVQ1_BLOCK_INTRA:
- result = svq1_decode_block_intra(bitbuf, current, pitch);
- break;
+ break;
}
+ result = svq1_decode_block_non_intra (bitbuf, current, pitch);
+ break;
- return result;
+ case SVQ1_BLOCK_INTRA:
+ result = svq1_decode_block_intra (bitbuf, current, pitch);
+ break;
+ }
+
+ return result;
}
-uint16_t ff_svq1_packet_checksum(const uint8_t *data, const int length, int value)
-{
- int i;
+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);
- }
+ for (i=0; i < length; i++) {
+ value = checksum_table[data[i] ^ (value >> 8)] ^ ((value & 0xFF) << 8);
+ }
- return value;
+ return value;
}
-static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
-{
- uint8_t seed;
- int i;
+static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) {
+ uint8_t seed;
+ int i;
- out[0] = get_bits(bitbuf, 8);
+ out[0] = get_bits (bitbuf, 8);
- seed = string_table[out[0]];
+ seed = string_table[out[0]];
- for(i = 1; i <= out[0]; i++)
- {
- out[i] = get_bits(bitbuf, 8) ^ seed;
- seed = string_table[out[i] ^ seed];
- }
+ for (i=1; i <= out[0]; i++) {
+ out[i] = get_bits (bitbuf, 8) ^ seed;
+ seed = string_table[out[i] ^ seed];
+ }
}
-static int svq1_decode_frame_header(GetBitContext *bitbuf, MpegEncContext *s)
-{
- int frame_size_code;
- int temporal_reference;
+static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
+ int frame_size_code;
+ int temporal_reference;
- temporal_reference = get_bits(bitbuf, 8);
+ temporal_reference = get_bits (bitbuf, 8);
- /* frame type */
- s->pict_type = get_bits(bitbuf, 2) + 1;
- if(s->pict_type == 4)
- return -1;
+ /* frame type */
+ s->pict_type= get_bits (bitbuf, 2)+1;
+ if(s->pict_type==4)
+ return -1;
- if(s->pict_type == FF_I_TYPE)
- {
+ if (s->pict_type == FF_I_TYPE) {
- /* unknown fields */
- if(s->f_code == 0x50 || s->f_code == 0x60)
- {
- int csum = get_bits(bitbuf, 16);
+ /* unknown fields */
+ if (s->f_code == 0x50 || s->f_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);
- }
+ }
- if((s->f_code ^ 0x10) >= 0x50)
- {
- uint8_t msg[256];
+ if ((s->f_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(s->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 -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;
}
+ }
- /* 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 -1;
+ }
- 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);
- }
+ 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);
}
+ }
- return 0;
+ return 0;
}
static int svq1_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
- MpegEncContext *s = avctx->priv_data;
- uint8_t *current, *previous;
- int result, i, x, y, width, height;
- AVFrame *pict = data;
+ MpegEncContext *s=avctx->priv_data;
+ uint8_t *current, *previous;
+ int result, i, x, y, width, height;
+ AVFrame *pict = data;
- /* initialize bit buffer */
- init_get_bits(&s->gb, buf, buf_size * 8);
+ /* initialize bit buffer */
+ init_get_bits(&s->gb,buf,buf_size*8);
- /* decode frame header */
- s->f_code = get_bits(&s->gb, 22);
+ /* decode frame header */
+ s->f_code = get_bits (&s->gb, 22);
- if((s->f_code & ~0x70) || !(s->f_code & 0x60))
- return -1;
+ if ((s->f_code & ~0x70) || !(s->f_code & 0x60))
+ return -1;
- /* swap some header bytes (why?) */
- if(s->f_code != 0x20)
- {
- uint32_t *src = (uint32_t *)(buf + 4);
+ /* swap some header bytes (why?) */
+ if (s->f_code != 0x20) {
+ uint32_t *src = (uint32_t *) (buf + 4);
- for(i = 0; i < 4; i++)
- {
- src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
- }
+ for (i=0; i < 4; i++) {
+ src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
}
+ }
- result = svq1_decode_frame_header(&s->gb, s);
+ result = svq1_decode_frame_header (&s->gb, s);
- if(result != 0)
- {
+ if (result != 0)
+ {
#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_frame_header %i\n", result);
+ av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_frame_header %i\n",result);
#endif
- return result;
+ return result;
+ }
+
+ //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==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
+
+ if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
+ ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
+ || avctx->skip_frame >= AVDISCARD_ALL)
+ return buf_size;
+
+ if(MPV_frame_start(s, avctx) < 0)
+ 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;
}
- //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 == FF_B_TYPE && s->last_picture_ptr == NULL) return buf_size;
-
- if(avctx->hurry_up && s->pict_type == FF_B_TYPE) return buf_size;
- if((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
- || avctx->skip_frame >= AVDISCARD_ALL)
- return buf_size;
-
- if(MPV_frame_start(s, avctx) < 0)
- return -1;
+ current = s->current_picture.data[i];
- /* 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;
- }
-
- current = s->current_picture.data[i];
-
- if(s->pict_type == FF_B_TYPE)
- {
- previous = s->next_picture.data[i];
- }
- else
- {
- previous = s->last_picture.data[i];
- }
+ if(s->pict_type==FF_B_TYPE){
+ previous = s->next_picture.data[i];
+ }else{
+ previous = s->last_picture.data[i];
+ }
- if(s->pict_type == FF_I_TYPE)
- {
- /* 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)
- {
+ if (s->pict_type == FF_I_TYPE) {
+ /* 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)
+ {
//#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n", result);
+ av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
//#endif
- return result;
- }
- }
- current += 16 * linesize;
- }
+ return result;
+ }
}
- else
- {
-#if __STDC_VERSION__ >= 199901L
- svq1_pmv pmv[width/8+3];
-#else
- svq1_pmv *pmv = _alloca(sizeof(svq1_pmv) * (width / 8 + 3));
-#endif
- /* 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)
- {
+ current += 16*linesize;
+ }
+ } else {
+ #if __STDC_VERSION__ >= 199901L
+ svq1_pmv pmv[width/8+3];
+ #else
+ svq1_pmv *pmv=_alloca(sizeof(svq1_pmv)*(width/8+3));
+ #endif
+ /* 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)
+ {
#ifdef DEBUG_SVQ1
- av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n", result);
+ av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n",result);
#endif
- return result;
- }
- }
+ return result;
+ }
+ }
- pmv[0].x =
- pmv[0].y = 0;
+ pmv[0].x =
+ pmv[0].y = 0;
- current += 16 * linesize;
- }
- }
+ current += 16*linesize;
+ }
}
+ }
- *pict = *(AVFrame*)&s->current_picture;
+ *pict = *(AVFrame*)&s->current_picture;
- MPV_frame_end(s);
+ MPV_frame_end(s);
- *data_size = sizeof(AVFrame);
- return buf_size;
+ *data_size=sizeof(AVFrame);
+ return buf_size;
}
static av_cold int svq1_decode_init(AVCodecContext *avctx)
@@ -838,47 +773,46 @@ static av_cold int svq1_decode_init(AVCodecContext *avctx)
MPV_decode_defaults(s);
s->avctx = avctx;
- s->width = (avctx->width + 3)&~3;
- s->height = (avctx->height + 3)&~3;
- s->codec_id = avctx->codec->id;
+ 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;
+ 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;
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,
- &mvtab[0][1], 2, 1,
- &mvtab[0][0], 2, 1, 176);
+ &mvtab[0][1], 2, 1,
+ &mvtab[0][0], 2, 1, 176);
- for(i = 0; i < 6; i++)
- {
+ 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 VLC_TYPE table[168][2];
svq1_intra_multistage[i].table = &table[offset];
svq1_intra_multistage[i].table_allocated = 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);
+ &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];
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;
}
@@ -892,8 +826,7 @@ static av_cold int svq1_decode_end(AVCodecContext *avctx)
}
-AVCodec svq1_decoder =
-{
+AVCodec svq1_decoder = {
"svq1",
CODEC_TYPE_VIDEO,
CODEC_ID_SVQ1,
@@ -906,11 +839,8 @@ AVCodec svq1_decoder =
/*.next=*/NULL,
/*.flush=*/ff_mpeg_flush,
/*.supported_framerates = */NULL,
-#if __STDC_VERSION__ >= 199901L
- .pix_fmts = (const enum PixelFormat[])
- {
- PIX_FMT_YUV410P, PIX_FMT_NONE
- },
+#if __STDC_VERSION__ >= 199901L
+ .pix_fmts=(const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
#else
/*.pix_fmts = */NULL,
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq3.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq3.c
index ef72d3d44..36d263f39 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq3.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/svq3.c
@@ -77,16 +77,14 @@
/
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,
+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,
};
-static const uint8_t svq3_pred_0[25][2] =
-{
+static const uint8_t svq3_pred_0[25][2] = {
{ 0, 0 },
{ 1, 0 }, { 0, 1 },
{ 0, 2 }, { 1, 1 }, { 2, 0 },
@@ -98,48 +96,33 @@ static const uint8_t svq3_pred_0[25][2] =
{ 4, 4 }
};
-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 }
- },
+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 } },
};
-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 },
- { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 }
- }
+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 },
+ { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
};
-static const uint32_t svq3_dequant_coeff[32] =
-{
- 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
- 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
+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
+ 61694, 68745, 77615, 89113,100253,109366,126635,141533
};
@@ -149,58 +132,54 @@ void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp)
#define stride 16
int i;
int temp[16];
- 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};
+ 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++)
- {
+ for (i = 0; i < 4; i++){
const int offset = y_offset[i];
- const int z0 = 13 * (block[offset+stride*0] + block[offset+stride*4]);
- const int z1 = 13 * (block[offset+stride*0] - block[offset+stride*4]);
- const int z2 = 7 * block[offset+stride*1] - 17 * block[offset+stride*5];
- const int z3 = 17 * block[offset+stride*1] + 7 * 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;
+ const int z0 = 13*(block[offset+stride*0] + block[offset+stride*4]);
+ const int z1 = 13*(block[offset+stride*0] - block[offset+stride*4]);
+ const int z2 = 7* block[offset+stride*1] - 17*block[offset+stride*5];
+ const int z3 = 17* block[offset+stride*1] + 7*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++)
- {
+ 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];
-
- block[stride*0 +offset] = ((z0 + z3) * qmul + 0x80000) >> 20;
- block[stride*2 +offset] = ((z1 + z2) * qmul + 0x80000) >> 20;
- block[stride*8 +offset] = ((z1 - z2) * qmul + 0x80000) >> 20;
- block[stride*10+offset] = ((z0 - z3) * qmul + 0x80000) >> 20;
+ 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[stride*0 +offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
+ block[stride*2 +offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
+ block[stride*8 +offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
+ block[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)
+ int dc)
{
const int qmul = svq3_dequant_coeff[qp];
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- if(dc)
- {
- dc = 13 * 13 * ((dc == 1) ? 1538 * block[0] : ((qmul * (block[0] >> 3)) / 2));
+ if (dc) {
+ 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];
+ 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;
@@ -208,18 +187,17 @@ void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp,
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];
+ 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 rr = (dc + 0x80000);
- dst[i + stride*0] = cm[ dst[i + stride*0] + (((z0 + z3) * qmul + rr) >> 20)];
- dst[i + stride*1] = cm[ dst[i + stride*1] + (((z1 + z2) * qmul + rr) >> 20)];
- dst[i + stride*2] = cm[ dst[i + stride*2] + (((z1 - z2) * qmul + rr) >> 20)];
- dst[i + stride*3] = cm[ dst[i + stride*3] + (((z0 - z3) * qmul + rr) >> 20)];
+ dst[i + stride*0] = cm[ dst[i + stride*0] + (((z0 + z3)*qmul + rr) >> 20) ];
+ dst[i + stride*1] = cm[ dst[i + stride*1] + (((z1 + z2)*qmul + rr) >> 20) ];
+ dst[i + stride*2] = cm[ dst[i + stride*2] + (((z1 - z2)*qmul + rr) >> 20) ];
+ dst[i + stride*3] = cm[ dst[i + stride*3] + (((z0 - z3)*qmul + rr) >> 20) ];
}
}
@@ -233,62 +211,46 @@ static inline int svq3_decode_block(GetBitContext *gb, DCTELEM *block,
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++)
- {
-
- 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;
+ for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
+ for (; (vlc = svq3_get_ue_golomb(gb)) != 0; index++) {
+
+ 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;
}
- if(type != 2)
- {
+ if (type != 2) {
break;
}
}
@@ -297,66 +259,60 @@ static inline int svq3_decode_block(GetBitContext *gb, DCTELEM *block,
}
static inline void svq3_mc_dir_part(MpegEncContext *s,
-int x, int y, int width, int height,
-int mx, int my, int dxy,
-int thirdpel, int dir, int avg)
+ int x, int y, int width, int height,
+ int mx, int my, int dxy,
+ int thirdpel, int dir, int avg)
{
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 (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 ((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.data[0] + x + y * s->linesize;
- src = pic->data[0] + mx + my * s->linesize;
+ dest = s->current_picture.data[0] + x + y*s->linesize;
+ src = pic->data[0] + mx + my*s->linesize;
- if(emu)
- {
+ if (emu) {
ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
- mx, my, s->h_edge_pos, s->v_edge_pos);
+ mx, my, s->h_edge_pos, s->v_edge_pos);
src = s->edge_emu_buffer;
}
- if(thirdpel)
+ if (thirdpel)
(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);
- if(!(s->flags & CODEC_FLAG_GRAY))
- {
+ if (!(s->flags & CODEC_FLAG_GRAY)) {
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++)
- {
- dest = s->current_picture.data[i] + (x >> 1) + (y >> 1) * s->uvlinesize;
- src = pic->data[i] + mx + my * s->uvlinesize;
+ for (i = 1; i < 3; i++) {
+ dest = s->current_picture.data[i] + (x >> 1) + (y >> 1)*s->uvlinesize;
+ src = pic->data[i] + mx + my*s->uvlinesize;
- if(emu)
- {
+ if (emu) {
ff_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));
+ mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1));
src = s->edge_emu_buffer;
}
- if(thirdpel)
+ if (thirdpel)
(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);
@@ -365,96 +321,79 @@ int thirdpel, int dir, int avg)
}
static inline int svq3_mc_dir(H264Context *h, int size, int mode, int dir,
-int avg)
+ 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)
- {
- 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 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;
int dxy;
- x = 16 * s->mb_x + j;
- y = 16 * s->mb_y + i;
+ 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)
- {
+ if (mode != PREDICT_MODE) {
pred_motion(h, k, (part_width >> 2), dir, 1, &mx, &my);
- }
- else
- {
- mx = s->next_picture.motion_val[0][b_xy][0] << 1;
- my = s->next_picture.motion_val[0][b_xy][1] << 1;
+ } else {
+ mx = s->next_picture.motion_val[0][b_xy][0]<<1;
+ my = s->next_picture.motion_val[0][b_xy][1]<<1;
- if(dir == 0)
- {
+ 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;
- }
- else
- {
+ } 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;
}
}
/* 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)
- {
+ if (mode == PREDICT_MODE) {
dx = dy = 0;
- }
- else
- {
+ } else {
dy = svq3_get_se_golomb(&s->gb);
dx = svq3_get_se_golomb(&s->gb);
- if(dx == INVALID_VLC || dy == INVALID_VLC)
- {
+ if (dx == INVALID_VLC || dy == INVALID_VLC) {
av_log(h->s.avctx, AV_LOG_ERROR, "invalid MV vlc\n");
return -1;
}
}
/* compute motion vector */
- if(mode == THIRDPEL_MODE)
- {
+ 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);
+ 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);
+ } 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);
- 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;
+ } else {
+ 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);
mx *= 6;
@@ -462,31 +401,26 @@ int avg)
}
/* update mv_cache */
- if(mode != PREDICT_MODE)
- {
- int32_t mv = pack16to32(mx, my);
+ if (mode != PREDICT_MODE) {
+ int32_t mv = pack16to32(mx,my);
- if(part_height == 8 && i < 8)
- {
- *(int32_t *) h->mv_cache[dir][scan8[k] + 1 * 8] = mv;
+ if (part_height == 8 && i < 8) {
+ *(int32_t *) h->mv_cache[dir][scan8[k] + 1*8] = mv;
- if(part_width == 8 && j < 8)
- {
- *(int32_t *) h->mv_cache[dir][scan8[k] + 1 + 1 * 8] = mv;
+ if (part_width == 8 && j < 8) {
+ *(int32_t *) h->mv_cache[dir][scan8[k] + 1 + 1*8] = mv;
}
}
- if(part_width == 8 && j < 8)
- {
+ if (part_width == 8 && j < 8) {
*(int32_t *) h->mv_cache[dir][scan8[k] + 1] = mv;
}
- if(part_width == 4 || part_height == 4)
- {
+ if (part_width == 4 || part_height == 4) {
*(int32_t *) h->mv_cache[dir][scan8[k]] = mv;
}
}
/* write back motion vectors */
- fill_rectangle(s->current_picture.motion_val[dir][b_xy], part_width >> 2, part_height >> 2, h->b_stride, pack16to32(mx, my), 4);
+ fill_rectangle(s->current_picture.motion_val[dir][b_xy], part_width>>2, part_height>>2, h->b_stride, pack16to32(mx,my), 4);
}
}
@@ -501,48 +435,36 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
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;
+ 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 == FF_P_TYPE || s->next_picture.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 (mb_type == 0) { /* SKIP */
+ if (s->pict_type == FF_P_TYPE || s->next_picture.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 == FF_B_TYPE)
- {
- 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 == FF_B_TYPE) {
+ 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
- {
+ } else {
mb_type = FFMIN(s->next_picture.mb_type[mb_xy], 6);
- if(svq3_mc_dir(h, mb_type, PREDICT_MODE, 0, 0) < 0)
+ if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 0, 0) < 0)
return -1;
- if(svq3_mc_dir(h, mb_type, PREDICT_MODE, 1, 1) < 0)
+ if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 1, 1) < 0)
return -1;
mb_type = MB_TYPE_16x16;
}
- }
- else if(mb_type < 8) /* INTER */
- {
- if(h->thirdpel_flag && h->halfpel_flag == !get_bits1(&s->gb))
- {
+ } else if (mb_type < 8) { /* INTER */
+ if (h->thirdpel_flag && h->halfpel_flag == !get_bits1 (&s->gb)) {
mode = THIRDPEL_MODE;
- }
- else if(h->halfpel_flag && h->thirdpel_flag == !get_bits1(&s->gb))
- {
+ } else if (h->halfpel_flag && h->thirdpel_flag == !get_bits1 (&s->gb)) {
mode = HALFPEL_MODE;
- }
- else
- {
+ } else {
mode = FULLPEL_MODE;
}
@@ -555,124 +477,91 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
N??11111
*/
- for(m = 0; m < 2; m++)
- {
- if(s->mb_x > 0 && h->intra4x4_pred_mode[mb_xy - 1][0] != -1)
- {
- for(i = 0; i < 4; i++)
- {
- *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i * 8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride];
- }
- }
- else
- {
- for(i = 0; i < 4; i++)
- {
- *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i * 8] = 0;
- }
- }
- if(s->mb_y > 0)
- {
- memcpy(h->mv_cache[m][scan8[0] - 1 * 8], s->current_picture.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[mb_xy - s->mb_stride][4] == -1) ? PART_NOT_AVAILABLE : 1, 4);
-
- if(s->mb_x < (s->mb_width - 1))
- {
- *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1 * 8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4];
- h->ref_cache[m][scan8[0] + 4 - 1 * 8] =
- (h->intra4x4_pred_mode[mb_xy - s->mb_stride + 1][0] == -1 ||
- h->intra4x4_pred_mode[mb_xy - s->mb_stride ][4] == -1) ? PART_NOT_AVAILABLE : 1;
+ for (m = 0; m < 2; m++) {
+ if (s->mb_x > 0 && h->intra4x4_pred_mode[mb_xy - 1][0] != -1) {
+ for (i = 0; i < 4; i++) {
+ *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride];
}
- else
- h->ref_cache[m][scan8[0] + 4 - 1 * 8] = PART_NOT_AVAILABLE;
- if(s->mb_x > 0)
- {
- *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1 * 8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1];
- h->ref_cache[m][scan8[0] - 1 - 1 * 8] = (h->intra4x4_pred_mode[mb_xy - s->mb_stride - 1][3] == -1) ? PART_NOT_AVAILABLE : 1;
+ } else {
+ for (i = 0; i < 4; i++) {
+ *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0;
}
- 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 != FF_B_TYPE)
+ if (s->mb_y > 0) {
+ memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.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[mb_xy - s->mb_stride][4] == -1) ? PART_NOT_AVAILABLE : 1, 4);
+
+ if (s->mb_x < (s->mb_width - 1)) {
+ *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4];
+ h->ref_cache[m][scan8[0] + 4 - 1*8] =
+ (h->intra4x4_pred_mode[mb_xy - s->mb_stride + 1][0] == -1 ||
+ h->intra4x4_pred_mode[mb_xy - s->mb_stride ][4] == -1) ? PART_NOT_AVAILABLE : 1;
+ }else
+ h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
+ if (s->mb_x > 0) {
+ *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1];
+ h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[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 != FF_B_TYPE)
break;
}
/* decode motion vector(s) and form prediction(s) */
- if(s->pict_type == FF_P_TYPE)
- {
- if(svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0)
+ if (s->pict_type == FF_P_TYPE) {
+ if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0)
return -1;
- }
- else /* FF_B_TYPE */
- {
- if(mb_type != 2)
- {
- if(svq3_mc_dir(h, 0, mode, 0, 0) < 0)
+ } else { /* FF_B_TYPE */
+ 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.motion_val[0][b_xy + i*h->b_stride], 0, 4 * 2 * sizeof(int16_t));
+ } else {
+ for (i = 0; i < 4; i++) {
+ memset(s->current_picture.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 (mb_type != 1) {
+ 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.motion_val[1][b_xy + i*h->b_stride], 0, 4 * 2 * sizeof(int16_t));
+ } else {
+ for (i = 0; i < 4; i++) {
+ memset(s->current_picture.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));
-
- 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[mb_xy - 1][i];
+ } else if (mb_type == 8 || mb_type == 33) { /* INTRA4x4 */
+ 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[mb_xy - 1][i];
}
- if(h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1)
- {
+ if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) {
h->left_samples_available = 0x5F5F;
}
}
- if(s->mb_y > 0)
- {
+ if (s->mb_y > 0) {
h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][4];
h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][5];
h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][6];
h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[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;
}
@@ -683,35 +572,27 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
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);
+ } 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);
}
}
ff_h264_write_back_intra_pred_mode(h);
- if(mb_type == 8)
- {
+ if (mb_type == 8) {
ff_h264_check_intra4x4_pred_mode(h);
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);
+ } else {
+ 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;
@@ -719,14 +600,11 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
}
mb_type = MB_TYPE_INTRA4x4;
- }
- else /* INTRA16x16 */
- {
+ } 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)) == -1)
- {
+ if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir)) == -1){
av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
return -1;
}
@@ -735,75 +613,58 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
mb_type = MB_TYPE_INTRA16x16;
}
- if(!IS_INTER(mb_type) && s->pict_type != FF_I_TYPE)
- {
- for(i = 0; i < 4; i++)
- {
- memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4 * 2 * sizeof(int16_t));
+ if (!IS_INTER(mb_type) && s->pict_type != FF_I_TYPE) {
+ for (i = 0; i < 4; i++) {
+ memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
}
- if(s->pict_type == FF_B_TYPE)
- {
- for(i = 0; i < 4; i++)
- {
- memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4 * 2 * sizeof(int16_t));
+ if (s->pict_type == FF_B_TYPE) {
+ for (i = 0; i < 4; i++) {
+ memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
}
}
}
- if(!IS_INTRA4x4(mb_type))
- {
+ if (!IS_INTRA4x4(mb_type)) {
memset(h->intra4x4_pred_mode[mb_xy], DC_PRED, 8);
}
- if(!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE)
- {
- memset(h->non_zero_count_cache + 8, 0, 4 * 9 * sizeof(uint8_t));
+ if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) {
+ memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t));
s->dsp.clear_blocks(h->mb);
}
- if(!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE))
- {
- if((vlc = svq3_get_ue_golomb(&s->gb)) >= 48)
- {
+ if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE)) {
+ 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];
}
- if(IS_INTRA16x16(mb_type) || (s->pict_type != FF_I_TYPE && s->adaptive_quant && cbp))
- {
+ if (IS_INTRA16x16(mb_type) || (s->pict_type != FF_I_TYPE && s->adaptive_quant && cbp)) {
s->qscale += svq3_get_se_golomb(&s->gb);
- if(s->qscale > 31)
- {
+ if (s->qscale > 31){
av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
return -1;
}
}
- if(IS_INTRA16x16(mb_type))
- {
- if(svq3_decode_block(&s->gb, h->mb, 0, 0))
- {
+ if (IS_INTRA16x16(mb_type)) {
+ if (svq3_decode_block(&s->gb, h->mb, 0, 0)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
return -1;
}
}
- if(cbp)
- {
+ if (cbp) {
const int index = IS_INTRA16x16(mb_type) ? 1 : 0;
const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1);
- 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);
+ 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))
- {
+ 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;
}
@@ -811,25 +672,19 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
}
}
- if((cbp & 0x30))
- {
- for(i = 0; i < 2; ++i)
- {
- if(svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*i)], 0, 3))
- {
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
- return -1;
- }
+ if ((cbp & 0x30)) {
+ for (i = 0; i < 2; ++i) {
+ if (svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*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 = 0; i < 8; i++)
- {
+ if ((cbp & 0x20)) {
+ for (i = 0; i < 8; i++) {
h->non_zero_count_cache[ scan8[16+i] ] = 1;
- if(svq3_decode_block(&s->gb, &h->mb[16*(16 + i)], 1, 1))
- {
+ if (svq3_decode_block(&s->gb, &h->mb[16*(16 + i)], 1, 1)){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
return -1;
}
@@ -838,11 +693,10 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
}
}
- h->cbp = cbp;
+ h->cbp= cbp;
s->current_picture.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);
}
@@ -857,55 +711,45 @@ static int svq3_decode_slice_header(H264Context *h)
header = get_bits(&s->gb, 8);
- if(((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0)
- {
+ if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
/* TODO: what? */
av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
return -1;
- }
- else
- {
+ } else {
int length = (header >> 5) & 3;
- h->next_slice_index = get_bits_count(&s->gb) + 8 * show_bits(&s->gb, 8 * length) + 8 * length;
+ h->next_slice_index = get_bits_count(&s->gb) + 8*show_bits(&s->gb, 8*length) + 8*length;
- if(h->next_slice_index > s->gb.size_in_bits)
- {
+ if (h->next_slice_index > s->gb.size_in_bits) {
av_log(h->s.avctx, AV_LOG_ERROR, "slice after bitstream end\n");
return -1;
- }
+ }
- s->gb.size_in_bits = h->next_slice_index - 8 * (length - 1);
+ s->gb.size_in_bits = h->next_slice_index - 8*(length - 1);
skip_bits(&s->gb, 8);
- if(h->svq3_watermark_key)
- {
+ if (h->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 ^ h->svq3_watermark_key);
}
- if(length > 0)
- {
+ 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)
- {
+ 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);
return -1;
}
h->slice_type = golomb_to_pict_type[i];
- if((header & 0x9F) == 2)
- {
- i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1));
+ 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));
- }
- else
- {
+ } else {
skip_bits1(&s->gb);
s->mb_skip_run = 0;
}
@@ -917,31 +761,26 @@ static int svq3_decode_slice_header(H264Context *h)
/* unknown fields */
skip_bits1(&s->gb);
- if(h->unknown_svq3_flag)
- {
+ if (h->unknown_svq3_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[mb_xy - 1], -1, 4 * sizeof(int8_t));
- memset(h->intra4x4_pred_mode[mb_xy - s->mb_x], -1, 8 * sizeof(int8_t)*s->mb_x);
+ if (s->mb_x > 0) {
+ memset(h->intra4x4_pred_mode[mb_xy - 1], -1, 4*sizeof(int8_t));
+ memset(h->intra4x4_pred_mode[mb_xy - s->mb_x], -1, 8*sizeof(int8_t)*s->mb_x);
}
- if(s->mb_y > 0)
- {
- memset(h->intra4x4_pred_mode[mb_xy - s->mb_stride], -1, 8 * sizeof(int8_t)*(s->mb_width - s->mb_x));
+ if (s->mb_y > 0) {
+ memset(h->intra4x4_pred_mode[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x));
- if(s->mb_x > 0)
- {
+ if (s->mb_x > 0) {
h->intra4x4_pred_mode[mb_xy - s->mb_stride - 1][3] = -1;
}
}
@@ -957,22 +796,20 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
unsigned char *extradata;
unsigned int size;
- if(avctx->thread_count > 1)
- {
+ if(avctx->thread_count > 1){
av_log(avctx, AV_LOG_ERROR, "SVQ3 does not support multithreaded decoding, patch welcome! (check latest SVN too)\n");
return -1;
}
- if(ff_h264_decode_init(avctx) < 0)
+ if (ff_h264_decode_init(avctx) < 0)
return -1;
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
s->unrestricted_mv = 1;
- h->is_complex = 1;
+ h->is_complex=1;
- if(!s->context_initialized)
- {
+ if (!s->context_initialized) {
s->width = avctx->width;
s->height = avctx->height;
h->halfpel_flag = 1;
@@ -980,68 +817,44 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
h->unknown_svq3_flag = 0;
h->chroma_qp[0] = h->chroma_qp[1] = 4;
- if(MPV_common_init(s) < 0)
+ if (MPV_common_init(s) < 0)
return -1;
- h->b_stride = 4 * s->mb_width;
+ h->b_stride = 4*s->mb_width;
ff_h264_alloc_tables(h);
/* prowl for the "SEQH" marker in the extradata */
extradata = (unsigned char *)avctx->extradata;
- for(m = 0; m < avctx->extradata_size; m++)
- {
- if(!memcmp(extradata, "SEQH", 4))
+ for (m = 0; m < avctx->extradata_size; m++) {
+ if (!memcmp(extradata, "SEQH", 4))
break;
extradata++;
}
/* if a match was found, parse the extra data */
- if(extradata && !memcmp(extradata, "SEQH", 4))
- {
+ if (extradata && !memcmp(extradata, "SEQH", 4)) {
GetBitContext gb;
int frame_size_code;
size = AV_RB32(&extradata[4]);
- 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;
+ 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;
}
h->halfpel_flag = get_bits1(&gb);
@@ -1058,15 +871,13 @@ 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);
}
h->unknown_svq3_flag = get_bits1(&gb);
avctx->has_b_frames = !s->low_delay;
- if(h->unknown_svq3_flag)
- {
+ if (h->unknown_svq3_flag) {
#if CONFIG_ZLIB
unsigned watermark_width = svq3_get_ue_golomb(&gb);
unsigned watermark_height = svq3_get_ue_golomb(&gb);
@@ -1074,18 +885,17 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
int u2 = get_bits(&gb, 8);
int u3 = get_bits(&gb, 2);
int u4 = svq3_get_ue_golomb(&gb);
- unsigned buf_len = watermark_width * watermark_height * 4;
- int offset = (get_bits_count(&gb) + 7) >> 3;
+ unsigned 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, (uLong*)&buf_len, extradata + 8 + offset, size - offset) != Z_OK)
- {
+ if (uncompress(buf, (uLong*)&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;
@@ -1106,18 +916,16 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
}
static int svq3_decode_frame(AVCodecContext *avctx,
-void *data, int *data_size,
-const uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ const uint8_t *buf, int buf_size)
{
MpegEncContext *const s = avctx->priv_data;
H264Context *const h = avctx->priv_data;
int m, mb_type;
/* special case for last picture */
- if(buf_size == 0)
- {
- if(s->next_picture_ptr && !s->low_delay)
- {
+ if (buf_size == 0) {
+ if (s->next_picture_ptr && !s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->next_picture;
s->next_picture_ptr = NULL;
*data_size = sizeof(AVFrame);
@@ -1125,21 +933,20 @@ const uint8_t *buf, int buf_size)
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(h))
+ if (svq3_decode_slice_header(h))
return -1;
s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
- if(avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ 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_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
- s->adaptive_quant, s->qscale, h->slice_num);
+ av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
+ s->adaptive_quant, s->qscale, h->slice_num);
}
/* for hurry_up == 5 */
@@ -1147,83 +954,71 @@ const uint8_t *buf, int buf_size)
s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
/* Skip B-frames if we do not have reference frames. */
- if(s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
+ if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
return 0;
/* Skip B-frames if we are in a hurry. */
- if(avctx->hurry_up && s->pict_type == FF_B_TYPE)
+ if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
return 0;
/* Skip everything if we are in a hurry >= 5. */
- if(avctx->hurry_up >= 5)
+ if (avctx->hurry_up >= 5)
return 0;
- if((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
- || avctx->skip_frame >= AVDISCARD_ALL)
+ if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
+ ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
+ || avctx->skip_frame >= AVDISCARD_ALL)
return 0;
- if(s->next_p_frame_damaged)
- {
- if(s->pict_type == FF_B_TYPE)
+ if (s->next_p_frame_damaged) {
+ if (s->pict_type == FF_B_TYPE)
return 0;
else
s->next_p_frame_damaged = 0;
}
- if(ff_h264_frame_start(h) < 0)
+ if (ff_h264_frame_start(h) < 0)
return -1;
- if(s->pict_type == FF_B_TYPE)
- {
+ if (s->pict_type == FF_B_TYPE) {
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
- {
+ } 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);
- 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;
- if(i < 3)
- h->ref_cache[m][scan8[0] + 8 * i + j] = PART_NOT_AVAILABLE;
+ for (j = -1; j < 4; j++)
+ 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;
}
}
- 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;
+ 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))
- {
+ 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, h->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(h))
+ if (svq3_decode_slice_header(h))
return -1;
/* TODO: support s->mb_skip_run */
@@ -1231,49 +1026,39 @@ const uint8_t *buf, int buf_size)
mb_type = svq3_get_ue_golomb(&s->gb);
- if(s->pict_type == FF_I_TYPE)
- {
+ if (s->pict_type == FF_I_TYPE) {
mb_type += 8;
- }
- else if(s->pict_type == FF_B_TYPE && mb_type >= 4)
- {
+ } else if (s->pict_type == FF_B_TYPE && mb_type >= 4) {
mb_type += 4;
}
- if(mb_type > 33 || svq3_decode_mb(h, mb_type))
- {
+ if (mb_type > 33 || svq3_decode_mb(h, 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 != FF_B_TYPE && !s->low_delay)
- {
+ if (s->pict_type != FF_B_TYPE && !s->low_delay) {
s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
- (s->pict_type == FF_P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
+ (s->pict_type == FF_P_TYPE && 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);
- if(s->pict_type == FF_B_TYPE || s->low_delay)
- {
+ if (s->pict_type == FF_B_TYPE || s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->current_picture;
- }
- else
- {
+ } else {
*(AVFrame *) data = *(AVFrame *) &s->last_picture;
}
/* Do not output the last pic after seeking. */
- if(s->last_picture_ptr || s->low_delay)
- {
+ if (s->last_picture_ptr || s->low_delay) {
*data_size = sizeof(AVFrame);
}
@@ -1281,8 +1066,7 @@ const uint8_t *buf, int buf_size)
}
-AVCodec svq3_decoder =
-{
+AVCodec svq3_decoder = {
"svq3",
CODEC_TYPE_VIDEO,
CODEC_ID_SVQ3,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/tableprint.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/tableprint.h
index c1481a74a..706e29653 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/tableprint.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/tableprint.h
@@ -30,15 +30,14 @@
*
* \{
*/
-void write_int8_array(const void *, int, int);
-void write_uint32_array(const void *, int, int);
-void write_float_array(const void *, int, int);
-void write_int8_2d_array(const void *, int, int);
+void write_int8_array (const void *, int, int);
+void write_uint32_array (const void *, int, int);
+void write_float_array (const void *, int, int);
+void write_int8_2d_array (const void *, int, int);
void write_uint32_2d_array(const void *, int, int);
/** \} */ // end of printfuncs group
-struct tabledef
-{
+struct tabledef {
/** String that declares the array. Adding " = { ..." after it should
* make a valid initializer, adding "extern" before and ";" if possible
* should make a valid extern declaration. */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c
index 8cf1fb9d0..d1a9b941f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c
@@ -49,11 +49,11 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
if(min_size < *size)
return ptr;
- *size = FFMAX(17 * min_size / 16 + 32, min_size);
+ *size= FFMAX(17*min_size/16 + 32, min_size);
- ptr = av_realloc(ptr, *size);
+ ptr= av_realloc(ptr, *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
- *size = 0;
+ *size= 0;
return ptr;
}
@@ -61,12 +61,12 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)
{
void **p = ptr;
- if(min_size < *size)
+ if (min_size < *size)
return;
- *size = FFMAX(17 * min_size / 16 + 32, min_size);
+ *size= FFMAX(17*min_size/16 + 32, min_size);
av_free(*p);
*p = av_malloc(*size);
- if(!*p) *size = 0;
+ if (!*p) *size = 0;
}
/* ffdshow custom code (begin) */
@@ -75,8 +75,7 @@ static void** array_static = NULL;
void av_free_static(void)
{
- while(last_static)
- {
+ while(last_static){
av_freep(&array_static[--last_static]);
}
av_freep(&array_static);
@@ -86,8 +85,7 @@ void av_free_static(void)
/* encoder management */
static AVCodec *first_avcodec = NULL;
-AVCodec *av_codec_next(AVCodec *c)
-{
+AVCodec *av_codec_next(AVCodec *c){
if(c) return c->next;
else return first_avcodec;
}
@@ -97,38 +95,34 @@ void avcodec_register(AVCodec *codec)
AVCodec **p;
avcodec_init();
p = &first_avcodec;
- while(*p != NULL) p = &(*p)->next;
+ while (*p != NULL) p = &(*p)->next;
*p = codec;
codec->next = NULL;
}
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
-{
+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);
+ s->coded_height= height;
+ s->width = -((-width )>>s->lowres);
+ s->height= -((-height)>>s->lowres);
}
-typedef struct InternalBuffer
-{
+typedef struct InternalBuffer{
int last_pic_num;
uint8_t *base[4];
uint8_t *data[4];
int linesize[4];
int width, height;
enum PixelFormat pix_fmt;
-} InternalBuffer;
+}InternalBuffer;
#define INTERNAL_BUFFER_SIZE 32
-void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
-{
- int w_align = 1;
- int h_align = 1;
+void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
+ int w_align= 1;
+ int h_align= 1;
- switch(s->pix_fmt)
- {
+ switch(s->pix_fmt){
case PIX_FMT_YUV420P:
case PIX_FMT_YUYV422:
case PIX_FMT_UYVY422:
@@ -143,111 +137,98 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
case PIX_FMT_YUVJ440P:
case PIX_FMT_YUVJ444P:
case PIX_FMT_YUVA420P:
- w_align = 16; //FIXME check for non mpeg style codecs and use less alignment
- h_align = 16;
+ w_align= 16; //FIXME check for non mpeg style codecs and use less alignment
+ h_align= 16;
if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV)
- h_align = 32; // interlaced is rounded up to 2 MBs
+ h_align= 32; // interlaced is rounded up to 2 MBs
break;
case PIX_FMT_YUV411P:
case PIX_FMT_UYYVYY411:
- w_align = 32;
- h_align = 8;
+ w_align=32;
+ h_align=8;
break;
case PIX_FMT_YUV410P:
- if(s->codec_id == CODEC_ID_SVQ1)
- {
- w_align = 64;
- h_align = 64;
+ if(s->codec_id == 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;
+ if(s->codec_id == CODEC_ID_RPZA){
+ 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;
+ if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == 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);
+ *height= FFALIGN(*height, h_align);
if(s->codec_id == CODEC_ID_H264)
- *height += 2; // some of the optimized chroma MC reads one line too much
+ *height+=2; // some of the optimized chroma MC reads one line too much
}
-int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h)
-{
- if((int)w > 0 && (int)h > 0 && (w + 128)*(uint64_t)(h + 128) < INT_MAX / 8)
+int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
+ if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
return 0;
av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
return -1;
}
-int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic)
-{
+int avcodec_default_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;
int *picture_number;
- 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(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE)
- {
+ if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) {
av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n");
return -1;
}
- if(avcodec_check_dimensions(s, w, h))
+ if(avcodec_check_dimensions(s,w,h))
return -1;
- if(s->internal_buffer == NULL)
- {
- s->internal_buffer = av_mallocz((INTERNAL_BUFFER_SIZE + 1) * sizeof(InternalBuffer));
+ if(s->internal_buffer==NULL){
+ s->internal_buffer= av_mallocz((INTERNAL_BUFFER_SIZE+1)*sizeof(InternalBuffer));
}
#if 0
- s->internal_buffer = av_fast_realloc(
- s->internal_buffer,
- &s->internal_buffer_size,
- sizeof(InternalBuffer) * FFMAX(99, s->internal_buffer_count + 1) /*FIXME*/
- );
+ s->internal_buffer= av_fast_realloc(
+ s->internal_buffer,
+ &s->internal_buffer_size,
+ sizeof(InternalBuffer)*FFMAX(99, s->internal_buffer_count+1)/*FIXME*/
+ );
#endif
- buf = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
- picture_number = &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE]).last_pic_num; //FIXME ugly hack
+ buf= &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
+ picture_number= &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE]).last_pic_num; //FIXME ugly hack
(*picture_number)++;
- if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt))
- {
- for(i = 0; i < 4; i++)
- {
+ if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){
+ for(i=0; i<4; i++){
av_freep(&buf->base[i]);
- buf->data[i] = NULL;
+ buf->data[i]= NULL;
}
}
- if(buf->base[0])
- {
- pic->age = *picture_number - buf->last_pic_num;
- buf->last_pic_num = *picture_number;
- }
- else
- {
+ if(buf->base[0]){
+ pic->age= *picture_number - buf->last_pic_num;
+ buf->last_pic_num= *picture_number;
+ }else{
int h_chroma_shift, v_chroma_shift;
int size[4] = {0};
int tmpsize;
@@ -259,106 +240,98 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic)
avcodec_align_dimensions(s, &w, &h);
- 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
- {
+ do {
// NOTE: do not align linesizes individually, this breaks e.g. assumptions
// that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
ff_fill_linesize(&picture, 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++){
//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)
- stride_align[i] = 16;
+ stride_align[i]= 16;
else
#endif
- stride_align[i] = STRIDE_ALIGN;
+ stride_align[i] = STRIDE_ALIGN;
unaligned |= picture.linesize[i] % stride_align[i];
}
- }
- while(unaligned);
+ } while (unaligned);
tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h);
- if(tmpsize < 0)
+ if (tmpsize < 0)
return -1;
- for(i = 0; i < 3 && picture.data[i+1]; 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]);
- buf->last_pic_num = -256 * 256 * 256 * 64;
+ buf->last_pic_num= -256*256*256*64;
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 EDEG 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) + (EDGE_WIDTH >> h_shift), stride_align[i]);
+ buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]);
}
if(size[1] && !size[2])
ff_set_systematic_pal((uint32_t*)buf->data[1], s->pix_fmt);
buf->width = s->width;
buf->height = s->height;
- buf->pix_fmt = s->pix_fmt;
- pic->age = 256 * 256 * 256 * 64;
+ buf->pix_fmt= s->pix_fmt;
+ pic->age= 256*256*256*64;
}
- pic->type = FF_BUFFER_TYPE_INTERNAL;
+ pic->type= FF_BUFFER_TYPE_INTERNAL;
- for(i = 0; i < 4; i++)
- {
- pic->base[i] = buf->base[i];
- pic->data[i] = buf->data[i];
- pic->linesize[i] = buf->linesize[i];
+ for(i=0; i<4; i++){
+ pic->base[i]= buf->base[i];
+ pic->data[i]= buf->data[i];
+ pic->linesize[i]= buf->linesize[i];
}
s->internal_buffer_count++;
- pic->reordered_opaque = s->reordered_opaque;
- pic->reordered_opaque2 = s->reordered_opaque2; /* ffdshow custom code */
- pic->reordered_opaque3 = s->reordered_opaque3; /* ffdshow custom code */
+ pic->reordered_opaque= s->reordered_opaque;
+ pic->reordered_opaque2= s->reordered_opaque2; /* ffdshow custom code */
+ pic->reordered_opaque3= s->reordered_opaque3; /* ffdshow custom code */
- 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, s->internal_buffer_count);
return 0;
}
-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
-{
+void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
int i;
InternalBuffer *buf, *last;
- assert(pic->type == FF_BUFFER_TYPE_INTERNAL);
+ assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
assert(s->internal_buffer_count);
buf = NULL; /* avoids warning */
- for(i = 0; i < s->internal_buffer_count; i++) //just 3-5 checks so is not worth to optimize
- {
- buf = &((InternalBuffer*)s->internal_buffer)[i];
+ for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize
+ buf= &((InternalBuffer*)s->internal_buffer)[i];
if(buf->data[0] == pic->data[0])
break;
}
@@ -368,34 +341,30 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
FFSWAP(InternalBuffer, *buf, *last);
- for(i = 0; i < 4; i++)
- {
- pic->data[i] = NULL;
+ for(i=0; i<4; 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, s->internal_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;
/* 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);
}
/* If internal buffer type return the same buffer */
- if(pic->type == FF_BUFFER_TYPE_INTERNAL)
- {
- pic->reordered_opaque = s->reordered_opaque;
+ if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
+ pic->reordered_opaque= s->reordered_opaque;
return 0;
}
@@ -407,59 +376,52 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic)
pic->data[i] = pic->base[i] = NULL;
pic->opaque = NULL;
/* Allocate new frame */
- if(s->get_buffer(s, pic))
+ if (s->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);
+ 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)
-{
+enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt){
return fmt[0];
}
-void avcodec_get_frame_defaults(AVFrame *pic)
-{
+void avcodec_get_frame_defaults(AVFrame *pic){
memset(pic, 0, sizeof(AVFrame));
- pic->pts = AV_NOPTS_VALUE;
- pic->key_frame = 1;
+ pic->pts= AV_NOPTS_VALUE;
+ pic->key_frame= 1;
pic->YCbCr_RGB_matrix_coefficients = YCbCr_RGB_coeff_Unspecified; // ffdshow custom code
pic->video_full_range_flag = VIDEO_FULL_RANGE_INVALID; // ffdshow custom code
}
-AVFrame *avcodec_alloc_frame(void)
-{
- AVFrame *pic = av_malloc(sizeof(AVFrame));
+AVFrame *avcodec_alloc_frame(void){
+ AVFrame *pic= av_malloc(sizeof(AVFrame));
- if(pic == NULL) return NULL;
+ if(pic==NULL) return NULL;
avcodec_get_frame_defaults(pic);
@@ -468,12 +430,11 @@ AVFrame *avcodec_alloc_frame(void)
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
{
- int ret = -1;
+ int ret= -1;
/* If there is a user-supplied mutex locking routine, call it. */
- if(ff_lockmgr_cb)
- {
- if((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
+ if (ff_lockmgr_cb) {
+ if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
return -1;
}
@@ -487,17 +448,13 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
if(avctx->codec || !codec)
goto end;
- if(codec->priv_data_size > 0)
- {
+ if (codec->priv_data_size > 0) {
avctx->priv_data = av_mallocz(codec->priv_data_size);
- if(!avctx->priv_data)
- {
+ if (!avctx->priv_data) {
ret = AVERROR(ENOMEM);
goto end;
}
- }
- else
- {
+ } else {
avctx->priv_data = NULL;
}
@@ -507,10 +464,9 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
avcodec_set_dimensions(avctx, avctx->width, avctx->height);
#define SANE_NB_CHANNELS 128U
- if(((avctx->coded_width || avctx->coded_height)
+ if (((avctx->coded_width || avctx->coded_height)
&& avcodec_check_dimensions(avctx, avctx->coded_width, avctx->coded_height))
- || avctx->channels > SANE_NB_CHANNELS)
- {
+ || avctx->channels > SANE_NB_CHANNELS) {
ret = AVERROR(EINVAL);
goto free_and_end;
}
@@ -518,124 +474,108 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
avctx->codec = codec;
avctx->codec_id = codec->id; /* ffdshow custom code */
avctx->frame_number = 0;
- if(avctx->codec->init)
- {
+ if(avctx->codec->init){
ret = avctx->codec->init(avctx);
- if(ret < 0)
- {
+ if (ret < 0) {
goto free_and_end;
}
}
- ret = 0;
+ ret=0;
end:
//entangled_thread_counter--; /* ffdshow custom comment out */
/* Release any user-supplied mutex. */
- if(ff_lockmgr_cb)
- {
+ if (ff_lockmgr_cb) {
(*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
}
return ret;
free_and_end:
av_freep(&avctx->priv_data);
- avctx->codec = NULL;
+ avctx->codec= NULL;
goto end;
}
int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
- const short *samples)
+ const short *samples)
{
- if(buf_size < FF_MIN_BUFFER_SIZE && 0)
- {
+ if(buf_size < FF_MIN_BUFFER_SIZE && 0){
av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
return -1;
}
- if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples)
- {
+ if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples){
int ret = avctx->codec->encode(avctx, buf, buf_size, samples);
avctx->frame_number++;
return ret;
- }
- else
+ }else
return 0;
}
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)
- {
+ if(buf_size < FF_MIN_BUFFER_SIZE){
av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
return -1;
}
- if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
+ if(avcodec_check_dimensions(avctx,avctx->width,avctx->height))
return -1;
- if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict)
- {
+ 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
+ }else
return 0;
}
int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
- int *got_picture_ptr,
- const uint8_t *buf, int buf_size)
+ int *got_picture_ptr,
+ const uint8_t *buf, int buf_size)
{
int ret;
- *got_picture_ptr = 0;
- if((avctx->coded_width || avctx->coded_height) && avcodec_check_dimensions(avctx, avctx->coded_width, avctx->coded_height))
+ *got_picture_ptr= 0;
+ if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height))
return -1;
- if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size)
- {
+ if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
- buf, buf_size);
+ buf, buf_size);
emms_c(); //needed to avoid an emms_c() call before every return;
- if(*got_picture_ptr)
+ if (*got_picture_ptr)
avctx->frame_number++;
- }
- else
- ret = 0;
+ }else
+ ret= 0;
return ret;
}
int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
- int *frame_size_ptr,
- const uint8_t *buf, int buf_size)
+ int *frame_size_ptr,
+ const uint8_t *buf, int buf_size)
{
int ret;
- if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size)
- {
+ if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
//FIXME remove the check below _after_ ensuring that all audio check that the available space is enough
- if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE)
- {
+ if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");
return -1;
}
if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||
- *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t))
- {
+ *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t)){
av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);
return -1;
}
ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
- buf, buf_size);
+ buf, buf_size);
avctx->frame_number++;
- }
- else
- {
- ret = 0;
- *frame_size_ptr = 0;
+ }else{
+ ret= 0;
+ *frame_size_ptr=0;
}
return ret;
}
@@ -643,9 +583,8 @@ int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *sa
int avcodec_close(AVCodecContext *avctx)
{
/* If there is a user-supplied mutex locking routine, call it. */
- if(ff_lockmgr_cb)
- {
- if((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
+ if (ff_lockmgr_cb) {
+ if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
return -1;
}
@@ -659,7 +598,7 @@ int avcodec_close(AVCodecContext *avctx)
//if (HAVE_THREADS && avctx->thread_opaque)
// avcodec_thread_free(avctx);
- if(avctx->codec->close)
+ if (avctx->codec->close)
avctx->codec->close(avctx);
avcodec_default_free_buffers(avctx);
av_freep(&avctx->priv_data);
@@ -667,8 +606,7 @@ int avcodec_close(AVCodecContext *avctx)
//entangled_thread_counter--; /* ffdshow custom comment out */
/* Release any user-supplied mutex. */
- if(ff_lockmgr_cb)
- {
+ if (ff_lockmgr_cb) {
(*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
}
return 0;
@@ -678,9 +616,8 @@ AVCodec *avcodec_find_encoder(enum CodecID id)
{
AVCodec *p;
p = first_avcodec;
- while(p)
- {
- if(p->encode != NULL && p->id == id)
+ while (p) {
+ if (p->encode != NULL && p->id == id)
return p;
p = p->next;
}
@@ -690,12 +627,11 @@ AVCodec *avcodec_find_encoder(enum CodecID id)
AVCodec *avcodec_find_encoder_by_name(const char *name)
{
AVCodec *p;
- if(!name)
+ if (!name)
return NULL;
p = first_avcodec;
- while(p)
- {
- if(p->encode != NULL && strcmp(name, p->name) == 0)
+ while (p) {
+ if (p->encode != NULL && strcmp(name,p->name) == 0)
return p;
p = p->next;
}
@@ -706,9 +642,8 @@ AVCodec *avcodec_find_decoder(enum CodecID id)
{
AVCodec *p;
p = first_avcodec;
- while(p)
- {
- if(p->decode != NULL && p->id == id)
+ while (p) {
+ if (p->decode != NULL && p->id == id)
return p;
p = p->next;
}
@@ -718,35 +653,34 @@ AVCodec *avcodec_find_decoder(enum CodecID id)
AVCodec *avcodec_find_decoder_by_name(const char *name)
{
AVCodec *p;
- if(!name)
+ if (!name)
return NULL;
p = first_avcodec;
- while(p)
- {
- if(p->decode != NULL && strcmp(name, p->name) == 0)
+ while (p) {
+ if (p->decode != NULL && strcmp(name,p->name) == 0)
return p;
p = p->next;
}
return NULL;
}
-unsigned avcodec_version(void)
+unsigned avcodec_version( void )
{
- return LIBAVCODEC_VERSION_INT;
+ return LIBAVCODEC_VERSION_INT;
}
void avcodec_init(void)
{
static int initialized = 0;
- if(initialized != 0)
+ if (initialized != 0)
return;
initialized = 1;
#if __STDC_VERSION__ < 199901L
{
- extern void avpicture_init_pixfmtinfo(void);
- avpicture_init_pixfmtinfo();
- }
+ extern void avpicture_init_pixfmtinfo(void);
+ avpicture_init_pixfmtinfo();
+ }
#endif
dsputil_static_init();
@@ -758,55 +692,40 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
avctx->codec->flush(avctx);
}
-void avcodec_default_free_buffers(AVCodecContext *s)
-{
+void avcodec_default_free_buffers(AVCodecContext *s){
int i, j;
- if(s->internal_buffer == NULL) return;
+ if(s->internal_buffer==NULL) return;
- if(s->internal_buffer_count)
+ if (s->internal_buffer_count)
av_log(s, AV_LOG_WARNING, "Found %i unreleased buffers!\n", s->internal_buffer_count);
- for(i = 0; i < INTERNAL_BUFFER_SIZE; i++)
- {
- InternalBuffer *buf = &((InternalBuffer*)s->internal_buffer)[i];
- for(j = 0; j < 4; j++)
- {
+ for(i=0; i<INTERNAL_BUFFER_SIZE; i++){
+ InternalBuffer *buf= &((InternalBuffer*)s->internal_buffer)[i];
+ for(j=0; j<4; j++){
av_freep(&buf->base[j]);
- buf->data[j] = NULL;
+ buf->data[j]= NULL;
}
}
av_freep(&s->internal_buffer);
- s->internal_buffer_count = 0;
+ s->internal_buffer_count=0;
}
-char av_get_pict_type_char(int pict_type)
-{
- switch(pict_type)
- {
- case FF_I_TYPE:
- return 'I';
- case FF_P_TYPE:
- return 'P';
- case FF_B_TYPE:
- return 'B';
- case FF_S_TYPE:
- return 'S';
- case FF_SI_TYPE:
- return 'i';
- case FF_SP_TYPE:
- return 'p';
- case FF_BI_TYPE:
- return 'b';
- default:
- return '?';
+char av_get_pict_type_char(int pict_type){
+ switch(pict_type){
+ case FF_I_TYPE: return 'I';
+ case FF_P_TYPE: return 'P';
+ case FF_B_TYPE: return 'B';
+ case FF_S_TYPE: return 'S';
+ case FF_SI_TYPE:return 'i';
+ case FF_SP_TYPE:return 'p';
+ case FF_BI_TYPE:return 'b';
+ default: return '?';
}
}
-int av_get_bits_per_sample(enum CodecID codec_id)
-{
- switch(codec_id)
- {
+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:
@@ -825,10 +744,8 @@ int av_get_bits_per_sample(enum CodecID codec_id)
}
}
-int av_get_bits_per_sample_format(enum SampleFormat sample_fmt)
-{
- switch(sample_fmt)
- {
+int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
+ switch (sample_fmt) {
case SAMPLE_FMT_U8:
return 8;
case SAMPLE_FMT_S16:
@@ -844,8 +761,7 @@ int av_get_bits_per_sample_format(enum SampleFormat sample_fmt)
}
#if !HAVE_THREADS
-int avcodec_thread_init(AVCodecContext *s, int thread_count)
-{
+int avcodec_thread_init(AVCodecContext *s, int thread_count){
s->thread_count = thread_count;
return -1;
}
@@ -855,8 +771,7 @@ 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++;
@@ -866,19 +781,18 @@ 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 FFmpeg "
- "version to the newest one from SVN. If the problem still "
- "occurs, it means that your file has a feature which has not "
- "been implemented.", feature);
+ "version to the newest one from SVN. If the problem still "
+ "occurs, it means that your file has a feature which has not "
+ "been implemented.", feature);
if(want_sample)
av_log_ask_for_sample(avc, NULL);
else
@@ -887,26 +801,24 @@ void av_log_missing_feature(void *avc, const char *feature, int want_sample)
void av_log_ask_for_sample(void *avc, const char *msg)
{
- if(msg)
+ if (msg)
av_log(avc, AV_LOG_WARNING, "%s ", msg);
av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
- "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
- "and contact the ffmpeg-devel mailing list.\n");
+ "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
+ "and contact the ffmpeg-devel mailing list.\n");
}
int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
{
- if(ff_lockmgr_cb)
- {
- if(ff_lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY))
+ if (ff_lockmgr_cb) {
+ if (ff_lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY))
return -1;
}
ff_lockmgr_cb = cb;
- if(ff_lockmgr_cb)
- {
- if(ff_lockmgr_cb(&codec_mutex, AV_LOCK_CREATE))
+ if (ff_lockmgr_cb) {
+ if (ff_lockmgr_cb(&codec_mutex, AV_LOCK_CREATE))
return -1;
}
return 0;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.c
index 7437b4092..ea15b4018 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.c
@@ -49,8 +49,7 @@
* Imode types
* @{
*/
-enum Imode
-{
+enum Imode {
IMODE_RAW,
IMODE_NORM2,
IMODE_DIFF2,
@@ -67,16 +66,14 @@ enum Imode
* @param[in] height Height of this buffer
* @param[in] stride of this buffer
*/
-static void decode_rowskip(uint8_t* plane, int width, int height, int stride, GetBitContext *gb)
-{
+static void decode_rowskip(uint8_t* plane, int width, int height, int stride, GetBitContext *gb){
int x, y;
- for(y = 0; y < height; y++)
- {
- if(!get_bits1(gb)) //rowskip
+ for (y=0; y<height; y++){
+ if (!get_bits1(gb)) //rowskip
memset(plane, 0, width);
else
- for(x = 0; x < width; x++)
+ for (x=0; x<width; x++)
plane[x] = get_bits1(gb);
plane += stride;
}
@@ -89,17 +86,15 @@ static void decode_rowskip(uint8_t* plane, int width, int height, int stride, Ge
* @param[in] stride of this buffer
* @todo FIXME: Optimize
*/
-static void decode_colskip(uint8_t* plane, int width, int height, int stride, GetBitContext *gb)
-{
+static void decode_colskip(uint8_t* plane, int width, int height, int stride, GetBitContext *gb){
int x, y;
- for(x = 0; x < width; x++)
- {
- if(!get_bits1(gb)) //colskip
- for(y = 0; y < height; y++)
+ for (x=0; x<width; x++){
+ if (!get_bits1(gb)) //colskip
+ for (y=0; y<height; y++)
plane[y*stride] = 0;
else
- for(y = 0; y < height; y++)
+ for (y=0; y<height; y++)
plane[y*stride] = get_bits1(gb);
plane ++;
}
@@ -127,7 +122,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
imode = get_vlc2(gb, ff_vc1_imode_vlc.table, VC1_IMODE_VLC_BITS, 1);
*raw_flag = 0;
- switch(imode)
+ switch (imode)
{
case IMODE_RAW:
//Data is actually read in the MB layer (same for all tests == "raw")
@@ -135,27 +130,24 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
return invert;
case IMODE_DIFF2:
case IMODE_NORM2:
- if((height * width) & 1)
+ if ((height * width) & 1)
{
*planep++ = get_bits1(gb);
offset = 1;
}
else offset = 0;
// decode bitplane as one long line
- for(y = offset; y < height * width; y += 2)
- {
+ for (y = offset; y < height * width; y += 2) {
code = get_vlc2(gb, ff_vc1_norm2_vlc.table, VC1_NORM2_VLC_BITS, 1);
*planep++ = code & 1;
offset++;
- if(offset == width)
- {
+ if(offset == width) {
offset = 0;
planep += stride - width;
}
*planep++ = code >> 1;
offset++;
- if(offset == width)
- {
+ if(offset == width) {
offset = 0;
planep += stride - width;
}
@@ -163,15 +155,11 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
break;
case IMODE_DIFF6:
case IMODE_NORM6:
- if(!(height % 3) && (width % 3)) // use 2x3 decoding
- {
- for(y = 0; y < height; y += 3)
- {
- for(x = width & 1; x < width; x += 2)
- {
+ if(!(height % 3) && (width % 3)) { // use 2x3 decoding
+ for(y = 0; y < height; y+= 3) {
+ for(x = width & 1; x < width; x += 2) {
code = get_vlc2(gb, ff_vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
- if(code < 0)
- {
+ if(code < 0){
av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
return -1;
}
@@ -185,17 +173,12 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
planep += stride * 3;
}
if(width & 1) decode_colskip(data, 1, height, stride, &v->s.gb);
- }
- else // 3x2
- {
+ } else { // 3x2
planep += (height & 1) * stride;
- for(y = height & 1; y < height; y += 2)
- {
- for(x = width % 3; x < width; x += 3)
- {
+ for(y = height & 1; y < height; y += 2) {
+ for(x = width % 3; x < width; x += 3) {
code = get_vlc2(gb, ff_vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
- if(code < 0)
- {
+ if(code < 0){
av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
return -1;
}
@@ -210,7 +193,7 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
}
x = width % 3;
if(x) decode_colskip(data , x, height , stride, &v->s.gb);
- if(height & 1) decode_rowskip(data + x, width - x, 1, stride, &v->s.gb);
+ if(height & 1) decode_rowskip(data+x, width - x, 1, stride, &v->s.gb);
}
break;
case IMODE_ROWSKIP:
@@ -219,34 +202,33 @@ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
case IMODE_COLSKIP:
decode_colskip(data, width, height, stride, &v->s.gb);
break;
- default:
- break;
+ default: break;
}
/* Applying diff operator */
- if(imode == IMODE_DIFF2 || imode == IMODE_DIFF6)
+ if (imode == IMODE_DIFF2 || imode == IMODE_DIFF6)
{
planep = data;
planep[0] ^= invert;
- for(x = 1; x < width; x++)
+ for (x=1; x<width; x++)
planep[x] ^= planep[x-1];
- for(y = 1; y < height; y++)
+ for (y=1; y<height; y++)
{
planep += stride;
planep[0] ^= planep[-stride];
- for(x = 1; x < width; x++)
+ for (x=1; x<width; x++)
{
- if(planep[x-1] != planep[x-stride]) planep[x] ^= invert;
+ if (planep[x-1] != planep[x-stride]) planep[x] ^= invert;
else planep[x] ^= planep[x-1];
}
}
}
- else if(invert)
+ else if (invert)
{
planep = data;
- for(x = 0; x < stride * height; x++) planep[x] = !planep[x]; //FIXME stride
+ for (x=0; x<stride*height; x++) planep[x] = !planep[x]; //FIXME stride
}
- return (imode << 1) + invert;
+ return (imode<<1) + invert;
}
/** @} */ //Bitplane group
@@ -261,19 +243,19 @@ static int vop_dquant_decoding(VC1Context *v)
int pqdiff;
//variable size
- if(v->dquant == 2)
+ if (v->dquant == 2)
{
pqdiff = get_bits(gb, 3);
- if(pqdiff == 7) v->altpq = get_bits(gb, 5);
+ if (pqdiff == 7) v->altpq = get_bits(gb, 5);
else v->altpq = v->pq + pqdiff + 1;
}
else
{
v->dquantfrm = get_bits1(gb);
- if(v->dquantfrm)
+ if ( v->dquantfrm )
{
v->dqprofile = get_bits(gb, 2);
- switch(v->dqprofile)
+ switch (v->dqprofile)
{
case DQPROFILE_SINGLE_EDGE:
case DQPROFILE_DOUBLE_EDGES:
@@ -283,13 +265,12 @@ static int vop_dquant_decoding(VC1Context *v)
v->dqbilevel = get_bits1(gb);
if(!v->dqbilevel)
v->halfpq = 0;
- default:
- break; //Forbidden ?
+ default: break; //Forbidden ?
}
- if(v->dqbilevel || v->dqprofile != DQPROFILE_ALL_MBS)
+ if (v->dqbilevel || v->dqprofile != DQPROFILE_ALL_MBS)
{
pqdiff = get_bits(gb, 3);
- if(pqdiff == 7) v->altpq = get_bits(gb, 5);
+ if (pqdiff == 7) v->altpq = get_bits(gb, 5);
else v->altpq = v->pq + pqdiff + 1;
}
}
@@ -310,12 +291,12 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
{
av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32));
v->profile = get_bits(gb, 2);
- if(v->profile == PROFILE_COMPLEX)
+ if (v->profile == PROFILE_COMPLEX)
{
av_log(avctx, AV_LOG_ERROR, "WMV3 Complex Profile is not fully supported\n");
}
- if(v->profile == PROFILE_ADVANCED)
+ if (v->profile == PROFILE_ADVANCED)
{
v->zz_8x4 = ff_vc1_adv_progressive_8x4_zz;
v->zz_4x8 = ff_vc1_adv_progressive_4x8_zz;
@@ -326,7 +307,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->zz_8x4 = wmv2_scantableA;
v->zz_4x8 = wmv2_scantableB;
v->res_sm = get_bits(gb, 2); //reserved
- if(v->res_sm)
+ if (v->res_sm)
{
av_log(avctx, AV_LOG_ERROR,
"Reserved RES_SM=%i is forbidden\n", v->res_sm);
@@ -350,7 +331,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->res_x8 = get_bits1(gb); //reserved
v->multires = get_bits1(gb);
v->res_fasttx = get_bits1(gb);
- if(!v->res_fasttx)
+ if (!v->res_fasttx)
{
v->s.dsp.vc1_inv_trans_8x8 = ff_simple_idct;
v->s.dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
@@ -363,14 +344,14 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
}
v->fastuvmc = get_bits1(gb); //common
- if(!v->profile && !v->fastuvmc)
+ if (!v->profile && !v->fastuvmc)
{
av_log(avctx, AV_LOG_ERROR,
"FASTUVMC unavailable in Simple Profile\n");
return -1;
}
v->extended_mv = get_bits1(gb); //common
- if(!v->profile && v->extended_mv)
+ if (!v->profile && v->extended_mv)
{
av_log(avctx, AV_LOG_ERROR,
"Extended MVs unavailable in Simple Profile\n");
@@ -380,7 +361,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->vstransform = get_bits1(gb); //common
v->res_transtab = get_bits1(gb);
- if(v->res_transtab)
+ if (v->res_transtab)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_TRANSTAB is forbidden\n");
@@ -391,7 +372,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->s.resync_marker = get_bits1(gb);
v->rangered = get_bits1(gb);
- if(v->rangered && v->profile == PROFILE_SIMPLE)
+ if (v->rangered && v->profile == PROFILE_SIMPLE)
{
av_log(avctx, AV_LOG_INFO,
"RANGERED should be set to 0 in Simple Profile\n");
@@ -402,7 +383,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->finterpflag = get_bits1(gb); //common
v->res_rtm_flag = get_bits1(gb); //reserved
- if(!v->res_rtm_flag)
+ if (!v->res_rtm_flag)
{
// av_log(avctx, AV_LOG_ERROR,
// "0 for reserved RES_RTM_FLAG is forbidden\n");
@@ -413,15 +394,15 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
//TODO: figure out what they mean (always 0x402F)
if(!v->res_fasttx) skip_bits(gb, 16);
av_log(avctx, AV_LOG_DEBUG,
- "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
- "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n"
- "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
- "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
- v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
- v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv,
- v->rangered, v->vstransform, v->overlap, v->s.resync_marker,
- v->dquant, v->quantizer_mode, avctx->max_b_frames
- );
+ "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
+ "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n"
+ "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
+ "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
+ v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
+ v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv,
+ v->rangered, v->vstransform, v->overlap, v->s.resync_marker,
+ v->dquant, v->quantizer_mode, avctx->max_b_frames
+ );
return 0;
}
@@ -431,10 +412,10 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
v->level = get_bits(gb, 3);
if(v->level >= 5)
{
- av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n", v->level);
+ av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level);
}
v->chromaformat = get_bits(gb, 2);
- if(v->chromaformat != 1)
+ if (v->chromaformat != 1)
{
av_log(v->s.avctx, AV_LOG_ERROR,
"Only 4:2:0 chroma format supported\n");
@@ -461,23 +442,21 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
v->s.v_edge_pos = v->s.avctx->coded_height;
av_log(v->s.avctx, AV_LOG_DEBUG,
- "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
- "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
- "TFCTRflag=%i, FINTERPflag=%i\n",
- v->level, v->frmrtq_postproc, v->bitrtq_postproc,
- v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace,
- v->tfcntrflag, v->finterpflag
- );
+ "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
+ "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
+ "TFCTRflag=%i, FINTERPflag=%i\n",
+ v->level, v->frmrtq_postproc, v->bitrtq_postproc,
+ v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace,
+ v->tfcntrflag, v->finterpflag
+ );
v->psf = get_bits1(gb);
- if(v->psf) //PsF, 6.1.13
- {
+ if(v->psf) { //PsF, 6.1.13
av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
return -1;
}
v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
- if(get_bits1(gb)) //Display Info - decoding is not affected by it
- {
+ if(get_bits1(gb)) { //Display Info - decoding is not affected by it
int w, h, ar = 0;
av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
v->s.avctx->width = w = get_bits(gb, 14) + 1;
@@ -485,41 +464,31 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h);
if(get_bits1(gb))
ar = get_bits(gb, 4);
- if(ar && ar < 14)
- {
+ if(ar && ar < 14){
v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar];
- }
- else if(ar == 15)
- {
+ }else if(ar == 15){
w = get_bits(gb, 8);
h = get_bits(gb, 8);
- v->s.avctx->sample_aspect_ratio.num = w;
- v->s.avctx->sample_aspect_ratio.den = h;
+ v->s.avctx->sample_aspect_ratio.num = w; v->s.avctx->sample_aspect_ratio.den = h;
}
av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n", v->s.avctx->sample_aspect_ratio.num, v->s.avctx->sample_aspect_ratio.den);
- if(get_bits1(gb)) //framerate stuff
- {
- if(get_bits1(gb))
- {
+ if(get_bits1(gb)){ //framerate stuff
+ if(get_bits1(gb)) {
v->s.avctx->time_base.num = 32;
v->s.avctx->time_base.den = get_bits(gb, 16) + 1;
- }
- else
- {
+ } else {
int nr, dr;
nr = get_bits(gb, 8);
dr = get_bits(gb, 4);
- if(nr && nr < 8 && dr && dr < 3)
- {
+ if(nr && nr < 8 && dr && dr < 3){
v->s.avctx->time_base.num = ff_vc1_fps_dr[dr - 1];
v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000;
}
}
}
- if(get_bits1(gb))
- {
+ if(get_bits1(gb)){
v->color_prim = get_bits(gb, 8);
v->transfer_char = get_bits(gb, 8);
v->matrix_coef = get_bits(gb, 8);
@@ -527,14 +496,12 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
}
v->hrd_param_flag = get_bits1(gb);
- if(v->hrd_param_flag)
- {
+ if(v->hrd_param_flag) {
int i;
v->hrd_num_leaky_buckets = get_bits(gb, 5);
skip_bits(gb, 4); //bitrate exponent
skip_bits(gb, 4); //buffer size exponent
- for(i = 0; i < v->hrd_num_leaky_buckets; i++)
- {
+ for(i = 0; i < v->hrd_num_leaky_buckets; i++) {
skip_bits(gb, 16); //hrd_rate[n]
skip_bits(gb, 16); //hrd_buffer[n]
}
@@ -559,38 +526,33 @@ int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *
v->overlap = get_bits1(gb);
v->quantizer_mode = get_bits(gb, 2);
- if(v->hrd_param_flag)
- {
- for(i = 0; i < v->hrd_num_leaky_buckets; i++)
- {
+ if(v->hrd_param_flag){
+ for(i = 0; i < v->hrd_num_leaky_buckets; i++) {
skip_bits(gb, 8); //hrd_full[n]
}
}
- if(get_bits1(gb))
- {
- avctx->coded_width = (get_bits(gb, 12) + 1) << 1;
- avctx->coded_height = (get_bits(gb, 12) + 1) << 1;
+ if(get_bits1(gb)){
+ avctx->coded_width = (get_bits(gb, 12)+1)<<1;
+ avctx->coded_height = (get_bits(gb, 12)+1)<<1;
}
if(v->extended_mv)
v->extended_dmv = get_bits1(gb);
- if((v->range_mapy_flag = get_bits1(gb)))
- {
+ if((v->range_mapy_flag = get_bits1(gb))) {
av_log(avctx, AV_LOG_ERROR, "Luma scaling is not supported, expect wrong picture\n");
v->range_mapy = get_bits(gb, 3);
}
- if((v->range_mapuv_flag = get_bits1(gb)))
- {
+ if((v->range_mapuv_flag = get_bits1(gb))) {
av_log(avctx, AV_LOG_ERROR, "Chroma scaling is not supported, expect wrong picture\n");
v->range_mapuv = get_bits(gb, 3);
}
av_log(avctx, AV_LOG_DEBUG, "Entry point info:\n"
- "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
- "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
- "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
- v->broken_link, v->closed_entry, v->panscanflag, v->refdist_flag, v->s.loop_filter,
- v->fastuvmc, v->extended_mv, v->dquant, v->vstransform, v->overlap, v->quantizer_mode);
+ "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
+ "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
+ "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
+ v->broken_link, v->closed_entry, v->panscanflag, v->refdist_flag, v->s.loop_filter,
+ v->fastuvmc, v->extended_mv, v->dquant, v->vstransform, v->overlap, v->quantizer_mode);
return 0;
}
@@ -602,26 +564,20 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
if(v->finterpflag) v->interpfrm = get_bits1(gb);
skip_bits(gb, 2); //framecnt unused
v->rangeredfrm = 0;
- if(v->rangered) v->rangeredfrm = get_bits1(gb);
+ if (v->rangered) v->rangeredfrm = get_bits1(gb);
v->s.pict_type = get_bits1(gb);
- if(v->s.avctx->max_b_frames)
- {
- if(!v->s.pict_type)
- {
- if(get_bits1(gb)) v->s.pict_type = FF_I_TYPE;
+ if (v->s.avctx->max_b_frames) {
+ if (!v->s.pict_type) {
+ if (get_bits1(gb)) v->s.pict_type = FF_I_TYPE;
else v->s.pict_type = FF_B_TYPE;
- }
- else v->s.pict_type = FF_P_TYPE;
- }
- else v->s.pict_type = v->s.pict_type ? FF_P_TYPE : FF_I_TYPE;
+ } else v->s.pict_type = FF_P_TYPE;
+ } else v->s.pict_type = v->s.pict_type ? FF_P_TYPE : FF_I_TYPE;
v->bi_type = 0;
- if(v->s.pict_type == FF_B_TYPE)
- {
+ if(v->s.pict_type == FF_B_TYPE) {
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)
- {
+ if(v->bfraction == 0) {
v->s.pict_type = FF_BI_TYPE;
}
}
@@ -640,49 +596,46 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
/* Quantizer stuff */
pqindex = get_bits(gb, 5);
if(!pqindex) return -1;
- if(v->quantizer_mode == QUANT_FRAME_IMPLICIT)
+ if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
v->pq = ff_vc1_pquant_table[0][pqindex];
else
v->pq = ff_vc1_pquant_table[1][pqindex];
v->pquantizer = 1;
- if(v->quantizer_mode == QUANT_FRAME_IMPLICIT)
+ if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
v->pquantizer = pqindex < 9;
- if(v->quantizer_mode == QUANT_NON_UNIFORM)
+ if (v->quantizer_mode == QUANT_NON_UNIFORM)
v->pquantizer = 0;
v->pqindex = pqindex;
- if(pqindex < 9) v->halfpq = get_bits1(gb);
+ if (pqindex < 9) v->halfpq = get_bits1(gb);
else v->halfpq = 0;
- if(v->quantizer_mode == QUANT_FRAME_EXPLICIT)
+ if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)
v->pquantizer = get_bits1(gb);
v->dquantfrm = 0;
- if(v->extended_mv == 1) v->mvrange = get_unary(gb, 0, 3);
+ if (v->extended_mv == 1) v->mvrange = get_unary(gb, 0, 3);
v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
v->range_x = 1 << (v->k_x - 1);
v->range_y = 1 << (v->k_y - 1);
- if(v->multires && v->s.pict_type != FF_B_TYPE) v->respic = get_bits(gb, 2);
+ if (v->multires && v->s.pict_type != FF_B_TYPE) v->respic = get_bits(gb, 2);
- if(v->res_x8 && (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE))
- {
+ if(v->res_x8 && (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)){
v->x8_type = get_bits1(gb);
- }
- else v->x8_type = 0;
+ }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 == FF_P_TYPE) ? 'P' : ((v->s.pict_type == FF_I_TYPE) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm);
if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_P_TYPE) v->use_ic = 0;
- switch(v->s.pict_type)
- {
+ switch(v->s.pict_type) {
case FF_P_TYPE:
- if(v->pq < 5) v->tt_index = 0;
+ if (v->pq < 5) v->tt_index = 0;
else if(v->pq < 13) v->tt_index = 1;
else v->tt_index = 2;
lowquant = (v->pq > 12) ? 0 : 1;
v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
- if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
+ if (v->mv_mode == MV_PMODE_INTENSITY_COMP)
{
int scale, shift, i;
v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
@@ -690,86 +643,76 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
v->lumshift = get_bits(gb, 6);
v->use_ic = 1;
/* fill lookup tables for intensity compensation */
- if(!v->lumscale)
- {
+ if(!v->lumscale) {
scale = -64;
shift = (255 - v->lumshift * 2) << 6;
if(v->lumshift > 31)
shift += 128 << 6;
- }
- else
- {
+ } else {
scale = v->lumscale + 32;
if(v->lumshift > 31)
shift = (v->lumshift - 64) << 6;
else
shift = v->lumshift << 6;
}
- for(i = 0; i < 256; i++)
- {
+ for(i = 0; i < 256; i++) {
v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6);
- v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128 * 64 + 32) >> 6);
+ v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6);
}
}
if(v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN)
v->s.quarter_sample = 0;
- else if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
- {
+ else if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
if(v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)
v->s.quarter_sample = 0;
else
v->s.quarter_sample = 1;
- }
- else
+ } else
v->s.quarter_sample = 1;
v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN));
- if((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
- v->mv_mode2 == MV_PMODE_MIXED_MV)
- || v->mv_mode == MV_PMODE_MIXED_MV)
+ if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
+ v->mv_mode2 == MV_PMODE_MIXED_MV)
+ || v->mv_mode == MV_PMODE_MIXED_MV)
{
status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
- }
- else
- {
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
+ } else {
v->mv_type_is_raw = 0;
memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
}
status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
/* Hopefully this is correct for P frames */
v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
- if(v->dquant)
+ if (v->dquant)
{
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
vop_dquant_decoding(v);
}
v->ttfrm = 0; //FIXME Is that so ?
- if(v->vstransform)
+ if (v->vstransform)
{
v->ttmbf = get_bits1(gb);
- if(v->ttmbf)
+ if (v->ttmbf)
{
v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
}
- }
- else
- {
+ } else {
v->ttmbf = 1;
v->ttfrm = TT_8X8;
}
break;
case FF_B_TYPE:
- if(v->pq < 5) v->tt_index = 0;
+ if (v->pq < 5) v->tt_index = 0;
else if(v->pq < 13) v->tt_index = 1;
else v->tt_index = 2;
@@ -778,34 +721,32 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
v->s.mspel = v->s.quarter_sample;
status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
v->s.mv_table_index = get_bits(gb, 2);
v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
- if(v->dquant)
+ if (v->dquant)
{
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
vop_dquant_decoding(v);
}
v->ttfrm = 0;
- if(v->vstransform)
+ if (v->vstransform)
{
v->ttmbf = get_bits1(gb);
- if(v->ttmbf)
+ if (v->ttmbf)
{
v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
}
- }
- else
- {
+ } else {
v->ttmbf = 1;
v->ttfrm = TT_8X8;
}
@@ -816,7 +757,7 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
{
/* AC Syntax */
v->c_ac_table_index = decode012(gb);
- if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
+ if (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
{
v->y_ac_table_index = decode012(gb);
}
@@ -824,8 +765,7 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
v->s.dc_table_index = get_bits1(gb);
}
- if(v->s.pict_type == FF_BI_TYPE)
- {
+ if(v->s.pict_type == FF_BI_TYPE) {
v->s.pict_type = FF_B_TYPE;
v->bi_type = 1;
}
@@ -839,15 +779,13 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
v->p_frame_skipped = 0;
- if(v->interlace)
- {
+ if(v->interlace){
v->fcm = decode012(gb);
- // ==> Start patch MPC
+ // ==> Start patch MPC
if(v->fcm && !v->allow_interlaced) return -1; // interlaced frames/fields are not implemented
- // <== End patch MPC
+ // <== End patch MPC
}
- switch(get_unary(gb, 0, 4))
- {
+ switch(get_unary(gb, 0, 4)) {
case 0:
v->s.pict_type = FF_P_TYPE;
break;
@@ -867,52 +805,45 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
}
if(v->tfcntrflag)
skip_bits(gb, 8);
- if(v->broadcast)
- {
- if(!v->interlace || v->psf)
- {
+ if(v->broadcast) {
+ if(!v->interlace || v->psf) {
v->rptfrm = get_bits(gb, 2);
- }
- else
- {
+ } else {
v->tff = get_bits1(gb);
v->rptfrm = get_bits1(gb);
}
}
- if(v->panscanflag)
- {
+ if(v->panscanflag) {
//...
}
v->rnd = get_bits1(gb);
if(v->interlace)
v->uvsamp = get_bits1(gb);
if(v->finterpflag) v->interpfrm = get_bits1(gb);
- if(v->s.pict_type == FF_B_TYPE)
- {
+ if(v->s.pict_type == FF_B_TYPE) {
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)
- {
+ if(v->bfraction == 0) {
v->s.pict_type = FF_BI_TYPE; /* XXX: should not happen here */
}
}
pqindex = get_bits(gb, 5);
if(!pqindex) return -1;
v->pqindex = pqindex;
- if(v->quantizer_mode == QUANT_FRAME_IMPLICIT)
+ if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
v->pq = ff_vc1_pquant_table[0][pqindex];
else
v->pq = ff_vc1_pquant_table[1][pqindex];
v->pquantizer = 1;
- if(v->quantizer_mode == QUANT_FRAME_IMPLICIT)
+ if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
v->pquantizer = pqindex < 9;
- if(v->quantizer_mode == QUANT_NON_UNIFORM)
+ if (v->quantizer_mode == QUANT_NON_UNIFORM)
v->pquantizer = 0;
v->pqindex = pqindex;
- if(pqindex < 9) v->halfpq = get_bits1(gb);
+ if (pqindex < 9) v->halfpq = get_bits1(gb);
else v->halfpq = 0;
- if(v->quantizer_mode == QUANT_FRAME_EXPLICIT)
+ if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)
v->pquantizer = get_bits1(gb);
if(v->postprocflag)
v->postproc = get_bits(gb, 2);
@@ -922,135 +853,122 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
if(v->parse_only)
return 0;
- switch(v->s.pict_type)
- {
+ switch(v->s.pict_type) {
case FF_I_TYPE:
case FF_BI_TYPE:
status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
v->condover = CONDOVER_NONE;
- if(v->overlap && v->pq <= 8)
- {
+ if(v->overlap && v->pq <= 8) {
v->condover = decode012(gb);
- if(v->condover == CONDOVER_SELECT)
- {
+ if(v->condover == CONDOVER_SELECT) {
status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
}
}
break;
case FF_P_TYPE:
- if(v->extended_mv) v->mvrange = get_unary(gb, 0, 3);
+ if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3);
else v->mvrange = 0;
v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
v->range_x = 1 << (v->k_x - 1);
v->range_y = 1 << (v->k_y - 1);
- if(v->pq < 5) v->tt_index = 0;
+ if (v->pq < 5) v->tt_index = 0;
else if(v->pq < 13) v->tt_index = 1;
else v->tt_index = 2;
lowquant = (v->pq > 12) ? 0 : 1;
v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
- if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
+ if (v->mv_mode == MV_PMODE_INTENSITY_COMP)
{
int scale, shift, i;
v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
v->lumscale = get_bits(gb, 6);
v->lumshift = get_bits(gb, 6);
/* fill lookup tables for intensity compensation */
- if(!v->lumscale)
- {
+ if(!v->lumscale) {
scale = -64;
shift = (255 - v->lumshift * 2) << 6;
if(v->lumshift > 31)
shift += 128 << 6;
- }
- else
- {
+ } else {
scale = v->lumscale + 32;
if(v->lumshift > 31)
shift = (v->lumshift - 64) << 6;
else
shift = v->lumshift << 6;
}
- for(i = 0; i < 256; i++)
- {
+ for(i = 0; i < 256; i++) {
v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6);
- v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128 * 64 + 32) >> 6);
+ v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6);
}
v->use_ic = 1;
}
if(v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN)
v->s.quarter_sample = 0;
- else if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
- {
+ else if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
if(v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)
v->s.quarter_sample = 0;
else
v->s.quarter_sample = 1;
- }
- else
+ } else
v->s.quarter_sample = 1;
v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN));
- if((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
- v->mv_mode2 == MV_PMODE_MIXED_MV)
- || v->mv_mode == MV_PMODE_MIXED_MV)
+ if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
+ v->mv_mode2 == MV_PMODE_MIXED_MV)
+ || v->mv_mode == MV_PMODE_MIXED_MV)
{
status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
- }
- else
- {
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
+ } else {
v->mv_type_is_raw = 0;
memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
}
status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
/* Hopefully this is correct for P frames */
v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
- if(v->dquant)
+ if (v->dquant)
{
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
vop_dquant_decoding(v);
}
v->ttfrm = 0; //FIXME Is that so ?
- if(v->vstransform)
+ if (v->vstransform)
{
v->ttmbf = get_bits1(gb);
- if(v->ttmbf)
+ if (v->ttmbf)
{
v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
}
- }
- else
- {
+ } else {
v->ttmbf = 1;
v->ttfrm = TT_8X8;
}
break;
case FF_B_TYPE:
- if(v->extended_mv) v->mvrange = get_unary(gb, 0, 3);
+ if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3);
else v->mvrange = 0;
v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
v->range_x = 1 << (v->k_x - 1);
v->range_y = 1 << (v->k_y - 1);
- if(v->pq < 5) v->tt_index = 0;
+ if (v->pq < 5) v->tt_index = 0;
else if(v->pq < 13) v->tt_index = 1;
else v->tt_index = 2;
@@ -1059,34 +977,32 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
v->s.mspel = v->s.quarter_sample;
status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
- if(status < 0) return -1;
+ if (status < 0) return -1;
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
- "Imode: %i, Invert: %i\n", status >> 1, status & 1);
+ "Imode: %i, Invert: %i\n", status>>1, status&1);
v->s.mv_table_index = get_bits(gb, 2);
v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
- if(v->dquant)
+ if (v->dquant)
{
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
vop_dquant_decoding(v);
}
v->ttfrm = 0;
- if(v->vstransform)
+ if (v->vstransform)
{
v->ttmbf = get_bits1(gb);
- if(v->ttmbf)
+ if (v->ttmbf)
{
v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
}
- }
- else
- {
+ } else {
v->ttmbf = 1;
v->ttfrm = TT_8X8;
}
@@ -1095,21 +1011,19 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
/* AC Syntax */
v->c_ac_table_index = decode012(gb);
- if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
+ if (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
{
v->y_ac_table_index = decode012(gb);
}
/* DC Syntax */
v->s.dc_table_index = get_bits1(gb);
- if((v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE) && v->dquant)
- {
+ if ((v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE) && v->dquant) {
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
vop_dquant_decoding(v);
}
v->bi_type = 0;
- if(v->s.pict_type == FF_BI_TYPE)
- {
+ if(v->s.pict_type == FF_BI_TYPE) {
v->s.pict_type = FF_B_TYPE;
v->bi_type = 1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.h
index 4d2248251..24921dd5e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1.h
@@ -29,8 +29,7 @@
/** Markers used in VC-1 AP frame data */
//@{
-enum VC1Code
-{
+enum VC1Code{
VC1_CODE_RES0 = 0x00000100,
VC1_CODE_ENDOFSEQ = 0x0000010A,
VC1_CODE_SLICE,
@@ -45,8 +44,7 @@ enum VC1Code
/** Available Profiles */
//@{
-enum Profile
-{
+enum Profile {
PROFILE_SIMPLE,
PROFILE_MAIN,
PROFILE_COMPLEX, ///< TODO: WMV9 specific
@@ -56,8 +54,7 @@ enum Profile
/** Sequence quantizer mode */
//@{
-enum QuantMode
-{
+enum QuantMode {
QUANT_FRAME_IMPLICIT, ///< Implicitly specified at frame level
QUANT_FRAME_EXPLICIT, ///< Explicitly specified at frame level
QUANT_NON_UNIFORM, ///< Non-uniform quant used for all frames
@@ -67,8 +64,7 @@ enum QuantMode
/** Where quant can be changed */
//@{
-enum DQProfile
-{
+enum DQProfile {
DQPROFILE_FOUR_EDGES,
DQPROFILE_DOUBLE_EDGES,
DQPROFILE_SINGLE_EDGE,
@@ -79,8 +75,7 @@ enum DQProfile
/** @name Where quant can be changed
*/
//@{
-enum DQSingleEdge
-{
+enum DQSingleEdge {
DQSINGLE_BEDGE_LEFT,
DQSINGLE_BEDGE_TOP,
DQSINGLE_BEDGE_RIGHT,
@@ -90,8 +85,7 @@ enum DQSingleEdge
/** Which pair of edges is quantized with ALTPQUANT */
//@{
-enum DQDoubleEdge
-{
+enum DQDoubleEdge {
DQDOUBLE_BEDGE_TOPLEFT,
DQDOUBLE_BEDGE_TOPRIGHT,
DQDOUBLE_BEDGE_BOTTOMRIGHT,
@@ -101,8 +95,7 @@ enum DQDoubleEdge
/** MV modes for P frames */
//@{
-enum MVModes
-{
+enum MVModes {
MV_PMODE_1MV_HPEL_BILIN,
MV_PMODE_1MV,
MV_PMODE_1MV_HPEL,
@@ -113,8 +106,7 @@ enum MVModes
/** @name MV types for B frames */
//@{
-enum BMVTypes
-{
+enum BMVTypes {
BMV_TYPE_BACKWARD,
BMV_TYPE_FORWARD,
BMV_TYPE_INTERPOLATED
@@ -123,8 +115,7 @@ enum BMVTypes
/** @name Block types for P/B frames */
//@{
-enum TransformTypes
-{
+enum TransformTypes {
TT_8X8,
TT_8X4_BOTTOM,
TT_8X4_TOP,
@@ -136,8 +127,7 @@ enum TransformTypes
};
//@}
-enum CodingSet
-{
+enum CodingSet {
CS_HIGH_MOT_INTRA = 0,
CS_HIGH_MOT_INTER,
CS_LOW_MOT_INTRA,
@@ -150,8 +140,7 @@ enum CodingSet
/** @name Overlap conditions for Advanced Profile */
//@{
-enum COTypes
-{
+enum COTypes {
CONDOVER_NONE = 0,
CONDOVER_ALL,
CONDOVER_SELECT
@@ -163,8 +152,7 @@ enum COTypes
* @todo Change size wherever another size is more efficient
* Many members are only used for Advanced Profile
*/
-typedef struct VC1Context
-{
+typedef struct VC1Context{
MpegEncContext s;
IntraX8Context x8;
@@ -178,7 +166,7 @@ typedef struct VC1Context
int res_fasttx; ///< reserved, always 1
int res_transtab; ///< reserved, always 0
int rangered; ///< RANGEREDFRM (range reduction) syntax element present
- ///< at frame level
+ ///< at frame level
int res_rtm_flag; ///< reserved, set to 1
int reserved; ///< reserved
//@}
@@ -198,7 +186,7 @@ typedef struct VC1Context
int transfer_char; ///< 8bits, Opto-electronic transfer characteristics
int matrix_coef; ///< 8bits, Color primaries->YCbCr transform matrix
int hrd_param_flag; ///< Presence of Hypothetical Reference
- ///< Decoder parameters
+ ///< Decoder parameters
int psf; ///< Progressive Segmented Frame
//@}
@@ -339,12 +327,11 @@ static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, cons
{
uint32_t mrk = 0xFFFFFFFF;
- if(end - src < 4) return end;
- while(src < end)
- {
+ if(end-src < 4) return end;
+ while(src < end){
mrk = (mrk << 8) | *src++;
if(IS_MARKER(mrk))
- return src - 4;
+ return src-4;
}
return end;
}
@@ -353,20 +340,16 @@ static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, ui
{
int dsize = 0, i;
- if(size < 4)
- {
+ if(size < 4){
for(dsize = 0; dsize < size; dsize++) *dst++ = *src++;
return size;
}
- for(i = 0; i < size; i++, src++)
- {
- if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size - 1 && src[1] < 4)
- {
+ for(i = 0; i < size; i++, src++) {
+ if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) {
dst[dsize++] = src[1];
src++;
i++;
- }
- else
+ } else
dst[dsize++] = *src;
}
return dsize;
@@ -383,7 +366,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
-int vc1_parse_frame_header(VC1Context *v, GetBitContext *gb);
+int vc1_parse_frame_header (VC1Context *v, GetBitContext *gb);
int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb);
#endif /* AVCODEC_VC1_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1_dxva.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1_dxva.c
index 1d82d5ffa..c482e7f0a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1_dxva.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1_dxva.c
@@ -20,50 +20,45 @@
// void *data, int *data_size,
// uint8_t *buf, int buf_size)
int av_vc1_decode_frame(AVCodecContext *avctx,
- uint8_t *buf, int buf_size)
+ uint8_t *buf, int buf_size)
{
VC1Context *v = avctx->priv_data;
MpegEncContext *s = &v->s;
//AVFrame *pict = data;
uint8_t *buf2 = NULL;
- v->allow_interlaced = 1;
- v->lumshift = 0;
- v->lumscale = 32;
+ v->allow_interlaced = 1;
+ v->lumshift = 0;
+ v->lumscale = 32;
/* We need to set current_picture_ptr before reading the header,
* otherwise we cannot store anything in there. */
- if(s->current_picture_ptr == NULL || s->current_picture_ptr->data[0])
- {
- int i = ff_find_unused_picture(s, 0);
- s->current_picture_ptr = &s->picture[i];
+ if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
+ int i= ff_find_unused_picture(s, 0);
+ s->current_picture_ptr= &s->picture[i];
}
//for advanced profile we may need to parse and unescape data
- if(avctx->codec_id == CODEC_ID_VC1)
- {
+ if (avctx->codec_id == CODEC_ID_VC1) {
int buf_size2 = 0;
buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if(IS_MARKER(AV_RB32(buf))) /* frame starts with marker and needs to be parsed */
- {
+ if(IS_MARKER(AV_RB32(buf))){ /* frame starts with marker and needs to be parsed */
const uint8_t *start, *end, *next;
int size;
next = buf;
- for(start = buf, end = buf + buf_size; next < end; start = next)
- {
+ for(start = buf, end = buf + buf_size; next < end; start = next){
next = find_next_marker(start + 4, end);
size = next - start - 4;
if(size <= 0) continue;
- switch(AV_RB32(start))
- {
+ switch(AV_RB32(start)){
case VC1_CODE_FRAME:
buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
break;
case VC1_CODE_ENTRYPOINT: /* it should be before frame data */
buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
- init_get_bits(&s->gb, buf2, buf_size2 * 8);
+ init_get_bits(&s->gb, buf2, buf_size2*8);
vc1_decode_entry_point(avctx, v, &s->gb);
break;
case VC1_CODE_SLICE:
@@ -72,45 +67,33 @@ int av_vc1_decode_frame(AVCodecContext *avctx,
return -1;
}
}
- }
- else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)) /* WVC1 interlaced stores both fields divided by marker */
- {
+ }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */
const uint8_t *divider;
divider = find_next_marker(buf, buf + buf_size);
- if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD)
- {
+ if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){
av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
- av_free(buf2);
+ av_free(buf2);
return -1;
}
buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2);
// TODO
- av_free(buf2);
- return -1;
- }
- else
- {
+ av_free(buf2);return -1;
+ }else{
buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);
}
- init_get_bits(&s->gb, buf2, buf_size2 * 8);
- }
- else
- init_get_bits(&s->gb, buf, buf_size * 8);
+ init_get_bits(&s->gb, buf2, buf_size2*8);
+ } else
+ init_get_bits(&s->gb, buf, buf_size*8);
// do parse frame header
- if(v->profile < PROFILE_ADVANCED)
- {
- if(vc1_parse_frame_header(v, &s->gb) == -1)
- {
+ if(v->profile < PROFILE_ADVANCED) {
+ if(vc1_parse_frame_header(v, &s->gb) == -1) {
av_free(buf2);
return -1;
}
- }
- else
- {
- if(vc1_parse_frame_header_adv(v, &s->gb) == -1)
- {
+ } else {
+ if(vc1_parse_frame_header_adv(v, &s->gb) == -1) {
av_free(buf2);
return -1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1acdata.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1acdata.h
index 4762b481e..78de0f9a2 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1acdata.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1acdata.h
@@ -26,575 +26,567 @@
#define AC_MODES 8
-static const int vc1_ac_sizes[AC_MODES] =
-{
+static const int vc1_ac_sizes[AC_MODES] = {
186, 169, 133, 149, 103, 103, 163, 175
};
-static const uint32_t vc1_ac_tables[AC_MODES][186][2] =
-{
- {
- { 0x0001, 2}, { 0x0005, 3}, { 0x000D, 4}, { 0x0012, 5}, { 0x000E, 6}, { 0x0015, 7},
- { 0x0013, 8}, { 0x003F, 8}, { 0x004B, 9}, { 0x011F, 9}, { 0x00B8, 10}, { 0x03E3, 10},
- { 0x0172, 11}, { 0x024D, 12}, { 0x03DA, 12}, { 0x02DD, 13}, { 0x1F55, 13}, { 0x05B9, 14},
- { 0x3EAE, 14}, { 0x0000, 4}, { 0x0010, 5}, { 0x0008, 7}, { 0x0020, 8}, { 0x0029, 9},
- { 0x01F4, 9}, { 0x0233, 10}, { 0x01E0, 11}, { 0x012A, 12}, { 0x03DD, 12}, { 0x050A, 13},
- { 0x1F29, 13}, { 0x0A42, 14}, { 0x1272, 15}, { 0x1737, 15}, { 0x0003, 5}, { 0x0011, 7},
- { 0x00C4, 8}, { 0x004B, 10}, { 0x00B4, 11}, { 0x07D4, 11}, { 0x0345, 12}, { 0x02D7, 13},
- { 0x07BF, 13}, { 0x0938, 14}, { 0x0BBB, 14}, { 0x095E, 15}, { 0x0013, 5}, { 0x0078, 7},
- { 0x0069, 9}, { 0x0232, 10}, { 0x0461, 11}, { 0x03EC, 12}, { 0x0520, 13}, { 0x1F2A, 13},
- { 0x3E50, 14}, { 0x3E51, 14}, { 0x1486, 15}, { 0x000C, 6}, { 0x0024, 9}, { 0x0094, 11},
- { 0x08C0, 12}, { 0x0F09, 14}, { 0x1EF0, 15}, { 0x003D, 6}, { 0x0053, 9}, { 0x01A0, 11},
- { 0x02D6, 13}, { 0x0F08, 14}, { 0x0013, 7}, { 0x007C, 9}, { 0x07C1, 11}, { 0x04AC, 14},
- { 0x001B, 7}, { 0x00A0, 10}, { 0x0344, 12}, { 0x0F79, 14}, { 0x0079, 7}, { 0x03E1, 10},
- { 0x02D4, 13}, { 0x2306, 14}, { 0x0021, 8}, { 0x023C, 10}, { 0x0FAE, 12}, { 0x23DE, 14},
- { 0x0035, 8}, { 0x0175, 11}, { 0x07B3, 13}, { 0x00C5, 8}, { 0x0174, 11}, { 0x0785, 13},
- { 0x0048, 9}, { 0x01A3, 11}, { 0x049E, 13}, { 0x002C, 9}, { 0x00FA, 10}, { 0x07D6, 11},
- { 0x0092, 10}, { 0x05CC, 13}, { 0x1EF1, 15}, { 0x00A3, 10}, { 0x03ED, 12}, { 0x093E, 14},
- { 0x01E2, 11}, { 0x1273, 15}, { 0x07C4, 11}, { 0x1487, 15}, { 0x0291, 12}, { 0x0293, 12},
- { 0x0F8A, 12}, { 0x0509, 13}, { 0x0508, 13}, { 0x078D, 13}, { 0x07BE, 13}, { 0x078C, 13},
- { 0x04AE, 14}, { 0x0BBA, 14}, { 0x2307, 14}, { 0x0B9A, 14}, { 0x1736, 15}, { 0x000E, 4},
- { 0x0045, 7}, { 0x01F3, 9}, { 0x047A, 11}, { 0x05DC, 13}, { 0x23DF, 14}, { 0x0019, 5},
- { 0x0028, 9}, { 0x0176, 11}, { 0x049D, 13}, { 0x23DD, 14}, { 0x0030, 6}, { 0x00A2, 10},
- { 0x02EF, 12}, { 0x05B8, 14}, { 0x003F, 6}, { 0x00A5, 10}, { 0x03DB, 12}, { 0x093F, 14},
- { 0x0044, 7}, { 0x07CB, 11}, { 0x095F, 15}, { 0x0063, 7}, { 0x03C3, 12}, { 0x0015, 8},
- { 0x08F6, 12}, { 0x0017, 8}, { 0x0498, 13}, { 0x002C, 8}, { 0x07B2, 13}, { 0x002F, 8},
- { 0x1F54, 13}, { 0x008D, 8}, { 0x07BD, 13}, { 0x008E, 8}, { 0x1182, 13}, { 0x00FB, 8},
- { 0x050B, 13}, { 0x002D, 8}, { 0x07C0, 11}, { 0x0079, 9}, { 0x1F5F, 13}, { 0x007A, 9},
- { 0x1F56, 13}, { 0x0231, 10}, { 0x03E4, 10}, { 0x01A1, 11}, { 0x0143, 11}, { 0x01F7, 11},
- { 0x016F, 12}, { 0x0292, 12}, { 0x02E7, 12}, { 0x016C, 12}, { 0x016D, 12}, { 0x03DC, 12},
- { 0x0F8B, 12}, { 0x0499, 13}, { 0x03D8, 12}, { 0x078E, 13}, { 0x02D5, 13}, { 0x1F5E, 13},
- { 0x1F2B, 13}, { 0x078F, 13}, { 0x04AD, 14}, { 0x3EAF, 14}, { 0x23DC, 14}, { 0x004A, 9}
- },
- {
- { 0x0000, 3}, { 0x0003, 4}, { 0x000B, 5}, { 0x0014, 6}, { 0x003F, 6}, { 0x005D, 7},
- { 0x00A2, 8}, { 0x00AC, 9}, { 0x016E, 9}, { 0x020A, 10}, { 0x02E2, 10}, { 0x0432, 11},
- { 0x05C9, 11}, { 0x0827, 12}, { 0x0B54, 12}, { 0x04E6, 13}, { 0x105F, 13}, { 0x172A, 13},
- { 0x20B2, 14}, { 0x2D4E, 14}, { 0x39F0, 14}, { 0x4175, 15}, { 0x5A9E, 15}, { 0x0004, 4},
- { 0x001E, 5}, { 0x0042, 7}, { 0x00B6, 8}, { 0x0173, 9}, { 0x0395, 10}, { 0x072E, 11},
- { 0x0B94, 12}, { 0x16A4, 13}, { 0x20B3, 14}, { 0x2E45, 14}, { 0x0005, 5}, { 0x0040, 7},
- { 0x0049, 9}, { 0x028F, 10}, { 0x05CB, 11}, { 0x048A, 13}, { 0x09DD, 14}, { 0x73E2, 15},
- { 0x0018, 5}, { 0x0025, 8}, { 0x008A, 10}, { 0x051B, 11}, { 0x0E5F, 12}, { 0x09C9, 14},
- { 0x139C, 15}, { 0x0029, 6}, { 0x004F, 9}, { 0x0412, 11}, { 0x048D, 13}, { 0x2E41, 14},
- { 0x0038, 6}, { 0x010E, 9}, { 0x05A8, 11}, { 0x105C, 13}, { 0x39F2, 14}, { 0x0058, 7},
- { 0x021F, 10}, { 0x0E7E, 12}, { 0x39FF, 14}, { 0x0023, 8}, { 0x02E3, 10}, { 0x04E5, 13},
- { 0x2E40, 14}, { 0x00A1, 8}, { 0x05BE, 11}, { 0x09C8, 14}, { 0x0083, 8}, { 0x013A, 11},
- { 0x1721, 13}, { 0x0044, 9}, { 0x0276, 12}, { 0x39F6, 14}, { 0x008B, 10}, { 0x04EF, 13},
- { 0x5A9B, 15}, { 0x0208, 10}, { 0x1CFE, 13}, { 0x0399, 10}, { 0x1CB4, 13}, { 0x039E, 10},
- { 0x39F3, 14}, { 0x05AB, 11}, { 0x73E3, 15}, { 0x0737, 11}, { 0x5A9F, 15}, { 0x082D, 12},
- { 0x0E69, 12}, { 0x0E68, 12}, { 0x0433, 11}, { 0x0B7B, 12}, { 0x2DF8, 14}, { 0x2E56, 14},
- { 0x2E57, 14}, { 0x39F7, 14}, { 0x51A5, 15}, { 0x0003, 3}, { 0x002A, 6}, { 0x00E4, 8},
- { 0x028E, 10}, { 0x0735, 11}, { 0x1058, 13}, { 0x1CFA, 13}, { 0x2DF9, 14}, { 0x4174, 15},
- { 0x0009, 4}, { 0x0054, 8}, { 0x0398, 10}, { 0x048B, 13}, { 0x139D, 15}, { 0x000D, 4},
- { 0x00AD, 9}, { 0x0826, 12}, { 0x2D4C, 14}, { 0x0011, 5}, { 0x016B, 9}, { 0x0B7F, 12},
- { 0x51A4, 15}, { 0x0019, 5}, { 0x021B, 10}, { 0x16FD, 13}, { 0x001D, 5}, { 0x0394, 10},
- { 0x28D3, 14}, { 0x002B, 6}, { 0x05BC, 11}, { 0x5A9A, 15}, { 0x002F, 6}, { 0x0247, 12},
- { 0x0010, 7}, { 0x0A35, 12}, { 0x003E, 6}, { 0x0B7A, 12}, { 0x0059, 7}, { 0x105E, 13},
- { 0x0026, 8}, { 0x09CF, 14}, { 0x0055, 8}, { 0x1CB5, 13}, { 0x0057, 8}, { 0x0E5B, 12},
- { 0x00A0, 8}, { 0x1468, 13}, { 0x0170, 9}, { 0x0090, 10}, { 0x01CE, 9}, { 0x021A, 10},
- { 0x0218, 10}, { 0x0168, 9}, { 0x021E, 10}, { 0x0244, 12}, { 0x0736, 11}, { 0x0138, 11},
- { 0x0519, 11}, { 0x0E5E, 12}, { 0x072C, 11}, { 0x0B55, 12}, { 0x09DC, 14}, { 0x20BB, 14},
- { 0x048C, 13}, { 0x1723, 13}, { 0x2E44, 14}, { 0x16A5, 13}, { 0x0518, 11}, { 0x39FE, 14},
- { 0x0169, 9}
- },
- {
- { 0x0001, 2}, { 0x0006, 3}, { 0x000F, 4}, { 0x0016, 5}, { 0x0020, 6}, { 0x0018, 7},
- { 0x0008, 8}, { 0x009A, 8}, { 0x0056, 9}, { 0x013E, 9}, { 0x00F0, 10}, { 0x03A5, 10},
- { 0x0077, 11}, { 0x01EF, 11}, { 0x009A, 12}, { 0x005D, 13}, { 0x0001, 4}, { 0x0011, 5},
- { 0x0002, 7}, { 0x000B, 8}, { 0x0012, 9}, { 0x01D6, 9}, { 0x027E, 10}, { 0x0191, 11},
- { 0x00EA, 12}, { 0x03DC, 12}, { 0x013B, 13}, { 0x0004, 5}, { 0x0014, 7}, { 0x009E, 8},
- { 0x0009, 10}, { 0x01AC, 11}, { 0x01E2, 11}, { 0x03CA, 12}, { 0x005F, 13}, { 0x0017, 5},
- { 0x004E, 7}, { 0x005E, 9}, { 0x00F3, 10}, { 0x01AD, 11}, { 0x00EC, 12}, { 0x05F0, 13},
- { 0x000E, 6}, { 0x00E1, 8}, { 0x03A4, 10}, { 0x009C, 12}, { 0x013D, 13}, { 0x003B, 6},
- { 0x001C, 9}, { 0x0014, 11}, { 0x09BE, 12}, { 0x0006, 7}, { 0x007A, 9}, { 0x0190, 11},
- { 0x0137, 13}, { 0x001B, 7}, { 0x0008, 10}, { 0x075C, 11}, { 0x0071, 7}, { 0x00D7, 10},
- { 0x09BF, 12}, { 0x0007, 8}, { 0x00AF, 10}, { 0x04CC, 11}, { 0x0034, 8}, { 0x0265, 10},
- { 0x009F, 12}, { 0x00E0, 8}, { 0x0016, 11}, { 0x0327, 12}, { 0x0015, 9}, { 0x017D, 11},
- { 0x0EBB, 12}, { 0x0014, 9}, { 0x00F6, 10}, { 0x01E4, 11}, { 0x00CB, 10}, { 0x099D, 12},
- { 0x00CA, 10}, { 0x02FC, 12}, { 0x017F, 11}, { 0x04CD, 11}, { 0x02FD, 12}, { 0x04FE, 11},
- { 0x013A, 13}, { 0x000A, 4}, { 0x0042, 7}, { 0x01D3, 9}, { 0x04DD, 11}, { 0x0012, 5},
- { 0x00E8, 8}, { 0x004C, 11}, { 0x0136, 13}, { 0x0039, 6}, { 0x0264, 10}, { 0x0EBA, 12},
- { 0x0000, 7}, { 0x00AE, 10}, { 0x099C, 12}, { 0x001F, 7}, { 0x04DE, 11}, { 0x0043, 7},
- { 0x04DC, 11}, { 0x0003, 8}, { 0x03CB, 12}, { 0x0006, 8}, { 0x099E, 12}, { 0x002A, 8},
- { 0x05F1, 13}, { 0x000F, 8}, { 0x09FE, 12}, { 0x0033, 8}, { 0x09FF, 12}, { 0x0098, 8},
- { 0x099F, 12}, { 0x00EA, 8}, { 0x013C, 13}, { 0x002E, 8}, { 0x0192, 11}, { 0x0136, 9},
- { 0x006A, 9}, { 0x0015, 11}, { 0x03AF, 10}, { 0x01E3, 11}, { 0x0074, 11}, { 0x00EB, 12},
- { 0x02F9, 12}, { 0x005C, 13}, { 0x00ED, 12}, { 0x03DD, 12}, { 0x0326, 12}, { 0x005E, 13},
- { 0x0016, 7}
- },
- {
- { 0x0004, 3}, { 0x0014, 5}, { 0x0017, 7}, { 0x007F, 8}, { 0x0154, 9}, { 0x01F2, 10},
- { 0x00BF, 11}, { 0x0065, 12}, { 0x0AAA, 12}, { 0x0630, 13}, { 0x1597, 13}, { 0x03B7, 14},
- { 0x2B22, 14}, { 0x0BE6, 15}, { 0x000B, 4}, { 0x0037, 7}, { 0x0062, 9}, { 0x0007, 11},
- { 0x0166, 12}, { 0x00CE, 13}, { 0x1590, 13}, { 0x05F6, 14}, { 0x0BE7, 15}, { 0x0007, 5},
- { 0x006D, 8}, { 0x0003, 11}, { 0x031F, 12}, { 0x05F2, 14}, { 0x0002, 6}, { 0x0061, 9},
- { 0x0055, 12}, { 0x01DF, 14}, { 0x001A, 6}, { 0x001E, 10}, { 0x0AC9, 12}, { 0x2B23, 14},
- { 0x001E, 6}, { 0x001F, 10}, { 0x0AC3, 12}, { 0x2B2B, 14}, { 0x0006, 7}, { 0x0004, 11},
- { 0x02F8, 13}, { 0x0019, 7}, { 0x0006, 11}, { 0x063D, 13}, { 0x0057, 7}, { 0x0182, 11},
- { 0x2AA2, 14}, { 0x0004, 8}, { 0x0180, 11}, { 0x059C, 14}, { 0x007D, 8}, { 0x0164, 12},
- { 0x076D, 15}, { 0x0002, 9}, { 0x018D, 11}, { 0x1581, 13}, { 0x00AD, 8}, { 0x0060, 12},
- { 0x0C67, 14}, { 0x001C, 9}, { 0x00EE, 13}, { 0x0003, 9}, { 0x02CF, 13}, { 0x00D9, 9},
- { 0x1580, 13}, { 0x0002, 11}, { 0x0183, 11}, { 0x0057, 12}, { 0x0061, 12}, { 0x0031, 11},
- { 0x0066, 12}, { 0x0631, 13}, { 0x0632, 13}, { 0x00AC, 13}, { 0x031D, 12}, { 0x0076, 12},
- { 0x003A, 11}, { 0x0165, 12}, { 0x0C66, 14}, { 0x0003, 2}, { 0x0054, 7}, { 0x02AB, 10},
- { 0x0016, 13}, { 0x05F7, 14}, { 0x0005, 4}, { 0x00F8, 9}, { 0x0AA9, 12}, { 0x005F, 15},
- { 0x0004, 4}, { 0x001C, 10}, { 0x1550, 13}, { 0x0004, 5}, { 0x0077, 11}, { 0x076C, 15},
- { 0x000E, 5}, { 0x000A, 12}, { 0x000C, 5}, { 0x0562, 11}, { 0x0004, 6}, { 0x031C, 12},
- { 0x0006, 6}, { 0x00C8, 13}, { 0x000D, 6}, { 0x01DA, 13}, { 0x0007, 6}, { 0x00C9, 13},
- { 0x0001, 7}, { 0x002E, 14}, { 0x0014, 7}, { 0x1596, 13}, { 0x000A, 7}, { 0x0AC2, 12},
- { 0x0016, 7}, { 0x015B, 14}, { 0x0015, 7}, { 0x015A, 14}, { 0x000F, 8}, { 0x005E, 15},
- { 0x007E, 8}, { 0x00AB, 8}, { 0x002D, 9}, { 0x00D8, 9}, { 0x000B, 9}, { 0x0014, 10},
- { 0x02B3, 10}, { 0x01F3, 10}, { 0x003A, 10}, { 0x0000, 10}, { 0x0058, 10}, { 0x002E, 9},
- { 0x005E, 10}, { 0x0563, 11}, { 0x00EC, 12}, { 0x0054, 12}, { 0x0AC1, 12}, { 0x1556, 13},
- { 0x02FA, 13}, { 0x0181, 11}, { 0x1557, 13}, { 0x059D, 14}, { 0x2AA3, 14}, { 0x2B2A, 14},
- { 0x01DE, 14}, { 0x063C, 13}, { 0x00CF, 13}, { 0x1594, 13}, { 0x000D, 9}
- },
- {
- { 0x0002, 2}, { 0x0006, 3}, { 0x000F, 4}, { 0x000D, 5}, { 0x000C, 5}, { 0x0015, 6},
- { 0x0013, 6}, { 0x0012, 6}, { 0x0017, 7}, { 0x001F, 8}, { 0x001E, 8}, { 0x001D, 8},
- { 0x0025, 9}, { 0x0024, 9}, { 0x0023, 9}, { 0x0021, 9}, { 0x0021, 10}, { 0x0020, 10},
- { 0x000F, 10}, { 0x000E, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11}, { 0x0021, 11},
- { 0x0050, 12}, { 0x0051, 12}, { 0x0052, 12}, { 0x000E, 4}, { 0x0014, 6}, { 0x0016, 7},
- { 0x001C, 8}, { 0x0020, 9}, { 0x001F, 9}, { 0x000D, 10}, { 0x0022, 11}, { 0x0053, 12},
- { 0x0055, 12}, { 0x000B, 5}, { 0x0015, 7}, { 0x001E, 9}, { 0x000C, 10}, { 0x0056, 12},
- { 0x0011, 6}, { 0x001B, 8}, { 0x001D, 9}, { 0x000B, 10}, { 0x0010, 6}, { 0x0022, 9},
- { 0x000A, 10}, { 0x000D, 6}, { 0x001C, 9}, { 0x0008, 10}, { 0x0012, 7}, { 0x001B, 9},
- { 0x0054, 12}, { 0x0014, 7}, { 0x001A, 9}, { 0x0057, 12}, { 0x0019, 8}, { 0x0009, 10},
- { 0x0018, 8}, { 0x0023, 11}, { 0x0017, 8}, { 0x0019, 9}, { 0x0018, 9}, { 0x0007, 10},
- { 0x0058, 12}, { 0x0007, 4}, { 0x000C, 6}, { 0x0016, 8}, { 0x0017, 9}, { 0x0006, 10},
- { 0x0005, 11}, { 0x0004, 11}, { 0x0059, 12}, { 0x000F, 6}, { 0x0016, 9}, { 0x0005, 10},
- { 0x000E, 6}, { 0x0004, 10}, { 0x0011, 7}, { 0x0024, 11}, { 0x0010, 7}, { 0x0025, 11},
- { 0x0013, 7}, { 0x005A, 12}, { 0x0015, 8}, { 0x005B, 12}, { 0x0014, 8}, { 0x0013, 8},
- { 0x001A, 8}, { 0x0015, 9}, { 0x0014, 9}, { 0x0013, 9}, { 0x0012, 9}, { 0x0011, 9},
- { 0x0026, 11}, { 0x0027, 11}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12},
- { 0x0003, 7}
- },
- {
- { 0x0002, 2}, { 0x000F, 4}, { 0x0015, 6}, { 0x0017, 7}, { 0x001F, 8}, { 0x0025, 9},
- { 0x0024, 9}, { 0x0021, 10}, { 0x0020, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11},
- { 0x0006, 3}, { 0x0014, 6}, { 0x001E, 8}, { 0x000F, 10}, { 0x0021, 11}, { 0x0050, 12},
- { 0x000E, 4}, { 0x001D, 8}, { 0x000E, 10}, { 0x0051, 12}, { 0x000D, 5}, { 0x0023, 9},
- { 0x000D, 10}, { 0x000C, 5}, { 0x0022, 9}, { 0x0052, 12}, { 0x000B, 5}, { 0x000C, 10},
- { 0x0053, 12}, { 0x0013, 6}, { 0x000B, 10}, { 0x0054, 12}, { 0x0012, 6}, { 0x000A, 10},
- { 0x0011, 6}, { 0x0009, 10}, { 0x0010, 6}, { 0x0008, 10}, { 0x0016, 7}, { 0x0055, 12},
- { 0x0015, 7}, { 0x0014, 7}, { 0x001C, 8}, { 0x001B, 8}, { 0x0021, 9}, { 0x0020, 9},
- { 0x001F, 9}, { 0x001E, 9}, { 0x001D, 9}, { 0x001C, 9}, { 0x001B, 9}, { 0x001A, 9},
- { 0x0022, 11}, { 0x0023, 11}, { 0x0056, 12}, { 0x0057, 12}, { 0x0007, 4}, { 0x0019, 9},
- { 0x0005, 11}, { 0x000F, 6}, { 0x0004, 11}, { 0x000E, 6}, { 0x000D, 6}, { 0x000C, 6},
- { 0x0013, 7}, { 0x0012, 7}, { 0x0011, 7}, { 0x0010, 7}, { 0x001A, 8}, { 0x0019, 8},
- { 0x0018, 8}, { 0x0017, 8}, { 0x0016, 8}, { 0x0015, 8}, { 0x0014, 8}, { 0x0013, 8},
- { 0x0018, 9}, { 0x0017, 9}, { 0x0016, 9}, { 0x0015, 9}, { 0x0014, 9}, { 0x0013, 9},
- { 0x0012, 9}, { 0x0011, 9}, { 0x0007, 10}, { 0x0006, 10}, { 0x0005, 10}, { 0x0004, 10},
- { 0x0024, 11}, { 0x0025, 11}, { 0x0026, 11}, { 0x0027, 11}, { 0x0058, 12}, { 0x0059, 12},
- { 0x005A, 12}, { 0x005B, 12}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12},
- { 0x0003, 7}
- },
- {
- { 0x0000, 2}, { 0x0003, 3}, { 0x000D, 4}, { 0x0005, 4}, { 0x001C, 5}, { 0x0016, 5},
- { 0x003F, 6}, { 0x003A, 6}, { 0x002E, 6}, { 0x0022, 6}, { 0x007B, 7}, { 0x0067, 7},
- { 0x005F, 7}, { 0x0047, 7}, { 0x0026, 7}, { 0x00EF, 8}, { 0x00CD, 8}, { 0x00C1, 8},
- { 0x00A9, 8}, { 0x004F, 8}, { 0x01F2, 9}, { 0x01DD, 9}, { 0x0199, 9}, { 0x0185, 9},
- { 0x015D, 9}, { 0x011B, 9}, { 0x03EF, 10}, { 0x03E1, 10}, { 0x03C8, 10}, { 0x0331, 10},
- { 0x0303, 10}, { 0x02F1, 10}, { 0x02A0, 10}, { 0x0233, 10}, { 0x0126, 10}, { 0x07C0, 11},
- { 0x076F, 11}, { 0x076C, 11}, { 0x0661, 11}, { 0x0604, 11}, { 0x0572, 11}, { 0x0551, 11},
- { 0x046A, 11}, { 0x0274, 11}, { 0x0F27, 12}, { 0x0F24, 12}, { 0x0EDB, 12}, { 0x0C8E, 12},
- { 0x0C0B, 12}, { 0x0C0A, 12}, { 0x0AE3, 12}, { 0x08D6, 12}, { 0x0490, 12}, { 0x0495, 12},
- { 0x1F19, 13}, { 0x1DB5, 13}, { 0x0009, 4}, { 0x0010, 5}, { 0x0029, 6}, { 0x0062, 7},
- { 0x00F3, 8}, { 0x00AD, 8}, { 0x01E5, 9}, { 0x0179, 9}, { 0x009C, 9}, { 0x03B1, 10},
- { 0x02AE, 10}, { 0x0127, 10}, { 0x076E, 11}, { 0x0570, 11}, { 0x0275, 11}, { 0x0F25, 12},
- { 0x0EC0, 12}, { 0x0AA0, 12}, { 0x08D7, 12}, { 0x1E4C, 13}, { 0x0008, 5}, { 0x0063, 7},
- { 0x00AF, 8}, { 0x017B, 9}, { 0x03B3, 10}, { 0x07DD, 11}, { 0x0640, 11}, { 0x0F8D, 12},
- { 0x0BC1, 12}, { 0x0491, 12}, { 0x0028, 6}, { 0x00C3, 8}, { 0x0151, 9}, { 0x02A1, 10},
- { 0x0573, 11}, { 0x0EC3, 12}, { 0x1F35, 13}, { 0x0065, 7}, { 0x01DA, 9}, { 0x02AF, 10},
- { 0x0277, 11}, { 0x08C9, 12}, { 0x1781, 13}, { 0x0025, 7}, { 0x0118, 9}, { 0x0646, 11},
- { 0x0AA6, 12}, { 0x1780, 13}, { 0x00C9, 8}, { 0x0321, 10}, { 0x0F9B, 12}, { 0x191E, 13},
- { 0x0048, 8}, { 0x07CC, 11}, { 0x0AA1, 12}, { 0x0180, 9}, { 0x0465, 11}, { 0x1905, 13},
- { 0x03E2, 10}, { 0x0EC1, 12}, { 0x3C9B, 14}, { 0x02F4, 10}, { 0x08C8, 12}, { 0x07C1, 11},
- { 0x0928, 13}, { 0x05E1, 11}, { 0x320D, 14}, { 0x0EC2, 12}, { 0x6418, 15}, { 0x1F34, 13},
- { 0x0078, 7}, { 0x0155, 9}, { 0x0552, 11}, { 0x191F, 13}, { 0x00FA, 8}, { 0x07DC, 11},
- { 0x1907, 13}, { 0x00AC, 8}, { 0x0249, 11}, { 0x13B1, 14}, { 0x01F6, 9}, { 0x0AE2, 12},
- { 0x01DC, 9}, { 0x04ED, 12}, { 0x0184, 9}, { 0x1904, 13}, { 0x0156, 9}, { 0x09D9, 13},
- { 0x03E7, 10}, { 0x0929, 13}, { 0x03B2, 10}, { 0x3B68, 14}, { 0x02F5, 10}, { 0x13B0, 14},
- { 0x0322, 10}, { 0x3B69, 14}, { 0x0234, 10}, { 0x7935, 15}, { 0x07C7, 11}, { 0xC833, 16},
- { 0x0660, 11}, { 0x7934, 15}, { 0x024B, 11}, { 0xC832, 16}, { 0x0AA7, 12}, { 0x1F18, 13},
- { 0x007A, 7}
- },
- {
- { 0x0002, 2}, { 0x0000, 3}, { 0x001E, 5}, { 0x0004, 5}, { 0x0012, 6}, { 0x0070, 7},
- { 0x001A, 7}, { 0x005F, 8}, { 0x0047, 8}, { 0x01D3, 9}, { 0x00B5, 9}, { 0x0057, 9},
- { 0x03B5, 10}, { 0x016D, 10}, { 0x0162, 10}, { 0x07CE, 11}, { 0x0719, 11}, { 0x0691, 11},
- { 0x02C6, 11}, { 0x0156, 11}, { 0x0F92, 12}, { 0x0D2E, 12}, { 0x0D20, 12}, { 0x059E, 12},
- { 0x0468, 12}, { 0x02A6, 12}, { 0x1DA2, 13}, { 0x1C60, 13}, { 0x1A43, 13}, { 0x0B1D, 13},
- { 0x08C0, 13}, { 0x055D, 13}, { 0x0003, 3}, { 0x000A, 5}, { 0x0077, 7}, { 0x00E5, 8},
- { 0x01D9, 9}, { 0x03E5, 10}, { 0x0166, 10}, { 0x0694, 11}, { 0x0152, 11}, { 0x059F, 12},
- { 0x1F3C, 13}, { 0x1A4B, 13}, { 0x055E, 13}, { 0x000C, 4}, { 0x007D, 7}, { 0x0044, 8},
- { 0x03E0, 10}, { 0x0769, 11}, { 0x0E31, 12}, { 0x1F26, 13}, { 0x055C, 13}, { 0x001B, 5},
- { 0x00E2, 8}, { 0x03A5, 10}, { 0x02C9, 11}, { 0x1F23, 13}, { 0x3B47, 14}, { 0x0007, 5},
- { 0x01D8, 9}, { 0x02D8, 11}, { 0x1F27, 13}, { 0x3494, 14}, { 0x0035, 6}, { 0x03E1, 10},
- { 0x059C, 12}, { 0x38C3, 14}, { 0x000C, 6}, { 0x0165, 10}, { 0x1D23, 13}, { 0x1638, 14},
- { 0x0068, 7}, { 0x0693, 11}, { 0x3A45, 14}, { 0x0020, 7}, { 0x0F90, 12}, { 0x7CF6, 15},
- { 0x00E8, 8}, { 0x058F, 12}, { 0x2CEF, 15}, { 0x0045, 8}, { 0x0B3A, 13}, { 0x01F1, 9},
- { 0x3B46, 14}, { 0x01A7, 9}, { 0x1676, 14}, { 0x0056, 9}, { 0x692A, 15}, { 0x038D, 10},
- { 0xE309, 16}, { 0x00AA, 10}, { 0x1C611, 17}, { 0x02DF, 11}, { 0xB3B9, 17}, { 0x02C8, 11},
- { 0x38C20, 18}, { 0x01B0, 11}, { 0x16390, 18}, { 0x0F9F, 12}, { 0x16771, 18}, { 0x0ED0, 12},
- { 0x71843, 19}, { 0x0D2A, 12}, { 0xF9E8C, 20}, { 0x0461, 12}, { 0xF9E8E, 20}, { 0x0B67, 13},
- { 0x055F, 13}, { 0x003F, 6}, { 0x006D, 9}, { 0x0E90, 12}, { 0x054E, 13}, { 0x0013, 6},
- { 0x0119, 10}, { 0x0B66, 13}, { 0x000B, 6}, { 0x0235, 11}, { 0x7CF5, 15}, { 0x0075, 7},
- { 0x0D24, 12}, { 0xF9E9, 16}, { 0x002E, 7}, { 0x1F22, 13}, { 0x0021, 7}, { 0x054F, 13},
- { 0x0014, 7}, { 0x3A44, 14}, { 0x00E4, 8}, { 0x7CF7, 15}, { 0x005E, 8}, { 0x7185, 15},
- { 0x0037, 8}, { 0x2C73, 15}, { 0x01DB, 9}, { 0x59DD, 16}, { 0x01C7, 9}, { 0x692B, 15},
- { 0x01A6, 9}, { 0x58E5, 16}, { 0x00B4, 9}, { 0x1F3D0, 17}, { 0x00B0, 9}, { 0xB1C9, 17},
- { 0x03E6, 10}, { 0x16770, 18}, { 0x016E, 10}, { 0x3E7A2, 18}, { 0x011B, 10}, { 0xF9E8D, 20},
- { 0x00D9, 10}, { 0xF9E8F, 20}, { 0x00A8, 10}, { 0x2C723, 19}, { 0x0749, 11}, { 0xE3084, 20},
- { 0x0696, 11}, { 0x58E45, 20}, { 0x02DE, 11}, { 0xB1C88, 21}, { 0x0231, 11}, { 0x1C610A, 21},
- { 0x01B1, 11}, { 0x71842D, 23}, { 0x0D2B, 12}, { 0x38C217, 22}, { 0x0D2F, 12}, { 0x163913, 22},
- { 0x05B2, 12}, { 0x163912, 22}, { 0x0469, 12}, { 0x71842C, 23}, { 0x1A42, 13}, { 0x08C1, 13},
- { 0x0073, 7}
- }
+static const uint32_t vc1_ac_tables[AC_MODES][186][2] = {
+{
+{ 0x0001, 2}, { 0x0005, 3}, { 0x000D, 4}, { 0x0012, 5}, { 0x000E, 6}, { 0x0015, 7},
+{ 0x0013, 8}, { 0x003F, 8}, { 0x004B, 9}, { 0x011F, 9}, { 0x00B8, 10}, { 0x03E3, 10},
+{ 0x0172, 11}, { 0x024D, 12}, { 0x03DA, 12}, { 0x02DD, 13}, { 0x1F55, 13}, { 0x05B9, 14},
+{ 0x3EAE, 14}, { 0x0000, 4}, { 0x0010, 5}, { 0x0008, 7}, { 0x0020, 8}, { 0x0029, 9},
+{ 0x01F4, 9}, { 0x0233, 10}, { 0x01E0, 11}, { 0x012A, 12}, { 0x03DD, 12}, { 0x050A, 13},
+{ 0x1F29, 13}, { 0x0A42, 14}, { 0x1272, 15}, { 0x1737, 15}, { 0x0003, 5}, { 0x0011, 7},
+{ 0x00C4, 8}, { 0x004B, 10}, { 0x00B4, 11}, { 0x07D4, 11}, { 0x0345, 12}, { 0x02D7, 13},
+{ 0x07BF, 13}, { 0x0938, 14}, { 0x0BBB, 14}, { 0x095E, 15}, { 0x0013, 5}, { 0x0078, 7},
+{ 0x0069, 9}, { 0x0232, 10}, { 0x0461, 11}, { 0x03EC, 12}, { 0x0520, 13}, { 0x1F2A, 13},
+{ 0x3E50, 14}, { 0x3E51, 14}, { 0x1486, 15}, { 0x000C, 6}, { 0x0024, 9}, { 0x0094, 11},
+{ 0x08C0, 12}, { 0x0F09, 14}, { 0x1EF0, 15}, { 0x003D, 6}, { 0x0053, 9}, { 0x01A0, 11},
+{ 0x02D6, 13}, { 0x0F08, 14}, { 0x0013, 7}, { 0x007C, 9}, { 0x07C1, 11}, { 0x04AC, 14},
+{ 0x001B, 7}, { 0x00A0, 10}, { 0x0344, 12}, { 0x0F79, 14}, { 0x0079, 7}, { 0x03E1, 10},
+{ 0x02D4, 13}, { 0x2306, 14}, { 0x0021, 8}, { 0x023C, 10}, { 0x0FAE, 12}, { 0x23DE, 14},
+{ 0x0035, 8}, { 0x0175, 11}, { 0x07B3, 13}, { 0x00C5, 8}, { 0x0174, 11}, { 0x0785, 13},
+{ 0x0048, 9}, { 0x01A3, 11}, { 0x049E, 13}, { 0x002C, 9}, { 0x00FA, 10}, { 0x07D6, 11},
+{ 0x0092, 10}, { 0x05CC, 13}, { 0x1EF1, 15}, { 0x00A3, 10}, { 0x03ED, 12}, { 0x093E, 14},
+{ 0x01E2, 11}, { 0x1273, 15}, { 0x07C4, 11}, { 0x1487, 15}, { 0x0291, 12}, { 0x0293, 12},
+{ 0x0F8A, 12}, { 0x0509, 13}, { 0x0508, 13}, { 0x078D, 13}, { 0x07BE, 13}, { 0x078C, 13},
+{ 0x04AE, 14}, { 0x0BBA, 14}, { 0x2307, 14}, { 0x0B9A, 14}, { 0x1736, 15}, { 0x000E, 4},
+{ 0x0045, 7}, { 0x01F3, 9}, { 0x047A, 11}, { 0x05DC, 13}, { 0x23DF, 14}, { 0x0019, 5},
+{ 0x0028, 9}, { 0x0176, 11}, { 0x049D, 13}, { 0x23DD, 14}, { 0x0030, 6}, { 0x00A2, 10},
+{ 0x02EF, 12}, { 0x05B8, 14}, { 0x003F, 6}, { 0x00A5, 10}, { 0x03DB, 12}, { 0x093F, 14},
+{ 0x0044, 7}, { 0x07CB, 11}, { 0x095F, 15}, { 0x0063, 7}, { 0x03C3, 12}, { 0x0015, 8},
+{ 0x08F6, 12}, { 0x0017, 8}, { 0x0498, 13}, { 0x002C, 8}, { 0x07B2, 13}, { 0x002F, 8},
+{ 0x1F54, 13}, { 0x008D, 8}, { 0x07BD, 13}, { 0x008E, 8}, { 0x1182, 13}, { 0x00FB, 8},
+{ 0x050B, 13}, { 0x002D, 8}, { 0x07C0, 11}, { 0x0079, 9}, { 0x1F5F, 13}, { 0x007A, 9},
+{ 0x1F56, 13}, { 0x0231, 10}, { 0x03E4, 10}, { 0x01A1, 11}, { 0x0143, 11}, { 0x01F7, 11},
+{ 0x016F, 12}, { 0x0292, 12}, { 0x02E7, 12}, { 0x016C, 12}, { 0x016D, 12}, { 0x03DC, 12},
+{ 0x0F8B, 12}, { 0x0499, 13}, { 0x03D8, 12}, { 0x078E, 13}, { 0x02D5, 13}, { 0x1F5E, 13},
+{ 0x1F2B, 13}, { 0x078F, 13}, { 0x04AD, 14}, { 0x3EAF, 14}, { 0x23DC, 14}, { 0x004A, 9}
+},
+{
+{ 0x0000, 3}, { 0x0003, 4}, { 0x000B, 5}, { 0x0014, 6}, { 0x003F, 6}, { 0x005D, 7},
+{ 0x00A2, 8}, { 0x00AC, 9}, { 0x016E, 9}, { 0x020A, 10}, { 0x02E2, 10}, { 0x0432, 11},
+{ 0x05C9, 11}, { 0x0827, 12}, { 0x0B54, 12}, { 0x04E6, 13}, { 0x105F, 13}, { 0x172A, 13},
+{ 0x20B2, 14}, { 0x2D4E, 14}, { 0x39F0, 14}, { 0x4175, 15}, { 0x5A9E, 15}, { 0x0004, 4},
+{ 0x001E, 5}, { 0x0042, 7}, { 0x00B6, 8}, { 0x0173, 9}, { 0x0395, 10}, { 0x072E, 11},
+{ 0x0B94, 12}, { 0x16A4, 13}, { 0x20B3, 14}, { 0x2E45, 14}, { 0x0005, 5}, { 0x0040, 7},
+{ 0x0049, 9}, { 0x028F, 10}, { 0x05CB, 11}, { 0x048A, 13}, { 0x09DD, 14}, { 0x73E2, 15},
+{ 0x0018, 5}, { 0x0025, 8}, { 0x008A, 10}, { 0x051B, 11}, { 0x0E5F, 12}, { 0x09C9, 14},
+{ 0x139C, 15}, { 0x0029, 6}, { 0x004F, 9}, { 0x0412, 11}, { 0x048D, 13}, { 0x2E41, 14},
+{ 0x0038, 6}, { 0x010E, 9}, { 0x05A8, 11}, { 0x105C, 13}, { 0x39F2, 14}, { 0x0058, 7},
+{ 0x021F, 10}, { 0x0E7E, 12}, { 0x39FF, 14}, { 0x0023, 8}, { 0x02E3, 10}, { 0x04E5, 13},
+{ 0x2E40, 14}, { 0x00A1, 8}, { 0x05BE, 11}, { 0x09C8, 14}, { 0x0083, 8}, { 0x013A, 11},
+{ 0x1721, 13}, { 0x0044, 9}, { 0x0276, 12}, { 0x39F6, 14}, { 0x008B, 10}, { 0x04EF, 13},
+{ 0x5A9B, 15}, { 0x0208, 10}, { 0x1CFE, 13}, { 0x0399, 10}, { 0x1CB4, 13}, { 0x039E, 10},
+{ 0x39F3, 14}, { 0x05AB, 11}, { 0x73E3, 15}, { 0x0737, 11}, { 0x5A9F, 15}, { 0x082D, 12},
+{ 0x0E69, 12}, { 0x0E68, 12}, { 0x0433, 11}, { 0x0B7B, 12}, { 0x2DF8, 14}, { 0x2E56, 14},
+{ 0x2E57, 14}, { 0x39F7, 14}, { 0x51A5, 15}, { 0x0003, 3}, { 0x002A, 6}, { 0x00E4, 8},
+{ 0x028E, 10}, { 0x0735, 11}, { 0x1058, 13}, { 0x1CFA, 13}, { 0x2DF9, 14}, { 0x4174, 15},
+{ 0x0009, 4}, { 0x0054, 8}, { 0x0398, 10}, { 0x048B, 13}, { 0x139D, 15}, { 0x000D, 4},
+{ 0x00AD, 9}, { 0x0826, 12}, { 0x2D4C, 14}, { 0x0011, 5}, { 0x016B, 9}, { 0x0B7F, 12},
+{ 0x51A4, 15}, { 0x0019, 5}, { 0x021B, 10}, { 0x16FD, 13}, { 0x001D, 5}, { 0x0394, 10},
+{ 0x28D3, 14}, { 0x002B, 6}, { 0x05BC, 11}, { 0x5A9A, 15}, { 0x002F, 6}, { 0x0247, 12},
+{ 0x0010, 7}, { 0x0A35, 12}, { 0x003E, 6}, { 0x0B7A, 12}, { 0x0059, 7}, { 0x105E, 13},
+{ 0x0026, 8}, { 0x09CF, 14}, { 0x0055, 8}, { 0x1CB5, 13}, { 0x0057, 8}, { 0x0E5B, 12},
+{ 0x00A0, 8}, { 0x1468, 13}, { 0x0170, 9}, { 0x0090, 10}, { 0x01CE, 9}, { 0x021A, 10},
+{ 0x0218, 10}, { 0x0168, 9}, { 0x021E, 10}, { 0x0244, 12}, { 0x0736, 11}, { 0x0138, 11},
+{ 0x0519, 11}, { 0x0E5E, 12}, { 0x072C, 11}, { 0x0B55, 12}, { 0x09DC, 14}, { 0x20BB, 14},
+{ 0x048C, 13}, { 0x1723, 13}, { 0x2E44, 14}, { 0x16A5, 13}, { 0x0518, 11}, { 0x39FE, 14},
+{ 0x0169, 9}
+},
+{
+{ 0x0001, 2}, { 0x0006, 3}, { 0x000F, 4}, { 0x0016, 5}, { 0x0020, 6}, { 0x0018, 7},
+{ 0x0008, 8}, { 0x009A, 8}, { 0x0056, 9}, { 0x013E, 9}, { 0x00F0, 10}, { 0x03A5, 10},
+{ 0x0077, 11}, { 0x01EF, 11}, { 0x009A, 12}, { 0x005D, 13}, { 0x0001, 4}, { 0x0011, 5},
+{ 0x0002, 7}, { 0x000B, 8}, { 0x0012, 9}, { 0x01D6, 9}, { 0x027E, 10}, { 0x0191, 11},
+{ 0x00EA, 12}, { 0x03DC, 12}, { 0x013B, 13}, { 0x0004, 5}, { 0x0014, 7}, { 0x009E, 8},
+{ 0x0009, 10}, { 0x01AC, 11}, { 0x01E2, 11}, { 0x03CA, 12}, { 0x005F, 13}, { 0x0017, 5},
+{ 0x004E, 7}, { 0x005E, 9}, { 0x00F3, 10}, { 0x01AD, 11}, { 0x00EC, 12}, { 0x05F0, 13},
+{ 0x000E, 6}, { 0x00E1, 8}, { 0x03A4, 10}, { 0x009C, 12}, { 0x013D, 13}, { 0x003B, 6},
+{ 0x001C, 9}, { 0x0014, 11}, { 0x09BE, 12}, { 0x0006, 7}, { 0x007A, 9}, { 0x0190, 11},
+{ 0x0137, 13}, { 0x001B, 7}, { 0x0008, 10}, { 0x075C, 11}, { 0x0071, 7}, { 0x00D7, 10},
+{ 0x09BF, 12}, { 0x0007, 8}, { 0x00AF, 10}, { 0x04CC, 11}, { 0x0034, 8}, { 0x0265, 10},
+{ 0x009F, 12}, { 0x00E0, 8}, { 0x0016, 11}, { 0x0327, 12}, { 0x0015, 9}, { 0x017D, 11},
+{ 0x0EBB, 12}, { 0x0014, 9}, { 0x00F6, 10}, { 0x01E4, 11}, { 0x00CB, 10}, { 0x099D, 12},
+{ 0x00CA, 10}, { 0x02FC, 12}, { 0x017F, 11}, { 0x04CD, 11}, { 0x02FD, 12}, { 0x04FE, 11},
+{ 0x013A, 13}, { 0x000A, 4}, { 0x0042, 7}, { 0x01D3, 9}, { 0x04DD, 11}, { 0x0012, 5},
+{ 0x00E8, 8}, { 0x004C, 11}, { 0x0136, 13}, { 0x0039, 6}, { 0x0264, 10}, { 0x0EBA, 12},
+{ 0x0000, 7}, { 0x00AE, 10}, { 0x099C, 12}, { 0x001F, 7}, { 0x04DE, 11}, { 0x0043, 7},
+{ 0x04DC, 11}, { 0x0003, 8}, { 0x03CB, 12}, { 0x0006, 8}, { 0x099E, 12}, { 0x002A, 8},
+{ 0x05F1, 13}, { 0x000F, 8}, { 0x09FE, 12}, { 0x0033, 8}, { 0x09FF, 12}, { 0x0098, 8},
+{ 0x099F, 12}, { 0x00EA, 8}, { 0x013C, 13}, { 0x002E, 8}, { 0x0192, 11}, { 0x0136, 9},
+{ 0x006A, 9}, { 0x0015, 11}, { 0x03AF, 10}, { 0x01E3, 11}, { 0x0074, 11}, { 0x00EB, 12},
+{ 0x02F9, 12}, { 0x005C, 13}, { 0x00ED, 12}, { 0x03DD, 12}, { 0x0326, 12}, { 0x005E, 13},
+{ 0x0016, 7}
+},
+{
+{ 0x0004, 3}, { 0x0014, 5}, { 0x0017, 7}, { 0x007F, 8}, { 0x0154, 9}, { 0x01F2, 10},
+{ 0x00BF, 11}, { 0x0065, 12}, { 0x0AAA, 12}, { 0x0630, 13}, { 0x1597, 13}, { 0x03B7, 14},
+{ 0x2B22, 14}, { 0x0BE6, 15}, { 0x000B, 4}, { 0x0037, 7}, { 0x0062, 9}, { 0x0007, 11},
+{ 0x0166, 12}, { 0x00CE, 13}, { 0x1590, 13}, { 0x05F6, 14}, { 0x0BE7, 15}, { 0x0007, 5},
+{ 0x006D, 8}, { 0x0003, 11}, { 0x031F, 12}, { 0x05F2, 14}, { 0x0002, 6}, { 0x0061, 9},
+{ 0x0055, 12}, { 0x01DF, 14}, { 0x001A, 6}, { 0x001E, 10}, { 0x0AC9, 12}, { 0x2B23, 14},
+{ 0x001E, 6}, { 0x001F, 10}, { 0x0AC3, 12}, { 0x2B2B, 14}, { 0x0006, 7}, { 0x0004, 11},
+{ 0x02F8, 13}, { 0x0019, 7}, { 0x0006, 11}, { 0x063D, 13}, { 0x0057, 7}, { 0x0182, 11},
+{ 0x2AA2, 14}, { 0x0004, 8}, { 0x0180, 11}, { 0x059C, 14}, { 0x007D, 8}, { 0x0164, 12},
+{ 0x076D, 15}, { 0x0002, 9}, { 0x018D, 11}, { 0x1581, 13}, { 0x00AD, 8}, { 0x0060, 12},
+{ 0x0C67, 14}, { 0x001C, 9}, { 0x00EE, 13}, { 0x0003, 9}, { 0x02CF, 13}, { 0x00D9, 9},
+{ 0x1580, 13}, { 0x0002, 11}, { 0x0183, 11}, { 0x0057, 12}, { 0x0061, 12}, { 0x0031, 11},
+{ 0x0066, 12}, { 0x0631, 13}, { 0x0632, 13}, { 0x00AC, 13}, { 0x031D, 12}, { 0x0076, 12},
+{ 0x003A, 11}, { 0x0165, 12}, { 0x0C66, 14}, { 0x0003, 2}, { 0x0054, 7}, { 0x02AB, 10},
+{ 0x0016, 13}, { 0x05F7, 14}, { 0x0005, 4}, { 0x00F8, 9}, { 0x0AA9, 12}, { 0x005F, 15},
+{ 0x0004, 4}, { 0x001C, 10}, { 0x1550, 13}, { 0x0004, 5}, { 0x0077, 11}, { 0x076C, 15},
+{ 0x000E, 5}, { 0x000A, 12}, { 0x000C, 5}, { 0x0562, 11}, { 0x0004, 6}, { 0x031C, 12},
+{ 0x0006, 6}, { 0x00C8, 13}, { 0x000D, 6}, { 0x01DA, 13}, { 0x0007, 6}, { 0x00C9, 13},
+{ 0x0001, 7}, { 0x002E, 14}, { 0x0014, 7}, { 0x1596, 13}, { 0x000A, 7}, { 0x0AC2, 12},
+{ 0x0016, 7}, { 0x015B, 14}, { 0x0015, 7}, { 0x015A, 14}, { 0x000F, 8}, { 0x005E, 15},
+{ 0x007E, 8}, { 0x00AB, 8}, { 0x002D, 9}, { 0x00D8, 9}, { 0x000B, 9}, { 0x0014, 10},
+{ 0x02B3, 10}, { 0x01F3, 10}, { 0x003A, 10}, { 0x0000, 10}, { 0x0058, 10}, { 0x002E, 9},
+{ 0x005E, 10}, { 0x0563, 11}, { 0x00EC, 12}, { 0x0054, 12}, { 0x0AC1, 12}, { 0x1556, 13},
+{ 0x02FA, 13}, { 0x0181, 11}, { 0x1557, 13}, { 0x059D, 14}, { 0x2AA3, 14}, { 0x2B2A, 14},
+{ 0x01DE, 14}, { 0x063C, 13}, { 0x00CF, 13}, { 0x1594, 13}, { 0x000D, 9}
+},
+{
+{ 0x0002, 2}, { 0x0006, 3}, { 0x000F, 4}, { 0x000D, 5}, { 0x000C, 5}, { 0x0015, 6},
+{ 0x0013, 6}, { 0x0012, 6}, { 0x0017, 7}, { 0x001F, 8}, { 0x001E, 8}, { 0x001D, 8},
+{ 0x0025, 9}, { 0x0024, 9}, { 0x0023, 9}, { 0x0021, 9}, { 0x0021, 10}, { 0x0020, 10},
+{ 0x000F, 10}, { 0x000E, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11}, { 0x0021, 11},
+{ 0x0050, 12}, { 0x0051, 12}, { 0x0052, 12}, { 0x000E, 4}, { 0x0014, 6}, { 0x0016, 7},
+{ 0x001C, 8}, { 0x0020, 9}, { 0x001F, 9}, { 0x000D, 10}, { 0x0022, 11}, { 0x0053, 12},
+{ 0x0055, 12}, { 0x000B, 5}, { 0x0015, 7}, { 0x001E, 9}, { 0x000C, 10}, { 0x0056, 12},
+{ 0x0011, 6}, { 0x001B, 8}, { 0x001D, 9}, { 0x000B, 10}, { 0x0010, 6}, { 0x0022, 9},
+{ 0x000A, 10}, { 0x000D, 6}, { 0x001C, 9}, { 0x0008, 10}, { 0x0012, 7}, { 0x001B, 9},
+{ 0x0054, 12}, { 0x0014, 7}, { 0x001A, 9}, { 0x0057, 12}, { 0x0019, 8}, { 0x0009, 10},
+{ 0x0018, 8}, { 0x0023, 11}, { 0x0017, 8}, { 0x0019, 9}, { 0x0018, 9}, { 0x0007, 10},
+{ 0x0058, 12}, { 0x0007, 4}, { 0x000C, 6}, { 0x0016, 8}, { 0x0017, 9}, { 0x0006, 10},
+{ 0x0005, 11}, { 0x0004, 11}, { 0x0059, 12}, { 0x000F, 6}, { 0x0016, 9}, { 0x0005, 10},
+{ 0x000E, 6}, { 0x0004, 10}, { 0x0011, 7}, { 0x0024, 11}, { 0x0010, 7}, { 0x0025, 11},
+{ 0x0013, 7}, { 0x005A, 12}, { 0x0015, 8}, { 0x005B, 12}, { 0x0014, 8}, { 0x0013, 8},
+{ 0x001A, 8}, { 0x0015, 9}, { 0x0014, 9}, { 0x0013, 9}, { 0x0012, 9}, { 0x0011, 9},
+{ 0x0026, 11}, { 0x0027, 11}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12},
+{ 0x0003, 7}
+},
+{
+{ 0x0002, 2}, { 0x000F, 4}, { 0x0015, 6}, { 0x0017, 7}, { 0x001F, 8}, { 0x0025, 9},
+{ 0x0024, 9}, { 0x0021, 10}, { 0x0020, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11},
+{ 0x0006, 3}, { 0x0014, 6}, { 0x001E, 8}, { 0x000F, 10}, { 0x0021, 11}, { 0x0050, 12},
+{ 0x000E, 4}, { 0x001D, 8}, { 0x000E, 10}, { 0x0051, 12}, { 0x000D, 5}, { 0x0023, 9},
+{ 0x000D, 10}, { 0x000C, 5}, { 0x0022, 9}, { 0x0052, 12}, { 0x000B, 5}, { 0x000C, 10},
+{ 0x0053, 12}, { 0x0013, 6}, { 0x000B, 10}, { 0x0054, 12}, { 0x0012, 6}, { 0x000A, 10},
+{ 0x0011, 6}, { 0x0009, 10}, { 0x0010, 6}, { 0x0008, 10}, { 0x0016, 7}, { 0x0055, 12},
+{ 0x0015, 7}, { 0x0014, 7}, { 0x001C, 8}, { 0x001B, 8}, { 0x0021, 9}, { 0x0020, 9},
+{ 0x001F, 9}, { 0x001E, 9}, { 0x001D, 9}, { 0x001C, 9}, { 0x001B, 9}, { 0x001A, 9},
+{ 0x0022, 11}, { 0x0023, 11}, { 0x0056, 12}, { 0x0057, 12}, { 0x0007, 4}, { 0x0019, 9},
+{ 0x0005, 11}, { 0x000F, 6}, { 0x0004, 11}, { 0x000E, 6}, { 0x000D, 6}, { 0x000C, 6},
+{ 0x0013, 7}, { 0x0012, 7}, { 0x0011, 7}, { 0x0010, 7}, { 0x001A, 8}, { 0x0019, 8},
+{ 0x0018, 8}, { 0x0017, 8}, { 0x0016, 8}, { 0x0015, 8}, { 0x0014, 8}, { 0x0013, 8},
+{ 0x0018, 9}, { 0x0017, 9}, { 0x0016, 9}, { 0x0015, 9}, { 0x0014, 9}, { 0x0013, 9},
+{ 0x0012, 9}, { 0x0011, 9}, { 0x0007, 10}, { 0x0006, 10}, { 0x0005, 10}, { 0x0004, 10},
+{ 0x0024, 11}, { 0x0025, 11}, { 0x0026, 11}, { 0x0027, 11}, { 0x0058, 12}, { 0x0059, 12},
+{ 0x005A, 12}, { 0x005B, 12}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12},
+{ 0x0003, 7}
+},
+{
+{ 0x0000, 2}, { 0x0003, 3}, { 0x000D, 4}, { 0x0005, 4}, { 0x001C, 5}, { 0x0016, 5},
+{ 0x003F, 6}, { 0x003A, 6}, { 0x002E, 6}, { 0x0022, 6}, { 0x007B, 7}, { 0x0067, 7},
+{ 0x005F, 7}, { 0x0047, 7}, { 0x0026, 7}, { 0x00EF, 8}, { 0x00CD, 8}, { 0x00C1, 8},
+{ 0x00A9, 8}, { 0x004F, 8}, { 0x01F2, 9}, { 0x01DD, 9}, { 0x0199, 9}, { 0x0185, 9},
+{ 0x015D, 9}, { 0x011B, 9}, { 0x03EF, 10}, { 0x03E1, 10}, { 0x03C8, 10}, { 0x0331, 10},
+{ 0x0303, 10}, { 0x02F1, 10}, { 0x02A0, 10}, { 0x0233, 10}, { 0x0126, 10}, { 0x07C0, 11},
+{ 0x076F, 11}, { 0x076C, 11}, { 0x0661, 11}, { 0x0604, 11}, { 0x0572, 11}, { 0x0551, 11},
+{ 0x046A, 11}, { 0x0274, 11}, { 0x0F27, 12}, { 0x0F24, 12}, { 0x0EDB, 12}, { 0x0C8E, 12},
+{ 0x0C0B, 12}, { 0x0C0A, 12}, { 0x0AE3, 12}, { 0x08D6, 12}, { 0x0490, 12}, { 0x0495, 12},
+{ 0x1F19, 13}, { 0x1DB5, 13}, { 0x0009, 4}, { 0x0010, 5}, { 0x0029, 6}, { 0x0062, 7},
+{ 0x00F3, 8}, { 0x00AD, 8}, { 0x01E5, 9}, { 0x0179, 9}, { 0x009C, 9}, { 0x03B1, 10},
+{ 0x02AE, 10}, { 0x0127, 10}, { 0x076E, 11}, { 0x0570, 11}, { 0x0275, 11}, { 0x0F25, 12},
+{ 0x0EC0, 12}, { 0x0AA0, 12}, { 0x08D7, 12}, { 0x1E4C, 13}, { 0x0008, 5}, { 0x0063, 7},
+{ 0x00AF, 8}, { 0x017B, 9}, { 0x03B3, 10}, { 0x07DD, 11}, { 0x0640, 11}, { 0x0F8D, 12},
+{ 0x0BC1, 12}, { 0x0491, 12}, { 0x0028, 6}, { 0x00C3, 8}, { 0x0151, 9}, { 0x02A1, 10},
+{ 0x0573, 11}, { 0x0EC3, 12}, { 0x1F35, 13}, { 0x0065, 7}, { 0x01DA, 9}, { 0x02AF, 10},
+{ 0x0277, 11}, { 0x08C9, 12}, { 0x1781, 13}, { 0x0025, 7}, { 0x0118, 9}, { 0x0646, 11},
+{ 0x0AA6, 12}, { 0x1780, 13}, { 0x00C9, 8}, { 0x0321, 10}, { 0x0F9B, 12}, { 0x191E, 13},
+{ 0x0048, 8}, { 0x07CC, 11}, { 0x0AA1, 12}, { 0x0180, 9}, { 0x0465, 11}, { 0x1905, 13},
+{ 0x03E2, 10}, { 0x0EC1, 12}, { 0x3C9B, 14}, { 0x02F4, 10}, { 0x08C8, 12}, { 0x07C1, 11},
+{ 0x0928, 13}, { 0x05E1, 11}, { 0x320D, 14}, { 0x0EC2, 12}, { 0x6418, 15}, { 0x1F34, 13},
+{ 0x0078, 7}, { 0x0155, 9}, { 0x0552, 11}, { 0x191F, 13}, { 0x00FA, 8}, { 0x07DC, 11},
+{ 0x1907, 13}, { 0x00AC, 8}, { 0x0249, 11}, { 0x13B1, 14}, { 0x01F6, 9}, { 0x0AE2, 12},
+{ 0x01DC, 9}, { 0x04ED, 12}, { 0x0184, 9}, { 0x1904, 13}, { 0x0156, 9}, { 0x09D9, 13},
+{ 0x03E7, 10}, { 0x0929, 13}, { 0x03B2, 10}, { 0x3B68, 14}, { 0x02F5, 10}, { 0x13B0, 14},
+{ 0x0322, 10}, { 0x3B69, 14}, { 0x0234, 10}, { 0x7935, 15}, { 0x07C7, 11}, { 0xC833, 16},
+{ 0x0660, 11}, { 0x7934, 15}, { 0x024B, 11}, { 0xC832, 16}, { 0x0AA7, 12}, { 0x1F18, 13},
+{ 0x007A, 7}
+},
+{
+{ 0x0002, 2}, { 0x0000, 3}, { 0x001E, 5}, { 0x0004, 5}, { 0x0012, 6}, { 0x0070, 7},
+{ 0x001A, 7}, { 0x005F, 8}, { 0x0047, 8}, { 0x01D3, 9}, { 0x00B5, 9}, { 0x0057, 9},
+{ 0x03B5, 10}, { 0x016D, 10}, { 0x0162, 10}, { 0x07CE, 11}, { 0x0719, 11}, { 0x0691, 11},
+{ 0x02C6, 11}, { 0x0156, 11}, { 0x0F92, 12}, { 0x0D2E, 12}, { 0x0D20, 12}, { 0x059E, 12},
+{ 0x0468, 12}, { 0x02A6, 12}, { 0x1DA2, 13}, { 0x1C60, 13}, { 0x1A43, 13}, { 0x0B1D, 13},
+{ 0x08C0, 13}, { 0x055D, 13}, { 0x0003, 3}, { 0x000A, 5}, { 0x0077, 7}, { 0x00E5, 8},
+{ 0x01D9, 9}, { 0x03E5, 10}, { 0x0166, 10}, { 0x0694, 11}, { 0x0152, 11}, { 0x059F, 12},
+{ 0x1F3C, 13}, { 0x1A4B, 13}, { 0x055E, 13}, { 0x000C, 4}, { 0x007D, 7}, { 0x0044, 8},
+{ 0x03E0, 10}, { 0x0769, 11}, { 0x0E31, 12}, { 0x1F26, 13}, { 0x055C, 13}, { 0x001B, 5},
+{ 0x00E2, 8}, { 0x03A5, 10}, { 0x02C9, 11}, { 0x1F23, 13}, { 0x3B47, 14}, { 0x0007, 5},
+{ 0x01D8, 9}, { 0x02D8, 11}, { 0x1F27, 13}, { 0x3494, 14}, { 0x0035, 6}, { 0x03E1, 10},
+{ 0x059C, 12}, { 0x38C3, 14}, { 0x000C, 6}, { 0x0165, 10}, { 0x1D23, 13}, { 0x1638, 14},
+{ 0x0068, 7}, { 0x0693, 11}, { 0x3A45, 14}, { 0x0020, 7}, { 0x0F90, 12}, { 0x7CF6, 15},
+{ 0x00E8, 8}, { 0x058F, 12}, { 0x2CEF, 15}, { 0x0045, 8}, { 0x0B3A, 13}, { 0x01F1, 9},
+{ 0x3B46, 14}, { 0x01A7, 9}, { 0x1676, 14}, { 0x0056, 9}, { 0x692A, 15}, { 0x038D, 10},
+{ 0xE309, 16}, { 0x00AA, 10}, { 0x1C611, 17}, { 0x02DF, 11}, { 0xB3B9, 17}, { 0x02C8, 11},
+{ 0x38C20, 18}, { 0x01B0, 11}, { 0x16390, 18}, { 0x0F9F, 12}, { 0x16771, 18}, { 0x0ED0, 12},
+{ 0x71843, 19}, { 0x0D2A, 12}, { 0xF9E8C, 20}, { 0x0461, 12}, { 0xF9E8E, 20}, { 0x0B67, 13},
+{ 0x055F, 13}, { 0x003F, 6}, { 0x006D, 9}, { 0x0E90, 12}, { 0x054E, 13}, { 0x0013, 6},
+{ 0x0119, 10}, { 0x0B66, 13}, { 0x000B, 6}, { 0x0235, 11}, { 0x7CF5, 15}, { 0x0075, 7},
+{ 0x0D24, 12}, { 0xF9E9, 16}, { 0x002E, 7}, { 0x1F22, 13}, { 0x0021, 7}, { 0x054F, 13},
+{ 0x0014, 7}, { 0x3A44, 14}, { 0x00E4, 8}, { 0x7CF7, 15}, { 0x005E, 8}, { 0x7185, 15},
+{ 0x0037, 8}, { 0x2C73, 15}, { 0x01DB, 9}, { 0x59DD, 16}, { 0x01C7, 9}, { 0x692B, 15},
+{ 0x01A6, 9}, { 0x58E5, 16}, { 0x00B4, 9}, { 0x1F3D0, 17}, { 0x00B0, 9}, { 0xB1C9, 17},
+{ 0x03E6, 10}, { 0x16770, 18}, { 0x016E, 10}, { 0x3E7A2, 18}, { 0x011B, 10}, { 0xF9E8D, 20},
+{ 0x00D9, 10}, { 0xF9E8F, 20}, { 0x00A8, 10}, { 0x2C723, 19}, { 0x0749, 11}, { 0xE3084, 20},
+{ 0x0696, 11}, { 0x58E45, 20}, { 0x02DE, 11}, { 0xB1C88, 21}, { 0x0231, 11}, { 0x1C610A, 21},
+{ 0x01B1, 11}, { 0x71842D, 23}, { 0x0D2B, 12}, { 0x38C217, 22}, { 0x0D2F, 12}, { 0x163913, 22},
+{ 0x05B2, 12}, { 0x163912, 22}, { 0x0469, 12}, { 0x71842C, 23}, { 0x1A42, 13}, { 0x08C1, 13},
+{ 0x0073, 7}
+}
};
/* which indexes point to last=1 entries in tables */
-static const int vc1_last_decode_table[AC_MODES] =
-{
+static const int vc1_last_decode_table[AC_MODES] = {
119, 99, 85, 81, 67, 58, 126, 109
};
-static const uint8_t vc1_index_decode_table[AC_MODES][185][2] =
-{
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
- { 0, 17}, { 0, 18}, { 0, 19}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5},
- { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13},
- { 1, 14}, { 1, 15}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6},
- { 2, 7}, { 2, 8}, { 2, 9}, { 2, 10}, { 2, 11}, { 2, 12}, { 3, 1}, { 3, 2},
- { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 3, 8}, { 3, 9}, { 3, 10},
- { 3, 11}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 4, 6}, { 5, 1},
- { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4},
- { 7, 1}, { 7, 2}, { 7, 3}, { 7, 4}, { 8, 1}, { 8, 2}, { 8, 3}, { 8, 4},
- { 9, 1}, { 9, 2}, { 9, 3}, { 9, 4}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1},
- { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 13, 3},
- { 14, 1}, { 14, 2}, { 14, 3}, { 15, 1}, { 15, 2}, { 15, 3}, { 16, 1}, { 16, 2},
- { 17, 1}, { 17, 2}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1},
- { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 0, 1},
- { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 1, 1}, { 1, 2}, { 1, 3},
- { 1, 4}, { 1, 5}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2},
- { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 6, 1},
- { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1},
- { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1},
- { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1},
- { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1},
- { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1},
- { 37, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
- { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 1, 1},
- { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9},
- { 1, 10}, { 1, 11}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6},
- { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6},
- { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1}, { 5, 2},
- { 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1},
- { 7, 2}, { 7, 3}, { 7, 4}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2},
- { 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1},
- { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1},
- { 16, 2}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1},
- { 24, 1}, { 25, 1}, { 26, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5},
- { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4},
- { 1, 5}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2}, { 3, 3},
- { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1},
- { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2},
- { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2},
- { 14, 1}, { 14, 2}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1},
- { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1},
- { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
- { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8},
- { 1, 9}, { 1, 10}, { 1, 11}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5},
- { 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5},
- { 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1},
- { 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1},
- { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3},
- { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2},
- { 12, 3}, { 13, 1}, { 13, 2}, { 13, 3}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2},
- { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 0, 1}, { 0, 2}, { 0, 3},
- { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 2, 1}, { 2, 2}, { 2, 3},
- { 3, 1}, { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1},
- { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1},
- { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1},
- { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1},
- { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 1, 1}, { 1, 2},
- { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 2, 1},
- { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4},
- { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4},
- { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2},
- { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1},
- { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 14, 1},
- { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1},
- { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1},
- { 29, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 1, 1}, { 1, 2},
- { 1, 3}, { 1, 4}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1}, { 3, 2}, { 3, 3},
- { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2},
- { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2},
- { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2},
- { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1},
- { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1},
- { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}, { 37, 1}, { 38, 1}, { 39, 1},
- { 40, 1}, { 41, 1}, { 42, 1}, { 43, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
- { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24},
- { 0, 25}, { 0, 26}, { 0, 27}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5},
- { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 2, 1}, { 2, 2}, { 2, 3},
- { 2, 4}, { 2, 5}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2},
- { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1},
- { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 11, 1},
- { 12, 1}, { 13, 1}, { 14, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5},
- { 0, 6}, { 0, 7}, { 0, 8}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2},
- { 3, 1}, { 3, 2}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2},
- { 7, 1}, { 8, 1}, { 9, 1}, { 10, 1}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1},
- { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4},
- { 1, 5}, { 1, 6}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2},
- { 3, 3}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1},
- { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2},
- { 10, 1}, { 10, 2}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1},
- { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1},
- { 25, 1}, { 26, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 1, 1}, { 1, 2}, { 2, 1},
- { 3, 1}, { 4, 1}, { 5, 1}, { 6, 1}, { 7, 1}, { 8, 1}, { 9, 1}, { 10, 1},
- { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1},
- { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1},
- { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1},
- { 35, 1}, { 36, 1}, { 37, 1}, { 38, 1}, { 39, 1}, { 40, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
- { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24},
- { 0, 25}, { 0, 26}, { 0, 27}, { 0, 28}, { 0, 29}, { 0, 30}, { 0, 31}, { 0, 32},
- { 0, 33}, { 0, 34}, { 0, 35}, { 0, 36}, { 0, 37}, { 0, 38}, { 0, 39}, { 0, 40},
- { 0, 41}, { 0, 42}, { 0, 43}, { 0, 44}, { 0, 45}, { 0, 46}, { 0, 47}, { 0, 48},
- { 0, 49}, { 0, 50}, { 0, 51}, { 0, 52}, { 0, 53}, { 0, 54}, { 0, 55}, { 0, 56},
- { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8},
- { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 1, 14}, { 1, 15}, { 1, 16},
- { 1, 17}, { 1, 18}, { 1, 19}, { 1, 20}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4},
- { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 2, 9}, { 2, 10}, { 3, 1}, { 3, 2},
- { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3},
- { 4, 4}, { 4, 5}, { 4, 6}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5},
- { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1},
- { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 11, 1},
- { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 0, 1}, { 0, 2},
- { 0, 3}, { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 3},
- { 3, 1}, { 3, 2}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2},
- { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2},
- { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2},
- { 15, 1}, { 16, 1}
- },
- {
- { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
- { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
- { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24},
- { 0, 25}, { 0, 26}, { 0, 27}, { 0, 28}, { 0, 29}, { 0, 30}, { 0, 31}, { 0, 32},
- { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8},
- { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 2, 1}, { 2, 2}, { 2, 3},
- { 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3},
- { 3, 4}, { 3, 5}, { 3, 6}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5},
- { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4},
- { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2},
- { 9, 3}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1},
- { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1},
- { 17, 2}, { 18, 1}, { 18, 2}, { 19, 1}, { 19, 2}, { 20, 1}, { 20, 2}, { 21, 1},
- { 21, 2}, { 22, 1}, { 22, 2}, { 23, 1}, { 24, 1}, { 0, 1}, { 0, 2}, { 0, 3},
- { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1},
- { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2},
- { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2},
- { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2},
- { 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1}, { 17, 2}, { 18, 1}, { 18, 2},
- { 19, 1}, { 19, 2}, { 20, 1}, { 20, 2}, { 21, 1}, { 21, 2}, { 22, 1}, { 22, 2},
- { 23, 1}, { 23, 2}, { 24, 1}, { 24, 2}, { 25, 1}, { 25, 2}, { 26, 1}, { 26, 2},
- { 27, 1}, { 27, 2}, { 28, 1}, { 28, 2}, { 29, 1}, { 30, 1}
- }
+static const uint8_t vc1_index_decode_table[AC_MODES][185][2] = {
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
+{ 0, 17}, { 0, 18}, { 0, 19}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5},
+{ 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13},
+{ 1, 14}, { 1, 15}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6},
+{ 2, 7}, { 2, 8}, { 2, 9}, { 2, 10}, { 2, 11}, { 2, 12}, { 3, 1}, { 3, 2},
+{ 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 3, 8}, { 3, 9}, { 3, 10},
+{ 3, 11}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 4, 6}, { 5, 1},
+{ 5, 2}, { 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4},
+{ 7, 1}, { 7, 2}, { 7, 3}, { 7, 4}, { 8, 1}, { 8, 2}, { 8, 3}, { 8, 4},
+{ 9, 1}, { 9, 2}, { 9, 3}, { 9, 4}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1},
+{ 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 13, 3},
+{ 14, 1}, { 14, 2}, { 14, 3}, { 15, 1}, { 15, 2}, { 15, 3}, { 16, 1}, { 16, 2},
+{ 17, 1}, { 17, 2}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1},
+{ 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 0, 1},
+{ 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 1, 1}, { 1, 2}, { 1, 3},
+{ 1, 4}, { 1, 5}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2},
+{ 3, 3}, { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 6, 1},
+{ 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1},
+{ 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1},
+{ 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1},
+{ 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1},
+{ 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1},
+{ 37, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
+{ 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 1, 1},
+{ 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9},
+{ 1, 10}, { 1, 11}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6},
+{ 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6},
+{ 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1}, { 5, 2},
+{ 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1},
+{ 7, 2}, { 7, 3}, { 7, 4}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2},
+{ 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1},
+{ 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1},
+{ 16, 2}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1},
+{ 24, 1}, { 25, 1}, { 26, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5},
+{ 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4},
+{ 1, 5}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2}, { 3, 3},
+{ 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1},
+{ 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2},
+{ 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2},
+{ 14, 1}, { 14, 2}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1},
+{ 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1},
+{ 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
+{ 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8},
+{ 1, 9}, { 1, 10}, { 1, 11}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5},
+{ 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5},
+{ 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1},
+{ 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1},
+{ 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3},
+{ 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2},
+{ 12, 3}, { 13, 1}, { 13, 2}, { 13, 3}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2},
+{ 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 0, 1}, { 0, 2}, { 0, 3},
+{ 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 2, 1}, { 2, 2}, { 2, 3},
+{ 3, 1}, { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1},
+{ 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1},
+{ 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1},
+{ 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1},
+{ 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 1, 1}, { 1, 2},
+{ 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 2, 1},
+{ 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4},
+{ 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4},
+{ 6, 1}, { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2},
+{ 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1},
+{ 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 14, 1},
+{ 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1},
+{ 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1},
+{ 29, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 1, 1}, { 1, 2},
+{ 1, 3}, { 1, 4}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1}, { 3, 2}, { 3, 3},
+{ 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2},
+{ 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2},
+{ 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2},
+{ 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1},
+{ 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1},
+{ 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}, { 37, 1}, { 38, 1}, { 39, 1},
+{ 40, 1}, { 41, 1}, { 42, 1}, { 43, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
+{ 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24},
+{ 0, 25}, { 0, 26}, { 0, 27}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5},
+{ 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 2, 1}, { 2, 2}, { 2, 3},
+{ 2, 4}, { 2, 5}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2},
+{ 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1},
+{ 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 11, 1},
+{ 12, 1}, { 13, 1}, { 14, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5},
+{ 0, 6}, { 0, 7}, { 0, 8}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2},
+{ 3, 1}, { 3, 2}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2},
+{ 7, 1}, { 8, 1}, { 9, 1}, { 10, 1}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1},
+{ 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4},
+{ 1, 5}, { 1, 6}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2},
+{ 3, 3}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1},
+{ 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2},
+{ 10, 1}, { 10, 2}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1},
+{ 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1},
+{ 25, 1}, { 26, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 1, 1}, { 1, 2}, { 2, 1},
+{ 3, 1}, { 4, 1}, { 5, 1}, { 6, 1}, { 7, 1}, { 8, 1}, { 9, 1}, { 10, 1},
+{ 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1},
+{ 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1},
+{ 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1},
+{ 35, 1}, { 36, 1}, { 37, 1}, { 38, 1}, { 39, 1}, { 40, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
+{ 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24},
+{ 0, 25}, { 0, 26}, { 0, 27}, { 0, 28}, { 0, 29}, { 0, 30}, { 0, 31}, { 0, 32},
+{ 0, 33}, { 0, 34}, { 0, 35}, { 0, 36}, { 0, 37}, { 0, 38}, { 0, 39}, { 0, 40},
+{ 0, 41}, { 0, 42}, { 0, 43}, { 0, 44}, { 0, 45}, { 0, 46}, { 0, 47}, { 0, 48},
+{ 0, 49}, { 0, 50}, { 0, 51}, { 0, 52}, { 0, 53}, { 0, 54}, { 0, 55}, { 0, 56},
+{ 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8},
+{ 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 1, 14}, { 1, 15}, { 1, 16},
+{ 1, 17}, { 1, 18}, { 1, 19}, { 1, 20}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4},
+{ 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 2, 9}, { 2, 10}, { 3, 1}, { 3, 2},
+{ 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3},
+{ 4, 4}, { 4, 5}, { 4, 6}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5},
+{ 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1},
+{ 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 11, 1},
+{ 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 0, 1}, { 0, 2},
+{ 0, 3}, { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 3},
+{ 3, 1}, { 3, 2}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2},
+{ 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2},
+{ 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2},
+{ 15, 1}, { 16, 1}
+},
+{
+{ 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8},
+{ 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16},
+{ 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24},
+{ 0, 25}, { 0, 26}, { 0, 27}, { 0, 28}, { 0, 29}, { 0, 30}, { 0, 31}, { 0, 32},
+{ 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8},
+{ 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 2, 1}, { 2, 2}, { 2, 3},
+{ 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3},
+{ 3, 4}, { 3, 5}, { 3, 6}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5},
+{ 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4},
+{ 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2},
+{ 9, 3}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1},
+{ 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1},
+{ 17, 2}, { 18, 1}, { 18, 2}, { 19, 1}, { 19, 2}, { 20, 1}, { 20, 2}, { 21, 1},
+{ 21, 2}, { 22, 1}, { 22, 2}, { 23, 1}, { 24, 1}, { 0, 1}, { 0, 2}, { 0, 3},
+{ 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1},
+{ 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2},
+{ 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2},
+{ 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2},
+{ 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1}, { 17, 2}, { 18, 1}, { 18, 2},
+{ 19, 1}, { 19, 2}, { 20, 1}, { 20, 2}, { 21, 1}, { 21, 2}, { 22, 1}, { 22, 2},
+{ 23, 1}, { 23, 2}, { 24, 1}, { 24, 2}, { 25, 1}, { 25, 2}, { 26, 1}, { 26, 2},
+{ 27, 1}, { 27, 2}, { 28, 1}, { 28, 2}, { 29, 1}, { 30, 1}
+}
};
-static const uint8_t vc1_delta_level_table[AC_MODES][31] =
-{
- {
- 19, 15, 12, 11, 6, 5, 4, 4, 4, 4,
- 3, 3, 3, 3, 3, 3, 2, 2, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1
- },
- {
- 23, 11, 8, 7, 5, 5, 4, 4, 3, 3,
- 3, 3, 2, 2, 2, 2, 2, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1
- },
- {
- 16, 11, 8, 7, 5, 4, 4, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 1, 1, 1, 1,
- 1
- },
- {
- 14, 9, 5, 4, 4, 4, 3, 3, 3, 3,
- 3, 3, 3, 2, 2, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1
- },
- {
- 27, 10, 5, 4, 3, 3, 3, 3, 2, 2,
- 1, 1, 1, 1, 1
- },
- {
- 12, 6, 4, 3, 3, 3, 3, 2, 2, 2,
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1
- },
- {
- 56, 20, 10, 7, 6, 5, 4, 3, 3, 3,
- 2, 2, 2, 2, 1
- },
- {
- 32, 13, 8, 6, 5, 4, 4, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 1, 1
- }
+static const uint8_t vc1_delta_level_table[AC_MODES][31] = {
+{
+ 19, 15, 12, 11, 6, 5, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 2, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1
+},
+{
+ 23, 11, 8, 7, 5, 5, 4, 4, 3, 3,
+ 3, 3, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1
+},
+{
+ 16, 11, 8, 7, 5, 4, 4, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 1, 1, 1, 1,
+ 1
+},
+{
+ 14, 9, 5, 4, 4, 4, 3, 3, 3, 3,
+ 3, 3, 3, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1
+},
+{
+ 27, 10, 5, 4, 3, 3, 3, 3, 2, 2,
+ 1, 1, 1, 1, 1
+},
+{
+ 12, 6, 4, 3, 3, 3, 3, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1
+},
+{
+ 56, 20, 10, 7, 6, 5, 4, 3, 3, 3,
+ 2, 2, 2, 2, 1
+},
+{
+ 32, 13, 8, 6, 5, 4, 4, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 1, 1
+}
};
-static const uint8_t vc1_last_delta_level_table[AC_MODES][44] =
-{
- {
- 6, 5, 4, 4, 3, 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
- },
- {
- 9, 5, 4, 4, 3, 3, 3, 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
- },
- {
- 4, 4, 3, 3, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1
- },
- {
- 5, 4, 3, 3, 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
- },
- {
- 8, 3, 2, 2, 2, 2, 2, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1
- },
- {
- 3, 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
- },
- {
- 4, 3, 3, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 1
- },
- {
- 4, 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, 1,
- 1
- }
+static const uint8_t vc1_last_delta_level_table[AC_MODES][44] = {
+{
+ 6, 5, 4, 4, 3, 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
+},
+{
+ 9, 5, 4, 4, 3, 3, 3, 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
+},
+{
+ 4, 4, 3, 3, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1
+},
+{
+ 5, 4, 3, 3, 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
+},
+{
+ 8, 3, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1
+},
+{
+ 3, 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
+},
+{
+ 4, 3, 3, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1
+},
+{
+ 4, 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, 1,
+ 1
+}
};
-static const uint8_t vc1_delta_run_table[AC_MODES][57] =
-{
- {
- -1, 30, 17, 15, 9, 5, 4, 3, 3, 3,
- 3, 3, 2, 1, 1, 1, 0, 0, 0,
- 0
- },
- {
- -1, 26, 16, 11, 7, 5, 3, 3, 2, 1,
- 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
- },
- {
- -1, 20, 15, 13, 6, 4, 3, 3, 2, 1,
- 1, 1, 0, 0, 0, 0, 0
- },
- {
- -1, 29, 15, 12, 5, 2, 1, 1, 1, 1,
- 0, 0, 0, 0, 0
- },
- {
- -1, 14, 9, 7, 3, 2, 1, 1, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- -1, 26, 10, 6, 2, 1, 1, 0, 0, 0,
- 0, 0, 0
- },
- {
- -1, 14, 13, 9, 6, 5, 4, 3, 2, 2,
- 2, 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
- },
- {
- -1, 24, 22, 9, 6, 4, 3, 2, 2, 1,
- 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0
- }
+static const uint8_t vc1_delta_run_table[AC_MODES][57] = {
+{
+ -1, 30, 17, 15, 9, 5, 4, 3, 3, 3,
+ 3, 3, 2, 1, 1, 1, 0, 0, 0,
+ 0
+},
+{
+ -1, 26, 16, 11, 7, 5, 3, 3, 2, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+},
+{
+ -1, 20, 15, 13, 6, 4, 3, 3, 2, 1,
+ 1, 1, 0, 0, 0, 0, 0
+},
+{
+ -1, 29, 15, 12, 5, 2, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0
+},
+{
+ -1, 14, 9, 7, 3, 2, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0
+},
+{
+ -1, 26, 10, 6, 2, 1, 1, 0, 0, 0,
+ 0, 0, 0
+},
+{
+ -1, 14, 13, 9, 6, 5, 4, 3, 2, 2,
+ 2, 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
+},
+{
+ -1, 24, 22, 9, 6, 4, 3, 2, 2, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0
+}
};
-static const uint8_t vc1_last_delta_run_table[AC_MODES][10] =
-{
- {
- -1, 37, 15, 4, 3, 1, 0
- },
- {
- -1, 36, 14, 6, 3, 1, 0, 0, 0,
- 0
- },
- {
- -1, 26, 13, 3, 1
- },
- {
- -1, 43, 15, 3, 1, 0
- },
- {
- -1, 20, 6, 1, 0, 0, 0, 0, 0
- },
- {
- -1, 40, 1, 0
- },
- {
- -1, 16, 14, 2, 0
- },
- {
- -1, 30, 28, 3, 0
- }
+static const uint8_t vc1_last_delta_run_table[AC_MODES][10] = {
+{
+ -1, 37, 15, 4, 3, 1, 0
+},
+{
+ -1, 36, 14, 6, 3, 1, 0, 0, 0,
+ 0
+},
+{
+ -1, 26, 13, 3, 1
+},
+{
+ -1, 43, 15, 3, 1, 0
+},
+{
+ -1, 20, 6, 1, 0, 0, 0, 0, 0
+},
+{
+ -1, 40, 1, 0
+},
+{
+ -1, 16, 14, 2, 0
+},
+{
+ -1, 30, 28, 3, 0
+}
};
#endif /* AVCODEC_VC1ACDATA_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1data.c
index 43f27e95f..dd2978517 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1data.c
@@ -30,43 +30,39 @@
#include "vc1data.h"
/** Table for conversion between TTBLK and TTMB */
-const int ff_vc1_ttblk_to_tt[3][8] =
-{
- { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT },
- { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP },
- { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP }
+const int ff_vc1_ttblk_to_tt[3][8] = {
+ { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT },
+ { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP },
+ { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP }
};
const int ff_vc1_ttfrm_to_tt[4] = { TT_8X8, TT_8X4, TT_4X8, TT_4X4 };
/** MV P mode - the 5th element is only used for mode 1 */
-const uint8_t ff_vc1_mv_pmode_table[2][5] =
-{
- { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV },
- { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN }
+const uint8_t ff_vc1_mv_pmode_table[2][5] = {
+ { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV },
+ { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN }
};
-const uint8_t ff_vc1_mv_pmode_table2[2][4] =
-{
- { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV },
- { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN }
+const uint8_t ff_vc1_mv_pmode_table2[2][4] = {
+ { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV },
+ { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN }
};
const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
- ff_vc1_fps_dr[2] = { 1000, 1001 };
-const uint8_t ff_vc1_pquant_table[3][32] =
-{
- { /* Implicit quantizer */
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31
- },
- { /* Explicit quantizer, pquantizer uniform */
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
- },
- { /* Explicit quantizer, pquantizer non-uniform */
- 0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31
- }
+ ff_vc1_fps_dr[2] = { 1000, 1001 };
+const uint8_t ff_vc1_pquant_table[3][32] = {
+ { /* Implicit quantizer */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31
+ },
+ { /* Explicit quantizer, pquantizer uniform */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
+ },
+ { /* Explicit quantizer, pquantizer non-uniform */
+ 0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31
+ }
};
/** @name VC-1 VLC tables and defines
@@ -101,32 +97,29 @@ VLC ff_vc1_ac_coeff_table[8];
#if B_FRACTION_DEN==840 //original bfraction from vc9data.h, not conforming to standard
/* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
-const int16_t ff_vc1_bfraction_lut[23] =
-{
- 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
- 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
- 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
- 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/,
- 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/,
- 525 /*5/8*/, 735 /*7/8*/,
- -1 /*inv.*/, 0 /*BI fm*/
+const int16_t ff_vc1_bfraction_lut[23] = {
+ 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
+ 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
+ 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
+ 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/,
+ 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/,
+ 525 /*5/8*/, 735 /*7/8*/,
+ -1 /*inv.*/, 0 /*BI fm*/
};
#else
/* pre-computed scales for all bfractions and base=256 */
-const int16_t ff_vc1_bfraction_lut[23] =
-{
- 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/,
- 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/,
- 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/,
- 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/,
- 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/,
- 160 /*5/8*/, 224 /*7/8*/,
- -1 /*inv.*/, 0 /*BI fm*/
+const int16_t ff_vc1_bfraction_lut[23] = {
+ 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/,
+ 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/,
+ 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/,
+ 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/,
+ 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/,
+ 160 /*5/8*/, 224 /*7/8*/,
+ -1 /*inv.*/, 0 /*BI fm*/
};
#endif
-const uint8_t ff_vc1_bfraction_bits[23] =
-{
+const uint8_t ff_vc1_bfraction_bits[23] = {
3, 3, 3, 3,
3, 3, 3,
7, 7, 7, 7,
@@ -135,276 +128,260 @@ const uint8_t ff_vc1_bfraction_bits[23] =
7, 7,
7, 7
};
-const uint8_t ff_vc1_bfraction_codes[23] =
-{
- 0, 1, 2, 3,
- 4, 5, 6,
- 112, 113, 114, 115,
- 116, 117, 118, 119,
- 120, 121, 122, 123,
- 124, 125,
- 126, 127
+const uint8_t ff_vc1_bfraction_codes[23] = {
+ 0, 1, 2, 3,
+ 4, 5, 6,
+ 112, 113, 114, 115,
+ 116, 117, 118, 119,
+ 120, 121, 122, 123,
+ 124, 125,
+ 126, 127
};
//Same as H.264
-const AVRational ff_vc1_pixel_aspect[16] =
-{
- {0, 1},
- {1, 1},
- {12, 11},
- {10, 11},
- {16, 11},
- {40, 33},
- {24, 11},
- {20, 11},
- {32, 11},
- {80, 33},
- {18, 11},
- {15, 11},
- {64, 33},
- {160, 99},
- {0, 1},
- {0, 1}
+const AVRational ff_vc1_pixel_aspect[16]={
+ {0, 1},
+ {1, 1},
+ {12, 11},
+ {10, 11},
+ {16, 11},
+ {40, 33},
+ {24, 11},
+ {20, 11},
+ {32, 11},
+ {80, 33},
+ {18, 11},
+ {15, 11},
+ {64, 33},
+ {160, 99},
+ {0, 1},
+ {0, 1}
};
/* BitPlane IMODE - such a small table... */
-const uint8_t ff_vc1_imode_codes[7] =
-{
- 0, 2, 1, 3, 1, 2, 3
+const uint8_t ff_vc1_imode_codes[7] = {
+ 0, 2, 1, 3, 1, 2, 3
};
-const uint8_t ff_vc1_imode_bits[7] =
-{
- 4, 2, 3, 2, 4, 3, 3
+const uint8_t ff_vc1_imode_bits[7] = {
+ 4, 2, 3, 2, 4, 3, 3
};
/* Normal-2 imode */
-const uint8_t ff_vc1_norm2_codes[4] =
-{
- 0, 4, 5, 3
+const uint8_t ff_vc1_norm2_codes[4] = {
+ 0, 4, 5, 3
};
-const uint8_t ff_vc1_norm2_bits[4] =
-{
- 1, 3, 3, 2
+const uint8_t ff_vc1_norm2_bits[4] = {
+ 1, 3, 3, 2
};
-const uint16_t ff_vc1_norm6_codes[64] =
-{
- 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
- 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
- 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
- 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
+const uint16_t ff_vc1_norm6_codes[64] = {
+0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
+0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
+0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
+0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
};
-const uint8_t ff_vc1_norm6_bits[64] =
-{
- 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13,
- 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
- 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
- 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
+const uint8_t ff_vc1_norm6_bits[64] = {
+ 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13,
+ 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
+ 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
+ 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
};
#if 0
/* Normal-6 imode */
-const uint8_t ff_vc1_norm6_spec[64][5] =
-{
- { 0, 1, 1 },
- { 1, 2, 4 },
- { 2, 3, 4 },
- { 3, 0, 8 },
- { 4, 4, 4 },
- { 5, 1, 8 },
- { 6, 2, 8 },
- { 7, 2, 5, 7, 5 },
- { 8, 5, 4 },
- { 9, 3, 8 },
- {10, 4, 8 },
- {11, 2, 5, 11, 5 },
- {12, 5, 8 },
- {13, 2, 5, 13, 5 },
- {14, 2, 5, 14, 5 },
- {15, 3, 5, 14, 8 },
- {16, 6, 4 },
- {17, 6, 8 },
- {18, 7, 8 },
- {19, 2, 5, 19, 5 },
- {20, 8, 8 },
- {21, 2, 5, 21, 5 },
- {22, 2, 5, 22, 5 },
- {23, 3, 5, 13, 8 },
- {24, 9, 8 },
- {25, 2, 5, 25, 5 },
- {26, 2, 5, 26, 5 },
- {27, 3, 5, 12, 8 },
- {28, 2, 5, 28, 5 },
- {29, 3, 5, 11, 8 },
- {30, 3, 5, 10, 8 },
- {31, 3, 5, 7, 4 },
- {32, 7, 4 },
- {33, 10, 8 },
- {34, 11, 8 },
- {35, 2, 5, 3, 5 },
- {36, 12, 8 },
- {37, 2, 5, 5, 5 },
- {38, 2, 5, 6, 5 },
- {39, 3, 5, 9, 8 },
- {40, 13, 8 },
- {41, 2, 5, 9, 5 },
- {42, 2, 5, 10, 5 },
- {43, 3, 5, 8, 8 },
- {44, 2, 5, 12, 5 },
- {45, 3, 5, 7, 8 },
- {46, 3, 5, 6, 8 },
- {47, 3, 5, 6, 4 },
- {48, 14, 8 },
- {49, 2, 5, 17, 5 },
- {50, 2, 5, 18, 5 },
- {51, 3, 5, 5, 8 },
- {52, 2, 5, 20, 5 },
- {53, 3, 5, 4, 8 },
- {54, 3, 5, 3, 8 },
- {55, 3, 5, 5, 4 },
- {56, 2, 5, 24, 5 },
- {57, 3, 5, 2, 8 },
- {58, 3, 5, 1, 8 },
- {59, 3, 5, 4, 4 },
- {60, 3, 5, 0, 8 },
- {61, 3, 5, 3, 4 },
- {62, 3, 5, 2, 4 },
- {63, 3, 5, 1, 1 },
+const uint8_t ff_vc1_norm6_spec[64][5] = {
+{ 0, 1, 1 },
+{ 1, 2, 4 },
+{ 2, 3, 4 },
+{ 3, 0, 8 },
+{ 4, 4, 4 },
+{ 5, 1, 8 },
+{ 6, 2, 8 },
+{ 7, 2, 5, 7, 5 },
+{ 8, 5, 4 },
+{ 9, 3, 8 },
+{10, 4, 8 },
+{11, 2, 5, 11, 5 },
+{12, 5, 8 },
+{13, 2, 5, 13, 5 },
+{14, 2, 5, 14, 5 },
+{15, 3, 5, 14, 8 },
+{16, 6, 4 },
+{17, 6, 8 },
+{18, 7, 8 },
+{19, 2, 5, 19, 5 },
+{20, 8, 8 },
+{21, 2, 5, 21, 5 },
+{22, 2, 5, 22, 5 },
+{23, 3, 5, 13, 8 },
+{24, 9, 8 },
+{25, 2, 5, 25, 5 },
+{26, 2, 5, 26, 5 },
+{27, 3, 5, 12, 8 },
+{28, 2, 5, 28, 5 },
+{29, 3, 5, 11, 8 },
+{30, 3, 5, 10, 8 },
+{31, 3, 5, 7, 4 },
+{32, 7, 4 },
+{33, 10, 8 },
+{34, 11, 8 },
+{35, 2, 5, 3, 5 },
+{36, 12, 8 },
+{37, 2, 5, 5, 5 },
+{38, 2, 5, 6, 5 },
+{39, 3, 5, 9, 8 },
+{40, 13, 8 },
+{41, 2, 5, 9, 5 },
+{42, 2, 5, 10, 5 },
+{43, 3, 5, 8, 8 },
+{44, 2, 5, 12, 5 },
+{45, 3, 5, 7, 8 },
+{46, 3, 5, 6, 8 },
+{47, 3, 5, 6, 4 },
+{48, 14, 8 },
+{49, 2, 5, 17, 5 },
+{50, 2, 5, 18, 5 },
+{51, 3, 5, 5, 8 },
+{52, 2, 5, 20, 5 },
+{53, 3, 5, 4, 8 },
+{54, 3, 5, 3, 8 },
+{55, 3, 5, 5, 4 },
+{56, 2, 5, 24, 5 },
+{57, 3, 5, 2, 8 },
+{58, 3, 5, 1, 8 },
+{59, 3, 5, 4, 4 },
+{60, 3, 5, 0, 8 },
+{61, 3, 5, 3, 4 },
+{62, 3, 5, 2, 4 },
+{63, 3, 5, 1, 1 },
};
#endif
/* 4MV Block pattern VLC tables */
-const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] =
-{
- { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2},
- { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0},
- { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0},
- { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10}
+const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = {
+ { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2},
+ { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0},
+ { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0},
+ { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10}
};
-const uint8_t ff_vc1_4mv_block_pattern_bits[4][16] =
-{
- { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
- { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
- { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
- { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
+const uint8_t ff_vc1_4mv_block_pattern_bits[4][16] = {
+ { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
+ { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
+ { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
+ { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
};
-const uint8_t wmv3_dc_scale_table[32] =
-{
- 0, 2, 4, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21
+const uint8_t wmv3_dc_scale_table[32]={
+ 0, 2, 4, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21
};
/* P-Picture CBPCY VLC tables */
#if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
-const uint16_t ff_vc1_cbpcy_p_codes[4][64] =
-{
- {
- 0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119,
- 1, 54, 96, 8, 10, 111, 5, 15, 12, 10, 2, 12, 13, 115, 53, 63,
- 1, 7, 1, 7, 14, 12, 4, 14, 1, 9, 97, 11, 7, 58, 52, 62,
- 4, 103, 1, 9, 11, 56, 101, 118, 4, 110, 100, 30, 2, 5, 4, 3
- },
- {
- 0, 9, 1, 18, 5, 14, 237, 26, 3, 121, 3, 22, 13, 16, 6, 30,
- 2, 10, 1, 20, 12, 241, 5, 28, 16, 12, 3, 24, 28, 124, 239, 247,
- 1, 240, 1, 19, 18, 15, 4, 27, 1, 122, 2, 23, 1, 17, 7, 31,
- 1, 11, 2, 21, 19, 246, 238, 29, 17, 13, 236, 25, 58, 63, 8, 125
- },
- {
- 0, 201, 25, 231, 5, 221, 1, 3, 2, 414, 2, 241, 16, 225, 195, 492,
- 2, 412, 1, 240, 7, 224, 98, 245, 1, 220, 96, 5, 9, 230, 101, 247,
- 1, 102, 1, 415, 24, 3, 2, 244, 3, 54, 3, 484, 17, 114, 200, 493,
- 3, 413, 1, 4, 13, 113, 99, 485, 4, 111, 194, 243, 5, 29, 26, 31
- },
- {
- 0, 28, 12, 44, 3, 36, 20, 52, 2, 32, 16, 48, 8, 40, 24, 28,
- 1, 30, 14, 46, 6, 38, 22, 54, 3, 34, 18, 50, 10, 42, 26, 30,
- 1, 29, 13, 45, 5, 37, 21, 53, 2, 33, 17, 49, 9, 41, 25, 29,
- 1, 31, 15, 47, 7, 39, 23, 55, 4, 35, 19, 51, 11, 43, 27, 31
- }
-};
-
-const uint8_t ff_vc1_cbpcy_p_bits[4][64] =
-{
- {
- 13, 13, 7, 13, 7, 13, 13, 12, 6, 13, 7, 12, 6, 8, 8, 8,
- 5, 7, 8, 12, 6, 8, 13, 12, 7, 13, 13, 12, 6, 8, 7, 7,
- 6, 13, 8, 12, 7, 13, 13, 12, 7, 13, 8, 12, 5, 7, 7, 7,
- 6, 8, 13, 12, 6, 7, 8, 8, 5, 8, 8, 6, 3, 3, 3, 2
- },
- {
- 14, 13, 8, 13, 3, 13, 8, 13, 3, 7, 8, 13, 4, 13, 13, 13,
- 3, 13, 13, 13, 4, 8, 13, 13, 5, 13, 13, 13, 5, 7, 8, 8,
- 3, 8, 14, 13, 5, 13, 13, 13, 4, 7, 13, 13, 6, 13, 13, 13,
- 5, 13, 8, 13, 5, 8, 8, 13, 5, 13, 8, 13, 6, 6, 13, 7
- },
- {
- 13, 8, 6, 8, 4, 8, 13, 12, 4, 9, 8, 8, 5, 8, 8, 9,
- 5, 9, 10, 8, 4, 8, 7, 8, 6, 8, 7, 13, 4, 8, 7, 8,
- 5, 7, 8, 9, 6, 13, 13, 8, 4, 6, 8, 9, 5, 7, 8, 9,
- 5, 9, 9, 13, 5, 7, 7, 9, 4, 7, 8, 8, 3, 5, 5, 5
- },
- {
- 9, 9, 9, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 8,
- 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
- 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8
- }
+const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
+ {
+ 0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119,
+ 1, 54, 96, 8, 10, 111, 5, 15, 12, 10, 2, 12, 13, 115, 53, 63,
+ 1, 7, 1, 7, 14, 12, 4, 14, 1, 9, 97, 11, 7, 58, 52, 62,
+ 4, 103, 1, 9, 11, 56, 101, 118, 4, 110, 100, 30, 2, 5, 4, 3
+ },
+ {
+ 0, 9, 1, 18, 5, 14, 237, 26, 3, 121, 3, 22, 13, 16, 6, 30,
+ 2, 10, 1, 20, 12, 241, 5, 28, 16, 12, 3, 24, 28, 124, 239, 247,
+ 1, 240, 1, 19, 18, 15, 4, 27, 1, 122, 2, 23, 1, 17, 7, 31,
+ 1, 11, 2, 21, 19, 246, 238, 29, 17, 13, 236, 25, 58, 63, 8, 125
+ },
+ {
+ 0, 201, 25, 231, 5, 221, 1, 3, 2, 414, 2, 241, 16, 225, 195, 492,
+ 2, 412, 1, 240, 7, 224, 98, 245, 1, 220, 96, 5, 9, 230, 101, 247,
+ 1, 102, 1, 415, 24, 3, 2, 244, 3, 54, 3, 484, 17, 114, 200, 493,
+ 3, 413, 1, 4, 13, 113, 99, 485, 4, 111, 194, 243, 5, 29, 26, 31
+ },
+ {
+ 0, 28, 12, 44, 3, 36, 20, 52, 2, 32, 16, 48, 8, 40, 24, 28,
+ 1, 30, 14, 46, 6, 38, 22, 54, 3, 34, 18, 50, 10, 42, 26, 30,
+ 1, 29, 13, 45, 5, 37, 21, 53, 2, 33, 17, 49, 9, 41, 25, 29,
+ 1, 31, 15, 47, 7, 39, 23, 55, 4, 35, 19, 51, 11, 43, 27, 31
+ }
+};
+
+const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
+ {
+ 13, 13, 7, 13, 7, 13, 13, 12, 6, 13, 7, 12, 6, 8, 8, 8,
+ 5, 7, 8, 12, 6, 8, 13, 12, 7, 13, 13, 12, 6, 8, 7, 7,
+ 6, 13, 8, 12, 7, 13, 13, 12, 7, 13, 8, 12, 5, 7, 7, 7,
+ 6, 8, 13, 12, 6, 7, 8, 8, 5, 8, 8, 6, 3, 3, 3, 2
+ },
+ {
+ 14, 13, 8, 13, 3, 13, 8, 13, 3, 7, 8, 13, 4, 13, 13, 13,
+ 3, 13, 13, 13, 4, 8, 13, 13, 5, 13, 13, 13, 5, 7, 8, 8,
+ 3, 8, 14, 13, 5, 13, 13, 13, 4, 7, 13, 13, 6, 13, 13, 13,
+ 5, 13, 8, 13, 5, 8, 8, 13, 5, 13, 8, 13, 6, 6, 13, 7
+ },
+ {
+ 13, 8, 6, 8, 4, 8, 13, 12, 4, 9, 8, 8, 5, 8, 8, 9,
+ 5, 9, 10, 8, 4, 8, 7, 8, 6, 8, 7, 13, 4, 8, 7, 8,
+ 5, 7, 8, 9, 6, 13, 13, 8, 4, 6, 8, 9, 5, 7, 8, 9,
+ 5, 9, 9, 13, 5, 7, 7, 9, 4, 7, 8, 8, 3, 5, 5, 5
+ },
+ {
+ 9, 9, 9, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 8,
+ 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
+ 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8
+ }
};
#else
-const uint16_t ff_vc1_cbpcy_p_codes[4][64] =
-{
- {
- 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
- 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
- 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5,
- 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3
- },
- {
- 0, 1, 2, 1, 3, 1, 16, 17, 5, 18, 12, 19, 13, 1, 28, 58,
- 1, 1, 1, 2, 3, 2, 3, 236, 237, 4, 5, 238, 6, 7, 239, 8,
- 9, 240, 10, 11, 121, 122, 12, 13, 14, 15, 241, 246, 16, 17, 124, 63,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 247, 125
- },
- {
- 0, 1, 2, 3, 2, 3, 1, 4, 5, 24, 7, 13, 16, 17, 9, 5,
- 25, 1, 1, 1, 2, 3, 96, 194, 1, 2, 98, 99, 195, 200, 101, 26,
- 201, 102, 412, 413, 414, 54, 220, 111, 221, 3, 224, 113, 225, 114, 230, 29,
- 231, 415, 240, 4, 241, 484, 5, 243, 3, 244, 245, 485, 492, 493, 247, 31
- },
- {
- 0, 1, 1, 1, 2, 2, 3, 4, 3, 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, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
- }
-};
-const uint8_t ff_vc1_cbpcy_p_bits[4][64] =
-{
- {
- 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
- 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
- 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3,
- 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2
- },
- {
- 14, 3, 3, 5, 3, 4, 5, 5, 3, 5, 4, 5, 4, 6, 5, 6,
- 8, 14, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 13, 13, 8, 13,
- 13, 8, 13, 13, 7, 7, 13, 13, 13, 13, 8, 8, 13, 13, 7, 6,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 7
- },
- {
- 13, 5, 5, 5, 4, 4, 6, 4, 4, 6, 4, 5, 5, 5, 4, 3,
- 6, 8, 10, 9, 8, 8, 7, 8, 13, 13, 7, 7, 8, 8, 7, 5,
- 8, 7, 9, 9, 9, 6, 8, 7, 8, 13, 8, 7, 8, 7, 8, 5,
- 8, 9, 8, 13, 8, 9, 13, 8, 12, 8, 8, 9, 9, 9, 8, 5
- },
- {
- 9, 2, 3, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8
- }
+const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
+ {
+ 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
+ 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
+ 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5,
+ 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3
+ },
+ {
+ 0, 1, 2, 1, 3, 1, 16, 17, 5, 18, 12, 19, 13, 1, 28, 58,
+ 1, 1, 1, 2, 3, 2, 3, 236, 237, 4, 5, 238, 6, 7, 239, 8,
+ 9, 240, 10, 11, 121, 122, 12, 13, 14, 15, 241, 246, 16, 17, 124, 63,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 247, 125
+ },
+ {
+ 0, 1, 2, 3, 2, 3, 1, 4, 5, 24, 7, 13, 16, 17, 9, 5,
+ 25, 1, 1, 1, 2, 3, 96, 194, 1, 2, 98, 99, 195, 200, 101, 26,
+ 201, 102, 412, 413, 414, 54, 220, 111, 221, 3, 224, 113, 225, 114, 230, 29,
+ 231, 415, 240, 4, 241, 484, 5, 243, 3, 244, 245, 485, 492, 493, 247, 31
+ },
+ {
+ 0, 1, 1, 1, 2, 2, 3, 4, 3, 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, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
+ }
+};
+const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
+ {
+ 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
+ 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
+ 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3,
+ 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2
+ },
+ {
+ 14, 3, 3, 5, 3, 4, 5, 5, 3, 5, 4, 5, 4, 6, 5, 6,
+ 8, 14, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 13, 13, 8, 13,
+ 13, 8, 13, 13, 7, 7, 13, 13, 13, 13, 8, 8, 13, 13, 7, 6,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 7
+ },
+ {
+ 13, 5, 5, 5, 4, 4, 6, 4, 4, 6, 4, 5, 5, 5, 4, 3,
+ 6, 8, 10, 9, 8, 8, 7, 8, 13, 13, 7, 7, 8, 8, 7, 5,
+ 8, 7, 9, 9, 9, 6, 8, 7, 8, 13, 8, 7, 8, 7, 8, 5,
+ 8, 9, 8, 13, 8, 9, 13, 8, 12, 8, 8, 9, 9, 9, 8, 5
+ },
+ {
+ 9, 2, 3, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8
+ }
};
#endif
@@ -416,179 +393,171 @@ const uint8_t ff_vc1_cbpcy_p_bits[4][64] =
* 8x4:MB:btm 8x4:MB:top 8x4,MB,both
* 4x8,MB,right 4x8,MB,left
* 4x4,MB */
-const uint16_t ff_vc1_ttmb_codes[3][16] =
-{
- {
- 0x0003,
- 0x002E, 0x005F, 0x0000,
- 0x0016, 0x0015, 0x0001,
- 0x0004, 0x0014,
- 0x02F1, 0x0179, 0x017B,
- 0x0BC0, 0x0BC1, 0x05E1,
- 0x017A
- },
- {
- 0x0006,
- 0x0006, 0x0003, 0x0007,
- 0x000F, 0x000E, 0x0000,
- 0x0002, 0x0002,
- 0x0014, 0x0011, 0x000B,
- 0x0009, 0x0021, 0x0015,
- 0x0020
- },
- {
- 0x0006,
- 0x0000, 0x000E, 0x0005,
- 0x0002, 0x0003, 0x0003,
- 0x000F, 0x0002,
- 0x0081, 0x0021, 0x0009,
- 0x0101, 0x0041, 0x0011,
- 0x0100
- }
-};
-
-const uint8_t ff_vc1_ttmb_bits[3][16] =
-{
- {
- 2,
- 6, 7, 2,
- 5, 5, 2,
- 3, 5,
- 10, 9, 9,
- 12, 12, 11,
- 9
- },
- {
- 3,
- 4, 4, 4,
- 4, 4, 3,
- 3, 2,
- 7, 7, 6,
- 6, 8, 7,
- 8
- },
- {
- 3,
- 3, 4, 5,
- 3, 3, 4,
- 4, 2,
- 10, 8, 6,
- 11, 9, 7,
- 11
- }
+const uint16_t ff_vc1_ttmb_codes[3][16] = {
+ {
+ 0x0003,
+ 0x002E, 0x005F, 0x0000,
+ 0x0016, 0x0015, 0x0001,
+ 0x0004, 0x0014,
+ 0x02F1, 0x0179, 0x017B,
+ 0x0BC0, 0x0BC1, 0x05E1,
+ 0x017A
+ },
+ {
+ 0x0006,
+ 0x0006, 0x0003, 0x0007,
+ 0x000F, 0x000E, 0x0000,
+ 0x0002, 0x0002,
+ 0x0014, 0x0011, 0x000B,
+ 0x0009, 0x0021, 0x0015,
+ 0x0020
+ },
+ {
+ 0x0006,
+ 0x0000, 0x000E, 0x0005,
+ 0x0002, 0x0003, 0x0003,
+ 0x000F, 0x0002,
+ 0x0081, 0x0021, 0x0009,
+ 0x0101, 0x0041, 0x0011,
+ 0x0100
+ }
+};
+
+const uint8_t ff_vc1_ttmb_bits[3][16] = {
+ {
+ 2,
+ 6, 7, 2,
+ 5, 5, 2,
+ 3, 5,
+ 10, 9, 9,
+ 12, 12, 11,
+ 9
+ },
+ {
+ 3,
+ 4, 4, 4,
+ 4, 4, 3,
+ 3, 2,
+ 7, 7, 6,
+ 6, 8, 7,
+ 8
+ },
+ {
+ 3,
+ 3, 4, 5,
+ 3, 3, 4,
+ 4, 2,
+ 10, 8, 6,
+ 11, 9, 7,
+ 11
+ }
};
/* TTBLK (Transform Type per Block) tables */
-const uint8_t ff_vc1_ttblk_codes[3][8] =
-{
- { 0, 1, 3, 5, 16, 17, 18, 19},
- { 3, 0, 1, 2, 3, 5, 8, 9},
- { 1, 0, 1, 4, 6, 7, 10, 11}
+const uint8_t ff_vc1_ttblk_codes[3][8] = {
+ { 0, 1, 3, 5, 16, 17, 18, 19},
+ { 3, 0, 1, 2, 3, 5, 8, 9},
+ { 1, 0, 1, 4, 6, 7, 10, 11}
};
-const uint8_t ff_vc1_ttblk_bits[3][8] =
-{
- { 2, 2, 2, 3, 5, 5, 5, 5},
- { 2, 3, 3, 3, 3, 3, 4, 4},
- { 2, 3, 3, 3, 3, 3, 4, 4}
+const uint8_t ff_vc1_ttblk_bits[3][8] = {
+ { 2, 2, 2, 3, 5, 5, 5, 5},
+ { 2, 3, 3, 3, 3, 3, 4, 4},
+ { 2, 3, 3, 3, 3, 3, 4, 4}
};
/* SUBBLKPAT tables, p93-94, reordered */
-const uint8_t ff_vc1_subblkpat_codes[3][15] =
-{
- { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1},
- { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1},
- { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15}
+const uint8_t ff_vc1_subblkpat_codes[3][15] = {
+ { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1},
+ { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1},
+ { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15}
};
-const uint8_t ff_vc1_subblkpat_bits[3][15] =
-{
- { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1},
- { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2},
- { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4}
+const uint8_t ff_vc1_subblkpat_bits[3][15] = {
+ { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1},
+ { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2},
+ { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4}
};
/* MV differential tables, p265 */
-const uint16_t ff_vc1_mv_diff_codes[4][73] =
-{
- {
- 0, 2, 3, 8, 576, 3, 2, 6,
- 5, 577, 578, 7, 8, 9, 40, 19,
- 37, 82, 21, 22, 23, 579, 580, 166,
- 96, 167, 49, 194, 195, 581, 582, 583,
- 292, 293, 294, 13, 2, 7, 24, 50,
- 102, 295, 13, 7, 8, 18, 50, 103,
- 38, 20, 21, 22, 39, 204, 103, 23,
- 24, 25, 104, 410, 105, 106, 107, 108,
- 109, 220, 411, 442, 222, 443, 446, 447,
- 7 /* 73 elements */
- },
- {
- 0, 4, 5, 3, 4, 3, 4, 5,
- 20, 6, 21, 44, 45, 46, 3008, 95,
- 112, 113, 57, 3009, 3010, 116, 117, 3011,
- 118, 3012, 3013, 3014, 3015, 3016, 3017, 3018,
- 3019, 3020, 3021, 3022, 1, 4, 15, 160,
- 161, 41, 6, 11, 42, 162, 43, 119,
- 56, 57, 58, 163, 236, 237, 3023, 119,
- 120, 242, 122, 486, 1512, 487, 246, 494,
- 1513, 495, 1514, 1515, 1516, 1517, 1518, 1519,
- 31 /* 73 elements */
- },
- {
- 0, 512, 513, 514, 515, 2, 3, 258,
- 259, 260, 261, 262, 263, 264, 265, 266,
- 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282,
- 283, 284, 285, 286, 1, 5, 287, 288,
- 289, 290, 6, 7, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302,
- 303, 304, 305, 306, 307, 308, 309, 310,
- 311, 312, 313, 314, 315, 316, 317, 318,
- 319 /* 73 elements */
- },
- {
- 0, 1, 1, 2, 3, 4, 1, 5,
- 4, 3, 5, 8, 6, 9, 10, 11,
- 12, 7, 104, 14, 105, 4, 10, 15,
- 11, 6, 14, 8, 106, 107, 108, 15,
- 109, 9, 55, 10, 1, 2, 1, 2,
- 3, 12, 6, 2, 6, 7, 28, 7,
- 15, 8, 5, 18, 29, 152, 77, 24,
- 25, 26, 39, 108, 13, 109, 55, 56,
- 57, 116, 11, 153, 234, 235, 118, 119,
- 15 /* 73 elements */
- }
-};
-const uint8_t ff_vc1_mv_diff_bits[4][73] =
-{
- {
- 6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9,
- 10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14,
- 13, 13, 13, 6, 3, 5, 6, 8, 9, 13, 5, 4, 4, 5, 7, 9,
- 6, 5, 5, 5, 6, 9, 8, 5, 5, 5, 7, 10, 7, 7, 7, 7,
- 7, 8, 10, 9, 8, 9, 9, 9, 3 /* 73 elements */
- },
- {
- 5, 7, 7, 6, 6, 5, 5, 6, 7, 5, 7, 8, 8, 8, 14, 9,
- 9, 9, 8, 14, 14, 9, 9, 14, 9, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 2, 3, 6, 8, 8, 6, 3, 4, 6, 8, 6, 9,
- 6, 6, 6, 8, 8, 8, 14, 7, 7, 8, 7, 9, 13, 9, 8, 9,
- 13, 9, 13, 13, 13, 13, 13, 13, 5 /* 73 elements */
-
- },
- {
- 3, 12, 12, 12, 12, 3, 4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 1, 5, 11, 11, 11, 11, 4, 4, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11 /* 73 elements */
- },
- {
- 15, 11, 15, 15, 15, 15, 12, 15, 12, 11, 12, 12, 15, 12, 12, 12,
- 12, 15, 15, 12, 15, 10, 11, 12, 11, 10, 11, 10, 15, 15, 15, 11,
- 15, 10, 14, 10, 4, 4, 5, 7, 8, 9, 5, 3, 4, 5, 6, 8,
- 5, 4, 3, 5, 6, 8, 7, 5, 5, 5, 6, 7, 9, 7, 6, 6,
- 6, 7, 10, 8, 8, 8, 7, 7, 4 /* 73 elements */
- }
+const uint16_t ff_vc1_mv_diff_codes[4][73] = {
+ {
+ 0, 2, 3, 8, 576, 3, 2, 6,
+ 5, 577, 578, 7, 8, 9, 40, 19,
+ 37, 82, 21, 22, 23, 579, 580, 166,
+ 96, 167, 49, 194, 195, 581, 582, 583,
+ 292, 293, 294, 13, 2, 7, 24, 50,
+ 102, 295, 13, 7, 8, 18, 50, 103,
+ 38, 20, 21, 22, 39, 204, 103, 23,
+ 24, 25, 104, 410, 105, 106, 107, 108,
+ 109, 220, 411, 442, 222, 443, 446, 447,
+ 7 /* 73 elements */
+ },
+ {
+ 0, 4, 5, 3, 4, 3, 4, 5,
+ 20, 6, 21, 44, 45, 46, 3008, 95,
+ 112, 113, 57, 3009, 3010, 116, 117, 3011,
+ 118, 3012, 3013, 3014, 3015, 3016, 3017, 3018,
+ 3019, 3020, 3021, 3022, 1, 4, 15, 160,
+ 161, 41, 6, 11, 42, 162, 43, 119,
+ 56, 57, 58, 163, 236, 237, 3023, 119,
+ 120, 242, 122, 486, 1512, 487, 246, 494,
+ 1513, 495, 1514, 1515, 1516, 1517, 1518, 1519,
+ 31 /* 73 elements */
+ },
+ {
+ 0, 512, 513, 514, 515, 2, 3, 258,
+ 259, 260, 261, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282,
+ 283, 284, 285, 286, 1, 5, 287, 288,
+ 289, 290, 6, 7, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302,
+ 303, 304, 305, 306, 307, 308, 309, 310,
+ 311, 312, 313, 314, 315, 316, 317, 318,
+ 319 /* 73 elements */
+ },
+ {
+ 0, 1, 1, 2, 3, 4, 1, 5,
+ 4, 3, 5, 8, 6, 9, 10, 11,
+ 12, 7, 104, 14, 105, 4, 10, 15,
+ 11, 6, 14, 8, 106, 107, 108, 15,
+ 109, 9, 55, 10, 1, 2, 1, 2,
+ 3, 12, 6, 2, 6, 7, 28, 7,
+ 15, 8, 5, 18, 29, 152, 77, 24,
+ 25, 26, 39, 108, 13, 109, 55, 56,
+ 57, 116, 11, 153, 234, 235, 118, 119,
+ 15 /* 73 elements */
+ }
+};
+const uint8_t ff_vc1_mv_diff_bits[4][73] = {
+ {
+ 6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9,
+ 10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14,
+ 13, 13, 13, 6, 3, 5, 6, 8, 9, 13, 5, 4, 4, 5, 7, 9,
+ 6, 5, 5, 5, 6, 9, 8, 5, 5, 5, 7, 10, 7, 7, 7, 7,
+ 7, 8, 10, 9, 8, 9, 9, 9, 3 /* 73 elements */
+ },
+ {
+ 5, 7, 7, 6, 6, 5, 5, 6, 7, 5, 7, 8, 8, 8, 14, 9,
+ 9, 9, 8, 14, 14, 9, 9, 14, 9, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 2, 3, 6, 8, 8, 6, 3, 4, 6, 8, 6, 9,
+ 6, 6, 6, 8, 8, 8, 14, 7, 7, 8, 7, 9, 13, 9, 8, 9,
+ 13, 9, 13, 13, 13, 13, 13, 13, 5 /* 73 elements */
+
+ },
+ {
+ 3, 12, 12, 12, 12, 3, 4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 1, 5, 11, 11, 11, 11, 4, 4, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11 /* 73 elements */
+ },
+ {
+ 15, 11, 15, 15, 15, 15, 12, 15, 12, 11, 12, 12, 15, 12, 12, 12,
+ 12, 15, 15, 12, 15, 10, 11, 12, 11, 10, 11, 10, 15, 15, 15, 11,
+ 15, 10, 14, 10, 4, 4, 5, 7, 8, 9, 5, 3, 4, 5, 6, 8,
+ 5, 4, 3, 5, 6, 8, 7, 5, 5, 5, 6, 7, 9, 7, 6, 6,
+ 6, 7, 10, 8, 8, 8, 7, 7, 4 /* 73 elements */
+ }
};
/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
@@ -596,77 +565,76 @@ const uint8_t ff_vc1_mv_diff_bits[4][73] =
/* Table 232 */
const int8_t ff_vc1_simple_progressive_4x4_zz [16] =
{
- 0, 8, 16, 1,
- 9, 24, 17, 2,
- 10, 18, 25, 3,
- 11, 26, 19, 27
+ 0, 8, 16, 1,
+ 9, 24, 17, 2,
+ 10, 18, 25, 3,
+ 11, 26, 19, 27
};
const int8_t ff_vc1_adv_progressive_8x4_zz [32] = /* Table 233 */
{
- 0, 8, 1, 16, 2, 9, 10, 3,
- 24, 17, 4, 11, 18, 12, 5, 19,
- 25, 13, 20, 26, 27, 6, 21, 28,
- 14, 22, 29, 7, 30, 15, 23, 31
+ 0, 8, 1, 16, 2, 9, 10, 3,
+ 24, 17, 4, 11, 18, 12, 5, 19,
+ 25, 13, 20, 26, 27, 6, 21, 28,
+ 14, 22, 29, 7, 30, 15, 23, 31
};
const int8_t ff_vc1_adv_progressive_4x8_zz [32] = /* Table 234 */
{
- 0, 1, 8, 2,
- 9, 16, 17, 24,
- 10, 32, 25, 18,
- 40, 3, 33, 26,
- 48, 11, 56, 41,
- 34, 49, 57, 42,
- 19, 50, 27, 58,
- 35, 43, 51, 59
+ 0, 1, 8, 2,
+ 9, 16, 17, 24,
+ 10, 32, 25, 18,
+ 40, 3, 33, 26,
+ 48, 11, 56, 41,
+ 34, 49, 57, 42,
+ 19, 50, 27, 58,
+ 35, 43, 51, 59
};
const int8_t ff_vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */
{
- 0, 8, 1, 16, 24, 9, 2, 32,
- 40, 48, 56, 17, 10, 3, 25, 18,
- 11, 4, 33, 41, 49, 57, 26, 34,
- 42, 50, 58, 19, 12, 5, 27, 20,
- 13, 6, 35, 28, 21, 14, 7, 15,
- 22, 29, 36, 43, 51, 59, 60, 52,
- 44, 37, 30, 23, 31, 38, 45, 53,
- 61, 62, 54, 46, 39, 47, 55, 63
+ 0, 8, 1, 16, 24, 9, 2, 32,
+ 40, 48, 56, 17, 10, 3, 25, 18,
+ 11, 4, 33, 41, 49, 57, 26, 34,
+ 42, 50, 58, 19, 12, 5, 27, 20,
+ 13, 6, 35, 28, 21, 14, 7, 15,
+ 22, 29, 36, 43, 51, 59, 60, 52,
+ 44, 37, 30, 23, 31, 38, 45, 53,
+ 61, 62, 54, 46, 39, 47, 55, 63
};
const int8_t ff_vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */
{
- 0, 8, 16, 24, 1, 9, 2, 17,
- 25, 10, 3, 18, 26, 4, 11, 19,
- 12, 5, 13, 20, 27, 6, 21, 28,
- 14, 22, 29, 7, 30, 15, 23, 31
+ 0, 8, 16, 24, 1, 9, 2, 17,
+ 25, 10, 3, 18, 26, 4, 11, 19,
+ 12, 5, 13, 20, 27, 6, 21, 28,
+ 14, 22, 29, 7, 30, 15, 23, 31
};
const int8_t ff_vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */
{
- 0, 1, 2, 8,
- 16, 9, 24, 17,
- 10, 3, 32, 40,
- 48, 56, 25, 18,
- 33, 26, 41, 34,
- 49, 57, 11, 42,
- 19, 50, 27, 58,
- 35, 43, 51, 59
+ 0, 1, 2, 8,
+ 16, 9, 24, 17,
+ 10, 3, 32, 40,
+ 48, 56, 25, 18,
+ 33, 26, 41, 34,
+ 49, 57, 11, 42,
+ 19, 50, 27, 58,
+ 35, 43, 51, 59
};
const int8_t ff_vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */
{
- 0, 8, 16, 24,
- 1, 9, 17, 2,
- 25, 10, 18, 3,
- 26, 11, 19, 27
+ 0, 8, 16, 24,
+ 1, 9, 17, 2,
+ 25, 10, 18, 3,
+ 26, 11, 19, 27
};
/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
-const int32_t ff_vc1_dqscale[63] =
-{
- 0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
+const int32_t ff_vc1_dqscale[63] = {
+0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000,
0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB,
0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dec.c
index 190791789..c38c494c1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dec.c
@@ -47,9 +47,8 @@
static const uint16_t table_mb_intra[64][2];
-static const uint16_t vlc_offs[] =
-{
- 0, 520, 552, 616, 1128, 1160, 1224, 1740, 1772, 1836, 1900, 2436,
+static const uint16_t vlc_offs[] = {
+ 0, 520, 552, 616, 1128, 1160, 1224, 1740, 1772, 1836, 1900, 2436,
2986, 3050, 3610, 4154, 4218, 4746, 5326, 5390, 5902, 6554, 7658, 8620,
9262, 10202, 10756, 11310, 12228, 15078
};
@@ -71,18 +70,18 @@ static int vc1_init_common(VC1Context *v)
if(!done)
{
INIT_VLC_STATIC(&ff_vc1_bfraction_vlc, VC1_BFRACTION_VLC_BITS, 23,
- ff_vc1_bfraction_bits, 1, 1,
- ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS);
+ ff_vc1_bfraction_bits, 1, 1,
+ ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS);
INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
- ff_vc1_norm2_bits, 1, 1,
- ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS);
+ ff_vc1_norm2_bits, 1, 1,
+ ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS);
INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
- ff_vc1_norm6_bits, 1, 1,
- ff_vc1_norm6_codes, 2, 2, 556);
+ ff_vc1_norm6_bits, 1, 1,
+ ff_vc1_norm6_codes, 2, 2, 556);
INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
- ff_vc1_imode_bits, 1, 1,
- ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS);
- for(i = 0; i < 3; i++)
+ ff_vc1_imode_bits, 1, 1,
+ ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS);
+ for (i=0; i<3; i++)
{
ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i*3+0]];
ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i*3+1] - vlc_offs[i*3+0];
@@ -100,7 +99,7 @@ static int vc1_init_common(VC1Context *v)
ff_vc1_subblkpat_bits[i], 1, 1,
ff_vc1_subblkpat_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < 4; i++)
+ for(i=0; i<4; i++)
{
ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i*3+9]];
ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i*3+10] - vlc_offs[i*3+9];
@@ -118,8 +117,7 @@ static int vc1_init_common(VC1Context *v)
ff_vc1_mv_diff_bits[i], 1, 1,
ff_vc1_mv_diff_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
}
- for(i = 0; i < 8; i++)
- {
+ for(i=0; i<8; i++){
ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i+21]];
ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i+22] - vlc_offs[i+21];
init_vlc(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, vc1_ac_sizes[i],
@@ -147,8 +145,7 @@ static int vc1_init_common(VC1Context *v)
* Imode types
* @{
*/
-enum Imode
-{
+enum Imode {
IMODE_RAW,
IMODE_NORM2,
IMODE_DIFF2,
@@ -167,11 +164,10 @@ static void vc1_loop_filter_iblk(MpegEncContext *s, int pq)
int i, j;
if(!s->first_slice_line)
s->dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq);
- s->dsp.vc1_v_loop_filter16(s->dest[0] + 8 * s->linesize, s->linesize, pq);
- for(i = !s->mb_x * 8; i < 16; i += 8)
+ s->dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq);
+ for(i = !s->mb_x*8; i < 16; i += 8)
s->dsp.vc1_h_loop_filter16(s->dest[0] + i, s->linesize, pq);
- for(j = 0; j < 2; j++)
- {
+ for(j = 0; j < 2; j++){
if(!s->first_slice_line)
s->dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq);
if(s->mb_x)
@@ -187,8 +183,7 @@ static void vc1_put_block(VC1Context *v, DCTELEM block[6][64])
int ys, us, vs;
DSPContext *dsp = &v->s.dsp;
- if(v->rangeredfrm)
- {
+ if(v->rangeredfrm) {
int i, j, k;
for(k = 0; k < 6; k++)
for(j = 0; j < 8; j++)
@@ -207,8 +202,7 @@ static void vc1_put_block(VC1Context *v, DCTELEM block[6][64])
dsp->put_pixels_clamped(block[2], Y, ys);
dsp->put_pixels_clamped(block[3], Y + 8, ys);
- if(!(v->s.flags & CODEC_FLAG_GRAY))
- {
+ if(!(v->s.flags & CODEC_FLAG_GRAY)) {
dsp->put_pixels_clamped(block[4], v->s.dest[1], us);
dsp->put_pixels_clamped(block[5], v->s.dest[2], vs);
}
@@ -230,26 +224,21 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
my = s->mv[dir][0][1];
// store motion vectors for further use in B frames
- if(s->pict_type == FF_P_TYPE)
- {
+ if(s->pict_type == FF_P_TYPE) {
s->current_picture.motion_val[1][s->block_index[0]][0] = mx;
s->current_picture.motion_val[1][s->block_index[0]][1] = my;
}
uvmx = (mx + ((mx & 3) == 3)) >> 1;
uvmy = (my + ((my & 3) == 3)) >> 1;
- if(v->fastuvmc)
- {
- uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1));
- uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1));
+ if(v->fastuvmc) {
+ uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
+ uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
}
- if(!dir)
- {
+ if(!dir) {
srcY = s->last_picture.data[0];
srcU = s->last_picture.data[1];
srcV = s->last_picture.data[2];
- }
- else
- {
+ } else {
srcY = s->next_picture.data[0];
srcU = s->next_picture.data[1];
srcV = s->next_picture.data[2];
@@ -260,17 +249,14 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
- if(v->profile != PROFILE_ADVANCED)
- {
- src_x = av_clip(src_x, -16, s->mb_width * 16);
- src_y = av_clip(src_y, -16, s->mb_height * 16);
+ if(v->profile != PROFILE_ADVANCED){
+ src_x = av_clip( src_x, -16, s->mb_width * 16);
+ src_y = av_clip( src_y, -16, s->mb_height * 16);
uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8);
uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8);
- }
- else
- {
- src_x = av_clip(src_x, -17, s->avctx->coded_width);
- src_y = av_clip(src_y, -18, s->avctx->coded_height + 1);
+ }else{
+ src_x = av_clip( src_x, -17, s->avctx->coded_width);
+ src_y = av_clip( src_y, -18, s->avctx->coded_height + 1);
uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1);
uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1);
}
@@ -280,46 +266,39 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
/* for grayscale we should not try to read from unknown area */
- if(s->flags & CODEC_FLAG_GRAY)
- {
+ if(s->flags & CODEC_FLAG_GRAY) {
srcU = s->edge_emu_buffer + 18 * s->linesize;
srcV = s->edge_emu_buffer + 18 * s->linesize;
}
if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
- || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 16 - s->mspel * 3
- || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my & 3) - 16 - s->mspel * 3)
- {
- uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
+ || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3
+ || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 16 - s->mspel*3){
+ uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize;
srcY -= s->mspel * (1 + s->linesize);
- ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17 + s->mspel * 2, 17 + s->mspel * 2,
+ ff_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, s->v_edge_pos);
srcY = s->edge_emu_buffer;
- ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8 + 1, 8 + 1,
+ ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1,
+ ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
srcU = uvbuf;
srcV = uvbuf + 16;
/* if we deal with range reduction we need to scale source blocks */
- if(v->rangeredfrm)
- {
+ if(v->rangeredfrm) {
int i, j;
uint8_t *src, *src2;
src = srcY;
- for(j = 0; j < 17 + s->mspel * 2; j++)
- {
- for(i = 0; i < 17 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
+ for(j = 0; j < 17 + s->mspel*2; j++) {
+ for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
src += s->linesize;
}
- src = srcU;
- src2 = srcV;
- for(j = 0; j < 9; j++)
- {
- for(i = 0; i < 9; i++)
- {
+ src = srcU; src2 = srcV;
+ for(j = 0; j < 9; j++) {
+ for(i = 0; i < 9; i++) {
src[i] = ((src[i] - 128) >> 1) + 128;
src2[i] = ((src2[i] - 128) >> 1) + 128;
}
@@ -328,23 +307,18 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
}
}
/* if we deal with intensity compensation we need to scale source blocks */
- if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
- {
+ if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
int i, j;
uint8_t *src, *src2;
src = srcY;
- for(j = 0; j < 17 + s->mspel * 2; j++)
- {
- for(i = 0; i < 17 + s->mspel * 2; i++) src[i] = v->luty[src[i]];
+ for(j = 0; j < 17 + s->mspel*2; j++) {
+ for(i = 0; i < 17 + s->mspel*2; i++) src[i] = v->luty[src[i]];
src += s->linesize;
}
- src = srcU;
- src2 = srcV;
- for(j = 0; j < 9; j++)
- {
- for(i = 0; i < 9; i++)
- {
+ src = srcU; src2 = srcV;
+ for(j = 0; j < 9; j++) {
+ for(i = 0; i < 9; i++) {
src[i] = v->lutuv[src[i]];
src2[i] = v->lutuv[src2[i]];
}
@@ -355,17 +329,14 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
srcY += s->mspel * (1 + s->linesize);
}
- if(s->mspel)
- {
+ if(s->mspel) {
dxy = ((my & 3) << 2) | (mx & 3);
dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd);
dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
srcY += s->linesize * 8;
dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd);
dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
- }
- else // hpel mc - always used for luma
- {
+ } else { // hpel mc - always used for luma
dxy = (my & 2) | ((mx & 2) >> 1);
if(!v->rnd)
@@ -376,15 +347,12 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
if(s->flags & CODEC_FLAG_GRAY) return;
/* Chroma MC always uses qpel bilinear */
- uvmx = (uvmx & 3) << 1;
- uvmy = (uvmy & 3) << 1;
- if(!v->rnd)
- {
+ uvmx = (uvmx&3)<<1;
+ uvmy = (uvmy&3)<<1;
+ if(!v->rnd){
dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
- }
- else
- {
+ }else{
dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
}
@@ -405,68 +373,57 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n)
my = s->mv[0][n][1];
srcY = s->last_picture.data[0];
- off = s->linesize * 4 * (n & 2) + (n & 1) * 8;
+ off = s->linesize * 4 * (n&2) + (n&1) * 8;
- src_x = s->mb_x * 16 + (n & 1) * 8 + (mx >> 2);
- src_y = s->mb_y * 16 + (n & 2) * 4 + (my >> 2);
+ src_x = s->mb_x * 16 + (n&1) * 8 + (mx >> 2);
+ src_y = s->mb_y * 16 + (n&2) * 4 + (my >> 2);
- if(v->profile != PROFILE_ADVANCED)
- {
- src_x = av_clip(src_x, -16, s->mb_width * 16);
- src_y = av_clip(src_y, -16, s->mb_height * 16);
- }
- else
- {
- src_x = av_clip(src_x, -17, s->avctx->coded_width);
- src_y = av_clip(src_y, -18, s->avctx->coded_height + 1);
+ if(v->profile != PROFILE_ADVANCED){
+ src_x = av_clip( src_x, -16, s->mb_width * 16);
+ src_y = av_clip( src_y, -16, s->mb_height * 16);
+ }else{
+ src_x = av_clip( src_x, -17, s->avctx->coded_width);
+ src_y = av_clip( src_y, -18, s->avctx->coded_height + 1);
}
srcY += src_y * s->linesize + src_x;
if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
- || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 8 - s->mspel * 2
- || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my & 3) - 8 - s->mspel * 2)
- {
+ || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2
+ || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){
srcY -= s->mspel * (1 + s->linesize);
- ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9 + s->mspel * 2, 9 + s->mspel * 2,
+ ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2,
src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
srcY = s->edge_emu_buffer;
/* if we deal with range reduction we need to scale source blocks */
- if(v->rangeredfrm)
- {
+ if(v->rangeredfrm) {
int i, j;
uint8_t *src;
src = srcY;
- for(j = 0; j < 9 + s->mspel * 2; j++)
- {
- for(i = 0; i < 9 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
+ for(j = 0; j < 9 + s->mspel*2; j++) {
+ for(i = 0; i < 9 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
src += s->linesize;
}
}
/* if we deal with intensity compensation we need to scale source blocks */
- if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
- {
+ if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
int i, j;
uint8_t *src;
src = srcY;
- for(j = 0; j < 9 + s->mspel * 2; j++)
- {
- for(i = 0; i < 9 + s->mspel * 2; i++) src[i] = v->luty[src[i]];
+ for(j = 0; j < 9 + s->mspel*2; j++) {
+ for(i = 0; i < 9 + s->mspel*2; i++) src[i] = v->luty[src[i]];
src += s->linesize;
}
}
srcY += s->mspel * (1 + s->linesize);
}
- if(s->mspel)
- {
+ if(s->mspel) {
dxy = ((my & 3) << 2) | (mx & 3);
dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd);
- }
- else // hpel mc - always used for luma
- {
+ } else { // hpel mc - always used for luma
dxy = (my & 2) | ((mx & 2) >> 1);
if(!v->rnd)
dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8);
@@ -477,13 +434,10 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n)
static inline int median4(int a, int b, int c, int d)
{
- if(a < b)
- {
+ if(a < b) {
if(c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2;
else return (FFMIN(b, c) + FFMAX(a, d)) / 2;
- }
- else
- {
+ } else {
if(c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2;
else return (FFMIN(a, c) + FFMAX(b, d)) / 2;
}
@@ -505,8 +459,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
if(!v->s.last_picture.data[0])return;
if(s->flags & CODEC_FLAG_GRAY) return;
- for(i = 0; i < 4; i++)
- {
+ for(i = 0; i < 4; i++) {
mvx[i] = s->mv[0][i][0];
mvy[i] = s->mv[0][i][1];
intra[i] = v->mb_type[0][s->block_index[i]];
@@ -514,15 +467,11 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
/* calculate chroma MV vector from four luma MVs */
idx = (intra[3] << 3) | (intra[2] << 2) | (intra[1] << 1) | intra[0];
- if(!idx) // all blocks are inter
- {
+ if(!idx) { // all blocks are inter
tx = median4(mvx[0], mvx[1], mvx[2], mvx[3]);
ty = median4(mvy[0], mvy[1], mvy[2], mvy[3]);
- }
- else if(count[idx] == 1) // 3 inter blocks
- {
- switch(idx)
- {
+ } else if(count[idx] == 1) { // 3 inter blocks
+ switch(idx) {
case 0x1:
tx = mid_pred(mvx[1], mvx[2], mvx[3]);
ty = mid_pred(mvy[1], mvy[2], mvy[3]);
@@ -540,25 +489,13 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
ty = mid_pred(mvy[0], mvy[1], mvy[2]);
break;
}
- }
- else if(count[idx] == 2)
- {
+ } else if(count[idx] == 2) {
int t1 = 0, t2 = 0;
- for(i = 0; i < 3; i++) if(!intra[i])
- {
- t1 = i;
- break;
- }
- for(i = t1 + 1; i < 4; i++)if(!intra[i])
- {
- t2 = i;
- break;
- }
+ for(i=0; i<3;i++) if(!intra[i]) {t1 = i; break;}
+ for(i= t1+1; i<4; i++)if(!intra[i]) {t2 = i; break;}
tx = (mvx[t1] + mvx[t2]) / 2;
ty = (mvy[t1] + mvy[t2]) / 2;
- }
- else
- {
+ } else {
s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
return; //no need to do MC for inter blocks
@@ -566,24 +503,20 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
s->current_picture.motion_val[1][s->block_index[0]][0] = tx;
s->current_picture.motion_val[1][s->block_index[0]][1] = ty;
- uvmx = (tx + ((tx & 3) == 3)) >> 1;
- uvmy = (ty + ((ty & 3) == 3)) >> 1;
- if(v->fastuvmc)
- {
- uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1));
- uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1));
+ uvmx = (tx + ((tx&3) == 3)) >> 1;
+ uvmy = (ty + ((ty&3) == 3)) >> 1;
+ if(v->fastuvmc) {
+ uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
+ uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
}
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
- if(v->profile != PROFILE_ADVANCED)
- {
+ if(v->profile != PROFILE_ADVANCED){
uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8);
uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8);
- }
- else
- {
+ }else{
uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1);
uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1);
}
@@ -592,27 +525,22 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x;
if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
|| (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
- || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9)
- {
- ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8 + 1, 8 + 1,
+ || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){
+ ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1,
+ ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
srcU = s->edge_emu_buffer;
srcV = s->edge_emu_buffer + 16;
/* if we deal with range reduction we need to scale source blocks */
- if(v->rangeredfrm)
- {
+ if(v->rangeredfrm) {
int i, j;
uint8_t *src, *src2;
- src = srcU;
- src2 = srcV;
- for(j = 0; j < 9; j++)
- {
- for(i = 0; i < 9; i++)
- {
+ src = srcU; src2 = srcV;
+ for(j = 0; j < 9; j++) {
+ for(i = 0; i < 9; i++) {
src[i] = ((src[i] - 128) >> 1) + 128;
src2[i] = ((src2[i] - 128) >> 1) + 128;
}
@@ -621,17 +549,13 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
}
}
/* if we deal with intensity compensation we need to scale source blocks */
- if(v->mv_mode == MV_PMODE_INTENSITY_COMP)
- {
+ if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
int i, j;
uint8_t *src, *src2;
- src = srcU;
- src2 = srcV;
- for(j = 0; j < 9; j++)
- {
- for(i = 0; i < 9; i++)
- {
+ src = srcU; src2 = srcV;
+ for(j = 0; j < 9; j++) {
+ for(i = 0; i < 9; i++) {
src[i] = v->lutuv[src[i]];
src2[i] = v->lutuv[src2[i]];
}
@@ -642,15 +566,12 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
}
/* Chroma MC always uses qpel bilinear */
- uvmx = (uvmx & 3) << 1;
- uvmy = (uvmy & 3) << 1;
- if(!v->rnd)
- {
+ uvmx = (uvmx&3)<<1;
+ uvmy = (uvmy&3)<<1;
+ if(!v->rnd){
dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
- }
- else
- {
+ }else{
dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
}
@@ -766,14 +687,12 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i
wrap = s->b8_stride;
xy = s->block_index[n];
- if(s->mb_intra)
- {
+ if(s->mb_intra){
s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0;
s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0;
s->current_picture.motion_val[1][xy][0] = 0;
s->current_picture.motion_val[1][xy][1] = 0;
- if(mv1) /* duplicate motion data for 1-MV block */
- {
+ if(mv1) { /* duplicate motion data for 1-MV block */
s->current_picture.motion_val[0][xy + 1][0] = 0;
s->current_picture.motion_val[0][xy + 1][1] = 0;
s->current_picture.motion_val[0][xy + wrap][0] = 0;
@@ -794,11 +713,9 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i
A = s->current_picture.motion_val[0][xy - wrap];
if(mv1)
off = (s->mb_x == (s->mb_width - 1)) ? -1 : 2;
- else
- {
+ else {
//in 4-MV mode different blocks have different B predictor position
- switch(n)
- {
+ switch(n){
case 0:
off = (s->mb_x > 0) ? -1 : 1;
break;
@@ -814,42 +731,31 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i
}
B = s->current_picture.motion_val[0][xy - wrap + off];
- if(!s->first_slice_line || (n == 2 || n == 3)) // predictor A is not out of bounds
- {
- if(s->mb_width == 1)
- {
+ if(!s->first_slice_line || (n==2 || n==3)) { // predictor A is not out of bounds
+ if(s->mb_width == 1) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = mid_pred(A[0], B[0], C[0]);
py = mid_pred(A[1], B[1], C[1]);
}
- }
- else if(s->mb_x || (n == 1 || n == 3)) // predictor C is not out of bounds
- {
+ } else if(s->mb_x || (n==1 || n==3)) { // predictor C is not out of bounds
px = C[0];
py = C[1];
- }
- else
- {
+ } else {
px = py = 0;
}
/* Pullback MV as specified in 8.3.5.3.4 */
{
int qx, qy, X, Y;
- qx = (s->mb_x << 6) + ((n == 1 || n == 3) ? 32 : 0);
- qy = (s->mb_y << 6) + ((n == 2 || n == 3) ? 32 : 0);
+ qx = (s->mb_x << 6) + ((n==1 || n==3) ? 32 : 0);
+ qy = (s->mb_y << 6) + ((n==2 || n==3) ? 32 : 0);
X = (s->mb_width << 6) - 4;
Y = (s->mb_height << 6) - 4;
- if(mv1)
- {
+ if(mv1) {
if(qx + px < -60) px = -60 - qx;
if(qy + py < -60) py = -60 - qy;
- }
- else
- {
+ } else {
if(qx + px < -28) px = -28 - qx;
if(qy + py < -28) py = -28 - qy;
}
@@ -857,40 +763,29 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i
if(qy + py > Y) py = Y - qy;
}
/* Calculate hybrid prediction as specified in 8.3.5.3.5 */
- if((!s->first_slice_line || (n == 2 || n == 3)) && (s->mb_x || (n == 1 || n == 3)))
- {
+ if((!s->first_slice_line || (n==2 || n==3)) && (s->mb_x || (n==1 || n==3))) {
if(is_intra[xy - wrap])
sum = FFABS(px) + FFABS(py);
else
sum = FFABS(px - A[0]) + FFABS(py - A[1]);
- if(sum > 32)
- {
- if(get_bits1(&s->gb))
- {
+ if(sum > 32) {
+ if(get_bits1(&s->gb)) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = C[0];
py = C[1];
}
- }
- else
- {
+ } else {
if(is_intra[xy - 1])
sum = FFABS(px) + FFABS(py);
else
sum = FFABS(px - C[0]) + FFABS(py - C[1]);
- if(sum > 32)
- {
- if(get_bits1(&s->gb))
- {
+ if(sum > 32) {
+ if(get_bits1(&s->gb)) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = C[0];
py = C[1];
}
@@ -900,8 +795,7 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i
/* store MV using signed modulus of MV range defined in 4.11 */
s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x;
s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y;
- if(mv1) /* duplicate motion data for 1-MV block */
- {
+ if(mv1) { /* duplicate motion data for 1-MV block */
s->current_picture.motion_val[0][xy + 1][0] = s->current_picture.motion_val[0][xy][0];
s->current_picture.motion_val[0][xy + 1][1] = s->current_picture.motion_val[0][xy][1];
s->current_picture.motion_val[0][xy + wrap][0] = s->current_picture.motion_val[0][xy][0];
@@ -926,10 +820,9 @@ static void vc1_interp_mc(VC1Context *v)
my = s->mv[1][0][1];
uvmx = (mx + ((mx & 3) == 3)) >> 1;
uvmy = (my + ((my & 3) == 3)) >> 1;
- if(v->fastuvmc)
- {
- uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1));
- uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1));
+ if(v->fastuvmc) {
+ uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1));
+ uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1));
}
srcY = s->next_picture.data[0];
srcU = s->next_picture.data[1];
@@ -940,17 +833,14 @@ static void vc1_interp_mc(VC1Context *v)
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
- if(v->profile != PROFILE_ADVANCED)
- {
- src_x = av_clip(src_x, -16, s->mb_width * 16);
- src_y = av_clip(src_y, -16, s->mb_height * 16);
+ if(v->profile != PROFILE_ADVANCED){
+ src_x = av_clip( src_x, -16, s->mb_width * 16);
+ src_y = av_clip( src_y, -16, s->mb_height * 16);
uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8);
uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8);
- }
- else
- {
- src_x = av_clip(src_x, -17, s->avctx->coded_width);
- src_y = av_clip(src_y, -18, s->avctx->coded_height + 1);
+ }else{
+ src_x = av_clip( src_x, -17, s->avctx->coded_width);
+ src_y = av_clip( src_y, -18, s->avctx->coded_height + 1);
uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1);
uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1);
}
@@ -960,46 +850,39 @@ static void vc1_interp_mc(VC1Context *v)
srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
/* for grayscale we should not try to read from unknown area */
- if(s->flags & CODEC_FLAG_GRAY)
- {
+ if(s->flags & CODEC_FLAG_GRAY) {
srcU = s->edge_emu_buffer + 18 * s->linesize;
srcV = s->edge_emu_buffer + 18 * s->linesize;
}
if(v->rangeredfrm
- || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 16 - s->mspel * 3
- || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my & 3) - 16 - s->mspel * 3)
- {
- uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
+ || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3
+ || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 16 - s->mspel*3){
+ uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize;
srcY -= s->mspel * (1 + s->linesize);
- ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17 + s->mspel * 2, 17 + s->mspel * 2,
+ ff_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, s->v_edge_pos);
srcY = s->edge_emu_buffer;
- ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8 + 1, 8 + 1,
+ ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1,
+ ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
srcU = uvbuf;
srcV = uvbuf + 16;
/* if we deal with range reduction we need to scale source blocks */
- if(v->rangeredfrm)
- {
+ if(v->rangeredfrm) {
int i, j;
uint8_t *src, *src2;
src = srcY;
- for(j = 0; j < 17 + s->mspel * 2; j++)
- {
- for(i = 0; i < 17 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
+ for(j = 0; j < 17 + s->mspel*2; j++) {
+ for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
src += s->linesize;
}
- src = srcU;
- src2 = srcV;
- for(j = 0; j < 9; j++)
- {
- for(i = 0; i < 9; i++)
- {
+ src = srcU; src2 = srcV;
+ for(j = 0; j < 9; j++) {
+ for(i = 0; i < 9; i++) {
src[i] = ((src[i] - 128) >> 1) + 128;
src2[i] = ((src2[i] - 128) >> 1) + 128;
}
@@ -1010,17 +893,14 @@ static void vc1_interp_mc(VC1Context *v)
srcY += s->mspel * (1 + s->linesize);
}
- if(s->mspel)
- {
+ if(s->mspel) {
dxy = ((my & 3) << 2) | (mx & 3);
dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd);
dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
srcY += s->linesize * 8;
dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd);
dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
- }
- else // hpel mc
- {
+ } else { // hpel mc
dxy = (my & 2) | ((mx & 2) >> 1);
if(!v->rnd)
@@ -1031,15 +911,12 @@ static void vc1_interp_mc(VC1Context *v)
if(s->flags & CODEC_FLAG_GRAY) return;
/* Chroma MC always uses qpel blilinear */
- uvmx = (uvmx & 3) << 1;
- uvmy = (uvmy & 3) << 1;
- if(!v->rnd)
- {
+ uvmx = (uvmx&3)<<1;
+ uvmy = (uvmy&3)<<1;
+ if(!v->rnd){
dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
- }
- else
- {
+ }else{
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
}
@@ -1060,7 +937,7 @@ static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs)
n -= B_FRACTION_DEN;
if(!qs)
return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN));
- return (value * n + B_FRACTION_DEN / 2) / B_FRACTION_DEN;
+ return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN;
#endif
}
@@ -1068,20 +945,17 @@ static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs)
*/
static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mode)
{
- if(v->use_ic)
- {
+ if(v->use_ic) {
v->mv_mode2 = v->mv_mode;
v->mv_mode = MV_PMODE_INTENSITY_COMP;
}
- if(direct)
- {
+ if(direct) {
vc1_mc_1mv(v, 0);
vc1_interp_mc(v);
if(v->use_ic) v->mv_mode = v->mv_mode2;
return;
}
- if(mode == BMV_TYPE_INTERPOLATED)
- {
+ if(mode == BMV_TYPE_INTERPOLATED) {
vc1_mc_1mv(v, 0);
vc1_interp_mc(v);
if(v->use_ic) v->mv_mode = v->mv_mode2;
@@ -1114,12 +988,11 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
wrap = s->b8_stride;
xy = s->block_index[0];
- if(s->mb_intra)
- {
+ if(s->mb_intra) {
s->current_picture.motion_val[0][xy][0] =
- s->current_picture.motion_val[0][xy][1] =
- s->current_picture.motion_val[1][xy][0] =
- s->current_picture.motion_val[1][xy][1] = 0;
+ s->current_picture.motion_val[0][xy][1] =
+ s->current_picture.motion_val[1][xy][0] =
+ s->current_picture.motion_val[1][xy][1] = 0;
return;
}
s->mv[0][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample);
@@ -1132,8 +1005,7 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
s->mv[0][0][1] = av_clip(s->mv[0][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6));
s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6));
s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6));
- if(direct)
- {
+ if(direct) {
s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0];
s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1];
s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0];
@@ -1141,41 +1013,31 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
return;
}
- if((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED))
- {
+ if((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) {
C = s->current_picture.motion_val[0][xy - 2];
A = s->current_picture.motion_val[0][xy - wrap*2];
off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2;
B = s->current_picture.motion_val[0][xy - wrap*2 + off];
if(!s->mb_x) C[0] = C[1] = 0;
- if(!s->first_slice_line) // predictor A is not out of bounds
- {
- if(s->mb_width == 1)
- {
+ if(!s->first_slice_line) { // predictor A is not out of bounds
+ if(s->mb_width == 1) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = mid_pred(A[0], B[0], C[0]);
py = mid_pred(A[1], B[1], C[1]);
}
- }
- else if(s->mb_x) // predictor C is not out of bounds
- {
+ } else if(s->mb_x) { // predictor C is not out of bounds
px = C[0];
py = C[1];
- }
- else
- {
+ } else {
px = py = 0;
}
/* Pullback MV as specified in 8.3.5.3.4 */
{
int qx, qy, X, Y;
- if(v->profile < PROFILE_ADVANCED)
- {
+ if(v->profile < PROFILE_ADVANCED) {
qx = (s->mb_x << 5);
qy = (s->mb_y << 5);
X = (s->mb_width << 5) - 4;
@@ -1184,9 +1046,7 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
if(qy + py < -28) py = -28 - qy;
if(qx + px > X) px = X - qx;
if(qy + py > Y) py = Y - qy;
- }
- else
- {
+ } else {
qx = (s->mb_x << 6);
qy = (s->mb_y << 6);
X = (s->mb_width << 6) - 4;
@@ -1198,40 +1058,29 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
}
}
/* Calculate hybrid prediction as specified in 8.3.5.3.5 */
- if(0 && !s->first_slice_line && s->mb_x)
- {
+ if(0 && !s->first_slice_line && s->mb_x) {
if(is_intra[xy - wrap])
sum = FFABS(px) + FFABS(py);
else
sum = FFABS(px - A[0]) + FFABS(py - A[1]);
- if(sum > 32)
- {
- if(get_bits1(&s->gb))
- {
+ if(sum > 32) {
+ if(get_bits1(&s->gb)) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = C[0];
py = C[1];
}
- }
- else
- {
+ } else {
if(is_intra[xy - 2])
sum = FFABS(px) + FFABS(py);
else
sum = FFABS(px - C[0]) + FFABS(py - C[1]);
- if(sum > 32)
- {
- if(get_bits1(&s->gb))
- {
+ if(sum > 32) {
+ if(get_bits1(&s->gb)) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = C[0];
py = C[1];
}
@@ -1242,41 +1091,31 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
s->mv[0][0][0] = ((px + dmv_x[0] + r_x) & ((r_x << 1) - 1)) - r_x;
s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y;
}
- if((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED))
- {
+ if((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) {
C = s->current_picture.motion_val[1][xy - 2];
A = s->current_picture.motion_val[1][xy - wrap*2];
off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2;
B = s->current_picture.motion_val[1][xy - wrap*2 + off];
if(!s->mb_x) C[0] = C[1] = 0;
- if(!s->first_slice_line) // predictor A is not out of bounds
- {
- if(s->mb_width == 1)
- {
+ if(!s->first_slice_line) { // predictor A is not out of bounds
+ if(s->mb_width == 1) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = mid_pred(A[0], B[0], C[0]);
py = mid_pred(A[1], B[1], C[1]);
}
- }
- else if(s->mb_x) // predictor C is not out of bounds
- {
+ } else if(s->mb_x) { // predictor C is not out of bounds
px = C[0];
py = C[1];
- }
- else
- {
+ } else {
px = py = 0;
}
/* Pullback MV as specified in 8.3.5.3.4 */
{
int qx, qy, X, Y;
- if(v->profile < PROFILE_ADVANCED)
- {
+ if(v->profile < PROFILE_ADVANCED) {
qx = (s->mb_x << 5);
qy = (s->mb_y << 5);
X = (s->mb_width << 5) - 4;
@@ -1285,9 +1124,7 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
if(qy + py < -28) py = -28 - qy;
if(qx + px > X) px = X - qx;
if(qy + py > Y) py = Y - qy;
- }
- else
- {
+ } else {
qx = (s->mb_x << 6);
qy = (s->mb_y << 6);
X = (s->mb_width << 6) - 4;
@@ -1299,40 +1136,29 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
}
}
/* Calculate hybrid prediction as specified in 8.3.5.3.5 */
- if(0 && !s->first_slice_line && s->mb_x)
- {
+ if(0 && !s->first_slice_line && s->mb_x) {
if(is_intra[xy - wrap])
sum = FFABS(px) + FFABS(py);
else
sum = FFABS(px - A[0]) + FFABS(py - A[1]);
- if(sum > 32)
- {
- if(get_bits1(&s->gb))
- {
+ if(sum > 32) {
+ if(get_bits1(&s->gb)) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = C[0];
py = C[1];
}
- }
- else
- {
+ } else {
if(is_intra[xy - 2])
sum = FFABS(px) + FFABS(py);
else
sum = FFABS(px - C[0]) + FFABS(py - C[1]);
- if(sum > 32)
- {
- if(get_bits1(&s->gb))
- {
+ if(sum > 32) {
+ if(get_bits1(&s->gb)) {
px = A[0];
py = A[1];
- }
- else
- {
+ } else {
px = C[0];
py = C[1];
}
@@ -1360,24 +1186,23 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int
* @param dir_ptr Prediction direction for use in AC prediction
*/
static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
- int16_t **dc_val_ptr, int *dir_ptr)
+ int16_t **dc_val_ptr, int *dir_ptr)
{
int a, b, c, wrap, pred, scale;
int16_t *dc_val;
- static const uint16_t dcpred[32] =
- {
- -1, 1024, 512, 341, 256, 205, 171, 146, 128,
- 114, 102, 93, 85, 79, 73, 68, 64,
- 60, 57, 54, 51, 49, 47, 45, 43,
- 41, 39, 38, 37, 35, 34, 33
+ static const uint16_t dcpred[32] = {
+ -1, 1024, 512, 341, 256, 205, 171, 146, 128,
+ 114, 102, 93, 85, 79, 73, 68, 64,
+ 60, 57, 54, 51, 49, 47, 45, 43,
+ 41, 39, 38, 37, 35, 34, 33
};
/* find prediction - wmv3_dc_scale always used here in fact */
- if(n < 4) scale = s->y_dc_scale;
+ if (n < 4) scale = s->y_dc_scale;
else scale = s->c_dc_scale;
wrap = s->block_wrap[n];
- dc_val = s->dc_val[0] + s->block_index[n];
+ dc_val= s->dc_val[0] + s->block_index[n];
/* B A
* C X
@@ -1386,26 +1211,23 @@ static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
b = dc_val[ - 1 - wrap];
a = dc_val[ - wrap];
- if(pq < 9 || !overlap)
+ if (pq < 9 || !overlap)
{
/* Set outer values */
- if(s->first_slice_line && (n != 2 && n != 3)) b = a = dcpred[scale];
- if(s->mb_x == 0 && (n != 1 && n != 3)) b = c = dcpred[scale];
+ if (s->first_slice_line && (n!=2 && n!=3)) b=a=dcpred[scale];
+ if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=dcpred[scale];
}
else
{
/* Set outer values */
- if(s->first_slice_line && (n != 2 && n != 3)) b = a = 0;
- if(s->mb_x == 0 && (n != 1 && n != 3)) b = c = 0;
+ if (s->first_slice_line && (n!=2 && n!=3)) b=a=0;
+ if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=0;
}
- if(abs(a - b) <= abs(b - c))
- {
+ if (abs(a - b) <= abs(b - c)) {
pred = c;
*dir_ptr = 1;//left
- }
- else
- {
+ } else {
pred = a;
*dir_ptr = 0;//top
}
@@ -1437,7 +1259,7 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
int q1, q2 = 0;
wrap = s->block_wrap[n];
- dc_val = s->dc_val[0] + s->block_index[n];
+ dc_val= s->dc_val[0] + s->block_index[n];
/* B A
* C X
@@ -1447,20 +1269,17 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
a = dc_val[ - wrap];
/* scale predictors if needed */
q1 = s->current_picture.qscale_table[mb_pos];
- if(c_avail && (n != 1 && n != 3))
- {
+ if(c_avail && (n!= 1 && n!=3)) {
q2 = s->current_picture.qscale_table[mb_pos - 1];
if(q2 && q2 != q1)
c = (c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
- if(a_avail && (n != 2 && n != 3))
- {
+ if(a_avail && (n!= 2 && n!=3)) {
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
if(q2 && q2 != q1)
a = (a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
- if(a_avail && c_avail && (n != 3))
- {
+ if(a_avail && c_avail && (n!=3)) {
int off = mb_pos;
if(n != 1) off--;
if(n != 2) off -= s->mb_stride;
@@ -1469,31 +1288,21 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
b = (b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
}
- if(a_avail && c_avail)
- {
- if(abs(a - b) <= abs(b - c))
- {
+ if(a_avail && c_avail) {
+ if(abs(a - b) <= abs(b - c)) {
pred = c;
*dir_ptr = 1;//left
- }
- else
- {
+ } else {
pred = a;
*dir_ptr = 0;//top
}
- }
- else if(a_avail)
- {
+ } else if(a_avail) {
pred = a;
*dir_ptr = 0;//top
- }
- else if(c_avail)
- {
+ } else if(c_avail) {
pred = c;
*dir_ptr = 1;//left
- }
- else
- {
+ } else {
pred = 0;
*dir_ptr = 1;//left
}
@@ -1525,12 +1334,9 @@ static inline int vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **code
b = s->coded_block[xy - 1 - wrap];
c = s->coded_block[xy - wrap];
- if(b == c)
- {
+ if (b == c) {
pred = a;
- }
- else
- {
+ } else {
pred = c;
}
@@ -1555,32 +1361,25 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value,
int index, escape, run = 0, level = 0, lst = 0;
index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
- if(index != vc1_ac_sizes[codingset] - 1)
- {
+ if (index != vc1_ac_sizes[codingset] - 1) {
run = vc1_index_decode_table[codingset][index][0];
level = vc1_index_decode_table[codingset][index][1];
lst = index >= vc1_last_decode_table[codingset];
if(get_bits1(gb))
level = -level;
- }
- else
- {
+ } else {
escape = decode210(gb);
- if(escape != 2)
- {
+ if (escape != 2) {
index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
run = vc1_index_decode_table[codingset][index][0];
level = vc1_index_decode_table[codingset][index][1];
lst = index >= vc1_last_decode_table[codingset];
- if(escape == 0)
- {
+ if(escape == 0) {
if(lst)
level += vc1_last_delta_level_table[codingset][run];
else
level += vc1_delta_level_table[codingset][run];
- }
- else
- {
+ } else {
if(lst)
run += vc1_last_delta_run_table[codingset][level] + 1;
else
@@ -1588,21 +1387,15 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value,
}
if(get_bits1(gb))
level = -level;
- }
- else
- {
+ } else {
int sign;
lst = get_bits1(gb);
- if(v->s.esc3_level_length == 0)
- {
- if(v->pq < 8 || v->dquantfrm) // table 59
- {
+ if(v->s.esc3_level_length == 0) {
+ if(v->pq < 8 || v->dquantfrm) { // table 59
v->s.esc3_level_length = get_bits(gb, 3);
if(!v->s.esc3_level_length)
v->s.esc3_level_length = get_bits(gb, 2) + 8;
- }
- else //table 60
- {
+ } else { //table 60
v->s.esc3_level_length = get_unary(gb, 1, 6) + 2;
}
v->s.esc3_run_length = 3 + get_bits(gb, 2);
@@ -1638,36 +1431,32 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
int dcdiff;
/* Get DC differential */
- if(n < 4)
- {
+ if (n < 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
- }
- else
- {
+ } else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
- if(dcdiff < 0)
- {
+ if (dcdiff < 0){
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
- if(dcdiff)
+ if (dcdiff)
{
- if(dcdiff == 119 /* ESC index value */)
+ if (dcdiff == 119 /* ESC index value */)
{
/* TODO: Optimize */
- if(v->pq == 1) dcdiff = get_bits(gb, 10);
- else if(v->pq == 2) dcdiff = get_bits(gb, 9);
+ if (v->pq == 1) dcdiff = get_bits(gb, 10);
+ else if (v->pq == 2) dcdiff = get_bits(gb, 9);
else dcdiff = get_bits(gb, 8);
}
else
{
- if(v->pq == 1)
- dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3;
- else if(v->pq == 2)
- dcdiff = (dcdiff << 1) + get_bits1(gb) - 1;
+ if (v->pq == 1)
+ dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
+ else if (v->pq == 2)
+ dcdiff = (dcdiff<<1) + get_bits1(gb) - 1;
}
- if(get_bits1(gb))
+ if (get_bits1(gb))
dcdiff = -dcdiff;
}
@@ -1676,17 +1465,13 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
*dc_val = dcdiff;
/* Store the quantized DC coeff, used for prediction */
- if(n < 4)
- {
+ if (n < 4) {
block[0] = dcdiff * s->y_dc_scale;
- }
- else
- {
+ } else {
block[0] = dcdiff * s->c_dc_scale;
}
/* Skip ? */
- if(!coded)
- {
+ if (!coded) {
goto not_coded;
}
@@ -1701,14 +1486,12 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
scale = v->pq * 2 + v->halfpq;
- if(v->s.ac_pred)
- {
+ if(v->s.ac_pred) {
if(!dc_pred_dir)
zz_table = wmv1_scantable[2];
else
zz_table = wmv1_scantable[3];
- }
- else
+ } else
zz_table = wmv1_scantable[1];
ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
@@ -1718,8 +1501,7 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
else //top
ac_val -= 16 * s->block_wrap[n];
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
i += skip;
if(i > 63)
@@ -1728,30 +1510,24 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
}
/* apply AC prediction if needed */
- if(s->ac_pred)
- {
- if(dc_pred_dir) //left
- {
+ if(s->ac_pred) {
+ if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
block[k << 3] += ac_val[k];
- }
- else //top
- {
+ } else { //top
for(k = 1; k < 8; k++)
block[k] += ac_val[k + 8];
}
}
/* save AC coeffs for further prediction */
- for(k = 1; k < 8; k++)
- {
+ for(k = 1; k < 8; k++) {
ac_val2[k] = block[k << 3];
ac_val2[k + 8] = block[k];
}
/* scale AC coeffs */
for(k = 1; k < 64; k++)
- if(block[k])
- {
+ if(block[k]) {
block[k] *= scale;
if(!v->pquantizer)
block[k] += (block[k] < 0) ? -v->pq : v->pq;
@@ -1761,8 +1537,7 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
}
not_coded:
- if(!coded)
- {
+ if(!coded) {
int k, scale;
ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
ac_val2 = ac_val;
@@ -1770,35 +1545,26 @@ not_coded:
i = 0;
scale = v->pq * 2 + v->halfpq;
memset(ac_val2, 0, 16 * 2);
- if(dc_pred_dir) //left
- {
+ if(dc_pred_dir) {//left
ac_val -= 16;
if(s->ac_pred)
memcpy(ac_val2, ac_val, 8 * 2);
- }
- else //top
- {
+ } else {//top
ac_val -= 16 * s->block_wrap[n];
if(s->ac_pred)
memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
}
/* apply AC prediction if needed */
- if(s->ac_pred)
- {
- if(dc_pred_dir) //left
- {
- for(k = 1; k < 8; k++)
- {
+ if(s->ac_pred) {
+ if(dc_pred_dir) { //left
+ for(k = 1; k < 8; k++) {
block[k << 3] = ac_val[k] * scale;
if(!v->pquantizer && block[k << 3])
block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq;
}
- }
- else //top
- {
- for(k = 1; k < 8; k++)
- {
+ } else { //top
+ for(k = 1; k < 8; k++) {
block[k] = ac_val[k + 8] * scale;
if(!v->pquantizer && block[k])
block[k] += (block[k] < 0) ? -v->pq : v->pq;
@@ -1836,36 +1602,32 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
/* Get DC differential */
- if(n < 4)
- {
+ if (n < 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
- }
- else
- {
+ } else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
- if(dcdiff < 0)
- {
+ if (dcdiff < 0){
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
- if(dcdiff)
+ if (dcdiff)
{
- if(dcdiff == 119 /* ESC index value */)
+ if (dcdiff == 119 /* ESC index value */)
{
/* TODO: Optimize */
- if(mquant == 1) dcdiff = get_bits(gb, 10);
- else if(mquant == 2) dcdiff = get_bits(gb, 9);
+ if (mquant == 1) dcdiff = get_bits(gb, 10);
+ else if (mquant == 2) dcdiff = get_bits(gb, 9);
else dcdiff = get_bits(gb, 8);
}
else
{
- if(mquant == 1)
- dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3;
- else if(mquant == 2)
- dcdiff = (dcdiff << 1) + get_bits1(gb) - 1;
+ if (mquant == 1)
+ dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
+ else if (mquant == 2)
+ dcdiff = (dcdiff<<1) + get_bits1(gb) - 1;
}
- if(get_bits1(gb))
+ if (get_bits1(gb))
dcdiff = -dcdiff;
}
@@ -1874,12 +1636,9 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
*dc_val = dcdiff;
/* Store the quantized DC coeff, used for prediction */
- if(n < 4)
- {
+ if (n < 4) {
block[0] = dcdiff * s->y_dc_scale;
- }
- else
- {
+ } else {
block[0] = dcdiff * s->c_dc_scale;
}
@@ -1901,28 +1660,24 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
q1 = s->current_picture.qscale_table[mb_pos];
if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1];
if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
- if(dc_pred_dir && n == 1) q2 = q1;
- if(!dc_pred_dir && n == 2) q2 = q1;
- if(n == 3) q2 = q1;
+ if(dc_pred_dir && n==1) q2 = q1;
+ if(!dc_pred_dir && n==2) q2 = q1;
+ if(n==3) q2 = q1;
- if(coded)
- {
+ if(coded) {
int last = 0, skip, value;
const int8_t *zz_table;
int k;
- if(v->s.ac_pred)
- {
+ if(v->s.ac_pred) {
if(!dc_pred_dir)
zz_table = wmv1_scantable[2];
else
zz_table = wmv1_scantable[3];
- }
- else
+ } else
zz_table = wmv1_scantable[1];
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
i += skip;
if(i > 63)
@@ -1931,83 +1686,62 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
}
/* apply AC prediction if needed */
- if(use_pred)
- {
+ if(use_pred) {
/* scale predictors if needed*/
- if(q2 && q1 != q2)
- {
+ if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
- if(dc_pred_dir) //left
- {
+ if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
- }
- else //top
- {
+ } else { //top
for(k = 1; k < 8; k++)
block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
- }
- else
- {
- if(dc_pred_dir) //left
- {
+ } else {
+ if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
block[k << 3] += ac_val[k];
- }
- else //top
- {
+ } else { //top
for(k = 1; k < 8; k++)
block[k] += ac_val[k + 8];
}
}
}
/* save AC coeffs for further prediction */
- for(k = 1; k < 8; k++)
- {
+ for(k = 1; k < 8; k++) {
ac_val2[k] = block[k << 3];
ac_val2[k + 8] = block[k];
}
/* scale AC coeffs */
for(k = 1; k < 64; k++)
- if(block[k])
- {
+ if(block[k]) {
block[k] *= scale;
if(!v->pquantizer)
block[k] += (block[k] < 0) ? -mquant : mquant;
}
if(use_pred) i = 63;
- }
- else // no AC coeffs
- {
+ } else { // no AC coeffs
int k;
memset(ac_val2, 0, 16 * 2);
- if(dc_pred_dir) //left
- {
- if(use_pred)
- {
+ if(dc_pred_dir) {//left
+ if(use_pred) {
memcpy(ac_val2, ac_val, 8 * 2);
- if(q2 && q1 != q2)
- {
+ if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
}
- }
- else //top
- {
- if(use_pred)
- {
+ } else {//top
+ if(use_pred) {
memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
- if(q2 && q1 != q2)
- {
+ if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
@@ -2017,21 +1751,15 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
}
/* apply AC prediction if needed */
- if(use_pred)
- {
- if(dc_pred_dir) //left
- {
- for(k = 1; k < 8; k++)
- {
+ if(use_pred) {
+ if(dc_pred_dir) { //left
+ for(k = 1; k < 8; k++) {
block[k << 3] = ac_val2[k] * scale;
if(!v->pquantizer && block[k << 3])
block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
}
- }
- else //top
- {
- for(k = 1; k < 8; k++)
- {
+ } else { //top
+ for(k = 1; k < 8; k++) {
block[k] = ac_val2[k + 8] * scale;
if(!v->pquantizer && block[k])
block[k] += (block[k] < 0) ? -mquant : mquant;
@@ -2071,43 +1799,39 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
s->dsp.clear_block(block);
/* XXX: Guard against dumb values of mquant */
- mquant = (mquant < 1) ? 0 : ((mquant > 31) ? 31 : mquant);
+ mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant );
/* Set DC scale - y and c use the same */
s->y_dc_scale = s->y_dc_scale_table[mquant];
s->c_dc_scale = s->c_dc_scale_table[mquant];
/* Get DC differential */
- if(n < 4)
- {
+ if (n < 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
- }
- else
- {
+ } else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
- if(dcdiff < 0)
- {
+ if (dcdiff < 0){
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
- if(dcdiff)
+ if (dcdiff)
{
- if(dcdiff == 119 /* ESC index value */)
+ if (dcdiff == 119 /* ESC index value */)
{
/* TODO: Optimize */
- if(mquant == 1) dcdiff = get_bits(gb, 10);
- else if(mquant == 2) dcdiff = get_bits(gb, 9);
+ if (mquant == 1) dcdiff = get_bits(gb, 10);
+ else if (mquant == 2) dcdiff = get_bits(gb, 9);
else dcdiff = get_bits(gb, 8);
}
else
{
- if(mquant == 1)
- dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3;
- else if(mquant == 2)
- dcdiff = (dcdiff << 1) + get_bits1(gb) - 1;
+ if (mquant == 1)
+ dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
+ else if (mquant == 2)
+ dcdiff = (dcdiff<<1) + get_bits1(gb) - 1;
}
- if(get_bits1(gb))
+ if (get_bits1(gb))
dcdiff = -dcdiff;
}
@@ -2117,12 +1841,9 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
/* Store the quantized DC coeff, used for prediction */
- if(n < 4)
- {
+ if (n < 4) {
block[0] = dcdiff * s->y_dc_scale;
- }
- else
- {
+ } else {
block[0] = dcdiff * s->c_dc_scale;
}
@@ -2146,20 +1867,18 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
q1 = s->current_picture.qscale_table[mb_pos];
if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1];
if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
- if(dc_pred_dir && n == 1) q2 = q1;
- if(!dc_pred_dir && n == 2) q2 = q1;
- if(n == 3) q2 = q1;
+ if(dc_pred_dir && n==1) q2 = q1;
+ if(!dc_pred_dir && n==2) q2 = q1;
+ if(n==3) q2 = q1;
- if(coded)
- {
+ if(coded) {
int last = 0, skip, value;
const int8_t *zz_table;
int k;
zz_table = wmv1_scantable[0];
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
i += skip;
if(i > 63)
@@ -2168,83 +1887,62 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
}
/* apply AC prediction if needed */
- if(use_pred)
- {
+ if(use_pred) {
/* scale predictors if needed*/
- if(q2 && q1 != q2)
- {
+ if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
- if(dc_pred_dir) //left
- {
+ if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
- }
- else //top
- {
+ } else { //top
for(k = 1; k < 8; k++)
block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
- }
- else
- {
- if(dc_pred_dir) //left
- {
+ } else {
+ if(dc_pred_dir) { //left
for(k = 1; k < 8; k++)
block[k << 3] += ac_val[k];
- }
- else //top
- {
+ } else { //top
for(k = 1; k < 8; k++)
block[k] += ac_val[k + 8];
}
}
}
/* save AC coeffs for further prediction */
- for(k = 1; k < 8; k++)
- {
+ for(k = 1; k < 8; k++) {
ac_val2[k] = block[k << 3];
ac_val2[k + 8] = block[k];
}
/* scale AC coeffs */
for(k = 1; k < 64; k++)
- if(block[k])
- {
+ if(block[k]) {
block[k] *= scale;
if(!v->pquantizer)
block[k] += (block[k] < 0) ? -mquant : mquant;
}
if(use_pred) i = 63;
- }
- else // no AC coeffs
- {
+ } else { // no AC coeffs
int k;
memset(ac_val2, 0, 16 * 2);
- if(dc_pred_dir) //left
- {
- if(use_pred)
- {
+ if(dc_pred_dir) {//left
+ if(use_pred) {
memcpy(ac_val2, ac_val, 8 * 2);
- if(q2 && q1 != q2)
- {
+ if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
}
- }
- else //top
- {
- if(use_pred)
- {
+ } else {//top
+ if(use_pred) {
memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
- if(q2 && q1 != q2)
- {
+ if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
@@ -2254,21 +1952,15 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
}
/* apply AC prediction if needed */
- if(use_pred)
- {
- if(dc_pred_dir) //left
- {
- for(k = 1; k < 8; k++)
- {
+ if(use_pred) {
+ if(dc_pred_dir) { //left
+ for(k = 1; k < 8; k++) {
block[k << 3] = ac_val2[k] * scale;
if(!v->pquantizer && block[k << 3])
block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
}
- }
- else //top
- {
- for(k = 1; k < 8; k++)
- {
+ } else { //top
+ for(k = 1; k < 8; k++) {
block[k] = ac_val2[k + 8] * scale;
if(!v->pquantizer && block[k])
block[k] += (block[k] < 0) ? -mquant : mquant;
@@ -2297,16 +1989,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
s->dsp.clear_block(block);
- if(ttmb == -1)
- {
+ if(ttmb == -1) {
ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)];
}
- if(ttblk == TT_4X4)
- {
+ if(ttblk == TT_4X4) {
subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1);
}
- if((ttblk != TT_8X8 && ttblk != TT_4X4) && (v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block)))
- {
+ if((ttblk != TT_8X8 && ttblk != TT_4X4) && (v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))) {
subblkpat = decode012(gb);
if(subblkpat) subblkpat ^= 3; //swap decoded pattern bits
if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4;
@@ -2315,24 +2004,20 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
scale = 2 * mquant + ((v->pq == mquant) ? v->halfpq : 0);
// convert transforms like 8X4_TOP to generic TT and SUBBLKPAT
- if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM)
- {
+ if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) {
subblkpat = 2 - (ttblk == TT_8X4_TOP);
ttblk = TT_8X4;
}
- if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT)
- {
+ if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) {
subblkpat = 2 - (ttblk == TT_4X8_LEFT);
ttblk = TT_4X8;
}
- switch(ttblk)
- {
+ switch(ttblk) {
case TT_8X8:
pat = 0xF;
i = 0;
last = 0;
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
i += skip;
if(i > 63)
@@ -2342,12 +2027,10 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
if(!v->pquantizer)
block[idx] += (block[idx] < 0) ? -mquant : mquant;
}
- if(!skip_block)
- {
- if(i == 1)
+ if(!skip_block){
+ if(i==1)
s->dsp.vc1_inv_trans_8x8_dc(dst, linesize, block);
- else
- {
+ else{
s->dsp.vc1_inv_trans_8x8(block);
s->dsp.add_pixels_clamped(block, dst, linesize);
}
@@ -2359,13 +2042,11 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
break;
case TT_4X4:
pat = ~subblkpat & 0xF;
- for(j = 0; j < 4; j++)
- {
+ for(j = 0; j < 4; j++) {
last = subblkpat & (1 << (3 - j));
i = 0;
off = (j & 1) * 4 + (j & 2) * 16;
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
i += skip;
if(i > 15)
@@ -2375,78 +2056,71 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
if(!v->pquantizer)
block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant;
}
- if(!(subblkpat & (1 << (3 - j))) && !skip_block)
- {
- if(i == 1)
- s->dsp.vc1_inv_trans_4x4_dc(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off);
+ if(!(subblkpat & (1 << (3 - j))) && !skip_block){
+ if(i==1)
+ s->dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
else
- s->dsp.vc1_inv_trans_4x4(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off);
- if(apply_filter && (j & 2 ? pat & (1 << (j - 2)) : (cbp_top & (1 << (j + 2)))))
- s->dsp.vc1_v_loop_filter4(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, v->pq);
- if(apply_filter && (j & 1 ? pat & (1 << (j - 1)) : (cbp_left & (1 << (j + 1)))))
- s->dsp.vc1_h_loop_filter4(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, v->pq);
+ s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
+ if(apply_filter && (j&2 ? pat & (1<<(j-2)) : (cbp_top & (1 << (j + 2)))))
+ s->dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq);
+ if(apply_filter && (j&1 ? pat & (1<<(j-1)) : (cbp_left & (1 << (j + 1)))))
+ s->dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq);
}
}
break;
case TT_8X4:
- pat = ~((subblkpat & 2) * 6 + (subblkpat & 1) * 3) & 0xF;
- for(j = 0; j < 2; j++)
- {
+ pat = ~((subblkpat & 2)*6 + (subblkpat & 1)*3) & 0xF;
+ for(j = 0; j < 2; j++) {
last = subblkpat & (1 << (1 - j));
i = 0;
off = j * 32;
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
i += skip;
if(i > 31)
break;
- idx = v->zz_8x4[i++] + off;
+ idx = v->zz_8x4[i++]+off;
block[idx] = value * scale;
if(!v->pquantizer)
block[idx] += (block[idx] < 0) ? -mquant : mquant;
}
- if(!(subblkpat & (1 << (1 - j))) && !skip_block)
- {
- if(i == 1)
- s->dsp.vc1_inv_trans_8x4_dc(dst + j * 4 * linesize, linesize, block + off);
+ if(!(subblkpat & (1 << (1 - j))) && !skip_block){
+ if(i==1)
+ s->dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off);
else
- s->dsp.vc1_inv_trans_8x4(dst + j * 4 * linesize, linesize, block + off);
+ s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off);
if(apply_filter && j ? pat & 0x3 : (cbp_top & 0xC))
- s->dsp.vc1_v_loop_filter8(dst + j * 4 * linesize, linesize, v->pq);
+ s->dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq);
if(apply_filter && cbp_left & (2 << j))
- s->dsp.vc1_h_loop_filter4(dst + j * 4 * linesize, linesize, v->pq);
+ s->dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq);
}
}
break;
case TT_4X8:
- pat = ~(subblkpat * 5) & 0xF;
- for(j = 0; j < 2; j++)
- {
+ pat = ~(subblkpat*5) & 0xF;
+ for(j = 0; j < 2; j++) {
last = subblkpat & (1 << (1 - j));
i = 0;
off = j * 4;
- while(!last)
- {
+ while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
i += skip;
if(i > 31)
break;
- idx = v->zz_4x8[i++] + off;
+ idx = v->zz_4x8[i++]+off;
block[idx] = value * scale;
if(!v->pquantizer)
block[idx] += (block[idx] < 0) ? -mquant : mquant;
}
- if(!(subblkpat & (1 << (1 - j))) && !skip_block)
- {
- if(i == 1)
- s->dsp.vc1_inv_trans_4x8_dc(dst + j * 4, linesize, block + off);
+ if(!(subblkpat & (1 << (1 - j))) && !skip_block){
+ if(i==1)
+ s->dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off);
else
- s->dsp.vc1_inv_trans_4x8(dst + j * 4, linesize, block + off);
+ s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off);
if(apply_filter && cbp_top & (2 << j))
- s->dsp.vc1_v_loop_filter4(dst + j * 4, linesize, v->pq);
+ s->dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq);
if(apply_filter && j ? pat & 0x5 : (cbp_left & 0xA))
- s->dsp.vc1_h_loop_filter8(dst + j * 4, linesize, v->pq);
+ s->dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq);
}
}
break;
@@ -2483,24 +2157,23 @@ static int vc1_decode_p_mb(VC1Context *v)
mquant = v->pq; /* Loosy initialization */
- if(v->mv_type_is_raw)
+ if (v->mv_type_is_raw)
fourmv = get_bits1(gb);
else
fourmv = v->mv_type_mb_plane[mb_pos];
- if(v->skip_is_raw)
+ if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);
- if(!fourmv) /* 1MV mode */
+ if (!fourmv) /* 1MV mode */
{
- if(!skipped)
+ if (!skipped)
{
GET_MVDATA(dmv_x, dmv_y);
- if(s->mb_intra)
- {
+ if (s->mb_intra) {
s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
}
@@ -2508,15 +2181,15 @@ static int vc1_decode_p_mb(VC1Context *v)
vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]);
/* FIXME Set DC val for inter block ? */
- if(s->mb_intra && !mb_has_coeffs)
+ if (s->mb_intra && !mb_has_coeffs)
{
GET_MQUANT();
s->ac_pred = get_bits1(gb);
cbp = 0;
}
- else if(mb_has_coeffs)
+ else if (mb_has_coeffs)
{
- if(s->mb_intra) s->ac_pred = get_bits1(gb);
+ if (s->mb_intra) s->ac_pred = get_bits1(gb);
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
@@ -2527,20 +2200,19 @@ static int vc1_decode_p_mb(VC1Context *v)
}
s->current_picture.qscale_table[mb_pos] = mquant;
- if(!v->ttmbf && !s->mb_intra && mb_has_coeffs)
+ if (!v->ttmbf && !s->mb_intra && mb_has_coeffs)
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table,
VC1_TTMB_VLC_BITS, 2);
if(!s->mb_intra) vc1_mc_1mv(v, 0);
dst_idx = 0;
- for(i = 0; i < 6; i++)
+ for (i=0; i<6; i++)
{
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
- if(s->mb_intra)
- {
+ if(s->mb_intra) {
/* check if prediction blocks A and C are available */
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || !s->first_slice_line)
@@ -2548,30 +2220,25 @@ static int vc1_decode_p_mb(VC1Context *v)
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
- vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset);
- if((i > 3) && (s->flags & CODEC_FLAG_GRAY)) continue;
+ vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
+ if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
s->dsp.vc1_inv_trans_8x8(s->block[i]);
if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
- if(v->pq >= 9 && v->overlap)
- {
+ if(v->pq >= 9 && v->overlap) {
if(v->c_avail)
s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
if(v->a_avail)
s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
}
- if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1))
- {
+ if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
int left_cbp, top_cbp;
- if(i & 4)
- {
+ if(i & 4){
left_cbp = v->cbp[s->mb_x - 1] >> (i * 4);
top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
- }
- else
- {
- left_cbp = (i & 1) ? (cbp >> ((i - 1) * 4)) : (v->cbp[s->mb_x - 1] >> ((i + 1) * 4));
- top_cbp = (i & 2) ? (cbp >> ((i - 2) * 4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i + 2) * 4));
+ }else{
+ left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4));
+ top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
}
if(left_cbp & 0xC)
s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
@@ -2579,29 +2246,23 @@ static int vc1_decode_p_mb(VC1Context *v)
s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
}
block_cbp |= 0xF << (i << 2);
- }
- else if(val)
- {
+ } else if(val) {
int left_cbp = 0, top_cbp = 0, filter = 0;
- if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1))
- {
+ if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
filter = 1;
- if(i & 4)
- {
+ if(i & 4){
left_cbp = v->cbp[s->mb_x - 1] >> (i * 4);
top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
- }
- else
- {
- left_cbp = (i & 1) ? (cbp >> ((i - 1) * 4)) : (v->cbp[s->mb_x - 1] >> ((i + 1) * 4));
- top_cbp = (i & 2) ? (cbp >> ((i - 2) * 4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i + 2) * 4));
+ }else{
+ left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4));
+ top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
}
if(left_cbp & 0xC)
s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
if(top_cbp & 0xA)
s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
}
- pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
+ pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
block_cbp |= pat << (i << 2);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
@@ -2611,8 +2272,7 @@ static int vc1_decode_p_mb(VC1Context *v)
else //Skipped
{
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
- {
+ for(i = 0; i < 6; i++) {
v->mb_type[0][s->block_index[i]] = 0;
s->dc_val[0][s->block_index[i]] = 0;
}
@@ -2625,24 +2285,22 @@ static int vc1_decode_p_mb(VC1Context *v)
} //1MV mode
else //4MV mode
{
- if(!skipped /* unskipped MB */)
+ if (!skipped /* unskipped MB */)
{
int intra_count = 0, coded_inter = 0;
int is_intra[6], is_coded[6];
/* Get CBPCY */
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
- for(i = 0; i < 6; i++)
+ for (i=0; i<6; i++)
{
val = ((cbp >> (5 - i)) & 1);
s->dc_val[0][s->block_index[i]] = 0;
s->mb_intra = 0;
- if(i < 4)
- {
+ if(i < 4) {
dmv_x = dmv_y = 0;
s->mb_intra = 0;
mb_has_coeffs = 0;
- if(val)
- {
+ if(val) {
GET_MVDATA(dmv_x, dmv_y);
}
vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]);
@@ -2651,8 +2309,7 @@ static int vc1_decode_p_mb(VC1Context *v)
is_intra[i] = s->mb_intra;
is_coded[i] = mb_has_coeffs;
}
- if(i & 4)
- {
+ if(i&4){
is_intra[i] = (intra_count >= 3);
is_coded[i] = val;
}
@@ -2668,12 +2325,10 @@ static int vc1_decode_p_mb(VC1Context *v)
/* test if block is intra and has pred */
{
int intrapred = 0;
- for(i = 0; i < 6; i++)
- if(is_intra[i])
- {
- if(((!s->first_slice_line || (i == 2 || i == 3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]])
- || ((s->mb_x || (i == 1 || i == 3)) && v->mb_type[0][s->block_index[i] - 1]))
- {
+ for(i=0; i<6; i++)
+ if(is_intra[i]) {
+ if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]])
+ || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) {
intrapred = 1;
break;
}
@@ -2681,15 +2336,14 @@ static int vc1_decode_p_mb(VC1Context *v)
if(intrapred)s->ac_pred = get_bits1(gb);
else s->ac_pred = 0;
}
- if(!v->ttmbf && coded_inter)
+ if (!v->ttmbf && coded_inter)
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
- for(i = 0; i < 6; i++)
+ for (i=0; i<6; i++)
{
dst_idx += i >> 2;
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
s->mb_intra = is_intra[i];
- if(is_intra[i])
- {
+ if (is_intra[i]) {
/* check if prediction blocks A and C are available */
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || !s->first_slice_line)
@@ -2697,30 +2351,25 @@ static int vc1_decode_p_mb(VC1Context *v)
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
- vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i & 4) ? v->codingset2 : v->codingset);
- if((i > 3) && (s->flags & CODEC_FLAG_GRAY)) continue;
+ vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset);
+ if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
s->dsp.vc1_inv_trans_8x8(s->block[i]);
if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
- s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize);
- if(v->pq >= 9 && v->overlap)
- {
+ s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
+ if(v->pq >= 9 && v->overlap) {
if(v->c_avail)
s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
if(v->a_avail)
s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
}
- if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1))
- {
+ if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
int left_cbp, top_cbp;
- if(i & 4)
- {
+ if(i & 4){
left_cbp = v->cbp[s->mb_x - 1] >> (i * 4);
top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
- }
- else
- {
- left_cbp = (i & 1) ? (cbp >> ((i - 1) * 4)) : (v->cbp[s->mb_x - 1] >> ((i + 1) * 4));
- top_cbp = (i & 2) ? (cbp >> ((i - 2) * 4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i + 2) * 4));
+ }else{
+ left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4));
+ top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
}
if(left_cbp & 0xC)
s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
@@ -2728,29 +2377,23 @@ static int vc1_decode_p_mb(VC1Context *v)
s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
}
block_cbp |= 0xF << (i << 2);
- }
- else if(is_coded[i])
- {
+ } else if(is_coded[i]) {
int left_cbp = 0, top_cbp = 0, filter = 0;
- if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1))
- {
+ if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
filter = 1;
- if(i & 4)
- {
+ if(i & 4){
left_cbp = v->cbp[s->mb_x - 1] >> (i * 4);
top_cbp = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
- }
- else
- {
- left_cbp = (i & 1) ? (cbp >> ((i - 1) * 4)) : (v->cbp[s->mb_x - 1] >> ((i + 1) * 4));
- top_cbp = (i & 2) ? (cbp >> ((i - 2) * 4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i + 2) * 4));
+ }else{
+ left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1] >> ((i+1)*4));
+ top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
}
if(left_cbp & 0xC)
s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
if(top_cbp & 0xA)
s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
}
- pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
+ pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
block_cbp |= pat << (i << 2);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
@@ -2762,12 +2405,11 @@ static int vc1_decode_p_mb(VC1Context *v)
{
s->mb_intra = 0;
s->current_picture.qscale_table[mb_pos] = 0;
- for(i = 0; i < 6; i++)
- {
+ for (i=0; i<6; i++) {
v->mb_type[0][s->block_index[i]] = 0;
s->dc_val[0][s->block_index[i]] = 0;
}
- for(i = 0; i < 4; i++)
+ for (i=0; i<4; i++)
{
vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]);
vc1_mc_4mv_luma(v, i);
@@ -2806,41 +2448,36 @@ static void vc1_decode_b_mb(VC1Context *v)
mquant = v->pq; /* Loosy initialization */
s->mb_intra = 0;
- if(v->dmb_is_raw)
+ if (v->dmb_is_raw)
direct = get_bits1(gb);
else
direct = v->direct_mb_plane[mb_pos];
- if(v->skip_is_raw)
+ if (v->skip_is_raw)
skipped = get_bits1(gb);
else
skipped = v->s.mbskip_table[mb_pos];
dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0;
- for(i = 0; i < 6; i++)
- {
+ for(i = 0; i < 6; i++) {
v->mb_type[0][s->block_index[i]] = 0;
s->dc_val[0][s->block_index[i]] = 0;
}
s->current_picture.qscale_table[mb_pos] = 0;
- if(!direct)
- {
- if(!skipped)
- {
+ if (!direct) {
+ if (!skipped) {
GET_MVDATA(dmv_x[0], dmv_y[0]);
dmv_x[1] = dmv_x[0];
dmv_y[1] = dmv_y[0];
}
- if(skipped || !s->mb_intra)
- {
+ if(skipped || !s->mb_intra) {
bmvtype = decode012(gb);
- switch(bmvtype)
- {
+ switch(bmvtype) {
case 0:
- bmvtype = (v->bfraction >= (B_FRACTION_DEN / 2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
+ bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
break;
case 1:
- bmvtype = (v->bfraction >= (B_FRACTION_DEN / 2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
+ bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
break;
case 2:
bmvtype = BMV_TYPE_INTERPOLATED;
@@ -2851,15 +2488,13 @@ static void vc1_decode_b_mb(VC1Context *v)
for(i = 0; i < 6; i++)
v->mb_type[0][s->block_index[i]] = s->mb_intra;
- if(skipped)
- {
+ if (skipped) {
if(direct) bmvtype = BMV_TYPE_INTERPOLATED;
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return;
}
- if(direct)
- {
+ if (direct) {
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
s->mb_intra = 0;
@@ -2869,31 +2504,23 @@ static void vc1_decode_b_mb(VC1Context *v)
dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0;
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
- }
- else
- {
- if(!mb_has_coeffs && !s->mb_intra)
- {
+ } else {
+ if(!mb_has_coeffs && !s->mb_intra) {
/* no coded blocks - effectively skipped */
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return;
}
- if(s->mb_intra && !mb_has_coeffs)
- {
+ if(s->mb_intra && !mb_has_coeffs) {
GET_MQUANT();
s->current_picture.qscale_table[mb_pos] = mquant;
s->ac_pred = get_bits1(gb);
cbp = 0;
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
- }
- else
- {
- if(bmvtype == BMV_TYPE_INTERPOLATED)
- {
+ } else {
+ if(bmvtype == BMV_TYPE_INTERPOLATED) {
GET_MVDATA(dmv_x[0], dmv_y[0]);
- if(!mb_has_coeffs)
- {
+ if(!mb_has_coeffs) {
/* interpolated skipped block */
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
@@ -2901,8 +2528,7 @@ static void vc1_decode_b_mb(VC1Context *v)
}
}
vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
- if(!s->mb_intra)
- {
+ if(!s->mb_intra) {
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
}
if(s->mb_intra)
@@ -2915,15 +2541,14 @@ static void vc1_decode_b_mb(VC1Context *v)
}
}
dst_idx = 0;
- for(i = 0; i < 6; i++)
+ for (i=0; i<6; i++)
{
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
- if(s->mb_intra)
- {
+ if(s->mb_intra) {
/* check if prediction blocks A and C are available */
v->a_avail = v->c_avail = 0;
if(i == 2 || i == 3 || !s->first_slice_line)
@@ -2931,15 +2556,13 @@ static void vc1_decode_b_mb(VC1Context *v)
if(i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
- vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset);
- if((i > 3) && (s->flags & CODEC_FLAG_GRAY)) continue;
+ vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
+ if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
s->dsp.vc1_inv_trans_8x8(s->block[i]);
if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
- }
- else if(val)
- {
- vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0);
+ } else if(val) {
+ vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0);
if(!v->ttmbf && ttmb < 8) ttmb = -1;
first_block = 0;
}
@@ -2957,8 +2580,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
int mb_pos;
/* select codingmode used for VLC tables selection */
- switch(v->y_ac_table_index)
- {
+ switch(v->y_ac_table_index){
case 0:
v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
break;
@@ -2970,8 +2592,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
break;
}
- switch(v->c_ac_table_index)
- {
+ switch(v->c_ac_table_index){
case 0:
v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
break;
@@ -2991,12 +2612,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->mb_height; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
+ for(; s->mb_x < s->mb_width; s->mb_x++) {
ff_update_block_index(s);
s->dsp.clear_blocks(s->block[0]);
mb_pos = s->mb_x + s->mb_y * s->mb_width;
@@ -3009,48 +2628,40 @@ static void vc1_decode_i_blocks(VC1Context *v)
cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
v->s.ac_pred = get_bits1(&v->s.gb);
- for(k = 0; k < 6; k++)
- {
+ for(k = 0; k < 6; k++) {
val = ((cbp >> (5 - k)) & 1);
- if(k < 4)
- {
+ if (k < 4) {
int pred = vc1_coded_block_pred(&v->s, k, &coded_val);
val = val ^ pred;
*coded_val = val;
}
cbp |= val << (5 - k);
- vc1_decode_i_block(v, s->block[k], k, val, (k < 4) ? v->codingset : v->codingset2);
+ vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2);
s->dsp.vc1_inv_trans_8x8(s->block[k]);
- if(v->pq >= 9 && v->overlap)
- {
+ if(v->pq >= 9 && v->overlap) {
for(j = 0; j < 64; j++) s->block[k][j] += 128;
}
}
vc1_put_block(v, s->block);
- if(v->pq >= 9 && v->overlap)
- {
- if(s->mb_x)
- {
+ if(v->pq >= 9 && v->overlap) {
+ if(s->mb_x) {
s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
- if(!(s->flags & CODEC_FLAG_GRAY))
- {
+ if(!(s->flags & CODEC_FLAG_GRAY)) {
s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
}
}
s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
- if(!s->first_slice_line)
- {
+ if(!s->first_slice_line) {
s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
- if(!(s->flags & CODEC_FLAG_GRAY))
- {
+ if(!(s->flags & CODEC_FLAG_GRAY)) {
s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
}
@@ -3060,9 +2671,8 @@ static void vc1_decode_i_blocks(VC1Context *v)
}
if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
- if(get_bits_count(&s->gb) > v->bits)
- {
- ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END));
+ if(get_bits_count(&s->gb) > v->bits) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
return;
}
@@ -3070,7 +2680,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END | DC_END | MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
/** Decode blocks of I-frame for advanced profile
@@ -3088,8 +2698,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
GetBitContext *gb = &s->gb;
/* select codingmode used for VLC tables selection */
- switch(v->y_ac_table_index)
- {
+ switch(v->y_ac_table_index){
case 0:
v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
break;
@@ -3101,8 +2710,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
break;
}
- switch(v->c_ac_table_index)
- {
+ switch(v->c_ac_table_index){
case 0:
v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
break;
@@ -3118,12 +2726,10 @@ static void vc1_decode_i_blocks_adv(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->mb_height; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
+ for(;s->mb_x < s->mb_width; s->mb_x++) {
ff_update_block_index(s);
s->dsp.clear_blocks(s->block[0]);
mb_pos = s->mb_x + s->mb_y * s->mb_stride;
@@ -3138,14 +2744,12 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
else
v->s.ac_pred = v->acpred_plane[mb_pos];
- if(v->condover == CONDOVER_SELECT)
- {
+ if(v->condover == CONDOVER_SELECT) {
if(v->overflg_is_raw)
overlap = get_bits1(&v->s.gb);
else
overlap = v->over_flags_plane[mb_pos];
- }
- else
+ } else
overlap = (v->condover == CONDOVER_ALL);
GET_MQUANT();
@@ -3155,48 +2759,41 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
s->y_dc_scale = s->y_dc_scale_table[mquant];
s->c_dc_scale = s->c_dc_scale_table[mquant];
- for(k = 0; k < 6; k++)
- {
+ for(k = 0; k < 6; k++) {
val = ((cbp >> (5 - k)) & 1);
- if(k < 4)
- {
+ if (k < 4) {
int pred = vc1_coded_block_pred(&v->s, k, &coded_val);
val = val ^ pred;
*coded_val = val;
}
cbp |= val << (5 - k);
- v->a_avail = !s->first_slice_line || (k == 2 || k == 3);
- v->c_avail = !!s->mb_x || (k == 1 || k == 3);
+ v->a_avail = !s->first_slice_line || (k==2 || k==3);
+ v->c_avail = !!s->mb_x || (k==1 || k==3);
- vc1_decode_i_block_adv(v, s->block[k], k, val, (k < 4) ? v->codingset : v->codingset2, mquant);
+ vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant);
s->dsp.vc1_inv_trans_8x8(s->block[k]);
for(j = 0; j < 64; j++) s->block[k][j] += 128;
}
vc1_put_block(v, s->block);
- if(overlap)
- {
- if(s->mb_x)
- {
+ if(overlap) {
+ if(s->mb_x) {
s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
- if(!(s->flags & CODEC_FLAG_GRAY))
- {
+ if(!(s->flags & CODEC_FLAG_GRAY)) {
s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
}
}
s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
- if(!s->first_slice_line)
- {
+ if(!s->first_slice_line) {
s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
- if(!(s->flags & CODEC_FLAG_GRAY))
- {
+ if(!(s->flags & CODEC_FLAG_GRAY)) {
s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
}
@@ -3206,9 +2803,8 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
}
if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
- if(get_bits_count(&s->gb) > v->bits)
- {
- ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END));
+ if(get_bits_count(&s->gb) > v->bits) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
return;
}
@@ -3216,7 +2812,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END | DC_END | MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
static void vc1_decode_p_blocks(VC1Context *v)
@@ -3224,8 +2820,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
MpegEncContext *s = &v->s;
/* select codingmode used for VLC tables selection */
- switch(v->c_ac_table_index)
- {
+ switch(v->c_ac_table_index){
case 0:
v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
break;
@@ -3237,8 +2832,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
break;
}
- switch(v->c_ac_table_index)
- {
+ switch(v->c_ac_table_index){
case 0:
v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
break;
@@ -3251,20 +2845,17 @@ static void vc1_decode_p_blocks(VC1Context *v)
}
s->first_slice_line = 1;
- memset(v->cbp_base, 0, sizeof(v->cbp_base[0]) * 2 * s->mb_stride);
- for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++)
- {
+ memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride);
+ for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
+ for(; s->mb_x < s->mb_width; s->mb_x++) {
ff_update_block_index(s);
vc1_decode_p_mb(v);
- if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0)
- {
- ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END));
- av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y);
+ if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+ av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y);
return;
}
}
@@ -3272,7 +2863,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END | DC_END | MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
static void vc1_decode_b_blocks(VC1Context *v)
@@ -3280,8 +2871,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
MpegEncContext *s = &v->s;
/* select codingmode used for VLC tables selection */
- switch(v->c_ac_table_index)
- {
+ switch(v->c_ac_table_index){
case 0:
v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
break;
@@ -3293,8 +2883,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
break;
}
- switch(v->c_ac_table_index)
- {
+ switch(v->c_ac_table_index){
case 0:
v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
break;
@@ -3307,19 +2896,16 @@ static void vc1_decode_b_blocks(VC1Context *v)
}
s->first_slice_line = 1;
- for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++)
- {
+ for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
- for(; s->mb_x < s->mb_width; s->mb_x++)
- {
+ for(; s->mb_x < s->mb_width; s->mb_x++) {
ff_update_block_index(s);
vc1_decode_b_mb(v);
- if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0)
- {
- ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END | DC_END | MV_END));
- av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y);
+ if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+ av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y);
return;
}
if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
@@ -3327,17 +2913,16 @@ static void vc1_decode_b_blocks(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END | DC_END | MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
static void vc1_decode_skip_blocks(VC1Context *v)
{
MpegEncContext *s = &v->s;
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END | DC_END | MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
s->first_slice_line = 1;
- for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++)
- {
+ for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
ff_update_block_index(s);
@@ -3354,15 +2939,11 @@ static void vc1_decode_blocks(VC1Context *v)
{
v->s.esc3_level_length = 0;
- if(v->x8_type)
- {
- ff_intrax8_decode_picture(&v->x8, 2 * v->pq + v->halfpq, v->pq*(!v->pquantizer));
- }
- else
- {
+ if(v->x8_type){
+ ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) );
+ }else{
- switch(v->s.pict_type)
- {
+ switch(v->s.pict_type) {
case FF_I_TYPE:
if(v->profile == PROFILE_ADVANCED)
vc1_decode_i_blocks_adv(v);
@@ -3376,14 +2957,12 @@ static void vc1_decode_blocks(VC1Context *v)
vc1_decode_p_blocks(v);
break;
case FF_B_TYPE:
- if(v->bi_type)
- {
+ if(v->bi_type){
if(v->profile == PROFILE_ADVANCED)
vc1_decode_i_blocks_adv(v);
else
vc1_decode_i_blocks(v);
- }
- else
+ }else
vc1_decode_b_blocks(v);
break;
}
@@ -3400,8 +2979,8 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
MpegEncContext *s = &v->s;
GetBitContext gb;
- if(!avctx->extradata_size || !avctx->extradata) return -1;
- if(!(avctx->flags & CODEC_FLAG_GRAY))
+ if (!avctx->extradata_size || !avctx->extradata) return -1;
+ if (!(avctx->flags & CODEC_FLAG_GRAY))
avctx->pix_fmt = PIX_FMT_YUV420P; /* ffdshow custom code */
else
avctx->pix_fmt = PIX_FMT_GRAY8;
@@ -3409,20 +2988,19 @@ static av_cold int vc1_decode_init(AVCodecContext *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(avctx->idct_algo==FF_IDCT_AUTO){
+ avctx->idct_algo=FF_IDCT_WMV2;
}
if(ff_h263_decode_init(avctx) < 0)
return -1;
- if(vc1_init_common(v) < 0) return -1;
+ if (vc1_init_common(v) < 0) return -1;
// only for ff_msmp4_mb_i_table
- if(ff_msmpeg4_decode_init(avctx) < 0) return -1;
+ if (ff_msmpeg4_decode_init(avctx) < 0) return -1;
avctx->coded_width = avctx->width;
avctx->coded_height = avctx->height;
- if(avctx->codec_id == CODEC_ID_WMV3)
+ if (avctx->codec_id == CODEC_ID_WMV3)
{
int count = 0;
@@ -3431,24 +3009,22 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
// the last byte of the extradata is a version number, 1 for the
// samples we can decode
- init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
+ init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8);
- if(vc1_decode_sequence_header(avctx, v, &gb) < 0)
- return -1;
+ if (vc1_decode_sequence_header(avctx, v, &gb) < 0)
+ return -1;
- count = avctx->extradata_size * 8 - get_bits_count(&gb);
- if(count > 0)
+ count = avctx->extradata_size*8 - get_bits_count(&gb);
+ if (count>0)
{
av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n",
count, get_bits(&gb, count));
}
- else if(count < 0)
+ else if (count < 0)
{
av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count);
}
- }
- else // VC1/WVC1
- {
+ } else { // VC1/WVC1
const uint8_t *start = avctx->extradata;
uint8_t *end = avctx->extradata + avctx->extradata_size;
const uint8_t *next;
@@ -3456,8 +3032,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
uint8_t *buf2 = NULL;
int seq_initialized = 0, ep_initialized = 0;
- if(avctx->extradata_size < 16)
- {
+ if(avctx->extradata_size < 16) {
av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size);
return -1;
}
@@ -3465,26 +3040,22 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv
next = start;
- for(; next < end; start = next)
- {
+ for(; next < end; start = next){
next = find_next_marker(start + 4, end);
size = next - start - 4;
if(size <= 0) continue;
buf2_size = vc1_unescape_buffer(start + 4, size, buf2);
init_get_bits(&gb, buf2, buf2_size * 8);
- switch(AV_RB32(start))
- {
+ switch(AV_RB32(start)){
case VC1_CODE_SEQHDR:
- if(vc1_decode_sequence_header(avctx, v, &gb) < 0)
- {
+ if(vc1_decode_sequence_header(avctx, v, &gb) < 0){
av_free(buf2);
return -1;
}
seq_initialized = 1;
break;
case VC1_CODE_ENTRYPOINT:
- if(vc1_decode_entry_point(avctx, v, &gb) < 0)
- {
+ if(vc1_decode_entry_point(avctx, v, &gb) < 0){
av_free(buf2);
return -1;
}
@@ -3493,17 +3064,16 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
}
}
av_free(buf2);
- if(!seq_initialized || !ep_initialized)
- {
+ if(!seq_initialized || !ep_initialized){
av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
return -1;
}
}
- avctx->has_b_frames = !!(avctx->max_b_frames);
+ avctx->has_b_frames= !!(avctx->max_b_frames);
s->low_delay = !avctx->has_b_frames;
- s->mb_width = (avctx->coded_width + 15) >> 4;
- s->mb_height = (avctx->coded_height + 15) >> 4;
+ s->mb_width = (avctx->coded_width+15)>>4;
+ s->mb_height = (avctx->coded_height+15)>>4;
/* Allocate mb bitplanes */
v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height);
@@ -3521,7 +3091,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
v->mb_type[2] = v->mb_type[1] + s->mb_stride * (s->mb_height + 1);
/* Init coded blocks info */
- if(v->profile == PROFILE_ADVANCED)
+ if (v->profile == PROFILE_ADVANCED)
{
// if (alloc_bitplane(&v->over_flags_plane, s->mb_width, s->mb_height) < 0)
// return -1;
@@ -3529,7 +3099,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
// return -1;
}
- ff_intrax8_common_init(&v->x8, s);
+ ff_intrax8_common_init(&v->x8,s);
return 0;
}
@@ -3547,13 +3117,11 @@ static int vc1_decode_frame(AVCodecContext *avctx,
uint8_t *buf2 = NULL;
/* no supplementary picture */
- if(buf_size == 0)
- {
+ if (buf_size == 0) {
/* special case for last picture */
- if(s->low_delay == 0 && s->next_picture_ptr)
- {
- *pict = *(AVFrame*)s->next_picture_ptr;
- s->next_picture_ptr = NULL;
+ if (s->low_delay==0 && s->next_picture_ptr) {
+ *pict= *(AVFrame*)s->next_picture_ptr;
+ s->next_picture_ptr= NULL;
*data_size = sizeof(AVFrame);
}
@@ -3563,37 +3131,32 @@ static int vc1_decode_frame(AVCodecContext *avctx,
/* We need to set current_picture_ptr before reading the header,
* otherwise we cannot store anything in there. */
- if(s->current_picture_ptr == NULL || s->current_picture_ptr->data[0])
- {
- int i = ff_find_unused_picture(s, 0);
- s->current_picture_ptr = &s->picture[i];
+ if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
+ int i= ff_find_unused_picture(s, 0);
+ s->current_picture_ptr= &s->picture[i];
}
//for advanced profile we may need to parse and unescape data
- if(avctx->codec_id == CODEC_ID_VC1)
- {
+ if (avctx->codec_id == CODEC_ID_VC1) {
int buf_size2 = 0;
buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if(IS_MARKER(AV_RB32(buf))) /* frame starts with marker and needs to be parsed */
- {
+ if(IS_MARKER(AV_RB32(buf))){ /* frame starts with marker and needs to be parsed */
const uint8_t *start, *end, *next;
int size;
next = buf;
- for(start = buf, end = buf + buf_size; next < end; start = next)
- {
+ for(start = buf, end = buf + buf_size; next < end; start = next){
next = find_next_marker(start + 4, end);
size = next - start - 4;
if(size <= 0) continue;
- switch(AV_RB32(start))
- {
+ switch(AV_RB32(start)){
case VC1_CODE_FRAME:
buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
break;
case VC1_CODE_ENTRYPOINT: /* it should be before frame data */
buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
- init_get_bits(&s->gb, buf2, buf_size2 * 8);
+ init_get_bits(&s->gb, buf2, buf_size2*8);
vc1_decode_entry_point(avctx, v, &s->gb);
break;
case VC1_CODE_SLICE:
@@ -3602,14 +3165,11 @@ static int vc1_decode_frame(AVCodecContext *avctx,
return -1;
}
}
- }
- else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)) /* WVC1 interlaced stores both fields divided by marker */
- {
+ }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */
const uint8_t *divider;
divider = find_next_marker(buf, buf + buf_size);
- if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD)
- {
+ if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){
av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
av_free(buf2);
return -1;
@@ -3619,108 +3179,89 @@ static int vc1_decode_frame(AVCodecContext *avctx,
// TODO
if(!v->warn_interlaced++)
av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced WVC1 support is not implemented\n");
- av_free(buf2);
- return -1;
- }
- else
- {
+ av_free(buf2);return -1;
+ }else{
buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);
}
- init_get_bits(&s->gb, buf2, buf_size2 * 8);
- }
- else
- init_get_bits(&s->gb, buf, buf_size * 8);
+ init_get_bits(&s->gb, buf2, buf_size2*8);
+ } else
+ init_get_bits(&s->gb, buf, buf_size*8);
// do parse frame header
- if(v->profile < PROFILE_ADVANCED)
- {
- if(vc1_parse_frame_header(v, &s->gb) == -1)
- {
+ if(v->profile < PROFILE_ADVANCED) {
+ if(vc1_parse_frame_header(v, &s->gb) == -1) {
av_free(buf2);
return -1;
}
- }
- else
- {
- if(vc1_parse_frame_header_adv(v, &s->gb) == -1)
- {
+ } else {
+ if(vc1_parse_frame_header_adv(v, &s->gb) == -1) {
av_free(buf2);
return -1;
}
}
- if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag)
- {
+ if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){
av_free(buf2);
return -1;
}
// for hurry_up==5
- s->current_picture.pict_type = s->pict_type;
- s->current_picture.key_frame = s->pict_type == FF_I_TYPE;
+ s->current_picture.pict_type= s->pict_type;
+ s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
/* skip B-frames if we don't have reference frames */
- if(s->last_picture_ptr == NULL && (s->pict_type == FF_B_TYPE || s->dropable))
- {
+ if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){
av_free(buf2);
return -1;//buf_size;
}
/* skip b frames if we are in a hurry */
- if(avctx->hurry_up && s->pict_type == FF_B_TYPE) return -1; //buf_size;
- if((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
- || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
- || avctx->skip_frame >= AVDISCARD_ALL)
- {
+ if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
+ || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
+ || avctx->skip_frame >= AVDISCARD_ALL) {
av_free(buf2);
return buf_size;
}
/* skip everything if we are in a hurry>=5 */
- if(avctx->hurry_up >= 5)
- {
+ if(avctx->hurry_up>=5) {
av_free(buf2);
return -1;//buf_size;
}
- if(s->next_p_frame_damaged)
- {
- if(s->pict_type == FF_B_TYPE)
+ if(s->next_p_frame_damaged){
+ if(s->pict_type==FF_B_TYPE)
return buf_size;
else
- s->next_p_frame_damaged = 0;
+ s->next_p_frame_damaged=0;
}
- if(MPV_frame_start(s, avctx) < 0)
- {
+ if(MPV_frame_start(s, avctx) < 0) {
av_free(buf2);
return -1;
}
- s->me.qpel_put = s->dsp.put_qpel_pixels_tab;
- s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;
+ s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
+ s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
- ff_er_frame_start(s);
+ ff_er_frame_start(s);
- v->bits = buf_size * 8;
- vc1_decode_blocks(v);
+ v->bits = buf_size * 8;
+ vc1_decode_blocks(v);
//av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), buf_size*8);
// if(get_bits_count(&s->gb) > buf_size * 8)
// return -1;
- ff_er_frame_end(s);
+ ff_er_frame_end(s);
MPV_frame_end(s);
- assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
- assert(s->current_picture.pict_type == s->pict_type);
- if(s->pict_type == FF_B_TYPE || s->low_delay)
- {
- *pict = *(AVFrame*)s->current_picture_ptr;
- }
- else if(s->last_picture_ptr != NULL)
- {
- *pict = *(AVFrame*)s->last_picture_ptr;
+assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
+assert(s->current_picture.pict_type == s->pict_type);
+ if (s->pict_type == FF_B_TYPE || s->low_delay) {
+ *pict= *(AVFrame*)s->current_picture_ptr;
+ } else if (s->last_picture_ptr != NULL) {
+ *pict= *(AVFrame*)s->last_picture_ptr;
}
- if(s->last_picture_ptr || s->low_delay)
- {
+ if(s->last_picture_ptr || s->low_delay){
*data_size = sizeof(AVFrame);
ff_print_debug_info(s, pict);
}
@@ -3751,8 +3292,7 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx)
}
-AVCodec vc1_decoder =
-{
+AVCodec vc1_decoder = {
"vc1",
CODEC_TYPE_VIDEO,
CODEC_ID_VC1,
@@ -3770,8 +3310,7 @@ AVCodec vc1_decoder =
};
#if CONFIG_WMV3_DECODER
-AVCodec wmv3_decoder =
-{
+AVCodec wmv3_decoder = {
"wmv3",
CODEC_TYPE_VIDEO,
CODEC_ID_WMV3,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dsp.c
index e391aa979..85896dbdd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vc1dsp.c
@@ -36,8 +36,7 @@ static void vc1_v_overlap_c(uint8_t* src, int stride)
int a, b, c, d;
int d1, d2;
int rnd = 1;
- for(i = 0; i < 8; i++)
- {
+ for(i = 0; i < 8; i++) {
a = src[-2*stride];
b = src[-stride];
c = src[0];
@@ -62,8 +61,7 @@ static void vc1_h_overlap_c(uint8_t* src, int stride)
int a, b, c, d;
int d1, d2;
int rnd = 1;
- for(i = 0; i < 8; i++)
- {
+ for(i = 0; i < 8; i++) {
a = src[-2];
b = src[-1];
c = src[0];
@@ -88,34 +86,29 @@ static void vc1_h_overlap_c(uint8_t* src, int stride)
* @return whether other 3 pairs should be filtered or not
* @see 8.6
*/
-static av_always_inline int vc1_filter_line(uint8_t* src, int stride, int pq)
-{
+static av_always_inline int vc1_filter_line(uint8_t* src, int stride, int pq){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- int a0 = (2 * (src[-2*stride] - src[ 1*stride]) - 5 * (src[-1*stride] - src[ 0*stride]) + 4) >> 3;
+ int a0 = (2*(src[-2*stride] - src[ 1*stride]) - 5*(src[-1*stride] - src[ 0*stride]) + 4) >> 3;
int a0_sign = a0 >> 31; /* Store sign */
a0 = (a0 ^ a0_sign) - a0_sign; /* a0 = FFABS(a0); */
- if(a0 < pq)
- {
- int a1 = FFABS((2 * (src[-4*stride] - src[-1*stride]) - 5 * (src[-3*stride] - src[-2*stride]) + 4) >> 3);
- int a2 = FFABS((2 * (src[ 0*stride] - src[ 3*stride]) - 5 * (src[ 1*stride] - src[ 2*stride]) + 4) >> 3);
- if(a1 < a0 || a2 < a0)
- {
+ if(a0 < pq){
+ int a1 = FFABS((2*(src[-4*stride] - src[-1*stride]) - 5*(src[-3*stride] - src[-2*stride]) + 4) >> 3);
+ int a2 = FFABS((2*(src[ 0*stride] - src[ 3*stride]) - 5*(src[ 1*stride] - src[ 2*stride]) + 4) >> 3);
+ if(a1 < a0 || a2 < a0){
int clip = src[-1*stride] - src[ 0*stride];
int clip_sign = clip >> 31;
- clip = ((clip ^ clip_sign) - clip_sign) >> 1;
- if(clip)
- {
+ clip = ((clip ^ clip_sign) - clip_sign)>>1;
+ if(clip){
int a3 = FFMIN(a1, a2);
int d = 5 * (a3 - a0);
int d_sign = (d >> 31);
d = ((d ^ d_sign) - d_sign) >> 3;
d_sign ^= a0_sign;
- if(d_sign ^ clip_sign)
+ if( d_sign ^ clip_sign )
d = 0;
- else
- {
+ else{
d = FFMIN(d, clip);
d = (d ^ d_sign) - d_sign; /* Restore sign */
src[-1*stride] = cm[src[-1*stride] - d];
@@ -142,14 +135,12 @@ static inline void vc1_loop_filter(uint8_t* src, int step, int stride, int len,
int i;
int filt3;
- for(i = 0; i < len; i += 4)
- {
- filt3 = vc1_filter_line(src + 2 * step, stride, pq);
- if(filt3)
- {
- vc1_filter_line(src + 0 * step, stride, pq);
- vc1_filter_line(src + 1 * step, stride, pq);
- vc1_filter_line(src + 3 * step, stride, pq);
+ for(i = 0; i < len; i += 4){
+ filt3 = vc1_filter_line(src + 2*step, stride, pq);
+ if(filt3){
+ vc1_filter_line(src + 0*step, stride, pq);
+ vc1_filter_line(src + 1*step, stride, pq);
+ vc1_filter_line(src + 3*step, stride, pq);
}
src += step * 4;
}
@@ -194,16 +185,15 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
dc = (3 * dc + 1) >> 1;
dc = (3 * dc + 16) >> 5;
- for(i = 0; i < 8; i++)
- {
- dest[0] = cm[dest[0] + dc];
- dest[1] = cm[dest[1] + dc];
- dest[2] = cm[dest[2] + dc];
- dest[3] = cm[dest[3] + dc];
- dest[4] = cm[dest[4] + dc];
- dest[5] = cm[dest[5] + dc];
- dest[6] = cm[dest[6] + dc];
- dest[7] = cm[dest[7] + dc];
+ for(i = 0; i < 8; i++){
+ dest[0] = cm[dest[0]+dc];
+ dest[1] = cm[dest[1]+dc];
+ dest[2] = cm[dest[2]+dc];
+ dest[3] = cm[dest[3]+dc];
+ dest[4] = cm[dest[4]+dc];
+ dest[5] = cm[dest[5]+dc];
+ dest[6] = cm[dest[6]+dc];
+ dest[7] = cm[dest[7]+dc];
dest += linesize;
}
}
@@ -211,13 +201,12 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
static void vc1_inv_trans_8x8_c(DCTELEM block[64])
{
int i;
- register int t1, t2, t3, t4, t5, t6, t7, t8;
+ register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst;
src = block;
dst = block;
- for(i = 0; i < 8; i++)
- {
+ for(i = 0; i < 8; i++){
t1 = 12 * (src[0] + src[4]) + 4;
t2 = 12 * (src[0] - src[4]) + 4;
t3 = 16 * src[2] + 6 * src[6];
@@ -248,8 +237,7 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64])
src = block;
dst = block;
- for(i = 0; i < 8; i++)
- {
+ for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 64;
t2 = 12 * (src[ 0] - src[32]) + 64;
t3 = 16 * src[16] + 6 * src[48];
@@ -286,18 +274,17 @@ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
int i;
int dc = block[0];
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- dc = (3 * dc + 1) >> 1;
+ dc = ( 3 * dc + 1) >> 1;
dc = (17 * dc + 64) >> 7;
- for(i = 0; i < 4; i++)
- {
- dest[0] = cm[dest[0] + dc];
- dest[1] = cm[dest[1] + dc];
- dest[2] = cm[dest[2] + dc];
- dest[3] = cm[dest[3] + dc];
- dest[4] = cm[dest[4] + dc];
- dest[5] = cm[dest[5] + dc];
- dest[6] = cm[dest[6] + dc];
- dest[7] = cm[dest[7] + dc];
+ for(i = 0; i < 4; i++){
+ dest[0] = cm[dest[0]+dc];
+ dest[1] = cm[dest[1]+dc];
+ dest[2] = cm[dest[2]+dc];
+ dest[3] = cm[dest[3]+dc];
+ dest[4] = cm[dest[4]+dc];
+ dest[5] = cm[dest[5]+dc];
+ dest[6] = cm[dest[6]+dc];
+ dest[7] = cm[dest[7]+dc];
dest += linesize;
}
}
@@ -305,14 +292,13 @@ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block)
{
int i;
- register int t1, t2, t3, t4, t5, t6, t7, t8;
+ register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
- for(i = 0; i < 4; i++)
- {
+ for(i = 0; i < 4; i++){
t1 = 12 * (src[0] + src[4]) + 4;
t2 = 12 * (src[0] - src[4]) + 4;
t3 = 16 * src[2] + 6 * src[6];
@@ -342,8 +328,7 @@ static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block)
}
src = block;
- for(i = 0; i < 8; i++)
- {
+ for(i = 0; i < 8; i++){
t1 = 17 * (src[ 0] + src[16]) + 64;
t2 = 17 * (src[ 0] - src[16]) + 64;
t3 = 22 * src[ 8] + 10 * src[24];
@@ -368,12 +353,11 @@ static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
dc = (17 * dc + 4) >> 3;
dc = (12 * dc + 64) >> 7;
- for(i = 0; i < 8; i++)
- {
- dest[0] = cm[dest[0] + dc];
- dest[1] = cm[dest[1] + dc];
- dest[2] = cm[dest[2] + dc];
- dest[3] = cm[dest[3] + dc];
+ for(i = 0; i < 8; i++){
+ dest[0] = cm[dest[0]+dc];
+ dest[1] = cm[dest[1]+dc];
+ dest[2] = cm[dest[2]+dc];
+ dest[3] = cm[dest[3]+dc];
dest += linesize;
}
}
@@ -381,14 +365,13 @@ static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block)
{
int i;
- register int t1, t2, t3, t4, t5, t6, t7, t8;
+ register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
- for(i = 0; i < 8; i++)
- {
+ for(i = 0; i < 8; i++){
t1 = 17 * (src[0] + src[2]) + 4;
t2 = 17 * (src[0] - src[2]) + 4;
t3 = 22 * src[1] + 10 * src[3];
@@ -404,8 +387,7 @@ static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block)
}
src = block;
- for(i = 0; i < 4; i++)
- {
+ for(i = 0; i < 4; i++){
t1 = 12 * (src[ 0] + src[32]) + 64;
t2 = 12 * (src[ 0] - src[32]) + 64;
t3 = 16 * src[16] + 6 * src[48];
@@ -444,12 +426,11 @@ static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
dc = (17 * dc + 4) >> 3;
dc = (17 * dc + 64) >> 7;
- for(i = 0; i < 4; i++)
- {
- dest[0] = cm[dest[0] + dc];
- dest[1] = cm[dest[1] + dc];
- dest[2] = cm[dest[2] + dc];
- dest[3] = cm[dest[3] + dc];
+ for(i = 0; i < 4; i++){
+ dest[0] = cm[dest[0]+dc];
+ dest[1] = cm[dest[1]+dc];
+ dest[2] = cm[dest[2]+dc];
+ dest[3] = cm[dest[3]+dc];
dest += linesize;
}
}
@@ -457,14 +438,13 @@ static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block)
{
int i;
- register int t1, t2, t3, t4;
+ register int t1,t2,t3,t4;
DCTELEM *src, *dst;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
- for(i = 0; i < 4; i++)
- {
+ for(i = 0; i < 4; i++){
t1 = 17 * (src[0] + src[2]) + 4;
t2 = 17 * (src[0] - src[2]) + 4;
t3 = 22 * src[1] + 10 * src[3];
@@ -480,8 +460,7 @@ static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block)
}
src = block;
- for(i = 0; i < 4; i++)
- {
+ for(i = 0; i < 4; i++){
t1 = 17 * (src[ 0] + src[16]) + 64;
t2 = 17 * (src[ 0] - src[16]) + 64;
t3 = 22 * src[ 8] + 10 * src[24];
@@ -523,16 +502,15 @@ VC1_MSPEL_FILTER_16B(hor, int16_t);
*/
static av_always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r)
{
- switch(mode)
- {
+ switch(mode){
case 0: //no shift
return src[0];
case 1: // 1/4 shift
- return (-4 * src[-stride] + 53 * src[0] + 18 * src[stride] - 3 * src[stride*2] + 32 - r) >> 6;
+ return (-4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2] + 32 - r) >> 6;
case 2: // 1/2 shift
- return (-src[-stride] + 9 * src[0] + 9 * src[stride] - src[stride*2] + 8 - r) >> 4;
+ return (-src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2] + 8 - r) >> 4;
case 3: // 3/4 shift
- return (-3 * src[-stride] + 18 * src[0] + 53 * src[stride] - 4 * src[stride*2] + 32 - r) >> 6;
+ return (-3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2] + 32 - r) >> 6;
}
return 0; //should not occur
}
@@ -634,8 +612,7 @@ PUT_VC1_MSPEL(1, 3)
PUT_VC1_MSPEL(2, 3)
PUT_VC1_MSPEL(3, 3)
-av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx)
-{
+av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3.c
index 171f5bdcc..e3595e718 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3.c
@@ -44,16 +44,14 @@
static av_cold int vp3_decode_end(AVCodecContext *avctx);
-typedef struct Coeff
-{
+typedef struct Coeff {
struct Coeff *next;
DCTELEM coeff;
uint8_t index;
} Coeff;
//FIXME split things out into their own arrays
-typedef struct Vp3Fragment
-{
+typedef struct Vp3Fragment {
Coeff *next_coeff;
/* address of first pixel taking into account which plane the fragment
* lives on as well as the plane stride */
@@ -89,59 +87,46 @@ typedef struct Vp3Fragment
static const int ModeAlphabet[6][CODING_MODE_COUNT] =
{
/* scheme 1: Last motion vector dominates */
- {
- MODE_INTER_LAST_MV, MODE_INTER_PRIOR_LAST,
- MODE_INTER_PLUS_MV, MODE_INTER_NO_MV,
- MODE_INTRA, MODE_USING_GOLDEN,
- MODE_GOLDEN_MV, MODE_INTER_FOURMV
- },
+ { MODE_INTER_LAST_MV, MODE_INTER_PRIOR_LAST,
+ MODE_INTER_PLUS_MV, MODE_INTER_NO_MV,
+ MODE_INTRA, MODE_USING_GOLDEN,
+ MODE_GOLDEN_MV, MODE_INTER_FOURMV },
/* scheme 2 */
- {
- MODE_INTER_LAST_MV, MODE_INTER_PRIOR_LAST,
- MODE_INTER_NO_MV, MODE_INTER_PLUS_MV,
- MODE_INTRA, MODE_USING_GOLDEN,
- MODE_GOLDEN_MV, MODE_INTER_FOURMV
- },
+ { MODE_INTER_LAST_MV, MODE_INTER_PRIOR_LAST,
+ MODE_INTER_NO_MV, MODE_INTER_PLUS_MV,
+ MODE_INTRA, MODE_USING_GOLDEN,
+ MODE_GOLDEN_MV, MODE_INTER_FOURMV },
/* scheme 3 */
- {
- MODE_INTER_LAST_MV, MODE_INTER_PLUS_MV,
- MODE_INTER_PRIOR_LAST, MODE_INTER_NO_MV,
- MODE_INTRA, MODE_USING_GOLDEN,
- MODE_GOLDEN_MV, MODE_INTER_FOURMV
- },
+ { MODE_INTER_LAST_MV, MODE_INTER_PLUS_MV,
+ MODE_INTER_PRIOR_LAST, MODE_INTER_NO_MV,
+ MODE_INTRA, MODE_USING_GOLDEN,
+ MODE_GOLDEN_MV, MODE_INTER_FOURMV },
/* scheme 4 */
- {
- MODE_INTER_LAST_MV, MODE_INTER_PLUS_MV,
- MODE_INTER_NO_MV, MODE_INTER_PRIOR_LAST,
- MODE_INTRA, MODE_USING_GOLDEN,
- MODE_GOLDEN_MV, MODE_INTER_FOURMV
- },
+ { MODE_INTER_LAST_MV, MODE_INTER_PLUS_MV,
+ MODE_INTER_NO_MV, MODE_INTER_PRIOR_LAST,
+ MODE_INTRA, MODE_USING_GOLDEN,
+ MODE_GOLDEN_MV, MODE_INTER_FOURMV },
/* scheme 5: No motion vector dominates */
- {
- MODE_INTER_NO_MV, MODE_INTER_LAST_MV,
- MODE_INTER_PRIOR_LAST, MODE_INTER_PLUS_MV,
- MODE_INTRA, MODE_USING_GOLDEN,
- MODE_GOLDEN_MV, MODE_INTER_FOURMV
- },
+ { MODE_INTER_NO_MV, MODE_INTER_LAST_MV,
+ MODE_INTER_PRIOR_LAST, MODE_INTER_PLUS_MV,
+ MODE_INTRA, MODE_USING_GOLDEN,
+ MODE_GOLDEN_MV, MODE_INTER_FOURMV },
/* scheme 6 */
- {
- MODE_INTER_NO_MV, MODE_USING_GOLDEN,
- MODE_INTER_LAST_MV, MODE_INTER_PRIOR_LAST,
- MODE_INTER_PLUS_MV, MODE_INTRA,
- MODE_GOLDEN_MV, MODE_INTER_FOURMV
- },
+ { MODE_INTER_NO_MV, MODE_USING_GOLDEN,
+ MODE_INTER_LAST_MV, MODE_INTER_PRIOR_LAST,
+ MODE_INTER_PLUS_MV, MODE_INTRA,
+ MODE_GOLDEN_MV, MODE_INTER_FOURMV },
};
#define MIN_DEQUANT_VAL 2
-typedef struct Vp3DecodeContext
-{
+typedef struct Vp3DecodeContext {
AVCodecContext *avctx;
int theora, theora_tables;
int version;
@@ -258,9 +243,9 @@ typedef struct Vp3DecodeContext
DECLARE_ALIGNED_8(int, bounding_values_array)[256+2];
/* ffdshow custom stuffs (begin) */
- int fps_numerator, fps_denumerator;
+ int fps_numerator,fps_denumerator;
int64_t granulepos;
- int keyframe_granule_shift, keyframe_frequency_force;
+ int keyframe_granule_shift,keyframe_frequency_force;
/* ffdshow custom stuffs (end) */
} Vp3DecodeContext;
@@ -291,30 +276,26 @@ static int init_block_mapping(Vp3DecodeContext *s)
int current_macroblock;
int c_fragment;
- static const signed char travel_width[16] =
- {
- 1, 1, 0, -1,
- 0, 0, 1, 0,
- 1, 0, 1, 0,
- 0, -1, 0, 1
+ static const signed char travel_width[16] = {
+ 1, 1, 0, -1,
+ 0, 0, 1, 0,
+ 1, 0, 1, 0,
+ 0, -1, 0, 1
};
- static const signed char travel_height[16] =
- {
- 0, 0, 1, 0,
- 1, 1, 0, -1,
- 0, 1, 0, -1,
+ static const signed char travel_height[16] = {
+ 0, 0, 1, 0,
+ 1, 1, 0, -1,
+ 0, 1, 0, -1,
-1, 0, -1, 0
};
- static const signed char travel_width_mb[4] =
- {
- 1, 0, 1, 0
+ static const signed char travel_width_mb[4] = {
+ 1, 0, 1, 0
};
- static const signed char travel_height_mb[4] =
- {
- 0, 1, 0, -1
+ static const signed char travel_height_mb[4] = {
+ 0, 1, 0, -1
};
hilbert_walk_mb[0] = 1;
@@ -323,11 +304,9 @@ static int init_block_mapping(Vp3DecodeContext *s)
hilbert_walk_mb[3] = -s->macroblock_width;
/* iterate through each superblock (all planes) and map the fragments */
- for(i = 0; i < s->superblock_count; i++)
- {
+ for (i = 0; i < s->superblock_count; i++) {
/* time to re-assign the limits? */
- if(i == 0)
- {
+ if (i == 0) {
/* start of Y superblocks */
right_edge = s->fragment_width;
@@ -335,14 +314,12 @@ static int init_block_mapping(Vp3DecodeContext *s)
current_width = -1;
current_height = 0;
superblock_row_inc = 3 * s->fragment_width -
- (s->y_superblock_width * 4 - s->fragment_width);
+ (s->y_superblock_width * 4 - s->fragment_width);
/* the first operation for this variable is to advance by 1 */
current_fragment = -1;
- }
- else if(i == s->u_superblock_start)
- {
+ } else if (i == s->u_superblock_start) {
/* start of U superblocks */
right_edge = s->fragment_width / 2;
@@ -350,14 +327,12 @@ static int init_block_mapping(Vp3DecodeContext *s)
current_width = -1;
current_height = 0;
superblock_row_inc = 3 * (s->fragment_width / 2) -
- (s->c_superblock_width * 4 - s->fragment_width / 2);
+ (s->c_superblock_width * 4 - s->fragment_width / 2);
/* the first operation for this variable is to advance by 1 */
current_fragment = s->fragment_start[1] - 1;
- }
- else if(i == s->v_superblock_start)
- {
+ } else if (i == s->v_superblock_start) {
/* start of V superblocks */
right_edge = s->fragment_width / 2;
@@ -365,15 +340,14 @@ static int init_block_mapping(Vp3DecodeContext *s)
current_width = -1;
current_height = 0;
superblock_row_inc = 3 * (s->fragment_width / 2) -
- (s->c_superblock_width * 4 - s->fragment_width / 2);
+ (s->c_superblock_width * 4 - s->fragment_width / 2);
/* the first operation for this variable is to advance by 1 */
current_fragment = s->fragment_start[2] - 1;
}
- if(current_width >= right_edge - 1)
- {
+ if (current_width >= right_edge - 1) {
/* reset width and move to next superblock row */
current_width = -1;
current_height += 4;
@@ -383,20 +357,16 @@ static int init_block_mapping(Vp3DecodeContext *s)
}
/* iterate through all 16 fragments in a superblock */
- for(j = 0; j < 16; j++)
- {
+ for (j = 0; j < 16; j++) {
current_fragment += travel_width[j] + right_edge * travel_height[j];
current_width += travel_width[j];
current_height += travel_height[j];
/* check if the fragment is in bounds */
- if((current_width < right_edge) &&
- (current_height < bottom_edge))
- {
+ if ((current_width < right_edge) &&
+ (current_height < bottom_edge)) {
s->superblock_fragments[mapping_index] = current_fragment;
- }
- else
- {
+ } else {
s->superblock_fragments[mapping_index] = -1;
}
@@ -411,14 +381,12 @@ static int init_block_mapping(Vp3DecodeContext *s)
current_width = -1;
current_height = 0;
superblock_row_inc = s->macroblock_width -
- (s->y_superblock_width * 2 - s->macroblock_width);
+ (s->y_superblock_width * 2 - s->macroblock_width);
mapping_index = 0;
current_macroblock = -1;
- for(i = 0; i < s->u_superblock_start; i++)
- {
+ for (i = 0; i < s->u_superblock_start; i++) {
- if(current_width >= right_edge - 1)
- {
+ if (current_width >= right_edge - 1) {
/* reset width and move to next superblock row */
current_width = -1;
current_height += 2;
@@ -428,20 +396,16 @@ static int init_block_mapping(Vp3DecodeContext *s)
}
/* iterate through each potential macroblock in the superblock */
- for(j = 0; j < 4; j++)
- {
+ for (j = 0; j < 4; j++) {
current_macroblock += hilbert_walk_mb[j];
current_width += travel_width_mb[j];
current_height += travel_height_mb[j];
/* check if the macroblock is in bounds */
- if((current_width < right_edge) &&
- (current_height < bottom_edge))
- {
+ if ((current_width < right_edge) &&
+ (current_height < bottom_edge)) {
s->superblock_macroblocks[mapping_index] = current_macroblock;
- }
- else
- {
+ } else {
s->superblock_macroblocks[mapping_index] = -1;
}
@@ -453,55 +417,47 @@ static int init_block_mapping(Vp3DecodeContext *s)
current_fragment = 0;
current_macroblock = 0;
mapping_index = 0;
- for(i = 0; i < s->fragment_height; i += 2)
- {
+ for (i = 0; i < s->fragment_height; i += 2) {
- for(j = 0; j < s->fragment_width; j += 2)
- {
+ for (j = 0; j < s->fragment_width; j += 2) {
s->all_fragments[current_fragment].macroblock = current_macroblock;
s->macroblock_fragments[mapping_index++] = current_fragment;
- if(j + 1 < s->fragment_width)
- {
+ if (j + 1 < s->fragment_width) {
s->all_fragments[current_fragment + 1].macroblock = current_macroblock;
s->macroblock_fragments[mapping_index++] = current_fragment + 1;
- }
- else
+ } else
s->macroblock_fragments[mapping_index++] = -1;
- if(i + 1 < s->fragment_height)
- {
+ if (i + 1 < s->fragment_height) {
s->all_fragments[current_fragment + s->fragment_width].macroblock =
current_macroblock;
s->macroblock_fragments[mapping_index++] =
current_fragment + s->fragment_width;
- }
- else
+ } else
s->macroblock_fragments[mapping_index++] = -1;
- if((j + 1 < s->fragment_width) && (i + 1 < s->fragment_height))
- {
+ if ((j + 1 < s->fragment_width) && (i + 1 < s->fragment_height)) {
s->all_fragments[current_fragment + s->fragment_width + 1].macroblock =
current_macroblock;
s->macroblock_fragments[mapping_index++] =
current_fragment + s->fragment_width + 1;
- }
- else
+ } else
s->macroblock_fragments[mapping_index++] = -1;
/* C planes */
c_fragment = s->fragment_start[1] +
- (i * s->fragment_width / 4) + (j / 2);
+ (i * s->fragment_width / 4) + (j / 2);
s->all_fragments[c_fragment].macroblock = s->macroblock_count;
s->macroblock_fragments[mapping_index++] = c_fragment;
c_fragment = s->fragment_start[2] +
- (i * s->fragment_width / 4) + (j / 2);
+ (i * s->fragment_width / 4) + (j / 2);
s->all_fragments[c_fragment].macroblock = s->macroblock_count;
s->macroblock_fragments[mapping_index++] = c_fragment;
- if(j + 2 <= s->fragment_width)
+ if (j + 2 <= s->fragment_width)
current_fragment += 2;
else
current_fragment++;
@@ -523,16 +479,15 @@ static void init_frame(Vp3DecodeContext *s, GetBitContext *gb)
/* zero out all of the fragment information */
s->coded_fragment_list_index = 0;
- for(i = 0; i < s->fragment_count; i++)
- {
+ for (i = 0; i < s->fragment_count; i++) {
s->coeff_counts[i] = 0;
s->all_fragments[i].motion_x = 127;
s->all_fragments[i].motion_y = 127;
- s->all_fragments[i].next_coeff = NULL;
+ s->all_fragments[i].next_coeff= NULL;
s->all_fragments[i].qpi = 0;
- s->coeffs[i].index =
- s->coeffs[i].coeff = 0;
- s->coeffs[i].next = NULL;
+ s->coeffs[i].index=
+ s->coeffs[i].coeff=0;
+ s->coeffs[i].next= NULL;
}
}
@@ -546,38 +501,34 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi)
int dc_scale_factor = s->coded_dc_scale_factor[s->qps[qpi]];
int i, plane, inter, qri, bmi, bmj, qistart;
- for(inter = 0; inter < 2; inter++)
- {
- for(plane = 0; plane < 3; plane++)
- {
- int sum = 0;
- for(qri = 0; qri < s->qr_count[inter][plane]; qri++)
- {
- sum += s->qr_size[inter][plane][qri];
+ for(inter=0; inter<2; inter++){
+ for(plane=0; plane<3; plane++){
+ int sum=0;
+ for(qri=0; qri<s->qr_count[inter][plane]; qri++){
+ sum+= s->qr_size[inter][plane][qri];
if(s->qps[qpi] <= sum)
break;
}
- qistart = sum - s->qr_size[inter][plane][qri];
- bmi = s->qr_base[inter][plane][qri ];
- bmj = s->qr_base[inter][plane][qri+1];
- for(i = 0; i < 64; i++)
- {
- int coeff = (2 * (sum - s->qps[qpi]) * s->base_matrix[bmi][i]
- - 2 * (qistart - s->qps[qpi]) * s->base_matrix[bmj][i]
- + s->qr_size[inter][plane][qri])
- / (2 * s->qr_size[inter][plane][qri]);
-
- int qmin = 8 << (inter + !i);
- int qscale = i ? ac_scale_factor : dc_scale_factor;
-
- s->qmat[qpi][inter][plane][s->dsp.idct_permutation[i]] = av_clip((qscale * coeff) / 100 * 4, qmin, 4096);
+ qistart= sum - s->qr_size[inter][plane][qri];
+ bmi= s->qr_base[inter][plane][qri ];
+ bmj= s->qr_base[inter][plane][qri+1];
+ for(i=0; i<64; i++){
+ int coeff= ( 2*(sum -s->qps[qpi])*s->base_matrix[bmi][i]
+ - 2*(qistart-s->qps[qpi])*s->base_matrix[bmj][i]
+ + s->qr_size[inter][plane][qri])
+ / (2*s->qr_size[inter][plane][qri]);
+
+ int qmin= 8<<(inter + !i);
+ int qscale= i ? ac_scale_factor : dc_scale_factor;
+
+ s->qmat[qpi][inter][plane][s->dsp.idct_permutation[i]]= av_clip((qscale * coeff)/100 * 4, qmin, 4096);
}
// all DC coefficients use the same quant so as not to interfere with DC prediction
s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0];
}
}
- memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1]) + 8) / 16, 512); //FIXME finetune
+ memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune
}
/*
@@ -588,7 +539,7 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi)
*/
static void init_loop_filter(Vp3DecodeContext *s)
{
- int *bounding_values = s->bounding_values_array + 127;
+ int *bounding_values= s->bounding_values_array+127;
int filter_limit;
int x;
int value;
@@ -597,17 +548,15 @@ static void init_loop_filter(Vp3DecodeContext *s)
/* set up the bounding values */
memset(s->bounding_values_array, 0, 256 * sizeof(int));
- for(x = 0; x < filter_limit; x++)
- {
+ for (x = 0; x < filter_limit; x++) {
bounding_values[-x] = -x;
bounding_values[x] = x;
}
- for(x = value = filter_limit; x < 128 && value; x++, value--)
- {
+ for (x = value = filter_limit; x < 128 && value; x++, value--) {
bounding_values[ x] = value;
bounding_values[-x] = -value;
}
- if(value)
+ if (value)
bounding_values[128] = value;
bounding_values[129] = bounding_values[130] = filter_limit * 0x02020202;
}
@@ -628,37 +577,29 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
int i, j;
int current_fragment;
- if(s->keyframe)
- {
+ if (s->keyframe) {
memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count);
- }
- else
- {
+ } else {
/* unpack the list of partially-coded superblocks */
bit = get_bits1(gb);
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
- while(current_superblock < s->superblock_count)
- {
- if(current_run-- == 0)
- {
+ while (current_superblock < s->superblock_count) {
+ if (current_run-- == 0) {
bit ^= 1;
current_run = get_vlc2(gb,
- s->superblock_run_length_vlc.table, 6, 2);
- if(current_run == 33)
+ s->superblock_run_length_vlc.table, 6, 2);
+ if (current_run == 33)
current_run += get_bits(gb, 12);
/* if any of the superblocks are not partially coded, flag
* a boolean to decode the list of fully-coded superblocks */
- if(bit == 0)
- {
+ if (bit == 0) {
decode_fully_flags = 1;
- }
- else
- {
+ } else {
/* make a note of the fact that there are partially coded
* superblocks */
@@ -670,8 +611,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* unpack the list of fully coded superblocks if any of the blocks were
* not marked as partially coded in the previous step */
- if(decode_fully_flags)
- {
+ if (decode_fully_flags) {
current_superblock = 0;
current_run = 0;
@@ -679,22 +619,19 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
- while(current_superblock < s->superblock_count)
- {
+ while (current_superblock < s->superblock_count) {
/* skip any superblocks already marked as partially coded */
- if(s->superblock_coding[current_superblock] == SB_NOT_CODED)
- {
+ if (s->superblock_coding[current_superblock] == SB_NOT_CODED) {
- if(current_run-- == 0)
- {
+ if (current_run-- == 0) {
bit ^= 1;
current_run = get_vlc2(gb,
- s->superblock_run_length_vlc.table, 6, 2);
- if(current_run == 33)
+ s->superblock_run_length_vlc.table, 6, 2);
+ if (current_run == 33)
current_run += get_bits(gb, 12);
}
- s->superblock_coding[current_superblock] = 2 * bit;
+ s->superblock_coding[current_superblock] = 2*bit;
}
current_superblock++;
}
@@ -702,8 +639,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* if there were partial blocks, initialize bitstream for
* unpacking fragment codings */
- if(decode_partial_blocks)
- {
+ if (decode_partial_blocks) {
current_run = 0;
bit = get_bits1(gb);
@@ -716,90 +652,75 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* figure out which fragments are coded; iterate through each
* superblock (all planes) */
s->coded_fragment_list_index = 0;
- s->next_coeff = s->coeffs + s->fragment_count;
+ s->next_coeff= s->coeffs + s->fragment_count;
s->first_coded_y_fragment = s->first_coded_c_fragment = 0;
s->last_coded_y_fragment = s->last_coded_c_fragment = -1;
first_c_fragment_seen = 0;
memset(s->macroblock_coding, MODE_COPY, s->macroblock_count);
- for(i = 0; i < s->superblock_count; i++)
- {
+ for (i = 0; i < s->superblock_count; i++) {
/* iterate through all 16 fragments in a superblock */
- for(j = 0; j < 16; j++)
- {
+ for (j = 0; j < 16; j++) {
/* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j];
- if(current_fragment >= s->fragment_count)
- {
+ if (current_fragment >= s->fragment_count) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_superblocks(): bad fragment number (%d >= %d)\n",
- current_fragment, s->fragment_count);
+ current_fragment, s->fragment_count);
return 1;
}
- if(current_fragment != -1)
- {
- if(s->superblock_coding[i] == SB_NOT_CODED)
- {
+ if (current_fragment != -1) {
+ if (s->superblock_coding[i] == SB_NOT_CODED) {
/* copy all the fragments from the prior frame */
s->all_fragments[current_fragment].coding_method =
MODE_COPY;
- }
- else if(s->superblock_coding[i] == SB_PARTIALLY_CODED)
- {
+ } else if (s->superblock_coding[i] == SB_PARTIALLY_CODED) {
/* fragment may or may not be coded; this is the case
* that cares about the fragment coding runs */
- if(current_run-- == 0)
- {
+ if (current_run-- == 0) {
bit ^= 1;
current_run = get_vlc2(gb,
- s->fragment_run_length_vlc.table, 5, 2);
+ s->fragment_run_length_vlc.table, 5, 2);
}
- if(bit)
- {
+ if (bit) {
/* default mode; actual mode will be decoded in
* the next phase */
s->all_fragments[current_fragment].coding_method =
MODE_INTER_NO_MV;
- s->all_fragments[current_fragment].next_coeff = s->coeffs + current_fragment;
+ s->all_fragments[current_fragment].next_coeff= s->coeffs + current_fragment;
s->coded_fragment_list[s->coded_fragment_list_index] =
current_fragment;
- if((current_fragment >= s->fragment_start[1]) &&
- (s->last_coded_y_fragment == -1) &&
- (!first_c_fragment_seen))
- {
+ if ((current_fragment >= s->fragment_start[1]) &&
+ (s->last_coded_y_fragment == -1) &&
+ (!first_c_fragment_seen)) {
s->first_coded_c_fragment = s->coded_fragment_list_index;
s->last_coded_y_fragment = s->first_coded_c_fragment - 1;
first_c_fragment_seen = 1;
}
s->coded_fragment_list_index++;
s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV;
- }
- else
- {
+ } else {
/* not coded; copy this fragment from the prior frame */
s->all_fragments[current_fragment].coding_method =
MODE_COPY;
}
- }
- else
- {
+ } else {
/* fragments are fully coded in this superblock; actual
* coding will be determined in next step */
s->all_fragments[current_fragment].coding_method =
MODE_INTER_NO_MV;
- s->all_fragments[current_fragment].next_coeff = s->coeffs + current_fragment;
+ s->all_fragments[current_fragment].next_coeff= s->coeffs + current_fragment;
s->coded_fragment_list[s->coded_fragment_list_index] =
current_fragment;
- if((current_fragment >= s->fragment_start[1]) &&
- (s->last_coded_y_fragment == -1) &&
- (!first_c_fragment_seen))
- {
+ if ((current_fragment >= s->fragment_start[1]) &&
+ (s->last_coded_y_fragment == -1) &&
+ (!first_c_fragment_seen)) {
s->first_coded_c_fragment = s->coded_fragment_list_index;
s->last_coded_y_fragment = s->first_coded_c_fragment - 1;
first_c_fragment_seen = 1;
@@ -811,31 +732,28 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
}
}
- if(!first_c_fragment_seen)
+ if (!first_c_fragment_seen)
/* only Y fragments coded in this frame */
s->last_coded_y_fragment = s->coded_fragment_list_index - 1;
else
/* end the list of coded C fragments */
s->last_coded_c_fragment = s->coded_fragment_list_index - 1;
- for(i = 0; i < s->fragment_count - 1; i++)
- {
+ for (i = 0; i < s->fragment_count - 1; i++) {
s->fast_fragment_list[i] = i + 1;
}
s->fast_fragment_list[s->fragment_count - 1] = -1;
- if(s->last_coded_y_fragment == -1)
+ if (s->last_coded_y_fragment == -1)
s->fragment_list_y_head = -1;
- else
- {
+ else {
s->fragment_list_y_head = s->first_coded_y_fragment;
s->fast_fragment_list[s->last_coded_y_fragment] = -1;
}
- if(s->last_coded_c_fragment == -1)
+ if (s->last_coded_c_fragment == -1)
s->fragment_list_c_head = -1;
- else
- {
+ else {
s->fragment_list_c_head = s->first_coded_c_fragment;
s->fast_fragment_list[s->last_coded_c_fragment] = -1;
}
@@ -856,70 +774,61 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
int coding_mode;
int custom_mode_alphabet[CODING_MODE_COUNT];
- if(s->keyframe)
- {
- for(i = 0; i < s->fragment_count; i++)
+ if (s->keyframe) {
+ for (i = 0; i < s->fragment_count; i++)
s->all_fragments[i].coding_method = MODE_INTRA;
- }
- else
- {
+ } else {
/* fetch the mode coding scheme for this frame */
scheme = get_bits(gb, 3);
/* is it a custom coding scheme? */
- if(scheme == 0)
- {
- for(i = 0; i < 8; i++)
+ if (scheme == 0) {
+ for (i = 0; i < 8; i++)
custom_mode_alphabet[i] = MODE_INTER_NO_MV;
- for(i = 0; i < 8; i++)
+ for (i = 0; i < 8; i++)
custom_mode_alphabet[get_bits(gb, 3)] = i;
}
/* iterate through all of the macroblocks that contain 1 or more
* coded fragments */
- for(i = 0; i < s->u_superblock_start; i++)
- {
+ for (i = 0; i < s->u_superblock_start; i++) {
- for(j = 0; j < 4; j++)
- {
+ for (j = 0; j < 4; j++) {
current_macroblock = s->superblock_macroblocks[i * 4 + j];
- if((current_macroblock == -1) ||
- (s->macroblock_coding[current_macroblock] == MODE_COPY))
+ if ((current_macroblock == -1) ||
+ (s->macroblock_coding[current_macroblock] == MODE_COPY))
continue;
- if(current_macroblock >= s->macroblock_count)
- {
+ if (current_macroblock >= s->macroblock_count) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_modes(): bad macroblock number (%d >= %d)\n",
- current_macroblock, s->macroblock_count);
+ current_macroblock, s->macroblock_count);
return 1;
}
/* mode 7 means get 3 bits for each coding mode */
- if(scheme == 7)
+ if (scheme == 7)
coding_mode = get_bits(gb, 3);
else if(scheme == 0)
coding_mode = custom_mode_alphabet
- [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
+ [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
else
coding_mode = ModeAlphabet[scheme-1]
- [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
+ [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
s->macroblock_coding[current_macroblock] = coding_mode;
- for(k = 0; k < 6; k++)
- {
+ for (k = 0; k < 6; k++) {
current_fragment =
s->macroblock_fragments[current_macroblock * 6 + k];
- if(current_fragment == -1)
+ if (current_fragment == -1)
continue;
- if(current_fragment >= s->fragment_count)
- {
+ if (current_fragment >= s->fragment_count) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_modes(): bad fragment number (%d >= %d)\n",
- current_fragment, s->fragment_count);
+ current_fragment, s->fragment_count);
return 1;
}
- if(s->all_fragments[current_fragment].coding_method !=
- MODE_COPY)
+ if (s->all_fragments[current_fragment].coding_method !=
+ MODE_COPY)
s->all_fragments[current_fragment].coding_method =
coding_mode;
}
@@ -947,7 +856,7 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
int current_macroblock;
int current_fragment;
- if(s->keyframe)
+ if (s->keyframe)
return 0;
memset(motion_x, 0, 6 * sizeof(int));
@@ -958,50 +867,41 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
/* iterate through all of the macroblocks that contain 1 or more
* coded fragments */
- for(i = 0; i < s->u_superblock_start; i++)
- {
+ for (i = 0; i < s->u_superblock_start; i++) {
- for(j = 0; j < 4; j++)
- {
+ for (j = 0; j < 4; j++) {
current_macroblock = s->superblock_macroblocks[i * 4 + j];
- if((current_macroblock == -1) ||
- (s->macroblock_coding[current_macroblock] == MODE_COPY))
+ if ((current_macroblock == -1) ||
+ (s->macroblock_coding[current_macroblock] == MODE_COPY))
continue;
- if(current_macroblock >= s->macroblock_count)
- {
+ if (current_macroblock >= s->macroblock_count) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad macroblock number (%d >= %d)\n",
- current_macroblock, s->macroblock_count);
+ current_macroblock, s->macroblock_count);
return 1;
}
current_fragment = s->macroblock_fragments[current_macroblock * 6];
- if(current_fragment >= s->fragment_count)
- {
+ if (current_fragment >= s->fragment_count) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d\n",
- current_fragment, s->fragment_count);
+ current_fragment, s->fragment_count);
return 1;
}
- switch(s->macroblock_coding[current_macroblock])
- {
+ switch (s->macroblock_coding[current_macroblock]) {
case MODE_INTER_PLUS_MV:
case MODE_GOLDEN_MV:
/* all 6 fragments use the same motion vector */
- if(coding_mode == 0)
- {
+ if (coding_mode == 0) {
motion_x[0] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
motion_y[0] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
- }
- else
- {
+ } else {
motion_x[0] = fixed_motion_vector_table[get_bits(gb, 6)];
motion_y[0] = fixed_motion_vector_table[get_bits(gb, 6)];
}
/* vector maintenance, only on MODE_INTER_PLUS_MV */
- if(s->macroblock_coding[current_macroblock] ==
- MODE_INTER_PLUS_MV)
- {
+ if (s->macroblock_coding[current_macroblock] ==
+ MODE_INTER_PLUS_MV) {
prior_last_motion_x = last_motion_x;
prior_last_motion_y = last_motion_y;
last_motion_x = motion_x[0];
@@ -1017,28 +917,21 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
/* fetch 4 vectors from the bitstream, one for each
* Y fragment, then average for the C fragment vectors */
motion_x[4] = motion_y[4] = 0;
- for(k = 0; k < 4; k++)
- {
- for(l = 0; l < s->coded_fragment_list_index; l++)
- if(s->coded_fragment_list[l] == s->macroblock_fragments[6*current_macroblock + k])
+ for (k = 0; k < 4; k++) {
+ for (l = 0; l < s->coded_fragment_list_index; l++)
+ if (s->coded_fragment_list[l] == s->macroblock_fragments[6*current_macroblock + k])
break;
- if(l < s->coded_fragment_list_index)
- {
- if(coding_mode == 0)
- {
+ if (l < s->coded_fragment_list_index) {
+ if (coding_mode == 0) {
motion_x[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
motion_y[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
- }
- else
- {
+ } else {
motion_x[k] = fixed_motion_vector_table[get_bits(gb, 6)];
motion_y[k] = fixed_motion_vector_table[get_bits(gb, 6)];
}
last_motion_x = motion_x[k];
last_motion_y = motion_y[k];
- }
- else
- {
+ } else {
motion_x[k] = 0;
motion_y[k] = 0;
}
@@ -1046,10 +939,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
motion_y[4] += motion_y[k];
}
- motion_x[5] =
- motion_x[4] = RSHIFT(motion_x[4], 2);
- motion_y[5] =
- motion_y[4] = RSHIFT(motion_y[4], 2);
+ motion_x[5]=
+ motion_x[4]= RSHIFT(motion_x[4], 2);
+ motion_y[5]=
+ motion_y[4]= RSHIFT(motion_y[4], 2);
break;
case MODE_INTER_LAST_MV:
@@ -1084,25 +977,20 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
}
/* assign the motion vectors to the correct fragments */
- for(k = 0; k < 6; k++)
- {
+ for (k = 0; k < 6; k++) {
current_fragment =
s->macroblock_fragments[current_macroblock * 6 + k];
- if(current_fragment == -1)
+ if (current_fragment == -1)
continue;
- if(current_fragment >= s->fragment_count)
- {
+ if (current_fragment >= s->fragment_count) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d)\n",
- current_fragment, s->fragment_count);
+ current_fragment, s->fragment_count);
return 1;
}
- if(s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV)
- {
+ if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
s->all_fragments[current_fragment].motion_x = motion_x[k];
s->all_fragments[current_fragment].motion_y = motion_y[k];
- }
- else
- {
+ } else {
s->all_fragments[current_fragment].motion_x = motion_x[0];
s->all_fragments[current_fragment].motion_y = motion_y[0];
}
@@ -1118,40 +1006,35 @@ static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;
int num_blocks = s->coded_fragment_list_index;
- for(qpi = 0; qpi < s->nqps - 1 && num_blocks > 0; qpi++)
- {
+ for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {
i = blocks_decoded = num_blocks_at_qpi = 0;
bit = get_bits1(gb);
- do
- {
+ do {
run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;
- if(run_length == 34)
+ if (run_length == 34)
run_length += get_bits(gb, 12);
blocks_decoded += run_length;
- if(!bit)
+ if (!bit)
num_blocks_at_qpi += run_length;
- for(j = 0; j < run_length; i++)
- {
- if(i >= s->coded_fragment_list_index)
+ for (j = 0; j < run_length; i++) {
+ if (i >= s->coded_fragment_list_index)
return -1;
- if(s->all_fragments[s->coded_fragment_list[i]].qpi == qpi)
- {
+ if (s->all_fragments[s->coded_fragment_list[i]].qpi == qpi) {
s->all_fragments[s->coded_fragment_list[i]].qpi += bit;
j++;
}
}
- if(run_length == 4129)
+ if (run_length == 4129)
bit = get_bits1(gb);
else
bit ^= 1;
- }
- while(blocks_decoded < num_blocks);
+ } while (blocks_decoded < num_blocks);
num_blocks -= num_blocks_at_qpi;
}
@@ -1172,9 +1055,9 @@ static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
* be passed into the next call to this same function.
*/
static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
- VLC *table, int coeff_index,
- int y_plane,
- int eob_run)
+ VLC *table, int coeff_index,
+ int y_plane,
+ int eob_run)
{
int i;
int token;
@@ -1188,83 +1071,70 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
int *list_head;
/* local references to structure members to avoid repeated deferences */
- uint8_t *perm = s->scantable.permutated;
+ uint8_t *perm= s->scantable.permutated;
int *coded_fragment_list = s->coded_fragment_list;
Vp3Fragment *all_fragments = s->all_fragments;
uint8_t *coeff_counts = s->coeff_counts;
- VLC_TYPE(*vlc_table)[2] = table->table;
+ VLC_TYPE (*vlc_table)[2] = table->table;
int *fast_fragment_list = s->fast_fragment_list;
- if(y_plane)
- {
+ if (y_plane) {
next_fragment = s->fragment_list_y_head;
list_head = &s->fragment_list_y_head;
- }
- else
- {
+ } else {
next_fragment = s->fragment_list_c_head;
list_head = &s->fragment_list_c_head;
}
i = next_fragment;
previous_fragment = -1; /* this indicates that the previous fragment is actually the list head */
- while(i != -1)
- {
+ while (i != -1) {
fragment_num = coded_fragment_list[i];
- if(coeff_counts[fragment_num] > coeff_index)
- {
+ if (coeff_counts[fragment_num] > coeff_index) {
previous_fragment = i;
i = fast_fragment_list[i];
continue;
}
fragment = &all_fragments[fragment_num];
- if(!eob_run)
- {
+ if (!eob_run) {
/* decode a VLC into a token */
token = get_vlc2(gb, vlc_table, 5, 3);
/* use the token to get a zero run, a coefficient, and an eob run */
- if(token <= 6)
- {
+ if (token <= 6) {
eob_run = eob_run_base[token];
- if(eob_run_get_bits[token])
+ if (eob_run_get_bits[token])
eob_run += get_bits(gb, eob_run_get_bits[token]);
coeff = zero_run = 0;
- }
- else
- {
+ } else {
bits_to_get = coeff_get_bits[token];
- if(bits_to_get)
+ if (bits_to_get)
bits_to_get = get_bits(gb, bits_to_get);
coeff = coeff_tables[token][bits_to_get];
zero_run = zero_run_base[token];
- if(zero_run_get_bits[token])
+ if (zero_run_get_bits[token])
zero_run += get_bits(gb, zero_run_get_bits[token]);
}
}
- if(!eob_run)
- {
+ if (!eob_run) {
coeff_counts[fragment_num] += zero_run;
- if(coeff_counts[fragment_num] < 64)
- {
- fragment->next_coeff->coeff = coeff;
- fragment->next_coeff->index = perm[coeff_counts[fragment_num]++]; //FIXME perm here already?
- fragment->next_coeff->next = s->next_coeff;
- s->next_coeff->next = NULL;
- fragment->next_coeff = s->next_coeff++;
+ if (coeff_counts[fragment_num] < 64){
+ fragment->next_coeff->coeff= coeff;
+ fragment->next_coeff->index= perm[coeff_counts[fragment_num]++]; //FIXME perm here already?
+ fragment->next_coeff->next= s->next_coeff;
+ s->next_coeff->next=NULL;
+ fragment->next_coeff= s->next_coeff++;
}
/* previous fragment is now this fragment */
previous_fragment = i;
- }
- else
- {
+ } else {
coeff_counts[fragment_num] |= 128;
eob_run--;
/* remove this fragment from the list */
- if(previous_fragment != -1)
+ if (previous_fragment != -1)
fast_fragment_list[previous_fragment] = fast_fragment_list[i];
else
*list_head = fast_fragment_list[i];
@@ -1302,22 +1172,22 @@ static int unpack_dct_coeffs(Vp3DecodeContext *s, GetBitContext *gb)
/* unpack the Y plane DC coefficients */
residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_y_table], 0,
- 1, residual_eob_run);
+ 1, residual_eob_run);
/* reverse prediction of the Y-plane DC coefficients */
reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height);
/* unpack the C plane DC coefficients */
residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0,
- 0, residual_eob_run);
+ 0, residual_eob_run);
/* reverse prediction of the C-plane DC coefficients */
- if(!(s->avctx->flags & CODEC_FLAG_GRAY))
+ if (!(s->avctx->flags & CODEC_FLAG_GRAY))
{
reverse_dc_prediction(s, s->fragment_start[1],
- s->fragment_width / 2, s->fragment_height / 2);
+ s->fragment_width / 2, s->fragment_height / 2);
reverse_dc_prediction(s, s->fragment_start[2],
- s->fragment_width / 2, s->fragment_height / 2);
+ s->fragment_width / 2, s->fragment_height / 2);
}
/* fetch the AC table indexes */
@@ -1325,37 +1195,32 @@ static int unpack_dct_coeffs(Vp3DecodeContext *s, GetBitContext *gb)
ac_c_table = get_bits(gb, 4);
/* build tables of AC VLC tables */
- for(i = 1; i <= 5; i++)
- {
+ for (i = 1; i <= 5; i++) {
y_tables[i] = &s->ac_vlc_1[ac_y_table];
c_tables[i] = &s->ac_vlc_1[ac_c_table];
}
- for(i = 6; i <= 14; i++)
- {
+ for (i = 6; i <= 14; i++) {
y_tables[i] = &s->ac_vlc_2[ac_y_table];
c_tables[i] = &s->ac_vlc_2[ac_c_table];
}
- for(i = 15; i <= 27; i++)
- {
+ for (i = 15; i <= 27; i++) {
y_tables[i] = &s->ac_vlc_3[ac_y_table];
c_tables[i] = &s->ac_vlc_3[ac_c_table];
}
- for(i = 28; i <= 63; i++)
- {
+ for (i = 28; i <= 63; i++) {
y_tables[i] = &s->ac_vlc_4[ac_y_table];
c_tables[i] = &s->ac_vlc_4[ac_c_table];
}
/* decode all AC coefficents */
- for(i = 1; i <= 63; i++)
- {
- if(s->fragment_list_y_head != -1)
+ for (i = 1; i <= 63; i++) {
+ if (s->fragment_list_y_head != -1)
residual_eob_run = unpack_vlcs(s, gb, y_tables[i], i,
- 1, residual_eob_run);
+ 1, residual_eob_run);
- if(s->fragment_list_c_head != -1)
+ if (s->fragment_list_c_head != -1)
residual_eob_run = unpack_vlcs(s, gb, c_tables[i], i,
- 0, residual_eob_run);
+ 0, residual_eob_run);
}
return 0;
@@ -1399,24 +1264,23 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
* 2: up-right multiplier
* 3: left multiplier
*/
- static const int predictor_transform[16][4] =
- {
+ static const int predictor_transform[16][4] = {
{ 0, 0, 0, 0},
- { 0, 0, 0, 128}, // PL
- { 0, 0, 128, 0}, // PUR
+ { 0, 0, 0,128}, // PL
+ { 0, 0,128, 0}, // PUR
{ 0, 0, 53, 75}, // PUR|PL
- { 0, 128, 0, 0}, // PU
+ { 0,128, 0, 0}, // PU
{ 0, 64, 0, 64}, // PU|PL
- { 0, 128, 0, 0}, // PU|PUR
+ { 0,128, 0, 0}, // PU|PUR
{ 0, 0, 53, 75}, // PU|PUR|PL
{128, 0, 0, 0}, // PUL
- { 0, 0, 0, 128}, // PUL|PL
+ { 0, 0, 0,128}, // PUL|PL
{ 64, 0, 64, 0}, // PUL|PUR
{ 0, 0, 53, 75}, // PUL|PUR|PL
- { 0, 128, 0, 0}, // PUL|PU
- { -104, 116, 0, 116}, // PUL|PU|PL
+ { 0,128, 0, 0}, // PUL|PU
+ {-104,116, 0,116}, // PUL|PU|PL
{ 24, 80, 24, 0}, // PUL|PU|PUR
- { -104, 116, 0, 116} // PUL|PU|PUR|PL
+ {-104,116, 0,116} // PUL|PU|PUR|PL
};
/* This table shows which types of blocks can use other blocks for
@@ -1425,8 +1289,7 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
* from other INTRA blocks. There are 2 golden frame coding types;
* blocks encoding in these modes can only predict from other blocks
* that were encoded with these 1 of these 2 modes. */
- static const unsigned char compatible_frame[9] =
- {
+ static const unsigned char compatible_frame[9] = {
1, /* MODE_INTER_NO_MV */
0, /* MODE_INTRA */
1, /* MODE_INTER_PLUS_MV */
@@ -1448,59 +1311,49 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
last_dc[0] = last_dc[1] = last_dc[2] = 0;
/* for each fragment row... */
- for(y = 0; y < fragment_height; y++)
- {
+ for (y = 0; y < fragment_height; y++) {
/* for each fragment in a row... */
- for(x = 0; x < fragment_width; x++, i++)
- {
+ for (x = 0; x < fragment_width; x++, i++) {
/* reverse prediction if this block was coded */
- if(s->all_fragments[i].coding_method != MODE_COPY)
- {
+ if (s->all_fragments[i].coding_method != MODE_COPY) {
current_frame_type =
compatible_frame[s->all_fragments[i].coding_method];
- transform = 0;
- if(x)
- {
- l = i - 1;
+ transform= 0;
+ if(x){
+ l= i-1;
vl = DC_COEFF(l);
if(COMPATIBLE_FRAME(l))
transform |= PL;
}
- if(y)
- {
- u = i - fragment_width;
+ if(y){
+ u= i-fragment_width;
vu = DC_COEFF(u);
if(COMPATIBLE_FRAME(u))
transform |= PU;
- if(x)
- {
- ul = i - fragment_width - 1;
+ if(x){
+ ul= i-fragment_width-1;
vul = DC_COEFF(ul);
if(COMPATIBLE_FRAME(ul))
transform |= PUL;
}
- if(x + 1 < fragment_width)
- {
- ur = i - fragment_width + 1;
+ if(x + 1 < fragment_width){
+ ur= i-fragment_width+1;
vur = DC_COEFF(ur);
if(COMPATIBLE_FRAME(ur))
transform |= PUR;
}
}
- if(transform == 0)
- {
+ if (transform == 0) {
/* if there were no fragments to predict from, use last
* DC saved */
predicted_dc = last_dc[current_frame_type];
- }
- else
- {
+ } else {
/* apply the appropriate predictor transform */
predicted_dc =
@@ -1513,34 +1366,31 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
/* check for outranging on the [ul u l] and
* [ul u ur l] predictors */
- if((transform == 15) || (transform == 13))
- {
- if(FFABS(predicted_dc - vu) > 128)
+ if ((transform == 15) || (transform == 13)) {
+ if (FFABS(predicted_dc - vu) > 128)
predicted_dc = vu;
- else if(FFABS(predicted_dc - vl) > 128)
+ else if (FFABS(predicted_dc - vl) > 128)
predicted_dc = vl;
- else if(FFABS(predicted_dc - vul) > 128)
+ else if (FFABS(predicted_dc - vul) > 128)
predicted_dc = vul;
}
}
/* at long last, apply the predictor */
- if(s->coeffs[i].index)
- {
- *s->next_coeff = s->coeffs[i];
- s->coeffs[i].index = 0;
- s->coeffs[i].coeff = 0;
- s->coeffs[i].next = s->next_coeff++;
+ if(s->coeffs[i].index){
+ *s->next_coeff= s->coeffs[i];
+ s->coeffs[i].index=0;
+ s->coeffs[i].coeff=0;
+ s->coeffs[i].next= s->next_coeff++;
}
s->coeffs[i].coeff += predicted_dc;
/* save the DC */
last_dc[current_frame_type] = DC_COEFF(i);
- if(DC_COEFF(i) && !(s->coeff_counts[i] & 127))
- {
- s->coeff_counts[i] = 129;
+ if(DC_COEFF(i) && !(s->coeff_counts[i]&127)){
+ s->coeff_counts[i]= 129;
// s->all_fragments[i].next_coeff= s->next_coeff;
- s->coeffs[i].next = s->next_coeff;
- (s->next_coeff++)->next = NULL;
+ s->coeffs[i].next= s->next_coeff;
+ (s->next_coeff++)->next=NULL;
}
}
}
@@ -1562,11 +1412,10 @@ static void render_slice(Vp3DecodeContext *s, int slice)
int plane;
int current_macroblock_entry = slice * s->macroblock_width * 6;
- if(slice >= s->macroblock_height)
+ if (slice >= s->macroblock_height)
return;
- for(plane = 0; plane < 3; plane++)
- {
+ for (plane = 0; plane < 3; plane++) {
uint8_t *output_plane = s->current_frame.data [plane];
uint8_t * last_plane = s-> last_frame.data [plane];
uint8_t *golden_plane = s-> golden_frame.data [plane];
@@ -1577,57 +1426,51 @@ static void render_slice(Vp3DecodeContext *s, int slice)
int slice_height = y + (FRAGMENT_PIXELS << !plane);
int i = s->macroblock_fragments[current_macroblock_entry + plane + 3*!!plane];
- if(!s->flipped_image) stride = -stride;
+ if (!s->flipped_image) stride = -stride;
if(FFABS(stride) > 2048)
return; //various tables are fixed size
/* for each fragment row in the slice (both of them)... */
- for(; y < slice_height; y += 8)
- {
+ for (; y < slice_height; y += 8) {
/* for each fragment in a row... */
- for(x = 0; x < plane_width; x += 8, i++)
- {
+ for (x = 0; x < plane_width; x += 8, i++) {
- if((i < 0) || (i >= s->fragment_count))
- {
+ if ((i < 0) || (i >= s->fragment_count)) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:render_slice(): bad fragment number (%d)\n", i);
return;
}
/* transform if this block was coded */
- if((s->all_fragments[i].coding_method != MODE_COPY) &&
- !((s->avctx->flags & CODEC_FLAG_GRAY) && plane))
- {
+ if ((s->all_fragments[i].coding_method != MODE_COPY) &&
+ !((s->avctx->flags & CODEC_FLAG_GRAY) && plane)) {
- if((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||
- (s->all_fragments[i].coding_method == MODE_GOLDEN_MV))
- motion_source = golden_plane;
+ if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||
+ (s->all_fragments[i].coding_method == MODE_GOLDEN_MV))
+ motion_source= golden_plane;
else
- motion_source = last_plane;
+ motion_source= last_plane;
motion_source += s->all_fragments[i].first_pixel;
motion_halfpel_index = 0;
/* sort out the motion vector if this fragment is coded
* using a motion vector method */
- if((s->all_fragments[i].coding_method > MODE_INTRA) &&
- (s->all_fragments[i].coding_method != MODE_USING_GOLDEN))
- {
+ if ((s->all_fragments[i].coding_method > MODE_INTRA) &&
+ (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) {
int src_x, src_y;
motion_x = s->all_fragments[i].motion_x;
motion_y = s->all_fragments[i].motion_y;
- if(plane)
- {
- motion_x = (motion_x >> 1) | (motion_x & 1);
- motion_y = (motion_y >> 1) | (motion_y & 1);
+ if(plane){
+ motion_x= (motion_x>>1) | (motion_x&1);
+ motion_y= (motion_y>>1) | (motion_y&1);
}
- src_x = (motion_x >> 1) + x;
- src_y = (motion_y >> 1) + y;
- if((motion_x == 127) || (motion_y == 127))
+ src_x= (motion_x>>1) + x;
+ src_y= (motion_y>>1) + y;
+ if ((motion_x == 127) || (motion_y == 127))
av_log(s->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\n", motion_x, motion_y);
motion_halfpel_index = motion_x & 0x01;
@@ -1636,35 +1479,30 @@ static void render_slice(Vp3DecodeContext *s, int slice)
motion_halfpel_index |= (motion_y & 0x01) << 1;
motion_source += ((motion_y >> 1) * stride);
- if(src_x < 0 || src_y < 0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height)
- {
- uint8_t *temp = s->edge_emu_buffer;
- if(stride < 0) temp -= 9 * stride;
- else temp += 9 * stride;
+ if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){
+ uint8_t *temp= s->edge_emu_buffer;
+ if(stride<0) temp -= 9*stride;
+ else temp += 9*stride;
ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
- motion_source = temp;
+ motion_source= temp;
}
}
/* first, take care of copying a block from either the
* previous or the golden frame */
- if(s->all_fragments[i].coding_method != MODE_INTRA)
- {
+ if (s->all_fragments[i].coding_method != MODE_INTRA) {
/* Note, it is possible to implement all MC cases with
put_no_rnd_pixels_l2 which would look more like the
VP3 source but this would be slower as
put_no_rnd_pixels_tab is better optimzed */
- if(motion_halfpel_index != 3)
- {
+ if(motion_halfpel_index != 3){
s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](
output_plane + s->all_fragments[i].first_pixel,
motion_source, stride, 8);
- }
- else
- {
- int d = (motion_x ^ motion_y) >> 31; // d is 0 if motion_x and _y have the same sign, else -1
+ }else{
+ int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1
s->dsp.put_no_rnd_pixels_l2[1](
output_plane + s->all_fragments[i].first_pixel,
motion_source - d,
@@ -1672,55 +1510,43 @@ static void render_slice(Vp3DecodeContext *s, int slice)
stride, 8);
}
dequantizer = s->qmat[s->all_fragments[i].qpi][1][plane];
- }
- else
- {
+ }else{
dequantizer = s->qmat[s->all_fragments[i].qpi][0][plane];
}
/* dequantize the DCT coefficients */
- if(s->avctx->idct_algo == FF_IDCT_VP3)
- {
- Coeff *coeff = s->coeffs + i;
+ if(s->avctx->idct_algo==FF_IDCT_VP3){
+ Coeff *coeff= s->coeffs + i;
s->dsp.clear_block(block);
- while(coeff->next)
- {
- block[coeff->index] = coeff->coeff * dequantizer[coeff->index];
- coeff = coeff->next;
+ while(coeff->next){
+ block[coeff->index]= coeff->coeff * dequantizer[coeff->index];
+ coeff= coeff->next;
}
- }
- else
- {
- Coeff *coeff = s->coeffs + i;
+ }else{
+ Coeff *coeff= s->coeffs + i;
s->dsp.clear_block(block);
- while(coeff->next)
- {
- block[coeff->index] = (coeff->coeff * dequantizer[coeff->index] + 2) >> 2;
- coeff = coeff->next;
+ while(coeff->next){
+ block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2;
+ coeff= coeff->next;
}
}
/* invert DCT and place (or add) in final output */
- if(s->all_fragments[i].coding_method == MODE_INTRA)
- {
- if(s->avctx->idct_algo != FF_IDCT_VP3)
- block[0] += 128 << 3;
+ if (s->all_fragments[i].coding_method == MODE_INTRA) {
+ if(s->avctx->idct_algo!=FF_IDCT_VP3)
+ block[0] += 128<<3;
s->dsp.idct_put(
output_plane + s->all_fragments[i].first_pixel,
stride,
block);
- }
- else
- {
+ } else {
s->dsp.idct_add(
output_plane + s->all_fragments[i].first_pixel,
stride,
block);
}
- }
- else
- {
+ } else {
/* copy directly from the previous frame */
s->dsp.put_pixels_tab[1][0](
@@ -1733,13 +1559,13 @@ static void render_slice(Vp3DecodeContext *s, int slice)
}
}
- /* this looks like a good place for slice dispatch... */
- /* algorithm:
- * if (slice == s->macroblock_height - 1)
- * dispatch (both last slice & 2nd-to-last slice);
- * else if (slice > 0)
- * dispatch (slice - 1);
- */
+ /* this looks like a good place for slice dispatch... */
+ /* algorithm:
+ * if (slice == s->macroblock_height - 1)
+ * dispatch (both last slice & 2nd-to-last slice);
+ * else if (slice > 0)
+ * dispatch (slice - 1);
+ */
emms_c();
}
@@ -1748,39 +1574,34 @@ static void apply_loop_filter(Vp3DecodeContext *s)
{
int plane;
int x, y;
- int *bounding_values = s->bounding_values_array + 127;
+ int *bounding_values= s->bounding_values_array+127;
- for(plane = 0; plane < 3; plane++)
- {
+ for (plane = 0; plane < 3; plane++) {
int width = s->fragment_width >> !!plane;
int height = s->fragment_height >> !!plane;
int fragment = s->fragment_start [plane];
int stride = s->current_frame.linesize[plane];
uint8_t *plane_data = s->current_frame.data [plane];
- if(!s->flipped_image) stride = -stride;
+ if (!s->flipped_image) stride = -stride;
- for(y = 0; y < height; y++)
- {
+ for (y = 0; y < height; y++) {
- for(x = 0; x < width; x++)
- {
+ for (x = 0; x < width; x++) {
/* This code basically just deblocks on the edges of coded blocks.
* However, it has to be much more complicated because of the
* braindamaged deblock ordering used in VP3/Theora. Order matters
* because some pixels get filtered twice. */
- if(s->all_fragments[fragment].coding_method != MODE_COPY)
+ if( s->all_fragments[fragment].coding_method != MODE_COPY )
{
/* do not perform left edge filter for left columns frags */
- if(x > 0)
- {
+ if (x > 0) {
s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
}
/* do not perform top edge filter for top row fragments */
- if(y > 0)
- {
+ if (y > 0) {
s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment].first_pixel,
stride, bounding_values);
@@ -1789,9 +1610,8 @@ static void apply_loop_filter(Vp3DecodeContext *s)
/* do not perform right edge filter for right column
* fragments or if right fragment neighbor is also coded
* in this frame (it will be filtered in next iteration) */
- if((x < width - 1) &&
- (s->all_fragments[fragment + 1].coding_method == MODE_COPY))
- {
+ if ((x < width - 1) &&
+ (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
s->dsp.vp3_h_loop_filter(
plane_data + s->all_fragments[fragment + 1].first_pixel,
stride, bounding_values);
@@ -1800,9 +1620,8 @@ static void apply_loop_filter(Vp3DecodeContext *s)
/* do not perform bottom edge filter for bottom row
* fragments or if bottom fragment neighbor is also coded
* in this frame (it will be filtered in the next row) */
- if((y < height - 1) &&
- (s->all_fragments[fragment + width].coding_method == MODE_COPY))
- {
+ if ((y < height - 1) &&
+ (s->all_fragments[fragment + width].coding_method == MODE_COPY)) {
s->dsp.vp3_v_loop_filter(
plane_data + s->all_fragments[fragment + width].first_pixel,
stride, bounding_values);
@@ -1831,40 +1650,34 @@ static void vp3_calculate_pixel_addresses(Vp3DecodeContext *s)
/* figure out the first pixel addresses for each of the fragments */
/* Y plane */
i = 0;
- for(y = Y_INITIAL(0); Y_FINISHED(0); y += y_inc)
- {
- for(x = 0; x < s->fragment_width; x++)
- {
+ for (y = Y_INITIAL(0); Y_FINISHED(0); y += y_inc) {
+ for (x = 0; x < s->fragment_width; x++) {
s->all_fragments[i++].first_pixel =
s->golden_frame.linesize[0] * y * FRAGMENT_PIXELS -
- s->golden_frame.linesize[0] +
- x * FRAGMENT_PIXELS;
+ s->golden_frame.linesize[0] +
+ x * FRAGMENT_PIXELS;
}
}
/* U plane */
i = s->fragment_start[1];
- for(y = Y_INITIAL(1); Y_FINISHED(1); y += y_inc)
- {
- for(x = 0; x < s->fragment_width / 2; x++)
- {
+ for (y = Y_INITIAL(1); Y_FINISHED(1); y += y_inc) {
+ for (x = 0; x < s->fragment_width / 2; x++) {
s->all_fragments[i++].first_pixel =
s->golden_frame.linesize[1] * y * FRAGMENT_PIXELS -
- s->golden_frame.linesize[1] +
- x * FRAGMENT_PIXELS;
+ s->golden_frame.linesize[1] +
+ x * FRAGMENT_PIXELS;
}
}
/* V plane */
i = s->fragment_start[2];
- for(y = Y_INITIAL(1); Y_FINISHED(1); y += y_inc)
- {
- for(x = 0; x < s->fragment_width / 2; x++)
- {
+ for (y = Y_INITIAL(1); Y_FINISHED(1); y += y_inc) {
+ for (x = 0; x < s->fragment_width / 2; x++) {
s->all_fragments[i++].first_pixel =
s->golden_frame.linesize[2] * y * FRAGMENT_PIXELS -
- s->golden_frame.linesize[2] +
- x * FRAGMENT_PIXELS;
+ s->golden_frame.linesize[2] +
+ x * FRAGMENT_PIXELS;
}
}
}
@@ -1881,7 +1694,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
int y_superblock_count;
int c_superblock_count;
- if(avctx->codec_tag == MKTAG('V', 'P', '3', '0'))
+ if (avctx->codec_tag == MKTAG('V','P','3','0'))
s->version = 0;
else
s->version = 1;
@@ -1892,14 +1705,14 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_YUV420P;
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
//if(avctx->idct_algo==FF_IDCT_AUTO)
- avctx->idct_algo = FF_IDCT_VP3;
+ avctx->idct_algo=FF_IDCT_VP3;
dsputil_init(&s->dsp, avctx);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
/* initialize to an impossible value which will force a recalculation
* in the first frame decode */
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
s->qps[i] = -1;
s->y_superblock_width = (s->width + 31) / 32;
@@ -1936,17 +1749,15 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int));
s->fast_fragment_list = av_malloc(s->fragment_count * sizeof(int));
s->pixel_addresses_initialized = 0;
- if(!s->superblock_coding || !s->all_fragments || !s->coeff_counts ||
- !s->coeffs || !s->coded_fragment_list || !s->fast_fragment_list)
- {
+ if (!s->superblock_coding || !s->all_fragments || !s->coeff_counts ||
+ !s->coeffs || !s->coded_fragment_list || !s->fast_fragment_list) {
vp3_decode_end(avctx);
return -1;
}
- if(!s->theora_tables)
+ if (!s->theora_tables)
{
- for(i = 0; i < 64; i++)
- {
+ for (i = 0; i < 64; i++) {
s->coded_dc_scale_factor[i] = vp31_dc_scale_factor[i];
s->coded_ac_scale_factor[i] = vp31_ac_scale_factor[i];
s->base_matrix[0][i] = vp31_intra_y_dequant[i];
@@ -1955,115 +1766,107 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
s->filter_limit_values[i] = vp31_filter_limit_values[i];
}
- for(inter = 0; inter < 2; inter++)
- {
- for(plane = 0; plane < 3; plane++)
- {
- s->qr_count[inter][plane] = 1;
- s->qr_size [inter][plane][0] = 63;
- s->qr_base [inter][plane][0] =
- s->qr_base [inter][plane][1] = 2 * inter + (!!plane)*!inter;
+ for(inter=0; inter<2; inter++){
+ for(plane=0; plane<3; plane++){
+ s->qr_count[inter][plane]= 1;
+ s->qr_size [inter][plane][0]= 63;
+ s->qr_base [inter][plane][0]=
+ s->qr_base [inter][plane][1]= 2*inter + (!!plane)*!inter;
}
}
/* init VLC tables */
- for(i = 0; i < 16; i++)
- {
+ for (i = 0; i < 16; i++) {
/* DC histograms */
init_vlc(&s->dc_vlc[i], 5, 32,
- &dc_bias[i][0][1], 4, 2,
- &dc_bias[i][0][0], 4, 2, 0);
+ &dc_bias[i][0][1], 4, 2,
+ &dc_bias[i][0][0], 4, 2, 0);
/* group 1 AC histograms */
init_vlc(&s->ac_vlc_1[i], 5, 32,
- &ac_bias_0[i][0][1], 4, 2,
- &ac_bias_0[i][0][0], 4, 2, 0);
+ &ac_bias_0[i][0][1], 4, 2,
+ &ac_bias_0[i][0][0], 4, 2, 0);
/* group 2 AC histograms */
init_vlc(&s->ac_vlc_2[i], 5, 32,
- &ac_bias_1[i][0][1], 4, 2,
- &ac_bias_1[i][0][0], 4, 2, 0);
+ &ac_bias_1[i][0][1], 4, 2,
+ &ac_bias_1[i][0][0], 4, 2, 0);
/* group 3 AC histograms */
init_vlc(&s->ac_vlc_3[i], 5, 32,
- &ac_bias_2[i][0][1], 4, 2,
- &ac_bias_2[i][0][0], 4, 2, 0);
+ &ac_bias_2[i][0][1], 4, 2,
+ &ac_bias_2[i][0][0], 4, 2, 0);
/* group 4 AC histograms */
init_vlc(&s->ac_vlc_4[i], 5, 32,
- &ac_bias_3[i][0][1], 4, 2,
- &ac_bias_3[i][0][0], 4, 2, 0);
+ &ac_bias_3[i][0][1], 4, 2,
+ &ac_bias_3[i][0][0], 4, 2, 0);
}
- }
- else
- {
- for(i = 0; i < 16; i++)
- {
+ } else {
+ for (i = 0; i < 16; i++) {
/* DC histograms */
- if(init_vlc(&s->dc_vlc[i], 5, 32,
- &s->huffman_table[i][0][1], 4, 2,
- &s->huffman_table[i][0][0], 4, 2, 0) < 0)
+ if (init_vlc(&s->dc_vlc[i], 5, 32,
+ &s->huffman_table[i][0][1], 4, 2,
+ &s->huffman_table[i][0][0], 4, 2, 0) < 0)
goto vlc_fail;
/* group 1 AC histograms */
- if(init_vlc(&s->ac_vlc_1[i], 5, 32,
- &s->huffman_table[i+16][0][1], 4, 2,
- &s->huffman_table[i+16][0][0], 4, 2, 0) < 0)
+ if (init_vlc(&s->ac_vlc_1[i], 5, 32,
+ &s->huffman_table[i+16][0][1], 4, 2,
+ &s->huffman_table[i+16][0][0], 4, 2, 0) < 0)
goto vlc_fail;
/* group 2 AC histograms */
- if(init_vlc(&s->ac_vlc_2[i], 5, 32,
- &s->huffman_table[i+16*2][0][1], 4, 2,
- &s->huffman_table[i+16*2][0][0], 4, 2, 0) < 0)
+ if (init_vlc(&s->ac_vlc_2[i], 5, 32,
+ &s->huffman_table[i+16*2][0][1], 4, 2,
+ &s->huffman_table[i+16*2][0][0], 4, 2, 0) < 0)
goto vlc_fail;
/* group 3 AC histograms */
- if(init_vlc(&s->ac_vlc_3[i], 5, 32,
- &s->huffman_table[i+16*3][0][1], 4, 2,
- &s->huffman_table[i+16*3][0][0], 4, 2, 0) < 0)
+ if (init_vlc(&s->ac_vlc_3[i], 5, 32,
+ &s->huffman_table[i+16*3][0][1], 4, 2,
+ &s->huffman_table[i+16*3][0][0], 4, 2, 0) < 0)
goto vlc_fail;
/* group 4 AC histograms */
- if(init_vlc(&s->ac_vlc_4[i], 5, 32,
- &s->huffman_table[i+16*4][0][1], 4, 2,
- &s->huffman_table[i+16*4][0][0], 4, 2, 0) < 0)
+ if (init_vlc(&s->ac_vlc_4[i], 5, 32,
+ &s->huffman_table[i+16*4][0][1], 4, 2,
+ &s->huffman_table[i+16*4][0][0], 4, 2, 0) < 0)
goto vlc_fail;
}
}
init_vlc(&s->superblock_run_length_vlc, 6, 34,
- &superblock_run_length_vlc_table[0][1], 4, 2,
- &superblock_run_length_vlc_table[0][0], 4, 2, 0);
+ &superblock_run_length_vlc_table[0][1], 4, 2,
+ &superblock_run_length_vlc_table[0][0], 4, 2, 0);
init_vlc(&s->fragment_run_length_vlc, 5, 30,
- &fragment_run_length_vlc_table[0][1], 4, 2,
- &fragment_run_length_vlc_table[0][0], 4, 2, 0);
+ &fragment_run_length_vlc_table[0][1], 4, 2,
+ &fragment_run_length_vlc_table[0][0], 4, 2, 0);
init_vlc(&s->mode_code_vlc, 3, 8,
- &mode_code_vlc_table[0][1], 2, 1,
- &mode_code_vlc_table[0][0], 2, 1, 0);
+ &mode_code_vlc_table[0][1], 2, 1,
+ &mode_code_vlc_table[0][0], 2, 1, 0);
init_vlc(&s->motion_vector_vlc, 6, 63,
- &motion_vector_vlc_table[0][1], 2, 1,
- &motion_vector_vlc_table[0][0], 2, 1, 0);
+ &motion_vector_vlc_table[0][1], 2, 1,
+ &motion_vector_vlc_table[0][0], 2, 1, 0);
/* work out the block mapping tables */
s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int));
s->superblock_macroblocks = av_malloc(s->superblock_count * 4 * sizeof(int));
s->macroblock_fragments = av_malloc(s->macroblock_count * 6 * sizeof(int));
s->macroblock_coding = av_malloc(s->macroblock_count + 1);
- if(!s->superblock_fragments || !s->superblock_macroblocks ||
- !s->macroblock_fragments || !s->macroblock_coding)
- {
+ if (!s->superblock_fragments || !s->superblock_macroblocks ||
+ !s->macroblock_fragments || !s->macroblock_coding) {
vp3_decode_end(avctx);
return -1;
}
init_block_mapping(s);
- for(i = 0; i < 3; i++)
- {
+ for (i = 0; i < 3; i++) {
s->current_frame.data[i] = NULL;
s->last_frame.data[i] = NULL;
s->golden_frame.data[i] = NULL;
@@ -2077,16 +1880,13 @@ vlc_fail:
}
/* ffdshow custom code (begin) */
-static int64_t theora_granule_frame(Vp3DecodeContext *s, int64_t granulepos)
-{
- if(granulepos >= 0)
- {
- int64_t iframe = granulepos >> s->keyframe_granule_shift;
- int64_t pframe = granulepos - (iframe << s->keyframe_granule_shift);
- return iframe + pframe;
- }
- else
- {
+static int64_t theora_granule_frame(Vp3DecodeContext *s,int64_t granulepos)
+{
+ if(granulepos>=0){
+ int64_t iframe=granulepos>>s->keyframe_granule_shift;
+ int64_t pframe=granulepos-(iframe<<s->keyframe_granule_shift);
+ return iframe+pframe;
+ }else{
return -1;
}
}
@@ -2106,187 +1906,165 @@ static int vp3_decode_frame(AVCodecContext *avctx,
init_get_bits(&gb, buf, buf_size * 8);
- if(s->theora && get_bits1(&gb))
+ if (s->theora && get_bits1(&gb))
{
av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
return -1;
}
s->keyframe = !get_bits1(&gb);
- if(!s->theora)
+ if (!s->theora)
skip_bits(&gb, 1);
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
s->last_qps[i] = s->qps[i];
- s->nqps = 0;
- do
- {
- s->qps[s->nqps++] = get_bits(&gb, 6);
- }
- while(s->theora >= 0x030200 && s->nqps < 3 && get_bits1(&gb));
- for(i = s->nqps; i < 3; i++)
+ s->nqps=0;
+ do{
+ s->qps[s->nqps++]= get_bits(&gb, 6);
+ } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb));
+ for (i = s->nqps; i < 3; i++)
s->qps[i] = -1;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
- s->keyframe ? "key" : "", counter, s->qps[0]);
+ s->keyframe?"key":"", counter, s->qps[0]);
counter++;
- if(s->qps[0] != s->last_qps[0])
+ if (s->qps[0] != s->last_qps[0])
init_loop_filter(s);
- for(i = 0; i < s->nqps; i++)
+ for (i = 0; i < s->nqps; i++)
// reinit all dequantizers if the first one changed, because
// the DC of the first quantizer must be used for all matrices
- if(s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
+ if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
init_dequantizer(s, i);
- if(avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
+ if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
return buf_size;
- if(s->keyframe)
- {
- if(!s->theora)
+ if (s->keyframe) {
+ if (!s->theora)
{
skip_bits(&gb, 4); /* width code */
skip_bits(&gb, 4); /* height code */
- if(s->version)
+ if (s->version)
{
s->version = get_bits(&gb, 5);
- if(counter == 1)
+ if (counter == 1)
av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
}
}
- if(s->version || s->theora)
+ if (s->version || s->theora)
{
- if(get_bits1(&gb))
- av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
+ if (get_bits1(&gb))
+ av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2); /* reserved? */
}
- if(s->last_frame.data[0] == s->golden_frame.data[0])
- {
- if(s->golden_frame.data[0])
+ if (s->last_frame.data[0] == s->golden_frame.data[0]) {
+ if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
- s->last_frame = s->golden_frame; /* ensure that we catch any access to this released frame */
- }
- else
- {
- if(s->golden_frame.data[0])
+ s->last_frame= s->golden_frame; /* ensure that we catch any access to this released frame */
+ } else {
+ if (s->golden_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
- if(s->last_frame.data[0])
+ if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame);
}
s->golden_frame.reference = 3;
- if(avctx->get_buffer(avctx, &s->golden_frame) < 0)
- {
+ if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1;
}
/* golden frame is also the current frame */
- s->current_frame = s->golden_frame;
+ s->current_frame= s->golden_frame;
/* time to figure out pixel addresses? */
- if(!s->pixel_addresses_initialized)
+ if (!s->pixel_addresses_initialized)
{
vp3_calculate_pixel_addresses(s);
s->pixel_addresses_initialized = 1;
}
- }
- else
- {
+ } else {
/* allocate a new current frame */
s->current_frame.reference = 3;
- if(!s->pixel_addresses_initialized)
- {
+ if (!s->pixel_addresses_initialized) {
av_log(s->avctx, AV_LOG_ERROR, "vp3: first frame not a keyframe\n");
return -1;
}
- if(avctx->get_buffer(avctx, &s->current_frame) < 0)
- {
+ if(avctx->get_buffer(avctx, &s->current_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1;
}
}
- s->current_frame.qscale_table = s->qscale_table; //FIXME allocate individual tables per AVFrame
- s->current_frame.qstride = 0;
+ s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
+ s->current_frame.qstride= 0;
init_frame(s, &gb);
- if(unpack_superblocks(s, &gb))
- {
+ if (unpack_superblocks(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
return -1;
}
- if(unpack_modes(s, &gb))
- {
+ if (unpack_modes(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
return -1;
}
- if(unpack_vectors(s, &gb))
- {
+ if (unpack_vectors(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
return -1;
}
- if(unpack_block_qpis(s, &gb))
- {
+ if (unpack_block_qpis(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
return -1;
}
- if(unpack_dct_coeffs(s, &gb))
- {
+ if (unpack_dct_coeffs(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
return -1;
}
- for(i = 0; i < s->macroblock_height; i++)
+ for (i = 0; i < s->macroblock_height; i++)
render_slice(s, i);
apply_loop_filter(s);
/* ffdshow custom code (begin) */
- if(s->theora && s->fps_numerator)
- {
- if(avctx->granulepos > -1)
- {
- s->granulepos = avctx->granulepos;
- }
- else
- {
- if(s->granulepos == -1)
- s->granulepos = 0;
- else if(s->keyframe)
- {
- long frames = s->granulepos & ((1 << s->keyframe_granule_shift) - 1);
- s->granulepos >>= s->keyframe_granule_shift;
- s->granulepos += frames + 1;
- s->granulepos <<= s->keyframe_granule_shift;
- }
+ if (s->theora && s->fps_numerator){
+ if (avctx->granulepos>-1){
+ s->granulepos=avctx->granulepos;
+ }else{
+ if (s->granulepos==-1)
+ s->granulepos=0;
else
- {
- s->granulepos++;
- }
+ if (s->keyframe){
+ long frames= s->granulepos & ((1<<s->keyframe_granule_shift)-1);
+ s->granulepos>>=s->keyframe_granule_shift;
+ s->granulepos+=frames+1;
+ s->granulepos<<=s->keyframe_granule_shift;
+ }else{
+ s->granulepos++;
+ }
}
- s->current_frame.reordered_opaque = 10000000LL * theora_granule_frame(s, s->granulepos) * s->fps_denumerator / s->fps_numerator;
- s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
+ s->current_frame.reordered_opaque = 10000000LL * theora_granule_frame(s,s->granulepos) * s->fps_denumerator / s->fps_numerator;
+ s->current_frame.pict_type=s->keyframe?FF_I_TYPE:FF_P_TYPE;
}
/* ffdshow custom code (end) */
- *data_size = sizeof(AVFrame);
- *(AVFrame*)data = s->current_frame;
+ *data_size=sizeof(AVFrame);
+ *(AVFrame*)data= s->current_frame;
/* release the last frame, if it is allocated and if it is not the
* golden frame */
- if((s->last_frame.data[0]) &&
- (s->last_frame.data[0] != s->golden_frame.data[0]))
+ if ((s->last_frame.data[0]) &&
+ (s->last_frame.data[0] != s->golden_frame.data[0]))
avctx->release_buffer(avctx, &s->last_frame);
/* shuffle frames (last = current) */
- s->last_frame = s->current_frame;
- s->current_frame.data[0] = NULL; /* ensure that we catch any access to this released frame */
+ s->last_frame= s->current_frame;
+ s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */
return buf_size;
}
@@ -2310,8 +2088,7 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
av_free(s->macroblock_fragments);
av_free(s->macroblock_coding);
- for(i = 0; i < 16; i++)
- {
+ for (i = 0; i < 16; i++) {
free_vlc(&s->dc_vlc[i]);
free_vlc(&s->ac_vlc_1[i]);
free_vlc(&s->ac_vlc_2[i]);
@@ -2325,9 +2102,9 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
free_vlc(&s->motion_vector_vlc);
/* release all frames */
- if(s->golden_frame.data[0] && s->golden_frame.data[0] != s->last_frame.data[0])
+ if (s->golden_frame.data[0] && s->golden_frame.data[0] != s->last_frame.data[0])
avctx->release_buffer(avctx, &s->golden_frame);
- if(s->last_frame.data[0])
+ if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame);
/* no need to release the current_frame since it will always be pointing
* to the same frame as either the golden or last frame */
@@ -2339,11 +2116,9 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
{
Vp3DecodeContext *s = avctx->priv_data;
- if(get_bits1(gb))
- {
+ if (get_bits1(gb)) {
int token;
- if(s->entries >= 32) /* overflow */
- {
+ if (s->entries >= 32) { /* overflow */
av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
return -1;
}
@@ -2353,19 +2128,17 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
s->huffman_table[s->hti][token][1] = s->huff_code_size;
s->entries++;
}
- else
- {
- if(s->huff_code_size >= 32) /* overflow */
- {
+ else {
+ if (s->huff_code_size >= 32) {/* overflow */
av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
return -1;
}
s->huff_code_size++;
s->hbits <<= 1;
- if(read_huffman_tree(avctx, gb))
+ if (read_huffman_tree(avctx, gb))
return -1;
s->hbits |= 1;
- if(read_huffman_tree(avctx, gb))
+ if (read_huffman_tree(avctx, gb))
return -1;
s->hbits >>= 1;
s->huff_code_size--;
@@ -2384,7 +2157,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
/* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */
/* but previous versions have the image flipped relative to vp3 */
- if(s->theora < 0x030200)
+ if (s->theora < 0x030200)
{
s->flipped_image = 1;
av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n");
@@ -2393,14 +2166,13 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
visible_width = s->width = get_bits(gb, 16) << 4;
visible_height = s->height = get_bits(gb, 16) << 4;
- if(avcodec_check_dimensions(avctx, s->width, s->height))
- {
+ if(avcodec_check_dimensions(avctx, s->width, s->height)){
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height);
- s->width = s->height = 0;
+ s->width= s->height= 0;
return -1;
}
- if(s->theora >= 0x030400)
+ if (s->theora >= 0x030400)
{
skip_bits(gb, 32); /* total number of superblocks in a frame */
// fixme, the next field is 36bits long
@@ -2409,8 +2181,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
skip_bits(gb, 32); /* total number of macroblocks in a frame */
}
- if(s->theora >= 0x030200)
- {
+ if (s->theora >= 0x030200) {
visible_width = get_bits_long(gb, 24);
visible_height = get_bits_long(gb, 24);
@@ -2419,34 +2190,34 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
}
/* ffdshow custom code (begin) */
- s->fps_numerator = get_bits(gb, 32); /* fps numerator */
- s->fps_denumerator = get_bits(gb, 32); /* fps denumerator */
+ s->fps_numerator=get_bits(gb, 32); /* fps numerator */
+ s->fps_denumerator=get_bits(gb, 32); /* fps denumerator */
avctx->sample_aspect_ratio.num = get_bits(gb, 24); /* aspect numerator */
avctx->sample_aspect_ratio.den = get_bits(gb, 24); /* aspect denumerator */
/* ffdshow custom code (end) */
- if(s->theora < 0x030200)
- s->keyframe_frequency_force = 1 << get_bits(gb, 5); /* keyframe frequency force */ /* ffdshow custom code */
+ if (s->theora < 0x030200)
+ s->keyframe_frequency_force=1<<get_bits(gb, 5); /* keyframe frequency force */ /* ffdshow custom code */
skip_bits(gb, 8); /* colorspace */
- if(s->theora >= 0x030400)
+ if (s->theora >= 0x030400)
skip_bits(gb, 2); /* pixel format: 420,res,422,444 */
skip_bits(gb, 24); /* bitrate */
skip_bits(gb, 6); /* quality hint */
- if(s->theora >= 0x030200)
+ if (s->theora >= 0x030200)
{
- s->keyframe_frequency_force = 1 << get_bits(gb, 5); /* keyframe frequency force */ /* ffdshow custom code */
+ s->keyframe_frequency_force=1<<get_bits(gb, 5); /* keyframe frequency force */ /* ffdshow custom code */
- if(s->theora < 0x030400)
+ if (s->theora < 0x030400)
skip_bits(gb, 5); /* spare bits */
}
- s->keyframe_granule_shift = _ilog(s->keyframe_frequency_force - 1); // ffdshow custom code
+ s->keyframe_granule_shift=_ilog(s->keyframe_frequency_force-1); // ffdshow custom code
// align_get_bits(gb);
- if(visible_width <= s->width && visible_width > s->width - 16
- && visible_height <= s->height && visible_height > s->height - 16)
+ if ( visible_width <= s->width && visible_width > s->width-16
+ && visible_height <= s->height && visible_height > s->height-16)
avcodec_set_dimensions(avctx, visible_width, visible_height);
else
avcodec_set_dimensions(avctx, s->width, s->height);
@@ -2459,116 +2230,98 @@ static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
Vp3DecodeContext *s = avctx->priv_data;
int i, n, matrices, inter, plane;
- if(s->theora >= 0x030200)
- {
+ if (s->theora >= 0x030200) {
n = get_bits(gb, 3);
/* loop filter limit values table */
- for(i = 0; i < 64; i++)
- {
+ for (i = 0; i < 64; i++) {
s->filter_limit_values[i] = get_bits(gb, n);
- if(s->filter_limit_values[i] > 127)
- {
+ if (s->filter_limit_values[i] > 127) {
av_log(avctx, AV_LOG_ERROR, "filter limit value too large (%i > 127), clamping\n", s->filter_limit_values[i]);
s->filter_limit_values[i] = 127;
}
}
}
- if(s->theora >= 0x030200)
+ if (s->theora >= 0x030200)
n = get_bits(gb, 4) + 1;
else
n = 16;
/* quality threshold table */
- for(i = 0; i < 64; i++)
+ for (i = 0; i < 64; i++)
s->coded_ac_scale_factor[i] = get_bits(gb, n);
- if(s->theora >= 0x030200)
+ if (s->theora >= 0x030200)
n = get_bits(gb, 4) + 1;
else
n = 16;
/* dc scale factor table */
- for(i = 0; i < 64; i++)
+ for (i = 0; i < 64; i++)
s->coded_dc_scale_factor[i] = get_bits(gb, n);
- if(s->theora >= 0x030200)
+ if (s->theora >= 0x030200)
matrices = get_bits(gb, 9) + 1;
else
matrices = 3;
- if(matrices > 384)
- {
+ if(matrices > 384){
av_log(avctx, AV_LOG_ERROR, "invalid number of base matrixes\n");
return -1;
}
- for(n = 0; n < matrices; n++)
- {
- for(i = 0; i < 64; i++)
- s->base_matrix[n][i] = get_bits(gb, 8);
+ for(n=0; n<matrices; n++){
+ for (i = 0; i < 64; i++)
+ s->base_matrix[n][i]= get_bits(gb, 8);
}
- for(inter = 0; inter <= 1; inter++)
- {
- for(plane = 0; plane <= 2; plane++)
- {
- int newqr = 1;
- if(inter || plane > 0)
+ for (inter = 0; inter <= 1; inter++) {
+ for (plane = 0; plane <= 2; plane++) {
+ int newqr= 1;
+ if (inter || plane > 0)
newqr = get_bits1(gb);
- if(!newqr)
- {
+ if (!newqr) {
int qtj, plj;
- if(inter && get_bits1(gb))
- {
+ if(inter && get_bits1(gb)){
qtj = 0;
plj = plane;
+ }else{
+ qtj= (3*inter + plane - 1) / 3;
+ plj= (plane + 2) % 3;
}
- else
- {
- qtj = (3 * inter + plane - 1) / 3;
- plj = (plane + 2) % 3;
- }
- s->qr_count[inter][plane] = s->qr_count[qtj][plj];
+ s->qr_count[inter][plane]= s->qr_count[qtj][plj];
memcpy(s->qr_size[inter][plane], s->qr_size[qtj][plj], sizeof(s->qr_size[0][0]));
memcpy(s->qr_base[inter][plane], s->qr_base[qtj][plj], sizeof(s->qr_base[0][0]));
- }
- else
- {
- int qri = 0;
+ } else {
+ int qri= 0;
int qi = 0;
- for(;;)
- {
- i = get_bits(gb, av_log2(matrices - 1) + 1);
- if(i >= matrices)
- {
+ for(;;){
+ i= get_bits(gb, av_log2(matrices-1)+1);
+ if(i>= matrices){
av_log(avctx, AV_LOG_ERROR, "invalid base matrix index\n");
return -1;
}
- s->qr_base[inter][plane][qri] = i;
+ s->qr_base[inter][plane][qri]= i;
if(qi >= 63)
break;
- i = get_bits(gb, av_log2(63 - qi) + 1) + 1;
- s->qr_size[inter][plane][qri++] = i;
+ i = get_bits(gb, av_log2(63-qi)+1) + 1;
+ s->qr_size[inter][plane][qri++]= i;
qi += i;
}
- if(qi > 63)
- {
+ if (qi > 63) {
av_log(avctx, AV_LOG_ERROR, "invalid qi %d > 63\n", qi);
return -1;
}
- s->qr_count[inter][plane] = qri;
+ s->qr_count[inter][plane]= qri;
}
}
}
/* Huffman tables */
- for(s->hti = 0; s->hti < 80; s->hti++)
- {
+ for (s->hti = 0; s->hti < 80; s->hti++) {
s->entries = 0;
s->huff_code_size = 1;
- if(!get_bits1(gb))
- {
+ if (!get_bits1(gb)) {
s->hbits = 0;
if(read_huffman_tree(avctx, gb))
return -1;
@@ -2594,63 +2347,60 @@ static av_cold int theora_decode_init(AVCodecContext *avctx)
s->theora = 1;
- if(!avctx->extradata_size)
+ if (!avctx->extradata_size)
{
av_log(avctx, AV_LOG_ERROR, "Missing extradata!\n");
return -1;
}
- if(ff_split_xiph_headers(avctx->extradata, avctx->extradata_size,
- 42, header_start, header_len) < 0)
- {
+ if (ff_split_xiph_headers(avctx->extradata, avctx->extradata_size,
+ 42, header_start, header_len) < 0) {
av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");
return -1;
}
- for(i = 0; i < 3; i++)
- {
- init_get_bits(&gb, header_start[i], header_len[i] * 8);
+ for(i=0;i<3;i++) {
+ init_get_bits(&gb, header_start[i], header_len[i] * 8);
- ptype = get_bits(&gb, 8);
+ ptype = get_bits(&gb, 8);
- if(!(ptype & 0x80))
- {
- av_log(avctx, AV_LOG_ERROR, "Invalid extradata!\n");
+ if (!(ptype & 0x80))
+ {
+ av_log(avctx, AV_LOG_ERROR, "Invalid extradata!\n");
// return -1;
- }
+ }
- // FIXME: Check for this as well.
- skip_bits_long(&gb, 6 * 8); /* "theora" */
+ // FIXME: Check for this as well.
+ skip_bits_long(&gb, 6*8); /* "theora" */
- switch(ptype)
- {
+ switch(ptype)
+ {
case 0x80:
theora_decode_header(avctx, &gb);
- break;
+ break;
case 0x81:
// FIXME: is this needed? it breaks sometimes
// theora_decode_comments(avctx, gb);
break;
case 0x82:
- if(theora_decode_tables(avctx, &gb))
+ if (theora_decode_tables(avctx, &gb))
return -1;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype&~0x80);
break;
- }
- if(ptype != 0x81 && 8 * header_len[i] != get_bits_count(&gb))
- av_log(avctx, AV_LOG_WARNING, "%d bits left in packet %X\n", 8 * header_len[i] - get_bits_count(&gb), ptype);
- if(s->theora < 0x030200)
- break;
}
+ if(ptype != 0x81 && 8*header_len[i] != get_bits_count(&gb))
+ av_log(avctx, AV_LOG_WARNING, "%d bits left in packet %X\n", 8*header_len[i] - get_bits_count(&gb), ptype);
+ if (s->theora < 0x030200)
+ break;
+ }
- s->granulepos = -1; /* ffdshow custom code */
+ s->granulepos=-1; /* ffdshow custom code */
return vp3_decode_init(avctx);
}
-AVCodec theora_decoder =
-{
+AVCodec theora_decoder = {
"theora",
CODEC_TYPE_VIDEO,
CODEC_ID_THEORA,
@@ -2668,8 +2418,7 @@ AVCodec theora_decoder =
};
#endif
-AVCodec vp3_decoder =
-{
+AVCodec vp3_decoder = {
"vp3",
CODEC_TYPE_VIDEO,
CODEC_ID_VP3,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3data.h
index 636366fb9..c5d148e45 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3data.h
@@ -27,35 +27,32 @@
/* these coefficients dequantize intraframe Y plane coefficients
* (note: same as JPEG) */
static const int16_t vp31_intra_y_dequant[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, 58, 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
+{ 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, 58, 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
};
/* these coefficients dequantize intraframe C plane coefficients
* (note: same as JPEG) */
static const int16_t vp31_intra_c_dequant[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
+{ 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
};
/* these coefficients dequantize interframe coefficients (all planes) */
static const int16_t vp31_inter_dequant[64] =
-{
- 16, 16, 16, 20, 24, 28, 32, 40,
+{ 16, 16, 16, 20, 24, 28, 32, 40,
16, 16, 20, 24, 28, 32, 40, 48,
16, 20, 24, 28, 32, 40, 48, 64,
20, 24, 28, 32, 40, 48, 64, 64,
@@ -66,33 +63,30 @@ static const int16_t vp31_inter_dequant[64] =
};
static const int16_t vp31_dc_scale_factor[64] =
-{
- 220, 200, 190, 180, 170, 170, 160, 160,
- 150, 150, 140, 140, 130, 130, 120, 120,
- 110, 110, 100, 100, 90, 90, 90, 80,
- 80, 80, 70, 70, 70, 60, 60, 60,
- 60, 50, 50, 50, 50, 40, 40, 40,
- 40, 40, 30, 30, 30, 30, 30, 30,
- 30, 20, 20, 20, 20, 20, 20, 20,
- 20, 10, 10, 10, 10, 10, 10, 10
+{ 220, 200, 190, 180, 170, 170, 160, 160,
+ 150, 150, 140, 140, 130, 130, 120, 120,
+ 110, 110, 100, 100, 90, 90, 90, 80,
+ 80, 80, 70, 70, 70, 60, 60, 60,
+ 60, 50, 50, 50, 50, 40, 40, 40,
+ 40, 40, 30, 30, 30, 30, 30, 30,
+ 30, 20, 20, 20, 20, 20, 20, 20,
+ 20, 10, 10, 10, 10, 10, 10, 10
};
static const uint32_t vp31_ac_scale_factor[64] =
-{
- 500, 450, 400, 370, 340, 310, 285, 265,
- 245, 225, 210, 195, 185, 180, 170, 160,
- 150, 145, 135, 130, 125, 115, 110, 107,
- 100, 96, 93, 89, 85, 82, 75, 74,
- 70, 68, 64, 60, 57, 56, 52, 50,
- 49, 45, 44, 43, 40, 38, 37, 35,
- 33, 32, 30, 29, 28, 25, 24, 22,
- 21, 19, 18, 17, 15, 13, 12, 10
+{ 500, 450, 400, 370, 340, 310, 285, 265,
+ 245, 225, 210, 195, 185, 180, 170, 160,
+ 150, 145, 135, 130, 125, 115, 110, 107,
+ 100, 96, 93, 89, 85, 82, 75, 74,
+ 70, 68, 64, 60, 57, 56, 52, 50,
+ 49, 45, 44, 43, 40, 38, 37, 35,
+ 33, 32, 30, 29, 28, 25, 24, 22,
+ 21, 19, 18, 17, 15, 13, 12, 10
};
static const uint8_t vp31_filter_limit_values[64] =
-{
- 30, 25, 20, 20, 15, 15, 14, 14,
- 13, 13, 12, 12, 11, 11, 10, 10,
+{ 30, 25, 20, 20, 15, 15, 14, 14,
+ 13, 13, 12, 12, 11, 11, 10, 10,
9, 9, 8, 8, 7, 7, 7, 7,
6, 6, 6, 6, 5, 5, 5, 5,
4, 4, 4, 4, 3, 3, 3, 3,
@@ -101,8 +95,7 @@ static const uint8_t vp31_filter_limit_values[64] =
0, 0, 0, 0, 0, 0, 0, 0
};
-static const uint16_t superblock_run_length_vlc_table[34][2] =
-{
+static const uint16_t superblock_run_length_vlc_table[34][2] = {
{ 0, 1 },
{ 4, 3 }, { 5, 3 },
@@ -123,8 +116,7 @@ static const uint16_t superblock_run_length_vlc_table[34][2] =
bits from stream and adding the value 34 */
};
-static const uint16_t fragment_run_length_vlc_table[30][2] =
-{
+static const uint16_t fragment_run_length_vlc_table[30][2] = {
/* 1 -> 2 */
{ 0x0, 2 }, { 0x1, 2 },
@@ -149,16 +141,14 @@ static const uint16_t fragment_run_length_vlc_table[30][2] =
{ 0x1FC, 9 }, { 0x1FD, 9 }, { 0x1FE, 9 }, { 0x1FF, 9 }
};
-static const uint8_t mode_code_vlc_table[8][2] =
-{
+static const uint8_t mode_code_vlc_table[8][2] = {
{ 0, 1 }, { 2, 2 },
{ 6, 3 }, { 14, 4 },
{ 30, 5 }, { 62, 6 },
{ 126, 7 }, { 127, 7 }
};
-static const uint8_t motion_vector_vlc_table[63][2] =
-{
+static const uint8_t motion_vector_vlc_table[63][2] = {
{ 0, 3 },
{ 1, 3 },
{ 2, 3 },
@@ -186,8 +176,7 @@ static const uint8_t motion_vector_vlc_table[63][2] =
{ 0xFC, 8 }, { 0xFD, 8 }, { 0xFE, 8 }, { 0xFF, 8 }
};
-static const int motion_vector_table[63] =
-{
+static const int motion_vector_table[63] = {
0, 1, -1,
2, -2,
3, -3,
@@ -197,38 +186,33 @@ static const int motion_vector_table[63] =
24, -24, 25, -25, 26, -26, 27, -27, 28, -28, 29, -29, 30, -30, 31, -31
};
-static const int8_t fixed_motion_vector_table[64] =
-{
- 0, 0, 1, -1, 2, -2, 3, -3,
- 4, -4, 5, -5, 6, -6, 7, -7,
- 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, -22, 23, -23,
- 24, -24, 25, -25, 26, -26, 27, -27,
- 28, -28, 29, -29, 30, -30, 31, -31
+static const int8_t fixed_motion_vector_table[64] = {
+ 0, 0, 1, -1, 2, -2, 3, -3,
+ 4, -4, 5, -5, 6, -6, 7, -7,
+ 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, -22, 23, -23,
+ 24, -24, 25, -25, 26, -26, 27, -27,
+ 28, -28, 29, -29, 30, -30, 31, -31
};
/* only tokens 0..6 indicate eob runs */
-static const int eob_run_base[7] =
-{
+static const int eob_run_base[7] = {
1, 2, 3, 4, 8, 16, 0
};
-static const int eob_run_get_bits[7] =
-{
+static const int eob_run_get_bits[7] = {
0, 0, 0, 2, 3, 4, 12
};
-static const int zero_run_base[32] =
-{
+static const int zero_run_base[32] = {
0, 0, 0, 0, 0, 0, 0, /* 0..6 are never used */
0, 0, /* 7..8 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9..22 */
1, 2, 3, 4, 5, /* 23..27 */
6, 10, 1, 2 /* 28..31 */
};
-static const int zero_run_get_bits[32] =
-{
+static const int zero_run_get_bits[32] = {
0, 0, 0, 0, 0, 0, 0, /* 0..6 are never used */
3, 6, /* 7..8 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 9..22 */
@@ -236,8 +220,7 @@ static const int zero_run_get_bits[32] =
2, 3, 0, 1 /* 28..31 */
};
-static const int coeff_get_bits[32] =
-{
+static const int coeff_get_bits[32] = {
0, 0, 0, 0, 0, 0, 0, /* 0..6 are never used */
0, 0, 0, 0, 0, 0, /* 7..12 use constant coeffs */
1, 1, 1, 1, /* 13..16 are constants but still need sign bit */
@@ -261,31 +244,26 @@ static const int16_t coeff_table_token_23_24_25_26_27_28_29[2] = { 1, -1 };
static const int16_t coeff_table_token_30[4] = { 2, 3, -2, -3 };
static const int16_t coeff_table_token_31[4] = { 2, 3, -2, -3 };
-static const int16_t coeff_table_token_17[4] =
-{
+static const int16_t coeff_table_token_17[4] = {
7, 8, -7, -8
};
-static const int16_t coeff_table_token_18[8] =
-{
+static const int16_t coeff_table_token_18[8] = {
9, 10, 11, 12, -9, -10, -11, -12
};
-static const int16_t coeff_table_token_19[16] =
-{
+static const int16_t coeff_table_token_19[16] = {
13, 14, 15, 16, 17, 18, 19, 20, -13, -14, -15, -16, -17, -18, -19, -20
};
-static const int16_t coeff_table_token_20[32] =
-{
+static const int16_t coeff_table_token_20[32] = {
21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36,
-21, -22, -23, -24, -25, -26, -27, -28,
-29, -30, -31, -32, -33, -34, -35, -36
};
-static const int16_t coeff_table_token_21[64] =
-{
+static const int16_t coeff_table_token_21[64] = {
37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60,
@@ -296,8 +274,7 @@ static const int16_t coeff_table_token_21[64] =
-61, -62, -63, -64, -65, -66, -67, -68
};
-static const int16_t coeff_table_token_22[1024] =
-{
+static const int16_t coeff_table_token_22[1024] = {
69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92,
@@ -428,8 +405,7 @@ static const int16_t coeff_table_token_22[1024] =
-573, -574, -575, -576, -577, -578, -579, -580
};
-static const int16_t *const coeff_tables[32] =
-{
+static const int16_t *const coeff_tables[32] = {
NULL,
NULL,
NULL,
@@ -467,2744 +443,2739 @@ static const int16_t *const coeff_tables[32] =
coeff_table_token_31
};
-static const uint16_t dc_bias[16][32][2] =
-{
- { /* DC bias table 0 */
- { 0x2D, 6 },
- { 0x26, 7 },
- { 0x166, 9 },
- { 0x4E, 8 },
- { 0x2CE, 10 },
- { 0x59E, 11 },
- { 0x27D, 11 },
- { 0x8, 5 },
- { 0x4F9, 12 },
- { 0xF, 4 },
- { 0xE, 4 },
- { 0x1B, 5 },
- { 0x6, 4 },
- { 0x8, 4 },
- { 0x5, 4 },
- { 0x1A, 5 },
- { 0x15, 5 },
- { 0x7, 4 },
- { 0xC, 4 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0x9, 4 },
- { 0x17, 5 },
- { 0x29, 6 },
- { 0x28, 6 },
- { 0xB2, 8 },
- { 0x4F8, 12 },
- { 0x59F, 11 },
- { 0x9E, 9 },
- { 0x13F, 10 },
- { 0x12, 6 },
- { 0x58, 7 }
- },
- { /* DC bias table 1 */
- { 0x10, 5 },
- { 0x47, 7 },
- { 0x1FF, 9 },
- { 0x8C, 8 },
- { 0x3FC, 10 },
- { 0x46A, 11 },
- { 0x469, 11 },
- { 0x22, 6 },
- { 0x11A1, 13 },
- { 0xE, 4 },
- { 0xD, 4 },
- { 0x4, 4 },
- { 0x5, 4 },
- { 0x9, 4 },
- { 0x6, 4 },
- { 0x1E, 5 },
- { 0x16, 5 },
- { 0x7, 4 },
- { 0xC, 4 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xA, 4 },
- { 0x17, 5 },
- { 0x7D, 7 },
- { 0x7E, 7 },
- { 0x11B, 9 },
- { 0x8D1, 12 },
- { 0x3FD, 10 },
- { 0x46B, 11 },
- { 0x11A0, 13 },
- { 0x7C, 7 },
- { 0xFE, 8 }
- },
- { /* DC bias table 2 */
- { 0x16, 5 },
- { 0x20, 6 },
- { 0x86, 8 },
- { 0x87, 8 },
- { 0x367, 10 },
- { 0x6CC, 11 },
- { 0x6CB, 11 },
- { 0x6E, 7 },
- { 0x366D, 14 },
- { 0xF, 4 },
- { 0xE, 4 },
- { 0x4, 4 },
- { 0x5, 4 },
- { 0xA, 4 },
- { 0x6, 4 },
- { 0x1A, 5 },
- { 0x11, 5 },
- { 0x7, 4 },
- { 0xC, 4 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0x9, 4 },
- { 0x17, 5 },
- { 0x6F, 7 },
- { 0x6D, 7 },
- { 0x364, 10 },
- { 0xD9A, 12 },
- { 0x6CA, 11 },
- { 0x1B37, 13 },
- { 0x366C, 14 },
- { 0x42, 7 },
- { 0xD8, 8 }
- },
- { /* DC bias table 3 */
- { 0x0, 4 },
- { 0x2D, 6 },
- { 0xF7, 8 },
- { 0x58, 7 },
- { 0x167, 9 },
- { 0x2CB, 10 },
- { 0x2CA, 10 },
- { 0xE, 6 },
- { 0x1661, 13 },
- { 0x3, 3 },
- { 0x2, 3 },
- { 0x8, 4 },
- { 0x9, 4 },
- { 0xD, 4 },
- { 0x2, 4 },
- { 0x1F, 5 },
- { 0x17, 5 },
- { 0x1, 4 },
- { 0xC, 4 },
- { 0xE, 4 },
- { 0xA, 4 },
- { 0x6, 5 },
- { 0x78, 7 },
- { 0xF, 6 },
- { 0x7A, 7 },
- { 0x164, 9 },
- { 0x599, 11 },
- { 0x2CD, 10 },
- { 0xB31, 12 },
- { 0x1660, 13 },
- { 0x79, 7 },
- { 0xF6, 8 }
- },
- { /* DC bias table 4 */
- { 0x3, 4 },
- { 0x3C, 6 },
- { 0xF, 7 },
- { 0x7A, 7 },
- { 0x1D, 8 },
- { 0x20, 9 },
- { 0x72, 10 },
- { 0x6, 6 },
- { 0x399, 13 },
- { 0x4, 3 },
- { 0x5, 3 },
- { 0x5, 4 },
- { 0x6, 4 },
- { 0xE, 4 },
- { 0x4, 4 },
- { 0x0, 4 },
- { 0x19, 5 },
- { 0x2, 4 },
- { 0xD, 4 },
- { 0x7, 4 },
- { 0x1F, 5 },
- { 0x30, 6 },
- { 0x11, 8 },
- { 0x31, 6 },
- { 0x5, 6 },
- { 0x21, 9 },
- { 0xE7, 11 },
- { 0x38, 9 },
- { 0x1CD, 12 },
- { 0x398, 13 },
- { 0x7B, 7 },
- { 0x9, 7 }
- },
- { /* DC bias table 5 */
- { 0x9, 4 },
- { 0x2, 5 },
- { 0x74, 7 },
- { 0x7, 6 },
- { 0xEC, 8 },
- { 0xD1, 9 },
- { 0x1A6, 10 },
- { 0x6, 6 },
- { 0xD21, 13 },
- { 0x5, 3 },
- { 0x6, 3 },
- { 0x8, 4 },
- { 0x7, 4 },
- { 0xF, 4 },
- { 0x4, 4 },
- { 0x0, 4 },
- { 0x1C, 5 },
- { 0x2, 4 },
- { 0x5, 4 },
- { 0x3, 4 },
- { 0xC, 5 },
- { 0x35, 7 },
- { 0x1A7, 10 },
- { 0x1B, 6 },
- { 0x77, 7 },
- { 0x1A5, 10 },
- { 0x349, 11 },
- { 0xD0, 9 },
- { 0x691, 12 },
- { 0xD20, 13 },
- { 0x75, 7 },
- { 0xED, 8 }
- },
- { /* DC bias table 6 */
- { 0xA, 4 },
- { 0xC, 5 },
- { 0x12, 6 },
- { 0x1B, 6 },
- { 0xB7, 8 },
- { 0x16C, 9 },
- { 0x99, 9 },
- { 0x5A, 7 },
- { 0x16D8, 13 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x0, 3 },
- { 0x5, 4 },
- { 0x17, 5 },
- { 0xE, 5 },
- { 0x2, 4 },
- { 0x3, 4 },
- { 0xF, 5 },
- { 0x1A, 6 },
- { 0x4D, 8 },
- { 0x2DB3, 14 },
- { 0x2C, 6 },
- { 0x11, 6 },
- { 0x2DA, 10 },
- { 0x5B7, 11 },
- { 0x98, 9 },
- { 0xB6D, 12 },
- { 0x2DB2, 14 },
- { 0x10, 6 },
- { 0x27, 7 }
- },
- { /* DC bias table 7 */
- { 0xD, 4 },
- { 0xF, 5 },
- { 0x1D, 6 },
- { 0x8, 5 },
- { 0x51, 7 },
- { 0x56, 8 },
- { 0xAF, 9 },
- { 0x2A, 7 },
- { 0x148A, 13 },
- { 0x7, 3 },
- { 0x0, 2 },
- { 0x8, 4 },
- { 0x9, 4 },
- { 0xC, 4 },
- { 0x6, 4 },
- { 0x17, 5 },
- { 0xB, 5 },
- { 0x16, 5 },
- { 0x15, 5 },
- { 0x9, 5 },
- { 0x50, 7 },
- { 0xAE, 9 },
- { 0x2917, 14 },
- { 0x1C, 6 },
- { 0x14, 6 },
- { 0x290, 10 },
- { 0x523, 11 },
- { 0x149, 9 },
- { 0xA44, 12 },
- { 0x2916, 14 },
- { 0x53, 7 },
- { 0xA5, 8 }
- },
- { /* DC bias table 8 */
- { 0x1, 4 },
- { 0x1D, 6 },
- { 0xF5, 8 },
- { 0xF4, 8 },
- { 0x24D, 10 },
- { 0x499, 11 },
- { 0x498, 11 },
- { 0x1, 5 },
- { 0x21, 6 },
- { 0x6, 3 },
- { 0x5, 3 },
- { 0x6, 4 },
- { 0x5, 4 },
- { 0x2, 4 },
- { 0x7, 5 },
- { 0x25, 6 },
- { 0x7B, 7 },
- { 0x1C, 6 },
- { 0x20, 6 },
- { 0xD, 6 },
- { 0x48, 7 },
- { 0x92, 8 },
- { 0x127, 9 },
- { 0xE, 4 },
- { 0x4, 4 },
- { 0x11, 5 },
- { 0xC, 6 },
- { 0x3C, 6 },
- { 0xF, 5 },
- { 0x0, 5 },
- { 0x1F, 5 },
- { 0x13, 5 }
- },
- { /* DC bias table 9 */
- { 0x5, 4 },
- { 0x3C, 6 },
- { 0x40, 7 },
- { 0xD, 7 },
- { 0x31, 9 },
- { 0x61, 10 },
- { 0x60, 10 },
- { 0x2, 5 },
- { 0xF5, 8 },
- { 0x6, 3 },
- { 0x5, 3 },
- { 0x7, 4 },
- { 0x6, 4 },
- { 0x2, 4 },
- { 0x9, 5 },
- { 0x25, 6 },
- { 0x7, 6 },
- { 0x21, 6 },
- { 0x24, 6 },
- { 0x10, 6 },
- { 0x41, 7 },
- { 0xF4, 8 },
- { 0x19, 8 },
- { 0xE, 4 },
- { 0x3, 4 },
- { 0x11, 5 },
- { 0x11, 6 },
- { 0x3F, 6 },
- { 0x3E, 6 },
- { 0x7B, 7 },
- { 0x0, 4 },
- { 0x13, 5 }
- },
- { /* DC bias table 10 */
- { 0xA, 4 },
- { 0x7, 5 },
- { 0x1, 6 },
- { 0x9, 6 },
- { 0x131, 9 },
- { 0x261, 10 },
- { 0x260, 10 },
- { 0x15, 6 },
- { 0x1, 7 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0x8, 4 },
- { 0x7, 4 },
- { 0x6, 4 },
- { 0x12, 5 },
- { 0x2F, 6 },
- { 0x14, 6 },
- { 0x27, 6 },
- { 0x2D, 6 },
- { 0x16, 6 },
- { 0x4D, 7 },
- { 0x99, 8 },
- { 0x0, 7 },
- { 0x4, 4 },
- { 0x1, 4 },
- { 0x5, 5 },
- { 0x17, 6 },
- { 0x2E, 6 },
- { 0x2C, 6 },
- { 0x8, 6 },
- { 0x6, 5 },
- { 0x1, 5 }
- },
- { /* DC bias table 11 */
- { 0x0, 3 },
- { 0xE, 5 },
- { 0x17, 6 },
- { 0x2A, 6 },
- { 0x10, 7 },
- { 0xF9, 10 },
- { 0xF8, 10 },
- { 0x1E, 7 },
- { 0x3F, 8 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x6, 4 },
- { 0xF, 5 },
- { 0x5, 5 },
- { 0x16, 6 },
- { 0x29, 6 },
- { 0x2B, 6 },
- { 0x15, 6 },
- { 0x50, 7 },
- { 0x11, 7 },
- { 0x7D, 9 },
- { 0x4, 4 },
- { 0x17, 5 },
- { 0x6, 5 },
- { 0x14, 6 },
- { 0x2C, 6 },
- { 0x2D, 6 },
- { 0xE, 6 },
- { 0x9, 6 },
- { 0x51, 7 }
- },
- { /* DC bias table 12 */
- { 0x2, 3 },
- { 0x18, 5 },
- { 0x2F, 6 },
- { 0xD, 5 },
- { 0x53, 7 },
- { 0x295, 10 },
- { 0x294, 10 },
- { 0xA4, 8 },
- { 0x7C, 8 },
- { 0x0, 2 },
- { 0x7, 3 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x1B, 5 },
- { 0xC, 5 },
- { 0x28, 6 },
- { 0x6A, 7 },
- { 0x1E, 6 },
- { 0x1D, 6 },
- { 0x69, 7 },
- { 0xD7, 8 },
- { 0x7D, 8 },
- { 0x14B, 9 },
- { 0x19, 5 },
- { 0x16, 5 },
- { 0x2E, 6 },
- { 0x1C, 6 },
- { 0x2B, 6 },
- { 0x2A, 6 },
- { 0x68, 7 },
- { 0x3F, 7 },
- { 0xD6, 8 }
- },
- { /* DC bias table 13 */
- { 0x2, 3 },
- { 0x1B, 5 },
- { 0xC, 5 },
- { 0x18, 5 },
- { 0x29, 6 },
- { 0x7F, 8 },
- { 0x2F0, 10 },
- { 0x198, 9 },
- { 0x179, 9 },
- { 0x0, 2 },
- { 0x7, 3 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x1A, 5 },
- { 0xD, 5 },
- { 0x2A, 6 },
- { 0x64, 7 },
- { 0x1E, 6 },
- { 0x67, 7 },
- { 0x5F, 7 },
- { 0xCD, 8 },
- { 0x7E, 8 },
- { 0x2F1, 10 },
- { 0x16, 5 },
- { 0xE, 5 },
- { 0x2E, 6 },
- { 0x65, 7 },
- { 0x2B, 6 },
- { 0x28, 6 },
- { 0x3E, 7 },
- { 0xBD, 8 },
- { 0x199, 9 }
- },
- { /* DC bias table 14 */
- { 0x2, 3 },
- { 0x7, 4 },
- { 0x16, 5 },
- { 0x6, 4 },
- { 0x36, 6 },
- { 0x5C, 7 },
- { 0x15D, 9 },
- { 0x15C, 9 },
- { 0x2BF, 10 },
- { 0x0, 2 },
- { 0x7, 3 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x18, 5 },
- { 0x34, 6 },
- { 0x2A, 6 },
- { 0x5E, 7 },
- { 0x6A, 7 },
- { 0x64, 7 },
- { 0x5D, 7 },
- { 0xCB, 8 },
- { 0xAD, 8 },
- { 0x2BE, 10 },
- { 0x14, 5 },
- { 0x33, 6 },
- { 0x6E, 7 },
- { 0x5F, 7 },
- { 0x6F, 7 },
- { 0x6B, 7 },
- { 0xCA, 8 },
- { 0xAC, 8 },
- { 0x15E, 9 }
- },
- { /* DC bias table 15 */
- { 0xF, 4 },
- { 0x1D, 5 },
- { 0x18, 5 },
- { 0xB, 4 },
- { 0x19, 5 },
- { 0x29, 6 },
- { 0xD6, 8 },
- { 0x551, 11 },
- { 0xAA1, 12 },
- { 0x1, 2 },
- { 0x0, 2 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x1B, 5 },
- { 0x38, 6 },
- { 0x28, 6 },
- { 0x57, 7 },
- { 0x6A, 7 },
- { 0x68, 7 },
- { 0x56, 7 },
- { 0xE5, 8 },
- { 0x155, 9 },
- { 0xAA0, 12 },
- { 0x73, 7 },
- { 0x69, 7 },
- { 0xD7, 8 },
- { 0xAB, 8 },
- { 0xE4, 8 },
- { 0xA9, 8 },
- { 0x151, 9 },
- { 0x150, 9 },
- { 0x2A9, 10 }
- }
+static const uint16_t dc_bias[16][32][2] = {
+ { /* DC bias table 0 */
+ { 0x2D, 6 },
+ { 0x26, 7 },
+ { 0x166, 9 },
+ { 0x4E, 8 },
+ { 0x2CE, 10 },
+ { 0x59E, 11 },
+ { 0x27D, 11 },
+ { 0x8, 5 },
+ { 0x4F9, 12 },
+ { 0xF, 4 },
+ { 0xE, 4 },
+ { 0x1B, 5 },
+ { 0x6, 4 },
+ { 0x8, 4 },
+ { 0x5, 4 },
+ { 0x1A, 5 },
+ { 0x15, 5 },
+ { 0x7, 4 },
+ { 0xC, 4 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0x9, 4 },
+ { 0x17, 5 },
+ { 0x29, 6 },
+ { 0x28, 6 },
+ { 0xB2, 8 },
+ { 0x4F8, 12 },
+ { 0x59F, 11 },
+ { 0x9E, 9 },
+ { 0x13F, 10 },
+ { 0x12, 6 },
+ { 0x58, 7 }
+ },
+ { /* DC bias table 1 */
+ { 0x10, 5 },
+ { 0x47, 7 },
+ { 0x1FF, 9 },
+ { 0x8C, 8 },
+ { 0x3FC, 10 },
+ { 0x46A, 11 },
+ { 0x469, 11 },
+ { 0x22, 6 },
+ { 0x11A1, 13 },
+ { 0xE, 4 },
+ { 0xD, 4 },
+ { 0x4, 4 },
+ { 0x5, 4 },
+ { 0x9, 4 },
+ { 0x6, 4 },
+ { 0x1E, 5 },
+ { 0x16, 5 },
+ { 0x7, 4 },
+ { 0xC, 4 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xA, 4 },
+ { 0x17, 5 },
+ { 0x7D, 7 },
+ { 0x7E, 7 },
+ { 0x11B, 9 },
+ { 0x8D1, 12 },
+ { 0x3FD, 10 },
+ { 0x46B, 11 },
+ { 0x11A0, 13 },
+ { 0x7C, 7 },
+ { 0xFE, 8 }
+ },
+ { /* DC bias table 2 */
+ { 0x16, 5 },
+ { 0x20, 6 },
+ { 0x86, 8 },
+ { 0x87, 8 },
+ { 0x367, 10 },
+ { 0x6CC, 11 },
+ { 0x6CB, 11 },
+ { 0x6E, 7 },
+ { 0x366D, 14 },
+ { 0xF, 4 },
+ { 0xE, 4 },
+ { 0x4, 4 },
+ { 0x5, 4 },
+ { 0xA, 4 },
+ { 0x6, 4 },
+ { 0x1A, 5 },
+ { 0x11, 5 },
+ { 0x7, 4 },
+ { 0xC, 4 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0x9, 4 },
+ { 0x17, 5 },
+ { 0x6F, 7 },
+ { 0x6D, 7 },
+ { 0x364, 10 },
+ { 0xD9A, 12 },
+ { 0x6CA, 11 },
+ { 0x1B37, 13 },
+ { 0x366C, 14 },
+ { 0x42, 7 },
+ { 0xD8, 8 }
+ },
+ { /* DC bias table 3 */
+ { 0x0, 4 },
+ { 0x2D, 6 },
+ { 0xF7, 8 },
+ { 0x58, 7 },
+ { 0x167, 9 },
+ { 0x2CB, 10 },
+ { 0x2CA, 10 },
+ { 0xE, 6 },
+ { 0x1661, 13 },
+ { 0x3, 3 },
+ { 0x2, 3 },
+ { 0x8, 4 },
+ { 0x9, 4 },
+ { 0xD, 4 },
+ { 0x2, 4 },
+ { 0x1F, 5 },
+ { 0x17, 5 },
+ { 0x1, 4 },
+ { 0xC, 4 },
+ { 0xE, 4 },
+ { 0xA, 4 },
+ { 0x6, 5 },
+ { 0x78, 7 },
+ { 0xF, 6 },
+ { 0x7A, 7 },
+ { 0x164, 9 },
+ { 0x599, 11 },
+ { 0x2CD, 10 },
+ { 0xB31, 12 },
+ { 0x1660, 13 },
+ { 0x79, 7 },
+ { 0xF6, 8 }
+ },
+ { /* DC bias table 4 */
+ { 0x3, 4 },
+ { 0x3C, 6 },
+ { 0xF, 7 },
+ { 0x7A, 7 },
+ { 0x1D, 8 },
+ { 0x20, 9 },
+ { 0x72, 10 },
+ { 0x6, 6 },
+ { 0x399, 13 },
+ { 0x4, 3 },
+ { 0x5, 3 },
+ { 0x5, 4 },
+ { 0x6, 4 },
+ { 0xE, 4 },
+ { 0x4, 4 },
+ { 0x0, 4 },
+ { 0x19, 5 },
+ { 0x2, 4 },
+ { 0xD, 4 },
+ { 0x7, 4 },
+ { 0x1F, 5 },
+ { 0x30, 6 },
+ { 0x11, 8 },
+ { 0x31, 6 },
+ { 0x5, 6 },
+ { 0x21, 9 },
+ { 0xE7, 11 },
+ { 0x38, 9 },
+ { 0x1CD, 12 },
+ { 0x398, 13 },
+ { 0x7B, 7 },
+ { 0x9, 7 }
+ },
+ { /* DC bias table 5 */
+ { 0x9, 4 },
+ { 0x2, 5 },
+ { 0x74, 7 },
+ { 0x7, 6 },
+ { 0xEC, 8 },
+ { 0xD1, 9 },
+ { 0x1A6, 10 },
+ { 0x6, 6 },
+ { 0xD21, 13 },
+ { 0x5, 3 },
+ { 0x6, 3 },
+ { 0x8, 4 },
+ { 0x7, 4 },
+ { 0xF, 4 },
+ { 0x4, 4 },
+ { 0x0, 4 },
+ { 0x1C, 5 },
+ { 0x2, 4 },
+ { 0x5, 4 },
+ { 0x3, 4 },
+ { 0xC, 5 },
+ { 0x35, 7 },
+ { 0x1A7, 10 },
+ { 0x1B, 6 },
+ { 0x77, 7 },
+ { 0x1A5, 10 },
+ { 0x349, 11 },
+ { 0xD0, 9 },
+ { 0x691, 12 },
+ { 0xD20, 13 },
+ { 0x75, 7 },
+ { 0xED, 8 }
+ },
+ { /* DC bias table 6 */
+ { 0xA, 4 },
+ { 0xC, 5 },
+ { 0x12, 6 },
+ { 0x1B, 6 },
+ { 0xB7, 8 },
+ { 0x16C, 9 },
+ { 0x99, 9 },
+ { 0x5A, 7 },
+ { 0x16D8, 13 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x0, 3 },
+ { 0x5, 4 },
+ { 0x17, 5 },
+ { 0xE, 5 },
+ { 0x2, 4 },
+ { 0x3, 4 },
+ { 0xF, 5 },
+ { 0x1A, 6 },
+ { 0x4D, 8 },
+ { 0x2DB3, 14 },
+ { 0x2C, 6 },
+ { 0x11, 6 },
+ { 0x2DA, 10 },
+ { 0x5B7, 11 },
+ { 0x98, 9 },
+ { 0xB6D, 12 },
+ { 0x2DB2, 14 },
+ { 0x10, 6 },
+ { 0x27, 7 }
+ },
+ { /* DC bias table 7 */
+ { 0xD, 4 },
+ { 0xF, 5 },
+ { 0x1D, 6 },
+ { 0x8, 5 },
+ { 0x51, 7 },
+ { 0x56, 8 },
+ { 0xAF, 9 },
+ { 0x2A, 7 },
+ { 0x148A, 13 },
+ { 0x7, 3 },
+ { 0x0, 2 },
+ { 0x8, 4 },
+ { 0x9, 4 },
+ { 0xC, 4 },
+ { 0x6, 4 },
+ { 0x17, 5 },
+ { 0xB, 5 },
+ { 0x16, 5 },
+ { 0x15, 5 },
+ { 0x9, 5 },
+ { 0x50, 7 },
+ { 0xAE, 9 },
+ { 0x2917, 14 },
+ { 0x1C, 6 },
+ { 0x14, 6 },
+ { 0x290, 10 },
+ { 0x523, 11 },
+ { 0x149, 9 },
+ { 0xA44, 12 },
+ { 0x2916, 14 },
+ { 0x53, 7 },
+ { 0xA5, 8 }
+ },
+ { /* DC bias table 8 */
+ { 0x1, 4 },
+ { 0x1D, 6 },
+ { 0xF5, 8 },
+ { 0xF4, 8 },
+ { 0x24D, 10 },
+ { 0x499, 11 },
+ { 0x498, 11 },
+ { 0x1, 5 },
+ { 0x21, 6 },
+ { 0x6, 3 },
+ { 0x5, 3 },
+ { 0x6, 4 },
+ { 0x5, 4 },
+ { 0x2, 4 },
+ { 0x7, 5 },
+ { 0x25, 6 },
+ { 0x7B, 7 },
+ { 0x1C, 6 },
+ { 0x20, 6 },
+ { 0xD, 6 },
+ { 0x48, 7 },
+ { 0x92, 8 },
+ { 0x127, 9 },
+ { 0xE, 4 },
+ { 0x4, 4 },
+ { 0x11, 5 },
+ { 0xC, 6 },
+ { 0x3C, 6 },
+ { 0xF, 5 },
+ { 0x0, 5 },
+ { 0x1F, 5 },
+ { 0x13, 5 }
+ },
+ { /* DC bias table 9 */
+ { 0x5, 4 },
+ { 0x3C, 6 },
+ { 0x40, 7 },
+ { 0xD, 7 },
+ { 0x31, 9 },
+ { 0x61, 10 },
+ { 0x60, 10 },
+ { 0x2, 5 },
+ { 0xF5, 8 },
+ { 0x6, 3 },
+ { 0x5, 3 },
+ { 0x7, 4 },
+ { 0x6, 4 },
+ { 0x2, 4 },
+ { 0x9, 5 },
+ { 0x25, 6 },
+ { 0x7, 6 },
+ { 0x21, 6 },
+ { 0x24, 6 },
+ { 0x10, 6 },
+ { 0x41, 7 },
+ { 0xF4, 8 },
+ { 0x19, 8 },
+ { 0xE, 4 },
+ { 0x3, 4 },
+ { 0x11, 5 },
+ { 0x11, 6 },
+ { 0x3F, 6 },
+ { 0x3E, 6 },
+ { 0x7B, 7 },
+ { 0x0, 4 },
+ { 0x13, 5 }
+ },
+ { /* DC bias table 10 */
+ { 0xA, 4 },
+ { 0x7, 5 },
+ { 0x1, 6 },
+ { 0x9, 6 },
+ { 0x131, 9 },
+ { 0x261, 10 },
+ { 0x260, 10 },
+ { 0x15, 6 },
+ { 0x1, 7 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0x8, 4 },
+ { 0x7, 4 },
+ { 0x6, 4 },
+ { 0x12, 5 },
+ { 0x2F, 6 },
+ { 0x14, 6 },
+ { 0x27, 6 },
+ { 0x2D, 6 },
+ { 0x16, 6 },
+ { 0x4D, 7 },
+ { 0x99, 8 },
+ { 0x0, 7 },
+ { 0x4, 4 },
+ { 0x1, 4 },
+ { 0x5, 5 },
+ { 0x17, 6 },
+ { 0x2E, 6 },
+ { 0x2C, 6 },
+ { 0x8, 6 },
+ { 0x6, 5 },
+ { 0x1, 5 }
+ },
+ { /* DC bias table 11 */
+ { 0x0, 3 },
+ { 0xE, 5 },
+ { 0x17, 6 },
+ { 0x2A, 6 },
+ { 0x10, 7 },
+ { 0xF9, 10 },
+ { 0xF8, 10 },
+ { 0x1E, 7 },
+ { 0x3F, 8 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x6, 4 },
+ { 0xF, 5 },
+ { 0x5, 5 },
+ { 0x16, 6 },
+ { 0x29, 6 },
+ { 0x2B, 6 },
+ { 0x15, 6 },
+ { 0x50, 7 },
+ { 0x11, 7 },
+ { 0x7D, 9 },
+ { 0x4, 4 },
+ { 0x17, 5 },
+ { 0x6, 5 },
+ { 0x14, 6 },
+ { 0x2C, 6 },
+ { 0x2D, 6 },
+ { 0xE, 6 },
+ { 0x9, 6 },
+ { 0x51, 7 }
+ },
+ { /* DC bias table 12 */
+ { 0x2, 3 },
+ { 0x18, 5 },
+ { 0x2F, 6 },
+ { 0xD, 5 },
+ { 0x53, 7 },
+ { 0x295, 10 },
+ { 0x294, 10 },
+ { 0xA4, 8 },
+ { 0x7C, 8 },
+ { 0x0, 2 },
+ { 0x7, 3 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x1B, 5 },
+ { 0xC, 5 },
+ { 0x28, 6 },
+ { 0x6A, 7 },
+ { 0x1E, 6 },
+ { 0x1D, 6 },
+ { 0x69, 7 },
+ { 0xD7, 8 },
+ { 0x7D, 8 },
+ { 0x14B, 9 },
+ { 0x19, 5 },
+ { 0x16, 5 },
+ { 0x2E, 6 },
+ { 0x1C, 6 },
+ { 0x2B, 6 },
+ { 0x2A, 6 },
+ { 0x68, 7 },
+ { 0x3F, 7 },
+ { 0xD6, 8 }
+ },
+ { /* DC bias table 13 */
+ { 0x2, 3 },
+ { 0x1B, 5 },
+ { 0xC, 5 },
+ { 0x18, 5 },
+ { 0x29, 6 },
+ { 0x7F, 8 },
+ { 0x2F0, 10 },
+ { 0x198, 9 },
+ { 0x179, 9 },
+ { 0x0, 2 },
+ { 0x7, 3 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x1A, 5 },
+ { 0xD, 5 },
+ { 0x2A, 6 },
+ { 0x64, 7 },
+ { 0x1E, 6 },
+ { 0x67, 7 },
+ { 0x5F, 7 },
+ { 0xCD, 8 },
+ { 0x7E, 8 },
+ { 0x2F1, 10 },
+ { 0x16, 5 },
+ { 0xE, 5 },
+ { 0x2E, 6 },
+ { 0x65, 7 },
+ { 0x2B, 6 },
+ { 0x28, 6 },
+ { 0x3E, 7 },
+ { 0xBD, 8 },
+ { 0x199, 9 }
+ },
+ { /* DC bias table 14 */
+ { 0x2, 3 },
+ { 0x7, 4 },
+ { 0x16, 5 },
+ { 0x6, 4 },
+ { 0x36, 6 },
+ { 0x5C, 7 },
+ { 0x15D, 9 },
+ { 0x15C, 9 },
+ { 0x2BF, 10 },
+ { 0x0, 2 },
+ { 0x7, 3 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x18, 5 },
+ { 0x34, 6 },
+ { 0x2A, 6 },
+ { 0x5E, 7 },
+ { 0x6A, 7 },
+ { 0x64, 7 },
+ { 0x5D, 7 },
+ { 0xCB, 8 },
+ { 0xAD, 8 },
+ { 0x2BE, 10 },
+ { 0x14, 5 },
+ { 0x33, 6 },
+ { 0x6E, 7 },
+ { 0x5F, 7 },
+ { 0x6F, 7 },
+ { 0x6B, 7 },
+ { 0xCA, 8 },
+ { 0xAC, 8 },
+ { 0x15E, 9 }
+ },
+ { /* DC bias table 15 */
+ { 0xF, 4 },
+ { 0x1D, 5 },
+ { 0x18, 5 },
+ { 0xB, 4 },
+ { 0x19, 5 },
+ { 0x29, 6 },
+ { 0xD6, 8 },
+ { 0x551, 11 },
+ { 0xAA1, 12 },
+ { 0x1, 2 },
+ { 0x0, 2 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x1B, 5 },
+ { 0x38, 6 },
+ { 0x28, 6 },
+ { 0x57, 7 },
+ { 0x6A, 7 },
+ { 0x68, 7 },
+ { 0x56, 7 },
+ { 0xE5, 8 },
+ { 0x155, 9 },
+ { 0xAA0, 12 },
+ { 0x73, 7 },
+ { 0x69, 7 },
+ { 0xD7, 8 },
+ { 0xAB, 8 },
+ { 0xE4, 8 },
+ { 0xA9, 8 },
+ { 0x151, 9 },
+ { 0x150, 9 },
+ { 0x2A9, 10 }
+ }
};
-static const uint16_t ac_bias_0[16][32][2] =
-{
- { /* AC bias group 1, table 0 */
- { 0x8, 5 },
- { 0x25, 7 },
- { 0x17A, 9 },
- { 0x2F7, 10 },
- { 0xBDB, 12 },
- { 0x17B4, 13 },
- { 0x2F6B, 14 },
- { 0x1D, 5 },
- { 0x2F6A, 14 },
- { 0x8, 4 },
- { 0x7, 4 },
- { 0x1, 4 },
- { 0x2, 4 },
- { 0xA, 4 },
- { 0x6, 4 },
- { 0x0, 4 },
- { 0x1C, 5 },
- { 0x9, 4 },
- { 0xD, 4 },
- { 0xF, 4 },
- { 0xC, 4 },
- { 0x3, 4 },
- { 0xA, 5 },
- { 0x16, 5 },
- { 0x13, 6 },
- { 0x5D, 7 },
- { 0x24, 7 },
- { 0xBC, 8 },
- { 0x5C, 7 },
- { 0x5EC, 11 },
- { 0xB, 5 },
- { 0x5F, 7 }
- },
- { /* AC bias group 1, table 1 */
- { 0xF, 5 },
- { 0x10, 6 },
- { 0x4B, 8 },
- { 0xC6, 8 },
- { 0x31D, 10 },
- { 0xC71, 12 },
- { 0xC70, 12 },
- { 0x1, 4 },
- { 0xC73, 12 },
- { 0x8, 4 },
- { 0x9, 4 },
- { 0x2, 4 },
- { 0x3, 4 },
- { 0xB, 4 },
- { 0x6, 4 },
- { 0x0, 4 },
- { 0x1C, 5 },
- { 0x5, 4 },
- { 0xD, 4 },
- { 0xF, 4 },
- { 0xA, 4 },
- { 0x19, 5 },
- { 0x13, 6 },
- { 0x1D, 5 },
- { 0x30, 6 },
- { 0x62, 7 },
- { 0x24, 7 },
- { 0x4A, 8 },
- { 0x18F, 9 },
- { 0xC72, 12 },
- { 0xE, 5 },
- { 0x11, 6 }
- },
- { /* AC bias group 1, table 2 */
- { 0x1B, 5 },
- { 0x3, 6 },
- { 0x8D, 8 },
- { 0x40, 7 },
- { 0x239, 10 },
- { 0x471, 11 },
- { 0x8E0, 12 },
- { 0x3, 4 },
- { 0x11C3, 13 },
- { 0xA, 4 },
- { 0x9, 4 },
- { 0x4, 4 },
- { 0x5, 4 },
- { 0xE, 4 },
- { 0x7, 4 },
- { 0x1, 4 },
- { 0x1E, 5 },
- { 0x6, 4 },
- { 0xC, 4 },
- { 0xB, 4 },
- { 0x2, 4 },
- { 0x0, 5 },
- { 0x41, 7 },
- { 0x1F, 5 },
- { 0x22, 6 },
- { 0x2, 6 },
- { 0x8F, 8 },
- { 0x8C, 8 },
- { 0x11D, 9 },
- { 0x11C2, 13 },
- { 0x1A, 5 },
- { 0x21, 6 }
- },
- { /* AC bias group 1, table 3 */
- { 0x1F, 5 },
- { 0x3, 6 },
- { 0x3, 7 },
- { 0x43, 7 },
- { 0xB, 9 },
- { 0x15, 10 },
- { 0x51, 12 },
- { 0x3, 4 },
- { 0x50, 12 },
- { 0xD, 4 },
- { 0xC, 4 },
- { 0x4, 4 },
- { 0x6, 4 },
- { 0xE, 4 },
- { 0xA, 4 },
- { 0x1, 4 },
- { 0x1E, 5 },
- { 0x5, 4 },
- { 0x9, 4 },
- { 0x7, 4 },
- { 0x11, 5 },
- { 0x2, 6 },
- { 0x4, 8 },
- { 0x2, 4 },
- { 0x2D, 6 },
- { 0x20, 6 },
- { 0x42, 7 },
- { 0x1, 7 },
- { 0x0, 7 },
- { 0x29, 11 },
- { 0x17, 5 },
- { 0x2C, 6 }
- },
- { /* AC bias group 1, table 4 */
- { 0x3, 4 },
- { 0x1F, 6 },
- { 0x3A, 7 },
- { 0x5D, 7 },
- { 0x173, 9 },
- { 0x2E4, 10 },
- { 0x172D, 13 },
- { 0x4, 4 },
- { 0x172C, 13 },
- { 0xF, 4 },
- { 0xE, 4 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0xC, 4 },
- { 0xA, 4 },
- { 0x1, 4 },
- { 0x16, 5 },
- { 0x2, 4 },
- { 0x5, 4 },
- { 0x1A, 5 },
- { 0x2F, 6 },
- { 0x38, 7 },
- { 0x5CA, 11 },
- { 0x6, 4 },
- { 0x37, 6 },
- { 0x1E, 6 },
- { 0x3B, 7 },
- { 0x39, 7 },
- { 0xB8, 8 },
- { 0xB97, 12 },
- { 0x0, 4 },
- { 0x36, 6 }
- },
- { /* AC bias group 1, table 5 */
- { 0x6, 4 },
- { 0x37, 6 },
- { 0x5D, 7 },
- { 0xC, 6 },
- { 0xB9, 8 },
- { 0x2E3, 10 },
- { 0x5C4, 11 },
- { 0x4, 4 },
- { 0x1715, 13 },
- { 0x0, 3 },
- { 0xF, 4 },
- { 0x8, 4 },
- { 0x7, 4 },
- { 0xC, 4 },
- { 0x9, 4 },
- { 0x1D, 5 },
- { 0x16, 5 },
- { 0x1C, 5 },
- { 0x1A, 5 },
- { 0xB, 5 },
- { 0x5E, 7 },
- { 0x170, 9 },
- { 0x1714, 13 },
- { 0xA, 4 },
- { 0xA, 5 },
- { 0x36, 6 },
- { 0x5F, 7 },
- { 0x1B, 7 },
- { 0x1A, 7 },
- { 0xB8B, 12 },
- { 0x2, 4 },
- { 0x7, 5 }
- },
- { /* AC bias group 1, table 6 */
- { 0xC, 4 },
- { 0xB, 5 },
- { 0x79, 7 },
- { 0x22, 6 },
- { 0xF0, 8 },
- { 0x119, 9 },
- { 0x230, 10 },
- { 0x1D, 5 },
- { 0x8C4, 12 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xA, 4 },
- { 0x9, 4 },
- { 0xB, 4 },
- { 0x7, 4 },
- { 0x1C, 5 },
- { 0x3D, 6 },
- { 0xD, 5 },
- { 0x8, 5 },
- { 0x15, 6 },
- { 0x8D, 8 },
- { 0x118B, 13 },
- { 0x118A, 13 },
- { 0xD, 4 },
- { 0x10, 5 },
- { 0x9, 5 },
- { 0x14, 6 },
- { 0x47, 7 },
- { 0xF1, 8 },
- { 0x463, 11 },
- { 0x1F, 5 },
- { 0xC, 5 }
- },
- { /* AC bias group 1, table 7 */
- { 0x0, 3 },
- { 0x1A, 5 },
- { 0x33, 6 },
- { 0xC, 5 },
- { 0x46, 7 },
- { 0x1E3, 9 },
- { 0x3C5, 10 },
- { 0x17, 5 },
- { 0x1E21, 13 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x9, 4 },
- { 0xA, 4 },
- { 0x7, 4 },
- { 0x1B, 5 },
- { 0x3D, 6 },
- { 0x1B, 6 },
- { 0x22, 6 },
- { 0x79, 7 },
- { 0xF0, 8 },
- { 0x1E20, 13 },
- { 0x1E23, 13 },
- { 0x1E22, 13 },
- { 0xE, 4 },
- { 0x16, 5 },
- { 0x18, 5 },
- { 0x32, 6 },
- { 0x1A, 6 },
- { 0x47, 7 },
- { 0x789, 11 },
- { 0x1F, 5 },
- { 0x10, 5 }
- },
- { /* AC bias group 1, table 8 */
- { 0x1D, 5 },
- { 0x61, 7 },
- { 0x4E, 8 },
- { 0x9E, 9 },
- { 0x27C, 11 },
- { 0x9F5, 13 },
- { 0x9F4, 13 },
- { 0x3, 4 },
- { 0x60, 7 },
- { 0x0, 3 },
- { 0xF, 4 },
- { 0xB, 4 },
- { 0xA, 4 },
- { 0x9, 4 },
- { 0x5, 4 },
- { 0xD, 5 },
- { 0x31, 6 },
- { 0x8, 5 },
- { 0x38, 6 },
- { 0x12, 6 },
- { 0x26, 7 },
- { 0x13F, 10 },
- { 0x4FB, 12 },
- { 0xD, 4 },
- { 0x2, 4 },
- { 0xC, 5 },
- { 0x39, 6 },
- { 0x1C, 6 },
- { 0xF, 5 },
- { 0x1D, 6 },
- { 0x8, 4 },
- { 0x19, 5 }
- },
- { /* AC bias group 1, table 9 */
- { 0x7, 4 },
- { 0x19, 6 },
- { 0xAB, 8 },
- { 0xAA, 8 },
- { 0x119, 10 },
- { 0x461, 12 },
- { 0x460, 12 },
- { 0x1B, 5 },
- { 0x47, 8 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xC, 4 },
- { 0xB, 4 },
- { 0x9, 4 },
- { 0x5, 4 },
- { 0xD, 5 },
- { 0x35, 6 },
- { 0x3D, 6 },
- { 0x3C, 6 },
- { 0x18, 6 },
- { 0x22, 7 },
- { 0x8D, 9 },
- { 0x231, 11 },
- { 0xE, 4 },
- { 0x1F, 5 },
- { 0x9, 5 },
- { 0x2B, 6 },
- { 0x10, 6 },
- { 0x34, 6 },
- { 0x54, 7 },
- { 0x8, 4 },
- { 0x14, 5 }
- },
- { /* AC bias group 1, table 10 */
- { 0xC, 4 },
- { 0x5, 5 },
- { 0x8, 6 },
- { 0x5B, 7 },
- { 0x4D, 9 },
- { 0x131, 11 },
- { 0x261, 12 },
- { 0x1A, 5 },
- { 0x12, 7 },
- { 0x0, 3 },
- { 0xF, 4 },
- { 0xA, 4 },
- { 0x9, 4 },
- { 0x6, 4 },
- { 0x1B, 5 },
- { 0x6, 5 },
- { 0x1C, 6 },
- { 0x2C, 6 },
- { 0x15, 6 },
- { 0x5A, 7 },
- { 0x27, 8 },
- { 0x99, 10 },
- { 0x260, 12 },
- { 0xE, 4 },
- { 0x4, 4 },
- { 0xF, 5 },
- { 0x7, 5 },
- { 0x1D, 6 },
- { 0xB, 5 },
- { 0x14, 6 },
- { 0x8, 4 },
- { 0x17, 5 }
- },
- { /* AC bias group 1, table 11 */
- { 0xF, 4 },
- { 0x13, 5 },
- { 0x75, 7 },
- { 0x24, 6 },
- { 0x95, 8 },
- { 0x251, 10 },
- { 0x4A0, 11 },
- { 0x10, 5 },
- { 0xC8, 8 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x1, 4 },
- { 0x0, 4 },
- { 0x1A, 5 },
- { 0x11, 5 },
- { 0x2C, 6 },
- { 0x65, 7 },
- { 0x74, 7 },
- { 0x4B, 7 },
- { 0xC9, 8 },
- { 0x129, 9 },
- { 0x943, 12 },
- { 0x942, 12 },
- { 0x3, 3 },
- { 0xA, 4 },
- { 0x1C, 5 },
- { 0x18, 5 },
- { 0x33, 6 },
- { 0x17, 5 },
- { 0x2D, 6 },
- { 0x1B, 5 },
- { 0x3B, 6 }
- },
- { /* AC bias group 1, table 12 */
- { 0x3, 3 },
- { 0x1A, 5 },
- { 0x2D, 6 },
- { 0x38, 6 },
- { 0x28, 7 },
- { 0x395, 10 },
- { 0xE51, 12 },
- { 0x37, 6 },
- { 0xE4, 8 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0x1F, 5 },
- { 0x1E, 5 },
- { 0x17, 5 },
- { 0x3A, 6 },
- { 0x73, 7 },
- { 0x2A, 7 },
- { 0x2B, 7 },
- { 0x29, 7 },
- { 0x1CB, 9 },
- { 0x729, 11 },
- { 0x1CA1, 13 },
- { 0x1CA0, 13 },
- { 0x4, 3 },
- { 0xA, 4 },
- { 0x4, 4 },
- { 0x18, 5 },
- { 0x36, 6 },
- { 0xB, 5 },
- { 0x2C, 6 },
- { 0x19, 5 },
- { 0x3B, 6 }
- },
- { /* AC bias group 1, table 13 */
- { 0x4, 3 },
- { 0x4, 4 },
- { 0x3F, 6 },
- { 0x17, 5 },
- { 0x75, 7 },
- { 0x1F5, 9 },
- { 0x7D1, 11 },
- { 0x17, 6 },
- { 0x1F6, 9 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0x1B, 5 },
- { 0x1A, 5 },
- { 0xA, 5 },
- { 0x32, 6 },
- { 0x74, 7 },
- { 0xF8, 8 },
- { 0xF9, 8 },
- { 0x1F7, 9 },
- { 0x3E9, 10 },
- { 0xFA0, 12 },
- { 0x1F43, 13 },
- { 0x1F42, 13 },
- { 0x3, 3 },
- { 0xA, 4 },
- { 0x1E, 5 },
- { 0x1C, 5 },
- { 0x3B, 6 },
- { 0x18, 5 },
- { 0x16, 6 },
- { 0x16, 5 },
- { 0x33, 6 }
- },
- { /* AC bias group 1, table 14 */
- { 0x4, 3 },
- { 0x7, 4 },
- { 0x18, 5 },
- { 0x1E, 5 },
- { 0x36, 6 },
- { 0x31, 7 },
- { 0x177, 9 },
- { 0x77, 7 },
- { 0x176, 9 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0x1A, 5 },
- { 0x19, 5 },
- { 0x3A, 6 },
- { 0x19, 6 },
- { 0x5C, 7 },
- { 0xBA, 8 },
- { 0x61, 8 },
- { 0xC1, 9 },
- { 0x180, 10 },
- { 0x302, 11 },
- { 0x607, 12 },
- { 0x606, 12 },
- { 0x2, 3 },
- { 0xA, 4 },
- { 0x1F, 5 },
- { 0x1C, 5 },
- { 0x37, 6 },
- { 0x16, 5 },
- { 0x76, 7 },
- { 0xD, 5 },
- { 0x2F, 6 }
- },
- { /* AC bias group 1, table 15 */
- { 0x0, 3 },
- { 0xA, 4 },
- { 0x1A, 5 },
- { 0xC, 4 },
- { 0x1D, 5 },
- { 0x39, 6 },
- { 0x78, 7 },
- { 0x5E, 7 },
- { 0x393, 11 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x16, 5 },
- { 0xF, 5 },
- { 0x2E, 6 },
- { 0x5F, 7 },
- { 0x73, 8 },
- { 0xE5, 9 },
- { 0x1C8, 10 },
- { 0xE4A, 13 },
- { 0x1C97, 14 },
- { 0x1C96, 14 },
- { 0xE49, 13 },
- { 0xE48, 13 },
- { 0x4, 3 },
- { 0x6, 4 },
- { 0x1F, 5 },
- { 0x1B, 5 },
- { 0x1D, 6 },
- { 0x38, 6 },
- { 0x38, 7 },
- { 0x3D, 6 },
- { 0x79, 7 }
- }
+static const uint16_t ac_bias_0[16][32][2] = {
+ { /* AC bias group 1, table 0 */
+ { 0x8, 5 },
+ { 0x25, 7 },
+ { 0x17A, 9 },
+ { 0x2F7, 10 },
+ { 0xBDB, 12 },
+ { 0x17B4, 13 },
+ { 0x2F6B, 14 },
+ { 0x1D, 5 },
+ { 0x2F6A, 14 },
+ { 0x8, 4 },
+ { 0x7, 4 },
+ { 0x1, 4 },
+ { 0x2, 4 },
+ { 0xA, 4 },
+ { 0x6, 4 },
+ { 0x0, 4 },
+ { 0x1C, 5 },
+ { 0x9, 4 },
+ { 0xD, 4 },
+ { 0xF, 4 },
+ { 0xC, 4 },
+ { 0x3, 4 },
+ { 0xA, 5 },
+ { 0x16, 5 },
+ { 0x13, 6 },
+ { 0x5D, 7 },
+ { 0x24, 7 },
+ { 0xBC, 8 },
+ { 0x5C, 7 },
+ { 0x5EC, 11 },
+ { 0xB, 5 },
+ { 0x5F, 7 }
+ },
+ { /* AC bias group 1, table 1 */
+ { 0xF, 5 },
+ { 0x10, 6 },
+ { 0x4B, 8 },
+ { 0xC6, 8 },
+ { 0x31D, 10 },
+ { 0xC71, 12 },
+ { 0xC70, 12 },
+ { 0x1, 4 },
+ { 0xC73, 12 },
+ { 0x8, 4 },
+ { 0x9, 4 },
+ { 0x2, 4 },
+ { 0x3, 4 },
+ { 0xB, 4 },
+ { 0x6, 4 },
+ { 0x0, 4 },
+ { 0x1C, 5 },
+ { 0x5, 4 },
+ { 0xD, 4 },
+ { 0xF, 4 },
+ { 0xA, 4 },
+ { 0x19, 5 },
+ { 0x13, 6 },
+ { 0x1D, 5 },
+ { 0x30, 6 },
+ { 0x62, 7 },
+ { 0x24, 7 },
+ { 0x4A, 8 },
+ { 0x18F, 9 },
+ { 0xC72, 12 },
+ { 0xE, 5 },
+ { 0x11, 6 }
+ },
+ { /* AC bias group 1, table 2 */
+ { 0x1B, 5 },
+ { 0x3, 6 },
+ { 0x8D, 8 },
+ { 0x40, 7 },
+ { 0x239, 10 },
+ { 0x471, 11 },
+ { 0x8E0, 12 },
+ { 0x3, 4 },
+ { 0x11C3, 13 },
+ { 0xA, 4 },
+ { 0x9, 4 },
+ { 0x4, 4 },
+ { 0x5, 4 },
+ { 0xE, 4 },
+ { 0x7, 4 },
+ { 0x1, 4 },
+ { 0x1E, 5 },
+ { 0x6, 4 },
+ { 0xC, 4 },
+ { 0xB, 4 },
+ { 0x2, 4 },
+ { 0x0, 5 },
+ { 0x41, 7 },
+ { 0x1F, 5 },
+ { 0x22, 6 },
+ { 0x2, 6 },
+ { 0x8F, 8 },
+ { 0x8C, 8 },
+ { 0x11D, 9 },
+ { 0x11C2, 13 },
+ { 0x1A, 5 },
+ { 0x21, 6 }
+ },
+ { /* AC bias group 1, table 3 */
+ { 0x1F, 5 },
+ { 0x3, 6 },
+ { 0x3, 7 },
+ { 0x43, 7 },
+ { 0xB, 9 },
+ { 0x15, 10 },
+ { 0x51, 12 },
+ { 0x3, 4 },
+ { 0x50, 12 },
+ { 0xD, 4 },
+ { 0xC, 4 },
+ { 0x4, 4 },
+ { 0x6, 4 },
+ { 0xE, 4 },
+ { 0xA, 4 },
+ { 0x1, 4 },
+ { 0x1E, 5 },
+ { 0x5, 4 },
+ { 0x9, 4 },
+ { 0x7, 4 },
+ { 0x11, 5 },
+ { 0x2, 6 },
+ { 0x4, 8 },
+ { 0x2, 4 },
+ { 0x2D, 6 },
+ { 0x20, 6 },
+ { 0x42, 7 },
+ { 0x1, 7 },
+ { 0x0, 7 },
+ { 0x29, 11 },
+ { 0x17, 5 },
+ { 0x2C, 6 }
+ },
+ { /* AC bias group 1, table 4 */
+ { 0x3, 4 },
+ { 0x1F, 6 },
+ { 0x3A, 7 },
+ { 0x5D, 7 },
+ { 0x173, 9 },
+ { 0x2E4, 10 },
+ { 0x172D, 13 },
+ { 0x4, 4 },
+ { 0x172C, 13 },
+ { 0xF, 4 },
+ { 0xE, 4 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0xC, 4 },
+ { 0xA, 4 },
+ { 0x1, 4 },
+ { 0x16, 5 },
+ { 0x2, 4 },
+ { 0x5, 4 },
+ { 0x1A, 5 },
+ { 0x2F, 6 },
+ { 0x38, 7 },
+ { 0x5CA, 11 },
+ { 0x6, 4 },
+ { 0x37, 6 },
+ { 0x1E, 6 },
+ { 0x3B, 7 },
+ { 0x39, 7 },
+ { 0xB8, 8 },
+ { 0xB97, 12 },
+ { 0x0, 4 },
+ { 0x36, 6 }
+ },
+ { /* AC bias group 1, table 5 */
+ { 0x6, 4 },
+ { 0x37, 6 },
+ { 0x5D, 7 },
+ { 0xC, 6 },
+ { 0xB9, 8 },
+ { 0x2E3, 10 },
+ { 0x5C4, 11 },
+ { 0x4, 4 },
+ { 0x1715, 13 },
+ { 0x0, 3 },
+ { 0xF, 4 },
+ { 0x8, 4 },
+ { 0x7, 4 },
+ { 0xC, 4 },
+ { 0x9, 4 },
+ { 0x1D, 5 },
+ { 0x16, 5 },
+ { 0x1C, 5 },
+ { 0x1A, 5 },
+ { 0xB, 5 },
+ { 0x5E, 7 },
+ { 0x170, 9 },
+ { 0x1714, 13 },
+ { 0xA, 4 },
+ { 0xA, 5 },
+ { 0x36, 6 },
+ { 0x5F, 7 },
+ { 0x1B, 7 },
+ { 0x1A, 7 },
+ { 0xB8B, 12 },
+ { 0x2, 4 },
+ { 0x7, 5 }
+ },
+ { /* AC bias group 1, table 6 */
+ { 0xC, 4 },
+ { 0xB, 5 },
+ { 0x79, 7 },
+ { 0x22, 6 },
+ { 0xF0, 8 },
+ { 0x119, 9 },
+ { 0x230, 10 },
+ { 0x1D, 5 },
+ { 0x8C4, 12 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xA, 4 },
+ { 0x9, 4 },
+ { 0xB, 4 },
+ { 0x7, 4 },
+ { 0x1C, 5 },
+ { 0x3D, 6 },
+ { 0xD, 5 },
+ { 0x8, 5 },
+ { 0x15, 6 },
+ { 0x8D, 8 },
+ { 0x118B, 13 },
+ { 0x118A, 13 },
+ { 0xD, 4 },
+ { 0x10, 5 },
+ { 0x9, 5 },
+ { 0x14, 6 },
+ { 0x47, 7 },
+ { 0xF1, 8 },
+ { 0x463, 11 },
+ { 0x1F, 5 },
+ { 0xC, 5 }
+ },
+ { /* AC bias group 1, table 7 */
+ { 0x0, 3 },
+ { 0x1A, 5 },
+ { 0x33, 6 },
+ { 0xC, 5 },
+ { 0x46, 7 },
+ { 0x1E3, 9 },
+ { 0x3C5, 10 },
+ { 0x17, 5 },
+ { 0x1E21, 13 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x9, 4 },
+ { 0xA, 4 },
+ { 0x7, 4 },
+ { 0x1B, 5 },
+ { 0x3D, 6 },
+ { 0x1B, 6 },
+ { 0x22, 6 },
+ { 0x79, 7 },
+ { 0xF0, 8 },
+ { 0x1E20, 13 },
+ { 0x1E23, 13 },
+ { 0x1E22, 13 },
+ { 0xE, 4 },
+ { 0x16, 5 },
+ { 0x18, 5 },
+ { 0x32, 6 },
+ { 0x1A, 6 },
+ { 0x47, 7 },
+ { 0x789, 11 },
+ { 0x1F, 5 },
+ { 0x10, 5 }
+ },
+ { /* AC bias group 1, table 8 */
+ { 0x1D, 5 },
+ { 0x61, 7 },
+ { 0x4E, 8 },
+ { 0x9E, 9 },
+ { 0x27C, 11 },
+ { 0x9F5, 13 },
+ { 0x9F4, 13 },
+ { 0x3, 4 },
+ { 0x60, 7 },
+ { 0x0, 3 },
+ { 0xF, 4 },
+ { 0xB, 4 },
+ { 0xA, 4 },
+ { 0x9, 4 },
+ { 0x5, 4 },
+ { 0xD, 5 },
+ { 0x31, 6 },
+ { 0x8, 5 },
+ { 0x38, 6 },
+ { 0x12, 6 },
+ { 0x26, 7 },
+ { 0x13F, 10 },
+ { 0x4FB, 12 },
+ { 0xD, 4 },
+ { 0x2, 4 },
+ { 0xC, 5 },
+ { 0x39, 6 },
+ { 0x1C, 6 },
+ { 0xF, 5 },
+ { 0x1D, 6 },
+ { 0x8, 4 },
+ { 0x19, 5 }
+ },
+ { /* AC bias group 1, table 9 */
+ { 0x7, 4 },
+ { 0x19, 6 },
+ { 0xAB, 8 },
+ { 0xAA, 8 },
+ { 0x119, 10 },
+ { 0x461, 12 },
+ { 0x460, 12 },
+ { 0x1B, 5 },
+ { 0x47, 8 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xC, 4 },
+ { 0xB, 4 },
+ { 0x9, 4 },
+ { 0x5, 4 },
+ { 0xD, 5 },
+ { 0x35, 6 },
+ { 0x3D, 6 },
+ { 0x3C, 6 },
+ { 0x18, 6 },
+ { 0x22, 7 },
+ { 0x8D, 9 },
+ { 0x231, 11 },
+ { 0xE, 4 },
+ { 0x1F, 5 },
+ { 0x9, 5 },
+ { 0x2B, 6 },
+ { 0x10, 6 },
+ { 0x34, 6 },
+ { 0x54, 7 },
+ { 0x8, 4 },
+ { 0x14, 5 }
+ },
+ { /* AC bias group 1, table 10 */
+ { 0xC, 4 },
+ { 0x5, 5 },
+ { 0x8, 6 },
+ { 0x5B, 7 },
+ { 0x4D, 9 },
+ { 0x131, 11 },
+ { 0x261, 12 },
+ { 0x1A, 5 },
+ { 0x12, 7 },
+ { 0x0, 3 },
+ { 0xF, 4 },
+ { 0xA, 4 },
+ { 0x9, 4 },
+ { 0x6, 4 },
+ { 0x1B, 5 },
+ { 0x6, 5 },
+ { 0x1C, 6 },
+ { 0x2C, 6 },
+ { 0x15, 6 },
+ { 0x5A, 7 },
+ { 0x27, 8 },
+ { 0x99, 10 },
+ { 0x260, 12 },
+ { 0xE, 4 },
+ { 0x4, 4 },
+ { 0xF, 5 },
+ { 0x7, 5 },
+ { 0x1D, 6 },
+ { 0xB, 5 },
+ { 0x14, 6 },
+ { 0x8, 4 },
+ { 0x17, 5 }
+ },
+ { /* AC bias group 1, table 11 */
+ { 0xF, 4 },
+ { 0x13, 5 },
+ { 0x75, 7 },
+ { 0x24, 6 },
+ { 0x95, 8 },
+ { 0x251, 10 },
+ { 0x4A0, 11 },
+ { 0x10, 5 },
+ { 0xC8, 8 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x1, 4 },
+ { 0x0, 4 },
+ { 0x1A, 5 },
+ { 0x11, 5 },
+ { 0x2C, 6 },
+ { 0x65, 7 },
+ { 0x74, 7 },
+ { 0x4B, 7 },
+ { 0xC9, 8 },
+ { 0x129, 9 },
+ { 0x943, 12 },
+ { 0x942, 12 },
+ { 0x3, 3 },
+ { 0xA, 4 },
+ { 0x1C, 5 },
+ { 0x18, 5 },
+ { 0x33, 6 },
+ { 0x17, 5 },
+ { 0x2D, 6 },
+ { 0x1B, 5 },
+ { 0x3B, 6 }
+ },
+ { /* AC bias group 1, table 12 */
+ { 0x3, 3 },
+ { 0x1A, 5 },
+ { 0x2D, 6 },
+ { 0x38, 6 },
+ { 0x28, 7 },
+ { 0x395, 10 },
+ { 0xE51, 12 },
+ { 0x37, 6 },
+ { 0xE4, 8 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0x1F, 5 },
+ { 0x1E, 5 },
+ { 0x17, 5 },
+ { 0x3A, 6 },
+ { 0x73, 7 },
+ { 0x2A, 7 },
+ { 0x2B, 7 },
+ { 0x29, 7 },
+ { 0x1CB, 9 },
+ { 0x729, 11 },
+ { 0x1CA1, 13 },
+ { 0x1CA0, 13 },
+ { 0x4, 3 },
+ { 0xA, 4 },
+ { 0x4, 4 },
+ { 0x18, 5 },
+ { 0x36, 6 },
+ { 0xB, 5 },
+ { 0x2C, 6 },
+ { 0x19, 5 },
+ { 0x3B, 6 }
+ },
+ { /* AC bias group 1, table 13 */
+ { 0x4, 3 },
+ { 0x4, 4 },
+ { 0x3F, 6 },
+ { 0x17, 5 },
+ { 0x75, 7 },
+ { 0x1F5, 9 },
+ { 0x7D1, 11 },
+ { 0x17, 6 },
+ { 0x1F6, 9 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0x1B, 5 },
+ { 0x1A, 5 },
+ { 0xA, 5 },
+ { 0x32, 6 },
+ { 0x74, 7 },
+ { 0xF8, 8 },
+ { 0xF9, 8 },
+ { 0x1F7, 9 },
+ { 0x3E9, 10 },
+ { 0xFA0, 12 },
+ { 0x1F43, 13 },
+ { 0x1F42, 13 },
+ { 0x3, 3 },
+ { 0xA, 4 },
+ { 0x1E, 5 },
+ { 0x1C, 5 },
+ { 0x3B, 6 },
+ { 0x18, 5 },
+ { 0x16, 6 },
+ { 0x16, 5 },
+ { 0x33, 6 }
+ },
+ { /* AC bias group 1, table 14 */
+ { 0x4, 3 },
+ { 0x7, 4 },
+ { 0x18, 5 },
+ { 0x1E, 5 },
+ { 0x36, 6 },
+ { 0x31, 7 },
+ { 0x177, 9 },
+ { 0x77, 7 },
+ { 0x176, 9 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0x1A, 5 },
+ { 0x19, 5 },
+ { 0x3A, 6 },
+ { 0x19, 6 },
+ { 0x5C, 7 },
+ { 0xBA, 8 },
+ { 0x61, 8 },
+ { 0xC1, 9 },
+ { 0x180, 10 },
+ { 0x302, 11 },
+ { 0x607, 12 },
+ { 0x606, 12 },
+ { 0x2, 3 },
+ { 0xA, 4 },
+ { 0x1F, 5 },
+ { 0x1C, 5 },
+ { 0x37, 6 },
+ { 0x16, 5 },
+ { 0x76, 7 },
+ { 0xD, 5 },
+ { 0x2F, 6 }
+ },
+ { /* AC bias group 1, table 15 */
+ { 0x0, 3 },
+ { 0xA, 4 },
+ { 0x1A, 5 },
+ { 0xC, 4 },
+ { 0x1D, 5 },
+ { 0x39, 6 },
+ { 0x78, 7 },
+ { 0x5E, 7 },
+ { 0x393, 11 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x16, 5 },
+ { 0xF, 5 },
+ { 0x2E, 6 },
+ { 0x5F, 7 },
+ { 0x73, 8 },
+ { 0xE5, 9 },
+ { 0x1C8, 10 },
+ { 0xE4A, 13 },
+ { 0x1C97, 14 },
+ { 0x1C96, 14 },
+ { 0xE49, 13 },
+ { 0xE48, 13 },
+ { 0x4, 3 },
+ { 0x6, 4 },
+ { 0x1F, 5 },
+ { 0x1B, 5 },
+ { 0x1D, 6 },
+ { 0x38, 6 },
+ { 0x38, 7 },
+ { 0x3D, 6 },
+ { 0x79, 7 }
+ }
};
-static const uint16_t ac_bias_1[16][32][2] =
-{
- { /* AC bias group 2, table 0 */
- { 0xB, 5 },
- { 0x2B, 7 },
- { 0x54, 8 },
- { 0x1B7, 9 },
- { 0x6D9, 11 },
- { 0xDB1, 12 },
- { 0xDB0, 12 },
- { 0x2, 4 },
- { 0xAB, 9 },
- { 0x9, 4 },
- { 0xA, 4 },
- { 0x7, 4 },
- { 0x8, 4 },
- { 0xF, 4 },
- { 0xC, 4 },
- { 0x3, 4 },
- { 0x1D, 5 },
- { 0x4, 4 },
- { 0xB, 4 },
- { 0x6, 4 },
- { 0x1A, 5 },
- { 0x3, 6 },
- { 0xAA, 9 },
- { 0x1, 4 },
- { 0x0, 5 },
- { 0x14, 6 },
- { 0x6C, 7 },
- { 0xDA, 8 },
- { 0x2, 6 },
- { 0x36D, 10 },
- { 0x1C, 5 },
- { 0x37, 6 }
- },
- { /* AC bias group 2, table 1 */
- { 0x1D, 5 },
- { 0x4, 6 },
- { 0xB6, 8 },
- { 0x6A, 8 },
- { 0x5B9, 11 },
- { 0x16E1, 13 },
- { 0x16E0, 13 },
- { 0x7, 4 },
- { 0x16F, 9 },
- { 0xC, 4 },
- { 0xD, 4 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0xF, 4 },
- { 0xA, 4 },
- { 0x3, 4 },
- { 0x17, 5 },
- { 0x2, 4 },
- { 0x4, 4 },
- { 0x1C, 5 },
- { 0x2C, 6 },
- { 0x6B, 8 },
- { 0xB71, 12 },
- { 0x5, 4 },
- { 0x3, 5 },
- { 0x1B, 6 },
- { 0x5A, 7 },
- { 0x34, 7 },
- { 0x5, 6 },
- { 0x2DD, 10 },
- { 0x0, 4 },
- { 0xC, 5 }
- },
- { /* AC bias group 2, table 2 */
- { 0x3, 4 },
- { 0x7F, 7 },
- { 0xA1, 8 },
- { 0xA0, 8 },
- { 0x20C, 10 },
- { 0x834, 12 },
- { 0x106B, 13 },
- { 0x7, 4 },
- { 0x82, 8 },
- { 0xE, 4 },
- { 0xD, 4 },
- { 0xB, 4 },
- { 0xC, 4 },
- { 0x0, 3 },
- { 0x9, 4 },
- { 0x2, 4 },
- { 0x11, 5 },
- { 0x1E, 5 },
- { 0x15, 5 },
- { 0x3E, 6 },
- { 0x40, 7 },
- { 0x41B, 11 },
- { 0x106A, 13 },
- { 0x6, 4 },
- { 0xA, 5 },
- { 0x29, 6 },
- { 0x7E, 7 },
- { 0x51, 7 },
- { 0x21, 6 },
- { 0x107, 9 },
- { 0x4, 4 },
- { 0xB, 5 }
- },
- { /* AC bias group 2, table 3 */
- { 0x7, 4 },
- { 0x1B, 6 },
- { 0xF6, 8 },
- { 0xE9, 8 },
- { 0x3A1, 10 },
- { 0x740, 11 },
- { 0xE82, 12 },
- { 0x1F, 5 },
- { 0x1EF, 9 },
- { 0x1, 3 },
- { 0x2, 3 },
- { 0xB, 4 },
- { 0xC, 4 },
- { 0xD, 4 },
- { 0x8, 4 },
- { 0x1C, 5 },
- { 0x3, 5 },
- { 0x12, 5 },
- { 0x2, 5 },
- { 0x75, 7 },
- { 0x1D1, 9 },
- { 0x1D07, 13 },
- { 0x1D06, 13 },
- { 0xA, 4 },
- { 0x13, 5 },
- { 0x3B, 6 },
- { 0x1A, 6 },
- { 0x7A, 7 },
- { 0x3C, 6 },
- { 0x1EE, 9 },
- { 0x0, 4 },
- { 0xC, 5 }
- },
- { /* AC bias group 2, table 4 */
- { 0xD, 4 },
- { 0x3D, 6 },
- { 0x42, 7 },
- { 0x37, 7 },
- { 0xD9, 9 },
- { 0x362, 11 },
- { 0x6C6, 12 },
- { 0x1F, 5 },
- { 0x86, 8 },
- { 0x1, 3 },
- { 0x2, 3 },
- { 0xC, 4 },
- { 0xB, 4 },
- { 0xA, 4 },
- { 0x1, 4 },
- { 0xF, 5 },
- { 0x25, 6 },
- { 0x3C, 6 },
- { 0x1A, 6 },
- { 0x87, 8 },
- { 0x1B0, 10 },
- { 0xD8F, 13 },
- { 0xD8E, 13 },
- { 0xE, 4 },
- { 0x13, 5 },
- { 0xC, 5 },
- { 0x24, 6 },
- { 0x20, 6 },
- { 0x11, 5 },
- { 0x6D, 8 },
- { 0x0, 4 },
- { 0xE, 5 }
- },
- { /* AC bias group 2, table 5 */
- { 0x0, 3 },
- { 0x12, 5 },
- { 0x76, 7 },
- { 0x77, 7 },
- { 0x14D, 9 },
- { 0x533, 11 },
- { 0x14C9, 13 },
- { 0x13, 5 },
- { 0xA5, 8 },
- { 0x2, 3 },
- { 0x3, 3 },
- { 0xB, 4 },
- { 0xC, 4 },
- { 0x8, 4 },
- { 0x1A, 5 },
- { 0x2B, 6 },
- { 0x75, 7 },
- { 0x74, 7 },
- { 0xA7, 8 },
- { 0x298, 10 },
- { 0x14C8, 13 },
- { 0x14CB, 13 },
- { 0x14CA, 13 },
- { 0xF, 4 },
- { 0x1C, 5 },
- { 0x7, 5 },
- { 0x2A, 6 },
- { 0x28, 6 },
- { 0x1B, 5 },
- { 0xA4, 8 },
- { 0x2, 4 },
- { 0x6, 5 }
- },
- { /* AC bias group 2, table 6 */
- { 0x2, 3 },
- { 0x1A, 5 },
- { 0x2B, 6 },
- { 0x3A, 6 },
- { 0xED, 8 },
- { 0x283, 10 },
- { 0xA0A, 12 },
- { 0x4, 5 },
- { 0xA1, 8 },
- { 0x4, 3 },
- { 0x3, 3 },
- { 0xB, 4 },
- { 0xC, 4 },
- { 0x1F, 5 },
- { 0x6, 5 },
- { 0x77, 7 },
- { 0xA3, 8 },
- { 0xA2, 8 },
- { 0x140, 9 },
- { 0x1417, 13 },
- { 0x1416, 13 },
- { 0xA09, 12 },
- { 0xA08, 12 },
- { 0x0, 3 },
- { 0x1E, 5 },
- { 0x7, 5 },
- { 0x2A, 6 },
- { 0x29, 6 },
- { 0x1C, 5 },
- { 0xEC, 8 },
- { 0x1B, 5 },
- { 0x5, 5 }
- },
- { /* AC bias group 2, table 7 */
- { 0x2, 3 },
- { 0x2, 4 },
- { 0x18, 5 },
- { 0x1D, 5 },
- { 0x35, 6 },
- { 0xE4, 8 },
- { 0x1CF, 11 },
- { 0x1D, 7 },
- { 0x72, 9 },
- { 0x4, 3 },
- { 0x5, 3 },
- { 0x6, 4 },
- { 0x7, 4 },
- { 0x6, 5 },
- { 0x73, 7 },
- { 0x38, 8 },
- { 0x1CE, 11 },
- { 0x39B, 12 },
- { 0x398, 12 },
- { 0x733, 13 },
- { 0x732, 13 },
- { 0x735, 13 },
- { 0x734, 13 },
- { 0x0, 3 },
- { 0x1F, 5 },
- { 0x1B, 5 },
- { 0x34, 6 },
- { 0xF, 6 },
- { 0x1E, 5 },
- { 0xE5, 8 },
- { 0x19, 5 },
- { 0x38, 6 }
- },
- { /* AC bias group 2, table 8 */
- { 0x16, 5 },
- { 0x50, 7 },
- { 0x172, 9 },
- { 0x2E7, 10 },
- { 0x1732, 13 },
- { 0x2E67, 14 },
- { 0x2E66, 14 },
- { 0x6, 4 },
- { 0x51, 7 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xD, 4 },
- { 0xC, 4 },
- { 0x9, 4 },
- { 0x1C, 5 },
- { 0x9, 5 },
- { 0x1C, 6 },
- { 0x1D, 6 },
- { 0x5D, 7 },
- { 0xB8, 8 },
- { 0x5CD, 11 },
- { 0x1731, 13 },
- { 0x1730, 13 },
- { 0xF, 4 },
- { 0x5, 4 },
- { 0xF, 5 },
- { 0x8, 5 },
- { 0x29, 6 },
- { 0x1D, 5 },
- { 0x2F, 6 },
- { 0x8, 4 },
- { 0x15, 5 }
- },
- { /* AC bias group 2, table 9 */
- { 0x9, 4 },
- { 0x21, 6 },
- { 0x40, 7 },
- { 0xAD, 8 },
- { 0x2B0, 10 },
- { 0x1589, 13 },
- { 0x1588, 13 },
- { 0x1C, 5 },
- { 0x5F, 7 },
- { 0x0, 3 },
- { 0xF, 4 },
- { 0xD, 4 },
- { 0xC, 4 },
- { 0x6, 4 },
- { 0x11, 5 },
- { 0x2A, 6 },
- { 0x57, 7 },
- { 0x5E, 7 },
- { 0x41, 7 },
- { 0x159, 9 },
- { 0x563, 11 },
- { 0x158B, 13 },
- { 0x158A, 13 },
- { 0x1, 3 },
- { 0x5, 4 },
- { 0x14, 5 },
- { 0x3B, 6 },
- { 0x2E, 6 },
- { 0x4, 4 },
- { 0x3A, 6 },
- { 0x7, 4 },
- { 0x16, 5 }
- },
- { /* AC bias group 2, table 10 */
- { 0xE, 4 },
- { 0x7, 5 },
- { 0x46, 7 },
- { 0x45, 7 },
- { 0x64, 9 },
- { 0x32A, 12 },
- { 0x657, 13 },
- { 0x18, 5 },
- { 0xD, 6 },
- { 0x0, 3 },
- { 0xF, 4 },
- { 0xA, 4 },
- { 0xB, 4 },
- { 0x1A, 5 },
- { 0x36, 6 },
- { 0x47, 7 },
- { 0x44, 7 },
- { 0x18, 7 },
- { 0x33, 8 },
- { 0xCB, 10 },
- { 0x656, 13 },
- { 0x329, 12 },
- { 0x328, 12 },
- { 0x2, 3 },
- { 0x6, 4 },
- { 0x19, 5 },
- { 0xE, 5 },
- { 0x37, 6 },
- { 0x9, 4 },
- { 0xF, 5 },
- { 0x2, 4 },
- { 0x10, 5 }
- },
- { /* AC bias group 2, table 11 */
- { 0x3, 3 },
- { 0x18, 5 },
- { 0x23, 6 },
- { 0x77, 7 },
- { 0x194, 9 },
- { 0x1956, 13 },
- { 0x32AF, 14 },
- { 0x3A, 6 },
- { 0x76, 7 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x1F, 5 },
- { 0x1E, 5 },
- { 0x14, 5 },
- { 0x22, 6 },
- { 0x64, 7 },
- { 0x197, 9 },
- { 0x196, 9 },
- { 0x32B, 10 },
- { 0x654, 11 },
- { 0x32AE, 14 },
- { 0x1955, 13 },
- { 0x1954, 13 },
- { 0x0, 3 },
- { 0x9, 4 },
- { 0x1C, 5 },
- { 0x15, 5 },
- { 0x10, 5 },
- { 0xD, 4 },
- { 0x17, 5 },
- { 0x16, 5 },
- { 0x33, 6 }
- },
- { /* AC bias group 2, table 12 */
- { 0x5, 3 },
- { 0x6, 4 },
- { 0x3E, 6 },
- { 0x10, 5 },
- { 0x48, 7 },
- { 0x93F, 12 },
- { 0x24FA, 14 },
- { 0x32, 6 },
- { 0x67, 7 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x1B, 5 },
- { 0x1E, 5 },
- { 0x34, 6 },
- { 0x66, 7 },
- { 0x92, 8 },
- { 0x126, 9 },
- { 0x24E, 10 },
- { 0x49E, 11 },
- { 0x49F7, 15 },
- { 0x49F6, 15 },
- { 0x24F9, 14 },
- { 0x24F8, 14 },
- { 0x0, 3 },
- { 0x7, 4 },
- { 0x18, 5 },
- { 0x11, 5 },
- { 0x3F, 6 },
- { 0xE, 4 },
- { 0x13, 5 },
- { 0x35, 6 },
- { 0x25, 6 }
- },
- { /* AC bias group 2, table 13 */
- { 0x5, 3 },
- { 0x8, 4 },
- { 0x12, 5 },
- { 0x1C, 5 },
- { 0x1C, 6 },
- { 0xEA, 9 },
- { 0x1D75, 14 },
- { 0x1E, 6 },
- { 0x66, 7 },
- { 0x1, 3 },
- { 0x2, 3 },
- { 0x1B, 5 },
- { 0x1A, 5 },
- { 0x1F, 6 },
- { 0x3B, 7 },
- { 0x74, 8 },
- { 0x1D6, 10 },
- { 0x3AF, 11 },
- { 0x1D74, 14 },
- { 0x1D77, 14 },
- { 0x1D76, 14 },
- { 0xEB9, 13 },
- { 0xEB8, 13 },
- { 0xF, 4 },
- { 0x6, 4 },
- { 0x13, 5 },
- { 0x3B, 6 },
- { 0x3A, 6 },
- { 0x0, 3 },
- { 0x18, 5 },
- { 0x32, 6 },
- { 0x67, 7 }
- },
- { /* AC bias group 2, table 14 */
- { 0x4, 3 },
- { 0xA, 4 },
- { 0x1B, 5 },
- { 0xC, 4 },
- { 0xD, 5 },
- { 0xE6, 8 },
- { 0x684, 11 },
- { 0x72, 7 },
- { 0xE7, 8 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x17, 5 },
- { 0x16, 5 },
- { 0x18, 6 },
- { 0xD1, 8 },
- { 0x1A0, 9 },
- { 0x686, 11 },
- { 0xD0F, 12 },
- { 0xD0A, 12 },
- { 0x1A17, 13 },
- { 0x1A16, 13 },
- { 0x1A1D, 13 },
- { 0x1A1C, 13 },
- { 0xF, 4 },
- { 0x1D, 5 },
- { 0xE, 5 },
- { 0x35, 6 },
- { 0x38, 6 },
- { 0x0, 3 },
- { 0xF, 5 },
- { 0x19, 6 },
- { 0x69, 7 }
- },
- { /* AC bias group 2, table 15 */
- { 0x3, 3 },
- { 0xC, 4 },
- { 0x1B, 5 },
- { 0x0, 3 },
- { 0x3, 4 },
- { 0x2E, 6 },
- { 0x51, 9 },
- { 0xBC, 8 },
- { 0x53, 9 },
- { 0x4, 3 },
- { 0x2, 3 },
- { 0x16, 5 },
- { 0x15, 5 },
- { 0x15, 7 },
- { 0x50, 9 },
- { 0xA4, 10 },
- { 0x294, 12 },
- { 0x52B, 13 },
- { 0x52A, 13 },
- { 0x52D, 13 },
- { 0x52C, 13 },
- { 0x52F, 13 },
- { 0x52E, 13 },
- { 0xE, 4 },
- { 0x1A, 5 },
- { 0x4, 5 },
- { 0x28, 6 },
- { 0x29, 6 },
- { 0xF, 4 },
- { 0xB, 6 },
- { 0x5F, 7 },
- { 0xBD, 8 }
- }
+static const uint16_t ac_bias_1[16][32][2] = {
+ { /* AC bias group 2, table 0 */
+ { 0xB, 5 },
+ { 0x2B, 7 },
+ { 0x54, 8 },
+ { 0x1B7, 9 },
+ { 0x6D9, 11 },
+ { 0xDB1, 12 },
+ { 0xDB0, 12 },
+ { 0x2, 4 },
+ { 0xAB, 9 },
+ { 0x9, 4 },
+ { 0xA, 4 },
+ { 0x7, 4 },
+ { 0x8, 4 },
+ { 0xF, 4 },
+ { 0xC, 4 },
+ { 0x3, 4 },
+ { 0x1D, 5 },
+ { 0x4, 4 },
+ { 0xB, 4 },
+ { 0x6, 4 },
+ { 0x1A, 5 },
+ { 0x3, 6 },
+ { 0xAA, 9 },
+ { 0x1, 4 },
+ { 0x0, 5 },
+ { 0x14, 6 },
+ { 0x6C, 7 },
+ { 0xDA, 8 },
+ { 0x2, 6 },
+ { 0x36D, 10 },
+ { 0x1C, 5 },
+ { 0x37, 6 }
+ },
+ { /* AC bias group 2, table 1 */
+ { 0x1D, 5 },
+ { 0x4, 6 },
+ { 0xB6, 8 },
+ { 0x6A, 8 },
+ { 0x5B9, 11 },
+ { 0x16E1, 13 },
+ { 0x16E0, 13 },
+ { 0x7, 4 },
+ { 0x16F, 9 },
+ { 0xC, 4 },
+ { 0xD, 4 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0xF, 4 },
+ { 0xA, 4 },
+ { 0x3, 4 },
+ { 0x17, 5 },
+ { 0x2, 4 },
+ { 0x4, 4 },
+ { 0x1C, 5 },
+ { 0x2C, 6 },
+ { 0x6B, 8 },
+ { 0xB71, 12 },
+ { 0x5, 4 },
+ { 0x3, 5 },
+ { 0x1B, 6 },
+ { 0x5A, 7 },
+ { 0x34, 7 },
+ { 0x5, 6 },
+ { 0x2DD, 10 },
+ { 0x0, 4 },
+ { 0xC, 5 }
+ },
+ { /* AC bias group 2, table 2 */
+ { 0x3, 4 },
+ { 0x7F, 7 },
+ { 0xA1, 8 },
+ { 0xA0, 8 },
+ { 0x20C, 10 },
+ { 0x834, 12 },
+ { 0x106B, 13 },
+ { 0x7, 4 },
+ { 0x82, 8 },
+ { 0xE, 4 },
+ { 0xD, 4 },
+ { 0xB, 4 },
+ { 0xC, 4 },
+ { 0x0, 3 },
+ { 0x9, 4 },
+ { 0x2, 4 },
+ { 0x11, 5 },
+ { 0x1E, 5 },
+ { 0x15, 5 },
+ { 0x3E, 6 },
+ { 0x40, 7 },
+ { 0x41B, 11 },
+ { 0x106A, 13 },
+ { 0x6, 4 },
+ { 0xA, 5 },
+ { 0x29, 6 },
+ { 0x7E, 7 },
+ { 0x51, 7 },
+ { 0x21, 6 },
+ { 0x107, 9 },
+ { 0x4, 4 },
+ { 0xB, 5 }
+ },
+ { /* AC bias group 2, table 3 */
+ { 0x7, 4 },
+ { 0x1B, 6 },
+ { 0xF6, 8 },
+ { 0xE9, 8 },
+ { 0x3A1, 10 },
+ { 0x740, 11 },
+ { 0xE82, 12 },
+ { 0x1F, 5 },
+ { 0x1EF, 9 },
+ { 0x1, 3 },
+ { 0x2, 3 },
+ { 0xB, 4 },
+ { 0xC, 4 },
+ { 0xD, 4 },
+ { 0x8, 4 },
+ { 0x1C, 5 },
+ { 0x3, 5 },
+ { 0x12, 5 },
+ { 0x2, 5 },
+ { 0x75, 7 },
+ { 0x1D1, 9 },
+ { 0x1D07, 13 },
+ { 0x1D06, 13 },
+ { 0xA, 4 },
+ { 0x13, 5 },
+ { 0x3B, 6 },
+ { 0x1A, 6 },
+ { 0x7A, 7 },
+ { 0x3C, 6 },
+ { 0x1EE, 9 },
+ { 0x0, 4 },
+ { 0xC, 5 }
+ },
+ { /* AC bias group 2, table 4 */
+ { 0xD, 4 },
+ { 0x3D, 6 },
+ { 0x42, 7 },
+ { 0x37, 7 },
+ { 0xD9, 9 },
+ { 0x362, 11 },
+ { 0x6C6, 12 },
+ { 0x1F, 5 },
+ { 0x86, 8 },
+ { 0x1, 3 },
+ { 0x2, 3 },
+ { 0xC, 4 },
+ { 0xB, 4 },
+ { 0xA, 4 },
+ { 0x1, 4 },
+ { 0xF, 5 },
+ { 0x25, 6 },
+ { 0x3C, 6 },
+ { 0x1A, 6 },
+ { 0x87, 8 },
+ { 0x1B0, 10 },
+ { 0xD8F, 13 },
+ { 0xD8E, 13 },
+ { 0xE, 4 },
+ { 0x13, 5 },
+ { 0xC, 5 },
+ { 0x24, 6 },
+ { 0x20, 6 },
+ { 0x11, 5 },
+ { 0x6D, 8 },
+ { 0x0, 4 },
+ { 0xE, 5 }
+ },
+ { /* AC bias group 2, table 5 */
+ { 0x0, 3 },
+ { 0x12, 5 },
+ { 0x76, 7 },
+ { 0x77, 7 },
+ { 0x14D, 9 },
+ { 0x533, 11 },
+ { 0x14C9, 13 },
+ { 0x13, 5 },
+ { 0xA5, 8 },
+ { 0x2, 3 },
+ { 0x3, 3 },
+ { 0xB, 4 },
+ { 0xC, 4 },
+ { 0x8, 4 },
+ { 0x1A, 5 },
+ { 0x2B, 6 },
+ { 0x75, 7 },
+ { 0x74, 7 },
+ { 0xA7, 8 },
+ { 0x298, 10 },
+ { 0x14C8, 13 },
+ { 0x14CB, 13 },
+ { 0x14CA, 13 },
+ { 0xF, 4 },
+ { 0x1C, 5 },
+ { 0x7, 5 },
+ { 0x2A, 6 },
+ { 0x28, 6 },
+ { 0x1B, 5 },
+ { 0xA4, 8 },
+ { 0x2, 4 },
+ { 0x6, 5 }
+ },
+ { /* AC bias group 2, table 6 */
+ { 0x2, 3 },
+ { 0x1A, 5 },
+ { 0x2B, 6 },
+ { 0x3A, 6 },
+ { 0xED, 8 },
+ { 0x283, 10 },
+ { 0xA0A, 12 },
+ { 0x4, 5 },
+ { 0xA1, 8 },
+ { 0x4, 3 },
+ { 0x3, 3 },
+ { 0xB, 4 },
+ { 0xC, 4 },
+ { 0x1F, 5 },
+ { 0x6, 5 },
+ { 0x77, 7 },
+ { 0xA3, 8 },
+ { 0xA2, 8 },
+ { 0x140, 9 },
+ { 0x1417, 13 },
+ { 0x1416, 13 },
+ { 0xA09, 12 },
+ { 0xA08, 12 },
+ { 0x0, 3 },
+ { 0x1E, 5 },
+ { 0x7, 5 },
+ { 0x2A, 6 },
+ { 0x29, 6 },
+ { 0x1C, 5 },
+ { 0xEC, 8 },
+ { 0x1B, 5 },
+ { 0x5, 5 }
+ },
+ { /* AC bias group 2, table 7 */
+ { 0x2, 3 },
+ { 0x2, 4 },
+ { 0x18, 5 },
+ { 0x1D, 5 },
+ { 0x35, 6 },
+ { 0xE4, 8 },
+ { 0x1CF, 11 },
+ { 0x1D, 7 },
+ { 0x72, 9 },
+ { 0x4, 3 },
+ { 0x5, 3 },
+ { 0x6, 4 },
+ { 0x7, 4 },
+ { 0x6, 5 },
+ { 0x73, 7 },
+ { 0x38, 8 },
+ { 0x1CE, 11 },
+ { 0x39B, 12 },
+ { 0x398, 12 },
+ { 0x733, 13 },
+ { 0x732, 13 },
+ { 0x735, 13 },
+ { 0x734, 13 },
+ { 0x0, 3 },
+ { 0x1F, 5 },
+ { 0x1B, 5 },
+ { 0x34, 6 },
+ { 0xF, 6 },
+ { 0x1E, 5 },
+ { 0xE5, 8 },
+ { 0x19, 5 },
+ { 0x38, 6 }
+ },
+ { /* AC bias group 2, table 8 */
+ { 0x16, 5 },
+ { 0x50, 7 },
+ { 0x172, 9 },
+ { 0x2E7, 10 },
+ { 0x1732, 13 },
+ { 0x2E67, 14 },
+ { 0x2E66, 14 },
+ { 0x6, 4 },
+ { 0x51, 7 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xD, 4 },
+ { 0xC, 4 },
+ { 0x9, 4 },
+ { 0x1C, 5 },
+ { 0x9, 5 },
+ { 0x1C, 6 },
+ { 0x1D, 6 },
+ { 0x5D, 7 },
+ { 0xB8, 8 },
+ { 0x5CD, 11 },
+ { 0x1731, 13 },
+ { 0x1730, 13 },
+ { 0xF, 4 },
+ { 0x5, 4 },
+ { 0xF, 5 },
+ { 0x8, 5 },
+ { 0x29, 6 },
+ { 0x1D, 5 },
+ { 0x2F, 6 },
+ { 0x8, 4 },
+ { 0x15, 5 }
+ },
+ { /* AC bias group 2, table 9 */
+ { 0x9, 4 },
+ { 0x21, 6 },
+ { 0x40, 7 },
+ { 0xAD, 8 },
+ { 0x2B0, 10 },
+ { 0x1589, 13 },
+ { 0x1588, 13 },
+ { 0x1C, 5 },
+ { 0x5F, 7 },
+ { 0x0, 3 },
+ { 0xF, 4 },
+ { 0xD, 4 },
+ { 0xC, 4 },
+ { 0x6, 4 },
+ { 0x11, 5 },
+ { 0x2A, 6 },
+ { 0x57, 7 },
+ { 0x5E, 7 },
+ { 0x41, 7 },
+ { 0x159, 9 },
+ { 0x563, 11 },
+ { 0x158B, 13 },
+ { 0x158A, 13 },
+ { 0x1, 3 },
+ { 0x5, 4 },
+ { 0x14, 5 },
+ { 0x3B, 6 },
+ { 0x2E, 6 },
+ { 0x4, 4 },
+ { 0x3A, 6 },
+ { 0x7, 4 },
+ { 0x16, 5 }
+ },
+ { /* AC bias group 2, table 10 */
+ { 0xE, 4 },
+ { 0x7, 5 },
+ { 0x46, 7 },
+ { 0x45, 7 },
+ { 0x64, 9 },
+ { 0x32A, 12 },
+ { 0x657, 13 },
+ { 0x18, 5 },
+ { 0xD, 6 },
+ { 0x0, 3 },
+ { 0xF, 4 },
+ { 0xA, 4 },
+ { 0xB, 4 },
+ { 0x1A, 5 },
+ { 0x36, 6 },
+ { 0x47, 7 },
+ { 0x44, 7 },
+ { 0x18, 7 },
+ { 0x33, 8 },
+ { 0xCB, 10 },
+ { 0x656, 13 },
+ { 0x329, 12 },
+ { 0x328, 12 },
+ { 0x2, 3 },
+ { 0x6, 4 },
+ { 0x19, 5 },
+ { 0xE, 5 },
+ { 0x37, 6 },
+ { 0x9, 4 },
+ { 0xF, 5 },
+ { 0x2, 4 },
+ { 0x10, 5 }
+ },
+ { /* AC bias group 2, table 11 */
+ { 0x3, 3 },
+ { 0x18, 5 },
+ { 0x23, 6 },
+ { 0x77, 7 },
+ { 0x194, 9 },
+ { 0x1956, 13 },
+ { 0x32AF, 14 },
+ { 0x3A, 6 },
+ { 0x76, 7 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x1F, 5 },
+ { 0x1E, 5 },
+ { 0x14, 5 },
+ { 0x22, 6 },
+ { 0x64, 7 },
+ { 0x197, 9 },
+ { 0x196, 9 },
+ { 0x32B, 10 },
+ { 0x654, 11 },
+ { 0x32AE, 14 },
+ { 0x1955, 13 },
+ { 0x1954, 13 },
+ { 0x0, 3 },
+ { 0x9, 4 },
+ { 0x1C, 5 },
+ { 0x15, 5 },
+ { 0x10, 5 },
+ { 0xD, 4 },
+ { 0x17, 5 },
+ { 0x16, 5 },
+ { 0x33, 6 }
+ },
+ { /* AC bias group 2, table 12 */
+ { 0x5, 3 },
+ { 0x6, 4 },
+ { 0x3E, 6 },
+ { 0x10, 5 },
+ { 0x48, 7 },
+ { 0x93F, 12 },
+ { 0x24FA, 14 },
+ { 0x32, 6 },
+ { 0x67, 7 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x1B, 5 },
+ { 0x1E, 5 },
+ { 0x34, 6 },
+ { 0x66, 7 },
+ { 0x92, 8 },
+ { 0x126, 9 },
+ { 0x24E, 10 },
+ { 0x49E, 11 },
+ { 0x49F7, 15 },
+ { 0x49F6, 15 },
+ { 0x24F9, 14 },
+ { 0x24F8, 14 },
+ { 0x0, 3 },
+ { 0x7, 4 },
+ { 0x18, 5 },
+ { 0x11, 5 },
+ { 0x3F, 6 },
+ { 0xE, 4 },
+ { 0x13, 5 },
+ { 0x35, 6 },
+ { 0x25, 6 }
+ },
+ { /* AC bias group 2, table 13 */
+ { 0x5, 3 },
+ { 0x8, 4 },
+ { 0x12, 5 },
+ { 0x1C, 5 },
+ { 0x1C, 6 },
+ { 0xEA, 9 },
+ { 0x1D75, 14 },
+ { 0x1E, 6 },
+ { 0x66, 7 },
+ { 0x1, 3 },
+ { 0x2, 3 },
+ { 0x1B, 5 },
+ { 0x1A, 5 },
+ { 0x1F, 6 },
+ { 0x3B, 7 },
+ { 0x74, 8 },
+ { 0x1D6, 10 },
+ { 0x3AF, 11 },
+ { 0x1D74, 14 },
+ { 0x1D77, 14 },
+ { 0x1D76, 14 },
+ { 0xEB9, 13 },
+ { 0xEB8, 13 },
+ { 0xF, 4 },
+ { 0x6, 4 },
+ { 0x13, 5 },
+ { 0x3B, 6 },
+ { 0x3A, 6 },
+ { 0x0, 3 },
+ { 0x18, 5 },
+ { 0x32, 6 },
+ { 0x67, 7 }
+ },
+ { /* AC bias group 2, table 14 */
+ { 0x4, 3 },
+ { 0xA, 4 },
+ { 0x1B, 5 },
+ { 0xC, 4 },
+ { 0xD, 5 },
+ { 0xE6, 8 },
+ { 0x684, 11 },
+ { 0x72, 7 },
+ { 0xE7, 8 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x17, 5 },
+ { 0x16, 5 },
+ { 0x18, 6 },
+ { 0xD1, 8 },
+ { 0x1A0, 9 },
+ { 0x686, 11 },
+ { 0xD0F, 12 },
+ { 0xD0A, 12 },
+ { 0x1A17, 13 },
+ { 0x1A16, 13 },
+ { 0x1A1D, 13 },
+ { 0x1A1C, 13 },
+ { 0xF, 4 },
+ { 0x1D, 5 },
+ { 0xE, 5 },
+ { 0x35, 6 },
+ { 0x38, 6 },
+ { 0x0, 3 },
+ { 0xF, 5 },
+ { 0x19, 6 },
+ { 0x69, 7 }
+ },
+ { /* AC bias group 2, table 15 */
+ { 0x3, 3 },
+ { 0xC, 4 },
+ { 0x1B, 5 },
+ { 0x0, 3 },
+ { 0x3, 4 },
+ { 0x2E, 6 },
+ { 0x51, 9 },
+ { 0xBC, 8 },
+ { 0x53, 9 },
+ { 0x4, 3 },
+ { 0x2, 3 },
+ { 0x16, 5 },
+ { 0x15, 5 },
+ { 0x15, 7 },
+ { 0x50, 9 },
+ { 0xA4, 10 },
+ { 0x294, 12 },
+ { 0x52B, 13 },
+ { 0x52A, 13 },
+ { 0x52D, 13 },
+ { 0x52C, 13 },
+ { 0x52F, 13 },
+ { 0x52E, 13 },
+ { 0xE, 4 },
+ { 0x1A, 5 },
+ { 0x4, 5 },
+ { 0x28, 6 },
+ { 0x29, 6 },
+ { 0xF, 4 },
+ { 0xB, 6 },
+ { 0x5F, 7 },
+ { 0xBD, 8 }
+ }
};
-static const uint16_t ac_bias_2[16][32][2] =
-{
- { /* AC bias group 3, table 0 */
- { 0x3, 4 },
- { 0x9, 6 },
- { 0xD0, 8 },
- { 0x1A3, 9 },
- { 0x344, 10 },
- { 0xD14, 12 },
- { 0x1A2B, 13 },
- { 0x4, 4 },
- { 0x15, 7 },
- { 0x0, 3 },
- { 0xF, 4 },
- { 0xB, 4 },
- { 0xC, 4 },
- { 0xE, 4 },
- { 0x9, 4 },
- { 0x1B, 5 },
- { 0xA, 5 },
- { 0x14, 5 },
- { 0xD, 5 },
- { 0x2A, 6 },
- { 0x14, 7 },
- { 0x68B, 11 },
- { 0x1A2A, 13 },
- { 0x8, 4 },
- { 0xB, 5 },
- { 0x2B, 6 },
- { 0xB, 6 },
- { 0x69, 7 },
- { 0x35, 6 },
- { 0x8, 6 },
- { 0x7, 4 },
- { 0xC, 5 }
- },
- { /* AC bias group 3, table 1 */
- { 0xA, 4 },
- { 0x3C, 6 },
- { 0x32, 7 },
- { 0x30, 7 },
- { 0xC5, 9 },
- { 0x621, 12 },
- { 0x620, 12 },
- { 0x1F, 5 },
- { 0x33, 7 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xE, 4 },
- { 0xD, 4 },
- { 0xC, 4 },
- { 0x4, 4 },
- { 0xD, 5 },
- { 0x26, 6 },
- { 0x27, 6 },
- { 0x14, 6 },
- { 0x63, 8 },
- { 0x189, 10 },
- { 0x623, 12 },
- { 0x622, 12 },
- { 0xB, 4 },
- { 0x12, 5 },
- { 0x3D, 6 },
- { 0x22, 6 },
- { 0x15, 6 },
- { 0xB, 5 },
- { 0x23, 6 },
- { 0x7, 4 },
- { 0x10, 5 }
- },
- { /* AC bias group 3, table 2 */
- { 0xF, 4 },
- { 0xC, 5 },
- { 0x43, 7 },
- { 0x10, 6 },
- { 0x44, 8 },
- { 0x114, 10 },
- { 0x455, 12 },
- { 0x18, 5 },
- { 0x23, 7 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xE, 4 },
- { 0xD, 4 },
- { 0x9, 4 },
- { 0x19, 5 },
- { 0x9, 5 },
- { 0x17, 6 },
- { 0x16, 6 },
- { 0x42, 7 },
- { 0x8B, 9 },
- { 0x454, 12 },
- { 0x457, 12 },
- { 0x456, 12 },
- { 0xB, 4 },
- { 0x15, 5 },
- { 0xA, 5 },
- { 0x29, 6 },
- { 0x20, 6 },
- { 0xD, 5 },
- { 0x28, 6 },
- { 0x7, 4 },
- { 0x11, 5 }
- },
- { /* AC bias group 3, table 3 */
- { 0x1, 3 },
- { 0x1A, 5 },
- { 0x29, 6 },
- { 0x2A, 6 },
- { 0xA0, 8 },
- { 0x285, 10 },
- { 0x1425, 13 },
- { 0x2, 5 },
- { 0x0, 7 },
- { 0x2, 3 },
- { 0x3, 3 },
- { 0xC, 4 },
- { 0xB, 4 },
- { 0x8, 4 },
- { 0x12, 5 },
- { 0x1, 6 },
- { 0x51, 7 },
- { 0x1, 7 },
- { 0x143, 9 },
- { 0x508, 11 },
- { 0x1424, 13 },
- { 0x1427, 13 },
- { 0x1426, 13 },
- { 0xF, 4 },
- { 0x1C, 5 },
- { 0x3, 5 },
- { 0x37, 6 },
- { 0x2B, 6 },
- { 0x13, 5 },
- { 0x36, 6 },
- { 0x1D, 5 },
- { 0x1, 5 }
- },
- { /* AC bias group 3, table 4 */
- { 0x4, 3 },
- { 0x1F, 5 },
- { 0x3D, 6 },
- { 0x6, 5 },
- { 0x16, 7 },
- { 0x53, 9 },
- { 0x14A, 11 },
- { 0x34, 6 },
- { 0x2A, 8 },
- { 0x2, 3 },
- { 0x3, 3 },
- { 0xB, 4 },
- { 0xC, 4 },
- { 0x1C, 5 },
- { 0x37, 6 },
- { 0x17, 7 },
- { 0x2B, 8 },
- { 0x28, 8 },
- { 0xA4, 10 },
- { 0x52D, 13 },
- { 0x52C, 13 },
- { 0x52F, 13 },
- { 0x52E, 13 },
- { 0x0, 3 },
- { 0x1D, 5 },
- { 0x7, 5 },
- { 0x4, 5 },
- { 0x35, 6 },
- { 0x14, 5 },
- { 0x36, 6 },
- { 0x15, 5 },
- { 0x3C, 6 }
- },
- { /* AC bias group 3, table 5 */
- { 0x4, 3 },
- { 0xA, 4 },
- { 0x7, 5 },
- { 0x1D, 5 },
- { 0x9, 6 },
- { 0x1F3, 9 },
- { 0x7C7, 11 },
- { 0x8, 6 },
- { 0x1F0, 9 },
- { 0x3, 3 },
- { 0x2, 3 },
- { 0xD, 4 },
- { 0xC, 4 },
- { 0x17, 5 },
- { 0x7D, 7 },
- { 0x1F2, 9 },
- { 0x7C6, 11 },
- { 0x7C5, 11 },
- { 0x1F12, 13 },
- { 0x3E27, 14 },
- { 0x3E26, 14 },
- { 0x1F11, 13 },
- { 0x1F10, 13 },
- { 0x0, 3 },
- { 0x1E, 5 },
- { 0x6, 5 },
- { 0x39, 6 },
- { 0x38, 6 },
- { 0x3F, 6 },
- { 0x2C, 6 },
- { 0x5, 5 },
- { 0x2D, 6 }
- },
- { /* AC bias group 3, table 6 */
- { 0x2, 3 },
- { 0x7, 4 },
- { 0x18, 5 },
- { 0x3, 4 },
- { 0x5, 5 },
- { 0x35, 7 },
- { 0x4F, 9 },
- { 0x12, 7 },
- { 0x4E5, 13 },
- { 0x5, 3 },
- { 0x4, 3 },
- { 0xD, 4 },
- { 0xE, 4 },
- { 0x33, 6 },
- { 0x26, 8 },
- { 0x9D, 10 },
- { 0x4E4, 13 },
- { 0x4E7, 13 },
- { 0x4E6, 13 },
- { 0x4E1, 13 },
- { 0x4E0, 13 },
- { 0x4E3, 13 },
- { 0x4E2, 13 },
- { 0x0, 3 },
- { 0x1F, 5 },
- { 0xC, 5 },
- { 0x3D, 6 },
- { 0x3C, 6 },
- { 0x32, 6 },
- { 0x34, 7 },
- { 0x1B, 6 },
- { 0x8, 6 }
- },
- { /* AC bias group 3, table 7 */
- { 0x0, 3 },
- { 0x4, 4 },
- { 0x1C, 5 },
- { 0xF, 4 },
- { 0x2, 4 },
- { 0x7, 5 },
- { 0x75, 7 },
- { 0xE8, 8 },
- { 0x1D2A, 13 },
- { 0x5, 3 },
- { 0x4, 3 },
- { 0xD, 4 },
- { 0xC, 4 },
- { 0x77, 7 },
- { 0xE96, 12 },
- { 0x3A57, 14 },
- { 0x3A56, 14 },
- { 0x3A5D, 14 },
- { 0x3A5C, 14 },
- { 0x3A5F, 14 },
- { 0x3A5E, 14 },
- { 0x1D29, 13 },
- { 0x1D28, 13 },
- { 0x3, 3 },
- { 0x6, 5 },
- { 0xA, 5 },
- { 0x2C, 7 },
- { 0x17, 6 },
- { 0x76, 7 },
- { 0x1D3, 9 },
- { 0x3A4, 10 },
- { 0x2D, 7 }
- },
- { /* AC bias group 3, table 8 */
- { 0xA, 4 },
- { 0x24, 6 },
- { 0xBF, 8 },
- { 0x85, 8 },
- { 0x211, 10 },
- { 0x842, 12 },
- { 0x1087, 13 },
- { 0x18, 5 },
- { 0x20, 6 },
- { 0x1, 3 },
- { 0x2, 3 },
- { 0xE, 4 },
- { 0xD, 4 },
- { 0x7, 4 },
- { 0x13, 5 },
- { 0x25, 6 },
- { 0x5E, 7 },
- { 0x43, 7 },
- { 0xBE, 8 },
- { 0x109, 9 },
- { 0x1086, 13 },
- { 0x841, 12 },
- { 0x840, 12 },
- { 0xF, 4 },
- { 0x1, 4 },
- { 0x11, 5 },
- { 0x0, 5 },
- { 0x2E, 6 },
- { 0x19, 5 },
- { 0x1, 5 },
- { 0x6, 4 },
- { 0x16, 5 }
- },
- { /* AC bias group 3, table 9 */
- { 0x2, 3 },
- { 0xF, 5 },
- { 0x6F, 7 },
- { 0x61, 7 },
- { 0x374, 10 },
- { 0x1BA8, 13 },
- { 0x3753, 14 },
- { 0x12, 5 },
- { 0x36, 6 },
- { 0x0, 3 },
- { 0x1, 3 },
- { 0xA, 4 },
- { 0xB, 4 },
- { 0x1A, 5 },
- { 0x31, 6 },
- { 0x60, 7 },
- { 0xDC, 8 },
- { 0x1BB, 9 },
- { 0x6EB, 11 },
- { 0x1BAB, 13 },
- { 0x3752, 14 },
- { 0x3755, 14 },
- { 0x3754, 14 },
- { 0xE, 4 },
- { 0x6, 4 },
- { 0x13, 5 },
- { 0xE, 5 },
- { 0x3E, 6 },
- { 0x8, 4 },
- { 0x1E, 5 },
- { 0x19, 5 },
- { 0x3F, 6 }
- },
- { /* AC bias group 3, table 10 */
- { 0x3, 3 },
- { 0x1C, 5 },
- { 0x25, 6 },
- { 0x24, 6 },
- { 0x1DA, 9 },
- { 0x1DBD, 13 },
- { 0x3B7C, 14 },
- { 0x3C, 6 },
- { 0x3D, 6 },
- { 0x0, 3 },
- { 0x1, 3 },
- { 0xB, 4 },
- { 0xA, 4 },
- { 0xB, 5 },
- { 0x77, 7 },
- { 0xEC, 8 },
- { 0x3B6, 10 },
- { 0x76E, 11 },
- { 0x1DBF, 13 },
- { 0x76FB, 15 },
- { 0x76FA, 15 },
- { 0x3B79, 14 },
- { 0x3B78, 14 },
- { 0xD, 4 },
- { 0x1F, 5 },
- { 0x13, 5 },
- { 0xA, 5 },
- { 0x8, 5 },
- { 0xC, 4 },
- { 0x8, 4 },
- { 0x9, 5 },
- { 0x3A, 6 }
- },
- { /* AC bias group 3, table 11 */
- { 0x5, 3 },
- { 0x3, 4 },
- { 0x4, 5 },
- { 0x10, 5 },
- { 0x8F, 8 },
- { 0x475, 11 },
- { 0x11D1, 13 },
- { 0x79, 7 },
- { 0x27, 6 },
- { 0x2, 3 },
- { 0x3, 3 },
- { 0x1, 4 },
- { 0x0, 4 },
- { 0x26, 6 },
- { 0x46, 7 },
- { 0x11C, 9 },
- { 0x477, 11 },
- { 0x8ED, 12 },
- { 0x11D0, 13 },
- { 0x11D3, 13 },
- { 0x11D2, 13 },
- { 0x11D9, 13 },
- { 0x11D8, 13 },
- { 0xD, 4 },
- { 0x1F, 5 },
- { 0x12, 5 },
- { 0x5, 5 },
- { 0x3D, 6 },
- { 0xC, 4 },
- { 0xE, 4 },
- { 0x22, 6 },
- { 0x78, 7 }
- },
- { /* AC bias group 3, table 12 */
- { 0x5, 3 },
- { 0xC, 4 },
- { 0x1B, 5 },
- { 0x0, 4 },
- { 0x6, 6 },
- { 0x3E2, 10 },
- { 0x3E3D, 14 },
- { 0xF, 7 },
- { 0x34, 6 },
- { 0x3, 3 },
- { 0x2, 3 },
- { 0x1E, 5 },
- { 0x1D, 5 },
- { 0x7D, 7 },
- { 0x1F0, 9 },
- { 0x7C6, 11 },
- { 0x3E3C, 14 },
- { 0x3E3F, 14 },
- { 0x3E3E, 14 },
- { 0x3E39, 14 },
- { 0x3E38, 14 },
- { 0x3E3B, 14 },
- { 0x3E3A, 14 },
- { 0x8, 4 },
- { 0x1C, 5 },
- { 0x2, 5 },
- { 0x3F, 6 },
- { 0x35, 6 },
- { 0x9, 4 },
- { 0x1, 3 },
- { 0xE, 7 },
- { 0xF9, 8 }
- },
- { /* AC bias group 3, table 13 */
- { 0x4, 3 },
- { 0xB, 4 },
- { 0x1, 4 },
- { 0xA, 4 },
- { 0x1E, 6 },
- { 0xE0, 9 },
- { 0xE1E, 13 },
- { 0x71, 8 },
- { 0x39, 7 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0xD, 5 },
- { 0xC, 5 },
- { 0x20, 7 },
- { 0x1C2, 10 },
- { 0x1C3F, 14 },
- { 0x1C3E, 14 },
- { 0xE19, 13 },
- { 0xE18, 13 },
- { 0xE1B, 13 },
- { 0xE1A, 13 },
- { 0xE1D, 13 },
- { 0xE1C, 13 },
- { 0x0, 4 },
- { 0x9, 5 },
- { 0x1D, 6 },
- { 0x1F, 6 },
- { 0x11, 6 },
- { 0x5, 4 },
- { 0x1, 3 },
- { 0x43, 8 },
- { 0x42, 8 }
- },
- { /* AC bias group 3, table 14 */
- { 0x4, 3 },
- { 0xD, 4 },
- { 0x7, 4 },
- { 0x2, 3 },
- { 0x14, 5 },
- { 0x16C, 9 },
- { 0x16D1, 13 },
- { 0x2DF, 10 },
- { 0x16E, 9 },
- { 0x0, 2 },
- { 0x7, 3 },
- { 0x2C, 6 },
- { 0x2B, 6 },
- { 0x2DE, 10 },
- { 0x16D0, 13 },
- { 0x16D3, 13 },
- { 0x16D2, 13 },
- { 0x2DB5, 14 },
- { 0x2DB4, 14 },
- { 0x2DB7, 14 },
- { 0x2DB6, 14 },
- { 0x16D9, 13 },
- { 0x16D8, 13 },
- { 0xC, 5 },
- { 0x2A, 6 },
- { 0x5A, 7 },
- { 0x1B, 6 },
- { 0x1A, 6 },
- { 0x17, 5 },
- { 0xC, 4 },
- { 0x5B7, 11 },
- { 0x5B5, 11 }
- },
- { /* AC bias group 3, table 15 */
- { 0x2, 2 },
- { 0xF, 4 },
- { 0x1C, 5 },
- { 0xC, 4 },
- { 0x3B, 6 },
- { 0x1AC, 9 },
- { 0x1AD8, 13 },
- { 0x35B3, 14 },
- { 0x35B2, 14 },
- { 0x1, 2 },
- { 0x0, 2 },
- { 0x69, 7 },
- { 0x68, 7 },
- { 0x35BD, 14 },
- { 0x35BC, 14 },
- { 0x35BF, 14 },
- { 0x35BE, 14 },
- { 0x35B9, 14 },
- { 0x35B8, 14 },
- { 0x35BB, 14 },
- { 0x35BA, 14 },
- { 0x35B5, 14 },
- { 0x35B4, 14 },
- { 0x1A9, 9 },
- { 0x1A8, 9 },
- { 0x35A, 10 },
- { 0xD7, 8 },
- { 0xD5, 8 },
- { 0x3A, 6 },
- { 0x1B, 5 },
- { 0x35B7, 14 },
- { 0x35B6, 14 }
- }
+static const uint16_t ac_bias_2[16][32][2] = {
+ { /* AC bias group 3, table 0 */
+ { 0x3, 4 },
+ { 0x9, 6 },
+ { 0xD0, 8 },
+ { 0x1A3, 9 },
+ { 0x344, 10 },
+ { 0xD14, 12 },
+ { 0x1A2B, 13 },
+ { 0x4, 4 },
+ { 0x15, 7 },
+ { 0x0, 3 },
+ { 0xF, 4 },
+ { 0xB, 4 },
+ { 0xC, 4 },
+ { 0xE, 4 },
+ { 0x9, 4 },
+ { 0x1B, 5 },
+ { 0xA, 5 },
+ { 0x14, 5 },
+ { 0xD, 5 },
+ { 0x2A, 6 },
+ { 0x14, 7 },
+ { 0x68B, 11 },
+ { 0x1A2A, 13 },
+ { 0x8, 4 },
+ { 0xB, 5 },
+ { 0x2B, 6 },
+ { 0xB, 6 },
+ { 0x69, 7 },
+ { 0x35, 6 },
+ { 0x8, 6 },
+ { 0x7, 4 },
+ { 0xC, 5 }
+ },
+ { /* AC bias group 3, table 1 */
+ { 0xA, 4 },
+ { 0x3C, 6 },
+ { 0x32, 7 },
+ { 0x30, 7 },
+ { 0xC5, 9 },
+ { 0x621, 12 },
+ { 0x620, 12 },
+ { 0x1F, 5 },
+ { 0x33, 7 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xE, 4 },
+ { 0xD, 4 },
+ { 0xC, 4 },
+ { 0x4, 4 },
+ { 0xD, 5 },
+ { 0x26, 6 },
+ { 0x27, 6 },
+ { 0x14, 6 },
+ { 0x63, 8 },
+ { 0x189, 10 },
+ { 0x623, 12 },
+ { 0x622, 12 },
+ { 0xB, 4 },
+ { 0x12, 5 },
+ { 0x3D, 6 },
+ { 0x22, 6 },
+ { 0x15, 6 },
+ { 0xB, 5 },
+ { 0x23, 6 },
+ { 0x7, 4 },
+ { 0x10, 5 }
+ },
+ { /* AC bias group 3, table 2 */
+ { 0xF, 4 },
+ { 0xC, 5 },
+ { 0x43, 7 },
+ { 0x10, 6 },
+ { 0x44, 8 },
+ { 0x114, 10 },
+ { 0x455, 12 },
+ { 0x18, 5 },
+ { 0x23, 7 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xE, 4 },
+ { 0xD, 4 },
+ { 0x9, 4 },
+ { 0x19, 5 },
+ { 0x9, 5 },
+ { 0x17, 6 },
+ { 0x16, 6 },
+ { 0x42, 7 },
+ { 0x8B, 9 },
+ { 0x454, 12 },
+ { 0x457, 12 },
+ { 0x456, 12 },
+ { 0xB, 4 },
+ { 0x15, 5 },
+ { 0xA, 5 },
+ { 0x29, 6 },
+ { 0x20, 6 },
+ { 0xD, 5 },
+ { 0x28, 6 },
+ { 0x7, 4 },
+ { 0x11, 5 }
+ },
+ { /* AC bias group 3, table 3 */
+ { 0x1, 3 },
+ { 0x1A, 5 },
+ { 0x29, 6 },
+ { 0x2A, 6 },
+ { 0xA0, 8 },
+ { 0x285, 10 },
+ { 0x1425, 13 },
+ { 0x2, 5 },
+ { 0x0, 7 },
+ { 0x2, 3 },
+ { 0x3, 3 },
+ { 0xC, 4 },
+ { 0xB, 4 },
+ { 0x8, 4 },
+ { 0x12, 5 },
+ { 0x1, 6 },
+ { 0x51, 7 },
+ { 0x1, 7 },
+ { 0x143, 9 },
+ { 0x508, 11 },
+ { 0x1424, 13 },
+ { 0x1427, 13 },
+ { 0x1426, 13 },
+ { 0xF, 4 },
+ { 0x1C, 5 },
+ { 0x3, 5 },
+ { 0x37, 6 },
+ { 0x2B, 6 },
+ { 0x13, 5 },
+ { 0x36, 6 },
+ { 0x1D, 5 },
+ { 0x1, 5 }
+ },
+ { /* AC bias group 3, table 4 */
+ { 0x4, 3 },
+ { 0x1F, 5 },
+ { 0x3D, 6 },
+ { 0x6, 5 },
+ { 0x16, 7 },
+ { 0x53, 9 },
+ { 0x14A, 11 },
+ { 0x34, 6 },
+ { 0x2A, 8 },
+ { 0x2, 3 },
+ { 0x3, 3 },
+ { 0xB, 4 },
+ { 0xC, 4 },
+ { 0x1C, 5 },
+ { 0x37, 6 },
+ { 0x17, 7 },
+ { 0x2B, 8 },
+ { 0x28, 8 },
+ { 0xA4, 10 },
+ { 0x52D, 13 },
+ { 0x52C, 13 },
+ { 0x52F, 13 },
+ { 0x52E, 13 },
+ { 0x0, 3 },
+ { 0x1D, 5 },
+ { 0x7, 5 },
+ { 0x4, 5 },
+ { 0x35, 6 },
+ { 0x14, 5 },
+ { 0x36, 6 },
+ { 0x15, 5 },
+ { 0x3C, 6 }
+ },
+ { /* AC bias group 3, table 5 */
+ { 0x4, 3 },
+ { 0xA, 4 },
+ { 0x7, 5 },
+ { 0x1D, 5 },
+ { 0x9, 6 },
+ { 0x1F3, 9 },
+ { 0x7C7, 11 },
+ { 0x8, 6 },
+ { 0x1F0, 9 },
+ { 0x3, 3 },
+ { 0x2, 3 },
+ { 0xD, 4 },
+ { 0xC, 4 },
+ { 0x17, 5 },
+ { 0x7D, 7 },
+ { 0x1F2, 9 },
+ { 0x7C6, 11 },
+ { 0x7C5, 11 },
+ { 0x1F12, 13 },
+ { 0x3E27, 14 },
+ { 0x3E26, 14 },
+ { 0x1F11, 13 },
+ { 0x1F10, 13 },
+ { 0x0, 3 },
+ { 0x1E, 5 },
+ { 0x6, 5 },
+ { 0x39, 6 },
+ { 0x38, 6 },
+ { 0x3F, 6 },
+ { 0x2C, 6 },
+ { 0x5, 5 },
+ { 0x2D, 6 }
+ },
+ { /* AC bias group 3, table 6 */
+ { 0x2, 3 },
+ { 0x7, 4 },
+ { 0x18, 5 },
+ { 0x3, 4 },
+ { 0x5, 5 },
+ { 0x35, 7 },
+ { 0x4F, 9 },
+ { 0x12, 7 },
+ { 0x4E5, 13 },
+ { 0x5, 3 },
+ { 0x4, 3 },
+ { 0xD, 4 },
+ { 0xE, 4 },
+ { 0x33, 6 },
+ { 0x26, 8 },
+ { 0x9D, 10 },
+ { 0x4E4, 13 },
+ { 0x4E7, 13 },
+ { 0x4E6, 13 },
+ { 0x4E1, 13 },
+ { 0x4E0, 13 },
+ { 0x4E3, 13 },
+ { 0x4E2, 13 },
+ { 0x0, 3 },
+ { 0x1F, 5 },
+ { 0xC, 5 },
+ { 0x3D, 6 },
+ { 0x3C, 6 },
+ { 0x32, 6 },
+ { 0x34, 7 },
+ { 0x1B, 6 },
+ { 0x8, 6 }
+ },
+ { /* AC bias group 3, table 7 */
+ { 0x0, 3 },
+ { 0x4, 4 },
+ { 0x1C, 5 },
+ { 0xF, 4 },
+ { 0x2, 4 },
+ { 0x7, 5 },
+ { 0x75, 7 },
+ { 0xE8, 8 },
+ { 0x1D2A, 13 },
+ { 0x5, 3 },
+ { 0x4, 3 },
+ { 0xD, 4 },
+ { 0xC, 4 },
+ { 0x77, 7 },
+ { 0xE96, 12 },
+ { 0x3A57, 14 },
+ { 0x3A56, 14 },
+ { 0x3A5D, 14 },
+ { 0x3A5C, 14 },
+ { 0x3A5F, 14 },
+ { 0x3A5E, 14 },
+ { 0x1D29, 13 },
+ { 0x1D28, 13 },
+ { 0x3, 3 },
+ { 0x6, 5 },
+ { 0xA, 5 },
+ { 0x2C, 7 },
+ { 0x17, 6 },
+ { 0x76, 7 },
+ { 0x1D3, 9 },
+ { 0x3A4, 10 },
+ { 0x2D, 7 }
+ },
+ { /* AC bias group 3, table 8 */
+ { 0xA, 4 },
+ { 0x24, 6 },
+ { 0xBF, 8 },
+ { 0x85, 8 },
+ { 0x211, 10 },
+ { 0x842, 12 },
+ { 0x1087, 13 },
+ { 0x18, 5 },
+ { 0x20, 6 },
+ { 0x1, 3 },
+ { 0x2, 3 },
+ { 0xE, 4 },
+ { 0xD, 4 },
+ { 0x7, 4 },
+ { 0x13, 5 },
+ { 0x25, 6 },
+ { 0x5E, 7 },
+ { 0x43, 7 },
+ { 0xBE, 8 },
+ { 0x109, 9 },
+ { 0x1086, 13 },
+ { 0x841, 12 },
+ { 0x840, 12 },
+ { 0xF, 4 },
+ { 0x1, 4 },
+ { 0x11, 5 },
+ { 0x0, 5 },
+ { 0x2E, 6 },
+ { 0x19, 5 },
+ { 0x1, 5 },
+ { 0x6, 4 },
+ { 0x16, 5 }
+ },
+ { /* AC bias group 3, table 9 */
+ { 0x2, 3 },
+ { 0xF, 5 },
+ { 0x6F, 7 },
+ { 0x61, 7 },
+ { 0x374, 10 },
+ { 0x1BA8, 13 },
+ { 0x3753, 14 },
+ { 0x12, 5 },
+ { 0x36, 6 },
+ { 0x0, 3 },
+ { 0x1, 3 },
+ { 0xA, 4 },
+ { 0xB, 4 },
+ { 0x1A, 5 },
+ { 0x31, 6 },
+ { 0x60, 7 },
+ { 0xDC, 8 },
+ { 0x1BB, 9 },
+ { 0x6EB, 11 },
+ { 0x1BAB, 13 },
+ { 0x3752, 14 },
+ { 0x3755, 14 },
+ { 0x3754, 14 },
+ { 0xE, 4 },
+ { 0x6, 4 },
+ { 0x13, 5 },
+ { 0xE, 5 },
+ { 0x3E, 6 },
+ { 0x8, 4 },
+ { 0x1E, 5 },
+ { 0x19, 5 },
+ { 0x3F, 6 }
+ },
+ { /* AC bias group 3, table 10 */
+ { 0x3, 3 },
+ { 0x1C, 5 },
+ { 0x25, 6 },
+ { 0x24, 6 },
+ { 0x1DA, 9 },
+ { 0x1DBD, 13 },
+ { 0x3B7C, 14 },
+ { 0x3C, 6 },
+ { 0x3D, 6 },
+ { 0x0, 3 },
+ { 0x1, 3 },
+ { 0xB, 4 },
+ { 0xA, 4 },
+ { 0xB, 5 },
+ { 0x77, 7 },
+ { 0xEC, 8 },
+ { 0x3B6, 10 },
+ { 0x76E, 11 },
+ { 0x1DBF, 13 },
+ { 0x76FB, 15 },
+ { 0x76FA, 15 },
+ { 0x3B79, 14 },
+ { 0x3B78, 14 },
+ { 0xD, 4 },
+ { 0x1F, 5 },
+ { 0x13, 5 },
+ { 0xA, 5 },
+ { 0x8, 5 },
+ { 0xC, 4 },
+ { 0x8, 4 },
+ { 0x9, 5 },
+ { 0x3A, 6 }
+ },
+ { /* AC bias group 3, table 11 */
+ { 0x5, 3 },
+ { 0x3, 4 },
+ { 0x4, 5 },
+ { 0x10, 5 },
+ { 0x8F, 8 },
+ { 0x475, 11 },
+ { 0x11D1, 13 },
+ { 0x79, 7 },
+ { 0x27, 6 },
+ { 0x2, 3 },
+ { 0x3, 3 },
+ { 0x1, 4 },
+ { 0x0, 4 },
+ { 0x26, 6 },
+ { 0x46, 7 },
+ { 0x11C, 9 },
+ { 0x477, 11 },
+ { 0x8ED, 12 },
+ { 0x11D0, 13 },
+ { 0x11D3, 13 },
+ { 0x11D2, 13 },
+ { 0x11D9, 13 },
+ { 0x11D8, 13 },
+ { 0xD, 4 },
+ { 0x1F, 5 },
+ { 0x12, 5 },
+ { 0x5, 5 },
+ { 0x3D, 6 },
+ { 0xC, 4 },
+ { 0xE, 4 },
+ { 0x22, 6 },
+ { 0x78, 7 }
+ },
+ { /* AC bias group 3, table 12 */
+ { 0x5, 3 },
+ { 0xC, 4 },
+ { 0x1B, 5 },
+ { 0x0, 4 },
+ { 0x6, 6 },
+ { 0x3E2, 10 },
+ { 0x3E3D, 14 },
+ { 0xF, 7 },
+ { 0x34, 6 },
+ { 0x3, 3 },
+ { 0x2, 3 },
+ { 0x1E, 5 },
+ { 0x1D, 5 },
+ { 0x7D, 7 },
+ { 0x1F0, 9 },
+ { 0x7C6, 11 },
+ { 0x3E3C, 14 },
+ { 0x3E3F, 14 },
+ { 0x3E3E, 14 },
+ { 0x3E39, 14 },
+ { 0x3E38, 14 },
+ { 0x3E3B, 14 },
+ { 0x3E3A, 14 },
+ { 0x8, 4 },
+ { 0x1C, 5 },
+ { 0x2, 5 },
+ { 0x3F, 6 },
+ { 0x35, 6 },
+ { 0x9, 4 },
+ { 0x1, 3 },
+ { 0xE, 7 },
+ { 0xF9, 8 }
+ },
+ { /* AC bias group 3, table 13 */
+ { 0x4, 3 },
+ { 0xB, 4 },
+ { 0x1, 4 },
+ { 0xA, 4 },
+ { 0x1E, 6 },
+ { 0xE0, 9 },
+ { 0xE1E, 13 },
+ { 0x71, 8 },
+ { 0x39, 7 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0xD, 5 },
+ { 0xC, 5 },
+ { 0x20, 7 },
+ { 0x1C2, 10 },
+ { 0x1C3F, 14 },
+ { 0x1C3E, 14 },
+ { 0xE19, 13 },
+ { 0xE18, 13 },
+ { 0xE1B, 13 },
+ { 0xE1A, 13 },
+ { 0xE1D, 13 },
+ { 0xE1C, 13 },
+ { 0x0, 4 },
+ { 0x9, 5 },
+ { 0x1D, 6 },
+ { 0x1F, 6 },
+ { 0x11, 6 },
+ { 0x5, 4 },
+ { 0x1, 3 },
+ { 0x43, 8 },
+ { 0x42, 8 }
+ },
+ { /* AC bias group 3, table 14 */
+ { 0x4, 3 },
+ { 0xD, 4 },
+ { 0x7, 4 },
+ { 0x2, 3 },
+ { 0x14, 5 },
+ { 0x16C, 9 },
+ { 0x16D1, 13 },
+ { 0x2DF, 10 },
+ { 0x16E, 9 },
+ { 0x0, 2 },
+ { 0x7, 3 },
+ { 0x2C, 6 },
+ { 0x2B, 6 },
+ { 0x2DE, 10 },
+ { 0x16D0, 13 },
+ { 0x16D3, 13 },
+ { 0x16D2, 13 },
+ { 0x2DB5, 14 },
+ { 0x2DB4, 14 },
+ { 0x2DB7, 14 },
+ { 0x2DB6, 14 },
+ { 0x16D9, 13 },
+ { 0x16D8, 13 },
+ { 0xC, 5 },
+ { 0x2A, 6 },
+ { 0x5A, 7 },
+ { 0x1B, 6 },
+ { 0x1A, 6 },
+ { 0x17, 5 },
+ { 0xC, 4 },
+ { 0x5B7, 11 },
+ { 0x5B5, 11 }
+ },
+ { /* AC bias group 3, table 15 */
+ { 0x2, 2 },
+ { 0xF, 4 },
+ { 0x1C, 5 },
+ { 0xC, 4 },
+ { 0x3B, 6 },
+ { 0x1AC, 9 },
+ { 0x1AD8, 13 },
+ { 0x35B3, 14 },
+ { 0x35B2, 14 },
+ { 0x1, 2 },
+ { 0x0, 2 },
+ { 0x69, 7 },
+ { 0x68, 7 },
+ { 0x35BD, 14 },
+ { 0x35BC, 14 },
+ { 0x35BF, 14 },
+ { 0x35BE, 14 },
+ { 0x35B9, 14 },
+ { 0x35B8, 14 },
+ { 0x35BB, 14 },
+ { 0x35BA, 14 },
+ { 0x35B5, 14 },
+ { 0x35B4, 14 },
+ { 0x1A9, 9 },
+ { 0x1A8, 9 },
+ { 0x35A, 10 },
+ { 0xD7, 8 },
+ { 0xD5, 8 },
+ { 0x3A, 6 },
+ { 0x1B, 5 },
+ { 0x35B7, 14 },
+ { 0x35B6, 14 }
+ }
};
-static const uint16_t ac_bias_3[16][32][2] =
-{
- { /* AC bias group 4, table 0 */
- { 0x0, 3 },
- { 0x10, 5 },
- { 0x72, 7 },
- { 0x71, 7 },
- { 0x154, 9 },
- { 0xAAB, 12 },
- { 0xAA8, 12 },
- { 0x14, 5 },
- { 0x70, 7 },
- { 0x2, 3 },
- { 0x3, 3 },
- { 0xC, 4 },
- { 0xB, 4 },
- { 0x3, 4 },
- { 0x11, 5 },
- { 0x73, 7 },
- { 0x54, 7 },
- { 0xAB, 8 },
- { 0x2AB, 10 },
- { 0x1553, 13 },
- { 0x1552, 13 },
- { 0x1555, 13 },
- { 0x1554, 13 },
- { 0xD, 4 },
- { 0x1E, 5 },
- { 0x12, 5 },
- { 0x3E, 6 },
- { 0x2B, 6 },
- { 0x2, 4 },
- { 0x3F, 6 },
- { 0x1D, 5 },
- { 0x13, 5 }
- },
- { /* AC bias group 4, table 1 */
- { 0x3, 3 },
- { 0x1F, 5 },
- { 0x29, 6 },
- { 0x3D, 6 },
- { 0xC, 7 },
- { 0x69, 10 },
- { 0x345, 13 },
- { 0x2, 5 },
- { 0x28, 6 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0xE, 4 },
- { 0xC, 4 },
- { 0x15, 5 },
- { 0x7, 6 },
- { 0x1B, 8 },
- { 0x6B, 10 },
- { 0x6A, 10 },
- { 0x344, 13 },
- { 0x347, 13 },
- { 0x346, 13 },
- { 0x1A1, 12 },
- { 0x1A0, 12 },
- { 0xB, 4 },
- { 0x1A, 5 },
- { 0x12, 5 },
- { 0x0, 5 },
- { 0x3C, 6 },
- { 0x8, 4 },
- { 0x1B, 5 },
- { 0x13, 5 },
- { 0x1, 5 }
- },
- { /* AC bias group 4, table 2 */
- { 0x4, 3 },
- { 0x4, 4 },
- { 0x3F, 6 },
- { 0x14, 5 },
- { 0x56, 7 },
- { 0x15C, 9 },
- { 0x15D5, 13 },
- { 0x3C, 6 },
- { 0x2A, 6 },
- { 0x0, 3 },
- { 0x1, 3 },
- { 0xE, 4 },
- { 0xD, 4 },
- { 0xC, 5 },
- { 0xAF, 8 },
- { 0x2BB, 10 },
- { 0x15D4, 13 },
- { 0x15D7, 13 },
- { 0x15D6, 13 },
- { 0x15D1, 13 },
- { 0x15D0, 13 },
- { 0x15D3, 13 },
- { 0x15D2, 13 },
- { 0xB, 4 },
- { 0x19, 5 },
- { 0xD, 5 },
- { 0x3E, 6 },
- { 0x31, 6 },
- { 0x7, 4 },
- { 0x5, 4 },
- { 0x3D, 6 },
- { 0x30, 6 }
- },
- { /* AC bias group 4, table 3 */
- { 0x5, 3 },
- { 0x8, 4 },
- { 0x1A, 5 },
- { 0x0, 4 },
- { 0x36, 6 },
- { 0x11, 8 },
- { 0x106, 12 },
- { 0xA, 7 },
- { 0x6E, 7 },
- { 0x2, 3 },
- { 0x3, 3 },
- { 0x3, 4 },
- { 0x2, 4 },
- { 0x6F, 7 },
- { 0x21, 9 },
- { 0x20F, 13 },
- { 0x20E, 13 },
- { 0x101, 12 },
- { 0x100, 12 },
- { 0x103, 12 },
- { 0x102, 12 },
- { 0x105, 12 },
- { 0x104, 12 },
- { 0xC, 4 },
- { 0x1E, 5 },
- { 0x3, 5 },
- { 0x3E, 6 },
- { 0x3F, 6 },
- { 0x9, 4 },
- { 0xE, 4 },
- { 0xB, 7 },
- { 0x9, 7 }
- },
- { /* AC bias group 4, table 4 */
- { 0x2, 3 },
- { 0xE, 4 },
- { 0x1E, 5 },
- { 0xC, 4 },
- { 0x1F, 5 },
- { 0x6E, 7 },
- { 0xAD, 10 },
- { 0xAF, 10 },
- { 0x14, 7 },
- { 0x4, 3 },
- { 0x3, 3 },
- { 0x1A, 5 },
- { 0x17, 5 },
- { 0x2A, 8 },
- { 0x576, 13 },
- { 0xAEF, 14 },
- { 0xAEE, 14 },
- { 0x571, 13 },
- { 0x570, 13 },
- { 0x573, 13 },
- { 0x572, 13 },
- { 0x575, 13 },
- { 0x574, 13 },
- { 0x3, 4 },
- { 0x16, 5 },
- { 0x4, 5 },
- { 0x36, 6 },
- { 0xB, 6 },
- { 0xA, 4 },
- { 0x0, 3 },
- { 0x6F, 7 },
- { 0xAC, 10 }
- },
- { /* AC bias group 4, table 5 */
- { 0x4, 3 },
- { 0x5, 4 },
- { 0x3, 3 },
- { 0x1, 3 },
- { 0x4, 4 },
- { 0x2F, 6 },
- { 0x526, 11 },
- { 0x1495, 13 },
- { 0xA6, 8 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0x2D, 6 },
- { 0x2C, 6 },
- { 0x1494, 13 },
- { 0x1497, 13 },
- { 0x1496, 13 },
- { 0x1491, 13 },
- { 0x1490, 13 },
- { 0x1493, 13 },
- { 0x1492, 13 },
- { 0x293D, 14 },
- { 0x293C, 14 },
- { 0x293F, 14 },
- { 0x0, 3 },
- { 0x28, 6 },
- { 0xA5, 8 },
- { 0x148, 9 },
- { 0xA7, 8 },
- { 0x2E, 6 },
- { 0x15, 5 },
- { 0xA4E, 12 },
- { 0x293E, 14 }
- },
- { /* AC bias group 4, table 6 */
- { 0x4, 3 },
- { 0x5, 4 },
- { 0x3, 3 },
- { 0x1, 3 },
- { 0x4, 4 },
- { 0x2F, 6 },
- { 0x526, 11 },
- { 0x1495, 13 },
- { 0xA6, 8 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0x2D, 6 },
- { 0x2C, 6 },
- { 0x1494, 13 },
- { 0x1497, 13 },
- { 0x1496, 13 },
- { 0x1491, 13 },
- { 0x1490, 13 },
- { 0x1493, 13 },
- { 0x1492, 13 },
- { 0x293D, 14 },
- { 0x293C, 14 },
- { 0x293F, 14 },
- { 0x0, 3 },
- { 0x28, 6 },
- { 0xA5, 8 },
- { 0x148, 9 },
- { 0xA7, 8 },
- { 0x2E, 6 },
- { 0x15, 5 },
- { 0xA4E, 12 },
- { 0x293E, 14 }
- },
- { /* AC bias group 4, table 7 */
- { 0x4, 3 },
- { 0x5, 4 },
- { 0x3, 3 },
- { 0x1, 3 },
- { 0x4, 4 },
- { 0x2F, 6 },
- { 0x526, 11 },
- { 0x1495, 13 },
- { 0xA6, 8 },
- { 0x7, 3 },
- { 0x6, 3 },
- { 0x2D, 6 },
- { 0x2C, 6 },
- { 0x1494, 13 },
- { 0x1497, 13 },
- { 0x1496, 13 },
- { 0x1491, 13 },
- { 0x1490, 13 },
- { 0x1493, 13 },
- { 0x1492, 13 },
- { 0x293D, 14 },
- { 0x293C, 14 },
- { 0x293F, 14 },
- { 0x0, 3 },
- { 0x28, 6 },
- { 0xA5, 8 },
- { 0x148, 9 },
- { 0xA7, 8 },
- { 0x2E, 6 },
- { 0x15, 5 },
- { 0xA4E, 12 },
- { 0x293E, 14 }
- },
- { /* AC bias group 4, table 8 */
- { 0x3, 3 },
- { 0x11, 5 },
- { 0x20, 6 },
- { 0x74, 7 },
- { 0x10D, 9 },
- { 0x863, 12 },
- { 0x860, 12 },
- { 0xA, 5 },
- { 0x75, 7 },
- { 0x1, 3 },
- { 0x0, 3 },
- { 0xB, 4 },
- { 0xA, 4 },
- { 0x18, 5 },
- { 0x38, 6 },
- { 0x42, 7 },
- { 0x10F, 9 },
- { 0x10E, 9 },
- { 0x219, 10 },
- { 0x10C3, 13 },
- { 0x10C2, 13 },
- { 0x10C5, 13 },
- { 0x10C4, 13 },
- { 0xF, 4 },
- { 0x4, 4 },
- { 0x19, 5 },
- { 0xB, 5 },
- { 0x39, 6 },
- { 0x9, 4 },
- { 0x1B, 5 },
- { 0x1A, 5 },
- { 0x3B, 6 }
- },
- { /* AC bias group 4, table 9 */
- { 0x5, 3 },
- { 0x1, 4 },
- { 0x3E, 6 },
- { 0x1, 5 },
- { 0xE2, 8 },
- { 0x1C6F, 13 },
- { 0x38D9, 14 },
- { 0x39, 6 },
- { 0x1F, 6 },
- { 0x2, 3 },
- { 0x1, 3 },
- { 0x9, 4 },
- { 0x8, 4 },
- { 0x0, 5 },
- { 0x70, 7 },
- { 0x1C7, 9 },
- { 0x38C, 10 },
- { 0x71A, 11 },
- { 0x38D8, 14 },
- { 0x38DB, 14 },
- { 0x38DA, 14 },
- { 0x38DD, 14 },
- { 0x38DC, 14 },
- { 0xD, 4 },
- { 0x1D, 5 },
- { 0xE, 5 },
- { 0x3F, 6 },
- { 0x3C, 6 },
- { 0xC, 4 },
- { 0x6, 4 },
- { 0x3D, 6 },
- { 0x1E, 6 }
- },
- { /* AC bias group 4, table 10 */
- { 0x6, 3 },
- { 0xB, 4 },
- { 0x11, 5 },
- { 0x1E, 5 },
- { 0x74, 7 },
- { 0x3AA, 10 },
- { 0x1D5C, 13 },
- { 0x1, 6 },
- { 0x21, 6 },
- { 0x1, 3 },
- { 0x2, 3 },
- { 0x7, 4 },
- { 0x6, 4 },
- { 0x3E, 6 },
- { 0xEB, 8 },
- { 0x1D4, 9 },
- { 0xEAF, 12 },
- { 0x3ABB, 14 },
- { 0x3ABA, 14 },
- { 0x1D59, 13 },
- { 0x1D58, 13 },
- { 0x1D5B, 13 },
- { 0x1D5A, 13 },
- { 0xA, 4 },
- { 0x1C, 5 },
- { 0x1, 5 },
- { 0x3F, 6 },
- { 0x3B, 6 },
- { 0x1, 4 },
- { 0x9, 4 },
- { 0x20, 6 },
- { 0x0, 6 }
- },
- { /* AC bias group 4, table 11 */
- { 0x4, 3 },
- { 0xA, 4 },
- { 0x17, 5 },
- { 0x4, 4 },
- { 0x16, 6 },
- { 0x16A, 9 },
- { 0x16B1, 13 },
- { 0x17, 7 },
- { 0x5B, 7 },
- { 0x6, 3 },
- { 0x7, 3 },
- { 0x1, 4 },
- { 0x0, 4 },
- { 0xA, 6 },
- { 0x2D7, 10 },
- { 0xB5A, 12 },
- { 0x16B0, 13 },
- { 0x16B3, 13 },
- { 0x16B2, 13 },
- { 0x2D6D, 14 },
- { 0x2D6C, 14 },
- { 0x2D6F, 14 },
- { 0x2D6E, 14 },
- { 0x6, 4 },
- { 0xA, 5 },
- { 0x4, 5 },
- { 0x2C, 6 },
- { 0x17, 6 },
- { 0x3, 4 },
- { 0x7, 4 },
- { 0x16, 7 },
- { 0xB4, 8 }
- },
- { /* AC bias group 4, table 12 */
- { 0x5, 3 },
- { 0xD, 4 },
- { 0x5, 4 },
- { 0x9, 4 },
- { 0x33, 6 },
- { 0x193, 9 },
- { 0x192C, 13 },
- { 0x61, 8 },
- { 0x31, 7 },
- { 0x0, 2 },
- { 0x7, 3 },
- { 0x10, 5 },
- { 0x11, 5 },
- { 0xC8, 8 },
- { 0x192F, 13 },
- { 0x325B, 14 },
- { 0x325A, 14 },
- { 0x1929, 13 },
- { 0x1928, 13 },
- { 0x192B, 13 },
- { 0x192A, 13 },
- { 0x325D, 14 },
- { 0x325C, 14 },
- { 0x18, 5 },
- { 0x1A, 6 },
- { 0x1B, 6 },
- { 0x65, 7 },
- { 0x19, 6 },
- { 0x4, 4 },
- { 0x7, 4 },
- { 0x60, 8 },
- { 0x324, 10 }
- },
- { /* AC bias group 4, table 13 */
- { 0x6, 3 },
- { 0x0, 3 },
- { 0x2, 4 },
- { 0xF, 4 },
- { 0x39, 6 },
- { 0x1D9, 9 },
- { 0x1D82, 13 },
- { 0x761, 11 },
- { 0x3BE, 10 },
- { 0x1, 2 },
- { 0x2, 2 },
- { 0xF, 6 },
- { 0xE, 6 },
- { 0x762, 11 },
- { 0x3B07, 14 },
- { 0x3B06, 14 },
- { 0x3B1D, 14 },
- { 0x3B1C, 14 },
- { 0x3B1F, 14 },
- { 0x3B1E, 14 },
- { 0x3B19, 14 },
- { 0x3B18, 14 },
- { 0x3B1B, 14 },
- { 0x38, 6 },
- { 0x1DE, 9 },
- { 0xED, 8 },
- { 0x3BF, 10 },
- { 0xEE, 8 },
- { 0x3A, 6 },
- { 0x6, 5 },
- { 0xEC0, 12 },
- { 0x3B1A, 14 }
- },
- { /* AC bias group 4, table 14 */
- { 0x0, 2 },
- { 0x2, 3 },
- { 0xF, 5 },
- { 0x6, 4 },
- { 0x1C, 6 },
- { 0x1D0, 10 },
- { 0xE8C, 13 },
- { 0x1D1B, 14 },
- { 0x1D1A, 14 },
- { 0x3, 2 },
- { 0x2, 2 },
- { 0xEA, 9 },
- { 0xE9, 9 },
- { 0xE89, 13 },
- { 0xE88, 13 },
- { 0xE8B, 13 },
- { 0xE8A, 13 },
- { 0x1D65, 14 },
- { 0x1D64, 14 },
- { 0x1D67, 14 },
- { 0x1D66, 14 },
- { 0x1D61, 14 },
- { 0x1D60, 14 },
- { 0x3AD, 11 },
- { 0x1D63, 14 },
- { 0x1D62, 14 },
- { 0x1D1D, 14 },
- { 0x1D1C, 14 },
- { 0x3B, 7 },
- { 0x1D7, 10 },
- { 0x1D1F, 14 },
- { 0x1D1E, 14 }
- },
- { /* AC bias group 4, table 15 */
- { 0x2, 2 },
- { 0xF, 4 },
- { 0x1C, 5 },
- { 0xC, 4 },
- { 0x3B, 6 },
- { 0x1AC, 9 },
- { 0x1AD8, 13 },
- { 0x35B3, 14 },
- { 0x35B2, 14 },
- { 0x1, 2 },
- { 0x0, 2 },
- { 0x69, 7 },
- { 0x68, 7 },
- { 0x35BD, 14 },
- { 0x35BC, 14 },
- { 0x35BF, 14 },
- { 0x35BE, 14 },
- { 0x35B9, 14 },
- { 0x35B8, 14 },
- { 0x35BB, 14 },
- { 0x35BA, 14 },
- { 0x35B5, 14 },
- { 0x35B4, 14 },
- { 0x1A9, 9 },
- { 0x1A8, 9 },
- { 0x35A, 10 },
- { 0xD7, 8 },
- { 0xD5, 8 },
- { 0x3A, 6 },
- { 0x1B, 5 },
- { 0x35B7, 14 },
- { 0x35B6, 14 }
- }
+static const uint16_t ac_bias_3[16][32][2] = {
+ { /* AC bias group 4, table 0 */
+ { 0x0, 3 },
+ { 0x10, 5 },
+ { 0x72, 7 },
+ { 0x71, 7 },
+ { 0x154, 9 },
+ { 0xAAB, 12 },
+ { 0xAA8, 12 },
+ { 0x14, 5 },
+ { 0x70, 7 },
+ { 0x2, 3 },
+ { 0x3, 3 },
+ { 0xC, 4 },
+ { 0xB, 4 },
+ { 0x3, 4 },
+ { 0x11, 5 },
+ { 0x73, 7 },
+ { 0x54, 7 },
+ { 0xAB, 8 },
+ { 0x2AB, 10 },
+ { 0x1553, 13 },
+ { 0x1552, 13 },
+ { 0x1555, 13 },
+ { 0x1554, 13 },
+ { 0xD, 4 },
+ { 0x1E, 5 },
+ { 0x12, 5 },
+ { 0x3E, 6 },
+ { 0x2B, 6 },
+ { 0x2, 4 },
+ { 0x3F, 6 },
+ { 0x1D, 5 },
+ { 0x13, 5 }
+ },
+ { /* AC bias group 4, table 1 */
+ { 0x3, 3 },
+ { 0x1F, 5 },
+ { 0x29, 6 },
+ { 0x3D, 6 },
+ { 0xC, 7 },
+ { 0x69, 10 },
+ { 0x345, 13 },
+ { 0x2, 5 },
+ { 0x28, 6 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0xE, 4 },
+ { 0xC, 4 },
+ { 0x15, 5 },
+ { 0x7, 6 },
+ { 0x1B, 8 },
+ { 0x6B, 10 },
+ { 0x6A, 10 },
+ { 0x344, 13 },
+ { 0x347, 13 },
+ { 0x346, 13 },
+ { 0x1A1, 12 },
+ { 0x1A0, 12 },
+ { 0xB, 4 },
+ { 0x1A, 5 },
+ { 0x12, 5 },
+ { 0x0, 5 },
+ { 0x3C, 6 },
+ { 0x8, 4 },
+ { 0x1B, 5 },
+ { 0x13, 5 },
+ { 0x1, 5 }
+ },
+ { /* AC bias group 4, table 2 */
+ { 0x4, 3 },
+ { 0x4, 4 },
+ { 0x3F, 6 },
+ { 0x14, 5 },
+ { 0x56, 7 },
+ { 0x15C, 9 },
+ { 0x15D5, 13 },
+ { 0x3C, 6 },
+ { 0x2A, 6 },
+ { 0x0, 3 },
+ { 0x1, 3 },
+ { 0xE, 4 },
+ { 0xD, 4 },
+ { 0xC, 5 },
+ { 0xAF, 8 },
+ { 0x2BB, 10 },
+ { 0x15D4, 13 },
+ { 0x15D7, 13 },
+ { 0x15D6, 13 },
+ { 0x15D1, 13 },
+ { 0x15D0, 13 },
+ { 0x15D3, 13 },
+ { 0x15D2, 13 },
+ { 0xB, 4 },
+ { 0x19, 5 },
+ { 0xD, 5 },
+ { 0x3E, 6 },
+ { 0x31, 6 },
+ { 0x7, 4 },
+ { 0x5, 4 },
+ { 0x3D, 6 },
+ { 0x30, 6 }
+ },
+ { /* AC bias group 4, table 3 */
+ { 0x5, 3 },
+ { 0x8, 4 },
+ { 0x1A, 5 },
+ { 0x0, 4 },
+ { 0x36, 6 },
+ { 0x11, 8 },
+ { 0x106, 12 },
+ { 0xA, 7 },
+ { 0x6E, 7 },
+ { 0x2, 3 },
+ { 0x3, 3 },
+ { 0x3, 4 },
+ { 0x2, 4 },
+ { 0x6F, 7 },
+ { 0x21, 9 },
+ { 0x20F, 13 },
+ { 0x20E, 13 },
+ { 0x101, 12 },
+ { 0x100, 12 },
+ { 0x103, 12 },
+ { 0x102, 12 },
+ { 0x105, 12 },
+ { 0x104, 12 },
+ { 0xC, 4 },
+ { 0x1E, 5 },
+ { 0x3, 5 },
+ { 0x3E, 6 },
+ { 0x3F, 6 },
+ { 0x9, 4 },
+ { 0xE, 4 },
+ { 0xB, 7 },
+ { 0x9, 7 }
+ },
+ { /* AC bias group 4, table 4 */
+ { 0x2, 3 },
+ { 0xE, 4 },
+ { 0x1E, 5 },
+ { 0xC, 4 },
+ { 0x1F, 5 },
+ { 0x6E, 7 },
+ { 0xAD, 10 },
+ { 0xAF, 10 },
+ { 0x14, 7 },
+ { 0x4, 3 },
+ { 0x3, 3 },
+ { 0x1A, 5 },
+ { 0x17, 5 },
+ { 0x2A, 8 },
+ { 0x576, 13 },
+ { 0xAEF, 14 },
+ { 0xAEE, 14 },
+ { 0x571, 13 },
+ { 0x570, 13 },
+ { 0x573, 13 },
+ { 0x572, 13 },
+ { 0x575, 13 },
+ { 0x574, 13 },
+ { 0x3, 4 },
+ { 0x16, 5 },
+ { 0x4, 5 },
+ { 0x36, 6 },
+ { 0xB, 6 },
+ { 0xA, 4 },
+ { 0x0, 3 },
+ { 0x6F, 7 },
+ { 0xAC, 10 }
+ },
+ { /* AC bias group 4, table 5 */
+ { 0x4, 3 },
+ { 0x5, 4 },
+ { 0x3, 3 },
+ { 0x1, 3 },
+ { 0x4, 4 },
+ { 0x2F, 6 },
+ { 0x526, 11 },
+ { 0x1495, 13 },
+ { 0xA6, 8 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0x2D, 6 },
+ { 0x2C, 6 },
+ { 0x1494, 13 },
+ { 0x1497, 13 },
+ { 0x1496, 13 },
+ { 0x1491, 13 },
+ { 0x1490, 13 },
+ { 0x1493, 13 },
+ { 0x1492, 13 },
+ { 0x293D, 14 },
+ { 0x293C, 14 },
+ { 0x293F, 14 },
+ { 0x0, 3 },
+ { 0x28, 6 },
+ { 0xA5, 8 },
+ { 0x148, 9 },
+ { 0xA7, 8 },
+ { 0x2E, 6 },
+ { 0x15, 5 },
+ { 0xA4E, 12 },
+ { 0x293E, 14 }
+ },
+ { /* AC bias group 4, table 6 */
+ { 0x4, 3 },
+ { 0x5, 4 },
+ { 0x3, 3 },
+ { 0x1, 3 },
+ { 0x4, 4 },
+ { 0x2F, 6 },
+ { 0x526, 11 },
+ { 0x1495, 13 },
+ { 0xA6, 8 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0x2D, 6 },
+ { 0x2C, 6 },
+ { 0x1494, 13 },
+ { 0x1497, 13 },
+ { 0x1496, 13 },
+ { 0x1491, 13 },
+ { 0x1490, 13 },
+ { 0x1493, 13 },
+ { 0x1492, 13 },
+ { 0x293D, 14 },
+ { 0x293C, 14 },
+ { 0x293F, 14 },
+ { 0x0, 3 },
+ { 0x28, 6 },
+ { 0xA5, 8 },
+ { 0x148, 9 },
+ { 0xA7, 8 },
+ { 0x2E, 6 },
+ { 0x15, 5 },
+ { 0xA4E, 12 },
+ { 0x293E, 14 }
+ },
+ { /* AC bias group 4, table 7 */
+ { 0x4, 3 },
+ { 0x5, 4 },
+ { 0x3, 3 },
+ { 0x1, 3 },
+ { 0x4, 4 },
+ { 0x2F, 6 },
+ { 0x526, 11 },
+ { 0x1495, 13 },
+ { 0xA6, 8 },
+ { 0x7, 3 },
+ { 0x6, 3 },
+ { 0x2D, 6 },
+ { 0x2C, 6 },
+ { 0x1494, 13 },
+ { 0x1497, 13 },
+ { 0x1496, 13 },
+ { 0x1491, 13 },
+ { 0x1490, 13 },
+ { 0x1493, 13 },
+ { 0x1492, 13 },
+ { 0x293D, 14 },
+ { 0x293C, 14 },
+ { 0x293F, 14 },
+ { 0x0, 3 },
+ { 0x28, 6 },
+ { 0xA5, 8 },
+ { 0x148, 9 },
+ { 0xA7, 8 },
+ { 0x2E, 6 },
+ { 0x15, 5 },
+ { 0xA4E, 12 },
+ { 0x293E, 14 }
+ },
+ { /* AC bias group 4, table 8 */
+ { 0x3, 3 },
+ { 0x11, 5 },
+ { 0x20, 6 },
+ { 0x74, 7 },
+ { 0x10D, 9 },
+ { 0x863, 12 },
+ { 0x860, 12 },
+ { 0xA, 5 },
+ { 0x75, 7 },
+ { 0x1, 3 },
+ { 0x0, 3 },
+ { 0xB, 4 },
+ { 0xA, 4 },
+ { 0x18, 5 },
+ { 0x38, 6 },
+ { 0x42, 7 },
+ { 0x10F, 9 },
+ { 0x10E, 9 },
+ { 0x219, 10 },
+ { 0x10C3, 13 },
+ { 0x10C2, 13 },
+ { 0x10C5, 13 },
+ { 0x10C4, 13 },
+ { 0xF, 4 },
+ { 0x4, 4 },
+ { 0x19, 5 },
+ { 0xB, 5 },
+ { 0x39, 6 },
+ { 0x9, 4 },
+ { 0x1B, 5 },
+ { 0x1A, 5 },
+ { 0x3B, 6 }
+ },
+ { /* AC bias group 4, table 9 */
+ { 0x5, 3 },
+ { 0x1, 4 },
+ { 0x3E, 6 },
+ { 0x1, 5 },
+ { 0xE2, 8 },
+ { 0x1C6F, 13 },
+ { 0x38D9, 14 },
+ { 0x39, 6 },
+ { 0x1F, 6 },
+ { 0x2, 3 },
+ { 0x1, 3 },
+ { 0x9, 4 },
+ { 0x8, 4 },
+ { 0x0, 5 },
+ { 0x70, 7 },
+ { 0x1C7, 9 },
+ { 0x38C, 10 },
+ { 0x71A, 11 },
+ { 0x38D8, 14 },
+ { 0x38DB, 14 },
+ { 0x38DA, 14 },
+ { 0x38DD, 14 },
+ { 0x38DC, 14 },
+ { 0xD, 4 },
+ { 0x1D, 5 },
+ { 0xE, 5 },
+ { 0x3F, 6 },
+ { 0x3C, 6 },
+ { 0xC, 4 },
+ { 0x6, 4 },
+ { 0x3D, 6 },
+ { 0x1E, 6 }
+ },
+ { /* AC bias group 4, table 10 */
+ { 0x6, 3 },
+ { 0xB, 4 },
+ { 0x11, 5 },
+ { 0x1E, 5 },
+ { 0x74, 7 },
+ { 0x3AA, 10 },
+ { 0x1D5C, 13 },
+ { 0x1, 6 },
+ { 0x21, 6 },
+ { 0x1, 3 },
+ { 0x2, 3 },
+ { 0x7, 4 },
+ { 0x6, 4 },
+ { 0x3E, 6 },
+ { 0xEB, 8 },
+ { 0x1D4, 9 },
+ { 0xEAF, 12 },
+ { 0x3ABB, 14 },
+ { 0x3ABA, 14 },
+ { 0x1D59, 13 },
+ { 0x1D58, 13 },
+ { 0x1D5B, 13 },
+ { 0x1D5A, 13 },
+ { 0xA, 4 },
+ { 0x1C, 5 },
+ { 0x1, 5 },
+ { 0x3F, 6 },
+ { 0x3B, 6 },
+ { 0x1, 4 },
+ { 0x9, 4 },
+ { 0x20, 6 },
+ { 0x0, 6 }
+ },
+ { /* AC bias group 4, table 11 */
+ { 0x4, 3 },
+ { 0xA, 4 },
+ { 0x17, 5 },
+ { 0x4, 4 },
+ { 0x16, 6 },
+ { 0x16A, 9 },
+ { 0x16B1, 13 },
+ { 0x17, 7 },
+ { 0x5B, 7 },
+ { 0x6, 3 },
+ { 0x7, 3 },
+ { 0x1, 4 },
+ { 0x0, 4 },
+ { 0xA, 6 },
+ { 0x2D7, 10 },
+ { 0xB5A, 12 },
+ { 0x16B0, 13 },
+ { 0x16B3, 13 },
+ { 0x16B2, 13 },
+ { 0x2D6D, 14 },
+ { 0x2D6C, 14 },
+ { 0x2D6F, 14 },
+ { 0x2D6E, 14 },
+ { 0x6, 4 },
+ { 0xA, 5 },
+ { 0x4, 5 },
+ { 0x2C, 6 },
+ { 0x17, 6 },
+ { 0x3, 4 },
+ { 0x7, 4 },
+ { 0x16, 7 },
+ { 0xB4, 8 }
+ },
+ { /* AC bias group 4, table 12 */
+ { 0x5, 3 },
+ { 0xD, 4 },
+ { 0x5, 4 },
+ { 0x9, 4 },
+ { 0x33, 6 },
+ { 0x193, 9 },
+ { 0x192C, 13 },
+ { 0x61, 8 },
+ { 0x31, 7 },
+ { 0x0, 2 },
+ { 0x7, 3 },
+ { 0x10, 5 },
+ { 0x11, 5 },
+ { 0xC8, 8 },
+ { 0x192F, 13 },
+ { 0x325B, 14 },
+ { 0x325A, 14 },
+ { 0x1929, 13 },
+ { 0x1928, 13 },
+ { 0x192B, 13 },
+ { 0x192A, 13 },
+ { 0x325D, 14 },
+ { 0x325C, 14 },
+ { 0x18, 5 },
+ { 0x1A, 6 },
+ { 0x1B, 6 },
+ { 0x65, 7 },
+ { 0x19, 6 },
+ { 0x4, 4 },
+ { 0x7, 4 },
+ { 0x60, 8 },
+ { 0x324, 10 }
+ },
+ { /* AC bias group 4, table 13 */
+ { 0x6, 3 },
+ { 0x0, 3 },
+ { 0x2, 4 },
+ { 0xF, 4 },
+ { 0x39, 6 },
+ { 0x1D9, 9 },
+ { 0x1D82, 13 },
+ { 0x761, 11 },
+ { 0x3BE, 10 },
+ { 0x1, 2 },
+ { 0x2, 2 },
+ { 0xF, 6 },
+ { 0xE, 6 },
+ { 0x762, 11 },
+ { 0x3B07, 14 },
+ { 0x3B06, 14 },
+ { 0x3B1D, 14 },
+ { 0x3B1C, 14 },
+ { 0x3B1F, 14 },
+ { 0x3B1E, 14 },
+ { 0x3B19, 14 },
+ { 0x3B18, 14 },
+ { 0x3B1B, 14 },
+ { 0x38, 6 },
+ { 0x1DE, 9 },
+ { 0xED, 8 },
+ { 0x3BF, 10 },
+ { 0xEE, 8 },
+ { 0x3A, 6 },
+ { 0x6, 5 },
+ { 0xEC0, 12 },
+ { 0x3B1A, 14 }
+ },
+ { /* AC bias group 4, table 14 */
+ { 0x0, 2 },
+ { 0x2, 3 },
+ { 0xF, 5 },
+ { 0x6, 4 },
+ { 0x1C, 6 },
+ { 0x1D0, 10 },
+ { 0xE8C, 13 },
+ { 0x1D1B, 14 },
+ { 0x1D1A, 14 },
+ { 0x3, 2 },
+ { 0x2, 2 },
+ { 0xEA, 9 },
+ { 0xE9, 9 },
+ { 0xE89, 13 },
+ { 0xE88, 13 },
+ { 0xE8B, 13 },
+ { 0xE8A, 13 },
+ { 0x1D65, 14 },
+ { 0x1D64, 14 },
+ { 0x1D67, 14 },
+ { 0x1D66, 14 },
+ { 0x1D61, 14 },
+ { 0x1D60, 14 },
+ { 0x3AD, 11 },
+ { 0x1D63, 14 },
+ { 0x1D62, 14 },
+ { 0x1D1D, 14 },
+ { 0x1D1C, 14 },
+ { 0x3B, 7 },
+ { 0x1D7, 10 },
+ { 0x1D1F, 14 },
+ { 0x1D1E, 14 }
+ },
+ { /* AC bias group 4, table 15 */
+ { 0x2, 2 },
+ { 0xF, 4 },
+ { 0x1C, 5 },
+ { 0xC, 4 },
+ { 0x3B, 6 },
+ { 0x1AC, 9 },
+ { 0x1AD8, 13 },
+ { 0x35B3, 14 },
+ { 0x35B2, 14 },
+ { 0x1, 2 },
+ { 0x0, 2 },
+ { 0x69, 7 },
+ { 0x68, 7 },
+ { 0x35BD, 14 },
+ { 0x35BC, 14 },
+ { 0x35BF, 14 },
+ { 0x35BE, 14 },
+ { 0x35B9, 14 },
+ { 0x35B8, 14 },
+ { 0x35BB, 14 },
+ { 0x35BA, 14 },
+ { 0x35B5, 14 },
+ { 0x35B4, 14 },
+ { 0x1A9, 9 },
+ { 0x1A8, 9 },
+ { 0x35A, 10 },
+ { 0xD7, 8 },
+ { 0xD5, 8 },
+ { 0x3A, 6 },
+ { 0x1B, 5 },
+ { 0x35B7, 14 },
+ { 0x35B6, 14 }
+ }
};
#endif /* AVCODEC_VP3DATA_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3dsp.c
index f3ff667fb..83d46e97f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3dsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp3dsp.c
@@ -49,11 +49,9 @@ static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int
int i;
/* Inverse DCT on the rows now */
- for(i = 0; i < 8; i++)
- {
+ for (i = 0; i < 8; i++) {
/* Check for non-zero values */
- if(ip[0] | ip[1] | ip[2] | ip[3] | ip[4] | ip[5] | ip[6] | ip[7])
- {
+ if ( ip[0] | ip[1] | ip[2] | ip[3] | ip[4] | ip[5] | ip[6] | ip[7] ) {
A = M(xC1S7, ip[1]) + M(xC7S1, ip[7]);
B = M(xC7S1, ip[1]) - M(xC1S7, ip[7]);
C = M(xC3S5, ip[3]) + M(xC5S3, ip[5]);
@@ -99,12 +97,10 @@ static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int
ip = input;
- for(i = 0; i < 8; i++)
- {
+ for ( i = 0; i < 8; i++) {
/* Check for non-zero values (bitwise or faster than ||) */
- if(ip[1 * 8] | ip[2 * 8] | ip[3 * 8] |
- ip[4 * 8] | ip[5 * 8] | ip[6 * 8] | ip[7 * 8])
- {
+ if ( ip[1 * 8] | ip[2 * 8] | ip[3 * 8] |
+ ip[4 * 8] | ip[5 * 8] | ip[6 * 8] | ip[7 * 8] ) {
A = M(xC1S7, ip[1*8]) + M(xC7S1, ip[7*8]);
B = M(xC7S1, ip[1*8]) - M(xC1S7, ip[7*8]);
@@ -120,10 +116,9 @@ static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int
E = M(xC4S4, (ip[0*8] + ip[4*8])) + 8;
F = M(xC4S4, (ip[0*8] - ip[4*8])) + 8;
- if(type == 1) //HACK
- {
- E += 16 * 128;
- F += 16 * 128;
+ if(type==1){ //HACK
+ E += 16*128;
+ F += 16*128;
}
G = M(xC2S6, ip[2*8]) + M(xC6S2, ip[6*8]);
@@ -139,79 +134,66 @@ static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int
Hd = Bd + H;
/* Final sequence of operations over-write original inputs. */
- if(type == 0)
- {
- ip[0*8] = (Gd + Cd) >> 4;
- ip[7*8] = (Gd - Cd) >> 4;
+ if(type==0){
+ ip[0*8] = (Gd + Cd ) >> 4;
+ ip[7*8] = (Gd - Cd ) >> 4;
- ip[1*8] = (Add + Hd) >> 4;
- ip[2*8] = (Add - Hd) >> 4;
+ ip[1*8] = (Add + Hd ) >> 4;
+ ip[2*8] = (Add - Hd ) >> 4;
- ip[3*8] = (Ed + Dd) >> 4;
- ip[4*8] = (Ed - Dd) >> 4;
+ ip[3*8] = (Ed + Dd ) >> 4;
+ ip[4*8] = (Ed - Dd ) >> 4;
- ip[5*8] = (Fd + Bdd) >> 4;
- ip[6*8] = (Fd - Bdd) >> 4;
- }
- else if(type == 1)
- {
- dst[0*stride] = cm[(Gd + Cd) >> 4];
- dst[7*stride] = cm[(Gd - Cd) >> 4];
+ ip[5*8] = (Fd + Bdd ) >> 4;
+ ip[6*8] = (Fd - Bdd ) >> 4;
+ }else if(type==1){
+ dst[0*stride] = cm[(Gd + Cd ) >> 4];
+ dst[7*stride] = cm[(Gd - Cd ) >> 4];
- dst[1*stride] = cm[(Add + Hd) >> 4];
- dst[2*stride] = cm[(Add - Hd) >> 4];
+ dst[1*stride] = cm[(Add + Hd ) >> 4];
+ dst[2*stride] = cm[(Add - Hd ) >> 4];
- dst[3*stride] = cm[(Ed + Dd) >> 4];
- dst[4*stride] = cm[(Ed - Dd) >> 4];
+ dst[3*stride] = cm[(Ed + Dd ) >> 4];
+ dst[4*stride] = cm[(Ed - Dd ) >> 4];
- dst[5*stride] = cm[(Fd + Bdd) >> 4];
- dst[6*stride] = cm[(Fd - Bdd) >> 4];
- }
- else
- {
- dst[0*stride] = cm[dst[0*stride] + ((Gd + Cd) >> 4)];
- dst[7*stride] = cm[dst[7*stride] + ((Gd - Cd) >> 4)];
+ dst[5*stride] = cm[(Fd + Bdd ) >> 4];
+ dst[6*stride] = cm[(Fd - Bdd ) >> 4];
+ }else{
+ dst[0*stride] = cm[dst[0*stride] + ((Gd + Cd ) >> 4)];
+ dst[7*stride] = cm[dst[7*stride] + ((Gd - Cd ) >> 4)];
- dst[1*stride] = cm[dst[1*stride] + ((Add + Hd) >> 4)];
- dst[2*stride] = cm[dst[2*stride] + ((Add - Hd) >> 4)];
+ dst[1*stride] = cm[dst[1*stride] + ((Add + Hd ) >> 4)];
+ dst[2*stride] = cm[dst[2*stride] + ((Add - Hd ) >> 4)];
- dst[3*stride] = cm[dst[3*stride] + ((Ed + Dd) >> 4)];
- dst[4*stride] = cm[dst[4*stride] + ((Ed - Dd) >> 4)];
+ dst[3*stride] = cm[dst[3*stride] + ((Ed + Dd ) >> 4)];
+ dst[4*stride] = cm[dst[4*stride] + ((Ed - Dd ) >> 4)];
- dst[5*stride] = cm[dst[5*stride] + ((Fd + Bdd) >> 4)];
- dst[6*stride] = cm[dst[6*stride] + ((Fd - Bdd) >> 4)];
+ dst[5*stride] = cm[dst[5*stride] + ((Fd + Bdd ) >> 4)];
+ dst[6*stride] = cm[dst[6*stride] + ((Fd - Bdd ) >> 4)];
}
- }
- else
- {
- if(type == 0)
- {
+ } else {
+ if(type==0){
ip[0*8] =
- ip[1*8] =
- ip[2*8] =
- ip[3*8] =
- ip[4*8] =
- ip[5*8] =
- ip[6*8] =
- ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift << 16))>>20);
- }
- else if(type == 1)
- {
- dst[0*stride] =
- dst[1*stride] =
- dst[2*stride] =
- dst[3*stride] =
- dst[4*stride] =
- dst[5*stride] =
- dst[6*stride] =
- dst[7*stride] = cm[128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift << 16))>>20)];
- }
- else
- {
- if(ip[0*8])
- {
- int v = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift << 16))>>20);
+ ip[1*8] =
+ ip[2*8] =
+ ip[3*8] =
+ ip[4*8] =
+ ip[5*8] =
+ ip[6*8] =
+ ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
+ }else if(type==1){
+ dst[0*stride]=
+ dst[1*stride]=
+ dst[2*stride]=
+ dst[3*stride]=
+ dst[4*stride]=
+ dst[5*stride]=
+ dst[6*stride]=
+ dst[7*stride]= cm[128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20)];
+ }else{
+ if(ip[0*8]){
+ int v= ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
dst[0*stride] = cm[dst[0*stride] + v];
dst[1*stride] = cm[dst[1*stride] + v];
dst[2*stride] = cm[dst[2*stride] + v];
@@ -229,18 +211,15 @@ static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int
}
}
-void ff_vp3_idct_c(DCTELEM *block/* align 16*/)
-{
+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*/)
-{
+void ff_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*/)
-{
+void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
idct(dest, line_size, block, 2);
}
@@ -248,13 +227,12 @@ void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_valu
{
unsigned char *end;
int filter_value;
- const int nstride = -stride;
+ const int nstride= -stride;
- for(end = first_pixel + 8; first_pixel < end; first_pixel++)
- {
+ for (end= first_pixel + 8; first_pixel < end; first_pixel++) {
filter_value =
(first_pixel[2 * nstride] - first_pixel[ stride])
- + 3 * (first_pixel[0 ] - first_pixel[nstride]);
+ +3*(first_pixel[0 ] - first_pixel[nstride]);
filter_value = bounding_values[(filter_value + 4) >> 3];
first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value);
first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value);
@@ -266,11 +244,10 @@ void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_valu
unsigned char *end;
int filter_value;
- for(end = first_pixel + 8 * stride; first_pixel != end; first_pixel += stride)
- {
+ for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) {
filter_value =
(first_pixel[-2] - first_pixel[ 1])
- + 3 * (first_pixel[ 0] - first_pixel[-1]);
+ +3*(first_pixel[ 0] - first_pixel[-1]);
filter_value = bounding_values[(filter_value + 4) >> 3];
first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value);
first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c
index 5d797163c..b8b7f9718 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c
@@ -43,14 +43,13 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);
vp56_rac_get(c);
vp56_init_dequant(s, vp56_rac_gets(c, 6));
- if(s->framep[VP56_FRAME_CURRENT]->key_frame)
+ if (s->framep[VP56_FRAME_CURRENT]->key_frame)
{
vp56_rac_gets(c, 8);
if(vp56_rac_gets(c, 5) > 5)
return 0;
vp56_rac_gets(c, 2);
- if(vp56_rac_get(c))
- {
+ if (vp56_rac_get(c)) {
av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
return 0;
}
@@ -59,15 +58,13 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
vp56_rac_gets(c, 8); /* number of displayed macroblock rows */
vp56_rac_gets(c, 8); /* number of displayed macroblock cols */
vp56_rac_gets(c, 2);
- if(!s->macroblocks || /* first frame */
- 16 * cols != s->avctx->coded_width ||
- 16 * rows != s->avctx->coded_height)
- {
- avcodec_set_dimensions(s->avctx, 16 * cols, 16 * rows);
+ if (!s->macroblocks || /* first frame */
+ 16*cols != s->avctx->coded_width ||
+ 16*rows != s->avctx->coded_height) {
+ avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
return 2;
}
- }
- else if(!s->macroblocks)
+ } else if (!s->macroblocks)
return 0;
return 1;
}
@@ -78,7 +75,7 @@ static int vp5_adjust(int v, int t)
int s2, s1 = v >> 31;
v ^= s1;
v -= s1;
- v *= v < 2 * t;
+ v *= v < 2*t;
v -= t;
s2 = v >> 31;
v ^= s2;
@@ -95,11 +92,9 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
VP56Model *model = s->modelp;
int comp, di;
- for(comp = 0; comp < 2; comp++)
- {
+ for (comp=0; comp<2; comp++) {
int delta = 0;
- if(vp56_rac_get_prob(c, model->vector_dct[comp]))
- {
+ if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
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;
@@ -108,7 +103,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
delta = di | (delta << 2);
delta = (delta ^ -sign) + sign;
}
- if(!comp)
+ if (!comp)
vect->x = delta;
else
vect->y = delta;
@@ -121,21 +116,20 @@ static void vp5_parse_vector_models(VP56Context *s)
VP56Model *model = s->modelp;
int comp, node;
- for(comp = 0; comp < 2; comp++)
- {
- if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][0]))
+ for (comp=0; comp<2; comp++) {
+ if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][0]))
model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
- if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][1]))
+ if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][1]))
model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
- if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][2]))
+ if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][2]))
model->vector_pdi[comp][0] = vp56_rac_gets_nn(c, 7);
- if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][3]))
+ if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][3]))
model->vector_pdi[comp][1] = vp56_rac_gets_nn(c, 7);
}
- for(comp = 0; comp < 2; comp++)
- for(node = 0; node < 7; node++)
- if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node]))
+ for (comp=0; comp<2; comp++)
+ for (node=0; node<7; node++)
+ if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node]))
model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
}
@@ -150,44 +144,38 @@ static void vp5_parse_coeff_models(VP56Context *s)
memset(def_prob, 0x80, sizeof(def_prob));
- for(pt = 0; pt < 2; pt++)
- for(node = 0; node < 11; node++)
- if(vp56_rac_get_prob(c, vp5_dccv_pct[pt][node]))
- {
+ for (pt=0; pt<2; pt++)
+ for (node=0; node<11; node++)
+ if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[pt][node] = def_prob[node];
- }
- else if(s->framep[VP56_FRAME_CURRENT]->key_frame)
- {
+ } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_dccv[pt][node] = def_prob[node];
}
- for(ct = 0; ct < 3; ct++)
- for(pt = 0; pt < 2; pt++)
- for(cg = 0; cg < 6; cg++)
- for(node = 0; node < 11; node++)
- if(vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node]))
- {
+ for (ct=0; ct<3; ct++)
+ for (pt=0; pt<2; pt++)
+ for (cg=0; cg<6; cg++)
+ for (node=0; node<11; node++)
+ if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
- }
- else if(s->framep[VP56_FRAME_CURRENT]->key_frame)
- {
+ } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
}
/* coeff_dcct is a linear combination of coeff_dccv */
- for(pt = 0; pt < 2; pt++)
- for(ctx = 0; ctx < 36; ctx++)
- for(node = 0; node < 5; node++)
+ for (pt=0; pt<2; pt++)
+ for (ctx=0; ctx<36; ctx++)
+ for (node=0; node<5; node++)
model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254);
/* coeff_acct is a linear combination of coeff_ract */
- for(ct = 0; ct < 3; ct++)
- for(pt = 0; pt < 2; pt++)
- for(cg = 0; cg < 3; cg++)
- for(ctx = 0; ctx < 6; ctx++)
- for(node = 0; node < 5; node++)
+ for (ct=0; ct<3; ct++)
+ for (pt=0; pt<2; pt++)
+ for (cg=0; cg<3; cg++)
+ for (ctx=0; ctx<6; ctx++)
+ for (node=0; node<5; node++)
model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254);
}
@@ -201,63 +189,49 @@ static void vp5_parse_coeff(VP56Context *s)
int b, i, cg, idx, ctx, ctx_last;
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
- for(b = 0; b < 6; b++)
- {
+ for (b=0; b<6; b++) {
int ct = 1; /* code type */
- if(b > 3) pt = 1;
+ if (b > 3) pt = 1;
- ctx = 6 * s->coeff_ctx[vp56_b6to4[b]][0]
+ ctx = 6*s->coeff_ctx[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];
- for(coeff_idx = 0; coeff_idx < 64;)
- {
- if(vp56_rac_get_prob(c, model2[0]))
- {
- if(vp56_rac_get_prob(c, model2[2]))
- {
- if(vp56_rac_get_prob(c, model2[3]))
- {
+ for (coeff_idx=0; coeff_idx<64; ) {
+ 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);
sign = vp56_rac_get(c);
coeff = vp56_coeff_bias[idx+5];
- for(i = vp56_coeff_bit_length[idx]; i >= 0; i--)
+ for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
- }
- else
- {
- if(vp56_rac_get_prob(c, model2[4]))
- {
+ } 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;
- }
- else
- {
+ } else {
coeff = 2;
s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2;
}
sign = vp56_rac_get(c);
}
ct = 2;
- }
- else
- {
+ } else {
ct = 1;
s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1;
sign = vp56_rac_get(c);
coeff = 1;
}
coeff = (coeff ^ -sign) + sign;
- if(coeff_idx)
+ if (coeff_idx)
coeff *= s->dequant_ac;
s->block_coeff[b][permute[coeff_idx]] = coeff;
- }
- else
- {
- if(ct && !vp56_rac_get_prob(c, model2[1]))
+ } else {
+ if (ct && !vp56_rac_get_prob(c, model2[1]))
break;
ct = 0;
s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0;
@@ -271,8 +245,8 @@ static void vp5_parse_coeff(VP56Context *s)
ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24);
s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx;
- if(coeff_idx < ctx_last)
- for(i = coeff_idx; i <= ctx_last; i++)
+ 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];
}
@@ -283,8 +257,7 @@ static void vp5_default_models_init(VP56Context *s)
VP56Model *model = s->modelp;
int i;
- for(i = 0; i < 2; i++)
- {
+ for (i=0; i<2; i++) {
model->vector_sig[i] = 0x80;
model->vector_dct[i] = 0x80;
model->vector_pdi[i][0] = 0x55;
@@ -311,8 +284,7 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx)
return 0;
}
-AVCodec vp5_decoder =
-{
+AVCodec vp5_decoder = {
"vp5",
CODEC_TYPE_VIDEO,
CODEC_ID_VP5,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c
index 181071c7e..a4baf23d2 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c
@@ -39,30 +39,28 @@ static int vp56_get_vectors_predictors(VP56Context *s, int row, int col,
VP56Frame ref_frame)
{
int nb_pred = 0;
- VP56mv vect[2] = {{0, 0}, {0, 0}};
+ VP56mv vect[2] = {{0,0}, {0,0}};
int pos, offset;
VP56mv mvp;
- for(pos = 0; pos < 12; pos++)
- {
+ for (pos=0; pos<12; pos++) {
mvp.x = col + vp56_candidate_predictor_pos[pos][0];
mvp.y = row + vp56_candidate_predictor_pos[pos][1];
- if(mvp.x < 0 || mvp.x >= s->mb_width ||
- mvp.y < 0 || mvp.y >= s->mb_height)
+ if (mvp.x < 0 || mvp.x >= s->mb_width ||
+ mvp.y < 0 || mvp.y >= s->mb_height)
continue;
- offset = mvp.x + s->mb_width * mvp.y;
+ offset = mvp.x + s->mb_width*mvp.y;
- if(vp56_reference_frame[s->macroblocks[offset].type] != ref_frame)
+ if (vp56_reference_frame[s->macroblocks[offset].type] != ref_frame)
continue;
- if((s->macroblocks[offset].mv.x == vect[0].x &&
- s->macroblocks[offset].mv.y == vect[0].y) ||
- (s->macroblocks[offset].mv.x == 0 &&
- s->macroblocks[offset].mv.y == 0))
+ if ((s->macroblocks[offset].mv.x == vect[0].x &&
+ s->macroblocks[offset].mv.y == vect[0].y) ||
+ (s->macroblocks[offset].mv.x == 0 &&
+ s->macroblocks[offset].mv.y == 0))
continue;
vect[nb_pred++] = s->macroblocks[offset].mv;
- if(nb_pred > 1)
- {
+ if (nb_pred > 1) {
nb_pred = -1;
break;
}
@@ -72,7 +70,7 @@ static int vp56_get_vectors_predictors(VP56Context *s, int row, int col,
s->vector_candidate[0] = vect[0];
s->vector_candidate[1] = vect[1];
- return nb_pred + 1;
+ return nb_pred+1;
}
static void vp56_parse_mb_type_models(VP56Context *s)
@@ -81,28 +79,22 @@ static void vp56_parse_mb_type_models(VP56Context *s)
VP56Model *model = s->modelp;
int i, ctx, type;
- for(ctx = 0; ctx < 3; ctx++)
- {
- if(vp56_rac_get_prob(c, 174))
- {
+ for (ctx=0; ctx<3; ctx++) {
+ if (vp56_rac_get_prob(c, 174)) {
int idx = vp56_rac_gets(c, 4);
memcpy(model->mb_types_stats[ctx],
- vp56_pre_def_mb_type_stats[idx][ctx],
- sizeof(model->mb_types_stats[ctx]));
+ vp56_pre_def_mb_type_stats[idx][ctx],
+ sizeof(model->mb_types_stats[ctx]));
}
- if(vp56_rac_get_prob(c, 254))
- {
- for(type = 0; type < 10; type++)
- {
- for(i = 0; i < 2; i++)
- {
- if(vp56_rac_get_prob(c, 205))
- {
+ if (vp56_rac_get_prob(c, 254)) {
+ for (type=0; type<10; type++) {
+ for(i=0; i<2; i++) {
+ if (vp56_rac_get_prob(c, 205)) {
int delta, sign = vp56_rac_get(c);
delta = vp56_rac_get_tree(c, vp56_pmbtm_tree,
- vp56_mb_type_model_model);
- if(!delta)
+ vp56_mb_type_model_model);
+ if (!delta)
delta = 4 * vp56_rac_gets(c, 7);
model->mb_types_stats[ctx][type][i] += (delta ^ -sign) + sign;
}
@@ -112,15 +104,13 @@ static void vp56_parse_mb_type_models(VP56Context *s)
}
/* compute MB type probability tables based on previous MB type */
- for(ctx = 0; ctx < 3; ctx++)
- {
+ for (ctx=0; ctx<3; ctx++) {
int p[10];
- for(type = 0; type < 10; type++)
+ for (type=0; type<10; type++)
p[type] = 100 * model->mb_types_stats[ctx][type][1];
- for(type = 0; type < 10; type++)
- {
+ for (type=0; type<10; type++) {
int p02, p34, p0234, p17, p56, p89, p5689, p156789;
/* conservative MB type probability */
@@ -138,15 +128,15 @@ static void vp56_parse_mb_type_models(VP56Context *s)
p5689 = p56 + p89;
p156789 = p17 + p5689;
- model->mb_type[ctx][type][1] = 1 + 255 * p0234 / (1 + p0234 + p156789);
- model->mb_type[ctx][type][2] = 1 + 255 * p02 / (1 + p0234);
- model->mb_type[ctx][type][3] = 1 + 255 * p17 / (1 + p156789);
- model->mb_type[ctx][type][4] = 1 + 255 * p[0] / (1 + p02);
- model->mb_type[ctx][type][5] = 1 + 255 * p[3] / (1 + p34);
- model->mb_type[ctx][type][6] = 1 + 255 * p[1] / (1 + p17);
- model->mb_type[ctx][type][7] = 1 + 255 * p56 / (1 + p5689);
- model->mb_type[ctx][type][8] = 1 + 255 * p[5] / (1 + p56);
- model->mb_type[ctx][type][9] = 1 + 255 * p[8] / (1 + p89);
+ model->mb_type[ctx][type][1] = 1 + 255 * p0234/(1+p0234+p156789);
+ model->mb_type[ctx][type][2] = 1 + 255 * p02 / (1+p0234);
+ model->mb_type[ctx][type][3] = 1 + 255 * p17 / (1+p156789);
+ model->mb_type[ctx][type][4] = 1 + 255 * p[0] / (1+p02);
+ model->mb_type[ctx][type][5] = 1 + 255 * p[3] / (1+p34);
+ model->mb_type[ctx][type][6] = 1 + 255 * p[1] / (1+p17);
+ model->mb_type[ctx][type][7] = 1 + 255 * p56 / (1+p5689);
+ model->mb_type[ctx][type][8] = 1 + 255 * p[5] / (1+p56);
+ model->mb_type[ctx][type][9] = 1 + 255 * p[8] / (1+p89);
/* restore initial value */
p[type] = 100 * model->mb_types_stats[ctx][type][1];
@@ -155,12 +145,12 @@ static void vp56_parse_mb_type_models(VP56Context *s)
}
static VP56mb vp56_parse_mb_type(VP56Context *s,
-VP56mb prev_type, int ctx)
+ VP56mb prev_type, int ctx)
{
uint8_t *mb_type_model = s->modelp->mb_type[ctx][prev_type];
VP56RangeCoder *c = &s->c;
- if(vp56_rac_get_prob(c, mb_type_model[0]))
+ if (vp56_rac_get_prob(c, mb_type_model[0]))
return prev_type;
else
return vp56_rac_get_tree(c, vp56_pmbt_tree, mb_type_model);
@@ -168,36 +158,32 @@ VP56mb prev_type, int ctx)
static void vp56_decode_4mv(VP56Context *s, int row, int col)
{
- VP56mv mv = {0, 0};
+ VP56mv mv = {0,0};
int type[4];
int b;
/* parse each block type */
- for(b = 0; b < 4; b++)
- {
+ for (b=0; b<4; b++) {
type[b] = vp56_rac_gets(&s->c, 2);
- if(type[b])
+ if (type[b])
type[b]++; /* only returns 0, 2, 3 or 4 (all INTER_PF) */
}
/* get vectors */
- for(b = 0; b < 4; b++)
- {
- switch(type[b])
- {
- case VP56_MB_INTER_NOVEC_PF:
- s->mv[b].x = 0;
- s->mv[b].y = 0;
- break;
- case VP56_MB_INTER_DELTA_PF:
- s->parse_vector_adjustment(s, &s->mv[b]);
- break;
- case VP56_MB_INTER_V1_PF:
- s->mv[b] = s->vector_candidate[0];
- break;
- case VP56_MB_INTER_V2_PF:
- s->mv[b] = s->vector_candidate[1];
- break;
+ for (b=0; b<4; b++) {
+ switch (type[b]) {
+ case VP56_MB_INTER_NOVEC_PF:
+ s->mv[b].x=0;s->mv[b].y=0;
+ break;
+ case VP56_MB_INTER_DELTA_PF:
+ s->parse_vector_adjustment(s, &s->mv[b]);
+ break;
+ case VP56_MB_INTER_V1_PF:
+ s->mv[b] = s->vector_candidate[0];
+ break;
+ case VP56_MB_INTER_V2_PF:
+ s->mv[b] = s->vector_candidate[1];
+ break;
}
mv.x += s->mv[b].x;
mv.y += s->mv[b].y;
@@ -207,71 +193,66 @@ 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)
- {
- 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
- {
- s->mv[4].x = s->mv[5].x = mv.x / 4;
- s->mv[4].y = s->mv[5].y = mv.y / 4;
+ if (s->avctx->codec->id == 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 {
+ s->mv[4].x = s->mv[5].x = mv.x/4; s->mv[4].y = s->mv[5].y = mv.y/4;
}
}
static VP56mb vp56_decode_mv(VP56Context *s, int row, int col)
{
- VP56mv *mv, vect = {0, 0};
+ VP56mv *mv, vect = {0,0};
int ctx, b;
ctx = vp56_get_vectors_predictors(s, row, col, VP56_FRAME_PREVIOUS);
s->mb_type = vp56_parse_mb_type(s, s->mb_type, ctx);
s->macroblocks[row * s->mb_width + col].type = s->mb_type;
- switch(s->mb_type)
- {
- case VP56_MB_INTER_V1_PF:
- mv = &s->vector_candidate[0];
- break;
-
- case VP56_MB_INTER_V2_PF:
- mv = &s->vector_candidate[1];
- break;
-
- case VP56_MB_INTER_V1_GF:
- vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
- mv = &s->vector_candidate[0];
- break;
-
- case VP56_MB_INTER_V2_GF:
- vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
- mv = &s->vector_candidate[1];
- break;
-
- case VP56_MB_INTER_DELTA_PF:
- s->parse_vector_adjustment(s, &vect);
- mv = &vect;
- break;
-
- case VP56_MB_INTER_DELTA_GF:
- vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
- s->parse_vector_adjustment(s, &vect);
- mv = &vect;
- break;
-
- case VP56_MB_INTER_4V:
- vp56_decode_4mv(s, row, col);
- return s->mb_type;
-
- default:
- mv = &vect;
- break;
+ switch (s->mb_type) {
+ case VP56_MB_INTER_V1_PF:
+ mv = &s->vector_candidate[0];
+ break;
+
+ case VP56_MB_INTER_V2_PF:
+ mv = &s->vector_candidate[1];
+ break;
+
+ case VP56_MB_INTER_V1_GF:
+ vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
+ mv = &s->vector_candidate[0];
+ break;
+
+ case VP56_MB_INTER_V2_GF:
+ vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
+ mv = &s->vector_candidate[1];
+ break;
+
+ case VP56_MB_INTER_DELTA_PF:
+ s->parse_vector_adjustment(s, &vect);
+ mv = &vect;
+ break;
+
+ case VP56_MB_INTER_DELTA_GF:
+ vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
+ s->parse_vector_adjustment(s, &vect);
+ mv = &vect;
+ break;
+
+ case VP56_MB_INTER_4V:
+ vp56_decode_4mv(s, row, col);
+ return s->mb_type;
+
+ default:
+ mv = &vect;
+ break;
}
s->macroblocks[row*s->mb_width + col].mv = *mv;
/* same vector for all blocks */
- for(b = 0; b < 6; b++)
+ for (b=0; b<6; b++)
s->mv[b] = *mv;
return s->mb_type;
@@ -282,34 +263,30 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame)
int idx = s->scantable.permutated[0];
int b;
- for(b = 0; b < 6; b++)
- {
+ for (b=0; b<6; b++) {
VP56RefDc *ab = &s->above_blocks[s->above_block_idx[b]];
VP56RefDc *lb = &s->left_block[vp56_b6to4[b]];
int count = 0;
int dc = 0;
int i;
- if(ref_frame == lb->ref_frame)
- {
+ if (ref_frame == lb->ref_frame) {
dc += lb->dc_coeff;
count++;
}
- if(ref_frame == ab->ref_frame)
- {
+ if (ref_frame == ab->ref_frame) {
dc += ab->dc_coeff;
count++;
}
- if(s->avctx->codec->id == CODEC_ID_VP5)
- for(i = 0; i < 2; i++)
- if(count < 2 && ref_frame == ab[-1+2*i].ref_frame)
- {
+ if (s->avctx->codec->id == 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)
+ if (count == 0)
dc = s->prev_dc[vp56_b2p[b]][ref_frame];
- else if(count == 2)
+ else if (count == 2)
dc /= 2;
s->block_coeff[b][idx] += dc;
@@ -323,14 +300,13 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame)
}
static void vp56_edge_filter(VP56Context *s, uint8_t *yuv,
-int pix_inc, int line_inc, int t)
+ int pix_inc, int line_inc, int t)
{
int pix2_inc = 2 * pix_inc;
int i, v;
- for(i = 0; i < 12; i++)
- {
- v = (yuv[-pix2_inc] + 3 * (yuv[0] - yuv[-pix_inc]) - yuv[pix_inc] + 4) >> 3;
+ for (i=0; i<12; i++) {
+ v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4) >>3;
v = s->adjust(v, t);
yuv[-pix_inc] = av_clip_uint8(yuv[-pix_inc] + v);
yuv[0] = av_clip_uint8(yuv[0] - v);
@@ -339,17 +315,17 @@ int pix_inc, int line_inc, int t)
}
static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv,
-int stride, int dx, int dy)
+ int stride, int dx, int dy)
{
int t = vp56_filter_threshold[s->quantizer];
- if(dx) vp56_edge_filter(s, yuv + 10 - dx , 1, stride, t);
- if(dy) vp56_edge_filter(s, yuv + stride*(10 - dy), stride, 1, t);
+ if (dx) vp56_edge_filter(s, yuv + 10-dx , 1, stride, t);
+ if (dy) vp56_edge_filter(s, yuv + stride*(10-dy), stride, 1, t);
}
static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,
-int stride, int x, int y)
+ int stride, int x, int y)
{
- uint8_t *dst = s->framep[VP56_FRAME_CURRENT]->data[plane] + s->block_offset[b];
+ uint8_t *dst=s->framep[VP56_FRAME_CURRENT]->data[plane]+s->block_offset[b];
uint8_t *src_block;
int src_offset;
int overlap_offset = 0;
@@ -358,70 +334,61 @@ int stride, int x, int y)
int dx;
int dy;
- if(s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
- (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY
- && !s->framep[VP56_FRAME_CURRENT]->key_frame))
+ if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
+ (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY
+ && !s->framep[VP56_FRAME_CURRENT]->key_frame))
deblock_filtering = 0;
dx = s->mv[b].x / s->vp56_coord_div[b];
dy = s->mv[b].y / s->vp56_coord_div[b];
- if(b >= 4)
- {
+ if (b >= 4) {
x /= 2;
y /= 2;
}
x += dx - 2;
y += dy - 2;
- if(x < 0 || x + 12 >= s->plane_width[plane] ||
- y < 0 || y + 12 >= s->plane_height[plane])
- {
+ if (x<0 || x+12>=s->plane_width[plane] ||
+ y<0 || y+12>=s->plane_height[plane]) {
ff_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],
- s->plane_height[plane]);
+ src + s->block_offset[b] + (dy-2)*stride + (dx-2),
+ stride, 12, 12, x, y,
+ s->plane_width[plane],
+ s->plane_height[plane]);
src_block = s->edge_emu_buffer;
- src_offset = 2 + 2 * stride;
- }
- else if(deblock_filtering)
- {
+ src_offset = 2 + 2*stride;
+ } else if (deblock_filtering) {
/* only need a 12x12 block, but there is no such dsp function, */
/* so copy a 16x12 block */
s->dsp.put_pixels_tab[0][0](s->edge_emu_buffer,
- src + s->block_offset[b] + (dy - 2)*stride + (dx - 2),
- stride, 12);
+ src + s->block_offset[b] + (dy-2)*stride + (dx-2),
+ stride, 12);
src_block = s->edge_emu_buffer;
- src_offset = 2 + 2 * stride;
- }
- else
- {
+ src_offset = 2 + 2*stride;
+ } else {
src_block = src;
- src_offset = s->block_offset[b] + dy * stride + dx;
+ src_offset = s->block_offset[b] + dy*stride + dx;
}
- if(deblock_filtering)
- vp56_deblock_filter(s, src_block, stride, dx & 7, dy & 7);
+ if (deblock_filtering)
+ vp56_deblock_filter(s, src_block, stride, dx&7, dy&7);
- if(s->mv[b].x & mask)
+ if (s->mv[b].x & mask)
overlap_offset += (s->mv[b].x > 0) ? 1 : -1;
- if(s->mv[b].y & mask)
+ if (s->mv[b].y & mask)
overlap_offset += (s->mv[b].y > 0) ? stride : -stride;
- if(overlap_offset)
- {
- if(s->filter)
- s->filter(s, dst, src_block, src_offset, src_offset + overlap_offset,
- stride, s->mv[b], mask, s->filter_selection, b < 4);
+ if (overlap_offset) {
+ if (s->filter)
+ s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
+ stride, s->mv[b], mask, s->filter_selection, b<4);
else
- s->dsp.put_no_rnd_pixels_l2[1](dst, src_block + src_offset,
- src_block + src_offset + overlap_offset,
- stride, 8);
- }
- else
- {
- s->dsp.put_pixels_tab[1][0](dst, src_block + src_offset, stride, 8);
+ s->dsp.put_no_rnd_pixels_l2[1](dst, src_block+src_offset,
+ src_block+src_offset+overlap_offset,
+ stride, 8);
+ } else {
+ s->dsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);
}
}
@@ -432,7 +399,7 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
VP56Frame ref_frame;
int b, ab, b_max, plane, off;
- if(s->framep[VP56_FRAME_CURRENT]->key_frame)
+ if (s->framep[VP56_FRAME_CURRENT]->key_frame)
mb_type = VP56_MB_INTRA;
else
mb_type = vp56_decode_mv(s, row, col);
@@ -447,52 +414,48 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
frame_current = s->framep[VP56_FRAME_CURRENT];
frame_ref = s->framep[ref_frame];
- ab = 6 * is_alpha;
- b_max = 6 - 2 * 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],
- s->stride[plane], s->block_coeff[b]);
- }
- break;
-
- case VP56_MB_INTER_NOVEC_PF:
- case VP56_MB_INTER_NOVEC_GF:
- for(b = 0; b < b_max; b++)
- {
- plane = 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->stride[plane], s->block_coeff[b]);
- }
- break;
-
- case VP56_MB_INTER_DELTA_PF:
- case VP56_MB_INTER_V1_PF:
- case VP56_MB_INTER_V2_PF:
- case VP56_MB_INTER_DELTA_GF:
- case VP56_MB_INTER_4V:
- case VP56_MB_INTER_V1_GF:
- case VP56_MB_INTER_V2_GF:
- 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];
- 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->stride[plane], s->block_coeff[b]);
- }
- break;
+ ab = 6*is_alpha;
+ b_max = 6 - 2*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],
+ s->stride[plane], s->block_coeff[b]);
+ }
+ break;
+
+ case VP56_MB_INTER_NOVEC_PF:
+ case VP56_MB_INTER_NOVEC_GF:
+ for (b=0; b<b_max; b++) {
+ plane = 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->stride[plane], s->block_coeff[b]);
+ }
+ break;
+
+ case VP56_MB_INTER_DELTA_PF:
+ case VP56_MB_INTER_V1_PF:
+ case VP56_MB_INTER_V2_PF:
+ case VP56_MB_INTER_DELTA_GF:
+ case VP56_MB_INTER_4V:
+ case VP56_MB_INTER_V1_GF:
+ case VP56_MB_INTER_V2_GF:
+ 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];
+ 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->stride[plane], s->block_coeff[b]);
+ }
+ break;
}
}
@@ -503,51 +466,48 @@ static int vp56_size_changed(AVCodecContext *avctx)
int i;
s->plane_width[0] = s->plane_width[3] = avctx->coded_width;
- s->plane_width[1] = s->plane_width[2] = avctx->coded_width / 2;
+ s->plane_width[1] = s->plane_width[2] = avctx->coded_width/2;
s->plane_height[0] = s->plane_height[3] = avctx->coded_height;
- s->plane_height[1] = s->plane_height[2] = avctx->coded_height / 2;
+ s->plane_height[1] = s->plane_height[2] = avctx->coded_height/2;
- for(i = 0; i < 4; i++)
+ for (i=0; i<4; i++)
s->stride[i] = s->flip * s->framep[VP56_FRAME_CURRENT]->linesize[i];
- s->mb_width = (avctx->coded_width + 15) / 16;
- s->mb_height = (avctx->coded_height + 15) / 16;
+ s->mb_width = (avctx->coded_width +15) / 16;
+ s->mb_height = (avctx->coded_height+15) / 16;
- if(s->mb_width > 1000 || s->mb_height > 1000)
- {
+ if (s->mb_width > 1000 || s->mb_height > 1000) {
av_log(avctx, AV_LOG_ERROR, "picture too big\n");
return -1;
}
s->above_blocks = av_realloc(s->above_blocks,
- (4 * s->mb_width + 6) * sizeof(*s->above_blocks));
+ (4*s->mb_width+6) * sizeof(*s->above_blocks));
s->macroblocks = av_realloc(s->macroblocks,
- s->mb_width * s->mb_height * sizeof(*s->macroblocks));
+ s->mb_width*s->mb_height*sizeof(*s->macroblocks));
av_free(s->edge_emu_buffer_alloc);
- s->edge_emu_buffer_alloc = av_malloc(16 * stride);
+ s->edge_emu_buffer_alloc = av_malloc(16*stride);
s->edge_emu_buffer = s->edge_emu_buffer_alloc;
- if(s->flip < 0)
+ if (s->flip < 0)
s->edge_emu_buffer += 15 * stride;
return 0;
}
int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-const uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
VP56Context *s = avctx->priv_data;
AVFrame *const p = s->framep[VP56_FRAME_CURRENT];
int remaining_buf_size = buf_size;
int is_alpha, av_uninit(alpha_offset);
- if(s->has_alpha)
- {
+ if (s->has_alpha) {
alpha_offset = bytestream_get_be24(&buf);
remaining_buf_size -= 3;
}
- for(is_alpha = 0; is_alpha < 1 + s->has_alpha; is_alpha++)
- {
+ for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {
int mb_row, mb_col, mb_row_flip, mb_offset = 0;
int block, y, uv, stride_y, stride_uv;
int golden_frame = 0;
@@ -556,35 +516,29 @@ const uint8_t *buf, int buf_size)
s->modelp = &s->models[is_alpha];
res = s->parse_header(s, buf, remaining_buf_size, &golden_frame);
- if(!res)
+ if (!res)
return -1;
- if(!is_alpha)
- {
+ if (!is_alpha) {
p->reference = 1;
- if(avctx->get_buffer(avctx, p) < 0)
- {
+ if (avctx->get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
- if(res == 2)
- if(vp56_size_changed(avctx))
- {
+ if (res == 2)
+ if (vp56_size_changed(avctx)) {
avctx->release_buffer(avctx, p);
return -1;
}
}
- if(p->key_frame)
- {
+ if (p->key_frame) {
p->pict_type = FF_I_TYPE;
s->default_models_init(s);
- for(block = 0; block < s->mb_height * s->mb_width; block++)
+ for (block=0; block<s->mb_height*s->mb_width; block++)
s->macroblocks[block].type = VP56_MB_INTRA;
- }
- else
- {
+ } else {
p->pict_type = FF_P_TYPE;
vp56_parse_mb_type_models(s);
s->parse_vector_models(s);
@@ -597,8 +551,7 @@ const uint8_t *buf, int buf_size)
s->prev_dc[1][VP56_FRAME_CURRENT] = 128;
s->prev_dc[2][VP56_FRAME_CURRENT] = 128;
- for(block = 0; block < 4 * s->mb_width + 6; block++)
- {
+ for (block=0; block < 4*s->mb_width+6; block++) {
s->above_blocks[block].ref_frame = VP56_FRAME_NONE;
s->above_blocks[block].dc_coeff = 0;
s->above_blocks[block].not_null_dc = 0;
@@ -609,19 +562,17 @@ const uint8_t *buf, int buf_size)
stride_y = p->linesize[0];
stride_uv = p->linesize[1];
- if(s->flip < 0)
+ if (s->flip < 0)
mb_offset = 7;
/* main macroblocks loop */
- for(mb_row = 0; mb_row < s->mb_height; mb_row++)
- {
- if(s->flip < 0)
+ for (mb_row=0; mb_row<s->mb_height; mb_row++) {
+ if (s->flip < 0)
mb_row_flip = s->mb_height - mb_row - 1;
else
mb_row_flip = mb_row;
- for(block = 0; block < 4; block++)
- {
+ for (block=0; block<4; block++) {
s->left_block[block].ref_frame = VP56_FRAME_NONE;
s->left_block[block].dc_coeff = 0;
s->left_block[block].not_null_dc = 0;
@@ -633,66 +584,59 @@ const uint8_t *buf, int buf_size)
s->above_block_idx[1] = 2;
s->above_block_idx[2] = 1;
s->above_block_idx[3] = 2;
- s->above_block_idx[4] = 2 * s->mb_width + 2 + 1;
- s->above_block_idx[5] = 3 * s->mb_width + 4 + 1;
+ s->above_block_idx[4] = 2*s->mb_width + 2 + 1;
+ s->above_block_idx[5] = 3*s->mb_width + 4 + 1;
- s->block_offset[s->frbi] = (mb_row_flip * 16 + mb_offset) * stride_y;
- s->block_offset[s->srbi] = s->block_offset[s->frbi] + 8 * stride_y;
+ s->block_offset[s->frbi] = (mb_row_flip*16 + mb_offset) * stride_y;
+ s->block_offset[s->srbi] = s->block_offset[s->frbi] + 8*stride_y;
s->block_offset[1] = s->block_offset[0] + 8;
s->block_offset[3] = s->block_offset[2] + 8;
- s->block_offset[4] = (mb_row_flip * 8 + mb_offset) * stride_uv;
+ s->block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv;
s->block_offset[5] = s->block_offset[4];
- for(mb_col = 0; mb_col < s->mb_width; mb_col++)
- {
+ for (mb_col=0; mb_col<s->mb_width; mb_col++) {
vp56_decode_mb(s, mb_row, mb_col, is_alpha);
- for(y = 0; y < 4; y++)
- {
+ for (y=0; y<4; y++) {
s->above_block_idx[y] += 2;
s->block_offset[y] += 16;
}
- for(uv = 4; uv < 6; uv++)
- {
+ for (uv=4; uv<6; uv++) {
s->above_block_idx[uv] += 1;
s->block_offset[uv] += 8;
}
}
}
- if(p->key_frame || golden_frame)
- {
- if(s->framep[VP56_FRAME_GOLDEN]->data[0] &&
- s->framep[VP56_FRAME_GOLDEN] != s->framep[VP56_FRAME_GOLDEN2])
+ if (p->key_frame || golden_frame) {
+ if (s->framep[VP56_FRAME_GOLDEN]->data[0] &&
+ s->framep[VP56_FRAME_GOLDEN] != s->framep[VP56_FRAME_GOLDEN2])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
s->framep[VP56_FRAME_GOLDEN] = p;
}
- if(s->has_alpha)
- {
+ if (s->has_alpha) {
FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN],
- s->framep[VP56_FRAME_GOLDEN2]);
+ s->framep[VP56_FRAME_GOLDEN2]);
buf += alpha_offset;
remaining_buf_size -= alpha_offset;
}
}
- if(s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN] ||
- s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN2])
- {
- if(s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN] &&
- s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN2])
+ if (s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN] ||
+ s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN2]) {
+ if (s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN] &&
+ s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN2])
FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
- s->framep[VP56_FRAME_UNUSED]);
+ s->framep[VP56_FRAME_UNUSED]);
else
FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
- s->framep[VP56_FRAME_UNUSED2]);
- }
- else if(s->framep[VP56_FRAME_PREVIOUS]->data[0])
+ s->framep[VP56_FRAME_UNUSED2]);
+ } else if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT],
- s->framep[VP56_FRAME_PREVIOUS]);
+ s->framep[VP56_FRAME_PREVIOUS]);
*(AVFrame*)data = *p;
*data_size = sizeof(AVFrame);
@@ -709,11 +653,11 @@ av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
avctx->pix_fmt = has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
/* always use the VP3 IDCT */
- avctx->idct_algo = FF_IDCT_VP3;
+ avctx->idct_algo = FF_IDCT_VP3;
dsputil_init(&s->dsp, avctx);
- ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
+ ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct);
- for(i = 0; i < 4; i++)
+ for (i=0; i<4; i++)
s->framep[i] = &s->frames[i];
s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN];
s->framep[VP56_FRAME_UNUSED2] = s->framep[VP56_FRAME_GOLDEN2];
@@ -727,14 +671,11 @@ av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
s->filter = NULL;
s->has_alpha = has_alpha;
- if(flip)
- {
+ if (flip) {
s->flip = -1;
s->frbi = 2;
s->srbi = 0;
- }
- else
- {
+ } else {
s->flip = 1;
s->frbi = 0;
s->srbi = 2;
@@ -748,11 +689,11 @@ av_cold int vp56_free(AVCodecContext *avctx)
av_freep(&s->above_blocks);
av_freep(&s->macroblocks);
av_freep(&s->edge_emu_buffer_alloc);
- if(s->framep[VP56_FRAME_GOLDEN]->data[0])
+ if (s->framep[VP56_FRAME_GOLDEN]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
- if(s->framep[VP56_FRAME_GOLDEN2]->data[0])
+ if (s->framep[VP56_FRAME_GOLDEN2]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]);
- if(s->framep[VP56_FRAME_PREVIOUS]->data[0])
+ if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
return 0;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h
index 943474298..53da77812 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h
@@ -34,8 +34,8 @@ typedef struct vp56_context VP56Context;
typedef struct vp56_mv VP56mv;
typedef void (*VP56ParseVectorAdjustment)(VP56Context *s,
- VP56mv *vect);
-typedef int (*VP56Adjust)(int v, int t);
+ VP56mv *vect);
+typedef int (*VP56Adjust)(int v, int t);
typedef void (*VP56Filter)(VP56Context *s, uint8_t *dst, uint8_t *src,
int offset1, int offset2, int stride,
VP56mv mv, int mask, int select, int luma);
@@ -43,11 +43,10 @@ typedef void (*VP56ParseCoeff)(VP56Context *s);
typedef void (*VP56DefaultModelsInit)(VP56Context *s);
typedef void (*VP56ParseVectorModels)(VP56Context *s);
typedef void (*VP56ParseCoeffModels)(VP56Context *s);
-typedef int (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf,
- int buf_size, int *golden_frame);
+typedef int (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf,
+ int buf_size, int *golden_frame);
-typedef struct
-{
+typedef struct {
int high;
int bits;
const uint8_t *buffer;
@@ -55,27 +54,23 @@ typedef struct
unsigned long code_word;
} VP56RangeCoder;
-typedef struct
-{
+typedef struct {
uint8_t not_null_dc;
VP56Frame ref_frame;
DCTELEM dc_coeff;
} VP56RefDc;
-struct vp56_mv
-{
+struct vp56_mv {
int x;
int y;
};
-typedef struct
-{
+typedef struct {
uint8_t type;
VP56mv mv;
} VP56Macroblock;
-typedef struct
-{
+typedef struct {
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 */
@@ -92,8 +87,7 @@ typedef struct
uint8_t mb_types_stats[3][10][2];/* contextual, next MB type stats */
} VP56Model;
-struct vp56_context
-{
+struct vp56_context {
AVCodecContext *avctx;
DSPContext dsp;
ScanTable scantable;
@@ -187,7 +181,7 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
*/
static inline void vp56_init_range_decoder(VP56RangeCoder *c,
- const uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
c->high = 255;
c->bits = 8;
@@ -202,23 +196,18 @@ static inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
unsigned int low_shift = low << 8;
int bit = c->code_word >= low_shift;
- if(bit)
- {
+ if (bit) {
c->high -= low;
c->code_word -= low_shift;
- }
- else
- {
+ } else {
c->high = low;
}
/* normalize */
- while(c->high < 128)
- {
+ while (c->high < 128) {
c->high <<= 1;
c->code_word <<= 1;
- if(--c->bits == 0 && c->buffer < c->end)
- {
+ if (--c->bits == 0 && c->buffer < c->end) {
c->bits = 8;
c->code_word |= *c->buffer++;
}
@@ -232,20 +221,16 @@ static inline int vp56_rac_get(VP56RangeCoder *c)
int low = (c->high + 1) >> 1;
unsigned int low_shift = low << 8;
int bit = c->code_word >= low_shift;
- if(bit)
- {
+ if (bit) {
c->high = (c->high - low) << 1;
c->code_word -= low_shift;
- }
- else
- {
+ } else {
c->high = low << 1;
}
/* normalize */
c->code_word <<= 1;
- if(--c->bits == 0 && c->buffer < c->end)
- {
+ if (--c->bits == 0 && c->buffer < c->end) {
c->bits = 8;
c->code_word |= *c->buffer++;
}
@@ -256,8 +241,7 @@ static inline int vp56_rac_gets(VP56RangeCoder *c, int bits)
{
int value = 0;
- while(bits--)
- {
+ while (bits--) {
value = (value << 1) | vp56_rac_get(c);
}
@@ -274,9 +258,8 @@ static inline int vp56_rac_get_tree(VP56RangeCoder *c,
const VP56Tree *tree,
const uint8_t *probs)
{
- while(tree->val > 0)
- {
- if(vp56_rac_get_prob(c, probs[tree->prob_idx]))
+ while (tree->val > 0) {
+ if (vp56_rac_get_prob(c, probs[tree->prob_idx]))
tree += tree->val;
else
tree++;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.c
index 085bb4651..9b98014e4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.c
@@ -26,8 +26,7 @@
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 vp56_coeff_parse_table[6][11] =
-{
+const uint8_t 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 },
@@ -36,37 +35,31 @@ 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] =
-{
- { { 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 },
- { 1, 2 }, { 0, 1 }, { 0, 0 }, { 1, 1 }, { 0, 0 },
- },
- { { 122, 35 }, { 1, 1 }, { 1, 6 }, { 46, 34 }, { 0, 0 },
- { 1, 2 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 },
- },
+const uint8_t 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 },
+ { 1, 2 }, { 0, 1 }, { 0, 0 }, { 1, 1 }, { 0, 0 }, },
+ { { 122, 35 }, { 1, 1 }, { 1, 6 }, { 46, 34 }, { 0, 0 },
+ { 1, 2 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, },
};
-const VP56Tree vp56_pva_tree[] =
-{
+const VP56Tree vp56_pva_tree[] = {
{ 8, 0},
{ 4, 1},
- { 2, 2}, { -0}, { -1},
- { 2, 3}, { -2}, { -3},
+ { 2, 2}, {-0}, {-1},
+ { 2, 3}, {-2}, {-3},
{ 4, 4},
- { 2, 5}, { -4}, { -5},
- { 2, 6}, { -6}, { -7},
+ { 2, 5}, {-4}, {-5},
+ { 2, 6}, {-6}, {-7},
};
-const VP56Tree vp56_pc_tree[] =
-{
+const VP56Tree vp56_pc_tree[] = {
{ 4, 6},
- { 2, 7}, { -0}, { -1},
+ { 2, 7}, {-0}, {-1},
{ 4, 8},
- { 2, 9}, { -2}, { -3},
- { 2, 10}, { -4}, { -5},
+ { 2, 9}, {-2}, {-3},
+ { 2,10}, {-4}, {-5},
};
const uint8_t vp56_coeff_bias[] = { 0, 1, 2, 3, 4, 5, 7, 11, 19, 35, 67 };
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.h
index 831b3750e..92f2512a3 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56data.h
@@ -26,9 +26,8 @@
#include "libavutil/common.h"
-typedef enum
-{
- VP56_FRAME_NONE = -1,
+typedef enum {
+ VP56_FRAME_NONE =-1,
VP56_FRAME_CURRENT = 0,
VP56_FRAME_PREVIOUS = 1,
VP56_FRAME_GOLDEN = 2,
@@ -37,8 +36,7 @@ typedef enum
VP56_FRAME_UNUSED2 = 5,
} VP56Frame;
-typedef enum
-{
+typedef enum {
VP56_MB_INTER_NOVEC_PF = 0, /**< Inter MB, no vector, from previous frame */
VP56_MB_INTRA = 1, /**< Intra MB */
VP56_MB_INTER_DELTA_PF = 2, /**< Inter MB, above/left vector + delta, from previous frame */
@@ -51,10 +49,9 @@ typedef enum
VP56_MB_INTER_V2_GF = 9, /**< Inter MB, second vector, from golden frame */
} VP56mb;
-typedef struct
-{
- int8_t val;
- int8_t prob_idx;
+typedef struct {
+ int8_t val;
+ int8_t prob_idx;
} VP56Tree;
extern const uint8_t vp56_b2p[];
@@ -66,8 +63,7 @@ extern const VP56Tree vp56_pc_tree[];
extern const uint8_t vp56_coeff_bias[];
extern const uint8_t vp56_coeff_bit_length[];
-static const VP56Frame vp56_reference_frame[] =
-{
+static const VP56Frame vp56_reference_frame[] = {
VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */
VP56_FRAME_CURRENT, /* VP56_MB_INTRA */
VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_DELTA_PF */
@@ -80,8 +76,7 @@ static const VP56Frame vp56_reference_frame[] =
VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V2_GF */
};
-static const uint8_t vp56_ac_dequant[64] =
-{
+static const uint8_t vp56_ac_dequant[64] = {
94, 92, 90, 88, 86, 82, 78, 74,
70, 66, 62, 58, 54, 53, 52, 51,
50, 49, 48, 47, 46, 45, 44, 43,
@@ -89,11 +84,10 @@ static const uint8_t vp56_ac_dequant[64] =
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,
+ 8, 7, 6, 5, 4, 3, 2, 1,
};
-static const uint8_t vp56_dc_dequant[64] =
-{
+static const uint8_t vp56_dc_dequant[64] = {
47, 47, 47, 47, 45, 43, 43, 43,
43, 43, 42, 41, 41, 40, 40, 40,
40, 35, 35, 35, 35, 33, 33, 33,
@@ -101,216 +95,146 @@ static const uint8_t vp56_dc_dequant[64] =
25, 25, 24, 24, 23, 23, 19, 19,
19, 19, 18, 18, 17, 16, 16, 16,
16, 16, 15, 11, 11, 11, 10, 10,
- 9, 8, 7, 5, 3, 3, 2, 2,
+ 9, 8, 7, 5, 3, 3, 2, 2,
};
-static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2] =
-{
- { { { 9, 15 }, { 32, 25 }, { 7, 19 }, { 9, 21 }, { 1, 12 },
- { 14, 12 }, { 3, 18 }, { 14, 23 }, { 3, 10 }, { 0, 4 },
- },
- { { 41, 22 }, { 1, 0 }, { 1, 31 }, { 0, 0 }, { 0, 0 },
- { 0, 1 }, { 1, 7 }, { 0, 1 }, { 98, 25 }, { 4, 10 },
- },
- { { 2, 3 }, { 2, 3 }, { 0, 2 }, { 0, 2 }, { 0, 0 },
- { 11, 4 }, { 1, 4 }, { 0, 2 }, { 3, 2 }, { 0, 4 },
- },
- },
- { { { 48, 39 }, { 1, 2 }, { 11, 27 }, { 29, 44 }, { 7, 27 },
- { 1, 4 }, { 0, 3 }, { 1, 6 }, { 1, 2 }, { 0, 0 },
- },
- { { 123, 37 }, { 6, 4 }, { 1, 27 }, { 0, 0 }, { 0, 0 },
- { 5, 8 }, { 1, 7 }, { 0, 1 }, { 12, 10 }, { 0, 2 },
- },
- { { 49, 46 }, { 3, 4 }, { 7, 31 }, { 42, 41 }, { 0, 0 },
- { 2, 6 }, { 1, 7 }, { 1, 4 }, { 2, 4 }, { 0, 1 },
- },
- },
- { { { 21, 32 }, { 1, 2 }, { 4, 10 }, { 32, 43 }, { 6, 23 },
- { 2, 3 }, { 1, 19 }, { 1, 6 }, { 12, 21 }, { 0, 7 },
- },
- { { 26, 14 }, { 14, 12 }, { 0, 24 }, { 0, 0 }, { 0, 0 },
- { 55, 17 }, { 1, 9 }, { 0, 36 }, { 5, 7 }, { 1, 3 },
- },
- { { 26, 25 }, { 1, 1 }, { 2, 10 }, { 67, 39 }, { 0, 0 },
- { 1, 1 }, { 0, 14 }, { 0, 2 }, { 31, 26 }, { 1, 6 },
- },
- },
- { { { 69, 83 }, { 0, 0 }, { 0, 2 }, { 10, 29 }, { 3, 12 },
- { 0, 1 }, { 0, 3 }, { 0, 3 }, { 2, 2 }, { 0, 0 },
- },
- { { 209, 5 }, { 0, 0 }, { 0, 27 }, { 0, 0 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 },
- },
- { { 103, 46 }, { 1, 2 }, { 2, 10 }, { 33, 42 }, { 0, 0 },
- { 1, 4 }, { 0, 3 }, { 0, 1 }, { 1, 3 }, { 0, 0 },
- },
- },
- { { { 11, 20 }, { 1, 4 }, { 18, 36 }, { 43, 48 }, { 13, 35 },
- { 0, 2 }, { 0, 5 }, { 3, 12 }, { 1, 2 }, { 0, 0 },
- },
- { { 2, 5 }, { 4, 5 }, { 0, 121 }, { 0, 0 }, { 0, 0 },
- { 0, 3 }, { 2, 4 }, { 1, 4 }, { 2, 2 }, { 0, 1 },
- },
- { { 14, 31 }, { 9, 13 }, { 14, 54 }, { 22, 29 }, { 0, 0 },
- { 2, 6 }, { 4, 18 }, { 6, 13 }, { 1, 5 }, { 0, 1 },
- },
- },
- { { { 70, 44 }, { 0, 1 }, { 2, 10 }, { 37, 46 }, { 8, 26 },
- { 0, 2 }, { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 0 },
- },
- { { 175, 5 }, { 0, 1 }, { 0, 48 }, { 0, 0 }, { 0, 0 },
- { 0, 2 }, { 0, 1 }, { 0, 2 }, { 0, 1 }, { 0, 0 },
- },
- { { 85, 39 }, { 0, 0 }, { 1, 9 }, { 69, 40 }, { 0, 0 },
- { 0, 1 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 0 },
- },
- },
- { { { 8, 15 }, { 0, 1 }, { 8, 21 }, { 74, 53 }, { 22, 42 },
- { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 0, 0 },
- },
- { { 83, 5 }, { 2, 3 }, { 0, 102 }, { 0, 0 }, { 0, 0 },
- { 1, 3 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, { 0, 0 },
- },
- { { 31, 28 }, { 0, 0 }, { 3, 14 }, { 130, 34 }, { 0, 0 },
- { 0, 1 }, { 0, 3 }, { 0, 1 }, { 3, 3 }, { 0, 1 },
- },
- },
- { { { 141, 42 }, { 0, 0 }, { 1, 4 }, { 11, 24 }, { 1, 11 },
- { 0, 1 }, { 0, 1 }, { 0, 2 }, { 0, 0 }, { 0, 0 },
- },
- { { 233, 6 }, { 0, 0 }, { 0, 8 }, { 0, 0 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 },
- },
- { { 171, 25 }, { 0, 0 }, { 1, 5 }, { 25, 21 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- },
- },
- { { { 8, 19 }, { 4, 10 }, { 24, 45 }, { 21, 37 }, { 9, 29 },
- { 0, 3 }, { 1, 7 }, { 11, 25 }, { 0, 2 }, { 0, 1 },
- },
- { { 34, 16 }, { 112, 21 }, { 1, 28 }, { 0, 0 }, { 0, 0 },
- { 6, 8 }, { 1, 7 }, { 0, 3 }, { 2, 5 }, { 0, 2 },
- },
- { { 17, 21 }, { 68, 29 }, { 6, 15 }, { 13, 22 }, { 0, 0 },
- { 6, 12 }, { 3, 14 }, { 4, 10 }, { 1, 7 }, { 0, 3 },
- },
- },
- { { { 46, 42 }, { 0, 1 }, { 2, 10 }, { 54, 51 }, { 10, 30 },
- { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 1 }, { 0, 0 },
- },
- { { 159, 35 }, { 2, 2 }, { 0, 25 }, { 0, 0 }, { 0, 0 },
- { 3, 6 }, { 0, 5 }, { 0, 1 }, { 4, 4 }, { 0, 1 },
- },
- { { 51, 39 }, { 0, 1 }, { 2, 12 }, { 91, 44 }, { 0, 0 },
- { 0, 2 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 1 },
- },
- },
- { { { 28, 32 }, { 0, 0 }, { 3, 10 }, { 75, 51 }, { 14, 33 },
- { 0, 1 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 },
- },
- { { 75, 39 }, { 5, 7 }, { 2, 48 }, { 0, 0 }, { 0, 0 },
- { 3, 11 }, { 2, 16 }, { 1, 4 }, { 7, 10 }, { 0, 2 },
- },
- { { 81, 25 }, { 0, 0 }, { 2, 9 }, { 106, 26 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 },
- },
- },
- { { { 100, 46 }, { 0, 1 }, { 3, 9 }, { 21, 37 }, { 5, 20 },
- { 0, 1 }, { 0, 2 }, { 1, 2 }, { 0, 1 }, { 0, 0 },
- },
- { { 212, 21 }, { 0, 1 }, { 0, 9 }, { 0, 0 }, { 0, 0 },
- { 1, 2 }, { 0, 2 }, { 0, 0 }, { 2, 2 }, { 0, 0 },
- },
- { { 140, 37 }, { 0, 1 }, { 1, 8 }, { 24, 33 }, { 0, 0 },
- { 1, 2 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 },
- },
- },
- { { { 27, 29 }, { 0, 1 }, { 9, 25 }, { 53, 51 }, { 12, 34 },
- { 0, 1 }, { 0, 3 }, { 1, 5 }, { 0, 2 }, { 0, 0 },
- },
- { { 4, 2 }, { 0, 0 }, { 0, 172 }, { 0, 0 }, { 0, 0 },
- { 0, 1 }, { 0, 2 }, { 0, 0 }, { 2, 0 }, { 0, 0 },
- },
- { { 14, 23 }, { 1, 3 }, { 11, 53 }, { 90, 31 }, { 0, 0 },
- { 0, 3 }, { 1, 5 }, { 2, 6 }, { 1, 2 }, { 0, 0 },
- },
- },
- { { { 80, 38 }, { 0, 0 }, { 1, 4 }, { 69, 33 }, { 5, 16 },
- { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 },
- },
- { { 187, 22 }, { 1, 1 }, { 0, 17 }, { 0, 0 }, { 0, 0 },
- { 3, 6 }, { 0, 4 }, { 0, 1 }, { 4, 4 }, { 0, 1 },
- },
- { { 123, 29 }, { 0, 0 }, { 1, 7 }, { 57, 30 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 },
- },
- },
- { { { 16, 20 }, { 0, 0 }, { 2, 8 }, { 104, 49 }, { 15, 33 },
- { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 },
- },
- { { 133, 6 }, { 1, 2 }, { 1, 70 }, { 0, 0 }, { 0, 0 },
- { 0, 2 }, { 0, 4 }, { 0, 3 }, { 1, 1 }, { 0, 0 },
- },
- { { 13, 14 }, { 0, 0 }, { 4, 20 }, { 175, 20 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 },
- },
- },
- { { { 194, 16 }, { 0, 0 }, { 1, 1 }, { 1, 9 }, { 1, 3 },
- { 0, 0 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 },
- },
- { { 251, 1 }, { 0, 0 }, { 0, 2 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- },
- { { 202, 23 }, { 0, 0 }, { 1, 3 }, { 2, 9 }, { 0, 0 },
- { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 },
- },
- },
+static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2] = {
+ { { { 9, 15 }, { 32, 25 }, { 7, 19 }, { 9, 21 }, { 1, 12 },
+ { 14, 12 }, { 3, 18 }, { 14, 23 }, { 3, 10 }, { 0, 4 }, },
+ { { 41, 22 }, { 1, 0 }, { 1, 31 }, { 0, 0 }, { 0, 0 },
+ { 0, 1 }, { 1, 7 }, { 0, 1 }, { 98, 25 }, { 4, 10 }, },
+ { { 2, 3 }, { 2, 3 }, { 0, 2 }, { 0, 2 }, { 0, 0 },
+ { 11, 4 }, { 1, 4 }, { 0, 2 }, { 3, 2 }, { 0, 4 }, }, },
+ { { { 48, 39 }, { 1, 2 }, { 11, 27 }, { 29, 44 }, { 7, 27 },
+ { 1, 4 }, { 0, 3 }, { 1, 6 }, { 1, 2 }, { 0, 0 }, },
+ { { 123, 37 }, { 6, 4 }, { 1, 27 }, { 0, 0 }, { 0, 0 },
+ { 5, 8 }, { 1, 7 }, { 0, 1 }, { 12, 10 }, { 0, 2 }, },
+ { { 49, 46 }, { 3, 4 }, { 7, 31 }, { 42, 41 }, { 0, 0 },
+ { 2, 6 }, { 1, 7 }, { 1, 4 }, { 2, 4 }, { 0, 1 }, }, },
+ { { { 21, 32 }, { 1, 2 }, { 4, 10 }, { 32, 43 }, { 6, 23 },
+ { 2, 3 }, { 1, 19 }, { 1, 6 }, { 12, 21 }, { 0, 7 }, },
+ { { 26, 14 }, { 14, 12 }, { 0, 24 }, { 0, 0 }, { 0, 0 },
+ { 55, 17 }, { 1, 9 }, { 0, 36 }, { 5, 7 }, { 1, 3 }, },
+ { { 26, 25 }, { 1, 1 }, { 2, 10 }, { 67, 39 }, { 0, 0 },
+ { 1, 1 }, { 0, 14 }, { 0, 2 }, { 31, 26 }, { 1, 6 }, }, },
+ { { { 69, 83 }, { 0, 0 }, { 0, 2 }, { 10, 29 }, { 3, 12 },
+ { 0, 1 }, { 0, 3 }, { 0, 3 }, { 2, 2 }, { 0, 0 }, },
+ { { 209, 5 }, { 0, 0 }, { 0, 27 }, { 0, 0 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, },
+ { { 103, 46 }, { 1, 2 }, { 2, 10 }, { 33, 42 }, { 0, 0 },
+ { 1, 4 }, { 0, 3 }, { 0, 1 }, { 1, 3 }, { 0, 0 }, }, },
+ { { { 11, 20 }, { 1, 4 }, { 18, 36 }, { 43, 48 }, { 13, 35 },
+ { 0, 2 }, { 0, 5 }, { 3, 12 }, { 1, 2 }, { 0, 0 }, },
+ { { 2, 5 }, { 4, 5 }, { 0, 121 }, { 0, 0 }, { 0, 0 },
+ { 0, 3 }, { 2, 4 }, { 1, 4 }, { 2, 2 }, { 0, 1 }, },
+ { { 14, 31 }, { 9, 13 }, { 14, 54 }, { 22, 29 }, { 0, 0 },
+ { 2, 6 }, { 4, 18 }, { 6, 13 }, { 1, 5 }, { 0, 1 }, }, },
+ { { { 70, 44 }, { 0, 1 }, { 2, 10 }, { 37, 46 }, { 8, 26 },
+ { 0, 2 }, { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, },
+ { { 175, 5 }, { 0, 1 }, { 0, 48 }, { 0, 0 }, { 0, 0 },
+ { 0, 2 }, { 0, 1 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, },
+ { { 85, 39 }, { 0, 0 }, { 1, 9 }, { 69, 40 }, { 0, 0 },
+ { 0, 1 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 0 }, }, },
+ { { { 8, 15 }, { 0, 1 }, { 8, 21 }, { 74, 53 }, { 22, 42 },
+ { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 0, 0 }, },
+ { { 83, 5 }, { 2, 3 }, { 0, 102 }, { 0, 0 }, { 0, 0 },
+ { 1, 3 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, },
+ { { 31, 28 }, { 0, 0 }, { 3, 14 }, { 130, 34 }, { 0, 0 },
+ { 0, 1 }, { 0, 3 }, { 0, 1 }, { 3, 3 }, { 0, 1 }, }, },
+ { { { 141, 42 }, { 0, 0 }, { 1, 4 }, { 11, 24 }, { 1, 11 },
+ { 0, 1 }, { 0, 1 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, },
+ { { 233, 6 }, { 0, 0 }, { 0, 8 }, { 0, 0 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, },
+ { { 171, 25 }, { 0, 0 }, { 1, 5 }, { 25, 21 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
+ { { { 8, 19 }, { 4, 10 }, { 24, 45 }, { 21, 37 }, { 9, 29 },
+ { 0, 3 }, { 1, 7 }, { 11, 25 }, { 0, 2 }, { 0, 1 }, },
+ { { 34, 16 }, { 112, 21 }, { 1, 28 }, { 0, 0 }, { 0, 0 },
+ { 6, 8 }, { 1, 7 }, { 0, 3 }, { 2, 5 }, { 0, 2 }, },
+ { { 17, 21 }, { 68, 29 }, { 6, 15 }, { 13, 22 }, { 0, 0 },
+ { 6, 12 }, { 3, 14 }, { 4, 10 }, { 1, 7 }, { 0, 3 }, }, },
+ { { { 46, 42 }, { 0, 1 }, { 2, 10 }, { 54, 51 }, { 10, 30 },
+ { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, },
+ { { 159, 35 }, { 2, 2 }, { 0, 25 }, { 0, 0 }, { 0, 0 },
+ { 3, 6 }, { 0, 5 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, },
+ { { 51, 39 }, { 0, 1 }, { 2, 12 }, { 91, 44 }, { 0, 0 },
+ { 0, 2 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 1 }, }, },
+ { { { 28, 32 }, { 0, 0 }, { 3, 10 }, { 75, 51 }, { 14, 33 },
+ { 0, 1 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, },
+ { { 75, 39 }, { 5, 7 }, { 2, 48 }, { 0, 0 }, { 0, 0 },
+ { 3, 11 }, { 2, 16 }, { 1, 4 }, { 7, 10 }, { 0, 2 }, },
+ { { 81, 25 }, { 0, 0 }, { 2, 9 }, { 106, 26 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, },
+ { { { 100, 46 }, { 0, 1 }, { 3, 9 }, { 21, 37 }, { 5, 20 },
+ { 0, 1 }, { 0, 2 }, { 1, 2 }, { 0, 1 }, { 0, 0 }, },
+ { { 212, 21 }, { 0, 1 }, { 0, 9 }, { 0, 0 }, { 0, 0 },
+ { 1, 2 }, { 0, 2 }, { 0, 0 }, { 2, 2 }, { 0, 0 }, },
+ { { 140, 37 }, { 0, 1 }, { 1, 8 }, { 24, 33 }, { 0, 0 },
+ { 1, 2 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, }, },
+ { { { 27, 29 }, { 0, 1 }, { 9, 25 }, { 53, 51 }, { 12, 34 },
+ { 0, 1 }, { 0, 3 }, { 1, 5 }, { 0, 2 }, { 0, 0 }, },
+ { { 4, 2 }, { 0, 0 }, { 0, 172 }, { 0, 0 }, { 0, 0 },
+ { 0, 1 }, { 0, 2 }, { 0, 0 }, { 2, 0 }, { 0, 0 }, },
+ { { 14, 23 }, { 1, 3 }, { 11, 53 }, { 90, 31 }, { 0, 0 },
+ { 0, 3 }, { 1, 5 }, { 2, 6 }, { 1, 2 }, { 0, 0 }, }, },
+ { { { 80, 38 }, { 0, 0 }, { 1, 4 }, { 69, 33 }, { 5, 16 },
+ { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, },
+ { { 187, 22 }, { 1, 1 }, { 0, 17 }, { 0, 0 }, { 0, 0 },
+ { 3, 6 }, { 0, 4 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, },
+ { { 123, 29 }, { 0, 0 }, { 1, 7 }, { 57, 30 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, }, },
+ { { { 16, 20 }, { 0, 0 }, { 2, 8 }, { 104, 49 }, { 15, 33 },
+ { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, },
+ { { 133, 6 }, { 1, 2 }, { 1, 70 }, { 0, 0 }, { 0, 0 },
+ { 0, 2 }, { 0, 4 }, { 0, 3 }, { 1, 1 }, { 0, 0 }, },
+ { { 13, 14 }, { 0, 0 }, { 4, 20 }, { 175, 20 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, },
+ { { { 194, 16 }, { 0, 0 }, { 1, 1 }, { 1, 9 }, { 1, 3 },
+ { 0, 0 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, },
+ { { 251, 1 }, { 0, 0 }, { 0, 2 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, },
+ { { 202, 23 }, { 0, 0 }, { 1, 3 }, { 2, 9 }, { 0, 0 },
+ { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, },
};
-static const uint8_t vp56_filter_threshold[] =
-{
+static const uint8_t vp56_filter_threshold[] = {
14, 14, 13, 13, 12, 12, 10, 10,
10, 10, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 7, 7, 7, 7,
- 7, 7, 6, 6, 6, 6, 6, 6,
- 5, 5, 5, 5, 4, 4, 4, 4,
- 4, 4, 4, 3, 3, 3, 3, 2,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 7, 7, 7, 7,
+ 7, 7, 6, 6, 6, 6, 6, 6,
+ 5, 5, 5, 5, 4, 4, 4, 4,
+ 4, 4, 4, 3, 3, 3, 3, 2,
};
-static const uint8_t vp56_mb_type_model_model[] =
-{
+static const uint8_t vp56_mb_type_model_model[] = {
171, 83, 199, 140, 125, 104,
};
-static const VP56Tree vp56_pmbtm_tree[] =
-{
+static const VP56Tree vp56_pmbtm_tree[] = {
{ 4, 0},
- { 2, 1}, { -8}, { -4},
+ { 2, 1}, {-8}, {-4},
{ 8, 2},
{ 6, 3},
{ 4, 4},
- { 2, 5}, { -24}, { -20}, { -16}, { -12}, { -0},
+ { 2, 5}, {-24}, {-20}, {-16}, {-12}, {-0},
};
-static const VP56Tree vp56_pmbt_tree[] =
-{
+static const VP56Tree vp56_pmbt_tree[] = {
{ 8, 1},
{ 4, 2},
- { 2, 4}, { -VP56_MB_INTER_NOVEC_PF}, { -VP56_MB_INTER_DELTA_PF},
- { 2, 5}, { -VP56_MB_INTER_V1_PF}, { -VP56_MB_INTER_V2_PF},
+ { 2, 4}, {-VP56_MB_INTER_NOVEC_PF}, {-VP56_MB_INTER_DELTA_PF},
+ { 2, 5}, {-VP56_MB_INTER_V1_PF}, {-VP56_MB_INTER_V2_PF},
{ 4, 3},
- { 2, 6}, { -VP56_MB_INTRA}, { -VP56_MB_INTER_4V},
+ { 2, 6}, {-VP56_MB_INTRA}, {-VP56_MB_INTER_4V},
{ 4, 7},
- { 2, 8}, { -VP56_MB_INTER_NOVEC_GF}, { -VP56_MB_INTER_DELTA_GF},
- { 2, 9}, { -VP56_MB_INTER_V1_GF}, { -VP56_MB_INTER_V2_GF},
+ { 2, 8}, {-VP56_MB_INTER_NOVEC_GF}, {-VP56_MB_INTER_DELTA_GF},
+ { 2, 9}, {-VP56_MB_INTER_V1_GF}, {-VP56_MB_INTER_V2_GF},
};
/* relative pos of surrounding blocks, from closest to farthest */
-static const int8_t vp56_candidate_predictor_pos[12][2] =
-{
+static const int8_t vp56_candidate_predictor_pos[12][2] = {
{ 0, -1 },
{ -1, 0 },
{ -1, -1 },
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5data.h
index 9262052fa..64ecb78b8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5data.h
@@ -26,176 +26,147 @@
#include <stdint.h>
-static const uint8_t vp5_coeff_groups[] =
-{
+static const uint8_t vp5_coeff_groups[] = {
-1, 0, 1, 1, 2, 1, 1, 2,
- 2, 1, 1, 2, 2, 2, 1, 2,
- 2, 2, 2, 2, 1, 1, 2, 2,
- 3, 3, 4, 3, 4, 4, 4, 3,
- 3, 3, 3, 3, 4, 3, 3, 3,
- 4, 4, 4, 4, 4, 3, 3, 4,
- 4, 4, 3, 4, 4, 4, 4, 4,
- 4, 4, 5, 5, 5, 5, 5, 5,
+ 2, 1, 1, 2, 2, 2, 1, 2,
+ 2, 2, 2, 2, 1, 1, 2, 2,
+ 3, 3, 4, 3, 4, 4, 4, 3,
+ 3, 3, 3, 3, 4, 3, 3, 3,
+ 4, 4, 4, 4, 4, 3, 3, 4,
+ 4, 4, 3, 4, 4, 4, 4, 4,
+ 4, 4, 5, 5, 5, 5, 5, 5,
};
-static const uint8_t vp5_vmc_pct[2][11] =
-{
+static const uint8_t vp5_vmc_pct[2][11] = {
{ 243, 220, 251, 253, 237, 232, 241, 245, 247, 251, 253 },
{ 235, 211, 246, 249, 234, 231, 248, 249, 252, 252, 254 },
};
-static const uint8_t vp5_dccv_pct[2][11] =
-{
+static const uint8_t vp5_dccv_pct[2][11] = {
{ 146, 197, 181, 207, 232, 243, 238, 251, 244, 250, 249 },
{ 179, 219, 214, 240, 250, 254, 244, 254, 254, 254, 254 },
};
-static const uint8_t vp5_ract_pct[3][2][6][11] =
-{
- { { { 227, 246, 230, 247, 244, 254, 254, 254, 254, 254, 254 },
- { 202, 254, 209, 231, 231, 249, 249, 253, 254, 254, 254 },
- { 206, 254, 225, 242, 241, 251, 253, 254, 254, 254, 254 },
- { 235, 254, 241, 253, 252, 254, 254, 254, 254, 254, 254 },
- { 234, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }
- },
- { { 240, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 238, 254, 240, 253, 254, 254, 254, 254, 254, 254, 254 },
- { 244, 254, 251, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }
- }
- },
- { { { 206, 203, 227, 239, 247, 254, 253, 254, 254, 254, 254 },
- { 207, 199, 220, 236, 243, 252, 252, 254, 254, 254, 254 },
- { 212, 219, 230, 243, 244, 253, 252, 254, 254, 254, 254 },
- { 236, 237, 247, 252, 253, 254, 254, 254, 254, 254, 254 },
- { 240, 240, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }
- },
- { { 230, 233, 249, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 238, 238, 250, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 248, 251, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }
- }
- },
- { { { 225, 239, 227, 231, 244, 253, 243, 254, 254, 253, 254 },
- { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 254 },
- { 235, 249, 238, 240, 251, 254, 249, 254, 253, 253, 254 },
- { 249, 253, 251, 250, 254, 254, 254, 254, 254, 254, 254 },
- { 251, 250, 249, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }
- },
- { { 243, 244, 250, 250, 254, 254, 254, 254, 254, 254, 254 },
- { 249, 248, 250, 253, 254, 254, 254, 254, 254, 254, 254 },
- { 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
- { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }
- }
- },
+static const uint8_t vp5_ract_pct[3][2][6][11] = {
+ { { { 227, 246, 230, 247, 244, 254, 254, 254, 254, 254, 254 },
+ { 202, 254, 209, 231, 231, 249, 249, 253, 254, 254, 254 },
+ { 206, 254, 225, 242, 241, 251, 253, 254, 254, 254, 254 },
+ { 235, 254, 241, 253, 252, 254, 254, 254, 254, 254, 254 },
+ { 234, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } },
+ { { 240, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 238, 254, 240, 253, 254, 254, 254, 254, 254, 254, 254 },
+ { 244, 254, 251, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } },
+ { { { 206, 203, 227, 239, 247, 254, 253, 254, 254, 254, 254 },
+ { 207, 199, 220, 236, 243, 252, 252, 254, 254, 254, 254 },
+ { 212, 219, 230, 243, 244, 253, 252, 254, 254, 254, 254 },
+ { 236, 237, 247, 252, 253, 254, 254, 254, 254, 254, 254 },
+ { 240, 240, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } },
+ { { 230, 233, 249, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 238, 238, 250, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 248, 251, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } },
+ { { { 225, 239, 227, 231, 244, 253, 243, 254, 254, 253, 254 },
+ { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 254 },
+ { 235, 249, 238, 240, 251, 254, 249, 254, 253, 253, 254 },
+ { 249, 253, 251, 250, 254, 254, 254, 254, 254, 254, 254 },
+ { 251, 250, 249, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } },
+ { { 243, 244, 250, 250, 254, 254, 254, 254, 254, 254, 254 },
+ { 249, 248, 250, 253, 254, 254, 254, 254, 254, 254, 254 },
+ { 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
+ { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } },
};
-static const int16_t vp5_dccv_lc[5][36][2] =
-{
- { {154, 61}, {141, 54}, { 90, 45}, { 54, 34}, { 54, 13}, {128, 109},
- {136, 54}, {148, 45}, { 92, 41}, { 54, 33}, { 51, 15}, { 87, 113},
- { 87, 44}, { 97, 40}, { 67, 36}, { 46, 29}, { 41, 15}, { 64, 80},
- { 59, 33}, { 61, 31}, { 51, 28}, { 44, 22}, { 33, 12}, { 49, 63},
- { 69, 12}, { 59, 16}, { 46, 14}, { 31, 13}, { 26, 6}, { 92, 26},
- {128, 108}, { 77, 119}, { 54, 84}, { 26, 71}, { 87, 19}, { 95, 155}
- },
- { {154, 4}, {182, 0}, {159, -8}, {128, -5}, {143, -5}, {187, 55},
- {182, 0}, {228, -3}, {187, -7}, {174, -9}, {189, -11}, {169, 79},
- {161, -9}, {192, -8}, {187, -9}, {169, -10}, {136, -9}, {184, 40},
- {164, -11}, {179, -10}, {174, -10}, {161, -10}, {115, -7}, {197, 20},
- {195, -11}, {195, -11}, {146, -10}, {110, -6}, { 95, -4}, {195, 39},
- {182, 55}, {172, 77}, {177, 37}, {169, 29}, {172, 52}, { 92, 162}
- },
- { {174, 80}, {164, 80}, { 95, 80}, { 46, 66}, { 56, 24}, { 36, 193},
- {164, 80}, {166, 77}, {105, 76}, { 49, 68}, { 46, 31}, { 49, 186},
- { 97, 78}, {110, 74}, { 72, 72}, { 44, 60}, { 33, 30}, { 69, 131},
- { 61, 61}, { 69, 63}, { 51, 57}, { 31, 48}, { 26, 27}, { 64, 89},
- { 67, 23}, { 51, 32}, { 36, 33}, { 26, 28}, { 20, 12}, { 44, 68},
- { 26, 197}, { 41, 189}, { 61, 129}, { 28, 103}, { 49, 52}, { -12, 245}
- },
- { {102, 141}, { 79, 166}, { 72, 162}, { 97, 125}, {179, 4}, {307, 0},
- { 72, 168}, { 69, 175}, { 84, 160}, {105, 127}, {148, 34}, {310, 0},
- { 84, 151}, { 82, 161}, { 87, 153}, { 87, 135}, {115, 51}, {317, 0},
- { 97, 125}, {102, 131}, {105, 125}, { 87, 122}, { 84, 64}, { 54, 184},
- {166, 18}, {146, 43}, {125, 51}, { 90, 64}, { 95, 7}, { 38, 154},
- {294, 0}, { 13, 225}, { 10, 225}, { 67, 168}, { 0, 167}, {161, 94}
- },
- { {172, 76}, {172, 75}, {136, 80}, { 64, 98}, { 74, 67}, {315, 0},
- {169, 76}, {207, 56}, {164, 66}, { 97, 80}, { 67, 72}, {328, 0},
- {136, 80}, {187, 53}, {154, 62}, { 72, 85}, { -2, 105}, {305, 0},
- { 74, 91}, {128, 64}, {113, 64}, { 61, 77}, { 41, 75}, {259, 0},
- { 46, 84}, { 51, 81}, { 28, 89}, { 31, 78}, { 23, 77}, {202, 0},
- {323, 0}, {323, 0}, {300, 0}, {236, 0}, {195, 0}, {328, 0}
- },
+static const int16_t vp5_dccv_lc[5][36][2] = {
+ { {154, 61}, {141, 54}, { 90, 45}, { 54, 34}, { 54, 13}, {128, 109},
+ {136, 54}, {148, 45}, { 92, 41}, { 54, 33}, { 51, 15}, { 87, 113},
+ { 87, 44}, { 97, 40}, { 67, 36}, { 46, 29}, { 41, 15}, { 64, 80},
+ { 59, 33}, { 61, 31}, { 51, 28}, { 44, 22}, { 33, 12}, { 49, 63},
+ { 69, 12}, { 59, 16}, { 46, 14}, { 31, 13}, { 26, 6}, { 92, 26},
+ {128, 108}, { 77, 119}, { 54, 84}, { 26, 71}, { 87, 19}, { 95, 155} },
+ { {154, 4}, {182, 0}, {159, -8}, {128, -5}, {143, -5}, {187, 55},
+ {182, 0}, {228, -3}, {187, -7}, {174, -9}, {189, -11}, {169, 79},
+ {161, -9}, {192, -8}, {187, -9}, {169, -10}, {136, -9}, {184, 40},
+ {164, -11}, {179, -10}, {174, -10}, {161, -10}, {115, -7}, {197, 20},
+ {195, -11}, {195, -11}, {146, -10}, {110, -6}, { 95, -4}, {195, 39},
+ {182, 55}, {172, 77}, {177, 37}, {169, 29}, {172, 52}, { 92, 162} },
+ { {174, 80}, {164, 80}, { 95, 80}, { 46, 66}, { 56, 24}, { 36, 193},
+ {164, 80}, {166, 77}, {105, 76}, { 49, 68}, { 46, 31}, { 49, 186},
+ { 97, 78}, {110, 74}, { 72, 72}, { 44, 60}, { 33, 30}, { 69, 131},
+ { 61, 61}, { 69, 63}, { 51, 57}, { 31, 48}, { 26, 27}, { 64, 89},
+ { 67, 23}, { 51, 32}, { 36, 33}, { 26, 28}, { 20, 12}, { 44, 68},
+ { 26, 197}, { 41, 189}, { 61, 129}, { 28, 103}, { 49, 52}, {-12, 245} },
+ { {102, 141}, { 79, 166}, { 72, 162}, { 97, 125}, {179, 4}, {307, 0},
+ { 72, 168}, { 69, 175}, { 84, 160}, {105, 127}, {148, 34}, {310, 0},
+ { 84, 151}, { 82, 161}, { 87, 153}, { 87, 135}, {115, 51}, {317, 0},
+ { 97, 125}, {102, 131}, {105, 125}, { 87, 122}, { 84, 64}, { 54, 184},
+ {166, 18}, {146, 43}, {125, 51}, { 90, 64}, { 95, 7}, { 38, 154},
+ {294, 0}, { 13, 225}, { 10, 225}, { 67, 168}, { 0, 167}, {161, 94} },
+ { {172, 76}, {172, 75}, {136, 80}, { 64, 98}, { 74, 67}, {315, 0},
+ {169, 76}, {207, 56}, {164, 66}, { 97, 80}, { 67, 72}, {328, 0},
+ {136, 80}, {187, 53}, {154, 62}, { 72, 85}, { -2, 105}, {305, 0},
+ { 74, 91}, {128, 64}, {113, 64}, { 61, 77}, { 41, 75}, {259, 0},
+ { 46, 84}, { 51, 81}, { 28, 89}, { 31, 78}, { 23, 77}, {202, 0},
+ {323, 0}, {323, 0}, {300, 0}, {236, 0}, {195, 0}, {328, 0} },
};
-static const int16_t vp5_ract_lc[3][3][5][6][2] =
-{
- { { { {276, 0}, {238, 0}, {195, 0}, {156, 0}, {113, 0}, {274, 0} },
- { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} },
- { {192, 59}, {182, 50}, {141, 48}, {110, 40}, { 92, 19}, {125, 128} },
- { {169, 87}, {169, 83}, {184, 62}, {220, 16}, {184, 0}, {264, 0} },
- { {212, 40}, {212, 36}, {169, 49}, {174, 27}, { 8, 120}, {182, 71} }
- },
- { { {259, 10}, {197, 19}, {143, 22}, {123, 16}, {110, 8}, {133, 88} },
- { { 0, 1}, {256, 0}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} },
- { {207, 46}, {187, 50}, { 97, 83}, { 23, 100}, { 41, 56}, { 56, 188} },
- { {166, 90}, {146, 108}, {161, 88}, {136, 95}, {174, 0}, {266, 0} },
- { {264, 7}, {243, 18}, {184, 43}, { -14, 154}, { 20, 112}, { 20, 199} }
- },
- { { {230, 26}, {197, 22}, {159, 20}, {146, 12}, {136, 4}, { 54, 162} },
- { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} },
- { {192, 59}, {156, 72}, { 84, 101}, { 49, 101}, { 79, 47}, { 79, 167} },
- { {138, 115}, {136, 116}, {166, 80}, {238, 0}, {195, 0}, {261, 0} },
- { {225, 33}, {205, 42}, {159, 61}, { 79, 96}, { 92, 66}, { 28, 195} }
- },
+static const int16_t vp5_ract_lc[3][3][5][6][2] = {
+ { { { {276, 0}, {238, 0}, {195, 0}, {156, 0}, {113, 0}, {274, 0} },
+ { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} },
+ { {192, 59}, {182, 50}, {141, 48}, {110, 40}, { 92, 19}, {125,128} },
+ { {169, 87}, {169, 83}, {184, 62}, {220, 16}, {184, 0}, {264, 0} },
+ { {212, 40}, {212, 36}, {169, 49}, {174, 27}, { 8,120}, {182, 71} } },
+ { { {259, 10}, {197, 19}, {143, 22}, {123, 16}, {110, 8}, {133, 88} },
+ { { 0, 1}, {256, 0}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} },
+ { {207, 46}, {187, 50}, { 97, 83}, { 23,100}, { 41, 56}, { 56,188} },
+ { {166, 90}, {146,108}, {161, 88}, {136, 95}, {174, 0}, {266, 0} },
+ { {264, 7}, {243, 18}, {184, 43}, {-14,154}, { 20,112}, { 20,199} } },
+ { { {230, 26}, {197, 22}, {159, 20}, {146, 12}, {136, 4}, { 54,162} },
+ { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} },
+ { {192, 59}, {156, 72}, { 84,101}, { 49,101}, { 79, 47}, { 79,167} },
+ { {138,115}, {136,116}, {166, 80}, {238, 0}, {195, 0}, {261, 0} },
+ { {225, 33}, {205, 42}, {159, 61}, { 79, 96}, { 92, 66}, { 28,195} } },
}, {
- { { {200, 37}, {197, 18}, {159, 13}, {143, 7}, {102, 5}, {123, 126} },
- { {197, 3}, {220, -9}, {210, -12}, {187, -6}, {151, -2}, {174, 80} },
- { {200, 53}, {187, 47}, {159, 40}, {118, 38}, {100, 18}, {141, 111} },
- { {179, 78}, {166, 86}, {197, 50}, {207, 27}, {187, 0}, {115, 139} },
- { {218, 34}, {220, 29}, {174, 46}, {128, 61}, { 54, 89}, {187, 65} }
- },
- { { {238, 14}, {197, 18}, {125, 26}, { 90, 25}, { 82, 13}, {161, 86} },
- { {189, 1}, {205, -2}, {156, -4}, {143, -4}, {146, -4}, {172, 72} },
- { {230, 31}, {192, 45}, {102, 76}, { 38, 85}, { 56, 41}, { 64, 173} },
- { {166, 91}, {141, 111}, {128, 116}, {118, 109}, {177, 0}, { 23, 222} },
- { {253, 14}, {236, 21}, {174, 49}, { 33, 118}, { 44, 93}, { 23, 187} }
- },
- { { {218, 28}, {179, 28}, {118, 35}, { 95, 30}, { 72, 24}, {128, 108} },
- { {187, 1}, {174, -1}, {125, -1}, {110, -1}, {108, -1}, {202, 52} },
- { {197, 53}, {146, 75}, { 46, 118}, { 33, 103}, { 64, 50}, {118, 126} },
- { {138, 114}, {128, 122}, {161, 86}, {243, -6}, {195, 0}, { 38, 210} },
- { {215, 39}, {179, 58}, { 97, 101}, { 95, 85}, { 87, 70}, { 69, 152} }
- },
+ { { {200, 37}, {197, 18}, {159, 13}, {143, 7}, {102, 5}, {123,126} },
+ { {197, 3}, {220, -9}, {210,-12}, {187, -6}, {151, -2}, {174, 80} },
+ { {200, 53}, {187, 47}, {159, 40}, {118, 38}, {100, 18}, {141,111} },
+ { {179, 78}, {166, 86}, {197, 50}, {207, 27}, {187, 0}, {115,139} },
+ { {218, 34}, {220, 29}, {174, 46}, {128, 61}, { 54, 89}, {187, 65} } },
+ { { {238, 14}, {197, 18}, {125, 26}, { 90, 25}, { 82, 13}, {161, 86} },
+ { {189, 1}, {205, -2}, {156, -4}, {143, -4}, {146, -4}, {172, 72} },
+ { {230, 31}, {192, 45}, {102, 76}, { 38, 85}, { 56, 41}, { 64,173} },
+ { {166, 91}, {141,111}, {128,116}, {118,109}, {177, 0}, { 23,222} },
+ { {253, 14}, {236, 21}, {174, 49}, { 33,118}, { 44, 93}, { 23,187} } },
+ { { {218, 28}, {179, 28}, {118, 35}, { 95, 30}, { 72, 24}, {128,108} },
+ { {187, 1}, {174, -1}, {125, -1}, {110, -1}, {108, -1}, {202, 52} },
+ { {197, 53}, {146, 75}, { 46,118}, { 33,103}, { 64, 50}, {118,126} },
+ { {138,114}, {128,122}, {161, 86}, {243, -6}, {195, 0}, { 38,210} },
+ { {215, 39}, {179, 58}, { 97,101}, { 95, 85}, { 87, 70}, { 69,152} } },
}, {
- { { {236, 24}, {205, 18}, {172, 12}, {154, 6}, {125, 1}, {169, 75} },
- { {187, 4}, {230, -2}, {228, -4}, {236, -4}, {241, -2}, {192, 66} },
- { {200, 46}, {187, 42}, {159, 34}, {136, 25}, {105, 10}, {179, 62} },
- { {207, 55}, {192, 63}, {192, 54}, {195, 36}, {177, 1}, {143, 98} },
- { {225, 27}, {207, 34}, {200, 30}, {131, 57}, { 97, 60}, {197, 45} }
- },
- { { {271, 8}, {218, 13}, {133, 19}, { 90, 19}, { 72, 7}, {182, 51} },
- { {179, 1}, {225, -1}, {154, -2}, {110, -1}, { 92, 0}, {195, 41} },
- { {241, 26}, {189, 40}, { 82, 64}, { 33, 60}, { 67, 17}, {120, 94} },
- { {192, 68}, {151, 94}, {146, 90}, {143, 72}, {161, 0}, {113, 128} },
- { {256, 12}, {218, 29}, {166, 48}, { 44, 99}, { 31, 87}, {148, 78} }
- },
- { { {238, 20}, {184, 22}, {113, 27}, { 90, 22}, { 74, 9}, {192, 37} },
- { {184, 0}, {215, -1}, {141, -1}, { 97, 0}, { 49, 0}, {264, 13} },
- { {182, 51}, {138, 61}, { 95, 63}, { 54, 59}, { 64, 25}, {200, 45} },
- { {179, 75}, {156, 87}, {174, 65}, {177, 44}, {174, 0}, {164, 85} },
- { {195, 45}, {148, 65}, {105, 79}, { 95, 72}, { 87, 60}, {169, 63} }
- },
+ { { {236, 24}, {205, 18}, {172, 12}, {154, 6}, {125, 1}, {169, 75} },
+ { {187, 4}, {230, -2}, {228, -4}, {236, -4}, {241, -2}, {192, 66} },
+ { {200, 46}, {187, 42}, {159, 34}, {136, 25}, {105, 10}, {179, 62} },
+ { {207, 55}, {192, 63}, {192, 54}, {195, 36}, {177, 1}, {143, 98} },
+ { {225, 27}, {207, 34}, {200, 30}, {131, 57}, { 97, 60}, {197, 45} } },
+ { { {271, 8}, {218, 13}, {133, 19}, { 90, 19}, { 72, 7}, {182, 51} },
+ { {179, 1}, {225, -1}, {154, -2}, {110, -1}, { 92, 0}, {195, 41} },
+ { {241, 26}, {189, 40}, { 82, 64}, { 33, 60}, { 67, 17}, {120, 94} },
+ { {192, 68}, {151, 94}, {146, 90}, {143, 72}, {161, 0}, {113,128} },
+ { {256, 12}, {218, 29}, {166, 48}, { 44, 99}, { 31, 87}, {148, 78} } },
+ { { {238, 20}, {184, 22}, {113, 27}, { 90, 22}, { 74, 9}, {192, 37} },
+ { {184, 0}, {215, -1}, {141, -1}, { 97, 0}, { 49, 0}, {264, 13} },
+ { {182, 51}, {138, 61}, { 95, 63}, { 54, 59}, { 64, 25}, {200, 45} },
+ { {179, 75}, {156, 87}, {174, 65}, {177, 44}, {174, 0}, {164, 85} },
+ { {195, 45}, {148, 65}, {105, 79}, { 95, 72}, { 87, 60}, {169, 63} } },
}
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c
index 4d0c2dcfe..519833bdc 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c
@@ -58,20 +58,17 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
vp56_init_dequant(s, (buf[0] >> 1) & 0x3F);
- if(s->framep[VP56_FRAME_CURRENT]->key_frame)
- {
+ if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
sub_version = buf[1] >> 3;
- if(sub_version > 8)
+ if (sub_version > 8)
return 0;
s->filter_header = buf[1] & 0x06;
- if(buf[1] & 1)
- {
+ if (buf[1] & 1) {
av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
return 0;
}
- if(separated_coeff || !s->filter_header)
- {
- coeff_offset = AV_RB16(buf + 2) - 2;
+ if (separated_coeff || !s->filter_header) {
+ coeff_offset = AV_RB16(buf+2) - 2;
buf += 2;
buf_size -= 2;
}
@@ -81,68 +78,56 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
/* buf[4] is number of displayed macroblock rows */
/* buf[5] is number of displayed macroblock cols */
- if(!s->macroblocks || /* first frame */
- 16 * cols != s->avctx->coded_width ||
- 16 * rows != s->avctx->coded_height)
- {
- avcodec_set_dimensions(s->avctx, 16 * cols, 16 * rows);
- if(s->avctx->extradata_size == 1)
- {
+ if (!s->macroblocks || /* first frame */
+ 16*cols != s->avctx->coded_width ||
+ 16*rows != s->avctx->coded_height) {
+ avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
+ if (s->avctx->extradata_size == 1) {
s->avctx->width -= s->avctx->extradata[0] >> 4;
s->avctx->height -= s->avctx->extradata[0] & 0x0F;
}
res = 2;
}
- vp56_init_range_decoder(c, buf + 6, buf_size - 6);
+ vp56_init_range_decoder(c, buf+6, buf_size-6);
vp56_rac_gets(c, 2);
parse_filter_info = s->filter_header;
- if(sub_version < 8)
+ if (sub_version < 8)
vrt_shift = 5;
s->sub_version = sub_version;
- }
- else
- {
- if(!s->sub_version)
+ } else {
+ if (!s->sub_version)
return 0;
- if(separated_coeff || !s->filter_header)
- {
- coeff_offset = AV_RB16(buf + 1) - 2;
+ if (separated_coeff || !s->filter_header) {
+ coeff_offset = AV_RB16(buf+1) - 2;
buf += 2;
buf_size -= 2;
}
- vp56_init_range_decoder(c, buf + 1, buf_size - 1);
+ vp56_init_range_decoder(c, buf+1, buf_size-1);
*golden_frame = vp56_rac_get(c);
- if(s->filter_header)
- {
+ if (s->filter_header) {
s->deblock_filtering = vp56_rac_get(c);
- if(s->deblock_filtering)
+ if (s->deblock_filtering)
vp56_rac_get(c);
- if(s->sub_version > 7)
+ if (s->sub_version > 7)
parse_filter_info = vp56_rac_get(c);
}
}
- if(parse_filter_info)
- {
- if(vp56_rac_get(c))
- {
+ if (parse_filter_info) {
+ if (vp56_rac_get(c)) {
s->filter_mode = 2;
s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift;
s->max_vector_length = 2 << vp56_rac_gets(c, 3);
- }
- else if(vp56_rac_get(c))
- {
+ } else if (vp56_rac_get(c)) {
s->filter_mode = 1;
- }
- else
- {
+ } else {
s->filter_mode = 0;
}
- if(s->sub_version > 7)
+ if (s->sub_version > 7)
s->filter_selection = vp56_rac_gets(c, 4);
else
s->filter_selection = 16;
@@ -151,25 +136,19 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
s->use_huffman = vp56_rac_get(c);
s->parse_coeff = vp6_parse_coeff;
- if(coeff_offset)
- {
+ if (coeff_offset) {
buf += coeff_offset;
buf_size -= coeff_offset;
- if(buf_size < 0)
+ if (buf_size < 0)
return 0;
- if(s->use_huffman)
- {
+ if (s->use_huffman) {
s->parse_coeff = vp6_parse_coeff_huffman;
- init_get_bits(&s->gb, buf, buf_size << 3);
- }
- else
- {
+ init_get_bits(&s->gb, buf, buf_size<<3);
+ } else {
vp56_init_range_decoder(&s->cc, buf, buf_size);
s->ccp = &s->cc;
}
- }
- else
- {
+ } else {
s->ccp = &s->c;
}
@@ -181,9 +160,9 @@ static void vp6_coeff_order_table_init(VP56Context *s)
int i, pos, idx = 1;
s->modelp->coeff_index_to_pos[0] = 0;
- for(i = 0; i < 16; i++)
- for(pos = 1; pos < 64; pos++)
- if(s->modelp->coeff_reorder[pos] == i)
+ for (i=0; i<16; i++)
+ for (pos=1; pos<64; pos++)
+ if (s->modelp->coeff_reorder[pos] == i)
s->modelp->coeff_index_to_pos[idx++] = pos;
}
@@ -211,22 +190,21 @@ static void vp6_parse_vector_models(VP56Context *s)
VP56Model *model = s->modelp;
int comp, node;
- for(comp = 0; comp < 2; comp++)
- {
- if(vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0]))
+ for (comp=0; comp<2; comp++) {
+ if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0]))
model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
- if(vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1]))
+ if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1]))
model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
}
- for(comp = 0; comp < 2; comp++)
- for(node = 0; node < 7; node++)
- if(vp56_rac_get_prob(c, vp6_pdv_pct[comp][node]))
+ for (comp=0; comp<2; comp++)
+ for (node=0; node<7; node++)
+ if (vp56_rac_get_prob(c, vp6_pdv_pct[comp][node]))
model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
- for(comp = 0; comp < 2; comp++)
- for(node = 0; node < 8; node++)
- if(vp56_rac_get_prob(c, vp6_fdv_pct[comp][node]))
+ for (comp=0; comp<2; comp++)
+ for (node=0; node<8; node++)
+ if (vp56_rac_get_prob(c, vp6_fdv_pct[comp][node]))
model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7);
}
@@ -234,23 +212,22 @@ static void vp6_parse_vector_models(VP56Context *s)
static int vp6_huff_cmp(const void *va, const void *vb)
{
const Node *a = va, *b = vb;
- return (a->count - b->count) * 16 + (b->sym - a->sym);
+ return (a->count - b->count)*16 + (b->sym - a->sym);
}
static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
const uint8_t *map, unsigned size, VLC *vlc)
{
-#if __STDC_VERSION__ >= 199901L
+ #if __STDC_VERSION__ >= 199901L
Node nodes[2*size], *tmp = &nodes[size];
-#else
- Node *nodes = (Node *)alloca(2 * size * sizeof(Node)), *tmp = &nodes[size];
-#endif
+ #else
+ Node *nodes=(Node *)alloca(2*size*sizeof(Node)), *tmp = &nodes[size];
+ #endif
int a, b, i;
/* first compute probabilities from model */
tmp[0].count = 256;
- for(i = 0; i < size - 1; i++)
- {
+ for (i=0; i<size-1; i++) {
a = tmp[i].count * coeff_model[i] >> 8;
b = tmp[i].count * (255 - coeff_model[i]) >> 8;
nodes[map[2*i ]].count = a + !a;
@@ -273,68 +250,57 @@ static void vp6_parse_coeff_models(VP56Context *s)
memset(def_prob, 0x80, sizeof(def_prob));
- for(pt = 0; pt < 2; pt++)
- for(node = 0; node < 11; node++)
- if(vp56_rac_get_prob(c, vp6_dccv_pct[pt][node]))
- {
+ for (pt=0; pt<2; pt++)
+ for (node=0; node<11; node++)
+ if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_dccv[pt][node] = def_prob[node];
- }
- else if(s->framep[VP56_FRAME_CURRENT]->key_frame)
- {
+ } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_dccv[pt][node] = def_prob[node];
}
- if(vp56_rac_get(c))
- {
- for(pos = 1; pos < 64; pos++)
- if(vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos]))
+ if (vp56_rac_get(c)) {
+ for (pos=1; pos<64; pos++)
+ if (vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos]))
model->coeff_reorder[pos] = vp56_rac_gets(c, 4);
vp6_coeff_order_table_init(s);
}
- for(cg = 0; cg < 2; cg++)
- for(node = 0; node < 14; node++)
- if(vp56_rac_get_prob(c, vp6_runv_pct[cg][node]))
+ for (cg=0; cg<2; cg++)
+ for (node=0; node<14; node++)
+ if (vp56_rac_get_prob(c, vp6_runv_pct[cg][node]))
model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7);
- for(ct = 0; ct < 3; ct++)
- for(pt = 0; pt < 2; pt++)
- for(cg = 0; cg < 6; cg++)
- for(node = 0; node < 11; node++)
- if(vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node]))
- {
+ for (ct=0; ct<3; ct++)
+ for (pt=0; pt<2; pt++)
+ for (cg=0; cg<6; cg++)
+ for (node=0; node<11; node++)
+ if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) {
def_prob[node] = vp56_rac_gets_nn(c, 7);
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
- }
- else if(s->framep[VP56_FRAME_CURRENT]->key_frame)
- {
+ } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
model->coeff_ract[pt][ct][cg][node] = def_prob[node];
}
- if(s->use_huffman)
- {
- for(pt = 0; pt < 2; pt++)
- {
+ if (s->use_huffman) {
+ for (pt=0; pt<2; pt++) {
vp6_build_huff_tree(s, model->coeff_dccv[pt],
vp6_huff_coeff_map, 12, &s->dccv_vlc[pt]);
vp6_build_huff_tree(s, model->coeff_runv[pt],
vp6_huff_run_map, 9, &s->runv_vlc[pt]);
- for(ct = 0; ct < 3; ct++)
- for(cg = 0; cg < 6; cg++)
+ for (ct=0; ct<3; ct++)
+ for (cg = 0; cg < 6; cg++)
vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg],
vp6_huff_coeff_map, 12,
&s->ract_vlc[pt][ct][cg]);
}
memset(s->nb_null, 0, sizeof(s->nb_null));
- }
- else
- {
- /* coeff_dcct is a linear combination of coeff_dccv */
- for(pt = 0; pt < 2; pt++)
- for(ctx = 0; ctx < 3; ctx++)
- for(node = 0; node < 5; node++)
- model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255);
+ } else {
+ /* coeff_dcct is a linear combination of coeff_dccv */
+ for (pt=0; pt<2; pt++)
+ for (ctx=0; ctx<3; ctx++)
+ for (node=0; node<5; node++)
+ model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255);
}
}
@@ -344,38 +310,32 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
VP56Model *model = s->modelp;
int comp;
- vect->x = 0;
- vect->y = 0;
- if(s->vector_candidate_pos < 2)
+ vect->x=0;vect->y=0;
+ if (s->vector_candidate_pos < 2)
*vect = s->vector_candidate[0];
- for(comp = 0; comp < 2; comp++)
- {
+ for (comp=0; comp<2; comp++) {
int i, delta = 0;
- if(vp56_rac_get_prob(c, model->vector_dct[comp]))
- {
+ if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4};
- for(i = 0; i < sizeof(prob_order); i++)
- {
+ for (i=0; i<sizeof(prob_order); i++) {
int j = prob_order[i];
- delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][j]) << j;
+ delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][j])<<j;
}
- if(delta & 0xF0)
- delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][3]) << 3;
+ if (delta & 0xF0)
+ delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][3])<<3;
else
delta |= 8;
- }
- else
- {
+ } else {
delta = vp56_rac_get_tree(c, vp56_pva_tree,
model->vector_pdv[comp]);
}
- if(delta && vp56_rac_get_prob(c, model->vector_sig[comp]))
+ if (delta && vp56_rac_get_prob(c, model->vector_sig[comp]))
delta = -delta;
- if(!comp)
+ if (!comp)
vect->x += delta;
else
vect->y += delta;
@@ -389,12 +349,11 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
static unsigned vp6_get_nb_null(VP56Context *s)
{
unsigned val = get_bits(&s->gb, 2);
- if(val == 2)
+ if (val == 2)
val += get_bits(&s->gb, 2);
- else if(val == 3)
- {
+ else if (val == 3) {
val = get_bits1(&s->gb) << 2;
- val = 6 + val + get_bits(&s->gb, 2 + val);
+ val = 6+val + get_bits(&s->gb, 2+val);
}
return val;
}
@@ -408,60 +367,48 @@ static void vp6_parse_coeff_huffman(VP56Context *s)
int b, cg, idx;
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
- for(b = 0; b < 6; b++)
- {
+ for (b=0; b<6; b++) {
int ct = 0; /* code type */
- if(b > 3) pt = 1;
+ if (b > 3) pt = 1;
vlc_coeff = &s->dccv_vlc[pt];
- for(coeff_idx = 0; coeff_idx < 64;)
- {
+ for (coeff_idx=0; coeff_idx<64; ) {
int run = 1;
- if(coeff_idx < 2 && s->nb_null[coeff_idx][pt])
- {
+ if (coeff_idx<2 && s->nb_null[coeff_idx][pt]) {
s->nb_null[coeff_idx][pt]--;
- if(coeff_idx)
+ if (coeff_idx)
break;
- }
- else
- {
- if(get_bits_count(&s->gb) >= s->gb.size_in_bits)
+ } else {
+ if (get_bits_count(&s->gb) >= s->gb.size_in_bits)
return;
coeff = get_vlc2(&s->gb, vlc_coeff->table, 9, 3);
- if(coeff == 0)
- {
- if(coeff_idx)
- {
+ if (coeff == 0) {
+ if (coeff_idx) {
int pt = (coeff_idx >= 6);
run += get_vlc2(&s->gb, s->runv_vlc[pt].table, 9, 3);
- if(run >= 9)
+ if (run >= 9)
run += get_bits(&s->gb, 6);
- }
- else
+ } else
s->nb_null[0][pt] = vp6_get_nb_null(s);
ct = 0;
- }
- else if(coeff == 11) /* end of block */
- {
- if(coeff_idx == 1) /* first AC coeff ? */
+ } else if (coeff == 11) { /* end of block */
+ if (coeff_idx == 1) /* first AC coeff ? */
s->nb_null[1][pt] = vp6_get_nb_null(s);
break;
- }
- else
- {
+ } else {
int coeff2 = vp56_coeff_bias[coeff];
- if(coeff > 4)
+ if (coeff > 4)
coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 : 11);
ct = 1 + (coeff2 > 1);
sign = get_bits1(&s->gb);
coeff2 = (coeff2 ^ -sign) + sign;
- if(coeff_idx)
+ if (coeff_idx)
coeff2 *= s->dequant_ac;
idx = model->coeff_index_to_pos[coeff_idx];
s->block_coeff[b][permute[idx]] = coeff2;
}
}
- coeff_idx += run;
+ coeff_idx+=run;
cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
vlc_coeff = &s->ract_vlc[pt][ct][cg];
}
@@ -478,67 +425,55 @@ static void vp6_parse_coeff(VP56Context *s)
int b, i, cg, idx, ctx;
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
- for(b = 0; b < 6; b++)
- {
+ for (b=0; b<6; b++) {
int ct = 1; /* code type */
int run = 1;
- if(b > 3) pt = 1;
+ if (b > 3) pt = 1;
ctx = s->left_block[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];
- for(coeff_idx = 0; coeff_idx < 64;)
- {
- if((coeff_idx > 1 && ct == 0) || vp56_rac_get_prob(c, model2[0]))
- {
+ for (coeff_idx=0; coeff_idx<64; ) {
+ if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
/* parse a coeff */
- if(vp56_rac_get_prob(c, model2[2]))
- {
- if(vp56_rac_get_prob(c, model2[3]))
- {
+ 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--)
+ for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
- }
- else
- {
- if(vp56_rac_get_prob(c, model2[4]))
+ } else {
+ if (vp56_rac_get_prob(c, model2[4]))
coeff = 3 + vp56_rac_get_prob(c, model1[5]);
else
coeff = 2;
}
ct = 2;
- }
- else
- {
+ } else {
ct = 1;
coeff = 1;
}
sign = vp56_rac_get(c);
coeff = (coeff ^ -sign) + sign;
- if(coeff_idx)
+ if (coeff_idx)
coeff *= s->dequant_ac;
idx = model->coeff_index_to_pos[coeff_idx];
s->block_coeff[b][permute[idx]] = coeff;
run = 1;
- }
- else
- {
+ } else {
/* parse a run */
ct = 0;
- if(coeff_idx > 0)
- {
- if(!vp56_rac_get_prob(c, model2[1]))
+ if (coeff_idx > 0) {
+ if (!vp56_rac_get_prob(c, model2[1]))
break;
model3 = model->coeff_runv[coeff_idx >= 6];
run = vp56_rac_get_tree(c, vp6_pcr_tree, model3);
- if(!run)
- for(run = 9, i = 0; i < 6; i++)
+ if (!run)
+ for (run=9, i=0; i<6; i++)
run += vp56_rac_get_prob(c, model3[i+8]) << i;
}
}
@@ -548,7 +483,7 @@ static void vp6_parse_coeff(VP56Context *s)
}
s->left_block[vp56_b6to4[b]].not_null_dc =
- s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];
+ s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];
}
}
@@ -557,9 +492,9 @@ static int vp6_adjust(int v, int t)
int V = v, s = v >> 31;
V ^= s;
V -= s;
- if(V - t - 1 >= (unsigned)(t - 1))
+ if (V-t-1 >= (unsigned)(t-1))
return v;
- V = 2 * t - V;
+ V = 2*t - V;
V += s;
V ^= s;
return V;
@@ -570,16 +505,14 @@ static int vp6_block_variance(uint8_t *src, int stride)
int sum = 0, square_sum = 0;
int y, x;
- for(y = 0; y < 8; y += 2)
- {
- for(x = 0; x < 8; x += 2)
- {
+ for (y=0; y<8; y+=2) {
+ for (x=0; x<8; x+=2) {
sum += src[x];
- square_sum += src[x] * src[x];
+ square_sum += src[x]*src[x];
}
- src += 2 * stride;
+ src += 2*stride;
}
- return (16 * square_sum - sum * sum) >> 8;
+ return (16*square_sum - sum*sum) >> 8;
}
static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride,
@@ -587,14 +520,12 @@ static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride,
{
int x, y;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = av_clip_uint8((src[x-delta ] * weights[0]
- + src[x ] * weights[1]
- + src[x+delta ] * weights[2]
- + src[x+2*delta] * weights[3] + 64) >> 7);
+ for (y=0; y<8; y++) {
+ for (x=0; x<8; x++) {
+ dst[x] = av_clip_uint8(( src[x-delta ] * weights[0]
+ + src[x ] * weights[1]
+ + src[x+delta ] * weights[2]
+ + src[x+2*delta] * weights[3] + 64) >> 7);
}
src += stride;
dst += stride;
@@ -604,7 +535,7 @@ static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride,
static void vp6_filter_diag2(VP56Context *s, uint8_t *dst, uint8_t *src,
int stride, int h_weight, int v_weight)
{
- uint8_t *tmp = s->edge_emu_buffer + 16;
+ uint8_t *tmp = s->edge_emu_buffer+16;
s->dsp.put_h264_chroma_pixels_tab[0](tmp, src, stride, 9, h_weight, 0);
s->dsp.put_h264_chroma_pixels_tab[0](dst, tmp, stride, 8, 0, v_weight);
}
@@ -617,61 +548,44 @@ static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src,
int x8 = mv.x & mask;
int y8 = mv.y & mask;
- if(luma)
- {
+ if (luma) {
x8 *= 2;
y8 *= 2;
filter4 = s->filter_mode;
- if(filter4 == 2)
- {
- if(s->max_vector_length &&
- (FFABS(mv.x) > s->max_vector_length ||
- FFABS(mv.y) > s->max_vector_length))
- {
+ if (filter4 == 2) {
+ if (s->max_vector_length &&
+ (FFABS(mv.x) > s->max_vector_length ||
+ FFABS(mv.y) > s->max_vector_length)) {
filter4 = 0;
- }
- else if(s->sample_variance_threshold
- && (vp6_block_variance(src + offset1, stride)
- < s->sample_variance_threshold))
- {
+ } else if (s->sample_variance_threshold
+ && (vp6_block_variance(src+offset1, stride)
+ < s->sample_variance_threshold)) {
filter4 = 0;
}
}
}
- if((y8 && (offset2 - offset1)*s->flip < 0) || (!y8 && offset1 > offset2))
- {
+ if ((y8 && (offset2-offset1)*s->flip<0) || (!y8 && offset1 > offset2)) {
offset1 = offset2;
}
- if(filter4)
- {
- if(!y8) /* left or right combine */
- {
- vp6_filter_hv4(dst, src + offset1, stride, 1,
+ if (filter4) {
+ if (!y8) { /* left or right combine */
+ vp6_filter_hv4(dst, src+offset1, stride, 1,
vp6_block_copy_filter[select][x8]);
- }
- else if(!x8) /* above or below combine */
- {
- vp6_filter_hv4(dst, src + offset1, stride, stride,
+ } else if (!x8) { /* above or below combine */
+ vp6_filter_hv4(dst, src+offset1, stride, stride,
vp6_block_copy_filter[select][y8]);
+ } else {
+ s->dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride,
+ vp6_block_copy_filter[select][x8],
+ vp6_block_copy_filter[select][y8]);
}
- else
- {
- s->dsp.vp6_filter_diag4(dst, src + offset1 + ((mv.x ^ mv.y) >> 31), stride,
- vp6_block_copy_filter[select][x8],
- vp6_block_copy_filter[select][y8]);
- }
- }
- else
- {
- if(!x8 || !y8)
- {
- s->dsp.put_h264_chroma_pixels_tab[0](dst, src + offset1, stride, 8, x8, y8);
- }
- else
- {
- vp6_filter_diag2(s, dst, src + offset1 + ((mv.x ^ mv.y) >> 31), stride, x8, y8);
+ } else {
+ if (!x8 || !y8) {
+ s->dsp.put_h264_chroma_pixels_tab[0](dst, src+offset1, stride, 8, x8, y8);
+ } else {
+ vp6_filter_diag2(s, dst, src+offset1 + ((mv.x^mv.y)>>31), stride, x8, y8);
}
}
}
@@ -681,7 +595,7 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
VP56Context *s = avctx->priv_data;
vp56_init(avctx, avctx->codec->id == CODEC_ID_VP6,
- avctx->codec->id == CODEC_ID_VP6A);
+ avctx->codec->id == CODEC_ID_VP6A);
s->vp56_coord_div = vp6_coord_div;
s->parse_vector_adjustment = vp6_parse_vector_adjustment;
s->adjust = vp6_adjust;
@@ -694,8 +608,7 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
return 0;
}
-AVCodec vp6_decoder =
-{
+AVCodec vp6_decoder = {
"vp6",
CODEC_TYPE_VIDEO,
CODEC_ID_VP6,
@@ -713,8 +626,7 @@ AVCodec vp6_decoder =
};
/* flash version, not flipped upside-down */
-AVCodec vp6f_decoder =
-{
+AVCodec vp6f_decoder = {
"vp6f",
CODEC_TYPE_VIDEO,
CODEC_ID_VP6F,
@@ -732,8 +644,7 @@ AVCodec vp6f_decoder =
};
/* flash version, not flipped upside-down, with alpha channel */
-AVCodec vp6a_decoder =
-{
+AVCodec vp6a_decoder = {
"vp6a",
CODEC_TYPE_VIDEO,
CODEC_ID_VP6A,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6data.h
index 6a08a501c..f57115c0a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6data.h
@@ -26,62 +26,53 @@
#include "vp56data.h"
-static const uint8_t vp6_def_fdv_vector_model[2][8] =
-{
+static const uint8_t vp6_def_fdv_vector_model[2][8] = {
{ 247, 210, 135, 68, 138, 220, 239, 246 },
{ 244, 184, 201, 44, 173, 221, 239, 253 },
};
-static const uint8_t vp6_def_pdv_vector_model[2][7] =
-{
+static const uint8_t vp6_def_pdv_vector_model[2][7] = {
{ 225, 146, 172, 147, 214, 39, 156 },
{ 204, 170, 119, 235, 140, 230, 228 },
};
-static const uint8_t vp6_def_coeff_reorder[] =
-{
- 0, 0, 1, 1, 1, 2, 2, 2,
- 2, 2, 2, 3, 3, 4, 4, 4,
- 5, 5, 5, 5, 6, 6, 7, 7,
- 7, 7, 7, 8, 8, 9, 9, 9,
- 9, 9, 9, 10, 10, 11, 11, 11,
+static const uint8_t vp6_def_coeff_reorder[] = {
+ 0, 0, 1, 1, 1, 2, 2, 2,
+ 2, 2, 2, 3, 3, 4, 4, 4,
+ 5, 5, 5, 5, 6, 6, 7, 7,
+ 7, 7, 7, 8, 8, 9, 9, 9,
+ 9, 9, 9, 10, 10, 11, 11, 11,
11, 11, 11, 12, 12, 12, 12, 12,
12, 13, 13, 13, 13, 13, 14, 14,
14, 14, 15, 15, 15, 15, 15, 15,
};
-static const uint8_t vp6_def_runv_coeff_model[2][14] =
-{
+static const uint8_t vp6_def_runv_coeff_model[2][14] = {
{ 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 },
{ 135, 201, 181, 154, 98, 117, 132, 126, 146, 169, 184, 240, 246, 254 },
};
-static const uint8_t vp6_sig_dct_pct[2][2] =
-{
+static const uint8_t vp6_sig_dct_pct[2][2] = {
{ 237, 246 },
{ 231, 243 },
};
-static const uint8_t vp6_pdv_pct[2][7] =
-{
+static const uint8_t vp6_pdv_pct[2][7] = {
{ 253, 253, 254, 254, 254, 254, 254 },
{ 245, 253, 254, 254, 254, 254, 254 },
};
-static const uint8_t vp6_fdv_pct[2][8] =
-{
+static const uint8_t vp6_fdv_pct[2][8] = {
{ 254, 254, 254, 254, 254, 250, 250, 252 },
{ 254, 254, 254, 254, 254, 251, 251, 254 },
};
-static const uint8_t vp6_dccv_pct[2][11] =
-{
+static const uint8_t vp6_dccv_pct[2][11] = {
{ 146, 255, 181, 207, 232, 243, 238, 251, 244, 250, 249 },
{ 179, 255, 214, 240, 250, 255, 244, 255, 255, 255, 255 },
};
-static const uint8_t vp6_coeff_reorder_pct[] =
-{
+static const uint8_t vp6_coeff_reorder_pct[] = {
255, 132, 132, 159, 153, 151, 161, 170,
164, 162, 136, 110, 103, 114, 129, 118,
124, 125, 132, 136, 114, 110, 142, 135,
@@ -92,70 +83,57 @@ static const uint8_t vp6_coeff_reorder_pct[] =
255, 255, 255, 255, 255, 255, 255, 255,
};
-static const uint8_t vp6_runv_pct[2][14] =
-{
- { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 },
- { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 },
+static const uint8_t vp6_runv_pct[2][14] = {
+ { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 },
+ { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 },
};
-static const uint8_t vp6_ract_pct[3][2][6][11] =
-{
- { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 },
- { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 },
- { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
- },
- { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
- }
- },
- { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 },
- { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 },
- { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 },
- { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 },
- { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
- },
- { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
- }
- },
- { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 },
- { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 },
- { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 },
- { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 },
- { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
- },
- { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 },
- { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 },
- { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
- { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
- }
- }
+static const uint8_t vp6_ract_pct[3][2][6][11] = {
+ { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 },
+ { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 },
+ { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
+ { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } },
+ { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 },
+ { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 },
+ { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 },
+ { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 },
+ { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
+ { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } },
+ { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 },
+ { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 },
+ { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 },
+ { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 },
+ { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
+ { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 },
+ { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 },
+ { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
+ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }
};
-static const int vp6_dccv_lc[3][5][2] =
-{
- { { 122, 133 }, { 0, 1 }, { 78, 171 }, { 139, 117 }, { 168, 79 } },
- { { 133, 51 }, { 0, 1 }, { 169, 71 }, { 214, 44 }, { 210, 38 } },
- { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246, -3 }, { 203, 17 } },
+static const int vp6_dccv_lc[3][5][2] = {
+ { { 122, 133 }, { 0, 1 }, { 78, 171 }, { 139, 117 }, { 168, 79 } },
+ { { 133, 51 }, { 0, 1 }, { 169, 71 }, { 214, 44 }, { 210, 38 } },
+ { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246, -3 }, { 203, 17 } },
};
-static const uint8_t vp6_coeff_groups[] =
-{
+static const uint8_t vp6_coeff_groups[] = {
0, 0, 1, 1, 1, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 4, 4,
@@ -166,185 +144,164 @@ static const uint8_t vp6_coeff_groups[] =
5, 5, 5, 5, 5, 5, 5, 5,
};
-static const int16_t vp6_block_copy_filter[17][8][4] =
-{
- { { 0, 128, 0, 0 }, /* 0 */
- { -3, 122, 9, 0 },
- { -4, 109, 24, -1 },
- { -5, 91, 45, -3 },
- { -4, 68, 68, -4 },
- { -3, 45, 91, -5 },
- { -1, 24, 109, -4 },
- { 0, 9, 122, -3 }
- },
- { { 0, 128, 0, 0 }, /* 1 */
- { -4, 124, 9, -1 },
- { -5, 110, 25, -2 },
- { -6, 91, 46, -3 },
- { -5, 69, 69, -5 },
- { -3, 46, 91, -6 },
- { -2, 25, 110, -5 },
- { -1, 9, 124, -4 }
- },
- { { 0, 128, 0, 0 }, /* 2 */
- { -4, 123, 10, -1 },
- { -6, 110, 26, -2 },
- { -7, 92, 47, -4 },
- { -6, 70, 70, -6 },
- { -4, 47, 92, -7 },
- { -2, 26, 110, -6 },
- { -1, 10, 123, -4 }
- },
- { { 0, 128, 0, 0 }, /* 3 */
- { -5, 124, 10, -1 },
- { -7, 110, 27, -2 },
- { -7, 91, 48, -4 },
- { -6, 70, 70, -6 },
- { -4, 48, 92, -8 },
- { -2, 27, 110, -7 },
- { -1, 10, 124, -5 }
- },
- { { 0, 128, 0, 0 }, /* 4 */
- { -6, 124, 11, -1 },
- { -8, 111, 28, -3 },
- { -8, 92, 49, -5 },
- { -7, 71, 71, -7 },
- { -5, 49, 92, -8 },
- { -3, 28, 111, -8 },
- { -1, 11, 124, -6 }
- },
- { { 0, 128, 0, 0 }, /* 5 */
- { -6, 123, 12, -1 },
- { -9, 111, 29, -3 },
- { -9, 93, 50, -6 },
- { -8, 72, 72, -8 },
- { -6, 50, 93, -9 },
- { -3, 29, 111, -9 },
- { -1, 12, 123, -6 }
- },
- { { 0, 128, 0, 0 }, /* 6 */
- { -7, 124, 12, -1 },
- { -10, 111, 30, -3 },
- { -10, 93, 51, -6 },
- { -9, 73, 73, -9 },
- { -6, 51, 93, -10 },
- { -3, 30, 111, -10 },
- { -1, 12, 124, -7 }
- },
- { { 0, 128, 0, 0 }, /* 7 */
- { -7, 123, 13, -1 },
- { -11, 112, 31, -4 },
- { -11, 94, 52, -7 },
- { -10, 74, 74, -10 },
- { -7, 52, 94, -11 },
- { -4, 31, 112, -11 },
- { -1, 13, 123, -7 }
- },
- { { 0, 128, 0, 0 }, /* 8 */
- { -8, 124, 13, -1 },
- { -12, 112, 32, -4 },
- { -12, 94, 53, -7 },
- { -10, 74, 74, -10 },
- { -7, 53, 94, -12 },
- { -4, 32, 112, -12 },
- { -1, 13, 124, -8 }
- },
- { { 0, 128, 0, 0 }, /* 9 */
- { -9, 124, 14, -1 },
- { -13, 112, 33, -4 },
- { -13, 95, 54, -8 },
- { -11, 75, 75, -11 },
- { -8, 54, 95, -13 },
- { -4, 33, 112, -13 },
- { -1, 14, 124, -9 }
- },
- { { 0, 128, 0, 0 }, /* 10 */
- { -9, 123, 15, -1 },
- { -14, 113, 34, -5 },
- { -14, 95, 55, -8 },
- { -12, 76, 76, -12 },
- { -8, 55, 95, -14 },
- { -5, 34, 112, -13 },
- { -1, 15, 123, -9 }
- },
- { { 0, 128, 0, 0 }, /* 11 */
- { -10, 124, 15, -1 },
- { -14, 113, 34, -5 },
- { -15, 96, 56, -9 },
- { -13, 77, 77, -13 },
- { -9, 56, 96, -15 },
- { -5, 34, 113, -14 },
- { -1, 15, 124, -10 }
- },
- { { 0, 128, 0, 0 }, /* 12 */
- { -10, 123, 16, -1 },
- { -15, 113, 35, -5 },
- { -16, 98, 56, -10 },
- { -14, 78, 78, -14 },
- { -10, 56, 98, -16 },
- { -5, 35, 113, -15 },
- { -1, 16, 123, -10 }
- },
- { { 0, 128, 0, 0 }, /* 13 */
- { -11, 124, 17, -2 },
- { -16, 113, 36, -5 },
- { -17, 98, 57, -10 },
- { -14, 78, 78, -14 },
- { -10, 57, 98, -17 },
- { -5, 36, 113, -16 },
- { -2, 17, 124, -11 }
- },
- { { 0, 128, 0, 0 }, /* 14 */
- { -12, 125, 17, -2 },
- { -17, 114, 37, -6 },
- { -18, 99, 58, -11 },
- { -15, 79, 79, -15 },
- { -11, 58, 99, -18 },
- { -6, 37, 114, -17 },
- { -2, 17, 125, -12 }
- },
- { { 0, 128, 0, 0 }, /* 15 */
- { -12, 124, 18, -2 },
- { -18, 114, 38, -6 },
- { -19, 99, 59, -11 },
- { -16, 80, 80, -16 },
- { -11, 59, 99, -19 },
- { -6, 38, 114, -18 },
- { -2, 18, 124, -12 }
- },
- { { 0, 128, 0, 0 }, /* 16 */
- { -4, 118, 16, -2 },
- { -7, 106, 34, -5 },
- { -8, 90, 53, -7 },
- { -8, 72, 72, -8 },
- { -7, 53, 90, -8 },
- { -5, 34, 106, -7 },
- { -2, 16, 118, -4 }
- },
+static const int16_t vp6_block_copy_filter[17][8][4] = {
+ { { 0, 128, 0, 0 }, /* 0 */
+ { -3, 122, 9, 0 },
+ { -4, 109, 24, -1 },
+ { -5, 91, 45, -3 },
+ { -4, 68, 68, -4 },
+ { -3, 45, 91, -5 },
+ { -1, 24, 109, -4 },
+ { 0, 9, 122, -3 } },
+ { { 0, 128, 0, 0 }, /* 1 */
+ { -4, 124, 9, -1 },
+ { -5, 110, 25, -2 },
+ { -6, 91, 46, -3 },
+ { -5, 69, 69, -5 },
+ { -3, 46, 91, -6 },
+ { -2, 25, 110, -5 },
+ { -1, 9, 124, -4 } },
+ { { 0, 128, 0, 0 }, /* 2 */
+ { -4, 123, 10, -1 },
+ { -6, 110, 26, -2 },
+ { -7, 92, 47, -4 },
+ { -6, 70, 70, -6 },
+ { -4, 47, 92, -7 },
+ { -2, 26, 110, -6 },
+ { -1, 10, 123, -4 } },
+ { { 0, 128, 0, 0 }, /* 3 */
+ { -5, 124, 10, -1 },
+ { -7, 110, 27, -2 },
+ { -7, 91, 48, -4 },
+ { -6, 70, 70, -6 },
+ { -4, 48, 92, -8 },
+ { -2, 27, 110, -7 },
+ { -1, 10, 124, -5 } },
+ { { 0, 128, 0, 0 }, /* 4 */
+ { -6, 124, 11, -1 },
+ { -8, 111, 28, -3 },
+ { -8, 92, 49, -5 },
+ { -7, 71, 71, -7 },
+ { -5, 49, 92, -8 },
+ { -3, 28, 111, -8 },
+ { -1, 11, 124, -6 } },
+ { { 0, 128, 0, 0 }, /* 5 */
+ { -6, 123, 12, -1 },
+ { -9, 111, 29, -3 },
+ { -9, 93, 50, -6 },
+ { -8, 72, 72, -8 },
+ { -6, 50, 93, -9 },
+ { -3, 29, 111, -9 },
+ { -1, 12, 123, -6 } },
+ { { 0, 128, 0, 0 }, /* 6 */
+ { -7, 124, 12, -1 },
+ { -10, 111, 30, -3 },
+ { -10, 93, 51, -6 },
+ { -9, 73, 73, -9 },
+ { -6, 51, 93, -10 },
+ { -3, 30, 111, -10 },
+ { -1, 12, 124, -7 } },
+ { { 0, 128, 0, 0 }, /* 7 */
+ { -7, 123, 13, -1 },
+ { -11, 112, 31, -4 },
+ { -11, 94, 52, -7 },
+ { -10, 74, 74, -10 },
+ { -7, 52, 94, -11 },
+ { -4, 31, 112, -11 },
+ { -1, 13, 123, -7 } },
+ { { 0, 128, 0, 0 }, /* 8 */
+ { -8, 124, 13, -1 },
+ { -12, 112, 32, -4 },
+ { -12, 94, 53, -7 },
+ { -10, 74, 74, -10 },
+ { -7, 53, 94, -12 },
+ { -4, 32, 112, -12 },
+ { -1, 13, 124, -8 } },
+ { { 0, 128, 0, 0 }, /* 9 */
+ { -9, 124, 14, -1 },
+ { -13, 112, 33, -4 },
+ { -13, 95, 54, -8 },
+ { -11, 75, 75, -11 },
+ { -8, 54, 95, -13 },
+ { -4, 33, 112, -13 },
+ { -1, 14, 124, -9 } },
+ { { 0, 128, 0, 0 }, /* 10 */
+ { -9, 123, 15, -1 },
+ { -14, 113, 34, -5 },
+ { -14, 95, 55, -8 },
+ { -12, 76, 76, -12 },
+ { -8, 55, 95, -14 },
+ { -5, 34, 112, -13 },
+ { -1, 15, 123, -9 } },
+ { { 0, 128, 0, 0 }, /* 11 */
+ { -10, 124, 15, -1 },
+ { -14, 113, 34, -5 },
+ { -15, 96, 56, -9 },
+ { -13, 77, 77, -13 },
+ { -9, 56, 96, -15 },
+ { -5, 34, 113, -14 },
+ { -1, 15, 124, -10 } },
+ { { 0, 128, 0, 0 }, /* 12 */
+ { -10, 123, 16, -1 },
+ { -15, 113, 35, -5 },
+ { -16, 98, 56, -10 },
+ { -14, 78, 78, -14 },
+ { -10, 56, 98, -16 },
+ { -5, 35, 113, -15 },
+ { -1, 16, 123, -10 } },
+ { { 0, 128, 0, 0 }, /* 13 */
+ { -11, 124, 17, -2 },
+ { -16, 113, 36, -5 },
+ { -17, 98, 57, -10 },
+ { -14, 78, 78, -14 },
+ { -10, 57, 98, -17 },
+ { -5, 36, 113, -16 },
+ { -2, 17, 124, -11 } },
+ { { 0, 128, 0, 0 }, /* 14 */
+ { -12, 125, 17, -2 },
+ { -17, 114, 37, -6 },
+ { -18, 99, 58, -11 },
+ { -15, 79, 79, -15 },
+ { -11, 58, 99, -18 },
+ { -6, 37, 114, -17 },
+ { -2, 17, 125, -12 } },
+ { { 0, 128, 0, 0 }, /* 15 */
+ { -12, 124, 18, -2 },
+ { -18, 114, 38, -6 },
+ { -19, 99, 59, -11 },
+ { -16, 80, 80, -16 },
+ { -11, 59, 99, -19 },
+ { -6, 38, 114, -18 },
+ { -2, 18, 124, -12 } },
+ { { 0, 128, 0, 0 }, /* 16 */
+ { -4, 118, 16, -2 },
+ { -7, 106, 34, -5 },
+ { -8, 90, 53, -7 },
+ { -8, 72, 72, -8 },
+ { -7, 53, 90, -8 },
+ { -5, 34, 106, -7 },
+ { -2, 16, 118, -4 } },
};
-static const VP56Tree vp6_pcr_tree[] =
-{
+static const VP56Tree vp6_pcr_tree[] = {
{ 8, 0},
{ 4, 1},
- { 2, 2}, { -1}, { -2},
- { 2, 3}, { -3}, { -4},
+ { 2, 2}, {-1}, {-2},
+ { 2, 3}, {-3}, {-4},
{ 8, 4},
{ 4, 5},
- { 2, 6}, { -5}, { -6},
- { 2, 7}, { -7}, { -8},
- { -0},
+ { 2, 6}, {-5}, {-6},
+ { 2, 7}, {-7}, {-8},
+ {-0},
};
static const uint8_t vp6_coord_div[] = { 4, 4, 4, 4, 8, 8 };
-static const uint8_t vp6_huff_coeff_map[] =
-{
+static const uint8_t vp6_huff_coeff_map[] = {
13, 14, 11, 0, 1, 15, 16, 18, 2, 17, 3, 4, 19, 20, 5, 6, 21, 22, 7, 8, 9, 10
};
-static const uint8_t vp6_huff_run_map[] =
-{
+static const uint8_t vp6_huff_run_map[] = {
10, 13, 11, 12, 0, 1, 2, 3, 14, 8, 15, 16, 4, 5, 6, 7
};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6dsp.c
index 14274fbae..f4b7670d7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6dsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6dsp.c
@@ -34,28 +34,24 @@ void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
src -= stride;
- for(y = 0; y < 11; y++)
- {
- for(x = 0; x < 8; x++)
- {
- t[x] = av_clip_uint8((src[x-1] * h_weights[0]
- + src[x ] * h_weights[1]
- + src[x+1] * h_weights[2]
- + src[x+2] * h_weights[3] + 64) >> 7);
+ for (y=0; y<11; y++) {
+ for (x=0; x<8; x++) {
+ t[x] = av_clip_uint8(( src[x-1] * h_weights[0]
+ + src[x ] * h_weights[1]
+ + src[x+1] * h_weights[2]
+ + src[x+2] * h_weights[3] + 64) >> 7);
}
src += stride;
t += 8;
}
t = tmp + 8;
- for(y = 0; y < 8; y++)
- {
- for(x = 0; x < 8; x++)
- {
- dst[x] = av_clip_uint8((t[x-8 ] * v_weights[0]
- + t[x ] * v_weights[1]
- + t[x+8 ] * v_weights[2]
- + t[x+16] * v_weights[3] + 64) >> 7);
+ for (y=0; y<8; y++) {
+ for (x=0; x<8; x++) {
+ dst[x] = av_clip_uint8(( t[x-8 ] * v_weights[0]
+ + t[x ] * v_weights[1]
+ + t[x+8 ] * v_weights[2]
+ + t[x+16] * v_weights[3] + 64) >> 7);
}
dst += stride;
t += 8;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/w32thread.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/w32thread.c
index dda15f295..295a87a35 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/w32thread.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/w32thread.c
@@ -25,8 +25,7 @@
#include <windows.h>
#include <process.h>
-typedef struct ThreadContext
-{
+typedef struct ThreadContext{
AVCodecContext *avctx;
HANDLE thread;
HANDLE work_sem;
@@ -39,30 +38,28 @@ typedef struct ThreadContext
int *jobnr;
int *ret;
int threadnr;
-} ThreadContext;
+}ThreadContext;
-static unsigned WINAPI attribute_align_arg thread_func(void *v)
-{
- ThreadContext *c = v;
+static unsigned WINAPI attribute_align_arg thread_func(void *v){
+ ThreadContext *c= v;
- for(;;)
- {
+ for(;;){
int ret, jobnr;
//printf("thread_func %X enter wait\n", (int)v); fflush(stdout);
WaitForSingleObject(c->work_sem, INFINITE);
// avoid trying to access jobnr if we should quit
- if(!c->func && !c->func2)
+ if (!c->func && !c->func2)
break;
WaitForSingleObject(c->job_sem, INFINITE);
jobnr = (*c->jobnr)++;
ReleaseSemaphore(c->job_sem, 1, 0);
//printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout);
if(c->func)
- ret = c->func(c->avctx, (uint8_t *)c->arg + jobnr * c->argsize);
+ ret= c->func(c->avctx, (uint8_t *)c->arg + jobnr*c->argsize);
else
- ret = c->func2(c->avctx, c->arg, jobnr, c->threadnr);
- if(c->ret)
+ ret= c->func2(c->avctx, c->arg, jobnr, c->threadnr);
+ if (c->ret)
c->ret[jobnr] = ret;
//printf("thread_func %X signal complete\n", (int)v); fflush(stdout);
ReleaseSemaphore(c->done_sem, 1, 0);
@@ -75,20 +72,17 @@ static unsigned WINAPI attribute_align_arg thread_func(void *v)
* Free what has been allocated by avcodec_thread_init().
* Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.
*/
-void avcodec_thread_free(AVCodecContext *s)
-{
- ThreadContext *c = s->thread_opaque;
+void avcodec_thread_free(AVCodecContext *s){
+ ThreadContext *c= s->thread_opaque;
int i;
- for(i = 0; i < s->thread_count; i++)
- {
+ for(i=0; i<s->thread_count; i++){
- c[i].func = NULL;
- c[i].func2 = NULL;
+ c[i].func= NULL;
+ c[i].func2= NULL;
}
ReleaseSemaphore(c[0].work_sem, s->thread_count, 0);
- for(i = 0; i < s->thread_count; i++)
- {
+ for(i=0; i<s->thread_count; i++){
WaitForSingleObject(c[i].thread, INFINITE);
if(c[i].thread) CloseHandle(c[i].thread);
}
@@ -99,9 +93,8 @@ void avcodec_thread_free(AVCodecContext *s)
av_freep(&s->thread_opaque);
}
-int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
-{
- ThreadContext *c = s->thread_opaque;
+int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+ ThreadContext *c= s->thread_opaque;
int i;
int jobnr = 0;
@@ -109,44 +102,41 @@ int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, vo
/* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */
- for(i = 0; i < s->thread_count; i++)
- {
- c[i].arg = arg;
- c[i].argsize = size;
- c[i].func = func;
- c[i].ret = ret;
+ for(i=0; i<s->thread_count; i++){
+ c[i].arg= arg;
+ c[i].argsize= size;
+ c[i].func= func;
+ c[i].ret= ret;
c[i].jobnr = &jobnr;
}
ReleaseSemaphore(c[0].work_sem, count, 0);
- for(i = 0; i < count; i++)
+ for(i=0; i<count; i++)
WaitForSingleObject(c[0].done_sem, INFINITE);
return 0;
}
-int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2, int, int), void *arg, int *ret, int count)
-{
- ThreadContext *c = s->thread_opaque;
+int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count){
+ ThreadContext *c= s->thread_opaque;
int i;
- for(i = 0; i < s->thread_count; i++)
+ for(i=0; i<s->thread_count; i++)
c[i].func2 = func;
avcodec_thread_execute(s, NULL, arg, ret, count, 0);
}
-int avcodec_thread_init(AVCodecContext *s, int thread_count)
-{
+int avcodec_thread_init(AVCodecContext *s, int thread_count){
int i;
ThreadContext *c;
uint32_t threadid;
- s->thread_count = thread_count;
+ s->thread_count= thread_count;
- if(thread_count <= 1)
+ if (thread_count <= 1)
return 0;
assert(!s->thread_opaque);
- c = av_mallocz(sizeof(ThreadContext) * thread_count);
- s->thread_opaque = c;
+ c= av_mallocz(sizeof(ThreadContext)*thread_count);
+ s->thread_opaque= c;
if(!(c[0].work_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL)))
goto fail;
if(!(c[0].job_sem = CreateSemaphore(NULL, 1, 1, NULL)))
@@ -154,23 +144,22 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count)
if(!(c[0].done_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL)))
goto fail;
- for(i = 0; i < thread_count; i++)
- {
+ for(i=0; i<thread_count; i++){
//printf("init semaphors %d\n", i); fflush(stdout);
- c[i].avctx = s;
+ c[i].avctx= s;
c[i].work_sem = c[0].work_sem;
c[i].job_sem = c[0].job_sem;
c[i].done_sem = c[0].done_sem;
c[i].threadnr = i;
//printf("create thread %d\n", i); fflush(stdout);
- c[i].thread = (HANDLE)_beginthreadex(NULL, 0, thread_func, &c[i], 0, &threadid);
- if(!c[i].thread) goto fail;
+ c[i].thread = (HANDLE)_beginthreadex(NULL, 0, thread_func, &c[i], 0, &threadid );
+ if( !c[i].thread ) goto fail;
}
//printf("init done\n"); fflush(stdout);
- s->execute = avcodec_thread_execute;
- s->execute2 = avcodec_thread_execute2;
+ s->execute= avcodec_thread_execute;
+ s->execute2= avcodec_thread_execute2;
return 0;
fail:
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.c
index a88e55926..6cb7c8477 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.c
@@ -25,68 +25,63 @@
#include "wmv2.h"
-av_cold void ff_wmv2_common_init(Wmv2Context * w)
-{
- MpegEncContext * const s = &w->s;
+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);
}
-static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n)
-{
- MpegEncContext * const s = &w->s;
-
- if(s->block_last_index[n] >= 0)
- {
- switch(w->abt_type_table[n])
- {
- case 0:
- s->dsp.idct_add(dst, stride, block1);
- break;
- case 1:
- ff_simple_idct84_add(dst , stride, block1);
- ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
- s->dsp.clear_block(w->abt_block2[n]);
- break;
- case 2:
- ff_simple_idct48_add(dst , stride, block1);
- ff_simple_idct48_add(dst + 4 , stride, w->abt_block2[n]);
- s->dsp.clear_block(w->abt_block2[n]);
- break;
- default:
- av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
- }
+static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){
+ MpegEncContext * const s= &w->s;
+
+ if (s->block_last_index[n] >= 0) {
+ switch(w->abt_type_table[n]){
+ case 0:
+ s->dsp.idct_add (dst, stride, block1);
+ break;
+ case 1:
+ ff_simple_idct84_add(dst , stride, block1);
+ ff_simple_idct84_add(dst + 4*stride, stride, w->abt_block2[n]);
+ s->dsp.clear_block(w->abt_block2[n]);
+ break;
+ case 2:
+ ff_simple_idct48_add(dst , stride, block1);
+ ff_simple_idct48_add(dst + 4 , stride, w->abt_block2[n]);
+ s->dsp.clear_block(w->abt_block2[n]);
+ break;
+ default:
+ av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
}
+ }
}
-void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
-{
- Wmv2Context * const w = (Wmv2Context*)s;
+void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr){
+ Wmv2Context * const w= (Wmv2Context*)s;
wmv2_add_block(w, block1[0], dest_y , s->linesize, 0);
wmv2_add_block(w, block1[1], dest_y + 8 , s->linesize, 1);
- wmv2_add_block(w, block1[2], dest_y + 8 * s->linesize, s->linesize, 2);
- wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3);
+ wmv2_add_block(w, block1[2], dest_y + 8*s->linesize, s->linesize, 2);
+ wmv2_add_block(w, block1[3], dest_y + 8 + 8*s->linesize, s->linesize, 3);
- if(s->flags & CODEC_FLAG_GRAY) return;
+ if(s->flags&CODEC_FLAG_GRAY) return;
wmv2_add_block(w, block1[4], dest_cb , s->uvlinesize, 4);
wmv2_add_block(w, block1[5], dest_cr , s->uvlinesize, 5);
}
void ff_mspel_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- uint8_t **ref_picture, op_pixels_func(*pix_op)[4],
- int motion_x, int motion_y, int h)
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
+ int motion_x, int motion_y, int h)
{
- Wmv2Context * const w = (Wmv2Context*)s;
+ Wmv2Context * const w= (Wmv2Context*)s;
uint8_t *ptr;
int dxy, offset, mx, my, src_x, src_y, v_edge_pos, linesize, uvlinesize;
- int emu = 0;
+ int emu=0;
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
- dxy = 2 * dxy + w->hshift;
+ dxy = 2*dxy + w->hshift;
src_x = s->mb_x * 16 + (motion_x >> 1);
src_y = s->mb_y * 16 + (motion_y >> 1);
@@ -95,46 +90,41 @@ void ff_mspel_motion(MpegEncContext *s,
src_x = av_clip(src_x, -16, s->width);
src_y = av_clip(src_y, -16, s->height);
- if(src_x <= -16 || src_x >= s->width)
+ if(src_x<=-16 || src_x >= s->width)
dxy &= ~3;
- if(src_y <= -16 || src_y >= s->height)
+ if(src_y<=-16 || src_y >= s->height)
dxy &= ~4;
linesize = s->linesize;
uvlinesize = s->uvlinesize;
ptr = ref_picture[0] + (src_y * linesize) + src_x;
- 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)
- {
+ 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){
ff_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;
+ src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos);
+ ptr= s->edge_emu_buffer + 1 + s->linesize;
+ emu=1;
}
}
s->dsp.put_mspel_pixels_tab[dxy](dest_y , ptr , linesize);
- s->dsp.put_mspel_pixels_tab[dxy](dest_y + 8 , ptr + 8 , linesize);
- s->dsp.put_mspel_pixels_tab[dxy](dest_y + 8 * linesize, ptr + 8 * linesize, linesize);
- s->dsp.put_mspel_pixels_tab[dxy](dest_y + 8 + 8 * linesize, ptr + 8 + 8 * linesize, linesize);
+ s->dsp.put_mspel_pixels_tab[dxy](dest_y+8 , ptr+8 , linesize);
+ s->dsp.put_mspel_pixels_tab[dxy](dest_y +8*linesize, ptr +8*linesize, linesize);
+ s->dsp.put_mspel_pixels_tab[dxy](dest_y+8+8*linesize, ptr+8+8*linesize, linesize);
- if(s->flags & CODEC_FLAG_GRAY) return;
+ if(s->flags&CODEC_FLAG_GRAY) return;
- if(s->out_format == FMT_H263)
- {
+ if (s->out_format == FMT_H263) {
dxy = 0;
- if((motion_x & 3) != 0)
+ if ((motion_x & 3) != 0)
dxy |= 1;
- if((motion_y & 3) != 0)
+ if ((motion_y & 3) != 0)
dxy |= 2;
mx = motion_x >> 2;
my = motion_y >> 2;
- }
- else
- {
+ } else {
mx = motion_x / 2;
my = motion_y / 2;
dxy = ((my & 1) << 1) | (mx & 1);
@@ -145,27 +135,25 @@ void ff_mspel_motion(MpegEncContext *s,
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))
+ if (src_x == (s->width >> 1))
dxy &= ~1;
src_y = av_clip(src_y, -8, s->height >> 1);
- if(src_y == (s->height >> 1))
+ if (src_y == (s->height >> 1))
dxy &= ~2;
offset = (src_y * uvlinesize) + src_x;
ptr = ref_picture[1] + offset;
- if(emu)
- {
+ if(emu){
ff_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;
+ src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr= s->edge_emu_buffer;
}
pix_op[1][dxy](dest_cb, ptr, uvlinesize, h >> 1);
ptr = ref_picture[2] + offset;
- if(emu)
- {
+ if(emu){
ff_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;
+ src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr= s->edge_emu_buffer;
}
pix_op[1][dxy](dest_cr, ptr, uvlinesize, h >> 1);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.h
index c979065e0..8522f3a32 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2.h
@@ -32,8 +32,7 @@
#define SKIP_TYPE_COL 3
-typedef struct Wmv2Context
-{
+typedef struct Wmv2Context{
MpegEncContext s;
IntraX8Context x8;
int j_type_bit;
@@ -52,7 +51,7 @@ typedef struct Wmv2Context
ScanTable abt_scantable[2];
DECLARE_ALIGNED_16(DCTELEM, abt_block2)[6][64];
-} Wmv2Context;
+}Wmv2Context;
void ff_wmv2_common_init(Wmv2Context * w);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c
index 29c0c4406..232099ecd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c
@@ -29,67 +29,49 @@
#include "wmv2.h"
-static void parse_mb_skip(Wmv2Context * w)
-{
+static void parse_mb_skip(Wmv2Context * w){
int mb_x, mb_y;
- MpegEncContext * const s = &w->s;
- uint32_t * const mb_type = s->current_picture_ptr->mb_type;
+ MpegEncContext * const s= &w->s;
+ uint32_t * const mb_type= s->current_picture_ptr->mb_type;
- w->skip_type = get_bits(&s->gb, 2);
- switch(w->skip_type)
- {
+ w->skip_type= get_bits(&s->gb, 2);
+ switch(w->skip_type){
case SKIP_TYPE_NONE:
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- mb_type[mb_y*s->mb_stride + mb_x] = MB_TYPE_16x16 | MB_TYPE_L0;
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
case SKIP_TYPE_MPEG:
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- mb_type[mb_y*s->mb_stride + mb_x] = (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
break;
case SKIP_TYPE_ROW:
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- if(get_bits1(&s->gb))
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- mb_type[mb_y*s->mb_stride + mb_x] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ if(get_bits1(&s->gb)){
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
}
- }
- else
- {
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- mb_type[mb_y*s->mb_stride + mb_x] = (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
+ }else{
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
}
break;
case SKIP_TYPE_COL:
- for(mb_x = 0; mb_x < s->mb_width; mb_x++)
- {
- if(get_bits1(&s->gb))
- {
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- mb_type[mb_y*s->mb_stride + mb_x] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
+ for(mb_x=0; mb_x<s->mb_width; mb_x++){
+ if(get_bits1(&s->gb)){
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
}
- }
- else
- {
- for(mb_y = 0; mb_y < s->mb_height; mb_y++)
- {
- mb_type[mb_y*s->mb_stride + mb_x] = (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
+ }else{
+ for(mb_y=0; mb_y<s->mb_height; mb_y++){
+ mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
}
}
}
@@ -97,146 +79,129 @@ static void parse_mb_skip(Wmv2Context * w)
}
}
-static int decode_ext_header(Wmv2Context *w)
-{
- MpegEncContext * const s = &w->s;
+static int decode_ext_header(Wmv2Context *w){
+ MpegEncContext * const s= &w->s;
GetBitContext gb;
int fps;
int code;
- if(s->avctx->extradata_size < 4) return -1;
+ if(s->avctx->extradata_size<4) return -1;
- init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size * 8);
+ init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);
fps = get_bits(&gb, 5);
- s->bit_rate = get_bits(&gb, 11) * 1024;
+ s->bit_rate = get_bits(&gb, 11)*1024;
w->mspel_bit = get_bits1(&gb);
s->loop_filter = get_bits1(&gb);
w->abt_flag = get_bits1(&gb);
w->j_type_bit = get_bits1(&gb);
- w->top_left_mv_flag = get_bits1(&gb);
+ w->top_left_mv_flag= get_bits1(&gb);
w->per_mb_rl_bit = get_bits1(&gb);
code = get_bits(&gb, 3);
- if(code == 0) return -1;
+ if(code==0) return -1;
s->slice_height = s->mb_height / code;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, slices:%d\n",
- fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
- code);
+ fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
+ code);
}
return 0;
}
int ff_wmv2_decode_picture_header(MpegEncContext * s)
{
- Wmv2Context * const w = (Wmv2Context*)s;
+ Wmv2Context * const w= (Wmv2Context*)s;
int code;
#if 0
- {
- int i;
- for(i = 0; i < s->gb.size * 8; i++)
- printf("%d", get_bits1(&s->gb));
+{
+int i;
+for(i=0; i<s->gb.size*8; i++)
+ printf("%d", get_bits1(&s->gb));
// get_bits1(&s->gb);
- printf("END\n");
- return -1;
- }
+printf("END\n");
+return -1;
+}
#endif
- if(s->picture_number == 0)
+ if(s->picture_number==0)
decode_ext_header(w);
s->pict_type = get_bits1(&s->gb) + 1;
- if(s->pict_type == FF_I_TYPE)
- {
+ if(s->pict_type == FF_I_TYPE){
code = get_bits(&s->gb, 7);
av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
}
- s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
+ s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
if(s->qscale <= 0)
- return -1;
+ return -1;
return 0;
}
int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
{
- Wmv2Context * const w = (Wmv2Context*)s;
+ Wmv2Context * const w= (Wmv2Context*)s;
- if(s->pict_type == FF_I_TYPE)
- {
- if(w->j_type_bit) w->j_type = get_bits1(&s->gb);
- else w->j_type = 0; //FIXME check
+ if (s->pict_type == FF_I_TYPE) {
+ if(w->j_type_bit) w->j_type= get_bits1(&s->gb);
+ else w->j_type= 0; //FIXME check
- if(!w->j_type)
- {
- if(w->per_mb_rl_bit) s->per_mb_rl_table = get_bits1(&s->gb);
- else s->per_mb_rl_table = 0;
+ if(!w->j_type){
+ if(w->per_mb_rl_bit) s->per_mb_rl_table= get_bits1(&s->gb);
+ else s->per_mb_rl_table= 0;
- if(!s->per_mb_rl_table)
- {
+ if(!s->per_mb_rl_table){
s->rl_chroma_table_index = decode012(&s->gb);
s->rl_table_index = decode012(&s->gb);
}
s->dc_table_index = get_bits1(&s->gb);
}
- s->inter_intra_pred = 0;
+ s->inter_intra_pred= 0;
s->no_rounding = 1;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
- s->qscale,
- s->rl_chroma_table_index,
- s->rl_table_index,
- s->dc_table_index,
- s->per_mb_rl_table,
- w->j_type);
+ s->qscale,
+ s->rl_chroma_table_index,
+ s->rl_table_index,
+ s->dc_table_index,
+ s->per_mb_rl_table,
+ w->j_type);
}
- }
- else
- {
+ }else{
int cbp_index;
- w->j_type = 0;
+ w->j_type=0;
parse_mb_skip(w);
- cbp_index = decode012(&s->gb);
- if(s->qscale <= 10)
- {
- int map[3] = {0, 2, 1};
- w->cbp_table_index = map[cbp_index];
- }
- else if(s->qscale <= 20)
- {
- int map[3] = {1, 0, 2};
- w->cbp_table_index = map[cbp_index];
- }
- else
- {
- int map[3] = {2, 1, 0};
- w->cbp_table_index = map[cbp_index];
+ cbp_index= decode012(&s->gb);
+ if(s->qscale <= 10){
+ int map[3]= {0,2,1};
+ w->cbp_table_index= map[cbp_index];
+ }else if(s->qscale <= 20){
+ int map[3]= {1,0,2};
+ w->cbp_table_index= map[cbp_index];
+ }else{
+ int map[3]= {2,1,0};
+ w->cbp_table_index= map[cbp_index];
}
- if(w->mspel_bit) s->mspel = get_bits1(&s->gb);
- else s->mspel = 0; //FIXME check
+ if(w->mspel_bit) s->mspel= get_bits1(&s->gb);
+ else s->mspel= 0; //FIXME check
- if(w->abt_flag)
- {
- w->per_mb_abt = get_bits1(&s->gb) ^ 1;
- if(!w->per_mb_abt)
- {
- w->abt_type = decode012(&s->gb);
+ if(w->abt_flag){
+ w->per_mb_abt= get_bits1(&s->gb)^1;
+ if(!w->per_mb_abt){
+ w->abt_type= decode012(&s->gb);
}
}
- if(w->per_mb_rl_bit) s->per_mb_rl_table = get_bits1(&s->gb);
- else s->per_mb_rl_table = 0;
+ if(w->per_mb_rl_bit) s->per_mb_rl_table= get_bits1(&s->gb);
+ else s->per_mb_rl_table= 0;
- if(!s->per_mb_rl_table)
- {
+ if(!s->per_mb_rl_table){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
}
@@ -244,62 +209,58 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
s->dc_table_index = get_bits1(&s->gb);
s->mv_table_index = get_bits1(&s->gb);
- s->inter_intra_pred = 0; //(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
+ s->inter_intra_pred= 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
s->no_rounding ^= 1;
- if(s->avctx->debug & FF_DEBUG_PICT_INFO)
- {
+ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
- s->rl_table_index,
- s->rl_chroma_table_index,
- s->dc_table_index,
- s->mv_table_index,
- s->per_mb_rl_table,
- s->qscale,
- s->mspel,
- w->per_mb_abt,
- w->abt_type,
- w->cbp_table_index,
- s->inter_intra_pred);
+ s->rl_table_index,
+ s->rl_chroma_table_index,
+ s->dc_table_index,
+ s->mv_table_index,
+ s->per_mb_rl_table,
+ s->qscale,
+ s->mspel,
+ w->per_mb_abt,
+ w->abt_type,
+ w->cbp_table_index,
+ s->inter_intra_pred);
}
}
- s->esc3_level_length = 0;
- s->esc3_run_length = 0;
+ s->esc3_level_length= 0;
+ s->esc3_run_length= 0;
- s->picture_number++; //FIXME ?
+s->picture_number++; //FIXME ?
- if(w->j_type)
- {
- ff_intrax8_decode_picture(&w->x8, 2 * s->qscale, (s->qscale - 1) | 1);
+ if(w->j_type){
+ ff_intrax8_decode_picture(&w->x8, 2*s->qscale, (s->qscale-1)|1 );
return 1;
}
return 0;
}
-static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
-{
- MpegEncContext * const s = &w->s;
+static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){
+ MpegEncContext * const s= &w->s;
int ret;
- ret = ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
+ ret= ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
- if(ret < 0) return -1;
+ if(ret<0) return -1;
- if((((*mx_ptr) | (*my_ptr)) & 1) && s->mspel)
- w->hshift = get_bits1(&s->gb);
+ if((((*mx_ptr)|(*my_ptr)) & 1) && s->mspel)
+ w->hshift= get_bits1(&s->gb);
else
- w->hshift = 0;
+ w->hshift= 0;
//printf("%d %d ", *mx_ptr, *my_ptr);
return 0;
}
-static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
-{
- MpegEncContext * const s = &w->s;
+static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){
+ MpegEncContext * const s= &w->s;
int xy, wrap, diff, type;
int16_t *A, *B, *C, *mot_val;
@@ -313,35 +274,27 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
C = s->current_picture.motion_val[0][xy + 2 - wrap];
if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
- diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
+ diff= FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
else
- diff = 0;
+ diff=0;
if(diff >= 8)
- type = get_bits1(&s->gb);
- else
- type = 2;
-
- if(type == 0)
- {
- *px = A[0];
- *py = A[1];
- }
- else if(type == 1)
- {
- *px = B[0];
- *py = B[1];
- }
+ type= get_bits1(&s->gb);
else
- {
+ type= 2;
+
+ if(type == 0){
+ *px= A[0];
+ *py= A[1];
+ }else if(type == 1){
+ *px= B[0];
+ *py= B[1];
+ }else{
/* special case for first (slice) line */
- if(s->first_slice_line)
- {
+ if (s->first_slice_line) {
*px = A[0];
*py = A[1];
- }
- else
- {
+ } else {
*px = mid_pred(A[0], B[0], C[0]);
*py = mid_pred(A[1], B[1], C[1]);
}
@@ -350,53 +303,46 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
return mot_val;
}
-static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, int cbp)
-{
- MpegEncContext * const s = &w->s;
- static const int sub_cbp_table[3] = {2, 3, 1};
+static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, int cbp){
+ MpegEncContext * const s= &w->s;
+ static const int sub_cbp_table[3]= {2,3,1};
int sub_cbp;
- if(!cbp)
- {
+ if(!cbp){
s->block_last_index[n] = -1;
return 0;
}
if(w->per_block_abt)
- w->abt_type = decode012(&s->gb);
+ w->abt_type= decode012(&s->gb);
#if 0
if(w->per_block_abt)
printf("B%d", w->abt_type);
#endif
- w->abt_type_table[n] = w->abt_type;
+ w->abt_type_table[n]= w->abt_type;
- if(w->abt_type)
- {
+ if(w->abt_type){
// const uint8_t *scantable= w->abt_scantable[w->abt_type-1].permutated;
- const uint8_t *scantable = w->abt_scantable[w->abt_type-1].scantable;
+ const uint8_t *scantable= w->abt_scantable[w->abt_type-1].scantable;
// 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)];
+ 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)
+ if(sub_cbp&1){
+ if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0)
return -1;
}
- if(sub_cbp & 2)
- {
- if(ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable) < 0)
+ if(sub_cbp&2){
+ if (ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable) < 0)
return -1;
}
s->block_last_index[n] = 63;
return 0;
- }
- else
- {
+ }else{
return ff_msmpeg4_decode_block(s, block, n, 1, s->inter_scantable.permutated);
}
}
@@ -404,52 +350,45 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n,
int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
{
- Wmv2Context * const w = (Wmv2Context*)s;
+ Wmv2Context * const w= (Wmv2Context*)s;
int cbp, code, i;
uint8_t *coded_val;
if(w->j_type) return 0;
- if(s->pict_type == FF_P_TYPE)
- {
- if(IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x]))
- {
+ if (s->pict_type == FF_P_TYPE) {
+ if(IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])){
/* skip mb */
s->mb_intra = 0;
- for(i = 0; i < 6; i++)
+ for(i=0;i<6;i++)
s->block_last_index[i] = -1;
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
s->mb_skipped = 1;
- w->hshift = 0;
+ w->hshift=0;
return 0;
}
code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3);
- if(code < 0)
+ if (code < 0)
return -1;
s->mb_intra = (~code & 0x40) >> 6;
cbp = code & 0x3f;
- }
- else
- {
+ } else {
s->mb_intra = 1;
code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
- if(code < 0)
- {
+ if (code < 0){
av_log(s->avctx, AV_LOG_ERROR, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
/* predict coded block pattern */
cbp = 0;
- for(i = 0; i < 6; i++)
- {
+ for(i=0;i<6;i++) {
int val = ((code >> (5 - i)) & 1);
- if(i < 4)
- {
+ if (i < 4) {
int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
val = val ^ pred;
*coded_val = val;
@@ -458,32 +397,27 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
}
}
- if(!s->mb_intra)
- {
+ 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)
- {
+ if(cbp){
s->dsp.clear_blocks(s->block[0]);
- if(s->per_mb_rl_table)
- {
+ if(s->per_mb_rl_table){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
}
- if(w->abt_flag && w->per_mb_abt)
- {
- w->per_block_abt = get_bits1(&s->gb);
+ if(w->abt_flag && w->per_mb_abt){
+ w->per_block_abt= get_bits1(&s->gb);
if(!w->per_block_abt)
- w->abt_type = decode012(&s->gb);
- }
- else
- w->per_block_abt = 0;
+ w->abt_type= decode012(&s->gb);
+ }else
+ w->per_block_abt=0;
}
- if(wmv2_decode_motion(w, &mx, &my) < 0)
+ if (wmv2_decode_motion(w, &mx, &my) < 0)
return -1;
s->mv_dir = MV_DIR_FORWARD;
@@ -491,36 +425,30 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
s->mv[0][0][0] = mx;
s->mv[0][0][1] = my;
- for(i = 0; i < 6; i++)
- {
- if(wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0)
+ for (i = 0; i < 6; i++) {
+ if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0)
{
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
}
}
- }
- else
- {
+ } else {
//if(s->pict_type==FF_P_TYPE)
// 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));
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);
+ 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);
}
- if(s->per_mb_rl_table && cbp)
- {
+ if(s->per_mb_rl_table && cbp){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
}
s->dsp.clear_blocks(s->block[0]);
- for(i = 0; i < 6; i++)
- {
- if(ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
+ for (i = 0; i < 6; i++) {
+ if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
@@ -531,13 +459,11 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
return 0;
}
-static av_cold int wmv2_decode_init(AVCodecContext *avctx)
-{
- Wmv2Context * const w = avctx->priv_data;
+static av_cold int wmv2_decode_init(AVCodecContext *avctx){
+ Wmv2Context * const w= avctx->priv_data;
- if(avctx->idct_algo == FF_IDCT_AUTO)
- {
- avctx->idct_algo = FF_IDCT_WMV2;
+ if(avctx->idct_algo==FF_IDCT_AUTO){
+ avctx->idct_algo=FF_IDCT_WMV2;
}
if(ff_msmpeg4_decode_init(avctx) < 0)
@@ -545,7 +471,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
ff_wmv2_common_init(w);
- ff_intrax8_common_init(&w->x8, &w->s);
+ ff_intrax8_common_init(&w->x8,&w->s);
return 0;
}
@@ -558,8 +484,7 @@ static av_cold int wmv2_decode_end(AVCodecContext *avctx)
return ff_h263_decode_end(avctx);
}
-AVCodec wmv2_decoder =
-{
+AVCodec wmv2_decoder = {
"wmv2",
CODEC_TYPE_VIDEO,
CODEC_ID_WMV2,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/cpuid.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/cpuid.c
index 28cc51f98..f012fb18f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/cpuid.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/cpuid.c
@@ -41,11 +41,11 @@ int mm_support(void)
{
int rval = 0;
int eax, ebx, ecx, edx;
- int max_std_level, max_ext_level, std_caps = 0, ext_caps = 0;
+ int max_std_level, max_ext_level, std_caps=0, ext_caps=0;
#if ARCH_X86_32
x86_reg a, c;
- __asm__ volatile(
+ __asm__ volatile (
/* See if CPUID instruction is supported ... */
/* ... Get copies of EFLAGS into eax and ecx */
"pushfl\n\t"
@@ -61,67 +61,65 @@ int mm_support(void)
/* ... Get the (hopefully modified) EFLAGS */
"pushfl\n\t"
"pop %0\n\t"
- : "=a"(a), "=c"(c)
+ : "=a" (a), "=c" (c)
:
: "cc"
- );
+ );
- if(a == c)
+ if (a == c)
return 0; /* CPUID not supported */
#endif
cpuid(0, max_std_level, ebx, ecx, edx);
- if(max_std_level >= 1)
- {
+ if(max_std_level >= 1){
cpuid(1, eax, ebx, ecx, std_caps);
- if(std_caps & (1 << 23))
+ if (std_caps & (1<<23))
rval |= FF_MM_MMX;
- if(std_caps & (1 << 25))
+ if (std_caps & (1<<25))
rval |= FF_MM_MMX2
#if HAVE_SSE
- | FF_MM_SSE;
- if(std_caps & (1 << 26))
+ | FF_MM_SSE;
+ if (std_caps & (1<<26))
rval |= FF_MM_SSE2;
- if(ecx & 1)
+ if (ecx & 1)
rval |= FF_MM_SSE3;
- if(ecx & 0x00000200)
+ if (ecx & 0x00000200 )
rval |= FF_MM_SSSE3;
- if(ecx & 0x00080000)
+ if (ecx & 0x00080000 )
rval |= FF_MM_SSE4;
- if(ecx & 0x00100000)
+ if (ecx & 0x00100000 )
rval |= FF_MM_SSE42;
#endif
- ;
+ ;
}
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 & (1 << 31))
+ if (ext_caps & (1<<31))
rval |= FF_MM_3DNOW;
- if(ext_caps & (1 << 30))
+ if (ext_caps & (1<<30))
rval |= FF_MM_3DNOWEXT;
- if(ext_caps & (1 << 23))
+ if (ext_caps & (1<<23))
rval |= FF_MM_MMX;
- if(ext_caps & (1 << 22))
+ if (ext_caps & (1<<22))
rval |= FF_MM_MMX2;
}
#if 0
av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s%s%s%s%s\n",
- (rval & FF_MM_MMX) ? "MMX " : "",
- (rval & FF_MM_MMX2) ? "MMX2 " : "",
- (rval & FF_MM_SSE) ? "SSE " : "",
- (rval & FF_MM_SSE2) ? "SSE2 " : "",
- (rval & FF_MM_SSE3) ? "SSE3 " : "",
- (rval & FF_MM_SSSE3) ? "SSSE3 " : "",
- (rval & FF_MM_SSE4) ? "SSE4.1 " : "",
- (rval & FF_MM_SSE42) ? "SSE4.2 " : "",
- (rval & FF_MM_3DNOW) ? "3DNow " : "",
- (rval & FF_MM_3DNOWEXT) ? "3DNowExt " : "");
+ (rval&FF_MM_MMX) ? "MMX ":"",
+ (rval&FF_MM_MMX2) ? "MMX2 ":"",
+ (rval&FF_MM_SSE) ? "SSE ":"",
+ (rval&FF_MM_SSE2) ? "SSE2 ":"",
+ (rval&FF_MM_SSE3) ? "SSE3 ":"",
+ (rval&FF_MM_SSSE3) ? "SSSE3 ":"",
+ (rval&FF_MM_SSE4) ? "SSE4.1 ":"",
+ (rval&FF_MM_SSE42) ? "SSE4.2 ":"",
+ (rval&FF_MM_3DNOW) ? "3DNow ":"",
+ (rval&FF_MM_3DNOWEXT) ? "3DNowExt ":"");
#endif
return rval;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_mmx.c
index f5ef6ace4..9aa8a52aa 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_mmx.c
@@ -31,16 +31,15 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
DECLARE_ALIGNED_8(uint64_t, DD);
int i;
- if(y == 0 && x == 0)
- {
+ if(y==0 && x==0) {
/* no filter needed */
H264_CHROMA_MC8_MV0(dst, src, stride, h);
return;
}
- assert(x < 8 && y < 8 && x >= 0 && y >= 0);
+ assert(x<8 && y<8 && x>=0 && y>=0);
- if(y == 0 || x == 0)
+ if(y==0 || x==0)
{
/* 1 dimensional filter only */
const int dxy = x ? 1 : stride;
@@ -55,8 +54,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"psubw %%mm5, %%mm4\n\t" /* mm4 = A = 8-x */
:: "rm"(x+y), "m"(ff_pw_8), "m"(*(rnd_reg+1)));
- for(i = 0; i < h; i++)
- {
+ for(i=0; i<h; i++) {
__asm__ volatile(
/* mm0 = src[0..7], mm1 = src[1..8] */
"movq %0, %%mm0\n\t"
@@ -87,7 +85,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"packuswb %%mm1, %%mm0\n\t"
H264_CHROMA_OP(%0, %%mm0)
"movq %%mm0, %0\n\t"
- : "=m"(dst[0]));
+ : "=m" (dst[0]));
src += stride;
dst += stride;
@@ -97,34 +95,33 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
/* general case, bilinear */
__asm__ volatile("movd %2, %%mm4\n\t"
- "movd %3, %%mm6\n\t"
- "punpcklwd %%mm4, %%mm4\n\t"
- "punpcklwd %%mm6, %%mm6\n\t"
- "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */
- "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */
- "movq %%mm4, %%mm5\n\t"
- "pmullw %%mm6, %%mm4\n\t" /* mm4 = x * y */
- "psllw $3, %%mm5\n\t"
- "psllw $3, %%mm6\n\t"
- "movq %%mm5, %%mm7\n\t"
- "paddw %%mm6, %%mm7\n\t"
- "movq %%mm4, %1\n\t" /* DD = x * y */
- "psubw %%mm4, %%mm5\n\t" /* mm5 = B = 8x - xy */
- "psubw %%mm4, %%mm6\n\t" /* mm6 = C = 8y - xy */
- "paddw %4, %%mm4\n\t"
- "psubw %%mm7, %%mm4\n\t" /* mm4 = A = xy - (8x+8y) + 64 */
- "pxor %%mm7, %%mm7\n\t"
- "movq %%mm4, %0\n\t"
- : "=m"(AA), "=m"(DD) : "rm"(x), "rm"(y), "m"(ff_pw_64));
+ "movd %3, %%mm6\n\t"
+ "punpcklwd %%mm4, %%mm4\n\t"
+ "punpcklwd %%mm6, %%mm6\n\t"
+ "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */
+ "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */
+ "movq %%mm4, %%mm5\n\t"
+ "pmullw %%mm6, %%mm4\n\t" /* mm4 = x * y */
+ "psllw $3, %%mm5\n\t"
+ "psllw $3, %%mm6\n\t"
+ "movq %%mm5, %%mm7\n\t"
+ "paddw %%mm6, %%mm7\n\t"
+ "movq %%mm4, %1\n\t" /* DD = x * y */
+ "psubw %%mm4, %%mm5\n\t" /* mm5 = B = 8x - xy */
+ "psubw %%mm4, %%mm6\n\t" /* mm6 = C = 8y - xy */
+ "paddw %4, %%mm4\n\t"
+ "psubw %%mm7, %%mm4\n\t" /* mm4 = A = xy - (8x+8y) + 64 */
+ "pxor %%mm7, %%mm7\n\t"
+ "movq %%mm4, %0\n\t"
+ : "=m" (AA), "=m" (DD) : "rm" (x), "rm" (y), "m" (ff_pw_64));
__asm__ volatile(
/* mm0 = src[0..7], mm1 = src[1..8] */
"movq %0, %%mm0\n\t"
"movq %1, %%mm1\n\t"
- : : "m"(src[0]), "m"(src[1]));
+ : : "m" (src[0]), "m" (src[1]));
- for(i = 0; i < h; i++)
- {
+ for(i=0; i<h; i++) {
src += stride;
__asm__ volatile(
@@ -142,7 +139,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"pmullw %%mm5, %%mm3\n\t"
"paddw %%mm1, %%mm2\n\t"
"paddw %%mm0, %%mm3\n\t"
- : : "m"(AA));
+ : : "m" (AA));
__asm__ volatile(
/* [mm2,mm3] += C * src[0..7] */
@@ -154,7 +151,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"pmullw %%mm6, %%mm1\n\t"
"paddw %%mm0, %%mm2\n\t"
"paddw %%mm1, %%mm3\n\t"
- : : "m"(src[0]));
+ : : "m" (src[0]));
__asm__ volatile(
/* [mm2,mm3] += D * src[1..8] */
@@ -168,7 +165,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"paddw %%mm0, %%mm2\n\t"
"paddw %%mm4, %%mm3\n\t"
"movq %0, %%mm0\n\t"
- : : "m"(src[0]), "m"(src[1]), "m"(DD));
+ : : "m" (src[0]), "m" (src[1]), "m" (DD));
__asm__ volatile(
/* dst[0..7] = ([mm2,mm3] + rnd) >> 6 */
@@ -179,8 +176,8 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"packuswb %%mm3, %%mm2\n\t"
H264_CHROMA_OP(%0, %%mm2)
"movq %%mm2, %0\n\t"
- : "=m"(dst[0]) : "m"(*rnd_reg));
- dst += stride;
+ : "=m" (dst[0]) : "m" (*rnd_reg));
+ dst+= stride;
}
}
@@ -255,9 +252,9 @@ static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*
#ifdef H264_CHROMA_MC2_TMPL
static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
{
- int tmp = ((1 << 16) - 1) * x + 8;
- int CD = tmp * y;
- int AB = (tmp << 3) - CD;
+ int tmp = ((1<<16)-1)*x + 8;
+ int CD= tmp*y;
+ int AB= (tmp<<3) - CD;
__asm__ volatile(
/* mm5 = {A,B,A,B} */
/* mm6 = {C,D,C,D} */
@@ -298,8 +295,8 @@ static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1*
"add %4, %0\n\t"
"sub $1, %2\n\t"
"jnz 1b\n\t"
- : "+r"(dst), "+r"(src), "+r"(h)
- : "m"(ff_pw_32), "r"((x86_reg)stride)
+ : "+r" (dst), "+r"(src), "+r"(h)
+ : "m" (ff_pw_32), "r"((x86_reg)stride)
: "%esi");
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_ssse3.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_ssse3.c
index 57e7a1dd9..e29e05e7c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_ssse3.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_h264_template_ssse3.c
@@ -26,16 +26,15 @@
*/
static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, int rnd)
{
- if(y == 0 && x == 0)
- {
+ if(y==0 && x==0) {
/* no filter needed */
H264_CHROMA_MC8_MV0(dst, src, stride, h);
return;
}
- assert(x < 8 && y < 8 && x >= 0 && y >= 0);
+ assert(x<8 && y<8 && x>=0 && y>=0);
- if(y == 0 || x == 0)
+ if(y==0 || x==0)
{
/* 1 dimensional filter only */
__asm__ volatile(
@@ -47,8 +46,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
:: "r"(255*(x+y)+8), "m"(*(rnd?&ff_pw_4:&ff_pw_3))
);
- if(x)
- {
+ if(x) {
__asm__ volatile(
"1: \n\t"
"movq (%1), %%xmm0 \n\t"
@@ -59,14 +57,14 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"punpcklbw %%xmm3, %%xmm2 \n\t"
"pmaddubsw %%xmm7, %%xmm0 \n\t"
"pmaddubsw %%xmm7, %%xmm2 \n\t"
- AVG_OP("movq (%0), %%xmm4 \n\t")
- AVG_OP("movhps (%0,%3), %%xmm4 \n\t")
+ AVG_OP("movq (%0), %%xmm4 \n\t")
+ AVG_OP("movhps (%0,%3), %%xmm4 \n\t")
"paddw %%xmm6, %%xmm0 \n\t"
"paddw %%xmm6, %%xmm2 \n\t"
"psrlw $3, %%xmm0 \n\t"
"psrlw $3, %%xmm2 \n\t"
"packuswb %%xmm2, %%xmm0 \n\t"
- AVG_OP("pavgb %%xmm4, %%xmm0 \n\t")
+ AVG_OP("pavgb %%xmm4, %%xmm0 \n\t")
"movq %%xmm0, (%0) \n\t"
"movhps %%xmm0, (%0,%3) \n\t"
"sub $2, %2 \n\t"
@@ -76,9 +74,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
:"+r"(dst), "+r"(src), "+r"(h)
:"r"((x86_reg)stride)
);
- }
- else
- {
+ } else {
__asm__ volatile(
"1: \n\t"
"movq (%1), %%xmm0 \n\t"
@@ -89,14 +85,14 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"punpcklbw %%xmm3, %%xmm2 \n\t"
"pmaddubsw %%xmm7, %%xmm0 \n\t"
"pmaddubsw %%xmm7, %%xmm2 \n\t"
- AVG_OP("movq (%0), %%xmm4 \n\t")
- AVG_OP("movhps (%0,%3), %%xmm4 \n\t")
+ AVG_OP("movq (%0), %%xmm4 \n\t")
+ AVG_OP("movhps (%0,%3), %%xmm4 \n\t")
"paddw %%xmm6, %%xmm0 \n\t"
"paddw %%xmm6, %%xmm2 \n\t"
"psrlw $3, %%xmm0 \n\t"
"psrlw $3, %%xmm2 \n\t"
"packuswb %%xmm2, %%xmm0 \n\t"
- AVG_OP("pavgb %%xmm4, %%xmm0 \n\t")
+ AVG_OP("pavgb %%xmm4, %%xmm0 \n\t")
"movq %%xmm0, (%0) \n\t"
"movhps %%xmm0, (%0,%3) \n\t"
"sub $2, %2 \n\t"
@@ -148,10 +144,10 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
"movdqa %%xmm4, %%xmm0 \n\t"
"psrlw $6, %%xmm1 \n\t"
"psrlw $6, %%xmm3 \n\t"
- AVG_OP("movq (%0), %%xmm2 \n\t")
- AVG_OP("movhps (%0,%3), %%xmm2 \n\t")
+ AVG_OP("movq (%0), %%xmm2 \n\t")
+ AVG_OP("movhps (%0,%3), %%xmm2 \n\t")
"packuswb %%xmm3, %%xmm1 \n\t"
- AVG_OP("pavgb %%xmm2, %%xmm1 \n\t")
+ AVG_OP("pavgb %%xmm2, %%xmm1 \n\t")
"movq %%xmm1, (%0)\n\t"
"movhps %%xmm1, (%0,%3)\n\t"
"sub $2, %2 \n\t"
@@ -198,8 +194,8 @@ static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*
"psrlw $6, %%mm3 \n\t"
"packuswb %%mm1, %%mm1 \n\t"
"packuswb %%mm3, %%mm3 \n\t"
- AVG_OP("pavgb (%0), %%mm1 \n\t")
- AVG_OP("pavgb (%0,%3), %%mm3 \n\t")
+ AVG_OP("pavgb (%0), %%mm1 \n\t")
+ AVG_OP("pavgb (%0,%3), %%mm3 \n\t")
"movd %%mm1, (%0)\n\t"
"movd %%mm3, (%0,%3)\n\t"
"sub $2, %2 \n\t"
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c
index 3ea90e88c..95cd1fe99 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c
@@ -39,35 +39,35 @@
int mm_flags; /* multimedia extension flags */
/* pixel operations */
-DECLARE_ALIGNED_8(const uint64_t, ff_bone) = 0x0101010101010101ULL;
-DECLARE_ALIGNED_8(const uint64_t, ff_wtwo) = 0x0002000200020002ULL;
+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_8(const uint64_t, ff_pw_3) = 0x0003000300030003ULL;
-DECLARE_ALIGNED_8(const uint64_t, ff_pw_4) = 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_8(const uint64_t, ff_pw_15) = 0x000F000F000F000FULL;
-DECLARE_ALIGNED_16(const xmm_reg, ff_pw_16) = {0x0010001000100010ULL, 0x0010001000100010ULL};
-DECLARE_ALIGNED_8(const uint64_t, ff_pw_20) = 0x0014001400140014ULL;
-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_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_8(const uint64_t, ff_pb_1) = 0x0101010101010101ULL;
-DECLARE_ALIGNED_8(const uint64_t, ff_pb_3) = 0x0303030303030303ULL;
-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_8(const uint64_t, ff_pb_81) = 0x8181818181818181ULL;
-DECLARE_ALIGNED_8(const uint64_t, ff_pb_A1) = 0xA1A1A1A1A1A1A1A1ULL;
-DECLARE_ALIGNED_8(const uint64_t, ff_pb_FC) = 0xFCFCFCFCFCFCFCFCULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_3 ) = 0x0003000300030003ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_4 ) = 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_8 (const uint64_t, ff_pw_15 ) = 0x000F000F000F000FULL;
+DECLARE_ALIGNED_16(const xmm_reg, ff_pw_16 ) = {0x0010001000100010ULL, 0x0010001000100010ULL};
+DECLARE_ALIGNED_8 (const uint64_t, ff_pw_20 ) = 0x0014001400140014ULL;
+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_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_8 (const uint64_t, ff_pb_1 ) = 0x0101010101010101ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_3 ) = 0x0303030303030303ULL;
+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_8 (const uint64_t, ff_pb_81 ) = 0x8181818181818181ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_A1 ) = 0xA1A1A1A1A1A1A1A1ULL;
+DECLARE_ALIGNED_8 (const uint64_t, ff_pb_FC ) = 0xFCFCFCFCFCFCFCFCULL;
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 };
@@ -231,54 +231,54 @@ void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size
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), "m"(*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");
+ "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");
}
DECLARE_ASM_CONST(8, uint8_t, ff_vector128)[8] =
-{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
+ { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
#define put_signed_pixels_clamped_mmx_half(off) \
"movq "#off"(%2), %%mm1 \n\t"\
@@ -303,15 +303,15 @@ void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int li
x86_reg line_skip = line_size;
x86_reg line_skip3;
- __asm__ volatile(
- "movq "MANGLE(ff_vector128)", %%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");
+ __asm__ volatile (
+ "movq "MANGLE(ff_vector128)", %%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 add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
@@ -325,170 +325,168 @@ void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size
pix = pixels;
MOVQ_ZERO(mm7);
i = 4;
- do
- {
+ 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;
+ "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);
+ } 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"
- ASMALIGN(3)
- "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"
- );
+ "lea (%3, %3), %%"REG_a" \n\t"
+ ASMALIGN(3)
+ "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"
- ASMALIGN(3)
- "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"
- );
+ "lea (%3, %3), %%"REG_a" \n\t"
+ ASMALIGN(3)
+ "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)
{
__asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- ASMALIGN(3)
- "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"
- );
+ "lea (%3, %3), %%"REG_a" \n\t"
+ ASMALIGN(3)
+ "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"
- "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 (%1,%3,4), %1 \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"
- );
+ "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"
+ "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 (%1,%3,4), %1 \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"
+ );
}
static void avg_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"
- "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 (%1,%3,4), %1 \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"
- );
+ "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"
+ "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 (%1,%3,4), %1 \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"
+ );
}
#define CLEAR_BLOCKS(name,n) \
@@ -530,8 +528,7 @@ static void clear_block_sse(DCTELEM *block)
}
static void clear_blocks_sse(DCTELEM *blocks)
-{
- \
+{\
__asm__ volatile(
"xorps %%xmm0, %%xmm0 \n"
"mov %1, %%"REG_a" \n"
@@ -546,15 +543,14 @@ static void clear_blocks_sse(DCTELEM *blocks)
"movaps %%xmm0, 112(%0, %%"REG_a") \n"
"add $128, %%"REG_a" \n"
" js 1b \n"
- : : "r"(((uint8_t *)blocks)+128*6),
- "i"(-128*6)
+ : : "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;
+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"
@@ -570,16 +566,15 @@ static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w)
"2: \n\t"
"cmp %3, %0 \n\t"
" js 1b \n\t"
- : "+r"(i)
+ : "+r" (i)
: "r"(src), "r"(dst), "r"((x86_reg)w-15)
);
- for(; i < w; i++)
+ 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;
+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"
"1: \n\t"
@@ -593,16 +588,15 @@ static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
"2: \n\t"
"cmp %4, %0 \n\t"
" js 1b \n\t"
- : "+r"(i)
+ : "+r" (i)
: "r"(dst), "r"(src1), "r"(src2), "r"((x86_reg)w-15)
);
- for(; i < w; i++)
+ for(; i<w; i++)
dst[i] = src1[i] + src2[i];
}
#if HAVE_7REGS && HAVE_TEN_OPERANDS
-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;
@@ -707,31 +701,28 @@ static void add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top, co
"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];
+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(
+ __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)
- );
+ 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, int dst_stride, int src_stride)
-{
+static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){
__asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ...
"movd %4, %%mm0 \n\t"
"movd %5, %%mm1 \n\t"
@@ -749,69 +740,67 @@ static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int
"punpckhdq %%mm1, %%mm1 \n\t"
"movd %%mm1, %3 \n\t"
- : "=m"(*(uint32_t*)(dst + 0*dst_stride)),
- "=m"(*(uint32_t*)(dst + 1*dst_stride)),
- "=m"(*(uint32_t*)(dst + 2*dst_stride)),
- "=m"(*(uint32_t*)(dst + 3*dst_stride))
- : "m"(*(uint32_t*)(src + 0*src_stride)),
- "m"(*(uint32_t*)(src + 1*src_stride)),
- "m"(*(uint32_t*)(src + 2*src_stride)),
- "m"(*(uint32_t*)(src + 3*src_stride))
+ : "=m" (*(uint32_t*)(dst + 0*dst_stride)),
+ "=m" (*(uint32_t*)(dst + 1*dst_stride)),
+ "=m" (*(uint32_t*)(dst + 2*dst_stride)),
+ "=m" (*(uint32_t*)(dst + 3*dst_stride))
+ : "m" (*(uint32_t*)(src + 0*src_stride)),
+ "m" (*(uint32_t*)(src + 1*src_stride)),
+ "m" (*(uint32_t*)(src + 2*src_stride)),
+ "m" (*(uint32_t*)(src + 3*src_stride))
);
}
-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;
+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;
+ src -= 2;
- transpose4x4(btemp , src , 8, stride);
- transpose4x4(btemp + 4, src + 4 * stride, 8, stride);
- __asm__ volatile(
- H263_LOOP_FILTER // 5 3 4 6
+ 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)
- );
+ : "+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))
+ );
}
}
@@ -825,81 +814,80 @@ 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)
+ 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)
+ "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)
+ "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)
);
}
- for(i = 0; i < w; i += 4)
- {
+ for(i=0;i<w;i+=4) {
/* top and bottom (and hopefully also the corners) */
- ptr = buf - (i + 1) * wrap - w;
+ 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)
+ "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)
);
- ptr = last_line + (i + 1) * wrap - w;
+ 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)
+ "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)
);
}
}
@@ -1681,7 +1669,7 @@ 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)
@@ -1693,51 +1681,47 @@ QPEL_2TAP(avg_, 8, 3dnow)
#if 0
-static void just_return(void)
-{
- return;
-}
+static void just_return(void) { return; }
#endif
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)
-{
+ 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;
+ 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];
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);
+ 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)
+ ((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)
+ || (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);
return;
}
- src += ix + iy * stride;
- if((unsigned)ix >= width - w ||
- (unsigned)iy >= height - h)
+ src += ix + iy*stride;
+ if( (unsigned)ix >= width-w ||
+ (unsigned)iy >= height-h )
{
- ff_emulated_edge_mc(edge_buf, src, stride, w + 1, h + 1, ix, iy, width, height);
+ ff_emulated_edge_mc(edge_buf, src, stride, w+1, h+1, ix, iy, width, height);
src = edge_buf;
}
@@ -1749,23 +1733,17 @@ int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
:: "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++)
- {
+ 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"
@@ -1815,12 +1793,12 @@ int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
: "=m"(dst[x+y*stride])
: "m"(src[0]), "m"(src[1]),
- "m"(src[stride]), "m"(src[stride+1]),
- "m"(*r4), "m"(shift2)
+ "m"(src[stride]), "m"(src[stride+1]),
+ "m"(*r4), "m"(shift2)
);
src += stride;
}
- src += 4 - h * stride;
+ src += 4-h*stride;
}
}
@@ -1843,32 +1821,26 @@ PREFETCH(prefetch_3dnow, prefetch)
void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx);
void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx);
-void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride)
-{
+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)
-{
+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)
-{
+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)
-{
+void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
avg_pixels16_mmx(dst, src, stride, 16);
}
/* VC1 specific */
void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx);
-void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd)
-{
+void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
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)
-{
+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);
}
@@ -1881,43 +1853,43 @@ void ff_mmxext_idct(DCTELEM *block);
#if CONFIG_GPL
static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
- ff_mmx_idct(block);
+ ff_mmx_idct (block);
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_mmx_idct (block);
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_mmxext_idct (block);
put_pixels_clamped_mmx(block, dest, line_size);
}
static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
- ff_mmxext_idct(block);
+ ff_mmxext_idct (block);
add_pixels_clamped_mmx(block, dest, line_size);
}
#endif
static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block)
{
- ff_idct_xvid_mmx(block);
+ ff_idct_xvid_mmx (block);
put_pixels_clamped_mmx(block, dest, line_size);
}
static void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block)
{
- ff_idct_xvid_mmx(block);
+ ff_idct_xvid_mmx (block);
add_pixels_clamped_mmx(block, dest, line_size);
}
static void ff_idct_xvid_mmx2_put(uint8_t *dest, int line_size, DCTELEM *block)
{
- ff_idct_xvid_mmx2(block);
+ ff_idct_xvid_mmx2 (block);
put_pixels_clamped_mmx(block, dest, line_size);
}
static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block)
{
- ff_idct_xvid_mmx2(block);
+ ff_idct_xvid_mmx2 (block);
add_pixels_clamped_mmx(block, dest, line_size);
}
@@ -1925,8 +1897,7 @@ 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)
- {
+ for(i=0; i<blocksize; i+=2) {
__asm__ volatile(
"movq %0, %%mm0 \n\t"
"movq %1, %%mm1 \n\t"
@@ -1954,11 +1925,10 @@ static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize)
int i;
__asm__ volatile(
- "movaps %0, %%xmm5 \n\t"
+ "movaps %0, %%xmm5 \n\t"
::"m"(ff_pdw_80000000[0])
);
- for(i = 0; i < blocksize; i += 4)
- {
+ for(i=0; i<blocksize; i+=4) {
__asm__ volatile(
"movaps %0, %%xmm0 \n\t"
"movaps %1, %%xmm1 \n\t"
@@ -2045,24 +2015,19 @@ static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize)
:"memory"\
);
-static void ac3_downmix_sse(float(*samples)[256], float(*matrix)[2], int out_ch, int in_ch, int len)
+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
- {
+ 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)[in_ch][2][4];
- j = 2 * in_ch * sizeof(float);
+ j = 2*in_ch*sizeof(float);
__asm__ volatile(
"1: \n"
"sub $8, %0 \n"
@@ -2077,20 +2042,16 @@ static void ac3_downmix_sse(float(*samples)[256], float(*matrix)[2], int out_ch,
:"r"(matrix_simd), "r"(matrix)
:"memory"
);
- if(out_ch == 2)
- {
+ if(out_ch == 2) {
MIX_MISC(IF1);
- }
- else
- {
+ } else {
MIX_MISC(IF0);
}
}
}
-static void vector_fmul_3dnow(float *dst, const float *src, int len)
-{
- x86_reg i = (len - 4) * 4;
+static void vector_fmul_3dnow(float *dst, const float *src, int len){
+ x86_reg i = (len-4)*4;
__asm__ volatile(
"1: \n\t"
"movq (%1,%0), %%mm0 \n\t"
@@ -2107,9 +2068,8 @@ static void vector_fmul_3dnow(float *dst, const float *src, int len)
:"memory"
);
}
-static void vector_fmul_sse(float *dst, const float *src, int len)
-{
- x86_reg i = (len - 8) * 4;
+static void vector_fmul_sse(float *dst, const float *src, int len){
+ x86_reg i = (len-8)*4;
__asm__ volatile(
"1: \n\t"
"movaps (%1,%0), %%xmm0 \n\t"
@@ -2126,9 +2086,8 @@ static void vector_fmul_sse(float *dst, const float *src, int len)
);
}
-static void vector_fmul_reverse_3dnow2(float *dst, const float *src0, const float *src1, int len)
-{
- x86_reg i = len * 4 - 16;
+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"
@@ -2145,9 +2104,8 @@ static void vector_fmul_reverse_3dnow2(float *dst, const float *src0, const floa
);
__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;
+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"
@@ -2167,9 +2125,8 @@ static void vector_fmul_reverse_sse(float *dst, const float *src0, const float *
}
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;
+ const float *src2, int len){
+ x86_reg i = (len-4)*4;
__asm__ volatile(
"1: \n\t"
"movq (%2,%0), %%mm0 \n\t"
@@ -2189,9 +2146,8 @@ const float *src2, int len)
__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;
+ const float *src2, int len){
+ x86_reg i = (len-8)*4;
__asm__ volatile(
"1: \n\t"
"movaps (%2,%0), %%xmm0 \n\t"
@@ -2211,13 +2167,11 @@ const float *src2, int len)
}
static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1,
-const float *win, float add_bias, int len)
-{
+ const float *win, float add_bias, int len){
#if HAVE_6REGS
- if(add_bias == 0)
- {
- x86_reg i = -len * 4;
- x86_reg j = len * 4 - 8;
+ if(add_bias == 0){
+ x86_reg i = -len*4;
+ x86_reg j = len*4-8;
__asm__ volatile(
"1: \n"
"pswapd (%5,%1), %%mm1 \n"
@@ -2242,20 +2196,17 @@ const float *win, float add_bias, int len)
:"+r"(i), "+r"(j)
:"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
);
- }
- else
+ }else
#endif
ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len);
}
static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1,
-const float *win, float add_bias, int len)
-{
+ const float *win, float add_bias, int len){
#if HAVE_6REGS
- if(add_bias == 0)
- {
- x86_reg i = -len * 4;
- x86_reg j = len * 4 - 16;
+ if(add_bias == 0){
+ x86_reg i = -len*4;
+ x86_reg j = len*4-16;
__asm__ volatile(
"1: \n"
"movaps (%5,%1), %%xmm1 \n"
@@ -2281,15 +2232,14 @@ const float *win, float add_bias, int len)
:"+r"(i), "+r"(j)
:"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
);
- }
- else
+ }else
#endif
ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len);
}
static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len)
{
- x86_reg i = -4 * len;
+ x86_reg i = -4*len;
__asm__ volatile(
"movss %3, %%xmm4 \n"
"shufps $0, %%xmm4, %%xmm4 \n"
@@ -2313,7 +2263,7 @@ static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul
static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len)
{
- x86_reg i = -4 * len;
+ x86_reg i = -4*len;
__asm__ volatile(
"movss %3, %%xmm4 \n"
"shufps $0, %%xmm4, %%xmm4 \n"
@@ -2331,8 +2281,7 @@ static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mu
);
}
-static void float_to_int16_3dnow(int16_t *dst, const float *src, long len)
-{
+static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){
x86_reg reglen = len;
// not bit-exact: pf2id uses different rounding than C and SSE
__asm__ volatile(
@@ -2355,8 +2304,7 @@ static void float_to_int16_3dnow(int16_t *dst, const float *src, long len)
:"+r"(reglen), "+r"(dst), "+r"(src)
);
}
-static void float_to_int16_sse(int16_t *dst, const float *src, long len)
-{
+static void float_to_int16_sse(int16_t *dst, const float *src, long len){
x86_reg reglen = len;
__asm__ volatile(
"add %0 , %0 \n\t"
@@ -2379,8 +2327,7 @@ static void float_to_int16_sse(int16_t *dst, const float *src, long len)
);
}
-static void float_to_int16_sse2(int16_t *dst, const float *src, long len)
-{
+static void float_to_int16_sse2(int16_t *dst, const float *src, long len){
x86_reg reglen = len;
__asm__ volatile(
"add %0 , %0 \n\t"
@@ -2419,8 +2366,8 @@ void ff_x264_deblock_h_luma_intra_sse2(uint8_t *pix, int stride, int alpha, int
void ff_x264_deblock_v8_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta);
static void ff_x264_deblock_v_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta)
{
- ff_x264_deblock_v8_luma_intra_mmxext(pix + 0, stride, alpha, beta);
- ff_x264_deblock_v8_luma_intra_mmxext(pix + 8, stride, alpha, beta);
+ ff_x264_deblock_v8_luma_intra_mmxext(pix+0, stride, alpha, beta);
+ ff_x264_deblock_v8_luma_intra_mmxext(pix+8, stride, alpha, beta);
}
#elif !HAVE_YASM
#define ff_float_to_int16_interleave6_sse(a,b,c) float_to_int16_interleave_misc_sse(a,b,c,6)
@@ -2464,56 +2411,55 @@ static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, lon
}
FLOAT_TO_INT16_INTERLEAVE(3dnow,
-"1: \n"
-"pf2id (%2,%0), %%mm0 \n"
-"pf2id 8(%2,%0), %%mm1 \n"
-"pf2id (%3,%0), %%mm2 \n"
-"pf2id 8(%3,%0), %%mm3 \n"
-"packssdw %%mm1, %%mm0 \n"
-"packssdw %%mm3, %%mm2 \n"
-"movq %%mm0, %%mm1 \n"
-"punpcklwd %%mm2, %%mm0 \n"
-"punpckhwd %%mm2, %%mm1 \n"
-"movq %%mm0, (%1,%0)\n"
-"movq %%mm1, 8(%1,%0)\n"
-"add $16, %0 \n"
-"js 1b \n"
-"femms \n"
- )
+ "1: \n"
+ "pf2id (%2,%0), %%mm0 \n"
+ "pf2id 8(%2,%0), %%mm1 \n"
+ "pf2id (%3,%0), %%mm2 \n"
+ "pf2id 8(%3,%0), %%mm3 \n"
+ "packssdw %%mm1, %%mm0 \n"
+ "packssdw %%mm3, %%mm2 \n"
+ "movq %%mm0, %%mm1 \n"
+ "punpcklwd %%mm2, %%mm0 \n"
+ "punpckhwd %%mm2, %%mm1 \n"
+ "movq %%mm0, (%1,%0)\n"
+ "movq %%mm1, 8(%1,%0)\n"
+ "add $16, %0 \n"
+ "js 1b \n"
+ "femms \n"
+)
FLOAT_TO_INT16_INTERLEAVE(sse,
-"1: \n"
-"cvtps2pi (%2,%0), %%mm0 \n"
-"cvtps2pi 8(%2,%0), %%mm1 \n"
-"cvtps2pi (%3,%0), %%mm2 \n"
-"cvtps2pi 8(%3,%0), %%mm3 \n"
-"packssdw %%mm1, %%mm0 \n"
-"packssdw %%mm3, %%mm2 \n"
-"movq %%mm0, %%mm1 \n"
-"punpcklwd %%mm2, %%mm0 \n"
-"punpckhwd %%mm2, %%mm1 \n"
-"movq %%mm0, (%1,%0)\n"
-"movq %%mm1, 8(%1,%0)\n"
-"add $16, %0 \n"
-"js 1b \n"
-"emms \n"
- )
+ "1: \n"
+ "cvtps2pi (%2,%0), %%mm0 \n"
+ "cvtps2pi 8(%2,%0), %%mm1 \n"
+ "cvtps2pi (%3,%0), %%mm2 \n"
+ "cvtps2pi 8(%3,%0), %%mm3 \n"
+ "packssdw %%mm1, %%mm0 \n"
+ "packssdw %%mm3, %%mm2 \n"
+ "movq %%mm0, %%mm1 \n"
+ "punpcklwd %%mm2, %%mm0 \n"
+ "punpckhwd %%mm2, %%mm1 \n"
+ "movq %%mm0, (%1,%0)\n"
+ "movq %%mm1, 8(%1,%0)\n"
+ "add $16, %0 \n"
+ "js 1b \n"
+ "emms \n"
+)
FLOAT_TO_INT16_INTERLEAVE(sse2,
-"1: \n"
-"cvtps2dq (%2,%0), %%xmm0 \n"
-"cvtps2dq (%3,%0), %%xmm1 \n"
-"packssdw %%xmm1, %%xmm0 \n"
-"movhlps %%xmm0, %%xmm1 \n"
-"punpcklwd %%xmm1, %%xmm0 \n"
-"movdqa %%xmm0, (%1,%0) \n"
-"add $16, %0 \n"
-"js 1b \n"
- )
-
-static void float_to_int16_interleave_3dn2(int16_t *dst, const float **src, long len, int channels)
-{
- if(channels == 6)
+ "1: \n"
+ "cvtps2dq (%2,%0), %%xmm0 \n"
+ "cvtps2dq (%3,%0), %%xmm1 \n"
+ "packssdw %%xmm1, %%xmm0 \n"
+ "movhlps %%xmm0, %%xmm1 \n"
+ "punpcklwd %%xmm1, %%xmm0 \n"
+ "movdqa %%xmm0, (%1,%0) \n"
+ "add $16, %0 \n"
+ "js 1b \n"
+)
+
+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);
@@ -2525,9 +2471,8 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
{
mm_flags = mm_support();
- if(avctx->dsp_mask)
- {
- if(avctx->dsp_mask & FF_MM_FORCE)
+ if (avctx->dsp_mask) {
+ if (avctx->dsp_mask & FF_MM_FORCE)
mm_flags |= (avctx->dsp_mask & 0xffff);
else
mm_flags &= ~(avctx->dsp_mask & 0xffff);
@@ -2535,91 +2480,69 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
#if 0
av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
- if(mm_flags & FF_MM_MMX)
+ if (mm_flags & FF_MM_MMX)
av_log(avctx, AV_LOG_INFO, " mmx");
- if(mm_flags & FF_MM_MMX2)
+ if (mm_flags & FF_MM_MMX2)
av_log(avctx, AV_LOG_INFO, " mmx2");
- if(mm_flags & FF_MM_3DNOW)
+ if (mm_flags & FF_MM_3DNOW)
av_log(avctx, AV_LOG_INFO, " 3dnow");
- if(mm_flags & FF_MM_SSE)
+ if (mm_flags & FF_MM_SSE)
av_log(avctx, AV_LOG_INFO, " sse");
- if(mm_flags & FF_MM_SSE2)
+ if (mm_flags & FF_MM_SSE2)
av_log(avctx, AV_LOG_INFO, " sse2");
av_log(avctx, AV_LOG_INFO, "\n");
#endif
- if(mm_flags & FF_MM_MMX)
- {
- const int idct_algo = avctx->idct_algo;
-
- if(avctx->lowres == 0)
- {
- 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;
+ if (mm_flags & FF_MM_MMX) {
+ const int idct_algo= avctx->idct_algo;
+
+ if(avctx->lowres==0){
+ 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;
+ c->idct_permutation_type= FF_SIMPLE_IDCT_PERM;
#if CONFIG_GPL
- }
- else if(idct_algo == FF_IDCT_LIBMPEG2MMX)
- {
- if(mm_flags & FF_MM_MMX2)
- {
- c->idct_put = ff_libmpeg2mmx2_idct_put;
- c->idct_add = ff_libmpeg2mmx2_idct_add;
+ }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){
+ if(mm_flags & FF_MM_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;
+ }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;
+ 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)
- {
- if(mm_flags & FF_MM_SSE2)
- {
- c->idct_put = ff_vp3_idct_put_sse2;
- c->idct_add = ff_vp3_idct_add_sse2;
+ }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) &&
+ idct_algo==FF_IDCT_VP3){
+ if(mm_flags & FF_MM_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_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;
+ 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 & FF_MM_SSE2)
- {
- c->idct_put = ff_idct_xvid_sse2_put;
- c->idct_add = ff_idct_xvid_sse2_add;
+ }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 & FF_MM_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 & FF_MM_MMX2)
- {
- c->idct_put = ff_idct_xvid_mmx2_put;
- c->idct_add = ff_idct_xvid_mmx2_add;
+ c->idct_permutation_type= FF_SSE2_IDCT_PERM;
+ }else if(mm_flags & FF_MM_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;
+ }else{
+ c->idct_put= ff_idct_xvid_mmx_put;
+ c->idct_add= ff_idct_xvid_mmx_add;
c->idct = ff_idct_xvid_mmx;
}
}
@@ -2630,8 +2553,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->add_pixels_clamped = add_pixels_clamped_mmx;
c->clear_block = clear_block_mmx;
c->clear_blocks = clear_blocks_mmx;
- if(mm_flags & FF_MM_SSE)
- {
+ if (mm_flags & FF_MM_SSE){
c->clear_block = clear_block_sse;
c->clear_blocks = clear_blocks_sse;
}
@@ -2651,42 +2573,39 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
SET_HPEL_FUNCS(avg, 1, 8, mmx);
SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx);
- c->gmc = gmc_mmx;
+ c->gmc= gmc_mmx;
- c->add_bytes = add_bytes_mmx;
- c->add_bytes_l2 = add_bytes_l2_mmx;
+ c->add_bytes= add_bytes_mmx;
+ c->add_bytes_l2= add_bytes_l2_mmx;
c->draw_edges = draw_edges_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;
+ 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;
}
- c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_mmx_rnd;
- c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_mmx;
- c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_vc1_chroma_mc8_mmx_nornd;
+ c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_rnd;
+ c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx;
+ c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_vc1_chroma_mc8_mmx_nornd;
- c->put_rv40_chroma_pixels_tab[0] = put_rv40_chroma_mc8_mmx;
- c->put_rv40_chroma_pixels_tab[1] = put_rv40_chroma_mc4_mmx;
+ c->put_rv40_chroma_pixels_tab[0]= put_rv40_chroma_mc8_mmx;
+ c->put_rv40_chroma_pixels_tab[1]= put_rv40_chroma_mc4_mmx;
- c->h264_idct_dc_add =
- c->h264_idct_add = ff_h264_idct_add_mmx;
- c->h264_idct8_dc_add =
- c->h264_idct8_add = ff_h264_idct8_add_mmx;
+ c->h264_idct_dc_add=
+ c->h264_idct_add= ff_h264_idct_add_mmx;
+ c->h264_idct8_dc_add=
+ c->h264_idct8_add= ff_h264_idct8_add_mmx;
c->h264_idct_add16 = ff_h264_idct_add16_mmx;
c->h264_idct8_add4 = ff_h264_idct8_add4_mmx;
c->h264_idct_add8 = ff_h264_idct_add8_mmx;
- c->h264_idct_add16intra = ff_h264_idct_add16intra_mmx;
+ c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx;
- if(CONFIG_VP6_DECODER)
- {
+ if (CONFIG_VP6_DECODER) {
c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx;
}
- if(mm_flags & FF_MM_MMX2)
- {
+ if (mm_flags & FF_MM_MMX2) {
c->prefetch = prefetch_mmx2;
c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
@@ -2703,15 +2622,14 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
- c->h264_idct_dc_add = ff_h264_idct_dc_add_mmx2;
- c->h264_idct8_dc_add = ff_h264_idct8_dc_add_mmx2;
+ c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2;
+ c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2;
c->h264_idct_add16 = ff_h264_idct_add16_mmx2;
c->h264_idct8_add4 = ff_h264_idct8_add4_mmx2;
c->h264_idct_add8 = ff_h264_idct_add8_mmx2;
- c->h264_idct_add16intra = ff_h264_idct_add16intra_mmx2;
+ c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2;
- if(!(avctx->flags & CODEC_FLAG_BITEXACT))
- {
+ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
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;
@@ -2719,10 +2637,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
- if(CONFIG_VP3_DECODER)
- {
- 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) {
+ c->vp3_v_loop_filter= ff_vp3_v_loop_filter_mmx2;
+ c->vp3_h_loop_filter= ff_vp3_h_loop_filter_mmx2;
}
}
@@ -2763,59 +2680,57 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2);
SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2);
- c->avg_rv40_chroma_pixels_tab[0] = avg_rv40_chroma_mc8_mmx2;
- c->avg_rv40_chroma_pixels_tab[1] = avg_rv40_chroma_mc4_mmx2;
-
- c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_vc1_chroma_mc8_mmx2_nornd;
-
- c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_mmx2_rnd;
- c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_mmx2;
- c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_mmx2;
- c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_mmx2;
- c->h264_v_loop_filter_luma = h264_v_loop_filter_luma_mmx2;
- c->h264_h_loop_filter_luma = h264_h_loop_filter_luma_mmx2;
- c->h264_v_loop_filter_chroma = h264_v_loop_filter_chroma_mmx2;
- c->h264_h_loop_filter_chroma = h264_h_loop_filter_chroma_mmx2;
- c->h264_v_loop_filter_chroma_intra = h264_v_loop_filter_chroma_intra_mmx2;
- c->h264_h_loop_filter_chroma_intra = h264_h_loop_filter_chroma_intra_mmx2;
- c->h264_loop_filter_strength = h264_loop_filter_strength_mmx2;
-
- c->weight_h264_pixels_tab[0] = ff_h264_weight_16x16_mmx2;
- c->weight_h264_pixels_tab[1] = ff_h264_weight_16x8_mmx2;
- c->weight_h264_pixels_tab[2] = ff_h264_weight_8x16_mmx2;
- c->weight_h264_pixels_tab[3] = ff_h264_weight_8x8_mmx2;
- c->weight_h264_pixels_tab[4] = ff_h264_weight_8x4_mmx2;
- c->weight_h264_pixels_tab[5] = ff_h264_weight_4x8_mmx2;
- c->weight_h264_pixels_tab[6] = ff_h264_weight_4x4_mmx2;
- c->weight_h264_pixels_tab[7] = ff_h264_weight_4x2_mmx2;
-
- c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16x16_mmx2;
- c->biweight_h264_pixels_tab[1] = ff_h264_biweight_16x8_mmx2;
- c->biweight_h264_pixels_tab[2] = ff_h264_biweight_8x16_mmx2;
- c->biweight_h264_pixels_tab[3] = ff_h264_biweight_8x8_mmx2;
- c->biweight_h264_pixels_tab[4] = ff_h264_biweight_8x4_mmx2;
- c->biweight_h264_pixels_tab[5] = ff_h264_biweight_4x8_mmx2;
- c->biweight_h264_pixels_tab[6] = ff_h264_biweight_4x4_mmx2;
- c->biweight_h264_pixels_tab[7] = ff_h264_biweight_4x2_mmx2;
+ c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_mmx2;
+ c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_mmx2;
+
+ c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_vc1_chroma_mc8_mmx2_nornd;
+
+ c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2_rnd;
+ c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2;
+ c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_mmx2;
+ c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_mmx2;
+ c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2;
+ c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2;
+ c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2;
+ c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2;
+ c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_mmx2;
+ c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_mmx2;
+ c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2;
+
+ c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2;
+ c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2;
+ c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2;
+ c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2;
+ c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2;
+ c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2;
+ c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2;
+ c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2;
+
+ c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2;
+ c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2;
+ c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2;
+ c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2;
+ c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2;
+ c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2;
+ c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2;
+ c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2;
#if HAVE_YASM && ARCH_X86_32
c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2;
#endif
#if HAVE_7REGS && HAVE_TEN_OPERANDS
- if(mm_flags & FF_MM_3DNOW)
+ if( mm_flags&FF_MM_3DNOW )
c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
#endif
- if(CONFIG_CAVS_DECODER)
+ if (CONFIG_CAVS_DECODER)
ff_cavsdsp_init_mmx2(c, avctx);
- if(CONFIG_VC1_DECODER)
+ if (CONFIG_VC1_DECODER)
ff_vc1dsp_init_mmx(c, avctx);
- c->add_png_paeth_prediction = add_png_paeth_prediction_mmx2;
- }
- else if(mm_flags & FF_MM_3DNOW)
- {
+ c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2;
+ } else if (mm_flags & FF_MM_3DNOW) {
c->prefetch = prefetch_3dnow;
c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
@@ -2832,8 +2747,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
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))
- {
+ 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;
@@ -2861,13 +2775,13 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow);
SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow);
- c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_3dnow_rnd;
- c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_3dnow;
+ c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow_rnd;
+ c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow;
- c->avg_rv40_chroma_pixels_tab[0] = avg_rv40_chroma_mc8_3dnow;
- c->avg_rv40_chroma_pixels_tab[1] = avg_rv40_chroma_mc4_3dnow;
+ c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_3dnow;
+ c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_3dnow;
- if(CONFIG_CAVS_DECODER)
+ if (CONFIG_CAVS_DECODER)
ff_cavsdsp_init_3dnow(c, avctx);
}
@@ -2877,19 +2791,17 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
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 & FF_MM_SSE2) && !(mm_flags & FF_MM_3DNOW))
- {
+ if((mm_flags & FF_MM_SSE2) && !(mm_flags & FF_MM_3DNOW)){
// these functions are slower than mmx on AMD, but faster on Intel
- /* FIXME works in most codecs, but crashes svq1 due to unaligned chroma
- c->put_pixels_tab[0][0] = put_pixels16_sse2;
- c->avg_pixels_tab[0][0] = avg_pixels16_sse2;
- */
+/* FIXME works in most codecs, but crashes svq1 due to unaligned chroma
+ c->put_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 & FF_MM_SSE2)
- {
+ if(mm_flags & FF_MM_SSE2){
c->h264_idct8_add = ff_h264_idct8_add_sse2;
- c->h264_idct8_add4 = ff_h264_idct8_add4_sse2;
+ c->h264_idct8_add4= ff_h264_idct8_add4_sse2;
H264_QPEL_FUNCS(0, 1, sse2);
H264_QPEL_FUNCS(0, 2, sse2);
@@ -2904,14 +2816,12 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
H264_QPEL_FUNCS(3, 2, sse2);
H264_QPEL_FUNCS(3, 3, sse2);
- if(CONFIG_VP6_DECODER)
- {
+ if (CONFIG_VP6_DECODER) {
c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
}
}
#if HAVE_SSSE3
- if(mm_flags & FF_MM_SSSE3)
- {
+ if(mm_flags & FF_MM_SSSE3){
H264_QPEL_FUNCS(1, 0, ssse3);
H264_QPEL_FUNCS(1, 1, ssse3);
H264_QPEL_FUNCS(1, 2, ssse3);
@@ -2924,30 +2834,28 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
H264_QPEL_FUNCS(3, 1, ssse3);
H264_QPEL_FUNCS(3, 2, ssse3);
H264_QPEL_FUNCS(3, 3, ssse3);
- c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_vc1_chroma_mc8_ssse3_nornd;
- c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_vc1_chroma_mc8_ssse3_nornd;
- c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_ssse3_rnd;
- c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_ssse3_rnd;
- c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_ssse3;
- c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_ssse3;
- c->add_png_paeth_prediction = add_png_paeth_prediction_ssse3;
+ c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_vc1_chroma_mc8_ssse3_nornd;
+ c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_vc1_chroma_mc8_ssse3_nornd;
+ c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_rnd;
+ c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_ssse3_rnd;
+ c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_ssse3;
+ c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_ssse3;
+ c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3;
#if HAVE_YASM && ARCH_X86_32
c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_ssse3;
- if(mm_flags & FF_MM_SSE4) // not really sse4, just slow on Conroe
+ if (mm_flags & FF_MM_SSE4) // not really sse4, just slow on Conroe
c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_sse4;
#endif
}
#endif
#if CONFIG_GPL && HAVE_YASM && ARCH_X86_32
- if(mm_flags & FF_MM_MMX2)
- {
+ if (mm_flags & FF_MM_MMX2){
#if ARCH_X86_32
c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_mmxext;
c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_mmxext;
#endif
- if(mm_flags & FF_MM_SSE2)
- {
+ if( mm_flags&FF_MM_SSE2 ){
#if ARCH_X86_64 || !defined(__ICC) || __ICC > 1110
c->h264_v_loop_filter_luma = ff_x264_deblock_v_luma_sse2;
c->h264_h_loop_filter_luma = ff_x264_deblock_h_luma_sse2;
@@ -2961,29 +2869,24 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
#endif
- /* disable audio related ASM for 64-bit builds */
+/* disable audio related ASM for 64-bit builds */
#if ARCH_X86_32
- if(mm_flags & FF_MM_3DNOW)
- {
+ if(mm_flags & FF_MM_3DNOW){
c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
c->vector_fmul = vector_fmul_3dnow;
- if(!(avctx->flags & CODEC_FLAG_BITEXACT))
- {
+ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->float_to_int16 = float_to_int16_3dnow;
c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
}
}
- if(mm_flags & FF_MM_3DNOWEXT)
- {
+ if(mm_flags & FF_MM_3DNOWEXT){
c->vector_fmul_reverse = vector_fmul_reverse_3dnow2;
c->vector_fmul_window = vector_fmul_window_3dnow2;
- if(!(avctx->flags & CODEC_FLAG_BITEXACT))
- {
+ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->float_to_int16_interleave = float_to_int16_interleave_3dn2;
}
}
- if(mm_flags & FF_MM_SSE)
- {
+ if(mm_flags & FF_MM_SSE){
c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse;
c->ac3_downmix = ac3_downmix_sse;
c->vector_fmul = vector_fmul_sse;
@@ -3001,8 +2904,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
if(mm_flags & FF_MM_3DNOW)
c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse
- if(mm_flags & FF_MM_SSE2)
- {
+ if(mm_flags & FF_MM_SSE2){
c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2;
c->float_to_int16 = float_to_int16_sse2;
c->float_to_int16_interleave = float_to_int16_interleave_sse2;
@@ -3010,27 +2912,27 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
#endif /* ARCH_X86_32 */
}
- if(CONFIG_ENCODERS)
+ if (CONFIG_ENCODERS)
dsputilenc_init_mmx(c, avctx);
}
-const char* avcodec_get_current_idct_mmx(AVCodecContext *avctx, DSPContext *c)
+const char* avcodec_get_current_idct_mmx(AVCodecContext *avctx,DSPContext *c)
{
- if(c->idct_put == ff_idct_xvid_mmx_put)
+ if (c->idct_put==ff_idct_xvid_mmx_put)
return "Xvid (ff_idct_xvid_mmx)";
- if(c->idct_put == ff_idct_xvid_mmx2_put)
+ if (c->idct_put==ff_idct_xvid_mmx2_put)
return "Xvid (ff_idct_xvid_mmx2)";
- if(c->idct_put == ff_idct_xvid_sse2_put)
+ if (c->idct_put==ff_idct_xvid_sse2_put)
return "Xvid (ff_idct_xvid_sse2)";
- if(c->idct_put == ff_simple_idct_put_mmx)
+ if (c->idct_put==ff_simple_idct_put_mmx)
return "Simple MMX (ff_simple_idct_mmx)";
- if(c->idct_put == ff_libmpeg2mmx2_idct_put)
+ if (c->idct_put==ff_libmpeg2mmx2_idct_put)
return "libmpeg2 (ff_libmpeg2mmx2_idct)";
- if(c->idct_put == ff_libmpeg2mmx_idct_put)
+ if (c->idct_put==ff_libmpeg2mmx_idct_put)
return "libmpeg2 (ff_libmpeg2mmx_idct)";
- if(c->idct_put == ff_vp3_idct_put_sse2)
+ if (c->idct_put==ff_vp3_idct_put_sse2)
return "VP3 (ff_vp3_idct_sse2)";
- if(c->idct_put == ff_vp3_idct_put_mmx)
+ if (c->idct_put==ff_vp3_idct_put_mmx)
return "VP3 (ff_vp3_idct_mmx)";
return NULL;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h
index 9355b696c..c0ef49b30 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h
@@ -25,10 +25,7 @@
#include <stdint.h>
#include "libavcodec/dsputil.h"
-typedef struct
-{
- uint64_t a, b;
-} xmm_reg;
+typedef struct { uint64_t a, b; } xmm_reg;
extern const uint64_t ff_bone;
extern const uint64_t ff_wtwo;
@@ -84,7 +81,7 @@ extern const double ff_pd_2[2];
"mov" #m " " #a ", " #t " \n\t" /* abcd */\
"punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
"punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
-
+
#define TRANSPOSE4(a,b,c,d,t)\
SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_avg_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_avg_template.c
index 5a735f8ad..218d5995a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_avg_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_avg_template.c
@@ -51,7 +51,7 @@ static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -59,7 +59,7 @@ static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
{
__asm__ volatile(
"testl $1, %0 \n\t"
- " jz 1f \n\t"
+ " jz 1f \n\t"
"movd (%1), %%mm0 \n\t"
"movd (%2), %%mm1 \n\t"
"add %4, %1 \n\t"
@@ -110,7 +110,7 @@ static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
{
__asm__ volatile(
"testl $1, %0 \n\t"
- " jz 1f \n\t"
+ " jz 1f \n\t"
"movq (%1), %%mm0 \n\t"
"movq (%2), %%mm1 \n\t"
"add %4, %1 \n\t"
@@ -151,9 +151,9 @@ static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
:"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");*/
+/* :"+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)
@@ -161,7 +161,7 @@ static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src
__asm__ volatile(
"pcmpeqb %%mm6, %%mm6 \n\t"
"testl $1, %0 \n\t"
- " jz 1f \n\t"
+ " jz 1f \n\t"
"movq (%1), %%mm0 \n\t"
"movq (%2), %%mm1 \n\t"
"add %4, %1 \n\t"
@@ -221,16 +221,16 @@ static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src
:"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");*/
+/* :"+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"
+ " jz 1f \n\t"
"movd (%1), %%mm0 \n\t"
"movd (%2), %%mm1 \n\t"
"add %4, %1 \n\t"
@@ -282,7 +282,7 @@ static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
{
__asm__ volatile(
"testl $1, %0 \n\t"
- " jz 1f \n\t"
+ " jz 1f \n\t"
"movq (%1), %%mm0 \n\t"
"movq (%2), %%mm1 \n\t"
"add %4, %1 \n\t"
@@ -328,9 +328,9 @@ static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
:"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");*/
+/* :"+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)
@@ -369,7 +369,7 @@ static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -377,7 +377,7 @@ static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
{
__asm__ volatile(
"testl $1, %0 \n\t"
- " jz 1f \n\t"
+ " jz 1f \n\t"
"movq (%1), %%mm0 \n\t"
"movq 8(%1), %%mm1 \n\t"
PAVGB" (%2), %%mm0 \n\t"
@@ -416,16 +416,16 @@ static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
:"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");*/
+/* :"+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"
+ " jz 1f \n\t"
"movq (%1), %%mm0 \n\t"
"movq 8(%1), %%mm1 \n\t"
PAVGB" (%2), %%mm0 \n\t"
@@ -470,9 +470,9 @@ static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int
:"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");*/
+/* :"+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)
@@ -480,7 +480,7 @@ static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *sr
__asm__ volatile(
"pcmpeqb %%mm6, %%mm6 \n\t"
"testl $1, %0 \n\t"
- " jz 1f \n\t"
+ " jz 1f \n\t"
"movq (%1), %%mm0 \n\t"
"movq 8(%1), %%mm1 \n\t"
"movq (%2), %%mm2 \n\t"
@@ -543,9 +543,9 @@ static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *sr
:"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");*/
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
}
/* GL: this function does incorrect rounding if overflow */
@@ -582,7 +582,7 @@ static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, in
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -611,8 +611,8 @@ static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_
"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)
+ :"+g"(h), "+S"(pixels), "+D" (block)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -645,8 +645,8 @@ static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, in
"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)
+ :"+g"(h), "+S"(pixels), "+D" (block)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -674,7 +674,7 @@ static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_siz
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -706,7 +706,7 @@ static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -744,7 +744,7 @@ static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -757,7 +757,7 @@ static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line
"lea (%3, %3), %%"REG_a" \n\t"
"movq (%1), %%mm0 \n\t"
PAVGB" 1(%1), %%mm0 \n\t"
- ASMALIGN(3)
+ ASMALIGN(3)
"1: \n\t"
"movq (%1, %%"REG_a"), %%mm2 \n\t"
"movq (%1, %3), %%mm1 \n\t"
@@ -787,14 +787,13 @@ static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line
"subl $4, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels), "+D"(block)
- :"r"((x86_reg)line_size)
+ :"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
- {
+ do {
__asm__ volatile(
"movd (%1), %%mm0 \n\t"
"movd (%1, %2), %%mm1 \n\t"
@@ -809,50 +808,42 @@ static void DEF(avg_pixels4)(uint8_t *block, const uint8_t *pixels, int line_siz
"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)
+ "r" ((x86_reg)line_size), "r"((x86_reg)3L*line_size)
:"memory");
- block += 4 * line_size;
- pixels += 4 * line_size;
+ block += 4*line_size;
+ pixels += 4*line_size;
h -= 4;
- }
- while(h > 0);
+ } 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)
-{
+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);
+ 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)
-{
+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);
+ 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)
-{
+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);
+ 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)
-{
+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);
+ 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)
-{
+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);
+ 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)
-{
+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);
+ 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)
-{
+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);
+ DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
}
#define QPEL_2TAP_L3(OPNAME) \
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_qns_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_qns_template.c
index b2c080818..677618a90 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_qns_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_qns_template.c
@@ -26,10 +26,10 @@
static int DEF(try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale)
{
- x86_reg i = 0;
+ x86_reg i=0;
assert(FFABS(scale) < MAX_ABS);
- scale <<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
+ scale<<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
SET_RND(mm6);
__asm__ volatile(
@@ -60,7 +60,7 @@ static int DEF(try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[
"psrld $2, %%mm7 \n\t"
"movd %%mm7, %0 \n\t"
- : "+r"(i)
+ : "+r" (i)
: "r"(basis), "r"(rem), "r"(weight), "g"(scale)
);
return i;
@@ -68,38 +68,34 @@ static int DEF(try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[
static void DEF(add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale)
{
- x86_reg i = 0;
+ x86_reg i=0;
- if(FFABS(scale) < MAX_ABS)
- {
- scale <<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
+ if(FFABS(scale) < MAX_ABS){
+ scale<<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
SET_RND(mm6);
__asm__ volatile(
- "movd %3, %%mm5 \n\t"
- "punpcklwd %%mm5, %%mm5 \n\t"
- "punpcklwd %%mm5, %%mm5 \n\t"
- ASMALIGN(4)
- "1: \n\t"
- "movq (%1, %0), %%mm0 \n\t"
- "movq 8(%1, %0), %%mm1 \n\t"
- PMULHRW(%%mm0, %%mm1, %%mm5, %%mm6)
- "paddw (%2, %0), %%mm0 \n\t"
- "paddw 8(%2, %0), %%mm1 \n\t"
- "movq %%mm0, (%2, %0) \n\t"
- "movq %%mm1, 8(%2, %0) \n\t"
- "add $16, %0 \n\t"
- "cmp $128, %0 \n\t" // FIXME optimize & bench
- " jb 1b \n\t"
+ "movd %3, %%mm5 \n\t"
+ "punpcklwd %%mm5, %%mm5 \n\t"
+ "punpcklwd %%mm5, %%mm5 \n\t"
+ ASMALIGN(4)
+ "1: \n\t"
+ "movq (%1, %0), %%mm0 \n\t"
+ "movq 8(%1, %0), %%mm1 \n\t"
+ PMULHRW(%%mm0, %%mm1, %%mm5, %%mm6)
+ "paddw (%2, %0), %%mm0 \n\t"
+ "paddw 8(%2, %0), %%mm1 \n\t"
+ "movq %%mm0, (%2, %0) \n\t"
+ "movq %%mm1, 8(%2, %0) \n\t"
+ "add $16, %0 \n\t"
+ "cmp $128, %0 \n\t" // FIXME optimize & bench
+ " jb 1b \n\t"
- : "+r"(i)
- : "r"(basis), "r"(rem), "g"(scale)
+ : "+r" (i)
+ : "r"(basis), "r"(rem), "g"(scale)
);
- }
- else
- {
- for(i = 0; i < 8 * 8; i++)
- {
- rem[i] += (basis[i] * scale + (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >> (BASIS_SHIFT - RECON_SHIFT);
+ }else{
+ for(i=0; i<8*8; i++){
+ rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT);
}
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_rnd_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_rnd_template.c
index 702fba01c..d4dfb41e6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_rnd_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx_rnd_template.c
@@ -302,20 +302,19 @@ static void av_unused DEF(avg, pixels4)(uint8_t *block, const uint8_t *pixels, i
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
- "movd %0, %%mm0 \n\t"
- "movd %1, %%mm1 \n\t"
- OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
- "movd %%mm2, %0 \n\t"
- :"+m"(*block)
- :"m"(*pixels)
- :"memory");
+ "movd %0, %%mm0 \n\t"
+ "movd %1, %%mm1 \n\t"
+ OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
+ "movd %%mm2, %0 \n\t"
+ :"+m"(*block)
+ :"m"(*pixels)
+ :"memory");
pixels += line_size;
block += line_size;
}
- while(--h);
+ while (--h);
}
// in case more speed is needed - unroling would certainly help
@@ -323,52 +322,49 @@ static void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, int line_si
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
- "movq %0, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
- "movq %%mm2, %0 \n\t"
- :"+m"(*block)
- :"m"(*pixels)
- :"memory");
+ "movq %0, %%mm0 \n\t"
+ "movq %1, %%mm1 \n\t"
+ OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
+ "movq %%mm2, %0 \n\t"
+ :"+m"(*block)
+ :"m"(*pixels)
+ :"memory");
pixels += line_size;
block += line_size;
}
- while(--h);
+ while (--h);
}
static void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
- "movq %0, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
- "movq %%mm2, %0 \n\t"
- "movq 8%0, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
- "movq %%mm2, 8%0 \n\t"
- :"+m"(*block)
- :"m"(*pixels)
- :"memory");
+ "movq %0, %%mm0 \n\t"
+ "movq %1, %%mm1 \n\t"
+ OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
+ "movq %%mm2, %0 \n\t"
+ "movq 8%0, %%mm0 \n\t"
+ "movq 8%1, %%mm1 \n\t"
+ OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
+ "movq %%mm2, 8%0 \n\t"
+ :"+m"(*block)
+ :"m"(*pixels)
+ :"memory");
pixels += line_size;
block += line_size;
}
- while(--h);
+ while (--h);
}
static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
"movq %1, %%mm0 \n\t"
"movq 1%1, %%mm1 \n\t"
@@ -381,16 +377,14 @@ static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line
:"memory");
pixels += line_size;
block += line_size;
- }
- while(--h);
+ } while (--h);
}
static av_unused void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
"movq %1, %%mm0 \n\t"
"movq %2, %%mm1 \n\t"
@@ -404,16 +398,14 @@ static av_unused void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t
dst += dstStride;
src1 += src1Stride;
src2 += 8;
- }
- while(--h);
+ } while (--h);
}
static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
"movq %1, %%mm0 \n\t"
"movq 1%1, %%mm1 \n\t"
@@ -432,16 +424,14 @@ static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int lin
:"memory");
pixels += line_size;
block += line_size;
- }
- while(--h);
+ } while (--h);
}
static av_unused void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
{
MOVQ_BFE(mm6);
JUMPALIGN();
- do
- {
+ do {
__asm__ volatile(
"movq %1, %%mm0 \n\t"
"movq %2, %%mm1 \n\t"
@@ -461,8 +451,7 @@ static av_unused void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t
dst += dstStride;
src1 += src1Stride;
src2 += 16;
- }
- while(--h);
+ } while (--h);
}
static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
@@ -540,12 +529,12 @@ static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
"paddusw %%mm1, %%mm5 \n\t"
"psrlw $2, %%mm4 \n\t"
"psrlw $2, %%mm5 \n\t"
- "movq (%2, %%"REG_a"), %%mm3 \n\t"
+ "movq (%2, %%"REG_a"), %%mm3 \n\t"
"packuswb %%mm5, %%mm4 \n\t"
- "pcmpeqd %%mm2, %%mm2 \n\t"
- "paddb %%mm2, %%mm2 \n\t"
- OP_AVG(%%mm3, %%mm4, %%mm5, %%mm2)
- "movq %%mm5, (%2, %%"REG_a") \n\t"
+ "pcmpeqd %%mm2, %%mm2 \n\t"
+ "paddb %%mm2, %%mm2 \n\t"
+ OP_AVG(%%mm3, %%mm4, %%mm5, %%mm2)
+ "movq %%mm5, (%2, %%"REG_a") \n\t"
"add %3, %%"REG_a" \n\t"
"movq (%1, %%"REG_a"), %%mm2 \n\t" // 0 <-> 2 1 <-> 3
@@ -564,12 +553,12 @@ static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
"paddusw %%mm5, %%mm1 \n\t"
"psrlw $2, %%mm0 \n\t"
"psrlw $2, %%mm1 \n\t"
- "movq (%2, %%"REG_a"), %%mm3 \n\t"
+ "movq (%2, %%"REG_a"), %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
- "pcmpeqd %%mm2, %%mm2 \n\t"
- "paddb %%mm2, %%mm2 \n\t"
- OP_AVG(%%mm3, %%mm0, %%mm1, %%mm2)
- "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "pcmpeqd %%mm2, %%mm2 \n\t"
+ "paddb %%mm2, %%mm2 \n\t"
+ OP_AVG(%%mm3, %%mm0, %%mm1, %%mm2)
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
"add %3, %%"REG_a" \n\t"
"subl $2, %0 \n\t"
@@ -580,26 +569,22 @@ static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
}
//FIXME optimize
-static void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int 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);
+ DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
}
-static void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
+static void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
DEF(put, pixels8_xy2)(block , pixels , line_size, h);
- DEF(put, pixels8_xy2)(block + 8, pixels + 8, line_size, h);
+ DEF(put, pixels8_xy2)(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)
-{
+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);
+ 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)
-{
+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);
+ DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fdct_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fdct_mmx.c
index 70bcf0be6..319daf28b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fdct_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fdct_mmx.c
@@ -55,15 +55,13 @@
#define X8(x) x,x,x,x,x,x,x,x
//concatenated table, for forward DCT transformation
-static const int16_t fdct_tg_all_16[24] ATTR_ALIGN(16) =
-{
+static const int16_t fdct_tg_all_16[24] ATTR_ALIGN(16) = {
X8(13036), // tg * (2<<16) + 0.5
X8(27146), // tg * (2<<16) + 0.5
X8(-21746) // tg * (2<<16) + 0.5
};
-static const int16_t ocos_4_16[8] ATTR_ALIGN(16) =
-{
+static const int16_t ocos_4_16[8] ATTR_ALIGN(16) = {
X8(23170) //cos * (2<<15) + 0.5
};
@@ -73,96 +71,92 @@ static const int32_t fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW };
static struct
{
- const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16);
-} fdct_r_row_sse2 ATTR_ALIGN(16) =
-{
- {
- RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
- }
-};
+ const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16);
+} fdct_r_row_sse2 ATTR_ALIGN(16)=
+{{
+ RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
+}};
//static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
-static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = // 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 const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // 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
{
- const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16);
+ const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16);
} tab_frw_01234567_sse2 ATTR_ALIGN(16) =
-{
- {
+{{
//static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table
#define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \
C4, C4, C5, C7, C2, C6, C3, -C7, \
@@ -176,7 +170,7 @@ static struct
#define C5 12873
#define C6 8867
#define C7 4520
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -192,7 +186,7 @@ static struct
#define C5 17855
#define C6 12299
#define C7 6270
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -208,7 +202,7 @@ static struct
#define C5 16819
#define C6 11585
#define C7 5906
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -224,7 +218,7 @@ static struct
#define C5 15137
#define C6 10426
#define C7 5315
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -240,7 +234,7 @@ static struct
#define C5 12873
#define C6 8867
#define C7 4520
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -256,7 +250,7 @@ static struct
#define C5 15137
#define C6 10426
#define C7 5315
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -272,7 +266,7 @@ static struct
#define C5 16819
#define C6 11585
#define C7 5906
- TABLE_SSE2
+TABLE_SSE2
#undef C1
#undef C2
@@ -288,9 +282,8 @@ static struct
#define C5 17855
#define C6 12299
#define C7 6270
- TABLE_SSE2
- }
-};
+TABLE_SSE2
+}};
#define S(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
@@ -419,33 +412,33 @@ static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
"movdqa %%xmm1, " #i "(%4) \n\t"
"movdqa (%2), %%xmm6 \n\t"
- FDCT_ROW_SSE2_H1(0, 0)
+ FDCT_ROW_SSE2_H1(0,0)
FDCT_ROW_SSE2(0)
- FDCT_ROW_SSE2_H2(64, 0)
+ FDCT_ROW_SSE2_H2(64,0)
FDCT_ROW_SSE2(64)
- FDCT_ROW_SSE2_H1(16, 64)
+ FDCT_ROW_SSE2_H1(16,64)
FDCT_ROW_SSE2(16)
- FDCT_ROW_SSE2_H2(112, 64)
+ FDCT_ROW_SSE2_H2(112,64)
FDCT_ROW_SSE2(112)
- FDCT_ROW_SSE2_H1(32, 128)
+ FDCT_ROW_SSE2_H1(32,128)
FDCT_ROW_SSE2(32)
- FDCT_ROW_SSE2_H2(96, 128)
+ FDCT_ROW_SSE2_H2(96,128)
FDCT_ROW_SSE2(96)
- FDCT_ROW_SSE2_H1(48, 192)
+ FDCT_ROW_SSE2_H1(48,192)
FDCT_ROW_SSE2(48)
- FDCT_ROW_SSE2_H2(80, 192)
+ 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)
+ : "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)
);
}
static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table)
{
- __asm__ volatile(
+ __asm__ volatile (
"pshufw $0x1B, 8(%0), %%mm5 \n\t"
"movq (%0), %%mm0 \n\t"
"movq %%mm0, %%mm1 \n\t"
@@ -486,7 +479,7 @@ static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, cons
"movq %%mm3, (%3) \n\t"
"movq %%mm7, 8(%3) \n\t"
:
- : "r"(in), "r"(table), "r"(fdct_r_row), "r"(out));
+ : "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)
@@ -537,21 +530,20 @@ static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const
"movq %%mm3, 0(%3) \n\t"
"movq %%mm7, 8(%3) \n\t"
:
- : "r"(in), "r"(table), "r"(fdct_r_row), "r"(out));
+ : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
}
void ff_fdct_mmx(int16_t *block)
{
int64_t align_tmp[16] ATTR_ALIGN(8);
- int16_t * block1 = (int16_t*)align_tmp;
- const int16_t *table = tab_frw_01234567;
+ 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--)
- {
+ for(i=8;i>0;i--) {
fdct_row_mmx(block1, block, table);
block1 += 8;
table += 32;
@@ -562,15 +554,14 @@ void ff_fdct_mmx(int16_t *block)
void ff_fdct_mmx2(int16_t *block)
{
int64_t align_tmp[16] ATTR_ALIGN(8);
- int16_t *block1 = (int16_t*)align_tmp;
- const int16_t *table = tab_frw_01234567;
+ 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--)
- {
+ for(i=8;i>0;i--) {
fdct_row_mmx2(block1, block, table);
block1 += 8;
table += 32;
@@ -581,7 +572,7 @@ void ff_fdct_mmx2(int16_t *block)
void ff_fdct_sse2(int16_t *block)
{
int64_t align_tmp[16] ATTR_ALIGN(16);
- int16_t * const block1 = (int16_t*)align_tmp;
+ int16_t * const block1= (int16_t*)align_tmp;
fdct_col_sse2(block, block1, 0);
fdct_row_sse2(block1, block);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft.c
index c5c196233..ad395991e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft.c
@@ -21,29 +21,24 @@
av_cold void ff_fft_init_mmx(FFTContext *s)
{
- /* Crashes on 64-bit
- * ToDo: verify if that is still the case with the current code and with GCC 4.3.3 and above
- */
+/* Crashes on 64-bit
+ * ToDo: verify if that is still the case with the current code and with GCC 4.3.3 and above
+ */
#if HAVE_YASM && ARCH_X86_32
int has_vectors = mm_support();
- if(has_vectors & FF_MM_SSE && HAVE_SSE)
- {
+ if (has_vectors & FF_MM_SSE && HAVE_SSE) {
/* SSE for P3/P4/K8 */
s->imdct_calc = ff_imdct_calc_sse;
/* crashes DTS decoder */
//s->imdct_half = ff_imdct_half_sse;
s->fft_permute = ff_fft_permute_sse;
s->fft_calc = ff_fft_calc_sse;
- }
- else if(has_vectors & FF_MM_3DNOWEXT && HAVE_AMD3DNOWEXT)
- {
+ } else if (has_vectors & FF_MM_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 & FF_MM_3DNOW && HAVE_AMD3DNOW)
- {
+ } else if (has_vectors & FF_MM_3DNOW && HAVE_AMD3DNOW) {
/* 3DNow! for K6-2/3 */
s->imdct_calc = ff_imdct_calc_3dn;
s->imdct_half = ff_imdct_half_3dn;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_3dn2.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_3dn2.c
index 329131dd6..160caeecf 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_3dn2.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_3dn2.c
@@ -23,7 +23,7 @@
#include "libavcodec/dsputil.h"
#include "fft.h"
-DECLARE_ALIGNED_8(static const int, m1m1)[2] = { 1 << 31, 1 << 31 };
+DECLARE_ALIGNED_8(static const int, m1m1)[2] = { 1<<31, 1<<31 };
#ifdef EMULATE_3DNOWEXT
#define PSWAPD(s,d)\
@@ -44,12 +44,12 @@ 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 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)
+ for(i=0; i<n; i+=2)
FFSWAP(FFTSample, z[i].im, z[i+1].re);
}
@@ -72,8 +72,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
#ifdef EMULATE_3DNOWEXT
__asm__ volatile("movd %0, %%mm7" ::"r"(1<<31));
#endif
- for(k = 0; k < n4; k++)
- {
+ 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"
@@ -81,7 +80,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
"punpckldq %1, %%mm0 \n"
"punpckldq %3, %%mm1 \n"
"movq %%mm0, %%mm2 \n"
- PSWAPD(%%mm1, %%mm3)
+ PSWAPD( %%mm1, %%mm3 )
"pfmul %%mm1, %%mm0 \n"
"pfmul %%mm3, %%mm2 \n"
#ifdef EMULATE_3DNOWEXT
@@ -94,7 +93,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
"pfpnacc %%mm2, %%mm0 \n"
#endif
::"m"(in2[-2*k]), "m"(in1[2*k]),
- "m"(tcos[k]), "m"(tsin[k])
+ "m"(tcos[k]), "m"(tsin[k])
);
__asm__ volatile(
"movq %%mm0, %0 \n\t"
@@ -118,7 +117,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
/* post rotation */
j = -n2;
- k = n2 - 8;
+ k = n2-8;
__asm__ volatile(
"1: \n"
CMUL(%0, %%mm0, %%mm1)
@@ -151,15 +150,15 @@ void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
long n = 1 << s->mdct_bits;
long n4 = n >> 2;
- ff_imdct_half_3dn2(s, output + n4, input);
+ ff_imdct_half_3dn2(s, output+n4, input);
j = -n;
- k = n - 8;
+ k = n-8;
__asm__ volatile(
"movq %4, %%mm7 \n"
"1: \n"
- PSWAPD((%2, %1), %%mm0)
- PSWAPD((%3, %0), %%mm1)
+ PSWAPD((%2,%1), %%mm0)
+ PSWAPD((%3,%0), %%mm1)
"pxor %%mm7, %%mm0 \n"
"movq %%mm1, (%3,%1) \n"
"movq %%mm0, (%2,%0) \n"
@@ -168,7 +167,7 @@ void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
"jl 1b \n"
:"+r"(j), "+r"(k)
:"r"(output+n4), "r"(output+n4*3),
- "m"(*m1m1)
+ "m"(*m1m1)
);
__asm__ volatile("femms");
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_sse.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_sse.c
index 0ef49497f..726e186b5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_sse.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/fft_sse.c
@@ -24,7 +24,7 @@
#include "fft.h"
DECLARE_ALIGNED(16, static const int, m1m1m1m1)[4] =
-{ 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
+ { 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
@@ -35,9 +35,8 @@ void ff_fft_calc_sse(FFTContext *s, FFTComplex *z)
ff_fft_dispatch_interleave_sse(z, s->nbits);
- if(n <= 16)
- {
- x86_reg i = -8 * n;
+ if(n <= 16) {
+ x86_reg i = -8*n;
__asm__ volatile(
"1: \n"
"movaps (%0,%1), %%xmm0 \n"
@@ -59,18 +58,17 @@ void ff_fft_permute_sse(FFTContext *s, FFTComplex *z)
{
int n = 1 << s->nbits;
int i;
- for(i = 0; i < n; i += 2)
- {
+ 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"(s->tmp_buf[s->revtab[i+1]])
:"m"(z[i])
);
}
- memcpy(z, s->tmp_buf, n * sizeof(FFTComplex));
+ memcpy(z, s->tmp_buf, n*sizeof(FFTComplex));
}
void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
@@ -86,8 +84,7 @@ void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
FFTComplex *z = (FFTComplex *)output;
/* pre rotation */
- for(k = n8 - 2; k >= 0; k -= 2)
- {
+ for(k=n8-2; k>=0; k-=2) {
__asm__ volatile(
"movaps (%2,%1,2), %%xmm0 \n" // { z[k].re, z[k].im, z[k+1].re, z[k+1].im }
"movaps -16(%2,%0,2), %%xmm1 \n" // { z[-k-2].re, z[-k-2].im, z[-k-1].re, z[-k-1].im }
@@ -110,20 +107,20 @@ void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
"unpcklps %%xmm2, %%xmm1 \n" // { z[k], z[k+1] }
"unpckhps %%xmm2, %%xmm0 \n" // { z[-k-2], z[-k-1] }
::"r"(-4*k), "r"(4*k),
- "r"(input+n4), "r"(tcos+n8), "r"(tsin+n8)
+ "r"(input+n4), "r"(tcos+n8), "r"(tsin+n8)
);
#if ARCH_X86_64
// if we have enough regs, don't let gcc make the luts latency-bound
// but if not, latency is faster than spilling
__asm__("movlps %%xmm0, %0 \n"
- "movhps %%xmm0, %1 \n"
- "movlps %%xmm1, %2 \n"
- "movhps %%xmm1, %3 \n"
- :"=m"(z[revtab[-k-2]]),
- "=m"(z[revtab[-k-1]]),
- "=m"(z[revtab[ k ]]),
- "=m"(z[revtab[ k+1]])
- );
+ "movhps %%xmm0, %1 \n"
+ "movlps %%xmm1, %2 \n"
+ "movhps %%xmm1, %3 \n"
+ :"=m"(z[revtab[-k-2]]),
+ "=m"(z[revtab[-k-1]]),
+ "=m"(z[revtab[ k ]]),
+ "=m"(z[revtab[ k+1]])
+ );
#else
__asm__("movlps %%xmm0, %0" :"=m"(z[revtab[-k-2]]));
__asm__("movhps %%xmm0, %0" :"=m"(z[revtab[-k-1]]));
@@ -149,7 +146,7 @@ void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
"addps %%xmm7, "#xmm1"\n"
j = -n2;
- k = n2 - 16;
+ k = n2-16;
__asm__ volatile(
"1: \n"
CMUL(%0, %%xmm0, %%xmm1)
@@ -181,10 +178,10 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
long n = 1 << s->mdct_bits;
long n4 = n >> 2;
- ff_imdct_half_sse(s, output + n4, input);
+ ff_imdct_half_sse(s, output+n4, input);
j = -n;
- k = n - 16;
+ k = n-16;
__asm__ volatile(
"movaps %4, %%xmm7 \n"
"1: \n"
@@ -200,7 +197,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
"jl 1b \n"
:"+r"(j), "+r"(k)
:"r"(output+n4), "r"(output+n4*3),
- "m"(*m1m1m1m1)
+ "m"(*m1m1m1m1)
);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_i386.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_i386.h
index d393e8945..d16e633f2 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_i386.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_i386.h
@@ -36,11 +36,10 @@
#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
static int decode_significance_x86(CABACContext *c, int max_coeff,
uint8_t *significant_coeff_ctx_base,
- int *index)
-{
- void *end = significant_coeff_ctx_base + max_coeff - 1;
- int minusstart = -(int)significant_coeff_ctx_base;
- int minusindex = 4 - (int)index;
+ int *index){
+ void *end= significant_coeff_ctx_base + max_coeff - 1;
+ int minusstart= -(int)significant_coeff_ctx_base;
+ int minusindex= 4-(int)index;
int coeff_count;
__asm__ volatile(
"movl "RANGE "(%3), %%esi \n\t"
@@ -91,11 +90,10 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
static int decode_significance_8x8_x86(CABACContext *c,
uint8_t *significant_coeff_ctx_base,
- int *index, const uint8_t *sig_off)
-{
- int minusindex = 4 - (int)index;
+ int *index, const uint8_t *sig_off){
+ int minusindex= 4-(int)index;
int coeff_count;
- x86_reg last = 0;
+ x86_reg last=0;
__asm__ volatile(
"movl "RANGE "(%3), %%esi \n\t"
"movl "LOW "(%3), %%ebx \n\t"
@@ -143,13 +141,13 @@ static int decode_significance_8x8_x86(CABACContext *c,
"movl %%esi, "RANGE "(%3) \n\t"
"movl %%ebx, "LOW "(%3) \n\t"
- :"=&a"(coeff_count), "+m"(last), "+m"(index)
+ :"=&a"(coeff_count),"+m"(last), "+m"(index)
:"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)
: "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"
);
return coeff_count;
}
#endif /* ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE */
-/* !defined(BROKEN_RELOCATIONS) */
+ /* !defined(BROKEN_RELOCATIONS) */
#endif /* AVCODEC_X86_H264_I386_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264dsp_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264dsp_mmx.c
index a2dc52b48..cfe3429aa 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264dsp_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264dsp_mmx.c
@@ -20,8 +20,8 @@
#include "dsputil_mmx.h"
-DECLARE_ALIGNED_8(static const uint64_t, ff_pb_3_1) = 0x0103010301030103ULL;
-DECLARE_ALIGNED_8(static const uint64_t, ff_pb_7_3) = 0x0307030703070307ULL;
+DECLARE_ALIGNED_8 (static const uint64_t, ff_pb_3_1 ) = 0x0103010301030103ULL;
+DECLARE_ALIGNED_8 (static const uint64_t, ff_pb_7_3 ) = 0x0307030703070307ULL;
/***********************************/
/* IDCT */
@@ -62,34 +62,34 @@ static void ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride)
"movq 8(%0), %%mm1 \n\t"
"movq 16(%0), %%mm2 \n\t"
"movq 24(%0), %%mm3 \n\t"
- :: "r"(block));
+ :: "r"(block) );
__asm__ volatile(
/* mm1=s02+s13 mm2=s02-s13 mm4=d02+d13 mm0=d02-d13 */
- IDCT4_1D(%%mm2, %%mm1, %%mm0, %%mm3, %%mm4)
+ IDCT4_1D( %%mm2, %%mm1, %%mm0, %%mm3, %%mm4 )
"movq %0, %%mm6 \n\t"
/* in: 1,4,0,2 out: 1,2,3,0 */
- TRANSPOSE4(%%mm3, %%mm1, %%mm0, %%mm2, %%mm4)
+ TRANSPOSE4( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 )
"paddw %%mm6, %%mm3 \n\t"
/* mm2=s02+s13 mm3=s02-s13 mm4=d02+d13 mm1=d02-d13 */
- IDCT4_1D(%%mm4, %%mm2, %%mm3, %%mm0, %%mm1)
+ IDCT4_1D( %%mm4, %%mm2, %%mm3, %%mm0, %%mm1 )
"pxor %%mm7, %%mm7 \n\t"
- :: "m"(ff_pw_32));
+ :: "m"(ff_pw_32));
__asm__ volatile(
- STORE_DIFF_4P(%%mm0, %%mm1, %%mm7)
+ STORE_DIFF_4P( %%mm0, %%mm1, %%mm7)
"add %1, %0 \n\t"
- STORE_DIFF_4P(%%mm2, %%mm1, %%mm7)
+ STORE_DIFF_4P( %%mm2, %%mm1, %%mm7)
"add %1, %0 \n\t"
- STORE_DIFF_4P(%%mm3, %%mm1, %%mm7)
+ STORE_DIFF_4P( %%mm3, %%mm1, %%mm7)
"add %1, %0 \n\t"
- STORE_DIFF_4P(%%mm4, %%mm1, %%mm7)
+ STORE_DIFF_4P( %%mm4, %%mm1, %%mm7)
: "+r"(dst)
- : "r"((x86_reg)stride)
+ : "r" ((x86_reg)stride)
);
}
@@ -143,13 +143,13 @@ static inline void h264_idct8_1d(int16_t *block)
"movq (%0), %%mm2 \n\t"
"movq 64(%0), %%mm0 \n\t"
- SUMSUB_BA(%%mm0, %%mm2)
- SUMSUB_BA(%%mm6, %%mm0)
- SUMSUB_BA(%%mm4, %%mm2)
- SUMSUB_BA(%%mm7, %%mm6)
- SUMSUB_BA(%%mm5, %%mm4)
- SUMSUB_BA(%%mm3, %%mm2)
- SUMSUB_BA(%%mm1, %%mm0)
+ SUMSUB_BA( %%mm0, %%mm2 )
+ SUMSUB_BA( %%mm6, %%mm0 )
+ SUMSUB_BA( %%mm4, %%mm2 )
+ SUMSUB_BA( %%mm7, %%mm6 )
+ SUMSUB_BA( %%mm5, %%mm4 )
+ SUMSUB_BA( %%mm3, %%mm2 )
+ SUMSUB_BA( %%mm1, %%mm0 )
:: "r"(block)
);
}
@@ -161,21 +161,20 @@ static void ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
block[0] += 32;
- for(i = 0; i < 2; i++)
- {
+ for(i=0; i<2; i++){
DECLARE_ALIGNED_8(uint64_t, tmp);
- h264_idct8_1d(block + 4 * i);
+ h264_idct8_1d(block+4*i);
__asm__ volatile(
"movq %%mm7, %0 \n\t"
- TRANSPOSE4(%%mm0, %%mm2, %%mm4, %%mm6, %%mm7)
+ 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)
+ TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
"movq %%mm7, (%1) \n\t"
"movq %%mm1, 16(%1) \n\t"
"movq %%mm0, 32(%1) \n\t"
@@ -186,9 +185,8 @@ static void ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
);
}
- for(i = 0; i < 2; i++)
- {
- h264_idct8_1d(b2 + 4 * i);
+ for(i=0; i<2; i++){
+ h264_idct8_1d(b2+4*i);
__asm__ volatile(
"psraw $6, %%mm7 \n\t"
@@ -288,16 +286,16 @@ static void ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride)
"movdqa %%xmm7, 0x70(%1) \n"
"pxor %%xmm7, %%xmm7 \n"
STORE_DIFF_8P(%%xmm2, (%0), %%xmm6, %%xmm7)
- STORE_DIFF_8P(%%xmm0, (%0, %2), %%xmm6, %%xmm7)
- STORE_DIFF_8P(%%xmm1, (%0, %2, 2), %%xmm6, %%xmm7)
- STORE_DIFF_8P(%%xmm3, (%0, %3), %%xmm6, %%xmm7)
+ STORE_DIFF_8P(%%xmm0, (%0,%2), %%xmm6, %%xmm7)
+ STORE_DIFF_8P(%%xmm1, (%0,%2,2), %%xmm6, %%xmm7)
+ STORE_DIFF_8P(%%xmm3, (%0,%3), %%xmm6, %%xmm7)
"lea (%0,%2,4), %0 \n"
STORE_DIFF_8P(%%xmm5, (%0), %%xmm6, %%xmm7)
- STORE_DIFF_8P(%%xmm4, (%0, %2), %%xmm6, %%xmm7)
+ STORE_DIFF_8P(%%xmm4, (%0,%2), %%xmm6, %%xmm7)
"movdqa 0x60(%1), %%xmm0 \n"
"movdqa 0x70(%1), %%xmm1 \n"
- STORE_DIFF_8P(%%xmm0, (%0, %2, 2), %%xmm6, %%xmm7)
- STORE_DIFF_8P(%%xmm1, (%0, %3), %%xmm6, %%xmm7)
+ STORE_DIFF_8P(%%xmm0, (%0,%2,2), %%xmm6, %%xmm7)
+ STORE_DIFF_8P(%%xmm1, (%0,%3), %%xmm6, %%xmm7)
:"+r"(dst)
:"r"(block), "r"((x86_reg)stride), "r"((x86_reg)3L*stride), "m"(ff_pw_32)
);
@@ -333,9 +331,9 @@ static void ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
"movd %%mm4, %2 \n\t"
"movd %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dst+0*stride)),
- "+m"(*(uint32_t*)(dst+1*stride)),
- "+m"(*(uint32_t*)(dst+2*stride)),
- "+m"(*(uint32_t*)(dst+3*stride))
+ "+m"(*(uint32_t*)(dst+1*stride)),
+ "+m"(*(uint32_t*)(dst+2*stride)),
+ "+m"(*(uint32_t*)(dst+3*stride))
);
}
@@ -352,148 +350,125 @@ static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
"packuswb %%mm1, %%mm1 \n\t"
::"r"(dc)
);
- for(y = 2; y--; dst += 4 * stride)
- {
- __asm__ volatile(
- "movq %0, %%mm2 \n\t"
- "movq %1, %%mm3 \n\t"
- "movq %2, %%mm4 \n\t"
- "movq %3, %%mm5 \n\t"
- "paddusb %%mm0, %%mm2 \n\t"
- "paddusb %%mm0, %%mm3 \n\t"
- "paddusb %%mm0, %%mm4 \n\t"
- "paddusb %%mm0, %%mm5 \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "psubusb %%mm1, %%mm3 \n\t"
- "psubusb %%mm1, %%mm4 \n\t"
- "psubusb %%mm1, %%mm5 \n\t"
- "movq %%mm2, %0 \n\t"
- "movq %%mm3, %1 \n\t"
- "movq %%mm4, %2 \n\t"
- "movq %%mm5, %3 \n\t"
- :"+m"(*(uint64_t*)(dst+0*stride)),
- "+m"(*(uint64_t*)(dst+1*stride)),
- "+m"(*(uint64_t*)(dst+2*stride)),
- "+m"(*(uint64_t*)(dst+3*stride))
- );
+ for(y=2; y--; dst += 4*stride){
+ __asm__ volatile(
+ "movq %0, %%mm2 \n\t"
+ "movq %1, %%mm3 \n\t"
+ "movq %2, %%mm4 \n\t"
+ "movq %3, %%mm5 \n\t"
+ "paddusb %%mm0, %%mm2 \n\t"
+ "paddusb %%mm0, %%mm3 \n\t"
+ "paddusb %%mm0, %%mm4 \n\t"
+ "paddusb %%mm0, %%mm5 \n\t"
+ "psubusb %%mm1, %%mm2 \n\t"
+ "psubusb %%mm1, %%mm3 \n\t"
+ "psubusb %%mm1, %%mm4 \n\t"
+ "psubusb %%mm1, %%mm5 \n\t"
+ "movq %%mm2, %0 \n\t"
+ "movq %%mm3, %1 \n\t"
+ "movq %%mm4, %2 \n\t"
+ "movq %%mm5, %3 \n\t"
+ :"+m"(*(uint64_t*)(dst+0*stride)),
+ "+m"(*(uint64_t*)(dst+1*stride)),
+ "+m"(*(uint64_t*)(dst+2*stride)),
+ "+m"(*(uint64_t*)(dst+3*stride))
+ );
}
}
//FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split
-static const uint8_t scan8[16 + 2*4] =
-{
- 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,
- 1 + 1 * 8, 2 + 1 * 8,
- 1 + 2 * 8, 2 + 2 * 8,
- 1 + 4 * 8, 2 + 4 * 8,
- 1 + 5 * 8, 2 + 5 * 8,
+static const uint8_t scan8[16 + 2*4]={
+ 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,
+ 1+1*8, 2+1*8,
+ 1+2*8, 2+2*8,
+ 1+4*8, 2+4*8,
+ 1+5*8, 2+5*8,
};
-static void ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i++)
- {
+ for(i=0; i<16; i++){
if(nnzc[ scan8[i] ])
- ff_h264_idct_add_mmx(dst + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride);
}
}
-static void ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i += 4)
- {
+ for(i=0; i<16; i+=4){
if(nnzc[ scan8[i] ])
- ff_h264_idct8_add_mmx(dst + block_offset[i], block + i * 16, stride);
+ ff_h264_idct8_add_mmx(dst + block_offset[i], block + i*16, stride);
}
}
-static void ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i++)
- {
+ for(i=0; i<16; i++){
int nnz = nnzc[ scan8[i] ];
- if(nnz)
- {
- if(nnz == 1 && block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i * 16, stride);
- else ff_h264_idct_add_mmx(dst + block_offset[i], block + i * 16, stride);
+ if(nnz){
+ if(nnz==1 && block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
+ else ff_h264_idct_add_mmx (dst + block_offset[i], block + i*16, stride);
}
}
}
-static void ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i++)
- {
+ for(i=0; i<16; i++){
if(nnzc[ scan8[i] ] || block[i*16])
- ff_h264_idct_add_mmx(dst + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride);
}
}
-static void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i++)
- {
- if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx(dst + block_offset[i], block + i * 16, stride);
- else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i * 16, stride);
+ for(i=0; i<16; i++){
+ if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx (dst + block_offset[i], block + i*16, stride);
+ else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
}
}
-static void ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i += 4)
- {
+ for(i=0; i<16; i+=4){
int nnz = nnzc[ scan8[i] ];
- if(nnz)
- {
- if(nnz == 1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i * 16, stride);
- else ff_h264_idct8_add_mmx(dst + block_offset[i], block + i * 16, stride);
+ if(nnz){
+ if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
+ else ff_h264_idct8_add_mmx (dst + block_offset[i], block + i*16, stride);
}
}
}
-static void ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i += 4)
- {
+ for(i=0; i<16; i+=4){
int nnz = nnzc[ scan8[i] ];
- if(nnz)
- {
- if(nnz == 1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i * 16, stride);
- else ff_h264_idct8_add_sse2(dst + block_offset[i], block + i * 16, stride);
+ if(nnz){
+ if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
+ else ff_h264_idct8_add_sse2 (dst + block_offset[i], block + i*16, stride);
}
}
}
-static void ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 16; i < 16 + 8; i++)
- {
+ for(i=16; i<16+8; i++){
if(nnzc[ scan8[i] ] || block[i*16])
- ff_h264_idct_add_mmx(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_add_mmx (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
}
}
-static void ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 16; i < 16 + 8; i++)
- {
+ for(i=16; i<16+8; i++){
if(nnzc[ scan8[i] ])
- ff_h264_idct_add_mmx(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_add_mmx (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
else if(block[i*16])
- ff_h264_idct_dc_add_mmx2(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
+ ff_h264_idct_dc_add_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
}
}
@@ -512,8 +487,8 @@ static void ff_h264_idct_dc_add8_mmx2(uint8_t *dst, int16_t *block, int stride)
"pshufw $0xFA, %%mm0, %%mm1 \n\t" // -d-d-d-d-D-D-D-D
"punpcklwd %%mm0, %%mm0 \n\t" // d d d d D D D D
::"m"(block[ 0]),
- "m"(block[16]),
- "m"(ff_pw_32)
+ "m"(block[16]),
+ "m"(ff_pw_32)
);
__asm__ volatile(
"movq %0, %%mm2 \n\t"
@@ -533,43 +508,38 @@ static void ff_h264_idct_dc_add8_mmx2(uint8_t *dst, int16_t *block, int stride)
"movq %%mm4, %2 \n\t"
"movq %%mm5, %3 \n\t"
:"+m"(*(uint64_t*)(dst+0*stride)),
- "+m"(*(uint64_t*)(dst+1*stride)),
- "+m"(*(uint64_t*)(dst+2*stride)),
- "+m"(*(uint64_t*)(dst+3*stride))
+ "+m"(*(uint64_t*)(dst+1*stride)),
+ "+m"(*(uint64_t*)(dst+2*stride)),
+ "+m"(*(uint64_t*)(dst+3*stride))
);
}
extern void ff_x264_add8x4_idct_sse2(uint8_t *dst, int16_t *block, int stride);
-static void ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i += 2)
- if(nnzc[ scan8[i+0] ] | nnzc[ scan8[i+1] ])
- ff_x264_add8x4_idct_sse2(dst + block_offset[i], block + i * 16, stride);
+ for(i=0; i<16; i+=2)
+ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ])
+ ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride);
}
-static void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 0; i < 16; i += 2)
- {
- if(nnzc[ scan8[i+0] ] | nnzc[ scan8[i+1] ])
- ff_x264_add8x4_idct_sse2(dst + block_offset[i], block + i * 16, stride);
- else if(block[i*16] | block[i*16+16])
- ff_h264_idct_dc_add8_mmx2(dst + block_offset[i], block + i * 16, stride);
+ for(i=0; i<16; i+=2){
+ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ])
+ ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride);
+ else if(block[i*16]|block[i*16+16])
+ ff_h264_idct_dc_add8_mmx2(dst + block_offset[i], block + i*16, stride);
}
}
-static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-{
+static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
- for(i = 16; i < 16 + 8; i += 2)
- {
- if(nnzc[ scan8[i+0] ] | nnzc[ scan8[i+1] ])
- ff_x264_add8x4_idct_sse2(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
- else if(block[i*16] | block[i*16+16])
- ff_h264_idct_dc_add8_mmx2(dest[(i&4)>>2] + block_offset[i], block + i * 16, stride);
+ for(i=16; i<16+8; i+=2){
+ if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ])
+ ff_x264_add8x4_idct_sse2 (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
+ else if(block[i*16]|block[i*16+16])
+ ff_h264_idct_dc_add8_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
}
}
#endif
@@ -597,7 +567,7 @@ static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTE
"psubusb "#a", "#t" \n\t"\
"psubusb "#a", "#o" \n\t"\
"pcmpeqb "#t", "#o" \n\t"\
-
+
// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1
// out: mm5=beta-1, mm7=mask
// clobbers: mm4,mm6
@@ -704,17 +674,17 @@ static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alph
: "=m"(tmp0[0]), "=m"(tmp0[1])
: "r"(pix-3*stride), "r"(pix), "r"((x86_reg)stride),
- "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1),
- "m"(ff_bone)
+ "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1),
+ "m"(ff_bone)
);
}
static void h264_v_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
if((tc0[0] & tc0[1]) >= 0)
- h264_loop_filter_luma_mmx2(pix, stride, alpha - 1, beta - 1, tc0);
+ h264_loop_filter_luma_mmx2(pix, stride, alpha-1, beta-1, tc0);
if((tc0[2] & tc0[3]) >= 0)
- h264_loop_filter_luma_mmx2(pix + 8, stride, alpha - 1, beta - 1, tc0 + 2);
+ h264_loop_filter_luma_mmx2(pix+8, stride, alpha-1, beta-1, tc0+2);
}
static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
@@ -722,17 +692,16 @@ static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, in
// also, it only needs to transpose 6x8
DECLARE_ALIGNED_8(uint8_t, trans)[8*8];
int i;
- for(i = 0; i < 2; i++, pix += 8 * stride, tc0 += 2)
- {
+ for(i=0; i<2; i++, pix+=8*stride, tc0+=2) {
if((tc0[0] & tc0[1]) < 0)
continue;
- transpose4x4(trans, pix - 4, 8, stride);
- transpose4x4(trans + 4 * 8, pix, 8, stride);
- transpose4x4(trans + 4, pix - 4 + 4 * stride, 8, stride);
- transpose4x4(trans + 4 + 4 * 8, pix + 4 * stride, 8, stride);
- h264_loop_filter_luma_mmx2(trans + 4 * 8, 8, alpha - 1, beta - 1, tc0);
- transpose4x4(pix - 2, trans + 2 * 8, stride, 8);
- transpose4x4(pix - 2 + 4 * stride, trans + 4 + 2 * 8, stride, 8);
+ transpose4x4(trans, pix-4, 8, stride);
+ transpose4x4(trans +4*8, pix, 8, stride);
+ transpose4x4(trans+4, pix-4+4*stride, 8, stride);
+ transpose4x4(trans+4+4*8, pix +4*stride, 8, stride);
+ h264_loop_filter_luma_mmx2(trans+4*8, 8, alpha-1, beta-1, tc0);
+ transpose4x4(pix-2, trans +2*8, stride, 8);
+ transpose4x4(pix-2+4*stride, trans+4+2*8, stride, 8);
}
}
@@ -752,25 +721,25 @@ static inline void h264_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int al
"movq %%mm2, (%1) \n\t"
:: "r"(pix-2*stride), "r"(pix), "r"((x86_reg)stride),
- "r"(*(uint32_t*)tc0),
- "m"(alpha1), "m"(beta1), "m"(ff_bone), "m"(ff_pb_3F)
+ "r"(*(uint32_t*)tc0),
+ "m"(alpha1), "m"(beta1), "m"(ff_bone), "m"(ff_pb_3F)
);
}
static void h264_v_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
- h264_loop_filter_chroma_mmx2(pix, stride, alpha - 1, beta - 1, tc0);
+ h264_loop_filter_chroma_mmx2(pix, stride, alpha-1, beta-1, tc0);
}
static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
//FIXME: could cut some load/stores by merging transpose with filter
DECLARE_ALIGNED_8(uint8_t, trans)[8*4];
- transpose4x4(trans, pix - 2, 8, stride);
- transpose4x4(trans + 4, pix - 2 + 4 * stride, 8, stride);
- h264_loop_filter_chroma_mmx2(trans + 2 * 8, 8, alpha - 1, beta - 1, tc0);
- transpose4x4(pix - 2, trans, stride, 8);
- transpose4x4(pix - 2 + 4 * stride, trans + 4, stride, 8);
+ transpose4x4(trans, pix-2, 8, stride);
+ transpose4x4(trans+4, pix-2+4*stride, 8, stride);
+ h264_loop_filter_chroma_mmx2(trans+2*8, 8, alpha-1, beta-1, tc0);
+ transpose4x4(pix-2, trans, stride, 8);
+ transpose4x4(pix-2+4*stride, trans+4, stride, 8);
}
// p0 = (p0 + q1 + 2*p1 + 2) >> 2
@@ -781,7 +750,7 @@ static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha,
"pavgb "#q1", "#p0" \n\t"\
"psubusb %%mm4, "#p0" \n\t"\
"pavgb "#p1", "#p0" \n\t" /* dst = avg(p1, avg(p0,q1) - ((p0^q1)&1)) */\
-
+
static inline void h264_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha1, int beta1)
{
__asm__ volatile(
@@ -803,29 +772,28 @@ static inline void h264_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride,
"movq %%mm1, (%0,%2) \n\t"
"movq %%mm2, (%1) \n\t"
:: "r"(pix-2*stride), "r"(pix), "r"((x86_reg)stride),
- "m"(alpha1), "m"(beta1), "m"(ff_bone)
+ "m"(alpha1), "m"(beta1), "m"(ff_bone)
);
}
static void h264_v_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
{
- h264_loop_filter_chroma_intra_mmx2(pix, stride, alpha - 1, beta - 1);
+ h264_loop_filter_chroma_intra_mmx2(pix, stride, alpha-1, beta-1);
}
static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
{
//FIXME: could cut some load/stores by merging transpose with filter
DECLARE_ALIGNED_8(uint8_t, trans)[8*4];
- transpose4x4(trans, pix - 2, 8, stride);
- transpose4x4(trans + 4, pix - 2 + 4 * stride, 8, stride);
- h264_loop_filter_chroma_intra_mmx2(trans + 2 * 8, 8, alpha - 1, beta - 1);
- transpose4x4(pix - 2, trans, stride, 8);
- transpose4x4(pix - 2 + 4 * stride, trans + 4, stride, 8);
+ transpose4x4(trans, pix-2, 8, stride);
+ transpose4x4(trans+4, pix-2+4*stride, 8, stride);
+ h264_loop_filter_chroma_intra_mmx2(trans+2*8, 8, alpha-1, beta-1);
+ transpose4x4(pix-2, trans, stride, 8);
+ transpose4x4(pix-2+4*stride, trans+4, stride, 8);
}
-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)
-{
+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 ) {
int dir;
__asm__ volatile(
"movq %0, %%mm7 \n"
@@ -840,26 +808,22 @@ static void h264_loop_filter_strength_mmx2(int16_t bS[2][4][4], uint8_t nnz[40],
__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%
- for(dir = 1; dir >= 0; dir--)
- {
+ for( dir=1; dir>=0; dir-- ) {
const x86_reg d_idx = dir ? -8 : -1;
const int mask_mv = dir ? mask_mv1 : mask_mv0;
DECLARE_ALIGNED_8(const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL;
int b_idx, edge;
- for(b_idx = 12, edge = 0; edge < edges; edge += step, b_idx += 8 * step)
- {
+ for( b_idx=12, edge=0; edge<edges; edge+=step, b_idx+=8*step ) {
__asm__ volatile(
"pand %0, %%mm0 \n\t"
::"m"(mask_dir)
);
- if(!(mask_mv & edge))
- {
- if(bidir)
- {
+ if(!(mask_mv & edge)) {
+ if(bidir) {
__asm__ volatile(
"movd (%1,%0), %%mm2 \n"
"punpckldq 40(%1,%0), %%mm2 \n" // { ref0[bn], ref1[bn] }
@@ -894,12 +858,10 @@ static void h264_loop_filter_strength_mmx2(int16_t bS[2][4][4], uint8_t nnz[40],
"pshufw $0x4E, %%mm0, %%mm1 \n"
"pminub %%mm1, %%mm0 \n"
::"r"(d_idx),
- "r"(ref[0]+b_idx),
- "r"(mv[0]+b_idx)
+ "r"(ref[0]+b_idx),
+ "r"(mv[0]+b_idx)
);
- }
- else
- {
+ } else {
__asm__ volatile(
"movd (%1), %%mm0 \n"
"psubb (%1,%0), %%mm0 \n" // ref[b] != ref[bn]
@@ -913,8 +875,8 @@ static void h264_loop_filter_strength_mmx2(int16_t bS[2][4][4], uint8_t nnz[40],
"packsswb %%mm1, %%mm1 \n"
"por %%mm1, %%mm0 \n"
::"r"(d_idx),
- "r"(ref[0]+b_idx),
- "r"(mv[0]+b_idx)
+ "r"(ref[0]+b_idx),
+ "r"(mv[0]+b_idx)
);
}
}
@@ -922,7 +884,7 @@ static void h264_loop_filter_strength_mmx2(int16_t bS[2][4][4], uint8_t nnz[40],
"movd %0, %%mm1 \n"
"por %1, %%mm1 \n" // nnz[b] || nnz[bn]
::"m"(nnz[b_idx]),
- "m"(nnz[b_idx+d_idx])
+ "m"(nnz[b_idx+d_idx])
);
__asm__ volatile(
"pminub %%mm7, %%mm1 \n"
@@ -1545,7 +1507,7 @@ static void OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, u
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)\
@@ -1722,7 +1684,7 @@ static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src,
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;\
@@ -1782,12 +1744,10 @@ static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, ui
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--)
- {
+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"
@@ -1817,8 +1777,7 @@ static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, u
: "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)
: "memory"
);
- if(size == 16)
- {
+ if(size==16){
__asm__ volatile(
QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 8*48)
QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 9*48)
@@ -1834,7 +1793,7 @@ static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, u
);
}
tmp += 8;
- src += 8 - (size + 5) * srcStride;
+ src += 8 - (size+5)*srcStride;
}
}
@@ -1944,7 +1903,7 @@ static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp,
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
@@ -1981,13 +1940,11 @@ 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)
-{
+
+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)
-{
+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
@@ -1997,7 +1954,7 @@ static void avg_h264_qpel16_mc00_sse2(uint8_t *dst, uint8_t *src, int stride)
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);\
@@ -2010,7 +1967,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *
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];\
@@ -2027,7 +1984,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *
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];\
@@ -2093,7 +2050,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *
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)\
@@ -2101,13 +2058,13 @@ 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"\
@@ -2149,8 +2106,7 @@ H264_MC_816(H264_MC_HV, ssse3)
#endif
/* rnd interleaved with rnd div 8, use p+1 to access rnd div 8 */
-DECLARE_ALIGNED_8(static const uint64_t, h264_rnd_reg)[4] =
-{
+DECLARE_ALIGNED_8(static const uint64_t, h264_rnd_reg)[4] = {
0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL
};
@@ -2168,7 +2124,7 @@ static void put_h264_chroma_mc8_mmx_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*a
}
static void put_vc1_chroma_mc8_mmx_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
{
- put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, h264_rnd_reg + 2);
+ put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, h264_rnd_reg+2);
}
static void put_h264_chroma_mc4_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
{
@@ -2196,7 +2152,7 @@ static void avg_h264_chroma_mc8_mmx2_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*
}
static void avg_vc1_chroma_mc8_mmx2_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
{
- avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, h264_rnd_reg + 2);
+ avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, h264_rnd_reg+2);
}
static void avg_h264_chroma_mc4_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
{
@@ -2287,12 +2243,8 @@ static inline void ff_h264_weight_WxH_mmx2(uint8_t *dst, int stride, int log2_de
"pxor %%mm7, %%mm7 \n\t"
:: "g"(weight), "g"(offset), "g"(log2_denom)
);
- for(y = 0;
- y < h;
- y += 2)
- {
- for(x = 0; x < w; x += 4)
- {
+ for(y=0; y<h; y+=2){
+ for(x=0; x<w; x+=4){
__asm__ volatile(
"movd %0, %%mm0 \n\t"
"movd %1, %%mm1 \n\t"
@@ -2309,10 +2261,10 @@ static inline void ff_h264_weight_WxH_mmx2(uint8_t *dst, int stride, int log2_de
"movd %%mm0, %0 \n\t"
"movd %%mm1, %1 \n\t"
: "+m"(*(uint32_t*)(dst+x)),
- "+m"(*(uint32_t*)(dst+x+stride))
+ "+m"(*(uint32_t*)(dst+x+stride))
);
}
- dst += 2 * stride;
+ dst += 2*stride;
}
}
@@ -2331,10 +2283,8 @@ static inline void ff_h264_biweight_WxH_mmx2(uint8_t *dst, uint8_t *src, int str
"pxor %%mm7, %%mm7 \n\t"
:: "g"(weightd), "g"(weights), "g"(offset), "g"(log2_denom+1)
);
- for(y = 0; y < h; y++)
- {
- for(x = 0; x < w; x += 4)
- {
+ for(y=0; y<h; y++){
+ for(x=0; x<w; x+=4){
__asm__ volatile(
"movd %0, %%mm0 \n\t"
"movd %1, %%mm1 \n\t"
@@ -2364,12 +2314,12 @@ static void ff_h264_weight_ ## W ## x ## H ## _mmx2(uint8_t *dst, int stride, in
ff_h264_weight_WxH_mmx2(dst, stride, log2_denom, weight, offset, W, H); \
}
-H264_WEIGHT(16, 16)
+H264_WEIGHT(16,16)
H264_WEIGHT(16, 8)
-H264_WEIGHT(8, 16)
-H264_WEIGHT(8, 8)
-H264_WEIGHT(8, 4)
-H264_WEIGHT(4, 8)
-H264_WEIGHT(4, 4)
-H264_WEIGHT(4, 2)
+H264_WEIGHT( 8,16)
+H264_WEIGHT( 8, 8)
+H264_WEIGHT( 8, 4)
+H264_WEIGHT( 4, 8)
+H264_WEIGHT( 4, 4)
+H264_WEIGHT( 4, 2)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx.c
index f220bf40f..a39f54b3f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx.c
@@ -36,8 +36,8 @@
#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)
+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;
@@ -52,15 +52,15 @@ static inline void idct_row(int16_t * row, int offset,
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;
+ 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];
+ 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;
@@ -85,107 +85,107 @@ static inline void idct_row(int16_t * row, int offset,
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)
+static inline void mmxext_row_head (int16_t * const row, const int offset,
+ const int16_t * const table)
{
- movq_m2r(*(row + offset), mm2); /* mm2 = x6 x4 x2 x0 */
+ movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
- movq_m2r(*(row + offset + 4), mm5); /* mm5 = x7 x5 x3 x1 */
- movq_r2r(mm2, mm0); /* mm0 = x6 x4 x2 x0 */
+ movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
+ movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
- movq_m2r(*table, mm3); /* mm3 = -C2 -C4 C2 C4 */
- movq_r2r(mm5, mm6); /* mm6 = x7 x5 x3 x1 */
+ movq_m2r (*table, mm3); /* mm3 = -C2 -C4 C2 C4 */
+ movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
- movq_m2r(*(table + 4), mm4); /* mm4 = C6 C4 C6 C4 */
- pmaddwd_r2r(mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
+ movq_m2r (*(table+4), mm4); /* mm4 = C6 C4 C6 C4 */
+ pmaddwd_r2r (mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
- pshufw_r2r(mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
+ pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
}
-static inline void mmxext_row(const int16_t * const table,
- const int32_t * const rounder)
+static inline void mmxext_row (const int16_t * const table,
+ const int32_t * const rounder)
{
- movq_m2r(*(table + 8), mm1); /* mm1 = -C5 -C1 C3 C1 */
- pmaddwd_r2r(mm2, mm4); /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */
+ movq_m2r (*(table+8), mm1); /* mm1 = -C5 -C1 C3 C1 */
+ pmaddwd_r2r (mm2, mm4); /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */
- pmaddwd_m2r(*(table + 16), mm0); /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */
- pshufw_r2r(mm6, mm6, 0x4e); /* mm6 = x3 x1 x7 x5 */
+ pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */
+ pshufw_r2r (mm6, mm6, 0x4e); /* mm6 = x3 x1 x7 x5 */
- movq_m2r(*(table + 12), mm7); /* mm7 = -C7 C3 C7 C5 */
- pmaddwd_r2r(mm5, mm1); /* mm1 = -C1*x5-C5*x7 C1*x1+C3*x3 */
+ movq_m2r (*(table+12), mm7); /* mm7 = -C7 C3 C7 C5 */
+ pmaddwd_r2r (mm5, mm1); /* mm1 = -C1*x5-C5*x7 C1*x1+C3*x3 */
- paddd_m2r(*rounder, mm3); /* mm3 += rounder */
- pmaddwd_r2r(mm6, mm7); /* mm7 = C3*x1-C7*x3 C5*x5+C7*x7 */
+ paddd_m2r (*rounder, mm3); /* mm3 += rounder */
+ pmaddwd_r2r (mm6, mm7); /* mm7 = C3*x1-C7*x3 C5*x5+C7*x7 */
- pmaddwd_m2r(*(table + 20), mm2); /* mm2 = C4*x0-C2*x2 -C4*x4+C2*x6 */
- paddd_r2r(mm4, mm3); /* mm3 = a1 a0 + rounder */
+ pmaddwd_m2r (*(table+20), mm2); /* mm2 = C4*x0-C2*x2 -C4*x4+C2*x6 */
+ paddd_r2r (mm4, mm3); /* mm3 = a1 a0 + rounder */
- pmaddwd_m2r(*(table + 24), mm5); /* mm5 = C3*x5-C1*x7 C5*x1-C1*x3 */
- movq_r2r(mm3, mm4); /* mm4 = a1 a0 + rounder */
+ pmaddwd_m2r (*(table+24), mm5); /* mm5 = C3*x5-C1*x7 C5*x1-C1*x3 */
+ movq_r2r (mm3, mm4); /* mm4 = a1 a0 + rounder */
- pmaddwd_m2r(*(table + 28), mm6); /* mm6 = C7*x1-C5*x3 C7*x5+C3*x7 */
- paddd_r2r(mm7, mm1); /* mm1 = b1 b0 */
+ pmaddwd_m2r (*(table+28), mm6); /* mm6 = C7*x1-C5*x3 C7*x5+C3*x7 */
+ paddd_r2r (mm7, mm1); /* mm1 = b1 b0 */
- paddd_m2r(*rounder, mm0); /* mm0 += rounder */
- psubd_r2r(mm1, mm3); /* mm3 = a1-b1 a0-b0 + rounder */
+ paddd_m2r (*rounder, mm0); /* mm0 += rounder */
+ psubd_r2r (mm1, mm3); /* mm3 = a1-b1 a0-b0 + rounder */
- psrad_i2r(ROW_SHIFT, mm3); /* mm3 = y6 y7 */
- paddd_r2r(mm4, mm1); /* mm1 = a1+b1 a0+b0 + rounder */
+ psrad_i2r (ROW_SHIFT, mm3); /* mm3 = y6 y7 */
+ paddd_r2r (mm4, mm1); /* mm1 = a1+b1 a0+b0 + rounder */
- paddd_r2r(mm2, mm0); /* mm0 = a3 a2 + rounder */
- psrad_i2r(ROW_SHIFT, mm1); /* mm1 = y1 y0 */
+ paddd_r2r (mm2, mm0); /* mm0 = a3 a2 + rounder */
+ psrad_i2r (ROW_SHIFT, mm1); /* mm1 = y1 y0 */
- paddd_r2r(mm6, mm5); /* mm5 = b3 b2 */
- movq_r2r(mm0, mm4); /* mm4 = a3 a2 + rounder */
+ paddd_r2r (mm6, mm5); /* mm5 = b3 b2 */
+ movq_r2r (mm0, mm4); /* mm4 = a3 a2 + rounder */
- paddd_r2r(mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
- psubd_r2r(mm5, mm4); /* mm4 = a3-b3 a2-b2 + rounder */
+ paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
+ psubd_r2r (mm5, mm4); /* mm4 = a3-b3 a2-b2 + rounder */
}
-static inline void mmxext_row_tail(int16_t * const row, const int store)
+static inline void mmxext_row_tail (int16_t * const row, const int store)
{
- psrad_i2r(ROW_SHIFT, mm0); /* mm0 = y3 y2 */
+ psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
- psrad_i2r(ROW_SHIFT, mm4); /* mm4 = y4 y5 */
+ psrad_i2r (ROW_SHIFT, mm4); /* mm4 = y4 y5 */
- packssdw_r2r(mm0, mm1); /* mm1 = y3 y2 y1 y0 */
+ packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
- packssdw_r2r(mm3, mm4); /* mm4 = y6 y7 y4 y5 */
+ packssdw_r2r (mm3, mm4); /* mm4 = y6 y7 y4 y5 */
- movq_r2m(mm1, *(row + store)); /* save y3 y2 y1 y0 */
- pshufw_r2r(mm4, mm4, 0xb1); /* mm4 = y7 y6 y5 y4 */
+ movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
+ pshufw_r2r (mm4, mm4, 0xb1); /* mm4 = y7 y6 y5 y4 */
/* slot */
- movq_r2m(mm4, *(row + store + 4)); /* save y7 y6 y5 y4 */
+ movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */
}
-static inline void mmxext_row_mid(int16_t * const row, const int store,
- const int offset,
- const int16_t * const table)
+static inline void mmxext_row_mid (int16_t * const row, const int store,
+ const int offset,
+ const int16_t * const table)
{
- movq_m2r(*(row + offset), mm2); /* mm2 = x6 x4 x2 x0 */
- psrad_i2r(ROW_SHIFT, mm0); /* mm0 = y3 y2 */
+ movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
+ psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
- movq_m2r(*(row + offset + 4), mm5); /* mm5 = x7 x5 x3 x1 */
- psrad_i2r(ROW_SHIFT, mm4); /* mm4 = y4 y5 */
+ movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
+ psrad_i2r (ROW_SHIFT, mm4); /* mm4 = y4 y5 */
- packssdw_r2r(mm0, mm1); /* mm1 = y3 y2 y1 y0 */
- movq_r2r(mm5, mm6); /* mm6 = x7 x5 x3 x1 */
+ packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
+ movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
- packssdw_r2r(mm3, mm4); /* mm4 = y6 y7 y4 y5 */
- movq_r2r(mm2, mm0); /* mm0 = x6 x4 x2 x0 */
+ packssdw_r2r (mm3, mm4); /* mm4 = y6 y7 y4 y5 */
+ movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
- movq_r2m(mm1, *(row + store)); /* save y3 y2 y1 y0 */
- pshufw_r2r(mm4, mm4, 0xb1); /* mm4 = y7 y6 y5 y4 */
+ movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
+ pshufw_r2r (mm4, mm4, 0xb1); /* mm4 = y7 y6 y5 y4 */
- movq_m2r(*table, mm3); /* mm3 = -C2 -C4 C2 C4 */
- movq_r2m(mm4, *(row + store + 4)); /* save y7 y6 y5 y4 */
+ movq_m2r (*table, mm3); /* mm3 = -C2 -C4 C2 C4 */
+ movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */
- pmaddwd_r2r(mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
+ pmaddwd_r2r (mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
- movq_m2r(*(table + 4), mm4); /* mm4 = C6 C4 C6 C4 */
- pshufw_r2r(mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
+ movq_m2r (*(table+4), mm4); /* mm4 = C6 C4 C6 C4 */
+ pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
}
@@ -200,133 +200,133 @@ static inline void mmxext_row_mid(int16_t * const row, const int store,
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)
+static inline void mmx_row_head (int16_t * const row, const int offset,
+ const int16_t * const table)
{
- movq_m2r(*(row + offset), mm2); /* mm2 = x6 x4 x2 x0 */
+ movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
- movq_m2r(*(row + offset + 4), mm5); /* mm5 = x7 x5 x3 x1 */
- movq_r2r(mm2, mm0); /* mm0 = x6 x4 x2 x0 */
+ movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
+ movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
- movq_m2r(*table, mm3); /* mm3 = C6 C4 C2 C4 */
- movq_r2r(mm5, mm6); /* mm6 = x7 x5 x3 x1 */
+ movq_m2r (*table, mm3); /* mm3 = C6 C4 C2 C4 */
+ movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
- punpckldq_r2r(mm0, mm0); /* mm0 = x2 x0 x2 x0 */
+ punpckldq_r2r (mm0, mm0); /* mm0 = x2 x0 x2 x0 */
- movq_m2r(*(table + 4), mm4); /* mm4 = -C2 -C4 C6 C4 */
- pmaddwd_r2r(mm0, mm3); /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
+ movq_m2r (*(table+4), mm4); /* mm4 = -C2 -C4 C6 C4 */
+ pmaddwd_r2r (mm0, mm3); /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
- movq_m2r(*(table + 8), mm1); /* mm1 = -C7 C3 C3 C1 */
- punpckhdq_r2r(mm2, mm2); /* mm2 = x6 x4 x6 x4 */
+ movq_m2r (*(table+8), mm1); /* mm1 = -C7 C3 C3 C1 */
+ punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */
}
-static inline void mmx_row(const int16_t * const table,
- const int32_t * const rounder)
+static inline void mmx_row (const int16_t * const table,
+ const int32_t * const rounder)
{
- pmaddwd_r2r(mm2, mm4); /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */
- punpckldq_r2r(mm5, mm5); /* mm5 = x3 x1 x3 x1 */
+ pmaddwd_r2r (mm2, mm4); /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */
+ punpckldq_r2r (mm5, mm5); /* mm5 = x3 x1 x3 x1 */
- pmaddwd_m2r(*(table + 16), mm0); /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */
- punpckhdq_r2r(mm6, mm6); /* mm6 = x7 x5 x7 x5 */
+ pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */
+ punpckhdq_r2r (mm6, mm6); /* mm6 = x7 x5 x7 x5 */
- movq_m2r(*(table + 12), mm7); /* mm7 = -C5 -C1 C7 C5 */
- pmaddwd_r2r(mm5, mm1); /* mm1 = C3*x1-C7*x3 C1*x1+C3*x3 */
+ movq_m2r (*(table+12), mm7); /* mm7 = -C5 -C1 C7 C5 */
+ pmaddwd_r2r (mm5, mm1); /* mm1 = C3*x1-C7*x3 C1*x1+C3*x3 */
- paddd_m2r(*rounder, mm3); /* mm3 += rounder */
- pmaddwd_r2r(mm6, mm7); /* mm7 = -C1*x5-C5*x7 C5*x5+C7*x7 */
+ paddd_m2r (*rounder, mm3); /* mm3 += rounder */
+ pmaddwd_r2r (mm6, mm7); /* mm7 = -C1*x5-C5*x7 C5*x5+C7*x7 */
- pmaddwd_m2r(*(table + 20), mm2); /* mm2 = C4*x4-C6*x6 -C4*x4+C2*x6 */
- paddd_r2r(mm4, mm3); /* mm3 = a1 a0 + rounder */
+ pmaddwd_m2r (*(table+20), mm2); /* mm2 = C4*x4-C6*x6 -C4*x4+C2*x6 */
+ paddd_r2r (mm4, mm3); /* mm3 = a1 a0 + rounder */
- pmaddwd_m2r(*(table + 24), mm5); /* mm5 = C7*x1-C5*x3 C5*x1-C1*x3 */
- movq_r2r(mm3, mm4); /* mm4 = a1 a0 + rounder */
+ pmaddwd_m2r (*(table+24), mm5); /* mm5 = C7*x1-C5*x3 C5*x1-C1*x3 */
+ movq_r2r (mm3, mm4); /* mm4 = a1 a0 + rounder */
- pmaddwd_m2r(*(table + 28), mm6); /* mm6 = C3*x5-C1*x7 C7*x5+C3*x7 */
- paddd_r2r(mm7, mm1); /* mm1 = b1 b0 */
+ pmaddwd_m2r (*(table+28), mm6); /* mm6 = C3*x5-C1*x7 C7*x5+C3*x7 */
+ paddd_r2r (mm7, mm1); /* mm1 = b1 b0 */
- paddd_m2r(*rounder, mm0); /* mm0 += rounder */
- psubd_r2r(mm1, mm3); /* mm3 = a1-b1 a0-b0 + rounder */
+ paddd_m2r (*rounder, mm0); /* mm0 += rounder */
+ psubd_r2r (mm1, mm3); /* mm3 = a1-b1 a0-b0 + rounder */
- psrad_i2r(ROW_SHIFT, mm3); /* mm3 = y6 y7 */
- paddd_r2r(mm4, mm1); /* mm1 = a1+b1 a0+b0 + rounder */
+ psrad_i2r (ROW_SHIFT, mm3); /* mm3 = y6 y7 */
+ paddd_r2r (mm4, mm1); /* mm1 = a1+b1 a0+b0 + rounder */
- paddd_r2r(mm2, mm0); /* mm0 = a3 a2 + rounder */
- psrad_i2r(ROW_SHIFT, mm1); /* mm1 = y1 y0 */
+ paddd_r2r (mm2, mm0); /* mm0 = a3 a2 + rounder */
+ psrad_i2r (ROW_SHIFT, mm1); /* mm1 = y1 y0 */
- paddd_r2r(mm6, mm5); /* mm5 = b3 b2 */
- movq_r2r(mm0, mm7); /* mm7 = a3 a2 + rounder */
+ paddd_r2r (mm6, mm5); /* mm5 = b3 b2 */
+ movq_r2r (mm0, mm7); /* mm7 = a3 a2 + rounder */
- paddd_r2r(mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
- psubd_r2r(mm5, mm7); /* mm7 = a3-b3 a2-b2 + rounder */
+ paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
+ psubd_r2r (mm5, mm7); /* mm7 = a3-b3 a2-b2 + rounder */
}
-static inline void mmx_row_tail(int16_t * const row, const int store)
+static inline void mmx_row_tail (int16_t * const row, const int store)
{
- psrad_i2r(ROW_SHIFT, mm0); /* mm0 = y3 y2 */
+ psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
- psrad_i2r(ROW_SHIFT, mm7); /* mm7 = y4 y5 */
+ psrad_i2r (ROW_SHIFT, mm7); /* mm7 = y4 y5 */
- packssdw_r2r(mm0, mm1); /* mm1 = y3 y2 y1 y0 */
+ packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
- packssdw_r2r(mm3, mm7); /* mm7 = y6 y7 y4 y5 */
+ packssdw_r2r (mm3, mm7); /* mm7 = y6 y7 y4 y5 */
- movq_r2m(mm1, *(row + store)); /* save y3 y2 y1 y0 */
- movq_r2r(mm7, mm4); /* mm4 = y6 y7 y4 y5 */
+ movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
+ movq_r2r (mm7, mm4); /* mm4 = y6 y7 y4 y5 */
- pslld_i2r(16, mm7); /* mm7 = y7 0 y5 0 */
+ pslld_i2r (16, mm7); /* mm7 = y7 0 y5 0 */
- psrld_i2r(16, mm4); /* mm4 = 0 y6 0 y4 */
+ psrld_i2r (16, mm4); /* mm4 = 0 y6 0 y4 */
- por_r2r(mm4, mm7); /* mm7 = y7 y6 y5 y4 */
+ por_r2r (mm4, mm7); /* mm7 = y7 y6 y5 y4 */
/* slot */
- movq_r2m(mm7, *(row + store + 4)); /* save y7 y6 y5 y4 */
+ movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */
}
-static inline void mmx_row_mid(int16_t * const row, const int store,
- const int offset, const int16_t * const table)
+static inline void mmx_row_mid (int16_t * const row, const int store,
+ const int offset, const int16_t * const table)
{
- movq_m2r(*(row + offset), mm2); /* mm2 = x6 x4 x2 x0 */
- psrad_i2r(ROW_SHIFT, mm0); /* mm0 = y3 y2 */
+ movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
+ psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
- movq_m2r(*(row + offset + 4), mm5); /* mm5 = x7 x5 x3 x1 */
- psrad_i2r(ROW_SHIFT, mm7); /* mm7 = y4 y5 */
+ movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
+ psrad_i2r (ROW_SHIFT, mm7); /* mm7 = y4 y5 */
- packssdw_r2r(mm0, mm1); /* mm1 = y3 y2 y1 y0 */
- movq_r2r(mm5, mm6); /* mm6 = x7 x5 x3 x1 */
+ packssdw_r2r (mm0, mm1); /* mm1 = y3 y2 y1 y0 */
+ movq_r2r (mm5, mm6); /* mm6 = x7 x5 x3 x1 */
- packssdw_r2r(mm3, mm7); /* mm7 = y6 y7 y4 y5 */
- movq_r2r(mm2, mm0); /* mm0 = x6 x4 x2 x0 */
+ packssdw_r2r (mm3, mm7); /* mm7 = y6 y7 y4 y5 */
+ movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
- movq_r2m(mm1, *(row + store)); /* save y3 y2 y1 y0 */
- movq_r2r(mm7, mm1); /* mm1 = y6 y7 y4 y5 */
+ movq_r2m (mm1, *(row+store)); /* save y3 y2 y1 y0 */
+ movq_r2r (mm7, mm1); /* mm1 = y6 y7 y4 y5 */
- punpckldq_r2r(mm0, mm0); /* mm0 = x2 x0 x2 x0 */
- psrld_i2r(16, mm7); /* mm7 = 0 y6 0 y4 */
+ punpckldq_r2r (mm0, mm0); /* mm0 = x2 x0 x2 x0 */
+ psrld_i2r (16, mm7); /* mm7 = 0 y6 0 y4 */
- movq_m2r(*table, mm3); /* mm3 = C6 C4 C2 C4 */
- pslld_i2r(16, mm1); /* mm1 = y7 0 y5 0 */
+ movq_m2r (*table, mm3); /* mm3 = C6 C4 C2 C4 */
+ pslld_i2r (16, mm1); /* mm1 = y7 0 y5 0 */
- movq_m2r(*(table + 4), mm4); /* mm4 = -C2 -C4 C6 C4 */
- por_r2r(mm1, mm7); /* mm7 = y7 y6 y5 y4 */
+ movq_m2r (*(table+4), mm4); /* mm4 = -C2 -C4 C6 C4 */
+ por_r2r (mm1, mm7); /* mm7 = y7 y6 y5 y4 */
- movq_m2r(*(table + 8), mm1); /* mm1 = -C7 C3 C3 C1 */
- punpckhdq_r2r(mm2, mm2); /* mm2 = x6 x4 x6 x4 */
+ movq_m2r (*(table+8), mm1); /* mm1 = -C7 C3 C3 C1 */
+ punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */
- movq_r2m(mm7, *(row + store + 4)); /* save y7 y6 y5 y4 */
- pmaddwd_r2r(mm0, mm3); /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
+ movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */
+ pmaddwd_r2r (mm0, mm3); /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
}
#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)
+static inline void idct_col (int16_t * col, int offset)
{
- /* multiplication - as implemented on mmx */
+/* multiplication - as implemented on mmx */
#define F(c,x) (((c) * (x)) >> 16)
- /* saturation - it helps us handle torture test cases */
+/* 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;
@@ -345,39 +345,39 @@ static inline void idct_col(int16_t * col, int offset)
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;
+ 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;
@@ -392,147 +392,147 @@ static inline void idct_col(int16_t * col, int offset)
/* MMX column IDCT */
-static inline void idct_col(int16_t * const col, const int offset)
+static inline void idct_col (int16_t * const col, const int offset)
{
#define T1 13036
#define T2 27146
#define T3 43790
#define C4 23170
- static const short t1_vector[] ATTR_ALIGN(8) = {T1, T1, T1, T1};
- static const short t2_vector[] ATTR_ALIGN(8) = {T2, T2, T2, T2};
- static const short t3_vector[] ATTR_ALIGN(8) = {T3, T3, T3, T3};
- static const short c4_vector[] ATTR_ALIGN(8) = {C4, C4, C4, C4};
+ static const short t1_vector[] ATTR_ALIGN(8) = {T1,T1,T1,T1};
+ static const short t2_vector[] ATTR_ALIGN(8) = {T2,T2,T2,T2};
+ static const short t3_vector[] ATTR_ALIGN(8) = {T3,T3,T3,T3};
+ static const short c4_vector[] ATTR_ALIGN(8) = {C4,C4,C4,C4};
/* column code adapted from Peter Gubanov */
/* http://www.elecard.com/peter/idct.shtml */
- movq_m2r(*t1_vector, mm0); /* mm0 = T1 */
+ movq_m2r (*t1_vector, mm0); /* mm0 = T1 */
- movq_m2r(*(col + offset + 1 * 8), mm1); /* mm1 = x1 */
- movq_r2r(mm0, mm2); /* mm2 = T1 */
+ movq_m2r (*(col+offset+1*8), mm1); /* mm1 = x1 */
+ movq_r2r (mm0, mm2); /* mm2 = T1 */
- movq_m2r(*(col + offset + 7 * 8), mm4); /* mm4 = x7 */
- pmulhw_r2r(mm1, mm0); /* mm0 = T1*x1 */
+ movq_m2r (*(col+offset+7*8), mm4); /* mm4 = x7 */
+ pmulhw_r2r (mm1, mm0); /* mm0 = T1*x1 */
- movq_m2r(*t3_vector, mm5); /* mm5 = T3 */
- pmulhw_r2r(mm4, mm2); /* mm2 = T1*x7 */
+ movq_m2r (*t3_vector, mm5); /* mm5 = T3 */
+ pmulhw_r2r (mm4, mm2); /* mm2 = T1*x7 */
- movq_m2r(*(col + offset + 5 * 8), mm6); /* mm6 = x5 */
- movq_r2r(mm5, mm7); /* mm7 = T3-1 */
+ movq_m2r (*(col+offset+5*8), mm6); /* mm6 = x5 */
+ movq_r2r (mm5, mm7); /* mm7 = T3-1 */
- movq_m2r(*(col + offset + 3 * 8), mm3); /* mm3 = x3 */
- psubsw_r2r(mm4, mm0); /* mm0 = v17 */
+ movq_m2r (*(col+offset+3*8), mm3); /* mm3 = x3 */
+ psubsw_r2r (mm4, mm0); /* mm0 = v17 */
- movq_m2r(*t2_vector, mm4); /* mm4 = T2 */
- pmulhw_r2r(mm3, mm5); /* mm5 = (T3-1)*x3 */
+ movq_m2r (*t2_vector, mm4); /* mm4 = T2 */
+ pmulhw_r2r (mm3, mm5); /* mm5 = (T3-1)*x3 */
- paddsw_r2r(mm2, mm1); /* mm1 = u17 */
- pmulhw_r2r(mm6, mm7); /* mm7 = (T3-1)*x5 */
+ paddsw_r2r (mm2, mm1); /* mm1 = u17 */
+ pmulhw_r2r (mm6, mm7); /* mm7 = (T3-1)*x5 */
/* slot */
- movq_r2r(mm4, mm2); /* mm2 = T2 */
- paddsw_r2r(mm3, mm5); /* mm5 = T3*x3 */
+ movq_r2r (mm4, mm2); /* mm2 = T2 */
+ paddsw_r2r (mm3, mm5); /* mm5 = T3*x3 */
- pmulhw_m2r(*(col + offset + 2 * 8), mm4); /* mm4 = T2*x2 */
- paddsw_r2r(mm6, mm7); /* mm7 = T3*x5 */
+ pmulhw_m2r (*(col+offset+2*8), mm4);/* mm4 = T2*x2 */
+ paddsw_r2r (mm6, mm7); /* mm7 = T3*x5 */
- psubsw_r2r(mm6, mm5); /* mm5 = v35 */
- paddsw_r2r(mm3, mm7); /* mm7 = u35 */
+ psubsw_r2r (mm6, mm5); /* mm5 = v35 */
+ paddsw_r2r (mm3, mm7); /* mm7 = u35 */
- movq_m2r(*(col + offset + 6 * 8), mm3); /* mm3 = x6 */
- movq_r2r(mm0, mm6); /* mm6 = v17 */
+ movq_m2r (*(col+offset+6*8), mm3); /* mm3 = x6 */
+ movq_r2r (mm0, mm6); /* mm6 = v17 */
- pmulhw_r2r(mm3, mm2); /* mm2 = T2*x6 */
- psubsw_r2r(mm5, mm0); /* mm0 = b3 */
+ pmulhw_r2r (mm3, mm2); /* mm2 = T2*x6 */
+ psubsw_r2r (mm5, mm0); /* mm0 = b3 */
- psubsw_r2r(mm3, mm4); /* mm4 = v26 */
- paddsw_r2r(mm6, mm5); /* mm5 = v12 */
+ psubsw_r2r (mm3, mm4); /* mm4 = v26 */
+ paddsw_r2r (mm6, mm5); /* mm5 = v12 */
- movq_r2m(mm0, *(col + offset + 3 * 8)); /* save b3 in scratch0 */
- movq_r2r(mm1, mm6); /* mm6 = u17 */
+ movq_r2m (mm0, *(col+offset+3*8)); /* save b3 in scratch0 */
+ movq_r2r (mm1, mm6); /* mm6 = u17 */
- paddsw_m2r(*(col + offset + 2 * 8), mm2); /* mm2 = u26 */
- paddsw_r2r(mm7, mm6); /* mm6 = b0 */
+ paddsw_m2r (*(col+offset+2*8), mm2);/* mm2 = u26 */
+ paddsw_r2r (mm7, mm6); /* mm6 = b0 */
- psubsw_r2r(mm7, mm1); /* mm1 = u12 */
- movq_r2r(mm1, mm7); /* mm7 = u12 */
+ psubsw_r2r (mm7, mm1); /* mm1 = u12 */
+ movq_r2r (mm1, mm7); /* mm7 = u12 */
- movq_m2r(*(col + offset + 0 * 8), mm3); /* mm3 = x0 */
- paddsw_r2r(mm5, mm1); /* mm1 = u12+v12 */
+ movq_m2r (*(col+offset+0*8), mm3); /* mm3 = x0 */
+ paddsw_r2r (mm5, mm1); /* mm1 = u12+v12 */
- movq_m2r(*c4_vector, mm0); /* mm0 = C4/2 */
- psubsw_r2r(mm5, mm7); /* mm7 = u12-v12 */
+ movq_m2r (*c4_vector, mm0); /* mm0 = C4/2 */
+ psubsw_r2r (mm5, mm7); /* mm7 = u12-v12 */
- movq_r2m(mm6, *(col + offset + 5 * 8)); /* save b0 in scratch1 */
- pmulhw_r2r(mm0, mm1); /* mm1 = b1/2 */
+ movq_r2m (mm6, *(col+offset+5*8)); /* save b0 in scratch1 */
+ pmulhw_r2r (mm0, mm1); /* mm1 = b1/2 */
- movq_r2r(mm4, mm6); /* mm6 = v26 */
- pmulhw_r2r(mm0, mm7); /* mm7 = b2/2 */
+ movq_r2r (mm4, mm6); /* mm6 = v26 */
+ pmulhw_r2r (mm0, mm7); /* mm7 = b2/2 */
- movq_m2r(*(col + offset + 4 * 8), mm5); /* mm5 = x4 */
- movq_r2r(mm3, mm0); /* mm0 = x0 */
+ movq_m2r (*(col+offset+4*8), mm5); /* mm5 = x4 */
+ movq_r2r (mm3, mm0); /* mm0 = x0 */
- psubsw_r2r(mm5, mm3); /* mm3 = v04 */
- paddsw_r2r(mm5, mm0); /* mm0 = u04 */
+ psubsw_r2r (mm5, mm3); /* mm3 = v04 */
+ paddsw_r2r (mm5, mm0); /* mm0 = u04 */
- paddsw_r2r(mm3, mm4); /* mm4 = a1 */
- movq_r2r(mm0, mm5); /* mm5 = u04 */
+ paddsw_r2r (mm3, mm4); /* mm4 = a1 */
+ movq_r2r (mm0, mm5); /* mm5 = u04 */
- psubsw_r2r(mm6, mm3); /* mm3 = a2 */
- paddsw_r2r(mm2, mm5); /* mm5 = a0 */
+ psubsw_r2r (mm6, mm3); /* mm3 = a2 */
+ paddsw_r2r (mm2, mm5); /* mm5 = a0 */
- paddsw_r2r(mm1, mm1); /* mm1 = b1 */
- psubsw_r2r(mm2, mm0); /* mm0 = a3 */
+ paddsw_r2r (mm1, mm1); /* mm1 = b1 */
+ psubsw_r2r (mm2, mm0); /* mm0 = a3 */
- paddsw_r2r(mm7, mm7); /* mm7 = b2 */
- movq_r2r(mm3, mm2); /* mm2 = a2 */
+ paddsw_r2r (mm7, mm7); /* mm7 = b2 */
+ movq_r2r (mm3, mm2); /* mm2 = a2 */
- movq_r2r(mm4, mm6); /* mm6 = a1 */
- paddsw_r2r(mm7, mm3); /* mm3 = a2+b2 */
+ movq_r2r (mm4, mm6); /* mm6 = a1 */
+ paddsw_r2r (mm7, mm3); /* mm3 = a2+b2 */
- psraw_i2r(COL_SHIFT, mm3); /* mm3 = y2 */
- paddsw_r2r(mm1, mm4); /* mm4 = a1+b1 */
+ psraw_i2r (COL_SHIFT, mm3); /* mm3 = y2 */
+ paddsw_r2r (mm1, mm4); /* mm4 = a1+b1 */
- psraw_i2r(COL_SHIFT, mm4); /* mm4 = y1 */
- psubsw_r2r(mm1, mm6); /* mm6 = a1-b1 */
+ psraw_i2r (COL_SHIFT, mm4); /* mm4 = y1 */
+ psubsw_r2r (mm1, mm6); /* mm6 = a1-b1 */
- movq_m2r(*(col + offset + 5 * 8), mm1); /* mm1 = b0 */
- psubsw_r2r(mm7, mm2); /* mm2 = a2-b2 */
+ movq_m2r (*(col+offset+5*8), mm1); /* mm1 = b0 */
+ psubsw_r2r (mm7, mm2); /* mm2 = a2-b2 */
- psraw_i2r(COL_SHIFT, mm6); /* mm6 = y6 */
- movq_r2r(mm5, mm7); /* mm7 = a0 */
+ psraw_i2r (COL_SHIFT, mm6); /* mm6 = y6 */
+ movq_r2r (mm5, mm7); /* mm7 = a0 */
- movq_r2m(mm4, *(col + offset + 1 * 8)); /* save y1 */
- psraw_i2r(COL_SHIFT, mm2); /* mm2 = y5 */
+ movq_r2m (mm4, *(col+offset+1*8)); /* save y1 */
+ psraw_i2r (COL_SHIFT, mm2); /* mm2 = y5 */
- movq_r2m(mm3, *(col + offset + 2 * 8)); /* save y2 */
- paddsw_r2r(mm1, mm5); /* mm5 = a0+b0 */
+ movq_r2m (mm3, *(col+offset+2*8)); /* save y2 */
+ paddsw_r2r (mm1, mm5); /* mm5 = a0+b0 */
- movq_m2r(*(col + offset + 3 * 8), mm4); /* mm4 = b3 */
- psubsw_r2r(mm1, mm7); /* mm7 = a0-b0 */
+ movq_m2r (*(col+offset+3*8), mm4); /* mm4 = b3 */
+ psubsw_r2r (mm1, mm7); /* mm7 = a0-b0 */
- psraw_i2r(COL_SHIFT, mm5); /* mm5 = y0 */
- movq_r2r(mm0, mm3); /* mm3 = a3 */
+ psraw_i2r (COL_SHIFT, mm5); /* mm5 = y0 */
+ movq_r2r (mm0, mm3); /* mm3 = a3 */
- movq_r2m(mm2, *(col + offset + 5 * 8)); /* save y5 */
- psubsw_r2r(mm4, mm3); /* mm3 = a3-b3 */
+ movq_r2m (mm2, *(col+offset+5*8)); /* save y5 */
+ psubsw_r2r (mm4, mm3); /* mm3 = a3-b3 */
- psraw_i2r(COL_SHIFT, mm7); /* mm7 = y7 */
- paddsw_r2r(mm0, mm4); /* mm4 = a3+b3 */
+ psraw_i2r (COL_SHIFT, mm7); /* mm7 = y7 */
+ paddsw_r2r (mm0, mm4); /* mm4 = a3+b3 */
- movq_r2m(mm5, *(col + offset + 0 * 8)); /* save y0 */
- psraw_i2r(COL_SHIFT, mm3); /* mm3 = y4 */
+ movq_r2m (mm5, *(col+offset+0*8)); /* save y0 */
+ psraw_i2r (COL_SHIFT, mm3); /* mm3 = y4 */
- movq_r2m(mm6, *(col + offset + 6 * 8)); /* save y6 */
- psraw_i2r(COL_SHIFT, mm4); /* mm4 = y3 */
+ movq_r2m (mm6, *(col+offset+6*8)); /* save y6 */
+ psraw_i2r (COL_SHIFT, mm4); /* mm4 = y3 */
- movq_r2m(mm7, *(col + offset + 7 * 8)); /* save y7 */
+ movq_r2m (mm7, *(col+offset+7*8)); /* save y7 */
- movq_r2m(mm3, *(col + offset + 4 * 8)); /* save y4 */
+ movq_r2m (mm3, *(col+offset+4*8)); /* save y4 */
- movq_r2m(mm4, *(col + offset + 3 * 8)); /* save y3 */
+ movq_r2m (mm4, *(col+offset+3*8)); /* save y3 */
#undef T1
#undef T2
@@ -542,20 +542,20 @@ static inline void idct_col(int16_t * const col, const int offset)
static const int32_t rounder0[] ATTR_ALIGN(8) =
- rounder((1 << (COL_SHIFT - 1)) - 0.5);
-static const int32_t rounder4[] ATTR_ALIGN(8) = rounder(0);
+ rounder ((1 << (COL_SHIFT - 1)) - 0.5);
+static const int32_t rounder4[] ATTR_ALIGN(8) = rounder (0);
static const int32_t rounder1[] ATTR_ALIGN(8) =
- rounder(1.25683487303); /* C1*(C1/C4+C1+C7)/2 */
+ rounder (1.25683487303); /* C1*(C1/C4+C1+C7)/2 */
static const int32_t rounder7[] ATTR_ALIGN(8) =
- rounder(-0.25); /* C1*(C7/C4+C7-C1)/2 */
+ rounder (-0.25); /* C1*(C7/C4+C7-C1)/2 */
static const int32_t rounder2[] ATTR_ALIGN(8) =
- rounder(0.60355339059); /* C2 * (C6+C2)/2 */
+ rounder (0.60355339059); /* C2 * (C6+C2)/2 */
static const int32_t rounder6[] ATTR_ALIGN(8) =
- rounder(-0.25); /* C2 * (C6-C2)/2 */
+ rounder (-0.25); /* C2 * (C6-C2)/2 */
static const int32_t rounder3[] ATTR_ALIGN(8) =
- rounder(0.087788325588); /* C3*(-C3/C4+C3+C5)/2 */
+ rounder (0.087788325588); /* C3*(-C3/C4+C3+C5)/2 */
static const int32_t rounder5[] ATTR_ALIGN(8) =
- rounder(-0.441341716183); /* C3*(-C5/C4+C5-C3)/2 */
+ rounder (-0.441341716183); /* C3*(-C5/C4+C5-C3)/2 */
#undef COL_SHIFT
#undef ROW_SHIFT
@@ -597,9 +597,9 @@ void idct (int16_t * const block) \
void ff_mmx_idct(DCTELEM *block);
void ff_mmxext_idct(DCTELEM *block);
-declare_idct(ff_mmxext_idct, mmxext_table,
- mmxext_row_head, mmxext_row, mmxext_row_tail, mmxext_row_mid)
+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)
+declare_idct (ff_mmx_idct, mmx_table,
+ mmx_row_head, mmx_row, mmx_row_tail, mmx_row_mid)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx_xvid.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx_xvid.c
index 2246cb997..22cd50019 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx_xvid.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_mmx_xvid.c
@@ -64,25 +64,21 @@
//-----------------------------------------------------------------------------
-DECLARE_ALIGNED(8, static const int16_t, tg_1_16)[4*4] =
-{
- 13036, 13036, 13036, 13036, // tg * (2<<16) + 0.5
- 27146, 27146, 27146, 27146, // tg * (2<<16) + 0.5
- -21746, -21746, -21746, -21746, // tg * (2<<16) + 0.5
- 23170, 23170, 23170, 23170
-}; // cos * (2<<15) + 0.5
-
-DECLARE_ALIGNED(8, static const int32_t, rounder_0)[2*8] =
-{
- 65536, 65536,
- 3597, 3597,
- 2260, 2260,
- 1203, 1203,
- 0, 0,
- 120, 120,
- 512, 512,
- 512, 512
-};
+DECLARE_ALIGNED(8, static const int16_t, tg_1_16)[4*4] = {
+ 13036,13036,13036,13036, // tg * (2<<16) + 0.5
+ 27146,27146,27146,27146, // tg * (2<<16) + 0.5
+ -21746,-21746,-21746,-21746, // tg * (2<<16) + 0.5
+ 23170,23170,23170,23170}; // cos * (2<<15) + 0.5
+
+DECLARE_ALIGNED(8, static const int32_t, rounder_0)[2*8] = {
+ 65536,65536,
+ 3597,3597,
+ 2260,2260,
+ 1203,1203,
+ 0,0,
+ 120,120,
+ 512,512,
+ 512,512};
//-----------------------------------------------------------------------------
//
@@ -144,86 +140,84 @@ DECLARE_ALIGNED(8, static const int32_t, rounder_0)[2*8] =
//-----------------------------------------------------------------------------
// Table for rows 0,4 - constants are multiplied by cos_4_16
-DECLARE_ALIGNED(8, static const int16_t, tab_i_04_mmx)[32*4] =
-{
- 16384, 16384, 16384, -16384, // movq-> w06 w04 w02 w00
- 21407, 8867, 8867, -21407, // w07 w05 w03 w01
- 16384, -16384, 16384, 16384, // w14 w12 w10 w08
- -8867, 21407, -21407, -8867, // w15 w13 w11 w09
- 22725, 12873, 19266, -22725, // w22 w20 w18 w16
- 19266, 4520, -4520, -12873, // w23 w21 w19 w17
- 12873, 4520, 4520, 19266, // w30 w28 w26 w24
- -22725, 19266, -12873, -22725, // w31 w29 w27 w25
+DECLARE_ALIGNED(8, static const int16_t, tab_i_04_mmx)[32*4] = {
+ 16384,16384,16384,-16384, // movq-> w06 w04 w02 w00
+ 21407,8867,8867,-21407, // w07 w05 w03 w01
+ 16384,-16384,16384,16384, // w14 w12 w10 w08
+ -8867,21407,-21407,-8867, // w15 w13 w11 w09
+ 22725,12873,19266,-22725, // w22 w20 w18 w16
+ 19266,4520,-4520,-12873, // w23 w21 w19 w17
+ 12873,4520,4520,19266, // w30 w28 w26 w24
+ -22725,19266,-12873,-22725, // w31 w29 w27 w25
// Table for rows 1,7 - constants are multiplied by cos_1_16
- 22725, 22725, 22725, -22725, // movq-> w06 w04 w02 w00
- 29692, 12299, 12299, -29692, // w07 w05 w03 w01
- 22725, -22725, 22725, 22725, // w14 w12 w10 w08
- -12299, 29692, -29692, -12299, // w15 w13 w11 w09
- 31521, 17855, 26722, -31521, // w22 w20 w18 w16
- 26722, 6270, -6270, -17855, // w23 w21 w19 w17
- 17855, 6270, 6270, 26722, // w30 w28 w26 w24
- -31521, 26722, -17855, -31521, // w31 w29 w27 w25
+ 22725,22725,22725,-22725, // movq-> w06 w04 w02 w00
+ 29692,12299,12299,-29692, // w07 w05 w03 w01
+ 22725,-22725,22725,22725, // w14 w12 w10 w08
+ -12299,29692,-29692,-12299, // w15 w13 w11 w09
+ 31521,17855,26722,-31521, // w22 w20 w18 w16
+ 26722,6270,-6270,-17855, // w23 w21 w19 w17
+ 17855,6270,6270,26722, // w30 w28 w26 w24
+ -31521,26722,-17855,-31521, // w31 w29 w27 w25
// Table for rows 2,6 - constants are multiplied by cos_2_16
- 21407, 21407, 21407, -21407, // movq-> w06 w04 w02 w00
- 27969, 11585, 11585, -27969, // w07 w05 w03 w01
- 21407, -21407, 21407, 21407, // w14 w12 w10 w08
- -11585, 27969, -27969, -11585, // w15 w13 w11 w09
- 29692, 16819, 25172, -29692, // w22 w20 w18 w16
- 25172, 5906, -5906, -16819, // w23 w21 w19 w17
- 16819, 5906, 5906, 25172, // w30 w28 w26 w24
- -29692, 25172, -16819, -29692, // w31 w29 w27 w25
+ 21407,21407,21407,-21407, // movq-> w06 w04 w02 w00
+ 27969,11585,11585,-27969, // w07 w05 w03 w01
+ 21407,-21407,21407,21407, // w14 w12 w10 w08
+ -11585,27969,-27969,-11585, // w15 w13 w11 w09
+ 29692,16819,25172,-29692, // w22 w20 w18 w16
+ 25172,5906,-5906,-16819, // w23 w21 w19 w17
+ 16819,5906,5906,25172, // w30 w28 w26 w24
+ -29692,25172,-16819,-29692, // w31 w29 w27 w25
// Table for rows 3,5 - constants are multiplied by cos_3_16
- 19266, 19266, 19266, -19266, // movq-> w06 w04 w02 w00
- 25172, 10426, 10426, -25172, // w07 w05 w03 w01
- 19266, -19266, 19266, 19266, // w14 w12 w10 w08
- -10426, 25172, -25172, -10426, // w15 w13 w11 w09
- 26722, 15137, 22654, -26722, // w22 w20 w18 w16
- 22654, 5315, -5315, -15137, // w23 w21 w19 w17
- 15137, 5315, 5315, 22654, // w30 w28 w26 w24
- -26722, 22654, -15137, -26722, // w31 w29 w27 w25
+ 19266,19266,19266,-19266, // movq-> w06 w04 w02 w00
+ 25172,10426,10426,-25172, // w07 w05 w03 w01
+ 19266,-19266,19266,19266, // w14 w12 w10 w08
+ -10426,25172,-25172,-10426, // w15 w13 w11 w09
+ 26722,15137,22654,-26722, // w22 w20 w18 w16
+ 22654,5315,-5315,-15137, // w23 w21 w19 w17
+ 15137,5315,5315,22654, // w30 w28 w26 w24
+ -26722,22654,-15137,-26722, // w31 w29 w27 w25
};
//-----------------------------------------------------------------------------
// Tables for xmm processors
//-----------------------------------------------------------------------------
// %3 for rows 0,4 - constants are multiplied by cos_4_16
-DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] =
-{
- 16384, 21407, 16384, 8867, // movq-> w05 w04 w01 w00
- 16384, 8867, -16384, -21407, // w07 w06 w03 w02
- 16384, -8867, 16384, -21407, // w13 w12 w09 w08
- -16384, 21407, 16384, -8867, // w15 w14 w11 w10
- 22725, 19266, 19266, -4520, // w21 w20 w17 w16
- 12873, 4520, -22725, -12873, // w23 w22 w19 w18
- 12873, -22725, 4520, -12873, // w29 w28 w25 w24
- 4520, 19266, 19266, -22725, // w31 w30 w27 w26
+DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] = {
+ 16384,21407,16384,8867, // movq-> w05 w04 w01 w00
+ 16384,8867,-16384,-21407, // w07 w06 w03 w02
+ 16384,-8867,16384,-21407, // w13 w12 w09 w08
+ -16384,21407,16384,-8867, // w15 w14 w11 w10
+ 22725,19266,19266,-4520, // w21 w20 w17 w16
+ 12873,4520,-22725,-12873, // w23 w22 w19 w18
+ 12873,-22725,4520,-12873, // w29 w28 w25 w24
+ 4520,19266,19266,-22725, // w31 w30 w27 w26
// %3 for rows 1,7 - constants are multiplied by cos_1_16
- 22725, 29692, 22725, 12299, // movq-> w05 w04 w01 w00
- 22725, 12299, -22725, -29692, // w07 w06 w03 w02
- 22725, -12299, 22725, -29692, // w13 w12 w09 w08
- -22725, 29692, 22725, -12299, // w15 w14 w11 w10
- 31521, 26722, 26722, -6270, // w21 w20 w17 w16
- 17855, 6270, -31521, -17855, // w23 w22 w19 w18
- 17855, -31521, 6270, -17855, // w29 w28 w25 w24
- 6270, 26722, 26722, -31521, // w31 w30 w27 w26
+ 22725,29692,22725,12299, // movq-> w05 w04 w01 w00
+ 22725,12299,-22725,-29692, // w07 w06 w03 w02
+ 22725,-12299,22725,-29692, // w13 w12 w09 w08
+ -22725,29692,22725,-12299, // w15 w14 w11 w10
+ 31521,26722,26722,-6270, // w21 w20 w17 w16
+ 17855,6270,-31521,-17855, // w23 w22 w19 w18
+ 17855,-31521,6270,-17855, // w29 w28 w25 w24
+ 6270,26722,26722,-31521, // w31 w30 w27 w26
// %3 for rows 2,6 - constants are multiplied by cos_2_16
- 21407, 27969, 21407, 11585, // movq-> w05 w04 w01 w00
- 21407, 11585, -21407, -27969, // w07 w06 w03 w02
- 21407, -11585, 21407, -27969, // w13 w12 w09 w08
- -21407, 27969, 21407, -11585, // w15 w14 w11 w10
- 29692, 25172, 25172, -5906, // w21 w20 w17 w16
- 16819, 5906, -29692, -16819, // w23 w22 w19 w18
- 16819, -29692, 5906, -16819, // w29 w28 w25 w24
- 5906, 25172, 25172, -29692, // w31 w30 w27 w26
+ 21407,27969,21407,11585, // movq-> w05 w04 w01 w00
+ 21407,11585,-21407,-27969, // w07 w06 w03 w02
+ 21407,-11585,21407,-27969, // w13 w12 w09 w08
+ -21407,27969,21407,-11585, // w15 w14 w11 w10
+ 29692,25172,25172,-5906, // w21 w20 w17 w16
+ 16819,5906,-29692,-16819, // w23 w22 w19 w18
+ 16819,-29692,5906,-16819, // w29 w28 w25 w24
+ 5906,25172,25172,-29692, // w31 w30 w27 w26
// %3 for rows 3,5 - constants are multiplied by cos_3_16
- 19266, 25172, 19266, 10426, // movq-> w05 w04 w01 w00
- 19266, 10426, -19266, -25172, // w07 w06 w03 w02
- 19266, -10426, 19266, -25172, // w13 w12 w09 w08
- -19266, 25172, 19266, -10426, // w15 w14 w11 w10
- 26722, 22654, 22654, -5315, // w21 w20 w17 w16
- 15137, 5315, -26722, -15137, // w23 w22 w19 w18
- 15137, -26722, 5315, -15137, // w29 w28 w25 w24
- 5315, 22654, 22654, -26722, // w31 w30 w27 w26
+ 19266,25172,19266,10426, // movq-> w05 w04 w01 w00
+ 19266,10426,-19266,-25172, // w07 w06 w03 w02
+ 19266,-10426,19266,-25172, // w13 w12 w09 w08
+ -19266,25172,19266,-10426, // w15 w14 w11 w10
+ 26722,22654,22654,-5315, // w21 w20 w17 w16
+ 15137,5315,-26722,-15137, // w23 w22 w19 w18
+ 15137,-26722,5315,-15137, // w29 w28 w25 w24
+ 5315,22654,22654,-26722, // w31 w30 w27 w26
};
//=============================================================================
// Helper macros for the code
@@ -281,7 +275,7 @@ DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] =
"movq %%mm1," #A2 " \n\t"/* 1 ; save y3 y2 y1 y0*/\
"por %%mm4,%%mm7 \n\t"/* 4 ; y7 y6 y5 y4*/\
"movq %%mm7,8 +" #A2 "\n\t"/* 7 ; save y7 y6 y5 y4*/\
-
+
//-----------------------------------------------------------------------------
// DCT_8_INV_ROW_XMM( INP, OUT, TABLE, ROUNDER
@@ -329,7 +323,7 @@ DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] =
"movq %%mm3, " #A2 " \n\t"/* 3 ; save y3 y2 y1 y0*/\
"pshufw $0xb1,%%mm7,%%mm7 \n\t"/* y7 y6 y5 y4*/\
"movq %%mm7,8 +" #A2 "\n\t"/* 7 ; save y7 y6 y5 y4*/\
-
+
//-----------------------------------------------------------------------------
//
@@ -488,23 +482,22 @@ DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] =
//-----------------------------------------------------------------------------
-void ff_idct_xvid_mmx(short *block)
-{
- __asm__ volatile(
- //# Process each row
- DCT_8_INV_ROW_MMX(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
- DCT_8_INV_ROW_MMX(1*16(%0), 1*16(%0), 64*1(%2), 8*1(%1))
- DCT_8_INV_ROW_MMX(2*16(%0), 2*16(%0), 64*2(%2), 8*2(%1))
- DCT_8_INV_ROW_MMX(3*16(%0), 3*16(%0), 64*3(%2), 8*3(%1))
- DCT_8_INV_ROW_MMX(4*16(%0), 4*16(%0), 64*0(%2), 8*4(%1))
- DCT_8_INV_ROW_MMX(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1))
- DCT_8_INV_ROW_MMX(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1))
- DCT_8_INV_ROW_MMX(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1))
-
- //# Process the columns (4 at a time)
- DCT_8_INV_COL(0(%0), 0(%0))
- DCT_8_INV_COL(8(%0), 8(%0))
- :: "r"(block), "r"(rounder_0), "r"(tab_i_04_mmx), "r"(tg_1_16));
+void ff_idct_xvid_mmx(short *block){
+__asm__ volatile(
+ //# Process each row
+ DCT_8_INV_ROW_MMX(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
+ DCT_8_INV_ROW_MMX(1*16(%0), 1*16(%0), 64*1(%2), 8*1(%1))
+ DCT_8_INV_ROW_MMX(2*16(%0), 2*16(%0), 64*2(%2), 8*2(%1))
+ DCT_8_INV_ROW_MMX(3*16(%0), 3*16(%0), 64*3(%2), 8*3(%1))
+ DCT_8_INV_ROW_MMX(4*16(%0), 4*16(%0), 64*0(%2), 8*4(%1))
+ DCT_8_INV_ROW_MMX(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1))
+ DCT_8_INV_ROW_MMX(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1))
+ DCT_8_INV_ROW_MMX(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1))
+
+ //# Process the columns (4 at a time)
+ DCT_8_INV_COL(0(%0), 0(%0))
+ DCT_8_INV_COL(8(%0), 8(%0))
+ :: "r"(block), "r"(rounder_0), "r"(tab_i_04_mmx), "r"(tg_1_16));
}
//-----------------------------------------------------------------------------
@@ -512,22 +505,21 @@ void ff_idct_xvid_mmx(short *block)
//-----------------------------------------------------------------------------
-void ff_idct_xvid_mmx2(short *block)
-{
- __asm__ volatile(
- //# Process each row
- DCT_8_INV_ROW_XMM(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
- DCT_8_INV_ROW_XMM(1*16(%0), 1*16(%0), 64*1(%2), 8*1(%1))
- DCT_8_INV_ROW_XMM(2*16(%0), 2*16(%0), 64*2(%2), 8*2(%1))
- DCT_8_INV_ROW_XMM(3*16(%0), 3*16(%0), 64*3(%2), 8*3(%1))
- DCT_8_INV_ROW_XMM(4*16(%0), 4*16(%0), 64*0(%2), 8*4(%1))
- DCT_8_INV_ROW_XMM(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1))
- DCT_8_INV_ROW_XMM(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1))
- DCT_8_INV_ROW_XMM(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1))
-
- //# Process the columns (4 at a time)
- DCT_8_INV_COL(0(%0), 0(%0))
- DCT_8_INV_COL(8(%0), 8(%0))
- :: "r"(block), "r"(rounder_0), "r"(tab_i_04_xmm), "r"(tg_1_16));
+void ff_idct_xvid_mmx2(short *block){
+__asm__ volatile(
+ //# Process each row
+ DCT_8_INV_ROW_XMM(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
+ DCT_8_INV_ROW_XMM(1*16(%0), 1*16(%0), 64*1(%2), 8*1(%1))
+ DCT_8_INV_ROW_XMM(2*16(%0), 2*16(%0), 64*2(%2), 8*2(%1))
+ DCT_8_INV_ROW_XMM(3*16(%0), 3*16(%0), 64*3(%2), 8*3(%1))
+ DCT_8_INV_ROW_XMM(4*16(%0), 4*16(%0), 64*0(%2), 8*4(%1))
+ DCT_8_INV_ROW_XMM(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1))
+ DCT_8_INV_ROW_XMM(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1))
+ DCT_8_INV_ROW_XMM(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1))
+
+ //# Process the columns (4 at a time)
+ DCT_8_INV_COL(0(%0), 0(%0))
+ DCT_8_INV_COL(8(%0), 8(%0))
+ :: "r"(block), "r"(rounder_0), "r"(tab_i_04_xmm), "r"(tg_1_16));
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_sse2_xvid.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_sse2_xvid.c
index 53fe5ae6d..6c3564f24 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_sse2_xvid.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/idct_sse2_xvid.c
@@ -55,49 +55,44 @@
DECLARE_ASM_CONST(16, int16_t, tan1)[] = {X8(13036)}; // tan( pi/16)
DECLARE_ASM_CONST(16, int16_t, tan2)[] = {X8(27146)}; // tan(2pi/16) = sqrt(2)-1
DECLARE_ASM_CONST(16, int16_t, tan3)[] = {X8(43790)}; // tan(3pi/16)-1
-DECLARE_ASM_CONST(16, int16_t, sqrt2)[] = {X8(23170)}; // 0.5/sqrt(2)
+DECLARE_ASM_CONST(16, int16_t, sqrt2)[]= {X8(23170)}; // 0.5/sqrt(2)
DECLARE_ASM_CONST(8, uint8_t, m127)[] = {X8(127)};
-DECLARE_ASM_CONST(16, int16_t, iTab1)[] =
-{
- 0x4000, 0x539f, 0xc000, 0xac61, 0x4000, 0xdd5d, 0x4000, 0xdd5d,
- 0x4000, 0x22a3, 0x4000, 0x22a3, 0xc000, 0x539f, 0x4000, 0xac61,
- 0x3249, 0x11a8, 0x4b42, 0xee58, 0x11a8, 0x4b42, 0x11a8, 0xcdb7,
- 0x58c5, 0x4b42, 0xa73b, 0xcdb7, 0x3249, 0xa73b, 0x4b42, 0xa73b
+DECLARE_ASM_CONST(16, int16_t, iTab1)[] = {
+ 0x4000, 0x539f, 0xc000, 0xac61, 0x4000, 0xdd5d, 0x4000, 0xdd5d,
+ 0x4000, 0x22a3, 0x4000, 0x22a3, 0xc000, 0x539f, 0x4000, 0xac61,
+ 0x3249, 0x11a8, 0x4b42, 0xee58, 0x11a8, 0x4b42, 0x11a8, 0xcdb7,
+ 0x58c5, 0x4b42, 0xa73b, 0xcdb7, 0x3249, 0xa73b, 0x4b42, 0xa73b
};
-DECLARE_ASM_CONST(16, int16_t, iTab2)[] =
-{
- 0x58c5, 0x73fc, 0xa73b, 0x8c04, 0x58c5, 0xcff5, 0x58c5, 0xcff5,
- 0x58c5, 0x300b, 0x58c5, 0x300b, 0xa73b, 0x73fc, 0x58c5, 0x8c04,
- 0x45bf, 0x187e, 0x6862, 0xe782, 0x187e, 0x6862, 0x187e, 0xba41,
- 0x7b21, 0x6862, 0x84df, 0xba41, 0x45bf, 0x84df, 0x6862, 0x84df
+DECLARE_ASM_CONST(16, int16_t, iTab2)[] = {
+ 0x58c5, 0x73fc, 0xa73b, 0x8c04, 0x58c5, 0xcff5, 0x58c5, 0xcff5,
+ 0x58c5, 0x300b, 0x58c5, 0x300b, 0xa73b, 0x73fc, 0x58c5, 0x8c04,
+ 0x45bf, 0x187e, 0x6862, 0xe782, 0x187e, 0x6862, 0x187e, 0xba41,
+ 0x7b21, 0x6862, 0x84df, 0xba41, 0x45bf, 0x84df, 0x6862, 0x84df
};
-DECLARE_ASM_CONST(16, int16_t, iTab3)[] =
-{
- 0x539f, 0x6d41, 0xac61, 0x92bf, 0x539f, 0xd2bf, 0x539f, 0xd2bf,
- 0x539f, 0x2d41, 0x539f, 0x2d41, 0xac61, 0x6d41, 0x539f, 0x92bf,
- 0x41b3, 0x1712, 0x6254, 0xe8ee, 0x1712, 0x6254, 0x1712, 0xbe4d,
- 0x73fc, 0x6254, 0x8c04, 0xbe4d, 0x41b3, 0x8c04, 0x6254, 0x8c04
+DECLARE_ASM_CONST(16, int16_t, iTab3)[] = {
+ 0x539f, 0x6d41, 0xac61, 0x92bf, 0x539f, 0xd2bf, 0x539f, 0xd2bf,
+ 0x539f, 0x2d41, 0x539f, 0x2d41, 0xac61, 0x6d41, 0x539f, 0x92bf,
+ 0x41b3, 0x1712, 0x6254, 0xe8ee, 0x1712, 0x6254, 0x1712, 0xbe4d,
+ 0x73fc, 0x6254, 0x8c04, 0xbe4d, 0x41b3, 0x8c04, 0x6254, 0x8c04
};
-DECLARE_ASM_CONST(16, int16_t, iTab4)[] =
-{
- 0x4b42, 0x6254, 0xb4be, 0x9dac, 0x4b42, 0xd746, 0x4b42, 0xd746,
- 0x4b42, 0x28ba, 0x4b42, 0x28ba, 0xb4be, 0x6254, 0x4b42, 0x9dac,
- 0x3b21, 0x14c3, 0x587e, 0xeb3d, 0x14c3, 0x587e, 0x14c3, 0xc4df,
- 0x6862, 0x587e, 0x979e, 0xc4df, 0x3b21, 0x979e, 0x587e, 0x979e
+DECLARE_ASM_CONST(16, int16_t, iTab4)[] = {
+ 0x4b42, 0x6254, 0xb4be, 0x9dac, 0x4b42, 0xd746, 0x4b42, 0xd746,
+ 0x4b42, 0x28ba, 0x4b42, 0x28ba, 0xb4be, 0x6254, 0x4b42, 0x9dac,
+ 0x3b21, 0x14c3, 0x587e, 0xeb3d, 0x14c3, 0x587e, 0x14c3, 0xc4df,
+ 0x6862, 0x587e, 0x979e, 0xc4df, 0x3b21, 0x979e, 0x587e, 0x979e
};
-DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] =
-{
- 65536, 65536, 65536, 65536,
- 3597, 3597, 3597, 3597,
- 2260, 2260, 2260, 2260,
- 1203, 1203, 1203, 1203,
- 120, 120, 120, 120,
- 512, 512, 512, 512
+DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] = {
+ 65536, 65536, 65536, 65536,
+ 3597, 3597, 3597, 3597,
+ 2260, 2260, 2260, 2260,
+ 1203, 1203, 1203, 1203,
+ 120, 120, 120, 120,
+ 512, 512, 512, 512
};
// Temporary storage before the column pass
@@ -205,7 +200,7 @@ DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] =
#define iLLM_HEAD \
"movdqa "MANGLE(tan3)", "TAN3" \n\t" \
"movdqa "MANGLE(tan1)", "TAN1" \n\t" \
-
+
///IDCT pass on columns.
#define iLLM_PASS(dct) \
"movdqa "TAN3", %%xmm1 \n\t" \
@@ -348,43 +343,43 @@ DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] =
inline void ff_idct_xvid_sse2(short *block)
{
__asm__ volatile(
- "movq "MANGLE(m127)", %%mm0 \n\t"
- iMTX_MULT("(%0)", MANGLE(iTab1), ROUND(walkenIdctRounders), PUT_EVEN(ROW0))
- iMTX_MULT("1*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+1*16), PUT_ODD(ROW1))
- iMTX_MULT("2*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+2*16), PUT_EVEN(ROW2))
+ "movq "MANGLE(m127)", %%mm0 \n\t"
+ iMTX_MULT("(%0)", MANGLE(iTab1), ROUND(walkenIdctRounders), PUT_EVEN(ROW0))
+ iMTX_MULT("1*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+1*16), PUT_ODD(ROW1))
+ iMTX_MULT("2*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+2*16), PUT_EVEN(ROW2))
- TEST_TWO_ROWS("3*16(%0)", "4*16(%0)", "%%eax", "%%ecx", CLEAR_ODD(ROW3), CLEAR_EVEN(ROW4))
- JZ("%%eax", "1f")
- iMTX_MULT("3*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+3*16), PUT_ODD(ROW3))
+ TEST_TWO_ROWS("3*16(%0)", "4*16(%0)", "%%eax", "%%ecx", CLEAR_ODD(ROW3), CLEAR_EVEN(ROW4))
+ JZ("%%eax", "1f")
+ iMTX_MULT("3*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+3*16), PUT_ODD(ROW3))
- TEST_TWO_ROWS("5*16(%0)", "6*16(%0)", "%%eax", "%%edx", CLEAR_ODD(ROW5), CLEAR_EVEN(ROW6))
- TEST_ONE_ROW("7*16(%0)", "%%esi", CLEAR_ODD(ROW7))
- iLLM_HEAD
- ASMALIGN(4)
- JNZ("%%ecx", "2f")
- JNZ("%%eax", "3f")
- JNZ("%%edx", "4f")
- JNZ("%%esi", "5f")
- iLLM_PASS_SPARSE("%0")
- "jmp 6f \n\t"
- "2: \n\t"
- iMTX_MULT("4*16(%0)", MANGLE(iTab1), "#", PUT_EVEN(ROW4))
- "3: \n\t"
- iMTX_MULT("5*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+4*16), PUT_ODD(ROW5))
- JZ("%%edx", "1f")
- "4: \n\t"
- iMTX_MULT("6*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+5*16), PUT_EVEN(ROW6))
- JZ("%%esi", "1f")
- "5: \n\t"
- iMTX_MULT("7*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+5*16), PUT_ODD(ROW7))
+ TEST_TWO_ROWS("5*16(%0)", "6*16(%0)", "%%eax", "%%edx", CLEAR_ODD(ROW5), CLEAR_EVEN(ROW6))
+ TEST_ONE_ROW("7*16(%0)", "%%esi", CLEAR_ODD(ROW7))
+ iLLM_HEAD
+ ASMALIGN(4)
+ JNZ("%%ecx", "2f")
+ JNZ("%%eax", "3f")
+ JNZ("%%edx", "4f")
+ JNZ("%%esi", "5f")
+ iLLM_PASS_SPARSE("%0")
+ "jmp 6f \n\t"
+ "2: \n\t"
+ iMTX_MULT("4*16(%0)", MANGLE(iTab1), "#", PUT_EVEN(ROW4))
+ "3: \n\t"
+ iMTX_MULT("5*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+4*16), PUT_ODD(ROW5))
+ JZ("%%edx", "1f")
+ "4: \n\t"
+ iMTX_MULT("6*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+5*16), PUT_EVEN(ROW6))
+ JZ("%%esi", "1f")
+ "5: \n\t"
+ iMTX_MULT("7*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+5*16), PUT_ODD(ROW7))
#if !ARCH_X86_64
- iLLM_HEAD
+ iLLM_HEAD
#endif
- iLLM_PASS("%0")
- "6: \n\t"
- : "+r"(block)
- :
- : "%eax", "%ecx", "%edx", "%esi", "memory");
+ iLLM_PASS("%0")
+ "6: \n\t"
+ : "+r"(block)
+ :
+ : "%eax", "%ecx", "%edx", "%esi", "memory");
}
void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mathops.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mathops.h
index 6fd97ee94..691a200fd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mathops.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mathops.h
@@ -50,7 +50,7 @@
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c)
{
- int i = b;
+ int i=b;
__asm__ volatile(
"cmp %2, %1 \n\t"
"cmovg %1, %0 \n\t"
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mlpdsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mlpdsp.c
index 875b43521..486a927ad 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mlpdsp.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mlpdsp.c
@@ -45,12 +45,10 @@ static const void *firtable[9] = { &ff_mlp_firorder_0, &ff_mlp_firorder_1,
&ff_mlp_firorder_2, &ff_mlp_firorder_3,
&ff_mlp_firorder_4, &ff_mlp_firorder_5,
&ff_mlp_firorder_6, &ff_mlp_firorder_7,
- &ff_mlp_firorder_8
- };
+ &ff_mlp_firorder_8 };
static const void *iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1,
&ff_mlp_iirorder_2, &ff_mlp_iirorder_3,
- &ff_mlp_iirorder_4
- };
+ &ff_mlp_iirorder_4 };
#if ARCH_X86_64
@@ -98,7 +96,7 @@ static const void *iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1,
"mov %%esi, %%eax\n\t" \
"movzbl %7 , %%ecx\n\t" \
"shrd %%cl, %%edx, %%eax\n\t" \
-
+
#define ACCUM "%%edx"
#define RESULT "%%eax"
#define RESULT32 "%%eax"
@@ -126,20 +124,20 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
"1: \n\t"
CLEAR_ACCUM
"jmp *%5 \n\t"
- FIRMUL(ff_mlp_firorder_8, 0x1c)
- FIRMUL(ff_mlp_firorder_7, 0x18)
- FIRMUL(ff_mlp_firorder_6, 0x14)
- FIRMUL(ff_mlp_firorder_5, 0x10)
- FIRMUL(ff_mlp_firorder_4, 0x0c)
- FIRMULREG(ff_mlp_firorder_3, 0x08, 10)
+ FIRMUL (ff_mlp_firorder_8, 0x1c )
+ FIRMUL (ff_mlp_firorder_7, 0x18 )
+ FIRMUL (ff_mlp_firorder_6, 0x14 )
+ FIRMUL (ff_mlp_firorder_5, 0x10 )
+ FIRMUL (ff_mlp_firorder_4, 0x0c )
+ FIRMULREG(ff_mlp_firorder_3, 0x08,10)
FIRMULREG(ff_mlp_firorder_2, 0x04, 9)
FIRMULREG(ff_mlp_firorder_1, 0x00, 8)
LABEL_MANGLE(ff_mlp_firorder_0)":\n\t"
"jmp *%6 \n\t"
- IIRMUL(ff_mlp_iirorder_4, 0x0c)
- IIRMUL(ff_mlp_iirorder_3, 0x08)
- IIRMUL(ff_mlp_iirorder_2, 0x04)
- IIRMUL(ff_mlp_iirorder_1, 0x00)
+ IIRMUL (ff_mlp_iirorder_4, 0x0c )
+ IIRMUL (ff_mlp_iirorder_3, 0x08 )
+ IIRMUL (ff_mlp_iirorder_2, 0x04 )
+ IIRMUL (ff_mlp_iirorder_1, 0x00 )
LABEL_MANGLE(ff_mlp_iirorder_0)":\n\t"
SHIFT_ACCUM
"mov "RESULT" ,"ACCUM" \n\t"
@@ -154,20 +152,20 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
"incl %3 \n\t"
"js 1b \n\t"
: /* 0*/"+r"(state),
- /* 1*/"+r"(coeff),
- /* 2*/"+r"(sample_buffer),
+ /* 1*/"+r"(coeff),
+ /* 2*/"+r"(sample_buffer),
#if ARCH_X86_64
- /* 3*/"+r"(blocksize)
+ /* 3*/"+r"(blocksize)
: /* 4*/"r"((x86_reg)mask), /* 5*/"r"(firjump),
- /* 6*/"r"(iirjump) , /* 7*/"c"(filter_shift)
+ /* 6*/"r"(iirjump) , /* 7*/"c"(filter_shift)
, /* 8*/"r"((int64_t)coeff[0])
, /* 9*/"r"((int64_t)coeff[1])
, /*10*/"r"((int64_t)coeff[2])
: "rax", "rdx", "rsi"
#else /* ARCH_X86_32 */
- /* 3*/"+m"(blocksize)
- : /* 4*/"m"(mask), /* 5*/"m"(firjump),
- /* 6*/"m"(iirjump) , /* 7*/"m"(filter_shift)
+ /* 3*/"+m"(blocksize)
+ : /* 4*/"m"( mask), /* 5*/"m"(firjump),
+ /* 6*/"m"(iirjump) , /* 7*/"m"(filter_shift)
: "eax", "edx", "esi", "ecx"
#endif /* !ARCH_X86_64 */
);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx.c
index aac5ac3af..f9a8847de 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx.c
@@ -32,142 +32,139 @@ extern uint16_t inv_zigzag_direct16[64];
static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ 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);
+ assert(s->block_last_index[n]>=0 || s->h263_aic);
- if(!s->h263_aic)
- {
- if(n < 4)
+ 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
- {
+ }else{
qadd = 0;
- level = block[0];
+ level= block[0];
}
if(s->ac_pred)
- nCoeffs = 63;
+ nCoeffs=63;
else
- nCoeffs = s->inter_scantable.raster_end[ s->block_last_index[n] ];
+ 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"
- ASMALIGN(4)
- "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;
+__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"
+ ASMALIGN(4)
+ "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)
+ 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);
+ assert(s->block_last_index[n]>=0 || s->h263_aic);
- nCoeffs = s->inter_scantable.raster_end[ s->block_last_index[n] ];
+ 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"
- ASMALIGN(4)
- "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"
- );
+__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"
+ ASMALIGN(4)
+ "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"
+ );
}
@@ -201,288 +198,287 @@ static void dct_unquantize_h263_inter_mmx(MpegEncContext *s,
high3 += tlow1
*/
static void dct_unquantize_mpeg1_intra_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
+ DCTELEM *block, int n, int qscale)
{
x86_reg nCoeffs;
const uint16_t *quant_matrix;
int block0;
- assert(s->block_last_index[n] >= 0);
+ assert(s->block_last_index[n]>=0);
- nCoeffs = s->intra_scantable.raster_end[ s->block_last_index[n] ] + 1;
+ nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
- if(n < 4)
+ 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"
- ASMALIGN(4)
- "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;
+__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"
+ ASMALIGN(4)
+ "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)
+ 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"
- ASMALIGN(4)
- "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"
- );
+ 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"
+ ASMALIGN(4)
+ "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)
+ DCTELEM *block, int n, int qscale)
{
x86_reg nCoeffs;
const uint16_t *quant_matrix;
int block0;
- assert(s->block_last_index[n] >= 0);
+ 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(s->alternate_scan) nCoeffs= 63; //FIXME
+ else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
- if(n < 4)
+ 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"
- ASMALIGN(4)
- "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
+__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"
+ ASMALIGN(4)
+ "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)
+ 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"
- ASMALIGN(4)
- "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"
- );
+ 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"
+ ASMALIGN(4)
+ "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];
+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]++;
@@ -527,17 +523,16 @@ static void denoise_dct_mmx(MpegEncContext *s, DCTELEM *block)
"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)
+ " 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];
+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]++;
@@ -582,8 +577,8 @@ static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block)
"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)
+ " jb 1b \n\t"
+ : "+r" (block), "+r" (sum), "+r" (offset)
: "r"(block+64)
);
}
@@ -630,8 +625,7 @@ static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block)
void MPV_common_init_mmx(MpegEncContext *s)
{
- if(mm_flags & FF_MM_MMX)
- {
+ if (mm_flags & FF_MM_MMX) {
const int dct_algo = s->avctx->dct_algo;
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
@@ -642,36 +636,25 @@ void MPV_common_init_mmx(MpegEncContext *s)
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
- if(mm_flags & FF_MM_SSE2)
- {
- s->denoise_dct = denoise_dct_sse2;
- }
- else
- {
- s->denoise_dct = denoise_dct_mmx;
+ if (mm_flags & FF_MM_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(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
#if HAVE_SSSE3
- if(mm_flags & FF_MM_SSSE3)
- {
- s->dct_quantize = dct_quantize_SSSE3;
- }
- else
+ if(mm_flags & FF_MM_SSSE3){
+ s->dct_quantize= dct_quantize_SSSE3;
+ } else
#endif
- if(mm_flags & FF_MM_SSE2)
- {
- s->dct_quantize = dct_quantize_SSE2;
- }
- else if(mm_flags & FF_MM_MMX2)
- {
- s->dct_quantize = dct_quantize_MMX2;
- }
- else
- {
- s->dct_quantize = dct_quantize_MMX;
- }
+ if(mm_flags & FF_MM_SSE2){
+ s->dct_quantize= dct_quantize_SSE2;
+ } else if(mm_flags & FF_MM_MMX2){
+ s->dct_quantize= dct_quantize_MMX2;
+ } else {
+ s->dct_quantize= dct_quantize_MMX;
+ }
}
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx_template.c
index 479aec083..1e5cd2cb4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/mpegvideo_mmx_template.c
@@ -92,68 +92,62 @@
#endif
static int RENAME(dct_quantize)(MpegEncContext *s,
- DCTELEM *block, int n,
- int qscale, int *overflow)
+ DCTELEM *block, int n,
+ int qscale, int *overflow)
{
x86_reg last_non_zero_p1;
- int level = 0, q; //=0 is because gcc says uninitialized ...
+ int level=0, q; //=0 is because gcc says uninitialized ...
const uint16_t *qmat, *bias;
DECLARE_ALIGNED_16(int16_t, temp_block)[64];
- assert((7 & (int)(&temp_block[0])) == 0); //did gcc align it correctly?
+ assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly?
//s->fdct (block);
- RENAMEl(ff_fdct)(block); //cannot be anything else ...
+ RENAMEl(ff_fdct) (block); //cannot be anything else ...
if(s->dct_error_sum)
s->denoise_dct(s, block);
- if(s->mb_intra)
- {
+ if (s->mb_intra) {
int dummy;
- if(n < 4)
+ 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)
- {
+ if (!s->h263_aic) {
#if 1
- __asm__ volatile(
+ __asm__ volatile (
"mul %%ecx \n\t"
- : "=d"(level), "=a"(dummy)
- : "a"((block[0]>>2) + q), "c"(ff_inverse[q<<1])
- );
+ : "=d" (level), "=a"(dummy)
+ : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
+ );
#else
- __asm__ volatile(
+ __asm__ volatile (
"xorl %%edx, %%edx \n\t"
"divw %%cx \n\t"
"movzwl %%ax, %%eax \n\t"
- : "=a"(level)
- : "a"((block[0]>>2) + q), "c"(q<<1)
+ : "=a" (level)
+ : "a" ((block[0]>>2) + q), "c" (q<<1)
: "%edx"
- );
+ );
#endif
- }
- else
+ } else
/* For AIC we skip quant/dequant of INTRADC */
- level = (block[0] + 4) >> 3;
+ level = (block[0] + 4)>>3;
- block[0] = 0; //avoid fake overflow
+ 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
- {
+ } 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)
- {
+ 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
@@ -183,13 +177,11 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
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)
+ : "+a" (last_non_zero_p1)
+ : "r" (block+64), "r" (qmat), "r" (bias),
+ "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
);
- }
- else // FMT_H263
- {
+ }else{ // FMT_H263
__asm__ volatile(
"movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1
SPREADW(MM"3")
@@ -217,9 +209,9 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
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)
+ : "+a" (last_non_zero_p1)
+ : "r" (block+64), "r" (qmat+64), "r" (bias+64),
+ "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
);
}
__asm__ volatile(
@@ -231,249 +223,154 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
"packuswb "MM"4, "MM"4 \n\t"
#endif
"movd "MM"4, %0 \n\t" // *overflow
- : "=g"(*overflow)
- : "g"(s->max_qcoeff)
+ : "=g" (*overflow)
+ : "g" (s->max_qcoeff)
);
- if(s->mb_intra) block[0] = level;
- else block[0] = temp_block[0];
+ if(s->mb_intra) block[0]= level;
+ else block[0]= temp_block[0];
- if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM)
- {
+ 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[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[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];
+ 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[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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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)
- {
+ 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];
+ 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[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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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
- {
+ 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];
+ 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[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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
}
-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/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/rv40dsp_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/rv40dsp_mmx.c
index a73b103c6..9a702084a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/rv40dsp_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/rv40dsp_mmx.c
@@ -24,24 +24,15 @@
#include "dsputil_mmx.h"
/* bias interleaved with bias div 8, use p+1 to access bias div 8 */
-DECLARE_ALIGNED_8(static const uint64_t, rv40_bias_reg)[4][8] =
-{
- {
- 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0010001000100010ULL, 0x0002000200020002ULL,
- 0x0020002000200020ULL, 0x0004000400040004ULL, 0x0010001000100010ULL, 0x0002000200020002ULL
- },
- {
- 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL,
- 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL
- },
- {
- 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0020002000200020ULL, 0x0004000400040004ULL,
- 0x0010001000100010ULL, 0x0002000200020002ULL, 0x0020002000200020ULL, 0x0004000400040004ULL
- },
- {
- 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL,
- 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL
- }
+DECLARE_ALIGNED_8(static const uint64_t, rv40_bias_reg)[4][8] = {
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0010001000100010ULL, 0x0002000200020002ULL,
+ 0x0020002000200020ULL, 0x0004000400040004ULL, 0x0010001000100010ULL, 0x0002000200020002ULL },
+ { 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL,
+ 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL },
+ { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0020002000200020ULL, 0x0004000400040004ULL,
+ 0x0010001000100010ULL, 0x0002000200020002ULL, 0x0020002000200020ULL, 0x0004000400040004ULL },
+ { 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL,
+ 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL }
};
static void put_rv40_chroma_mc8_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vc1dsp_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vc1dsp_mmx.c
index d370def4e..bf96f2470 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vc1dsp_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vc1dsp_mmx.c
@@ -90,11 +90,11 @@ static void vc1_put_ver_16b_shift2_mmx(int16_t *dst,
"movd (%0), %%mm3 \n\t"
"punpcklbw %%mm0, %%mm2 \n\t"
"punpcklbw %%mm0, %%mm3 \n\t"
- SHIFT2_LINE(0, 1, 2, 3, 4)
- SHIFT2_LINE(24, 2, 3, 4, 1)
- SHIFT2_LINE(48, 3, 4, 1, 2)
- SHIFT2_LINE(72, 4, 1, 2, 3)
- SHIFT2_LINE(96, 1, 2, 3, 4)
+ SHIFT2_LINE( 0, 1, 2, 3, 4)
+ SHIFT2_LINE( 24, 2, 3, 4, 1)
+ SHIFT2_LINE( 48, 3, 4, 1, 2)
+ SHIFT2_LINE( 72, 4, 1, 2, 3)
+ SHIFT2_LINE( 96, 1, 2, 3, 4)
SHIFT2_LINE(120, 2, 3, 4, 1)
SHIFT2_LINE(144, 3, 4, 1, 2)
SHIFT2_LINE(168, 4, 1, 2, 3)
@@ -104,7 +104,7 @@ static void vc1_put_ver_16b_shift2_mmx(int16_t *dst,
"jnz 1b \n\t"
: "+r"(src), "+r"(dst)
: "r"(stride), "r"(-2*stride),
- "m"(shift), "m"(rnd), "r"(9*stride-4)
+ "m"(shift), "m"(rnd), "r"(9*stride-4)
: "%"REG_c, "memory"
);
}
@@ -393,15 +393,15 @@ OPNAME ## vc1_## NAME ## _mmx(uint8_t *dst, const uint8_t *src, \
}
/** 1/4 shift bicubic interpolation */
-MSPEL_FILTER13_8B(shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )", OP_PUT, put_)
-MSPEL_FILTER13_8B(shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )", OP_AVG, avg_)
+MSPEL_FILTER13_8B (shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )", OP_PUT, put_)
+MSPEL_FILTER13_8B (shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )", OP_AVG, avg_)
MSPEL_FILTER13_VER_16B(shift1, "0(%1,%4 )", "0(%1,%3,2)", "0(%1,%3 )", "0(%1 )")
MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)", OP_PUT, put_)
MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)", OP_AVG, avg_)
/** 3/4 shift bicubic interpolation */
-MSPEL_FILTER13_8B(shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )", OP_PUT, put_)
-MSPEL_FILTER13_8B(shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )", OP_AVG, avg_)
+MSPEL_FILTER13_8B (shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )", OP_PUT, put_)
+MSPEL_FILTER13_8B (shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )", OP_AVG, avg_)
MSPEL_FILTER13_VER_16B(shift3, "0(%1 )", "0(%1,%3 )", "0(%1,%3,2)", "0(%1,%4 )")
MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)", OP_PUT, put_)
MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)", OP_AVG, avg_)
@@ -526,9 +526,9 @@ static void vc1_inv_trans_4x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
"movd %%mm4, %2 \n\t"
"movd %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dest+0*linesize)),
- "+m"(*(uint32_t*)(dest+1*linesize)),
- "+m"(*(uint32_t*)(dest+2*linesize)),
- "+m"(*(uint32_t*)(dest+3*linesize))
+ "+m"(*(uint32_t*)(dest+1*linesize)),
+ "+m"(*(uint32_t*)(dest+2*linesize)),
+ "+m"(*(uint32_t*)(dest+3*linesize))
);
}
@@ -564,11 +564,11 @@ static void vc1_inv_trans_4x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
"movd %%mm4, %2 \n\t"
"movd %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dest+0*linesize)),
- "+m"(*(uint32_t*)(dest+1*linesize)),
- "+m"(*(uint32_t*)(dest+2*linesize)),
- "+m"(*(uint32_t*)(dest+3*linesize))
+ "+m"(*(uint32_t*)(dest+1*linesize)),
+ "+m"(*(uint32_t*)(dest+2*linesize)),
+ "+m"(*(uint32_t*)(dest+3*linesize))
);
- dest += 4 * linesize;
+ dest += 4*linesize;
__asm__ volatile(
"movd %0, %%mm2 \n\t"
"movd %1, %%mm3 \n\t"
@@ -587,16 +587,16 @@ static void vc1_inv_trans_4x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
"movd %%mm4, %2 \n\t"
"movd %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dest+0*linesize)),
- "+m"(*(uint32_t*)(dest+1*linesize)),
- "+m"(*(uint32_t*)(dest+2*linesize)),
- "+m"(*(uint32_t*)(dest+3*linesize))
+ "+m"(*(uint32_t*)(dest+1*linesize)),
+ "+m"(*(uint32_t*)(dest+2*linesize)),
+ "+m"(*(uint32_t*)(dest+3*linesize))
);
}
static void vc1_inv_trans_8x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
{
int dc = block[0];
- dc = (3 * dc + 1) >> 1;
+ dc = ( 3 * dc + 1) >> 1;
dc = (17 * dc + 64) >> 7;
__asm__ volatile(
"movd %0, %%mm0 \n\t"
@@ -625,9 +625,9 @@ static void vc1_inv_trans_8x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
"movq %%mm4, %2 \n\t"
"movq %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dest+0*linesize)),
- "+m"(*(uint32_t*)(dest+1*linesize)),
- "+m"(*(uint32_t*)(dest+2*linesize)),
- "+m"(*(uint32_t*)(dest+3*linesize))
+ "+m"(*(uint32_t*)(dest+1*linesize)),
+ "+m"(*(uint32_t*)(dest+2*linesize)),
+ "+m"(*(uint32_t*)(dest+3*linesize))
);
}
@@ -663,11 +663,11 @@ static void vc1_inv_trans_8x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
"movq %%mm4, %2 \n\t"
"movq %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dest+0*linesize)),
- "+m"(*(uint32_t*)(dest+1*linesize)),
- "+m"(*(uint32_t*)(dest+2*linesize)),
- "+m"(*(uint32_t*)(dest+3*linesize))
+ "+m"(*(uint32_t*)(dest+1*linesize)),
+ "+m"(*(uint32_t*)(dest+2*linesize)),
+ "+m"(*(uint32_t*)(dest+3*linesize))
);
- dest += 4 * linesize;
+ dest += 4*linesize;
__asm__ volatile(
"movq %0, %%mm2 \n\t"
"movq %1, %%mm3 \n\t"
@@ -686,14 +686,13 @@ static void vc1_inv_trans_8x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
"movq %%mm4, %2 \n\t"
"movq %%mm5, %3 \n\t"
:"+m"(*(uint32_t*)(dest+0*linesize)),
- "+m"(*(uint32_t*)(dest+1*linesize)),
- "+m"(*(uint32_t*)(dest+2*linesize)),
- "+m"(*(uint32_t*)(dest+3*linesize))
+ "+m"(*(uint32_t*)(dest+1*linesize)),
+ "+m"(*(uint32_t*)(dest+2*linesize)),
+ "+m"(*(uint32_t*)(dest+3*linesize))
);
}
-void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx)
-{
+void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) {
mm_flags = mm_support();
dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
@@ -716,8 +715,7 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx)
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 & FF_MM_MMX2)
- {
+ if (mm_flags & FF_MM_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;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_mmx.c
index 334249216..df0fcb9f1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_mmx.c
@@ -97,10 +97,10 @@ void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values)
"movq %%mm4, %1 \n\t"
"movq %%mm3, %2 \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))
+ : "+m" (*(uint64_t*)(src - 2*stride)),
+ "+m" (*(uint64_t*)(src - 1*stride)),
+ "+m" (*(uint64_t*)(src + 0*stride)),
+ "+m" (*(uint64_t*)(src + 1*stride))
: "m"(*(uint64_t*)(bounding_values+129))
);
}
@@ -115,16 +115,16 @@ void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values)
"movd -2(%1,%3,2), %%mm1 \n\t"
"movd -2(%1,%4), %%mm4 \n\t"
- TRANSPOSE8x4(%%mm6, %%mm0, %%mm1, %%mm4, -2(%2), -2(%2, %3), -2(%2, %3, 2), -2(%2, %4), %%mm2)
+ TRANSPOSE8x4(%%mm6, %%mm0, %%mm1, %%mm4, -2(%2), -2(%2,%3), -2(%2,%3,2), -2(%2,%4), %%mm2)
VP3_LOOP_FILTER(%5)
SBUTTERFLY(%%mm4, %%mm3, %%mm5, bw, q)
- STORE_4_WORDS((%1), (%1, %3), (%1, %3, 2), (%1, %4), %%mm4)
- STORE_4_WORDS((%2), (%2, %3), (%2, %3, 2), (%2, %4), %%mm5)
+ STORE_4_WORDS((%1), (%1,%3), (%1,%3,2), (%1,%4), %%mm4)
+ STORE_4_WORDS((%2), (%2,%3), (%2,%3,2), (%2,%4), %%mm5)
: "=&r"(tmp)
: "r"(src), "r"(src+4*stride), "r"((x86_reg)stride), "r"((x86_reg)3*stride),
- "m"(*(uint64_t*)(bounding_values+129))
+ "m"(*(uint64_t*)(bounding_values+129))
: "memory"
);
}
@@ -351,7 +351,7 @@ void ff_vp3_idct_mmx(int16_t *output_data)
#define I(x) AV_STRINGIFY(16* x )"(%0)"
#define J(x) AV_STRINGIFY(16*(x-4) + 8)"(%0)"
- __asm__ volatile(
+ __asm__ volatile (
RowIDCT()
Transpose()
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_sse2.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_sse2.c
index f5587b65e..e7745b372 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_sse2.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp3dsp_sse2.c
@@ -28,13 +28,13 @@
DECLARE_ALIGNED_16(const uint16_t, ff_vp3_idct_data)[7 * 8] =
{
- 64277, 64277, 64277, 64277, 64277, 64277, 64277, 64277,
- 60547, 60547, 60547, 60547, 60547, 60547, 60547, 60547,
- 54491, 54491, 54491, 54491, 54491, 54491, 54491, 54491,
- 46341, 46341, 46341, 46341, 46341, 46341, 46341, 46341,
- 36410, 36410, 36410, 36410, 36410, 36410, 36410, 36410,
- 25080, 25080, 25080, 25080, 25080, 25080, 25080, 25080,
- 12785, 12785, 12785, 12785, 12785, 12785, 12785, 12785
+ 64277,64277,64277,64277,64277,64277,64277,64277,
+ 60547,60547,60547,60547,60547,60547,60547,60547,
+ 54491,54491,54491,54491,54491,54491,54491,54491,
+ 46341,46341,46341,46341,46341,46341,46341,46341,
+ 36410,36410,36410,36410,36410,36410,36410,36410,
+ 25080,25080,25080,25080,25080,25080,25080,25080,
+ 12785,12785,12785,12785,12785,12785,12785,12785
};
@@ -161,7 +161,7 @@ void ff_vp3_idct_sse2(int16_t *input_data)
#define O(x) I(x)
#define C(x) AV_STRINGIFY(16*(x-1))"(%1)"
- __asm__ volatile(
+ __asm__ volatile (
VP3_1D_IDCT_SSE2(NOP, NOP)
TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%0))
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.c
index 6797e973f..39e40d568 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.c
@@ -73,36 +73,36 @@ void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride,
int i;
src -= stride;
- for(i = 0; i < 4 * 4; i++)
+ for (i=0; i<4*4; i++)
weights[i] = h_weights[i>>2];
__asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "movq "MANGLE(ff_pw_64)", %%mm6 \n\t"
- "1: \n\t"
- DIAG4_MMX(-1, 0, 1, 2)
- "add $8, %1 \n\t"
- "add %3, %0 \n\t"
- "decl %4 \n\t"
- "jnz 1b \n\t"
- : "+r"(src), "+r"(t)
- : "r"(weights), "r"((x86_reg)stride), "r"(11)
- : "memory");
+ "pxor %%mm7, %%mm7 \n\t"
+ "movq "MANGLE(ff_pw_64)", %%mm6 \n\t"
+ "1: \n\t"
+ DIAG4_MMX(-1,0,1,2)
+ "add $8, %1 \n\t"
+ "add %3, %0 \n\t"
+ "decl %4 \n\t"
+ "jnz 1b \n\t"
+ : "+r"(src), "+r"(t)
+ : "r"(weights), "r"((x86_reg)stride), "r"(11)
+ : "memory");
t = tmp + 8;
- for(i = 0; i < 4 * 4; i++)
+ for (i=0; i<4*4; i++)
weights[i] = v_weights[i>>2];
__asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "movq "MANGLE(ff_pw_64)", %%mm6 \n\t"
- "1: \n\t"
- DIAG4_MMX(-8, 0, 8, 16)
- "add $8, %0 \n\t"
- "add %3, %1 \n\t"
- "decl %4 \n\t"
- "jnz 1b \n\t"
- : "+r"(t), "+r"(dst)
- : "r"(weights), "r"((x86_reg)stride), "r"(8)
- : "memory");
+ "pxor %%mm7, %%mm7 \n\t"
+ "movq "MANGLE(ff_pw_64)", %%mm6 \n\t"
+ "1: \n\t"
+ DIAG4_MMX(-8,0,8,16)
+ "add $8, %0 \n\t"
+ "add %3, %1 \n\t"
+ "decl %4 \n\t"
+ "jnz 1b \n\t"
+ : "+r"(t), "+r"(dst)
+ : "r"(weights), "r"((x86_reg)stride), "r"(8)
+ : "memory");
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.h
index 50488b931..743bc4361 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_mmx.h
@@ -25,6 +25,6 @@
#include <stdint.h>
void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride,
- const int16_t *h_weights, const int16_t *v_weights);
+ const int16_t *h_weights,const int16_t *v_weights);
#endif /* AVCODEC_X86_VP6DSP_MMX_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.c
index ffde62108..c72a0cacb 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.c
@@ -46,53 +46,53 @@
"psraw $7, %%xmm0 \n\t" \
"packuswb %%xmm0, %%xmm0 \n\t" \
"movq %%xmm0, (%1) \n\t" \
-
+
void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
- const int16_t *h_weights, const int16_t *v_weights)
+ const int16_t *h_weights,const int16_t *v_weights)
{
uint8_t tmp[8*11], *t = tmp;
src -= stride;
__asm__ volatile(
- "pxor %%xmm7, %%xmm7 \n\t"
- "movq %4, %%xmm3 \n\t"
- "pshuflw $0, %%xmm3, %%xmm4 \n\t"
- "punpcklqdq %%xmm4, %%xmm4 \n\t"
- "pshuflw $85, %%xmm3, %%xmm5 \n\t"
- "punpcklqdq %%xmm5, %%xmm5 \n\t"
- "pshuflw $170, %%xmm3, %%xmm6 \n\t"
- "punpcklqdq %%xmm6, %%xmm6 \n\t"
- "pshuflw $255, %%xmm3, %%xmm3 \n\t"
- "punpcklqdq %%xmm3, %%xmm3 \n\t"
- "1: \n\t"
- DIAG4_SSE2(-1, 0, 1, 2)
- "add $8, %1 \n\t"
- "add %2, %0 \n\t"
- "decl %3 \n\t"
- "jnz 1b \n\t"
- : "+r"(src), "+r"(t)
- : "g"((x86_reg)stride), "r"(11), "m"(*(const int64_t*)h_weights)
- : "memory");
+ "pxor %%xmm7, %%xmm7 \n\t"
+ "movq %4, %%xmm3 \n\t"
+ "pshuflw $0, %%xmm3, %%xmm4 \n\t"
+ "punpcklqdq %%xmm4, %%xmm4 \n\t"
+ "pshuflw $85, %%xmm3, %%xmm5 \n\t"
+ "punpcklqdq %%xmm5, %%xmm5 \n\t"
+ "pshuflw $170, %%xmm3, %%xmm6 \n\t"
+ "punpcklqdq %%xmm6, %%xmm6 \n\t"
+ "pshuflw $255, %%xmm3, %%xmm3 \n\t"
+ "punpcklqdq %%xmm3, %%xmm3 \n\t"
+ "1: \n\t"
+ DIAG4_SSE2(-1,0,1,2)
+ "add $8, %1 \n\t"
+ "add %2, %0 \n\t"
+ "decl %3 \n\t"
+ "jnz 1b \n\t"
+ : "+r"(src), "+r"(t)
+ : "g"((x86_reg)stride), "r"(11), "m"(*(const int64_t*)h_weights)
+ : "memory");
t = tmp + 8;
__asm__ volatile(
- "movq %4, %%xmm3 \n\t"
- "pshuflw $0, %%xmm3, %%xmm4 \n\t"
- "punpcklqdq %%xmm4, %%xmm4 \n\t"
- "pshuflw $85, %%xmm3, %%xmm5 \n\t"
- "punpcklqdq %%xmm5, %%xmm5 \n\t"
- "pshuflw $170, %%xmm3, %%xmm6 \n\t"
- "punpcklqdq %%xmm6, %%xmm6 \n\t"
- "pshuflw $255, %%xmm3, %%xmm3 \n\t"
- "punpcklqdq %%xmm3, %%xmm3 \n\t"
- "1: \n\t"
- DIAG4_SSE2(-8, 0, 8, 16)
- "add $8, %0 \n\t"
- "add %2, %1 \n\t"
- "decl %3 \n\t"
- "jnz 1b \n\t"
- : "+r"(t), "+r"(dst)
- : "g"((x86_reg)stride), "r"(8), "m"(*(const int64_t*)v_weights)
- : "memory");
+ "movq %4, %%xmm3 \n\t"
+ "pshuflw $0, %%xmm3, %%xmm4 \n\t"
+ "punpcklqdq %%xmm4, %%xmm4 \n\t"
+ "pshuflw $85, %%xmm3, %%xmm5 \n\t"
+ "punpcklqdq %%xmm5, %%xmm5 \n\t"
+ "pshuflw $170, %%xmm3, %%xmm6 \n\t"
+ "punpcklqdq %%xmm6, %%xmm6 \n\t"
+ "pshuflw $255, %%xmm3, %%xmm3 \n\t"
+ "punpcklqdq %%xmm3, %%xmm3 \n\t"
+ "1: \n\t"
+ DIAG4_SSE2(-8,0,8,16)
+ "add $8, %0 \n\t"
+ "add %2, %1 \n\t"
+ "decl %3 \n\t"
+ "jnz 1b \n\t"
+ : "+r"(t), "+r"(dst)
+ : "g"((x86_reg)stride), "r"(8), "m"(*(const int64_t*)v_weights)
+ : "memory");
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.h
index 96b71c800..a30089a3e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/vp6dsp_sse2.h
@@ -25,6 +25,6 @@
#include <stdint.h>
void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
- const int16_t *h_weights, const int16_t *v_weights);
+ const int16_t *h_weights,const int16_t *v_weights);
#endif /* AVCODEC_X86_VP6DSP_SSE2_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/xiph.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/xiph.c
index 133540878..2f4f25c92 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/xiph.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/xiph.c
@@ -27,44 +27,36 @@ int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,
{
int i;
- if(extradata_size >= 6 && AV_RB16(extradata) == first_header_size)
- {
+ if (extradata_size >= 6 && AV_RB16(extradata) == first_header_size) {
int overall_len = 6;
- for(i = 0; i < 3; i++)
- {
+ for (i=0; i<3; i++) {
header_len[i] = AV_RB16(extradata);
extradata += 2;
header_start[i] = extradata;
extradata += header_len[i];
- if(overall_len > extradata_size - header_len[i])
+ if (overall_len > extradata_size - header_len[i])
return -1;
overall_len += header_len[i];
}
- }
- else if(extradata_size >= 3 && extradata_size < INT_MAX - 0x1ff && extradata[0] == 2)
- {
+ } else if (extradata_size >= 3 && extradata_size < INT_MAX - 0x1ff && extradata[0] == 2) {
int overall_len = 3;
extradata++;
- for(i = 0; i < 2; i++, extradata++)
- {
+ for (i=0; i<2; i++, extradata++) {
header_len[i] = 0;
- for(; overall_len < extradata_size && *extradata == 0xff; extradata++)
- {
+ for (; overall_len < extradata_size && *extradata==0xff; extradata++) {
header_len[i] += 0xff;
overall_len += 0xff + 1;
}
header_len[i] += *extradata;
overall_len += *extradata;
- if(overall_len > extradata_size)
+ if (overall_len > extradata_size)
return -1;
}
header_len[2] = extradata_size - overall_len;
header_start[0] = extradata;
header_start[1] = header_start[0] + header_len[0];
header_start[2] = header_start[1] + header_len[1];
- }
- else
- {
+ } else {
return -1;
}
return 0;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h
index 981a5ec46..54c682678 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h
@@ -37,7 +37,7 @@
#ifndef bswap_16
static av_always_inline av_const uint16_t bswap_16(uint16_t x)
{
- x = (x >> 8) | (x << 8);
+ x= (x>>8) | (x<<8);
return x;
}
#endif
@@ -45,8 +45,8 @@ static av_always_inline av_const uint16_t bswap_16(uint16_t x)
#ifndef bswap_32
static av_always_inline av_const uint32_t bswap_32(uint32_t x)
{
- x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF);
- x = (x >> 16) | (x << 16);
+ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
+ x= (x>>16) | (x<<16);
return x;
}
#endif
@@ -55,18 +55,17 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
static inline uint64_t av_const bswap_64(uint64_t x)
{
#if 0
- x = ((x << 8) & 0xFF00FF00FF00FF00ULL) | ((x >> 8) & 0x00FF00FF00FF00FFULL);
- x = ((x << 16) & 0xFFFF0000FFFF0000ULL) | ((x >> 16) & 0x0000FFFF0000FFFFULL);
- return (x >> 32) | (x << 32);
+ x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
+ x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);
+ return (x>>32) | (x<<32);
#else
- union
- {
+ union {
uint64_t ll;
uint32_t l[2];
} w, r;
w.ll = x;
- r.l[0] = bswap_32(w.l[1]);
- r.l[1] = bswap_32(w.l[0]);
+ r.l[0] = bswap_32 (w.l[1]);
+ r.l[1] = bswap_32 (w.l[0]);
return r.ll;
#endif
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h
index 440651dd1..7b16d915d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h
@@ -152,13 +152,11 @@ extern const uint8_t av_reverse[256];
static inline av_const int av_log2(unsigned int v)
{
int n = 0;
- if(v & 0xffff0000)
- {
+ if (v & 0xffff0000) {
v >>= 16;
n += 16;
}
- if(v & 0xff00)
- {
+ if (v & 0xff00) {
v >>= 8;
n += 8;
}
@@ -172,8 +170,7 @@ static inline av_const int av_log2(unsigned int v)
static inline av_const int av_log2_16bit(unsigned int v)
{
int n = 0;
- if(v & 0xff00)
- {
+ if (v & 0xff00) {
v >>= 8;
n += 8;
}
@@ -192,8 +189,8 @@ static inline av_const int av_log2_16bit(unsigned int v)
*/
static inline av_const int av_clip(int a, int amin, int amax)
{
- if(a < amin) return amin;
- else if(a > amax) return amax;
+ if (a < amin) return amin;
+ else if (a > amax) return amax;
else return a;
}
@@ -204,7 +201,7 @@ static inline av_const int av_clip(int a, int amin, int amax)
*/
static inline av_const uint8_t av_clip_uint8(int a)
{
- if(a&(~255)) return (-a) >> 31;
+ if (a&(~255)) return (-a)>>31;
else return a;
}
@@ -215,7 +212,7 @@ static inline av_const uint8_t av_clip_uint8(int a)
*/
static inline av_const uint16_t av_clip_uint16(int a)
{
- if(a&(~65535)) return (-a) >> 31;
+ if (a&(~65535)) return (-a)>>31;
else return a;
}
@@ -226,7 +223,7 @@ static inline av_const uint16_t av_clip_uint16(int a)
*/
static inline av_const int16_t av_clip_int16(int a)
{
- if((a + 32768) & ~65535) return (a >> 31) ^ 32767;
+ if ((a+32768) & ~65535) return (a>>31) ^ 32767;
else return a;
}
@@ -239,8 +236,8 @@ static inline av_const int16_t av_clip_int16(int a)
*/
static inline av_const float av_clipf(float a, float amin, float amax)
{
- if(a < amin) return amin;
- else if(a > amax) return amax;
+ if (a < amin) return amin;
+ else if (a > amax) return amax;
else return a;
}
@@ -307,7 +304,7 @@ static inline av_const int av_ceil_log2(int x)
val += (hi<<10) + 0x10000;\
}\
}\
-
+
/*!
* \def PUT_UTF8(val, tmp, PUT_BYTE)
* Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.c
index 463815ed7..35ac73c35 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.c
@@ -25,26 +25,24 @@
#if CONFIG_HARDCODED_TABLES
#include "crc_data.h"
#else
-static struct
-{
+static struct {
uint8_t le;
uint8_t bits;
uint32_t poly;
-} av_crc_table_params[AV_CRC_MAX] =
-{
-#ifdef __GNUC__
+} av_crc_table_params[AV_CRC_MAX] = {
+ #ifdef __GNUC__
[AV_CRC_8_ATM] = { 0, 8, 0x07 },
[AV_CRC_16_ANSI] = { 0, 16, 0x8005 },
[AV_CRC_16_CCITT] = { 0, 16, 0x1021 },
[AV_CRC_32_IEEE] = { 0, 32, 0x04C11DB7 },
[AV_CRC_32_IEEE_LE] = { 1, 32, 0xEDB88320 },
-#else
-{ 0, 8, 0x07 },
-{ 0, 16, 0x8005 },
-{ 0, 16, 0x1021 },
-{ 0, 32, 0x04C11DB7 },
-{ 1, 32, 0xEDB88320 },
-#endif
+ #else
+ { 0, 8, 0x07 },
+ { 0, 16, 0x8005 },
+ { 0, 16, 0x1021 },
+ { 0, 32, 0x04C11DB7 },
+ { 1, 32, 0xEDB88320 },
+ #endif
};
static AVCRC av_crc_table[AV_CRC_MAX][257];
#endif
@@ -65,37 +63,32 @@ static AVCRC av_crc_table[AV_CRC_MAX][257];
* representation as specified by le
* @return <0 on failure
*/
-int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
-{
+int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
int i, j;
uint32_t c;
- if(bits < 8 || bits > 32 || poly >= (1LL << bits))
+ if (bits < 8 || bits > 32 || poly >= (1LL<<bits))
return -1;
- if(ctx_size != sizeof(AVCRC) * 257 && ctx_size != sizeof(AVCRC) * 1024)
+ if (ctx_size != sizeof(AVCRC)*257 && ctx_size != sizeof(AVCRC)*1024)
return -1;
- for(i = 0; i < 256; i++)
- {
- if(le)
- {
- for(c = i, j = 0; j < 8; j++)
- c = (c >> 1) ^(poly & (-(c & 1)));
+ for (i = 0; i < 256; i++) {
+ if (le) {
+ for (c = i, j = 0; j < 8; j++)
+ c = (c>>1)^(poly & (-(c&1)));
ctx[i] = c;
- }
- else
- {
- for(c = i << 24, j = 0; j < 8; j++)
- c = (c << 1) ^((poly << (32 - bits)) & (((int32_t)c) >> 31));
+ } else {
+ for (c = i << 24, j = 0; j < 8; j++)
+ c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) );
ctx[i] = bswap_32(c);
}
}
- ctx[256] = 1;
+ ctx[256]=1;
#if !CONFIG_SMALL
- if(ctx_size >= sizeof(AVCRC) * 1024)
- for(i = 0; i < 256; i++)
- for(j = 0; j < 3; j++)
- ctx[256*(j+1) + i] = (ctx[256*j + i] >> 8) ^ ctx[ ctx[256*j + i] & 0xFF ];
+ if(ctx_size >= sizeof(AVCRC)*1024)
+ for (i = 0; i < 256; i++)
+ for(j=0; j<3; j++)
+ ctx[256*(j+1) + i]= (ctx[256*j + i]>>8) ^ ctx[ ctx[256*j + i]&0xFF ];
#endif
return 0;
@@ -106,15 +99,14 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
* @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)
-{
+const AVCRC *av_crc_get_table(AVCRCId crc_id){
#if !CONFIG_HARDCODED_TABLES
- if(!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id]) - 1])
- if(av_crc_init(av_crc_table[crc_id],
- av_crc_table_params[crc_id].le,
- av_crc_table_params[crc_id].bits,
- av_crc_table_params[crc_id].poly,
- sizeof(av_crc_table[crc_id])) < 0)
+ if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id])-1])
+ if (av_crc_init(av_crc_table[crc_id],
+ av_crc_table_params[crc_id].le,
+ av_crc_table_params[crc_id].bits,
+ av_crc_table_params[crc_id].poly,
+ sizeof(av_crc_table[crc_id])) < 0)
return NULL;
#endif
return av_crc_table[crc_id];
@@ -127,29 +119,25 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id)
*
* @see av_crc_init() "le" parameter
*/
-uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
-{
- const uint8_t *end = buffer + length;
+uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){
+ const uint8_t *end= buffer+length;
#if !CONFIG_SMALL
- if(!ctx[256])
- {
+ if(!ctx[256]) {
while(((intptr_t) buffer & 3) && buffer < end)
- crc = ctx[((uint8_t)crc) ^ *buffer++] ^(crc >> 8);
+ crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
- while(buffer < end - 3)
- {
- crc ^= le2me_32(*(const uint32_t*)buffer);
- buffer += 4;
- crc = ctx[3*256 + (crc &0xFF)]
- ^ ctx[2*256 + ((crc>>8)&0xFF)]
- ^ ctx[1*256 + ((crc>>16)&0xFF)]
- ^ ctx[0*256 + ((crc>>24))];
+ while(buffer<end-3){
+ crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4;
+ crc = ctx[3*256 + ( crc &0xFF)]
+ ^ctx[2*256 + ((crc>>8 )&0xFF)]
+ ^ctx[1*256 + ((crc>>16)&0xFF)]
+ ^ctx[0*256 + ((crc>>24) )];
}
}
#endif
- while(buffer < end)
- crc = ctx[((uint8_t)crc) ^ *buffer++] ^(crc >> 8);
+ while(buffer<end)
+ crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
return crc;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.h
index 175da0062..5e5c663b1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc.h
@@ -27,15 +27,14 @@
typedef uint32_t AVCRC;
-typedef enum
-{
+typedef enum {
AV_CRC_8_ATM,
AV_CRC_16_ANSI,
AV_CRC_16_CCITT,
AV_CRC_32_IEEE,
AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
-} AVCRCId;
+}AVCRCId;
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
const AVCRC *av_crc_get_table(AVCRCId crc_id);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc_data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc_data.h
index 25fd868da..afa25e7cf 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc_data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/crc_data.h
@@ -23,8 +23,7 @@
#include "crc.h"
-static const AVCRC av_crc_table[AV_CRC_MAX][257] =
-{
+static const AVCRC av_crc_table[AV_CRC_MAX][257] = {
[AV_CRC_8_ATM] = {
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31,
0x24, 0x23, 0x2A, 0x2D, 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/internal.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/internal.h
index ae8dc0516..732ca66b4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/internal.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/internal.h
@@ -100,8 +100,8 @@
#endif
#ifdef _MSC_VER
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
+ #define snprintf _snprintf
+ #define vsnprintf _vsnprintf
#endif
#if defined(__MINGW32__) || defined(__CYGWIN__)
@@ -150,18 +150,17 @@ 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 (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] ;
+ 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
- {
+ 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);
+ b = FASTDIV(c,b) + (b << s);
}
return b - (a < b * b);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/intreadwrite.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/intreadwrite.h
index 6cedf19d2..0a36981c5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/intreadwrite.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/intreadwrite.h
@@ -147,18 +147,9 @@
#if HAVE_ATTRIBUTE_PACKED
-struct unaligned_64
-{
- uint64_t l;
-} __attribute__((packed));
-struct unaligned_32
-{
- uint32_t l;
-} __attribute__((packed));
-struct unaligned_16
-{
- uint16_t l;
-} __attribute__((packed));
+struct unaligned_64 { uint64_t l; } __attribute__((packed));
+struct unaligned_32 { uint32_t l; } __attribute__((packed));
+struct unaligned_16 { uint16_t l; } __attribute__((packed));
# define AV_RN(s, p) (((const struct unaligned_##s *) (p))->l)
# define AV_WN(s, p, v) ((((struct unaligned_##s *) (p))->l) = (v))
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.c
index 3a5f9bf4f..1382f0214 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.c
@@ -24,22 +24,19 @@
#include "md5.h"
#include "intreadwrite.h"
-void av_cold av_lfg_init(AVLFG *c, unsigned int seed)
-{
- uint8_t tmp[16] = {0};
+void av_cold av_lfg_init(AVLFG *c, unsigned int seed){
+ uint8_t tmp[16]={0};
int i;
- for(i = 8; i < 64; i += 4)
- {
- AV_WL32(tmp, seed);
- tmp[4] = i;
+ for(i=8; i<64; i+=4){
+ AV_WL32(tmp, seed); tmp[4]=i;
av_md5_sum(tmp, tmp, 16);
- c->state[i ] = AV_RL32(tmp);
- c->state[i+1] = AV_RL32(tmp + 4);
- c->state[i+2] = AV_RL32(tmp + 8);
- c->state[i+3] = AV_RL32(tmp + 12);
+ c->state[i ]= AV_RL32(tmp);
+ c->state[i+1]= AV_RL32(tmp+4);
+ c->state[i+2]= AV_RL32(tmp+8);
+ c->state[i+3]= AV_RL32(tmp+12);
}
- c->index = 0;
+ c->index=0;
}
#ifdef TEST
@@ -48,18 +45,16 @@ void av_cold av_lfg_init(AVLFG *c, unsigned int seed)
int main(void)
{
- int x = 0;
+ int x=0;
int i, j;
AVLFG state;
av_lfg_init(&state, 0xdeadbeef);
- for(j = 0; j < 10000; j++)
- {
+ for (j = 0; j < 10000; j++) {
START_TIMER
- for(i = 0; i < 624; i++)
- {
+ for (i = 0; i < 624; i++) {
// av_log(NULL,AV_LOG_ERROR, "%X\n", av_lfg_get(&state));
- x += av_lfg_get(&state);
+ x+=av_lfg_get(&state);
}
STOP_TIMER("624 calls of av_lfg_get");
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.h
index 058f7aa15..939e160ab 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lfg.h
@@ -26,8 +26,7 @@
#include "libavutil/common.h"
#endif
-typedef struct
-{
+typedef struct {
unsigned int state[64];
int index;
} AVLFG;
@@ -40,8 +39,7 @@ void av_lfg_init(AVLFG *c, unsigned int seed);
* Please also consider a simple LCG like state= state*1664525+1013904223,
* it may be good enough and faster for your specific use case.
*/
-static inline unsigned int av_lfg_get(AVLFG *c)
-{
+static inline unsigned int av_lfg_get(AVLFG *c){
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
return c->state[c->index++ & 63];
}
@@ -51,11 +49,10 @@ static inline unsigned int av_lfg_get(AVLFG *c)
*
* Please also consider av_lfg_get() above, it is faster.
*/
-static inline unsigned int av_mlfg_get(AVLFG *c)
-{
- unsigned int a = c->state[(c->index-55) & 63];
- unsigned int b = c->state[(c->index-24) & 63];
- return c->state[c->index++ & 63] = 2 * a * b + a + b;
+static inline unsigned int av_mlfg_get(AVLFG *c){
+ unsigned int a= c->state[(c->index-55) & 63];
+ unsigned int b= c->state[(c->index-24) & 63];
+ return c->state[c->index++ & 63] = 2*a*b+a+b;
}
#endif /* AVUTIL_LFG_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.c
index 163c1ffe8..047f976c3 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.c
@@ -30,90 +30,76 @@
#include "lls.h"
-void av_init_lls(LLSModel *m, int indep_count)
-{
+void av_init_lls(LLSModel *m, int indep_count){
memset(m, 0, sizeof(LLSModel));
- m->indep_count = indep_count;
+ m->indep_count= indep_count;
}
-void av_update_lls(LLSModel *m, double *var, double decay)
-{
- int i, j;
+void av_update_lls(LLSModel *m, double *var, double decay){
+ int i,j;
- for(i = 0; i <= m->indep_count; i++)
- {
- for(j = i; j <= m->indep_count; j++)
- {
+ for(i=0; i<=m->indep_count; i++){
+ for(j=i; j<=m->indep_count; j++){
m->covariance[i][j] *= decay;
- m->covariance[i][j] += var[i] * var[j];
+ m->covariance[i][j] += var[i]*var[j];
}
}
}
-void av_solve_lls(LLSModel *m, double threshold, int min_order)
-{
- int i, j, k;
- double(*factor)[MAX_VARS+1] = (void*)&m->covariance[1][0];
- double(*covar)[MAX_VARS+1] = (void*)&m->covariance[1][1];
+void av_solve_lls(LLSModel *m, double threshold, int min_order){
+ int i,j,k;
+ double (*factor)[MAX_VARS+1]= (void*)&m->covariance[1][0];
+ double (*covar )[MAX_VARS+1]= (void*)&m->covariance[1][1];
double *covar_y = m->covariance[0];
- int count = m->indep_count;
+ int count= m->indep_count;
- for(i = 0; i < count; i++)
- {
- for(j = i; j < count; j++)
- {
- double sum = covar[i][j];
+ for(i=0; i<count; i++){
+ for(j=i; j<count; j++){
+ double sum= covar[i][j];
- for(k = i - 1; k >= 0; k--)
- sum -= factor[i][k] * factor[j][k];
+ for(k=i-1; k>=0; k--)
+ sum -= factor[i][k]*factor[j][k];
- if(i == j)
- {
+ if(i==j){
if(sum < threshold)
- sum = 1.0;
- factor[i][i] = sqrt(sum);
- }
- else
- factor[j][i] = sum / factor[i][i];
+ sum= 1.0;
+ factor[i][i]= sqrt(sum);
+ }else
+ factor[j][i]= sum / factor[i][i];
}
}
- for(i = 0; i < count; i++)
- {
- double sum = covar_y[i+1];
- for(k = i - 1; k >= 0; k--)
- sum -= factor[i][k] * m->coeff[0][k];
- m->coeff[0][i] = sum / factor[i][i];
+ for(i=0; i<count; i++){
+ double sum= covar_y[i+1];
+ for(k=i-1; k>=0; k--)
+ sum -= factor[i][k]*m->coeff[0][k];
+ m->coeff[0][i]= sum / factor[i][i];
}
- for(j = count - 1; j >= min_order; j--)
- {
- for(i = j; i >= 0; i--)
- {
- double sum = m->coeff[0][i];
- for(k = i + 1; k <= j; k++)
- sum -= factor[k][i] * m->coeff[j][k];
- m->coeff[j][i] = sum / factor[i][i];
+ for(j=count-1; j>=min_order; j--){
+ for(i=j; i>=0; i--){
+ double sum= m->coeff[0][i];
+ for(k=i+1; k<=j; k++)
+ sum -= factor[k][i]*m->coeff[j][k];
+ m->coeff[j][i]= sum / factor[i][i];
}
- m->variance[j] = covar_y[0];
- for(i = 0; i <= j; i++)
- {
- double sum = m->coeff[j][i] * covar[i][i] - 2 * covar_y[i+1];
- for(k = 0; k < i; k++)
- sum += 2 * m->coeff[j][k] * covar[k][i];
- m->variance[j] += m->coeff[j][i] * sum;
+ m->variance[j]= covar_y[0];
+ for(i=0; i<=j; i++){
+ double sum= m->coeff[j][i]*covar[i][i] - 2*covar_y[i+1];
+ for(k=0; k<i; k++)
+ sum += 2*m->coeff[j][k]*covar[k][i];
+ m->variance[j] += m->coeff[j][i]*sum;
}
}
}
-double av_evaluate_lls(LLSModel *m, double *param, int order)
-{
+double av_evaluate_lls(LLSModel *m, double *param, int order){
int i;
- double out = 0;
+ double out= 0;
- for(i = 0; i <= order; i++)
- out += param[i] * m->coeff[order][i];
+ for(i=0; i<=order; i++)
+ out+= param[i]*m->coeff[order][i];
return out;
}
@@ -123,29 +109,26 @@ double av_evaluate_lls(LLSModel *m, double *param, int order)
#include <stdlib.h>
#include <stdio.h>
-int main(void)
-{
+int main(void){
LLSModel m;
int i, order;
av_init_lls(&m, 3);
- for(i = 0; i < 100; i++)
- {
+ for(i=0; i<100; i++){
double var[4];
double eval;
- var[0] = (rand() / (double)RAND_MAX - 0.5) * 2;
+ var[0] = (rand() / (double)RAND_MAX - 0.5)*2;
var[1] = var[0] + rand() / (double)RAND_MAX - 0.5;
var[2] = var[1] + rand() / (double)RAND_MAX - 0.5;
var[3] = var[2] + rand() / (double)RAND_MAX - 0.5;
av_update_lls(&m, var, 0.99);
av_solve_lls(&m, 0.001, 0);
- for(order = 0; order < 3; order++)
- {
- eval = av_evaluate_lls(&m, var + 1, order);
+ for(order=0; order<3; order++){
+ eval= av_evaluate_lls(&m, var+1, order);
printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
- var[0], order, eval, sqrt(m.variance[order] / (i + 1)),
- m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
+ var[0], order, eval, sqrt(m.variance[order] / (i+1)),
+ m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
}
}
return 0;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.h
index 07e6ecc9a..d168e5974 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lls.h
@@ -30,13 +30,12 @@
/**
* Linear least squares model.
*/
-typedef struct LLSModel
-{
+typedef struct LLSModel{
double covariance[MAX_VARS+1][MAX_VARS+1];
double coeff[MAX_VARS][MAX_VARS];
double variance[MAX_VARS];
int indep_count;
-} LLSModel;
+}LLSModel;
void av_init_lls(LLSModel *m, int indep_count);
void av_update_lls(LLSModel *m, double *param, double decay);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.c
index bcc3f14e4..7d9ec0908 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.c
@@ -34,32 +34,28 @@ int av_log_level = AV_LOG_INFO;
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
{
- static int print_prefix = 1;
+ static int print_prefix=1;
static int count;
static char line[1024], prev[1024];
- AVClass* avc = ptr ? *(AVClass**)ptr : NULL;
- if(level > av_log_level)
+ AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
+ if(level>av_log_level)
return;
#undef fprintf
- if(print_prefix && avc)
- {
+ if(print_prefix && avc) {
snprintf(line, sizeof(line), "[%s @ %p]", avc->item_name(ptr), ptr);
- }
- else
- line[0] = 0;
+ }else
+ line[0]=0;
vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
- print_prefix = line[strlen(line)-1] == '\n';
- if(print_prefix && !strcmp(line, prev))
- {
+ print_prefix= line[strlen(line)-1] == '\n';
+ if(print_prefix && !strcmp(line, prev)){
count++;
return;
}
- if(count > 0)
- {
+ if(count>0){
fprintf(stderr, " Last message repeated %d times\n", count);
- count = 0;
+ count=0;
}
fputs(line, stderr);
strcpy(prev, line);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h
index 734d0e25d..720264ef0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h
@@ -30,8 +30,7 @@
* AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
*/
typedef struct AVCLASS AVClass;
-struct AVCLASS
-{
+struct AVCLASS {
/**
* The name of the class; usually it is the same name as the
* context structure type to which the AVClass is associated.
@@ -42,7 +41,7 @@ struct AVCLASS
* A pointer to a function which returns the name of a context
* instance ctx associated with the class.
*/
- const char*(*item_name)(void* ctx);
+ const char* (*item_name)(void* ctx);
/**
* a pointer to the first option specified in the class if any or NULL
@@ -103,7 +102,7 @@ struct AVCLASS
* @see av_vlog
*/
#ifdef __GNUC__
-void av_log(void*, int level, const char *fmt, ...) __attribute__((__format__(__printf__, 3, 4)));
+void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
#else
void av_log(void*, int level, const char *fmt, ...);
#endif
@@ -114,11 +113,11 @@ extern "C" {
#endif
// <== End patch MPC
- void av_vlog(void*, int level, const char *fmt, va_list);
- int av_log_get_level(void);
- void av_log_set_level(int);
- void av_log_set_callback(void (*)(void*, int, const char*, va_list));
- void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
+void av_vlog(void*, int level, const char *fmt, va_list);
+int av_log_get_level(void);
+void av_log_set_level(int);
+void av_log_set_callback(void (*)(void*, int, const char*, va_list));
+void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
// ==> Start patch MPC
#ifdef __cplusplus
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lzo.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lzo.c
index d8350ac36..3464f392a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lzo.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/lzo.c
@@ -30,8 +30,7 @@
#define OUTBUF_PADDED 1
//! Define if we may read up to 8 bytes beyond the input buffer.
#define INBUF_PADDED 1
-typedef struct LZOContext
-{
+typedef struct LZOContext {
const uint8_t *in, *in_end;
uint8_t *out_start, *out, *out_end;
int error;
@@ -41,9 +40,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)
-{
- if(c->in < c->in_end)
+static inline int get_byte(LZOContext *c) {
+ if (c->in < c->in_end)
return *c->in++;
c->error |= AV_LZO_INPUT_DEPLETED;
return 1;
@@ -61,12 +59,10 @@ 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;
+ if (!cnt) {
+ while (!(x = get_byte(c))) cnt += 255;
cnt += mask + x;
}
return cnt;
@@ -89,17 +85,14 @@ static inline int get_len(LZOContext *c, int x, int mask)
* \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;
- if(cnt > c->in_end - src)
- {
+ if (cnt > c->in_end - src) {
cnt = FFMAX(c->in_end - src, 0);
c->error |= AV_LZO_INPUT_DEPLETED;
}
- if(cnt > c->out_end - dst)
- {
+ if (cnt > c->out_end - dst) {
cnt = FFMAX(c->out_end - dst, 0);
c->error |= AV_LZO_OUTPUT_FULL;
}
@@ -108,7 +101,7 @@ static inline void copy(LZOContext *c, int cnt)
src += 4;
dst += 4;
cnt -= 4;
- if(cnt > 0)
+ if (cnt > 0)
#endif
memcpy(dst, src, cnt);
c->in = src + cnt;
@@ -125,17 +118,14 @@ 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)
-{
+static inline void copy_backptr(LZOContext *c, int back, int cnt) {
register const uint8_t *src = &c->out[-back];
register uint8_t *dst = c->out;
- if(src < c->out_start || src > dst)
- {
+ if (src < c->out_start || src > dst) {
c->error |= AV_LZO_INVALID_BACKPTR;
return;
}
- if(cnt > c->out_end - dst)
- {
+ if (cnt > c->out_end - dst) {
cnt = FFMAX(c->out_end - dst, 0);
c->error |= AV_LZO_OUTPUT_FULL;
}
@@ -143,23 +133,18 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt)
c->out = dst + cnt;
}
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
-{
+static inline void memcpy_backptr(uint8_t *dst, int back, int cnt) {
const uint8_t *src = &dst[-back];
- if(back == 1)
- {
+ if (back == 1) {
memset(dst, *src, cnt);
- }
- else
- {
+ } else {
#ifdef OUTBUF_PADDED
COPY2(dst, src);
COPY2(dst + 2, src + 2);
src += 4;
dst += 4;
cnt -= 4;
- if(cnt > 0)
- {
+ if (cnt > 0) {
COPY2(dst, src);
COPY2(dst + 2, src + 2);
COPY2(dst + 4, src + 4);
@@ -169,11 +154,9 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
cnt -= 8;
}
#endif
- if(cnt > 0)
- {
+ if (cnt > 0) {
int blocklen = back;
- while(cnt > blocklen)
- {
+ while (cnt > blocklen) {
memcpy(dst, src, blocklen);
dst += blocklen;
cnt -= blocklen;
@@ -184,14 +167,12 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
}
}
-void av_memcpy_backptr(uint8_t *dst, int back, int 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;
c.in = in;
@@ -200,67 +181,54 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
c.out_end = (uint8_t *)out + * outlen;
c.error = 0;
x = GETB(c);
- if(x > 17)
- {
+ 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)
+ if (c.in > c.in_end)
c.error |= AV_LZO_INPUT_DEPLETED;
- while(!c.error)
- {
+ while (!c.error) {
int cnt, back;
- if(x > 15)
- {
- if(x > 63)
- {
+ if (x > 15) {
+ if (x > 63) {
cnt = (x >> 5) - 1;
back = (GETB(c) << 3) + ((x >> 2) & 7) + 1;
- }
- else if(x > 31)
- {
+ } else if (x > 31) {
cnt = get_len(&c, x, 31);
x = GETB(c);
back = (GETB(c) << 6) + (x >> 2) + 1;
- }
- else
- {
+ } else {
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)
+ if (back == (1 << 14)) {
+ if (cnt != 1)
c.error |= AV_LZO_ERROR;
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
- {
- cnt = 0;
- back = (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;
}
copy_backptr(&c, back, cnt + 2);
- state =
- cnt = x & 3;
+ state=
+ cnt = x & 3;
copy(&c, cnt);
x = GETB(c);
}
*inlen = c.in_end - c.in;
- if(c.in > c.in_end)
+ if (c.in > c.in_end)
*inlen = 0;
*outlen = c.out_end - c.out;
return c.error;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.c
index dd4ff4746..97aa1cb4c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.c
@@ -28,52 +28,48 @@
#include "common.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_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
+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
};
-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,
- 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,
+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,
+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,
};
-int64_t av_gcd(int64_t a, int64_t b)
-{
- if(b) return av_gcd(b, a % b);
+int64_t av_gcd(int64_t a, int64_t b){
+ if(b) return av_gcd(b, a%b);
else return a;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.h
index a4b5b2c9c..b1dc6a67f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mathematics.h
@@ -42,18 +42,17 @@
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#endif
#ifndef NAN
-#if __STDC_VERSION__ >= 199901L
-#define NAN 0.0/0.0
-#else
-#define NAN -1234567891234
-#endif
+ #if __STDC_VERSION__ >= 199901L
+ #define NAN 0.0/0.0
+ #else
+ #define NAN -1234567891234
+ #endif
#endif
#ifndef INFINITY
#define INFINITY (1.0/0.0)
#endif
-enum AVRounding
-{
+enum AVRounding {
AV_ROUND_ZERO = 0, ///< Round toward zero.
AV_ROUND_INF = 1, ///< Round away from zero.
AV_ROUND_DOWN = 2, ///< Round toward -infinity.
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/md5.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/md5.c
index c2fb526a1..37236eadd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/md5.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/md5.c
@@ -34,25 +34,22 @@
#include "bswap.h"
#include "md5.h"
-typedef struct AVMD5
-{
+typedef struct AVMD5{
uint64_t len;
uint8_t block[64];
uint32_t ABCD[4];
} AVMD5;
-const int av_md5_size = sizeof(AVMD5);
+const int av_md5_size= sizeof(AVMD5);
-static const uint8_t S[4][4] =
-{
+static const uint8_t S[4][4] = {
{ 7, 12, 17, 22 }, /* round 1 */
{ 5, 9, 14, 20 }, /* round 2 */
{ 4, 11, 16, 23 }, /* round 3 */
{ 6, 10, 15, 21 } /* round 4 */
};
-static const uint32_t T[64] = // T[i]= fabs(sin(i+1)<<32)
-{
+static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* round 1 */
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
@@ -87,35 +84,29 @@ static const uint32_t T[64] = // T[i]= fabs(sin(i+1)<<32)
}\
a = b + (( a << t ) | ( a >> (32 - t) ));
-static void body(uint32_t ABCD[4], uint32_t X[16])
-{
+static void body(uint32_t ABCD[4], uint32_t X[16]){
int t;
int i av_unused;
- unsigned int a = ABCD[3];
- unsigned int b = ABCD[2];
- unsigned int c = ABCD[1];
- unsigned int d = ABCD[0];
+ unsigned int a= ABCD[3];
+ unsigned int b= ABCD[2];
+ unsigned int c= ABCD[1];
+ unsigned int d= ABCD[0];
#if HAVE_BIGENDIAN
- for(i = 0; i < 16; i++)
- X[i] = bswap_32(X[i]);
+ for(i=0; i<16; i++)
+ X[i]= bswap_32(X[i]);
#endif
#if CONFIG_SMALL
- for(i = 0; i < 64; i++)
- {
- CORE(i, a, b, c, d)
- t = d;
- d = c;
- c = b;
- b = a;
- a = t;
+ for( i = 0; i < 64; i++ ){
+ CORE(i,a,b,c,d)
+ t=d; d=c; c=b; b=a; a=t;
}
#else
#define CORE2(i) CORE(i,a,b,c,d) CORE((i+1),d,a,b,c) CORE((i+2),c,d,a,b) CORE((i+3),b,c,d,a)
#define CORE4(i) CORE2(i) CORE2((i+4)) CORE2((i+8)) CORE2((i+12))
- CORE4(0) CORE4(16) CORE4(32) CORE4(48)
+CORE4(0) CORE4(16) CORE4(32) CORE4(48)
#endif
ABCD[0] += d;
@@ -124,8 +115,7 @@ static void body(uint32_t ABCD[4], uint32_t X[16])
ABCD[3] += a;
}
-void av_md5_init(AVMD5 *ctx)
-{
+void av_md5_init(AVMD5 *ctx){
ctx->len = 0;
ctx->ABCD[0] = 0x10325476;
@@ -134,41 +124,36 @@ void av_md5_init(AVMD5 *ctx)
ctx->ABCD[3] = 0x67452301;
}
-void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len)
-{
+void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){
int i, j;
- j = ctx->len & 63;
+ j= ctx->len & 63;
ctx->len += len;
- for(i = 0; i < len; i++)
- {
+ for( i = 0; i < len; i++ ){
ctx->block[j++] = src[i];
- if(64 == j)
- {
+ if( 64 == j ){
body(ctx->ABCD, (uint32_t*) ctx->block);
j = 0;
}
}
}
-void av_md5_final(AVMD5 *ctx, uint8_t *dst)
-{
+void av_md5_final(AVMD5 *ctx, uint8_t *dst){
int i;
- uint64_t finalcount = le2me_64(ctx->len << 3);
+ uint64_t finalcount= le2me_64(ctx->len<<3);
av_md5_update(ctx, "\200", 1);
- while((ctx->len & 63) != 56)
+ while((ctx->len & 63)!=56)
av_md5_update(ctx, "", 1);
av_md5_update(ctx, (uint8_t*)&finalcount, 8);
- for(i = 0; i < 4; i++)
- ((uint32_t*)dst)[i] = le2me_32(ctx->ABCD[3-i]);
+ for(i=0; i<4; i++)
+ ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]);
}
-void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len)
-{
+void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){
AVMD5 ctx[1];
av_md5_init(ctx);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.c
index edd694633..7c80cf830 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.c
@@ -66,13 +66,13 @@ void *av_malloc(unsigned int size)
void *ptr;
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX - 16))
+ if(size > (INT_MAX-16) )
return NULL;
#ifndef __GNUC__
- ptr = _aligned_malloc(size, 16);
+ ptr = _aligned_malloc(size,16);
#else
- ptr = __mingw_aligned_malloc(size, 16);
+ ptr = __mingw_aligned_malloc(size,16);
#endif
/* Why 64?
Indeed, we should align it:
@@ -83,43 +83,43 @@ void *av_malloc(unsigned int size)
Because L1 and L2 caches are aligned on those values.
But I don't want to code such logic here!
*/
- /* Why 16?
- Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs
- it will just trigger an exception and the unaligned load will be done in the
- exception handler or it will just segfault (SSE2 on P4).
- 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.
- */
+ /* Why 16?
+ Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs
+ it will just trigger an exception and the unaligned load will be done in the
+ exception handler or it will just segfault (SSE2 on P4).
+ 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.
+ */
return ptr;
}
void *av_realloc(void *ptr, unsigned int size)
{
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX - 16))
+ if(size > (INT_MAX-16) )
return NULL;
#ifndef __GNUC__
- return _aligned_realloc(ptr, size, 16);
+ return _aligned_realloc(ptr, size,16);
#else
- return __mingw_aligned_realloc(ptr, size, 16);
+ return __mingw_aligned_realloc(ptr, size,16);
#endif
}
void av_free(void *ptr)
{
/* XXX: this test should not be needed on most libcs */
- if(ptr)
+ if (ptr)
#ifndef __GNUC__
_aligned_free(ptr);
#else
@@ -129,7 +129,7 @@ void av_free(void *ptr)
void av_freep(void *arg)
{
- void **ptr = (void**)arg;
+ void **ptr= (void**)arg;
av_free(*ptr);
*ptr = NULL;
}
@@ -137,19 +137,18 @@ void av_freep(void *arg)
void *av_mallocz(unsigned int size)
{
void *ptr = av_malloc(size);
- if(ptr)
+ if (ptr)
memset(ptr, 0, size);
return ptr;
}
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)
+ if (ptr)
memcpy(ptr, s, len);
}
return ptr;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.h
index 8742044e2..14dbde9b4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/mem.h
@@ -29,30 +29,30 @@
#include "common.h"
#if defined(__ICC) || 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
+ #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(__GNUC__)
-#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
-#define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v
+ #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v
#elif defined(_MSC_VER)
-#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
-#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
+ #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
#else
-#define DECLARE_ALIGNED(n,t,v) t v
-#define DECLARE_ASM_CONST(n,t,v) static const t v
+ #define DECLARE_ALIGNED(n,t,v) t v
+ #define DECLARE_ASM_CONST(n,t,v) static const t v
#endif
#if AV_GCC_VERSION_AT_LEAST(3,1)
-#define av_malloc_attrib __attribute__((__malloc__))
+ #define av_malloc_attrib __attribute__((__malloc__))
#else
-#define av_malloc_attrib
+ #define av_malloc_attrib
#endif
#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
-#define av_alloc_size(n) __attribute__((alloc_size(n)))
+ #define av_alloc_size(n) __attribute__((alloc_size(n)))
#else
-#define av_alloc_size(n)
+ #define av_alloc_size(n)
#endif
/**
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.c
index cd79e6d1e..886e7ebaf 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.c
@@ -33,74 +33,63 @@
#include "mathematics.h"
#include "rational.h"
-int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
-{
- AVRational a0 = {0, 1}, a1 = {1, 0};
- int sign = (num < 0) ^(den < 0);
- int64_t gcd = av_gcd(FFABS(num), FFABS(den));
+int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max){
+ AVRational a0={0,1}, a1={1,0};
+ int sign= (num<0) ^ (den<0);
+ int64_t gcd= av_gcd(FFABS(num), FFABS(den));
- if(gcd)
- {
- num = FFABS(num) / gcd;
- den = FFABS(den) / gcd;
+ if(gcd){
+ num = FFABS(num)/gcd;
+ den = FFABS(den)/gcd;
}
- if(num <= max && den <= max)
- {
- a1.num = num;
- a1.den = den;
- den = 0;
+ if(num<=max && den<=max){
+ a1.num=num; a1.den=den;
+ den=0;
}
- while(den)
- {
+ while(den){
uint64_t x = num / den;
- int64_t next_den = num - den * x;
- int64_t a2n = x * a1.num + a0.num;
- int64_t a2d = x * a1.den + a0.den;
+ int64_t next_den= num - den*x;
+ int64_t a2n= x*a1.num + a0.num;
+ int64_t a2d= x*a1.den + a0.den;
- if(a2n > max || a2d > max)
- {
- if(a1.num) x = (max - a0.num) / a1.num;
- if(a1.den) x = FFMIN(x, (max - a0.den) / a1.den);
+ if(a2n > max || a2d > max){
+ if(a1.num) x= (max - a0.num) / a1.num;
+ if(a1.den) x= FFMIN(x, (max - a0.den) / a1.den);
- if(den*(2 * x * a1.den + a0.den) > num * a1.den)
- a1.num = x * a1.num + a0.num;
- a1.den = x * a1.den + a0.den;
+ if (den*(2*x*a1.den + a0.den) > num*a1.den)
+ a1.num = x*a1.num + a0.num; a1.den = x*a1.den + a0.den;
break;
}
- a0 = a1;
- a1.num = a2n;
- a1.den = a2d;
- num = den;
- den = next_den;
+ a0= a1;
+ a1.num=a2n; a1.den=a2d;
+ num= den;
+ den= next_den;
}
assert(av_gcd(a1.num, a1.den) <= 1U);
*dst_num = sign ? -a1.num : a1.num;
*dst_den = a1.den;
- return den == 0;
+ return den==0;
}
-AVRational av_mul_q(AVRational b, AVRational c)
-{
- av_reduce(&b.num, &b.den, b.num *(int64_t)c.num, b.den *(int64_t)c.den, INT_MAX);
+AVRational av_mul_q(AVRational b, AVRational c){
+ av_reduce(&b.num, &b.den, b.num * (int64_t)c.num, b.den * (int64_t)c.den, INT_MAX);
return b;
}
-AVRational av_div_q(AVRational b, AVRational c)
-{
+AVRational av_div_q(AVRational b, AVRational c){
AVRational d = {c.den, c.num};
return av_mul_q(b, d);
}
-AVRational av_d2q(double d, int max)
-{
+AVRational av_d2q(double d, int max){
AVRational a;
#define LOG2 0.69314718055994530941723212145817656807550013436025
- int exponent = FFMAX((int)(log(fabs(d) + 1e-20) / LOG2), 0);
- int64_t den = 1LL << (61 - exponent);
+ int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
+ int64_t den= 1LL << (61 - exponent);
av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);
return a;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.h
index b0e46b0cd..157c038fd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/rational.h
@@ -34,8 +34,7 @@
/**
* rational number numerator/denominator
*/
-typedef struct AVRational
-{
+typedef struct AVRational{
int num; ///< numerator
int den; ///< denominator
} AVRational;
@@ -46,11 +45,10 @@ typedef struct AVRational
* @param b second rational
* @return 0 if a==b, 1 if a>b and -1 if a<b
*/
-static inline int av_cmp_q(AVRational a, AVRational b)
-{
- const int64_t tmp = a.num * (int64_t)b.den - b.num * (int64_t)a.den;
+static inline int av_cmp_q(AVRational a, AVRational b){
+ const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
- if(tmp) return (tmp >> 63) | 1;
+ if(tmp) return (tmp>>63)|1;
else return 0;
}
@@ -59,8 +57,7 @@ static inline int av_cmp_q(AVRational a, AVRational b)
* @param a rational to convert
* @return (double) a
*/
-static inline double av_q2d(AVRational a)
-{
+static inline double av_q2d(AVRational a){
return a.num / (double) a.den;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/bswap.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/bswap.h
index 81edab6b7..0ff8a9338 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/bswap.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/bswap.h
@@ -39,7 +39,7 @@ static av_always_inline av_const uint16_t bswap_16(uint16_t x)
static av_always_inline av_const uint32_t bswap_32(uint32_t x)
{
#if HAVE_BSWAP
- __asm__("bswap %0" : "+r"(x));
+ __asm__("bswap %0" : "+r" (x));
#else
__asm__("rorw $8, %w0 \n\t"
"rorl $16, %0 \n\t"
@@ -53,7 +53,7 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
#define bswap_64 bswap_64
static inline uint64_t av_const bswap_64(uint64_t x)
{
- __asm__("bswap %0": "=r"(x) : "0"(x));
+ __asm__("bswap %0": "=r" (x) : "0" (x));
return x;
}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/intreadwrite.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/intreadwrite.h
index 8a3eca3af..4621f064d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/intreadwrite.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/intreadwrite.h
@@ -34,7 +34,7 @@ static av_always_inline void AV_COPY64(void *d, const void *s)
__asm__("movq %1, %%mm0 \n\t"
"movq %%mm0, %0 \n\t"
: "=m"(*(uint64_t*)d)
- : "m"(*(const uint64_t*)s)
+ : "m" (*(const uint64_t*)s)
: "mm0");
}
@@ -65,15 +65,12 @@ static av_always_inline void AV_ZERO64(void *d)
#define AV_COPY128 AV_COPY128
static av_always_inline void AV_COPY128(void *d, const void *s)
{
- struct v
- {
- uint64_t v[2];
- };
+ struct v {uint64_t v[2];};
__asm__("movaps %1, %%xmm0 \n\t"
"movaps %%xmm0, %0 \n\t"
: "=m"(*(struct v*)d)
- : "m"(*(const struct v*)s)
+ : "m" (*(const struct v*)s)
: "xmm0");
}
@@ -84,10 +81,7 @@ static av_always_inline void AV_COPY128(void *d, const void *s)
#define AV_ZERO128 AV_ZERO128
static av_always_inline void AV_ZERO128(void *d)
{
- struct v
- {
- uint64_t v[2];
- };
+ struct v {uint64_t v[2];};
__asm__("pxor %%xmm0, %%xmm0 \n\t"
"movdqa %%xmm0, %0 \n\t"
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/timer.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/timer.h
index 0d41362e0..62a111fdd 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/timer.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/x86/timer.h
@@ -28,7 +28,7 @@
static inline uint64_t read_time(void)
{
uint32_t a, d;
- __asm__ volatile("rdtsc" : "=a"(a), "=d"(d));
+ __asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
return ((uint64_t)d << 32) + a;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/config.h b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/config.h
index 157af6911..fad24058f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/config.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/config.h
@@ -1,35 +1,35 @@
#ifdef __GNUC__
-#define HAVE_MMX 1
-#define HAVE_MMX2 1
-#define HAVE_SSE 1
-#define HAVE_SSE2 1
-#define HAVE_SSSE3 1
-#define HAVE_AMD3DNOW 1
-#define HAVE_AMD3DNOWEX 1
-
-#define ARCH_X86 1
-#ifdef ARCH_X86_64
-#define HAVE_FAST_64BIT 1
-#define HAVE_CMOV 1
-#define HAVE_FAST_CMOV 1
-#else
-#define ARCH_X86_32 1
-#endif
+ #define HAVE_MMX 1
+ #define HAVE_MMX2 1
+ #define HAVE_SSE 1
+ #define HAVE_SSE2 1
+ #define HAVE_SSSE3 1
+ #define HAVE_AMD3DNOW 1
+ #define HAVE_AMD3DNOWEX 1
+
+ #define ARCH_X86 1
+ #ifdef ARCH_X86_64
+ #define HAVE_FAST_64BIT 1
+ #define HAVE_CMOV 1
+ #define HAVE_FAST_CMOV 1
+ #else
+ #define ARCH_X86_32 1
+ #endif
#else
-#define HAVE_INLINE_ASM 0
-#define HAVE_MMX 0
-#define HAVE_MMX2 0
-#define HAVE_SSE 0
-#define HAVE_SSE2 0
-#define HAVE_SSSE3 0
-#define HAVE_AMD3DNOW 0
-#define HAVE_AMD3DNOWEXT 0
-#define ARCH_X86 0
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define HAVE_FAST_64BIT 0
-#define HAVE_CMOV 0
-#define HAVE_FAST_CMOV 0
+ #define HAVE_INLINE_ASM 0
+ #define HAVE_MMX 0
+ #define HAVE_MMX2 0
+ #define HAVE_SSE 0
+ #define HAVE_SSE2 0
+ #define HAVE_SSSE3 0
+ #define HAVE_AMD3DNOW 0
+ #define HAVE_AMD3DNOWEXT 0
+ #define ARCH_X86 0
+ #define ARCH_X86_32 0
+ #define ARCH_X86_64 0
+ #define HAVE_FAST_64BIT 0
+ #define HAVE_CMOV 0
+ #define HAVE_FAST_CMOV 0
#endif
#define HAVE_TEN_OPERANDS 1
@@ -54,13 +54,13 @@
#undef MP_DEBUG
#ifndef __GNUC__
-#define inline __inline
-#ifndef __attribute__
-#define __attribute__(x) /**/
-#endif
-#pragma warning (disable:4002)
-#include <malloc.h>
-#define memalign(a,b) _aligned_malloc(b,a)
+ #define inline __inline
+ #ifndef __attribute__
+ #define __attribute__(x) /**/
+ #endif
+ #pragma warning (disable:4002)
+ #include <malloc.h>
+ #define memalign(a,b) _aligned_malloc(b,a)
#else
-#define memalign(a,b) __mingw_aligned_malloc(b,a)
+ #define memalign(a,b) __mingw_aligned_malloc(b,a)
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/isP4HT.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/isP4HT.c
index 43a33511c..7a1a9dff9 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/isP4HT.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/isP4HT.c
@@ -10,7 +10,7 @@ int IsCPUID(void)
return 0;
#else
long result;
- result = 1;
+ result= 1;
#if ARCH_X86 // GCC
asm volatile(
"pushf \n\t"
@@ -26,8 +26,8 @@ int IsCPUID(void)
"mov $0,%0 \n\t"
"1: \n\t"
- : "+a"(result)
- :: "%ecx", "%edx"
+ : "+a" (result)
+ :: "%ecx","%edx"
);
#endif
return result;
@@ -36,12 +36,12 @@ int IsCPUID(void)
int isP4HT_I(int family, int model, const char *v_name) // return true if P4HT, P4EE or P4
{
- if(!strncmp("GenuineIntel", v_name, 12) && family == 0x0f && model <= 3)
+ if (!strncmp("GenuineIntel", v_name, 12) && family==0x0f && model<=3)
return 1;
return 0;
}
-int isP4HT(void)
+int isP4HT (void)
{
#ifdef WIN64
return 0;
@@ -51,11 +51,9 @@ int isP4HT(void)
long dwFeature = 0;
long dwMax = 0;
long dwExt = 0;
- union
- {
+ union {
char cBuf[12+1];
- struct
- {
+ struct {
long dw0;
long dw1;
long dw2;
@@ -63,12 +61,12 @@ int isP4HT(void)
} Ident;
char v_name[13]; // vendor name
int family; // family of the processor
- // e.g. 6 = Pentium-Pro architecture
+ // e.g. 6 = Pentium-Pro architecture
int model; // model of processor
- // e.g. 1 = Pentium-Pro for family = 6
+ // e.g. 1 = Pentium-Pro for family = 6
int stepping; // processor revision number
- if(!IsCPUID())
+ if (!IsCPUID())
return 0;
#if ARCH_X86 // GCC
@@ -88,13 +86,12 @@ int isP4HT(void)
"mov %%ebx, %5 \n\t"
"mov %%edx, %6 \n\t"
- : "=m"(dwMax), "=m"(Ident.s.dw0), "=m"(Ident.s.dw1), "=m"(Ident.s.dw2), "=m"(dwStandard), "=m"(dwBrandIndex), "=m"(dwFeature)
- :: "%eax", "%ebx", "%ecx", "%edx"
+ : "=m" (dwMax), "=m" (Ident.s.dw0), "=m" (Ident.s.dw1), "=m" (Ident.s.dw2), "=m" (dwStandard), "=m" (dwBrandIndex), "=m" (dwFeature)
+ :: "%eax","%ebx","%ecx","%edx"
);
#ifndef _WIN64
#elif defined(_WIN32)
- _asm
- {
+ _asm {
push ebx
push ecx
push edx
@@ -128,10 +125,10 @@ int isP4HT(void)
stepping = (dwStandard) & 0xF; // retrieve stepping
Ident.cBuf[12] = 0;
strcpy(v_name, Ident.cBuf);
- if((dwFeature & 0x8000000) == 0)
+ if((dwFeature & 0x8000000)==0)
return 0;
- if(((dwBrandIndex & 0xff0000) >> 16) == 1)
+ if(((dwBrandIndex & 0xff0000) >> 16)==1)
return 0;
return isP4HT_I(family, model, v_name);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/libswscalew32thread.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/libswscalew32thread.c
index c653fa23d..48223cc75 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/libswscalew32thread.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/libswscalew32thread.c
@@ -34,8 +34,7 @@
#include <windows.h>
#include <process.h>
-typedef struct SwsThreadContext
-{
+typedef struct SwsThreadContext{
SwsContext *swsctx;
HANDLE thread;
HANDLE work_sem;
@@ -43,20 +42,18 @@ typedef struct SwsThreadContext
int (*func)(SwsContext *c);
void *arg;
int ret;
-} SwsThreadContext;
+}SwsThreadContext;
-static unsigned __stdcall sws_thread_func(void *v)
-{
- SwsThreadContext *c = v;
+static unsigned __stdcall sws_thread_func(void *v){
+ SwsThreadContext *c= v;
- for(;;)
- {
+ for(;;){
//printf("sws_thread_func %X enter wait\n", (int)v); fflush(stdout);
WaitForSingleObject(c->work_sem, INFINITE);
//printf("sws_thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout);
if(c->func)
- c->ret = c->func(c->swsctx);
+ c->ret= c->func(c->swsctx);
else
return 0;
//printf("sws_thread_func %X signal complete\n", (int)v); fflush(stdout);
@@ -70,28 +67,25 @@ static unsigned __stdcall sws_thread_func(void *v)
* Free what has been allocated by sws_thread_init().
* Must be called after decoding has finished, especially do not call while sws_thread_execute() is running
*/
-void sws_thread_free(SwsContext *s)
-{
- SwsThreadContext *c = s->thread_opaque;
+void sws_thread_free(SwsContext *s){
+ SwsThreadContext *c= s->thread_opaque;
int i;
- for(i = 0; i < s->thread_count; i++)
- {
+ for(i=0; i<s->thread_count; i++){
- c[i].func = NULL;
+ c[i].func= NULL;
ReleaseSemaphore(c[i].work_sem, 1, 0);
WaitForSingleObject(c[i].thread, INFINITE);
if(c[i].work_sem) CloseHandle(c[i].work_sem);
if(c[i].done_sem) CloseHandle(c[i].done_sem);
- if(c[i].thread) CloseHandle(c[i].thread);
+ if(c[i].thread) CloseHandle(c[i].thread);
}
av_freep(&s->thread_opaque);
}
-int sws_thread_execute(SwsContext *s, int (*func)(SwsContext *c2), int *ret, int count) //CUSTOMIZED no void **arg
-{
- SwsThreadContext *c = s->thread_opaque;
+int sws_thread_execute(SwsContext *s, int (*func)(SwsContext *c2), int *ret, int count){ //CUSTOMIZED no void **arg
+ SwsThreadContext *c= s->thread_opaque;
int i;
assert(s == c->swsctx);
@@ -99,40 +93,36 @@ int sws_thread_execute(SwsContext *s, int (*func)(SwsContext *c2), int *ret, int
/* note, we can be certain that this is not called with the same SwsContext by different threads at the same time */
- for(i = 0; i < count; i++)
- {
+ for(i=0; i<count; i++){
c[i].arg = &s[i].stp;//CUSTOMIZED
- c[i].func = func;
+ c[i].func= func;
c[i].ret = 12345;
ReleaseSemaphore(c[i].work_sem, 1, 0);
}
- for(i = 0; i < count; i++)
- {
+ for(i=0; i<count; i++){
WaitForSingleObject(c[i].done_sem, INFINITE);
- c[i].func = NULL;
- if(ret) ret[i] = c[i].ret;
+ c[i].func= NULL;
+ if(ret) ret[i]= c[i].ret;
}
return 0;
}
-int sws_thread_init(SwsContext *s, int thread_count)
-{
+int sws_thread_init(SwsContext *s, int thread_count){
int i;
SwsThreadContext *c;
uint32_t threadid;
- s->thread_count = thread_count;
+ s->thread_count= thread_count;
assert(!s->thread_opaque);
- c = av_mallocz(sizeof(SwsThreadContext) * thread_count);
- s->thread_opaque = c;
+ c= av_mallocz(sizeof(SwsThreadContext)*thread_count);
+ s->thread_opaque= c;
- for(i = 0; i < thread_count; i++)
- {
+ for(i=0; i<thread_count; i++){
//printf("init semaphors %d\n", i); fflush(stdout);
- c[i].swsctx = &s[i]; //CUSTOMIZED
+ c[i].swsctx= &s[i]; //CUSTOMIZED
if(!(c[i].work_sem = CreateSemaphore(NULL, 0, s->thread_count, NULL)))
goto fail;
@@ -140,12 +130,12 @@ int sws_thread_init(SwsContext *s, int thread_count)
goto fail;
//printf("create thread %d\n", i); fflush(stdout);
- c[i].thread = (HANDLE)_beginthreadex(NULL, 0, sws_thread_func, &c[i], 0, &threadid);
- if(!c[i].thread) goto fail;
+ c[i].thread = (HANDLE)_beginthreadex(NULL, 0, sws_thread_func, &c[i], 0, &threadid );
+ if( !c[i].thread ) goto fail;
}
//printf("init done\n"); fflush(stdout);
- s->execute = sws_thread_execute;
+ s->execute= sws_thread_execute;
return 0;
fail:
@@ -153,14 +143,13 @@ fail:
return -1;
}
-int GetCPUCount(void)
-{
+int GetCPUCount(void){
int CPUCount;
SYSTEM_INFO si;
GetSystemInfo(&si);
- if(isP4HT() && si.dwNumberOfProcessors >= 2)
- CPUCount = si.dwNumberOfProcessors >> 1;
+ if(isP4HT() &&si.dwNumberOfProcessors>=2)
+ CPUCount = si.dwNumberOfProcessors>>1;
else
- CPUCount = si.dwNumberOfProcessors;
+ CPUCount= si.dwNumberOfProcessors;
return CPUCount;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.c
index b4929a692..a7c7a3696 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.c
@@ -108,22 +108,22 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
#if ARCH_X86_32 || ARCH_X86_64
-static uint64_t __attribute__((aligned(8))) attribute_used w05 = 0x0005000500050005LL;
-static uint64_t __attribute__((aligned(8))) attribute_used w04 = 0x0004000400040004LL;
-static uint64_t __attribute__((aligned(8))) attribute_used w20 = 0x0020002000200020LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b00 = 0x0000000000000000LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b01 = 0x0101010101010101LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b02 = 0x0202020202020202LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b08 = 0x0808080808080808LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b80 = 0x8080808080808080LL;
+static uint64_t __attribute__((aligned(8))) attribute_used w05= 0x0005000500050005LL;
+static uint64_t __attribute__((aligned(8))) attribute_used w04= 0x0004000400040004LL;
+static uint64_t __attribute__((aligned(8))) attribute_used w20= 0x0020002000200020LL;
+static uint64_t __attribute__((aligned(8))) attribute_used b00= 0x0000000000000000LL;
+static uint64_t __attribute__((aligned(8))) attribute_used b01= 0x0101010101010101LL;
+static uint64_t __attribute__((aligned(8))) attribute_used b02= 0x0202020202020202LL;
+static uint64_t __attribute__((aligned(8))) attribute_used b08= 0x0808080808080808LL;
+static uint64_t __attribute__((aligned(8))) attribute_used b80= 0x8080808080808080LL;
#endif
static uint8_t clip_table[3*256];
-static uint8_t * const clip_tab = clip_table + 256;
+static uint8_t * const clip_tab= clip_table + 256;
-static const int verbose = 0;
+static const int verbose= 0;
-static const int attribute_used deringThreshold = 20;
+static const int attribute_used deringThreshold= 20;
@@ -131,30 +131,30 @@ static const int attribute_used deringThreshold = 20;
#if ARCH_X86_32 || ARCH_X86_64
static inline void prefetchnta(void *p)
{
- asm volatile("prefetchnta (%0)\n\t"
- : : "r"(p)
- );
+ asm volatile( "prefetchnta (%0)\n\t"
+ : : "r" (p)
+ );
}
static inline void prefetcht0(void *p)
{
- asm volatile("prefetcht0 (%0)\n\t"
- : : "r"(p)
- );
+ asm volatile( "prefetcht0 (%0)\n\t"
+ : : "r" (p)
+ );
}
static inline void prefetcht1(void *p)
{
- asm volatile("prefetcht1 (%0)\n\t"
- : : "r"(p)
- );
+ asm volatile( "prefetcht1 (%0)\n\t"
+ : : "r" (p)
+ );
}
static inline void prefetcht2(void *p)
{
- asm volatile("prefetcht2 (%0)\n\t"
- : : "r"(p)
- );
+ asm volatile( "prefetcht2 (%0)\n\t"
+ : : "r" (p)
+ );
}
#endif
@@ -165,183 +165,171 @@ static inline void prefetcht2(void *p)
*/
static inline int isHorizDC_C(uint8_t src[], stride_t 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;
+ 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[], stride_t 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 isVertDC_C(uint8_t src[], stride_t 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[], stride_t stride, int QP)
{
- int i;
+ int i;
#if 1
- 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;
- }
+ 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;
+ }
#else
- for(i = 0; i < 8; i++)
- {
- if((unsigned)(src[0] - src[7] + 2 * QP) > 4 * QP) return 0;
- src += stride;
- }
+ for(i=0; i<8; i++){
+ if((unsigned)(src[0] - src[7] + 2*QP) > 4*QP) return 0;
+ src += stride;
+ }
#endif
- return 1;
+ return 1;
}
static inline int isVertMinMaxOk_C(uint8_t src[], stride_t stride, int QP)
{
#if 1
#if 1
- 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;
- }
+ 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;
+ }
#else
- int x;
- src += stride * 3;
- for(x = 0; x < BLOCK_SIZE; x++)
- {
- if((unsigned)(src[x + stride] - src[x + (stride<<3)] + 2 * QP) > 4 * QP) return 0;
- }
+ int x;
+ src+= stride*3;
+ for(x=0; x<BLOCK_SIZE; x++)
+ {
+ if((unsigned)(src[x + stride] - src[x + (stride<<3)] + 2*QP) > 4*QP) return 0;
+ }
#endif
- return 1;
+ return 1;
#else
- int x;
- src += stride * 4;
- for(x = 0; x < BLOCK_SIZE; x++)
- {
- int min = 255;
- int max = 0;
- int y;
- for(y = 0; y < 8; y++)
- {
- int v = src[x + y*stride];
- if(v > max) max = v;
- if(v < min) min = v;
- }
- if(max - min > 2 * QP) return 0;
- }
- return 1;
+ int x;
+ src+= stride*4;
+ for(x=0; x<BLOCK_SIZE; x++)
+ {
+ int min=255;
+ int max=0;
+ int y;
+ for(y=0; y<8; y++){
+ int v= src[x + y*stride];
+ if(v>max) max=v;
+ if(v<min) min=v;
+ }
+ if(max-min > 2*QP) return 0;
+ }
+ return 1;
#endif
}
-static inline int horizClassify_C(uint8_t src[], stride_t 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 horizClassify_C(uint8_t src[], stride_t 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[], stride_t 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 int vertClassify_C(uint8_t src[], stride_t 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[], stride_t 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(ABS(middleEnergy) < 8 * c->QP)
+ int y;
+ for(y=0; y<BLOCK_SIZE; y++)
{
- 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 = ABS(middleEnergy) - MIN(ABS(leftEnergy), ABS(rightEnergy));
- d = MAX(d, 0);
-
- d = (5 * d + 32) >> 6;
- d *= SIGN(-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;
+ const int middleEnergy= 5*(dst[4] - dst[3]) + 2*(dst[2] - dst[5]);
+
+ if(ABS(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= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) );
+ d= MAX(d, 0);
+
+ d= (5*d + 32) >> 6;
+ d*= SIGN(-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;
}
- dst += stride;
- }
}
/**
@@ -350,35 +338,35 @@ static inline void doHorizDefFilter_C(uint8_t dst[], stride_t stride, PPContext
*/
static inline void doHorizLowPass_C(uint8_t dst[], stride_t stride, PPContext *c)
{
- int y;
- for(y = 0; y < BLOCK_SIZE; y++)
- {
- const int first = ABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0];
- const int last = ABS(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;
- }
+ int y;
+ for(y=0; y<BLOCK_SIZE; y++)
+ {
+ const int first= ABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0];
+ const int last= ABS(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;
+ }
}
/**
@@ -391,179 +379,166 @@ static inline void doHorizLowPass_C(uint8_t dst[], stride_t stride, PPContext *c
*/
static inline void horizX1Filter(uint8_t *src, stride_t stride, int QP)
{
- int y;
- static uint64_t *lut = NULL;
- if(lut == NULL)
- {
- int i;
- lut = (uint64_t*)memalign(8, 256 * 8);
- for(i = 0; i < 256; i++)
+ int y;
+ static uint64_t *lut= NULL;
+ if(lut==NULL)
{
- 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;
- */
+ int i;
+ lut= (uint64_t*)memalign(8, 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);
+ 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];
+ 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 = MAX(ABS(b) - (ABS(a) + ABS(c)) / 2, 0);
+ int d= MAX(ABS(b) - (ABS(a) + ABS(c))/2, 0);
- if(d < QP)
- {
- int v = d * SIGN(-b);
+ if(d < QP)
+ {
+ int v = d * SIGN(-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[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;
}
- src += stride;
- }
}
/**
* accurate deblock filter
*/
-static av_always_inline void do_a_deblock_C(uint8_t *src, stride_t step, stride_t 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;
+static av_always_inline void do_a_deblock_C(uint8_t *src, stride_t step, stride_t 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 = ABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0];
- const int last = ABS(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(ABS(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 = ABS(middleEnergy) - MIN(ABS(leftEnergy), ABS(rightEnergy));
- d = MAX(d, 0);
-
- d = (5 * d + 32) >> 6;
- d *= SIGN(-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")
- }*/
+ 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= ABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0];
+ const int last= ABS(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(ABS(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= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) );
+ d= MAX(d, 0);
+
+ d= (5*d + 32) >> 6;
+ d*= SIGN(-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
@@ -649,250 +624,234 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, stride_t step, stride_
// minor note: the HAVE_xyz is messed up after that line so dont use it
static inline void postProcess(uint8_t src[], stride_t srcStride, uint8_t dst[], stride_t dstStride, int width, int height,
- QP_STORE_T QPs[], int QPStride, int isColor, pp_mode_t *vm, pp_context_t *vc)
+ QP_STORE_T QPs[], int QPStride, int isColor, pp_mode_t *vm, pp_context_t *vc)
{
- PPContext *c = (PPContext *)vc;
- PPMode *ppMode = (PPMode *)vm;
- c->ppMode = *ppMode; //FIXME
+ PPContext *c= (PPContext *)vc;
+ PPMode *ppMode= (PPMode *)vm;
+ c->ppMode= *ppMode; //FIXME
- // useing ifs here as they are faster than function pointers allthough the
- // difference wouldnt be messureable here but its much better because
- // someone might exchange the cpu whithout restarting mplayer ;)
+ // useing ifs here as they are faster than function pointers allthough the
+ // difference wouldnt be messureable here but its much better because
+ // someone might exchange the cpu whithout restarting mplayer ;)
#ifdef RUNTIME_CPUDETECT
#if ARCH_X86_32 || ARCH_X86_64
- // ordered per speed fasterst 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);
+ // ordered per speed fasterst 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
#ifdef ARCH_POWERPC
#ifdef HAVE_ALTIVEC
- if(c->cpuCaps & PP_CPU_CAPS_ALTIVEC)
- postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
- else
+ if(c->cpuCaps & PP_CPU_CAPS_ALTIVEC)
+ postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
+ else
#endif
#endif
- postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
+ postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#endif
#else //RUNTIME_CPUDETECT
#if HAVE_MMX2
- postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
+ 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);
+ 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);
+ postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#elif defined (HAVE_ALTIVEC)
- postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
+ 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);
+ postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#endif
#endif //!RUNTIME_CPUDETECT
}
-static void reallocAlign(void **p, int alignment, stride_t size)
-{
- av_free(*p);
- *p = memalign(alignment, size);
- memset(*p, 0, size);
+static void reallocAlign(void **p, int alignment, stride_t size){
+ av_free(*p);
+ *p= memalign(alignment, size);
+ memset(*p, 0, size);
}
-static void reallocBuffers(PPContext *c, int width, int height, stride_t 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 * 2);
- reallocAlign((void **)&c->tempSrc, 8, stride * 24 * 2);
- 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 dont have to worry about r/w over te end
- reallocAlign((void **)&c->tempBlured[i], 8, stride * mbHeight * 16 + 17 * 1024 + 256);
- reallocAlign((void **)&c->tempBluredPast[i], 8, 256 *((height + 7)&(~7)) / 2 + 17 * 1024 + 256); //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 void reallocBuffers(PPContext *c, int width, int height, stride_t 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*2);
+ reallocAlign((void **)&c->tempSrc, 8, stride*24*2);
+ 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 dont have to worry about r/w over te end
+ reallocAlign((void **)&c->tempBlured[i], 8, stride*mbHeight*16 + 17*1024+256);
+ reallocAlign((void **)&c->tempBluredPast[i], 8, 256*((height+7)&(~7))/2 + 17*1024+256);//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 void global_init(void)
-{
- int i;
- memset(clip_table, 0, 256);
- for(i = 256; i < 512; i++)
- clip_table[i] = i;
- memset(clip_table + 512, 0, 256);
+static void global_init(void){
+ int i;
+ memset(clip_table, 0, 256);
+ for(i=256; i<512; i++)
+ clip_table[i]= i;
+ memset(clip_table+512, 0, 256);
}
-pp_context_t *pp_get_context(int width, int height, int cpuCaps)
-{
- PPContext *c = memalign(32, sizeof(PPContext));
- int stride = (width + 15) & (~15); //assumed / will realloc if needed
- int qpStride = (width + 15) / 16 + 2; //assumed / will realloc if needed
-
- global_init();
-
- memset(c, 0, sizeof(PPContext));
- 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;
+pp_context_t *pp_get_context(int width, int height, int cpuCaps){
+ PPContext *c= memalign(32, sizeof(PPContext));
+ int stride= (width+15)&(~15); //assumed / will realloc if needed
+ int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
+
+ global_init();
+
+ memset(c, 0, sizeof(PPContext));
+ 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;
+void pp_free_context(void *vc){
+ PPContext *c = (PPContext*)vc;
+ int i;
- for(i = 0; i < 3; i++) av_free(c->tempBlured[i]);
- for(i = 0; i < 3; i++) av_free(c->tempBluredPast[i]);
+ for(i=0; i<3; i++) av_free(c->tempBlured[i]);
+ for(i=0; i<3; i++) av_free(c->tempBluredPast[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);
+ 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));
+ memset(c, 0, sizeof(PPContext));
- av_free(c);
+ av_free(c);
}
void pp_postprocess(uint8_t * src[3], stride_t srcStride[3],
- uint8_t * dst[3], stride_t dstStride[3],
- int width, int height,
- QP_STORE_T *QP_store, int QPStride,
- pp_mode_t *vm, void *vc, int pict_type)
+ uint8_t * dst[3], stride_t dstStride[3],
+ int width, int height,
+ QP_STORE_T *QP_store, int QPStride,
+ pp_mode_t *vm, void *vc, int pict_type)
{
- int mbWidth = (width + 15) >> 4;
- int mbHeight = (height + 15) >> 4;
- PPMode *mode = (PPMode*)vm;
- PPContext *c = (PPContext*)vc;
- stride_t minStride = MAX(srcStride[0], dstStride[0]);
-
- if(c->stride < minStride || c->qpStride < QPStride)
- reallocBuffers(c, width, height,
- MAX(minStride, c->stride),
- MAX(c->qpStride, QPStride));
-
- if(QP_store == NULL || (mode->lumMode & FORCE_QUANT))
- {
- int i;
- QP_store = c->forcedQPTable;
- QPStride = 0;
- if(mode->lumMode & FORCE_QUANT)
- for(i = 0; i < mbWidth; i++) QP_store[i] = mode->forcedQuant;
- else
- for(i = 0; i < mbWidth; i++) QP_store[i] = 1;
- }
-//printf("pict_type:%d\n", pict_type);
-
- if(pict_type & PP_PICT_TYPE_QP2)
- {
- int i;
- const int count = mbHeight * QPStride;
- for(i = 0; i<(count >> 2); i++)
- {
- ((uint32_t*)c->stdQPTable)[i] = (((uint32_t*)QP_store)[i] >> 1) & 0x7F7F7F7F;
- }
- for(i <<= 2; i < count; i++)
+ int mbWidth = (width+15)>>4;
+ int mbHeight= (height+15)>>4;
+ PPMode *mode = (PPMode*)vm;
+ PPContext *c = (PPContext*)vc;
+ stride_t minStride= MAX(srcStride[0], dstStride[0]);
+
+ if(c->stride < minStride || c->qpStride < QPStride)
+ reallocBuffers(c, width, height,
+ MAX(minStride, c->stride),
+ MAX(c->qpStride, QPStride));
+
+ if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
{
- c->stdQPTable[i] = QP_store[i] >> 1;
+ int i;
+ QP_store= c->forcedQPTable;
+ QPStride= 0;
+ if(mode->lumMode & FORCE_QUANT)
+ for(i=0; i<mbWidth; i++) QP_store[i]= mode->forcedQuant;
+ else
+ for(i=0; i<mbWidth; i++) QP_store[i]= 1;
}
- QP_store = c->stdQPTable;
- }
+//printf("pict_type:%d\n", pict_type);
- if(0)
- {
- int x, y;
- for(y = 0; y < mbHeight; y++)
- {
- for(x = 0; x < mbWidth; x++)
- {
- ;//printf("%2d ", QP_store[x + y*QPStride]);
- }
- //printf("\n");
- }
- //printf("\n");
- }
-
- if((pict_type & 7) != 3)
- {
- int i;
- const int count = mbHeight * QPStride;
- for(i = 0; i<(count >> 2); i++)
+ if(pict_type & PP_PICT_TYPE_QP2){
+ int i;
+ const int count= mbHeight * QPStride;
+ for(i=0; i<(count>>2); i++){
+ ((uint32_t*)c->stdQPTable)[i] = (((uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F;
+ }
+ for(i<<=2; i<count; i++){
+ c->stdQPTable[i] = QP_store[i]>>1;
+ }
+ QP_store= c->stdQPTable;
+ }
+
+if(0){
+int x,y;
+for(y=0; y<mbHeight; y++){
+ for(x=0; x<mbWidth; x++){
+ ;//printf("%2d ", QP_store[x + y*QPStride]);
+ }
+ //printf("\n");
+}
+ //printf("\n");
+}
+
+ if((pict_type&7)!=3)
{
- ((uint32_t*)c->nonBQPTable)[i] = ((uint32_t*)QP_store)[i] & 0x3F3F3F3F;
+ int i;
+ const int count= mbHeight * QPStride;
+ for(i=0; i<(count>>2); i++){
+ ((uint32_t*)c->nonBQPTable)[i] = ((uint32_t*)QP_store)[i] & 0x3F3F3F3F;
+ }
+ for(i<<=2; i<count; i++){
+ c->nonBQPTable[i] = QP_store[i] & 0x3F;
+ }
+ }
+
+ if(verbose>2)
+ {
+ //printf("using npp filters 0x%X/0x%X\n", mode->lumMode, mode->chromMode);
}
- for(i <<= 2; i < count; i++)
+
+ 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)
{
- c->nonBQPTable[i] = QP_store[i] & 0x3F;
- }
- }
-
- if(verbose > 2)
- {
- //printf("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);
- }/*
+ 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[1]>0 && srcStride[2] == dstStride[2] && srcStride[2]>0)
{
memcpy(dst[1], src[1], srcStride[1]*height);
memcpy(dst[2], src[2], srcStride[2]*height);
}*/
- else
- {
- int y;
- for(y = 0; y < height; y++)
+ else
{
- memcpy(&(dst[1][y*dstStride[1]]), &(src[1][y*srcStride[1]]), width);
- memcpy(&(dst[2][y*dstStride[2]]), &(src[2][y*srcStride[2]]), width);
+ 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/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.h b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.h
index 733b7df47..277522cf1 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess.h
@@ -37,39 +37,38 @@ extern "C" {
#define FF_CSP_ONLY
#include "ffImgfmt.h"
- /**
- * 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
+/**
+ * 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" u r willing to loose to get a brightness corrected picture
- int maxTmpNoise[3]; ///< for Temporal Noise Reducing filter (Maximal sum of abs differences)
+ int maxTmpNoise[3]; ///< for Temporal Noise Reducing filter (Maximal sum of abs differences)
- int baseDcDiff;
- int flatnessThreshold;
+ int baseDcDiff;
+ int flatnessThreshold;
- int forcedQuant; ///< quantizer if FORCE_QUANT is used
- } PPMode;
+ int forcedQuant; ///< quantizer if FORCE_QUANT is used
+} PPMode;
- typedef void pp_context_t;
- typedef PPMode pp_mode_t;
+typedef void pp_context_t;
+typedef PPMode pp_mode_t;
- void pp_postprocess(uint8_t * src[3], stride_t srcStride[3],
- uint8_t * dst[3], stride_t dstStride[3],
- int horizontalSize, int verticalSize,
- QP_STORE_T *QP_store, int QP_stride,
- pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
+void pp_postprocess(uint8_t * src[3], stride_t srcStride[3],
+ uint8_t * dst[3], stride_t dstStride[3],
+ int horizontalSize, int verticalSize,
+ QP_STORE_T *QP_store, int QP_stride,
+ pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
- pp_context_t *pp_get_context(int width, int height, int flags);
- void pp_free_context(pp_context_t *ppContext);
+pp_context_t *pp_get_context(int width, int height, int flags);
+void pp_free_context(pp_context_t *ppContext);
#define PP_CPU_CAPS_MMX 0x80000000
#define PP_CPU_CAPS_MMX2 0x20000000
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_internal.h b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_internal.h
index 305c5fb79..625e35855 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_internal.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_internal.h
@@ -25,10 +25,9 @@
//#define COMPILE_TIME_MODE 0x77
#if 1
-static inline int CLIP(int a)
-{
- if(a & 256) return ((a) >> 31) ^(-1);
- else return a;
+static inline int CLIP(int a){
+ if(a&256) return ((a)>>31)^(-1);
+ else return a;
}
//#define CLIP(a) (((a)&256) ? ((a)>>31)^(-1) : (a))
#elif 0
@@ -39,67 +38,65 @@ static inline int CLIP(int a)
/**
* Postprocessng filter.
*/
-struct PPFilter
-{
- char *shortName;
- 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
+struct PPFilter{
+ char *shortName;
+ 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
};
/**
* postprocess context.
*/
-typedef struct PPContext
-{
- uint8_t *tempBlocks; ///<used for the horizontal code
+typedef struct PPContext{
+ 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;
+ /**
+ * 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;
- uint64_t __attribute__((aligned(8))) packedYOffset;
- uint64_t __attribute__((aligned(8))) packedYScale;
+ uint64_t __attribute__((aligned(8))) packedYOffset;
+ uint64_t __attribute__((aligned(8))) packedYScale;
- /** Temporal noise reducing buffers */
- uint8_t *tempBlured[3];
- int32_t *tempBluredPast[3];
+ /** Temporal noise reducing buffers */
+ uint8_t *tempBlured[3];
+ int32_t *tempBluredPast[3];
- /** Temporary buffers for handling the last row(s) */
- uint8_t *tempDst;
- uint8_t *tempSrc;
+ /** Temporary buffers for handling the last row(s) */
+ uint8_t *tempDst;
+ uint8_t *tempSrc;
- uint8_t *deintTemp;
+ uint8_t *deintTemp;
- uint64_t __attribute__((aligned(8))) pQPb;
- uint64_t __attribute__((aligned(8))) pQPb2;
+ uint64_t __attribute__((aligned(8))) pQPb;
+ uint64_t __attribute__((aligned(8))) pQPb2;
- uint64_t __attribute__((aligned(8))) mmxDcOffset[64];
- uint64_t __attribute__((aligned(8))) mmxDcThreshold[64];
+ uint64_t __attribute__((aligned(8))) mmxDcOffset[64];
+ uint64_t __attribute__((aligned(8))) mmxDcThreshold[64];
- QP_STORE_T *stdQPTable; ///< used to fix MPEG2 style qscale
- QP_STORE_T *nonBQPTable;
- QP_STORE_T *forcedQPTable;
+ QP_STORE_T *stdQPTable; ///< used to fix MPEG2 style qscale
+ QP_STORE_T *nonBQPTable;
+ QP_STORE_T *forcedQPTable;
- int QP;
- int nonBQP;
+ int QP;
+ int nonBQP;
- int frameNum;
+ int frameNum;
- int cpuCaps;
+ int cpuCaps;
- int qpStride; ///<size of qp buffers (needed to realloc them if needed)
- stride_t stride; ///<size of some buffers (needed to realloc them if needed)
+ int qpStride; ///<size of qp buffers (needed to realloc them if needed)
+ stride_t stride; ///<size of some buffers (needed to realloc them if needed)
- int hChromaSubSample;
- int vChromaSubSample;
+ int hChromaSubSample;
+ int vChromaSubSample;
- PPMode ppMode;
+ PPMode ppMode;
} PPContext;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_template.c
index 9278071a6..1a5a5e0e7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/postprocess_template.c
@@ -76,120 +76,116 @@
/**
* 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"
+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"
+ "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"
+ "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"
+ "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"((stride_t)stride), "m"(c->pQPb)
- : "%"REG_a
- );
-
- numEq = (-numEq) & 0xFF;
- if(numEq > c->ppMode.flatnessThreshold)
- {
- if(dcOk) return 0;
- else return 1;
- }
- else
- {
- return 2;
- }
-}
+ "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" ((stride_t)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
/**
@@ -200,172 +196,172 @@ static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c)
static inline void RENAME(doVertLowPass)(uint8_t *src, stride_t 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"((stride_t)stride), "m"(c->pQPb)
- : "%"REG_a, "%"REG_c
- );
+ 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" ((stride_t)stride), "m" (c->pQPb)
+ : "%"REG_a, "%"REG_c
+ );
#else
- const stride_t l1 = stride;
- const stride_t l2 = stride + l1;
- const stride_t l3 = stride + l2;
- const stride_t l4 = stride + l3;
- const stride_t l5 = stride + l4;
- const stride_t l6 = stride + l5;
- const stride_t l7 = stride + l6;
- const stride_t l8 = stride + l7;
- const stride_t l9 = stride + l8;
- int x;
- src += stride * 3;
- for(x = 0; x < BLOCK_SIZE; x++)
- {
- const int first = ABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1];
- const int last = ABS(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++;
- }
+ const stride_t l1= stride;
+ const stride_t l2= stride + l1;
+ const stride_t l3= stride + l2;
+ const stride_t l4= stride + l3;
+ const stride_t l5= stride + l4;
+ const stride_t l6= stride + l5;
+ const stride_t l7= stride + l6;
+ const stride_t l8= stride + l7;
+ const stride_t l9= stride + l8;
+ int x;
+ src+= stride*3;
+ for(x=0; x<BLOCK_SIZE; x++)
+ {
+ const int first= ABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1];
+ const int last= ABS(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
}
#endif //HAVE_ALTIVEC
@@ -385,92 +381,92 @@ static inline void RENAME(doVertLowPass)(uint8_t *src, stride_t stride, PPContex
static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP)
{
#if HAVE_MMX2 || HAVE_AMD3DNOW
- src += stride * 3;
+ src+= stride*3;
// FIXME rounding
- asm volatile(
- "pxor %%mm7, %%mm7 \n\t" // 0
- "movq "MANGLE(b80)", %%mm6 \n\t" // MIN_SIGNED_BYTE
- "leal (%0, %1), %%"REG_a" \n\t"
- "leal (%%"REG_a", %1, 4), %%"REG_c" \n\t"
+ asm volatile(
+ "pxor %%mm7, %%mm7 \n\t" // 0
+ "movq "MANGLE(b80)", %%mm6 \n\t" // MIN_SIGNED_BYTE
+ "leal (%0, %1), %%"REG_a" \n\t"
+ "leal (%%"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 "MANGLE(pQPb)", %%mm0 \n\t" // QP,..., QP
- "movq %%mm0, %%mm1 \n\t" // QP,..., QP
- "paddusb "MANGLE(b02)", %%mm0 \n\t"
- "psrlw $2, %%mm0 \n\t"
- "pand "MANGLE(b3F)", %%mm0 \n\t" // QP/4,..., QP/4
- "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ...
- "movq (%0, %1, 4), %%mm2 \n\t" // line 4
- "movq (%%"REG_c"), %%mm3 \n\t" // line 5
- "movq %%mm2, %%mm4 \n\t" // line 4
- "pcmpeqb %%mm5, %%mm5 \n\t" // -1
- "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1
- PAVGB(%%mm3, %%mm5)
- "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2
- "psubusb %%mm3, %%mm4 \n\t"
- "psubusb %%mm2, %%mm3 \n\t"
- "por %%mm3, %%mm4 \n\t" // |l4 - l5|
- "psubusb %%mm0, %%mm4 \n\t"
- "pcmpeqb %%mm7, %%mm4 \n\t"
- "pand %%mm4, %%mm5 \n\t" // d/2
+ "movq "MANGLE(pQPb)", %%mm0 \n\t" // QP,..., QP
+ "movq %%mm0, %%mm1 \n\t" // QP,..., QP
+ "paddusb "MANGLE(b02)", %%mm0 \n\t"
+ "psrlw $2, %%mm0 \n\t"
+ "pand "MANGLE(b3F)", %%mm0 \n\t" // QP/4,..., QP/4
+ "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ...
+ "movq (%0, %1, 4), %%mm2 \n\t" // line 4
+ "movq (%%"REG_c"), %%mm3 \n\t" // line 5
+ "movq %%mm2, %%mm4 \n\t" // line 4
+ "pcmpeqb %%mm5, %%mm5 \n\t" // -1
+ "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1
+ PAVGB(%%mm3, %%mm5)
+ "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2
+ "psubusb %%mm3, %%mm4 \n\t"
+ "psubusb %%mm2, %%mm3 \n\t"
+ "por %%mm3, %%mm4 \n\t" // |l4 - l5|
+ "psubusb %%mm0, %%mm4 \n\t"
+ "pcmpeqb %%mm7, %%mm4 \n\t"
+ "pand %%mm4, %%mm5 \n\t" // d/2
// "paddb %%mm6, %%mm2 \n\t" // line 4 + 0x80
- "paddb %%mm5, %%mm2 \n\t"
+ "paddb %%mm5, %%mm2 \n\t"
// "psubb %%mm6, %%mm2 \n\t"
- "movq %%mm2, (%0,%1, 4) \n\t"
+ "movq %%mm2, (%0,%1, 4) \n\t"
- "movq (%%"REG_c"), %%mm2 \n\t"
+ "movq (%%"REG_c"), %%mm2 \n\t"
// "paddb %%mm6, %%mm2 \n\t" // line 5 + 0x80
- "psubb %%mm5, %%mm2 \n\t"
+ "psubb %%mm5, %%mm2 \n\t"
// "psubb %%mm6, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_c") \n\t"
-
- "paddb %%mm6, %%mm5 \n\t"
- "psrlw $2, %%mm5 \n\t"
- "pand "MANGLE(b3F)", %%mm5 \n\t"
- "psubb "MANGLE(b20)", %%mm5 \n\t" // (l5-l4)/8
-
- "movq (%%"REG_a", %1, 2), %%mm2 \n\t"
- "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80
- "paddsb %%mm5, %%mm2 \n\t"
- "psubb %%mm6, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
-
- "movq (%%"REG_c", %1), %%mm2 \n\t"
- "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80
- "psubsb %%mm5, %%mm2 \n\t"
- "psubb %%mm6, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_c", %1) \n\t"
-
- :
- : "r"(src), "r"((stride_t)stride)
- : "%"REG_a, "%"REG_c
- );
+ "movq %%mm2, (%%"REG_c") \n\t"
+
+ "paddb %%mm6, %%mm5 \n\t"
+ "psrlw $2, %%mm5 \n\t"
+ "pand "MANGLE(b3F)", %%mm5 \n\t"
+ "psubb "MANGLE(b20)", %%mm5 \n\t" // (l5-l4)/8
+
+ "movq (%%"REG_a", %1, 2), %%mm2 \n\t"
+ "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80
+ "paddsb %%mm5, %%mm2 \n\t"
+ "psubb %%mm6, %%mm2 \n\t"
+ "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
+
+ "movq (%%"REG_c", %1), %%mm2 \n\t"
+ "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80
+ "psubsb %%mm5, %%mm2 \n\t"
+ "psubb %%mm6, %%mm2 \n\t"
+ "movq %%mm2, (%%"REG_c", %1) \n\t"
+
+ :
+ : "r" (src), "r" ((stride_t)stride)
+ : "%"REG_a, "%"REG_c
+ );
#else
- 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 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;
- const int QP15 = QP + (QP >> 2);
- src += stride * 3;
- for(x = 0; x < BLOCK_SIZE; x++)
- {
- const int v = (src[x+l5] - src[x+l4]);
- if(ABS(v) < QP15)
- {
- src[x+l3] += v >> 3;
- src[x+l4] += v >> 1;
- src[x+l5] -= v >> 1;
- src[x+l6] -= v >> 3;
-
- }
- }
+ int x;
+ const int QP15= QP + (QP>>2);
+ src+= stride*3;
+ for(x=0; x<BLOCK_SIZE; x++)
+ {
+ const int v = (src[x+l5] - src[x+l4]);
+ if(ABS(v) < QP15)
+ {
+ src[x+l3] +=v>>3;
+ src[x+l4] +=v>>1;
+ src[x+l5] -=v>>1;
+ src[x+l6] -=v>>3;
+
+ }
+ }
#endif
}
@@ -486,128 +482,128 @@ static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP)
static inline void RENAME(vertX1Filter)(uint8_t *src, stride_t stride, PPContext *co)
{
#if HAVE_MMX2 || HAVE_AMD3DNOW
- src += stride * 3;
+ 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"
+ 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"((stride_t)stride), "m"(co->pQPb)
- : "%"REG_a, "%"REG_c
- );
+ "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" ((stride_t)stride), "m" (co->pQPb)
+ : "%"REG_a, "%"REG_c
+ );
#else
- const stride_t l1 = stride;
- const stride_t l2 = stride + l1;
- const stride_t l3 = stride + l2;
- const stride_t l4 = stride + l3;
- const stride_t l5 = stride + l4;
- const stride_t l6 = stride + l5;
- const stride_t l7 = stride + l6;
+ const stride_t l1= stride;
+ const stride_t l2= stride + l1;
+ const stride_t l3= stride + l2;
+ const stride_t l4= stride + l3;
+ const stride_t l5= stride + l4;
+ const stride_t l6= stride + l5;
+ const stride_t 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 = ABS(b) - ((ABS(a) + ABS(c)) >> 1);
- d = MAX(d, 0);
-
- if(d < co->QP * 2)
- {
- int v = d * SIGN(-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++;
- }
+ 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= ABS(b) - ((ABS(a) + ABS(c))>>1);
+ d= MAX(d, 0);
+
+ if(d < co->QP*2)
+ {
+ int v = d * SIGN(-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
}
@@ -615,570 +611,570 @@ static inline void RENAME(vertX1Filter)(uint8_t *src, stride_t stride, PPContext
static inline void RENAME(doVertDefFilter)(uint8_t src[], stride_t 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(
+/*
+ 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 //sligtly 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"
+ "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
+ "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)
+ "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
+ "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"
+ 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"
+ "movq %%mm3, %%mm1 \n\t"
// "psubusb "MANGLE(b01)", %%mm3 \n\t"
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm7, %%mm3)
- "paddusb %%mm1, %%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"
+ "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
- "lea (%0, %1), %%"REG_a" \n\t"
- "pcmpeqb %%mm6, %%mm6 \n\t" // -1
+ "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
+ "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
+ "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
+ "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
+ 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
+ "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
+ "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"((stride_t)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(ABS(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= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) );
- d= MAX(d, 0);
-
- d= (5*d + 32) >> 6;
- d*= SIGN(-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= ABS(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)
- {
- printf(" %d %d %d %d\n", num, sum, max, bias);
- }
- }
- }
- }
- */
+ "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" ((stride_t)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(ABS(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= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) );
+ d= MAX(d, 0);
+
+ d= (5*d + 32) >> 6;
+ d*= SIGN(-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= ABS(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)
+ {
+ printf(" %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
+ 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
+ "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
+ "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|
+ "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|
+ "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"
+ "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"
+ "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"
+ "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|
+ "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"
+ "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"
+ "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"
+ "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"((stride_t)stride), "m"(c->pQPb)
- : "%"REG_a, "%"REG_c
- );
+ "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" ((stride_t)stride), "m" (c->pQPb)
+ : "%"REG_a, "%"REG_c
+ );
#else
- const stride_t l1 = stride;
- const stride_t l2 = stride + l1;
- const stride_t l3 = stride + l2;
- const stride_t l4 = stride + l3;
- const stride_t l5 = stride + l4;
- const stride_t l6 = stride + l5;
- const stride_t l7 = stride + l6;
- const stride_t l8 = stride + l7;
+ const stride_t l1= stride;
+ const stride_t l2= stride + l1;
+ const stride_t l3= stride + l2;
+ const stride_t l4= stride + l3;
+ const stride_t l5= stride + l4;
+ const stride_t l6= stride + l5;
+ const stride_t l7= stride + l6;
+ const stride_t 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(ABS(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 = ABS(middleEnergy) - MIN(ABS(leftEnergy), ABS(rightEnergy));
- d = MAX(d, 0);
-
- d = (5 * d + 32) >> 6;
- d *= SIGN(-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++;
- }
+ 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(ABS(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= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) );
+ d= MAX(d, 0);
+
+ d= (5*d + 32) >> 6;
+ d*= SIGN(-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
}
#endif //HAVE_ALTIVEC
@@ -1187,18 +1183,18 @@ static inline void RENAME(doVertDefFilter)(uint8_t src[], stride_t stride, PPCon
static inline void RENAME(dering)(uint8_t src[], stride_t 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"
+ 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
@@ -1220,118 +1216,118 @@ static inline void RENAME(dering)(uint8_t src[], stride_t stride, PPContext *c)
#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"
+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"
+ "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"
+ "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"
+ "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"
+ "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"
+ "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"
+ "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] */\
@@ -1381,160 +1377,160 @@ static inline void RENAME(dering)(uint8_t src[], stride_t stride, PPContext *c)
#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
+/*
+0000000
+1111111
- 1111110
- 1111101
- 1111100
- 1111011
- 1111010
- 1111001
+1111110
+1111101
+1111100
+1111011
+1111010
+1111001
- 1111000
- 1110111
+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"((stride_t)stride), "m"(c->pQPb), "m"(c->pQPb2)
- : "%"REG_a, "%"REG_d, "%"REG_c
- );
+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" ((stride_t)stride), "m" (c->pQPb), "m"(c->pQPb2)
+ : "%"REG_a, "%"REG_d, "%"REG_c
+ );
#else
- 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;
+ 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++;
+ 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 numSkiped = 0;
- static int errorSum = 0;
- static int worstQP = 0;
- static int worstRange = 0;
- static int worstDiff = 0;
- int diff = (f - *p);
- int absDiff = ABS(diff);
- int error = diff * diff;
-
- if(x == 1 || x == 8 || y == 1 || y == 8) continue;
-
- numSkiped++;
- if(absDiff > worstDiff)
- {
- worstDiff = absDiff;
- worstQP = QP;
- worstRange = max - min;
- }
- errorSum += error;
-
- if(1024LL * 1024LL * 1024LL % numSkiped == 0)
- {
- }
- }
- }
+ if(max-min < 20)
+ {
+ static int numSkiped=0;
+ static int errorSum=0;
+ static int worstQP=0;
+ static int worstRange=0;
+ static int worstDiff=0;
+ int diff= (f - *p);
+ int absDiff= ABS(diff);
+ int error= diff*diff;
+
+ if(x==1 || x==8 || y==1 || y==8) continue;
+
+ numSkiped++;
+ if(absDiff > worstDiff)
+ {
+ worstDiff= absDiff;
+ worstQP= QP;
+ worstRange= max-min;
+ }
+ errorSum+= error;
+
+ if(1024LL*1024LL*1024LL % numSkiped == 0)
+ {
+ }
+ }
+ }
#endif
- if(*p + QP2 < f) *p = *p + QP2;
- else if(*p - QP2 > f) *p = *p - QP2;
- else *p = f;
- }
- }
- }
+ 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 = MIN(*p + 20, 255);
- }
- }
+ 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 = MIN(*p + 20, 255);
+ }
+ }
// src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
- }
+ }
#endif
#endif
}
@@ -1549,47 +1545,46 @@ static inline void RENAME(dering)(uint8_t src[], stride_t stride, PPContext *c)
static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], stride_t 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"
+ 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"((stride_t)stride)
- : "%"REG_a, "%"REG_c
- );
+ "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" ((stride_t)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;
- }
+ 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
}
@@ -1603,13 +1598,13 @@ static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], stride_t
static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], stride_t 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"
+ 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
@@ -1636,25 +1631,25 @@ static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], stride_t s
"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))
+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"((stride_t)stride)
- : "%"REG_a, "%"REG_d, "%"REG_c
- );
+ : : "r" (src), "r" ((stride_t)stride)
+ : "%"REG_a, "%"REG_d, "%"REG_c
+ );
#else
- 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++;
- }
+ 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
}
@@ -1668,12 +1663,12 @@ static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], stride_t s
static inline void RENAME(deInterlaceFF)(uint8_t src[], stride_t 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"
+ 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
@@ -1704,37 +1699,37 @@ static inline void RENAME(deInterlaceFF)(uint8_t src[], stride_t stride, uint8_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))
+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"((stride_t)stride), "r"(tmp)
- : "%"REG_a, "%"REG_d
- );
+ "movq %%mm0, (%2) \n\t"
+ : : "r" (src), "r" ((stride_t)stride), "r"(tmp)
+ : "%"REG_a, "%"REG_d
+ );
#else
- 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++;
- }
+ 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
}
@@ -1748,13 +1743,13 @@ static inline void RENAME(deInterlaceFF)(uint8_t src[], stride_t stride, uint8_t
static inline void RENAME(deInterlaceL5)(uint8_t src[], stride_t 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"
+ 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
@@ -1790,53 +1785,53 @@ static inline void RENAME(deInterlaceL5)(uint8_t src[], stride_t stride, uint8_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"((stride_t)stride), "r"(tmp), "r"(tmp2)
- : "%"REG_a, "%"REG_d
- );
+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" ((stride_t)stride), "r"(tmp), "r"(tmp2)
+ : "%"REG_a, "%"REG_d
+ );
#else
- 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++;
- }
+ 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
}
@@ -1850,96 +1845,95 @@ static inline void RENAME(deInterlaceL5)(uint8_t src[], stride_t stride, uint8_t
static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], stride_t 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"
+ 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"((stride_t)stride), "r"(tmp)
- : "%"REG_a, "%"REG_d
- );
+ "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" ((stride_t)stride), "r" (tmp)
+ : "%"REG_a, "%"REG_d
+ );
#else
- 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;
- }
+ 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
}
@@ -1952,63 +1946,63 @@ static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], stride_t stride
static inline void RENAME(deInterlaceMedian)(uint8_t src[], stride_t stride)
{
#if HAVE_MMX
- src += 4 * stride;
+ src+= 4*stride;
#if HAVE_MMX2
- asm volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
+ 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"((stride_t)stride)
- : "%"REG_a, "%"REG_d
- );
+ "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" ((stride_t)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"
+ 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"
+ "pxor %%mm7, %%mm7 \n\t"
#define REAL_MEDIAN(a,b,c)\
"movq " #a ", %%mm0 \n\t"\
@@ -2035,36 +2029,36 @@ static inline void RENAME(deInterlaceMedian)(uint8_t src[], stride_t stride)
"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))
+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"((stride_t)stride)
- : "%"REG_a, "%"REG_d
- );
+ : : "r" (src), "r" ((stride_t)stride)
+ : "%"REG_a, "%"REG_d
+ );
#endif // MMX
#else
- 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++;
- }
+ 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
}
@@ -2074,84 +2068,84 @@ static inline void RENAME(deInterlaceMedian)(uint8_t src[], stride_t stride)
*/
static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
{
- asm(
- "lea (%0, %1), %%"REG_a" \n\t"
+ 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"((stride_t)srcStride), "r"(dst1), "r"(dst2)
- : "%"REG_a
- );
+ "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" ((stride_t)srcStride), "r" (dst1), "r" (dst2)
+ : "%"REG_a
+ );
}
/**
@@ -2159,132 +2153,132 @@ static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src
*/
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"
+ 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"((stride_t)dstStride), "r"(src)
- : "%"REG_a, "%"REG_d
- );
+ "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" ((stride_t)dstStride), "r" (src)
+ : "%"REG_a, "%"REG_d
+ );
}
#endif
//static long test=0;
#ifndef HAVE_ALTIVEC
static inline void RENAME(tempNoiseReducer)(uint8_t *src, stride_t stride,
- uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
+ uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
{
- // to save a register (FIXME do this outside of the loops)
- tempBluredPast[127] = maxNoise[0];
- tempBluredPast[128] = maxNoise[1];
- tempBluredPast[129] = maxNoise[2];
+ // to save a register (FIXME do this outside of the loops)
+ tempBluredPast[127]= maxNoise[0];
+ tempBluredPast[128]= maxNoise[1];
+ tempBluredPast[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
+ 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"
+ "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
#if defined (FAST_L2_DIFF)
- "pcmpeqb %%mm7, %%mm7 \n\t"
- "movq "MANGLE(b80)", %%mm6 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
+ "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"\
@@ -2300,8 +2294,8 @@ static inline void RENAME(tempNoiseReducer)(uint8_t *src, stride_t stride,
"paddd %%mm5, %%mm0 \n\t"
#else
- "pxor %%mm7, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
+ "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"\
@@ -2322,323 +2316,323 @@ static inline void RENAME(tempNoiseReducer)(uint8_t *src, stride_t stride,
#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))
+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
- "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"
+ "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"(tempBlured), "r"((stride_t)stride), "m"(tempBluredPast)
- : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
- );
+ "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" (tempBlured), "r"((stride_t)stride), "m" (tempBluredPast)
+ : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
+ );
//printf("%d\n", test);
#else
- {
- int y;
- int d = 0;
+{
+ 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 = tempBlured[ x + y*stride ];
- int cur = src[ x + y*stride ];
- int d1 = ref - cur;
+ int i;
+
+ for(y=0; y<8; y++)
+ {
+ int x;
+ for(x=0; x<8; x++)
+ {
+ int ref= tempBlured[ 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+= ABS(d1);
- d += d1 * d1;
+ d+= d1*d1;
// sysd+= d1;
- }
- }
- i = d;
- d = (
- 4 * d
- + (*(tempBluredPast - 256))
- + (*(tempBluredPast - 1)) + (*(tempBluredPast + 1))
- + (*(tempBluredPast + 256))
- + 4) >> 3;
- *tempBluredPast = i;
+ }
+ }
+ i=d;
+ d= (
+ 4*d
+ +(*(tempBluredPast-256))
+ +(*(tempBluredPast-1))+ (*(tempBluredPast+1))
+ +(*(tempBluredPast+256))
+ +4)>>3;
+ *tempBluredPast=i;
// ((*tempBluredPast)*3 + d + 2)>>2;
//printf("%d %d %d\n", maxNoise[0], maxNoise[1], maxNoise[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 = tempBlured[ x + y*stride ];
- int cur = src[ x + y*stride ];
- tempBlured[ 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++)
- {
- tempBlured[ 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 = tempBlured[ x + y*stride ];
- int cur = src[ x + y*stride ];
- tempBlured[ 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 = tempBlured[ x + y*stride ];
- int cur = src[ x + y*stride ];
- tempBlured[ x + y*stride ] =
- src[ x + y*stride ] =
- (ref * 3 + cur + 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= tempBlured[ x + y*stride ];
+ int cur= src[ x + y*stride ];
+ tempBlured[ 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++)
+ {
+ tempBlured[ 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= tempBlured[ x + y*stride ];
+ int cur= src[ x + y*stride ];
+ tempBlured[ 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= tempBlured[ x + y*stride ];
+ int cur= src[ x + y*stride ];
+ tempBlured[ x + y*stride ]=
+ src[ x + y*stride ]=
+ (ref*3 + cur + 2)>>2;
+ }
+ }
+ }
+ }
+}
#endif
}
#endif //HAVE_ALTIVEC
@@ -2647,170 +2641,168 @@ static inline void RENAME(tempNoiseReducer)(uint8_t *src, stride_t stride,
/**
* 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
+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"
+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"((stride_t)step), "m"(c->pQPb), "m"(c->ppMode.flatnessThreshold)
- : "%"REG_a
- );
-
- both_masks = dc_mask & eq_mask;
-
- if(both_masks)
- {
- stride_t 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"
+ "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" ((stride_t)step), "m" (c->pQPb), "m"(c->ppMode.flatnessThreshold)
+ : "%"REG_a
+ );
+
+ both_masks = dc_mask & eq_mask;
+
+ if(both_masks){
+ stride_t 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"\
@@ -2831,362 +2823,360 @@ static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int st
"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"((stride_t)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"((stride_t)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
+ 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" ((stride_t)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" ((stride_t)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
+ "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
+ "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|
+ "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|
+ "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"
+ "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"
+ "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"
+ "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|
+ "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"
+ "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"
+ "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"
+ "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"((stride_t)step), "m"(c->pQPb), "m"(eq_mask)
- : "%"REG_a, "%"REG_c
- );
- }
- /*if(step==16){
- STOP_TIMER("step16")
- }else{
- STOP_TIMER("stepX")
- }*/
+ "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" ((stride_t)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)(uint8_t src[], stride_t srcStride, uint8_t dst[], stride_t dstStride, int width, int height,
- QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
+ QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
/**
* Copies a block from src to dst and fixes the blacklevel
@@ -3195,20 +3185,20 @@ static void RENAME(postProcess)(uint8_t src[], stride_t srcStride, uint8_t dst[]
#undef SCALED_CPY
static inline void RENAME(blockCopy)(uint8_t dst[], stride_t dstStride, uint8_t src[], stride_t srcStride,
- int levelFix, int64_t *packedOffsetAndScale)
+ int levelFix, int64_t *packedOffsetAndScale)
{
#if !HAVE_MMX
- int i;
+ int i;
#endif
- if(levelFix)
- {
+ 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"
+ 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"\
@@ -3231,7 +3221,7 @@ static inline void RENAME(blockCopy)(uint8_t dst[], stride_t dstStride, uint8_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"\
@@ -3258,68 +3248,68 @@ static inline void RENAME(blockCopy)(uint8_t dst[], stride_t dstStride, uint8_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"((stride_t)srcStride),
- "r"((stride_t)dstStride)
- : "%"REG_d
- );
+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" ((stride_t)srcStride),
+ "r" ((stride_t)dstStride)
+ : "%"REG_d
+ );
#else
- for(i = 0; i < 8; i++)
- memcpy(&(dst[dstStride*i]),
- &(src[srcStride*i]), BLOCK_SIZE);
+ for(i=0; i<8; i++)
+ memcpy( &(dst[dstStride*i]),
+ &(src[srcStride*i]), BLOCK_SIZE);
#endif
- }
- else
- {
+ }
+ else
+ {
#if HAVE_MMX
- asm volatile(
- "lea (%0,%2), %%"REG_a" \n\t"
- "lea (%1,%3), %%"REG_d" \n\t"
+ 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"((stride_t)srcStride),
- "r"((stride_t)dstStride)
- : "%"REG_a, "%"REG_d
- );
+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" ((stride_t)srcStride),
+ "r" ((stride_t)dstStride)
+ : "%"REG_a, "%"REG_d
+ );
#else
- for(i = 0; i < 8; i++)
- memcpy(&(dst[dstStride*i]),
- &(src[srcStride*i]), BLOCK_SIZE);
+ for(i=0; i<8; i++)
+ memcpy( &(dst[dstStride*i]),
+ &(src[srcStride*i]), BLOCK_SIZE);
#endif
- }
+ }
}
/**
@@ -3328,23 +3318,23 @@ static inline void RENAME(blockCopy)(uint8_t dst[], stride_t dstStride, uint8_t
static inline void RENAME(duplicate)(uint8_t src[], stride_t 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"((stride_t)-stride)
- );
+ 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" ((stride_t)-stride)
+ );
#else
- int i;
- uint8_t *p = src;
- for(i = 0; i < 3; i++)
- {
- p -= stride;
- memcpy(p, src, 8);
- }
+ int i;
+ uint8_t *p=src;
+ for(i=0; i<3; i++)
+ {
+ p-= stride;
+ memcpy(p, src, 8);
+ }
#endif
}
@@ -3352,512 +3342,503 @@ static inline void RENAME(duplicate)(uint8_t src[], stride_t stride)
* Filters array of bytes (Y or U or V values)
*/
static void RENAME(postProcess)(uint8_t src[], stride_t srcStride, uint8_t dst[], stride_t dstStride, int width, int height,
- QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
+ QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
{
- PPContext __attribute__((aligned(8))) c = *c2; //copy to stack for faster access
- int x, y;
+ PPContext __attribute__((aligned(8))) c= *c2; //copy to stack for faster access
+ int x,y;
#ifdef COMPILE_TIME_MODE
- const int mode = COMPILE_TIME_MODE;
+ const int mode= COMPILE_TIME_MODE;
#else
- const int mode = isColor ? c.ppMode.chromMode : c.ppMode.lumMode;
+ 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 black=0, white=255; // blackest black and whitest white in the picture
+ int QPCorrecture= 256*256;
- stride_t copyAhead;
+ stride_t copyAhead;
#if HAVE_MMX
- int i;
+ int i;
#endif
- const int qpHShift = isColor ? 4 - c.hChromaSubSample : 4;
- const int qpVShift = isColor ? 4 - c.vChromaSubSample : 4;
+ 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 = c.tempSrc + 24 * width;
- uint8_t * const tempDst = c.tempDst + 24 * width;
- //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
+ //FIXME remove
+ uint64_t * const yHistogram= c.yHistogram;
+ uint8_t * const tempSrc= c.tempSrc+24*width;
+ uint8_t * const tempDst= c.tempDst+24*width;
+ //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;
- }
+ 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;
+ 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];
+ 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];
// printf("%d ", yHistogram[i]);
- }
+ }
// printf("\n\n");
- /* we allways get a completly black picture first */
- maxClipped = (uint64_t)(sum * c.ppMode.maxClippedThreshold);
+ /* we allways get a completly 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(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];
- }
+ 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);
+ 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;
+ 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;
+ 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;
- {
- uint8_t *srcBlock = &(src[y*srcStride]);
- uint8_t *dstBlock = tempDst + dstStride;
-
- // From this point on it is guranteed 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)
- {
+ 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;
+ {
+ uint8_t *srcBlock= &(src[y*srcStride]);
+ uint8_t *dstBlock= tempDst + dstStride;
+
+ // From this point on it is guranteed 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"((stride_t)srcStride), "r"(dstBlock), "r"((stride_t)dstStride),
- "g"((stride_t)x), "g"(copyAhead)
- : "%"REG_a, "%"REG_d
- );
+/*
+ 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" ((stride_t)srcStride), "r" (dstBlock), "r" ((stride_t)dstStride),
+ "g" ((stride_t)x), "g" (copyAhead)
+ : "%"REG_a, "%"REG_d
+ );
#elif HAVE_AMD3DNOW
//FIXME check if this is faster on an 3dnow chip or if its 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);
- */
+/* 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 == dstStride)
- memcpy(dst, tempDst + 9 * dstStride, copyAhead * dstStride);
- else
- {
- int i;
- for(i = 0; i < copyAhead; i++)
- {
- memcpy(dst + i * dstStride, tempDst + (9 + i)*dstStride, width);
- }
- }
- }
+ 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==dstStride)
+ memcpy(dst, tempDst + 9*dstStride, copyAhead*dstStride );
+ else
+ {
+ int i;
+ for(i=0; i<copyAhead; i++)
+ {
+ memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width);
+ }
+ }
+ }
//printf("\n");
- for(y = 0; y < height; y += BLOCK_SIZE)
- {
- //1% speedup if these are here instead of the inner loop
- uint8_t *srcBlock = &(src[y*srcStride]);
- uint8_t *dstBlock = &(dst[y*dstStride]);
+ for(y=0; y<height; y+=BLOCK_SIZE)
+ {
+ //1% speedup if these are here instead of the inner loop
+ 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;
+ uint8_t *tempBlock1= c.tempBlocks;
+ uint8_t *tempBlock2= c.tempBlocks + 8;
#endif
- int8_t *QPptr = &QPs[(y>>qpVShift)*QPStride];
- int8_t *nonBQPptr = &c.nonBQPTable[(y>>qpVShift)*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 */
- for(i = 0; i < MAX(height - y - copyAhead, 0); i++)
- memcpy(tempSrc + srcStride * copyAhead + i * srcStride, srcBlock + srcStride * copyAhead + i * srcStride, width);
-
- /* duplicate last line of src to fill the void upto line (copyAhead+7) */
- for(i = MAX(height - y, 8); i < copyAhead + 8; i++)
- memcpy(tempSrc + srcStride * i, src + srcStride*(height - 1), width);
-
- /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
- for(i = 0; i < MIN(height - y + 1, copyAhead + 1); i++)
- memcpy(tempDst + i * dstStride, (dstBlock - dstStride) + i * dstStride, width);
-
- /* duplicate last line of dst to fill the void upto line (copyAhead) */
- for(i = height - y + 1; i <= copyAhead; i++)
- memcpy(tempDst + dstStride * i, dst + dstStride*(height - 1), width);
-
- dstBlock = tempDst + dstStride;
- srcBlock = tempSrc;
- }
+ int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
+ int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*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 */
+ for(i=0;i<MAX(height-y-copyAhead, 0);i++)
+ memcpy(tempSrc + srcStride*copyAhead+i*srcStride, srcBlock + srcStride*copyAhead+i*srcStride,width);
+
+ /* duplicate last line of src to fill the void upto line (copyAhead+7) */
+ for(i=MAX(height-y, 8); i<copyAhead+8; i++)
+ memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), width);
+
+ /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
+ for(i=0;i<MIN(height-y+1, copyAhead+1);i++)
+ memcpy(tempDst+i*dstStride, (dstBlock - dstStride)+i*dstStride, width);
+
+ /* duplicate last line of dst to fill the void upto line (copyAhead) */
+ for(i=height-y+1; i<=copyAhead; i++)
+ memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), width);
+
+ dstBlock= tempDst + dstStride;
+ srcBlock= tempSrc;
+ }
//printf("\n");
- // From this point on it is guranteed 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 stride_t stride = dstStride;
+ // From this point on it is guranteed 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 stride_t stride= dstStride;
#if HAVE_MMX
- uint8_t *tmpXchg;
+ 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(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)
- );
+ 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"((stride_t)srcStride), "r"(dstBlock), "r"((stride_t)dstStride),
- "g"((stride_t)x), "g"((long)copyAhead)
- : "%"REG_a, "%"REG_d
- );
+/*
+ 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" ((stride_t)srcStride), "r" (dstBlock), "r" ((stride_t)dstStride),
+ "g" ((stride_t)x), "g" ((long)copyAhead)
+ : "%"REG_a, "%"REG_d
+ );
#elif HAVE_AMD3DNOW
//FIXME check if this is faster on an 3dnow chip or if its 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);
- */
+/* 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);
- }
- }
+ 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);
+ RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride);
#endif
- /* check if we have a previous block to deblock it with dstBlock */
- if(x - 8 >= 0)
- {
+ /* 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)
- {
+ 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);
+ 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);
+ 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(mode & H_X1_FILTER)
+ horizX1Filter(dstBlock-4, stride, QP);
+ else if(mode & H_DEBLOCK)
+ {
#ifdef HAVE_ALTIVEC
- unsigned char __attribute__((aligned(16))) tempBlock[272];
- transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
-
- const int 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);
- }
+ unsigned char __attribute__ ((aligned(16))) tempBlock[272];
+ transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
+
+ const int 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);
+ 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);
+ 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);
- }
+ }else if(mode & H_A_DEBLOCK){
+ RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
+ }
#endif
- 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.tempBlured[isColor] + y * dstStride + x + 256,
- c.tempBluredPast[isColor] + (y >> 3) * 256 + (x >> 3) + 256,
- c.ppMode.maxTmpNoise);
- }
- }
-
- dstBlock += 8;
- srcBlock += 8;
+ 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.tempBlured[isColor] + y*dstStride + x+256,
+ c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3)+256,
+ c.ppMode.maxTmpNoise);
+ }
+ }
+
+ dstBlock+=8;
+ srcBlock+=8;
#if HAVE_MMX
- tmpXchg = tempBlock1;
- tempBlock1 = tempBlock2;
- tempBlock2 = tmpXchg;
+ 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.tempBlured[isColor] + y * dstStride + x + 256,
- c.tempBluredPast[isColor] + (y >> 3) * 256 + (x >> 3) + 256,
- 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 == dstStride)
- memcpy(dstBlock, tempDst + dstStride, dstStride*(height - y));
- 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(mode & DERING)
+ {
+ if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
+ }
+
+ if((mode & TEMP_NOISE_FILTER))
+ {
+ RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
+ c.tempBlured[isColor] + y*dstStride + x+256,
+ c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3)+256,
+ 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==dstStride)
+ memcpy(dstBlock, tempDst + dstStride, dstStride*(height-y) );
+ 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");
+ asm volatile("femms");
#elif HAVE_MMX
- asm volatile("emms");
+ 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;
- }
-
- }
+ 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
+ *c2= c; //copy local context back
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.c
index 4584728e1..dff5dfbf6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.c
@@ -38,18 +38,18 @@
#define FAST_BGR2YV12 // use 7-bit instead of 15-bit coefficients
-void (*rgb24to32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb24to16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb24to15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb32to24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb32to16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb32to15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb15to16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb15to24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb15to32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb16to15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb16to24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-void (*rgb16to32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
+void (*rgb24to32)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb24to16)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb24to15)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb32to24)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb32to16)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb32to15)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb15to16)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb15to24)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb15to32)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb16to15)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb16to24)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+void (*rgb16to32)(const uint8_t *src,uint8_t *dst,stride_t src_size);
//void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
@@ -60,41 +60,41 @@ void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
void (*yv12tovyuy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
void (*yv12toyvyu)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride);
void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride);
void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
- stride_t srcStride, stride_t dstStride);
+ stride_t srcStride, stride_t dstStride);
void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
- long width, long height, stride_t src1Stride,
- stride_t src2Stride, stride_t dstStride);
+ long width, long height, stride_t src1Stride,
+ stride_t src2Stride, stride_t dstStride);
void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dst1, uint8_t *dst2,
- long width, long height,
- stride_t srcStride1, stride_t srcStride2,
- stride_t dstStride1, stride_t dstStride2);
+ uint8_t *dst1, uint8_t *dst2,
+ long width, long height,
+ stride_t srcStride1, stride_t srcStride2,
+ stride_t dstStride1, stride_t dstStride2);
void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
- long width, long height,
- stride_t srcStride1, stride_t srcStride2,
- stride_t srcStride3, stride_t dstStride);
+ uint8_t *dst,
+ long width, long height,
+ stride_t srcStride1, stride_t srcStride2,
+ stride_t srcStride3, stride_t dstStride);
#if ARCH_X86 && CONFIG_GPL
DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
@@ -142,7 +142,7 @@ static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0
static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL;
#endif
static const uint64_t bgr2YOffset attribute_used __attribute__((aligned(8))) = 0x1010101010101010ULL;
-static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8))) = 0x8080808080808080ULL;
+static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8)))= 0x8080808080808080ULL;
static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0x0001000100010001ULL;
#endif /* ARCH_X86 */
@@ -205,140 +205,133 @@ static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0
32-bit C version, and and&add trick by Michael Niedermayer
*/
-void sws_rgb2rgb_init(SwsParams *params)
-{
- yv12toyvyu = yv12toyvyu_C;
- yv12tovyuy = yv12tovyuy_C;
+void sws_rgb2rgb_init(SwsParams *params){
+ yv12toyvyu= yv12toyvyu_C;
+ yv12tovyuy= yv12tovyuy_C;
#if ARCH_X86_32 || ARCH_X86_64
- if(params->cpu & SWS_CPU_CAPS_MMX2)
- {
- rgb15to16 = rgb15to16_MMX2;
- rgb15to24 = rgb15to24_MMX2;
- rgb15to32 = rgb15to32_MMX2;
- rgb16to24 = rgb16to24_MMX2;
- rgb16to32 = rgb16to32_MMX2;
- rgb16to15 = rgb16to15_MMX2;
- rgb24to16 = rgb24to16_MMX2;
- rgb24to15 = rgb24to15_MMX2;
- rgb24to32 = rgb24to32_MMX2;
- rgb32to16 = rgb32to16_MMX2;
- rgb32to15 = rgb32to15_MMX2;
- rgb32to24 = rgb32to24_MMX2;
- rgb24tobgr15 = rgb24tobgr15_MMX2;
- rgb24tobgr16 = rgb24tobgr16_MMX2;
- rgb24tobgr24 = rgb24tobgr24_MMX2;
- rgb32tobgr32 = rgb32tobgr32_MMX2;
- rgb32tobgr16 = rgb32tobgr16_MMX2;
- rgb32tobgr15 = rgb32tobgr15_MMX2;
- yv12toyuy2 = yv12toyuy2_MMX2;
- yv12touyvy = yv12touyvy_MMX2;
- yuv422ptoyuy2 = yuv422ptoyuy2_MMX2;
- yuy2toyv12 = yuy2toyv12_MMX2;
+ if(params->cpu & SWS_CPU_CAPS_MMX2){
+ rgb15to16= rgb15to16_MMX2;
+ rgb15to24= rgb15to24_MMX2;
+ rgb15to32= rgb15to32_MMX2;
+ rgb16to24= rgb16to24_MMX2;
+ rgb16to32= rgb16to32_MMX2;
+ rgb16to15= rgb16to15_MMX2;
+ rgb24to16= rgb24to16_MMX2;
+ rgb24to15= rgb24to15_MMX2;
+ rgb24to32= rgb24to32_MMX2;
+ rgb32to16= rgb32to16_MMX2;
+ rgb32to15= rgb32to15_MMX2;
+ rgb32to24= rgb32to24_MMX2;
+ rgb24tobgr15= rgb24tobgr15_MMX2;
+ rgb24tobgr16= rgb24tobgr16_MMX2;
+ rgb24tobgr24= rgb24tobgr24_MMX2;
+ rgb32tobgr32= rgb32tobgr32_MMX2;
+ rgb32tobgr16= rgb32tobgr16_MMX2;
+ rgb32tobgr15= rgb32tobgr15_MMX2;
+ yv12toyuy2= yv12toyuy2_MMX2;
+ yv12touyvy= yv12touyvy_MMX2;
+ yuv422ptoyuy2= yuv422ptoyuy2_MMX2;
+ yuy2toyv12= yuy2toyv12_MMX2;
// uyvytoyv12= uyvytoyv12_MMX2;
// yvu9toyv12= yvu9toyv12_MMX2;
- planar2x = planar2x_MMX2;
- rgb24toyv12 = rgb24toyv12_MMX2;
- interleaveBytes = interleaveBytes_MMX2;
- vu9_to_vu12 = vu9_to_vu12_MMX2;
- yvu9_to_yuy2 = yvu9_to_yuy2_MMX2;
- }
- else if(params->cpu & SWS_CPU_CAPS_3DNOW)
- {
- rgb15to16 = rgb15to16_3DNOW;
- rgb15to24 = rgb15to24_3DNOW;
- rgb15to32 = rgb15to32_3DNOW;
- rgb16to24 = rgb16to24_3DNOW;
- rgb16to32 = rgb16to32_3DNOW;
- rgb16to15 = rgb16to15_3DNOW;
- rgb24to16 = rgb24to16_3DNOW;
- rgb24to15 = rgb24to15_3DNOW;
- rgb24to32 = rgb24to32_3DNOW;
- rgb32to16 = rgb32to16_3DNOW;
- rgb32to15 = rgb32to15_3DNOW;
- rgb32to24 = rgb32to24_3DNOW;
- rgb24tobgr15 = rgb24tobgr15_3DNOW;
- rgb24tobgr16 = rgb24tobgr16_3DNOW;
- rgb24tobgr24 = rgb24tobgr24_3DNOW;
- rgb32tobgr32 = rgb32tobgr32_3DNOW;
- rgb32tobgr16 = rgb32tobgr16_3DNOW;
- rgb32tobgr15 = rgb32tobgr15_3DNOW;
- yv12toyuy2 = yv12toyuy2_3DNOW;
- yv12touyvy = yv12touyvy_3DNOW;
- yuv422ptoyuy2 = yuv422ptoyuy2_3DNOW;
- yuy2toyv12 = yuy2toyv12_3DNOW;
+ planar2x= planar2x_MMX2;
+ rgb24toyv12= rgb24toyv12_MMX2;
+ interleaveBytes= interleaveBytes_MMX2;
+ vu9_to_vu12= vu9_to_vu12_MMX2;
+ yvu9_to_yuy2= yvu9_to_yuy2_MMX2;
+ }else if(params->cpu & SWS_CPU_CAPS_3DNOW){
+ rgb15to16= rgb15to16_3DNOW;
+ rgb15to24= rgb15to24_3DNOW;
+ rgb15to32= rgb15to32_3DNOW;
+ rgb16to24= rgb16to24_3DNOW;
+ rgb16to32= rgb16to32_3DNOW;
+ rgb16to15= rgb16to15_3DNOW;
+ rgb24to16= rgb24to16_3DNOW;
+ rgb24to15= rgb24to15_3DNOW;
+ rgb24to32= rgb24to32_3DNOW;
+ rgb32to16= rgb32to16_3DNOW;
+ rgb32to15= rgb32to15_3DNOW;
+ rgb32to24= rgb32to24_3DNOW;
+ rgb24tobgr15= rgb24tobgr15_3DNOW;
+ rgb24tobgr16= rgb24tobgr16_3DNOW;
+ rgb24tobgr24= rgb24tobgr24_3DNOW;
+ rgb32tobgr32= rgb32tobgr32_3DNOW;
+ rgb32tobgr16= rgb32tobgr16_3DNOW;
+ rgb32tobgr15= rgb32tobgr15_3DNOW;
+ yv12toyuy2= yv12toyuy2_3DNOW;
+ yv12touyvy= yv12touyvy_3DNOW;
+ yuv422ptoyuy2= yuv422ptoyuy2_3DNOW;
+ yuy2toyv12= yuy2toyv12_3DNOW;
// uyvytoyv12= uyvytoyv12_3DNOW;
// yvu9toyv12= yvu9toyv12_3DNOW;
- planar2x = planar2x_3DNOW;
- rgb24toyv12 = rgb24toyv12_3DNOW;
- interleaveBytes = interleaveBytes_3DNOW;
- vu9_to_vu12 = vu9_to_vu12_3DNOW;
- yvu9_to_yuy2 = yvu9_to_yuy2_3DNOW;
- }
- else if(params->cpu & SWS_CPU_CAPS_MMX)
- {
- rgb15to16 = rgb15to16_MMX;
- rgb15to24 = rgb15to24_MMX;
- rgb15to32 = rgb15to32_MMX;
- rgb16to24 = rgb16to24_MMX;
- rgb16to32 = rgb16to32_MMX;
- rgb16to15 = rgb16to15_MMX;
- rgb24to16 = rgb24to16_MMX;
- rgb24to15 = rgb24to15_MMX;
- rgb24to32 = rgb24to32_MMX;
- rgb32to16 = rgb32to16_MMX;
- rgb32to15 = rgb32to15_MMX;
- rgb32to24 = rgb32to24_MMX;
- rgb24tobgr15 = rgb24tobgr15_MMX;
- rgb24tobgr16 = rgb24tobgr16_MMX;
- rgb24tobgr24 = rgb24tobgr24_MMX;
- rgb32tobgr32 = rgb32tobgr32_MMX;
- rgb32tobgr16 = rgb32tobgr16_MMX;
- rgb32tobgr15 = rgb32tobgr15_MMX;
- yv12toyuy2 = yv12toyuy2_MMX;
- yv12touyvy = yv12touyvy_MMX;
- yuv422ptoyuy2 = yuv422ptoyuy2_MMX;
- yuy2toyv12 = yuy2toyv12_MMX;
+ planar2x= planar2x_3DNOW;
+ rgb24toyv12= rgb24toyv12_3DNOW;
+ interleaveBytes= interleaveBytes_3DNOW;
+ vu9_to_vu12= vu9_to_vu12_3DNOW;
+ yvu9_to_yuy2= yvu9_to_yuy2_3DNOW;
+ }else if(params->cpu & SWS_CPU_CAPS_MMX){
+ rgb15to16= rgb15to16_MMX;
+ rgb15to24= rgb15to24_MMX;
+ rgb15to32= rgb15to32_MMX;
+ rgb16to24= rgb16to24_MMX;
+ rgb16to32= rgb16to32_MMX;
+ rgb16to15= rgb16to15_MMX;
+ rgb24to16= rgb24to16_MMX;
+ rgb24to15= rgb24to15_MMX;
+ rgb24to32= rgb24to32_MMX;
+ rgb32to16= rgb32to16_MMX;
+ rgb32to15= rgb32to15_MMX;
+ rgb32to24= rgb32to24_MMX;
+ rgb24tobgr15= rgb24tobgr15_MMX;
+ rgb24tobgr16= rgb24tobgr16_MMX;
+ rgb24tobgr24= rgb24tobgr24_MMX;
+ rgb32tobgr32= rgb32tobgr32_MMX;
+ rgb32tobgr16= rgb32tobgr16_MMX;
+ rgb32tobgr15= rgb32tobgr15_MMX;
+ yv12toyuy2= yv12toyuy2_MMX;
+ yv12touyvy= yv12touyvy_MMX;
+ yuv422ptoyuy2= yuv422ptoyuy2_MMX;
+ yuy2toyv12= yuy2toyv12_MMX;
// uyvytoyv12= uyvytoyv12_MMX;
// yvu9toyv12= yvu9toyv12_MMX;
- planar2x = planar2x_MMX;
- rgb24toyv12 = rgb24toyv12_MMX;
- interleaveBytes = interleaveBytes_MMX;
- vu9_to_vu12 = vu9_to_vu12_MMX;
- yvu9_to_yuy2 = yvu9_to_yuy2_MMX;
- }
- else
+ planar2x= planar2x_MMX;
+ rgb24toyv12= rgb24toyv12_MMX;
+ interleaveBytes= interleaveBytes_MMX;
+ vu9_to_vu12= vu9_to_vu12_MMX;
+ yvu9_to_yuy2= yvu9_to_yuy2_MMX;
+ }else
#endif /* ARCH_X86_32 || ARCH_X86_64 */
- {
- rgb15to16 = rgb15to16_C;
- rgb15to24 = rgb15to24_C;
- rgb15to32 = rgb15to32_C;
- rgb16to24 = rgb16to24_C;
- rgb16to32 = rgb16to32_C;
- rgb16to15 = rgb16to15_C;
- rgb24to16 = rgb24to16_C;
- rgb24to15 = rgb24to15_C;
- rgb24to32 = rgb24to32_C;
- rgb32to16 = rgb32to16_C;
- rgb32to15 = rgb32to15_C;
- rgb32to24 = rgb32to24_C;
- rgb24tobgr15 = rgb24tobgr15_C;
- rgb24tobgr16 = rgb24tobgr16_C;
- rgb24tobgr24 = rgb24tobgr24_C;
- rgb32tobgr32 = rgb32tobgr32_C;
- rgb32tobgr16 = rgb32tobgr16_C;
- rgb32tobgr15 = rgb32tobgr15_C;
- yv12toyuy2 = yv12toyuy2_C;
- yv12touyvy = yv12touyvy_C;
- yuv422ptoyuy2 = yuv422ptoyuy2_C;
- yuy2toyv12 = yuy2toyv12_C;
+ {
+ rgb15to16= rgb15to16_C;
+ rgb15to24= rgb15to24_C;
+ rgb15to32= rgb15to32_C;
+ rgb16to24= rgb16to24_C;
+ rgb16to32= rgb16to32_C;
+ rgb16to15= rgb16to15_C;
+ rgb24to16= rgb24to16_C;
+ rgb24to15= rgb24to15_C;
+ rgb24to32= rgb24to32_C;
+ rgb32to16= rgb32to16_C;
+ rgb32to15= rgb32to15_C;
+ rgb32to24= rgb32to24_C;
+ rgb24tobgr15= rgb24tobgr15_C;
+ rgb24tobgr16= rgb24tobgr16_C;
+ rgb24tobgr24= rgb24tobgr24_C;
+ rgb32tobgr32= rgb32tobgr32_C;
+ rgb32tobgr16= rgb32tobgr16_C;
+ rgb32tobgr15= rgb32tobgr15_C;
+ yv12toyuy2= yv12toyuy2_C;
+ yv12touyvy= yv12touyvy_C;
+ yuv422ptoyuy2= yuv422ptoyuy2_C;
+ yuy2toyv12= yuy2toyv12_C;
// uyvytoyv12= uyvytoyv12_C;
// yvu9toyv12= yvu9toyv12_C;
- planar2x = planar2x_C;
- rgb24toyv12 = rgb24toyv12_C;
- interleaveBytes = interleaveBytes_C;
- vu9_to_vu12 = vu9_to_vu12_C;
- yvu9_to_yuy2 = yvu9_to_yuy2_C;
- }
+ planar2x= planar2x_C;
+ rgb24toyv12= rgb24toyv12_C;
+ interleaveBytes= interleaveBytes_C;
+ vu9_to_vu12= vu9_to_vu12_C;
+ yvu9_to_yuy2= yvu9_to_yuy2_C;
+ }
}
/**
@@ -346,49 +339,49 @@ void sws_rgb2rgb_init(SwsParams *params)
*/
void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
- long i;
+ long i;
- /*
- for(i=0; i<num_pixels; i++)
- ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ];
- */
+/*
+ for(i=0; i<num_pixels; i++)
+ ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ];
+*/
- for(i = 0; i < num_pixels; i++)
- {
-#ifdef WORDS_BIGENDIAN
- dst[3] = palette[ src[i] * 4 + 2 ];
- dst[2] = palette[ src[i] * 4 + 1 ];
- dst[1] = palette[ src[i] * 4 + 0 ];
-#else
- //FIXME slow?
- dst[0] = palette[ src[i] * 4 + 2 ];
- dst[1] = palette[ src[i] * 4 + 1 ];
- dst[2] = palette[ src[i] * 4 + 0 ];
+ for(i=0; i<num_pixels; i++)
+ {
+ #ifdef WORDS_BIGENDIAN
+ dst[3]= palette[ src[i]*4+2 ];
+ dst[2]= palette[ src[i]*4+1 ];
+ dst[1]= palette[ src[i]*4+0 ];
+ #else
+ //FIXME slow?
+ dst[0]= palette[ src[i]*4+2 ];
+ dst[1]= palette[ src[i]*4+1 ];
+ dst[2]= palette[ src[i]*4+0 ];
// dst[3]= 0; /* do we need this cleansing? */
-#endif
- dst += 4;
- }
+ #endif
+ dst+= 4;
+ }
}
void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
- long i;
- for(i = 0; i < num_pixels; i++)
- {
-#ifdef WORDS_BIGENDIAN
- dst[3] = palette[ src[i] * 4 + 0 ];
- dst[2] = palette[ src[i] * 4 + 1 ];
- dst[1] = palette[ src[i] * 4 + 2 ];
-#else
- //FIXME slow?
- dst[0] = palette[ src[i] * 4 + 0 ];
- dst[1] = palette[ src[i] * 4 + 1 ];
- dst[2] = palette[ src[i] * 4 + 2 ];
+ long i;
+ for(i=0; i<num_pixels; i++)
+ {
+ #ifdef WORDS_BIGENDIAN
+ dst[3]= palette[ src[i]*4+0 ];
+ dst[2]= palette[ src[i]*4+1 ];
+ dst[1]= palette[ src[i]*4+2 ];
+ #else
+ //FIXME slow?
+ dst[0]= palette[ src[i]*4+0 ];
+ dst[1]= palette[ src[i]*4+1 ];
+ dst[2]= palette[ src[i]*4+2 ];
// dst[3]= 0; /* do we need this cleansing? */
-#endif
+ #endif
- dst += 4;
- }
+ dst+= 4;
+ }
}
/**
@@ -396,38 +389,38 @@ void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const ui
*/
void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
- long i;
- /*
- writes 1 byte o much and might cause alignment issues on some architectures?
- for(i=0; i<num_pixels; i++)
- ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ];
- */
- for(i = 0; i < num_pixels; i++)
- {
- //FIXME slow?
- dst[0] = palette[ src[i] * 4 + 2 ];
- dst[1] = palette[ src[i] * 4 + 1 ];
- dst[2] = palette[ src[i] * 4 + 0 ];
- dst += 3;
- }
+ long i;
+/*
+ writes 1 byte o much and might cause alignment issues on some architectures?
+ for(i=0; i<num_pixels; i++)
+ ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ];
+*/
+ for(i=0; i<num_pixels; i++)
+ {
+ //FIXME slow?
+ dst[0]= palette[ src[i]*4+2 ];
+ dst[1]= palette[ src[i]*4+1 ];
+ dst[2]= palette[ src[i]*4+0 ];
+ dst+= 3;
+ }
}
void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
- long i;
- /*
- writes 1 byte o much and might cause alignment issues on some architectures?
- for(i=0; i<num_pixels; i++)
- ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ];
- */
- for(i = 0; i < num_pixels; i++)
- {
- //FIXME slow?
- dst[0] = palette[ src[i] * 4 + 0 ];
- dst[1] = palette[ src[i] * 4 + 1 ];
- dst[2] = palette[ src[i] * 4 + 2 ];
- dst += 3;
- }
+ long i;
+/*
+ writes 1 byte o much and might cause alignment issues on some architectures?
+ for(i=0; i<num_pixels; i++)
+ ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ];
+*/
+ for(i=0; i<num_pixels; i++)
+ {
+ //FIXME slow?
+ dst[0]= palette[ src[i]*4+0 ];
+ dst[1]= palette[ src[i]*4+1 ];
+ dst[2]= palette[ src[i]*4+2 ];
+ dst+= 3;
+ }
}
/**
@@ -436,13 +429,13 @@ void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const ui
void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
long i;
- for(i = 0; i < num_pixels; i++)
+ for (i=0; i<num_pixels; i++)
((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
}
void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
long i;
- for(i = 0; i < num_pixels; i++)
+ for (i=0; i<num_pixels; i++)
((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
}
@@ -452,13 +445,13 @@ void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const ui
void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
long i;
- for(i = 0; i < num_pixels; i++)
+ for (i=0; i<num_pixels; i++)
((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
}
void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
{
long i;
- for(i = 0; i < num_pixels; i++)
+ for (i=0; i<num_pixels; i++)
((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
}
@@ -466,38 +459,38 @@ void rgb32tobgr24(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
long i;
stride_t num_pixels = src_size >> 2;
- for(i = 0; i < num_pixels; i++)
+ for (i=0; i<num_pixels; i++)
{
-#ifdef WORDS_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];
-#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];
-#endif
+ #ifdef WORDS_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];
+ #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];
+ #endif
}
}
void rgb24tobgr32(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
long i;
- for(i = 0; 3 * i < src_size; i++)
+ for (i=0; 3*i<src_size; i++)
{
-#ifdef WORDS_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];
-#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;
-#endif
+ #ifdef WORDS_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];
+ #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;
+ #endif
}
}
@@ -506,22 +499,22 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, stride_t src_size)
const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size / 2;
- while(s < end)
+ end = s + src_size/2;
+ while (s < end)
{
register uint16_t bgr;
bgr = *s++;
-#ifdef WORDS_BIGENDIAN
- *d++ = 255;
- *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++ = 255;
-#endif
+ #ifdef WORDS_BIGENDIAN
+ *d++ = 255;
+ *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++ = 255;
+ #endif
}
}
@@ -530,49 +523,49 @@ void rgb16tobgr24(const uint8_t *src, uint8_t *dst, stride_t src_size)
const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size / 2;
- while(s < end)
+ 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;
+ *d++ = (bgr&0xF800)>>8;
+ *d++ = (bgr&0x7E0)>>3;
+ *d++ = (bgr&0x1F)<<3;
}
}
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- long i;
- stride_t num_pixels = src_size >> 1;
-
- for(i = 0; i < num_pixels; i++)
- {
- unsigned b, g, r;
- register uint16_t rgb;
- rgb = ((uint16_t*)src)[i];
- r = rgb & 0x1F;
- g = (rgb & 0x7E0) >> 5;
- b = (rgb & 0xF800) >> 11;
- ((uint16_t*)dst)[i] = (b & 0x1F) | ((g & 0x3F) << 5) | ((r & 0x1F) << 11);
- }
+ long i;
+ stride_t num_pixels = src_size >> 1;
+
+ for(i=0; i<num_pixels; i++)
+ {
+ unsigned b,g,r;
+ register uint16_t rgb;
+ rgb = ((uint16_t*)src)[i];
+ r = rgb&0x1F;
+ g = (rgb&0x7E0)>>5;
+ b = (rgb&0xF800)>>11;
+ ((uint16_t*)dst)[i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11);
+ }
}
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- long i;
- stride_t num_pixels = src_size >> 1;
-
- for(i = 0; i < num_pixels; i++)
- {
- unsigned b, g, r;
- register uint16_t rgb;
- rgb = ((uint16_t*)src)[i];
- r = rgb & 0x1F;
- g = (rgb & 0x7E0) >> 5;
- b = (rgb & 0xF800) >> 11;
- ((uint16_t*)dst)[i] = (b & 0x1F) | ((g & 0x1F) << 5) | ((r & 0x1F) << 10);
- }
+ long i;
+ stride_t num_pixels = src_size >> 1;
+
+ for(i=0; i<num_pixels; i++)
+ {
+ unsigned b,g,r;
+ register uint16_t rgb;
+ rgb = ((uint16_t*)src)[i];
+ r = rgb&0x1F;
+ g = (rgb&0x7E0)>>5;
+ b = (rgb&0xF800)>>11;
+ ((uint16_t*)dst)[i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10);
+ }
}
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, stride_t src_size)
@@ -580,22 +573,22 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, stride_t src_size)
const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size / 2;
- while(s < end)
+ end = s + src_size/2;
+ while (s < end)
{
register uint16_t bgr;
bgr = *s++;
-#ifdef WORDS_BIGENDIAN
- *d++ = 255;
- *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++ = 255;
-#endif
+ #ifdef WORDS_BIGENDIAN
+ *d++ = 255;
+ *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++ = 255;
+ #endif
}
}
@@ -604,63 +597,63 @@ void rgb15tobgr24(const uint8_t *src, uint8_t *dst, stride_t src_size)
const uint16_t *end;
uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src;
- end = s + src_size / 2;
- while(s < end)
+ 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;
+ *d++ = (bgr&0x7C00)>>7;
+ *d++ = (bgr&0x3E0)>>2;
+ *d++ = (bgr&0x1F)<<3;
}
}
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- long i;
- stride_t num_pixels = src_size >> 1;
-
- for(i = 0; i < num_pixels; i++)
- {
- unsigned b, g, r;
- register uint16_t rgb;
- rgb = ((uint16_t*)src)[i];
- r = rgb & 0x1F;
- g = (rgb & 0x3E0) >> 5;
- b = (rgb & 0x7C00) >> 10;
- ((uint16_t*)dst)[i] = (b & 0x1F) | ((g & 0x3F) << 5) | ((r & 0x1F) << 11);
- }
+ long i;
+ stride_t num_pixels = src_size >> 1;
+
+ for(i=0; i<num_pixels; i++)
+ {
+ unsigned b,g,r;
+ register uint16_t rgb;
+ rgb = ((uint16_t*)src)[i];
+ r = rgb&0x1F;
+ g = (rgb&0x3E0)>>5;
+ b = (rgb&0x7C00)>>10;
+ ((uint16_t*)dst)[i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11);
+ }
}
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- long i;
- stride_t num_pixels = src_size >> 1;
-
- for(i = 0; i < num_pixels; i++)
- {
- unsigned b, g, r;
- register uint16_t rgb;
- rgb = ((uint16_t*)src)[i];
- r = rgb & 0x1F;
- g = (rgb & 0x3E0) >> 5;
- b = (rgb & 0x7C00) >> 10;
- ((uint16_t*)dst)[i] = (b & 0x1F) | ((g & 0x1F) << 5) | ((r & 0x1F) << 10);
- }
+ long i;
+ stride_t num_pixels = src_size >> 1;
+
+ for(i=0; i<num_pixels; i++)
+ {
+ unsigned b,g,r;
+ register uint16_t rgb;
+ rgb = ((uint16_t*)src)[i];
+ r = rgb&0x1F;
+ g = (rgb&0x3E0)>>5;
+ b = (rgb&0x7C00)>>10;
+ ((uint16_t*)dst)[i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10);
+ }
}
void rgb8tobgr8(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
long i;
stride_t num_pixels = src_size;
- for(i = 0; i < num_pixels; i++)
+ for (i=0; i<num_pixels; i++)
{
- unsigned b, g, r;
+ 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);
+ r = (rgb&0x07);
+ g = (rgb&0x38)>>3;
+ b = (rgb&0xC0)>>6;
+ dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6);
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.h b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.h
index 33312fd8f..3c6abaae6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb.h
@@ -30,18 +30,18 @@
#include "ffImgfmt.h"
/* A full collection of RGB to RGB(BGR) converters */
-extern void (*rgb24to32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb24to16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb24to15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb32to24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb32to16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb32to15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb15to16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb15to24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb15to32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb16to15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb16to24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
-extern void (*rgb16to32)(const uint8_t *src, uint8_t *dst, stride_t src_size);
+extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb24to15)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb32to24)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb32to16)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb32to15)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb15to16)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb15to24)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb15to32)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb16to15)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb16to24)(const uint8_t *src,uint8_t *dst,stride_t src_size);
+extern void (*rgb16to32)(const uint8_t *src,uint8_t *dst,stride_t src_size);
extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, stride_t src_size);
extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, stride_t src_size);
extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, stride_t src_size);
@@ -84,39 +84,39 @@ extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, c
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
/**
* Width should be a multiple of 16.
*/
extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
/**
* Height should be a multiple of 2 and width should be a multiple of 16.
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride);
/**
* Height should be a multiple of 2 and width should be a multiple of 16.
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
extern void (*yv12tovyuy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
extern void (*yv12toyvyu)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride);
/**
* Height should be a multiple of 2 and width should be a multiple of 2.
@@ -125,26 +125,26 @@ extern void (*yv12toyvyu)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_
* FIXME: Write high quality version.
*/
extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride);
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride);
extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
- stride_t srcStride, stride_t dstStride);
+ stride_t srcStride, stride_t dstStride);
extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
- long width, long height, stride_t src1Stride,
- stride_t src2Stride, stride_t dstStride);
+ long width, long height, stride_t src1Stride,
+ stride_t src2Stride, stride_t dstStride);
extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dst1, uint8_t *dst2,
- long width, long height,
- stride_t srcStride1, stride_t srcStride2,
- stride_t dstStride1, stride_t dstStride2);
+ uint8_t *dst1, uint8_t *dst2,
+ long width, long height,
+ stride_t srcStride1, stride_t srcStride2,
+ stride_t dstStride1, stride_t dstStride2);
extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
- long width, long height,
- stride_t srcStride1, stride_t srcStride2,
- stride_t srcStride3, stride_t dstStride);
+ uint8_t *dst,
+ long width, long height,
+ stride_t srcStride1, stride_t srcStride2,
+ stride_t srcStride3, stride_t dstStride);
struct SwsParams;
void sws_rgb2rgb_init(struct SwsParams *params);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb_template.c
index 80993e5bc..878de0fe6 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/rgb2rgb_template.c
@@ -71,22 +71,22 @@
#define SFENCE "/nop"
#endif
-static inline void RENAME(rgb24to32)(const uint8_t *src, uint8_t *dst, stride_t src_size)
+static inline void RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,stride_t src_size)
{
uint8_t *dest = dst;
const uint8_t *s = src;
const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
+ #if HAVE_MMX
+ const uint8_t *mm_end;
+ #endif
end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- mm_end = end - 23;
- __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory");
- while(s < mm_end)
- {
- __asm__ volatile(
+ #if HAVE_MMX
+ __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
+ mm_end = end - 23;
+ __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"
@@ -107,31 +107,31 @@ static inline void RENAME(rgb24to32)(const uint8_t *src, uint8_t *dst, stride_t
:"=m"(*dest)
:"m"(*s)
:"memory");
- dest += 32;
- s += 24;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while(s < end)
+ dest += 32;
+ s += 24;
+ }
+ __asm__ volatile(SFENCE:::"memory");
+ __asm__ volatile(EMMS:::"memory");
+ #endif
+ while (s < end)
{
-#ifdef WORDS_BIGENDIAN
+ #ifdef WORDS_BIGENDIAN
/* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */
*dest++ = 255;
*dest++ = s[2];
*dest++ = s[1];
*dest++ = s[0];
- s += 3;
-#else
+ s+=3;
+ #else
*dest++ = *s++;
*dest++ = *s++;
*dest++ = *s++;
*dest++ = 255;
-#endif
+ #endif
}
}
-static inline void RENAME(rgb32to24)(const uint8_t *src, uint8_t *dst, stride_t src_size)
+static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,stride_t src_size)
{
uint8_t *dest = dst;
const uint8_t *s = src;
@@ -143,63 +143,63 @@ static inline void RENAME(rgb32to24)(const uint8_t *src, uint8_t *dst, stride_t
#if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
mm_end = end - 31;
- while(s < mm_end)
+ 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"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "movq %%mm4, %%mm6 \n\t"
- "movq %%mm5, %%mm7 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm3 \n\t"
- "psrlq $8, %%mm6 \n\t"
- "psrlq $8, %%mm7 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm1 \n\t"
- "pand %2, %%mm4 \n\t"
- "pand %2, %%mm5 \n\t"
- "pand %3, %%mm2 \n\t"
- "pand %3, %%mm3 \n\t"
- "pand %3, %%mm6 \n\t"
- "pand %3, %%mm7 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "por %%mm7, %%mm5 \n\t"
-
- "movq %%mm1, %%mm2 \n\t"
- "movq %%mm4, %%mm3 \n\t"
- "psllq $48, %%mm2 \n\t"
- "psllq $32, %%mm3 \n\t"
- "pand %4, %%mm2 \n\t"
- "pand %5, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psrlq $16, %%mm1 \n\t"
- "psrlq $32, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "pand %6, %%mm5 \n\t"
- "por %%mm5, %%mm4 \n\t"
-
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm4, 16%0"
- :"=m"(*dest)
- :"m"(*s), "m"(mask24l),
- "m"(mask24h), "m"(mask24hh), "m"(mask24hhh), "m"(mask24hhhh)
- :"memory");
+ 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"
+ "psrlq $8, %%mm2 \n\t"
+ "psrlq $8, %%mm3 \n\t"
+ "psrlq $8, %%mm6 \n\t"
+ "psrlq $8, %%mm7 \n\t"
+ "pand %2, %%mm0 \n\t"
+ "pand %2, %%mm1 \n\t"
+ "pand %2, %%mm4 \n\t"
+ "pand %2, %%mm5 \n\t"
+ "pand %3, %%mm2 \n\t"
+ "pand %3, %%mm3 \n\t"
+ "pand %3, %%mm6 \n\t"
+ "pand %3, %%mm7 \n\t"
+ "por %%mm2, %%mm0 \n\t"
+ "por %%mm3, %%mm1 \n\t"
+ "por %%mm6, %%mm4 \n\t"
+ "por %%mm7, %%mm5 \n\t"
+
+ "movq %%mm1, %%mm2 \n\t"
+ "movq %%mm4, %%mm3 \n\t"
+ "psllq $48, %%mm2 \n\t"
+ "psllq $32, %%mm3 \n\t"
+ "pand %4, %%mm2 \n\t"
+ "pand %5, %%mm3 \n\t"
+ "por %%mm2, %%mm0 \n\t"
+ "psrlq $16, %%mm1 \n\t"
+ "psrlq $32, %%mm4 \n\t"
+ "psllq $16, %%mm5 \n\t"
+ "por %%mm3, %%mm1 \n\t"
+ "pand %6, %%mm5 \n\t"
+ "por %%mm5, %%mm4 \n\t"
+
+ MOVNTQ" %%mm0, %0 \n\t"
+ MOVNTQ" %%mm1, 8%0 \n\t"
+ MOVNTQ" %%mm4, 16%0"
+ :"=m"(*dest)
+ :"m"(*s),"m"(mask24l),
+ "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
+ :"memory");
dest += 24;
s += 32;
}
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
#endif
- while(s < end)
+ while (s < end)
{
#ifdef WORDS_BIGENDIAN
/* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
@@ -223,10 +223,10 @@ static inline void RENAME(rgb32to24)(const uint8_t *src, uint8_t *dst, stride_t
MMX2, 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, stride_t src_size)
+static inline void RENAME(rgb15to16)(const uint8_t *src,uint8_t *dst,stride_t src_size)
{
- register const uint8_t* s = src;
- register uint8_t* d = dst;
+ 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;
@@ -234,48 +234,48 @@ static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, stride_t
__asm__ volatile(PREFETCH" %0"::"m"(*s));
__asm__ volatile("movq %0, %%mm4"::"m"(mask15s));
mm_end = end - 15;
- while(s < mm_end)
+ while (s<mm_end)
{
__asm__ volatile(
- 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)
+ 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)
);
- d += 16;
- s += 16;
+ d+=16;
+ s+=16;
}
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
#endif
mm_end = end - 3;
- while(s < mm_end)
+ 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)
+ 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 RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, stride_t src_size)
+static inline void RENAME(rgb16to15)(const uint8_t *src,uint8_t *dst,stride_t src_size)
{
- register const uint8_t* s = src;
- register uint8_t* d = dst;
+ 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;
@@ -284,47 +284,47 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, stride_t
__asm__ volatile("movq %0, %%mm7"::"m"(mask15rg));
__asm__ volatile("movq %0, %%mm6"::"m"(mask15b));
mm_end = end - 15;
- while(s < mm_end)
+ while (s<mm_end)
{
__asm__ volatile(
- 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"
- "psrlq $1, %%mm2 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "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)
+ 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"
+ "psrlq $1, %%mm2 \n\t"
+ "pand %%mm7, %%mm0 \n\t"
+ "pand %%mm7, %%mm2 \n\t"
+ "pand %%mm6, %%mm1 \n\t"
+ "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)
);
- d += 16;
- s += 16;
+ d+=16;
+ s+=16;
}
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
#endif
mm_end = end - 3;
- while(s < mm_end)
+ 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)
+ if (s < end)
{
- register uint16_t x = *((const uint16_t*)s);
- *((uint16_t *)d) = ((x >> 1) & 0x7FE0) | (x & 0x001F);
- s += 2;
- d += 2;
+ register uint16_t x= *((const uint16_t*)s);
+ *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
+ s+=2;
+ d+=2;
}
}
@@ -341,77 +341,77 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, stride_t
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"
- "movq %5, %%mm7 \n\t"
- "jmp 2f \n\t"
- ASMALIGN(4)
- "1: \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 %%mm3, %%mm4 \n\t"
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm6, %%mm3 \n\t"
- "pmaddwd %%mm7, %%mm0 \n\t"
- "pmaddwd %%mm7, %%mm3 \n\t"
- "pand %%mm5, %%mm1 \n\t"
- "pand %%mm5, %%mm4 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "psrld $5, %%mm0 \n\t"
- "pslld $11, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, (%0) \n\t"
- "add $16, %1 \n\t"
- "add $8, %0 \n\t"
- "2: \n\t"
- "cmp %2, %1 \n\t"
- " jb 1b \n\t"
- : "+r"(d), "+r"(s)
- : "r"(mm_end), "m"(mask3216g), "m"(mask3216br), "m"(mul3216)
+ "movq %3, %%mm5 \n\t"
+ "movq %4, %%mm6 \n\t"
+ "movq %5, %%mm7 \n\t"
+ "jmp 2f \n\t"
+ ASMALIGN(4)
+ "1: \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 %%mm3, %%mm4 \n\t"
+ "pand %%mm6, %%mm0 \n\t"
+ "pand %%mm6, %%mm3 \n\t"
+ "pmaddwd %%mm7, %%mm0 \n\t"
+ "pmaddwd %%mm7, %%mm3 \n\t"
+ "pand %%mm5, %%mm1 \n\t"
+ "pand %%mm5, %%mm4 \n\t"
+ "por %%mm1, %%mm0 \n\t"
+ "por %%mm4, %%mm3 \n\t"
+ "psrld $5, %%mm0 \n\t"
+ "pslld $11, %%mm3 \n\t"
+ "por %%mm3, %%mm0 \n\t"
+ MOVNTQ" %%mm0, (%0) \n\t"
+ "add $16, %1 \n\t"
+ "add $8, %0 \n\t"
+ "2: \n\t"
+ "cmp %2, %1 \n\t"
+ " jb 1b \n\t"
+ : "+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)
+ ::"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");
+ 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;
}
@@ -419,485 +419,481 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, stride_t
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
#endif
- while(s < end)
+ 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 RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- __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));
- 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"
- "movq %%mm0, %%mm1\n\t"
- "movq %%mm0, %%mm2\n\t"
- "movq %%mm3, %%mm4\n\t"
- "movq %%mm3, %%mm5\n\t"
- "psllq $8, %%mm0\n\t"
- "psllq $8, %%mm3\n\t"
- "pand %%mm7, %%mm0\n\t"
- "pand %%mm7, %%mm3\n\t"
- "psrlq $5, %%mm1\n\t"
- "psrlq $5, %%mm4\n\t"
- "pand %%mm6, %%mm1\n\t"
- "pand %%mm6, %%mm4\n\t"
- "psrlq $19, %%mm2\n\t"
- "psrlq $19, %%mm5\n\t"
- "pand %2, %%mm2\n\t"
- "pand %2, %%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;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
- {
- register int rgb = *(uint32_t*)s;
- s += 4;
- *d++ = ((rgb & 0xF8) << 8) + ((rgb & 0xFC00) >> 5) + ((rgb & 0xF80000) >> 19);
- }
+ __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));
+ 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"
+ "movq %%mm0, %%mm1\n\t"
+ "movq %%mm0, %%mm2\n\t"
+ "movq %%mm3, %%mm4\n\t"
+ "movq %%mm3, %%mm5\n\t"
+ "psllq $8, %%mm0\n\t"
+ "psllq $8, %%mm3\n\t"
+ "pand %%mm7, %%mm0\n\t"
+ "pand %%mm7, %%mm3\n\t"
+ "psrlq $5, %%mm1\n\t"
+ "psrlq $5, %%mm4\n\t"
+ "pand %%mm6, %%mm1\n\t"
+ "pand %%mm6, %%mm4\n\t"
+ "psrlq $19, %%mm2\n\t"
+ "psrlq $19, %%mm5\n\t"
+ "pand %2, %%mm2\n\t"
+ "pand %2, %%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;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ register int rgb = *(uint32_t*)s; s += 4;
+ *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19);
+ }
}
static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- mm_end = end - 15;
+ mm_end = end - 15;
#if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster)
- asm volatile(
- "movq %3, %%mm5 \n\t"
- "movq %4, %%mm6 \n\t"
- "movq %5, %%mm7 \n\t"
- ".balign 16 \n\t"
- "1: \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 %%mm3, %%mm4 \n\t"
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm6, %%mm3 \n\t"
- "pmaddwd %%mm7, %%mm0 \n\t"
- "pmaddwd %%mm7, %%mm3 \n\t"
- "pand %%mm5, %%mm1 \n\t"
- "pand %%mm5, %%mm4 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "psrld $6, %%mm0 \n\t"
- "pslld $10, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, (%0) \n\t"
- "add $16, %1 \n\t"
- "add $8, %0 \n\t"
- "cmp %2, %1 \n\t"
- " jb 1b \n\t"
- : "+r"(d), "+r"(s)
- : "r"(mm_end), "m"(mask3215g), "m"(mask3216br), "m"(mul3215)
- );
+ asm volatile(
+ "movq %3, %%mm5 \n\t"
+ "movq %4, %%mm6 \n\t"
+ "movq %5, %%mm7 \n\t"
+ ".balign 16 \n\t"
+ "1: \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 %%mm3, %%mm4 \n\t"
+ "pand %%mm6, %%mm0 \n\t"
+ "pand %%mm6, %%mm3 \n\t"
+ "pmaddwd %%mm7, %%mm0 \n\t"
+ "pmaddwd %%mm7, %%mm3 \n\t"
+ "pand %%mm5, %%mm1 \n\t"
+ "pand %%mm5, %%mm4 \n\t"
+ "por %%mm1, %%mm0 \n\t"
+ "por %%mm4, %%mm3 \n\t"
+ "psrld $6, %%mm0 \n\t"
+ "pslld $10, %%mm3 \n\t"
+ "por %%mm3, %%mm0 \n\t"
+ MOVNTQ" %%mm0, (%0) \n\t"
+ "add $16, %1 \n\t"
+ "add $8, %0 \n\t"
+ "cmp %2, %1 \n\t"
+ " jb 1b \n\t"
+ : "+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");
-#endif
- while(s < end)
- {
- register int rgb = *(uint32_t*)s;
- s += 4;
- *d++ = ((rgb & 0xFF) >> 3) + ((rgb & 0xF800) >> 6) + ((rgb & 0xF80000) >> 9);
- }
+ __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");
+#endif
+ while(s < end)
+ {
+ register int rgb = *(uint32_t*)s; s += 4;
+ *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
+ }
}
static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- __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));
- 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"
- "movq %%mm0, %%mm1\n\t"
- "movq %%mm0, %%mm2\n\t"
- "movq %%mm3, %%mm4\n\t"
- "movq %%mm3, %%mm5\n\t"
- "psllq $7, %%mm0\n\t"
- "psllq $7, %%mm3\n\t"
- "pand %%mm7, %%mm0\n\t"
- "pand %%mm7, %%mm3\n\t"
- "psrlq $6, %%mm1\n\t"
- "psrlq $6, %%mm4\n\t"
- "pand %%mm6, %%mm1\n\t"
- "pand %%mm6, %%mm4\n\t"
- "psrlq $19, %%mm2\n\t"
- "psrlq $19, %%mm5\n\t"
- "pand %2, %%mm2\n\t"
- "pand %2, %%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;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
- {
- register int rgb = *(uint32_t*)s;
- s += 4;
- *d++ = ((rgb & 0xF8) << 7) + ((rgb & 0xF800) >> 6) + ((rgb & 0xF80000) >> 19);
- }
+ __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));
+ 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"
+ "movq %%mm0, %%mm1\n\t"
+ "movq %%mm0, %%mm2\n\t"
+ "movq %%mm3, %%mm4\n\t"
+ "movq %%mm3, %%mm5\n\t"
+ "psllq $7, %%mm0\n\t"
+ "psllq $7, %%mm3\n\t"
+ "pand %%mm7, %%mm0\n\t"
+ "pand %%mm7, %%mm3\n\t"
+ "psrlq $6, %%mm1\n\t"
+ "psrlq $6, %%mm4\n\t"
+ "pand %%mm6, %%mm1\n\t"
+ "pand %%mm6, %%mm4\n\t"
+ "psrlq $19, %%mm2\n\t"
+ "psrlq $19, %%mm5\n\t"
+ "pand %2, %%mm2\n\t"
+ "pand %2, %%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;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ register int rgb = *(uint32_t*)s; s += 4;
+ *d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19);
+ }
}
static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- __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));
- 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"
- "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 += 12;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
- {
- const int b = *s++;
- const int g = *s++;
- const int r = *s++;
- *d++ = (b >> 3) | ((g & 0xFC) << 3) | ((r & 0xF8) << 8);
- }
+ __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));
+ 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"
+ "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 += 12;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ const int b= *s++;
+ const int g= *s++;
+ const int r= *s++;
+ *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
+ }
}
static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- __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));
- 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"
- "movq %%mm0, %%mm1\n\t"
- "movq %%mm0, %%mm2\n\t"
- "movq %%mm3, %%mm4\n\t"
- "movq %%mm3, %%mm5\n\t"
- "psllq $8, %%mm0\n\t"
- "psllq $8, %%mm3\n\t"
- "pand %%mm7, %%mm0\n\t"
- "pand %%mm7, %%mm3\n\t"
- "psrlq $5, %%mm1\n\t"
- "psrlq $5, %%mm4\n\t"
- "pand %%mm6, %%mm1\n\t"
- "pand %%mm6, %%mm4\n\t"
- "psrlq $19, %%mm2\n\t"
- "psrlq $19, %%mm5\n\t"
- "pand %2, %%mm2\n\t"
- "pand %2, %%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 += 12;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
- {
- const int r = *s++;
- const int g = *s++;
- const int b = *s++;
- *d++ = (b >> 3) | ((g & 0xFC) << 3) | ((r & 0xF8) << 8);
- }
+ __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));
+ 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"
+ "movq %%mm0, %%mm1\n\t"
+ "movq %%mm0, %%mm2\n\t"
+ "movq %%mm3, %%mm4\n\t"
+ "movq %%mm3, %%mm5\n\t"
+ "psllq $8, %%mm0\n\t"
+ "psllq $8, %%mm3\n\t"
+ "pand %%mm7, %%mm0\n\t"
+ "pand %%mm7, %%mm3\n\t"
+ "psrlq $5, %%mm1\n\t"
+ "psrlq $5, %%mm4\n\t"
+ "pand %%mm6, %%mm1\n\t"
+ "pand %%mm6, %%mm4\n\t"
+ "psrlq $19, %%mm2\n\t"
+ "psrlq $19, %%mm5\n\t"
+ "pand %2, %%mm2\n\t"
+ "pand %2, %%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 += 12;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ const int r= *s++;
+ const int g= *s++;
+ const int b= *s++;
+ *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
+ }
}
static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- __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));
- 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"
- "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 += 12;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
- {
- const int b = *s++;
- const int g = *s++;
- const int r = *s++;
- *d++ = (b >> 3) | ((g & 0xF8) << 2) | ((r & 0xF8) << 7);
- }
+ __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));
+ 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"
+ "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 += 12;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ const int b= *s++;
+ const int g= *s++;
+ const int r= *s++;
+ *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
+ }
}
static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
+ const uint8_t *s = src;
+ const uint8_t *end;
#if HAVE_MMX
- const uint8_t *mm_end;
+ const uint8_t *mm_end;
#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ end = s + src_size;
#if HAVE_MMX
- __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));
- 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"
- "movq %%mm0, %%mm1\n\t"
- "movq %%mm0, %%mm2\n\t"
- "movq %%mm3, %%mm4\n\t"
- "movq %%mm3, %%mm5\n\t"
- "psllq $7, %%mm0\n\t"
- "psllq $7, %%mm3\n\t"
- "pand %%mm7, %%mm0\n\t"
- "pand %%mm7, %%mm3\n\t"
- "psrlq $6, %%mm1\n\t"
- "psrlq $6, %%mm4\n\t"
- "pand %%mm6, %%mm1\n\t"
- "pand %%mm6, %%mm4\n\t"
- "psrlq $19, %%mm2\n\t"
- "psrlq $19, %%mm5\n\t"
- "pand %2, %%mm2\n\t"
- "pand %2, %%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 += 12;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
- {
- const int r = *s++;
- const int g = *s++;
- const int b = *s++;
- *d++ = (b >> 3) | ((g & 0xF8) << 2) | ((r & 0xF8) << 7);
- }
+ __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));
+ 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"
+ "movq %%mm0, %%mm1\n\t"
+ "movq %%mm0, %%mm2\n\t"
+ "movq %%mm3, %%mm4\n\t"
+ "movq %%mm3, %%mm5\n\t"
+ "psllq $7, %%mm0\n\t"
+ "psllq $7, %%mm3\n\t"
+ "pand %%mm7, %%mm0\n\t"
+ "pand %%mm7, %%mm3\n\t"
+ "psrlq $6, %%mm1\n\t"
+ "psrlq $6, %%mm4\n\t"
+ "pand %%mm6, %%mm1\n\t"
+ "pand %%mm6, %%mm4\n\t"
+ "psrlq $19, %%mm2\n\t"
+ "psrlq $19, %%mm5\n\t"
+ "pand %2, %%mm2\n\t"
+ "pand %2, %%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 += 12;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ const int r= *s++;
+ const int g= *s++;
+ const int b= *s++;
+ *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
+ }
}
/*
@@ -925,594 +921,594 @@ static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, stride
*/
static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint16_t *end;
+ const uint16_t *end;
#if HAVE_MMX
- const uint16_t *mm_end;
+ const uint16_t *mm_end;
#endif
- uint8_t *d = (uint8_t *)dst;
- const uint16_t *s = (uint16_t *)src;
- end = s + src_size / 2;
+ uint8_t *d = (uint8_t *)dst;
+ const uint16_t *s = (uint16_t *)src;
+ end = s + src_size/2;
#if HAVE_MMX
- __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
- 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"
- "pand %2, %%mm0\n\t"
- "pand %3, %%mm1\n\t"
- "pand %4, %%mm2\n\t"
- "psllq $3, %%mm0\n\t"
- "psrlq $2, %%mm1\n\t"
- "psrlq $7, %%mm2\n\t"
- "movq %%mm0, %%mm3\n\t"
- "movq %%mm1, %%mm4\n\t"
- "movq %%mm2, %%mm5\n\t"
- "punpcklwd %5, %%mm0\n\t"
- "punpcklwd %5, %%mm1\n\t"
- "punpcklwd %5, %%mm2\n\t"
- "punpckhwd %5, %%mm3\n\t"
- "punpckhwd %5, %%mm4\n\t"
- "punpckhwd %5, %%mm5\n\t"
- "psllq $8, %%mm1\n\t"
- "psllq $16, %%mm2\n\t"
- "por %%mm1, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t"
- "psllq $8, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm4, %%mm3\n\t"
- "por %%mm5, %%mm3\n\t"
-
- "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"
- "pand %2, %%mm0\n\t"
- "pand %3, %%mm1\n\t"
- "pand %4, %%mm2\n\t"
- "psllq $3, %%mm0\n\t"
- "psrlq $2, %%mm1\n\t"
- "psrlq $7, %%mm2\n\t"
- "movq %%mm0, %%mm3\n\t"
- "movq %%mm1, %%mm4\n\t"
- "movq %%mm2, %%mm5\n\t"
- "punpcklwd %5, %%mm0\n\t"
- "punpcklwd %5, %%mm1\n\t"
- "punpcklwd %5, %%mm2\n\t"
- "punpckhwd %5, %%mm3\n\t"
- "punpckhwd %5, %%mm4\n\t"
- "punpckhwd %5, %%mm5\n\t"
- "psllq $8, %%mm1\n\t"
- "psllq $16, %%mm2\n\t"
- "por %%mm1, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t"
- "psllq $8, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm4, %%mm3\n\t"
- "por %%mm5, %%mm3\n\t"
-
- : "=m"(*d)
- : "m"(*s), "m"(mask15b), "m"(mask15g), "m"(mask15r), "m"(mmx_null)
- : "memory");
- /* Borrowed 32 to 24 */
- __asm __volatile(
- "movq %%mm0, %%mm4\n\t"
- "movq %%mm3, %%mm5\n\t"
- "movq %%mm6, %%mm0\n\t"
- "movq %%mm7, %%mm1\n\t"
-
- "movq %%mm4, %%mm6\n\t"
- "movq %%mm5, %%mm7\n\t"
- "movq %%mm0, %%mm2\n\t"
- "movq %%mm1, %%mm3\n\t"
-
- "psrlq $8, %%mm2\n\t"
- "psrlq $8, %%mm3\n\t"
- "psrlq $8, %%mm6\n\t"
- "psrlq $8, %%mm7\n\t"
- "pand %2, %%mm0\n\t"
- "pand %2, %%mm1\n\t"
- "pand %2, %%mm4\n\t"
- "pand %2, %%mm5\n\t"
- "pand %3, %%mm2\n\t"
- "pand %3, %%mm3\n\t"
- "pand %3, %%mm6\n\t"
- "pand %3, %%mm7\n\t"
- "por %%mm2, %%mm0\n\t"
- "por %%mm3, %%mm1\n\t"
- "por %%mm6, %%mm4\n\t"
- "por %%mm7, %%mm5\n\t"
-
- "movq %%mm1, %%mm2\n\t"
- "movq %%mm4, %%mm3\n\t"
- "psllq $48, %%mm2\n\t"
- "psllq $32, %%mm3\n\t"
- "pand %4, %%mm2\n\t"
- "pand %5, %%mm3\n\t"
- "por %%mm2, %%mm0\n\t"
- "psrlq $16, %%mm1\n\t"
- "psrlq $32, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm3, %%mm1\n\t"
- "pand %6, %%mm5\n\t"
- "por %%mm5, %%mm4\n\t"
-
- MOVNTQ" %%mm0, %0\n\t"
- MOVNTQ" %%mm1, 8%0\n\t"
- MOVNTQ" %%mm4, 16%0"
-
- : "=m"(*d)
- : "m"(*s), "m"(mask24l), "m"(mask24h), "m"(mask24hh), "m"(mask24hhh), "m"(mask24hhhh)
- : "memory");
- d += 24;
- s += 8;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
-{
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr & 0x1F) << 3;
- *d++ = (bgr & 0x3E0) >> 2;
- *d++ = (bgr & 0x7C00) >> 7;
- }
+ __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
+ 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"
+ "pand %2, %%mm0\n\t"
+ "pand %3, %%mm1\n\t"
+ "pand %4, %%mm2\n\t"
+ "psllq $3, %%mm0\n\t"
+ "psrlq $2, %%mm1\n\t"
+ "psrlq $7, %%mm2\n\t"
+ "movq %%mm0, %%mm3\n\t"
+ "movq %%mm1, %%mm4\n\t"
+ "movq %%mm2, %%mm5\n\t"
+ "punpcklwd %5, %%mm0\n\t"
+ "punpcklwd %5, %%mm1\n\t"
+ "punpcklwd %5, %%mm2\n\t"
+ "punpckhwd %5, %%mm3\n\t"
+ "punpckhwd %5, %%mm4\n\t"
+ "punpckhwd %5, %%mm5\n\t"
+ "psllq $8, %%mm1\n\t"
+ "psllq $16, %%mm2\n\t"
+ "por %%mm1, %%mm0\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psllq $8, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm4, %%mm3\n\t"
+ "por %%mm5, %%mm3\n\t"
+
+ "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"
+ "pand %2, %%mm0\n\t"
+ "pand %3, %%mm1\n\t"
+ "pand %4, %%mm2\n\t"
+ "psllq $3, %%mm0\n\t"
+ "psrlq $2, %%mm1\n\t"
+ "psrlq $7, %%mm2\n\t"
+ "movq %%mm0, %%mm3\n\t"
+ "movq %%mm1, %%mm4\n\t"
+ "movq %%mm2, %%mm5\n\t"
+ "punpcklwd %5, %%mm0\n\t"
+ "punpcklwd %5, %%mm1\n\t"
+ "punpcklwd %5, %%mm2\n\t"
+ "punpckhwd %5, %%mm3\n\t"
+ "punpckhwd %5, %%mm4\n\t"
+ "punpckhwd %5, %%mm5\n\t"
+ "psllq $8, %%mm1\n\t"
+ "psllq $16, %%mm2\n\t"
+ "por %%mm1, %%mm0\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psllq $8, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm4, %%mm3\n\t"
+ "por %%mm5, %%mm3\n\t"
+
+ :"=m"(*d)
+ :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
+ :"memory");
+ /* Borrowed 32 to 24 */
+ __asm __volatile(
+ "movq %%mm0, %%mm4\n\t"
+ "movq %%mm3, %%mm5\n\t"
+ "movq %%mm6, %%mm0\n\t"
+ "movq %%mm7, %%mm1\n\t"
+
+ "movq %%mm4, %%mm6\n\t"
+ "movq %%mm5, %%mm7\n\t"
+ "movq %%mm0, %%mm2\n\t"
+ "movq %%mm1, %%mm3\n\t"
+
+ "psrlq $8, %%mm2\n\t"
+ "psrlq $8, %%mm3\n\t"
+ "psrlq $8, %%mm6\n\t"
+ "psrlq $8, %%mm7\n\t"
+ "pand %2, %%mm0\n\t"
+ "pand %2, %%mm1\n\t"
+ "pand %2, %%mm4\n\t"
+ "pand %2, %%mm5\n\t"
+ "pand %3, %%mm2\n\t"
+ "pand %3, %%mm3\n\t"
+ "pand %3, %%mm6\n\t"
+ "pand %3, %%mm7\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "por %%mm3, %%mm1\n\t"
+ "por %%mm6, %%mm4\n\t"
+ "por %%mm7, %%mm5\n\t"
+
+ "movq %%mm1, %%mm2\n\t"
+ "movq %%mm4, %%mm3\n\t"
+ "psllq $48, %%mm2\n\t"
+ "psllq $32, %%mm3\n\t"
+ "pand %4, %%mm2\n\t"
+ "pand %5, %%mm3\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psrlq $16, %%mm1\n\t"
+ "psrlq $32, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm3, %%mm1\n\t"
+ "pand %6, %%mm5\n\t"
+ "por %%mm5, %%mm4\n\t"
+
+ MOVNTQ" %%mm0, %0\n\t"
+ MOVNTQ" %%mm1, 8%0\n\t"
+ MOVNTQ" %%mm4, 16%0"
+
+ :"=m"(*d)
+ :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
+ :"memory");
+ d += 24;
+ s += 8;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ register uint16_t bgr;
+ bgr = *s++;
+ *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr&0x3E0)>>2;
+ *d++ = (bgr&0x7C00)>>7;
+ }
}
static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint16_t *end;
+ const uint16_t *end;
#if HAVE_MMX
- const uint16_t *mm_end;
+ const uint16_t *mm_end;
#endif
- 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;
+ end = s + src_size/2;
#if HAVE_MMX
- __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
- 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"
- "pand %2, %%mm0\n\t"
- "pand %3, %%mm1\n\t"
- "pand %4, %%mm2\n\t"
- "psllq $3, %%mm0\n\t"
- "psrlq $3, %%mm1\n\t"
- "psrlq $8, %%mm2\n\t"
- "movq %%mm0, %%mm3\n\t"
- "movq %%mm1, %%mm4\n\t"
- "movq %%mm2, %%mm5\n\t"
- "punpcklwd %5, %%mm0\n\t"
- "punpcklwd %5, %%mm1\n\t"
- "punpcklwd %5, %%mm2\n\t"
- "punpckhwd %5, %%mm3\n\t"
- "punpckhwd %5, %%mm4\n\t"
- "punpckhwd %5, %%mm5\n\t"
- "psllq $8, %%mm1\n\t"
- "psllq $16, %%mm2\n\t"
- "por %%mm1, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t"
- "psllq $8, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm4, %%mm3\n\t"
- "por %%mm5, %%mm3\n\t"
-
- "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"
- "pand %2, %%mm0\n\t"
- "pand %3, %%mm1\n\t"
- "pand %4, %%mm2\n\t"
- "psllq $3, %%mm0\n\t"
- "psrlq $3, %%mm1\n\t"
- "psrlq $8, %%mm2\n\t"
- "movq %%mm0, %%mm3\n\t"
- "movq %%mm1, %%mm4\n\t"
- "movq %%mm2, %%mm5\n\t"
- "punpcklwd %5, %%mm0\n\t"
- "punpcklwd %5, %%mm1\n\t"
- "punpcklwd %5, %%mm2\n\t"
- "punpckhwd %5, %%mm3\n\t"
- "punpckhwd %5, %%mm4\n\t"
- "punpckhwd %5, %%mm5\n\t"
- "psllq $8, %%mm1\n\t"
- "psllq $16, %%mm2\n\t"
- "por %%mm1, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t"
- "psllq $8, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm4, %%mm3\n\t"
- "por %%mm5, %%mm3\n\t"
- : "=m"(*d)
- : "m"(*s), "m"(mask16b), "m"(mask16g), "m"(mask16r), "m"(mmx_null)
- : "memory");
- /* Borrowed 32 to 24 */
- __asm __volatile(
- "movq %%mm0, %%mm4\n\t"
- "movq %%mm3, %%mm5\n\t"
- "movq %%mm6, %%mm0\n\t"
- "movq %%mm7, %%mm1\n\t"
-
- "movq %%mm4, %%mm6\n\t"
- "movq %%mm5, %%mm7\n\t"
- "movq %%mm0, %%mm2\n\t"
- "movq %%mm1, %%mm3\n\t"
-
- "psrlq $8, %%mm2\n\t"
- "psrlq $8, %%mm3\n\t"
- "psrlq $8, %%mm6\n\t"
- "psrlq $8, %%mm7\n\t"
- "pand %2, %%mm0\n\t"
- "pand %2, %%mm1\n\t"
- "pand %2, %%mm4\n\t"
- "pand %2, %%mm5\n\t"
- "pand %3, %%mm2\n\t"
- "pand %3, %%mm3\n\t"
- "pand %3, %%mm6\n\t"
- "pand %3, %%mm7\n\t"
- "por %%mm2, %%mm0\n\t"
- "por %%mm3, %%mm1\n\t"
- "por %%mm6, %%mm4\n\t"
- "por %%mm7, %%mm5\n\t"
-
- "movq %%mm1, %%mm2\n\t"
- "movq %%mm4, %%mm3\n\t"
- "psllq $48, %%mm2\n\t"
- "psllq $32, %%mm3\n\t"
- "pand %4, %%mm2\n\t"
- "pand %5, %%mm3\n\t"
- "por %%mm2, %%mm0\n\t"
- "psrlq $16, %%mm1\n\t"
- "psrlq $32, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm3, %%mm1\n\t"
- "pand %6, %%mm5\n\t"
- "por %%mm5, %%mm4\n\t"
-
- MOVNTQ" %%mm0, %0\n\t"
- MOVNTQ" %%mm1, 8%0\n\t"
- MOVNTQ" %%mm4, 16%0"
-
- : "=m"(*d)
- : "m"(*s), "m"(mask24l), "m"(mask24h), "m"(mask24hh), "m"(mask24hhh), "m"(mask24hhhh)
- : "memory");
- d += 24;
- s += 8;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
-{
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr & 0x1F) << 3;
- *d++ = (bgr & 0x7E0) >> 3;
- *d++ = (bgr & 0xF800) >> 8;
- }
+ __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
+ 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"
+ "pand %2, %%mm0\n\t"
+ "pand %3, %%mm1\n\t"
+ "pand %4, %%mm2\n\t"
+ "psllq $3, %%mm0\n\t"
+ "psrlq $3, %%mm1\n\t"
+ "psrlq $8, %%mm2\n\t"
+ "movq %%mm0, %%mm3\n\t"
+ "movq %%mm1, %%mm4\n\t"
+ "movq %%mm2, %%mm5\n\t"
+ "punpcklwd %5, %%mm0\n\t"
+ "punpcklwd %5, %%mm1\n\t"
+ "punpcklwd %5, %%mm2\n\t"
+ "punpckhwd %5, %%mm3\n\t"
+ "punpckhwd %5, %%mm4\n\t"
+ "punpckhwd %5, %%mm5\n\t"
+ "psllq $8, %%mm1\n\t"
+ "psllq $16, %%mm2\n\t"
+ "por %%mm1, %%mm0\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psllq $8, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm4, %%mm3\n\t"
+ "por %%mm5, %%mm3\n\t"
+
+ "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"
+ "pand %2, %%mm0\n\t"
+ "pand %3, %%mm1\n\t"
+ "pand %4, %%mm2\n\t"
+ "psllq $3, %%mm0\n\t"
+ "psrlq $3, %%mm1\n\t"
+ "psrlq $8, %%mm2\n\t"
+ "movq %%mm0, %%mm3\n\t"
+ "movq %%mm1, %%mm4\n\t"
+ "movq %%mm2, %%mm5\n\t"
+ "punpcklwd %5, %%mm0\n\t"
+ "punpcklwd %5, %%mm1\n\t"
+ "punpcklwd %5, %%mm2\n\t"
+ "punpckhwd %5, %%mm3\n\t"
+ "punpckhwd %5, %%mm4\n\t"
+ "punpckhwd %5, %%mm5\n\t"
+ "psllq $8, %%mm1\n\t"
+ "psllq $16, %%mm2\n\t"
+ "por %%mm1, %%mm0\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psllq $8, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm4, %%mm3\n\t"
+ "por %%mm5, %%mm3\n\t"
+ :"=m"(*d)
+ :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
+ :"memory");
+ /* Borrowed 32 to 24 */
+ __asm __volatile(
+ "movq %%mm0, %%mm4\n\t"
+ "movq %%mm3, %%mm5\n\t"
+ "movq %%mm6, %%mm0\n\t"
+ "movq %%mm7, %%mm1\n\t"
+
+ "movq %%mm4, %%mm6\n\t"
+ "movq %%mm5, %%mm7\n\t"
+ "movq %%mm0, %%mm2\n\t"
+ "movq %%mm1, %%mm3\n\t"
+
+ "psrlq $8, %%mm2\n\t"
+ "psrlq $8, %%mm3\n\t"
+ "psrlq $8, %%mm6\n\t"
+ "psrlq $8, %%mm7\n\t"
+ "pand %2, %%mm0\n\t"
+ "pand %2, %%mm1\n\t"
+ "pand %2, %%mm4\n\t"
+ "pand %2, %%mm5\n\t"
+ "pand %3, %%mm2\n\t"
+ "pand %3, %%mm3\n\t"
+ "pand %3, %%mm6\n\t"
+ "pand %3, %%mm7\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "por %%mm3, %%mm1\n\t"
+ "por %%mm6, %%mm4\n\t"
+ "por %%mm7, %%mm5\n\t"
+
+ "movq %%mm1, %%mm2\n\t"
+ "movq %%mm4, %%mm3\n\t"
+ "psllq $48, %%mm2\n\t"
+ "psllq $32, %%mm3\n\t"
+ "pand %4, %%mm2\n\t"
+ "pand %5, %%mm3\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psrlq $16, %%mm1\n\t"
+ "psrlq $32, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm3, %%mm1\n\t"
+ "pand %6, %%mm5\n\t"
+ "por %%mm5, %%mm4\n\t"
+
+ MOVNTQ" %%mm0, %0\n\t"
+ MOVNTQ" %%mm1, 8%0\n\t"
+ MOVNTQ" %%mm4, 16%0"
+
+ :"=m"(*d)
+ :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
+ :"memory");
+ d += 24;
+ s += 8;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ register uint16_t bgr;
+ bgr = *s++;
+ *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr&0x7E0)>>3;
+ *d++ = (bgr&0xF800)>>8;
+ }
}
static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint16_t *end;
+ const uint16_t *end;
#if HAVE_MMX
- const uint16_t *mm_end;
+ const uint16_t *mm_end;
#endif
- 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;
+ end = s + src_size/2;
#if HAVE_MMX
- __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
- __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory");
- 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"
- "pand %2, %%mm0\n\t"
- "pand %3, %%mm1\n\t"
- "pand %4, %%mm2\n\t"
- "psllq $3, %%mm0\n\t"
- "psrlq $2, %%mm1\n\t"
- "psrlq $7, %%mm2\n\t"
- "movq %%mm0, %%mm3\n\t"
- "movq %%mm1, %%mm4\n\t"
- "movq %%mm2, %%mm5\n\t"
- "punpcklwd %%mm7, %%mm0\n\t"
- "punpcklwd %%mm7, %%mm1\n\t"
- "punpcklwd %%mm7, %%mm2\n\t"
- "punpckhwd %%mm7, %%mm3\n\t"
- "punpckhwd %%mm7, %%mm4\n\t"
- "punpckhwd %%mm7, %%mm5\n\t"
- "psllq $8, %%mm1\n\t"
- "psllq $16, %%mm2\n\t"
- "por %%mm1, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t"
- "psllq $8, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm4, %%mm3\n\t"
- "por %%mm5, %%mm3\n\t"
- MOVNTQ" %%mm0, %0\n\t"
- MOVNTQ" %%mm3, 8%0\n\t"
- : "=m"(*d)
- : "m"(*s), "m"(mask15b), "m"(mask15g), "m"(mask15r)
- : "memory");
- d += 16;
- s += 4;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
-{
+ __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
+ __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory");
+ 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"
+ "pand %2, %%mm0\n\t"
+ "pand %3, %%mm1\n\t"
+ "pand %4, %%mm2\n\t"
+ "psllq $3, %%mm0\n\t"
+ "psrlq $2, %%mm1\n\t"
+ "psrlq $7, %%mm2\n\t"
+ "movq %%mm0, %%mm3\n\t"
+ "movq %%mm1, %%mm4\n\t"
+ "movq %%mm2, %%mm5\n\t"
+ "punpcklwd %%mm7, %%mm0\n\t"
+ "punpcklwd %%mm7, %%mm1\n\t"
+ "punpcklwd %%mm7, %%mm2\n\t"
+ "punpckhwd %%mm7, %%mm3\n\t"
+ "punpckhwd %%mm7, %%mm4\n\t"
+ "punpckhwd %%mm7, %%mm5\n\t"
+ "psllq $8, %%mm1\n\t"
+ "psllq $16, %%mm2\n\t"
+ "por %%mm1, %%mm0\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psllq $8, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm4, %%mm3\n\t"
+ "por %%mm5, %%mm3\n\t"
+ MOVNTQ" %%mm0, %0\n\t"
+ MOVNTQ" %%mm3, 8%0\n\t"
+ :"=m"(*d)
+ :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r)
+ :"memory");
+ d += 16;
+ s += 4;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
#if 0 //slightly slower on athlon
- int bgr = *s++;
- *((uint32_t*)d)++ = ((bgr & 0x1F) << 3) + ((bgr & 0x3E0) << 6) + ((bgr & 0x7C00) << 9);
+ int bgr= *s++;
+ *((uint32_t*)d)++ = ((bgr&0x1F)<<3) + ((bgr&0x3E0)<<6) + ((bgr&0x7C00)<<9);
#else
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr;
+ bgr = *s++;
#ifdef WORDS_BIGENDIAN
- *d++ = 0;
- *d++ = (bgr & 0x7C00) >> 7;
- *d++ = (bgr & 0x3E0) >> 2;
- *d++ = (bgr & 0x1F) << 3;
+ *d++ = 0;
+ *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++ = 0;
+ *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr&0x3E0)>>2;
+ *d++ = (bgr&0x7C00)>>7;
+ *d++ = 0;
#endif
#endif
- }
+ }
}
static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- const uint16_t *end;
+ const uint16_t *end;
#if HAVE_MMX
- const uint16_t *mm_end;
+ const uint16_t *mm_end;
#endif
- uint8_t *d = (uint8_t *)dst;
- const uint16_t *s = (uint16_t *)src;
- end = s + src_size / 2;
+ uint8_t *d = (uint8_t *)dst;
+ const uint16_t *s = (uint16_t *)src;
+ end = s + src_size/2;
#if HAVE_MMX
- __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
- __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory");
- 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"
- "pand %2, %%mm0\n\t"
- "pand %3, %%mm1\n\t"
- "pand %4, %%mm2\n\t"
- "psllq $3, %%mm0\n\t"
- "psrlq $3, %%mm1\n\t"
- "psrlq $8, %%mm2\n\t"
- "movq %%mm0, %%mm3\n\t"
- "movq %%mm1, %%mm4\n\t"
- "movq %%mm2, %%mm5\n\t"
- "punpcklwd %%mm7, %%mm0\n\t"
- "punpcklwd %%mm7, %%mm1\n\t"
- "punpcklwd %%mm7, %%mm2\n\t"
- "punpckhwd %%mm7, %%mm3\n\t"
- "punpckhwd %%mm7, %%mm4\n\t"
- "punpckhwd %%mm7, %%mm5\n\t"
- "psllq $8, %%mm1\n\t"
- "psllq $16, %%mm2\n\t"
- "por %%mm1, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t"
- "psllq $8, %%mm4\n\t"
- "psllq $16, %%mm5\n\t"
- "por %%mm4, %%mm3\n\t"
- "por %%mm5, %%mm3\n\t"
- MOVNTQ" %%mm0, %0\n\t"
- MOVNTQ" %%mm3, 8%0\n\t"
- : "=m"(*d)
- : "m"(*s), "m"(mask16b), "m"(mask16g), "m"(mask16r)
- : "memory");
- d += 16;
- s += 4;
- }
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-#endif
- while(s < end)
-{
- register uint16_t bgr;
- bgr = *s++;
+ __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
+ __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory");
+ 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"
+ "pand %2, %%mm0\n\t"
+ "pand %3, %%mm1\n\t"
+ "pand %4, %%mm2\n\t"
+ "psllq $3, %%mm0\n\t"
+ "psrlq $3, %%mm1\n\t"
+ "psrlq $8, %%mm2\n\t"
+ "movq %%mm0, %%mm3\n\t"
+ "movq %%mm1, %%mm4\n\t"
+ "movq %%mm2, %%mm5\n\t"
+ "punpcklwd %%mm7, %%mm0\n\t"
+ "punpcklwd %%mm7, %%mm1\n\t"
+ "punpcklwd %%mm7, %%mm2\n\t"
+ "punpckhwd %%mm7, %%mm3\n\t"
+ "punpckhwd %%mm7, %%mm4\n\t"
+ "punpckhwd %%mm7, %%mm5\n\t"
+ "psllq $8, %%mm1\n\t"
+ "psllq $16, %%mm2\n\t"
+ "por %%mm1, %%mm0\n\t"
+ "por %%mm2, %%mm0\n\t"
+ "psllq $8, %%mm4\n\t"
+ "psllq $16, %%mm5\n\t"
+ "por %%mm4, %%mm3\n\t"
+ "por %%mm5, %%mm3\n\t"
+ MOVNTQ" %%mm0, %0\n\t"
+ MOVNTQ" %%mm3, 8%0\n\t"
+ :"=m"(*d)
+ :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r)
+ :"memory");
+ d += 16;
+ s += 4;
+ }
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+#endif
+ while(s < end)
+ {
+ register uint16_t bgr;
+ bgr = *s++;
#ifdef WORDS_BIGENDIAN
- *d++ = 0;
- *d++ = (bgr & 0xF800) >> 8;
- *d++ = (bgr & 0x7E0) >> 3;
- *d++ = (bgr & 0x1F) << 3;
+ *d++ = 0;
+ *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++ = 0;
+ *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr&0x7E0)>>3;
+ *d++ = (bgr&0xF800)>>8;
+ *d++ = 0;
#endif
- }
+ }
}
static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
#if HAVE_MMX
- /* TODO: unroll this loop */
- asm volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ".balign 16 \n\t"
- "1: \n\t"
- PREFETCH" 32(%0, %%"REG_a") \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "pslld $16, %%mm0 \n\t"
- "psrld $16, %%mm1 \n\t"
- "pand "MANGLE(mask32r)", %%mm0 \n\t"
- "pand "MANGLE(mask32g)", %%mm2 \n\t"
- "pand "MANGLE(mask32b)", %%mm1 \n\t"
- "por %%mm0, %%mm2 \n\t"
- "por %%mm1, %%mm2 \n\t"
- MOVNTQ" %%mm2, (%1, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- "cmp %2, %%"REG_a" \n\t"
- " jb 1b \n\t"
- :: "r"(src), "r"(dst), "r"(src_size-7)
- : "%"REG_a
- );
-
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
+/* TODO: unroll this loop */
+ asm volatile (
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ ".balign 16 \n\t"
+ "1: \n\t"
+ PREFETCH" 32(%0, %%"REG_a") \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm0, %%mm2 \n\t"
+ "pslld $16, %%mm0 \n\t"
+ "psrld $16, %%mm1 \n\t"
+ "pand "MANGLE(mask32r)", %%mm0 \n\t"
+ "pand "MANGLE(mask32g)", %%mm2 \n\t"
+ "pand "MANGLE(mask32b)", %%mm1 \n\t"
+ "por %%mm0, %%mm2 \n\t"
+ "por %%mm1, %%mm2 \n\t"
+ MOVNTQ" %%mm2, (%1, %%"REG_a") \n\t"
+ "add $8, %%"REG_a" \n\t"
+ "cmp %2, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ :: "r" (src), "r"(dst), "r" (src_size-7)
+ : "%"REG_a
+ );
+
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
#else
- unsigned i;
- stride_t num_pixels = src_size >> 2;
- for(i = 0; i < num_pixels; i++)
- {
+ unsigned i;
+ stride_t num_pixels = src_size >> 2;
+ for(i=0; i<num_pixels; i++)
+ {
#ifdef WORDS_BIGENDIAN
- dst[4*i + 1] = src[4*i + 3];
- dst[4*i + 2] = src[4*i + 2];
- dst[4*i + 3] = src[4*i + 1];
+ dst[4*i + 1] = src[4*i + 3];
+ dst[4*i + 2] = src[4*i + 2];
+ dst[4*i + 3] = src[4*i + 1];
#else
- dst[4*i + 0] = src[4*i + 2];
- dst[4*i + 1] = src[4*i + 1];
- dst[4*i + 2] = src[4*i + 0];
+ dst[4*i + 0] = src[4*i + 2];
+ dst[4*i + 1] = src[4*i + 1];
+ dst[4*i + 2] = src[4*i + 0];
#endif
- }
+ }
#endif
}
static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, stride_t src_size)
{
- unsigned i;
+ unsigned i;
#if HAVE_MMX
- long mmx_size = 23 - src_size;
- asm volatile(
- "movq "MANGLE(mask24r)", %%mm5 \n\t"
- "movq "MANGLE(mask24g)", %%mm6 \n\t"
- "movq "MANGLE(mask24b)", %%mm7 \n\t"
- ".balign 16 \n\t"
- "1: \n\t"
- PREFETCH" 32(%1, %%"REG_a") \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
- "movq (%1, %%"REG_a"), %%mm1 \n\t" // BGR BGR BG
- "movq 2(%1, %%"REG_a"), %%mm2 \n\t" // R BGR BGR B
- "psllq $16, %%mm0 \n\t" // 00 BGR BGR
- "pand %%mm5, %%mm0 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "por %%mm0, %%mm1 \n\t"
- "por %%mm2, %%mm1 \n\t"
- "movq 6(%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
- MOVNTQ" %%mm1, (%2, %%"REG_a")\n\t" // RGB RGB RG
- "movq 8(%1, %%"REG_a"), %%mm1 \n\t" // R BGR BGR B
- "movq 10(%1, %%"REG_a"), %%mm2 \n\t" // GR BGR BGR
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm5, %%mm1 \n\t"
- "pand %%mm6, %%mm2 \n\t"
- "por %%mm0, %%mm1 \n\t"
- "por %%mm2, %%mm1 \n\t"
- "movq 14(%1, %%"REG_a"), %%mm0 \n\t" // R BGR BGR B
- MOVNTQ" %%mm1, 8(%2, %%"REG_a")\n\t" // B RGB RGB R
- "movq 16(%1, %%"REG_a"), %%mm1 \n\t" // GR BGR BGR
- "movq 18(%1, %%"REG_a"), %%mm2 \n\t" // BGR BGR BG
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm5, %%mm2 \n\t"
- "por %%mm0, %%mm1 \n\t"
- "por %%mm2, %%mm1 \n\t"
- MOVNTQ" %%mm1, 16(%2, %%"REG_a")\n\t"
- "add $24, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+a"(mmx_size)
- : "r"(src-mmx_size), "r"(dst-mmx_size)
- );
-
- __asm __volatile(SFENCE:::"memory");
- __asm __volatile(EMMS:::"memory");
-
- if(mmx_size == 23) return; //finihsed, was multiple of 8
-
- src += src_size;
- dst += src_size;
- src_size = 23 - mmx_size;
- src -= src_size;
- dst -= src_size;
-#endif
- 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;
- }
+ long mmx_size= 23 - src_size;
+ asm volatile (
+ "movq "MANGLE(mask24r)", %%mm5 \n\t"
+ "movq "MANGLE(mask24g)", %%mm6 \n\t"
+ "movq "MANGLE(mask24b)", %%mm7 \n\t"
+ ".balign 16 \n\t"
+ "1: \n\t"
+ PREFETCH" 32(%1, %%"REG_a") \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
+ "movq (%1, %%"REG_a"), %%mm1 \n\t" // BGR BGR BG
+ "movq 2(%1, %%"REG_a"), %%mm2 \n\t" // R BGR BGR B
+ "psllq $16, %%mm0 \n\t" // 00 BGR BGR
+ "pand %%mm5, %%mm0 \n\t"
+ "pand %%mm6, %%mm1 \n\t"
+ "pand %%mm7, %%mm2 \n\t"
+ "por %%mm0, %%mm1 \n\t"
+ "por %%mm2, %%mm1 \n\t"
+ "movq 6(%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
+ MOVNTQ" %%mm1, (%2, %%"REG_a")\n\t" // RGB RGB RG
+ "movq 8(%1, %%"REG_a"), %%mm1 \n\t" // R BGR BGR B
+ "movq 10(%1, %%"REG_a"), %%mm2 \n\t" // GR BGR BGR
+ "pand %%mm7, %%mm0 \n\t"
+ "pand %%mm5, %%mm1 \n\t"
+ "pand %%mm6, %%mm2 \n\t"
+ "por %%mm0, %%mm1 \n\t"
+ "por %%mm2, %%mm1 \n\t"
+ "movq 14(%1, %%"REG_a"), %%mm0 \n\t" // R BGR BGR B
+ MOVNTQ" %%mm1, 8(%2, %%"REG_a")\n\t" // B RGB RGB R
+ "movq 16(%1, %%"REG_a"), %%mm1 \n\t" // GR BGR BGR
+ "movq 18(%1, %%"REG_a"), %%mm2 \n\t" // BGR BGR BG
+ "pand %%mm6, %%mm0 \n\t"
+ "pand %%mm7, %%mm1 \n\t"
+ "pand %%mm5, %%mm2 \n\t"
+ "por %%mm0, %%mm1 \n\t"
+ "por %%mm2, %%mm1 \n\t"
+ MOVNTQ" %%mm1, 16(%2, %%"REG_a")\n\t"
+ "add $24, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ : "+a" (mmx_size)
+ : "r" (src-mmx_size), "r"(dst-mmx_size)
+ );
+
+ __asm __volatile(SFENCE:::"memory");
+ __asm __volatile(EMMS:::"memory");
+
+ if(mmx_size==23) return; //finihsed, was multiple of 8
+
+ src+= src_size;
+ dst+= src_size;
+ src_size= 23-mmx_size;
+ src-= src_size;
+ dst-= src_size;
+#endif
+ 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;
+ }
}
static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride, long vertLumPerChroma)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride, long vertLumPerChroma)
{
- long y;
- const stride_t chromWidth = width >> 1;
- for(y = 0; y < height; y++)
- {
+ long y;
+ const stride_t chromWidth= width>>1;
+ for(y=0; y<height; y++)
+ {
#if HAVE_MMX
//FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
- asm volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ".balign 16 \n\t"
- "1: \n\t"
- PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
- PREFETCH" 32(%2, %%"REG_a") \n\t"
- PREFETCH" 32(%3, %%"REG_a") \n\t"
- "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
- "movq %%mm0, %%mm2 \n\t" // U(0)
- "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
- "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
-
- "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
- "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
- "movq %%mm3, %%mm4 \n\t" // Y(0)
- "movq %%mm5, %%mm6 \n\t" // Y(8)
- "punpcklbw %%mm0, %%mm3 \n\t" // YUYV YUYV(0)
- "punpckhbw %%mm0, %%mm4 \n\t" // YUYV YUYV(4)
- "punpcklbw %%mm2, %%mm5 \n\t" // YUYV YUYV(8)
- "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12)
-
- MOVNTQ" %%mm3, (%0, %%"REG_a", 4)\n\t"
- MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t"
- MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4)\n\t"
- MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g"(chromWidth)
- : "%"REG_a
- );
+ asm volatile(
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ ".balign 16 \n\t"
+ "1: \n\t"
+ PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
+ PREFETCH" 32(%2, %%"REG_a") \n\t"
+ PREFETCH" 32(%3, %%"REG_a") \n\t"
+ "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
+ "movq %%mm0, %%mm2 \n\t" // U(0)
+ "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
+ "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
+ "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
+
+ "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
+ "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
+ "movq %%mm3, %%mm4 \n\t" // Y(0)
+ "movq %%mm5, %%mm6 \n\t" // Y(8)
+ "punpcklbw %%mm0, %%mm3 \n\t" // YUYV YUYV(0)
+ "punpckhbw %%mm0, %%mm4 \n\t" // YUYV YUYV(4)
+ "punpcklbw %%mm2, %%mm5 \n\t" // YUYV YUYV(8)
+ "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12)
+
+ MOVNTQ" %%mm3, (%0, %%"REG_a", 4)\n\t"
+ MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t"
+ MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4)\n\t"
+ MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ "cmp %4, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
+ : "%"REG_a
+ );
#else
#if defined ARCH_ALPHA && defined HAVE_MVI
@@ -1531,83 +1527,80 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u
qdst[n] = yuv1; \
qdst2[n] = yuv2;
- int i;
- uint64_t *qdst = (uint64_t *) dst;
- uint64_t *qdst2 = (uint64_t *)(dst + dstStride);
- const uint32_t *yc = (uint32_t *) ysrc;
- const uint32_t *yc2 = (uint32_t *)(ysrc + lumStride);
- const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc;
- for(i = 0; i < chromWidth; i += 8)
- {
- uint64_t y1, y2, yuv1, yuv2;
- uint64_t u, v;
- /* Prefetch */
- asm("ldq $31,64(%0)" :: "r"(yc));
- asm("ldq $31,64(%0)" :: "r"(yc2));
- asm("ldq $31,64(%0)" :: "r"(uc));
- asm("ldq $31,64(%0)" :: "r"(vc));
-
- pl2yuy2(0);
- pl2yuy2(1);
- pl2yuy2(2);
- pl2yuy2(3);
-
- yc += 4;
- yc2 += 4;
- uc += 4;
- vc += 4;
- qdst += 4;
- qdst2 += 4;
- }
- y++;
- ysrc += lumStride;
- dst += dstStride;
+ int i;
+ uint64_t *qdst = (uint64_t *) dst;
+ uint64_t *qdst2 = (uint64_t *) (dst + dstStride);
+ const uint32_t *yc = (uint32_t *) ysrc;
+ const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride);
+ const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc;
+ for(i = 0; i < chromWidth; i += 8){
+ uint64_t y1, y2, yuv1, yuv2;
+ uint64_t u, v;
+ /* Prefetch */
+ asm("ldq $31,64(%0)" :: "r"(yc));
+ asm("ldq $31,64(%0)" :: "r"(yc2));
+ asm("ldq $31,64(%0)" :: "r"(uc));
+ asm("ldq $31,64(%0)" :: "r"(vc));
+
+ pl2yuy2(0);
+ pl2yuy2(1);
+ pl2yuy2(2);
+ pl2yuy2(3);
+
+ yc += 4;
+ yc2 += 4;
+ uc += 4;
+ vc += 4;
+ qdst += 4;
+ qdst2 += 4;
+ }
+ y++;
+ ysrc += lumStride;
+ dst += dstStride;
#elif HAVE_FAST_64BIT
- int i;
- 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);
- *ldst++ = k + (l << 32);
- yc += 4;
- uc += 2;
- vc += 2;
- }
+ int i;
+ 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);
+ *ldst++ = k + (l << 32);
+ yc += 4;
+ uc += 2;
+ vc += 2;
+ }
#else
- int i, *idst = (int32_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for(i = 0; i < chromWidth; i++)
- {
+ int i, *idst = (int32_t *) dst;
+ const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+ for(i = 0; i < chromWidth; i++){
#ifdef WORDS_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);
-#endif
- yc += 2;
- uc++;
- vc++;
- }
-#endif
-#endif
- if((y&(vertLumPerChroma - 1)) == (vertLumPerChroma - 1))
- {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
+ *idst++ = yc[0] + (uc[0] << 8) +
+ (yc[1] << 16) + (vc[0] << 24);
+#endif
+ yc += 2;
+ uc++;
+ vc++;
+ }
+#endif
+#endif
+ if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
+ {
+ usrc += chromStride;
+ vsrc += chromStride;
+ }
+ ysrc += lumStride;
+ dst += dstStride;
+ }
#if HAVE_MMX
- asm(EMMS" \n\t"
+asm( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
@@ -1619,55 +1612,55 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u
* problem for anyone then tell me, and ill fix it)
*/
static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride)
{
- //FIXME interpolate chroma
- RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
+ //FIXME interpolate chroma
+ RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
}
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride, stride_t vertLumPerChroma)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride, stride_t vertLumPerChroma)
{
long y;
- const x86_reg chromWidth = width >> 1;
- for(y = 0; y < height; y++)
+ const x86_reg chromWidth= width>>1;
+ for (y=0; y<height; y++)
{
#if HAVE_MMX
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
__asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
- PREFETCH" 32(%2, %%"REG_a") \n\t"
- PREFETCH" 32(%3, %%"REG_a") \n\t"
- "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
- "movq %%mm0, %%mm2 \n\t" // U(0)
- "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
- "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
-
- "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
- "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
- "movq %%mm0, %%mm4 \n\t" // Y(0)
- "movq %%mm2, %%mm6 \n\t" // Y(8)
- "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0)
- "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4)
- "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8)
- "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12)
-
- MOVNTQ" %%mm0, (%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g"(chromWidth)
- : "%"REG_a
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ ASMALIGN(4)
+ "1: \n\t"
+ PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
+ PREFETCH" 32(%2, %%"REG_a") \n\t"
+ PREFETCH" 32(%3, %%"REG_a") \n\t"
+ "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
+ "movq %%mm0, %%mm2 \n\t" // U(0)
+ "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
+ "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
+ "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
+
+ "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
+ "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
+ "movq %%mm0, %%mm4 \n\t" // Y(0)
+ "movq %%mm2, %%mm6 \n\t" // Y(8)
+ "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0)
+ "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4)
+ "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8)
+ "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12)
+
+ MOVNTQ" %%mm0, (%0, %%"REG_a", 4) \n\t"
+ MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t"
+ MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4) \n\t"
+ MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ "cmp %4, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
+ : "%"REG_a
);
#else
//FIXME adapt the Alpha ASM code from yv12->yuy2
@@ -1676,8 +1669,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
int i;
uint64_t *ldst = (uint64_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for(i = 0; i < chromWidth; i += 2)
- {
+ for (i = 0; i < chromWidth; i += 2){
uint64_t k, l;
k = uc[0] + (yc[0] << 8) +
(vc[0] << 16) + (yc[1] << 24);
@@ -1692,14 +1684,13 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
#else
int i, *idst = (int32_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for(i = 0; i < chromWidth; i++)
- {
+ for (i = 0; i < chromWidth; i++){
#ifdef WORDS_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);
+ *idst++ = uc[0] + (yc[0] << 8) +
+ (vc[0] << 16) + (yc[1] << 24);
#endif
yc += 2;
uc++;
@@ -1707,7 +1698,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
}
#endif
#endif
- if((y&(vertLumPerChroma - 1)) == vertLumPerChroma - 1)
+ if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1)
{
usrc += chromStride;
vsrc += chromStride;
@@ -1716,66 +1707,64 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
dst += dstStride;
}
#if HAVE_MMX
- __asm__(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
+__asm__( EMMS" \n\t"
+ SFENCE" \n\t"
+ :::"memory");
#endif
}
static inline void RENAME(yuvPlanartovyuy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride, stride_t vertLumPerChroma)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride, stride_t vertLumPerChroma)
{
- long y;
- const stride_t chromWidth = width >> 1;
- for(y = 0; y < height; y++)
- {
- int i, *idst = (int32_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for(i = 0; i < chromWidth; i++)
- {
- *idst++ = vc[0] + (yc[0] << 8) +
- (uc[0] << 16) + (yc[1] << 24);
- yc += 2;
- uc++;
- vc++;
- }
- if((y&(vertLumPerChroma - 1)) == (vertLumPerChroma - 1))
- {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
+ long y;
+ const stride_t chromWidth= width>>1;
+ for(y=0; y<height; y++)
+ {
+ int i, *idst = (int32_t *) dst;
+ const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+ for(i = 0; i < chromWidth; i++){
+ *idst++ = vc[0] + (yc[0] << 8) +
+ (uc[0] << 16) + (yc[1] << 24);
+ yc += 2;
+ uc++;
+ vc++;
+ }
+ if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
+ {
+ usrc += chromStride;
+ vsrc += chromStride;
+ }
+ ysrc += lumStride;
+ dst += dstStride;
+ }
}
static inline void RENAME(yuvPlanartoyvyu)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride, stride_t vertLumPerChroma)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride, stride_t vertLumPerChroma)
{
- long y;
- const stride_t chromWidth = width >> 1;
- for(y = 0; y < height; y++)
- {
- int i, *idst = (int32_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for(i = 0; i < chromWidth; i++)
- {
- *idst++ = yc[0] + (vc[0] << 8) +
- (yc[1] << 16) + (uc[0] << 24);
- yc += 2;
- uc++;
- vc++;
- }
- if((y&(vertLumPerChroma - 1)) == (vertLumPerChroma - 1))
- {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
+ long y;
+ const stride_t chromWidth= width>>1;
+ for(y=0; y<height; y++)
+ {
+ int i, *idst = (int32_t *) dst;
+ const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+ for(i = 0; i < chromWidth; i++){
+ *idst++ = yc[0] + (vc[0] << 8) +
+ (yc[1] << 16) + (uc[0] << 24);
+ yc += 2;
+ uc++;
+ vc++;
+ }
+ if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
+ {
+ usrc += chromStride;
+ vsrc += chromStride;
+ }
+ ysrc += lumStride;
+ dst += dstStride;
+ }
}
/**
@@ -1783,24 +1772,24 @@ static inline void RENAME(yuvPlanartoyvyu)(const uint8_t *ysrc, const uint8_t *u
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride)
{
//FIXME interpolate chroma
RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
}
static inline void RENAME(yv12toyvyu)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride)
{
//FIXME interpolate chroma
RENAME(yuvPlanartoyvyu)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
}
static inline void RENAME(yv12tovyuy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride)
{
//FIXME interpolate chroma
RENAME(yuvPlanartovyuy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
@@ -1810,8 +1799,8 @@ static inline void RENAME(yv12tovyuy)(const uint8_t *ysrc, const uint8_t *usrc,
* Width should be a multiple of 16.
*/
static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t dstStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t dstStride)
{
RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
}
@@ -1821,98 +1810,98 @@ static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usr
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride)
{
long y;
- const x86_reg chromWidth = width >> 1;
- for(y = 0; y < height; y += 2)
+ const x86_reg chromWidth= width>>1;
+ for (y=0; y<height; y+=2)
{
#if HAVE_MMX
__asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
- "movq %%mm0, %%mm2 \n\t" // YUYV YUYV(0)
- "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(4)
- "psrlw $8, %%mm0 \n\t" // U0V0 U0V0(0)
- "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(4)
- "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
- "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
- "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
-
- MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t"
-
- "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(8)
- "movq 24(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(12)
- "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(8)
- "movq %%mm2, %%mm4 \n\t" // YUYV YUYV(12)
- "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(8)
- "psrlw $8, %%mm2 \n\t" // U0V0 U0V0(12)
- "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
- "pand %%mm7, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
- "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t"
-
- "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
- "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
- "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
- "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
- "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
- "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
- "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
- "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
-
- MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
- MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g"(chromWidth)
- : "memory", "%"REG_a
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
+ ASMALIGN(4)
+ "1: \n\t"
+ PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
+ "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
+ "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
+ "movq %%mm0, %%mm2 \n\t" // YUYV YUYV(0)
+ "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(4)
+ "psrlw $8, %%mm0 \n\t" // U0V0 U0V0(0)
+ "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(4)
+ "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
+ "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
+ "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
+ "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
+
+ MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t"
+
+ "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(8)
+ "movq 24(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(12)
+ "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(8)
+ "movq %%mm2, %%mm4 \n\t" // YUYV YUYV(12)
+ "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(8)
+ "psrlw $8, %%mm2 \n\t" // U0V0 U0V0(12)
+ "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
+ "pand %%mm7, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
+ "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
+ "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
+
+ MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t"
+
+ "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
+ "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
+ "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
+ "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
+ "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
+ "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
+ "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
+ "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
+
+ MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
+ MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ "cmp %4, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
+ : "memory", "%"REG_a
);
ydst += lumStride;
src += srcStride;
__asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
- "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8)
- "movq 24(%0, %%"REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12)
- "pand %%mm7, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
- "pand %%mm7, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
- "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
- "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
-
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g"(chromWidth)
- : "memory", "%"REG_a
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ ASMALIGN(4)
+ "1: \n\t"
+ PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
+ "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
+ "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
+ "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8)
+ "movq 24(%0, %%"REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12)
+ "pand %%mm7, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
+ "pand %%mm7, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
+ "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
+ "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
+ "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
+ "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
+
+ MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ "cmp %4, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+
+ ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
+ : "memory", "%"REG_a
);
#else
long i;
- for(i = 0; i < chromWidth; i++)
+ for (i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+0];
udst[i] = src[4*i+1];
@@ -1922,7 +1911,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
ydst += lumStride;
src += srcStride;
- for(i = 0; i < chromWidth; i++)
+ for (i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+0];
ydst[2*i+1] = src[4*i+2];
@@ -1934,126 +1923,121 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
src += srcStride;
}
#if HAVE_MMX
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
+__asm__ volatile( EMMS" \n\t"
+ SFENCE" \n\t"
+ :::"memory");
#endif
}
static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
- uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height, stride_t lumStride, stride_t chromStride)
+ uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+ long width, long height, stride_t lumStride, stride_t chromStride)
{
/* Y Plane */
- memcpy(ydst, ysrc, width * height);
+ memcpy(ydst, ysrc, width*height);
/* XXX: implement upscaling for U,V */
}
static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, stride_t srcStride, stride_t dstStride)
{
- long x, y;
+ long 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++){
#if HAVE_MMX2 || HAVE_AMD3DNOW
- const x86_reg mmxSize = srcWidth&~15;
+ const x86_reg mmxSize= srcWidth&~15;
__asm__ volatile(
- "mov %4, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq (%1, %%"REG_a"), %%mm1 \n\t"
- "movq 1(%0, %%"REG_a"), %%mm2 \n\t"
- "movq 1(%1, %%"REG_a"), %%mm3 \n\t"
- "movq -1(%0, %%"REG_a"), %%mm4 \n\t"
- "movq -1(%1, %%"REG_a"), %%mm5 \n\t"
- PAVGB" %%mm0, %%mm5 \n\t"
- PAVGB" %%mm0, %%mm3 \n\t"
- PAVGB" %%mm0, %%mm5 \n\t"
- PAVGB" %%mm0, %%mm3 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- "movq %%mm5, %%mm7 \n\t"
- "movq %%mm4, %%mm6 \n\t"
- "punpcklbw %%mm3, %%mm5 \n\t"
- "punpckhbw %%mm3, %%mm7 \n\t"
- "punpcklbw %%mm2, %%mm4 \n\t"
- "punpckhbw %%mm2, %%mm6 \n\t"
+ "mov %4, %%"REG_a" \n\t"
+ "1: \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq (%1, %%"REG_a"), %%mm1 \n\t"
+ "movq 1(%0, %%"REG_a"), %%mm2 \n\t"
+ "movq 1(%1, %%"REG_a"), %%mm3 \n\t"
+ "movq -1(%0, %%"REG_a"), %%mm4 \n\t"
+ "movq -1(%1, %%"REG_a"), %%mm5 \n\t"
+ PAVGB" %%mm0, %%mm5 \n\t"
+ PAVGB" %%mm0, %%mm3 \n\t"
+ PAVGB" %%mm0, %%mm5 \n\t"
+ PAVGB" %%mm0, %%mm3 \n\t"
+ PAVGB" %%mm1, %%mm4 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ PAVGB" %%mm1, %%mm4 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ "movq %%mm5, %%mm7 \n\t"
+ "movq %%mm4, %%mm6 \n\t"
+ "punpcklbw %%mm3, %%mm5 \n\t"
+ "punpckhbw %%mm3, %%mm7 \n\t"
+ "punpcklbw %%mm2, %%mm4 \n\t"
+ "punpckhbw %%mm2, %%mm6 \n\t"
#if 1
- MOVNTQ" %%mm5, (%2, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm4, (%3, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm5, (%2, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm4, (%3, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2) \n\t"
#else
- "movq %%mm5, (%2, %%"REG_a", 2) \n\t"
- "movq %%mm7, 8(%2, %%"REG_a", 2) \n\t"
- "movq %%mm4, (%3, %%"REG_a", 2) \n\t"
- "movq %%mm6, 8(%3, %%"REG_a", 2) \n\t"
-#endif
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- :: "r"(src + mmxSize), "r"(src + srcStride + mmxSize),
- "r"(dst + mmxSize*2), "r"(dst + dstStride + mmxSize*2),
- "g"(-mmxSize)
- : "%"REG_a
+ "movq %%mm5, (%2, %%"REG_a", 2) \n\t"
+ "movq %%mm7, 8(%2, %%"REG_a", 2) \n\t"
+ "movq %%mm4, (%3, %%"REG_a", 2) \n\t"
+ "movq %%mm6, 8(%3, %%"REG_a", 2) \n\t"
+#endif
+ "add $8, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ),
+ "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2),
+ "g" (-mmxSize)
+ : "%"REG_a
);
#else
- const x86_reg mmxSize = 1;
+ const x86_reg mmxSize=1;
#endif
- dst[0 ] = (3 * src[0] + src[srcStride]) >> 2;
- dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2;
+ dst[0 ]= (3*src[0] + 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]= (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;
}
- 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 ]= (3*src[srcWidth-1] + 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
#if 1
- 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]= (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];
#else
- for(x = 0; x < srcWidth; x++)
- {
- dst[2*x+0] =
- dst[2*x+1] = src[x];
+ for (x=0; x<srcWidth; x++){
+ dst[2*x+0]=
+ dst[2*x+1]= src[x];
}
#endif
#if HAVE_MMX
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
+__asm__ volatile( EMMS" \n\t"
+ SFENCE" \n\t"
+ :::"memory");
#endif
}
@@ -2064,98 +2048,98 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi
* FIXME: Write HQ version.
*/
static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride)
+ long width, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride)
{
long y;
- const x86_reg chromWidth = width >> 1;
- for(y = 0; y < height; y += 2)
+ const x86_reg chromWidth= width>>1;
+ for (y=0; y<height; y+=2)
{
#if HAVE_MMX
__asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // UYVY UYVY(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(4)
- "movq %%mm0, %%mm2 \n\t" // UYVY UYVY(0)
- "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(4)
- "pand %%mm7, %%mm0 \n\t" // U0V0 U0V0(0)
- "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(4)
- "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
- "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
- "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
-
- MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t"
-
- "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(8)
- "movq 24(%0, %%"REG_a", 4), %%mm2 \n\t" // UYVY UYVY(12)
- "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(8)
- "movq %%mm2, %%mm4 \n\t" // UYVY UYVY(12)
- "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(8)
- "pand %%mm7, %%mm2 \n\t" // U0V0 U0V0(12)
- "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
- "psrlw $8, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
- "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t"
-
- "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
- "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
- "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
- "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
- "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
- "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
- "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
- "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
-
- MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
- MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g"(chromWidth)
- : "memory", "%"REG_a
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
+ ASMALIGN(4)
+ "1: \n\t"
+ PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
+ "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // UYVY UYVY(0)
+ "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(4)
+ "movq %%mm0, %%mm2 \n\t" // UYVY UYVY(0)
+ "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(4)
+ "pand %%mm7, %%mm0 \n\t" // U0V0 U0V0(0)
+ "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(4)
+ "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
+ "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
+ "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
+ "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
+
+ MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t"
+
+ "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(8)
+ "movq 24(%0, %%"REG_a", 4), %%mm2 \n\t" // UYVY UYVY(12)
+ "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(8)
+ "movq %%mm2, %%mm4 \n\t" // UYVY UYVY(12)
+ "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(8)
+ "pand %%mm7, %%mm2 \n\t" // U0V0 U0V0(12)
+ "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
+ "psrlw $8, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
+ "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
+ "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
+
+ MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t"
+
+ "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
+ "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
+ "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
+ "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
+ "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
+ "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
+ "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
+ "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
+
+ MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
+ MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ "cmp %4, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
+ : "memory", "%"REG_a
);
ydst += lumStride;
src += srcStride;
__asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
- "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8)
- "movq 24(%0, %%"REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12)
- "psrlw $8, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
- "psrlw $8, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
- "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
- "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
-
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g"(chromWidth)
- : "memory", "%"REG_a
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ ASMALIGN(4)
+ "1: \n\t"
+ PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
+ "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
+ "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
+ "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8)
+ "movq 24(%0, %%"REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12)
+ "psrlw $8, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
+ "psrlw $8, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
+ "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
+ "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
+ "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
+ "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
+
+ MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ "cmp %4, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+
+ ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
+ : "memory", "%"REG_a
);
#else
long i;
- for(i = 0; i < chromWidth; i++)
+ for (i=0; i<chromWidth; i++)
{
udst[i] = src[4*i+0];
ydst[2*i+0] = src[4*i+1];
@@ -2165,7 +2149,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
ydst += lumStride;
src += srcStride;
- for(i = 0; i < chromWidth; i++)
+ for (i=0; i<chromWidth; i++)
{
ydst[2*i+0] = src[4*i+1];
ydst[2*i+1] = src[4*i+3];
@@ -2177,9 +2161,9 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
src += srcStride;
}
#if HAVE_MMX
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
+__asm__ volatile( EMMS" \n\t"
+ SFENCE" \n\t"
+ :::"memory");
#endif
}
@@ -2191,582 +2175,576 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
* FIXME: Write HQ version.
*/
static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width0, long height,
- stride_t lumStride, stride_t chromStride, stride_t srcStride)
+ long width0, long height,
+ stride_t lumStride, stride_t chromStride, stride_t srcStride)
{
- long y;
- const stride_t chromWidth = width0 >> 1;
- const stride_t width = width0;
+ long y;
+ const stride_t chromWidth= width0>>1;
+ const stride_t width = width0;
#if HAVE_MMX
- for(y = 0; y < height - 2; y += 2)
- {
- long i;
- for(i = 0; i < 2; i++)
- {
- asm volatile(
- "mov %2, %%"REG_a" \n\t"
- "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t"
- "movq "MANGLE(w1111)", %%mm5 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
- ".balign 16 \n\t"
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_b") \n\t"
- "movd (%0, %%"REG_b"), %%mm0 \n\t"
- "movd 3(%0, %%"REG_b"), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "movd 6(%0, %%"REG_b"), %%mm2 \n\t"
- "movd 9(%0, %%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm0 \n\t"
- "pmaddwd %%mm6, %%mm1 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
+ for(y=0; y<height-2; y+=2)
+ {
+ long i;
+ for(i=0; i<2; i++)
+ {
+ asm volatile(
+ "mov %2, %%"REG_a" \n\t"
+ "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t"
+ "movq "MANGLE(w1111)", %%mm5 \n\t"
+ "pxor %%mm7, %%mm7 \n\t"
+ "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
+ ".balign 16 \n\t"
+ "1: \n\t"
+ PREFETCH" 64(%0, %%"REG_b") \n\t"
+ "movd (%0, %%"REG_b"), %%mm0 \n\t"
+ "movd 3(%0, %%"REG_b"), %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "movd 6(%0, %%"REG_b"), %%mm2 \n\t"
+ "movd 9(%0, %%"REG_b"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "pmaddwd %%mm6, %%mm0 \n\t"
+ "pmaddwd %%mm6, %%mm1 \n\t"
+ "pmaddwd %%mm6, %%mm2 \n\t"
+ "pmaddwd %%mm6, %%mm3 \n\t"
#ifndef FAST_BGR2YV12
- "psrad $8, %%mm0 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm1, %%mm0 \n\t"
- "packssdw %%mm3, %%mm2 \n\t"
- "pmaddwd %%mm5, %%mm0 \n\t"
- "pmaddwd %%mm5, %%mm2 \n\t"
- "packssdw %%mm2, %%mm0 \n\t"
- "psraw $7, %%mm0 \n\t"
-
- "movd 12(%0, %%"REG_b"), %%mm4 \n\t"
- "movd 15(%0, %%"REG_b"), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "movd 18(%0, %%"REG_b"), %%mm2 \n\t"
- "movd 21(%0, %%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm4 \n\t"
- "pmaddwd %%mm6, %%mm1 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
+ "psrad $8, %%mm0 \n\t"
+ "psrad $8, %%mm1 \n\t"
+ "psrad $8, %%mm2 \n\t"
+ "psrad $8, %%mm3 \n\t"
+#endif
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "pmaddwd %%mm5, %%mm0 \n\t"
+ "pmaddwd %%mm5, %%mm2 \n\t"
+ "packssdw %%mm2, %%mm0 \n\t"
+ "psraw $7, %%mm0 \n\t"
+
+ "movd 12(%0, %%"REG_b"), %%mm4 \n\t"
+ "movd 15(%0, %%"REG_b"), %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm4 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "movd 18(%0, %%"REG_b"), %%mm2 \n\t"
+ "movd 21(%0, %%"REG_b"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "pmaddwd %%mm6, %%mm4 \n\t"
+ "pmaddwd %%mm6, %%mm1 \n\t"
+ "pmaddwd %%mm6, %%mm2 \n\t"
+ "pmaddwd %%mm6, %%mm3 \n\t"
#ifndef FAST_BGR2YV12
- "psrad $8, %%mm4 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm1, %%mm4 \n\t"
- "packssdw %%mm3, %%mm2 \n\t"
- "pmaddwd %%mm5, %%mm4 \n\t"
- "pmaddwd %%mm5, %%mm2 \n\t"
- "add $24, %%"REG_b" \n\t"
- "packssdw %%mm2, %%mm4 \n\t"
- "psraw $7, %%mm4 \n\t"
-
- "packuswb %%mm4, %%mm0 \n\t"
- "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t"
-
- MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "r"(src+width*3), "r"(ydst+width), "g"(-width)
- : "%"REG_a, "%"REG_b
- );
- ydst += lumStride;
- src += srcStride;
- }
- src -= srcStride * 2;
- asm volatile(
- "mov %4, %%"REG_a" \n\t"
- "movq "MANGLE(w1111)", %%mm5 \n\t"
- "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
- "add %%"REG_b", %%"REG_b" \n\t"
- ".balign 16 \n\t"
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_b") \n\t"
- PREFETCH" 64(%1, %%"REG_b") \n\t"
+ "psrad $8, %%mm4 \n\t"
+ "psrad $8, %%mm1 \n\t"
+ "psrad $8, %%mm2 \n\t"
+ "psrad $8, %%mm3 \n\t"
+#endif
+ "packssdw %%mm1, %%mm4 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "pmaddwd %%mm5, %%mm4 \n\t"
+ "pmaddwd %%mm5, %%mm2 \n\t"
+ "add $24, %%"REG_b" \n\t"
+ "packssdw %%mm2, %%mm4 \n\t"
+ "psraw $7, %%mm4 \n\t"
+
+ "packuswb %%mm4, %%mm0 \n\t"
+ "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t"
+
+ MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t"
+ "add $8, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ : : "r" (src+width*3), "r" (ydst+width), "g" (-width)
+ : "%"REG_a, "%"REG_b
+ );
+ ydst += lumStride;
+ src += srcStride;
+ }
+ src -= srcStride*2;
+ asm volatile(
+ "mov %4, %%"REG_a" \n\t"
+ "movq "MANGLE(w1111)", %%mm5 \n\t"
+ "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t"
+ "pxor %%mm7, %%mm7 \n\t"
+ "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
+ "add %%"REG_b", %%"REG_b" \n\t"
+ ".balign 16 \n\t"
+ "1: \n\t"
+ PREFETCH" 64(%0, %%"REG_b") \n\t"
+ PREFETCH" 64(%1, %%"REG_b") \n\t"
#if HAVE_MMX2 || HAVE_AMD3DNOW
- "movq (%0, %%"REG_b"), %%mm0 \n\t"
- "movq (%1, %%"REG_b"), %%mm1 \n\t"
- "movq 6(%0, %%"REG_b"), %%mm2 \n\t"
- "movq 6(%1, %%"REG_b"), %%mm3 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlq $24, %%mm0 \n\t"
- "psrlq $24, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
+ "movq (%0, %%"REG_b"), %%mm0 \n\t"
+ "movq (%1, %%"REG_b"), %%mm1 \n\t"
+ "movq 6(%0, %%"REG_b"), %%mm2 \n\t"
+ "movq 6(%1, %%"REG_b"), %%mm3 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "psrlq $24, %%mm0 \n\t"
+ "psrlq $24, %%mm2 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
#else
- "movd (%0, %%"REG_b"), %%mm0 \n\t"
- "movd (%1, %%"REG_b"), %%mm1 \n\t"
- "movd 3(%0, %%"REG_b"), %%mm2 \n\t"
- "movd 3(%1, %%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "movd 6(%0, %%"REG_b"), %%mm4 \n\t"
- "movd 6(%1, %%"REG_b"), %%mm1 \n\t"
- "movd 9(%0, %%"REG_b"), %%mm2 \n\t"
- "movd 9(%1, %%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm4, %%mm2 \n\t"
- "psrlw $2, %%mm0 \n\t"
- "psrlw $2, %%mm2 \n\t"
-#endif
- "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t"
- "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t"
-
- "pmaddwd %%mm0, %%mm1 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm0 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
+ "movd (%0, %%"REG_b"), %%mm0 \n\t"
+ "movd (%1, %%"REG_b"), %%mm1 \n\t"
+ "movd 3(%0, %%"REG_b"), %%mm2 \n\t"
+ "movd 3(%1, %%"REG_b"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+ "paddw %%mm3, %%mm2 \n\t"
+ "paddw %%mm2, %%mm0 \n\t"
+ "movd 6(%0, %%"REG_b"), %%mm4 \n\t"
+ "movd 6(%1, %%"REG_b"), %%mm1 \n\t"
+ "movd 9(%0, %%"REG_b"), %%mm2 \n\t"
+ "movd 9(%1, %%"REG_b"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm4 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "paddw %%mm1, %%mm4 \n\t"
+ "paddw %%mm3, %%mm2 \n\t"
+ "paddw %%mm4, %%mm2 \n\t"
+ "psrlw $2, %%mm0 \n\t"
+ "psrlw $2, %%mm2 \n\t"
+#endif
+ "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t"
+ "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t"
+
+ "pmaddwd %%mm0, %%mm1 \n\t"
+ "pmaddwd %%mm2, %%mm3 \n\t"
+ "pmaddwd %%mm6, %%mm0 \n\t"
+ "pmaddwd %%mm6, %%mm2 \n\t"
#ifndef FAST_BGR2YV12
- "psrad $8, %%mm0 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm2, %%mm0 \n\t"
- "packssdw %%mm3, %%mm1 \n\t"
- "pmaddwd %%mm5, %%mm0 \n\t"
- "pmaddwd %%mm5, %%mm1 \n\t"
- "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
- "psraw $7, %%mm0 \n\t"
+ "psrad $8, %%mm0 \n\t"
+ "psrad $8, %%mm1 \n\t"
+ "psrad $8, %%mm2 \n\t"
+ "psrad $8, %%mm3 \n\t"
+#endif
+ "packssdw %%mm2, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm1 \n\t"
+ "pmaddwd %%mm5, %%mm0 \n\t"
+ "pmaddwd %%mm5, %%mm1 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
+ "psraw $7, %%mm0 \n\t"
#if HAVE_MMX2 || HAVE_AMD3DNOW
- "movq 12(%0, %%"REG_b"), %%mm4 \n\t"
- "movq 12(%1, %%"REG_b"), %%mm1 \n\t"
- "movq 18(%0, %%"REG_b"), %%mm2 \n\t"
- "movq 18(%1, %%"REG_b"), %%mm3 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "movq %%mm4, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlq $24, %%mm4 \n\t"
- "psrlq $24, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
+ "movq 12(%0, %%"REG_b"), %%mm4 \n\t"
+ "movq 12(%1, %%"REG_b"), %%mm1 \n\t"
+ "movq 18(%0, %%"REG_b"), %%mm2 \n\t"
+ "movq 18(%1, %%"REG_b"), %%mm3 \n\t"
+ PAVGB" %%mm1, %%mm4 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "movq %%mm4, %%mm1 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "psrlq $24, %%mm4 \n\t"
+ "psrlq $24, %%mm2 \n\t"
+ PAVGB" %%mm1, %%mm4 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm4 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
#else
- "movd 12(%0, %%"REG_b"), %%mm4 \n\t"
- "movd 12(%1, %%"REG_b"), %%mm1 \n\t"
- "movd 15(%0, %%"REG_b"), %%mm2 \n\t"
- "movd 15(%1, %%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm2, %%mm4 \n\t"
- "movd 18(%0, %%"REG_b"), %%mm5 \n\t"
- "movd 18(%1, %%"REG_b"), %%mm1 \n\t"
- "movd 21(%0, %%"REG_b"), %%mm2 \n\t"
- "movd 21(%1, %%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm5 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm5, %%mm2 \n\t"
- "movq "MANGLE(w1111)", %%mm5 \n\t"
- "psrlw $2, %%mm4 \n\t"
- "psrlw $2, %%mm2 \n\t"
-#endif
- "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t"
- "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t"
-
- "pmaddwd %%mm4, %%mm1 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm4 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
+ "movd 12(%0, %%"REG_b"), %%mm4 \n\t"
+ "movd 12(%1, %%"REG_b"), %%mm1 \n\t"
+ "movd 15(%0, %%"REG_b"), %%mm2 \n\t"
+ "movd 15(%1, %%"REG_b"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm4 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "paddw %%mm1, %%mm4 \n\t"
+ "paddw %%mm3, %%mm2 \n\t"
+ "paddw %%mm2, %%mm4 \n\t"
+ "movd 18(%0, %%"REG_b"), %%mm5 \n\t"
+ "movd 18(%1, %%"REG_b"), %%mm1 \n\t"
+ "movd 21(%0, %%"REG_b"), %%mm2 \n\t"
+ "movd 21(%1, %%"REG_b"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm5 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "paddw %%mm1, %%mm5 \n\t"
+ "paddw %%mm3, %%mm2 \n\t"
+ "paddw %%mm5, %%mm2 \n\t"
+ "movq "MANGLE(w1111)", %%mm5 \n\t"
+ "psrlw $2, %%mm4 \n\t"
+ "psrlw $2, %%mm2 \n\t"
+#endif
+ "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t"
+ "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t"
+
+ "pmaddwd %%mm4, %%mm1 \n\t"
+ "pmaddwd %%mm2, %%mm3 \n\t"
+ "pmaddwd %%mm6, %%mm4 \n\t"
+ "pmaddwd %%mm6, %%mm2 \n\t"
#ifndef FAST_BGR2YV12
- "psrad $8, %%mm4 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm2, %%mm4 \n\t"
- "packssdw %%mm3, %%mm1 \n\t"
- "pmaddwd %%mm5, %%mm4 \n\t"
- "pmaddwd %%mm5, %%mm1 \n\t"
- "add $24, %%"REG_b" \n\t"
- "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2
- "psraw $7, %%mm4 \n\t"
-
- "movq %%mm0, %%mm1 \n\t"
- "punpckldq %%mm4, %%mm0 \n\t"
- "punpckhdq %%mm4, %%mm1 \n\t"
- "packsswb %%mm1, %%mm0 \n\t"
- "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t"
- "movd %%mm0, (%2, %%"REG_a") \n\t"
- "punpckhdq %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%3, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "r"(src+chromWidth*6), "r"(src+srcStride+chromWidth*6), "r"(udst+chromWidth), "r"(vdst+chromWidth), "g"(-chromWidth)
- : "%"REG_a, "%"REG_b
- );
-
- udst += chromStride;
- vdst += chromStride;
- src += srcStride * 2;
- }
-
- asm volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
+ "psrad $8, %%mm4 \n\t"
+ "psrad $8, %%mm1 \n\t"
+ "psrad $8, %%mm2 \n\t"
+ "psrad $8, %%mm3 \n\t"
+#endif
+ "packssdw %%mm2, %%mm4 \n\t"
+ "packssdw %%mm3, %%mm1 \n\t"
+ "pmaddwd %%mm5, %%mm4 \n\t"
+ "pmaddwd %%mm5, %%mm1 \n\t"
+ "add $24, %%"REG_b" \n\t"
+ "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2
+ "psraw $7, %%mm4 \n\t"
+
+ "movq %%mm0, %%mm1 \n\t"
+ "punpckldq %%mm4, %%mm0 \n\t"
+ "punpckhdq %%mm4, %%mm1 \n\t"
+ "packsswb %%mm1, %%mm0 \n\t"
+ "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t"
+ "movd %%mm0, (%2, %%"REG_a") \n\t"
+ "punpckhdq %%mm0, %%mm0 \n\t"
+ "movd %%mm0, (%3, %%"REG_a") \n\t"
+ "add $4, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
+ : "%"REG_a, "%"REG_b
+ );
+
+ udst += chromStride;
+ vdst += chromStride;
+ src += srcStride*2;
+ }
+
+ asm volatile( EMMS" \n\t"
+ SFENCE" \n\t"
+ :::"memory");
#else
- y = 0;
-#endif
- for(; y < height; y += 2)
- {
- long 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];
-
- 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;
-
- 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;
- }
- 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];
-
- unsigned int Y = ((RY * r + GY * g + BY * b) >> RGB2YUV_SHIFT) + 16;
-
- ydst[2*i] = Y;
-
- 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;
- }
- udst += chromStride;
- vdst += chromStride;
- ydst += lumStride;
- src += srcStride;
- }
+ y=0;
+#endif
+ for(; y<height; y+=2)
+ {
+ long 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];
+
+ 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;
+
+ 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;
+ }
+ 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];
+
+ unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
+
+ ydst[2*i] = Y;
+
+ 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;
+ }
+ udst += chromStride;
+ vdst += chromStride;
+ ydst += lumStride;
+ src += srcStride;
+ }
}
void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
- long width0, long height, stride_t src1Stride,
- stride_t src2Stride, stride_t dstStride)
-{
- long h;
- const stride_t width = width0;
+ long width0, long height, stride_t src1Stride,
+ stride_t src2Stride, stride_t dstStride){
+ long h;
+ const stride_t width = width0;
- for(h = 0; h < height; h++)
- {
- long w;
+ for(h=0; h < height; h++)
+ {
+ long w;
#if HAVE_MMX
#if HAVE_SSE2
__asm__(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "1: \n\t"
- PREFETCH" 64(%1, %%"REG_a") \n\t"
- PREFETCH" 64(%2, %%"REG_a") \n\t"
- "movdqa (%1, %%"REG_a"), %%xmm0 \n\t"
- "movdqa (%1, %%"REG_a"), %%xmm1 \n\t"
- "movdqa (%2, %%"REG_a"), %%xmm2 \n\t"
- "punpcklbw %%xmm2, %%xmm0 \n\t"
- "punpckhbw %%xmm2, %%xmm1 \n\t"
- "movntdq %%xmm0, (%0, %%"REG_a", 2) \n\t"
- "movntdq %%xmm1, 16(%0, %%"REG_a", 2) \n\t"
- "add $16, %%"REG_a" \n\t"
- "cmp %3, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dest), "r"(src1), "r"(src2), "r"((x86_reg)width-15)
- : "memory", "%"REG_a""
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ "1: \n\t"
+ PREFETCH" 64(%1, %%"REG_a") \n\t"
+ PREFETCH" 64(%2, %%"REG_a") \n\t"
+ "movdqa (%1, %%"REG_a"), %%xmm0 \n\t"
+ "movdqa (%1, %%"REG_a"), %%xmm1 \n\t"
+ "movdqa (%2, %%"REG_a"), %%xmm2 \n\t"
+ "punpcklbw %%xmm2, %%xmm0 \n\t"
+ "punpckhbw %%xmm2, %%xmm1 \n\t"
+ "movntdq %%xmm0, (%0, %%"REG_a", 2) \n\t"
+ "movntdq %%xmm1, 16(%0, %%"REG_a", 2) \n\t"
+ "add $16, %%"REG_a" \n\t"
+ "cmp %3, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
+ : "memory", "%"REG_a""
);
#else
__asm__(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "1: \n\t"
- PREFETCH" 64(%1, %%"REG_a") \n\t"
- PREFETCH" 64(%2, %%"REG_a") \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a"), %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq (%2, %%"REG_a"), %%mm4 \n\t"
- "movq 8(%2, %%"REG_a"), %%mm5 \n\t"
- "punpcklbw %%mm4, %%mm0 \n\t"
- "punpckhbw %%mm4, %%mm1 \n\t"
- "punpcklbw %%mm5, %%mm2 \n\t"
- "punpckhbw %%mm5, %%mm3 \n\t"
- MOVNTQ" %%mm0, (%0, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm1, 8(%0, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm2, 16(%0, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm3, 24(%0, %%"REG_a", 2) \n\t"
- "add $16, %%"REG_a" \n\t"
- "cmp %3, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dest), "r"(src1), "r"(src2), "r"((x86_reg)width-15)
- : "memory", "%"REG_a
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ "1: \n\t"
+ PREFETCH" 64(%1, %%"REG_a") \n\t"
+ PREFETCH" 64(%2, %%"REG_a") \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ "movq 8(%1, %%"REG_a"), %%mm2 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "movq (%2, %%"REG_a"), %%mm4 \n\t"
+ "movq 8(%2, %%"REG_a"), %%mm5 \n\t"
+ "punpcklbw %%mm4, %%mm0 \n\t"
+ "punpckhbw %%mm4, %%mm1 \n\t"
+ "punpcklbw %%mm5, %%mm2 \n\t"
+ "punpckhbw %%mm5, %%mm3 \n\t"
+ MOVNTQ" %%mm0, (%0, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm1, 8(%0, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm2, 16(%0, %%"REG_a", 2) \n\t"
+ MOVNTQ" %%mm3, 24(%0, %%"REG_a", 2) \n\t"
+ "add $16, %%"REG_a" \n\t"
+ "cmp %3, %%"REG_a" \n\t"
+ " jb 1b \n\t"
+ ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
+ : "memory", "%"REG_a
);
#endif
- for(w = (width & (~15)); w < width; w++)
+ for (w= (width&(~15)); w < width; w++)
{
dest[2*w+0] = src1[w];
dest[2*w+1] = src2[w];
}
#else
- for(w = 0; w < width; w++)
+ for (w=0; w < width; w++)
{
dest[2*w+0] = src1[w];
dest[2*w+1] = src2[w];
}
#endif
dest += dstStride;
- src1 += src1Stride;
- src2 += src2Stride;
+ src1 += src1Stride;
+ src2 += src2Stride;
}
#if HAVE_MMX
__asm__(
EMMS" \n\t"
SFENCE" \n\t"
::: "memory"
- );
+ );
#endif
}
static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dst1, uint8_t *dst2,
- long width, long height,
- stride_t srcStride1, stride_t srcStride2,
- stride_t dstStride1, stride_t dstStride2)
+ uint8_t *dst1, uint8_t *dst2,
+ long width, long height,
+ stride_t srcStride1, stride_t srcStride2,
+ stride_t dstStride1, stride_t dstStride2)
{
x86_reg y;
- long x, w, h;
- w = width / 2;
- h = height / 2;
+ long x,w,h;
+ w=width/2; h=height/2;
#if HAVE_MMX
__asm__ volatile(
- PREFETCH" %0 \n\t"
- PREFETCH" %1 \n\t"
- ::"m"(*(src1+srcStride1)), "m"(*(src2+srcStride2)):"memory");
-#endif
- for(y = 0; y < h; y++)
- {
- const uint8_t* s1 = src1 + srcStride1 * (y >> 1);
- uint8_t* d = dst1 + dstStride1 * y;
- x = 0;
+ PREFETCH" %0 \n\t"
+ PREFETCH" %1 \n\t"
+ ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory");
+#endif
+ for (y=0;y<h;y++){
+ const uint8_t* s1=src1+srcStride1*(y>>1);
+ uint8_t* d=dst1+dstStride1*y;
+ x=0;
#if HAVE_MMX
- 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"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "movq %%mm6, %%mm7 \n\t"
- "punpcklbw %%mm0, %%mm0 \n\t"
- "punpckhbw %%mm1, %%mm1 \n\t"
- "punpcklbw %%mm2, %%mm2 \n\t"
- "punpckhbw %%mm3, %%mm3 \n\t"
- "punpcklbw %%mm4, %%mm4 \n\t"
- "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])
- :"memory");
- }
+ 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"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "movq %%mm4, %%mm5 \n\t"
+ "movq %%mm6, %%mm7 \n\t"
+ "punpcklbw %%mm0, %%mm0 \n\t"
+ "punpckhbw %%mm1, %%mm1 \n\t"
+ "punpcklbw %%mm2, %%mm2 \n\t"
+ "punpckhbw %%mm3, %%mm3 \n\t"
+ "punpcklbw %%mm4, %%mm4 \n\t"
+ "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])
+ :"memory");
+ }
#endif
- for(; x < w; x++) d[2*x] = d[2*x+1] = s1[x];
+ for (;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 (y=0;y<h;y++){
+ const uint8_t* s2=src2+srcStride2*(y>>1);
+ uint8_t* d=dst2+dstStride2*y;
+ x=0;
#if HAVE_MMX
- 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"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "movq %%mm6, %%mm7 \n\t"
- "punpcklbw %%mm0, %%mm0 \n\t"
- "punpckhbw %%mm1, %%mm1 \n\t"
- "punpcklbw %%mm2, %%mm2 \n\t"
- "punpckhbw %%mm3, %%mm3 \n\t"
- "punpcklbw %%mm4, %%mm4 \n\t"
- "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])
- :"memory");
- }
+ 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"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "movq %%mm4, %%mm5 \n\t"
+ "movq %%mm6, %%mm7 \n\t"
+ "punpcklbw %%mm0, %%mm0 \n\t"
+ "punpckhbw %%mm1, %%mm1 \n\t"
+ "punpcklbw %%mm2, %%mm2 \n\t"
+ "punpckhbw %%mm3, %%mm3 \n\t"
+ "punpcklbw %%mm4, %%mm4 \n\t"
+ "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])
+ :"memory");
+ }
#endif
- for(; x < w; x++) d[2*x] = d[2*x+1] = s2[x];
+ for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
}
#if HAVE_MMX
__asm__(
EMMS" \n\t"
SFENCE" \n\t"
::: "memory"
- );
+ );
#endif
}
static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
- long width, long height,
- stride_t srcStride1, stride_t srcStride2,
- stride_t srcStride3, stride_t dstStride)
+ uint8_t *dst,
+ long width, long height,
+ stride_t srcStride1, stride_t srcStride2,
+ stride_t srcStride3, stride_t dstStride)
{
x86_reg x;
- long 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;
+ long 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;
#if HAVE_MMX
- for(; x < w - 7; x += 8)
- {
- __asm__ volatile(
- PREFETCH" 32(%1, %0) \n\t"
- PREFETCH" 32(%2, %0) \n\t"
- PREFETCH" 32(%3, %0) \n\t"
- "movq (%1, %0, 4), %%mm0 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
- "movq (%2, %0), %%mm1 \n\t" /* U0U1U2U3U4U5U6U7 */
- "movq (%3, %0), %%mm2 \n\t" /* V0V1V2V3V4V5V6V7 */
- "movq %%mm0, %%mm3 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
- "movq %%mm1, %%mm4 \n\t" /* U0U1U2U3U4U5U6U7 */
- "movq %%mm2, %%mm5 \n\t" /* V0V1V2V3V4V5V6V7 */
- "punpcklbw %%mm1, %%mm1 \n\t" /* U0U0 U1U1 U2U2 U3U3 */
- "punpcklbw %%mm2, %%mm2 \n\t" /* V0V0 V1V1 V2V2 V3V3 */
- "punpckhbw %%mm4, %%mm4 \n\t" /* U4U4 U5U5 U6U6 U7U7 */
- "punpckhbw %%mm5, %%mm5 \n\t" /* V4V4 V5V5 V6V6 V7V7 */
-
- "movq %%mm1, %%mm6 \n\t"
- "punpcklbw %%mm2, %%mm1 \n\t" /* U0V0 U0V0 U1V1 U1V1*/
- "punpcklbw %%mm1, %%mm0 \n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/
- "punpckhbw %%mm1, %%mm3 \n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/
- MOVNTQ" %%mm0, (%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 8(%4, %0, 8) \n\t"
-
- "punpckhbw %%mm2, %%mm6 \n\t" /* U2V2 U2V2 U3V3 U3V3*/
- "movq 8(%1, %0, 4), %%mm0 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm6, %%mm0 \n\t" /* Y U2 Y V2 Y U2 Y V2*/
- "punpckhbw %%mm6, %%mm3 \n\t" /* Y U3 Y V3 Y U3 Y V3*/
- MOVNTQ" %%mm0, 16(%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 24(%4, %0, 8) \n\t"
-
- "movq %%mm4, %%mm6 \n\t"
- "movq 16(%1, %0, 4), %%mm0 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm5, %%mm4 \n\t"
- "punpcklbw %%mm4, %%mm0 \n\t" /* Y U4 Y V4 Y U4 Y V4*/
- "punpckhbw %%mm4, %%mm3 \n\t" /* Y U5 Y V5 Y U5 Y V5*/
- MOVNTQ" %%mm0, 32(%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 40(%4, %0, 8) \n\t"
-
- "punpckhbw %%mm5, %%mm6 \n\t"
- "movq 24(%1, %0, 4), %%mm0 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm6, %%mm0 \n\t" /* Y U6 Y V6 Y U6 Y V6*/
- "punpckhbw %%mm6, %%mm3 \n\t" /* Y U7 Y V7 Y U7 Y V7*/
- MOVNTQ" %%mm0, 48(%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 56(%4, %0, 8) \n\t"
-
- : "+r"(x)
- : "r"(yp), "r"(up), "r"(vp), "r"(d)
- :"memory");
- }
+ for (;x<w-7;x+=8)
+ {
+ __asm__ volatile(
+ PREFETCH" 32(%1, %0) \n\t"
+ PREFETCH" 32(%2, %0) \n\t"
+ PREFETCH" 32(%3, %0) \n\t"
+ "movq (%1, %0, 4), %%mm0 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
+ "movq (%2, %0), %%mm1 \n\t" /* U0U1U2U3U4U5U6U7 */
+ "movq (%3, %0), %%mm2 \n\t" /* V0V1V2V3V4V5V6V7 */
+ "movq %%mm0, %%mm3 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
+ "movq %%mm1, %%mm4 \n\t" /* U0U1U2U3U4U5U6U7 */
+ "movq %%mm2, %%mm5 \n\t" /* V0V1V2V3V4V5V6V7 */
+ "punpcklbw %%mm1, %%mm1 \n\t" /* U0U0 U1U1 U2U2 U3U3 */
+ "punpcklbw %%mm2, %%mm2 \n\t" /* V0V0 V1V1 V2V2 V3V3 */
+ "punpckhbw %%mm4, %%mm4 \n\t" /* U4U4 U5U5 U6U6 U7U7 */
+ "punpckhbw %%mm5, %%mm5 \n\t" /* V4V4 V5V5 V6V6 V7V7 */
+
+ "movq %%mm1, %%mm6 \n\t"
+ "punpcklbw %%mm2, %%mm1 \n\t" /* U0V0 U0V0 U1V1 U1V1*/
+ "punpcklbw %%mm1, %%mm0 \n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/
+ "punpckhbw %%mm1, %%mm3 \n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/
+ MOVNTQ" %%mm0, (%4, %0, 8) \n\t"
+ MOVNTQ" %%mm3, 8(%4, %0, 8) \n\t"
+
+ "punpckhbw %%mm2, %%mm6 \n\t" /* U2V2 U2V2 U3V3 U3V3*/
+ "movq 8(%1, %0, 4), %%mm0 \n\t"
+ "movq %%mm0, %%mm3 \n\t"
+ "punpcklbw %%mm6, %%mm0 \n\t" /* Y U2 Y V2 Y U2 Y V2*/
+ "punpckhbw %%mm6, %%mm3 \n\t" /* Y U3 Y V3 Y U3 Y V3*/
+ MOVNTQ" %%mm0, 16(%4, %0, 8) \n\t"
+ MOVNTQ" %%mm3, 24(%4, %0, 8) \n\t"
+
+ "movq %%mm4, %%mm6 \n\t"
+ "movq 16(%1, %0, 4), %%mm0 \n\t"
+ "movq %%mm0, %%mm3 \n\t"
+ "punpcklbw %%mm5, %%mm4 \n\t"
+ "punpcklbw %%mm4, %%mm0 \n\t" /* Y U4 Y V4 Y U4 Y V4*/
+ "punpckhbw %%mm4, %%mm3 \n\t" /* Y U5 Y V5 Y U5 Y V5*/
+ MOVNTQ" %%mm0, 32(%4, %0, 8) \n\t"
+ MOVNTQ" %%mm3, 40(%4, %0, 8) \n\t"
+
+ "punpckhbw %%mm5, %%mm6 \n\t"
+ "movq 24(%1, %0, 4), %%mm0 \n\t"
+ "movq %%mm0, %%mm3 \n\t"
+ "punpcklbw %%mm6, %%mm0 \n\t" /* Y U6 Y V6 Y U6 Y V6*/
+ "punpckhbw %%mm6, %%mm3 \n\t" /* Y U7 Y V7 Y U7 Y V7*/
+ MOVNTQ" %%mm0, 48(%4, %0, 8) \n\t"
+ MOVNTQ" %%mm3, 56(%4, %0, 8) \n\t"
+
+ : "+r" (x)
+ : "r"(yp), "r" (up), "r"(vp), "r"(d)
+ :"memory");
+ }
#endif
- for(; x < w; x++)
- {
- const long 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];
- }
+ for (; x<w; x++)
+ {
+ const long 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];
+ }
}
#if HAVE_MMX
__asm__(
EMMS" \n\t"
SFENCE" \n\t"
::: "memory"
- );
+ );
#endif
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.c
index 4e06b6e17..e2c3d5bf0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.c
@@ -151,42 +151,38 @@ write special BGR->BGR scaler
*/
#if ARCH_X86 && CONFIG_GPL
-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, dither4[2]) =
-{
- 0x0103010301030103LL,
- 0x0200020002000200LL,
-};
-
-const DECLARE_ALIGNED(8, uint64_t, dither8[2]) =
-{
- 0x0602060206020602LL,
- 0x0004000400040004LL,
-};
+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, dither4[2]) = {
+ 0x0103010301030103LL,
+ 0x0200020002000200LL,};
+
+const DECLARE_ALIGNED(8, uint64_t, dither8[2]) = {
+ 0x0602060206020602LL,
+ 0x0004000400040004LL,};
static volatile uint64_t attribute_used __attribute__((aligned(8))) b5Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) g5Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) g6Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) r5Dither;
-static uint64_t __attribute__((aligned(8))) b16Mask = 0x001F001F001F001FLL;
-static uint64_t attribute_used __attribute__((aligned(8))) g16Mask = 0x07E007E007E007E0LL;
-static uint64_t attribute_used __attribute__((aligned(8))) r16Mask = 0xF800F800F800F800LL;
-static uint64_t __attribute__((aligned(8))) b15Mask = 0x001F001F001F001FLL;
-static uint64_t attribute_used __attribute__((aligned(8))) g15Mask = 0x03E003E003E003E0LL;
-static uint64_t attribute_used __attribute__((aligned(8))) r15Mask = 0x7C007C007C007C00LL;
+static uint64_t __attribute__((aligned(8))) b16Mask= 0x001F001F001F001FLL;
+static uint64_t attribute_used __attribute__((aligned(8))) g16Mask= 0x07E007E007E007E0LL;
+static uint64_t attribute_used __attribute__((aligned(8))) r16Mask= 0xF800F800F800F800LL;
+static uint64_t __attribute__((aligned(8))) b15Mask= 0x001F001F001F001FLL;
+static uint64_t attribute_used __attribute__((aligned(8))) g15Mask= 0x03E003E003E003E0LL;
+static uint64_t attribute_used __attribute__((aligned(8))) r15Mask= 0x7C007C007C007C00LL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24A = 0x00FF0000FF0000FFLL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24B = 0xFF0000FF0000FF00LL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24C = 0x0000FF0000FF0000LL;
+static uint64_t attribute_used __attribute__((aligned(8))) M24A= 0x00FF0000FF0000FFLL;
+static uint64_t attribute_used __attribute__((aligned(8))) M24B= 0xFF0000FF0000FF00LL;
+static uint64_t attribute_used __attribute__((aligned(8))) M24C= 0x0000FF0000FF0000LL;
#ifdef FAST_BGR2YV12
static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000000210041000DULL;
@@ -198,7 +194,7 @@ static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0
static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL;
#endif /* FAST_BGR2YV12 */
static const uint64_t bgr2YOffset attribute_used __attribute__((aligned(8))) = 0x1010101010101010ULL;
-static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8))) = 0x8080808080808080ULL;
+static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8)))= 0x8080808080808080ULL;
static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0x0001000100010001ULL;
#endif /* ARCH_X86 && CONFIG_GPL */
@@ -207,120 +203,110 @@ static unsigned char clip_table[768];
static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b);
-static const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8] =
-{
- { 1, 3, 1, 3, 1, 3, 1, 3, },
- { 2, 0, 2, 0, 2, 0, 2, 0, },
+static const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={
+{ 1, 3, 1, 3, 1, 3, 1, 3, },
+{ 2, 0, 2, 0, 2, 0, 2, 0, },
};
-static const uint8_t __attribute__((aligned(8))) dither_2x2_8[2][8] =
-{
- { 6, 2, 6, 2, 6, 2, 6, 2, },
- { 0, 4, 0, 4, 0, 4, 0, 4, },
+static const uint8_t __attribute__((aligned(8))) dither_2x2_8[2][8]={
+{ 6, 2, 6, 2, 6, 2, 6, 2, },
+{ 0, 4, 0, 4, 0, 4, 0, 4, },
};
-const uint8_t __attribute__((aligned(8))) 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, },
+const uint8_t __attribute__((aligned(8))) 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, },
};
#if 0
-const uint8_t __attribute__((aligned(8))) dither_8x8_64[8][8] =
-{
- { 0, 48, 12, 60, 3, 51, 15, 63, },
- { 32, 16, 44, 28, 35, 19, 47, 31, },
- { 8, 56, 4, 52, 11, 59, 7, 55, },
- { 40, 24, 36, 20, 43, 27, 39, 23, },
- { 2, 50, 14, 62, 1, 49, 13, 61, },
- { 34, 18, 46, 30, 33, 17, 45, 29, },
- { 10, 58, 6, 54, 9, 57, 5, 53, },
- { 42, 26, 38, 22, 41, 25, 37, 21, },
+const uint8_t __attribute__((aligned(8))) dither_8x8_64[8][8]={
+{ 0, 48, 12, 60, 3, 51, 15, 63, },
+{ 32, 16, 44, 28, 35, 19, 47, 31, },
+{ 8, 56, 4, 52, 11, 59, 7, 55, },
+{ 40, 24, 36, 20, 43, 27, 39, 23, },
+{ 2, 50, 14, 62, 1, 49, 13, 61, },
+{ 34, 18, 46, 30, 33, 17, 45, 29, },
+{ 10, 58, 6, 54, 9, 57, 5, 53, },
+{ 42, 26, 38, 22, 41, 25, 37, 21, },
};
#endif
-const uint8_t __attribute__((aligned(8))) 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, },
+const uint8_t __attribute__((aligned(8))) 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 0
-const uint8_t __attribute__((aligned(8))) dither_8x8_128[8][8] =
-{
- { 68, 36, 92, 60, 66, 34, 90, 58, },
- { 20, 116, 12, 108, 18, 114, 10, 106, },
- { 84, 52, 76, 44, 82, 50, 74, 42, },
- { 0, 96, 24, 120, 6, 102, 30, 126, },
- { 64, 32, 88, 56, 70, 38, 94, 62, },
- { 16, 112, 8, 104, 22, 118, 14, 110, },
- { 80, 48, 72, 40, 86, 54, 78, 46, },
- { 4, 100, 28, 124, 2, 98, 26, 122, },
+const uint8_t __attribute__((aligned(8))) dither_8x8_128[8][8]={
+{ 68, 36, 92, 60, 66, 34, 90, 58, },
+{ 20, 116, 12, 108, 18, 114, 10, 106, },
+{ 84, 52, 76, 44, 82, 50, 74, 42, },
+{ 0, 96, 24, 120, 6, 102, 30, 126, },
+{ 64, 32, 88, 56, 70, 38, 94, 62, },
+{ 16, 112, 8, 104, 22, 118, 14, 110, },
+{ 80, 48, 72, 40, 86, 54, 78, 46, },
+{ 4, 100, 28, 124, 2, 98, 26, 122, },
};
#endif
#if 1
-const uint8_t __attribute__((aligned(8))) 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, },
+const uint8_t __attribute__((aligned(8))) 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
-const uint8_t __attribute__((aligned(8))) 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, },
+const uint8_t __attribute__((aligned(8))) 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
-const uint8_t __attribute__((aligned(8))) 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, },
+const uint8_t __attribute__((aligned(8))) 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
-const uint8_t __attribute__((aligned(8))) 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, },
+const uint8_t __attribute__((aligned(8))) 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
@@ -335,7 +321,7 @@ int GetCPUCount(void)
{
return 1;
}
-int isP4HT(void)
+int isP4HT (void)
{
return 0;
}
@@ -343,14 +329,12 @@ int isP4HT(void)
#include "isP4HT.c"
#endif
-int sws_default_execute(SwsContext *c, int (*func)(SwsContext *c2), int *ret, int count)
-{
+int sws_default_execute(SwsContext *c, int (*func)(SwsContext *c2), int *ret, int count){
int i;
- for(i = 0; i < count; i++)
- {
- int r = func(&c[i]);
- if(ret) ret[i] = r;
+ for(i=0; i<count; i++){
+ int r= func(&c[i]);
+ if(ret) ret[i]= r;
}
return 0;
}
@@ -364,9 +348,9 @@ char *sws_format_name(int format)
res = fmt_name + buffer * 32;
buffer = 1 - buffer;
snprintf(res, 32, "0x%x (%c%c%c%c)", format,
- format >> 24, (format >> 16) & 0xFF,
- (format >> 8) & 0xFF,
- format & 0xFF);
+ format >> 24, (format >> 16) & 0xFF,
+ (format >> 8) & 0xFF,
+ format & 0xFF);
return res;
}
@@ -374,95 +358,95 @@ char *sws_format_name(int format)
#if ARCH_X86_32 || ARCH_X86_64
void in_asm_used_var_warning_killer()
{
- volatile int i = bF8 + bFC + w10 +
- bm00001111 + bm00000111 + bm11111000 + b16Mask + g16Mask + r16Mask + b15Mask + g15Mask + r15Mask +
- M24A + M24B + M24C + w02 + b5Dither + g5Dither + r5Dither + g6Dither + dither4[0] + dither8[0] + bm01010101;
- if(i) i = 0;
+ volatile int i= bF8+bFC+w10+
+ bm00001111+bm00000111+bm11111000+b16Mask+g16Mask+r16Mask+b15Mask+g15Mask+r15Mask+
+ M24A+M24B+M24C+w02 + b5Dither+g5Dither+r5Dither+g6Dither+dither4[0]+dither8[0]+bm01010101;
+ if(i) i=0;
}
#endif
static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
- int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
-{
- //FIXME Optimize (just quickly writen not opti..)
- int i;
- for(i = 0; i < dstW; i++)
- {
- int val = 1 << 18;
- int j;
- for(j = 0; j < lumFilterSize; j++)
- val += lumSrc[j][i] * lumFilter[j];
-
- dest[i] = FFMIN(FFMAX(val >> 19, 0), 255);
- }
-
- if(uDest != NULL)
- for(i = 0; i < chrDstW; i++)
- {
- int u = 1 << 18;
- int v = 1 << 18;
- int j;
- for(j = 0; j < chrFilterSize; j++)
- {
- u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + 2048] * chrFilter[j];
- }
+ int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
+ uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
+{
+ //FIXME Optimize (just quickly writen not opti..)
+ int i;
+ for(i=0; i<dstW; i++)
+ {
+ int val=1<<18;
+ int j;
+ for(j=0; j<lumFilterSize; j++)
+ val += lumSrc[j][i] * lumFilter[j];
+
+ dest[i]= FFMIN(FFMAX(val>>19, 0), 255);
+ }
+
+ if(uDest != NULL)
+ for(i=0; i<chrDstW; i++)
+ {
+ int u=1<<18;
+ int v=1<<18;
+ int j;
+ for(j=0; j<chrFilterSize; j++)
+ {
+ u += chrSrc[j][i] * chrFilter[j];
+ v += chrSrc[j][i + 2048] * chrFilter[j];
+ }
- uDest[i] = FFMIN(FFMAX(u >> 19, 0), 255);
- vDest[i] = FFMIN(FFMAX(v >> 19, 0), 255);
- }
+ uDest[i]= FFMIN(FFMAX(u>>19, 0), 255);
+ vDest[i]= FFMIN(FFMAX(v>>19, 0), 255);
+ }
}
static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
- int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
-{
- //FIXME Optimize (just quickly writen not opti..)
- int i;
- for(i = 0; i < dstW; i++)
- {
- int val = 1 << 18;
- int j;
- for(j = 0; j < lumFilterSize; j++)
- val += lumSrc[j][i] * lumFilter[j];
-
- dest[i] = FFMIN(FFMAX(val >> 19, 0), 255);
- }
-
- if(uDest == NULL)
- return;
-
- if(dstFormat == IMGFMT_NV12)
- for(i = 0; i < chrDstW; i++)
- {
- int u = 1 << 18;
- int v = 1 << 18;
- int j;
- for(j = 0; j < chrFilterSize; j++)
- {
- u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + 2048] * chrFilter[j];
- }
+ int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
+ uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
+{
+ //FIXME Optimize (just quickly writen not opti..)
+ int i;
+ for(i=0; i<dstW; i++)
+ {
+ int val=1<<18;
+ int j;
+ for(j=0; j<lumFilterSize; j++)
+ val += lumSrc[j][i] * lumFilter[j];
+
+ dest[i]= FFMIN(FFMAX(val>>19, 0), 255);
+ }
+
+ if(uDest == NULL)
+ return;
+
+ if(dstFormat == IMGFMT_NV12)
+ for(i=0; i<chrDstW; i++)
+ {
+ int u=1<<18;
+ int v=1<<18;
+ int j;
+ for(j=0; j<chrFilterSize; j++)
+ {
+ u += chrSrc[j][i] * chrFilter[j];
+ v += chrSrc[j][i + 2048] * chrFilter[j];
+ }
- uDest[2*i] = FFMIN(FFMAX(u >> 19, 0), 255);
- uDest[2*i+1] = FFMIN(FFMAX(v >> 19, 0), 255);
- }
- else
- for(i = 0; i < chrDstW; i++)
- {
- int u = 1 << 18;
- int v = 1 << 18;
- int j;
- for(j = 0; j < chrFilterSize; j++)
- {
- u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + 2048] * chrFilter[j];
- }
+ uDest[2*i]= FFMIN(FFMAX(u>>19, 0), 255);
+ uDest[2*i+1]= FFMIN(FFMAX(v>>19, 0), 255);
+ }
+ else
+ for(i=0; i<chrDstW; i++)
+ {
+ int u=1<<18;
+ int v=1<<18;
+ int j;
+ for(j=0; j<chrFilterSize; j++)
+ {
+ u += chrSrc[j][i] * chrFilter[j];
+ v += chrSrc[j][i + 2048] * chrFilter[j];
+ }
- uDest[2*i] = FFMIN(FFMAX(v >> 19, 0), 255);
- uDest[2*i+1] = FFMIN(FFMAX(u >> 19, 0), 255);
- }
+ uDest[2*i]= FFMIN(FFMAX(v>>19, 0), 255);
+ uDest[2*i+1]= FFMIN(FFMAX(u>>19, 0), 255);
+ }
}
#define YSCALE_YUV_2_PACKEDX_C(type) \
@@ -506,7 +490,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
r = c->table_rV[V];\
g = c->table_gU[U] + c->table_gV[V];\
b = c->table_bU[U];\
-
+
#define YSCALE_YUV_2_PACKED2_C \
for(i=0; i<(dstW>>1); i++){\
const int i2= 2*i;\
@@ -514,14 +498,14 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19;\
int U= (uvbuf0[i ]*uvalpha1+uvbuf1[i ]*uvalpha)>>19;\
int V= (uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19;\
-
+
#define YSCALE_YUV_2_RGB2_C(type) \
YSCALE_YUV_2_PACKED2_C\
type *r, *b, *g;\
r = c->table_rV[V];\
g = c->table_gU[U] + c->table_gV[V];\
b = c->table_bU[U];\
-
+
#define YSCALE_YUV_2_PACKED1_C \
for(i=0; i<(dstW>>1); i++){\
const int i2= 2*i;\
@@ -529,14 +513,14 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
int Y2= buf0[i2+1]>>7;\
int U= (uvbuf1[i ])>>7;\
int V= (uvbuf1[i+2048])>>7;\
-
+
#define YSCALE_YUV_2_RGB1_C(type) \
YSCALE_YUV_2_PACKED1_C\
type *r, *b, *g;\
r = c->table_rV[V];\
g = c->table_gU[U] + c->table_gV[V];\
b = c->table_bU[U];\
-
+
#define YSCALE_YUV_2_PACKED1B_C \
for(i=0; i<(dstW>>1); i++){\
const int i2= 2*i;\
@@ -544,14 +528,14 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
int Y2= buf0[i2+1]>>7;\
int U= (uvbuf0[i ] + uvbuf1[i ])>>8;\
int V= (uvbuf0[i+2048] + uvbuf1[i+2048])>>8;\
-
+
#define YSCALE_YUV_2_RGB1B_C(type) \
YSCALE_YUV_2_PACKED1B_C\
type *r, *b, *g;\
r = c->table_rV[V];\
g = c->table_gU[U] + c->table_gV[V];\
b = c->table_bU[U];\
-
+
#define YSCALE_YUV_2_ANYRGB_C(func, func2)\
switch(c->dstFormat)\
{\
@@ -745,177 +729,175 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
} \
break;\
}\
-
-static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
- int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, int dstW, int y)
-{
- int i;
- switch(c->dstFormat)
- {
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- YSCALE_YUV_2_RGBX_C(uint32_t)
- ((uint32_t*)dest)[i2+0] = r[Y1] + g[Y1] + b[Y1];
- ((uint32_t*)dest)[i2+1] = r[Y2] + g[Y2] + b[Y2];
- }
- break;
-case IMGFMT_RGB24:
- YSCALE_YUV_2_RGBX_C(uint8_t)
- ((uint8_t*)dest)[0] = r[Y1];
- ((uint8_t*)dest)[1] = g[Y1];
- ((uint8_t*)dest)[2] = b[Y1];
- ((uint8_t*)dest)[3] = r[Y2];
- ((uint8_t*)dest)[4] = g[Y2];
- ((uint8_t*)dest)[5] = b[Y2];
- dest += 6;
-}
-break;
-case IMGFMT_BGR24:
-YSCALE_YUV_2_RGBX_C(uint8_t)
-((uint8_t*)dest)[0] = b[Y1];
-((uint8_t*)dest)[1] = g[Y1];
-((uint8_t*)dest)[2] = r[Y1];
-((uint8_t*)dest)[3] = b[Y2];
-((uint8_t*)dest)[4] = g[Y2];
-((uint8_t*)dest)[5] = r[Y2];
-dest += 6;
-}
-break;
-case IMGFMT_RGB16:
-case IMGFMT_BGR16:
-{
- const int dr1 = dither_2x2_8[y&1 ][0];
- const int dg1 = dither_2x2_4[y&1 ][0];
- const int db1 = dither_2x2_8[(y&1)^1][0];
- const int dr2 = dither_2x2_8[y&1 ][1];
- const int dg2 = dither_2x2_4[y&1 ][1];
- const int db2 = dither_2x2_8[(y&1)^1][1];
- YSCALE_YUV_2_RGBX_C(uint16_t)
- ((uint16_t*)dest)[i2+0] = r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];
- ((uint16_t*)dest)[i2+1] = r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];
-}
-}
-break;
-case IMGFMT_RGB15:
-case IMGFMT_BGR15:
-{
- const int dr1 = dither_2x2_8[y&1 ][0];
- const int dg1 = dither_2x2_8[y&1 ][1];
- const int db1 = dither_2x2_8[(y&1)^1][0];
- const int dr2 = dither_2x2_8[y&1 ][1];
- const int dg2 = dither_2x2_8[y&1 ][0];
- const int db2 = dither_2x2_8[(y&1)^1][1];
- YSCALE_YUV_2_RGBX_C(uint16_t)
- ((uint16_t*)dest)[i2+0] = r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];
- ((uint16_t*)dest)[i2+1] = r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];
-}
-}
-break;
-case IMGFMT_RGB8:
-case IMGFMT_BGR8:
-{
- const uint8_t * const d64 = dither_8x8_73[y&7];
- const uint8_t * const d32 = dither_8x8_32[y&7];
- YSCALE_YUV_2_RGBX_C(uint8_t)
- ((uint8_t*)dest)[i2+0] = r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]];
- ((uint8_t*)dest)[i2+1] = r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]];
-}
-}
-break;
-case IMGFMT_RGB4:
-case IMGFMT_BGR4:
-{
- const uint8_t * const d64 = dither_8x8_73 [y&7];
- const uint8_t * const d128 = dither_8x8_220[y&7];
- YSCALE_YUV_2_RGBX_C(uint8_t)
- ((uint8_t*)dest)[i] = r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]]
- + ((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]]) << 4);
-}
-}
-break;
-case IMGFMT_RG4B:
-case IMGFMT_BG4B:
-{
- const uint8_t * const d64 = dither_8x8_73 [y&7];
- const uint8_t * const d128 = dither_8x8_220[y&7];
- YSCALE_YUV_2_RGBX_C(uint8_t)
- ((uint8_t*)dest)[i2+0] = r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]];
- ((uint8_t*)dest)[i2+1] = r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]];
-}
-}
-break;
-case IMGFMT_RGB1:
-case IMGFMT_BGR1:
-{
- const uint8_t * const d128 = dither_8x8_220[y&7];
- uint8_t *g = c->table_gU[128] + c->table_gV[128];
- int 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) & 256)
- {
- if(Y1 > 255) Y1 = 255;
- else if(Y1 < 0)Y1 = 0;
- if(Y2 > 255) Y2 = 255;
- else if(Y2 < 0)Y2 = 0;
- }
- acc += acc + g[Y1+d128[(i+0)&7]];
- acc += acc + g[Y2+d128[(i+1)&7]];
- if((i & 7) == 6)
- {
- ((uint8_t*)dest)[0] = acc;
- dest++;
- }
- }
+static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
+ int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
+ uint8_t *dest, int dstW, int y)
+{
+ int i;
+ switch(c->dstFormat)
+ {
+ case IMGFMT_RGB32:
+ case IMGFMT_BGR32:
+ YSCALE_YUV_2_RGBX_C(uint32_t)
+ ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];
+ ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];
+ }
+ break;
+ case IMGFMT_RGB24:
+ YSCALE_YUV_2_RGBX_C(uint8_t)
+ ((uint8_t*)dest)[0]= r[Y1];
+ ((uint8_t*)dest)[1]= g[Y1];
+ ((uint8_t*)dest)[2]= b[Y1];
+ ((uint8_t*)dest)[3]= r[Y2];
+ ((uint8_t*)dest)[4]= g[Y2];
+ ((uint8_t*)dest)[5]= b[Y2];
+ dest+=6;
+ }
+ break;
+ case IMGFMT_BGR24:
+ YSCALE_YUV_2_RGBX_C(uint8_t)
+ ((uint8_t*)dest)[0]= b[Y1];
+ ((uint8_t*)dest)[1]= g[Y1];
+ ((uint8_t*)dest)[2]= r[Y1];
+ ((uint8_t*)dest)[3]= b[Y2];
+ ((uint8_t*)dest)[4]= g[Y2];
+ ((uint8_t*)dest)[5]= r[Y2];
+ dest+=6;
+ }
+ break;
+ case IMGFMT_RGB16:
+ case IMGFMT_BGR16:
+ {
+ const int dr1= dither_2x2_8[y&1 ][0];
+ const int dg1= dither_2x2_4[y&1 ][0];
+ const int db1= dither_2x2_8[(y&1)^1][0];
+ const int dr2= dither_2x2_8[y&1 ][1];
+ const int dg2= dither_2x2_4[y&1 ][1];
+ const int db2= dither_2x2_8[(y&1)^1][1];
+ YSCALE_YUV_2_RGBX_C(uint16_t)
+ ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];
+ ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];
+ }
+ }
+ break;
+ case IMGFMT_RGB15:
+ case IMGFMT_BGR15:
+ {
+ const int dr1= dither_2x2_8[y&1 ][0];
+ const int dg1= dither_2x2_8[y&1 ][1];
+ const int db1= dither_2x2_8[(y&1)^1][0];
+ const int dr2= dither_2x2_8[y&1 ][1];
+ const int dg2= dither_2x2_8[y&1 ][0];
+ const int db2= dither_2x2_8[(y&1)^1][1];
+ YSCALE_YUV_2_RGBX_C(uint16_t)
+ ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];
+ ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];
+ }
+ }
+ break;
+ case IMGFMT_RGB8:
+ case IMGFMT_BGR8:
+ {
+ const uint8_t * const d64= dither_8x8_73[y&7];
+ const uint8_t * const d32= dither_8x8_32[y&7];
+ YSCALE_YUV_2_RGBX_C(uint8_t)
+ ((uint8_t*)dest)[i2+0]= r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]];
+ ((uint8_t*)dest)[i2+1]= r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]];
+ }
+ }
+ break;
+ case IMGFMT_RGB4:
+ case IMGFMT_BGR4:
+ {
+ const uint8_t * const d64= dither_8x8_73 [y&7];
+ const uint8_t * const d128=dither_8x8_220[y&7];
+ YSCALE_YUV_2_RGBX_C(uint8_t)
+ ((uint8_t*)dest)[i]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]]
+ +((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]])<<4);
+ }
+ }
+ break;
+ case IMGFMT_RG4B:
+ case IMGFMT_BG4B:
+ {
+ const uint8_t * const d64= dither_8x8_73 [y&7];
+ const uint8_t * const d128=dither_8x8_220[y&7];
+ YSCALE_YUV_2_RGBX_C(uint8_t)
+ ((uint8_t*)dest)[i2+0]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]];
+ ((uint8_t*)dest)[i2+1]= r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]];
+ }
+ }
+ break;
+ case IMGFMT_RGB1:
+ case IMGFMT_BGR1:
+ {
+ const uint8_t * const d128=dither_8x8_220[y&7];
+ uint8_t *g= c->table_gU[128] + c->table_gV[128];
+ int 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)&256)
+ {
+ if(Y1>255) Y1=255;
+ else if(Y1<0)Y1=0;
+ if(Y2>255) Y2=255;
+ else if(Y2<0)Y2=0;
+ }
+ acc+= acc + g[Y1+d128[(i+0)&7]];
+ acc+= acc + g[Y2+d128[(i+1)&7]];
+ if((i&7)==6){
+ ((uint8_t*)dest)[0]= acc;
+ dest++;
+ }
+ }
+ }
+ break;
+ case IMGFMT_YUY2:
+ YSCALE_YUV_2_PACKEDX_C(void)
+ ((uint8_t*)dest)[2*i2+0]= Y1;
+ ((uint8_t*)dest)[2*i2+1]= U;
+ ((uint8_t*)dest)[2*i2+2]= Y2;
+ ((uint8_t*)dest)[2*i2+3]= V;
+ }
+ break;
+ case IMGFMT_UYVY:
+ YSCALE_YUV_2_PACKEDX_C(void)
+ ((uint8_t*)dest)[2*i2+0]= U;
+ ((uint8_t*)dest)[2*i2+1]= Y1;
+ ((uint8_t*)dest)[2*i2+2]= V;
+ ((uint8_t*)dest)[2*i2+3]= Y2;
+ }
+ break;
+ case IMGFMT_VYUY:
+ YSCALE_YUV_2_PACKEDX_C(void)
+ ((uint8_t*)dest)[2*i2+0]= V;
+ ((uint8_t*)dest)[2*i2+1]= Y1;
+ ((uint8_t*)dest)[2*i2+2]= U;
+ ((uint8_t*)dest)[2*i2+3]= Y2;
+ }
+ break;
+ case IMGFMT_YVYU:
+ YSCALE_YUV_2_PACKEDX_C(void)
+ ((uint8_t*)dest)[2*i2+0]= Y1;
+ ((uint8_t*)dest)[2*i2+1]= V;
+ ((uint8_t*)dest)[2*i2+2]= Y2;
+ ((uint8_t*)dest)[2*i2+3]= U;
+ }
+ break;
+ }
}
-break;
-case IMGFMT_YUY2:
-YSCALE_YUV_2_PACKEDX_C(void)
-((uint8_t*)dest)[2*i2+0] = Y1;
- ((uint8_t*)dest)[2*i2+1] = U;
- ((uint8_t*)dest)[2*i2+2] = Y2;
- ((uint8_t*)dest)[2*i2+3] = V;
- }
- break;
- case IMGFMT_UYVY:
- YSCALE_YUV_2_PACKEDX_C(void)
- ((uint8_t*)dest)[2*i2+0] = U;
- ((uint8_t*)dest)[2*i2+1] = Y1;
- ((uint8_t*)dest)[2*i2+2] = V;
- ((uint8_t*)dest)[2*i2+3] = Y2;
- }
- break;
- case IMGFMT_VYUY:
- YSCALE_YUV_2_PACKEDX_C(void)
- ((uint8_t*)dest)[2*i2+0] = V;
- ((uint8_t*)dest)[2*i2+1] = Y1;
- ((uint8_t*)dest)[2*i2+2] = U;
- ((uint8_t*)dest)[2*i2+3] = Y2;
- }
- break;
- case IMGFMT_YVYU:
- YSCALE_YUV_2_PACKEDX_C(void)
- ((uint8_t*)dest)[2*i2+0] = Y1;
- ((uint8_t*)dest)[2*i2+1] = V;
- ((uint8_t*)dest)[2*i2+2] = Y2;
- ((uint8_t*)dest)[2*i2+3] = U;
- }
- break;
- }
- }
//Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
@@ -970,15 +952,15 @@ YSCALE_YUV_2_PACKEDX_C(void)
#if ARCH_X86_32 || ARCH_X86_64
//X86 versions
- /*
- #undef RENAME
- #undef HAVE_MMX
- #undef HAVE_MMX2
- #undef HAVE_AMD3DNOW
- #define ARCH_X86 1
- #define RENAME(a) a ## _X86
- #include "swscale_template.c"
- */
+/*
+#undef RENAME
+#undef HAVE_MMX
+#undef HAVE_MMX2
+#undef HAVE_AMD3DNOW
+#define ARCH_X86 1
+#define RENAME(a) a ## _X86
+#include "swscale_template.c"
+*/
//MMX versions
#ifdef COMPILE_MMX
#undef RENAME
@@ -1013,704 +995,685 @@ YSCALE_YUV_2_PACKEDX_C(void)
// minor note: the HAVE_xyz are messed up after this line so don't use them
- 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)
{
// printf("%f %f %f %f %f\n", a,b,c,d,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 inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc,
- int srcW, int dstW, int filterAlign, int one, SwsMethodParams *params,
- int subsampling, int cpuflags, int debugflags,
- SwsVector *srcFilter, SwsVector *dstFilter)
-{
- int i;
- int filterSize;
- int filter2Size;
- int minFilterSize;
- double *filter = NULL;
- double *filter2 = NULL;
+ int srcW, int dstW, int filterAlign, int one, SwsMethodParams *params,
+ int subsampling,int cpuflags, int debugflags,
+ SwsVector *srcFilter, SwsVector *dstFilter)
+{
+ int i;
+ int filterSize;
+ int filter2Size;
+ int minFilterSize;
+ double *filter=NULL;
+ double *filter2=NULL;
#if ARCH_X86_32 || ARCH_X86_64
- if(cpuflags & SWS_CPU_CAPS_MMX)
- asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions)
+ if(cpuflags & SWS_CPU_CAPS_MMX)
+ asm volatile("emms\n\t"::: "memory"); //FIXME this shouldnt be required but it IS (even for non mmx versions)
#endif
- // Note the +1 is for the MMXscaler which reads over the end
- *filterPos = av_malloc((dstW + 1) * sizeof(int16_t));
-
- if(FFABS(xInc - 0x10000) < 10) // unscaled
- {
- int i;
- filterSize = 1;
- filter = av_malloc(dstW * sizeof(double) * filterSize);
- for(i = 0; i < dstW * filterSize; i++) filter[i] = 0;
-
- for(i = 0; i < dstW; i++)
- {
- filter[i*filterSize] = 1;
- (*filterPos)[i] = i;
- }
-
- }
- else if(params->method & SWS_POINT) // lame looking point sampling mode
- {
- int i;
- int xDstInSrc;
- filterSize = 1;
- filter = av_malloc(dstW * sizeof(double) * filterSize);
-
- xDstInSrc = xInc / 2 - 0x8000;
- for(i = 0; i < dstW; i++)
- {
- int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15))>>16;
-
- (*filterPos)[i] = xx;
- filter[i] = 1.0;
- xDstInSrc += xInc;
- }
- }
- else if((xInc <= (1 << 16) && (params->method & SWS_AREA)) || (params->method & SWS_FAST_BILINEAR)) // bilinear upscale
- {
- int i;
- int xDstInSrc;
- if(params->method & SWS_BICUBIC) filterSize = 4;
- else if(params->method & SWS_X) filterSize = 4;
- else filterSize = 2; // SWS_BILINEAR / SWS_AREA
- filter = av_malloc(dstW * sizeof(double) * filterSize);
-
- 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++)
- {
- double d = FFABS((xx << 16) - xDstInSrc) / (double)(1 << 16);
- double coeff = 1.0 - d;
- if(coeff < 0) coeff = 0;
- filter[i*filterSize + j] = coeff;
- xx++;
- }
- xDstInSrc += xInc;
- }
- }
- else
- {
- double xDstInSrc;
- double sizeFactor, filterSizeInSrc;
- const double xInc1 = (double)xInc / (double)(1 << 16);
-
- if(params->method & SWS_BICUBIC) sizeFactor = 4.0;
- else if(params->method & SWS_X) sizeFactor = 8.0;
- else if(params->method & SWS_AREA) sizeFactor = 1.0; //downscale only, for upscale it is bilinear
- else if(params->method & SWS_GAUSS) sizeFactor = 8.0; // infinite ;)
- else if(params->method & SWS_LANCZOS) sizeFactor = params->param ? 2.0 * params->param : 6.0;
- else if(params->method & SWS_SINC) sizeFactor = 20.0; // infinite ;)
- else if(params->method & SWS_SPLINE) sizeFactor = 20.0; // infinite ;)
- else if(params->method & SWS_BILINEAR) sizeFactor = 2.0;
- else
- {
- sizeFactor = 0.0; //GCC warning killer
- ASSERT(0)
- }
-
- if(xInc1 <= 1.0) filterSizeInSrc = sizeFactor; // upscale
- else filterSizeInSrc = sizeFactor * srcW / (double)dstW;
-
- filterSize = (int)ceil(1 + filterSizeInSrc); // will be reduced later if possible
- if(filterSize > srcW - 2) filterSize = srcW - 2;
-
- filter = av_malloc(dstW * sizeof(double) * filterSize);
-
- xDstInSrc = xInc1 / 2.0 - 0.5;
- for(i = 0; i < dstW; i++)
- {
- int xx = (int)(xDstInSrc - (filterSize - 1) * 0.5 + 0.5);
- int j;
- (*filterPos)[i] = xx;
- for(j = 0; j < filterSize; j++)
- {
- double d = FFABS(xx - xDstInSrc) / filterSizeInSrc * sizeFactor;
- double coeff;
- if(params->method & SWS_BICUBIC)
- {
- double A = params->param ? -params->param * 0.01 : -0.08; //old default was -0.60
-
- // Equation is from VirtualDub
- if(d < 1.0)
- coeff = (1.0 - (A + 3.0) * d * d + (A + 2.0) * d * d * d);
- else if(d < 2.0)
- coeff = (-4.0 * A + 8.0 * A * d - 5.0 * A * d * d + A * d * d * d);
- else
- coeff = 0.0;
- }
- /* else if(flags & SWS_X)
- {
- double p= param ? param*0.01 : 0.3;
- coeff = d ? sin(d*PI)/(d*PI) : 1.0;
- coeff*= pow(2.0, - p*d*d);
- }*/
- else if(params->method & SWS_X)
- {
- double A = params->param ? params->param * 0.1 : 1.0;
-
- if(d < 1.0)
- coeff = cos(d * PI);
- else
- coeff = -1.0;
- if(coeff < 0.0) coeff = -pow(-coeff, A);
- else coeff = pow(coeff, A);
- coeff = coeff * 0.5 + 0.5;
- }
- else if(params->method & SWS_AREA)
- {
- double srcPixelSize = 1.0 / xInc1;
- if(d + srcPixelSize / 2 < 0.5) coeff = 1.0;
- else if(d - srcPixelSize / 2 < 0.5) coeff = (0.5 - d) / srcPixelSize + 0.5;
- else coeff = 0.0;
- }
- else if(params->method & SWS_GAUSS)
- {
- double p = params->param ? params->param * 0.1 : 3.0;
- coeff = pow(2.0, - p * d * d);
- }
- else if(params->method & SWS_SINC)
- {
- coeff = d ? sin(d * PI) / (d * PI) : 1.0;
- }
- else if(params->method & SWS_LANCZOS)
- {
- double p = params->param ? params->param : 3.0;
- coeff = d ? sin(d * PI) * sin(d * PI / p) / (d * d * PI * PI / p) : 1.0;
- if(d > p) coeff = 0;
- }
- else if(params->method & SWS_BILINEAR)
- {
- coeff = 1.0 - d;
- if(coeff < 0) coeff = 0;
- }
- else if(params->method & SWS_SPLINE)
- {
- static const double p = -2.196152422706632;
- coeff = getSplineCoeff(1.0, 0.0, p, -p - 1.0, d);
- }
- else
- {
- coeff = 0.0; //GCC warning killer
- ASSERT(0)
- }
-
- filter[i*filterSize + j] = coeff;
- xx++;
- }
- xDstInSrc += xInc1;
- }
- }
-
- /* 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)
- filter2 = av_malloc(filter2Size * dstW * sizeof(double));
-
- for(i = 0; i < dstW; i++)
- {
- int j;
- SwsVector scaleFilter;
- SwsVector *outVec;
-
- scaleFilter.coeff = filter + i * filterSize;
- scaleFilter.length = filterSize;
-
- if(srcFilter) outVec = sws_getConvVec(srcFilter, &scaleFilter);
- else outVec = &scaleFilter;
-
- ASSERT(outVec->length == filter2Size)
- //FIXME dstFilter
-
- for(j = 0; j < outVec->length; j++)
- {
- filter2[i*filter2Size + j] = outVec->coeff[j];
- }
-
- (*filterPos)[i] += (filterSize - 1) / 2 - (filter2Size - 1) / 2;
-
- if(outVec != &scaleFilter) sws_freeVec(outVec);
- }
- av_free(filter);
- filter = NULL;
-
- /* try to reduce the filter-size (step1 find size and shift left) */
- // Assume its 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;
- int j;
- double cutOff = 0.0;
-
- /* get rid off near zero elements on the left by shifting left */
- for(j = 0; j < filter2Size; j++)
- {
- int k;
- cutOff += FFABS(filter2[i*filter2Size]);
-
- if(cutOff > SWS_MAX_REDUCE_CUTOFF) break;
-
- /* preserve Monotonicity because the core can't handle the filter otherwise */
- if(i < dstW - 1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
-
- // Move filter coeffs left
- for(k = 1; k < filter2Size; k++)
- filter2[i*filter2Size + k - 1] = filter2[i*filter2Size + k];
- filter2[i*filter2Size + k - 1] = 0.0;
- (*filterPos)[i]++;
- }
-
- cutOff = 0.0;
- /* count near zeros on the right */
- for(j = filter2Size - 1; j > 0; j--)
- {
- cutOff += FFABS(filter2[i*filter2Size + j]);
-
- if(cutOff > SWS_MAX_REDUCE_CUTOFF) break;
- min--;
- }
-
- if(min > minFilterSize) minFilterSize = min;
- }
-
- if(cpuflags & SWS_CPU_CAPS_ALTIVEC)
- {
- // we can handle the special case 4,
- // so we don't want to go to the full 8
- if(minFilterSize < 5)
+ // Note the +1 is for the MMXscaler which reads over the end
+ *filterPos = av_malloc((dstW+1)*sizeof(int16_t));
+
+ if(FFABS(xInc - 0x10000) <10) // unscaled
+ {
+ int i;
+ filterSize= 1;
+ filter= av_malloc(dstW*sizeof(double)*filterSize);
+ for(i=0; i<dstW*filterSize; i++) filter[i]=0;
+
+ for(i=0; i<dstW; i++)
+ {
+ filter[i*filterSize]=1;
+ (*filterPos)[i]=i;
+ }
+
+ }
+ else if(params->method&SWS_POINT) // lame looking point sampling mode
+ {
+ int i;
+ int xDstInSrc;
+ filterSize= 1;
+ filter= av_malloc(dstW*sizeof(double)*filterSize);
+
+ xDstInSrc= xInc/2 - 0x8000;
+ for(i=0; i<dstW; i++)
+ {
+ int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
+
+ (*filterPos)[i]= xx;
+ filter[i]= 1.0;
+ xDstInSrc+= xInc;
+ }
+ }
+ else if((xInc <= (1<<16) && (params->method&SWS_AREA)) || (params->method&SWS_FAST_BILINEAR)) // bilinear upscale
+ {
+ int i;
+ int xDstInSrc;
+ if (params->method&SWS_BICUBIC) filterSize= 4;
+ else if(params->method&SWS_X ) filterSize= 4;
+ else filterSize= 2; // SWS_BILINEAR / SWS_AREA
+ filter= av_malloc(dstW*sizeof(double)*filterSize);
+
+ 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++)
+ {
+ double d= FFABS((xx<<16) - xDstInSrc)/(double)(1<<16);
+ double coeff= 1.0 - d;
+ if(coeff<0) coeff=0;
+ filter[i*filterSize + j]= coeff;
+ xx++;
+ }
+ xDstInSrc+= xInc;
+ }
+ }
+ else
+ {
+ double xDstInSrc;
+ double sizeFactor, filterSizeInSrc;
+ const double xInc1= (double)xInc / (double)(1<<16);
+
+ if (params->method&SWS_BICUBIC) sizeFactor= 4.0;
+ else if(params->method&SWS_X) sizeFactor= 8.0;
+ else if(params->method&SWS_AREA) sizeFactor= 1.0; //downscale only, for upscale it is bilinear
+ else if(params->method&SWS_GAUSS) sizeFactor= 8.0; // infinite ;)
+ else if(params->method&SWS_LANCZOS) sizeFactor= params->param ? 2.0*params->param : 6.0;
+ else if(params->method&SWS_SINC) sizeFactor= 20.0; // infinite ;)
+ else if(params->method&SWS_SPLINE) sizeFactor= 20.0; // infinite ;)
+ else if(params->method&SWS_BILINEAR) sizeFactor= 2.0;
+ else {
+ sizeFactor= 0.0; //GCC warning killer
+ ASSERT(0)
+ }
+
+ if(xInc1 <= 1.0) filterSizeInSrc= sizeFactor; // upscale
+ else filterSizeInSrc= sizeFactor*srcW / (double)dstW;
+
+ filterSize= (int)ceil(1 + filterSizeInSrc); // will be reduced later if possible
+ if(filterSize > srcW-2) filterSize=srcW-2;
+
+ filter= av_malloc(dstW*sizeof(double)*filterSize);
+
+ xDstInSrc= xInc1 / 2.0 - 0.5;
+ for(i=0; i<dstW; i++)
+ {
+ int xx= (int)(xDstInSrc - (filterSize-1)*0.5 + 0.5);
+ int j;
+ (*filterPos)[i]= xx;
+ for(j=0; j<filterSize; j++)
+ {
+ double d= FFABS(xx - xDstInSrc)/filterSizeInSrc*sizeFactor;
+ double coeff;
+ if(params->method & SWS_BICUBIC)
+ {
+ double A= params->param ? -params->param*0.01 : -0.08; //old default was -0.60
+
+ // Equation is from VirtualDub
+ if(d<1.0)
+ coeff = (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d);
+ else if(d<2.0)
+ coeff = (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d);
+ else
+ coeff=0.0;
+ }
+/* else if(flags & SWS_X)
+ {
+ double p= param ? param*0.01 : 0.3;
+ coeff = d ? sin(d*PI)/(d*PI) : 1.0;
+ coeff*= pow(2.0, - p*d*d);
+ }*/
+ else if(params->method & SWS_X)
+ {
+ double A= params->param ? params->param*0.1 : 1.0;
+
+ if(d<1.0)
+ coeff = cos(d*PI);
+ else
+ coeff=-1.0;
+ if(coeff<0.0) coeff= -pow(-coeff, A);
+ else coeff= pow( coeff, A);
+ coeff= coeff*0.5 + 0.5;
+ }
+ else if(params->method & SWS_AREA)
+ {
+ double srcPixelSize= 1.0/xInc1;
+ if(d + srcPixelSize/2 < 0.5) coeff= 1.0;
+ else if(d - srcPixelSize/2 < 0.5) coeff= (0.5-d)/srcPixelSize + 0.5;
+ else coeff=0.0;
+ }
+ else if(params->method & SWS_GAUSS)
+ {
+ double p= params->param ? params->param*0.1 : 3.0;
+ coeff = pow(2.0, - p*d*d);
+ }
+ else if(params->method & SWS_SINC)
+ {
+ coeff = d ? sin(d*PI)/(d*PI) : 1.0;
+ }
+ else if(params->method & SWS_LANCZOS)
+ {
+ double p= params->param ? params->param : 3.0;
+ coeff = d ? sin(d*PI)*sin(d*PI/p)/(d*d*PI*PI/p) : 1.0;
+ if(d>p) coeff=0;
+ }
+ else if(params->method & SWS_BILINEAR)
+ {
+ coeff= 1.0 - d;
+ if(coeff<0) coeff=0;
+ }
+ else if(params->method & SWS_SPLINE)
+ {
+ static const double p=-2.196152422706632;
+ coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, d);
+ }
+ else {
+ coeff= 0.0; //GCC warning killer
+ ASSERT(0)
+ }
+
+ filter[i*filterSize + j]= coeff;
+ xx++;
+ }
+ xDstInSrc+= xInc1;
+ }
+ }
+
+ /* 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)
+ filter2= av_malloc(filter2Size*dstW*sizeof(double));
+
+ for(i=0; i<dstW; i++)
+ {
+ int j;
+ SwsVector scaleFilter;
+ SwsVector *outVec;
+
+ scaleFilter.coeff= filter + i*filterSize;
+ scaleFilter.length= filterSize;
+
+ if(srcFilter) outVec= sws_getConvVec(srcFilter, &scaleFilter);
+ else outVec= &scaleFilter;
+
+ ASSERT(outVec->length == filter2Size)
+ //FIXME dstFilter
+
+ for(j=0; j<outVec->length; j++)
+ {
+ filter2[i*filter2Size + j]= outVec->coeff[j];
+ }
+
+ (*filterPos)[i]+= (filterSize-1)/2 - (filter2Size-1)/2;
+
+ if(outVec != &scaleFilter) sws_freeVec(outVec);
+ }
+ av_free(filter); filter=NULL;
+
+ /* try to reduce the filter-size (step1 find size and shift left) */
+ // Assume its 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;
+ int j;
+ double cutOff=0.0;
+
+ /* get rid off near zero elements on the left by shifting left */
+ for(j=0; j<filter2Size; j++)
+ {
+ int k;
+ cutOff += FFABS(filter2[i*filter2Size]);
+
+ if(cutOff > SWS_MAX_REDUCE_CUTOFF) break;
+
+ /* preserve Monotonicity because the core can't handle the filter otherwise */
+ if(i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
+
+ // Move filter coeffs left
+ for(k=1; k<filter2Size; k++)
+ filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
+ filter2[i*filter2Size + k - 1]= 0.0;
+ (*filterPos)[i]++;
+ }
+
+ cutOff=0.0;
+ /* count near zeros on the right */
+ for(j=filter2Size-1; j>0; j--)
+ {
+ cutOff += FFABS(filter2[i*filter2Size + j]);
+
+ if(cutOff > SWS_MAX_REDUCE_CUTOFF) break;
+ min--;
+ }
+
+ if(min>minFilterSize) minFilterSize= min;
+ }
+
+ if (cpuflags & SWS_CPU_CAPS_ALTIVEC) {
+ // we can handle the special case 4,
+ // so we don't want to go to 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 filter.
- // vectorizing is worth it only if you have
- // decent-sized vector.
- if(minFilterSize < 3)
+ // we really don't want to waste our time
+ // doing useless computation, so fall-back on
+ // the scalar C code for very small filter.
+ // vectorizing is worth it only if you have
+ // decent-sized vector.
+ if (minFilterSize < 3)
filterAlign = 1;
- }
-
- if(cpuflags & SWS_CPU_CAPS_MMX)
- {
- // special case for unscaled vertical filtering
- if(minFilterSize == 1 && filterAlign == 2)
- filterAlign = 1;
- }
-
- ASSERT(minFilterSize > 0)
- filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1));
- ASSERT(filterSize > 0)
- filter = av_malloc(filterSize * dstW * sizeof(double));
- if(filterSize >= MAX_FILTER_SIZE * 16 / ((subsampling & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
- return -1;
- *outFilterSize = filterSize;
-
- if(debugflags & SWS_PRINT_INFO)
- MSG_V("SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
- /* try to reduce the filter-size (step2 reduce it) */
- for(i = 0; i < dstW; i++)
- {
- int j;
-
- for(j = 0; j < filterSize; j++)
- {
- if(j >= filter2Size) filter[i*filterSize + j] = 0.0;
- else filter[i*filterSize + j] = filter2[i*filter2Size + j];
}
- }
- av_free(filter2);
- filter2 = NULL;
-
-
- //FIXME try to align filterpos if possible
- //fix borders
- for(i = 0; i < dstW; i++)
- {
- int j;
- if((*filterPos)[i] < 0)
- {
- // Move filter coeffs left to compensate for filterPos
- 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;
- }
- (*filterPos)[i] = 0;
+ if (cpuflags & SWS_CPU_CAPS_MMX) {
+ // special case for unscaled vertical filtering
+ if(minFilterSize == 1 && filterAlign == 2)
+ filterAlign= 1;
}
- if((*filterPos)[i] + filterSize > srcW)
+ ASSERT(minFilterSize > 0)
+ filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
+ ASSERT(filterSize > 0)
+ filter= av_malloc(filterSize*dstW*sizeof(double));
+ if (filterSize >= MAX_FILTER_SIZE*16/((subsampling & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
+ return -1;
+ *outFilterSize= filterSize;
+
+ if(debugflags&SWS_PRINT_INFO)
+ MSG_V("SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
+ /* try to reduce the filter-size (step2 reduce it) */
+ for(i=0; i<dstW; i++)
{
- int shift = (*filterPos)[i] + filterSize - srcW;
- // Move filter coeffs right to compensate for filterPos
- 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;
- }
- (*filterPos)[i] = srcW - filterSize;
- }
- }
-
- // Note the +1 is for the MMXscaler which reads over the end
- /* align at 16 for AltiVec (needed by hScale_altivec_real) */
- *outFilter = av_malloc(*outFilterSize * (dstW + 1) * sizeof(int16_t));
- memset(*outFilter, 0, *outFilterSize*(dstW + 1)*sizeof(int16_t));
-
- /* Normalize & Store in outFilter */
- for(i = 0; i < dstW; i++)
- {
- int j;
- double error = 0;
- double sum = 0;
- double scale = one;
-
- for(j = 0; j < filterSize; j++)
- {
- sum += filter[i*filterSize + j];
- }
- scale /= sum;
- for(j = 0; j < *outFilterSize; j++)
- {
- double v = filter[i*filterSize + j] * scale + error;
- int intV = floor(v + 0.5);
- (*outFilter)[i*(*outFilterSize) + j] = intV;
- error = v - intV;
- }
- }
-
- (*filterPos)[dstW] = (*filterPos)[dstW-1]; // the MMX scaler will read over the end
- for(i = 0; i < *outFilterSize; i++)
- {
- int j = dstW * (*outFilterSize);
- (*outFilter)[j + i] = (*outFilter)[j + i - (*outFilterSize)];
- }
-
- av_free(filter);
- return 0;
+ int j;
+
+ for(j=0; j<filterSize; j++)
+ {
+ if(j>=filter2Size) filter[i*filterSize + j]= 0.0;
+ else filter[i*filterSize + j]= filter2[i*filter2Size + j];
+ }
+ }
+ av_free(filter2); filter2=NULL;
+
+
+ //FIXME try to align filterpos if possible
+
+ //fix borders
+ for(i=0; i<dstW; i++)
+ {
+ int j;
+ if((*filterPos)[i] < 0)
+ {
+ // Move filter coeffs left to compensate for filterPos
+ 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;
+ }
+ (*filterPos)[i]= 0;
+ }
+
+ if((*filterPos)[i] + filterSize > srcW)
+ {
+ int shift= (*filterPos)[i] + filterSize - srcW;
+ // Move filter coeffs right to compensate for filterPos
+ 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;
+ }
+ (*filterPos)[i]= srcW - filterSize;
+ }
+ }
+
+ // Note the +1 is for the MMXscaler which reads over the end
+ /* align at 16 for AltiVec (needed by hScale_altivec_real) */
+ *outFilter= av_malloc(*outFilterSize*(dstW+1)*sizeof(int16_t));
+ memset(*outFilter, 0, *outFilterSize*(dstW+1)*sizeof(int16_t));
+
+ /* Normalize & Store in outFilter */
+ for(i=0; i<dstW; i++)
+ {
+ int j;
+ double error=0;
+ double sum=0;
+ double scale= one;
+
+ for(j=0; j<filterSize; j++)
+ {
+ sum+= filter[i*filterSize + j];
+ }
+ scale/= sum;
+ for(j=0; j<*outFilterSize; j++)
+ {
+ double v= filter[i*filterSize + j]*scale + error;
+ int intV= floor(v + 0.5);
+ (*outFilter)[i*(*outFilterSize) + j]= intV;
+ error = v - intV;
+ }
+ }
+
+ (*filterPos)[dstW]= (*filterPos)[dstW-1]; // the MMX scaler will read over the end
+ for(i=0; i<*outFilterSize; i++)
+ {
+ int j= dstW*(*outFilterSize);
+ (*outFilter)[j + i]= (*outFilter)[j + i - (*outFilterSize)];
+ }
+
+ av_free(filter);
+ return 0;
}
#if ARCH_X86_32 || ARCH_X86_64
static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *filter, int32_t *filterPos, int numSplits)
{
- uint8_t *fragmentA;
- stride_t imm8OfPShufW1A;
- stride_t imm8OfPShufW2A;
- stride_t fragmentLengthA;
- uint8_t *fragmentB;
- stride_t imm8OfPShufW1B;
- stride_t imm8OfPShufW2B;
- stride_t fragmentLengthB;
- stride_t fragmentPos;
-
- int xpos, i;
-
- // create an optimized horizontal scaling routine
-
- //code fragment
-
- asm volatile(
- "jmp 9f \n\t"
- // Begin
- "0: \n\t"
- "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t"
- "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t"
- "movd 1(%%"REG_c", %%"REG_S"), %%mm1\n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "pshufw $0xFF, %%mm1, %%mm1 \n\t"
- "1: \n\t"
- "pshufw $0xFF, %%mm0, %%mm0 \n\t"
- "2: \n\t"
- "psubw %%mm1, %%mm0 \n\t"
- "movl 8(%%"REG_b", %%"REG_a"), %%esi\n\t"
- "pmullw %%mm3, %%mm0 \n\t"
- "psllw $7, %%mm1 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
-
- "movq %%mm0, (%%"REG_D", %%"REG_a")\n\t"
-
- "add $8, %%"REG_a" \n\t"
- // End
- "9: \n\t"
+ uint8_t *fragmentA;
+ stride_t imm8OfPShufW1A;
+ stride_t imm8OfPShufW2A;
+ stride_t fragmentLengthA;
+ uint8_t *fragmentB;
+ stride_t imm8OfPShufW1B;
+ stride_t imm8OfPShufW2B;
+ stride_t fragmentLengthB;
+ stride_t fragmentPos;
+
+ int xpos, i;
+
+ // create an optimized horizontal scaling routine
+
+ //code fragment
+
+ asm volatile(
+ "jmp 9f \n\t"
+ // Begin
+ "0: \n\t"
+ "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t"
+ "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t"
+ "movd 1(%%"REG_c", %%"REG_S"), %%mm1\n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "pshufw $0xFF, %%mm1, %%mm1 \n\t"
+ "1: \n\t"
+ "pshufw $0xFF, %%mm0, %%mm0 \n\t"
+ "2: \n\t"
+ "psubw %%mm1, %%mm0 \n\t"
+ "movl 8(%%"REG_b", %%"REG_a"), %%esi\n\t"
+ "pmullw %%mm3, %%mm0 \n\t"
+ "psllw $7, %%mm1 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+
+ "movq %%mm0, (%%"REG_D", %%"REG_a")\n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ // 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"
- "dec %1 \n\t"
- "dec %2 \n\t"
- "sub %0, %1 \n\t"
- "sub %0, %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"
- "sub %0, %3 \n\t"
-
-
- :"=r"(fragmentA), "=r"(imm8OfPShufW1A), "=r"(imm8OfPShufW2A),
- "=r"(fragmentLengthA)
- );
-
- asm volatile(
- "jmp 9f \n\t"
- // Begin
- "0: \n\t"
- "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t"
- "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "pshufw $0xFF, %%mm0, %%mm1 \n\t"
- "1: \n\t"
- "pshufw $0xFF, %%mm0, %%mm0 \n\t"
- "2: \n\t"
- "psubw %%mm1, %%mm0 \n\t"
- "movl 8(%%"REG_b", %%"REG_a"), %%esi\n\t"
- "pmullw %%mm3, %%mm0 \n\t"
- "psllw $7, %%mm1 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
-
- "movq %%mm0, (%%"REG_D", %%"REG_a")\n\t"
-
- "add $8, %%"REG_a" \n\t"
- // End
- "9: \n\t"
+ "sub %0, %3 \n\t"
+
+
+ :"=r" (fragmentA), "=r" (imm8OfPShufW1A), "=r" (imm8OfPShufW2A),
+ "=r" (fragmentLengthA)
+ );
+
+ asm volatile(
+ "jmp 9f \n\t"
+ // Begin
+ "0: \n\t"
+ "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t"
+ "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "pshufw $0xFF, %%mm0, %%mm1 \n\t"
+ "1: \n\t"
+ "pshufw $0xFF, %%mm0, %%mm0 \n\t"
+ "2: \n\t"
+ "psubw %%mm1, %%mm0 \n\t"
+ "movl 8(%%"REG_b", %%"REG_a"), %%esi\n\t"
+ "pmullw %%mm3, %%mm0 \n\t"
+ "psllw $7, %%mm1 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+
+ "movq %%mm0, (%%"REG_D", %%"REG_a")\n\t"
+
+ "add $8, %%"REG_a" \n\t"
+ // 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"
- "dec %1 \n\t"
- "dec %2 \n\t"
- "sub %0, %1 \n\t"
- "sub %0, %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"
- "sub %0, %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;
+ 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;
- 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;
- if(d + 1 < 4)
- {
- int maxShift = 3 - (d + 1);
- int shift = 0;
+ if(d+1<4)
+ {
+ int maxShift= 3-(d+1);
+ int shift=0;
- memcpy(funnyCode + fragmentPos, fragmentB, fragmentLengthB);
+ memcpy(funnyCode + fragmentPos, fragmentB, fragmentLengthB);
- funnyCode[fragmentPos + imm8OfPShufW1B] =
- (a + 1) | ((b + 1) << 2) | ((c + 1) << 4) | ((d + 1) << 6);
- funnyCode[fragmentPos + imm8OfPShufW2B] =
- a | (b << 2) | (c << 4) | (d << 6);
+ funnyCode[fragmentPos + imm8OfPShufW1B]=
+ (a+1) | ((b+1)<<2) | ((c+1)<<4) | ((d+1)<<6);
+ funnyCode[fragmentPos + imm8OfPShufW2B]=
+ a | (b<<2) | (c<<4) | (d<<6);
- if(i + 3 >= dstW) shift = maxShift; //avoid overread
- else if((filterPos[i/2] & 3) <= maxShift) shift = filterPos[i/2] & 3; //Align
+ if(i+3>=dstW) shift=maxShift; //avoid overread
+ else if((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align
- if(shift && i >= shift)
- {
- funnyCode[fragmentPos + imm8OfPShufW1B] += 0x55 * shift;
- funnyCode[fragmentPos + imm8OfPShufW2B] += 0x55 * shift;
- filterPos[i/2] -= shift;
- }
+ if(shift && i>=shift)
+ {
+ funnyCode[fragmentPos + imm8OfPShufW1B]+= 0x55*shift;
+ funnyCode[fragmentPos + imm8OfPShufW2B]+= 0x55*shift;
+ filterPos[i/2]-=shift;
+ }
- fragmentPos += fragmentLengthB;
- }
- else
- {
- int maxShift = 3 - d;
- int shift = 0;
+ fragmentPos+= fragmentLengthB;
+ }
+ else
+ {
+ int maxShift= 3-d;
+ int shift=0;
- memcpy(funnyCode + fragmentPos, fragmentA, fragmentLengthA);
+ memcpy(funnyCode + fragmentPos, fragmentA, fragmentLengthA);
- funnyCode[fragmentPos + imm8OfPShufW1A] =
- funnyCode[fragmentPos + imm8OfPShufW2A] =
- a | (b << 2) | (c << 4) | (d << 6);
+ funnyCode[fragmentPos + imm8OfPShufW1A]=
+ funnyCode[fragmentPos + imm8OfPShufW2A]=
+ a | (b<<2) | (c<<4) | (d<<6);
- if(i + 4 >= dstW) shift = maxShift; //avoid overread
- else if((filterPos[i/2] & 3) <= maxShift) shift = filterPos[i/2] & 3; //partial align
+ if(i+4>=dstW) shift=maxShift; //avoid overread
+ else if((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //partial align
- if(shift && i >= shift)
- {
- funnyCode[fragmentPos + imm8OfPShufW1A] += 0x55 * shift;
- funnyCode[fragmentPos + imm8OfPShufW2A] += 0x55 * shift;
- filterPos[i/2] -= shift;
- }
+ if(shift && i>=shift)
+ {
+ funnyCode[fragmentPos + imm8OfPShufW1A]+= 0x55*shift;
+ funnyCode[fragmentPos + imm8OfPShufW2A]+= 0x55*shift;
+ filterPos[i/2]-=shift;
+ }
- fragmentPos += fragmentLengthA;
- }
+ fragmentPos+= fragmentLengthA;
+ }
- funnyCode[fragmentPos] = RET;
- }
- xpos += xInc;
- }
- filterPos[i/2] = xpos >> 16; // needed to jump to the next part
+ funnyCode[fragmentPos]= RET;
+ }
+ xpos+=xInc;
+ }
+ filterPos[i/2]= xpos>>16; // needed to jump to the next part
}
#endif // ARCH_X86_32 || ARCH_X86_64
-static void globalInit(void)
-{
+static void globalInit(void){
// generating tables:
int i;
- for(i = 0; i < 768; i++)
- {
- int c = FFMIN(FFMAX(i - 256, 0), 255);
- clip_table[i] = c;
+ for(i=0; i<768; i++){
+ int c= FFMIN(FFMAX(i-256, 0), 255);
+ clip_table[i]=c;
}
}
-static SwsFunc getSwsFunc(int flags)
-{
+static SwsFunc getSwsFunc(int flags){
#ifdef RUNTIME_CPUDETECT
#if ARCH_X86_32 || ARCH_X86_64
- // ordered per speed fasterst first
- if(flags & SWS_CPU_CAPS_MMX2)
- return swScale_MMX2;
- else if(flags & SWS_CPU_CAPS_3DNOW)
- return swScale_3DNow;
- else if(flags & SWS_CPU_CAPS_MMX)
- return swScale_MMX;
- else
- return swScale_C;
+ // ordered per speed fasterst first
+ if(flags & SWS_CPU_CAPS_MMX2)
+ return swScale_MMX2;
+ else if(flags & SWS_CPU_CAPS_3DNOW)
+ return swScale_3DNow;
+ else if(flags & SWS_CPU_CAPS_MMX)
+ return swScale_MMX;
+ else
+ return swScale_C;
#else
#ifdef ARCH_POWERPC
- if(flags & SWS_CPU_CAPS_ALTIVEC)
- return swScale_altivec;
- else
- return swScale_C;
+ if(flags & SWS_CPU_CAPS_ALTIVEC)
+ return swScale_altivec;
+ else
+ return swScale_C;
#endif
- return swScale_C;
+ return swScale_C;
#endif /* ARCH_X86_32 || ARCH_X86_64 */
#else //RUNTIME_CPUDETECT
#if HAVE_MMX2
- return swScale_MMX2;
+ return swScale_MMX2;
#elif HAVE_AMD3DNOW
- return swScale_3DNow;
+ return swScale_3DNow;
#elif HAVE_MMX
- return swScale_MMX;
+ return swScale_MMX;
#elif defined (HAVE_ALTIVEC)
- return swScale_altivec;
+ return swScale_altivec;
#else
- return swScale_C;
+ return swScale_C;
#endif
#endif //!RUNTIME_CPUDETECT
}
static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], stride_t dstStride[])
-{
- uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
- /* Copy Y plane */
- if(dstStride[0] == srcStride[0] && srcStride[0] > 0)
- memcpy(dst, src[0], srcSliceH * dstStride[0]);
- else
- {
- int i;
- uint8_t *srcPtr = src[0];
- uint8_t *dstPtr = dst;
- for(i = 0; i < srcSliceH; i++)
- {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- }
- dst = dstParam[1]; //dstParam[0] + dstStride[0]*c->srcH;
- if(c->dstFormat == IMGFMT_NV12)
- interleaveBytes(src[1], src[2], dst, c->srcW / 2, srcSliceH / 2, srcStride[1], srcStride[2], dstStride[0]);
- else
- interleaveBytes(src[2], src[1], dst, c->srcW / 2, srcSliceH / 2, srcStride[2], srcStride[1], dstStride[0]);
-
- return srcSliceH;
+ int srcSliceH, uint8_t* dstParam[], stride_t dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
+ /* Copy Y plane */
+ if(dstStride[0]==srcStride[0] && srcStride[0] > 0)
+ memcpy(dst, src[0], srcSliceH*dstStride[0]);
+ else
+ {
+ int i;
+ uint8_t *srcPtr= src[0];
+ uint8_t *dstPtr= dst;
+ for(i=0; i<srcSliceH; i++)
+ {
+ memcpy(dstPtr, srcPtr, c->srcW);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ }
+ dst = dstParam[1]; //dstParam[0] + dstStride[0]*c->srcH;
+ if (c->dstFormat == IMGFMT_NV12)
+ interleaveBytes( src[1],src[2],dst,c->srcW/2,srcSliceH/2,srcStride[1],srcStride[2],dstStride[0] );
+ else
+ interleaveBytes( src[2],src[1],dst,c->srcW/2,srcSliceH/2,srcStride[2],srcStride[1],dstStride[0] );
+
+ return srcSliceH;
}
static int NV12ToPlanarWrapper(SwsContext *c, uint8_t* srcParam[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[])
-{
- const uint8_t *src = srcParam[0] + srcStride[0] * srcSliceY;
- unsigned char *dst_U = dst[1];
- unsigned char *dst_V = dst[2];
- int swapped = c->srcFormat == IMGFMT_NV12;
- int x, y, idx;
- int srcSliceHc = srcSliceH >> 1;
- int srcWc = c->srcW >> 1;
-
- if(dstStride[0] == srcStride[0] && srcStride[0] > 0)
- memcpy(dst[0], src, srcSliceH * dstStride[0]);
- else
- {
- int i;
- uint8_t *dstPtr = dst[0];
- const uint8_t *srcPtr = src;
- for(i = 0; i < srcSliceH; i++)
- {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- }
-
- idx = 0;
- src = srcParam[1];
- if(swapped)
- {
- for(y = 0 ; y < srcSliceHc ; y++, dst_U += dstStride[1], dst_V += dstStride[2])
- {
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]){
+ const uint8_t *src=srcParam[0] + srcStride[0]*srcSliceY;
+ unsigned char *dst_U =dst[1];
+ unsigned char *dst_V =dst[2];
+ int swapped=c->srcFormat == IMGFMT_NV12;
+ int x,y,idx;
+ int srcSliceHc = srcSliceH >> 1;
+ int srcWc = c->srcW >> 1;
+
+ if(dstStride[0]==srcStride[0] && srcStride[0]>0)
+ memcpy(dst[0], src, srcSliceH*dstStride[0]);
+ else
+ {
+ int i;
+ uint8_t *dstPtr= dst[0];
+ const uint8_t *srcPtr= src;
+ for(i=0; i<srcSliceH; i++)
+ {
+ memcpy(dstPtr, srcPtr, c->srcW);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ }
+
+ idx=0;
+ src=srcParam[1];
+ if (swapped)
+ {
+ for(y = 0 ; y < srcSliceHc ; y++, dst_U += dstStride[1], dst_V += dstStride[2] ) {
idx = 0;
- for(x = 0 ; x < srcWc ; x++, idx += 2)
- {
+ for(x = 0 ; x < srcWc ; x++, idx+=2){
*(dst_U + x) = *(src + idx);
*(dst_V + x) = *(src + idx + 1);
}
src += srcStride[1];
}
- }
- else
- {
- for(y = 0 ; y < srcSliceHc ; y++, dst_U += dstStride[1], dst_V += dstStride[2])
- {
+ } else {
+ for(y = 0 ; y < srcSliceHc ; y++, dst_U += dstStride[1], dst_V += dstStride[2] ) {
idx = 0;
- for(x = 0 ; x < srcWc ; x++, idx += 2)
- {
+ for(x = 0 ; x < srcWc ; x++, idx+=2){
*(dst_U + x) = *(src + idx + 1);
*(dst_V + x) = *(src + idx);
}
@@ -1721,438 +1684,347 @@ static int NV12ToPlanarWrapper(SwsContext *c, uint8_t* srcParam[], stride_t srcS
}
static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], stride_t dstStride[])
-{
- uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
+ int srcSliceH, uint8_t* dstParam[], stride_t dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
+ yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
- return srcSliceH;
+ return srcSliceH;
}
static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], stride_t dstStride[])
-{
- uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
+ int srcSliceH, uint8_t* dstParam[], stride_t dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
+ yv12touyvy( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
- return srcSliceH;
+ return srcSliceH;
}
static int PlanarToYvyuWrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], stride_t dstStride[])
-{
- uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
+ int srcSliceH, uint8_t* dstParam[], stride_t dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- yv12toyvyu(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
+ yv12toyvyu( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
- return srcSliceH;
+ return srcSliceH;
}
static int PlanarToVyuyWrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], stride_t dstStride[])
-{
- uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY;
+ int srcSliceH, uint8_t* dstParam[], stride_t dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- yv12tovyuy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
+ yv12tovyuy( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] );
- return srcSliceH;
+ return srcSliceH;
}
/* {RGB,BGR}{15,16,24,32} -> {RGB,BGR}{15,16,24,32} */
static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[])
-{
- const int srcFormat = c->srcFormat;
- const int dstFormat = c->dstFormat;
- const int srcBpp = ((srcFormat & 0xFF) + 7) >> 3;
- const int dstBpp = ((dstFormat & 0xFF) + 7) >> 3;
- const int srcId = (srcFormat & 0xFF) >> 2; // 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8
- const int dstId = (dstFormat & 0xFF) >> 2;
- void (*conv)(const uint8_t * src, uint8_t * dst, stride_t src_size) = NULL;
-
- /* BGR -> BGR */
- if((isBGR(srcFormat) && isBGR(dstFormat))
- || (isRGB(srcFormat) && isRGB(dstFormat)))
- {
- switch(srcId | (dstId << 4))
- {
- case 0x34:
- conv = rgb16to15;
- break;
- case 0x36:
- conv = rgb24to15;
- break;
- case 0x38:
- conv = rgb32to15;
- break;
- case 0x43:
- conv = rgb15to16;
- break;
- case 0x46:
- conv = rgb24to16;
- break;
- case 0x48:
- conv = rgb32to16;
- break;
- case 0x63:
- conv = rgb15to24;
- break;
- case 0x64:
- conv = rgb16to24;
- break;
- case 0x68:
- conv = rgb32to24;
- break;
- case 0x83:
- conv = rgb15to32;
- break;
- case 0x84:
- conv = rgb16to32;
- break;
- case 0x86:
- conv = rgb24to32;
- break;
- default:
- MSG_ERR("swScaler: internal error %s -> %s converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- break;
- }
- }
- else if((isBGR(srcFormat) && isRGB(dstFormat))
- || (isRGB(srcFormat) && isBGR(dstFormat)))
- {
- switch(srcId | (dstId << 4))
- {
- case 0x33:
- conv = rgb15tobgr15;
- break;
- case 0x34:
- conv = rgb16tobgr15;
- break;
- case 0x36:
- conv = rgb24tobgr15;
- break;
- case 0x38:
- conv = rgb32tobgr15;
- break;
- case 0x43:
- conv = rgb15tobgr16;
- break;
- case 0x44:
- conv = rgb16tobgr16;
- break;
- case 0x46:
- conv = rgb24tobgr16;
- break;
- case 0x48:
- conv = rgb32tobgr16;
- break;
- case 0x63:
- conv = rgb15tobgr24;
- break;
- case 0x64:
- conv = rgb16tobgr24;
- break;
- case 0x66:
- conv = rgb24tobgr24;
- break;
- case 0x68:
- conv = rgb32tobgr24;
- break;
- case 0x83:
- conv = rgb15tobgr32;
- break;
- case 0x84:
- conv = rgb16tobgr32;
- break;
- case 0x86:
- conv = rgb24tobgr32;
- break;
- case 0x88:
- conv = rgb32tobgr32;
- break;
- default:
- MSG_ERR("swScaler: internal error %s -> %s converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- break;
- }
- }
- else
- {
- MSG_ERR("swScaler: internal error %s -> %s converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- }
-
- if(dstStride[0]*srcBpp == srcStride[0]*dstBpp && dstStride[0] > 0)
- conv(src[0], dst[0] + dstStride[0]*srcSliceY, srcSliceH * srcStride[0]);
- else
- {
- int i;
- uint8_t *srcPtr = src[0];
- uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
-
- for(i = 0; i < srcSliceH; i++)
- {
- conv(srcPtr, dstPtr, c->srcW * srcBpp);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- }
- return srcSliceH;
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]){
+ const int srcFormat= c->srcFormat;
+ const int dstFormat= c->dstFormat;
+ const int srcBpp= ((srcFormat&0xFF) + 7)>>3;
+ const int dstBpp= ((dstFormat&0xFF) + 7)>>3;
+ const int srcId= (srcFormat&0xFF)>>2; // 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8
+ const int dstId= (dstFormat&0xFF)>>2;
+ void (*conv)(const uint8_t *src, uint8_t *dst, stride_t src_size)=NULL;
+
+ /* BGR -> BGR */
+ if( (isBGR(srcFormat) && isBGR(dstFormat))
+ || (isRGB(srcFormat) && isRGB(dstFormat))){
+ switch(srcId | (dstId<<4)){
+ case 0x34: conv= rgb16to15; break;
+ case 0x36: conv= rgb24to15; break;
+ case 0x38: conv= rgb32to15; break;
+ case 0x43: conv= rgb15to16; break;
+ case 0x46: conv= rgb24to16; break;
+ case 0x48: conv= rgb32to16; break;
+ case 0x63: conv= rgb15to24; break;
+ case 0x64: conv= rgb16to24; break;
+ case 0x68: conv= rgb32to24; break;
+ case 0x83: conv= rgb15to32; break;
+ case 0x84: conv= rgb16to32; break;
+ case 0x86: conv= rgb24to32; break;
+ default: MSG_ERR("swScaler: internal error %s -> %s converter\n",
+ sws_format_name(srcFormat), sws_format_name(dstFormat)); break;
+ }
+ }else if( (isBGR(srcFormat) && isRGB(dstFormat))
+ || (isRGB(srcFormat) && isBGR(dstFormat))){
+ switch(srcId | (dstId<<4)){
+ case 0x33: conv= rgb15tobgr15; break;
+ case 0x34: conv= rgb16tobgr15; break;
+ case 0x36: conv= rgb24tobgr15; break;
+ case 0x38: conv= rgb32tobgr15; break;
+ case 0x43: conv= rgb15tobgr16; break;
+ case 0x44: conv= rgb16tobgr16; break;
+ case 0x46: conv= rgb24tobgr16; break;
+ case 0x48: conv= rgb32tobgr16; break;
+ case 0x63: conv= rgb15tobgr24; break;
+ case 0x64: conv= rgb16tobgr24; break;
+ case 0x66: conv= rgb24tobgr24; break;
+ case 0x68: conv= rgb32tobgr24; break;
+ case 0x83: conv= rgb15tobgr32; break;
+ case 0x84: conv= rgb16tobgr32; break;
+ case 0x86: conv= rgb24tobgr32; break;
+ case 0x88: conv= rgb32tobgr32; break;
+ default: MSG_ERR("swScaler: internal error %s -> %s converter\n",
+ sws_format_name(srcFormat), sws_format_name(dstFormat)); break;
+ }
+ }else{
+ MSG_ERR("swScaler: internal error %s -> %s converter\n",
+ sws_format_name(srcFormat), sws_format_name(dstFormat));
+ }
+
+ if(dstStride[0]*srcBpp == srcStride[0]*dstBpp && dstStride[0]>0)
+ conv(src[0], dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
+ else
+ {
+ int i;
+ uint8_t *srcPtr= src[0];
+ uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
+
+ for(i=0; i<srcSliceH; i++)
+ {
+ conv(srcPtr, dstPtr, c->srcW*srcBpp);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ }
+ return srcSliceH;
}
static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[])
-{
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]){
- rgb24toyv12(
- src[0],
- dst[0] + srcSliceY * dstStride[0],
- dst[1] + (srcSliceY >> 1)*dstStride[1],
- dst[2] + (srcSliceY >> 1)*dstStride[2],
- c->srcW, srcSliceH,
- dstStride[0], dstStride[1], srcStride[0]);
- return srcSliceH;
+ rgb24toyv12(
+ src[0],
+ dst[0]+ srcSliceY *dstStride[0],
+ dst[1]+(srcSliceY>>1)*dstStride[1],
+ dst[2]+(srcSliceY>>1)*dstStride[2],
+ c->srcW, srcSliceH,
+ dstStride[0], dstStride[1], srcStride[0]);
+ return srcSliceH;
}
static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[])
-{
- int i;
-
- /* copy Y */
- if(srcStride[0] == dstStride[0] && srcStride[0] > 0)
- memcpy(dst[0] + srcSliceY * dstStride[0], src[0], srcStride[0]*srcSliceH);
- else
- {
- uint8_t *srcPtr = src[0];
- uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
-
- for(i = 0; i < srcSliceH; i++)
- {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- }
-
- if(c->dstFormat == IMGFMT_YV12)
- {
- planar2x(src[1], dst[1], c->chrSrcW, c->chrSrcH, srcStride[1], dstStride[1]);
- planar2x(src[2], dst[2], c->chrSrcW, c->chrSrcH, srcStride[2], dstStride[2]);
- }
- else
- {
- planar2x(src[1], dst[2], c->chrSrcW, c->chrSrcH, srcStride[1], dstStride[2]);
- planar2x(src[2], dst[1], c->chrSrcW, c->chrSrcH, srcStride[2], dstStride[1]);
- }
- return srcSliceH;
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]){
+ int i;
+
+ /* copy Y */
+ if(srcStride[0]==dstStride[0] && srcStride[0] > 0)
+ memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
+ else{
+ uint8_t *srcPtr= src[0];
+ uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
+
+ for(i=0; i<srcSliceH; i++)
+ {
+ memcpy(dstPtr, srcPtr, c->srcW);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ }
+
+ if(c->dstFormat==IMGFMT_YV12){
+ planar2x(src[1], dst[1], c->chrSrcW, c->chrSrcH, srcStride[1], dstStride[1]);
+ planar2x(src[2], dst[2], c->chrSrcW, c->chrSrcH, srcStride[2], dstStride[2]);
+ }else{
+ planar2x(src[1], dst[2], c->chrSrcW, c->chrSrcH, srcStride[1], dstStride[2]);
+ planar2x(src[2], dst[1], c->chrSrcW, c->chrSrcH, srcStride[2], dstStride[1]);
+ }
+ return srcSliceH;
}
/**
* bring pointers in YUV order instead of YVU
*/
-static inline void sws_orderYUV(int format, uint8_t * sortedP[], stride_t sortedStride[], uint8_t * p[], stride_t stride[])
-{
- if(format == IMGFMT_YV12 || format == IMGFMT_YVU9
- || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P)
- {
- sortedP[0] = p[0];
- sortedP[1] = p[2];
- sortedP[2] = p[1];
- sortedStride[0] = stride[0];
- sortedStride[1] = stride[2];
- sortedStride[2] = stride[1];
- }
- else if(isPacked(format) || isGray(format) || format == IMGFMT_Y8)
- {
- sortedP[0] = p[0];
- sortedP[1] =
- sortedP[2] = NULL;
- sortedStride[0] = stride[0];
- sortedStride[1] =
- sortedStride[2] = 0;
- }
- else if(format == IMGFMT_I420 || format == IMGFMT_IYUV)
- {
- sortedP[0] = p[0];
- sortedP[1] = p[1];
- sortedP[2] = p[2];
- sortedStride[0] = stride[0];
- sortedStride[1] = stride[1];
- sortedStride[2] = stride[2];
- }
- else if(format == IMGFMT_NV12 || format == IMGFMT_NV21)
- {
- sortedP[0] = p[0];
- sortedP[1] = p[1];
- sortedP[2] = NULL;
- sortedStride[0] = stride[0];
- sortedStride[1] = stride[1];
- sortedStride[2] = 0;
- }
- else
- {
- MSG_ERR("internal error in orderYUV\n");
- }
+static inline void sws_orderYUV(int format, uint8_t * sortedP[], stride_t sortedStride[], uint8_t * p[], stride_t stride[]){
+ if(format == IMGFMT_YV12 || format == IMGFMT_YVU9
+ || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){
+ sortedP[0]= p[0];
+ sortedP[1]= p[2];
+ sortedP[2]= p[1];
+ sortedStride[0]= stride[0];
+ sortedStride[1]= stride[2];
+ sortedStride[2]= stride[1];
+ }
+ else if(isPacked(format) || isGray(format) || format == IMGFMT_Y8)
+ {
+ sortedP[0]= p[0];
+ sortedP[1]=
+ sortedP[2]= NULL;
+ sortedStride[0]= stride[0];
+ sortedStride[1]=
+ sortedStride[2]= 0;
+ }
+ else if(format == IMGFMT_I420 || format == IMGFMT_IYUV)
+ {
+ sortedP[0]= p[0];
+ sortedP[1]= p[1];
+ sortedP[2]= p[2];
+ sortedStride[0]= stride[0];
+ sortedStride[1]= stride[1];
+ sortedStride[2]= stride[2];
+ }
+ else if(format == IMGFMT_NV12 || format == IMGFMT_NV21)
+ {
+ sortedP[0]= p[0];
+ sortedP[1]= p[1];
+ sortedP[2]= NULL;
+ sortedStride[0]= stride[0];
+ sortedStride[1]= stride[1];
+ sortedStride[2]= 0;
+ }else{
+ MSG_ERR("internal error in orderYUV\n");
+ }
}
/* unscaled copy like stuff (assumes nearly identical formats) */
static int simpleCopy(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[])
-{
-
- if(isPacked(c->srcFormat))
- {
- int length = c->srcW * csp_mplayercsp2Bpp(c->srcFormat);
-
- if(dstStride[0] == srcStride[0] && srcStride[0] > 0 && srcSliceH > 0)
- memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], (srcSliceH - 1)*dstStride[0] + length); // older version crashed in ffdshow-crop, which moves the image horizontally. Last line overflows.
- else
- {
- int i;
- uint8_t *srcPtr = src[0];
- uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
-
- for(i = 0; i < srcSliceH; i++)
- {
- memcpy(dstPtr, srcPtr, length);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- }
- }
- else if(c->srcFormat == IMGFMT_NV12 || c->srcFormat == IMGFMT_NV21)
- {
- if(dstStride[0] == srcStride[0] && srcStride[0] > 0 && srcSliceH > 0)
- {
- memcpy(dst[0] + dstStride[0] * srcSliceY, src[0], (srcSliceH - 1) * dstStride[0] + c->srcW);
- memcpy(dst[1] + (dstStride[0] * srcSliceY >> 1), src[1], ((srcSliceH >> 1) - 1) * dstStride[0] + c->srcW);
- }
- else
- {
- int i;
- int srcSliceHc = srcSliceH >> 1;
- uint8_t *srcPtr = src[0];
- uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
-
- for(i = 0 ; i < srcSliceH ; i++)
- {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- srcPtr = src[1];
- dstPtr = dst[1] + (dstStride[0] * srcSliceY >> 1);
- for(i = 0 ; i < srcSliceHc ; i++)
- {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr += srcStride[0];
- dstPtr += dstStride[0];
- }
- }
- }
- else
- {
- /* Planar YUV or gray */
- int plane;
- for(plane = 0; plane < 3; plane++)
- {
- int length = plane == 0 ? c->srcW : -((-c->srcW) >> c->chrDstHSubSample);
- int y = plane == 0 ? srcSliceY : -((-srcSliceY) >> c->chrDstVSubSample);
- int height = plane == 0 ? srcSliceH : -((-srcSliceH) >> c->chrDstVSubSample);
-
- if((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane > 0)
- {
- if(!isGray(c->dstFormat))
- memset(dst[plane], 128, dstStride[plane]*height);
- }
- else
- {
- if(dstStride[plane] == srcStride[plane] && srcStride[plane] > 0 && height > 0)
- memcpy(dst[plane] + dstStride[plane]*y, src[plane], (height - 1)*dstStride[plane] + length);
- else
- {
- int i;
- uint8_t *srcPtr = src[plane];
- uint8_t *dstPtr = dst[plane] + dstStride[plane] * y;
- for(i = 0; i < height; i++)
- {
- memcpy(dstPtr, srcPtr, length);
- srcPtr += srcStride[plane];
- dstPtr += dstStride[plane];
- }
- }
- }
- }
- }
- return srcSliceH;
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]){
+
+ if(isPacked(c->srcFormat))
+ {
+ int length= c->srcW * csp_mplayercsp2Bpp(c->srcFormat);
+
+ if(dstStride[0]==srcStride[0] && srcStride[0] > 0 && srcSliceH>0)
+ memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], (srcSliceH-1)*dstStride[0]+length); // older version crashed in ffdshow-crop, which moves the image horizontally. Last line overflows.
+ else
+ {
+ int i;
+ uint8_t *srcPtr= src[0];
+ uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
+
+ for(i=0; i<srcSliceH; i++)
+ {
+ memcpy(dstPtr, srcPtr, length);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ }
+ }
+ else if (c->srcFormat == IMGFMT_NV12 || c->srcFormat == IMGFMT_NV21)
+ {
+ if(dstStride[0]==srcStride[0] && srcStride[0] > 0 && srcSliceH>0)
+ {
+ memcpy(dst[0] + dstStride[0] * srcSliceY, src[0], (srcSliceH - 1) * dstStride[0] + c->srcW);
+ memcpy(dst[1] + (dstStride[0] * srcSliceY >> 1), src[1], ((srcSliceH >> 1) - 1) * dstStride[0] + c->srcW);
+ }
+ else
+ {
+ int i;
+ int srcSliceHc = srcSliceH >> 1;
+ uint8_t *srcPtr= src[0];
+ uint8_t *dstPtr= dst[0] + dstStride[0] * srcSliceY;
+
+ for(i=0 ; i<srcSliceH ; i++)
+ {
+ memcpy(dstPtr, srcPtr, c->srcW);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ srcPtr = src[1];
+ dstPtr = dst[1] + (dstStride[0] * srcSliceY >> 1);
+ for(i=0 ; i<srcSliceHc ; i++)
+ {
+ memcpy(dstPtr, srcPtr, c->srcW);
+ srcPtr+= srcStride[0];
+ dstPtr+= dstStride[0];
+ }
+ }
+ }
+ else
+ { /* Planar YUV or gray */
+ int plane;
+ for(plane=0; plane<3; plane++)
+ {
+ int length= plane==0 ? c->srcW : -((-c->srcW )>>c->chrDstHSubSample);
+ int y= plane==0 ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample);
+ int height= plane==0 ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample);
+
+ if((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0)
+ {
+ if(!isGray(c->dstFormat))
+ memset(dst[plane], 128, dstStride[plane]*height);
+ }
+ else
+ {
+ if(dstStride[plane]==srcStride[plane] && srcStride[plane] > 0 && height>0)
+ memcpy(dst[plane] + dstStride[plane]*y, src[plane], (height-1)*dstStride[plane] + length);
+ else
+ {
+ int i;
+ uint8_t *srcPtr= src[plane];
+ uint8_t *dstPtr= dst[plane] + dstStride[plane]*y;
+ for(i=0; i<height; i++)
+ {
+ memcpy(dstPtr, srcPtr, length);
+ srcPtr+= srcStride[plane];
+ dstPtr+= dstStride[plane];
+ }
+ }
+ }
+ }
+ }
+ return srcSliceH;
}
static int remove_dup_fourcc(int fourcc)
{
- switch(fourcc)
- {
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- return IMGFMT_YV12;
- case IMGFMT_Y8 :
- return IMGFMT_Y800;
- case IMGFMT_IF09:
- return IMGFMT_YVU9;
- default:
- return fourcc;
- }
-}
-
-static void getSubSampleFactors(int *h, int *v, int format)
-{
- switch(format)
- {
- case IMGFMT_UYVY:
- case IMGFMT_YVYU:
- case IMGFMT_VYUY:
- case IMGFMT_YUY2:
- *h = 1;
- *v = 0;
- break;
- case IMGFMT_YV12:
- case IMGFMT_Y800: //FIXME remove after different subsamplings are fully implemented
- case IMGFMT_NV12:
- case IMGFMT_NV21:
- *h = 1;
- *v = 1;
- break;
- case IMGFMT_YVU9:
- *h = 2;
- *v = 2;
- break;
- case IMGFMT_444P:
- *h = 0;
- *v = 0;
- break;
- case IMGFMT_422P:
- *h = 1;
- *v = 0;
- break;
- case IMGFMT_411P:
- *h = 2;
- *v = 0;
- break;
- default:
- *h = 0;
- *v = 0;
- break;
- }
-}
-
-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;
+ switch(fourcc)
+ {
+ case IMGFMT_I420:
+ case IMGFMT_IYUV: return IMGFMT_YV12;
+ case IMGFMT_Y8 : return IMGFMT_Y800;
+ case IMGFMT_IF09: return IMGFMT_YVU9;
+ default: return fourcc;
+ }
+}
+
+static void getSubSampleFactors(int *h, int *v, int format){
+ switch(format){
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
+ case IMGFMT_VYUY:
+ case IMGFMT_YUY2:
+ *h=1;
+ *v=0;
+ break;
+ case IMGFMT_YV12:
+ case IMGFMT_Y800: //FIXME remove after different subsamplings are fully implemented
+ case IMGFMT_NV12:
+ case IMGFMT_NV21:
+ *h=1;
+ *v=1;
+ break;
+ case IMGFMT_YVU9:
+ *h=2;
+ *v=2;
+ break;
+ case IMGFMT_444P:
+ *h=0;
+ *v=0;
+ break;
+ case IMGFMT_422P:
+ *h=1;
+ *v=0;
+ break;
+ case IMGFMT_411P:
+ *h=2;
+ *v=0;
+ break;
+ default:
+ *h=0;
+ *v=0;
+ break;
+ }
+}
+
+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;
}
/**
@@ -2160,628 +2032,618 @@ static uint16_t roundToInt16(int64_t f)
* @param fullRange if 1 then the luma range is 0..255 if 0 its 16..235
* @return -1 if not supported
*/
-int sws_setColorspaceDetails(SwsContext *c, const int inv_table[7], int srcRange, const int table[7], int dstRange, int brightness, int contrast, int saturation)
-{
- int64_t crv = inv_table[0];
- int64_t cbu = inv_table[1];
- int64_t cgu = -inv_table[2];
- int64_t cgv = -inv_table[3];
- int64_t cy = inv_table[4];
- int64_t oy = inv_table[5];
-
- if(isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
- memcpy(c->srcColorspaceTable, inv_table, sizeof(int) * 7);
- memcpy(c->dstColorspaceTable, table, sizeof(int) * 7);
-
- c->brightness = brightness;
- c->contrast = contrast;
- c->saturation = saturation;
- c->srcRange = srcRange;
- c->dstRange = dstRange;
-
- c->uOffset = 0x0400040004000400LL;
- c->vOffset = 0x0400040004000400LL;
-
- 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->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;
-
- yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
- //FIXME factorize
+int sws_setColorspaceDetails(SwsContext *c, const int inv_table[7], int srcRange, const int table[7], int dstRange, int brightness, int contrast, int saturation){
+ int64_t crv = inv_table[0];
+ int64_t cbu = inv_table[1];
+ int64_t cgu = -inv_table[2];
+ int64_t cgv = -inv_table[3];
+ int64_t cy = inv_table[4];
+ int64_t oy = inv_table[5];
+
+ if(isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
+ memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*7);
+ memcpy(c->dstColorspaceTable, table, sizeof(int)*7);
+
+ c->brightness= brightness;
+ c->contrast = contrast;
+ c->saturation= saturation;
+ c->srcRange = srcRange;
+ c->dstRange = dstRange;
+
+ c->uOffset= 0x0400040004000400LL;
+ c->vOffset= 0x0400040004000400LL;
+
+ 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->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;
+
+ yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
+ //FIXME factorize
#ifdef COMPILE_ALTIVEC
- if(c->flags & SWS_CPU_CAPS_ALTIVEC)
- yuv2rgb_altivec_init_tables(c, inv_table, brightness, contrast, saturation);
+ if (c->flags & SWS_CPU_CAPS_ALTIVEC)
+ yuv2rgb_altivec_init_tables (c, inv_table, brightness, contrast, saturation);
#endif
- return 0;
+ return 0;
}
/**
* @return -1 if not supported
*/
-int sws_getColorspaceDetails(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;
+int sws_getColorspaceDetails(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;
- *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;
+ return 0;
}
// Be carefull when you modify SwsContext after returning from sws_getContext.
// SwsContext is copied to array for multithreading.
// sws_scale_ordered modify c->sliceDir. It does not matter for now.
SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int dstH, int origDstFormat, SwsParams *params,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const int yuv2rgbTable[6])
-{
- return sws_getContextEx(srcW, srcH, origSrcFormat, dstW, dstH, origDstFormat, params,
- srcFilter, dstFilter, yuv2rgbTable, GetCPUCount());
+ SwsFilter *srcFilter, SwsFilter *dstFilter, const int yuv2rgbTable[6]){
+ return sws_getContextEx(srcW, srcH, origSrcFormat, dstW, dstH, origDstFormat, params,
+ srcFilter, dstFilter, yuv2rgbTable, GetCPUCount());
}
SwsContext *sws_getContextEx(int srcW, int srcH, int origSrcFormat, int dstW, int dstH, int origDstFormat, SwsParams *params,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const int yuv2rgbTable[6], int threadCount)
-{
-
- SwsContext *c;
- int i;
- int usesVFilter, usesHFilter;
- int unscaled, needsDither;
- int srcFormat, dstFormat;
- SwsFilter dummyFilter = {NULL, NULL, NULL, NULL};
+ SwsFilter *srcFilter, SwsFilter *dstFilter, const int yuv2rgbTable[6], int threadCount){
+
+ SwsContext *c;
+ int i;
+ int usesVFilter, usesHFilter;
+ int unscaled, needsDither;
+ int srcFormat, dstFormat;
+ SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if ARCH_X86_32 || ARCH_X86_64
- if(params->cpu & SWS_CPU_CAPS_MMX)
- asm volatile("emms\n\t"::: "memory");
+ if(params->cpu & SWS_CPU_CAPS_MMX)
+ asm volatile("emms\n\t"::: "memory");
#else
- params->cpu = 0;
+ params->cpu=0;
#endif
#ifndef RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
- flags &= ~(SWS_CPU_CAPS_MMX | SWS_CPU_CAPS_MMX2 | SWS_CPU_CAPS_3DNOW | SWS_CPU_CAPS_ALTIVEC);
+ flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC);
#if HAVE_MMX2
- flags |= SWS_CPU_CAPS_MMX | SWS_CPU_CAPS_MMX2;
+ flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
#elif HAVE_AMD3DNOW
- flags |= SWS_CPU_CAPS_MMX | SWS_CPU_CAPS_3DNOW;
+ flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW;
#elif HAVE_MMX
- flags |= SWS_CPU_CAPS_MMX;
+ flags |= SWS_CPU_CAPS_MMX;
#elif defined (HAVE_ALTIVEC)
- flags |= SWS_CPU_CAPS_ALTIVEC;
+ flags |= SWS_CPU_CAPS_ALTIVEC;
#endif
#endif /* RUNTIME_CPUDETECT */
- if(clip_table[512] != 255) globalInit();
- if(rgb15to16 == NULL) sws_rgb2rgb_init(params);
-
- /* avoid duplicate Formats, so we don't need to check to much */
- srcFormat = remove_dup_fourcc(origSrcFormat);
- dstFormat = remove_dup_fourcc(origDstFormat);
-
- unscaled = (srcW == dstW && srcH == dstH);
- needsDither = (isBGR(dstFormat) || isRGB(dstFormat))
- && (dstFormat & 0xFF) < 24
- && ((dstFormat & 0xFF) < (srcFormat & 0xFF) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
-
- if(!isSupportedIn(srcFormat))
- {
- MSG_ERR("swScaler: %s is not supported as input format\n", sws_format_name(srcFormat));
- return NULL;
- }
- if(!isSupportedOut(dstFormat))
- {
- MSG_ERR("swScaler: %s is not supported as output format\n", sws_format_name(dstFormat));
- return NULL;
- }
-
- /* 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
- {
- MSG_ERR("swScaler: %dx%d -> %dx%d is invalid scaling dimension\n",
- srcW, srcH, dstW, dstH);
- return NULL;
- }
-
- if(!dstFilter) dstFilter = &dummyFilter;
- if(!srcFilter) srcFilter = &dummyFilter;
-
- c = av_malloc(sizeof(SwsContext) * threadCount); // array support up to c[threadCount-1]. "c->" is identical to "c[0]."
- memset(c, 0, sizeof(SwsContext));
-
- c->srcW = srcW;
- c->srcH = srcH;
- c->dstW = dstW;
- c->dstH = dstH;
- c->lumXInc = ((srcW << 16) + (dstW >> 1)) / dstW;
- c->lumYInc = ((srcH << 16) + (dstH >> 1)) / dstH;
- c->params = *params;
- c->dstFormat = dstFormat;
- c->srcFormat = srcFormat;
- c->origDstFormat = origDstFormat;
- c->origSrcFormat = origSrcFormat;
- c->vRounder = 4 * 0x0001000100010001ULL;
-
- usesHFilter = usesVFilter = 0;
- if(dstFilter->lumV != NULL && dstFilter->lumV->length > 1) usesVFilter = 1;
- if(dstFilter->lumH != NULL && dstFilter->lumH->length > 1) usesHFilter = 1;
- if(dstFilter->chrV != NULL && dstFilter->chrV->length > 1) usesVFilter = 1;
- if(dstFilter->chrH != NULL && dstFilter->chrH->length > 1) usesHFilter = 1;
- if(srcFilter->lumV != NULL && srcFilter->lumV->length > 1) usesVFilter = 1;
- if(srcFilter->lumH != NULL && srcFilter->lumH->length > 1) usesHFilter = 1;
- if(srcFilter->chrV != NULL && srcFilter->chrV->length > 1) usesVFilter = 1;
- if(srcFilter->chrH != NULL && srcFilter->chrH->length > 1) usesHFilter = 1;
-
- getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
- getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
-
- // reuse chroma for 2 pixles rgb/bgr unless user wants full chroma interpolation
- if((isBGR(dstFormat) || isRGB(dstFormat)) && !(params->subsampling & SWS_FULL_CHR_H_INT)) c->chrDstHSubSample = 1;
-
- // drop some chroma lines if the user wants it
- c->vChrDrop = params->v_chr_drop; // (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
- c->chrSrcVSubSample += c->vChrDrop;
-
- // drop every 2. pixel for chroma calculation unless user wants full chroma
- if((isBGR(srcFormat) || isRGB(srcFormat)) && !(params->subsampling & SWS_FULL_CHR_H_INP))
- c->chrSrcHSubSample = 1;
-
- //c->chrIntHSubSample= c->chrDstHSubSample;
- //c->chrIntVSubSample= c->chrSrcVSubSample;
-
- // note the -((-x)>>y) is so that we allways round toward +inf
- c->chrSrcW = -((-srcW) >> c->chrSrcHSubSample);
- c->chrSrcH = -((-srcH) >> c->chrSrcVSubSample);
- c->chrDstW = -((-dstW) >> c->chrDstHSubSample);
- c->chrDstH = -((-dstH) >> c->chrDstVSubSample);
-
- sws_setColorspaceDetails(c, yuv2rgbTable ? yuv2rgbTable : Inverse_Table_6_9[SWS_CS_DEFAULT], 0, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, 0, 0, 1 << 16, 1 << 16);
-
- /* unscaled special Cases */
- if(unscaled && !usesHFilter && !usesVFilter)
- {
- /* yv12_to_nv12 */
- if(srcFormat == IMGFMT_YV12 && (dstFormat == IMGFMT_NV12 || dstFormat == IMGFMT_NV21))
- {
- c->swScale = PlanarToNV12Wrapper;
- }
- if((srcFormat == IMGFMT_NV12 || srcFormat == IMGFMT_NV21) && dstFormat == IMGFMT_YV12)
- {
- c->swScale = NV12ToPlanarWrapper;
- }
- /* yuv2bgr */
- if((srcFormat == IMGFMT_YV12 || srcFormat == IMGFMT_422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
- {
- c->swScale = yuv2rgb_get_func_ptr(c);
- }
-
- if(srcFormat == IMGFMT_YVU9 && dstFormat == IMGFMT_YV12)
- {
- c->swScale = yvu9toyv12Wrapper;
- }
-
- /* bgr24toYV12 */
- if(srcFormat == IMGFMT_BGR24 && dstFormat == IMGFMT_YV12)
- c->swScale = bgr24toyv12Wrapper;
-
- /* rgb/bgr -> rgb/bgr (no dither needed forms) */
- if((isBGR(srcFormat) || isRGB(srcFormat))
- && (isBGR(dstFormat) || isRGB(dstFormat))
- && !needsDither)
- c->swScale = rgb2rgbWrapper;
-
- /* LQ converters if -sws 0 or -sws 4*/
- if(c->params.methodLuma.method&(SWS_FAST_BILINEAR | SWS_POINT) && c->params.methodChroma.method&(SWS_FAST_BILINEAR | SWS_POINT))
- {
- /* rgb/bgr -> rgb/bgr (dither needed forms) */
- if((isBGR(srcFormat) || isRGB(srcFormat))
- && (isBGR(dstFormat) || isRGB(dstFormat))
- && needsDither)
- c->swScale = rgb2rgbWrapper;
-
- /* yv12_to_yuy2 */
- if(srcFormat == IMGFMT_YV12 &&
- (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY || dstFormat == IMGFMT_YVYU || dstFormat == IMGFMT_VYUY))
- {
- if(dstFormat == IMGFMT_YUY2)
- c->swScale = PlanarToYuy2Wrapper;
- else if(dstFormat == IMGFMT_UYVY)
- c->swScale = PlanarToUyvyWrapper;
- else if(dstFormat == IMGFMT_VYUY)
- c->swScale = PlanarToVyuyWrapper;
- else
- c->swScale = PlanarToYvyuWrapper;
- }
- }
+ if(clip_table[512] != 255) globalInit();
+ if(rgb15to16 == NULL) sws_rgb2rgb_init(params);
+
+ /* avoid duplicate Formats, so we don't need to check to much */
+ srcFormat = remove_dup_fourcc(origSrcFormat);
+ dstFormat = remove_dup_fourcc(origDstFormat);
+
+ unscaled = (srcW == dstW && srcH == dstH);
+ needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
+ && (dstFormat&0xFF)<24
+ && ((dstFormat&0xFF)<(srcFormat&0xFF) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
+
+ if(!isSupportedIn(srcFormat))
+ {
+ MSG_ERR("swScaler: %s is not supported as input format\n", sws_format_name(srcFormat));
+ return NULL;
+ }
+ if(!isSupportedOut(dstFormat))
+ {
+ MSG_ERR("swScaler: %s is not supported as output format\n", sws_format_name(dstFormat));
+ return NULL;
+ }
+
+ /* 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
+ {
+ MSG_ERR("swScaler: %dx%d -> %dx%d is invalid scaling dimension\n",
+ srcW, srcH, dstW, dstH);
+ return NULL;
+ }
+
+ if(!dstFilter) dstFilter= &dummyFilter;
+ if(!srcFilter) srcFilter= &dummyFilter;
+
+ c= av_malloc(sizeof(SwsContext)*threadCount); // array support up to c[threadCount-1]. "c->" is identical to "c[0]."
+ memset(c, 0, sizeof(SwsContext));
+
+ c->srcW= srcW;
+ c->srcH= srcH;
+ c->dstW= dstW;
+ c->dstH= dstH;
+ c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;
+ c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;
+ c->params= *params;
+ c->dstFormat= dstFormat;
+ c->srcFormat= srcFormat;
+ c->origDstFormat= origDstFormat;
+ c->origSrcFormat= origSrcFormat;
+ c->vRounder= 4* 0x0001000100010001ULL;
+
+ usesHFilter= usesVFilter= 0;
+ if(dstFilter->lumV!=NULL && dstFilter->lumV->length>1) usesVFilter=1;
+ if(dstFilter->lumH!=NULL && dstFilter->lumH->length>1) usesHFilter=1;
+ if(dstFilter->chrV!=NULL && dstFilter->chrV->length>1) usesVFilter=1;
+ if(dstFilter->chrH!=NULL && dstFilter->chrH->length>1) usesHFilter=1;
+ if(srcFilter->lumV!=NULL && srcFilter->lumV->length>1) usesVFilter=1;
+ if(srcFilter->lumH!=NULL && srcFilter->lumH->length>1) usesHFilter=1;
+ if(srcFilter->chrV!=NULL && srcFilter->chrV->length>1) usesVFilter=1;
+ if(srcFilter->chrH!=NULL && srcFilter->chrH->length>1) usesHFilter=1;
+
+ getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
+ getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
+
+ // reuse chroma for 2 pixles rgb/bgr unless user wants full chroma interpolation
+ if((isBGR(dstFormat) || isRGB(dstFormat)) && !(params->subsampling&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
+
+ // drop some chroma lines if the user wants it
+ c->vChrDrop= params->v_chr_drop;// (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
+ c->chrSrcVSubSample+= c->vChrDrop;
+
+ // drop every 2. pixel for chroma calculation unless user wants full chroma
+ if((isBGR(srcFormat) || isRGB(srcFormat)) && !(params->subsampling&SWS_FULL_CHR_H_INP))
+ c->chrSrcHSubSample=1;
+
+ //c->chrIntHSubSample= c->chrDstHSubSample;
+ //c->chrIntVSubSample= c->chrSrcVSubSample;
+
+ // note the -((-x)>>y) is so that we allways round toward +inf
+ c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
+ c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
+ c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
+ c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
+
+ sws_setColorspaceDetails(c, yuv2rgbTable ? yuv2rgbTable : Inverse_Table_6_9[SWS_CS_DEFAULT], 0, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, 0, 0, 1<<16, 1<<16);
+
+ /* unscaled special Cases */
+ if(unscaled && !usesHFilter && !usesVFilter)
+ {
+ /* yv12_to_nv12 */
+ if(srcFormat == IMGFMT_YV12 && (dstFormat == IMGFMT_NV12 || dstFormat == IMGFMT_NV21))
+ {
+ c->swScale= PlanarToNV12Wrapper;
+ }
+ if((srcFormat == IMGFMT_NV12 || srcFormat == IMGFMT_NV21) && dstFormat == IMGFMT_YV12)
+ {
+ c->swScale= NV12ToPlanarWrapper;
+ }
+ /* yuv2bgr */
+ if((srcFormat==IMGFMT_YV12 || srcFormat==IMGFMT_422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
+ {
+ c->swScale= yuv2rgb_get_func_ptr(c);
+ }
+
+ if( srcFormat==IMGFMT_YVU9 && dstFormat==IMGFMT_YV12 )
+ {
+ c->swScale= yvu9toyv12Wrapper;
+ }
+
+ /* bgr24toYV12 */
+ if(srcFormat==IMGFMT_BGR24 && dstFormat==IMGFMT_YV12)
+ c->swScale= bgr24toyv12Wrapper;
+
+ /* rgb/bgr -> rgb/bgr (no dither needed forms) */
+ if( (isBGR(srcFormat) || isRGB(srcFormat))
+ && (isBGR(dstFormat) || isRGB(dstFormat))
+ && !needsDither)
+ c->swScale= rgb2rgbWrapper;
+
+ /* LQ converters if -sws 0 or -sws 4*/
+ if(c->params.methodLuma.method&(SWS_FAST_BILINEAR|SWS_POINT) && c->params.methodChroma.method&(SWS_FAST_BILINEAR|SWS_POINT)){
+ /* rgb/bgr -> rgb/bgr (dither needed forms) */
+ if( (isBGR(srcFormat) || isRGB(srcFormat))
+ && (isBGR(dstFormat) || isRGB(dstFormat))
+ && needsDither)
+ c->swScale= rgb2rgbWrapper;
+
+ /* yv12_to_yuy2 */
+ if(srcFormat == IMGFMT_YV12 &&
+ (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY || dstFormat == IMGFMT_YVYU || dstFormat== IMGFMT_VYUY))
+ {
+ if (dstFormat == IMGFMT_YUY2)
+ c->swScale= PlanarToYuy2Wrapper;
+ else if (dstFormat == IMGFMT_UYVY)
+ c->swScale= PlanarToUyvyWrapper;
+ else if (dstFormat == IMGFMT_VYUY)
+ c->swScale= PlanarToVyuyWrapper;
+ else
+ c->swScale= PlanarToYvyuWrapper;
+ }
+ }
#ifdef COMPILE_ALTIVEC
- if((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
- ((srcFormat == IMGFMT_YV12 &&
- (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY))))
- {
- // unscaled YV12 -> packed YUV, we want speed
- if(dstFormat == IMGFMT_YUY2)
- c->swScale = yv12toyuy2_unscaled_altivec;
- else
- c->swScale = yv12touyvy_unscaled_altivec;
- }
+ if ((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
+ ((srcFormat == IMGFMT_YV12 &&
+ (dstFormat == IMGFMT_YUY2 || dstFormat == IMGFMT_UYVY)))) {
+ // unscaled YV12 -> packed YUV, we want speed
+ if (dstFormat == IMGFMT_YUY2)
+ c->swScale= yv12toyuy2_unscaled_altivec;
+ else
+ c->swScale= yv12touyvy_unscaled_altivec;
+ }
#endif
- /* simple copy */
- if(srcFormat == dstFormat
- || (isPlanarYUV(srcFormat) && isGray(dstFormat))
- || (isPlanarYUV(dstFormat) && isGray(srcFormat))
- )
- {
- c->swScale = simpleCopy;
- }
-
- if(c->swScale)
- {
- if(params->debug & SWS_PRINT_INFO)
- MSG_INFO("SwScaler: using unscaled %s -> %s special converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- return c;
- }
- }
-
- if(params->cpu & SWS_CPU_CAPS_MMX2)
- {
- c->canMMX2BeUsed = (dstW >= srcW && (dstW & 31) == 0 && (srcW & 15) == 0) ? 1 : 0;
- if(!c->canMMX2BeUsed && dstW >= srcW && (srcW & 15) == 0 && (params->methodLuma.method & SWS_FAST_BILINEAR))
- {
- if(params->debug & SWS_PRINT_INFO)
- MSG_INFO("SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
- }
- if(usesHFilter) c->canMMX2BeUsed = 0;
- }
- else
- c->canMMX2BeUsed = 0;
-
- c->chrXInc = ((c->chrSrcW << 16) + (c->chrDstW >> 1)) / c->chrDstW;
- c->chrYInc = ((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 noone shuld 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(params->methodLuma.method & SWS_FAST_BILINEAR)
- {
- if(c->canMMX2BeUsed)
+ /* simple copy */
+ if( srcFormat == dstFormat
+ || (isPlanarYUV(srcFormat) && isGray(dstFormat))
+ || (isPlanarYUV(dstFormat) && isGray(srcFormat))
+ )
+ {
+ c->swScale= simpleCopy;
+ }
+
+ if(c->swScale){
+ if(params->debug&SWS_PRINT_INFO)
+ MSG_INFO("SwScaler: using unscaled %s -> %s special converter\n",
+ sws_format_name(srcFormat), sws_format_name(dstFormat));
+ return c;
+ }
+ }
+
+ if(params->cpu & SWS_CPU_CAPS_MMX2)
+ {
+ c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
+ if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (params->methodLuma.method&SWS_FAST_BILINEAR))
+ {
+ if(params->debug&SWS_PRINT_INFO)
+ MSG_INFO("SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
+ }
+ if(usesHFilter) c->canMMX2BeUsed=0;
+ }
+ else
+ c->canMMX2BeUsed=0;
+
+ c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
+ c->chrYInc= ((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 noone shuld 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(params->methodLuma.method&SWS_FAST_BILINEAR)
+ {
+ if(c->canMMX2BeUsed)
+ {
+ c->lumXInc = ((srcW-2)<<16)/(dstW);
+ }
+ //we don't use the x86asm scaler if mmx is available
+ else if(params->cpu& SWS_CPU_CAPS_MMX)
+ {
+ c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
+ }
+ else
+ c->lumXInc = ((srcW-2)<<16)/(dstW);
+ }
+
+ if(params->methodChroma.method&SWS_FAST_BILINEAR)
{
- c->lumXInc = ((srcW - 2) << 16) / (dstW);
- }
- //we don't use the x86asm scaler if mmx is available
- else if(params->cpu & SWS_CPU_CAPS_MMX)
- {
- c->lumXInc = ((srcW - 2) << 16) / (dstW - 2) - 20;
+ if(c->canMMX2BeUsed)
+ {
+ c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW);
+ }
+ //we don't use the x86asm scaler if mmx is available
+ else if(params->cpu& SWS_CPU_CAPS_MMX)
+ {
+ c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
+ }
+ else
+ c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW);
}
- else
- c->lumXInc = ((srcW - 2) << 16) / (dstW);
- }
- if(params->methodChroma.method & SWS_FAST_BILINEAR)
- {
- if(c->canMMX2BeUsed)
- {
- c->chrXInc = ((c->chrSrcW - 2) << 16) / (c->chrDstW);
- }
- //we don't use the x86asm scaler if mmx is available
- else if(params->cpu & SWS_CPU_CAPS_MMX)
- {
- c->chrXInc = ((c->chrSrcW - 2) << 16) / (c->chrDstW - 2) - 20;
- }
- else
- c->chrXInc = ((c->chrSrcW - 2) << 16) / (c->chrDstW);
- }
-
- /* precalculate horizontal scaler filter coefficients */
- {
- const int filterAlign =
- (params->cpu & SWS_CPU_CAPS_MMX) ? 4 :
- (params->cpu & SWS_CPU_CAPS_ALTIVEC) ? 8 :
- 1;
-
- initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
- srcW , dstW, filterAlign, 1 << 14,
- /*(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags*/&params->methodLuma, params->subsampling, params->cpu, params->debug,
- srcFilter->lumH, dstFilter->lumH);
- initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
- c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,
- /*(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags*/&params->methodChroma, params->subsampling, params->cpu, params->debug,
- srcFilter->chrH, dstFilter->chrH);
+ /* precalculate horizontal scaler filter coefficients */
+ {
+ const int filterAlign=
+ (params->cpu & SWS_CPU_CAPS_MMX) ? 4 :
+ (params->cpu & SWS_CPU_CAPS_ALTIVEC) ? 8 :
+ 1;
+
+ initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
+ srcW , dstW, filterAlign, 1<<14,
+ /*(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags*/&params->methodLuma,params->subsampling,params->cpu,params->debug,
+ srcFilter->lumH, dstFilter->lumH);
+ initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
+ c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
+ /*(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags*/&params->methodChroma,params->subsampling,params->cpu,params->debug,
+ srcFilter->chrH, dstFilter->chrH);
#if ARCH_X86 || ARCH_X86_64
// can't downscale !!!
#define MAX_FUNNY_CODE_SIZE 10000
- if(c->canMMX2BeUsed && (params->methodLuma.method & SWS_FAST_BILINEAR))
- {
+ if(c->canMMX2BeUsed && (params->methodLuma.method & SWS_FAST_BILINEAR))
+ {
#ifdef HAVE_SYS_MMAN_H
- c->funnyYCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ c->funnyYCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
#else
- c->funnyYCode = (uint8_t*)VirtualAlloc(NULL, MAX_FUNNY_CODE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE); //memalign(32, MAX_FUNNY_CODE_SIZE);
+ c->funnyYCode = (uint8_t*)VirtualAlloc(NULL,MAX_FUNNY_CODE_SIZE,MEM_COMMIT,PAGE_EXECUTE_READWRITE); //memalign(32, MAX_FUNNY_CODE_SIZE);
#endif
- c->lumMmx2Filter = av_malloc((dstW / 8 + 8) * sizeof(int16_t));
- c->lumMmx2FilterPos = av_malloc((dstW / 2 / 8 + 8) * sizeof(int32_t));
+ c->lumMmx2Filter = av_malloc((dstW /8+8)*sizeof(int16_t));
+ c->lumMmx2FilterPos= av_malloc((dstW /2/8+8)*sizeof(int32_t));
- initMMX2HScaler(dstW, c->lumXInc, c->funnyYCode , c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
- }
- if(c->canMMX2BeUsed && (params->methodChroma.method & SWS_FAST_BILINEAR))
- {
+ initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode , c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
+ }
+ if(c->canMMX2BeUsed && (params->methodChroma.method & SWS_FAST_BILINEAR))
+ {
#ifdef HAVE_SYS_MMAN_H
- c->funnyUVCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ c->funnyUVCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
#else
- c->funnyUVCode = (uint8_t*)VirtualAlloc(NULL, MAX_FUNNY_CODE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE); //memalign(32, MAX_FUNNY_CODE_SIZE);
+ c->funnyUVCode = (uint8_t*)VirtualAlloc(NULL,MAX_FUNNY_CODE_SIZE,MEM_COMMIT,PAGE_EXECUTE_READWRITE); //memalign(32, MAX_FUNNY_CODE_SIZE);
#endif
- c->chrMmx2Filter = av_malloc((c->chrDstW / 4 + 8) * sizeof(int16_t));
- c->chrMmx2FilterPos = av_malloc((c->chrDstW / 2 / 4 + 8) * sizeof(int32_t));
+ c->chrMmx2Filter = av_malloc((c->chrDstW /4+8)*sizeof(int16_t));
+ c->chrMmx2FilterPos= av_malloc((c->chrDstW/2/4+8)*sizeof(int32_t));
- initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
- }
+ initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
+ }
#endif /* ARCH_X86 || ARCH_X86_64 */
- } // Init Horizontal stuff
-
+ } // Init Horizontal stuff
- /* precalculate vertical scaler filter coefficients */
- {
- const int filterAlign =
- (params->cpu & SWS_CPU_CAPS_MMX) && (params->subsampling & SWS_ACCURATE_RND) ? 2 :
- (params->cpu & SWS_CPU_CAPS_ALTIVEC) ? 8 :
- 1;
-
- initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
- srcH , dstH, filterAlign, (1 << 12) - 4,
- /*(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags*/&params->methodLuma, params->subsampling, params->cpu, params->debug,
- srcFilter->lumV, dstFilter->lumV);
- initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
- c->chrSrcH, c->chrDstH, filterAlign, (1 << 12) - 4,
- /*(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags*/&params->methodChroma, params->subsampling, params->cpu, params->debug,
- srcFilter->chrV, dstFilter->chrV);
-#ifdef HAVE_ALTIVEC
- c->vYCoeffsBank = av_malloc(sizeof(vector signed short) * c->vLumFilterSize * c->dstH);
- c->vCCoeffsBank = av_malloc(sizeof(vector signed short) * c->vChrFilterSize * c->chrDstH);
+ /* precalculate vertical scaler filter coefficients */
+ {
+ const int filterAlign=
+ (params->cpu & SWS_CPU_CAPS_MMX) && (params->subsampling & SWS_ACCURATE_RND) ? 2 :
+ (params->cpu & SWS_CPU_CAPS_ALTIVEC) ? 8 :
+ 1;
- for(i = 0; i < c->vLumFilterSize * c->dstH; i++)
- {
- int j;
- short *p = (short *)&c->vYCoeffsBank[i];
- for(j = 0; j < 8; j++)
- p[j] = c->vLumFilter[i];
- }
+ initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
+ srcH , dstH, filterAlign, (1<<12)-4,
+ /*(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags*/&params->methodLuma,params->subsampling,params->cpu,params->debug,
+ srcFilter->lumV, dstFilter->lumV);
+ initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
+ c->chrSrcH, c->chrDstH, filterAlign, (1<<12)-4,
+ /*(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags*/&params->methodChroma,params->subsampling,params->cpu,params->debug,
+ srcFilter->chrV, dstFilter->chrV);
- for(i = 0; i < c->vChrFilterSize * c->chrDstH; i++)
- {
- int j;
- short *p = (short *)&c->vCCoeffsBank[i];
- for(j = 0; j < 8; j++)
- p[j] = c->vChrFilter[i];
- }
+#ifdef HAVE_ALTIVEC
+ c->vYCoeffsBank = av_malloc(sizeof (vector signed short)*c->vLumFilterSize*c->dstH);
+ c->vCCoeffsBank = av_malloc(sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH);
+
+ for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
+ int j;
+ short *p = (short *)&c->vYCoeffsBank[i];
+ for (j=0;j<8;j++)
+ p[j] = c->vLumFilter[i];
+ }
+
+ for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
+ int j;
+ short *p = (short *)&c->vCCoeffsBank[i];
+ 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 = 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];
- }
-
- ASSERT(c->chrDstH <= dstH)
-
- if(params->debug & SWS_PRINT_INFO)
- {
+ }
+
+ // 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= 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];
+ }
+
+ ASSERT(c->chrDstH <= dstH)
+
+ if(params->debug&SWS_PRINT_INFO)
+ {
#ifdef DITHER1XBPP
- char *dither = " dithered";
+ char *dither= " dithered";
#else
- char *dither = "";
+ char *dither= "";
#endif
- if(params->methodLuma.method & SWS_FAST_BILINEAR)
- MSG_INFO("\nSwScaler: luma FAST_BILINEAR scaler, ");
- else if(params->methodLuma.method & SWS_BILINEAR)
- MSG_INFO("\nSwScaler: luma BILINEAR scaler, ");
- else if(params->methodLuma.method & SWS_BICUBIC)
- MSG_INFO("\nSwScaler: luma BICUBIC scaler, ");
- else if(params->methodLuma.method & SWS_X)
- MSG_INFO("\nSwScaler: luma Experimental scaler, ");
- else if(params->methodLuma.method & SWS_POINT)
- MSG_INFO("\nSwScaler: luma Nearest Neighbor / POINT scaler, ");
- else if(params->methodLuma.method & SWS_AREA)
- MSG_INFO("\nSwScaler: luma Area Averageing scaler, ");
- else if(params->methodLuma.method & SWS_GAUSS)
- MSG_INFO("\nSwScaler: luma Gaussian scaler, ");
- else if(params->methodLuma.method & SWS_SINC)
- MSG_INFO("\nSwScaler: luma Sinc scaler, ");
- else if(params->methodLuma.method & SWS_LANCZOS)
- MSG_INFO("\nSwScaler: luma Lanczos scaler, ");
- else if(params->methodLuma.method & SWS_SPLINE)
- MSG_INFO("\nSwScaler: luma Bicubic spline scaler, ");
- else
- MSG_INFO("\nSwScaler: luma ehh flags invalid?! ");
-
- if(params->methodLuma.method != params->methodChroma.method)
- if(params->methodChroma.method & SWS_FAST_BILINEAR)
- MSG_INFO("\nSwScaler: chroma FAST_BILINEAR scaler, ");
- else if(params->methodChroma.method & SWS_BILINEAR)
- MSG_INFO("\nSwScaler: chroma BILINEAR scaler, ");
- else if(params->methodChroma.method & SWS_BICUBIC)
- MSG_INFO("\nSwScaler: chroma BICUBIC scaler, ");
- else if(params->methodChroma.method & SWS_X)
- MSG_INFO("\nSwScaler: chroma Experimental scaler, ");
- else if(params->methodChroma.method & SWS_POINT)
- MSG_INFO("\nSwScaler: chroma Nearest Neighbor / POINT scaler, ");
- else if(params->methodChroma.method & SWS_AREA)
- MSG_INFO("\nSwScaler: chroma Area Averageing scaler, ");
- else if(params->methodChroma.method & SWS_GAUSS)
- MSG_INFO("\nSwScaler: chroma Gaussian scaler, ");
- else if(params->methodChroma.method & SWS_SINC)
- MSG_INFO("\nSwScaler: chroma Sinc scaler, ");
- else if(params->methodChroma.method & SWS_LANCZOS)
- MSG_INFO("\nSwScaler: chroma Lanczos scaler, ");
- else if(params->methodChroma.method & SWS_SPLINE)
- MSG_INFO("\nSwScaler: chroma Bicubic spline scaler, ");
- else
- MSG_INFO("\nSwScaler: chroma ehh flags invalid?! ");
-
- if(dstFormat == IMGFMT_BGR15 || dstFormat == IMGFMT_BGR16)
- MSG_INFO("from %s to%s %s ",
- sws_format_name(srcFormat), dither, sws_format_name(dstFormat));
- else
- MSG_INFO("from %s to %s ",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
-
- if(params->cpu & SWS_CPU_CAPS_MMX2)
- MSG_INFO("using MMX2\n");
- else if(params->cpu & SWS_CPU_CAPS_3DNOW)
- MSG_INFO("using 3DNOW\n");
- else if(params->cpu & SWS_CPU_CAPS_MMX)
- MSG_INFO("using MMX\n");
- else if(params->cpu & SWS_CPU_CAPS_ALTIVEC)
- MSG_INFO("using AltiVec\n");
- else
- MSG_INFO("using C\n");
- }
-
- if(params->debug & SWS_PRINT_INFO)
- {
- if(params->cpu & SWS_CPU_CAPS_MMX)
- {
- if(c->canMMX2BeUsed && (params->methodLuma.method & SWS_FAST_BILINEAR) && (params->methodChroma.method & SWS_FAST_BILINEAR))
- MSG_V("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
- else
- {
- if(c->hLumFilterSize == 4)
- MSG_V("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
- else if(c->hLumFilterSize == 8)
- MSG_V("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
- else
- MSG_V("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
-
- if(c->hChrFilterSize == 4)
- MSG_V("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
- else if(c->hChrFilterSize == 8)
- MSG_V("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
- else
- MSG_V("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
- }
- }
- else
- {
+ if(params->methodLuma.method&SWS_FAST_BILINEAR)
+ MSG_INFO("\nSwScaler: luma FAST_BILINEAR scaler, ");
+ else if(params->methodLuma.method&SWS_BILINEAR)
+ MSG_INFO("\nSwScaler: luma BILINEAR scaler, ");
+ else if(params->methodLuma.method&SWS_BICUBIC)
+ MSG_INFO("\nSwScaler: luma BICUBIC scaler, ");
+ else if(params->methodLuma.method&SWS_X)
+ MSG_INFO("\nSwScaler: luma Experimental scaler, ");
+ else if(params->methodLuma.method&SWS_POINT)
+ MSG_INFO("\nSwScaler: luma Nearest Neighbor / POINT scaler, ");
+ else if(params->methodLuma.method&SWS_AREA)
+ MSG_INFO("\nSwScaler: luma Area Averageing scaler, ");
+ else if(params->methodLuma.method&SWS_GAUSS)
+ MSG_INFO("\nSwScaler: luma Gaussian scaler, ");
+ else if(params->methodLuma.method&SWS_SINC)
+ MSG_INFO("\nSwScaler: luma Sinc scaler, ");
+ else if(params->methodLuma.method&SWS_LANCZOS)
+ MSG_INFO("\nSwScaler: luma Lanczos scaler, ");
+ else if(params->methodLuma.method&SWS_SPLINE)
+ MSG_INFO("\nSwScaler: luma Bicubic spline scaler, ");
+ else
+ MSG_INFO("\nSwScaler: luma ehh flags invalid?! ");
+
+ if(params->methodLuma.method!=params->methodChroma.method)
+ if(params->methodChroma.method&SWS_FAST_BILINEAR)
+ MSG_INFO("\nSwScaler: chroma FAST_BILINEAR scaler, ");
+ else if(params->methodChroma.method&SWS_BILINEAR)
+ MSG_INFO("\nSwScaler: chroma BILINEAR scaler, ");
+ else if(params->methodChroma.method&SWS_BICUBIC)
+ MSG_INFO("\nSwScaler: chroma BICUBIC scaler, ");
+ else if(params->methodChroma.method&SWS_X)
+ MSG_INFO("\nSwScaler: chroma Experimental scaler, ");
+ else if(params->methodChroma.method&SWS_POINT)
+ MSG_INFO("\nSwScaler: chroma Nearest Neighbor / POINT scaler, ");
+ else if(params->methodChroma.method&SWS_AREA)
+ MSG_INFO("\nSwScaler: chroma Area Averageing scaler, ");
+ else if(params->methodChroma.method&SWS_GAUSS)
+ MSG_INFO("\nSwScaler: chroma Gaussian scaler, ");
+ else if(params->methodChroma.method&SWS_SINC)
+ MSG_INFO("\nSwScaler: chroma Sinc scaler, ");
+ else if(params->methodChroma.method&SWS_LANCZOS)
+ MSG_INFO("\nSwScaler: chroma Lanczos scaler, ");
+ else if(params->methodChroma.method&SWS_SPLINE)
+ MSG_INFO("\nSwScaler: chroma Bicubic spline scaler, ");
+ else
+ MSG_INFO("\nSwScaler: chroma ehh flags invalid?! ");
+
+ if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16)
+ MSG_INFO("from %s to%s %s ",
+ sws_format_name(srcFormat), dither, sws_format_name(dstFormat));
+ else
+ MSG_INFO("from %s to %s ",
+ sws_format_name(srcFormat), sws_format_name(dstFormat));
+
+ if(params->cpu & SWS_CPU_CAPS_MMX2)
+ MSG_INFO("using MMX2\n");
+ else if(params->cpu & SWS_CPU_CAPS_3DNOW)
+ MSG_INFO("using 3DNOW\n");
+ else if(params->cpu & SWS_CPU_CAPS_MMX)
+ MSG_INFO("using MMX\n");
+ else if(params->cpu & SWS_CPU_CAPS_ALTIVEC)
+ MSG_INFO("using AltiVec\n");
+ else
+ MSG_INFO("using C\n");
+ }
+
+ if(params->debug & SWS_PRINT_INFO)
+ {
+ if(params->cpu & SWS_CPU_CAPS_MMX)
+ {
+ if(c->canMMX2BeUsed && (params->methodLuma.method&SWS_FAST_BILINEAR) && (params->methodChroma.method&SWS_FAST_BILINEAR))
+ MSG_V("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
+ else
+ {
+ if(c->hLumFilterSize==4)
+ MSG_V("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
+ else if(c->hLumFilterSize==8)
+ MSG_V("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
+ else
+ MSG_V("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
+
+ if(c->hChrFilterSize==4)
+ MSG_V("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
+ else if(c->hChrFilterSize==8)
+ MSG_V("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
+ else
+ MSG_V("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
+ }
+ }
+ else
+ {
#if ARCH_X86_32 || ARCH_X86_64
- MSG_V("SwScaler: using X86-Asm scaler for horizontal scaling\n");
+ MSG_V("SwScaler: using X86-Asm scaler for horizontal scaling\n");
#else
- if((params->methodLuma.method & SWS_FAST_BILINEAR) && (params->methodChroma.method & SWS_FAST_BILINEAR))
- MSG_V("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
- else
- MSG_V("SwScaler: using C scaler for horizontal scaling\n");
+ if((params->methodLuma.method & SWS_FAST_BILINEAR) && (params->methodChroma.method & SWS_FAST_BILINEAR))
+ MSG_V("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
+ else
+ MSG_V("SwScaler: using C scaler for horizontal scaling\n");
#endif
- }
- if(isPlanarYUV(dstFormat))
- {
- if(c->vLumFilterSize == 1)
- MSG_V("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else
- MSG_V("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- }
- else
- {
- if(c->vLumFilterSize == 1 && c->vChrFilterSize == 2)
- MSG_V("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
- "SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if(c->vLumFilterSize == 2 && c->vChrFilterSize == 2)
- MSG_V("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else
- MSG_V("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- }
-
- if(dstFormat == IMGFMT_BGR24)
- MSG_V("SwScaler: using %s YV12->BGR24 Converter\n",
- (flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
- else if(dstFormat == IMGFMT_BGR32)
- MSG_V("SwScaler: using %s YV12->BGR32 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if(dstFormat == IMGFMT_BGR16)
- MSG_V("SwScaler: using %s YV12->BGR16 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if(dstFormat == IMGFMT_BGR15)
- MSG_V("SwScaler: using %s YV12->BGR15 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-
- MSG_V("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
- }
- if(params->debug & SWS_PRINT_INFO)
- {
- MSG_DBG2("SwScaler: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);
- MSG_DBG2("SwScaler: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 = getSwsFunc(params->cpu);
-
- c->ret = av_malloc(threadCount * sizeof(int));
- c->thread_count = threadCount;
- c->execute = sws_default_execute;
- if(threadCount >= 2)
- if(sws_thread_init(c, threadCount) == -1)
- {
- threadCount = 1;
- c->thread_count = threadCount;
- c->execute = sws_default_execute;
- }
-
- if(threadCount >= 2)
- {
- for(i = 1; i < threadCount; i++)
- {
- memcpy(&(c[i]), c, sizeof(SwsContext));
- }
- }
-
- // allocate pixbufs (we use dynamic allocation because otherwise we would need to
- //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)
-
- for(i = 0; i < threadCount; i++)
- {
- int j;
- c[i].lumPixBuf = av_malloc(c->vLumBufSize * 2 * sizeof(int16_t*));
- for(j = 0; j < c->vLumBufSize; j++)
- {
- c[i].lumPixBuf[j] = c[i].lumPixBuf[j+c->vLumBufSize] = av_malloc(8000); /* align at 16 bytes for AltiVec */
- memset(c[i].lumPixBuf[j], 0, 8000); //try to avoid drawing green stuff between the right end and the stride end
- }
- c[i].chrPixBuf = av_malloc(c->vChrBufSize * 2 * sizeof(int16_t*));
- for(j = 0; j < c->vChrBufSize; j++)
- {
- c[i].chrPixBuf[j] = c[i].chrPixBuf[j+c->vChrBufSize] = av_malloc(16000);
- memset(c[i].chrPixBuf[j], 64, 16000); //try to avoid drawing green stuff between the right end and the stride end
- }
- }
- return c;
+ }
+ if(isPlanarYUV(dstFormat))
+ {
+ if(c->vLumFilterSize==1)
+ MSG_V("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ else
+ MSG_V("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ }
+ else
+ {
+ if(c->vLumFilterSize==1 && c->vChrFilterSize==2)
+ MSG_V("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
+ "SwScaler: 2-tap scaler for vertical chrominance scaling (BGR)\n",(flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ else if(c->vLumFilterSize==2 && c->vChrFilterSize==2)
+ MSG_V("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ else
+ MSG_V("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ }
+
+ if(dstFormat==IMGFMT_BGR24)
+ MSG_V("SwScaler: using %s YV12->BGR24 Converter\n",
+ (flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
+ else if(dstFormat==IMGFMT_BGR32)
+ MSG_V("SwScaler: using %s YV12->BGR32 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ else if(dstFormat==IMGFMT_BGR16)
+ MSG_V("SwScaler: using %s YV12->BGR16 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+ else if(dstFormat==IMGFMT_BGR15)
+ MSG_V("SwScaler: using %s YV12->BGR15 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
+
+ MSG_V("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
+ }
+ if(params->debug & SWS_PRINT_INFO)
+ {
+ MSG_DBG2("SwScaler: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);
+ MSG_DBG2("SwScaler: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= getSwsFunc(params->cpu);
+
+ c->ret=av_malloc(threadCount*sizeof(int));
+ c->thread_count= threadCount;
+ c->execute= sws_default_execute;
+ if (threadCount>=2)
+ if(sws_thread_init(c, threadCount)==-1)
+ {
+ threadCount=1;
+ c->thread_count= threadCount;
+ c->execute= sws_default_execute;
+ }
+
+ if(threadCount>=2)
+ {
+ for (i=1; i<threadCount; i++){
+ memcpy(&(c[i]), c,sizeof(SwsContext));
+ }
+ }
+
+ // allocate pixbufs (we use dynamic allocation because otherwise we would need to
+ //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)
+
+ for(i=0; i<threadCount; i++)
+ {
+ int j;
+ c[i].lumPixBuf=av_malloc(c->vLumBufSize*2*sizeof(int16_t*));
+ for(j=0; j<c->vLumBufSize; j++)
+ {
+ c[i].lumPixBuf[j]= c[i].lumPixBuf[j+c->vLumBufSize]= av_malloc(8000); /* align at 16 bytes for AltiVec */
+ memset(c[i].lumPixBuf[j], 0, 8000); //try to avoid drawing green stuff between the right end and the stride end
+ }
+ c[i].chrPixBuf=av_malloc(c->vChrBufSize*2*sizeof(int16_t*));
+ for(j=0; j<c->vChrBufSize; j++)
+ {
+ c[i].chrPixBuf[j]= c[i].chrPixBuf[j+c->vChrBufSize]= av_malloc(16000);
+ memset(c[i].chrPixBuf[j], 64, 16000); //try to avoid drawing green stuff between the right end and the stride end
+ }
+ }
+ return c;
}
/**
@@ -2789,455 +2651,420 @@ SwsContext *sws_getContextEx(int srcW, int srcH, int origSrcFormat, int dstW, in
* assumes planar YUV to be in YUV order instead of YVU (except YV16)
*/
int sws_scale_ordered(SwsContext *c, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[])
-{
- if(c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH)
- {
- MSG_ERR("swScaler: slices start in the middle!\n");
- return 0;
- }
- if(c->sliceDir == 0)
- {
- if(srcSliceY == 0) c->sliceDir = 1;
- else c->sliceDir = -1;
- }
-
- //copy strides, so they can safely be modified
- if(c->sliceDir == 1)
- {
- // slices go from top to bottom
- stride_t srcStride2[3] = {srcStride[0], srcStride[1], srcStride[2]};
- stride_t dstStride2[3] = {dstStride[0], dstStride[1], dstStride[2]};
- return c->swScale(c, src, srcStride2, srcSliceY, srcSliceH, dst, dstStride2);
- }
- else
- {
- // slices go from bottom to top => we flip the image internally
- uint8_t* src2[3] = {src[0] + (srcSliceH - 1)*srcStride[0],
- src[1] + ((srcSliceH >> c->chrSrcVSubSample) - 1)*srcStride[1],
- src[2] + ((srcSliceH >> c->chrSrcVSubSample) - 1)*srcStride[2]
- };
- uint8_t* dst2[3] = {dst[0] + (c->dstH - 1)*dstStride[0],
- dst[1] + ((c->dstH >> c->chrDstVSubSample) - 1)*dstStride[1],
- dst[2] + ((c->dstH >> c->chrDstVSubSample) - 1)*dstStride[2]
- };
- stride_t srcStride2[3] = { -srcStride[0], -srcStride[1], -srcStride[2]};
- stride_t dstStride2[3] = { -dstStride[0], -dstStride[1], -dstStride[2]};
-
- return c->swScale(c, src2, srcStride2, c->srcH - srcSliceY - srcSliceH, srcSliceH, dst2, dstStride2);
- }
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]){
+ if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
+ MSG_ERR("swScaler: slices start in the middle!\n");
+ return 0;
+ }
+ if (c->sliceDir == 0) {
+ if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
+ }
+
+ //copy strides, so they can safely be modified
+ if (c->sliceDir == 1) {
+ // slices go from top to bottom
+ stride_t srcStride2[3]= {srcStride[0], srcStride[1], srcStride[2]};
+ stride_t dstStride2[3]= {dstStride[0], dstStride[1], dstStride[2]};
+ return c->swScale(c, src, srcStride2, srcSliceY, srcSliceH, dst, dstStride2);
+ } else {
+ // slices go from bottom to top => we flip the image internally
+ uint8_t* src2[3]= {src[0] + (srcSliceH-1)*srcStride[0],
+ src[1] + ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1],
+ src[2] + ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2]
+ };
+ uint8_t* dst2[3]= {dst[0] + (c->dstH-1)*dstStride[0],
+ dst[1] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1],
+ dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2]};
+ stride_t srcStride2[3]= {-srcStride[0], -srcStride[1], -srcStride[2]};
+ stride_t dstStride2[3]= {-dstStride[0], -dstStride[1], -dstStride[2]};
+
+ return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2);
+ }
}
/**
* swscale warper, so we don't need to export the SwsContext
*/
int sws_scale(SwsContext *c, uint8_t* srcParam[], stride_t srcStrideParam[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], stride_t dstStrideParam[])
-{
- stride_t srcStride[3];
- stride_t dstStride[3];
- uint8_t *src[3];
- uint8_t *dst[3];
- sws_orderYUV(c->origSrcFormat, src, srcStride, srcParam, srcStrideParam);
- sws_orderYUV(c->origDstFormat, dst, dstStride, dstParam, dstStrideParam);
+ int srcSliceH, uint8_t* dstParam[], stride_t dstStrideParam[]){
+ stride_t srcStride[3];
+ stride_t dstStride[3];
+ uint8_t *src[3];
+ uint8_t *dst[3];
+ sws_orderYUV(c->origSrcFormat, src, srcStride, srcParam, srcStrideParam);
+ sws_orderYUV(c->origDstFormat, dst, dstStride, dstParam, dstStrideParam);
//printf("sws: slice %d %d\n", srcSliceY, srcSliceH);
- return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
+ return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
}
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
- float lumaSharpen, float chromaSharpen,
- float chromaHShift, float chromaVShift,
- int verbose)
-{
- SwsFilter *filter = av_malloc(sizeof(SwsFilter));
-
- //DPRINTF(_l("sws_getDefaultFilter lumaGBlur %f, chromaGBlur %f, lumaSharpen %f, chromaSharpen %f, chromaHShift %f, chromaVShift %f"),lumaGBlur, chromaGBlur, lumaSharpen, chromaSharpen, chromaHShift, chromaVShift);
- 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();
- }
-
- 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();
- }
-
- if(chromaSharpen != 0.0)
- {
- SwsVector *g = sws_getConstVec(-1.0, 3);
- SwsVector *id = sws_getConstVec(10.0 / chromaSharpen, 1);
- g->coeff[1] = 2.0;
- sws_addVec(id, g);
- sws_convVec(filter->chrH, id);
- sws_convVec(filter->chrV, id);
- sws_freeVec(g);
- sws_freeVec(id);
- }
-
- if(lumaSharpen != 0.0)
- {
- SwsVector *g = sws_getConstVec(-1.0, 3);
- SwsVector *id = sws_getConstVec(10.0 / lumaSharpen, 1);
- g->coeff[1] = 2.0;
- sws_addVec(id, g);
- sws_convVec(filter->lumH, id);
- sws_convVec(filter->lumV, id);
- sws_freeVec(g);
- sws_freeVec(id);
- }
-
- if(chromaHShift != 0.0)
- sws_shiftVec(filter->chrH, (int)(chromaHShift + 0.5));
-
- if(chromaVShift != 0.0)
- 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_printVec(filter->chrH);
- if(verbose) sws_printVec(filter->lumH);
-
- return filter;
+ float lumaSharpen, float chromaSharpen,
+ float chromaHShift, float chromaVShift,
+ int verbose)
+{
+ SwsFilter *filter= av_malloc(sizeof(SwsFilter));
+
+ //DPRINTF(_l("sws_getDefaultFilter lumaGBlur %f, chromaGBlur %f, lumaSharpen %f, chromaSharpen %f, chromaHShift %f, chromaVShift %f"),lumaGBlur, chromaGBlur, lumaSharpen, chromaSharpen, chromaHShift, chromaVShift);
+ 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();
+ }
+
+ 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();
+ }
+
+ if(chromaSharpen!=0.0){
+ SwsVector *g= sws_getConstVec(-1.0, 3);
+ SwsVector *id= sws_getConstVec(10.0/chromaSharpen, 1);
+ g->coeff[1]=2.0;
+ sws_addVec(id, g);
+ sws_convVec(filter->chrH, id);
+ sws_convVec(filter->chrV, id);
+ sws_freeVec(g);
+ sws_freeVec(id);
+ }
+
+ if(lumaSharpen!=0.0){
+ SwsVector *g= sws_getConstVec(-1.0, 3);
+ SwsVector *id= sws_getConstVec(10.0/lumaSharpen, 1);
+ g->coeff[1]=2.0;
+ sws_addVec(id, g);
+ sws_convVec(filter->lumH, id);
+ sws_convVec(filter->lumV, id);
+ sws_freeVec(g);
+ sws_freeVec(id);
+ }
+
+ if(chromaHShift != 0.0)
+ sws_shiftVec(filter->chrH, (int)(chromaHShift+0.5));
+
+ if(chromaVShift != 0.0)
+ 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_printVec(filter->chrH);
+ if(verbose) sws_printVec(filter->lumH);
+
+ return filter;
}
/**
* returns a normalized gaussian curve used to filter stuff
* quality=3 is high quality, lowwer is lowwer quality
*/
-SwsVector *sws_getGaussianVec(double variance, double quality)
-{
- const int length = (int)(variance * quality + 0.5) | 1;
- int i;
- double *coeff = av_malloc(length * sizeof(double));
- double middle = (length - 1) * 0.5;
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+SwsVector *sws_getGaussianVec(double variance, double quality){
+ const int length= (int)(variance*quality + 0.5) | 1;
+ int i;
+ double *coeff= av_malloc(length*sizeof(double));
+ double middle= (length-1)*0.5;
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = length;
+ vec->coeff= coeff;
+ vec->length= length;
- for(i = 0; i < length; i++)
- {
- double dist = i - middle;
- coeff[i] = exp(-dist * dist / (2 * variance * variance)) / sqrt(2 * variance * PI);
- }
+ for(i=0; i<length; i++)
+ {
+ double dist= i-middle;
+ coeff[i]= exp( -dist*dist/(2*variance*variance) ) / sqrt(2*variance*PI);
+ }
- sws_normalizeVec(vec, 1.0);
+ sws_normalizeVec(vec, 1.0);
- return vec;
+ return vec;
}
-SwsVector *sws_getConstVec(double c, int length)
-{
- int i;
- double *coeff = av_malloc(length * sizeof(double));
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+SwsVector *sws_getConstVec(double c, int length){
+ int i;
+ double *coeff= av_malloc(length*sizeof(double));
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = length;
+ vec->coeff= coeff;
+ vec->length= length;
- for(i = 0; i < length; i++)
- coeff[i] = c;
+ for(i=0; i<length; i++)
+ coeff[i]= c;
- return vec;
+ return vec;
}
-SwsVector *sws_getIdentityVec(void)
-{
- return sws_getConstVec(1.0, 1);
+SwsVector *sws_getIdentityVec(void){
+ return sws_getConstVec(1.0, 1);
}
-void sws_scaleVec(SwsVector *a, double scalar)
-{
- int i;
+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)
-{
- int i;
- double sum = 0;
- double inv;
+void sws_normalizeVec(SwsVector *a, double height){
+ int i;
+ double sum=0;
+ double inv;
- for(i = 0; i < a->length; i++)
- sum += a->coeff[i];
+ for(i=0; i<a->length; i++)
+ sum+= a->coeff[i];
- inv = height / sum;
+ inv= height/sum;
- for(i = 0; i < a->length; i++)
- a->coeff[i] *= inv;
+ for(i=0; i<a->length; i++)
+ a->coeff[i]*= inv;
}
-static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b)
-{
- int length = a->length + b->length - 1;
- double *coeff = av_malloc(length * sizeof(double));
+static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b){
+ int length= a->length + b->length - 1;
+ double *coeff= av_malloc(length*sizeof(double));
int i, j;
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = length;
+ vec->coeff= coeff;
+ vec->length= length;
- for(i = 0; i < length; i++) coeff[i] = 0.0;
+ for (i=0; i<length; i++) coeff[i]= 0.0;
- for(i = 0; i < a->length; i++)
+ for (i=0; i<a->length; i++)
{
- for(j = 0; j < b->length; j++)
+ for (j=0; j<b->length; j++)
{
- coeff[i+j] += a->coeff[i] * b->coeff[j];
+ coeff[i+j]+= a->coeff[i]*b->coeff[j];
}
}
return vec;
}
-static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b)
-{
- int length = FFMAX(a->length, b->length);
- double *coeff = av_malloc(length * sizeof(double));
+static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){
+ int length= FFMAX(a->length, b->length);
+ double *coeff= av_malloc(length*sizeof(double));
int i;
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = length;
+ vec->coeff= coeff;
+ vec->length= length;
- for(i = 0; i < length; i++) coeff[i] = 0.0;
+ for (i=0; i<length; i++) coeff[i]= 0.0;
- for(i = 0; i < a->length; i++) coeff[i + (length-1)/2 - (a->length-1)/2] += a->coeff[i];
- for(i = 0; i < b->length; i++) coeff[i + (length-1)/2 - (b->length-1)/2] += b->coeff[i];
+ for (i=0; i<a->length; i++) coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
+ for (i=0; i<b->length; i++) 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);
- double *coeff = av_malloc(length * sizeof(double));
+static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b){
+ int length= FFMAX(a->length, b->length);
+ double *coeff= av_malloc(length*sizeof(double));
int i;
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = length;
+ vec->coeff= coeff;
+ vec->length= length;
- for(i = 0; i < length; i++) coeff[i] = 0.0;
+ for (i=0; i<length; i++) coeff[i]= 0.0;
- for(i = 0; i < a->length; i++) coeff[i + (length-1)/2 - (a->length-1)/2] += a->coeff[i];
- for(i = 0; i < b->length; i++) coeff[i + (length-1)/2 - (b->length-1)/2] -= b->coeff[i];
+ for (i=0; i<a->length; i++) coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
+ for (i=0; i<b->length; i++) coeff[i + (length-1)/2 - (b->length-1)/2]-= b->coeff[i];
return vec;
}
/* shift left / or right if "shift" is negative */
-static SwsVector *sws_getShiftedVec(SwsVector *a, int shift)
-{
- int length = a->length + FFABS(shift) * 2;
- double *coeff = av_malloc(length * sizeof(double));
+static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){
+ int length= a->length + FFABS(shift)*2;
+ double *coeff= av_malloc(length*sizeof(double));
int i;
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = length;
+ vec->coeff= coeff;
+ vec->length= length;
- for(i = 0; i < length; i++) coeff[i] = 0.0;
+ for (i=0; i<length; i++) coeff[i]= 0.0;
- for(i = 0; i < a->length; i++)
+ for (i=0; i<a->length; i++)
{
- coeff[i + (length-1)/2 - (a->length-1)/2 - shift] = a->coeff[i];
+ coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i];
}
return vec;
}
-void sws_shiftVec(SwsVector *a, int shift)
-{
- SwsVector *shifted = sws_getShiftedVec(a, shift);
+void sws_shiftVec(SwsVector *a, int 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);
+void sws_addVec(SwsVector *a, SwsVector *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);
+void sws_subVec(SwsVector *a, SwsVector *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);
+void sws_convVec(SwsVector *a, SwsVector *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)
-{
- double *coeff = av_malloc(a->length * sizeof(double));
+SwsVector *sws_cloneVec(SwsVector *a){
+ double *coeff= av_malloc(a->length*sizeof(double));
int i;
- SwsVector *vec = av_malloc(sizeof(SwsVector));
+ SwsVector *vec= av_malloc(sizeof(SwsVector));
- vec->coeff = coeff;
- vec->length = a->length;
+ vec->coeff= coeff;
+ vec->length= a->length;
- for(i = 0; i < a->length; i++) coeff[i] = a->coeff[i];
+ for (i=0; i<a->length; i++) coeff[i]= a->coeff[i];
return vec;
}
-void sws_printVec(SwsVector *a)
-{
- int i;
- double max = 0;
- double min = 0;
- double range;
+void sws_printVec(SwsVector *a){
+ int i;
+ 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);
- MSG_DBG2("%1.3f ", a->coeff[i]);
- for(; x > 0; x--) MSG_DBG2(" ");
- MSG_DBG2("|\n");
- }
+ for(i=0; i<a->length; i++)
+ {
+ int x= (int)((a->coeff[i]-min)*60.0/range +0.5);
+ MSG_DBG2("%1.3f ", a->coeff[i]);
+ for(;x>0; x--) MSG_DBG2(" ");
+ MSG_DBG2("|\n");
+ }
}
-void sws_freeVec(SwsVector *a)
-{
- if(!a) return;
+void sws_freeVec(SwsVector *a){
+ if (!a) return;
av_freep(&a->coeff);
- a->length = 0;
+ a->length=0;
av_free(a);
}
-void sws_freeFilter(SwsFilter *filter)
-{
- if(!filter) return;
+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->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;
+void sws_freeContext(SwsContext *c){
+ int i;
+ if(!c) return;
- if(c->thread_count > 1)
- sws_thread_free(c);
- for(i = 0; i < c->thread_count; i++)
- {
- int j;
- if(c[i].lumPixBuf)
- {
- for(j = 0; j < c->vLumBufSize; j++)
- {
- av_free(c[i].lumPixBuf[j]);
- c[i].lumPixBuf[j] = NULL;
- }
+ if (c->thread_count>1)
+ sws_thread_free(c);
+ for(i=0; i<c->thread_count; i++)
+ {
+ int j;
+ if (c[i].lumPixBuf)
+ {
+ for(j=0; j<c->vLumBufSize; j++)
+ {
+ av_free(c[i].lumPixBuf[j]);
+ c[i].lumPixBuf[j]=NULL;
+ }
av_free(c[i].lumPixBuf);
- c[i].lumPixBuf = NULL;
- }
- if(c[i].chrPixBuf)
- {
- for(j = 0; j < c->vChrBufSize; j++)
- {
- av_free(c[i].chrPixBuf[j]);
- c[i].chrPixBuf[j] = NULL;
- }
+ c[i].lumPixBuf=NULL;
+ }
+ if (c[i].chrPixBuf)
+ {
+ for(j=0; j<c->vChrBufSize; j++)
+ {
+ av_free(c[i].chrPixBuf[j]);
+ c[i].chrPixBuf[j]=NULL;
+ }
av_free(c[i].chrPixBuf);
- c[i].chrPixBuf = NULL;
- }
- }
-
- av_free(c->vLumFilter);
- c->vLumFilter = NULL;
- av_free(c->vChrFilter);
- c->vChrFilter = NULL;
- av_free(c->hLumFilter);
- c->hLumFilter = NULL;
- av_free(c->hChrFilter);
- c->hChrFilter = NULL;
+ c[i].chrPixBuf=NULL;
+ }
+ }
+
+ av_free(c->vLumFilter);
+ c->vLumFilter = NULL;
+ av_free(c->vChrFilter);
+ c->vChrFilter = NULL;
+ av_free(c->hLumFilter);
+ c->hLumFilter = NULL;
+ av_free(c->hChrFilter);
+ c->hChrFilter = NULL;
#ifdef HAVE_ALTIVEC
- av_free(c->vYCoeffsBank);
- c->vYCoeffsBank = NULL;
- av_free(c->vCCoeffsBank);
- c->vCCoeffsBank = NULL;
+ av_free(c->vYCoeffsBank);
+ c->vYCoeffsBank = NULL;
+ av_free(c->vCCoeffsBank);
+ c->vCCoeffsBank = NULL;
#endif
- av_free(c->vLumFilterPos);
- c->vLumFilterPos = NULL;
- av_free(c->vChrFilterPos);
- c->vChrFilterPos = NULL;
- av_free(c->hLumFilterPos);
- c->hLumFilterPos = NULL;
- av_free(c->hChrFilterPos);
- c->hChrFilterPos = NULL;
+ av_free(c->vLumFilterPos);
+ c->vLumFilterPos = NULL;
+ av_free(c->vChrFilterPos);
+ c->vChrFilterPos = NULL;
+ av_free(c->hLumFilterPos);
+ c->hLumFilterPos = NULL;
+ av_free(c->hChrFilterPos);
+ c->hChrFilterPos = NULL;
#if ARCH_X86_32 || ARCH_X86_64
#ifdef HAVE_SYS_MMAN_H
- if(c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE);
- if(c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE);
+ if(c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE);
+ if(c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE);
#else
- if(c->funnyYCode) /*free*/VirtualFree(c->funnyYCode, 0, MEM_RELEASE);
- if(c->funnyUVCode) /*free*/VirtualFree(c->funnyUVCode, 0, MEM_RELEASE);
+ if(c->funnyYCode) /*free*/VirtualFree(c->funnyYCode,0,MEM_RELEASE);
+ if(c->funnyUVCode) /*free*/VirtualFree(c->funnyUVCode,0,MEM_RELEASE);
#endif
- c->funnyYCode = NULL;
- c->funnyUVCode = NULL;
+ c->funnyYCode=NULL;
+ c->funnyUVCode=NULL;
#endif /* ARCH_X86_32 || ARCH_X86_64 */
- av_free(c->lumMmx2Filter);
- c->lumMmx2Filter = NULL;
- av_free(c->chrMmx2Filter);
- c->chrMmx2Filter = NULL;
- av_free(c->lumMmx2FilterPos);
- c->lumMmx2FilterPos = NULL;
- av_free(c->chrMmx2FilterPos);
- c->chrMmx2FilterPos = NULL;
- av_free(c->yuvTable);
- c->yuvTable = NULL;
-
- av_free(c);
+ av_free(c->lumMmx2Filter);
+ c->lumMmx2Filter=NULL;
+ av_free(c->chrMmx2Filter);
+ c->chrMmx2Filter=NULL;
+ av_free(c->lumMmx2FilterPos);
+ c->lumMmx2FilterPos=NULL;
+ av_free(c->chrMmx2FilterPos);
+ c->chrMmx2FilterPos=NULL;
+ av_free(c->yuvTable);
+ c->yuvTable=NULL;
+
+ av_free(c);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.h b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.h
index 7babd3580..3e5217632 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale.h
@@ -31,7 +31,7 @@ extern "C" {
#include "ffImgfmt.h"
- /* values for the flags, the stuff on the command line is different */
+/* values for the flags, the stuff on the command line is different */
#define SWS_MAX_REDUCE_CUTOFF 0.002
#define SWS_CS_ITU709 1
@@ -44,105 +44,101 @@ extern "C" {
// when used for filters they must have an odd number of elements
// coeffs cannot be shared between vectors
- typedef struct SwsVector
- {
+typedef struct SwsVector {
double *coeff;
int length;
- } SwsVector;
+} SwsVector;
// vectors can be shared
- typedef struct SwsFilter
- {
+typedef struct SwsFilter {
SwsVector *lumH;
SwsVector *lumV;
SwsVector *chrH;
SwsVector *chrV;
- } SwsFilter;
+} SwsFilter;
- typedef struct SwsMethodParams
- {
+typedef struct SwsMethodParams {
int method;
-#define SWS_FAST_BILINEAR 1
-#define SWS_BILINEAR 2
-#define SWS_BICUBIC 4
-#define SWS_X 8
-#define SWS_POINT 0x10
-#define SWS_AREA 0x20
+ #define SWS_FAST_BILINEAR 1
+ #define SWS_BILINEAR 2
+ #define SWS_BICUBIC 4
+ #define SWS_X 8
+ #define SWS_POINT 0x10
+ #define SWS_AREA 0x20
//#define SWS_BICUBLIN 0x40
-#define SWS_GAUSS 0x80
-#define SWS_SINC 0x100
-#define SWS_LANCZOS 0x200
-#define SWS_SPLINE 0x400
+ #define SWS_GAUSS 0x80
+ #define SWS_SINC 0x100
+ #define SWS_LANCZOS 0x200
+ #define SWS_SPLINE 0x400
int param;
- } SwsMethodParams;
+} SwsMethodParams;
- typedef struct SwsParams
- {
+typedef struct SwsParams {
int cpu;
-#define SWS_CPU_CAPS_MMX 0x80000000
-#define SWS_CPU_CAPS_MMX2 0x20000000
-#define SWS_CPU_CAPS_3DNOW 0x40000000
-#define SWS_CPU_CAPS_ALTIVEC 0x10000000
+ #define SWS_CPU_CAPS_MMX 0x80000000
+ #define SWS_CPU_CAPS_MMX2 0x20000000
+ #define SWS_CPU_CAPS_3DNOW 0x40000000
+ #define SWS_CPU_CAPS_ALTIVEC 0x10000000
int debug;
-#define SWS_PRINT_INFO 0x1000
+ #define SWS_PRINT_INFO 0x1000
int subsampling;
//the following 3 flags are not completly implemented
//internal chrominace subsamling info
-#define SWS_FULL_CHR_H_INT 0x2000
+ #define SWS_FULL_CHR_H_INT 0x2000
//input subsampling info
-#define SWS_FULL_CHR_H_INP 0x4000
-#define SWS_DIRECT_BGR 0x8000
-#define SWS_ACCURATE_RND 0x40000
+ #define SWS_FULL_CHR_H_INP 0x4000
+ #define SWS_DIRECT_BGR 0x8000
+ #define SWS_ACCURATE_RND 0x40000
int v_chr_drop;
- SwsMethodParams methodLuma, methodChroma;
- } SwsParams;
-
- struct SwsContext;
-
- void sws_freeContext(struct SwsContext *swsContext);
-
- struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, SwsParams *params,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const int32_t yuv2rgbTable[6]);
- struct SwsContext *sws_getContextEx(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, SwsParams *params,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const int32_t yuv2rgbTable[6], int threadCount);
- int sws_scale(struct SwsContext *context, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[]);
- int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[]);
-
-
- int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[7], int srcRange, const int table[7], int dstRange, int brightness, int contrast, int saturation);
- int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation);
- SwsVector *sws_getGaussianVec(double variance, double quality);
- SwsVector *sws_getConstVec(double c, int length);
- SwsVector *sws_getIdentityVec(void);
- void sws_scaleVec(SwsVector *a, double scalar);
- void sws_normalizeVec(SwsVector *a, double height);
- void sws_convVec(SwsVector *a, SwsVector *b);
- void sws_addVec(SwsVector *a, SwsVector *b);
- void sws_subVec(SwsVector *a, SwsVector *b);
- void sws_shiftVec(SwsVector *a, int shift);
- SwsVector *sws_cloneVec(SwsVector *a);
-
- void sws_printVec(SwsVector *a);
- void sws_freeVec(SwsVector *a);
-
- SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
- float lumaSarpen, float chromaSharpen,
- float chromaHShift, float chromaVShift,
- int verbose);
- void sws_freeFilter(SwsFilter *filter);
-
- int sws_thread_init(struct SwsContext *s, int thread_count);
- void sws_thread_free(struct SwsContext *s);
- int sws_thread_execute(struct SwsContext *s, int (*func)(struct SwsContext *c2), int *ret, int count);
- int sws_default_execute(struct SwsContext *c, int (*func)(struct SwsContext *c2), int *ret, int count);
- int GetCPUCount(void);
- int isP4HT(void);
+ SwsMethodParams methodLuma,methodChroma;
+} SwsParams;
+
+struct SwsContext;
+
+void sws_freeContext(struct SwsContext *swsContext);
+
+struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, SwsParams *params,
+ SwsFilter *srcFilter, SwsFilter *dstFilter, const int32_t yuv2rgbTable[6]);
+struct SwsContext *sws_getContextEx(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, SwsParams *params,
+ SwsFilter *srcFilter, SwsFilter *dstFilter, const int32_t yuv2rgbTable[6],int threadCount);
+int sws_scale(struct SwsContext *context, uint8_t* src[], stride_t srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]);
+int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], stride_t srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]);
+
+
+int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[7], int srcRange, const int table[7], int dstRange, int brightness, int contrast, int saturation);
+int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation);
+SwsVector *sws_getGaussianVec(double variance, double quality);
+SwsVector *sws_getConstVec(double c, int length);
+SwsVector *sws_getIdentityVec(void);
+void sws_scaleVec(SwsVector *a, double scalar);
+void sws_normalizeVec(SwsVector *a, double height);
+void sws_convVec(SwsVector *a, SwsVector *b);
+void sws_addVec(SwsVector *a, SwsVector *b);
+void sws_subVec(SwsVector *a, SwsVector *b);
+void sws_shiftVec(SwsVector *a, int shift);
+SwsVector *sws_cloneVec(SwsVector *a);
+
+void sws_printVec(SwsVector *a);
+void sws_freeVec(SwsVector *a);
+
+SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
+ float lumaSarpen, float chromaSharpen,
+ float chromaHShift, float chromaVShift,
+ int verbose);
+void sws_freeFilter(SwsFilter *filter);
+
+int sws_thread_init(struct SwsContext *s, int thread_count);
+void sws_thread_free(struct SwsContext *s);
+int sws_thread_execute(struct SwsContext *s, int (*func)(struct SwsContext *c2), int *ret, int count);
+int sws_default_execute(struct SwsContext *c, int (*func)(struct SwsContext *c2), int *ret, int count);
+int GetCPUCount(void);
+int isP4HT (void);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale_internal.h b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale_internal.h
index bd8dd3589..bd2d5c00f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale_internal.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/swscale_internal.h
@@ -29,21 +29,21 @@
#include "../ffmpeg/mp_msg.h"
#ifdef __GNUC__
-#define MSG_WARN(args...) mp_msg(MSGT_SWS,MSGL_WARN, ##args )
-#define MSG_FATAL(args...) mp_msg(MSGT_SWS,MSGL_FATAL, ##args )
-#define MSG_ERR(args...) mp_msg(MSGT_SWS,MSGL_ERR, ##args )
-#define MSG_V(args...) mp_msg(MSGT_SWS,MSGL_V, ##args )
-#define MSG_DBG2(args...) mp_msg(MSGT_SWS,MSGL_DBG2, ##args )
-#define MSG_INFO(args...) mp_msg(MSGT_SWS,MSGL_INFO, ##args )
-#define __align32(t,v) t v __attribute__ ((aligned (32)))
+ #define MSG_WARN(args...) mp_msg(MSGT_SWS,MSGL_WARN, ##args )
+ #define MSG_FATAL(args...) mp_msg(MSGT_SWS,MSGL_FATAL, ##args )
+ #define MSG_ERR(args...) mp_msg(MSGT_SWS,MSGL_ERR, ##args )
+ #define MSG_V(args...) mp_msg(MSGT_SWS,MSGL_V, ##args )
+ #define MSG_DBG2(args...) mp_msg(MSGT_SWS,MSGL_DBG2, ##args )
+ #define MSG_INFO(args...) mp_msg(MSGT_SWS,MSGL_INFO, ##args )
+ #define __align32(t,v) t v __attribute__ ((aligned (32)))
#else
-#define MSG_WARN(args)
-#define MSG_FATAL(args)
-#define MSG_ERR(args)
-#define MSG_V(args)
-#define MSG_DBG2(args)
-#define MSG_INFO(args)
-#define __align32(t,v) __declspec(align(32)) t v
+ #define MSG_WARN(args)
+ #define MSG_FATAL(args)
+ #define MSG_ERR(args)
+ #define MSG_V(args)
+ #define MSG_DBG2(args)
+ #define MSG_INFO(args)
+ #define __align32(t,v) __declspec(align(32)) t v
#endif
#define AV_TOSTRING(s) #s
@@ -62,94 +62,92 @@
#endif
typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], stride_t srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], stride_t dstStride[]);
+ int srcSliceH, uint8_t* dst[], stride_t dstStride[]);
struct SwsContext;
-typedef struct SwsThreadParam
-{
- struct SwsContext *c;
- uint8_t **src;
- stride_t* srcStride;
- int srcSliceY;
- int srcSliceH;
- uint8_t **dst;
- stride_t* dstStride;
- int dstYstart;
- int dstYend;
+typedef struct SwsThreadParam{
+ struct SwsContext *c;
+ uint8_t **src;
+ stride_t* srcStride;
+ int srcSliceY;
+ int srcSliceH;
+ uint8_t **dst;
+ stride_t* dstStride;
+ int dstYstart;
+ int dstYend;
} SwsThreadParam;
/* This struct should be aligned on at least a 32-byte boundary. */
-typedef struct SwsContext
-{
- /**
- *
- * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
- */
- SwsFunc swScale;
- int srcW, srcH, dstH;
- int chrSrcW, chrSrcH, chrDstW, chrDstH;
- int lumXInc, chrXInc;
- int lumYInc, chrYInc;
- int dstFormat, srcFormat; ///< format 4:2:0 type is allways YV12
- int origDstFormat, origSrcFormat; ///< format
- int chrSrcHSubSample, chrSrcVSubSample;
- //int chrIntHSubSample, chrIntVSubSample;
- int chrDstHSubSample, chrDstVSubSample;
- int vChrDrop;
- int sliceDir;
-
- void *thread_opaque;
- int thread_count;
- int (*execute)(struct SwsContext *c, int (*func)(struct SwsContext *c), int *ret, int count);
- int *ret;
- SwsThreadParam stp;
- int16_t **lumPixBuf;
- int16_t **chrPixBuf;
- int16_t *hLumFilter;
- int16_t *hLumFilterPos;
- int16_t *hChrFilter;
- int16_t *hChrFilterPos;
- int16_t *vLumFilter;
- int16_t *vLumFilterPos;
- int16_t *vChrFilter;
- int16_t *vChrFilterPos;
-
- __align32(uint8_t, formatConvBuffer[8000]); //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
-
- int hLumFilterSize;
- int hChrFilterSize;
- int vLumFilterSize;
- int vChrFilterSize;
- int vLumBufSize;
- int vChrBufSize;
-
- uint8_t *funnyYCode;
- uint8_t *funnyUVCode;
- int32_t *lumMmx2FilterPos;
- int32_t *chrMmx2FilterPos;
- int16_t *lumMmx2Filter;
- int16_t *chrMmx2Filter;
-
- int canMMX2BeUsed;
-
- int lastInLumBuf;
- int lastInChrBuf;
- int lumBufIndex;
- int chrBufIndex;
- int dstY;
- SwsParams params;
- void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
- unsigned char * table_rV[256];
- unsigned char * table_gU[256];
- int table_gV[256];
- unsigned char * table_bU[256];
-
- //Colorspace stuff
- int contrast, brightness, saturation; // for sws_getColorspaceDetails
- int srcColorspaceTable[7];
- int dstColorspaceTable[7];
- int srcRange, dstRange;
+typedef struct SwsContext{
+ /**
+ *
+ * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
+ */
+ SwsFunc swScale;
+ int srcW, srcH, dstH;
+ int chrSrcW, chrSrcH, chrDstW, chrDstH;
+ int lumXInc, chrXInc;
+ int lumYInc, chrYInc;
+ int dstFormat, srcFormat; ///< format 4:2:0 type is allways YV12
+ int origDstFormat, origSrcFormat; ///< format
+ int chrSrcHSubSample, chrSrcVSubSample;
+ //int chrIntHSubSample, chrIntVSubSample;
+ int chrDstHSubSample, chrDstVSubSample;
+ int vChrDrop;
+ int sliceDir;
+
+ void *thread_opaque;
+ int thread_count;
+ int (*execute)(struct SwsContext *c, int (*func)(struct SwsContext *c), int *ret, int count);
+ int *ret;
+ SwsThreadParam stp;
+ int16_t **lumPixBuf;
+ int16_t **chrPixBuf;
+ int16_t *hLumFilter;
+ int16_t *hLumFilterPos;
+ int16_t *hChrFilter;
+ int16_t *hChrFilterPos;
+ int16_t *vLumFilter;
+ int16_t *vLumFilterPos;
+ int16_t *vChrFilter;
+ int16_t *vChrFilterPos;
+
+ __align32(uint8_t,formatConvBuffer[8000]); //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
+
+ int hLumFilterSize;
+ int hChrFilterSize;
+ int vLumFilterSize;
+ int vChrFilterSize;
+ int vLumBufSize;
+ int vChrBufSize;
+
+ uint8_t *funnyYCode;
+ uint8_t *funnyUVCode;
+ int32_t *lumMmx2FilterPos;
+ int32_t *chrMmx2FilterPos;
+ int16_t *lumMmx2Filter;
+ int16_t *chrMmx2Filter;
+
+ int canMMX2BeUsed;
+
+ int lastInLumBuf;
+ int lastInChrBuf;
+ int lumBufIndex;
+ int chrBufIndex;
+ int dstY;
+ SwsParams params;
+ void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
+ unsigned char * table_rV[256];
+ unsigned char * table_gU[256];
+ int table_gV[256];
+ unsigned char * table_bU[256];
+
+ //Colorspace stuff
+ int contrast, brightness, saturation; // for sws_getColorspaceDetails
+ int srcColorspaceTable[7];
+ int dstColorspaceTable[7];
+ int srcRange, dstRange;
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
@@ -170,32 +168,32 @@ typedef struct SwsContext
#define U_TEMP "11*8+4*4*256*2+24"
#define V_TEMP "11*8+4*4*256*2+32"
- uint64_t redDither __attribute__((aligned(8)));
- uint64_t greenDither __attribute__((aligned(8)));
- uint64_t blueDither __attribute__((aligned(8)));
-
- uint64_t yCoeff __attribute__((aligned(8)));
- uint64_t vrCoeff __attribute__((aligned(8)));
- uint64_t ubCoeff __attribute__((aligned(8)));
- uint64_t vgCoeff __attribute__((aligned(8)));
- uint64_t ugCoeff __attribute__((aligned(8)));
- uint64_t yOffset __attribute__((aligned(8)));
- uint64_t uOffset __attribute__((aligned(8)));
- uint64_t vOffset __attribute__((aligned(8)));
- int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
- int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
- int dstW;
- uint64_t esp __attribute__((aligned(8)));
- uint64_t vRounder __attribute__((aligned(8)));
- uint64_t u_temp __attribute__((aligned(8)));
- uint64_t v_temp __attribute__((aligned(8)));
+ uint64_t redDither __attribute__((aligned(8)));
+ uint64_t greenDither __attribute__((aligned(8)));
+ uint64_t blueDither __attribute__((aligned(8)));
+
+ uint64_t yCoeff __attribute__((aligned(8)));
+ uint64_t vrCoeff __attribute__((aligned(8)));
+ uint64_t ubCoeff __attribute__((aligned(8)));
+ uint64_t vgCoeff __attribute__((aligned(8)));
+ uint64_t ugCoeff __attribute__((aligned(8)));
+ uint64_t yOffset __attribute__((aligned(8)));
+ uint64_t uOffset __attribute__((aligned(8)));
+ uint64_t vOffset __attribute__((aligned(8)));
+ int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
+ int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
+ int dstW;
+ uint64_t esp __attribute__((aligned(8)));
+ uint64_t vRounder __attribute__((aligned(8)));
+ uint64_t u_temp __attribute__((aligned(8)));
+ uint64_t v_temp __attribute__((aligned(8)));
} SwsContext;
//FIXME check init (where 0)
-SwsFunc yuv2rgb_get_func_ptr(SwsContext *c);
-int yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[7], int fullRange, int brightness, int contrast, int saturation);
+SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
+int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[7], int fullRange, int brightness, int contrast, int saturation);
char *sws_format_name(int format);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_mmx.c
index 1c8a1b727..b03cce2ae 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_mmx.c
@@ -60,56 +60,38 @@ DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
{
- if(c->flags & SWS_CPU_CAPS_MMX2)
- {
- switch(c->dstFormat)
- {
+ if (c->flags & SWS_CPU_CAPS_MMX2) {
+ switch (c->dstFormat) {
case PIX_FMT_RGB32:
- if(CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P)
- {
- if(HAVE_7REGS) return yuva420_rgb32_MMX2;
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
+ if (HAVE_7REGS) return yuva420_rgb32_MMX2;
break;
- }
- else return yuv420_rgb32_MMX2;
+ } else return yuv420_rgb32_MMX2;
case PIX_FMT_BGR32:
- if(CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P)
- {
- if(HAVE_7REGS) return yuva420_bgr32_MMX2;
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
+ if (HAVE_7REGS) return yuva420_bgr32_MMX2;
break;
- }
- else return yuv420_bgr32_MMX2;
- case PIX_FMT_BGR24:
- return yuv420_rgb24_MMX2;
- case PIX_FMT_RGB565:
- return yuv420_rgb16_MMX2;
- case PIX_FMT_RGB555:
- return yuv420_rgb15_MMX2;
+ } else return yuv420_bgr32_MMX2;
+ case PIX_FMT_BGR24: return yuv420_rgb24_MMX2;
+ case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
+ case PIX_FMT_RGB555: return yuv420_rgb15_MMX2;
}
}
- if(c->flags & SWS_CPU_CAPS_MMX)
- {
- switch(c->dstFormat)
- {
+ if (c->flags & SWS_CPU_CAPS_MMX) {
+ switch (c->dstFormat) {
case PIX_FMT_RGB32:
- if(CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P)
- {
- if(HAVE_7REGS) return yuva420_rgb32_MMX;
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
+ if (HAVE_7REGS) return yuva420_rgb32_MMX;
break;
- }
- else return yuv420_rgb32_MMX;
+ } else return yuv420_rgb32_MMX;
case PIX_FMT_BGR32:
- if(CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P)
- {
- if(HAVE_7REGS) return yuva420_bgr32_MMX;
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
+ if (HAVE_7REGS) return yuva420_bgr32_MMX;
break;
- }
- else return yuv420_bgr32_MMX;
- case PIX_FMT_BGR24:
- return yuv420_rgb24_MMX;
- case PIX_FMT_RGB565:
- return yuv420_rgb16_MMX;
- case PIX_FMT_RGB555:
- return yuv420_rgb15_MMX;
+ } else return yuv420_bgr32_MMX;
+ case PIX_FMT_BGR24: return yuv420_rgb24_MMX;
+ case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
+ case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
}
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_template.c
index 638075ef4..994480d14 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/x86/yuv2rgb_template.c
@@ -47,46 +47,46 @@
#define YUV2RGB \
/* Do the multiply part of the conversion for even and odd pixels,
-register usage:
-mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
- mm6 -> Y even, mm7 -> Y odd */\
+ register usage:
+ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
+ mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
+ mm6 -> Y even, mm7 -> Y odd */\
/* convert the chroma part */\
"punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
"punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
- \
+\
"psllw $3, %%mm0;" /* Promote precision */ \
"psllw $3, %%mm1;" /* Promote precision */ \
- \
+\
"psubsw "U_OFFSET"(%4), %%mm0;" /* Cb -= 128 */ \
"psubsw "V_OFFSET"(%4), %%mm1;" /* Cr -= 128 */ \
- \
+\
"movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
"movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
- \
+\
"pmulhw "UG_COEFF"(%4), %%mm2;" /* Mul Cb with green coeff -> Cb green */ \
"pmulhw "VG_COEFF"(%4), %%mm3;" /* Mul Cr with green coeff -> Cr green */ \
- \
+\
"pmulhw "UB_COEFF"(%4), %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */\
"pmulhw "VR_COEFF"(%4), %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */\
- \
+\
"paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */\
- \
+\
/* convert the luma part */\
"movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
"pand "MANGLE(mmx_00ffw)", %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
- \
+\
"psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */\
- \
+\
"psllw $3, %%mm6;" /* Promote precision */\
"psllw $3, %%mm7;" /* Promote precision */\
- \
+\
"psubw "Y_OFFSET"(%4), %%mm6;" /* Y -= 16 */\
"psubw "Y_OFFSET"(%4), %%mm7;" /* Y -= 16 */\
- \
+\
"pmulhw "Y_COEFF"(%4), %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */\
"pmulhw "Y_COEFF"(%4), %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */\
- \
+\
/* Do the addition part of the conversion for even and odd pixels,
register usage:
mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
@@ -95,26 +95,26 @@ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
"movq %%mm0, %%mm3;" /* Copy Cblue */\
"movq %%mm1, %%mm4;" /* Copy Cred */\
"movq %%mm2, %%mm5;" /* Copy Cgreen */\
- \
+\
"paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */\
"paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */\
- \
+\
"paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */\
"paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */\
- \
+\
"paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */\
"paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */\
- \
+\
/* Limit RGB even to 0..255 */\
"packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */\
"packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */\
"packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */\
- \
+\
/* Limit RGB odd to 0..255 */\
"packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */\
"packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */\
"packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */\
- \
+\
/* Interleave RGB even and odd */\
"punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */\
"punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */\
@@ -126,7 +126,7 @@ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
srcStride[1] *= 2; \
srcStride[2] *= 2; \
} \
-
+
#define YUV2RGB_LOOP(depth) \
h_size= (c->dstW+7)&~7; \
if(h_size*depth > FFABS(dstStride[0])) h_size-=8; \
@@ -138,7 +138,7 @@ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
uint8_t *pu = src[1] + (y>>1)*srcStride[1]; \
uint8_t *pv = src[2] + (y>>1)*srcStride[2]; \
x86_reg index= -h_size/2; \
-
+
#define YUV2RGB_INIT \
/* This MMX assembly code deals with a SINGLE scan line at a time, \
* it converts 8 pixels in each iteration. */ \
@@ -157,12 +157,12 @@ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
PREFETCH" 64(%1) \n\t" \
PREFETCH" 64(%2) \n\t" \
*/ \
-
+
#define YUV2RGB_ENDLOOP(depth) \
"add $"AV_STRINGIFY(depth*8)", %1 \n\t" \
"add $4, %0 \n\t" \
" js 1b \n\t" \
-
+
#define YUV2RGB_OPERANDS \
: "+r" (index), "+r" (image) \
: "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index) \
@@ -170,7 +170,7 @@ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
} \
__asm__ volatile (EMMS); \
return srcSliceH; \
-
+
#define YUV2RGB_OPERANDS_ALPHA \
: "+r" (index), "+r" (image) \
: "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), "r" (pa - 2*index) \
@@ -178,59 +178,59 @@ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
} \
__asm__ volatile (EMMS); \
return srcSliceH; \
-
- static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+
+static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[])
{
int y, h_size;
YUV422_UNSHIFT
YUV2RGB_LOOP(2)
- c->blueDither = ff_dither8[y&1];
- c->greenDither = ff_dither4[y&1];
- c->redDither = ff_dither8[(y+1)&1];
+ c->blueDither= ff_dither8[y&1];
+ c->greenDither= ff_dither4[y&1];
+ c->redDither= ff_dither8[(y+1)&1];
- YUV2RGB_INIT
- YUV2RGB
+ YUV2RGB_INIT
+ YUV2RGB
#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%4), %%mm0;"
- "paddusb "GREEN_DITHER"(%4), %%mm2;"
- "paddusb "RED_DITHER"(%4), %%mm1;"
+ "paddusb "BLUE_DITHER"(%4), %%mm0;"
+ "paddusb "GREEN_DITHER"(%4), %%mm2;"
+ "paddusb "RED_DITHER"(%4), %%mm1;"
#endif
- /* mask unneeded bits off */
- "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
- "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
+ /* mask unneeded bits off */
+ "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
+ "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
+ "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
- "psrlw $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
+ "psrlw $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
+ "pxor %%mm4, %%mm4;" /* zero mm4 */
- "movq %%mm0, %%mm5;" /* Copy B7-B0 */
- "movq %%mm2, %%mm7;" /* Copy G7-G0 */
+ "movq %%mm0, %%mm5;" /* Copy B7-B0 */
+ "movq %%mm2, %%mm7;" /* Copy G7-G0 */
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
- "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
+ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
+ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $3, %%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
- "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
+ "psllw $3, %%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
+ "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
- "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
+ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
+ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $3, %%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "psllw $3, %%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
+ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
YUV2RGB_ENDLOOP(2)
YUV2RGB_OPERANDS
@@ -244,52 +244,52 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStr
YUV422_UNSHIFT
YUV2RGB_LOOP(2)
- c->blueDither = ff_dither8[y&1];
- c->greenDither = ff_dither8[y&1];
- c->redDither = ff_dither8[(y+1)&1];
+ c->blueDither= ff_dither8[y&1];
+ c->greenDither= ff_dither8[y&1];
+ c->redDither= ff_dither8[(y+1)&1];
- YUV2RGB_INIT
- YUV2RGB
+ YUV2RGB_INIT
+ YUV2RGB
#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%4), %%mm0 \n\t"
- "paddusb "GREEN_DITHER"(%4), %%mm2 \n\t"
- "paddusb "RED_DITHER"(%4), %%mm1 \n\t"
+ "paddusb "BLUE_DITHER"(%4), %%mm0 \n\t"
+ "paddusb "GREEN_DITHER"(%4), %%mm2 \n\t"
+ "paddusb "RED_DITHER"(%4), %%mm1 \n\t"
#endif
- /* mask unneeded bits off */
- "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
+ /* mask unneeded bits off */
+ "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
+ "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
+ "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
- "psrlw $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
- "psrlw $1, %%mm1;" /* 0_r7r6r5 r4r3_0_0 0_r7r6r5 r4r3_0_0 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
+ "psrlw $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
+ "psrlw $1, %%mm1;" /* 0_r7r6r5 r4r3_0_0 0_r7r6r5 r4r3_0_0 */
+ "pxor %%mm4, %%mm4;" /* zero mm4 */
- "movq %%mm0, %%mm5;" /* Copy B7-B0 */
- "movq %%mm2, %%mm7;" /* Copy G7-G0 */
+ "movq %%mm0, %%mm5;" /* Copy B7-B0 */
+ "movq %%mm2, %%mm7;" /* Copy G7-G0 */
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
- "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
+ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
+ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
- "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
+ "psllw $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
+ "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
- "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
+ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
+ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "psllw $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "por %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "por %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
+ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
YUV2RGB_ENDLOOP(2)
YUV2RGB_OPERANDS
@@ -303,108 +303,108 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr
YUV422_UNSHIFT
YUV2RGB_LOOP(3)
- YUV2RGB_INIT
- YUV2RGB
- /* mm0=B, %%mm2=G, %%mm1=R */
+ YUV2RGB_INIT
+ YUV2RGB
+ /* mm0=B, %%mm2=G, %%mm1=R */
#if HAVE_MMX2
- "movq "MANGLE(ff_M24A)", %%mm4 \n\t"
- "movq "MANGLE(ff_M24C)", %%mm7 \n\t"
- "pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */
- "pshufw $0x50, %%mm2, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */
- "pshufw $0x00, %%mm1, %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */
-
- "pand %%mm4, %%mm5 \n\t" /* B2 B1 B0 */
- "pand %%mm4, %%mm3 \n\t" /* G2 G1 G0 */
- "pand %%mm7, %%mm6 \n\t" /* R1 R0 */
-
- "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */
- "por %%mm5, %%mm6 \n\t"
- "por %%mm3, %%mm6 \n\t"
- MOVNTQ" %%mm6, (%1) \n\t"
-
- "psrlq $8, %%mm2 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */
- "pshufw $0xA5, %%mm0, %%mm5 \n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */
- "pshufw $0x55, %%mm2, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */
- "pshufw $0xA5, %%mm1, %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */
-
- "pand "MANGLE(ff_M24B)", %%mm5 \n\t" /* B5 B4 B3 */
- "pand %%mm7, %%mm3 \n\t" /* G4 G3 */
- "pand %%mm4, %%mm6 \n\t" /* R4 R3 R2 */
-
- "por %%mm5, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */
- "por %%mm3, %%mm6 \n\t"
- MOVNTQ" %%mm6, 8(%1) \n\t"
-
- "pshufw $0xFF, %%mm0, %%mm5 \n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */
- "pshufw $0xFA, %%mm2, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */
- "pshufw $0xFA, %%mm1, %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
- "pand %%mm7, %%mm5 \n\t" /* B7 B6 */
- "pand %%mm4, %%mm3 \n\t" /* G7 G6 G5 */
- "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7 R6 R5 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- \
- "por %%mm5, %%mm3 \n\t"
- "por %%mm3, %%mm6 \n\t"
- MOVNTQ" %%mm6, 16(%1) \n\t"
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- "pxor %%mm4, %%mm4 \n\t"
+ "movq "MANGLE(ff_M24A)", %%mm4 \n\t"
+ "movq "MANGLE(ff_M24C)", %%mm7 \n\t"
+ "pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */
+ "pshufw $0x50, %%mm2, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */
+ "pshufw $0x00, %%mm1, %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */
+
+ "pand %%mm4, %%mm5 \n\t" /* B2 B1 B0 */
+ "pand %%mm4, %%mm3 \n\t" /* G2 G1 G0 */
+ "pand %%mm7, %%mm6 \n\t" /* R1 R0 */
+
+ "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */
+ "por %%mm5, %%mm6 \n\t"
+ "por %%mm3, %%mm6 \n\t"
+ MOVNTQ" %%mm6, (%1) \n\t"
+
+ "psrlq $8, %%mm2 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */
+ "pshufw $0xA5, %%mm0, %%mm5 \n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */
+ "pshufw $0x55, %%mm2, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */
+ "pshufw $0xA5, %%mm1, %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */
+
+ "pand "MANGLE(ff_M24B)", %%mm5 \n\t" /* B5 B4 B3 */
+ "pand %%mm7, %%mm3 \n\t" /* G4 G3 */
+ "pand %%mm4, %%mm6 \n\t" /* R4 R3 R2 */
+
+ "por %%mm5, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */
+ "por %%mm3, %%mm6 \n\t"
+ MOVNTQ" %%mm6, 8(%1) \n\t"
+
+ "pshufw $0xFF, %%mm0, %%mm5 \n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */
+ "pshufw $0xFA, %%mm2, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */
+ "pshufw $0xFA, %%mm1, %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+
+ "pand %%mm7, %%mm5 \n\t" /* B7 B6 */
+ "pand %%mm4, %%mm3 \n\t" /* G7 G6 G5 */
+ "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7 R6 R5 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+\
+ "por %%mm5, %%mm3 \n\t"
+ "por %%mm3, %%mm6 \n\t"
+ MOVNTQ" %%mm6, 16(%1) \n\t"
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ "pxor %%mm4, %%mm4 \n\t"
#else
- "pxor %%mm4, %%mm4 \n\t"
- "movq %%mm0, %%mm5 \n\t" /* B */
- "movq %%mm1, %%mm6 \n\t" /* R */
- "punpcklbw %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */
- "punpcklbw %%mm4, %%mm1 \n\t" /* 0R0R0R0R 0 */
- "punpckhbw %%mm2, %%mm5 \n\t" /* GBGBGBGB 2 */
- "punpckhbw %%mm4, %%mm6 \n\t" /* 0R0R0R0R 2 */
- "movq %%mm0, %%mm7 \n\t" /* GBGBGBGB 0 */
- "movq %%mm5, %%mm3 \n\t" /* GBGBGBGB 2 */
- "punpcklwd %%mm1, %%mm7 \n\t" /* 0RGB0RGB 0 */
- "punpckhwd %%mm1, %%mm0 \n\t" /* 0RGB0RGB 1 */
- "punpcklwd %%mm6, %%mm5 \n\t" /* 0RGB0RGB 2 */
- "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */
-
- "movq %%mm7, %%mm2 \n\t" /* 0RGB0RGB 0 */
- "movq %%mm0, %%mm6 \n\t" /* 0RGB0RGB 1 */
- "movq %%mm5, %%mm1 \n\t" /* 0RGB0RGB 2 */
- "movq %%mm3, %%mm4 \n\t" /* 0RGB0RGB 3 */
-
- "psllq $40, %%mm7 \n\t" /* RGB00000 0 */
- "psllq $40, %%mm0 \n\t" /* RGB00000 1 */
- "psllq $40, %%mm5 \n\t" /* RGB00000 2 */
- "psllq $40, %%mm3 \n\t" /* RGB00000 3 */
-
- "punpckhdq %%mm2, %%mm7 \n\t" /* 0RGBRGB0 0 */
- "punpckhdq %%mm6, %%mm0 \n\t" /* 0RGBRGB0 1 */
- "punpckhdq %%mm1, %%mm5 \n\t" /* 0RGBRGB0 2 */
- "punpckhdq %%mm4, %%mm3 \n\t" /* 0RGBRGB0 3 */
-
- "psrlq $8, %%mm7 \n\t" /* 00RGBRGB 0 */
- "movq %%mm0, %%mm6 \n\t" /* 0RGBRGB0 1 */
- "psllq $40, %%mm0 \n\t" /* GB000000 1 */
- "por %%mm0, %%mm7 \n\t" /* GBRGBRGB 0 */
- MOVNTQ" %%mm7, (%1) \n\t"
-
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
- "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */
- "movq %%mm5, %%mm1 \n\t" /* 0RGBRGB0 2 */
- "psllq $24, %%mm5 \n\t" /* BRGB0000 2 */
- "por %%mm5, %%mm6 \n\t" /* BRGBRGBR 1 */
- MOVNTQ" %%mm6, 8(%1) \n\t"
-
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
-
- "psrlq $40, %%mm1 \n\t" /* 000000RG 2 */
- "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */
- "por %%mm3, %%mm1 \n\t" /* RGBRGBRG 2 */
- MOVNTQ" %%mm1, 16(%1) \n\t"
-
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "pxor %%mm4, %%mm4 \n\t"
+ "pxor %%mm4, %%mm4 \n\t"
+ "movq %%mm0, %%mm5 \n\t" /* B */
+ "movq %%mm1, %%mm6 \n\t" /* R */
+ "punpcklbw %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */
+ "punpcklbw %%mm4, %%mm1 \n\t" /* 0R0R0R0R 0 */
+ "punpckhbw %%mm2, %%mm5 \n\t" /* GBGBGBGB 2 */
+ "punpckhbw %%mm4, %%mm6 \n\t" /* 0R0R0R0R 2 */
+ "movq %%mm0, %%mm7 \n\t" /* GBGBGBGB 0 */
+ "movq %%mm5, %%mm3 \n\t" /* GBGBGBGB 2 */
+ "punpcklwd %%mm1, %%mm7 \n\t" /* 0RGB0RGB 0 */
+ "punpckhwd %%mm1, %%mm0 \n\t" /* 0RGB0RGB 1 */
+ "punpcklwd %%mm6, %%mm5 \n\t" /* 0RGB0RGB 2 */
+ "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */
+
+ "movq %%mm7, %%mm2 \n\t" /* 0RGB0RGB 0 */
+ "movq %%mm0, %%mm6 \n\t" /* 0RGB0RGB 1 */
+ "movq %%mm5, %%mm1 \n\t" /* 0RGB0RGB 2 */
+ "movq %%mm3, %%mm4 \n\t" /* 0RGB0RGB 3 */
+
+ "psllq $40, %%mm7 \n\t" /* RGB00000 0 */
+ "psllq $40, %%mm0 \n\t" /* RGB00000 1 */
+ "psllq $40, %%mm5 \n\t" /* RGB00000 2 */
+ "psllq $40, %%mm3 \n\t" /* RGB00000 3 */
+
+ "punpckhdq %%mm2, %%mm7 \n\t" /* 0RGBRGB0 0 */
+ "punpckhdq %%mm6, %%mm0 \n\t" /* 0RGBRGB0 1 */
+ "punpckhdq %%mm1, %%mm5 \n\t" /* 0RGBRGB0 2 */
+ "punpckhdq %%mm4, %%mm3 \n\t" /* 0RGBRGB0 3 */
+
+ "psrlq $8, %%mm7 \n\t" /* 00RGBRGB 0 */
+ "movq %%mm0, %%mm6 \n\t" /* 0RGBRGB0 1 */
+ "psllq $40, %%mm0 \n\t" /* GB000000 1 */
+ "por %%mm0, %%mm7 \n\t" /* GBRGBRGB 0 */
+ MOVNTQ" %%mm7, (%1) \n\t"
+
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+
+ "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */
+ "movq %%mm5, %%mm1 \n\t" /* 0RGBRGB0 2 */
+ "psllq $24, %%mm5 \n\t" /* BRGB0000 2 */
+ "por %%mm5, %%mm6 \n\t" /* BRGBRGBR 1 */
+ MOVNTQ" %%mm6, 8(%1) \n\t"
+
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+
+ "psrlq $40, %%mm1 \n\t" /* 000000RG 2 */
+ "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */
+ "por %%mm3, %%mm1 \n\t" /* RGBRGBRG 2 */
+ MOVNTQ" %%mm1, 16(%1) \n\t"
+
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "pxor %%mm4, %%mm4 \n\t"
#endif
YUV2RGB_ENDLOOP(3)
@@ -471,7 +471,7 @@ etc.
\
"pxor %%mm4, %%mm4;" /* zero mm4 */ \
"movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
-
+
static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
@@ -480,10 +480,10 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStr
YUV422_UNSHIFT
YUV2RGB_LOOP(4)
- YUV2RGB_INIT
- YUV2RGB
- "pcmpeqd %%mm3, %%mm3;" /* fill mm3 */
- RGB_PLANAR2PACKED32(REG_RED, REG_GREEN, REG_BLUE, REG_ALPHA)
+ YUV2RGB_INIT
+ YUV2RGB
+ "pcmpeqd %%mm3, %%mm3;" /* fill mm3 */
+ RGB_PLANAR2PACKED32(REG_RED,REG_GREEN,REG_BLUE,REG_ALPHA)
YUV2RGB_ENDLOOP(4)
YUV2RGB_OPERANDS
@@ -497,11 +497,11 @@ static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcSt
YUV2RGB_LOOP(4)
- uint8_t *pa = src[3] + y * srcStride[3];
- YUV2RGB_INIT
- YUV2RGB
- "movq (%6, %0, 2), %%mm3;" /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
- RGB_PLANAR2PACKED32(REG_RED, REG_GREEN, REG_BLUE, REG_ALPHA)
+ uint8_t *pa = src[3] + y*srcStride[3];
+ YUV2RGB_INIT
+ YUV2RGB
+ "movq (%6, %0, 2), %%mm3;" /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
+ RGB_PLANAR2PACKED32(REG_RED,REG_GREEN,REG_BLUE,REG_ALPHA)
YUV2RGB_ENDLOOP(4)
YUV2RGB_OPERANDS_ALPHA
@@ -516,10 +516,10 @@ static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t* src[], int
YUV422_UNSHIFT
YUV2RGB_LOOP(4)
- YUV2RGB_INIT
- YUV2RGB
- "pcmpeqd %%mm3, %%mm3;" /* fill mm3 */
- RGB_PLANAR2PACKED32(REG_BLUE, REG_GREEN, REG_RED, REG_ALPHA)
+ YUV2RGB_INIT
+ YUV2RGB
+ "pcmpeqd %%mm3, %%mm3;" /* fill mm3 */
+ RGB_PLANAR2PACKED32(REG_BLUE,REG_GREEN,REG_RED,REG_ALPHA)
YUV2RGB_ENDLOOP(4)
YUV2RGB_OPERANDS
@@ -533,11 +533,11 @@ static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t* src[], int
YUV2RGB_LOOP(4)
- uint8_t *pa = src[3] + y * srcStride[3];
- YUV2RGB_INIT
- YUV2RGB
- "movq (%6, %0, 2), %%mm3;" /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
- RGB_PLANAR2PACKED32(REG_BLUE, REG_GREEN, REG_RED, REG_ALPHA)
+ uint8_t *pa = src[3] + y*srcStride[3];
+ YUV2RGB_INIT
+ YUV2RGB
+ "movq (%6, %0, 2), %%mm3;" /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
+ RGB_PLANAR2PACKED32(REG_BLUE,REG_GREEN,REG_RED,REG_ALPHA)
YUV2RGB_ENDLOOP(4)
YUV2RGB_OPERANDS_ALPHA
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb.c
index 3faa447d5..742fd6aad 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb.c
@@ -50,9 +50,9 @@ 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;
-uint64_t attribute_used __attribute__((aligned(8))) M24A = 0x00FF0000FF0000FFULL;
-uint64_t attribute_used __attribute__((aligned(8))) M24B = 0xFF0000FF0000FF00ULL;
-uint64_t attribute_used __attribute__((aligned(8))) M24C = 0x0000FF0000FF0000ULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24A= 0x00FF0000FF0000FFULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24B= 0xFF0000FF0000FF00ULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24C= 0x0000FF0000FF0000ULL;
// the volatile is required because gcc otherwise optimizes some writes away not knowing that these
// are read in the asm block
@@ -84,9 +84,8 @@ extern const uint64_t dither8[2];
#endif /* ARCH_X86_32 || ARCH_X86_64 */
-const int32_t Inverse_Table_6_9[8][7] =
-{
-// { crv, cbu, cgu, cgv, cy, oy, RGB_add} /* dived by 65536 to get familiar values */
+const int32_t Inverse_Table_6_9[8][7] = {
+ // { crv, cbu, cgu, cgv, cy, oy, RGB_add} /* dived by 65536 to get familiar values */
{117504, 138453, 13954, 34903, 76309, 1048576, 0}, /* no sequence_display_extension */
{117504, 138453, 13954, 34903, 76309, 1048576, 0}, /* ITU-R Rec. 709 (1990) */
{104597, 132201, 25675, 53279, 76309, 1048576, 0}, /* unspecified */
@@ -160,7 +159,7 @@ static int func_name(SwsContext *c, uint8_t* src[], stride_t srcStride[], int sr
unsigned int h_size= c->dstW>>3;\
while (h_size--) {\
int U, V, Y;\
-
+
#define EPILOG(dst_delta)\
pu += 4;\
pv += 4;\
@@ -174,104 +173,104 @@ static int func_name(SwsContext *c, uint8_t* src[], stride_t srcStride[], int sr
}
PROLOG(yuv2rgb_c_32, uint32_t)
-RGB(0);
-DST1(0);
-DST2(0);
+ RGB(0);
+ DST1(0);
+ DST2(0);
-RGB(1);
-DST2(1);
-DST1(1);
+ RGB(1);
+ DST2(1);
+ DST1(1);
-RGB(2);
-DST1(2);
-DST2(2);
+ RGB(2);
+ DST1(2);
+ DST2(2);
-RGB(3);
-DST2(3);
-DST1(3);
+ RGB(3);
+ DST2(3);
+ DST1(3);
EPILOG(8)
PROLOG(yuv2rgb_c_24_rgb, uint8_t)
-RGB(0);
-DST1RGB(0);
-DST2RGB(0);
+ RGB(0);
+ DST1RGB(0);
+ DST2RGB(0);
-RGB(1);
-DST2RGB(1);
-DST1RGB(1);
+ RGB(1);
+ DST2RGB(1);
+ DST1RGB(1);
-RGB(2);
-DST1RGB(2);
-DST2RGB(2);
+ RGB(2);
+ DST1RGB(2);
+ DST2RGB(2);
-RGB(3);
-DST2RGB(3);
-DST1RGB(3);
+ RGB(3);
+ DST2RGB(3);
+ DST1RGB(3);
EPILOG(24)
// only trivial mods from yuv2rgb_c_24_rgb
PROLOG(yuv2rgb_c_24_bgr, uint8_t)
-RGB(0);
-DST1BGR(0);
-DST2BGR(0);
+ RGB(0);
+ DST1BGR(0);
+ DST2BGR(0);
-RGB(1);
-DST2BGR(1);
-DST1BGR(1);
+ RGB(1);
+ DST2BGR(1);
+ DST1BGR(1);
-RGB(2);
-DST1BGR(2);
-DST2BGR(2);
+ RGB(2);
+ DST1BGR(2);
+ DST2BGR(2);
-RGB(3);
-DST2BGR(3);
-DST1BGR(3);
+ RGB(3);
+ DST2BGR(3);
+ DST1BGR(3);
EPILOG(24)
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_16, uint16_t)
-RGB(0);
-DST1(0);
-DST2(0);
+ RGB(0);
+ DST1(0);
+ DST2(0);
-RGB(1);
-DST2(1);
-DST1(1);
+ RGB(1);
+ DST2(1);
+ DST1(1);
-RGB(2);
-DST1(2);
-DST2(2);
+ RGB(2);
+ DST1(2);
+ DST2(2);
-RGB(3);
-DST2(3);
-DST1(3);
+ RGB(3);
+ DST2(3);
+ DST1(3);
EPILOG(8)
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_8, uint8_t)
-RGB(0);
-DST1(0);
-DST2(0);
+ RGB(0);
+ DST1(0);
+ DST2(0);
-RGB(1);
-DST2(1);
-DST1(1);
+ RGB(1);
+ DST2(1);
+ DST1(1);
-RGB(2);
-DST1(2);
-DST2(2);
+ RGB(2);
+ DST1(2);
+ DST2(2);
-RGB(3);
-DST2(3);
-DST1(3);
+ RGB(3);
+ DST2(3);
+ DST1(3);
EPILOG(8)
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_8_ordered_dither, uint8_t)
-const uint8_t *d32 = dither_8x8_32[y&7];
-const uint8_t *d64 = dither_8x8_73[y&7];
+ const uint8_t *d32= dither_8x8_32[y&7];
+ const uint8_t *d64= dither_8x8_73[y&7];
#define DST1bpp8(i,o) \
Y = py_1[2*i]; \
dst_1[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \
@@ -285,28 +284,28 @@ const uint8_t *d64 = dither_8x8_73[y&7];
dst_2[2*i+1] = r[Y+d32[9+o]] + g[Y+d32[9+o]] + b[Y+d64[9+o]];
-RGB(0);
-DST1bpp8(0, 0);
-DST2bpp8(0, 0);
+ RGB(0);
+ DST1bpp8(0,0);
+ DST2bpp8(0,0);
-RGB(1);
-DST2bpp8(1, 2);
-DST1bpp8(1, 2);
+ RGB(1);
+ DST2bpp8(1,2);
+ DST1bpp8(1,2);
-RGB(2);
-DST1bpp8(2, 4);
-DST2bpp8(2, 4);
+ RGB(2);
+ DST1bpp8(2,4);
+ DST2bpp8(2,4);
-RGB(3);
-DST2bpp8(3, 6);
-DST1bpp8(3, 6);
+ RGB(3);
+ DST2bpp8(3,6);
+ DST1bpp8(3,6);
EPILOG(8)
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_4, uint8_t)
-int acc;
+ int acc;
#define DST1_4(i) \
Y = py_1[2*i]; \
acc = r[Y] + g[Y] + b[Y]; \
@@ -321,27 +320,27 @@ int acc;
acc |= (r[Y] + g[Y] + b[Y])<<4;\
dst_2[i] = acc;
-RGB(0);
-DST1_4(0);
-DST2_4(0);
+ RGB(0);
+ DST1_4(0);
+ DST2_4(0);
-RGB(1);
-DST2_4(1);
-DST1_4(1);
+ RGB(1);
+ DST2_4(1);
+ DST1_4(1);
-RGB(2);
-DST1_4(2);
-DST2_4(2);
+ RGB(2);
+ DST1_4(2);
+ DST2_4(2);
-RGB(3);
-DST2_4(3);
-DST1_4(3);
+ RGB(3);
+ DST2_4(3);
+ DST1_4(3);
EPILOG(4)
PROLOG(yuv2rgb_c_4_ordered_dither, uint8_t)
-const uint8_t *d64 = dither_8x8_73[y&7];
-const uint8_t *d128 = dither_8x8_220[y&7];
-int acc;
+ const uint8_t *d64= dither_8x8_73[y&7];
+ const uint8_t *d128=dither_8x8_220[y&7];
+ int acc;
#define DST1bpp4(i,o) \
Y = py_1[2*i]; \
@@ -358,46 +357,46 @@ int acc;
dst_2[i]= acc;
-RGB(0);
-DST1bpp4(0, 0);
-DST2bpp4(0, 0);
+ RGB(0);
+ DST1bpp4(0,0);
+ DST2bpp4(0,0);
-RGB(1);
-DST2bpp4(1, 2);
-DST1bpp4(1, 2);
+ RGB(1);
+ DST2bpp4(1,2);
+ DST1bpp4(1,2);
-RGB(2);
-DST1bpp4(2, 4);
-DST2bpp4(2, 4);
+ RGB(2);
+ DST1bpp4(2,4);
+ DST2bpp4(2,4);
-RGB(3);
-DST2bpp4(3, 6);
-DST1bpp4(3, 6);
+ RGB(3);
+ DST2bpp4(3,6);
+ DST1bpp4(3,6);
EPILOG(4)
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_4b, uint8_t)
-RGB(0);
-DST1(0);
-DST2(0);
+ RGB(0);
+ DST1(0);
+ DST2(0);
-RGB(1);
-DST2(1);
-DST1(1);
+ RGB(1);
+ DST2(1);
+ DST1(1);
-RGB(2);
-DST1(2);
-DST2(2);
+ RGB(2);
+ DST1(2);
+ DST2(2);
-RGB(3);
-DST2(3);
-DST1(3);
+ RGB(3);
+ DST2(3);
+ DST1(3);
EPILOG(8)
PROLOG(yuv2rgb_c_4b_ordered_dither, uint8_t)
-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];
#define DST1bpp4b(i,o) \
Y = py_1[2*i]; \
@@ -412,27 +411,27 @@ const uint8_t *d128 = dither_8x8_220[y&7];
dst_2[2*i+1] = r[Y+d128[9+o]] + g[Y+d64[9+o]] + b[Y+d128[9+o]];
-RGB(0);
-DST1bpp4b(0, 0);
-DST2bpp4b(0, 0);
+ RGB(0);
+ DST1bpp4b(0,0);
+ DST2bpp4b(0,0);
-RGB(1);
-DST2bpp4b(1, 2);
-DST1bpp4b(1, 2);
+ RGB(1);
+ DST2bpp4b(1,2);
+ DST1bpp4b(1,2);
-RGB(2);
-DST1bpp4b(2, 4);
-DST2bpp4b(2, 4);
+ RGB(2);
+ DST1bpp4b(2,4);
+ DST2bpp4b(2,4);
-RGB(3);
-DST2bpp4b(3, 6);
-DST1bpp4b(3, 6);
+ RGB(3);
+ DST2bpp4b(3,6);
+ DST1bpp4b(3,6);
EPILOG(8)
PROLOG(yuv2rgb_c_1_ordered_dither, uint8_t)
-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 DST1bpp1(i,o) \
Y = py_1[2*i]; \
@@ -446,114 +445,93 @@ g = c->table_gU[128] + c->table_gV[128];
Y = py_2[2*i+1]; \
out_2+= out_2 + g[Y+d128[9+o]];
-DST1bpp1(0, 0);
-DST2bpp1(0, 0);
+ DST1bpp1(0,0);
+ DST2bpp1(0,0);
-DST2bpp1(1, 2);
-DST1bpp1(1, 2);
+ DST2bpp1(1,2);
+ DST1bpp1(1,2);
-DST1bpp1(2, 4);
-DST2bpp1(2, 4);
+ DST1bpp1(2,4);
+ DST2bpp1(2,4);
-DST2bpp1(3, 6);
-DST1bpp1(3, 6);
+ DST2bpp1(3,6);
+ DST1bpp1(3,6);
-dst_1[0] = out_1;
-dst_2[0] = out_2;
+ dst_1[0]= out_1;
+ dst_2[0]= out_2;
EPILOG(1)
-SwsFunc yuv2rgb_get_func_ptr(SwsContext *c)
+SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
{
#if ARCH_X86 || ARCH_X86_64
- if(c->params.cpu & SWS_CPU_CAPS_MMX2)
- {
- switch(c->dstFormat)
- {
- case IMGFMT_BGR32:
- return yuv420_rgb32_MMX2;
- case IMGFMT_BGR24:
- return yuv420_rgb24_MMX2;
- case IMGFMT_BGR16:
- return yuv420_rgb16_MMX2;
- case IMGFMT_BGR15:
- return yuv420_rgb15_MMX2;
- }
+ if(c->params.cpu & SWS_CPU_CAPS_MMX2){
+ switch(c->dstFormat){
+ case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
+ case IMGFMT_BGR24: return yuv420_rgb24_MMX2;
+ case IMGFMT_BGR16: return yuv420_rgb16_MMX2;
+ case IMGFMT_BGR15: return yuv420_rgb15_MMX2;
+ }
}
- if(c->params.cpu & SWS_CPU_CAPS_MMX)
- {
- switch(c->dstFormat)
- {
- case IMGFMT_BGR32:
- return yuv420_rgb32_MMX;
- case IMGFMT_BGR24:
- return yuv420_rgb24_MMX;
- case IMGFMT_BGR16:
- return yuv420_rgb16_MMX;
- case IMGFMT_BGR15:
- return yuv420_rgb15_MMX;
- }
+ if(c->params.cpu & SWS_CPU_CAPS_MMX){
+ switch(c->dstFormat){
+ case IMGFMT_BGR32: return yuv420_rgb32_MMX;
+ case IMGFMT_BGR24: return yuv420_rgb24_MMX;
+ case IMGFMT_BGR16: return yuv420_rgb16_MMX;
+ case IMGFMT_BGR15: return yuv420_rgb15_MMX;
+ }
}
#endif
#ifdef HAVE_MLIB
{
- SwsFunc t = yuv2rgb_init_mlib(c);
- if(t) return t;
- }
+ SwsFunc t= yuv2rgb_init_mlib(c);
+ if(t) return t;
+}
#endif
#ifdef HAVE_ALTIVEC
- if(c->params.cpu & SWS_CPU_CAPS_ALTIVEC)
+ if (c->params.cpu & SWS_CPU_CAPS_ALTIVEC)
{
- SwsFunc t = yuv2rgb_init_altivec(c);
- if(t) return t;
+ SwsFunc t = yuv2rgb_init_altivec(c);
+ if(t) return t;
}
#endif
MSG_WARN("No accelerated colorspace conversion found\n");
- switch(c->dstFormat)
- {
+ switch(c->dstFormat){
case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- return yuv2rgb_c_32;
- case IMGFMT_RGB24:
- return yuv2rgb_c_24_rgb;
- case IMGFMT_BGR24:
- return yuv2rgb_c_24_bgr;
+ case IMGFMT_BGR32: return yuv2rgb_c_32;
+ case IMGFMT_RGB24: return yuv2rgb_c_24_rgb;
+ case IMGFMT_BGR24: return yuv2rgb_c_24_bgr;
case IMGFMT_RGB16:
case IMGFMT_BGR16:
case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- return yuv2rgb_c_16;
+ case IMGFMT_BGR15: return yuv2rgb_c_16;
case IMGFMT_RGB8:
- case IMGFMT_BGR8:
- return yuv2rgb_c_8_ordered_dither;
+ case IMGFMT_BGR8: return yuv2rgb_c_8_ordered_dither;
case IMGFMT_RGB4:
- case IMGFMT_BGR4:
- return yuv2rgb_c_4_ordered_dither;
+ case IMGFMT_BGR4: return yuv2rgb_c_4_ordered_dither;
case IMGFMT_RG4B:
- case IMGFMT_BG4B:
- return yuv2rgb_c_4b_ordered_dither;
+ case IMGFMT_BG4B: return yuv2rgb_c_4b_ordered_dither;
case IMGFMT_RGB1:
- case IMGFMT_BGR1:
- return yuv2rgb_c_1_ordered_dither;
+ case IMGFMT_BGR1: return yuv2rgb_c_1_ordered_dither;
default:
- assert(0);
+ assert(0);
}
return NULL;
}
-static int div_round(int dividend, int divisor)
+static int div_round (int dividend, int divisor)
{
- if(dividend > 0)
- return (dividend + (divisor >> 1)) / divisor;
+ if (dividend > 0)
+ return (dividend + (divisor>>1)) / divisor;
else
- return -((-dividend + (divisor >> 1)) / divisor);
+ return -((-dividend + (divisor>>1)) / divisor);
}
-int yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[7], int fullRange, int brightness, int contrast, int saturation)
+int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[7], int fullRange, int brightness, int contrast, int saturation)
{
const int isRgb = IMGFMT_IS_BGR(c->dstFormat);
- const int bpp = isRgb ? IMGFMT_RGB_DEPTH(c->dstFormat) : IMGFMT_BGR_DEPTH(c->dstFormat);
+ const int bpp = isRgb?IMGFMT_RGB_DEPTH(c->dstFormat):IMGFMT_BGR_DEPTH(c->dstFormat);
int i;
uint8_t table_Y[1024];
uint32_t *table_32 = 0;
@@ -576,188 +554,175 @@ int yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[7], int fullRange,
//printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv);
- cy = (cy * contrast) >> 16;
- crv = (crv * contrast * saturation) >> 32;
- cbu = (cbu * contrast * saturation) >> 32;
- cgu = (cgu * contrast * saturation) >> 32;
- cgv = (cgv * contrast * saturation) >> 32;
+ cy = (cy *contrast )>>16;
+ crv= (crv*contrast * saturation)>>32;
+ cbu= (cbu*contrast * saturation)>>32;
+ cgu= (cgu*contrast * saturation)>>32;
+ cgv= (cgv*contrast * saturation)>>32;
//printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv);
- oy -= 256 * brightness;
+ oy -= 256*brightness;
- for(i = 0; i < 1024; i++)
- {
+ for (i = 0; i < 1024; i++) {
int j;
- j = ((cy * (((i - 384) << 16) - oy) + (1 << 31))>>32) + rgb_add;
+ j= ((cy*(((i - 384)<<16) - oy) + (1<<31))>>32) + rgb_add;
j = (j < 0) ? 0 : ((j > 255) ? 255 : j);
table_Y[i] = j;
}
- switch(bpp)
- {
+ switch (bpp) {
case 32:
- table_start = table_32 = av_malloc((197 + 2 * 682 + 256 + 132) * sizeof(uint32_t));
+ table_start= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));
- entry_size = sizeof(uint32_t);
+ entry_size = sizeof (uint32_t);
table_r = table_32 + 197;
table_b = table_32 + 197 + 685;
- table_g = table_32 + 197 + 2 * 682;
+ table_g = table_32 + 197 + 2*682;
- for(i = -197; i < 256 + 197; i++)
- ((uint32_t *)table_r)[i] = table_Y[i+384] << (isRgb ? 16 : 0);
- for(i = -132; i < 256 + 132; i++)
+ for (i = -197; i < 256+197; i++)
+ ((uint32_t *)table_r)[i] = table_Y[i+384] << (isRgb ? 16 : 0);
+ for (i = -132; i < 256+132; i++)
((uint32_t *)table_g)[i] = table_Y[i+384] << 8;
- for(i = -232; i < 256 + 232; i++)
- ((uint32_t *)table_b)[i] = table_Y[i+384] << (isRgb ? 0 : 16);
+ for (i = -232; i < 256+232; i++)
+ ((uint32_t *)table_b)[i] = table_Y[i+384] << (isRgb ? 0 : 16);
break;
case 24:
- table_start = table_8 = av_malloc((256 + 2 * 232) * sizeof(uint8_t));
+ table_start= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t));
- entry_size = sizeof(uint8_t);
+ entry_size = sizeof (uint8_t);
table_r = table_g = table_b = table_8 + 232;
- for(i = -232; i < 256 + 232; i++)
- ((uint8_t *)table_b)[i] = table_Y[i+384];
+ for (i = -232; i < 256+232; i++)
+ ((uint8_t * )table_b)[i] = table_Y[i+384];
break;
case 15:
case 16:
- table_start = table_16 = av_malloc((197 + 2 * 682 + 256 + 132) * sizeof(uint16_t));
+ table_start= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));
- entry_size = sizeof(uint16_t);
+ entry_size = sizeof (uint16_t);
table_r = table_16 + 197;
table_b = table_16 + 197 + 685;
- table_g = table_16 + 197 + 2 * 682;
+ table_g = table_16 + 197 + 2*682;
- for(i = -197; i < 256 + 197; i++)
- {
+ for (i = -197; i < 256+197; i++) {
int j = table_Y[i+384] >> 3;
- if(isRgb)
- j <<= ((bpp == 16) ? 11 : 10);
+ if (isRgb)
+ j <<= ((bpp==16) ? 11 : 10);
((uint16_t *)table_r)[i] = j;
}
- for(i = -132; i < 256 + 132; i++)
- {
- int j = table_Y[i+384] >> ((bpp == 16) ? 2 : 3);
+ for (i = -132; i < 256+132; i++) {
+ int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3);
((uint16_t *)table_g)[i] = j << 5;
}
- for(i = -232; i < 256 + 232; i++)
- {
+ for (i = -232; i < 256+232; i++) {
int j = table_Y[i+384] >> 3;
- if(!isRgb)
- j <<= ((bpp == 16) ? 11 : 10);
+ if (!isRgb)
+ j <<= ((bpp==16) ? 11 : 10);
((uint16_t *)table_b)[i] = j;
}
break;
case 8:
- table_start = table_332 = av_malloc((197 + 2 * 682 + 256 + 132) * sizeof(uint8_t));
+ table_start= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
- entry_size = sizeof(uint8_t);
- table_r = table_332 + 197;
- table_b = table_332 + 197 + 685;
- table_g = table_332 + 197 + 2 * 682;
+ entry_size = sizeof (uint8_t);
+ table_r = table_332 + 197;
+ table_b = table_332 + 197 + 685;
+ table_g = table_332 + 197 + 2*682;
- for(i = -197; i < 256 + 197; i++)
- {
- int j = (table_Y[i+384 - 16] + 18) / 36;
+ for (i = -197; i < 256+197; i++) {
+ int j = (table_Y[i+384 - 16] + 18)/36;
- if(isRgb)
- j <<= 5;
+ if (isRgb)
+ j <<= 5;
- ((uint8_t *)table_r)[i] = j;
- }
- for(i = -132; i < 256 + 132; i++)
- {
- int j = (table_Y[i+384 - 16] + 18) / 36;
+ ((uint8_t *)table_r)[i] = j;
+ }
+ for (i = -132; i < 256+132; i++) {
+ int j = (table_Y[i+384 - 16] + 18)/36;
- if(!isRgb)
- j <<= 1;
+ if (!isRgb)
+ j <<= 1;
- ((uint8_t *)table_g)[i] = j << 2;
- }
- for(i = -232; i < 256 + 232; i++)
- {
- int j = (table_Y[i+384 - 37] + 43) / 85;
+ ((uint8_t *)table_g)[i] = j << 2;
+ }
+ for (i = -232; i < 256+232; i++) {
+ int j = (table_Y[i+384 - 37] + 43)/85;
- if(!isRgb)
- j <<= 6;
+ if (!isRgb)
+ j <<= 6;
- ((uint8_t *)table_b)[i] = j;
- }
- break;
+ ((uint8_t *)table_b)[i] = j;
+ }
+ break;
case 4:
case 4|128:
- table_start = table_121 = av_malloc((197 + 2 * 682 + 256 + 132) * sizeof(uint8_t));
+ table_start= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
- entry_size = sizeof(uint8_t);
- table_r = table_121 + 197;
- table_b = table_121 + 197 + 685;
- table_g = table_121 + 197 + 2 * 682;
+ entry_size = sizeof (uint8_t);
+ table_r = table_121 + 197;
+ table_b = table_121 + 197 + 685;
+ table_g = table_121 + 197 + 2*682;
- for(i = -197; i < 256 + 197; i++)
- {
- int j = table_Y[i+384 - 110] >> 7;
+ for (i = -197; i < 256+197; i++) {
+ int j = table_Y[i+384 - 110] >> 7;
- if(isRgb)
- j <<= 3;
+ if (isRgb)
+ j <<= 3;
- ((uint8_t *)table_r)[i] = j;
- }
- for(i = -132; i < 256 + 132; i++)
- {
- int j = (table_Y[i+384 - 37] + 43) / 85;
+ ((uint8_t *)table_r)[i] = j;
+ }
+ for (i = -132; i < 256+132; i++) {
+ int j = (table_Y[i+384 - 37]+ 43)/85;
- ((uint8_t *)table_g)[i] = j << 1;
- }
- for(i = -232; i < 256 + 232; i++)
- {
- int j = table_Y[i+384 - 110] >> 7;
+ ((uint8_t *)table_g)[i] = j << 1;
+ }
+ for (i = -232; i < 256+232; i++) {
+ int j =table_Y[i+384 - 110] >> 7;
- if(!isRgb)
- j <<= 3;
+ if (!isRgb)
+ j <<= 3;
- ((uint8_t *)table_b)[i] = j;
- }
- break;
+ ((uint8_t *)table_b)[i] = j;
+ }
+ break;
case 1:
- table_start = table_1 = av_malloc(256 * 2 * sizeof(uint8_t));
+ table_start= table_1 = av_malloc (256*2 * sizeof (uint8_t));
- entry_size = sizeof(uint8_t);
- table_g = table_1;
- table_r = table_b = NULL;
+ entry_size = sizeof (uint8_t);
+ table_g = table_1;
+ table_r = table_b = NULL;
- for(i = 0; i < 256 + 256; i++)
- {
- int j = table_Y[i + 384 - 110] >> 7;
+ for (i = 0; i < 256+256; i++) {
+ int j = table_Y[i + 384 - 110]>>7;
- ((uint8_t *)table_g)[i] = j;
- }
- break;
+ ((uint8_t *)table_g)[i] = j;
+ }
+ break;
default:
- table_start = NULL;
- MSG_ERR("%ibpp not supported by yuv2rgb\n", bpp);
- //free mem?
- return -1;
+ table_start= NULL;
+ MSG_ERR("%ibpp not supported by yuv2rgb\n", bpp);
+ //free mem?
+ return -1;
}
- for(i = 0; i < 256; i++)
- {
- c->table_rV[i] = table_r + entry_size * div_round(crv * (i - 128), 76309);
- c->table_gU[i] = table_g + entry_size * div_round(cgu * (i - 128), 76309);
- c->table_gV[i] = entry_size * div_round(cgv * (i - 128), 76309);
- c->table_bU[i] = table_b + entry_size * div_round(cbu * (i - 128), 76309);
+ for (i = 0; i < 256; i++) {
+ c->table_rV[i] = table_r + entry_size * div_round (crv * (i-128), 76309);
+ c->table_gU[i] = table_g + entry_size * div_round (cgu * (i-128), 76309);
+ c->table_gV[i] = entry_size * div_round (cgv * (i-128), 76309);
+ c->table_bU[i] = table_b + entry_size * div_round (cbu * (i-128), 76309);
}
if(c->yuvTable) av_free(c->yuvTable);
- c->yuvTable = table_start;
+ c->yuvTable= table_start;
return 0;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb_template.c
index 9eb692287..4cabb1d97 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libswscale/yuv2rgb_template.c
@@ -47,504 +47,492 @@
#define YUV2RGB \
/* Do the multiply part of the conversion for even and odd pixels,
-register usage:
-mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
- mm6 -> Y even, mm7 -> Y odd */\
- /* convert the chroma part */\
- "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
- "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
- \
- "psllw $3, %%mm0;" /* Promote precision */ \
- "psllw $3, %%mm1;" /* Promote precision */ \
- \
- "psubsw "U_OFFSET"(%4), %%mm0;" /* Cb -= 128 */ \
- "psubsw "V_OFFSET"(%4), %%mm1;" /* Cr -= 128 */ \
- \
- "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
- "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
- \
- "pmulhw "UG_COEFF"(%4), %%mm2;" /* Mul Cb with green coeff -> Cb green */ \
- "pmulhw "VG_COEFF"(%4), %%mm3;" /* Mul Cr with green coeff -> Cr green */ \
- \
- "pmulhw "UB_COEFF"(%4), %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */\
- "pmulhw "VR_COEFF"(%4), %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */\
- \
- "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */\
- \
- /* convert the luma part */\
- "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
- "pand "MANGLE(mmx_00ffw)", %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
- \
- "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */\
- \
- "psllw $3, %%mm6;" /* Promote precision */\
- "psllw $3, %%mm7;" /* Promote precision */\
- \
- "psubw "Y_OFFSET"(%4), %%mm6;" /* Y -= 16 */\
- "psubw "Y_OFFSET"(%4), %%mm7;" /* Y -= 16 */\
- \
- "pmulhw "Y_COEFF"(%4), %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */\
- "pmulhw "Y_COEFF"(%4), %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */\
- \
- /* Do the addition part of the conversion for even and odd pixels,
- register usage:
- mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
- mm6 -> Y even, mm7 -> Y odd */\
- "movq %%mm0, %%mm3;" /* Copy Cblue */\
- "movq %%mm1, %%mm4;" /* Copy Cred */\
- "movq %%mm2, %%mm5;" /* Copy Cgreen */\
- \
- "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */\
- "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */\
- \
- "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */\
- "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */\
- \
- "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */\
- "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */\
- \
- /* Limit RGB even to 0..255 */\
- "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */\
- "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */\
- "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */\
- \
- /* Limit RGB odd to 0..255 */\
- "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */\
- "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */\
- "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */\
- \
- /* Interleave RGB even and odd */\
- "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */\
- "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */\
- "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
-
-
- static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
+ register usage:
+ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
+ mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
+ mm6 -> Y even, mm7 -> Y odd */\
+ /* convert the chroma part */\
+ "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
+ "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
+\
+ "psllw $3, %%mm0;" /* Promote precision */ \
+ "psllw $3, %%mm1;" /* Promote precision */ \
+\
+ "psubsw "U_OFFSET"(%4), %%mm0;" /* Cb -= 128 */ \
+ "psubsw "V_OFFSET"(%4), %%mm1;" /* Cr -= 128 */ \
+\
+ "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
+ "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
+\
+ "pmulhw "UG_COEFF"(%4), %%mm2;" /* Mul Cb with green coeff -> Cb green */ \
+ "pmulhw "VG_COEFF"(%4), %%mm3;" /* Mul Cr with green coeff -> Cr green */ \
+\
+ "pmulhw "UB_COEFF"(%4), %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */\
+ "pmulhw "VR_COEFF"(%4), %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */\
+\
+ "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */\
+\
+ /* convert the luma part */\
+ "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
+ "pand "MANGLE(mmx_00ffw)", %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
+\
+ "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */\
+\
+ "psllw $3, %%mm6;" /* Promote precision */\
+ "psllw $3, %%mm7;" /* Promote precision */\
+\
+ "psubw "Y_OFFSET"(%4), %%mm6;" /* Y -= 16 */\
+ "psubw "Y_OFFSET"(%4), %%mm7;" /* Y -= 16 */\
+\
+ "pmulhw "Y_COEFF"(%4), %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */\
+ "pmulhw "Y_COEFF"(%4), %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */\
+\
+ /* Do the addition part of the conversion for even and odd pixels,
+ register usage:
+ mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
+ mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
+ mm6 -> Y even, mm7 -> Y odd */\
+ "movq %%mm0, %%mm3;" /* Copy Cblue */\
+ "movq %%mm1, %%mm4;" /* Copy Cred */\
+ "movq %%mm2, %%mm5;" /* Copy Cgreen */\
+\
+ "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */\
+ "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */\
+\
+ "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */\
+ "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */\
+\
+ "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */\
+ "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */\
+\
+ /* Limit RGB even to 0..255 */\
+ "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */\
+ "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */\
+ "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */\
+\
+ /* Limit RGB odd to 0..255 */\
+ "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */\
+ "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */\
+ "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */\
+\
+ /* Interleave RGB even and odd */\
+ "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */\
+ "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */\
+ "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
+
+
+static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P)
- {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
}
- h_size = (c->dstW + 7)&~7;
- if(h_size * 2 > abs(dstStride[0])) h_size -= 8;
+ h_size= (c->dstW+7)&~7;
+ if(h_size*2 > abs(dstStride[0])) h_size-=8;
- __asm__ __volatile__("pxor %mm4, %mm4;" /* zero mm4 */);
+ __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
//printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0],
//srcStride[0],srcStride[1],srcStride[2],dstStride[0]);
- for(y = 0; y < srcSliceH; y++)
- {
- uint8_t *_image = dst[0] + (y + srcSliceY) * dstStride[0];
- uint8_t *_py = src[0] + y * srcStride[0];
- uint8_t *_pu = src[1] + (y >> 1) * srcStride[1];
- uint8_t *_pv = src[2] + (y >> 1) * srcStride[2];
- stride_t index = -h_size / 2;
-
- b5Dither = dither8[y&1];
- g6Dither = dither4[y&1];
- g5Dither = dither8[y&1];
- r5Dither = dither8[(y+1)&1];
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__(
- /* load data for start of next scan line */
- "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ for (y= 0; y<srcSliceH; y++ ) {
+ uint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];
+ uint8_t *_py = src[0] + y*srcStride[0];
+ uint8_t *_pu = src[1] + (y>>1)*srcStride[1];
+ uint8_t *_pv = src[2] + (y>>1)*srcStride[2];
+ stride_t index= -h_size/2;
+
+ b5Dither= dither8[y&1];
+ g6Dither= dither4[y&1];
+ g5Dither= dither8[y&1];
+ r5Dither= dither8[(y+1)&1];
+ /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
+ pixels in each iteration */
+ __asm__ __volatile__ (
+ /* load data for start of next scan line */
+ "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
// ".balign 16 \n\t"
- "1: \n\t"
- /* no speed diference on my p3@500 with prefetch,
- * if it is faster for anyone with -benchmark then tell me
- PREFETCH" 64(%0) \n\t"
- PREFETCH" 64(%1) \n\t"
- PREFETCH" 64(%2) \n\t"
- */
- YUV2RGB
+ "1: \n\t"
+/* no speed diference on my p3@500 with prefetch,
+ * if it is faster for anyone with -benchmark then tell me
+ PREFETCH" 64(%0) \n\t"
+ PREFETCH" 64(%1) \n\t"
+ PREFETCH" 64(%2) \n\t"
+*/
+YUV2RGB
#ifdef DITHER1XBPP
- "paddusb "MANGLE(b5Dither)", %%mm0;"
- "paddusb "MANGLE(g6Dither)", %%mm2;"
- "paddusb "MANGLE(r5Dither)", %%mm1;"
+ "paddusb "MANGLE(b5Dither)", %%mm0;"
+ "paddusb "MANGLE(g6Dither)", %%mm2;"
+ "paddusb "MANGLE(r5Dither)", %%mm1;"
#endif
- /* mask unneeded bits off */
- "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
- "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
+ /* mask unneeded bits off */
+ "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
+ "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
+ "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
- "psrlw $3,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
+ "psrlw $3,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
+ "pxor %%mm4, %%mm4;" /* zero mm4 */
- "movq %%mm0, %%mm5;" /* Copy B7-B0 */
- "movq %%mm2, %%mm7;" /* Copy G7-G0 */
+ "movq %%mm0, %%mm5;" /* Copy B7-B0 */
+ "movq %%mm2, %%mm7;" /* Copy G7-G0 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
- "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
- "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
+ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $3, %%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
- "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
+ "psllw $3, %%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
+ "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
- "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
- "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
+ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $3, %%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "psllw $3, %%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
+ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
- "add $16, %1 \n\t"
- "add $4, %0 \n\t"
- " js 1b \n\t"
+ "add $16, %1 \n\t"
+ "add $4, %0 \n\t"
+ " js 1b \n\t"
- : "+r"(index), "+r"(_image)
- : "r"(_pu - index), "r"(_pv - index), "r"(&c->redDither), "r"(_py - 2*index)
- );
- }
+ : "+r" (index), "+r" (_image)
+ : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index)
+ );
+ }
- __asm__ __volatile__(EMMS);
+ __asm__ __volatile__ (EMMS);
return srcSliceH;
-}
+ }
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P)
- {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
+}
- h_size = (c->dstW + 7)&~7;
- if(h_size * 2 > abs(dstStride[0])) h_size -= 8;
+ h_size= (c->dstW+7)&~7;
+ if(h_size*2 > abs(dstStride[0])) h_size-=8;
- __asm__ __volatile__("pxor %mm4, %mm4;" /* zero mm4 */);
+ __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
//printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0],
//srcStride[0],srcStride[1],srcStride[2],dstStride[0]);
- for(y = 0; y < srcSliceH; y++)
- {
- uint8_t *_image = dst[0] + (y + srcSliceY) * dstStride[0];
- uint8_t *_py = src[0] + y * srcStride[0];
- uint8_t *_pu = src[1] + (y >> 1) * srcStride[1];
- uint8_t *_pv = src[2] + (y >> 1) * srcStride[2];
- stride_t index = -h_size / 2;
-
- b5Dither = dither8[y&1];
- g6Dither = dither4[y&1];
- g5Dither = dither8[y&1];
- r5Dither = dither8[(y+1)&1];
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__(
- /* load data for start of next scan line */
- "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ for (y= 0; y<srcSliceH; y++ ) {
+ uint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];
+ uint8_t *_py = src[0] + y*srcStride[0];
+ uint8_t *_pu = src[1] + (y>>1)*srcStride[1];
+ uint8_t *_pv = src[2] + (y>>1)*srcStride[2];
+ stride_t index= -h_size/2;
+
+ b5Dither= dither8[y&1];
+ g6Dither= dither4[y&1];
+ g5Dither= dither8[y&1];
+ r5Dither= dither8[(y+1)&1];
+ /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
+ pixels in each iteration */
+ __asm__ __volatile__ (
+ /* load data for start of next scan line */
+ "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
// ".balign 16 \n\t"
- "1: \n\t"
- YUV2RGB
+ "1: \n\t"
+YUV2RGB
#ifdef DITHER1XBPP
- "paddusb "MANGLE(b5Dither)", %%mm0 \n\t"
- "paddusb "MANGLE(g5Dither)", %%mm2 \n\t"
- "paddusb "MANGLE(r5Dither)", %%mm1 \n\t"
+ "paddusb "MANGLE(b5Dither)", %%mm0 \n\t"
+ "paddusb "MANGLE(g5Dither)", %%mm2 \n\t"
+ "paddusb "MANGLE(r5Dither)", %%mm1 \n\t"
#endif
- /* mask unneeded bits off */
- "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
+ /* mask unneeded bits off */
+ "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
+ "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
+ "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
- "psrlw $3,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
- "psrlw $1,%%mm1;" /* 0_r7r6r5 r4r3_0_0 0_r7r6r5 r4r3_0_0 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
+ "psrlw $3,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
+ "psrlw $1,%%mm1;" /* 0_r7r6r5 r4r3_0_0 0_r7r6r5 r4r3_0_0 */
+ "pxor %%mm4, %%mm4;" /* zero mm4 */
- "movq %%mm0, %%mm5;" /* Copy B7-B0 */
- "movq %%mm2, %%mm7;" /* Copy G7-G0 */
+ "movq %%mm0, %%mm5;" /* Copy B7-B0 */
+ "movq %%mm2, %%mm7;" /* Copy G7-G0 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
- "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
- "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
+ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
- "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
+ "psllw $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
+ "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
- "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
- "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
+ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
+ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
- "psllw $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "psllw $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "por %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "por %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
+ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
- "add $16, %1 \n\t"
- "add $4, %0 \n\t"
- " js 1b \n\t"
- : "+r"(index), "+r"(_image)
- : "r"(_pu - index), "r"(_pv - index), "r"(&c->redDither), "r"(_py - 2*index)
- );
- }
+ "add $16, %1 \n\t"
+ "add $4, %0 \n\t"
+ " js 1b \n\t"
+ : "+r" (index), "+r" (_image)
+ : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index)
+ );
+ }
- __asm__ __volatile__(EMMS);
+ __asm__ __volatile__ (EMMS);
return srcSliceH;
-}
+ }
static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P)
- {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
}
- h_size = (c->dstW + 7)&~7;
- if(h_size * 3 > abs(dstStride[0])) h_size -= 8;
-
- __asm__ __volatile__("pxor %mm4, %mm4;" /* zero mm4 */);
-
- for(y = 0; y < srcSliceH; y++)
- {
- uint8_t *_image = dst[0] + (y + srcSliceY) * dstStride[0];
- uint8_t *_py = src[0] + y * srcStride[0];
- uint8_t *_pu = src[1] + (y >> 1) * srcStride[1];
- uint8_t *_pv = src[2] + (y >> 1) * srcStride[2];
- stride_t index = -h_size / 2;
-
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__(
- /* load data for start of next scan line */
- "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ h_size= (c->dstW+7)&~7;
+ if(h_size*3 > abs(dstStride[0])) h_size-=8;
+
+ __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
+
+ for (y= 0; y<srcSliceH; y++ ) {
+ uint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];
+ uint8_t *_py = src[0] + y*srcStride[0];
+ uint8_t *_pu = src[1] + (y>>1)*srcStride[1];
+ uint8_t *_pv = src[2] + (y>>1)*srcStride[2];
+ stride_t index= -h_size/2;
+
+ /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
+ pixels in each iteration */
+ __asm__ __volatile__ (
+ /* load data for start of next scan line */
+ "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
// ".balign 16 \n\t"
- "1: \n\t"
- YUV2RGB
- /* mm0=B, %%mm2=G, %%mm1=R */
+ "1: \n\t"
+YUV2RGB
+ /* mm0=B, %%mm2=G, %%mm1=R */
#if HAVE_MMX2
- "movq "MANGLE(M24A)", %%mm4 \n\t"
- "movq "MANGLE(M24C)", %%mm7 \n\t"
- "pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */
- "pshufw $0x50, %%mm2, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */
- "pshufw $0x00, %%mm1, %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */
-
- "pand %%mm4, %%mm5 \n\t" /* B2 B1 B0 */
- "pand %%mm4, %%mm3 \n\t" /* G2 G1 G0 */
- "pand %%mm7, %%mm6 \n\t" /* R1 R0 */
-
- "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */
- "por %%mm5, %%mm6 \n\t"
- "por %%mm3, %%mm6 \n\t"
- MOVNTQ" %%mm6, (%1) \n\t"
-
- "psrlq $8, %%mm2 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */
- "pshufw $0xA5, %%mm0, %%mm5 \n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */
- "pshufw $0x55, %%mm2, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */
- "pshufw $0xA5, %%mm1, %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */
-
- "pand "MANGLE(M24B)", %%mm5 \n\t" /* B5 B4 B3 */
- "pand %%mm7, %%mm3 \n\t" /* G4 G3 */
- "pand %%mm4, %%mm6 \n\t" /* R4 R3 R2 */
-
- "por %%mm5, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */
- "por %%mm3, %%mm6 \n\t"
- MOVNTQ" %%mm6, 8(%1) \n\t"
-
- "pshufw $0xFF, %%mm0, %%mm5 \n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */
- "pshufw $0xFA, %%mm2, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */
- "pshufw $0xFA, %%mm1, %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
- "pand %%mm7, %%mm5 \n\t" /* B7 B6 */
- "pand %%mm4, %%mm3 \n\t" /* G7 G6 G5 */
- "pand "MANGLE(M24B)", %%mm6 \n\t" /* R7 R6 R5 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- \
- "por %%mm5, %%mm3 \n\t"
- "por %%mm3, %%mm6 \n\t"
- MOVNTQ" %%mm6, 16(%1) \n\t"
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- "pxor %%mm4, %%mm4 \n\t"
+ "movq "MANGLE(M24A)", %%mm4 \n\t"
+ "movq "MANGLE(M24C)", %%mm7 \n\t"
+ "pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */
+ "pshufw $0x50, %%mm2, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */
+ "pshufw $0x00, %%mm1, %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */
+
+ "pand %%mm4, %%mm5 \n\t" /* B2 B1 B0 */
+ "pand %%mm4, %%mm3 \n\t" /* G2 G1 G0 */
+ "pand %%mm7, %%mm6 \n\t" /* R1 R0 */
+
+ "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */
+ "por %%mm5, %%mm6 \n\t"
+ "por %%mm3, %%mm6 \n\t"
+ MOVNTQ" %%mm6, (%1) \n\t"
+
+ "psrlq $8, %%mm2 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */
+ "pshufw $0xA5, %%mm0, %%mm5 \n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */
+ "pshufw $0x55, %%mm2, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */
+ "pshufw $0xA5, %%mm1, %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */
+
+ "pand "MANGLE(M24B)", %%mm5 \n\t" /* B5 B4 B3 */
+ "pand %%mm7, %%mm3 \n\t" /* G4 G3 */
+ "pand %%mm4, %%mm6 \n\t" /* R4 R3 R2 */
+
+ "por %%mm5, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */
+ "por %%mm3, %%mm6 \n\t"
+ MOVNTQ" %%mm6, 8(%1) \n\t"
+
+ "pshufw $0xFF, %%mm0, %%mm5 \n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */
+ "pshufw $0xFA, %%mm2, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */
+ "pshufw $0xFA, %%mm1, %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+
+ "pand %%mm7, %%mm5 \n\t" /* B7 B6 */
+ "pand %%mm4, %%mm3 \n\t" /* G7 G6 G5 */
+ "pand "MANGLE(M24B)", %%mm6 \n\t" /* R7 R6 R5 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+\
+ "por %%mm5, %%mm3 \n\t"
+ "por %%mm3, %%mm6 \n\t"
+ MOVNTQ" %%mm6, 16(%1) \n\t"
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ "pxor %%mm4, %%mm4 \n\t"
#else
- "pxor %%mm4, %%mm4 \n\t"
- "movq %%mm0, %%mm5 \n\t" /* B */
- "movq %%mm1, %%mm6 \n\t" /* R */
- "punpcklbw %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */
- "punpcklbw %%mm4, %%mm1 \n\t" /* 0R0R0R0R 0 */
- "punpckhbw %%mm2, %%mm5 \n\t" /* GBGBGBGB 2 */
- "punpckhbw %%mm4, %%mm6 \n\t" /* 0R0R0R0R 2 */
- "movq %%mm0, %%mm7 \n\t" /* GBGBGBGB 0 */
- "movq %%mm5, %%mm3 \n\t" /* GBGBGBGB 2 */
- "punpcklwd %%mm1, %%mm7 \n\t" /* 0RGB0RGB 0 */
- "punpckhwd %%mm1, %%mm0 \n\t" /* 0RGB0RGB 1 */
- "punpcklwd %%mm6, %%mm5 \n\t" /* 0RGB0RGB 2 */
- "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */
-
- "movq %%mm7, %%mm2 \n\t" /* 0RGB0RGB 0 */
- "movq %%mm0, %%mm6 \n\t" /* 0RGB0RGB 1 */
- "movq %%mm5, %%mm1 \n\t" /* 0RGB0RGB 2 */
- "movq %%mm3, %%mm4 \n\t" /* 0RGB0RGB 3 */
-
- "psllq $40, %%mm7 \n\t" /* RGB00000 0 */
- "psllq $40, %%mm0 \n\t" /* RGB00000 1 */
- "psllq $40, %%mm5 \n\t" /* RGB00000 2 */
- "psllq $40, %%mm3 \n\t" /* RGB00000 3 */
-
- "punpckhdq %%mm2, %%mm7 \n\t" /* 0RGBRGB0 0 */
- "punpckhdq %%mm6, %%mm0 \n\t" /* 0RGBRGB0 1 */
- "punpckhdq %%mm1, %%mm5 \n\t" /* 0RGBRGB0 2 */
- "punpckhdq %%mm4, %%mm3 \n\t" /* 0RGBRGB0 3 */
-
- "psrlq $8, %%mm7 \n\t" /* 00RGBRGB 0 */
- "movq %%mm0, %%mm6 \n\t" /* 0RGBRGB0 1 */
- "psllq $40, %%mm0 \n\t" /* GB000000 1 */
- "por %%mm0, %%mm7 \n\t" /* GBRGBRGB 0 */
- MOVNTQ" %%mm7, (%1) \n\t"
-
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
- "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */
- "movq %%mm5, %%mm1 \n\t" /* 0RGBRGB0 2 */
- "psllq $24, %%mm5 \n\t" /* BRGB0000 2 */
- "por %%mm5, %%mm6 \n\t" /* BRGBRGBR 1 */
- MOVNTQ" %%mm6, 8(%1) \n\t"
-
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
-
- "psrlq $40, %%mm1 \n\t" /* 000000RG 2 */
- "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */
- "por %%mm3, %%mm1 \n\t" /* RGBRGBRG 2 */
- MOVNTQ" %%mm1, 16(%1) \n\t"
-
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "pxor %%mm4, %%mm4 \n\t"
+ "pxor %%mm4, %%mm4 \n\t"
+ "movq %%mm0, %%mm5 \n\t" /* B */
+ "movq %%mm1, %%mm6 \n\t" /* R */
+ "punpcklbw %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */
+ "punpcklbw %%mm4, %%mm1 \n\t" /* 0R0R0R0R 0 */
+ "punpckhbw %%mm2, %%mm5 \n\t" /* GBGBGBGB 2 */
+ "punpckhbw %%mm4, %%mm6 \n\t" /* 0R0R0R0R 2 */
+ "movq %%mm0, %%mm7 \n\t" /* GBGBGBGB 0 */
+ "movq %%mm5, %%mm3 \n\t" /* GBGBGBGB 2 */
+ "punpcklwd %%mm1, %%mm7 \n\t" /* 0RGB0RGB 0 */
+ "punpckhwd %%mm1, %%mm0 \n\t" /* 0RGB0RGB 1 */
+ "punpcklwd %%mm6, %%mm5 \n\t" /* 0RGB0RGB 2 */
+ "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */
+
+ "movq %%mm7, %%mm2 \n\t" /* 0RGB0RGB 0 */
+ "movq %%mm0, %%mm6 \n\t" /* 0RGB0RGB 1 */
+ "movq %%mm5, %%mm1 \n\t" /* 0RGB0RGB 2 */
+ "movq %%mm3, %%mm4 \n\t" /* 0RGB0RGB 3 */
+
+ "psllq $40, %%mm7 \n\t" /* RGB00000 0 */
+ "psllq $40, %%mm0 \n\t" /* RGB00000 1 */
+ "psllq $40, %%mm5 \n\t" /* RGB00000 2 */
+ "psllq $40, %%mm3 \n\t" /* RGB00000 3 */
+
+ "punpckhdq %%mm2, %%mm7 \n\t" /* 0RGBRGB0 0 */
+ "punpckhdq %%mm6, %%mm0 \n\t" /* 0RGBRGB0 1 */
+ "punpckhdq %%mm1, %%mm5 \n\t" /* 0RGBRGB0 2 */
+ "punpckhdq %%mm4, %%mm3 \n\t" /* 0RGBRGB0 3 */
+
+ "psrlq $8, %%mm7 \n\t" /* 00RGBRGB 0 */
+ "movq %%mm0, %%mm6 \n\t" /* 0RGBRGB0 1 */
+ "psllq $40, %%mm0 \n\t" /* GB000000 1 */
+ "por %%mm0, %%mm7 \n\t" /* GBRGBRGB 0 */
+ MOVNTQ" %%mm7, (%1) \n\t"
+
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+
+ "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */
+ "movq %%mm5, %%mm1 \n\t" /* 0RGBRGB0 2 */
+ "psllq $24, %%mm5 \n\t" /* BRGB0000 2 */
+ "por %%mm5, %%mm6 \n\t" /* BRGBRGBR 1 */
+ MOVNTQ" %%mm6, 8(%1) \n\t"
+
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+
+ "psrlq $40, %%mm1 \n\t" /* 000000RG 2 */
+ "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */
+ "por %%mm3, %%mm1 \n\t" /* RGBRGBRG 2 */
+ MOVNTQ" %%mm1, 16(%1) \n\t"
+
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "pxor %%mm4, %%mm4 \n\t"
#endif
- "add $24, %1 \n\t"
- "add $4, %0 \n\t"
- " js 1b \n\t"
+ "add $24, %1 \n\t"
+ "add $4, %0 \n\t"
+ " js 1b \n\t"
- : "+r"(index), "+r"(_image)
- : "r"(_pu - index), "r"(_pv - index), "r"(&c->redDither), "r"(_py - 2*index)
- );
- }
+ : "+r" (index), "+r" (_image)
+ : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index)
+ );
+ }
- __asm__ __volatile__(EMMS);
+ __asm__ __volatile__ (EMMS);
return srcSliceH;
-}
+ }
static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
int y, h_size;
- if(c->srcFormat == IMGFMT_422P)
- {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
}
- h_size = (c->dstW + 7)&~7;
- if(h_size * 4 > abs(dstStride[0])) h_size -= 8;
-
- __asm__ __volatile__("pxor %mm4, %mm4;" /* zero mm4 */);
-
- for(y = 0; y < srcSliceH; y++)
- {
- uint8_t *_image = dst[0] + (y + srcSliceY) * dstStride[0];
- uint8_t *_py = src[0] + y * srcStride[0];
- uint8_t *_pu = src[1] + (y >> 1) * srcStride[1];
- uint8_t *_pv = src[2] + (y >> 1) * srcStride[2];
- stride_t index = -h_size / 2;
-
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__(
- /* load data for start of next scan line */
- "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ h_size= (c->dstW+7)&~7;
+ if(h_size*4 > abs(dstStride[0])) h_size-=8;
+
+ __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
+
+ for (y= 0; y<srcSliceH; y++ ) {
+ uint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];
+ uint8_t *_py = src[0] + y*srcStride[0];
+ uint8_t *_pu = src[1] + (y>>1)*srcStride[1];
+ uint8_t *_pv = src[2] + (y>>1)*srcStride[2];
+ stride_t index= -h_size/2;
+
+ /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
+ pixels in each iteration */
+ __asm__ __volatile__ (
+ /* load data for start of next scan line */
+ "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
// ".balign 16 \n\t"
- "1: \n\t"
- YUV2RGB
- /* convert RGB plane to RGB packed format,
- mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0,
- mm4 -> GB, mm5 -> AR pixel 4-7,
- mm6 -> GB, mm7 -> AR pixel 0-3 */
- "pxor %%mm3, %%mm3;" /* zero mm3 */
+ "1: \n\t"
+YUV2RGB
+ /* convert RGB plane to RGB packed format,
+ mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0,
+ mm4 -> GB, mm5 -> AR pixel 4-7,
+ mm6 -> GB, mm7 -> AR pixel 0-3 */
+ "pxor %%mm3, %%mm3;" /* zero mm3 */
- "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
- "movq %%mm1, %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */
+ "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
+ "movq %%mm1, %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */
- "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
- "movq %%mm1, %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */
+ "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
+ "movq %%mm1, %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */
- "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */
- "punpcklbw %%mm3, %%mm7;" /* 00 R3 00 R2 00 R1 00 R0 */
+ "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */
+ "punpcklbw %%mm3, %%mm7;" /* 00 R3 00 R2 00 R1 00 R0 */
- "punpcklwd %%mm7, %%mm6;" /* 00 R1 B1 G1 00 R0 B0 G0 */
- MOVNTQ " %%mm6, (%1);" /* Store ARGB1 ARGB0 */
+ "punpcklwd %%mm7, %%mm6;" /* 00 R1 B1 G1 00 R0 B0 G0 */
+ MOVNTQ " %%mm6, (%1);" /* Store ARGB1 ARGB0 */
- "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
- "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */
+ "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
+ "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */
- "punpckhwd %%mm7, %%mm6;" /* 00 R3 G3 B3 00 R2 B3 G2 */
- MOVNTQ " %%mm6, 8 (%1);" /* Store ARGB3 ARGB2 */
+ "punpckhwd %%mm7, %%mm6;" /* 00 R3 G3 B3 00 R2 B3 G2 */
+ MOVNTQ " %%mm6, 8 (%1);" /* Store ARGB3 ARGB2 */
- "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */
- "punpckhbw %%mm3, %%mm5;" /* 00 R7 00 R6 00 R5 00 R4 */
+ "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */
+ "punpckhbw %%mm3, %%mm5;" /* 00 R7 00 R6 00 R5 00 R4 */
- "punpcklwd %%mm5, %%mm4;" /* 00 R5 B5 G5 00 R4 B4 G4 */
- MOVNTQ " %%mm4, 16 (%1);" /* Store ARGB5 ARGB4 */
+ "punpcklwd %%mm5, %%mm4;" /* 00 R5 B5 G5 00 R4 B4 G4 */
+ MOVNTQ " %%mm4, 16 (%1);" /* Store ARGB5 ARGB4 */
- "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
- "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */
+ "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */
+ "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */
- "punpckhwd %%mm5, %%mm4;" /* 00 R7 G7 B7 00 R6 B6 G6 */
- MOVNTQ " %%mm4, 24 (%1);" /* Store ARGB7 ARGB6 */
+ "punpckhwd %%mm5, %%mm4;" /* 00 R7 G7 B7 00 R6 B6 G6 */
+ MOVNTQ " %%mm4, 24 (%1);" /* Store ARGB7 ARGB6 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
+ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
+ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
+ "pxor %%mm4, %%mm4;" /* zero mm4 */
+ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- "add $32, %1 \n\t"
- "add $4, %0 \n\t"
- " js 1b \n\t"
+ "add $32, %1 \n\t"
+ "add $4, %0 \n\t"
+ " js 1b \n\t"
- : "+r"(index), "+r"(_image)
- : "r"(_pu - index), "r"(_pv - index), "r"(&c->redDither), "r"(_py - 2*index)
- );
+ : "+r" (index), "+r" (_image)
+ : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index)
+ );
}
- __asm__ __volatile__(EMMS);
+ __asm__ __volatile__ (EMMS);
return srcSliceH;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib.c b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib.c
index f84649784..8ea7b670b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib.c
@@ -113,35 +113,35 @@
#endif // CAN_COMPILE_X86_ASM
-void*(*fast_memcpy)(void * to, const void * from, size_t len) = NULL;
+void* (*fast_memcpy)(void * to, const void * from, size_t len)=NULL;
void init_fast_memcpy(void)
{
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
- // ordered per speed fasterst first
- if(gCpuCaps.hasSSE2)
- fast_memcpy = fast_memcpy_SSE;
- else if(gCpuCaps.hasMMX2)
- fast_memcpy = fast_memcpy_MMX2;
- else if(gCpuCaps.has3DNow)
- fast_memcpy = fast_memcpy_3DNow;
- else if(gCpuCaps.hasMMX)
- fast_memcpy = fast_memcpy_MMX;
- else
+ // ordered per speed fasterst first
+ if(gCpuCaps.hasSSE2)
+ fast_memcpy=fast_memcpy_SSE;
+ else if(gCpuCaps.hasMMX2)
+ fast_memcpy=fast_memcpy_MMX2;
+ else if(gCpuCaps.has3DNow)
+ fast_memcpy=fast_memcpy_3DNow;
+ else if(gCpuCaps.hasMMX)
+ fast_memcpy=fast_memcpy_MMX;
+ else
#endif //CAN_COMPILE_X86_ASM
- fast_memcpy = memcpy; // prior to mmx we use the standart memcpy
+ fast_memcpy=memcpy; // prior to mmx we use the standart memcpy
#else
#if HAVE_SSE2
- fast_memcpy = fast_memcpy_SSE;
+ fast_memcpy=fast_memcpy_SSE;
#elif HAVE_MMX2
- fast_memcpy = fast_memcpy_MMX2;
+ fast_memcpy=fast_memcpy_MMX2;
#elif HAVE_AMD3DNOW
- fast_memcpy = fast_memcpy_3DNow;
+ fast_memcpy=fast_memcpy_3DNow;
#elif HAVE_MMX
- fast_memcpy = fast_memcpy_MMX;
+ fast_memcpy=fast_memcpy_MMX;
#else
- fast_memcpy = memcpy; // prior to mmx we use the standart memcpy
+ fast_memcpy=memcpy; // prior to mmx we use the standart memcpy
#endif
#endif //!RUNTIME_CPUDETECT
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib_template.c b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib_template.c
index c89596b47..27826f328 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib_template.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/aclib_template.c
@@ -135,45 +135,45 @@ __asm__ __volatile__(\
static inline void * RENAME(fast_memcpy)(void * to, const void * from, size_t len)
{
- void *retval;
- size_t i;
- retval = to;
+ void *retval;
+ size_t i;
+ retval = to;
#ifdef STATISTICS
- {
- static int freq[33];
- static int t = 0;
- int i;
- for(i = 0; len > (1 << i); i++);
- freq[i]++;
- t++;
- if(1024 * 1024 * 1024 % t == 0)
- for(i = 0; i < 32; i++)
- ;//printf("freq < %8d %4d\n", 1<<i, freq[i]);
- }
+ {
+ static int freq[33];
+ static int t=0;
+ int i;
+ for(i=0; len>(1<<i); i++);
+ freq[i]++;
+ t++;
+ if(1024*1024*1024 % t == 0)
+ for(i=0; i<32; i++)
+ ;//printf("freq < %8d %4d\n", 1<<i, freq[i]);
+ }
#endif
#ifndef HAVE_MMX1
- /* PREFETCH has effect even for MOVSB instruction ;) */
- __asm__ __volatile__(
- PREFETCH" (%0)\n"
- PREFETCH" 64(%0)\n"
- PREFETCH" 128(%0)\n"
- PREFETCH" 192(%0)\n"
- PREFETCH" 256(%0)\n"
- : : "r"(from));
+ /* PREFETCH has effect even for MOVSB instruction ;) */
+ __asm__ __volatile__ (
+ PREFETCH" (%0)\n"
+ PREFETCH" 64(%0)\n"
+ PREFETCH" 128(%0)\n"
+ PREFETCH" 192(%0)\n"
+ PREFETCH" 256(%0)\n"
+ : : "r" (from) );
#endif
- if(len >= MIN_LEN)
- {
- register unsigned long int delta;
- /* Align destinition to MMREG_SIZE -boundary */
- delta = ((unsigned long int)to) & (MMREG_SIZE - 1);
- if(delta)
- {
- delta = MMREG_SIZE - delta;
- len -= delta;
- small_memcpy(to, from, delta);
- }
- i = len >> 6; /* len/64 */
- len &= 63;
+ if(len >= MIN_LEN)
+ {
+ register unsigned long int delta;
+ /* Align destinition to MMREG_SIZE -boundary */
+ delta = ((unsigned long int)to)&(MMREG_SIZE-1);
+ if(delta)
+ {
+ delta=MMREG_SIZE-delta;
+ len -= delta;
+ small_memcpy(to, from, delta);
+ }
+ i = len >> 6; /* len/64 */
+ len&=63;
/*
This algorithm is top effective when the code consequently
reads and writes blocks which have size of cache line.
@@ -184,178 +184,178 @@ static inline void * RENAME(fast_memcpy)(void * to, const void * from, size_t le
processor's decoders, but it's not always possible.
*/
#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
- if(((unsigned long)from) & 15)
- /* if SRC is misaligned */
- for(; i > 0; i--)
- {
- __asm__ __volatile__(
- PREFETCH" 320(%0)\n"
- "movups (%0), %%xmm0\n"
- "movups 16(%0), %%xmm1\n"
- "movups 32(%0), %%xmm2\n"
- "movups 48(%0), %%xmm3\n"
- "movntps %%xmm0, (%1)\n"
- "movntps %%xmm1, 16(%1)\n"
- "movntps %%xmm2, 32(%1)\n"
- "movntps %%xmm3, 48(%1)\n"
- :: "r"(from), "r"(to) : "memory");
- from = ((const unsigned char *) from) + 64;
- to = ((unsigned char *)to) + 64;
- }
- else
- /*
- Only if SRC is aligned on 16-byte boundary.
- It allows to use movaps instead of movups, which required data
- to be aligned or a general-protection exception (#GP) is generated.
- */
- for(; i > 0; i--)
- {
- __asm__ __volatile__(
- PREFETCH" 320(%0)\n"
- "movaps (%0), %%xmm0\n"
- "movaps 16(%0), %%xmm1\n"
- "movaps 32(%0), %%xmm2\n"
- "movaps 48(%0), %%xmm3\n"
- "movntps %%xmm0, (%1)\n"
- "movntps %%xmm1, 16(%1)\n"
- "movntps %%xmm2, 32(%1)\n"
- "movntps %%xmm3, 48(%1)\n"
- :: "r"(from), "r"(to) : "memory");
- from = ((const unsigned char *)from) + 64;
- to = ((unsigned char *)to) + 64;
- }
+ if(((unsigned long)from) & 15)
+ /* if SRC is misaligned */
+ for(; i>0; i--)
+ {
+ __asm__ __volatile__ (
+ PREFETCH" 320(%0)\n"
+ "movups (%0), %%xmm0\n"
+ "movups 16(%0), %%xmm1\n"
+ "movups 32(%0), %%xmm2\n"
+ "movups 48(%0), %%xmm3\n"
+ "movntps %%xmm0, (%1)\n"
+ "movntps %%xmm1, 16(%1)\n"
+ "movntps %%xmm2, 32(%1)\n"
+ "movntps %%xmm3, 48(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from=((const unsigned char *) from)+64;
+ to=((unsigned char *)to)+64;
+ }
+ else
+ /*
+ Only if SRC is aligned on 16-byte boundary.
+ It allows to use movaps instead of movups, which required data
+ to be aligned or a general-protection exception (#GP) is generated.
+ */
+ for(; i>0; i--)
+ {
+ __asm__ __volatile__ (
+ PREFETCH" 320(%0)\n"
+ "movaps (%0), %%xmm0\n"
+ "movaps 16(%0), %%xmm1\n"
+ "movaps 32(%0), %%xmm2\n"
+ "movaps 48(%0), %%xmm3\n"
+ "movntps %%xmm0, (%1)\n"
+ "movntps %%xmm1, 16(%1)\n"
+ "movntps %%xmm2, 32(%1)\n"
+ "movntps %%xmm3, 48(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from=((const unsigned char *)from)+64;
+ to=((unsigned char *)to)+64;
+ }
#else
- // Align destination at BLOCK_SIZE boundary
- for(; ((int)to & (BLOCK_SIZE - 1)) && i > 0; i--)
- {
- __asm__ __volatile__(
+ // Align destination at BLOCK_SIZE boundary
+ for(; ((int)to & (BLOCK_SIZE-1)) && i>0; i--)
+ {
+ __asm__ __volatile__ (
#ifndef HAVE_MMX1
- PREFETCH" 320(%0)\n"
+ PREFETCH" 320(%0)\n"
#endif
- "movq (%0), %%mm0\n"
- "movq 8(%0), %%mm1\n"
- "movq 16(%0), %%mm2\n"
- "movq 24(%0), %%mm3\n"
- "movq 32(%0), %%mm4\n"
- "movq 40(%0), %%mm5\n"
- "movq 48(%0), %%mm6\n"
- "movq 56(%0), %%mm7\n"
- MOVNTQ" %%mm0, (%1)\n"
- MOVNTQ" %%mm1, 8(%1)\n"
- MOVNTQ" %%mm2, 16(%1)\n"
- MOVNTQ" %%mm3, 24(%1)\n"
- MOVNTQ" %%mm4, 32(%1)\n"
- MOVNTQ" %%mm5, 40(%1)\n"
- MOVNTQ" %%mm6, 48(%1)\n"
- MOVNTQ" %%mm7, 56(%1)\n"
- :: "r"(from), "r"(to) : "memory");
- from = ((const unsigned char *)from) + 64;
- to = ((unsigned char *)to) + 64;
- }
+ "movq (%0), %%mm0\n"
+ "movq 8(%0), %%mm1\n"
+ "movq 16(%0), %%mm2\n"
+ "movq 24(%0), %%mm3\n"
+ "movq 32(%0), %%mm4\n"
+ "movq 40(%0), %%mm5\n"
+ "movq 48(%0), %%mm6\n"
+ "movq 56(%0), %%mm7\n"
+ MOVNTQ" %%mm0, (%1)\n"
+ MOVNTQ" %%mm1, 8(%1)\n"
+ MOVNTQ" %%mm2, 16(%1)\n"
+ MOVNTQ" %%mm3, 24(%1)\n"
+ MOVNTQ" %%mm4, 32(%1)\n"
+ MOVNTQ" %%mm5, 40(%1)\n"
+ MOVNTQ" %%mm6, 48(%1)\n"
+ MOVNTQ" %%mm7, 56(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from=((const unsigned char *)from)+64;
+ to=((unsigned char *)to)+64;
+ }
// printf(" %d %d\n", (int)from&1023, (int)to&1023);
- // Pure Assembly cuz gcc is a bit unpredictable ;)
- if(i >= BLOCK_SIZE / 64)
- asm volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ".balign 16 \n\t"
- "1: \n\t"
- "movl (%0, %%"REG_a"), %%ebx \n\t"
- "movl 32(%0, %%"REG_a"), %%ebx \n\t"
- "movl 64(%0, %%"REG_a"), %%ebx \n\t"
- "movl 96(%0, %%"REG_a"), %%ebx \n\t"
- "add $128, %%"REG_a" \n\t"
- "cmp %3, %%"REG_a" \n\t"
- " jb 1b \n\t"
+ // Pure Assembly cuz gcc is a bit unpredictable ;)
+ if(i>=BLOCK_SIZE/64)
+ asm volatile(
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ ".balign 16 \n\t"
+ "1: \n\t"
+ "movl (%0, %%"REG_a"), %%ebx \n\t"
+ "movl 32(%0, %%"REG_a"), %%ebx \n\t"
+ "movl 64(%0, %%"REG_a"), %%ebx \n\t"
+ "movl 96(%0, %%"REG_a"), %%ebx \n\t"
+ "add $128, %%"REG_a" \n\t"
+ "cmp %3, %%"REG_a" \n\t"
+ " jb 1b \n\t"
- "xor %%"REG_a", %%"REG_a" \n\t"
+ "xor %%"REG_a", %%"REG_a" \n\t"
- ".balign 16 \n\t"
- "2: \n\t"
- "movq (%0, %%"REG_a"), %%mm0\n"
- "movq 8(%0, %%"REG_a"), %%mm1\n"
- "movq 16(%0, %%"REG_a"), %%mm2\n"
- "movq 24(%0, %%"REG_a"), %%mm3\n"
- "movq 32(%0, %%"REG_a"), %%mm4\n"
- "movq 40(%0, %%"REG_a"), %%mm5\n"
- "movq 48(%0, %%"REG_a"), %%mm6\n"
- "movq 56(%0, %%"REG_a"), %%mm7\n"
- MOVNTQ" %%mm0, (%1, %%"REG_a")\n"
- MOVNTQ" %%mm1, 8(%1, %%"REG_a")\n"
- MOVNTQ" %%mm2, 16(%1, %%"REG_a")\n"
- MOVNTQ" %%mm3, 24(%1, %%"REG_a")\n"
- MOVNTQ" %%mm4, 32(%1, %%"REG_a")\n"
- MOVNTQ" %%mm5, 40(%1, %%"REG_a")\n"
- MOVNTQ" %%mm6, 48(%1, %%"REG_a")\n"
- MOVNTQ" %%mm7, 56(%1, %%"REG_a")\n"
- "add $64, %%"REG_a" \n\t"
- "cmp %3, %%"REG_a" \n\t"
- "jb 2b \n\t"
+ ".balign 16 \n\t"
+ "2: \n\t"
+ "movq (%0, %%"REG_a"), %%mm0\n"
+ "movq 8(%0, %%"REG_a"), %%mm1\n"
+ "movq 16(%0, %%"REG_a"), %%mm2\n"
+ "movq 24(%0, %%"REG_a"), %%mm3\n"
+ "movq 32(%0, %%"REG_a"), %%mm4\n"
+ "movq 40(%0, %%"REG_a"), %%mm5\n"
+ "movq 48(%0, %%"REG_a"), %%mm6\n"
+ "movq 56(%0, %%"REG_a"), %%mm7\n"
+ MOVNTQ" %%mm0, (%1, %%"REG_a")\n"
+ MOVNTQ" %%mm1, 8(%1, %%"REG_a")\n"
+ MOVNTQ" %%mm2, 16(%1, %%"REG_a")\n"
+ MOVNTQ" %%mm3, 24(%1, %%"REG_a")\n"
+ MOVNTQ" %%mm4, 32(%1, %%"REG_a")\n"
+ MOVNTQ" %%mm5, 40(%1, %%"REG_a")\n"
+ MOVNTQ" %%mm6, 48(%1, %%"REG_a")\n"
+ MOVNTQ" %%mm7, 56(%1, %%"REG_a")\n"
+ "add $64, %%"REG_a" \n\t"
+ "cmp %3, %%"REG_a" \n\t"
+ "jb 2b \n\t"
#if CONFUSION_FACTOR > 0
- // a few percent speedup on out of order executing CPUs
- "mov %5, %%"REG_a" \n\t"
- "2: \n\t"
- "movl (%0), %%ebx \n\t"
- "movl (%0), %%ebx \n\t"
- "movl (%0), %%ebx \n\t"
- "movl (%0), %%ebx \n\t"
- "dec %%"REG_a" \n\t"
- " jnz 2b \n\t"
+ // a few percent speedup on out of order executing CPUs
+ "mov %5, %%"REG_a" \n\t"
+ "2: \n\t"
+ "movl (%0), %%ebx \n\t"
+ "movl (%0), %%ebx \n\t"
+ "movl (%0), %%ebx \n\t"
+ "movl (%0), %%ebx \n\t"
+ "dec %%"REG_a" \n\t"
+ " jnz 2b \n\t"
#endif
- "xor %%"REG_a", %%"REG_a" \n\t"
- "add %3, %0 \n\t"
- "add %3, %1 \n\t"
- "sub %4, %2 \n\t"
- "cmp %4, %2 \n\t"
- " jae 1b \n\t"
- : "+r"(from), "+r"(to), "+r"(i)
- : "r"((stride_t)BLOCK_SIZE), "i"(BLOCK_SIZE/64), "i"((long)CONFUSION_FACTOR)
- : "%"REG_a, "%ebx"
- );
+ "xor %%"REG_a", %%"REG_a" \n\t"
+ "add %3, %0 \n\t"
+ "add %3, %1 \n\t"
+ "sub %4, %2 \n\t"
+ "cmp %4, %2 \n\t"
+ " jae 1b \n\t"
+ : "+r" (from), "+r" (to), "+r" (i)
+ : "r" ((stride_t)BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" ((long)CONFUSION_FACTOR)
+ : "%"REG_a, "%ebx"
+ );
- for(; i > 0; i--)
- {
- __asm__ __volatile__(
+ for(; i>0; i--)
+ {
+ __asm__ __volatile__ (
#ifndef HAVE_MMX1
- PREFETCH" 320(%0)\n"
+ PREFETCH" 320(%0)\n"
#endif
- "movq (%0), %%mm0\n"
- "movq 8(%0), %%mm1\n"
- "movq 16(%0), %%mm2\n"
- "movq 24(%0), %%mm3\n"
- "movq 32(%0), %%mm4\n"
- "movq 40(%0), %%mm5\n"
- "movq 48(%0), %%mm6\n"
- "movq 56(%0), %%mm7\n"
- MOVNTQ" %%mm0, (%1)\n"
- MOVNTQ" %%mm1, 8(%1)\n"
- MOVNTQ" %%mm2, 16(%1)\n"
- MOVNTQ" %%mm3, 24(%1)\n"
- MOVNTQ" %%mm4, 32(%1)\n"
- MOVNTQ" %%mm5, 40(%1)\n"
- MOVNTQ" %%mm6, 48(%1)\n"
- MOVNTQ" %%mm7, 56(%1)\n"
- :: "r"(from), "r"(to) : "memory");
- from = ((const unsigned char *)from) + 64;
- to = ((unsigned char *)to) + 64;
- }
+ "movq (%0), %%mm0\n"
+ "movq 8(%0), %%mm1\n"
+ "movq 16(%0), %%mm2\n"
+ "movq 24(%0), %%mm3\n"
+ "movq 32(%0), %%mm4\n"
+ "movq 40(%0), %%mm5\n"
+ "movq 48(%0), %%mm6\n"
+ "movq 56(%0), %%mm7\n"
+ MOVNTQ" %%mm0, (%1)\n"
+ MOVNTQ" %%mm1, 8(%1)\n"
+ MOVNTQ" %%mm2, 16(%1)\n"
+ MOVNTQ" %%mm3, 24(%1)\n"
+ MOVNTQ" %%mm4, 32(%1)\n"
+ MOVNTQ" %%mm5, 40(%1)\n"
+ MOVNTQ" %%mm6, 48(%1)\n"
+ MOVNTQ" %%mm7, 56(%1)\n"
+ :: "r" (from), "r" (to) : "memory");
+ from=((const unsigned char *)from)+64;
+ to=((unsigned char *)to)+64;
+ }
#endif /* Have SSE */
#ifdef HAVE_MMX2
- /* since movntq is weakly-ordered, a "sfence"
- * is needed to become ordered again. */
- __asm__ __volatile__("sfence":::"memory");
+ /* since movntq is weakly-ordered, a "sfence"
+ * is needed to become ordered again. */
+ __asm__ __volatile__ ("sfence":::"memory");
#endif
#ifndef HAVE_SSE
- /* enables to use FPU */
- __asm__ __volatile__(EMMS:::"memory");
+ /* enables to use FPU */
+ __asm__ __volatile__ (EMMS:::"memory");
#endif
- }
- /*
- * Now do the tail of the block
- */
- if(len) small_memcpy(to, from, len);
- return retval;
+ }
+ /*
+ * Now do the tail of the block
+ */
+ if(len) small_memcpy(to, from, len);
+ return retval;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/fastmemcpy.h b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/fastmemcpy.h
index 77f282f64..0dd2ff62c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/fastmemcpy.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/fastmemcpy.h
@@ -6,38 +6,37 @@
#include "../libavutil/internal.h"
#if defined(USE_FASTMEMCPY) && (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_SSE || HAVE_SSE2)
-extern void*(*fast_memcpy)(void * to, const void * from, size_t len);
+extern void* (*fast_memcpy)(void * to, const void * from, size_t len);
#define memcpy(a,b,c) fast_memcpy(a,b,c)
#endif
void init_fast_memcpy(void);
static inline void * memcpy_pic(unsigned char * dst, unsigned char * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
- int i;
- void *retval = dst;
+ int i;
+ void *retval=dst;
- if(dstStride == srcStride)
- {
- if(srcStride < 0)
- {
- src += (height - 1) * srcStride;
- dst += (height - 1) * dstStride;
- srcStride = -srcStride;
- }
+ if(dstStride == srcStride)
+ {
+ if (srcStride < 0) {
+ src += (height-1)*srcStride;
+ dst += (height-1)*dstStride;
+ srcStride = -srcStride;
+ }
- memcpy(dst, src, srcStride * height);
- }
- else
- {
- for(i = 0; i < height; i++)
- {
- memcpy(dst, src, bytesPerLine);
- src += srcStride;
- dst += dstStride;
- }
- }
+ memcpy(dst, src, srcStride*height);
+ }
+ else
+ {
+ for(i=0; i<height; i++)
+ {
+ memcpy(dst, src, bytesPerLine);
+ src+= srcStride;
+ dst+= dstStride;
+ }
+ }
- return retval;
+ return retval;
}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/libvoinit.c b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/libvoinit.c
index 0bae5434c..31d8d3a4e 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libvo/libvoinit.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libvo/libvoinit.c
@@ -8,15 +8,15 @@ CpuCaps gCpuCaps;
void init_libvo()
{
- gCpuCaps.hasMMX = 1;
- gCpuCaps.hasMMX2 = 1;
- gCpuCaps.has3DNow = 1;
- gCpuCaps.has3DNowExt = 1;
- gCpuCaps.hasSSE = 1;
- gCpuCaps.hasSSE2 = 1;
- gCpuCaps.hasSSSE3 = 1;
- init_fast_memcpy();
-// Avoid using multithread if the CPU is Pentium4-HT
-// because it is not faster at all and uses more CPU.
-// (Swscaler depends much on MMX and P4HT have only one MMX unit.)
+ gCpuCaps.hasMMX=1;
+ gCpuCaps.hasMMX2=1;
+ gCpuCaps.has3DNow=1;
+ gCpuCaps.has3DNowExt=1;
+ gCpuCaps.hasSSE=1;
+ gCpuCaps.hasSSE2=1;
+ gCpuCaps.hasSSSE3=1;
+ init_fast_memcpy();
+ // Avoid using multithread if the CPU is Pentium4-HT
+ // because it is not faster at all and uses more CPU.
+ // (Swscaler depends much on MMX and P4HT have only one MMX unit.)
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/mp_msg.h b/src/filters/transform/MPCVideoDec/ffmpeg/mp_msg.h
index bdc0acfa5..ed6bb025f 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/mp_msg.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/mp_msg.h
@@ -86,136 +86,88 @@
#define MSGT_MAX 64
#if 1
-#ifdef __GNUC__
-#define mp_msg(mod,lev, args... )
+ #ifdef __GNUC__
+ #define mp_msg(mod,lev, args... )
+ #else
+ #define mp_msg(x)
+ #endif
#else
-#define mp_msg(x)
-#endif
-#else
-#include "ffImgfmt.h"
-static inline const char *vo_format_name(int format)
-{
- switch(format)
+ #include "ffImgfmt.h"
+ static inline const char *vo_format_name(int format)
+ {
+ switch(format)
{
- case IMGFMT_RGB1:
- return("RGB 1-bit");
- case IMGFMT_RGB4:
- return("RGB 4-bit");
- case IMGFMT_RG4B:
- return("RGB 4-bit per byte");
- case IMGFMT_RGB8:
- return("RGB 8-bit");
- case IMGFMT_RGB15:
- return("RGB 15-bit");
- case IMGFMT_RGB16:
- return("RGB 16-bit");
- case IMGFMT_RGB24:
- return("RGB 24-bit");
- case IMGFMT_RGB32:
- return("RGB 32-bit");
- case IMGFMT_BGR1:
- return("BGR 1-bit");
- case IMGFMT_BGR4:
- return("BGR 4-bit");
- case IMGFMT_BG4B:
- return("BGR 4-bit per byte");
- case IMGFMT_BGR8:
- return("BGR 8-bit");
- case IMGFMT_BGR15:
- return("BGR 15-bit");
- case IMGFMT_BGR16:
- return("BGR 16-bit");
- case IMGFMT_BGR24:
- return("BGR 24-bit");
- case IMGFMT_BGR32:
- return("BGR 32-bit");
- case IMGFMT_YVU9:
- return("Planar YVU9");
- case IMGFMT_IF09:
- return("Planar IF09");
- case IMGFMT_YV12:
- return("Planar YV12");
- case IMGFMT_I420:
- return("Planar I420");
- case IMGFMT_IYUV:
- return("Planar IYUV");
- case IMGFMT_CLPL:
- return("Planar CLPL");
- case IMGFMT_Y800:
- return("Planar Y800");
- case IMGFMT_Y8:
- return("Planar Y8");
- case IMGFMT_444P:
- return("Planar 444P");
- case IMGFMT_422P:
- return("Planar 422P");
- case IMGFMT_411P:
- return("Planar 411P");
- case IMGFMT_NV12:
- return("Planar NV12");
- //case IMGFMT_NV21: return("Planar NV21");
- //case IMGFMT_HM12: return("Planar NV12 Macroblock");
- case IMGFMT_IUYV:
- return("Packed IUYV");
- case IMGFMT_IY41:
- return("Packed IY41");
- case IMGFMT_IYU1:
- return("Packed IYU1");
- case IMGFMT_IYU2:
- return("Packed IYU2");
- case IMGFMT_UYVY:
- return("Packed UYVY");
- case IMGFMT_UYNV:
- return("Packed UYNV");
- case IMGFMT_cyuv:
- return("Packed CYUV");
- case IMGFMT_Y422:
- return("Packed Y422");
- case IMGFMT_YUY2:
- return("Packed YUY2");
- case IMGFMT_YUNV:
- return("Packed YUNV");
- case IMGFMT_YVYU:
- return("Packed YVYU");
- case IMGFMT_Y41P:
- return("Packed Y41P");
- case IMGFMT_Y211:
- return("Packed Y211");
- case IMGFMT_Y41T:
- return("Packed Y41T");
- case IMGFMT_Y42T:
- return("Packed Y42T");
- case IMGFMT_V422:
- return("Packed V422");
- case IMGFMT_V655:
- return("Packed V655");
- case IMGFMT_CLJR:
- return("Packed CLJR");
- case IMGFMT_YUVP:
- return("Packed YUVP");
- case IMGFMT_UYVP:
- return("Packed UYVP");
- //case IMGFMT_MPEGPES: return("Mpeg PES");
- //case IMGFMT_ZRMJPEGNI: return("Zoran MJPEG non-interlaced");
- //case IMGFMT_ZRMJPEGIT: return("Zoran MJPEG top field first");
- //case IMGFMT_ZRMJPEGIB: return("Zoran MJPEG bottom field first");
- //case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation");
- //case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT");
+ case IMGFMT_RGB1: return("RGB 1-bit");
+ case IMGFMT_RGB4: return("RGB 4-bit");
+ case IMGFMT_RG4B: return("RGB 4-bit per byte");
+ case IMGFMT_RGB8: return("RGB 8-bit");
+ case IMGFMT_RGB15: return("RGB 15-bit");
+ case IMGFMT_RGB16: return("RGB 16-bit");
+ case IMGFMT_RGB24: return("RGB 24-bit");
+ case IMGFMT_RGB32: return("RGB 32-bit");
+ case IMGFMT_BGR1: return("BGR 1-bit");
+ case IMGFMT_BGR4: return("BGR 4-bit");
+ case IMGFMT_BG4B: return("BGR 4-bit per byte");
+ case IMGFMT_BGR8: return("BGR 8-bit");
+ case IMGFMT_BGR15: return("BGR 15-bit");
+ case IMGFMT_BGR16: return("BGR 16-bit");
+ case IMGFMT_BGR24: return("BGR 24-bit");
+ case IMGFMT_BGR32: return("BGR 32-bit");
+ case IMGFMT_YVU9: return("Planar YVU9");
+ case IMGFMT_IF09: return("Planar IF09");
+ case IMGFMT_YV12: return("Planar YV12");
+ case IMGFMT_I420: return("Planar I420");
+ case IMGFMT_IYUV: return("Planar IYUV");
+ case IMGFMT_CLPL: return("Planar CLPL");
+ case IMGFMT_Y800: return("Planar Y800");
+ case IMGFMT_Y8: return("Planar Y8");
+ case IMGFMT_444P: return("Planar 444P");
+ case IMGFMT_422P: return("Planar 422P");
+ case IMGFMT_411P: return("Planar 411P");
+ case IMGFMT_NV12: return("Planar NV12");
+ //case IMGFMT_NV21: return("Planar NV21");
+ //case IMGFMT_HM12: return("Planar NV12 Macroblock");
+ case IMGFMT_IUYV: return("Packed IUYV");
+ case IMGFMT_IY41: return("Packed IY41");
+ case IMGFMT_IYU1: return("Packed IYU1");
+ case IMGFMT_IYU2: return("Packed IYU2");
+ case IMGFMT_UYVY: return("Packed UYVY");
+ case IMGFMT_UYNV: return("Packed UYNV");
+ case IMGFMT_cyuv: return("Packed CYUV");
+ case IMGFMT_Y422: return("Packed Y422");
+ case IMGFMT_YUY2: return("Packed YUY2");
+ case IMGFMT_YUNV: return("Packed YUNV");
+ case IMGFMT_YVYU: return("Packed YVYU");
+ case IMGFMT_Y41P: return("Packed Y41P");
+ case IMGFMT_Y211: return("Packed Y211");
+ case IMGFMT_Y41T: return("Packed Y41T");
+ case IMGFMT_Y42T: return("Packed Y42T");
+ case IMGFMT_V422: return("Packed V422");
+ case IMGFMT_V655: return("Packed V655");
+ case IMGFMT_CLJR: return("Packed CLJR");
+ case IMGFMT_YUVP: return("Packed YUVP");
+ case IMGFMT_UYVP: return("Packed UYVP");
+ //case IMGFMT_MPEGPES: return("Mpeg PES");
+ //case IMGFMT_ZRMJPEGNI: return("Zoran MJPEG non-interlaced");
+ //case IMGFMT_ZRMJPEGIT: return("Zoran MJPEG top field first");
+ //case IMGFMT_ZRMJPEGIB: return("Zoran MJPEG bottom field first");
+ //case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation");
+ //case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT");
}
- return("Unknown");
-}
-#include <stdarg.h>
-#define WINAPI __stdcall
-void WINAPI OutputDebugStringA(const char*); //rather than including windows.h
-static inline void mp_msg(int mod, int len, const char* fmt, ...)
-{
- va_list args;
- char buf[1024];
- va_start(args, fmt);
- vsprintf(buf, fmt, args);
- va_end(args);
- OutputDebugStringA(buf);
-};
+ return("Unknown");
+ }
+ #include <stdarg.h>
+ #define WINAPI __stdcall
+ void WINAPI OutputDebugStringA(const char*); //rather than including windows.h
+ static inline void mp_msg(int mod,int len,const char* fmt,...)
+ {
+ va_list args;
+ char buf[1024];
+ va_start(args, fmt);
+ vsprintf(buf, fmt, args);
+ va_end(args);
+ OutputDebugStringA(buf);
+ };
#endif
#endif
diff --git a/src/filters/transform/MPCVideoDec/intrin_fixed.h b/src/filters/transform/MPCVideoDec/intrin_fixed.h
index 52ef875da..23ac9f267 100644
--- a/src/filters/transform/MPCVideoDec/intrin_fixed.h
+++ b/src/filters/transform/MPCVideoDec/intrin_fixed.h
@@ -45,24 +45,24 @@
extern "C" {
#endif
- /*
- ** __MACHINE : all compilers
- ** __MACHINEX64: X64 compiler only
- ** __MACHINEARMX : ARM XSCALE intrinsics
- ** __MACHINECC : Intel XSCALE Concan
- ** __MACHINESA : ARM (StrongARM) only
- ** __MACHINECE : common intrinsic functions for Windows CE
- ** __MACHINEI : Intel (32 bit x86) and X64
- ** __MACHINEIA32 : 32 bit x86 arch only
- ** __MACHINEX86X : X86 Extended intrinsics
- ** __MACHINEX86X_NOX64 : X86 Extended intrinsics not supported on X64
- ** __MACHINEX86X_NOIA64 : X86 Extended intrinsics not supported on IA64
- ** __MACHINEX86X_NOWIN64 : X86 Extended intrinsics not supported on Win64 targets
- ** __MACHINEIA64 : IA64 compiler only
- ** __MACHINEIW64 : IA32 + Win64 compilers only (__MACHINEI + __MACHINEW64)
- ** __MACHINEW64 : WIN64(tm), 64 bit compilers only
- ** __MACHINEZ : nothing
- */
+/*
+** __MACHINE : all compilers
+** __MACHINEX64: X64 compiler only
+** __MACHINEARMX : ARM XSCALE intrinsics
+** __MACHINECC : Intel XSCALE Concan
+** __MACHINESA : ARM (StrongARM) only
+** __MACHINECE : common intrinsic functions for Windows CE
+** __MACHINEI : Intel (32 bit x86) and X64
+** __MACHINEIA32 : 32 bit x86 arch only
+** __MACHINEX86X : X86 Extended intrinsics
+** __MACHINEX86X_NOX64 : X86 Extended intrinsics not supported on X64
+** __MACHINEX86X_NOIA64 : X86 Extended intrinsics not supported on IA64
+** __MACHINEX86X_NOWIN64 : X86 Extended intrinsics not supported on Win64 targets
+** __MACHINEIA64 : IA64 compiler only
+** __MACHINEIW64 : IA32 + Win64 compilers only (__MACHINEI + __MACHINEW64)
+** __MACHINEW64 : WIN64(tm), 64 bit compilers only
+** __MACHINEZ : nothing
+*/
#define __MACHINEX64 __MACHINE
#define __MACHINEARMX __MACHINE
@@ -79,7 +79,7 @@ extern "C" {
#define __MACHINEIW64 __MACHINE
#define __MACHINEW64 __MACHINE
#if defined(_M_CEE_PURE)
- /* No intrinsics available to pure managed code */
+/* No intrinsics available to pure managed code */
#define __MACHINE(X) __MACHINEZ(X)
#else
#define __MACHINE(X) X;
@@ -106,7 +106,7 @@ extern "C" {
#define __MACHINEW64 __MACHINEZ
#endif
-#if !(_M_IX86 || _M_AMD64)
+#if !(_M_IX86 || _M_AMD64)
#undef __MACHINEX86X
#define __MACHINEX86X __MACHINEZ
#endif
@@ -145,1029 +145,1029 @@ extern "C" {
#define __MACHINECE __MACHINEZ
#endif
- __MACHINEIA64(void _AcquireSpinLock(unsigned __int64 *))
- __MACHINE(void * __cdecl _alloca(size_t))
- __MACHINE(int __cdecl abs(int))
- __MACHINEIA64(void __break(int))
- __MACHINECE(__int64 __cdecl _abs64(__int64))
- __MACHINE(unsigned short __cdecl _byteswap_ushort(unsigned short value))
- __MACHINE(unsigned long __cdecl _byteswap_ulong(unsigned long value))
- __MACHINE(unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 value))
- __MACHINECE(void __CacheRelease(void *))
- __MACHINECE(void __CacheWriteback(void *))
- __MACHINECE(_CRTIMP double ceil(double))
- __MACHINEX64(_CRTIMP double ceil(double))
- __MACHINECE(_CRTIMP double ceil(double))
- __MACHINECE(double _CopyDoubleFromInt64(__int64))
- __MACHINECE(float _CopyFloatFromInt32(__int32))
- __MACHINECE(__int64 _CopyInt64FromDouble(double))
- __MACHINECE(__int32 _CopyInt32FromFloat(float))
- __MACHINECE(unsigned _CountLeadingOnes(long))
- __MACHINECE(unsigned _CountLeadingOnes64(__int64))
- __MACHINECE(unsigned _CountLeadingSigns(long))
- __MACHINECE(unsigned _CountLeadingSigns64(__int64))
- __MACHINECE(unsigned _CountLeadingZeros(long))
- __MACHINECE(unsigned _CountLeadingZeros64(__int64))
- __MACHINECE(unsigned _CountOneBits(long))
- __MACHINECE(unsigned _CountOneBits64(__int64))
- __MACHINE(void __cdecl __debugbreak(void))
- __MACHINEI(void __cdecl _disable(void))
- __MACHINEIA64(void __cdecl _disable(void))
- __MACHINEIA64(void __dsrlz(void))
- __MACHINEI(__int64 __emul(int, int))
- __MACHINEI(unsigned __int64 __emulu(unsigned int, unsigned int))
- __MACHINEI(void __cdecl _enable(void))
- __MACHINEIA64(void __cdecl _enable(void))
- __MACHINEIA64(void __fc(__int64))
- __MACHINEIA64(void __fclrf(void))
- __MACHINEIA64(void __fsetc(int, int))
- __MACHINEIA64(void __fwb(void))
- __MACHINEIA64(unsigned __int64 __getReg(int))
- __MACHINEIA64(unsigned __int64 __getPSP(void))
- __MACHINEIA64(unsigned __int64 __getCFS(void))
- __MACHINECE(void __ICacheRefresh(void *))
- __MACHINEIA64(long _InterlockedAdd(long volatile *, long))
- __MACHINEIA64(long _InterlockedAdd_acq(long volatile *, long))
- __MACHINEIA64(long _InterlockedAdd_rel(long volatile *, long))
- __MACHINEIA64(__int64 _InterlockedAdd64(__int64 volatile *, __int64))
- __MACHINEIA64(__int64 _InterlockedAdd64_acq(__int64 volatile *, __int64))
- __MACHINEIA64(__int64 _InterlockedAdd64_rel(__int64 volatile *, __int64))
- __MACHINEI(long __cdecl _InterlockedDecrement(long volatile *))
- __MACHINEIA64(long _InterlockedDecrement(long volatile *))
- __MACHINEIA64(long _InterlockedDecrement_acq(long volatile *))
- __MACHINEIA64(long _InterlockedDecrement_rel(long volatile *))
- __MACHINEIA64(__int64 _InterlockedDecrement64(__int64 volatile *))
- __MACHINEIA64(__int64 _InterlockedDecrement64_acq(__int64 volatile *))
- __MACHINEIA64(__int64 _InterlockedDecrement64_rel(__int64 volatile *))
- __MACHINEX64(__int64 _InterlockedDecrement64(__int64 volatile *))
- __MACHINEI(long _InterlockedExchange(long volatile *, long))
- __MACHINEIA64(long _InterlockedExchange(long volatile *, long))
- __MACHINEIA64(long _InterlockedExchange_acq(long volatile *, long))
- __MACHINESA(long __stdcall _InterlockedExchange(long volatile *, long))
- __MACHINEIA64(__int64 _InterlockedExchange64(__int64 volatile *, __int64))
- __MACHINEIA64(__int64 _InterlockedExchange64_acq(__int64 volatile *, __int64))
- __MACHINEX64(__int64 _InterlockedExchange64(__int64 volatile *, __int64))
- __MACHINEIA64(void * _InterlockedExchangePointer(void * volatile *, void *))
- __MACHINEIA64(void * _InterlockedExchangePointer_acq(void * volatile *, void volatile *))
- __MACHINEX64(void * _InterlockedExchangePointer(void * volatile *, void *))
- __MACHINEI(long _InterlockedExchangeAdd(long volatile *, long))
- __MACHINEIA64(long _InterlockedExchangeAdd(long volatile *, long))
- __MACHINEIA64(long _InterlockedExchangeAdd_acq(long volatile *, long))
- __MACHINEIA64(long _InterlockedExchangeAdd_rel(long volatile *, long))
- __MACHINEIA64(__int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64))
- __MACHINEIA64(__int64 _InterlockedExchangeAdd64_acq(__int64 volatile *, __int64))
- __MACHINEIA64(__int64 _InterlockedExchangeAdd64_rel(__int64 volatile *, __int64))
- __MACHINEX64(__int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64))
- __MACHINEI(long _InterlockedCompareExchange(long volatile *, long, long))
- __MACHINEIA64(long _InterlockedCompareExchange(long volatile *, long, long))
- __MACHINEIA64(long _InterlockedCompareExchange_acq(long volatile *, long, long))
- __MACHINEIA64(long _InterlockedCompareExchange_rel(long volatile *, long, long))
- __MACHINEIA64(__int64 _InterlockedCompareExchange64(__int64 volatile *, __int64, __int64))
- __MACHINEIA64(__int64 _InterlockedCompareExchange64_acq(__int64 volatile *, __int64, __int64))
- __MACHINEIA64(__int64 _InterlockedCompareExchange64_rel(__int64 volatile *, __int64, __int64))
- __MACHINEIA64(__int64 _InterlockedCompare64Exchange128(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEIA64(__int64 _InterlockedCompare64Exchange128_acq(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEIA64(__int64 _InterlockedCompare64Exchange128_rel(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEX64(__int64 _InterlockedCompare64Exchange128(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEX64(__int64 _InterlockedCompare64Exchange128_acq(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEX64(__int64 _InterlockedCompare64Exchange128_rel(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEIA64(void *_InterlockedCompareExchangePointer(void * volatile *, void *, void *))
- __MACHINEIA64(void *_InterlockedCompareExchangePointer_acq(void * volatile *, void *, void *))
- __MACHINEIA64(void *_InterlockedCompareExchangePointer_rel(void * volatile *, void *, void *))
- __MACHINEI(__int64 _InterlockedCompareExchange64(__int64 volatile *, __int64, __int64))
- __MACHINEX64(void *_InterlockedCompareExchangePointer(void * volatile *, void *, void *))
- __MACHINEI(long __cdecl _InterlockedIncrement(long volatile *))
- __MACHINEIA64(long _InterlockedIncrement(long volatile *))
- __MACHINEIA64(long _InterlockedIncrement_acq(long volatile *))
- __MACHINEIA64(long _InterlockedIncrement_rel(long volatile *))
- __MACHINEIA64(__int64 _InterlockedIncrement64(__int64 volatile *))
- __MACHINEIA64(__int64 _InterlockedIncrement64_acq(__int64 volatile *))
- __MACHINEIA64(__int64 _InterlockedIncrement64_rel(__int64 volatile *))
- __MACHINEX64(__int64 _InterlockedIncrement64(__int64 volatile *))
- __MACHINEIW64(long _InterlockedOr(long volatile *, long))
- __MACHINEIW64(char _InterlockedOr8(char volatile *, char))
- __MACHINEIW64(short _InterlockedOr16(short volatile *, short))
- __MACHINEW64(__int64 _InterlockedOr64(__int64 volatile *, __int64))
- __MACHINEIA64(long _InterlockedOr_acq(long volatile *, long))
- __MACHINEIA64(char _InterlockedOr8_acq(char volatile *, char))
- __MACHINEIA64(short _InterlockedOr16_acq(short volatile *, short))
- __MACHINEIA64(__int64 _InterlockedOr64_acq(__int64 volatile *, __int64))
- __MACHINEIA64(long _InterlockedOr_rel(long volatile *, long))
- __MACHINEIA64(char _InterlockedOr8_rel(char volatile *, char))
- __MACHINEIA64(short _InterlockedOr16_rel(short volatile *, short))
- __MACHINEIA64(__int64 _InterlockedOr64_rel(__int64 volatile *, __int64))
- __MACHINEIW64(long _InterlockedXor(long volatile *, long))
- __MACHINEIW64(char _InterlockedXor8(char volatile *, char))
- __MACHINEIW64(short _InterlockedXor16(short volatile *, short))
- __MACHINEW64(__int64 _InterlockedXor64(__int64 volatile *, __int64))
- __MACHINEIA64(long _InterlockedXor_acq(long volatile *, long))
- __MACHINEIA64(char _InterlockedXor8_acq(char volatile *, char))
- __MACHINEIA64(short _InterlockedXor16_acq(short volatile *, short))
- __MACHINEIA64(__int64 _InterlockedXor64_acq(__int64 volatile *, __int64))
- __MACHINEIA64(long _InterlockedXor_rel(long volatile *, long))
- __MACHINEIA64(char _InterlockedXor8_rel(char volatile *, char))
- __MACHINEIA64(short _InterlockedXor16_rel(short volatile *, short))
- __MACHINEIA64(__int64 _InterlockedXor64_rel(__int64 volatile *, __int64))
- __MACHINEIW64(long _InterlockedAnd(long volatile *, long))
- __MACHINEIW64(char _InterlockedAnd8(char volatile *, char))
- __MACHINEIW64(short _InterlockedAnd16(short volatile *, short))
- __MACHINEW64(__int64 _InterlockedAnd64(__int64 volatile *, __int64))
- __MACHINEIA64(long _InterlockedAnd_acq(long volatile *, long))
- __MACHINEIA64(char _InterlockedAnd8_acq(char volatile *, char))
- __MACHINEIA64(short _InterlockedAnd16_acq(short volatile *, short))
- __MACHINEIA64(__int64 _InterlockedAnd64_acq(__int64 volatile *, __int64))
- __MACHINEIA64(long _InterlockedAnd_rel(long volatile *, long))
- __MACHINEIA64(char _InterlockedAnd8_rel(char volatile *, char))
- __MACHINEIA64(short _InterlockedAnd16_rel(short volatile *, short))
- __MACHINEIA64(__int64 _InterlockedAnd64_rel(__int64 volatile *, __int64))
- __MACHINEIA32(long _InterlockedAddLargeStatistic(__int64 volatile *, long))
- __MACHINEI(int __cdecl _inp(unsigned short))
- __MACHINEI(int __cdecl inp(unsigned short))
- __MACHINEI(unsigned long __cdecl _inpd(unsigned short))
- __MACHINEI(unsigned long __cdecl inpd(unsigned short))
- __MACHINEI(unsigned short __cdecl _inpw(unsigned short))
- __MACHINEI(unsigned short __cdecl inpw(unsigned short))
- __MACHINEIA64(int __isNat(int))
- __MACHINEIA64(void __isrlz(void))
- __MACHINEIA64(void __invalat(void))
- __MACHINECE(int _isnan(double))
- __MACHINECE(int _isnanf(float))
- __MACHINECE(int _isunordered(double, double))
- __MACHINECE(int _isunorderedf(float, float))
- __MACHINE(long __cdecl labs(long))
- __MACHINEIA64(void __lfetch(int, void const *))
- __MACHINEIA64(void __lfetchfault(int, void const *))
- __MACHINEIA64(void __lfetch_excl(int, void const *))
- __MACHINEIA64(void __lfetchfault_excl(int, void const *))
- __MACHINEIA64(__int64 __load128(void *, __int64 *))
- __MACHINEIA64(__int64 __load128_acq(void *, __int64 *))
- __MACHINEZ(void __cdecl longjmp(jmp_buf, int))
- __MACHINE(unsigned long __cdecl _lrotl(unsigned long, int))
- __MACHINE(unsigned long __cdecl _lrotr(unsigned long, int))
- __MACHINEI(unsigned __int64 __ll_lshift(unsigned __int64, int))
- __MACHINEI(__int64 __ll_rshift(__int64, int))
- __MACHINEIA64(__m64 __m64_czx1l(__m64))
- __MACHINEIA64(__m64 __m64_czx1r(__m64))
- __MACHINEIA64(__m64 __m64_czx2l(__m64))
- __MACHINEIA64(__m64 __m64_czx2r(__m64))
- __MACHINEIA64(__m64 __m64_dep_mi(const int, __m64, const int, const int))
- __MACHINEIA64(__m64 __m64_dep_mr(__m64, __m64, const int, const int))
- __MACHINEIA64(__m64 __m64_dep_zi(const int, const int, const int))
- __MACHINEIA64(__m64 __m64_dep_zr(__m64, const int, const int))
- __MACHINEIA64(__m64 __m64_extr(__m64, const int, const int))
- __MACHINEIA64(__m64 __m64_extru(__m64, const int, const int))
- __MACHINEIA64(__m64 __m64_mix1l(__m64, __m64))
- __MACHINEIA64(__m64 __m64_mix1r(__m64, __m64))
- __MACHINEIA64(__m64 __m64_mix2l(__m64, __m64))
- __MACHINEIA64(__m64 __m64_mix2r(__m64, __m64))
- __MACHINEIA64(__m64 __m64_mix4l(__m64, __m64))
- __MACHINEIA64(__m64 __m64_mix4r(__m64, __m64))
- __MACHINEIA64(__m64 __m64_mux1(__m64, const int))
- __MACHINEIA64(__m64 __m64_mux2(__m64, const int))
- __MACHINEIA64(__m64 __m64_muladd64hi(__m64, __m64, __m64))
- __MACHINEIA64(__m64 __m64_muladd64hi_u(__m64, __m64, __m64))
- __MACHINEIA64(__m64 __m64_muladd64lo(__m64, __m64, __m64))
- __MACHINEIA64(__m64 __m64_padd1uus(__m64, __m64))
- __MACHINEIA64(__m64 __m64_padd2uus(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pavg1_nraz(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pavg2_nraz(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pavgsub1(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pavgsub2(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pmpy2l(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pmpy2r(__m64, __m64))
- __MACHINEIA64(__m64 __m64_pmpyshr2(__m64, __m64, const int))
- __MACHINEIA64(__m64 __m64_pmpyshr2u(__m64, __m64, const int))
- __MACHINEIA64(__m64 __m64_popcnt(__m64))
- __MACHINEIA64(__m64 __m64_pshladd2(__m64, const int, __m64))
- __MACHINEIA64(__m64 __m64_pshradd2(__m64, const int, __m64))
- __MACHINEIA64(__m64 __m64_psub1uus(__m64, __m64))
- __MACHINEIA64(__m64 __m64_psub2uus(__m64, __m64))
- __MACHINEIA64(__m64 __m64_shladd(__m64, const int, __m64))
- __MACHINEIA64(__m64 __m64_shrp(__m64, __m64, const int))
- __MACHINECE(_CONST_RETURN void * __cdecl memchr(const void *, int, size_t))
- __MACHINE(int __cdecl memcmp(const void *, const void *, size_t))
- __MACHINE(void * __cdecl memcpy(void *, const void *, size_t))
- __MACHINE(void * __cdecl memset(void *, int, size_t))
- __MACHINEIA64(void __mf(void))
- __MACHINEIA64(void __mfa(void))
- __MACHINECE(long _MulHigh(long, long))
- __MACHINECE(unsigned long _MulUnsignedHigh(unsigned long, unsigned long))
- __MACHINEI(int __cdecl _outp(unsigned short, int))
- __MACHINEI(int __cdecl outp(unsigned short, int))
- __MACHINEI(unsigned long __cdecl _outpd(unsigned short, unsigned long))
- __MACHINEI(unsigned long __cdecl outpd(unsigned short, unsigned long))
- __MACHINEI(unsigned short __cdecl _outpw(unsigned short, unsigned short))
- __MACHINEI(unsigned short __cdecl outpw(unsigned short, unsigned short))
- __MACHINECE(void __cdecl __prefetch(unsigned long *addr))
- __MACHINEIA64(void __ptcl(__int64, __int64))
- __MACHINEIA64(void __ptcg(__int64, __int64))
- __MACHINEIA64(void __ptcga(__int64, __int64))
- __MACHINEIA64(void __ptrd(__int64, __int64))
- __MACHINEIA64(void __ptri(__int64, __int64))
- __MACHINEIA64(void *_rdteb(void))
- __MACHINEIA64(void *_rdtebex(void))
- __MACHINESA(int _ReadStatusReg(int))
- __MACHINECE(void _ReadWriteBarrier(void))
- __MACHINEIA64(void _ReleaseSpinLock(unsigned __int64 *))
- __MACHINEI(void * _ReturnAddress(void))
- __MACHINEIA64(void * _ReturnAddress(void))
- __MACHINESA(void * _ReturnAddress(void))
- __MACHINECE(void * _ReturnAddress(void))
- __MACHINE(unsigned int __cdecl _rotl(unsigned int, int))
- __MACHINECE(unsigned __int64 __cdecl _rotl64(unsigned __int64, int))
- __MACHINE(unsigned int __cdecl _rotr(unsigned int, int))
- __MACHINECE(unsigned __int64 __cdecl _rotr64(unsigned __int64, int))
- __MACHINEIA64(void __rsm(int))
- __MACHINEIA64(void __rum(int))
- __MACHINE(int __cdecl _setjmp(jmp_buf))
- __MACHINEIA64(int __cdecl _setjmpex(jmp_buf))
- __MACHINEX64(int __cdecl _setjmpex(jmp_buf))
- __MACHINEIA64(void __setReg(int, unsigned __int64))
- __MACHINEARMX(void _SmulAdd_SL_ACC(int, int))
- __MACHINEARMX(void _SmulAddPack_2SW_ACC(int, int))
- __MACHINEARMX(void _SmulAddLo_SW_ACC(int, int))
- __MACHINEARMX(void _SmulAddHi_SW_ACC(int, int))
- __MACHINEARMX(void _SmulAddHiLo_SW_ACC(int, int))
- __MACHINEARMX(void _SmulAddLoHi_SW_ACC(int, int))
- __MACHINEIA64(void __store128(void *, __int64, __int64))
- __MACHINEIA64(void __store128_rel(void *, __int64, __int64))
- __MACHINE(char * __cdecl strcat(char *, const char *))
- __MACHINE(int __cdecl strcmp(const char *, const char *))
- __MACHINE(char * __cdecl strcpy(char *, const char *))
- __MACHINE(size_t __cdecl strlen(const char *))
- __MACHINECE(int __cdecl strncmp(const char *, const char *, size_t))
- __MACHINECE(char * __cdecl strncpy(char *, const char *, size_t))
- __MACHINE(char * __cdecl _strset(char *, int))
- __MACHINE(char * __cdecl strset(char *, int))
- __MACHINEIA64(void __ssm(int))
- __MACHINEIA64(void __sum(int))
- __MACHINESA(int __swi(unsigned, ...))
- __MACHINEIA64(void __synci(void))
- __MACHINEIA64(__int64 __thash(__int64))
- __MACHINEIA64(__int64 __ttag(__int64))
- __MACHINECE(int __trap(int, ...))
- __MACHINEI(unsigned __int64 __ull_rshift(unsigned __int64, int))
- __MACHINEIA64(unsigned __int64 __UMULH(unsigned __int64 a, unsigned __int64 b))
- __MACHINECE(wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *))
- __MACHINECE(int __cdecl wcscmp(const wchar_t *, const wchar_t *))
- __MACHINECE(wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *))
- __MACHINECE(size_t __cdecl wcslen(const wchar_t *))
- __MACHINECE(int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t))
- __MACHINECE(wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t))
- __MACHINECE(wchar_t * __cdecl _wcsset(wchar_t *, wchar_t))
- __MACHINECE(void _WriteBarrier(void))
- __MACHINESA(void _WriteStatusReg(int, int, int))
- __MACHINEI(void * _AddressOfReturnAddress(void))
- __MACHINEIA64(void __yield(void))
- __MACHINEIA64(void __fci(void*))
+__MACHINEIA64(void _AcquireSpinLock(unsigned __int64 *))
+__MACHINE(void * __cdecl _alloca(size_t))
+__MACHINE(int __cdecl abs(int))
+__MACHINEIA64(void __break(int))
+__MACHINECE(__int64 __cdecl _abs64(__int64))
+__MACHINE(unsigned short __cdecl _byteswap_ushort(unsigned short value))
+__MACHINE(unsigned long __cdecl _byteswap_ulong(unsigned long value))
+__MACHINE(unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 value))
+__MACHINECE(void __CacheRelease(void *))
+__MACHINECE(void __CacheWriteback(void *))
+__MACHINECE(_CRTIMP double ceil(double))
+__MACHINEX64(_CRTIMP double ceil(double))
+__MACHINECE(_CRTIMP double ceil(double))
+__MACHINECE(double _CopyDoubleFromInt64(__int64))
+__MACHINECE(float _CopyFloatFromInt32(__int32))
+__MACHINECE(__int64 _CopyInt64FromDouble(double))
+__MACHINECE(__int32 _CopyInt32FromFloat(float))
+__MACHINECE(unsigned _CountLeadingOnes(long))
+__MACHINECE(unsigned _CountLeadingOnes64(__int64))
+__MACHINECE(unsigned _CountLeadingSigns(long))
+__MACHINECE(unsigned _CountLeadingSigns64(__int64))
+__MACHINECE(unsigned _CountLeadingZeros(long))
+__MACHINECE(unsigned _CountLeadingZeros64(__int64))
+__MACHINECE(unsigned _CountOneBits(long))
+__MACHINECE(unsigned _CountOneBits64(__int64))
+__MACHINE(void __cdecl __debugbreak(void))
+__MACHINEI(void __cdecl _disable(void))
+__MACHINEIA64(void __cdecl _disable(void))
+__MACHINEIA64(void __dsrlz(void))
+__MACHINEI(__int64 __emul(int,int))
+__MACHINEI(unsigned __int64 __emulu(unsigned int,unsigned int))
+__MACHINEI(void __cdecl _enable(void))
+__MACHINEIA64(void __cdecl _enable(void))
+__MACHINEIA64(void __fc(__int64))
+__MACHINEIA64(void __fclrf(void))
+__MACHINEIA64(void __fsetc(int, int))
+__MACHINEIA64(void __fwb(void))
+__MACHINEIA64(unsigned __int64 __getReg(int))
+__MACHINEIA64(unsigned __int64 __getPSP(void))
+__MACHINEIA64(unsigned __int64 __getCFS(void))
+__MACHINECE(void __ICacheRefresh(void *))
+__MACHINEIA64(long _InterlockedAdd(long volatile *, long))
+__MACHINEIA64(long _InterlockedAdd_acq(long volatile *, long))
+__MACHINEIA64(long _InterlockedAdd_rel(long volatile *, long))
+__MACHINEIA64(__int64 _InterlockedAdd64(__int64 volatile *, __int64))
+__MACHINEIA64(__int64 _InterlockedAdd64_acq(__int64 volatile *, __int64))
+__MACHINEIA64(__int64 _InterlockedAdd64_rel(__int64 volatile *, __int64))
+__MACHINEI(long __cdecl _InterlockedDecrement(long volatile *))
+__MACHINEIA64(long _InterlockedDecrement(long volatile *))
+__MACHINEIA64(long _InterlockedDecrement_acq(long volatile *))
+__MACHINEIA64(long _InterlockedDecrement_rel(long volatile *))
+__MACHINEIA64(__int64 _InterlockedDecrement64(__int64 volatile *))
+__MACHINEIA64(__int64 _InterlockedDecrement64_acq(__int64 volatile *))
+__MACHINEIA64(__int64 _InterlockedDecrement64_rel(__int64 volatile *))
+__MACHINEX64(__int64 _InterlockedDecrement64(__int64 volatile *))
+__MACHINEI(long _InterlockedExchange(long volatile *, long))
+__MACHINEIA64(long _InterlockedExchange(long volatile *, long))
+__MACHINEIA64(long _InterlockedExchange_acq(long volatile *, long))
+__MACHINESA(long __stdcall _InterlockedExchange(long volatile *, long))
+__MACHINEIA64(__int64 _InterlockedExchange64(__int64 volatile *, __int64))
+__MACHINEIA64(__int64 _InterlockedExchange64_acq(__int64 volatile *, __int64))
+__MACHINEX64(__int64 _InterlockedExchange64(__int64 volatile *, __int64))
+__MACHINEIA64(void * _InterlockedExchangePointer(void * volatile *, void *))
+__MACHINEIA64(void * _InterlockedExchangePointer_acq(void * volatile *, void volatile *))
+__MACHINEX64(void * _InterlockedExchangePointer(void * volatile *, void *))
+__MACHINEI(long _InterlockedExchangeAdd(long volatile *, long))
+__MACHINEIA64(long _InterlockedExchangeAdd(long volatile *, long))
+__MACHINEIA64(long _InterlockedExchangeAdd_acq(long volatile *, long))
+__MACHINEIA64(long _InterlockedExchangeAdd_rel(long volatile *, long))
+__MACHINEIA64(__int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64))
+__MACHINEIA64(__int64 _InterlockedExchangeAdd64_acq(__int64 volatile *, __int64))
+__MACHINEIA64(__int64 _InterlockedExchangeAdd64_rel(__int64 volatile *, __int64))
+__MACHINEX64(__int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64))
+__MACHINEI(long _InterlockedCompareExchange (long volatile *, long, long))
+__MACHINEIA64(long _InterlockedCompareExchange (long volatile *, long, long))
+__MACHINEIA64(long _InterlockedCompareExchange_acq (long volatile *, long, long))
+__MACHINEIA64(long _InterlockedCompareExchange_rel (long volatile *, long, long))
+__MACHINEIA64(__int64 _InterlockedCompareExchange64(__int64 volatile *, __int64, __int64))
+__MACHINEIA64(__int64 _InterlockedCompareExchange64_acq(__int64 volatile *, __int64, __int64))
+__MACHINEIA64(__int64 _InterlockedCompareExchange64_rel(__int64 volatile *, __int64, __int64))
+__MACHINEIA64(__int64 _InterlockedCompare64Exchange128(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEIA64(__int64 _InterlockedCompare64Exchange128_acq(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEIA64(__int64 _InterlockedCompare64Exchange128_rel(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEX64(__int64 _InterlockedCompare64Exchange128(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEX64(__int64 _InterlockedCompare64Exchange128_acq(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEX64(__int64 _InterlockedCompare64Exchange128_rel(__int64 volatile *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEIA64(void *_InterlockedCompareExchangePointer (void * volatile *, void *, void *))
+__MACHINEIA64(void *_InterlockedCompareExchangePointer_acq (void * volatile *, void *, void *))
+__MACHINEIA64(void *_InterlockedCompareExchangePointer_rel (void * volatile *, void *, void *))
+__MACHINEI(__int64 _InterlockedCompareExchange64(__int64 volatile *, __int64, __int64))
+__MACHINEX64(void *_InterlockedCompareExchangePointer (void * volatile *, void *, void *))
+__MACHINEI(long __cdecl _InterlockedIncrement(long volatile *))
+__MACHINEIA64(long _InterlockedIncrement(long volatile *))
+__MACHINEIA64(long _InterlockedIncrement_acq(long volatile *))
+__MACHINEIA64(long _InterlockedIncrement_rel(long volatile *))
+__MACHINEIA64(__int64 _InterlockedIncrement64(__int64 volatile *))
+__MACHINEIA64(__int64 _InterlockedIncrement64_acq(__int64 volatile *))
+__MACHINEIA64(__int64 _InterlockedIncrement64_rel(__int64 volatile *))
+__MACHINEX64(__int64 _InterlockedIncrement64(__int64 volatile *))
+__MACHINEIW64(long _InterlockedOr(long volatile *, long))
+__MACHINEIW64(char _InterlockedOr8(char volatile *, char))
+__MACHINEIW64(short _InterlockedOr16(short volatile *, short))
+__MACHINEW64(__int64 _InterlockedOr64(__int64 volatile *, __int64))
+__MACHINEIA64(long _InterlockedOr_acq(long volatile *, long))
+__MACHINEIA64(char _InterlockedOr8_acq(char volatile *, char))
+__MACHINEIA64(short _InterlockedOr16_acq(short volatile *, short))
+__MACHINEIA64(__int64 _InterlockedOr64_acq(__int64 volatile *, __int64))
+__MACHINEIA64(long _InterlockedOr_rel(long volatile *, long))
+__MACHINEIA64(char _InterlockedOr8_rel(char volatile *, char))
+__MACHINEIA64(short _InterlockedOr16_rel(short volatile *, short))
+__MACHINEIA64(__int64 _InterlockedOr64_rel(__int64 volatile *, __int64))
+__MACHINEIW64(long _InterlockedXor(long volatile *, long))
+__MACHINEIW64(char _InterlockedXor8(char volatile *, char))
+__MACHINEIW64(short _InterlockedXor16(short volatile *, short))
+__MACHINEW64(__int64 _InterlockedXor64(__int64 volatile *, __int64))
+__MACHINEIA64(long _InterlockedXor_acq(long volatile *, long))
+__MACHINEIA64(char _InterlockedXor8_acq(char volatile *, char))
+__MACHINEIA64(short _InterlockedXor16_acq(short volatile *, short))
+__MACHINEIA64(__int64 _InterlockedXor64_acq(__int64 volatile *, __int64))
+__MACHINEIA64(long _InterlockedXor_rel(long volatile *, long))
+__MACHINEIA64(char _InterlockedXor8_rel(char volatile *, char))
+__MACHINEIA64(short _InterlockedXor16_rel(short volatile *, short))
+__MACHINEIA64(__int64 _InterlockedXor64_rel(__int64 volatile *, __int64))
+__MACHINEIW64(long _InterlockedAnd(long volatile *, long))
+__MACHINEIW64(char _InterlockedAnd8(char volatile *, char))
+__MACHINEIW64(short _InterlockedAnd16(short volatile *, short))
+__MACHINEW64(__int64 _InterlockedAnd64(__int64 volatile *, __int64))
+__MACHINEIA64(long _InterlockedAnd_acq(long volatile *, long))
+__MACHINEIA64(char _InterlockedAnd8_acq(char volatile *, char))
+__MACHINEIA64(short _InterlockedAnd16_acq(short volatile *, short))
+__MACHINEIA64(__int64 _InterlockedAnd64_acq(__int64 volatile *, __int64))
+__MACHINEIA64(long _InterlockedAnd_rel(long volatile *, long))
+__MACHINEIA64(char _InterlockedAnd8_rel(char volatile *, char))
+__MACHINEIA64(short _InterlockedAnd16_rel(short volatile *, short))
+__MACHINEIA64(__int64 _InterlockedAnd64_rel(__int64 volatile *, __int64))
+__MACHINEIA32(long _InterlockedAddLargeStatistic(__int64 volatile *, long))
+__MACHINEI(int __cdecl _inp(unsigned short))
+__MACHINEI(int __cdecl inp(unsigned short))
+__MACHINEI(unsigned long __cdecl _inpd(unsigned short))
+__MACHINEI(unsigned long __cdecl inpd(unsigned short))
+__MACHINEI(unsigned short __cdecl _inpw(unsigned short))
+__MACHINEI(unsigned short __cdecl inpw(unsigned short))
+__MACHINEIA64(int __isNat(int))
+__MACHINEIA64(void __isrlz(void))
+__MACHINEIA64(void __invalat(void))
+__MACHINECE(int _isnan(double))
+__MACHINECE(int _isnanf(float))
+__MACHINECE(int _isunordered(double,double))
+__MACHINECE(int _isunorderedf(float,float))
+__MACHINE(long __cdecl labs(long))
+__MACHINEIA64(void __lfetch(int, void const *))
+__MACHINEIA64(void __lfetchfault(int, void const *))
+__MACHINEIA64(void __lfetch_excl(int, void const *))
+__MACHINEIA64(void __lfetchfault_excl(int, void const *))
+__MACHINEIA64(__int64 __load128(void *, __int64 *))
+__MACHINEIA64(__int64 __load128_acq(void *, __int64 *))
+__MACHINEZ(void __cdecl longjmp(jmp_buf, int))
+__MACHINE(unsigned long __cdecl _lrotl(unsigned long,int))
+__MACHINE(unsigned long __cdecl _lrotr(unsigned long,int))
+__MACHINEI(unsigned __int64 __ll_lshift(unsigned __int64,int))
+__MACHINEI(__int64 __ll_rshift(__int64,int))
+__MACHINEIA64(__m64 __m64_czx1l(__m64))
+__MACHINEIA64(__m64 __m64_czx1r(__m64))
+__MACHINEIA64(__m64 __m64_czx2l(__m64))
+__MACHINEIA64(__m64 __m64_czx2r(__m64))
+__MACHINEIA64(__m64 __m64_dep_mi(const int,__m64,const int,const int))
+__MACHINEIA64(__m64 __m64_dep_mr(__m64,__m64,const int,const int))
+__MACHINEIA64(__m64 __m64_dep_zi(const int,const int,const int))
+__MACHINEIA64(__m64 __m64_dep_zr(__m64,const int,const int))
+__MACHINEIA64(__m64 __m64_extr(__m64,const int,const int))
+__MACHINEIA64(__m64 __m64_extru(__m64,const int,const int))
+__MACHINEIA64(__m64 __m64_mix1l(__m64,__m64))
+__MACHINEIA64(__m64 __m64_mix1r(__m64,__m64))
+__MACHINEIA64(__m64 __m64_mix2l(__m64,__m64))
+__MACHINEIA64(__m64 __m64_mix2r(__m64,__m64))
+__MACHINEIA64(__m64 __m64_mix4l(__m64,__m64))
+__MACHINEIA64(__m64 __m64_mix4r(__m64,__m64))
+__MACHINEIA64(__m64 __m64_mux1(__m64,const int))
+__MACHINEIA64(__m64 __m64_mux2(__m64,const int))
+__MACHINEIA64(__m64 __m64_muladd64hi(__m64,__m64,__m64))
+__MACHINEIA64(__m64 __m64_muladd64hi_u(__m64,__m64,__m64))
+__MACHINEIA64(__m64 __m64_muladd64lo(__m64,__m64,__m64))
+__MACHINEIA64(__m64 __m64_padd1uus(__m64,__m64))
+__MACHINEIA64(__m64 __m64_padd2uus(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pavg1_nraz(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pavg2_nraz(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pavgsub1(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pavgsub2(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pmpy2l(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pmpy2r(__m64,__m64))
+__MACHINEIA64(__m64 __m64_pmpyshr2(__m64,__m64,const int))
+__MACHINEIA64(__m64 __m64_pmpyshr2u(__m64,__m64,const int))
+__MACHINEIA64(__m64 __m64_popcnt(__m64))
+__MACHINEIA64(__m64 __m64_pshladd2(__m64,const int,__m64))
+__MACHINEIA64(__m64 __m64_pshradd2(__m64,const int,__m64))
+__MACHINEIA64(__m64 __m64_psub1uus(__m64,__m64))
+__MACHINEIA64(__m64 __m64_psub2uus(__m64,__m64))
+__MACHINEIA64(__m64 __m64_shladd(__m64,const int,__m64))
+__MACHINEIA64(__m64 __m64_shrp(__m64,__m64,const int))
+__MACHINECE(_CONST_RETURN void * __cdecl memchr(const void *,int,size_t))
+__MACHINE(int __cdecl memcmp(const void *,const void *,size_t))
+__MACHINE(void * __cdecl memcpy(void *,const void *,size_t))
+__MACHINE(void * __cdecl memset(void *,int,size_t))
+__MACHINEIA64(void __mf(void))
+__MACHINEIA64(void __mfa(void))
+__MACHINECE(long _MulHigh(long,long))
+__MACHINECE(unsigned long _MulUnsignedHigh (unsigned long,unsigned long))
+__MACHINEI(int __cdecl _outp(unsigned short,int))
+__MACHINEI(int __cdecl outp(unsigned short,int))
+__MACHINEI(unsigned long __cdecl _outpd(unsigned short,unsigned long))
+__MACHINEI(unsigned long __cdecl outpd(unsigned short,unsigned long))
+__MACHINEI(unsigned short __cdecl _outpw(unsigned short,unsigned short))
+__MACHINEI(unsigned short __cdecl outpw(unsigned short,unsigned short))
+__MACHINECE(void __cdecl __prefetch(unsigned long *addr))
+__MACHINEIA64(void __ptcl(__int64, __int64))
+__MACHINEIA64(void __ptcg(__int64, __int64))
+__MACHINEIA64(void __ptcga(__int64, __int64))
+__MACHINEIA64(void __ptrd(__int64, __int64))
+__MACHINEIA64(void __ptri(__int64, __int64))
+__MACHINEIA64(void *_rdteb(void))
+__MACHINEIA64(void *_rdtebex(void))
+__MACHINESA(int _ReadStatusReg(int))
+__MACHINECE(void _ReadWriteBarrier(void))
+__MACHINEIA64(void _ReleaseSpinLock(unsigned __int64 * ))
+__MACHINEI(void * _ReturnAddress(void))
+__MACHINEIA64(void * _ReturnAddress(void))
+__MACHINESA(void * _ReturnAddress(void))
+__MACHINECE(void * _ReturnAddress(void))
+__MACHINE(unsigned int __cdecl _rotl(unsigned int,int))
+__MACHINECE(unsigned __int64 __cdecl _rotl64(unsigned __int64,int))
+__MACHINE(unsigned int __cdecl _rotr(unsigned int,int))
+__MACHINECE(unsigned __int64 __cdecl _rotr64(unsigned __int64,int))
+__MACHINEIA64(void __rsm(int))
+__MACHINEIA64(void __rum(int))
+__MACHINE(int __cdecl _setjmp(jmp_buf))
+__MACHINEIA64(int __cdecl _setjmpex(jmp_buf))
+__MACHINEX64(int __cdecl _setjmpex(jmp_buf))
+__MACHINEIA64(void __setReg(int,unsigned __int64))
+__MACHINEARMX(void _SmulAdd_SL_ACC(int, int))
+__MACHINEARMX(void _SmulAddPack_2SW_ACC(int, int))
+__MACHINEARMX(void _SmulAddLo_SW_ACC(int, int))
+__MACHINEARMX(void _SmulAddHi_SW_ACC(int, int))
+__MACHINEARMX(void _SmulAddHiLo_SW_ACC(int,int))
+__MACHINEARMX(void _SmulAddLoHi_SW_ACC(int,int))
+__MACHINEIA64(void __store128(void *, __int64, __int64))
+__MACHINEIA64(void __store128_rel(void *, __int64, __int64))
+__MACHINE(char * __cdecl strcat(char *,const char *))
+__MACHINE(int __cdecl strcmp(const char *,const char *))
+__MACHINE(char * __cdecl strcpy(char *,const char *))
+__MACHINE(size_t __cdecl strlen(const char *))
+__MACHINECE(int __cdecl strncmp(const char *,const char *,size_t))
+__MACHINECE(char * __cdecl strncpy(char *,const char *,size_t))
+__MACHINE(char * __cdecl _strset(char *,int))
+__MACHINE(char * __cdecl strset(char *,int))
+__MACHINEIA64(void __ssm(int))
+__MACHINEIA64(void __sum(int))
+__MACHINESA(int __swi(unsigned, ...))
+__MACHINEIA64(void __synci(void))
+__MACHINEIA64(__int64 __thash(__int64))
+__MACHINEIA64(__int64 __ttag(__int64))
+__MACHINECE(int __trap(int,...))
+__MACHINEI(unsigned __int64 __ull_rshift(unsigned __int64,int))
+__MACHINEIA64(unsigned __int64 __UMULH(unsigned __int64 a, unsigned __int64 b))
+__MACHINECE(wchar_t * __cdecl wcscat(wchar_t *,const wchar_t *))
+__MACHINECE(int __cdecl wcscmp(const wchar_t *,const wchar_t *))
+__MACHINECE(wchar_t * __cdecl wcscpy(wchar_t *,const wchar_t *))
+__MACHINECE(size_t __cdecl wcslen(const wchar_t *))
+__MACHINECE(int __cdecl wcsncmp(const wchar_t *, const wchar_t *,size_t))
+__MACHINECE(wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *,size_t))
+__MACHINECE(wchar_t * __cdecl _wcsset(wchar_t *,wchar_t))
+__MACHINECE(void _WriteBarrier(void))
+__MACHINESA(void _WriteStatusReg(int,int, int))
+__MACHINEI(void * _AddressOfReturnAddress(void))
+__MACHINEIA64(void __yield(void))
+__MACHINEIA64(void __fci(void*))
- __MACHINEX86X_NOX64(void _m_empty(void))
- __MACHINEX86X_NOX64(__m64 _m_from_int(int))
- __MACHINEX86X_NOX64(int _m_to_int(__m64))
- __MACHINEX86X_NOX64(__m64 _m_packsswb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_packssdw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_packuswb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_punpckhbw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_punpckhwd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_punpckhdq(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_punpcklbw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_punpcklwd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_punpckldq(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddsb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddsw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddusb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_paddusw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubsb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubsw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubusb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psubusw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pmaddwd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pmulhw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pmullw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psllw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psllwi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_pslld(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pslldi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_psllq(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psllqi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_psraw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psrawi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_psrad(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psradi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_psrlw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psrlwi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_psrld(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psrldi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_psrlq(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psrlqi(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_pand(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pandn(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_por(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pxor(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pcmpeqb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pcmpeqw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pcmpeqd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pcmpgtb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pcmpgtw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pcmpgtd(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _mm_setzero_si64(void))
- __MACHINEX86X_NOX64(__m64 _mm_set_pi32(int, int))
- __MACHINEX86X_NOX64(__m64 _mm_set_pi16(short, short, short, short))
- __MACHINEX86X_NOX64(__m64 _mm_set_pi8(char, char, char, char, char, char, char, char))
- __MACHINEX86X_NOX64(__m64 _mm_set1_pi32(int))
- __MACHINEX86X_NOX64(__m64 _mm_set1_pi16(short))
- __MACHINEX86X_NOX64(__m64 _mm_set1_pi8(char))
- __MACHINEX86X_NOX64(__m64 _mm_setr_pi32(int, int))
- __MACHINEX86X_NOX64(__m64 _mm_setr_pi16(short, short, short, short))
- __MACHINEX86X_NOX64(__m64 _mm_setr_pi8(char, char, char, char, char, char, char, char))
- __MACHINEX86X_NOX64(int _m_pextrw(__m64, int))
- __MACHINEX86X_NOX64(__m64 _m_pinsrw(__m64, int, int))
- __MACHINEX86X_NOX64(__m64 _m_pmaxsw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pmaxub(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pminsw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pminub(__m64, __m64))
- __MACHINEX86X_NOX64(int _m_pmovmskb(__m64))
- __MACHINEX86X_NOX64(__m64 _m_pmulhuw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pshufw(__m64, int))
- __MACHINEX86X_NOX64(void _m_maskmovq(__m64, __m64, char*))
- __MACHINEX86X_NOX64(__m64 _m_pavgb(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_pavgw(__m64, __m64))
- __MACHINEX86X_NOX64(__m64 _m_psadbw(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_from_float(float))
- __MACHINEX86X_NOWIN64(float _m_to_float(__m64))
- __MACHINEX86X_NOIA64(__m128 _mm_add_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_add_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_sub_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_sub_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_mul_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_mul_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_div_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_div_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_sqrt_ss(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_sqrt_ps(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_rcp_ss(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_rcp_ps(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_rsqrt_ss(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_rsqrt_ps(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_min_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_min_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_max_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_max_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_and_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_andnot_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_or_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_xor_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpeq_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpeq_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmplt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmplt_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmple_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmple_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpgt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpgt_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpge_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpge_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpneq_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpneq_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpnlt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpnlt_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpnle_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpnle_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpngt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpngt_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpnge_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpnge_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpord_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpord_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpunord_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cmpunord_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_comieq_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_comilt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_comile_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_comigt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_comige_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_comineq_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_ucomieq_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_ucomilt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_ucomile_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_ucomigt_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_ucomige_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_ucomineq_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(int _mm_cvt_ss2si(__m128))
- __MACHINEX86X_NOWIN64(__m64 _mm_cvt_ps2pi(__m128))
- __MACHINEX86X_NOIA64(int _mm_cvtt_ss2si(__m128))
- __MACHINEX86X_NOWIN64(__m64 _mm_cvtt_ps2pi(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_cvt_si2ss(__m128, int))
- __MACHINEX86X_NOWIN64(__m128 _mm_cvt_pi2ps(__m128, __m64))
- __MACHINEX86X_NOIA64(__m128 _mm_shuffle_ps(__m128, __m128, unsigned int))
- __MACHINEX86X_NOIA64(__m128 _mm_unpackhi_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_unpacklo_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_loadh_pi(__m128, __m64 const*))
- __MACHINEX86X_NOIA64(void _mm_storeh_pi(__m64*, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_loadl_pi(__m128, __m64 const*))
- __MACHINEX86X_NOIA64(void _mm_storel_pi(__m64*, __m128))
- __MACHINEX86X_NOIA64(int _mm_movemask_ps(__m128))
- __MACHINEX86X_NOIA64(__m128 _mm_set_ss(float))
- __MACHINEX86X_NOIA64(__m128 _mm_set_ps1(float))
- __MACHINEX86X_NOIA64(__m128 _mm_set_ps(float, float, float, float))
- __MACHINEX86X_NOIA64(__m128 _mm_setr_ps(float, float, float, float))
- __MACHINEX86X_NOIA64(__m128 _mm_setzero_ps(void))
- __MACHINEX86X_NOIA64(__m128 _mm_load_ss(float const*))
- __MACHINEX86X_NOIA64(__m128 _mm_load_ps1(float const*))
- __MACHINEX86X_NOIA64(__m128 _mm_load_ps(float const*))
- __MACHINEX86X_NOIA64(__m128 _mm_loadr_ps(float const*))
- __MACHINEX86X_NOIA64(__m128 _mm_loadu_ps(float const*))
- __MACHINEX86X_NOIA64(__m128 _mm_move_ss(__m128, __m128))
- __MACHINEX86X_NOIA64(void _mm_store_ss(float*, __m128))
- __MACHINEX86X_NOIA64(void _mm_store_ps1(float*, __m128))
- __MACHINEX86X_NOIA64(void _mm_store_ps(float*, __m128))
- __MACHINEX86X_NOIA64(void _mm_storer_ps(float*, __m128))
- __MACHINEX86X_NOIA64(void _mm_storeu_ps(float*, __m128))
- __MACHINEX86X_NOIA64(void _mm_prefetch(char const*, int))
- __MACHINEX86X_NOWIN64(void _mm_stream_pi(__m64*, __m64))
- __MACHINEX86X_NOIA64(void _mm_stream_ps(float*, __m128))
- __MACHINEX86X_NOIA64(void _mm_sfence(void))
- __MACHINEX86X_NOIA64(unsigned int _mm_getcsr(void))
- __MACHINEX86X_NOIA64(void _mm_setcsr(unsigned int))
- __MACHINEX86X_NOIA64(__m128 _mm_movelh_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(__m128 _mm_movehl_ps(__m128, __m128))
- __MACHINEX86X_NOIA64(void _m_prefetch(void*))
- __MACHINEX86X_NOIA64(void _m_prefetchw(volatile const void*_Source))
- __MACHINEX86X_NOWIN64(void _m_femms(void))
- __MACHINEX86X_NOWIN64(__m64 _m_pavgusb(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pf2id(__m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfacc(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfadd(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfcmpeq(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfcmpge(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfcmpgt(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfmax(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfmin(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfmul(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfrcp(__m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfrcpit1(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfrcpit2(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfrsqrt(__m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfrsqit1(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfsub(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfsubr(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pi2fd(__m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pmulhrw(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pf2iw(__m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfnacc(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pfpnacc(__m64, __m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pi2fw(__m64))
- __MACHINEX86X_NOWIN64(__m64 _m_pswapd(__m64))
- __MACHINEX86X(__m128d _mm_add_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_add_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_div_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_div_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_max_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_max_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_min_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_min_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_mul_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_mul_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_sqrt_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_sqrt_pd(__m128d))
- __MACHINEX86X(__m128d _mm_sub_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_sub_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_and_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_andnot_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_or_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_xor_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpeq_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpeq_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmplt_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmplt_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmple_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmple_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpgt_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpgt_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpge_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpge_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpneq_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpneq_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpnlt_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpnlt_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpnle_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpnle_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpngt_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpngt_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpnge_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpnge_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpord_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpord_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpunord_sd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_cmpunord_pd(__m128d, __m128d))
- __MACHINEX86X(int _mm_comieq_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_comilt_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_comile_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_comigt_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_comige_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_comineq_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_ucomieq_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_ucomilt_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_ucomile_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_ucomigt_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_ucomige_sd(__m128d, __m128d))
- __MACHINEX86X(int _mm_ucomineq_sd(__m128d, __m128d))
- __MACHINEX86X(__m128 _mm_cvtpd_ps(__m128d))
- __MACHINEX86X(__m128d _mm_cvtps_pd(__m128))
- __MACHINEX86X(__m128d _mm_cvtepi32_pd(__m128i))
- __MACHINEX86X(__m128i _mm_cvtpd_epi32(__m128d))
- __MACHINEX86X(int _mm_cvtsd_si32(__m128d))
- __MACHINEX86X(__m128 _mm_cvtsd_ss(__m128, __m128d))
- __MACHINEX86X(__m128d _mm_cvtsi32_sd(__m128d, int))
- __MACHINEX86X(__m128d _mm_cvtss_sd(__m128d, __m128))
- __MACHINEX86X(__m128i _mm_cvttpd_epi32(__m128d))
- __MACHINEX86X(int _mm_cvttsd_si32(__m128d))
- __MACHINEX86X(__m128 _mm_cvtepi32_ps(__m128i))
- __MACHINEX86X(__m128i _mm_cvtps_epi32(__m128))
- __MACHINEX86X(__m128i _mm_cvttps_epi32(__m128))
- __MACHINEX86X_NOX64(__m64 _mm_cvtpd_pi32(__m128d))
- __MACHINEX86X_NOX64(__m64 _mm_cvttpd_pi32(__m128d))
- __MACHINEX86X_NOX64(__m128d _mm_cvtpi32_pd(__m64))
- __MACHINEX86X(__m128d _mm_unpackhi_pd(__m128d, __m128d))
- __MACHINEX86X(__m128d _mm_unpacklo_pd(__m128d, __m128d))
- __MACHINEX86X(int _mm_movemask_pd(__m128d))
- __MACHINEX86X(__m128d _mm_shuffle_pd(__m128d, __m128d, int))
- __MACHINEX86X(__m128d _mm_load_pd(double const*))
- __MACHINEX86X(__m128d _mm_load1_pd(double const*))
- __MACHINEX86X(__m128d _mm_loadr_pd(double const*))
- __MACHINEX86X(__m128d _mm_loadu_pd(double const*))
- __MACHINEX86X(__m128d _mm_load_sd(double const*))
- __MACHINEX86X(__m128d _mm_loadh_pd(__m128d, double const*))
- __MACHINEX86X(__m128d _mm_loadl_pd(__m128d, double const*))
- __MACHINEX86X(__m128d _mm_set_sd(double))
- __MACHINEX86X(__m128d _mm_set1_pd(double))
- __MACHINEX86X(__m128d _mm_set_pd(double, double))
- __MACHINEX86X(__m128d _mm_setr_pd(double, double))
- __MACHINEX86X(__m128d _mm_setzero_pd(void))
- __MACHINEX86X(__m128d _mm_move_sd(__m128d, __m128d))
- __MACHINEX86X(void _mm_store_sd(double*, __m128d))
- __MACHINEX86X(void _mm_store1_pd(double*, __m128d))
- __MACHINEX86X(void _mm_store_pd(double*, __m128d))
- __MACHINEX86X(void _mm_storeu_pd(double*, __m128d))
- __MACHINEX86X(void _mm_storer_pd(double*, __m128d))
- __MACHINEX86X(void _mm_storeh_pd(double*, __m128d))
- __MACHINEX86X(void _mm_storel_pd(double*, __m128d))
- __MACHINEX86X(__m128i _mm_add_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_add_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_add_epi32(__m128i, __m128i))
- __MACHINEX86X_NOX64(__m64 _mm_add_si64(__m64, __m64))
- __MACHINEX86X(__m128i _mm_add_epi64(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_adds_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_adds_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_adds_epu8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_adds_epu16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_avg_epu8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_avg_epu16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_madd_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_max_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_max_epu8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_min_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_min_epu8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_mulhi_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_mulhi_epu16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_mullo_epi16(__m128i, __m128i))
- __MACHINEX86X_NOX64(__m64 _mm_mul_su32(__m64, __m64))
- __MACHINEX86X(__m128i _mm_mul_epu32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_sad_epu8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_sub_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_sub_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_sub_epi32(__m128i, __m128i))
- __MACHINEX86X_NOX64(__m64 _mm_sub_si64(__m64, __m64))
- __MACHINEX86X(__m128i _mm_sub_epi64(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_subs_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_subs_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_subs_epu8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_subs_epu16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_andnot_si128(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_and_si128(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_or_si128(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_xor_si128(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_slli_si128(__m128i, int))
- __MACHINEX86X(__m128i _mm_slli_epi16(__m128i, int))
- __MACHINEX86X(__m128i _mm_sll_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_slli_epi32(__m128i, int))
- __MACHINEX86X(__m128i _mm_sll_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_slli_epi64(__m128i, int))
- __MACHINEX86X(__m128i _mm_sll_epi64(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_srai_epi16(__m128i, int))
- __MACHINEX86X(__m128i _mm_sra_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_srai_epi32(__m128i, int))
- __MACHINEX86X(__m128i _mm_sra_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_srli_si128(__m128i, int))
- __MACHINEX86X(__m128i _mm_srli_epi16(__m128i, int))
- __MACHINEX86X(__m128i _mm_srl_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_srli_epi32(__m128i, int))
- __MACHINEX86X(__m128i _mm_srl_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_srli_epi64(__m128i, int))
- __MACHINEX86X(__m128i _mm_srl_epi64(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmpeq_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmpeq_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmpeq_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmpgt_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmpgt_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmpgt_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmplt_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmplt_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cmplt_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_cvtsi32_si128(int))
- __MACHINEX86X(int _mm_cvtsi128_si32(__m128i))
- __MACHINEX86X(__m128i _mm_packs_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_packs_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_packus_epi16(__m128i, __m128i))
- __MACHINEX86X(int _mm_extract_epi16(__m128i, int))
- __MACHINEX86X(__m128i _mm_insert_epi16(__m128i, int, int))
- __MACHINEX86X(int _mm_movemask_epi8(__m128i))
- __MACHINEX86X(__m128i _mm_shuffle_epi32(__m128i, int))
- __MACHINEX86X(__m128i _mm_shufflehi_epi16(__m128i, int))
- __MACHINEX86X(__m128i _mm_shufflelo_epi16(__m128i, int))
- __MACHINEX86X(__m128i _mm_unpackhi_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpackhi_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpackhi_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpackhi_epi64(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpacklo_epi8(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpacklo_epi16(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpacklo_epi32(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_unpacklo_epi64(__m128i, __m128i))
- __MACHINEX86X(__m128i _mm_load_si128(__m128i const*))
- __MACHINEX86X(__m128i _mm_loadu_si128(__m128i const*))
- __MACHINEX86X(__m128i _mm_loadl_epi64(__m128i const*))
- __MACHINEX86X_NOX64(__m128i _mm_set_epi64(__m64, __m64))
- __MACHINEX86X(__m128i _mm_set_epi32(int, int, int, int))
- __MACHINEX86X(__m128i _mm_set_epi16(short, short, short, short, short, short, short, short))
- __MACHINEX86X(__m128i _mm_set_epi8(char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char))
- __MACHINEX86X_NOX64(__m128i _mm_set1_epi64(__m64))
- __MACHINEX86X(__m128i _mm_set1_epi32(int))
- __MACHINEX86X(__m128i _mm_set1_epi16(short))
- __MACHINEX86X(__m128i _mm_set1_epi8(char))
- __MACHINEX86X(__m128i _mm_setl_epi64(__m128i))
- __MACHINEX86X_NOX64(__m128i _mm_setr_epi64(__m64, __m64))
- __MACHINEX86X(__m128i _mm_setr_epi32(int, int, int, int))
- __MACHINEX86X(__m128i _mm_setr_epi16(short, short, short, short, short, short, short, short))
- __MACHINEX86X(__m128i _mm_setr_epi8(char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char))
- __MACHINEX86X(__m128i _mm_setzero_si128(void))
- __MACHINEX86X(void _mm_store_si128(__m128i*, __m128i))
- __MACHINEX86X(void _mm_storeu_si128(__m128i*, __m128i))
- __MACHINEX86X(void _mm_storel_epi64(__m128i*, __m128i))
- __MACHINEX86X(void _mm_maskmoveu_si128(__m128i, __m128i, char*))
- __MACHINEX86X(__m128i _mm_move_epi64(__m128i))
- __MACHINEX86X_NOX64(__m128i _mm_movpi64_epi64(__m64))
- __MACHINEX86X_NOX64(__m64 _mm_movepi64_pi64(__m128i))
- __MACHINEX86X(void _mm_stream_pd(double*, __m128d))
- __MACHINEX86X(void _mm_stream_si128(__m128i*, __m128i))
- __MACHINEX86X(void _mm_clflush(void const *))
- __MACHINEX86X(void _mm_lfence(void))
- __MACHINEX86X(void _mm_mfence(void))
- __MACHINEX86X(void _mm_stream_si32(int*, int))
- __MACHINEX86X(void _mm_pause(void))
- __MACHINEX86X(__m128 _mm_addsub_ps(__m128, __m128))
- __MACHINEX86X(__m128d _mm_addsub_pd(__m128d, __m128d))
- __MACHINEX86X(__m128 _mm_hadd_ps(__m128, __m128))
- __MACHINEX86X(__m128d _mm_hadd_pd(__m128d, __m128d))
- __MACHINEX86X(__m128 _mm_hsub_ps(__m128, __m128))
- __MACHINEX86X(__m128d _mm_hsub_pd(__m128d, __m128d))
- __MACHINEX86X(__m128i _mm_lddqu_si128(__m128i const*))
- __MACHINEX86X(void _mm_monitor(void const*, unsigned int, unsigned int))
- __MACHINEX86X(__m128d _mm_movedup_pd(__m128d))
- __MACHINEX86X(__m128d _mm_loaddup_pd(double const*))
- __MACHINEX86X(__m128 _mm_movehdup_ps(__m128))
- __MACHINEX86X(__m128 _mm_moveldup_ps(__m128))
- __MACHINEX86X(void _mm_mwait(unsigned int, unsigned int))
- __MACHINEI(void _WriteBarrier(void))
- __MACHINEI(void _ReadWriteBarrier(void))
- __MACHINEIA64(void _WriteBarrier(void))
- __MACHINEIA64(void _ReadWriteBarrier(void))
- __MACHINEX64(void __faststorefence(void))
- __MACHINEX64(__int64 __mulh(__int64, __int64))
- __MACHINEX64(unsigned __int64 __umulh(unsigned __int64, unsigned __int64))
- __MACHINEX64(unsigned __int64 __readcr0(void))
- __MACHINEX64(unsigned __int64 __readcr2(void))
- __MACHINEX64(unsigned __int64 __readcr3(void))
- __MACHINEX64(unsigned __int64 __readcr4(void))
- __MACHINEX64(unsigned __int64 __readcr8(void))
- __MACHINEIA32(unsigned long __readcr0(void))
- __MACHINEIA32(unsigned long __readcr2(void))
- __MACHINEIA32(unsigned long __readcr3(void))
- __MACHINEIA32(unsigned long __readcr4(void))
- __MACHINEIA32(unsigned long __readcr8(void))
- __MACHINEX64(void __writecr0(unsigned __int64))
- __MACHINEX64(void __writecr3(unsigned __int64))
- __MACHINEX64(void __writecr4(unsigned __int64))
- __MACHINEX64(void __writecr8(unsigned __int64))
- __MACHINEIA32(void __writecr0(unsigned))
- __MACHINEIA32(void __writecr3(unsigned))
- __MACHINEIA32(void __writecr4(unsigned))
- __MACHINEIA32(void __writecr8(unsigned))
- __MACHINEX64(unsigned __int64 __readdr(unsigned int))
- __MACHINEIA32(unsigned __readdr(unsigned int))
- __MACHINEX64(void __writedr(unsigned int, unsigned __int64))
- __MACHINEIA32(void __writedr(unsigned int, unsigned))
- __MACHINEX64(unsigned __int64 __readeflags(void))
- __MACHINEIA32(unsigned __readeflags(void))
- __MACHINEX64(void __writeeflags(unsigned __int64))
- __MACHINEIA32(void __writeeflags(unsigned))
- __MACHINEI(void __wbinvd(void))
- __MACHINEI(void __invlpg(void*))
- __MACHINEI(unsigned __int64 __readmsr(unsigned long))
- __MACHINEI(void __writemsr(unsigned long, unsigned __int64))
- __MACHINEI(unsigned __int64 __rdtsc(void))
- __MACHINEI(void __movsb(unsigned char *, unsigned char const *, size_t))
- __MACHINEI(void __movsw(unsigned short *, unsigned short const *, size_t))
- __MACHINEI(void __movsd(unsigned long *, unsigned long const *, size_t))
- __MACHINEX64(void __movsq(unsigned long long *, unsigned long long const *, size_t))
- __MACHINEX64(unsigned char __readgsbyte(unsigned long Offset))
- __MACHINEX64(unsigned short __readgsword(unsigned long Offset))
- __MACHINEX64(unsigned long __readgsdword(unsigned long Offset))
- __MACHINEX64(unsigned __int64 __readgsqword(unsigned long Offset))
- __MACHINEX64(void __writegsbyte(unsigned long Offset, unsigned char Data))
- __MACHINEX64(void __writegsword(unsigned long Offset, unsigned short Data))
- __MACHINEX64(void __writegsdword(unsigned long Offset, unsigned long Data))
- __MACHINEX64(void __writegsqword(unsigned long Offset, unsigned __int64 Data))
- __MACHINEI(unsigned char __inbyte(unsigned short Port))
- __MACHINEI(unsigned short __inword(unsigned short Port))
- __MACHINEI(unsigned long __indword(unsigned short Port))
- __MACHINEI(void __outbyte(unsigned short Port, unsigned char Data))
- __MACHINEI(void __outword(unsigned short Port, unsigned short Data))
- __MACHINEI(void __outdword(unsigned short Port, unsigned long Data))
- __MACHINEI(void __inbytestring(unsigned short Port, unsigned char *Buffer, unsigned long Count))
- __MACHINEI(void __inwordstring(unsigned short Port, unsigned short *Buffer, unsigned long Count))
- __MACHINEI(void __indwordstring(unsigned short Port, unsigned long *Buffer, unsigned long Count))
- __MACHINEI(void __outbytestring(unsigned short Port, unsigned char *Buffer, unsigned long Count))
- __MACHINEI(void __outwordstring(unsigned short Port, unsigned short *Buffer, unsigned long Count))
- __MACHINEI(void __outdwordstring(unsigned short Port, unsigned long *Buffer, unsigned long Count))
- __MACHINEI(unsigned int __getcallerseflags())
- __MACHINEX64(unsigned char __vmx_vmclear(unsigned __int64*))
- __MACHINEX64(unsigned char __vmx_vmlaunch(void))
- __MACHINEX64(unsigned char __vmx_vmptrld(unsigned __int64*))
- __MACHINEI(void __vmx_vmptrst(unsigned __int64 *))
- __MACHINEX64(unsigned char __vmx_vmread(size_t, size_t*))
- __MACHINEX64(unsigned char __vmx_vmresume(void))
- __MACHINEX64(unsigned char __vmx_vmwrite(size_t, size_t))
- __MACHINEI(void __vmx_off(void))
- __MACHINEX64(unsigned char __vmx_on(unsigned __int64*))
- __MACHINEI(void __svm_clgi(void))
- __MACHINEI(void __svm_invlpga(void*, int))
- __MACHINEI(void __svm_skinit(int))
- __MACHINEI(void __svm_stgi(void))
- __MACHINEI(void __svm_vmload(size_t))
- __MACHINEI(void __svm_vmrun(size_t))
- __MACHINEI(void __svm_vmsave(size_t))
- __MACHINEI(void __halt(void))
- __MACHINEI(void __sidt(void*))
- __MACHINEI(void __lidt(void*))
- __MACHINEI(void __ud2(void))
- __MACHINEI(void __nop(void))
- __MACHINEX64(__m128i _mm_set_epi64x(__int64 i1, __int64 i0))
- __MACHINEX64(__m128i _mm_set1_epi64x(__int64 i))
- __MACHINEX64(__int64 _mm_cvtsd_si64x(__m128d a))
- __MACHINEX64(__m128d _mm_cvtsi64x_sd(__m128d a, __int64 b))
- __MACHINEX64(__m128 _mm_cvtsi64x_ss(__m128 a, __int64 b))
- __MACHINEX64(__int64 _mm_cvtss_si64x(__m128 a))
- __MACHINEX64(__int64 _mm_cvttsd_si64x(__m128d a))
- __MACHINEX64(__int64 _mm_cvttss_si64x(__m128 a))
- __MACHINEX64(__m128i _mm_cvtsi64x_si128(__int64 a))
- __MACHINEX64(__int64 _mm_cvtsi128_si64x(__m128i a))
- __MACHINEX64(void _mm_stream_si64x(__int64 *, __int64))
- __MACHINEI(void __stosb(unsigned char *, unsigned char, size_t))
- __MACHINEI(void __stosw(unsigned short *, unsigned short, size_t))
- __MACHINEI(void __stosd(unsigned long *, unsigned long, size_t))
- __MACHINEX64(void __stosq(unsigned __int64 *, unsigned __int64, size_t))
- __MACHINEIW64(unsigned char _bittest(long const *a, long b))
- __MACHINEIW64(unsigned char _bittestandset(long *a, long b))
- __MACHINEIW64(unsigned char _bittestandreset(long *a, long b))
- __MACHINEIW64(unsigned char _bittestandcomplement(long *a, long b))
+__MACHINEX86X_NOX64(void _m_empty(void))
+__MACHINEX86X_NOX64(__m64 _m_from_int(int))
+__MACHINEX86X_NOX64(int _m_to_int(__m64))
+__MACHINEX86X_NOX64(__m64 _m_packsswb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_packssdw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_packuswb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_punpckhbw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_punpckhwd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_punpckhdq(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_punpcklbw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_punpcklwd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_punpckldq(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddsb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddsw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddusb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_paddusw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubsb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubsw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubusb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psubusw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pmaddwd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pmulhw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pmullw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psllw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psllwi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_pslld(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pslldi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_psllq(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psllqi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_psraw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psrawi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_psrad(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psradi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_psrlw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psrlwi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_psrld(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psrldi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_psrlq(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psrlqi(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_pand(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pandn(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_por(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pxor(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pcmpeqb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pcmpeqw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pcmpeqd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pcmpgtb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pcmpgtw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pcmpgtd(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _mm_setzero_si64(void))
+__MACHINEX86X_NOX64(__m64 _mm_set_pi32(int,int))
+__MACHINEX86X_NOX64(__m64 _mm_set_pi16(short,short,short,short))
+__MACHINEX86X_NOX64(__m64 _mm_set_pi8(char,char,char,char,char,char,char,char))
+__MACHINEX86X_NOX64(__m64 _mm_set1_pi32(int))
+__MACHINEX86X_NOX64(__m64 _mm_set1_pi16(short))
+__MACHINEX86X_NOX64(__m64 _mm_set1_pi8(char))
+__MACHINEX86X_NOX64(__m64 _mm_setr_pi32(int,int))
+__MACHINEX86X_NOX64(__m64 _mm_setr_pi16(short,short,short,short))
+__MACHINEX86X_NOX64(__m64 _mm_setr_pi8(char,char,char,char,char,char,char,char))
+__MACHINEX86X_NOX64(int _m_pextrw(__m64,int))
+__MACHINEX86X_NOX64(__m64 _m_pinsrw(__m64,int,int))
+__MACHINEX86X_NOX64(__m64 _m_pmaxsw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pmaxub(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pminsw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pminub(__m64,__m64))
+__MACHINEX86X_NOX64(int _m_pmovmskb(__m64))
+__MACHINEX86X_NOX64(__m64 _m_pmulhuw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pshufw(__m64,int))
+__MACHINEX86X_NOX64(void _m_maskmovq(__m64,__m64,char*))
+__MACHINEX86X_NOX64(__m64 _m_pavgb(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_pavgw(__m64,__m64))
+__MACHINEX86X_NOX64(__m64 _m_psadbw(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_from_float(float))
+__MACHINEX86X_NOWIN64(float _m_to_float(__m64))
+__MACHINEX86X_NOIA64(__m128 _mm_add_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_add_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_sub_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_sub_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_mul_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_mul_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_div_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_div_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_sqrt_ss(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_sqrt_ps(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_rcp_ss(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_rcp_ps(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_rsqrt_ss(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_rsqrt_ps(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_min_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_min_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_max_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_max_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_and_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_andnot_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_or_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_xor_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpeq_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpeq_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmplt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmplt_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmple_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmple_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpgt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpgt_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpge_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpge_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpneq_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpneq_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpnlt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpnlt_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpnle_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpnle_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpngt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpngt_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpnge_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpnge_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpord_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpord_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpunord_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cmpunord_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_comieq_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_comilt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_comile_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_comigt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_comige_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_comineq_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_ucomieq_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_ucomilt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_ucomile_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_ucomigt_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_ucomige_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_ucomineq_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(int _mm_cvt_ss2si(__m128))
+__MACHINEX86X_NOWIN64(__m64 _mm_cvt_ps2pi(__m128))
+__MACHINEX86X_NOIA64(int _mm_cvtt_ss2si(__m128))
+__MACHINEX86X_NOWIN64(__m64 _mm_cvtt_ps2pi(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_cvt_si2ss(__m128,int))
+__MACHINEX86X_NOWIN64(__m128 _mm_cvt_pi2ps(__m128,__m64))
+__MACHINEX86X_NOIA64(__m128 _mm_shuffle_ps(__m128,__m128,unsigned int))
+__MACHINEX86X_NOIA64(__m128 _mm_unpackhi_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_unpacklo_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_loadh_pi(__m128,__m64 const*))
+__MACHINEX86X_NOIA64(void _mm_storeh_pi(__m64*,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_loadl_pi(__m128,__m64 const*))
+__MACHINEX86X_NOIA64(void _mm_storel_pi(__m64*,__m128))
+__MACHINEX86X_NOIA64(int _mm_movemask_ps(__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_set_ss(float))
+__MACHINEX86X_NOIA64(__m128 _mm_set_ps1(float))
+__MACHINEX86X_NOIA64(__m128 _mm_set_ps(float,float,float,float))
+__MACHINEX86X_NOIA64(__m128 _mm_setr_ps(float,float,float,float))
+__MACHINEX86X_NOIA64(__m128 _mm_setzero_ps(void))
+__MACHINEX86X_NOIA64(__m128 _mm_load_ss(float const*))
+__MACHINEX86X_NOIA64(__m128 _mm_load_ps1(float const*))
+__MACHINEX86X_NOIA64(__m128 _mm_load_ps(float const*))
+__MACHINEX86X_NOIA64(__m128 _mm_loadr_ps(float const*))
+__MACHINEX86X_NOIA64(__m128 _mm_loadu_ps(float const*))
+__MACHINEX86X_NOIA64(__m128 _mm_move_ss(__m128,__m128))
+__MACHINEX86X_NOIA64(void _mm_store_ss(float*,__m128))
+__MACHINEX86X_NOIA64(void _mm_store_ps1(float*,__m128))
+__MACHINEX86X_NOIA64(void _mm_store_ps(float*,__m128))
+__MACHINEX86X_NOIA64(void _mm_storer_ps(float*,__m128))
+__MACHINEX86X_NOIA64(void _mm_storeu_ps(float*,__m128))
+__MACHINEX86X_NOIA64(void _mm_prefetch(char const*,int))
+__MACHINEX86X_NOWIN64(void _mm_stream_pi(__m64*,__m64))
+__MACHINEX86X_NOIA64(void _mm_stream_ps(float*,__m128))
+__MACHINEX86X_NOIA64(void _mm_sfence(void))
+__MACHINEX86X_NOIA64(unsigned int _mm_getcsr(void))
+__MACHINEX86X_NOIA64(void _mm_setcsr(unsigned int))
+__MACHINEX86X_NOIA64(__m128 _mm_movelh_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(__m128 _mm_movehl_ps(__m128,__m128))
+__MACHINEX86X_NOIA64(void _m_prefetch(void*))
+__MACHINEX86X_NOIA64(void _m_prefetchw(volatile const void*_Source))
+__MACHINEX86X_NOWIN64(void _m_femms(void))
+__MACHINEX86X_NOWIN64(__m64 _m_pavgusb(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pf2id(__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfacc(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfadd(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfcmpeq(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfcmpge(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfcmpgt(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfmax(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfmin(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfmul(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfrcp(__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfrcpit1(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfrcpit2(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfrsqrt(__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfrsqit1(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfsub(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfsubr(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pi2fd(__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pmulhrw(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pf2iw(__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfnacc(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pfpnacc(__m64,__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pi2fw(__m64))
+__MACHINEX86X_NOWIN64(__m64 _m_pswapd(__m64))
+__MACHINEX86X(__m128d _mm_add_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_add_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_div_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_div_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_max_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_max_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_min_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_min_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_mul_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_mul_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_sqrt_sd(__m128d, __m128d))
+__MACHINEX86X(__m128d _mm_sqrt_pd(__m128d))
+__MACHINEX86X(__m128d _mm_sub_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_sub_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_and_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_andnot_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_or_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_xor_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpeq_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpeq_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmplt_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmplt_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmple_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmple_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpgt_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpgt_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpge_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpge_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpneq_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpneq_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpnlt_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpnlt_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpnle_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpnle_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpngt_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpngt_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpnge_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpnge_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpord_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpord_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpunord_sd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_cmpunord_pd(__m128d,__m128d))
+__MACHINEX86X(int _mm_comieq_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_comilt_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_comile_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_comigt_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_comige_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_comineq_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_ucomieq_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_ucomilt_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_ucomile_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_ucomigt_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_ucomige_sd(__m128d,__m128d))
+__MACHINEX86X(int _mm_ucomineq_sd(__m128d,__m128d))
+__MACHINEX86X(__m128 _mm_cvtpd_ps(__m128d))
+__MACHINEX86X(__m128d _mm_cvtps_pd(__m128))
+__MACHINEX86X(__m128d _mm_cvtepi32_pd(__m128i))
+__MACHINEX86X(__m128i _mm_cvtpd_epi32(__m128d))
+__MACHINEX86X(int _mm_cvtsd_si32(__m128d))
+__MACHINEX86X(__m128 _mm_cvtsd_ss(__m128,__m128d))
+__MACHINEX86X(__m128d _mm_cvtsi32_sd(__m128d,int))
+__MACHINEX86X(__m128d _mm_cvtss_sd(__m128d,__m128))
+__MACHINEX86X(__m128i _mm_cvttpd_epi32(__m128d))
+__MACHINEX86X(int _mm_cvttsd_si32(__m128d))
+__MACHINEX86X(__m128 _mm_cvtepi32_ps(__m128i))
+__MACHINEX86X(__m128i _mm_cvtps_epi32(__m128))
+__MACHINEX86X(__m128i _mm_cvttps_epi32(__m128))
+__MACHINEX86X_NOX64(__m64 _mm_cvtpd_pi32(__m128d))
+__MACHINEX86X_NOX64(__m64 _mm_cvttpd_pi32(__m128d))
+__MACHINEX86X_NOX64(__m128d _mm_cvtpi32_pd(__m64))
+__MACHINEX86X(__m128d _mm_unpackhi_pd(__m128d,__m128d))
+__MACHINEX86X(__m128d _mm_unpacklo_pd(__m128d,__m128d))
+__MACHINEX86X(int _mm_movemask_pd(__m128d))
+__MACHINEX86X(__m128d _mm_shuffle_pd(__m128d,__m128d,int))
+__MACHINEX86X(__m128d _mm_load_pd(double const*))
+__MACHINEX86X(__m128d _mm_load1_pd(double const*))
+__MACHINEX86X(__m128d _mm_loadr_pd(double const*))
+__MACHINEX86X(__m128d _mm_loadu_pd(double const*))
+__MACHINEX86X(__m128d _mm_load_sd(double const*))
+__MACHINEX86X(__m128d _mm_loadh_pd(__m128d,double const*))
+__MACHINEX86X(__m128d _mm_loadl_pd(__m128d,double const*))
+__MACHINEX86X(__m128d _mm_set_sd(double))
+__MACHINEX86X(__m128d _mm_set1_pd(double))
+__MACHINEX86X(__m128d _mm_set_pd(double,double))
+__MACHINEX86X(__m128d _mm_setr_pd(double,double))
+__MACHINEX86X(__m128d _mm_setzero_pd(void))
+__MACHINEX86X(__m128d _mm_move_sd(__m128d,__m128d))
+__MACHINEX86X(void _mm_store_sd(double*,__m128d))
+__MACHINEX86X(void _mm_store1_pd(double*,__m128d))
+__MACHINEX86X(void _mm_store_pd(double*,__m128d))
+__MACHINEX86X(void _mm_storeu_pd(double*,__m128d))
+__MACHINEX86X(void _mm_storer_pd(double*,__m128d))
+__MACHINEX86X(void _mm_storeh_pd(double*,__m128d))
+__MACHINEX86X(void _mm_storel_pd(double*,__m128d))
+__MACHINEX86X(__m128i _mm_add_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_add_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_add_epi32(__m128i,__m128i))
+__MACHINEX86X_NOX64(__m64 _mm_add_si64(__m64,__m64))
+__MACHINEX86X(__m128i _mm_add_epi64(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_adds_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_adds_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_adds_epu8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_adds_epu16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_avg_epu8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_avg_epu16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_madd_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_max_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_max_epu8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_min_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_min_epu8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_mulhi_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_mulhi_epu16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_mullo_epi16(__m128i,__m128i))
+__MACHINEX86X_NOX64(__m64 _mm_mul_su32(__m64,__m64))
+__MACHINEX86X(__m128i _mm_mul_epu32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_sad_epu8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_sub_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_sub_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_sub_epi32(__m128i,__m128i))
+__MACHINEX86X_NOX64(__m64 _mm_sub_si64(__m64,__m64))
+__MACHINEX86X(__m128i _mm_sub_epi64(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_subs_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_subs_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_subs_epu8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_subs_epu16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_andnot_si128(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_and_si128(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_or_si128(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_xor_si128(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_slli_si128(__m128i,int))
+__MACHINEX86X(__m128i _mm_slli_epi16(__m128i,int))
+__MACHINEX86X(__m128i _mm_sll_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_slli_epi32(__m128i,int))
+__MACHINEX86X(__m128i _mm_sll_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_slli_epi64(__m128i,int))
+__MACHINEX86X(__m128i _mm_sll_epi64(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_srai_epi16(__m128i,int))
+__MACHINEX86X(__m128i _mm_sra_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_srai_epi32(__m128i,int))
+__MACHINEX86X(__m128i _mm_sra_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_srli_si128(__m128i,int))
+__MACHINEX86X(__m128i _mm_srli_epi16(__m128i,int))
+__MACHINEX86X(__m128i _mm_srl_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_srli_epi32(__m128i,int))
+__MACHINEX86X(__m128i _mm_srl_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_srli_epi64(__m128i,int))
+__MACHINEX86X(__m128i _mm_srl_epi64(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmpeq_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmpeq_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmpeq_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmpgt_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmpgt_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmpgt_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmplt_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmplt_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cmplt_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_cvtsi32_si128(int))
+__MACHINEX86X(int _mm_cvtsi128_si32(__m128i))
+__MACHINEX86X(__m128i _mm_packs_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_packs_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_packus_epi16(__m128i,__m128i))
+__MACHINEX86X(int _mm_extract_epi16(__m128i,int))
+__MACHINEX86X(__m128i _mm_insert_epi16(__m128i,int,int))
+__MACHINEX86X(int _mm_movemask_epi8(__m128i))
+__MACHINEX86X(__m128i _mm_shuffle_epi32(__m128i,int))
+__MACHINEX86X(__m128i _mm_shufflehi_epi16(__m128i,int))
+__MACHINEX86X(__m128i _mm_shufflelo_epi16(__m128i,int))
+__MACHINEX86X(__m128i _mm_unpackhi_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpackhi_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpackhi_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpackhi_epi64(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpacklo_epi8(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpacklo_epi16(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpacklo_epi32(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_unpacklo_epi64(__m128i,__m128i))
+__MACHINEX86X(__m128i _mm_load_si128(__m128i const*))
+__MACHINEX86X(__m128i _mm_loadu_si128(__m128i const*))
+__MACHINEX86X(__m128i _mm_loadl_epi64(__m128i const*))
+__MACHINEX86X_NOX64(__m128i _mm_set_epi64(__m64,__m64))
+__MACHINEX86X(__m128i _mm_set_epi32(int,int,int,int))
+__MACHINEX86X(__m128i _mm_set_epi16(short,short,short,short,short,short,short,short))
+__MACHINEX86X(__m128i _mm_set_epi8(char,char,char,char,char,char,char,char,char,char,char,char,char,char,char,char))
+__MACHINEX86X_NOX64(__m128i _mm_set1_epi64(__m64))
+__MACHINEX86X(__m128i _mm_set1_epi32(int))
+__MACHINEX86X(__m128i _mm_set1_epi16(short))
+__MACHINEX86X(__m128i _mm_set1_epi8(char))
+__MACHINEX86X(__m128i _mm_setl_epi64(__m128i))
+__MACHINEX86X_NOX64(__m128i _mm_setr_epi64(__m64,__m64))
+__MACHINEX86X(__m128i _mm_setr_epi32(int,int,int,int))
+__MACHINEX86X(__m128i _mm_setr_epi16(short,short,short,short,short,short,short,short))
+__MACHINEX86X(__m128i _mm_setr_epi8(char,char,char,char,char,char,char,char,char,char,char,char,char,char,char,char))
+__MACHINEX86X(__m128i _mm_setzero_si128(void))
+__MACHINEX86X(void _mm_store_si128(__m128i*,__m128i))
+__MACHINEX86X(void _mm_storeu_si128(__m128i*,__m128i))
+__MACHINEX86X(void _mm_storel_epi64(__m128i*,__m128i))
+__MACHINEX86X(void _mm_maskmoveu_si128(__m128i,__m128i,char*))
+__MACHINEX86X(__m128i _mm_move_epi64(__m128i))
+__MACHINEX86X_NOX64(__m128i _mm_movpi64_epi64(__m64))
+__MACHINEX86X_NOX64(__m64 _mm_movepi64_pi64(__m128i))
+__MACHINEX86X(void _mm_stream_pd(double*,__m128d))
+__MACHINEX86X(void _mm_stream_si128(__m128i*,__m128i))
+__MACHINEX86X(void _mm_clflush(void const *))
+__MACHINEX86X(void _mm_lfence(void))
+__MACHINEX86X(void _mm_mfence(void))
+__MACHINEX86X(void _mm_stream_si32(int*,int))
+__MACHINEX86X(void _mm_pause(void))
+__MACHINEX86X(__m128 _mm_addsub_ps(__m128,__m128))
+__MACHINEX86X(__m128d _mm_addsub_pd(__m128d,__m128d))
+__MACHINEX86X(__m128 _mm_hadd_ps(__m128,__m128))
+__MACHINEX86X(__m128d _mm_hadd_pd(__m128d,__m128d))
+__MACHINEX86X(__m128 _mm_hsub_ps(__m128,__m128))
+__MACHINEX86X(__m128d _mm_hsub_pd(__m128d,__m128d))
+__MACHINEX86X(__m128i _mm_lddqu_si128(__m128i const*))
+__MACHINEX86X(void _mm_monitor(void const*,unsigned int,unsigned int))
+__MACHINEX86X(__m128d _mm_movedup_pd(__m128d))
+__MACHINEX86X(__m128d _mm_loaddup_pd(double const*))
+__MACHINEX86X(__m128 _mm_movehdup_ps(__m128))
+__MACHINEX86X(__m128 _mm_moveldup_ps(__m128))
+__MACHINEX86X(void _mm_mwait(unsigned int,unsigned int))
+__MACHINEI(void _WriteBarrier(void))
+__MACHINEI(void _ReadWriteBarrier(void))
+__MACHINEIA64(void _WriteBarrier(void))
+__MACHINEIA64(void _ReadWriteBarrier(void))
+__MACHINEX64(void __faststorefence(void))
+__MACHINEX64(__int64 __mulh(__int64,__int64))
+__MACHINEX64(unsigned __int64 __umulh(unsigned __int64,unsigned __int64))
+__MACHINEX64(unsigned __int64 __readcr0(void))
+__MACHINEX64(unsigned __int64 __readcr2(void))
+__MACHINEX64(unsigned __int64 __readcr3(void))
+__MACHINEX64(unsigned __int64 __readcr4(void))
+__MACHINEX64(unsigned __int64 __readcr8(void))
+__MACHINEIA32(unsigned long __readcr0(void))
+__MACHINEIA32(unsigned long __readcr2(void))
+__MACHINEIA32(unsigned long __readcr3(void))
+__MACHINEIA32(unsigned long __readcr4(void))
+__MACHINEIA32(unsigned long __readcr8(void))
+__MACHINEX64(void __writecr0(unsigned __int64))
+__MACHINEX64(void __writecr3(unsigned __int64))
+__MACHINEX64(void __writecr4(unsigned __int64))
+__MACHINEX64(void __writecr8(unsigned __int64))
+__MACHINEIA32(void __writecr0(unsigned))
+__MACHINEIA32(void __writecr3(unsigned))
+__MACHINEIA32(void __writecr4(unsigned))
+__MACHINEIA32(void __writecr8(unsigned))
+__MACHINEX64(unsigned __int64 __readdr(unsigned int))
+__MACHINEIA32(unsigned __readdr(unsigned int))
+__MACHINEX64(void __writedr(unsigned int, unsigned __int64))
+__MACHINEIA32(void __writedr(unsigned int, unsigned))
+__MACHINEX64(unsigned __int64 __readeflags(void))
+__MACHINEIA32(unsigned __readeflags(void))
+__MACHINEX64(void __writeeflags(unsigned __int64))
+__MACHINEIA32(void __writeeflags(unsigned))
+__MACHINEI(void __wbinvd(void))
+__MACHINEI(void __invlpg(void*))
+__MACHINEI(unsigned __int64 __readmsr(unsigned long))
+__MACHINEI(void __writemsr(unsigned long, unsigned __int64))
+__MACHINEI(unsigned __int64 __rdtsc(void))
+__MACHINEI(void __movsb(unsigned char *, unsigned char const *, size_t))
+__MACHINEI(void __movsw(unsigned short *, unsigned short const *, size_t))
+__MACHINEI(void __movsd(unsigned long *, unsigned long const *, size_t))
+__MACHINEX64(void __movsq(unsigned long long *, unsigned long long const *, size_t))
+__MACHINEX64(unsigned char __readgsbyte(unsigned long Offset))
+__MACHINEX64(unsigned short __readgsword(unsigned long Offset))
+__MACHINEX64(unsigned long __readgsdword(unsigned long Offset))
+__MACHINEX64(unsigned __int64 __readgsqword(unsigned long Offset))
+__MACHINEX64(void __writegsbyte(unsigned long Offset, unsigned char Data))
+__MACHINEX64(void __writegsword(unsigned long Offset, unsigned short Data))
+__MACHINEX64(void __writegsdword(unsigned long Offset, unsigned long Data))
+__MACHINEX64(void __writegsqword(unsigned long Offset, unsigned __int64 Data))
+__MACHINEI(unsigned char __inbyte(unsigned short Port))
+__MACHINEI(unsigned short __inword(unsigned short Port))
+__MACHINEI(unsigned long __indword(unsigned short Port))
+__MACHINEI(void __outbyte(unsigned short Port, unsigned char Data))
+__MACHINEI(void __outword(unsigned short Port, unsigned short Data))
+__MACHINEI(void __outdword(unsigned short Port, unsigned long Data))
+__MACHINEI(void __inbytestring(unsigned short Port, unsigned char *Buffer, unsigned long Count))
+__MACHINEI(void __inwordstring(unsigned short Port, unsigned short *Buffer, unsigned long Count))
+__MACHINEI(void __indwordstring(unsigned short Port, unsigned long *Buffer, unsigned long Count))
+__MACHINEI(void __outbytestring(unsigned short Port, unsigned char *Buffer, unsigned long Count))
+__MACHINEI(void __outwordstring(unsigned short Port, unsigned short *Buffer, unsigned long Count))
+__MACHINEI(void __outdwordstring(unsigned short Port, unsigned long *Buffer, unsigned long Count))
+__MACHINEI(unsigned int __getcallerseflags())
+__MACHINEX64(unsigned char __vmx_vmclear(unsigned __int64*))
+__MACHINEX64(unsigned char __vmx_vmlaunch(void))
+__MACHINEX64(unsigned char __vmx_vmptrld(unsigned __int64*))
+__MACHINEI(void __vmx_vmptrst(unsigned __int64 *))
+__MACHINEX64(unsigned char __vmx_vmread(size_t, size_t*))
+__MACHINEX64(unsigned char __vmx_vmresume(void))
+__MACHINEX64(unsigned char __vmx_vmwrite(size_t, size_t))
+__MACHINEI(void __vmx_off(void))
+__MACHINEX64(unsigned char __vmx_on(unsigned __int64*))
+__MACHINEI(void __svm_clgi(void))
+__MACHINEI(void __svm_invlpga(void*, int))
+__MACHINEI(void __svm_skinit(int))
+__MACHINEI(void __svm_stgi(void))
+__MACHINEI(void __svm_vmload(size_t))
+__MACHINEI(void __svm_vmrun(size_t))
+__MACHINEI(void __svm_vmsave(size_t))
+__MACHINEI(void __halt(void))
+__MACHINEI(void __sidt(void*))
+__MACHINEI(void __lidt(void*))
+__MACHINEI(void __ud2(void))
+__MACHINEI(void __nop(void))
+__MACHINEX64(__m128i _mm_set_epi64x(__int64 i1, __int64 i0))
+__MACHINEX64(__m128i _mm_set1_epi64x(__int64 i))
+__MACHINEX64(__int64 _mm_cvtsd_si64x(__m128d a))
+__MACHINEX64(__m128d _mm_cvtsi64x_sd(__m128d a, __int64 b))
+__MACHINEX64(__m128 _mm_cvtsi64x_ss(__m128 a, __int64 b))
+__MACHINEX64(__int64 _mm_cvtss_si64x(__m128 a))
+__MACHINEX64(__int64 _mm_cvttsd_si64x(__m128d a))
+__MACHINEX64(__int64 _mm_cvttss_si64x(__m128 a))
+__MACHINEX64(__m128i _mm_cvtsi64x_si128(__int64 a))
+__MACHINEX64(__int64 _mm_cvtsi128_si64x(__m128i a))
+__MACHINEX64(void _mm_stream_si64x(__int64 *,__int64))
+__MACHINEI(void __stosb(unsigned char *, unsigned char, size_t))
+__MACHINEI(void __stosw(unsigned short *, unsigned short, size_t))
+__MACHINEI(void __stosd(unsigned long *, unsigned long, size_t))
+__MACHINEX64(void __stosq(unsigned __int64 *, unsigned __int64, size_t))
+__MACHINEIW64(unsigned char _bittest(long const *a, long b))
+__MACHINEIW64(unsigned char _bittestandset(long *a, long b))
+__MACHINEIW64(unsigned char _bittestandreset(long *a, long b))
+__MACHINEIW64(unsigned char _bittestandcomplement(long *a, long b))
//__MACHINEI(unsigned char _interlockedbittestandset(long *a, long b))
//__MACHINEI(unsigned char _interlockedbittestandreset(long *a, long b))
- __MACHINEW64(unsigned char _bittest64(__int64 const *a, __int64 b))
- __MACHINEW64(unsigned char _bittestandset64(__int64 *a, __int64 b))
- __MACHINEW64(unsigned char _bittestandreset64(__int64 *a, __int64 b))
- __MACHINEW64(unsigned char _bittestandcomplement64(__int64 *a, __int64 b))
+__MACHINEW64(unsigned char _bittest64(__int64 const *a, __int64 b))
+__MACHINEW64(unsigned char _bittestandset64(__int64 *a, __int64 b))
+__MACHINEW64(unsigned char _bittestandreset64(__int64 *a, __int64 b))
+__MACHINEW64(unsigned char _bittestandcomplement64(__int64 *a, __int64 b))
//__MACHINEX64(unsigned char _interlockedbittestandset64(__int64 *a, __int64 b))
//__MACHINEX64(unsigned char _interlockedbittestandreset64(__int64 *a, __int64 b))
- __MACHINEI(void __cpuid(int a[4], int b))
- __MACHINEI(unsigned __int64 __readpmc(unsigned long a))
- __MACHINEI(unsigned long __segmentlimit(unsigned long a))
+__MACHINEI(void __cpuid(int a[4], int b))
+__MACHINEI(unsigned __int64 __readpmc(unsigned long a))
+__MACHINEI(unsigned long __segmentlimit(unsigned long a))
- __MACHINEIA32(unsigned char __readfsbyte(unsigned long Offset))
- __MACHINEIA32(unsigned short __readfsword(unsigned long Offset))
- __MACHINEIA32(unsigned long __readfsdword(unsigned long Offset))
- __MACHINEIA32(unsigned __int64 __readfsqword(unsigned long Offset))
- __MACHINEIA32(void __writefsbyte(unsigned long Offset, unsigned char Data))
- __MACHINEIA32(void __writefsword(unsigned long Offset, unsigned short Data))
- __MACHINEIA32(void __writefsdword(unsigned long Offset, unsigned long Data))
- __MACHINEIA32(void __writefsqword(unsigned long Offset, unsigned __int64 Data))
+__MACHINEIA32(unsigned char __readfsbyte(unsigned long Offset))
+__MACHINEIA32(unsigned short __readfsword(unsigned long Offset))
+__MACHINEIA32(unsigned long __readfsdword(unsigned long Offset))
+__MACHINEIA32(unsigned __int64 __readfsqword(unsigned long Offset))
+__MACHINEIA32(void __writefsbyte(unsigned long Offset, unsigned char Data))
+__MACHINEIA32(void __writefsword(unsigned long Offset, unsigned short Data))
+__MACHINEIA32(void __writefsdword(unsigned long Offset, unsigned long Data))
+__MACHINEIA32(void __writefsqword(unsigned long Offset, unsigned __int64 Data))
- __MACHINE(unsigned __int64 __cdecl _rotl64(unsigned __int64, int))
- __MACHINE(unsigned __int64 __cdecl _rotr64(unsigned __int64, int))
- __MACHINE(__int64 __cdecl _abs64(__int64))
+__MACHINE(unsigned __int64 __cdecl _rotl64(unsigned __int64,int))
+__MACHINE(unsigned __int64 __cdecl _rotr64(unsigned __int64,int))
+__MACHINE(__int64 __cdecl _abs64(__int64))
- __MACHINEIW64(unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask))
- __MACHINEIW64(unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask))
- __MACHINEW64(unsigned char _BitScanForward64(unsigned long* Index, unsigned __int64 Mask))
- __MACHINEW64(unsigned char _BitScanReverse64(unsigned long* Index, unsigned __int64 Mask))
- __MACHINEIW64(_CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *))
- __MACHINEIW64(_CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *))
- __MACHINEIW64(_CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *))
- __MACHINEIW64(_CRTIMP size_t __cdecl wcslen(const wchar_t *))
- __MACHINEIW64(_CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t))
- __MACHINEW64(unsigned __int64 __shiftleft128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift))
- __MACHINEW64(unsigned __int64 __shiftright128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift))
- __MACHINEW64(unsigned __int64 _umul128(unsigned __int64 multiplier, unsigned __int64 multiplicand, unsigned __int64 *highproduct))
- __MACHINEW64(__int64 _mul128(__int64 multiplier, __int64 multiplicand, __int64 *highproduct))
- __MACHINEI(void __int2c(void))
- __MACHINEIW64(void _ReadBarrier(void))
- __MACHINEIW64(unsigned char _rotr8(unsigned char value, unsigned char shift))
- __MACHINEIW64(unsigned short _rotr16(unsigned short value, unsigned char shift))
- __MACHINEIW64(unsigned char _rotl8(unsigned char value, unsigned char shift))
- __MACHINEIW64(unsigned short _rotl16(unsigned short value, unsigned char shift))
- __MACHINEIW64(short _InterlockedIncrement16(short volatile *Addend))
- __MACHINEIW64(short _InterlockedDecrement16(short volatile *Addend))
- __MACHINEIW64(short _InterlockedCompareExchange16(short volatile *Destination, short Exchange, short Comparand))
- __MACHINEIA64(short _InterlockedIncrement16_acq(short volatile *Addend))
- __MACHINEIA64(short _InterlockedIncrement16_rel(short volatile *Addend))
- __MACHINEIA64(short _InterlockedDecrement16_acq(short volatile *Addend))
- __MACHINEIA64(short _InterlockedDecrement16_rel(short volatile *Addend))
- __MACHINEIA64(short _InterlockedCompareExchange16_acq(short volatile *Destination, short Exchange, short Comparand))
- __MACHINEIA64(short _InterlockedCompareExchange16_rel(short volatile *Destination, short Exchange, short Comparand))
- __MACHINECC(unsigned __int64 _m_paddb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddsb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddsw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddsd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddusb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddusw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paddusd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubsb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubsw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubsd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubusb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubusw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psubusd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmaddwd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmadduwd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmulhw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmulhuw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmullw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmullw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmacsw(unsigned __int64 m1, unsigned __int64 m2, unsigned __int64 m3))
- __MACHINECC(unsigned __int64 _m_pmacuw(unsigned __int64 m1, unsigned __int64 m2, unsigned __int64 m3))
- __MACHINECC(unsigned __int64 _m_pmacszw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_padduzw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paccb(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_paccw(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_paccd(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_pmia(unsigned __int64 m1, int i1, int i0))
- __MACHINECC(unsigned __int64 _m_pmiaph(unsigned __int64 m1, int i1, int i0))
- __MACHINECC(unsigned __int64 _m_pmiabb(unsigned __int64 m1, int i1, int i0))
- __MACHINECC(unsigned __int64 _m_pmiabt(unsigned __int64 m1, int i1, int i0))
- __MACHINECC(unsigned __int64 _m_pmiatb(unsigned __int64 m1, int i1, int i0))
- __MACHINECC(unsigned __int64 _m_pmiatt(unsigned __int64 m1, int i1, int i0))
- __MACHINECC(unsigned __int64 _m_psllw(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psllwi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_pslld(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_pslldi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psllq(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psllqi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psraw(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psrawi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psrad(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psradi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psraq(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psraqi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psrlw(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psrlwi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psrld(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psrldi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_psrlq(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_psrlqi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_prorw(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_prorwi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_prord(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_prordi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_prorq(unsigned __int64 m1, unsigned __int64 count))
- __MACHINECC(unsigned __int64 _m_prorqi(unsigned __int64 m1, int count))
- __MACHINECC(unsigned __int64 _m_pand(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pandn(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_por(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pxor(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpeqb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpeqw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpeqd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpgtb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpgtub(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpgtw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpgtuw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpgtd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pcmpgtud(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_packsswb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_packssdw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_packssqd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_packuswb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_packusdw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_packusqd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpckhbw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpckhwd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpckhdq(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpcklbw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpcklwd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpckldq(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_punpckehsbw(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckehswd(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckehsdq(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckehubw(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckehuwd(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckehudq(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckelsbw(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckelswd(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckelsdq(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckelubw(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckeluwd(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_punpckeludq(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _mm_setzero_si64())
- __MACHINECC(unsigned __int64 _mm_set_pi32(int i1, int i0))
- __MACHINECC(unsigned __int64 _mm_set_pi16(short s3, short s2, short s1, short s0))
- __MACHINECC(unsigned __int64 _mm_set_pi8(char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0))
- __MACHINECC(unsigned __int64 _mm_set1_pi32(int i))
- __MACHINECC(unsigned __int64 _mm_set1_pi16(short s))
- __MACHINECC(unsigned __int64 _mm_set1_pi8(char b))
- __MACHINECC(unsigned __int64 _mm_setr_pi32(int i1, int i0))
- __MACHINECC(unsigned __int64 _mm_setr_pi16(short s3, short s2, short s1, short s0))
- __MACHINECC(unsigned __int64 _mm_setr_pi8(char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0))
- __MACHINECC(void _mm_setwcx(int i1, int i0))
- __MACHINECC(int _mm_getwcx(int i))
- __MACHINECC(int _m_pextrb(unsigned __int64 m1, const int c))
- __MACHINECC(int _m_pextrw(unsigned __int64 m1, const int c))
- __MACHINECC(int _m_pextrd(unsigned __int64 m1, const int c))
- __MACHINECC(unsigned int _m_pextrub(unsigned __int64 m1, const int c))
- __MACHINECC(unsigned int _m_pextruw(unsigned __int64 m1, const int c))
- __MACHINECC(unsigned int _m_pextrud(unsigned __int64 m1, const int c))
- __MACHINECC(unsigned __int64 _m_pinsrb(unsigned __int64 m1, int i, const int c))
- __MACHINECC(unsigned __int64 _m_pinsrw(unsigned __int64 m1, int i, const int c))
- __MACHINECC(unsigned __int64 _m_pinsrd(unsigned __int64 m1, int i, const int c))
- __MACHINECC(unsigned __int64 _m_pmaxsb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmaxsw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmaxsd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmaxub(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmaxuw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pmaxud(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pminsb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pminsw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pminsd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pminub(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pminuw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pminud(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(int _m_pmovmskb(unsigned __int64 m1))
- __MACHINECC(int _m_pmovmskw(unsigned __int64 m1))
- __MACHINECC(int _m_pmovmskd(unsigned __int64 m1))
- __MACHINECC(unsigned __int64 _m_pshufw(unsigned __int64 m1, int i))
- __MACHINECC(unsigned __int64 _m_pavgb(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pavgw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pavg2b(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_pavg2w(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psadbw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psadwd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psadzbw(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_psadzwd(unsigned __int64 m1, unsigned __int64 m2))
- __MACHINECC(unsigned __int64 _m_paligniq(unsigned __int64 m1, unsigned __int64 m2, int i))
- __MACHINECC(unsigned __int64 _m_cvt_si2pi(__int64 i))
- __MACHINECC(__int64 _m_cvt_pi2si(unsigned __int64 m1))
- __MACHINEIW64(void __nvreg_save_fence(void))
- __MACHINEIW64(void __nvreg_restore_fence(void))
+__MACHINEIW64(unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask))
+__MACHINEIW64(unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask))
+__MACHINEW64(unsigned char _BitScanForward64(unsigned long* Index, unsigned __int64 Mask))
+__MACHINEW64(unsigned char _BitScanReverse64(unsigned long* Index, unsigned __int64 Mask))
+__MACHINEIW64(_CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *))
+__MACHINEIW64(_CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *))
+__MACHINEIW64(_CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *))
+__MACHINEIW64(_CRTIMP size_t __cdecl wcslen(const wchar_t *))
+__MACHINEIW64(_CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t))
+__MACHINEW64(unsigned __int64 __shiftleft128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift))
+__MACHINEW64(unsigned __int64 __shiftright128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift))
+__MACHINEW64(unsigned __int64 _umul128(unsigned __int64 multiplier, unsigned __int64 multiplicand, unsigned __int64 *highproduct))
+__MACHINEW64(__int64 _mul128(__int64 multiplier, __int64 multiplicand, __int64 *highproduct))
+__MACHINEI(void __int2c(void))
+__MACHINEIW64(void _ReadBarrier(void))
+__MACHINEIW64(unsigned char _rotr8(unsigned char value, unsigned char shift))
+__MACHINEIW64(unsigned short _rotr16(unsigned short value, unsigned char shift))
+__MACHINEIW64(unsigned char _rotl8(unsigned char value, unsigned char shift))
+__MACHINEIW64(unsigned short _rotl16(unsigned short value, unsigned char shift))
+__MACHINEIW64(short _InterlockedIncrement16(short volatile *Addend))
+__MACHINEIW64(short _InterlockedDecrement16(short volatile *Addend))
+__MACHINEIW64(short _InterlockedCompareExchange16(short volatile *Destination, short Exchange, short Comparand))
+__MACHINEIA64(short _InterlockedIncrement16_acq(short volatile *Addend))
+__MACHINEIA64(short _InterlockedIncrement16_rel(short volatile *Addend))
+__MACHINEIA64(short _InterlockedDecrement16_acq(short volatile *Addend))
+__MACHINEIA64(short _InterlockedDecrement16_rel(short volatile *Addend))
+__MACHINEIA64(short _InterlockedCompareExchange16_acq(short volatile *Destination, short Exchange, short Comparand))
+__MACHINEIA64(short _InterlockedCompareExchange16_rel(short volatile *Destination, short Exchange, short Comparand))
+__MACHINECC(unsigned __int64 _m_paddb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddsb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddsw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddsd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddusb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddusw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paddusd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubsb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubsw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubsd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubusb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubusw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psubusd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmaddwd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmadduwd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmulhw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmulhuw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmullw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmullw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmacsw(unsigned __int64 m1, unsigned __int64 m2, unsigned __int64 m3))
+__MACHINECC(unsigned __int64 _m_pmacuw(unsigned __int64 m1, unsigned __int64 m2, unsigned __int64 m3))
+__MACHINECC(unsigned __int64 _m_pmacszw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_padduzw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paccb(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_paccw(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_paccd(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_pmia(unsigned __int64 m1, int i1, int i0))
+__MACHINECC(unsigned __int64 _m_pmiaph(unsigned __int64 m1, int i1, int i0))
+__MACHINECC(unsigned __int64 _m_pmiabb(unsigned __int64 m1, int i1, int i0))
+__MACHINECC(unsigned __int64 _m_pmiabt(unsigned __int64 m1, int i1, int i0))
+__MACHINECC(unsigned __int64 _m_pmiatb(unsigned __int64 m1, int i1, int i0))
+__MACHINECC(unsigned __int64 _m_pmiatt(unsigned __int64 m1, int i1, int i0))
+__MACHINECC(unsigned __int64 _m_psllw(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psllwi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_pslld(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_pslldi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psllq(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psllqi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psraw(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psrawi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psrad(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psradi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psraq(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psraqi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psrlw(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psrlwi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psrld(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psrldi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_psrlq(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_psrlqi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_prorw(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_prorwi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_prord(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_prordi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_prorq(unsigned __int64 m1, unsigned __int64 count))
+__MACHINECC(unsigned __int64 _m_prorqi(unsigned __int64 m1, int count))
+__MACHINECC(unsigned __int64 _m_pand(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pandn(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_por(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pxor(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpeqb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpeqw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpeqd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpgtb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpgtub(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpgtw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpgtuw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpgtd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pcmpgtud(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_packsswb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_packssdw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_packssqd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_packuswb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_packusdw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_packusqd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpckhbw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpckhwd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpckhdq(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpcklbw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpcklwd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpckldq(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_punpckehsbw(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckehswd(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckehsdq(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckehubw(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckehuwd(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckehudq(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckelsbw(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckelswd(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckelsdq(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckelubw(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckeluwd(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_punpckeludq(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _mm_setzero_si64())
+__MACHINECC(unsigned __int64 _mm_set_pi32(int i1, int i0))
+__MACHINECC(unsigned __int64 _mm_set_pi16(short s3, short s2, short s1, short s0))
+__MACHINECC(unsigned __int64 _mm_set_pi8(char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0))
+__MACHINECC(unsigned __int64 _mm_set1_pi32(int i))
+__MACHINECC(unsigned __int64 _mm_set1_pi16(short s))
+__MACHINECC(unsigned __int64 _mm_set1_pi8(char b))
+__MACHINECC(unsigned __int64 _mm_setr_pi32(int i1, int i0))
+__MACHINECC(unsigned __int64 _mm_setr_pi16(short s3, short s2, short s1, short s0))
+__MACHINECC(unsigned __int64 _mm_setr_pi8(char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0))
+__MACHINECC(void _mm_setwcx(int i1, int i0))
+__MACHINECC(int _mm_getwcx(int i))
+__MACHINECC(int _m_pextrb(unsigned __int64 m1, const int c))
+__MACHINECC(int _m_pextrw(unsigned __int64 m1, const int c))
+__MACHINECC(int _m_pextrd(unsigned __int64 m1, const int c))
+__MACHINECC(unsigned int _m_pextrub(unsigned __int64 m1, const int c))
+__MACHINECC(unsigned int _m_pextruw(unsigned __int64 m1, const int c))
+__MACHINECC(unsigned int _m_pextrud(unsigned __int64 m1, const int c))
+__MACHINECC(unsigned __int64 _m_pinsrb(unsigned __int64 m1, int i, const int c))
+__MACHINECC(unsigned __int64 _m_pinsrw(unsigned __int64 m1, int i, const int c))
+__MACHINECC(unsigned __int64 _m_pinsrd(unsigned __int64 m1, int i, const int c))
+__MACHINECC(unsigned __int64 _m_pmaxsb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmaxsw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmaxsd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmaxub(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmaxuw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pmaxud(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pminsb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pminsw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pminsd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pminub(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pminuw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pminud(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(int _m_pmovmskb(unsigned __int64 m1))
+__MACHINECC(int _m_pmovmskw(unsigned __int64 m1))
+__MACHINECC(int _m_pmovmskd(unsigned __int64 m1))
+__MACHINECC(unsigned __int64 _m_pshufw(unsigned __int64 m1, int i))
+__MACHINECC(unsigned __int64 _m_pavgb(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pavgw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pavg2b(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_pavg2w(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psadbw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psadwd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psadzbw(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_psadzwd(unsigned __int64 m1, unsigned __int64 m2))
+__MACHINECC(unsigned __int64 _m_paligniq(unsigned __int64 m1, unsigned __int64 m2, int i))
+__MACHINECC(unsigned __int64 _m_cvt_si2pi(__int64 i))
+__MACHINECC(__int64 _m_cvt_pi2si(unsigned __int64 m1))
+__MACHINEIW64(void __nvreg_save_fence(void))
+__MACHINEIW64(void __nvreg_restore_fence(void))
- __MACHINEX64(short _InterlockedCompareExchange16_np(short volatile *Destination, short Exchange, short Comparand))
- __MACHINEX64(long _InterlockedCompareExchange_np(long *, long, long))
- __MACHINEX64(__int64 _InterlockedCompareExchange64_np(__int64 *, __int64, __int64))
- __MACHINEX64(void *_InterlockedCompareExchangePointer_np(void **, void *, void *))
- __MACHINEX64(__int64 _InterlockedCompare64Exchange128_np(__int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEX64(__int64 _InterlockedCompare64Exchange128_acq_np(__int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEX64(__int64 _InterlockedCompare64Exchange128_rel_np(__int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
- __MACHINEX64(long _InterlockedAnd_np(long *, long))
- __MACHINEX64(char _InterlockedAnd8_np(char *, char))
- __MACHINEX64(short _InterlockedAnd16_np(short *, short))
- __MACHINEX64(__int64 _InterlockedAnd64_np(__int64 *, __int64))
- __MACHINEX64(long _InterlockedOr_np(long *, long))
- __MACHINEX64(char _InterlockedOr8_np(char *, char))
- __MACHINEX64(short _InterlockedOr16_np(short *, short))
- __MACHINEX64(__int64 _InterlockedOr64_np(__int64 *, __int64))
- __MACHINEX64(long _InterlockedXor_np(long *, long))
- __MACHINEX64(char _InterlockedXor8_np(char *, char))
- __MACHINEX64(short _InterlockedXor16_np(short *, short))
- __MACHINEX64(__int64 _InterlockedXor64_np(__int64 *, __int64))
+__MACHINEX64(short _InterlockedCompareExchange16_np(short volatile *Destination, short Exchange, short Comparand))
+__MACHINEX64(long _InterlockedCompareExchange_np (long *, long, long))
+__MACHINEX64(__int64 _InterlockedCompareExchange64_np(__int64 *, __int64, __int64))
+__MACHINEX64(void *_InterlockedCompareExchangePointer_np (void **, void *, void *))
+__MACHINEX64(__int64 _InterlockedCompare64Exchange128_np(__int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEX64(__int64 _InterlockedCompare64Exchange128_acq_np(__int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEX64(__int64 _InterlockedCompare64Exchange128_rel_np(__int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comparand))
+__MACHINEX64(long _InterlockedAnd_np(long *, long))
+__MACHINEX64(char _InterlockedAnd8_np(char *, char))
+__MACHINEX64(short _InterlockedAnd16_np(short *, short))
+__MACHINEX64(__int64 _InterlockedAnd64_np(__int64 *, __int64))
+__MACHINEX64(long _InterlockedOr_np(long *, long))
+__MACHINEX64(char _InterlockedOr8_np(char *, char))
+__MACHINEX64(short _InterlockedOr16_np(short *, short))
+__MACHINEX64(__int64 _InterlockedOr64_np(__int64 *, __int64))
+__MACHINEX64(long _InterlockedXor_np(long *, long))
+__MACHINEX64(char _InterlockedXor8_np(char *, char))
+__MACHINEX64(short _InterlockedXor16_np(short *, short))
+__MACHINEX64(__int64 _InterlockedXor64_np(__int64 *, __int64))
#if defined(_M_IA64)
diff --git a/src/filters/transform/MPCVideoDec/resource.h b/src/filters/transform/MPCVideoDec/resource.h
index b3aa5e1d8..0965ded12 100644
--- a/src/filters/transform/MPCVideoDec/resource.h
+++ b/src/filters/transform/MPCVideoDec/resource.h
@@ -34,7 +34,7 @@
#define IDS_VDF_DXVA_NOCHECK 41104
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
diff --git a/src/filters/transform/MPCVideoDec/stdafx.cpp b/src/filters/transform/MPCVideoDec/stdafx.cpp
index eca4e29af..0a111a528 100644
--- a/src/filters/transform/MPCVideoDec/stdafx.cpp
+++ b/src/filters/transform/MPCVideoDec/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -29,20 +29,20 @@
void LOG(LPCTSTR fmt, ...)
{
- va_list args;
- va_start(args, fmt);
- if(TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1])
- {
- _vstprintf(buff, fmt, args);
- if(FILE* f = _tfopen(LOG_FILE, _T("at")))
- {
- fseek(f, 0, 2);
- _ftprintf(f, _T("%s\n"), buff);
- fclose(f);
- }
- delete [] buff;
- }
- va_end(args);
+ va_list args;
+ va_start(args, fmt);
+ if(TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1])
+ {
+ _vstprintf(buff, fmt, args);
+ if(FILE* f = _tfopen(LOG_FILE, _T("at")))
+ {
+ fseek(f, 0, 2);
+ _ftprintf(f, _T("%s\n"), buff);
+ fclose(f);
+ }
+ delete [] buff;
+ }
+ va_end(args);
}
#endif \ No newline at end of file
diff --git a/src/filters/transform/MPCVideoDec/stdafx.h b/src/filters/transform/MPCVideoDec/stdafx.h
index 8e18a10f9..41d2d3d49 100644
--- a/src/filters/transform/MPCVideoDec/stdafx.h
+++ b/src/filters/transform/MPCVideoDec/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* (C) 2006-2010 see AUTHORS
@@ -47,9 +47,9 @@
#ifdef _DEBUG
-void LOG(LPCTSTR fmt, ...);
+ void LOG(LPCTSTR fmt, ...);
#else
-inline void LOG(LPCTSTR fmt, ...) {}
+ inline void LOG(LPCTSTR fmt, ...) {}
#endif
#define CHECK_HR(x) hr = ##x; if (FAILED (hr)) { TRACE("Error : 0x%08x\n", hr); ASSERT (hr==VFW_E_NOT_COMMITTED); return hr; }
diff --git a/src/filters/transform/MpaDecFilter/IMpaDecFilter.h b/src/filters/transform/MpaDecFilter/IMpaDecFilter.h
index 8e7809508..cb044aa40 100644
--- a/src/filters/transform/MpaDecFilter/IMpaDecFilter.h
+++ b/src/filters/transform/MpaDecFilter/IMpaDecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,31 +26,30 @@ enum {AAC_ASIS, AAC_STEREO};
enum DolbyDigitalMode
{
- DD_Unknown,
- DD_AC3, // Standard AC3
- DD_EAC3, // Dolby Digital +
- DD_TRUEHD, // Dolby True HD
- DD_MLP // Meridian Lossless Packing
+ DD_Unknown,
+ DD_AC3, // Standard AC3
+ DD_EAC3, // Dolby Digital +
+ DD_TRUEHD, // Dolby True HD
+ DD_MLP // Meridian Lossless Packing
};
[uuid("2067C60F-752F-4EBD-B0B1-4CBC5E00741C")]
-interface IMpaDecFilter :
-public IUnknown
+interface IMpaDecFilter : public IUnknown
{
- enum enctype {ac3, dts, aac, etlast};
+ enum enctype {ac3, dts, aac, etlast};
- STDMETHOD(SetSampleFormat(MPCSampleFormat sf)) = 0;
- STDMETHOD_(MPCSampleFormat, GetSampleFormat()) = 0;
- STDMETHOD(SetNormalize(bool fNormalize)) = 0;
- STDMETHOD_(bool, GetNormalize()) = 0;
- STDMETHOD(SetSpeakerConfig(enctype et, int sc)) = 0; // sign of sc tells if spdif is active
- STDMETHOD_(int, GetSpeakerConfig(enctype et)) = 0;
- STDMETHOD(SetDynamicRangeControl(enctype et, bool fDRC)) = 0;
- STDMETHOD_(bool, GetDynamicRangeControl(enctype et)) = 0;
- STDMETHOD(SetBoost(float boost)) = 0;
- STDMETHOD_(float, GetBoost()) = 0;
- STDMETHOD_(DolbyDigitalMode, GetDolbyDigitalMode()) = 0;
+ STDMETHOD(SetSampleFormat(MPCSampleFormat sf)) = 0;
+ STDMETHOD_(MPCSampleFormat, GetSampleFormat()) = 0;
+ STDMETHOD(SetNormalize(bool fNormalize)) = 0;
+ STDMETHOD_(bool, GetNormalize()) = 0;
+ STDMETHOD(SetSpeakerConfig(enctype et, int sc)) = 0; // sign of sc tells if spdif is active
+ STDMETHOD_(int, GetSpeakerConfig(enctype et)) = 0;
+ STDMETHOD(SetDynamicRangeControl(enctype et, bool fDRC)) = 0;
+ STDMETHOD_(bool, GetDynamicRangeControl(enctype et)) = 0;
+ STDMETHOD(SetBoost(float boost)) = 0;
+ STDMETHOD_(float, GetBoost()) = 0;
+ STDMETHOD_(DolbyDigitalMode, GetDolbyDigitalMode()) = 0;
- STDMETHOD(SaveSettings()) = 0;
+ STDMETHOD(SaveSettings()) = 0;
};
diff --git a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
index 05a17f450..ca91ef027 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
+++ b/src/filters/transform/MpaDecFilter/MpaDecFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -54,70 +54,70 @@ typedef long int32;
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Payload},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MPEG2_AUDIO},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MPEG2_AUDIO},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MPEG2_AUDIO},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG2_AUDIO},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_AC3},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_AC3},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_DDPLUS},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_DDPLUS},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_DDPLUS},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_DDPLUS},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_TRUEHD},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_TRUEHD},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_TRUEHD},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_TRUEHD},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DTS},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DTS},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_HDMV_LPCM_AUDIO},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_AAC},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_AAC},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_AAC},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_AAC},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MP4A},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MP4A},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MP4A},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP4A},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_mp4a},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_mp4a},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_mp4a},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_mp4a},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_AMR},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_SAMR},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_SAWB},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_PS2_PCM},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_PS2_PCM},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_PS2_PCM},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_PS2_PCM},
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_PS2_ADPCM},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_PS2_ADPCM},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_PS2_ADPCM},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_PS2_ADPCM},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_Vorbis2},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_FLAC_FRAMED},
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_NELLYMOSER},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Payload},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_DDPLUS},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_DDPLUS},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_DDPLUS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_DDPLUS},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_TRUEHD},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_TRUEHD},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_TRUEHD},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_TRUEHD},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_HDMV_LPCM_AUDIO},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_AMR},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_SAMR},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_SAWB},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_Vorbis2},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_FLAC_FRAMED},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NELLYMOSER},
};
#ifdef REGISTER_FILTER
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -128,25 +128,25 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CMpaDecFilter), L"MPC - MPA Decoder Filter", /*MERIT_DO_NOT_USE*/0x40000001, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CMpaDecFilter), L"MPC - MPA Decoder Filter", /*MERIT_DO_NOT_USE*/0x40000001, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
{sudFilter[0].strName, &__uuidof(CMpaDecFilter), CreateInstance<CMpaDecFilter>, NULL, &sudFilter[0]},
- {L"CMpaDecPropertyPage", &__uuidof(CMpaDecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpaDecSettingsWnd> >},
+ {L"CMpaDecPropertyPage", &__uuidof(CMpaDecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpaDecSettingsWnd> >},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
//
@@ -165,1881 +165,1850 @@ CFilterApp theApp;
static struct scmap_t
{
- WORD nChannels;
- BYTE ch[8];
- DWORD dwChannelMask;
-}
-s_scmap_ac3[2*11] =
-{
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // A52_CHANNEL
- {1, {0, -1, -1, -1, -1, -1, -1, -1}, 0}, // A52_MONO
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // A52_STEREO
- {3, {0, 2, 1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER}, // A52_3F
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_CENTER}, // A52_2F1R
- {4, {0, 2, 1, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER}, // A52_3F1R
- {4, {0, 1, 2, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // A52_2F2R
- {5, {0, 2, 1, 3, 4, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // A52_3F2R
- {1, {0, -1, -1, -1, -1, -1, -1, -1}, 0}, // A52_CHANNEL1
- {1, {0, -1, -1, -1, -1, -1, -1, -1}, 0}, // A52_CHANNEL2
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // A52_DOLBY
-
- {3, {1, 2, 0, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL|A52_LFE
- {2, {1, 0, -1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // A52_MONO|A52_LFE
- {3, {1, 2, 0, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // A52_STEREO|A52_LFE
- {4, {1, 3, 2, 0, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // A52_3F|A52_LFE
- {4, {1, 2, 0, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_CENTER}, // A52_2F1R|A52_LFE
- {5, {1, 3, 2, 0, 4, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_CENTER}, // A52_3F1R|A52_LFE
- {5, {1, 2, 0, 3, 4, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // A52_2F2R|A52_LFE
- {6, {1, 3, 2, 0, 4, 5, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // A52_3F2R|A52_LFE
- {2, {1, 0, -1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL1|A52_LFE
- {2, {1, 0, -1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL2|A52_LFE
- {3, {1, 2, 0, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // A52_DOLBY|A52_LFE
+ WORD nChannels;
+ BYTE ch[8];
+ DWORD dwChannelMask;
+}
+s_scmap_ac3[2*11] =
+{
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // A52_CHANNEL
+ {1, {0,-1,-1,-1,-1,-1,-1,-1}, 0}, // A52_MONO
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // A52_STEREO
+ {3, {0, 2, 1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // A52_3F
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_CENTER}, // A52_2F1R
+ {4, {0, 2, 1, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_CENTER}, // A52_3F1R
+ {4, {0, 1, 2, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_2F2R
+ {5, {0, 2, 1, 3, 4,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_3F2R
+ {1, {0,-1,-1,-1,-1,-1,-1,-1}, 0}, // A52_CHANNEL1
+ {1, {0,-1,-1,-1,-1,-1,-1,-1}, 0}, // A52_CHANNEL2
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // A52_DOLBY
+
+ {3, {1, 2, 0,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL|A52_LFE
+ {2, {1, 0,-1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_MONO|A52_LFE
+ {3, {1, 2, 0,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // A52_STEREO|A52_LFE
+ {4, {1, 3, 2, 0,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_3F|A52_LFE
+ {4, {1, 2, 0, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // A52_2F1R|A52_LFE
+ {5, {1, 3, 2, 0, 4,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // A52_3F1R|A52_LFE
+ {5, {1, 2, 0, 3, 4,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_2F2R|A52_LFE
+ {6, {1, 3, 2, 0, 4, 5,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_3F2R|A52_LFE
+ {2, {1, 0,-1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL1|A52_LFE
+ {2, {1, 0,-1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL2|A52_LFE
+ {3, {1, 2, 0,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // A52_DOLBY|A52_LFE
},
-s_scmap_dts[2*10] =
-{
- {1, {0, -1, -1, -1, -1, -1, -1, -1}, 0}, // DTS_MONO
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // DTS_CHANNEL
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // DTS_STEREO
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // DTS_STEREO_SUMDIFF
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // DTS_STEREO_TOTAL
- {3, {1, 2, 0, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER}, // DTS_3F
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_CENTER}, // DTS_2F1R
- {4, {1, 2, 0, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER}, // DTS_3F1R
- {4, {0, 1, 2, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // DTS_2F2R
- {5, {1, 2, 0, 3, 4, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // DTS_3F2R
-
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // DTS_MONO|DTS_LFE
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // DTS_CHANNEL|DTS_LFE
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // DTS_STEREO|DTS_LFE
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // DTS_STEREO_SUMDIFF|DTS_LFE
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // DTS_STEREO_TOTAL|DTS_LFE
- {4, {1, 2, 0, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // DTS_3F|DTS_LFE
- {4, {0, 1, 3, 2, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_CENTER}, // DTS_2F1R|DTS_LFE
- {5, {1, 2, 0, 4, 3, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_CENTER}, // DTS_3F1R|DTS_LFE
- {5, {0, 1, 4, 2, 3, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // DTS_2F2R|DTS_LFE
- {6, {1, 2, 0, 5, 3, 4, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // DTS_3F2R|DTS_LFE
+s_scmap_dts[2*10] =
+{
+ {1, {0,-1,-1,-1,-1,-1,-1,-1}, 0}, // DTS_MONO
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // DTS_CHANNEL
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // DTS_STEREO
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // DTS_STEREO_SUMDIFF
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // DTS_STEREO_TOTAL
+ {3, {1, 2, 0,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // DTS_3F
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_CENTER}, // DTS_2F1R
+ {4, {1, 2, 0, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_CENTER}, // DTS_3F1R
+ {4, {0, 1, 2, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_2F2R
+ {5, {1, 2, 0, 3, 4,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_3F2R
+
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // DTS_MONO|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_CHANNEL|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_STEREO|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_STEREO_SUMDIFF|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_STEREO_TOTAL|DTS_LFE
+ {4, {1, 2, 0, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // DTS_3F|DTS_LFE
+ {4, {0, 1, 3, 2,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // DTS_2F1R|DTS_LFE
+ {5, {1, 2, 0, 4, 3,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // DTS_3F1R|DTS_LFE
+ {5, {0, 1, 4, 2, 3,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_2F2R|DTS_LFE
+ {6, {1, 2, 0, 5, 3, 4,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_3F2R|DTS_LFE
},
-s_scmap_vorbis[6] =
-{
- {1, {0, -1, -1, -1, -1, -1, -1, -1}, 0}, // 1F
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // 2F
- {3, {0, 2, 1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER}, // 2F1R
- {4, {0, 1, 2, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 2F2R
- {5, {0, 2, 1, 3, 4, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3F2R
- {6, {0, 2, 1, 5, 3, 4, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3F2R + LFE
+s_scmap_vorbis[6] =
+{
+ {1, {0,-1,-1,-1,-1,-1,-1,-1}, 0}, // 1F
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // 2F
+ {3, {0, 2, 1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // 2F1R
+ {4, {0, 1, 2, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // 2F2R
+ {5, {0, 2, 1, 3, 4,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // 3F2R
+ {6, {0, 2, 1, 5, 3, 4,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // 3F2R + LFE
},
-s_scmap_hdmv[] =
+s_scmap_hdmv[] =
{
// FL FR FC LFe BL BR FLC FRC
- {0, { -1, -1, -1, -1, -1, -1, -1, -1 }, 0}, // INVALID
- {2, { 0, -1, -1, -1, -1, -1, -1, -1 }, 0}, // Mono M1, 0
- {0, { -1, -1, -1, -1, -1, -1, -1, -1 }, 0}, // INVALID
- {2, { 0, 1, -1, -1, -1, -1, -1, -1 }, 0}, // Stereo FL, FR
- {4, { 0, 1, 2, -1, -1, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER}, // 3/0 FL, FR, FC
- {4, { 0, 1, 2, -1, -1, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY}, // 2/1 FL, FR, Surround
- {4, { 0, 1, 2, 3, -1, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // 3/1 FL, FR, FC, Surround
- {4, { 0, 1, 2, 3, -1, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 2/2 FL, FR, BL, BR
- {6, { 0, 1, 2, 3, 4, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3/2 FL, FR, FC, BL, BR
- {6, { 0, 1, 2, 5, 3, 4, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3/2+LFe FL, FR, FC, BL, BR, LFe
- {8, { 0, 1, 2, 3, 6, 4, 5, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT}, // 3/4 FL, FR, FC, BL, Bls, Brs, BR
- {8, { 0, 1, 2, 7, 4, 5, 3, 6 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT}, // 3/4+LFe FL, FR, FC, BL, Bls, Brs, BR, LFe
+ {0, {-1,-1,-1,-1,-1,-1,-1,-1 }, 0}, // INVALID
+ {2, { 0,-1,-1,-1,-1,-1,-1,-1 }, 0}, // Mono M1, 0
+ {0, {-1,-1,-1,-1,-1,-1,-1,-1 }, 0}, // INVALID
+ {2, { 0, 1,-1,-1,-1,-1,-1,-1 }, 0}, // Stereo FL, FR
+ {4, { 0, 1, 2,-1,-1,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // 3/0 FL, FR, FC
+ {4, { 0, 1, 2,-1,-1,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // 2/1 FL, FR, Surround
+ {4, { 0, 1, 2, 3,-1,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // 3/1 FL, FR, FC, Surround
+ {4, { 0, 1, 2, 3,-1,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // 2/2 FL, FR, BL, BR
+ {6, { 0, 1, 2, 3, 4,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // 3/2 FL, FR, FC, BL, BR
+ {6, { 0, 1, 2, 5, 3, 4,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// 3/2+LFe FL, FR, FC, BL, BR, LFe
+ {8, { 0, 1, 2, 3, 6, 4, 5,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT}, // 3/4 FL, FR, FC, BL, Bls, Brs, BR
+ {8, { 0, 1, 2, 7, 4, 5, 3, 6 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT},// 3/4+LFe FL, FR, FC, BL, Bls, Brs, BR, LFe
},
m_scmap_default[] =
{
// FL FR FC LFe BL BR FLC FRC
- {1, { 0, -1, -1, -1, -1, -1, -1, -1 }, 0}, // Mono M1, 0
- {2, { 0, 1, -1, -1, -1, -1, -1, -1 }, 0}, // Stereo FL, FR
- {3, { 0, 1, 2, -1, -1, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER}, // 3/0 FL, FR, FC
- {4, { 0, 1, 2, 3, -1, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY}, // 3/1 FL, FR, FC, Surround
- {5, { 0, 1, 2, 3, 4, -1, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3/2 FL, FR, FC, BL, BR
- {6, { 0, 1, 2, 3, 4, 5, -1, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3/2+LFe FL, FR, FC, BL, BR, LFe
- {7, { 0, 1, 2, 3, 4, 5, 6, -1 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT | SPEAKER_BACK_CENTER}, // 3/4 FL, FR, FC, BL, Bls, Brs, BR
- {8, { 0, 1, 2, 3, 6, 7, 4, 5 }, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // 3/4+LFe FL, FR, FC, BL, Bls, Brs, BR, LFe
+ {1, { 0,-1,-1,-1,-1,-1,-1,-1 }, 0}, // Mono M1, 0
+ {2, { 0, 1,-1,-1,-1,-1,-1,-1 }, 0}, // Stereo FL, FR
+ {3, { 0, 1, 2,-1,-1,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // 3/0 FL, FR, FC
+ {4, { 0, 1, 2, 3,-1,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // 3/1 FL, FR, FC, Surround
+ {5, { 0, 1, 2, 3, 4,-1,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // 3/2 FL, FR, FC, BL, BR
+ {6, { 0, 1, 2, 3, 4, 5,-1,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// 3/2+LFe FL, FR, FC, BL, BR, LFe
+ {7, { 0, 1, 2, 3, 4, 5, 6,-1 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT|SPEAKER_BACK_CENTER}, // 3/4 FL, FR, FC, BL, Bls, Brs, BR
+ {8, { 0, 1, 2, 3, 6, 7, 4, 5 }, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// 3/4+LFe FL, FR, FC, BL, Bls, Brs, BR, LFe
},
m_ffmpeg_ac3[] =
{
// FL FR FC LFe BL BR FLC FRC
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // AC3_CHMODE_DUALMONO
- {1, {0, -1, -1, -1, -1, -1, -1, -1}, 0}, // AC3_CHMODE_MONO
- {2, {0, 1, -1, -1, -1, -1, -1, -1}, 0}, // AC3_CHMODE_STEREO
- {3, {0, 2, 1, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER}, // AC3_CHMODE_3F
- {3, {0, 1, 2, -1, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_CENTER}, // AC3_CHMODE_2F1R
- {4, {0, 2, 1, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER}, // AC3_CHMODE_3F1R
- {4, {0, 1, 2, 3, -1, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // AC3_CHMODE_2F2R
- {5, {0, 2, 1, 3, 4, -1, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // AC3_CHMODE_3F2R
-
- // LFe
- {6, {0, 1, 2, 3, 4, 5, -1, -1}, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT}, // AC3_CHMODE_3F2R
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // AC3_CHMODE_DUALMONO
+ {1, {0,-1,-1,-1,-1,-1,-1,-1}, 0}, // AC3_CHMODE_MONO
+ {2, {0, 1,-1,-1,-1,-1,-1,-1}, 0}, // AC3_CHMODE_STEREO
+ {3, {0, 2, 1,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // AC3_CHMODE_3F
+ {3, {0, 1, 2,-1,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_CENTER}, // AC3_CHMODE_2F1R
+ {4, {0, 2, 1, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_CENTER}, // AC3_CHMODE_3F1R
+ {4, {0, 1, 2, 3,-1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // AC3_CHMODE_2F2R
+ {5, {0, 2, 1, 3, 4,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// AC3_CHMODE_3F2R
+
+ // LFe
+ {6, {0, 1, 2, 3, 4, 5,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// AC3_CHMODE_3F2R
};
-CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CTransformFilter(NAME("CMpaDecFilter"), lpunk, __uuidof(this))
- , m_iSampleFormat(SF_PCM16)
- , m_fNormalize(false)
- , m_boost(1)
-{
- if(phr) *phr = S_OK;
-
- if(!(m_pInput = DNew CMpaDecInputPin(this, phr, L"In"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
-
- if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr))
- {
- delete m_pInput, m_pInput = NULL;
- return;
- }
-
- m_iSpeakerConfig[ac3] = A52_STEREO;
- m_iSpeakerConfig[dts] = DTS_STEREO;
- m_iSpeakerConfig[aac] = AAC_STEREO;
- m_fDynamicRangeControl[ac3] = false;
- m_fDynamicRangeControl[dts] = false;
- m_fDynamicRangeControl[aac] = false;
- m_DolbyDigitalMode = DD_Unknown;
- m_pAVCodec = NULL;
- m_pAVCtx = NULL;
- m_pParser = NULL;
- m_pPCMData = NULL;
- memset(&m_flac, 0, sizeof(m_flac));
-
- CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"), KEY_READ))
- {
- DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("SampleFormat"), dw)) m_iSampleFormat = (MPCSampleFormat)dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Normalize"), dw)) m_fNormalize = !!dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Boost"), dw)) m_boost = *(float*)&dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3SpeakerConfig"), dw)) m_iSpeakerConfig[ac3] = (int)dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsSpeakerConfig"), dw)) m_iSpeakerConfig[dts] = (int)dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AacSpeakerConfig"), dw)) m_iSpeakerConfig[aac] = (int)dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3DynamicRangeControl"), dw)) m_fDynamicRangeControl[ac3] = !!dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsDynamicRangeControl"), dw)) m_fDynamicRangeControl[dts] = !!dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AacDynamicRangeControl"), dw)) m_fDynamicRangeControl[aac] = !!dw;
- }
+CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CMpaDecFilter"), lpunk, __uuidof(this))
+ , m_iSampleFormat(SF_PCM16)
+ , m_fNormalize(false)
+ , m_boost(1)
+{
+ if(phr) *phr = S_OK;
+
+ if(!(m_pInput = DNew CMpaDecInputPin(this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ if(!(m_pOutput = DNew CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
+
+ m_iSpeakerConfig[ac3] = A52_STEREO;
+ m_iSpeakerConfig[dts] = DTS_STEREO;
+ m_iSpeakerConfig[aac] = AAC_STEREO;
+ m_fDynamicRangeControl[ac3] = false;
+ m_fDynamicRangeControl[dts] = false;
+ m_fDynamicRangeControl[aac] = false;
+ m_DolbyDigitalMode = DD_Unknown;
+ m_pAVCodec = NULL;
+ m_pAVCtx = NULL;
+ m_pParser = NULL;
+ m_pPCMData = NULL;
+ memset (&m_flac, 0, sizeof(m_flac));
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"), KEY_READ))
+ {
+ DWORD dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("SampleFormat"), dw)) m_iSampleFormat = (MPCSampleFormat)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Normalize"), dw)) m_fNormalize = !!dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Boost"), dw)) m_boost = *(float*)&dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3SpeakerConfig"), dw)) m_iSpeakerConfig[ac3] = (int)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsSpeakerConfig"), dw)) m_iSpeakerConfig[dts] = (int)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AacSpeakerConfig"), dw)) m_iSpeakerConfig[aac] = (int)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3DynamicRangeControl"), dw)) m_fDynamicRangeControl[ac3] = !!dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsDynamicRangeControl"), dw)) m_fDynamicRangeControl[dts] = !!dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AacDynamicRangeControl"), dw)) m_fDynamicRangeControl[aac] = !!dw;
+ }
}
CMpaDecFilter::~CMpaDecFilter()
{
- /*
- CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder")))
- {
- key.SetDWORDValue(_T("SampleFormat"), m_iSampleFormat);
- key.SetDWORDValue(_T("Normalize"), m_fNormalize);
- key.SetDWORDValue(_T("Boost"), *(DWORD*)&m_boost);
- key.SetDWORDValue(_T("Ac3SpeakerConfig"), m_iSpeakerConfig[ac3]);
- key.SetDWORDValue(_T("DtsSpeakerConfig"), m_iSpeakerConfig[dts]);
- key.SetDWORDValue(_T("AacSpeakerConfig"), m_iSpeakerConfig[aac]);
- key.SetDWORDValue(_T("Ac3DynamicRangeControl"), m_fDynamicRangeControl[ac3]);
- key.SetDWORDValue(_T("DtsDynamicRangeControl"), m_fDynamicRangeControl[dts]);
- key.SetDWORDValue(_T("AacDynamicRangeControl"), m_fDynamicRangeControl[aac]);
- }
- */
+ /*
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder")))
+ {
+ key.SetDWORDValue(_T("SampleFormat"), m_iSampleFormat);
+ key.SetDWORDValue(_T("Normalize"), m_fNormalize);
+ key.SetDWORDValue(_T("Boost"), *(DWORD*)&m_boost);
+ key.SetDWORDValue(_T("Ac3SpeakerConfig"), m_iSpeakerConfig[ac3]);
+ key.SetDWORDValue(_T("DtsSpeakerConfig"), m_iSpeakerConfig[dts]);
+ key.SetDWORDValue(_T("AacSpeakerConfig"), m_iSpeakerConfig[aac]);
+ key.SetDWORDValue(_T("Ac3DynamicRangeControl"), m_fDynamicRangeControl[ac3]);
+ key.SetDWORDValue(_T("DtsDynamicRangeControl"), m_fDynamicRangeControl[dts]);
+ key.SetDWORDValue(_T("AacDynamicRangeControl"), m_fDynamicRangeControl[aac]);
+ }
+ */
}
STDMETHODIMP CMpaDecFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IMpaDecFilter)
- QI(ISpecifyPropertyPages)
- QI(ISpecifyPropertyPages2)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IMpaDecFilter)
+ QI(ISpecifyPropertyPages)
+ QI(ISpecifyPropertyPages2)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CMpaDecFilter::EndOfStream()
{
- CAutoLock cAutoLock(&m_csReceive);
- return __super::EndOfStream();
+ CAutoLock cAutoLock(&m_csReceive);
+ return __super::EndOfStream();
}
HRESULT CMpaDecFilter::BeginFlush()
{
- return __super::BeginFlush();
+ return __super::BeginFlush();
}
HRESULT CMpaDecFilter::EndFlush()
{
- CAutoLock cAutoLock(&m_csReceive);
- m_buff.RemoveAll();
- m_sample_max = 0.1f;
- return __super::EndFlush();
+ CAutoLock cAutoLock(&m_csReceive);
+ m_buff.RemoveAll();
+ m_sample_max = 0.1f;
+ return __super::EndFlush();
}
HRESULT CMpaDecFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
- m_buff.RemoveAll();
- m_sample_max = 0.1f;
- m_ps2_state.sync = false;
- m_DolbyDigitalMode = DD_Unknown;
- if(m_pAVCtx)
- avcodec_flush_buffers(m_pAVCtx);
- if(m_flac.pDecoder)
- FLAC__stream_decoder_flush((FLAC__StreamDecoder*) m_flac.pDecoder);
- return __super::NewSegment(tStart, tStop, dRate);
+ CAutoLock cAutoLock(&m_csReceive);
+ m_buff.RemoveAll();
+ m_sample_max = 0.1f;
+ m_ps2_state.sync = false;
+ m_DolbyDigitalMode = DD_Unknown;
+ if (m_pAVCtx)
+ avcodec_flush_buffers (m_pAVCtx);
+ if (m_flac.pDecoder)
+ FLAC__stream_decoder_flush((FLAC__StreamDecoder*) m_flac.pDecoder);
+ return __super::NewSegment(tStart, tStop, dRate);
}
HRESULT CMpaDecFilter::Receive(IMediaSample* pIn)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- HRESULT hr;
+ HRESULT hr;
AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
if(pProps->dwStreamId != AM_STREAM_MEDIA)
- return m_pOutput->Deliver(pIn);
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- m_pInput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- pmt = NULL;
- m_sample_max = 0.1f;
- m_aac_state.init(mt);
-
- m_vorbis.init(mt);
- m_DolbyDigitalMode = DD_Unknown;
- }
-
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
-
- long len = pIn->GetActualDataLength();
-
- (static_cast<CDeCSSInputPin*>(m_pInput))->StripPacket(pDataIn, len);
-
- REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
- hr = pIn->GetTime(&rtStart, &rtStop);
-
- if(pIn->IsDiscontinuity() == S_OK)
- {
- m_fDiscontinuity = true;
- m_buff.RemoveAll();
- m_sample_max = 0.1f;
- // ASSERT(SUCCEEDED(hr)); // what to do if not?
- if(FAILED(hr))
- {
- TRACE(_T("mpa: disc. w/o timestamp\n")); // lets wait then...
- return S_OK;
- }
- m_rtStart = rtStart;
- }
-
- const GUID& subtype = m_pInput->CurrentMediaType().subtype;
-
- BOOL bNoJitterControl = false;
- if(subtype == MEDIASUBTYPE_AMR || subtype == MEDIASUBTYPE_SAMR || subtype == MEDIASUBTYPE_SAWB)
- {
- //The reason I add this to disable Jitter control for AMR audio stream
- //is because it seems a lot AMR audio stream haven't report correct output sample rate (my guess)
- //so if there is jitter control, audio and video will be going very faster than it should (result)
- //therefor I disable jitter control.
- //but this is NOT a PERFECT solution. hope more input from other brilliant developers
- //discuss is welcome -- tomasen@gmail.com
- bNoJitterControl = true;
- }
-
- if(SUCCEEDED(hr) && abs((int)(m_rtStart - rtStart)) > 1000000 && !bNoJitterControl) // +-100ms jitter is allowed for now
- {
- m_buff.RemoveAll();
- m_rtStart = rtStart;
- }
-
- int bufflen = m_buff.GetCount();
- m_buff.SetCount(bufflen + len, 4096);
- memcpy(m_buff.GetData() + bufflen, pDataIn, len);
- len += bufflen;
-
- if(subtype == MEDIASUBTYPE_AMR || subtype == MEDIASUBTYPE_SAMR)
- hr = ProcessFfmpeg(CODEC_ID_AMR_NB);
- else if(subtype == MEDIASUBTYPE_SAWB)
- hr = ProcessFfmpeg(CODEC_ID_AMR_WB);
- else if(subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
- hr = ProcessLPCM();
- else if(subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
- hr = ProcessHdmvLPCM(pIn->IsSyncPoint());
- else if(subtype == MEDIASUBTYPE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
- subtype == MEDIASUBTYPE_DOLBY_TRUEHD)
- hr = ProcessAC3();
- else if(subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS)
- hr = ProcessDTS();
- else if(subtype == MEDIASUBTYPE_AAC || subtype == MEDIASUBTYPE_MP4A || subtype == MEDIASUBTYPE_mp4a)
- hr = ProcessAAC();
- else if(subtype == MEDIASUBTYPE_PS2_PCM)
- hr = ProcessPS2PCM();
- else if(subtype == MEDIASUBTYPE_PS2_ADPCM)
- hr = ProcessPS2ADPCM();
- else if(subtype == MEDIASUBTYPE_Vorbis2)
- hr = ProcessVorbis();
- else if(subtype == MEDIASUBTYPE_FLAC_FRAMED)
- hr = ProcessFlac();
- else if(subtype == MEDIASUBTYPE_NELLYMOSER)
- hr = ProcessFfmpeg(CODEC_ID_NELLYMOSER);
- else // if(.. the rest ..)
- hr = ProcessMPA();
-
- return hr;
+ return m_pOutput->Deliver(pIn);
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pInput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ pmt = NULL;
+ m_sample_max = 0.1f;
+ m_aac_state.init(mt);
+
+ m_vorbis.init(mt);
+ m_DolbyDigitalMode = DD_Unknown;
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+
+ long len = pIn->GetActualDataLength();
+
+ (static_cast<CDeCSSInputPin*>(m_pInput))->StripPacket(pDataIn, len);
+
+ REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
+ hr = pIn->GetTime(&rtStart, &rtStop);
+
+ if(pIn->IsDiscontinuity() == S_OK)
+ {
+ m_fDiscontinuity = true;
+ m_buff.RemoveAll();
+ m_sample_max = 0.1f;
+ // ASSERT(SUCCEEDED(hr)); // what to do if not?
+ if(FAILED(hr)) {TRACE(_T("mpa: disc. w/o timestamp\n")); return S_OK;} // lets wait then...
+ m_rtStart = rtStart;
+ }
+
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ BOOL bNoJitterControl = false;
+ if(subtype == MEDIASUBTYPE_AMR || subtype == MEDIASUBTYPE_SAMR || subtype == MEDIASUBTYPE_SAWB)
+ {
+ //The reason I add this to disable Jitter control for AMR audio stream
+ //is because it seems a lot AMR audio stream haven't report correct output sample rate (my guess)
+ //so if there is jitter control, audio and video will be going very faster than it should (result)
+ //therefor I disable jitter control.
+ //but this is NOT a PERFECT solution. hope more input from other brilliant developers
+ //discuss is welcome -- tomasen@gmail.com
+ bNoJitterControl = true;
+ }
+
+ if(SUCCEEDED(hr) && abs((int)(m_rtStart - rtStart)) > 1000000 && !bNoJitterControl) // +-100ms jitter is allowed for now
+ {
+ m_buff.RemoveAll();
+ m_rtStart = rtStart;
+ }
+
+ int bufflen = m_buff.GetCount();
+ m_buff.SetCount(bufflen + len, 4096);
+ memcpy(m_buff.GetData() + bufflen, pDataIn, len);
+ len += bufflen;
+
+ if(subtype == MEDIASUBTYPE_AMR || subtype == MEDIASUBTYPE_SAMR)
+ hr = ProcessFfmpeg(CODEC_ID_AMR_NB);
+ else if(subtype == MEDIASUBTYPE_SAWB)
+ hr = ProcessFfmpeg(CODEC_ID_AMR_WB);
+ else if(subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ hr = ProcessLPCM();
+ else if(subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
+ hr = ProcessHdmvLPCM(pIn->IsSyncPoint());
+ else if(subtype == MEDIASUBTYPE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
+ subtype == MEDIASUBTYPE_DOLBY_TRUEHD)
+ hr = ProcessAC3();
+ else if(subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS)
+ hr = ProcessDTS();
+ else if(subtype == MEDIASUBTYPE_AAC || subtype == MEDIASUBTYPE_MP4A || subtype == MEDIASUBTYPE_mp4a)
+ hr = ProcessAAC();
+ else if(subtype == MEDIASUBTYPE_PS2_PCM)
+ hr = ProcessPS2PCM();
+ else if(subtype == MEDIASUBTYPE_PS2_ADPCM)
+ hr = ProcessPS2ADPCM();
+ else if(subtype == MEDIASUBTYPE_Vorbis2)
+ hr = ProcessVorbis();
+ else if(subtype == MEDIASUBTYPE_FLAC_FRAMED)
+ hr = ProcessFlac();
+ else if(subtype == MEDIASUBTYPE_NELLYMOSER)
+ hr = ProcessFfmpeg(CODEC_ID_NELLYMOSER);
+ else // if(.. the rest ..)
+ hr = ProcessMPA();
+
+ return hr;
}
HRESULT CMpaDecFilter::ProcessLPCM()
{
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
-
- if(wfein->nChannels < 1 || wfein->nChannels > 8)
- return ERROR_NOT_SUPPORTED;
-
- scmap_t* remap = &m_scmap_default [wfein->nChannels-1];
- int nChannels = wfein->nChannels;
-
- BYTE* pDataIn = m_buff.GetData();
- int BytesPerDoubleSample = (wfein->wBitsPerSample * 2) / 8;
- int BytesPerDoubleChannelSample = BytesPerDoubleSample * nChannels;
- int nInBytes = m_buff.GetCount();
- int len = (nInBytes / BytesPerDoubleChannelSample) * (BytesPerDoubleChannelSample); // We always code 2 samples at a time
-
- CAtlArray<float> pBuff;
- pBuff.SetCount((len / BytesPerDoubleSample) * 2);
-
- float* pDataOut = pBuff.GetData();
-
- switch(wfein->wBitsPerSample)
- {
- case 16 :
- {
- long nSamples = len / (BytesPerDoubleChannelSample);
- int16 Temp[2][8];
- for(int i = 0; i < nSamples; i++)
- {
- for(int j = 0; j < nChannels; j++)
- {
- uint16 All = *((uint16 *)pDataIn);
- pDataIn += 2;
- int16 Part1 = (All & 0xFF) << 8 | (All & 0xFF00) >> 8;
- Temp[0][j] = Part1;
- }
- for(int j = 0; j < nChannels; j++)
- {
- uint16 All = *((uint16 *)pDataIn);
- pDataIn += 2;
- int16 Part1 = (All & 0xFF) << 8 | (All & 0xFF00) >> 8;
- Temp[1][j] = Part1;
- }
-
- for(int j = 0; j < nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = float(Temp[0][nRemap]) / float(SHRT_MAX);
- ++pDataOut;
- }
- for(int j = 0; j < nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = float(Temp[1][nRemap]) / float(SHRT_MAX);
- ++pDataOut;
- }
- }
- }
- break;
-
- case 24 :
- {
- long nSamples = len / (BytesPerDoubleChannelSample);
- int32 Temp[2][8];
- for(int i = 0; i < nSamples; i++)
- {
- // Start by upper 16 bits
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint16 *)pDataIn);
- pDataIn += 2;
- uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
- Temp[0][j] = Part1;
- }
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint16 *)pDataIn);
- pDataIn += 2;
- uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
- Temp[1][j] = Part1;
- }
-
- // Continue with lower bits
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint8 *)pDataIn);
- pDataIn += 1;
- Temp[0][j] = int32(Temp[0][j] | (All << 8)) >> 8;
- }
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint8 *)pDataIn);
- pDataIn += 1;
- Temp[1][j] = int32(Temp[1][j] | (All << 8)) >> 8;
- }
-
- // Convert into float
- for(int j = 0; j < nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = float(Temp[0][nRemap]) / float(1 << 23);
- ++pDataOut;
- }
- for(int j = 0; j < nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = float(Temp[1][nRemap]) / float(1 << 23);
- ++pDataOut;
- }
- }
- }
- break;
- case 20 :
- {
- long nSamples = len / (BytesPerDoubleChannelSample);
- int32 Temp[2][8];
- for(int i = 0; i < nSamples; i++)
- {
- // Start by upper 16 bits
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint16 *)pDataIn);
- pDataIn += 2;
- uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
- Temp[0][j] = Part1;
- }
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint16 *)pDataIn);
- pDataIn += 2;
- uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
- Temp[1][j] = Part1;
- }
-
- // Continue with lower bits
- for(int j = 0; j < nChannels; j++)
- {
- uint32 All = *((uint8 *)pDataIn);
- pDataIn += 1;
- Temp[0][j] = int32(Temp[0][j] | ((All & 0xf0) << 8)) >> 8;
- Temp[1][j] = int32(Temp[1][j] | ((All & 0x0f) << 12)) >> 8;
- }
-
- // Convert into float
- for(int j = 0; j < nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = float(Temp[0][nRemap]) / float(1 << 23);
- ++pDataOut;
- }
- for(int j = 0; j < nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = float(Temp[1][nRemap]) / float(1 << 23);
- ++pDataOut;
- }
- }
- }
- break;
- }
-
- memmove(m_buff.GetData(), pDataIn, m_buff.GetCount() - len);
- m_buff.SetCount(m_buff.GetCount() - len);
-
- return Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels, remap->dwChannelMask);
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+
+ if (wfein->nChannels < 1 || wfein->nChannels > 8)
+ return ERROR_NOT_SUPPORTED;
+
+ scmap_t* remap = &m_scmap_default [wfein->nChannels-1];
+ int nChannels = wfein->nChannels;
+
+ BYTE* pDataIn = m_buff.GetData();
+ int BytesPerDoubleSample = (wfein->wBitsPerSample * 2)/8;
+ int BytesPerDoubleChannelSample = BytesPerDoubleSample * nChannels;
+ int nInBytes = m_buff.GetCount();
+ int len = (nInBytes / BytesPerDoubleChannelSample) * (BytesPerDoubleChannelSample); // We always code 2 samples at a time
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount((len/BytesPerDoubleSample) * 2);
+
+ float* pDataOut = pBuff.GetData();
+
+ switch (wfein->wBitsPerSample)
+ {
+ case 16 :
+ {
+ long nSamples = len/(BytesPerDoubleChannelSample);
+ int16 Temp[2][8];
+ for (int i=0; i<nSamples; i++)
+ {
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint16 All = *((uint16 *)pDataIn);
+ pDataIn += 2;
+ int16 Part1 = (All & 0xFF) << 8 | (All & 0xFF00) >> 8;
+ Temp[0][j] = Part1;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint16 All = *((uint16 *)pDataIn);
+ pDataIn += 2;
+ int16 Part1 = (All & 0xFF) << 8 | (All & 0xFF00) >> 8;
+ Temp[1][j] = Part1;
+ }
+
+ for(int j = 0; j < nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = float(Temp[0][nRemap]) / float(SHRT_MAX);
+ ++pDataOut;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = float(Temp[1][nRemap]) / float(SHRT_MAX);
+ ++pDataOut;
+ }
+ }
+ }
+ break;
+
+ case 24 :
+ {
+ long nSamples = len/(BytesPerDoubleChannelSample);
+ int32 Temp[2][8];
+ for (int i=0; i<nSamples; i++)
+ {
+ // Start by upper 16 bits
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint16 *)pDataIn);
+ pDataIn += 2;
+ uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
+ Temp[0][j] = Part1;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint16 *)pDataIn);
+ pDataIn += 2;
+ uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
+ Temp[1][j] = Part1;
+ }
+
+ // Continue with lower bits
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint8 *)pDataIn);
+ pDataIn += 1;
+ Temp[0][j] = int32(Temp[0][j] | (All << 8)) >> 8;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint8 *)pDataIn);
+ pDataIn += 1;
+ Temp[1][j] = int32(Temp[1][j] | (All << 8)) >> 8;
+ }
+
+ // Convert into float
+ for(int j = 0; j < nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = float(Temp[0][nRemap]) / float(1<<23);
+ ++pDataOut;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = float(Temp[1][nRemap]) / float(1<<23);
+ ++pDataOut;
+ }
+ }
+ }
+ break;
+ case 20 :
+ {
+ long nSamples = len/(BytesPerDoubleChannelSample);
+ int32 Temp[2][8];
+ for (int i=0; i<nSamples; i++)
+ {
+ // Start by upper 16 bits
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint16 *)pDataIn);
+ pDataIn += 2;
+ uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
+ Temp[0][j] = Part1;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint16 *)pDataIn);
+ pDataIn += 2;
+ uint32 Part1 = (All & 0xFF) << 24 | (All & 0xFF00) << 8;
+ Temp[1][j] = Part1;
+ }
+
+ // Continue with lower bits
+ for(int j = 0; j < nChannels; j++)
+ {
+ uint32 All = *((uint8 *)pDataIn);
+ pDataIn += 1;
+ Temp[0][j] = int32(Temp[0][j] | ((All&0xf0) << 8)) >> 8;
+ Temp[1][j] = int32(Temp[1][j] | ((All&0x0f) << 12)) >> 8;
+ }
+
+ // Convert into float
+ for(int j = 0; j < nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = float(Temp[0][nRemap]) / float(1<<23);
+ ++pDataOut;
+ }
+ for(int j = 0; j < nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = float(Temp[1][nRemap]) / float(1<<23);
+ ++pDataOut;
+ }
+ }
+ }
+ break;
+ }
+
+ memmove(m_buff.GetData(), pDataIn, m_buff.GetCount() - len );
+ m_buff.SetCount(m_buff.GetCount() - len);
+
+ return Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels, remap->dwChannelMask);
}
HRESULT CMpaDecFilter::ProcessHdmvLPCM(bool bAlignOldBuffer) // Blu ray LPCM
{
- WAVEFORMATEX_HDMV_LPCM* wfein = (WAVEFORMATEX_HDMV_LPCM*)m_pInput->CurrentMediaType().Format();
-
- BYTE* pDataIn = m_buff.GetData();
- int BytesPerChannelSample = (((wfein->wBitsPerSample + 7) & (~7))) / 8;
- int BytesPerSample = wfein->nChannels * BytesPerChannelSample; // Beliyaal: Old calculation only worked if nChannel*bytespersample is power of 2
- int oldlen = m_buff.GetCount();
- int len = (oldlen / BytesPerSample) * BytesPerSample;
- if(bAlignOldBuffer)
- {
- m_buff.SetCount(len);
- }
- scmap_t* remap = &s_scmap_hdmv [wfein->channel_conf];
-
- CAtlArray<float> pBuff;
- pBuff.SetCount(len / BytesPerChannelSample);
-
- float* pDataOut = pBuff.GetData();
-
- switch(wfein->wBitsPerSample)
- {
- case 16 :
- for(int i = 0; i < len / wfein->nChannels / 2; i++)
- {
- for(int j = 0; j < wfein->nChannels; j++)
- {
- int nRemap = remap->ch[j];
- *pDataOut = (float)(short)((pDataIn[nRemap*2] << 8) | pDataIn[nRemap*2+1]) / SHRT_MAX;
- pDataOut++;
- }
- pDataIn += wfein->nChannels * 2;
- }
- break;
-
- case 24 :
- case 20 :
- long lSample;
-
- for(int i = 0; i < len / wfein->nChannels / 3; i++)
- {
- for(int j = 0; j < wfein->nChannels; j++)
- {
- BYTE nRemap = remap->ch[j];
-
- lSample = (long)pDataIn[nRemap*3] << 24 | (long)pDataIn[nRemap*3+1] << 16 | (long)pDataIn[nRemap*3+2] << 8;
- *pDataOut = (float)(long)lSample / 0x80000000;
-
- pDataOut++;
- }
- pDataIn += wfein->nChannels * 3;
- }
- break;
- }
-
- memmove(m_buff.GetData(), pDataIn, m_buff.GetCount() - len);
- m_buff.SetCount(m_buff.GetCount() - len);
-
- return Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels, remap->dwChannelMask);
+ WAVEFORMATEX_HDMV_LPCM* wfein = (WAVEFORMATEX_HDMV_LPCM*)m_pInput->CurrentMediaType().Format();
+
+ BYTE* pDataIn = m_buff.GetData();
+ int BytesPerChannelSample = (((wfein->wBitsPerSample + 7)&(~7))) / 8;
+ int BytesPerSample = wfein->nChannels*BytesPerChannelSample; // Beliyaal: Old calculation only worked if nChannel*bytespersample is power of 2
+ int oldlen = m_buff.GetCount();
+ int len = (oldlen / BytesPerSample) * BytesPerSample;
+ if (bAlignOldBuffer)
+ {
+ m_buff.SetCount(len);
+ }
+ scmap_t* remap = &s_scmap_hdmv [wfein->channel_conf];
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(len/BytesPerChannelSample);
+
+ float* pDataOut = pBuff.GetData();
+
+ switch (wfein->wBitsPerSample)
+ {
+ case 16 :
+ for (int i=0; i<len/wfein->nChannels/2; i++)
+ {
+ for(int j = 0; j < wfein->nChannels; j++)
+ {
+ int nRemap = remap->ch[j];
+ *pDataOut = (float)(short)((pDataIn[nRemap*2]<<8)|pDataIn[nRemap*2+1]) / SHRT_MAX;
+ pDataOut++;
+ }
+ pDataIn += wfein->nChannels*2;
+ }
+ break;
+
+ case 24 :
+ case 20 :
+ long lSample;
+
+ for (int i=0; i<len/wfein->nChannels/3; i++)
+ {
+ for(int j = 0; j < wfein->nChannels; j++)
+ {
+ BYTE nRemap = remap->ch[j];
+
+ lSample = (long)pDataIn[nRemap*3]<<24 | (long)pDataIn[nRemap*3+1]<<16 | (long)pDataIn[nRemap*3+2]<<8;
+ *pDataOut = (float)(long)lSample / 0x80000000;
+
+ pDataOut++;
+ }
+ pDataIn += wfein->nChannels*3;
+ }
+ break;
+ }
+
+ memmove(m_buff.GetData(), pDataIn, m_buff.GetCount() - len );
+ m_buff.SetCount(m_buff.GetCount() - len);
+
+ return Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels, remap->dwChannelMask);
}
HRESULT CMpaDecFilter::ProcessA52(BYTE* p, int buffsize, int& size, bool& fEnoughData)
{
- int flags, sample_rate, bit_rate;
+ int flags, sample_rate, bit_rate;
- if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0)
- {
+ if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0)
+ {
// TRACE(_T("ac3: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d\n"), size, flags, sample_rate, bit_rate);
- fEnoughData = size <= buffsize;
+ fEnoughData = size <= buffsize;
- if(fEnoughData)
- {
- int iSpeakerConfig = GetSpeakerConfig(ac3);
+ if(fEnoughData)
+ {
+ int iSpeakerConfig = GetSpeakerConfig(ac3);
- if(iSpeakerConfig < 0)
- {
- HRESULT hr;
- if(S_OK != (hr = Deliver(p, size, bit_rate, 0x0001)))
- return hr;
- }
- else
- {
- flags = iSpeakerConfig & (A52_CHANNEL_MASK | A52_LFE);
- flags |= A52_ADJUST_LEVEL;
+ if(iSpeakerConfig < 0)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(p, size, bit_rate, 0x0001)))
+ return hr;
+ }
+ else
+ {
+ flags = iSpeakerConfig&(A52_CHANNEL_MASK|A52_LFE);
+ flags |= A52_ADJUST_LEVEL;
- sample_t level = 1, gain = 1, bias = 0;
- level *= gain;
+ sample_t level = 1, gain = 1, bias = 0;
+ level *= gain;
- if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0)
- {
- if(GetDynamicRangeControl(ac3))
- a52_dynrng(m_a52_state, NULL, NULL);
+ if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0)
+ {
+ if(GetDynamicRangeControl(ac3))
+ a52_dynrng(m_a52_state, NULL, NULL);
- int scmapidx = min(flags & A52_CHANNEL_MASK, countof(s_scmap_ac3) / 2);
+ int scmapidx = min(flags&A52_CHANNEL_MASK, countof(s_scmap_ac3)/2);
scmap_t& scmap = s_scmap_ac3[scmapidx + ((flags&A52_LFE)?(countof(s_scmap_ac3)/2):0)];
- CAtlArray<float> pBuff;
- pBuff.SetCount(6 * 256 * scmap.nChannels);
- float* p = pBuff.GetData();
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(6*256*scmap.nChannels);
+ float* p = pBuff.GetData();
- int i = 0;
+ int i = 0;
- for(; i < 6 && a52_block(m_a52_state) == 0; i++)
- {
- sample_t* samples = a52_samples(m_a52_state);
+ for(; i < 6 && a52_block(m_a52_state) == 0; i++)
+ {
+ sample_t* samples = a52_samples(m_a52_state);
- for(int j = 0; j < 256; j++, samples++)
- {
- for(int ch = 0; ch < scmap.nChannels; ch++)
- {
- ASSERT(scmap.ch[ch] != -1);
- *p++ = (float)(*(samples + 256 * scmap.ch[ch]) / level);
- }
- }
- }
+ for(int j = 0; j < 256; j++, samples++)
+ {
+ for(int ch = 0; ch < scmap.nChannels; ch++)
+ {
+ ASSERT(scmap.ch[ch] != -1);
+ *p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
+ }
+ }
+ }
- if(i == 6)
- {
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
- return hr;
- }
- }
- }
- }
- }
+ if(i == 6)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
+ return hr;
+ }
+ }
+ }
+ }
+ }
- return S_OK;
+ return S_OK;
}
#if 0 // Old AC3 ! (to remove later...)
HRESULT CMpaDecFilter::ProcessAC3()
{
- BYTE* p = m_buff.GetData();
- BYTE* base = p;
- BYTE* end = p + m_buff.GetCount();
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
- while(end - p >= 7)
- {
- int size = 0, flags, sample_rate, bit_rate;
+ while(end - p >= 7)
+ {
+ int size = 0, flags, sample_rate, bit_rate;
- if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0)
- {
+ if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0)
+ {
// TRACE(_T("ac3: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d\n"), size, flags, sample_rate, bit_rate);
- bool fEnoughData = p + size <= end;
+ bool fEnoughData = p + size <= end;
- if(fEnoughData)
- {
- int iSpeakerConfig = GetSpeakerConfig(ac3);
+ if(fEnoughData)
+ {
+ int iSpeakerConfig = GetSpeakerConfig(ac3);
- if(iSpeakerConfig < 0)
- {
- HRESULT hr;
- if(S_OK != (hr = Deliver(p, size, bit_rate, 0x0001)))
- return hr;
- }
- else
- {
- flags = iSpeakerConfig & (A52_CHANNEL_MASK | A52_LFE);
- flags |= A52_ADJUST_LEVEL;
+ if(iSpeakerConfig < 0)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(p, size, bit_rate, 0x0001)))
+ return hr;
+ }
+ else
+ {
+ flags = iSpeakerConfig&(A52_CHANNEL_MASK|A52_LFE);
+ flags |= A52_ADJUST_LEVEL;
- sample_t level = 1, gain = 1, bias = 0;
- level *= gain;
+ sample_t level = 1, gain = 1, bias = 0;
+ level *= gain;
- if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0)
- {
- if(GetDynamicRangeControl(ac3))
- a52_dynrng(m_a52_state, NULL, NULL);
+ if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0)
+ {
+ if(GetDynamicRangeControl(ac3))
+ a52_dynrng(m_a52_state, NULL, NULL);
- int scmapidx = min(flags & A52_CHANNEL_MASK, countof(s_scmap_ac3) / 2);
+ int scmapidx = min(flags&A52_CHANNEL_MASK, countof(s_scmap_ac3)/2);
scmap_t& scmap = s_scmap_ac3[scmapidx + ((flags&A52_LFE)?(countof(s_scmap_ac3)/2):0)];
- CAtlArray<float> pBuff;
- pBuff.SetCount(6 * 256 * scmap.nChannels);
- float* p = pBuff.GetData();
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(6*256*scmap.nChannels);
+ float* p = pBuff.GetData();
- int i = 0;
+ int i = 0;
- for(; i < 6 && a52_block(m_a52_state) == 0; i++)
- {
- sample_t* samples = a52_samples(m_a52_state);
+ for(; i < 6 && a52_block(m_a52_state) == 0; i++)
+ {
+ sample_t* samples = a52_samples(m_a52_state);
- for(int j = 0; j < 256; j++, samples++)
- {
- for(int ch = 0; ch < scmap.nChannels; ch++)
- {
- ASSERT(scmap.ch[ch] != -1);
- *p++ = (float)(*(samples + 256 * scmap.ch[ch]) / level);
- }
- }
- }
+ for(int j = 0; j < 256; j++, samples++)
+ {
+ for(int ch = 0; ch < scmap.nChannels; ch++)
+ {
+ ASSERT(scmap.ch[ch] != -1);
+ *p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
+ }
+ }
+ }
- if(i == 6)
- {
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
- return hr;
- }
- }
- }
+ if(i == 6)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
+ return hr;
+ }
+ }
+ }
- p += size;
- }
+ p += size;
+ }
- memmove(base, p, end - p);
- end = base + (end - p);
- p = base;
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
- if(!fEnoughData)
- break;
- }
- else
- {
- p++;
- }
- }
+ if(!fEnoughData)
+ break;
+ }
+ else
+ {
+ p++;
+ }
+ }
- m_buff.SetCount(end - p);
+ m_buff.SetCount(end - p);
- return S_OK;
+ return S_OK;
}
#else
HRESULT CMpaDecFilter::ProcessAC3()
{
- HRESULT hr;
- BYTE* p = m_buff.GetData();
- BYTE* base = p;
- BYTE* end = p + m_buff.GetCount();
-
- while(end - p >= AC3_HEADER_SIZE)
- {
- int size = 0;
- bool fEnoughData = true;
-
- if(m_DolbyDigitalMode != DD_TRUEHD && m_DolbyDigitalMode != DD_MLP && (*((__int16*)p) == 0x770b)) /* AC3-EAC3 syncword */
- {
- BYTE bsid = p[5] >> 3;
- if((m_DolbyDigitalMode != DD_EAC3) && bsid <= 12)
- {
- m_DolbyDigitalMode = DD_AC3;
- if(FAILED(hr = ProcessA52(p, end - p, size, fEnoughData))) return hr;
- }
- else if(bsid <= 16)
- {
- DeliverFfmpeg(CODEC_ID_EAC3, p, end - p, size);
- if(size > 0)
- m_DolbyDigitalMode = DD_EAC3;
- }
- else
- {
- p++;
- continue;
- }
- }
- else if((*((__int32*)(p + 4)) == 0xba6f72f8) || // True HD major sync frame
- m_DolbyDigitalMode == DD_TRUEHD)
- {
- int nMLPLength = 0;
- int nMLPChunk;
- int nLenght = (((p[0] << 8) + p[1]) & 0x0FFF) * 2;
-
- m_DolbyDigitalMode = DD_TRUEHD;
-
- if(nLenght >= 4)
- {
- DeliverFfmpeg(CODEC_ID_TRUEHD, p, end - p, size);
- if(size < 0) size = end - p;
- }
- }
- else if((*((__int32*)(p + 4)) == 0xbb6f72f8) ||
- m_DolbyDigitalMode == DD_MLP) // MLP
- {
- int nMLPLength = 0;
- int nMLPChunk;
- int nLenght = (((p[0] << 8) + p[1]) & 0x0FFF) * 2;
-
- m_DolbyDigitalMode = DD_MLP;
-
- if(nLenght >= 4)
- {
- DeliverFfmpeg(CODEC_ID_MLP, p, end - p, size);
- if(size < 0) size = end - p;
- }
- }
- else
- {
- p++;
- continue;
- }
-
-
- // Update buffer position
- if(fEnoughData)
- {
- ASSERT(size <= end - p);
- if(size <= 0) break;
- p += size;
- }
- memmove(base, p, end - p);
- end = base + (end - p);
- p = base;
- if(!fEnoughData)
- break;
- }
-
- m_buff.SetCount(end - p);
-
- return S_OK;
+ HRESULT hr;
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ while(end - p >= AC3_HEADER_SIZE)
+ {
+ int size = 0;
+ bool fEnoughData = true;
+
+ if (m_DolbyDigitalMode != DD_TRUEHD && m_DolbyDigitalMode != DD_MLP && (*((__int16*)p) == 0x770b)) /* AC3-EAC3 syncword */
+ {
+ BYTE bsid = p[5] >> 3;
+ if ((m_DolbyDigitalMode != DD_EAC3) && bsid <= 12)
+ {
+ m_DolbyDigitalMode = DD_AC3;
+ if (FAILED (hr = ProcessA52 (p, end-p, size, fEnoughData))) return hr;
+ }
+ else if (bsid <= 16)
+ {
+ DeliverFfmpeg(CODEC_ID_EAC3, p, end-p, size);
+ if (size > 0)
+ m_DolbyDigitalMode = DD_EAC3;
+ }
+ else
+ {
+ p++;
+ continue;
+ }
+ }
+ else if ( (*((__int32*)(p+4)) == 0xba6f72f8) || // True HD major sync frame
+ m_DolbyDigitalMode == DD_TRUEHD )
+ {
+ int nMLPLength=0;
+ int nMLPChunk;
+ int nLenght = (((p[0]<<8) + p[1]) & 0x0FFF)*2;
+
+ m_DolbyDigitalMode = DD_TRUEHD;
+
+ if (nLenght >= 4)
+ {
+ DeliverFfmpeg(CODEC_ID_TRUEHD, p, end-p, size);
+ if (size<0) size = end-p;
+ }
+ }
+ else if ( (*((__int32*)(p+4)) == 0xbb6f72f8) ||
+ m_DolbyDigitalMode == DD_MLP ) // MLP
+ {
+ int nMLPLength=0;
+ int nMLPChunk;
+ int nLenght = (((p[0]<<8) + p[1]) & 0x0FFF)*2;
+
+ m_DolbyDigitalMode = DD_MLP;
+
+ if (nLenght >= 4)
+ {
+ DeliverFfmpeg(CODEC_ID_MLP, p, end-p, size);
+ if (size<0) size = end-p;
+ }
+ }
+ else
+ {
+ p++;
+ continue;
+ }
+
+
+ // Update buffer position
+ if (fEnoughData)
+ {
+ ASSERT (size <= end-p);
+ if (size <= 0) break;
+ p += size;
+ }
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+ if(!fEnoughData)
+ break;
+ }
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
}
#endif
HRESULT CMpaDecFilter::ProcessFfmpeg(int nCodecId)
{
- HRESULT hr;
- BYTE* p = m_buff.GetData();
- BYTE* base = p;
- BYTE* end = p + m_buff.GetCount();
+ HRESULT hr;
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
- int size = 0;
- hr = DeliverFfmpeg(nCodecId, p, end - p, size);
- if(size <= 0) return S_OK;
- p += size;
- memmove(base, p, end - p);
- end = base + (end - p);
- p = base;
- m_buff.SetCount(end - p);
+ int size = 0;
+ hr = DeliverFfmpeg(nCodecId, p, end-p, size);
+ if (size <= 0) return S_OK;
+ p += size;
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+ m_buff.SetCount(end - p);
- return hr;
+ return hr;
}
HRESULT CMpaDecFilter::ProcessDTS()
{
- BYTE* p = m_buff.GetData();
- BYTE* base = p;
- BYTE* end = p + m_buff.GetCount();
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
- while(end - p >= 14)
- {
- int size = 0, flags, sample_rate, bit_rate, frame_length;
+ while(end - p >= 14)
+ {
+ int size = 0, flags, sample_rate, bit_rate, frame_length;
- if((size = dts_syncinfo(m_dts_state, p, &flags, &sample_rate, &bit_rate, &frame_length)) > 0)
- {
+ if((size = dts_syncinfo(m_dts_state, p, &flags, &sample_rate, &bit_rate, &frame_length)) > 0)
+ {
// TRACE(_T("dts: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d, frame_length=%d\n"), size, flags, sample_rate, bit_rate, frame_length);
- bool fEnoughData = p + size <= end;
+ bool fEnoughData = p + size <= end;
- if(fEnoughData)
- {
- int iSpeakerConfig = GetSpeakerConfig(dts);
+ if(fEnoughData)
+ {
+ int iSpeakerConfig = GetSpeakerConfig(dts);
- if(iSpeakerConfig < 0)
- {
- HRESULT hr;
- if(S_OK != (hr = Deliver(p, size, bit_rate, 0x000b)))
- return hr;
- }
- else
- {
- flags = iSpeakerConfig & (DTS_CHANNEL_MASK | DTS_LFE);
- flags |= DTS_ADJUST_LEVEL;
+ if(iSpeakerConfig < 0)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(p, size, bit_rate, 0x000b)))
+ return hr;
+ }
+ else
+ {
+ flags = iSpeakerConfig&(DTS_CHANNEL_MASK|DTS_LFE);
+ flags |= DTS_ADJUST_LEVEL;
- sample_t level = 1, gain = 1, bias = 0;
- level *= gain;
+ sample_t level = 1, gain = 1, bias = 0;
+ level *= gain;
- if(dts_frame(m_dts_state, p, &flags, &level, bias) == 0)
- {
- if(GetDynamicRangeControl(dts))
- dts_dynrng(m_dts_state, NULL, NULL);
+ if(dts_frame(m_dts_state, p, &flags, &level, bias) == 0)
+ {
+ if(GetDynamicRangeControl(dts))
+ dts_dynrng(m_dts_state, NULL, NULL);
- int scmapidx = min(flags & DTS_CHANNEL_MASK, countof(s_scmap_dts) / 2);
+ int scmapidx = min(flags&DTS_CHANNEL_MASK, countof(s_scmap_dts)/2);
scmap_t& scmap = s_scmap_dts[scmapidx + ((flags&DTS_LFE)?(countof(s_scmap_dts)/2):0)];
- int blocks = dts_blocks_num(m_dts_state);
+ int blocks = dts_blocks_num(m_dts_state);
- CAtlArray<float> pBuff;
- pBuff.SetCount(blocks * 256 * scmap.nChannels);
- float* p = pBuff.GetData();
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(blocks*256*scmap.nChannels);
+ float* p = pBuff.GetData();
- int i = 0;
+ int i = 0;
- for(; i < blocks && dts_block(m_dts_state) == 0; i++)
- {
- sample_t* samples = dts_samples(m_dts_state);
+ for(; i < blocks && dts_block(m_dts_state) == 0; i++)
+ {
+ sample_t* samples = dts_samples(m_dts_state);
- for(int j = 0; j < 256; j++, samples++)
- {
- for(int ch = 0; ch < scmap.nChannels; ch++)
- {
- ASSERT(scmap.ch[ch] != -1);
- *p++ = (float)(*(samples + 256 * scmap.ch[ch]) / level);
- }
- }
- }
+ for(int j = 0; j < 256; j++, samples++)
+ {
+ for(int ch = 0; ch < scmap.nChannels; ch++)
+ {
+ ASSERT(scmap.ch[ch] != -1);
+ *p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
+ }
+ }
+ }
- if(i == blocks)
- {
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
- return hr;
- }
- }
- }
+ if(i == blocks)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
+ return hr;
+ }
+ }
+ }
- p += size;
- }
+ p += size;
+ }
- memmove(base, p, end - p);
- end = base + (end - p);
- p = base;
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
- if(!fEnoughData)
- break;
- }
- else
- {
- p++;
- }
- }
+ if(!fEnoughData)
+ break;
+ }
+ else
+ {
+ p++;
+ }
+ }
- m_buff.SetCount(end - p);
+ m_buff.SetCount(end - p);
- return S_OK;
+ return S_OK;
}
HRESULT CMpaDecFilter::ProcessAAC()
{
- int iSpeakerConfig = GetSpeakerConfig(aac);
-
- NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(m_aac_state.h);
- c->downMatrix = iSpeakerConfig;
- NeAACDecSetConfiguration(m_aac_state.h, c);
-
- NeAACDecFrameInfo info;
- float* src = (float*)NeAACDecDecode(m_aac_state.h, &info, m_buff.GetData(), m_buff.GetCount());
- m_buff.RemoveAll();
- //if(!src) return E_FAIL;
- if(info.error) m_aac_state.init(m_pInput->CurrentMediaType());
- if(!src || info.samples == 0) return S_OK;
-
- // HACK: bug in faad2 with mono sources?
- if(info.channels == 2 && info.channel_position[1] == UNKNOWN_CHANNEL)
- {
- info.channel_position[0] = FRONT_CHANNEL_LEFT;
- info.channel_position[1] = FRONT_CHANNEL_RIGHT;
- }
-
- CAtlArray<float> pBuff;
- pBuff.SetCount(info.samples);
- float* dst = pBuff.GetData();
-
- CAtlMap<int, int> chmask;
- chmask[FRONT_CHANNEL_CENTER] = SPEAKER_FRONT_CENTER;
- chmask[FRONT_CHANNEL_LEFT] = SPEAKER_FRONT_LEFT;
- chmask[FRONT_CHANNEL_RIGHT] = SPEAKER_FRONT_RIGHT;
- chmask[SIDE_CHANNEL_LEFT] = SPEAKER_SIDE_LEFT;
- chmask[SIDE_CHANNEL_RIGHT] = SPEAKER_SIDE_RIGHT;
- chmask[BACK_CHANNEL_LEFT] = SPEAKER_BACK_LEFT;
- chmask[BACK_CHANNEL_RIGHT] = SPEAKER_BACK_RIGHT;
- chmask[BACK_CHANNEL_CENTER] = SPEAKER_BACK_CENTER;
- chmask[LFE_CHANNEL] = SPEAKER_LOW_FREQUENCY;
-
- DWORD dwChannelMask = 0;
- for(int i = 0; i < info.channels; i++)
- {
- if(info.channel_position[i] == UNKNOWN_CHANNEL)
- {
- ASSERT(0);
- return E_FAIL;
- }
- dwChannelMask |= chmask[info.channel_position[i]];
- }
-
- int chmap[countof(info.channel_position)];
- memset(chmap, 0, sizeof(chmap));
-
- for(int i = 0; i < info.channels; i++)
- {
- unsigned int ch = 0, mask = chmask[info.channel_position[i]];
-
- for(int j = 0; j < 32; j++)
- {
- if(dwChannelMask & (1 << j))
- {
- if((1 << j) == mask)
- {
- chmap[i] = ch;
- break;
- }
- ch++;
- }
- }
- }
-
- if(info.channels <= 2) dwChannelMask = 0;
-
- for(int j = 0; j < info.samples; j += info.channels, dst += info.channels)
- for(int i = 0; i < info.channels; i++)
- dst[chmap[i]] = *src++;
-
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, info.samplerate, info.channels, dwChannelMask)))
- return hr;
-
- return S_OK;
+ int iSpeakerConfig = GetSpeakerConfig(aac);
+
+ NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(m_aac_state.h);
+ c->downMatrix = iSpeakerConfig;
+ NeAACDecSetConfiguration(m_aac_state.h, c);
+
+ NeAACDecFrameInfo info;
+ float* src = (float*)NeAACDecDecode(m_aac_state.h, &info, m_buff.GetData(), m_buff.GetCount());
+ m_buff.RemoveAll();
+ //if(!src) return E_FAIL;
+ if(info.error) m_aac_state.init(m_pInput->CurrentMediaType());
+ if(!src || info.samples == 0) return S_OK;
+
+ // HACK: bug in faad2 with mono sources?
+ if(info.channels == 2 && info.channel_position[1] == UNKNOWN_CHANNEL)
+ {
+ info.channel_position[0] = FRONT_CHANNEL_LEFT;
+ info.channel_position[1] = FRONT_CHANNEL_RIGHT;
+ }
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(info.samples);
+ float* dst = pBuff.GetData();
+
+ CAtlMap<int, int> chmask;
+ chmask[FRONT_CHANNEL_CENTER] = SPEAKER_FRONT_CENTER;
+ chmask[FRONT_CHANNEL_LEFT] = SPEAKER_FRONT_LEFT;
+ chmask[FRONT_CHANNEL_RIGHT] = SPEAKER_FRONT_RIGHT;
+ chmask[SIDE_CHANNEL_LEFT] = SPEAKER_SIDE_LEFT;
+ chmask[SIDE_CHANNEL_RIGHT] = SPEAKER_SIDE_RIGHT;
+ chmask[BACK_CHANNEL_LEFT] = SPEAKER_BACK_LEFT;
+ chmask[BACK_CHANNEL_RIGHT] = SPEAKER_BACK_RIGHT;
+ chmask[BACK_CHANNEL_CENTER] = SPEAKER_BACK_CENTER;
+ chmask[LFE_CHANNEL] = SPEAKER_LOW_FREQUENCY;
+
+ DWORD dwChannelMask = 0;
+ for(int i = 0; i < info.channels; i++)
+ {
+ if(info.channel_position[i] == UNKNOWN_CHANNEL) {ASSERT(0); return E_FAIL;}
+ dwChannelMask |= chmask[info.channel_position[i]];
+ }
+
+ int chmap[countof(info.channel_position)];
+ memset(chmap, 0, sizeof(chmap));
+
+ for(int i = 0; i < info.channels; i++)
+ {
+ unsigned int ch = 0, mask = chmask[info.channel_position[i]];
+
+ for(int j = 0; j < 32; j++)
+ {
+ if(dwChannelMask & (1 << j))
+ {
+ if((1 << j) == mask) {chmap[i] = ch; break;}
+ ch++;
+ }
+ }
+ }
+
+ if(info.channels <= 2) dwChannelMask = 0;
+
+ for(int j = 0; j < info.samples; j += info.channels, dst += info.channels)
+ for(int i = 0; i < info.channels; i++)
+ dst[chmap[i]] = *src++;
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, info.samplerate, info.channels, dwChannelMask)))
+ return hr;
+
+ return S_OK;
}
HRESULT CMpaDecFilter::ProcessPS2PCM()
{
- BYTE* p = m_buff.GetData();
- BYTE* base = p;
- BYTE* end = p + m_buff.GetCount();
-
- WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)m_pInput->CurrentMediaType().Format();
- int size = wfe->dwInterleave * wfe->nChannels;
- int samples = wfe->dwInterleave / (wfe->wBitsPerSample >> 3);
- int channels = wfe->nChannels;
-
- CAtlArray<float> pBuff;
- pBuff.SetCount(samples * channels);
- float* f = pBuff.GetData();
-
- while(end - p >= size)
- {
- DWORD* dw = (DWORD*)p;
-
- if(dw[0] == 'dhSS')
- {
- p += dw[1] + 8;
- }
- else if(dw[0] == 'dbSS')
- {
- p += 8;
- m_ps2_state.sync = true;
- }
- else
- {
- if(m_ps2_state.sync)
- {
- short* s = (short*)p;
-
- for(int i = 0; i < samples; i++)
- for(int j = 0; j < channels; j++)
- f[i*channels+j] = (float)s[j*samples+i] / 32768;
- }
- else
- {
- for(int i = 0, j = samples * channels; i < j; i++)
- f[i] = 0;
- }
-
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels)))
- return hr;
-
- p += size;
-
- memmove(base, p, end - p);
- end = base + (end - p);
- p = base;
- }
- }
-
- m_buff.SetCount(end - p);
-
- return S_OK;
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)m_pInput->CurrentMediaType().Format();
+ int size = wfe->dwInterleave*wfe->nChannels;
+ int samples = wfe->dwInterleave/(wfe->wBitsPerSample>>3);
+ int channels = wfe->nChannels;
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(samples*channels);
+ float* f = pBuff.GetData();
+
+ while(end - p >= size)
+ {
+ DWORD* dw = (DWORD*)p;
+
+ if(dw[0] == 'dhSS')
+ {
+ p += dw[1] + 8;
+ }
+ else if(dw[0] == 'dbSS')
+ {
+ p += 8;
+ m_ps2_state.sync = true;
+ }
+ else
+ {
+ if(m_ps2_state.sync)
+ {
+ short* s = (short*)p;
+
+ for(int i = 0; i < samples; i++)
+ for(int j = 0; j < channels; j++)
+ f[i*channels+j] = (float)s[j*samples+i] / 32768;
+ }
+ else
+ {
+ for(int i = 0, j = samples*channels; i < j; i++)
+ f[i] = 0;
+ }
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels)))
+ return hr;
+
+ p += size;
+
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+ }
+ }
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
}
static void decodeps2adpcm(ps2_state_t& s, int channel, BYTE* pin, double* pout)
{
- int tbl_index = pin[0] >> 4;
- int shift = pin[0] & 0xf;
+ int tbl_index = pin[0]>>4;
+ int shift = pin[0]&0xf;
int unk = pin[1]; // ?
- if(tbl_index >= 10)
- {
- ASSERT(0);
- return;
- }
- // if(unk == 7) {ASSERT(0); return;} // ???
+ if(tbl_index >= 10) {ASSERT(0); return;}
+ // if(unk == 7) {ASSERT(0); return;} // ???
- static double s_tbl[] =
- {
- 0.0, 0.0, 0.9375, 0.0, 1.796875, -0.8125, 1.53125, -0.859375, 1.90625, -0.9375,
- 0.0, 0.0, -0.9375, 0.0, -1.796875, 0.8125, -1.53125, 0.859375 - 1.90625, 0.9375
- };
+ static double s_tbl[] =
+ {
+ 0.0, 0.0, 0.9375, 0.0, 1.796875, -0.8125, 1.53125, -0.859375, 1.90625, -0.9375,
+ 0.0, 0.0, -0.9375, 0.0, -1.796875, 0.8125, -1.53125, 0.859375 -1.90625, 0.9375
+ };
- double* tbl = &s_tbl[tbl_index*2];
- double& a = s.a[channel];
- double& b = s.b[channel];
+ double* tbl = &s_tbl[tbl_index*2];
+ double& a = s.a[channel];
+ double& b = s.b[channel];
- for(int i = 0; i < 28; i++)
- {
- short input = (short)(((pin[2+i/2] >> ((i & 1) << 2)) & 0xf) << 12) >> shift;
- double output = a * tbl[1] + b * tbl[0] + input;
+ for(int i = 0; i < 28; i++)
+ {
+ short input = (short)(((pin[2+i/2] >> ((i&1) << 2)) & 0xf) << 12) >> shift;
+ double output = a * tbl[1] + b * tbl[0] + input;
- a = b;
- b = output;
+ a = b;
+ b = output;
- *pout++ = output / SHRT_MAX;
- }
+ *pout++ = output / SHRT_MAX;
+ }
}
HRESULT CMpaDecFilter::ProcessPS2ADPCM()
{
- BYTE* p = m_buff.GetData();
- BYTE* base = p;
- BYTE* end = p + m_buff.GetCount();
-
- WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)m_pInput->CurrentMediaType().Format();
- int size = wfe->dwInterleave * wfe->nChannels;
- int samples = wfe->dwInterleave * 14 / 16 * 2;
- int channels = wfe->nChannels;
-
- CAtlArray<float> pBuff;
- pBuff.SetCount(samples * channels);
- float* f = pBuff.GetData();
-
- while(end - p >= size)
- {
- DWORD* dw = (DWORD*)p;
-
- if(dw[0] == 'dhSS')
- {
- p += dw[1] + 8;
- }
- else if(dw[0] == 'dbSS')
- {
- p += 8;
- m_ps2_state.sync = true;
- }
- else
- {
- if(m_ps2_state.sync)
- {
- double* tmp = DNew double[samples*channels];
-
- for(int channel = 0, j = 0, k = 0; channel < channels; channel++, j += wfe->dwInterleave)
- for(int i = 0; i < wfe->dwInterleave; i += 16, k += 28)
- decodeps2adpcm(m_ps2_state, channel, p + i + j, tmp + k);
-
- for(int i = 0, k = 0; i < samples; i++)
- for(int j = 0; j < channels; j++, k++)
- f[k] = (float)tmp[j*samples+i];
-
- delete [] tmp;
- }
- else
- {
- for(int i = 0, j = samples * channels; i < j; i++)
- f[i] = 0;
- }
-
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels)))
- return hr;
-
- p += size;
- }
- }
-
- memmove(base, p, end - p);
- end = base + (end - p);
- p = base;
-
- m_buff.SetCount(end - p);
-
- return S_OK;
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)m_pInput->CurrentMediaType().Format();
+ int size = wfe->dwInterleave*wfe->nChannels;
+ int samples = wfe->dwInterleave * 14 / 16 * 2;
+ int channels = wfe->nChannels;
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(samples*channels);
+ float* f = pBuff.GetData();
+
+ while(end - p >= size)
+ {
+ DWORD* dw = (DWORD*)p;
+
+ if(dw[0] == 'dhSS')
+ {
+ p += dw[1] + 8;
+ }
+ else if(dw[0] == 'dbSS')
+ {
+ p += 8;
+ m_ps2_state.sync = true;
+ }
+ else
+ {
+ if(m_ps2_state.sync)
+ {
+ double* tmp = DNew double[samples*channels];
+
+ for(int channel = 0, j = 0, k = 0; channel < channels; channel++, j += wfe->dwInterleave)
+ for(int i = 0; i < wfe->dwInterleave; i += 16, k += 28)
+ decodeps2adpcm(m_ps2_state, channel, p + i + j, tmp + k);
+
+ for(int i = 0, k = 0; i < samples; i++)
+ for(int j = 0; j < channels; j++, k++)
+ f[k] = (float)tmp[j*samples+i];
+
+ delete [] tmp;
+ }
+ else
+ {
+ for(int i = 0, j = samples*channels; i < j; i++)
+ f[i] = 0;
+ }
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels)))
+ return hr;
+
+ p += size;
+ }
+ }
+
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
}
HRESULT CMpaDecFilter::ProcessVorbis()
{
- if(m_vorbis.vi.channels < 1 || m_vorbis.vi.channels > 6)
- return E_FAIL;
+ if(m_vorbis.vi.channels < 1 || m_vorbis.vi.channels > 6)
+ return E_FAIL;
- if(m_buff.IsEmpty())
- return S_OK;
+ if(m_buff.IsEmpty())
+ return S_OK;
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
- ogg_packet op;
- memset(&op, 0, sizeof(op));
- op.packet = m_buff.GetData();
- op.bytes = m_buff.GetCount();
- op.b_o_s = 0;
- op.packetno = m_vorbis.packetno++;
+ ogg_packet op;
+ memset(&op, 0, sizeof(op));
+ op.packet = m_buff.GetData();
+ op.bytes = m_buff.GetCount();
+ op.b_o_s = 0;
+ op.packetno = m_vorbis.packetno++;
- if(vorbis_synthesis(&m_vorbis.vb, &op) == 0)
- {
- vorbis_synthesis_blockin(&m_vorbis.vd, &m_vorbis.vb);
+ if(vorbis_synthesis(&m_vorbis.vb, &op) == 0)
+ {
+ vorbis_synthesis_blockin(&m_vorbis.vd, &m_vorbis.vb);
- int samples;
- float** pcm;
+ int samples;
+ float** pcm;
- while((samples = vorbis_synthesis_pcmout(&m_vorbis.vd, &pcm)) > 0)
- {
- const scmap_t& scmap = s_scmap_vorbis[m_vorbis.vi.channels-1];
+ while((samples = vorbis_synthesis_pcmout(&m_vorbis.vd, &pcm)) > 0)
+ {
+ const scmap_t& scmap = s_scmap_vorbis[m_vorbis.vi.channels-1];
- CAtlArray<float> pBuff;
- pBuff.SetCount(samples * scmap.nChannels);
- float* dst = pBuff.GetData();
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(samples * scmap.nChannels);
+ float* dst = pBuff.GetData();
- for(int j = 0, ch = scmap.nChannels; j < ch; j++)
- {
- float* src = pcm[scmap.ch[j]];
- for(int i = 0; i < samples; i++)
- dst[j + i*ch] = src[i];
- // dst[j + i*ch] = (float)max(min(src[i], 1<<24), -1<<24) / (1<<24);
- }
+ for(int j = 0, ch = scmap.nChannels; j < ch; j++)
+ {
+ float* src = pcm[scmap.ch[j]];
+ for(int i = 0; i < samples; i++)
+ dst[j + i*ch] = src[i];
+ // dst[j + i*ch] = (float)max(min(src[i], 1<<24), -1<<24) / (1<<24);
+ }
- if(S_OK != (hr = Deliver(pBuff, m_vorbis.vi.rate, scmap.nChannels, scmap.dwChannelMask)))
- break;
+ if(S_OK != (hr = Deliver(pBuff, m_vorbis.vi.rate, scmap.nChannels, scmap.dwChannelMask)))
+ break;
- vorbis_synthesis_read(&m_vorbis.vd, samples);
- }
- }
+ vorbis_synthesis_read(&m_vorbis.vd, samples);
+ }
+ }
- m_buff.RemoveAll();
+ m_buff.RemoveAll();
- return hr;
+ return hr;
}
static inline float fscale(mad_fixed_t sample)
{
- if(sample >= MAD_F_ONE) sample = MAD_F_ONE - 1;
- else if(sample < -MAD_F_ONE) sample = -MAD_F_ONE;
+ if(sample >= MAD_F_ONE) sample = MAD_F_ONE - 1;
+ else if(sample < -MAD_F_ONE) sample = -MAD_F_ONE;
- return (float)sample / (1 << MAD_F_FRACBITS);
+ return (float)sample / (1 << MAD_F_FRACBITS);
}
HRESULT CMpaDecFilter::ProcessFlac()
{
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
- FLAC__stream_decoder_process_single((FLAC__StreamDecoder*) m_flac.pDecoder);
- return m_flac.hr;
+ FLAC__stream_decoder_process_single ((FLAC__StreamDecoder*) m_flac.pDecoder);
+ return m_flac.hr;
}
HRESULT CMpaDecFilter::ProcessMPA()
{
- mad_stream_buffer(&m_stream, m_buff.GetData(), m_buff.GetCount());
-
- while(1)
- {
- if(mad_frame_decode(&m_frame, &m_stream) == -1)
- {
- if(m_stream.error == MAD_ERROR_BUFLEN)
- {
- memmove(m_buff.GetData(), m_stream.this_frame, m_stream.bufend - m_stream.this_frame);
- m_buff.SetCount(m_stream.bufend - m_stream.this_frame);
- break;
- }
-
- if(!MAD_RECOVERABLE(m_stream.error))
- {
- TRACE(_T("*m_stream.error == %d\n"), m_stream.error);
- return E_FAIL;
- }
-
- // FIXME: the renderer doesn't like this
- // m_fDiscontinuity = true;
-
- continue;
- }
- /*
- // TODO: needs to be tested... (has anybody got an external mpeg audio decoder?)
- HRESULT hr;
- if(S_OK != (hr = Deliver(
- (BYTE*)m_stream.this_frame,
- m_stream.next_frame - m_stream.this_frame,
- m_frame.header.bitrate,
- m_frame.header.layer == 1 ? 0x0004 : 0x0005)))
- return hr;
- continue;
- */
- mad_synth_frame(&m_synth, &m_frame);
-
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
- if(wfein->nChannels != m_synth.pcm.channels || wfein->nSamplesPerSec != m_synth.pcm.samplerate)
- continue;
-
- const mad_fixed_t* left_ch = m_synth.pcm.samples[0];
- const mad_fixed_t* right_ch = m_synth.pcm.samples[1];
-
- CAtlArray<float> pBuff;
- pBuff.SetCount(m_synth.pcm.length * m_synth.pcm.channels);
-
- float* pDataOut = pBuff.GetData();
- for(unsigned short i = 0; i < m_synth.pcm.length; i++)
- {
- *pDataOut++ = fscale(*left_ch++);
- if(m_synth.pcm.channels == 2) *pDataOut++ = fscale(*right_ch++);
- }
-
- HRESULT hr;
- if(S_OK != (hr = Deliver(pBuff, m_synth.pcm.samplerate, m_synth.pcm.channels)))
- return hr;
- }
-
- return S_OK;
+ mad_stream_buffer(&m_stream, m_buff.GetData(), m_buff.GetCount());
+
+ while(1)
+ {
+ if(mad_frame_decode(&m_frame, &m_stream) == -1)
+ {
+ if(m_stream.error == MAD_ERROR_BUFLEN)
+ {
+ memmove(m_buff.GetData(), m_stream.this_frame, m_stream.bufend - m_stream.this_frame);
+ m_buff.SetCount(m_stream.bufend - m_stream.this_frame);
+ break;
+ }
+
+ if(!MAD_RECOVERABLE(m_stream.error))
+ {
+ TRACE(_T("*m_stream.error == %d\n"), m_stream.error);
+ return E_FAIL;
+ }
+
+ // FIXME: the renderer doesn't like this
+ // m_fDiscontinuity = true;
+
+ continue;
+ }
+/*
+// TODO: needs to be tested... (has anybody got an external mpeg audio decoder?)
+HRESULT hr;
+if(S_OK != (hr = Deliver(
+ (BYTE*)m_stream.this_frame,
+ m_stream.next_frame - m_stream.this_frame,
+ m_frame.header.bitrate,
+ m_frame.header.layer == 1 ? 0x0004 : 0x0005)))
+ return hr;
+continue;
+*/
+ mad_synth_frame(&m_synth, &m_frame);
+
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ if(wfein->nChannels != m_synth.pcm.channels || wfein->nSamplesPerSec != m_synth.pcm.samplerate)
+ continue;
+
+ const mad_fixed_t* left_ch = m_synth.pcm.samples[0];
+ const mad_fixed_t* right_ch = m_synth.pcm.samples[1];
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(m_synth.pcm.length*m_synth.pcm.channels);
+
+ float* pDataOut = pBuff.GetData();
+ for(unsigned short i = 0; i < m_synth.pcm.length; i++)
+ {
+ *pDataOut++ = fscale(*left_ch++);
+ if(m_synth.pcm.channels == 2) *pDataOut++ = fscale(*right_ch++);
+ }
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, m_synth.pcm.samplerate, m_synth.pcm.channels)))
+ return hr;
+ }
+
+ return S_OK;
}
HRESULT CMpaDecFilter::GetDeliveryBuffer(IMediaSample** pSample, BYTE** pData)
{
- HRESULT hr;
+ HRESULT hr;
- *pData = NULL;
- if(FAILED(hr = m_pOutput->GetDeliveryBuffer(pSample, NULL, NULL, 0))
- || FAILED(hr = (*pSample)->GetPointer(pData)))
- return hr;
+ *pData = NULL;
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(pSample, NULL, NULL, 0))
+ || FAILED(hr = (*pSample)->GetPointer(pData)))
+ return hr;
- AM_MEDIA_TYPE* pmt = NULL;
- if(SUCCEEDED((*pSample)->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt = *pmt;
- m_pOutput->SetMediaType(&mt);
- DeleteMediaType(pmt);
- pmt = NULL;
- }
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(SUCCEEDED((*pSample)->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ pmt = NULL;
+ }
- return S_OK;
+ return S_OK;
}
HRESULT CMpaDecFilter::Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask)
{
- HRESULT hr;
+ HRESULT hr;
- MPCSampleFormat sf = GetSampleFormat();
+ MPCSampleFormat sf = GetSampleFormat();
- CMediaType mt = CreateMediaType(sf, nSamplesPerSec, nChannels, dwChannelMask);
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ CMediaType mt = CreateMediaType(sf, nSamplesPerSec, nChannels, dwChannelMask);
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- int nSamples = pBuff.GetCount() / wfe->nChannels;
+ int nSamples = pBuff.GetCount()/wfe->nChannels;
- if(FAILED(hr = ReconnectOutput(nSamples, mt)))
- return hr;
+ if(FAILED(hr = ReconnectOutput(nSamples, mt)))
+ return hr;
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut)))
- return E_FAIL;
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut)))
+ return E_FAIL;
- REFERENCE_TIME rtDur = 10000000i64 * nSamples / wfe->nSamplesPerSec;
- REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
- m_rtStart += rtDur;
+ REFERENCE_TIME rtDur = 10000000i64*nSamples/wfe->nSamplesPerSec;
+ REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
+ m_rtStart += rtDur;
//TRACE(_T("CMpaDecFilter: %I64d - %I64d\n"), rtStart/10000, rtStop/10000);
- if(rtStart < 0 /*200000*/ /* < 0, FIXME: 0 makes strange noises */)
- return S_OK;
-
- if(hr == S_OK)
- {
- m_pOutput->SetMediaType(&mt);
- pOut->SetMediaType(&mt);
- }
-
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
-
- pOut->SetPreroll(FALSE);
- pOut->SetDiscontinuity(m_fDiscontinuity);
- m_fDiscontinuity = false;
- pOut->SetSyncPoint(TRUE);
-
- pOut->SetActualDataLength(pBuff.GetCount()*wfe->wBitsPerSample / 8);
-
- WAVEFORMATEX* wfeout = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
- ASSERT(wfeout->nChannels == wfe->nChannels);
- ASSERT(wfeout->nSamplesPerSec == wfe->nSamplesPerSec);
-
- float* pDataIn = pBuff.GetData();
-
- // TODO: move this into the audio switcher
- float sample_mul = 1;
- if(m_fNormalize)
- {
- for(int i = 0, len = pBuff.GetCount(); i < len; i++)
- {
- float f = *pDataIn++;
- if(f < 0) f = -f;
- if(m_sample_max < f) m_sample_max = f;
- }
- sample_mul = 1.0f / m_sample_max;
- pDataIn = pBuff.GetData();
- }
-
- bool fBoost = m_boost > 1;
- double boost = 1 + log10(m_boost);
-
- for(int i = 0, len = pBuff.GetCount(); i < len; i++)
- {
- float f = *pDataIn++;
-
- // TODO: move this into the audio switcher
-
- if(m_fNormalize)
- f *= sample_mul;
-
- if(fBoost)
- f *= boost;
-
- if(f < -1) f = -1;
- else if(f > 1) f = 1;
-
-#define round(x) ((x) > 0 ? (x) + 0.5 : (x) - 0.5)
-
- switch(sf)
- {
- default:
- case SF_PCM16:
- *(short*)pDataOut = (short)round(f * SHRT_MAX);
- pDataOut += sizeof(short);
- break;
- case SF_PCM24:
- {
- DWORD i24 = (DWORD)(int)round(f * ((1 << 23) - 1));
- *pDataOut++ = (BYTE)(i24);
- *pDataOut++ = (BYTE)(i24 >> 8);
- *pDataOut++ = (BYTE)(i24 >> 16);
- }
- break;
- case SF_PCM32:
- *(int*)pDataOut = (int)round(f * INT_MAX);
- pDataOut += sizeof(int);
- break;
- case SF_FLOAT32:
- *(float*)pDataOut = f;
- pDataOut += sizeof(float);
- break;
- }
- }
-
- return m_pOutput->Deliver(pOut);
+ if(rtStart < 0 /*200000*/ /* < 0, FIXME: 0 makes strange noises */)
+ return S_OK;
+
+ if(hr == S_OK)
+ {
+ m_pOutput->SetMediaType(&mt);
+ pOut->SetMediaType(&mt);
+ }
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ pOut->SetPreroll(FALSE);
+ pOut->SetDiscontinuity(m_fDiscontinuity); m_fDiscontinuity = false;
+ pOut->SetSyncPoint(TRUE);
+
+ pOut->SetActualDataLength(pBuff.GetCount()*wfe->wBitsPerSample/8);
+
+WAVEFORMATEX* wfeout = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+ASSERT(wfeout->nChannels == wfe->nChannels);
+ASSERT(wfeout->nSamplesPerSec == wfe->nSamplesPerSec);
+
+ float* pDataIn = pBuff.GetData();
+
+ // TODO: move this into the audio switcher
+ float sample_mul = 1;
+ if(m_fNormalize)
+ {
+ for(int i = 0, len = pBuff.GetCount(); i < len; i++)
+ {
+ float f = *pDataIn++;
+ if(f < 0) f = -f;
+ if(m_sample_max < f) m_sample_max = f;
+ }
+ sample_mul = 1.0f / m_sample_max;
+ pDataIn = pBuff.GetData();
+ }
+
+ bool fBoost = m_boost > 1;
+ double boost = 1+log10(m_boost);
+
+ for(int i = 0, len = pBuff.GetCount(); i < len; i++)
+ {
+ float f = *pDataIn++;
+
+ // TODO: move this into the audio switcher
+
+ if(m_fNormalize)
+ f *= sample_mul;
+
+ if(fBoost)
+ f *= boost;
+
+ if(f < -1) f = -1;
+ else if(f > 1) f = 1;
+
+ #define round(x) ((x) > 0 ? (x) + 0.5 : (x) - 0.5)
+
+ switch(sf)
+ {
+ default:
+ case SF_PCM16:
+ *(short*)pDataOut = (short)round(f * SHRT_MAX);
+ pDataOut += sizeof(short);
+ break;
+ case SF_PCM24:
+ {DWORD i24 = (DWORD)(int)round(f * ((1<<23)-1));
+ *pDataOut++ = (BYTE)(i24);
+ *pDataOut++ = (BYTE)(i24>>8);
+ *pDataOut++ = (BYTE)(i24>>16);}
+ break;
+ case SF_PCM32:
+ *(int*)pDataOut = (int)round(f * INT_MAX);
+ pDataOut += sizeof(int);
+ break;
+ case SF_FLOAT32:
+ *(float*)pDataOut = f;
+ pDataOut += sizeof(float);
+ break;
+ }
+ }
+
+ return m_pOutput->Deliver(pOut);
}
HRESULT CMpaDecFilter::Deliver(BYTE* pBuff, int size, int bit_rate, BYTE type)
{
- HRESULT hr;
- bool padded = false;
-
- CMediaType mt = CreateMediaTypeSPDIF();
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ HRESULT hr;
+ bool padded = false;
- int length = 0;
- while(length < size + sizeof(WORD) * 4) length += 0x800;
- int size2 = 1i64 * wfe->nBlockAlign * wfe->nSamplesPerSec * size * 8 / bit_rate;
- while(length < size2) length += 0x800;
- if(length > size2)
- padded = true;
+ CMediaType mt = CreateMediaTypeSPDIF();
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- if(FAILED(hr = ReconnectOutput(length / wfe->nBlockAlign, mt)))
- return hr;
+ int length = 0;
+ while(length < size+sizeof(WORD)*4) length += 0x800;
+ int size2 = 1i64 * wfe->nBlockAlign * wfe->nSamplesPerSec * size*8 / bit_rate;
+ while(length < size2) length += 0x800;
+ if(length > size2)
+ padded = true;
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut)))
- return E_FAIL;
+ if(FAILED(hr = ReconnectOutput(length / wfe->nBlockAlign, mt)))
+ return hr;
- WORD* pDataOutW = (WORD*)pDataOut;
- pDataOutW[0] = 0xf872;
- pDataOutW[1] = 0x4e1f;
- pDataOutW[2] = type;
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut)))
+ return E_FAIL;
- REFERENCE_TIME rtDur;
+ WORD* pDataOutW = (WORD*)pDataOut;
+ pDataOutW[0] = 0xf872;
+ pDataOutW[1] = 0x4e1f;
+ pDataOutW[2] = type;
+
+ REFERENCE_TIME rtDur;
- if(!padded)
- {
- rtDur = 10000000i64 * size * 8 / bit_rate;
- pDataOutW[3] = size * 8;
- _swab((char*)pBuff, (char*)&pDataOutW[4], size);
- }
+ if(!padded)
+ {
+ rtDur = 10000000i64 * size*8 / bit_rate;
+ pDataOutW[3] = size*8;
+ _swab((char*)pBuff, (char*)&pDataOutW[4], size);
+ }
- else
- {
- const size_t blocks = (size + length - 1) / length;
- rtDur = 10000000i64 * blocks * length * 8 / bit_rate;
- pDataOutW[3] = length * 8;
- _swab((char*)pBuff, (char*)&pDataOutW[4], length);
- }
- REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
- m_rtStart += rtDur;
+ else
+ {
+ const size_t blocks = (size + length - 1) / length;
+ rtDur = 10000000i64 * blocks * length*8 / bit_rate;
+ pDataOutW[3] = length*8;
+ _swab((char*)pBuff, (char*)&pDataOutW[4], length);
+ }
+ REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
+ m_rtStart += rtDur;
- if(rtStart < 0)
- return S_OK;
+ if(rtStart < 0)
+ return S_OK;
- if(hr == S_OK)
- {
- m_pOutput->SetMediaType(&mt);
- pOut->SetMediaType(&mt);
- }
+ if(hr == S_OK)
+ {
+ m_pOutput->SetMediaType(&mt);
+ pOut->SetMediaType(&mt);
+ }
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
- pOut->SetPreroll(FALSE);
- pOut->SetDiscontinuity(m_fDiscontinuity);
- m_fDiscontinuity = false;
- pOut->SetSyncPoint(TRUE);
+ pOut->SetPreroll(FALSE);
+ pOut->SetDiscontinuity(m_fDiscontinuity); m_fDiscontinuity = false;
+ pOut->SetSyncPoint(TRUE);
- pOut->SetActualDataLength(length);
+ pOut->SetActualDataLength(length);
- return m_pOutput->Deliver(pOut);
+ return m_pOutput->Deliver(pOut);
}
HRESULT CMpaDecFilter::ReconnectOutput(int nSamples, CMediaType& mt)
{
- HRESULT hr;
+ HRESULT hr;
- CComQIPtr<IMemInputPin> pPin = m_pOutput->GetConnected();
- if(!pPin) return E_NOINTERFACE;
+ CComQIPtr<IMemInputPin> pPin = m_pOutput->GetConnected();
+ if(!pPin) return E_NOINTERFACE;
- CComPtr<IMemAllocator> pAllocator;
- if(FAILED(hr = pPin->GetAllocator(&pAllocator)) || !pAllocator)
- return hr;
+ CComPtr<IMemAllocator> pAllocator;
+ if(FAILED(hr = pPin->GetAllocator(&pAllocator)) || !pAllocator)
+ return hr;
- ALLOCATOR_PROPERTIES props, actual;
- if(FAILED(hr = pAllocator->GetProperties(&props)))
- return hr;
+ ALLOCATOR_PROPERTIES props, actual;
+ if(FAILED(hr = pAllocator->GetProperties(&props)))
+ return hr;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- long cbBuffer = nSamples * wfe->nBlockAlign;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ long cbBuffer = nSamples * wfe->nBlockAlign;
- if(mt != m_pOutput->CurrentMediaType() || cbBuffer > props.cbBuffer)
- {
- if(cbBuffer > props.cbBuffer)
- {
- props.cBuffers = 4;
- props.cbBuffer = cbBuffer * 3 / 2;
+ if(mt != m_pOutput->CurrentMediaType() || cbBuffer > props.cbBuffer)
+ {
+ if(cbBuffer > props.cbBuffer)
+ {
+ props.cBuffers = 4;
+ props.cbBuffer = cbBuffer*3/2;
- if(FAILED(hr = m_pOutput->DeliverBeginFlush())
- || FAILED(hr = m_pOutput->DeliverEndFlush())
- || FAILED(hr = pAllocator->Decommit())
- || FAILED(hr = pAllocator->SetProperties(&props, &actual))
- || FAILED(hr = pAllocator->Commit()))
- return hr;
+ if(FAILED(hr = m_pOutput->DeliverBeginFlush())
+ || FAILED(hr = m_pOutput->DeliverEndFlush())
+ || FAILED(hr = pAllocator->Decommit())
+ || FAILED(hr = pAllocator->SetProperties(&props, &actual))
+ || FAILED(hr = pAllocator->Commit()))
+ return hr;
- if(props.cBuffers > actual.cBuffers || props.cbBuffer > actual.cbBuffer)
- {
- NotifyEvent(EC_ERRORABORT, hr, 0);
- return E_FAIL;
- }
- }
+ if(props.cBuffers > actual.cBuffers || props.cbBuffer > actual.cbBuffer)
+ {
+ NotifyEvent(EC_ERRORABORT, hr, 0);
+ return E_FAIL;
+ }
+ }
- return S_OK;
- }
+ return S_OK;
+ }
- return S_FALSE;
+ return S_FALSE;
}
CMediaType CMpaDecFilter::CreateMediaType(MPCSampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask)
{
- CMediaType mt;
-
- mt.majortype = MEDIATYPE_Audio;
- mt.subtype = sf == SF_FLOAT32 ? MEDIASUBTYPE_IEEE_FLOAT : MEDIASUBTYPE_PCM;
- mt.formattype = FORMAT_WaveFormatEx;
-
- WAVEFORMATEXTENSIBLE wfex;
- memset(&wfex, 0, sizeof(wfex));
- WAVEFORMATEX* wfe = &wfex.Format;
- wfe->wFormatTag = (WORD)mt.subtype.Data1;
- wfe->nChannels = nChannels;
- wfe->nSamplesPerSec = nSamplesPerSec;
- switch(sf)
- {
- default:
- case SF_PCM16:
- wfe->wBitsPerSample = 16;
- break;
- case SF_PCM24:
- wfe->wBitsPerSample = 24;
- break;
- case SF_PCM32:
- case SF_FLOAT32:
- wfe->wBitsPerSample = 32;
- break;
- }
- wfe->nBlockAlign = wfe->nChannels * wfe->wBitsPerSample / 8;
- wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
- mt.SetSampleSize(wfe->wBitsPerSample * wfe->nChannels / 8);
-
- // FIXME: 24/32 bit only seems to work with WAVE_FORMAT_EXTENSIBLE
- if(dwChannelMask == 0 && (sf == SF_PCM24 || sf == SF_PCM32))
- dwChannelMask = nChannels == 2 ? (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) : SPEAKER_FRONT_CENTER;
-
- if(dwChannelMask)
- {
- wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- wfex.Format.cbSize = sizeof(wfex) - sizeof(wfex.Format);
- wfex.dwChannelMask = dwChannelMask;
- wfex.Samples.wValidBitsPerSample = wfex.Format.wBitsPerSample;
- wfex.SubFormat = mt.subtype;
- }
-
- mt.SetFormat((BYTE*)&wfex, sizeof(wfex.Format) + wfex.Format.cbSize);
-
- return mt;
+ CMediaType mt;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = sf == SF_FLOAT32 ? MEDIASUBTYPE_IEEE_FLOAT : MEDIASUBTYPE_PCM;
+ mt.formattype = FORMAT_WaveFormatEx;
+
+ WAVEFORMATEXTENSIBLE wfex;
+ memset(&wfex, 0, sizeof(wfex));
+ WAVEFORMATEX* wfe = &wfex.Format;
+ wfe->wFormatTag = (WORD)mt.subtype.Data1;
+ wfe->nChannels = nChannels;
+ wfe->nSamplesPerSec = nSamplesPerSec;
+ switch(sf)
+ {
+ default:
+ case SF_PCM16: wfe->wBitsPerSample = 16; break;
+ case SF_PCM24: wfe->wBitsPerSample = 24; break;
+ case SF_PCM32: case SF_FLOAT32: wfe->wBitsPerSample = 32; break;
+ }
+ wfe->nBlockAlign = wfe->nChannels*wfe->wBitsPerSample/8;
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec*wfe->nBlockAlign;
+ mt.SetSampleSize (wfe->wBitsPerSample*wfe->nChannels/8);
+
+ // FIXME: 24/32 bit only seems to work with WAVE_FORMAT_EXTENSIBLE
+ if(dwChannelMask == 0 && (sf == SF_PCM24 || sf == SF_PCM32))
+ dwChannelMask = nChannels == 2 ? (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT) : SPEAKER_FRONT_CENTER;
+
+ if(dwChannelMask)
+ {
+ wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfex.Format.cbSize = sizeof(wfex) - sizeof(wfex.Format);
+ wfex.dwChannelMask = dwChannelMask;
+ wfex.Samples.wValidBitsPerSample = wfex.Format.wBitsPerSample;
+ wfex.SubFormat = mt.subtype;
+ }
+
+ mt.SetFormat((BYTE*)&wfex, sizeof(wfex.Format) + wfex.Format.cbSize);
+
+ return mt;
}
CMediaType CMpaDecFilter::CreateMediaTypeSPDIF()
{
- CMediaType mt = CreateMediaType(SF_PCM16, 48000, 2);
- ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
- return mt;
+ CMediaType mt = CreateMediaType(SF_PCM16, 48000, 2);
+ ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
+ return mt;
}
HRESULT CMpaDecFilter::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
- if(wfe->nChannels < 1 || wfe->nChannels > 8 || (wfe->wBitsPerSample != 16 && wfe->wBitsPerSample != 20 && wfe->wBitsPerSample != 24))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- else if(mtIn->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
- {
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
- return S_OK;
- }
- else if(mtIn->subtype == MEDIASUBTYPE_PS2_ADPCM)
- {
- WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)mtIn->Format();
- if(wfe->dwInterleave & 0xf) // has to be a multiple of the block size (16 bytes)
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- else if(mtIn->subtype == MEDIASUBTYPE_Vorbis2)
- {
- if(!m_vorbis.init(*mtIn))
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- else if(mtIn->subtype == MEDIASUBTYPE_FLAC_FRAMED)
- {
- return S_OK;
- }
- else if(mtIn->subtype == MEDIASUBTYPE_NELLYMOSER)
- {
- return S_OK;
- }
- else if(mtIn->subtype == MEDIASUBTYPE_AAC)
- {
- // Reject invalid AAC stream on connection
- if(!m_aac_state.init(*mtIn)) return VFW_E_TYPE_NOT_ACCEPTED;
- }
-
- for(int i = 0; i < countof(sudPinTypesIn); i++)
- {
- if(*sudPinTypesIn[i].clsMajorType == mtIn->majortype
- && *sudPinTypesIn[i].clsMinorType == mtIn->subtype)
- return S_OK;
- }
-
- return VFW_E_TYPE_NOT_ACCEPTED;
+ if(mtIn->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
+ if(wfe->nChannels < 1 || wfe->nChannels > 8 || (wfe->wBitsPerSample != 16 && wfe->wBitsPerSample != 20 && wfe->wBitsPerSample != 24))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
+ return S_OK;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_PS2_ADPCM)
+ {
+ WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)mtIn->Format();
+ if(wfe->dwInterleave & 0xf) // has to be a multiple of the block size (16 bytes)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_Vorbis2)
+ {
+ if(!m_vorbis.init(*mtIn))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_FLAC_FRAMED)
+ {
+ return S_OK;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_NELLYMOSER)
+ {
+ return S_OK;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_AAC)
+ {
+ // Reject invalid AAC stream on connection
+ if (!m_aac_state.init(*mtIn)) return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ for(int i = 0; i < countof(sudPinTypesIn); i++)
+ {
+ if(*sudPinTypesIn[i].clsMajorType == mtIn->majortype
+ && *sudPinTypesIn[i].clsMinorType == mtIn->subtype)
+ return S_OK;
+ }
+
+ return VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CMpaDecFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- return SUCCEEDED(CheckInputType(mtIn))
- && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
- || mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_IEEE_FLOAT
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ || mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_IEEE_FLOAT
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CMpaDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- CMediaType& mt = m_pInput->CurrentMediaType();
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ CMediaType& mt = m_pInput->CurrentMediaType();
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- pProperties->cBuffers = 4;
- // pProperties->cbBuffer = 1;
- pProperties->cbBuffer = 48000 * 6 * (32 / 8) / 10; // 48KHz 6ch 32bps 100ms
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ pProperties->cBuffers = 4;
+ // pProperties->cbBuffer = 1;
+ pProperties->cbBuffer = 48000*6*(32/8)/10; // 48KHz 6ch 32bps 100ms
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR;
+ ? E_FAIL
+ : NOERROR;
}
HRESULT CMpaDecFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
-
- CMediaType mt = m_pInput->CurrentMediaType();
- const GUID& subtype = mt.subtype;
- WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- if(wfe == NULL) return E_INVALIDARG;
-
- if(GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
- subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
- subtype == MEDIASUBTYPE_DOLBY_TRUEHD)
- || GetSpeakerConfig(dts) < 0 && (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS))
- {
- *pmt = CreateMediaTypeSPDIF();
- }
- else if(subtype == MEDIASUBTYPE_Vorbis2)
- {
- *pmt = CreateMediaType(GetSampleFormat(), m_vorbis.vi.rate, m_vorbis.vi.channels);
- }
- else
- {
- *pmt = CreateMediaType(GetSampleFormat(), wfe->nSamplesPerSec, min(2, wfe->nChannels));
- }
-
- return S_OK;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ CMediaType mt = m_pInput->CurrentMediaType();
+ const GUID& subtype = mt.subtype;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ if (wfe == NULL) return E_INVALIDARG;
+
+ if(GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 ||
+ subtype == MEDIASUBTYPE_DOLBY_DDPLUS ||
+ subtype == MEDIASUBTYPE_DOLBY_TRUEHD)
+ || GetSpeakerConfig(dts) < 0 && (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS))
+ {
+ *pmt = CreateMediaTypeSPDIF();
+ }
+ else if(subtype == MEDIASUBTYPE_Vorbis2)
+ {
+ *pmt = CreateMediaType(GetSampleFormat(), m_vorbis.vi.rate, m_vorbis.vi.channels);
+ }
+ else
+ {
+ *pmt = CreateMediaType(GetSampleFormat(), wfe->nSamplesPerSec, min(2, wfe->nChannels));
+ }
+
+ return S_OK;
}
HRESULT CMpaDecFilter::StartStreaming()
{
- HRESULT hr = __super::StartStreaming();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::StartStreaming();
+ if(FAILED(hr)) return hr;
- m_a52_state = a52_init(0);
+ m_a52_state = a52_init(0);
- m_dts_state = dts_init(0);
+ m_dts_state = dts_init(0);
- m_aac_state.init(m_pInput->CurrentMediaType());
+ m_aac_state.init(m_pInput->CurrentMediaType());
- mad_stream_init(&m_stream);
- mad_frame_init(&m_frame);
- mad_synth_init(&m_synth);
- mad_stream_options(&m_stream, 0/*options*/);
+ mad_stream_init(&m_stream);
+ mad_frame_init(&m_frame);
+ mad_synth_init(&m_synth);
+ mad_stream_options(&m_stream, 0/*options*/);
- m_ps2_state.reset();
- FlacInitDecoder();
+ m_ps2_state.reset();
+ FlacInitDecoder();
- m_fDiscontinuity = false;
+ m_fDiscontinuity = false;
- m_sample_max = 0.1f;
+ m_sample_max = 0.1f;
- return S_OK;
+ return S_OK;
}
HRESULT CMpaDecFilter::StopStreaming()
{
- a52_free(m_a52_state);
+ a52_free(m_a52_state);
- dts_free(m_dts_state);
+ dts_free(m_dts_state);
- mad_synth_finish(&m_synth);
- mad_frame_finish(&m_frame);
- mad_stream_finish(&m_stream);
- flac_stream_finish();
- ffmpeg_stream_finish();
+ mad_synth_finish(&m_synth);
+ mad_frame_finish(&m_frame);
+ mad_stream_finish(&m_stream);
+ flac_stream_finish();
+ ffmpeg_stream_finish();
- return __super::StopStreaming();
+ return __super::StopStreaming();
}
// IMpaDecFilter
STDMETHODIMP CMpaDecFilter::SetSampleFormat(MPCSampleFormat sf)
{
- CAutoLock cAutoLock(&m_csProps);
- m_iSampleFormat = sf;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_iSampleFormat = sf;
+ return S_OK;
}
STDMETHODIMP_(MPCSampleFormat) CMpaDecFilter::GetSampleFormat()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_iSampleFormat;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_iSampleFormat;
}
STDMETHODIMP CMpaDecFilter::SetNormalize(bool fNormalize)
{
- CAutoLock cAutoLock(&m_csProps);
- if(m_fNormalize != fNormalize) m_sample_max = 0.1f;
- m_fNormalize = fNormalize;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ if(m_fNormalize != fNormalize) m_sample_max = 0.1f;
+ m_fNormalize = fNormalize;
+ return S_OK;
}
STDMETHODIMP_(bool) CMpaDecFilter::GetNormalize()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_fNormalize;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fNormalize;
}
STDMETHODIMP CMpaDecFilter::SetSpeakerConfig(enctype et, int sc)
{
- CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) m_iSpeakerConfig[et] = sc;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) m_iSpeakerConfig[et] = sc;
+ return S_OK;
}
STDMETHODIMP_(int) CMpaDecFilter::GetSpeakerConfig(enctype et)
{
- CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) return m_iSpeakerConfig[et];
- return -1;
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) return m_iSpeakerConfig[et];
+ return -1;
}
STDMETHODIMP CMpaDecFilter::SetDynamicRangeControl(enctype et, bool fDRC)
{
- CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) m_fDynamicRangeControl[et] = fDRC;
- else return E_INVALIDARG;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) m_fDynamicRangeControl[et] = fDRC;
+ else return E_INVALIDARG;
+ return S_OK;
}
STDMETHODIMP_(bool) CMpaDecFilter::GetDynamicRangeControl(enctype et)
{
- CAutoLock cAutoLock(&m_csProps);
- if(et >= 0 && et < etlast) return m_fDynamicRangeControl[et];
- return false;
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) return m_fDynamicRangeControl[et];
+ return false;
}
STDMETHODIMP CMpaDecFilter::SetBoost(float boost)
{
- CAutoLock cAutoLock(&m_csProps);
- m_boost = max(boost, 1);
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_boost = max(boost, 1);
+ return S_OK;
}
STDMETHODIMP_(float) CMpaDecFilter::GetBoost()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_boost;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_boost;
}
STDMETHODIMP_(DolbyDigitalMode) CMpaDecFilter::GetDolbyDigitalMode()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_DolbyDigitalMode;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_DolbyDigitalMode;
}
STDMETHODIMP CMpaDecFilter::SaveSettings()
{
- CAutoLock cAutoLock(&m_csProps);
- CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder")))
- {
- key.SetDWORDValue(_T("SampleFormat"), m_iSampleFormat);
- key.SetDWORDValue(_T("Normalize"), m_fNormalize);
- key.SetDWORDValue(_T("Boost"), *(DWORD*)&m_boost);
- key.SetDWORDValue(_T("Ac3SpeakerConfig"), m_iSpeakerConfig[ac3]);
- key.SetDWORDValue(_T("DtsSpeakerConfig"), m_iSpeakerConfig[dts]);
- key.SetDWORDValue(_T("AacSpeakerConfig"), m_iSpeakerConfig[aac]);
- key.SetDWORDValue(_T("Ac3DynamicRangeControl"), m_fDynamicRangeControl[ac3]);
- key.SetDWORDValue(_T("DtsDynamicRangeControl"), m_fDynamicRangeControl[dts]);
- key.SetDWORDValue(_T("AacDynamicRangeControl"), m_fDynamicRangeControl[aac]);
- }
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder")))
+ {
+ key.SetDWORDValue(_T("SampleFormat"), m_iSampleFormat);
+ key.SetDWORDValue(_T("Normalize"), m_fNormalize);
+ key.SetDWORDValue(_T("Boost"), *(DWORD*)&m_boost);
+ key.SetDWORDValue(_T("Ac3SpeakerConfig"), m_iSpeakerConfig[ac3]);
+ key.SetDWORDValue(_T("DtsSpeakerConfig"), m_iSpeakerConfig[dts]);
+ key.SetDWORDValue(_T("AacSpeakerConfig"), m_iSpeakerConfig[aac]);
+ key.SetDWORDValue(_T("Ac3DynamicRangeControl"), m_fDynamicRangeControl[ac3]);
+ key.SetDWORDValue(_T("DtsDynamicRangeControl"), m_fDynamicRangeControl[dts]);
+ key.SetDWORDValue(_T("AacDynamicRangeControl"), m_fDynamicRangeControl[aac]);
+ }
+ return S_OK;
}
// ISpecifyPropertyPages2
STDMETHODIMP CMpaDecFilter::GetPages(CAUUID* pPages)
{
- CheckPointer(pPages, E_POINTER);
+ CheckPointer(pPages, E_POINTER);
- pPages->cElems = 1;
- pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
- pPages->pElems[0] = __uuidof(CMpaDecSettingsWnd);
+ pPages->cElems = 1;
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
+ pPages->pElems[0] = __uuidof(CMpaDecSettingsWnd);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CMpaDecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
{
- CheckPointer(ppPage, E_POINTER);
+ CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) return E_INVALIDARG;
+ if(*ppPage != NULL) return E_INVALIDARG;
- HRESULT hr;
+ HRESULT hr;
- if(guid == __uuidof(CMpaDecSettingsWnd))
- {
- (*ppPage = DNew CInternalPropertyPageTempl<CMpaDecSettingsWnd>(NULL, &hr))->AddRef();
- }
+ if(guid == __uuidof(CMpaDecSettingsWnd))
+ {
+ (*ppPage = DNew CInternalPropertyPageTempl<CMpaDecSettingsWnd>(NULL, &hr))->AddRef();
+ }
- return *ppPage ? S_OK : E_FAIL;
+ return *ppPage ? S_OK : E_FAIL;
}
//
@@ -2047,7 +2016,7 @@ STDMETHODIMP CMpaDecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
//
CMpaDecInputPin::CMpaDecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
- : CDeCSSInputPin(NAME("CMpaDecInputPin"), pFilter, phr, pName)
+ : CDeCSSInputPin(NAME("CMpaDecInputPin"), pFilter, phr, pName)
{
}
@@ -2055,200 +2024,194 @@ CMpaDecInputPin::CMpaDecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR
// aac_state_t
//
-aac_state_t::aac_state_t() : h(NULL), freq(0), channels(0)
-{
- open();
-}
-aac_state_t::~aac_state_t()
-{
- close();
-}
+aac_state_t::aac_state_t() : h(NULL), freq(0), channels(0) {open();}
+aac_state_t::~aac_state_t() {close();}
bool aac_state_t::open()
{
- close();
- if(!(h = NeAACDecOpen())) return false;
- NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(h);
- c->outputFormat = FAAD_FMT_FLOAT;
- NeAACDecSetConfiguration(h, c);
- return true;
+ close();
+ if(!(h = NeAACDecOpen())) return false;
+ NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(h);
+ c->outputFormat = FAAD_FMT_FLOAT;
+ NeAACDecSetConfiguration(h, c);
+ return true;
}
void aac_state_t::close()
{
- if(h) NeAACDecClose(h);
- h = NULL;
+ if(h) NeAACDecClose(h);
+ h = NULL;
}
bool aac_state_t::init(const CMediaType& mt)
{
- if(mt.subtype != MEDIASUBTYPE_AAC
- && mt.subtype != MEDIASUBTYPE_MP4A
- && mt.subtype != MEDIASUBTYPE_mp4a)
- return true; // nothing to do
+ if(mt.subtype != MEDIASUBTYPE_AAC
+ && mt.subtype != MEDIASUBTYPE_MP4A
+ && mt.subtype != MEDIASUBTYPE_mp4a)
+ return true; // nothing to do
- open();
- const WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
- return !NeAACDecInit2(h, (BYTE*)(wfe + 1), wfe->cbSize, &freq, &channels);
+ open();
+ const WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ return !NeAACDecInit2(h, (BYTE*)(wfe+1), wfe->cbSize, &freq, &channels);
}
//
// vorbis_state_t
-//
+//
vorbis_state_t::vorbis_state_t()
{
- memset(&vd, 0, sizeof(vd));
- memset(&vb, 0, sizeof(vb));
- memset(&vc, 0, sizeof(vc));
- memset(&vi, 0, sizeof(vi));
+ memset(&vd, 0, sizeof(vd));
+ memset(&vb, 0, sizeof(vb));
+ memset(&vc, 0, sizeof(vc));
+ memset(&vi, 0, sizeof(vi));
}
vorbis_state_t::~vorbis_state_t()
{
- clear();
+ clear();
}
void vorbis_state_t::clear()
{
- vorbis_block_clear(&vb);
- vorbis_dsp_clear(&vd);
- vorbis_comment_clear(&vc);
- vorbis_info_clear(&vi);
+ vorbis_block_clear(&vb);
+ vorbis_dsp_clear(&vd);
+ vorbis_comment_clear(&vc);
+ vorbis_info_clear(&vi);
}
bool vorbis_state_t::init(const CMediaType& mt)
{
- if(mt.subtype != MEDIASUBTYPE_Vorbis2)
- return true; // nothing to do
+ if(mt.subtype != MEDIASUBTYPE_Vorbis2)
+ return true; // nothing to do
- clear();
+ clear();
- vorbis_info_init(&vi);
- vorbis_comment_init(&vc);
+ vorbis_info_init(&vi);
+ vorbis_comment_init(&vc);
- VORBISFORMAT2* vf = (VORBISFORMAT2*)mt.Format();
- BYTE* fmt = mt.Format();
+ VORBISFORMAT2* vf = (VORBISFORMAT2*)mt.Format();
+ BYTE* fmt = mt.Format();
- packetno = 0;
+ packetno = 0;
+
+ memset(&op, 0, sizeof(op));
+ op.packet = (fmt += sizeof(*vf));
+ op.bytes = vf->HeaderSize[0];
+ op.b_o_s = 1;
+ op.packetno = packetno++;
- memset(&op, 0, sizeof(op));
- op.packet = (fmt += sizeof(*vf));
- op.bytes = vf->HeaderSize[0];
- op.b_o_s = 1;
- op.packetno = packetno++;
+ if(vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
+ return false;
- if(vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
- return false;
+ memset(&op, 0, sizeof(op));
+ op.packet = (fmt += vf->HeaderSize[0]);
+ op.bytes = vf->HeaderSize[1];
+ op.b_o_s = 0;
+ op.packetno = packetno++;
- memset(&op, 0, sizeof(op));
- op.packet = (fmt += vf->HeaderSize[0]);
- op.bytes = vf->HeaderSize[1];
- op.b_o_s = 0;
- op.packetno = packetno++;
+ if(vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
+ return false;
+
+ memset(&op, 0, sizeof(op));
+ op.packet = (fmt += vf->HeaderSize[1]);
+ op.bytes = vf->HeaderSize[2];
+ op.b_o_s = 0;
+ op.packetno = packetno++;
- if(vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
- return false;
+ if(vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
+ return false;
- memset(&op, 0, sizeof(op));
- op.packet = (fmt += vf->HeaderSize[1]);
- op.bytes = vf->HeaderSize[2];
- op.b_o_s = 0;
- op.packetno = packetno++;
+ postgain = 1.0;
- if(vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
- return false;
+ if(vorbis_comment_query_count(&vc, "LWING_GAIN"))
+ postgain = atof(vorbis_comment_query(&vc, "LWING_GAIN", 0));
- postgain = 1.0;
+ if(vorbis_comment_query_count(&vc, "POSTGAIN"))
+ postgain = atof(vorbis_comment_query(&vc, "POSTGAIN", 0));
- if(vorbis_comment_query_count(&vc, "LWING_GAIN"))
- postgain = atof(vorbis_comment_query(&vc, "LWING_GAIN", 0));
+ if(vorbis_comment_query_count(&vc, "REPLAYGAIN_TRACK_GAIN"))
+ postgain = pow(10.0, atof(vorbis_comment_query(&vc, "REPLAYGAIN_TRACK_GAIN", 0)) / 20.0);
- if(vorbis_comment_query_count(&vc, "POSTGAIN"))
- postgain = atof(vorbis_comment_query(&vc, "POSTGAIN", 0));
+ vorbis_synthesis_init(&vd, &vi);
+ vorbis_block_init(&vd, &vb);
- if(vorbis_comment_query_count(&vc, "REPLAYGAIN_TRACK_GAIN"))
- postgain = pow(10.0, atof(vorbis_comment_query(&vc, "REPLAYGAIN_TRACK_GAIN", 0)) / 20.0);
-
- vorbis_synthesis_init(&vd, &vi);
- vorbis_block_init(&vd, &vb);
-
- return true;
+ return true;
}
#pragma region Flac callback
void CMpaDecFilter::FlacFillBuffer(BYTE buffer[], size_t *bytes)
{
- UINT nSize = min(*bytes, m_buff.GetCount());
-
- if(nSize > 0)
- {
- memcpy_s(buffer, *bytes, m_buff.GetData(), nSize);
- memmove(m_buff.GetData(), m_buff.GetData() + nSize, m_buff.GetCount() - nSize);
- m_buff.SetCount(m_buff.GetCount() - nSize);
-
- }
- *bytes = nSize;
-}
-
-void CMpaDecFilter::FlacDeliverBuffer(unsigned blocksize, const __int32 * const buffer[])
-{
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
- CAtlArray<float> pBuff;
-
- pBuff.SetCount(blocksize * wfein->nChannels);
- float* pDataOut = pBuff.GetData();
-
- scmap_t& scmap = m_scmap_default[wfein->nChannels-1];
-
- switch(wfein->wBitsPerSample)
- {
- case 16 :
- for(unsigned i = 0; i < blocksize; i++)
- {
- for(int nChannel = 0; nChannel < wfein->nChannels; nChannel++)
- {
- FLAC__int16 nVal = (FLAC__int16)buffer[nChannel][i];
- *pDataOut = (float)nVal / SHRT_MAX;
- pDataOut++;
- }
- }
- break;
- case 20 :
- case 24 :
- for(unsigned i = 0; i < blocksize; i++)
- {
- for(int nChannel = 0; nChannel < wfein->nChannels; nChannel++)
- {
- FLAC__int32 nVal = (FLAC__int32)buffer[nChannel][i];
- *pDataOut = (float)nVal / INT24_MAX;
- pDataOut++;
- }
- }
- break;
- }
-
- m_flac.hr = Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels, scmap.dwChannelMask);
+ UINT nSize = min (*bytes, m_buff.GetCount());
+
+ if (nSize > 0)
+ {
+ memcpy_s (buffer, *bytes, m_buff.GetData(), nSize);
+ memmove(m_buff.GetData(), m_buff.GetData() + nSize, m_buff.GetCount() - nSize);
+ m_buff.SetCount(m_buff.GetCount() - nSize);
+
+ }
+ *bytes = nSize;
+}
+
+void CMpaDecFilter::FlacDeliverBuffer (unsigned blocksize, const __int32 * const buffer[])
+{
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ CAtlArray<float> pBuff;
+
+ pBuff.SetCount (blocksize * wfein->nChannels);
+ float* pDataOut = pBuff.GetData();
+
+ scmap_t& scmap = m_scmap_default[wfein->nChannels-1];
+
+ switch (wfein->wBitsPerSample)
+ {
+ case 16 :
+ for(unsigned i = 0; i < blocksize; i++)
+ {
+ for(int nChannel = 0; nChannel < wfein->nChannels; nChannel++)
+ {
+ FLAC__int16 nVal = (FLAC__int16)buffer[nChannel][i];
+ *pDataOut = (float)nVal / SHRT_MAX;
+ pDataOut++;
+ }
+ }
+ break;
+ case 20 :
+ case 24 :
+ for(unsigned i = 0; i < blocksize; i++)
+ {
+ for(int nChannel = 0; nChannel < wfein->nChannels; nChannel++)
+ {
+ FLAC__int32 nVal = (FLAC__int32)buffer[nChannel][i];
+ *pDataOut = (float)nVal / INT24_MAX;
+ pDataOut++;
+ }
+ }
+ break;
+ }
+
+ m_flac.hr = Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels, scmap.dwChannelMask);
}
static FLAC__StreamDecoderReadStatus StreamDecoderRead(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- CMpaDecFilter* pThis = static_cast<CMpaDecFilter*>(client_data);
+ CMpaDecFilter* pThis = static_cast<CMpaDecFilter*> (client_data);
- pThis->FlacFillBuffer(buffer, bytes);
+ pThis->FlacFillBuffer (buffer, bytes);
- return (*bytes == 0) ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ return (*bytes == 0) ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
static FLAC__StreamDecoderWriteStatus StreamDecoderWrite(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
- CMpaDecFilter* pThis = static_cast<CMpaDecFilter*>(client_data);
+ CMpaDecFilter* pThis = static_cast<CMpaDecFilter*> (client_data);
- pThis->FlacDeliverBuffer(frame->header.blocksize, buffer);
+ pThis->FlacDeliverBuffer (frame->header.blocksize, buffer);
- return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
static void StreamDecoderError(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
@@ -2262,37 +2225,37 @@ static void StreamDecoderMetadata(const FLAC__StreamDecoder *decoder, const FLAC
void CMpaDecFilter::FlacInitDecoder()
{
- if(!m_flac.pDecoder)
- {
- m_flac.pDecoder = FLAC__stream_decoder_new();
- if(m_flac.pDecoder)
- {
- FLAC__stream_decoder_init_stream((FLAC__StreamDecoder*)m_flac.pDecoder,
- StreamDecoderRead,
- NULL,
- NULL,
- NULL,
- NULL,
- StreamDecoderWrite,
- StreamDecoderMetadata,
- StreamDecoderError,
- this);
- }
- }
- else
- {
- FLAC__stream_decoder_reset((FLAC__StreamDecoder*)m_flac.pDecoder);
- }
+ if (!m_flac.pDecoder)
+ {
+ m_flac.pDecoder = FLAC__stream_decoder_new();
+ if (m_flac.pDecoder)
+ {
+ FLAC__stream_decoder_init_stream ((FLAC__StreamDecoder*)m_flac.pDecoder,
+ StreamDecoderRead,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ StreamDecoderWrite,
+ StreamDecoderMetadata,
+ StreamDecoderError,
+ this);
+ }
+ }
+ else
+ {
+ FLAC__stream_decoder_reset ((FLAC__StreamDecoder*)m_flac.pDecoder);
+ }
}
void CMpaDecFilter::flac_stream_finish()
{
- if(m_flac.pDecoder)
- {
- FLAC__stream_decoder_delete((FLAC__StreamDecoder*)m_flac.pDecoder);
- m_flac.pDecoder = NULL;
- }
+ if (m_flac.pDecoder)
+ {
+ FLAC__stream_decoder_delete ((FLAC__StreamDecoder*)m_flac.pDecoder);
+ m_flac.pDecoder = NULL;
+ }
}
#pragma endregion
@@ -2303,252 +2266,252 @@ void CMpaDecFilter::flac_stream_finish()
#if 0
HRESULT CMpaDecFilter::DeliverFfmpeg(int nCodecId, BYTE* p, int buffsize, int& size)
{
- HRESULT hr = S_OK;
-
- size = 0;
- if(!m_pAVCtx || nCodecId != m_pAVCtx->codec_id)
- if(!InitFfmpeg(nCodecId)) return E_FAIL;
-
- while(buffsize > 0)
- {
- BYTE* pParserData;
- int nParserLength = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- int nPCMLength = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- int nRet;
-
- if(m_pAVCtx->codec_id != CODEC_ID_MLP)
- {
- // Parse buffer
- nRet = av_parser_parse(m_pParser, m_pAVCtx, (uint8_t**)&pParserData, &nParserLength,
- (const uint8_t*)p, buffsize, AV_NOPTS_VALUE, AV_NOPTS_VALUE);
- if(nRet < 0 || (nRet == 0 && nParserLength == 0))
- return S_OK;
-
- buffsize -= nRet;
- p += nRet;
- size += nRet;
-
- // Decode frame
- if(nParserLength > 0)
- {
- nRet = avcodec_decode_audio2(m_pAVCtx, (int16_t*)m_pPCMData, &nPCMLength, (const uint8_t*)pParserData, nParserLength);
- if(nRet < 0 || (nRet == 0 && nPCMLength == 0))
- continue;
- }
- else
- continue;
- }
- else
- {
- // No parsing for MLP : decode only
- nRet = avcodec_decode_audio2(m_pAVCtx, (int16_t*)m_pPCMData, &nPCMLength, (const uint8_t*)p, buffsize);
- if(nRet < 0 || (nRet == 0 && nParserLength == 0))
- return S_OK;
-
- buffsize -= nRet;
- p += nRet;
- size += nRet;
- }
-
- if(nPCMLength > 0)
- {
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
- CAtlArray<float> pBuff;
- int nRemap;
- float* pDataOut;
-
- nRemap = FFGetChannelMap(m_pAVCtx);
- if(nRemap >= 0)
- {
- scmap_t& scmap = s_scmap_ac3[nRemap];
-
- switch(m_pAVCtx->sample_fmt)
- {
- case SAMPLE_FMT_S16 :
- pBuff.SetCount(nPCMLength / 2);
- pDataOut = pBuff.GetData();
-
- for(int i = 0; i < pBuff.GetCount() / m_pAVCtx->channels; i++)
- {
- for(int ch = 0; ch < m_pAVCtx->channels; ch++)
- {
- *pDataOut = (float)((int16_t*)m_pPCMData)[scmap.ch[ch] + i * m_pAVCtx->channels] / SHRT_MAX;
- pDataOut++;
- }
- }
- break;
-
- case SAMPLE_FMT_S32 :
- pBuff.SetCount(nPCMLength / 4);
- pDataOut = pBuff.GetData();
-
- for(int i = 0; i < pBuff.GetCount() / m_pAVCtx->channels; i++)
- {
- for(int ch = 0; ch < m_pAVCtx->channels; ch++)
- {
- *pDataOut = (float)((int32_t*)m_pPCMData)[scmap.ch[ch] + i * m_pAVCtx->channels] / INT_MAX;
- pDataOut++;
- }
- }
- break;
- default :
- ASSERT(FALSE);
- break;
- }
- hr = Deliver(pBuff, m_pAVCtx->sample_rate, m_pAVCtx->channels, scmap.dwChannelMask);
- }
- }
- }
-
- return hr;
+ HRESULT hr = S_OK;
+
+ size = 0;
+ if (!m_pAVCtx || nCodecId != m_pAVCtx->codec_id)
+ if (!InitFfmpeg (nCodecId)) return E_FAIL;
+
+ while (buffsize > 0)
+ {
+ BYTE* pParserData;
+ int nParserLength = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+ int nPCMLength = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+ int nRet;
+
+ if (m_pAVCtx->codec_id != CODEC_ID_MLP)
+ {
+ // Parse buffer
+ nRet = av_parser_parse( m_pParser, m_pAVCtx, (uint8_t**)&pParserData, &nParserLength,
+ (const uint8_t*)p, buffsize, AV_NOPTS_VALUE, AV_NOPTS_VALUE);
+ if (nRet<0 || (nRet==0 && nParserLength==0))
+ return S_OK;
+
+ buffsize -= nRet;
+ p += nRet;
+ size += nRet;
+
+ // Decode frame
+ if (nParserLength > 0)
+ {
+ nRet = avcodec_decode_audio2(m_pAVCtx, (int16_t*)m_pPCMData, &nPCMLength, (const uint8_t*)pParserData, nParserLength);
+ if (nRet<0 || (nRet==0 &&nPCMLength==0))
+ continue;
+ }
+ else
+ continue;
+ }
+ else
+ {
+ // No parsing for MLP : decode only
+ nRet = avcodec_decode_audio2(m_pAVCtx, (int16_t*)m_pPCMData, &nPCMLength, (const uint8_t*)p, buffsize);
+ if (nRet<0 || (nRet==0 && nParserLength==0))
+ return S_OK;
+
+ buffsize -= nRet;
+ p += nRet;
+ size += nRet;
+ }
+
+ if (nPCMLength > 0)
+ {
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ CAtlArray<float> pBuff;
+ int nRemap;
+ float* pDataOut;
+
+ nRemap = FFGetChannelMap (m_pAVCtx);
+ if (nRemap >=0)
+ {
+ scmap_t& scmap = s_scmap_ac3[nRemap];
+
+ switch (m_pAVCtx->sample_fmt)
+ {
+ case SAMPLE_FMT_S16 :
+ pBuff.SetCount (nPCMLength / 2);
+ pDataOut = pBuff.GetData();
+
+ for (int i=0; i<pBuff.GetCount()/m_pAVCtx->channels; i++)
+ {
+ for(int ch=0; ch<m_pAVCtx->channels; ch++)
+ {
+ *pDataOut = (float)((int16_t*)m_pPCMData) [scmap.ch[ch]+i*m_pAVCtx->channels] / SHRT_MAX;
+ pDataOut++;
+ }
+ }
+ break;
+
+ case SAMPLE_FMT_S32 :
+ pBuff.SetCount (nPCMLength / 4);
+ pDataOut = pBuff.GetData();
+
+ for (int i=0; i<pBuff.GetCount()/m_pAVCtx->channels; i++)
+ {
+ for(int ch=0; ch<m_pAVCtx->channels; ch++)
+ {
+ *pDataOut = (float)((int32_t*)m_pPCMData) [scmap.ch[ch]+i*m_pAVCtx->channels] / INT_MAX;
+ pDataOut++;
+ }
+ }
+ break;
+ default :
+ ASSERT(FALSE);
+ break;
+ }
+ hr = Deliver(pBuff, m_pAVCtx->sample_rate, m_pAVCtx->channels, scmap.dwChannelMask);
+ }
+ }
+ }
+
+ return hr;
}
#else
HRESULT CMpaDecFilter::DeliverFfmpeg(int nCodecId, BYTE* p, int buffsize, int& size)
{
- HRESULT hr = S_OK;
- int nPCMLength = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-
- if(!m_pAVCtx || nCodecId != m_pAVCtx->codec_id)
- if(!InitFfmpeg(nCodecId))
- {
- size = 0;
- return E_FAIL;
- }
-
- size = avcodec_decode_audio2(m_pAVCtx, (int16_t*)m_pPCMData, &nPCMLength, (const uint8_t*)p, buffsize);
- size = min(size, buffsize);
-
- if(size > 0 && nPCMLength > 0)
- {
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
- CAtlArray<float> pBuff;
- int iSpeakerConfig;
- int nRemap;
- float* pDataOut;
-
- scmap_t* scmap;
-
- switch(nCodecId)
- {
- case CODEC_ID_EAC3 :
- scmap = &m_ffmpeg_ac3[FFGetChannelMap(m_pAVCtx)];
- break;
- default :
- scmap = &m_scmap_default[m_pAVCtx->channels-1];
- break;
- }
-
- switch(m_pAVCtx->sample_fmt)
- {
- case SAMPLE_FMT_S16 :
- pBuff.SetCount(nPCMLength / 2);
- pDataOut = pBuff.GetData();
-
- for(size_t i = 0; i < pBuff.GetCount() / m_pAVCtx->channels; i++)
- {
- for(int ch = 0; ch < m_pAVCtx->channels; ch++)
- {
- *pDataOut = (float)((int16_t*)m_pPCMData)[scmap->ch[ch] + i * m_pAVCtx->channels] / SHRT_MAX;
- pDataOut++;
- }
- }
- break;
-
- case SAMPLE_FMT_S32 :
- pBuff.SetCount(nPCMLength / 4);
- pDataOut = pBuff.GetData();
-
- for(size_t i = 0; i < pBuff.GetCount() / m_pAVCtx->channels; i++)
- {
- for(int ch = 0; ch < m_pAVCtx->channels; ch++)
- {
- *pDataOut = (float)((int32_t*)m_pPCMData)[scmap->ch[ch] + i * m_pAVCtx->channels] / INT_MAX;
- pDataOut++;
- }
- }
- break;
- default :
- ASSERT(FALSE);
- break;
- }
- hr = Deliver(pBuff, m_pAVCtx->sample_rate, scmap->nChannels, scmap->dwChannelMask);
- }
-
- return hr;
+ HRESULT hr = S_OK;
+ int nPCMLength = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+
+ if (!m_pAVCtx || nCodecId != m_pAVCtx->codec_id)
+ if (!InitFfmpeg (nCodecId))
+ {
+ size = 0;
+ return E_FAIL;
+ }
+
+ size = avcodec_decode_audio2(m_pAVCtx, (int16_t*)m_pPCMData, &nPCMLength, (const uint8_t*)p, buffsize);
+ size = min (size, buffsize);
+
+ if (size>0 && nPCMLength>0)
+ {
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ CAtlArray<float> pBuff;
+ int iSpeakerConfig;
+ int nRemap;
+ float* pDataOut;
+
+ scmap_t* scmap;
+
+ switch (nCodecId)
+ {
+ case CODEC_ID_EAC3 :
+ scmap = &m_ffmpeg_ac3[FFGetChannelMap(m_pAVCtx)];
+ break;
+ default :
+ scmap = &m_scmap_default[m_pAVCtx->channels-1];
+ break;
+ }
+
+ switch (m_pAVCtx->sample_fmt)
+ {
+ case SAMPLE_FMT_S16 :
+ pBuff.SetCount (nPCMLength / 2);
+ pDataOut = pBuff.GetData();
+
+ for (size_t i=0; i<pBuff.GetCount()/m_pAVCtx->channels; i++)
+ {
+ for(int ch=0; ch<m_pAVCtx->channels; ch++)
+ {
+ *pDataOut = (float)((int16_t*)m_pPCMData) [scmap->ch[ch]+i*m_pAVCtx->channels] / SHRT_MAX;
+ pDataOut++;
+ }
+ }
+ break;
+
+ case SAMPLE_FMT_S32 :
+ pBuff.SetCount (nPCMLength / 4);
+ pDataOut = pBuff.GetData();
+
+ for (size_t i=0; i<pBuff.GetCount()/m_pAVCtx->channels; i++)
+ {
+ for(int ch=0; ch<m_pAVCtx->channels; ch++)
+ {
+ *pDataOut = (float)((int32_t*)m_pPCMData) [scmap->ch[ch]+i*m_pAVCtx->channels] / INT_MAX;
+ pDataOut++;
+ }
+ }
+ break;
+ default :
+ ASSERT(FALSE);
+ break;
+ }
+ hr = Deliver(pBuff, m_pAVCtx->sample_rate, scmap->nChannels, scmap->dwChannelMask);
+ }
+
+ return hr;
}
#endif
bool CMpaDecFilter::InitFfmpeg(int nCodecId)
{
- WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
- bool bRet = false;
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ bool bRet = false;
- avcodec_init();
- avcodec_register_all();
+ avcodec_init();
+ avcodec_register_all();
#ifdef _DEBUG
- av_log_set_callback(LogLibAVCodec);
+ av_log_set_callback(LogLibAVCodec);
#endif
- if(m_pAVCodec) ffmpeg_stream_finish();
+ if (m_pAVCodec) ffmpeg_stream_finish();
- m_pAVCodec = avcodec_find_decoder((CodecID)nCodecId);
- if(m_pAVCodec)
- {
- if(nCodecId == CODEC_ID_AMR_NB || nCodecId == CODEC_ID_AMR_WB)
- {
- wfein->nChannels = 1;
- wfein->nSamplesPerSec = 8000;
- }
+ m_pAVCodec = avcodec_find_decoder((CodecID)nCodecId);
+ if (m_pAVCodec)
+ {
+ if (nCodecId==CODEC_ID_AMR_NB || nCodecId== CODEC_ID_AMR_WB)
+ {
+ wfein->nChannels = 1;
+ wfein->nSamplesPerSec = 8000;
+ }
- m_pAVCtx = avcodec_alloc_context();
- m_pAVCtx->sample_rate = wfein->nSamplesPerSec;
- m_pAVCtx->channels = wfein->nChannels;
- m_pAVCtx->bit_rate = wfein->nAvgBytesPerSec * 8;
- m_pAVCtx->bits_per_coded_sample = wfein->wBitsPerSample;
- m_pAVCtx->block_align = wfein->nBlockAlign;
- m_pAVCtx->flags |= CODEC_FLAG_TRUNCATED;
+ m_pAVCtx = avcodec_alloc_context();
+ m_pAVCtx->sample_rate = wfein->nSamplesPerSec;
+ m_pAVCtx->channels = wfein->nChannels;
+ m_pAVCtx->bit_rate = wfein->nAvgBytesPerSec*8;
+ m_pAVCtx->bits_per_coded_sample = wfein->wBitsPerSample;
+ m_pAVCtx->block_align = wfein->nBlockAlign;
+ m_pAVCtx->flags |= CODEC_FLAG_TRUNCATED;
- m_pAVCtx->codec_id = (CodecID)nCodecId;
- m_pParser = av_parser_init(nCodecId);
+ m_pAVCtx->codec_id = (CodecID)nCodecId;
+ m_pParser = av_parser_init(nCodecId);
- if(avcodec_open(m_pAVCtx, m_pAVCodec) >= 0)
- {
- m_pPCMData = (BYTE*)FF_aligned_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE, 64);
- bRet = true;
- }
- }
+ if (avcodec_open(m_pAVCtx,m_pAVCodec)>=0)
+ {
+ m_pPCMData = (BYTE*)FF_aligned_malloc (AVCODEC_MAX_AUDIO_FRAME_SIZE+FF_INPUT_BUFFER_PADDING_SIZE, 64);
+ bRet = true;
+ }
+ }
- if(!bRet) ffmpeg_stream_finish();
+ if (!bRet) ffmpeg_stream_finish();
- return bRet;
+ return bRet;
}
-void CMpaDecFilter::LogLibAVCodec(void* par, int level, const char *fmt, va_list valist)
+void CMpaDecFilter::LogLibAVCodec(void* par,int level,const char *fmt,va_list valist)
{
- char Msg [500];
- vsnprintf_s(Msg, sizeof(Msg), _TRUNCATE, fmt, valist);
- TRACE("AVLIB : %s", Msg);
+ char Msg [500];
+ vsnprintf_s (Msg, sizeof(Msg), _TRUNCATE, fmt, valist);
+ TRACE("AVLIB : %s", Msg);
}
void CMpaDecFilter::ffmpeg_stream_finish()
{
- m_pAVCodec = NULL;
- if(m_pAVCtx)
- {
- avcodec_close(m_pAVCtx);
- av_free(m_pAVCtx);
- m_pAVCtx = NULL;
- }
-
- if(m_pParser)
- {
- av_parser_close(m_pParser);
- m_pParser = NULL;
- }
-
- if(m_pPCMData) FF_aligned_free(m_pPCMData);
+ m_pAVCodec = NULL;
+ if (m_pAVCtx)
+ {
+ avcodec_close (m_pAVCtx);
+ av_free (m_pAVCtx);
+ m_pAVCtx = NULL;
+ }
+
+ if (m_pParser)
+ {
+ av_parser_close (m_pParser);
+ m_pParser = NULL;
+ }
+
+ if (m_pPCMData) FF_aligned_free (m_pPCMData);
}
#pragma endregion
diff --git a/src/filters/transform/MpaDecFilter/MpaDecFilter.h b/src/filters/transform/MpaDecFilter/MpaDecFilter.h
index e02bc21dd..6c1711fae 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecFilter.h
+++ b/src/filters/transform/MpaDecFilter/MpaDecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -36,52 +36,45 @@
struct aac_state_t
{
- void* h; // NeAACDecHandle h;
- DWORD freq;
- BYTE channels;
-
- aac_state_t();
- ~aac_state_t();
- bool open();
- void close();
- bool init(const CMediaType& mt);
+ void* h; // NeAACDecHandle h;
+ DWORD freq;
+ BYTE channels;
+
+ aac_state_t();
+ ~aac_state_t();
+ bool open();
+ void close();
+ bool init(const CMediaType& mt);
};
struct ps2_state_t
{
- bool sync;
- double a[2], b[2];
- ps2_state_t()
- {
- reset();
- }
- void reset()
- {
- sync = false;
- a[0] = a[1] = b[0] = b[1] = 0;
- }
+ bool sync;
+ double a[2], b[2];
+ ps2_state_t() {reset();}
+ void reset() {sync = false; a[0] = a[1] = b[0] = b[1] = 0;}
};
struct vorbis_state_t
{
- vorbis_info vi;
- vorbis_comment vc;
- vorbis_block vb;
- vorbis_dsp_state vd;
- ogg_packet op;
- int packetno;
- double postgain;
-
- vorbis_state_t();
- ~vorbis_state_t();
- void clear();
- bool init(const CMediaType& mt);
+ vorbis_info vi;
+ vorbis_comment vc;
+ vorbis_block vb;
+ vorbis_dsp_state vd;
+ ogg_packet op;
+ int packetno;
+ double postgain;
+
+ vorbis_state_t();
+ ~vorbis_state_t();
+ void clear();
+ bool init(const CMediaType& mt);
};
struct flac_state_t
{
- void* pDecoder;
- HRESULT hr;
+ void* pDecoder;
+ HRESULT hr;
};
struct AVCodec;
@@ -91,83 +84,83 @@ struct AVCodecParserContext;
[uuid("3D446B6F-71DE-4437-BE15-8CE47174340F")]
-class CMpaDecFilter
- : public CTransformFilter
- , public IMpaDecFilter
- , public ISpecifyPropertyPages2
+class CMpaDecFilter
+ : public CTransformFilter
+ , public IMpaDecFilter
+ , public ISpecifyPropertyPages2
{
protected:
- CCritSec m_csReceive;
-
- a52_state_t* m_a52_state;
- dts_state_t* m_dts_state;
- aac_state_t m_aac_state;
- mad_stream m_stream;
- mad_frame m_frame;
- mad_synth m_synth;
- ps2_state_t m_ps2_state;
- vorbis_state_t m_vorbis;
- flac_state_t m_flac;
- DolbyDigitalMode m_DolbyDigitalMode;
-
- // === FFMpeg variables
- AVCodec* m_pAVCodec;
- AVCodecContext* m_pAVCtx;
- AVCodecParserContext* m_pParser;
- BYTE* m_pPCMData;
-
- CAtlArray<BYTE> m_buff;
- REFERENCE_TIME m_rtStart;
- bool m_fDiscontinuity;
-
- float m_sample_max;
-
- HRESULT ProcessLPCM();
- HRESULT ProcessHdmvLPCM(bool bAlignOldBuffer);
- HRESULT ProcessAC3();
- HRESULT ProcessA52(BYTE* p, int buffsize, int& size, bool& fEnoughData);
- HRESULT ProcessDTS();
- HRESULT ProcessAAC();
- HRESULT ProcessPS2PCM();
- HRESULT ProcessPS2ADPCM();
- HRESULT ProcessVorbis();
- HRESULT ProcessFlac();
- HRESULT ProcessMPA();
- HRESULT ProcessFfmpeg(int nCodecId);
-
- HRESULT GetDeliveryBuffer(IMediaSample** pSample, BYTE** pData);
- HRESULT Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
- HRESULT Deliver(BYTE* pBuff, int size, int bit_rate, BYTE type);
- HRESULT ReconnectOutput(int nSamples, CMediaType& mt);
- CMediaType CreateMediaType(MPCSampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
- CMediaType CreateMediaTypeSPDIF();
-
- void FlacInitDecoder();
- void flac_stream_finish();
-
- bool InitFfmpeg(int nCodecId);
- void ffmpeg_stream_finish();
- HRESULT DeliverFfmpeg(int nCodecId, BYTE* p, int buffsize, int& size);
- static void LogLibAVCodec(void* par, int level, const char *fmt, va_list valist);
+ CCritSec m_csReceive;
+
+ a52_state_t* m_a52_state;
+ dts_state_t* m_dts_state;
+ aac_state_t m_aac_state;
+ mad_stream m_stream;
+ mad_frame m_frame;
+ mad_synth m_synth;
+ ps2_state_t m_ps2_state;
+ vorbis_state_t m_vorbis;
+ flac_state_t m_flac;
+ DolbyDigitalMode m_DolbyDigitalMode;
+
+ // === FFMpeg variables
+ AVCodec* m_pAVCodec;
+ AVCodecContext* m_pAVCtx;
+ AVCodecParserContext* m_pParser;
+ BYTE* m_pPCMData;
+
+ CAtlArray<BYTE> m_buff;
+ REFERENCE_TIME m_rtStart;
+ bool m_fDiscontinuity;
+
+ float m_sample_max;
+
+ HRESULT ProcessLPCM();
+ HRESULT ProcessHdmvLPCM(bool bAlignOldBuffer);
+ HRESULT ProcessAC3();
+ HRESULT ProcessA52(BYTE* p, int buffsize, int& size, bool& fEnoughData);
+ HRESULT ProcessDTS();
+ HRESULT ProcessAAC();
+ HRESULT ProcessPS2PCM();
+ HRESULT ProcessPS2ADPCM();
+ HRESULT ProcessVorbis();
+ HRESULT ProcessFlac();
+ HRESULT ProcessMPA();
+ HRESULT ProcessFfmpeg(int nCodecId);
+
+ HRESULT GetDeliveryBuffer(IMediaSample** pSample, BYTE** pData);
+ HRESULT Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
+ HRESULT Deliver(BYTE* pBuff, int size, int bit_rate, BYTE type);
+ HRESULT ReconnectOutput(int nSamples, CMediaType& mt);
+ CMediaType CreateMediaType(MPCSampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
+ CMediaType CreateMediaTypeSPDIF();
+
+ void FlacInitDecoder();
+ void flac_stream_finish();
+
+ bool InitFfmpeg(int nCodecId);
+ void ffmpeg_stream_finish();
+ HRESULT DeliverFfmpeg(int nCodecId, BYTE* p, int buffsize, int& size);
+ static void LogLibAVCodec(void* par,int level,const char *fmt,va_list valist);
protected:
- CCritSec m_csProps;
- MPCSampleFormat m_iSampleFormat;
- bool m_fNormalize;
- int m_iSpeakerConfig[etlast];
- bool m_fDynamicRangeControl[etlast];
- float m_boost;
+ CCritSec m_csProps;
+ MPCSampleFormat m_iSampleFormat;
+ bool m_fNormalize;
+ int m_iSpeakerConfig[etlast];
+ bool m_fDynamicRangeControl[etlast];
+ float m_boost;
public:
- CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CMpaDecFilter();
+ CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CMpaDecFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
HRESULT EndOfStream();
- HRESULT BeginFlush();
- HRESULT EndFlush();
+ HRESULT BeginFlush();
+ HRESULT EndFlush();
HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
HRESULT Receive(IMediaSample* pIn);
@@ -176,32 +169,32 @@ public:
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
- // ISpecifyPropertyPages2
+ // ISpecifyPropertyPages2
- STDMETHODIMP GetPages(CAUUID* pPages);
- STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
+ STDMETHODIMP GetPages(CAUUID* pPages);
+ STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
- // IMpaDecFilter
+ // IMpaDecFilter
- STDMETHODIMP SetSampleFormat(MPCSampleFormat sf);
- STDMETHODIMP_(MPCSampleFormat) GetSampleFormat();
- STDMETHODIMP SetNormalize(bool fNormalize);
- STDMETHODIMP_(bool) GetNormalize();
- STDMETHODIMP SetSpeakerConfig(enctype et, int sc);
- STDMETHODIMP_(int) GetSpeakerConfig(enctype et);
- STDMETHODIMP SetDynamicRangeControl(enctype et, bool fDRC);
- STDMETHODIMP_(bool) GetDynamicRangeControl(enctype et);
- STDMETHODIMP SetBoost(float boost);
- STDMETHODIMP_(float) GetBoost();
- STDMETHODIMP_(DolbyDigitalMode) GetDolbyDigitalMode();
+ STDMETHODIMP SetSampleFormat(MPCSampleFormat sf);
+ STDMETHODIMP_(MPCSampleFormat) GetSampleFormat();
+ STDMETHODIMP SetNormalize(bool fNormalize);
+ STDMETHODIMP_(bool) GetNormalize();
+ STDMETHODIMP SetSpeakerConfig(enctype et, int sc);
+ STDMETHODIMP_(int) GetSpeakerConfig(enctype et);
+ STDMETHODIMP SetDynamicRangeControl(enctype et, bool fDRC);
+ STDMETHODIMP_(bool) GetDynamicRangeControl(enctype et);
+ STDMETHODIMP SetBoost(float boost);
+ STDMETHODIMP_(float) GetBoost();
+ STDMETHODIMP_(DolbyDigitalMode) GetDolbyDigitalMode();
- STDMETHODIMP SaveSettings();
+ STDMETHODIMP SaveSettings();
- void FlacFillBuffer(BYTE buffer[], size_t *bytes);
- void FlacDeliverBuffer(unsigned blocksize, const __int32 * const buffer[]);
+ void FlacFillBuffer(BYTE buffer[], size_t *bytes);
+ void FlacDeliverBuffer (unsigned blocksize, const __int32 * const buffer[]);
};
class CMpaDecInputPin : public CDeCSSInputPin
diff --git a/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp b/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp
index aebb06fbe..fe8fab2d7 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp
+++ b/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -36,207 +36,207 @@ static TCHAR m_strDecodeToSpeaker[50];
CMpaDecSettingsWnd::CMpaDecSettingsWnd()
{
- wcscpy(m_strDecodeToSpeaker, ResStr(IDS_MPADECSETTINGSWND_5));
+ wcscpy (m_strDecodeToSpeaker, ResStr(IDS_MPADECSETTINGSWND_5));
}
bool CMpaDecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
{
- ASSERT(!m_pMDF);
-
- m_pMDF.Release();
+ ASSERT(!m_pMDF);
- POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+ m_pMDF.Release();
- if(!m_pMDF) return false;
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+
+ if(!m_pMDF) return false;
- m_outputformat = m_pMDF->GetSampleFormat();
- m_ac3spkcfg = m_pMDF->GetSpeakerConfig(IMpaDecFilter::ac3);
- m_ac3drc = m_pMDF->GetDynamicRangeControl(IMpaDecFilter::ac3);
- m_dtsspkcfg = m_pMDF->GetSpeakerConfig(IMpaDecFilter::dts);
- m_dtsdrc = m_pMDF->GetDynamicRangeControl(IMpaDecFilter::dts);
- m_aacdownmix = !!m_pMDF->GetSpeakerConfig(IMpaDecFilter::aac);
- m_ddmode = m_pMDF->GetDolbyDigitalMode();
+ m_outputformat = m_pMDF->GetSampleFormat();
+ m_ac3spkcfg = m_pMDF->GetSpeakerConfig(IMpaDecFilter::ac3);
+ m_ac3drc = m_pMDF->GetDynamicRangeControl(IMpaDecFilter::ac3);
+ m_dtsspkcfg = m_pMDF->GetSpeakerConfig(IMpaDecFilter::dts);
+ m_dtsdrc = m_pMDF->GetDynamicRangeControl(IMpaDecFilter::dts);
+ m_aacdownmix = !!m_pMDF->GetSpeakerConfig(IMpaDecFilter::aac);
+ m_ddmode = m_pMDF->GetDolbyDigitalMode();
- return true;
+ return true;
}
void CMpaDecSettingsWnd::OnDisconnect()
{
- m_pMDF.Release();
+ m_pMDF.Release();
}
-LPCTSTR CMpaDecSettingsWnd::GetDolbyMode(DolbyDigitalMode ddmode)
+LPCTSTR CMpaDecSettingsWnd::GetDolbyMode (DolbyDigitalMode ddmode)
{
- switch(ddmode)
- {
- case DD_AC3 :
- return _T(" (AC3)");
- case DD_EAC3 :
- return _T(" (Dolby Digital Plus)");
- case DD_TRUEHD :
- return _T(" (Dolby True HD)");
- case DD_MLP :
- return _T(" (MLP)");
- default :
- return _T("");
- }
+ switch (ddmode)
+ {
+ case DD_AC3 :
+ return _T(" (AC3)");
+ case DD_EAC3 :
+ return _T(" (Dolby Digital Plus)");
+ case DD_TRUEHD :
+ return _T(" (Dolby True HD)");
+ case DD_MLP :
+ return _T(" (MLP)");
+ default :
+ return _T("");
+ }
}
bool CMpaDecSettingsWnd::OnActivate()
{
- DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
- CRect r;
+ CRect r;
- CPoint p(10, 10);
+ CPoint p(10, 10);
- m_outputformat_static.Create(ResStr(IDS_MPADECSETTINGSWND_0), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+ m_outputformat_static.Create(ResStr(IDS_MPADECSETTINGSWND_0), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
- p.y += m_fontheight + 5;
+ p.y += m_fontheight + 5;
- m_outputformat_combo.Create(dwStyle | CBS_DROPDOWNLIST, CRect(p + CSize(10, 0), CSize(100, 200)), this, IDC_PP_COMBO1);
- m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 16 Bit")), SF_PCM16);
- m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 24 Bit")), SF_PCM24);
- m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 32 Bit")), SF_PCM32);
- m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("IEEE Float")), SF_FLOAT32);
- m_outputformat_combo.SetCurSel(0);
+ m_outputformat_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(10, 0), CSize(100, 200)), this, IDC_PP_COMBO1);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 16 Bit")), SF_PCM16);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 24 Bit")), SF_PCM24);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 32 Bit")), SF_PCM32);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("IEEE Float")), SF_FLOAT32);
+ m_outputformat_combo.SetCurSel(0);
- for(int i = 0; i < m_outputformat_combo.GetCount(); i++)
- if((int)m_outputformat_combo.GetItemData(i) == m_outputformat)
- m_outputformat_combo.SetCurSel(i);
+ for(int i = 0; i < m_outputformat_combo.GetCount(); i++)
+ if((int)m_outputformat_combo.GetItemData(i) == m_outputformat)
+ m_outputformat_combo.SetCurSel(i);
- p.y += 30;
+ p.y += 30;
- CString strSpeak;
- strSpeak.Format(_T("%s%s"), ResStr(IDS_MPADECSETTINGSWND_1), GetDolbyMode(m_ddmode));
- m_ac3spkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_1) + GetDolbyMode(m_ddmode), dwStyle, CRect(p, CSize(220, m_fontheight)), this);
+ CString strSpeak;
+ strSpeak.Format (_T("%s%s"), ResStr(IDS_MPADECSETTINGSWND_1), GetDolbyMode(m_ddmode));
+ m_ac3spkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_1) + GetDolbyMode(m_ddmode), dwStyle, CRect(p, CSize(220, m_fontheight)), this);
- p.y += m_fontheight + 5;
+ p.y += m_fontheight + 5;
- m_ac3spkcfg_combo.Create(dwStyle | CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO2);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Mono")), A52_MONO);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dual Mono")), A52_CHANNEL);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Stereo")), A52_STEREO);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dolby Stereo")), A52_DOLBY);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F)), A52_3F);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), A52_2F1R);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), A52_3F1R);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), A52_2F2R);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), A52_3F2R);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_1)), A52_CHANNEL1);
- m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_2)), A52_CHANNEL2);
+ m_ac3spkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO2);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Mono")), A52_MONO);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dual Mono")), A52_CHANNEL);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Stereo")), A52_STEREO);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dolby Stereo")), A52_DOLBY);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F)), A52_3F);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), A52_2F1R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), A52_3F1R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), A52_2F2R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), A52_3F2R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_1)), A52_CHANNEL1);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_2)), A52_CHANNEL2);
- for(int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++)
- if((int)m_ac3spkcfg_combo.GetItemData(i) == sel)
- m_ac3spkcfg_combo.SetCurSel(i);
+ for(int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++)
+ if((int)m_ac3spkcfg_combo.GetItemData(i) == sel)
+ m_ac3spkcfg_combo.SetCurSel(i);
- m_ac3spkcfg_combo.GetWindowRect(r);
- ScreenToClient(r);
+ m_ac3spkcfg_combo.GetWindowRect(r);
+ ScreenToClient(r);
- m_ac3lfe_check.Create(_T("LFE"), dwStyle | BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK4);
- m_ac3lfe_check.SetCheck(!!(abs(m_ac3spkcfg) & A52_LFE));
+ m_ac3lfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK4);
+ m_ac3lfe_check.SetCheck(!!(abs(m_ac3spkcfg) & A52_LFE));
- for(int i = 0, h = max(20, m_fontheight) + 1; i < countof(m_ac3spkcfg_radio); i++, p.y += h)
- {
- static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")};
- m_ac3spkcfg_radio[i].Create(labels[i], dwStyle | BS_AUTORADIOBUTTON | (i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO1 + i);
- }
+ for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_ac3spkcfg_radio); i++, p.y += h)
+ {
+ static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")};
+ m_ac3spkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO1+i);
+ }
- CheckRadioButton(IDC_PP_RADIO1, IDC_PP_RADIO2, m_ac3spkcfg >= 0 ? IDC_PP_RADIO1 : IDC_PP_RADIO2);
+ CheckRadioButton(IDC_PP_RADIO1, IDC_PP_RADIO2, m_ac3spkcfg >= 0 ? IDC_PP_RADIO1 : IDC_PP_RADIO2);
- p.y += 5;
+ p.y += 5;
- m_ac3spkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle | BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK1);
- m_ac3spkcfg_check.SetCheck(m_ac3drc);
+ m_ac3spkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK1);
+ m_ac3spkcfg_check.SetCheck(m_ac3drc);
- p.y += m_fontheight + 10;
+ p.y += m_fontheight + 10;
- m_dtsspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_7), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+ m_dtsspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_7), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
- p.y += m_fontheight + 5;
+ p.y += m_fontheight + 5;
- m_dtsspkcfg_combo.Create(dwStyle | CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO3);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Mono")), DTS_MONO);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Dual Mono")), DTS_CHANNEL);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo")), DTS_STEREO);
- //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_SUMDIFF);
- //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_TOTAL);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F)), DTS_3F);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), DTS_2F1R);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), DTS_3F1R);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), DTS_2F2R);
- m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), DTS_3F2R);
+ m_dtsspkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO3);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Mono")), DTS_MONO);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Dual Mono")), DTS_CHANNEL);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo")), DTS_STEREO);
+ //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_SUMDIFF);
+ //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_TOTAL);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F)), DTS_3F);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), DTS_2F1R);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), DTS_3F1R);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), DTS_2F2R);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), DTS_3F2R);
- for(int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++)
- if((int)m_dtsspkcfg_combo.GetItemData(i) == sel)
- m_dtsspkcfg_combo.SetCurSel(i);
+ for(int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++)
+ if((int)m_dtsspkcfg_combo.GetItemData(i) == sel)
+ m_dtsspkcfg_combo.SetCurSel(i);
- m_dtsspkcfg_combo.GetWindowRect(r);
- ScreenToClient(r);
+ m_dtsspkcfg_combo.GetWindowRect(r);
+ ScreenToClient(r);
- m_dtslfe_check.Create(_T("LFE"), dwStyle | BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK5);
- m_dtslfe_check.SetCheck(!!(abs(m_dtsspkcfg) & DTS_LFE));
+ m_dtslfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK5);
+ m_dtslfe_check.SetCheck(!!(abs(m_dtsspkcfg) & DTS_LFE));
- for(int i = 0, h = max(20, m_fontheight) + 1; i < countof(m_dtsspkcfg_radio); i++, p.y += h)
- {
- static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")};
- m_dtsspkcfg_radio[i].Create(labels[i], dwStyle | BS_AUTORADIOBUTTON | (i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO3 + i);
- }
+ for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_dtsspkcfg_radio); i++, p.y += h)
+ {
+ static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")};
+ m_dtsspkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO3+i);
+ }
- CheckRadioButton(IDC_PP_RADIO3, IDC_PP_RADIO4, m_dtsspkcfg >= 0 ? IDC_PP_RADIO3 : IDC_PP_RADIO4);
+ CheckRadioButton(IDC_PP_RADIO3, IDC_PP_RADIO4, m_dtsspkcfg >= 0 ? IDC_PP_RADIO3 : IDC_PP_RADIO4);
- p.y += 5;
+ p.y += 5;
- m_dtsspkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle | WS_DISABLED | BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK2);
- m_dtsspkcfg_check.SetCheck(m_dtsdrc);
+ m_dtsspkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|WS_DISABLED|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK2);
+ m_dtsspkcfg_check.SetCheck(m_dtsdrc);
- p.y += m_fontheight + 10;
+ p.y += m_fontheight + 10;
- m_aacspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_11), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+ m_aacspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_11), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
- p.y += m_fontheight + 5;
+ p.y += m_fontheight + 5;
- m_aacdownmix_check.Create(ResStr(IDS_MPADECSETTINGSWND_12), dwStyle | BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK3);
- m_aacdownmix_check.SetCheck(m_aacdownmix);
+ m_aacdownmix_check.Create(ResStr(IDS_MPADECSETTINGSWND_12), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK3);
+ m_aacdownmix_check.SetCheck(m_aacdownmix);
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
- pWnd->SetFont(&m_font, FALSE);
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
- return true;
+ return true;
}
void CMpaDecSettingsWnd::OnDeactivate()
{
- m_outputformat = m_outputformat_combo.GetItemData(m_outputformat_combo.GetCurSel());
- m_ac3spkcfg = m_ac3spkcfg_combo.GetItemData(m_ac3spkcfg_combo.GetCurSel());
- if(!!m_ac3lfe_check.GetCheck()) m_ac3spkcfg |= A52_LFE;
- if(IsDlgButtonChecked(IDC_PP_RADIO2)) m_ac3spkcfg = -m_ac3spkcfg;
- m_ac3drc = !!m_ac3spkcfg_check.GetCheck();
- m_dtsspkcfg = m_dtsspkcfg_combo.GetItemData(m_dtsspkcfg_combo.GetCurSel());
- if(!!m_dtslfe_check.GetCheck()) m_dtsspkcfg |= DTS_LFE;
- if(IsDlgButtonChecked(IDC_PP_RADIO4)) m_dtsspkcfg = -m_dtsspkcfg;
- m_dtsdrc = !!m_dtsspkcfg_check.GetCheck();
- m_aacdownmix = !!m_aacdownmix_check.GetCheck();
+ m_outputformat = m_outputformat_combo.GetItemData(m_outputformat_combo.GetCurSel());
+ m_ac3spkcfg = m_ac3spkcfg_combo.GetItemData(m_ac3spkcfg_combo.GetCurSel());
+ if(!!m_ac3lfe_check.GetCheck()) m_ac3spkcfg |= A52_LFE;
+ if(IsDlgButtonChecked(IDC_PP_RADIO2)) m_ac3spkcfg = -m_ac3spkcfg;
+ m_ac3drc = !!m_ac3spkcfg_check.GetCheck();
+ m_dtsspkcfg = m_dtsspkcfg_combo.GetItemData(m_dtsspkcfg_combo.GetCurSel());
+ if(!!m_dtslfe_check.GetCheck()) m_dtsspkcfg |= DTS_LFE;
+ if(IsDlgButtonChecked(IDC_PP_RADIO4)) m_dtsspkcfg = -m_dtsspkcfg;
+ m_dtsdrc = !!m_dtsspkcfg_check.GetCheck();
+ m_aacdownmix = !!m_aacdownmix_check.GetCheck();
}
bool CMpaDecSettingsWnd::OnApply()
{
- OnDeactivate();
+ OnDeactivate();
- if(m_pMDF)
- {
- m_pMDF->SetSampleFormat((MPCSampleFormat)m_outputformat);
- m_pMDF->SetSpeakerConfig(IMpaDecFilter::ac3, m_ac3spkcfg);
- m_pMDF->SetDynamicRangeControl(IMpaDecFilter::ac3, m_ac3drc);
- m_pMDF->SetSpeakerConfig(IMpaDecFilter::dts, m_dtsspkcfg);
- m_pMDF->SetDynamicRangeControl(IMpaDecFilter::dts, m_dtsdrc);
- m_pMDF->SetSpeakerConfig(IMpaDecFilter::aac, m_aacdownmix);
+ if(m_pMDF)
+ {
+ m_pMDF->SetSampleFormat((MPCSampleFormat)m_outputformat);
+ m_pMDF->SetSpeakerConfig(IMpaDecFilter::ac3, m_ac3spkcfg);
+ m_pMDF->SetDynamicRangeControl(IMpaDecFilter::ac3, m_ac3drc);
+ m_pMDF->SetSpeakerConfig(IMpaDecFilter::dts, m_dtsspkcfg);
+ m_pMDF->SetDynamicRangeControl(IMpaDecFilter::dts, m_dtsdrc);
+ m_pMDF->SetSpeakerConfig(IMpaDecFilter::aac, m_aacdownmix);
- m_pMDF->SaveSettings();
- }
+ m_pMDF->SaveSettings();
+ }
- return true;
+ return true;
}
BEGIN_MESSAGE_MAP(CMpaDecSettingsWnd, CInternalPropertyPageWnd)
diff --git a/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.h b/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.h
index e48163385..cf459b705 100644
--- a/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.h
+++ b/src/filters/transform/MpaDecFilter/MpaDecSettingsWnd.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,65 +28,59 @@
[uuid("24103041-884B-4772-B0D3-A600E7CBFEC7")]
class CMpaDecSettingsWnd : public CInternalPropertyPageWnd
{
- CComQIPtr<IMpaDecFilter> m_pMDF;
+ CComQIPtr<IMpaDecFilter> m_pMDF;
- int m_outputformat;
- int m_ac3spkcfg;
- bool m_ac3drc;
- int m_dtsspkcfg;
- bool m_dtsdrc;
- bool m_aacdownmix;
- DolbyDigitalMode m_ddmode;
+ int m_outputformat;
+ int m_ac3spkcfg;
+ bool m_ac3drc;
+ int m_dtsspkcfg;
+ bool m_dtsdrc;
+ bool m_aacdownmix;
+ DolbyDigitalMode m_ddmode;
- enum
- {
- IDC_PP_RADIO1 = 10000,
- IDC_PP_RADIO2,
- IDC_PP_RADIO3,
- IDC_PP_RADIO4,
- IDC_PP_COMBO1,
- IDC_PP_COMBO2,
- IDC_PP_COMBO3,
- IDC_PP_CHECK1,
- IDC_PP_CHECK2,
- IDC_PP_CHECK3,
- IDC_PP_CHECK4,
- IDC_PP_CHECK5
- };
+ enum
+ {
+ IDC_PP_RADIO1 = 10000,
+ IDC_PP_RADIO2,
+ IDC_PP_RADIO3,
+ IDC_PP_RADIO4,
+ IDC_PP_COMBO1,
+ IDC_PP_COMBO2,
+ IDC_PP_COMBO3,
+ IDC_PP_CHECK1,
+ IDC_PP_CHECK2,
+ IDC_PP_CHECK3,
+ IDC_PP_CHECK4,
+ IDC_PP_CHECK5
+ };
- CStatic m_outputformat_static;
- CComboBox m_outputformat_combo;
- CStatic m_ac3spkcfg_static;
- CButton m_ac3spkcfg_radio[2];
- CComboBox m_ac3spkcfg_combo;
- CButton m_ac3spkcfg_check;
- CButton m_ac3lfe_check;
- CStatic m_dtsspkcfg_static;
- CButton m_dtsspkcfg_radio[2];
- CComboBox m_dtsspkcfg_combo;
- CButton m_dtsspkcfg_check;
- CStatic m_aacspkcfg_static;
- CButton m_dtslfe_check;
- CButton m_aacdownmix_check;
+ CStatic m_outputformat_static;
+ CComboBox m_outputformat_combo;
+ CStatic m_ac3spkcfg_static;
+ CButton m_ac3spkcfg_radio[2];
+ CComboBox m_ac3spkcfg_combo;
+ CButton m_ac3spkcfg_check;
+ CButton m_ac3lfe_check;
+ CStatic m_dtsspkcfg_static;
+ CButton m_dtsspkcfg_radio[2];
+ CComboBox m_dtsspkcfg_combo;
+ CButton m_dtsspkcfg_check;
+ CStatic m_aacspkcfg_static;
+ CButton m_dtslfe_check;
+ CButton m_aacdownmix_check;
public:
- CMpaDecSettingsWnd();
-
- bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
- void OnDisconnect();
- bool OnActivate();
- void OnDeactivate();
- bool OnApply();
- LPCTSTR GetDolbyMode(DolbyDigitalMode ddmode);
+ CMpaDecSettingsWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
+ LPCTSTR GetDolbyMode (DolbyDigitalMode ddmode);
- static LPCTSTR GetWindowTitle()
- {
- return _T("Settings");
- }
- static CSize GetWindowSize()
- {
- return CSize(320, 320);
- }
+ static LPCTSTR GetWindowTitle() {return _T("Settings");}
+ static CSize GetWindowSize() {return CSize(320, 320);}
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
}; \ No newline at end of file
diff --git a/src/filters/transform/MpaDecFilter/a52dec/include/a52.h b/src/filters/transform/MpaDecFilter/a52dec/include/a52.h
index 5be0879c3..7701ef9ca 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/include/a52.h
+++ b/src/filters/transform/MpaDecFilter/a52dec/include/a52.h
@@ -31,12 +31,12 @@ extern "C" {
# endif
#ifndef LIBA52_DOUBLE
- typedef float sample_t;
+typedef float sample_t;
#else
- typedef double sample_t;
+typedef double sample_t;
#endif
- typedef struct a52_state_s a52_state_t;
+typedef struct a52_state_s a52_state_t;
#define A52_CHANNEL 0
#define A52_MONO 1
@@ -54,16 +54,16 @@ extern "C" {
#define A52_LFE 16
#define A52_ADJUST_LEVEL 32
- a52_state_t * a52_init(uint32_t mm_accel);
- sample_t * a52_samples(a52_state_t * state);
- int a52_syncinfo(uint8_t * buf, int * flags,
- int * sample_rate, int * bit_rate);
- int a52_frame(a52_state_t * state, uint8_t * buf, int * flags,
- sample_t * level, sample_t bias);
- void a52_dynrng(a52_state_t * state,
- sample_t (* call)(sample_t, void *), void * data);
- int a52_block(a52_state_t * state);
- void a52_free(a52_state_t * state);
+a52_state_t * a52_init (uint32_t mm_accel);
+sample_t * a52_samples (a52_state_t * state);
+int a52_syncinfo (uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate);
+int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
+ sample_t * level, sample_t bias);
+void a52_dynrng (a52_state_t * state,
+ sample_t (* call) (sample_t, void *), void * data);
+int a52_block (a52_state_t * state);
+void a52_free (a52_state_t * state);
# ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/a52_internal.h b/src/filters/transform/MpaDecFilter/a52dec/liba52/a52_internal.h
index 2e8b7ce65..50d01b83f 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/a52_internal.h
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/a52_internal.h
@@ -21,21 +21,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-typedef struct
-{
+typedef struct {
uint8_t bai; /* fine SNR offset, fast gain */
uint8_t deltbae; /* delta bit allocation exists */
int8_t deltba[50]; /* per-band delta bit allocation */
} ba_t;
-typedef struct
-{
+typedef struct {
uint8_t exp[256]; /* decoded channel exponents */
int8_t bap[256]; /* derived channel bit allocation */
} expbap_t;
-struct a52_state_s
-{
+struct a52_state_s {
uint8_t fscod; /* sample rate */
uint8_t halfrate; /* halfrate factor */
uint8_t acmod; /* coded channels */
@@ -50,7 +47,7 @@ struct a52_state_s
int dynrnge; /* apply dynamic range */
sample_t dynrng; /* dynamic range */
void * dynrngdata; /* dynamic range callback funtion and data */
- sample_t (* dynrngcall)(sample_t range, void * dynrngdata);
+ sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
uint8_t chincpl; /* channel coupled */
uint8_t phsflginu; /* phase flags in use (stereo only) */
@@ -106,18 +103,18 @@ struct a52_state_s
#define DELTA_BIT_NONE (2)
#define DELTA_BIT_RESERVED (3)
-void a52_bit_allocate(a52_state_t * state, ba_t * ba, int bndstart,
- int start, int end, int fastleak, int slowleak,
- expbap_t * expbap);
-
-int a52_downmix_init(int input, int flags, sample_t * level,
- sample_t clev, sample_t slev);
-int a52_downmix_coeff(sample_t * coeff, int acmod, int output, sample_t level,
- sample_t clev, sample_t slev);
-void a52_downmix(sample_t * samples, int acmod, int output, sample_t bias,
- sample_t clev, sample_t slev);
-void a52_upmix(sample_t * samples, int acmod, int output);
-
-void a52_imdct_init(uint32_t mm_accel);
-void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias);
-void a52_imdct_512(sample_t * data, sample_t * delay, sample_t bias);
+void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
+ int start, int end, int fastleak, int slowleak,
+ expbap_t * expbap);
+
+int a52_downmix_init (int input, int flags, sample_t * level,
+ sample_t clev, sample_t slev);
+int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
+ sample_t clev, sample_t slev);
+void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ sample_t clev, sample_t slev);
+void a52_upmix (sample_t * samples, int acmod, int output);
+
+void a52_imdct_init (uint32_t mm_accel);
+void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
+void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias);
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/bit_allocate.c b/src/filters/transform/MpaDecFilter/a52dec/liba52/bit_allocate.c
index f321c673f..564eb2492 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/bit_allocate.c
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/bit_allocate.c
@@ -28,33 +28,25 @@
#include "a52.h"
#include "a52_internal.h"
-static int hthtab[3][50] =
-{
- {
- 0x730, 0x730, 0x7c0, 0x800, 0x820, 0x840, 0x850, 0x850, 0x860, 0x860,
- 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x890, 0x890,
- 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900,
- 0x910, 0x910, 0x910, 0x910, 0x900, 0x8f0, 0x8c0, 0x870, 0x820, 0x7e0,
- 0x7a0, 0x770, 0x760, 0x7a0, 0x7c0, 0x7c0, 0x6e0, 0x400, 0x3c0, 0x3c0
- },
- {
- 0x710, 0x710, 0x7a0, 0x7f0, 0x820, 0x830, 0x840, 0x850, 0x850, 0x860,
- 0x860, 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880,
- 0x890, 0x890, 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8e0, 0x8f0,
- 0x900, 0x910, 0x910, 0x910, 0x910, 0x900, 0x8e0, 0x8b0, 0x870, 0x820,
- 0x7e0, 0x7b0, 0x760, 0x770, 0x7a0, 0x7c0, 0x780, 0x5d0, 0x3c0, 0x3c0
- },
- {
- 0x680, 0x680, 0x750, 0x7b0, 0x7e0, 0x810, 0x820, 0x830, 0x840, 0x850,
- 0x850, 0x850, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860,
- 0x870, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, 0x890, 0x8a0, 0x8b0,
- 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, 0x910, 0x910, 0x910, 0x900, 0x8f0,
- 0x8d0, 0x8b0, 0x840, 0x7f0, 0x790, 0x760, 0x7a0, 0x7c0, 0x7b0, 0x720
- }
+static int hthtab[3][50] = {
+ {0x730, 0x730, 0x7c0, 0x800, 0x820, 0x840, 0x850, 0x850, 0x860, 0x860,
+ 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x890, 0x890,
+ 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900,
+ 0x910, 0x910, 0x910, 0x910, 0x900, 0x8f0, 0x8c0, 0x870, 0x820, 0x7e0,
+ 0x7a0, 0x770, 0x760, 0x7a0, 0x7c0, 0x7c0, 0x6e0, 0x400, 0x3c0, 0x3c0},
+ {0x710, 0x710, 0x7a0, 0x7f0, 0x820, 0x830, 0x840, 0x850, 0x850, 0x860,
+ 0x860, 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880,
+ 0x890, 0x890, 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8e0, 0x8f0,
+ 0x900, 0x910, 0x910, 0x910, 0x910, 0x900, 0x8e0, 0x8b0, 0x870, 0x820,
+ 0x7e0, 0x7b0, 0x760, 0x770, 0x7a0, 0x7c0, 0x780, 0x5d0, 0x3c0, 0x3c0},
+ {0x680, 0x680, 0x750, 0x7b0, 0x7e0, 0x810, 0x820, 0x830, 0x840, 0x850,
+ 0x850, 0x850, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860,
+ 0x870, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, 0x890, 0x8a0, 0x8b0,
+ 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, 0x910, 0x910, 0x910, 0x900, 0x8f0,
+ 0x8d0, 0x8b0, 0x840, 0x7f0, 0x790, 0x760, 0x7a0, 0x7c0, 0x7b0, 0x720}
};
-static int8_t baptab[305] =
-{
+static int8_t baptab[305] = {
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
@@ -64,28 +56,26 @@ static int8_t baptab[305] =
16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 14, 14, 14, 14,
14, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9,
- 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5,
- 5, 4, 4, -3, -3, 3, 3, 3, -2, -2, -1, -1, -1, -1, -1, 0,
+ 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5,
+ 5, 4, 4, -3, -3, 3, 3, 3, -2, -2, -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 /* 148 padding elems */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0 /* 148 padding elems */
};
static int bndtab[30] = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34,
- 37, 40, 43, 46, 49, 55, 61, 67, 73, 79,
- 85, 97, 109, 121, 133, 157, 181, 205, 229, 253
- };
+ 37, 40, 43, 46, 49, 55, 61, 67, 73, 79,
+ 85, 97, 109, 121, 133, 157, 181, 205, 229, 253};
-static int8_t latab[256] =
-{
+static int8_t latab[256] = {
-64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53,
-52, -52, -51, -50, -49, -48, -47, -47, -46, -45, -44, -44,
-43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -36, -35,
@@ -95,19 +85,19 @@ static int8_t latab[256] =
-17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14,
-13, -13, -13, -13, -12, -12, -12, -12, -11, -11, -11, -11,
-10, -10, -10, -10, -10, -9, -9, -9, -9, -9, -8, -8,
- -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -6, -6,
- -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5,
- -5, -5, -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, -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, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
+ -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -6, -6,
+ -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5,
+ -5, -5, -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, -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, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
};
#define UPDATE_LEAK() \
@@ -131,15 +121,14 @@ do { \
mask -= floor; \
} while (0)
-void a52_bit_allocate(a52_state_t * state, ba_t * ba, int bndstart,
- int start, int end, int fastleak, int slowleak,
- expbap_t * expbap)
+void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
+ int start, int end, int fastleak, int slowleak,
+ expbap_t * expbap)
{
static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410};
static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100};
static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0,
- 0xa10, 0xa90, 0xb10, 0x1400
- };
+ 0xa10, 0xa90, 0xb10, 0x1400};
int i, j;
uint8_t * exp;
@@ -171,125 +160,106 @@ void a52_bit_allocate(a52_state_t * state, ba_t * ba, int bndstart,
i = bndstart;
j = start;
- if(start == 0) /* not the coupling channel */
- {
- int lowcomp;
+ if (start == 0) { /* not the coupling channel */
+ int lowcomp;
- lowcomp = 0;
- j = end - 1;
- do
- {
- if(i < j)
- {
- if(exp[i+1] == exp[i] - 2)
- lowcomp = 384;
- else if(lowcomp && (exp[i+1] > exp[i]))
- lowcomp -= 64;
- }
- psd = 128 * exp[i];
- mask = psd + fgain + lowcomp;
- COMPUTE_MASK();
- bap[i] = (baptab + 156)[mask + 4 * exp[i]];
- i++;
- }
- while((i < 3) || ((i < 7) && (exp[i] > exp[i-1])));
- fastleak = psd + fgain;
- slowleak = psd + sgain;
+ lowcomp = 0;
+ j = end - 1;
+ do {
+ if (i < j) {
+ if (exp[i+1] == exp[i] - 2)
+ lowcomp = 384;
+ else if (lowcomp && (exp[i+1] > exp[i]))
+ lowcomp -= 64;
+ }
+ psd = 128 * exp[i];
+ mask = psd + fgain + lowcomp;
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1])));
+ fastleak = psd + fgain;
+ slowleak = psd + sgain;
- while(i < 7)
- {
- if(i < j)
- {
- if(exp[i+1] == exp[i] - 2)
- lowcomp = 384;
- else if(lowcomp && (exp[i+1] > exp[i]))
- lowcomp -= 64;
- }
- psd = 128 * exp[i];
- UPDATE_LEAK();
- mask = ((fastleak + lowcomp < slowleak) ?
- fastleak + lowcomp : slowleak);
- COMPUTE_MASK();
- bap[i] = (baptab + 156)[mask + 4 * exp[i]];
- i++;
- }
+ while (i < 7) {
+ if (i < j) {
+ if (exp[i+1] == exp[i] - 2)
+ lowcomp = 384;
+ else if (lowcomp && (exp[i+1] > exp[i]))
+ lowcomp -= 64;
+ }
+ psd = 128 * exp[i];
+ UPDATE_LEAK ();
+ mask = ((fastleak + lowcomp < slowleak) ?
+ fastleak + lowcomp : slowleak);
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ }
- if(end == 7) /* lfe channel */
- return;
+ if (end == 7) /* lfe channel */
+ return;
- do
- {
- if(exp[i+1] == exp[i] - 2)
- lowcomp = 320;
- else if(lowcomp && (exp[i+1] > exp[i]))
- lowcomp -= 64;
- psd = 128 * exp[i];
- UPDATE_LEAK();
- mask = ((fastleak + lowcomp < slowleak) ?
- fastleak + lowcomp : slowleak);
- COMPUTE_MASK();
- bap[i] = (baptab + 156)[mask + 4 * exp[i]];
- i++;
- }
- while(i < 20);
+ do {
+ if (exp[i+1] == exp[i] - 2)
+ lowcomp = 320;
+ else if (lowcomp && (exp[i+1] > exp[i]))
+ lowcomp -= 64;
+ psd = 128 * exp[i];
+ UPDATE_LEAK ();
+ mask = ((fastleak + lowcomp < slowleak) ?
+ fastleak + lowcomp : slowleak);
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ } while (i < 20);
- while(lowcomp > 128) /* two iterations maximum */
- {
- lowcomp -= 128;
- psd = 128 * exp[i];
- UPDATE_LEAK();
- mask = ((fastleak + lowcomp < slowleak) ?
- fastleak + lowcomp : slowleak);
- COMPUTE_MASK();
- bap[i] = (baptab + 156)[mask + 4 * exp[i]];
- i++;
- }
- j = i;
+ while (lowcomp > 128) { /* two iterations maximum */
+ lowcomp -= 128;
+ psd = 128 * exp[i];
+ UPDATE_LEAK ();
+ mask = ((fastleak + lowcomp < slowleak) ?
+ fastleak + lowcomp : slowleak);
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ }
+ j = i;
}
- do
- {
- int startband, endband;
+ do {
+ int startband, endband;
- startband = j;
- endband = (bndtab[i-20] < end) ? bndtab[i-20] : end;
- psd = 128 * exp[j++];
- while(j < endband)
- {
- int next, delta;
+ startband = j;
+ endband = (bndtab[i-20] < end) ? bndtab[i-20] : end;
+ psd = 128 * exp[j++];
+ while (j < endband) {
+ int next, delta;
- next = 128 * exp[j++];
- delta = next - psd;
- switch(delta >> 9)
- {
- case -6:
- case -5:
- case -4:
- case -3:
- case -2:
- psd = next;
- break;
- case -1:
- psd = next + latab[(-delta) >> 1];
- break;
- case 0:
- psd += latab[delta >> 1];
- break;
- }
- }
- /* minpsd = -289 */
- UPDATE_LEAK();
- mask = (fastleak < slowleak) ? fastleak : slowleak;
- COMPUTE_MASK();
- i++;
- j = startband;
- do
- {
- /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */
- /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */
- bap[j] = (baptab + 156)[mask + 4 * exp[j]];
- }
- while(++j < endband);
- }
- while(j < end);
+ next = 128 * exp[j++];
+ delta = next - psd;
+ switch (delta >> 9) {
+ case -6: case -5: case -4: case -3: case -2:
+ psd = next;
+ break;
+ case -1:
+ psd = next + latab[(-delta) >> 1];
+ break;
+ case 0:
+ psd += latab[delta >> 1];
+ break;
+ }
+ }
+ /* minpsd = -289 */
+ UPDATE_LEAK ();
+ mask = (fastleak < slowleak) ? fastleak : slowleak;
+ COMPUTE_MASK ();
+ i++;
+ j = startband;
+ do {
+ /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */
+ /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */
+ bap[j] = (baptab+156)[mask + 4 * exp[j]];
+ } while (++j < endband);
+ } while (j < end);
}
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.c b/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.c
index 6b3dc8ff5..6b1becb7b 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.c
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.c
@@ -31,24 +31,24 @@
#define BUFFER_SIZE 4096
-void a52_bitstream_set_ptr(a52_state_t * state, uint8_t * buf)
+void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf)
{
int align;
align = (long)buf & 3;
- state->buffer_start = (uint32_t *)(buf - align);
+ state->buffer_start = (uint32_t *) (buf - align);
state->bits_left = 0;
state->current_word = 0;
- bitstream_get(state, align * 8);
- bitstream_get_2(state, 0); /* pretend function is used - keep gcc happy */
+ bitstream_get (state, align * 8);
+ bitstream_get_2 (state, 0); /* pretend function is used - keep gcc happy */
}
-static inline void bitstream_fill_current(a52_state_t * state)
+static inline void bitstream_fill_current (a52_state_t * state)
{
uint32_t tmp;
tmp = *(state->buffer_start++);
- state->current_word = swab32(tmp);
+ state->current_word = swab32 (tmp);
}
/*
@@ -60,43 +60,43 @@ static inline void bitstream_fill_current(a52_state_t * state)
* -ah
*/
-uint32_t a52_bitstream_get_bh(a52_state_t * state, uint32_t num_bits)
+uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits)
{
uint32_t result = 0;
- if(state->bits_left)
+ if (state->bits_left)
{
- num_bits -= state->bits_left;
- result = ((state->current_word << (32 - state->bits_left)) >>
- (32 - state->bits_left));
+ num_bits -= state->bits_left;
+ result = ((state->current_word << (32 - state->bits_left)) >>
+ (32 - state->bits_left));
}
- bitstream_fill_current(state);
+ bitstream_fill_current (state);
- if(num_bits != 0)
- result = (result << num_bits) | (state->current_word >> (32 - num_bits));
+ if (num_bits != 0)
+ result = (result << num_bits) | (state->current_word >> (32 - num_bits));
state->bits_left = 32 - num_bits;
return result;
}
-int32_t a52_bitstream_get_bh_2(a52_state_t * state, uint32_t num_bits)
+int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits)
{
int32_t result = 0;
- if(state->bits_left)
+ if (state->bits_left)
{
- num_bits -= state->bits_left;
- result = ((((int32_t)state->current_word) << (32 - state->bits_left))
- >> (32 - state->bits_left));
+ num_bits -= state->bits_left;
+ result = ((((int32_t)state->current_word) << (32 - state->bits_left))
+ >> (32 - state->bits_left));
}
bitstream_fill_current(state);
- if(num_bits != 0)
- result = (result << num_bits) | (state->current_word >> (32 - num_bits));
-
+ if (num_bits != 0)
+ result = (result << num_bits) | (state->current_word >> (32 - num_bits));
+
state->bits_left = 32 - num_bits;
return result;
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.h b/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.h
index 88c748c95..0d28e19f4 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.h
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/bitstream.h
@@ -31,11 +31,11 @@
# if 0 && defined (__i386__)
# define swab32(x) __i386_swab32(x)
-static inline const uint32_t __i386_swab32(uint32_t x)
-{
- __asm__("bswap %0" : "=r"(x) : "0"(x));
- return x;
-}
+ static inline const uint32_t __i386_swab32(uint32_t x)
+ {
+ __asm__("bswap %0" : "=r" (x) : "0" (x));
+ return x;
+ }
# else
@@ -46,34 +46,32 @@ static inline const uint32_t __i386_swab32(uint32_t x)
# endif
#endif
-void a52_bitstream_set_ptr(a52_state_t * state, uint8_t * buf);
-uint32_t a52_bitstream_get_bh(a52_state_t * state, uint32_t num_bits);
-int32_t a52_bitstream_get_bh_2(a52_state_t * state, uint32_t num_bits);
+void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf);
+uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits);
+int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits);
-static inline uint32_t bitstream_get(a52_state_t * state, uint32_t num_bits)
+static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits)
{
uint32_t result;
-
- if(num_bits < state->bits_left)
- {
- result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits);
- state->bits_left -= num_bits;
- return result;
+
+ if (num_bits < state->bits_left) {
+ result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits);
+ state->bits_left -= num_bits;
+ return result;
}
- return a52_bitstream_get_bh(state, num_bits);
+ return a52_bitstream_get_bh (state, num_bits);
}
-static inline int32_t bitstream_get_2(a52_state_t * state, uint32_t num_bits)
+static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits)
{
int32_t result;
-
- if(num_bits < state->bits_left)
- {
- result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits);
- state->bits_left -= num_bits;
- return result;
+
+ if (num_bits < state->bits_left) {
+ result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits);
+ state->bits_left -= num_bits;
+ return result;
}
- return a52_bitstream_get_bh_2(state, num_bits);
+ return a52_bitstream_get_bh_2 (state, num_bits);
}
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/downmix.c b/src/filters/transform/MpaDecFilter/a52dec/liba52/downmix.c
index a28842b4f..83ccb5def 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/downmix.c
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/downmix.c
@@ -31,660 +31,625 @@
#define CONVERT(acmod,output) (((output) << 3) + (acmod))
-int a52_downmix_init(int input, int flags, sample_t * level,
- sample_t clev, sample_t slev)
+int a52_downmix_init (int input, int flags, sample_t * level,
+ sample_t clev, sample_t slev)
{
- static uint8_t table[11][8] =
- {
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
- A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO
- },
- {
- A52_MONO, A52_MONO, A52_MONO, A52_MONO,
- A52_MONO, A52_MONO, A52_MONO, A52_MONO
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
- A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
- A52_STEREO, A52_3F, A52_STEREO, A52_3F
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
- A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
- A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
- A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
- A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R
- },
- {
- A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO,
- A52_MONO, A52_MONO, A52_MONO, A52_MONO
- },
- {
- A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO,
- A52_MONO, A52_MONO, A52_MONO, A52_MONO
- },
- {
- A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY,
- A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY
- }
+ static uint8_t table[11][8] = {
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
+ {A52_MONO, A52_MONO, A52_MONO, A52_MONO,
+ A52_MONO, A52_MONO, A52_MONO, A52_MONO},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
+ A52_STEREO, A52_3F, A52_STEREO, A52_3F},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
+ A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
+ A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R},
+ {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO,
+ A52_MONO, A52_MONO, A52_MONO, A52_MONO},
+ {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO,
+ A52_MONO, A52_MONO, A52_MONO, A52_MONO},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY,
+ A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY}
};
int output;
output = flags & A52_CHANNEL_MASK;
- if(output > A52_DOLBY)
- return -1;
+ if (output > A52_DOLBY)
+ return -1;
output = table[output][input & 7];
- if((output == A52_STEREO) &&
- ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB))))
- output = A52_DOLBY;
-
- if(flags & A52_ADJUST_LEVEL)
- switch(CONVERT(input & 7, output))
- {
-
- case CONVERT(A52_3F, A52_MONO):
- *level *= LEVEL_3DB / (1 + clev);
- break;
-
- case CONVERT(A52_STEREO, A52_MONO):
- case CONVERT(A52_2F2R, A52_2F1R):
- case CONVERT(A52_3F2R, A52_3F1R):
-level_3db:
- *level *= LEVEL_3DB;
- break;
-
- case CONVERT(A52_3F2R, A52_2F1R):
- if(clev < LEVEL_PLUS3DB - 1)
- goto level_3db;
- /* break thru */
- case CONVERT(A52_3F, A52_STEREO):
- case CONVERT(A52_3F1R, A52_2F1R):
- case CONVERT(A52_3F1R, A52_2F2R):
- case CONVERT(A52_3F2R, A52_2F2R):
- *level /= 1 + clev;
- break;
-
- case CONVERT(A52_2F1R, A52_MONO):
- *level *= LEVEL_PLUS3DB / (2 + slev);
- break;
-
- case CONVERT(A52_2F1R, A52_STEREO):
- case CONVERT(A52_3F1R, A52_3F):
- *level /= 1 + slev * LEVEL_3DB;
- break;
-
- case CONVERT(A52_3F1R, A52_MONO):
- *level *= LEVEL_3DB / (1 + clev + 0.5 * slev);
- break;
-
- case CONVERT(A52_3F1R, A52_STEREO):
- *level /= 1 + clev + slev * LEVEL_3DB;
- break;
-
- case CONVERT(A52_2F2R, A52_MONO):
- *level *= LEVEL_3DB / (1 + slev);
- break;
-
- case CONVERT(A52_2F2R, A52_STEREO):
- case CONVERT(A52_3F2R, A52_3F):
- *level /= 1 + slev;
- break;
-
- case CONVERT(A52_3F2R, A52_MONO):
- *level *= LEVEL_3DB / (1 + clev + slev);
- break;
-
- case CONVERT(A52_3F2R, A52_STEREO):
- *level /= 1 + clev + slev;
- break;
-
- case CONVERT(A52_MONO, A52_DOLBY):
- *level *= LEVEL_PLUS3DB;
- break;
-
- case CONVERT(A52_3F, A52_DOLBY):
- case CONVERT(A52_2F1R, A52_DOLBY):
- *level *= 1 / (1 + LEVEL_3DB);
- break;
-
- case CONVERT(A52_3F1R, A52_DOLBY):
- case CONVERT(A52_2F2R, A52_DOLBY):
- *level *= 1 / (1 + 2 * LEVEL_3DB);
- break;
-
- case CONVERT(A52_3F2R, A52_DOLBY):
- *level *= 1 / (1 + 3 * LEVEL_3DB);
- break;
- }
+ if ((output == A52_STEREO) &&
+ ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB))))
+ output = A52_DOLBY;
+
+ if (flags & A52_ADJUST_LEVEL)
+ switch (CONVERT (input & 7, output)) {
+
+ case CONVERT (A52_3F, A52_MONO):
+ *level *= LEVEL_3DB / (1 + clev);
+ break;
+
+ case CONVERT (A52_STEREO, A52_MONO):
+ case CONVERT (A52_2F2R, A52_2F1R):
+ case CONVERT (A52_3F2R, A52_3F1R):
+ level_3db:
+ *level *= LEVEL_3DB;
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F1R):
+ if (clev < LEVEL_PLUS3DB - 1)
+ goto level_3db;
+ /* break thru */
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_2F1R):
+ case CONVERT (A52_3F1R, A52_2F2R):
+ case CONVERT (A52_3F2R, A52_2F2R):
+ *level /= 1 + clev;
+ break;
+
+ case CONVERT (A52_2F1R, A52_MONO):
+ *level *= LEVEL_PLUS3DB / (2 + slev);
+ break;
+
+ case CONVERT (A52_2F1R, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_3F):
+ *level /= 1 + slev * LEVEL_3DB;
+ break;
+
+ case CONVERT (A52_3F1R, A52_MONO):
+ *level *= LEVEL_3DB / (1 + clev + 0.5 * slev);
+ break;
+
+ case CONVERT (A52_3F1R, A52_STEREO):
+ *level /= 1 + clev + slev * LEVEL_3DB;
+ break;
+
+ case CONVERT (A52_2F2R, A52_MONO):
+ *level *= LEVEL_3DB / (1 + slev);
+ break;
+
+ case CONVERT (A52_2F2R, A52_STEREO):
+ case CONVERT (A52_3F2R, A52_3F):
+ *level /= 1 + slev;
+ break;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ *level *= LEVEL_3DB / (1 + clev + slev);
+ break;
+
+ case CONVERT (A52_3F2R, A52_STEREO):
+ *level /= 1 + clev + slev;
+ break;
+
+ case CONVERT (A52_MONO, A52_DOLBY):
+ *level *= LEVEL_PLUS3DB;
+ break;
+
+ case CONVERT (A52_3F, A52_DOLBY):
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ *level *= 1 / (1 + LEVEL_3DB);
+ break;
+
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ *level *= 1 / (1 + 2 * LEVEL_3DB);
+ break;
+
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ *level *= 1 / (1 + 3 * LEVEL_3DB);
+ break;
+ }
return output;
}
-int a52_downmix_coeff(sample_t * coeff, int acmod, int output, sample_t level,
- sample_t clev, sample_t slev)
+int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
+ sample_t clev, sample_t slev)
{
- switch(CONVERT(acmod, output & A52_CHANNEL_MASK))
- {
-
- case CONVERT(A52_CHANNEL, A52_CHANNEL):
- case CONVERT(A52_MONO, A52_MONO):
- case CONVERT(A52_STEREO, A52_STEREO):
- case CONVERT(A52_3F, A52_3F):
- case CONVERT(A52_2F1R, A52_2F1R):
- case CONVERT(A52_3F1R, A52_3F1R):
- case CONVERT(A52_2F2R, A52_2F2R):
- case CONVERT(A52_3F2R, A52_3F2R):
- case CONVERT(A52_STEREO, A52_DOLBY):
- coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
- return 0;
-
- case CONVERT(A52_CHANNEL, A52_MONO):
- coeff[0] = coeff[1] = level * LEVEL_6DB;
- return 3;
-
- case CONVERT(A52_STEREO, A52_MONO):
- coeff[0] = coeff[1] = level * LEVEL_3DB;
- return 3;
-
- case CONVERT(A52_3F, A52_MONO):
- coeff[0] = coeff[2] = level * LEVEL_3DB;
- coeff[1] = level * clev * LEVEL_PLUS3DB;
- return 7;
-
- case CONVERT(A52_2F1R, A52_MONO):
- coeff[0] = coeff[1] = level * LEVEL_3DB;
- coeff[2] = level * slev * LEVEL_3DB;
- return 7;
-
- case CONVERT(A52_2F2R, A52_MONO):
- coeff[0] = coeff[1] = level * LEVEL_3DB;
- coeff[2] = coeff[3] = level * slev * LEVEL_3DB;
- return 15;
-
- case CONVERT(A52_3F1R, A52_MONO):
- coeff[0] = coeff[2] = level * LEVEL_3DB;
- coeff[1] = level * clev * LEVEL_PLUS3DB;
- coeff[3] = level * slev * LEVEL_3DB;
- return 15;
-
- case CONVERT(A52_3F2R, A52_MONO):
- coeff[0] = coeff[2] = level * LEVEL_3DB;
- coeff[1] = level * clev * LEVEL_PLUS3DB;
- coeff[3] = coeff[4] = level * slev * LEVEL_3DB;
- return 31;
-
- case CONVERT(A52_MONO, A52_DOLBY):
- coeff[0] = level * LEVEL_3DB;
- return 0;
-
- case CONVERT(A52_3F, A52_DOLBY):
- clev = LEVEL_3DB;
- case CONVERT(A52_3F, A52_STEREO):
- case CONVERT(A52_3F1R, A52_2F1R):
- case CONVERT(A52_3F2R, A52_2F2R):
- coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
- coeff[1] = level * clev;
- return 7;
-
- case CONVERT(A52_2F1R, A52_DOLBY):
- slev = 1;
- case CONVERT(A52_2F1R, A52_STEREO):
- coeff[0] = coeff[1] = level;
- coeff[2] = level * slev * LEVEL_3DB;
- return 7;
-
- case CONVERT(A52_3F1R, A52_DOLBY):
- clev = LEVEL_3DB;
- slev = 1;
- case CONVERT(A52_3F1R, A52_STEREO):
- coeff[0] = coeff[2] = level;
- coeff[1] = level * clev;
- coeff[3] = level * slev * LEVEL_3DB;
- return 15;
-
- case CONVERT(A52_2F2R, A52_DOLBY):
- slev = LEVEL_3DB;
- case CONVERT(A52_2F2R, A52_STEREO):
- coeff[0] = coeff[1] = level;
- coeff[2] = coeff[3] = level * slev;
- return 15;
-
- case CONVERT(A52_3F2R, A52_DOLBY):
- clev = LEVEL_3DB;
- case CONVERT(A52_3F2R, A52_2F1R):
- slev = LEVEL_3DB;
- case CONVERT(A52_3F2R, A52_STEREO):
- coeff[0] = coeff[2] = level;
- coeff[1] = level * clev;
- coeff[3] = coeff[4] = level * slev;
- return 31;
-
- case CONVERT(A52_3F1R, A52_3F):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = level * slev * LEVEL_3DB;
- return 13;
-
- case CONVERT(A52_3F2R, A52_3F):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = coeff[4] = level * slev;
- return 29;
-
- case CONVERT(A52_2F2R, A52_2F1R):
- coeff[0] = coeff[1] = level;
- coeff[2] = coeff[3] = level * LEVEL_3DB;
- return 12;
-
- case CONVERT(A52_3F2R, A52_3F1R):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = coeff[4] = level * LEVEL_3DB;
- return 24;
-
- case CONVERT(A52_2F1R, A52_2F2R):
- coeff[0] = coeff[1] = level;
- coeff[2] = level * LEVEL_3DB;
- return 0;
-
- case CONVERT(A52_3F1R, A52_2F2R):
- coeff[0] = coeff[2] = level;
- coeff[1] = level * clev;
- coeff[3] = level * LEVEL_3DB;
- return 7;
-
- case CONVERT(A52_3F1R, A52_3F2R):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = level * LEVEL_3DB;
- return 0;
-
- case CONVERT(A52_CHANNEL, A52_CHANNEL1):
- coeff[0] = level;
- coeff[1] = 0;
- return 0;
-
- case CONVERT(A52_CHANNEL, A52_CHANNEL2):
- coeff[0] = 0;
- coeff[1] = level;
- return 0;
+ switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL):
+ case CONVERT (A52_MONO, A52_MONO):
+ case CONVERT (A52_STEREO, A52_STEREO):
+ case CONVERT (A52_3F, A52_3F):
+ case CONVERT (A52_2F1R, A52_2F1R):
+ case CONVERT (A52_3F1R, A52_3F1R):
+ case CONVERT (A52_2F2R, A52_2F2R):
+ case CONVERT (A52_3F2R, A52_3F2R):
+ case CONVERT (A52_STEREO, A52_DOLBY):
+ coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
+ return 0;
+
+ case CONVERT (A52_CHANNEL, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_6DB;
+ return 3;
+
+ case CONVERT (A52_STEREO, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_3DB;
+ return 3;
+
+ case CONVERT (A52_3F, A52_MONO):
+ coeff[0] = coeff[2] = level * LEVEL_3DB;
+ coeff[1] = level * clev * LEVEL_PLUS3DB;
+ return 7;
+
+ case CONVERT (A52_2F1R, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_3DB;
+ coeff[2] = level * slev * LEVEL_3DB;
+ return 7;
+
+ case CONVERT (A52_2F2R, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_3DB;
+ coeff[2] = coeff[3] = level * slev * LEVEL_3DB;
+ return 15;
+
+ case CONVERT (A52_3F1R, A52_MONO):
+ coeff[0] = coeff[2] = level * LEVEL_3DB;
+ coeff[1] = level * clev * LEVEL_PLUS3DB;
+ coeff[3] = level * slev * LEVEL_3DB;
+ return 15;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ coeff[0] = coeff[2] = level * LEVEL_3DB;
+ coeff[1] = level * clev * LEVEL_PLUS3DB;
+ coeff[3] = coeff[4] = level * slev * LEVEL_3DB;
+ return 31;
+
+ case CONVERT (A52_MONO, A52_DOLBY):
+ coeff[0] = level * LEVEL_3DB;
+ return 0;
+
+ case CONVERT (A52_3F, A52_DOLBY):
+ clev = LEVEL_3DB;
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_2F1R):
+ case CONVERT (A52_3F2R, A52_2F2R):
+ coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
+ coeff[1] = level * clev;
+ return 7;
+
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ slev = 1;
+ case CONVERT (A52_2F1R, A52_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level * slev * LEVEL_3DB;
+ return 7;
+
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ clev = LEVEL_3DB;
+ slev = 1;
+ case CONVERT (A52_3F1R, A52_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = level * clev;
+ coeff[3] = level * slev * LEVEL_3DB;
+ return 15;
+
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ slev = LEVEL_3DB;
+ case CONVERT (A52_2F2R, A52_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level * slev;
+ return 15;
+
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ clev = LEVEL_3DB;
+ case CONVERT (A52_3F2R, A52_2F1R):
+ slev = LEVEL_3DB;
+ case CONVERT (A52_3F2R, A52_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = level * clev;
+ coeff[3] = coeff[4] = level * slev;
+ return 31;
+
+ case CONVERT (A52_3F1R, A52_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = level * slev * LEVEL_3DB;
+ return 13;
+
+ case CONVERT (A52_3F2R, A52_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = level * slev;
+ return 29;
+
+ case CONVERT (A52_2F2R, A52_2F1R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level * LEVEL_3DB;
+ return 12;
+
+ case CONVERT (A52_3F2R, A52_3F1R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = level * LEVEL_3DB;
+ return 24;
+
+ case CONVERT (A52_2F1R, A52_2F2R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level * LEVEL_3DB;
+ return 0;
+
+ case CONVERT (A52_3F1R, A52_2F2R):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = level * clev;
+ coeff[3] = level * LEVEL_3DB;
+ return 7;
+
+ case CONVERT (A52_3F1R, A52_3F2R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = level * LEVEL_3DB;
+ return 0;
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL1):
+ coeff[0] = level;
+ coeff[1] = 0;
+ return 0;
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL2):
+ coeff[0] = 0;
+ coeff[1] = level;
+ return 0;
}
return -1; /* NOTREACHED */
}
-static void mix2to1(sample_t * dest, sample_t * src, sample_t bias)
+static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- dest[i] += src[i] + bias;
+ for (i = 0; i < 256; i++)
+ dest[i] += src[i] + bias;
}
-static void mix3to1(sample_t * samples, sample_t bias)
+static void mix3to1 (sample_t * samples, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] += samples[i + 256] + samples[i + 512] + bias;
+ for (i = 0; i < 256; i++)
+ samples[i] += samples[i + 256] + samples[i + 512] + bias;
}
-static void mix4to1(sample_t * samples, sample_t bias)
+static void mix4to1 (sample_t * samples, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] += (samples[i + 256] + samples[i + 512] +
- samples[i + 768] + bias);
+ for (i = 0; i < 256; i++)
+ samples[i] += (samples[i + 256] + samples[i + 512] +
+ samples[i + 768] + bias);
}
-static void mix5to1(sample_t * samples, sample_t bias)
+static void mix5to1 (sample_t * samples, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] += (samples[i + 256] + samples[i + 512] +
- samples[i + 768] + samples[i + 1024] + bias);
+ for (i = 0; i < 256; i++)
+ samples[i] += (samples[i + 256] + samples[i + 512] +
+ samples[i + 768] + samples[i + 1024] + bias);
}
-static void mix3to2(sample_t * samples, sample_t bias)
+static void mix3to2 (sample_t * samples, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = samples[i + 256] + bias;
- samples[i] += common;
- samples[i + 256] = samples[i + 512] + common;
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ samples[i] += common;
+ samples[i + 256] = samples[i + 512] + common;
}
}
-static void mix21to2(sample_t * left, sample_t * right, sample_t bias)
+static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = right[i + 256] + bias;
- left[i] += common;
- right[i] += common;
+ for (i = 0; i < 256; i++) {
+ common = right[i + 256] + bias;
+ left[i] += common;
+ right[i] += common;
}
}
-static void mix21toS(sample_t * samples, sample_t bias)
+static void mix21toS (sample_t * samples, sample_t bias)
{
int i;
sample_t surround;
- for(i = 0; i < 256; i++)
- {
- surround = samples[i + 512];
- samples[i] += bias - surround;
- samples[i + 256] += bias + surround;
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512];
+ samples[i] += bias - surround;
+ samples[i + 256] += bias + surround;
}
}
-static void mix31to2(sample_t * samples, sample_t bias)
+static void mix31to2 (sample_t * samples, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = samples[i + 256] + samples[i + 768] + bias;
- samples[i] += common;
- samples[i + 256] = samples[i + 512] + common;
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + samples[i + 768] + bias;
+ samples[i] += common;
+ samples[i + 256] = samples[i + 512] + common;
}
}
-static void mix31toS(sample_t * samples, sample_t bias)
+static void mix31toS (sample_t * samples, sample_t bias)
{
int i;
sample_t common, surround;
- for(i = 0; i < 256; i++)
- {
- common = samples[i + 256] + bias;
- surround = samples[i + 768];
- samples[i] += common - surround;
- samples[i + 256] = samples[i + 512] + common + surround;
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ surround = samples[i + 768];
+ samples[i] += common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
}
}
-static void mix22toS(sample_t * samples, sample_t bias)
+static void mix22toS (sample_t * samples, sample_t bias)
{
int i;
sample_t surround;
- for(i = 0; i < 256; i++)
- {
- surround = samples[i + 512] + samples[i + 768];
- samples[i] += bias - surround;
- samples[i + 256] += bias + surround;
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512] + samples[i + 768];
+ samples[i] += bias - surround;
+ samples[i + 256] += bias + surround;
}
}
-static void mix32to2(sample_t * samples, sample_t bias)
+static void mix32to2 (sample_t * samples, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = samples[i + 256] + bias;
- samples[i] += common + samples[i + 768];
- samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ samples[i] += common + samples[i + 768];
+ samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
}
}
-static void mix32toS(sample_t * samples, sample_t bias)
+static void mix32toS (sample_t * samples, sample_t bias)
{
int i;
sample_t common, surround;
- for(i = 0; i < 256; i++)
- {
- common = samples[i + 256] + bias;
- surround = samples[i + 768] + samples[i + 1024];
- samples[i] += common - surround;
- samples[i + 256] = samples[i + 512] + common + surround;
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ surround = samples[i + 768] + samples[i + 1024];
+ samples[i] += common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
}
}
-static void move2to1(sample_t * src, sample_t * dest, sample_t bias)
+static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- dest[i] = src[i] + src[i + 256] + bias;
+ for (i = 0; i < 256; i++)
+ dest[i] = src[i] + src[i + 256] + bias;
}
-static void zero(sample_t * samples)
+static void zero (sample_t * samples)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] = 0;
+ for (i = 0; i < 256; i++)
+ samples[i] = 0;
}
-void a52_downmix(sample_t * samples, int acmod, int output, sample_t bias,
- sample_t clev, sample_t slev)
+void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ sample_t clev, sample_t slev)
{
- switch(CONVERT(acmod, output & A52_CHANNEL_MASK))
- {
-
- case CONVERT(A52_CHANNEL, A52_CHANNEL2):
- memcpy(samples, samples + 256, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_CHANNEL, A52_MONO):
- case CONVERT(A52_STEREO, A52_MONO):
-mix_2to1:
- mix2to1(samples, samples + 256, bias);
- break;
-
- case CONVERT(A52_2F1R, A52_MONO):
- if(slev == 0)
- goto mix_2to1;
- case CONVERT(A52_3F, A52_MONO):
-mix_3to1:
- mix3to1(samples, bias);
- break;
-
- case CONVERT(A52_3F1R, A52_MONO):
- if(slev == 0)
- goto mix_3to1;
- case CONVERT(A52_2F2R, A52_MONO):
- if(slev == 0)
- goto mix_2to1;
- mix4to1(samples, bias);
- break;
-
- case CONVERT(A52_3F2R, A52_MONO):
- if(slev == 0)
- goto mix_3to1;
- mix5to1(samples, bias);
- break;
-
- case CONVERT(A52_MONO, A52_DOLBY):
- memcpy(samples + 256, samples, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_3F, A52_STEREO):
- case CONVERT(A52_3F, A52_DOLBY):
-mix_3to2:
- mix3to2(samples, bias);
- break;
-
- case CONVERT(A52_2F1R, A52_STEREO):
- if(slev == 0)
- break;
- mix21to2(samples, samples + 256, bias);
- break;
-
- case CONVERT(A52_2F1R, A52_DOLBY):
- mix21toS(samples, bias);
- break;
-
- case CONVERT(A52_3F1R, A52_STEREO):
- if(slev == 0)
- goto mix_3to2;
- mix31to2(samples, bias);
- break;
-
- case CONVERT(A52_3F1R, A52_DOLBY):
- mix31toS(samples, bias);
- break;
-
- case CONVERT(A52_2F2R, A52_STEREO):
- if(slev == 0)
- break;
- mix2to1(samples, samples + 512, bias);
- mix2to1(samples + 256, samples + 768, bias);
- break;
-
- case CONVERT(A52_2F2R, A52_DOLBY):
- mix22toS(samples, bias);
- break;
-
- case CONVERT(A52_3F2R, A52_STEREO):
- if(slev == 0)
- goto mix_3to2;
- mix32to2(samples, bias);
- break;
-
- case CONVERT(A52_3F2R, A52_DOLBY):
- mix32toS(samples, bias);
- break;
-
- case CONVERT(A52_3F1R, A52_3F):
- if(slev == 0)
- break;
- mix21to2(samples, samples + 512, bias);
- break;
-
- case CONVERT(A52_3F2R, A52_3F):
- if(slev == 0)
- break;
- mix2to1(samples, samples + 768, bias);
- mix2to1(samples + 512, samples + 1024, bias);
- break;
-
- case CONVERT(A52_3F1R, A52_2F1R):
- mix3to2(samples, bias);
- memcpy(samples + 512, samples + 768, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_2F2R, A52_2F1R):
- mix2to1(samples + 512, samples + 768, bias);
- break;
-
- case CONVERT(A52_3F2R, A52_2F1R):
- mix3to2(samples, bias);
- move2to1(samples + 768, samples + 512, bias);
- break;
-
- case CONVERT(A52_3F2R, A52_3F1R):
- mix2to1(samples + 768, samples + 1024, bias);
- break;
-
- case CONVERT(A52_2F1R, A52_2F2R):
- memcpy(samples + 768, samples + 512, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_3F1R, A52_2F2R):
- mix3to2(samples, bias);
- memcpy(samples + 512, samples + 768, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_3F2R, A52_2F2R):
- mix3to2(samples, bias);
- memcpy(samples + 512, samples + 768, 256 * sizeof(sample_t));
- memcpy(samples + 768, samples + 1024, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_3F1R, A52_3F2R):
- memcpy(samples + 1024, samples + 768, 256 * sizeof(sample_t));
- break;
+ switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL2):
+ memcpy (samples, samples + 256, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_CHANNEL, A52_MONO):
+ case CONVERT (A52_STEREO, A52_MONO):
+ mix_2to1:
+ mix2to1 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ case CONVERT (A52_3F, A52_MONO):
+ mix_3to1:
+ mix3to1 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ case CONVERT (A52_2F2R, A52_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ mix4to1 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ mix5to1 (samples, bias);
+ break;
+
+ case CONVERT (A52_MONO, A52_DOLBY):
+ memcpy (samples + 256, samples, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F, A52_DOLBY):
+ mix_3to2:
+ mix3to2 (samples, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_STEREO):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ mix21toS (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix31to2 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ mix31toS (samples, bias);
+ break;
+
+ case CONVERT (A52_2F2R, A52_STEREO):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 512, bias);
+ mix2to1 (samples + 256, samples + 768, bias);
+ break;
+
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ mix22toS (samples, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix32to2 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ mix32toS (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_3F):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 512, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 768, bias);
+ mix2to1 (samples + 512, samples + 1024, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_2F1R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_2F2R, A52_2F1R):
+ mix2to1 (samples + 512, samples + 768, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F1R):
+ mix3to2 (samples, bias);
+ move2to1 (samples + 768, samples + 512, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F1R):
+ mix2to1 (samples + 768, samples + 1024, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_2F2R):
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F1R, A52_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F1R, A52_3F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ break;
}
}
-void a52_upmix(sample_t * samples, int acmod, int output)
+void a52_upmix (sample_t * samples, int acmod, int output)
{
- switch(CONVERT(acmod, output & A52_CHANNEL_MASK))
- {
-
- case CONVERT(A52_CHANNEL, A52_CHANNEL2):
- memcpy(samples + 256, samples, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(A52_3F2R, A52_MONO):
- zero(samples + 1024);
- case CONVERT(A52_3F1R, A52_MONO):
- case CONVERT(A52_2F2R, A52_MONO):
- zero(samples + 768);
- case CONVERT(A52_3F, A52_MONO):
- case CONVERT(A52_2F1R, A52_MONO):
- zero(samples + 512);
- case CONVERT(A52_CHANNEL, A52_MONO):
- case CONVERT(A52_STEREO, A52_MONO):
- zero(samples + 256);
- break;
-
- case CONVERT(A52_3F2R, A52_STEREO):
- case CONVERT(A52_3F2R, A52_DOLBY):
- zero(samples + 1024);
- case CONVERT(A52_3F1R, A52_STEREO):
- case CONVERT(A52_3F1R, A52_DOLBY):
- zero(samples + 768);
- case CONVERT(A52_3F, A52_STEREO):
- case CONVERT(A52_3F, A52_DOLBY):
-mix_3to2:
- memcpy(samples + 512, samples + 256, 256 * sizeof(sample_t));
- zero(samples + 256);
- break;
-
- case CONVERT(A52_2F2R, A52_STEREO):
- case CONVERT(A52_2F2R, A52_DOLBY):
- zero(samples + 768);
- case CONVERT(A52_2F1R, A52_STEREO):
- case CONVERT(A52_2F1R, A52_DOLBY):
- zero(samples + 512);
- break;
-
- case CONVERT(A52_3F2R, A52_3F):
- zero(samples + 1024);
- case CONVERT(A52_3F1R, A52_3F):
- case CONVERT(A52_2F2R, A52_2F1R):
- zero(samples + 768);
- break;
-
- case CONVERT(A52_3F2R, A52_3F1R):
- zero(samples + 1024);
- break;
-
- case CONVERT(A52_3F2R, A52_2F1R):
- zero(samples + 1024);
- case CONVERT(A52_3F1R, A52_2F1R):
-mix_31to21:
- memcpy(samples + 768, samples + 512, 256 * sizeof(sample_t));
- goto mix_3to2;
-
- case CONVERT(A52_3F2R, A52_2F2R):
- memcpy(samples + 1024, samples + 768, 256 * sizeof(sample_t));
- goto mix_31to21;
+ switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL2):
+ memcpy (samples + 256, samples, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_MONO):
+ case CONVERT (A52_2F2R, A52_MONO):
+ zero (samples + 768);
+ case CONVERT (A52_3F, A52_MONO):
+ case CONVERT (A52_2F1R, A52_MONO):
+ zero (samples + 512);
+ case CONVERT (A52_CHANNEL, A52_MONO):
+ case CONVERT (A52_STEREO, A52_MONO):
+ zero (samples + 256);
+ break;
+
+ case CONVERT (A52_3F2R, A52_STEREO):
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ zero (samples + 768);
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F, A52_DOLBY):
+ mix_3to2:
+ memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
+ zero (samples + 256);
+ break;
+
+ case CONVERT (A52_2F2R, A52_STEREO):
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ zero (samples + 768);
+ case CONVERT (A52_2F1R, A52_STEREO):
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ zero (samples + 512);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_3F):
+ case CONVERT (A52_2F2R, A52_2F1R):
+ zero (samples + 768);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F1R):
+ zero (samples + 1024);
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F1R):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_2F1R):
+ mix_31to21:
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ goto mix_3to2;
+
+ case CONVERT (A52_3F2R, A52_2F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ goto mix_31to21;
}
}
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/imdct.c b/src/filters/transform/MpaDecFilter/a52dec/liba52/imdct.c
index 69afaa2b8..303fe0ca4 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/imdct.c
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/imdct.c
@@ -40,22 +40,20 @@
#include "a52_internal.h"
//#include "mm_accel.h"
-typedef struct complex_s
-{
+typedef struct complex_s {
sample_t real;
sample_t imag;
} complex_t;
-static uint8_t fftorder[] =
-{
- 0, 128, 64, 192, 32, 160, 224, 96, 16, 144, 80, 208, 240, 112, 48, 176,
- 8, 136, 72, 200, 40, 168, 232, 104, 248, 120, 56, 184, 24, 152, 216, 88,
- 4, 132, 68, 196, 36, 164, 228, 100, 20, 148, 84, 212, 244, 116, 52, 180,
- 252, 124, 60, 188, 28, 156, 220, 92, 12, 140, 76, 204, 236, 108, 44, 172,
- 2, 130, 66, 194, 34, 162, 226, 98, 18, 146, 82, 210, 242, 114, 50, 178,
- 10, 138, 74, 202, 42, 170, 234, 106, 250, 122, 58, 186, 26, 154, 218, 90,
- 254, 126, 62, 190, 30, 158, 222, 94, 14, 142, 78, 206, 238, 110, 46, 174,
- 6, 134, 70, 198, 38, 166, 230, 102, 246, 118, 54, 182, 22, 150, 214, 86
+static uint8_t fftorder[] = {
+ 0,128, 64,192, 32,160,224, 96, 16,144, 80,208,240,112, 48,176,
+ 8,136, 72,200, 40,168,232,104,248,120, 56,184, 24,152,216, 88,
+ 4,132, 68,196, 36,164,228,100, 20,148, 84,212,244,116, 52,180,
+ 252,124, 60,188, 28,156,220, 92, 12,140, 76,204,236,108, 44,172,
+ 2,130, 66,194, 34,162,226, 98, 18,146, 82,210,242,114, 50,178,
+ 10,138, 74,202, 42,170,234,106,250,122, 58,186, 26,154,218, 90,
+ 254,126, 62,190, 30,158,222, 94, 14,142, 78,206,238,110, 46,174,
+ 6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86
};
/* Root values for IFFT */
@@ -72,10 +70,10 @@ static complex_t post2[32];
static sample_t a52_imdct_window[256];
-static void (* ifft128)(complex_t * buf);
-static void (* ifft64)(complex_t * buf);
+static void (* ifft128) (complex_t * buf);
+static void (* ifft64) (complex_t * buf);
-static inline void ifft2(complex_t * buf)
+static inline void ifft2 (complex_t * buf)
{
double r, i;
@@ -87,7 +85,7 @@ static inline void ifft2(complex_t * buf)
buf[1].imag = i - buf[1].imag;
}
-static inline void ifft4(complex_t * buf)
+static inline void ifft4 (complex_t * buf)
{
double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
@@ -169,18 +167,18 @@ static inline void ifft4(complex_t * buf)
a1.imag += tmp4; \
} while (0)
-static inline void ifft8(complex_t * buf)
+static inline void ifft8 (complex_t * buf)
{
double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
- ifft4(buf);
- ifft2(buf + 4);
- ifft2(buf + 6);
- BUTTERFLY_ZERO(buf[0], buf[2], buf[4], buf[6]);
- BUTTERFLY_HALF(buf[1], buf[3], buf[5], buf[7], roots16[1]);
+ ifft4 (buf);
+ ifft2 (buf + 4);
+ ifft2 (buf + 6);
+ BUTTERFLY_ZERO (buf[0], buf[2], buf[4], buf[6]);
+ BUTTERFLY_HALF (buf[1], buf[3], buf[5], buf[7], roots16[1]);
}
-static void ifft_pass(complex_t * buf, sample_t * weight, int n)
+static void ifft_pass (complex_t * buf, sample_t * weight, int n)
{
complex_t * buf1;
complex_t * buf2;
@@ -193,101 +191,97 @@ static void ifft_pass(complex_t * buf, sample_t * weight, int n)
buf2 = buf + 2 * n;
buf3 = buf + 3 * n;
- BUTTERFLY_ZERO(buf[-1], buf1[-1], buf2[-1], buf3[-1]);
+ BUTTERFLY_ZERO (buf[-1], buf1[-1], buf2[-1], buf3[-1]);
i = n - 1;
- do
- {
- BUTTERFLY(buf[0], buf1[0], buf2[0], buf3[0], weight[n], weight[2*i]);
- buf++;
- buf1++;
- buf2++;
- buf3++;
- weight++;
- }
- while(--i);
+ do {
+ BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], weight[n], weight[2*i]);
+ buf++;
+ buf1++;
+ buf2++;
+ buf3++;
+ weight++;
+ } while (--i);
}
-static void ifft16(complex_t * buf)
+static void ifft16 (complex_t * buf)
{
- ifft8(buf);
- ifft4(buf + 8);
- ifft4(buf + 12);
- ifft_pass(buf, roots16 - 4, 4);
+ ifft8 (buf);
+ ifft4 (buf + 8);
+ ifft4 (buf + 12);
+ ifft_pass (buf, roots16 - 4, 4);
}
-static void ifft32(complex_t * buf)
+static void ifft32 (complex_t * buf)
{
- ifft16(buf);
- ifft8(buf + 16);
- ifft8(buf + 24);
- ifft_pass(buf, roots32 - 8, 8);
+ ifft16 (buf);
+ ifft8 (buf + 16);
+ ifft8 (buf + 24);
+ ifft_pass (buf, roots32 - 8, 8);
}
-static void ifft64_c(complex_t * buf)
+static void ifft64_c (complex_t * buf)
{
- ifft32(buf);
- ifft16(buf + 32);
- ifft16(buf + 48);
- ifft_pass(buf, roots64 - 16, 16);
+ ifft32 (buf);
+ ifft16 (buf + 32);
+ ifft16 (buf + 48);
+ ifft_pass (buf, roots64 - 16, 16);
}
-static void ifft128_c(complex_t * buf)
+static void ifft128_c (complex_t * buf)
{
- ifft32(buf);
- ifft16(buf + 32);
- ifft16(buf + 48);
- ifft_pass(buf, roots64 - 16, 16);
-
- ifft32(buf + 64);
- ifft32(buf + 96);
- ifft_pass(buf, roots128 - 32, 32);
+ ifft32 (buf);
+ ifft16 (buf + 32);
+ ifft16 (buf + 48);
+ ifft_pass (buf, roots64 - 16, 16);
+
+ ifft32 (buf + 64);
+ ifft32 (buf + 96);
+ ifft_pass (buf, roots128 - 32, 32);
}
-void a52_imdct_512(sample_t * data, sample_t * delay, sample_t bias)
+void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias)
{
int i, k;
sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2;
const sample_t * window = a52_imdct_window;
complex_t buf[128];
-
- for(i = 0; i < 128; i++)
- {
- k = fftorder[i];
- t_r = pre1[i].real;
- t_i = pre1[i].imag;
-
- buf[i].real = t_i * data[255-k] + t_r * data[k];
- buf[i].imag = t_r * data[255-k] - t_i * data[k];
+
+ for (i = 0; i < 128; i++) {
+ k = fftorder[i];
+ t_r = pre1[i].real;
+ t_i = pre1[i].imag;
+
+ buf[i].real = t_i * data[255-k] + t_r * data[k];
+ buf[i].imag = t_r * data[255-k] - t_i * data[k];
}
- ifft128(buf);
+ ifft128 (buf);
/* Post IFFT complex multiply plus IFFT complex conjugate*/
/* Window and convert to real valued signal */
- for(i = 0; i < 64; i++)
- {
- /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */
- t_r = post1[i].real;
- t_i = post1[i].imag;
-
- a_r = t_r * buf[i].real + t_i * buf[i].imag;
- a_i = t_i * buf[i].real - t_r * buf[i].imag;
- b_r = t_i * buf[127-i].real + t_r * buf[127-i].imag;
- b_i = t_r * buf[127-i].real - t_i * buf[127-i].imag;
-
- w_1 = window[2*i];
- w_2 = window[255-2*i];
- data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias;
- data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias;
- delay[2*i] = a_i;
-
- w_1 = window[2*i+1];
- w_2 = window[254-2*i];
- data[2*i+1] = delay[2*i+1] * w_2 + b_r * w_1 + bias;
- data[254-2*i] = delay[2*i+1] * w_1 - b_r * w_2 + bias;
- delay[2*i+1] = b_i;
+ for (i = 0; i < 64; i++) {
+ /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */
+ t_r = post1[i].real;
+ t_i = post1[i].imag;
+
+ a_r = t_r * buf[i].real + t_i * buf[i].imag;
+ a_i = t_i * buf[i].real - t_r * buf[i].imag;
+ b_r = t_i * buf[127-i].real + t_r * buf[127-i].imag;
+ b_i = t_r * buf[127-i].real - t_i * buf[127-i].imag;
+
+ w_1 = window[2*i];
+ w_2 = window[255-2*i];
+ data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias;
+ data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias;
+ delay[2*i] = a_i;
+
+ w_1 = window[2*i+1];
+ w_2 = window[254-2*i];
+ data[2*i+1] = delay[2*i+1] * w_2 + b_r * w_1 + bias;
+ data[254-2*i] = delay[2*i+1] * w_1 - b_r * w_2 + bias;
+ delay[2*i+1] = b_i;
}
}
@@ -299,150 +293,140 @@ void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias)
complex_t buf1[64], buf2[64];
/* Pre IFFT complex multiply plus IFFT cmplx conjugate */
- for(i = 0; i < 64; i++)
- {
- k = fftorder[i];
- t_r = pre2[i].real;
- t_i = pre2[i].imag;
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i];
+ t_r = pre2[i].real;
+ t_i = pre2[i].imag;
- buf1[i].real = t_i * data[254-k] + t_r * data[k];
- buf1[i].imag = t_r * data[254-k] - t_i * data[k];
+ buf1[i].real = t_i * data[254-k] + t_r * data[k];
+ buf1[i].imag = t_r * data[254-k] - t_i * data[k];
- buf2[i].real = t_i * data[255-k] + t_r * data[k+1];
- buf2[i].imag = t_r * data[255-k] - t_i * data[k+1];
+ buf2[i].real = t_i * data[255-k] + t_r * data[k+1];
+ buf2[i].imag = t_r * data[255-k] - t_i * data[k+1];
}
- ifft64(buf1);
- ifft64(buf2);
+ ifft64 (buf1);
+ ifft64 (buf2);
/* Post IFFT complex multiply */
/* Window and convert to real valued signal */
- for(i = 0; i < 32; i++)
- {
- /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
- t_r = post2[i].real;
- t_i = post2[i].imag;
-
- a_r = t_r * buf1[i].real + t_i * buf1[i].imag;
- a_i = t_i * buf1[i].real - t_r * buf1[i].imag;
- b_r = t_i * buf1[63-i].real + t_r * buf1[63-i].imag;
- b_i = t_r * buf1[63-i].real - t_i * buf1[63-i].imag;
-
- c_r = t_r * buf2[i].real + t_i * buf2[i].imag;
- c_i = t_i * buf2[i].real - t_r * buf2[i].imag;
- d_r = t_i * buf2[63-i].real + t_r * buf2[63-i].imag;
- d_i = t_r * buf2[63-i].real - t_i * buf2[63-i].imag;
-
- w_1 = window[2*i];
- w_2 = window[255-2*i];
- data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias;
- data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias;
- delay[2*i] = c_i;
-
- w_1 = window[128+2*i];
- w_2 = window[127-2*i];
- data[128+2*i] = delay[127-2*i] * w_2 + a_i * w_1 + bias;
- data[127-2*i] = delay[127-2*i] * w_1 - a_i * w_2 + bias;
- delay[127-2*i] = c_r;
-
- w_1 = window[2*i+1];
- w_2 = window[254-2*i];
- data[2*i+1] = delay[2*i+1] * w_2 - b_i * w_1 + bias;
- data[254-2*i] = delay[2*i+1] * w_1 + b_i * w_2 + bias;
- delay[2*i+1] = d_r;
-
- w_1 = window[129+2*i];
- w_2 = window[126-2*i];
- data[129+2*i] = delay[126-2*i] * w_2 + b_r * w_1 + bias;
- data[126-2*i] = delay[126-2*i] * w_1 - b_r * w_2 + bias;
- delay[126-2*i] = d_i;
+ for (i = 0; i < 32; i++) {
+ /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
+ t_r = post2[i].real;
+ t_i = post2[i].imag;
+
+ a_r = t_r * buf1[i].real + t_i * buf1[i].imag;
+ a_i = t_i * buf1[i].real - t_r * buf1[i].imag;
+ b_r = t_i * buf1[63-i].real + t_r * buf1[63-i].imag;
+ b_i = t_r * buf1[63-i].real - t_i * buf1[63-i].imag;
+
+ c_r = t_r * buf2[i].real + t_i * buf2[i].imag;
+ c_i = t_i * buf2[i].real - t_r * buf2[i].imag;
+ d_r = t_i * buf2[63-i].real + t_r * buf2[63-i].imag;
+ d_i = t_r * buf2[63-i].real - t_i * buf2[63-i].imag;
+
+ w_1 = window[2*i];
+ w_2 = window[255-2*i];
+ data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias;
+ data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias;
+ delay[2*i] = c_i;
+
+ w_1 = window[128+2*i];
+ w_2 = window[127-2*i];
+ data[128+2*i] = delay[127-2*i] * w_2 + a_i * w_1 + bias;
+ data[127-2*i] = delay[127-2*i] * w_1 - a_i * w_2 + bias;
+ delay[127-2*i] = c_r;
+
+ w_1 = window[2*i+1];
+ w_2 = window[254-2*i];
+ data[2*i+1] = delay[2*i+1] * w_2 - b_i * w_1 + bias;
+ data[254-2*i] = delay[2*i+1] * w_1 + b_i * w_2 + bias;
+ delay[2*i+1] = d_r;
+
+ w_1 = window[129+2*i];
+ w_2 = window[126-2*i];
+ data[129+2*i] = delay[126-2*i] * w_2 + b_r * w_1 + bias;
+ data[126-2*i] = delay[126-2*i] * w_1 - b_r * w_2 + bias;
+ delay[126-2*i] = d_i;
}
}
-static double besselI0(double x)
+static double besselI0 (double x)
{
double bessel = 1;
int i = 100;
do
- bessel = bessel * x / (i * i) + 1;
- while(--i);
+ bessel = bessel * x / (i * i) + 1;
+ while (--i);
return bessel;
}
-void a52_imdct_init(uint32_t mm_accel)
+void a52_imdct_init (uint32_t mm_accel)
{
int i, k;
double sum;
/* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */
sum = 0;
- for(i = 0; i < 256; i++)
- {
- sum += besselI0(i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256));
- a52_imdct_window[i] = sum;
+ for (i = 0; i < 256; i++) {
+ sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256));
+ a52_imdct_window[i] = sum;
}
sum++;
- for(i = 0; i < 256; i++)
- a52_imdct_window[i] = sqrt(a52_imdct_window[i] / sum);
+ for (i = 0; i < 256; i++)
+ a52_imdct_window[i] = sqrt (a52_imdct_window[i] / sum);
- for(i = 0; i < 3; i++)
- roots16[i] = cos((M_PI / 8) * (i + 1));
+ for (i = 0; i < 3; i++)
+ roots16[i] = cos ((M_PI / 8) * (i + 1));
- for(i = 0; i < 7; i++)
- roots32[i] = cos((M_PI / 16) * (i + 1));
+ for (i = 0; i < 7; i++)
+ roots32[i] = cos ((M_PI / 16) * (i + 1));
- for(i = 0; i < 15; i++)
- roots64[i] = cos((M_PI / 32) * (i + 1));
+ for (i = 0; i < 15; i++)
+ roots64[i] = cos ((M_PI / 32) * (i + 1));
- for(i = 0; i < 31; i++)
- roots128[i] = cos((M_PI / 64) * (i + 1));
+ for (i = 0; i < 31; i++)
+ roots128[i] = cos ((M_PI / 64) * (i + 1));
- for(i = 0; i < 64; i++)
- {
- k = fftorder[i] / 2 + 64;
- pre1[i].real = cos((M_PI / 256) * (k - 0.25));
- pre1[i].imag = sin((M_PI / 256) * (k - 0.25));
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i] / 2 + 64;
+ pre1[i].real = cos ((M_PI / 256) * (k - 0.25));
+ pre1[i].imag = sin ((M_PI / 256) * (k - 0.25));
}
- for(i = 64; i < 128; i++)
- {
- k = fftorder[i] / 2 + 64;
- pre1[i].real = -cos((M_PI / 256) * (k - 0.25));
- pre1[i].imag = -sin((M_PI / 256) * (k - 0.25));
+ for (i = 64; i < 128; i++) {
+ k = fftorder[i] / 2 + 64;
+ pre1[i].real = -cos ((M_PI / 256) * (k - 0.25));
+ pre1[i].imag = -sin ((M_PI / 256) * (k - 0.25));
}
- for(i = 0; i < 64; i++)
- {
- post1[i].real = cos((M_PI / 256) * (i + 0.5));
- post1[i].imag = sin((M_PI / 256) * (i + 0.5));
+ for (i = 0; i < 64; i++) {
+ post1[i].real = cos ((M_PI / 256) * (i + 0.5));
+ post1[i].imag = sin ((M_PI / 256) * (i + 0.5));
}
- for(i = 0; i < 64; i++)
- {
- k = fftorder[i] / 4;
- pre2[i].real = cos((M_PI / 128) * (k - 0.25));
- pre2[i].imag = sin((M_PI / 128) * (k - 0.25));
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i] / 4;
+ pre2[i].real = cos ((M_PI / 128) * (k - 0.25));
+ pre2[i].imag = sin ((M_PI / 128) * (k - 0.25));
}
- for(i = 0; i < 32; i++)
- {
- post2[i].real = cos((M_PI / 128) * (i + 0.5));
- post2[i].imag = sin((M_PI / 128) * (i + 0.5));
+ for (i = 0; i < 32; i++) {
+ post2[i].real = cos ((M_PI / 128) * (i + 0.5));
+ post2[i].imag = sin ((M_PI / 128) * (i + 0.5));
}
#ifdef LIBA52_DJBFFT
- if(mm_accel & MM_ACCEL_DJBFFT)
- {
- //fprintf (stderr, "Using djbfft for IMDCT transform\n");
- ifft128 = (void (*)(complex_t *)) fftc4_un128;
- ifft64 = (void (*)(complex_t *)) fftc4_un64;
- }
- else
+ if (mm_accel & MM_ACCEL_DJBFFT) {
+ //fprintf (stderr, "Using djbfft for IMDCT transform\n");
+ ifft128 = (void (*) (complex_t *)) fftc4_un128;
+ ifft64 = (void (*) (complex_t *)) fftc4_un64;
+ } else
#endif
{
- //fprintf (stderr, "No accelerated IMDCT transform found\n");
- ifft128 = ifft128_c;
- ifft64 = ifft64_c;
+ //fprintf (stderr, "No accelerated IMDCT transform found\n");
+ ifft128 = ifft128_c;
+ ifft64 = ifft64_c;
}
}
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/parse.c b/src/filters/transform/MpaDecFilter/a52dec/liba52/parse.c
index e078111d2..08d5bada4 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/parse.c
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/parse.c
@@ -38,14 +38,13 @@ void * __cdecl malloc(size_t);
#ifdef HAVE_MEMALIGN
/* some systems have memalign() but no declaration for it */
-void * memalign(size_t align, size_t size);
+void * memalign (size_t align, size_t size);
#else
/* assume malloc alignment is sufficient */
#define memalign(align,size) malloc (size)
#endif
-typedef struct
-{
+typedef struct {
sample_t q1[2];
sample_t q2[2];
sample_t q4;
@@ -56,88 +55,85 @@ typedef struct
static uint8_t halfrate[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3};
-a52_state_t * a52_init(uint32_t mm_accel)
+a52_state_t * a52_init (uint32_t mm_accel)
{
a52_state_t * state;
int i;
- state = malloc(sizeof(a52_state_t));
- if(state == NULL)
- return NULL;
+ state = malloc (sizeof (a52_state_t));
+ if (state == NULL)
+ return NULL;
- state->samples = memalign(16, 256 * 12 * sizeof(sample_t));
- if(state->samples == NULL)
- {
- free(state);
- return NULL;
+ state->samples = memalign (16, 256 * 12 * sizeof (sample_t));
+ if (state->samples == NULL) {
+ free (state);
+ return NULL;
}
- for(i = 0; i < 256 * 12; i++)
- state->samples[i] = 0;
+ for (i = 0; i < 256 * 12; i++)
+ state->samples[i] = 0;
state->downmixed = 1;
state->lfsr_state = 1;
- a52_imdct_init(mm_accel);
+ a52_imdct_init (mm_accel);
return state;
}
-sample_t * a52_samples(a52_state_t * state)
+sample_t * a52_samples (a52_state_t * state)
{
return state->samples;
}
-int a52_syncinfo(uint8_t * buf, int * flags,
- int * sample_rate, int * bit_rate)
+int a52_syncinfo (uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate)
{
static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112,
- 128, 160, 192, 224, 256, 320, 384, 448,
- 512, 576, 640
- };
+ 128, 160, 192, 224, 256, 320, 384, 448,
+ 512, 576, 640};
static uint8_t lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01};
int frmsizecod;
int bitrate;
int half;
int acmod;
- if((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */
- return 0;
+ if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */
+ return 0;
- if(buf[5] >= 0x60) /* bsid >= 12 */
- return 0;
+ if (buf[5] >= 0x60) /* bsid >= 12 */
+ return 0;
half = halfrate[buf[5] >> 3];
/* acmod, dsurmod and lfeon */
acmod = buf[6] >> 5;
*flags = ((((buf[6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) |
- ((buf[6] & lfeon[acmod]) ? A52_LFE : 0));
+ ((buf[6] & lfeon[acmod]) ? A52_LFE : 0));
frmsizecod = buf[4] & 63;
- if(frmsizecod >= 38)
- return 0;
+ if (frmsizecod >= 38)
+ return 0;
bitrate = rate [frmsizecod >> 1];
*bit_rate = (bitrate * 1000) >> half;
- switch(buf[4] & 0xc0)
- {
+ switch (buf[4] & 0xc0) {
case 0:
- *sample_rate = 48000 >> half;
- return 4 * bitrate;
+ *sample_rate = 48000 >> half;
+ return 4 * bitrate;
case 0x40:
- *sample_rate = 44100 >> half;
- return 2 * (320 * bitrate / 147 + (frmsizecod & 1));
+ *sample_rate = 44100 >> half;
+ return 2 * (320 * bitrate / 147 + (frmsizecod & 1));
case 0x80:
- *sample_rate = 32000 >> half;
- return 6 * bitrate;
+ *sample_rate = 32000 >> half;
+ return 6 * bitrate;
default:
- return 0;
+ return 0;
}
}
-int a52_frame(a52_state_t * state, uint8_t * buf, int * flags,
- sample_t * level, sample_t bias)
+int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
+ sample_t * level, sample_t bias)
{
static sample_t clev[4] = {LEVEL_3DB, LEVEL_45DB, LEVEL_6DB, LEVEL_45DB};
static sample_t slev[4] = {LEVEL_3DB, LEVEL_6DB, 0, LEVEL_6DB};
@@ -148,28 +144,28 @@ int a52_frame(a52_state_t * state, uint8_t * buf, int * flags,
state->halfrate = halfrate[buf[5] >> 3];
state->acmod = acmod = buf[6] >> 5;
- a52_bitstream_set_ptr(state, buf + 6);
- bitstream_get(state, 3); /* skip acmod we already parsed */
+ a52_bitstream_set_ptr (state, buf + 6);
+ bitstream_get (state, 3); /* skip acmod we already parsed */
- if((acmod == 2) && (bitstream_get(state, 2) == 2)) /* dsurmod */
- acmod = A52_DOLBY;
+ if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */
+ acmod = A52_DOLBY;
state->clev = state->slev = 0;
- if((acmod & 1) && (acmod != 1))
- state->clev = clev[bitstream_get(state, 2)]; /* cmixlev */
+ if ((acmod & 1) && (acmod != 1))
+ state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */
- if(acmod & 4)
- state->slev = slev[bitstream_get(state, 2)]; /* surmixlev */
+ if (acmod & 4)
+ state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */
- state->lfeon = bitstream_get(state, 1);
+ state->lfeon = bitstream_get (state, 1);
- state->output = a52_downmix_init(acmod, *flags, level,
- state->clev, state->slev);
- if(state->output < 0)
- return 1;
- if(state->lfeon && (*flags & A52_LFE))
- state->output |= A52_LFE;
+ state->output = a52_downmix_init (acmod, *flags, level,
+ state->clev, state->slev);
+ if (state->output < 0)
+ return 1;
+ if (state->lfeon && (*flags & A52_LFE))
+ state->output |= A52_LFE;
*flags = state->output;
/* the 2* compensates for differences in imdct */
state->dynrng = state->level = 2 * *level;
@@ -178,273 +174,247 @@ int a52_frame(a52_state_t * state, uint8_t * buf, int * flags,
state->dynrngcall = NULL;
state->cplba.deltbae = DELTA_BIT_NONE;
state->ba[0].deltbae = state->ba[1].deltbae = state->ba[2].deltbae =
- state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE;
+ state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE;
chaninfo = !acmod;
- do
- {
- bitstream_get(state, 5); /* dialnorm */
- if(bitstream_get(state, 1)) /* compre */
- bitstream_get(state, 8); /* compr */
- if(bitstream_get(state, 1)) /* langcode */
- bitstream_get(state, 8); /* langcod */
- if(bitstream_get(state, 1)) /* audprodie */
- bitstream_get(state, 7); /* mixlevel + roomtyp */
- }
- while(chaninfo--);
-
- bitstream_get(state, 2); /* copyrightb + origbs */
-
- if(bitstream_get(state, 1)) /* timecod1e */
- bitstream_get(state, 14); /* timecod1 */
- if(bitstream_get(state, 1)) /* timecod2e */
- bitstream_get(state, 14); /* timecod2 */
-
- if(bitstream_get(state, 1)) /* addbsie */
- {
- int addbsil;
-
- addbsil = bitstream_get(state, 6);
- do
- {
- bitstream_get(state, 8); /* addbsi */
- }
- while(addbsil--);
+ do {
+ bitstream_get (state, 5); /* dialnorm */
+ if (bitstream_get (state, 1)) /* compre */
+ bitstream_get (state, 8); /* compr */
+ if (bitstream_get (state, 1)) /* langcode */
+ bitstream_get (state, 8); /* langcod */
+ if (bitstream_get (state, 1)) /* audprodie */
+ bitstream_get (state, 7); /* mixlevel + roomtyp */
+ } while (chaninfo--);
+
+ bitstream_get (state, 2); /* copyrightb + origbs */
+
+ if (bitstream_get (state, 1)) /* timecod1e */
+ bitstream_get (state, 14); /* timecod1 */
+ if (bitstream_get (state, 1)) /* timecod2e */
+ bitstream_get (state, 14); /* timecod2 */
+
+ if (bitstream_get (state, 1)) { /* addbsie */
+ int addbsil;
+
+ addbsil = bitstream_get (state, 6);
+ do {
+ bitstream_get (state, 8); /* addbsi */
+ } while (addbsil--);
}
return 0;
}
-void a52_dynrng(a52_state_t * state,
- sample_t (* call)(sample_t, void *), void * data)
+void a52_dynrng (a52_state_t * state,
+ sample_t (* call) (sample_t, void *), void * data)
{
state->dynrnge = 0;
- if(call)
- {
- state->dynrnge = 1;
- state->dynrngcall = call;
- state->dynrngdata = data;
+ if (call) {
+ state->dynrnge = 1;
+ state->dynrngcall = call;
+ state->dynrngdata = data;
}
}
-static int parse_exponents(a52_state_t * state, int expstr, int ngrps,
- uint8_t exponent, uint8_t * dest)
+static int parse_exponents (a52_state_t * state, int expstr, int ngrps,
+ uint8_t exponent, uint8_t * dest)
{
int exps;
- while(ngrps--)
- {
- exps = bitstream_get(state, 7);
-
- exponent += exp_1[exps];
- if(exponent > 24)
- return 1;
-
- switch(expstr)
- {
- case EXP_D45:
- *(dest++) = exponent;
- *(dest++) = exponent;
- case EXP_D25:
- *(dest++) = exponent;
- case EXP_D15:
- *(dest++) = exponent;
- }
-
- exponent += exp_2[exps];
- if(exponent > 24)
- return 1;
-
- switch(expstr)
- {
- case EXP_D45:
- *(dest++) = exponent;
- *(dest++) = exponent;
- case EXP_D25:
- *(dest++) = exponent;
- case EXP_D15:
- *(dest++) = exponent;
- }
-
- exponent += exp_3[exps];
- if(exponent > 24)
- return 1;
-
- switch(expstr)
- {
- case EXP_D45:
- *(dest++) = exponent;
- *(dest++) = exponent;
- case EXP_D25:
- *(dest++) = exponent;
- case EXP_D15:
- *(dest++) = exponent;
- }
- }
+ while (ngrps--) {
+ exps = bitstream_get (state, 7);
+
+ exponent += exp_1[exps];
+ if (exponent > 24)
+ return 1;
+
+ switch (expstr) {
+ case EXP_D45:
+ *(dest++) = exponent;
+ *(dest++) = exponent;
+ case EXP_D25:
+ *(dest++) = exponent;
+ case EXP_D15:
+ *(dest++) = exponent;
+ }
+
+ exponent += exp_2[exps];
+ if (exponent > 24)
+ return 1;
+
+ switch (expstr) {
+ case EXP_D45:
+ *(dest++) = exponent;
+ *(dest++) = exponent;
+ case EXP_D25:
+ *(dest++) = exponent;
+ case EXP_D15:
+ *(dest++) = exponent;
+ }
+
+ exponent += exp_3[exps];
+ if (exponent > 24)
+ return 1;
+
+ switch (expstr) {
+ case EXP_D45:
+ *(dest++) = exponent;
+ *(dest++) = exponent;
+ case EXP_D25:
+ *(dest++) = exponent;
+ case EXP_D15:
+ *(dest++) = exponent;
+ }
+ }
return 0;
}
-static int parse_deltba(a52_state_t * state, int8_t * deltba)
+static int parse_deltba (a52_state_t * state, int8_t * deltba)
{
int deltnseg, deltlen, delta, j;
- memset(deltba, 0, 50);
+ memset (deltba, 0, 50);
- deltnseg = bitstream_get(state, 3);
+ deltnseg = bitstream_get (state, 3);
j = 0;
- do
- {
- j += bitstream_get(state, 5);
- deltlen = bitstream_get(state, 4);
- delta = bitstream_get(state, 3);
- delta -= (delta >= 4) ? 3 : 4;
- if(!deltlen)
- continue;
- if(j + deltlen >= 50)
- return 1;
- while(deltlen--)
- deltba[j++] = delta;
- }
- while(deltnseg--);
+ do {
+ j += bitstream_get (state, 5);
+ deltlen = bitstream_get (state, 4);
+ delta = bitstream_get (state, 3);
+ delta -= (delta >= 4) ? 3 : 4;
+ if (!deltlen)
+ continue;
+ if (j + deltlen >= 50)
+ return 1;
+ while (deltlen--)
+ deltba[j++] = delta;
+ } while (deltnseg--);
return 0;
}
-static inline int zero_snr_offsets(int nfchans, a52_state_t * state)
+static inline int zero_snr_offsets (int nfchans, a52_state_t * state)
{
int i;
- if((state->csnroffst) ||
- (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */
- (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */
- return 0;
- for(i = 0; i < nfchans; i++)
- if(state->ba[i].bai >> 3) /* fsnroffst */
- return 0;
+ if ((state->csnroffst) ||
+ (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */
+ (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */
+ return 0;
+ for (i = 0; i < nfchans; i++)
+ if (state->ba[i].bai >> 3) /* fsnroffst */
+ return 0;
return 1;
}
-static inline int16_t dither_gen(a52_state_t * state)
+static inline int16_t dither_gen (a52_state_t * state)
{
int16_t nstate;
- nstate = dither_lut[state->lfsr_state >> 8] ^(state->lfsr_state << 8);
-
+ nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8);
+
state->lfsr_state = (uint16_t) nstate;
return nstate;
}
-static void coeff_get(a52_state_t * state, sample_t * coeff,
- expbap_t * expbap, quantizer_t * quantizer,
- sample_t level, int dither, int end)
+static void coeff_get (a52_state_t * state, sample_t * coeff,
+ expbap_t * expbap, quantizer_t * quantizer,
+ sample_t level, int dither, int end)
{
int i;
uint8_t * exp;
int8_t * bap;
sample_t factor[25];
- for(i = 0; i <= 24; i++)
- factor[i] = scale_factor[i] * level;
+ for (i = 0; i <= 24; i++)
+ factor[i] = scale_factor[i] * level;
exp = expbap->exp;
bap = expbap->bap;
- for(i = 0; i < end; i++)
- {
- int bapi;
-
- bapi = bap[i];
- switch(bapi)
- {
- case 0:
- if(dither)
- {
- coeff[i] = dither_gen(state) * LEVEL_3DB * factor[exp[i]];
- continue;
- }
- else
- {
- coeff[i] = 0;
- continue;
- }
-
- case -1:
- if(quantizer->q1_ptr >= 0)
- {
- coeff[i] = quantizer->q1[quantizer->q1_ptr--] * factor[exp[i]];
- continue;
- }
- else
- {
- int code;
-
- code = bitstream_get(state, 5);
-
- quantizer->q1_ptr = 1;
- quantizer->q1[0] = q_1_2[code];
- quantizer->q1[1] = q_1_1[code];
- coeff[i] = q_1_0[code] * factor[exp[i]];
- continue;
- }
-
- case -2:
- if(quantizer->q2_ptr >= 0)
- {
- coeff[i] = quantizer->q2[quantizer->q2_ptr--] * factor[exp[i]];
- continue;
- }
- else
- {
- int code;
-
- code = bitstream_get(state, 7);
-
- quantizer->q2_ptr = 1;
- quantizer->q2[0] = q_2_2[code];
- quantizer->q2[1] = q_2_1[code];
- coeff[i] = q_2_0[code] * factor[exp[i]];
- continue;
- }
-
- case 3:
- coeff[i] = q_3[bitstream_get(state, 3)] * factor[exp[i]];
- continue;
-
- case -3:
- if(quantizer->q4_ptr == 0)
- {
- quantizer->q4_ptr = -1;
- coeff[i] = quantizer->q4 * factor[exp[i]];
- continue;
- }
- else
- {
- int code;
-
- code = bitstream_get(state, 7);
-
- quantizer->q4_ptr = 0;
- quantizer->q4 = q_4_1[code];
- coeff[i] = q_4_0[code] * factor[exp[i]];
- continue;
- }
-
- case 4:
- coeff[i] = q_5[bitstream_get(state, 4)] * factor[exp[i]];
- continue;
-
- default:
- coeff[i] = ((bitstream_get_2(state, bapi) << (16 - bapi)) *
- factor[exp[i]]);
- }
+ for (i = 0; i < end; i++) {
+ int bapi;
+
+ bapi = bap[i];
+ switch (bapi) {
+ case 0:
+ if (dither) {
+ coeff[i] = dither_gen (state) * LEVEL_3DB * factor[exp[i]];
+ continue;
+ } else {
+ coeff[i] = 0;
+ continue;
+ }
+
+ case -1:
+ if (quantizer->q1_ptr >= 0) {
+ coeff[i] = quantizer->q1[quantizer->q1_ptr--] * factor[exp[i]];
+ continue;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 5);
+
+ quantizer->q1_ptr = 1;
+ quantizer->q1[0] = q_1_2[code];
+ quantizer->q1[1] = q_1_1[code];
+ coeff[i] = q_1_0[code] * factor[exp[i]];
+ continue;
+ }
+
+ case -2:
+ if (quantizer->q2_ptr >= 0) {
+ coeff[i] = quantizer->q2[quantizer->q2_ptr--] * factor[exp[i]];
+ continue;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q2_ptr = 1;
+ quantizer->q2[0] = q_2_2[code];
+ quantizer->q2[1] = q_2_1[code];
+ coeff[i] = q_2_0[code] * factor[exp[i]];
+ continue;
+ }
+
+ case 3:
+ coeff[i] = q_3[bitstream_get (state, 3)] * factor[exp[i]];
+ continue;
+
+ case -3:
+ if (quantizer->q4_ptr == 0) {
+ quantizer->q4_ptr = -1;
+ coeff[i] = quantizer->q4 * factor[exp[i]];
+ continue;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q4_ptr = 0;
+ quantizer->q4 = q_4_1[code];
+ coeff[i] = q_4_0[code] * factor[exp[i]];
+ continue;
+ }
+
+ case 4:
+ coeff[i] = q_5[bitstream_get (state, 4)] * factor[exp[i]];
+ continue;
+
+ default:
+ coeff[i] = ((bitstream_get_2 (state, bapi) << (16 - bapi)) *
+ factor[exp[i]]);
+ }
}
}
-static void coeff_get_coupling(a52_state_t * state, int nfchans,
- sample_t * coeff, sample_t (* samples)[256],
- quantizer_t * quantizer, uint8_t dithflag[5])
+static void coeff_get_coupling (a52_state_t * state, int nfchans,
+ sample_t * coeff, sample_t (* samples)[256],
+ quantizer_t * quantizer, uint8_t dithflag[5])
{
int cplbndstrc, bnd, i, i_end, ch;
uint8_t * exp;
@@ -456,120 +426,106 @@ static void coeff_get_coupling(a52_state_t * state, int nfchans,
bnd = 0;
cplbndstrc = state->cplbndstrc;
i = state->cplstrtmant;
- while(i < state->cplendmant)
- {
- i_end = i + 12;
- while(cplbndstrc & 1)
- {
- cplbndstrc >>= 1;
- i_end += 12;
- }
- cplbndstrc >>= 1;
- for(ch = 0; ch < nfchans; ch++)
- cplco[ch] = state->cplco[ch][bnd] * coeff[ch];
- bnd++;
-
- while(i < i_end)
- {
- sample_t cplcoeff;
- int bapi;
-
- bapi = bap[i];
- switch(bapi)
- {
- case 0:
- cplcoeff = LEVEL_3DB * scale_factor[exp[i]];
- for(ch = 0; ch < nfchans; ch++)
- if((state->chincpl >> ch) & 1)
- {
- if(dithflag[ch])
- samples[ch][i] = (cplcoeff * cplco[ch] *
- dither_gen(state));
- else
- samples[ch][i] = 0;
- }
- i++;
- continue;
-
- case -1:
- if(quantizer->q1_ptr >= 0)
- {
- cplcoeff = quantizer->q1[quantizer->q1_ptr--];
- break;
- }
- else
- {
- int code;
-
- code = bitstream_get(state, 5);
-
- quantizer->q1_ptr = 1;
- quantizer->q1[0] = q_1_2[code];
- quantizer->q1[1] = q_1_1[code];
- cplcoeff = q_1_0[code];
- break;
- }
-
- case -2:
- if(quantizer->q2_ptr >= 0)
- {
- cplcoeff = quantizer->q2[quantizer->q2_ptr--];
- break;
- }
- else
- {
- int code;
-
- code = bitstream_get(state, 7);
-
- quantizer->q2_ptr = 1;
- quantizer->q2[0] = q_2_2[code];
- quantizer->q2[1] = q_2_1[code];
- cplcoeff = q_2_0[code];
- break;
- }
-
- case 3:
- cplcoeff = q_3[bitstream_get(state, 3)];
- break;
-
- case -3:
- if(quantizer->q4_ptr == 0)
- {
- quantizer->q4_ptr = -1;
- cplcoeff = quantizer->q4;
- break;
- }
- else
- {
- int code;
-
- code = bitstream_get(state, 7);
-
- quantizer->q4_ptr = 0;
- quantizer->q4 = q_4_1[code];
- cplcoeff = q_4_0[code];
- break;
- }
-
- case 4:
- cplcoeff = q_5[bitstream_get(state, 4)];
- break;
-
- default:
- cplcoeff = bitstream_get_2(state, bapi) << (16 - bapi);
- }
-
- cplcoeff *= scale_factor[exp[i]];
- for(ch = 0; ch < nfchans; ch++)
- if((state->chincpl >> ch) & 1)
- samples[ch][i] = cplcoeff * cplco[ch];
- i++;
- }
+ while (i < state->cplendmant) {
+ i_end = i + 12;
+ while (cplbndstrc & 1) {
+ cplbndstrc >>= 1;
+ i_end += 12;
+ }
+ cplbndstrc >>= 1;
+ for (ch = 0; ch < nfchans; ch++)
+ cplco[ch] = state->cplco[ch][bnd] * coeff[ch];
+ bnd++;
+
+ while (i < i_end) {
+ sample_t cplcoeff;
+ int bapi;
+
+ bapi = bap[i];
+ switch (bapi) {
+ case 0:
+ cplcoeff = LEVEL_3DB * scale_factor[exp[i]];
+ for (ch = 0; ch < nfchans; ch++)
+ if ((state->chincpl >> ch) & 1) {
+ if (dithflag[ch])
+ samples[ch][i] = (cplcoeff * cplco[ch] *
+ dither_gen (state));
+ else
+ samples[ch][i] = 0;
+ }
+ i++;
+ continue;
+
+ case -1:
+ if (quantizer->q1_ptr >= 0) {
+ cplcoeff = quantizer->q1[quantizer->q1_ptr--];
+ break;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 5);
+
+ quantizer->q1_ptr = 1;
+ quantizer->q1[0] = q_1_2[code];
+ quantizer->q1[1] = q_1_1[code];
+ cplcoeff = q_1_0[code];
+ break;
+ }
+
+ case -2:
+ if (quantizer->q2_ptr >= 0) {
+ cplcoeff = quantizer->q2[quantizer->q2_ptr--];
+ break;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q2_ptr = 1;
+ quantizer->q2[0] = q_2_2[code];
+ quantizer->q2[1] = q_2_1[code];
+ cplcoeff = q_2_0[code];
+ break;
+ }
+
+ case 3:
+ cplcoeff = q_3[bitstream_get (state, 3)];
+ break;
+
+ case -3:
+ if (quantizer->q4_ptr == 0) {
+ quantizer->q4_ptr = -1;
+ cplcoeff = quantizer->q4;
+ break;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q4_ptr = 0;
+ quantizer->q4 = q_4_1[code];
+ cplcoeff = q_4_0[code];
+ break;
+ }
+
+ case 4:
+ cplcoeff = q_5[bitstream_get (state, 4)];
+ break;
+
+ default:
+ cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi);
+ }
+
+ cplcoeff *= scale_factor[exp[i]];
+ for (ch = 0; ch < nfchans; ch++)
+ if ((state->chincpl >> ch) & 1)
+ samples[ch][i] = cplcoeff * cplco[ch];
+ i++;
+ }
}
}
-int a52_block(a52_state_t * state)
+int a52_block (a52_state_t * state)
{
static const uint8_t nfchans_tbl[] = {2, 1, 2, 3, 3, 4, 4, 5, 1, 1, 2};
static int rematrix_band[4] = {25, 37, 61, 253};
@@ -583,421 +539,369 @@ int a52_block(a52_state_t * state)
nfchans = nfchans_tbl[state->acmod];
- for(i = 0; i < nfchans; i++)
- blksw[i] = bitstream_get(state, 1);
+ for (i = 0; i < nfchans; i++)
+ blksw[i] = bitstream_get (state, 1);
- for(i = 0; i < nfchans; i++)
- dithflag[i] = bitstream_get(state, 1);
+ for (i = 0; i < nfchans; i++)
+ dithflag[i] = bitstream_get (state, 1);
chaninfo = !state->acmod;
- do
- {
- if(bitstream_get(state, 1)) /* dynrnge */
- {
- int dynrng;
-
- dynrng = bitstream_get_2(state, 8);
- if(state->dynrnge)
- {
- sample_t range;
-
- range = ((((dynrng & 0x1f) | 0x20) << 13) *
- scale_factor[3 - (dynrng >> 5)]);
- if(state->dynrngcall)
- range = state->dynrngcall(range, state->dynrngdata);
- state->dynrng = state->level * range;
- }
- }
- }
- while(chaninfo--);
-
- if(bitstream_get(state, 1)) /* cplstre */
- {
- state->chincpl = 0;
- if(bitstream_get(state, 1)) /* cplinu */
- {
- static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44,
- 45, 45, 46, 46, 47, 47, 48, 48
- };
- int cplbegf;
- int cplendf;
- int ncplsubnd;
-
- for(i = 0; i < nfchans; i++)
- state->chincpl |= bitstream_get(state, 1) << i;
- switch(state->acmod)
- {
- case 0:
- case 1:
- return 1;
- case 2:
- state->phsflginu = bitstream_get(state, 1);
- }
- cplbegf = bitstream_get(state, 4);
- cplendf = bitstream_get(state, 4);
-
- if(cplendf + 3 - cplbegf < 0)
- return 1;
- state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf;
- state->cplstrtbnd = bndtab[cplbegf];
- state->cplstrtmant = cplbegf * 12 + 37;
- state->cplendmant = cplendf * 12 + 73;
-
- state->cplbndstrc = 0;
- for(i = 0; i < ncplsubnd - 1; i++)
- if(bitstream_get(state, 1))
- {
- state->cplbndstrc |= 1 << i;
- state->ncplbnd--;
- }
- }
+ do {
+ if (bitstream_get (state, 1)) { /* dynrnge */
+ int dynrng;
+
+ dynrng = bitstream_get_2 (state, 8);
+ if (state->dynrnge) {
+ sample_t range;
+
+ range = ((((dynrng & 0x1f) | 0x20) << 13) *
+ scale_factor[3 - (dynrng >> 5)]);
+ if (state->dynrngcall)
+ range = state->dynrngcall (range, state->dynrngdata);
+ state->dynrng = state->level * range;
+ }
+ }
+ } while (chaninfo--);
+
+ if (bitstream_get (state, 1)) { /* cplstre */
+ state->chincpl = 0;
+ if (bitstream_get (state, 1)) { /* cplinu */
+ static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44,
+ 45, 45, 46, 46, 47, 47, 48, 48};
+ int cplbegf;
+ int cplendf;
+ int ncplsubnd;
+
+ for (i = 0; i < nfchans; i++)
+ state->chincpl |= bitstream_get (state, 1) << i;
+ switch (state->acmod) {
+ case 0: case 1:
+ return 1;
+ case 2:
+ state->phsflginu = bitstream_get (state, 1);
+ }
+ cplbegf = bitstream_get (state, 4);
+ cplendf = bitstream_get (state, 4);
+
+ if (cplendf + 3 - cplbegf < 0)
+ return 1;
+ state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf;
+ state->cplstrtbnd = bndtab[cplbegf];
+ state->cplstrtmant = cplbegf * 12 + 37;
+ state->cplendmant = cplendf * 12 + 73;
+
+ state->cplbndstrc = 0;
+ for (i = 0; i < ncplsubnd - 1; i++)
+ if (bitstream_get (state, 1)) {
+ state->cplbndstrc |= 1 << i;
+ state->ncplbnd--;
+ }
+ }
}
- if(state->chincpl) /* cplinu */
- {
- int j, cplcoe;
-
- cplcoe = 0;
- for(i = 0; i < nfchans; i++)
- if((state->chincpl) >> i & 1)
- if(bitstream_get(state, 1)) /* cplcoe */
- {
- int mstrcplco, cplcoexp, cplcomant;
-
- cplcoe = 1;
- mstrcplco = 3 * bitstream_get(state, 2);
- for(j = 0; j < state->ncplbnd; j++)
- {
- cplcoexp = bitstream_get(state, 4);
- cplcomant = bitstream_get(state, 4);
- if(cplcoexp == 15)
- cplcomant <<= 14;
- else
- cplcomant = (cplcomant | 0x10) << 13;
- state->cplco[i][j] =
- cplcomant * scale_factor[cplcoexp + mstrcplco];
- }
- }
- if((state->acmod == 2) && state->phsflginu && cplcoe)
- for(j = 0; j < state->ncplbnd; j++)
- if(bitstream_get(state, 1)) /* phsflg */
- state->cplco[1][j] = -state->cplco[1][j];
+ if (state->chincpl) { /* cplinu */
+ int j, cplcoe;
+
+ cplcoe = 0;
+ for (i = 0; i < nfchans; i++)
+ if ((state->chincpl) >> i & 1)
+ if (bitstream_get (state, 1)) { /* cplcoe */
+ int mstrcplco, cplcoexp, cplcomant;
+
+ cplcoe = 1;
+ mstrcplco = 3 * bitstream_get (state, 2);
+ for (j = 0; j < state->ncplbnd; j++) {
+ cplcoexp = bitstream_get (state, 4);
+ cplcomant = bitstream_get (state, 4);
+ if (cplcoexp == 15)
+ cplcomant <<= 14;
+ else
+ cplcomant = (cplcomant | 0x10) << 13;
+ state->cplco[i][j] =
+ cplcomant * scale_factor[cplcoexp + mstrcplco];
+ }
+ }
+ if ((state->acmod == 2) && state->phsflginu && cplcoe)
+ for (j = 0; j < state->ncplbnd; j++)
+ if (bitstream_get (state, 1)) /* phsflg */
+ state->cplco[1][j] = -state->cplco[1][j];
}
- if((state->acmod == 2) && (bitstream_get(state, 1))) /* rematstr */
- {
- int end;
+ if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */
+ int end;
- state->rematflg = 0;
- end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */
- i = 0;
- do
- state->rematflg |= bitstream_get(state, 1) << i;
- while(rematrix_band[i++] < end);
+ state->rematflg = 0;
+ end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */
+ i = 0;
+ do
+ state->rematflg |= bitstream_get (state, 1) << i;
+ while (rematrix_band[i++] < end);
}
cplexpstr = EXP_REUSE;
lfeexpstr = EXP_REUSE;
- if(state->chincpl) /* cplinu */
- cplexpstr = bitstream_get(state, 2);
- for(i = 0; i < nfchans; i++)
- chexpstr[i] = bitstream_get(state, 2);
- if(state->lfeon)
- lfeexpstr = bitstream_get(state, 1);
-
- for(i = 0; i < nfchans; i++)
- if(chexpstr[i] != EXP_REUSE)
- {
- if((state->chincpl >> i) & 1)
- state->endmant[i] = state->cplstrtmant;
- else
- {
- int chbwcod;
-
- chbwcod = bitstream_get(state, 6);
- if(chbwcod > 60)
- return 1;
- state->endmant[i] = chbwcod * 3 + 73;
- }
- }
+ if (state->chincpl) /* cplinu */
+ cplexpstr = bitstream_get (state, 2);
+ for (i = 0; i < nfchans; i++)
+ chexpstr[i] = bitstream_get (state, 2);
+ if (state->lfeon)
+ lfeexpstr = bitstream_get (state, 1);
+
+ for (i = 0; i < nfchans; i++)
+ if (chexpstr[i] != EXP_REUSE) {
+ if ((state->chincpl >> i) & 1)
+ state->endmant[i] = state->cplstrtmant;
+ else {
+ int chbwcod;
+
+ chbwcod = bitstream_get (state, 6);
+ if (chbwcod > 60)
+ return 1;
+ state->endmant[i] = chbwcod * 3 + 73;
+ }
+ }
do_bit_alloc = 0;
- if(cplexpstr != EXP_REUSE)
- {
- int cplabsexp, ncplgrps;
-
- do_bit_alloc = 64;
- ncplgrps = ((state->cplendmant - state->cplstrtmant) /
- (3 << (cplexpstr - 1)));
- cplabsexp = bitstream_get(state, 4) << 1;
- if(parse_exponents(state, cplexpstr, ncplgrps, cplabsexp,
- state->cpl_expbap.exp + state->cplstrtmant))
- return 1;
+ if (cplexpstr != EXP_REUSE) {
+ int cplabsexp, ncplgrps;
+
+ do_bit_alloc = 64;
+ ncplgrps = ((state->cplendmant - state->cplstrtmant) /
+ (3 << (cplexpstr - 1)));
+ cplabsexp = bitstream_get (state, 4) << 1;
+ if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp,
+ state->cpl_expbap.exp + state->cplstrtmant))
+ return 1;
}
- for(i = 0; i < nfchans; i++)
- if(chexpstr[i] != EXP_REUSE)
- {
- int grp_size, nchgrps;
-
- do_bit_alloc |= 1 << i;
- grp_size = 3 << (chexpstr[i] - 1);
- nchgrps = (state->endmant[i] + grp_size - 4) / grp_size;
- state->fbw_expbap[i].exp[0] = bitstream_get(state, 4);
- if(parse_exponents(state, chexpstr[i], nchgrps,
- state->fbw_expbap[i].exp[0],
- state->fbw_expbap[i].exp + 1))
- return 1;
- bitstream_get(state, 2); /* gainrng */
- }
- if(lfeexpstr != EXP_REUSE)
- {
- do_bit_alloc |= 32;
- state->lfe_expbap.exp[0] = bitstream_get(state, 4);
- if(parse_exponents(state, lfeexpstr, 2, state->lfe_expbap.exp[0],
- state->lfe_expbap.exp + 1))
- return 1;
+ for (i = 0; i < nfchans; i++)
+ if (chexpstr[i] != EXP_REUSE) {
+ int grp_size, nchgrps;
+
+ do_bit_alloc |= 1 << i;
+ grp_size = 3 << (chexpstr[i] - 1);
+ nchgrps = (state->endmant[i] + grp_size - 4) / grp_size;
+ state->fbw_expbap[i].exp[0] = bitstream_get (state, 4);
+ if (parse_exponents (state, chexpstr[i], nchgrps,
+ state->fbw_expbap[i].exp[0],
+ state->fbw_expbap[i].exp + 1))
+ return 1;
+ bitstream_get (state, 2); /* gainrng */
+ }
+ if (lfeexpstr != EXP_REUSE) {
+ do_bit_alloc |= 32;
+ state->lfe_expbap.exp[0] = bitstream_get (state, 4);
+ if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0],
+ state->lfe_expbap.exp + 1))
+ return 1;
}
- if(bitstream_get(state, 1)) /* baie */
- {
- do_bit_alloc = 127;
- state->bai = bitstream_get(state, 11);
+ if (bitstream_get (state, 1)) { /* baie */
+ do_bit_alloc = 127;
+ state->bai = bitstream_get (state, 11);
}
- if(bitstream_get(state, 1)) /* snroffste */
- {
- do_bit_alloc = 127;
- state->csnroffst = bitstream_get(state, 6);
- if(state->chincpl) /* cplinu */
- state->cplba.bai = bitstream_get(state, 7);
- for(i = 0; i < nfchans; i++)
- state->ba[i].bai = bitstream_get(state, 7);
- if(state->lfeon)
- state->lfeba.bai = bitstream_get(state, 7);
+ if (bitstream_get (state, 1)) { /* snroffste */
+ do_bit_alloc = 127;
+ state->csnroffst = bitstream_get (state, 6);
+ if (state->chincpl) /* cplinu */
+ state->cplba.bai = bitstream_get (state, 7);
+ for (i = 0; i < nfchans; i++)
+ state->ba[i].bai = bitstream_get (state, 7);
+ if (state->lfeon)
+ state->lfeba.bai = bitstream_get (state, 7);
}
- if((state->chincpl) && (bitstream_get(state, 1))) /* cplleake */
- {
- do_bit_alloc |= 64;
- state->cplfleak = 9 - bitstream_get(state, 3);
- state->cplsleak = 9 - bitstream_get(state, 3);
+ if ((state->chincpl) && (bitstream_get (state, 1))) { /* cplleake */
+ do_bit_alloc |= 64;
+ state->cplfleak = 9 - bitstream_get (state, 3);
+ state->cplsleak = 9 - bitstream_get (state, 3);
}
- if(bitstream_get(state, 1)) /* deltbaie */
- {
- do_bit_alloc = 127;
- if(state->chincpl) /* cplinu */
- state->cplba.deltbae = bitstream_get(state, 2);
- for(i = 0; i < nfchans; i++)
- state->ba[i].deltbae = bitstream_get(state, 2);
- if(state->chincpl && /* cplinu */
- (state->cplba.deltbae == DELTA_BIT_NEW) &&
- parse_deltba(state, state->cplba.deltba))
- return 1;
- for(i = 0; i < nfchans; i++)
- if((state->ba[i].deltbae == DELTA_BIT_NEW) &&
- parse_deltba(state, state->ba[i].deltba))
- return 1;
+ if (bitstream_get (state, 1)) { /* deltbaie */
+ do_bit_alloc = 127;
+ if (state->chincpl) /* cplinu */
+ state->cplba.deltbae = bitstream_get (state, 2);
+ for (i = 0; i < nfchans; i++)
+ state->ba[i].deltbae = bitstream_get (state, 2);
+ if (state->chincpl && /* cplinu */
+ (state->cplba.deltbae == DELTA_BIT_NEW) &&
+ parse_deltba (state, state->cplba.deltba))
+ return 1;
+ for (i = 0; i < nfchans; i++)
+ if ((state->ba[i].deltbae == DELTA_BIT_NEW) &&
+ parse_deltba (state, state->ba[i].deltba))
+ return 1;
}
- if(do_bit_alloc)
- {
- if(zero_snr_offsets(nfchans, state))
- {
- memset(state->cpl_expbap.bap, 0, sizeof(state->cpl_expbap.bap));
- for(i = 0; i < nfchans; i++)
- memset(state->fbw_expbap[i].bap, 0,
- sizeof(state->fbw_expbap[i].bap));
- memset(state->lfe_expbap.bap, 0, sizeof(state->lfe_expbap.bap));
- }
- else
- {
- if(state->chincpl && (do_bit_alloc & 64)) /* cplinu */
- a52_bit_allocate(state, &state->cplba, state->cplstrtbnd,
- state->cplstrtmant, state->cplendmant,
- state->cplfleak << 8, state->cplsleak << 8,
- &state->cpl_expbap);
- for(i = 0; i < nfchans; i++)
- if(do_bit_alloc & (1 << i))
- a52_bit_allocate(state, state->ba + i, 0, 0,
- state->endmant[i], 0, 0,
- state->fbw_expbap + i);
- if(state->lfeon && (do_bit_alloc & 32))
- {
- state->lfeba.deltbae = DELTA_BIT_NONE;
- a52_bit_allocate(state, &state->lfeba, 0, 0, 7, 0, 0,
- &state->lfe_expbap);
- }
- }
+ if (do_bit_alloc) {
+ if (zero_snr_offsets (nfchans, state)) {
+ memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap));
+ for (i = 0; i < nfchans; i++)
+ memset (state->fbw_expbap[i].bap, 0,
+ sizeof (state->fbw_expbap[i].bap));
+ memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap));
+ } else {
+ if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */
+ a52_bit_allocate (state, &state->cplba, state->cplstrtbnd,
+ state->cplstrtmant, state->cplendmant,
+ state->cplfleak << 8, state->cplsleak << 8,
+ &state->cpl_expbap);
+ for (i = 0; i < nfchans; i++)
+ if (do_bit_alloc & (1 << i))
+ a52_bit_allocate (state, state->ba + i, 0, 0,
+ state->endmant[i], 0, 0,
+ state->fbw_expbap +i);
+ if (state->lfeon && (do_bit_alloc & 32)) {
+ state->lfeba.deltbae = DELTA_BIT_NONE;
+ a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0,
+ &state->lfe_expbap);
+ }
+ }
}
- if(bitstream_get(state, 1)) /* skiple */
- {
- i = bitstream_get(state, 9); /* skipl */
- while(i--)
- bitstream_get(state, 8);
+ if (bitstream_get (state, 1)) { /* skiple */
+ i = bitstream_get (state, 9); /* skipl */
+ while (i--)
+ bitstream_get (state, 8);
}
samples = state->samples;
- if(state->output & A52_LFE)
- samples += 256; /* shift for LFE channel */
+ if (state->output & A52_LFE)
+ samples += 256; /* shift for LFE channel */
- chanbias = a52_downmix_coeff(coeff, state->acmod, state->output,
- state->dynrng, state->clev, state->slev);
+ chanbias = a52_downmix_coeff (coeff, state->acmod, state->output,
+ state->dynrng, state->clev, state->slev);
quantizer.q1_ptr = quantizer.q2_ptr = quantizer.q4_ptr = -1;
done_cpl = 0;
- for(i = 0; i < nfchans; i++)
- {
- int j;
-
- coeff_get(state, samples + 256 * i, state->fbw_expbap + i, &quantizer,
- coeff[i], dithflag[i], state->endmant[i]);
-
- if((state->chincpl >> i) & 1)
- {
- if(!done_cpl)
- {
- done_cpl = 1;
- coeff_get_coupling(state, nfchans, coeff,
- (sample_t (*)[256])samples, &quantizer,
- dithflag);
- }
- j = state->cplendmant;
- }
- else
- j = state->endmant[i];
- do
- (samples + 256 * i)[j] = 0;
- while(++j < 256);
+ for (i = 0; i < nfchans; i++) {
+ int j;
+
+ coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quantizer,
+ coeff[i], dithflag[i], state->endmant[i]);
+
+ if ((state->chincpl >> i) & 1) {
+ if (!done_cpl) {
+ done_cpl = 1;
+ coeff_get_coupling (state, nfchans, coeff,
+ (sample_t (*)[256])samples, &quantizer,
+ dithflag);
+ }
+ j = state->cplendmant;
+ } else
+ j = state->endmant[i];
+ do
+ (samples + 256 * i)[j] = 0;
+ while (++j < 256);
}
- if(state->acmod == 2)
- {
- int j, end, band, rematflg;
-
- end = ((state->endmant[0] < state->endmant[1]) ?
- state->endmant[0] : state->endmant[1]);
-
- i = 0;
- j = 13;
- rematflg = state->rematflg;
- do
- {
- if(!(rematflg & 1))
- {
- rematflg >>= 1;
- j = rematrix_band[i++];
- continue;
- }
- rematflg >>= 1;
- band = rematrix_band[i++];
- if(band > end)
- band = end;
- do
- {
- sample_t tmp0, tmp1;
-
- tmp0 = samples[j];
- tmp1 = (samples + 256)[j];
- samples[j] = tmp0 + tmp1;
- (samples + 256)[j] = tmp0 - tmp1;
- }
- while(++j < band);
- }
- while(j < end);
+ if (state->acmod == 2) {
+ int j, end, band, rematflg;
+
+ end = ((state->endmant[0] < state->endmant[1]) ?
+ state->endmant[0] : state->endmant[1]);
+
+ i = 0;
+ j = 13;
+ rematflg = state->rematflg;
+ do {
+ if (! (rematflg & 1)) {
+ rematflg >>= 1;
+ j = rematrix_band[i++];
+ continue;
+ }
+ rematflg >>= 1;
+ band = rematrix_band[i++];
+ if (band > end)
+ band = end;
+ do {
+ sample_t tmp0, tmp1;
+
+ tmp0 = samples[j];
+ tmp1 = (samples+256)[j];
+ samples[j] = tmp0 + tmp1;
+ (samples+256)[j] = tmp0 - tmp1;
+ } while (++j < band);
+ } while (j < end);
}
- if(state->lfeon)
- {
- if(state->output & A52_LFE)
- {
- coeff_get(state, samples - 256, &state->lfe_expbap, &quantizer,
- state->dynrng, 0, 7);
- for(i = 7; i < 256; i++)
- (samples - 256)[i] = 0;
- a52_imdct_512(samples - 256, samples + 1536 - 256, state->bias);
- }
- else
- {
- /* just skip the LFE coefficients */
- coeff_get(state, samples + 1280, &state->lfe_expbap, &quantizer,
- 0, 0, 7);
- }
+ if (state->lfeon) {
+ if (state->output & A52_LFE) {
+ coeff_get (state, samples - 256, &state->lfe_expbap, &quantizer,
+ state->dynrng, 0, 7);
+ for (i = 7; i < 256; i++)
+ (samples-256)[i] = 0;
+ a52_imdct_512 (samples - 256, samples + 1536 - 256, state->bias);
+ } else {
+ /* just skip the LFE coefficients */
+ coeff_get (state, samples + 1280, &state->lfe_expbap, &quantizer,
+ 0, 0, 7);
+ }
}
i = 0;
- if(nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans)
- for(i = 1; i < nfchans; i++)
- if(blksw[i] != blksw[0])
- break;
-
- if(i < nfchans)
- {
- if(state->downmixed)
- {
- state->downmixed = 0;
- a52_upmix(samples + 1536, state->acmod, state->output);
- }
-
- for(i = 0; i < nfchans; i++)
- {
- sample_t bias;
-
- bias = 0;
- if(!(chanbias & (1 << i)))
- bias = state->bias;
-
- if(coeff[i])
- {
- if(blksw[i])
- a52_imdct_256(samples + 256 * i, samples + 1536 + 256 * i,
- bias);
- else
- a52_imdct_512(samples + 256 * i, samples + 1536 + 256 * i,
- bias);
- }
- else
- {
- int j;
-
- for(j = 0; j < 256; j++)
- (samples + 256 * i)[j] = bias;
- }
- }
-
- a52_downmix(samples, state->acmod, state->output, state->bias,
- state->clev, state->slev);
- }
- else
- {
- nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK];
-
- a52_downmix(samples, state->acmod, state->output, 0,
- state->clev, state->slev);
-
- if(!state->downmixed)
- {
- state->downmixed = 1;
- a52_downmix(samples + 1536, state->acmod, state->output, 0,
- state->clev, state->slev);
- }
-
- if(blksw[0])
- for(i = 0; i < nfchans; i++)
- a52_imdct_256(samples + 256 * i, samples + 1536 + 256 * i,
- state->bias);
- else
- for(i = 0; i < nfchans; i++)
- a52_imdct_512(samples + 256 * i, samples + 1536 + 256 * i,
- state->bias);
+ if (nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans)
+ for (i = 1; i < nfchans; i++)
+ if (blksw[i] != blksw[0])
+ break;
+
+ if (i < nfchans) {
+ if (state->downmixed) {
+ state->downmixed = 0;
+ a52_upmix (samples + 1536, state->acmod, state->output);
+ }
+
+ for (i = 0; i < nfchans; i++) {
+ sample_t bias;
+
+ bias = 0;
+ if (!(chanbias & (1 << i)))
+ bias = state->bias;
+
+ if (coeff[i]) {
+ if (blksw[i])
+ a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i,
+ bias);
+ else
+ a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i,
+ bias);
+ } else {
+ int j;
+
+ for (j = 0; j < 256; j++)
+ (samples + 256 * i)[j] = bias;
+ }
+ }
+
+ a52_downmix (samples, state->acmod, state->output, state->bias,
+ state->clev, state->slev);
+ } else {
+ nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK];
+
+ a52_downmix (samples, state->acmod, state->output, 0,
+ state->clev, state->slev);
+
+ if (!state->downmixed) {
+ state->downmixed = 1;
+ a52_downmix (samples + 1536, state->acmod, state->output, 0,
+ state->clev, state->slev);
+ }
+
+ if (blksw[0])
+ for (i = 0; i < nfchans; i++)
+ a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i,
+ state->bias);
+ else
+ for (i = 0; i < nfchans; i++)
+ a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i,
+ state->bias);
}
return 0;
}
-void a52_free(a52_state_t * state)
+void a52_free (a52_state_t * state)
{
- free(state->samples);
- free(state);
+ free (state->samples);
+ free (state);
}
diff --git a/src/filters/transform/MpaDecFilter/a52dec/liba52/tables.h b/src/filters/transform/MpaDecFilter/a52dec/liba52/tables.h
index 904cccb62..8011715b1 100644
--- a/src/filters/transform/MpaDecFilter/a52dec/liba52/tables.h
+++ b/src/filters/transform/MpaDecFilter/a52dec/liba52/tables.h
@@ -21,60 +21,54 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-static const int8_t exp_1[128] =
-{
- -2, -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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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,
- 25, 25, 25
+static const int8_t exp_1[128] = {
+ -2,-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,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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,
+ 25,25,25
};
-static const int8_t exp_2[128] =
-{
- -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- 25, 25, 25
+static const int8_t exp_2[128] = {
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 25,25,25
};
-static const int8_t exp_3[128] =
-{
- -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
- -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2,
- 25, 25, 25
+static const int8_t exp_3[128] = {
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ 25,25,25
};
#define Q0 ((-2 << 15) / 3.0)
#define Q1 (0)
#define Q2 ((2 << 15) / 3.0)
-static const sample_t q_1_0[32] =
-{
- Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0,
- Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1,
- Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2,
- 0, 0, 0, 0, 0
+static const sample_t q_1_0[32] = {
+ Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
+ Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
+ Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
+ 0,0,0,0,0
};
-static const sample_t q_1_1[32] =
-{
- Q0, Q0, Q0, Q1, Q1, Q1, Q2, Q2, Q2,
- Q0, Q0, Q0, Q1, Q1, Q1, Q2, Q2, Q2,
- Q0, Q0, Q0, Q1, Q1, Q1, Q2, Q2, Q2,
- 0, 0, 0, 0, 0
+static const sample_t q_1_1[32] = {
+ Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
+ Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
+ Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
+ 0,0,0,0,0
};
-static const sample_t q_1_2[32] =
-{
- Q0, Q1, Q2, Q0, Q1, Q2, Q0, Q1, Q2,
- Q0, Q1, Q2, Q0, Q1, Q2, Q0, Q1, Q2,
- Q0, Q1, Q2, Q0, Q1, Q2, Q0, Q1, Q2,
- 0, 0, 0, 0, 0
+static const sample_t q_1_2[32] = {
+ Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
+ Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
+ Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
+ 0,0,0,0,0
};
#undef Q0
@@ -87,34 +81,31 @@ static const sample_t q_1_2[32] =
#define Q3 ((2 << 15) / 5.0)
#define Q4 ((4 << 15) / 5.0)
-static const sample_t q_2_0[128] =
-{
- Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0,
- Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1,
- Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2,
- Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3,
- Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4,
- 0, 0, 0
+static const sample_t q_2_0[128] = {
+ Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
+ Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
+ Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
+ Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,
+ Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,
+ 0,0,0
};
-static const sample_t q_2_1[128] =
-{
- Q0, Q0, Q0, Q0, Q0, Q1, Q1, Q1, Q1, Q1, Q2, Q2, Q2, Q2, Q2, Q3, Q3, Q3, Q3, Q3, Q4, Q4, Q4, Q4, Q4,
- Q0, Q0, Q0, Q0, Q0, Q1, Q1, Q1, Q1, Q1, Q2, Q2, Q2, Q2, Q2, Q3, Q3, Q3, Q3, Q3, Q4, Q4, Q4, Q4, Q4,
- Q0, Q0, Q0, Q0, Q0, Q1, Q1, Q1, Q1, Q1, Q2, Q2, Q2, Q2, Q2, Q3, Q3, Q3, Q3, Q3, Q4, Q4, Q4, Q4, Q4,
- Q0, Q0, Q0, Q0, Q0, Q1, Q1, Q1, Q1, Q1, Q2, Q2, Q2, Q2, Q2, Q3, Q3, Q3, Q3, Q3, Q4, Q4, Q4, Q4, Q4,
- Q0, Q0, Q0, Q0, Q0, Q1, Q1, Q1, Q1, Q1, Q2, Q2, Q2, Q2, Q2, Q3, Q3, Q3, Q3, Q3, Q4, Q4, Q4, Q4, Q4,
- 0, 0, 0
+static const sample_t q_2_1[128] = {
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ 0,0,0
};
-static const sample_t q_2_2[128] =
-{
- Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4,
- Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4,
- Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4,
- Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4,
- Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4, Q0, Q1, Q2, Q3, Q4,
- 0, 0, 0
+static const sample_t q_2_2[128] = {
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ 0,0,0
};
#undef Q0
@@ -123,10 +114,9 @@ static const sample_t q_2_2[128] =
#undef Q3
#undef Q4
-static const sample_t q_3[8] =
-{
- (-6 << 15) / 7.0, (-4 << 15) / 7.0, (-2 << 15) / 7.0, 0,
- (2 << 15) / 7.0, (4 << 15) / 7.0, (6 << 15) / 7.0, 0
+static const sample_t q_3[8] = {
+ (-6 << 15)/7.0, (-4 << 15)/7.0, (-2 << 15)/7.0, 0,
+ ( 2 << 15)/7.0, ( 4 << 15)/7.0, ( 6 << 15)/7.0, 0
};
#define Q0 ((-10 << 15) / 11.0)
@@ -141,8 +131,7 @@ static const sample_t q_3[8] =
#define Q9 ((8 << 15) / 11.0)
#define QA ((10 << 15) / 11.0)
-static const sample_t q_4_0[128] =
-{
+static const sample_t q_4_0[128] = {
Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0,
Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1,
Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2,
@@ -157,8 +146,7 @@ static const sample_t q_4_0[128] =
0, 0, 0, 0, 0, 0, 0
};
-static const sample_t q_4_1[128] =
-{
+static const sample_t q_4_1[128] = {
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
@@ -185,18 +173,16 @@ static const sample_t q_4_1[128] =
#undef Q9
#undef QA
-static const sample_t q_5[16] =
-{
- (-14 << 15) / 15.0, (-12 << 15) / 15.0, (-10 << 15) / 15.0,
- (-8 << 15) / 15.0, (-6 << 15) / 15.0, (-4 << 15) / 15.0,
- (-2 << 15) / 15.0, 0 , (2 << 15) / 15.0,
- (4 << 15) / 15.0, (6 << 15) / 15.0, (8 << 15) / 15.0,
- (10 << 15) / 15.0, (12 << 15) / 15.0, (14 << 15) / 15.0,
+static const sample_t q_5[16] = {
+ (-14 << 15)/15.0,(-12 << 15)/15.0,(-10 << 15)/15.0,
+ ( -8 << 15)/15.0,( -6 << 15)/15.0,( -4 << 15)/15.0,
+ ( -2 << 15)/15.0, 0 ,( 2 << 15)/15.0,
+ ( 4 << 15)/15.0,( 6 << 15)/15.0,( 8 << 15)/15.0,
+ ( 10 << 15)/15.0,( 12 << 15)/15.0,( 14 << 15)/15.0,
0
};
-static const sample_t scale_factor[25] =
-{
+static const sample_t scale_factor[25] = {
0.000030517578125,
0.0000152587890625,
0.00000762939453125,
@@ -224,8 +210,7 @@ static const sample_t scale_factor[25] =
0.000000000001818989403545856475830078125
};
-static const uint16_t dither_lut[256] =
-{
+static const uint16_t dither_lut[256] = {
0x0000, 0xa011, 0xe033, 0x4022, 0x6077, 0xc066, 0x8044, 0x2055,
0xc0ee, 0x60ff, 0x20dd, 0x80cc, 0xa099, 0x0088, 0x40aa, 0xe0bb,
0x21cd, 0x81dc, 0xc1fe, 0x61ef, 0x41ba, 0xe1ab, 0xa189, 0x0198,
diff --git a/src/filters/transform/MpaDecFilter/faad2/include/faad.h b/src/filters/transform/MpaDecFilter/faad2/include/faad.h
index 0fc399c42..72f407280 100644
--- a/src/filters/transform/MpaDecFilter/faad2/include/faad.h
+++ b/src/filters/transform/MpaDecFilter/faad2/include/faad.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
diff --git a/src/filters/transform/MpaDecFilter/faad2/include/neaacdec.h b/src/filters/transform/MpaDecFilter/faad2/include/neaacdec.h
index a05619d87..a45f1d09e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/include/neaacdec.h
+++ b/src/filters/transform/MpaDecFilter/faad2/include/neaacdec.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,13 +37,13 @@ extern "C" {
#if 1
- /* MACROS FOR BACKWARDS COMPATIBILITY */
- /* structs */
+/* MACROS FOR BACKWARDS COMPATIBILITY */
+/* structs */
#define faacDecHandle NeAACDecHandle
#define faacDecConfiguration NeAACDecConfiguration
#define faacDecConfigurationPtr NeAACDecConfigurationPtr
#define faacDecFrameInfo NeAACDecFrameInfo
- /* functions */
+/* functions */
#define faacDecGetErrorMessage NeAACDecGetErrorMessage
#define faacDecSetConfiguration NeAACDecSetConfiguration
#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
@@ -59,19 +59,19 @@ extern "C" {
#ifdef _WIN32
-#pragma pack(push, 8)
-#ifndef NEAACDECAPI
-#define NEAACDECAPI __cdecl
-#endif
+ #pragma pack(push, 8)
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI __cdecl
+ #endif
#else
-#ifndef NEAACDECAPI
-#define NEAACDECAPI
-#endif
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI
+ #endif
#endif
#define FAAD2_VERSION "2.7"
- /* object types for AAC */
+/* object types for AAC */
#define MAIN 1
#define LC 2
#define SSR 3
@@ -82,19 +82,19 @@ extern "C" {
#define LD 23
#define DRM_ER_LC 27 /* special object type for DRM */
- /* header types */
+/* header types */
#define RAW 0
#define ADIF 1
#define ADTS 2
#define LATM 3
- /* SBR signalling */
+/* SBR signalling */
#define NO_SBR 0
#define SBR_UPSAMPLED 1
#define SBR_DOWNSAMPLED 2
#define NO_SBR_UPSAMPLED 3
- /* library output formats */
+/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
@@ -102,7 +102,7 @@ extern "C" {
#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
#define FAAD_FMT_DOUBLE 5
- /* Capabilities */
+/* Capabilities */
#define LC_DEC_CAP (1<<0) /* Can decode LC */
#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
#define LTP_DEC_CAP (1<<2) /* Can decode LTP */
@@ -110,7 +110,7 @@ extern "C" {
#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
#define FIXED_POINT_CAP (1<<5) /* Fixed point */
- /* Channel definitions */
+/* Channel definitions */
#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT (2)
#define FRONT_CHANNEL_RIGHT (3)
@@ -122,7 +122,7 @@ extern "C" {
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
- /* DRM channel definitions */
+/* DRM channel definitions */
#define DRMCH_MONO 1
#define DRMCH_STEREO 2
#define DRMCH_SBR_MONO 3
@@ -130,125 +130,125 @@ extern "C" {
#define DRMCH_SBR_PS_STEREO 5
- /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
- so at least so much bytes per channel should be available in this stream */
+/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
+ so at least so much bytes per channel should be available in this stream */
#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
- typedef void *NeAACDecHandle;
-
- typedef struct mp4AudioSpecificConfig
- {
- /* Audio Specific Info */
- unsigned char objectTypeIndex;
- unsigned char samplingFrequencyIndex;
- unsigned long samplingFrequency;
- unsigned char channelsConfiguration;
-
- /* GA Specific Info */
- unsigned char frameLengthFlag;
- unsigned char dependsOnCoreCoder;
- unsigned short coreCoderDelay;
- unsigned char extensionFlag;
- unsigned char aacSectionDataResilienceFlag;
- unsigned char aacScalefactorDataResilienceFlag;
- unsigned char aacSpectralDataResilienceFlag;
- unsigned char epConfig;
-
- char sbr_present_flag;
- char forceUpSampling;
- char downSampledSBR;
- } mp4AudioSpecificConfig;
-
- typedef struct NeAACDecConfiguration
- {
- unsigned char defObjectType;
- unsigned long defSampleRate;
- unsigned char outputFormat;
- unsigned char downMatrix;
- unsigned char useOldADTSFormat;
- unsigned char dontUpSampleImplicitSBR;
- } NeAACDecConfiguration, *NeAACDecConfigurationPtr;
-
- typedef struct NeAACDecFrameInfo
- {
- unsigned long bytesconsumed;
- unsigned long samples;
- unsigned char channels;
- unsigned char error;
- unsigned long samplerate;
-
- /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
- unsigned char sbr;
-
- /* MPEG-4 ObjectType */
- unsigned char object_type;
-
- /* AAC header type; MP4 will be signalled as RAW also */
- unsigned char header_type;
-
- /* multichannel configuration */
- unsigned char num_front_channels;
- unsigned char num_side_channels;
- unsigned char num_back_channels;
- unsigned char num_lfe_channels;
- unsigned char channel_position[64];
-
- /* PS: 0: off, 1: on */
- unsigned char ps;
- } NeAACDecFrameInfo;
-
- char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
-
- unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
-
- NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
-
- NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
-
- unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
- NeAACDecConfigurationPtr config);
-
- /* Init the library based on info from the AAC file (ADTS/ADIF) */
- long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+typedef void *NeAACDecHandle;
+
+typedef struct mp4AudioSpecificConfig
+{
+ /* Audio Specific Info */
+ unsigned char objectTypeIndex;
+ unsigned char samplingFrequencyIndex;
+ unsigned long samplingFrequency;
+ unsigned char channelsConfiguration;
+
+ /* GA Specific Info */
+ unsigned char frameLengthFlag;
+ unsigned char dependsOnCoreCoder;
+ unsigned short coreCoderDelay;
+ unsigned char extensionFlag;
+ unsigned char aacSectionDataResilienceFlag;
+ unsigned char aacScalefactorDataResilienceFlag;
+ unsigned char aacSpectralDataResilienceFlag;
+ unsigned char epConfig;
+
+ char sbr_present_flag;
+ char forceUpSampling;
+ char downSampledSBR;
+} mp4AudioSpecificConfig;
+
+typedef struct NeAACDecConfiguration
+{
+ unsigned char defObjectType;
+ unsigned long defSampleRate;
+ unsigned char outputFormat;
+ unsigned char downMatrix;
+ unsigned char useOldADTSFormat;
+ unsigned char dontUpSampleImplicitSBR;
+} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
+
+typedef struct NeAACDecFrameInfo
+{
+ unsigned long bytesconsumed;
+ unsigned long samples;
+ unsigned char channels;
+ unsigned char error;
+ unsigned long samplerate;
+
+ /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
+ unsigned char sbr;
+
+ /* MPEG-4 ObjectType */
+ unsigned char object_type;
+
+ /* AAC header type; MP4 will be signalled as RAW also */
+ unsigned char header_type;
+
+ /* multichannel configuration */
+ unsigned char num_front_channels;
+ unsigned char num_side_channels;
+ unsigned char num_back_channels;
+ unsigned char num_lfe_channels;
+ unsigned char channel_position[64];
+
+ /* PS: 0: off, 1: on */
+ unsigned char ps;
+} NeAACDecFrameInfo;
+
+char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
+
+unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
+
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
+
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
+
+unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+ NeAACDecConfigurationPtr config);
+
+/* Init the library based on info from the AAC file (ADTS/ADIF) */
+long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+ unsigned char *buffer,
+ unsigned long buffer_size,
+ unsigned long *samplerate,
+ unsigned char *channels);
+
+/* Init the library using a DecoderSpecificInfo */
+char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder,
+ unsigned char *pBuffer,
+ unsigned long SizeOfDecoderSpecificInfo,
+ unsigned long *samplerate,
+ unsigned char *channels);
+
+/* Init the library for DRM */
+char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
+ unsigned char channels);
+
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
+
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ unsigned char *buffer,
+ unsigned long buffer_size);
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
- unsigned long *samplerate,
- unsigned char *channels);
-
- /* Init the library using a DecoderSpecificInfo */
- char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder,
- unsigned char *pBuffer,
- unsigned long SizeOfDecoderSpecificInfo,
- unsigned long *samplerate,
- unsigned char *channels);
-
- /* Init the library for DRM */
- char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
- unsigned char channels);
-
- void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
-
- void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
-
- void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
- NeAACDecFrameInfo *hInfo,
- unsigned char *buffer,
- unsigned long buffer_size);
-
- void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
- NeAACDecFrameInfo *hInfo,
- unsigned char *buffer,
- unsigned long buffer_size,
- void **sample_buffer,
- unsigned long sample_buffer_size);
+ void **sample_buffer,
+ unsigned long sample_buffer_size);
- char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
- unsigned long buffer_size,
- mp4AudioSpecificConfig *mp4ASC);
+char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
+ unsigned long buffer_size,
+ mp4AudioSpecificConfig *mp4ASC);
#ifdef _WIN32
-#pragma pack(pop)
+ #pragma pack(pop)
#endif
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/analysis.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/analysis.h
index 0464b1ec1..50e43fa04 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/analysis.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/analysis.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -39,7 +39,7 @@ extern "C" {
#ifdef ANALYSIS
#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg
#define DEBUGVAR(A,B,C) ,A,B,C
- extern uint16_t dbg_count;
+extern uint16_t dbg_count;
#else
#define DEBUGDEC
#define DEBUGVAR(A,B,C)
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.c
index 75066f884..dc14d7a03 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -39,13 +39,13 @@ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
{
uint32_t tmp;
- if(ld == NULL)
+ if (ld == NULL)
return;
// useless
//memset(ld, 0, sizeof(bitfile));
- if(buffer_size == 0 || _buffer == NULL)
+ if (buffer_size == 0 || _buffer == NULL)
{
ld->error = 1;
return;
@@ -56,25 +56,21 @@ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
ld->buffer_size = buffer_size;
ld->bytes_left = buffer_size;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)ld->buffer);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n((uint32_t*)ld->buffer, ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufa = tmp;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)ld->buffer + 1);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n((uint32_t*)ld->buffer + 1, ld->bytes_left);
ld->bytes_left = 0;
}
@@ -95,14 +91,14 @@ void faad_endbits(bitfile *ld)
uint32_t faad_get_processed_bits(bitfile *ld)
{
- return (uint32_t)(8 * (4 * (ld->tail - ld->start) - 4) - (ld->bits_left));
+ return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left));
}
uint8_t faad_byte_align(bitfile *ld)
{
int remainder = (32 - ld->bits_left) & 0x7;
- if(remainder)
+ if (remainder)
{
faad_flushbits(ld, 8 - remainder);
return (uint8_t)(8 - remainder);
@@ -115,13 +111,11 @@ void faad_flushbits_ex(bitfile *ld, uint32_t bits)
uint32_t tmp;
ld->bufa = ld->bufb;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword(ld->tail);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n(ld->tail, ld->bytes_left);
ld->bytes_left = 0;
}
@@ -142,25 +136,21 @@ void faad_rewindbits(bitfile *ld)
ld->bytes_left = ld->buffer_size;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)&ld->start[0]);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n((uint32_t*)&ld->start[0], ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufa = tmp;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)&ld->start[1]);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n((uint32_t*)&ld->start[1], ld->bytes_left);
ld->bytes_left = 0;
}
@@ -177,27 +167,23 @@ void faad_resetbits(bitfile *ld, int bits)
int words = bits >> 5;
int remainder = bits & 0x1F;
- ld->bytes_left = ld->buffer_size - words * 4;
+ ld->bytes_left = ld->buffer_size - words*4;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword(&ld->start[words]);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n(&ld->start[words], ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufa = tmp;
- if(ld->bytes_left >= 4)
+ if (ld->bytes_left >= 4)
{
tmp = getdword(&ld->start[words+1]);
ld->bytes_left -= 4;
- }
- else
- {
+ } else {
tmp = getdword_n(&ld->start[words+1], ld->bytes_left);
ld->bytes_left = 0;
}
@@ -215,23 +201,23 @@ void faad_resetbits(bitfile *ld, int bits)
}
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
- DEBUGDEC)
+ DEBUGDEC)
{
int i;
unsigned int temp;
int bytes = bits >> 3;
int remainder = bits & 0x7;
- uint8_t *buffer = (uint8_t*)faad_malloc((bytes + 1) * sizeof(uint8_t));
+ uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t));
- for(i = 0; i < bytes; i++)
+ for (i = 0; i < bytes; i++)
{
- buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print, var, dbg));
+ buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg));
}
- if(remainder)
+ if (remainder)
{
- temp = faad_getbits(ld, remainder DEBUGVAR(print, var, dbg)) << (8 - remainder);
+ temp = faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder);
buffer[bytes] = (uint8_t)temp;
}
@@ -262,7 +248,7 @@ void faad_initbits_rev(bitfile *ld, void *buffer,
ld->buffer_size = bit2byte(bits_in_buffer);
- index = (bits_in_buffer + 31) / 32 - 1;
+ index = (bits_in_buffer+31)/32 - 1;
ld->start = (uint32_t*)buffer + index - 2;
@@ -275,7 +261,7 @@ void faad_initbits_rev(bitfile *ld, void *buffer,
ld->tail = (uint32_t*)buffer + index;
ld->bits_left = bits_in_buffer % 32;
- if(ld->bits_left == 0)
+ if (ld->bits_left == 0)
ld->bits_left = 32;
ld->bytes_left = ld->buffer_size;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.h
index 325c4d08b..e303e8e72 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/bits.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -45,422 +45,403 @@ extern "C" {
//#define bit2byte(a) ((a+7)/BYTE_NUMBIT)
#define bit2byte(a) ((a+7)>>BYTE_NUMBIT_LD)
- typedef struct _bitfile
- {
- /* bit input */
- uint32_t bufa;
- uint32_t bufb;
- uint32_t bits_left;
- uint32_t buffer_size; /* size of the buffer in bytes */
- uint32_t bytes_left;
- uint8_t error;
- uint32_t *tail;
- uint32_t *start;
- const void *buffer;
- } bitfile;
+typedef struct _bitfile
+{
+ /* bit input */
+ uint32_t bufa;
+ uint32_t bufb;
+ uint32_t bits_left;
+ uint32_t buffer_size; /* size of the buffer in bytes */
+ uint32_t bytes_left;
+ uint8_t error;
+ uint32_t *tail;
+ uint32_t *start;
+ const void *buffer;
+} bitfile;
#if 0
- static uint32_t const bitmask[] =
- {
- 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
- 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
- 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
- 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
- 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
- /* added bitmask 32, correct?!?!?! */
- , 0xFFFFFFFF
- };
+static uint32_t const bitmask[] = {
+ 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
+ 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
+ 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
+ 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
+ 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
+ /* added bitmask 32, correct?!?!?! */
+ , 0xFFFFFFFF
+};
#endif
- void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
- void faad_endbits(bitfile *ld);
- void faad_initbits_rev(bitfile *ld, void *buffer,
- uint32_t bits_in_buffer);
- uint8_t faad_byte_align(bitfile *ld);
- uint32_t faad_get_processed_bits(bitfile *ld);
- void faad_flushbits_ex(bitfile *ld, uint32_t bits);
- void faad_rewindbits(bitfile *ld);
- void faad_resetbits(bitfile *ld, int bits);
- uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
- DEBUGDEC);
+void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
+void faad_endbits(bitfile *ld);
+void faad_initbits_rev(bitfile *ld, void *buffer,
+ uint32_t bits_in_buffer);
+uint8_t faad_byte_align(bitfile *ld);
+uint32_t faad_get_processed_bits(bitfile *ld);
+void faad_flushbits_ex(bitfile *ld, uint32_t bits);
+void faad_rewindbits(bitfile *ld);
+void faad_resetbits(bitfile *ld, int bits);
+uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
+ DEBUGDEC);
#ifdef DRM
- void *faad_origbitbuffer(bitfile *ld);
- uint32_t faad_origbitbuffer_size(bitfile *ld);
+void *faad_origbitbuffer(bitfile *ld);
+uint32_t faad_origbitbuffer_size(bitfile *ld);
#endif
- /* circumvent memory alignment errors on ARM */
- static INLINE uint32_t getdword(void *mem)
- {
- uint32_t tmp;
+/* circumvent memory alignment errors on ARM */
+static INLINE uint32_t getdword(void *mem)
+{
+ uint32_t tmp;
#ifndef ARCH_IS_BIG_ENDIAN
- ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
+ ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
+ ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
+ ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
+ ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
+#else
+ ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
+ ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+ ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
+ ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
+#endif
+
+ return tmp;
+}
+
+/* reads only n bytes from the stream instead of the standard 4 */
+static /*INLINE*/ uint32_t getdword_n(void *mem, int n)
+{
+ uint32_t tmp = 0;
+#ifndef ARCH_IS_BIG_ENDIAN
+ switch (n)
+ {
+ case 3:
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
+ case 2:
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
+ case 1:
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
+ default:
+ break;
+ }
#else
- ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
- ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+ switch (n)
+ {
+ case 3:
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
- ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
+ case 2:
+ ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+ case 1:
+ ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
+ default:
+ break;
+ }
#endif
- return tmp;
- }
+ return tmp;
+}
- /* reads only n bytes from the stream instead of the standard 4 */
- static /*INLINE*/ uint32_t getdword_n(void *mem, int n)
+static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
+{
+ if (bits <= ld->bits_left)
{
- uint32_t tmp = 0;
-#ifndef ARCH_IS_BIG_ENDIAN
- switch(n)
- {
- case 3:
- ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
- case 2:
- ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
- case 1:
- ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
- default:
- break;
- }
-#else
- switch(n)
- {
- case 3:
- ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
- case 2:
- ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
- case 1:
- ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
- default:
- break;
- }
-#endif
-
- return tmp;
+ //return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
+ return (ld->bufa << (32 - ld->bits_left)) >> (32 - bits);
}
- static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
- {
- if(bits <= ld->bits_left)
- {
- //return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
- return (ld->bufa << (32 - ld->bits_left)) >> (32 - bits);
- }
+ bits -= ld->bits_left;
+ //return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
+ return ((ld->bufa & ((1<<ld->bits_left)-1)) << bits) | (ld->bufb >> (32 - bits));
+}
- bits -= ld->bits_left;
- //return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
- return ((ld->bufa & ((1 << ld->bits_left) - 1)) << bits) | (ld->bufb >> (32 - bits));
- }
+static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
+{
+ /* do nothing if error */
+ if (ld->error != 0)
+ return;
- static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
+ if (bits < ld->bits_left)
{
- /* do nothing if error */
- if(ld->error != 0)
- return;
-
- if(bits < ld->bits_left)
- {
- ld->bits_left -= bits;
- }
- else
- {
- faad_flushbits_ex(ld, bits);
- }
+ ld->bits_left -= bits;
+ } else {
+ faad_flushbits_ex(ld, bits);
}
+}
- /* return next n bits (right adjusted) */
- static /*INLINE*/ uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
- {
- uint32_t ret;
+/* return next n bits (right adjusted) */
+static /*INLINE*/ uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
+{
+ uint32_t ret;
- if(n == 0)
- return 0;
+ if (n == 0)
+ return 0;
- ret = faad_showbits(ld, n);
- faad_flushbits(ld, n);
+ ret = faad_showbits(ld, n);
+ faad_flushbits(ld, n);
#ifdef ANALYSIS
- if(print)
- fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
+ if (print)
+ fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
- return ret;
- }
+ return ret;
+}
- static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
- {
- uint8_t r;
+static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
+{
+ uint8_t r;
- if(ld->bits_left > 0)
- {
- ld->bits_left--;
- r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
- return r;
- }
+ if (ld->bits_left > 0)
+ {
+ ld->bits_left--;
+ r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
+ return r;
+ }
- /* bits_left == 0 */
+ /* bits_left == 0 */
#if 0
- r = (uint8_t)(ld->bufb >> 31);
- faad_flushbits_ex(ld, 1);
+ r = (uint8_t)(ld->bufb >> 31);
+ faad_flushbits_ex(ld, 1);
#else
- r = (uint8_t)faad_getbits(ld, 1);
+ r = (uint8_t)faad_getbits(ld, 1);
#endif
- return r;
- }
+ return r;
+}
- /* reversed bitreading routines */
- static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
- {
- uint8_t i;
- uint32_t B = 0;
+/* reversed bitreading routines */
+static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
+{
+ uint8_t i;
+ uint32_t B = 0;
- if(bits <= ld->bits_left)
+ if (bits <= ld->bits_left)
+ {
+ for (i = 0; i < bits; i++)
{
- for(i = 0; i < bits; i++)
- {
- if(ld->bufa & (1 << (i + (32 - ld->bits_left))))
- B |= (1 << (bits - i - 1));
- }
- return B;
+ if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
+ B |= (1 << (bits - i - 1));
}
- else
+ return B;
+ } else {
+ for (i = 0; i < ld->bits_left; i++)
{
- for(i = 0; i < ld->bits_left; i++)
- {
- if(ld->bufa & (1 << (i + (32 - ld->bits_left))))
- B |= (1 << (bits - i - 1));
- }
- for(i = 0; i < bits - ld->bits_left; i++)
- {
- if(ld->bufb & (1 << (i + (32 - ld->bits_left))))
- B |= (1 << (bits - ld->bits_left - i - 1));
- }
- return B;
+ if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
+ B |= (1 << (bits - i - 1));
}
+ for (i = 0; i < bits - ld->bits_left; i++)
+ {
+ if (ld->bufb & (1 << (i + (32-ld->bits_left))))
+ B |= (1 << (bits - ld->bits_left - i - 1));
+ }
+ return B;
}
+}
- static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
+static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
+{
+ /* do nothing if error */
+ if (ld->error != 0)
+ return;
+
+ if (bits < ld->bits_left)
{
- /* do nothing if error */
- if(ld->error != 0)
- return;
+ ld->bits_left -= bits;
+ } else {
+ uint32_t tmp;
- if(bits < ld->bits_left)
+ ld->bufa = ld->bufb;
+ tmp = getdword(ld->start);
+ ld->bufb = tmp;
+ ld->start--;
+ ld->bits_left += (32 - bits);
+
+ if (ld->bytes_left < 4)
{
- ld->bits_left -= bits;
+ ld->error = 1;
+ ld->bytes_left = 0;
+ } else {
+ ld->bytes_left -= 4;
}
- else
- {
- uint32_t tmp;
-
- ld->bufa = ld->bufb;
- tmp = getdword(ld->start);
- ld->bufb = tmp;
- ld->start--;
- ld->bits_left += (32 - bits);
-
- if(ld->bytes_left < 4)
- {
- ld->error = 1;
- ld->bytes_left = 0;
- }
- else
- {
- ld->bytes_left -= 4;
- }
// if (ld->bytes_left == 0)
// ld->no_more_reading = 1;
- }
}
+}
- static /*INLINE*/ uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
- DEBUGDEC)
- {
- uint32_t ret;
+static /*INLINE*/ uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
+ DEBUGDEC)
+{
+ uint32_t ret;
- if(n == 0)
- return 0;
+ if (n == 0)
+ return 0;
- ret = faad_showbits_rev(ld, n);
- faad_flushbits_rev(ld, n);
+ ret = faad_showbits_rev(ld, n);
+ faad_flushbits_rev(ld, n);
#ifdef ANALYSIS
- if(print)
- fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
+ if (print)
+ fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
- return ret;
- }
+ return ret;
+}
#ifdef DRM
- /* CRC lookup table for G8 polynome in DRM standard */
- static const uint8_t crc_table_G8[256] =
- {
- 0x0, 0x1d, 0x3a, 0x27, 0x74, 0x69, 0x4e, 0x53,
- 0xe8, 0xf5, 0xd2, 0xcf, 0x9c, 0x81, 0xa6, 0xbb,
- 0xcd, 0xd0, 0xf7, 0xea, 0xb9, 0xa4, 0x83, 0x9e,
- 0x25, 0x38, 0x1f, 0x2, 0x51, 0x4c, 0x6b, 0x76,
- 0x87, 0x9a, 0xbd, 0xa0, 0xf3, 0xee, 0xc9, 0xd4,
- 0x6f, 0x72, 0x55, 0x48, 0x1b, 0x6, 0x21, 0x3c,
- 0x4a, 0x57, 0x70, 0x6d, 0x3e, 0x23, 0x4, 0x19,
- 0xa2, 0xbf, 0x98, 0x85, 0xd6, 0xcb, 0xec, 0xf1,
- 0x13, 0xe, 0x29, 0x34, 0x67, 0x7a, 0x5d, 0x40,
- 0xfb, 0xe6, 0xc1, 0xdc, 0x8f, 0x92, 0xb5, 0xa8,
- 0xde, 0xc3, 0xe4, 0xf9, 0xaa, 0xb7, 0x90, 0x8d,
- 0x36, 0x2b, 0xc, 0x11, 0x42, 0x5f, 0x78, 0x65,
- 0x94, 0x89, 0xae, 0xb3, 0xe0, 0xfd, 0xda, 0xc7,
- 0x7c, 0x61, 0x46, 0x5b, 0x8, 0x15, 0x32, 0x2f,
- 0x59, 0x44, 0x63, 0x7e, 0x2d, 0x30, 0x17, 0xa,
- 0xb1, 0xac, 0x8b, 0x96, 0xc5, 0xd8, 0xff, 0xe2,
- 0x26, 0x3b, 0x1c, 0x1, 0x52, 0x4f, 0x68, 0x75,
- 0xce, 0xd3, 0xf4, 0xe9, 0xba, 0xa7, 0x80, 0x9d,
- 0xeb, 0xf6, 0xd1, 0xcc, 0x9f, 0x82, 0xa5, 0xb8,
- 0x3, 0x1e, 0x39, 0x24, 0x77, 0x6a, 0x4d, 0x50,
- 0xa1, 0xbc, 0x9b, 0x86, 0xd5, 0xc8, 0xef, 0xf2,
- 0x49, 0x54, 0x73, 0x6e, 0x3d, 0x20, 0x7, 0x1a,
- 0x6c, 0x71, 0x56, 0x4b, 0x18, 0x5, 0x22, 0x3f,
- 0x84, 0x99, 0xbe, 0xa3, 0xf0, 0xed, 0xca, 0xd7,
- 0x35, 0x28, 0xf, 0x12, 0x41, 0x5c, 0x7b, 0x66,
- 0xdd, 0xc0, 0xe7, 0xfa, 0xa9, 0xb4, 0x93, 0x8e,
- 0xf8, 0xe5, 0xc2, 0xdf, 0x8c, 0x91, 0xb6, 0xab,
- 0x10, 0xd, 0x2a, 0x37, 0x64, 0x79, 0x5e, 0x43,
- 0xb2, 0xaf, 0x88, 0x95, 0xc6, 0xdb, 0xfc, 0xe1,
- 0x5a, 0x47, 0x60, 0x7d, 0x2e, 0x33, 0x14, 0x9,
- 0x7f, 0x62, 0x45, 0x58, 0xb, 0x16, 0x31, 0x2c,
- 0x97, 0x8a, 0xad, 0xb0, 0xe3, 0xfe, 0xd9, 0xc4,
- };
-
- static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
- {
- int bytes, rem;
- unsigned int CRC;
- unsigned int r = 255; /* Initialize to all ones */
-
- /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
+/* CRC lookup table for G8 polynome in DRM standard */
+static const uint8_t crc_table_G8[256] = {
+ 0x0, 0x1d, 0x3a, 0x27, 0x74, 0x69, 0x4e, 0x53,
+ 0xe8, 0xf5, 0xd2, 0xcf, 0x9c, 0x81, 0xa6, 0xbb,
+ 0xcd, 0xd0, 0xf7, 0xea, 0xb9, 0xa4, 0x83, 0x9e,
+ 0x25, 0x38, 0x1f, 0x2, 0x51, 0x4c, 0x6b, 0x76,
+ 0x87, 0x9a, 0xbd, 0xa0, 0xf3, 0xee, 0xc9, 0xd4,
+ 0x6f, 0x72, 0x55, 0x48, 0x1b, 0x6, 0x21, 0x3c,
+ 0x4a, 0x57, 0x70, 0x6d, 0x3e, 0x23, 0x4, 0x19,
+ 0xa2, 0xbf, 0x98, 0x85, 0xd6, 0xcb, 0xec, 0xf1,
+ 0x13, 0xe, 0x29, 0x34, 0x67, 0x7a, 0x5d, 0x40,
+ 0xfb, 0xe6, 0xc1, 0xdc, 0x8f, 0x92, 0xb5, 0xa8,
+ 0xde, 0xc3, 0xe4, 0xf9, 0xaa, 0xb7, 0x90, 0x8d,
+ 0x36, 0x2b, 0xc, 0x11, 0x42, 0x5f, 0x78, 0x65,
+ 0x94, 0x89, 0xae, 0xb3, 0xe0, 0xfd, 0xda, 0xc7,
+ 0x7c, 0x61, 0x46, 0x5b, 0x8, 0x15, 0x32, 0x2f,
+ 0x59, 0x44, 0x63, 0x7e, 0x2d, 0x30, 0x17, 0xa,
+ 0xb1, 0xac, 0x8b, 0x96, 0xc5, 0xd8, 0xff, 0xe2,
+ 0x26, 0x3b, 0x1c, 0x1, 0x52, 0x4f, 0x68, 0x75,
+ 0xce, 0xd3, 0xf4, 0xe9, 0xba, 0xa7, 0x80, 0x9d,
+ 0xeb, 0xf6, 0xd1, 0xcc, 0x9f, 0x82, 0xa5, 0xb8,
+ 0x3, 0x1e, 0x39, 0x24, 0x77, 0x6a, 0x4d, 0x50,
+ 0xa1, 0xbc, 0x9b, 0x86, 0xd5, 0xc8, 0xef, 0xf2,
+ 0x49, 0x54, 0x73, 0x6e, 0x3d, 0x20, 0x7, 0x1a,
+ 0x6c, 0x71, 0x56, 0x4b, 0x18, 0x5, 0x22, 0x3f,
+ 0x84, 0x99, 0xbe, 0xa3, 0xf0, 0xed, 0xca, 0xd7,
+ 0x35, 0x28, 0xf, 0x12, 0x41, 0x5c, 0x7b, 0x66,
+ 0xdd, 0xc0, 0xe7, 0xfa, 0xa9, 0xb4, 0x93, 0x8e,
+ 0xf8, 0xe5, 0xc2, 0xdf, 0x8c, 0x91, 0xb6, 0xab,
+ 0x10, 0xd, 0x2a, 0x37, 0x64, 0x79, 0x5e, 0x43,
+ 0xb2, 0xaf, 0x88, 0x95, 0xc6, 0xdb, 0xfc, 0xe1,
+ 0x5a, 0x47, 0x60, 0x7d, 0x2e, 0x33, 0x14, 0x9,
+ 0x7f, 0x62, 0x45, 0x58, 0xb, 0x16, 0x31, 0x2c,
+ 0x97, 0x8a, 0xad, 0xb0, 0xe3, 0xfe, 0xd9, 0xc4,
+};
+
+static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
+{
+ int bytes, rem;
+ unsigned int CRC;
+ unsigned int r=255; /* Initialize to all ones */
+
+ /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
#define GPOLY 0435
- faad_rewindbits(ld);
+ faad_rewindbits(ld);
- CRC = (unsigned int) ~faad_getbits(ld, 8
- DEBUGVAR(1, 999, "faad_check_CRC(): CRC")) & 0xFF; /* CRC is stored inverted */
+ CRC = (unsigned int) ~faad_getbits(ld, 8
+ DEBUGVAR(1,999,"faad_check_CRC(): CRC")) & 0xFF; /* CRC is stored inverted */
- bytes = len >> 3;
- rem = len & 0x7;
+ bytes = len >> 3;
+ rem = len & 0x7;
- for(; bytes > 0; bytes--)
- {
- r = crc_table_G8[(r ^ faad_getbits(ld, 8 DEBUGVAR(1, 998, ""))) & 0xFF];
- }
- for(; rem > 0; rem--)
- {
- r = ((r << 1) ^(((faad_get1bit(ld
- DEBUGVAR(1, 998, "")) & 1) ^((r >> 7) & 1)) * GPOLY)) & 0xFF;
- }
-
- if(r != CRC)
- // if (0)
- {
- return 28;
- }
- else
- {
- return 0;
- }
+ for (; bytes > 0; bytes--)
+ {
+ r = crc_table_G8[( r ^ faad_getbits(ld, 8 DEBUGVAR(1,998,"")) ) & 0xFF];
+ }
+ for (; rem > 0; rem--)
+ {
+ r = ( (r << 1) ^ (( ( faad_get1bit(ld
+ DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF;
}
- static uint8_t tabFlipbits[256] =
+ if (r != CRC)
+ // if (0)
{
- 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
- 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
- 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
- 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
- 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
- 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
- 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
- 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
- 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
- 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
- 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
- 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
- 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
- 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
- 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
- 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255
- };
+ return 28;
+ } else {
+ return 0;
+ }
+}
+
+static uint8_t tabFlipbits[256] = {
+ 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,
+ 8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,
+ 4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,
+ 12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,
+ 2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,
+ 10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,
+ 6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,
+ 14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,
+ 1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,
+ 9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,
+ 5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,
+ 13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,
+ 3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,
+ 11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,
+ 7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,
+ 15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
+};
#endif
#ifdef ERROR_RESILIENCE
- /* Modified bit reading functions for HCR */
+/* Modified bit reading functions for HCR */
- typedef struct
- {
- /* bit input */
- uint32_t bufa;
- uint32_t bufb;
- int8_t len;
- } bits_t;
+typedef struct
+{
+ /* bit input */
+ uint32_t bufa;
+ uint32_t bufb;
+ int8_t len;
+} bits_t;
- static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits)
+static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits)
+{
+ if (bits == 0) return 0;
+ if (ld->len <= 32)
{
- if(bits == 0) return 0;
- if(ld->len <= 32)
- {
- /* huffman_spectral_data_2 needs to read more than may be available, bits maybe
- > ld->len, deliver 0 than */
- if(ld->len >= bits)
- return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
- else
- return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
- }
+ /* huffman_spectral_data_2 needs to read more than may be available, bits maybe
+ > ld->len, deliver 0 than */
+ if (ld->len >= bits)
+ return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
else
+ return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
+ } else {
+ if ((ld->len - bits) < 32)
{
- if((ld->len - bits) < 32)
- {
- return ((ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
- (ld->bufa >> (ld->len - bits));
- }
- else
- {
- return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
- }
+ return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
+ (ld->bufa >> (ld->len - bits));
+ } else {
+ return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
}
}
+}
- /* return 1 if position is outside of buffer, 0 otherwise */
- static INLINE int8_t flushbits_hcr(bits_t *ld, uint8_t bits)
- {
- ld->len -= bits;
-
- if(ld->len < 0)
- {
- ld->len = 0;
- return 1;
- }
- else
- {
- return 0;
- }
- }
+/* return 1 if position is outside of buffer, 0 otherwise */
+static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits)
+{
+ ld->len -= bits;
- static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result)
+ if (ld->len <0)
{
- *result = showbits_hcr(ld, n);
- return flushbits_hcr(ld, n);
+ ld->len = 0;
+ return 1;
+ } else {
+ return 0;
}
+}
- static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
- {
- uint32_t res;
- int8_t ret;
+static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result)
+{
+ *result = showbits_hcr(ld, n);
+ return flushbits_hcr(ld, n);
+}
- ret = getbits_hcr(ld, 1, &res);
- *result = (int8_t)(res & 1);
- return ret;
- }
+static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
+{
+ uint32_t res;
+ int8_t ret;
+
+ ret = getbits_hcr(ld, 1, &res);
+ *result = (int8_t)(res & 1);
+ return ret;
+}
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.c
index 0378ff7d6..5b01d75d3 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -74,27 +74,25 @@ static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
{
uint16_t i, k, ah, ac;
- if(ido == 1)
+ if (ido == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
- ah = 2 * k;
- ac = 4 * k;
+ ah = 2*k;
+ ac = 4*k;
RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]);
IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- ah = k * ido;
- ac = 2 * k * ido;
+ ah = k*ido;
+ ac = 2*k*ido;
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
complex_t t2;
@@ -106,10 +104,10 @@ static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
#if 1
ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
- IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+ IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
#else
ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
- RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+ RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
#endif
}
}
@@ -121,27 +119,25 @@ static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
{
uint16_t i, k, ah, ac;
- if(ido == 1)
+ if (ido == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
- ah = 2 * k;
- ac = 4 * k;
+ ah = 2*k;
+ ac = 4*k;
RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]);
IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- ah = k * ido;
- ac = 2 * k * ido;
+ ah = k*ido;
+ ac = 2*k*ido;
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
complex_t t2;
@@ -153,10 +149,10 @@ static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
#if 1
ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
- RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+ RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
#else
ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
- IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+ IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
#endif
}
}
@@ -173,19 +169,19 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
uint16_t i, k, ac, ah;
complex_t c2, c3, d2, d3, t2;
- if(ido == 1)
+ if (ido == 1)
{
- if(isign == 1)
+ if (isign == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
- ac = 3 * k + 1;
+ ac = 3*k+1;
ah = k;
RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
- RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2), taur);
- IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2), taur);
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
@@ -198,18 +194,16 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(ch[ah+2*l1]) = RE(c2) + IM(c3);
IM(ch[ah+2*l1]) = IM(c2) - RE(c3);
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- ac = 3 * k + 1;
+ ac = 3*k+1;
ah = k;
RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
- RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2), taur);
- IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2), taur);
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
@@ -223,22 +217,20 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
IM(ch[ah+2*l1]) = IM(c2) + RE(c3);
}
}
- }
- else
- {
- if(isign == 1)
+ } else {
+ if (isign == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
- ac = i + (3 * k + 1) * ido;
+ ac = i + (3*k+1)*ido;
ah = i + k * ido;
RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
- RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2), taur);
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur);
IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
- IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2), taur);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
@@ -253,31 +245,29 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
#if 1
ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
- IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
- IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
#else
ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
- RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
- RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
#endif
}
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
- ac = i + (3 * k + 1) * ido;
+ ac = i + (3*k+1)*ido;
ah = i + k * ido;
RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
- RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2), taur);
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur);
IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
- IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2), taur);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
@@ -292,14 +282,14 @@ static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
#if 1
ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
- RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
- RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
#else
ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
- IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
- IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
#endif
}
}
@@ -314,13 +304,13 @@ static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
{
uint16_t i, k, ac, ah;
- if(ido == 1)
+ if (ido == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
complex_t t1, t2, t3, t4;
- ac = 4 * k;
+ ac = 4*k;
ah = k;
RE(t2) = RE(cc[ac]) + RE(cc[ac+2]);
@@ -344,15 +334,13 @@ static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
IM(ch[ah+l1]) = IM(t1) + IM(t4);
IM(ch[ah+3*l1]) = IM(t1) - IM(t4);
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- ac = 4 * k * ido;
- ah = k * ido;
+ ac = 4*k*ido;
+ ah = k*ido;
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
complex_t c2, c3, c4, t1, t2, t3, t4;
@@ -379,18 +367,18 @@ static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc
#if 1
ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
- IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+ IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
- IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+ IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
- IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+ IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
#else
ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
- RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+ RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
- RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+ RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
- RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+ RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
#endif
}
}
@@ -403,13 +391,13 @@ static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
{
uint16_t i, k, ac, ah;
- if(ido == 1)
+ if (ido == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
complex_t t1, t2, t3, t4;
- ac = 4 * k;
+ ac = 4*k;
ah = k;
RE(t2) = RE(cc[ac]) + RE(cc[ac+2]);
@@ -433,15 +421,13 @@ static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
IM(ch[ah+l1]) = IM(t1) - IM(t4);
IM(ch[ah+3*l1]) = IM(t1) + IM(t4);
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- ac = 4 * k * ido;
- ah = k * ido;
+ ac = 4*k*ido;
+ ah = k*ido;
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
complex_t c2, c3, c4, t1, t2, t3, t4;
@@ -468,18 +454,18 @@ static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc
#if 1
ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
- RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+ RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
- RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+ RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
- RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+ RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
#else
ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
- IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+ IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
- IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+ IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
- IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+ IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
#endif
}
}
@@ -497,13 +483,13 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
uint16_t i, k, ac, ah;
complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5;
- if(ido == 1)
+ if (ido == 1)
{
- if(isign == 1)
+ if (isign == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
- ac = 5 * k + 1;
+ ac = 5*k + 1;
ah = k;
RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
@@ -518,15 +504,15 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
- RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2), tr11) + MUL_F(RE(t3), tr12);
- IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2), tr11) + MUL_F(IM(t3), tr12);
- RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2), tr12) + MUL_F(RE(t3), tr11);
- IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2), tr12) + MUL_F(IM(t3), tr11);
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
ComplexMult(&RE(c5), &RE(c4),
- ti11, ti12, RE(t5), RE(t4));
+ ti11, ti12, RE(t5), RE(t4));
ComplexMult(&IM(c5), &IM(c4),
- ti11, ti12, IM(t5), IM(t4));
+ ti11, ti12, IM(t5), IM(t4));
RE(ch[ah+l1]) = RE(c2) - IM(c5);
IM(ch[ah+l1]) = IM(c2) + RE(c5);
@@ -537,12 +523,10 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(ch[ah+4*l1]) = RE(c2) + IM(c5);
IM(ch[ah+4*l1]) = IM(c2) - RE(c5);
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- ac = 5 * k + 1;
+ ac = 5*k + 1;
ah = k;
RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
@@ -557,15 +541,15 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
- RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2), tr11) + MUL_F(RE(t3), tr12);
- IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2), tr11) + MUL_F(IM(t3), tr12);
- RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2), tr12) + MUL_F(RE(t3), tr11);
- IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2), tr12) + MUL_F(IM(t3), tr11);
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
ComplexMult(&RE(c4), &RE(c5),
- ti12, ti11, RE(t5), RE(t4));
+ ti12, ti11, RE(t5), RE(t4));
ComplexMult(&IM(c4), &IM(c5),
- ti12, ti11, IM(t5), IM(t4));
+ ti12, ti11, IM(t5), IM(t4));
RE(ch[ah+l1]) = RE(c2) + IM(c5);
IM(ch[ah+l1]) = IM(c2) - RE(c5);
@@ -577,16 +561,14 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
IM(ch[ah+4*l1]) = IM(c2) + RE(c5);
}
}
- }
- else
- {
- if(isign == 1)
+ } else {
+ if (isign == 1)
{
- for(k = 0; k < l1; k++)
+ for (k = 0; k < l1; k++)
{
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
- ac = i + (k * 5 + 1) * ido;
+ ac = i + (k*5 + 1) * ido;
ah = i + k * ido;
RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
@@ -601,15 +583,15 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
- RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2), tr11) + MUL_F(RE(t3), tr12);
- IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2), tr11) + MUL_F(IM(t3), tr12);
- RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2), tr12) + MUL_F(RE(t3), tr11);
- IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2), tr12) + MUL_F(IM(t3), tr11);
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
ComplexMult(&RE(c5), &RE(c4),
- ti11, ti12, RE(t5), RE(t4));
+ ti11, ti12, RE(t5), RE(t4));
ComplexMult(&IM(c5), &IM(c4),
- ti11, ti12, IM(t5), IM(t4));
+ ti11, ti12, IM(t5), IM(t4));
IM(d2) = IM(c2) + RE(c5);
IM(d3) = IM(c3) + RE(c4);
@@ -622,33 +604,31 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
#if 1
ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
- IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
- IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
- IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+ IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
- IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+ IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
#else
ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
- RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
- RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
- RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+ RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
- RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+ RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
#endif
}
}
- }
- else
- {
- for(k = 0; k < l1; k++)
+ } else {
+ for (k = 0; k < l1; k++)
{
- for(i = 0; i < ido; i++)
+ for (i = 0; i < ido; i++)
{
- ac = i + (k * 5 + 1) * ido;
+ ac = i + (k*5 + 1) * ido;
ah = i + k * ido;
RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
@@ -663,15 +643,15 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
- RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2), tr11) + MUL_F(RE(t3), tr12);
- IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2), tr11) + MUL_F(IM(t3), tr12);
- RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2), tr12) + MUL_F(RE(t3), tr11);
- IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2), tr12) + MUL_F(IM(t3), tr11);
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
ComplexMult(&RE(c4), &RE(c5),
- ti12, ti11, RE(t5), RE(t4));
+ ti12, ti11, RE(t5), RE(t4));
ComplexMult(&IM(c4), &IM(c5),
- ti12, ti11, IM(t5), IM(t4));
+ ti12, ti11, IM(t5), IM(t4));
IM(d2) = IM(c2) - RE(c5);
IM(d3) = IM(c3) - RE(c4);
@@ -684,22 +664,22 @@ static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
#if 1
ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
- RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
- RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
- RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+ RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
- RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+ RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
#else
ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
- IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
- IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
- IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+ IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
- IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+ IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
#endif
}
}
@@ -725,20 +705,20 @@ static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
l1 = 1;
iw = 0;
- for(k1 = 2; k1 <= nf + 1; k1++)
+ for (k1 = 2; k1 <= nf+1; k1++)
{
ip = ifac[k1];
- l2 = ip * l1;
+ l2 = ip*l1;
ido = n / l2;
- idl1 = ido * l1;
+ idl1 = ido*l1;
- switch(ip)
+ switch (ip)
{
case 4:
ix2 = iw + ido;
ix3 = ix2 + ido;
- if(na == 0)
+ if (na == 0)
passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
else
passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
@@ -746,7 +726,7 @@ static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
na = 1 - na;
break;
case 2:
- if(na == 0)
+ if (na == 0)
passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
else
passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
@@ -756,7 +736,7 @@ static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
case 3:
ix2 = iw + ido;
- if(na == 0)
+ if (na == 0)
passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
else
passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
@@ -768,7 +748,7 @@ static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
ix3 = ix2 + ido;
ix4 = ix3 + ido;
- if(na == 0)
+ if (na == 0)
passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
else
passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
@@ -778,13 +758,13 @@ static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
}
l1 = l2;
- iw += (ip - 1) * ido;
+ iw += (ip-1) * ido;
}
- if(na == 0)
+ if (na == 0)
return;
- for(i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
{
RE(c[i]) = RE(ch[i]);
IM(c[i]) = IM(ch[i]);
@@ -804,20 +784,20 @@ static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
l1 = 1;
iw = 0;
- for(k1 = 2; k1 <= nf + 1; k1++)
+ for (k1 = 2; k1 <= nf+1; k1++)
{
ip = ifac[k1];
- l2 = ip * l1;
+ l2 = ip*l1;
ido = n / l2;
- idl1 = ido * l1;
+ idl1 = ido*l1;
- switch(ip)
+ switch (ip)
{
case 4:
ix2 = iw + ido;
ix3 = ix2 + ido;
- if(na == 0)
+ if (na == 0)
passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
else
passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
@@ -825,7 +805,7 @@ static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
na = 1 - na;
break;
case 2:
- if(na == 0)
+ if (na == 0)
passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
else
passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
@@ -835,7 +815,7 @@ static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
case 3:
ix2 = iw + ido;
- if(na == 0)
+ if (na == 0)
passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
else
passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
@@ -847,7 +827,7 @@ static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
ix3 = ix2 + ido;
ix4 = ix3 + ido;
- if(na == 0)
+ if (na == 0)
passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
else
passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
@@ -857,13 +837,13 @@ static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
}
l1 = l2;
- iw += (ip - 1) * ido;
+ iw += (ip-1) * ido;
}
- if(na == 0)
+ if (na == 0)
return;
- for(i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
{
RE(c[i]) = RE(ch[i]);
IM(c[i]) = IM(ch[i]);
@@ -900,7 +880,7 @@ static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
startloop:
j++;
- if(j <= 4)
+ if (j <= 4)
ntry = ntryh[j-1];
else
ntry += 2;
@@ -908,53 +888,52 @@ startloop:
do
{
nq = nl / ntry;
- nr = nl - ntry * nq;
+ nr = nl - ntry*nq;
- if(nr != 0)
+ if (nr != 0)
goto startloop;
nf++;
ifac[nf+1] = ntry;
nl = nq;
- if(ntry == 2 && nf != 1)
+ if (ntry == 2 && nf != 1)
{
- for(i = 2; i <= nf; i++)
+ for (i = 2; i <= nf; i++)
{
ib = nf - i + 2;
ifac[ib+1] = ifac[ib];
}
ifac[2] = 2;
}
- }
- while(nl != 1);
+ } while (nl != 1);
ifac[0] = n;
ifac[1] = nf;
#ifndef FIXED_POINT
- argh = (real_t)2.0 * (real_t)M_PI / (real_t)n;
+ argh = (real_t)2.0*(real_t)M_PI / (real_t)n;
i = 0;
l1 = 1;
- for(k1 = 1; k1 <= nf; k1++)
+ for (k1 = 1; k1 <= nf; k1++)
{
ip = ifac[k1+1];
ld = 0;
- l2 = l1 * ip;
+ l2 = l1*ip;
ido = n / l2;
ipm = ip - 1;
- for(j = 0; j < ipm; j++)
+ for (j = 0; j < ipm; j++)
{
i1 = i;
RE(wa[i]) = 1.0;
IM(wa[i]) = 0.0;
ld += l1;
fi = 0;
- argld = ld * argh;
+ argld = ld*argh;
- for(ii = 0; ii < ido; ii++)
+ for (ii = 0; ii < ido; ii++)
{
i++;
fi++;
@@ -963,11 +942,11 @@ startloop:
#if 1
IM(wa[i]) = (real_t)sin(arg);
#else
- IM(wa[i]) = (real_t) - sin(arg);
+ IM(wa[i]) = (real_t)-sin(arg);
#endif
}
- if(ip > 5)
+ if (ip > 5)
{
RE(wa[i1]) = RE(wa[i]);
IM(wa[i1]) = IM(wa[i]);
@@ -983,45 +962,31 @@ cfft_info *cffti(uint16_t n)
cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info));
cfft->n = n;
- cfft->work = (complex_t*)faad_malloc(n * sizeof(complex_t));
+ cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t));
#ifndef FIXED_POINT
- cfft->tab = (complex_t*)faad_malloc(n * sizeof(complex_t));
+ cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t));
cffti1(n, cfft->tab, cfft->ifac);
#else
cffti1(n, NULL, cfft->ifac);
- switch(n)
+ switch (n)
{
- case 64:
- cfft->tab = (complex_t*)cfft_tab_64;
- break;
- case 512:
- cfft->tab = (complex_t*)cfft_tab_512;
- break;
+ case 64: cfft->tab = (complex_t*)cfft_tab_64; break;
+ case 512: cfft->tab = (complex_t*)cfft_tab_512; break;
#ifdef LD_DEC
- case 256:
- cfft->tab = (complex_t*)cfft_tab_256;
- break;
+ case 256: cfft->tab = (complex_t*)cfft_tab_256; break;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
- case 60:
- cfft->tab = (complex_t*)cfft_tab_60;
- break;
- case 480:
- cfft->tab = (complex_t*)cfft_tab_480;
- break;
+ case 60: cfft->tab = (complex_t*)cfft_tab_60; break;
+ case 480: cfft->tab = (complex_t*)cfft_tab_480; break;
#ifdef LD_DEC
- case 240:
- cfft->tab = (complex_t*)cfft_tab_240;
- break;
+ case 240: cfft->tab = (complex_t*)cfft_tab_240; break;
#endif
#endif
- case 128:
- cfft->tab = (complex_t*)cfft_tab_128;
- break;
+ case 128: cfft->tab = (complex_t*)cfft_tab_128; break;
}
#endif
@@ -1030,11 +995,11 @@ cfft_info *cffti(uint16_t n)
void cfftu(cfft_info *cfft)
{
- if(cfft->work) faad_free(cfft->work);
+ if (cfft->work) faad_free(cfft->work);
#ifndef FIXED_POINT
- if(cfft->tab) faad_free(cfft->tab);
+ if (cfft->tab) faad_free(cfft->tab);
#endif
- if(cfft) faad_free(cfft);
+ if (cfft) faad_free(cfft);
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.h
index 093bcfe7c..dc89cdc85 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,19 +35,19 @@
extern "C" {
#endif
- typedef struct
- {
- uint16_t n;
- uint16_t ifac[15];
- complex_t *work;
- complex_t *tab;
- } cfft_info;
+typedef struct
+{
+ uint16_t n;
+ uint16_t ifac[15];
+ complex_t *work;
+ complex_t *tab;
+} cfft_info;
- void cfftf(cfft_info *cfft, complex_t *c);
- void cfftb(cfft_info *cfft, complex_t *c);
- cfft_info *cffti(uint16_t n);
- void cfftu(cfft_info *cfft);
+void cfftf(cfft_info *cfft, complex_t *c);
+void cfftb(cfft_info *cfft, complex_t *c);
+cfft_info *cffti(uint16_t n);
+void cfftu(cfft_info *cfft);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft_tab.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft_tab.h
index 578bac6d0..80b1b75be 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft_tab.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/cfft_tab.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,1783 +37,1783 @@ extern "C" {
#ifdef FIXED_POINT
- ALIGN static const complex_t cfft_tab_512[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) },
- { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
- { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) },
- { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
- { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) },
- { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
- { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) },
- { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
- { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) },
- { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
- { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) },
- { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
- { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) },
- { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
- { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) },
- { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
- { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) },
- { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
- { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) },
- { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
- { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) },
- { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
- { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) },
- { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
- { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) },
- { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
- { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) },
- { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
- { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) },
- { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) },
- { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
- { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) },
- { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
- { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) },
- { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
- { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) },
- { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
- { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) },
- { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
- { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) },
- { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
- { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) },
- { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
- { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) },
- { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
- { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) },
- { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
- { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) },
- { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
- { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) },
- { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) },
- { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
- { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) },
- { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
- { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) },
- { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
- { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) },
- { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
- { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) },
- { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) },
- { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
- { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) },
- { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
- { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) },
- { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) },
- { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
- { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) },
- { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
- { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) },
- { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) },
- { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
- { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) },
- { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
- { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) },
- { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) },
- { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
- { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) },
- { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
- { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) },
- { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) },
- { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
- { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) },
- { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) },
- { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) },
- { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) },
- { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) },
- { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) },
- { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) },
- { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
- { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) },
- { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) },
- { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) },
- { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) },
- { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) },
- { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) },
- { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) },
- { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) },
- { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) },
- { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
- { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) },
- { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) },
- { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) },
- { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) },
- { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) },
- { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) },
- { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
- { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) },
- { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) },
- { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) },
- { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) },
- { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) },
- { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) },
- { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
- { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) },
- { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
- { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) },
- { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) },
- { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) },
- { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) },
- { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) },
- { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) },
- { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
- { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) },
- { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
- { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) },
- { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
- { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) },
- { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) },
- { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) },
- { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) },
- { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) },
- { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
- { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) },
- { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
- { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) },
- { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
- { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) },
- { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) },
- { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) },
- { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
- { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) },
- { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) },
- { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) },
- { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) },
- { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) },
- { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) },
- { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) },
- { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) },
- { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
- { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) },
- { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) },
- { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) },
- { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
- { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) },
- { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
- { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) },
- { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) },
- { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) },
- { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
- { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) },
- { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) },
- { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) },
- { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
- { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) },
- { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
- { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) },
- { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
- { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) },
- { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) },
- { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) },
- { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) },
- { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) },
- { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
- { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) },
- { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
- { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
- { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) },
- { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) },
- { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) },
- { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
- { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) },
- { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) },
- { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
- { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
- { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
- { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
- { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
- { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
- { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
- { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
- { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
- { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
- { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
- { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
- { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
- { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
- { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
- { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
- { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
- { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
- { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
- { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
- { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
- { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
- { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
- { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
- { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
- { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
- { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
- { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
- { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
- { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
- { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
- { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
- { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
- { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
- { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
- { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
- { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
- { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
- { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
- { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
- { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
- { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
- { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
- { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
- { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
- { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
- { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
- { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
- { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
- { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
- { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
- { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
- { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
- { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
- { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
- { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
- { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
- };
+ALIGN static const complex_t cfft_tab_512[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) },
+ { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+ { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) },
+ { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+ { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) },
+ { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+ { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) },
+ { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+ { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) },
+ { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+ { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) },
+ { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+ { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) },
+ { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+ { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) },
+ { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+ { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) },
+ { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+ { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) },
+ { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+ { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) },
+ { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) },
+ { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+ { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) },
+ { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+ { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) },
+ { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+ { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) },
+ { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) },
+ { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+ { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) },
+ { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+ { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) },
+ { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+ { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) },
+ { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) },
+ { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+ { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) },
+ { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) },
+ { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) },
+ { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+ { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) },
+ { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) },
+ { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) },
+ { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) },
+ { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) },
+ { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+ { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) },
+ { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) },
+ { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) },
+ { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) },
+ { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) },
+ { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) },
+ { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) },
+ { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+ { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) },
+ { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) },
+ { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) },
+ { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) },
+ { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+ { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) },
+ { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) },
+ { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) },
+ { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) },
+ { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+ { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) },
+ { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) },
+ { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) },
+ { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) },
+ { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) },
+ { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) },
+ { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) },
+ { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) },
+ { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) },
+ { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) },
+ { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) },
+ { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) },
+ { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) },
+ { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) },
+ { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) },
+ { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) },
+ { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+ { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) },
+ { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) },
+ { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) },
+ { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) },
+ { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+ { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) },
+ { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) },
+ { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) },
+ { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) },
+ { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) },
+ { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+ { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) },
+ { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) },
+ { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) },
+ { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) },
+ { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
+ { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
+ { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
+ { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
+ { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
+ { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
+ { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
+ { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
+ { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
+ { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
+ { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
+ { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
+ { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const complex_t cfft_tab_480[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) },
- { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
- { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) },
- { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
- { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) },
- { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
- { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) },
- { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
- { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) },
- { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
- { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) },
- { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) },
- { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
- { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) },
- { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
- { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) },
- { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
- { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) },
- { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
- { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) },
- { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
- { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) },
- { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
- { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) },
- { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
- { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) },
- { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
- { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) },
- { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
- { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) },
- { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
- { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) },
- { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
- { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) },
- { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
- { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) },
- { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
- { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) },
- { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
- { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) },
- { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
- { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) },
- { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
- { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) },
- { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
- { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) },
- { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
- { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) },
- { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
- { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) },
- { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
- { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) },
- { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
- { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) },
- { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
- { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) },
- { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) },
- { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
- { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) },
- { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
- { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) },
- { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) },
- { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) },
- { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
- { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) },
- { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
- { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) },
- { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) },
- { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) },
- { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
- { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) },
- { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
- { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) },
- { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) },
- { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) },
- { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
- { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) },
- { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
- { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) },
- { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) },
- { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) },
- { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
- { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) },
- { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
- { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) },
- { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) },
- { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
- { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) },
- { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
- { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) },
- { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
- { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) },
- { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
- { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) },
- { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
- { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) },
- { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) },
- { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) },
- { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) },
- { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) },
- { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) },
- { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
- { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) },
- { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) },
- { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) },
- { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
- { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) },
- { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) },
- { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) },
- { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) },
- { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) },
- { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
- { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) },
- { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) },
- { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) },
- { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
- { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) },
- { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) },
- { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) },
- { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) },
- { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
- { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) },
- { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
- { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) },
- { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) },
- { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) },
- { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
- { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) },
- { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) },
- { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) },
- { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
- { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) },
- { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
- { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) },
- { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) },
- { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) },
- { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) },
- { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) },
- { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
- { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) },
- { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) },
- { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) },
- { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) },
- { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
- { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) },
- { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) },
- { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) },
- { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
- { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) },
- { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
- { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) },
- { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
- { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) },
- { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) },
- { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
- { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
- { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
- { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
- { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
- { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
- { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
- { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
- { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
- { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
- { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
- { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
- { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
- { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
- { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
- { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
- { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
- { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
- { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
- { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
- { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
- { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
- { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
- { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
- { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
- { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
- { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
- { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
- { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
- { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
- { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
- { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
- { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
- { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
- { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
- { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
- { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
- { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
- { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
- { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
- { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
- { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
- { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
- { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
- { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
- { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
- { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
- { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
- { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
- { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
- { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
- { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
- { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
- { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
- { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
- { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
- { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
- { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
- { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
- { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
- { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
- };
+ALIGN static const complex_t cfft_tab_480[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) },
+ { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+ { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) },
+ { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+ { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) },
+ { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) },
+ { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+ { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) },
+ { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+ { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) },
+ { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) },
+ { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+ { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+ { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) },
+ { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) },
+ { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+ { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) },
+ { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+ { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) },
+ { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+ { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) },
+ { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) },
+ { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) },
+ { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+ { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) },
+ { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) },
+ { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+ { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) },
+ { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) },
+ { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) },
+ { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) },
+ { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) },
+ { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) },
+ { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) },
+ { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+ { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) },
+ { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) },
+ { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+ { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) },
+ { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) },
+ { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+ { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) },
+ { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) },
+ { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) },
+ { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) },
+ { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) },
+ { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+ { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) },
+ { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) },
+ { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) },
+ { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) },
+ { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) },
+ { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) },
+ { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+ { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) },
+ { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) },
+ { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) },
+ { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+ { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) },
+ { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) },
+ { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) },
+ { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+ { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) },
+ { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+ { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) },
+ { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) },
+ { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) },
+ { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) },
+ { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+ { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) },
+ { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) },
+ { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) },
+ { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) },
+ { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) },
+ { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+ { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) },
+ { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) },
+ { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) },
+ { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) },
+ { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) },
+ { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+ { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) },
+ { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+ { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) },
+ { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+ { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) },
+ { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) },
+ { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+ { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+ { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+ { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+ { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
+ { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+ { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
+ { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
+ { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
+ { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+ { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
+ { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
+ { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
+ { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
+ { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
+ { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+ { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
+ { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
+ { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
+ { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
+ { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
#endif
- ALIGN static const complex_t cfft_tab_64[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
- { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
- { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
- };
+ALIGN static const complex_t cfft_tab_64[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const complex_t cfft_tab_60[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
- { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
- { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
- { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
- { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
- { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
- };
+ALIGN static const complex_t cfft_tab_60[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+ { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+ { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
#endif
#ifdef LD_DEC
- ALIGN static const complex_t cfft_tab_256[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
- { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
- { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
- { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
- { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
- { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
- { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
- { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
- { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
- { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
- { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
- { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
- { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
- { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
- { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
- { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
- { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
- { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
- { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
- { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
- { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
- { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
- { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
- { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
- { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
- { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
- { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
- { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
- { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
- { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
- { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
- { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
- { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
- { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
- { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
- { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
- { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
- { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
- { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
- { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
- { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
- { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
- { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
- { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
- { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
- { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
- { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
- { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
- { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
- { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
- { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
- { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
- { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
- { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
- { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
- { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
- { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
- };
+ALIGN static const complex_t cfft_tab_256[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
+ { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
+ { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
+ { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
+ { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
+ { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
+ { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
+ { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
+ { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
+ { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
+ { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
+ { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
+ { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const complex_t cfft_tab_240[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
- { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
- { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
- { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
- { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
- { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
- { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
- { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
- { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
- { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
- { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
- { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
- { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
- { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
- { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
- { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
- { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
- { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
- { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
- { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
- { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
- { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
- { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
- { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
- { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
- { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
- { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
- { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
- { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
- { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
- { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
- { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
- { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
- { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
- { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
- { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
- { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
- { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
- { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
- { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
- { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
- { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
- { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
- { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
- { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
- { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
- { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
- { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
- { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
- { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
- { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
- { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
- { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
- { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
- { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
- { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
- { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
- { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
- { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
- { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
- { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
- { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
- { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
- { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
- { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
- { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
- { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
- { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
- { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
- { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
- { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
- { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
- { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
- { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
- { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
- { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
- };
+ALIGN static const complex_t cfft_tab_240[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+ { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+ { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+ { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+ { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
+ { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+ { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
+ { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
+ { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
+ { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+ { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
+ { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
+ { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
+ { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
+ { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
+ { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+ { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
+ { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
+ { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
+ { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
+ { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
#endif
#endif
- ALIGN static const complex_t cfft_tab_128[] =
- {
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
- { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
- { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
- { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
- { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
- { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
- { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
- { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
- { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
- { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
- { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
- { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
- { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
- { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
- { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
- { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
- { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
- { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
- { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
- { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
- { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
- { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
- { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
- { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
- { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
- };
+ALIGN static const complex_t cfft_tab_128[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb.h
index 725864de0..29bbca4f8 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,38 +35,38 @@
extern "C" {
#endif
- /*
- * Optimal huffman decoding for AAC taken from:
- * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
- * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
- * AES paper 5436
- *
- * 2 methods are used for huffman decoding:
- * - binary search
- * - 2-step table lookup
- *
- * The choice of the "optimal" method is based on the fact that if the
- * memory size for the Two-step is exorbitantly high then the decision
- * is Binary search for that codebook. However, for marginally more memory
- * size, if Twostep outperforms even the best case of Binary then the
- * decision is Two-step for that codebook.
- *
- * The following methods are used for the different tables.
- * codebook "optimal" method
- * HCB_1 2-Step
- * HCB_2 2-Step
- * HCB_3 Binary
- * HCB_4 2-Step
- * HCB_5 Binary
- * HCB_6 2-Step
- * HCB_7 Binary
- * HCB_8 2-Step
- * HCB_9 Binary
- * HCB_10 2-Step
- * HCB_11 2-Step
- * HCB_SF Binary
- *
- */
+/*
+ * Optimal huffman decoding for AAC taken from:
+ * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
+ * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
+ * AES paper 5436
+ *
+ * 2 methods are used for huffman decoding:
+ * - binary search
+ * - 2-step table lookup
+ *
+ * The choice of the "optimal" method is based on the fact that if the
+ * memory size for the Two-step is exorbitantly high then the decision
+ * is Binary search for that codebook. However, for marginally more memory
+ * size, if Twostep outperforms even the best case of Binary then the
+ * decision is Two-step for that codebook.
+ *
+ * The following methods are used for the different tables.
+ * codebook "optimal" method
+ * HCB_1 2-Step
+ * HCB_2 2-Step
+ * HCB_3 Binary
+ * HCB_4 2-Step
+ * HCB_5 Binary
+ * HCB_6 2-Step
+ * HCB_7 Binary
+ * HCB_8 2-Step
+ * HCB_9 Binary
+ * HCB_10 2-Step
+ * HCB_11 2-Step
+ * HCB_SF Binary
+ *
+ */
#define ZERO_HCB 0
@@ -78,52 +78,52 @@ extern "C" {
#define INTENSITY_HCB2 14
#define INTENSITY_HCB 15
- /* 1st step table */
- typedef struct
- {
- uint8_t offset;
- uint8_t extra_bits;
- } hcb;
+/* 1st step table */
+typedef struct
+{
+ uint8_t offset;
+ uint8_t extra_bits;
+} hcb;
- /* 2nd step table with quadruple data */
- typedef struct
- {
- uint8_t bits;
- int8_t x;
- int8_t y;
- } hcb_2_pair;
+/* 2nd step table with quadruple data */
+typedef struct
+{
+ uint8_t bits;
+ int8_t x;
+ int8_t y;
+} hcb_2_pair;
- typedef struct
- {
- uint8_t bits;
- int8_t x;
- int8_t y;
- int8_t v;
- int8_t w;
- } hcb_2_quad;
+typedef struct
+{
+ uint8_t bits;
+ int8_t x;
+ int8_t y;
+ int8_t v;
+ int8_t w;
+} hcb_2_quad;
- /* binary search table */
- typedef struct
- {
- uint8_t is_leaf;
- int8_t data[4];
- } hcb_bin_quad;
+/* binary search table */
+typedef struct
+{
+ uint8_t is_leaf;
+ int8_t data[4];
+} hcb_bin_quad;
- typedef struct
- {
- uint8_t is_leaf;
- int8_t data[2];
- } hcb_bin_pair;
+typedef struct
+{
+ uint8_t is_leaf;
+ int8_t data[2];
+} hcb_bin_pair;
- hcb *hcb_table[];
- hcb_2_quad *hcb_2_quad_table[];
- hcb_2_pair *hcb_2_pair_table[];
- hcb_bin_pair *hcb_bin_table[];
- uint8_t hcbN[];
- uint8_t unsigned_cb[];
- int hcb_2_quad_table_size[];
- int hcb_2_pair_table_size[];
- int hcb_bin_table_size[];
+hcb *hcb_table[];
+hcb_2_quad *hcb_2_quad_table[];
+hcb_2_pair *hcb_2_pair_table[];
+hcb_bin_pair *hcb_bin_table[];
+uint8_t hcbN[];
+uint8_t unsigned_cb[];
+int hcb_2_quad_table_size[];
+int hcb_2_pair_table_size[];
+int hcb_bin_table_size[];
#include "codebook/hcb_1.h"
#include "codebook/hcb_2.h"
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_1.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_1.h
index 53e236d01..f6632c230 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_1.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_1.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb1_1[] =
-{
+static hcb hcb1_1[] = {
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
@@ -82,8 +81,7 @@ static hcb hcb1_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_quad hcb1_2[] =
-{
+static hcb_2_quad hcb1_2[] = {
/* 1 bit codeword */
{ 1, 0, 0, 0, 0 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_10.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_10.h
index e0f161131..87e621df5 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_10.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_10.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb10_1[] =
-{
+static hcb hcb10_1[] = {
/* 4 bit codewords */
{ /* 000000 */ 0, 0 },
{ /* */ 0, 0 },
@@ -119,8 +118,7 @@ static hcb hcb10_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_pair hcb10_2[] =
-{
+static hcb_2_pair hcb10_2[] = {
/* 4 bit codewords */
{ 4, 1, 1 },
{ 4, 1, 2 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_11.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_11.h
index 53bb2d547..509a1d684 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_11.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_11.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb11_1[] =
-{
+static hcb hcb11_1[] = {
/* 4 bits */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
@@ -99,8 +98,7 @@ static hcb hcb11_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_pair hcb11_2[] =
-{
+static hcb_2_pair hcb11_2[] = {
/* 4 */
{ 4, 0, 0 },
{ 4, 1, 1 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_2.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_2.h
index 76576e12f..8edfe525d 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_2.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_2.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb2_1[] =
-{
+static hcb hcb2_1[] = {
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
@@ -86,8 +85,7 @@ static hcb hcb2_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_quad hcb2_2[] =
-{
+static hcb_2_quad hcb2_2[] = {
/* 3 bit codeword */
{ 3, 0, 0, 0, 0 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_3.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_3.h
index 2cb6a5293..e9481e198 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_3.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_3.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -31,8 +31,7 @@
/* Binary search huffman table HCB_3 */
-static hcb_bin_quad hcb3[] =
-{
+static hcb_bin_quad hcb3[] = {
{ /* 0 */ 0, { 1, 2, 0, 0 } },
{ /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2, 0, 0 } },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_4.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_4.h
index ba8521a4f..c2b43e005 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_4.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_4.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb4_1[] =
-{
+static hcb hcb4_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
@@ -89,8 +88,7 @@ static hcb hcb4_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_quad hcb4_2[] =
-{
+static hcb_2_quad hcb4_2[] = {
/* 4 bit codewords */
{ 4, 1, 1, 1, 1 },
{ 4, 0, 1, 1, 1 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_5.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_5.h
index cea1c9274..ca7c473bf 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_5.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_5.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -31,8 +31,7 @@
/* Binary search huffman table HCB_5 */
-static hcb_bin_pair hcb5[] =
-{
+static hcb_bin_pair hcb5[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2 } },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_6.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_6.h
index 8217508d7..2181d63d5 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_6.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_6.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb6_1[] =
-{
+static hcb hcb6_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
@@ -87,8 +86,7 @@ static hcb hcb6_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_pair hcb6_2[] =
-{
+static hcb_2_pair hcb6_2[] = {
/* 4 bit codewords */
{ 4, 0, 0 },
{ 4, 1, 0 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_7.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_7.h
index d6500c649..54c85c11d 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_7.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_7.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -31,8 +31,7 @@
/* Binary search huffman table HCB_7 */
-static hcb_bin_pair hcb7[] =
-{
+static hcb_bin_pair hcb7[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_8.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_8.h
index 1c41cce32..6e3f1009e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_8.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_8.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,7 @@
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
-static hcb hcb8_1[] =
-{
+static hcb hcb8_1[] = {
/* 3 bit codeword */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
@@ -91,8 +90,7 @@ static hcb hcb8_1[] =
*
* Gives size of codeword and actual data (x,y,v,w)
*/
-static hcb_2_pair hcb8_2[] =
-{
+static hcb_2_pair hcb8_2[] = {
/* 3 bit codeword */
{ 3, 1, 1 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_9.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_9.h
index bb4f2351f..bdba2c222 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_9.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_9.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -31,8 +31,7 @@
/* Binary search huffman table HCB_9 */
-static hcb_bin_pair hcb9[] =
-{
+static hcb_bin_pair hcb9[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_sf.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_sf.h
index f4f9c98f4..3c02b3d84 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_sf.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/codebook/hcb_sf.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -31,8 +31,7 @@
/* Binary search huffman table HCB_SF */
-static uint8_t hcb_sf[][2] =
-{
+static uint8_t hcb_sf[][2] = {
{ /* 0 */ 1, 2 },
{ /* 1 */ 60, 0 },
{ /* 2 */ 1, 2 },
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/common.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/common.c
index 42b015ef7..be08d351e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/common.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/common.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -40,18 +40,18 @@
/* Returns the sample rate index based on the samplerate */
uint8_t get_sr_index(const uint32_t samplerate)
{
- if(92017 <= samplerate) return 0;
- if(75132 <= samplerate) return 1;
- if(55426 <= samplerate) return 2;
- if(46009 <= samplerate) return 3;
- if(37566 <= samplerate) return 4;
- if(27713 <= samplerate) return 5;
- if(23004 <= samplerate) return 6;
- if(18783 <= samplerate) return 7;
- if(13856 <= samplerate) return 8;
- if(11502 <= samplerate) return 9;
- if(9391 <= samplerate) return 10;
- if(16428320 <= samplerate) return 11;
+ if (92017 <= samplerate) return 0;
+ if (75132 <= samplerate) return 1;
+ if (55426 <= samplerate) return 2;
+ if (46009 <= samplerate) return 3;
+ if (37566 <= samplerate) return 4;
+ if (27713 <= samplerate) return 5;
+ if (23004 <= samplerate) return 6;
+ if (18783 <= samplerate) return 7;
+ if (13856 <= samplerate) return 8;
+ if (11502 <= samplerate) return 9;
+ if (9391 <= samplerate) return 10;
+ if (16428320 <= samplerate) return 11;
return 11;
}
@@ -65,7 +65,7 @@ uint32_t get_sample_rate(const uint8_t sr_index)
24000, 22050, 16000, 12000, 11025, 8000
};
- if(sr_index < 12)
+ if (sr_index < 12)
return sample_rates[sr_index];
return 0;
@@ -79,7 +79,7 @@ uint8_t max_pred_sfb(const uint8_t sr_index)
};
- if(sr_index < 12)
+ if (sr_index < 12)
return pred_sfb_max[sr_index];
return 0;
@@ -109,14 +109,14 @@ uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
{42, 14, 23, 8}, /* 11025 */
{39, 14, 19, 7}, /* 8000 */
{39, 14, 19, 7}, /* 7350 */
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0}
+ {0,0,0,0},
+ {0,0,0,0},
+ {0,0,0,0}
};
uint8_t i = 0;
- if(is_short) i++;
- if(object_type == SSR) i += 2;
+ if (is_short) i++;
+ if (object_type == SSR) i += 2;
return tns_sbf_max[sr_index][i];
}
@@ -124,7 +124,7 @@ uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
/* Returns 0 if an object type is decodable, otherwise returns -1 */
int8_t can_decode_ot(const uint8_t object_type)
{
- switch(object_type)
+ switch (object_type)
{
case LC:
return 0;
@@ -147,7 +147,7 @@ int8_t can_decode_ot(const uint8_t object_type)
return -1;
#endif
- /* ER object types */
+ /* ER object types */
#ifdef ERROR_RESILIENCE
case ER_LC:
#ifdef DRM
@@ -191,343 +191,332 @@ void faad_free(void *b)
}
#endif
- static const uint8_t Parity [256] = // parity
- {
- 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
- 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
- 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
- 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0
- };
+static const uint8_t Parity [256] = { // parity
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
+};
- static uint32_t __r1 = 1;
- static uint32_t __r2 = 1;
-
-
- /*
- * This is a simple random number generator with good quality for audio purposes.
- * It consists of two polycounters with opposite rotation direction and different
- * periods. The periods are coprime, so the total period is the product of both.
- *
- * -------------------------------------------------------------------------------------------------
- * +-> |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|
- * | -------------------------------------------------------------------------------------------------
- * | | | | | | |
- * | +--+--+--+-XOR-+--------+
- * | |
- * +--------------------------------------------------------------------------------------+
- *
- * -------------------------------------------------------------------------------------------------
- * |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| <-+
- * ------------------------------------------------------------------------------------------------- |
- * | | | | |
- * +--+----XOR----+--+ |
- * | |
- * +----------------------------------------------------------------------------------------+
- *
- *
- * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
- * which gives a period of 18.410.713.077.675.721.215. The result is the
- * XORed values of both generators.
- */
- uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2)
- {
- uint32_t t1, t2, t3, t4;
-
- t3 = t1 = *__r1;
- t4 = t2 = *__r2; // Parity calculation is done via table lookup, this is also available
- t1 &= 0xF5;
- t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
- t1 = Parity [t1];
- t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
- t1 <<= 31;
- t2 = Parity [t2];
-
- return (*__r1 = (t3 >> 1) | t1) ^(*__r2 = (t4 + t4) | t2);
- }
+static uint32_t __r1 = 1;
+static uint32_t __r2 = 1;
- static uint32_t ones32(uint32_t x)
- {
- x -= ((x >> 1) & 0x55555555);
- x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
- x = (((x >> 4) + x) & 0x0f0f0f0f);
- x += (x >> 8);
- x += (x >> 16);
- return (x & 0x0000003f);
- }
+/*
+ * This is a simple random number generator with good quality for audio purposes.
+ * It consists of two polycounters with opposite rotation direction and different
+ * periods. The periods are coprime, so the total period is the product of both.
+ *
+ * -------------------------------------------------------------------------------------------------
+ * +-> |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|
+ * | -------------------------------------------------------------------------------------------------
+ * | | | | | | |
+ * | +--+--+--+-XOR-+--------+
+ * | |
+ * +--------------------------------------------------------------------------------------+
+ *
+ * -------------------------------------------------------------------------------------------------
+ * |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| <-+
+ * ------------------------------------------------------------------------------------------------- |
+ * | | | | |
+ * +--+----XOR----+--+ |
+ * | |
+ * +----------------------------------------------------------------------------------------+
+ *
+ *
+ * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
+ * which gives a period of 18.410.713.077.675.721.215. The result is the
+ * XORed values of both generators.
+ */
+uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2)
+{
+ uint32_t t1, t2, t3, t4;
- static uint32_t floor_log2(uint32_t x)
- {
+ t3 = t1 = *__r1; t4 = t2 = *__r2; // Parity calculation is done via table lookup, this is also available
+ t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
+ t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
+ t1 <<= 31; t2 = Parity [t2];
+
+ return (*__r1 = (t3 >> 1) | t1 ) ^ (*__r2 = (t4 + t4) | t2 );
+}
+
+static uint32_t ones32(uint32_t x)
+{
+ x -= ((x >> 1) & 0x55555555);
+ x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
+ x = (((x >> 4) + x) & 0x0f0f0f0f);
+ x += (x >> 8);
+ x += (x >> 16);
+
+ return (x & 0x0000003f);
+}
+
+static uint32_t floor_log2(uint32_t x)
+{
#if 1
- x |= (x >> 1);
- x |= (x >> 2);
- x |= (x >> 4);
- x |= (x >> 8);
- x |= (x >> 16);
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
- return (ones32(x) - 1);
+ return (ones32(x) - 1);
#else
- uint32_t count = 0;
+ uint32_t count = 0;
- while(x >>= 1)
- count++;
+ while (x >>= 1)
+ count++;
- return count;
+ return count;
#endif
- }
+}
- /* returns position of first bit that is not 0 from msb,
- * starting count at lsb */
- uint32_t wl_min_lzc(uint32_t x)
- {
+/* returns position of first bit that is not 0 from msb,
+ * starting count at lsb */
+uint32_t wl_min_lzc(uint32_t x)
+{
#if 1
- x |= (x >> 1);
- x |= (x >> 2);
- x |= (x >> 4);
- x |= (x >> 8);
- x |= (x >> 16);
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
- return (ones32(x));
+ return (ones32(x));
#else
- uint32_t count = 0;
+ uint32_t count = 0;
- while(x >>= 1)
- count++;
+ while (x >>= 1)
+ count++;
- return (count + 1);
+ return (count + 1);
#endif
- }
+}
#ifdef FIXED_POINT
#define TABLE_BITS 6
- /* just take the maximum number of bits for interpolation */
+/* just take the maximum number of bits for interpolation */
#define INTERP_BITS (REAL_BITS-TABLE_BITS)
- static const real_t pow2_tab[] =
- {
- REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
- REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
- REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
- REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
- REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
- REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
- REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
- REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
- REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
- REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
- REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
- REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
- REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
- REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
- REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
- REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
- REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
- REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
- REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
- REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
- REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
- REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
- };
+static const real_t pow2_tab[] = {
+ REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
+ REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
+ REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
+ REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
+ REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
+ REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
+ REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
+ REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
+ REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
+ REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
+ REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
+ REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
+ REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
+ REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
+ REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
+ REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
+ REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
+ REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
+ REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
+ REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
+ REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
+ REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
+};
+
+static const real_t log2_tab[] = {
+ REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
+ REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
+ REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
+ REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
+ REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
+ REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
+ REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
+ REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
+ REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
+ REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
+ REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
+ REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
+ REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
+ REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
+ REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
+ REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
+ REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
+ REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
+ REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
+ REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
+ REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
+ REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
+};
+
+real_t pow2_fix(real_t val)
+{
+ uint32_t x1, x2;
+ uint32_t errcorr;
+ uint32_t index_frac;
+ real_t retval;
+ int32_t whole = (val >> REAL_BITS);
+
+ /* rest = [0..1] */
+ int32_t rest = val - (whole << REAL_BITS);
+
+ /* index into pow2_tab */
+ int32_t index = rest >> (REAL_BITS-TABLE_BITS);
- static const real_t log2_tab[] =
- {
- REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
- REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
- REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
- REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
- REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
- REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
- REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
- REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
- REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
- REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
- REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
- REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
- REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
- REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
- REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
- REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
- REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
- REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
- REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
- REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
- REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
- REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
- };
- real_t pow2_fix(real_t val)
+ if (val == 0)
+ return (1<<REAL_BITS);
+
+ /* leave INTERP_BITS bits */
+ index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+ index_frac = index_frac & ((1<<INTERP_BITS)-1);
+
+ if (whole > 0)
{
- uint32_t x1, x2;
- uint32_t errcorr;
- uint32_t index_frac;
- real_t retval;
- int32_t whole = (val >> REAL_BITS);
-
- /* rest = [0..1] */
- int32_t rest = val - (whole << REAL_BITS);
-
- /* index into pow2_tab */
- int32_t index = rest >> (REAL_BITS - TABLE_BITS);
-
-
- if(val == 0)
- return (1 << REAL_BITS);
-
- /* leave INTERP_BITS bits */
- index_frac = rest >> (REAL_BITS - TABLE_BITS - INTERP_BITS);
- index_frac = index_frac & ((1 << INTERP_BITS) - 1);
-
- if(whole > 0)
- {
- retval = 1 << whole;
- }
- else
- {
- retval = REAL_CONST(1) >> -whole;
- }
-
- x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
- x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
- errcorr = ((index_frac * (x2 - x1))) >> INTERP_BITS;
-
- if(whole > 0)
- {
- retval = retval * (errcorr + x1);
- }
- else
- {
- retval = MUL_R(retval, (errcorr + x1));
- }
-
- return retval;
+ retval = 1 << whole;
+ } else {
+ retval = REAL_CONST(1) >> -whole;
}
- int32_t pow2_int(real_t val)
+ x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+ errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+ if (whole > 0)
{
- uint32_t x1, x2;
- uint32_t errcorr;
- uint32_t index_frac;
- real_t retval;
- int32_t whole = (val >> REAL_BITS);
+ retval = retval * (errcorr + x1);
+ } else {
+ retval = MUL_R(retval, (errcorr + x1));
+ }
- /* rest = [0..1] */
- int32_t rest = val - (whole << REAL_BITS);
+ return retval;
+}
- /* index into pow2_tab */
- int32_t index = rest >> (REAL_BITS - TABLE_BITS);
+int32_t pow2_int(real_t val)
+{
+ uint32_t x1, x2;
+ uint32_t errcorr;
+ uint32_t index_frac;
+ real_t retval;
+ int32_t whole = (val >> REAL_BITS);
+ /* rest = [0..1] */
+ int32_t rest = val - (whole << REAL_BITS);
- if(val == 0)
- return 1;
+ /* index into pow2_tab */
+ int32_t index = rest >> (REAL_BITS-TABLE_BITS);
- /* leave INTERP_BITS bits */
- index_frac = rest >> (REAL_BITS - TABLE_BITS - INTERP_BITS);
- index_frac = index_frac & ((1 << INTERP_BITS) - 1);
- if(whole > 0)
- retval = 1 << whole;
- else
- retval = 0;
+ if (val == 0)
+ return 1;
- x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
- x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
- errcorr = ((index_frac * (x2 - x1))) >> INTERP_BITS;
+ /* leave INTERP_BITS bits */
+ index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+ index_frac = index_frac & ((1<<INTERP_BITS)-1);
- retval = MUL_R(retval, (errcorr + x1));
+ if (whole > 0)
+ retval = 1 << whole;
+ else
+ retval = 0;
- return retval;
- }
+ x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+ errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
- /* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
- int32_t log2_int(uint32_t val)
- {
- uint32_t frac;
- uint32_t whole = (val);
- int32_t exp = 0;
- uint32_t index;
- uint32_t index_frac;
- uint32_t x1, x2;
- uint32_t errcorr;
+ retval = MUL_R(retval, (errcorr + x1));
- /* error */
- if(val == 0)
- return -10000;
+ return retval;
+}
- exp = floor_log2(val);
- exp -= REAL_BITS;
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+int32_t log2_int(uint32_t val)
+{
+ uint32_t frac;
+ uint32_t whole = (val);
+ int32_t exp = 0;
+ uint32_t index;
+ uint32_t index_frac;
+ uint32_t x1, x2;
+ uint32_t errcorr;
- /* frac = [1..2] */
- if(exp >= 0)
- frac = val >> exp;
- else
- frac = val << -exp;
+ /* error */
+ if (val == 0)
+ return -10000;
- /* index in the log2 table */
- index = frac >> (REAL_BITS - TABLE_BITS);
+ exp = floor_log2(val);
+ exp -= REAL_BITS;
- /* leftover part for linear interpolation */
- index_frac = frac & ((1 << (REAL_BITS - TABLE_BITS)) - 1);
+ /* frac = [1..2] */
+ if (exp >= 0)
+ frac = val >> exp;
+ else
+ frac = val << -exp;
- /* leave INTERP_BITS bits */
- index_frac = index_frac >> (REAL_BITS - TABLE_BITS - INTERP_BITS);
+ /* index in the log2 table */
+ index = frac >> (REAL_BITS-TABLE_BITS);
- x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
- x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+ /* leftover part for linear interpolation */
+ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
- /* linear interpolation */
- /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+ /* leave INTERP_BITS bits */
+ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
- errcorr = (index_frac * (x2 - x1)) >> INTERP_BITS;
+ x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
- return ((exp + REAL_BITS) << REAL_BITS) + errcorr + x1;
- }
+ /* linear interpolation */
+ /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
- /* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
- real_t log2_fix(uint32_t val)
- {
- uint32_t frac;
- uint32_t whole = (val >> REAL_BITS);
- int8_t exp = 0;
- uint32_t index;
- uint32_t index_frac;
- uint32_t x1, x2;
- uint32_t errcorr;
+ errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
- /* error */
- if(val == 0)
- return -100000;
+ return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
+}
- exp = floor_log2(val);
- exp -= REAL_BITS;
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+real_t log2_fix(uint32_t val)
+{
+ uint32_t frac;
+ uint32_t whole = (val >> REAL_BITS);
+ int8_t exp = 0;
+ uint32_t index;
+ uint32_t index_frac;
+ uint32_t x1, x2;
+ uint32_t errcorr;
- /* frac = [1..2] */
- if(exp >= 0)
- frac = val >> exp;
- else
- frac = val << -exp;
+ /* error */
+ if (val == 0)
+ return -100000;
- /* index in the log2 table */
- index = frac >> (REAL_BITS - TABLE_BITS);
+ exp = floor_log2(val);
+ exp -= REAL_BITS;
- /* leftover part for linear interpolation */
- index_frac = frac & ((1 << (REAL_BITS - TABLE_BITS)) - 1);
+ /* frac = [1..2] */
+ if (exp >= 0)
+ frac = val >> exp;
+ else
+ frac = val << -exp;
- /* leave INTERP_BITS bits */
- index_frac = index_frac >> (REAL_BITS - TABLE_BITS - INTERP_BITS);
+ /* index in the log2 table */
+ index = frac >> (REAL_BITS-TABLE_BITS);
- x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
- x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+ /* leftover part for linear interpolation */
+ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
- /* linear interpolation */
- /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+ /* leave INTERP_BITS bits */
+ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
- errcorr = (index_frac * (x2 - x1)) >> INTERP_BITS;
+ x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
- return (exp << REAL_BITS) + errcorr + x1;
- }
+ /* linear interpolation */
+ /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+ errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+ return (exp << REAL_BITS) + errcorr + x1;
+}
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/common.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/common.h
index fcb6f3815..b696b4a9e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/common.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/common.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -60,15 +60,15 @@ extern "C" {
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
- /* COMPILE TIME DEFINITIONS */
+/* COMPILE TIME DEFINITIONS */
- /* use double precision */
- /* #define USE_DOUBLE_PRECISION */
- /* use fixed point reals */
+/* use double precision */
+/* #define USE_DOUBLE_PRECISION */
+/* use fixed point reals */
//#define FIXED_POINT
//#define BIG_IQ_TABLE
- /* Use if target platform has address generators with autoincrement */
+/* Use if target platform has address generators with autoincrement */
//#define PREFER_POINTERS
#ifdef _WIN32_WCE
@@ -82,19 +82,19 @@ extern "C" {
#define ERROR_RESILIENCE
- /* Allow decoding of MAIN profile AAC */
+/* Allow decoding of MAIN profile AAC */
#define MAIN_DEC
- /* Allow decoding of SSR profile AAC */
+/* Allow decoding of SSR profile AAC */
//#define SSR_DEC
- /* Allow decoding of LTP profile AAC */
+/* Allow decoding of LTP profile AAC */
#define LTP_DEC
- /* Allow decoding of LD profile AAC */
+/* Allow decoding of LD profile AAC */
#define LD_DEC
- /* Allow decoding of Digital Radio Mondiale (DRM) */
+/* Allow decoding of Digital Radio Mondiale (DRM) */
//#define DRM
//#define DRM_PS
- /* LD can't do without LTP */
+/* LD can't do without LTP */
#ifdef LD_DEC
#ifndef ERROR_RESILIENCE
#define ERROR_RESILIENCE
@@ -110,13 +110,13 @@ extern "C" {
// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
//#define LC_ONLY_DECODER
#ifdef LC_ONLY_DECODER
-#undef LD_DEC
-#undef LTP_DEC
-#undef MAIN_DEC
-#undef SSR_DEC
-#undef DRM
-#undef ALLOW_SMALL_FRAMELENGTH
-#undef ERROR_RESILIENCE
+ #undef LD_DEC
+ #undef LTP_DEC
+ #undef MAIN_DEC
+ #undef SSR_DEC
+ #undef DRM
+ #undef ALLOW_SMALL_FRAMELENGTH
+ #undef ERROR_RESILIENCE
#endif
#define SBR_DEC
@@ -127,7 +127,7 @@ extern "C" {
#undef PS_DEC
#endif
- /* FIXED POINT: No MAIN decoding */
+/* FIXED POINT: No MAIN decoding */
#ifdef FIXED_POINT
# ifdef MAIN_DEC
# undef MAIN_DEC
@@ -164,21 +164,21 @@ extern "C" {
#endif
- /* END COMPILE TIME DEFINITIONS */
+/* END COMPILE TIME DEFINITIONS */
#if defined(_WIN32) && !defined(__MINGW32__)
#include <stdlib.h>
- typedef unsigned __int64 uint64_t;
- typedef unsigned __int32 uint32_t;
- typedef unsigned __int16 uint16_t;
- typedef unsigned __int8 uint8_t;
- typedef signed __int64 int64_t;
- typedef signed __int32 int32_t;
- typedef signed __int16 int16_t;
- typedef signed __int8 int8_t;
- typedef float float32_t;
+typedef unsigned __int64 uint64_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int64 int64_t;
+typedef signed __int32 int32_t;
+typedef signed __int16 int16_t;
+typedef signed __int8 int8_t;
+typedef float float32_t;
#else
@@ -213,20 +213,20 @@ extern "C" {
# if HAVE_STDINT_H
# include <stdint.h>
# else
- /* we need these... */
+/* we need these... */
#ifndef __TCS__
- typedef unsigned long long uint64_t;
- typedef signed long long int64_t;
+typedef unsigned long long uint64_t;
+typedef signed long long int64_t;
#else
- typedef unsigned long uint64_t;
- typedef signed long int64_t;
-#endif
- typedef unsigned long uint32_t;
- typedef unsigned short uint16_t;
- typedef unsigned char uint8_t;
- typedef signed long int32_t;
- typedef signed short int16_t;
- typedef signed char int8_t;
+typedef unsigned long uint64_t;
+typedef signed long int64_t;
+#endif
+typedef unsigned long uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+typedef signed long int32_t;
+typedef signed short int16_t;
+typedef signed char int8_t;
# endif
#endif
#if HAVE_UNISTD_H
@@ -234,7 +234,7 @@ extern "C" {
#endif
#ifndef HAVE_FLOAT32_T
- typedef float float32_t;
+typedef float float32_t;
#endif
#if STDC_HEADERS
@@ -244,7 +244,7 @@ extern "C" {
# define strchr index
# define strrchr rindex
# endif
- char *strchr(), *strrchr();
+char *strchr(), *strrchr();
# if !HAVE_MEMCPY
# define memcpy(d, s, n) bcopy((s), (d), (n))
# define memmove(d, s, n) bcopy((s), (d), (n))
@@ -257,64 +257,64 @@ extern "C" {
#define ARCH_IS_BIG_ENDIAN
#endif
- /* FIXED_POINT doesn't work with MAIN and SSR yet */
+/* FIXED_POINT doesn't work with MAIN and SSR yet */
#ifdef FIXED_POINT
-#undef MAIN_DEC
-#undef SSR_DEC
+ #undef MAIN_DEC
+ #undef SSR_DEC
#endif
#if defined(FIXED_POINT)
-#include "fixed.h"
+ #include "fixed.h"
#elif defined(USE_DOUBLE_PRECISION)
- typedef double real_t;
+ typedef double real_t;
-#include <math.h>
+ #include <math.h>
-#define MUL_R(A,B) ((A)*(B))
-#define MUL_C(A,B) ((A)*(B))
-#define MUL_F(A,B) ((A)*(B))
+ #define MUL_R(A,B) ((A)*(B))
+ #define MUL_C(A,B) ((A)*(B))
+ #define MUL_F(A,B) ((A)*(B))
- /* Complex multiplication */
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
- *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
- }
+ /* Complex multiplication */
+ static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+ {
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+ }
-#define REAL_CONST(A) ((real_t)(A))
-#define COEF_CONST(A) ((real_t)(A))
-#define Q2_CONST(A) ((real_t)(A))
-#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
+ #define REAL_CONST(A) ((real_t)(A))
+ #define COEF_CONST(A) ((real_t)(A))
+ #define Q2_CONST(A) ((real_t)(A))
+ #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
#else /* Normal floating point operation */
- typedef float real_t;
+ typedef float real_t;
-#define MUL_R(A,B) ((A)*(B))
-#define MUL_C(A,B) ((A)*(B))
-#define MUL_F(A,B) ((A)*(B))
+ #define MUL_R(A,B) ((A)*(B))
+ #define MUL_C(A,B) ((A)*(B))
+ #define MUL_F(A,B) ((A)*(B))
-#define REAL_CONST(A) ((real_t)(A))
-#define COEF_CONST(A) ((real_t)(A))
-#define Q2_CONST(A) ((real_t)(A))
-#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
+ #define REAL_CONST(A) ((real_t)(A))
+ #define COEF_CONST(A) ((real_t)(A))
+ #define Q2_CONST(A) ((real_t)(A))
+ #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
- /* Complex multiplication */
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
- *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
- }
+ /* Complex multiplication */
+ static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+ {
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+ }
-#if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
-#define HAS_LRINTF
+ #if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
+ #define HAS_LRINTF
static INLINE int lrintf(float f)
{
int i;
@@ -325,37 +325,37 @@ extern "C" {
}
return i;
}
-#elif (defined(__i386__) && defined(__GNUC__) && \
+ #elif (defined(__i386__) && defined(__GNUC__) && \
!defined(__CYGWIN__) && !defined(__MINGW32__))
-#ifndef HAVE_LRINTF
-#define HAS_LRINTF
+ #ifndef HAVE_LRINTF
+ #define HAS_LRINTF
// from http://www.stereopsis.com/FPU.html
static INLINE int lrintf(float f)
{
int i;
- __asm__ __volatile__(
+ __asm__ __volatile__ (
"flds %1 \n\t"
"fistpl %0 \n\t"
- : "=m"(i)
- : "m"(f));
+ : "=m" (i)
+ : "m" (f));
return i;
}
-#endif /* HAVE_LRINTF */
-#endif
+ #endif /* HAVE_LRINTF */
+ #endif
-#ifdef __ICL /* only Intel C compiler has fmath ??? */
+ #ifdef __ICL /* only Intel C compiler has fmath ??? */
-#include <mathf.h>
+ #include <mathf.h>
-#define sin sinf
-#define cos cosf
-#define log logf
-#define floor floorf
-#define ceil ceilf
-#define sqrt sqrtf
+ #define sin sinf
+ #define cos cosf
+ #define log logf
+ #define floor floorf
+ #define ceil ceilf
+ #define sqrt sqrtf
-#else
+ #else
#ifdef HAVE_LRINTF
# define HAS_LRINTF
@@ -365,7 +365,7 @@ extern "C" {
# define __USE_ISOC99 1
#endif
-#include <math.h>
+ #include <math.h>
#ifdef HAVE_SINF
# define sin sinf
@@ -390,50 +390,50 @@ extern "C" {
# define sqrt sqrtf
#endif
-#endif
+ #endif
#endif
#ifndef HAS_LRINTF
- /* standard cast */
+/* standard cast */
#define lrintf(f) ((int32_t)(f))
#endif
- typedef real_t complex_t[2];
+typedef real_t complex_t[2];
#define RE(A) A[0]
#define IM(A) A[1]
- /* common functions */
- uint8_t cpu_has_sse(void);
- uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2);
- uint32_t wl_min_lzc(uint32_t x);
+/* common functions */
+uint8_t cpu_has_sse(void);
+uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2);
+uint32_t wl_min_lzc(uint32_t x);
#ifdef FIXED_POINT
#define LOG2_MIN_INF REAL_CONST(-10000)
- int32_t log2_int(uint32_t val);
- int32_t log2_fix(uint32_t val);
- int32_t pow2_int(real_t val);
- real_t pow2_fix(real_t val);
+int32_t log2_int(uint32_t val);
+int32_t log2_fix(uint32_t val);
+int32_t pow2_int(real_t val);
+real_t pow2_fix(real_t val);
#endif
- uint8_t get_sr_index(const uint32_t samplerate);
- uint8_t max_pred_sfb(const uint8_t sr_index);
- uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
- const uint8_t is_short);
- uint32_t get_sample_rate(const uint8_t sr_index);
- int8_t can_decode_ot(const uint8_t object_type);
+uint8_t get_sr_index(const uint32_t samplerate);
+uint8_t max_pred_sfb(const uint8_t sr_index);
+uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
+ const uint8_t is_short);
+uint32_t get_sample_rate(const uint8_t sr_index);
+int8_t can_decode_ot(const uint8_t object_type);
- void *faad_malloc(size_t size);
- void faad_free(void *b);
+void *faad_malloc(size_t size);
+void faad_free(void *b);
//#define PROFILE
#ifdef PROFILE
- static int64_t faad_get_ts()
+static int64_t faad_get_ts()
+{
+ __asm
{
- __asm
- {
- rdtsc
- }
+ rdtsc
}
+}
#endif
#ifndef M_PI
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.c
index 6fe0c4dda..f3fb4ddea 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -66,7 +66,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder,
char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode)
{
- if(errcode >= NUM_ERROR_MESSAGES)
+ if (errcode >= NUM_ERROR_MESSAGES)
return NULL;
return err_msg[errcode];
}
@@ -97,13 +97,13 @@ unsigned long NEAACDECAPI NeAACDecGetCapabilities(void)
return cap;
}
-const unsigned char mes[] = { 0x67, 0x20, 0x61, 0x20, 0x20, 0x20, 0x6f, 0x20, 0x72, 0x20, 0x65, 0x20, 0x6e, 0x20, 0x20, 0x20, 0x74, 0x20, 0x68, 0x20, 0x67, 0x20, 0x69, 0x20, 0x72, 0x20, 0x79, 0x20, 0x70, 0x20, 0x6f, 0x20, 0x63 };
+const unsigned char mes[] = { 0x67,0x20,0x61,0x20,0x20,0x20,0x6f,0x20,0x72,0x20,0x65,0x20,0x6e,0x20,0x20,0x20,0x74,0x20,0x68,0x20,0x67,0x20,0x69,0x20,0x72,0x20,0x79,0x20,0x70,0x20,0x6f,0x20,0x63 };
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
{
uint8_t i;
NeAACDecStruct *hDecoder = NULL;
- if((hDecoder = (NeAACDecStruct*)faad_malloc(sizeof(NeAACDecStruct))) == NULL)
+ if ((hDecoder = (NeAACDecStruct*)faad_malloc(sizeof(NeAACDecStruct))) == NULL)
return NULL;
memset(hDecoder, 0, sizeof(NeAACDecStruct));
@@ -115,7 +115,7 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
hDecoder->config.downMatrix = 0;
hDecoder->adts_header_present = 0;
hDecoder->adif_header_present = 0;
- hDecoder->latm_header_present = 0;
+ hDecoder->latm_header_present = 0;
#ifdef ERROR_RESILIENCE
hDecoder->aacSectionDataResilienceFlag = 0;
hDecoder->aacScalefactorDataResilienceFlag = 0;
@@ -129,7 +129,7 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
hDecoder->__r1 = 1;
hDecoder->__r2 = 1;
- for(i = 0; i < MAX_CHANNELS; i++)
+ for (i = 0; i < MAX_CHANNELS; i++)
{
hDecoder->window_shape_prev[i] = 0;
hDecoder->time_out[i] = NULL;
@@ -148,7 +148,7 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
}
#ifdef SBR_DEC
- for(i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
+ for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
{
hDecoder->sbr[i] = NULL;
}
@@ -162,7 +162,7 @@ NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hpDecoder)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
- if(hDecoder)
+ if (hDecoder)
{
NeAACDecConfigurationPtr config = &(hDecoder->config);
@@ -173,32 +173,32 @@ NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHan
}
unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hpDecoder,
- NeAACDecConfigurationPtr config)
+ NeAACDecConfigurationPtr config)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
- if(hDecoder && config)
+ if (hDecoder && config)
{
/* check if we can decode this object type */
- if(can_decode_ot(config->defObjectType) < 0)
+ if (can_decode_ot(config->defObjectType) < 0)
return 0;
hDecoder->config.defObjectType = config->defObjectType;
/* samplerate: anything but 0 should be possible */
- if(config->defSampleRate == 0)
+ if (config->defSampleRate == 0)
return 0;
hDecoder->config.defSampleRate = config->defSampleRate;
/* check output format */
#ifdef FIXED_POINT
- if((config->outputFormat < 1) || (config->outputFormat > 4))
+ if ((config->outputFormat < 1) || (config->outputFormat > 4))
return 0;
#else
- if((config->outputFormat < 1) || (config->outputFormat > 5))
+ if ((config->outputFormat < 1) || (config->outputFormat > 5))
return 0;
#endif
hDecoder->config.outputFormat = config->outputFormat;
- if(config->downMatrix > 1)
+ if (config->downMatrix > 1)
return 0;
hDecoder->config.downMatrix = config->downMatrix;
@@ -212,19 +212,19 @@ unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hpDecoder,
static int latmCheck(latm_header *latm, bitfile *ld)
{
- uint32_t good = 0, bad = 0, bits, m;
+ uint32_t good=0, bad=0, bits, m;
- while(ld->bytes_left)
+ while (ld->bytes_left)
{
bits = faad_latm_frame(latm, ld);
#pragma warning(disable: 4146)
- if(bits == -1U)
+ if(bits==-1U)
#pragma warning(default: 4146)
bad++;
else
{
good++;
- while(bits > 0)
+ while(bits>0)
{
m = min(bits, 8);
faad_getbits(ld, m);
@@ -233,7 +233,7 @@ static int latmCheck(latm_header *latm, bitfile *ld)
}
}
- return (good > 0);
+ return (good>0);
}
@@ -251,7 +251,7 @@ long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder,
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
- if((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL))
+ if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL))
return -1;
hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
@@ -259,7 +259,7 @@ long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder,
*samplerate = get_sample_rate(hDecoder->sf_index);
*channels = 1;
- if(buffer != NULL)
+ if (buffer != NULL)
{
#if 0
int is_latm;
@@ -267,62 +267,59 @@ long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder,
#endif
faad_initbits(&ld, buffer, buffer_size);
-
+
#if 0
memset(l, 0, sizeof(latm_header));
is_latm = latmCheck(l, &ld);
l->inited = 0;
l->frameLength = 0;
faad_rewindbits(&ld);
- if(is_latm && l->ASCbits > 0)
+ if(is_latm && l->ASCbits>0)
{
int32_t x;
hDecoder->latm_header_present = 1;
- x = NeAACDecInit2(hDecoder, l->ASC, (l->ASCbits + 7) / 8, samplerate, channels);
- if(x != 0)
+ x = NeAACDecInit2(hDecoder, l->ASC, (l->ASCbits+7)/8, samplerate, channels);
+ if(x!=0)
hDecoder->latm_header_present = 0;
return x;
- }
- else
+ } else
#endif
- /* Check if an ADIF header is present */
- if((buffer[0] == 'A') && (buffer[1] == 'D') &&
- (buffer[2] == 'I') && (buffer[3] == 'F'))
- {
- hDecoder->adif_header_present = 1;
+ /* Check if an ADIF header is present */
+ if ((buffer[0] == 'A') && (buffer[1] == 'D') &&
+ (buffer[2] == 'I') && (buffer[3] == 'F'))
+ {
+ hDecoder->adif_header_present = 1;
- get_adif_header(&adif, &ld);
- faad_byte_align(&ld);
+ get_adif_header(&adif, &ld);
+ faad_byte_align(&ld);
- hDecoder->sf_index = adif.pce[0].sf_index;
- hDecoder->object_type = adif.pce[0].object_type + 1;
+ hDecoder->sf_index = adif.pce[0].sf_index;
+ hDecoder->object_type = adif.pce[0].object_type + 1;
- *samplerate = get_sample_rate(hDecoder->sf_index);
- *channels = adif.pce[0].channels;
+ *samplerate = get_sample_rate(hDecoder->sf_index);
+ *channels = adif.pce[0].channels;
- memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config));
- hDecoder->pce_set = 1;
+ memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config));
+ hDecoder->pce_set = 1;
- bits = bit2byte(faad_get_processed_bits(&ld));
+ bits = bit2byte(faad_get_processed_bits(&ld));
- /* Check if an ADTS header is present */
- }
- else if(faad_showbits(&ld, 12) == 0xfff)
- {
- hDecoder->adts_header_present = 1;
+ /* Check if an ADTS header is present */
+ } else if (faad_showbits(&ld, 12) == 0xfff) {
+ hDecoder->adts_header_present = 1;
- adts.old_format = hDecoder->config.useOldADTSFormat;
- adts_frame(&adts, &ld);
+ adts.old_format = hDecoder->config.useOldADTSFormat;
+ adts_frame(&adts, &ld);
- hDecoder->sf_index = adts.sf_index;
- hDecoder->object_type = adts.profile + 1;
+ hDecoder->sf_index = adts.sf_index;
+ hDecoder->object_type = adts.profile + 1;
- *samplerate = get_sample_rate(hDecoder->sf_index);
- *channels = (adts.channel_configuration > 6) ?
- 2 : adts.channel_configuration;
- }
+ *samplerate = get_sample_rate(hDecoder->sf_index);
+ *channels = (adts.channel_configuration > 6) ?
+ 2 : adts.channel_configuration;
+ }
- if(ld.error)
+ if (ld.error)
{
faad_endbits(&ld);
return -1;
@@ -332,7 +329,7 @@ long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder,
#if (defined(PS_DEC) || defined(DRM_PS))
/* check if we have a mono file */
- if(*channels == 1)
+ if (*channels == 1)
{
/* upMatrix to 2 channels for implicit signalling of PS */
*channels = 2;
@@ -343,31 +340,29 @@ long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder,
#ifdef SBR_DEC
/* implicit signalling */
- if(*samplerate <= 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0))
+ if (*samplerate <= 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0))
{
*samplerate *= 2;
hDecoder->forceUpSampling = 1;
- }
- else if(*samplerate > 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0))
- {
+ } else if (*samplerate > 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0)) {
hDecoder->downSampledSBR = 1;
}
#endif
/* must be done before frameLength is divided by 2 for LD */
#ifdef SSR_DEC
- if(hDecoder->object_type == SSR)
- hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength / SSR_BANDS);
+ if (hDecoder->object_type == SSR)
+ hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS);
else
#endif
hDecoder->fb = filter_bank_init(hDecoder->frameLength);
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
hDecoder->frameLength >>= 1;
#endif
- if(can_decode_ot(hDecoder->object_type) < 0)
+ if (can_decode_ot(hDecoder->object_type) < 0)
return -1;
return bits;
@@ -385,10 +380,10 @@ char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder,
mp4AudioSpecificConfig mp4ASC;
if((hDecoder == NULL)
- || (pBuffer == NULL)
- || (SizeOfDecoderSpecificInfo < 2)
- || (samplerate == NULL)
- || (channels == NULL))
+ || (pBuffer == NULL)
+ || (SizeOfDecoderSpecificInfo < 2)
+ || (samplerate == NULL)
+ || (channels == NULL))
{
return -1;
}
@@ -398,22 +393,20 @@ char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder,
/* decode the audio specific config */
rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC,
- &(hDecoder->pce), hDecoder->latm_header_present);
+ &(hDecoder->pce), hDecoder->latm_header_present);
/* copy the relevant info to the decoder handle */
*samplerate = mp4ASC.samplingFrequency;
- if(mp4ASC.channelsConfiguration)
+ if (mp4ASC.channelsConfiguration)
{
*channels = mp4ASC.channelsConfiguration;
- }
- else
- {
+ } else {
*channels = hDecoder->pce.channels;
hDecoder->pce_set = 1;
}
#if (defined(PS_DEC) || defined(DRM_PS))
/* check if we have a mono file */
- if(*channels == 1)
+ if (*channels == 1)
{
/* upMatrix to 2 channels for implicit signalling of PS */
*channels = 2;
@@ -429,24 +422,24 @@ char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder,
#ifdef SBR_DEC
hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
hDecoder->downSampledSBR = mp4ASC.downSampledSBR;
- if(hDecoder->config.dontUpSampleImplicitSBR == 0)
+ if (hDecoder->config.dontUpSampleImplicitSBR == 0)
hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
else
hDecoder->forceUpSampling = 0;
/* AAC core decoder samplerate is 2 times as low */
- if(((hDecoder->sbr_present_flag == 1) && (!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1)
+ if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1)
{
hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2);
}
#endif
- if(rc != 0)
+ if (rc != 0)
{
return rc;
}
hDecoder->channelConfiguration = mp4ASC.channelsConfiguration;
- if(mp4ASC.frameLengthFlag)
+ if (mp4ASC.frameLengthFlag)
#ifdef ALLOW_SMALL_FRAMELENGTH
hDecoder->frameLength = 960;
#else
@@ -455,14 +448,14 @@ char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder,
/* must be done before frameLength is divided by 2 for LD */
#ifdef SSR_DEC
- if(hDecoder->object_type == SSR)
- hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength / SSR_BANDS);
+ if (hDecoder->object_type == SSR)
+ hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS);
else
#endif
hDecoder->fb = filter_bank_init(hDecoder->frameLength);
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
hDecoder->frameLength >>= 1;
#endif
@@ -475,7 +468,7 @@ char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hpDecoder,
unsigned char channels)
{
NeAACDecStruct** hDecoder = (NeAACDecStruct**)hpDecoder;
- if(hDecoder == NULL)
+ if (hDecoder == NULL)
return 1; /* error */
NeAACDecClose(*hDecoder);
@@ -495,13 +488,13 @@ char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hpDecoder,
(*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate);
(*hDecoder)->object_type = (*hDecoder)->config.defObjectType;
- if((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO))
+ if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO))
(*hDecoder)->channelConfiguration = 2;
else
(*hDecoder)->channelConfiguration = 1;
#ifdef SBR_DEC
- if((channels == DRMCH_MONO) || (channels == DRMCH_STEREO))
+ if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO))
(*hDecoder)->sbr_present_flag = 0;
else
(*hDecoder)->sbr_present_flag = 1;
@@ -518,7 +511,7 @@ void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder)
uint8_t i;
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
- if(hDecoder == NULL)
+ if (hDecoder == NULL)
return;
#ifdef PROFILE
@@ -529,24 +522,24 @@ void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder)
printf("output: %I64d cycles\n", hDecoder->output_cycles);
#endif
- for(i = 0; i < MAX_CHANNELS; i++)
+ for (i = 0; i < MAX_CHANNELS; i++)
{
- if(hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]);
- if(hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]);
+ if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]);
+ if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]);
#ifdef SSR_DEC
- if(hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]);
- if(hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]);
+ if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]);
+ if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]);
#endif
#ifdef MAIN_DEC
- if(hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]);
+ if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]);
#endif
#ifdef LTP_DEC
- if(hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]);
+ if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]);
#endif
}
#ifdef SSR_DEC
- if(hDecoder->object_type == SSR)
+ if (hDecoder->object_type == SSR)
ssr_filter_bank_end(hDecoder->fb);
else
#endif
@@ -554,27 +547,27 @@ void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder)
drc_end(hDecoder->drc);
- if(hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer);
+ if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer);
#ifdef SBR_DEC
- for(i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
+ for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
{
- if(hDecoder->sbr[i])
+ if (hDecoder->sbr[i])
sbrDecodeEnd(hDecoder->sbr[i]);
}
#endif
- if(hDecoder) faad_free(hDecoder);
+ if (hDecoder) faad_free(hDecoder);
}
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hpDecoder, long frame)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
- if(hDecoder)
+ if (hDecoder)
{
hDecoder->postSeekResetFlag = 1;
- if(frame != -1)
+ if (frame != -1)
hDecoder->frame = frame;
}
}
@@ -585,9 +578,9 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
hInfo->num_side_channels = 0;
hInfo->num_back_channels = 0;
hInfo->num_lfe_channels = 0;
- memset(hInfo->channel_position, 0, MAX_CHANNELS * sizeof(uint8_t));
+ memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t));
- if(hDecoder->downMatrix)
+ if (hDecoder->downMatrix)
{
hInfo->num_front_channels = 2;
hInfo->channel_position[0] = FRONT_CHANNEL_LEFT;
@@ -596,7 +589,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
}
/* check if there is a PCE */
- if(hDecoder->pce_set)
+ if (hDecoder->pce_set)
{
uint8_t i, chpos = 0;
uint8_t chdir, back_center = 0;
@@ -607,7 +600,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels;
chdir = hInfo->num_front_channels;
- if(chdir & 1)
+ if (chdir & 1)
{
#if (defined(PS_DEC) || defined(DRM_PS))
/* When PS is enabled output is always stereo */
@@ -618,43 +611,41 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
chdir--;
#endif
}
- for(i = 0; i < chdir; i += 2)
+ for (i = 0; i < chdir; i += 2)
{
hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT;
hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT;
}
- for(i = 0; i < hInfo->num_side_channels; i += 2)
+ for (i = 0; i < hInfo->num_side_channels; i += 2)
{
hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT;
hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT;
}
chdir = hInfo->num_back_channels;
- if(chdir & 1)
+ if (chdir & 1)
{
back_center = 1;
chdir--;
}
- for(i = 0; i < chdir; i += 2)
+ for (i = 0; i < chdir; i += 2)
{
hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT;
hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT;
}
- if(back_center)
+ if (back_center)
{
hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER;
}
- for(i = 0; i < hInfo->num_lfe_channels; i++)
+ for (i = 0; i < hInfo->num_lfe_channels; i++)
{
hInfo->channel_position[chpos++] = LFE_CHANNEL;
}
- }
- else
- {
- switch(hDecoder->channelConfiguration)
+ } else {
+ switch (hDecoder->channelConfiguration)
{
case 1:
#if (defined(PS_DEC) || defined(DRM_PS))
@@ -721,86 +712,80 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
hInfo->channel_position[7] = LFE_CHANNEL;
break;
default: /* channelConfiguration == 0 || channelConfiguration > 7 */
- {
- uint8_t i;
- uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe;
- if(ch & 1) /* there's either a center front or a center back channel */
{
- uint8_t ch1 = (ch - 1) / 2;
- if(hDecoder->first_syn_ele == ID_SCE)
+ uint8_t i;
+ uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe;
+ if (ch & 1) /* there's either a center front or a center back channel */
{
- hInfo->num_front_channels = ch1 + 1;
- hInfo->num_back_channels = ch1;
- hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
- for(i = 1; i <= ch1; i += 2)
+ uint8_t ch1 = (ch-1)/2;
+ if (hDecoder->first_syn_ele == ID_SCE)
{
- hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ hInfo->num_front_channels = ch1 + 1;
+ hInfo->num_back_channels = ch1;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ for (i = 1; i <= ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1+1; i < ch; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ } else {
+ hInfo->num_front_channels = ch1;
+ hInfo->num_back_channels = ch1 + 1;
+ for (i = 0; i < ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1; i < ch-1; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
}
- for(i = ch1 + 1; i < ch; i += 2)
- {
- hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
- }
- }
- else
- {
+ } else {
+ uint8_t ch1 = (ch)/2;
hInfo->num_front_channels = ch1;
- hInfo->num_back_channels = ch1 + 1;
- for(i = 0; i < ch1; i += 2)
- {
- hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
- }
- for(i = ch1; i < ch - 1; i += 2)
- {
- hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
- }
- hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
- }
- }
- else
- {
- uint8_t ch1 = (ch) / 2;
- hInfo->num_front_channels = ch1;
- hInfo->num_back_channels = ch1;
- if(ch1 & 1)
- {
- hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
- for(i = 1; i <= ch1; i += 2)
- {
- hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
- }
- for(i = ch1 + 1; i < ch - 1; i += 2)
+ hInfo->num_back_channels = ch1;
+ if (ch1 & 1)
{
- hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ for (i = 1; i <= ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1+1; i < ch-1; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
+ } else {
+ for (i = 0; i < ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1; i < ch; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
}
- hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
}
- else
+ hInfo->num_lfe_channels = hDecoder->has_lfe;
+ for (i = ch; i < hDecoder->fr_channels; i++)
{
- for(i = 0; i < ch1; i += 2)
- {
- hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
- }
- for(i = ch1; i < ch; i += 2)
- {
- hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
- hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
- }
+ hInfo->channel_position[i] = LFE_CHANNEL;
}
}
- hInfo->num_lfe_channels = hDecoder->has_lfe;
- for(i = ch; i < hDecoder->fr_channels; i++)
- {
- hInfo->channel_position[i] = LFE_CHANNEL;
- }
- }
- break;
+ break;
}
}
}
@@ -822,14 +807,14 @@ void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder,
unsigned long sample_buffer_size)
{
NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder;
- if((sample_buffer == NULL) || (sample_buffer_size == 0))
+ if ((sample_buffer == NULL) || (sample_buffer_size == 0))
{
hInfo->error = 27;
return NULL;
}
return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size,
- sample_buffer, sample_buffer_size);
+ sample_buffer, sample_buffer_size);
}
#ifdef DRM
@@ -857,36 +842,34 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
uint32_t bitsconsumed;
uint16_t frame_len;
void *sample_buffer;
- uint32_t startbit = 0, endbit = 0, payload_bits = 0;
+ uint32_t startbit=0, endbit=0, payload_bits=0;
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
/* safety checks */
- if((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL))
+ if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL))
{
return NULL;
}
#if 0
- printf("%d\n", buffer_size * 8);
+ printf("%d\n", buffer_size*8);
#endif
frame_len = hDecoder->frameLength;
memset(hInfo, 0, sizeof(NeAACDecFrameInfo));
- memset(hDecoder->internal_channel, 0, MAX_CHANNELS * sizeof(hDecoder->internal_channel[0]));
+ memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0]));
#ifdef USE_TIME_LIMIT
- if((TIME_LIMIT * get_sample_rate(hDecoder->sf_index)) > hDecoder->TL_count)
+ if ((TIME_LIMIT * get_sample_rate(hDecoder->sf_index)) > hDecoder->TL_count)
{
hDecoder->TL_count += 1024;
- }
- else
- {
- hInfo->error = (NUM_ERROR_MESSAGES - 1);
+ } else {
+ hInfo->error = (NUM_ERROR_MESSAGES-1);
goto error;
}
#endif
@@ -896,9 +879,9 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
* No need to return an error
*/
/* ID3 */
- if(buffer_size >= 128)
+ if (buffer_size >= 128)
{
- if(memcmp(buffer, "TAG", 3) == 0)
+ if (memcmp(buffer, "TAG", 3) == 0)
{
/* found it */
hInfo->bytesconsumed = 128; /* 128 bytes fixed size */
@@ -914,7 +897,7 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
#if 0
{
int i;
- for(i = 0; i < ((buffer_size + 3) >> 2); i++)
+ for (i = 0; i < ((buffer_size+3)>>2); i++)
{
uint8_t *buf;
uint32_t temp = 0;
@@ -943,26 +926,26 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
#endif
#ifdef DRM
- if(hDecoder->object_type == DRM_ER_LC)
+ if (hDecoder->object_type == DRM_ER_LC)
{
/* We do not support stereo right now */
- if(0) //(hDecoder->channelConfiguration == 2)
+ if (0) //(hDecoder->channelConfiguration == 2)
{
hInfo->error = 28; // Throw CRC error
goto error;
}
faad_getbits(&ld, 8
- DEBUGVAR(1, 1, "NeAACDecDecode(): skip CRC"));
+ DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC"));
}
#endif
- if(hDecoder->adts_header_present)
+ if (hDecoder->adts_header_present)
{
adts_header adts;
adts.old_format = hDecoder->config.useOldADTSFormat;
- if((hInfo->error = adts_frame(&adts, &ld)) > 0)
+ if ((hInfo->error = adts_frame(&adts, &ld)) > 0)
goto error;
/* MPEG2 does byte_alignment() here,
@@ -977,12 +960,10 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
/* decode the complete bitstream */
#ifdef DRM
- if(/*(hDecoder->object_type == 6) ||*/ (hDecoder->object_type == DRM_ER_LC))
+ if (/*(hDecoder->object_type == 6) ||*/ (hDecoder->object_type == DRM_ER_LC))
{
DRM_aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc);
- }
- else
- {
+ } else {
#endif
raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc);
#ifdef DRM
@@ -993,9 +974,9 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
if(hDecoder->latm_header_present)
{
endbit = faad_get_processed_bits(&ld);
- if(endbit - startbit > payload_bits)
+ if(endbit-startbit > payload_bits)
fprintf(stderr, "\r\nERROR, too many payload bits read: %u > %d. Please. report with a link to a sample\n",
- endbit - startbit, payload_bits);
+ endbit-startbit, payload_bits);
if(hDecoder->latm_config.otherDataLenBits > 0)
faad_getbits(&ld, hDecoder->latm_config.otherDataLenBits);
faad_byte_align(&ld);
@@ -1004,11 +985,11 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
channels = hDecoder->fr_channels;
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
goto error;
/* safety check */
- if(channels == 0 || channels > MAX_CHANNELS)
+ if (channels == 0 || channels > MAX_CHANNELS)
{
/* invalid number of channels */
hInfo->error = 12;
@@ -1018,7 +999,7 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
/* no more bit reading after this */
bitsconsumed = faad_get_processed_bits(&ld);
hInfo->bytesconsumed = bit2byte(bitsconsumed);
- if(ld.error)
+ if (ld.error)
{
hInfo->error = 14;
goto error;
@@ -1026,35 +1007,33 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
faad_endbits(&ld);
- if(!hDecoder->adts_header_present && !hDecoder->adif_header_present
+ if (!hDecoder->adts_header_present && !hDecoder->adif_header_present
#if 0
- && !hDecoder->latm_header_present
+ && !hDecoder->latm_header_present
#endif
- )
+ )
{
- if(hDecoder->channelConfiguration == 0)
+ if (hDecoder->channelConfiguration == 0)
hDecoder->channelConfiguration = channels;
- if(channels == 8) /* 7.1 */
+ if (channels == 8) /* 7.1 */
hDecoder->channelConfiguration = 7;
- if(channels == 7) /* not a standard channelConfiguration */
+ if (channels == 7) /* not a standard channelConfiguration */
hDecoder->channelConfiguration = 0;
}
- if((channels == 5 || channels == 6) && hDecoder->config.downMatrix)
+ if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix)
{
hDecoder->downMatrix = 1;
output_channels = 2;
- }
- else
- {
+ } else {
output_channels = channels;
}
#if (defined(PS_DEC) || defined(DRM_PS))
hDecoder->upMatrix = 0;
/* check if we have a mono file */
- if(output_channels == 1)
+ if (output_channels == 1)
{
/* upMatrix to 2 channels for implicit signalling of PS */
hDecoder->upMatrix = 1;
@@ -1066,7 +1045,7 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
create_channel_config(hDecoder, hInfo);
/* number of samples in this frame */
- hInfo->samples = frame_len * output_channels;
+ hInfo->samples = frame_len*output_channels;
/* number of channels in this frame */
hInfo->channels = output_channels;
/* samplerate */
@@ -1077,12 +1056,12 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
hInfo->sbr = NO_SBR;
/* header type */
hInfo->header_type = RAW;
- if(hDecoder->adif_header_present)
+ if (hDecoder->adif_header_present)
hInfo->header_type = ADIF;
- if(hDecoder->adts_header_present)
+ if (hDecoder->adts_header_present)
hInfo->header_type = ADTS;
#if 0
- if(hDecoder->latm_header_present)
+ if (hDecoder->latm_header_present)
hInfo->header_type = LATM;
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
@@ -1090,37 +1069,35 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
#endif
/* check if frame has channel elements */
- if(channels == 0)
+ if (channels == 0)
{
hDecoder->frame++;
return NULL;
}
/* allocate the buffer for the final samples */
- if((hDecoder->sample_buffer == NULL) ||
- (hDecoder->alloced_channels != output_channels))
+ if ((hDecoder->sample_buffer == NULL) ||
+ (hDecoder->alloced_channels != output_channels))
{
static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t),
- sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t),
- sizeof(int16_t), sizeof(int16_t), 0, 0, 0
- };
+ sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t),
+ sizeof(int16_t), sizeof(int16_t), 0, 0, 0
+ };
uint8_t stride = str[hDecoder->config.outputFormat-1];
#ifdef SBR_DEC
- if(((hDecoder->sbr_present_flag == 1) && (!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1))
+ if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1))
{
stride = 2 * stride;
}
#endif
/* check if we want to use internal sample_buffer */
- if(sample_buffer_size == 0)
+ if (sample_buffer_size == 0)
{
- if(hDecoder->sample_buffer)
+ if (hDecoder->sample_buffer)
faad_free(hDecoder->sample_buffer);
hDecoder->sample_buffer = NULL;
- hDecoder->sample_buffer = faad_malloc(frame_len * output_channels * stride);
- }
- else if(sample_buffer_size < frame_len * output_channels * stride)
- {
+ hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride);
+ } else if (sample_buffer_size < frame_len*output_channels*stride) {
/* provided sample buffer is not big enough */
hInfo->error = 27;
return NULL;
@@ -1128,22 +1105,20 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
hDecoder->alloced_channels = output_channels;
}
- if(sample_buffer_size == 0)
+ if (sample_buffer_size == 0)
{
sample_buffer = hDecoder->sample_buffer;
- }
- else
- {
+ } else {
sample_buffer = *sample_buffer2;
}
#ifdef SBR_DEC
- if((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
{
uint8_t ele;
/* this data is different when SBR is used or when the data is upsampled */
- if(!hDecoder->downSampledSBR)
+ if (!hDecoder->downSampledSBR)
{
frame_len *= 2;
hInfo->samples *= 2;
@@ -1151,9 +1126,9 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
}
/* check if every element was provided with SBR data */
- for(ele = 0; ele < hDecoder->fr_ch_ele; ele++)
+ for (ele = 0; ele < hDecoder->fr_ch_ele; ele++)
{
- if(hDecoder->sbr[ele] == NULL)
+ if (hDecoder->sbr[ele] == NULL)
{
hInfo->error = 25;
goto error;
@@ -1161,16 +1136,14 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
}
/* sbr */
- if(hDecoder->sbr_present_flag == 1)
+ if (hDecoder->sbr_present_flag == 1)
{
hInfo->object_type = HE_AAC;
hInfo->sbr = SBR_UPSAMPLED;
- }
- else
- {
+ } else {
hInfo->sbr = NO_SBR_UPSAMPLED;
}
- if(hDecoder->downSampledSBR)
+ if (hDecoder->downSampledSBR)
{
hInfo->sbr = SBR_DOWNSAMPLED;
}
@@ -1179,7 +1152,7 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer,
- output_channels, frame_len, hDecoder->config.outputFormat);
+ output_channels, frame_len, hDecoder->config.outputFormat);
#ifdef DRM
@@ -1191,17 +1164,15 @@ static void* aac_frame_decode(NeAACDecStruct *hDecoder,
hDecoder->frame++;
#ifdef LD_DEC
- if(hDecoder->object_type != LD)
+ if (hDecoder->object_type != LD)
{
#endif
- if(hDecoder->frame <= 1)
+ if (hDecoder->frame <= 1)
hInfo->samples = 0;
#ifdef LD_DEC
- }
- else
- {
+ } else {
/* LD encoders will give lower delay */
- if(hDecoder->frame <= 0)
+ if (hDecoder->frame <= 0)
hInfo->samples = 0;
}
#endif
@@ -1226,17 +1197,17 @@ error:
#endif
/* reset filterbank state */
- for(i = 0; i < MAX_CHANNELS; i++)
+ for (i = 0; i < MAX_CHANNELS; i++)
{
- if(hDecoder->fb_intermed[i] != NULL)
+ if (hDecoder->fb_intermed[i] != NULL)
{
- memset(hDecoder->fb_intermed[i], 0, hDecoder->frameLength * sizeof(real_t));
+ memset(hDecoder->fb_intermed[i], 0, hDecoder->frameLength*sizeof(real_t));
}
}
#ifdef SBR_DEC
- for(i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
+ for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
{
- if(hDecoder->sbr[i] != NULL)
+ if (hDecoder->sbr[i] != NULL)
{
sbrReset(hDecoder->sbr[i]);
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.h
index 2b26062a1..24cdabdd8 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/decoder.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -38,18 +38,18 @@ extern "C" {
#endif
#ifdef _WIN32
-#pragma pack(push, 8)
-#ifndef NEAACDECAPI
-#define NEAACDECAPI __cdecl
-#endif
+ #pragma pack(push, 8)
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI __cdecl
+ #endif
#else
-#ifndef NEAACDECAPI
-#define NEAACDECAPI
-#endif
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI
+ #endif
#endif
- /* library output formats */
+/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
@@ -75,49 +75,49 @@ extern "C" {
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
- char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);
- uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);
- NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
- NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
- uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
- NeAACDecConfigurationPtr config);
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+ NeAACDecConfigurationPtr config);
- /* Init the library based on info from the AAC file (ADTS/ADIF) */
- int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
- uint8_t *buffer,
- uint32_t buffer_size,
- uint32_t *samplerate,
- uint8_t *channels);
+/* Init the library based on info from the AAC file (ADTS/ADIF) */
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+ uint8_t *buffer,
+ uint32_t buffer_size,
+ uint32_t *samplerate,
+ uint8_t *channels);
- /* Init the library using a DecoderSpecificInfo */
- int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
- uint32_t SizeOfDecoderSpecificInfo,
- uint32_t *samplerate, uint8_t *channels);
+/* Init the library using a DecoderSpecificInfo */
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+ uint32_t SizeOfDecoderSpecificInfo,
+ uint32_t *samplerate, uint8_t *channels);
- /* Init the library for DRM */
- int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
- uint8_t channels);
+/* Init the library for DRM */
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+ uint8_t channels);
- void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
- void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);
- void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
- NeAACDecFrameInfo *hInfo,
- uint8_t *buffer,
- uint32_t buffer_size);
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer,
+ uint32_t buffer_size);
- void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
- NeAACDecFrameInfo *hInfo,
- uint8_t *buffer, uint32_t buffer_size,
- void **sample_buffer, uint32_t sample_buffer_size);
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer, uint32_t buffer_size,
+ void **sample_buffer, uint32_t sample_buffer_size);
#ifdef _WIN32
-#pragma pack(pop)
+ #pragma pack(pop)
#endif
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.c
index b469157e7..3c9ff3ae0 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -45,7 +45,7 @@ drc_info *drc_init(real_t cut, real_t boost)
drc->ctrl2 = boost;
drc->num_bands = 1;
- drc->band_top[0] = 1024 / 4 - 1;
+ drc->band_top[0] = 1024/4 - 1;
drc->dyn_rng_sgn[0] = 1;
drc->dyn_rng_ctl[0] = 0;
@@ -54,7 +54,7 @@ drc_info *drc_init(real_t cut, real_t boost)
void drc_end(drc_info *drc)
{
- if(drc) faad_free(drc);
+ if (drc) faad_free(drc);
}
#ifdef FIXED_POINT
@@ -120,54 +120,50 @@ void drc_decode(drc_info *drc, real_t *spec)
#endif
uint16_t bottom = 0;
- if(drc->num_bands == 1)
- drc->band_top[0] = 1024 / 4 - 1;
+ if (drc->num_bands == 1)
+ drc->band_top[0] = 1024/4 - 1;
- for(bd = 0; bd < drc->num_bands; bd++)
+ for (bd = 0; bd < drc->num_bands; bd++)
{
top = 4 * (drc->band_top[bd] + 1);
#ifndef FIXED_POINT
/* Decode DRC gain factor */
- if(drc->dyn_rng_sgn[bd]) /* compress */
- exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) / REAL_CONST(24.0);
+ if (drc->dyn_rng_sgn[bd]) /* compress */
+ exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
else /* boost */
- exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) / REAL_CONST(24.0);
+ exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
factor = (real_t)pow(2.0, exp);
/* Apply gain factor */
- for(i = bottom; i < top; i++)
+ for (i = bottom; i < top; i++)
spec[i] *= factor;
#else
/* Decode DRC gain factor */
- if(drc->dyn_rng_sgn[bd]) /* compress */
+ if (drc->dyn_rng_sgn[bd]) /* compress */
{
- exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) / 24;
+ exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
- }
- else /* boost */
- {
- exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) / 24;
+ } else { /* boost */
+ exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
}
/* Apply gain factor */
- if(exp < 0)
+ if (exp < 0)
{
- for(i = bottom; i < top; i++)
+ for (i = bottom; i < top; i++)
{
spec[i] >>= -exp;
- if(frac)
- spec[i] = MUL_R(spec[i], drc_pow2_table[frac+23]);
+ if (frac)
+ spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
- }
- else
- {
- for(i = bottom; i < top; i++)
+ } else {
+ for (i = bottom; i < top; i++)
{
spec[i] <<= exp;
- if(frac)
- spec[i] = MUL_R(spec[i], drc_pow2_table[frac+23]);
+ if (frac)
+ spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.h
index c8e6b45d7..49118bcd0 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/drc.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -38,9 +38,9 @@ extern "C" {
#define DRC_REF_LEVEL 20*4 /* -20 dB */
- drc_info *drc_init(real_t cut, real_t boost);
- void drc_end(drc_info *drc);
- void drc_decode(drc_info *drc, real_t *spec);
+drc_info *drc_init(real_t cut, real_t boost);
+void drc_end(drc_info *drc);
+void drc_decode(drc_info *drc, real_t *spec);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.c
index 84e0ffdce..61cb8180e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -49,7 +49,7 @@ typedef const int8_t (*drm_ps_huff_tab)[2];
/* binary search huffman tables */
-static const int8_t f_huffman_sa[][2] =
+static const int8_t f_huffman_sa[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
@@ -67,7 +67,7 @@ static const int8_t f_huffman_sa[][2] =
{ /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */
};
-static const int8_t t_huffman_sa[][2] =
+static const int8_t t_huffman_sa[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
@@ -85,7 +85,7 @@ static const int8_t t_huffman_sa[][2] =
{ /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */
};
-static const int8_t f_huffman_pan[][2] =
+static const int8_t f_huffman_pan[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
@@ -117,7 +117,7 @@ static const int8_t f_huffman_pan[][2] =
{ /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */
};
-static const int8_t t_huffman_pan[][2] =
+static const int8_t t_huffman_pan[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
@@ -150,7 +150,7 @@ static const int8_t t_huffman_pan[][2] =
};
/* There are 3 classes in the standard but the last 2 are identical */
-static const real_t sa_quant[8][2] =
+static const real_t sa_quant[8][2] =
{
{ FRAC_CONST(0.0000), FRAC_CONST(0.0000) },
{ FRAC_CONST(0.0501), FRAC_CONST(0.1778) },
@@ -164,7 +164,7 @@ static const real_t sa_quant[8][2] =
/* We don't need the actual quantizer values */
#if 0
-static const real_t pan_quant[8][5] =
+static const real_t pan_quant[8][5] =
{
{ COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) },
{ COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) },
@@ -178,8 +178,7 @@ static const real_t pan_quant[8][5] =
#endif
/* 2^(pan_quant[x][y] */
-static const real_t pan_pow_2_pos[8][5] =
-{
+static const real_t pan_pow_2_pos[8][5] = {
{ REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) },
{ REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) },
{ REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) },
@@ -191,8 +190,7 @@ static const real_t pan_pow_2_pos[8][5] =
};
/* 2^(-pan_quant[x][y] */
-static const real_t pan_pow_2_neg[8][5] =
-{
+static const real_t pan_pow_2_neg[8][5] = {
{ REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) },
{ REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) },
{ REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) },
@@ -204,44 +202,40 @@ static const real_t pan_pow_2_neg[8][5] =
};
/* 2^(pan_quant[x][y]/30) */
-static const real_t pan_pow_2_30_pos[8][5] =
-{
- { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
- { COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) },
- { COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) },
- { COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) },
+static const real_t pan_pow_2_30_pos[8][5] = {
+ { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
+ { COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) },
+ { COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) },
+ { COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) },
{ COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) },
- { COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) },
- { COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) },
+ { COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) },
+ { COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) },
{ COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) }
};
/* 2^(-pan_quant[x][y]/30) */
-static const real_t pan_pow_2_30_neg[8][5] =
-{
+static const real_t pan_pow_2_30_neg[8][5] = {
{ COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
- { COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) },
- { COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) },
- { COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) },
- { COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) },
- { COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) },
- { COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) },
+ { COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) },
+ { COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) },
+ { COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) },
+ { COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) },
+ { COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) },
+ { COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) },
{ COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) }
};
-static const real_t g_decayslope[MAX_SA_BAND] =
-{
- FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95), FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8),
- FRAC_CONST(0.75), FRAC_CONST(0.7), FRAC_CONST(0.65), FRAC_CONST(0.6), FRAC_CONST(0.55), FRAC_CONST(0.5), FRAC_CONST(0.45),
- FRAC_CONST(0.4), FRAC_CONST(0.35), FRAC_CONST(0.3), FRAC_CONST(0.25), FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1),
- FRAC_CONST(0.05), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
- FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
- FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
+static const real_t g_decayslope[MAX_SA_BAND] = {
+ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8),
+ FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45),
+ FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1),
+ FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
+ FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
+ FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0)
};
-static const real_t sa_sqrt_1_minus[8][2] =
-{
+static const real_t sa_sqrt_1_minus[8][2] = {
{ FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) },
{ FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) },
@@ -252,53 +246,51 @@ static const real_t sa_sqrt_1_minus[8][2] =
{ FRAC_CONST(0.929071574), FRAC_CONST(0) }
};
-static const uint8_t sa_freq_scale[9] =
+static const uint8_t sa_freq_scale[9] =
{
0, 1, 2, 3, 5, 7, 10, 13, 23
};
-static const uint8_t pan_freq_scale[21] =
+static const uint8_t pan_freq_scale[21] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 18, 22, 26, 32, 64
};
-static const uint8_t pan_quant_class[20] =
+static const uint8_t pan_quant_class[20] =
{
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 4, 4, 4
};
/* Inverse mapping lookup */
-static const uint8_t pan_inv_freq[64] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
+static const uint8_t pan_inv_freq[64] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
};
-static const uint8_t sa_inv_freq[MAX_SA_BAND] =
-{
+static const uint8_t sa_inv_freq[MAX_SA_BAND] = {
0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 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
};
-static const real_t filter_coeff[] =
+static const real_t filter_coeff[] =
{
FRAC_CONST(0.65143905754106),
FRAC_CONST(0.56471812200776),
FRAC_CONST(0.48954165955695)
};
-static const uint8_t delay_length[3] =
+static const uint8_t delay_length[3] =
{
3, 4, 5
};
-static const real_t delay_fraction[] =
+static const real_t delay_fraction[] =
{
FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347)
};
@@ -308,8 +300,7 @@ static const real_t peak_decay = FRAC_CONST(0.76592833836465);
static const real_t smooth_coeff = FRAC_CONST(0.25);
/* Please note that these are the same tables as in plain PS */
-static const complex_t Q_Fract_allpass_Qmf[][3] =
-{
+static const complex_t Q_Fract_allpass_Qmf[][3] = {
{ { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
{ { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
{ { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
@@ -376,8 +367,7 @@ static const complex_t Q_Fract_allpass_Qmf[][3] =
{ { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
};
-static const complex_t Phi_Fract_Qmf[] =
-{
+static const complex_t Phi_Fract_Qmf[] = {
{ FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
{ FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
{ FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
@@ -460,12 +450,12 @@ uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld)
ps->bs_enable_sa = faad_get1bit(ld);
ps->bs_enable_pan = faad_get1bit(ld);
- if(ps->bs_enable_sa)
+ if (ps->bs_enable_sa)
{
drm_ps_sa_element(ps, ld);
}
- if(ps->bs_enable_pan)
+ if (ps->bs_enable_pan)
{
drm_ps_pan_element(ps, ld);
}
@@ -481,16 +471,14 @@ static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld)
uint8_t band;
ps->bs_sa_dt_flag = faad_get1bit(ld);
- if(ps->bs_sa_dt_flag)
+ if (ps->bs_sa_dt_flag)
{
huff = t_huffman_sa;
- }
- else
- {
+ } else {
huff = f_huffman_sa;
}
- for(band = 0; band < DRM_NUM_SA_BANDS; band++)
+ for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->bs_sa_data[band] = huff_dec(ld, huff);
}
@@ -502,16 +490,14 @@ static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld)
uint8_t band;
ps->bs_pan_dt_flag = faad_get1bit(ld);
- if(ps->bs_pan_dt_flag)
+ if (ps->bs_pan_dt_flag)
{
huff = t_huffman_pan;
- }
- else
- {
+ } else {
huff = f_huffman_pan;
}
- for(band = 0; band < DRM_NUM_PAN_BANDS; band++)
+ for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->bs_pan_data[band] = huff_dec(ld, huff);
}
@@ -523,7 +509,7 @@ static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff)
uint8_t bit;
int16_t index = 0;
- while(index >= 0)
+ while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = huff[index][bit];
@@ -535,149 +521,122 @@ static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff)
static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i)
{
- if(i < 0)
- {
- /* printf(" SAminclip %d", i); */
+ if (i < 0) {
+ /* printf(" SAminclip %d", i); */
ps->sa_decode_error = 1;
return 0;
- }
- else if(i > 7)
- {
- /* printf(" SAmaxclip %d", i); */
+ } else if (i > 7) {
+ /* printf(" SAmaxclip %d", i); */
ps->sa_decode_error = 1;
return 7;
- }
- else
+ } else
return i;
}
static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i)
-{
- if(i < -7)
- {
+{
+ if (i < -7) {
/* printf(" PANminclip %d", i); */
ps->pan_decode_error = 1;
return -7;
- }
- else if(i > 7)
- {
- /* printf(" PANmaxclip %d", i); */
+ } else if (i > 7) {
+ /* printf(" PANmaxclip %d", i); */
ps->pan_decode_error = 1;
return 7;
- }
- else
+ } else
return i;
}
-static void drm_ps_delta_decode(drm_ps_info *ps)
+static void drm_ps_delta_decode(drm_ps_info *ps)
{
- uint8_t band;
+ uint8_t band;
- if(ps->bs_enable_sa)
- {
- if(ps->bs_sa_dt_flag && !ps->g_last_had_sa)
- {
+ if (ps->bs_enable_sa)
+ {
+ if (ps->bs_sa_dt_flag && !ps->g_last_had_sa)
+ {
/* wait until we get a DT frame */
ps->bs_enable_sa = 0;
- }
- else if(ps->bs_sa_dt_flag)
- {
+ } else if (ps->bs_sa_dt_flag) {
/* DT frame, we have a last frame, so we can decode */
- ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0] + ps->bs_sa_data[0]);
- }
- else
- {
+ ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]);
+ } else {
/* DF always decodable */
- ps->g_sa_index[0] = sa_delta_clip(ps, ps->bs_sa_data[0]);
+ ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]);
}
-
- for(band = 1; band < DRM_NUM_SA_BANDS; band++)
- {
- if(ps->bs_sa_dt_flag && ps->g_last_had_sa)
+
+ for (band = 1; band < DRM_NUM_SA_BANDS; band++)
+ {
+ if (ps->bs_sa_dt_flag && ps->g_last_had_sa)
{
ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]);
- }
- else if(!ps->bs_sa_dt_flag)
- {
- ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]);
+ } else if (!ps->bs_sa_dt_flag) {
+ ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]);
}
}
}
/* An error during SA decoding implies PAN data will be undecodable, too */
/* Also, we don't like on/off switching in PS, so we force to last settings */
- if(ps->sa_decode_error)
- {
+ if (ps->sa_decode_error) {
ps->pan_decode_error = 1;
ps->bs_enable_pan = ps->g_last_had_pan;
ps->bs_enable_sa = ps->g_last_had_sa;
}
-
-
- if(ps->bs_enable_sa)
- {
- if(ps->sa_decode_error)
- {
- for(band = 0; band < DRM_NUM_SA_BANDS; band++)
- {
+
+
+ if (ps->bs_enable_sa)
+ {
+ if (ps->sa_decode_error) {
+ for (band = 0; band < DRM_NUM_SA_BANDS; band++)
+ {
ps->g_sa_index[band] = ps->g_last_good_sa_index[band];
}
- }
- else
- {
- for(band = 0; band < DRM_NUM_SA_BANDS; band++)
- {
+ } else {
+ for (band = 0; band < DRM_NUM_SA_BANDS; band++)
+ {
ps->g_last_good_sa_index[band] = ps->g_sa_index[band];
}
}
}
-
- if(ps->bs_enable_pan)
+
+ if (ps->bs_enable_pan)
{
- if(ps->bs_pan_dt_flag && !ps->g_last_had_pan)
+ if (ps->bs_pan_dt_flag && !ps->g_last_had_pan)
{
ps->bs_enable_pan = 0;
- }
- else if(ps->bs_pan_dt_flag)
- {
- ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0] + ps->bs_pan_data[0]);
- }
- else
- {
+ } else if (ps->bs_pan_dt_flag) {
+ ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]);
+ } else {
ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]);
}
-
- for(band = 1; band < DRM_NUM_PAN_BANDS; band++)
- {
- if(ps->bs_pan_dt_flag && ps->g_last_had_pan)
+
+ for (band = 1; band < DRM_NUM_PAN_BANDS; band++)
+ {
+ if (ps->bs_pan_dt_flag && ps->g_last_had_pan)
{
ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]);
- }
- else if(!ps->bs_pan_dt_flag)
- {
+ } else if (!ps->bs_pan_dt_flag) {
ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]);
}
}
-
- if(ps->pan_decode_error)
- {
- for(band = 0; band < DRM_NUM_PAN_BANDS; band++)
- {
+
+ if (ps->pan_decode_error) {
+ for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
+ {
ps->g_pan_index[band] = ps->g_last_good_pan_index[band];
}
- }
- else
- {
- for(band = 0; band < DRM_NUM_PAN_BANDS; band++)
- {
+ } else {
+ for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
+ {
ps->g_last_good_pan_index[band] = ps->g_pan_index[band];
}
}
}
}
-static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
-{
+static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
+{
uint8_t s, b, k;
complex_t qfrac, tmp0, tmp, in, R0;
real_t peakdiff;
@@ -691,17 +650,17 @@ static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
uint32_t in_re, in_im;
#endif
- for(b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
+ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
{
- /* set delay indices */
- for(k = 0; k < NUM_OF_LINKS; k++)
+ /* set delay indices */
+ for (k = 0; k < NUM_OF_LINKS; k++)
temp_delay_ser[k] = ps->delay_buf_index_ser[k];
RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]);
IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]);
- for(s = 0; s < NUM_OF_SUBSAMPLES; s++)
- {
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ {
const real_t gamma = REAL_CONST(1.5);
const real_t sigma = REAL_CONST(1.5625);
@@ -712,15 +671,15 @@ static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
/* NOTE: all input is scaled by 2^(-5) because of fixed point QMF
* meaning that P will be scaled by 2^(-10) compared to floating point version
*/
- in_re = ((abs(RE(in)) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
- in_im = ((abs(IM(in)) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
- power = in_re * in_re + in_im * in_im;
+ in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ power = in_re*in_re + in_im*in_im;
#else
- power = MUL_R(RE(in), RE(in)) + MUL_R(IM(in), IM(in));
+ power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in));
#endif
ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay);
- if(ps->peakdecay_fast[b] < power)
+ if (ps->peakdecay_fast[b] < power)
ps->peakdecay_fast[b] = power;
peakdiff = ps->prev_peakdiff[b];
@@ -731,16 +690,13 @@ static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff);
ps->prev_nrg[b] = nrg;
- if(MUL_R(peakdiff, gamma) <= nrg)
- {
+ if (MUL_R(peakdiff, gamma) <= nrg) {
transratio = sigma;
- }
- else
- {
+ } else {
transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma);
}
-
- for(k = 0; k < NUM_OF_LINKS; k++)
+
+ for (k = 0; k < NUM_OF_LINKS; k++)
{
new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]);
}
@@ -752,14 +708,14 @@ static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]);
RE(ps->d_buff[1][b]) = RE(in);
- IM(ps->d_buff[1][b]) = IM(in);
+ IM(ps->d_buff[1][b]) = IM(in);
ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract));
RE(R0) = RE(tmp);
IM(R0) = IM(tmp);
- for(k = 0; k < NUM_OF_LINKS; k++)
+ for (k = 0; k < NUM_OF_LINKS; k++)
{
RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]);
IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]);
@@ -782,29 +738,29 @@ static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio);
QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio);
- for(k = 0; k < NUM_OF_LINKS; k++)
+ for (k = 0; k < NUM_OF_LINKS; k++)
{
- if(++temp_delay_ser[k] >= delay_length[k])
+ if (++temp_delay_ser[k] >= delay_length[k])
temp_delay_ser[k] = 0;
}
- }
+ }
}
- for(k = 0; k < NUM_OF_LINKS; k++)
+ for (k = 0; k < NUM_OF_LINKS; k++)
ps->delay_buf_index_ser[k] = temp_delay_ser[k];
}
-static void drm_add_ambiance(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
+static void drm_add_ambiance(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
- uint8_t s, b, ifreq, qclass;
+ uint8_t s, b, ifreq, qclass;
real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND];
real_t new_dir_map, new_sa_map;
-
- if(ps->bs_enable_sa)
+
+ if (ps->bs_enable_sa)
{
/* Instead of dequantization and mapping, we use an inverse mapping
to look up all the values we need */
- for(b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
+ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
{
const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333);
@@ -814,48 +770,47 @@ static void drm_add_ambiance(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_righ
sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass];
new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass];
- k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b]));
-
- sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass];
+ k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b]));
+
+ sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass];
new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass];
-
+
k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b]));
}
- for(s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
- for(b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
- {
+ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
+ {
QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
-
+
sa_map[b] += k_sa_map[b];
sa_dir_map[b] += k_sa_dir_map[b];
}
- for(b = sa_freq_scale[DRM_NUM_SA_BANDS]; b < NUM_OF_QMF_CHANNELS; b++)
- {
+ for (b = sa_freq_scale[DRM_NUM_SA_BANDS]; b < NUM_OF_QMF_CHANNELS; b++)
+ {
QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
}
}
- }
- else
- {
- for(s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ }
+ else {
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
- for(b = 0; b < NUM_OF_QMF_CHANNELS; b++)
+ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
- QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
+ QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
}
}
}
}
-static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
+static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
uint8_t s, b, qclass, ifreq;
real_t tmp, coeff1, coeff2;
@@ -863,63 +818,55 @@ static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38]
real_t pan_delta[MAX_PAN_BAND];
qmf_t temp_l, temp_r;
- if(ps->bs_enable_pan)
+ if (ps->bs_enable_pan)
{
- for(b = 0; b < NUM_OF_QMF_CHANNELS; b++)
+ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
/* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an
inverse mapping 64->20 and look up the 2^G(x,y) values directly */
ifreq = pan_inv_freq[b];
qclass = pan_quant_class[ifreq];
- if(ps->g_prev_pan_index[ifreq] >= 0)
- {
- pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass];
- }
- else
+ if (ps->g_prev_pan_index[ifreq] >= 0)
{
+ pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass];
+ } else {
pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass];
}
/* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */
/* a en b can be negative so we may need to inverse parts */
- if(ps->g_pan_index[ifreq] >= 0)
+ if (ps->g_pan_index[ifreq] >= 0)
{
- if(ps->g_prev_pan_index[ifreq] >= 0)
+ if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
- }
- else
- {
+ } else {
pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
}
- }
- else
- {
- if(ps->g_prev_pan_index[ifreq] >= 0)
+ } else {
+ if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
- }
- else
- {
+ } else {
pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
}
}
}
- for(s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
/* PAN always uses all 64 channels */
- for(b = 0; b < NUM_OF_QMF_CHANNELS; b++)
+ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
tmp = pan_base[b];
coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp));
- coeff1 = MUL_R(coeff2, tmp);
+ coeff1 = MUL_R(coeff2, tmp);
QMF_RE(temp_l) = QMF_RE(X_left[s][b]);
QMF_IM(temp_l) = QMF_IM(X_left[s][b]);
@@ -930,20 +877,20 @@ static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38]
QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1);
QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2);
QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2);
-
+
/* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */
/* ^^^^^^^^^^^^^^^ k times */
pan_base[b] = MUL_C(pan_base[b], pan_delta[b]);
- }
- }
- }
+ }
+ }
+ }
}
drm_ps_info *drm_ps_init(void)
{
drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info));
- memset(ps, 0, sizeof(drm_ps_info));
+ memset(ps, 0, sizeof(drm_ps_info));
return ps;
}
@@ -955,16 +902,16 @@ void drm_ps_free(drm_ps_info *ps)
/* main DRM PS decoding function */
uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64])
-{
- if(ps == NULL)
+{
+ if (ps == NULL)
{
- memcpy(X_right, X_left, sizeof(qmf_t) * 30 * 64);
- return 0;
- }
+ memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
+ return 0;
+ }
- if(!ps->drm_ps_data_available && !guess)
+ if (!ps->drm_ps_data_available && !guess)
{
- memcpy(X_right, X_left, sizeof(qmf_t) * 30 * 64);
+ memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index));
memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index));
return 0;
@@ -972,47 +919,42 @@ uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_
/* if SBR CRC doesn't match out, we can assume decode errors to start with,
and we'll guess what the parameters should be */
- if(!guess)
+ if (!guess)
{
ps->sa_decode_error = 0;
ps->pan_decode_error = 0;
drm_ps_delta_decode(ps);
- }
- else
+ } else
{
ps->sa_decode_error = 1;
ps->pan_decode_error = 1;
/* don't even bother decoding */
}
-
+
ps->drm_ps_data_available = 0;
drm_calc_sa_side_signal(ps, X_left);
drm_add_ambiance(ps, X_left, X_right);
- if(ps->bs_enable_sa)
+ if (ps->bs_enable_sa)
{
- ps->g_last_had_sa = 1;
+ ps->g_last_had_sa = 1;
- memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS);
+ memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS);
- }
- else
- {
+ } else {
ps->g_last_had_sa = 0;
}
-
- if(ps->bs_enable_pan)
+
+ if (ps->bs_enable_pan)
{
drm_add_pan(ps, X_left, X_right);
-
- ps->g_last_had_pan = 1;
+
+ ps->g_last_had_pan = 1;
memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS);
- }
- else
- {
+ } else {
ps->g_last_had_pan = 0;
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.h
index 4ea014a4d..d0ac995e4 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/drm_dec.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -47,51 +47,51 @@ extern "C" {
#define MAX_PAN_BAND 64
#define MAX_DELAY 5
- typedef struct
- {
- uint8_t drm_ps_data_available;
- uint8_t bs_enable_sa;
- uint8_t bs_enable_pan;
-
- uint8_t bs_sa_dt_flag;
- uint8_t bs_pan_dt_flag;
-
- uint8_t g_last_had_sa;
- uint8_t g_last_had_pan;
-
- int8_t bs_sa_data[DRM_NUM_SA_BANDS];
- int8_t bs_pan_data[DRM_NUM_PAN_BANDS];
+typedef struct
+{
+ uint8_t drm_ps_data_available;
+ uint8_t bs_enable_sa;
+ uint8_t bs_enable_pan;
- int8_t g_sa_index[DRM_NUM_SA_BANDS];
- int8_t g_pan_index[DRM_NUM_PAN_BANDS];
- int8_t g_prev_sa_index[DRM_NUM_SA_BANDS];
- int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS];
+ uint8_t bs_sa_dt_flag;
+ uint8_t bs_pan_dt_flag;
- int8_t sa_decode_error;
- int8_t pan_decode_error;
+ uint8_t g_last_had_sa;
+ uint8_t g_last_had_pan;
- int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS];
- int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS];
+ int8_t bs_sa_data[DRM_NUM_SA_BANDS];
+ int8_t bs_pan_data[DRM_NUM_PAN_BANDS];
+
+ int8_t g_sa_index[DRM_NUM_SA_BANDS];
+ int8_t g_pan_index[DRM_NUM_PAN_BANDS];
+ int8_t g_prev_sa_index[DRM_NUM_SA_BANDS];
+ int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS];
- qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND];
+ int8_t sa_decode_error;
+ int8_t pan_decode_error;
- complex_t d_buff[2][MAX_SA_BAND];
- complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND];
+ int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS];
+ int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS];
+
+ qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND];
- uint8_t delay_buf_index_ser[NUM_OF_LINKS];
+ complex_t d_buff[2][MAX_SA_BAND];
+ complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND];
- real_t prev_nrg[MAX_SA_BAND];
- real_t prev_peakdiff[MAX_SA_BAND];
- real_t peakdecay_fast[MAX_SA_BAND];
- } drm_ps_info;
+ uint8_t delay_buf_index_ser[NUM_OF_LINKS];
+
+ real_t prev_nrg[MAX_SA_BAND];
+ real_t prev_peakdiff[MAX_SA_BAND];
+ real_t peakdecay_fast[MAX_SA_BAND];
+} drm_ps_info;
- uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld);
+uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld);
- drm_ps_info *drm_ps_init(void);
- void drm_ps_free(drm_ps_info *ps);
+drm_ps_info *drm_ps_init(void);
+void drm_ps_free(drm_ps_info *ps);
- uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]);
+uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/error.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/error.c
index 0f8965a13..8984a8390 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/error.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/error.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -31,8 +31,7 @@
#include "common.h"
#include "error.h"
-char *err_msg[] =
-{
+char *err_msg[] = {
"No error",
"Gain control not yet implemented",
"Pulse coding not allowed in short blocks",
@@ -66,6 +65,6 @@ char *err_msg[] =
"No standard extension payload allowed in DRM",
"PCE shall be the first element in a frame",
"Bitstream value not allowed by specification",
- "MAIN prediction not initialised"
+ "MAIN prediction not initialised"
};
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/error.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/error.h
index 7044504ce..0e79423a7 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/error.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/error.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,7 +36,7 @@ extern "C" {
#endif
#define NUM_ERROR_MESSAGES 34
- extern char *err_msg[];
+extern char *err_msg[];
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.c
index 876c1f466..1b1464bca 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -48,24 +48,24 @@
fb_info *filter_bank_init(uint16_t frame_len)
{
- uint16_t nshort = frame_len / 8;
+ uint16_t nshort = frame_len/8;
#ifdef LD_DEC
- uint16_t frame_len_ld = frame_len / 2;
+ uint16_t frame_len_ld = frame_len/2;
#endif
fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
memset(fb, 0, sizeof(fb_info));
/* normal */
- fb->mdct256 = faad_mdct_init(2 * nshort);
- fb->mdct2048 = faad_mdct_init(2 * frame_len);
+ fb->mdct256 = faad_mdct_init(2*nshort);
+ fb->mdct2048 = faad_mdct_init(2*frame_len);
#ifdef LD_DEC
/* LD */
- fb->mdct1024 = faad_mdct_init(2 * frame_len_ld);
+ fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
- if(frame_len == 1024)
+ if (frame_len == 1024)
{
#endif
fb->long_window[0] = sine_long_1024;
@@ -77,9 +77,7 @@ fb_info *filter_bank_init(uint16_t frame_len)
fb->ld_window[1] = ld_mid_512;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
- }
- else /* (frame_len == 960) */
- {
+ } else /* (frame_len == 960) */ {
fb->long_window[0] = sine_long_960;
fb->short_window[0] = sine_short_120;
fb->long_window[1] = kbd_long_960;
@@ -96,7 +94,7 @@ fb_info *filter_bank_init(uint16_t frame_len)
void filter_bank_end(fb_info *fb)
{
- if(fb != NULL)
+ if (fb != NULL)
{
#ifdef PROFILE
printf("FB: %I64d cycles\n", fb->cycles);
@@ -117,7 +115,7 @@ static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, ui
#ifdef LD_DEC
mdct_info *mdct = NULL;
- switch(len)
+ switch (len)
{
case 2048:
case 1920:
@@ -141,7 +139,7 @@ static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t
{
mdct_info *mdct = NULL;
- switch(len)
+ switch (len)
{
case 2048:
case 1920:
@@ -177,10 +175,10 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
- uint16_t nshort = frame_len / 8;
- uint16_t trans = nshort / 2;
+ uint16_t nshort = frame_len/8;
+ uint16_t trans = nshort/2;
- uint16_t nflat_ls = (nlong - nshort) / 2;
+ uint16_t nflat_ls = (nlong-nshort)/2;
#ifdef PROFILE
int64_t count = faad_get_ts();
@@ -188,13 +186,11 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
/* select windows of current frame and previous frame (Sine or KBD) */
#ifdef LD_DEC
- if(object_type == LD)
+ if (object_type == LD)
{
window_long = fb->ld_window[window_shape];
window_long_prev = fb->ld_window[window_shape_prev];
- }
- else
- {
+ } else {
#endif
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
@@ -205,7 +201,7 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
#endif
#if 0
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
printf("%d\n", freq_in[i]);
}
@@ -215,113 +211,113 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
printf("%d %d\n", window_sequence, window_shape);
#endif
- switch(window_sequence)
+ switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
/* perform iMDCT */
- imdct_long(fb, freq_in, transf_buf, 2 * nlong);
+ imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
- for(i = 0; i < nlong; i += 4)
+ for (i = 0; i < nlong; i+=4)
{
- time_out[i] = overlap[i] + MUL_F(transf_buf[i], window_long_prev[i]);
- time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1], window_long_prev[i+1]);
- time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2], window_long_prev[i+2]);
- time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3], window_long_prev[i+3]);
+ time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
+ time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+ time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+ time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
}
/* window the second half and save as overlap for next frame */
- for(i = 0; i < nlong; i += 4)
+ for (i = 0; i < nlong; i+=4)
{
- overlap[i] = MUL_F(transf_buf[nlong+i], window_long[nlong-1-i]);
- overlap[i+1] = MUL_F(transf_buf[nlong+i+1], window_long[nlong-2-i]);
- overlap[i+2] = MUL_F(transf_buf[nlong+i+2], window_long[nlong-3-i]);
- overlap[i+3] = MUL_F(transf_buf[nlong+i+3], window_long[nlong-4-i]);
+ overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+ overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
+ overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
+ overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
}
break;
case LONG_START_SEQUENCE:
/* perform iMDCT */
- imdct_long(fb, freq_in, transf_buf, 2 * nlong);
+ imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
- for(i = 0; i < nlong; i += 4)
+ for (i = 0; i < nlong; i+=4)
{
- time_out[i] = overlap[i] + MUL_F(transf_buf[i], window_long_prev[i]);
- time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1], window_long_prev[i+1]);
- time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2], window_long_prev[i+2]);
- time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3], window_long_prev[i+3]);
+ time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
+ time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+ time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+ time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
}
/* window the second half and save as overlap for next frame */
/* construct second half window using padding with 1's and 0's */
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
overlap[i] = transf_buf[nlong+i];
- for(i = 0; i < nshort; i++)
- overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i], window_short[nshort-i-1]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nshort; i++)
+ overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+ for (i = 0; i < nflat_ls; i++)
overlap[nflat_ls+nshort+i] = 0;
break;
case EIGHT_SHORT_SEQUENCE:
/* perform iMDCT for each short block */
- faad_imdct(fb->mdct256, freq_in + 0 * nshort, transf_buf + 2 * nshort * 0);
- faad_imdct(fb->mdct256, freq_in + 1 * nshort, transf_buf + 2 * nshort * 1);
- faad_imdct(fb->mdct256, freq_in + 2 * nshort, transf_buf + 2 * nshort * 2);
- faad_imdct(fb->mdct256, freq_in + 3 * nshort, transf_buf + 2 * nshort * 3);
- faad_imdct(fb->mdct256, freq_in + 4 * nshort, transf_buf + 2 * nshort * 4);
- faad_imdct(fb->mdct256, freq_in + 5 * nshort, transf_buf + 2 * nshort * 5);
- faad_imdct(fb->mdct256, freq_in + 6 * nshort, transf_buf + 2 * nshort * 6);
- faad_imdct(fb->mdct256, freq_in + 7 * nshort, transf_buf + 2 * nshort * 7);
+ faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
+ faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
+ faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
+ faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
+ faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
+ faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
+ faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
+ faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
/* add second half output of previous frame to windowed output of current frame */
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
time_out[i] = overlap[i];
for(i = 0; i < nshort; i++)
{
- time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i], window_short_prev[i]);
- time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i], window_short[i]);
- time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i], window_short[i]);
- time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i], window_short[i]);
- if(i < trans)
- time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i], window_short[i]);
+ time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
+ time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
+ time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
+ time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
+ if (i < trans)
+ time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
}
/* window the second half and save as overlap for next frame */
for(i = 0; i < nshort; i++)
{
- if(i >= trans)
- overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i], window_short[i]);
- overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i], window_short[i]);
- overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i], window_short[i]);
- overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i], window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i], window_short[i]);
- overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i], window_short[nshort-1-i]);
+ if (i >= trans)
+ overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+ overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
+ overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
+ overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
+ overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
}
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
overlap[nflat_ls+nshort+i] = 0;
break;
case LONG_STOP_SEQUENCE:
/* perform iMDCT */
- imdct_long(fb, freq_in, transf_buf, 2 * nlong);
+ imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
/* construct first half window using padding with 1's and 0's */
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
time_out[i] = overlap[i];
- for(i = 0; i < nshort; i++)
- time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i], window_short_prev[i]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nshort; i++)
+ time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
/* window the second half and save as overlap for next frame */
- for(i = 0; i < nlong; i++)
- overlap[i] = MUL_F(transf_buf[nlong+i], window_long[nlong-1-i]);
- break;
+ for (i = 0; i < nlong; i++)
+ overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+ break;
}
#if 0
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
printf("%d\n", time_out[i]);
//printf("0x%.8X\n", time_out[i]);
@@ -351,19 +347,17 @@ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
- uint16_t nshort = frame_len / 8;
- uint16_t nflat_ls = (nlong - nshort) / 2;
+ uint16_t nshort = frame_len/8;
+ uint16_t nflat_ls = (nlong-nshort)/2;
assert(window_sequence != EIGHT_SHORT_SEQUENCE);
#ifdef LD_DEC
- if(object_type == LD)
+ if (object_type == LD)
{
window_long = fb->ld_window[window_shape];
window_long_prev = fb->ld_window[window_shape_prev];
- }
- else
- {
+ } else {
#endif
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
@@ -376,36 +370,36 @@ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
switch(window_sequence)
{
case ONLY_LONG_SEQUENCE:
- for(i = nlong - 1; i >= 0; i--)
+ for (i = nlong-1; i >= 0; i--)
{
windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
}
- mdct(fb, windowed_buf, out_mdct, 2 * nlong);
+ mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
case LONG_START_SEQUENCE:
- for(i = 0; i < nlong; i++)
+ for (i = 0; i < nlong; i++)
windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nlong] = in_data[i+nlong];
- for(i = 0; i < nshort; i++)
+ for (i = 0; i < nshort; i++)
windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nlong+nflat_ls+nshort] = 0;
- mdct(fb, windowed_buf, out_mdct, 2 * nlong);
+ mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
case LONG_STOP_SEQUENCE:
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
windowed_buf[i] = 0;
- for(i = 0; i < nshort; i++)
+ for (i = 0; i < nshort; i++)
windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
- for(i = 0; i < nlong; i++)
+ for (i = 0; i < nlong; i++)
windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
- mdct(fb, windowed_buf, out_mdct, 2 * nlong);
+ mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.h
index bddc2ab7f..de0149c97 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/filtbank.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,24 +36,24 @@ extern "C" {
#endif
- fb_info *filter_bank_init(uint16_t frame_len);
- void filter_bank_end(fb_info *fb);
+fb_info *filter_bank_init(uint16_t frame_len);
+void filter_bank_end(fb_info *fb);
#ifdef LTP_DEC
- void filter_bank_ltp(fb_info *fb,
- uint8_t window_sequence,
- uint8_t window_shape,
- uint8_t window_shape_prev,
- real_t *in_data,
- real_t *out_mdct,
- uint8_t object_type,
- uint16_t frame_len);
+void filter_bank_ltp(fb_info *fb,
+ uint8_t window_sequence,
+ uint8_t window_shape,
+ uint8_t window_shape_prev,
+ real_t *in_data,
+ real_t *out_mdct,
+ uint8_t object_type,
+ uint16_t frame_len);
#endif
- void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
- uint8_t window_shape_prev, real_t *freq_in,
- real_t *time_out, real_t *overlap,
- uint8_t object_type, uint16_t frame_len);
+void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+ uint8_t window_shape_prev, real_t *freq_in,
+ real_t *time_out, real_t *overlap,
+ uint8_t object_type, uint16_t frame_len);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/fixed.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/fixed.h
index f88986160..531583772 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/fixed.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/fixed.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -45,13 +45,13 @@ extern "C" {
#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
#define REAL_PRECISION (1 << REAL_BITS)
- /* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
+/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
#define FRAC_SIZE 32 /* frac is a 32 bit integer */
#define FRAC_BITS 31
#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
#define FRAC_MAX 0x7FFFFFFF
- typedef int32_t real_t;
+typedef int32_t real_t;
#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
@@ -65,105 +65,98 @@ extern "C" {
#if defined(_WIN32) && !defined(_WIN32_WCE)
- /* multiply with real shift */
- static INLINE real_t MUL_R(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- shrd eax, edx, REAL_BITS
- }
+/* multiply with real shift */
+static INLINE real_t MUL_R(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,REAL_BITS
}
+}
- /* multiply with coef shift */
- static INLINE real_t MUL_C(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- shrd eax, edx, COEF_BITS
- }
+/* multiply with coef shift */
+static INLINE real_t MUL_C(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,COEF_BITS
}
+}
- static INLINE real_t MUL_Q2(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- shrd eax, edx, Q2_BITS
- }
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,Q2_BITS
}
+}
- static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- shrd eax, edx, 6
- }
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,6
}
+}
- static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- shrd eax, edx, 23
- }
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,23
}
+}
#if 1
- static INLINE real_t _MulHigh(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- mov eax, edx
- }
+static INLINE real_t _MulHigh(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ mov eax,edx
}
+}
- /* multiply with fractional shift */
- static INLINE real_t MUL_F(real_t A, real_t B)
- {
- return _MulHigh(A, B) << (FRAC_SIZE - FRAC_BITS);
- }
+/* multiply with fractional shift */
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+ return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS);
+}
- /* Complex multiplication */
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2)) << (FRAC_SIZE - FRAC_BITS);
- *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2)) << (FRAC_SIZE - FRAC_BITS);
- }
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
+ *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
+}
#else
- static INLINE real_t MUL_F(real_t A, real_t B)
- {
- _asm
- {
- mov eax, A
- imul B
- shrd eax, edx, FRAC_BITS
- }
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,FRAC_BITS
}
+}
- /* Complex multiplication */
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
- *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
- }
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+}
#endif
#elif defined(__GNUC__) && defined (__arm__)
- /* taken from MAD */
+/* taken from MAD */
#define arm_mul(x, y, SCALEBITS) \
({ \
uint32_t __hi; \
@@ -179,77 +172,77 @@ extern "C" {
__result; \
})
- static INLINE real_t MUL_R(real_t A, real_t B)
- {
- return arm_mul(A, B, REAL_BITS);
- }
+static INLINE real_t MUL_R(real_t A, real_t B)
+{
+ return arm_mul(A, B, REAL_BITS);
+}
- static INLINE real_t MUL_C(real_t A, real_t B)
- {
- return arm_mul(A, B, COEF_BITS);
- }
+static INLINE real_t MUL_C(real_t A, real_t B)
+{
+ return arm_mul(A, B, COEF_BITS);
+}
- static INLINE real_t MUL_Q2(real_t A, real_t B)
- {
- return arm_mul(A, B, Q2_BITS);
- }
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+ return arm_mul(A, B, Q2_BITS);
+}
- static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
- {
- return arm_mul(A, B, 6);
- }
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+ return arm_mul(A, B, 6);
+}
- static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
- {
- return arm_mul(A, B, 23);
- }
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+ return arm_mul(A, B, 23);
+}
- static INLINE real_t _MulHigh(real_t x, real_t y)
- {
- uint32_t __lo;
- uint32_t __hi;
- asm("smull\t%0, %1, %2, %3"
- : "=&r"(__lo), "=&r"(__hi)
- : "%r"(x), "r"(y)
- : "cc");
- return __hi;
- }
+static INLINE real_t _MulHigh(real_t x, real_t y)
+{
+ uint32_t __lo;
+ uint32_t __hi;
+ asm("smull\t%0, %1, %2, %3"
+ : "=&r"(__lo),"=&r"(__hi)
+ : "%r"(x),"r"(y)
+ : "cc");
+ return __hi;
+}
- static INLINE real_t MUL_F(real_t A, real_t B)
- {
- return _MulHigh(A, B) << (FRAC_SIZE - FRAC_BITS);
- }
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+ return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS);
+}
- /* Complex multiplication */
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- int32_t tmp, yt1, yt2;
- asm("smull %0, %1, %4, %6\n\t"
- "smlal %0, %1, %5, %7\n\t"
- "rsb %3, %4, #0\n\t"
- "smull %0, %2, %5, %6\n\t"
- "smlal %0, %2, %3, %7"
- : "=&r"(tmp), "=&r"(yt1), "=&r"(yt2), "=r"(x1)
- : "3"(x1), "r"(x2), "r"(c1), "r"(c2)
- : "cc");
- *y1 = yt1 << (FRAC_SIZE - FRAC_BITS);
- *y2 = yt2 << (FRAC_SIZE - FRAC_BITS);
- }
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ int32_t tmp, yt1, yt2;
+ asm("smull %0, %1, %4, %6\n\t"
+ "smlal %0, %1, %5, %7\n\t"
+ "rsb %3, %4, #0\n\t"
+ "smull %0, %2, %5, %6\n\t"
+ "smlal %0, %2, %3, %7"
+ : "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1)
+ : "3" (x1), "r" (x2), "r" (c1), "r" (c2)
+ : "cc" );
+ *y1 = yt1 << (FRAC_SIZE-FRAC_BITS);
+ *y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
+}
#else
- /* multiply with real shift */
-#define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
- /* multiply with coef shift */
-#define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
- /* multiply with fractional shift */
+ /* multiply with real shift */
+ #define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
+ /* multiply with coef shift */
+ #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
+ /* multiply with fractional shift */
#if defined(_WIN32_WCE) && defined(_ARM_)
- /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
- static INLINE real_t MUL_F(real_t A, real_t B)
- {
- return _MulHigh(A, B) << (32 - FRAC_BITS);
- }
+ /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
+ static INLINE real_t MUL_F(real_t A, real_t B)
+ {
+ return _MulHigh(A,B) << (32-FRAC_BITS);
+ }
#else
#ifdef __BFIN__
#define _MulHigh(X,Y) ({ int __xxo; \
@@ -268,21 +261,21 @@ extern "C" {
"%0 = (a0 += a1);\n\t" \
: "=d" (__xxo) : "d" (X), "d" (Y) : "A0","A1"); __xxo; })
#else
-#define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
-#define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
+ #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
+ #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
#endif
#endif
-#define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
-#define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
-#define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
-
- /* Complex multiplication */
- static INLINE void ComplexMult(real_t *y1, real_t *y2,
- real_t x1, real_t x2, real_t c1, real_t c2)
- {
- *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2)) << (FRAC_SIZE - FRAC_BITS);
- *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2)) << (FRAC_SIZE - FRAC_BITS);
- }
+ #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
+ #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
+ #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
+ *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
+}
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/hcr.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/hcr.c
index 5df0ae8f1..9df593ff3 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/hcr.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/hcr.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,15 +37,15 @@
#include "specrec.h"
#include "huffman.h"
-/* ISO/IEC 14496-3/Amd.1
- * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR)
+/* ISO/IEC 14496-3/Amd.1
+ * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR)
*
- * HCR devides the spectral data in known fixed size segments, and
- * sorts it by the importance of the data. The importance is firstly
- * the (lower) position in the spectrum, and secondly the largest
- * value in the used codebook.
+ * HCR devides the spectral data in known fixed size segments, and
+ * sorts it by the importance of the data. The importance is firstly
+ * the (lower) position in the spectrum, and secondly the largest
+ * value in the used codebook.
* The most important data is written at the start of each segment
- * (at known positions), the remaining data is interleaved inbetween,
+ * (at known positions), the remaining data is interleaved inbetween,
* with the writing direction alternating.
* Data length is not increased.
*/
@@ -60,23 +60,21 @@
#define VCB11_FIRST 16
#define VCB11_LAST 31
-static const uint8_t PreSortCB_STD[NUM_CB] =
-{ 11, 9, 7, 5, 3, 1};
+static const uint8_t PreSortCB_STD[NUM_CB] =
+ { 11, 9, 7, 5, 3, 1};
-static const uint8_t PreSortCB_ER[NUM_CB_ER] =
-{ 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
+static const uint8_t PreSortCB_ER[NUM_CB_ER] =
+ { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
/* 8.5.3.3.2 Derivation of segment width */
-static const uint8_t maxCwLen[MAX_CB] = {
- 0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
- 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41
-};
+static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
+ 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
#define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword)
/* bit-twiddling helpers */
-static const uint8_t S[] = {1, 2, 4, 8, 16};
+static const uint8_t S[] = {1, 2, 4, 8, 16};
static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
typedef struct
@@ -90,11 +88,11 @@ typedef struct
/* rewind and reverse */
/* 32 bit version */
static uint32_t rewrev_word(uint32_t v, const uint8_t len)
-{
+{
/* 32 bit reverse */
- v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
- v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
- v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
+ v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
+ v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
+ v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
@@ -106,33 +104,31 @@ static uint32_t rewrev_word(uint32_t v, const uint8_t len)
/* 64 bit version */
static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
-{
- if(len <= 32)
- {
+{
+ if (len <= 32) {
*hi = 0;
*lo = rewrev_word(*lo, len);
- }
- else
+ } else
{
uint32_t t = *hi, v = *lo;
/* double 32 bit reverse */
- v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
- t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]);
- v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
- t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]);
- v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
- t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]);
+ v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
+ t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]);
+ v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
+ t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]);
+ v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
+ t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]);
v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]);
- v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
+ v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]);
/* last 32<>32 bit swap is implicit below */
-
+
/* shift off low bits (this is really only one 64 bit shift) */
*lo = (t >> (64 - len)) | (v << (len - 32));
- *hi = v >> (64 - len);
+ *hi = v >> (64 - len);
}
}
@@ -140,7 +136,7 @@ static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
/* bits_t version */
static void rewrev_bits(bits_t *bits)
{
- if(bits->len == 0) return;
+ if (bits->len == 0) return;
rewrev_lword(&bits->bufb, &bits->bufa, bits->len);
}
@@ -150,24 +146,22 @@ static void concat_bits(bits_t *b, bits_t *a)
{
uint32_t bl, bh, al, ah;
- if(a->len == 0) return;
+ if (a->len == 0) return;
al = a->bufa;
ah = a->bufb;
-
- if(b->len > 32)
+
+ if (b->len > 32)
{
/* maskoff superfluous high b bits */
bl = b->bufa;
- bh = b->bufb & ((1 << (b->len - 32)) - 1);
+ bh = b->bufb & ((1 << (b->len-32)) - 1);
/* left shift a b->len bits */
ah = al << (b->len - 32);
al = 0;
- }
- else
- {
+ } else {
bl = b->bufa & ((1 << (b->len)) - 1);
- bh = 0;
+ bh = 0;
ah = (ah << (b->len)) | (al >> (32 - b->len));
al = al << b->len;
}
@@ -178,18 +172,17 @@ static void concat_bits(bits_t *b, bits_t *a)
b->len += a->len;
}
-
+
static uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
{
/* only want spectral data CB's */
- if((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
+ if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
{
- if(this_CB < ESC_HCB)
+ if (this_CB < ESC_HCB)
{
/* normal codebook pairs */
return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1));
- }
- else
+ } else
{
/* escape codebook */
return (this_sec_CB == this_CB);
@@ -197,22 +190,20 @@ static uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
}
return 0;
}
-
+
static void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld)
{
segment->len = segwidth;
- if(segwidth > 32)
- {
- segment->bufb = faad_getbits(ld, segwidth - 32);
- segment->bufa = faad_getbits(ld, 32);
+ if (segwidth > 32)
+ {
+ segment->bufb = faad_getbits(ld, segwidth - 32);
+ segment->bufa = faad_getbits(ld, 32);
- }
- else
- {
+ } else {
segment->bufa = faad_getbits(ld, segwidth);
- segment->bufb = 0;
- }
+ segment->bufb = 0;
+ }
}
static void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb)
@@ -223,11 +214,11 @@ static void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp,
codeword[index].bits.len = 0;
}
-uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics,
-bitfile *ld, int16_t *spectral_data)
-{
+uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics,
+ bitfile *ld, int16_t *spectral_data)
+{
uint16_t PCWs_done;
- uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
+ uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
codeword_t codeword[512];
bits_t segment[512];
@@ -235,28 +226,28 @@ bitfile *ld, int16_t *spectral_data)
uint16_t sp_offset[8];
uint16_t g, i, sortloop, set, bitsread;
uint16_t bitsleft, codewordsleft;
- uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB;
-
- const uint16_t nshort = hDecoder->frameLength / 8;
+ uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB;
+
+ const uint16_t nshort = hDecoder->frameLength/8;
const uint16_t sp_data_len = ics->length_of_reordered_spectral_data;
-
+
const uint8_t *PreSortCb;
/* no data (e.g. silence) */
- if(sp_data_len == 0)
+ if (sp_data_len == 0)
return 0;
/* since there is spectral data, at least one codeword has nonzero length */
- if(ics->length_of_longest_codeword == 0)
+ if (ics->length_of_longest_codeword == 0)
return 10;
- if(sp_data_len < ics->length_of_longest_codeword)
- return 10;
+ if (sp_data_len < ics->length_of_longest_codeword)
+ return 10;
sp_offset[0] = 0;
- for(g = 1; g < ics->num_window_groups; g++)
+ for (g = 1; g < ics->num_window_groups; g++)
{
- sp_offset[g] = sp_offset[g-1] + nshort * ics->window_group_length[g-1];
+ sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
}
PCWs_done = 0;
@@ -265,181 +256,173 @@ bitfile *ld, int16_t *spectral_data)
bitsread = 0;
/* VCB11 code books in use */
- if(hDecoder->aacSectionDataResilienceFlag)
+ if (hDecoder->aacSectionDataResilienceFlag)
{
PreSortCb = PreSortCB_ER;
last_CB = NUM_CB_ER;
- }
- else
+ } else
{
PreSortCb = PreSortCB_STD;
last_CB = NUM_CB;
}
-
+
/* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */
- for(sortloop = 0; sortloop < last_CB; sortloop++)
+ for (sortloop = 0; sortloop < last_CB; sortloop++)
{
/* select codebook to process this pass */
this_CB = PreSortCb[sortloop];
-
+
/* loop over sfbs */
- for(sfb = 0; sfb < ics->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* loop over all in this sfb, 4 lines per loop */
- for(w_idx = 0; 4 * w_idx < (min(ics->swb_offset[sfb+1], ics->swb_offset_max) - ics->swb_offset[sfb]); w_idx++)
+ for (w_idx = 0; 4*w_idx < (min(ics->swb_offset[sfb+1], ics->swb_offset_max) - ics->swb_offset[sfb]); w_idx++)
{
for(g = 0; g < ics->num_window_groups; g++)
{
- for(i = 0; i < ics->num_sec[g]; i++)
+ for (i = 0; i < ics->num_sec[g]; i++)
{
/* check whether sfb used here is the one we want to process */
- if((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
- {
+ if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
+ {
/* check whether codebook used here is the one we want to process */
this_sec_CB = ics->sect_cb[g][i];
-
- if(is_good_cb(this_CB, this_sec_CB))
+
+ if (is_good_cb(this_CB, this_sec_CB))
{
/* precalculate some stuff */
uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb];
uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
- uint16_t group_cws_count = (4 * ics->window_group_length[g]) / inc;
+ uint16_t group_cws_count = (4*ics->window_group_length[g])/inc;
uint8_t segwidth = segmentWidth(this_sec_CB);
- uint16_t cws;
+ uint16_t cws;
- /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */
- for(cws = 0; (cws < group_cws_count) && ((cws + w_idx * group_cws_count) < sect_sfb_size); cws++)
+ /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */
+ for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++)
{
- uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx * group_cws_count);
+ uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count);
/* read and decode PCW */
- if(!PCWs_done)
- {
+ if (!PCWs_done)
+ {
/* read in normal segments */
- if(bitsread + segwidth <= sp_data_len)
- {
- read_segment(&segment[numberOfSegments], segwidth, ld);
+ if (bitsread + segwidth <= sp_data_len)
+ {
+ read_segment(&segment[numberOfSegments], segwidth, ld);
bitsread += segwidth;
-
- huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);
+
+ huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);
/* keep leftover bits */
rewrev_bits(&segment[numberOfSegments]);
numberOfSegments++;
- }
- else
- {
+ } else {
/* remaining stuff after last segment, we unfortunately couldn't read
this in earlier because it might not fit in 64 bits. since we already
decoded (and removed) the PCW it is now guaranteed to fit */
- if(bitsread < sp_data_len)
- {
- const uint8_t additional_bits = sp_data_len - bitsread;
+ if (bitsread < sp_data_len)
+ {
+ const uint8_t additional_bits = sp_data_len - bitsread;
- read_segment(&segment[numberOfSegments], additional_bits, ld);
+ read_segment(&segment[numberOfSegments], additional_bits, ld);
segment[numberOfSegments].len += segment[numberOfSegments-1].len;
- rewrev_bits(&segment[numberOfSegments]);
+ rewrev_bits(&segment[numberOfSegments]);
- if(segment[numberOfSegments-1].len > 32)
+ if (segment[numberOfSegments-1].len > 32)
{
- segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb +
- showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
- segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
- showbits_hcr(&segment[numberOfSegments-1], 32);
- }
- else
- {
- segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
- showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
+ segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb +
+ showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
+ segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
+ showbits_hcr(&segment[numberOfSegments-1], 32);
+ } else {
+ segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
+ showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb;
- }
+ }
segment[numberOfSegments-1].len += additional_bits;
}
bitsread = sp_data_len;
PCWs_done = 1;
- fill_in_codeword(codeword, 0, sp, this_sec_CB);
+ fill_in_codeword(codeword, 0, sp, this_sec_CB);
}
- }
- else
- {
- fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);
+ } else {
+ fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);
}
numberOfCodewords++;
- }
+ }
}
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
}
- if(numberOfSegments == 0)
- return 10;
+ if (numberOfSegments == 0)
+ return 10;
- numberOfSets = numberOfCodewords / numberOfSegments;
+ numberOfSets = numberOfCodewords / numberOfSegments;
/* step 2: decode nonPCWs */
- for(set = 1; set <= numberOfSets; set++)
+ for (set = 1; set <= numberOfSets; set++)
{
uint16_t trial;
- for(trial = 0; trial < numberOfSegments; trial++)
+ for (trial = 0; trial < numberOfSegments; trial++)
{
uint16_t codewordBase;
- for(codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
+ for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
{
const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments;
- const uint16_t codeword_idx = codewordBase + set * numberOfSegments - numberOfSegments;
+ const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments;
/* data up */
- if(codeword_idx >= numberOfCodewords - numberOfSegments) break;
+ if (codeword_idx >= numberOfCodewords - numberOfSegments) break;
- if(!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
+ if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
{
uint8_t tmplen;
- if(codeword[codeword_idx].bits.len != 0)
- concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);
-
+ if (codeword[codeword_idx].bits.len != 0)
+ concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);
+
tmplen = segment[segment_idx].len;
- if(huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
- &spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
+ if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
+ &spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
{
codeword[codeword_idx].decoded = 1;
- }
- else
- {
+ } else
+ {
codeword[codeword_idx].bits = segment[segment_idx];
- codeword[codeword_idx].bits.len = tmplen;
+ codeword[codeword_idx].bits.len = tmplen;
}
-
+
}
}
}
- for(i = 0; i < numberOfSegments; i++)
+ for (i = 0; i < numberOfSegments; i++)
rewrev_bits(&segment[i]);
}
#if 0 // Seems to give false errors
- bitsleft = 0;
-
- for(i = 0; i < numberOfSegments && !bitsleft; i++)
+ bitsleft = 0;
+
+ for (i = 0; i < numberOfSegments && !bitsleft; i++)
bitsleft += segment[i].len;
- if(bitsleft) return 10;
+ if (bitsleft) return 10;
codewordsleft = 0;
- for(i = 0; (i < numberOfCodewords - numberOfSegments) && (!codewordsleft); i++)
- if(!codeword[i].decoded)
- codewordsleft++;
+ for (i = 0; (i < numberOfCodewords - numberOfSegments) && (!codewordsleft); i++)
+ if (!codeword[i].decoded)
+ codewordsleft++;
- if(codewordsleft) return 10;
+ if (codewordsleft) return 10;
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.c
index c261c9e28..e2656c089 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -59,13 +59,13 @@ int8_t huffman_scale_factor(bitfile *ld)
{
uint16_t offset = 0;
- while(hcb_sf[offset][1])
+ while (hcb_sf[offset][1])
{
uint8_t b = faad_get1bit(ld
- DEBUGVAR(1, 255, "huffman_scale_factor()"));
+ DEBUGVAR(1,255,"huffman_scale_factor()"));
offset += hcb_sf[offset][b];
- if(offset > 240)
+ if (offset > 240)
{
/* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */
return -1;
@@ -76,23 +76,19 @@ int8_t huffman_scale_factor(bitfile *ld)
}
-hcb *hcb_table[] =
-{
+hcb *hcb_table[] = {
0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1
};
-hcb_2_quad *hcb_2_quad_table[] =
-{
+hcb_2_quad *hcb_2_quad_table[] = {
0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0
};
-hcb_2_pair *hcb_2_pair_table[] =
-{
+hcb_2_pair *hcb_2_pair_table[] = {
0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2
};
-hcb_bin_pair *hcb_bin_table[] =
-{
+hcb_bin_pair *hcb_bin_table[] = {
0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0
};
@@ -101,8 +97,8 @@ uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
/* defines whether a huffman codebook is unsigned or not */
/* Table 4.6.2 */
uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
- /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- };
+ /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
@@ -112,12 +108,12 @@ static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
{
uint8_t i;
- for(i = 0; i < len; i++)
+ for (i = 0; i < len; i++)
{
if(sp[i])
{
if(faad_get1bit(ld
- DEBUGVAR(1, 5, "huffman_sign_bits(): sign bit")) & 1)
+ DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1)
{
sp[i] = -sp[i];
}
@@ -129,35 +125,33 @@ static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
{
uint8_t neg, i;
int16_t j;
- int16_t off;
+ int16_t off;
- if(sp < 0)
+ if (sp < 0)
{
- if(sp != -16)
+ if (sp != -16)
return sp;
neg = 1;
- }
- else
- {
- if(sp != 16)
+ } else {
+ if (sp != 16)
return sp;
neg = 0;
}
- for(i = 4; ; i++)
+ for (i = 4; ; i++)
{
- if(faad_get1bit(ld
- DEBUGVAR(1, 6, "huffman_getescape(): escape size")) == 0)
+ if (faad_get1bit(ld
+ DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0)
{
break;
}
}
off = (int16_t)faad_getbits(ld, i
- DEBUGVAR(1, 9, "huffman_getescape(): escape"));
+ DEBUGVAR(1,9,"huffman_getescape(): escape"));
- j = off | (1 << i);
- if(neg)
+ j = off | (1<<i);
+ if (neg)
j = -j;
return j;
@@ -173,19 +167,17 @@ static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp)
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
- if(extra_bits)
+ if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
faad_flushbits(ld, hcbN[cb]);
offset += (uint16_t)faad_showbits(ld, extra_bits);
faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]);
- }
- else
- {
+ } else {
faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits);
}
- if(offset > hcb_2_quad_table_size[cb])
+ if (offset > hcb_2_quad_table_size[cb])
{
/* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset,
hcb_2_quad_table_size[cb]); */
@@ -218,19 +210,17 @@ static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
- if(extra_bits)
+ if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
faad_flushbits(ld, hcbN[cb]);
offset += (uint16_t)faad_showbits(ld, extra_bits);
faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]);
- }
- else
- {
+ } else {
faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits);
}
- if(offset > hcb_2_pair_table_size[cb])
+ if (offset > hcb_2_pair_table_size[cb])
{
/* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset,
hcb_2_pair_table_size[cb]); */
@@ -255,14 +245,14 @@ static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint16_t offset = 0;
- while(!hcb3[offset].is_leaf)
+ while (!hcb3[offset].is_leaf)
{
uint8_t b = faad_get1bit(ld
- DEBUGVAR(1, 255, "huffman_spectral_data():3"));
+ DEBUGVAR(1,255,"huffman_spectral_data():3"));
offset += hcb3[offset].data[b];
}
- if(offset > hcb_bin_table_size[cb])
+ if (offset > hcb_bin_table_size[cb])
{
/* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
hcb_bin_table_size[cb]); */
@@ -289,14 +279,14 @@ static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint16_t offset = 0;
- while(!hcb_bin_table[cb][offset].is_leaf)
+ while (!hcb_bin_table[cb][offset].is_leaf)
{
uint8_t b = faad_get1bit(ld
- DEBUGVAR(1, 255, "huffman_spectral_data():9"));
+ DEBUGVAR(1,255,"huffman_spectral_data():9"));
offset += hcb_bin_table[cb][offset].data[b];
}
- if(offset > hcb_bin_table_size[cb])
+ if (offset > hcb_bin_table_size[cb])
{
/* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
hcb_bin_table_size[cb]); */
@@ -320,25 +310,24 @@ static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
static int16_t huffman_codebook(uint8_t i)
{
static const uint32_t data = 16428320;
- if(i == 0) return (int16_t)(data >> 16) & 0xFFFF;
+ if (i == 0) return (int16_t)(data >> 16) & 0xFFFF;
else return (int16_t)data & 0xFFFF;
}
static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
{
- static const uint16_t vcb11_LAV_tab[] =
- {
+ static const uint16_t vcb11_LAV_tab[] = {
16, 31, 47, 63, 95, 127, 159, 191, 223,
255, 319, 383, 511, 767, 1023, 2047
};
uint16_t max = 0;
- if(cb < 16 || cb > 31)
+ if (cb < 16 || cb > 31)
return;
max = vcb11_LAV_tab[cb - 16];
- if((abs(sp[0]) > max) || (abs(sp[1]) > max))
+ if ((abs(sp[0]) > max) || (abs(sp[1]) > max))
{
sp[0] = 0;
sp[1] = 0;
@@ -347,7 +336,7 @@ static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
{
- switch(cb)
+ switch (cb)
{
case 1: /* 2-step method for data quadruples */
case 2:
@@ -366,13 +355,10 @@ uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
case 8: /* 2-step method for data pairs */
case 10:
return huffman_2step_pair_sign(cb, ld, sp);
- case 12:
- {
+ case 12: {
uint8_t err = huffman_2step_pair(11, ld, sp);
- sp[0] = huffman_codebook(0);
- sp[1] = huffman_codebook(1);
- return err;
- }
+ sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1);
+ return err; }
case 11:
{
uint8_t err = huffman_2step_pair_sign(11, ld, sp);
@@ -382,22 +368,8 @@ uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
}
#ifdef ERROR_RESILIENCE
/* VCB11 uses codebook 11 */
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- case 29:
- case 30:
- case 31:
+ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+ case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
{
uint8_t err = huffman_2step_pair_sign(11, ld, sp);
sp[0] = huffman_getescape(ld, sp[0]);
@@ -434,7 +406,7 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
uint8_t i, vcb11 = 0;
- switch(cb)
+ switch (cb)
{
case 1: /* 2-step method for data quadruples */
case 2:
@@ -444,16 +416,14 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
- if(extra_bits)
+ if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
- if(flushbits_hcr(ld, hcbN[cb])) return -1;
+ if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
offset += (uint16_t)showbits_hcr(ld, extra_bits);
- if(flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb])) return -1;
- }
- else
- {
- if(flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits)) return -1;
+ if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1;
+ } else {
+ if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1;
}
sp[0] = hcb_2_quad_table[cb][offset].x;
@@ -466,45 +436,29 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
case 8:
case 10:
case 11:
- /* VCB11 uses codebook 11 */
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- case 29:
- case 30:
- case 31:
-
- if(cb >= 16)
+ /* VCB11 uses codebook 11 */
+ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+ case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+
+ if (cb >= 16)
{
/* store the virtual codebook */
vcb11 = cb;
cb = 11;
}
-
+
cw = showbits_hcr(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
- if(extra_bits)
+ if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
- if(flushbits_hcr(ld, hcbN[cb])) return -1;
+ if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
offset += (uint16_t)showbits_hcr(ld, extra_bits);
- if(flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb])) return -1;
- }
- else
- {
- if(flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits)) return -1;
+ if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1;
+ } else {
+ if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1;
}
sp[0] = hcb_2_pair_table[cb][offset].x;
sp[1] = hcb_2_pair_table[cb][offset].y;
@@ -512,11 +466,11 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
case 3: /* binary search for data quadruples */
- while(!hcb3[offset].is_leaf)
+ while (!hcb3[offset].is_leaf)
{
uint8_t b;
-
- if(get1bit_hcr(ld, &b)) return -1;
+
+ if ( get1bit_hcr(ld, &b) ) return -1;
offset += hcb3[offset].data[b];
}
@@ -531,11 +485,11 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
case 7:
case 9:
- while(!hcb_bin_table[cb][offset].is_leaf)
+ while (!hcb_bin_table[cb][offset].is_leaf)
{
uint8_t b;
-
- if(get1bit_hcr(ld, &b)) return -1;
+
+ if (get1bit_hcr(ld, &b) ) return -1;
offset += hcb_bin_table[cb][offset].data[b];
}
@@ -545,60 +499,59 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
break;
}
- /* decode sign bits */
- if(unsigned_cb[cb])
+ /* decode sign bits */
+ if (unsigned_cb[cb])
{
for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
{
if(sp[i])
{
- uint8_t b;
- if(get1bit_hcr(ld, &b)) return -1;
- if(b != 0)
- {
+ uint8_t b;
+ if ( get1bit_hcr(ld, &b) ) return -1;
+ if (b != 0) {
sp[i] = -sp[i];
}
- }
+ }
}
}
/* decode huffman escape bits */
- if((cb == ESC_HCB) || (cb >= 16))
+ if ((cb == ESC_HCB) || (cb >= 16))
{
uint8_t k;
- for(k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
- if((sp[k] == 16) || (sp[k] == -16))
+ if ((sp[k] == 16) || (sp[k] == -16))
{
uint8_t neg, i;
int32_t j;
uint32_t off;
- neg = (sp[k] < 0) ? 1 : 0;
+ neg = (sp[k] < 0) ? 1 : 0;
- for(i = 4; ; i++)
+ for (i = 4; ; i++)
{
uint8_t b;
- if(get1bit_hcr(ld, &b))
+ if (get1bit_hcr(ld, &b))
return -1;
- if(b == 0)
+ if (b == 0)
break;
}
- if(getbits_hcr(ld, i, &off))
+ if (getbits_hcr(ld, i, &off))
return -1;
- j = off + (1 << i);
+ j = off + (1<<i);
sp[k] = (int16_t)((neg) ? -j : j);
}
}
- if(vcb11 != 0)
+ if (vcb11 != 0)
{
/* check LAV (Largest Absolute Value) */
/* this finds errors in the ESCAPE signal */
vcb11_check_LAV(vcb11, sp);
}
- }
+ }
return ld->len;
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.h
index 3eaa9fe39..f8bcb237e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/huffman.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,10 +35,10 @@
extern "C" {
#endif
- int8_t huffman_scale_factor(bitfile *ld);
- uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
+int8_t huffman_scale_factor(bitfile *ld);
+uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
#ifdef ERROR_RESILIENCE
- int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
+int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
#endif
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.c
index 4ff883828..70027ba2f 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -48,17 +48,15 @@ static void flt_round(float32_t *pf)
tmp &= (uint32_t)0xffff0000;
tmp1 = tmp;
/* round 1/2 lsb toward infinity */
- if(flg)
+ if (flg)
{
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
tmp |= (uint32_t)0x00010000; /* insert 1 lsb */
tmp2 = tmp; /* add 1 lsb and elided one */
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
-
+
*pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
- }
- else
- {
+ } else {
*pf = *(float32_t*)&tmp;
}
}
@@ -68,7 +66,7 @@ static int16_t quant_pred(float32_t x)
int16_t q;
uint32_t *tmp = (uint32_t*)&x;
- q = (int16_t)(*tmp >> 16);
+ q = (int16_t)(*tmp>>16);
return q;
}
@@ -77,7 +75,7 @@ static float32_t inv_quant_pred(int16_t q)
{
float32_t x;
uint32_t *tmp = (uint32_t*)&x;
- *tmp = ((uint32_t)q) << 16;
+ *tmp = ((uint32_t)q)<<16;
return x;
}
@@ -87,7 +85,7 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t
uint16_t tmp;
int16_t i, j;
real_t dr1;
- float32_t predictedvalue;
+ float32_t predictedvalue;
real_t e0, e1;
real_t k1, k2;
@@ -107,13 +105,11 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t
tmp = state->VAR[0];
j = (tmp >> 7);
i = tmp & 0x7f;
- if(j >= 128)
+ if (j >= 128)
{
j -= 128;
k1 = COR[0] * exp_table[j] * mnt_table[i];
- }
- else
- {
+ } else {
k1 = REAL_CONST(0);
}
#else
@@ -123,12 +119,10 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t
real_t c = COR[0];
real_t v = VAR[0];
float32_t tmp;
- if(c == 0 || v <= 1)
+ if (c == 0 || v <= 1)
{
k1 = 0;
- }
- else
- {
+ } else {
tmp = B / v;
flt_round(&tmp);
k1 = c * tmp;
@@ -136,19 +130,17 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t
}
#endif
- if(pred)
+ if (pred)
{
#if 1
tmp = state->VAR[1];
j = (tmp >> 7);
i = tmp & 0x7f;
- if(j >= 128)
+ if (j >= 128)
{
j -= 128;
k2 = COR[1] * exp_table[j] * mnt_table[i];
- }
- else
- {
+ } else {
k2 = REAL_CONST(0);
}
#else
@@ -157,34 +149,32 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t
real_t c = COR[1];
real_t v = VAR[1];
float32_t tmp;
- if(c == 0 || v <= 1)
+ if (c == 0 || v <= 1)
{
k2 = 0;
- }
- else
- {
+ } else {
tmp = B / v;
flt_round(&tmp);
k2 = c * tmp;
}
#endif
- predictedvalue = k1 * r[0] + k2 * r[1];
+ predictedvalue = k1*r[0] + k2*r[1];
flt_round(&predictedvalue);
*output = input + predictedvalue;
}
/* calculate new state data */
e0 = *output;
- e1 = e0 - k1 * r[0];
- dr1 = k1 * e0;
+ e1 = e0 - k1*r[0];
+ dr1 = k1*e0;
- VAR[0] = ALPHA * VAR[0] + 0.5f * (r[0] * r[0] + e0 * e0);
- COR[0] = ALPHA * COR[0] + r[0] * e0;
- VAR[1] = ALPHA * VAR[1] + 0.5f * (r[1] * r[1] + e1 * e1);
- COR[1] = ALPHA * COR[1] + r[1] * e1;
+ VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0);
+ COR[0] = ALPHA*COR[0] + r[0]*e0;
+ VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1);
+ COR[1] = ALPHA*COR[1] + r[1]*e1;
- r[1] = A * (r[0] - dr1);
+ r[1] = A * (r[0]-dr1);
r[0] = A * e0;
state->r[0] = quant_pred(r[0]);
@@ -211,21 +201,21 @@ void pns_reset_pred_state(ic_stream *ics, pred_state *state)
uint16_t i, offs, offs2;
/* prediction only for long blocks */
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
return;
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
- for(b = 0; b < ics->window_group_length[g]; b++)
+ for (b = 0; b < ics->window_group_length[g]; b++)
{
- for(sfb = 0; sfb < ics->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
- if(is_noise(ics, g, sfb))
+ if (is_noise(ics, g, sfb))
{
offs = ics->swb_offset[sfb];
offs2 = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
- for(i = offs; i < offs2; i++)
+ for (i = offs; i < offs2; i++)
reset_pred_state(&state[i]);
}
}
@@ -237,7 +227,7 @@ void reset_all_predictors(pred_state *state, uint16_t frame_len)
{
uint16_t i;
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
reset_pred_state(&state[i]);
}
@@ -248,30 +238,28 @@ void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint8_t sfb;
uint16_t bin;
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
reset_all_predictors(state, frame_len);
- }
- else
- {
- for(sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
+ } else {
+ for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
- for(bin = low; bin < high; bin++)
+ for (bin = low; bin < high; bin++)
{
ic_predict(&state[bin], spec[bin], &spec[bin],
- (ics->predictor_data_present && ics->pred.prediction_used[sfb]));
+ (ics->predictor_data_present && ics->pred.prediction_used[sfb]));
}
}
- if(ics->predictor_data_present)
+ if (ics->predictor_data_present)
{
- if(ics->pred.predictor_reset)
+ if (ics->pred.predictor_reset)
{
- for(bin = ics->pred.predictor_reset_group_number - 1;
- bin < frame_len; bin += 30)
+ for (bin = ics->pred.predictor_reset_group_number - 1;
+ bin < frame_len; bin += 30)
{
reset_pred_state(&state[bin]);
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.h
index e990036b8..e69cd114e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ic_predict.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -41,210 +41,208 @@ extern "C" {
#define A REAL_CONST(0.953125)
- void pns_reset_pred_state(ic_stream *ics, pred_state *state);
- void reset_all_predictors(pred_state *state, uint16_t frame_len);
- void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
- uint16_t frame_len, uint8_t sf_index);
+void pns_reset_pred_state(ic_stream *ics, pred_state *state);
+void reset_all_predictors(pred_state *state, uint16_t frame_len);
+void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
+ uint16_t frame_len, uint8_t sf_index);
- ALIGN static const real_t mnt_table[128] =
- {
- COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
- COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
- COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
- COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
- COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
- COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
- COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
- COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
- COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
- COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
- COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
- COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
- COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
- COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
- COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
- COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
- COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
- COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
- COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
- COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
- COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
- COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
- COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
- COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
- COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
- COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
- COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
- COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
- COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
- COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
- COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
- COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
- COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
- COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
- COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
- COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
- COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
- COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
- COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
- COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
- COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
- COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
- COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
- COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
- COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
- COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
- COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
- COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
- COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
- COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
- COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
- COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
- COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
- COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
- COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
- COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
- COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
- COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
- COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
- COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
- COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
- COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
- COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
- COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
- };
+ALIGN static const real_t mnt_table[128] = {
+ COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
+ COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
+ COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
+ COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
+ COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
+ COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
+ COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
+ COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
+ COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
+ COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
+ COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
+ COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
+ COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
+ COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
+ COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
+ COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
+ COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
+ COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
+ COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
+ COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
+ COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
+ COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
+ COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
+ COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
+ COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
+ COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
+ COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
+ COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
+ COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
+ COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
+ COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
+ COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
+ COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
+ COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
+ COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
+ COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
+ COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
+ COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
+ COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
+ COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
+ COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
+ COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
+ COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
+ COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
+ COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
+ COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
+ COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
+ COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
+ COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
+ COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
+ COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
+ COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
+ COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
+ COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
+ COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
+ COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
+ COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
+ COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
+ COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
+ COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
+ COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
+ COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
+ COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
+ COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
+};
- ALIGN static const real_t exp_table[128] =
- {
- COEF_CONST(0.50000000000000000000000000000000000000000000000000),
- COEF_CONST(0.25000000000000000000000000000000000000000000000000),
- COEF_CONST(0.12500000000000000000000000000000000000000000000000),
- COEF_CONST(0.06250000000000000000000000000000000000000000000000),
- COEF_CONST(0.03125000000000000000000000000000000000000000000000),
- COEF_CONST(0.01562500000000000000000000000000000000000000000000),
- COEF_CONST(0.00781250000000000000000000000000000000000000000000),
- COEF_CONST(0.00390625000000000000000000000000000000000000000000),
- COEF_CONST(0.00195312500000000000000000000000000000000000000000),
- COEF_CONST(0.00097656250000000000000000000000000000000000000000),
- COEF_CONST(0.00048828125000000000000000000000000000000000000000),
- COEF_CONST(0.00024414062500000000000000000000000000000000000000),
- COEF_CONST(0.00012207031250000000000000000000000000000000000000),
- COEF_CONST(0.00006103515625000000000000000000000000000000000000),
- COEF_CONST(0.00003051757812500000000000000000000000000000000000),
- COEF_CONST(0.00001525878906250000000000000000000000000000000000),
- COEF_CONST(0.00000762939453125000000000000000000000000000000000),
- COEF_CONST(0.00000381469726562500000000000000000000000000000000),
- COEF_CONST(0.00000190734863281250000000000000000000000000000000),
- COEF_CONST(0.00000095367431640625000000000000000000000000000000),
- COEF_CONST(0.00000047683715820312500000000000000000000000000000),
- COEF_CONST(0.00000023841857910156250000000000000000000000000000),
- COEF_CONST(0.00000011920928955078125000000000000000000000000000),
- COEF_CONST(0.00000005960464477539062500000000000000000000000000),
- COEF_CONST(0.00000002980232238769531300000000000000000000000000),
- COEF_CONST(0.00000001490116119384765600000000000000000000000000),
- COEF_CONST(0.00000000745058059692382810000000000000000000000000),
- COEF_CONST(0.00000000372529029846191410000000000000000000000000),
- COEF_CONST(0.00000000186264514923095700000000000000000000000000),
- COEF_CONST(0.00000000093132257461547852000000000000000000000000),
- COEF_CONST(0.00000000046566128730773926000000000000000000000000),
- COEF_CONST(0.00000000023283064365386963000000000000000000000000),
- COEF_CONST(0.00000000011641532182693481000000000000000000000000),
- COEF_CONST(0.00000000005820766091346740700000000000000000000000),
- COEF_CONST(0.00000000002910383045673370400000000000000000000000),
- COEF_CONST(0.00000000001455191522836685200000000000000000000000),
- COEF_CONST(0.00000000000727595761418342590000000000000000000000),
- COEF_CONST(0.00000000000363797880709171300000000000000000000000),
- COEF_CONST(0.00000000000181898940354585650000000000000000000000),
- COEF_CONST(0.00000000000090949470177292824000000000000000000000),
- COEF_CONST(0.00000000000045474735088646412000000000000000000000),
- COEF_CONST(0.00000000000022737367544323206000000000000000000000),
- COEF_CONST(0.00000000000011368683772161603000000000000000000000),
- COEF_CONST(0.00000000000005684341886080801500000000000000000000),
- COEF_CONST(0.00000000000002842170943040400700000000000000000000),
- COEF_CONST(0.00000000000001421085471520200400000000000000000000),
- COEF_CONST(0.00000000000000710542735760100190000000000000000000),
- COEF_CONST(0.00000000000000355271367880050090000000000000000000),
- COEF_CONST(0.00000000000000177635683940025050000000000000000000),
- COEF_CONST(0.00000000000000088817841970012523000000000000000000),
- COEF_CONST(0.00000000000000044408920985006262000000000000000000),
- COEF_CONST(0.00000000000000022204460492503131000000000000000000),
- COEF_CONST(0.00000000000000011102230246251565000000000000000000),
- COEF_CONST(0.00000000000000005551115123125782700000000000000000),
- COEF_CONST(0.00000000000000002775557561562891400000000000000000),
- COEF_CONST(0.00000000000000001387778780781445700000000000000000),
- COEF_CONST(0.00000000000000000693889390390722840000000000000000),
- COEF_CONST(0.00000000000000000346944695195361420000000000000000),
- COEF_CONST(0.00000000000000000173472347597680710000000000000000),
- COEF_CONST(0.00000000000000000086736173798840355000000000000000),
- COEF_CONST(0.00000000000000000043368086899420177000000000000000),
- COEF_CONST(0.00000000000000000021684043449710089000000000000000),
- COEF_CONST(0.00000000000000000010842021724855044000000000000000),
- COEF_CONST(0.00000000000000000005421010862427522200000000000000),
- COEF_CONST(0.00000000000000000002710505431213761100000000000000),
- COEF_CONST(0.00000000000000000001355252715606880500000000000000),
- COEF_CONST(0.00000000000000000000677626357803440270000000000000),
- COEF_CONST(0.00000000000000000000338813178901720140000000000000),
- COEF_CONST(0.00000000000000000000169406589450860070000000000000),
- COEF_CONST(0.00000000000000000000084703294725430034000000000000),
- COEF_CONST(0.00000000000000000000042351647362715017000000000000),
- COEF_CONST(0.00000000000000000000021175823681357508000000000000),
- COEF_CONST(0.00000000000000000000010587911840678754000000000000),
- COEF_CONST(0.00000000000000000000005293955920339377100000000000),
- COEF_CONST(0.00000000000000000000002646977960169688600000000000),
- COEF_CONST(0.00000000000000000000001323488980084844300000000000),
- COEF_CONST(0.00000000000000000000000661744490042422140000000000),
- COEF_CONST(0.00000000000000000000000330872245021211070000000000),
- COEF_CONST(0.00000000000000000000000165436122510605530000000000),
- COEF_CONST(0.00000000000000000000000082718061255302767000000000),
- COEF_CONST(0.00000000000000000000000041359030627651384000000000),
- COEF_CONST(0.00000000000000000000000020679515313825692000000000),
- COEF_CONST(0.00000000000000000000000010339757656912846000000000),
- COEF_CONST(0.00000000000000000000000005169878828456423000000000),
- COEF_CONST(0.00000000000000000000000002584939414228211500000000),
- COEF_CONST(0.00000000000000000000000001292469707114105700000000),
- COEF_CONST(0.00000000000000000000000000646234853557052870000000),
- COEF_CONST(0.00000000000000000000000000323117426778526440000000),
- COEF_CONST(0.00000000000000000000000000161558713389263220000000),
- COEF_CONST(0.00000000000000000000000000080779356694631609000000),
- COEF_CONST(0.00000000000000000000000000040389678347315804000000),
- COEF_CONST(0.00000000000000000000000000020194839173657902000000),
- COEF_CONST(0.00000000000000000000000000010097419586828951000000),
- COEF_CONST(0.00000000000000000000000000005048709793414475600000),
- COEF_CONST(0.00000000000000000000000000002524354896707237800000),
- COEF_CONST(0.00000000000000000000000000001262177448353618900000),
- COEF_CONST(0.00000000000000000000000000000631088724176809440000),
- COEF_CONST(0.00000000000000000000000000000315544362088404720000),
- COEF_CONST(0.00000000000000000000000000000157772181044202360000),
- COEF_CONST(0.00000000000000000000000000000078886090522101181000),
- COEF_CONST(0.00000000000000000000000000000039443045261050590000),
- COEF_CONST(0.00000000000000000000000000000019721522630525295000),
- COEF_CONST(0.00000000000000000000000000000009860761315262647600),
- COEF_CONST(0.00000000000000000000000000000004930380657631323800),
- COEF_CONST(0.00000000000000000000000000000002465190328815661900),
- COEF_CONST(0.00000000000000000000000000000001232595164407830900),
- COEF_CONST(0.00000000000000000000000000000000616297582203915470),
- COEF_CONST(0.00000000000000000000000000000000308148791101957740),
- COEF_CONST(0.00000000000000000000000000000000154074395550978870),
- COEF_CONST(0.00000000000000000000000000000000077037197775489434),
- COEF_CONST(0.00000000000000000000000000000000038518598887744717),
- COEF_CONST(0.00000000000000000000000000000000019259299443872359),
- COEF_CONST(0.00000000000000000000000000000000009629649721936179),
- COEF_CONST(0.00000000000000000000000000000000004814824860968090),
- COEF_CONST(0.00000000000000000000000000000000002407412430484045),
- COEF_CONST(0.00000000000000000000000000000000001203706215242022),
- COEF_CONST(0.00000000000000000000000000000000000601853107621011),
- COEF_CONST(0.00000000000000000000000000000000000300926553810506),
- COEF_CONST(0.00000000000000000000000000000000000150463276905253),
- COEF_CONST(0.00000000000000000000000000000000000075231638452626),
- COEF_CONST(0.00000000000000000000000000000000000037615819226313),
- COEF_CONST(0.00000000000000000000000000000000000018807909613157),
- COEF_CONST(0.00000000000000000000000000000000000009403954806578),
- COEF_CONST(0.00000000000000000000000000000000000004701977403289),
- COEF_CONST(0.00000000000000000000000000000000000002350988701645),
- COEF_CONST(0.00000000000000000000000000000000000001175494350822),
- COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
- COEF_CONST(0.0)
- };
+ALIGN static const real_t exp_table[128] = {
+ COEF_CONST(0.50000000000000000000000000000000000000000000000000),
+ COEF_CONST(0.25000000000000000000000000000000000000000000000000),
+ COEF_CONST(0.12500000000000000000000000000000000000000000000000),
+ COEF_CONST(0.06250000000000000000000000000000000000000000000000),
+ COEF_CONST(0.03125000000000000000000000000000000000000000000000),
+ COEF_CONST(0.01562500000000000000000000000000000000000000000000),
+ COEF_CONST(0.00781250000000000000000000000000000000000000000000),
+ COEF_CONST(0.00390625000000000000000000000000000000000000000000),
+ COEF_CONST(0.00195312500000000000000000000000000000000000000000),
+ COEF_CONST(0.00097656250000000000000000000000000000000000000000),
+ COEF_CONST(0.00048828125000000000000000000000000000000000000000),
+ COEF_CONST(0.00024414062500000000000000000000000000000000000000),
+ COEF_CONST(0.00012207031250000000000000000000000000000000000000),
+ COEF_CONST(0.00006103515625000000000000000000000000000000000000),
+ COEF_CONST(0.00003051757812500000000000000000000000000000000000),
+ COEF_CONST(0.00001525878906250000000000000000000000000000000000),
+ COEF_CONST(0.00000762939453125000000000000000000000000000000000),
+ COEF_CONST(0.00000381469726562500000000000000000000000000000000),
+ COEF_CONST(0.00000190734863281250000000000000000000000000000000),
+ COEF_CONST(0.00000095367431640625000000000000000000000000000000),
+ COEF_CONST(0.00000047683715820312500000000000000000000000000000),
+ COEF_CONST(0.00000023841857910156250000000000000000000000000000),
+ COEF_CONST(0.00000011920928955078125000000000000000000000000000),
+ COEF_CONST(0.00000005960464477539062500000000000000000000000000),
+ COEF_CONST(0.00000002980232238769531300000000000000000000000000),
+ COEF_CONST(0.00000001490116119384765600000000000000000000000000),
+ COEF_CONST(0.00000000745058059692382810000000000000000000000000),
+ COEF_CONST(0.00000000372529029846191410000000000000000000000000),
+ COEF_CONST(0.00000000186264514923095700000000000000000000000000),
+ COEF_CONST(0.00000000093132257461547852000000000000000000000000),
+ COEF_CONST(0.00000000046566128730773926000000000000000000000000),
+ COEF_CONST(0.00000000023283064365386963000000000000000000000000),
+ COEF_CONST(0.00000000011641532182693481000000000000000000000000),
+ COEF_CONST(0.00000000005820766091346740700000000000000000000000),
+ COEF_CONST(0.00000000002910383045673370400000000000000000000000),
+ COEF_CONST(0.00000000001455191522836685200000000000000000000000),
+ COEF_CONST(0.00000000000727595761418342590000000000000000000000),
+ COEF_CONST(0.00000000000363797880709171300000000000000000000000),
+ COEF_CONST(0.00000000000181898940354585650000000000000000000000),
+ COEF_CONST(0.00000000000090949470177292824000000000000000000000),
+ COEF_CONST(0.00000000000045474735088646412000000000000000000000),
+ COEF_CONST(0.00000000000022737367544323206000000000000000000000),
+ COEF_CONST(0.00000000000011368683772161603000000000000000000000),
+ COEF_CONST(0.00000000000005684341886080801500000000000000000000),
+ COEF_CONST(0.00000000000002842170943040400700000000000000000000),
+ COEF_CONST(0.00000000000001421085471520200400000000000000000000),
+ COEF_CONST(0.00000000000000710542735760100190000000000000000000),
+ COEF_CONST(0.00000000000000355271367880050090000000000000000000),
+ COEF_CONST(0.00000000000000177635683940025050000000000000000000),
+ COEF_CONST(0.00000000000000088817841970012523000000000000000000),
+ COEF_CONST(0.00000000000000044408920985006262000000000000000000),
+ COEF_CONST(0.00000000000000022204460492503131000000000000000000),
+ COEF_CONST(0.00000000000000011102230246251565000000000000000000),
+ COEF_CONST(0.00000000000000005551115123125782700000000000000000),
+ COEF_CONST(0.00000000000000002775557561562891400000000000000000),
+ COEF_CONST(0.00000000000000001387778780781445700000000000000000),
+ COEF_CONST(0.00000000000000000693889390390722840000000000000000),
+ COEF_CONST(0.00000000000000000346944695195361420000000000000000),
+ COEF_CONST(0.00000000000000000173472347597680710000000000000000),
+ COEF_CONST(0.00000000000000000086736173798840355000000000000000),
+ COEF_CONST(0.00000000000000000043368086899420177000000000000000),
+ COEF_CONST(0.00000000000000000021684043449710089000000000000000),
+ COEF_CONST(0.00000000000000000010842021724855044000000000000000),
+ COEF_CONST(0.00000000000000000005421010862427522200000000000000),
+ COEF_CONST(0.00000000000000000002710505431213761100000000000000),
+ COEF_CONST(0.00000000000000000001355252715606880500000000000000),
+ COEF_CONST(0.00000000000000000000677626357803440270000000000000),
+ COEF_CONST(0.00000000000000000000338813178901720140000000000000),
+ COEF_CONST(0.00000000000000000000169406589450860070000000000000),
+ COEF_CONST(0.00000000000000000000084703294725430034000000000000),
+ COEF_CONST(0.00000000000000000000042351647362715017000000000000),
+ COEF_CONST(0.00000000000000000000021175823681357508000000000000),
+ COEF_CONST(0.00000000000000000000010587911840678754000000000000),
+ COEF_CONST(0.00000000000000000000005293955920339377100000000000),
+ COEF_CONST(0.00000000000000000000002646977960169688600000000000),
+ COEF_CONST(0.00000000000000000000001323488980084844300000000000),
+ COEF_CONST(0.00000000000000000000000661744490042422140000000000),
+ COEF_CONST(0.00000000000000000000000330872245021211070000000000),
+ COEF_CONST(0.00000000000000000000000165436122510605530000000000),
+ COEF_CONST(0.00000000000000000000000082718061255302767000000000),
+ COEF_CONST(0.00000000000000000000000041359030627651384000000000),
+ COEF_CONST(0.00000000000000000000000020679515313825692000000000),
+ COEF_CONST(0.00000000000000000000000010339757656912846000000000),
+ COEF_CONST(0.00000000000000000000000005169878828456423000000000),
+ COEF_CONST(0.00000000000000000000000002584939414228211500000000),
+ COEF_CONST(0.00000000000000000000000001292469707114105700000000),
+ COEF_CONST(0.00000000000000000000000000646234853557052870000000),
+ COEF_CONST(0.00000000000000000000000000323117426778526440000000),
+ COEF_CONST(0.00000000000000000000000000161558713389263220000000),
+ COEF_CONST(0.00000000000000000000000000080779356694631609000000),
+ COEF_CONST(0.00000000000000000000000000040389678347315804000000),
+ COEF_CONST(0.00000000000000000000000000020194839173657902000000),
+ COEF_CONST(0.00000000000000000000000000010097419586828951000000),
+ COEF_CONST(0.00000000000000000000000000005048709793414475600000),
+ COEF_CONST(0.00000000000000000000000000002524354896707237800000),
+ COEF_CONST(0.00000000000000000000000000001262177448353618900000),
+ COEF_CONST(0.00000000000000000000000000000631088724176809440000),
+ COEF_CONST(0.00000000000000000000000000000315544362088404720000),
+ COEF_CONST(0.00000000000000000000000000000157772181044202360000),
+ COEF_CONST(0.00000000000000000000000000000078886090522101181000),
+ COEF_CONST(0.00000000000000000000000000000039443045261050590000),
+ COEF_CONST(0.00000000000000000000000000000019721522630525295000),
+ COEF_CONST(0.00000000000000000000000000000009860761315262647600),
+ COEF_CONST(0.00000000000000000000000000000004930380657631323800),
+ COEF_CONST(0.00000000000000000000000000000002465190328815661900),
+ COEF_CONST(0.00000000000000000000000000000001232595164407830900),
+ COEF_CONST(0.00000000000000000000000000000000616297582203915470),
+ COEF_CONST(0.00000000000000000000000000000000308148791101957740),
+ COEF_CONST(0.00000000000000000000000000000000154074395550978870),
+ COEF_CONST(0.00000000000000000000000000000000077037197775489434),
+ COEF_CONST(0.00000000000000000000000000000000038518598887744717),
+ COEF_CONST(0.00000000000000000000000000000000019259299443872359),
+ COEF_CONST(0.00000000000000000000000000000000009629649721936179),
+ COEF_CONST(0.00000000000000000000000000000000004814824860968090),
+ COEF_CONST(0.00000000000000000000000000000000002407412430484045),
+ COEF_CONST(0.00000000000000000000000000000000001203706215242022),
+ COEF_CONST(0.00000000000000000000000000000000000601853107621011),
+ COEF_CONST(0.00000000000000000000000000000000000300926553810506),
+ COEF_CONST(0.00000000000000000000000000000000000150463276905253),
+ COEF_CONST(0.00000000000000000000000000000000000075231638452626),
+ COEF_CONST(0.00000000000000000000000000000000000037615819226313),
+ COEF_CONST(0.00000000000000000000000000000000000018807909613157),
+ COEF_CONST(0.00000000000000000000000000000000000009403954806578),
+ COEF_CONST(0.00000000000000000000000000000000000004701977403289),
+ COEF_CONST(0.00000000000000000000000000000000000002350988701645),
+ COEF_CONST(0.00000000000000000000000000000000000001175494350822),
+ COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
+ COEF_CONST(0.0)
+};
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/iq_table.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/iq_table.h
index a6a14549a..3cc2b8061 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/iq_table.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/iq_table.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,7 +36,7 @@ extern "C" {
#endif
- /* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */
+/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */
#ifndef FIXED_POINT
@@ -48,8201 +48,8201 @@ extern "C" {
#pragma warning(disable:4244)
#endif
- ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
- {
- 0,
- 1,
- 2.5198420997897464,
- 4.3267487109222245,
- 6.3496042078727974,
- 8.5498797333834844,
- 10.902723556992836,
- 13.390518279406722,
- 15.999999999999998,
- 18.720754407467133,
- 21.544346900318832,
- 24.463780996262464,
- 27.47314182127996,
- 30.567350940369842,
- 33.741991698453212,
- 36.993181114957046,
- 40.317473596635935,
- 43.711787041189993,
- 47.173345095760126,
- 50.699631325716943,
- 54.288352331898118,
- 57.937407704003519,
- 61.6448652744185,
- 65.408940536585988,
- 69.227979374755591,
- 73.100443455321638,
- 77.024897778591622,
- 80.999999999999986,
- 85.024491212518527,
- 89.097187944889555,
- 93.216975178615741,
- 97.382800224133163,
- 101.59366732596474,
- 105.84863288986224,
- 110.14680124343441,
- 114.4873208566006,
- 118.86938096020653,
- 123.29220851090024,
- 127.75506545836058,
- 132.25724627755247,
- 136.79807573413572,
- 141.37690685569191,
- 145.99311908523086,
- 150.6461165966291,
- 155.33532675434674,
- 160.06019870205279,
- 164.82020206673349,
- 169.61482576651861,
- 174.44357691188537,
- 179.30597979112557,
- 184.20157493201927,
- 189.12991823257562,
- 194.09058015449685,
- 199.08314497371677,
- 204.1072100829694,
- 209.16238534187647,
- 214.24829247050752,
- 219.36456448277784,
- 224.51084515641216,
- 229.6867885365223,
- 234.89205847013176,
- 240.12632816923249,
- 245.38927980018505,
- 250.68060409747261,
- 255.99999999999991,
- 261.34717430828869,
- 266.72184136106449,
- 272.12372272986045,
- 277.55254693037961,
- 283.0080491494619,
- 288.48997098659891,
- 293.99806020902247,
- 299.53207051947408,
- 305.0917613358298,
- 310.67689758182206,
- 316.28724948815585,
- 321.92259240337177,
- 327.58270661385535,
- 333.26737717243742,
- 338.97639373507025,
- 344.70955040510125,
- 350.46664558470013,
- 356.24748183302603,
- 362.05186573075139,
- 367.87960775058258,
- 373.73052213344511,
- 379.60442677002078,
- 385.50114308734607,
- 391.42049594019937,
- 397.36231350702371,
- 403.32642719014467,
- 409.31267152006262,
- 415.32088406360799,
- 421.35090533576471,
- 427.40257871497619,
- 433.4757503617617,
- 439.5702691404793,
- 445.68598654408271,
- 451.82275662172759,
- 457.98043590909128,
- 464.15888336127773,
- 470.35796028818726,
- 476.5775302922363,
- 482.81745920832043,
- 489.07761504591741,
- 495.35786793323581,
- 501.65809006331688,
- 507.97815564200368,
- 514.31794083769648,
- 520.67732373281672,
- 527.05618427690604,
- 533.45440424129174,
- 539.87186717525128,
- 546.30845836361505,
- 552.76406478574609,
- 559.23857507584194,
- 565.73187948450413,
- 572.24386984152341,
- 578.77443951983378,
- 585.32348340058843,
- 591.89089783931263,
- 598.47658063309257,
- 605.08043098876044,
- 611.70234949203643,
- 618.3422380775919,
- 624.99999999999977,
- 631.67553980553748,
- 638.36876330481164,
- 645.07957754617485,
- 651.80789078990415,
- 658.55361248311499,
- 665.31665323538357,
- 672.09692479505225,
- 678.8943400261943,
- 685.70881288621433,
- 692.540258404062,
- 699.38859265903977,
- 706.25373276018058,
- 713.13559682617972,
- 720.03410396586037,
- 726.94917425915435,
- 733.88072873858209,
- 740.82868937121543,
- 747.79297904110535,
- 754.77352153216191,
- 761.77024151147043,
- 768.78306451302956,
- 775.81191692189896,
- 782.85672595874246,
- 789.91741966475445,
- 796.99392688695798,
- 804.08617726386274,
- 811.19410121147098,
- 818.31762990962227,
- 825.45669528866563,
- 832.61123001644864,
- 839.78116748561604,
- 846.96644180120552,
- 854.16698776853514,
- 861.38274088137143,
- 868.61363731036977,
- 875.85961389178203,
- 883.12060811641959,
- 890.39655811886757,
- 897.68740266694181,
- 904.99308115138172,
- 912.31353357577188,
- 919.64870054668756,
- 926.99852326405619,
- 934.36294351172899,
- 941.74190364825859,
- 949.13534659787422,
- 956.54321584165211,
- 963.96545540887348,
- 971.40200986856541,
- 978.85282432122176,
- 986.31784439069588,
- 993.7970162162635,
- 1001.29028644485,
- 1008.797602223418,
- 1016.3189111915103,
- 1023.8541614739464,
- 1031.4033016736653,
- 1038.9662808647138,
- 1046.5430485853758,
- 1054.1335548314366,
- 1061.7377500495838,
- 1069.3555851309357,
- 1076.9870114046978,
- 1084.6319806319441,
- 1092.2904449995174,
- 1099.9623571140482,
- 1107.6476699960892,
- 1115.3463370743607,
- 1123.058312180106,
- 1130.7835495415541,
- 1138.5220037784854,
- 1146.273629896901,
- 1154.0383832837879,
- 1161.816219701986,
- 1169.607095285146,
- 1177.4109665327808,
- 1185.2277903054078,
- 1193.0575238197798,
- 1200.9001246442001,
- 1208.7555506939248,
- 1216.6237602266442,
- 1224.5047118380478,
- 1232.3983644574657,
- 1240.3046773435874,
- 1248.2236100802568,
- 1256.1551225723395,
- 1264.099175041662,
- 1272.0557280230228,
- 1280.0247423602691,
- 1288.0061792024444,
- 1295.9999999999995,
- 1304.006166501068,
- 1312.0246407478062,
- 1320.0553850727929,
- 1328.0983620954903,
- 1336.1535347187651,
- 1344.2208661254647,
- 1352.3003197750522,
- 1360.3918594002962,
- 1368.4954490040145,
- 1376.6110528558709,
- 1384.7386354892244,
- 1392.8781616980295,
- 1401.0295965337855,
- 1409.1929053025353,
- 1417.3680535619119,
- 1425.5550071182327,
- 1433.7537320236374,
- 1441.9641945732744,
- 1450.1863613025282,
- 1458.4201989842913,
- 1466.6656746262797,
- 1474.9227554683875,
- 1483.1914089800841,
- 1491.4716028578516,
- 1499.7633050226596,
- 1508.0664836174794,
- 1516.3811070048375,
- 1524.7071437644029,
- 1533.0445626906128,
- 1541.3933327903342,
- 1549.7534232805581,
- 1558.1248035861302,
- 1566.507443337515,
- 1574.9013123685909,
- 1583.3063807144795,
- 1591.7226186094069,
- 1600.1499964845941,
- 1608.58848496618,
- 1617.0380548731737,
- 1625.4986772154357,
- 1633.9703231916887,
- 1642.4529641875577,
- 1650.9465717736346,
- 1659.4511177035752,
- 1667.9665739122186,
- 1676.4929125137353,
- 1685.030105799801,
- 1693.5781262377957,
- 1702.136946469027,
- 1710.7065393069795,
- 1719.2868777355877,
- 1727.8779349075323,
- 1736.4796841425596,
- 1745.092098925825,
- 1753.7151529062583,
- 1762.3488198949503,
- 1770.9930738635628,
- 1779.6478889427597,
- 1788.3132394206564,
- 1796.9890997412947,
- 1805.6754445031333,
- 1814.3722484575621,
- 1823.0794865074322,
- 1831.7971337056094,
- 1840.5251652535437,
- 1849.2635564998579,
- 1858.0122829389563,
- 1866.7713202096493,
- 1875.5406440937966,
- 1884.3202305149687,
- 1893.110055537124,
- 1901.9100953633042,
- 1910.7203263343454,
- 1919.5407249276057,
- 1928.3712677557098,
- 1937.2119315653083,
- 1946.0626932358525,
- 1954.923529778386,
- 1963.79441833435,
- 1972.6753361744036,
- 1981.5662606972594,
- 1990.467169428533,
- 1999.3780400196069,
- 2008.2988502465078,
- 2017.2295780087982,
- 2026.1702013284819,
- 2035.1206983489212,
- 2044.0810473337688,
- 2053.0512266659125,
- 2062.0312148464309,
- 2071.0209904935646,
- 2080.0205323416958,
- 2089.0298192403443,
- 2098.0488301531714,
- 2107.0775441569995,
- 2116.115940440839,
- 2125.1639983049317,
- 2134.2216971597995,
- 2143.2890165253098,
- 2152.3659360297484,
- 2161.4524354089031,
- 2170.5484945051617,
- 2179.6540932666144,
- 2188.7692117461711,
- 2197.8938301006888,
- 2207.0279285901042,
- 2216.1714875765838,
- 2225.324487523676,
- 2234.4869089954782,
- 2243.6587326558101,
- 2252.8399392673982,
- 2262.0305096910702,
- 2271.2304248849537,
- 2280.4396659036897,
- 2289.6582138976523,
- 2298.8860501121762,
- 2308.1231558867926,
- 2317.3695126544767,
- 2326.6251019409005,
- 2335.8899053636933,
- 2345.1639046317132,
- 2354.4470815443233,
- 2363.7394179906792,
- 2373.0408959490205,
- 2382.3514974859731,
- 2391.6712047558558,
- 2400.9999999999991,
- 2410.3378655460651,
- 2419.6847838073813,
- 2429.0407372822747,
- 2438.4057085534191,
- 2447.7796802871858,
- 2457.1626352330004,
- 2466.5545562227112,
- 2475.9554261699564,
- 2485.3652280695474,
- 2494.7839449968492,
- 2504.2115601071737,
- 2513.6480566351788,
- 2523.0934178942675,
- 2532.5476272760025,
- 2542.0106682495189,
- 2551.482524360948,
- 2560.9631792328441,
- 2570.4526165636184,
- 2579.9508201269791,
- 2589.4577737713744,
- 2598.9734614194458,
- 2608.4978670674823,
- 2618.0309747848837,
- 2627.5727687136259,
- 2637.1232330677353,
- 2646.6823521327647,
- 2656.2501102652768,
- 2665.8264918923328,
- 2675.4114815109842,
- 2685.0050636877722,
- 2694.6072230582295,
- 2704.2179443263894,
- 2713.8372122642972,
- 2723.4650117115279,
- 2733.1013275747096,
- 2742.7461448270483,
- 2752.3994485078601,
- 2762.0612237221085,
- 2771.7314556399419,
- 2781.4101294962406,
- 2791.0972305901655,
- 2800.7927442847094,
- 2810.4966560062589,
- 2820.2089512441521,
- 2829.9296155502466,
- 2839.6586345384894,
- 2849.3959938844923,
- 2859.1416793251065,
- 2868.8956766580086,
- 2878.6579717412847,
- 2888.4285504930212,
- 2898.2073988908974,
- 2907.9945029717837,
- 2917.789848831344,
- 2927.5934226236377,
- 2937.4052105607311,
- 2947.2251989123079,
- 2957.0533740052865,
- 2966.8897222234368,
- 2976.734230007005,
- 2986.5868838523397,
- 2996.4476703115197,
- 3006.3165759919889,
- 3016.1935875561908,
- 3026.0786917212095,
- 3035.9718752584108,
- 3045.8731249930906,
- 3055.7824278041207,
- 3065.6997706236039,
- 3075.625140436528,
- 3085.5585242804245,
- 3095.4999092450298,
- 3105.4492824719491,
- 3115.4066311543256,
- 3125.3719425365089,
- 3135.3452039137287,
- 3145.3264026317715,
- 3155.3155260866592,
- 3165.3125617243295,
- 3175.3174970403229,
- 3185.3303195794679,
- 3195.35101693557,
- 3205.3795767511078,
- 3215.4159867169251,
- 3225.460234571929,
- 3235.5123081027928,
- 3245.5721951436558,
- 3255.63988357583,
- 3265.7153613275095,
- 3275.7986163734795,
- 3285.8896367348289,
- 3295.9884104786665,
- 3306.0949257178395,
- 3316.2091706106517,
- 3326.331133360588,
- 3336.4608022160378,
- 3346.5981654700231,
- 3356.7432114599264,
- 3366.8959285672249,
- 3377.0563052172211,
- 3387.2243298787821,
- 3397.3999910640764,
- 3407.5832773283128,
- 3417.7741772694862,
- 3427.9726795281199,
- 3438.1787727870123,
- 3448.3924457709873,
- 3458.6136872466445,
- 3468.8424860221107,
- 3479.0788309467976,
- 3489.3227109111554,
- 3499.5741148464344,
- 3509.8330317244445,
- 3520.0994505573185,
- 3530.3733603972751,
- 3540.6547503363886,
- 3550.9436095063534,
- 3561.239927078258,
- 3571.5436922623535,
- 3581.8548943078308,
- 3592.1735225025936,
- 3602.4995661730372,
- 3612.8330146838275,
- 3623.1738574376814,
- 3633.5220838751502,
- 3643.8776834744031,
- 3654.2406457510142,
- 3664.6109602577494,
- 3674.9886165843564,
- 3685.3736043573545,
- 3695.7659132398294,
- 3706.1655329312248,
- 3716.5724531671399,
- 3726.9866637191262,
- 3737.4081543944876,
- 3747.8369150360782,
- 3758.2729355221072,
- 3768.7162057659411,
- 3779.1667157159077,
- 3789.6244553551055,
- 3800.0894147012082,
- 3810.5615838062768,
- 3821.0409527565694,
- 3831.5275116723533,
- 3842.0212507077194,
- 3852.522160050396,
- 3863.0302299215673,
- 3873.5454505756893,
- 3884.0678123003108,
- 3894.5973054158922,
- 3905.1339202756285,
- 3915.6776472652732,
- 3926.2284768029604,
- 3936.7863993390338,
- 3947.3514053558706,
- 3957.9234853677135,
- 3968.5026299204969,
- 3979.0888295916798,
- 3989.6820749900776,
- 4000.2823567556948,
- 4010.8896655595613,
- 4021.5039921035655,
- 4032.1253271202945,
- 4042.7536613728694,
- 4053.3889856547858,
- 4064.0312907897551,
- 4074.6805676315448,
- 4085.3368070638221,
- 4095.9999999999982,
- 4106.6701373830711,
- 4117.347210185475,
- 4128.0312094089259,
- 4138.722126084268,
- 4149.4199512713267,
- 4160.1246760587583,
- 4170.8362915638982,
- 4181.5547889326181,
- 4192.2801593391769,
- 4203.0123939860741,
- 4213.7514841039101,
- 4224.4974209512384,
- 4235.2501958144258,
- 4246.0098000075095,
- 4256.7762248720574,
- 4267.549461777031,
- 4278.3295021186423,
- 4289.1163373202198,
- 4299.9099588320714,
- 4310.7103581313495,
- 4321.5175267219138,
- 4332.3314561342004,
- 4343.152137925088,
- 4353.9795636777671,
- 4364.8137250016052,
- 4375.6546135320223,
- 4386.5022209303588,
- 4397.3565388837469,
- 4408.2175591049827,
- 4419.0852733324018,
- 4429.9596733297531,
- 4440.8407508860728,
- 4451.7284978155603,
- 4462.6229059574571,
- 4473.5239671759227,
- 4484.4316733599126,
- 4495.3460164230582,
- 4506.2669883035496,
- 4517.1945809640119,
- 4528.1287863913894,
- 4539.069596596828,
- 4550.0170036155587,
- 4560.9709995067806,
- 4571.931576353546,
- 4582.898726262647,
- 4593.8724413645004,
- 4604.8527138130348,
- 4615.8395357855816,
- 4626.8328994827571,
- 4637.8327971283588,
- 4648.8392209692511,
- 4659.8521632752563,
- 4670.8716163390473,
- 4681.8975724760394,
- 4692.9300240242837,
- 4703.9689633443595,
- 4715.0143828192668,
- 4726.0662748543255,
- 4737.1246318770682,
- 4748.1894463371373,
- 4759.2607107061804,
- 4770.3384174777493,
- 4781.4225591671993,
- 4792.5131283115852,
- 4803.6101174695614,
- 4814.7135192212854,
- 4825.8233261683154,
- 4836.9395309335096,
- 4848.0621261609349,
- 4859.1911045157631,
- 4870.3264586841779,
- 4881.4681813732768,
- 4892.6162653109768,
- 4903.7707032459193,
- 4914.931487947375,
- 4926.0986122051509,
- 4937.2720688294967,
- 4948.4518506510112,
- 4959.637950520555,
- 4970.8303613091521,
- 4982.0290759079044,
- 4993.2340872278974,
- 5004.4453882001153,
- 5015.6629717753467,
- 5026.8868309241007,
- 5038.1169586365131,
- 5049.353347922266,
- 5060.5959918104927,
- 5071.8448833496996,
- 5083.1000156076734,
- 5094.3613816713996,
- 5105.6289746469747,
- 5116.9027876595246,
- 5128.18281385312,
- 5139.4690463906918,
- 5150.7614784539473,
- 5162.0601032432933,
- 5173.3649139777472,
- 5184.6759038948594,
- 5195.9930662506322,
- 5207.3163943194386,
- 5218.6458813939435,
- 5229.9815207850224,
- 5241.3233058216847,
- 5252.6712298509919,
- 5264.025286237983,
- 5275.3854683655954,
- 5286.7517696345885,
- 5298.1241834634639,
- 5309.5027032883945,
- 5320.887322563146,
- 5332.2780347589978,
- 5343.6748333646756,
- 5355.0777118862716,
- 5366.4866638471722,
- 5377.901682787985,
- 5389.3227622664635,
- 5400.749895857437,
- 5412.1830771527357,
- 5423.622299761123,
- 5435.067557308219,
- 5446.5188434364318,
- 5457.9761518048872,
- 5469.4394760893592,
- 5480.9088099821975,
- 5492.3841471922606,
- 5503.8654814448455,
- 5515.3528064816201,
- 5526.846116060552,
- 5538.3454039558474,
- 5549.8506639578736,
- 5561.3618898731029,
- 5572.8790755240361,
- 5584.4022147491451,
- 5595.9313014027975,
- 5607.4663293552012,
- 5619.0072924923297,
- 5630.5541847158656,
- 5642.1069999431284,
- 5653.665732107017,
- 5665.230375155943,
- 5676.8009230537655,
- 5688.3773697797333,
- 5699.9597093284156,
- 5711.5479357096474,
- 5723.1420429484588,
- 5734.7420250850209,
- 5746.347876174581,
- 5757.9595902874016,
- 5769.5771615087006,
- 5781.2005839385911,
- 5792.8298516920213,
- 5804.4649588987149,
- 5816.1058997031105,
- 5827.7526682643065,
- 5839.4052587559972,
- 5851.0636653664196,
- 5862.7278822982908,
- 5874.3979037687541,
- 5886.0737240093204,
- 5897.7553372658094,
- 5909.4427377982956,
- 5921.1359198810505,
- 5932.8348778024874,
- 5944.5396058651031,
- 5956.2500983854261,
- 5967.9663496939575,
- 5979.6883541351208,
- 5991.4161060672022,
- 6003.1495998623004,
- 6014.8888299062692,
- 6026.6337905986684,
- 6038.3844763527022,
- 6050.1408815951781,
- 6061.9030007664414,
- 6073.6708283203316,
- 6085.4443587241267,
- 6097.2235864584891,
- 6109.0085060174197,
- 6120.7991119081998,
- 6132.595398651345,
- 6144.3973607805519,
- 6156.2049928426459,
- 6168.0182893975361,
- 6179.8372450181578,
- 6191.6618542904307,
- 6203.4921118132024,
- 6215.3280121982016,
- 6227.1695500699925,
- 6239.0167200659189,
- 6250.8695168360628,
- 6262.7279350431891,
- 6274.5919693627056,
- 6286.4616144826068,
- 6298.3368651034316,
- 6310.2177159382172,
- 6322.1041617124456,
- 6333.9961971640032,
- 6345.8938170431311,
- 6357.7970161123785,
- 6369.7057891465583,
- 6381.6201309327007,
- 6393.5400362700075,
- 6405.4654999698032,
- 6417.3965168554978,
- 6429.3330817625329,
- 6441.2751895383453,
- 6453.2228350423138,
- 6465.176013145724,
- 6477.134718731716,
- 6489.0989466952469,
- 6501.0686919430445,
- 6513.0439493935628,
- 6525.0247139769417,
- 6537.010980634961,
- 6549.002744321001,
- 6560.9999999999973,
- 6573.0027426483985,
- 6585.0109672541284,
- 6597.0246688165371,
- 6609.0438423463656,
- 6621.0684828657004,
- 6633.0985854079354,
- 6645.134145017727,
- 6657.1751567509573,
- 6669.2216156746908,
- 6681.2735168671343,
- 6693.3308554176001,
- 6705.3936264264594,
- 6717.461825005108,
- 6729.535446275926,
- 6741.6144853722335,
- 6753.6989374382601,
- 6765.7887976290967,
- 6777.8840611106634,
- 6789.9847230596661,
- 6802.0907786635626,
- 6814.2022231205201,
- 6826.3190516393797,
- 6838.4412594396181,
- 6850.5688417513074,
- 6862.701793815083,
- 6874.840110882099,
- 6886.9837882139991,
- 6899.1328210828724,
- 6911.2872047712199,
- 6923.4469345719199,
- 6935.6120057881863,
- 6947.7824137335365,
- 6959.9581537317536,
- 6972.1392211168532,
- 6984.3256112330409,
- 6996.5173194346862,
- 7008.7143410862773,
- 7020.9166715623942,
- 7033.1243062476678,
- 7045.3372405367481,
- 7057.5554698342685,
- 7069.7789895548103,
- 7082.0077951228714,
- 7094.2418819728273,
- 7106.4812455489018,
- 7118.7258813051285,
- 7130.9757847053224,
- 7143.2309512230404,
- 7155.4913763415516,
- 7167.7570555538041,
- 7180.0279843623894,
- 7192.3041582795131,
- 7204.5855728269571,
- 7216.8722235360519,
- 7229.1641059476406,
- 7241.4612156120484,
- 7253.7635480890503,
- 7266.0710989478375,
- 7278.3838637669869,
- 7290.7018381344296,
- 7303.0250176474174,
- 7315.3533979124932,
- 7327.6869745454596,
- 7340.0257431713462,
- 7352.3696994243801,
- 7364.7188389479543,
- 7377.0731573945968,
- 7389.4326504259407,
- 7401.7973137126937,
- 7414.1671429346061,
- 7426.5421337804428,
- 7438.922281947951,
- 7451.3075831438346,
- 7463.6980330837177,
- 7476.0936274921214,
- 7488.4943621024304,
- 7500.9002326568652,
- 7513.3112349064522,
- 7525.7273646109943,
- 7538.1486175390446,
- 7550.5749894678729,
- 7563.0064761834419,
- 7575.4430734803736,
- 7587.8847771619248,
- 7600.3315830399597,
- 7612.7834869349153,
- 7625.24048467578,
- 7637.7025721000637,
- 7650.1697450537677,
- 7662.6419993913596,
- 7675.1193309757446,
- 7687.6017356782404,
- 7700.0892093785433,
- 7712.5817479647112,
- 7725.079347333125,
- 7737.5820033884729,
- 7750.0897120437139,
- 7762.6024692200581,
- 7775.1202708469355,
- 7787.6431128619733,
- 7800.1709912109645,
- 7812.7039018478481,
- 7825.2418407346768,
- 7837.7848038415968,
- 7850.3327871468155,
- 7862.8857866365806,
- 7875.4437983051539,
- 7888.006818154784,
- 7900.5748421956796,
- 7913.1478664459901,
- 7925.725886931772,
- 7938.3088996869719,
- 7950.8969007533951,
- 7963.4898861806851,
- 7976.0878520262959,
- 7988.6907943554688,
- 8001.2987092412086,
- 8013.911592764257,
- 8026.5294410130691,
- 8039.1522500837891,
- 8051.7800160802271,
- 8064.412735113835,
- 8077.0504033036796,
- 8089.6930167764222,
- 8102.3405716662946,
- 8114.9930641150731,
- 8127.6504902720571,
- 8140.3128462940449,
- 8152.9801283453098,
- 8165.6523325975786,
- 8178.3294552300049,
- 8191.0114924291529,
- 8203.6984403889655,
- 8216.3902953107463,
- 8229.0870534031419,
- 8241.7887108821069,
- 8254.4952639708936,
- 8267.2067089000211,
- 8279.9230419072574,
- 8292.6442592375952,
- 8305.3703571432306,
- 8318.101331883543,
- 8330.8371797250657,
- 8343.577896941475,
- 8356.3234798135582,
- 8369.0739246291978,
- 8381.8292276833508,
- 8394.5893852780209,
- 8407.3543937222421,
- 8420.1242493320569,
- 8432.8989484304948,
- 8445.6784873475499,
- 8458.4628624201578,
- 8471.2520699921806,
- 8484.0461064143838,
- 8496.8449680444082,
- 8509.6486512467636,
- 8522.4571523927953,
- 8535.270467860666,
- 8548.0885940353437,
- 8560.9115273085663,
- 8573.7392640788403,
- 8586.5718007514006,
- 8599.4091337382069,
- 8612.2512594579148,
- 8625.0981743358552,
- 8637.9498748040205,
- 8650.8063573010386,
- 8663.6676182721567,
- 8676.533654169225,
- 8689.4044614506638,
- 8702.2800365814601,
- 8715.1603760331418,
- 8728.0454762837508,
- 8740.9353338178389,
- 8753.8299451264356,
- 8766.7293067070332,
- 8779.6334150635721,
- 8792.5422667064158,
- 8805.4558581523324,
- 8818.3741859244819,
- 8831.2972465523908,
- 8844.2250365719356,
- 8857.1575525253265,
- 8870.0947909610859,
- 8883.0367484340295,
- 8895.9834215052524,
- 8908.934806742107,
- 8921.8909007181846,
- 8934.8517000132997,
- 8947.817201213471,
- 8960.7874009109,
- 8973.7622957039603,
- 8986.7418821971733,
- 8999.7261570011924,
- 9012.7151167327884,
- 9025.7087580148236,
- 9038.7070774762469,
- 9051.7100717520643,
- 9064.7177374833282,
- 9077.7300713171153,
- 9090.7470699065179,
- 9103.7687299106146,
- 9116.7950479944648,
- 9129.8260208290812,
- 9142.8616450914233,
- 9155.9019174643727,
- 9168.9468346367157,
- 9181.9963933031358,
- 9195.0505901641845,
- 9208.1094219262741,
- 9221.1728853016557,
- 9234.240977008405,
- 9247.3136937704076,
- 9260.3910323173386,
- 9273.472989384647,
- 9286.5595617135423,
- 9299.6507460509747,
- 9312.7465391496207,
- 9325.8469377678684,
- 9338.9519386698012,
- 9352.0615386251757,
- 9365.1757344094131,
- 9378.2945228035842,
- 9391.4179005943843,
- 9404.5458645741273,
- 9417.6784115407263,
- 9430.8155382976747,
- 9443.9572416540359,
- 9457.1035184244265,
- 9470.2543654290002,
- 9483.4097794934296,
- 9496.5697574488931,
- 9509.7342961320664,
- 9522.9033923850911,
- 9536.0770430555804,
- 9549.2552449965824,
- 9562.4379950665825,
- 9575.6252901294793,
- 9588.8171270545736,
- 9602.0135027165488,
- 9615.2144139954635,
- 9628.4198577767274,
- 9641.629830951093,
- 9654.844330414644,
- 9668.0633530687719,
- 9681.286895820167,
- 9694.5149555808002,
- 9707.7475292679192,
- 9720.9846138040157,
- 9734.2262061168276,
- 9747.4723031393187,
- 9760.7229018096641,
- 9773.9779990712323,
- 9787.2375918725811,
- 9800.5016771674327,
- 9813.7702519146696,
- 9827.0433130783094,
- 9840.3208576275028,
- 9853.602882536512,
- 9866.8893847846994,
- 9880.1803613565116,
- 9893.4758092414686,
- 9906.7757254341523,
- 9920.0801069341851,
- 9933.3889507462245,
- 9946.7022538799429,
- 9960.0200133500221,
- 9973.3422261761298,
- 9986.6688893829159,
- 9999.9999999999945,
- 10013.335555061929,
- 10026.675551608221,
- 10040.019986683301,
- 10053.368857336509,
- 10066.722160622081,
- 10080.079893599144,
- 10093.442053331697,
- 10106.808636888598,
- 10120.179641343551,
- 10133.555063775095,
- 10146.934901266595,
- 10160.31915090622,
- 10173.707809786936,
- 10187.100875006496,
- 10200.498343667417,
- 10213.900212876984,
- 10227.306479747222,
- 10240.717141394889,
- 10254.132194941467,
- 10267.551637513146,
- 10280.975466240814,
- 10294.40367826004,
- 10307.836270711066,
- 10321.273240738796,
- 10334.71458549278,
- 10348.160302127204,
- 10361.610387800878,
- 10375.064839677221,
- 10388.523654924258,
- 10401.986830714593,
- 10415.454364225412,
- 10428.926252638465,
- 10442.402493140049,
- 10455.883082921007,
- 10469.368019176709,
- 10482.85729910704,
- 10496.350919916393,
- 10509.848878813653,
- 10523.351173012188,
- 10536.857799729838,
- 10550.3687561889,
- 10563.884039616123,
- 10577.403647242685,
- 10590.927576304197,
- 10604.455824040679,
- 10617.988387696556,
- 10631.525264520642,
- 10645.066451766135,
- 10658.611946690598,
- 10672.161746555956,
- 10685.715848628475,
- 10699.274250178762,
- 10712.836948481747,
- 10726.403940816675,
- 10739.975224467091,
- 10753.550796720834,
- 10767.130654870027,
- 10780.714796211059,
- 10794.303218044579,
- 10807.895917675487,
- 10821.492892412922,
- 10835.094139570248,
- 10848.699656465047,
- 10862.309440419107,
- 10875.923488758415,
- 10889.541798813138,
- 10903.16436791762,
- 10916.791193410372,
- 10930.422272634056,
- 10944.05760293548,
- 10957.697181665582,
- 10971.341006179427,
- 10984.98907383619,
- 10998.641381999149,
- 11012.297928035676,
- 11025.958709317223,
- 11039.623723219316,
- 11053.292967121541,
- 11066.966438407539,
- 11080.64413446499,
- 11094.326052685608,
- 11108.012190465128,
- 11121.702545203296,
- 11135.397114303863,
- 11149.095895174571,
- 11162.798885227143,
- 11176.506081877278,
- 11190.217482544635,
- 11203.933084652828,
- 11217.652885629415,
- 11231.376882905886,
- 11245.105073917659,
- 11258.837456104062,
- 11272.574026908333,
- 11286.314783777601,
- 11300.059724162888,
- 11313.808845519083,
- 11327.562145304952,
- 11341.319620983111,
- 11355.081270020033,
- 11368.847089886023,
- 11382.617078055218,
- 11396.391232005579,
- 11410.169549218874,
- 11423.952027180676,
- 11437.738663380349,
- 11451.529455311042,
- 11465.324400469679,
- 11479.123496356951,
- 11492.926740477304,
- 11506.734130338931,
- 11520.545663453764,
- 11534.361337337466,
- 11548.181149509423,
- 11562.005097492724,
- 11575.83317881417,
- 11589.665391004253,
- 11603.501731597149,
- 11617.342198130715,
- 11631.186788146468,
- 11645.035499189589,
- 11658.888328808911,
- 11672.745274556904,
- 11686.606333989675,
- 11700.471504666955,
- 11714.340784152086,
- 11728.214170012021,
- 11742.091659817312,
- 11755.973251142101,
- 11769.858941564111,
- 11783.748728664636,
- 11797.642610028539,
- 11811.540583244237,
- 11825.442645903697,
- 11839.34879560242,
- 11853.259029939445,
- 11867.173346517333,
- 11881.091742942155,
- 11895.014216823492,
- 11908.940765774427,
- 11922.871387411526,
- 11936.806079354839,
- 11950.744839227897,
- 11964.687664657684,
- 11978.634553274653,
- 11992.585502712702,
- 12006.540510609168,
- 12020.499574604828,
- 12034.462692343877,
- 12048.429861473938,
- 12062.401079646032,
- 12076.376344514589,
- 12090.355653737433,
- 12104.339004975769,
- 12118.326395894188,
- 12132.317824160644,
- 12146.313287446457,
- 12160.312783426305,
- 12174.316309778205,
- 12188.323864183525,
- 12202.335444326955,
- 12216.351047896511,
- 12230.370672583531,
- 12244.394316082657,
- 12258.421976091831,
- 12272.453650312296,
- 12286.489336448574,
- 12300.529032208471,
- 12314.572735303058,
- 12328.620443446678,
- 12342.672154356922,
- 12356.727865754638,
- 12370.787575363909,
- 12384.851280912055,
- 12398.918980129623,
- 12412.990670750381,
- 12427.066350511306,
- 12441.146017152583,
- 12455.229668417589,
- 12469.317302052901,
- 12483.40891580827,
- 12497.50450743663,
- 12511.604074694078,
- 12525.707615339878,
- 12539.815127136444,
- 12553.926607849342,
- 12568.042055247275,
- 12582.161467102082,
- 12596.284841188726,
- 12610.41217528529,
- 12624.543467172971,
- 12638.678714636069,
- 12652.817915461985,
- 12666.961067441209,
- 12681.108168367316,
- 12695.259216036962,
- 12709.414208249869,
- 12723.573142808827,
- 12737.736017519681,
- 12751.902830191326,
- 12766.073578635704,
- 12780.248260667788,
- 12794.426874105588,
- 12808.609416770132,
- 12822.795886485468,
- 12836.986281078653,
- 12851.180598379744,
- 12865.378836221802,
- 12879.580992440871,
- 12893.787064875984,
- 12907.997051369144,
- 12922.210949765335,
- 12936.428757912496,
- 12950.650473661524,
- 12964.876094866273,
- 12979.105619383534,
- 12993.339045073039,
- 13007.576369797454,
- 13021.817591422368,
- 13036.062707816285,
- 13050.311716850629,
- 13064.564616399723,
- 13078.821404340792,
- 13093.082078553954,
- 13107.346636922217,
- 13121.615077331464,
- 13135.887397670458,
- 13150.163595830827,
- 13164.44366970706,
- 13178.727617196502,
- 13193.015436199352,
- 13207.307124618648,
- 13221.602680360265,
- 13235.902101332911,
- 13250.205385448118,
- 13264.512530620239,
- 13278.823534766434,
- 13293.138395806676,
- 13307.457111663734,
- 13321.779680263176,
- 13336.106099533356,
- 13350.436367405409,
- 13364.77048181325,
- 13379.108440693562,
- 13393.450241985796,
- 13407.795883632158,
- 13422.145363577607,
- 13436.498679769853,
- 13450.855830159346,
- 13465.216812699266,
- 13479.581625345529,
- 13493.950266056772,
- 13508.32273279435,
- 13522.699023522329,
- 13537.079136207483,
- 13551.463068819286,
- 13565.850819329906,
- 13580.2423857142,
- 13594.63776594971,
- 13609.036958016657,
- 13623.439959897927,
- 13637.846769579081,
- 13652.257385048335,
- 13666.67180429656,
- 13681.090025317284,
- 13695.512046106669,
- 13709.937864663521,
- 13724.367478989278,
- 13738.800887088004,
- 13753.238086966385,
- 13767.679076633727,
- 13782.123854101939,
- 13796.572417385545,
- 13811.024764501659,
- 13825.480893469998,
- 13839.94080231286,
- 13854.404489055134,
- 13868.871951724283,
- 13883.34318835034,
- 13897.818196965914,
- 13912.296975606168,
- 13926.779522308825,
- 13941.26583511416,
- 13955.755912064991,
- 13970.249751206682,
- 13984.747350587126,
- 13999.248708256751,
- 14013.753822268511,
- 14028.262690677873,
- 14042.775311542828,
- 14057.291682923867,
- 14071.811802883994,
- 14086.335669488704,
- 14100.863280805994,
- 14115.394634906341,
- 14129.92972986271,
- 14144.468563750548,
- 14159.01113464777,
- 14173.55744063476,
- 14188.107479794369,
- 14202.661250211901,
- 14217.218749975118,
- 14231.779977174227,
- 14246.344929901879,
- 14260.913606253163,
- 14275.486004325601,
- 14290.062122219146,
- 14304.641958036171,
- 14319.225509881464,
- 14333.812775862236,
- 14348.403754088098,
- 14362.998442671067,
- 14377.59683972556,
- 14392.198943368388,
- 14406.804751718748,
- 14421.414262898223,
- 14436.027475030774,
- 14450.64438624274,
- 14465.264994662828,
- 14479.889298422106,
- 14494.517295654005,
- 14509.148984494313,
- 14523.784363081166,
- 14538.423429555049,
- 14553.066182058781,
- 14567.712618737527,
- 14582.362737738777,
- 14597.016537212348,
- 14611.674015310382,
- 14626.33517018734,
- 14640.999999999993,
- 14655.668502907418,
- 14670.340677071003,
- 14685.016520654426,
- 14699.696031823671,
- 14714.379208746999,
- 14729.066049594967,
- 14743.756552540408,
- 14758.45071575843,
- 14773.148537426418,
- 14787.850015724018,
- 14802.555148833142,
- 14817.263934937961,
- 14831.976372224897,
- 14846.692458882624,
- 14861.41219310206,
- 14876.135573076363,
- 14890.862597000923,
- 14905.593263073371,
- 14920.327569493558,
- 14935.065514463557,
- 14949.807096187662,
- 14964.552312872382,
- 14979.301162726431,
- 14994.053643960735,
- 15008.809754788414,
- 15023.569493424788,
- 15038.332858087369,
- 15053.099846995858,
- 15067.870458372134,
- 15082.644690440264,
- 15097.422541426484,
- 15112.204009559202,
- 15126.989093068994,
- 15141.777790188597,
- 15156.570099152905,
- 15171.366018198967,
- 15186.165545565986,
- 15200.968679495301,
- 15215.775418230402,
- 15230.585760016909,
- 15245.399703102579,
- 15260.217245737298,
- 15275.038386173073,
- 15289.863122664035,
- 15304.691453466432,
- 15319.523376838621,
- 15334.358891041069,
- 15349.197994336346,
- 15364.040684989128,
- 15378.886961266177,
- 15393.736821436356,
- 15408.590263770609,
- 15423.447286541972,
- 15438.307888025554,
- 15453.172066498542,
- 15468.039820240196,
- 15482.91114753184,
- 15497.786046656869,
- 15512.664515900733,
- 15527.546553550939,
- 15542.432157897045,
- 15557.32132723066,
- 15572.214059845435,
- 15587.110354037064,
- 15602.010208103273,
- 15616.913620343823,
- 15631.820589060506,
- 15646.731112557136,
- 15661.645189139546,
- 15676.562817115593,
- 15691.483994795139,
- 15706.408720490062,
- 15721.336992514242,
- 15736.268809183561,
- 15751.204168815901,
- 15766.143069731135,
- 15781.085510251132,
- 15796.03148869974,
- 15810.981003402798,
- 15825.934052688119,
- 15840.890634885489,
- 15855.850748326673,
- 15870.814391345401,
- 15885.781562277361,
- 15900.752259460214,
- 15915.726481233565,
- 15930.704225938984,
- 15945.685491919978,
- 15960.670277522009,
- 15975.658581092481,
- 15990.65040098073,
- 16005.645735538035,
- 16020.644583117599,
- 16035.646942074556,
- 16050.652810765967,
- 16065.662187550806,
- 16080.675070789974,
- 16095.691458846273,
- 16110.711350084424,
- 16125.734742871053,
- 16140.761635574685,
- 16155.792026565747,
- 16170.825914216561,
- 16185.863296901338,
- 16200.904172996183,
- 16215.948540879079,
- 16230.996398929899,
- 16246.047745530386,
- 16261.102579064163,
- 16276.160897916721,
- 16291.22270047542,
- 16306.287985129484,
- 16321.356750269995,
- 16336.428994289896,
- 16351.504715583982,
- 16366.5839125489,
- 16381.666583583141,
- 16396.752727087041,
- 16411.842341462776,
- 16426.935425114363,
- 16442.031976447644,
- 16457.131993870298,
- 16472.235475791829,
- 16487.342420623561,
- 16502.452826778641,
- 16517.566692672033,
- 16532.684016720516,
- 16547.804797342676,
- 16562.929032958902,
- 16578.056721991394,
- 16593.18786286415,
- 16608.322454002962,
- 16623.460493835417,
- 16638.601980790896,
- 16653.746913300558,
- 16668.895289797354,
- 16684.047108716015,
- 16699.202368493046,
- 16714.361067566726,
- 16729.523204377107,
- 16744.688777366009,
- 16759.857784977012,
- 16775.030225655464,
- 16790.206097848466,
- 16805.385400004874,
- 16820.568130575302,
- 16835.754288012104,
- 16850.943870769381,
- 16866.136877302983,
- 16881.333306070494,
- 16896.53315553123,
- 16911.736424146249,
- 16926.943110378332,
- 16942.153212691992,
- 16957.366729553454,
- 16972.583659430682,
- 16987.804000793338,
- 17003.027752112816,
- 17018.254911862205,
- 17033.485478516312,
- 17048.719450551645,
- 17063.956826446421,
- 17079.197604680547,
- 17094.44178373563,
- 17109.689362094967,
- 17124.940338243552,
- 17140.194710668064,
- 17155.452477856852,
- 17170.713638299967,
- 17185.978190489128,
- 17201.246132917724,
- 17216.517464080825,
- 17231.792182475165,
- 17247.070286599141,
- 17262.351774952826,
- 17277.636646037936,
- 17292.924898357855,
- 17308.216530417623,
- 17323.511540723921,
- 17338.809927785089,
- 17354.111690111105,
- 17369.416826213594,
- 17384.725334605821,
- 17400.037213802683,
- 17415.352462320716,
- 17430.67107867809,
- 17445.993061394587,
- 17461.318408991636,
- 17476.647119992274,
- 17491.979192921168,
- 17507.314626304586,
- 17522.653418670423,
- 17537.995568548187,
- 17553.341074468986,
- 17568.689934965536,
- 17584.042148572156,
- 17599.397713824768,
- 17614.75662926089,
- 17630.118893419625,
- 17645.484504841683,
- 17660.853462069354,
- 17676.225763646511,
- 17691.601408118619,
- 17706.980394032718,
- 17722.362719937424,
- 17737.748384382936,
- 17753.137385921014,
- 17768.529723104999,
- 17783.92539448979,
- 17799.324398631856,
- 17814.726734089225,
- 17830.13239942148,
- 17845.541393189767,
- 17860.95371395678,
- 17876.369360286772,
- 17891.788330745527,
- 17907.210623900395,
- 17922.636238320254,
- 17938.065172575527,
- 17953.497425238176,
- 17968.932994881692,
- 17984.371880081104,
- 17999.814079412972,
- 18015.259591455371,
- 18030.708414787914,
- 18046.160547991731,
- 18061.615989649465,
- 18077.074738345284,
- 18092.536792664861,
- 18108.002151195393,
- 18123.470812525571,
- 18138.942775245599,
- 18154.418037947191,
- 18169.896599223546,
- 18185.37845766938,
- 18200.863611880886,
- 18216.352060455767,
- 18231.843801993204,
- 18247.338835093873,
- 18262.837158359936,
- 18278.338770395032,
- 18293.84366980429,
- 18309.351855194309,
- 18324.863325173166,
- 18340.378078350412,
- 18355.896113337069,
- 18371.417428745623,
- 18386.942023190033,
- 18402.469895285718,
- 18418.00104364955,
- 18433.53546689987,
- 18449.073163656474,
- 18464.614132540602,
- 18480.158372174956,
- 18495.705881183676,
- 18511.256658192357,
- 18526.810701828035,
- 18542.368010719183,
- 18557.928583495715,
- 18573.492418788985,
- 18589.059515231773,
- 18604.629871458303,
- 18620.203486104212,
- 18635.78035780658,
- 18651.360485203899,
- 18666.943866936086,
- 18682.53050164448,
- 18698.120387971841,
- 18713.713524562332,
- 18729.30991006154,
- 18744.909543116457,
- 18760.512422375479,
- 18776.118546488418,
- 18791.727914106479,
- 18807.340523882274,
- 18822.95637446981,
- 18838.575464524489,
- 18854.197792703111,
- 18869.823357663863,
- 18885.452158066328,
- 18901.08419257147,
- 18916.719459841639,
- 18932.357958540564,
- 18947.999687333362,
- 18963.644644886521,
- 18979.292829867907,
- 18994.944240946759,
- 19010.598876793687,
- 19026.256736080668,
- 19041.917817481048,
- 19057.582119669532,
- 19073.2496413222,
- 19088.920381116473,
- 19104.594337731145,
- 19120.271509846356,
- 19135.951896143604,
- 19151.635495305738,
- 19167.322306016948,
- 19183.012326962784,
- 19198.705556830122,
- 19214.401994307198,
- 19230.101638083579,
- 19245.804486850167,
- 19261.510539299208,
- 19277.219794124274,
- 19292.932250020265,
- 19308.647905683421,
- 19324.366759811302,
- 19340.088811102793,
- 19355.8140582581,
- 19371.542499978754,
- 19387.2741349676,
- 19403.008961928797,
- 19418.746979567823,
- 19434.488186591469,
- 19450.232581707827,
- 19465.980163626304,
- 19481.730931057613,
- 19497.484882713761,
- 19513.242017308068,
- 19529.002333555141,
- 19544.765830170898,
- 19560.532505872539,
- 19576.302359378566,
- 19592.075389408761,
- 19607.851594684209,
- 19623.630973927269,
- 19639.41352586159,
- 19655.199249212103,
- 19670.988142705017,
- 19686.780205067826,
- 19702.575435029288,
- 19718.373831319448,
- 19734.175392669615,
- 19749.980117812371,
- 19765.788005481569,
- 19781.599054412323,
- 19797.413263341008,
- 19813.230631005274,
- 19829.051156144014,
- 19844.874837497395,
- 19860.701673806827,
- 19876.531663814985,
- 19892.364806265789,
- 19908.201099904403,
- 19924.040543477258,
- 19939.883135732012,
- 19955.728875417579,
- 19971.577761284105,
- 19987.429792082985,
- 20003.284966566847,
- 20019.14328348956,
- 20035.004741606219,
- 20050.869339673161,
- 20066.737076447946,
- 20082.607950689362,
- 20098.481961157428,
- 20114.359106613385,
- 20130.239385819699,
- 20146.122797540058,
- 20162.009340539353,
- 20177.899013583716,
- 20193.791815440476,
- 20209.687744878182,
- 20225.586800666591,
- 20241.488981576669,
- 20257.394286380597,
- 20273.302713851754,
- 20289.214262764715,
- 20305.128931895277,
- 20321.046720020415,
- 20336.967625918318,
- 20352.891648368361,
- 20368.818786151114,
- 20384.749038048347,
- 20400.682402843009,
- 20416.618879319249,
- 20432.558466262391,
- 20448.501162458953,
- 20464.446966696629,
- 20480.395877764302,
- 20496.347894452025,
- 20512.303015551031,
- 20528.261239853735,
- 20544.22256615372,
- 20560.186993245738,
- 20576.15451992572,
- 20592.125144990758,
- 20608.098867239107,
- 20624.075685470198,
- 20640.055598484618,
- 20656.038605084115,
- 20672.024704071595,
- 20688.013894251126,
- 20704.006174427926,
- 20720.001543408373,
- 20735.999999999989,
- 20752.001543011454,
- 20768.006171252597,
- 20784.013883534382,
- 20800.024678668931,
- 20816.038555469506,
- 20832.055512750507,
- 20848.075549327474,
- 20864.098664017085,
- 20880.124855637161,
- 20896.154123006647,
- 20912.186464945626,
- 20928.221880275312,
- 20944.260367818049,
- 20960.301926397311,
- 20976.346554837684,
- 20992.394251964895,
- 21008.445016605787,
- 21024.498847588318,
- 21040.555743741574,
- 21056.615703895754,
- 21072.678726882168,
- 21088.744811533252,
- 21104.813956682538,
- 21120.886161164683,
- 21136.961423815443,
- 21153.039743471683,
- 21169.121118971379,
- 21185.205549153605,
- 21201.293032858535,
- 21217.383568927453,
- 21233.477156202731,
- 21249.573793527841,
- 21265.673479747358,
- 21281.776213706937,
- 21297.881994253334,
- 21313.990820234398,
- 21330.102690499054,
- 21346.21760389733,
- 21362.335559280327,
- 21378.456555500241,
- 21394.580591410333,
- 21410.707665864964,
- 21426.83777771956,
- 21442.970925830628,
- 21459.107109055756,
- 21475.246326253604,
- 21491.388576283895,
- 21507.533858007431,
- 21523.682170286087,
- 21539.833511982797,
- 21555.987881961566,
- 21572.145279087465,
- 21588.305702226615,
- 21604.469150246216,
- 21620.635622014521,
- 21636.805116400832,
- 21652.977632275521,
- 21669.153168510009,
- 21685.331723976764,
- 21701.513297549318,
- 21717.697888102244,
- 21733.885494511167,
- 21750.076115652759,
- 21766.269750404736,
- 21782.466397645861,
- 21798.666056255934,
- 21814.868725115801,
- 21831.074403107345,
- 21847.283089113484,
- 21863.494782018177,
- 21879.709480706417,
- 21895.927184064229,
- 21912.147890978667,
- 21928.371600337818,
- 21944.598311030797,
- 21960.828021947746,
- 21977.060731979829,
- 21993.296440019243,
- 22009.535144959198,
- 22025.77684569393,
- 22042.021541118691,
- 22058.269230129757,
- 22074.519911624411,
- 22090.773584500959,
- 22107.030247658717,
- 22123.289899998013,
- 22139.552540420187,
- 22155.818167827587,
- 22172.086781123569,
- 22188.358379212495,
- 22204.632960999726,
- 22220.910525391639,
- 22237.191071295601,
- 22253.474597619981,
- 22269.761103274148,
- 22286.050587168469,
- 22302.343048214312,
- 22318.638485324027,
- 22334.936897410968,
- 22351.23828338947,
- 22367.542642174871,
- 22383.849972683485,
- 22400.160273832618,
- 22416.473544540564,
- 22432.789783726603,
- 22449.108990310986,
- 22465.431163214958,
- 22481.75630136074,
- 22498.084403671528,
- 22514.415469071497,
- 22530.749496485802,
- 22547.086484840562,
- 22563.426433062879,
- 22579.769340080824,
- 22596.115204823436,
- 22612.464026220721,
- 22628.815803203655,
- 22645.170534704179,
- 22661.5282196552,
- 22677.888856990587,
- 22694.252445645168,
- 22710.618984554734,
- 22726.988472656034,
- 22743.360908886778,
- 22759.736292185622,
- 22776.114621492186,
- 22792.495895747044,
- 22808.880113891719,
- 22825.267274868678,
- 22841.657377621348,
- 22858.050421094096,
- 22874.446404232243,
- 22890.845325982053,
- 22907.247185290722,
- 22923.651981106406,
- 22940.059712378195,
- 22956.470378056114,
- 22972.883977091129,
- 22989.300508435153,
- 23005.719971041017,
- 23022.142363862498,
- 23038.567685854305,
- 23054.995935972078,
- 23071.427113172387,
- 23087.86121641273,
- 23104.298244651531,
- 23120.738196848146,
- 23137.181071962848,
- 23153.626868956846,
- 23170.075586792263,
- 23186.527224432142,
- 23202.981780840448,
- 23219.439254982066,
- 23235.899645822796,
- 23252.362952329357,
- 23268.829173469378,
- 23285.298308211408,
- 23301.770355524899,
- 23318.245314380223,
- 23334.723183748658,
- 23351.203962602387,
- 23367.687649914504,
- 23384.174244659007,
- 23400.663745810798,
- 23417.15615234568,
- 23433.651463240367,
- 23450.149677472462,
- 23466.650794020472,
- 23483.154811863806,
- 23499.661729982763,
- 23516.171547358543,
- 23532.684262973235,
- 23549.199875809823,
- 23565.718384852185,
- 23582.239789085092,
- 23598.764087494197,
- 23615.291279066041,
- 23631.821362788058,
- 23648.354337648565,
- 23664.890202636761,
- 23681.428956742733,
- 23697.970598957443,
- 23714.515128272738,
- 23731.062543681343,
- 23747.612844176863,
- 23764.166028753778,
- 23780.72209640744,
- 23797.281046134085,
- 23813.842876930816,
- 23830.407587795606,
- 23846.975177727301,
- 23863.545645725622,
- 23880.11899079115,
- 23896.695211925336,
- 23913.274308130498,
- 23929.856278409821,
- 23946.441121767348,
- 23963.028837207989,
- 23979.619423737513,
- 23996.212880362549,
- 24012.809206090584,
- 24029.408399929966,
- 24046.010460889898,
- 24062.615387980433,
- 24079.223180212492,
- 24095.833836597827,
- 24112.447356149063,
- 24129.063737879667,
- 24145.682980803951,
- 24162.305083937081,
- 24178.930046295067,
- 24195.557866894767,
- 24212.188544753884,
- 24228.822078890964,
- 24245.458468325389,
- 24262.097712077397,
- 24278.739809168052,
- 24295.384758619261,
- 24312.032559453768,
- 24328.683210695162,
- 24345.336711367858,
- 24361.993060497109,
- 24378.652257108995,
- 24395.314300230442,
- 24411.979188889192,
- 24428.646922113825,
- 24445.317498933746,
- 24461.990918379193,
- 24478.667179481225,
- 24495.346281271726,
- 24512.028222783407,
- 24528.713003049801,
- 24545.400621105266,
- 24562.091075984976,
- 24578.784366724925,
- 24595.480492361927,
- 24612.179451933614,
- 24628.881244478438,
- 24645.585869035654,
- 24662.293324645343,
- 24679.003610348394,
- 24695.716725186514,
- 24712.432668202211,
- 24729.151438438807,
- 24745.873034940436,
- 24762.597456752032,
- 24779.324702919344,
- 24796.054772488926,
- 24812.787664508123,
- 24829.5233780251,
- 24846.261912088819,
- 24863.003265749034,
- 24879.747438056307,
- 24896.494428062004,
- 24913.244234818278,
- 24929.996857378079,
- 24946.752294795166,
- 24963.510546124078,
- 24980.271610420157,
- 24997.035486739525,
- 25013.802174139113,
- 25030.571671676629,
- 25047.343978410572,
- 25064.119093400237,
- 25080.897015705697,
- 25097.677744387816,
- 25114.461278508239,
- 25131.2476171294,
- 25148.036759314517,
- 25164.828704127583,
- 25181.623450633375,
- 25198.42099789745,
- 25215.221344986145,
- 25232.024490966574,
- 25248.830434906627,
- 25265.639175874974,
- 25282.450712941049,
- 25299.265045175071,
- 25316.082171648024,
- 25332.902091431668,
- 25349.724803598532,
- 25366.550307221914,
- 25383.378601375884,
- 25400.209685135269,
- 25417.043557575678,
- 25433.880217773472,
- 25450.719664805783,
- 25467.561897750507,
- 25484.406915686297,
- 25501.254717692573,
- 25518.105302849512,
- 25534.958670238051,
- 25551.814818939893,
- 25568.67374803748,
- 25585.535456614027,
- 25602.399943753502,
- 25619.267208540619,
- 25636.137250060852,
- 25653.010067400432,
- 25669.885659646327,
- 25686.76402588627,
- 25703.645165208734,
- 25720.529076702944,
- 25737.415759458876,
- 25754.305212567244,
- 25771.197435119517,
- 25788.092426207899,
- 25804.990184925344,
- 25821.890710365547,
- 25838.794001622944,
- 25855.700057792714,
- 25872.608877970775,
- 25889.520461253778,
- 25906.434806739118,
- 25923.351913524923,
- 25940.271780710063,
- 25957.194407394138,
- 25974.11979267748,
- 25991.047935661154,
- 26007.978835446964,
- 26024.912491137442,
- 26041.848901835841,
- 26058.788066646157,
- 26075.729984673108,
- 26092.674655022136,
- 26109.622076799409,
- 26126.572249111829,
- 26143.525171067016,
- 26160.480841773315,
- 26177.43926033979,
- 26194.400425876229,
- 26211.364337493149,
- 26228.330994301767,
- 26245.30039541404,
- 26262.272539942627,
- 26279.247427000919,
- 26296.225055703002,
- 26313.205425163702,
- 26330.188534498539,
- 26347.174382823756,
- 26364.162969256304,
- 26381.154292913852,
- 26398.148352914774,
- 26415.145148378149,
- 26432.144678423778,
- 26449.146942172156,
- 26466.151938744493,
- 26483.159667262702,
- 26500.170126849403,
- 26517.183316627921,
- 26534.199235722277,
- 26551.217883257199,
- 26568.239258358124,
- 26585.263360151173,
- 26602.290187763181,
- 26619.319740321676,
- 26636.352016954883,
- 26653.387016791727,
- 26670.424738961825,
- 26687.465182595493,
- 26704.508346823739,
- 26721.554230778267,
- 26738.602833591467,
- 26755.65415439643,
- 26772.708192326929,
- 26789.764946517433,
- 26806.824416103096,
- 26823.886600219761,
- 26840.95149800396,
- 26858.019108592915,
- 26875.089431124517,
- 26892.162464737365,
- 26909.238208570721,
- 26926.316661764544,
- 26943.397823459472,
- 26960.481692796813,
- 26977.568268918571,
- 26994.657550967422,
- 27011.749538086722,
- 27028.844229420498,
- 27045.941624113464,
- 27063.041721311005,
- 27080.144520159181,
- 27097.250019804727,
- 27114.35821939505,
- 27131.469118078236,
- 27148.582715003027,
- 27165.699009318858,
- 27182.818000175819,
- 27199.939686724665,
- 27217.064068116837,
- 27234.191143504428,
- 27251.320912040203,
- 27268.453372877593,
- 27285.588525170693,
- 27302.726368074269,
- 27319.866900743735,
- 27337.010122335181,
- 27354.156032005358,
- 27371.304628911668,
- 27388.455912212183,
- 27405.609881065626,
- 27422.766534631384,
- 27439.925872069507,
- 27457.087892540683,
- 27474.252595206275,
- 27491.419979228293,
- 27508.5900437694,
- 27525.762787992917,
- 27542.93821106281,
- 27560.116312143706,
- 27577.297090400876,
- 27594.480545000242,
- 27611.666675108383,
- 27628.855479892518,
- 27646.046958520514,
- 27663.241110160889,
- 27680.437933982801,
- 27697.637429156068,
- 27714.839594851132,
- 27732.04443023909,
- 27749.251934491687,
- 27766.462106781299,
- 27783.674946280949,
- 27800.890452164302,
- 27818.108623605654,
- 27835.329459779954,
- 27852.55295986278,
- 27869.779123030345,
- 27887.007948459504,
- 27904.239435327745,
- 27921.473582813196,
- 27938.710390094613,
- 27955.949856351392,
- 27973.19198076355,
- 27990.436762511745,
- 28007.684200777272,
- 28024.934294742041,
- 28042.187043588601,
- 28059.442446500128,
- 28076.700502660427,
- 28093.961211253929,
- 28111.224571465693,
- 28128.490582481401,
- 28145.759243487362,
- 28163.030553670509,
- 28180.304512218394,
- 28197.581118319198,
- 28214.860371161725,
- 28232.14226993539,
- 28249.42681383024,
- 28266.71400203693,
- 28284.003833746745,
- 28301.296308151585,
- 28318.591424443959,
- 28335.889181817001,
- 28353.189579464462,
- 28370.492616580705,
- 28387.798292360701,
- 28405.106606000048,
- 28422.417556694945,
- 28439.731143642206,
- 28457.047366039264,
- 28474.366223084147,
- 28491.687713975512,
- 28509.011837912611,
- 28526.338594095305,
- 28543.667981724069,
- 28560.999999999982,
- 28578.334648124732,
- 28595.671925300605,
- 28613.011830730498,
- 28630.354363617909,
- 28647.699523166943,
- 28665.0473085823,
- 28682.397719069289,
- 28699.750753833818,
- 28717.10641208239,
- 28734.464693022121,
- 28751.825595860708,
- 28769.189119806462,
- 28786.55526406828,
- 28803.924027855664,
- 28821.295410378701,
- 28838.669410848088,
- 28856.046028475103,
- 28873.425262471628,
- 28890.80711205013,
- 28908.191576423673,
- 28925.578654805915,
- 28942.968346411097,
- 28960.360650454055,
- 28977.755566150216,
- 28995.153092715591,
- 29012.553229366786,
- 29029.955975320987,
- 29047.361329795975,
- 29064.769292010107,
- 29082.179861182336,
- 29099.593036532187,
- 29117.00881727978,
- 29134.427202645813,
- 29151.848191851568,
- 29169.271784118911,
- 29186.697978670283,
- 29204.126774728706,
- 29221.55817151779,
- 29238.992168261717,
- 29256.42876418525,
- 29273.867958513725,
- 29291.309750473058,
- 29308.754139289747,
- 29326.201124190855,
- 29343.65070440403,
- 29361.102879157483,
- 29378.557647680012,
- 29396.015009200975,
- 29413.474962950309,
- 29430.937508158524,
- 29448.402644056692,
- 29465.870369876469,
- 29483.340684850071,
- 29500.81358821028,
- 29518.289079190454,
- 29535.767157024511,
- 29553.247820946945,
- 29570.731070192807,
- 29588.216903997723,
- 29605.70532159787,
- 29623.19632223,
- 29640.689905131429,
- 29658.186069540028,
- 29675.684814694236,
- 29693.186139833047,
- 29710.690044196028,
- 29728.196527023298,
- 29745.705587555527,
- 29763.217225033964,
- 29780.731438700397,
- 29798.248227797183,
- 29815.76759156723,
- 29833.289529254005,
- 29850.81404010153,
- 29868.341123354381,
- 29885.870778257693,
- 29903.403004057145,
- 29920.937799998974,
- 29938.475165329975,
- 29956.015099297485,
- 29973.557601149394,
- 29991.102670134147,
- 30008.650305500738,
- 30026.200506498706,
- 30043.753272378144,
- 30061.308602389683,
- 30078.866495784507,
- 30096.426951814352,
- 30113.989969731494,
- 30131.55554878875,
- 30149.123688239491,
- 30166.694387337629,
- 30184.267645337608,
- 30201.843461494434,
- 30219.42183506364,
- 30237.002765301309,
- 30254.586251464058,
- 30272.172292809046,
- 30289.760888593977,
- 30307.35203807709,
- 30324.94574051716,
- 30342.541995173502,
- 30360.140801305966,
- 30377.742158174944,
- 30395.346065041358,
- 30412.952521166666,
- 30430.561525812864,
- 30448.173078242475,
- 30465.787177718561,
- 30483.403823504719,
- 30501.02301486507,
- 30518.644751064272,
- 30536.269031367516,
- 30553.895855040515,
- 30571.525221349519,
- 30589.157129561307,
- 30606.791578943175,
- 30624.428568762964,
- 30642.06809828903,
- 30659.710166790261,
- 30677.35477353607,
- 30695.001917796391,
- 30712.651598841687,
- 30730.303815942945,
- 30747.958568371676,
- 30765.615855399912,
- 30783.275676300211,
- 30800.938030345646,
- 30818.602916809814,
- 30836.270334966837,
- 30853.940284091354,
- 30871.612763458521,
- 30889.287772344011,
- 30906.965310024025,
- 30924.645375775272,
- 30942.327968874983,
- 30960.013088600903,
- 30977.700734231294,
- 30995.390905044929,
- 31013.083600321101,
- 31030.778819339619,
- 31048.476561380798,
- 31066.17682572547,
- 31083.879611654978,
- 31101.584918451179,
- 31119.29274539644,
- 31137.003091773637,
- 31154.715956866155,
- 31172.431339957893,
- 31190.14924033326,
- 31207.869657277162,
- 31225.592590075023,
- 31243.318038012771,
- 31261.046000376838,
- 31278.776476454172,
- 31296.50946553221,
- 31314.24496689891,
- 31331.98297984272,
- 31349.7235036526,
- 31367.466537618013,
- 31385.212081028923,
- 31402.960133175795,
- 31420.710693349596,
- 31438.463760841791,
- 31456.219334944351,
- 31473.977414949743,
- 31491.738000150934,
- 31509.501089841389,
- 31527.266683315069,
- 31545.034779866437,
- 31562.80537879045,
- 31580.578479382562,
- 31598.35408093872,
- 31616.132182755369,
- 31633.91278412945,
- 31651.695884358396,
- 31669.481482740131,
- 31687.269578573076,
- 31705.060171156143,
- 31722.853259788735,
- 31740.648843770748,
- 31758.446922402567,
- 31776.247494985066,
- 31794.050560819614,
- 31811.85611920806,
- 31829.664169452753,
- 31847.474710856521,
- 31865.287742722685,
- 31883.103264355046,
- 31900.921275057899,
- 31918.741774136019,
- 31936.564760894671,
- 31954.390234639599,
- 31972.21819467704,
- 31990.048640313704,
- 32007.881570856793,
- 32025.716985613984,
- 32043.554883893445,
- 32061.395265003815,
- 32079.238128254223,
- 32097.083472954269,
- 32114.931298414049,
- 32132.781603944117,
- 32150.634388855524,
- 32168.48965245979,
- 32186.347394068915,
- 32204.207612995371,
- 32222.07030855212,
- 32239.935480052583,
- 32257.803126810672,
- 32275.673248140767,
- 32293.545843357719,
- 32311.420911776862,
- 32329.298452713996,
- 32347.178465485395,
- 32365.060949407813,
- 32382.945903798463,
- 32400.83332797504,
- 32418.723221255706,
- 32436.615582959093,
- 32454.510412404306,
- 32472.407708910916,
- 32490.307471798966,
- 32508.209700388961,
- 32526.114394001877,
- 32544.021551959166,
- 32561.931173582732,
- 32579.843258194956,
- 32597.757805118679,
- 32615.674813677211,
- 32633.594283194328,
- 32651.516212994258,
- 32669.440602401712,
- 32687.367450741847,
- 32705.296757340297,
- 32723.228521523146,
- 32741.162742616943,
- 32759.099419948703,
- 32777.038552845901,
- 32794.980140636464,
- 32812.924182648792,
- 32830.87067821173,
- 32848.819626654593,
- 32866.77102730715,
- 32884.724879499619,
- 32902.681182562686,
- 32920.639935827494,
- 32938.601138625643,
- 32956.56479028918,
- 32974.530890150607,
- 32992.499437542894,
- 33010.470431799447,
- 33028.443872254145,
- 33046.419758241311,
- 33064.39808909571,
- 33082.378864152583,
- 33100.36208274759,
- 33118.347744216881,
- 33136.335847897026,
- 33154.326393125062,
- 33172.31937923847,
- 33190.314805575174,
- 33208.312671473555,
- 33226.312976272442,
- 33244.315719311111,
- 33262.320899929284,
- 33280.328517467125,
- 33298.33857126526,
- 33316.351060664747,
- 33334.365985007091,
- 33352.383343634239,
- 33370.403135888591,
- 33388.42536111299,
- 33406.450018650721,
- 33424.477107845501,
- 33442.506628041512,
- 33460.53857858335,
- 33478.572958816083,
- 33496.609768085189,
- 33514.649005736617,
- 33532.690671116739,
- 33550.734763572356,
- 33568.781282450735,
- 33586.830227099563,
- 33604.881596866973,
- 33622.935391101528,
- 33640.991609152239,
- 33659.050250368542,
- 33677.111314100322,
- 33695.174799697881,
- 33713.240706511984,
- 33731.309033893805,
- 33749.37978119497,
- 33767.452947767531,
- 33785.528532963974,
- 33803.606536137209,
- 33821.686956640602,
- 33839.769793827938,
- 33857.855047053425,
- 33875.942715671707,
- 33894.032799037872,
- 33912.125296507431,
- 33930.220207436316,
- 33948.317531180888,
- 33966.417267097961,
- 33984.519414544746,
- 34002.623972878901,
- 34020.730941458511,
- 34038.840319642077,
- 34056.952106788536,
- 34075.066302257255,
- 34093.182905408015,
- 34111.301915601027,
- 34129.42333219693,
- 34147.547154556785,
- 34165.673382042078,
- 34183.80201401472,
- 34201.933049837033,
- 34220.06648887178,
- 34238.202330482141,
- 34256.340574031703,
- 34274.481218884495,
- 34292.624264404949,
- 34310.769709957938,
- 34328.91755490873,
- 34347.067798623029,
- 34365.220440466954,
- 34383.375479807051,
- 34401.532916010263,
- 34419.692748443973,
- 34437.854976475966,
- 34456.01959947445,
- 34474.18661680806,
- 34492.356027845817,
- 34510.527831957188,
- 34528.702028512052,
- 34546.878616880676,
- 34565.05759643377,
- 34583.238966542449,
- 34601.422726578232,
- 34619.608875913065,
- 34637.797413919296,
- 34655.988339969692,
- 34674.181653437423,
- 34692.37735369608,
- 34710.575440119668,
- 34728.775912082579,
- 34746.978768959649,
- 34765.184010126082,
- 34783.391634957537,
- 34801.60164283005,
- 34819.814033120063,
- 34838.028805204456,
- 34856.24595846048,
- 34874.465492265823,
- 34892.687405998557,
- 34910.911699037177,
- 34929.138370760564,
- 34947.367420548027,
- 34965.598847779271,
- 34983.832651834389,
- 35002.068832093908,
- 35020.307387938738,
- 35038.548318750189,
- 35056.79162390998,
- 35075.03730280025,
- 35093.285354803513,
- 35111.535779302685,
- 35129.788575681116,
- 35148.043743322516,
- 35166.301281611013,
- 35184.561189931141,
- 35202.823467667826,
- 35221.088114206388,
- 35239.355128932555,
- 35257.624511232447,
- 35275.896260492584,
- 35294.170376099886,
- 35312.446857441668,
- 35330.725703905628,
- 35349.006914879887,
- 35367.290489752944,
- 35385.576427913686,
- 35403.864728751418,
- 35422.155391655811,
- 35440.448416016967,
- 35458.743801225341,
- 35477.041546671804,
- 35495.341651747622,
- 35513.644115844436,
- 35531.948938354304,
- 35550.256118669655,
- 35568.565656183309,
- 35586.877550288496,
- 35605.191800378816,
- 35623.508405848268,
- 35641.827366091238,
- 35660.148680502505,
- 35678.472348477233,
- 35696.798369410979,
- 35715.126742699678,
- 35733.457467739659,
- 35751.790543927644,
- 35770.125970660738,
- 35788.46374733642,
- 35806.803873352568,
- 35825.146348107453,
- 35843.49117099971,
- 35861.838341428367,
- 35880.187858792851,
- 35898.539722492955,
- 35916.893931928862,
- 35935.250486501129,
- 35953.609385610718,
- 35971.970628658957,
- 35990.334215047558,
- 36008.700144178612,
- 36027.068415454596,
- 36045.439028278372,
- 36063.811982053165,
- 36082.187276182609,
- 36100.564910070694,
- 36118.944883121789,
- 36137.327194740654,
- 36155.711844332429,
- 36174.098831302617,
- 36192.488155057115,
- 36210.87981500219,
- 36229.273810544473,
- 36247.670141091003,
- 36266.068806049167,
- 36284.469804826738,
- 36302.873136831862,
- 36321.278801473069,
- 36339.686798159251,
- 36358.097126299683,
- 36376.509785304013,
- 36394.924774582258,
- 36413.342093544816,
- 36431.761741602444,
- 36450.183718166292,
- 36468.608022647859,
- 36487.034654459028,
- 36505.463613012063,
- 36523.894897719583,
- 36542.328507994578,
- 36560.764443250409,
- 36579.202702900831,
- 36597.643286359926,
- 36616.086193042182,
- 36634.531422362437,
- 36652.978973735895,
- 36671.428846578143,
- 36689.881040305125,
- 36708.335554333149,
- 36726.792388078902,
- 36745.251540959427,
- 36763.713012392138,
- 36782.176801794812,
- 36800.642908585593,
- 36819.111332182983,
- 36837.582072005869,
- 36856.055127473483,
- 36874.530498005421,
- 36893.008183021651,
- 36911.488181942506,
- 36929.970494188674,
- 36948.455119181206,
- 36966.942056341519,
- 36985.431305091392,
- 37003.922864852961,
- 37022.416735048733,
- 37040.912915101559,
- 37059.411404434657,
- 37077.91220247162,
- 37096.415308636388,
- 37114.920722353243,
- 37133.428443046862,
- 37151.938470142253,
- 37170.450803064785,
- 37188.965441240209,
- 37207.482384094597,
- 37226.001631054402,
- 37244.523181546429,
- 37263.047034997842,
- 37281.573190836149,
- 37300.101648489224,
- 37318.632407385296,
- 37337.165466952945,
- 37355.700826621112,
- 37374.238485819085,
- 37392.778443976509,
- 37411.320700523385,
- 37429.865254890057,
- 37448.412106507232,
- 37466.961254805974,
- 37485.512699217681,
- 37504.066439174116,
- 37522.622474107404,
- 37541.180803449992,
- 37559.741426634704,
- 37578.304343094693,
- 37596.869552263488,
- 37615.43705357494,
- 37634.006846463279,
- 37652.578930363044,
- 37671.153304709165,
- 37689.729968936896,
- 37708.308922481847,
- 37726.890164779965,
- 37745.473695267559,
- 37764.059513381275,
- 37782.647618558112,
- 37801.238010235415,
- 37819.830687850859,
- 37838.425650842495,
- 37857.022898648691,
- 37875.622430708172,
- 37894.224246460013,
- 37912.828345343616,
- 37931.434726798747,
- 37950.043390265506,
- 37968.654335184328,
- 37987.267560995999,
- 38005.883067141665,
- 38024.500853062775,
- 38043.120918201159,
- 38061.743261998963,
- 38080.367883898682,
- 38098.994783343158,
- 38117.623959775563,
- 38136.255412639417,
- 38154.889141378575,
- 38173.525145437234,
- 38192.163424259939,
- 38210.803977291551,
- 38229.446803977284,
- 38248.091903762703,
- 38266.739276093685,
- 38285.388920416466,
- 38304.040836177606,
- 38322.695022824002,
- 38341.351479802899,
- 38360.010206561863,
- 38378.671202548816,
- 38397.334467211993,
- 38415.999999999978,
- 38434.667800361683,
- 38453.33786774637,
- 38472.010201603611,
- 38490.684801383337,
- 38509.361666535784,
- 38528.040796511552,
- 38546.722190761553,
- 38565.405848737035,
- 38584.091769889594,
- 38602.779953671132,
- 38621.470399533908,
- 38640.163106930493,
- 38658.858075313794,
- 38677.555304137059,
- 38696.254792853862,
- 38714.956540918094,
- 38733.660547783991,
- 38752.366812906112,
- 38771.075335739348,
- 38789.78611573892,
- 38808.499152360368,
- 38827.214445059573,
- 38845.931993292739,
- 38864.651796516388,
- 38883.373854187383,
- 38902.098165762916,
- 38920.824730700486,
- 38939.553548457938,
- 38958.284618493431,
- 38977.017940265461,
- 38995.753513232834,
- 39014.491336854699,
- 39033.231410590517,
- 39051.973733900079,
- 39070.718306243485,
- 39089.465127081188,
- 39108.214195873945,
- 39126.965512082832,
- 39145.719075169261,
- 39164.474884594965,
- 39183.232939821988,
- 39201.99324031271,
- 39220.755785529815,
- 39239.52057493633,
- 39258.287607995589,
- 39277.056884171245,
- 39295.828402927284,
- 39314.602163728006,
- 39333.378166038019,
- 39352.15640932227,
- 39370.936893046004,
- 39389.719616674811,
- 39408.504579674584,
- 39427.291781511522,
- 39446.081221652174,
- 39464.872899563372,
- 39483.666814712291,
- 39502.462966566411,
- 39521.261354593538,
- 39540.06197826178,
- 39558.864837039568,
- 39577.669930395656,
- 39596.47725779911,
- 39615.286818719302,
- 39634.098612625923,
- 39652.912638988993,
- 39671.728897278823,
- 39690.547386966064,
- 39709.368107521652,
- 39728.191058416858,
- 39747.016239123259,
- 39765.84364911275,
- 39784.673287857528,
- 39803.505154830105,
- 39822.339249503319,
- 39841.175571350293,
- 39860.014119844491,
- 39878.854894459677,
- 39897.697894669909,
- 39916.54311994958,
- 39935.390569773372,
- 39954.240243616303,
- 39973.092140953675,
- 39991.946261261117,
- 40010.802604014549,
- 40029.661168690225,
- 40048.521954764678,
- 40067.384961714779,
- 40086.250189017679,
- 40105.117636150855,
- 40123.98730259209,
- 40142.859187819471,
- 40161.733291311379,
- 40180.609612546526,
- 40199.488151003912,
- 40218.368906162854,
- 40237.25187750296,
- 40256.137064504153,
- 40275.024466646668,
- 40293.914083411029,
- 40312.805914278084,
- 40331.699958728961,
- 40350.596216245103,
- 40369.494686308273,
- 40388.39536840051,
- 40407.298262004173,
- 40426.20336660192,
- 40445.110681676706,
- 40464.020206711793,
- 40482.931941190756,
- 40501.845884597446,
- 40520.762036416032,
- 40539.680396130985,
- 40558.600963227072,
- 40577.523737189367,
- 40596.448717503234,
- 40615.375903654342,
- 40634.305295128659,
- 40653.236891412453,
- 40672.170691992294,
- 40691.106696355047,
- 40710.044903987873,
- 40728.985314378238,
- 40747.927927013901,
- 40766.872741382918,
- 40785.819756973651,
- 40804.768973274746,
- 40823.720389775161,
- 40842.674005964131,
- 40861.629821331211,
- 40880.587835366234,
- 40899.548047559321,
- 40918.510457400931,
- 40937.475064381761,
- 40956.441867992849,
- 40975.410867725499,
- 40994.382063071331,
- 41013.355453522236,
- 41032.331038570417,
- 41051.308817708363,
- 41070.288790428858,
- 41089.270956224987,
- 41108.255314590111,
- 41127.241865017888,
- 41146.23060700229,
- 41165.221540037543,
- 41184.214663618193,
- 41203.209977239079,
- 41222.207480395307,
- 41241.207172582297,
- 41260.209053295752,
- 41279.213122031659,
- 41298.219378286303,
- 41317.227821556255,
- 41336.23845133838,
- 41355.251267129832,
- 41374.266268428037,
- 41393.283454730743,
- 41412.302825535953,
- 41431.324380341983,
- 41450.348118647416,
- 41469.374039951144,
- 41488.402143752326,
- 41507.432429550427,
- 41526.464896845187,
- 41545.499545136627,
- 41564.536373925075,
- 41583.575382711126,
- 41602.616570995662,
- 41621.659938279874,
- 41640.705484065205,
- 41659.753207853406,
- 41678.803109146495,
- 41697.855187446803,
- 41716.909442256911,
- 41735.965873079709,
- 41755.02447941836,
- 41774.085260776315,
- 41793.148216657297,
- 41812.213346565331,
- 41831.280650004708,
- 41850.350126480014,
- 41869.421775496106,
- 41888.495596558132,
- 41907.571589171515,
- 41926.649752841957,
- 41945.730087075463,
- 41964.812591378286,
- 41983.897265256979,
- 42002.984108218378,
- 42022.073119769593,
- 42041.164299418015,
- 42060.257646671307,
- 42079.353161037419,
- 42098.450842024591,
- 42117.550689141324,
- 42136.652701896404,
- 42155.756879798893,
- 42174.863222358137,
- 42193.971729083758,
- 42213.082399485655,
- 42232.195233074002,
- 42251.310229359246,
- 42270.427387852127,
- 42289.546708063644,
- 42308.668189505079,
- 42327.791831687995,
- 42346.917634124227,
- 42366.045596325886,
- 42385.175717805352,
- 42404.307998075295,
- 42423.442436648642,
- 42442.579033038608,
- 42461.717786758672,
- 42480.858697322597,
- 42500.001764244422,
- 42519.146987038446,
- 42538.294365219248,
- 42557.443898301688,
- 42576.595585800882,
- 42595.749427232236,
- 42614.90542211142,
- 42634.063569954378,
- 42653.223870277317,
- 42672.386322596729,
- 42691.55092642938,
- 42710.717681292292,
- 42729.886586702756,
- 42749.057642178363,
- 42768.23084723694,
- 42787.406201396603,
- 42806.58370417574,
- 42825.76335509299,
- 42844.945153667286,
- 42864.129099417805,
- 42883.315191864014,
- 42902.503430525649,
- 42921.693814922692,
- 42940.88634457541,
- 42960.081019004348,
- 42979.277837730297,
- 42998.476800274322,
- 43017.677906157769,
- 43036.881154902228,
- 43056.086546029583,
- 43075.294079061961,
- 43094.503753521763,
- 43113.715568931671,
- 43132.929524814601,
- 43152.145620693766,
- 43171.363856092619,
- 43190.584230534907,
- 43209.806743544621,
- 43229.031394646016,
- 43248.258183363621,
- 43267.487109222224,
- 43286.718171746885,
- 43305.951370462906,
- 43325.186704895881,
- 43344.42417457165,
- 43363.663779016322,
- 43382.905517756262,
- 43402.149390318104,
- 43421.395396228749,
- 43440.643535015348,
- 43459.89380620532,
- 43479.146209326354,
- 43498.400743906379,
- 43517.657409473606,
- 43536.916205556496,
- 43556.177131683784,
- 43575.44018738444,
- 43594.705372187724,
- 43613.972685623135,
- 43633.242127220445,
- 43652.513696509668,
- 43671.787393021099,
- 43691.063216285271,
- 43710.341165833001,
- 43729.621241195346,
- 43748.903441903625,
- 43768.187767489413,
- 43787.474217484552,
- 43806.762791421126,
- 43826.053488831501,
- 43845.346309248278,
- 43864.641252204325,
- 43883.938317232765,
- 43903.237503866971,
- 43922.538811640596,
- 43941.842240087513,
- 43961.147788741881,
- 43980.455457138101,
- 43999.765244810835,
- 44019.077151295001,
- 44038.391176125755,
- 44057.70731883854,
- 44077.02557896902,
- 44096.345956053141,
- 44115.668449627083,
- 44134.993059227287,
- 44154.319784390456,
- 44173.648624653535,
- 44192.979579553728,
- 44212.312648628489,
- 44231.647831415532,
- 44250.985127452805,
- 44270.324536278538,
- 44289.666057431183,
- 44309.009690449464,
- 44328.355434872348,
- 44347.703290239064,
- 44367.053256089079,
- 44386.405331962109,
- 44405.759517398139,
- 44425.115811937387,
- 44444.474215120332,
- 44463.834726487694,
- 44483.197345580462,
- 44502.562071939843,
- 44521.928905107328,
- 44541.297844624634,
- 44560.668890033732,
- 44580.042040876848,
- 44599.417296696454,
- 44618.794657035272,
- 44638.174121436256,
- 44657.555689442641,
- 44676.939360597877,
- 44696.325134445673,
- 44715.713010530002,
- 44735.102988395054,
- 44754.495067585296,
- 44773.88924764542,
- 44793.285528120374,
- 44812.683908555344,
- 44832.084388495779,
- 44851.486967487363,
- 44870.891645076015,
- 44890.298420807922,
- 44909.707294229491,
- 44929.118264887409,
- 44948.531332328566,
- 44967.946496100136,
- 44987.363755749502,
- 45006.783110824319,
- 45026.204560872473,
- 45045.628105442098,
- 45065.053744081561,
- 45084.48147633949,
- 45103.911301764747,
- 45123.343219906426,
- 45142.777230313885,
- 45162.21333253671,
- 45181.651526124733,
- 45201.091810628037,
- 45220.534185596924,
- 45239.978650581965,
- 45259.425205133957,
- 45278.873848803938,
- 45298.324581143192,
- 45317.777401703235,
- 45337.232310035848,
- 45356.68930569302,
- 45376.148388226997,
- 45395.60955719027,
- 45415.072812135557,
- 45434.538152615823,
- 45454.005578184282,
- 45473.475088394356,
- 45492.946682799746,
- 45512.420360954362,
- 45531.896122412363,
- 45551.373966728155,
- 45570.853893456362,
- 45590.33590215187,
- 45609.819992369776,
- 45629.306163665438,
- 45648.794415594442,
- 45668.284747712612,
- 45687.777159576006,
- 45707.27165074092,
- 45726.768220763894,
- 45746.266869201696,
- 45765.767595611323,
- 45785.270399550034,
- 45804.775280575297,
- 45824.282238244828,
- 45843.79127211657,
- 45863.302381748719,
- 45882.815566699683,
- 45902.33082652813,
- 45921.848160792935,
- 45941.367569053225,
- 45960.889050868354,
- 45980.41260579793,
- 45999.938233401757,
- 46019.465933239902,
- 46038.995704872657,
- 46058.527547860547,
- 46078.06146176433,
- 46097.597446144995,
- 46117.135500563774,
- 46136.675624582109,
- 46156.217817761702,
- 46175.762079664462,
- 46195.308409852543,
- 46214.856807888333,
- 46234.407273334444,
- 46253.959805753715,
- 46273.51440470924,
- 46293.071069764315,
- 46312.629800482478,
- 46332.190596427499,
- 46351.753457163381,
- 46371.318382254351,
- 46390.885371264863,
- 46410.45442375962,
- 46430.025539303526,
- 46449.598717461733,
- 46469.17395779962,
- 46488.751259882782,
- 46508.33062327707,
- 46527.912047548532,
- 46547.495532263471,
- 46567.081076988397,
- 46586.668681290059,
- 46606.258344735434,
- 46625.850066891719,
- 46645.443847326351,
- 46665.039685606986,
- 46684.637581301497,
- 46704.237533978005,
- 46723.839543204842,
- 46743.443608550573,
- 46763.049729583989,
- 46782.657905874104,
- 46802.268136990162,
- 46821.880422501628,
- 46841.494761978196,
- 46861.111154989776,
- 46880.729601106526,
- 46900.350099898795,
- 46919.97265093719,
- 46939.597253792526,
- 46959.223908035841,
- 46978.852613238392,
- 46998.483368971691,
- 47018.11617480743,
- 47037.751030317551,
- 47057.387935074221,
- 47077.026888649809,
- 47096.66789061694,
- 47116.310940548428,
- 47135.956038017328,
- 47155.603182596918,
- 47175.252373860698,
- 47194.903611382375,
- 47214.556894735892,
- 47234.212223495422,
- 47253.869597235338,
- 47273.52901553025,
- 47293.19047795498,
- 47312.853984084577,
- 47332.519533494306,
- 47352.187125759658,
- 47371.856760456343,
- 47391.528437160297,
- 47411.202155447652,
- 47430.877914894787,
- 47450.555715078299,
- 47470.235555574982,
- 47489.917435961863,
- 47509.601355816201,
- 47529.287314715453,
- 47548.975312237308,
- 47568.665347959672,
- 47588.357421460656,
- 47608.051532318605,
- 47627.747680112072,
- 47647.445864419846,
- 47667.14608482091,
- 47686.848340894474,
- 47706.552632219973,
- 47726.258958377046,
- 47745.967318945557,
- 47765.677713505589,
- 47785.390141637428,
- 47805.104602921601,
- 47824.821096938824,
- 47844.539623270044,
- 47864.260181496429,
- 47883.982771199349,
- 47903.707391960394,
- 47923.434043361369,
- 47943.162724984308,
- 47962.893436411439,
- 47982.626177225218,
- 48002.36094700831,
- 48022.097745343599,
- 48041.836571814172,
- 48061.57742600335,
- 48081.32030749465,
- 48101.065215871815,
- 48120.81215071879,
- 48140.56111161974,
- 48160.312098159047,
- 48180.065109921306,
- 48199.820146491307,
- 48219.577207454073,
- 48239.336292394844,
- 48259.097400899045,
- 48278.860532552339,
- 48298.625686940592,
- 48318.392863649875,
- 48338.162062266485,
- 48357.933282376915,
- 48377.706523567889,
- 48397.481785426316,
- 48417.259067539344,
- 48437.038369494308,
- 48456.819690878765,
- 48476.603031280487,
- 48496.388390287451,
- 48516.175767487839,
- 48535.965162470042,
- 48555.756574822684,
- 48575.550004134566,
- 48595.345449994718,
- 48615.142911992378,
- 48634.942389716991,
- 48654.743882758201,
- 48674.547390705877,
- 48694.352913150084,
- 48714.160449681112,
- 48733.969999889443,
- 48753.781563365759,
- 48773.595139700978,
- 48793.410728486211,
- 48813.228329312769,
- 48833.047941772187,
- 48852.869565456189,
- 48872.693199956717,
- 48892.518844865925,
- 48912.346499776155,
- 48932.176164279976,
- 48952.007837970152,
- 48971.841520439666,
- 48991.677211281676,
- 49011.514910089587,
- 49031.354616456978,
- 49051.196329977654,
- 49071.04005024561,
- 49090.885776855059,
- 49110.733509400408,
- 49130.583247476279,
- 49150.434990677488,
- 49170.288738599062,
- 49190.144490836232,
- 49210.002246984441,
- 49229.86200663932,
- 49249.723769396718,
- 49269.587534852675,
- 49289.453302603448,
- 49309.32107224549,
- 49329.190843375451,
- 49349.062615590192,
- 49368.936388486785,
- 49388.812161662492,
- 49408.689934714785,
- 49428.569707241324,
- 49448.45147883999,
- 49468.335249108866,
- 49488.22101764621,
- 49508.108784050521,
- 49527.99854792047,
- 49547.890308854934,
- 49567.784066453009,
- 49587.679820313977,
- 49607.57757003732,
- 49627.477315222721,
- 49647.379055470075,
- 49667.28279037946,
- 49687.188519551179,
- 49707.096242585707,
- 49727.005959083741,
- 49746.917668646165,
- 49766.831370874068,
- 49786.747065368734,
- 49806.66475173166,
- 49826.584429564515,
- 49846.506098469203,
- 49866.429758047794,
- 49886.355407902578,
- 49906.283047636032,
- 49926.212676850846,
- 49946.144295149883,
- 49966.077902136225,
- 49986.013497413151,
- 50005.951080584135,
- 50025.890651252834,
- 50045.832209023123,
- 50065.775753499074,
- 50085.721284284933,
- 50105.668800985164,
- 50125.618303204428,
- 50145.569790547575,
- 50165.523262619652,
- 50185.478719025901,
- 50205.436159371769,
- 50225.395583262893,
- 50245.356990305103,
- 50265.320380104429,
- 50285.285752267104,
- 50305.253106399534,
- 50325.222442108337,
- 50345.193759000336,
- 50365.16705668252,
- 50385.142334762102,
- 50405.119592846473,
- 50425.098830543218,
- 50445.080047460127,
- 50465.063243205179,
- 50485.048417386541,
- 50505.035569612577,
- 50525.024699491856,
- 50545.015806633128,
- 50565.008890645338,
- 50585.003951137631,
- 50605.00098771933,
- 50624.999999999971,
- 50645.000987589265,
- 50665.003950097132,
- 50685.008887133677,
- 50705.015798309192,
- 50725.024683234165,
- 50745.035541519283,
- 50765.048372775411,
- 50785.063176613621,
- 50805.079952645159,
- 50825.098700481489,
- 50845.119419734241,
- 50865.142110015244,
- 50885.166770936521,
- 50905.193402110279,
- 50925.222003148934,
- 50945.252573665071,
- 50965.285113271471,
- 50985.319621581119,
- 51005.356098207172,
- 51025.394542762981,
- 51045.434954862096,
- 51065.477334118244,
- 51085.521680145357,
- 51105.567992557546,
- 51125.616270969113,
- 51145.66651499454,
- 51165.718724248516,
- 51185.772898345916,
- 51205.829036901778,
- 51225.887139531362,
- 51245.947205850105,
- 51266.009235473619,
- 51286.073228017718,
- 51306.139183098399,
- 51326.207100331856,
- 51346.276979334456,
- 51366.348819722756,
- 51386.42262111351,
- 51406.498383123653,
- 51426.57610537031,
- 51446.655787470787,
- 51466.737429042587,
- 51486.82102970338,
- 51506.906589071048,
- 51526.994106763632,
- 51547.083582399391,
- 51567.175015596738,
- 51587.268405974297,
- 51607.363753150858,
- 51627.461056745415,
- 51647.56031637713,
- 51667.661531665362,
- 51687.764702229651,
- 51707.869827689727,
- 51727.976907665499,
- 51748.085941777055,
- 51768.196929644677,
- 51788.309870888836,
- 51808.42476513017,
- 51828.541611989524,
- 51848.660411087905,
- 51868.781162046515,
- 51888.90386448674,
- 51909.028518030143,
- 51929.155122298485,
- 51949.283676913685,
- 51969.414181497872,
- 51989.546635673345,
- 52009.681039062583,
- 52029.817391288263,
- 52049.955691973213,
- 52070.095940740481,
- 52090.238137213273,
- 52110.382281014987,
- 52130.5283717692,
- 52150.676409099666,
- 52170.826392630333,
- 52190.97832198532,
- 52211.132196788931,
- 52231.288016665654,
- 52251.445781240145,
- 52271.60549013727,
- 52291.76714298204,
- 52311.930739399664,
- 52332.096279015546,
- 52352.263761455244,
- 52372.433186344519,
- 52392.604553309284,
- 52412.777861975665,
- 52432.953111969946,
- 52453.130302918595,
- 52473.309434448267,
- 52493.490506185793,
- 52513.67351775818,
- 52533.858468792605,
- 52554.045358916446,
- 52574.234187757254,
- 52594.42495494274,
- 52614.617660100812,
- 52634.812302859558,
- 52655.008882847229,
- 52675.20739969227,
- 52695.407853023295,
- 52715.610242469098,
- 52735.814567658657,
- 52756.02082822111,
- 52776.229023785803,
- 52796.439153982225,
- 52816.651218440056,
- 52836.865216789171,
- 52857.081148659599,
- 52877.29901368155,
- 52897.518811485425,
- 52917.740541701773,
- 52937.964203961354,
- 52958.18979789508,
- 52978.417323134046,
- 52998.646779309529,
- 53018.878166052978,
- 53039.111482996006,
- 53059.346729770419,
- 53079.583906008193,
- 53099.823011341483,
- 53120.0640454026,
- 53140.307007824063,
- 53160.551898238533,
- 53180.79871627887,
- 53201.047461578091,
- 53221.2981337694,
- 53241.550732486176,
- 53261.805257361964,
- 53282.061708030487,
- 53302.32008412564,
- 53322.580385281493,
- 53342.842611132299,
- 53363.106761312469,
- 53383.372835456597,
- 53403.640833199453,
- 53423.910754175973,
- 53444.18259802126,
- 53464.456364370613,
- 53484.732052859479,
- 53505.009663123499,
- 53525.289194798468,
- 53545.570647520362,
- 53565.854020925333,
- 53586.139314649699,
- 53606.426528329954,
- 53626.715661602764,
- 53647.006714104959,
- 53667.299685473547,
- 53687.59457534572,
- 53707.891383358816,
- 53728.190109150361,
- 53748.490752358055,
- 53768.793312619753,
- 53789.09778957349,
- 53809.404182857485,
- 53829.712492110106,
- 53850.022716969899,
- 53870.334857075584,
- 53890.648912066055,
- 53910.964881580367,
- 53931.28276525774,
- 53951.602562737586,
- 53971.924273659461,
- 53992.24789766311,
- 54012.57343438844,
- 54032.90088347553,
- 54053.23024456462,
- 54073.561517296133,
- 54093.894701310644,
- 54114.22979624891,
- 54134.566801751855,
- 54154.90571746057,
- 54175.246543016314,
- 54195.589278060506,
- 54215.933922234755,
- 54236.280475180814,
- 54256.628936540626,
- 54276.97930595628,
- 54297.331583070045,
- 54317.685767524359,
- 54338.041858961828,
- 54358.399857025215,
- 54378.759761357462,
- 54399.121571601667,
- 54419.485287401105,
- 54439.850908399218,
- 54460.218434239614,
- 54480.587864566056,
- 54500.95919902248,
- 54521.332437252997,
- 54541.707578901878,
- 54562.084623613555,
- 54582.46357103264,
- 54602.844420803893,
- 54623.227172572246,
- 54643.611825982807,
- 54663.998380680838,
- 54684.386836311773,
- 54704.777192521207,
- 54725.169448954897,
- 54745.563605258772,
- 54765.959661078923,
- 54786.357616061614,
- 54806.757469853255,
- 54827.159222100439,
- 54847.562872449904,
- 54867.968420548583,
- 54888.375866043534,
- 54908.785208582012,
- 54929.196447811417,
- 54949.609583379322,
- 54970.024614933463,
- 54990.441542121727,
- 55010.86036459219,
- 55031.28108199306,
- 55051.703693972733,
- 55072.128200179759,
- 55092.554600262847,
- 55112.982893870874,
- 55133.413080652877,
- 55153.845160258061,
- 55174.279132335789,
- 55194.714996535586,
- 55215.152752507143,
- 55235.592399900306,
- 55256.033938365079,
- 55276.477367551655,
- 55296.92268711036,
- 55317.369896691685,
- 55337.818995946305,
- 55358.269984525024,
- 55378.72286207883,
- 55399.177628258869,
- 55419.634282716441,
- 55440.092825103013,
- 55460.553255070205,
- 55481.015572269804,
- 55501.479776353764,
- 55521.945866974187,
- 55542.413843783339,
- 55562.883706433655,
- 55583.355454577715,
- 55603.82908786826,
- 55624.304605958219,
- 55644.782008500639,
- 55665.261295148754,
- 55685.742465555952,
- 55706.225519375774,
- 55726.710456261928,
- 55747.197275868275,
- 55767.685977848843,
- 55788.176561857814,
- 55808.669027549528,
- 55829.163374578478,
- 55849.659602599328,
- 55870.157711266889,
- 55890.657700236145,
- 55911.159569162221,
- 55931.663317700411,
- 55952.168945506164,
- 55972.676452235086,
- 55993.185837542944,
- 56013.697101085651,
- 56034.210242519301,
- 56054.72526150012,
- 56075.242157684508,
- 56095.760930729011,
- 56116.281580290342,
- 56136.804106025367,
- 56157.328507591104,
- 56177.85478464474,
- 56198.382936843598,
- 56218.912963845185,
- 56239.444865307138,
- 56259.978640887268,
- 56280.514290243525,
- 56301.051813034042,
- 56321.591208917082,
- 56342.13247755108,
- 56362.675618594607,
- 56383.220631706419,
- 56403.767516545398,
- 56424.316272770608,
- 56444.866900041241,
- 56465.419398016667,
- 56485.973766356394,
- 56506.530004720102,
- 56527.088112767611,
- 56547.648090158902,
- 56568.209936554107,
- 56588.773651613519,
- 56609.339234997584,
- 56629.9066863669,
- 56650.47600538221,
- 56671.04719170442,
- 56691.620244994599,
- 56712.195164913959,
- 56732.771951123868,
- 56753.350603285835,
- 56773.931121061541,
- 56794.513504112823,
- 56815.097752101647,
- 56835.683864690152,
- 56856.271841540627,
- 56876.86168231551,
- 56897.453386677393,
- 56918.046954289028,
- 56938.642384813298,
- 56959.239677913261,
- 56979.838833252121,
- 57000.439850493225,
- 57021.04272930009,
- 57041.647469336371,
- 57062.254070265873,
- 57082.862531752558,
- 57103.472853460553,
- 57124.085035054108,
- 57144.699076197649,
- 57165.314976555739,
- 57185.932735793103,
- 57206.552353574611,
- 57227.173829565276,
- 57247.797163430281,
- 57268.42235483494,
- 57289.049403444733,
- 57309.678308925286,
- 57330.30907094237,
- 57350.941689161911,
- 57371.576163249985,
- 57392.212492872815,
- 57412.850677696784,
- 57433.490717388406,
- 57454.132611614368,
- 57474.776360041491,
- 57495.421962336746,
- 57516.069418167266,
- 57536.718727200314,
- 57557.36988910332,
- 57578.022903543861,
- 57598.677770189643,
- 57619.334488708548,
- 57639.993058768589,
- 57660.653480037938,
- 57681.315752184906,
- 57701.979874877965,
- 57722.64584778573,
- 57743.31367057695,
- 57763.983342920546,
- 57784.654864485572,
- 57805.328234941233,
- 57826.003453956881,
- 57846.680521202026,
- 57867.359436346305,
- 57888.040199059527,
- 57908.722809011633,
- 57929.407265872709,
- 57950.093569313001,
- 57970.781719002895,
- 57991.471714612911,
- 58012.16355581375,
- 58032.857242276223,
- 58053.552773671312,
- 58074.25014967013,
- 58094.949369943948,
- 58115.650434164185,
- 58136.353342002389,
- 58157.058093130276,
- 58177.764687219693,
- 58198.47312394264,
- 58219.183402971255,
- 58239.895523977837,
- 58260.609486634821,
- 58281.325290614775,
- 58302.042935590434,
- 58322.762421234678,
- 58343.483747220511,
- 58364.206913221096,
- 58384.931918909751,
- 58405.658763959924,
- 58426.3874480452,
- 58447.117970839339,
- 58467.85033201622,
- 58488.584531249864,
- 58509.320568214462,
- 58530.058442584334,
- 58550.798154033931,
- 58571.539702237875,
- 58592.283086870906,
- 58613.028307607929,
- 58633.775364123983,
- 58654.52425609425,
- 58675.274983194053,
- 58696.027545098877,
- 58716.781941484325,
- 58737.538172026158,
- 58758.296236400274,
- 58779.056134282728,
- 58799.817865349694,
- 58820.581429277503,
- 58841.346825742643,
- 58862.114054421712,
- 58882.883114991484,
- 58903.654007128847,
- 58924.426730510851,
- 58945.201284814684,
- 58965.977669717664,
- 58986.755884897269,
- 59007.535930031117,
- 59028.317804796949,
- 59049.101508872664,
- 59069.887041936301,
- 59090.674403666046,
- 59111.463593740213,
- 59132.254611837263,
- 59153.047457635803,
- 59173.84213081457,
- 59194.638631052461,
- 59215.436958028506,
- 59236.237111421855,
- 59257.039090911829,
- 59277.842896177877,
- 59298.648526899589,
- 59319.455982756685,
- 59340.26526342905,
- 59361.076368596696,
- 59381.889297939757,
- 59402.704051138542,
- 59423.520627873484,
- 59444.339027825139,
- 59465.159250674224,
- 59485.9812961016,
- 59506.805163788253,
- 59527.630853415307,
- 59548.458364664046,
- 59569.287697215863,
- 59590.118850752311,
- 59610.951824955089,
- 59631.786619506012,
- 59652.623234087048,
- 59673.461668380311,
- 59694.301922068029,
- 59715.143994832593,
- 59735.987886356525,
- 59756.833596322482,
- 59777.681124413255,
- 59798.530470311794,
- 59819.381633701159,
- 59840.234614264569,
- 59861.089411685381,
- 59881.94602564707,
- 59902.804455833269,
- 59923.664701927737,
- 59944.526763614384,
- 59965.390640577243,
- 59986.256332500488,
- 60007.123839068438,
- 60027.993159965539,
- 60048.864294876381,
- 60069.737243485688,
- 60090.612005478324,
- 60111.488580539284,
- 60132.366968353708,
- 60153.247168606867,
- 60174.129180984164,
- 60195.013005171153,
- 60215.898640853513,
- 60236.786087717061,
- 60257.675345447751,
- 60278.566413731671,
- 60299.459292255044,
- 60320.353980704247,
- 60341.25047876576,
- 60362.148786126229,
- 60383.048902472423,
- 60403.950827491237,
- 60424.854560869717,
- 60445.76010229504,
- 60466.667451454516,
- 60487.57660803559,
- 60508.487571725847,
- 60529.400342212997,
- 60550.314919184893,
- 60571.231302329521,
- 60592.149491335003,
- 60613.069485889588,
- 60633.991285681674,
- 60654.914890399785,
- 60675.840299732568,
- 60696.767513368832,
- 60717.696530997484,
- 60738.627352307602,
- 60759.55997698837,
- 60780.494404729128,
- 60801.430635219323,
- 60822.368668148556,
- 60843.308503206565,
- 60864.250140083204,
- 60885.193578468468,
- 60906.138818052495,
- 60927.085858525541,
- 60948.034699578006,
- 60968.985340900421,
- 60989.937782183442,
- 61010.892023117864,
- 61031.848063394616,
- 61052.805902704764,
- 61073.765540739492,
- 61094.726977190134,
- 61115.690211748137,
- 61136.655244105103,
- 61157.622073952742,
- 61178.590700982917,
- 61199.561124887616,
- 61220.533345358948,
- 61241.507362089171,
- 61262.483174770663,
- 61283.460783095943,
- 61304.440186757645,
- 61325.421385448557,
- 61346.404378861582,
- 61367.389166689762,
- 61388.375748626262,
- 61409.364124364387,
- 61430.354293597571,
- 61451.346256019373,
- 61472.340011323497,
- 61493.335559203762,
- 61514.332899354122,
- 61535.332031468672,
- 61556.332955241618,
- 61577.335670367313,
- 61598.340176540238,
- 61619.346473454993,
- 61640.354560806329,
- 61661.3644382891,
- 61682.376105598312,
- 61703.389562429089,
- 61724.404808476691,
- 61745.42184343651,
- 61766.440667004063,
- 61787.461278874987,
- 61808.483678745069,
- 61829.507866310203,
- 61850.533841266435,
- 61871.561603309929,
- 61892.591152136971,
- 61913.622487443987,
- 61934.655608927525,
- 61955.690516284267,
- 61976.727209211022,
- 61997.765687404724,
- 62018.805950562448,
- 62039.847998381381,
- 62060.891830558845,
- 62081.93744679229,
- 62102.984846779298,
- 62124.034030217575,
- 62145.084996804966,
- 62166.137746239416,
- 62187.19227821903,
- 62208.248592442025,
- 62229.306688606739,
- 62250.366566411656,
- 62271.428225555377,
- 62292.491665736627,
- 62313.556886654267,
- 62334.623888007271,
- 62355.692669494762,
- 62376.763230815974,
- 62397.835571670272,
- 62418.909691757144,
- 62439.98559077621,
- 62461.063268427228,
- 62482.142724410049,
- 62503.223958424685,
- 62524.306970171267,
- 62545.39175935003,
- 62566.478325661366,
- 62587.566668805768,
- 62608.656788483881,
- 62629.748684396451,
- 62650.842356244357,
- 62671.937803728622,
- 62693.035026550366,
- 62714.134024410858,
- 62735.234797011479,
- 62756.337344053733,
- 62777.441665239276,
- 62798.547760269852,
- 62819.655628847358,
- 62840.765270673801,
- 62861.876685451323,
- 62882.989872882186,
- 62904.104832668774,
- 62925.221564513602,
- 62946.340068119309,
- 62967.460343188657,
- 62988.582389424526,
- 63009.70620652994,
- 63030.831794208025,
- 63051.959152162039,
- 63073.08828009537,
- 63094.219177711529,
- 63115.351844714154,
- 63136.486280806988,
- 63157.622485693922,
- 63178.760459078956,
- 63199.900200666219,
- 63221.041710159967,
- 63242.184987264569,
- 63263.330031684534,
- 63284.476843124474,
- 63305.625421289144,
- 63326.775765883409,
- 63347.927876612259,
- 63369.081753180813,
- 63390.237395294316,
- 63411.39480265812,
- 63432.553974977716,
- 63453.714911958712,
- 63474.877613306839,
- 63496.042078727944,
- 63517.208307927998,
- 63538.376300613119,
- 63559.546056489504,
- 63580.717575263516,
- 63601.890856641607,
- 63623.065900330374,
- 63644.242706036515,
- 63665.421273466869,
- 63686.601602328381,
- 63707.783692328136,
- 63728.967543173334,
- 63750.153154571279,
- 63771.340526229418,
- 63792.529657855317,
- 63813.720549156649,
- 63834.913199841227,
- 63856.107609616978,
- 63877.303778191941,
- 63898.501705274284,
- 63919.7013905723,
- 63940.902833794404,
- 63962.106034649114,
- 63983.310992845094,
- 64004.517708091109,
- 64025.726180096048,
- 64046.936408568938,
- 64068.1483932189,
- 64089.362133755196,
- 64110.577629887193,
- 64131.794881324393,
- 64153.013887776404,
- 64174.234648952966,
- 64195.457164563937,
- 64216.681434319289,
- 64237.907457929112,
- 64259.135235103626,
- 64280.36476555316,
- 64301.596048988169,
- 64322.829085119236,
- 64344.06387365704,
- 64365.300414312398,
- 64386.538706796251,
- 64407.778750819634,
- 64429.020546093721,
- 64450.26409232981,
- 64471.509389239291,
- 64492.756436533709,
- 64514.005233924705,
- 64535.255781124033,
- 64556.50807784358,
- 64577.762123795357,
- 64599.017918691468,
- 64620.275462244172,
- 64641.534754165805,
- 64662.795794168844,
- 64684.058581965895,
- 64705.323117269661,
- 64726.589399792974,
- 64747.857429248776,
- 64769.127205350138,
- 64790.398727810236,
- 64811.671996342375,
- 64832.947010659969,
- 64854.223770476558,
- 64875.502275505794,
- 64896.782525461451,
- 64918.064520057414,
- 64939.348259007682,
- 64960.633742026388,
- 64981.920968827762,
- 65003.209939126165,
- 65024.500652636067,
- 65045.793109072067,
- 65067.087308148861,
- 65088.383249581282,
- 65109.680933084259,
- 65130.980358372864,
- 65152.28152516226,
- 65173.584433167736,
- 65194.889082104703,
- 65216.195471688683,
- 65237.503601635319,
- 65258.813471660353,
- 65280.125081479666,
- 65301.438430809241,
- 65322.753519365178,
- 65344.070346863708,
- 65365.388913021146,
- 65386.709217553958,
- 65408.031260178701,
- 65429.355040612056,
- 65450.680558570821,
- 65472.00781377191,
- 65493.336805932355,
- 65514.66753476928,
- 65535.999999999956,
- 65557.334201341757,
- 65578.670138512171,
- 65600.007811228788,
- 65621.347219209332,
- 65642.688362171626,
- 65664.031239833639,
- 65685.375851913413,
- 65706.722198129137,
- 65728.070278199084,
- 65749.420091841661,
- 65770.771638775404,
- 65792.124918718939,
- 65813.479931391004,
- 65834.836676510458,
- 65856.195153796303,
- 65877.5553629676,
- 65898.917303743554,
- 65920.280975843489,
- 65941.646378986843,
- 65963.013512893158,
- 65984.382377282076,
- 66005.752971873386,
- 66027.125296386963,
- 66048.499350542799,
- 66069.875134061018,
- 66091.252646661844,
- 66112.631888065618,
- 66134.01285799277,
- 66155.395556163887,
- 66176.779982299631,
- 66198.166136120795,
- 66219.554017348273,
- 66240.943625703105,
- 66262.334960906388,
- 66283.728022679396,
- 66305.122810743444,
- 66326.519324820023,
- 66347.917564630698,
- 66369.317529897162,
- 66390.719220341227,
- 66412.122635684791,
- 66433.527775649884,
- 66454.934639958636,
- 66476.343228333324,
- 66497.753540496284,
- 66519.165576169995,
- 66540.57933507704,
- 66561.994816940118,
- 66583.412021482043,
- 66604.830948425733,
- 66626.251597494222,
- 66647.673968410629,
- 66669.098060898235,
- 66690.523874680381,
- 66711.951409480564,
- 66733.380665022371,
- 66754.811641029475,
- 66776.244337225711,
- 66797.678753334985,
- 66819.11488908132,
- 66840.552744188884,
- 66861.992318381905,
- 66883.433611384738,
- 66904.876622921889,
- 66926.321352717903,
- 66947.767800497502,
- 66969.215965985466,
- 66990.665848906734,
- 67012.117448986304,
- 67033.570765949335,
- 67055.025799521056,
- 67076.482549426815,
- 67097.941015392076,
- 67119.401197142433,
- 67140.863094403554,
- 67162.326706901222,
- 67183.792034361351,
- 67205.259076509959,
- 67226.72783307315,
- 67248.198303777172,
- 67269.670488348347,
- 67291.144386513144,
- 67312.619997998088,
- 67334.09732252988,
- 67355.576359835293,
- 67377.057109641188,
- 67398.53957167457,
- 67420.023745662547,
- 67441.50963133233,
- 67462.99722841123,
- 67484.486536626689,
- 67505.977555706224,
- 67527.470285377494,
- 67548.964725368263,
- 67570.460875406367,
- 67591.9587352198,
- 67613.458304536631,
- 67634.95958308503,
- 67656.462570593329,
- 67677.967266789899,
- 67699.473671403248,
- 67720.981784162024,
- 67742.491604794923,
- 67764.003133030797,
- 67785.516368598575,
- 67807.031311227314,
- 67828.547960646174,
- 67850.066316584402,
- 67871.58637877139,
- 67893.108146936589,
- 67914.63162080961,
- 67936.156800120138,
- 67957.683684597971,
- 67979.212273973011,
- 68000.742567975263,
- 68022.274566334876,
- 68043.808268782057,
- 68065.343675047145,
- 68086.880784860579,
- 68108.419597952918,
- 68129.960114054789,
- 68151.502332896969,
- 68173.04625421032,
- 68194.591877725834,
- 68216.139203174564,
- 68237.688230287706,
- 68259.238958796544,
- 68280.791388432481,
- 68302.345518927032,
- 68323.901350011787,
- 68345.458881418483,
- 68367.018112878912,
- 68388.579044125028,
- 68410.141674888844,
- 68431.706004902502,
- 68453.272033898262,
- 68474.839761608455,
- 68496.409187765545,
- 68517.980312102081,
- 68539.553134350732,
- 68561.127654244279,
- 68582.70387151558,
- 68604.281785897634,
- 68625.861397123503,
- 68647.44270492639,
- 68669.025709039604,
- 68690.610409196524,
- 68712.196805130661,
- 68733.784896575627,
- 68755.374683265123,
- 68776.966164932994,
- 68798.559341313128,
- 68820.154212139591,
- 68841.750777146473,
- 68863.349036068044,
- 68884.948988638629,
- 68906.550634592684,
- 68928.153973664739,
- 68949.75900558944,
- 68971.365730101577,
- 68992.974146935987,
- 69014.584255827634,
- 69036.196056511588,
- 69057.809548723017,
- 69079.424732197207,
- 69101.041606669532,
- 69122.660171875468,
- 69144.280427550606,
- 69165.902373430625,
- 69187.526009251334,
- 69209.151334748618,
- 69230.778349658474,
- 69252.40705371699,
- 69274.037446660412,
- 69295.669528225,
- 69317.303298147192,
- 69338.938756163494,
- 69360.575902010532,
- 69382.214735425005,
- 69403.855256143754,
- 69425.497463903681,
- 69447.141358441833,
- 69468.78693949533,
- 69490.434206801394,
- 69512.083160097391,
- 69533.733799120717,
- 69555.386123608929,
- 69577.04013329967,
- 69598.695827930685,
- 69620.353207239794,
- 69642.012270964973,
- 69663.67301884426,
- 69685.335450615792,
- 69706.999566017839,
- 69728.665364788743,
- 69750.332846666963,
- 69772.002011391058,
- 69793.672858699691,
- 69815.345388331611,
- 69837.019600025669,
- 69858.695493520849,
- 69880.373068556204,
- 69902.052324870907,
- 69923.733262204216,
- 69945.415880295492,
- 69967.100178884211,
- 69988.786157709939,
- 70010.473816512356,
- 70032.163155031216,
- 70053.854173006403,
- 70075.546870177874,
- 70097.241246285717,
- 70118.937301070109,
- 70140.635034271298,
- 70162.334445629691,
- 70184.035534885741,
- 70205.738301780017,
- 70227.442746053217,
- 70249.1488674461,
- 70270.856665699539,
- 70292.566140554511,
- 70314.277291752107,
- 70335.990119033493,
- 70357.704622139936,
- 70379.420800812819,
- 70401.138654793613,
- 70422.85818382389,
- 70444.579387645339,
- 70466.302265999722,
- 70488.026818628918,
- 70509.753045274876,
- 70531.480945679708,
- 70553.210519585555,
- 70574.941766734701,
- 70596.674686869505,
- 70618.409279732456,
- 70640.145545066101,
- 70661.883482613106,
- 70683.623092116264,
- 70705.364373318414,
- 70727.107325962526,
- 70748.851949791671,
- 70770.598244549008,
- 70792.346209977783,
- 70814.095845821372,
- 70835.847151823225,
- 70857.600127726895,
- 70879.354773276034,
- 70901.111088214413,
- 70922.869072285859,
- 70944.628725234332,
- 70966.390046803877,
- 70988.153036738629,
- 71009.917694782853,
- 71031.684020680885,
- 71053.45201417715,
- 71075.221675016204,
- 71096.993002942661,
- 71118.765997701266,
- 71140.540659036851,
- 71162.316986694335,
- 71184.09498041874,
- 71205.874639955218,
- 71227.655965048951,
- 71249.438955445294,
- 71271.223610889632,
- 71293.009931127483,
- 71314.797915904477,
- 71336.587564966307,
- 71358.378878058764,
- 71380.171854927772,
- 71401.966495319313,
- 71423.762798979486,
- 71445.560765654489,
- 71467.360395090596,
- 71489.161687034211,
- 71510.964641231811,
- 71532.769257429973,
- 71554.575535375348,
- 71576.383474814749,
- 71598.19307549503,
- 71620.004337163133,
- 71641.817259566145,
- 71663.631842451214,
- 71685.4480855656,
- 71707.26598865664,
- 71729.085551471784,
- 71750.906773758586,
- 71772.729655264673,
- 71794.554195737772,
- 71816.380394925713,
- 71838.208252576442,
- 71860.037768437964,
- 71881.868942258385,
- 71903.701773785942,
- 71925.536262768932,
- 71947.372408955751,
- 71969.210212094898,
- 71991.049671934976,
- 72012.890788224686,
- 72034.73356071279,
- 72056.577989148165,
- 72078.424073279821,
- 72100.271812856794,
- 72122.121207628254,
- 72143.97225734347,
- 72165.824961751801,
- 72187.679320602692,
- 72209.53533364569,
- 72231.393000630429,
- 72253.252321306645,
- 72275.113295424177,
- 72296.975922732949,
- 72318.840202982959,
- 72340.706135924338,
- 72362.573721307272,
- 72384.442958882093,
- 72406.313848399179,
- 72428.186389609036,
- 72450.060582262216,
- 72471.936426109431,
- 72493.813920901433,
- 72515.693066389096,
- 72537.573862323392,
- 72559.456308455352,
- 72581.340404536139,
- 72603.226150316987,
- 72625.113545549248,
- 72647.002589984331,
- 72668.893283373764,
- 72690.785625469172,
- 72712.679616022273,
- 72734.575254784853,
- 72756.472541508803,
- 72778.371475946144,
- 72800.272057848939,
- 72822.174286969355,
- 72844.07816305969,
- 72865.983685872285,
- 72887.890855159596,
- 72909.799670674183,
- 72931.710132168693,
- 72953.622239395845,
- 72975.535992108475,
- 72997.451390059519,
- 73019.368433001961,
- 73041.287120688925,
- 73063.207452873612,
- 73085.129429309294,
- 73107.053049749389,
- 73128.978313947344,
- 73150.905221656736,
- 73172.833772631217,
- 73194.763966624567,
- 73216.695803390612,
- 73238.62928268328,
- 73260.564404256627,
- 73282.501167864757,
- 73304.439573261901,
- 73326.379620202337,
- 73348.321308440485,
- 73370.264637730841,
- 73392.209607827957,
- 73414.156218486532,
- 73436.104469461323,
- 73458.054360507173,
- 73480.005891379056,
- 73501.959061831993,
- 73523.913871621116,
- 73545.870320501665,
- 73567.828408228932,
- 73589.78813455833,
- 73611.749499245358,
- 73633.712502045615,
- 73655.677142714747,
- 73677.643421008557,
- 73699.611336682879,
- 73721.580889493693,
- 73743.552079197019,
- 73765.524905548999,
- 73787.499368305856,
- 73809.475467223907,
- 73831.453202059551,
- 73853.432572569291,
- 73875.413578509717,
- 73897.396219637507,
- 73919.380495709411,
- 73941.36640648231,
- 73963.353951713143,
- 73985.343131158952,
- 74007.333944576865,
- 74029.326391724098,
- 74051.320472357969,
- 74073.316186235883,
- 74095.313533115303,
- 74117.312512753837,
- 74139.313124909138,
- 74161.315369338976,
- 74183.319245801191,
- 74205.324754053727,
- 74227.331893854629,
- 74249.340664961986,
- 74271.351067134034,
- 74293.363100129049,
- 74315.376763705441,
- 74337.392057621662,
- 74359.408981636298,
- 74381.427535508003,
- 74403.447718995507,
- 74425.469531857671,
- 74447.492973853383,
- 74469.518044741693,
- 74491.54474428168,
- 74513.573072232539,
- 74535.603028353551,
- 74557.634612404087,
- 74579.667824143602,
- 74601.702663331642,
- 74623.739129727837,
- 74645.777223091936,
- 74667.816943183716,
- 74689.858289763113,
- 74711.901262590094,
- 74733.945861424741,
- 74755.992086027225,
- 74778.039936157802,
- 74800.089411576817,
- 74822.140512044702,
- 74844.193237321961,
- 74866.24758716923,
- 74888.303561347187,
- 74910.36115961663,
- 74932.420381738411,
- 74954.481227473516,
- 74976.543696582972,
- 74998.607788827925,
- 75020.673503969607,
- 75042.740841769322,
- 75064.809801988464,
- 75086.88038438854,
- 75108.952588731103,
- 75131.026414777836,
- 75153.101862290467,
- 75175.178931030852,
- 75197.257620760924,
- 75219.33793124267,
- 75241.419862238225,
- 75263.503413509738,
- 75285.588584819503,
- 75307.675375929874,
- 75329.763786603318,
- 75351.853816602365,
- 75373.945465689612,
- 75396.038733627807,
- 75418.133620179724,
- 75440.230125108254,
- 75462.32824817636,
- 75484.427989147109,
- 75506.529347783653,
- 75528.63232384919,
- 75550.736917107075,
- 75572.843127320695,
- 75594.950954253538,
- 75617.060397669193,
- 75639.171457331307,
- 75661.284133003646,
- 75683.398424450032,
- 75705.514331434402,
- 75727.631853720741,
- 75749.750991073175,
- 75771.871743255862,
- 75793.994110033076,
- 75816.118091169177,
- 75838.243686428585,
- 75860.370895575848,
- 75882.499718375562,
- 75904.630154592422,
- 75926.762203991224,
- 75948.895866336825,
- 75971.031141394182,
- 75993.168028928325,
- 76015.306528704401,
- 76037.4466404876,
- 76059.588364043215,
- 76081.731699136653,
- 76103.876645533353,
- 76126.023202998884,
- 76148.171371298871,
- 76170.321150199044,
- 76192.472539465205,
- 76214.625538863256,
- 76236.780148159174,
- 76258.936367119008,
- 76281.094195508922,
- 76303.253633095141,
- 76325.414679643975,
- 76347.577334921851,
- 76369.741598695226,
- 76391.907470730686,
- 76414.074950794879,
- 76436.244038654564,
- 76458.414734076548,
- 76480.587036827754,
- 76502.760946675175,
- 76524.936463385893,
- 76547.11358672705,
- 76569.292316465915,
- 76591.472652369819,
- 76613.654594206164,
- 76635.838141742468,
- 76658.023294746308,
- 76680.210052985349,
- 76702.398416227341,
- 76724.588384240138,
- 76746.779956791637,
- 76768.973133649866,
- 76791.167914582897,
- 76813.364299358902,
- 76835.562287746157,
- 76857.761879512967,
- 76879.963074427797,
- 76902.165872259109,
- 76924.37027277553,
- 76946.576275745727,
- 76968.783880938441,
- 76990.993088122515,
- 77013.203897066895,
- 77035.416307540567,
- 77057.630319312622,
- 77079.845932152239,
- 77102.063145828695,
- 77124.281960111301,
- 77146.50237476948,
- 77168.724389572759,
- 77190.948004290723,
- 77213.173218693031,
- 77235.400032549442,
- 77257.628445629802,
- 77279.858457704031,
- 77302.090068542122,
- 77324.323277914169,
- 77346.558085590339,
- 77368.794491340886,
- 77391.032494936138,
- 77413.272096146524,
- 77435.51329474253,
- 77457.756090494731,
- 77480.000483173804,
- 77502.246472550498,
- 77524.494058395634,
- 77546.743240480107,
- 77568.994018574944,
- 77591.246392451198,
- 77613.500361880026,
- 77635.755926632657,
- 77658.013086480438,
- 77680.271841194757,
- 77702.532190547092,
- 77724.794134309021,
- 77747.057672252195,
- 77769.322804148323,
- 77791.589529769248,
- 77813.857848886837,
- 77836.127761273063,
- 77858.399266699998,
- 77880.67236493979,
- 77902.947055764627,
- 77925.223338946831,
- 77947.50121425878,
- 77969.780681472927,
- 77992.061740361838,
- 78014.344390698127,
- 78036.628632254491,
- 78058.914464803747,
- 78081.201888118725,
- 78103.490901972415,
- 78125.781506137821,
- 78148.073700388064,
- 78170.367484496339,
- 78192.662858235926,
- 78214.959821380166,
- 78237.258373702498,
- 78259.558514976452,
- 78281.860244975614,
- 78304.163563473659,
- 78326.468470244363,
- 78348.77496506153,
- 78371.083047699125,
- 78393.392717931114,
- 78415.703975531578,
- 78438.016820274701,
- 78460.331251934695,
- 78482.647270285903,
- 78504.964875102727,
- 78527.284066159627,
- 78549.604843231195,
- 78571.927206092048,
- 78594.251154516911,
- 78616.576688280606,
- 78638.903807157985,
- 78661.232510924034,
- 78683.562799353778,
- 78705.894672222363,
- 78728.228129304945,
- 78750.563170376859,
- 78772.899795213423,
- 78795.238003590101,
- 78817.577795282399,
- 78839.919170065928,
- 78862.262127716356,
- 78884.606668009452,
- 78906.952790721043,
- 78929.300495627045,
- 78951.64978250346,
- 78974.000651126378,
- 78996.353101271932,
- 79018.707132716358,
- 79041.062745235977,
- 79063.41993860717,
- 79085.778712606436,
- 79108.139067010285,
- 79130.501001595389,
- 79152.864516138419,
- 79175.22961041618,
- 79197.596284205531,
- 79219.96453728342,
- 79242.33436942687,
- 79264.705780412987,
- 79287.078770018954,
- 79309.453338022009,
- 79331.829484199508,
- 79354.207208328866,
- 79376.586510187582,
- 79398.967389553218,
- 79421.349846203433,
- 79443.733879915948,
- 79466.119490468584,
- 79488.50667763922,
- 79510.895441205823,
- 79533.285780946433,
- 79555.677696639163,
- 79578.071188062226,
- 79600.466254993895,
- 79622.862897212515,
- 79645.261114496549,
- 79667.660906624471,
- 79690.062273374875,
- 79712.465214526455,
- 79734.869729857935,
- 79757.275819148126,
- 79779.683482175955,
- 79802.092718720378,
- 79824.503528560454,
- 79846.915911475327,
- 79869.329867244203,
- 79891.745395646343,
- 79914.162496461155,
- 79936.581169468045,
- 79959.001414446553,
- 79981.423231176261,
- 80003.846619436852,
- 80026.271579008084,
- 80048.698109669771,
- 80071.12621120183,
- 80093.555883384237,
- 80115.987125997053,
- 80138.419938820414,
- 80160.854321634528,
- 80183.290274219689,
- 80205.727796356281,
- 80228.166887824715,
- 80250.607548405547,
- 80273.049777879336,
- 80295.493576026798,
- 80317.938942628651,
- 80340.385877465727,
- 80362.834380318949,
- 80385.28445096928,
- 80407.736089197788,
- 80430.189294785596,
- 80452.644067513917,
- 80475.100407164035,
- 80497.558313517322,
- 80520.017786355209,
- 80542.478825459213,
- 80564.941430610925,
- 80587.405601592007,
- 80609.871338184195,
- 80632.338640169342,
- 80654.8075073293,
- 80677.277939446067,
- 80699.749936301683,
- 80722.223497678278,
- 80744.698623358039,
- 80767.17531312324,
- 80789.653566756242,
- 80812.133384039465,
- 80834.614764755403,
- 80857.097708686648,
- 80879.582215615854,
- 80902.068285325731,
- 80924.555917599093,
- 80947.045112218824,
- 80969.535868967869,
- 80992.028187629272,
- 81014.522067986123,
- 81037.017509821613,
- 81059.514512919006,
- 81082.013077061609,
- 81104.513202032831,
- 81127.014887616184,
- 81149.518133595193,
- 81172.022939753486,
- 81194.529305874807,
- 81217.037231742899,
- 81239.546717141639,
- 81262.057761854958,
- 81284.570365666848,
- 81307.084528361403,
- 81329.600249722775,
- 81352.117529535186,
- 81374.636367582949,
- 81397.156763650448,
- 81419.678717522125,
- 81442.202228982511,
- 81464.727297816222,
- 81487.253923807933,
- 81509.782106742379,
- 81532.311846404409,
- 81554.843142578902,
- 81577.375995050839,
- 81599.910403605274,
- 81622.446368027333,
- 81644.983888102215,
- 81667.522963615178,
- 81690.063594351581,
- 81712.605780096841,
- 81735.149520636449,
- 81757.694815755967,
- 81780.241665241047,
- 81802.79006887741,
- 81825.340026450824,
- 81847.891537747171,
- 81870.444602552379,
- 81892.999220652477,
- 81915.555391833506,
- 81938.113115881672,
- 81960.672392583176,
- 81983.233221724338,
- 82005.795603091537,
- 82028.359536471224,
- 82050.925021649906,
- 82073.492058414209,
- 82096.060646550788,
- 82118.630785846399,
- 82141.202476087841,
- 82163.775717062032,
- 82186.35050855593,
- 82208.926850356569,
- 82231.504742251054,
- 82254.084184026578,
- 82276.665175470393,
- 82299.24771636985,
- 82321.831806512317,
- 82344.417445685307,
- 82367.004633676348,
- 82389.593370273054,
- 82412.183655263143,
- 82434.775488434374,
- 82457.368869574595,
- 82479.963798471697,
- 82502.560274913689,
- 82525.158298688606,
- 82547.757869584602,
- 82570.35898738986,
- 82592.961651892678,
- 82615.565862881398,
- 82638.171620144421,
- 82660.778923470265,
- 82683.387772647475,
- 82705.998167464713,
- 82728.610107710658,
- 82751.223593174116,
- 82773.83862364394,
- 82796.45519890904,
- 82819.073318758441,
- 82841.692982981185,
- 82864.314191366429,
- 82886.936943703375,
- 82909.561239781324,
- 82932.187079389638,
- 82954.814462317736,
- 82977.443388355125,
- 83000.073857291369,
- 83022.70586891612,
- 83045.339423019104,
- 83067.974519390089,
- 83090.611157818959,
- 83113.249338095629,
- 83135.8890600101,
- 83158.530323352461,
- 83181.173127912858,
- 83203.817473481497,
- 83226.463359848669,
- 83249.11078680474,
- 83271.759754140134,
- 83294.410261645375,
- 83317.062309111003,
- 83339.715896327703,
- 83362.371023086147,
- 83385.027689177165,
- 83407.685894391587,
- 83430.345638520361,
- 83453.006921354478,
- 83475.669742685001,
- 83498.334102303095,
- 83520.999999999942,
- 83543.667435566866,
- 83566.336408795192,
- 83589.006919476349,
- 83611.678967401851,
- 83634.352552363242,
- 83657.027674152167,
- 83679.704332560359,
- 83702.382527379552,
- 83725.062258401638,
- 83747.743525418511,
- 83770.42632822218,
- 83793.110666604684,
- 83815.796540358162,
- 83838.483949274829,
- 83861.172893146941,
- 83883.863371766842,
- 83906.555384926964,
- 83929.248932419752,
- 83951.944014037799,
- 83974.640629573696,
- 83997.338778820151,
- 84020.038461569929,
- 84042.739677615857,
- 84065.442426750829,
- 84088.146708767847,
- 84110.852523459922,
- 84133.559870620171,
- 84156.268750041796,
- 84178.979161518029,
- 84201.691104842204,
- 84224.404579807713,
- 84247.119586208006,
- 84269.83612383662,
- 84292.55419248715,
- 84315.273791953281,
- 84337.994922028738,
- 84360.717582507335,
- 84383.441773182945,
- 84406.167493849513,
- 84428.894744301069,
- 84451.623524331691,
- 84474.353833735542,
- 84497.085672306828,
- 84519.819039839858,
- 84542.553936128999,
- 84565.290360968676,
- 84588.028314153402,
- 84610.767795477717,
- 84633.508804736295,
- 84656.251341723822,
- 84678.995406235073,
- 84701.740998064924,
- 84724.488117008252,
- 84747.236762860062,
- 84769.986935415407,
- 84792.73863446941,
- 84815.491859817252,
- 84838.246611254188,
- 84861.002888575575,
- 84883.760691576768,
- 84906.520020053256,
- 84929.28087380057,
- 84952.043252614312,
- 84974.807156290146,
- 84997.572584623806,
- 85020.339537411113,
- 85043.108014447949,
- 85065.878015530237,
- 85088.649540453989,
- 85111.422589015303,
- 85134.197161010321,
- 85156.973256235244,
- 85179.750874486374,
- 85202.530015560071,
- 85225.310679252725,
- 85248.092865360857,
- 85270.876573681016,
- 85293.661804009811,
- 85316.448556143951,
- 85339.236829880188,
- 85362.026625015351,
- 85384.817941346351,
- 85407.610778670132,
- 85430.405136783724,
- 85453.201015484257,
- 85475.998414568865,
- 85498.797333834795,
- 85521.597773079353,
- 85544.399732099904,
- 85567.203210693886,
- 85590.008208658808,
- 85612.814725792239,
- 85635.62276189182,
- 85658.432316755265,
- 85681.243390180331,
- 85704.055981964877,
- 85726.870091906807,
- 85749.685719804082,
- 85772.502865454764,
- 85795.321528656961,
- 85818.141709208852,
- 85840.963406908675,
- 85863.78662155474,
- 85886.611352945445,
- 85909.437600879217,
- 85932.26536515457,
- 85955.094645570091,
- 85977.92544192441,
- 86000.757754016275,
- 86023.591581644432,
- 86046.426924607746,
- 86069.263782705122,
- 86092.102155735556,
- 86114.942043498071,
- 86137.783445791807,
- 86160.626362415918,
- 86183.470793169676,
- 86206.316737852379,
- 86229.164196263402,
- 86252.013168202204,
- 86274.863653468303,
- 86297.715651861261,
- 86320.569163180728,
- 86343.424187226425,
- 86366.280723798132,
- 86389.138772695675,
- 86411.998333718977,
- 86434.859406668009,
- 86457.721991342827,
- 86480.586087543532,
- 86503.451695070296,
- 86526.318813723352,
- 86549.187443303032,
- 86572.057583609683,
- 86594.929234443756,
- 86617.802395605773,
- 86640.677066896271,
- 86663.553248115903,
- 86686.43093906538,
- 86709.310139545443,
- 86732.190849356964,
- 86755.073068300815,
- 86777.956796177954,
- 86800.842032789442,
- 86823.728777936354,
- 86846.617031419853,
- 86869.506793041175,
- 86892.398062601613,
- 86915.290839902518,
- 86938.185124745316,
- 86961.080916931489,
- 86983.978216262592,
- 87006.87702254027,
- 87029.777335566177,
- 87052.67915514209,
- 87075.582481069796,
- 87098.487313151185,
- 87121.39365118822,
- 87144.301494982894,
- 87167.210844337285,
- 87190.121699053532,
- 87213.034058933845,
- 87235.947923780506,
- 87258.863293395829,
- 87281.780167582241,
- 87304.698546142172,
- 87327.618428878181,
- 87350.539815592856,
- 87373.462706088845,
- 87396.387100168897,
- 87419.312997635774,
- 87442.240398292357,
- 87465.16930194154,
- 87488.099708386319,
- 87511.031617429733,
- 87533.965028874911,
- 87556.899942525008,
- 87579.836358183282,
- 87602.774275653021,
- 87625.713694737613,
- 87648.654615240492,
- 87671.597036965148,
- 87694.540959715145,
- 87717.486383294105,
- 87740.433307505737,
- 87763.381732153779,
- 87786.331657042057,
- 87809.283081974456,
- 87832.236006754916,
- 87855.190431187453,
- 87878.146355076155,
- 87901.103778225151,
- 87924.062700438633,
- 87947.023121520891,
- 87969.985041276246,
- 87992.948459509105,
- 88015.913376023906,
- 88038.879790625171,
- 88061.847703117513,
- 88084.817113305573,
- 88107.788020994049,
- 88130.760425987726,
- 88153.734328091465,
- 88176.709727110137,
- 88199.686622848749,
- 88222.665015112303,
- 88245.644903705906,
- 88268.626288434709,
- 88291.609169103947,
- 88314.593545518903,
- 88337.579417484914,
- 88360.566784807408,
- 88383.555647291854,
- 88406.546004743795,
- 88429.537856968818,
- 88452.531203772611,
- 88475.52604496089,
- 88498.522380339447,
- 88521.52020971413,
- 88544.519532890874,
- 88567.520349675644,
- 88590.522659874507,
- 88613.526463293543,
- 88636.531759738922,
- 88659.538549016899,
- 88682.546830933745,
- 88705.556605295846,
- 88728.567871909589,
- 88751.580630581491,
- 88774.594881118086,
- 88797.610623325963,
- 88820.62785701183,
- 88843.646581982393,
- 88866.666798044462,
- 88889.688505004888,
- 88912.711702670611,
- 88935.7363908486,
- 88958.762569345898,
- 88981.790237969632,
- 89004.81939652696,
- 89027.850044825114,
- 89050.882182671412,
- 89073.9158098732,
- 89096.950926237885,
- 89119.987531572973,
- 89143.025625686001,
- 89166.065208384563,
- 89189.106279476357,
- 89212.148838769106,
- 89235.192886070581,
- 89258.238421188667,
- 89281.285443931265,
- 89304.333954106376,
- 89327.383951522017,
- 89350.435435986306,
- 89373.488407307406,
- 89396.542865293537,
- 89419.598809753006,
- 89442.656240494165,
- 89465.715157325409,
- 89488.775560055219,
- 89511.837448492137,
- 89534.900822444746,
- 89557.965681721733,
- 89581.032026131812,
- 89604.099855483742,
- 89627.169169586399,
- 89650.239968248672,
- 89673.312251279538,
- 89696.386018488018,
- 89719.461269683205,
- 89742.53800467425,
- 89765.616223270365,
- 89788.69592528083,
- 89811.777110514988,
- 89834.859778782207,
- 89857.943929891975,
- 89881.029563653807,
- 89904.116679877261,
- 89927.205278372014,
- 89950.29535894774,
- 89973.386921414218,
- 89996.479965581268,
- 90019.574491258769,
- 90042.670498256688,
- 90065.767986385021,
- 90088.866955453836,
- 90111.967405273259,
- 90135.069335653476,
- 90158.172746404758,
- 90181.277637337407,
- 90204.384008261797,
- 90227.49185898836,
- 90250.601189327586,
- 90273.711999090039,
- 90296.824288086325,
- 90319.938056127125,
- 90343.053303023189,
- 90366.170028585286,
- 90389.288232624298,
- 90412.407914951138,
- 90435.529075376777,
- 90458.651713712257,
- 90481.775829768681,
- 90504.901423357209,
- 90528.028494289058,
- 90551.157042375504,
- 90574.287067427911,
- 90597.418569257643,
- 90620.551547676194,
- 90643.686002495073,
- 90666.821933525847,
- 90689.959340580186,
- 90713.098223469773,
- 90736.238582006365,
- 90759.380416001804,
- 90782.523725267951,
- 90805.668509616764,
- 90828.814768860233,
- 90851.962502810435,
- 90875.11171127946,
- 90898.262394079517,
- 90921.414551022855,
- 90944.568181921743,
- 90967.72328658856,
- 90990.879864835719,
- 91014.037916475718,
- 91037.19744132107,
- 91060.358439184391,
- 91083.520909878338,
- 91106.684853215629,
- 91129.850269009039,
- 91153.017157071401,
- 91176.185517215621,
- 91199.355349254649,
- 91222.526653001492,
- 91245.699428269247,
- 91268.873674871036,
- 91292.049392620058,
- 91315.226581329553,
- 91338.405240812834,
- 91361.585370883287,
- 91384.766971354344,
- 91407.950042039476,
- 91431.134582752245,
- 91454.320593306256,
- 91477.508073515171,
- 91500.697023192712,
- 91523.887442152685,
- 91547.07933020893,
- 91570.272687175326,
- 91593.467512865856,
- 91616.663807094534,
- 91639.861569675442,
- 91663.060800422725,
- 91686.261499150554,
- 91709.463665673218,
- 91732.66729980502,
- 91755.872401360321,
- 91779.078970153569,
- 91802.287005999257,
- 91825.49650871192,
- 91848.707478106167,
- 91871.91991399668,
- 91895.133816198169,
- 91918.349184525418,
- 91941.566018793281,
- 91964.784318816659,
- 91988.004084410495,
- 92011.22531538982,
- 92034.448011569708,
- 92057.672172765277,
- 92080.897798791746,
- 92104.124889464365,
- 92127.353444598411,
- 92150.58346400928,
- 92173.814947512379,
- 92197.04789492322,
- 92220.282306057314,
- 92243.518180730272,
- 92266.755518757753,
- 92289.994319955469,
- 92313.234584139194,
- 92336.476311124774,
- 92359.719500728082,
- 92382.964152765067,
- 92406.210267051734,
- 92429.457843404161,
- 92452.706881638471,
- 92475.957381570814,
- 92499.209343017443,
- 92522.462765794655,
- 92545.717649718805,
- 92568.973994606305,
- 92592.231800273614,
- 92615.491066537259,
- 92638.751793213814,
- 92662.01398011994,
- 92685.277627072326,
- 92708.54273388772,
- 92731.809300382942,
- 92755.077326374871,
- 92778.346811680414,
- 92801.617756116568,
- 92824.890159500384,
- 92848.164021648947,
- 92871.439342379424,
- 92894.716121509016,
- 92917.994358855023,
- 92941.274054234746,
- 92964.555207465572,
- 92987.837818364962,
- 93011.121886750407,
- 93034.407412439468,
- 93057.694395249753,
- 93080.982834998955,
- 93104.272731504767,
- 93127.564084584999,
- 93150.856894057491,
- 93174.15115974014,
- 93197.446881450916,
- 93220.744059007804,
- 93244.04269222889,
- 93267.342780932304,
- 93290.644324936235,
- 93313.947324058914,
- 93337.251778118633,
- 93360.557686933767,
- 93383.865050322696,
- 93407.173868103928,
- 93430.484140095941,
- 93453.795866117362,
- 93477.109045986799,
- 93500.423679522952,
- 93523.739766544561,
- 93547.057306870454,
- 93570.376300319491,
- 93593.696746710571,
- 93617.018645862699,
- 93640.341997594893,
- 93663.666801726242,
- 93686.993058075881,
- 93710.320766463032,
- 93733.64992670693,
- 93756.980538626914,
- 93780.312602042337,
- 93803.646116772637,
- 93826.981082637285,
- 93850.317499455836,
- 93873.655367047861,
- 93896.994685233032,
- 93920.335453831038,
- 93943.677672661666,
- 93967.021341544707,
- 93990.366460300051,
- 94013.713028747632,
- 94037.061046707429,
- 94060.410513999494,
- 94083.761430443905,
- 94107.113795860845,
- 94130.467610070496,
- 94153.822872893157,
- 94177.179584149111,
- 94200.537743658759,
- 94223.897351242529,
- 94247.25840672091,
- 94270.620909914433,
- 94293.98486064373,
- 94317.350258729421,
- 94340.71710399224,
- 94364.085396252936,
- 94387.455135332348,
- 94410.82632105134,
- 94434.198953230851,
- 94457.573031691878,
- 94480.948556255447,
- 94504.325526742658,
- 94527.70394297468,
- 94551.083804772716,
- 94574.465111958023,
- 94597.847864351934,
- 94621.232061775823,
- 94644.617704051096,
- 94668.004790999272,
- 94691.393322441872,
- 94714.783298200506,
- 94738.174718096794,
- 94761.567581952477,
- 94784.961889589307,
- 94808.357640829097,
- 94831.754835493703,
- 94855.153473405066,
- 94878.553554385173,
- 94901.955078256055,
- 94925.358044839784,
- 94948.762453958523,
- 94972.168305434476,
- 94995.575599089891,
- 95018.984334747074,
- 95042.394512228391,
- 95065.806131356265,
- 95089.219191953176,
- 95112.633693841635,
- 95136.04963684424,
- 95159.467020783617,
- 95182.885845482466,
- 95206.306110763529,
- 95229.727816449609,
- 95253.150962363579,
- 95276.575548328314,
- 95300.001574166803,
- 95323.429039702052,
- 95346.857944757154,
- 95370.288289155214,
- 95393.720072719429,
- 95417.153295273019,
- 95440.587956639298,
- 95464.024056641589,
- 95487.461595103305,
- 95510.900571847902,
- 95534.340986698866,
- 95557.782839479783,
- 95581.226130014256,
- 95604.670858125959,
- 95628.117023638595,
- 95651.564626375985,
- 95675.013666161918,
- 95698.464142820303,
- 95721.916056175076,
- 95745.369406050231,
- 95768.824192269807,
- 95792.280414657915,
- 95815.738073038709,
- 95839.197167236387,
- 95862.657697075221,
- 95886.11966237954,
- 95909.583062973688,
- 95933.047898682111,
- 95956.514169329268,
- 95979.981874739708,
- 96003.451014738006,
- 96026.921589148798,
- 96050.393597796792,
- 96073.867040506724,
- 96097.341917103375,
- 96120.818227411626,
- 96144.295971256375,
- 96167.775148462577,
- 96191.255758855244,
- 96214.737802259449,
- 96238.221278500292,
- 96261.70618740299,
- 96285.192528792715,
- 96308.680302494788,
- 96332.169508334526,
- 96355.660146137321,
- 96379.152215728609,
- 96402.645716933868,
- 96426.14064957868,
- 96449.637013488609,
- 96473.134808489311,
- 96496.63403440651,
- 96520.134691065963,
- 96543.636778293469,
- 96567.140295914898,
- 96590.645243756153,
- 96614.151621643221,
- 96637.659429402134,
- 96661.168666858954,
- 96684.679333839798,
- 96708.191430170875,
- 96731.70495567839,
- 96755.219910188665,
- 96778.736293528011,
- 96802.254105522836,
- 96825.77334599958,
- 96849.29401478474,
- 96872.816111704873,
- 96896.339636586577,
- 96919.864589256511,
- 96943.390969541389,
- 96966.918777267958,
- 96990.448012263048,
- 97013.978674353522,
- 97037.510763366285,
- 97061.044279128328,
- 97084.579221466673,
- 97108.115590208385,
- 97131.653385180587,
- 97155.19260621049,
- 97178.733253125291,
- 97202.2753257523,
- 97225.81882391886,
- 97249.363747452342,
- 97272.910096180189,
- 97296.457869929916,
- 97320.007068529041,
- 97343.557691805196,
- 97367.109739586012,
- 97390.663211699197,
- 97414.218107972498,
- 97437.774428233737,
- 97461.332172310766,
- 97484.891340031507,
- 97508.451931223899,
- 97532.013945715982,
- 97555.577383335811,
- 97579.142243911512,
- 97602.708527271257,
- 97626.276233243261,
- 97649.845361655811,
- 97673.415912337223,
- 97696.987885115886,
- 97720.561279820206,
- 97744.1360962787,
- 97767.712334319876,
- 97791.289993772341,
- 97814.869074464703,
- 97838.449576225685,
- 97862.031498883996,
- 97885.614842268449,
- 97909.199606207883,
- 97932.785790531183,
- 97956.37339506732,
- 97979.962419645264,
- 98003.552864094076,
- 98027.144728242856,
- 98050.738011920766,
- 98074.332714956996,
- 98097.928837180807,
- 98121.526378421506,
- 98145.125338508456,
- 98168.725717271067,
- 98192.327514538789,
- 98215.930730141132,
- 98239.535363907664,
- 98263.141415668011,
- 98286.748885251814,
- 98310.357772488816,
- 98333.968077208759,
- 98357.579799241488,
- 98381.192938416847,
- 98404.807494564782,
- 98428.42346751524,
- 98452.040857098269,
- 98475.659663143917,
- 98499.27988548232,
- 98522.901523943656,
- 98546.524578358163,
- 98570.149048556093,
- 98593.774934367786,
- 98617.402235623624,
- 98641.030952154048,
- 98664.661083789513,
- 98688.292630360564,
- 98711.925591697771,
- 98735.559967631794,
- 98759.195757993293,
- 98782.832962613014,
- 98806.471581321734,
- 98830.111613950285,
- 98853.753060329575,
- 98877.39592029051,
- 98901.040193664099,
- 98924.68588028138,
- 98948.33297997342,
- 98971.981492571387,
- 98995.63141790645,
- 99019.282755809851,
- 99042.935506112874,
- 99066.589668646877,
- 99090.245243243233,
- 99113.902229733401,
- 99137.560627948857,
- 99161.220437721131,
- 99184.881658881859,
- 99208.544291262631,
- 99232.208334695169,
- 99255.87378901121,
- 99279.540654042547,
- 99303.208929621018,
- 99326.878615578535,
- 99350.549711746993,
- 99374.222217958435,
- 99397.896134044888,
- 99421.571459838422,
- 99445.248195171211,
- 99468.926339875441,
- 99492.605893783344,
- 99516.286856727209,
- 99539.969228539398,
- 99563.653009052287,
- 99587.338198098325,
- 99611.024795510006,
- 99634.712801119866,
- 99658.402214760499,
- 99682.093036264545,
- 99705.785265464699,
- 99729.478902193689,
- 99753.173946284325,
- 99776.870397569437,
- 99800.56825588191,
- 99824.267521054688,
- 99847.968192920773,
- 99871.670271313182,
- 99895.373756065004,
- 99919.078647009388,
- 99942.78494397951,
- 99966.492646808634,
- 99990.20175533001,
- 100013.91226937699,
- 100037.62418878295,
- 100061.33751338134,
- 100085.05224300563,
- 100108.76837748935,
- 100132.4859166661,
- 100156.2048603695,
- 100179.92520843323,
- 100203.64696069101,
- 100227.37011697664,
- 100251.09467712394,
- 100274.82064096678,
- 100298.54800833909,
- 100322.27677907483,
- 100346.00695300807,
- 100369.73852997283,
- 100393.47150980328,
- 100417.20589233354,
- 100440.94167739789,
- 100464.67886483055,
- 100488.41745446586,
- 100512.1574461382,
- 100535.89883968196,
- 100559.64163493161,
- 100583.38583172169,
- 100607.13142988674,
- 100630.87842926137,
- 100654.62682968024,
- 100678.37663097809,
- 100702.12783298964,
- 100725.88043554971,
- 100749.63443849317,
- 100773.38984165489,
- 100797.14664486986,
- 100820.90484797307,
- 100844.66445079957,
- 100868.42545318443,
- 100892.18785496285,
- 100915.95165596998,
- 100939.71685604109,
- 100963.48345501146,
- 100987.25145271645,
- 101011.02084899142,
- 101034.79164367182,
- 101058.56383659317,
- 101082.33742759094,
- 101106.11241650078,
- 101129.88880315828,
- 101153.66658739912,
- 101177.44576905905,
- 101201.22634797383,
- 101225.00832397929,
- 101248.7916969113,
- 101272.57646660579,
- 101296.36263289873,
- 101320.15019562612,
- 101343.93915462404,
- 101367.7295097286,
- 101391.52126077596,
- 101415.31440760233,
- 101439.10895004397,
- 101462.9048879372,
- 101486.70222111834,
- 101510.50094942382,
- 101534.30107269008,
- 101558.10259075361,
- 101581.90550345098,
- 101605.70981061876,
- 101629.5155120936,
- 101653.32260771218,
- 101677.13109731126,
- 101700.9409807276,
- 101724.75225779804,
- 101748.56492835947,
- 101772.37899224881,
- 101796.19444930303,
- 101820.01129935916,
- 101843.82954225427,
- 101867.64917782549,
- 101891.47020590997,
- 101915.29262634492,
- 101939.11643896763,
- 101962.94164361537,
- 101986.76824012553,
- 102010.59622833549,
- 102034.42560808272,
- 102058.25637920471,
- 102082.08854153901,
- 102105.9220949232,
- 102129.75703919494,
- 102153.59337419191,
- 102177.43109975185,
- 102201.27021571253,
- 102225.1107219118,
- 102248.95261818753,
- 102272.79590437764,
- 102296.64058032009,
- 102320.48664585294,
- 102344.33410081422,
- 102368.18294504205,
- 102392.03317837461,
- 102415.88480065008,
- 102439.73781170673,
- 102463.59221138287,
- 102487.44799951684,
- 102511.30517594704,
- 102535.1637405119,
- 102559.02369304992,
- 102582.88503339965,
- 102606.74776139967,
- 102630.61187688859,
- 102654.4773797051,
- 102678.34426968795,
- 102702.21254667587,
- 102726.08221050771,
- 102749.95326102231,
- 102773.8256980586,
- 102797.69952145554,
- 102821.57473105213,
- 102845.45132668741,
- 102869.32930820051,
- 102893.20867543056,
- 102917.08942821674,
- 102940.97156639832,
- 102964.85508981455,
- 102988.73999830478,
- 103012.6262917084,
- 103036.51396986481,
- 103060.40303261351,
- 103084.293479794,
- 103108.18531124585,
- 103132.07852680866,
- 103155.97312632212,
- 103179.8691096259,
- 103203.76647655977,
- 103227.66522696352,
- 103251.56536067701,
- 103275.46687754011,
- 103299.36977739276,
- 103323.27406007495,
- 103347.1797254267,
- 103371.0867732881,
- 103394.99520349925,
- 103418.90501590034,
- 103442.81621033157,
- 103466.72878663319,
- 103490.64274464553,
- 103514.55808420894,
- 103538.4748051638,
- 103562.39290735057,
- 103586.31239060973,
- 103610.23325478184,
- 103634.15549970744,
- 103658.07912522719,
- 103682.00413118176,
- 103705.93051741188,
- 103729.85828375829,
- 103753.78743006183,
- 103777.71795616332,
- 103801.64986190372,
- 103825.58314712394,
- 103849.51781166498,
- 103873.4538553679,
- 103897.39127807376,
- 103921.33007962372,
- 103945.27025985894,
- 103969.21181862066,
- 103993.15475575015,
- 104017.0990710887,
- 104041.0447644777,
- 104064.99183575854,
- 104088.94028477269,
- 104112.89011136163,
- 104136.84131536692,
- 104160.79389663014,
- 104184.74785499295,
- 104208.70319029699,
- 104232.65990238401,
- 104256.61799109577,
- 104280.57745627411,
- 104304.53829776087,
- 104328.50051539797,
- 104352.46410902737,
- 104376.42907849104,
- 104400.39542363105,
- 104424.36314428948,
- 104448.33224030846,
- 104472.3027115302,
- 104496.27455779689,
- 104520.24777895081,
- 104544.22237483428,
- 104568.19834528965,
- 104592.17569015936,
- 104616.15440928582,
- 104640.13450251156,
- 104664.1159696791,
- 104688.09881063103,
- 104712.08302520998,
- 104736.06861325864,
- 104760.05557461972,
- 104784.043909136,
- 104808.03361665027,
- 104832.0246970054,
- 104856.01715004431,
- 104880.01097560991,
- 104904.00617354522,
- 104928.00274369326,
- 104952.00068589712,
- 104975.99999999993,
- 105000.00068584486,
- 105024.00274327511,
- 105048.00617213396,
- 105072.0109722647,
- 105096.0171435107,
- 105120.02468571534,
- 105144.03359872208,
- 105168.04388237436,
- 105192.05553651576,
- 105216.06856098982,
- 105240.08295564017,
- 105264.09872031047,
- 105288.11585484444,
- 105312.13435908582,
- 105336.1542328784,
- 105360.17547606604,
- 105384.19808849262,
- 105408.22207000206,
- 105432.24742043833,
- 105456.27413964548,
- 105480.30222746753,
- 105504.33168374863,
- 105528.36250833291,
- 105552.39470106458,
- 105576.42826178786,
- 105600.46319034706,
- 105624.49948658649,
- 105648.53715035053,
- 105672.5761814836,
- 105696.61657983017,
- 105720.65834523473,
- 105744.70147754184,
- 105768.7459765961,
- 105792.79184224214,
- 105816.83907432464,
- 105840.88767268835,
- 105864.93763717801,
- 105888.98896763846,
- 105913.04166391456,
- 105937.09572585119,
- 105961.15115329332,
- 105985.20794608595,
- 106009.26610407409,
- 106033.32562710284,
- 106057.38651501729,
- 106081.44876766266,
- 106105.51238488412,
- 106129.57736652695,
- 106153.64371243643,
- 106177.71142245791,
- 106201.78049643678,
- 106225.85093421848,
- 106249.92273564848,
- 106273.99590057228,
- 106298.07042883546,
- 106322.14632028362,
- 106346.22357476239,
- 106370.30219211751,
- 106394.38217219469,
- 106418.46351483969,
- 106442.54621989837,
- 106466.63028721658,
- 106490.71571664025,
- 106514.80250801529,
- 106538.89066118775,
- 106562.98017600364,
- 106587.07105230905,
- 106611.16328995011,
- 106635.25688877302,
- 106659.35184862395,
- 106683.44816934918,
- 106707.54585079502,
- 106731.64489280782,
- 106755.74529523395,
- 106779.84705791986,
- 106803.95018071201,
- 106828.05466345693,
- 106852.16050600118,
- 106876.26770819137,
- 106900.37626987413,
- 106924.48619089619,
- 106948.59747110425,
- 106972.71011034511,
- 106996.82410846559,
- 107020.93946531253,
- 107045.05618073288,
- 107069.17425457356,
- 107093.29368668159,
- 107117.41447690397,
- 107141.53662508781,
- 107165.66013108024,
- 107189.7849947284,
- 107213.91121587952,
- 107238.03879438085,
- 107262.16773007967,
- 107286.29802282334,
- 107310.42967245923,
- 107334.56267883476,
- 107358.69704179741,
- 107382.83276119467,
- 107406.96983687414,
- 107431.10826868335,
- 107455.24805646999,
- 107479.38920008171,
- 107503.53169936626,
- 107527.67555417139,
- 107551.82076434491,
- 107575.96732973469,
- 107600.11525018861,
- 107624.26452555459,
- 107648.41515568066,
- 107672.56714041479,
- 107696.72047960508,
- 107720.87517309963,
- 107745.03122074658,
- 107769.18862239413,
- 107793.34737789053,
- 107817.50748708403,
- 107841.66894982298,
- 107865.83176595572,
- 107889.99593533068,
- 107914.16145779629,
- 107938.32833320105,
- 107962.49656139348,
- 107986.66614222217,
- 108010.83707553572,
- 108035.00936118282,
- 108059.18299901215,
- 108083.35798887245,
- 108107.53433061253,
- 108131.71202408121,
- 108155.89106912735,
- 108180.07146559987,
- 108204.25321334775,
- 108228.43631221994,
- 108252.62076206553,
- 108276.80656273357,
- 108300.99371407321,
- 108325.18221593359,
- 108349.37206816394,
- 108373.56327061349,
- 108397.75582313156,
- 108421.94972556747,
- 108446.1449777706,
- 108470.34157959036,
- 108494.53953087622,
- 108518.73883147769,
- 108542.93948124432,
- 108567.14148002568,
- 108591.34482767139,
- 108615.54952403114,
- 108639.75556895464,
- 108663.96296229165,
- 108688.17170389196,
- 108712.38179360541,
- 108736.59323128188,
- 108760.80601677128,
- 108785.02014992358,
- 108809.23563058881,
- 108833.45245861699,
- 108857.67063385822,
- 108881.89015616261,
- 108906.11102538036,
- 108930.33324136167,
- 108954.55680395682,
- 108978.78171301607,
- 109003.00796838976,
- 109027.23556992831,
- 109051.46451748211,
- 109075.69481090162,
- 109099.92645003737,
- 109124.15943473989,
- 109148.39376485976,
- 109172.62944024763,
- 109196.86646075416,
- 109221.10482623006,
- 109245.34453652608,
- 109269.58559149304,
- 109293.82799098175,
- 109318.07173484311,
- 109342.31682292801,
- 109366.56325508743,
- 109390.81103117237,
- 109415.06015103387,
- 109439.31061452301,
- 109463.56242149093,
- 109487.8155717888,
- 109512.07006526781,
- 109536.3259017792,
- 109560.58308117429,
- 109584.8416033044,
- 109609.1014680209,
- 109633.36267517522,
- 109657.62522461878,
- 109681.88911620311,
- 109706.15434977971,
- 109730.4209252002,
- 109754.68884231619,
- 109778.95810097932,
- 109803.22870104131,
- 109827.50064235389,
- 109851.77392476884,
- 109876.04854813802,
- 109900.32451231324,
- 109924.60181714644,
- 109948.88046248957,
- 109973.1604481946,
- 109997.44177411357,
- 110021.72444009855,
- 110046.00844600165,
- 110070.29379167501,
- 110094.58047697082,
- 110118.86850174134,
- 110143.15786583882,
- 110167.44856911557,
- 110191.74061142397,
- 110216.03399261639,
- 110240.32871254528,
- 110264.62477106311,
- 110288.9221680224,
- 110313.22090327571,
- 110337.52097667565,
- 110361.82238807483,
- 110386.12513732594,
- 110410.42922428172,
- 110434.73464879491,
- 110459.04141071832,
- 110483.34950990479,
- 110507.6589462072,
- 110531.96971947847,
- 110556.28182957157,
- 110580.5952763395,
- 110604.91005963532,
- 110629.22617931209,
- 110653.54363522294,
- 110677.86242722106,
- 110702.18255515963,
- 110726.50401889188,
- 110750.82681827113,
- 110775.1509531507,
- 110799.47642338395,
- 110823.80322882428,
- 110848.13136932514,
- 110872.46084474004,
- 110896.79165492248,
- 110921.12379972603,
- 110945.4572790043,
- 110969.79209261097,
- 110994.12824039967,
- 111018.46572222417,
- 111042.80453793822,
- 111067.14468739564,
- 111091.48617045028,
- 111115.82898695602,
- 111140.1731367668,
- 111164.51861973655,
- 111188.86543571933,
- 111213.21358456917,
- 111237.56306614014,
- 111261.91388028639,
- 111286.26602686207,
- 111310.61950572141,
- 111334.97431671864,
- 111359.33045970804,
- 111383.68793454397,
- 111408.04674108078,
- 111432.40687917286,
- 111456.76834867468,
- 111481.13114944073,
- 111505.49528132551,
- 111529.86074418361,
- 111554.22753786964,
- 111578.59566223821,
- 111602.96511714405,
- 111627.33590244185,
- 111651.7080179864,
- 111676.08146363248,
- 111700.45623923496,
- 111724.8323446487,
- 111749.20977972864,
- 111773.58854432974,
- 111797.96863830699,
- 111822.35006151545,
- 111846.73281381019,
- 111871.11689504632,
- 111895.50230507903,
- 111919.8890437635,
- 111944.27711095495,
- 111968.6665065087,
- 111993.05723028004,
- 112017.44928212435,
- 112041.842661897,
- 112066.23736945343,
- 112090.63340464912,
- 112115.03076733962,
- 112139.42945738042,
- 112163.82947462716,
- 112188.23081893545,
- 112212.63349016097,
- 112237.03748815943,
- 112261.44281278658,
- 112285.84946389822,
- 112310.25744135017,
- 112334.66674499828,
- 112359.07737469849,
- 112383.48933030672,
- 112407.90261167898,
- 112432.31721867126,
- 112456.73315113965,
- 112481.15040894024,
- 112505.56899192919,
- 112529.98889996267,
- 112554.41013289688,
- 112578.8326905881,
- 112603.25657289263,
- 112627.68177966679,
- 112652.10831076698,
- 112676.53616604958,
- 112700.96534537108,
- 112725.39584858794,
- 112749.82767555672,
- 112774.26082613398,
- 112798.6953001763,
- 112823.13109754038,
- 112847.56821808286,
- 112872.00666166049,
- 112896.44642813003,
- 112920.88751734827,
- 112945.32992917208,
- 112969.77366345831,
- 112994.21872006389,
- 113018.66509884578,
- 113043.11279966099,
- 113067.56182236652,
- 113092.01216681948,
- 113116.46383287695,
- 113140.9168203961,
- 113165.37112923413,
- 113189.82675924824,
- 113214.28371029573,
- 113238.74198223387,
- 113263.20157492002,
- 113287.66248821157,
- 113312.12472196593,
- 113336.58827604055,
- 113361.05315029295,
- 113385.51934458067,
- 113409.98685876124,
- 113434.45569269233,
- 113458.92584623155,
- 113483.39731923661,
- 113507.87011156522,
- 113532.34422307517,
- 113556.81965362425,
- 113581.2964030703,
- 113605.77447127122,
- 113630.25385808491,
- 113654.73456336933,
- 113679.2165869825,
- 113703.69992878241,
- 113728.18458862718,
- 113752.67056637487,
- 113777.15786188368,
- 113801.64647501177,
- 113826.13640561736,
- 113850.62765355874,
- 113875.12021869418,
- 113899.61410088204,
- 113924.1092999807,
- 113948.60581584855,
- 113973.10364834407,
- 113997.60279732574,
- 114022.1032626521,
- 114046.60504418171,
- 114071.10814177318,
- 114095.61255528514,
- 114120.11828457628,
- 114144.62532950533,
- 114169.13368993104,
- 114193.6433657122,
- 114218.15435670764,
- 114242.66666277625,
- 114267.18028377694,
- 114291.69521956862,
- 114316.21147001031,
- 114340.72903496103,
- 114365.24791427983,
- 114389.7681078258,
- 114414.2896154581,
- 114438.81243703589,
- 114463.33657241837,
- 114487.8620214648,
- 114512.38878403447,
- 114536.91685998671,
- 114561.44624918087,
- 114585.97695147636,
- 114610.5089667326,
- 114635.04229480909,
- 114659.57693556532,
- 114684.11288886084,
- 114708.65015455526,
- 114733.18873250818,
- 114757.72862257928,
- 114782.26982462825,
- 114806.81233851484,
- 114831.35616409882,
- 114855.90130123998,
- 114880.44774979822,
- 114904.99550963337,
- 114929.5445806054,
- 114954.09496257425,
- 114978.64665539992,
- 115003.19965894247,
- 115027.75397306195,
- 115052.30959761847,
- 115076.86653247218,
- 115101.42477748329,
- 115125.984332512,
- 115150.54519741859,
- 115175.10737206334,
- 115199.67085630659,
- 115224.23565000873,
- 115248.80175303014,
- 115273.3691652313,
- 115297.93788647266,
- 115322.50791661476,
- 115347.07925551817,
- 115371.65190304347,
- 115396.22585905129,
- 115420.80112340231,
- 115445.37769595724,
- 115469.95557657682,
- 115494.53476512182,
- 115519.11526145306,
- 115543.69706543141,
- 115568.28017691776,
- 115592.86459577303,
- 115617.4503218582,
- 115642.03735503425,
- 115666.62569516223,
- 115691.21534210323,
- 115715.80629571836,
- 115740.39855586876,
- 115764.99212241563,
- 115789.58699522018,
- 115814.18317414368,
- 115838.78065904744,
- 115863.37944979276,
- 115887.97954624105,
- 115912.5809482537,
- 115937.18365569216,
- 115961.78766841792,
- 115986.39298629249,
- 116010.99960917742,
- 116035.60753693432,
- 116060.21676942479,
- 116084.82730651053,
- 116109.43914805322,
- 116134.0522939146,
- 116158.66674395646,
- 116183.2824980406,
- 116207.89955602887,
- 116232.51791778316,
- 116257.13758316539,
- 116281.75855203751,
- 116306.38082426153,
- 116331.00439969949,
- 116355.62927821343,
- 116380.25545966547,
- 116404.88294391775,
- 116429.51173083246,
- 116454.14182027178,
- 116478.77321209799,
- 116503.40590617337,
- 116528.03990236025,
- 116552.67520052097,
- 116577.31180051794,
- 116601.94970221359,
- 116626.5889054704,
- 116651.22941015086,
- 116675.87121611751,
- 116700.51432323294,
- 116725.15873135976,
- 116749.8044403606,
- 116774.45145009817,
- 116799.0997604352,
- 116823.74937123443,
- 116848.40028235866,
- 116873.05249367072,
- 116897.70600503348,
- 116922.36081630984,
- 116947.01692736275,
- 116971.67433805518,
- 116996.33304825013,
- 117020.99305781067,
- 117045.65436659988,
- 117070.31697448085,
- 117094.98088131678,
- 117119.64608697082,
- 117144.31259130624,
- 117168.98039418629,
- 117193.64949547425,
- 117218.31989503348,
- 117242.99159272734,
- 117267.66458841923,
- 117292.33888197262,
- 117317.01447325097,
- 117341.6913621178,
- 117366.36954843666,
- 117391.04903207115,
- 117415.72981288488,
- 117440.41189074152,
- 117465.09526550474,
- 117489.77993703831,
- 117514.46590520597,
- 117539.15316987153,
- 117563.84173089883,
- 117588.53158815173,
- 117613.22274149416,
- 117637.91519079007,
- 117662.60893590341,
- 117687.30397669821,
- 117712.00031303853,
- 117736.69794478847,
- 117761.39687181212,
- 117786.09709397367,
- 117810.7986111373,
- 117835.50142316725,
- 117860.20552992777,
- 117884.91093128319,
- 117909.6176270978,
- 117934.32561723603,
- 117959.03490156225,
- 117983.74547994092,
- 118008.45735223651,
- 118033.17051831353,
- 118057.88497803656,
- 118082.60073127014,
- 118107.31777787894,
- 118132.03611772758,
- 118156.75575068076,
- 118181.47667660323,
- 118206.19889535972,
- 118230.92240681504,
- 118255.64721083404,
- 118280.37330728157,
- 118305.10069602253,
- 118329.82937692189,
- 118354.55934984458,
- 118379.29061465565,
- 118404.02317122012,
- 118428.75701940308,
- 118453.49215906965,
- 118478.22859008498,
- 118502.96631231424,
- 118527.70532562268,
- 118552.44562987552,
- 118577.18722493808,
- 118601.93011067568,
- 118626.67428695368,
- 118651.41975363747,
- 118676.16651059251,
- 118700.91455768423,
- 118725.66389477813,
- 118750.41452173979,
- 118775.16643843475,
- 118799.91964472862,
- 118824.67414048707,
- 118849.42992557574,
- 118874.18699986035,
- 118898.94536320666,
- 118923.70501548045,
- 118948.46595654752,
- 118973.22818627374,
- 118997.99170452499,
- 119022.7565111672,
- 119047.52260606633,
- 119072.28998908834,
- 119097.0586600993,
- 119121.82861896523,
- 119146.59986555226,
- 119171.3723997265,
- 119196.14622135412,
- 119220.92133030134,
- 119245.69772643436,
- 119270.47540961947,
- 119295.25437972297,
- 119320.03463661121,
- 119344.81618015055,
- 119369.5990102074,
- 119394.38312664822,
- 119419.16852933947,
- 119443.95521814766,
- 119468.74319293935,
- 119493.53245358112,
- 119518.32299993958,
- 119543.11483188139,
- 119567.90794927324,
- 119592.70235198183,
- 119617.49803987393,
- 119642.29501281632,
- 119667.09327067583,
- 119691.89281331931,
- 119716.69364061367,
- 119741.49575242582,
- 119766.29914862274,
- 119791.10382907141,
- 119815.90979363887,
- 119840.71704219218,
- 119865.52557459843,
- 119890.33539072477,
- 119915.14649043836,
- 119939.95887360642,
- 119964.77254009615,
- 119989.58748977486,
- 120014.40372250983,
- 120039.22123816841,
- 120064.04003661797,
- 120088.86011772591,
- 120113.6814813597,
- 120138.5041273868,
- 120163.3280556747,
- 120188.15326609099,
- 120212.97975850321,
- 120237.807532779,
- 120262.63658878599,
- 120287.46692639188,
- 120312.29854546436,
- 120337.13144587121,
- 120361.9656274802,
- 120386.80109015915,
- 120411.63783377589,
- 120436.47585819835,
- 120461.31516329442,
- 120486.15574893207,
- 120510.99761497928,
- 120535.84076130406,
- 120560.68518777451,
- 120585.53089425867,
- 120610.3778806247,
- 120635.22614674074,
- 120660.07569247499,
- 120684.92651769568,
- 120709.77862227106,
- 120734.63200606944,
- 120759.48666895913,
- 120784.3426108085,
- 120809.19983148595,
- 120834.05833085992,
- 120858.91810879884,
- 120883.77916517125,
- 120908.64149984565,
- 120933.5051126906,
- 120958.37000357473,
- 120983.23617236665,
- 121008.10361893504,
- 121032.97234314861,
- 121057.84234487606,
- 121082.71362398617,
- 121107.58618034775,
- 121132.46001382964,
- 121157.33512430069,
- 121182.21151162982,
- 121207.08917568595,
- 121231.96811633807,
- 121256.84833345517,
- 121281.72982690629,
- 121306.61259656049,
- 121331.49664228689,
- 121356.38196395461,
- 121381.26856143285,
- 121406.15643459078,
- 121431.04558329767,
- 121455.93600742276,
- 121480.82770683538,
- 121505.72068140487,
- 121530.61493100057,
- 121555.51045549192,
- 121580.40725474835,
- 121605.30532863933,
- 121630.20467703436,
- 121655.10529980299,
- 121680.00719681478,
- 121704.91036793934,
- 121729.81481304632,
- 121754.72053200539,
- 121779.62752468624,
- 121804.53579095862,
- 121829.44533069231,
- 121854.3561437571,
- 121879.26823002285,
- 121904.1815893594,
- 121929.09622163669,
- 121954.01212672464,
- 121978.92930449323,
- 122003.84775481246,
- 122028.76747755238,
- 122053.68847258303,
- 122078.61073977455,
- 122103.53427899707,
- 122128.45909012076,
- 122153.38517301581,
- 122178.31252755247,
- 122203.24115360099,
- 122228.17105103172,
- 122253.10221971494,
- 122278.03465952107,
- 122302.96837032049,
- 122327.90335198362,
- 122352.83960438096,
- 122377.777127383,
- 122402.71592086025,
- 122427.65598468333,
- 122452.59731872278,
- 122477.53992284928,
- 122502.48379693348,
- 122527.42894084606,
- 122552.37535445779,
- 122577.32303763942,
- 122602.27199026172,
- 122627.22221219557,
- 122652.17370331181,
- 122677.12646348133,
- 122702.08049257506,
- 122727.03579046397,
- 122751.99235701906,
- 122776.95019211136,
- 122801.9092956119,
- 122826.8696673918,
- 122851.83130732219,
- 122876.79421527422,
- 122901.75839111909,
- 122926.72383472799,
- 122951.69054597223,
- 122976.65852472307,
- 123001.62777085182,
- 123026.59828422987,
- 123051.57006472857,
- 123076.54311221937,
- 123101.5174265737,
- 123126.49300766307,
- 123151.46985535898,
- 123176.44796953299,
- 123201.42735005668,
- 123226.40799680166,
- 123251.38990963959,
- 123276.37308844214,
- 123301.35753308103,
- 123326.343243428,
- 123351.33021935483,
- 123376.31846073334,
- 123401.30796743535,
- 123426.29873933276,
- 123451.29077629748,
- 123476.28407820144,
- 123501.2786449166,
- 123526.27447631498,
- 123551.27157226863,
- 123576.26993264959,
- 123601.26955732999,
- 123626.27044618195,
- 123651.27259907764,
- 123676.27601588926,
- 123701.28069648903,
- 123726.28664074924,
- 123751.29384854218,
- 123776.30231974016,
- 123801.31205421555,
- 123826.32305184075,
- 123851.33531248817,
- 123876.34883603029,
- 123901.36362233957,
- 123926.37967128855,
- 123951.39698274979,
- 123976.41555659588,
- 124001.43539269941,
- 124026.45649093305,
- 124051.47885116948,
- 124076.50247328142,
- 124101.5273571416,
- 124126.55350262282,
- 124151.58090959788,
- 124176.60957793961,
- 124201.63950752091,
- 124226.67069821467,
- 124251.70314989384,
- 124276.73686243138,
- 124301.7718357003,
- 124326.80806957364,
- 124351.84556392446,
- 124376.88431862585,
- 124401.92433355095,
- 124426.96560857294,
- 124452.00814356498,
- 124477.05193840031,
- 124502.0969929522,
- 124527.14330709392,
- 124552.19088069882,
- 124577.23971364023,
- 124602.28980579154,
- 124627.34115702618,
- 124652.3937672176,
- 124677.44763623926,
- 124702.50276396469,
- 124727.55915026742,
- 124752.61679502104,
- 124777.67569809916,
- 124802.73585937542,
- 124827.79727872348,
- 124852.85995601704,
- 124877.92389112986,
- 124902.98908393568,
- 124928.05553430831,
- 124953.1232421216,
- 124978.19220724938,
- 125003.26242956554,
- 125028.33390894404,
- 125053.40664525882,
- 125078.48063838384,
- 125103.55588819318,
- 125128.63239456083,
- 125153.71015736091,
- 125178.78917646752,
- 125203.86945175481,
- 125228.95098309696,
- 125254.03377036817,
- 125279.1178134427,
- 125304.20311219479,
- 125329.28966649878,
- 125354.37747622898,
- 125379.46654125977,
- 125404.55686146552,
- 125429.6484367207,
- 125454.74126689974,
- 125479.83535187715,
- 125504.93069152744,
- 125530.02728572517,
- 125555.12513434493,
- 125580.22423726133,
- 125605.32459434902,
- 125630.4262054827,
- 125655.52907053704,
- 125680.63318938682,
- 125705.73856190679,
- 125730.84518797178,
- 125755.9530674566,
- 125781.06220023613,
- 125806.17258618528,
- 125831.28422517896,
- 125856.39711709213,
- 125881.51126179981,
- 125906.62665917698,
- 125931.74330909875,
- 125956.86121144016,
- 125981.98036607634,
- 126007.10077288245,
- 126032.22243173365,
- 126057.34534250517,
- 126082.46950507225,
- 126107.59491931014,
- 126132.72158509417,
- 126157.84950229966,
- 126182.97867080198,
- 126208.10909047653,
- 126233.24076119871,
- 126258.37368284403,
- 126283.50785528794,
- 126308.64327840599,
- 126333.77995207369,
- 126358.91787616667,
- 126384.0570505605,
- 126409.19747513086,
- 126434.3391497534,
- 126459.48207430386,
- 126484.62624865794,
- 126509.77167269142,
- 126534.9183462801,
- 126560.06626929982,
- 126585.21544162642,
- 126610.36586313581,
- 126635.51753370393,
- 126660.67045320668,
- 126685.82462152008,
- 126710.98003852014,
- 126736.13670408291,
- 126761.29461808444,
- 126786.45378040087,
- 126811.61419090834,
- 126836.77584948298,
- 126861.93875600102,
- 126887.10291033868,
- 126912.26831237224,
- 126937.43496197795,
- 126962.60285903217,
- 126987.77200341123,
- 127012.94239499152,
- 127038.11403364947,
- 127063.2869192615,
- 127088.46105170409,
- 127113.63643085376,
- 127138.81305658702,
- 127163.99092878048,
- 127189.17004731069,
- 127214.35041205429,
- 127239.53202288797,
- 127264.71487968838,
- 127289.89898233226,
- 127315.08433069635,
- 127340.27092465744,
- 127365.45876409234,
- 127390.64784887788,
- 127415.83817889093,
- 127441.02975400841,
- 127466.22257410725,
- 127491.41663906439,
- 127516.61194875685,
- 127541.80850306165,
- 127567.00630185583,
- 127592.20534501647,
- 127617.4056324207,
- 127642.60716394568,
- 127667.80993946856,
- 127693.01395886653,
- 127718.21922201688,
- 127743.42572879682,
- 127768.63347908368,
- 127793.84247275478,
- 127819.05270968749,
- 127844.26418975917,
- 127869.47691284724,
- 127894.69087882918,
- 127919.90608758242,
- 127945.12253898452,
- 127970.34023291297,
- 127995.55916924537,
- 128020.77934785932,
- 128046.00076863244,
- 128071.22343144237,
- 128096.44733616684,
- 128121.67248268353,
- 128146.89887087021,
- 128172.12650060465,
- 128197.35537176467,
- 128222.5854842281,
- 128247.81683787282,
- 128273.04943257671,
- 128298.28326821771,
- 128323.51834467379,
- 128348.75466182294,
- 128373.99221954317,
- 128399.23101771252,
- 128424.47105620909,
- 128449.71233491098,
- 128474.95485369631,
- 128500.19861244329,
- 128525.44361103009,
- 128550.68984933494,
- 128575.93732723613,
- 128601.18604461191,
- 128626.43600134061,
- 128651.68719730059,
- 128676.93963237021,
- 128702.1933064279,
- 128727.44821935208,
- 128752.70437102125,
- 128777.96176131385,
- 128803.22039010846,
- 128828.48025728362,
- 128853.74136271792,
- 128879.00370628996,
- 128904.26728787841,
- 128929.53210736193,
- 128954.79816461923,
- 128980.06545952905,
- 129005.33399197015,
- 129030.60376182134,
- 129055.87476896142,
- 129081.14701326926,
- 129106.42049462376,
- 129131.6952129038,
- 129156.97116798835,
- 129182.24835975636,
- 129207.52678808685,
- 129232.80645285884,
- 129258.08735395141,
- 129283.36949124365,
- 129308.65286461466,
- 129333.9374739436,
- 129359.22331910966,
- 129384.51039999202,
- 129409.79871646997,
- 129435.08826842274,
- 129460.37905572963,
- 129485.67107826998,
- 129510.96433592314,
- 129536.25882856851,
- 129561.55455608548,
- 129586.85151835352,
- 129612.14971525209,
- 129637.4491466607,
- 129662.74981245887,
- 129688.0517125262,
- 129713.35484674224,
- 129738.65921498663,
- 129763.96481713903,
- 129789.27165307909,
- 129814.57972268655,
- 129839.88902584116,
- 129865.19956242264,
- 129890.51133231082,
- 129915.82433538554,
- 129941.13857152662,
- 129966.45404061397,
- 129991.7707425275,
- 130017.08867714716,
- 130042.4078443529,
- 130067.72824402474,
- 130093.04987604271,
- 130118.37274028687,
- 130143.69683663732,
- 130169.02216497416,
- 130194.34872517755,
- 130219.67651712766,
- 130245.0055407047,
- 130270.33579578891,
- 130295.66728226055,
- 130320.99999999991,
- 130346.33394888733,
- 130371.66912880314,
- 130397.00553962773,
- 130422.34318124152,
- 130447.68205352494,
- 130473.02215635845,
- 130498.36348962256,
- 130523.70605319779,
- 130549.0498469647,
- 130574.39487080388,
- 130599.74112459592,
- 130625.08860822149,
- 130650.43732156123,
- 130675.78726449587,
- 130701.13843690613,
- 130726.49083867275,
- 130751.84446967654,
- 130777.19932979831,
- 130802.5554189189,
- 130827.91273691918,
- 130853.27128368006,
- 130878.63105908247,
- 130903.99206300738,
- 130929.35429533575,
- 130954.71775594862,
- 130980.08244472703,
- 131005.44836155206,
- 131030.81550630482,
- 131056.18387886642,
- 131081.55347911804,
- 131106.92430694087,
- 131132.29636221612,
- 131157.66964482504,
- 131183.0441546489,
- 131208.41989156904,
- 131233.79685546676,
- 131259.17504622342,
- 131284.55446372041,
- 131309.93510783918,
- 131335.31697846117,
- 131360.70007546784,
- 131386.0843987407,
- 131411.46994816128,
- 131436.85672361116,
- 131462.24472497194,
- 131487.63395212521,
- 131513.02440495262,
- 131538.41608333588,
- 131563.80898715663,
- 131589.2031162967,
- 131614.59847063778,
- 131639.9950500617,
- 131665.39285445024,
- 131690.79188368531,
- 131716.19213764873,
- 131741.59361622241,
- 131766.99631928833,
- 131792.40024672839,
- 131817.80539842462,
- 131843.21177425905,
- 131868.61937411371,
- 131894.02819787065,
- 131919.43824541202,
- 131944.84951661993,
- 131970.26201137656,
- 131995.67572956407,
- 132021.09067106468,
- 132046.50683576067,
- 132071.9242235343,
- 132097.34283426782,
- 132122.76266784366,
- 132148.1837241441,
- 132173.60600305157,
- 132199.02950444847,
- 132224.45422821722,
- 132249.88017424036,
- 132275.30734240031,
- 132300.73573257966,
- 132326.16534466096,
- 132351.59617852676,
- 132377.02823405969,
- 132402.46151114244,
- 132427.89600965759,
- 132453.33172948789,
- 132478.76867051609,
- 132504.20683262491,
- 132529.64621569714,
- 132555.08681961559,
- 132580.5286442631,
- 132605.97168952253,
- 132631.41595527678,
- 132656.86144140881,
- 132682.30814780149,
- 132707.75607433787,
- 132733.20522090094,
- 132758.65558737374,
- 132784.10717363929,
- 132809.55997958075,
- 132835.01400508118,
- 132860.46925002377,
- 132885.92571429166,
- 132911.38339776811,
- 132936.84230033628,
- 132962.30242187946,
- 132987.76376228096,
- 133013.22632142407,
- 133038.69009919214,
- 133064.15509546854,
- 133089.62131013666,
- 133115.08874307995,
- 133140.55739418184,
- 133166.02726332581,
- 133191.49835039541,
- 133216.97065527414,
- 133242.44417784561,
- 133267.91891799335,
- 133293.39487560102,
- 133318.87205055228,
- 133344.35044273079,
- 133369.83005202023,
- 133395.31087830439,
- 133420.79292146701,
- 133446.27618139185,
- 133471.76065796276,
- 133497.24635106357,
- 133522.73326057816,
- 133548.22138639039,
- 133573.71072838426,
- 133599.20128644365,
- 133624.69306045261,
- 133650.1860502951,
- 133675.68025585517,
- 133701.1756770169,
- 133726.67231366437,
- 133752.17016568172,
- 133777.66923295305,
- 133803.16951536259,
- 133828.67101279454,
- 133854.17372513309,
- 133879.67765226253,
- 133905.18279406714,
- 133930.68915043125,
- 133956.19672123916,
- 133981.70550637526,
- 134007.21550572399,
- 134032.7267191697,
- 134058.23914659687,
- 134083.75278789,
- 134109.26764293358,
- 134134.78371161217,
- 134160.30099381026,
- 134185.8194894125,
- 134211.33919830353,
- 134236.8601203679,
- 134262.38225549037,
- 134287.90560355558,
- 134313.43016444831,
- 134338.95593805326,
- 134364.48292425525,
- 134390.01112293909,
- 134415.54053398955,
- 134441.07115729159,
- 134466.60299273001,
- 134492.1360401898,
- 134517.67029955584,
- 134543.20577071316,
- 134568.74245354676,
- 134594.28034794159,
- 134619.81945378278,
- 134645.35977095537,
- 134670.90129934452,
- 134696.4440388353,
- 134721.98798931291,
- 134747.53315066252,
- 134773.07952276937,
- 134798.62710551871,
- 134824.17589879577,
- 134849.72590248589,
- 134875.27711647438,
- 134900.82954064661,
- 134926.38317488792,
- 134951.93801908373,
- 134977.49407311951,
- 135003.05133688069,
- 135028.60981025276,
- 135054.16949312127,
- 135079.73038537172,
- 135105.29248688967,
- 135130.85579756077,
- 135156.42031727062,
- 135181.98604590484,
- 135207.55298334916,
- 135233.12112948924,
- 135258.69048421088,
- 135284.26104739975,
- 135309.83281894168,
- 135335.4057987225,
- 135360.97998662802,
- 135386.55538254412,
- 135412.13198635669,
- 135437.70979795168,
- 135463.28881721498,
- 135488.86904403262,
- 135514.45047829056,
- 135540.03311987486,
- 135565.61696867159,
- 135591.20202456677,
- 135616.78828744654,
- 135642.37575719706,
- 135667.96443370447,
- 135693.55431685498,
- 135719.14540653475,
- 135744.73770263011,
- 135770.33120502727,
- 135795.92591361253,
- 135821.52182827223,
- 135847.11894889272,
- 135872.7172753604,
- 135898.31680756161,
- 135923.91754538284,
- 135949.51948871053,
- 135975.12263743114,
- 136000.72699143123,
- 136026.33255059729,
- 136051.93931481591,
- 136077.54728397369,
- 136103.15645795723,
- 136128.76683665317,
- 136154.37841994822,
- 136179.99120772901,
- 136205.60519988232,
- 136231.2203962949,
- 136256.83679685349,
- 136282.45440144493,
- 136308.07320995603,
- 136333.69322227367,
- 136359.31443828469,
- 136384.93685787608,
- 136410.56048093468,
- 136436.18530734754,
- 136461.81133700156,
- 136487.43856978384,
- 136513.06700558143,
- 136538.6966442813,
- 136564.32748577066,
- 136589.95952993655,
- 136615.59277666616,
- 136641.22722584667,
- 136666.86287736523,
- 136692.49973110916,
- 136718.13778696564,
- 136743.77704482197,
- 136769.41750456547,
- 136795.05916608346,
- 136820.70202926331,
- 136846.34609399244,
- 136871.99136015819,
- 136897.63782764805,
- 136923.28549634948,
- 136948.93436614997,
- 136974.58443693706,
- 137000.23570859825,
- 137025.88818102115,
- 137051.54185409332,
- 137077.19672770242,
- 137102.85280173609,
- 137128.51007608202,
- 137154.16855062786,
- 137179.82822526142,
- 137205.48909987041,
- 137231.15117434258,
- 137256.8144485658,
- 137282.47892242789,
- 137308.14459581667,
- 137333.81146862009,
- 137359.47954072602,
- 137385.14881202241,
- 137410.81928239719,
- 137436.49095173844,
- 137462.16381993407,
- 137487.83788687221,
- 137513.51315244089,
- 137539.18961652822,
- 137564.86727902229,
- 137590.54613981131,
- 137616.22619878338,
- 137641.90745582676,
- 137667.58991082967,
- 137693.27356368033,
- 137718.95841426702,
- 137744.64446247809,
- 137770.33170820182,
- 137796.02015132661,
- 137821.70979174081,
- 137847.40062933284,
- 137873.09266399115,
- 137898.78589560417,
- 137924.48032406042,
- 137950.17594924837,
- 137975.8727710566,
- 138001.57078937365,
- 138027.27000408815,
- 138052.97041508864,
- 138078.67202226384,
- 138104.3748255024,
- 138130.07882469296,
- 138155.78401972432,
- 138181.49041048516,
- 138207.1979968643,
- 138232.9067787505,
- 138258.61675603263,
- 138284.32792859949,
- 138310.04029633995,
- 138335.75385914298,
- 138361.46861689744,
- 138387.18456949232,
- 138412.90171681659,
- 138438.62005875923,
- 138464.33959520931,
- 138490.06032605586,
- 138515.78225118798,
- 138541.50537049473,
- 138567.2296838653,
- 138592.95519118884,
- 138618.68189235451,
- 138644.40978725153,
- 138670.13887576913,
- 138695.86915779658,
- 138721.60063322316,
- 138747.33330193823,
- 138773.06716383106,
- 138798.80221879104,
- 138824.53846670757,
- 138850.27590747006,
- 138876.01454096794,
- 138901.7543670907,
- 138927.49538572782,
- 138953.2375967688,
- 138978.9810001032,
- 139004.72559562061,
- 139030.47138321059,
- 139056.2183627628,
- 139081.96653416683,
- 139107.71589731239,
- 139133.46645208917,
- 139159.21819838689,
- 139184.97113609532,
- 139210.72526510421,
- 139236.48058530336,
- 139262.23709658257,
- 139287.99479883176,
- 139313.75369194071,
- 139339.51377579942,
- 139365.27505029776,
- 139391.03751532568,
- 139416.80117077316,
- 139442.56601653024,
- 139468.33205248689,
- 139494.09927853322,
- 139519.86769455927,
- 139545.63730045516,
- 139571.408096111,
- 139597.18008141697,
- 139622.95325626322,
- 139648.72762054001,
- 139674.5031741375,
- 139700.27991694602,
- 139726.05784885579,
- 139751.83696975713,
- 139777.61727954043,
- 139803.39877809596,
- 139829.18146531415,
- 139854.96534108539,
- 139880.75040530015,
- 139906.53665784886,
- 139932.32409862199,
- 139958.11272751007,
- 139983.90254440365,
- 140009.69354919327,
- 140035.48574176949,
- 140061.27912202294,
- 140087.07368984428,
- 140112.86944512415,
- 140138.66638775321,
- 140164.4645176222,
- 140190.26383462184,
- 140216.06433864293,
- 140241.86602957622,
- 140267.66890731253,
- 140293.47297174268,
- 140319.27822275754,
- 140345.08466024802,
- 140370.89228410498,
- 140396.70109421943,
- 140422.51109048226,
- 140448.32227278448,
- 140474.13464101712,
- 140499.94819507122,
- 140525.76293483781,
- 140551.57886020801,
- 140577.3959710729,
- 140603.21426732364,
- 140629.03374885136,
- 140654.85441554731,
- 140680.67626730262,
- 140706.49930400858,
- 140732.32352555645,
- 140758.1489318375,
- 140783.97552274304,
- 140809.80329816442,
- 140835.63225799298,
- 140861.46240212015,
- 140887.29373043729,
- 140913.12624283586,
- 140938.95993920733,
- 140964.79481944317,
- 140990.63088343487,
- 141016.46813107401,
- 141042.30656225214,
- 141068.14617686081,
- 141093.98697479168,
- 141119.82895593636,
- 141145.6721201865,
- 141171.51646743377,
- 141197.36199756994,
- 141223.20871048668,
- 141249.05660607578,
- 141274.90568422904,
- 141300.75594483822,
- 141326.6073877952,
- 141352.4600129918,
- 141378.31382031992,
- 141404.16880967148,
- 141430.02498093838,
- 141455.8823340126,
- 141481.74086878612,
- 141507.60058515094,
- 141533.46148299909,
- 141559.32356222265,
- 141585.18682271364,
- 141611.05126436421,
- 141636.9168870665,
- 141662.78369071262,
- 141688.65167519479,
- 141714.5208404052,
- 141740.39118623605,
- 141766.26271257963,
- 141792.1354193282,
- 141818.00930637406,
- 141843.88437360956,
- 141869.760620927,
- 141895.6380482188,
- 141921.51665537735,
- 141947.39644229505,
- 141973.27740886438,
- 141999.15955497778,
- 142025.04288052776,
- 142050.92738540689,
- 142076.81306950765,
- 142102.69993272264,
- 142128.58797494444,
- 142154.47719606571,
- 142180.36759597904,
- 142206.25917457714,
- 142232.15193175265,
- 142258.04586739838,
- 142283.94098140698,
- 142309.83727367126,
- 142335.73474408401,
- 142361.63339253806,
- 142387.5332189262,
- 142413.43422314132,
- 142439.33640507635,
- 142465.23976462413,
- 142491.14430167765,
- 142517.05001612983,
- 142542.95690787368,
- 142568.86497680223,
- 142594.77422280848,
- 142620.68464578551,
- 142646.5962456264,
- 142672.50902222423,
- 142698.42297547215,
- 142724.33810526333,
- 142750.25441149093,
- 142776.17189404817,
- 142802.09055282827,
- 142828.01038772447,
- 142853.93139863008,
- 142879.85358543837,
- 142905.77694804268,
- 142931.70148633636,
- 142957.62720021277,
- 142983.55408956532,
- 143009.48215428743,
- 143035.41139427255,
- 143061.34180941415,
- 143087.27339960571,
- 143113.20616474075,
- 143139.14010471283,
- 143165.07521941551,
- 143191.01150874238,
- 143216.94897258704,
- 143242.88761084314,
- 143268.82742340435,
- 143294.76841016437,
- 143320.71057101688,
- 143346.65390585564,
- 143372.59841457437,
- 143398.54409706692,
- 143424.49095322701,
- 143450.43898294857,
- 143476.38818612538,
- 143502.33856265133,
- 143528.29011242036,
- 143554.24283532638,
- 143580.19673126334,
- 143606.1518001252,
- 143632.10804180597,
- 143658.06545619969,
- 143684.02404320039,
- 143709.98380270213,
- 143735.944734599,
- 143761.90683878519,
- 143787.87011515474,
- 143813.83456360188,
- 143839.8001840208,
- 143865.76697630569,
- 143891.73494035081,
- 143917.7040760504,
- 143943.67438329876,
- 143969.6458619902,
- 143995.61851201905,
- 144021.59233327967,
- 144047.56732566646,
- 144073.54348907378,
- 144099.52082339607,
- 144125.49932852783,
- 144151.4790043635,
- 144177.45985079758,
- 144203.44186772458,
- 144229.42505503909,
- 144255.40941263564,
- 144281.39494040885,
- 144307.38163825331,
- 144333.36950606373,
- 144359.35854373468,
- 144385.34875116093,
- 144411.34012823718,
- 144437.33267485813,
- 144463.32639091855,
- 144489.32127631325,
- 144515.31733093705,
- 144541.31455468474,
- 144567.3129474512,
- 144593.3125091313,
- 144619.31323961995,
- 144645.31513881206,
- 144671.31820660262,
- 144697.32244288657,
- 144723.32784755889,
- 144749.33442051467,
- 144775.34216164888,
- 144801.35107085665,
- 144827.36114803303,
- 144853.37239307314,
- 144879.38480587213,
- 144905.39838632516,
- 144931.41313432742,
- 144957.4290497741,
- 144983.44613256046,
- 145009.46438258173,
- 145035.48379973322,
- 145061.50438391021,
- 145087.52613500805,
- 145113.54905292206,
- 145139.57313754765,
- 145165.59838878017,
- 145191.62480651509,
- 145217.65239064783,
- 145243.68114107384,
- 145269.71105768863,
- 145295.74214038774,
- 145321.77438906668,
- 145347.80780362099,
- 145373.84238394629,
- 145399.87812993818,
- 145425.91504149229,
- 145451.95311850426,
- 145477.9923608698,
- 145504.03276848458,
- 145530.07434124436,
- 145556.11707904484,
- 145582.16098178181,
- 145608.20604935108,
- 145634.25228164849,
- 145660.29967856981,
- 145686.34824001096,
- 145712.39796586783,
- 145738.4488560363,
- 145764.50091041232,
- 145790.55412889185,
- 145816.60851137087,
- 145842.66405774537,
- 145868.72076791141,
- 145894.77864176501,
- 145920.83767920226,
- 145946.89788011924,
- 145972.95924441208,
- 145999.02177197693,
- 146025.08546270995,
- 146051.15031650732,
- 146077.21633326527,
- 146103.28351288004,
- 146129.35185524789,
- 146155.42136026506,
- 146181.49202782792,
- 146207.56385783272,
- 146233.63685017588,
- 146259.71100475377,
- 146285.78632146274,
- 146311.86280019928,
- 146337.94044085976,
- 146364.01924334071,
- 146390.09920753856,
- 146416.18033334985,
- 146442.26262067116,
- 146468.34606939898,
- 146494.43067942993,
- 146520.51645066062,
- 146546.60338298764,
- 146572.69147630769,
- 146598.78073051744,
- 146624.87114551352,
- 146650.96272119274,
- 146677.05545745179,
- 146703.14935418745,
- 146729.2444112965,
- 146755.34062867577,
- 146781.43800622207,
- 146807.53654383228,
- 146833.63624140329,
- 146859.73709883197,
- 146885.83911601527,
- 146911.94229285014,
- 146938.04662923355,
- 146964.15212506248,
- 146990.25878023397,
- 147016.36659464505,
- 147042.47556819281,
- 147068.58570077427,
- 147094.6969922866,
- 147120.80944262692,
- 147146.92305169237,
- 147173.03781938017,
- 147199.15374558745,
- 147225.27083021149,
- 147251.38907314953,
- 147277.50847429881,
- 147303.62903355664,
- 147329.75075082036,
- 147355.87362598727,
- 147381.99765895473,
- 147408.12284962015,
- 147434.24919788091,
- 147460.37670363448,
- 147486.50536677826,
- 147512.63518720976,
- 147538.76616482646,
- 147564.89829952587,
- 147591.03159120557,
- 147617.16603976308,
- 147643.30164509601,
- 147669.43840710199,
- 147695.57632567859,
- 147721.71540072354,
- 147747.85563213445,
- 147773.99701980909,
- 147800.13956364512,
- 147826.28326354033,
- 147852.42811939248,
- 147878.57413109933,
- 147904.72129855872,
- 147930.86962166851,
- 147957.01910032652,
- 147983.16973443062,
- 148009.32152387875,
- 148035.47446856883,
- 148061.62856839882,
- 148087.78382326665,
- 148113.94023307035,
- 148140.09779770792,
- 148166.25651707739,
- 148192.41639107687,
- 148218.57741960438,
- 148244.73960255808,
- 148270.90293983606,
- 148297.0674313365,
- 148323.23307695755,
- 148349.39987659742,
- 148375.56783015432,
- 148401.73693752653,
- 148427.90719861226,
- 148454.07861330983,
- 148480.25118151752,
- 148506.42490313368,
- 148532.59977805667,
- 148558.77580618486,
- 148584.95298741665,
- 148611.13132165043,
- 148637.31080878471,
- 148663.49144871789,
- 148689.6732413485,
- 148715.85618657502,
- 148742.040284296,
- 148768.22553440998,
- 148794.41193681557,
- 148820.59949141133,
- 148846.78819809589,
- 148872.97805676793,
- 148899.16906732606,
- 148925.36122966901,
- 148951.55454369547,
- 148977.74900930419,
- 149003.9446263939,
- 149030.1413948634,
- 149056.33931461151,
- 149082.53838553699,
- 149108.73860753875,
- 149134.9399805156,
- 149161.14250436646,
- 149187.34617899026,
- 149213.5510042859,
- 149239.75698015234,
- 149265.96410648854,
- 149292.17238319354,
- 149318.38181016635,
- 149344.59238730598,
- 149370.80411451156,
- 149397.01699168212,
- 149423.23101871679,
- 149449.44619551473,
- 149475.66252197503,
- 149501.87999799693,
- 149528.0986234796,
- 149554.31839832227,
- 149580.53932242419,
- 149606.76139568459,
- 149632.98461800278,
- 149659.20898927809,
- 149685.43450940982,
- 149711.66117829733,
- 149737.88899584001,
- 149764.11796193724,
- 149790.34807648844,
- 149816.57933939309,
- 149842.81175055061,
- 149869.04530986046,
- 149895.28001722222,
- 149921.51587253538,
- 149947.75287569952,
- 149973.99102661415,
- 150000.23032517891,
- 150026.47077129342,
- 150052.71236485732,
- 150078.95510577026,
- 150105.1989939319,
- 150131.444029242,
- 150157.69021160025,
- 150183.93754090639,
- 150210.18601706024,
- 150236.43563996154,
- 150262.68640951012,
- 150288.93832560582,
- 150315.19138814852,
- 150341.44559703805,
- 150367.70095217437,
- 150393.95745345735,
- 150420.21510078697,
- 150446.47389406321,
- 150472.73383318601,
- 150498.99491805542,
- 150525.25714857146,
- 150551.52052463419,
- 150577.78504614369,
- 150604.05071300003,
- 150630.31752510337,
- 150656.58548235384,
- 150682.85458465159,
- 150709.1248318968,
- 150735.39622398972,
- 150761.66876083051,
- 150787.9424423195,
- 150814.21726835691,
- 150840.49323884305,
- 150866.77035367821,
- 150893.04861276277,
- 150919.32801599705,
- 150945.60856328148,
- 150971.89025451642,
- 150998.17308960229,
- 151024.45706843957,
- 151050.74219092872,
- 151077.02845697021,
- 151103.31586646455,
- 151129.60441931229,
- 151155.894115414,
- 151182.1849546702,
- 151208.47693698155,
- 151234.77006224863,
- 151261.06433037209,
- 151287.35974125259,
- 151313.65629479082,
- 151339.95399088747,
- 151366.25282944329,
- 151392.55281035902,
- 151418.85393353543,
- 151445.1561988733,
- 151471.45960627345,
- 151497.76415563675,
- 151524.06984686397,
- 151550.37667985607,
- 151576.68465451393,
- 151602.99377073845,
- 151629.30402843058,
- 151655.61542749128,
- 151681.92796782157,
- 151708.24164932242,
- 151734.55647189484,
- 151760.87243543993,
- 151787.18953985872,
- 151813.50778505235,
- 151839.82717092187,
- 151866.14769736846,
- 151892.46936429327,
- 151918.79217159748,
- 151945.11611918229,
- 151971.44120694889,
- 151997.76743479856,
- 152024.09480263255,
- 152050.42331035214,
- 152076.75295785864,
- 152103.08374505339,
- 152129.41567183775,
- 152155.74873811303,
- 152182.08294378067,
- 152208.41828874208,
- 152234.75477289871,
- 152261.09239615197,
- 152287.43115840337,
- 152313.77105955439,
- 152340.11209950657,
- 152366.45427816146,
- 152392.79759542056,
- 152419.14205118554,
- 152445.48764535793,
- 152471.8343778394,
- 152498.18224853161,
- 152524.53125733617,
- 152550.88140415482,
- 152577.23268888926,
- 152603.58511144121,
- 152629.93867171241,
- 152656.29336960468,
- 152682.64920501978,
- 152709.00617785956,
- 152735.36428802583,
- 152761.72353542043,
- 152788.08391994529,
- 152814.44544150229,
- 152840.80809999333,
- 152867.17189532038,
- 152893.53682738543,
- 152919.90289609041,
- 152946.27010133737,
- 152972.63844302832,
- 152999.00792106529,
- 153025.37853535041,
- 153051.7502857857,
- 153078.12317227334,
- 153104.4971947154,
- 153130.8723530141,
- 153157.24864707157,
- 153183.62607679001,
- 153210.00464207167,
- 153236.38434281875,
- 153262.76517893354,
- 153289.14715031831,
- 153315.53025687535,
- 153341.91449850702,
- 153368.2998751156,
- 153394.68638660354,
- 153421.07403287315,
- 153447.46281382689,
- 153473.85272936718,
- 153500.24377939643,
- 153526.63596381716,
- 153553.02928253182,
- 153579.42373544298,
- 153605.81932245308,
- 153632.21604346478,
- 153658.61389838057,
- 153685.0128871031,
- 153711.41300953497,
- 153737.81426557881,
- 153764.21665513728,
- 153790.62017811305,
- 153817.02483440886,
- 153843.43062392739,
- 153869.83754657139,
- 153896.24560224367,
- 153922.65479084692,
- 153949.06511228404,
- 153975.4765664578,
- 154001.88915327107,
- 154028.30287262669,
- 154054.71772442761,
- 154081.13370857667,
- 154107.55082497682,
- 154133.96907353101,
- 154160.38845414223,
- 154186.80896671346,
- 154213.23061114774,
- 154239.65338734805,
- 154266.07729521746,
- 154292.50233465908,
- 154318.92850557598,
- 154345.35580787127,
- 154371.7842414481,
- 154398.21380620965,
- 154424.64450205903,
- 154451.07632889951,
- 154477.50928663427,
- 154503.94337516659,
- 154530.37859439969,
- 154556.81494423689,
- 154583.25242458144,
- 154609.69103533673,
- 154636.13077640603,
- 154662.57164769279,
- 154689.01364910032,
- 154715.45678053208,
- 154741.90104189145,
- 154768.34643308193,
- 154794.79295400696,
- 154821.24060457002,
- 154847.68938467462,
- 154874.13929422433,
- 154900.59033312264,
- 154927.04250127316,
- 154953.49579857948,
- 154979.95022494521,
- 155006.40578027396,
- 155032.86246446942,
- 155059.32027743524,
- 155085.77921907514,
- 155112.2392892928,
- 155138.70048799197,
- 155165.16281507642,
- 155191.62627044989,
- 155218.09085401625,
- 155244.55656567923,
- 155271.02340534274,
- 155297.49137291059,
- 155323.96046828668,
- 155350.4306913749,
- 155376.90204207919,
- 155403.37452030348,
- 155429.84812595171,
- 155456.32285892789,
- 155482.79871913602,
- 155509.27570648011,
- 155535.75382086422,
- 155562.23306219239,
- 155588.71343036872,
- 155615.19492529731,
- 155641.67754688227,
- 155668.16129502779,
- 155694.64616963797,
- 155721.13217061706,
- 155747.61929786921,
- 155774.10755129869,
- 155800.59693080973,
- 155827.08743630661,
- 155853.57906769359,
- 155880.07182487496,
- 155906.56570775513,
- 155933.06071623837,
- 155959.55685022907,
- 155986.05410963166,
- 156012.5524943505,
- 156039.05200429002,
- 156065.55263935472,
- 156092.054399449,
- 156118.5572844774,
- 156145.06129434443,
- 156171.5664289546,
- 156198.07268821247,
- 156224.5800720226,
- 156251.08858028959,
- 156277.59821291809,
- 156304.10896981266,
- 156330.62085087801,
- 156357.1338560188,
- 156383.64798513969,
- 156410.16323814544,
- 156436.67961494075,
- 156463.1971154304,
- 156489.71573951913,
- 156516.23548711176,
- 156542.75635811311,
- 156569.27835242799,
- 156595.80146996127,
- 156622.32571061782,
- 156648.85107430254,
- 156675.37756092031,
- 156701.90517037612,
- 156728.43390257491,
- 156754.96375742162,
- 156781.49473482129,
- 156808.02683467892,
- 156834.5600568995,
- 156861.09440138817,
- 156887.62986804993,
- 156914.16645678994,
- 156940.70416751326,
- 156967.24300012505,
- 156993.78295453047,
- 157020.32403063469,
- 157046.8662283429,
- 157073.40954756032,
- 157099.9539881922,
- 157126.49955014378,
- 157153.04623332032,
- 157179.59403762716,
- 157206.14296296958,
- 157232.69300925292,
- 157259.24417638258,
- 157285.79646426387,
- 157312.34987280221,
- 157338.90440190304,
- 157365.46005147175,
- 157392.01682141385,
- 157418.57471163478,
- 157445.13372204005,
- 157471.69385253513,
- 157498.25510302564,
- 157524.81747341706,
- 157551.38096361503,
- 157577.9455735251,
- 157604.51130305286,
- 157631.07815210402,
- 157657.64612058419,
- 157684.21520839902,
- 157710.78541545427,
- 157737.35674165559,
- 157763.92918690876,
- 157790.50275111952,
- 157817.07743419363,
- 157843.65323603692,
- 157870.23015655516,
- 157896.80819565422,
- 157923.3873532399,
- 157949.96762921812,
- 157976.54902349479,
- 158003.13153597576,
- 158029.71516656701,
- 158056.29991517449,
- 158082.88578170416,
- 158109.47276606198,
- 158136.06086815402,
- 158162.65008788629,
- 158189.24042516484,
- 158215.83187989573,
- 158242.42445198505,
- 158269.01814133892,
- 158295.61294786347,
- 158322.20887146486,
- 158348.80591204923,
- 158375.4040695228,
- 158402.00334379176,
- 158428.60373476235,
- 158455.2052423408,
- 158481.80786643337,
- 158508.41160694641,
- 158535.01646378616,
- 158561.62243685898,
- 158588.2295260712,
- 158614.8377313292,
- 158641.44705253936,
- 158668.05748960807,
- 158694.66904244179,
- 158721.28171094693,
- 158747.89549502998,
- 158774.5103945974,
- 158801.12640955573,
- 158827.74353981143,
- 158854.36178527112,
- 158880.9811458413,
- 158907.60162142856,
- 158934.22321193956,
- 158960.84591728085,
- 158987.46973735912,
- 159014.09467208097,
- 159040.72072135314,
- 159067.3478850823,
- 159093.97616317519,
- 159120.60555553852,
- 159147.23606207906,
- 159173.8676827036,
- 159200.50041731889,
- 159227.13426583182,
- 159253.76922814918,
- 159280.40530417781,
- 159307.04249382461,
- 159333.68079699649,
- 159360.32021360032,
- 159386.96074354305,
- 159413.60238673165,
- 159440.24514307309,
- 159466.88901247433,
- 159493.53399484244,
- 159520.18009008438,
- 159546.82729810724,
- 159573.47561881805,
- 159600.12505212394,
- 159626.77559793202,
- 159653.42725614941,
- 159680.08002668325,
- 159706.73390944069,
- 159733.38890432892,
- 159760.04501125516,
- 159786.70223012666,
- 159813.36056085059,
- 159840.02000333427,
- 159866.68055748497,
- 159893.34222320997,
- 159920.00500041663,
- 159946.66888901225,
- 159973.33388890422,
- 159999.99999999988,
- 160026.66722220668,
- 160053.33555543202,
- 160080.0049995833,
- 160106.67555456801,
- 160133.3472202936,
- 160160.0199966676,
- 160186.6938835975,
- 160213.36888099083,
- 160240.04498875517,
- 160266.72220679806,
- 160293.40053502709,
- 160320.07997334987,
- 160346.76052167406,
- 160373.44217990729,
- 160400.1249479572,
- 160426.80882573154,
- 160453.49381313793,
- 160480.17991008417,
- 160506.86711647795,
- 160533.55543222709,
- 160560.24485723933,
- 160586.93539142248,
- 160613.62703468435,
- 160640.31978693281,
- 160667.01364807569,
- 160693.70861802087,
- 160720.40469667627,
- 160747.1018839498,
- 160773.80017974938,
- 160800.49958398298,
- 160827.20009655855,
- 160853.90171738411,
- 160880.60444636765,
- 160907.30828341722,
- 160934.01322844089,
- 160960.71928134665,
- 160987.42644204266,
- 161014.13471043704,
- 161040.84408643784,
- 161067.55456995327,
- 161094.26616089148,
- 161120.97885916062,
- 161147.69266466892,
- 161174.40757732463,
- 161201.12359703594,
- 161227.84072371112,
- 161254.55895725847,
- 161281.27829758628,
- 161307.99874460287,
- 161334.72029821656,
- 161361.44295833571,
- 161388.1667248687,
- 161414.89159772391,
- 161441.61757680977,
- 161468.34466203468,
- 161495.07285330712,
- 161521.80215053557,
- 161548.53255362847,
- 161575.26406249436,
- 161601.99667704175,
- 161628.7303971792,
- 161655.46522281526,
- 161682.20115385848,
- 161708.93819021754,
- 161735.67633180099,
- 161762.41557851751,
- 161789.15593027571,
- 161815.89738698432,
- 161842.63994855201,
- 161869.38361488748,
- 161896.1283858995,
- 161922.87426149679,
- 161949.62124158812,
- 161976.36932608229,
- 162003.1185148881,
- 162029.8688079144,
- 162056.62020507001,
- 162083.37270626382,
- 162110.12631140469,
- 162136.88102040152,
- 162163.63683316324,
- 162190.39374959879,
- 162217.15176961714,
- 162243.91089312723,
- 162270.67112003808,
- 162297.43245025873,
- 162324.19488369819,
- 162350.9584202655,
- 162377.72305986975,
- 162404.48880242003,
- 162431.25564782543,
- 162458.02359599507,
- 162484.79264683815,
- 162511.56280026378,
- 162538.33405618116,
- 162565.10641449949,
- 162591.87987512801,
- 162618.65443797593,
- 162645.43010295252,
- 162672.20686996708,
- 162698.98473892888,
- 162725.76370974723,
- 162752.54378233149,
- 162779.32495659095,
- 162806.10723243505,
- 162832.89060977317,
- 162859.67508851466,
- 162886.46066856899,
- 162913.24734984562,
- 162940.03513225398,
- 162966.82401570358,
- 162993.6140001039,
- 163020.40508536444,
- 163047.19727139481,
- 163073.99055810447,
- 163100.78494540305,
- 163127.58043320014,
- 163154.37702140535,
- 163181.17470992831,
- 163207.97349867865,
- 163234.77338756606,
- 163261.57437650024,
- 163288.37646539087,
- 163315.17965414765,
- 163341.98394268038,
- 163368.78933089875,
- 163395.59581871261,
- 163422.40340603172,
- 163449.2120927659,
- 163476.02187882498,
- 163502.83276411882,
- 163529.6447485573,
- 163556.45783205028,
- 163583.2720145077,
- 163610.08729583945,
- 163636.90367595552,
- 163663.72115476584,
- 163690.53973218042,
- 163717.35940810922,
- 163744.18018246227,
- 163771.00205514964,
- 163797.82502608138,
- 163824.64909516752,
- 163851.4742623182,
- 163878.3005274435,
- 163905.12789045356,
- 163931.95635125853,
- 163958.78590976857,
- 163985.61656589387,
- 164012.44831954464,
- 164039.28117063109,
- 164066.11511906344,
- 164092.95016475199,
- 164119.78630760699,
- 164146.62354753874,
- 164173.46188445756,
- 164200.30131827376,
- 164227.14184889771,
- 164253.98347623978,
- 164280.82620021031,
- 164307.67002071979,
- 164334.51493767856,
- 164361.3609509971,
- 164388.20806058586,
- 164415.05626635533,
- 164441.905568216,
- 164468.75596607837,
- 164495.607459853,
- 164522.4600494504,
- 164549.31373478117,
- 164576.16851575591,
- 164603.02439228518,
- 164629.88136427966,
- 164656.73943164994,
- 164683.59859430668,
- 164710.45885216061,
- 164737.32020512238,
- 164764.1826531027,
- 164791.04619601235,
- 164817.91083376206,
- 164844.77656626256,
- 164871.64339342469,
- 164898.51131515924,
- 164925.38033137703,
- 164952.25044198887,
- 164979.1216469057,
- 165005.9939460383,
- 165032.86733929763,
- 165059.7418265946,
- 165086.61740784015,
- 165113.4940829452
- };
+ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
+{
+ 0,
+ 1,
+ 2.5198420997897464,
+ 4.3267487109222245,
+ 6.3496042078727974,
+ 8.5498797333834844,
+ 10.902723556992836,
+ 13.390518279406722,
+ 15.999999999999998,
+ 18.720754407467133,
+ 21.544346900318832,
+ 24.463780996262464,
+ 27.47314182127996,
+ 30.567350940369842,
+ 33.741991698453212,
+ 36.993181114957046,
+ 40.317473596635935,
+ 43.711787041189993,
+ 47.173345095760126,
+ 50.699631325716943,
+ 54.288352331898118,
+ 57.937407704003519,
+ 61.6448652744185,
+ 65.408940536585988,
+ 69.227979374755591,
+ 73.100443455321638,
+ 77.024897778591622,
+ 80.999999999999986,
+ 85.024491212518527,
+ 89.097187944889555,
+ 93.216975178615741,
+ 97.382800224133163,
+ 101.59366732596474,
+ 105.84863288986224,
+ 110.14680124343441,
+ 114.4873208566006,
+ 118.86938096020653,
+ 123.29220851090024,
+ 127.75506545836058,
+ 132.25724627755247,
+ 136.79807573413572,
+ 141.37690685569191,
+ 145.99311908523086,
+ 150.6461165966291,
+ 155.33532675434674,
+ 160.06019870205279,
+ 164.82020206673349,
+ 169.61482576651861,
+ 174.44357691188537,
+ 179.30597979112557,
+ 184.20157493201927,
+ 189.12991823257562,
+ 194.09058015449685,
+ 199.08314497371677,
+ 204.1072100829694,
+ 209.16238534187647,
+ 214.24829247050752,
+ 219.36456448277784,
+ 224.51084515641216,
+ 229.6867885365223,
+ 234.89205847013176,
+ 240.12632816923249,
+ 245.38927980018505,
+ 250.68060409747261,
+ 255.99999999999991,
+ 261.34717430828869,
+ 266.72184136106449,
+ 272.12372272986045,
+ 277.55254693037961,
+ 283.0080491494619,
+ 288.48997098659891,
+ 293.99806020902247,
+ 299.53207051947408,
+ 305.0917613358298,
+ 310.67689758182206,
+ 316.28724948815585,
+ 321.92259240337177,
+ 327.58270661385535,
+ 333.26737717243742,
+ 338.97639373507025,
+ 344.70955040510125,
+ 350.46664558470013,
+ 356.24748183302603,
+ 362.05186573075139,
+ 367.87960775058258,
+ 373.73052213344511,
+ 379.60442677002078,
+ 385.50114308734607,
+ 391.42049594019937,
+ 397.36231350702371,
+ 403.32642719014467,
+ 409.31267152006262,
+ 415.32088406360799,
+ 421.35090533576471,
+ 427.40257871497619,
+ 433.4757503617617,
+ 439.5702691404793,
+ 445.68598654408271,
+ 451.82275662172759,
+ 457.98043590909128,
+ 464.15888336127773,
+ 470.35796028818726,
+ 476.5775302922363,
+ 482.81745920832043,
+ 489.07761504591741,
+ 495.35786793323581,
+ 501.65809006331688,
+ 507.97815564200368,
+ 514.31794083769648,
+ 520.67732373281672,
+ 527.05618427690604,
+ 533.45440424129174,
+ 539.87186717525128,
+ 546.30845836361505,
+ 552.76406478574609,
+ 559.23857507584194,
+ 565.73187948450413,
+ 572.24386984152341,
+ 578.77443951983378,
+ 585.32348340058843,
+ 591.89089783931263,
+ 598.47658063309257,
+ 605.08043098876044,
+ 611.70234949203643,
+ 618.3422380775919,
+ 624.99999999999977,
+ 631.67553980553748,
+ 638.36876330481164,
+ 645.07957754617485,
+ 651.80789078990415,
+ 658.55361248311499,
+ 665.31665323538357,
+ 672.09692479505225,
+ 678.8943400261943,
+ 685.70881288621433,
+ 692.540258404062,
+ 699.38859265903977,
+ 706.25373276018058,
+ 713.13559682617972,
+ 720.03410396586037,
+ 726.94917425915435,
+ 733.88072873858209,
+ 740.82868937121543,
+ 747.79297904110535,
+ 754.77352153216191,
+ 761.77024151147043,
+ 768.78306451302956,
+ 775.81191692189896,
+ 782.85672595874246,
+ 789.91741966475445,
+ 796.99392688695798,
+ 804.08617726386274,
+ 811.19410121147098,
+ 818.31762990962227,
+ 825.45669528866563,
+ 832.61123001644864,
+ 839.78116748561604,
+ 846.96644180120552,
+ 854.16698776853514,
+ 861.38274088137143,
+ 868.61363731036977,
+ 875.85961389178203,
+ 883.12060811641959,
+ 890.39655811886757,
+ 897.68740266694181,
+ 904.99308115138172,
+ 912.31353357577188,
+ 919.64870054668756,
+ 926.99852326405619,
+ 934.36294351172899,
+ 941.74190364825859,
+ 949.13534659787422,
+ 956.54321584165211,
+ 963.96545540887348,
+ 971.40200986856541,
+ 978.85282432122176,
+ 986.31784439069588,
+ 993.7970162162635,
+ 1001.29028644485,
+ 1008.797602223418,
+ 1016.3189111915103,
+ 1023.8541614739464,
+ 1031.4033016736653,
+ 1038.9662808647138,
+ 1046.5430485853758,
+ 1054.1335548314366,
+ 1061.7377500495838,
+ 1069.3555851309357,
+ 1076.9870114046978,
+ 1084.6319806319441,
+ 1092.2904449995174,
+ 1099.9623571140482,
+ 1107.6476699960892,
+ 1115.3463370743607,
+ 1123.058312180106,
+ 1130.7835495415541,
+ 1138.5220037784854,
+ 1146.273629896901,
+ 1154.0383832837879,
+ 1161.816219701986,
+ 1169.607095285146,
+ 1177.4109665327808,
+ 1185.2277903054078,
+ 1193.0575238197798,
+ 1200.9001246442001,
+ 1208.7555506939248,
+ 1216.6237602266442,
+ 1224.5047118380478,
+ 1232.3983644574657,
+ 1240.3046773435874,
+ 1248.2236100802568,
+ 1256.1551225723395,
+ 1264.099175041662,
+ 1272.0557280230228,
+ 1280.0247423602691,
+ 1288.0061792024444,
+ 1295.9999999999995,
+ 1304.006166501068,
+ 1312.0246407478062,
+ 1320.0553850727929,
+ 1328.0983620954903,
+ 1336.1535347187651,
+ 1344.2208661254647,
+ 1352.3003197750522,
+ 1360.3918594002962,
+ 1368.4954490040145,
+ 1376.6110528558709,
+ 1384.7386354892244,
+ 1392.8781616980295,
+ 1401.0295965337855,
+ 1409.1929053025353,
+ 1417.3680535619119,
+ 1425.5550071182327,
+ 1433.7537320236374,
+ 1441.9641945732744,
+ 1450.1863613025282,
+ 1458.4201989842913,
+ 1466.6656746262797,
+ 1474.9227554683875,
+ 1483.1914089800841,
+ 1491.4716028578516,
+ 1499.7633050226596,
+ 1508.0664836174794,
+ 1516.3811070048375,
+ 1524.7071437644029,
+ 1533.0445626906128,
+ 1541.3933327903342,
+ 1549.7534232805581,
+ 1558.1248035861302,
+ 1566.507443337515,
+ 1574.9013123685909,
+ 1583.3063807144795,
+ 1591.7226186094069,
+ 1600.1499964845941,
+ 1608.58848496618,
+ 1617.0380548731737,
+ 1625.4986772154357,
+ 1633.9703231916887,
+ 1642.4529641875577,
+ 1650.9465717736346,
+ 1659.4511177035752,
+ 1667.9665739122186,
+ 1676.4929125137353,
+ 1685.030105799801,
+ 1693.5781262377957,
+ 1702.136946469027,
+ 1710.7065393069795,
+ 1719.2868777355877,
+ 1727.8779349075323,
+ 1736.4796841425596,
+ 1745.092098925825,
+ 1753.7151529062583,
+ 1762.3488198949503,
+ 1770.9930738635628,
+ 1779.6478889427597,
+ 1788.3132394206564,
+ 1796.9890997412947,
+ 1805.6754445031333,
+ 1814.3722484575621,
+ 1823.0794865074322,
+ 1831.7971337056094,
+ 1840.5251652535437,
+ 1849.2635564998579,
+ 1858.0122829389563,
+ 1866.7713202096493,
+ 1875.5406440937966,
+ 1884.3202305149687,
+ 1893.110055537124,
+ 1901.9100953633042,
+ 1910.7203263343454,
+ 1919.5407249276057,
+ 1928.3712677557098,
+ 1937.2119315653083,
+ 1946.0626932358525,
+ 1954.923529778386,
+ 1963.79441833435,
+ 1972.6753361744036,
+ 1981.5662606972594,
+ 1990.467169428533,
+ 1999.3780400196069,
+ 2008.2988502465078,
+ 2017.2295780087982,
+ 2026.1702013284819,
+ 2035.1206983489212,
+ 2044.0810473337688,
+ 2053.0512266659125,
+ 2062.0312148464309,
+ 2071.0209904935646,
+ 2080.0205323416958,
+ 2089.0298192403443,
+ 2098.0488301531714,
+ 2107.0775441569995,
+ 2116.115940440839,
+ 2125.1639983049317,
+ 2134.2216971597995,
+ 2143.2890165253098,
+ 2152.3659360297484,
+ 2161.4524354089031,
+ 2170.5484945051617,
+ 2179.6540932666144,
+ 2188.7692117461711,
+ 2197.8938301006888,
+ 2207.0279285901042,
+ 2216.1714875765838,
+ 2225.324487523676,
+ 2234.4869089954782,
+ 2243.6587326558101,
+ 2252.8399392673982,
+ 2262.0305096910702,
+ 2271.2304248849537,
+ 2280.4396659036897,
+ 2289.6582138976523,
+ 2298.8860501121762,
+ 2308.1231558867926,
+ 2317.3695126544767,
+ 2326.6251019409005,
+ 2335.8899053636933,
+ 2345.1639046317132,
+ 2354.4470815443233,
+ 2363.7394179906792,
+ 2373.0408959490205,
+ 2382.3514974859731,
+ 2391.6712047558558,
+ 2400.9999999999991,
+ 2410.3378655460651,
+ 2419.6847838073813,
+ 2429.0407372822747,
+ 2438.4057085534191,
+ 2447.7796802871858,
+ 2457.1626352330004,
+ 2466.5545562227112,
+ 2475.9554261699564,
+ 2485.3652280695474,
+ 2494.7839449968492,
+ 2504.2115601071737,
+ 2513.6480566351788,
+ 2523.0934178942675,
+ 2532.5476272760025,
+ 2542.0106682495189,
+ 2551.482524360948,
+ 2560.9631792328441,
+ 2570.4526165636184,
+ 2579.9508201269791,
+ 2589.4577737713744,
+ 2598.9734614194458,
+ 2608.4978670674823,
+ 2618.0309747848837,
+ 2627.5727687136259,
+ 2637.1232330677353,
+ 2646.6823521327647,
+ 2656.2501102652768,
+ 2665.8264918923328,
+ 2675.4114815109842,
+ 2685.0050636877722,
+ 2694.6072230582295,
+ 2704.2179443263894,
+ 2713.8372122642972,
+ 2723.4650117115279,
+ 2733.1013275747096,
+ 2742.7461448270483,
+ 2752.3994485078601,
+ 2762.0612237221085,
+ 2771.7314556399419,
+ 2781.4101294962406,
+ 2791.0972305901655,
+ 2800.7927442847094,
+ 2810.4966560062589,
+ 2820.2089512441521,
+ 2829.9296155502466,
+ 2839.6586345384894,
+ 2849.3959938844923,
+ 2859.1416793251065,
+ 2868.8956766580086,
+ 2878.6579717412847,
+ 2888.4285504930212,
+ 2898.2073988908974,
+ 2907.9945029717837,
+ 2917.789848831344,
+ 2927.5934226236377,
+ 2937.4052105607311,
+ 2947.2251989123079,
+ 2957.0533740052865,
+ 2966.8897222234368,
+ 2976.734230007005,
+ 2986.5868838523397,
+ 2996.4476703115197,
+ 3006.3165759919889,
+ 3016.1935875561908,
+ 3026.0786917212095,
+ 3035.9718752584108,
+ 3045.8731249930906,
+ 3055.7824278041207,
+ 3065.6997706236039,
+ 3075.625140436528,
+ 3085.5585242804245,
+ 3095.4999092450298,
+ 3105.4492824719491,
+ 3115.4066311543256,
+ 3125.3719425365089,
+ 3135.3452039137287,
+ 3145.3264026317715,
+ 3155.3155260866592,
+ 3165.3125617243295,
+ 3175.3174970403229,
+ 3185.3303195794679,
+ 3195.35101693557,
+ 3205.3795767511078,
+ 3215.4159867169251,
+ 3225.460234571929,
+ 3235.5123081027928,
+ 3245.5721951436558,
+ 3255.63988357583,
+ 3265.7153613275095,
+ 3275.7986163734795,
+ 3285.8896367348289,
+ 3295.9884104786665,
+ 3306.0949257178395,
+ 3316.2091706106517,
+ 3326.331133360588,
+ 3336.4608022160378,
+ 3346.5981654700231,
+ 3356.7432114599264,
+ 3366.8959285672249,
+ 3377.0563052172211,
+ 3387.2243298787821,
+ 3397.3999910640764,
+ 3407.5832773283128,
+ 3417.7741772694862,
+ 3427.9726795281199,
+ 3438.1787727870123,
+ 3448.3924457709873,
+ 3458.6136872466445,
+ 3468.8424860221107,
+ 3479.0788309467976,
+ 3489.3227109111554,
+ 3499.5741148464344,
+ 3509.8330317244445,
+ 3520.0994505573185,
+ 3530.3733603972751,
+ 3540.6547503363886,
+ 3550.9436095063534,
+ 3561.239927078258,
+ 3571.5436922623535,
+ 3581.8548943078308,
+ 3592.1735225025936,
+ 3602.4995661730372,
+ 3612.8330146838275,
+ 3623.1738574376814,
+ 3633.5220838751502,
+ 3643.8776834744031,
+ 3654.2406457510142,
+ 3664.6109602577494,
+ 3674.9886165843564,
+ 3685.3736043573545,
+ 3695.7659132398294,
+ 3706.1655329312248,
+ 3716.5724531671399,
+ 3726.9866637191262,
+ 3737.4081543944876,
+ 3747.8369150360782,
+ 3758.2729355221072,
+ 3768.7162057659411,
+ 3779.1667157159077,
+ 3789.6244553551055,
+ 3800.0894147012082,
+ 3810.5615838062768,
+ 3821.0409527565694,
+ 3831.5275116723533,
+ 3842.0212507077194,
+ 3852.522160050396,
+ 3863.0302299215673,
+ 3873.5454505756893,
+ 3884.0678123003108,
+ 3894.5973054158922,
+ 3905.1339202756285,
+ 3915.6776472652732,
+ 3926.2284768029604,
+ 3936.7863993390338,
+ 3947.3514053558706,
+ 3957.9234853677135,
+ 3968.5026299204969,
+ 3979.0888295916798,
+ 3989.6820749900776,
+ 4000.2823567556948,
+ 4010.8896655595613,
+ 4021.5039921035655,
+ 4032.1253271202945,
+ 4042.7536613728694,
+ 4053.3889856547858,
+ 4064.0312907897551,
+ 4074.6805676315448,
+ 4085.3368070638221,
+ 4095.9999999999982,
+ 4106.6701373830711,
+ 4117.347210185475,
+ 4128.0312094089259,
+ 4138.722126084268,
+ 4149.4199512713267,
+ 4160.1246760587583,
+ 4170.8362915638982,
+ 4181.5547889326181,
+ 4192.2801593391769,
+ 4203.0123939860741,
+ 4213.7514841039101,
+ 4224.4974209512384,
+ 4235.2501958144258,
+ 4246.0098000075095,
+ 4256.7762248720574,
+ 4267.549461777031,
+ 4278.3295021186423,
+ 4289.1163373202198,
+ 4299.9099588320714,
+ 4310.7103581313495,
+ 4321.5175267219138,
+ 4332.3314561342004,
+ 4343.152137925088,
+ 4353.9795636777671,
+ 4364.8137250016052,
+ 4375.6546135320223,
+ 4386.5022209303588,
+ 4397.3565388837469,
+ 4408.2175591049827,
+ 4419.0852733324018,
+ 4429.9596733297531,
+ 4440.8407508860728,
+ 4451.7284978155603,
+ 4462.6229059574571,
+ 4473.5239671759227,
+ 4484.4316733599126,
+ 4495.3460164230582,
+ 4506.2669883035496,
+ 4517.1945809640119,
+ 4528.1287863913894,
+ 4539.069596596828,
+ 4550.0170036155587,
+ 4560.9709995067806,
+ 4571.931576353546,
+ 4582.898726262647,
+ 4593.8724413645004,
+ 4604.8527138130348,
+ 4615.8395357855816,
+ 4626.8328994827571,
+ 4637.8327971283588,
+ 4648.8392209692511,
+ 4659.8521632752563,
+ 4670.8716163390473,
+ 4681.8975724760394,
+ 4692.9300240242837,
+ 4703.9689633443595,
+ 4715.0143828192668,
+ 4726.0662748543255,
+ 4737.1246318770682,
+ 4748.1894463371373,
+ 4759.2607107061804,
+ 4770.3384174777493,
+ 4781.4225591671993,
+ 4792.5131283115852,
+ 4803.6101174695614,
+ 4814.7135192212854,
+ 4825.8233261683154,
+ 4836.9395309335096,
+ 4848.0621261609349,
+ 4859.1911045157631,
+ 4870.3264586841779,
+ 4881.4681813732768,
+ 4892.6162653109768,
+ 4903.7707032459193,
+ 4914.931487947375,
+ 4926.0986122051509,
+ 4937.2720688294967,
+ 4948.4518506510112,
+ 4959.637950520555,
+ 4970.8303613091521,
+ 4982.0290759079044,
+ 4993.2340872278974,
+ 5004.4453882001153,
+ 5015.6629717753467,
+ 5026.8868309241007,
+ 5038.1169586365131,
+ 5049.353347922266,
+ 5060.5959918104927,
+ 5071.8448833496996,
+ 5083.1000156076734,
+ 5094.3613816713996,
+ 5105.6289746469747,
+ 5116.9027876595246,
+ 5128.18281385312,
+ 5139.4690463906918,
+ 5150.7614784539473,
+ 5162.0601032432933,
+ 5173.3649139777472,
+ 5184.6759038948594,
+ 5195.9930662506322,
+ 5207.3163943194386,
+ 5218.6458813939435,
+ 5229.9815207850224,
+ 5241.3233058216847,
+ 5252.6712298509919,
+ 5264.025286237983,
+ 5275.3854683655954,
+ 5286.7517696345885,
+ 5298.1241834634639,
+ 5309.5027032883945,
+ 5320.887322563146,
+ 5332.2780347589978,
+ 5343.6748333646756,
+ 5355.0777118862716,
+ 5366.4866638471722,
+ 5377.901682787985,
+ 5389.3227622664635,
+ 5400.749895857437,
+ 5412.1830771527357,
+ 5423.622299761123,
+ 5435.067557308219,
+ 5446.5188434364318,
+ 5457.9761518048872,
+ 5469.4394760893592,
+ 5480.9088099821975,
+ 5492.3841471922606,
+ 5503.8654814448455,
+ 5515.3528064816201,
+ 5526.846116060552,
+ 5538.3454039558474,
+ 5549.8506639578736,
+ 5561.3618898731029,
+ 5572.8790755240361,
+ 5584.4022147491451,
+ 5595.9313014027975,
+ 5607.4663293552012,
+ 5619.0072924923297,
+ 5630.5541847158656,
+ 5642.1069999431284,
+ 5653.665732107017,
+ 5665.230375155943,
+ 5676.8009230537655,
+ 5688.3773697797333,
+ 5699.9597093284156,
+ 5711.5479357096474,
+ 5723.1420429484588,
+ 5734.7420250850209,
+ 5746.347876174581,
+ 5757.9595902874016,
+ 5769.5771615087006,
+ 5781.2005839385911,
+ 5792.8298516920213,
+ 5804.4649588987149,
+ 5816.1058997031105,
+ 5827.7526682643065,
+ 5839.4052587559972,
+ 5851.0636653664196,
+ 5862.7278822982908,
+ 5874.3979037687541,
+ 5886.0737240093204,
+ 5897.7553372658094,
+ 5909.4427377982956,
+ 5921.1359198810505,
+ 5932.8348778024874,
+ 5944.5396058651031,
+ 5956.2500983854261,
+ 5967.9663496939575,
+ 5979.6883541351208,
+ 5991.4161060672022,
+ 6003.1495998623004,
+ 6014.8888299062692,
+ 6026.6337905986684,
+ 6038.3844763527022,
+ 6050.1408815951781,
+ 6061.9030007664414,
+ 6073.6708283203316,
+ 6085.4443587241267,
+ 6097.2235864584891,
+ 6109.0085060174197,
+ 6120.7991119081998,
+ 6132.595398651345,
+ 6144.3973607805519,
+ 6156.2049928426459,
+ 6168.0182893975361,
+ 6179.8372450181578,
+ 6191.6618542904307,
+ 6203.4921118132024,
+ 6215.3280121982016,
+ 6227.1695500699925,
+ 6239.0167200659189,
+ 6250.8695168360628,
+ 6262.7279350431891,
+ 6274.5919693627056,
+ 6286.4616144826068,
+ 6298.3368651034316,
+ 6310.2177159382172,
+ 6322.1041617124456,
+ 6333.9961971640032,
+ 6345.8938170431311,
+ 6357.7970161123785,
+ 6369.7057891465583,
+ 6381.6201309327007,
+ 6393.5400362700075,
+ 6405.4654999698032,
+ 6417.3965168554978,
+ 6429.3330817625329,
+ 6441.2751895383453,
+ 6453.2228350423138,
+ 6465.176013145724,
+ 6477.134718731716,
+ 6489.0989466952469,
+ 6501.0686919430445,
+ 6513.0439493935628,
+ 6525.0247139769417,
+ 6537.010980634961,
+ 6549.002744321001,
+ 6560.9999999999973,
+ 6573.0027426483985,
+ 6585.0109672541284,
+ 6597.0246688165371,
+ 6609.0438423463656,
+ 6621.0684828657004,
+ 6633.0985854079354,
+ 6645.134145017727,
+ 6657.1751567509573,
+ 6669.2216156746908,
+ 6681.2735168671343,
+ 6693.3308554176001,
+ 6705.3936264264594,
+ 6717.461825005108,
+ 6729.535446275926,
+ 6741.6144853722335,
+ 6753.6989374382601,
+ 6765.7887976290967,
+ 6777.8840611106634,
+ 6789.9847230596661,
+ 6802.0907786635626,
+ 6814.2022231205201,
+ 6826.3190516393797,
+ 6838.4412594396181,
+ 6850.5688417513074,
+ 6862.701793815083,
+ 6874.840110882099,
+ 6886.9837882139991,
+ 6899.1328210828724,
+ 6911.2872047712199,
+ 6923.4469345719199,
+ 6935.6120057881863,
+ 6947.7824137335365,
+ 6959.9581537317536,
+ 6972.1392211168532,
+ 6984.3256112330409,
+ 6996.5173194346862,
+ 7008.7143410862773,
+ 7020.9166715623942,
+ 7033.1243062476678,
+ 7045.3372405367481,
+ 7057.5554698342685,
+ 7069.7789895548103,
+ 7082.0077951228714,
+ 7094.2418819728273,
+ 7106.4812455489018,
+ 7118.7258813051285,
+ 7130.9757847053224,
+ 7143.2309512230404,
+ 7155.4913763415516,
+ 7167.7570555538041,
+ 7180.0279843623894,
+ 7192.3041582795131,
+ 7204.5855728269571,
+ 7216.8722235360519,
+ 7229.1641059476406,
+ 7241.4612156120484,
+ 7253.7635480890503,
+ 7266.0710989478375,
+ 7278.3838637669869,
+ 7290.7018381344296,
+ 7303.0250176474174,
+ 7315.3533979124932,
+ 7327.6869745454596,
+ 7340.0257431713462,
+ 7352.3696994243801,
+ 7364.7188389479543,
+ 7377.0731573945968,
+ 7389.4326504259407,
+ 7401.7973137126937,
+ 7414.1671429346061,
+ 7426.5421337804428,
+ 7438.922281947951,
+ 7451.3075831438346,
+ 7463.6980330837177,
+ 7476.0936274921214,
+ 7488.4943621024304,
+ 7500.9002326568652,
+ 7513.3112349064522,
+ 7525.7273646109943,
+ 7538.1486175390446,
+ 7550.5749894678729,
+ 7563.0064761834419,
+ 7575.4430734803736,
+ 7587.8847771619248,
+ 7600.3315830399597,
+ 7612.7834869349153,
+ 7625.24048467578,
+ 7637.7025721000637,
+ 7650.1697450537677,
+ 7662.6419993913596,
+ 7675.1193309757446,
+ 7687.6017356782404,
+ 7700.0892093785433,
+ 7712.5817479647112,
+ 7725.079347333125,
+ 7737.5820033884729,
+ 7750.0897120437139,
+ 7762.6024692200581,
+ 7775.1202708469355,
+ 7787.6431128619733,
+ 7800.1709912109645,
+ 7812.7039018478481,
+ 7825.2418407346768,
+ 7837.7848038415968,
+ 7850.3327871468155,
+ 7862.8857866365806,
+ 7875.4437983051539,
+ 7888.006818154784,
+ 7900.5748421956796,
+ 7913.1478664459901,
+ 7925.725886931772,
+ 7938.3088996869719,
+ 7950.8969007533951,
+ 7963.4898861806851,
+ 7976.0878520262959,
+ 7988.6907943554688,
+ 8001.2987092412086,
+ 8013.911592764257,
+ 8026.5294410130691,
+ 8039.1522500837891,
+ 8051.7800160802271,
+ 8064.412735113835,
+ 8077.0504033036796,
+ 8089.6930167764222,
+ 8102.3405716662946,
+ 8114.9930641150731,
+ 8127.6504902720571,
+ 8140.3128462940449,
+ 8152.9801283453098,
+ 8165.6523325975786,
+ 8178.3294552300049,
+ 8191.0114924291529,
+ 8203.6984403889655,
+ 8216.3902953107463,
+ 8229.0870534031419,
+ 8241.7887108821069,
+ 8254.4952639708936,
+ 8267.2067089000211,
+ 8279.9230419072574,
+ 8292.6442592375952,
+ 8305.3703571432306,
+ 8318.101331883543,
+ 8330.8371797250657,
+ 8343.577896941475,
+ 8356.3234798135582,
+ 8369.0739246291978,
+ 8381.8292276833508,
+ 8394.5893852780209,
+ 8407.3543937222421,
+ 8420.1242493320569,
+ 8432.8989484304948,
+ 8445.6784873475499,
+ 8458.4628624201578,
+ 8471.2520699921806,
+ 8484.0461064143838,
+ 8496.8449680444082,
+ 8509.6486512467636,
+ 8522.4571523927953,
+ 8535.270467860666,
+ 8548.0885940353437,
+ 8560.9115273085663,
+ 8573.7392640788403,
+ 8586.5718007514006,
+ 8599.4091337382069,
+ 8612.2512594579148,
+ 8625.0981743358552,
+ 8637.9498748040205,
+ 8650.8063573010386,
+ 8663.6676182721567,
+ 8676.533654169225,
+ 8689.4044614506638,
+ 8702.2800365814601,
+ 8715.1603760331418,
+ 8728.0454762837508,
+ 8740.9353338178389,
+ 8753.8299451264356,
+ 8766.7293067070332,
+ 8779.6334150635721,
+ 8792.5422667064158,
+ 8805.4558581523324,
+ 8818.3741859244819,
+ 8831.2972465523908,
+ 8844.2250365719356,
+ 8857.1575525253265,
+ 8870.0947909610859,
+ 8883.0367484340295,
+ 8895.9834215052524,
+ 8908.934806742107,
+ 8921.8909007181846,
+ 8934.8517000132997,
+ 8947.817201213471,
+ 8960.7874009109,
+ 8973.7622957039603,
+ 8986.7418821971733,
+ 8999.7261570011924,
+ 9012.7151167327884,
+ 9025.7087580148236,
+ 9038.7070774762469,
+ 9051.7100717520643,
+ 9064.7177374833282,
+ 9077.7300713171153,
+ 9090.7470699065179,
+ 9103.7687299106146,
+ 9116.7950479944648,
+ 9129.8260208290812,
+ 9142.8616450914233,
+ 9155.9019174643727,
+ 9168.9468346367157,
+ 9181.9963933031358,
+ 9195.0505901641845,
+ 9208.1094219262741,
+ 9221.1728853016557,
+ 9234.240977008405,
+ 9247.3136937704076,
+ 9260.3910323173386,
+ 9273.472989384647,
+ 9286.5595617135423,
+ 9299.6507460509747,
+ 9312.7465391496207,
+ 9325.8469377678684,
+ 9338.9519386698012,
+ 9352.0615386251757,
+ 9365.1757344094131,
+ 9378.2945228035842,
+ 9391.4179005943843,
+ 9404.5458645741273,
+ 9417.6784115407263,
+ 9430.8155382976747,
+ 9443.9572416540359,
+ 9457.1035184244265,
+ 9470.2543654290002,
+ 9483.4097794934296,
+ 9496.5697574488931,
+ 9509.7342961320664,
+ 9522.9033923850911,
+ 9536.0770430555804,
+ 9549.2552449965824,
+ 9562.4379950665825,
+ 9575.6252901294793,
+ 9588.8171270545736,
+ 9602.0135027165488,
+ 9615.2144139954635,
+ 9628.4198577767274,
+ 9641.629830951093,
+ 9654.844330414644,
+ 9668.0633530687719,
+ 9681.286895820167,
+ 9694.5149555808002,
+ 9707.7475292679192,
+ 9720.9846138040157,
+ 9734.2262061168276,
+ 9747.4723031393187,
+ 9760.7229018096641,
+ 9773.9779990712323,
+ 9787.2375918725811,
+ 9800.5016771674327,
+ 9813.7702519146696,
+ 9827.0433130783094,
+ 9840.3208576275028,
+ 9853.602882536512,
+ 9866.8893847846994,
+ 9880.1803613565116,
+ 9893.4758092414686,
+ 9906.7757254341523,
+ 9920.0801069341851,
+ 9933.3889507462245,
+ 9946.7022538799429,
+ 9960.0200133500221,
+ 9973.3422261761298,
+ 9986.6688893829159,
+ 9999.9999999999945,
+ 10013.335555061929,
+ 10026.675551608221,
+ 10040.019986683301,
+ 10053.368857336509,
+ 10066.722160622081,
+ 10080.079893599144,
+ 10093.442053331697,
+ 10106.808636888598,
+ 10120.179641343551,
+ 10133.555063775095,
+ 10146.934901266595,
+ 10160.31915090622,
+ 10173.707809786936,
+ 10187.100875006496,
+ 10200.498343667417,
+ 10213.900212876984,
+ 10227.306479747222,
+ 10240.717141394889,
+ 10254.132194941467,
+ 10267.551637513146,
+ 10280.975466240814,
+ 10294.40367826004,
+ 10307.836270711066,
+ 10321.273240738796,
+ 10334.71458549278,
+ 10348.160302127204,
+ 10361.610387800878,
+ 10375.064839677221,
+ 10388.523654924258,
+ 10401.986830714593,
+ 10415.454364225412,
+ 10428.926252638465,
+ 10442.402493140049,
+ 10455.883082921007,
+ 10469.368019176709,
+ 10482.85729910704,
+ 10496.350919916393,
+ 10509.848878813653,
+ 10523.351173012188,
+ 10536.857799729838,
+ 10550.3687561889,
+ 10563.884039616123,
+ 10577.403647242685,
+ 10590.927576304197,
+ 10604.455824040679,
+ 10617.988387696556,
+ 10631.525264520642,
+ 10645.066451766135,
+ 10658.611946690598,
+ 10672.161746555956,
+ 10685.715848628475,
+ 10699.274250178762,
+ 10712.836948481747,
+ 10726.403940816675,
+ 10739.975224467091,
+ 10753.550796720834,
+ 10767.130654870027,
+ 10780.714796211059,
+ 10794.303218044579,
+ 10807.895917675487,
+ 10821.492892412922,
+ 10835.094139570248,
+ 10848.699656465047,
+ 10862.309440419107,
+ 10875.923488758415,
+ 10889.541798813138,
+ 10903.16436791762,
+ 10916.791193410372,
+ 10930.422272634056,
+ 10944.05760293548,
+ 10957.697181665582,
+ 10971.341006179427,
+ 10984.98907383619,
+ 10998.641381999149,
+ 11012.297928035676,
+ 11025.958709317223,
+ 11039.623723219316,
+ 11053.292967121541,
+ 11066.966438407539,
+ 11080.64413446499,
+ 11094.326052685608,
+ 11108.012190465128,
+ 11121.702545203296,
+ 11135.397114303863,
+ 11149.095895174571,
+ 11162.798885227143,
+ 11176.506081877278,
+ 11190.217482544635,
+ 11203.933084652828,
+ 11217.652885629415,
+ 11231.376882905886,
+ 11245.105073917659,
+ 11258.837456104062,
+ 11272.574026908333,
+ 11286.314783777601,
+ 11300.059724162888,
+ 11313.808845519083,
+ 11327.562145304952,
+ 11341.319620983111,
+ 11355.081270020033,
+ 11368.847089886023,
+ 11382.617078055218,
+ 11396.391232005579,
+ 11410.169549218874,
+ 11423.952027180676,
+ 11437.738663380349,
+ 11451.529455311042,
+ 11465.324400469679,
+ 11479.123496356951,
+ 11492.926740477304,
+ 11506.734130338931,
+ 11520.545663453764,
+ 11534.361337337466,
+ 11548.181149509423,
+ 11562.005097492724,
+ 11575.83317881417,
+ 11589.665391004253,
+ 11603.501731597149,
+ 11617.342198130715,
+ 11631.186788146468,
+ 11645.035499189589,
+ 11658.888328808911,
+ 11672.745274556904,
+ 11686.606333989675,
+ 11700.471504666955,
+ 11714.340784152086,
+ 11728.214170012021,
+ 11742.091659817312,
+ 11755.973251142101,
+ 11769.858941564111,
+ 11783.748728664636,
+ 11797.642610028539,
+ 11811.540583244237,
+ 11825.442645903697,
+ 11839.34879560242,
+ 11853.259029939445,
+ 11867.173346517333,
+ 11881.091742942155,
+ 11895.014216823492,
+ 11908.940765774427,
+ 11922.871387411526,
+ 11936.806079354839,
+ 11950.744839227897,
+ 11964.687664657684,
+ 11978.634553274653,
+ 11992.585502712702,
+ 12006.540510609168,
+ 12020.499574604828,
+ 12034.462692343877,
+ 12048.429861473938,
+ 12062.401079646032,
+ 12076.376344514589,
+ 12090.355653737433,
+ 12104.339004975769,
+ 12118.326395894188,
+ 12132.317824160644,
+ 12146.313287446457,
+ 12160.312783426305,
+ 12174.316309778205,
+ 12188.323864183525,
+ 12202.335444326955,
+ 12216.351047896511,
+ 12230.370672583531,
+ 12244.394316082657,
+ 12258.421976091831,
+ 12272.453650312296,
+ 12286.489336448574,
+ 12300.529032208471,
+ 12314.572735303058,
+ 12328.620443446678,
+ 12342.672154356922,
+ 12356.727865754638,
+ 12370.787575363909,
+ 12384.851280912055,
+ 12398.918980129623,
+ 12412.990670750381,
+ 12427.066350511306,
+ 12441.146017152583,
+ 12455.229668417589,
+ 12469.317302052901,
+ 12483.40891580827,
+ 12497.50450743663,
+ 12511.604074694078,
+ 12525.707615339878,
+ 12539.815127136444,
+ 12553.926607849342,
+ 12568.042055247275,
+ 12582.161467102082,
+ 12596.284841188726,
+ 12610.41217528529,
+ 12624.543467172971,
+ 12638.678714636069,
+ 12652.817915461985,
+ 12666.961067441209,
+ 12681.108168367316,
+ 12695.259216036962,
+ 12709.414208249869,
+ 12723.573142808827,
+ 12737.736017519681,
+ 12751.902830191326,
+ 12766.073578635704,
+ 12780.248260667788,
+ 12794.426874105588,
+ 12808.609416770132,
+ 12822.795886485468,
+ 12836.986281078653,
+ 12851.180598379744,
+ 12865.378836221802,
+ 12879.580992440871,
+ 12893.787064875984,
+ 12907.997051369144,
+ 12922.210949765335,
+ 12936.428757912496,
+ 12950.650473661524,
+ 12964.876094866273,
+ 12979.105619383534,
+ 12993.339045073039,
+ 13007.576369797454,
+ 13021.817591422368,
+ 13036.062707816285,
+ 13050.311716850629,
+ 13064.564616399723,
+ 13078.821404340792,
+ 13093.082078553954,
+ 13107.346636922217,
+ 13121.615077331464,
+ 13135.887397670458,
+ 13150.163595830827,
+ 13164.44366970706,
+ 13178.727617196502,
+ 13193.015436199352,
+ 13207.307124618648,
+ 13221.602680360265,
+ 13235.902101332911,
+ 13250.205385448118,
+ 13264.512530620239,
+ 13278.823534766434,
+ 13293.138395806676,
+ 13307.457111663734,
+ 13321.779680263176,
+ 13336.106099533356,
+ 13350.436367405409,
+ 13364.77048181325,
+ 13379.108440693562,
+ 13393.450241985796,
+ 13407.795883632158,
+ 13422.145363577607,
+ 13436.498679769853,
+ 13450.855830159346,
+ 13465.216812699266,
+ 13479.581625345529,
+ 13493.950266056772,
+ 13508.32273279435,
+ 13522.699023522329,
+ 13537.079136207483,
+ 13551.463068819286,
+ 13565.850819329906,
+ 13580.2423857142,
+ 13594.63776594971,
+ 13609.036958016657,
+ 13623.439959897927,
+ 13637.846769579081,
+ 13652.257385048335,
+ 13666.67180429656,
+ 13681.090025317284,
+ 13695.512046106669,
+ 13709.937864663521,
+ 13724.367478989278,
+ 13738.800887088004,
+ 13753.238086966385,
+ 13767.679076633727,
+ 13782.123854101939,
+ 13796.572417385545,
+ 13811.024764501659,
+ 13825.480893469998,
+ 13839.94080231286,
+ 13854.404489055134,
+ 13868.871951724283,
+ 13883.34318835034,
+ 13897.818196965914,
+ 13912.296975606168,
+ 13926.779522308825,
+ 13941.26583511416,
+ 13955.755912064991,
+ 13970.249751206682,
+ 13984.747350587126,
+ 13999.248708256751,
+ 14013.753822268511,
+ 14028.262690677873,
+ 14042.775311542828,
+ 14057.291682923867,
+ 14071.811802883994,
+ 14086.335669488704,
+ 14100.863280805994,
+ 14115.394634906341,
+ 14129.92972986271,
+ 14144.468563750548,
+ 14159.01113464777,
+ 14173.55744063476,
+ 14188.107479794369,
+ 14202.661250211901,
+ 14217.218749975118,
+ 14231.779977174227,
+ 14246.344929901879,
+ 14260.913606253163,
+ 14275.486004325601,
+ 14290.062122219146,
+ 14304.641958036171,
+ 14319.225509881464,
+ 14333.812775862236,
+ 14348.403754088098,
+ 14362.998442671067,
+ 14377.59683972556,
+ 14392.198943368388,
+ 14406.804751718748,
+ 14421.414262898223,
+ 14436.027475030774,
+ 14450.64438624274,
+ 14465.264994662828,
+ 14479.889298422106,
+ 14494.517295654005,
+ 14509.148984494313,
+ 14523.784363081166,
+ 14538.423429555049,
+ 14553.066182058781,
+ 14567.712618737527,
+ 14582.362737738777,
+ 14597.016537212348,
+ 14611.674015310382,
+ 14626.33517018734,
+ 14640.999999999993,
+ 14655.668502907418,
+ 14670.340677071003,
+ 14685.016520654426,
+ 14699.696031823671,
+ 14714.379208746999,
+ 14729.066049594967,
+ 14743.756552540408,
+ 14758.45071575843,
+ 14773.148537426418,
+ 14787.850015724018,
+ 14802.555148833142,
+ 14817.263934937961,
+ 14831.976372224897,
+ 14846.692458882624,
+ 14861.41219310206,
+ 14876.135573076363,
+ 14890.862597000923,
+ 14905.593263073371,
+ 14920.327569493558,
+ 14935.065514463557,
+ 14949.807096187662,
+ 14964.552312872382,
+ 14979.301162726431,
+ 14994.053643960735,
+ 15008.809754788414,
+ 15023.569493424788,
+ 15038.332858087369,
+ 15053.099846995858,
+ 15067.870458372134,
+ 15082.644690440264,
+ 15097.422541426484,
+ 15112.204009559202,
+ 15126.989093068994,
+ 15141.777790188597,
+ 15156.570099152905,
+ 15171.366018198967,
+ 15186.165545565986,
+ 15200.968679495301,
+ 15215.775418230402,
+ 15230.585760016909,
+ 15245.399703102579,
+ 15260.217245737298,
+ 15275.038386173073,
+ 15289.863122664035,
+ 15304.691453466432,
+ 15319.523376838621,
+ 15334.358891041069,
+ 15349.197994336346,
+ 15364.040684989128,
+ 15378.886961266177,
+ 15393.736821436356,
+ 15408.590263770609,
+ 15423.447286541972,
+ 15438.307888025554,
+ 15453.172066498542,
+ 15468.039820240196,
+ 15482.91114753184,
+ 15497.786046656869,
+ 15512.664515900733,
+ 15527.546553550939,
+ 15542.432157897045,
+ 15557.32132723066,
+ 15572.214059845435,
+ 15587.110354037064,
+ 15602.010208103273,
+ 15616.913620343823,
+ 15631.820589060506,
+ 15646.731112557136,
+ 15661.645189139546,
+ 15676.562817115593,
+ 15691.483994795139,
+ 15706.408720490062,
+ 15721.336992514242,
+ 15736.268809183561,
+ 15751.204168815901,
+ 15766.143069731135,
+ 15781.085510251132,
+ 15796.03148869974,
+ 15810.981003402798,
+ 15825.934052688119,
+ 15840.890634885489,
+ 15855.850748326673,
+ 15870.814391345401,
+ 15885.781562277361,
+ 15900.752259460214,
+ 15915.726481233565,
+ 15930.704225938984,
+ 15945.685491919978,
+ 15960.670277522009,
+ 15975.658581092481,
+ 15990.65040098073,
+ 16005.645735538035,
+ 16020.644583117599,
+ 16035.646942074556,
+ 16050.652810765967,
+ 16065.662187550806,
+ 16080.675070789974,
+ 16095.691458846273,
+ 16110.711350084424,
+ 16125.734742871053,
+ 16140.761635574685,
+ 16155.792026565747,
+ 16170.825914216561,
+ 16185.863296901338,
+ 16200.904172996183,
+ 16215.948540879079,
+ 16230.996398929899,
+ 16246.047745530386,
+ 16261.102579064163,
+ 16276.160897916721,
+ 16291.22270047542,
+ 16306.287985129484,
+ 16321.356750269995,
+ 16336.428994289896,
+ 16351.504715583982,
+ 16366.5839125489,
+ 16381.666583583141,
+ 16396.752727087041,
+ 16411.842341462776,
+ 16426.935425114363,
+ 16442.031976447644,
+ 16457.131993870298,
+ 16472.235475791829,
+ 16487.342420623561,
+ 16502.452826778641,
+ 16517.566692672033,
+ 16532.684016720516,
+ 16547.804797342676,
+ 16562.929032958902,
+ 16578.056721991394,
+ 16593.18786286415,
+ 16608.322454002962,
+ 16623.460493835417,
+ 16638.601980790896,
+ 16653.746913300558,
+ 16668.895289797354,
+ 16684.047108716015,
+ 16699.202368493046,
+ 16714.361067566726,
+ 16729.523204377107,
+ 16744.688777366009,
+ 16759.857784977012,
+ 16775.030225655464,
+ 16790.206097848466,
+ 16805.385400004874,
+ 16820.568130575302,
+ 16835.754288012104,
+ 16850.943870769381,
+ 16866.136877302983,
+ 16881.333306070494,
+ 16896.53315553123,
+ 16911.736424146249,
+ 16926.943110378332,
+ 16942.153212691992,
+ 16957.366729553454,
+ 16972.583659430682,
+ 16987.804000793338,
+ 17003.027752112816,
+ 17018.254911862205,
+ 17033.485478516312,
+ 17048.719450551645,
+ 17063.956826446421,
+ 17079.197604680547,
+ 17094.44178373563,
+ 17109.689362094967,
+ 17124.940338243552,
+ 17140.194710668064,
+ 17155.452477856852,
+ 17170.713638299967,
+ 17185.978190489128,
+ 17201.246132917724,
+ 17216.517464080825,
+ 17231.792182475165,
+ 17247.070286599141,
+ 17262.351774952826,
+ 17277.636646037936,
+ 17292.924898357855,
+ 17308.216530417623,
+ 17323.511540723921,
+ 17338.809927785089,
+ 17354.111690111105,
+ 17369.416826213594,
+ 17384.725334605821,
+ 17400.037213802683,
+ 17415.352462320716,
+ 17430.67107867809,
+ 17445.993061394587,
+ 17461.318408991636,
+ 17476.647119992274,
+ 17491.979192921168,
+ 17507.314626304586,
+ 17522.653418670423,
+ 17537.995568548187,
+ 17553.341074468986,
+ 17568.689934965536,
+ 17584.042148572156,
+ 17599.397713824768,
+ 17614.75662926089,
+ 17630.118893419625,
+ 17645.484504841683,
+ 17660.853462069354,
+ 17676.225763646511,
+ 17691.601408118619,
+ 17706.980394032718,
+ 17722.362719937424,
+ 17737.748384382936,
+ 17753.137385921014,
+ 17768.529723104999,
+ 17783.92539448979,
+ 17799.324398631856,
+ 17814.726734089225,
+ 17830.13239942148,
+ 17845.541393189767,
+ 17860.95371395678,
+ 17876.369360286772,
+ 17891.788330745527,
+ 17907.210623900395,
+ 17922.636238320254,
+ 17938.065172575527,
+ 17953.497425238176,
+ 17968.932994881692,
+ 17984.371880081104,
+ 17999.814079412972,
+ 18015.259591455371,
+ 18030.708414787914,
+ 18046.160547991731,
+ 18061.615989649465,
+ 18077.074738345284,
+ 18092.536792664861,
+ 18108.002151195393,
+ 18123.470812525571,
+ 18138.942775245599,
+ 18154.418037947191,
+ 18169.896599223546,
+ 18185.37845766938,
+ 18200.863611880886,
+ 18216.352060455767,
+ 18231.843801993204,
+ 18247.338835093873,
+ 18262.837158359936,
+ 18278.338770395032,
+ 18293.84366980429,
+ 18309.351855194309,
+ 18324.863325173166,
+ 18340.378078350412,
+ 18355.896113337069,
+ 18371.417428745623,
+ 18386.942023190033,
+ 18402.469895285718,
+ 18418.00104364955,
+ 18433.53546689987,
+ 18449.073163656474,
+ 18464.614132540602,
+ 18480.158372174956,
+ 18495.705881183676,
+ 18511.256658192357,
+ 18526.810701828035,
+ 18542.368010719183,
+ 18557.928583495715,
+ 18573.492418788985,
+ 18589.059515231773,
+ 18604.629871458303,
+ 18620.203486104212,
+ 18635.78035780658,
+ 18651.360485203899,
+ 18666.943866936086,
+ 18682.53050164448,
+ 18698.120387971841,
+ 18713.713524562332,
+ 18729.30991006154,
+ 18744.909543116457,
+ 18760.512422375479,
+ 18776.118546488418,
+ 18791.727914106479,
+ 18807.340523882274,
+ 18822.95637446981,
+ 18838.575464524489,
+ 18854.197792703111,
+ 18869.823357663863,
+ 18885.452158066328,
+ 18901.08419257147,
+ 18916.719459841639,
+ 18932.357958540564,
+ 18947.999687333362,
+ 18963.644644886521,
+ 18979.292829867907,
+ 18994.944240946759,
+ 19010.598876793687,
+ 19026.256736080668,
+ 19041.917817481048,
+ 19057.582119669532,
+ 19073.2496413222,
+ 19088.920381116473,
+ 19104.594337731145,
+ 19120.271509846356,
+ 19135.951896143604,
+ 19151.635495305738,
+ 19167.322306016948,
+ 19183.012326962784,
+ 19198.705556830122,
+ 19214.401994307198,
+ 19230.101638083579,
+ 19245.804486850167,
+ 19261.510539299208,
+ 19277.219794124274,
+ 19292.932250020265,
+ 19308.647905683421,
+ 19324.366759811302,
+ 19340.088811102793,
+ 19355.8140582581,
+ 19371.542499978754,
+ 19387.2741349676,
+ 19403.008961928797,
+ 19418.746979567823,
+ 19434.488186591469,
+ 19450.232581707827,
+ 19465.980163626304,
+ 19481.730931057613,
+ 19497.484882713761,
+ 19513.242017308068,
+ 19529.002333555141,
+ 19544.765830170898,
+ 19560.532505872539,
+ 19576.302359378566,
+ 19592.075389408761,
+ 19607.851594684209,
+ 19623.630973927269,
+ 19639.41352586159,
+ 19655.199249212103,
+ 19670.988142705017,
+ 19686.780205067826,
+ 19702.575435029288,
+ 19718.373831319448,
+ 19734.175392669615,
+ 19749.980117812371,
+ 19765.788005481569,
+ 19781.599054412323,
+ 19797.413263341008,
+ 19813.230631005274,
+ 19829.051156144014,
+ 19844.874837497395,
+ 19860.701673806827,
+ 19876.531663814985,
+ 19892.364806265789,
+ 19908.201099904403,
+ 19924.040543477258,
+ 19939.883135732012,
+ 19955.728875417579,
+ 19971.577761284105,
+ 19987.429792082985,
+ 20003.284966566847,
+ 20019.14328348956,
+ 20035.004741606219,
+ 20050.869339673161,
+ 20066.737076447946,
+ 20082.607950689362,
+ 20098.481961157428,
+ 20114.359106613385,
+ 20130.239385819699,
+ 20146.122797540058,
+ 20162.009340539353,
+ 20177.899013583716,
+ 20193.791815440476,
+ 20209.687744878182,
+ 20225.586800666591,
+ 20241.488981576669,
+ 20257.394286380597,
+ 20273.302713851754,
+ 20289.214262764715,
+ 20305.128931895277,
+ 20321.046720020415,
+ 20336.967625918318,
+ 20352.891648368361,
+ 20368.818786151114,
+ 20384.749038048347,
+ 20400.682402843009,
+ 20416.618879319249,
+ 20432.558466262391,
+ 20448.501162458953,
+ 20464.446966696629,
+ 20480.395877764302,
+ 20496.347894452025,
+ 20512.303015551031,
+ 20528.261239853735,
+ 20544.22256615372,
+ 20560.186993245738,
+ 20576.15451992572,
+ 20592.125144990758,
+ 20608.098867239107,
+ 20624.075685470198,
+ 20640.055598484618,
+ 20656.038605084115,
+ 20672.024704071595,
+ 20688.013894251126,
+ 20704.006174427926,
+ 20720.001543408373,
+ 20735.999999999989,
+ 20752.001543011454,
+ 20768.006171252597,
+ 20784.013883534382,
+ 20800.024678668931,
+ 20816.038555469506,
+ 20832.055512750507,
+ 20848.075549327474,
+ 20864.098664017085,
+ 20880.124855637161,
+ 20896.154123006647,
+ 20912.186464945626,
+ 20928.221880275312,
+ 20944.260367818049,
+ 20960.301926397311,
+ 20976.346554837684,
+ 20992.394251964895,
+ 21008.445016605787,
+ 21024.498847588318,
+ 21040.555743741574,
+ 21056.615703895754,
+ 21072.678726882168,
+ 21088.744811533252,
+ 21104.813956682538,
+ 21120.886161164683,
+ 21136.961423815443,
+ 21153.039743471683,
+ 21169.121118971379,
+ 21185.205549153605,
+ 21201.293032858535,
+ 21217.383568927453,
+ 21233.477156202731,
+ 21249.573793527841,
+ 21265.673479747358,
+ 21281.776213706937,
+ 21297.881994253334,
+ 21313.990820234398,
+ 21330.102690499054,
+ 21346.21760389733,
+ 21362.335559280327,
+ 21378.456555500241,
+ 21394.580591410333,
+ 21410.707665864964,
+ 21426.83777771956,
+ 21442.970925830628,
+ 21459.107109055756,
+ 21475.246326253604,
+ 21491.388576283895,
+ 21507.533858007431,
+ 21523.682170286087,
+ 21539.833511982797,
+ 21555.987881961566,
+ 21572.145279087465,
+ 21588.305702226615,
+ 21604.469150246216,
+ 21620.635622014521,
+ 21636.805116400832,
+ 21652.977632275521,
+ 21669.153168510009,
+ 21685.331723976764,
+ 21701.513297549318,
+ 21717.697888102244,
+ 21733.885494511167,
+ 21750.076115652759,
+ 21766.269750404736,
+ 21782.466397645861,
+ 21798.666056255934,
+ 21814.868725115801,
+ 21831.074403107345,
+ 21847.283089113484,
+ 21863.494782018177,
+ 21879.709480706417,
+ 21895.927184064229,
+ 21912.147890978667,
+ 21928.371600337818,
+ 21944.598311030797,
+ 21960.828021947746,
+ 21977.060731979829,
+ 21993.296440019243,
+ 22009.535144959198,
+ 22025.77684569393,
+ 22042.021541118691,
+ 22058.269230129757,
+ 22074.519911624411,
+ 22090.773584500959,
+ 22107.030247658717,
+ 22123.289899998013,
+ 22139.552540420187,
+ 22155.818167827587,
+ 22172.086781123569,
+ 22188.358379212495,
+ 22204.632960999726,
+ 22220.910525391639,
+ 22237.191071295601,
+ 22253.474597619981,
+ 22269.761103274148,
+ 22286.050587168469,
+ 22302.343048214312,
+ 22318.638485324027,
+ 22334.936897410968,
+ 22351.23828338947,
+ 22367.542642174871,
+ 22383.849972683485,
+ 22400.160273832618,
+ 22416.473544540564,
+ 22432.789783726603,
+ 22449.108990310986,
+ 22465.431163214958,
+ 22481.75630136074,
+ 22498.084403671528,
+ 22514.415469071497,
+ 22530.749496485802,
+ 22547.086484840562,
+ 22563.426433062879,
+ 22579.769340080824,
+ 22596.115204823436,
+ 22612.464026220721,
+ 22628.815803203655,
+ 22645.170534704179,
+ 22661.5282196552,
+ 22677.888856990587,
+ 22694.252445645168,
+ 22710.618984554734,
+ 22726.988472656034,
+ 22743.360908886778,
+ 22759.736292185622,
+ 22776.114621492186,
+ 22792.495895747044,
+ 22808.880113891719,
+ 22825.267274868678,
+ 22841.657377621348,
+ 22858.050421094096,
+ 22874.446404232243,
+ 22890.845325982053,
+ 22907.247185290722,
+ 22923.651981106406,
+ 22940.059712378195,
+ 22956.470378056114,
+ 22972.883977091129,
+ 22989.300508435153,
+ 23005.719971041017,
+ 23022.142363862498,
+ 23038.567685854305,
+ 23054.995935972078,
+ 23071.427113172387,
+ 23087.86121641273,
+ 23104.298244651531,
+ 23120.738196848146,
+ 23137.181071962848,
+ 23153.626868956846,
+ 23170.075586792263,
+ 23186.527224432142,
+ 23202.981780840448,
+ 23219.439254982066,
+ 23235.899645822796,
+ 23252.362952329357,
+ 23268.829173469378,
+ 23285.298308211408,
+ 23301.770355524899,
+ 23318.245314380223,
+ 23334.723183748658,
+ 23351.203962602387,
+ 23367.687649914504,
+ 23384.174244659007,
+ 23400.663745810798,
+ 23417.15615234568,
+ 23433.651463240367,
+ 23450.149677472462,
+ 23466.650794020472,
+ 23483.154811863806,
+ 23499.661729982763,
+ 23516.171547358543,
+ 23532.684262973235,
+ 23549.199875809823,
+ 23565.718384852185,
+ 23582.239789085092,
+ 23598.764087494197,
+ 23615.291279066041,
+ 23631.821362788058,
+ 23648.354337648565,
+ 23664.890202636761,
+ 23681.428956742733,
+ 23697.970598957443,
+ 23714.515128272738,
+ 23731.062543681343,
+ 23747.612844176863,
+ 23764.166028753778,
+ 23780.72209640744,
+ 23797.281046134085,
+ 23813.842876930816,
+ 23830.407587795606,
+ 23846.975177727301,
+ 23863.545645725622,
+ 23880.11899079115,
+ 23896.695211925336,
+ 23913.274308130498,
+ 23929.856278409821,
+ 23946.441121767348,
+ 23963.028837207989,
+ 23979.619423737513,
+ 23996.212880362549,
+ 24012.809206090584,
+ 24029.408399929966,
+ 24046.010460889898,
+ 24062.615387980433,
+ 24079.223180212492,
+ 24095.833836597827,
+ 24112.447356149063,
+ 24129.063737879667,
+ 24145.682980803951,
+ 24162.305083937081,
+ 24178.930046295067,
+ 24195.557866894767,
+ 24212.188544753884,
+ 24228.822078890964,
+ 24245.458468325389,
+ 24262.097712077397,
+ 24278.739809168052,
+ 24295.384758619261,
+ 24312.032559453768,
+ 24328.683210695162,
+ 24345.336711367858,
+ 24361.993060497109,
+ 24378.652257108995,
+ 24395.314300230442,
+ 24411.979188889192,
+ 24428.646922113825,
+ 24445.317498933746,
+ 24461.990918379193,
+ 24478.667179481225,
+ 24495.346281271726,
+ 24512.028222783407,
+ 24528.713003049801,
+ 24545.400621105266,
+ 24562.091075984976,
+ 24578.784366724925,
+ 24595.480492361927,
+ 24612.179451933614,
+ 24628.881244478438,
+ 24645.585869035654,
+ 24662.293324645343,
+ 24679.003610348394,
+ 24695.716725186514,
+ 24712.432668202211,
+ 24729.151438438807,
+ 24745.873034940436,
+ 24762.597456752032,
+ 24779.324702919344,
+ 24796.054772488926,
+ 24812.787664508123,
+ 24829.5233780251,
+ 24846.261912088819,
+ 24863.003265749034,
+ 24879.747438056307,
+ 24896.494428062004,
+ 24913.244234818278,
+ 24929.996857378079,
+ 24946.752294795166,
+ 24963.510546124078,
+ 24980.271610420157,
+ 24997.035486739525,
+ 25013.802174139113,
+ 25030.571671676629,
+ 25047.343978410572,
+ 25064.119093400237,
+ 25080.897015705697,
+ 25097.677744387816,
+ 25114.461278508239,
+ 25131.2476171294,
+ 25148.036759314517,
+ 25164.828704127583,
+ 25181.623450633375,
+ 25198.42099789745,
+ 25215.221344986145,
+ 25232.024490966574,
+ 25248.830434906627,
+ 25265.639175874974,
+ 25282.450712941049,
+ 25299.265045175071,
+ 25316.082171648024,
+ 25332.902091431668,
+ 25349.724803598532,
+ 25366.550307221914,
+ 25383.378601375884,
+ 25400.209685135269,
+ 25417.043557575678,
+ 25433.880217773472,
+ 25450.719664805783,
+ 25467.561897750507,
+ 25484.406915686297,
+ 25501.254717692573,
+ 25518.105302849512,
+ 25534.958670238051,
+ 25551.814818939893,
+ 25568.67374803748,
+ 25585.535456614027,
+ 25602.399943753502,
+ 25619.267208540619,
+ 25636.137250060852,
+ 25653.010067400432,
+ 25669.885659646327,
+ 25686.76402588627,
+ 25703.645165208734,
+ 25720.529076702944,
+ 25737.415759458876,
+ 25754.305212567244,
+ 25771.197435119517,
+ 25788.092426207899,
+ 25804.990184925344,
+ 25821.890710365547,
+ 25838.794001622944,
+ 25855.700057792714,
+ 25872.608877970775,
+ 25889.520461253778,
+ 25906.434806739118,
+ 25923.351913524923,
+ 25940.271780710063,
+ 25957.194407394138,
+ 25974.11979267748,
+ 25991.047935661154,
+ 26007.978835446964,
+ 26024.912491137442,
+ 26041.848901835841,
+ 26058.788066646157,
+ 26075.729984673108,
+ 26092.674655022136,
+ 26109.622076799409,
+ 26126.572249111829,
+ 26143.525171067016,
+ 26160.480841773315,
+ 26177.43926033979,
+ 26194.400425876229,
+ 26211.364337493149,
+ 26228.330994301767,
+ 26245.30039541404,
+ 26262.272539942627,
+ 26279.247427000919,
+ 26296.225055703002,
+ 26313.205425163702,
+ 26330.188534498539,
+ 26347.174382823756,
+ 26364.162969256304,
+ 26381.154292913852,
+ 26398.148352914774,
+ 26415.145148378149,
+ 26432.144678423778,
+ 26449.146942172156,
+ 26466.151938744493,
+ 26483.159667262702,
+ 26500.170126849403,
+ 26517.183316627921,
+ 26534.199235722277,
+ 26551.217883257199,
+ 26568.239258358124,
+ 26585.263360151173,
+ 26602.290187763181,
+ 26619.319740321676,
+ 26636.352016954883,
+ 26653.387016791727,
+ 26670.424738961825,
+ 26687.465182595493,
+ 26704.508346823739,
+ 26721.554230778267,
+ 26738.602833591467,
+ 26755.65415439643,
+ 26772.708192326929,
+ 26789.764946517433,
+ 26806.824416103096,
+ 26823.886600219761,
+ 26840.95149800396,
+ 26858.019108592915,
+ 26875.089431124517,
+ 26892.162464737365,
+ 26909.238208570721,
+ 26926.316661764544,
+ 26943.397823459472,
+ 26960.481692796813,
+ 26977.568268918571,
+ 26994.657550967422,
+ 27011.749538086722,
+ 27028.844229420498,
+ 27045.941624113464,
+ 27063.041721311005,
+ 27080.144520159181,
+ 27097.250019804727,
+ 27114.35821939505,
+ 27131.469118078236,
+ 27148.582715003027,
+ 27165.699009318858,
+ 27182.818000175819,
+ 27199.939686724665,
+ 27217.064068116837,
+ 27234.191143504428,
+ 27251.320912040203,
+ 27268.453372877593,
+ 27285.588525170693,
+ 27302.726368074269,
+ 27319.866900743735,
+ 27337.010122335181,
+ 27354.156032005358,
+ 27371.304628911668,
+ 27388.455912212183,
+ 27405.609881065626,
+ 27422.766534631384,
+ 27439.925872069507,
+ 27457.087892540683,
+ 27474.252595206275,
+ 27491.419979228293,
+ 27508.5900437694,
+ 27525.762787992917,
+ 27542.93821106281,
+ 27560.116312143706,
+ 27577.297090400876,
+ 27594.480545000242,
+ 27611.666675108383,
+ 27628.855479892518,
+ 27646.046958520514,
+ 27663.241110160889,
+ 27680.437933982801,
+ 27697.637429156068,
+ 27714.839594851132,
+ 27732.04443023909,
+ 27749.251934491687,
+ 27766.462106781299,
+ 27783.674946280949,
+ 27800.890452164302,
+ 27818.108623605654,
+ 27835.329459779954,
+ 27852.55295986278,
+ 27869.779123030345,
+ 27887.007948459504,
+ 27904.239435327745,
+ 27921.473582813196,
+ 27938.710390094613,
+ 27955.949856351392,
+ 27973.19198076355,
+ 27990.436762511745,
+ 28007.684200777272,
+ 28024.934294742041,
+ 28042.187043588601,
+ 28059.442446500128,
+ 28076.700502660427,
+ 28093.961211253929,
+ 28111.224571465693,
+ 28128.490582481401,
+ 28145.759243487362,
+ 28163.030553670509,
+ 28180.304512218394,
+ 28197.581118319198,
+ 28214.860371161725,
+ 28232.14226993539,
+ 28249.42681383024,
+ 28266.71400203693,
+ 28284.003833746745,
+ 28301.296308151585,
+ 28318.591424443959,
+ 28335.889181817001,
+ 28353.189579464462,
+ 28370.492616580705,
+ 28387.798292360701,
+ 28405.106606000048,
+ 28422.417556694945,
+ 28439.731143642206,
+ 28457.047366039264,
+ 28474.366223084147,
+ 28491.687713975512,
+ 28509.011837912611,
+ 28526.338594095305,
+ 28543.667981724069,
+ 28560.999999999982,
+ 28578.334648124732,
+ 28595.671925300605,
+ 28613.011830730498,
+ 28630.354363617909,
+ 28647.699523166943,
+ 28665.0473085823,
+ 28682.397719069289,
+ 28699.750753833818,
+ 28717.10641208239,
+ 28734.464693022121,
+ 28751.825595860708,
+ 28769.189119806462,
+ 28786.55526406828,
+ 28803.924027855664,
+ 28821.295410378701,
+ 28838.669410848088,
+ 28856.046028475103,
+ 28873.425262471628,
+ 28890.80711205013,
+ 28908.191576423673,
+ 28925.578654805915,
+ 28942.968346411097,
+ 28960.360650454055,
+ 28977.755566150216,
+ 28995.153092715591,
+ 29012.553229366786,
+ 29029.955975320987,
+ 29047.361329795975,
+ 29064.769292010107,
+ 29082.179861182336,
+ 29099.593036532187,
+ 29117.00881727978,
+ 29134.427202645813,
+ 29151.848191851568,
+ 29169.271784118911,
+ 29186.697978670283,
+ 29204.126774728706,
+ 29221.55817151779,
+ 29238.992168261717,
+ 29256.42876418525,
+ 29273.867958513725,
+ 29291.309750473058,
+ 29308.754139289747,
+ 29326.201124190855,
+ 29343.65070440403,
+ 29361.102879157483,
+ 29378.557647680012,
+ 29396.015009200975,
+ 29413.474962950309,
+ 29430.937508158524,
+ 29448.402644056692,
+ 29465.870369876469,
+ 29483.340684850071,
+ 29500.81358821028,
+ 29518.289079190454,
+ 29535.767157024511,
+ 29553.247820946945,
+ 29570.731070192807,
+ 29588.216903997723,
+ 29605.70532159787,
+ 29623.19632223,
+ 29640.689905131429,
+ 29658.186069540028,
+ 29675.684814694236,
+ 29693.186139833047,
+ 29710.690044196028,
+ 29728.196527023298,
+ 29745.705587555527,
+ 29763.217225033964,
+ 29780.731438700397,
+ 29798.248227797183,
+ 29815.76759156723,
+ 29833.289529254005,
+ 29850.81404010153,
+ 29868.341123354381,
+ 29885.870778257693,
+ 29903.403004057145,
+ 29920.937799998974,
+ 29938.475165329975,
+ 29956.015099297485,
+ 29973.557601149394,
+ 29991.102670134147,
+ 30008.650305500738,
+ 30026.200506498706,
+ 30043.753272378144,
+ 30061.308602389683,
+ 30078.866495784507,
+ 30096.426951814352,
+ 30113.989969731494,
+ 30131.55554878875,
+ 30149.123688239491,
+ 30166.694387337629,
+ 30184.267645337608,
+ 30201.843461494434,
+ 30219.42183506364,
+ 30237.002765301309,
+ 30254.586251464058,
+ 30272.172292809046,
+ 30289.760888593977,
+ 30307.35203807709,
+ 30324.94574051716,
+ 30342.541995173502,
+ 30360.140801305966,
+ 30377.742158174944,
+ 30395.346065041358,
+ 30412.952521166666,
+ 30430.561525812864,
+ 30448.173078242475,
+ 30465.787177718561,
+ 30483.403823504719,
+ 30501.02301486507,
+ 30518.644751064272,
+ 30536.269031367516,
+ 30553.895855040515,
+ 30571.525221349519,
+ 30589.157129561307,
+ 30606.791578943175,
+ 30624.428568762964,
+ 30642.06809828903,
+ 30659.710166790261,
+ 30677.35477353607,
+ 30695.001917796391,
+ 30712.651598841687,
+ 30730.303815942945,
+ 30747.958568371676,
+ 30765.615855399912,
+ 30783.275676300211,
+ 30800.938030345646,
+ 30818.602916809814,
+ 30836.270334966837,
+ 30853.940284091354,
+ 30871.612763458521,
+ 30889.287772344011,
+ 30906.965310024025,
+ 30924.645375775272,
+ 30942.327968874983,
+ 30960.013088600903,
+ 30977.700734231294,
+ 30995.390905044929,
+ 31013.083600321101,
+ 31030.778819339619,
+ 31048.476561380798,
+ 31066.17682572547,
+ 31083.879611654978,
+ 31101.584918451179,
+ 31119.29274539644,
+ 31137.003091773637,
+ 31154.715956866155,
+ 31172.431339957893,
+ 31190.14924033326,
+ 31207.869657277162,
+ 31225.592590075023,
+ 31243.318038012771,
+ 31261.046000376838,
+ 31278.776476454172,
+ 31296.50946553221,
+ 31314.24496689891,
+ 31331.98297984272,
+ 31349.7235036526,
+ 31367.466537618013,
+ 31385.212081028923,
+ 31402.960133175795,
+ 31420.710693349596,
+ 31438.463760841791,
+ 31456.219334944351,
+ 31473.977414949743,
+ 31491.738000150934,
+ 31509.501089841389,
+ 31527.266683315069,
+ 31545.034779866437,
+ 31562.80537879045,
+ 31580.578479382562,
+ 31598.35408093872,
+ 31616.132182755369,
+ 31633.91278412945,
+ 31651.695884358396,
+ 31669.481482740131,
+ 31687.269578573076,
+ 31705.060171156143,
+ 31722.853259788735,
+ 31740.648843770748,
+ 31758.446922402567,
+ 31776.247494985066,
+ 31794.050560819614,
+ 31811.85611920806,
+ 31829.664169452753,
+ 31847.474710856521,
+ 31865.287742722685,
+ 31883.103264355046,
+ 31900.921275057899,
+ 31918.741774136019,
+ 31936.564760894671,
+ 31954.390234639599,
+ 31972.21819467704,
+ 31990.048640313704,
+ 32007.881570856793,
+ 32025.716985613984,
+ 32043.554883893445,
+ 32061.395265003815,
+ 32079.238128254223,
+ 32097.083472954269,
+ 32114.931298414049,
+ 32132.781603944117,
+ 32150.634388855524,
+ 32168.48965245979,
+ 32186.347394068915,
+ 32204.207612995371,
+ 32222.07030855212,
+ 32239.935480052583,
+ 32257.803126810672,
+ 32275.673248140767,
+ 32293.545843357719,
+ 32311.420911776862,
+ 32329.298452713996,
+ 32347.178465485395,
+ 32365.060949407813,
+ 32382.945903798463,
+ 32400.83332797504,
+ 32418.723221255706,
+ 32436.615582959093,
+ 32454.510412404306,
+ 32472.407708910916,
+ 32490.307471798966,
+ 32508.209700388961,
+ 32526.114394001877,
+ 32544.021551959166,
+ 32561.931173582732,
+ 32579.843258194956,
+ 32597.757805118679,
+ 32615.674813677211,
+ 32633.594283194328,
+ 32651.516212994258,
+ 32669.440602401712,
+ 32687.367450741847,
+ 32705.296757340297,
+ 32723.228521523146,
+ 32741.162742616943,
+ 32759.099419948703,
+ 32777.038552845901,
+ 32794.980140636464,
+ 32812.924182648792,
+ 32830.87067821173,
+ 32848.819626654593,
+ 32866.77102730715,
+ 32884.724879499619,
+ 32902.681182562686,
+ 32920.639935827494,
+ 32938.601138625643,
+ 32956.56479028918,
+ 32974.530890150607,
+ 32992.499437542894,
+ 33010.470431799447,
+ 33028.443872254145,
+ 33046.419758241311,
+ 33064.39808909571,
+ 33082.378864152583,
+ 33100.36208274759,
+ 33118.347744216881,
+ 33136.335847897026,
+ 33154.326393125062,
+ 33172.31937923847,
+ 33190.314805575174,
+ 33208.312671473555,
+ 33226.312976272442,
+ 33244.315719311111,
+ 33262.320899929284,
+ 33280.328517467125,
+ 33298.33857126526,
+ 33316.351060664747,
+ 33334.365985007091,
+ 33352.383343634239,
+ 33370.403135888591,
+ 33388.42536111299,
+ 33406.450018650721,
+ 33424.477107845501,
+ 33442.506628041512,
+ 33460.53857858335,
+ 33478.572958816083,
+ 33496.609768085189,
+ 33514.649005736617,
+ 33532.690671116739,
+ 33550.734763572356,
+ 33568.781282450735,
+ 33586.830227099563,
+ 33604.881596866973,
+ 33622.935391101528,
+ 33640.991609152239,
+ 33659.050250368542,
+ 33677.111314100322,
+ 33695.174799697881,
+ 33713.240706511984,
+ 33731.309033893805,
+ 33749.37978119497,
+ 33767.452947767531,
+ 33785.528532963974,
+ 33803.606536137209,
+ 33821.686956640602,
+ 33839.769793827938,
+ 33857.855047053425,
+ 33875.942715671707,
+ 33894.032799037872,
+ 33912.125296507431,
+ 33930.220207436316,
+ 33948.317531180888,
+ 33966.417267097961,
+ 33984.519414544746,
+ 34002.623972878901,
+ 34020.730941458511,
+ 34038.840319642077,
+ 34056.952106788536,
+ 34075.066302257255,
+ 34093.182905408015,
+ 34111.301915601027,
+ 34129.42333219693,
+ 34147.547154556785,
+ 34165.673382042078,
+ 34183.80201401472,
+ 34201.933049837033,
+ 34220.06648887178,
+ 34238.202330482141,
+ 34256.340574031703,
+ 34274.481218884495,
+ 34292.624264404949,
+ 34310.769709957938,
+ 34328.91755490873,
+ 34347.067798623029,
+ 34365.220440466954,
+ 34383.375479807051,
+ 34401.532916010263,
+ 34419.692748443973,
+ 34437.854976475966,
+ 34456.01959947445,
+ 34474.18661680806,
+ 34492.356027845817,
+ 34510.527831957188,
+ 34528.702028512052,
+ 34546.878616880676,
+ 34565.05759643377,
+ 34583.238966542449,
+ 34601.422726578232,
+ 34619.608875913065,
+ 34637.797413919296,
+ 34655.988339969692,
+ 34674.181653437423,
+ 34692.37735369608,
+ 34710.575440119668,
+ 34728.775912082579,
+ 34746.978768959649,
+ 34765.184010126082,
+ 34783.391634957537,
+ 34801.60164283005,
+ 34819.814033120063,
+ 34838.028805204456,
+ 34856.24595846048,
+ 34874.465492265823,
+ 34892.687405998557,
+ 34910.911699037177,
+ 34929.138370760564,
+ 34947.367420548027,
+ 34965.598847779271,
+ 34983.832651834389,
+ 35002.068832093908,
+ 35020.307387938738,
+ 35038.548318750189,
+ 35056.79162390998,
+ 35075.03730280025,
+ 35093.285354803513,
+ 35111.535779302685,
+ 35129.788575681116,
+ 35148.043743322516,
+ 35166.301281611013,
+ 35184.561189931141,
+ 35202.823467667826,
+ 35221.088114206388,
+ 35239.355128932555,
+ 35257.624511232447,
+ 35275.896260492584,
+ 35294.170376099886,
+ 35312.446857441668,
+ 35330.725703905628,
+ 35349.006914879887,
+ 35367.290489752944,
+ 35385.576427913686,
+ 35403.864728751418,
+ 35422.155391655811,
+ 35440.448416016967,
+ 35458.743801225341,
+ 35477.041546671804,
+ 35495.341651747622,
+ 35513.644115844436,
+ 35531.948938354304,
+ 35550.256118669655,
+ 35568.565656183309,
+ 35586.877550288496,
+ 35605.191800378816,
+ 35623.508405848268,
+ 35641.827366091238,
+ 35660.148680502505,
+ 35678.472348477233,
+ 35696.798369410979,
+ 35715.126742699678,
+ 35733.457467739659,
+ 35751.790543927644,
+ 35770.125970660738,
+ 35788.46374733642,
+ 35806.803873352568,
+ 35825.146348107453,
+ 35843.49117099971,
+ 35861.838341428367,
+ 35880.187858792851,
+ 35898.539722492955,
+ 35916.893931928862,
+ 35935.250486501129,
+ 35953.609385610718,
+ 35971.970628658957,
+ 35990.334215047558,
+ 36008.700144178612,
+ 36027.068415454596,
+ 36045.439028278372,
+ 36063.811982053165,
+ 36082.187276182609,
+ 36100.564910070694,
+ 36118.944883121789,
+ 36137.327194740654,
+ 36155.711844332429,
+ 36174.098831302617,
+ 36192.488155057115,
+ 36210.87981500219,
+ 36229.273810544473,
+ 36247.670141091003,
+ 36266.068806049167,
+ 36284.469804826738,
+ 36302.873136831862,
+ 36321.278801473069,
+ 36339.686798159251,
+ 36358.097126299683,
+ 36376.509785304013,
+ 36394.924774582258,
+ 36413.342093544816,
+ 36431.761741602444,
+ 36450.183718166292,
+ 36468.608022647859,
+ 36487.034654459028,
+ 36505.463613012063,
+ 36523.894897719583,
+ 36542.328507994578,
+ 36560.764443250409,
+ 36579.202702900831,
+ 36597.643286359926,
+ 36616.086193042182,
+ 36634.531422362437,
+ 36652.978973735895,
+ 36671.428846578143,
+ 36689.881040305125,
+ 36708.335554333149,
+ 36726.792388078902,
+ 36745.251540959427,
+ 36763.713012392138,
+ 36782.176801794812,
+ 36800.642908585593,
+ 36819.111332182983,
+ 36837.582072005869,
+ 36856.055127473483,
+ 36874.530498005421,
+ 36893.008183021651,
+ 36911.488181942506,
+ 36929.970494188674,
+ 36948.455119181206,
+ 36966.942056341519,
+ 36985.431305091392,
+ 37003.922864852961,
+ 37022.416735048733,
+ 37040.912915101559,
+ 37059.411404434657,
+ 37077.91220247162,
+ 37096.415308636388,
+ 37114.920722353243,
+ 37133.428443046862,
+ 37151.938470142253,
+ 37170.450803064785,
+ 37188.965441240209,
+ 37207.482384094597,
+ 37226.001631054402,
+ 37244.523181546429,
+ 37263.047034997842,
+ 37281.573190836149,
+ 37300.101648489224,
+ 37318.632407385296,
+ 37337.165466952945,
+ 37355.700826621112,
+ 37374.238485819085,
+ 37392.778443976509,
+ 37411.320700523385,
+ 37429.865254890057,
+ 37448.412106507232,
+ 37466.961254805974,
+ 37485.512699217681,
+ 37504.066439174116,
+ 37522.622474107404,
+ 37541.180803449992,
+ 37559.741426634704,
+ 37578.304343094693,
+ 37596.869552263488,
+ 37615.43705357494,
+ 37634.006846463279,
+ 37652.578930363044,
+ 37671.153304709165,
+ 37689.729968936896,
+ 37708.308922481847,
+ 37726.890164779965,
+ 37745.473695267559,
+ 37764.059513381275,
+ 37782.647618558112,
+ 37801.238010235415,
+ 37819.830687850859,
+ 37838.425650842495,
+ 37857.022898648691,
+ 37875.622430708172,
+ 37894.224246460013,
+ 37912.828345343616,
+ 37931.434726798747,
+ 37950.043390265506,
+ 37968.654335184328,
+ 37987.267560995999,
+ 38005.883067141665,
+ 38024.500853062775,
+ 38043.120918201159,
+ 38061.743261998963,
+ 38080.367883898682,
+ 38098.994783343158,
+ 38117.623959775563,
+ 38136.255412639417,
+ 38154.889141378575,
+ 38173.525145437234,
+ 38192.163424259939,
+ 38210.803977291551,
+ 38229.446803977284,
+ 38248.091903762703,
+ 38266.739276093685,
+ 38285.388920416466,
+ 38304.040836177606,
+ 38322.695022824002,
+ 38341.351479802899,
+ 38360.010206561863,
+ 38378.671202548816,
+ 38397.334467211993,
+ 38415.999999999978,
+ 38434.667800361683,
+ 38453.33786774637,
+ 38472.010201603611,
+ 38490.684801383337,
+ 38509.361666535784,
+ 38528.040796511552,
+ 38546.722190761553,
+ 38565.405848737035,
+ 38584.091769889594,
+ 38602.779953671132,
+ 38621.470399533908,
+ 38640.163106930493,
+ 38658.858075313794,
+ 38677.555304137059,
+ 38696.254792853862,
+ 38714.956540918094,
+ 38733.660547783991,
+ 38752.366812906112,
+ 38771.075335739348,
+ 38789.78611573892,
+ 38808.499152360368,
+ 38827.214445059573,
+ 38845.931993292739,
+ 38864.651796516388,
+ 38883.373854187383,
+ 38902.098165762916,
+ 38920.824730700486,
+ 38939.553548457938,
+ 38958.284618493431,
+ 38977.017940265461,
+ 38995.753513232834,
+ 39014.491336854699,
+ 39033.231410590517,
+ 39051.973733900079,
+ 39070.718306243485,
+ 39089.465127081188,
+ 39108.214195873945,
+ 39126.965512082832,
+ 39145.719075169261,
+ 39164.474884594965,
+ 39183.232939821988,
+ 39201.99324031271,
+ 39220.755785529815,
+ 39239.52057493633,
+ 39258.287607995589,
+ 39277.056884171245,
+ 39295.828402927284,
+ 39314.602163728006,
+ 39333.378166038019,
+ 39352.15640932227,
+ 39370.936893046004,
+ 39389.719616674811,
+ 39408.504579674584,
+ 39427.291781511522,
+ 39446.081221652174,
+ 39464.872899563372,
+ 39483.666814712291,
+ 39502.462966566411,
+ 39521.261354593538,
+ 39540.06197826178,
+ 39558.864837039568,
+ 39577.669930395656,
+ 39596.47725779911,
+ 39615.286818719302,
+ 39634.098612625923,
+ 39652.912638988993,
+ 39671.728897278823,
+ 39690.547386966064,
+ 39709.368107521652,
+ 39728.191058416858,
+ 39747.016239123259,
+ 39765.84364911275,
+ 39784.673287857528,
+ 39803.505154830105,
+ 39822.339249503319,
+ 39841.175571350293,
+ 39860.014119844491,
+ 39878.854894459677,
+ 39897.697894669909,
+ 39916.54311994958,
+ 39935.390569773372,
+ 39954.240243616303,
+ 39973.092140953675,
+ 39991.946261261117,
+ 40010.802604014549,
+ 40029.661168690225,
+ 40048.521954764678,
+ 40067.384961714779,
+ 40086.250189017679,
+ 40105.117636150855,
+ 40123.98730259209,
+ 40142.859187819471,
+ 40161.733291311379,
+ 40180.609612546526,
+ 40199.488151003912,
+ 40218.368906162854,
+ 40237.25187750296,
+ 40256.137064504153,
+ 40275.024466646668,
+ 40293.914083411029,
+ 40312.805914278084,
+ 40331.699958728961,
+ 40350.596216245103,
+ 40369.494686308273,
+ 40388.39536840051,
+ 40407.298262004173,
+ 40426.20336660192,
+ 40445.110681676706,
+ 40464.020206711793,
+ 40482.931941190756,
+ 40501.845884597446,
+ 40520.762036416032,
+ 40539.680396130985,
+ 40558.600963227072,
+ 40577.523737189367,
+ 40596.448717503234,
+ 40615.375903654342,
+ 40634.305295128659,
+ 40653.236891412453,
+ 40672.170691992294,
+ 40691.106696355047,
+ 40710.044903987873,
+ 40728.985314378238,
+ 40747.927927013901,
+ 40766.872741382918,
+ 40785.819756973651,
+ 40804.768973274746,
+ 40823.720389775161,
+ 40842.674005964131,
+ 40861.629821331211,
+ 40880.587835366234,
+ 40899.548047559321,
+ 40918.510457400931,
+ 40937.475064381761,
+ 40956.441867992849,
+ 40975.410867725499,
+ 40994.382063071331,
+ 41013.355453522236,
+ 41032.331038570417,
+ 41051.308817708363,
+ 41070.288790428858,
+ 41089.270956224987,
+ 41108.255314590111,
+ 41127.241865017888,
+ 41146.23060700229,
+ 41165.221540037543,
+ 41184.214663618193,
+ 41203.209977239079,
+ 41222.207480395307,
+ 41241.207172582297,
+ 41260.209053295752,
+ 41279.213122031659,
+ 41298.219378286303,
+ 41317.227821556255,
+ 41336.23845133838,
+ 41355.251267129832,
+ 41374.266268428037,
+ 41393.283454730743,
+ 41412.302825535953,
+ 41431.324380341983,
+ 41450.348118647416,
+ 41469.374039951144,
+ 41488.402143752326,
+ 41507.432429550427,
+ 41526.464896845187,
+ 41545.499545136627,
+ 41564.536373925075,
+ 41583.575382711126,
+ 41602.616570995662,
+ 41621.659938279874,
+ 41640.705484065205,
+ 41659.753207853406,
+ 41678.803109146495,
+ 41697.855187446803,
+ 41716.909442256911,
+ 41735.965873079709,
+ 41755.02447941836,
+ 41774.085260776315,
+ 41793.148216657297,
+ 41812.213346565331,
+ 41831.280650004708,
+ 41850.350126480014,
+ 41869.421775496106,
+ 41888.495596558132,
+ 41907.571589171515,
+ 41926.649752841957,
+ 41945.730087075463,
+ 41964.812591378286,
+ 41983.897265256979,
+ 42002.984108218378,
+ 42022.073119769593,
+ 42041.164299418015,
+ 42060.257646671307,
+ 42079.353161037419,
+ 42098.450842024591,
+ 42117.550689141324,
+ 42136.652701896404,
+ 42155.756879798893,
+ 42174.863222358137,
+ 42193.971729083758,
+ 42213.082399485655,
+ 42232.195233074002,
+ 42251.310229359246,
+ 42270.427387852127,
+ 42289.546708063644,
+ 42308.668189505079,
+ 42327.791831687995,
+ 42346.917634124227,
+ 42366.045596325886,
+ 42385.175717805352,
+ 42404.307998075295,
+ 42423.442436648642,
+ 42442.579033038608,
+ 42461.717786758672,
+ 42480.858697322597,
+ 42500.001764244422,
+ 42519.146987038446,
+ 42538.294365219248,
+ 42557.443898301688,
+ 42576.595585800882,
+ 42595.749427232236,
+ 42614.90542211142,
+ 42634.063569954378,
+ 42653.223870277317,
+ 42672.386322596729,
+ 42691.55092642938,
+ 42710.717681292292,
+ 42729.886586702756,
+ 42749.057642178363,
+ 42768.23084723694,
+ 42787.406201396603,
+ 42806.58370417574,
+ 42825.76335509299,
+ 42844.945153667286,
+ 42864.129099417805,
+ 42883.315191864014,
+ 42902.503430525649,
+ 42921.693814922692,
+ 42940.88634457541,
+ 42960.081019004348,
+ 42979.277837730297,
+ 42998.476800274322,
+ 43017.677906157769,
+ 43036.881154902228,
+ 43056.086546029583,
+ 43075.294079061961,
+ 43094.503753521763,
+ 43113.715568931671,
+ 43132.929524814601,
+ 43152.145620693766,
+ 43171.363856092619,
+ 43190.584230534907,
+ 43209.806743544621,
+ 43229.031394646016,
+ 43248.258183363621,
+ 43267.487109222224,
+ 43286.718171746885,
+ 43305.951370462906,
+ 43325.186704895881,
+ 43344.42417457165,
+ 43363.663779016322,
+ 43382.905517756262,
+ 43402.149390318104,
+ 43421.395396228749,
+ 43440.643535015348,
+ 43459.89380620532,
+ 43479.146209326354,
+ 43498.400743906379,
+ 43517.657409473606,
+ 43536.916205556496,
+ 43556.177131683784,
+ 43575.44018738444,
+ 43594.705372187724,
+ 43613.972685623135,
+ 43633.242127220445,
+ 43652.513696509668,
+ 43671.787393021099,
+ 43691.063216285271,
+ 43710.341165833001,
+ 43729.621241195346,
+ 43748.903441903625,
+ 43768.187767489413,
+ 43787.474217484552,
+ 43806.762791421126,
+ 43826.053488831501,
+ 43845.346309248278,
+ 43864.641252204325,
+ 43883.938317232765,
+ 43903.237503866971,
+ 43922.538811640596,
+ 43941.842240087513,
+ 43961.147788741881,
+ 43980.455457138101,
+ 43999.765244810835,
+ 44019.077151295001,
+ 44038.391176125755,
+ 44057.70731883854,
+ 44077.02557896902,
+ 44096.345956053141,
+ 44115.668449627083,
+ 44134.993059227287,
+ 44154.319784390456,
+ 44173.648624653535,
+ 44192.979579553728,
+ 44212.312648628489,
+ 44231.647831415532,
+ 44250.985127452805,
+ 44270.324536278538,
+ 44289.666057431183,
+ 44309.009690449464,
+ 44328.355434872348,
+ 44347.703290239064,
+ 44367.053256089079,
+ 44386.405331962109,
+ 44405.759517398139,
+ 44425.115811937387,
+ 44444.474215120332,
+ 44463.834726487694,
+ 44483.197345580462,
+ 44502.562071939843,
+ 44521.928905107328,
+ 44541.297844624634,
+ 44560.668890033732,
+ 44580.042040876848,
+ 44599.417296696454,
+ 44618.794657035272,
+ 44638.174121436256,
+ 44657.555689442641,
+ 44676.939360597877,
+ 44696.325134445673,
+ 44715.713010530002,
+ 44735.102988395054,
+ 44754.495067585296,
+ 44773.88924764542,
+ 44793.285528120374,
+ 44812.683908555344,
+ 44832.084388495779,
+ 44851.486967487363,
+ 44870.891645076015,
+ 44890.298420807922,
+ 44909.707294229491,
+ 44929.118264887409,
+ 44948.531332328566,
+ 44967.946496100136,
+ 44987.363755749502,
+ 45006.783110824319,
+ 45026.204560872473,
+ 45045.628105442098,
+ 45065.053744081561,
+ 45084.48147633949,
+ 45103.911301764747,
+ 45123.343219906426,
+ 45142.777230313885,
+ 45162.21333253671,
+ 45181.651526124733,
+ 45201.091810628037,
+ 45220.534185596924,
+ 45239.978650581965,
+ 45259.425205133957,
+ 45278.873848803938,
+ 45298.324581143192,
+ 45317.777401703235,
+ 45337.232310035848,
+ 45356.68930569302,
+ 45376.148388226997,
+ 45395.60955719027,
+ 45415.072812135557,
+ 45434.538152615823,
+ 45454.005578184282,
+ 45473.475088394356,
+ 45492.946682799746,
+ 45512.420360954362,
+ 45531.896122412363,
+ 45551.373966728155,
+ 45570.853893456362,
+ 45590.33590215187,
+ 45609.819992369776,
+ 45629.306163665438,
+ 45648.794415594442,
+ 45668.284747712612,
+ 45687.777159576006,
+ 45707.27165074092,
+ 45726.768220763894,
+ 45746.266869201696,
+ 45765.767595611323,
+ 45785.270399550034,
+ 45804.775280575297,
+ 45824.282238244828,
+ 45843.79127211657,
+ 45863.302381748719,
+ 45882.815566699683,
+ 45902.33082652813,
+ 45921.848160792935,
+ 45941.367569053225,
+ 45960.889050868354,
+ 45980.41260579793,
+ 45999.938233401757,
+ 46019.465933239902,
+ 46038.995704872657,
+ 46058.527547860547,
+ 46078.06146176433,
+ 46097.597446144995,
+ 46117.135500563774,
+ 46136.675624582109,
+ 46156.217817761702,
+ 46175.762079664462,
+ 46195.308409852543,
+ 46214.856807888333,
+ 46234.407273334444,
+ 46253.959805753715,
+ 46273.51440470924,
+ 46293.071069764315,
+ 46312.629800482478,
+ 46332.190596427499,
+ 46351.753457163381,
+ 46371.318382254351,
+ 46390.885371264863,
+ 46410.45442375962,
+ 46430.025539303526,
+ 46449.598717461733,
+ 46469.17395779962,
+ 46488.751259882782,
+ 46508.33062327707,
+ 46527.912047548532,
+ 46547.495532263471,
+ 46567.081076988397,
+ 46586.668681290059,
+ 46606.258344735434,
+ 46625.850066891719,
+ 46645.443847326351,
+ 46665.039685606986,
+ 46684.637581301497,
+ 46704.237533978005,
+ 46723.839543204842,
+ 46743.443608550573,
+ 46763.049729583989,
+ 46782.657905874104,
+ 46802.268136990162,
+ 46821.880422501628,
+ 46841.494761978196,
+ 46861.111154989776,
+ 46880.729601106526,
+ 46900.350099898795,
+ 46919.97265093719,
+ 46939.597253792526,
+ 46959.223908035841,
+ 46978.852613238392,
+ 46998.483368971691,
+ 47018.11617480743,
+ 47037.751030317551,
+ 47057.387935074221,
+ 47077.026888649809,
+ 47096.66789061694,
+ 47116.310940548428,
+ 47135.956038017328,
+ 47155.603182596918,
+ 47175.252373860698,
+ 47194.903611382375,
+ 47214.556894735892,
+ 47234.212223495422,
+ 47253.869597235338,
+ 47273.52901553025,
+ 47293.19047795498,
+ 47312.853984084577,
+ 47332.519533494306,
+ 47352.187125759658,
+ 47371.856760456343,
+ 47391.528437160297,
+ 47411.202155447652,
+ 47430.877914894787,
+ 47450.555715078299,
+ 47470.235555574982,
+ 47489.917435961863,
+ 47509.601355816201,
+ 47529.287314715453,
+ 47548.975312237308,
+ 47568.665347959672,
+ 47588.357421460656,
+ 47608.051532318605,
+ 47627.747680112072,
+ 47647.445864419846,
+ 47667.14608482091,
+ 47686.848340894474,
+ 47706.552632219973,
+ 47726.258958377046,
+ 47745.967318945557,
+ 47765.677713505589,
+ 47785.390141637428,
+ 47805.104602921601,
+ 47824.821096938824,
+ 47844.539623270044,
+ 47864.260181496429,
+ 47883.982771199349,
+ 47903.707391960394,
+ 47923.434043361369,
+ 47943.162724984308,
+ 47962.893436411439,
+ 47982.626177225218,
+ 48002.36094700831,
+ 48022.097745343599,
+ 48041.836571814172,
+ 48061.57742600335,
+ 48081.32030749465,
+ 48101.065215871815,
+ 48120.81215071879,
+ 48140.56111161974,
+ 48160.312098159047,
+ 48180.065109921306,
+ 48199.820146491307,
+ 48219.577207454073,
+ 48239.336292394844,
+ 48259.097400899045,
+ 48278.860532552339,
+ 48298.625686940592,
+ 48318.392863649875,
+ 48338.162062266485,
+ 48357.933282376915,
+ 48377.706523567889,
+ 48397.481785426316,
+ 48417.259067539344,
+ 48437.038369494308,
+ 48456.819690878765,
+ 48476.603031280487,
+ 48496.388390287451,
+ 48516.175767487839,
+ 48535.965162470042,
+ 48555.756574822684,
+ 48575.550004134566,
+ 48595.345449994718,
+ 48615.142911992378,
+ 48634.942389716991,
+ 48654.743882758201,
+ 48674.547390705877,
+ 48694.352913150084,
+ 48714.160449681112,
+ 48733.969999889443,
+ 48753.781563365759,
+ 48773.595139700978,
+ 48793.410728486211,
+ 48813.228329312769,
+ 48833.047941772187,
+ 48852.869565456189,
+ 48872.693199956717,
+ 48892.518844865925,
+ 48912.346499776155,
+ 48932.176164279976,
+ 48952.007837970152,
+ 48971.841520439666,
+ 48991.677211281676,
+ 49011.514910089587,
+ 49031.354616456978,
+ 49051.196329977654,
+ 49071.04005024561,
+ 49090.885776855059,
+ 49110.733509400408,
+ 49130.583247476279,
+ 49150.434990677488,
+ 49170.288738599062,
+ 49190.144490836232,
+ 49210.002246984441,
+ 49229.86200663932,
+ 49249.723769396718,
+ 49269.587534852675,
+ 49289.453302603448,
+ 49309.32107224549,
+ 49329.190843375451,
+ 49349.062615590192,
+ 49368.936388486785,
+ 49388.812161662492,
+ 49408.689934714785,
+ 49428.569707241324,
+ 49448.45147883999,
+ 49468.335249108866,
+ 49488.22101764621,
+ 49508.108784050521,
+ 49527.99854792047,
+ 49547.890308854934,
+ 49567.784066453009,
+ 49587.679820313977,
+ 49607.57757003732,
+ 49627.477315222721,
+ 49647.379055470075,
+ 49667.28279037946,
+ 49687.188519551179,
+ 49707.096242585707,
+ 49727.005959083741,
+ 49746.917668646165,
+ 49766.831370874068,
+ 49786.747065368734,
+ 49806.66475173166,
+ 49826.584429564515,
+ 49846.506098469203,
+ 49866.429758047794,
+ 49886.355407902578,
+ 49906.283047636032,
+ 49926.212676850846,
+ 49946.144295149883,
+ 49966.077902136225,
+ 49986.013497413151,
+ 50005.951080584135,
+ 50025.890651252834,
+ 50045.832209023123,
+ 50065.775753499074,
+ 50085.721284284933,
+ 50105.668800985164,
+ 50125.618303204428,
+ 50145.569790547575,
+ 50165.523262619652,
+ 50185.478719025901,
+ 50205.436159371769,
+ 50225.395583262893,
+ 50245.356990305103,
+ 50265.320380104429,
+ 50285.285752267104,
+ 50305.253106399534,
+ 50325.222442108337,
+ 50345.193759000336,
+ 50365.16705668252,
+ 50385.142334762102,
+ 50405.119592846473,
+ 50425.098830543218,
+ 50445.080047460127,
+ 50465.063243205179,
+ 50485.048417386541,
+ 50505.035569612577,
+ 50525.024699491856,
+ 50545.015806633128,
+ 50565.008890645338,
+ 50585.003951137631,
+ 50605.00098771933,
+ 50624.999999999971,
+ 50645.000987589265,
+ 50665.003950097132,
+ 50685.008887133677,
+ 50705.015798309192,
+ 50725.024683234165,
+ 50745.035541519283,
+ 50765.048372775411,
+ 50785.063176613621,
+ 50805.079952645159,
+ 50825.098700481489,
+ 50845.119419734241,
+ 50865.142110015244,
+ 50885.166770936521,
+ 50905.193402110279,
+ 50925.222003148934,
+ 50945.252573665071,
+ 50965.285113271471,
+ 50985.319621581119,
+ 51005.356098207172,
+ 51025.394542762981,
+ 51045.434954862096,
+ 51065.477334118244,
+ 51085.521680145357,
+ 51105.567992557546,
+ 51125.616270969113,
+ 51145.66651499454,
+ 51165.718724248516,
+ 51185.772898345916,
+ 51205.829036901778,
+ 51225.887139531362,
+ 51245.947205850105,
+ 51266.009235473619,
+ 51286.073228017718,
+ 51306.139183098399,
+ 51326.207100331856,
+ 51346.276979334456,
+ 51366.348819722756,
+ 51386.42262111351,
+ 51406.498383123653,
+ 51426.57610537031,
+ 51446.655787470787,
+ 51466.737429042587,
+ 51486.82102970338,
+ 51506.906589071048,
+ 51526.994106763632,
+ 51547.083582399391,
+ 51567.175015596738,
+ 51587.268405974297,
+ 51607.363753150858,
+ 51627.461056745415,
+ 51647.56031637713,
+ 51667.661531665362,
+ 51687.764702229651,
+ 51707.869827689727,
+ 51727.976907665499,
+ 51748.085941777055,
+ 51768.196929644677,
+ 51788.309870888836,
+ 51808.42476513017,
+ 51828.541611989524,
+ 51848.660411087905,
+ 51868.781162046515,
+ 51888.90386448674,
+ 51909.028518030143,
+ 51929.155122298485,
+ 51949.283676913685,
+ 51969.414181497872,
+ 51989.546635673345,
+ 52009.681039062583,
+ 52029.817391288263,
+ 52049.955691973213,
+ 52070.095940740481,
+ 52090.238137213273,
+ 52110.382281014987,
+ 52130.5283717692,
+ 52150.676409099666,
+ 52170.826392630333,
+ 52190.97832198532,
+ 52211.132196788931,
+ 52231.288016665654,
+ 52251.445781240145,
+ 52271.60549013727,
+ 52291.76714298204,
+ 52311.930739399664,
+ 52332.096279015546,
+ 52352.263761455244,
+ 52372.433186344519,
+ 52392.604553309284,
+ 52412.777861975665,
+ 52432.953111969946,
+ 52453.130302918595,
+ 52473.309434448267,
+ 52493.490506185793,
+ 52513.67351775818,
+ 52533.858468792605,
+ 52554.045358916446,
+ 52574.234187757254,
+ 52594.42495494274,
+ 52614.617660100812,
+ 52634.812302859558,
+ 52655.008882847229,
+ 52675.20739969227,
+ 52695.407853023295,
+ 52715.610242469098,
+ 52735.814567658657,
+ 52756.02082822111,
+ 52776.229023785803,
+ 52796.439153982225,
+ 52816.651218440056,
+ 52836.865216789171,
+ 52857.081148659599,
+ 52877.29901368155,
+ 52897.518811485425,
+ 52917.740541701773,
+ 52937.964203961354,
+ 52958.18979789508,
+ 52978.417323134046,
+ 52998.646779309529,
+ 53018.878166052978,
+ 53039.111482996006,
+ 53059.346729770419,
+ 53079.583906008193,
+ 53099.823011341483,
+ 53120.0640454026,
+ 53140.307007824063,
+ 53160.551898238533,
+ 53180.79871627887,
+ 53201.047461578091,
+ 53221.2981337694,
+ 53241.550732486176,
+ 53261.805257361964,
+ 53282.061708030487,
+ 53302.32008412564,
+ 53322.580385281493,
+ 53342.842611132299,
+ 53363.106761312469,
+ 53383.372835456597,
+ 53403.640833199453,
+ 53423.910754175973,
+ 53444.18259802126,
+ 53464.456364370613,
+ 53484.732052859479,
+ 53505.009663123499,
+ 53525.289194798468,
+ 53545.570647520362,
+ 53565.854020925333,
+ 53586.139314649699,
+ 53606.426528329954,
+ 53626.715661602764,
+ 53647.006714104959,
+ 53667.299685473547,
+ 53687.59457534572,
+ 53707.891383358816,
+ 53728.190109150361,
+ 53748.490752358055,
+ 53768.793312619753,
+ 53789.09778957349,
+ 53809.404182857485,
+ 53829.712492110106,
+ 53850.022716969899,
+ 53870.334857075584,
+ 53890.648912066055,
+ 53910.964881580367,
+ 53931.28276525774,
+ 53951.602562737586,
+ 53971.924273659461,
+ 53992.24789766311,
+ 54012.57343438844,
+ 54032.90088347553,
+ 54053.23024456462,
+ 54073.561517296133,
+ 54093.894701310644,
+ 54114.22979624891,
+ 54134.566801751855,
+ 54154.90571746057,
+ 54175.246543016314,
+ 54195.589278060506,
+ 54215.933922234755,
+ 54236.280475180814,
+ 54256.628936540626,
+ 54276.97930595628,
+ 54297.331583070045,
+ 54317.685767524359,
+ 54338.041858961828,
+ 54358.399857025215,
+ 54378.759761357462,
+ 54399.121571601667,
+ 54419.485287401105,
+ 54439.850908399218,
+ 54460.218434239614,
+ 54480.587864566056,
+ 54500.95919902248,
+ 54521.332437252997,
+ 54541.707578901878,
+ 54562.084623613555,
+ 54582.46357103264,
+ 54602.844420803893,
+ 54623.227172572246,
+ 54643.611825982807,
+ 54663.998380680838,
+ 54684.386836311773,
+ 54704.777192521207,
+ 54725.169448954897,
+ 54745.563605258772,
+ 54765.959661078923,
+ 54786.357616061614,
+ 54806.757469853255,
+ 54827.159222100439,
+ 54847.562872449904,
+ 54867.968420548583,
+ 54888.375866043534,
+ 54908.785208582012,
+ 54929.196447811417,
+ 54949.609583379322,
+ 54970.024614933463,
+ 54990.441542121727,
+ 55010.86036459219,
+ 55031.28108199306,
+ 55051.703693972733,
+ 55072.128200179759,
+ 55092.554600262847,
+ 55112.982893870874,
+ 55133.413080652877,
+ 55153.845160258061,
+ 55174.279132335789,
+ 55194.714996535586,
+ 55215.152752507143,
+ 55235.592399900306,
+ 55256.033938365079,
+ 55276.477367551655,
+ 55296.92268711036,
+ 55317.369896691685,
+ 55337.818995946305,
+ 55358.269984525024,
+ 55378.72286207883,
+ 55399.177628258869,
+ 55419.634282716441,
+ 55440.092825103013,
+ 55460.553255070205,
+ 55481.015572269804,
+ 55501.479776353764,
+ 55521.945866974187,
+ 55542.413843783339,
+ 55562.883706433655,
+ 55583.355454577715,
+ 55603.82908786826,
+ 55624.304605958219,
+ 55644.782008500639,
+ 55665.261295148754,
+ 55685.742465555952,
+ 55706.225519375774,
+ 55726.710456261928,
+ 55747.197275868275,
+ 55767.685977848843,
+ 55788.176561857814,
+ 55808.669027549528,
+ 55829.163374578478,
+ 55849.659602599328,
+ 55870.157711266889,
+ 55890.657700236145,
+ 55911.159569162221,
+ 55931.663317700411,
+ 55952.168945506164,
+ 55972.676452235086,
+ 55993.185837542944,
+ 56013.697101085651,
+ 56034.210242519301,
+ 56054.72526150012,
+ 56075.242157684508,
+ 56095.760930729011,
+ 56116.281580290342,
+ 56136.804106025367,
+ 56157.328507591104,
+ 56177.85478464474,
+ 56198.382936843598,
+ 56218.912963845185,
+ 56239.444865307138,
+ 56259.978640887268,
+ 56280.514290243525,
+ 56301.051813034042,
+ 56321.591208917082,
+ 56342.13247755108,
+ 56362.675618594607,
+ 56383.220631706419,
+ 56403.767516545398,
+ 56424.316272770608,
+ 56444.866900041241,
+ 56465.419398016667,
+ 56485.973766356394,
+ 56506.530004720102,
+ 56527.088112767611,
+ 56547.648090158902,
+ 56568.209936554107,
+ 56588.773651613519,
+ 56609.339234997584,
+ 56629.9066863669,
+ 56650.47600538221,
+ 56671.04719170442,
+ 56691.620244994599,
+ 56712.195164913959,
+ 56732.771951123868,
+ 56753.350603285835,
+ 56773.931121061541,
+ 56794.513504112823,
+ 56815.097752101647,
+ 56835.683864690152,
+ 56856.271841540627,
+ 56876.86168231551,
+ 56897.453386677393,
+ 56918.046954289028,
+ 56938.642384813298,
+ 56959.239677913261,
+ 56979.838833252121,
+ 57000.439850493225,
+ 57021.04272930009,
+ 57041.647469336371,
+ 57062.254070265873,
+ 57082.862531752558,
+ 57103.472853460553,
+ 57124.085035054108,
+ 57144.699076197649,
+ 57165.314976555739,
+ 57185.932735793103,
+ 57206.552353574611,
+ 57227.173829565276,
+ 57247.797163430281,
+ 57268.42235483494,
+ 57289.049403444733,
+ 57309.678308925286,
+ 57330.30907094237,
+ 57350.941689161911,
+ 57371.576163249985,
+ 57392.212492872815,
+ 57412.850677696784,
+ 57433.490717388406,
+ 57454.132611614368,
+ 57474.776360041491,
+ 57495.421962336746,
+ 57516.069418167266,
+ 57536.718727200314,
+ 57557.36988910332,
+ 57578.022903543861,
+ 57598.677770189643,
+ 57619.334488708548,
+ 57639.993058768589,
+ 57660.653480037938,
+ 57681.315752184906,
+ 57701.979874877965,
+ 57722.64584778573,
+ 57743.31367057695,
+ 57763.983342920546,
+ 57784.654864485572,
+ 57805.328234941233,
+ 57826.003453956881,
+ 57846.680521202026,
+ 57867.359436346305,
+ 57888.040199059527,
+ 57908.722809011633,
+ 57929.407265872709,
+ 57950.093569313001,
+ 57970.781719002895,
+ 57991.471714612911,
+ 58012.16355581375,
+ 58032.857242276223,
+ 58053.552773671312,
+ 58074.25014967013,
+ 58094.949369943948,
+ 58115.650434164185,
+ 58136.353342002389,
+ 58157.058093130276,
+ 58177.764687219693,
+ 58198.47312394264,
+ 58219.183402971255,
+ 58239.895523977837,
+ 58260.609486634821,
+ 58281.325290614775,
+ 58302.042935590434,
+ 58322.762421234678,
+ 58343.483747220511,
+ 58364.206913221096,
+ 58384.931918909751,
+ 58405.658763959924,
+ 58426.3874480452,
+ 58447.117970839339,
+ 58467.85033201622,
+ 58488.584531249864,
+ 58509.320568214462,
+ 58530.058442584334,
+ 58550.798154033931,
+ 58571.539702237875,
+ 58592.283086870906,
+ 58613.028307607929,
+ 58633.775364123983,
+ 58654.52425609425,
+ 58675.274983194053,
+ 58696.027545098877,
+ 58716.781941484325,
+ 58737.538172026158,
+ 58758.296236400274,
+ 58779.056134282728,
+ 58799.817865349694,
+ 58820.581429277503,
+ 58841.346825742643,
+ 58862.114054421712,
+ 58882.883114991484,
+ 58903.654007128847,
+ 58924.426730510851,
+ 58945.201284814684,
+ 58965.977669717664,
+ 58986.755884897269,
+ 59007.535930031117,
+ 59028.317804796949,
+ 59049.101508872664,
+ 59069.887041936301,
+ 59090.674403666046,
+ 59111.463593740213,
+ 59132.254611837263,
+ 59153.047457635803,
+ 59173.84213081457,
+ 59194.638631052461,
+ 59215.436958028506,
+ 59236.237111421855,
+ 59257.039090911829,
+ 59277.842896177877,
+ 59298.648526899589,
+ 59319.455982756685,
+ 59340.26526342905,
+ 59361.076368596696,
+ 59381.889297939757,
+ 59402.704051138542,
+ 59423.520627873484,
+ 59444.339027825139,
+ 59465.159250674224,
+ 59485.9812961016,
+ 59506.805163788253,
+ 59527.630853415307,
+ 59548.458364664046,
+ 59569.287697215863,
+ 59590.118850752311,
+ 59610.951824955089,
+ 59631.786619506012,
+ 59652.623234087048,
+ 59673.461668380311,
+ 59694.301922068029,
+ 59715.143994832593,
+ 59735.987886356525,
+ 59756.833596322482,
+ 59777.681124413255,
+ 59798.530470311794,
+ 59819.381633701159,
+ 59840.234614264569,
+ 59861.089411685381,
+ 59881.94602564707,
+ 59902.804455833269,
+ 59923.664701927737,
+ 59944.526763614384,
+ 59965.390640577243,
+ 59986.256332500488,
+ 60007.123839068438,
+ 60027.993159965539,
+ 60048.864294876381,
+ 60069.737243485688,
+ 60090.612005478324,
+ 60111.488580539284,
+ 60132.366968353708,
+ 60153.247168606867,
+ 60174.129180984164,
+ 60195.013005171153,
+ 60215.898640853513,
+ 60236.786087717061,
+ 60257.675345447751,
+ 60278.566413731671,
+ 60299.459292255044,
+ 60320.353980704247,
+ 60341.25047876576,
+ 60362.148786126229,
+ 60383.048902472423,
+ 60403.950827491237,
+ 60424.854560869717,
+ 60445.76010229504,
+ 60466.667451454516,
+ 60487.57660803559,
+ 60508.487571725847,
+ 60529.400342212997,
+ 60550.314919184893,
+ 60571.231302329521,
+ 60592.149491335003,
+ 60613.069485889588,
+ 60633.991285681674,
+ 60654.914890399785,
+ 60675.840299732568,
+ 60696.767513368832,
+ 60717.696530997484,
+ 60738.627352307602,
+ 60759.55997698837,
+ 60780.494404729128,
+ 60801.430635219323,
+ 60822.368668148556,
+ 60843.308503206565,
+ 60864.250140083204,
+ 60885.193578468468,
+ 60906.138818052495,
+ 60927.085858525541,
+ 60948.034699578006,
+ 60968.985340900421,
+ 60989.937782183442,
+ 61010.892023117864,
+ 61031.848063394616,
+ 61052.805902704764,
+ 61073.765540739492,
+ 61094.726977190134,
+ 61115.690211748137,
+ 61136.655244105103,
+ 61157.622073952742,
+ 61178.590700982917,
+ 61199.561124887616,
+ 61220.533345358948,
+ 61241.507362089171,
+ 61262.483174770663,
+ 61283.460783095943,
+ 61304.440186757645,
+ 61325.421385448557,
+ 61346.404378861582,
+ 61367.389166689762,
+ 61388.375748626262,
+ 61409.364124364387,
+ 61430.354293597571,
+ 61451.346256019373,
+ 61472.340011323497,
+ 61493.335559203762,
+ 61514.332899354122,
+ 61535.332031468672,
+ 61556.332955241618,
+ 61577.335670367313,
+ 61598.340176540238,
+ 61619.346473454993,
+ 61640.354560806329,
+ 61661.3644382891,
+ 61682.376105598312,
+ 61703.389562429089,
+ 61724.404808476691,
+ 61745.42184343651,
+ 61766.440667004063,
+ 61787.461278874987,
+ 61808.483678745069,
+ 61829.507866310203,
+ 61850.533841266435,
+ 61871.561603309929,
+ 61892.591152136971,
+ 61913.622487443987,
+ 61934.655608927525,
+ 61955.690516284267,
+ 61976.727209211022,
+ 61997.765687404724,
+ 62018.805950562448,
+ 62039.847998381381,
+ 62060.891830558845,
+ 62081.93744679229,
+ 62102.984846779298,
+ 62124.034030217575,
+ 62145.084996804966,
+ 62166.137746239416,
+ 62187.19227821903,
+ 62208.248592442025,
+ 62229.306688606739,
+ 62250.366566411656,
+ 62271.428225555377,
+ 62292.491665736627,
+ 62313.556886654267,
+ 62334.623888007271,
+ 62355.692669494762,
+ 62376.763230815974,
+ 62397.835571670272,
+ 62418.909691757144,
+ 62439.98559077621,
+ 62461.063268427228,
+ 62482.142724410049,
+ 62503.223958424685,
+ 62524.306970171267,
+ 62545.39175935003,
+ 62566.478325661366,
+ 62587.566668805768,
+ 62608.656788483881,
+ 62629.748684396451,
+ 62650.842356244357,
+ 62671.937803728622,
+ 62693.035026550366,
+ 62714.134024410858,
+ 62735.234797011479,
+ 62756.337344053733,
+ 62777.441665239276,
+ 62798.547760269852,
+ 62819.655628847358,
+ 62840.765270673801,
+ 62861.876685451323,
+ 62882.989872882186,
+ 62904.104832668774,
+ 62925.221564513602,
+ 62946.340068119309,
+ 62967.460343188657,
+ 62988.582389424526,
+ 63009.70620652994,
+ 63030.831794208025,
+ 63051.959152162039,
+ 63073.08828009537,
+ 63094.219177711529,
+ 63115.351844714154,
+ 63136.486280806988,
+ 63157.622485693922,
+ 63178.760459078956,
+ 63199.900200666219,
+ 63221.041710159967,
+ 63242.184987264569,
+ 63263.330031684534,
+ 63284.476843124474,
+ 63305.625421289144,
+ 63326.775765883409,
+ 63347.927876612259,
+ 63369.081753180813,
+ 63390.237395294316,
+ 63411.39480265812,
+ 63432.553974977716,
+ 63453.714911958712,
+ 63474.877613306839,
+ 63496.042078727944,
+ 63517.208307927998,
+ 63538.376300613119,
+ 63559.546056489504,
+ 63580.717575263516,
+ 63601.890856641607,
+ 63623.065900330374,
+ 63644.242706036515,
+ 63665.421273466869,
+ 63686.601602328381,
+ 63707.783692328136,
+ 63728.967543173334,
+ 63750.153154571279,
+ 63771.340526229418,
+ 63792.529657855317,
+ 63813.720549156649,
+ 63834.913199841227,
+ 63856.107609616978,
+ 63877.303778191941,
+ 63898.501705274284,
+ 63919.7013905723,
+ 63940.902833794404,
+ 63962.106034649114,
+ 63983.310992845094,
+ 64004.517708091109,
+ 64025.726180096048,
+ 64046.936408568938,
+ 64068.1483932189,
+ 64089.362133755196,
+ 64110.577629887193,
+ 64131.794881324393,
+ 64153.013887776404,
+ 64174.234648952966,
+ 64195.457164563937,
+ 64216.681434319289,
+ 64237.907457929112,
+ 64259.135235103626,
+ 64280.36476555316,
+ 64301.596048988169,
+ 64322.829085119236,
+ 64344.06387365704,
+ 64365.300414312398,
+ 64386.538706796251,
+ 64407.778750819634,
+ 64429.020546093721,
+ 64450.26409232981,
+ 64471.509389239291,
+ 64492.756436533709,
+ 64514.005233924705,
+ 64535.255781124033,
+ 64556.50807784358,
+ 64577.762123795357,
+ 64599.017918691468,
+ 64620.275462244172,
+ 64641.534754165805,
+ 64662.795794168844,
+ 64684.058581965895,
+ 64705.323117269661,
+ 64726.589399792974,
+ 64747.857429248776,
+ 64769.127205350138,
+ 64790.398727810236,
+ 64811.671996342375,
+ 64832.947010659969,
+ 64854.223770476558,
+ 64875.502275505794,
+ 64896.782525461451,
+ 64918.064520057414,
+ 64939.348259007682,
+ 64960.633742026388,
+ 64981.920968827762,
+ 65003.209939126165,
+ 65024.500652636067,
+ 65045.793109072067,
+ 65067.087308148861,
+ 65088.383249581282,
+ 65109.680933084259,
+ 65130.980358372864,
+ 65152.28152516226,
+ 65173.584433167736,
+ 65194.889082104703,
+ 65216.195471688683,
+ 65237.503601635319,
+ 65258.813471660353,
+ 65280.125081479666,
+ 65301.438430809241,
+ 65322.753519365178,
+ 65344.070346863708,
+ 65365.388913021146,
+ 65386.709217553958,
+ 65408.031260178701,
+ 65429.355040612056,
+ 65450.680558570821,
+ 65472.00781377191,
+ 65493.336805932355,
+ 65514.66753476928,
+ 65535.999999999956,
+ 65557.334201341757,
+ 65578.670138512171,
+ 65600.007811228788,
+ 65621.347219209332,
+ 65642.688362171626,
+ 65664.031239833639,
+ 65685.375851913413,
+ 65706.722198129137,
+ 65728.070278199084,
+ 65749.420091841661,
+ 65770.771638775404,
+ 65792.124918718939,
+ 65813.479931391004,
+ 65834.836676510458,
+ 65856.195153796303,
+ 65877.5553629676,
+ 65898.917303743554,
+ 65920.280975843489,
+ 65941.646378986843,
+ 65963.013512893158,
+ 65984.382377282076,
+ 66005.752971873386,
+ 66027.125296386963,
+ 66048.499350542799,
+ 66069.875134061018,
+ 66091.252646661844,
+ 66112.631888065618,
+ 66134.01285799277,
+ 66155.395556163887,
+ 66176.779982299631,
+ 66198.166136120795,
+ 66219.554017348273,
+ 66240.943625703105,
+ 66262.334960906388,
+ 66283.728022679396,
+ 66305.122810743444,
+ 66326.519324820023,
+ 66347.917564630698,
+ 66369.317529897162,
+ 66390.719220341227,
+ 66412.122635684791,
+ 66433.527775649884,
+ 66454.934639958636,
+ 66476.343228333324,
+ 66497.753540496284,
+ 66519.165576169995,
+ 66540.57933507704,
+ 66561.994816940118,
+ 66583.412021482043,
+ 66604.830948425733,
+ 66626.251597494222,
+ 66647.673968410629,
+ 66669.098060898235,
+ 66690.523874680381,
+ 66711.951409480564,
+ 66733.380665022371,
+ 66754.811641029475,
+ 66776.244337225711,
+ 66797.678753334985,
+ 66819.11488908132,
+ 66840.552744188884,
+ 66861.992318381905,
+ 66883.433611384738,
+ 66904.876622921889,
+ 66926.321352717903,
+ 66947.767800497502,
+ 66969.215965985466,
+ 66990.665848906734,
+ 67012.117448986304,
+ 67033.570765949335,
+ 67055.025799521056,
+ 67076.482549426815,
+ 67097.941015392076,
+ 67119.401197142433,
+ 67140.863094403554,
+ 67162.326706901222,
+ 67183.792034361351,
+ 67205.259076509959,
+ 67226.72783307315,
+ 67248.198303777172,
+ 67269.670488348347,
+ 67291.144386513144,
+ 67312.619997998088,
+ 67334.09732252988,
+ 67355.576359835293,
+ 67377.057109641188,
+ 67398.53957167457,
+ 67420.023745662547,
+ 67441.50963133233,
+ 67462.99722841123,
+ 67484.486536626689,
+ 67505.977555706224,
+ 67527.470285377494,
+ 67548.964725368263,
+ 67570.460875406367,
+ 67591.9587352198,
+ 67613.458304536631,
+ 67634.95958308503,
+ 67656.462570593329,
+ 67677.967266789899,
+ 67699.473671403248,
+ 67720.981784162024,
+ 67742.491604794923,
+ 67764.003133030797,
+ 67785.516368598575,
+ 67807.031311227314,
+ 67828.547960646174,
+ 67850.066316584402,
+ 67871.58637877139,
+ 67893.108146936589,
+ 67914.63162080961,
+ 67936.156800120138,
+ 67957.683684597971,
+ 67979.212273973011,
+ 68000.742567975263,
+ 68022.274566334876,
+ 68043.808268782057,
+ 68065.343675047145,
+ 68086.880784860579,
+ 68108.419597952918,
+ 68129.960114054789,
+ 68151.502332896969,
+ 68173.04625421032,
+ 68194.591877725834,
+ 68216.139203174564,
+ 68237.688230287706,
+ 68259.238958796544,
+ 68280.791388432481,
+ 68302.345518927032,
+ 68323.901350011787,
+ 68345.458881418483,
+ 68367.018112878912,
+ 68388.579044125028,
+ 68410.141674888844,
+ 68431.706004902502,
+ 68453.272033898262,
+ 68474.839761608455,
+ 68496.409187765545,
+ 68517.980312102081,
+ 68539.553134350732,
+ 68561.127654244279,
+ 68582.70387151558,
+ 68604.281785897634,
+ 68625.861397123503,
+ 68647.44270492639,
+ 68669.025709039604,
+ 68690.610409196524,
+ 68712.196805130661,
+ 68733.784896575627,
+ 68755.374683265123,
+ 68776.966164932994,
+ 68798.559341313128,
+ 68820.154212139591,
+ 68841.750777146473,
+ 68863.349036068044,
+ 68884.948988638629,
+ 68906.550634592684,
+ 68928.153973664739,
+ 68949.75900558944,
+ 68971.365730101577,
+ 68992.974146935987,
+ 69014.584255827634,
+ 69036.196056511588,
+ 69057.809548723017,
+ 69079.424732197207,
+ 69101.041606669532,
+ 69122.660171875468,
+ 69144.280427550606,
+ 69165.902373430625,
+ 69187.526009251334,
+ 69209.151334748618,
+ 69230.778349658474,
+ 69252.40705371699,
+ 69274.037446660412,
+ 69295.669528225,
+ 69317.303298147192,
+ 69338.938756163494,
+ 69360.575902010532,
+ 69382.214735425005,
+ 69403.855256143754,
+ 69425.497463903681,
+ 69447.141358441833,
+ 69468.78693949533,
+ 69490.434206801394,
+ 69512.083160097391,
+ 69533.733799120717,
+ 69555.386123608929,
+ 69577.04013329967,
+ 69598.695827930685,
+ 69620.353207239794,
+ 69642.012270964973,
+ 69663.67301884426,
+ 69685.335450615792,
+ 69706.999566017839,
+ 69728.665364788743,
+ 69750.332846666963,
+ 69772.002011391058,
+ 69793.672858699691,
+ 69815.345388331611,
+ 69837.019600025669,
+ 69858.695493520849,
+ 69880.373068556204,
+ 69902.052324870907,
+ 69923.733262204216,
+ 69945.415880295492,
+ 69967.100178884211,
+ 69988.786157709939,
+ 70010.473816512356,
+ 70032.163155031216,
+ 70053.854173006403,
+ 70075.546870177874,
+ 70097.241246285717,
+ 70118.937301070109,
+ 70140.635034271298,
+ 70162.334445629691,
+ 70184.035534885741,
+ 70205.738301780017,
+ 70227.442746053217,
+ 70249.1488674461,
+ 70270.856665699539,
+ 70292.566140554511,
+ 70314.277291752107,
+ 70335.990119033493,
+ 70357.704622139936,
+ 70379.420800812819,
+ 70401.138654793613,
+ 70422.85818382389,
+ 70444.579387645339,
+ 70466.302265999722,
+ 70488.026818628918,
+ 70509.753045274876,
+ 70531.480945679708,
+ 70553.210519585555,
+ 70574.941766734701,
+ 70596.674686869505,
+ 70618.409279732456,
+ 70640.145545066101,
+ 70661.883482613106,
+ 70683.623092116264,
+ 70705.364373318414,
+ 70727.107325962526,
+ 70748.851949791671,
+ 70770.598244549008,
+ 70792.346209977783,
+ 70814.095845821372,
+ 70835.847151823225,
+ 70857.600127726895,
+ 70879.354773276034,
+ 70901.111088214413,
+ 70922.869072285859,
+ 70944.628725234332,
+ 70966.390046803877,
+ 70988.153036738629,
+ 71009.917694782853,
+ 71031.684020680885,
+ 71053.45201417715,
+ 71075.221675016204,
+ 71096.993002942661,
+ 71118.765997701266,
+ 71140.540659036851,
+ 71162.316986694335,
+ 71184.09498041874,
+ 71205.874639955218,
+ 71227.655965048951,
+ 71249.438955445294,
+ 71271.223610889632,
+ 71293.009931127483,
+ 71314.797915904477,
+ 71336.587564966307,
+ 71358.378878058764,
+ 71380.171854927772,
+ 71401.966495319313,
+ 71423.762798979486,
+ 71445.560765654489,
+ 71467.360395090596,
+ 71489.161687034211,
+ 71510.964641231811,
+ 71532.769257429973,
+ 71554.575535375348,
+ 71576.383474814749,
+ 71598.19307549503,
+ 71620.004337163133,
+ 71641.817259566145,
+ 71663.631842451214,
+ 71685.4480855656,
+ 71707.26598865664,
+ 71729.085551471784,
+ 71750.906773758586,
+ 71772.729655264673,
+ 71794.554195737772,
+ 71816.380394925713,
+ 71838.208252576442,
+ 71860.037768437964,
+ 71881.868942258385,
+ 71903.701773785942,
+ 71925.536262768932,
+ 71947.372408955751,
+ 71969.210212094898,
+ 71991.049671934976,
+ 72012.890788224686,
+ 72034.73356071279,
+ 72056.577989148165,
+ 72078.424073279821,
+ 72100.271812856794,
+ 72122.121207628254,
+ 72143.97225734347,
+ 72165.824961751801,
+ 72187.679320602692,
+ 72209.53533364569,
+ 72231.393000630429,
+ 72253.252321306645,
+ 72275.113295424177,
+ 72296.975922732949,
+ 72318.840202982959,
+ 72340.706135924338,
+ 72362.573721307272,
+ 72384.442958882093,
+ 72406.313848399179,
+ 72428.186389609036,
+ 72450.060582262216,
+ 72471.936426109431,
+ 72493.813920901433,
+ 72515.693066389096,
+ 72537.573862323392,
+ 72559.456308455352,
+ 72581.340404536139,
+ 72603.226150316987,
+ 72625.113545549248,
+ 72647.002589984331,
+ 72668.893283373764,
+ 72690.785625469172,
+ 72712.679616022273,
+ 72734.575254784853,
+ 72756.472541508803,
+ 72778.371475946144,
+ 72800.272057848939,
+ 72822.174286969355,
+ 72844.07816305969,
+ 72865.983685872285,
+ 72887.890855159596,
+ 72909.799670674183,
+ 72931.710132168693,
+ 72953.622239395845,
+ 72975.535992108475,
+ 72997.451390059519,
+ 73019.368433001961,
+ 73041.287120688925,
+ 73063.207452873612,
+ 73085.129429309294,
+ 73107.053049749389,
+ 73128.978313947344,
+ 73150.905221656736,
+ 73172.833772631217,
+ 73194.763966624567,
+ 73216.695803390612,
+ 73238.62928268328,
+ 73260.564404256627,
+ 73282.501167864757,
+ 73304.439573261901,
+ 73326.379620202337,
+ 73348.321308440485,
+ 73370.264637730841,
+ 73392.209607827957,
+ 73414.156218486532,
+ 73436.104469461323,
+ 73458.054360507173,
+ 73480.005891379056,
+ 73501.959061831993,
+ 73523.913871621116,
+ 73545.870320501665,
+ 73567.828408228932,
+ 73589.78813455833,
+ 73611.749499245358,
+ 73633.712502045615,
+ 73655.677142714747,
+ 73677.643421008557,
+ 73699.611336682879,
+ 73721.580889493693,
+ 73743.552079197019,
+ 73765.524905548999,
+ 73787.499368305856,
+ 73809.475467223907,
+ 73831.453202059551,
+ 73853.432572569291,
+ 73875.413578509717,
+ 73897.396219637507,
+ 73919.380495709411,
+ 73941.36640648231,
+ 73963.353951713143,
+ 73985.343131158952,
+ 74007.333944576865,
+ 74029.326391724098,
+ 74051.320472357969,
+ 74073.316186235883,
+ 74095.313533115303,
+ 74117.312512753837,
+ 74139.313124909138,
+ 74161.315369338976,
+ 74183.319245801191,
+ 74205.324754053727,
+ 74227.331893854629,
+ 74249.340664961986,
+ 74271.351067134034,
+ 74293.363100129049,
+ 74315.376763705441,
+ 74337.392057621662,
+ 74359.408981636298,
+ 74381.427535508003,
+ 74403.447718995507,
+ 74425.469531857671,
+ 74447.492973853383,
+ 74469.518044741693,
+ 74491.54474428168,
+ 74513.573072232539,
+ 74535.603028353551,
+ 74557.634612404087,
+ 74579.667824143602,
+ 74601.702663331642,
+ 74623.739129727837,
+ 74645.777223091936,
+ 74667.816943183716,
+ 74689.858289763113,
+ 74711.901262590094,
+ 74733.945861424741,
+ 74755.992086027225,
+ 74778.039936157802,
+ 74800.089411576817,
+ 74822.140512044702,
+ 74844.193237321961,
+ 74866.24758716923,
+ 74888.303561347187,
+ 74910.36115961663,
+ 74932.420381738411,
+ 74954.481227473516,
+ 74976.543696582972,
+ 74998.607788827925,
+ 75020.673503969607,
+ 75042.740841769322,
+ 75064.809801988464,
+ 75086.88038438854,
+ 75108.952588731103,
+ 75131.026414777836,
+ 75153.101862290467,
+ 75175.178931030852,
+ 75197.257620760924,
+ 75219.33793124267,
+ 75241.419862238225,
+ 75263.503413509738,
+ 75285.588584819503,
+ 75307.675375929874,
+ 75329.763786603318,
+ 75351.853816602365,
+ 75373.945465689612,
+ 75396.038733627807,
+ 75418.133620179724,
+ 75440.230125108254,
+ 75462.32824817636,
+ 75484.427989147109,
+ 75506.529347783653,
+ 75528.63232384919,
+ 75550.736917107075,
+ 75572.843127320695,
+ 75594.950954253538,
+ 75617.060397669193,
+ 75639.171457331307,
+ 75661.284133003646,
+ 75683.398424450032,
+ 75705.514331434402,
+ 75727.631853720741,
+ 75749.750991073175,
+ 75771.871743255862,
+ 75793.994110033076,
+ 75816.118091169177,
+ 75838.243686428585,
+ 75860.370895575848,
+ 75882.499718375562,
+ 75904.630154592422,
+ 75926.762203991224,
+ 75948.895866336825,
+ 75971.031141394182,
+ 75993.168028928325,
+ 76015.306528704401,
+ 76037.4466404876,
+ 76059.588364043215,
+ 76081.731699136653,
+ 76103.876645533353,
+ 76126.023202998884,
+ 76148.171371298871,
+ 76170.321150199044,
+ 76192.472539465205,
+ 76214.625538863256,
+ 76236.780148159174,
+ 76258.936367119008,
+ 76281.094195508922,
+ 76303.253633095141,
+ 76325.414679643975,
+ 76347.577334921851,
+ 76369.741598695226,
+ 76391.907470730686,
+ 76414.074950794879,
+ 76436.244038654564,
+ 76458.414734076548,
+ 76480.587036827754,
+ 76502.760946675175,
+ 76524.936463385893,
+ 76547.11358672705,
+ 76569.292316465915,
+ 76591.472652369819,
+ 76613.654594206164,
+ 76635.838141742468,
+ 76658.023294746308,
+ 76680.210052985349,
+ 76702.398416227341,
+ 76724.588384240138,
+ 76746.779956791637,
+ 76768.973133649866,
+ 76791.167914582897,
+ 76813.364299358902,
+ 76835.562287746157,
+ 76857.761879512967,
+ 76879.963074427797,
+ 76902.165872259109,
+ 76924.37027277553,
+ 76946.576275745727,
+ 76968.783880938441,
+ 76990.993088122515,
+ 77013.203897066895,
+ 77035.416307540567,
+ 77057.630319312622,
+ 77079.845932152239,
+ 77102.063145828695,
+ 77124.281960111301,
+ 77146.50237476948,
+ 77168.724389572759,
+ 77190.948004290723,
+ 77213.173218693031,
+ 77235.400032549442,
+ 77257.628445629802,
+ 77279.858457704031,
+ 77302.090068542122,
+ 77324.323277914169,
+ 77346.558085590339,
+ 77368.794491340886,
+ 77391.032494936138,
+ 77413.272096146524,
+ 77435.51329474253,
+ 77457.756090494731,
+ 77480.000483173804,
+ 77502.246472550498,
+ 77524.494058395634,
+ 77546.743240480107,
+ 77568.994018574944,
+ 77591.246392451198,
+ 77613.500361880026,
+ 77635.755926632657,
+ 77658.013086480438,
+ 77680.271841194757,
+ 77702.532190547092,
+ 77724.794134309021,
+ 77747.057672252195,
+ 77769.322804148323,
+ 77791.589529769248,
+ 77813.857848886837,
+ 77836.127761273063,
+ 77858.399266699998,
+ 77880.67236493979,
+ 77902.947055764627,
+ 77925.223338946831,
+ 77947.50121425878,
+ 77969.780681472927,
+ 77992.061740361838,
+ 78014.344390698127,
+ 78036.628632254491,
+ 78058.914464803747,
+ 78081.201888118725,
+ 78103.490901972415,
+ 78125.781506137821,
+ 78148.073700388064,
+ 78170.367484496339,
+ 78192.662858235926,
+ 78214.959821380166,
+ 78237.258373702498,
+ 78259.558514976452,
+ 78281.860244975614,
+ 78304.163563473659,
+ 78326.468470244363,
+ 78348.77496506153,
+ 78371.083047699125,
+ 78393.392717931114,
+ 78415.703975531578,
+ 78438.016820274701,
+ 78460.331251934695,
+ 78482.647270285903,
+ 78504.964875102727,
+ 78527.284066159627,
+ 78549.604843231195,
+ 78571.927206092048,
+ 78594.251154516911,
+ 78616.576688280606,
+ 78638.903807157985,
+ 78661.232510924034,
+ 78683.562799353778,
+ 78705.894672222363,
+ 78728.228129304945,
+ 78750.563170376859,
+ 78772.899795213423,
+ 78795.238003590101,
+ 78817.577795282399,
+ 78839.919170065928,
+ 78862.262127716356,
+ 78884.606668009452,
+ 78906.952790721043,
+ 78929.300495627045,
+ 78951.64978250346,
+ 78974.000651126378,
+ 78996.353101271932,
+ 79018.707132716358,
+ 79041.062745235977,
+ 79063.41993860717,
+ 79085.778712606436,
+ 79108.139067010285,
+ 79130.501001595389,
+ 79152.864516138419,
+ 79175.22961041618,
+ 79197.596284205531,
+ 79219.96453728342,
+ 79242.33436942687,
+ 79264.705780412987,
+ 79287.078770018954,
+ 79309.453338022009,
+ 79331.829484199508,
+ 79354.207208328866,
+ 79376.586510187582,
+ 79398.967389553218,
+ 79421.349846203433,
+ 79443.733879915948,
+ 79466.119490468584,
+ 79488.50667763922,
+ 79510.895441205823,
+ 79533.285780946433,
+ 79555.677696639163,
+ 79578.071188062226,
+ 79600.466254993895,
+ 79622.862897212515,
+ 79645.261114496549,
+ 79667.660906624471,
+ 79690.062273374875,
+ 79712.465214526455,
+ 79734.869729857935,
+ 79757.275819148126,
+ 79779.683482175955,
+ 79802.092718720378,
+ 79824.503528560454,
+ 79846.915911475327,
+ 79869.329867244203,
+ 79891.745395646343,
+ 79914.162496461155,
+ 79936.581169468045,
+ 79959.001414446553,
+ 79981.423231176261,
+ 80003.846619436852,
+ 80026.271579008084,
+ 80048.698109669771,
+ 80071.12621120183,
+ 80093.555883384237,
+ 80115.987125997053,
+ 80138.419938820414,
+ 80160.854321634528,
+ 80183.290274219689,
+ 80205.727796356281,
+ 80228.166887824715,
+ 80250.607548405547,
+ 80273.049777879336,
+ 80295.493576026798,
+ 80317.938942628651,
+ 80340.385877465727,
+ 80362.834380318949,
+ 80385.28445096928,
+ 80407.736089197788,
+ 80430.189294785596,
+ 80452.644067513917,
+ 80475.100407164035,
+ 80497.558313517322,
+ 80520.017786355209,
+ 80542.478825459213,
+ 80564.941430610925,
+ 80587.405601592007,
+ 80609.871338184195,
+ 80632.338640169342,
+ 80654.8075073293,
+ 80677.277939446067,
+ 80699.749936301683,
+ 80722.223497678278,
+ 80744.698623358039,
+ 80767.17531312324,
+ 80789.653566756242,
+ 80812.133384039465,
+ 80834.614764755403,
+ 80857.097708686648,
+ 80879.582215615854,
+ 80902.068285325731,
+ 80924.555917599093,
+ 80947.045112218824,
+ 80969.535868967869,
+ 80992.028187629272,
+ 81014.522067986123,
+ 81037.017509821613,
+ 81059.514512919006,
+ 81082.013077061609,
+ 81104.513202032831,
+ 81127.014887616184,
+ 81149.518133595193,
+ 81172.022939753486,
+ 81194.529305874807,
+ 81217.037231742899,
+ 81239.546717141639,
+ 81262.057761854958,
+ 81284.570365666848,
+ 81307.084528361403,
+ 81329.600249722775,
+ 81352.117529535186,
+ 81374.636367582949,
+ 81397.156763650448,
+ 81419.678717522125,
+ 81442.202228982511,
+ 81464.727297816222,
+ 81487.253923807933,
+ 81509.782106742379,
+ 81532.311846404409,
+ 81554.843142578902,
+ 81577.375995050839,
+ 81599.910403605274,
+ 81622.446368027333,
+ 81644.983888102215,
+ 81667.522963615178,
+ 81690.063594351581,
+ 81712.605780096841,
+ 81735.149520636449,
+ 81757.694815755967,
+ 81780.241665241047,
+ 81802.79006887741,
+ 81825.340026450824,
+ 81847.891537747171,
+ 81870.444602552379,
+ 81892.999220652477,
+ 81915.555391833506,
+ 81938.113115881672,
+ 81960.672392583176,
+ 81983.233221724338,
+ 82005.795603091537,
+ 82028.359536471224,
+ 82050.925021649906,
+ 82073.492058414209,
+ 82096.060646550788,
+ 82118.630785846399,
+ 82141.202476087841,
+ 82163.775717062032,
+ 82186.35050855593,
+ 82208.926850356569,
+ 82231.504742251054,
+ 82254.084184026578,
+ 82276.665175470393,
+ 82299.24771636985,
+ 82321.831806512317,
+ 82344.417445685307,
+ 82367.004633676348,
+ 82389.593370273054,
+ 82412.183655263143,
+ 82434.775488434374,
+ 82457.368869574595,
+ 82479.963798471697,
+ 82502.560274913689,
+ 82525.158298688606,
+ 82547.757869584602,
+ 82570.35898738986,
+ 82592.961651892678,
+ 82615.565862881398,
+ 82638.171620144421,
+ 82660.778923470265,
+ 82683.387772647475,
+ 82705.998167464713,
+ 82728.610107710658,
+ 82751.223593174116,
+ 82773.83862364394,
+ 82796.45519890904,
+ 82819.073318758441,
+ 82841.692982981185,
+ 82864.314191366429,
+ 82886.936943703375,
+ 82909.561239781324,
+ 82932.187079389638,
+ 82954.814462317736,
+ 82977.443388355125,
+ 83000.073857291369,
+ 83022.70586891612,
+ 83045.339423019104,
+ 83067.974519390089,
+ 83090.611157818959,
+ 83113.249338095629,
+ 83135.8890600101,
+ 83158.530323352461,
+ 83181.173127912858,
+ 83203.817473481497,
+ 83226.463359848669,
+ 83249.11078680474,
+ 83271.759754140134,
+ 83294.410261645375,
+ 83317.062309111003,
+ 83339.715896327703,
+ 83362.371023086147,
+ 83385.027689177165,
+ 83407.685894391587,
+ 83430.345638520361,
+ 83453.006921354478,
+ 83475.669742685001,
+ 83498.334102303095,
+ 83520.999999999942,
+ 83543.667435566866,
+ 83566.336408795192,
+ 83589.006919476349,
+ 83611.678967401851,
+ 83634.352552363242,
+ 83657.027674152167,
+ 83679.704332560359,
+ 83702.382527379552,
+ 83725.062258401638,
+ 83747.743525418511,
+ 83770.42632822218,
+ 83793.110666604684,
+ 83815.796540358162,
+ 83838.483949274829,
+ 83861.172893146941,
+ 83883.863371766842,
+ 83906.555384926964,
+ 83929.248932419752,
+ 83951.944014037799,
+ 83974.640629573696,
+ 83997.338778820151,
+ 84020.038461569929,
+ 84042.739677615857,
+ 84065.442426750829,
+ 84088.146708767847,
+ 84110.852523459922,
+ 84133.559870620171,
+ 84156.268750041796,
+ 84178.979161518029,
+ 84201.691104842204,
+ 84224.404579807713,
+ 84247.119586208006,
+ 84269.83612383662,
+ 84292.55419248715,
+ 84315.273791953281,
+ 84337.994922028738,
+ 84360.717582507335,
+ 84383.441773182945,
+ 84406.167493849513,
+ 84428.894744301069,
+ 84451.623524331691,
+ 84474.353833735542,
+ 84497.085672306828,
+ 84519.819039839858,
+ 84542.553936128999,
+ 84565.290360968676,
+ 84588.028314153402,
+ 84610.767795477717,
+ 84633.508804736295,
+ 84656.251341723822,
+ 84678.995406235073,
+ 84701.740998064924,
+ 84724.488117008252,
+ 84747.236762860062,
+ 84769.986935415407,
+ 84792.73863446941,
+ 84815.491859817252,
+ 84838.246611254188,
+ 84861.002888575575,
+ 84883.760691576768,
+ 84906.520020053256,
+ 84929.28087380057,
+ 84952.043252614312,
+ 84974.807156290146,
+ 84997.572584623806,
+ 85020.339537411113,
+ 85043.108014447949,
+ 85065.878015530237,
+ 85088.649540453989,
+ 85111.422589015303,
+ 85134.197161010321,
+ 85156.973256235244,
+ 85179.750874486374,
+ 85202.530015560071,
+ 85225.310679252725,
+ 85248.092865360857,
+ 85270.876573681016,
+ 85293.661804009811,
+ 85316.448556143951,
+ 85339.236829880188,
+ 85362.026625015351,
+ 85384.817941346351,
+ 85407.610778670132,
+ 85430.405136783724,
+ 85453.201015484257,
+ 85475.998414568865,
+ 85498.797333834795,
+ 85521.597773079353,
+ 85544.399732099904,
+ 85567.203210693886,
+ 85590.008208658808,
+ 85612.814725792239,
+ 85635.62276189182,
+ 85658.432316755265,
+ 85681.243390180331,
+ 85704.055981964877,
+ 85726.870091906807,
+ 85749.685719804082,
+ 85772.502865454764,
+ 85795.321528656961,
+ 85818.141709208852,
+ 85840.963406908675,
+ 85863.78662155474,
+ 85886.611352945445,
+ 85909.437600879217,
+ 85932.26536515457,
+ 85955.094645570091,
+ 85977.92544192441,
+ 86000.757754016275,
+ 86023.591581644432,
+ 86046.426924607746,
+ 86069.263782705122,
+ 86092.102155735556,
+ 86114.942043498071,
+ 86137.783445791807,
+ 86160.626362415918,
+ 86183.470793169676,
+ 86206.316737852379,
+ 86229.164196263402,
+ 86252.013168202204,
+ 86274.863653468303,
+ 86297.715651861261,
+ 86320.569163180728,
+ 86343.424187226425,
+ 86366.280723798132,
+ 86389.138772695675,
+ 86411.998333718977,
+ 86434.859406668009,
+ 86457.721991342827,
+ 86480.586087543532,
+ 86503.451695070296,
+ 86526.318813723352,
+ 86549.187443303032,
+ 86572.057583609683,
+ 86594.929234443756,
+ 86617.802395605773,
+ 86640.677066896271,
+ 86663.553248115903,
+ 86686.43093906538,
+ 86709.310139545443,
+ 86732.190849356964,
+ 86755.073068300815,
+ 86777.956796177954,
+ 86800.842032789442,
+ 86823.728777936354,
+ 86846.617031419853,
+ 86869.506793041175,
+ 86892.398062601613,
+ 86915.290839902518,
+ 86938.185124745316,
+ 86961.080916931489,
+ 86983.978216262592,
+ 87006.87702254027,
+ 87029.777335566177,
+ 87052.67915514209,
+ 87075.582481069796,
+ 87098.487313151185,
+ 87121.39365118822,
+ 87144.301494982894,
+ 87167.210844337285,
+ 87190.121699053532,
+ 87213.034058933845,
+ 87235.947923780506,
+ 87258.863293395829,
+ 87281.780167582241,
+ 87304.698546142172,
+ 87327.618428878181,
+ 87350.539815592856,
+ 87373.462706088845,
+ 87396.387100168897,
+ 87419.312997635774,
+ 87442.240398292357,
+ 87465.16930194154,
+ 87488.099708386319,
+ 87511.031617429733,
+ 87533.965028874911,
+ 87556.899942525008,
+ 87579.836358183282,
+ 87602.774275653021,
+ 87625.713694737613,
+ 87648.654615240492,
+ 87671.597036965148,
+ 87694.540959715145,
+ 87717.486383294105,
+ 87740.433307505737,
+ 87763.381732153779,
+ 87786.331657042057,
+ 87809.283081974456,
+ 87832.236006754916,
+ 87855.190431187453,
+ 87878.146355076155,
+ 87901.103778225151,
+ 87924.062700438633,
+ 87947.023121520891,
+ 87969.985041276246,
+ 87992.948459509105,
+ 88015.913376023906,
+ 88038.879790625171,
+ 88061.847703117513,
+ 88084.817113305573,
+ 88107.788020994049,
+ 88130.760425987726,
+ 88153.734328091465,
+ 88176.709727110137,
+ 88199.686622848749,
+ 88222.665015112303,
+ 88245.644903705906,
+ 88268.626288434709,
+ 88291.609169103947,
+ 88314.593545518903,
+ 88337.579417484914,
+ 88360.566784807408,
+ 88383.555647291854,
+ 88406.546004743795,
+ 88429.537856968818,
+ 88452.531203772611,
+ 88475.52604496089,
+ 88498.522380339447,
+ 88521.52020971413,
+ 88544.519532890874,
+ 88567.520349675644,
+ 88590.522659874507,
+ 88613.526463293543,
+ 88636.531759738922,
+ 88659.538549016899,
+ 88682.546830933745,
+ 88705.556605295846,
+ 88728.567871909589,
+ 88751.580630581491,
+ 88774.594881118086,
+ 88797.610623325963,
+ 88820.62785701183,
+ 88843.646581982393,
+ 88866.666798044462,
+ 88889.688505004888,
+ 88912.711702670611,
+ 88935.7363908486,
+ 88958.762569345898,
+ 88981.790237969632,
+ 89004.81939652696,
+ 89027.850044825114,
+ 89050.882182671412,
+ 89073.9158098732,
+ 89096.950926237885,
+ 89119.987531572973,
+ 89143.025625686001,
+ 89166.065208384563,
+ 89189.106279476357,
+ 89212.148838769106,
+ 89235.192886070581,
+ 89258.238421188667,
+ 89281.285443931265,
+ 89304.333954106376,
+ 89327.383951522017,
+ 89350.435435986306,
+ 89373.488407307406,
+ 89396.542865293537,
+ 89419.598809753006,
+ 89442.656240494165,
+ 89465.715157325409,
+ 89488.775560055219,
+ 89511.837448492137,
+ 89534.900822444746,
+ 89557.965681721733,
+ 89581.032026131812,
+ 89604.099855483742,
+ 89627.169169586399,
+ 89650.239968248672,
+ 89673.312251279538,
+ 89696.386018488018,
+ 89719.461269683205,
+ 89742.53800467425,
+ 89765.616223270365,
+ 89788.69592528083,
+ 89811.777110514988,
+ 89834.859778782207,
+ 89857.943929891975,
+ 89881.029563653807,
+ 89904.116679877261,
+ 89927.205278372014,
+ 89950.29535894774,
+ 89973.386921414218,
+ 89996.479965581268,
+ 90019.574491258769,
+ 90042.670498256688,
+ 90065.767986385021,
+ 90088.866955453836,
+ 90111.967405273259,
+ 90135.069335653476,
+ 90158.172746404758,
+ 90181.277637337407,
+ 90204.384008261797,
+ 90227.49185898836,
+ 90250.601189327586,
+ 90273.711999090039,
+ 90296.824288086325,
+ 90319.938056127125,
+ 90343.053303023189,
+ 90366.170028585286,
+ 90389.288232624298,
+ 90412.407914951138,
+ 90435.529075376777,
+ 90458.651713712257,
+ 90481.775829768681,
+ 90504.901423357209,
+ 90528.028494289058,
+ 90551.157042375504,
+ 90574.287067427911,
+ 90597.418569257643,
+ 90620.551547676194,
+ 90643.686002495073,
+ 90666.821933525847,
+ 90689.959340580186,
+ 90713.098223469773,
+ 90736.238582006365,
+ 90759.380416001804,
+ 90782.523725267951,
+ 90805.668509616764,
+ 90828.814768860233,
+ 90851.962502810435,
+ 90875.11171127946,
+ 90898.262394079517,
+ 90921.414551022855,
+ 90944.568181921743,
+ 90967.72328658856,
+ 90990.879864835719,
+ 91014.037916475718,
+ 91037.19744132107,
+ 91060.358439184391,
+ 91083.520909878338,
+ 91106.684853215629,
+ 91129.850269009039,
+ 91153.017157071401,
+ 91176.185517215621,
+ 91199.355349254649,
+ 91222.526653001492,
+ 91245.699428269247,
+ 91268.873674871036,
+ 91292.049392620058,
+ 91315.226581329553,
+ 91338.405240812834,
+ 91361.585370883287,
+ 91384.766971354344,
+ 91407.950042039476,
+ 91431.134582752245,
+ 91454.320593306256,
+ 91477.508073515171,
+ 91500.697023192712,
+ 91523.887442152685,
+ 91547.07933020893,
+ 91570.272687175326,
+ 91593.467512865856,
+ 91616.663807094534,
+ 91639.861569675442,
+ 91663.060800422725,
+ 91686.261499150554,
+ 91709.463665673218,
+ 91732.66729980502,
+ 91755.872401360321,
+ 91779.078970153569,
+ 91802.287005999257,
+ 91825.49650871192,
+ 91848.707478106167,
+ 91871.91991399668,
+ 91895.133816198169,
+ 91918.349184525418,
+ 91941.566018793281,
+ 91964.784318816659,
+ 91988.004084410495,
+ 92011.22531538982,
+ 92034.448011569708,
+ 92057.672172765277,
+ 92080.897798791746,
+ 92104.124889464365,
+ 92127.353444598411,
+ 92150.58346400928,
+ 92173.814947512379,
+ 92197.04789492322,
+ 92220.282306057314,
+ 92243.518180730272,
+ 92266.755518757753,
+ 92289.994319955469,
+ 92313.234584139194,
+ 92336.476311124774,
+ 92359.719500728082,
+ 92382.964152765067,
+ 92406.210267051734,
+ 92429.457843404161,
+ 92452.706881638471,
+ 92475.957381570814,
+ 92499.209343017443,
+ 92522.462765794655,
+ 92545.717649718805,
+ 92568.973994606305,
+ 92592.231800273614,
+ 92615.491066537259,
+ 92638.751793213814,
+ 92662.01398011994,
+ 92685.277627072326,
+ 92708.54273388772,
+ 92731.809300382942,
+ 92755.077326374871,
+ 92778.346811680414,
+ 92801.617756116568,
+ 92824.890159500384,
+ 92848.164021648947,
+ 92871.439342379424,
+ 92894.716121509016,
+ 92917.994358855023,
+ 92941.274054234746,
+ 92964.555207465572,
+ 92987.837818364962,
+ 93011.121886750407,
+ 93034.407412439468,
+ 93057.694395249753,
+ 93080.982834998955,
+ 93104.272731504767,
+ 93127.564084584999,
+ 93150.856894057491,
+ 93174.15115974014,
+ 93197.446881450916,
+ 93220.744059007804,
+ 93244.04269222889,
+ 93267.342780932304,
+ 93290.644324936235,
+ 93313.947324058914,
+ 93337.251778118633,
+ 93360.557686933767,
+ 93383.865050322696,
+ 93407.173868103928,
+ 93430.484140095941,
+ 93453.795866117362,
+ 93477.109045986799,
+ 93500.423679522952,
+ 93523.739766544561,
+ 93547.057306870454,
+ 93570.376300319491,
+ 93593.696746710571,
+ 93617.018645862699,
+ 93640.341997594893,
+ 93663.666801726242,
+ 93686.993058075881,
+ 93710.320766463032,
+ 93733.64992670693,
+ 93756.980538626914,
+ 93780.312602042337,
+ 93803.646116772637,
+ 93826.981082637285,
+ 93850.317499455836,
+ 93873.655367047861,
+ 93896.994685233032,
+ 93920.335453831038,
+ 93943.677672661666,
+ 93967.021341544707,
+ 93990.366460300051,
+ 94013.713028747632,
+ 94037.061046707429,
+ 94060.410513999494,
+ 94083.761430443905,
+ 94107.113795860845,
+ 94130.467610070496,
+ 94153.822872893157,
+ 94177.179584149111,
+ 94200.537743658759,
+ 94223.897351242529,
+ 94247.25840672091,
+ 94270.620909914433,
+ 94293.98486064373,
+ 94317.350258729421,
+ 94340.71710399224,
+ 94364.085396252936,
+ 94387.455135332348,
+ 94410.82632105134,
+ 94434.198953230851,
+ 94457.573031691878,
+ 94480.948556255447,
+ 94504.325526742658,
+ 94527.70394297468,
+ 94551.083804772716,
+ 94574.465111958023,
+ 94597.847864351934,
+ 94621.232061775823,
+ 94644.617704051096,
+ 94668.004790999272,
+ 94691.393322441872,
+ 94714.783298200506,
+ 94738.174718096794,
+ 94761.567581952477,
+ 94784.961889589307,
+ 94808.357640829097,
+ 94831.754835493703,
+ 94855.153473405066,
+ 94878.553554385173,
+ 94901.955078256055,
+ 94925.358044839784,
+ 94948.762453958523,
+ 94972.168305434476,
+ 94995.575599089891,
+ 95018.984334747074,
+ 95042.394512228391,
+ 95065.806131356265,
+ 95089.219191953176,
+ 95112.633693841635,
+ 95136.04963684424,
+ 95159.467020783617,
+ 95182.885845482466,
+ 95206.306110763529,
+ 95229.727816449609,
+ 95253.150962363579,
+ 95276.575548328314,
+ 95300.001574166803,
+ 95323.429039702052,
+ 95346.857944757154,
+ 95370.288289155214,
+ 95393.720072719429,
+ 95417.153295273019,
+ 95440.587956639298,
+ 95464.024056641589,
+ 95487.461595103305,
+ 95510.900571847902,
+ 95534.340986698866,
+ 95557.782839479783,
+ 95581.226130014256,
+ 95604.670858125959,
+ 95628.117023638595,
+ 95651.564626375985,
+ 95675.013666161918,
+ 95698.464142820303,
+ 95721.916056175076,
+ 95745.369406050231,
+ 95768.824192269807,
+ 95792.280414657915,
+ 95815.738073038709,
+ 95839.197167236387,
+ 95862.657697075221,
+ 95886.11966237954,
+ 95909.583062973688,
+ 95933.047898682111,
+ 95956.514169329268,
+ 95979.981874739708,
+ 96003.451014738006,
+ 96026.921589148798,
+ 96050.393597796792,
+ 96073.867040506724,
+ 96097.341917103375,
+ 96120.818227411626,
+ 96144.295971256375,
+ 96167.775148462577,
+ 96191.255758855244,
+ 96214.737802259449,
+ 96238.221278500292,
+ 96261.70618740299,
+ 96285.192528792715,
+ 96308.680302494788,
+ 96332.169508334526,
+ 96355.660146137321,
+ 96379.152215728609,
+ 96402.645716933868,
+ 96426.14064957868,
+ 96449.637013488609,
+ 96473.134808489311,
+ 96496.63403440651,
+ 96520.134691065963,
+ 96543.636778293469,
+ 96567.140295914898,
+ 96590.645243756153,
+ 96614.151621643221,
+ 96637.659429402134,
+ 96661.168666858954,
+ 96684.679333839798,
+ 96708.191430170875,
+ 96731.70495567839,
+ 96755.219910188665,
+ 96778.736293528011,
+ 96802.254105522836,
+ 96825.77334599958,
+ 96849.29401478474,
+ 96872.816111704873,
+ 96896.339636586577,
+ 96919.864589256511,
+ 96943.390969541389,
+ 96966.918777267958,
+ 96990.448012263048,
+ 97013.978674353522,
+ 97037.510763366285,
+ 97061.044279128328,
+ 97084.579221466673,
+ 97108.115590208385,
+ 97131.653385180587,
+ 97155.19260621049,
+ 97178.733253125291,
+ 97202.2753257523,
+ 97225.81882391886,
+ 97249.363747452342,
+ 97272.910096180189,
+ 97296.457869929916,
+ 97320.007068529041,
+ 97343.557691805196,
+ 97367.109739586012,
+ 97390.663211699197,
+ 97414.218107972498,
+ 97437.774428233737,
+ 97461.332172310766,
+ 97484.891340031507,
+ 97508.451931223899,
+ 97532.013945715982,
+ 97555.577383335811,
+ 97579.142243911512,
+ 97602.708527271257,
+ 97626.276233243261,
+ 97649.845361655811,
+ 97673.415912337223,
+ 97696.987885115886,
+ 97720.561279820206,
+ 97744.1360962787,
+ 97767.712334319876,
+ 97791.289993772341,
+ 97814.869074464703,
+ 97838.449576225685,
+ 97862.031498883996,
+ 97885.614842268449,
+ 97909.199606207883,
+ 97932.785790531183,
+ 97956.37339506732,
+ 97979.962419645264,
+ 98003.552864094076,
+ 98027.144728242856,
+ 98050.738011920766,
+ 98074.332714956996,
+ 98097.928837180807,
+ 98121.526378421506,
+ 98145.125338508456,
+ 98168.725717271067,
+ 98192.327514538789,
+ 98215.930730141132,
+ 98239.535363907664,
+ 98263.141415668011,
+ 98286.748885251814,
+ 98310.357772488816,
+ 98333.968077208759,
+ 98357.579799241488,
+ 98381.192938416847,
+ 98404.807494564782,
+ 98428.42346751524,
+ 98452.040857098269,
+ 98475.659663143917,
+ 98499.27988548232,
+ 98522.901523943656,
+ 98546.524578358163,
+ 98570.149048556093,
+ 98593.774934367786,
+ 98617.402235623624,
+ 98641.030952154048,
+ 98664.661083789513,
+ 98688.292630360564,
+ 98711.925591697771,
+ 98735.559967631794,
+ 98759.195757993293,
+ 98782.832962613014,
+ 98806.471581321734,
+ 98830.111613950285,
+ 98853.753060329575,
+ 98877.39592029051,
+ 98901.040193664099,
+ 98924.68588028138,
+ 98948.33297997342,
+ 98971.981492571387,
+ 98995.63141790645,
+ 99019.282755809851,
+ 99042.935506112874,
+ 99066.589668646877,
+ 99090.245243243233,
+ 99113.902229733401,
+ 99137.560627948857,
+ 99161.220437721131,
+ 99184.881658881859,
+ 99208.544291262631,
+ 99232.208334695169,
+ 99255.87378901121,
+ 99279.540654042547,
+ 99303.208929621018,
+ 99326.878615578535,
+ 99350.549711746993,
+ 99374.222217958435,
+ 99397.896134044888,
+ 99421.571459838422,
+ 99445.248195171211,
+ 99468.926339875441,
+ 99492.605893783344,
+ 99516.286856727209,
+ 99539.969228539398,
+ 99563.653009052287,
+ 99587.338198098325,
+ 99611.024795510006,
+ 99634.712801119866,
+ 99658.402214760499,
+ 99682.093036264545,
+ 99705.785265464699,
+ 99729.478902193689,
+ 99753.173946284325,
+ 99776.870397569437,
+ 99800.56825588191,
+ 99824.267521054688,
+ 99847.968192920773,
+ 99871.670271313182,
+ 99895.373756065004,
+ 99919.078647009388,
+ 99942.78494397951,
+ 99966.492646808634,
+ 99990.20175533001,
+ 100013.91226937699,
+ 100037.62418878295,
+ 100061.33751338134,
+ 100085.05224300563,
+ 100108.76837748935,
+ 100132.4859166661,
+ 100156.2048603695,
+ 100179.92520843323,
+ 100203.64696069101,
+ 100227.37011697664,
+ 100251.09467712394,
+ 100274.82064096678,
+ 100298.54800833909,
+ 100322.27677907483,
+ 100346.00695300807,
+ 100369.73852997283,
+ 100393.47150980328,
+ 100417.20589233354,
+ 100440.94167739789,
+ 100464.67886483055,
+ 100488.41745446586,
+ 100512.1574461382,
+ 100535.89883968196,
+ 100559.64163493161,
+ 100583.38583172169,
+ 100607.13142988674,
+ 100630.87842926137,
+ 100654.62682968024,
+ 100678.37663097809,
+ 100702.12783298964,
+ 100725.88043554971,
+ 100749.63443849317,
+ 100773.38984165489,
+ 100797.14664486986,
+ 100820.90484797307,
+ 100844.66445079957,
+ 100868.42545318443,
+ 100892.18785496285,
+ 100915.95165596998,
+ 100939.71685604109,
+ 100963.48345501146,
+ 100987.25145271645,
+ 101011.02084899142,
+ 101034.79164367182,
+ 101058.56383659317,
+ 101082.33742759094,
+ 101106.11241650078,
+ 101129.88880315828,
+ 101153.66658739912,
+ 101177.44576905905,
+ 101201.22634797383,
+ 101225.00832397929,
+ 101248.7916969113,
+ 101272.57646660579,
+ 101296.36263289873,
+ 101320.15019562612,
+ 101343.93915462404,
+ 101367.7295097286,
+ 101391.52126077596,
+ 101415.31440760233,
+ 101439.10895004397,
+ 101462.9048879372,
+ 101486.70222111834,
+ 101510.50094942382,
+ 101534.30107269008,
+ 101558.10259075361,
+ 101581.90550345098,
+ 101605.70981061876,
+ 101629.5155120936,
+ 101653.32260771218,
+ 101677.13109731126,
+ 101700.9409807276,
+ 101724.75225779804,
+ 101748.56492835947,
+ 101772.37899224881,
+ 101796.19444930303,
+ 101820.01129935916,
+ 101843.82954225427,
+ 101867.64917782549,
+ 101891.47020590997,
+ 101915.29262634492,
+ 101939.11643896763,
+ 101962.94164361537,
+ 101986.76824012553,
+ 102010.59622833549,
+ 102034.42560808272,
+ 102058.25637920471,
+ 102082.08854153901,
+ 102105.9220949232,
+ 102129.75703919494,
+ 102153.59337419191,
+ 102177.43109975185,
+ 102201.27021571253,
+ 102225.1107219118,
+ 102248.95261818753,
+ 102272.79590437764,
+ 102296.64058032009,
+ 102320.48664585294,
+ 102344.33410081422,
+ 102368.18294504205,
+ 102392.03317837461,
+ 102415.88480065008,
+ 102439.73781170673,
+ 102463.59221138287,
+ 102487.44799951684,
+ 102511.30517594704,
+ 102535.1637405119,
+ 102559.02369304992,
+ 102582.88503339965,
+ 102606.74776139967,
+ 102630.61187688859,
+ 102654.4773797051,
+ 102678.34426968795,
+ 102702.21254667587,
+ 102726.08221050771,
+ 102749.95326102231,
+ 102773.8256980586,
+ 102797.69952145554,
+ 102821.57473105213,
+ 102845.45132668741,
+ 102869.32930820051,
+ 102893.20867543056,
+ 102917.08942821674,
+ 102940.97156639832,
+ 102964.85508981455,
+ 102988.73999830478,
+ 103012.6262917084,
+ 103036.51396986481,
+ 103060.40303261351,
+ 103084.293479794,
+ 103108.18531124585,
+ 103132.07852680866,
+ 103155.97312632212,
+ 103179.8691096259,
+ 103203.76647655977,
+ 103227.66522696352,
+ 103251.56536067701,
+ 103275.46687754011,
+ 103299.36977739276,
+ 103323.27406007495,
+ 103347.1797254267,
+ 103371.0867732881,
+ 103394.99520349925,
+ 103418.90501590034,
+ 103442.81621033157,
+ 103466.72878663319,
+ 103490.64274464553,
+ 103514.55808420894,
+ 103538.4748051638,
+ 103562.39290735057,
+ 103586.31239060973,
+ 103610.23325478184,
+ 103634.15549970744,
+ 103658.07912522719,
+ 103682.00413118176,
+ 103705.93051741188,
+ 103729.85828375829,
+ 103753.78743006183,
+ 103777.71795616332,
+ 103801.64986190372,
+ 103825.58314712394,
+ 103849.51781166498,
+ 103873.4538553679,
+ 103897.39127807376,
+ 103921.33007962372,
+ 103945.27025985894,
+ 103969.21181862066,
+ 103993.15475575015,
+ 104017.0990710887,
+ 104041.0447644777,
+ 104064.99183575854,
+ 104088.94028477269,
+ 104112.89011136163,
+ 104136.84131536692,
+ 104160.79389663014,
+ 104184.74785499295,
+ 104208.70319029699,
+ 104232.65990238401,
+ 104256.61799109577,
+ 104280.57745627411,
+ 104304.53829776087,
+ 104328.50051539797,
+ 104352.46410902737,
+ 104376.42907849104,
+ 104400.39542363105,
+ 104424.36314428948,
+ 104448.33224030846,
+ 104472.3027115302,
+ 104496.27455779689,
+ 104520.24777895081,
+ 104544.22237483428,
+ 104568.19834528965,
+ 104592.17569015936,
+ 104616.15440928582,
+ 104640.13450251156,
+ 104664.1159696791,
+ 104688.09881063103,
+ 104712.08302520998,
+ 104736.06861325864,
+ 104760.05557461972,
+ 104784.043909136,
+ 104808.03361665027,
+ 104832.0246970054,
+ 104856.01715004431,
+ 104880.01097560991,
+ 104904.00617354522,
+ 104928.00274369326,
+ 104952.00068589712,
+ 104975.99999999993,
+ 105000.00068584486,
+ 105024.00274327511,
+ 105048.00617213396,
+ 105072.0109722647,
+ 105096.0171435107,
+ 105120.02468571534,
+ 105144.03359872208,
+ 105168.04388237436,
+ 105192.05553651576,
+ 105216.06856098982,
+ 105240.08295564017,
+ 105264.09872031047,
+ 105288.11585484444,
+ 105312.13435908582,
+ 105336.1542328784,
+ 105360.17547606604,
+ 105384.19808849262,
+ 105408.22207000206,
+ 105432.24742043833,
+ 105456.27413964548,
+ 105480.30222746753,
+ 105504.33168374863,
+ 105528.36250833291,
+ 105552.39470106458,
+ 105576.42826178786,
+ 105600.46319034706,
+ 105624.49948658649,
+ 105648.53715035053,
+ 105672.5761814836,
+ 105696.61657983017,
+ 105720.65834523473,
+ 105744.70147754184,
+ 105768.7459765961,
+ 105792.79184224214,
+ 105816.83907432464,
+ 105840.88767268835,
+ 105864.93763717801,
+ 105888.98896763846,
+ 105913.04166391456,
+ 105937.09572585119,
+ 105961.15115329332,
+ 105985.20794608595,
+ 106009.26610407409,
+ 106033.32562710284,
+ 106057.38651501729,
+ 106081.44876766266,
+ 106105.51238488412,
+ 106129.57736652695,
+ 106153.64371243643,
+ 106177.71142245791,
+ 106201.78049643678,
+ 106225.85093421848,
+ 106249.92273564848,
+ 106273.99590057228,
+ 106298.07042883546,
+ 106322.14632028362,
+ 106346.22357476239,
+ 106370.30219211751,
+ 106394.38217219469,
+ 106418.46351483969,
+ 106442.54621989837,
+ 106466.63028721658,
+ 106490.71571664025,
+ 106514.80250801529,
+ 106538.89066118775,
+ 106562.98017600364,
+ 106587.07105230905,
+ 106611.16328995011,
+ 106635.25688877302,
+ 106659.35184862395,
+ 106683.44816934918,
+ 106707.54585079502,
+ 106731.64489280782,
+ 106755.74529523395,
+ 106779.84705791986,
+ 106803.95018071201,
+ 106828.05466345693,
+ 106852.16050600118,
+ 106876.26770819137,
+ 106900.37626987413,
+ 106924.48619089619,
+ 106948.59747110425,
+ 106972.71011034511,
+ 106996.82410846559,
+ 107020.93946531253,
+ 107045.05618073288,
+ 107069.17425457356,
+ 107093.29368668159,
+ 107117.41447690397,
+ 107141.53662508781,
+ 107165.66013108024,
+ 107189.7849947284,
+ 107213.91121587952,
+ 107238.03879438085,
+ 107262.16773007967,
+ 107286.29802282334,
+ 107310.42967245923,
+ 107334.56267883476,
+ 107358.69704179741,
+ 107382.83276119467,
+ 107406.96983687414,
+ 107431.10826868335,
+ 107455.24805646999,
+ 107479.38920008171,
+ 107503.53169936626,
+ 107527.67555417139,
+ 107551.82076434491,
+ 107575.96732973469,
+ 107600.11525018861,
+ 107624.26452555459,
+ 107648.41515568066,
+ 107672.56714041479,
+ 107696.72047960508,
+ 107720.87517309963,
+ 107745.03122074658,
+ 107769.18862239413,
+ 107793.34737789053,
+ 107817.50748708403,
+ 107841.66894982298,
+ 107865.83176595572,
+ 107889.99593533068,
+ 107914.16145779629,
+ 107938.32833320105,
+ 107962.49656139348,
+ 107986.66614222217,
+ 108010.83707553572,
+ 108035.00936118282,
+ 108059.18299901215,
+ 108083.35798887245,
+ 108107.53433061253,
+ 108131.71202408121,
+ 108155.89106912735,
+ 108180.07146559987,
+ 108204.25321334775,
+ 108228.43631221994,
+ 108252.62076206553,
+ 108276.80656273357,
+ 108300.99371407321,
+ 108325.18221593359,
+ 108349.37206816394,
+ 108373.56327061349,
+ 108397.75582313156,
+ 108421.94972556747,
+ 108446.1449777706,
+ 108470.34157959036,
+ 108494.53953087622,
+ 108518.73883147769,
+ 108542.93948124432,
+ 108567.14148002568,
+ 108591.34482767139,
+ 108615.54952403114,
+ 108639.75556895464,
+ 108663.96296229165,
+ 108688.17170389196,
+ 108712.38179360541,
+ 108736.59323128188,
+ 108760.80601677128,
+ 108785.02014992358,
+ 108809.23563058881,
+ 108833.45245861699,
+ 108857.67063385822,
+ 108881.89015616261,
+ 108906.11102538036,
+ 108930.33324136167,
+ 108954.55680395682,
+ 108978.78171301607,
+ 109003.00796838976,
+ 109027.23556992831,
+ 109051.46451748211,
+ 109075.69481090162,
+ 109099.92645003737,
+ 109124.15943473989,
+ 109148.39376485976,
+ 109172.62944024763,
+ 109196.86646075416,
+ 109221.10482623006,
+ 109245.34453652608,
+ 109269.58559149304,
+ 109293.82799098175,
+ 109318.07173484311,
+ 109342.31682292801,
+ 109366.56325508743,
+ 109390.81103117237,
+ 109415.06015103387,
+ 109439.31061452301,
+ 109463.56242149093,
+ 109487.8155717888,
+ 109512.07006526781,
+ 109536.3259017792,
+ 109560.58308117429,
+ 109584.8416033044,
+ 109609.1014680209,
+ 109633.36267517522,
+ 109657.62522461878,
+ 109681.88911620311,
+ 109706.15434977971,
+ 109730.4209252002,
+ 109754.68884231619,
+ 109778.95810097932,
+ 109803.22870104131,
+ 109827.50064235389,
+ 109851.77392476884,
+ 109876.04854813802,
+ 109900.32451231324,
+ 109924.60181714644,
+ 109948.88046248957,
+ 109973.1604481946,
+ 109997.44177411357,
+ 110021.72444009855,
+ 110046.00844600165,
+ 110070.29379167501,
+ 110094.58047697082,
+ 110118.86850174134,
+ 110143.15786583882,
+ 110167.44856911557,
+ 110191.74061142397,
+ 110216.03399261639,
+ 110240.32871254528,
+ 110264.62477106311,
+ 110288.9221680224,
+ 110313.22090327571,
+ 110337.52097667565,
+ 110361.82238807483,
+ 110386.12513732594,
+ 110410.42922428172,
+ 110434.73464879491,
+ 110459.04141071832,
+ 110483.34950990479,
+ 110507.6589462072,
+ 110531.96971947847,
+ 110556.28182957157,
+ 110580.5952763395,
+ 110604.91005963532,
+ 110629.22617931209,
+ 110653.54363522294,
+ 110677.86242722106,
+ 110702.18255515963,
+ 110726.50401889188,
+ 110750.82681827113,
+ 110775.1509531507,
+ 110799.47642338395,
+ 110823.80322882428,
+ 110848.13136932514,
+ 110872.46084474004,
+ 110896.79165492248,
+ 110921.12379972603,
+ 110945.4572790043,
+ 110969.79209261097,
+ 110994.12824039967,
+ 111018.46572222417,
+ 111042.80453793822,
+ 111067.14468739564,
+ 111091.48617045028,
+ 111115.82898695602,
+ 111140.1731367668,
+ 111164.51861973655,
+ 111188.86543571933,
+ 111213.21358456917,
+ 111237.56306614014,
+ 111261.91388028639,
+ 111286.26602686207,
+ 111310.61950572141,
+ 111334.97431671864,
+ 111359.33045970804,
+ 111383.68793454397,
+ 111408.04674108078,
+ 111432.40687917286,
+ 111456.76834867468,
+ 111481.13114944073,
+ 111505.49528132551,
+ 111529.86074418361,
+ 111554.22753786964,
+ 111578.59566223821,
+ 111602.96511714405,
+ 111627.33590244185,
+ 111651.7080179864,
+ 111676.08146363248,
+ 111700.45623923496,
+ 111724.8323446487,
+ 111749.20977972864,
+ 111773.58854432974,
+ 111797.96863830699,
+ 111822.35006151545,
+ 111846.73281381019,
+ 111871.11689504632,
+ 111895.50230507903,
+ 111919.8890437635,
+ 111944.27711095495,
+ 111968.6665065087,
+ 111993.05723028004,
+ 112017.44928212435,
+ 112041.842661897,
+ 112066.23736945343,
+ 112090.63340464912,
+ 112115.03076733962,
+ 112139.42945738042,
+ 112163.82947462716,
+ 112188.23081893545,
+ 112212.63349016097,
+ 112237.03748815943,
+ 112261.44281278658,
+ 112285.84946389822,
+ 112310.25744135017,
+ 112334.66674499828,
+ 112359.07737469849,
+ 112383.48933030672,
+ 112407.90261167898,
+ 112432.31721867126,
+ 112456.73315113965,
+ 112481.15040894024,
+ 112505.56899192919,
+ 112529.98889996267,
+ 112554.41013289688,
+ 112578.8326905881,
+ 112603.25657289263,
+ 112627.68177966679,
+ 112652.10831076698,
+ 112676.53616604958,
+ 112700.96534537108,
+ 112725.39584858794,
+ 112749.82767555672,
+ 112774.26082613398,
+ 112798.6953001763,
+ 112823.13109754038,
+ 112847.56821808286,
+ 112872.00666166049,
+ 112896.44642813003,
+ 112920.88751734827,
+ 112945.32992917208,
+ 112969.77366345831,
+ 112994.21872006389,
+ 113018.66509884578,
+ 113043.11279966099,
+ 113067.56182236652,
+ 113092.01216681948,
+ 113116.46383287695,
+ 113140.9168203961,
+ 113165.37112923413,
+ 113189.82675924824,
+ 113214.28371029573,
+ 113238.74198223387,
+ 113263.20157492002,
+ 113287.66248821157,
+ 113312.12472196593,
+ 113336.58827604055,
+ 113361.05315029295,
+ 113385.51934458067,
+ 113409.98685876124,
+ 113434.45569269233,
+ 113458.92584623155,
+ 113483.39731923661,
+ 113507.87011156522,
+ 113532.34422307517,
+ 113556.81965362425,
+ 113581.2964030703,
+ 113605.77447127122,
+ 113630.25385808491,
+ 113654.73456336933,
+ 113679.2165869825,
+ 113703.69992878241,
+ 113728.18458862718,
+ 113752.67056637487,
+ 113777.15786188368,
+ 113801.64647501177,
+ 113826.13640561736,
+ 113850.62765355874,
+ 113875.12021869418,
+ 113899.61410088204,
+ 113924.1092999807,
+ 113948.60581584855,
+ 113973.10364834407,
+ 113997.60279732574,
+ 114022.1032626521,
+ 114046.60504418171,
+ 114071.10814177318,
+ 114095.61255528514,
+ 114120.11828457628,
+ 114144.62532950533,
+ 114169.13368993104,
+ 114193.6433657122,
+ 114218.15435670764,
+ 114242.66666277625,
+ 114267.18028377694,
+ 114291.69521956862,
+ 114316.21147001031,
+ 114340.72903496103,
+ 114365.24791427983,
+ 114389.7681078258,
+ 114414.2896154581,
+ 114438.81243703589,
+ 114463.33657241837,
+ 114487.8620214648,
+ 114512.38878403447,
+ 114536.91685998671,
+ 114561.44624918087,
+ 114585.97695147636,
+ 114610.5089667326,
+ 114635.04229480909,
+ 114659.57693556532,
+ 114684.11288886084,
+ 114708.65015455526,
+ 114733.18873250818,
+ 114757.72862257928,
+ 114782.26982462825,
+ 114806.81233851484,
+ 114831.35616409882,
+ 114855.90130123998,
+ 114880.44774979822,
+ 114904.99550963337,
+ 114929.5445806054,
+ 114954.09496257425,
+ 114978.64665539992,
+ 115003.19965894247,
+ 115027.75397306195,
+ 115052.30959761847,
+ 115076.86653247218,
+ 115101.42477748329,
+ 115125.984332512,
+ 115150.54519741859,
+ 115175.10737206334,
+ 115199.67085630659,
+ 115224.23565000873,
+ 115248.80175303014,
+ 115273.3691652313,
+ 115297.93788647266,
+ 115322.50791661476,
+ 115347.07925551817,
+ 115371.65190304347,
+ 115396.22585905129,
+ 115420.80112340231,
+ 115445.37769595724,
+ 115469.95557657682,
+ 115494.53476512182,
+ 115519.11526145306,
+ 115543.69706543141,
+ 115568.28017691776,
+ 115592.86459577303,
+ 115617.4503218582,
+ 115642.03735503425,
+ 115666.62569516223,
+ 115691.21534210323,
+ 115715.80629571836,
+ 115740.39855586876,
+ 115764.99212241563,
+ 115789.58699522018,
+ 115814.18317414368,
+ 115838.78065904744,
+ 115863.37944979276,
+ 115887.97954624105,
+ 115912.5809482537,
+ 115937.18365569216,
+ 115961.78766841792,
+ 115986.39298629249,
+ 116010.99960917742,
+ 116035.60753693432,
+ 116060.21676942479,
+ 116084.82730651053,
+ 116109.43914805322,
+ 116134.0522939146,
+ 116158.66674395646,
+ 116183.2824980406,
+ 116207.89955602887,
+ 116232.51791778316,
+ 116257.13758316539,
+ 116281.75855203751,
+ 116306.38082426153,
+ 116331.00439969949,
+ 116355.62927821343,
+ 116380.25545966547,
+ 116404.88294391775,
+ 116429.51173083246,
+ 116454.14182027178,
+ 116478.77321209799,
+ 116503.40590617337,
+ 116528.03990236025,
+ 116552.67520052097,
+ 116577.31180051794,
+ 116601.94970221359,
+ 116626.5889054704,
+ 116651.22941015086,
+ 116675.87121611751,
+ 116700.51432323294,
+ 116725.15873135976,
+ 116749.8044403606,
+ 116774.45145009817,
+ 116799.0997604352,
+ 116823.74937123443,
+ 116848.40028235866,
+ 116873.05249367072,
+ 116897.70600503348,
+ 116922.36081630984,
+ 116947.01692736275,
+ 116971.67433805518,
+ 116996.33304825013,
+ 117020.99305781067,
+ 117045.65436659988,
+ 117070.31697448085,
+ 117094.98088131678,
+ 117119.64608697082,
+ 117144.31259130624,
+ 117168.98039418629,
+ 117193.64949547425,
+ 117218.31989503348,
+ 117242.99159272734,
+ 117267.66458841923,
+ 117292.33888197262,
+ 117317.01447325097,
+ 117341.6913621178,
+ 117366.36954843666,
+ 117391.04903207115,
+ 117415.72981288488,
+ 117440.41189074152,
+ 117465.09526550474,
+ 117489.77993703831,
+ 117514.46590520597,
+ 117539.15316987153,
+ 117563.84173089883,
+ 117588.53158815173,
+ 117613.22274149416,
+ 117637.91519079007,
+ 117662.60893590341,
+ 117687.30397669821,
+ 117712.00031303853,
+ 117736.69794478847,
+ 117761.39687181212,
+ 117786.09709397367,
+ 117810.7986111373,
+ 117835.50142316725,
+ 117860.20552992777,
+ 117884.91093128319,
+ 117909.6176270978,
+ 117934.32561723603,
+ 117959.03490156225,
+ 117983.74547994092,
+ 118008.45735223651,
+ 118033.17051831353,
+ 118057.88497803656,
+ 118082.60073127014,
+ 118107.31777787894,
+ 118132.03611772758,
+ 118156.75575068076,
+ 118181.47667660323,
+ 118206.19889535972,
+ 118230.92240681504,
+ 118255.64721083404,
+ 118280.37330728157,
+ 118305.10069602253,
+ 118329.82937692189,
+ 118354.55934984458,
+ 118379.29061465565,
+ 118404.02317122012,
+ 118428.75701940308,
+ 118453.49215906965,
+ 118478.22859008498,
+ 118502.96631231424,
+ 118527.70532562268,
+ 118552.44562987552,
+ 118577.18722493808,
+ 118601.93011067568,
+ 118626.67428695368,
+ 118651.41975363747,
+ 118676.16651059251,
+ 118700.91455768423,
+ 118725.66389477813,
+ 118750.41452173979,
+ 118775.16643843475,
+ 118799.91964472862,
+ 118824.67414048707,
+ 118849.42992557574,
+ 118874.18699986035,
+ 118898.94536320666,
+ 118923.70501548045,
+ 118948.46595654752,
+ 118973.22818627374,
+ 118997.99170452499,
+ 119022.7565111672,
+ 119047.52260606633,
+ 119072.28998908834,
+ 119097.0586600993,
+ 119121.82861896523,
+ 119146.59986555226,
+ 119171.3723997265,
+ 119196.14622135412,
+ 119220.92133030134,
+ 119245.69772643436,
+ 119270.47540961947,
+ 119295.25437972297,
+ 119320.03463661121,
+ 119344.81618015055,
+ 119369.5990102074,
+ 119394.38312664822,
+ 119419.16852933947,
+ 119443.95521814766,
+ 119468.74319293935,
+ 119493.53245358112,
+ 119518.32299993958,
+ 119543.11483188139,
+ 119567.90794927324,
+ 119592.70235198183,
+ 119617.49803987393,
+ 119642.29501281632,
+ 119667.09327067583,
+ 119691.89281331931,
+ 119716.69364061367,
+ 119741.49575242582,
+ 119766.29914862274,
+ 119791.10382907141,
+ 119815.90979363887,
+ 119840.71704219218,
+ 119865.52557459843,
+ 119890.33539072477,
+ 119915.14649043836,
+ 119939.95887360642,
+ 119964.77254009615,
+ 119989.58748977486,
+ 120014.40372250983,
+ 120039.22123816841,
+ 120064.04003661797,
+ 120088.86011772591,
+ 120113.6814813597,
+ 120138.5041273868,
+ 120163.3280556747,
+ 120188.15326609099,
+ 120212.97975850321,
+ 120237.807532779,
+ 120262.63658878599,
+ 120287.46692639188,
+ 120312.29854546436,
+ 120337.13144587121,
+ 120361.9656274802,
+ 120386.80109015915,
+ 120411.63783377589,
+ 120436.47585819835,
+ 120461.31516329442,
+ 120486.15574893207,
+ 120510.99761497928,
+ 120535.84076130406,
+ 120560.68518777451,
+ 120585.53089425867,
+ 120610.3778806247,
+ 120635.22614674074,
+ 120660.07569247499,
+ 120684.92651769568,
+ 120709.77862227106,
+ 120734.63200606944,
+ 120759.48666895913,
+ 120784.3426108085,
+ 120809.19983148595,
+ 120834.05833085992,
+ 120858.91810879884,
+ 120883.77916517125,
+ 120908.64149984565,
+ 120933.5051126906,
+ 120958.37000357473,
+ 120983.23617236665,
+ 121008.10361893504,
+ 121032.97234314861,
+ 121057.84234487606,
+ 121082.71362398617,
+ 121107.58618034775,
+ 121132.46001382964,
+ 121157.33512430069,
+ 121182.21151162982,
+ 121207.08917568595,
+ 121231.96811633807,
+ 121256.84833345517,
+ 121281.72982690629,
+ 121306.61259656049,
+ 121331.49664228689,
+ 121356.38196395461,
+ 121381.26856143285,
+ 121406.15643459078,
+ 121431.04558329767,
+ 121455.93600742276,
+ 121480.82770683538,
+ 121505.72068140487,
+ 121530.61493100057,
+ 121555.51045549192,
+ 121580.40725474835,
+ 121605.30532863933,
+ 121630.20467703436,
+ 121655.10529980299,
+ 121680.00719681478,
+ 121704.91036793934,
+ 121729.81481304632,
+ 121754.72053200539,
+ 121779.62752468624,
+ 121804.53579095862,
+ 121829.44533069231,
+ 121854.3561437571,
+ 121879.26823002285,
+ 121904.1815893594,
+ 121929.09622163669,
+ 121954.01212672464,
+ 121978.92930449323,
+ 122003.84775481246,
+ 122028.76747755238,
+ 122053.68847258303,
+ 122078.61073977455,
+ 122103.53427899707,
+ 122128.45909012076,
+ 122153.38517301581,
+ 122178.31252755247,
+ 122203.24115360099,
+ 122228.17105103172,
+ 122253.10221971494,
+ 122278.03465952107,
+ 122302.96837032049,
+ 122327.90335198362,
+ 122352.83960438096,
+ 122377.777127383,
+ 122402.71592086025,
+ 122427.65598468333,
+ 122452.59731872278,
+ 122477.53992284928,
+ 122502.48379693348,
+ 122527.42894084606,
+ 122552.37535445779,
+ 122577.32303763942,
+ 122602.27199026172,
+ 122627.22221219557,
+ 122652.17370331181,
+ 122677.12646348133,
+ 122702.08049257506,
+ 122727.03579046397,
+ 122751.99235701906,
+ 122776.95019211136,
+ 122801.9092956119,
+ 122826.8696673918,
+ 122851.83130732219,
+ 122876.79421527422,
+ 122901.75839111909,
+ 122926.72383472799,
+ 122951.69054597223,
+ 122976.65852472307,
+ 123001.62777085182,
+ 123026.59828422987,
+ 123051.57006472857,
+ 123076.54311221937,
+ 123101.5174265737,
+ 123126.49300766307,
+ 123151.46985535898,
+ 123176.44796953299,
+ 123201.42735005668,
+ 123226.40799680166,
+ 123251.38990963959,
+ 123276.37308844214,
+ 123301.35753308103,
+ 123326.343243428,
+ 123351.33021935483,
+ 123376.31846073334,
+ 123401.30796743535,
+ 123426.29873933276,
+ 123451.29077629748,
+ 123476.28407820144,
+ 123501.2786449166,
+ 123526.27447631498,
+ 123551.27157226863,
+ 123576.26993264959,
+ 123601.26955732999,
+ 123626.27044618195,
+ 123651.27259907764,
+ 123676.27601588926,
+ 123701.28069648903,
+ 123726.28664074924,
+ 123751.29384854218,
+ 123776.30231974016,
+ 123801.31205421555,
+ 123826.32305184075,
+ 123851.33531248817,
+ 123876.34883603029,
+ 123901.36362233957,
+ 123926.37967128855,
+ 123951.39698274979,
+ 123976.41555659588,
+ 124001.43539269941,
+ 124026.45649093305,
+ 124051.47885116948,
+ 124076.50247328142,
+ 124101.5273571416,
+ 124126.55350262282,
+ 124151.58090959788,
+ 124176.60957793961,
+ 124201.63950752091,
+ 124226.67069821467,
+ 124251.70314989384,
+ 124276.73686243138,
+ 124301.7718357003,
+ 124326.80806957364,
+ 124351.84556392446,
+ 124376.88431862585,
+ 124401.92433355095,
+ 124426.96560857294,
+ 124452.00814356498,
+ 124477.05193840031,
+ 124502.0969929522,
+ 124527.14330709392,
+ 124552.19088069882,
+ 124577.23971364023,
+ 124602.28980579154,
+ 124627.34115702618,
+ 124652.3937672176,
+ 124677.44763623926,
+ 124702.50276396469,
+ 124727.55915026742,
+ 124752.61679502104,
+ 124777.67569809916,
+ 124802.73585937542,
+ 124827.79727872348,
+ 124852.85995601704,
+ 124877.92389112986,
+ 124902.98908393568,
+ 124928.05553430831,
+ 124953.1232421216,
+ 124978.19220724938,
+ 125003.26242956554,
+ 125028.33390894404,
+ 125053.40664525882,
+ 125078.48063838384,
+ 125103.55588819318,
+ 125128.63239456083,
+ 125153.71015736091,
+ 125178.78917646752,
+ 125203.86945175481,
+ 125228.95098309696,
+ 125254.03377036817,
+ 125279.1178134427,
+ 125304.20311219479,
+ 125329.28966649878,
+ 125354.37747622898,
+ 125379.46654125977,
+ 125404.55686146552,
+ 125429.6484367207,
+ 125454.74126689974,
+ 125479.83535187715,
+ 125504.93069152744,
+ 125530.02728572517,
+ 125555.12513434493,
+ 125580.22423726133,
+ 125605.32459434902,
+ 125630.4262054827,
+ 125655.52907053704,
+ 125680.63318938682,
+ 125705.73856190679,
+ 125730.84518797178,
+ 125755.9530674566,
+ 125781.06220023613,
+ 125806.17258618528,
+ 125831.28422517896,
+ 125856.39711709213,
+ 125881.51126179981,
+ 125906.62665917698,
+ 125931.74330909875,
+ 125956.86121144016,
+ 125981.98036607634,
+ 126007.10077288245,
+ 126032.22243173365,
+ 126057.34534250517,
+ 126082.46950507225,
+ 126107.59491931014,
+ 126132.72158509417,
+ 126157.84950229966,
+ 126182.97867080198,
+ 126208.10909047653,
+ 126233.24076119871,
+ 126258.37368284403,
+ 126283.50785528794,
+ 126308.64327840599,
+ 126333.77995207369,
+ 126358.91787616667,
+ 126384.0570505605,
+ 126409.19747513086,
+ 126434.3391497534,
+ 126459.48207430386,
+ 126484.62624865794,
+ 126509.77167269142,
+ 126534.9183462801,
+ 126560.06626929982,
+ 126585.21544162642,
+ 126610.36586313581,
+ 126635.51753370393,
+ 126660.67045320668,
+ 126685.82462152008,
+ 126710.98003852014,
+ 126736.13670408291,
+ 126761.29461808444,
+ 126786.45378040087,
+ 126811.61419090834,
+ 126836.77584948298,
+ 126861.93875600102,
+ 126887.10291033868,
+ 126912.26831237224,
+ 126937.43496197795,
+ 126962.60285903217,
+ 126987.77200341123,
+ 127012.94239499152,
+ 127038.11403364947,
+ 127063.2869192615,
+ 127088.46105170409,
+ 127113.63643085376,
+ 127138.81305658702,
+ 127163.99092878048,
+ 127189.17004731069,
+ 127214.35041205429,
+ 127239.53202288797,
+ 127264.71487968838,
+ 127289.89898233226,
+ 127315.08433069635,
+ 127340.27092465744,
+ 127365.45876409234,
+ 127390.64784887788,
+ 127415.83817889093,
+ 127441.02975400841,
+ 127466.22257410725,
+ 127491.41663906439,
+ 127516.61194875685,
+ 127541.80850306165,
+ 127567.00630185583,
+ 127592.20534501647,
+ 127617.4056324207,
+ 127642.60716394568,
+ 127667.80993946856,
+ 127693.01395886653,
+ 127718.21922201688,
+ 127743.42572879682,
+ 127768.63347908368,
+ 127793.84247275478,
+ 127819.05270968749,
+ 127844.26418975917,
+ 127869.47691284724,
+ 127894.69087882918,
+ 127919.90608758242,
+ 127945.12253898452,
+ 127970.34023291297,
+ 127995.55916924537,
+ 128020.77934785932,
+ 128046.00076863244,
+ 128071.22343144237,
+ 128096.44733616684,
+ 128121.67248268353,
+ 128146.89887087021,
+ 128172.12650060465,
+ 128197.35537176467,
+ 128222.5854842281,
+ 128247.81683787282,
+ 128273.04943257671,
+ 128298.28326821771,
+ 128323.51834467379,
+ 128348.75466182294,
+ 128373.99221954317,
+ 128399.23101771252,
+ 128424.47105620909,
+ 128449.71233491098,
+ 128474.95485369631,
+ 128500.19861244329,
+ 128525.44361103009,
+ 128550.68984933494,
+ 128575.93732723613,
+ 128601.18604461191,
+ 128626.43600134061,
+ 128651.68719730059,
+ 128676.93963237021,
+ 128702.1933064279,
+ 128727.44821935208,
+ 128752.70437102125,
+ 128777.96176131385,
+ 128803.22039010846,
+ 128828.48025728362,
+ 128853.74136271792,
+ 128879.00370628996,
+ 128904.26728787841,
+ 128929.53210736193,
+ 128954.79816461923,
+ 128980.06545952905,
+ 129005.33399197015,
+ 129030.60376182134,
+ 129055.87476896142,
+ 129081.14701326926,
+ 129106.42049462376,
+ 129131.6952129038,
+ 129156.97116798835,
+ 129182.24835975636,
+ 129207.52678808685,
+ 129232.80645285884,
+ 129258.08735395141,
+ 129283.36949124365,
+ 129308.65286461466,
+ 129333.9374739436,
+ 129359.22331910966,
+ 129384.51039999202,
+ 129409.79871646997,
+ 129435.08826842274,
+ 129460.37905572963,
+ 129485.67107826998,
+ 129510.96433592314,
+ 129536.25882856851,
+ 129561.55455608548,
+ 129586.85151835352,
+ 129612.14971525209,
+ 129637.4491466607,
+ 129662.74981245887,
+ 129688.0517125262,
+ 129713.35484674224,
+ 129738.65921498663,
+ 129763.96481713903,
+ 129789.27165307909,
+ 129814.57972268655,
+ 129839.88902584116,
+ 129865.19956242264,
+ 129890.51133231082,
+ 129915.82433538554,
+ 129941.13857152662,
+ 129966.45404061397,
+ 129991.7707425275,
+ 130017.08867714716,
+ 130042.4078443529,
+ 130067.72824402474,
+ 130093.04987604271,
+ 130118.37274028687,
+ 130143.69683663732,
+ 130169.02216497416,
+ 130194.34872517755,
+ 130219.67651712766,
+ 130245.0055407047,
+ 130270.33579578891,
+ 130295.66728226055,
+ 130320.99999999991,
+ 130346.33394888733,
+ 130371.66912880314,
+ 130397.00553962773,
+ 130422.34318124152,
+ 130447.68205352494,
+ 130473.02215635845,
+ 130498.36348962256,
+ 130523.70605319779,
+ 130549.0498469647,
+ 130574.39487080388,
+ 130599.74112459592,
+ 130625.08860822149,
+ 130650.43732156123,
+ 130675.78726449587,
+ 130701.13843690613,
+ 130726.49083867275,
+ 130751.84446967654,
+ 130777.19932979831,
+ 130802.5554189189,
+ 130827.91273691918,
+ 130853.27128368006,
+ 130878.63105908247,
+ 130903.99206300738,
+ 130929.35429533575,
+ 130954.71775594862,
+ 130980.08244472703,
+ 131005.44836155206,
+ 131030.81550630482,
+ 131056.18387886642,
+ 131081.55347911804,
+ 131106.92430694087,
+ 131132.29636221612,
+ 131157.66964482504,
+ 131183.0441546489,
+ 131208.41989156904,
+ 131233.79685546676,
+ 131259.17504622342,
+ 131284.55446372041,
+ 131309.93510783918,
+ 131335.31697846117,
+ 131360.70007546784,
+ 131386.0843987407,
+ 131411.46994816128,
+ 131436.85672361116,
+ 131462.24472497194,
+ 131487.63395212521,
+ 131513.02440495262,
+ 131538.41608333588,
+ 131563.80898715663,
+ 131589.2031162967,
+ 131614.59847063778,
+ 131639.9950500617,
+ 131665.39285445024,
+ 131690.79188368531,
+ 131716.19213764873,
+ 131741.59361622241,
+ 131766.99631928833,
+ 131792.40024672839,
+ 131817.80539842462,
+ 131843.21177425905,
+ 131868.61937411371,
+ 131894.02819787065,
+ 131919.43824541202,
+ 131944.84951661993,
+ 131970.26201137656,
+ 131995.67572956407,
+ 132021.09067106468,
+ 132046.50683576067,
+ 132071.9242235343,
+ 132097.34283426782,
+ 132122.76266784366,
+ 132148.1837241441,
+ 132173.60600305157,
+ 132199.02950444847,
+ 132224.45422821722,
+ 132249.88017424036,
+ 132275.30734240031,
+ 132300.73573257966,
+ 132326.16534466096,
+ 132351.59617852676,
+ 132377.02823405969,
+ 132402.46151114244,
+ 132427.89600965759,
+ 132453.33172948789,
+ 132478.76867051609,
+ 132504.20683262491,
+ 132529.64621569714,
+ 132555.08681961559,
+ 132580.5286442631,
+ 132605.97168952253,
+ 132631.41595527678,
+ 132656.86144140881,
+ 132682.30814780149,
+ 132707.75607433787,
+ 132733.20522090094,
+ 132758.65558737374,
+ 132784.10717363929,
+ 132809.55997958075,
+ 132835.01400508118,
+ 132860.46925002377,
+ 132885.92571429166,
+ 132911.38339776811,
+ 132936.84230033628,
+ 132962.30242187946,
+ 132987.76376228096,
+ 133013.22632142407,
+ 133038.69009919214,
+ 133064.15509546854,
+ 133089.62131013666,
+ 133115.08874307995,
+ 133140.55739418184,
+ 133166.02726332581,
+ 133191.49835039541,
+ 133216.97065527414,
+ 133242.44417784561,
+ 133267.91891799335,
+ 133293.39487560102,
+ 133318.87205055228,
+ 133344.35044273079,
+ 133369.83005202023,
+ 133395.31087830439,
+ 133420.79292146701,
+ 133446.27618139185,
+ 133471.76065796276,
+ 133497.24635106357,
+ 133522.73326057816,
+ 133548.22138639039,
+ 133573.71072838426,
+ 133599.20128644365,
+ 133624.69306045261,
+ 133650.1860502951,
+ 133675.68025585517,
+ 133701.1756770169,
+ 133726.67231366437,
+ 133752.17016568172,
+ 133777.66923295305,
+ 133803.16951536259,
+ 133828.67101279454,
+ 133854.17372513309,
+ 133879.67765226253,
+ 133905.18279406714,
+ 133930.68915043125,
+ 133956.19672123916,
+ 133981.70550637526,
+ 134007.21550572399,
+ 134032.7267191697,
+ 134058.23914659687,
+ 134083.75278789,
+ 134109.26764293358,
+ 134134.78371161217,
+ 134160.30099381026,
+ 134185.8194894125,
+ 134211.33919830353,
+ 134236.8601203679,
+ 134262.38225549037,
+ 134287.90560355558,
+ 134313.43016444831,
+ 134338.95593805326,
+ 134364.48292425525,
+ 134390.01112293909,
+ 134415.54053398955,
+ 134441.07115729159,
+ 134466.60299273001,
+ 134492.1360401898,
+ 134517.67029955584,
+ 134543.20577071316,
+ 134568.74245354676,
+ 134594.28034794159,
+ 134619.81945378278,
+ 134645.35977095537,
+ 134670.90129934452,
+ 134696.4440388353,
+ 134721.98798931291,
+ 134747.53315066252,
+ 134773.07952276937,
+ 134798.62710551871,
+ 134824.17589879577,
+ 134849.72590248589,
+ 134875.27711647438,
+ 134900.82954064661,
+ 134926.38317488792,
+ 134951.93801908373,
+ 134977.49407311951,
+ 135003.05133688069,
+ 135028.60981025276,
+ 135054.16949312127,
+ 135079.73038537172,
+ 135105.29248688967,
+ 135130.85579756077,
+ 135156.42031727062,
+ 135181.98604590484,
+ 135207.55298334916,
+ 135233.12112948924,
+ 135258.69048421088,
+ 135284.26104739975,
+ 135309.83281894168,
+ 135335.4057987225,
+ 135360.97998662802,
+ 135386.55538254412,
+ 135412.13198635669,
+ 135437.70979795168,
+ 135463.28881721498,
+ 135488.86904403262,
+ 135514.45047829056,
+ 135540.03311987486,
+ 135565.61696867159,
+ 135591.20202456677,
+ 135616.78828744654,
+ 135642.37575719706,
+ 135667.96443370447,
+ 135693.55431685498,
+ 135719.14540653475,
+ 135744.73770263011,
+ 135770.33120502727,
+ 135795.92591361253,
+ 135821.52182827223,
+ 135847.11894889272,
+ 135872.7172753604,
+ 135898.31680756161,
+ 135923.91754538284,
+ 135949.51948871053,
+ 135975.12263743114,
+ 136000.72699143123,
+ 136026.33255059729,
+ 136051.93931481591,
+ 136077.54728397369,
+ 136103.15645795723,
+ 136128.76683665317,
+ 136154.37841994822,
+ 136179.99120772901,
+ 136205.60519988232,
+ 136231.2203962949,
+ 136256.83679685349,
+ 136282.45440144493,
+ 136308.07320995603,
+ 136333.69322227367,
+ 136359.31443828469,
+ 136384.93685787608,
+ 136410.56048093468,
+ 136436.18530734754,
+ 136461.81133700156,
+ 136487.43856978384,
+ 136513.06700558143,
+ 136538.6966442813,
+ 136564.32748577066,
+ 136589.95952993655,
+ 136615.59277666616,
+ 136641.22722584667,
+ 136666.86287736523,
+ 136692.49973110916,
+ 136718.13778696564,
+ 136743.77704482197,
+ 136769.41750456547,
+ 136795.05916608346,
+ 136820.70202926331,
+ 136846.34609399244,
+ 136871.99136015819,
+ 136897.63782764805,
+ 136923.28549634948,
+ 136948.93436614997,
+ 136974.58443693706,
+ 137000.23570859825,
+ 137025.88818102115,
+ 137051.54185409332,
+ 137077.19672770242,
+ 137102.85280173609,
+ 137128.51007608202,
+ 137154.16855062786,
+ 137179.82822526142,
+ 137205.48909987041,
+ 137231.15117434258,
+ 137256.8144485658,
+ 137282.47892242789,
+ 137308.14459581667,
+ 137333.81146862009,
+ 137359.47954072602,
+ 137385.14881202241,
+ 137410.81928239719,
+ 137436.49095173844,
+ 137462.16381993407,
+ 137487.83788687221,
+ 137513.51315244089,
+ 137539.18961652822,
+ 137564.86727902229,
+ 137590.54613981131,
+ 137616.22619878338,
+ 137641.90745582676,
+ 137667.58991082967,
+ 137693.27356368033,
+ 137718.95841426702,
+ 137744.64446247809,
+ 137770.33170820182,
+ 137796.02015132661,
+ 137821.70979174081,
+ 137847.40062933284,
+ 137873.09266399115,
+ 137898.78589560417,
+ 137924.48032406042,
+ 137950.17594924837,
+ 137975.8727710566,
+ 138001.57078937365,
+ 138027.27000408815,
+ 138052.97041508864,
+ 138078.67202226384,
+ 138104.3748255024,
+ 138130.07882469296,
+ 138155.78401972432,
+ 138181.49041048516,
+ 138207.1979968643,
+ 138232.9067787505,
+ 138258.61675603263,
+ 138284.32792859949,
+ 138310.04029633995,
+ 138335.75385914298,
+ 138361.46861689744,
+ 138387.18456949232,
+ 138412.90171681659,
+ 138438.62005875923,
+ 138464.33959520931,
+ 138490.06032605586,
+ 138515.78225118798,
+ 138541.50537049473,
+ 138567.2296838653,
+ 138592.95519118884,
+ 138618.68189235451,
+ 138644.40978725153,
+ 138670.13887576913,
+ 138695.86915779658,
+ 138721.60063322316,
+ 138747.33330193823,
+ 138773.06716383106,
+ 138798.80221879104,
+ 138824.53846670757,
+ 138850.27590747006,
+ 138876.01454096794,
+ 138901.7543670907,
+ 138927.49538572782,
+ 138953.2375967688,
+ 138978.9810001032,
+ 139004.72559562061,
+ 139030.47138321059,
+ 139056.2183627628,
+ 139081.96653416683,
+ 139107.71589731239,
+ 139133.46645208917,
+ 139159.21819838689,
+ 139184.97113609532,
+ 139210.72526510421,
+ 139236.48058530336,
+ 139262.23709658257,
+ 139287.99479883176,
+ 139313.75369194071,
+ 139339.51377579942,
+ 139365.27505029776,
+ 139391.03751532568,
+ 139416.80117077316,
+ 139442.56601653024,
+ 139468.33205248689,
+ 139494.09927853322,
+ 139519.86769455927,
+ 139545.63730045516,
+ 139571.408096111,
+ 139597.18008141697,
+ 139622.95325626322,
+ 139648.72762054001,
+ 139674.5031741375,
+ 139700.27991694602,
+ 139726.05784885579,
+ 139751.83696975713,
+ 139777.61727954043,
+ 139803.39877809596,
+ 139829.18146531415,
+ 139854.96534108539,
+ 139880.75040530015,
+ 139906.53665784886,
+ 139932.32409862199,
+ 139958.11272751007,
+ 139983.90254440365,
+ 140009.69354919327,
+ 140035.48574176949,
+ 140061.27912202294,
+ 140087.07368984428,
+ 140112.86944512415,
+ 140138.66638775321,
+ 140164.4645176222,
+ 140190.26383462184,
+ 140216.06433864293,
+ 140241.86602957622,
+ 140267.66890731253,
+ 140293.47297174268,
+ 140319.27822275754,
+ 140345.08466024802,
+ 140370.89228410498,
+ 140396.70109421943,
+ 140422.51109048226,
+ 140448.32227278448,
+ 140474.13464101712,
+ 140499.94819507122,
+ 140525.76293483781,
+ 140551.57886020801,
+ 140577.3959710729,
+ 140603.21426732364,
+ 140629.03374885136,
+ 140654.85441554731,
+ 140680.67626730262,
+ 140706.49930400858,
+ 140732.32352555645,
+ 140758.1489318375,
+ 140783.97552274304,
+ 140809.80329816442,
+ 140835.63225799298,
+ 140861.46240212015,
+ 140887.29373043729,
+ 140913.12624283586,
+ 140938.95993920733,
+ 140964.79481944317,
+ 140990.63088343487,
+ 141016.46813107401,
+ 141042.30656225214,
+ 141068.14617686081,
+ 141093.98697479168,
+ 141119.82895593636,
+ 141145.6721201865,
+ 141171.51646743377,
+ 141197.36199756994,
+ 141223.20871048668,
+ 141249.05660607578,
+ 141274.90568422904,
+ 141300.75594483822,
+ 141326.6073877952,
+ 141352.4600129918,
+ 141378.31382031992,
+ 141404.16880967148,
+ 141430.02498093838,
+ 141455.8823340126,
+ 141481.74086878612,
+ 141507.60058515094,
+ 141533.46148299909,
+ 141559.32356222265,
+ 141585.18682271364,
+ 141611.05126436421,
+ 141636.9168870665,
+ 141662.78369071262,
+ 141688.65167519479,
+ 141714.5208404052,
+ 141740.39118623605,
+ 141766.26271257963,
+ 141792.1354193282,
+ 141818.00930637406,
+ 141843.88437360956,
+ 141869.760620927,
+ 141895.6380482188,
+ 141921.51665537735,
+ 141947.39644229505,
+ 141973.27740886438,
+ 141999.15955497778,
+ 142025.04288052776,
+ 142050.92738540689,
+ 142076.81306950765,
+ 142102.69993272264,
+ 142128.58797494444,
+ 142154.47719606571,
+ 142180.36759597904,
+ 142206.25917457714,
+ 142232.15193175265,
+ 142258.04586739838,
+ 142283.94098140698,
+ 142309.83727367126,
+ 142335.73474408401,
+ 142361.63339253806,
+ 142387.5332189262,
+ 142413.43422314132,
+ 142439.33640507635,
+ 142465.23976462413,
+ 142491.14430167765,
+ 142517.05001612983,
+ 142542.95690787368,
+ 142568.86497680223,
+ 142594.77422280848,
+ 142620.68464578551,
+ 142646.5962456264,
+ 142672.50902222423,
+ 142698.42297547215,
+ 142724.33810526333,
+ 142750.25441149093,
+ 142776.17189404817,
+ 142802.09055282827,
+ 142828.01038772447,
+ 142853.93139863008,
+ 142879.85358543837,
+ 142905.77694804268,
+ 142931.70148633636,
+ 142957.62720021277,
+ 142983.55408956532,
+ 143009.48215428743,
+ 143035.41139427255,
+ 143061.34180941415,
+ 143087.27339960571,
+ 143113.20616474075,
+ 143139.14010471283,
+ 143165.07521941551,
+ 143191.01150874238,
+ 143216.94897258704,
+ 143242.88761084314,
+ 143268.82742340435,
+ 143294.76841016437,
+ 143320.71057101688,
+ 143346.65390585564,
+ 143372.59841457437,
+ 143398.54409706692,
+ 143424.49095322701,
+ 143450.43898294857,
+ 143476.38818612538,
+ 143502.33856265133,
+ 143528.29011242036,
+ 143554.24283532638,
+ 143580.19673126334,
+ 143606.1518001252,
+ 143632.10804180597,
+ 143658.06545619969,
+ 143684.02404320039,
+ 143709.98380270213,
+ 143735.944734599,
+ 143761.90683878519,
+ 143787.87011515474,
+ 143813.83456360188,
+ 143839.8001840208,
+ 143865.76697630569,
+ 143891.73494035081,
+ 143917.7040760504,
+ 143943.67438329876,
+ 143969.6458619902,
+ 143995.61851201905,
+ 144021.59233327967,
+ 144047.56732566646,
+ 144073.54348907378,
+ 144099.52082339607,
+ 144125.49932852783,
+ 144151.4790043635,
+ 144177.45985079758,
+ 144203.44186772458,
+ 144229.42505503909,
+ 144255.40941263564,
+ 144281.39494040885,
+ 144307.38163825331,
+ 144333.36950606373,
+ 144359.35854373468,
+ 144385.34875116093,
+ 144411.34012823718,
+ 144437.33267485813,
+ 144463.32639091855,
+ 144489.32127631325,
+ 144515.31733093705,
+ 144541.31455468474,
+ 144567.3129474512,
+ 144593.3125091313,
+ 144619.31323961995,
+ 144645.31513881206,
+ 144671.31820660262,
+ 144697.32244288657,
+ 144723.32784755889,
+ 144749.33442051467,
+ 144775.34216164888,
+ 144801.35107085665,
+ 144827.36114803303,
+ 144853.37239307314,
+ 144879.38480587213,
+ 144905.39838632516,
+ 144931.41313432742,
+ 144957.4290497741,
+ 144983.44613256046,
+ 145009.46438258173,
+ 145035.48379973322,
+ 145061.50438391021,
+ 145087.52613500805,
+ 145113.54905292206,
+ 145139.57313754765,
+ 145165.59838878017,
+ 145191.62480651509,
+ 145217.65239064783,
+ 145243.68114107384,
+ 145269.71105768863,
+ 145295.74214038774,
+ 145321.77438906668,
+ 145347.80780362099,
+ 145373.84238394629,
+ 145399.87812993818,
+ 145425.91504149229,
+ 145451.95311850426,
+ 145477.9923608698,
+ 145504.03276848458,
+ 145530.07434124436,
+ 145556.11707904484,
+ 145582.16098178181,
+ 145608.20604935108,
+ 145634.25228164849,
+ 145660.29967856981,
+ 145686.34824001096,
+ 145712.39796586783,
+ 145738.4488560363,
+ 145764.50091041232,
+ 145790.55412889185,
+ 145816.60851137087,
+ 145842.66405774537,
+ 145868.72076791141,
+ 145894.77864176501,
+ 145920.83767920226,
+ 145946.89788011924,
+ 145972.95924441208,
+ 145999.02177197693,
+ 146025.08546270995,
+ 146051.15031650732,
+ 146077.21633326527,
+ 146103.28351288004,
+ 146129.35185524789,
+ 146155.42136026506,
+ 146181.49202782792,
+ 146207.56385783272,
+ 146233.63685017588,
+ 146259.71100475377,
+ 146285.78632146274,
+ 146311.86280019928,
+ 146337.94044085976,
+ 146364.01924334071,
+ 146390.09920753856,
+ 146416.18033334985,
+ 146442.26262067116,
+ 146468.34606939898,
+ 146494.43067942993,
+ 146520.51645066062,
+ 146546.60338298764,
+ 146572.69147630769,
+ 146598.78073051744,
+ 146624.87114551352,
+ 146650.96272119274,
+ 146677.05545745179,
+ 146703.14935418745,
+ 146729.2444112965,
+ 146755.34062867577,
+ 146781.43800622207,
+ 146807.53654383228,
+ 146833.63624140329,
+ 146859.73709883197,
+ 146885.83911601527,
+ 146911.94229285014,
+ 146938.04662923355,
+ 146964.15212506248,
+ 146990.25878023397,
+ 147016.36659464505,
+ 147042.47556819281,
+ 147068.58570077427,
+ 147094.6969922866,
+ 147120.80944262692,
+ 147146.92305169237,
+ 147173.03781938017,
+ 147199.15374558745,
+ 147225.27083021149,
+ 147251.38907314953,
+ 147277.50847429881,
+ 147303.62903355664,
+ 147329.75075082036,
+ 147355.87362598727,
+ 147381.99765895473,
+ 147408.12284962015,
+ 147434.24919788091,
+ 147460.37670363448,
+ 147486.50536677826,
+ 147512.63518720976,
+ 147538.76616482646,
+ 147564.89829952587,
+ 147591.03159120557,
+ 147617.16603976308,
+ 147643.30164509601,
+ 147669.43840710199,
+ 147695.57632567859,
+ 147721.71540072354,
+ 147747.85563213445,
+ 147773.99701980909,
+ 147800.13956364512,
+ 147826.28326354033,
+ 147852.42811939248,
+ 147878.57413109933,
+ 147904.72129855872,
+ 147930.86962166851,
+ 147957.01910032652,
+ 147983.16973443062,
+ 148009.32152387875,
+ 148035.47446856883,
+ 148061.62856839882,
+ 148087.78382326665,
+ 148113.94023307035,
+ 148140.09779770792,
+ 148166.25651707739,
+ 148192.41639107687,
+ 148218.57741960438,
+ 148244.73960255808,
+ 148270.90293983606,
+ 148297.0674313365,
+ 148323.23307695755,
+ 148349.39987659742,
+ 148375.56783015432,
+ 148401.73693752653,
+ 148427.90719861226,
+ 148454.07861330983,
+ 148480.25118151752,
+ 148506.42490313368,
+ 148532.59977805667,
+ 148558.77580618486,
+ 148584.95298741665,
+ 148611.13132165043,
+ 148637.31080878471,
+ 148663.49144871789,
+ 148689.6732413485,
+ 148715.85618657502,
+ 148742.040284296,
+ 148768.22553440998,
+ 148794.41193681557,
+ 148820.59949141133,
+ 148846.78819809589,
+ 148872.97805676793,
+ 148899.16906732606,
+ 148925.36122966901,
+ 148951.55454369547,
+ 148977.74900930419,
+ 149003.9446263939,
+ 149030.1413948634,
+ 149056.33931461151,
+ 149082.53838553699,
+ 149108.73860753875,
+ 149134.9399805156,
+ 149161.14250436646,
+ 149187.34617899026,
+ 149213.5510042859,
+ 149239.75698015234,
+ 149265.96410648854,
+ 149292.17238319354,
+ 149318.38181016635,
+ 149344.59238730598,
+ 149370.80411451156,
+ 149397.01699168212,
+ 149423.23101871679,
+ 149449.44619551473,
+ 149475.66252197503,
+ 149501.87999799693,
+ 149528.0986234796,
+ 149554.31839832227,
+ 149580.53932242419,
+ 149606.76139568459,
+ 149632.98461800278,
+ 149659.20898927809,
+ 149685.43450940982,
+ 149711.66117829733,
+ 149737.88899584001,
+ 149764.11796193724,
+ 149790.34807648844,
+ 149816.57933939309,
+ 149842.81175055061,
+ 149869.04530986046,
+ 149895.28001722222,
+ 149921.51587253538,
+ 149947.75287569952,
+ 149973.99102661415,
+ 150000.23032517891,
+ 150026.47077129342,
+ 150052.71236485732,
+ 150078.95510577026,
+ 150105.1989939319,
+ 150131.444029242,
+ 150157.69021160025,
+ 150183.93754090639,
+ 150210.18601706024,
+ 150236.43563996154,
+ 150262.68640951012,
+ 150288.93832560582,
+ 150315.19138814852,
+ 150341.44559703805,
+ 150367.70095217437,
+ 150393.95745345735,
+ 150420.21510078697,
+ 150446.47389406321,
+ 150472.73383318601,
+ 150498.99491805542,
+ 150525.25714857146,
+ 150551.52052463419,
+ 150577.78504614369,
+ 150604.05071300003,
+ 150630.31752510337,
+ 150656.58548235384,
+ 150682.85458465159,
+ 150709.1248318968,
+ 150735.39622398972,
+ 150761.66876083051,
+ 150787.9424423195,
+ 150814.21726835691,
+ 150840.49323884305,
+ 150866.77035367821,
+ 150893.04861276277,
+ 150919.32801599705,
+ 150945.60856328148,
+ 150971.89025451642,
+ 150998.17308960229,
+ 151024.45706843957,
+ 151050.74219092872,
+ 151077.02845697021,
+ 151103.31586646455,
+ 151129.60441931229,
+ 151155.894115414,
+ 151182.1849546702,
+ 151208.47693698155,
+ 151234.77006224863,
+ 151261.06433037209,
+ 151287.35974125259,
+ 151313.65629479082,
+ 151339.95399088747,
+ 151366.25282944329,
+ 151392.55281035902,
+ 151418.85393353543,
+ 151445.1561988733,
+ 151471.45960627345,
+ 151497.76415563675,
+ 151524.06984686397,
+ 151550.37667985607,
+ 151576.68465451393,
+ 151602.99377073845,
+ 151629.30402843058,
+ 151655.61542749128,
+ 151681.92796782157,
+ 151708.24164932242,
+ 151734.55647189484,
+ 151760.87243543993,
+ 151787.18953985872,
+ 151813.50778505235,
+ 151839.82717092187,
+ 151866.14769736846,
+ 151892.46936429327,
+ 151918.79217159748,
+ 151945.11611918229,
+ 151971.44120694889,
+ 151997.76743479856,
+ 152024.09480263255,
+ 152050.42331035214,
+ 152076.75295785864,
+ 152103.08374505339,
+ 152129.41567183775,
+ 152155.74873811303,
+ 152182.08294378067,
+ 152208.41828874208,
+ 152234.75477289871,
+ 152261.09239615197,
+ 152287.43115840337,
+ 152313.77105955439,
+ 152340.11209950657,
+ 152366.45427816146,
+ 152392.79759542056,
+ 152419.14205118554,
+ 152445.48764535793,
+ 152471.8343778394,
+ 152498.18224853161,
+ 152524.53125733617,
+ 152550.88140415482,
+ 152577.23268888926,
+ 152603.58511144121,
+ 152629.93867171241,
+ 152656.29336960468,
+ 152682.64920501978,
+ 152709.00617785956,
+ 152735.36428802583,
+ 152761.72353542043,
+ 152788.08391994529,
+ 152814.44544150229,
+ 152840.80809999333,
+ 152867.17189532038,
+ 152893.53682738543,
+ 152919.90289609041,
+ 152946.27010133737,
+ 152972.63844302832,
+ 152999.00792106529,
+ 153025.37853535041,
+ 153051.7502857857,
+ 153078.12317227334,
+ 153104.4971947154,
+ 153130.8723530141,
+ 153157.24864707157,
+ 153183.62607679001,
+ 153210.00464207167,
+ 153236.38434281875,
+ 153262.76517893354,
+ 153289.14715031831,
+ 153315.53025687535,
+ 153341.91449850702,
+ 153368.2998751156,
+ 153394.68638660354,
+ 153421.07403287315,
+ 153447.46281382689,
+ 153473.85272936718,
+ 153500.24377939643,
+ 153526.63596381716,
+ 153553.02928253182,
+ 153579.42373544298,
+ 153605.81932245308,
+ 153632.21604346478,
+ 153658.61389838057,
+ 153685.0128871031,
+ 153711.41300953497,
+ 153737.81426557881,
+ 153764.21665513728,
+ 153790.62017811305,
+ 153817.02483440886,
+ 153843.43062392739,
+ 153869.83754657139,
+ 153896.24560224367,
+ 153922.65479084692,
+ 153949.06511228404,
+ 153975.4765664578,
+ 154001.88915327107,
+ 154028.30287262669,
+ 154054.71772442761,
+ 154081.13370857667,
+ 154107.55082497682,
+ 154133.96907353101,
+ 154160.38845414223,
+ 154186.80896671346,
+ 154213.23061114774,
+ 154239.65338734805,
+ 154266.07729521746,
+ 154292.50233465908,
+ 154318.92850557598,
+ 154345.35580787127,
+ 154371.7842414481,
+ 154398.21380620965,
+ 154424.64450205903,
+ 154451.07632889951,
+ 154477.50928663427,
+ 154503.94337516659,
+ 154530.37859439969,
+ 154556.81494423689,
+ 154583.25242458144,
+ 154609.69103533673,
+ 154636.13077640603,
+ 154662.57164769279,
+ 154689.01364910032,
+ 154715.45678053208,
+ 154741.90104189145,
+ 154768.34643308193,
+ 154794.79295400696,
+ 154821.24060457002,
+ 154847.68938467462,
+ 154874.13929422433,
+ 154900.59033312264,
+ 154927.04250127316,
+ 154953.49579857948,
+ 154979.95022494521,
+ 155006.40578027396,
+ 155032.86246446942,
+ 155059.32027743524,
+ 155085.77921907514,
+ 155112.2392892928,
+ 155138.70048799197,
+ 155165.16281507642,
+ 155191.62627044989,
+ 155218.09085401625,
+ 155244.55656567923,
+ 155271.02340534274,
+ 155297.49137291059,
+ 155323.96046828668,
+ 155350.4306913749,
+ 155376.90204207919,
+ 155403.37452030348,
+ 155429.84812595171,
+ 155456.32285892789,
+ 155482.79871913602,
+ 155509.27570648011,
+ 155535.75382086422,
+ 155562.23306219239,
+ 155588.71343036872,
+ 155615.19492529731,
+ 155641.67754688227,
+ 155668.16129502779,
+ 155694.64616963797,
+ 155721.13217061706,
+ 155747.61929786921,
+ 155774.10755129869,
+ 155800.59693080973,
+ 155827.08743630661,
+ 155853.57906769359,
+ 155880.07182487496,
+ 155906.56570775513,
+ 155933.06071623837,
+ 155959.55685022907,
+ 155986.05410963166,
+ 156012.5524943505,
+ 156039.05200429002,
+ 156065.55263935472,
+ 156092.054399449,
+ 156118.5572844774,
+ 156145.06129434443,
+ 156171.5664289546,
+ 156198.07268821247,
+ 156224.5800720226,
+ 156251.08858028959,
+ 156277.59821291809,
+ 156304.10896981266,
+ 156330.62085087801,
+ 156357.1338560188,
+ 156383.64798513969,
+ 156410.16323814544,
+ 156436.67961494075,
+ 156463.1971154304,
+ 156489.71573951913,
+ 156516.23548711176,
+ 156542.75635811311,
+ 156569.27835242799,
+ 156595.80146996127,
+ 156622.32571061782,
+ 156648.85107430254,
+ 156675.37756092031,
+ 156701.90517037612,
+ 156728.43390257491,
+ 156754.96375742162,
+ 156781.49473482129,
+ 156808.02683467892,
+ 156834.5600568995,
+ 156861.09440138817,
+ 156887.62986804993,
+ 156914.16645678994,
+ 156940.70416751326,
+ 156967.24300012505,
+ 156993.78295453047,
+ 157020.32403063469,
+ 157046.8662283429,
+ 157073.40954756032,
+ 157099.9539881922,
+ 157126.49955014378,
+ 157153.04623332032,
+ 157179.59403762716,
+ 157206.14296296958,
+ 157232.69300925292,
+ 157259.24417638258,
+ 157285.79646426387,
+ 157312.34987280221,
+ 157338.90440190304,
+ 157365.46005147175,
+ 157392.01682141385,
+ 157418.57471163478,
+ 157445.13372204005,
+ 157471.69385253513,
+ 157498.25510302564,
+ 157524.81747341706,
+ 157551.38096361503,
+ 157577.9455735251,
+ 157604.51130305286,
+ 157631.07815210402,
+ 157657.64612058419,
+ 157684.21520839902,
+ 157710.78541545427,
+ 157737.35674165559,
+ 157763.92918690876,
+ 157790.50275111952,
+ 157817.07743419363,
+ 157843.65323603692,
+ 157870.23015655516,
+ 157896.80819565422,
+ 157923.3873532399,
+ 157949.96762921812,
+ 157976.54902349479,
+ 158003.13153597576,
+ 158029.71516656701,
+ 158056.29991517449,
+ 158082.88578170416,
+ 158109.47276606198,
+ 158136.06086815402,
+ 158162.65008788629,
+ 158189.24042516484,
+ 158215.83187989573,
+ 158242.42445198505,
+ 158269.01814133892,
+ 158295.61294786347,
+ 158322.20887146486,
+ 158348.80591204923,
+ 158375.4040695228,
+ 158402.00334379176,
+ 158428.60373476235,
+ 158455.2052423408,
+ 158481.80786643337,
+ 158508.41160694641,
+ 158535.01646378616,
+ 158561.62243685898,
+ 158588.2295260712,
+ 158614.8377313292,
+ 158641.44705253936,
+ 158668.05748960807,
+ 158694.66904244179,
+ 158721.28171094693,
+ 158747.89549502998,
+ 158774.5103945974,
+ 158801.12640955573,
+ 158827.74353981143,
+ 158854.36178527112,
+ 158880.9811458413,
+ 158907.60162142856,
+ 158934.22321193956,
+ 158960.84591728085,
+ 158987.46973735912,
+ 159014.09467208097,
+ 159040.72072135314,
+ 159067.3478850823,
+ 159093.97616317519,
+ 159120.60555553852,
+ 159147.23606207906,
+ 159173.8676827036,
+ 159200.50041731889,
+ 159227.13426583182,
+ 159253.76922814918,
+ 159280.40530417781,
+ 159307.04249382461,
+ 159333.68079699649,
+ 159360.32021360032,
+ 159386.96074354305,
+ 159413.60238673165,
+ 159440.24514307309,
+ 159466.88901247433,
+ 159493.53399484244,
+ 159520.18009008438,
+ 159546.82729810724,
+ 159573.47561881805,
+ 159600.12505212394,
+ 159626.77559793202,
+ 159653.42725614941,
+ 159680.08002668325,
+ 159706.73390944069,
+ 159733.38890432892,
+ 159760.04501125516,
+ 159786.70223012666,
+ 159813.36056085059,
+ 159840.02000333427,
+ 159866.68055748497,
+ 159893.34222320997,
+ 159920.00500041663,
+ 159946.66888901225,
+ 159973.33388890422,
+ 159999.99999999988,
+ 160026.66722220668,
+ 160053.33555543202,
+ 160080.0049995833,
+ 160106.67555456801,
+ 160133.3472202936,
+ 160160.0199966676,
+ 160186.6938835975,
+ 160213.36888099083,
+ 160240.04498875517,
+ 160266.72220679806,
+ 160293.40053502709,
+ 160320.07997334987,
+ 160346.76052167406,
+ 160373.44217990729,
+ 160400.1249479572,
+ 160426.80882573154,
+ 160453.49381313793,
+ 160480.17991008417,
+ 160506.86711647795,
+ 160533.55543222709,
+ 160560.24485723933,
+ 160586.93539142248,
+ 160613.62703468435,
+ 160640.31978693281,
+ 160667.01364807569,
+ 160693.70861802087,
+ 160720.40469667627,
+ 160747.1018839498,
+ 160773.80017974938,
+ 160800.49958398298,
+ 160827.20009655855,
+ 160853.90171738411,
+ 160880.60444636765,
+ 160907.30828341722,
+ 160934.01322844089,
+ 160960.71928134665,
+ 160987.42644204266,
+ 161014.13471043704,
+ 161040.84408643784,
+ 161067.55456995327,
+ 161094.26616089148,
+ 161120.97885916062,
+ 161147.69266466892,
+ 161174.40757732463,
+ 161201.12359703594,
+ 161227.84072371112,
+ 161254.55895725847,
+ 161281.27829758628,
+ 161307.99874460287,
+ 161334.72029821656,
+ 161361.44295833571,
+ 161388.1667248687,
+ 161414.89159772391,
+ 161441.61757680977,
+ 161468.34466203468,
+ 161495.07285330712,
+ 161521.80215053557,
+ 161548.53255362847,
+ 161575.26406249436,
+ 161601.99667704175,
+ 161628.7303971792,
+ 161655.46522281526,
+ 161682.20115385848,
+ 161708.93819021754,
+ 161735.67633180099,
+ 161762.41557851751,
+ 161789.15593027571,
+ 161815.89738698432,
+ 161842.63994855201,
+ 161869.38361488748,
+ 161896.1283858995,
+ 161922.87426149679,
+ 161949.62124158812,
+ 161976.36932608229,
+ 162003.1185148881,
+ 162029.8688079144,
+ 162056.62020507001,
+ 162083.37270626382,
+ 162110.12631140469,
+ 162136.88102040152,
+ 162163.63683316324,
+ 162190.39374959879,
+ 162217.15176961714,
+ 162243.91089312723,
+ 162270.67112003808,
+ 162297.43245025873,
+ 162324.19488369819,
+ 162350.9584202655,
+ 162377.72305986975,
+ 162404.48880242003,
+ 162431.25564782543,
+ 162458.02359599507,
+ 162484.79264683815,
+ 162511.56280026378,
+ 162538.33405618116,
+ 162565.10641449949,
+ 162591.87987512801,
+ 162618.65443797593,
+ 162645.43010295252,
+ 162672.20686996708,
+ 162698.98473892888,
+ 162725.76370974723,
+ 162752.54378233149,
+ 162779.32495659095,
+ 162806.10723243505,
+ 162832.89060977317,
+ 162859.67508851466,
+ 162886.46066856899,
+ 162913.24734984562,
+ 162940.03513225398,
+ 162966.82401570358,
+ 162993.6140001039,
+ 163020.40508536444,
+ 163047.19727139481,
+ 163073.99055810447,
+ 163100.78494540305,
+ 163127.58043320014,
+ 163154.37702140535,
+ 163181.17470992831,
+ 163207.97349867865,
+ 163234.77338756606,
+ 163261.57437650024,
+ 163288.37646539087,
+ 163315.17965414765,
+ 163341.98394268038,
+ 163368.78933089875,
+ 163395.59581871261,
+ 163422.40340603172,
+ 163449.2120927659,
+ 163476.02187882498,
+ 163502.83276411882,
+ 163529.6447485573,
+ 163556.45783205028,
+ 163583.2720145077,
+ 163610.08729583945,
+ 163636.90367595552,
+ 163663.72115476584,
+ 163690.53973218042,
+ 163717.35940810922,
+ 163744.18018246227,
+ 163771.00205514964,
+ 163797.82502608138,
+ 163824.64909516752,
+ 163851.4742623182,
+ 163878.3005274435,
+ 163905.12789045356,
+ 163931.95635125853,
+ 163958.78590976857,
+ 163985.61656589387,
+ 164012.44831954464,
+ 164039.28117063109,
+ 164066.11511906344,
+ 164092.95016475199,
+ 164119.78630760699,
+ 164146.62354753874,
+ 164173.46188445756,
+ 164200.30131827376,
+ 164227.14184889771,
+ 164253.98347623978,
+ 164280.82620021031,
+ 164307.67002071979,
+ 164334.51493767856,
+ 164361.3609509971,
+ 164388.20806058586,
+ 164415.05626635533,
+ 164441.905568216,
+ 164468.75596607837,
+ 164495.607459853,
+ 164522.4600494504,
+ 164549.31373478117,
+ 164576.16851575591,
+ 164603.02439228518,
+ 164629.88136427966,
+ 164656.73943164994,
+ 164683.59859430668,
+ 164710.45885216061,
+ 164737.32020512238,
+ 164764.1826531027,
+ 164791.04619601235,
+ 164817.91083376206,
+ 164844.77656626256,
+ 164871.64339342469,
+ 164898.51131515924,
+ 164925.38033137703,
+ 164952.25044198887,
+ 164979.1216469057,
+ 165005.9939460383,
+ 165032.86733929763,
+ 165059.7418265946,
+ 165086.61740784015,
+ 165113.4940829452
+};
#else
@@ -8252,8203 +8252,8203 @@ extern "C" {
#define IQ_TABLE_SIZE 1026
#endif
- ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
- {
- REAL_CONST(0.0),
- REAL_CONST(1.0 / 8.0),
- REAL_CONST(2.5198420997897464 / 8.0),
- REAL_CONST(4.3267487109222245 / 8.0),
- REAL_CONST(6.3496042078727974 / 8.0),
- REAL_CONST(8.5498797333834844 / 8.0),
- REAL_CONST(10.902723556992836 / 8.0),
- REAL_CONST(13.390518279406722 / 8.0),
- REAL_CONST(15.999999999999998 / 8.0),
- REAL_CONST(18.720754407467133 / 8.0),
- REAL_CONST(21.544346900318832 / 8.0),
- REAL_CONST(24.463780996262464 / 8.0),
- REAL_CONST(27.47314182127996 / 8.0),
- REAL_CONST(30.567350940369842 / 8.0),
- REAL_CONST(33.741991698453212 / 8.0),
- REAL_CONST(36.993181114957046 / 8.0),
- REAL_CONST(40.317473596635935 / 8.0),
- REAL_CONST(43.711787041189993 / 8.0),
- REAL_CONST(47.173345095760126 / 8.0),
- REAL_CONST(50.699631325716943 / 8.0),
- REAL_CONST(54.288352331898118 / 8.0),
- REAL_CONST(57.937407704003519 / 8.0),
- REAL_CONST(61.6448652744185 / 8.0),
- REAL_CONST(65.408940536585988 / 8.0),
- REAL_CONST(69.227979374755591 / 8.0),
- REAL_CONST(73.100443455321638 / 8.0),
- REAL_CONST(77.024897778591622 / 8.0),
- REAL_CONST(80.999999999999986 / 8.0),
- REAL_CONST(85.024491212518527 / 8.0),
- REAL_CONST(89.097187944889555 / 8.0),
- REAL_CONST(93.216975178615741 / 8.0),
- REAL_CONST(97.382800224133163 / 8.0),
- REAL_CONST(101.59366732596474 / 8.0),
- REAL_CONST(105.84863288986224 / 8.0),
- REAL_CONST(110.14680124343441 / 8.0),
- REAL_CONST(114.4873208566006 / 8.0),
- REAL_CONST(118.86938096020653 / 8.0),
- REAL_CONST(123.29220851090024 / 8.0),
- REAL_CONST(127.75506545836058 / 8.0),
- REAL_CONST(132.25724627755247 / 8.0),
- REAL_CONST(136.79807573413572 / 8.0),
- REAL_CONST(141.37690685569191 / 8.0),
- REAL_CONST(145.99311908523086 / 8.0),
- REAL_CONST(150.6461165966291 / 8.0),
- REAL_CONST(155.33532675434674 / 8.0),
- REAL_CONST(160.06019870205279 / 8.0),
- REAL_CONST(164.82020206673349 / 8.0),
- REAL_CONST(169.61482576651861 / 8.0),
- REAL_CONST(174.44357691188537 / 8.0),
- REAL_CONST(179.30597979112557 / 8.0),
- REAL_CONST(184.20157493201927 / 8.0),
- REAL_CONST(189.12991823257562 / 8.0),
- REAL_CONST(194.09058015449685 / 8.0),
- REAL_CONST(199.08314497371677 / 8.0),
- REAL_CONST(204.1072100829694 / 8.0),
- REAL_CONST(209.16238534187647 / 8.0),
- REAL_CONST(214.24829247050752 / 8.0),
- REAL_CONST(219.36456448277784 / 8.0),
- REAL_CONST(224.51084515641216 / 8.0),
- REAL_CONST(229.6867885365223 / 8.0),
- REAL_CONST(234.89205847013176 / 8.0),
- REAL_CONST(240.12632816923249 / 8.0),
- REAL_CONST(245.38927980018505 / 8.0),
- REAL_CONST(250.68060409747261 / 8.0),
- REAL_CONST(255.99999999999991 / 8.0),
- REAL_CONST(261.34717430828869 / 8.0),
- REAL_CONST(266.72184136106449 / 8.0),
- REAL_CONST(272.12372272986045 / 8.0),
- REAL_CONST(277.55254693037961 / 8.0),
- REAL_CONST(283.0080491494619 / 8.0),
- REAL_CONST(288.48997098659891 / 8.0),
- REAL_CONST(293.99806020902247 / 8.0),
- REAL_CONST(299.53207051947408 / 8.0),
- REAL_CONST(305.0917613358298 / 8.0),
- REAL_CONST(310.67689758182206 / 8.0),
- REAL_CONST(316.28724948815585 / 8.0),
- REAL_CONST(321.92259240337177 / 8.0),
- REAL_CONST(327.58270661385535 / 8.0),
- REAL_CONST(333.26737717243742 / 8.0),
- REAL_CONST(338.97639373507025 / 8.0),
- REAL_CONST(344.70955040510125 / 8.0),
- REAL_CONST(350.46664558470013 / 8.0),
- REAL_CONST(356.24748183302603 / 8.0),
- REAL_CONST(362.05186573075139 / 8.0),
- REAL_CONST(367.87960775058258 / 8.0),
- REAL_CONST(373.73052213344511 / 8.0),
- REAL_CONST(379.60442677002078 / 8.0),
- REAL_CONST(385.50114308734607 / 8.0),
- REAL_CONST(391.42049594019937 / 8.0),
- REAL_CONST(397.36231350702371 / 8.0),
- REAL_CONST(403.32642719014467 / 8.0),
- REAL_CONST(409.31267152006262 / 8.0),
- REAL_CONST(415.32088406360799 / 8.0),
- REAL_CONST(421.35090533576471 / 8.0),
- REAL_CONST(427.40257871497619 / 8.0),
- REAL_CONST(433.4757503617617 / 8.0),
- REAL_CONST(439.5702691404793 / 8.0),
- REAL_CONST(445.68598654408271 / 8.0),
- REAL_CONST(451.82275662172759 / 8.0),
- REAL_CONST(457.98043590909128 / 8.0),
- REAL_CONST(464.15888336127773 / 8.0),
- REAL_CONST(470.35796028818726 / 8.0),
- REAL_CONST(476.5775302922363 / 8.0),
- REAL_CONST(482.81745920832043 / 8.0),
- REAL_CONST(489.07761504591741 / 8.0),
- REAL_CONST(495.35786793323581 / 8.0),
- REAL_CONST(501.65809006331688 / 8.0),
- REAL_CONST(507.97815564200368 / 8.0),
- REAL_CONST(514.31794083769648 / 8.0),
- REAL_CONST(520.67732373281672 / 8.0),
- REAL_CONST(527.05618427690604 / 8.0),
- REAL_CONST(533.45440424129174 / 8.0),
- REAL_CONST(539.87186717525128 / 8.0),
- REAL_CONST(546.30845836361505 / 8.0),
- REAL_CONST(552.76406478574609 / 8.0),
- REAL_CONST(559.23857507584194 / 8.0),
- REAL_CONST(565.73187948450413 / 8.0),
- REAL_CONST(572.24386984152341 / 8.0),
- REAL_CONST(578.77443951983378 / 8.0),
- REAL_CONST(585.32348340058843 / 8.0),
- REAL_CONST(591.89089783931263 / 8.0),
- REAL_CONST(598.47658063309257 / 8.0),
- REAL_CONST(605.08043098876044 / 8.0),
- REAL_CONST(611.70234949203643 / 8.0),
- REAL_CONST(618.3422380775919 / 8.0),
- REAL_CONST(624.99999999999977 / 8.0),
- REAL_CONST(631.67553980553748 / 8.0),
- REAL_CONST(638.36876330481164 / 8.0),
- REAL_CONST(645.07957754617485 / 8.0),
- REAL_CONST(651.80789078990415 / 8.0),
- REAL_CONST(658.55361248311499 / 8.0),
- REAL_CONST(665.31665323538357 / 8.0),
- REAL_CONST(672.09692479505225 / 8.0),
- REAL_CONST(678.8943400261943 / 8.0),
- REAL_CONST(685.70881288621433 / 8.0),
- REAL_CONST(692.540258404062 / 8.0),
- REAL_CONST(699.38859265903977 / 8.0),
- REAL_CONST(706.25373276018058 / 8.0),
- REAL_CONST(713.13559682617972 / 8.0),
- REAL_CONST(720.03410396586037 / 8.0),
- REAL_CONST(726.94917425915435 / 8.0),
- REAL_CONST(733.88072873858209 / 8.0),
- REAL_CONST(740.82868937121543 / 8.0),
- REAL_CONST(747.79297904110535 / 8.0),
- REAL_CONST(754.77352153216191 / 8.0),
- REAL_CONST(761.77024151147043 / 8.0),
- REAL_CONST(768.78306451302956 / 8.0),
- REAL_CONST(775.81191692189896 / 8.0),
- REAL_CONST(782.85672595874246 / 8.0),
- REAL_CONST(789.91741966475445 / 8.0),
- REAL_CONST(796.99392688695798 / 8.0),
- REAL_CONST(804.08617726386274 / 8.0),
- REAL_CONST(811.19410121147098 / 8.0),
- REAL_CONST(818.31762990962227 / 8.0),
- REAL_CONST(825.45669528866563 / 8.0),
- REAL_CONST(832.61123001644864 / 8.0),
- REAL_CONST(839.78116748561604 / 8.0),
- REAL_CONST(846.96644180120552 / 8.0),
- REAL_CONST(854.16698776853514 / 8.0),
- REAL_CONST(861.38274088137143 / 8.0),
- REAL_CONST(868.61363731036977 / 8.0),
- REAL_CONST(875.85961389178203 / 8.0),
- REAL_CONST(883.12060811641959 / 8.0),
- REAL_CONST(890.39655811886757 / 8.0),
- REAL_CONST(897.68740266694181 / 8.0),
- REAL_CONST(904.99308115138172 / 8.0),
- REAL_CONST(912.31353357577188 / 8.0),
- REAL_CONST(919.64870054668756 / 8.0),
- REAL_CONST(926.99852326405619 / 8.0),
- REAL_CONST(934.36294351172899 / 8.0),
- REAL_CONST(941.74190364825859 / 8.0),
- REAL_CONST(949.13534659787422 / 8.0),
- REAL_CONST(956.54321584165211 / 8.0),
- REAL_CONST(963.96545540887348 / 8.0),
- REAL_CONST(971.40200986856541 / 8.0),
- REAL_CONST(978.85282432122176 / 8.0),
- REAL_CONST(986.31784439069588 / 8.0),
- REAL_CONST(993.7970162162635 / 8.0),
- REAL_CONST(1001.29028644485 / 8.0),
- REAL_CONST(1008.797602223418 / 8.0),
- REAL_CONST(1016.3189111915103 / 8.0),
- REAL_CONST(1023.8541614739464 / 8.0),
- REAL_CONST(1031.4033016736653 / 8.0),
- REAL_CONST(1038.9662808647138 / 8.0),
- REAL_CONST(1046.5430485853758 / 8.0),
- REAL_CONST(1054.1335548314366 / 8.0),
- REAL_CONST(1061.7377500495838 / 8.0),
- REAL_CONST(1069.3555851309357 / 8.0),
- REAL_CONST(1076.9870114046978 / 8.0),
- REAL_CONST(1084.6319806319441 / 8.0),
- REAL_CONST(1092.2904449995174 / 8.0),
- REAL_CONST(1099.9623571140482 / 8.0),
- REAL_CONST(1107.6476699960892 / 8.0),
- REAL_CONST(1115.3463370743607 / 8.0),
- REAL_CONST(1123.058312180106 / 8.0),
- REAL_CONST(1130.7835495415541 / 8.0),
- REAL_CONST(1138.5220037784854 / 8.0),
- REAL_CONST(1146.273629896901 / 8.0),
- REAL_CONST(1154.0383832837879 / 8.0),
- REAL_CONST(1161.816219701986 / 8.0),
- REAL_CONST(1169.607095285146 / 8.0),
- REAL_CONST(1177.4109665327808 / 8.0),
- REAL_CONST(1185.2277903054078 / 8.0),
- REAL_CONST(1193.0575238197798 / 8.0),
- REAL_CONST(1200.9001246442001 / 8.0),
- REAL_CONST(1208.7555506939248 / 8.0),
- REAL_CONST(1216.6237602266442 / 8.0),
- REAL_CONST(1224.5047118380478 / 8.0),
- REAL_CONST(1232.3983644574657 / 8.0),
- REAL_CONST(1240.3046773435874 / 8.0),
- REAL_CONST(1248.2236100802568 / 8.0),
- REAL_CONST(1256.1551225723395 / 8.0),
- REAL_CONST(1264.099175041662 / 8.0),
- REAL_CONST(1272.0557280230228 / 8.0),
- REAL_CONST(1280.0247423602691 / 8.0),
- REAL_CONST(1288.0061792024444 / 8.0),
- REAL_CONST(1295.9999999999995 / 8.0),
- REAL_CONST(1304.006166501068 / 8.0),
- REAL_CONST(1312.0246407478062 / 8.0),
- REAL_CONST(1320.0553850727929 / 8.0),
- REAL_CONST(1328.0983620954903 / 8.0),
- REAL_CONST(1336.1535347187651 / 8.0),
- REAL_CONST(1344.2208661254647 / 8.0),
- REAL_CONST(1352.3003197750522 / 8.0),
- REAL_CONST(1360.3918594002962 / 8.0),
- REAL_CONST(1368.4954490040145 / 8.0),
- REAL_CONST(1376.6110528558709 / 8.0),
- REAL_CONST(1384.7386354892244 / 8.0),
- REAL_CONST(1392.8781616980295 / 8.0),
- REAL_CONST(1401.0295965337855 / 8.0),
- REAL_CONST(1409.1929053025353 / 8.0),
- REAL_CONST(1417.3680535619119 / 8.0),
- REAL_CONST(1425.5550071182327 / 8.0),
- REAL_CONST(1433.7537320236374 / 8.0),
- REAL_CONST(1441.9641945732744 / 8.0),
- REAL_CONST(1450.1863613025282 / 8.0),
- REAL_CONST(1458.4201989842913 / 8.0),
- REAL_CONST(1466.6656746262797 / 8.0),
- REAL_CONST(1474.9227554683875 / 8.0),
- REAL_CONST(1483.1914089800841 / 8.0),
- REAL_CONST(1491.4716028578516 / 8.0),
- REAL_CONST(1499.7633050226596 / 8.0),
- REAL_CONST(1508.0664836174794 / 8.0),
- REAL_CONST(1516.3811070048375 / 8.0),
- REAL_CONST(1524.7071437644029 / 8.0),
- REAL_CONST(1533.0445626906128 / 8.0),
- REAL_CONST(1541.3933327903342 / 8.0),
- REAL_CONST(1549.7534232805581 / 8.0),
- REAL_CONST(1558.1248035861302 / 8.0),
- REAL_CONST(1566.507443337515 / 8.0),
- REAL_CONST(1574.9013123685909 / 8.0),
- REAL_CONST(1583.3063807144795 / 8.0),
- REAL_CONST(1591.7226186094069 / 8.0),
- REAL_CONST(1600.1499964845941 / 8.0),
- REAL_CONST(1608.58848496618 / 8.0),
- REAL_CONST(1617.0380548731737 / 8.0),
- REAL_CONST(1625.4986772154357 / 8.0),
- REAL_CONST(1633.9703231916887 / 8.0),
- REAL_CONST(1642.4529641875577 / 8.0),
- REAL_CONST(1650.9465717736346 / 8.0),
- REAL_CONST(1659.4511177035752 / 8.0),
- REAL_CONST(1667.9665739122186 / 8.0),
- REAL_CONST(1676.4929125137353 / 8.0),
- REAL_CONST(1685.030105799801 / 8.0),
- REAL_CONST(1693.5781262377957 / 8.0),
- REAL_CONST(1702.136946469027 / 8.0),
- REAL_CONST(1710.7065393069795 / 8.0),
- REAL_CONST(1719.2868777355877 / 8.0),
- REAL_CONST(1727.8779349075323 / 8.0),
- REAL_CONST(1736.4796841425596 / 8.0),
- REAL_CONST(1745.092098925825 / 8.0),
- REAL_CONST(1753.7151529062583 / 8.0),
- REAL_CONST(1762.3488198949503 / 8.0),
- REAL_CONST(1770.9930738635628 / 8.0),
- REAL_CONST(1779.6478889427597 / 8.0),
- REAL_CONST(1788.3132394206564 / 8.0),
- REAL_CONST(1796.9890997412947 / 8.0),
- REAL_CONST(1805.6754445031333 / 8.0),
- REAL_CONST(1814.3722484575621 / 8.0),
- REAL_CONST(1823.0794865074322 / 8.0),
- REAL_CONST(1831.7971337056094 / 8.0),
- REAL_CONST(1840.5251652535437 / 8.0),
- REAL_CONST(1849.2635564998579 / 8.0),
- REAL_CONST(1858.0122829389563 / 8.0),
- REAL_CONST(1866.7713202096493 / 8.0),
- REAL_CONST(1875.5406440937966 / 8.0),
- REAL_CONST(1884.3202305149687 / 8.0),
- REAL_CONST(1893.110055537124 / 8.0),
- REAL_CONST(1901.9100953633042 / 8.0),
- REAL_CONST(1910.7203263343454 / 8.0),
- REAL_CONST(1919.5407249276057 / 8.0),
- REAL_CONST(1928.3712677557098 / 8.0),
- REAL_CONST(1937.2119315653083 / 8.0),
- REAL_CONST(1946.0626932358525 / 8.0),
- REAL_CONST(1954.923529778386 / 8.0),
- REAL_CONST(1963.79441833435 / 8.0),
- REAL_CONST(1972.6753361744036 / 8.0),
- REAL_CONST(1981.5662606972594 / 8.0),
- REAL_CONST(1990.467169428533 / 8.0),
- REAL_CONST(1999.3780400196069 / 8.0),
- REAL_CONST(2008.2988502465078 / 8.0),
- REAL_CONST(2017.2295780087982 / 8.0),
- REAL_CONST(2026.1702013284819 / 8.0),
- REAL_CONST(2035.1206983489212 / 8.0),
- REAL_CONST(2044.0810473337688 / 8.0),
- REAL_CONST(2053.0512266659125 / 8.0),
- REAL_CONST(2062.0312148464309 / 8.0),
- REAL_CONST(2071.0209904935646 / 8.0),
- REAL_CONST(2080.0205323416958 / 8.0),
- REAL_CONST(2089.0298192403443 / 8.0),
- REAL_CONST(2098.0488301531714 / 8.0),
- REAL_CONST(2107.0775441569995 / 8.0),
- REAL_CONST(2116.115940440839 / 8.0),
- REAL_CONST(2125.1639983049317 / 8.0),
- REAL_CONST(2134.2216971597995 / 8.0),
- REAL_CONST(2143.2890165253098 / 8.0),
- REAL_CONST(2152.3659360297484 / 8.0),
- REAL_CONST(2161.4524354089031 / 8.0),
- REAL_CONST(2170.5484945051617 / 8.0),
- REAL_CONST(2179.6540932666144 / 8.0),
- REAL_CONST(2188.7692117461711 / 8.0),
- REAL_CONST(2197.8938301006888 / 8.0),
- REAL_CONST(2207.0279285901042 / 8.0),
- REAL_CONST(2216.1714875765838 / 8.0),
- REAL_CONST(2225.324487523676 / 8.0),
- REAL_CONST(2234.4869089954782 / 8.0),
- REAL_CONST(2243.6587326558101 / 8.0),
- REAL_CONST(2252.8399392673982 / 8.0),
- REAL_CONST(2262.0305096910702 / 8.0),
- REAL_CONST(2271.2304248849537 / 8.0),
- REAL_CONST(2280.4396659036897 / 8.0),
- REAL_CONST(2289.6582138976523 / 8.0),
- REAL_CONST(2298.8860501121762 / 8.0),
- REAL_CONST(2308.1231558867926 / 8.0),
- REAL_CONST(2317.3695126544767 / 8.0),
- REAL_CONST(2326.6251019409005 / 8.0),
- REAL_CONST(2335.8899053636933 / 8.0),
- REAL_CONST(2345.1639046317132 / 8.0),
- REAL_CONST(2354.4470815443233 / 8.0),
- REAL_CONST(2363.7394179906792 / 8.0),
- REAL_CONST(2373.0408959490205 / 8.0),
- REAL_CONST(2382.3514974859731 / 8.0),
- REAL_CONST(2391.6712047558558 / 8.0),
- REAL_CONST(2400.9999999999991 / 8.0),
- REAL_CONST(2410.3378655460651 / 8.0),
- REAL_CONST(2419.6847838073813 / 8.0),
- REAL_CONST(2429.0407372822747 / 8.0),
- REAL_CONST(2438.4057085534191 / 8.0),
- REAL_CONST(2447.7796802871858 / 8.0),
- REAL_CONST(2457.1626352330004 / 8.0),
- REAL_CONST(2466.5545562227112 / 8.0),
- REAL_CONST(2475.9554261699564 / 8.0),
- REAL_CONST(2485.3652280695474 / 8.0),
- REAL_CONST(2494.7839449968492 / 8.0),
- REAL_CONST(2504.2115601071737 / 8.0),
- REAL_CONST(2513.6480566351788 / 8.0),
- REAL_CONST(2523.0934178942675 / 8.0),
- REAL_CONST(2532.5476272760025 / 8.0),
- REAL_CONST(2542.0106682495189 / 8.0),
- REAL_CONST(2551.482524360948 / 8.0),
- REAL_CONST(2560.9631792328441 / 8.0),
- REAL_CONST(2570.4526165636184 / 8.0),
- REAL_CONST(2579.9508201269791 / 8.0),
- REAL_CONST(2589.4577737713744 / 8.0),
- REAL_CONST(2598.9734614194458 / 8.0),
- REAL_CONST(2608.4978670674823 / 8.0),
- REAL_CONST(2618.0309747848837 / 8.0),
- REAL_CONST(2627.5727687136259 / 8.0),
- REAL_CONST(2637.1232330677353 / 8.0),
- REAL_CONST(2646.6823521327647 / 8.0),
- REAL_CONST(2656.2501102652768 / 8.0),
- REAL_CONST(2665.8264918923328 / 8.0),
- REAL_CONST(2675.4114815109842 / 8.0),
- REAL_CONST(2685.0050636877722 / 8.0),
- REAL_CONST(2694.6072230582295 / 8.0),
- REAL_CONST(2704.2179443263894 / 8.0),
- REAL_CONST(2713.8372122642972 / 8.0),
- REAL_CONST(2723.4650117115279 / 8.0),
- REAL_CONST(2733.1013275747096 / 8.0),
- REAL_CONST(2742.7461448270483 / 8.0),
- REAL_CONST(2752.3994485078601 / 8.0),
- REAL_CONST(2762.0612237221085 / 8.0),
- REAL_CONST(2771.7314556399419 / 8.0),
- REAL_CONST(2781.4101294962406 / 8.0),
- REAL_CONST(2791.0972305901655 / 8.0),
- REAL_CONST(2800.7927442847094 / 8.0),
- REAL_CONST(2810.4966560062589 / 8.0),
- REAL_CONST(2820.2089512441521 / 8.0),
- REAL_CONST(2829.9296155502466 / 8.0),
- REAL_CONST(2839.6586345384894 / 8.0),
- REAL_CONST(2849.3959938844923 / 8.0),
- REAL_CONST(2859.1416793251065 / 8.0),
- REAL_CONST(2868.8956766580086 / 8.0),
- REAL_CONST(2878.6579717412847 / 8.0),
- REAL_CONST(2888.4285504930212 / 8.0),
- REAL_CONST(2898.2073988908974 / 8.0),
- REAL_CONST(2907.9945029717837 / 8.0),
- REAL_CONST(2917.789848831344 / 8.0),
- REAL_CONST(2927.5934226236377 / 8.0),
- REAL_CONST(2937.4052105607311 / 8.0),
- REAL_CONST(2947.2251989123079 / 8.0),
- REAL_CONST(2957.0533740052865 / 8.0),
- REAL_CONST(2966.8897222234368 / 8.0),
- REAL_CONST(2976.734230007005 / 8.0),
- REAL_CONST(2986.5868838523397 / 8.0),
- REAL_CONST(2996.4476703115197 / 8.0),
- REAL_CONST(3006.3165759919889 / 8.0),
- REAL_CONST(3016.1935875561908 / 8.0),
- REAL_CONST(3026.0786917212095 / 8.0),
- REAL_CONST(3035.9718752584108 / 8.0),
- REAL_CONST(3045.8731249930906 / 8.0),
- REAL_CONST(3055.7824278041207 / 8.0),
- REAL_CONST(3065.6997706236039 / 8.0),
- REAL_CONST(3075.625140436528 / 8.0),
- REAL_CONST(3085.5585242804245 / 8.0),
- REAL_CONST(3095.4999092450298 / 8.0),
- REAL_CONST(3105.4492824719491 / 8.0),
- REAL_CONST(3115.4066311543256 / 8.0),
- REAL_CONST(3125.3719425365089 / 8.0),
- REAL_CONST(3135.3452039137287 / 8.0),
- REAL_CONST(3145.3264026317715 / 8.0),
- REAL_CONST(3155.3155260866592 / 8.0),
- REAL_CONST(3165.3125617243295 / 8.0),
- REAL_CONST(3175.3174970403229 / 8.0),
- REAL_CONST(3185.3303195794679 / 8.0),
- REAL_CONST(3195.35101693557 / 8.0),
- REAL_CONST(3205.3795767511078 / 8.0),
- REAL_CONST(3215.4159867169251 / 8.0),
- REAL_CONST(3225.460234571929 / 8.0),
- REAL_CONST(3235.5123081027928 / 8.0),
- REAL_CONST(3245.5721951436558 / 8.0),
- REAL_CONST(3255.63988357583 / 8.0),
- REAL_CONST(3265.7153613275095 / 8.0),
- REAL_CONST(3275.7986163734795 / 8.0),
- REAL_CONST(3285.8896367348289 / 8.0),
- REAL_CONST(3295.9884104786665 / 8.0),
- REAL_CONST(3306.0949257178395 / 8.0),
- REAL_CONST(3316.2091706106517 / 8.0),
- REAL_CONST(3326.331133360588 / 8.0),
- REAL_CONST(3336.4608022160378 / 8.0),
- REAL_CONST(3346.5981654700231 / 8.0),
- REAL_CONST(3356.7432114599264 / 8.0),
- REAL_CONST(3366.8959285672249 / 8.0),
- REAL_CONST(3377.0563052172211 / 8.0),
- REAL_CONST(3387.2243298787821 / 8.0),
- REAL_CONST(3397.3999910640764 / 8.0),
- REAL_CONST(3407.5832773283128 / 8.0),
- REAL_CONST(3417.7741772694862 / 8.0),
- REAL_CONST(3427.9726795281199 / 8.0),
- REAL_CONST(3438.1787727870123 / 8.0),
- REAL_CONST(3448.3924457709873 / 8.0),
- REAL_CONST(3458.6136872466445 / 8.0),
- REAL_CONST(3468.8424860221107 / 8.0),
- REAL_CONST(3479.0788309467976 / 8.0),
- REAL_CONST(3489.3227109111554 / 8.0),
- REAL_CONST(3499.5741148464344 / 8.0),
- REAL_CONST(3509.8330317244445 / 8.0),
- REAL_CONST(3520.0994505573185 / 8.0),
- REAL_CONST(3530.3733603972751 / 8.0),
- REAL_CONST(3540.6547503363886 / 8.0),
- REAL_CONST(3550.9436095063534 / 8.0),
- REAL_CONST(3561.239927078258 / 8.0),
- REAL_CONST(3571.5436922623535 / 8.0),
- REAL_CONST(3581.8548943078308 / 8.0),
- REAL_CONST(3592.1735225025936 / 8.0),
- REAL_CONST(3602.4995661730372 / 8.0),
- REAL_CONST(3612.8330146838275 / 8.0),
- REAL_CONST(3623.1738574376814 / 8.0),
- REAL_CONST(3633.5220838751502 / 8.0),
- REAL_CONST(3643.8776834744031 / 8.0),
- REAL_CONST(3654.2406457510142 / 8.0),
- REAL_CONST(3664.6109602577494 / 8.0),
- REAL_CONST(3674.9886165843564 / 8.0),
- REAL_CONST(3685.3736043573545 / 8.0),
- REAL_CONST(3695.7659132398294 / 8.0),
- REAL_CONST(3706.1655329312248 / 8.0),
- REAL_CONST(3716.5724531671399 / 8.0),
- REAL_CONST(3726.9866637191262 / 8.0),
- REAL_CONST(3737.4081543944876 / 8.0),
- REAL_CONST(3747.8369150360782 / 8.0),
- REAL_CONST(3758.2729355221072 / 8.0),
- REAL_CONST(3768.7162057659411 / 8.0),
- REAL_CONST(3779.1667157159077 / 8.0),
- REAL_CONST(3789.6244553551055 / 8.0),
- REAL_CONST(3800.0894147012082 / 8.0),
- REAL_CONST(3810.5615838062768 / 8.0),
- REAL_CONST(3821.0409527565694 / 8.0),
- REAL_CONST(3831.5275116723533 / 8.0),
- REAL_CONST(3842.0212507077194 / 8.0),
- REAL_CONST(3852.522160050396 / 8.0),
- REAL_CONST(3863.0302299215673 / 8.0),
- REAL_CONST(3873.5454505756893 / 8.0),
- REAL_CONST(3884.0678123003108 / 8.0),
- REAL_CONST(3894.5973054158922 / 8.0),
- REAL_CONST(3905.1339202756285 / 8.0),
- REAL_CONST(3915.6776472652732 / 8.0),
- REAL_CONST(3926.2284768029604 / 8.0),
- REAL_CONST(3936.7863993390338 / 8.0),
- REAL_CONST(3947.3514053558706 / 8.0),
- REAL_CONST(3957.9234853677135 / 8.0),
- REAL_CONST(3968.5026299204969 / 8.0),
- REAL_CONST(3979.0888295916798 / 8.0),
- REAL_CONST(3989.6820749900776 / 8.0),
- REAL_CONST(4000.2823567556948 / 8.0),
- REAL_CONST(4010.8896655595613 / 8.0),
- REAL_CONST(4021.5039921035655 / 8.0),
- REAL_CONST(4032.1253271202945 / 8.0),
- REAL_CONST(4042.7536613728694 / 8.0),
- REAL_CONST(4053.3889856547858 / 8.0),
- REAL_CONST(4064.0312907897551 / 8.0),
- REAL_CONST(4074.6805676315448 / 8.0),
- REAL_CONST(4085.3368070638221 / 8.0),
- REAL_CONST(4095.9999999999982 / 8.0),
- REAL_CONST(4106.6701373830711 / 8.0),
- REAL_CONST(4117.347210185475 / 8.0),
- REAL_CONST(4128.0312094089259 / 8.0),
- REAL_CONST(4138.722126084268 / 8.0),
- REAL_CONST(4149.4199512713267 / 8.0),
- REAL_CONST(4160.1246760587583 / 8.0),
- REAL_CONST(4170.8362915638982 / 8.0),
- REAL_CONST(4181.5547889326181 / 8.0),
- REAL_CONST(4192.2801593391769 / 8.0),
- REAL_CONST(4203.0123939860741 / 8.0),
- REAL_CONST(4213.7514841039101 / 8.0),
- REAL_CONST(4224.4974209512384 / 8.0),
- REAL_CONST(4235.2501958144258 / 8.0),
- REAL_CONST(4246.0098000075095 / 8.0),
- REAL_CONST(4256.7762248720574 / 8.0),
- REAL_CONST(4267.549461777031 / 8.0),
- REAL_CONST(4278.3295021186423 / 8.0),
- REAL_CONST(4289.1163373202198 / 8.0),
- REAL_CONST(4299.9099588320714 / 8.0),
- REAL_CONST(4310.7103581313495 / 8.0),
- REAL_CONST(4321.5175267219138 / 8.0),
- REAL_CONST(4332.3314561342004 / 8.0),
- REAL_CONST(4343.152137925088 / 8.0),
- REAL_CONST(4353.9795636777671 / 8.0),
- REAL_CONST(4364.8137250016052 / 8.0),
- REAL_CONST(4375.6546135320223 / 8.0),
- REAL_CONST(4386.5022209303588 / 8.0),
- REAL_CONST(4397.3565388837469 / 8.0),
- REAL_CONST(4408.2175591049827 / 8.0),
- REAL_CONST(4419.0852733324018 / 8.0),
- REAL_CONST(4429.9596733297531 / 8.0),
- REAL_CONST(4440.8407508860728 / 8.0),
- REAL_CONST(4451.7284978155603 / 8.0),
- REAL_CONST(4462.6229059574571 / 8.0),
- REAL_CONST(4473.5239671759227 / 8.0),
- REAL_CONST(4484.4316733599126 / 8.0),
- REAL_CONST(4495.3460164230582 / 8.0),
- REAL_CONST(4506.2669883035496 / 8.0),
- REAL_CONST(4517.1945809640119 / 8.0),
- REAL_CONST(4528.1287863913894 / 8.0),
- REAL_CONST(4539.069596596828 / 8.0),
- REAL_CONST(4550.0170036155587 / 8.0),
- REAL_CONST(4560.9709995067806 / 8.0),
- REAL_CONST(4571.931576353546 / 8.0),
- REAL_CONST(4582.898726262647 / 8.0),
- REAL_CONST(4593.8724413645004 / 8.0),
- REAL_CONST(4604.8527138130348 / 8.0),
- REAL_CONST(4615.8395357855816 / 8.0),
- REAL_CONST(4626.8328994827571 / 8.0),
- REAL_CONST(4637.8327971283588 / 8.0),
- REAL_CONST(4648.8392209692511 / 8.0),
- REAL_CONST(4659.8521632752563 / 8.0),
- REAL_CONST(4670.8716163390473 / 8.0),
- REAL_CONST(4681.8975724760394 / 8.0),
- REAL_CONST(4692.9300240242837 / 8.0),
- REAL_CONST(4703.9689633443595 / 8.0),
- REAL_CONST(4715.0143828192668 / 8.0),
- REAL_CONST(4726.0662748543255 / 8.0),
- REAL_CONST(4737.1246318770682 / 8.0),
- REAL_CONST(4748.1894463371373 / 8.0),
- REAL_CONST(4759.2607107061804 / 8.0),
- REAL_CONST(4770.3384174777493 / 8.0),
- REAL_CONST(4781.4225591671993 / 8.0),
- REAL_CONST(4792.5131283115852 / 8.0),
- REAL_CONST(4803.6101174695614 / 8.0),
- REAL_CONST(4814.7135192212854 / 8.0),
- REAL_CONST(4825.8233261683154 / 8.0),
- REAL_CONST(4836.9395309335096 / 8.0),
- REAL_CONST(4848.0621261609349 / 8.0),
- REAL_CONST(4859.1911045157631 / 8.0),
- REAL_CONST(4870.3264586841779 / 8.0),
- REAL_CONST(4881.4681813732768 / 8.0),
- REAL_CONST(4892.6162653109768 / 8.0),
- REAL_CONST(4903.7707032459193 / 8.0),
- REAL_CONST(4914.931487947375 / 8.0),
- REAL_CONST(4926.0986122051509 / 8.0),
- REAL_CONST(4937.2720688294967 / 8.0),
- REAL_CONST(4948.4518506510112 / 8.0),
- REAL_CONST(4959.637950520555 / 8.0),
- REAL_CONST(4970.8303613091521 / 8.0),
- REAL_CONST(4982.0290759079044 / 8.0),
- REAL_CONST(4993.2340872278974 / 8.0),
- REAL_CONST(5004.4453882001153 / 8.0),
- REAL_CONST(5015.6629717753467 / 8.0),
- REAL_CONST(5026.8868309241007 / 8.0),
- REAL_CONST(5038.1169586365131 / 8.0),
- REAL_CONST(5049.353347922266 / 8.0),
- REAL_CONST(5060.5959918104927 / 8.0),
- REAL_CONST(5071.8448833496996 / 8.0),
- REAL_CONST(5083.1000156076734 / 8.0),
- REAL_CONST(5094.3613816713996 / 8.0),
- REAL_CONST(5105.6289746469747 / 8.0),
- REAL_CONST(5116.9027876595246 / 8.0),
- REAL_CONST(5128.18281385312 / 8.0),
- REAL_CONST(5139.4690463906918 / 8.0),
- REAL_CONST(5150.7614784539473 / 8.0),
- REAL_CONST(5162.0601032432933 / 8.0),
- REAL_CONST(5173.3649139777472 / 8.0),
- REAL_CONST(5184.6759038948594 / 8.0),
- REAL_CONST(5195.9930662506322 / 8.0),
- REAL_CONST(5207.3163943194386 / 8.0),
- REAL_CONST(5218.6458813939435 / 8.0),
- REAL_CONST(5229.9815207850224 / 8.0),
- REAL_CONST(5241.3233058216847 / 8.0),
- REAL_CONST(5252.6712298509919 / 8.0),
- REAL_CONST(5264.025286237983 / 8.0),
- REAL_CONST(5275.3854683655954 / 8.0),
- REAL_CONST(5286.7517696345885 / 8.0),
- REAL_CONST(5298.1241834634639 / 8.0),
- REAL_CONST(5309.5027032883945 / 8.0),
- REAL_CONST(5320.887322563146 / 8.0),
- REAL_CONST(5332.2780347589978 / 8.0),
- REAL_CONST(5343.6748333646756 / 8.0),
- REAL_CONST(5355.0777118862716 / 8.0),
- REAL_CONST(5366.4866638471722 / 8.0),
- REAL_CONST(5377.901682787985 / 8.0),
- REAL_CONST(5389.3227622664635 / 8.0),
- REAL_CONST(5400.749895857437 / 8.0),
- REAL_CONST(5412.1830771527357 / 8.0),
- REAL_CONST(5423.622299761123 / 8.0),
- REAL_CONST(5435.067557308219 / 8.0),
- REAL_CONST(5446.5188434364318 / 8.0),
- REAL_CONST(5457.9761518048872 / 8.0),
- REAL_CONST(5469.4394760893592 / 8.0),
- REAL_CONST(5480.9088099821975 / 8.0),
- REAL_CONST(5492.3841471922606 / 8.0),
- REAL_CONST(5503.8654814448455 / 8.0),
- REAL_CONST(5515.3528064816201 / 8.0),
- REAL_CONST(5526.846116060552 / 8.0),
- REAL_CONST(5538.3454039558474 / 8.0),
- REAL_CONST(5549.8506639578736 / 8.0),
- REAL_CONST(5561.3618898731029 / 8.0),
- REAL_CONST(5572.8790755240361 / 8.0),
- REAL_CONST(5584.4022147491451 / 8.0),
- REAL_CONST(5595.9313014027975 / 8.0),
- REAL_CONST(5607.4663293552012 / 8.0),
- REAL_CONST(5619.0072924923297 / 8.0),
- REAL_CONST(5630.5541847158656 / 8.0),
- REAL_CONST(5642.1069999431284 / 8.0),
- REAL_CONST(5653.665732107017 / 8.0),
- REAL_CONST(5665.230375155943 / 8.0),
- REAL_CONST(5676.8009230537655 / 8.0),
- REAL_CONST(5688.3773697797333 / 8.0),
- REAL_CONST(5699.9597093284156 / 8.0),
- REAL_CONST(5711.5479357096474 / 8.0),
- REAL_CONST(5723.1420429484588 / 8.0),
- REAL_CONST(5734.7420250850209 / 8.0),
- REAL_CONST(5746.347876174581 / 8.0),
- REAL_CONST(5757.9595902874016 / 8.0),
- REAL_CONST(5769.5771615087006 / 8.0),
- REAL_CONST(5781.2005839385911 / 8.0),
- REAL_CONST(5792.8298516920213 / 8.0),
- REAL_CONST(5804.4649588987149 / 8.0),
- REAL_CONST(5816.1058997031105 / 8.0),
- REAL_CONST(5827.7526682643065 / 8.0),
- REAL_CONST(5839.4052587559972 / 8.0),
- REAL_CONST(5851.0636653664196 / 8.0),
- REAL_CONST(5862.7278822982908 / 8.0),
- REAL_CONST(5874.3979037687541 / 8.0),
- REAL_CONST(5886.0737240093204 / 8.0),
- REAL_CONST(5897.7553372658094 / 8.0),
- REAL_CONST(5909.4427377982956 / 8.0),
- REAL_CONST(5921.1359198810505 / 8.0),
- REAL_CONST(5932.8348778024874 / 8.0),
- REAL_CONST(5944.5396058651031 / 8.0),
- REAL_CONST(5956.2500983854261 / 8.0),
- REAL_CONST(5967.9663496939575 / 8.0),
- REAL_CONST(5979.6883541351208 / 8.0),
- REAL_CONST(5991.4161060672022 / 8.0),
- REAL_CONST(6003.1495998623004 / 8.0),
- REAL_CONST(6014.8888299062692 / 8.0),
- REAL_CONST(6026.6337905986684 / 8.0),
- REAL_CONST(6038.3844763527022 / 8.0),
- REAL_CONST(6050.1408815951781 / 8.0),
- REAL_CONST(6061.9030007664414 / 8.0),
- REAL_CONST(6073.6708283203316 / 8.0),
- REAL_CONST(6085.4443587241267 / 8.0),
- REAL_CONST(6097.2235864584891 / 8.0),
- REAL_CONST(6109.0085060174197 / 8.0),
- REAL_CONST(6120.7991119081998 / 8.0),
- REAL_CONST(6132.595398651345 / 8.0),
- REAL_CONST(6144.3973607805519 / 8.0),
- REAL_CONST(6156.2049928426459 / 8.0),
- REAL_CONST(6168.0182893975361 / 8.0),
- REAL_CONST(6179.8372450181578 / 8.0),
- REAL_CONST(6191.6618542904307 / 8.0),
- REAL_CONST(6203.4921118132024 / 8.0),
- REAL_CONST(6215.3280121982016 / 8.0),
- REAL_CONST(6227.1695500699925 / 8.0),
- REAL_CONST(6239.0167200659189 / 8.0),
- REAL_CONST(6250.8695168360628 / 8.0),
- REAL_CONST(6262.7279350431891 / 8.0),
- REAL_CONST(6274.5919693627056 / 8.0),
- REAL_CONST(6286.4616144826068 / 8.0),
- REAL_CONST(6298.3368651034316 / 8.0),
- REAL_CONST(6310.2177159382172 / 8.0),
- REAL_CONST(6322.1041617124456 / 8.0),
- REAL_CONST(6333.9961971640032 / 8.0),
- REAL_CONST(6345.8938170431311 / 8.0),
- REAL_CONST(6357.7970161123785 / 8.0),
- REAL_CONST(6369.7057891465583 / 8.0),
- REAL_CONST(6381.6201309327007 / 8.0),
- REAL_CONST(6393.5400362700075 / 8.0),
- REAL_CONST(6405.4654999698032 / 8.0),
- REAL_CONST(6417.3965168554978 / 8.0),
- REAL_CONST(6429.3330817625329 / 8.0),
- REAL_CONST(6441.2751895383453 / 8.0),
- REAL_CONST(6453.2228350423138 / 8.0),
- REAL_CONST(6465.176013145724 / 8.0),
- REAL_CONST(6477.134718731716 / 8.0),
- REAL_CONST(6489.0989466952469 / 8.0),
- REAL_CONST(6501.0686919430445 / 8.0),
- REAL_CONST(6513.0439493935628 / 8.0),
- REAL_CONST(6525.0247139769417 / 8.0),
- REAL_CONST(6537.010980634961 / 8.0),
- REAL_CONST(6549.002744321001 / 8.0),
- REAL_CONST(6560.9999999999973 / 8.0),
- REAL_CONST(6573.0027426483985 / 8.0),
- REAL_CONST(6585.0109672541284 / 8.0),
- REAL_CONST(6597.0246688165371 / 8.0),
- REAL_CONST(6609.0438423463656 / 8.0),
- REAL_CONST(6621.0684828657004 / 8.0),
- REAL_CONST(6633.0985854079354 / 8.0),
- REAL_CONST(6645.134145017727 / 8.0),
- REAL_CONST(6657.1751567509573 / 8.0),
- REAL_CONST(6669.2216156746908 / 8.0),
- REAL_CONST(6681.2735168671343 / 8.0),
- REAL_CONST(6693.3308554176001 / 8.0),
- REAL_CONST(6705.3936264264594 / 8.0),
- REAL_CONST(6717.461825005108 / 8.0),
- REAL_CONST(6729.535446275926 / 8.0),
- REAL_CONST(6741.6144853722335 / 8.0),
- REAL_CONST(6753.6989374382601 / 8.0),
- REAL_CONST(6765.7887976290967 / 8.0),
- REAL_CONST(6777.8840611106634 / 8.0),
- REAL_CONST(6789.9847230596661 / 8.0),
- REAL_CONST(6802.0907786635626 / 8.0),
- REAL_CONST(6814.2022231205201 / 8.0),
- REAL_CONST(6826.3190516393797 / 8.0),
- REAL_CONST(6838.4412594396181 / 8.0),
- REAL_CONST(6850.5688417513074 / 8.0),
- REAL_CONST(6862.701793815083 / 8.0),
- REAL_CONST(6874.840110882099 / 8.0),
- REAL_CONST(6886.9837882139991 / 8.0),
- REAL_CONST(6899.1328210828724 / 8.0),
- REAL_CONST(6911.2872047712199 / 8.0),
- REAL_CONST(6923.4469345719199 / 8.0),
- REAL_CONST(6935.6120057881863 / 8.0),
- REAL_CONST(6947.7824137335365 / 8.0),
- REAL_CONST(6959.9581537317536 / 8.0),
- REAL_CONST(6972.1392211168532 / 8.0),
- REAL_CONST(6984.3256112330409 / 8.0),
- REAL_CONST(6996.5173194346862 / 8.0),
- REAL_CONST(7008.7143410862773 / 8.0),
- REAL_CONST(7020.9166715623942 / 8.0),
- REAL_CONST(7033.1243062476678 / 8.0),
- REAL_CONST(7045.3372405367481 / 8.0),
- REAL_CONST(7057.5554698342685 / 8.0),
- REAL_CONST(7069.7789895548103 / 8.0),
- REAL_CONST(7082.0077951228714 / 8.0),
- REAL_CONST(7094.2418819728273 / 8.0),
- REAL_CONST(7106.4812455489018 / 8.0),
- REAL_CONST(7118.7258813051285 / 8.0),
- REAL_CONST(7130.9757847053224 / 8.0),
- REAL_CONST(7143.2309512230404 / 8.0),
- REAL_CONST(7155.4913763415516 / 8.0),
- REAL_CONST(7167.7570555538041 / 8.0),
- REAL_CONST(7180.0279843623894 / 8.0),
- REAL_CONST(7192.3041582795131 / 8.0),
- REAL_CONST(7204.5855728269571 / 8.0),
- REAL_CONST(7216.8722235360519 / 8.0),
- REAL_CONST(7229.1641059476406 / 8.0),
- REAL_CONST(7241.4612156120484 / 8.0),
- REAL_CONST(7253.7635480890503 / 8.0),
- REAL_CONST(7266.0710989478375 / 8.0),
- REAL_CONST(7278.3838637669869 / 8.0),
- REAL_CONST(7290.7018381344296 / 8.0),
- REAL_CONST(7303.0250176474174 / 8.0),
- REAL_CONST(7315.3533979124932 / 8.0),
- REAL_CONST(7327.6869745454596 / 8.0),
- REAL_CONST(7340.0257431713462 / 8.0),
- REAL_CONST(7352.3696994243801 / 8.0),
- REAL_CONST(7364.7188389479543 / 8.0),
- REAL_CONST(7377.0731573945968 / 8.0),
- REAL_CONST(7389.4326504259407 / 8.0),
- REAL_CONST(7401.7973137126937 / 8.0),
- REAL_CONST(7414.1671429346061 / 8.0),
- REAL_CONST(7426.5421337804428 / 8.0),
- REAL_CONST(7438.922281947951 / 8.0),
- REAL_CONST(7451.3075831438346 / 8.0),
- REAL_CONST(7463.6980330837177 / 8.0),
- REAL_CONST(7476.0936274921214 / 8.0),
- REAL_CONST(7488.4943621024304 / 8.0),
- REAL_CONST(7500.9002326568652 / 8.0),
- REAL_CONST(7513.3112349064522 / 8.0),
- REAL_CONST(7525.7273646109943 / 8.0),
- REAL_CONST(7538.1486175390446 / 8.0),
- REAL_CONST(7550.5749894678729 / 8.0),
- REAL_CONST(7563.0064761834419 / 8.0),
- REAL_CONST(7575.4430734803736 / 8.0),
- REAL_CONST(7587.8847771619248 / 8.0),
- REAL_CONST(7600.3315830399597 / 8.0),
- REAL_CONST(7612.7834869349153 / 8.0),
- REAL_CONST(7625.24048467578 / 8.0),
- REAL_CONST(7637.7025721000637 / 8.0),
- REAL_CONST(7650.1697450537677 / 8.0),
- REAL_CONST(7662.6419993913596 / 8.0),
- REAL_CONST(7675.1193309757446 / 8.0),
- REAL_CONST(7687.6017356782404 / 8.0),
- REAL_CONST(7700.0892093785433 / 8.0),
- REAL_CONST(7712.5817479647112 / 8.0),
- REAL_CONST(7725.079347333125 / 8.0),
- REAL_CONST(7737.5820033884729 / 8.0),
- REAL_CONST(7750.0897120437139 / 8.0),
- REAL_CONST(7762.6024692200581 / 8.0),
- REAL_CONST(7775.1202708469355 / 8.0),
- REAL_CONST(7787.6431128619733 / 8.0),
- REAL_CONST(7800.1709912109645 / 8.0),
- REAL_CONST(7812.7039018478481 / 8.0),
- REAL_CONST(7825.2418407346768 / 8.0),
- REAL_CONST(7837.7848038415968 / 8.0),
- REAL_CONST(7850.3327871468155 / 8.0),
- REAL_CONST(7862.8857866365806 / 8.0),
- REAL_CONST(7875.4437983051539 / 8.0),
- REAL_CONST(7888.006818154784 / 8.0),
- REAL_CONST(7900.5748421956796 / 8.0),
- REAL_CONST(7913.1478664459901 / 8.0),
- REAL_CONST(7925.725886931772 / 8.0),
- REAL_CONST(7938.3088996869719 / 8.0),
- REAL_CONST(7950.8969007533951 / 8.0),
- REAL_CONST(7963.4898861806851 / 8.0),
- REAL_CONST(7976.0878520262959 / 8.0),
- REAL_CONST(7988.6907943554688 / 8.0),
- REAL_CONST(8001.2987092412086 / 8.0),
- REAL_CONST(8013.911592764257 / 8.0),
- REAL_CONST(8026.5294410130691 / 8.0),
- REAL_CONST(8039.1522500837891 / 8.0),
- REAL_CONST(8051.7800160802271 / 8.0),
- REAL_CONST(8064.412735113835 / 8.0),
- REAL_CONST(8077.0504033036796 / 8.0),
- REAL_CONST(8089.6930167764222 / 8.0),
- REAL_CONST(8102.3405716662946 / 8.0),
- REAL_CONST(8114.9930641150731 / 8.0),
- REAL_CONST(8127.6504902720571 / 8.0),
- REAL_CONST(8140.3128462940449 / 8.0),
- REAL_CONST(8152.9801283453098 / 8.0),
- REAL_CONST(8165.6523325975786 / 8.0),
- REAL_CONST(8178.3294552300049 / 8.0),
- REAL_CONST(8191.0114924291529 / 8.0),
- REAL_CONST(8203.6984403889655 / 8.0),
- REAL_CONST(8216.3902953107463 / 8.0),
- REAL_CONST(8229.0870534031419 / 8.0),
- REAL_CONST(8241.7887108821069 / 8.0),
- REAL_CONST(8254.4952639708936 / 8.0),
- REAL_CONST(8267.2067089000211 / 8.0),
- REAL_CONST(8279.9230419072574 / 8.0),
- REAL_CONST(8292.6442592375952 / 8.0),
- REAL_CONST(8305.3703571432306 / 8.0),
- REAL_CONST(8318.101331883543 / 8.0),
- REAL_CONST(8330.8371797250657 / 8.0),
- REAL_CONST(8343.577896941475 / 8.0),
- REAL_CONST(8356.3234798135582 / 8.0),
- REAL_CONST(8369.0739246291978 / 8.0),
- REAL_CONST(8381.8292276833508 / 8.0),
- REAL_CONST(8394.5893852780209 / 8.0),
- REAL_CONST(8407.3543937222421 / 8.0),
- REAL_CONST(8420.1242493320569 / 8.0),
- REAL_CONST(8432.8989484304948 / 8.0),
- REAL_CONST(8445.6784873475499 / 8.0),
- REAL_CONST(8458.4628624201578 / 8.0),
- REAL_CONST(8471.2520699921806 / 8.0),
- REAL_CONST(8484.0461064143838 / 8.0),
- REAL_CONST(8496.8449680444082 / 8.0),
- REAL_CONST(8509.6486512467636 / 8.0),
- REAL_CONST(8522.4571523927953 / 8.0),
- REAL_CONST(8535.270467860666 / 8.0),
- REAL_CONST(8548.0885940353437 / 8.0),
- REAL_CONST(8560.9115273085663 / 8.0),
- REAL_CONST(8573.7392640788403 / 8.0),
- REAL_CONST(8586.5718007514006 / 8.0),
- REAL_CONST(8599.4091337382069 / 8.0),
- REAL_CONST(8612.2512594579148 / 8.0),
- REAL_CONST(8625.0981743358552 / 8.0),
- REAL_CONST(8637.9498748040205 / 8.0),
- REAL_CONST(8650.8063573010386 / 8.0),
- REAL_CONST(8663.6676182721567 / 8.0),
- REAL_CONST(8676.533654169225 / 8.0),
- REAL_CONST(8689.4044614506638 / 8.0),
- REAL_CONST(8702.2800365814601 / 8.0),
- REAL_CONST(8715.1603760331418 / 8.0),
- REAL_CONST(8728.0454762837508 / 8.0),
- REAL_CONST(8740.9353338178389 / 8.0),
- REAL_CONST(8753.8299451264356 / 8.0),
- REAL_CONST(8766.7293067070332 / 8.0),
- REAL_CONST(8779.6334150635721 / 8.0),
- REAL_CONST(8792.5422667064158 / 8.0),
- REAL_CONST(8805.4558581523324 / 8.0),
- REAL_CONST(8818.3741859244819 / 8.0),
- REAL_CONST(8831.2972465523908 / 8.0),
- REAL_CONST(8844.2250365719356 / 8.0),
- REAL_CONST(8857.1575525253265 / 8.0),
- REAL_CONST(8870.0947909610859 / 8.0),
- REAL_CONST(8883.0367484340295 / 8.0),
- REAL_CONST(8895.9834215052524 / 8.0),
- REAL_CONST(8908.934806742107 / 8.0),
- REAL_CONST(8921.8909007181846 / 8.0),
- REAL_CONST(8934.8517000132997 / 8.0),
- REAL_CONST(8947.817201213471 / 8.0),
- REAL_CONST(8960.7874009109 / 8.0),
- REAL_CONST(8973.7622957039603 / 8.0),
- REAL_CONST(8986.7418821971733 / 8.0),
- REAL_CONST(8999.7261570011924 / 8.0),
- REAL_CONST(9012.7151167327884 / 8.0),
- REAL_CONST(9025.7087580148236 / 8.0),
- REAL_CONST(9038.7070774762469 / 8.0),
- REAL_CONST(9051.7100717520643 / 8.0),
- REAL_CONST(9064.7177374833282 / 8.0),
- REAL_CONST(9077.7300713171153 / 8.0),
- REAL_CONST(9090.7470699065179 / 8.0),
- REAL_CONST(9103.7687299106146 / 8.0),
- REAL_CONST(9116.7950479944648 / 8.0),
- REAL_CONST(9129.8260208290812 / 8.0),
- REAL_CONST(9142.8616450914233 / 8.0),
- REAL_CONST(9155.9019174643727 / 8.0),
- REAL_CONST(9168.9468346367157 / 8.0),
- REAL_CONST(9181.9963933031358 / 8.0),
- REAL_CONST(9195.0505901641845 / 8.0),
- REAL_CONST(9208.1094219262741 / 8.0),
- REAL_CONST(9221.1728853016557 / 8.0),
- REAL_CONST(9234.240977008405 / 8.0),
- REAL_CONST(9247.3136937704076 / 8.0),
- REAL_CONST(9260.3910323173386 / 8.0),
- REAL_CONST(9273.472989384647 / 8.0),
- REAL_CONST(9286.5595617135423 / 8.0),
- REAL_CONST(9299.6507460509747 / 8.0),
- REAL_CONST(9312.7465391496207 / 8.0),
- REAL_CONST(9325.8469377678684 / 8.0),
- REAL_CONST(9338.9519386698012 / 8.0),
- REAL_CONST(9352.0615386251757 / 8.0),
- REAL_CONST(9365.1757344094131 / 8.0),
- REAL_CONST(9378.2945228035842 / 8.0),
- REAL_CONST(9391.4179005943843 / 8.0),
- REAL_CONST(9404.5458645741273 / 8.0),
- REAL_CONST(9417.6784115407263 / 8.0),
- REAL_CONST(9430.8155382976747 / 8.0),
- REAL_CONST(9443.9572416540359 / 8.0),
- REAL_CONST(9457.1035184244265 / 8.0),
- REAL_CONST(9470.2543654290002 / 8.0),
- REAL_CONST(9483.4097794934296 / 8.0),
- REAL_CONST(9496.5697574488931 / 8.0),
- REAL_CONST(9509.7342961320664 / 8.0),
- REAL_CONST(9522.9033923850911 / 8.0),
- REAL_CONST(9536.0770430555804 / 8.0),
- REAL_CONST(9549.2552449965824 / 8.0),
- REAL_CONST(9562.4379950665825 / 8.0),
- REAL_CONST(9575.6252901294793 / 8.0),
- REAL_CONST(9588.8171270545736 / 8.0),
- REAL_CONST(9602.0135027165488 / 8.0),
- REAL_CONST(9615.2144139954635 / 8.0),
- REAL_CONST(9628.4198577767274 / 8.0),
- REAL_CONST(9641.629830951093 / 8.0),
- REAL_CONST(9654.844330414644 / 8.0),
- REAL_CONST(9668.0633530687719 / 8.0),
- REAL_CONST(9681.286895820167 / 8.0),
- REAL_CONST(9694.5149555808002 / 8.0),
- REAL_CONST(9707.7475292679192 / 8.0),
- REAL_CONST(9720.9846138040157 / 8.0),
- REAL_CONST(9734.2262061168276 / 8.0),
- REAL_CONST(9747.4723031393187 / 8.0),
- REAL_CONST(9760.7229018096641 / 8.0),
- REAL_CONST(9773.9779990712323 / 8.0),
- REAL_CONST(9787.2375918725811 / 8.0),
- REAL_CONST(9800.5016771674327 / 8.0),
- REAL_CONST(9813.7702519146696 / 8.0),
- REAL_CONST(9827.0433130783094 / 8.0),
- REAL_CONST(9840.3208576275028 / 8.0),
- REAL_CONST(9853.602882536512 / 8.0),
- REAL_CONST(9866.8893847846994 / 8.0),
- REAL_CONST(9880.1803613565116 / 8.0),
- REAL_CONST(9893.4758092414686 / 8.0),
- REAL_CONST(9906.7757254341523 / 8.0),
- REAL_CONST(9920.0801069341851 / 8.0),
- REAL_CONST(9933.3889507462245 / 8.0),
- REAL_CONST(9946.7022538799429 / 8.0),
- REAL_CONST(9960.0200133500221 / 8.0),
- REAL_CONST(9973.3422261761298 / 8.0),
- REAL_CONST(9986.6688893829159 / 8.0),
- REAL_CONST(9999.9999999999945 / 8.0),
- REAL_CONST(10013.335555061929 / 8.0),
- REAL_CONST(10026.675551608221 / 8.0),
- REAL_CONST(10040.019986683301 / 8.0),
- REAL_CONST(10053.368857336509 / 8.0),
- REAL_CONST(10066.722160622081 / 8.0),
- REAL_CONST(10080.079893599144 / 8.0),
- REAL_CONST(10093.442053331697 / 8.0),
- REAL_CONST(10106.808636888598 / 8.0),
- REAL_CONST(10120.179641343551 / 8.0),
- REAL_CONST(10133.555063775095 / 8.0),
- REAL_CONST(10146.934901266595 / 8.0),
- REAL_CONST(10160.31915090622 / 8.0),
- REAL_CONST(10173.707809786936 / 8.0),
- REAL_CONST(10187.100875006496 / 8.0),
- REAL_CONST(10200.498343667417 / 8.0),
- REAL_CONST(10213.900212876984 / 8.0),
- REAL_CONST(10227.306479747222 / 8.0),
- REAL_CONST(10240.717141394889 / 8.0),
- REAL_CONST(10254.132194941467 / 8.0),
- REAL_CONST(10267.551637513146 / 8.0),
- REAL_CONST(10280.975466240814 / 8.0),
- REAL_CONST(10294.40367826004 / 8.0),
- REAL_CONST(10307.836270711066 / 8.0),
- REAL_CONST(10321.273240738796 / 8.0),
- REAL_CONST(10334.71458549278 / 8.0)
+ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
+{
+ REAL_CONST(0.0),
+ REAL_CONST(1.0/8.0),
+ REAL_CONST(2.5198420997897464/8.0),
+ REAL_CONST(4.3267487109222245/8.0),
+ REAL_CONST(6.3496042078727974/8.0),
+ REAL_CONST(8.5498797333834844/8.0),
+ REAL_CONST(10.902723556992836/8.0),
+ REAL_CONST(13.390518279406722/8.0),
+ REAL_CONST(15.999999999999998/8.0),
+ REAL_CONST(18.720754407467133/8.0),
+ REAL_CONST(21.544346900318832/8.0),
+ REAL_CONST(24.463780996262464/8.0),
+ REAL_CONST(27.47314182127996/8.0),
+ REAL_CONST(30.567350940369842/8.0),
+ REAL_CONST(33.741991698453212/8.0),
+ REAL_CONST(36.993181114957046/8.0),
+ REAL_CONST(40.317473596635935/8.0),
+ REAL_CONST(43.711787041189993/8.0),
+ REAL_CONST(47.173345095760126/8.0),
+ REAL_CONST(50.699631325716943/8.0),
+ REAL_CONST(54.288352331898118/8.0),
+ REAL_CONST(57.937407704003519/8.0),
+ REAL_CONST(61.6448652744185/8.0),
+ REAL_CONST(65.408940536585988/8.0),
+ REAL_CONST(69.227979374755591/8.0),
+ REAL_CONST(73.100443455321638/8.0),
+ REAL_CONST(77.024897778591622/8.0),
+ REAL_CONST(80.999999999999986/8.0),
+ REAL_CONST(85.024491212518527/8.0),
+ REAL_CONST(89.097187944889555/8.0),
+ REAL_CONST(93.216975178615741/8.0),
+ REAL_CONST(97.382800224133163/8.0),
+ REAL_CONST(101.59366732596474/8.0),
+ REAL_CONST(105.84863288986224/8.0),
+ REAL_CONST(110.14680124343441/8.0),
+ REAL_CONST(114.4873208566006/8.0),
+ REAL_CONST(118.86938096020653/8.0),
+ REAL_CONST(123.29220851090024/8.0),
+ REAL_CONST(127.75506545836058/8.0),
+ REAL_CONST(132.25724627755247/8.0),
+ REAL_CONST(136.79807573413572/8.0),
+ REAL_CONST(141.37690685569191/8.0),
+ REAL_CONST(145.99311908523086/8.0),
+ REAL_CONST(150.6461165966291/8.0),
+ REAL_CONST(155.33532675434674/8.0),
+ REAL_CONST(160.06019870205279/8.0),
+ REAL_CONST(164.82020206673349/8.0),
+ REAL_CONST(169.61482576651861/8.0),
+ REAL_CONST(174.44357691188537/8.0),
+ REAL_CONST(179.30597979112557/8.0),
+ REAL_CONST(184.20157493201927/8.0),
+ REAL_CONST(189.12991823257562/8.0),
+ REAL_CONST(194.09058015449685/8.0),
+ REAL_CONST(199.08314497371677/8.0),
+ REAL_CONST(204.1072100829694/8.0),
+ REAL_CONST(209.16238534187647/8.0),
+ REAL_CONST(214.24829247050752/8.0),
+ REAL_CONST(219.36456448277784/8.0),
+ REAL_CONST(224.51084515641216/8.0),
+ REAL_CONST(229.6867885365223/8.0),
+ REAL_CONST(234.89205847013176/8.0),
+ REAL_CONST(240.12632816923249/8.0),
+ REAL_CONST(245.38927980018505/8.0),
+ REAL_CONST(250.68060409747261/8.0),
+ REAL_CONST(255.99999999999991/8.0),
+ REAL_CONST(261.34717430828869/8.0),
+ REAL_CONST(266.72184136106449/8.0),
+ REAL_CONST(272.12372272986045/8.0),
+ REAL_CONST(277.55254693037961/8.0),
+ REAL_CONST(283.0080491494619/8.0),
+ REAL_CONST(288.48997098659891/8.0),
+ REAL_CONST(293.99806020902247/8.0),
+ REAL_CONST(299.53207051947408/8.0),
+ REAL_CONST(305.0917613358298/8.0),
+ REAL_CONST(310.67689758182206/8.0),
+ REAL_CONST(316.28724948815585/8.0),
+ REAL_CONST(321.92259240337177/8.0),
+ REAL_CONST(327.58270661385535/8.0),
+ REAL_CONST(333.26737717243742/8.0),
+ REAL_CONST(338.97639373507025/8.0),
+ REAL_CONST(344.70955040510125/8.0),
+ REAL_CONST(350.46664558470013/8.0),
+ REAL_CONST(356.24748183302603/8.0),
+ REAL_CONST(362.05186573075139/8.0),
+ REAL_CONST(367.87960775058258/8.0),
+ REAL_CONST(373.73052213344511/8.0),
+ REAL_CONST(379.60442677002078/8.0),
+ REAL_CONST(385.50114308734607/8.0),
+ REAL_CONST(391.42049594019937/8.0),
+ REAL_CONST(397.36231350702371/8.0),
+ REAL_CONST(403.32642719014467/8.0),
+ REAL_CONST(409.31267152006262/8.0),
+ REAL_CONST(415.32088406360799/8.0),
+ REAL_CONST(421.35090533576471/8.0),
+ REAL_CONST(427.40257871497619/8.0),
+ REAL_CONST(433.4757503617617/8.0),
+ REAL_CONST(439.5702691404793/8.0),
+ REAL_CONST(445.68598654408271/8.0),
+ REAL_CONST(451.82275662172759/8.0),
+ REAL_CONST(457.98043590909128/8.0),
+ REAL_CONST(464.15888336127773/8.0),
+ REAL_CONST(470.35796028818726/8.0),
+ REAL_CONST(476.5775302922363/8.0),
+ REAL_CONST(482.81745920832043/8.0),
+ REAL_CONST(489.07761504591741/8.0),
+ REAL_CONST(495.35786793323581/8.0),
+ REAL_CONST(501.65809006331688/8.0),
+ REAL_CONST(507.97815564200368/8.0),
+ REAL_CONST(514.31794083769648/8.0),
+ REAL_CONST(520.67732373281672/8.0),
+ REAL_CONST(527.05618427690604/8.0),
+ REAL_CONST(533.45440424129174/8.0),
+ REAL_CONST(539.87186717525128/8.0),
+ REAL_CONST(546.30845836361505/8.0),
+ REAL_CONST(552.76406478574609/8.0),
+ REAL_CONST(559.23857507584194/8.0),
+ REAL_CONST(565.73187948450413/8.0),
+ REAL_CONST(572.24386984152341/8.0),
+ REAL_CONST(578.77443951983378/8.0),
+ REAL_CONST(585.32348340058843/8.0),
+ REAL_CONST(591.89089783931263/8.0),
+ REAL_CONST(598.47658063309257/8.0),
+ REAL_CONST(605.08043098876044/8.0),
+ REAL_CONST(611.70234949203643/8.0),
+ REAL_CONST(618.3422380775919/8.0),
+ REAL_CONST(624.99999999999977/8.0),
+ REAL_CONST(631.67553980553748/8.0),
+ REAL_CONST(638.36876330481164/8.0),
+ REAL_CONST(645.07957754617485/8.0),
+ REAL_CONST(651.80789078990415/8.0),
+ REAL_CONST(658.55361248311499/8.0),
+ REAL_CONST(665.31665323538357/8.0),
+ REAL_CONST(672.09692479505225/8.0),
+ REAL_CONST(678.8943400261943/8.0),
+ REAL_CONST(685.70881288621433/8.0),
+ REAL_CONST(692.540258404062/8.0),
+ REAL_CONST(699.38859265903977/8.0),
+ REAL_CONST(706.25373276018058/8.0),
+ REAL_CONST(713.13559682617972/8.0),
+ REAL_CONST(720.03410396586037/8.0),
+ REAL_CONST(726.94917425915435/8.0),
+ REAL_CONST(733.88072873858209/8.0),
+ REAL_CONST(740.82868937121543/8.0),
+ REAL_CONST(747.79297904110535/8.0),
+ REAL_CONST(754.77352153216191/8.0),
+ REAL_CONST(761.77024151147043/8.0),
+ REAL_CONST(768.78306451302956/8.0),
+ REAL_CONST(775.81191692189896/8.0),
+ REAL_CONST(782.85672595874246/8.0),
+ REAL_CONST(789.91741966475445/8.0),
+ REAL_CONST(796.99392688695798/8.0),
+ REAL_CONST(804.08617726386274/8.0),
+ REAL_CONST(811.19410121147098/8.0),
+ REAL_CONST(818.31762990962227/8.0),
+ REAL_CONST(825.45669528866563/8.0),
+ REAL_CONST(832.61123001644864/8.0),
+ REAL_CONST(839.78116748561604/8.0),
+ REAL_CONST(846.96644180120552/8.0),
+ REAL_CONST(854.16698776853514/8.0),
+ REAL_CONST(861.38274088137143/8.0),
+ REAL_CONST(868.61363731036977/8.0),
+ REAL_CONST(875.85961389178203/8.0),
+ REAL_CONST(883.12060811641959/8.0),
+ REAL_CONST(890.39655811886757/8.0),
+ REAL_CONST(897.68740266694181/8.0),
+ REAL_CONST(904.99308115138172/8.0),
+ REAL_CONST(912.31353357577188/8.0),
+ REAL_CONST(919.64870054668756/8.0),
+ REAL_CONST(926.99852326405619/8.0),
+ REAL_CONST(934.36294351172899/8.0),
+ REAL_CONST(941.74190364825859/8.0),
+ REAL_CONST(949.13534659787422/8.0),
+ REAL_CONST(956.54321584165211/8.0),
+ REAL_CONST(963.96545540887348/8.0),
+ REAL_CONST(971.40200986856541/8.0),
+ REAL_CONST(978.85282432122176/8.0),
+ REAL_CONST(986.31784439069588/8.0),
+ REAL_CONST(993.7970162162635/8.0),
+ REAL_CONST(1001.29028644485/8.0),
+ REAL_CONST(1008.797602223418/8.0),
+ REAL_CONST(1016.3189111915103/8.0),
+ REAL_CONST(1023.8541614739464/8.0),
+ REAL_CONST(1031.4033016736653/8.0),
+ REAL_CONST(1038.9662808647138/8.0),
+ REAL_CONST(1046.5430485853758/8.0),
+ REAL_CONST(1054.1335548314366/8.0),
+ REAL_CONST(1061.7377500495838/8.0),
+ REAL_CONST(1069.3555851309357/8.0),
+ REAL_CONST(1076.9870114046978/8.0),
+ REAL_CONST(1084.6319806319441/8.0),
+ REAL_CONST(1092.2904449995174/8.0),
+ REAL_CONST(1099.9623571140482/8.0),
+ REAL_CONST(1107.6476699960892/8.0),
+ REAL_CONST(1115.3463370743607/8.0),
+ REAL_CONST(1123.058312180106/8.0),
+ REAL_CONST(1130.7835495415541/8.0),
+ REAL_CONST(1138.5220037784854/8.0),
+ REAL_CONST(1146.273629896901/8.0),
+ REAL_CONST(1154.0383832837879/8.0),
+ REAL_CONST(1161.816219701986/8.0),
+ REAL_CONST(1169.607095285146/8.0),
+ REAL_CONST(1177.4109665327808/8.0),
+ REAL_CONST(1185.2277903054078/8.0),
+ REAL_CONST(1193.0575238197798/8.0),
+ REAL_CONST(1200.9001246442001/8.0),
+ REAL_CONST(1208.7555506939248/8.0),
+ REAL_CONST(1216.6237602266442/8.0),
+ REAL_CONST(1224.5047118380478/8.0),
+ REAL_CONST(1232.3983644574657/8.0),
+ REAL_CONST(1240.3046773435874/8.0),
+ REAL_CONST(1248.2236100802568/8.0),
+ REAL_CONST(1256.1551225723395/8.0),
+ REAL_CONST(1264.099175041662/8.0),
+ REAL_CONST(1272.0557280230228/8.0),
+ REAL_CONST(1280.0247423602691/8.0),
+ REAL_CONST(1288.0061792024444/8.0),
+ REAL_CONST(1295.9999999999995/8.0),
+ REAL_CONST(1304.006166501068/8.0),
+ REAL_CONST(1312.0246407478062/8.0),
+ REAL_CONST(1320.0553850727929/8.0),
+ REAL_CONST(1328.0983620954903/8.0),
+ REAL_CONST(1336.1535347187651/8.0),
+ REAL_CONST(1344.2208661254647/8.0),
+ REAL_CONST(1352.3003197750522/8.0),
+ REAL_CONST(1360.3918594002962/8.0),
+ REAL_CONST(1368.4954490040145/8.0),
+ REAL_CONST(1376.6110528558709/8.0),
+ REAL_CONST(1384.7386354892244/8.0),
+ REAL_CONST(1392.8781616980295/8.0),
+ REAL_CONST(1401.0295965337855/8.0),
+ REAL_CONST(1409.1929053025353/8.0),
+ REAL_CONST(1417.3680535619119/8.0),
+ REAL_CONST(1425.5550071182327/8.0),
+ REAL_CONST(1433.7537320236374/8.0),
+ REAL_CONST(1441.9641945732744/8.0),
+ REAL_CONST(1450.1863613025282/8.0),
+ REAL_CONST(1458.4201989842913/8.0),
+ REAL_CONST(1466.6656746262797/8.0),
+ REAL_CONST(1474.9227554683875/8.0),
+ REAL_CONST(1483.1914089800841/8.0),
+ REAL_CONST(1491.4716028578516/8.0),
+ REAL_CONST(1499.7633050226596/8.0),
+ REAL_CONST(1508.0664836174794/8.0),
+ REAL_CONST(1516.3811070048375/8.0),
+ REAL_CONST(1524.7071437644029/8.0),
+ REAL_CONST(1533.0445626906128/8.0),
+ REAL_CONST(1541.3933327903342/8.0),
+ REAL_CONST(1549.7534232805581/8.0),
+ REAL_CONST(1558.1248035861302/8.0),
+ REAL_CONST(1566.507443337515/8.0),
+ REAL_CONST(1574.9013123685909/8.0),
+ REAL_CONST(1583.3063807144795/8.0),
+ REAL_CONST(1591.7226186094069/8.0),
+ REAL_CONST(1600.1499964845941/8.0),
+ REAL_CONST(1608.58848496618/8.0),
+ REAL_CONST(1617.0380548731737/8.0),
+ REAL_CONST(1625.4986772154357/8.0),
+ REAL_CONST(1633.9703231916887/8.0),
+ REAL_CONST(1642.4529641875577/8.0),
+ REAL_CONST(1650.9465717736346/8.0),
+ REAL_CONST(1659.4511177035752/8.0),
+ REAL_CONST(1667.9665739122186/8.0),
+ REAL_CONST(1676.4929125137353/8.0),
+ REAL_CONST(1685.030105799801/8.0),
+ REAL_CONST(1693.5781262377957/8.0),
+ REAL_CONST(1702.136946469027/8.0),
+ REAL_CONST(1710.7065393069795/8.0),
+ REAL_CONST(1719.2868777355877/8.0),
+ REAL_CONST(1727.8779349075323/8.0),
+ REAL_CONST(1736.4796841425596/8.0),
+ REAL_CONST(1745.092098925825/8.0),
+ REAL_CONST(1753.7151529062583/8.0),
+ REAL_CONST(1762.3488198949503/8.0),
+ REAL_CONST(1770.9930738635628/8.0),
+ REAL_CONST(1779.6478889427597/8.0),
+ REAL_CONST(1788.3132394206564/8.0),
+ REAL_CONST(1796.9890997412947/8.0),
+ REAL_CONST(1805.6754445031333/8.0),
+ REAL_CONST(1814.3722484575621/8.0),
+ REAL_CONST(1823.0794865074322/8.0),
+ REAL_CONST(1831.7971337056094/8.0),
+ REAL_CONST(1840.5251652535437/8.0),
+ REAL_CONST(1849.2635564998579/8.0),
+ REAL_CONST(1858.0122829389563/8.0),
+ REAL_CONST(1866.7713202096493/8.0),
+ REAL_CONST(1875.5406440937966/8.0),
+ REAL_CONST(1884.3202305149687/8.0),
+ REAL_CONST(1893.110055537124/8.0),
+ REAL_CONST(1901.9100953633042/8.0),
+ REAL_CONST(1910.7203263343454/8.0),
+ REAL_CONST(1919.5407249276057/8.0),
+ REAL_CONST(1928.3712677557098/8.0),
+ REAL_CONST(1937.2119315653083/8.0),
+ REAL_CONST(1946.0626932358525/8.0),
+ REAL_CONST(1954.923529778386/8.0),
+ REAL_CONST(1963.79441833435/8.0),
+ REAL_CONST(1972.6753361744036/8.0),
+ REAL_CONST(1981.5662606972594/8.0),
+ REAL_CONST(1990.467169428533/8.0),
+ REAL_CONST(1999.3780400196069/8.0),
+ REAL_CONST(2008.2988502465078/8.0),
+ REAL_CONST(2017.2295780087982/8.0),
+ REAL_CONST(2026.1702013284819/8.0),
+ REAL_CONST(2035.1206983489212/8.0),
+ REAL_CONST(2044.0810473337688/8.0),
+ REAL_CONST(2053.0512266659125/8.0),
+ REAL_CONST(2062.0312148464309/8.0),
+ REAL_CONST(2071.0209904935646/8.0),
+ REAL_CONST(2080.0205323416958/8.0),
+ REAL_CONST(2089.0298192403443/8.0),
+ REAL_CONST(2098.0488301531714/8.0),
+ REAL_CONST(2107.0775441569995/8.0),
+ REAL_CONST(2116.115940440839/8.0),
+ REAL_CONST(2125.1639983049317/8.0),
+ REAL_CONST(2134.2216971597995/8.0),
+ REAL_CONST(2143.2890165253098/8.0),
+ REAL_CONST(2152.3659360297484/8.0),
+ REAL_CONST(2161.4524354089031/8.0),
+ REAL_CONST(2170.5484945051617/8.0),
+ REAL_CONST(2179.6540932666144/8.0),
+ REAL_CONST(2188.7692117461711/8.0),
+ REAL_CONST(2197.8938301006888/8.0),
+ REAL_CONST(2207.0279285901042/8.0),
+ REAL_CONST(2216.1714875765838/8.0),
+ REAL_CONST(2225.324487523676/8.0),
+ REAL_CONST(2234.4869089954782/8.0),
+ REAL_CONST(2243.6587326558101/8.0),
+ REAL_CONST(2252.8399392673982/8.0),
+ REAL_CONST(2262.0305096910702/8.0),
+ REAL_CONST(2271.2304248849537/8.0),
+ REAL_CONST(2280.4396659036897/8.0),
+ REAL_CONST(2289.6582138976523/8.0),
+ REAL_CONST(2298.8860501121762/8.0),
+ REAL_CONST(2308.1231558867926/8.0),
+ REAL_CONST(2317.3695126544767/8.0),
+ REAL_CONST(2326.6251019409005/8.0),
+ REAL_CONST(2335.8899053636933/8.0),
+ REAL_CONST(2345.1639046317132/8.0),
+ REAL_CONST(2354.4470815443233/8.0),
+ REAL_CONST(2363.7394179906792/8.0),
+ REAL_CONST(2373.0408959490205/8.0),
+ REAL_CONST(2382.3514974859731/8.0),
+ REAL_CONST(2391.6712047558558/8.0),
+ REAL_CONST(2400.9999999999991/8.0),
+ REAL_CONST(2410.3378655460651/8.0),
+ REAL_CONST(2419.6847838073813/8.0),
+ REAL_CONST(2429.0407372822747/8.0),
+ REAL_CONST(2438.4057085534191/8.0),
+ REAL_CONST(2447.7796802871858/8.0),
+ REAL_CONST(2457.1626352330004/8.0),
+ REAL_CONST(2466.5545562227112/8.0),
+ REAL_CONST(2475.9554261699564/8.0),
+ REAL_CONST(2485.3652280695474/8.0),
+ REAL_CONST(2494.7839449968492/8.0),
+ REAL_CONST(2504.2115601071737/8.0),
+ REAL_CONST(2513.6480566351788/8.0),
+ REAL_CONST(2523.0934178942675/8.0),
+ REAL_CONST(2532.5476272760025/8.0),
+ REAL_CONST(2542.0106682495189/8.0),
+ REAL_CONST(2551.482524360948/8.0),
+ REAL_CONST(2560.9631792328441/8.0),
+ REAL_CONST(2570.4526165636184/8.0),
+ REAL_CONST(2579.9508201269791/8.0),
+ REAL_CONST(2589.4577737713744/8.0),
+ REAL_CONST(2598.9734614194458/8.0),
+ REAL_CONST(2608.4978670674823/8.0),
+ REAL_CONST(2618.0309747848837/8.0),
+ REAL_CONST(2627.5727687136259/8.0),
+ REAL_CONST(2637.1232330677353/8.0),
+ REAL_CONST(2646.6823521327647/8.0),
+ REAL_CONST(2656.2501102652768/8.0),
+ REAL_CONST(2665.8264918923328/8.0),
+ REAL_CONST(2675.4114815109842/8.0),
+ REAL_CONST(2685.0050636877722/8.0),
+ REAL_CONST(2694.6072230582295/8.0),
+ REAL_CONST(2704.2179443263894/8.0),
+ REAL_CONST(2713.8372122642972/8.0),
+ REAL_CONST(2723.4650117115279/8.0),
+ REAL_CONST(2733.1013275747096/8.0),
+ REAL_CONST(2742.7461448270483/8.0),
+ REAL_CONST(2752.3994485078601/8.0),
+ REAL_CONST(2762.0612237221085/8.0),
+ REAL_CONST(2771.7314556399419/8.0),
+ REAL_CONST(2781.4101294962406/8.0),
+ REAL_CONST(2791.0972305901655/8.0),
+ REAL_CONST(2800.7927442847094/8.0),
+ REAL_CONST(2810.4966560062589/8.0),
+ REAL_CONST(2820.2089512441521/8.0),
+ REAL_CONST(2829.9296155502466/8.0),
+ REAL_CONST(2839.6586345384894/8.0),
+ REAL_CONST(2849.3959938844923/8.0),
+ REAL_CONST(2859.1416793251065/8.0),
+ REAL_CONST(2868.8956766580086/8.0),
+ REAL_CONST(2878.6579717412847/8.0),
+ REAL_CONST(2888.4285504930212/8.0),
+ REAL_CONST(2898.2073988908974/8.0),
+ REAL_CONST(2907.9945029717837/8.0),
+ REAL_CONST(2917.789848831344/8.0),
+ REAL_CONST(2927.5934226236377/8.0),
+ REAL_CONST(2937.4052105607311/8.0),
+ REAL_CONST(2947.2251989123079/8.0),
+ REAL_CONST(2957.0533740052865/8.0),
+ REAL_CONST(2966.8897222234368/8.0),
+ REAL_CONST(2976.734230007005/8.0),
+ REAL_CONST(2986.5868838523397/8.0),
+ REAL_CONST(2996.4476703115197/8.0),
+ REAL_CONST(3006.3165759919889/8.0),
+ REAL_CONST(3016.1935875561908/8.0),
+ REAL_CONST(3026.0786917212095/8.0),
+ REAL_CONST(3035.9718752584108/8.0),
+ REAL_CONST(3045.8731249930906/8.0),
+ REAL_CONST(3055.7824278041207/8.0),
+ REAL_CONST(3065.6997706236039/8.0),
+ REAL_CONST(3075.625140436528/8.0),
+ REAL_CONST(3085.5585242804245/8.0),
+ REAL_CONST(3095.4999092450298/8.0),
+ REAL_CONST(3105.4492824719491/8.0),
+ REAL_CONST(3115.4066311543256/8.0),
+ REAL_CONST(3125.3719425365089/8.0),
+ REAL_CONST(3135.3452039137287/8.0),
+ REAL_CONST(3145.3264026317715/8.0),
+ REAL_CONST(3155.3155260866592/8.0),
+ REAL_CONST(3165.3125617243295/8.0),
+ REAL_CONST(3175.3174970403229/8.0),
+ REAL_CONST(3185.3303195794679/8.0),
+ REAL_CONST(3195.35101693557/8.0),
+ REAL_CONST(3205.3795767511078/8.0),
+ REAL_CONST(3215.4159867169251/8.0),
+ REAL_CONST(3225.460234571929/8.0),
+ REAL_CONST(3235.5123081027928/8.0),
+ REAL_CONST(3245.5721951436558/8.0),
+ REAL_CONST(3255.63988357583/8.0),
+ REAL_CONST(3265.7153613275095/8.0),
+ REAL_CONST(3275.7986163734795/8.0),
+ REAL_CONST(3285.8896367348289/8.0),
+ REAL_CONST(3295.9884104786665/8.0),
+ REAL_CONST(3306.0949257178395/8.0),
+ REAL_CONST(3316.2091706106517/8.0),
+ REAL_CONST(3326.331133360588/8.0),
+ REAL_CONST(3336.4608022160378/8.0),
+ REAL_CONST(3346.5981654700231/8.0),
+ REAL_CONST(3356.7432114599264/8.0),
+ REAL_CONST(3366.8959285672249/8.0),
+ REAL_CONST(3377.0563052172211/8.0),
+ REAL_CONST(3387.2243298787821/8.0),
+ REAL_CONST(3397.3999910640764/8.0),
+ REAL_CONST(3407.5832773283128/8.0),
+ REAL_CONST(3417.7741772694862/8.0),
+ REAL_CONST(3427.9726795281199/8.0),
+ REAL_CONST(3438.1787727870123/8.0),
+ REAL_CONST(3448.3924457709873/8.0),
+ REAL_CONST(3458.6136872466445/8.0),
+ REAL_CONST(3468.8424860221107/8.0),
+ REAL_CONST(3479.0788309467976/8.0),
+ REAL_CONST(3489.3227109111554/8.0),
+ REAL_CONST(3499.5741148464344/8.0),
+ REAL_CONST(3509.8330317244445/8.0),
+ REAL_CONST(3520.0994505573185/8.0),
+ REAL_CONST(3530.3733603972751/8.0),
+ REAL_CONST(3540.6547503363886/8.0),
+ REAL_CONST(3550.9436095063534/8.0),
+ REAL_CONST(3561.239927078258/8.0),
+ REAL_CONST(3571.5436922623535/8.0),
+ REAL_CONST(3581.8548943078308/8.0),
+ REAL_CONST(3592.1735225025936/8.0),
+ REAL_CONST(3602.4995661730372/8.0),
+ REAL_CONST(3612.8330146838275/8.0),
+ REAL_CONST(3623.1738574376814/8.0),
+ REAL_CONST(3633.5220838751502/8.0),
+ REAL_CONST(3643.8776834744031/8.0),
+ REAL_CONST(3654.2406457510142/8.0),
+ REAL_CONST(3664.6109602577494/8.0),
+ REAL_CONST(3674.9886165843564/8.0),
+ REAL_CONST(3685.3736043573545/8.0),
+ REAL_CONST(3695.7659132398294/8.0),
+ REAL_CONST(3706.1655329312248/8.0),
+ REAL_CONST(3716.5724531671399/8.0),
+ REAL_CONST(3726.9866637191262/8.0),
+ REAL_CONST(3737.4081543944876/8.0),
+ REAL_CONST(3747.8369150360782/8.0),
+ REAL_CONST(3758.2729355221072/8.0),
+ REAL_CONST(3768.7162057659411/8.0),
+ REAL_CONST(3779.1667157159077/8.0),
+ REAL_CONST(3789.6244553551055/8.0),
+ REAL_CONST(3800.0894147012082/8.0),
+ REAL_CONST(3810.5615838062768/8.0),
+ REAL_CONST(3821.0409527565694/8.0),
+ REAL_CONST(3831.5275116723533/8.0),
+ REAL_CONST(3842.0212507077194/8.0),
+ REAL_CONST(3852.522160050396/8.0),
+ REAL_CONST(3863.0302299215673/8.0),
+ REAL_CONST(3873.5454505756893/8.0),
+ REAL_CONST(3884.0678123003108/8.0),
+ REAL_CONST(3894.5973054158922/8.0),
+ REAL_CONST(3905.1339202756285/8.0),
+ REAL_CONST(3915.6776472652732/8.0),
+ REAL_CONST(3926.2284768029604/8.0),
+ REAL_CONST(3936.7863993390338/8.0),
+ REAL_CONST(3947.3514053558706/8.0),
+ REAL_CONST(3957.9234853677135/8.0),
+ REAL_CONST(3968.5026299204969/8.0),
+ REAL_CONST(3979.0888295916798/8.0),
+ REAL_CONST(3989.6820749900776/8.0),
+ REAL_CONST(4000.2823567556948/8.0),
+ REAL_CONST(4010.8896655595613/8.0),
+ REAL_CONST(4021.5039921035655/8.0),
+ REAL_CONST(4032.1253271202945/8.0),
+ REAL_CONST(4042.7536613728694/8.0),
+ REAL_CONST(4053.3889856547858/8.0),
+ REAL_CONST(4064.0312907897551/8.0),
+ REAL_CONST(4074.6805676315448/8.0),
+ REAL_CONST(4085.3368070638221/8.0),
+ REAL_CONST(4095.9999999999982/8.0),
+ REAL_CONST(4106.6701373830711/8.0),
+ REAL_CONST(4117.347210185475/8.0),
+ REAL_CONST(4128.0312094089259/8.0),
+ REAL_CONST(4138.722126084268/8.0),
+ REAL_CONST(4149.4199512713267/8.0),
+ REAL_CONST(4160.1246760587583/8.0),
+ REAL_CONST(4170.8362915638982/8.0),
+ REAL_CONST(4181.5547889326181/8.0),
+ REAL_CONST(4192.2801593391769/8.0),
+ REAL_CONST(4203.0123939860741/8.0),
+ REAL_CONST(4213.7514841039101/8.0),
+ REAL_CONST(4224.4974209512384/8.0),
+ REAL_CONST(4235.2501958144258/8.0),
+ REAL_CONST(4246.0098000075095/8.0),
+ REAL_CONST(4256.7762248720574/8.0),
+ REAL_CONST(4267.549461777031/8.0),
+ REAL_CONST(4278.3295021186423/8.0),
+ REAL_CONST(4289.1163373202198/8.0),
+ REAL_CONST(4299.9099588320714/8.0),
+ REAL_CONST(4310.7103581313495/8.0),
+ REAL_CONST(4321.5175267219138/8.0),
+ REAL_CONST(4332.3314561342004/8.0),
+ REAL_CONST(4343.152137925088/8.0),
+ REAL_CONST(4353.9795636777671/8.0),
+ REAL_CONST(4364.8137250016052/8.0),
+ REAL_CONST(4375.6546135320223/8.0),
+ REAL_CONST(4386.5022209303588/8.0),
+ REAL_CONST(4397.3565388837469/8.0),
+ REAL_CONST(4408.2175591049827/8.0),
+ REAL_CONST(4419.0852733324018/8.0),
+ REAL_CONST(4429.9596733297531/8.0),
+ REAL_CONST(4440.8407508860728/8.0),
+ REAL_CONST(4451.7284978155603/8.0),
+ REAL_CONST(4462.6229059574571/8.0),
+ REAL_CONST(4473.5239671759227/8.0),
+ REAL_CONST(4484.4316733599126/8.0),
+ REAL_CONST(4495.3460164230582/8.0),
+ REAL_CONST(4506.2669883035496/8.0),
+ REAL_CONST(4517.1945809640119/8.0),
+ REAL_CONST(4528.1287863913894/8.0),
+ REAL_CONST(4539.069596596828/8.0),
+ REAL_CONST(4550.0170036155587/8.0),
+ REAL_CONST(4560.9709995067806/8.0),
+ REAL_CONST(4571.931576353546/8.0),
+ REAL_CONST(4582.898726262647/8.0),
+ REAL_CONST(4593.8724413645004/8.0),
+ REAL_CONST(4604.8527138130348/8.0),
+ REAL_CONST(4615.8395357855816/8.0),
+ REAL_CONST(4626.8328994827571/8.0),
+ REAL_CONST(4637.8327971283588/8.0),
+ REAL_CONST(4648.8392209692511/8.0),
+ REAL_CONST(4659.8521632752563/8.0),
+ REAL_CONST(4670.8716163390473/8.0),
+ REAL_CONST(4681.8975724760394/8.0),
+ REAL_CONST(4692.9300240242837/8.0),
+ REAL_CONST(4703.9689633443595/8.0),
+ REAL_CONST(4715.0143828192668/8.0),
+ REAL_CONST(4726.0662748543255/8.0),
+ REAL_CONST(4737.1246318770682/8.0),
+ REAL_CONST(4748.1894463371373/8.0),
+ REAL_CONST(4759.2607107061804/8.0),
+ REAL_CONST(4770.3384174777493/8.0),
+ REAL_CONST(4781.4225591671993/8.0),
+ REAL_CONST(4792.5131283115852/8.0),
+ REAL_CONST(4803.6101174695614/8.0),
+ REAL_CONST(4814.7135192212854/8.0),
+ REAL_CONST(4825.8233261683154/8.0),
+ REAL_CONST(4836.9395309335096/8.0),
+ REAL_CONST(4848.0621261609349/8.0),
+ REAL_CONST(4859.1911045157631/8.0),
+ REAL_CONST(4870.3264586841779/8.0),
+ REAL_CONST(4881.4681813732768/8.0),
+ REAL_CONST(4892.6162653109768/8.0),
+ REAL_CONST(4903.7707032459193/8.0),
+ REAL_CONST(4914.931487947375/8.0),
+ REAL_CONST(4926.0986122051509/8.0),
+ REAL_CONST(4937.2720688294967/8.0),
+ REAL_CONST(4948.4518506510112/8.0),
+ REAL_CONST(4959.637950520555/8.0),
+ REAL_CONST(4970.8303613091521/8.0),
+ REAL_CONST(4982.0290759079044/8.0),
+ REAL_CONST(4993.2340872278974/8.0),
+ REAL_CONST(5004.4453882001153/8.0),
+ REAL_CONST(5015.6629717753467/8.0),
+ REAL_CONST(5026.8868309241007/8.0),
+ REAL_CONST(5038.1169586365131/8.0),
+ REAL_CONST(5049.353347922266/8.0),
+ REAL_CONST(5060.5959918104927/8.0),
+ REAL_CONST(5071.8448833496996/8.0),
+ REAL_CONST(5083.1000156076734/8.0),
+ REAL_CONST(5094.3613816713996/8.0),
+ REAL_CONST(5105.6289746469747/8.0),
+ REAL_CONST(5116.9027876595246/8.0),
+ REAL_CONST(5128.18281385312/8.0),
+ REAL_CONST(5139.4690463906918/8.0),
+ REAL_CONST(5150.7614784539473/8.0),
+ REAL_CONST(5162.0601032432933/8.0),
+ REAL_CONST(5173.3649139777472/8.0),
+ REAL_CONST(5184.6759038948594/8.0),
+ REAL_CONST(5195.9930662506322/8.0),
+ REAL_CONST(5207.3163943194386/8.0),
+ REAL_CONST(5218.6458813939435/8.0),
+ REAL_CONST(5229.9815207850224/8.0),
+ REAL_CONST(5241.3233058216847/8.0),
+ REAL_CONST(5252.6712298509919/8.0),
+ REAL_CONST(5264.025286237983/8.0),
+ REAL_CONST(5275.3854683655954/8.0),
+ REAL_CONST(5286.7517696345885/8.0),
+ REAL_CONST(5298.1241834634639/8.0),
+ REAL_CONST(5309.5027032883945/8.0),
+ REAL_CONST(5320.887322563146/8.0),
+ REAL_CONST(5332.2780347589978/8.0),
+ REAL_CONST(5343.6748333646756/8.0),
+ REAL_CONST(5355.0777118862716/8.0),
+ REAL_CONST(5366.4866638471722/8.0),
+ REAL_CONST(5377.901682787985/8.0),
+ REAL_CONST(5389.3227622664635/8.0),
+ REAL_CONST(5400.749895857437/8.0),
+ REAL_CONST(5412.1830771527357/8.0),
+ REAL_CONST(5423.622299761123/8.0),
+ REAL_CONST(5435.067557308219/8.0),
+ REAL_CONST(5446.5188434364318/8.0),
+ REAL_CONST(5457.9761518048872/8.0),
+ REAL_CONST(5469.4394760893592/8.0),
+ REAL_CONST(5480.9088099821975/8.0),
+ REAL_CONST(5492.3841471922606/8.0),
+ REAL_CONST(5503.8654814448455/8.0),
+ REAL_CONST(5515.3528064816201/8.0),
+ REAL_CONST(5526.846116060552/8.0),
+ REAL_CONST(5538.3454039558474/8.0),
+ REAL_CONST(5549.8506639578736/8.0),
+ REAL_CONST(5561.3618898731029/8.0),
+ REAL_CONST(5572.8790755240361/8.0),
+ REAL_CONST(5584.4022147491451/8.0),
+ REAL_CONST(5595.9313014027975/8.0),
+ REAL_CONST(5607.4663293552012/8.0),
+ REAL_CONST(5619.0072924923297/8.0),
+ REAL_CONST(5630.5541847158656/8.0),
+ REAL_CONST(5642.1069999431284/8.0),
+ REAL_CONST(5653.665732107017/8.0),
+ REAL_CONST(5665.230375155943/8.0),
+ REAL_CONST(5676.8009230537655/8.0),
+ REAL_CONST(5688.3773697797333/8.0),
+ REAL_CONST(5699.9597093284156/8.0),
+ REAL_CONST(5711.5479357096474/8.0),
+ REAL_CONST(5723.1420429484588/8.0),
+ REAL_CONST(5734.7420250850209/8.0),
+ REAL_CONST(5746.347876174581/8.0),
+ REAL_CONST(5757.9595902874016/8.0),
+ REAL_CONST(5769.5771615087006/8.0),
+ REAL_CONST(5781.2005839385911/8.0),
+ REAL_CONST(5792.8298516920213/8.0),
+ REAL_CONST(5804.4649588987149/8.0),
+ REAL_CONST(5816.1058997031105/8.0),
+ REAL_CONST(5827.7526682643065/8.0),
+ REAL_CONST(5839.4052587559972/8.0),
+ REAL_CONST(5851.0636653664196/8.0),
+ REAL_CONST(5862.7278822982908/8.0),
+ REAL_CONST(5874.3979037687541/8.0),
+ REAL_CONST(5886.0737240093204/8.0),
+ REAL_CONST(5897.7553372658094/8.0),
+ REAL_CONST(5909.4427377982956/8.0),
+ REAL_CONST(5921.1359198810505/8.0),
+ REAL_CONST(5932.8348778024874/8.0),
+ REAL_CONST(5944.5396058651031/8.0),
+ REAL_CONST(5956.2500983854261/8.0),
+ REAL_CONST(5967.9663496939575/8.0),
+ REAL_CONST(5979.6883541351208/8.0),
+ REAL_CONST(5991.4161060672022/8.0),
+ REAL_CONST(6003.1495998623004/8.0),
+ REAL_CONST(6014.8888299062692/8.0),
+ REAL_CONST(6026.6337905986684/8.0),
+ REAL_CONST(6038.3844763527022/8.0),
+ REAL_CONST(6050.1408815951781/8.0),
+ REAL_CONST(6061.9030007664414/8.0),
+ REAL_CONST(6073.6708283203316/8.0),
+ REAL_CONST(6085.4443587241267/8.0),
+ REAL_CONST(6097.2235864584891/8.0),
+ REAL_CONST(6109.0085060174197/8.0),
+ REAL_CONST(6120.7991119081998/8.0),
+ REAL_CONST(6132.595398651345/8.0),
+ REAL_CONST(6144.3973607805519/8.0),
+ REAL_CONST(6156.2049928426459/8.0),
+ REAL_CONST(6168.0182893975361/8.0),
+ REAL_CONST(6179.8372450181578/8.0),
+ REAL_CONST(6191.6618542904307/8.0),
+ REAL_CONST(6203.4921118132024/8.0),
+ REAL_CONST(6215.3280121982016/8.0),
+ REAL_CONST(6227.1695500699925/8.0),
+ REAL_CONST(6239.0167200659189/8.0),
+ REAL_CONST(6250.8695168360628/8.0),
+ REAL_CONST(6262.7279350431891/8.0),
+ REAL_CONST(6274.5919693627056/8.0),
+ REAL_CONST(6286.4616144826068/8.0),
+ REAL_CONST(6298.3368651034316/8.0),
+ REAL_CONST(6310.2177159382172/8.0),
+ REAL_CONST(6322.1041617124456/8.0),
+ REAL_CONST(6333.9961971640032/8.0),
+ REAL_CONST(6345.8938170431311/8.0),
+ REAL_CONST(6357.7970161123785/8.0),
+ REAL_CONST(6369.7057891465583/8.0),
+ REAL_CONST(6381.6201309327007/8.0),
+ REAL_CONST(6393.5400362700075/8.0),
+ REAL_CONST(6405.4654999698032/8.0),
+ REAL_CONST(6417.3965168554978/8.0),
+ REAL_CONST(6429.3330817625329/8.0),
+ REAL_CONST(6441.2751895383453/8.0),
+ REAL_CONST(6453.2228350423138/8.0),
+ REAL_CONST(6465.176013145724/8.0),
+ REAL_CONST(6477.134718731716/8.0),
+ REAL_CONST(6489.0989466952469/8.0),
+ REAL_CONST(6501.0686919430445/8.0),
+ REAL_CONST(6513.0439493935628/8.0),
+ REAL_CONST(6525.0247139769417/8.0),
+ REAL_CONST(6537.010980634961/8.0),
+ REAL_CONST(6549.002744321001/8.0),
+ REAL_CONST(6560.9999999999973/8.0),
+ REAL_CONST(6573.0027426483985/8.0),
+ REAL_CONST(6585.0109672541284/8.0),
+ REAL_CONST(6597.0246688165371/8.0),
+ REAL_CONST(6609.0438423463656/8.0),
+ REAL_CONST(6621.0684828657004/8.0),
+ REAL_CONST(6633.0985854079354/8.0),
+ REAL_CONST(6645.134145017727/8.0),
+ REAL_CONST(6657.1751567509573/8.0),
+ REAL_CONST(6669.2216156746908/8.0),
+ REAL_CONST(6681.2735168671343/8.0),
+ REAL_CONST(6693.3308554176001/8.0),
+ REAL_CONST(6705.3936264264594/8.0),
+ REAL_CONST(6717.461825005108/8.0),
+ REAL_CONST(6729.535446275926/8.0),
+ REAL_CONST(6741.6144853722335/8.0),
+ REAL_CONST(6753.6989374382601/8.0),
+ REAL_CONST(6765.7887976290967/8.0),
+ REAL_CONST(6777.8840611106634/8.0),
+ REAL_CONST(6789.9847230596661/8.0),
+ REAL_CONST(6802.0907786635626/8.0),
+ REAL_CONST(6814.2022231205201/8.0),
+ REAL_CONST(6826.3190516393797/8.0),
+ REAL_CONST(6838.4412594396181/8.0),
+ REAL_CONST(6850.5688417513074/8.0),
+ REAL_CONST(6862.701793815083/8.0),
+ REAL_CONST(6874.840110882099/8.0),
+ REAL_CONST(6886.9837882139991/8.0),
+ REAL_CONST(6899.1328210828724/8.0),
+ REAL_CONST(6911.2872047712199/8.0),
+ REAL_CONST(6923.4469345719199/8.0),
+ REAL_CONST(6935.6120057881863/8.0),
+ REAL_CONST(6947.7824137335365/8.0),
+ REAL_CONST(6959.9581537317536/8.0),
+ REAL_CONST(6972.1392211168532/8.0),
+ REAL_CONST(6984.3256112330409/8.0),
+ REAL_CONST(6996.5173194346862/8.0),
+ REAL_CONST(7008.7143410862773/8.0),
+ REAL_CONST(7020.9166715623942/8.0),
+ REAL_CONST(7033.1243062476678/8.0),
+ REAL_CONST(7045.3372405367481/8.0),
+ REAL_CONST(7057.5554698342685/8.0),
+ REAL_CONST(7069.7789895548103/8.0),
+ REAL_CONST(7082.0077951228714/8.0),
+ REAL_CONST(7094.2418819728273/8.0),
+ REAL_CONST(7106.4812455489018/8.0),
+ REAL_CONST(7118.7258813051285/8.0),
+ REAL_CONST(7130.9757847053224/8.0),
+ REAL_CONST(7143.2309512230404/8.0),
+ REAL_CONST(7155.4913763415516/8.0),
+ REAL_CONST(7167.7570555538041/8.0),
+ REAL_CONST(7180.0279843623894/8.0),
+ REAL_CONST(7192.3041582795131/8.0),
+ REAL_CONST(7204.5855728269571/8.0),
+ REAL_CONST(7216.8722235360519/8.0),
+ REAL_CONST(7229.1641059476406/8.0),
+ REAL_CONST(7241.4612156120484/8.0),
+ REAL_CONST(7253.7635480890503/8.0),
+ REAL_CONST(7266.0710989478375/8.0),
+ REAL_CONST(7278.3838637669869/8.0),
+ REAL_CONST(7290.7018381344296/8.0),
+ REAL_CONST(7303.0250176474174/8.0),
+ REAL_CONST(7315.3533979124932/8.0),
+ REAL_CONST(7327.6869745454596/8.0),
+ REAL_CONST(7340.0257431713462/8.0),
+ REAL_CONST(7352.3696994243801/8.0),
+ REAL_CONST(7364.7188389479543/8.0),
+ REAL_CONST(7377.0731573945968/8.0),
+ REAL_CONST(7389.4326504259407/8.0),
+ REAL_CONST(7401.7973137126937/8.0),
+ REAL_CONST(7414.1671429346061/8.0),
+ REAL_CONST(7426.5421337804428/8.0),
+ REAL_CONST(7438.922281947951/8.0),
+ REAL_CONST(7451.3075831438346/8.0),
+ REAL_CONST(7463.6980330837177/8.0),
+ REAL_CONST(7476.0936274921214/8.0),
+ REAL_CONST(7488.4943621024304/8.0),
+ REAL_CONST(7500.9002326568652/8.0),
+ REAL_CONST(7513.3112349064522/8.0),
+ REAL_CONST(7525.7273646109943/8.0),
+ REAL_CONST(7538.1486175390446/8.0),
+ REAL_CONST(7550.5749894678729/8.0),
+ REAL_CONST(7563.0064761834419/8.0),
+ REAL_CONST(7575.4430734803736/8.0),
+ REAL_CONST(7587.8847771619248/8.0),
+ REAL_CONST(7600.3315830399597/8.0),
+ REAL_CONST(7612.7834869349153/8.0),
+ REAL_CONST(7625.24048467578/8.0),
+ REAL_CONST(7637.7025721000637/8.0),
+ REAL_CONST(7650.1697450537677/8.0),
+ REAL_CONST(7662.6419993913596/8.0),
+ REAL_CONST(7675.1193309757446/8.0),
+ REAL_CONST(7687.6017356782404/8.0),
+ REAL_CONST(7700.0892093785433/8.0),
+ REAL_CONST(7712.5817479647112/8.0),
+ REAL_CONST(7725.079347333125/8.0),
+ REAL_CONST(7737.5820033884729/8.0),
+ REAL_CONST(7750.0897120437139/8.0),
+ REAL_CONST(7762.6024692200581/8.0),
+ REAL_CONST(7775.1202708469355/8.0),
+ REAL_CONST(7787.6431128619733/8.0),
+ REAL_CONST(7800.1709912109645/8.0),
+ REAL_CONST(7812.7039018478481/8.0),
+ REAL_CONST(7825.2418407346768/8.0),
+ REAL_CONST(7837.7848038415968/8.0),
+ REAL_CONST(7850.3327871468155/8.0),
+ REAL_CONST(7862.8857866365806/8.0),
+ REAL_CONST(7875.4437983051539/8.0),
+ REAL_CONST(7888.006818154784/8.0),
+ REAL_CONST(7900.5748421956796/8.0),
+ REAL_CONST(7913.1478664459901/8.0),
+ REAL_CONST(7925.725886931772/8.0),
+ REAL_CONST(7938.3088996869719/8.0),
+ REAL_CONST(7950.8969007533951/8.0),
+ REAL_CONST(7963.4898861806851/8.0),
+ REAL_CONST(7976.0878520262959/8.0),
+ REAL_CONST(7988.6907943554688/8.0),
+ REAL_CONST(8001.2987092412086/8.0),
+ REAL_CONST(8013.911592764257/8.0),
+ REAL_CONST(8026.5294410130691/8.0),
+ REAL_CONST(8039.1522500837891/8.0),
+ REAL_CONST(8051.7800160802271/8.0),
+ REAL_CONST(8064.412735113835/8.0),
+ REAL_CONST(8077.0504033036796/8.0),
+ REAL_CONST(8089.6930167764222/8.0),
+ REAL_CONST(8102.3405716662946/8.0),
+ REAL_CONST(8114.9930641150731/8.0),
+ REAL_CONST(8127.6504902720571/8.0),
+ REAL_CONST(8140.3128462940449/8.0),
+ REAL_CONST(8152.9801283453098/8.0),
+ REAL_CONST(8165.6523325975786/8.0),
+ REAL_CONST(8178.3294552300049/8.0),
+ REAL_CONST(8191.0114924291529/8.0),
+ REAL_CONST(8203.6984403889655/8.0),
+ REAL_CONST(8216.3902953107463/8.0),
+ REAL_CONST(8229.0870534031419/8.0),
+ REAL_CONST(8241.7887108821069/8.0),
+ REAL_CONST(8254.4952639708936/8.0),
+ REAL_CONST(8267.2067089000211/8.0),
+ REAL_CONST(8279.9230419072574/8.0),
+ REAL_CONST(8292.6442592375952/8.0),
+ REAL_CONST(8305.3703571432306/8.0),
+ REAL_CONST(8318.101331883543/8.0),
+ REAL_CONST(8330.8371797250657/8.0),
+ REAL_CONST(8343.577896941475/8.0),
+ REAL_CONST(8356.3234798135582/8.0),
+ REAL_CONST(8369.0739246291978/8.0),
+ REAL_CONST(8381.8292276833508/8.0),
+ REAL_CONST(8394.5893852780209/8.0),
+ REAL_CONST(8407.3543937222421/8.0),
+ REAL_CONST(8420.1242493320569/8.0),
+ REAL_CONST(8432.8989484304948/8.0),
+ REAL_CONST(8445.6784873475499/8.0),
+ REAL_CONST(8458.4628624201578/8.0),
+ REAL_CONST(8471.2520699921806/8.0),
+ REAL_CONST(8484.0461064143838/8.0),
+ REAL_CONST(8496.8449680444082/8.0),
+ REAL_CONST(8509.6486512467636/8.0),
+ REAL_CONST(8522.4571523927953/8.0),
+ REAL_CONST(8535.270467860666/8.0),
+ REAL_CONST(8548.0885940353437/8.0),
+ REAL_CONST(8560.9115273085663/8.0),
+ REAL_CONST(8573.7392640788403/8.0),
+ REAL_CONST(8586.5718007514006/8.0),
+ REAL_CONST(8599.4091337382069/8.0),
+ REAL_CONST(8612.2512594579148/8.0),
+ REAL_CONST(8625.0981743358552/8.0),
+ REAL_CONST(8637.9498748040205/8.0),
+ REAL_CONST(8650.8063573010386/8.0),
+ REAL_CONST(8663.6676182721567/8.0),
+ REAL_CONST(8676.533654169225/8.0),
+ REAL_CONST(8689.4044614506638/8.0),
+ REAL_CONST(8702.2800365814601/8.0),
+ REAL_CONST(8715.1603760331418/8.0),
+ REAL_CONST(8728.0454762837508/8.0),
+ REAL_CONST(8740.9353338178389/8.0),
+ REAL_CONST(8753.8299451264356/8.0),
+ REAL_CONST(8766.7293067070332/8.0),
+ REAL_CONST(8779.6334150635721/8.0),
+ REAL_CONST(8792.5422667064158/8.0),
+ REAL_CONST(8805.4558581523324/8.0),
+ REAL_CONST(8818.3741859244819/8.0),
+ REAL_CONST(8831.2972465523908/8.0),
+ REAL_CONST(8844.2250365719356/8.0),
+ REAL_CONST(8857.1575525253265/8.0),
+ REAL_CONST(8870.0947909610859/8.0),
+ REAL_CONST(8883.0367484340295/8.0),
+ REAL_CONST(8895.9834215052524/8.0),
+ REAL_CONST(8908.934806742107/8.0),
+ REAL_CONST(8921.8909007181846/8.0),
+ REAL_CONST(8934.8517000132997/8.0),
+ REAL_CONST(8947.817201213471/8.0),
+ REAL_CONST(8960.7874009109/8.0),
+ REAL_CONST(8973.7622957039603/8.0),
+ REAL_CONST(8986.7418821971733/8.0),
+ REAL_CONST(8999.7261570011924/8.0),
+ REAL_CONST(9012.7151167327884/8.0),
+ REAL_CONST(9025.7087580148236/8.0),
+ REAL_CONST(9038.7070774762469/8.0),
+ REAL_CONST(9051.7100717520643/8.0),
+ REAL_CONST(9064.7177374833282/8.0),
+ REAL_CONST(9077.7300713171153/8.0),
+ REAL_CONST(9090.7470699065179/8.0),
+ REAL_CONST(9103.7687299106146/8.0),
+ REAL_CONST(9116.7950479944648/8.0),
+ REAL_CONST(9129.8260208290812/8.0),
+ REAL_CONST(9142.8616450914233/8.0),
+ REAL_CONST(9155.9019174643727/8.0),
+ REAL_CONST(9168.9468346367157/8.0),
+ REAL_CONST(9181.9963933031358/8.0),
+ REAL_CONST(9195.0505901641845/8.0),
+ REAL_CONST(9208.1094219262741/8.0),
+ REAL_CONST(9221.1728853016557/8.0),
+ REAL_CONST(9234.240977008405/8.0),
+ REAL_CONST(9247.3136937704076/8.0),
+ REAL_CONST(9260.3910323173386/8.0),
+ REAL_CONST(9273.472989384647/8.0),
+ REAL_CONST(9286.5595617135423/8.0),
+ REAL_CONST(9299.6507460509747/8.0),
+ REAL_CONST(9312.7465391496207/8.0),
+ REAL_CONST(9325.8469377678684/8.0),
+ REAL_CONST(9338.9519386698012/8.0),
+ REAL_CONST(9352.0615386251757/8.0),
+ REAL_CONST(9365.1757344094131/8.0),
+ REAL_CONST(9378.2945228035842/8.0),
+ REAL_CONST(9391.4179005943843/8.0),
+ REAL_CONST(9404.5458645741273/8.0),
+ REAL_CONST(9417.6784115407263/8.0),
+ REAL_CONST(9430.8155382976747/8.0),
+ REAL_CONST(9443.9572416540359/8.0),
+ REAL_CONST(9457.1035184244265/8.0),
+ REAL_CONST(9470.2543654290002/8.0),
+ REAL_CONST(9483.4097794934296/8.0),
+ REAL_CONST(9496.5697574488931/8.0),
+ REAL_CONST(9509.7342961320664/8.0),
+ REAL_CONST(9522.9033923850911/8.0),
+ REAL_CONST(9536.0770430555804/8.0),
+ REAL_CONST(9549.2552449965824/8.0),
+ REAL_CONST(9562.4379950665825/8.0),
+ REAL_CONST(9575.6252901294793/8.0),
+ REAL_CONST(9588.8171270545736/8.0),
+ REAL_CONST(9602.0135027165488/8.0),
+ REAL_CONST(9615.2144139954635/8.0),
+ REAL_CONST(9628.4198577767274/8.0),
+ REAL_CONST(9641.629830951093/8.0),
+ REAL_CONST(9654.844330414644/8.0),
+ REAL_CONST(9668.0633530687719/8.0),
+ REAL_CONST(9681.286895820167/8.0),
+ REAL_CONST(9694.5149555808002/8.0),
+ REAL_CONST(9707.7475292679192/8.0),
+ REAL_CONST(9720.9846138040157/8.0),
+ REAL_CONST(9734.2262061168276/8.0),
+ REAL_CONST(9747.4723031393187/8.0),
+ REAL_CONST(9760.7229018096641/8.0),
+ REAL_CONST(9773.9779990712323/8.0),
+ REAL_CONST(9787.2375918725811/8.0),
+ REAL_CONST(9800.5016771674327/8.0),
+ REAL_CONST(9813.7702519146696/8.0),
+ REAL_CONST(9827.0433130783094/8.0),
+ REAL_CONST(9840.3208576275028/8.0),
+ REAL_CONST(9853.602882536512/8.0),
+ REAL_CONST(9866.8893847846994/8.0),
+ REAL_CONST(9880.1803613565116/8.0),
+ REAL_CONST(9893.4758092414686/8.0),
+ REAL_CONST(9906.7757254341523/8.0),
+ REAL_CONST(9920.0801069341851/8.0),
+ REAL_CONST(9933.3889507462245/8.0),
+ REAL_CONST(9946.7022538799429/8.0),
+ REAL_CONST(9960.0200133500221/8.0),
+ REAL_CONST(9973.3422261761298/8.0),
+ REAL_CONST(9986.6688893829159/8.0),
+ REAL_CONST(9999.9999999999945/8.0),
+ REAL_CONST(10013.335555061929/8.0),
+ REAL_CONST(10026.675551608221/8.0),
+ REAL_CONST(10040.019986683301/8.0),
+ REAL_CONST(10053.368857336509/8.0),
+ REAL_CONST(10066.722160622081/8.0),
+ REAL_CONST(10080.079893599144/8.0),
+ REAL_CONST(10093.442053331697/8.0),
+ REAL_CONST(10106.808636888598/8.0),
+ REAL_CONST(10120.179641343551/8.0),
+ REAL_CONST(10133.555063775095/8.0),
+ REAL_CONST(10146.934901266595/8.0),
+ REAL_CONST(10160.31915090622/8.0),
+ REAL_CONST(10173.707809786936/8.0),
+ REAL_CONST(10187.100875006496/8.0),
+ REAL_CONST(10200.498343667417/8.0),
+ REAL_CONST(10213.900212876984/8.0),
+ REAL_CONST(10227.306479747222/8.0),
+ REAL_CONST(10240.717141394889/8.0),
+ REAL_CONST(10254.132194941467/8.0),
+ REAL_CONST(10267.551637513146/8.0),
+ REAL_CONST(10280.975466240814/8.0),
+ REAL_CONST(10294.40367826004/8.0),
+ REAL_CONST(10307.836270711066/8.0),
+ REAL_CONST(10321.273240738796/8.0),
+ REAL_CONST(10334.71458549278/8.0)
#ifdef BIG_IQ_TABLE
- , REAL_CONST(10348.160302127204 / 8.0),
- REAL_CONST(10361.610387800878 / 8.0),
- REAL_CONST(10375.064839677221 / 8.0),
- REAL_CONST(10388.523654924258 / 8.0),
- REAL_CONST(10401.986830714593 / 8.0),
- REAL_CONST(10415.454364225412 / 8.0),
- REAL_CONST(10428.926252638465 / 8.0),
- REAL_CONST(10442.402493140049 / 8.0),
- REAL_CONST(10455.883082921007 / 8.0),
- REAL_CONST(10469.368019176709 / 8.0),
- REAL_CONST(10482.85729910704 / 8.0),
- REAL_CONST(10496.350919916393 / 8.0),
- REAL_CONST(10509.848878813653 / 8.0),
- REAL_CONST(10523.351173012188 / 8.0),
- REAL_CONST(10536.857799729838 / 8.0),
- REAL_CONST(10550.3687561889 / 8.0),
- REAL_CONST(10563.884039616123 / 8.0),
- REAL_CONST(10577.403647242685 / 8.0),
- REAL_CONST(10590.927576304197 / 8.0),
- REAL_CONST(10604.455824040679 / 8.0),
- REAL_CONST(10617.988387696556 / 8.0),
- REAL_CONST(10631.525264520642 / 8.0),
- REAL_CONST(10645.066451766135 / 8.0),
- REAL_CONST(10658.611946690598 / 8.0),
- REAL_CONST(10672.161746555956 / 8.0),
- REAL_CONST(10685.715848628475 / 8.0),
- REAL_CONST(10699.274250178762 / 8.0),
- REAL_CONST(10712.836948481747 / 8.0),
- REAL_CONST(10726.403940816675 / 8.0),
- REAL_CONST(10739.975224467091 / 8.0),
- REAL_CONST(10753.550796720834 / 8.0),
- REAL_CONST(10767.130654870027 / 8.0),
- REAL_CONST(10780.714796211059 / 8.0),
- REAL_CONST(10794.303218044579 / 8.0),
- REAL_CONST(10807.895917675487 / 8.0),
- REAL_CONST(10821.492892412922 / 8.0),
- REAL_CONST(10835.094139570248 / 8.0),
- REAL_CONST(10848.699656465047 / 8.0),
- REAL_CONST(10862.309440419107 / 8.0),
- REAL_CONST(10875.923488758415 / 8.0),
- REAL_CONST(10889.541798813138 / 8.0),
- REAL_CONST(10903.16436791762 / 8.0),
- REAL_CONST(10916.791193410372 / 8.0),
- REAL_CONST(10930.422272634056 / 8.0),
- REAL_CONST(10944.05760293548 / 8.0),
- REAL_CONST(10957.697181665582 / 8.0),
- REAL_CONST(10971.341006179427 / 8.0),
- REAL_CONST(10984.98907383619 / 8.0),
- REAL_CONST(10998.641381999149 / 8.0),
- REAL_CONST(11012.297928035676 / 8.0),
- REAL_CONST(11025.958709317223 / 8.0),
- REAL_CONST(11039.623723219316 / 8.0),
- REAL_CONST(11053.292967121541 / 8.0),
- REAL_CONST(11066.966438407539 / 8.0),
- REAL_CONST(11080.64413446499 / 8.0),
- REAL_CONST(11094.326052685608 / 8.0),
- REAL_CONST(11108.012190465128 / 8.0),
- REAL_CONST(11121.702545203296 / 8.0),
- REAL_CONST(11135.397114303863 / 8.0),
- REAL_CONST(11149.095895174571 / 8.0),
- REAL_CONST(11162.798885227143 / 8.0),
- REAL_CONST(11176.506081877278 / 8.0),
- REAL_CONST(11190.217482544635 / 8.0),
- REAL_CONST(11203.933084652828 / 8.0),
- REAL_CONST(11217.652885629415 / 8.0),
- REAL_CONST(11231.376882905886 / 8.0),
- REAL_CONST(11245.105073917659 / 8.0),
- REAL_CONST(11258.837456104062 / 8.0),
- REAL_CONST(11272.574026908333 / 8.0),
- REAL_CONST(11286.314783777601 / 8.0),
- REAL_CONST(11300.059724162888 / 8.0),
- REAL_CONST(11313.808845519083 / 8.0),
- REAL_CONST(11327.562145304952 / 8.0),
- REAL_CONST(11341.319620983111 / 8.0),
- REAL_CONST(11355.081270020033 / 8.0),
- REAL_CONST(11368.847089886023 / 8.0),
- REAL_CONST(11382.617078055218 / 8.0),
- REAL_CONST(11396.391232005579 / 8.0),
- REAL_CONST(11410.169549218874 / 8.0),
- REAL_CONST(11423.952027180676 / 8.0),
- REAL_CONST(11437.738663380349 / 8.0),
- REAL_CONST(11451.529455311042 / 8.0),
- REAL_CONST(11465.324400469679 / 8.0),
- REAL_CONST(11479.123496356951 / 8.0),
- REAL_CONST(11492.926740477304 / 8.0),
- REAL_CONST(11506.734130338931 / 8.0),
- REAL_CONST(11520.545663453764 / 8.0),
- REAL_CONST(11534.361337337466 / 8.0),
- REAL_CONST(11548.181149509423 / 8.0),
- REAL_CONST(11562.005097492724 / 8.0),
- REAL_CONST(11575.83317881417 / 8.0),
- REAL_CONST(11589.665391004253 / 8.0),
- REAL_CONST(11603.501731597149 / 8.0),
- REAL_CONST(11617.342198130715 / 8.0),
- REAL_CONST(11631.186788146468 / 8.0),
- REAL_CONST(11645.035499189589 / 8.0),
- REAL_CONST(11658.888328808911 / 8.0),
- REAL_CONST(11672.745274556904 / 8.0),
- REAL_CONST(11686.606333989675 / 8.0),
- REAL_CONST(11700.471504666955 / 8.0),
- REAL_CONST(11714.340784152086 / 8.0),
- REAL_CONST(11728.214170012021 / 8.0),
- REAL_CONST(11742.091659817312 / 8.0),
- REAL_CONST(11755.973251142101 / 8.0),
- REAL_CONST(11769.858941564111 / 8.0),
- REAL_CONST(11783.748728664636 / 8.0),
- REAL_CONST(11797.642610028539 / 8.0),
- REAL_CONST(11811.540583244237 / 8.0),
- REAL_CONST(11825.442645903697 / 8.0),
- REAL_CONST(11839.34879560242 / 8.0),
- REAL_CONST(11853.259029939445 / 8.0),
- REAL_CONST(11867.173346517333 / 8.0),
- REAL_CONST(11881.091742942155 / 8.0),
- REAL_CONST(11895.014216823492 / 8.0),
- REAL_CONST(11908.940765774427 / 8.0),
- REAL_CONST(11922.871387411526 / 8.0),
- REAL_CONST(11936.806079354839 / 8.0),
- REAL_CONST(11950.744839227897 / 8.0),
- REAL_CONST(11964.687664657684 / 8.0),
- REAL_CONST(11978.634553274653 / 8.0),
- REAL_CONST(11992.585502712702 / 8.0),
- REAL_CONST(12006.540510609168 / 8.0),
- REAL_CONST(12020.499574604828 / 8.0),
- REAL_CONST(12034.462692343877 / 8.0),
- REAL_CONST(12048.429861473938 / 8.0),
- REAL_CONST(12062.401079646032 / 8.0),
- REAL_CONST(12076.376344514589 / 8.0),
- REAL_CONST(12090.355653737433 / 8.0),
- REAL_CONST(12104.339004975769 / 8.0),
- REAL_CONST(12118.326395894188 / 8.0),
- REAL_CONST(12132.317824160644 / 8.0),
- REAL_CONST(12146.313287446457 / 8.0),
- REAL_CONST(12160.312783426305 / 8.0),
- REAL_CONST(12174.316309778205 / 8.0),
- REAL_CONST(12188.323864183525 / 8.0),
- REAL_CONST(12202.335444326955 / 8.0),
- REAL_CONST(12216.351047896511 / 8.0),
- REAL_CONST(12230.370672583531 / 8.0),
- REAL_CONST(12244.394316082657 / 8.0),
- REAL_CONST(12258.421976091831 / 8.0),
- REAL_CONST(12272.453650312296 / 8.0),
- REAL_CONST(12286.489336448574 / 8.0),
- REAL_CONST(12300.529032208471 / 8.0),
- REAL_CONST(12314.572735303058 / 8.0),
- REAL_CONST(12328.620443446678 / 8.0),
- REAL_CONST(12342.672154356922 / 8.0),
- REAL_CONST(12356.727865754638 / 8.0),
- REAL_CONST(12370.787575363909 / 8.0),
- REAL_CONST(12384.851280912055 / 8.0),
- REAL_CONST(12398.918980129623 / 8.0),
- REAL_CONST(12412.990670750381 / 8.0),
- REAL_CONST(12427.066350511306 / 8.0),
- REAL_CONST(12441.146017152583 / 8.0),
- REAL_CONST(12455.229668417589 / 8.0),
- REAL_CONST(12469.317302052901 / 8.0),
- REAL_CONST(12483.40891580827 / 8.0),
- REAL_CONST(12497.50450743663 / 8.0),
- REAL_CONST(12511.604074694078 / 8.0),
- REAL_CONST(12525.707615339878 / 8.0),
- REAL_CONST(12539.815127136444 / 8.0),
- REAL_CONST(12553.926607849342 / 8.0),
- REAL_CONST(12568.042055247275 / 8.0),
- REAL_CONST(12582.161467102082 / 8.0),
- REAL_CONST(12596.284841188726 / 8.0),
- REAL_CONST(12610.41217528529 / 8.0),
- REAL_CONST(12624.543467172971 / 8.0),
- REAL_CONST(12638.678714636069 / 8.0),
- REAL_CONST(12652.817915461985 / 8.0),
- REAL_CONST(12666.961067441209 / 8.0),
- REAL_CONST(12681.108168367316 / 8.0),
- REAL_CONST(12695.259216036962 / 8.0),
- REAL_CONST(12709.414208249869 / 8.0),
- REAL_CONST(12723.573142808827 / 8.0),
- REAL_CONST(12737.736017519681 / 8.0),
- REAL_CONST(12751.902830191326 / 8.0),
- REAL_CONST(12766.073578635704 / 8.0),
- REAL_CONST(12780.248260667788 / 8.0),
- REAL_CONST(12794.426874105588 / 8.0),
- REAL_CONST(12808.609416770132 / 8.0),
- REAL_CONST(12822.795886485468 / 8.0),
- REAL_CONST(12836.986281078653 / 8.0),
- REAL_CONST(12851.180598379744 / 8.0),
- REAL_CONST(12865.378836221802 / 8.0),
- REAL_CONST(12879.580992440871 / 8.0),
- REAL_CONST(12893.787064875984 / 8.0),
- REAL_CONST(12907.997051369144 / 8.0),
- REAL_CONST(12922.210949765335 / 8.0),
- REAL_CONST(12936.428757912496 / 8.0),
- REAL_CONST(12950.650473661524 / 8.0),
- REAL_CONST(12964.876094866273 / 8.0),
- REAL_CONST(12979.105619383534 / 8.0),
- REAL_CONST(12993.339045073039 / 8.0),
- REAL_CONST(13007.576369797454 / 8.0),
- REAL_CONST(13021.817591422368 / 8.0),
- REAL_CONST(13036.062707816285 / 8.0),
- REAL_CONST(13050.311716850629 / 8.0),
- REAL_CONST(13064.564616399723 / 8.0),
- REAL_CONST(13078.821404340792 / 8.0),
- REAL_CONST(13093.082078553954 / 8.0),
- REAL_CONST(13107.346636922217 / 8.0),
- REAL_CONST(13121.615077331464 / 8.0),
- REAL_CONST(13135.887397670458 / 8.0),
- REAL_CONST(13150.163595830827 / 8.0),
- REAL_CONST(13164.44366970706 / 8.0),
- REAL_CONST(13178.727617196502 / 8.0),
- REAL_CONST(13193.015436199352 / 8.0),
- REAL_CONST(13207.307124618648 / 8.0),
- REAL_CONST(13221.602680360265 / 8.0),
- REAL_CONST(13235.902101332911 / 8.0),
- REAL_CONST(13250.205385448118 / 8.0),
- REAL_CONST(13264.512530620239 / 8.0),
- REAL_CONST(13278.823534766434 / 8.0),
- REAL_CONST(13293.138395806676 / 8.0),
- REAL_CONST(13307.457111663734 / 8.0),
- REAL_CONST(13321.779680263176 / 8.0),
- REAL_CONST(13336.106099533356 / 8.0),
- REAL_CONST(13350.436367405409 / 8.0),
- REAL_CONST(13364.77048181325 / 8.0),
- REAL_CONST(13379.108440693562 / 8.0),
- REAL_CONST(13393.450241985796 / 8.0),
- REAL_CONST(13407.795883632158 / 8.0),
- REAL_CONST(13422.145363577607 / 8.0),
- REAL_CONST(13436.498679769853 / 8.0),
- REAL_CONST(13450.855830159346 / 8.0),
- REAL_CONST(13465.216812699266 / 8.0),
- REAL_CONST(13479.581625345529 / 8.0),
- REAL_CONST(13493.950266056772 / 8.0),
- REAL_CONST(13508.32273279435 / 8.0),
- REAL_CONST(13522.699023522329 / 8.0),
- REAL_CONST(13537.079136207483 / 8.0),
- REAL_CONST(13551.463068819286 / 8.0),
- REAL_CONST(13565.850819329906 / 8.0),
- REAL_CONST(13580.2423857142 / 8.0),
- REAL_CONST(13594.63776594971 / 8.0),
- REAL_CONST(13609.036958016657 / 8.0),
- REAL_CONST(13623.439959897927 / 8.0),
- REAL_CONST(13637.846769579081 / 8.0),
- REAL_CONST(13652.257385048335 / 8.0),
- REAL_CONST(13666.67180429656 / 8.0),
- REAL_CONST(13681.090025317284 / 8.0),
- REAL_CONST(13695.512046106669 / 8.0),
- REAL_CONST(13709.937864663521 / 8.0),
- REAL_CONST(13724.367478989278 / 8.0),
- REAL_CONST(13738.800887088004 / 8.0),
- REAL_CONST(13753.238086966385 / 8.0),
- REAL_CONST(13767.679076633727 / 8.0),
- REAL_CONST(13782.123854101939 / 8.0),
- REAL_CONST(13796.572417385545 / 8.0),
- REAL_CONST(13811.024764501659 / 8.0),
- REAL_CONST(13825.480893469998 / 8.0),
- REAL_CONST(13839.94080231286 / 8.0),
- REAL_CONST(13854.404489055134 / 8.0),
- REAL_CONST(13868.871951724283 / 8.0),
- REAL_CONST(13883.34318835034 / 8.0),
- REAL_CONST(13897.818196965914 / 8.0),
- REAL_CONST(13912.296975606168 / 8.0),
- REAL_CONST(13926.779522308825 / 8.0),
- REAL_CONST(13941.26583511416 / 8.0),
- REAL_CONST(13955.755912064991 / 8.0),
- REAL_CONST(13970.249751206682 / 8.0),
- REAL_CONST(13984.747350587126 / 8.0),
- REAL_CONST(13999.248708256751 / 8.0),
- REAL_CONST(14013.753822268511 / 8.0),
- REAL_CONST(14028.262690677873 / 8.0),
- REAL_CONST(14042.775311542828 / 8.0),
- REAL_CONST(14057.291682923867 / 8.0),
- REAL_CONST(14071.811802883994 / 8.0),
- REAL_CONST(14086.335669488704 / 8.0),
- REAL_CONST(14100.863280805994 / 8.0),
- REAL_CONST(14115.394634906341 / 8.0),
- REAL_CONST(14129.92972986271 / 8.0),
- REAL_CONST(14144.468563750548 / 8.0),
- REAL_CONST(14159.01113464777 / 8.0),
- REAL_CONST(14173.55744063476 / 8.0),
- REAL_CONST(14188.107479794369 / 8.0),
- REAL_CONST(14202.661250211901 / 8.0),
- REAL_CONST(14217.218749975118 / 8.0),
- REAL_CONST(14231.779977174227 / 8.0),
- REAL_CONST(14246.344929901879 / 8.0),
- REAL_CONST(14260.913606253163 / 8.0),
- REAL_CONST(14275.486004325601 / 8.0),
- REAL_CONST(14290.062122219146 / 8.0),
- REAL_CONST(14304.641958036171 / 8.0),
- REAL_CONST(14319.225509881464 / 8.0),
- REAL_CONST(14333.812775862236 / 8.0),
- REAL_CONST(14348.403754088098 / 8.0),
- REAL_CONST(14362.998442671067 / 8.0),
- REAL_CONST(14377.59683972556 / 8.0),
- REAL_CONST(14392.198943368388 / 8.0),
- REAL_CONST(14406.804751718748 / 8.0),
- REAL_CONST(14421.414262898223 / 8.0),
- REAL_CONST(14436.027475030774 / 8.0),
- REAL_CONST(14450.64438624274 / 8.0),
- REAL_CONST(14465.264994662828 / 8.0),
- REAL_CONST(14479.889298422106 / 8.0),
- REAL_CONST(14494.517295654005 / 8.0),
- REAL_CONST(14509.148984494313 / 8.0),
- REAL_CONST(14523.784363081166 / 8.0),
- REAL_CONST(14538.423429555049 / 8.0),
- REAL_CONST(14553.066182058781 / 8.0),
- REAL_CONST(14567.712618737527 / 8.0),
- REAL_CONST(14582.362737738777 / 8.0),
- REAL_CONST(14597.016537212348 / 8.0),
- REAL_CONST(14611.674015310382 / 8.0),
- REAL_CONST(14626.33517018734 / 8.0),
- REAL_CONST(14640.999999999993 / 8.0),
- REAL_CONST(14655.668502907418 / 8.0),
- REAL_CONST(14670.340677071003 / 8.0),
- REAL_CONST(14685.016520654426 / 8.0),
- REAL_CONST(14699.696031823671 / 8.0),
- REAL_CONST(14714.379208746999 / 8.0),
- REAL_CONST(14729.066049594967 / 8.0),
- REAL_CONST(14743.756552540408 / 8.0),
- REAL_CONST(14758.45071575843 / 8.0),
- REAL_CONST(14773.148537426418 / 8.0),
- REAL_CONST(14787.850015724018 / 8.0),
- REAL_CONST(14802.555148833142 / 8.0),
- REAL_CONST(14817.263934937961 / 8.0),
- REAL_CONST(14831.976372224897 / 8.0),
- REAL_CONST(14846.692458882624 / 8.0),
- REAL_CONST(14861.41219310206 / 8.0),
- REAL_CONST(14876.135573076363 / 8.0),
- REAL_CONST(14890.862597000923 / 8.0),
- REAL_CONST(14905.593263073371 / 8.0),
- REAL_CONST(14920.327569493558 / 8.0),
- REAL_CONST(14935.065514463557 / 8.0),
- REAL_CONST(14949.807096187662 / 8.0),
- REAL_CONST(14964.552312872382 / 8.0),
- REAL_CONST(14979.301162726431 / 8.0),
- REAL_CONST(14994.053643960735 / 8.0),
- REAL_CONST(15008.809754788414 / 8.0),
- REAL_CONST(15023.569493424788 / 8.0),
- REAL_CONST(15038.332858087369 / 8.0),
- REAL_CONST(15053.099846995858 / 8.0),
- REAL_CONST(15067.870458372134 / 8.0),
- REAL_CONST(15082.644690440264 / 8.0),
- REAL_CONST(15097.422541426484 / 8.0),
- REAL_CONST(15112.204009559202 / 8.0),
- REAL_CONST(15126.989093068994 / 8.0),
- REAL_CONST(15141.777790188597 / 8.0),
- REAL_CONST(15156.570099152905 / 8.0),
- REAL_CONST(15171.366018198967 / 8.0),
- REAL_CONST(15186.165545565986 / 8.0),
- REAL_CONST(15200.968679495301 / 8.0),
- REAL_CONST(15215.775418230402 / 8.0),
- REAL_CONST(15230.585760016909 / 8.0),
- REAL_CONST(15245.399703102579 / 8.0),
- REAL_CONST(15260.217245737298 / 8.0),
- REAL_CONST(15275.038386173073 / 8.0),
- REAL_CONST(15289.863122664035 / 8.0),
- REAL_CONST(15304.691453466432 / 8.0),
- REAL_CONST(15319.523376838621 / 8.0),
- REAL_CONST(15334.358891041069 / 8.0),
- REAL_CONST(15349.197994336346 / 8.0),
- REAL_CONST(15364.040684989128 / 8.0),
- REAL_CONST(15378.886961266177 / 8.0),
- REAL_CONST(15393.736821436356 / 8.0),
- REAL_CONST(15408.590263770609 / 8.0),
- REAL_CONST(15423.447286541972 / 8.0),
- REAL_CONST(15438.307888025554 / 8.0),
- REAL_CONST(15453.172066498542 / 8.0),
- REAL_CONST(15468.039820240196 / 8.0),
- REAL_CONST(15482.91114753184 / 8.0),
- REAL_CONST(15497.786046656869 / 8.0),
- REAL_CONST(15512.664515900733 / 8.0),
- REAL_CONST(15527.546553550939 / 8.0),
- REAL_CONST(15542.432157897045 / 8.0),
- REAL_CONST(15557.32132723066 / 8.0),
- REAL_CONST(15572.214059845435 / 8.0),
- REAL_CONST(15587.110354037064 / 8.0),
- REAL_CONST(15602.010208103273 / 8.0),
- REAL_CONST(15616.913620343823 / 8.0),
- REAL_CONST(15631.820589060506 / 8.0),
- REAL_CONST(15646.731112557136 / 8.0),
- REAL_CONST(15661.645189139546 / 8.0),
- REAL_CONST(15676.562817115593 / 8.0),
- REAL_CONST(15691.483994795139 / 8.0),
- REAL_CONST(15706.408720490062 / 8.0),
- REAL_CONST(15721.336992514242 / 8.0),
- REAL_CONST(15736.268809183561 / 8.0),
- REAL_CONST(15751.204168815901 / 8.0),
- REAL_CONST(15766.143069731135 / 8.0),
- REAL_CONST(15781.085510251132 / 8.0),
- REAL_CONST(15796.03148869974 / 8.0),
- REAL_CONST(15810.981003402798 / 8.0),
- REAL_CONST(15825.934052688119 / 8.0),
- REAL_CONST(15840.890634885489 / 8.0),
- REAL_CONST(15855.850748326673 / 8.0),
- REAL_CONST(15870.814391345401 / 8.0),
- REAL_CONST(15885.781562277361 / 8.0),
- REAL_CONST(15900.752259460214 / 8.0),
- REAL_CONST(15915.726481233565 / 8.0),
- REAL_CONST(15930.704225938984 / 8.0),
- REAL_CONST(15945.685491919978 / 8.0),
- REAL_CONST(15960.670277522009 / 8.0),
- REAL_CONST(15975.658581092481 / 8.0),
- REAL_CONST(15990.65040098073 / 8.0),
- REAL_CONST(16005.645735538035 / 8.0),
- REAL_CONST(16020.644583117599 / 8.0),
- REAL_CONST(16035.646942074556 / 8.0),
- REAL_CONST(16050.652810765967 / 8.0),
- REAL_CONST(16065.662187550806 / 8.0),
- REAL_CONST(16080.675070789974 / 8.0),
- REAL_CONST(16095.691458846273 / 8.0),
- REAL_CONST(16110.711350084424 / 8.0),
- REAL_CONST(16125.734742871053 / 8.0),
- REAL_CONST(16140.761635574685 / 8.0),
- REAL_CONST(16155.792026565747 / 8.0),
- REAL_CONST(16170.825914216561 / 8.0),
- REAL_CONST(16185.863296901338 / 8.0),
- REAL_CONST(16200.904172996183 / 8.0),
- REAL_CONST(16215.948540879079 / 8.0),
- REAL_CONST(16230.996398929899 / 8.0),
- REAL_CONST(16246.047745530386 / 8.0),
- REAL_CONST(16261.102579064163 / 8.0),
- REAL_CONST(16276.160897916721 / 8.0),
- REAL_CONST(16291.22270047542 / 8.0),
- REAL_CONST(16306.287985129484 / 8.0),
- REAL_CONST(16321.356750269995 / 8.0),
- REAL_CONST(16336.428994289896 / 8.0),
- REAL_CONST(16351.504715583982 / 8.0),
- REAL_CONST(16366.5839125489 / 8.0),
- REAL_CONST(16381.666583583141 / 8.0),
- REAL_CONST(16396.752727087041 / 8.0),
- REAL_CONST(16411.842341462776 / 8.0),
- REAL_CONST(16426.935425114363 / 8.0),
- REAL_CONST(16442.031976447644 / 8.0),
- REAL_CONST(16457.131993870298 / 8.0),
- REAL_CONST(16472.235475791829 / 8.0),
- REAL_CONST(16487.342420623561 / 8.0),
- REAL_CONST(16502.452826778641 / 8.0),
- REAL_CONST(16517.566692672033 / 8.0),
- REAL_CONST(16532.684016720516 / 8.0),
- REAL_CONST(16547.804797342676 / 8.0),
- REAL_CONST(16562.929032958902 / 8.0),
- REAL_CONST(16578.056721991394 / 8.0),
- REAL_CONST(16593.18786286415 / 8.0),
- REAL_CONST(16608.322454002962 / 8.0),
- REAL_CONST(16623.460493835417 / 8.0),
- REAL_CONST(16638.601980790896 / 8.0),
- REAL_CONST(16653.746913300558 / 8.0),
- REAL_CONST(16668.895289797354 / 8.0),
- REAL_CONST(16684.047108716015 / 8.0),
- REAL_CONST(16699.202368493046 / 8.0),
- REAL_CONST(16714.361067566726 / 8.0),
- REAL_CONST(16729.523204377107 / 8.0),
- REAL_CONST(16744.688777366009 / 8.0),
- REAL_CONST(16759.857784977012 / 8.0),
- REAL_CONST(16775.030225655464 / 8.0),
- REAL_CONST(16790.206097848466 / 8.0),
- REAL_CONST(16805.385400004874 / 8.0),
- REAL_CONST(16820.568130575302 / 8.0),
- REAL_CONST(16835.754288012104 / 8.0),
- REAL_CONST(16850.943870769381 / 8.0),
- REAL_CONST(16866.136877302983 / 8.0),
- REAL_CONST(16881.333306070494 / 8.0),
- REAL_CONST(16896.53315553123 / 8.0),
- REAL_CONST(16911.736424146249 / 8.0),
- REAL_CONST(16926.943110378332 / 8.0),
- REAL_CONST(16942.153212691992 / 8.0),
- REAL_CONST(16957.366729553454 / 8.0),
- REAL_CONST(16972.583659430682 / 8.0),
- REAL_CONST(16987.804000793338 / 8.0),
- REAL_CONST(17003.027752112816 / 8.0),
- REAL_CONST(17018.254911862205 / 8.0),
- REAL_CONST(17033.485478516312 / 8.0),
- REAL_CONST(17048.719450551645 / 8.0),
- REAL_CONST(17063.956826446421 / 8.0),
- REAL_CONST(17079.197604680547 / 8.0),
- REAL_CONST(17094.44178373563 / 8.0),
- REAL_CONST(17109.689362094967 / 8.0),
- REAL_CONST(17124.940338243552 / 8.0),
- REAL_CONST(17140.194710668064 / 8.0),
- REAL_CONST(17155.452477856852 / 8.0),
- REAL_CONST(17170.713638299967 / 8.0),
- REAL_CONST(17185.978190489128 / 8.0),
- REAL_CONST(17201.246132917724 / 8.0),
- REAL_CONST(17216.517464080825 / 8.0),
- REAL_CONST(17231.792182475165 / 8.0),
- REAL_CONST(17247.070286599141 / 8.0),
- REAL_CONST(17262.351774952826 / 8.0),
- REAL_CONST(17277.636646037936 / 8.0),
- REAL_CONST(17292.924898357855 / 8.0),
- REAL_CONST(17308.216530417623 / 8.0),
- REAL_CONST(17323.511540723921 / 8.0),
- REAL_CONST(17338.809927785089 / 8.0),
- REAL_CONST(17354.111690111105 / 8.0),
- REAL_CONST(17369.416826213594 / 8.0),
- REAL_CONST(17384.725334605821 / 8.0),
- REAL_CONST(17400.037213802683 / 8.0),
- REAL_CONST(17415.352462320716 / 8.0),
- REAL_CONST(17430.67107867809 / 8.0),
- REAL_CONST(17445.993061394587 / 8.0),
- REAL_CONST(17461.318408991636 / 8.0),
- REAL_CONST(17476.647119992274 / 8.0),
- REAL_CONST(17491.979192921168 / 8.0),
- REAL_CONST(17507.314626304586 / 8.0),
- REAL_CONST(17522.653418670423 / 8.0),
- REAL_CONST(17537.995568548187 / 8.0),
- REAL_CONST(17553.341074468986 / 8.0),
- REAL_CONST(17568.689934965536 / 8.0),
- REAL_CONST(17584.042148572156 / 8.0),
- REAL_CONST(17599.397713824768 / 8.0),
- REAL_CONST(17614.75662926089 / 8.0),
- REAL_CONST(17630.118893419625 / 8.0),
- REAL_CONST(17645.484504841683 / 8.0),
- REAL_CONST(17660.853462069354 / 8.0),
- REAL_CONST(17676.225763646511 / 8.0),
- REAL_CONST(17691.601408118619 / 8.0),
- REAL_CONST(17706.980394032718 / 8.0),
- REAL_CONST(17722.362719937424 / 8.0),
- REAL_CONST(17737.748384382936 / 8.0),
- REAL_CONST(17753.137385921014 / 8.0),
- REAL_CONST(17768.529723104999 / 8.0),
- REAL_CONST(17783.92539448979 / 8.0),
- REAL_CONST(17799.324398631856 / 8.0),
- REAL_CONST(17814.726734089225 / 8.0),
- REAL_CONST(17830.13239942148 / 8.0),
- REAL_CONST(17845.541393189767 / 8.0),
- REAL_CONST(17860.95371395678 / 8.0),
- REAL_CONST(17876.369360286772 / 8.0),
- REAL_CONST(17891.788330745527 / 8.0),
- REAL_CONST(17907.210623900395 / 8.0),
- REAL_CONST(17922.636238320254 / 8.0),
- REAL_CONST(17938.065172575527 / 8.0),
- REAL_CONST(17953.497425238176 / 8.0),
- REAL_CONST(17968.932994881692 / 8.0),
- REAL_CONST(17984.371880081104 / 8.0),
- REAL_CONST(17999.814079412972 / 8.0),
- REAL_CONST(18015.259591455371 / 8.0),
- REAL_CONST(18030.708414787914 / 8.0),
- REAL_CONST(18046.160547991731 / 8.0),
- REAL_CONST(18061.615989649465 / 8.0),
- REAL_CONST(18077.074738345284 / 8.0),
- REAL_CONST(18092.536792664861 / 8.0),
- REAL_CONST(18108.002151195393 / 8.0),
- REAL_CONST(18123.470812525571 / 8.0),
- REAL_CONST(18138.942775245599 / 8.0),
- REAL_CONST(18154.418037947191 / 8.0),
- REAL_CONST(18169.896599223546 / 8.0),
- REAL_CONST(18185.37845766938 / 8.0),
- REAL_CONST(18200.863611880886 / 8.0),
- REAL_CONST(18216.352060455767 / 8.0),
- REAL_CONST(18231.843801993204 / 8.0),
- REAL_CONST(18247.338835093873 / 8.0),
- REAL_CONST(18262.837158359936 / 8.0),
- REAL_CONST(18278.338770395032 / 8.0),
- REAL_CONST(18293.84366980429 / 8.0),
- REAL_CONST(18309.351855194309 / 8.0),
- REAL_CONST(18324.863325173166 / 8.0),
- REAL_CONST(18340.378078350412 / 8.0),
- REAL_CONST(18355.896113337069 / 8.0),
- REAL_CONST(18371.417428745623 / 8.0),
- REAL_CONST(18386.942023190033 / 8.0),
- REAL_CONST(18402.469895285718 / 8.0),
- REAL_CONST(18418.00104364955 / 8.0),
- REAL_CONST(18433.53546689987 / 8.0),
- REAL_CONST(18449.073163656474 / 8.0),
- REAL_CONST(18464.614132540602 / 8.0),
- REAL_CONST(18480.158372174956 / 8.0),
- REAL_CONST(18495.705881183676 / 8.0),
- REAL_CONST(18511.256658192357 / 8.0),
- REAL_CONST(18526.810701828035 / 8.0),
- REAL_CONST(18542.368010719183 / 8.0),
- REAL_CONST(18557.928583495715 / 8.0),
- REAL_CONST(18573.492418788985 / 8.0),
- REAL_CONST(18589.059515231773 / 8.0),
- REAL_CONST(18604.629871458303 / 8.0),
- REAL_CONST(18620.203486104212 / 8.0),
- REAL_CONST(18635.78035780658 / 8.0),
- REAL_CONST(18651.360485203899 / 8.0),
- REAL_CONST(18666.943866936086 / 8.0),
- REAL_CONST(18682.53050164448 / 8.0),
- REAL_CONST(18698.120387971841 / 8.0),
- REAL_CONST(18713.713524562332 / 8.0),
- REAL_CONST(18729.30991006154 / 8.0),
- REAL_CONST(18744.909543116457 / 8.0),
- REAL_CONST(18760.512422375479 / 8.0),
- REAL_CONST(18776.118546488418 / 8.0),
- REAL_CONST(18791.727914106479 / 8.0),
- REAL_CONST(18807.340523882274 / 8.0),
- REAL_CONST(18822.95637446981 / 8.0),
- REAL_CONST(18838.575464524489 / 8.0),
- REAL_CONST(18854.197792703111 / 8.0),
- REAL_CONST(18869.823357663863 / 8.0),
- REAL_CONST(18885.452158066328 / 8.0),
- REAL_CONST(18901.08419257147 / 8.0),
- REAL_CONST(18916.719459841639 / 8.0),
- REAL_CONST(18932.357958540564 / 8.0),
- REAL_CONST(18947.999687333362 / 8.0),
- REAL_CONST(18963.644644886521 / 8.0),
- REAL_CONST(18979.292829867907 / 8.0),
- REAL_CONST(18994.944240946759 / 8.0),
- REAL_CONST(19010.598876793687 / 8.0),
- REAL_CONST(19026.256736080668 / 8.0),
- REAL_CONST(19041.917817481048 / 8.0),
- REAL_CONST(19057.582119669532 / 8.0),
- REAL_CONST(19073.2496413222 / 8.0),
- REAL_CONST(19088.920381116473 / 8.0),
- REAL_CONST(19104.594337731145 / 8.0),
- REAL_CONST(19120.271509846356 / 8.0),
- REAL_CONST(19135.951896143604 / 8.0),
- REAL_CONST(19151.635495305738 / 8.0),
- REAL_CONST(19167.322306016948 / 8.0),
- REAL_CONST(19183.012326962784 / 8.0),
- REAL_CONST(19198.705556830122 / 8.0),
- REAL_CONST(19214.401994307198 / 8.0),
- REAL_CONST(19230.101638083579 / 8.0),
- REAL_CONST(19245.804486850167 / 8.0),
- REAL_CONST(19261.510539299208 / 8.0),
- REAL_CONST(19277.219794124274 / 8.0),
- REAL_CONST(19292.932250020265 / 8.0),
- REAL_CONST(19308.647905683421 / 8.0),
- REAL_CONST(19324.366759811302 / 8.0),
- REAL_CONST(19340.088811102793 / 8.0),
- REAL_CONST(19355.8140582581 / 8.0),
- REAL_CONST(19371.542499978754 / 8.0),
- REAL_CONST(19387.2741349676 / 8.0),
- REAL_CONST(19403.008961928797 / 8.0),
- REAL_CONST(19418.746979567823 / 8.0),
- REAL_CONST(19434.488186591469 / 8.0),
- REAL_CONST(19450.232581707827 / 8.0),
- REAL_CONST(19465.980163626304 / 8.0),
- REAL_CONST(19481.730931057613 / 8.0),
- REAL_CONST(19497.484882713761 / 8.0),
- REAL_CONST(19513.242017308068 / 8.0),
- REAL_CONST(19529.002333555141 / 8.0),
- REAL_CONST(19544.765830170898 / 8.0),
- REAL_CONST(19560.532505872539 / 8.0),
- REAL_CONST(19576.302359378566 / 8.0),
- REAL_CONST(19592.075389408761 / 8.0),
- REAL_CONST(19607.851594684209 / 8.0),
- REAL_CONST(19623.630973927269 / 8.0),
- REAL_CONST(19639.41352586159 / 8.0),
- REAL_CONST(19655.199249212103 / 8.0),
- REAL_CONST(19670.988142705017 / 8.0),
- REAL_CONST(19686.780205067826 / 8.0),
- REAL_CONST(19702.575435029288 / 8.0),
- REAL_CONST(19718.373831319448 / 8.0),
- REAL_CONST(19734.175392669615 / 8.0),
- REAL_CONST(19749.980117812371 / 8.0),
- REAL_CONST(19765.788005481569 / 8.0),
- REAL_CONST(19781.599054412323 / 8.0),
- REAL_CONST(19797.413263341008 / 8.0),
- REAL_CONST(19813.230631005274 / 8.0),
- REAL_CONST(19829.051156144014 / 8.0),
- REAL_CONST(19844.874837497395 / 8.0),
- REAL_CONST(19860.701673806827 / 8.0),
- REAL_CONST(19876.531663814985 / 8.0),
- REAL_CONST(19892.364806265789 / 8.0),
- REAL_CONST(19908.201099904403 / 8.0),
- REAL_CONST(19924.040543477258 / 8.0),
- REAL_CONST(19939.883135732012 / 8.0),
- REAL_CONST(19955.728875417579 / 8.0),
- REAL_CONST(19971.577761284105 / 8.0),
- REAL_CONST(19987.429792082985 / 8.0),
- REAL_CONST(20003.284966566847 / 8.0),
- REAL_CONST(20019.14328348956 / 8.0),
- REAL_CONST(20035.004741606219 / 8.0),
- REAL_CONST(20050.869339673161 / 8.0),
- REAL_CONST(20066.737076447946 / 8.0),
- REAL_CONST(20082.607950689362 / 8.0),
- REAL_CONST(20098.481961157428 / 8.0),
- REAL_CONST(20114.359106613385 / 8.0),
- REAL_CONST(20130.239385819699 / 8.0),
- REAL_CONST(20146.122797540058 / 8.0),
- REAL_CONST(20162.009340539353 / 8.0),
- REAL_CONST(20177.899013583716 / 8.0),
- REAL_CONST(20193.791815440476 / 8.0),
- REAL_CONST(20209.687744878182 / 8.0),
- REAL_CONST(20225.586800666591 / 8.0),
- REAL_CONST(20241.488981576669 / 8.0),
- REAL_CONST(20257.394286380597 / 8.0),
- REAL_CONST(20273.302713851754 / 8.0),
- REAL_CONST(20289.214262764715 / 8.0),
- REAL_CONST(20305.128931895277 / 8.0),
- REAL_CONST(20321.046720020415 / 8.0),
- REAL_CONST(20336.967625918318 / 8.0),
- REAL_CONST(20352.891648368361 / 8.0),
- REAL_CONST(20368.818786151114 / 8.0),
- REAL_CONST(20384.749038048347 / 8.0),
- REAL_CONST(20400.682402843009 / 8.0),
- REAL_CONST(20416.618879319249 / 8.0),
- REAL_CONST(20432.558466262391 / 8.0),
- REAL_CONST(20448.501162458953 / 8.0),
- REAL_CONST(20464.446966696629 / 8.0),
- REAL_CONST(20480.395877764302 / 8.0),
- REAL_CONST(20496.347894452025 / 8.0),
- REAL_CONST(20512.303015551031 / 8.0),
- REAL_CONST(20528.261239853735 / 8.0),
- REAL_CONST(20544.22256615372 / 8.0),
- REAL_CONST(20560.186993245738 / 8.0),
- REAL_CONST(20576.15451992572 / 8.0),
- REAL_CONST(20592.125144990758 / 8.0),
- REAL_CONST(20608.098867239107 / 8.0),
- REAL_CONST(20624.075685470198 / 8.0),
- REAL_CONST(20640.055598484618 / 8.0),
- REAL_CONST(20656.038605084115 / 8.0),
- REAL_CONST(20672.024704071595 / 8.0),
- REAL_CONST(20688.013894251126 / 8.0),
- REAL_CONST(20704.006174427926 / 8.0),
- REAL_CONST(20720.001543408373 / 8.0),
- REAL_CONST(20735.999999999989 / 8.0),
- REAL_CONST(20752.001543011454 / 8.0),
- REAL_CONST(20768.006171252597 / 8.0),
- REAL_CONST(20784.013883534382 / 8.0),
- REAL_CONST(20800.024678668931 / 8.0),
- REAL_CONST(20816.038555469506 / 8.0),
- REAL_CONST(20832.055512750507 / 8.0),
- REAL_CONST(20848.075549327474 / 8.0),
- REAL_CONST(20864.098664017085 / 8.0),
- REAL_CONST(20880.124855637161 / 8.0),
- REAL_CONST(20896.154123006647 / 8.0),
- REAL_CONST(20912.186464945626 / 8.0),
- REAL_CONST(20928.221880275312 / 8.0),
- REAL_CONST(20944.260367818049 / 8.0),
- REAL_CONST(20960.301926397311 / 8.0),
- REAL_CONST(20976.346554837684 / 8.0),
- REAL_CONST(20992.394251964895 / 8.0),
- REAL_CONST(21008.445016605787 / 8.0),
- REAL_CONST(21024.498847588318 / 8.0),
- REAL_CONST(21040.555743741574 / 8.0),
- REAL_CONST(21056.615703895754 / 8.0),
- REAL_CONST(21072.678726882168 / 8.0),
- REAL_CONST(21088.744811533252 / 8.0),
- REAL_CONST(21104.813956682538 / 8.0),
- REAL_CONST(21120.886161164683 / 8.0),
- REAL_CONST(21136.961423815443 / 8.0),
- REAL_CONST(21153.039743471683 / 8.0),
- REAL_CONST(21169.121118971379 / 8.0),
- REAL_CONST(21185.205549153605 / 8.0),
- REAL_CONST(21201.293032858535 / 8.0),
- REAL_CONST(21217.383568927453 / 8.0),
- REAL_CONST(21233.477156202731 / 8.0),
- REAL_CONST(21249.573793527841 / 8.0),
- REAL_CONST(21265.673479747358 / 8.0),
- REAL_CONST(21281.776213706937 / 8.0),
- REAL_CONST(21297.881994253334 / 8.0),
- REAL_CONST(21313.990820234398 / 8.0),
- REAL_CONST(21330.102690499054 / 8.0),
- REAL_CONST(21346.21760389733 / 8.0),
- REAL_CONST(21362.335559280327 / 8.0),
- REAL_CONST(21378.456555500241 / 8.0),
- REAL_CONST(21394.580591410333 / 8.0),
- REAL_CONST(21410.707665864964 / 8.0),
- REAL_CONST(21426.83777771956 / 8.0),
- REAL_CONST(21442.970925830628 / 8.0),
- REAL_CONST(21459.107109055756 / 8.0),
- REAL_CONST(21475.246326253604 / 8.0),
- REAL_CONST(21491.388576283895 / 8.0),
- REAL_CONST(21507.533858007431 / 8.0),
- REAL_CONST(21523.682170286087 / 8.0),
- REAL_CONST(21539.833511982797 / 8.0),
- REAL_CONST(21555.987881961566 / 8.0),
- REAL_CONST(21572.145279087465 / 8.0),
- REAL_CONST(21588.305702226615 / 8.0),
- REAL_CONST(21604.469150246216 / 8.0),
- REAL_CONST(21620.635622014521 / 8.0),
- REAL_CONST(21636.805116400832 / 8.0),
- REAL_CONST(21652.977632275521 / 8.0),
- REAL_CONST(21669.153168510009 / 8.0),
- REAL_CONST(21685.331723976764 / 8.0),
- REAL_CONST(21701.513297549318 / 8.0),
- REAL_CONST(21717.697888102244 / 8.0),
- REAL_CONST(21733.885494511167 / 8.0),
- REAL_CONST(21750.076115652759 / 8.0),
- REAL_CONST(21766.269750404736 / 8.0),
- REAL_CONST(21782.466397645861 / 8.0),
- REAL_CONST(21798.666056255934 / 8.0),
- REAL_CONST(21814.868725115801 / 8.0),
- REAL_CONST(21831.074403107345 / 8.0),
- REAL_CONST(21847.283089113484 / 8.0),
- REAL_CONST(21863.494782018177 / 8.0),
- REAL_CONST(21879.709480706417 / 8.0),
- REAL_CONST(21895.927184064229 / 8.0),
- REAL_CONST(21912.147890978667 / 8.0),
- REAL_CONST(21928.371600337818 / 8.0),
- REAL_CONST(21944.598311030797 / 8.0),
- REAL_CONST(21960.828021947746 / 8.0),
- REAL_CONST(21977.060731979829 / 8.0),
- REAL_CONST(21993.296440019243 / 8.0),
- REAL_CONST(22009.535144959198 / 8.0),
- REAL_CONST(22025.77684569393 / 8.0),
- REAL_CONST(22042.021541118691 / 8.0),
- REAL_CONST(22058.269230129757 / 8.0),
- REAL_CONST(22074.519911624411 / 8.0),
- REAL_CONST(22090.773584500959 / 8.0),
- REAL_CONST(22107.030247658717 / 8.0),
- REAL_CONST(22123.289899998013 / 8.0),
- REAL_CONST(22139.552540420187 / 8.0),
- REAL_CONST(22155.818167827587 / 8.0),
- REAL_CONST(22172.086781123569 / 8.0),
- REAL_CONST(22188.358379212495 / 8.0),
- REAL_CONST(22204.632960999726 / 8.0),
- REAL_CONST(22220.910525391639 / 8.0),
- REAL_CONST(22237.191071295601 / 8.0),
- REAL_CONST(22253.474597619981 / 8.0),
- REAL_CONST(22269.761103274148 / 8.0),
- REAL_CONST(22286.050587168469 / 8.0),
- REAL_CONST(22302.343048214312 / 8.0),
- REAL_CONST(22318.638485324027 / 8.0),
- REAL_CONST(22334.936897410968 / 8.0),
- REAL_CONST(22351.23828338947 / 8.0),
- REAL_CONST(22367.542642174871 / 8.0),
- REAL_CONST(22383.849972683485 / 8.0),
- REAL_CONST(22400.160273832618 / 8.0),
- REAL_CONST(22416.473544540564 / 8.0),
- REAL_CONST(22432.789783726603 / 8.0),
- REAL_CONST(22449.108990310986 / 8.0),
- REAL_CONST(22465.431163214958 / 8.0),
- REAL_CONST(22481.75630136074 / 8.0),
- REAL_CONST(22498.084403671528 / 8.0),
- REAL_CONST(22514.415469071497 / 8.0),
- REAL_CONST(22530.749496485802 / 8.0),
- REAL_CONST(22547.086484840562 / 8.0),
- REAL_CONST(22563.426433062879 / 8.0),
- REAL_CONST(22579.769340080824 / 8.0),
- REAL_CONST(22596.115204823436 / 8.0),
- REAL_CONST(22612.464026220721 / 8.0),
- REAL_CONST(22628.815803203655 / 8.0),
- REAL_CONST(22645.170534704179 / 8.0),
- REAL_CONST(22661.5282196552 / 8.0),
- REAL_CONST(22677.888856990587 / 8.0),
- REAL_CONST(22694.252445645168 / 8.0),
- REAL_CONST(22710.618984554734 / 8.0),
- REAL_CONST(22726.988472656034 / 8.0),
- REAL_CONST(22743.360908886778 / 8.0),
- REAL_CONST(22759.736292185622 / 8.0),
- REAL_CONST(22776.114621492186 / 8.0),
- REAL_CONST(22792.495895747044 / 8.0),
- REAL_CONST(22808.880113891719 / 8.0),
- REAL_CONST(22825.267274868678 / 8.0),
- REAL_CONST(22841.657377621348 / 8.0),
- REAL_CONST(22858.050421094096 / 8.0),
- REAL_CONST(22874.446404232243 / 8.0),
- REAL_CONST(22890.845325982053 / 8.0),
- REAL_CONST(22907.247185290722 / 8.0),
- REAL_CONST(22923.651981106406 / 8.0),
- REAL_CONST(22940.059712378195 / 8.0),
- REAL_CONST(22956.470378056114 / 8.0),
- REAL_CONST(22972.883977091129 / 8.0),
- REAL_CONST(22989.300508435153 / 8.0),
- REAL_CONST(23005.719971041017 / 8.0),
- REAL_CONST(23022.142363862498 / 8.0),
- REAL_CONST(23038.567685854305 / 8.0),
- REAL_CONST(23054.995935972078 / 8.0),
- REAL_CONST(23071.427113172387 / 8.0),
- REAL_CONST(23087.86121641273 / 8.0),
- REAL_CONST(23104.298244651531 / 8.0),
- REAL_CONST(23120.738196848146 / 8.0),
- REAL_CONST(23137.181071962848 / 8.0),
- REAL_CONST(23153.626868956846 / 8.0),
- REAL_CONST(23170.075586792263 / 8.0),
- REAL_CONST(23186.527224432142 / 8.0),
- REAL_CONST(23202.981780840448 / 8.0),
- REAL_CONST(23219.439254982066 / 8.0),
- REAL_CONST(23235.899645822796 / 8.0),
- REAL_CONST(23252.362952329357 / 8.0),
- REAL_CONST(23268.829173469378 / 8.0),
- REAL_CONST(23285.298308211408 / 8.0),
- REAL_CONST(23301.770355524899 / 8.0),
- REAL_CONST(23318.245314380223 / 8.0),
- REAL_CONST(23334.723183748658 / 8.0),
- REAL_CONST(23351.203962602387 / 8.0),
- REAL_CONST(23367.687649914504 / 8.0),
- REAL_CONST(23384.174244659007 / 8.0),
- REAL_CONST(23400.663745810798 / 8.0),
- REAL_CONST(23417.15615234568 / 8.0),
- REAL_CONST(23433.651463240367 / 8.0),
- REAL_CONST(23450.149677472462 / 8.0),
- REAL_CONST(23466.650794020472 / 8.0),
- REAL_CONST(23483.154811863806 / 8.0),
- REAL_CONST(23499.661729982763 / 8.0),
- REAL_CONST(23516.171547358543 / 8.0),
- REAL_CONST(23532.684262973235 / 8.0),
- REAL_CONST(23549.199875809823 / 8.0),
- REAL_CONST(23565.718384852185 / 8.0),
- REAL_CONST(23582.239789085092 / 8.0),
- REAL_CONST(23598.764087494197 / 8.0),
- REAL_CONST(23615.291279066041 / 8.0),
- REAL_CONST(23631.821362788058 / 8.0),
- REAL_CONST(23648.354337648565 / 8.0),
- REAL_CONST(23664.890202636761 / 8.0),
- REAL_CONST(23681.428956742733 / 8.0),
- REAL_CONST(23697.970598957443 / 8.0),
- REAL_CONST(23714.515128272738 / 8.0),
- REAL_CONST(23731.062543681343 / 8.0),
- REAL_CONST(23747.612844176863 / 8.0),
- REAL_CONST(23764.166028753778 / 8.0),
- REAL_CONST(23780.72209640744 / 8.0),
- REAL_CONST(23797.281046134085 / 8.0),
- REAL_CONST(23813.842876930816 / 8.0),
- REAL_CONST(23830.407587795606 / 8.0),
- REAL_CONST(23846.975177727301 / 8.0),
- REAL_CONST(23863.545645725622 / 8.0),
- REAL_CONST(23880.11899079115 / 8.0),
- REAL_CONST(23896.695211925336 / 8.0),
- REAL_CONST(23913.274308130498 / 8.0),
- REAL_CONST(23929.856278409821 / 8.0),
- REAL_CONST(23946.441121767348 / 8.0),
- REAL_CONST(23963.028837207989 / 8.0),
- REAL_CONST(23979.619423737513 / 8.0),
- REAL_CONST(23996.212880362549 / 8.0),
- REAL_CONST(24012.809206090584 / 8.0),
- REAL_CONST(24029.408399929966 / 8.0),
- REAL_CONST(24046.010460889898 / 8.0),
- REAL_CONST(24062.615387980433 / 8.0),
- REAL_CONST(24079.223180212492 / 8.0),
- REAL_CONST(24095.833836597827 / 8.0),
- REAL_CONST(24112.447356149063 / 8.0),
- REAL_CONST(24129.063737879667 / 8.0),
- REAL_CONST(24145.682980803951 / 8.0),
- REAL_CONST(24162.305083937081 / 8.0),
- REAL_CONST(24178.930046295067 / 8.0),
- REAL_CONST(24195.557866894767 / 8.0),
- REAL_CONST(24212.188544753884 / 8.0),
- REAL_CONST(24228.822078890964 / 8.0),
- REAL_CONST(24245.458468325389 / 8.0),
- REAL_CONST(24262.097712077397 / 8.0),
- REAL_CONST(24278.739809168052 / 8.0),
- REAL_CONST(24295.384758619261 / 8.0),
- REAL_CONST(24312.032559453768 / 8.0),
- REAL_CONST(24328.683210695162 / 8.0),
- REAL_CONST(24345.336711367858 / 8.0),
- REAL_CONST(24361.993060497109 / 8.0),
- REAL_CONST(24378.652257108995 / 8.0),
- REAL_CONST(24395.314300230442 / 8.0),
- REAL_CONST(24411.979188889192 / 8.0),
- REAL_CONST(24428.646922113825 / 8.0),
- REAL_CONST(24445.317498933746 / 8.0),
- REAL_CONST(24461.990918379193 / 8.0),
- REAL_CONST(24478.667179481225 / 8.0),
- REAL_CONST(24495.346281271726 / 8.0),
- REAL_CONST(24512.028222783407 / 8.0),
- REAL_CONST(24528.713003049801 / 8.0),
- REAL_CONST(24545.400621105266 / 8.0),
- REAL_CONST(24562.091075984976 / 8.0),
- REAL_CONST(24578.784366724925 / 8.0),
- REAL_CONST(24595.480492361927 / 8.0),
- REAL_CONST(24612.179451933614 / 8.0),
- REAL_CONST(24628.881244478438 / 8.0),
- REAL_CONST(24645.585869035654 / 8.0),
- REAL_CONST(24662.293324645343 / 8.0),
- REAL_CONST(24679.003610348394 / 8.0),
- REAL_CONST(24695.716725186514 / 8.0),
- REAL_CONST(24712.432668202211 / 8.0),
- REAL_CONST(24729.151438438807 / 8.0),
- REAL_CONST(24745.873034940436 / 8.0),
- REAL_CONST(24762.597456752032 / 8.0),
- REAL_CONST(24779.324702919344 / 8.0),
- REAL_CONST(24796.054772488926 / 8.0),
- REAL_CONST(24812.787664508123 / 8.0),
- REAL_CONST(24829.5233780251 / 8.0),
- REAL_CONST(24846.261912088819 / 8.0),
- REAL_CONST(24863.003265749034 / 8.0),
- REAL_CONST(24879.747438056307 / 8.0),
- REAL_CONST(24896.494428062004 / 8.0),
- REAL_CONST(24913.244234818278 / 8.0),
- REAL_CONST(24929.996857378079 / 8.0),
- REAL_CONST(24946.752294795166 / 8.0),
- REAL_CONST(24963.510546124078 / 8.0),
- REAL_CONST(24980.271610420157 / 8.0),
- REAL_CONST(24997.035486739525 / 8.0),
- REAL_CONST(25013.802174139113 / 8.0),
- REAL_CONST(25030.571671676629 / 8.0),
- REAL_CONST(25047.343978410572 / 8.0),
- REAL_CONST(25064.119093400237 / 8.0),
- REAL_CONST(25080.897015705697 / 8.0),
- REAL_CONST(25097.677744387816 / 8.0),
- REAL_CONST(25114.461278508239 / 8.0),
- REAL_CONST(25131.2476171294 / 8.0),
- REAL_CONST(25148.036759314517 / 8.0),
- REAL_CONST(25164.828704127583 / 8.0),
- REAL_CONST(25181.623450633375 / 8.0),
- REAL_CONST(25198.42099789745 / 8.0),
- REAL_CONST(25215.221344986145 / 8.0),
- REAL_CONST(25232.024490966574 / 8.0),
- REAL_CONST(25248.830434906627 / 8.0),
- REAL_CONST(25265.639175874974 / 8.0),
- REAL_CONST(25282.450712941049 / 8.0),
- REAL_CONST(25299.265045175071 / 8.0),
- REAL_CONST(25316.082171648024 / 8.0),
- REAL_CONST(25332.902091431668 / 8.0),
- REAL_CONST(25349.724803598532 / 8.0),
- REAL_CONST(25366.550307221914 / 8.0),
- REAL_CONST(25383.378601375884 / 8.0),
- REAL_CONST(25400.209685135269 / 8.0),
- REAL_CONST(25417.043557575678 / 8.0),
- REAL_CONST(25433.880217773472 / 8.0),
- REAL_CONST(25450.719664805783 / 8.0),
- REAL_CONST(25467.561897750507 / 8.0),
- REAL_CONST(25484.406915686297 / 8.0),
- REAL_CONST(25501.254717692573 / 8.0),
- REAL_CONST(25518.105302849512 / 8.0),
- REAL_CONST(25534.958670238051 / 8.0),
- REAL_CONST(25551.814818939893 / 8.0),
- REAL_CONST(25568.67374803748 / 8.0),
- REAL_CONST(25585.535456614027 / 8.0),
- REAL_CONST(25602.399943753502 / 8.0),
- REAL_CONST(25619.267208540619 / 8.0),
- REAL_CONST(25636.137250060852 / 8.0),
- REAL_CONST(25653.010067400432 / 8.0),
- REAL_CONST(25669.885659646327 / 8.0),
- REAL_CONST(25686.76402588627 / 8.0),
- REAL_CONST(25703.645165208734 / 8.0),
- REAL_CONST(25720.529076702944 / 8.0),
- REAL_CONST(25737.415759458876 / 8.0),
- REAL_CONST(25754.305212567244 / 8.0),
- REAL_CONST(25771.197435119517 / 8.0),
- REAL_CONST(25788.092426207899 / 8.0),
- REAL_CONST(25804.990184925344 / 8.0),
- REAL_CONST(25821.890710365547 / 8.0),
- REAL_CONST(25838.794001622944 / 8.0),
- REAL_CONST(25855.700057792714 / 8.0),
- REAL_CONST(25872.608877970775 / 8.0),
- REAL_CONST(25889.520461253778 / 8.0),
- REAL_CONST(25906.434806739118 / 8.0),
- REAL_CONST(25923.351913524923 / 8.0),
- REAL_CONST(25940.271780710063 / 8.0),
- REAL_CONST(25957.194407394138 / 8.0),
- REAL_CONST(25974.11979267748 / 8.0),
- REAL_CONST(25991.047935661154 / 8.0),
- REAL_CONST(26007.978835446964 / 8.0),
- REAL_CONST(26024.912491137442 / 8.0),
- REAL_CONST(26041.848901835841 / 8.0),
- REAL_CONST(26058.788066646157 / 8.0),
- REAL_CONST(26075.729984673108 / 8.0),
- REAL_CONST(26092.674655022136 / 8.0),
- REAL_CONST(26109.622076799409 / 8.0),
- REAL_CONST(26126.572249111829 / 8.0),
- REAL_CONST(26143.525171067016 / 8.0),
- REAL_CONST(26160.480841773315 / 8.0),
- REAL_CONST(26177.43926033979 / 8.0),
- REAL_CONST(26194.400425876229 / 8.0),
- REAL_CONST(26211.364337493149 / 8.0),
- REAL_CONST(26228.330994301767 / 8.0),
- REAL_CONST(26245.30039541404 / 8.0),
- REAL_CONST(26262.272539942627 / 8.0),
- REAL_CONST(26279.247427000919 / 8.0),
- REAL_CONST(26296.225055703002 / 8.0),
- REAL_CONST(26313.205425163702 / 8.0),
- REAL_CONST(26330.188534498539 / 8.0),
- REAL_CONST(26347.174382823756 / 8.0),
- REAL_CONST(26364.162969256304 / 8.0),
- REAL_CONST(26381.154292913852 / 8.0),
- REAL_CONST(26398.148352914774 / 8.0),
- REAL_CONST(26415.145148378149 / 8.0),
- REAL_CONST(26432.144678423778 / 8.0),
- REAL_CONST(26449.146942172156 / 8.0),
- REAL_CONST(26466.151938744493 / 8.0),
- REAL_CONST(26483.159667262702 / 8.0),
- REAL_CONST(26500.170126849403 / 8.0),
- REAL_CONST(26517.183316627921 / 8.0),
- REAL_CONST(26534.199235722277 / 8.0),
- REAL_CONST(26551.217883257199 / 8.0),
- REAL_CONST(26568.239258358124 / 8.0),
- REAL_CONST(26585.263360151173 / 8.0),
- REAL_CONST(26602.290187763181 / 8.0),
- REAL_CONST(26619.319740321676 / 8.0),
- REAL_CONST(26636.352016954883 / 8.0),
- REAL_CONST(26653.387016791727 / 8.0),
- REAL_CONST(26670.424738961825 / 8.0),
- REAL_CONST(26687.465182595493 / 8.0),
- REAL_CONST(26704.508346823739 / 8.0),
- REAL_CONST(26721.554230778267 / 8.0),
- REAL_CONST(26738.602833591467 / 8.0),
- REAL_CONST(26755.65415439643 / 8.0),
- REAL_CONST(26772.708192326929 / 8.0),
- REAL_CONST(26789.764946517433 / 8.0),
- REAL_CONST(26806.824416103096 / 8.0),
- REAL_CONST(26823.886600219761 / 8.0),
- REAL_CONST(26840.95149800396 / 8.0),
- REAL_CONST(26858.019108592915 / 8.0),
- REAL_CONST(26875.089431124517 / 8.0),
- REAL_CONST(26892.162464737365 / 8.0),
- REAL_CONST(26909.238208570721 / 8.0),
- REAL_CONST(26926.316661764544 / 8.0),
- REAL_CONST(26943.397823459472 / 8.0),
- REAL_CONST(26960.481692796813 / 8.0),
- REAL_CONST(26977.568268918571 / 8.0),
- REAL_CONST(26994.657550967422 / 8.0),
- REAL_CONST(27011.749538086722 / 8.0),
- REAL_CONST(27028.844229420498 / 8.0),
- REAL_CONST(27045.941624113464 / 8.0),
- REAL_CONST(27063.041721311005 / 8.0),
- REAL_CONST(27080.144520159181 / 8.0),
- REAL_CONST(27097.250019804727 / 8.0),
- REAL_CONST(27114.35821939505 / 8.0),
- REAL_CONST(27131.469118078236 / 8.0),
- REAL_CONST(27148.582715003027 / 8.0),
- REAL_CONST(27165.699009318858 / 8.0),
- REAL_CONST(27182.818000175819 / 8.0),
- REAL_CONST(27199.939686724665 / 8.0),
- REAL_CONST(27217.064068116837 / 8.0),
- REAL_CONST(27234.191143504428 / 8.0),
- REAL_CONST(27251.320912040203 / 8.0),
- REAL_CONST(27268.453372877593 / 8.0),
- REAL_CONST(27285.588525170693 / 8.0),
- REAL_CONST(27302.726368074269 / 8.0),
- REAL_CONST(27319.866900743735 / 8.0),
- REAL_CONST(27337.010122335181 / 8.0),
- REAL_CONST(27354.156032005358 / 8.0),
- REAL_CONST(27371.304628911668 / 8.0),
- REAL_CONST(27388.455912212183 / 8.0),
- REAL_CONST(27405.609881065626 / 8.0),
- REAL_CONST(27422.766534631384 / 8.0),
- REAL_CONST(27439.925872069507 / 8.0),
- REAL_CONST(27457.087892540683 / 8.0),
- REAL_CONST(27474.252595206275 / 8.0),
- REAL_CONST(27491.419979228293 / 8.0),
- REAL_CONST(27508.5900437694 / 8.0),
- REAL_CONST(27525.762787992917 / 8.0),
- REAL_CONST(27542.93821106281 / 8.0),
- REAL_CONST(27560.116312143706 / 8.0),
- REAL_CONST(27577.297090400876 / 8.0),
- REAL_CONST(27594.480545000242 / 8.0),
- REAL_CONST(27611.666675108383 / 8.0),
- REAL_CONST(27628.855479892518 / 8.0),
- REAL_CONST(27646.046958520514 / 8.0),
- REAL_CONST(27663.241110160889 / 8.0),
- REAL_CONST(27680.437933982801 / 8.0),
- REAL_CONST(27697.637429156068 / 8.0),
- REAL_CONST(27714.839594851132 / 8.0),
- REAL_CONST(27732.04443023909 / 8.0),
- REAL_CONST(27749.251934491687 / 8.0),
- REAL_CONST(27766.462106781299 / 8.0),
- REAL_CONST(27783.674946280949 / 8.0),
- REAL_CONST(27800.890452164302 / 8.0),
- REAL_CONST(27818.108623605654 / 8.0),
- REAL_CONST(27835.329459779954 / 8.0),
- REAL_CONST(27852.55295986278 / 8.0),
- REAL_CONST(27869.779123030345 / 8.0),
- REAL_CONST(27887.007948459504 / 8.0),
- REAL_CONST(27904.239435327745 / 8.0),
- REAL_CONST(27921.473582813196 / 8.0),
- REAL_CONST(27938.710390094613 / 8.0),
- REAL_CONST(27955.949856351392 / 8.0),
- REAL_CONST(27973.19198076355 / 8.0),
- REAL_CONST(27990.436762511745 / 8.0),
- REAL_CONST(28007.684200777272 / 8.0),
- REAL_CONST(28024.934294742041 / 8.0),
- REAL_CONST(28042.187043588601 / 8.0),
- REAL_CONST(28059.442446500128 / 8.0),
- REAL_CONST(28076.700502660427 / 8.0),
- REAL_CONST(28093.961211253929 / 8.0),
- REAL_CONST(28111.224571465693 / 8.0),
- REAL_CONST(28128.490582481401 / 8.0),
- REAL_CONST(28145.759243487362 / 8.0),
- REAL_CONST(28163.030553670509 / 8.0),
- REAL_CONST(28180.304512218394 / 8.0),
- REAL_CONST(28197.581118319198 / 8.0),
- REAL_CONST(28214.860371161725 / 8.0),
- REAL_CONST(28232.14226993539 / 8.0),
- REAL_CONST(28249.42681383024 / 8.0),
- REAL_CONST(28266.71400203693 / 8.0),
- REAL_CONST(28284.003833746745 / 8.0),
- REAL_CONST(28301.296308151585 / 8.0),
- REAL_CONST(28318.591424443959 / 8.0),
- REAL_CONST(28335.889181817001 / 8.0),
- REAL_CONST(28353.189579464462 / 8.0),
- REAL_CONST(28370.492616580705 / 8.0),
- REAL_CONST(28387.798292360701 / 8.0),
- REAL_CONST(28405.106606000048 / 8.0),
- REAL_CONST(28422.417556694945 / 8.0),
- REAL_CONST(28439.731143642206 / 8.0),
- REAL_CONST(28457.047366039264 / 8.0),
- REAL_CONST(28474.366223084147 / 8.0),
- REAL_CONST(28491.687713975512 / 8.0),
- REAL_CONST(28509.011837912611 / 8.0),
- REAL_CONST(28526.338594095305 / 8.0),
- REAL_CONST(28543.667981724069 / 8.0),
- REAL_CONST(28560.999999999982 / 8.0),
- REAL_CONST(28578.334648124732 / 8.0),
- REAL_CONST(28595.671925300605 / 8.0),
- REAL_CONST(28613.011830730498 / 8.0),
- REAL_CONST(28630.354363617909 / 8.0),
- REAL_CONST(28647.699523166943 / 8.0),
- REAL_CONST(28665.0473085823 / 8.0),
- REAL_CONST(28682.397719069289 / 8.0),
- REAL_CONST(28699.750753833818 / 8.0),
- REAL_CONST(28717.10641208239 / 8.0),
- REAL_CONST(28734.464693022121 / 8.0),
- REAL_CONST(28751.825595860708 / 8.0),
- REAL_CONST(28769.189119806462 / 8.0),
- REAL_CONST(28786.55526406828 / 8.0),
- REAL_CONST(28803.924027855664 / 8.0),
- REAL_CONST(28821.295410378701 / 8.0),
- REAL_CONST(28838.669410848088 / 8.0),
- REAL_CONST(28856.046028475103 / 8.0),
- REAL_CONST(28873.425262471628 / 8.0),
- REAL_CONST(28890.80711205013 / 8.0),
- REAL_CONST(28908.191576423673 / 8.0),
- REAL_CONST(28925.578654805915 / 8.0),
- REAL_CONST(28942.968346411097 / 8.0),
- REAL_CONST(28960.360650454055 / 8.0),
- REAL_CONST(28977.755566150216 / 8.0),
- REAL_CONST(28995.153092715591 / 8.0),
- REAL_CONST(29012.553229366786 / 8.0),
- REAL_CONST(29029.955975320987 / 8.0),
- REAL_CONST(29047.361329795975 / 8.0),
- REAL_CONST(29064.769292010107 / 8.0),
- REAL_CONST(29082.179861182336 / 8.0),
- REAL_CONST(29099.593036532187 / 8.0),
- REAL_CONST(29117.00881727978 / 8.0),
- REAL_CONST(29134.427202645813 / 8.0),
- REAL_CONST(29151.848191851568 / 8.0),
- REAL_CONST(29169.271784118911 / 8.0),
- REAL_CONST(29186.697978670283 / 8.0),
- REAL_CONST(29204.126774728706 / 8.0),
- REAL_CONST(29221.55817151779 / 8.0),
- REAL_CONST(29238.992168261717 / 8.0),
- REAL_CONST(29256.42876418525 / 8.0),
- REAL_CONST(29273.867958513725 / 8.0),
- REAL_CONST(29291.309750473058 / 8.0),
- REAL_CONST(29308.754139289747 / 8.0),
- REAL_CONST(29326.201124190855 / 8.0),
- REAL_CONST(29343.65070440403 / 8.0),
- REAL_CONST(29361.102879157483 / 8.0),
- REAL_CONST(29378.557647680012 / 8.0),
- REAL_CONST(29396.015009200975 / 8.0),
- REAL_CONST(29413.474962950309 / 8.0),
- REAL_CONST(29430.937508158524 / 8.0),
- REAL_CONST(29448.402644056692 / 8.0),
- REAL_CONST(29465.870369876469 / 8.0),
- REAL_CONST(29483.340684850071 / 8.0),
- REAL_CONST(29500.81358821028 / 8.0),
- REAL_CONST(29518.289079190454 / 8.0),
- REAL_CONST(29535.767157024511 / 8.0),
- REAL_CONST(29553.247820946945 / 8.0),
- REAL_CONST(29570.731070192807 / 8.0),
- REAL_CONST(29588.216903997723 / 8.0),
- REAL_CONST(29605.70532159787 / 8.0),
- REAL_CONST(29623.19632223 / 8.0),
- REAL_CONST(29640.689905131429 / 8.0),
- REAL_CONST(29658.186069540028 / 8.0),
- REAL_CONST(29675.684814694236 / 8.0),
- REAL_CONST(29693.186139833047 / 8.0),
- REAL_CONST(29710.690044196028 / 8.0),
- REAL_CONST(29728.196527023298 / 8.0),
- REAL_CONST(29745.705587555527 / 8.0),
- REAL_CONST(29763.217225033964 / 8.0),
- REAL_CONST(29780.731438700397 / 8.0),
- REAL_CONST(29798.248227797183 / 8.0),
- REAL_CONST(29815.76759156723 / 8.0),
- REAL_CONST(29833.289529254005 / 8.0),
- REAL_CONST(29850.81404010153 / 8.0),
- REAL_CONST(29868.341123354381 / 8.0),
- REAL_CONST(29885.870778257693 / 8.0),
- REAL_CONST(29903.403004057145 / 8.0),
- REAL_CONST(29920.937799998974 / 8.0),
- REAL_CONST(29938.475165329975 / 8.0),
- REAL_CONST(29956.015099297485 / 8.0),
- REAL_CONST(29973.557601149394 / 8.0),
- REAL_CONST(29991.102670134147 / 8.0),
- REAL_CONST(30008.650305500738 / 8.0),
- REAL_CONST(30026.200506498706 / 8.0),
- REAL_CONST(30043.753272378144 / 8.0),
- REAL_CONST(30061.308602389683 / 8.0),
- REAL_CONST(30078.866495784507 / 8.0),
- REAL_CONST(30096.426951814352 / 8.0),
- REAL_CONST(30113.989969731494 / 8.0),
- REAL_CONST(30131.55554878875 / 8.0),
- REAL_CONST(30149.123688239491 / 8.0),
- REAL_CONST(30166.694387337629 / 8.0),
- REAL_CONST(30184.267645337608 / 8.0),
- REAL_CONST(30201.843461494434 / 8.0),
- REAL_CONST(30219.42183506364 / 8.0),
- REAL_CONST(30237.002765301309 / 8.0),
- REAL_CONST(30254.586251464058 / 8.0),
- REAL_CONST(30272.172292809046 / 8.0),
- REAL_CONST(30289.760888593977 / 8.0),
- REAL_CONST(30307.35203807709 / 8.0),
- REAL_CONST(30324.94574051716 / 8.0),
- REAL_CONST(30342.541995173502 / 8.0),
- REAL_CONST(30360.140801305966 / 8.0),
- REAL_CONST(30377.742158174944 / 8.0),
- REAL_CONST(30395.346065041358 / 8.0),
- REAL_CONST(30412.952521166666 / 8.0),
- REAL_CONST(30430.561525812864 / 8.0),
- REAL_CONST(30448.173078242475 / 8.0),
- REAL_CONST(30465.787177718561 / 8.0),
- REAL_CONST(30483.403823504719 / 8.0),
- REAL_CONST(30501.02301486507 / 8.0),
- REAL_CONST(30518.644751064272 / 8.0),
- REAL_CONST(30536.269031367516 / 8.0),
- REAL_CONST(30553.895855040515 / 8.0),
- REAL_CONST(30571.525221349519 / 8.0),
- REAL_CONST(30589.157129561307 / 8.0),
- REAL_CONST(30606.791578943175 / 8.0),
- REAL_CONST(30624.428568762964 / 8.0),
- REAL_CONST(30642.06809828903 / 8.0),
- REAL_CONST(30659.710166790261 / 8.0),
- REAL_CONST(30677.35477353607 / 8.0),
- REAL_CONST(30695.001917796391 / 8.0),
- REAL_CONST(30712.651598841687 / 8.0),
- REAL_CONST(30730.303815942945 / 8.0),
- REAL_CONST(30747.958568371676 / 8.0),
- REAL_CONST(30765.615855399912 / 8.0),
- REAL_CONST(30783.275676300211 / 8.0),
- REAL_CONST(30800.938030345646 / 8.0),
- REAL_CONST(30818.602916809814 / 8.0),
- REAL_CONST(30836.270334966837 / 8.0),
- REAL_CONST(30853.940284091354 / 8.0),
- REAL_CONST(30871.612763458521 / 8.0),
- REAL_CONST(30889.287772344011 / 8.0),
- REAL_CONST(30906.965310024025 / 8.0),
- REAL_CONST(30924.645375775272 / 8.0),
- REAL_CONST(30942.327968874983 / 8.0),
- REAL_CONST(30960.013088600903 / 8.0),
- REAL_CONST(30977.700734231294 / 8.0),
- REAL_CONST(30995.390905044929 / 8.0),
- REAL_CONST(31013.083600321101 / 8.0),
- REAL_CONST(31030.778819339619 / 8.0),
- REAL_CONST(31048.476561380798 / 8.0),
- REAL_CONST(31066.17682572547 / 8.0),
- REAL_CONST(31083.879611654978 / 8.0),
- REAL_CONST(31101.584918451179 / 8.0),
- REAL_CONST(31119.29274539644 / 8.0),
- REAL_CONST(31137.003091773637 / 8.0),
- REAL_CONST(31154.715956866155 / 8.0),
- REAL_CONST(31172.431339957893 / 8.0),
- REAL_CONST(31190.14924033326 / 8.0),
- REAL_CONST(31207.869657277162 / 8.0),
- REAL_CONST(31225.592590075023 / 8.0),
- REAL_CONST(31243.318038012771 / 8.0),
- REAL_CONST(31261.046000376838 / 8.0),
- REAL_CONST(31278.776476454172 / 8.0),
- REAL_CONST(31296.50946553221 / 8.0),
- REAL_CONST(31314.24496689891 / 8.0),
- REAL_CONST(31331.98297984272 / 8.0),
- REAL_CONST(31349.7235036526 / 8.0),
- REAL_CONST(31367.466537618013 / 8.0),
- REAL_CONST(31385.212081028923 / 8.0),
- REAL_CONST(31402.960133175795 / 8.0),
- REAL_CONST(31420.710693349596 / 8.0),
- REAL_CONST(31438.463760841791 / 8.0),
- REAL_CONST(31456.219334944351 / 8.0),
- REAL_CONST(31473.977414949743 / 8.0),
- REAL_CONST(31491.738000150934 / 8.0),
- REAL_CONST(31509.501089841389 / 8.0),
- REAL_CONST(31527.266683315069 / 8.0),
- REAL_CONST(31545.034779866437 / 8.0),
- REAL_CONST(31562.80537879045 / 8.0),
- REAL_CONST(31580.578479382562 / 8.0),
- REAL_CONST(31598.35408093872 / 8.0),
- REAL_CONST(31616.132182755369 / 8.0),
- REAL_CONST(31633.91278412945 / 8.0),
- REAL_CONST(31651.695884358396 / 8.0),
- REAL_CONST(31669.481482740131 / 8.0),
- REAL_CONST(31687.269578573076 / 8.0),
- REAL_CONST(31705.060171156143 / 8.0),
- REAL_CONST(31722.853259788735 / 8.0),
- REAL_CONST(31740.648843770748 / 8.0),
- REAL_CONST(31758.446922402567 / 8.0),
- REAL_CONST(31776.247494985066 / 8.0),
- REAL_CONST(31794.050560819614 / 8.0),
- REAL_CONST(31811.85611920806 / 8.0),
- REAL_CONST(31829.664169452753 / 8.0),
- REAL_CONST(31847.474710856521 / 8.0),
- REAL_CONST(31865.287742722685 / 8.0),
- REAL_CONST(31883.103264355046 / 8.0),
- REAL_CONST(31900.921275057899 / 8.0),
- REAL_CONST(31918.741774136019 / 8.0),
- REAL_CONST(31936.564760894671 / 8.0),
- REAL_CONST(31954.390234639599 / 8.0),
- REAL_CONST(31972.21819467704 / 8.0),
- REAL_CONST(31990.048640313704 / 8.0),
- REAL_CONST(32007.881570856793 / 8.0),
- REAL_CONST(32025.716985613984 / 8.0),
- REAL_CONST(32043.554883893445 / 8.0),
- REAL_CONST(32061.395265003815 / 8.0),
- REAL_CONST(32079.238128254223 / 8.0),
- REAL_CONST(32097.083472954269 / 8.0),
- REAL_CONST(32114.931298414049 / 8.0),
- REAL_CONST(32132.781603944117 / 8.0),
- REAL_CONST(32150.634388855524 / 8.0),
- REAL_CONST(32168.48965245979 / 8.0),
- REAL_CONST(32186.347394068915 / 8.0),
- REAL_CONST(32204.207612995371 / 8.0),
- REAL_CONST(32222.07030855212 / 8.0),
- REAL_CONST(32239.935480052583 / 8.0),
- REAL_CONST(32257.803126810672 / 8.0),
- REAL_CONST(32275.673248140767 / 8.0),
- REAL_CONST(32293.545843357719 / 8.0),
- REAL_CONST(32311.420911776862 / 8.0),
- REAL_CONST(32329.298452713996 / 8.0),
- REAL_CONST(32347.178465485395 / 8.0),
- REAL_CONST(32365.060949407813 / 8.0),
- REAL_CONST(32382.945903798463 / 8.0),
- REAL_CONST(32400.83332797504 / 8.0),
- REAL_CONST(32418.723221255706 / 8.0),
- REAL_CONST(32436.615582959093 / 8.0),
- REAL_CONST(32454.510412404306 / 8.0),
- REAL_CONST(32472.407708910916 / 8.0),
- REAL_CONST(32490.307471798966 / 8.0),
- REAL_CONST(32508.209700388961 / 8.0),
- REAL_CONST(32526.114394001877 / 8.0),
- REAL_CONST(32544.021551959166 / 8.0),
- REAL_CONST(32561.931173582732 / 8.0),
- REAL_CONST(32579.843258194956 / 8.0),
- REAL_CONST(32597.757805118679 / 8.0),
- REAL_CONST(32615.674813677211 / 8.0),
- REAL_CONST(32633.594283194328 / 8.0),
- REAL_CONST(32651.516212994258 / 8.0),
- REAL_CONST(32669.440602401712 / 8.0),
- REAL_CONST(32687.367450741847 / 8.0),
- REAL_CONST(32705.296757340297 / 8.0),
- REAL_CONST(32723.228521523146 / 8.0),
- REAL_CONST(32741.162742616943 / 8.0),
- REAL_CONST(32759.099419948703 / 8.0),
- REAL_CONST(32777.038552845901 / 8.0),
- REAL_CONST(32794.980140636464 / 8.0),
- REAL_CONST(32812.924182648792 / 8.0),
- REAL_CONST(32830.87067821173 / 8.0),
- REAL_CONST(32848.819626654593 / 8.0),
- REAL_CONST(32866.77102730715 / 8.0),
- REAL_CONST(32884.724879499619 / 8.0),
- REAL_CONST(32902.681182562686 / 8.0),
- REAL_CONST(32920.639935827494 / 8.0),
- REAL_CONST(32938.601138625643 / 8.0),
- REAL_CONST(32956.56479028918 / 8.0),
- REAL_CONST(32974.530890150607 / 8.0),
- REAL_CONST(32992.499437542894 / 8.0),
- REAL_CONST(33010.470431799447 / 8.0),
- REAL_CONST(33028.443872254145 / 8.0),
- REAL_CONST(33046.419758241311 / 8.0),
- REAL_CONST(33064.39808909571 / 8.0),
- REAL_CONST(33082.378864152583 / 8.0),
- REAL_CONST(33100.36208274759 / 8.0),
- REAL_CONST(33118.347744216881 / 8.0),
- REAL_CONST(33136.335847897026 / 8.0),
- REAL_CONST(33154.326393125062 / 8.0),
- REAL_CONST(33172.31937923847 / 8.0),
- REAL_CONST(33190.314805575174 / 8.0),
- REAL_CONST(33208.312671473555 / 8.0),
- REAL_CONST(33226.312976272442 / 8.0),
- REAL_CONST(33244.315719311111 / 8.0),
- REAL_CONST(33262.320899929284 / 8.0),
- REAL_CONST(33280.328517467125 / 8.0),
- REAL_CONST(33298.33857126526 / 8.0),
- REAL_CONST(33316.351060664747 / 8.0),
- REAL_CONST(33334.365985007091 / 8.0),
- REAL_CONST(33352.383343634239 / 8.0),
- REAL_CONST(33370.403135888591 / 8.0),
- REAL_CONST(33388.42536111299 / 8.0),
- REAL_CONST(33406.450018650721 / 8.0),
- REAL_CONST(33424.477107845501 / 8.0),
- REAL_CONST(33442.506628041512 / 8.0),
- REAL_CONST(33460.53857858335 / 8.0),
- REAL_CONST(33478.572958816083 / 8.0),
- REAL_CONST(33496.609768085189 / 8.0),
- REAL_CONST(33514.649005736617 / 8.0),
- REAL_CONST(33532.690671116739 / 8.0),
- REAL_CONST(33550.734763572356 / 8.0),
- REAL_CONST(33568.781282450735 / 8.0),
- REAL_CONST(33586.830227099563 / 8.0),
- REAL_CONST(33604.881596866973 / 8.0),
- REAL_CONST(33622.935391101528 / 8.0),
- REAL_CONST(33640.991609152239 / 8.0),
- REAL_CONST(33659.050250368542 / 8.0),
- REAL_CONST(33677.111314100322 / 8.0),
- REAL_CONST(33695.174799697881 / 8.0),
- REAL_CONST(33713.240706511984 / 8.0),
- REAL_CONST(33731.309033893805 / 8.0),
- REAL_CONST(33749.37978119497 / 8.0),
- REAL_CONST(33767.452947767531 / 8.0),
- REAL_CONST(33785.528532963974 / 8.0),
- REAL_CONST(33803.606536137209 / 8.0),
- REAL_CONST(33821.686956640602 / 8.0),
- REAL_CONST(33839.769793827938 / 8.0),
- REAL_CONST(33857.855047053425 / 8.0),
- REAL_CONST(33875.942715671707 / 8.0),
- REAL_CONST(33894.032799037872 / 8.0),
- REAL_CONST(33912.125296507431 / 8.0),
- REAL_CONST(33930.220207436316 / 8.0),
- REAL_CONST(33948.317531180888 / 8.0),
- REAL_CONST(33966.417267097961 / 8.0),
- REAL_CONST(33984.519414544746 / 8.0),
- REAL_CONST(34002.623972878901 / 8.0),
- REAL_CONST(34020.730941458511 / 8.0),
- REAL_CONST(34038.840319642077 / 8.0),
- REAL_CONST(34056.952106788536 / 8.0),
- REAL_CONST(34075.066302257255 / 8.0),
- REAL_CONST(34093.182905408015 / 8.0),
- REAL_CONST(34111.301915601027 / 8.0),
- REAL_CONST(34129.42333219693 / 8.0),
- REAL_CONST(34147.547154556785 / 8.0),
- REAL_CONST(34165.673382042078 / 8.0),
- REAL_CONST(34183.80201401472 / 8.0),
- REAL_CONST(34201.933049837033 / 8.0),
- REAL_CONST(34220.06648887178 / 8.0),
- REAL_CONST(34238.202330482141 / 8.0),
- REAL_CONST(34256.340574031703 / 8.0),
- REAL_CONST(34274.481218884495 / 8.0),
- REAL_CONST(34292.624264404949 / 8.0),
- REAL_CONST(34310.769709957938 / 8.0),
- REAL_CONST(34328.91755490873 / 8.0),
- REAL_CONST(34347.067798623029 / 8.0),
- REAL_CONST(34365.220440466954 / 8.0),
- REAL_CONST(34383.375479807051 / 8.0),
- REAL_CONST(34401.532916010263 / 8.0),
- REAL_CONST(34419.692748443973 / 8.0),
- REAL_CONST(34437.854976475966 / 8.0),
- REAL_CONST(34456.01959947445 / 8.0),
- REAL_CONST(34474.18661680806 / 8.0),
- REAL_CONST(34492.356027845817 / 8.0),
- REAL_CONST(34510.527831957188 / 8.0),
- REAL_CONST(34528.702028512052 / 8.0),
- REAL_CONST(34546.878616880676 / 8.0),
- REAL_CONST(34565.05759643377 / 8.0),
- REAL_CONST(34583.238966542449 / 8.0),
- REAL_CONST(34601.422726578232 / 8.0),
- REAL_CONST(34619.608875913065 / 8.0),
- REAL_CONST(34637.797413919296 / 8.0),
- REAL_CONST(34655.988339969692 / 8.0),
- REAL_CONST(34674.181653437423 / 8.0),
- REAL_CONST(34692.37735369608 / 8.0),
- REAL_CONST(34710.575440119668 / 8.0),
- REAL_CONST(34728.775912082579 / 8.0),
- REAL_CONST(34746.978768959649 / 8.0),
- REAL_CONST(34765.184010126082 / 8.0),
- REAL_CONST(34783.391634957537 / 8.0),
- REAL_CONST(34801.60164283005 / 8.0),
- REAL_CONST(34819.814033120063 / 8.0),
- REAL_CONST(34838.028805204456 / 8.0),
- REAL_CONST(34856.24595846048 / 8.0),
- REAL_CONST(34874.465492265823 / 8.0),
- REAL_CONST(34892.687405998557 / 8.0),
- REAL_CONST(34910.911699037177 / 8.0),
- REAL_CONST(34929.138370760564 / 8.0),
- REAL_CONST(34947.367420548027 / 8.0),
- REAL_CONST(34965.598847779271 / 8.0),
- REAL_CONST(34983.832651834389 / 8.0),
- REAL_CONST(35002.068832093908 / 8.0),
- REAL_CONST(35020.307387938738 / 8.0),
- REAL_CONST(35038.548318750189 / 8.0),
- REAL_CONST(35056.79162390998 / 8.0),
- REAL_CONST(35075.03730280025 / 8.0),
- REAL_CONST(35093.285354803513 / 8.0),
- REAL_CONST(35111.535779302685 / 8.0),
- REAL_CONST(35129.788575681116 / 8.0),
- REAL_CONST(35148.043743322516 / 8.0),
- REAL_CONST(35166.301281611013 / 8.0),
- REAL_CONST(35184.561189931141 / 8.0),
- REAL_CONST(35202.823467667826 / 8.0),
- REAL_CONST(35221.088114206388 / 8.0),
- REAL_CONST(35239.355128932555 / 8.0),
- REAL_CONST(35257.624511232447 / 8.0),
- REAL_CONST(35275.896260492584 / 8.0),
- REAL_CONST(35294.170376099886 / 8.0),
- REAL_CONST(35312.446857441668 / 8.0),
- REAL_CONST(35330.725703905628 / 8.0),
- REAL_CONST(35349.006914879887 / 8.0),
- REAL_CONST(35367.290489752944 / 8.0),
- REAL_CONST(35385.576427913686 / 8.0),
- REAL_CONST(35403.864728751418 / 8.0),
- REAL_CONST(35422.155391655811 / 8.0),
- REAL_CONST(35440.448416016967 / 8.0),
- REAL_CONST(35458.743801225341 / 8.0),
- REAL_CONST(35477.041546671804 / 8.0),
- REAL_CONST(35495.341651747622 / 8.0),
- REAL_CONST(35513.644115844436 / 8.0),
- REAL_CONST(35531.948938354304 / 8.0),
- REAL_CONST(35550.256118669655 / 8.0),
- REAL_CONST(35568.565656183309 / 8.0),
- REAL_CONST(35586.877550288496 / 8.0),
- REAL_CONST(35605.191800378816 / 8.0),
- REAL_CONST(35623.508405848268 / 8.0),
- REAL_CONST(35641.827366091238 / 8.0),
- REAL_CONST(35660.148680502505 / 8.0),
- REAL_CONST(35678.472348477233 / 8.0),
- REAL_CONST(35696.798369410979 / 8.0),
- REAL_CONST(35715.126742699678 / 8.0),
- REAL_CONST(35733.457467739659 / 8.0),
- REAL_CONST(35751.790543927644 / 8.0),
- REAL_CONST(35770.125970660738 / 8.0),
- REAL_CONST(35788.46374733642 / 8.0),
- REAL_CONST(35806.803873352568 / 8.0),
- REAL_CONST(35825.146348107453 / 8.0),
- REAL_CONST(35843.49117099971 / 8.0),
- REAL_CONST(35861.838341428367 / 8.0),
- REAL_CONST(35880.187858792851 / 8.0),
- REAL_CONST(35898.539722492955 / 8.0),
- REAL_CONST(35916.893931928862 / 8.0),
- REAL_CONST(35935.250486501129 / 8.0),
- REAL_CONST(35953.609385610718 / 8.0),
- REAL_CONST(35971.970628658957 / 8.0),
- REAL_CONST(35990.334215047558 / 8.0),
- REAL_CONST(36008.700144178612 / 8.0),
- REAL_CONST(36027.068415454596 / 8.0),
- REAL_CONST(36045.439028278372 / 8.0),
- REAL_CONST(36063.811982053165 / 8.0),
- REAL_CONST(36082.187276182609 / 8.0),
- REAL_CONST(36100.564910070694 / 8.0),
- REAL_CONST(36118.944883121789 / 8.0),
- REAL_CONST(36137.327194740654 / 8.0),
- REAL_CONST(36155.711844332429 / 8.0),
- REAL_CONST(36174.098831302617 / 8.0),
- REAL_CONST(36192.488155057115 / 8.0),
- REAL_CONST(36210.87981500219 / 8.0),
- REAL_CONST(36229.273810544473 / 8.0),
- REAL_CONST(36247.670141091003 / 8.0),
- REAL_CONST(36266.068806049167 / 8.0),
- REAL_CONST(36284.469804826738 / 8.0),
- REAL_CONST(36302.873136831862 / 8.0),
- REAL_CONST(36321.278801473069 / 8.0),
- REAL_CONST(36339.686798159251 / 8.0),
- REAL_CONST(36358.097126299683 / 8.0),
- REAL_CONST(36376.509785304013 / 8.0),
- REAL_CONST(36394.924774582258 / 8.0),
- REAL_CONST(36413.342093544816 / 8.0),
- REAL_CONST(36431.761741602444 / 8.0),
- REAL_CONST(36450.183718166292 / 8.0),
- REAL_CONST(36468.608022647859 / 8.0),
- REAL_CONST(36487.034654459028 / 8.0),
- REAL_CONST(36505.463613012063 / 8.0),
- REAL_CONST(36523.894897719583 / 8.0),
- REAL_CONST(36542.328507994578 / 8.0),
- REAL_CONST(36560.764443250409 / 8.0),
- REAL_CONST(36579.202702900831 / 8.0),
- REAL_CONST(36597.643286359926 / 8.0),
- REAL_CONST(36616.086193042182 / 8.0),
- REAL_CONST(36634.531422362437 / 8.0),
- REAL_CONST(36652.978973735895 / 8.0),
- REAL_CONST(36671.428846578143 / 8.0),
- REAL_CONST(36689.881040305125 / 8.0),
- REAL_CONST(36708.335554333149 / 8.0),
- REAL_CONST(36726.792388078902 / 8.0),
- REAL_CONST(36745.251540959427 / 8.0),
- REAL_CONST(36763.713012392138 / 8.0),
- REAL_CONST(36782.176801794812 / 8.0),
- REAL_CONST(36800.642908585593 / 8.0),
- REAL_CONST(36819.111332182983 / 8.0),
- REAL_CONST(36837.582072005869 / 8.0),
- REAL_CONST(36856.055127473483 / 8.0),
- REAL_CONST(36874.530498005421 / 8.0),
- REAL_CONST(36893.008183021651 / 8.0),
- REAL_CONST(36911.488181942506 / 8.0),
- REAL_CONST(36929.970494188674 / 8.0),
- REAL_CONST(36948.455119181206 / 8.0),
- REAL_CONST(36966.942056341519 / 8.0),
- REAL_CONST(36985.431305091392 / 8.0),
- REAL_CONST(37003.922864852961 / 8.0),
- REAL_CONST(37022.416735048733 / 8.0),
- REAL_CONST(37040.912915101559 / 8.0),
- REAL_CONST(37059.411404434657 / 8.0),
- REAL_CONST(37077.91220247162 / 8.0),
- REAL_CONST(37096.415308636388 / 8.0),
- REAL_CONST(37114.920722353243 / 8.0),
- REAL_CONST(37133.428443046862 / 8.0),
- REAL_CONST(37151.938470142253 / 8.0),
- REAL_CONST(37170.450803064785 / 8.0),
- REAL_CONST(37188.965441240209 / 8.0),
- REAL_CONST(37207.482384094597 / 8.0),
- REAL_CONST(37226.001631054402 / 8.0),
- REAL_CONST(37244.523181546429 / 8.0),
- REAL_CONST(37263.047034997842 / 8.0),
- REAL_CONST(37281.573190836149 / 8.0),
- REAL_CONST(37300.101648489224 / 8.0),
- REAL_CONST(37318.632407385296 / 8.0),
- REAL_CONST(37337.165466952945 / 8.0),
- REAL_CONST(37355.700826621112 / 8.0),
- REAL_CONST(37374.238485819085 / 8.0),
- REAL_CONST(37392.778443976509 / 8.0),
- REAL_CONST(37411.320700523385 / 8.0),
- REAL_CONST(37429.865254890057 / 8.0),
- REAL_CONST(37448.412106507232 / 8.0),
- REAL_CONST(37466.961254805974 / 8.0),
- REAL_CONST(37485.512699217681 / 8.0),
- REAL_CONST(37504.066439174116 / 8.0),
- REAL_CONST(37522.622474107404 / 8.0),
- REAL_CONST(37541.180803449992 / 8.0),
- REAL_CONST(37559.741426634704 / 8.0),
- REAL_CONST(37578.304343094693 / 8.0),
- REAL_CONST(37596.869552263488 / 8.0),
- REAL_CONST(37615.43705357494 / 8.0),
- REAL_CONST(37634.006846463279 / 8.0),
- REAL_CONST(37652.578930363044 / 8.0),
- REAL_CONST(37671.153304709165 / 8.0),
- REAL_CONST(37689.729968936896 / 8.0),
- REAL_CONST(37708.308922481847 / 8.0),
- REAL_CONST(37726.890164779965 / 8.0),
- REAL_CONST(37745.473695267559 / 8.0),
- REAL_CONST(37764.059513381275 / 8.0),
- REAL_CONST(37782.647618558112 / 8.0),
- REAL_CONST(37801.238010235415 / 8.0),
- REAL_CONST(37819.830687850859 / 8.0),
- REAL_CONST(37838.425650842495 / 8.0),
- REAL_CONST(37857.022898648691 / 8.0),
- REAL_CONST(37875.622430708172 / 8.0),
- REAL_CONST(37894.224246460013 / 8.0),
- REAL_CONST(37912.828345343616 / 8.0),
- REAL_CONST(37931.434726798747 / 8.0),
- REAL_CONST(37950.043390265506 / 8.0),
- REAL_CONST(37968.654335184328 / 8.0),
- REAL_CONST(37987.267560995999 / 8.0),
- REAL_CONST(38005.883067141665 / 8.0),
- REAL_CONST(38024.500853062775 / 8.0),
- REAL_CONST(38043.120918201159 / 8.0),
- REAL_CONST(38061.743261998963 / 8.0),
- REAL_CONST(38080.367883898682 / 8.0),
- REAL_CONST(38098.994783343158 / 8.0),
- REAL_CONST(38117.623959775563 / 8.0),
- REAL_CONST(38136.255412639417 / 8.0),
- REAL_CONST(38154.889141378575 / 8.0),
- REAL_CONST(38173.525145437234 / 8.0),
- REAL_CONST(38192.163424259939 / 8.0),
- REAL_CONST(38210.803977291551 / 8.0),
- REAL_CONST(38229.446803977284 / 8.0),
- REAL_CONST(38248.091903762703 / 8.0),
- REAL_CONST(38266.739276093685 / 8.0),
- REAL_CONST(38285.388920416466 / 8.0),
- REAL_CONST(38304.040836177606 / 8.0),
- REAL_CONST(38322.695022824002 / 8.0),
- REAL_CONST(38341.351479802899 / 8.0),
- REAL_CONST(38360.010206561863 / 8.0),
- REAL_CONST(38378.671202548816 / 8.0),
- REAL_CONST(38397.334467211993 / 8.0),
- REAL_CONST(38415.999999999978 / 8.0),
- REAL_CONST(38434.667800361683 / 8.0),
- REAL_CONST(38453.33786774637 / 8.0),
- REAL_CONST(38472.010201603611 / 8.0),
- REAL_CONST(38490.684801383337 / 8.0),
- REAL_CONST(38509.361666535784 / 8.0),
- REAL_CONST(38528.040796511552 / 8.0),
- REAL_CONST(38546.722190761553 / 8.0),
- REAL_CONST(38565.405848737035 / 8.0),
- REAL_CONST(38584.091769889594 / 8.0),
- REAL_CONST(38602.779953671132 / 8.0),
- REAL_CONST(38621.470399533908 / 8.0),
- REAL_CONST(38640.163106930493 / 8.0),
- REAL_CONST(38658.858075313794 / 8.0),
- REAL_CONST(38677.555304137059 / 8.0),
- REAL_CONST(38696.254792853862 / 8.0),
- REAL_CONST(38714.956540918094 / 8.0),
- REAL_CONST(38733.660547783991 / 8.0),
- REAL_CONST(38752.366812906112 / 8.0),
- REAL_CONST(38771.075335739348 / 8.0),
- REAL_CONST(38789.78611573892 / 8.0),
- REAL_CONST(38808.499152360368 / 8.0),
- REAL_CONST(38827.214445059573 / 8.0),
- REAL_CONST(38845.931993292739 / 8.0),
- REAL_CONST(38864.651796516388 / 8.0),
- REAL_CONST(38883.373854187383 / 8.0),
- REAL_CONST(38902.098165762916 / 8.0),
- REAL_CONST(38920.824730700486 / 8.0),
- REAL_CONST(38939.553548457938 / 8.0),
- REAL_CONST(38958.284618493431 / 8.0),
- REAL_CONST(38977.017940265461 / 8.0),
- REAL_CONST(38995.753513232834 / 8.0),
- REAL_CONST(39014.491336854699 / 8.0),
- REAL_CONST(39033.231410590517 / 8.0),
- REAL_CONST(39051.973733900079 / 8.0),
- REAL_CONST(39070.718306243485 / 8.0),
- REAL_CONST(39089.465127081188 / 8.0),
- REAL_CONST(39108.214195873945 / 8.0),
- REAL_CONST(39126.965512082832 / 8.0),
- REAL_CONST(39145.719075169261 / 8.0),
- REAL_CONST(39164.474884594965 / 8.0),
- REAL_CONST(39183.232939821988 / 8.0),
- REAL_CONST(39201.99324031271 / 8.0),
- REAL_CONST(39220.755785529815 / 8.0),
- REAL_CONST(39239.52057493633 / 8.0),
- REAL_CONST(39258.287607995589 / 8.0),
- REAL_CONST(39277.056884171245 / 8.0),
- REAL_CONST(39295.828402927284 / 8.0),
- REAL_CONST(39314.602163728006 / 8.0),
- REAL_CONST(39333.378166038019 / 8.0),
- REAL_CONST(39352.15640932227 / 8.0),
- REAL_CONST(39370.936893046004 / 8.0),
- REAL_CONST(39389.719616674811 / 8.0),
- REAL_CONST(39408.504579674584 / 8.0),
- REAL_CONST(39427.291781511522 / 8.0),
- REAL_CONST(39446.081221652174 / 8.0),
- REAL_CONST(39464.872899563372 / 8.0),
- REAL_CONST(39483.666814712291 / 8.0),
- REAL_CONST(39502.462966566411 / 8.0),
- REAL_CONST(39521.261354593538 / 8.0),
- REAL_CONST(39540.06197826178 / 8.0),
- REAL_CONST(39558.864837039568 / 8.0),
- REAL_CONST(39577.669930395656 / 8.0),
- REAL_CONST(39596.47725779911 / 8.0),
- REAL_CONST(39615.286818719302 / 8.0),
- REAL_CONST(39634.098612625923 / 8.0),
- REAL_CONST(39652.912638988993 / 8.0),
- REAL_CONST(39671.728897278823 / 8.0),
- REAL_CONST(39690.547386966064 / 8.0),
- REAL_CONST(39709.368107521652 / 8.0),
- REAL_CONST(39728.191058416858 / 8.0),
- REAL_CONST(39747.016239123259 / 8.0),
- REAL_CONST(39765.84364911275 / 8.0),
- REAL_CONST(39784.673287857528 / 8.0),
- REAL_CONST(39803.505154830105 / 8.0),
- REAL_CONST(39822.339249503319 / 8.0),
- REAL_CONST(39841.175571350293 / 8.0),
- REAL_CONST(39860.014119844491 / 8.0),
- REAL_CONST(39878.854894459677 / 8.0),
- REAL_CONST(39897.697894669909 / 8.0),
- REAL_CONST(39916.54311994958 / 8.0),
- REAL_CONST(39935.390569773372 / 8.0),
- REAL_CONST(39954.240243616303 / 8.0),
- REAL_CONST(39973.092140953675 / 8.0),
- REAL_CONST(39991.946261261117 / 8.0),
- REAL_CONST(40010.802604014549 / 8.0),
- REAL_CONST(40029.661168690225 / 8.0),
- REAL_CONST(40048.521954764678 / 8.0),
- REAL_CONST(40067.384961714779 / 8.0),
- REAL_CONST(40086.250189017679 / 8.0),
- REAL_CONST(40105.117636150855 / 8.0),
- REAL_CONST(40123.98730259209 / 8.0),
- REAL_CONST(40142.859187819471 / 8.0),
- REAL_CONST(40161.733291311379 / 8.0),
- REAL_CONST(40180.609612546526 / 8.0),
- REAL_CONST(40199.488151003912 / 8.0),
- REAL_CONST(40218.368906162854 / 8.0),
- REAL_CONST(40237.25187750296 / 8.0),
- REAL_CONST(40256.137064504153 / 8.0),
- REAL_CONST(40275.024466646668 / 8.0),
- REAL_CONST(40293.914083411029 / 8.0),
- REAL_CONST(40312.805914278084 / 8.0),
- REAL_CONST(40331.699958728961 / 8.0),
- REAL_CONST(40350.596216245103 / 8.0),
- REAL_CONST(40369.494686308273 / 8.0),
- REAL_CONST(40388.39536840051 / 8.0),
- REAL_CONST(40407.298262004173 / 8.0),
- REAL_CONST(40426.20336660192 / 8.0),
- REAL_CONST(40445.110681676706 / 8.0),
- REAL_CONST(40464.020206711793 / 8.0),
- REAL_CONST(40482.931941190756 / 8.0),
- REAL_CONST(40501.845884597446 / 8.0),
- REAL_CONST(40520.762036416032 / 8.0),
- REAL_CONST(40539.680396130985 / 8.0),
- REAL_CONST(40558.600963227072 / 8.0),
- REAL_CONST(40577.523737189367 / 8.0),
- REAL_CONST(40596.448717503234 / 8.0),
- REAL_CONST(40615.375903654342 / 8.0),
- REAL_CONST(40634.305295128659 / 8.0),
- REAL_CONST(40653.236891412453 / 8.0),
- REAL_CONST(40672.170691992294 / 8.0),
- REAL_CONST(40691.106696355047 / 8.0),
- REAL_CONST(40710.044903987873 / 8.0),
- REAL_CONST(40728.985314378238 / 8.0),
- REAL_CONST(40747.927927013901 / 8.0),
- REAL_CONST(40766.872741382918 / 8.0),
- REAL_CONST(40785.819756973651 / 8.0),
- REAL_CONST(40804.768973274746 / 8.0),
- REAL_CONST(40823.720389775161 / 8.0),
- REAL_CONST(40842.674005964131 / 8.0),
- REAL_CONST(40861.629821331211 / 8.0),
- REAL_CONST(40880.587835366234 / 8.0),
- REAL_CONST(40899.548047559321 / 8.0),
- REAL_CONST(40918.510457400931 / 8.0),
- REAL_CONST(40937.475064381761 / 8.0),
- REAL_CONST(40956.441867992849 / 8.0),
- REAL_CONST(40975.410867725499 / 8.0),
- REAL_CONST(40994.382063071331 / 8.0),
- REAL_CONST(41013.355453522236 / 8.0),
- REAL_CONST(41032.331038570417 / 8.0),
- REAL_CONST(41051.308817708363 / 8.0),
- REAL_CONST(41070.288790428858 / 8.0),
- REAL_CONST(41089.270956224987 / 8.0),
- REAL_CONST(41108.255314590111 / 8.0),
- REAL_CONST(41127.241865017888 / 8.0),
- REAL_CONST(41146.23060700229 / 8.0),
- REAL_CONST(41165.221540037543 / 8.0),
- REAL_CONST(41184.214663618193 / 8.0),
- REAL_CONST(41203.209977239079 / 8.0),
- REAL_CONST(41222.207480395307 / 8.0),
- REAL_CONST(41241.207172582297 / 8.0),
- REAL_CONST(41260.209053295752 / 8.0),
- REAL_CONST(41279.213122031659 / 8.0),
- REAL_CONST(41298.219378286303 / 8.0),
- REAL_CONST(41317.227821556255 / 8.0),
- REAL_CONST(41336.23845133838 / 8.0),
- REAL_CONST(41355.251267129832 / 8.0),
- REAL_CONST(41374.266268428037 / 8.0),
- REAL_CONST(41393.283454730743 / 8.0),
- REAL_CONST(41412.302825535953 / 8.0),
- REAL_CONST(41431.324380341983 / 8.0),
- REAL_CONST(41450.348118647416 / 8.0),
- REAL_CONST(41469.374039951144 / 8.0),
- REAL_CONST(41488.402143752326 / 8.0),
- REAL_CONST(41507.432429550427 / 8.0),
- REAL_CONST(41526.464896845187 / 8.0),
- REAL_CONST(41545.499545136627 / 8.0),
- REAL_CONST(41564.536373925075 / 8.0),
- REAL_CONST(41583.575382711126 / 8.0),
- REAL_CONST(41602.616570995662 / 8.0),
- REAL_CONST(41621.659938279874 / 8.0),
- REAL_CONST(41640.705484065205 / 8.0),
- REAL_CONST(41659.753207853406 / 8.0),
- REAL_CONST(41678.803109146495 / 8.0),
- REAL_CONST(41697.855187446803 / 8.0),
- REAL_CONST(41716.909442256911 / 8.0),
- REAL_CONST(41735.965873079709 / 8.0),
- REAL_CONST(41755.02447941836 / 8.0),
- REAL_CONST(41774.085260776315 / 8.0),
- REAL_CONST(41793.148216657297 / 8.0),
- REAL_CONST(41812.213346565331 / 8.0),
- REAL_CONST(41831.280650004708 / 8.0),
- REAL_CONST(41850.350126480014 / 8.0),
- REAL_CONST(41869.421775496106 / 8.0),
- REAL_CONST(41888.495596558132 / 8.0),
- REAL_CONST(41907.571589171515 / 8.0),
- REAL_CONST(41926.649752841957 / 8.0),
- REAL_CONST(41945.730087075463 / 8.0),
- REAL_CONST(41964.812591378286 / 8.0),
- REAL_CONST(41983.897265256979 / 8.0),
- REAL_CONST(42002.984108218378 / 8.0),
- REAL_CONST(42022.073119769593 / 8.0),
- REAL_CONST(42041.164299418015 / 8.0),
- REAL_CONST(42060.257646671307 / 8.0),
- REAL_CONST(42079.353161037419 / 8.0),
- REAL_CONST(42098.450842024591 / 8.0),
- REAL_CONST(42117.550689141324 / 8.0),
- REAL_CONST(42136.652701896404 / 8.0),
- REAL_CONST(42155.756879798893 / 8.0),
- REAL_CONST(42174.863222358137 / 8.0),
- REAL_CONST(42193.971729083758 / 8.0),
- REAL_CONST(42213.082399485655 / 8.0),
- REAL_CONST(42232.195233074002 / 8.0),
- REAL_CONST(42251.310229359246 / 8.0),
- REAL_CONST(42270.427387852127 / 8.0),
- REAL_CONST(42289.546708063644 / 8.0),
- REAL_CONST(42308.668189505079 / 8.0),
- REAL_CONST(42327.791831687995 / 8.0),
- REAL_CONST(42346.917634124227 / 8.0),
- REAL_CONST(42366.045596325886 / 8.0),
- REAL_CONST(42385.175717805352 / 8.0),
- REAL_CONST(42404.307998075295 / 8.0),
- REAL_CONST(42423.442436648642 / 8.0),
- REAL_CONST(42442.579033038608 / 8.0),
- REAL_CONST(42461.717786758672 / 8.0),
- REAL_CONST(42480.858697322597 / 8.0),
- REAL_CONST(42500.001764244422 / 8.0),
- REAL_CONST(42519.146987038446 / 8.0),
- REAL_CONST(42538.294365219248 / 8.0),
- REAL_CONST(42557.443898301688 / 8.0),
- REAL_CONST(42576.595585800882 / 8.0),
- REAL_CONST(42595.749427232236 / 8.0),
- REAL_CONST(42614.90542211142 / 8.0),
- REAL_CONST(42634.063569954378 / 8.0),
- REAL_CONST(42653.223870277317 / 8.0),
- REAL_CONST(42672.386322596729 / 8.0),
- REAL_CONST(42691.55092642938 / 8.0),
- REAL_CONST(42710.717681292292 / 8.0),
- REAL_CONST(42729.886586702756 / 8.0),
- REAL_CONST(42749.057642178363 / 8.0),
- REAL_CONST(42768.23084723694 / 8.0),
- REAL_CONST(42787.406201396603 / 8.0),
- REAL_CONST(42806.58370417574 / 8.0),
- REAL_CONST(42825.76335509299 / 8.0),
- REAL_CONST(42844.945153667286 / 8.0),
- REAL_CONST(42864.129099417805 / 8.0),
- REAL_CONST(42883.315191864014 / 8.0),
- REAL_CONST(42902.503430525649 / 8.0),
- REAL_CONST(42921.693814922692 / 8.0),
- REAL_CONST(42940.88634457541 / 8.0),
- REAL_CONST(42960.081019004348 / 8.0),
- REAL_CONST(42979.277837730297 / 8.0),
- REAL_CONST(42998.476800274322 / 8.0),
- REAL_CONST(43017.677906157769 / 8.0),
- REAL_CONST(43036.881154902228 / 8.0),
- REAL_CONST(43056.086546029583 / 8.0),
- REAL_CONST(43075.294079061961 / 8.0),
- REAL_CONST(43094.503753521763 / 8.0),
- REAL_CONST(43113.715568931671 / 8.0),
- REAL_CONST(43132.929524814601 / 8.0),
- REAL_CONST(43152.145620693766 / 8.0),
- REAL_CONST(43171.363856092619 / 8.0),
- REAL_CONST(43190.584230534907 / 8.0),
- REAL_CONST(43209.806743544621 / 8.0),
- REAL_CONST(43229.031394646016 / 8.0),
- REAL_CONST(43248.258183363621 / 8.0),
- REAL_CONST(43267.487109222224 / 8.0),
- REAL_CONST(43286.718171746885 / 8.0),
- REAL_CONST(43305.951370462906 / 8.0),
- REAL_CONST(43325.186704895881 / 8.0),
- REAL_CONST(43344.42417457165 / 8.0),
- REAL_CONST(43363.663779016322 / 8.0),
- REAL_CONST(43382.905517756262 / 8.0),
- REAL_CONST(43402.149390318104 / 8.0),
- REAL_CONST(43421.395396228749 / 8.0),
- REAL_CONST(43440.643535015348 / 8.0),
- REAL_CONST(43459.89380620532 / 8.0),
- REAL_CONST(43479.146209326354 / 8.0),
- REAL_CONST(43498.400743906379 / 8.0),
- REAL_CONST(43517.657409473606 / 8.0),
- REAL_CONST(43536.916205556496 / 8.0),
- REAL_CONST(43556.177131683784 / 8.0),
- REAL_CONST(43575.44018738444 / 8.0),
- REAL_CONST(43594.705372187724 / 8.0),
- REAL_CONST(43613.972685623135 / 8.0),
- REAL_CONST(43633.242127220445 / 8.0),
- REAL_CONST(43652.513696509668 / 8.0),
- REAL_CONST(43671.787393021099 / 8.0),
- REAL_CONST(43691.063216285271 / 8.0),
- REAL_CONST(43710.341165833001 / 8.0),
- REAL_CONST(43729.621241195346 / 8.0),
- REAL_CONST(43748.903441903625 / 8.0),
- REAL_CONST(43768.187767489413 / 8.0),
- REAL_CONST(43787.474217484552 / 8.0),
- REAL_CONST(43806.762791421126 / 8.0),
- REAL_CONST(43826.053488831501 / 8.0),
- REAL_CONST(43845.346309248278 / 8.0),
- REAL_CONST(43864.641252204325 / 8.0),
- REAL_CONST(43883.938317232765 / 8.0),
- REAL_CONST(43903.237503866971 / 8.0),
- REAL_CONST(43922.538811640596 / 8.0),
- REAL_CONST(43941.842240087513 / 8.0),
- REAL_CONST(43961.147788741881 / 8.0),
- REAL_CONST(43980.455457138101 / 8.0),
- REAL_CONST(43999.765244810835 / 8.0),
- REAL_CONST(44019.077151295001 / 8.0),
- REAL_CONST(44038.391176125755 / 8.0),
- REAL_CONST(44057.70731883854 / 8.0),
- REAL_CONST(44077.02557896902 / 8.0),
- REAL_CONST(44096.345956053141 / 8.0),
- REAL_CONST(44115.668449627083 / 8.0),
- REAL_CONST(44134.993059227287 / 8.0),
- REAL_CONST(44154.319784390456 / 8.0),
- REAL_CONST(44173.648624653535 / 8.0),
- REAL_CONST(44192.979579553728 / 8.0),
- REAL_CONST(44212.312648628489 / 8.0),
- REAL_CONST(44231.647831415532 / 8.0),
- REAL_CONST(44250.985127452805 / 8.0),
- REAL_CONST(44270.324536278538 / 8.0),
- REAL_CONST(44289.666057431183 / 8.0),
- REAL_CONST(44309.009690449464 / 8.0),
- REAL_CONST(44328.355434872348 / 8.0),
- REAL_CONST(44347.703290239064 / 8.0),
- REAL_CONST(44367.053256089079 / 8.0),
- REAL_CONST(44386.405331962109 / 8.0),
- REAL_CONST(44405.759517398139 / 8.0),
- REAL_CONST(44425.115811937387 / 8.0),
- REAL_CONST(44444.474215120332 / 8.0),
- REAL_CONST(44463.834726487694 / 8.0),
- REAL_CONST(44483.197345580462 / 8.0),
- REAL_CONST(44502.562071939843 / 8.0),
- REAL_CONST(44521.928905107328 / 8.0),
- REAL_CONST(44541.297844624634 / 8.0),
- REAL_CONST(44560.668890033732 / 8.0),
- REAL_CONST(44580.042040876848 / 8.0),
- REAL_CONST(44599.417296696454 / 8.0),
- REAL_CONST(44618.794657035272 / 8.0),
- REAL_CONST(44638.174121436256 / 8.0),
- REAL_CONST(44657.555689442641 / 8.0),
- REAL_CONST(44676.939360597877 / 8.0),
- REAL_CONST(44696.325134445673 / 8.0),
- REAL_CONST(44715.713010530002 / 8.0),
- REAL_CONST(44735.102988395054 / 8.0),
- REAL_CONST(44754.495067585296 / 8.0),
- REAL_CONST(44773.88924764542 / 8.0),
- REAL_CONST(44793.285528120374 / 8.0),
- REAL_CONST(44812.683908555344 / 8.0),
- REAL_CONST(44832.084388495779 / 8.0),
- REAL_CONST(44851.486967487363 / 8.0),
- REAL_CONST(44870.891645076015 / 8.0),
- REAL_CONST(44890.298420807922 / 8.0),
- REAL_CONST(44909.707294229491 / 8.0),
- REAL_CONST(44929.118264887409 / 8.0),
- REAL_CONST(44948.531332328566 / 8.0),
- REAL_CONST(44967.946496100136 / 8.0),
- REAL_CONST(44987.363755749502 / 8.0),
- REAL_CONST(45006.783110824319 / 8.0),
- REAL_CONST(45026.204560872473 / 8.0),
- REAL_CONST(45045.628105442098 / 8.0),
- REAL_CONST(45065.053744081561 / 8.0),
- REAL_CONST(45084.48147633949 / 8.0),
- REAL_CONST(45103.911301764747 / 8.0),
- REAL_CONST(45123.343219906426 / 8.0),
- REAL_CONST(45142.777230313885 / 8.0),
- REAL_CONST(45162.21333253671 / 8.0),
- REAL_CONST(45181.651526124733 / 8.0),
- REAL_CONST(45201.091810628037 / 8.0),
- REAL_CONST(45220.534185596924 / 8.0),
- REAL_CONST(45239.978650581965 / 8.0),
- REAL_CONST(45259.425205133957 / 8.0),
- REAL_CONST(45278.873848803938 / 8.0),
- REAL_CONST(45298.324581143192 / 8.0),
- REAL_CONST(45317.777401703235 / 8.0),
- REAL_CONST(45337.232310035848 / 8.0),
- REAL_CONST(45356.68930569302 / 8.0),
- REAL_CONST(45376.148388226997 / 8.0),
- REAL_CONST(45395.60955719027 / 8.0),
- REAL_CONST(45415.072812135557 / 8.0),
- REAL_CONST(45434.538152615823 / 8.0),
- REAL_CONST(45454.005578184282 / 8.0),
- REAL_CONST(45473.475088394356 / 8.0),
- REAL_CONST(45492.946682799746 / 8.0),
- REAL_CONST(45512.420360954362 / 8.0),
- REAL_CONST(45531.896122412363 / 8.0),
- REAL_CONST(45551.373966728155 / 8.0),
- REAL_CONST(45570.853893456362 / 8.0),
- REAL_CONST(45590.33590215187 / 8.0),
- REAL_CONST(45609.819992369776 / 8.0),
- REAL_CONST(45629.306163665438 / 8.0),
- REAL_CONST(45648.794415594442 / 8.0),
- REAL_CONST(45668.284747712612 / 8.0),
- REAL_CONST(45687.777159576006 / 8.0),
- REAL_CONST(45707.27165074092 / 8.0),
- REAL_CONST(45726.768220763894 / 8.0),
- REAL_CONST(45746.266869201696 / 8.0),
- REAL_CONST(45765.767595611323 / 8.0),
- REAL_CONST(45785.270399550034 / 8.0),
- REAL_CONST(45804.775280575297 / 8.0),
- REAL_CONST(45824.282238244828 / 8.0),
- REAL_CONST(45843.79127211657 / 8.0),
- REAL_CONST(45863.302381748719 / 8.0),
- REAL_CONST(45882.815566699683 / 8.0),
- REAL_CONST(45902.33082652813 / 8.0),
- REAL_CONST(45921.848160792935 / 8.0),
- REAL_CONST(45941.367569053225 / 8.0),
- REAL_CONST(45960.889050868354 / 8.0),
- REAL_CONST(45980.41260579793 / 8.0),
- REAL_CONST(45999.938233401757 / 8.0),
- REAL_CONST(46019.465933239902 / 8.0),
- REAL_CONST(46038.995704872657 / 8.0),
- REAL_CONST(46058.527547860547 / 8.0),
- REAL_CONST(46078.06146176433 / 8.0),
- REAL_CONST(46097.597446144995 / 8.0),
- REAL_CONST(46117.135500563774 / 8.0),
- REAL_CONST(46136.675624582109 / 8.0),
- REAL_CONST(46156.217817761702 / 8.0),
- REAL_CONST(46175.762079664462 / 8.0),
- REAL_CONST(46195.308409852543 / 8.0),
- REAL_CONST(46214.856807888333 / 8.0),
- REAL_CONST(46234.407273334444 / 8.0),
- REAL_CONST(46253.959805753715 / 8.0),
- REAL_CONST(46273.51440470924 / 8.0),
- REAL_CONST(46293.071069764315 / 8.0),
- REAL_CONST(46312.629800482478 / 8.0),
- REAL_CONST(46332.190596427499 / 8.0),
- REAL_CONST(46351.753457163381 / 8.0),
- REAL_CONST(46371.318382254351 / 8.0),
- REAL_CONST(46390.885371264863 / 8.0),
- REAL_CONST(46410.45442375962 / 8.0),
- REAL_CONST(46430.025539303526 / 8.0),
- REAL_CONST(46449.598717461733 / 8.0),
- REAL_CONST(46469.17395779962 / 8.0),
- REAL_CONST(46488.751259882782 / 8.0),
- REAL_CONST(46508.33062327707 / 8.0),
- REAL_CONST(46527.912047548532 / 8.0),
- REAL_CONST(46547.495532263471 / 8.0),
- REAL_CONST(46567.081076988397 / 8.0),
- REAL_CONST(46586.668681290059 / 8.0),
- REAL_CONST(46606.258344735434 / 8.0),
- REAL_CONST(46625.850066891719 / 8.0),
- REAL_CONST(46645.443847326351 / 8.0),
- REAL_CONST(46665.039685606986 / 8.0),
- REAL_CONST(46684.637581301497 / 8.0),
- REAL_CONST(46704.237533978005 / 8.0),
- REAL_CONST(46723.839543204842 / 8.0),
- REAL_CONST(46743.443608550573 / 8.0),
- REAL_CONST(46763.049729583989 / 8.0),
- REAL_CONST(46782.657905874104 / 8.0),
- REAL_CONST(46802.268136990162 / 8.0),
- REAL_CONST(46821.880422501628 / 8.0),
- REAL_CONST(46841.494761978196 / 8.0),
- REAL_CONST(46861.111154989776 / 8.0),
- REAL_CONST(46880.729601106526 / 8.0),
- REAL_CONST(46900.350099898795 / 8.0),
- REAL_CONST(46919.97265093719 / 8.0),
- REAL_CONST(46939.597253792526 / 8.0),
- REAL_CONST(46959.223908035841 / 8.0),
- REAL_CONST(46978.852613238392 / 8.0),
- REAL_CONST(46998.483368971691 / 8.0),
- REAL_CONST(47018.11617480743 / 8.0),
- REAL_CONST(47037.751030317551 / 8.0),
- REAL_CONST(47057.387935074221 / 8.0),
- REAL_CONST(47077.026888649809 / 8.0),
- REAL_CONST(47096.66789061694 / 8.0),
- REAL_CONST(47116.310940548428 / 8.0),
- REAL_CONST(47135.956038017328 / 8.0),
- REAL_CONST(47155.603182596918 / 8.0),
- REAL_CONST(47175.252373860698 / 8.0),
- REAL_CONST(47194.903611382375 / 8.0),
- REAL_CONST(47214.556894735892 / 8.0),
- REAL_CONST(47234.212223495422 / 8.0),
- REAL_CONST(47253.869597235338 / 8.0),
- REAL_CONST(47273.52901553025 / 8.0),
- REAL_CONST(47293.19047795498 / 8.0),
- REAL_CONST(47312.853984084577 / 8.0),
- REAL_CONST(47332.519533494306 / 8.0),
- REAL_CONST(47352.187125759658 / 8.0),
- REAL_CONST(47371.856760456343 / 8.0),
- REAL_CONST(47391.528437160297 / 8.0),
- REAL_CONST(47411.202155447652 / 8.0),
- REAL_CONST(47430.877914894787 / 8.0),
- REAL_CONST(47450.555715078299 / 8.0),
- REAL_CONST(47470.235555574982 / 8.0),
- REAL_CONST(47489.917435961863 / 8.0),
- REAL_CONST(47509.601355816201 / 8.0),
- REAL_CONST(47529.287314715453 / 8.0),
- REAL_CONST(47548.975312237308 / 8.0),
- REAL_CONST(47568.665347959672 / 8.0),
- REAL_CONST(47588.357421460656 / 8.0),
- REAL_CONST(47608.051532318605 / 8.0),
- REAL_CONST(47627.747680112072 / 8.0),
- REAL_CONST(47647.445864419846 / 8.0),
- REAL_CONST(47667.14608482091 / 8.0),
- REAL_CONST(47686.848340894474 / 8.0),
- REAL_CONST(47706.552632219973 / 8.0),
- REAL_CONST(47726.258958377046 / 8.0),
- REAL_CONST(47745.967318945557 / 8.0),
- REAL_CONST(47765.677713505589 / 8.0),
- REAL_CONST(47785.390141637428 / 8.0),
- REAL_CONST(47805.104602921601 / 8.0),
- REAL_CONST(47824.821096938824 / 8.0),
- REAL_CONST(47844.539623270044 / 8.0),
- REAL_CONST(47864.260181496429 / 8.0),
- REAL_CONST(47883.982771199349 / 8.0),
- REAL_CONST(47903.707391960394 / 8.0),
- REAL_CONST(47923.434043361369 / 8.0),
- REAL_CONST(47943.162724984308 / 8.0),
- REAL_CONST(47962.893436411439 / 8.0),
- REAL_CONST(47982.626177225218 / 8.0),
- REAL_CONST(48002.36094700831 / 8.0),
- REAL_CONST(48022.097745343599 / 8.0),
- REAL_CONST(48041.836571814172 / 8.0),
- REAL_CONST(48061.57742600335 / 8.0),
- REAL_CONST(48081.32030749465 / 8.0),
- REAL_CONST(48101.065215871815 / 8.0),
- REAL_CONST(48120.81215071879 / 8.0),
- REAL_CONST(48140.56111161974 / 8.0),
- REAL_CONST(48160.312098159047 / 8.0),
- REAL_CONST(48180.065109921306 / 8.0),
- REAL_CONST(48199.820146491307 / 8.0),
- REAL_CONST(48219.577207454073 / 8.0),
- REAL_CONST(48239.336292394844 / 8.0),
- REAL_CONST(48259.097400899045 / 8.0),
- REAL_CONST(48278.860532552339 / 8.0),
- REAL_CONST(48298.625686940592 / 8.0),
- REAL_CONST(48318.392863649875 / 8.0),
- REAL_CONST(48338.162062266485 / 8.0),
- REAL_CONST(48357.933282376915 / 8.0),
- REAL_CONST(48377.706523567889 / 8.0),
- REAL_CONST(48397.481785426316 / 8.0),
- REAL_CONST(48417.259067539344 / 8.0),
- REAL_CONST(48437.038369494308 / 8.0),
- REAL_CONST(48456.819690878765 / 8.0),
- REAL_CONST(48476.603031280487 / 8.0),
- REAL_CONST(48496.388390287451 / 8.0),
- REAL_CONST(48516.175767487839 / 8.0),
- REAL_CONST(48535.965162470042 / 8.0),
- REAL_CONST(48555.756574822684 / 8.0),
- REAL_CONST(48575.550004134566 / 8.0),
- REAL_CONST(48595.345449994718 / 8.0),
- REAL_CONST(48615.142911992378 / 8.0),
- REAL_CONST(48634.942389716991 / 8.0),
- REAL_CONST(48654.743882758201 / 8.0),
- REAL_CONST(48674.547390705877 / 8.0),
- REAL_CONST(48694.352913150084 / 8.0),
- REAL_CONST(48714.160449681112 / 8.0),
- REAL_CONST(48733.969999889443 / 8.0),
- REAL_CONST(48753.781563365759 / 8.0),
- REAL_CONST(48773.595139700978 / 8.0),
- REAL_CONST(48793.410728486211 / 8.0),
- REAL_CONST(48813.228329312769 / 8.0),
- REAL_CONST(48833.047941772187 / 8.0),
- REAL_CONST(48852.869565456189 / 8.0),
- REAL_CONST(48872.693199956717 / 8.0),
- REAL_CONST(48892.518844865925 / 8.0),
- REAL_CONST(48912.346499776155 / 8.0),
- REAL_CONST(48932.176164279976 / 8.0),
- REAL_CONST(48952.007837970152 / 8.0),
- REAL_CONST(48971.841520439666 / 8.0),
- REAL_CONST(48991.677211281676 / 8.0),
- REAL_CONST(49011.514910089587 / 8.0),
- REAL_CONST(49031.354616456978 / 8.0),
- REAL_CONST(49051.196329977654 / 8.0),
- REAL_CONST(49071.04005024561 / 8.0),
- REAL_CONST(49090.885776855059 / 8.0),
- REAL_CONST(49110.733509400408 / 8.0),
- REAL_CONST(49130.583247476279 / 8.0),
- REAL_CONST(49150.434990677488 / 8.0),
- REAL_CONST(49170.288738599062 / 8.0),
- REAL_CONST(49190.144490836232 / 8.0),
- REAL_CONST(49210.002246984441 / 8.0),
- REAL_CONST(49229.86200663932 / 8.0),
- REAL_CONST(49249.723769396718 / 8.0),
- REAL_CONST(49269.587534852675 / 8.0),
- REAL_CONST(49289.453302603448 / 8.0),
- REAL_CONST(49309.32107224549 / 8.0),
- REAL_CONST(49329.190843375451 / 8.0),
- REAL_CONST(49349.062615590192 / 8.0),
- REAL_CONST(49368.936388486785 / 8.0),
- REAL_CONST(49388.812161662492 / 8.0),
- REAL_CONST(49408.689934714785 / 8.0),
- REAL_CONST(49428.569707241324 / 8.0),
- REAL_CONST(49448.45147883999 / 8.0),
- REAL_CONST(49468.335249108866 / 8.0),
- REAL_CONST(49488.22101764621 / 8.0),
- REAL_CONST(49508.108784050521 / 8.0),
- REAL_CONST(49527.99854792047 / 8.0),
- REAL_CONST(49547.890308854934 / 8.0),
- REAL_CONST(49567.784066453009 / 8.0),
- REAL_CONST(49587.679820313977 / 8.0),
- REAL_CONST(49607.57757003732 / 8.0),
- REAL_CONST(49627.477315222721 / 8.0),
- REAL_CONST(49647.379055470075 / 8.0),
- REAL_CONST(49667.28279037946 / 8.0),
- REAL_CONST(49687.188519551179 / 8.0),
- REAL_CONST(49707.096242585707 / 8.0),
- REAL_CONST(49727.005959083741 / 8.0),
- REAL_CONST(49746.917668646165 / 8.0),
- REAL_CONST(49766.831370874068 / 8.0),
- REAL_CONST(49786.747065368734 / 8.0),
- REAL_CONST(49806.66475173166 / 8.0),
- REAL_CONST(49826.584429564515 / 8.0),
- REAL_CONST(49846.506098469203 / 8.0),
- REAL_CONST(49866.429758047794 / 8.0),
- REAL_CONST(49886.355407902578 / 8.0),
- REAL_CONST(49906.283047636032 / 8.0),
- REAL_CONST(49926.212676850846 / 8.0),
- REAL_CONST(49946.144295149883 / 8.0),
- REAL_CONST(49966.077902136225 / 8.0),
- REAL_CONST(49986.013497413151 / 8.0),
- REAL_CONST(50005.951080584135 / 8.0),
- REAL_CONST(50025.890651252834 / 8.0),
- REAL_CONST(50045.832209023123 / 8.0),
- REAL_CONST(50065.775753499074 / 8.0),
- REAL_CONST(50085.721284284933 / 8.0),
- REAL_CONST(50105.668800985164 / 8.0),
- REAL_CONST(50125.618303204428 / 8.0),
- REAL_CONST(50145.569790547575 / 8.0),
- REAL_CONST(50165.523262619652 / 8.0),
- REAL_CONST(50185.478719025901 / 8.0),
- REAL_CONST(50205.436159371769 / 8.0),
- REAL_CONST(50225.395583262893 / 8.0),
- REAL_CONST(50245.356990305103 / 8.0),
- REAL_CONST(50265.320380104429 / 8.0),
- REAL_CONST(50285.285752267104 / 8.0),
- REAL_CONST(50305.253106399534 / 8.0),
- REAL_CONST(50325.222442108337 / 8.0),
- REAL_CONST(50345.193759000336 / 8.0),
- REAL_CONST(50365.16705668252 / 8.0),
- REAL_CONST(50385.142334762102 / 8.0),
- REAL_CONST(50405.119592846473 / 8.0),
- REAL_CONST(50425.098830543218 / 8.0),
- REAL_CONST(50445.080047460127 / 8.0),
- REAL_CONST(50465.063243205179 / 8.0),
- REAL_CONST(50485.048417386541 / 8.0),
- REAL_CONST(50505.035569612577 / 8.0),
- REAL_CONST(50525.024699491856 / 8.0),
- REAL_CONST(50545.015806633128 / 8.0),
- REAL_CONST(50565.008890645338 / 8.0),
- REAL_CONST(50585.003951137631 / 8.0),
- REAL_CONST(50605.00098771933 / 8.0),
- REAL_CONST(50624.999999999971 / 8.0),
- REAL_CONST(50645.000987589265 / 8.0),
- REAL_CONST(50665.003950097132 / 8.0),
- REAL_CONST(50685.008887133677 / 8.0),
- REAL_CONST(50705.015798309192 / 8.0),
- REAL_CONST(50725.024683234165 / 8.0),
- REAL_CONST(50745.035541519283 / 8.0),
- REAL_CONST(50765.048372775411 / 8.0),
- REAL_CONST(50785.063176613621 / 8.0),
- REAL_CONST(50805.079952645159 / 8.0),
- REAL_CONST(50825.098700481489 / 8.0),
- REAL_CONST(50845.119419734241 / 8.0),
- REAL_CONST(50865.142110015244 / 8.0),
- REAL_CONST(50885.166770936521 / 8.0),
- REAL_CONST(50905.193402110279 / 8.0),
- REAL_CONST(50925.222003148934 / 8.0),
- REAL_CONST(50945.252573665071 / 8.0),
- REAL_CONST(50965.285113271471 / 8.0),
- REAL_CONST(50985.319621581119 / 8.0),
- REAL_CONST(51005.356098207172 / 8.0),
- REAL_CONST(51025.394542762981 / 8.0),
- REAL_CONST(51045.434954862096 / 8.0),
- REAL_CONST(51065.477334118244 / 8.0),
- REAL_CONST(51085.521680145357 / 8.0),
- REAL_CONST(51105.567992557546 / 8.0),
- REAL_CONST(51125.616270969113 / 8.0),
- REAL_CONST(51145.66651499454 / 8.0),
- REAL_CONST(51165.718724248516 / 8.0),
- REAL_CONST(51185.772898345916 / 8.0),
- REAL_CONST(51205.829036901778 / 8.0),
- REAL_CONST(51225.887139531362 / 8.0),
- REAL_CONST(51245.947205850105 / 8.0),
- REAL_CONST(51266.009235473619 / 8.0),
- REAL_CONST(51286.073228017718 / 8.0),
- REAL_CONST(51306.139183098399 / 8.0),
- REAL_CONST(51326.207100331856 / 8.0),
- REAL_CONST(51346.276979334456 / 8.0),
- REAL_CONST(51366.348819722756 / 8.0),
- REAL_CONST(51386.42262111351 / 8.0),
- REAL_CONST(51406.498383123653 / 8.0),
- REAL_CONST(51426.57610537031 / 8.0),
- REAL_CONST(51446.655787470787 / 8.0),
- REAL_CONST(51466.737429042587 / 8.0),
- REAL_CONST(51486.82102970338 / 8.0),
- REAL_CONST(51506.906589071048 / 8.0),
- REAL_CONST(51526.994106763632 / 8.0),
- REAL_CONST(51547.083582399391 / 8.0),
- REAL_CONST(51567.175015596738 / 8.0),
- REAL_CONST(51587.268405974297 / 8.0),
- REAL_CONST(51607.363753150858 / 8.0),
- REAL_CONST(51627.461056745415 / 8.0),
- REAL_CONST(51647.56031637713 / 8.0),
- REAL_CONST(51667.661531665362 / 8.0),
- REAL_CONST(51687.764702229651 / 8.0),
- REAL_CONST(51707.869827689727 / 8.0),
- REAL_CONST(51727.976907665499 / 8.0),
- REAL_CONST(51748.085941777055 / 8.0),
- REAL_CONST(51768.196929644677 / 8.0),
- REAL_CONST(51788.309870888836 / 8.0),
- REAL_CONST(51808.42476513017 / 8.0),
- REAL_CONST(51828.541611989524 / 8.0),
- REAL_CONST(51848.660411087905 / 8.0),
- REAL_CONST(51868.781162046515 / 8.0),
- REAL_CONST(51888.90386448674 / 8.0),
- REAL_CONST(51909.028518030143 / 8.0),
- REAL_CONST(51929.155122298485 / 8.0),
- REAL_CONST(51949.283676913685 / 8.0),
- REAL_CONST(51969.414181497872 / 8.0),
- REAL_CONST(51989.546635673345 / 8.0),
- REAL_CONST(52009.681039062583 / 8.0),
- REAL_CONST(52029.817391288263 / 8.0),
- REAL_CONST(52049.955691973213 / 8.0),
- REAL_CONST(52070.095940740481 / 8.0),
- REAL_CONST(52090.238137213273 / 8.0),
- REAL_CONST(52110.382281014987 / 8.0),
- REAL_CONST(52130.5283717692 / 8.0),
- REAL_CONST(52150.676409099666 / 8.0),
- REAL_CONST(52170.826392630333 / 8.0),
- REAL_CONST(52190.97832198532 / 8.0),
- REAL_CONST(52211.132196788931 / 8.0),
- REAL_CONST(52231.288016665654 / 8.0),
- REAL_CONST(52251.445781240145 / 8.0),
- REAL_CONST(52271.60549013727 / 8.0),
- REAL_CONST(52291.76714298204 / 8.0),
- REAL_CONST(52311.930739399664 / 8.0),
- REAL_CONST(52332.096279015546 / 8.0),
- REAL_CONST(52352.263761455244 / 8.0),
- REAL_CONST(52372.433186344519 / 8.0),
- REAL_CONST(52392.604553309284 / 8.0),
- REAL_CONST(52412.777861975665 / 8.0),
- REAL_CONST(52432.953111969946 / 8.0),
- REAL_CONST(52453.130302918595 / 8.0),
- REAL_CONST(52473.309434448267 / 8.0),
- REAL_CONST(52493.490506185793 / 8.0),
- REAL_CONST(52513.67351775818 / 8.0),
- REAL_CONST(52533.858468792605 / 8.0),
- REAL_CONST(52554.045358916446 / 8.0),
- REAL_CONST(52574.234187757254 / 8.0),
- REAL_CONST(52594.42495494274 / 8.0),
- REAL_CONST(52614.617660100812 / 8.0),
- REAL_CONST(52634.812302859558 / 8.0),
- REAL_CONST(52655.008882847229 / 8.0),
- REAL_CONST(52675.20739969227 / 8.0),
- REAL_CONST(52695.407853023295 / 8.0),
- REAL_CONST(52715.610242469098 / 8.0),
- REAL_CONST(52735.814567658657 / 8.0),
- REAL_CONST(52756.02082822111 / 8.0),
- REAL_CONST(52776.229023785803 / 8.0),
- REAL_CONST(52796.439153982225 / 8.0),
- REAL_CONST(52816.651218440056 / 8.0),
- REAL_CONST(52836.865216789171 / 8.0),
- REAL_CONST(52857.081148659599 / 8.0),
- REAL_CONST(52877.29901368155 / 8.0),
- REAL_CONST(52897.518811485425 / 8.0),
- REAL_CONST(52917.740541701773 / 8.0),
- REAL_CONST(52937.964203961354 / 8.0),
- REAL_CONST(52958.18979789508 / 8.0),
- REAL_CONST(52978.417323134046 / 8.0),
- REAL_CONST(52998.646779309529 / 8.0),
- REAL_CONST(53018.878166052978 / 8.0),
- REAL_CONST(53039.111482996006 / 8.0),
- REAL_CONST(53059.346729770419 / 8.0),
- REAL_CONST(53079.583906008193 / 8.0),
- REAL_CONST(53099.823011341483 / 8.0),
- REAL_CONST(53120.0640454026 / 8.0),
- REAL_CONST(53140.307007824063 / 8.0),
- REAL_CONST(53160.551898238533 / 8.0),
- REAL_CONST(53180.79871627887 / 8.0),
- REAL_CONST(53201.047461578091 / 8.0),
- REAL_CONST(53221.2981337694 / 8.0),
- REAL_CONST(53241.550732486176 / 8.0),
- REAL_CONST(53261.805257361964 / 8.0),
- REAL_CONST(53282.061708030487 / 8.0),
- REAL_CONST(53302.32008412564 / 8.0),
- REAL_CONST(53322.580385281493 / 8.0),
- REAL_CONST(53342.842611132299 / 8.0),
- REAL_CONST(53363.106761312469 / 8.0),
- REAL_CONST(53383.372835456597 / 8.0),
- REAL_CONST(53403.640833199453 / 8.0),
- REAL_CONST(53423.910754175973 / 8.0),
- REAL_CONST(53444.18259802126 / 8.0),
- REAL_CONST(53464.456364370613 / 8.0),
- REAL_CONST(53484.732052859479 / 8.0),
- REAL_CONST(53505.009663123499 / 8.0),
- REAL_CONST(53525.289194798468 / 8.0),
- REAL_CONST(53545.570647520362 / 8.0),
- REAL_CONST(53565.854020925333 / 8.0),
- REAL_CONST(53586.139314649699 / 8.0),
- REAL_CONST(53606.426528329954 / 8.0),
- REAL_CONST(53626.715661602764 / 8.0),
- REAL_CONST(53647.006714104959 / 8.0),
- REAL_CONST(53667.299685473547 / 8.0),
- REAL_CONST(53687.59457534572 / 8.0),
- REAL_CONST(53707.891383358816 / 8.0),
- REAL_CONST(53728.190109150361 / 8.0),
- REAL_CONST(53748.490752358055 / 8.0),
- REAL_CONST(53768.793312619753 / 8.0),
- REAL_CONST(53789.09778957349 / 8.0),
- REAL_CONST(53809.404182857485 / 8.0),
- REAL_CONST(53829.712492110106 / 8.0),
- REAL_CONST(53850.022716969899 / 8.0),
- REAL_CONST(53870.334857075584 / 8.0),
- REAL_CONST(53890.648912066055 / 8.0),
- REAL_CONST(53910.964881580367 / 8.0),
- REAL_CONST(53931.28276525774 / 8.0),
- REAL_CONST(53951.602562737586 / 8.0),
- REAL_CONST(53971.924273659461 / 8.0),
- REAL_CONST(53992.24789766311 / 8.0),
- REAL_CONST(54012.57343438844 / 8.0),
- REAL_CONST(54032.90088347553 / 8.0),
- REAL_CONST(54053.23024456462 / 8.0),
- REAL_CONST(54073.561517296133 / 8.0),
- REAL_CONST(54093.894701310644 / 8.0),
- REAL_CONST(54114.22979624891 / 8.0),
- REAL_CONST(54134.566801751855 / 8.0),
- REAL_CONST(54154.90571746057 / 8.0),
- REAL_CONST(54175.246543016314 / 8.0),
- REAL_CONST(54195.589278060506 / 8.0),
- REAL_CONST(54215.933922234755 / 8.0),
- REAL_CONST(54236.280475180814 / 8.0),
- REAL_CONST(54256.628936540626 / 8.0),
- REAL_CONST(54276.97930595628 / 8.0),
- REAL_CONST(54297.331583070045 / 8.0),
- REAL_CONST(54317.685767524359 / 8.0),
- REAL_CONST(54338.041858961828 / 8.0),
- REAL_CONST(54358.399857025215 / 8.0),
- REAL_CONST(54378.759761357462 / 8.0),
- REAL_CONST(54399.121571601667 / 8.0),
- REAL_CONST(54419.485287401105 / 8.0),
- REAL_CONST(54439.850908399218 / 8.0),
- REAL_CONST(54460.218434239614 / 8.0),
- REAL_CONST(54480.587864566056 / 8.0),
- REAL_CONST(54500.95919902248 / 8.0),
- REAL_CONST(54521.332437252997 / 8.0),
- REAL_CONST(54541.707578901878 / 8.0),
- REAL_CONST(54562.084623613555 / 8.0),
- REAL_CONST(54582.46357103264 / 8.0),
- REAL_CONST(54602.844420803893 / 8.0),
- REAL_CONST(54623.227172572246 / 8.0),
- REAL_CONST(54643.611825982807 / 8.0),
- REAL_CONST(54663.998380680838 / 8.0),
- REAL_CONST(54684.386836311773 / 8.0),
- REAL_CONST(54704.777192521207 / 8.0),
- REAL_CONST(54725.169448954897 / 8.0),
- REAL_CONST(54745.563605258772 / 8.0),
- REAL_CONST(54765.959661078923 / 8.0),
- REAL_CONST(54786.357616061614 / 8.0),
- REAL_CONST(54806.757469853255 / 8.0),
- REAL_CONST(54827.159222100439 / 8.0),
- REAL_CONST(54847.562872449904 / 8.0),
- REAL_CONST(54867.968420548583 / 8.0),
- REAL_CONST(54888.375866043534 / 8.0),
- REAL_CONST(54908.785208582012 / 8.0),
- REAL_CONST(54929.196447811417 / 8.0),
- REAL_CONST(54949.609583379322 / 8.0),
- REAL_CONST(54970.024614933463 / 8.0),
- REAL_CONST(54990.441542121727 / 8.0),
- REAL_CONST(55010.86036459219 / 8.0),
- REAL_CONST(55031.28108199306 / 8.0),
- REAL_CONST(55051.703693972733 / 8.0),
- REAL_CONST(55072.128200179759 / 8.0),
- REAL_CONST(55092.554600262847 / 8.0),
- REAL_CONST(55112.982893870874 / 8.0),
- REAL_CONST(55133.413080652877 / 8.0),
- REAL_CONST(55153.845160258061 / 8.0),
- REAL_CONST(55174.279132335789 / 8.0),
- REAL_CONST(55194.714996535586 / 8.0),
- REAL_CONST(55215.152752507143 / 8.0),
- REAL_CONST(55235.592399900306 / 8.0),
- REAL_CONST(55256.033938365079 / 8.0),
- REAL_CONST(55276.477367551655 / 8.0),
- REAL_CONST(55296.92268711036 / 8.0),
- REAL_CONST(55317.369896691685 / 8.0),
- REAL_CONST(55337.818995946305 / 8.0),
- REAL_CONST(55358.269984525024 / 8.0),
- REAL_CONST(55378.72286207883 / 8.0),
- REAL_CONST(55399.177628258869 / 8.0),
- REAL_CONST(55419.634282716441 / 8.0),
- REAL_CONST(55440.092825103013 / 8.0),
- REAL_CONST(55460.553255070205 / 8.0),
- REAL_CONST(55481.015572269804 / 8.0),
- REAL_CONST(55501.479776353764 / 8.0),
- REAL_CONST(55521.945866974187 / 8.0),
- REAL_CONST(55542.413843783339 / 8.0),
- REAL_CONST(55562.883706433655 / 8.0),
- REAL_CONST(55583.355454577715 / 8.0),
- REAL_CONST(55603.82908786826 / 8.0),
- REAL_CONST(55624.304605958219 / 8.0),
- REAL_CONST(55644.782008500639 / 8.0),
- REAL_CONST(55665.261295148754 / 8.0),
- REAL_CONST(55685.742465555952 / 8.0),
- REAL_CONST(55706.225519375774 / 8.0),
- REAL_CONST(55726.710456261928 / 8.0),
- REAL_CONST(55747.197275868275 / 8.0),
- REAL_CONST(55767.685977848843 / 8.0),
- REAL_CONST(55788.176561857814 / 8.0),
- REAL_CONST(55808.669027549528 / 8.0),
- REAL_CONST(55829.163374578478 / 8.0),
- REAL_CONST(55849.659602599328 / 8.0),
- REAL_CONST(55870.157711266889 / 8.0),
- REAL_CONST(55890.657700236145 / 8.0),
- REAL_CONST(55911.159569162221 / 8.0),
- REAL_CONST(55931.663317700411 / 8.0),
- REAL_CONST(55952.168945506164 / 8.0),
- REAL_CONST(55972.676452235086 / 8.0),
- REAL_CONST(55993.185837542944 / 8.0),
- REAL_CONST(56013.697101085651 / 8.0),
- REAL_CONST(56034.210242519301 / 8.0),
- REAL_CONST(56054.72526150012 / 8.0),
- REAL_CONST(56075.242157684508 / 8.0),
- REAL_CONST(56095.760930729011 / 8.0),
- REAL_CONST(56116.281580290342 / 8.0),
- REAL_CONST(56136.804106025367 / 8.0),
- REAL_CONST(56157.328507591104 / 8.0),
- REAL_CONST(56177.85478464474 / 8.0),
- REAL_CONST(56198.382936843598 / 8.0),
- REAL_CONST(56218.912963845185 / 8.0),
- REAL_CONST(56239.444865307138 / 8.0),
- REAL_CONST(56259.978640887268 / 8.0),
- REAL_CONST(56280.514290243525 / 8.0),
- REAL_CONST(56301.051813034042 / 8.0),
- REAL_CONST(56321.591208917082 / 8.0),
- REAL_CONST(56342.13247755108 / 8.0),
- REAL_CONST(56362.675618594607 / 8.0),
- REAL_CONST(56383.220631706419 / 8.0),
- REAL_CONST(56403.767516545398 / 8.0),
- REAL_CONST(56424.316272770608 / 8.0),
- REAL_CONST(56444.866900041241 / 8.0),
- REAL_CONST(56465.419398016667 / 8.0),
- REAL_CONST(56485.973766356394 / 8.0),
- REAL_CONST(56506.530004720102 / 8.0),
- REAL_CONST(56527.088112767611 / 8.0),
- REAL_CONST(56547.648090158902 / 8.0),
- REAL_CONST(56568.209936554107 / 8.0),
- REAL_CONST(56588.773651613519 / 8.0),
- REAL_CONST(56609.339234997584 / 8.0),
- REAL_CONST(56629.9066863669 / 8.0),
- REAL_CONST(56650.47600538221 / 8.0),
- REAL_CONST(56671.04719170442 / 8.0),
- REAL_CONST(56691.620244994599 / 8.0),
- REAL_CONST(56712.195164913959 / 8.0),
- REAL_CONST(56732.771951123868 / 8.0),
- REAL_CONST(56753.350603285835 / 8.0),
- REAL_CONST(56773.931121061541 / 8.0),
- REAL_CONST(56794.513504112823 / 8.0),
- REAL_CONST(56815.097752101647 / 8.0),
- REAL_CONST(56835.683864690152 / 8.0),
- REAL_CONST(56856.271841540627 / 8.0),
- REAL_CONST(56876.86168231551 / 8.0),
- REAL_CONST(56897.453386677393 / 8.0),
- REAL_CONST(56918.046954289028 / 8.0),
- REAL_CONST(56938.642384813298 / 8.0),
- REAL_CONST(56959.239677913261 / 8.0),
- REAL_CONST(56979.838833252121 / 8.0),
- REAL_CONST(57000.439850493225 / 8.0),
- REAL_CONST(57021.04272930009 / 8.0),
- REAL_CONST(57041.647469336371 / 8.0),
- REAL_CONST(57062.254070265873 / 8.0),
- REAL_CONST(57082.862531752558 / 8.0),
- REAL_CONST(57103.472853460553 / 8.0),
- REAL_CONST(57124.085035054108 / 8.0),
- REAL_CONST(57144.699076197649 / 8.0),
- REAL_CONST(57165.314976555739 / 8.0),
- REAL_CONST(57185.932735793103 / 8.0),
- REAL_CONST(57206.552353574611 / 8.0),
- REAL_CONST(57227.173829565276 / 8.0),
- REAL_CONST(57247.797163430281 / 8.0),
- REAL_CONST(57268.42235483494 / 8.0),
- REAL_CONST(57289.049403444733 / 8.0),
- REAL_CONST(57309.678308925286 / 8.0),
- REAL_CONST(57330.30907094237 / 8.0),
- REAL_CONST(57350.941689161911 / 8.0),
- REAL_CONST(57371.576163249985 / 8.0),
- REAL_CONST(57392.212492872815 / 8.0),
- REAL_CONST(57412.850677696784 / 8.0),
- REAL_CONST(57433.490717388406 / 8.0),
- REAL_CONST(57454.132611614368 / 8.0),
- REAL_CONST(57474.776360041491 / 8.0),
- REAL_CONST(57495.421962336746 / 8.0),
- REAL_CONST(57516.069418167266 / 8.0),
- REAL_CONST(57536.718727200314 / 8.0),
- REAL_CONST(57557.36988910332 / 8.0),
- REAL_CONST(57578.022903543861 / 8.0),
- REAL_CONST(57598.677770189643 / 8.0),
- REAL_CONST(57619.334488708548 / 8.0),
- REAL_CONST(57639.993058768589 / 8.0),
- REAL_CONST(57660.653480037938 / 8.0),
- REAL_CONST(57681.315752184906 / 8.0),
- REAL_CONST(57701.979874877965 / 8.0),
- REAL_CONST(57722.64584778573 / 8.0),
- REAL_CONST(57743.31367057695 / 8.0),
- REAL_CONST(57763.983342920546 / 8.0),
- REAL_CONST(57784.654864485572 / 8.0),
- REAL_CONST(57805.328234941233 / 8.0),
- REAL_CONST(57826.003453956881 / 8.0),
- REAL_CONST(57846.680521202026 / 8.0),
- REAL_CONST(57867.359436346305 / 8.0),
- REAL_CONST(57888.040199059527 / 8.0),
- REAL_CONST(57908.722809011633 / 8.0),
- REAL_CONST(57929.407265872709 / 8.0),
- REAL_CONST(57950.093569313001 / 8.0),
- REAL_CONST(57970.781719002895 / 8.0),
- REAL_CONST(57991.471714612911 / 8.0),
- REAL_CONST(58012.16355581375 / 8.0),
- REAL_CONST(58032.857242276223 / 8.0),
- REAL_CONST(58053.552773671312 / 8.0),
- REAL_CONST(58074.25014967013 / 8.0),
- REAL_CONST(58094.949369943948 / 8.0),
- REAL_CONST(58115.650434164185 / 8.0),
- REAL_CONST(58136.353342002389 / 8.0),
- REAL_CONST(58157.058093130276 / 8.0),
- REAL_CONST(58177.764687219693 / 8.0),
- REAL_CONST(58198.47312394264 / 8.0),
- REAL_CONST(58219.183402971255 / 8.0),
- REAL_CONST(58239.895523977837 / 8.0),
- REAL_CONST(58260.609486634821 / 8.0),
- REAL_CONST(58281.325290614775 / 8.0),
- REAL_CONST(58302.042935590434 / 8.0),
- REAL_CONST(58322.762421234678 / 8.0),
- REAL_CONST(58343.483747220511 / 8.0),
- REAL_CONST(58364.206913221096 / 8.0),
- REAL_CONST(58384.931918909751 / 8.0),
- REAL_CONST(58405.658763959924 / 8.0),
- REAL_CONST(58426.3874480452 / 8.0),
- REAL_CONST(58447.117970839339 / 8.0),
- REAL_CONST(58467.85033201622 / 8.0),
- REAL_CONST(58488.584531249864 / 8.0),
- REAL_CONST(58509.320568214462 / 8.0),
- REAL_CONST(58530.058442584334 / 8.0),
- REAL_CONST(58550.798154033931 / 8.0),
- REAL_CONST(58571.539702237875 / 8.0),
- REAL_CONST(58592.283086870906 / 8.0),
- REAL_CONST(58613.028307607929 / 8.0),
- REAL_CONST(58633.775364123983 / 8.0),
- REAL_CONST(58654.52425609425 / 8.0),
- REAL_CONST(58675.274983194053 / 8.0),
- REAL_CONST(58696.027545098877 / 8.0),
- REAL_CONST(58716.781941484325 / 8.0),
- REAL_CONST(58737.538172026158 / 8.0),
- REAL_CONST(58758.296236400274 / 8.0),
- REAL_CONST(58779.056134282728 / 8.0),
- REAL_CONST(58799.817865349694 / 8.0),
- REAL_CONST(58820.581429277503 / 8.0),
- REAL_CONST(58841.346825742643 / 8.0),
- REAL_CONST(58862.114054421712 / 8.0),
- REAL_CONST(58882.883114991484 / 8.0),
- REAL_CONST(58903.654007128847 / 8.0),
- REAL_CONST(58924.426730510851 / 8.0),
- REAL_CONST(58945.201284814684 / 8.0),
- REAL_CONST(58965.977669717664 / 8.0),
- REAL_CONST(58986.755884897269 / 8.0),
- REAL_CONST(59007.535930031117 / 8.0),
- REAL_CONST(59028.317804796949 / 8.0),
- REAL_CONST(59049.101508872664 / 8.0),
- REAL_CONST(59069.887041936301 / 8.0),
- REAL_CONST(59090.674403666046 / 8.0),
- REAL_CONST(59111.463593740213 / 8.0),
- REAL_CONST(59132.254611837263 / 8.0),
- REAL_CONST(59153.047457635803 / 8.0),
- REAL_CONST(59173.84213081457 / 8.0),
- REAL_CONST(59194.638631052461 / 8.0),
- REAL_CONST(59215.436958028506 / 8.0),
- REAL_CONST(59236.237111421855 / 8.0),
- REAL_CONST(59257.039090911829 / 8.0),
- REAL_CONST(59277.842896177877 / 8.0),
- REAL_CONST(59298.648526899589 / 8.0),
- REAL_CONST(59319.455982756685 / 8.0),
- REAL_CONST(59340.26526342905 / 8.0),
- REAL_CONST(59361.076368596696 / 8.0),
- REAL_CONST(59381.889297939757 / 8.0),
- REAL_CONST(59402.704051138542 / 8.0),
- REAL_CONST(59423.520627873484 / 8.0),
- REAL_CONST(59444.339027825139 / 8.0),
- REAL_CONST(59465.159250674224 / 8.0),
- REAL_CONST(59485.9812961016 / 8.0),
- REAL_CONST(59506.805163788253 / 8.0),
- REAL_CONST(59527.630853415307 / 8.0),
- REAL_CONST(59548.458364664046 / 8.0),
- REAL_CONST(59569.287697215863 / 8.0),
- REAL_CONST(59590.118850752311 / 8.0),
- REAL_CONST(59610.951824955089 / 8.0),
- REAL_CONST(59631.786619506012 / 8.0),
- REAL_CONST(59652.623234087048 / 8.0),
- REAL_CONST(59673.461668380311 / 8.0),
- REAL_CONST(59694.301922068029 / 8.0),
- REAL_CONST(59715.143994832593 / 8.0),
- REAL_CONST(59735.987886356525 / 8.0),
- REAL_CONST(59756.833596322482 / 8.0),
- REAL_CONST(59777.681124413255 / 8.0),
- REAL_CONST(59798.530470311794 / 8.0),
- REAL_CONST(59819.381633701159 / 8.0),
- REAL_CONST(59840.234614264569 / 8.0),
- REAL_CONST(59861.089411685381 / 8.0),
- REAL_CONST(59881.94602564707 / 8.0),
- REAL_CONST(59902.804455833269 / 8.0),
- REAL_CONST(59923.664701927737 / 8.0),
- REAL_CONST(59944.526763614384 / 8.0),
- REAL_CONST(59965.390640577243 / 8.0),
- REAL_CONST(59986.256332500488 / 8.0),
- REAL_CONST(60007.123839068438 / 8.0),
- REAL_CONST(60027.993159965539 / 8.0),
- REAL_CONST(60048.864294876381 / 8.0),
- REAL_CONST(60069.737243485688 / 8.0),
- REAL_CONST(60090.612005478324 / 8.0),
- REAL_CONST(60111.488580539284 / 8.0),
- REAL_CONST(60132.366968353708 / 8.0),
- REAL_CONST(60153.247168606867 / 8.0),
- REAL_CONST(60174.129180984164 / 8.0),
- REAL_CONST(60195.013005171153 / 8.0),
- REAL_CONST(60215.898640853513 / 8.0),
- REAL_CONST(60236.786087717061 / 8.0),
- REAL_CONST(60257.675345447751 / 8.0),
- REAL_CONST(60278.566413731671 / 8.0),
- REAL_CONST(60299.459292255044 / 8.0),
- REAL_CONST(60320.353980704247 / 8.0),
- REAL_CONST(60341.25047876576 / 8.0),
- REAL_CONST(60362.148786126229 / 8.0),
- REAL_CONST(60383.048902472423 / 8.0),
- REAL_CONST(60403.950827491237 / 8.0),
- REAL_CONST(60424.854560869717 / 8.0),
- REAL_CONST(60445.76010229504 / 8.0),
- REAL_CONST(60466.667451454516 / 8.0),
- REAL_CONST(60487.57660803559 / 8.0),
- REAL_CONST(60508.487571725847 / 8.0),
- REAL_CONST(60529.400342212997 / 8.0),
- REAL_CONST(60550.314919184893 / 8.0),
- REAL_CONST(60571.231302329521 / 8.0),
- REAL_CONST(60592.149491335003 / 8.0),
- REAL_CONST(60613.069485889588 / 8.0),
- REAL_CONST(60633.991285681674 / 8.0),
- REAL_CONST(60654.914890399785 / 8.0),
- REAL_CONST(60675.840299732568 / 8.0),
- REAL_CONST(60696.767513368832 / 8.0),
- REAL_CONST(60717.696530997484 / 8.0),
- REAL_CONST(60738.627352307602 / 8.0),
- REAL_CONST(60759.55997698837 / 8.0),
- REAL_CONST(60780.494404729128 / 8.0),
- REAL_CONST(60801.430635219323 / 8.0),
- REAL_CONST(60822.368668148556 / 8.0),
- REAL_CONST(60843.308503206565 / 8.0),
- REAL_CONST(60864.250140083204 / 8.0),
- REAL_CONST(60885.193578468468 / 8.0),
- REAL_CONST(60906.138818052495 / 8.0),
- REAL_CONST(60927.085858525541 / 8.0),
- REAL_CONST(60948.034699578006 / 8.0),
- REAL_CONST(60968.985340900421 / 8.0),
- REAL_CONST(60989.937782183442 / 8.0),
- REAL_CONST(61010.892023117864 / 8.0),
- REAL_CONST(61031.848063394616 / 8.0),
- REAL_CONST(61052.805902704764 / 8.0),
- REAL_CONST(61073.765540739492 / 8.0),
- REAL_CONST(61094.726977190134 / 8.0),
- REAL_CONST(61115.690211748137 / 8.0),
- REAL_CONST(61136.655244105103 / 8.0),
- REAL_CONST(61157.622073952742 / 8.0),
- REAL_CONST(61178.590700982917 / 8.0),
- REAL_CONST(61199.561124887616 / 8.0),
- REAL_CONST(61220.533345358948 / 8.0),
- REAL_CONST(61241.507362089171 / 8.0),
- REAL_CONST(61262.483174770663 / 8.0),
- REAL_CONST(61283.460783095943 / 8.0),
- REAL_CONST(61304.440186757645 / 8.0),
- REAL_CONST(61325.421385448557 / 8.0),
- REAL_CONST(61346.404378861582 / 8.0),
- REAL_CONST(61367.389166689762 / 8.0),
- REAL_CONST(61388.375748626262 / 8.0),
- REAL_CONST(61409.364124364387 / 8.0),
- REAL_CONST(61430.354293597571 / 8.0),
- REAL_CONST(61451.346256019373 / 8.0),
- REAL_CONST(61472.340011323497 / 8.0),
- REAL_CONST(61493.335559203762 / 8.0),
- REAL_CONST(61514.332899354122 / 8.0),
- REAL_CONST(61535.332031468672 / 8.0),
- REAL_CONST(61556.332955241618 / 8.0),
- REAL_CONST(61577.335670367313 / 8.0),
- REAL_CONST(61598.340176540238 / 8.0),
- REAL_CONST(61619.346473454993 / 8.0),
- REAL_CONST(61640.354560806329 / 8.0),
- REAL_CONST(61661.3644382891 / 8.0),
- REAL_CONST(61682.376105598312 / 8.0),
- REAL_CONST(61703.389562429089 / 8.0),
- REAL_CONST(61724.404808476691 / 8.0),
- REAL_CONST(61745.42184343651 / 8.0),
- REAL_CONST(61766.440667004063 / 8.0),
- REAL_CONST(61787.461278874987 / 8.0),
- REAL_CONST(61808.483678745069 / 8.0),
- REAL_CONST(61829.507866310203 / 8.0),
- REAL_CONST(61850.533841266435 / 8.0),
- REAL_CONST(61871.561603309929 / 8.0),
- REAL_CONST(61892.591152136971 / 8.0),
- REAL_CONST(61913.622487443987 / 8.0),
- REAL_CONST(61934.655608927525 / 8.0),
- REAL_CONST(61955.690516284267 / 8.0),
- REAL_CONST(61976.727209211022 / 8.0),
- REAL_CONST(61997.765687404724 / 8.0),
- REAL_CONST(62018.805950562448 / 8.0),
- REAL_CONST(62039.847998381381 / 8.0),
- REAL_CONST(62060.891830558845 / 8.0),
- REAL_CONST(62081.93744679229 / 8.0),
- REAL_CONST(62102.984846779298 / 8.0),
- REAL_CONST(62124.034030217575 / 8.0),
- REAL_CONST(62145.084996804966 / 8.0),
- REAL_CONST(62166.137746239416 / 8.0),
- REAL_CONST(62187.19227821903 / 8.0),
- REAL_CONST(62208.248592442025 / 8.0),
- REAL_CONST(62229.306688606739 / 8.0),
- REAL_CONST(62250.366566411656 / 8.0),
- REAL_CONST(62271.428225555377 / 8.0),
- REAL_CONST(62292.491665736627 / 8.0),
- REAL_CONST(62313.556886654267 / 8.0),
- REAL_CONST(62334.623888007271 / 8.0),
- REAL_CONST(62355.692669494762 / 8.0),
- REAL_CONST(62376.763230815974 / 8.0),
- REAL_CONST(62397.835571670272 / 8.0),
- REAL_CONST(62418.909691757144 / 8.0),
- REAL_CONST(62439.98559077621 / 8.0),
- REAL_CONST(62461.063268427228 / 8.0),
- REAL_CONST(62482.142724410049 / 8.0),
- REAL_CONST(62503.223958424685 / 8.0),
- REAL_CONST(62524.306970171267 / 8.0),
- REAL_CONST(62545.39175935003 / 8.0),
- REAL_CONST(62566.478325661366 / 8.0),
- REAL_CONST(62587.566668805768 / 8.0),
- REAL_CONST(62608.656788483881 / 8.0),
- REAL_CONST(62629.748684396451 / 8.0),
- REAL_CONST(62650.842356244357 / 8.0),
- REAL_CONST(62671.937803728622 / 8.0),
- REAL_CONST(62693.035026550366 / 8.0),
- REAL_CONST(62714.134024410858 / 8.0),
- REAL_CONST(62735.234797011479 / 8.0),
- REAL_CONST(62756.337344053733 / 8.0),
- REAL_CONST(62777.441665239276 / 8.0),
- REAL_CONST(62798.547760269852 / 8.0),
- REAL_CONST(62819.655628847358 / 8.0),
- REAL_CONST(62840.765270673801 / 8.0),
- REAL_CONST(62861.876685451323 / 8.0),
- REAL_CONST(62882.989872882186 / 8.0),
- REAL_CONST(62904.104832668774 / 8.0),
- REAL_CONST(62925.221564513602 / 8.0),
- REAL_CONST(62946.340068119309 / 8.0),
- REAL_CONST(62967.460343188657 / 8.0),
- REAL_CONST(62988.582389424526 / 8.0),
- REAL_CONST(63009.70620652994 / 8.0),
- REAL_CONST(63030.831794208025 / 8.0),
- REAL_CONST(63051.959152162039 / 8.0),
- REAL_CONST(63073.08828009537 / 8.0),
- REAL_CONST(63094.219177711529 / 8.0),
- REAL_CONST(63115.351844714154 / 8.0),
- REAL_CONST(63136.486280806988 / 8.0),
- REAL_CONST(63157.622485693922 / 8.0),
- REAL_CONST(63178.760459078956 / 8.0),
- REAL_CONST(63199.900200666219 / 8.0),
- REAL_CONST(63221.041710159967 / 8.0),
- REAL_CONST(63242.184987264569 / 8.0),
- REAL_CONST(63263.330031684534 / 8.0),
- REAL_CONST(63284.476843124474 / 8.0),
- REAL_CONST(63305.625421289144 / 8.0),
- REAL_CONST(63326.775765883409 / 8.0),
- REAL_CONST(63347.927876612259 / 8.0),
- REAL_CONST(63369.081753180813 / 8.0),
- REAL_CONST(63390.237395294316 / 8.0),
- REAL_CONST(63411.39480265812 / 8.0),
- REAL_CONST(63432.553974977716 / 8.0),
- REAL_CONST(63453.714911958712 / 8.0),
- REAL_CONST(63474.877613306839 / 8.0),
- REAL_CONST(63496.042078727944 / 8.0),
- REAL_CONST(63517.208307927998 / 8.0),
- REAL_CONST(63538.376300613119 / 8.0),
- REAL_CONST(63559.546056489504 / 8.0),
- REAL_CONST(63580.717575263516 / 8.0),
- REAL_CONST(63601.890856641607 / 8.0),
- REAL_CONST(63623.065900330374 / 8.0),
- REAL_CONST(63644.242706036515 / 8.0),
- REAL_CONST(63665.421273466869 / 8.0),
- REAL_CONST(63686.601602328381 / 8.0),
- REAL_CONST(63707.783692328136 / 8.0),
- REAL_CONST(63728.967543173334 / 8.0),
- REAL_CONST(63750.153154571279 / 8.0),
- REAL_CONST(63771.340526229418 / 8.0),
- REAL_CONST(63792.529657855317 / 8.0),
- REAL_CONST(63813.720549156649 / 8.0),
- REAL_CONST(63834.913199841227 / 8.0),
- REAL_CONST(63856.107609616978 / 8.0),
- REAL_CONST(63877.303778191941 / 8.0),
- REAL_CONST(63898.501705274284 / 8.0),
- REAL_CONST(63919.7013905723 / 8.0),
- REAL_CONST(63940.902833794404 / 8.0),
- REAL_CONST(63962.106034649114 / 8.0),
- REAL_CONST(63983.310992845094 / 8.0),
- REAL_CONST(64004.517708091109 / 8.0),
- REAL_CONST(64025.726180096048 / 8.0),
- REAL_CONST(64046.936408568938 / 8.0),
- REAL_CONST(64068.1483932189 / 8.0),
- REAL_CONST(64089.362133755196 / 8.0),
- REAL_CONST(64110.577629887193 / 8.0),
- REAL_CONST(64131.794881324393 / 8.0),
- REAL_CONST(64153.013887776404 / 8.0),
- REAL_CONST(64174.234648952966 / 8.0),
- REAL_CONST(64195.457164563937 / 8.0),
- REAL_CONST(64216.681434319289 / 8.0),
- REAL_CONST(64237.907457929112 / 8.0),
- REAL_CONST(64259.135235103626 / 8.0),
- REAL_CONST(64280.36476555316 / 8.0),
- REAL_CONST(64301.596048988169 / 8.0),
- REAL_CONST(64322.829085119236 / 8.0),
- REAL_CONST(64344.06387365704 / 8.0),
- REAL_CONST(64365.300414312398 / 8.0),
- REAL_CONST(64386.538706796251 / 8.0),
- REAL_CONST(64407.778750819634 / 8.0),
- REAL_CONST(64429.020546093721 / 8.0),
- REAL_CONST(64450.26409232981 / 8.0),
- REAL_CONST(64471.509389239291 / 8.0),
- REAL_CONST(64492.756436533709 / 8.0),
- REAL_CONST(64514.005233924705 / 8.0),
- REAL_CONST(64535.255781124033 / 8.0),
- REAL_CONST(64556.50807784358 / 8.0),
- REAL_CONST(64577.762123795357 / 8.0),
- REAL_CONST(64599.017918691468 / 8.0),
- REAL_CONST(64620.275462244172 / 8.0),
- REAL_CONST(64641.534754165805 / 8.0),
- REAL_CONST(64662.795794168844 / 8.0),
- REAL_CONST(64684.058581965895 / 8.0),
- REAL_CONST(64705.323117269661 / 8.0),
- REAL_CONST(64726.589399792974 / 8.0),
- REAL_CONST(64747.857429248776 / 8.0),
- REAL_CONST(64769.127205350138 / 8.0),
- REAL_CONST(64790.398727810236 / 8.0),
- REAL_CONST(64811.671996342375 / 8.0),
- REAL_CONST(64832.947010659969 / 8.0),
- REAL_CONST(64854.223770476558 / 8.0),
- REAL_CONST(64875.502275505794 / 8.0),
- REAL_CONST(64896.782525461451 / 8.0),
- REAL_CONST(64918.064520057414 / 8.0),
- REAL_CONST(64939.348259007682 / 8.0),
- REAL_CONST(64960.633742026388 / 8.0),
- REAL_CONST(64981.920968827762 / 8.0),
- REAL_CONST(65003.209939126165 / 8.0),
- REAL_CONST(65024.500652636067 / 8.0),
- REAL_CONST(65045.793109072067 / 8.0),
- REAL_CONST(65067.087308148861 / 8.0),
- REAL_CONST(65088.383249581282 / 8.0),
- REAL_CONST(65109.680933084259 / 8.0),
- REAL_CONST(65130.980358372864 / 8.0),
- REAL_CONST(65152.28152516226 / 8.0),
- REAL_CONST(65173.584433167736 / 8.0),
- REAL_CONST(65194.889082104703 / 8.0),
- REAL_CONST(65216.195471688683 / 8.0),
- REAL_CONST(65237.503601635319 / 8.0),
- REAL_CONST(65258.813471660353 / 8.0),
- REAL_CONST(65280.125081479666 / 8.0),
- REAL_CONST(65301.438430809241 / 8.0),
- REAL_CONST(65322.753519365178 / 8.0),
- REAL_CONST(65344.070346863708 / 8.0),
- REAL_CONST(65365.388913021146 / 8.0),
- REAL_CONST(65386.709217553958 / 8.0),
- REAL_CONST(65408.031260178701 / 8.0),
- REAL_CONST(65429.355040612056 / 8.0),
- REAL_CONST(65450.680558570821 / 8.0),
- REAL_CONST(65472.00781377191 / 8.0),
- REAL_CONST(65493.336805932355 / 8.0),
- REAL_CONST(65514.66753476928 / 8.0),
- REAL_CONST(65535.999999999956 / 8.0),
- REAL_CONST(65557.334201341757 / 8.0),
- REAL_CONST(65578.670138512171 / 8.0),
- REAL_CONST(65600.007811228788 / 8.0),
- REAL_CONST(65621.347219209332 / 8.0),
- REAL_CONST(65642.688362171626 / 8.0),
- REAL_CONST(65664.031239833639 / 8.0),
- REAL_CONST(65685.375851913413 / 8.0),
- REAL_CONST(65706.722198129137 / 8.0),
- REAL_CONST(65728.070278199084 / 8.0),
- REAL_CONST(65749.420091841661 / 8.0),
- REAL_CONST(65770.771638775404 / 8.0),
- REAL_CONST(65792.124918718939 / 8.0),
- REAL_CONST(65813.479931391004 / 8.0),
- REAL_CONST(65834.836676510458 / 8.0),
- REAL_CONST(65856.195153796303 / 8.0),
- REAL_CONST(65877.5553629676 / 8.0),
- REAL_CONST(65898.917303743554 / 8.0),
- REAL_CONST(65920.280975843489 / 8.0),
- REAL_CONST(65941.646378986843 / 8.0),
- REAL_CONST(65963.013512893158 / 8.0),
- REAL_CONST(65984.382377282076 / 8.0),
- REAL_CONST(66005.752971873386 / 8.0),
- REAL_CONST(66027.125296386963 / 8.0),
- REAL_CONST(66048.499350542799 / 8.0),
- REAL_CONST(66069.875134061018 / 8.0),
- REAL_CONST(66091.252646661844 / 8.0),
- REAL_CONST(66112.631888065618 / 8.0),
- REAL_CONST(66134.01285799277 / 8.0),
- REAL_CONST(66155.395556163887 / 8.0),
- REAL_CONST(66176.779982299631 / 8.0),
- REAL_CONST(66198.166136120795 / 8.0),
- REAL_CONST(66219.554017348273 / 8.0),
- REAL_CONST(66240.943625703105 / 8.0),
- REAL_CONST(66262.334960906388 / 8.0),
- REAL_CONST(66283.728022679396 / 8.0),
- REAL_CONST(66305.122810743444 / 8.0),
- REAL_CONST(66326.519324820023 / 8.0),
- REAL_CONST(66347.917564630698 / 8.0),
- REAL_CONST(66369.317529897162 / 8.0),
- REAL_CONST(66390.719220341227 / 8.0),
- REAL_CONST(66412.122635684791 / 8.0),
- REAL_CONST(66433.527775649884 / 8.0),
- REAL_CONST(66454.934639958636 / 8.0),
- REAL_CONST(66476.343228333324 / 8.0),
- REAL_CONST(66497.753540496284 / 8.0),
- REAL_CONST(66519.165576169995 / 8.0),
- REAL_CONST(66540.57933507704 / 8.0),
- REAL_CONST(66561.994816940118 / 8.0),
- REAL_CONST(66583.412021482043 / 8.0),
- REAL_CONST(66604.830948425733 / 8.0),
- REAL_CONST(66626.251597494222 / 8.0),
- REAL_CONST(66647.673968410629 / 8.0),
- REAL_CONST(66669.098060898235 / 8.0),
- REAL_CONST(66690.523874680381 / 8.0),
- REAL_CONST(66711.951409480564 / 8.0),
- REAL_CONST(66733.380665022371 / 8.0),
- REAL_CONST(66754.811641029475 / 8.0),
- REAL_CONST(66776.244337225711 / 8.0),
- REAL_CONST(66797.678753334985 / 8.0),
- REAL_CONST(66819.11488908132 / 8.0),
- REAL_CONST(66840.552744188884 / 8.0),
- REAL_CONST(66861.992318381905 / 8.0),
- REAL_CONST(66883.433611384738 / 8.0),
- REAL_CONST(66904.876622921889 / 8.0),
- REAL_CONST(66926.321352717903 / 8.0),
- REAL_CONST(66947.767800497502 / 8.0),
- REAL_CONST(66969.215965985466 / 8.0),
- REAL_CONST(66990.665848906734 / 8.0),
- REAL_CONST(67012.117448986304 / 8.0),
- REAL_CONST(67033.570765949335 / 8.0),
- REAL_CONST(67055.025799521056 / 8.0),
- REAL_CONST(67076.482549426815 / 8.0),
- REAL_CONST(67097.941015392076 / 8.0),
- REAL_CONST(67119.401197142433 / 8.0),
- REAL_CONST(67140.863094403554 / 8.0),
- REAL_CONST(67162.326706901222 / 8.0),
- REAL_CONST(67183.792034361351 / 8.0),
- REAL_CONST(67205.259076509959 / 8.0),
- REAL_CONST(67226.72783307315 / 8.0),
- REAL_CONST(67248.198303777172 / 8.0),
- REAL_CONST(67269.670488348347 / 8.0),
- REAL_CONST(67291.144386513144 / 8.0),
- REAL_CONST(67312.619997998088 / 8.0),
- REAL_CONST(67334.09732252988 / 8.0),
- REAL_CONST(67355.576359835293 / 8.0),
- REAL_CONST(67377.057109641188 / 8.0),
- REAL_CONST(67398.53957167457 / 8.0),
- REAL_CONST(67420.023745662547 / 8.0),
- REAL_CONST(67441.50963133233 / 8.0),
- REAL_CONST(67462.99722841123 / 8.0),
- REAL_CONST(67484.486536626689 / 8.0),
- REAL_CONST(67505.977555706224 / 8.0),
- REAL_CONST(67527.470285377494 / 8.0),
- REAL_CONST(67548.964725368263 / 8.0),
- REAL_CONST(67570.460875406367 / 8.0),
- REAL_CONST(67591.9587352198 / 8.0),
- REAL_CONST(67613.458304536631 / 8.0),
- REAL_CONST(67634.95958308503 / 8.0),
- REAL_CONST(67656.462570593329 / 8.0),
- REAL_CONST(67677.967266789899 / 8.0),
- REAL_CONST(67699.473671403248 / 8.0),
- REAL_CONST(67720.981784162024 / 8.0),
- REAL_CONST(67742.491604794923 / 8.0),
- REAL_CONST(67764.003133030797 / 8.0),
- REAL_CONST(67785.516368598575 / 8.0),
- REAL_CONST(67807.031311227314 / 8.0),
- REAL_CONST(67828.547960646174 / 8.0),
- REAL_CONST(67850.066316584402 / 8.0),
- REAL_CONST(67871.58637877139 / 8.0),
- REAL_CONST(67893.108146936589 / 8.0),
- REAL_CONST(67914.63162080961 / 8.0),
- REAL_CONST(67936.156800120138 / 8.0),
- REAL_CONST(67957.683684597971 / 8.0),
- REAL_CONST(67979.212273973011 / 8.0),
- REAL_CONST(68000.742567975263 / 8.0),
- REAL_CONST(68022.274566334876 / 8.0),
- REAL_CONST(68043.808268782057 / 8.0),
- REAL_CONST(68065.343675047145 / 8.0),
- REAL_CONST(68086.880784860579 / 8.0),
- REAL_CONST(68108.419597952918 / 8.0),
- REAL_CONST(68129.960114054789 / 8.0),
- REAL_CONST(68151.502332896969 / 8.0),
- REAL_CONST(68173.04625421032 / 8.0),
- REAL_CONST(68194.591877725834 / 8.0),
- REAL_CONST(68216.139203174564 / 8.0),
- REAL_CONST(68237.688230287706 / 8.0),
- REAL_CONST(68259.238958796544 / 8.0),
- REAL_CONST(68280.791388432481 / 8.0),
- REAL_CONST(68302.345518927032 / 8.0),
- REAL_CONST(68323.901350011787 / 8.0),
- REAL_CONST(68345.458881418483 / 8.0),
- REAL_CONST(68367.018112878912 / 8.0),
- REAL_CONST(68388.579044125028 / 8.0),
- REAL_CONST(68410.141674888844 / 8.0),
- REAL_CONST(68431.706004902502 / 8.0),
- REAL_CONST(68453.272033898262 / 8.0),
- REAL_CONST(68474.839761608455 / 8.0),
- REAL_CONST(68496.409187765545 / 8.0),
- REAL_CONST(68517.980312102081 / 8.0),
- REAL_CONST(68539.553134350732 / 8.0),
- REAL_CONST(68561.127654244279 / 8.0),
- REAL_CONST(68582.70387151558 / 8.0),
- REAL_CONST(68604.281785897634 / 8.0),
- REAL_CONST(68625.861397123503 / 8.0),
- REAL_CONST(68647.44270492639 / 8.0),
- REAL_CONST(68669.025709039604 / 8.0),
- REAL_CONST(68690.610409196524 / 8.0),
- REAL_CONST(68712.196805130661 / 8.0),
- REAL_CONST(68733.784896575627 / 8.0),
- REAL_CONST(68755.374683265123 / 8.0),
- REAL_CONST(68776.966164932994 / 8.0),
- REAL_CONST(68798.559341313128 / 8.0),
- REAL_CONST(68820.154212139591 / 8.0),
- REAL_CONST(68841.750777146473 / 8.0),
- REAL_CONST(68863.349036068044 / 8.0),
- REAL_CONST(68884.948988638629 / 8.0),
- REAL_CONST(68906.550634592684 / 8.0),
- REAL_CONST(68928.153973664739 / 8.0),
- REAL_CONST(68949.75900558944 / 8.0),
- REAL_CONST(68971.365730101577 / 8.0),
- REAL_CONST(68992.974146935987 / 8.0),
- REAL_CONST(69014.584255827634 / 8.0),
- REAL_CONST(69036.196056511588 / 8.0),
- REAL_CONST(69057.809548723017 / 8.0),
- REAL_CONST(69079.424732197207 / 8.0),
- REAL_CONST(69101.041606669532 / 8.0),
- REAL_CONST(69122.660171875468 / 8.0),
- REAL_CONST(69144.280427550606 / 8.0),
- REAL_CONST(69165.902373430625 / 8.0),
- REAL_CONST(69187.526009251334 / 8.0),
- REAL_CONST(69209.151334748618 / 8.0),
- REAL_CONST(69230.778349658474 / 8.0),
- REAL_CONST(69252.40705371699 / 8.0),
- REAL_CONST(69274.037446660412 / 8.0),
- REAL_CONST(69295.669528225 / 8.0),
- REAL_CONST(69317.303298147192 / 8.0),
- REAL_CONST(69338.938756163494 / 8.0),
- REAL_CONST(69360.575902010532 / 8.0),
- REAL_CONST(69382.214735425005 / 8.0),
- REAL_CONST(69403.855256143754 / 8.0),
- REAL_CONST(69425.497463903681 / 8.0),
- REAL_CONST(69447.141358441833 / 8.0),
- REAL_CONST(69468.78693949533 / 8.0),
- REAL_CONST(69490.434206801394 / 8.0),
- REAL_CONST(69512.083160097391 / 8.0),
- REAL_CONST(69533.733799120717 / 8.0),
- REAL_CONST(69555.386123608929 / 8.0),
- REAL_CONST(69577.04013329967 / 8.0),
- REAL_CONST(69598.695827930685 / 8.0),
- REAL_CONST(69620.353207239794 / 8.0),
- REAL_CONST(69642.012270964973 / 8.0),
- REAL_CONST(69663.67301884426 / 8.0),
- REAL_CONST(69685.335450615792 / 8.0),
- REAL_CONST(69706.999566017839 / 8.0),
- REAL_CONST(69728.665364788743 / 8.0),
- REAL_CONST(69750.332846666963 / 8.0),
- REAL_CONST(69772.002011391058 / 8.0),
- REAL_CONST(69793.672858699691 / 8.0),
- REAL_CONST(69815.345388331611 / 8.0),
- REAL_CONST(69837.019600025669 / 8.0),
- REAL_CONST(69858.695493520849 / 8.0),
- REAL_CONST(69880.373068556204 / 8.0),
- REAL_CONST(69902.052324870907 / 8.0),
- REAL_CONST(69923.733262204216 / 8.0),
- REAL_CONST(69945.415880295492 / 8.0),
- REAL_CONST(69967.100178884211 / 8.0),
- REAL_CONST(69988.786157709939 / 8.0),
- REAL_CONST(70010.473816512356 / 8.0),
- REAL_CONST(70032.163155031216 / 8.0),
- REAL_CONST(70053.854173006403 / 8.0),
- REAL_CONST(70075.546870177874 / 8.0),
- REAL_CONST(70097.241246285717 / 8.0),
- REAL_CONST(70118.937301070109 / 8.0),
- REAL_CONST(70140.635034271298 / 8.0),
- REAL_CONST(70162.334445629691 / 8.0),
- REAL_CONST(70184.035534885741 / 8.0),
- REAL_CONST(70205.738301780017 / 8.0),
- REAL_CONST(70227.442746053217 / 8.0),
- REAL_CONST(70249.1488674461 / 8.0),
- REAL_CONST(70270.856665699539 / 8.0),
- REAL_CONST(70292.566140554511 / 8.0),
- REAL_CONST(70314.277291752107 / 8.0),
- REAL_CONST(70335.990119033493 / 8.0),
- REAL_CONST(70357.704622139936 / 8.0),
- REAL_CONST(70379.420800812819 / 8.0),
- REAL_CONST(70401.138654793613 / 8.0),
- REAL_CONST(70422.85818382389 / 8.0),
- REAL_CONST(70444.579387645339 / 8.0),
- REAL_CONST(70466.302265999722 / 8.0),
- REAL_CONST(70488.026818628918 / 8.0),
- REAL_CONST(70509.753045274876 / 8.0),
- REAL_CONST(70531.480945679708 / 8.0),
- REAL_CONST(70553.210519585555 / 8.0),
- REAL_CONST(70574.941766734701 / 8.0),
- REAL_CONST(70596.674686869505 / 8.0),
- REAL_CONST(70618.409279732456 / 8.0),
- REAL_CONST(70640.145545066101 / 8.0),
- REAL_CONST(70661.883482613106 / 8.0),
- REAL_CONST(70683.623092116264 / 8.0),
- REAL_CONST(70705.364373318414 / 8.0),
- REAL_CONST(70727.107325962526 / 8.0),
- REAL_CONST(70748.851949791671 / 8.0),
- REAL_CONST(70770.598244549008 / 8.0),
- REAL_CONST(70792.346209977783 / 8.0),
- REAL_CONST(70814.095845821372 / 8.0),
- REAL_CONST(70835.847151823225 / 8.0),
- REAL_CONST(70857.600127726895 / 8.0),
- REAL_CONST(70879.354773276034 / 8.0),
- REAL_CONST(70901.111088214413 / 8.0),
- REAL_CONST(70922.869072285859 / 8.0),
- REAL_CONST(70944.628725234332 / 8.0),
- REAL_CONST(70966.390046803877 / 8.0),
- REAL_CONST(70988.153036738629 / 8.0),
- REAL_CONST(71009.917694782853 / 8.0),
- REAL_CONST(71031.684020680885 / 8.0),
- REAL_CONST(71053.45201417715 / 8.0),
- REAL_CONST(71075.221675016204 / 8.0),
- REAL_CONST(71096.993002942661 / 8.0),
- REAL_CONST(71118.765997701266 / 8.0),
- REAL_CONST(71140.540659036851 / 8.0),
- REAL_CONST(71162.316986694335 / 8.0),
- REAL_CONST(71184.09498041874 / 8.0),
- REAL_CONST(71205.874639955218 / 8.0),
- REAL_CONST(71227.655965048951 / 8.0),
- REAL_CONST(71249.438955445294 / 8.0),
- REAL_CONST(71271.223610889632 / 8.0),
- REAL_CONST(71293.009931127483 / 8.0),
- REAL_CONST(71314.797915904477 / 8.0),
- REAL_CONST(71336.587564966307 / 8.0),
- REAL_CONST(71358.378878058764 / 8.0),
- REAL_CONST(71380.171854927772 / 8.0),
- REAL_CONST(71401.966495319313 / 8.0),
- REAL_CONST(71423.762798979486 / 8.0),
- REAL_CONST(71445.560765654489 / 8.0),
- REAL_CONST(71467.360395090596 / 8.0),
- REAL_CONST(71489.161687034211 / 8.0),
- REAL_CONST(71510.964641231811 / 8.0),
- REAL_CONST(71532.769257429973 / 8.0),
- REAL_CONST(71554.575535375348 / 8.0),
- REAL_CONST(71576.383474814749 / 8.0),
- REAL_CONST(71598.19307549503 / 8.0),
- REAL_CONST(71620.004337163133 / 8.0),
- REAL_CONST(71641.817259566145 / 8.0),
- REAL_CONST(71663.631842451214 / 8.0),
- REAL_CONST(71685.4480855656 / 8.0),
- REAL_CONST(71707.26598865664 / 8.0),
- REAL_CONST(71729.085551471784 / 8.0),
- REAL_CONST(71750.906773758586 / 8.0),
- REAL_CONST(71772.729655264673 / 8.0),
- REAL_CONST(71794.554195737772 / 8.0),
- REAL_CONST(71816.380394925713 / 8.0),
- REAL_CONST(71838.208252576442 / 8.0),
- REAL_CONST(71860.037768437964 / 8.0),
- REAL_CONST(71881.868942258385 / 8.0),
- REAL_CONST(71903.701773785942 / 8.0),
- REAL_CONST(71925.536262768932 / 8.0),
- REAL_CONST(71947.372408955751 / 8.0),
- REAL_CONST(71969.210212094898 / 8.0),
- REAL_CONST(71991.049671934976 / 8.0),
- REAL_CONST(72012.890788224686 / 8.0),
- REAL_CONST(72034.73356071279 / 8.0),
- REAL_CONST(72056.577989148165 / 8.0),
- REAL_CONST(72078.424073279821 / 8.0),
- REAL_CONST(72100.271812856794 / 8.0),
- REAL_CONST(72122.121207628254 / 8.0),
- REAL_CONST(72143.97225734347 / 8.0),
- REAL_CONST(72165.824961751801 / 8.0),
- REAL_CONST(72187.679320602692 / 8.0),
- REAL_CONST(72209.53533364569 / 8.0),
- REAL_CONST(72231.393000630429 / 8.0),
- REAL_CONST(72253.252321306645 / 8.0),
- REAL_CONST(72275.113295424177 / 8.0),
- REAL_CONST(72296.975922732949 / 8.0),
- REAL_CONST(72318.840202982959 / 8.0),
- REAL_CONST(72340.706135924338 / 8.0),
- REAL_CONST(72362.573721307272 / 8.0),
- REAL_CONST(72384.442958882093 / 8.0),
- REAL_CONST(72406.313848399179 / 8.0),
- REAL_CONST(72428.186389609036 / 8.0),
- REAL_CONST(72450.060582262216 / 8.0),
- REAL_CONST(72471.936426109431 / 8.0),
- REAL_CONST(72493.813920901433 / 8.0),
- REAL_CONST(72515.693066389096 / 8.0),
- REAL_CONST(72537.573862323392 / 8.0),
- REAL_CONST(72559.456308455352 / 8.0),
- REAL_CONST(72581.340404536139 / 8.0),
- REAL_CONST(72603.226150316987 / 8.0),
- REAL_CONST(72625.113545549248 / 8.0),
- REAL_CONST(72647.002589984331 / 8.0),
- REAL_CONST(72668.893283373764 / 8.0),
- REAL_CONST(72690.785625469172 / 8.0),
- REAL_CONST(72712.679616022273 / 8.0),
- REAL_CONST(72734.575254784853 / 8.0),
- REAL_CONST(72756.472541508803 / 8.0),
- REAL_CONST(72778.371475946144 / 8.0),
- REAL_CONST(72800.272057848939 / 8.0),
- REAL_CONST(72822.174286969355 / 8.0),
- REAL_CONST(72844.07816305969 / 8.0),
- REAL_CONST(72865.983685872285 / 8.0),
- REAL_CONST(72887.890855159596 / 8.0),
- REAL_CONST(72909.799670674183 / 8.0),
- REAL_CONST(72931.710132168693 / 8.0),
- REAL_CONST(72953.622239395845 / 8.0),
- REAL_CONST(72975.535992108475 / 8.0),
- REAL_CONST(72997.451390059519 / 8.0),
- REAL_CONST(73019.368433001961 / 8.0),
- REAL_CONST(73041.287120688925 / 8.0),
- REAL_CONST(73063.207452873612 / 8.0),
- REAL_CONST(73085.129429309294 / 8.0),
- REAL_CONST(73107.053049749389 / 8.0),
- REAL_CONST(73128.978313947344 / 8.0),
- REAL_CONST(73150.905221656736 / 8.0),
- REAL_CONST(73172.833772631217 / 8.0),
- REAL_CONST(73194.763966624567 / 8.0),
- REAL_CONST(73216.695803390612 / 8.0),
- REAL_CONST(73238.62928268328 / 8.0),
- REAL_CONST(73260.564404256627 / 8.0),
- REAL_CONST(73282.501167864757 / 8.0),
- REAL_CONST(73304.439573261901 / 8.0),
- REAL_CONST(73326.379620202337 / 8.0),
- REAL_CONST(73348.321308440485 / 8.0),
- REAL_CONST(73370.264637730841 / 8.0),
- REAL_CONST(73392.209607827957 / 8.0),
- REAL_CONST(73414.156218486532 / 8.0),
- REAL_CONST(73436.104469461323 / 8.0),
- REAL_CONST(73458.054360507173 / 8.0),
- REAL_CONST(73480.005891379056 / 8.0),
- REAL_CONST(73501.959061831993 / 8.0),
- REAL_CONST(73523.913871621116 / 8.0),
- REAL_CONST(73545.870320501665 / 8.0),
- REAL_CONST(73567.828408228932 / 8.0),
- REAL_CONST(73589.78813455833 / 8.0),
- REAL_CONST(73611.749499245358 / 8.0),
- REAL_CONST(73633.712502045615 / 8.0),
- REAL_CONST(73655.677142714747 / 8.0),
- REAL_CONST(73677.643421008557 / 8.0),
- REAL_CONST(73699.611336682879 / 8.0),
- REAL_CONST(73721.580889493693 / 8.0),
- REAL_CONST(73743.552079197019 / 8.0),
- REAL_CONST(73765.524905548999 / 8.0),
- REAL_CONST(73787.499368305856 / 8.0),
- REAL_CONST(73809.475467223907 / 8.0),
- REAL_CONST(73831.453202059551 / 8.0),
- REAL_CONST(73853.432572569291 / 8.0),
- REAL_CONST(73875.413578509717 / 8.0),
- REAL_CONST(73897.396219637507 / 8.0),
- REAL_CONST(73919.380495709411 / 8.0),
- REAL_CONST(73941.36640648231 / 8.0),
- REAL_CONST(73963.353951713143 / 8.0),
- REAL_CONST(73985.343131158952 / 8.0),
- REAL_CONST(74007.333944576865 / 8.0),
- REAL_CONST(74029.326391724098 / 8.0),
- REAL_CONST(74051.320472357969 / 8.0),
- REAL_CONST(74073.316186235883 / 8.0),
- REAL_CONST(74095.313533115303 / 8.0),
- REAL_CONST(74117.312512753837 / 8.0),
- REAL_CONST(74139.313124909138 / 8.0),
- REAL_CONST(74161.315369338976 / 8.0),
- REAL_CONST(74183.319245801191 / 8.0),
- REAL_CONST(74205.324754053727 / 8.0),
- REAL_CONST(74227.331893854629 / 8.0),
- REAL_CONST(74249.340664961986 / 8.0),
- REAL_CONST(74271.351067134034 / 8.0),
- REAL_CONST(74293.363100129049 / 8.0),
- REAL_CONST(74315.376763705441 / 8.0),
- REAL_CONST(74337.392057621662 / 8.0),
- REAL_CONST(74359.408981636298 / 8.0),
- REAL_CONST(74381.427535508003 / 8.0),
- REAL_CONST(74403.447718995507 / 8.0),
- REAL_CONST(74425.469531857671 / 8.0),
- REAL_CONST(74447.492973853383 / 8.0),
- REAL_CONST(74469.518044741693 / 8.0),
- REAL_CONST(74491.54474428168 / 8.0),
- REAL_CONST(74513.573072232539 / 8.0),
- REAL_CONST(74535.603028353551 / 8.0),
- REAL_CONST(74557.634612404087 / 8.0),
- REAL_CONST(74579.667824143602 / 8.0),
- REAL_CONST(74601.702663331642 / 8.0),
- REAL_CONST(74623.739129727837 / 8.0),
- REAL_CONST(74645.777223091936 / 8.0),
- REAL_CONST(74667.816943183716 / 8.0),
- REAL_CONST(74689.858289763113 / 8.0),
- REAL_CONST(74711.901262590094 / 8.0),
- REAL_CONST(74733.945861424741 / 8.0),
- REAL_CONST(74755.992086027225 / 8.0),
- REAL_CONST(74778.039936157802 / 8.0),
- REAL_CONST(74800.089411576817 / 8.0),
- REAL_CONST(74822.140512044702 / 8.0),
- REAL_CONST(74844.193237321961 / 8.0),
- REAL_CONST(74866.24758716923 / 8.0),
- REAL_CONST(74888.303561347187 / 8.0),
- REAL_CONST(74910.36115961663 / 8.0),
- REAL_CONST(74932.420381738411 / 8.0),
- REAL_CONST(74954.481227473516 / 8.0),
- REAL_CONST(74976.543696582972 / 8.0),
- REAL_CONST(74998.607788827925 / 8.0),
- REAL_CONST(75020.673503969607 / 8.0),
- REAL_CONST(75042.740841769322 / 8.0),
- REAL_CONST(75064.809801988464 / 8.0),
- REAL_CONST(75086.88038438854 / 8.0),
- REAL_CONST(75108.952588731103 / 8.0),
- REAL_CONST(75131.026414777836 / 8.0),
- REAL_CONST(75153.101862290467 / 8.0),
- REAL_CONST(75175.178931030852 / 8.0),
- REAL_CONST(75197.257620760924 / 8.0),
- REAL_CONST(75219.33793124267 / 8.0),
- REAL_CONST(75241.419862238225 / 8.0),
- REAL_CONST(75263.503413509738 / 8.0),
- REAL_CONST(75285.588584819503 / 8.0),
- REAL_CONST(75307.675375929874 / 8.0),
- REAL_CONST(75329.763786603318 / 8.0),
- REAL_CONST(75351.853816602365 / 8.0),
- REAL_CONST(75373.945465689612 / 8.0),
- REAL_CONST(75396.038733627807 / 8.0),
- REAL_CONST(75418.133620179724 / 8.0),
- REAL_CONST(75440.230125108254 / 8.0),
- REAL_CONST(75462.32824817636 / 8.0),
- REAL_CONST(75484.427989147109 / 8.0),
- REAL_CONST(75506.529347783653 / 8.0),
- REAL_CONST(75528.63232384919 / 8.0),
- REAL_CONST(75550.736917107075 / 8.0),
- REAL_CONST(75572.843127320695 / 8.0),
- REAL_CONST(75594.950954253538 / 8.0),
- REAL_CONST(75617.060397669193 / 8.0),
- REAL_CONST(75639.171457331307 / 8.0),
- REAL_CONST(75661.284133003646 / 8.0),
- REAL_CONST(75683.398424450032 / 8.0),
- REAL_CONST(75705.514331434402 / 8.0),
- REAL_CONST(75727.631853720741 / 8.0),
- REAL_CONST(75749.750991073175 / 8.0),
- REAL_CONST(75771.871743255862 / 8.0),
- REAL_CONST(75793.994110033076 / 8.0),
- REAL_CONST(75816.118091169177 / 8.0),
- REAL_CONST(75838.243686428585 / 8.0),
- REAL_CONST(75860.370895575848 / 8.0),
- REAL_CONST(75882.499718375562 / 8.0),
- REAL_CONST(75904.630154592422 / 8.0),
- REAL_CONST(75926.762203991224 / 8.0),
- REAL_CONST(75948.895866336825 / 8.0),
- REAL_CONST(75971.031141394182 / 8.0),
- REAL_CONST(75993.168028928325 / 8.0),
- REAL_CONST(76015.306528704401 / 8.0),
- REAL_CONST(76037.4466404876 / 8.0),
- REAL_CONST(76059.588364043215 / 8.0),
- REAL_CONST(76081.731699136653 / 8.0),
- REAL_CONST(76103.876645533353 / 8.0),
- REAL_CONST(76126.023202998884 / 8.0),
- REAL_CONST(76148.171371298871 / 8.0),
- REAL_CONST(76170.321150199044 / 8.0),
- REAL_CONST(76192.472539465205 / 8.0),
- REAL_CONST(76214.625538863256 / 8.0),
- REAL_CONST(76236.780148159174 / 8.0),
- REAL_CONST(76258.936367119008 / 8.0),
- REAL_CONST(76281.094195508922 / 8.0),
- REAL_CONST(76303.253633095141 / 8.0),
- REAL_CONST(76325.414679643975 / 8.0),
- REAL_CONST(76347.577334921851 / 8.0),
- REAL_CONST(76369.741598695226 / 8.0),
- REAL_CONST(76391.907470730686 / 8.0),
- REAL_CONST(76414.074950794879 / 8.0),
- REAL_CONST(76436.244038654564 / 8.0),
- REAL_CONST(76458.414734076548 / 8.0),
- REAL_CONST(76480.587036827754 / 8.0),
- REAL_CONST(76502.760946675175 / 8.0),
- REAL_CONST(76524.936463385893 / 8.0),
- REAL_CONST(76547.11358672705 / 8.0),
- REAL_CONST(76569.292316465915 / 8.0),
- REAL_CONST(76591.472652369819 / 8.0),
- REAL_CONST(76613.654594206164 / 8.0),
- REAL_CONST(76635.838141742468 / 8.0),
- REAL_CONST(76658.023294746308 / 8.0),
- REAL_CONST(76680.210052985349 / 8.0),
- REAL_CONST(76702.398416227341 / 8.0),
- REAL_CONST(76724.588384240138 / 8.0),
- REAL_CONST(76746.779956791637 / 8.0),
- REAL_CONST(76768.973133649866 / 8.0),
- REAL_CONST(76791.167914582897 / 8.0),
- REAL_CONST(76813.364299358902 / 8.0),
- REAL_CONST(76835.562287746157 / 8.0),
- REAL_CONST(76857.761879512967 / 8.0),
- REAL_CONST(76879.963074427797 / 8.0),
- REAL_CONST(76902.165872259109 / 8.0),
- REAL_CONST(76924.37027277553 / 8.0),
- REAL_CONST(76946.576275745727 / 8.0),
- REAL_CONST(76968.783880938441 / 8.0),
- REAL_CONST(76990.993088122515 / 8.0),
- REAL_CONST(77013.203897066895 / 8.0),
- REAL_CONST(77035.416307540567 / 8.0),
- REAL_CONST(77057.630319312622 / 8.0),
- REAL_CONST(77079.845932152239 / 8.0),
- REAL_CONST(77102.063145828695 / 8.0),
- REAL_CONST(77124.281960111301 / 8.0),
- REAL_CONST(77146.50237476948 / 8.0),
- REAL_CONST(77168.724389572759 / 8.0),
- REAL_CONST(77190.948004290723 / 8.0),
- REAL_CONST(77213.173218693031 / 8.0),
- REAL_CONST(77235.400032549442 / 8.0),
- REAL_CONST(77257.628445629802 / 8.0),
- REAL_CONST(77279.858457704031 / 8.0),
- REAL_CONST(77302.090068542122 / 8.0),
- REAL_CONST(77324.323277914169 / 8.0),
- REAL_CONST(77346.558085590339 / 8.0),
- REAL_CONST(77368.794491340886 / 8.0),
- REAL_CONST(77391.032494936138 / 8.0),
- REAL_CONST(77413.272096146524 / 8.0),
- REAL_CONST(77435.51329474253 / 8.0),
- REAL_CONST(77457.756090494731 / 8.0),
- REAL_CONST(77480.000483173804 / 8.0),
- REAL_CONST(77502.246472550498 / 8.0),
- REAL_CONST(77524.494058395634 / 8.0),
- REAL_CONST(77546.743240480107 / 8.0),
- REAL_CONST(77568.994018574944 / 8.0),
- REAL_CONST(77591.246392451198 / 8.0),
- REAL_CONST(77613.500361880026 / 8.0),
- REAL_CONST(77635.755926632657 / 8.0),
- REAL_CONST(77658.013086480438 / 8.0),
- REAL_CONST(77680.271841194757 / 8.0),
- REAL_CONST(77702.532190547092 / 8.0),
- REAL_CONST(77724.794134309021 / 8.0),
- REAL_CONST(77747.057672252195 / 8.0),
- REAL_CONST(77769.322804148323 / 8.0),
- REAL_CONST(77791.589529769248 / 8.0),
- REAL_CONST(77813.857848886837 / 8.0),
- REAL_CONST(77836.127761273063 / 8.0),
- REAL_CONST(77858.399266699998 / 8.0),
- REAL_CONST(77880.67236493979 / 8.0),
- REAL_CONST(77902.947055764627 / 8.0),
- REAL_CONST(77925.223338946831 / 8.0),
- REAL_CONST(77947.50121425878 / 8.0),
- REAL_CONST(77969.780681472927 / 8.0),
- REAL_CONST(77992.061740361838 / 8.0),
- REAL_CONST(78014.344390698127 / 8.0),
- REAL_CONST(78036.628632254491 / 8.0),
- REAL_CONST(78058.914464803747 / 8.0),
- REAL_CONST(78081.201888118725 / 8.0),
- REAL_CONST(78103.490901972415 / 8.0),
- REAL_CONST(78125.781506137821 / 8.0),
- REAL_CONST(78148.073700388064 / 8.0),
- REAL_CONST(78170.367484496339 / 8.0),
- REAL_CONST(78192.662858235926 / 8.0),
- REAL_CONST(78214.959821380166 / 8.0),
- REAL_CONST(78237.258373702498 / 8.0),
- REAL_CONST(78259.558514976452 / 8.0),
- REAL_CONST(78281.860244975614 / 8.0),
- REAL_CONST(78304.163563473659 / 8.0),
- REAL_CONST(78326.468470244363 / 8.0),
- REAL_CONST(78348.77496506153 / 8.0),
- REAL_CONST(78371.083047699125 / 8.0),
- REAL_CONST(78393.392717931114 / 8.0),
- REAL_CONST(78415.703975531578 / 8.0),
- REAL_CONST(78438.016820274701 / 8.0),
- REAL_CONST(78460.331251934695 / 8.0),
- REAL_CONST(78482.647270285903 / 8.0),
- REAL_CONST(78504.964875102727 / 8.0),
- REAL_CONST(78527.284066159627 / 8.0),
- REAL_CONST(78549.604843231195 / 8.0),
- REAL_CONST(78571.927206092048 / 8.0),
- REAL_CONST(78594.251154516911 / 8.0),
- REAL_CONST(78616.576688280606 / 8.0),
- REAL_CONST(78638.903807157985 / 8.0),
- REAL_CONST(78661.232510924034 / 8.0),
- REAL_CONST(78683.562799353778 / 8.0),
- REAL_CONST(78705.894672222363 / 8.0),
- REAL_CONST(78728.228129304945 / 8.0),
- REAL_CONST(78750.563170376859 / 8.0),
- REAL_CONST(78772.899795213423 / 8.0),
- REAL_CONST(78795.238003590101 / 8.0),
- REAL_CONST(78817.577795282399 / 8.0),
- REAL_CONST(78839.919170065928 / 8.0),
- REAL_CONST(78862.262127716356 / 8.0),
- REAL_CONST(78884.606668009452 / 8.0),
- REAL_CONST(78906.952790721043 / 8.0),
- REAL_CONST(78929.300495627045 / 8.0),
- REAL_CONST(78951.64978250346 / 8.0),
- REAL_CONST(78974.000651126378 / 8.0),
- REAL_CONST(78996.353101271932 / 8.0),
- REAL_CONST(79018.707132716358 / 8.0),
- REAL_CONST(79041.062745235977 / 8.0),
- REAL_CONST(79063.41993860717 / 8.0),
- REAL_CONST(79085.778712606436 / 8.0),
- REAL_CONST(79108.139067010285 / 8.0),
- REAL_CONST(79130.501001595389 / 8.0),
- REAL_CONST(79152.864516138419 / 8.0),
- REAL_CONST(79175.22961041618 / 8.0),
- REAL_CONST(79197.596284205531 / 8.0),
- REAL_CONST(79219.96453728342 / 8.0),
- REAL_CONST(79242.33436942687 / 8.0),
- REAL_CONST(79264.705780412987 / 8.0),
- REAL_CONST(79287.078770018954 / 8.0),
- REAL_CONST(79309.453338022009 / 8.0),
- REAL_CONST(79331.829484199508 / 8.0),
- REAL_CONST(79354.207208328866 / 8.0),
- REAL_CONST(79376.586510187582 / 8.0),
- REAL_CONST(79398.967389553218 / 8.0),
- REAL_CONST(79421.349846203433 / 8.0),
- REAL_CONST(79443.733879915948 / 8.0),
- REAL_CONST(79466.119490468584 / 8.0),
- REAL_CONST(79488.50667763922 / 8.0),
- REAL_CONST(79510.895441205823 / 8.0),
- REAL_CONST(79533.285780946433 / 8.0),
- REAL_CONST(79555.677696639163 / 8.0),
- REAL_CONST(79578.071188062226 / 8.0),
- REAL_CONST(79600.466254993895 / 8.0),
- REAL_CONST(79622.862897212515 / 8.0),
- REAL_CONST(79645.261114496549 / 8.0),
- REAL_CONST(79667.660906624471 / 8.0),
- REAL_CONST(79690.062273374875 / 8.0),
- REAL_CONST(79712.465214526455 / 8.0),
- REAL_CONST(79734.869729857935 / 8.0),
- REAL_CONST(79757.275819148126 / 8.0),
- REAL_CONST(79779.683482175955 / 8.0),
- REAL_CONST(79802.092718720378 / 8.0),
- REAL_CONST(79824.503528560454 / 8.0),
- REAL_CONST(79846.915911475327 / 8.0),
- REAL_CONST(79869.329867244203 / 8.0),
- REAL_CONST(79891.745395646343 / 8.0),
- REAL_CONST(79914.162496461155 / 8.0),
- REAL_CONST(79936.581169468045 / 8.0),
- REAL_CONST(79959.001414446553 / 8.0),
- REAL_CONST(79981.423231176261 / 8.0),
- REAL_CONST(80003.846619436852 / 8.0),
- REAL_CONST(80026.271579008084 / 8.0),
- REAL_CONST(80048.698109669771 / 8.0),
- REAL_CONST(80071.12621120183 / 8.0),
- REAL_CONST(80093.555883384237 / 8.0),
- REAL_CONST(80115.987125997053 / 8.0),
- REAL_CONST(80138.419938820414 / 8.0),
- REAL_CONST(80160.854321634528 / 8.0),
- REAL_CONST(80183.290274219689 / 8.0),
- REAL_CONST(80205.727796356281 / 8.0),
- REAL_CONST(80228.166887824715 / 8.0),
- REAL_CONST(80250.607548405547 / 8.0),
- REAL_CONST(80273.049777879336 / 8.0),
- REAL_CONST(80295.493576026798 / 8.0),
- REAL_CONST(80317.938942628651 / 8.0),
- REAL_CONST(80340.385877465727 / 8.0),
- REAL_CONST(80362.834380318949 / 8.0),
- REAL_CONST(80385.28445096928 / 8.0),
- REAL_CONST(80407.736089197788 / 8.0),
- REAL_CONST(80430.189294785596 / 8.0),
- REAL_CONST(80452.644067513917 / 8.0),
- REAL_CONST(80475.100407164035 / 8.0),
- REAL_CONST(80497.558313517322 / 8.0),
- REAL_CONST(80520.017786355209 / 8.0),
- REAL_CONST(80542.478825459213 / 8.0),
- REAL_CONST(80564.941430610925 / 8.0),
- REAL_CONST(80587.405601592007 / 8.0),
- REAL_CONST(80609.871338184195 / 8.0),
- REAL_CONST(80632.338640169342 / 8.0),
- REAL_CONST(80654.8075073293 / 8.0),
- REAL_CONST(80677.277939446067 / 8.0),
- REAL_CONST(80699.749936301683 / 8.0),
- REAL_CONST(80722.223497678278 / 8.0),
- REAL_CONST(80744.698623358039 / 8.0),
- REAL_CONST(80767.17531312324 / 8.0),
- REAL_CONST(80789.653566756242 / 8.0),
- REAL_CONST(80812.133384039465 / 8.0),
- REAL_CONST(80834.614764755403 / 8.0),
- REAL_CONST(80857.097708686648 / 8.0),
- REAL_CONST(80879.582215615854 / 8.0),
- REAL_CONST(80902.068285325731 / 8.0),
- REAL_CONST(80924.555917599093 / 8.0),
- REAL_CONST(80947.045112218824 / 8.0),
- REAL_CONST(80969.535868967869 / 8.0),
- REAL_CONST(80992.028187629272 / 8.0),
- REAL_CONST(81014.522067986123 / 8.0),
- REAL_CONST(81037.017509821613 / 8.0),
- REAL_CONST(81059.514512919006 / 8.0),
- REAL_CONST(81082.013077061609 / 8.0),
- REAL_CONST(81104.513202032831 / 8.0),
- REAL_CONST(81127.014887616184 / 8.0),
- REAL_CONST(81149.518133595193 / 8.0),
- REAL_CONST(81172.022939753486 / 8.0),
- REAL_CONST(81194.529305874807 / 8.0),
- REAL_CONST(81217.037231742899 / 8.0),
- REAL_CONST(81239.546717141639 / 8.0),
- REAL_CONST(81262.057761854958 / 8.0),
- REAL_CONST(81284.570365666848 / 8.0),
- REAL_CONST(81307.084528361403 / 8.0),
- REAL_CONST(81329.600249722775 / 8.0),
- REAL_CONST(81352.117529535186 / 8.0),
- REAL_CONST(81374.636367582949 / 8.0),
- REAL_CONST(81397.156763650448 / 8.0),
- REAL_CONST(81419.678717522125 / 8.0),
- REAL_CONST(81442.202228982511 / 8.0),
- REAL_CONST(81464.727297816222 / 8.0),
- REAL_CONST(81487.253923807933 / 8.0),
- REAL_CONST(81509.782106742379 / 8.0),
- REAL_CONST(81532.311846404409 / 8.0),
- REAL_CONST(81554.843142578902 / 8.0),
- REAL_CONST(81577.375995050839 / 8.0),
- REAL_CONST(81599.910403605274 / 8.0),
- REAL_CONST(81622.446368027333 / 8.0),
- REAL_CONST(81644.983888102215 / 8.0),
- REAL_CONST(81667.522963615178 / 8.0),
- REAL_CONST(81690.063594351581 / 8.0),
- REAL_CONST(81712.605780096841 / 8.0),
- REAL_CONST(81735.149520636449 / 8.0),
- REAL_CONST(81757.694815755967 / 8.0),
- REAL_CONST(81780.241665241047 / 8.0),
- REAL_CONST(81802.79006887741 / 8.0),
- REAL_CONST(81825.340026450824 / 8.0),
- REAL_CONST(81847.891537747171 / 8.0),
- REAL_CONST(81870.444602552379 / 8.0),
- REAL_CONST(81892.999220652477 / 8.0),
- REAL_CONST(81915.555391833506 / 8.0),
- REAL_CONST(81938.113115881672 / 8.0),
- REAL_CONST(81960.672392583176 / 8.0),
- REAL_CONST(81983.233221724338 / 8.0),
- REAL_CONST(82005.795603091537 / 8.0),
- REAL_CONST(82028.359536471224 / 8.0),
- REAL_CONST(82050.925021649906 / 8.0),
- REAL_CONST(82073.492058414209 / 8.0),
- REAL_CONST(82096.060646550788 / 8.0),
- REAL_CONST(82118.630785846399 / 8.0),
- REAL_CONST(82141.202476087841 / 8.0),
- REAL_CONST(82163.775717062032 / 8.0),
- REAL_CONST(82186.35050855593 / 8.0),
- REAL_CONST(82208.926850356569 / 8.0),
- REAL_CONST(82231.504742251054 / 8.0),
- REAL_CONST(82254.084184026578 / 8.0),
- REAL_CONST(82276.665175470393 / 8.0),
- REAL_CONST(82299.24771636985 / 8.0),
- REAL_CONST(82321.831806512317 / 8.0),
- REAL_CONST(82344.417445685307 / 8.0),
- REAL_CONST(82367.004633676348 / 8.0),
- REAL_CONST(82389.593370273054 / 8.0),
- REAL_CONST(82412.183655263143 / 8.0),
- REAL_CONST(82434.775488434374 / 8.0),
- REAL_CONST(82457.368869574595 / 8.0),
- REAL_CONST(82479.963798471697 / 8.0),
- REAL_CONST(82502.560274913689 / 8.0),
- REAL_CONST(82525.158298688606 / 8.0),
- REAL_CONST(82547.757869584602 / 8.0),
- REAL_CONST(82570.35898738986 / 8.0),
- REAL_CONST(82592.961651892678 / 8.0),
- REAL_CONST(82615.565862881398 / 8.0),
- REAL_CONST(82638.171620144421 / 8.0),
- REAL_CONST(82660.778923470265 / 8.0),
- REAL_CONST(82683.387772647475 / 8.0),
- REAL_CONST(82705.998167464713 / 8.0),
- REAL_CONST(82728.610107710658 / 8.0),
- REAL_CONST(82751.223593174116 / 8.0),
- REAL_CONST(82773.83862364394 / 8.0),
- REAL_CONST(82796.45519890904 / 8.0),
- REAL_CONST(82819.073318758441 / 8.0),
- REAL_CONST(82841.692982981185 / 8.0),
- REAL_CONST(82864.314191366429 / 8.0),
- REAL_CONST(82886.936943703375 / 8.0),
- REAL_CONST(82909.561239781324 / 8.0),
- REAL_CONST(82932.187079389638 / 8.0),
- REAL_CONST(82954.814462317736 / 8.0),
- REAL_CONST(82977.443388355125 / 8.0),
- REAL_CONST(83000.073857291369 / 8.0),
- REAL_CONST(83022.70586891612 / 8.0),
- REAL_CONST(83045.339423019104 / 8.0),
- REAL_CONST(83067.974519390089 / 8.0),
- REAL_CONST(83090.611157818959 / 8.0),
- REAL_CONST(83113.249338095629 / 8.0),
- REAL_CONST(83135.8890600101 / 8.0),
- REAL_CONST(83158.530323352461 / 8.0),
- REAL_CONST(83181.173127912858 / 8.0),
- REAL_CONST(83203.817473481497 / 8.0),
- REAL_CONST(83226.463359848669 / 8.0),
- REAL_CONST(83249.11078680474 / 8.0),
- REAL_CONST(83271.759754140134 / 8.0),
- REAL_CONST(83294.410261645375 / 8.0),
- REAL_CONST(83317.062309111003 / 8.0),
- REAL_CONST(83339.715896327703 / 8.0),
- REAL_CONST(83362.371023086147 / 8.0),
- REAL_CONST(83385.027689177165 / 8.0),
- REAL_CONST(83407.685894391587 / 8.0),
- REAL_CONST(83430.345638520361 / 8.0),
- REAL_CONST(83453.006921354478 / 8.0),
- REAL_CONST(83475.669742685001 / 8.0),
- REAL_CONST(83498.334102303095 / 8.0),
- REAL_CONST(83520.999999999942 / 8.0),
- REAL_CONST(83543.667435566866 / 8.0),
- REAL_CONST(83566.336408795192 / 8.0),
- REAL_CONST(83589.006919476349 / 8.0),
- REAL_CONST(83611.678967401851 / 8.0),
- REAL_CONST(83634.352552363242 / 8.0),
- REAL_CONST(83657.027674152167 / 8.0),
- REAL_CONST(83679.704332560359 / 8.0),
- REAL_CONST(83702.382527379552 / 8.0),
- REAL_CONST(83725.062258401638 / 8.0),
- REAL_CONST(83747.743525418511 / 8.0),
- REAL_CONST(83770.42632822218 / 8.0),
- REAL_CONST(83793.110666604684 / 8.0),
- REAL_CONST(83815.796540358162 / 8.0),
- REAL_CONST(83838.483949274829 / 8.0),
- REAL_CONST(83861.172893146941 / 8.0),
- REAL_CONST(83883.863371766842 / 8.0),
- REAL_CONST(83906.555384926964 / 8.0),
- REAL_CONST(83929.248932419752 / 8.0),
- REAL_CONST(83951.944014037799 / 8.0),
- REAL_CONST(83974.640629573696 / 8.0),
- REAL_CONST(83997.338778820151 / 8.0),
- REAL_CONST(84020.038461569929 / 8.0),
- REAL_CONST(84042.739677615857 / 8.0),
- REAL_CONST(84065.442426750829 / 8.0),
- REAL_CONST(84088.146708767847 / 8.0),
- REAL_CONST(84110.852523459922 / 8.0),
- REAL_CONST(84133.559870620171 / 8.0),
- REAL_CONST(84156.268750041796 / 8.0),
- REAL_CONST(84178.979161518029 / 8.0),
- REAL_CONST(84201.691104842204 / 8.0),
- REAL_CONST(84224.404579807713 / 8.0),
- REAL_CONST(84247.119586208006 / 8.0),
- REAL_CONST(84269.83612383662 / 8.0),
- REAL_CONST(84292.55419248715 / 8.0),
- REAL_CONST(84315.273791953281 / 8.0),
- REAL_CONST(84337.994922028738 / 8.0),
- REAL_CONST(84360.717582507335 / 8.0),
- REAL_CONST(84383.441773182945 / 8.0),
- REAL_CONST(84406.167493849513 / 8.0),
- REAL_CONST(84428.894744301069 / 8.0),
- REAL_CONST(84451.623524331691 / 8.0),
- REAL_CONST(84474.353833735542 / 8.0),
- REAL_CONST(84497.085672306828 / 8.0),
- REAL_CONST(84519.819039839858 / 8.0),
- REAL_CONST(84542.553936128999 / 8.0),
- REAL_CONST(84565.290360968676 / 8.0),
- REAL_CONST(84588.028314153402 / 8.0),
- REAL_CONST(84610.767795477717 / 8.0),
- REAL_CONST(84633.508804736295 / 8.0),
- REAL_CONST(84656.251341723822 / 8.0),
- REAL_CONST(84678.995406235073 / 8.0),
- REAL_CONST(84701.740998064924 / 8.0),
- REAL_CONST(84724.488117008252 / 8.0),
- REAL_CONST(84747.236762860062 / 8.0),
- REAL_CONST(84769.986935415407 / 8.0),
- REAL_CONST(84792.73863446941 / 8.0),
- REAL_CONST(84815.491859817252 / 8.0),
- REAL_CONST(84838.246611254188 / 8.0),
- REAL_CONST(84861.002888575575 / 8.0),
- REAL_CONST(84883.760691576768 / 8.0),
- REAL_CONST(84906.520020053256 / 8.0),
- REAL_CONST(84929.28087380057 / 8.0),
- REAL_CONST(84952.043252614312 / 8.0),
- REAL_CONST(84974.807156290146 / 8.0),
- REAL_CONST(84997.572584623806 / 8.0),
- REAL_CONST(85020.339537411113 / 8.0),
- REAL_CONST(85043.108014447949 / 8.0),
- REAL_CONST(85065.878015530237 / 8.0),
- REAL_CONST(85088.649540453989 / 8.0),
- REAL_CONST(85111.422589015303 / 8.0),
- REAL_CONST(85134.197161010321 / 8.0),
- REAL_CONST(85156.973256235244 / 8.0),
- REAL_CONST(85179.750874486374 / 8.0),
- REAL_CONST(85202.530015560071 / 8.0),
- REAL_CONST(85225.310679252725 / 8.0),
- REAL_CONST(85248.092865360857 / 8.0),
- REAL_CONST(85270.876573681016 / 8.0),
- REAL_CONST(85293.661804009811 / 8.0),
- REAL_CONST(85316.448556143951 / 8.0),
- REAL_CONST(85339.236829880188 / 8.0),
- REAL_CONST(85362.026625015351 / 8.0),
- REAL_CONST(85384.817941346351 / 8.0),
- REAL_CONST(85407.610778670132 / 8.0),
- REAL_CONST(85430.405136783724 / 8.0),
- REAL_CONST(85453.201015484257 / 8.0),
- REAL_CONST(85475.998414568865 / 8.0),
- REAL_CONST(85498.797333834795 / 8.0),
- REAL_CONST(85521.597773079353 / 8.0),
- REAL_CONST(85544.399732099904 / 8.0),
- REAL_CONST(85567.203210693886 / 8.0),
- REAL_CONST(85590.008208658808 / 8.0),
- REAL_CONST(85612.814725792239 / 8.0),
- REAL_CONST(85635.62276189182 / 8.0),
- REAL_CONST(85658.432316755265 / 8.0),
- REAL_CONST(85681.243390180331 / 8.0),
- REAL_CONST(85704.055981964877 / 8.0),
- REAL_CONST(85726.870091906807 / 8.0),
- REAL_CONST(85749.685719804082 / 8.0),
- REAL_CONST(85772.502865454764 / 8.0),
- REAL_CONST(85795.321528656961 / 8.0),
- REAL_CONST(85818.141709208852 / 8.0),
- REAL_CONST(85840.963406908675 / 8.0),
- REAL_CONST(85863.78662155474 / 8.0),
- REAL_CONST(85886.611352945445 / 8.0),
- REAL_CONST(85909.437600879217 / 8.0),
- REAL_CONST(85932.26536515457 / 8.0),
- REAL_CONST(85955.094645570091 / 8.0),
- REAL_CONST(85977.92544192441 / 8.0),
- REAL_CONST(86000.757754016275 / 8.0),
- REAL_CONST(86023.591581644432 / 8.0),
- REAL_CONST(86046.426924607746 / 8.0),
- REAL_CONST(86069.263782705122 / 8.0),
- REAL_CONST(86092.102155735556 / 8.0),
- REAL_CONST(86114.942043498071 / 8.0),
- REAL_CONST(86137.783445791807 / 8.0),
- REAL_CONST(86160.626362415918 / 8.0),
- REAL_CONST(86183.470793169676 / 8.0),
- REAL_CONST(86206.316737852379 / 8.0),
- REAL_CONST(86229.164196263402 / 8.0),
- REAL_CONST(86252.013168202204 / 8.0),
- REAL_CONST(86274.863653468303 / 8.0),
- REAL_CONST(86297.715651861261 / 8.0),
- REAL_CONST(86320.569163180728 / 8.0),
- REAL_CONST(86343.424187226425 / 8.0),
- REAL_CONST(86366.280723798132 / 8.0),
- REAL_CONST(86389.138772695675 / 8.0),
- REAL_CONST(86411.998333718977 / 8.0),
- REAL_CONST(86434.859406668009 / 8.0),
- REAL_CONST(86457.721991342827 / 8.0),
- REAL_CONST(86480.586087543532 / 8.0),
- REAL_CONST(86503.451695070296 / 8.0),
- REAL_CONST(86526.318813723352 / 8.0),
- REAL_CONST(86549.187443303032 / 8.0),
- REAL_CONST(86572.057583609683 / 8.0),
- REAL_CONST(86594.929234443756 / 8.0),
- REAL_CONST(86617.802395605773 / 8.0),
- REAL_CONST(86640.677066896271 / 8.0),
- REAL_CONST(86663.553248115903 / 8.0),
- REAL_CONST(86686.43093906538 / 8.0),
- REAL_CONST(86709.310139545443 / 8.0),
- REAL_CONST(86732.190849356964 / 8.0),
- REAL_CONST(86755.073068300815 / 8.0),
- REAL_CONST(86777.956796177954 / 8.0),
- REAL_CONST(86800.842032789442 / 8.0),
- REAL_CONST(86823.728777936354 / 8.0),
- REAL_CONST(86846.617031419853 / 8.0),
- REAL_CONST(86869.506793041175 / 8.0),
- REAL_CONST(86892.398062601613 / 8.0),
- REAL_CONST(86915.290839902518 / 8.0),
- REAL_CONST(86938.185124745316 / 8.0),
- REAL_CONST(86961.080916931489 / 8.0),
- REAL_CONST(86983.978216262592 / 8.0),
- REAL_CONST(87006.87702254027 / 8.0),
- REAL_CONST(87029.777335566177 / 8.0),
- REAL_CONST(87052.67915514209 / 8.0),
- REAL_CONST(87075.582481069796 / 8.0),
- REAL_CONST(87098.487313151185 / 8.0),
- REAL_CONST(87121.39365118822 / 8.0),
- REAL_CONST(87144.301494982894 / 8.0),
- REAL_CONST(87167.210844337285 / 8.0),
- REAL_CONST(87190.121699053532 / 8.0),
- REAL_CONST(87213.034058933845 / 8.0),
- REAL_CONST(87235.947923780506 / 8.0),
- REAL_CONST(87258.863293395829 / 8.0),
- REAL_CONST(87281.780167582241 / 8.0),
- REAL_CONST(87304.698546142172 / 8.0),
- REAL_CONST(87327.618428878181 / 8.0),
- REAL_CONST(87350.539815592856 / 8.0),
- REAL_CONST(87373.462706088845 / 8.0),
- REAL_CONST(87396.387100168897 / 8.0),
- REAL_CONST(87419.312997635774 / 8.0),
- REAL_CONST(87442.240398292357 / 8.0),
- REAL_CONST(87465.16930194154 / 8.0),
- REAL_CONST(87488.099708386319 / 8.0),
- REAL_CONST(87511.031617429733 / 8.0),
- REAL_CONST(87533.965028874911 / 8.0),
- REAL_CONST(87556.899942525008 / 8.0),
- REAL_CONST(87579.836358183282 / 8.0),
- REAL_CONST(87602.774275653021 / 8.0),
- REAL_CONST(87625.713694737613 / 8.0),
- REAL_CONST(87648.654615240492 / 8.0),
- REAL_CONST(87671.597036965148 / 8.0),
- REAL_CONST(87694.540959715145 / 8.0),
- REAL_CONST(87717.486383294105 / 8.0),
- REAL_CONST(87740.433307505737 / 8.0),
- REAL_CONST(87763.381732153779 / 8.0),
- REAL_CONST(87786.331657042057 / 8.0),
- REAL_CONST(87809.283081974456 / 8.0),
- REAL_CONST(87832.236006754916 / 8.0),
- REAL_CONST(87855.190431187453 / 8.0),
- REAL_CONST(87878.146355076155 / 8.0),
- REAL_CONST(87901.103778225151 / 8.0),
- REAL_CONST(87924.062700438633 / 8.0),
- REAL_CONST(87947.023121520891 / 8.0),
- REAL_CONST(87969.985041276246 / 8.0),
- REAL_CONST(87992.948459509105 / 8.0),
- REAL_CONST(88015.913376023906 / 8.0),
- REAL_CONST(88038.879790625171 / 8.0),
- REAL_CONST(88061.847703117513 / 8.0),
- REAL_CONST(88084.817113305573 / 8.0),
- REAL_CONST(88107.788020994049 / 8.0),
- REAL_CONST(88130.760425987726 / 8.0),
- REAL_CONST(88153.734328091465 / 8.0),
- REAL_CONST(88176.709727110137 / 8.0),
- REAL_CONST(88199.686622848749 / 8.0),
- REAL_CONST(88222.665015112303 / 8.0),
- REAL_CONST(88245.644903705906 / 8.0),
- REAL_CONST(88268.626288434709 / 8.0),
- REAL_CONST(88291.609169103947 / 8.0),
- REAL_CONST(88314.593545518903 / 8.0),
- REAL_CONST(88337.579417484914 / 8.0),
- REAL_CONST(88360.566784807408 / 8.0),
- REAL_CONST(88383.555647291854 / 8.0),
- REAL_CONST(88406.546004743795 / 8.0),
- REAL_CONST(88429.537856968818 / 8.0),
- REAL_CONST(88452.531203772611 / 8.0),
- REAL_CONST(88475.52604496089 / 8.0),
- REAL_CONST(88498.522380339447 / 8.0),
- REAL_CONST(88521.52020971413 / 8.0),
- REAL_CONST(88544.519532890874 / 8.0),
- REAL_CONST(88567.520349675644 / 8.0),
- REAL_CONST(88590.522659874507 / 8.0),
- REAL_CONST(88613.526463293543 / 8.0),
- REAL_CONST(88636.531759738922 / 8.0),
- REAL_CONST(88659.538549016899 / 8.0),
- REAL_CONST(88682.546830933745 / 8.0),
- REAL_CONST(88705.556605295846 / 8.0),
- REAL_CONST(88728.567871909589 / 8.0),
- REAL_CONST(88751.580630581491 / 8.0),
- REAL_CONST(88774.594881118086 / 8.0),
- REAL_CONST(88797.610623325963 / 8.0),
- REAL_CONST(88820.62785701183 / 8.0),
- REAL_CONST(88843.646581982393 / 8.0),
- REAL_CONST(88866.666798044462 / 8.0),
- REAL_CONST(88889.688505004888 / 8.0),
- REAL_CONST(88912.711702670611 / 8.0),
- REAL_CONST(88935.7363908486 / 8.0),
- REAL_CONST(88958.762569345898 / 8.0),
- REAL_CONST(88981.790237969632 / 8.0),
- REAL_CONST(89004.81939652696 / 8.0),
- REAL_CONST(89027.850044825114 / 8.0),
- REAL_CONST(89050.882182671412 / 8.0),
- REAL_CONST(89073.9158098732 / 8.0),
- REAL_CONST(89096.950926237885 / 8.0),
- REAL_CONST(89119.987531572973 / 8.0),
- REAL_CONST(89143.025625686001 / 8.0),
- REAL_CONST(89166.065208384563 / 8.0),
- REAL_CONST(89189.106279476357 / 8.0),
- REAL_CONST(89212.148838769106 / 8.0),
- REAL_CONST(89235.192886070581 / 8.0),
- REAL_CONST(89258.238421188667 / 8.0),
- REAL_CONST(89281.285443931265 / 8.0),
- REAL_CONST(89304.333954106376 / 8.0),
- REAL_CONST(89327.383951522017 / 8.0),
- REAL_CONST(89350.435435986306 / 8.0),
- REAL_CONST(89373.488407307406 / 8.0),
- REAL_CONST(89396.542865293537 / 8.0),
- REAL_CONST(89419.598809753006 / 8.0),
- REAL_CONST(89442.656240494165 / 8.0),
- REAL_CONST(89465.715157325409 / 8.0),
- REAL_CONST(89488.775560055219 / 8.0),
- REAL_CONST(89511.837448492137 / 8.0),
- REAL_CONST(89534.900822444746 / 8.0),
- REAL_CONST(89557.965681721733 / 8.0),
- REAL_CONST(89581.032026131812 / 8.0),
- REAL_CONST(89604.099855483742 / 8.0),
- REAL_CONST(89627.169169586399 / 8.0),
- REAL_CONST(89650.239968248672 / 8.0),
- REAL_CONST(89673.312251279538 / 8.0),
- REAL_CONST(89696.386018488018 / 8.0),
- REAL_CONST(89719.461269683205 / 8.0),
- REAL_CONST(89742.53800467425 / 8.0),
- REAL_CONST(89765.616223270365 / 8.0),
- REAL_CONST(89788.69592528083 / 8.0),
- REAL_CONST(89811.777110514988 / 8.0),
- REAL_CONST(89834.859778782207 / 8.0),
- REAL_CONST(89857.943929891975 / 8.0),
- REAL_CONST(89881.029563653807 / 8.0),
- REAL_CONST(89904.116679877261 / 8.0),
- REAL_CONST(89927.205278372014 / 8.0),
- REAL_CONST(89950.29535894774 / 8.0),
- REAL_CONST(89973.386921414218 / 8.0),
- REAL_CONST(89996.479965581268 / 8.0),
- REAL_CONST(90019.574491258769 / 8.0),
- REAL_CONST(90042.670498256688 / 8.0),
- REAL_CONST(90065.767986385021 / 8.0),
- REAL_CONST(90088.866955453836 / 8.0),
- REAL_CONST(90111.967405273259 / 8.0),
- REAL_CONST(90135.069335653476 / 8.0),
- REAL_CONST(90158.172746404758 / 8.0),
- REAL_CONST(90181.277637337407 / 8.0),
- REAL_CONST(90204.384008261797 / 8.0),
- REAL_CONST(90227.49185898836 / 8.0),
- REAL_CONST(90250.601189327586 / 8.0),
- REAL_CONST(90273.711999090039 / 8.0),
- REAL_CONST(90296.824288086325 / 8.0),
- REAL_CONST(90319.938056127125 / 8.0),
- REAL_CONST(90343.053303023189 / 8.0),
- REAL_CONST(90366.170028585286 / 8.0),
- REAL_CONST(90389.288232624298 / 8.0),
- REAL_CONST(90412.407914951138 / 8.0),
- REAL_CONST(90435.529075376777 / 8.0),
- REAL_CONST(90458.651713712257 / 8.0),
- REAL_CONST(90481.775829768681 / 8.0),
- REAL_CONST(90504.901423357209 / 8.0),
- REAL_CONST(90528.028494289058 / 8.0),
- REAL_CONST(90551.157042375504 / 8.0),
- REAL_CONST(90574.287067427911 / 8.0),
- REAL_CONST(90597.418569257643 / 8.0),
- REAL_CONST(90620.551547676194 / 8.0),
- REAL_CONST(90643.686002495073 / 8.0),
- REAL_CONST(90666.821933525847 / 8.0),
- REAL_CONST(90689.959340580186 / 8.0),
- REAL_CONST(90713.098223469773 / 8.0),
- REAL_CONST(90736.238582006365 / 8.0),
- REAL_CONST(90759.380416001804 / 8.0),
- REAL_CONST(90782.523725267951 / 8.0),
- REAL_CONST(90805.668509616764 / 8.0),
- REAL_CONST(90828.814768860233 / 8.0),
- REAL_CONST(90851.962502810435 / 8.0),
- REAL_CONST(90875.11171127946 / 8.0),
- REAL_CONST(90898.262394079517 / 8.0),
- REAL_CONST(90921.414551022855 / 8.0),
- REAL_CONST(90944.568181921743 / 8.0),
- REAL_CONST(90967.72328658856 / 8.0),
- REAL_CONST(90990.879864835719 / 8.0),
- REAL_CONST(91014.037916475718 / 8.0),
- REAL_CONST(91037.19744132107 / 8.0),
- REAL_CONST(91060.358439184391 / 8.0),
- REAL_CONST(91083.520909878338 / 8.0),
- REAL_CONST(91106.684853215629 / 8.0),
- REAL_CONST(91129.850269009039 / 8.0),
- REAL_CONST(91153.017157071401 / 8.0),
- REAL_CONST(91176.185517215621 / 8.0),
- REAL_CONST(91199.355349254649 / 8.0),
- REAL_CONST(91222.526653001492 / 8.0),
- REAL_CONST(91245.699428269247 / 8.0),
- REAL_CONST(91268.873674871036 / 8.0),
- REAL_CONST(91292.049392620058 / 8.0),
- REAL_CONST(91315.226581329553 / 8.0),
- REAL_CONST(91338.405240812834 / 8.0),
- REAL_CONST(91361.585370883287 / 8.0),
- REAL_CONST(91384.766971354344 / 8.0),
- REAL_CONST(91407.950042039476 / 8.0),
- REAL_CONST(91431.134582752245 / 8.0),
- REAL_CONST(91454.320593306256 / 8.0),
- REAL_CONST(91477.508073515171 / 8.0),
- REAL_CONST(91500.697023192712 / 8.0),
- REAL_CONST(91523.887442152685 / 8.0),
- REAL_CONST(91547.07933020893 / 8.0),
- REAL_CONST(91570.272687175326 / 8.0),
- REAL_CONST(91593.467512865856 / 8.0),
- REAL_CONST(91616.663807094534 / 8.0),
- REAL_CONST(91639.861569675442 / 8.0),
- REAL_CONST(91663.060800422725 / 8.0),
- REAL_CONST(91686.261499150554 / 8.0),
- REAL_CONST(91709.463665673218 / 8.0),
- REAL_CONST(91732.66729980502 / 8.0),
- REAL_CONST(91755.872401360321 / 8.0),
- REAL_CONST(91779.078970153569 / 8.0),
- REAL_CONST(91802.287005999257 / 8.0),
- REAL_CONST(91825.49650871192 / 8.0),
- REAL_CONST(91848.707478106167 / 8.0),
- REAL_CONST(91871.91991399668 / 8.0),
- REAL_CONST(91895.133816198169 / 8.0),
- REAL_CONST(91918.349184525418 / 8.0),
- REAL_CONST(91941.566018793281 / 8.0),
- REAL_CONST(91964.784318816659 / 8.0),
- REAL_CONST(91988.004084410495 / 8.0),
- REAL_CONST(92011.22531538982 / 8.0),
- REAL_CONST(92034.448011569708 / 8.0),
- REAL_CONST(92057.672172765277 / 8.0),
- REAL_CONST(92080.897798791746 / 8.0),
- REAL_CONST(92104.124889464365 / 8.0),
- REAL_CONST(92127.353444598411 / 8.0),
- REAL_CONST(92150.58346400928 / 8.0),
- REAL_CONST(92173.814947512379 / 8.0),
- REAL_CONST(92197.04789492322 / 8.0),
- REAL_CONST(92220.282306057314 / 8.0),
- REAL_CONST(92243.518180730272 / 8.0),
- REAL_CONST(92266.755518757753 / 8.0),
- REAL_CONST(92289.994319955469 / 8.0),
- REAL_CONST(92313.234584139194 / 8.0),
- REAL_CONST(92336.476311124774 / 8.0),
- REAL_CONST(92359.719500728082 / 8.0),
- REAL_CONST(92382.964152765067 / 8.0),
- REAL_CONST(92406.210267051734 / 8.0),
- REAL_CONST(92429.457843404161 / 8.0),
- REAL_CONST(92452.706881638471 / 8.0),
- REAL_CONST(92475.957381570814 / 8.0),
- REAL_CONST(92499.209343017443 / 8.0),
- REAL_CONST(92522.462765794655 / 8.0),
- REAL_CONST(92545.717649718805 / 8.0),
- REAL_CONST(92568.973994606305 / 8.0),
- REAL_CONST(92592.231800273614 / 8.0),
- REAL_CONST(92615.491066537259 / 8.0),
- REAL_CONST(92638.751793213814 / 8.0),
- REAL_CONST(92662.01398011994 / 8.0),
- REAL_CONST(92685.277627072326 / 8.0),
- REAL_CONST(92708.54273388772 / 8.0),
- REAL_CONST(92731.809300382942 / 8.0),
- REAL_CONST(92755.077326374871 / 8.0),
- REAL_CONST(92778.346811680414 / 8.0),
- REAL_CONST(92801.617756116568 / 8.0),
- REAL_CONST(92824.890159500384 / 8.0),
- REAL_CONST(92848.164021648947 / 8.0),
- REAL_CONST(92871.439342379424 / 8.0),
- REAL_CONST(92894.716121509016 / 8.0),
- REAL_CONST(92917.994358855023 / 8.0),
- REAL_CONST(92941.274054234746 / 8.0),
- REAL_CONST(92964.555207465572 / 8.0),
- REAL_CONST(92987.837818364962 / 8.0),
- REAL_CONST(93011.121886750407 / 8.0),
- REAL_CONST(93034.407412439468 / 8.0),
- REAL_CONST(93057.694395249753 / 8.0),
- REAL_CONST(93080.982834998955 / 8.0),
- REAL_CONST(93104.272731504767 / 8.0),
- REAL_CONST(93127.564084584999 / 8.0),
- REAL_CONST(93150.856894057491 / 8.0),
- REAL_CONST(93174.15115974014 / 8.0),
- REAL_CONST(93197.446881450916 / 8.0),
- REAL_CONST(93220.744059007804 / 8.0),
- REAL_CONST(93244.04269222889 / 8.0),
- REAL_CONST(93267.342780932304 / 8.0),
- REAL_CONST(93290.644324936235 / 8.0),
- REAL_CONST(93313.947324058914 / 8.0),
- REAL_CONST(93337.251778118633 / 8.0),
- REAL_CONST(93360.557686933767 / 8.0),
- REAL_CONST(93383.865050322696 / 8.0),
- REAL_CONST(93407.173868103928 / 8.0),
- REAL_CONST(93430.484140095941 / 8.0),
- REAL_CONST(93453.795866117362 / 8.0),
- REAL_CONST(93477.109045986799 / 8.0),
- REAL_CONST(93500.423679522952 / 8.0),
- REAL_CONST(93523.739766544561 / 8.0),
- REAL_CONST(93547.057306870454 / 8.0),
- REAL_CONST(93570.376300319491 / 8.0),
- REAL_CONST(93593.696746710571 / 8.0),
- REAL_CONST(93617.018645862699 / 8.0),
- REAL_CONST(93640.341997594893 / 8.0),
- REAL_CONST(93663.666801726242 / 8.0),
- REAL_CONST(93686.993058075881 / 8.0),
- REAL_CONST(93710.320766463032 / 8.0),
- REAL_CONST(93733.64992670693 / 8.0),
- REAL_CONST(93756.980538626914 / 8.0),
- REAL_CONST(93780.312602042337 / 8.0),
- REAL_CONST(93803.646116772637 / 8.0),
- REAL_CONST(93826.981082637285 / 8.0),
- REAL_CONST(93850.317499455836 / 8.0),
- REAL_CONST(93873.655367047861 / 8.0),
- REAL_CONST(93896.994685233032 / 8.0),
- REAL_CONST(93920.335453831038 / 8.0),
- REAL_CONST(93943.677672661666 / 8.0),
- REAL_CONST(93967.021341544707 / 8.0),
- REAL_CONST(93990.366460300051 / 8.0),
- REAL_CONST(94013.713028747632 / 8.0),
- REAL_CONST(94037.061046707429 / 8.0),
- REAL_CONST(94060.410513999494 / 8.0),
- REAL_CONST(94083.761430443905 / 8.0),
- REAL_CONST(94107.113795860845 / 8.0),
- REAL_CONST(94130.467610070496 / 8.0),
- REAL_CONST(94153.822872893157 / 8.0),
- REAL_CONST(94177.179584149111 / 8.0),
- REAL_CONST(94200.537743658759 / 8.0),
- REAL_CONST(94223.897351242529 / 8.0),
- REAL_CONST(94247.25840672091 / 8.0),
- REAL_CONST(94270.620909914433 / 8.0),
- REAL_CONST(94293.98486064373 / 8.0),
- REAL_CONST(94317.350258729421 / 8.0),
- REAL_CONST(94340.71710399224 / 8.0),
- REAL_CONST(94364.085396252936 / 8.0),
- REAL_CONST(94387.455135332348 / 8.0),
- REAL_CONST(94410.82632105134 / 8.0),
- REAL_CONST(94434.198953230851 / 8.0),
- REAL_CONST(94457.573031691878 / 8.0),
- REAL_CONST(94480.948556255447 / 8.0),
- REAL_CONST(94504.325526742658 / 8.0),
- REAL_CONST(94527.70394297468 / 8.0),
- REAL_CONST(94551.083804772716 / 8.0),
- REAL_CONST(94574.465111958023 / 8.0),
- REAL_CONST(94597.847864351934 / 8.0),
- REAL_CONST(94621.232061775823 / 8.0),
- REAL_CONST(94644.617704051096 / 8.0),
- REAL_CONST(94668.004790999272 / 8.0),
- REAL_CONST(94691.393322441872 / 8.0),
- REAL_CONST(94714.783298200506 / 8.0),
- REAL_CONST(94738.174718096794 / 8.0),
- REAL_CONST(94761.567581952477 / 8.0),
- REAL_CONST(94784.961889589307 / 8.0),
- REAL_CONST(94808.357640829097 / 8.0),
- REAL_CONST(94831.754835493703 / 8.0),
- REAL_CONST(94855.153473405066 / 8.0),
- REAL_CONST(94878.553554385173 / 8.0),
- REAL_CONST(94901.955078256055 / 8.0),
- REAL_CONST(94925.358044839784 / 8.0),
- REAL_CONST(94948.762453958523 / 8.0),
- REAL_CONST(94972.168305434476 / 8.0),
- REAL_CONST(94995.575599089891 / 8.0),
- REAL_CONST(95018.984334747074 / 8.0),
- REAL_CONST(95042.394512228391 / 8.0),
- REAL_CONST(95065.806131356265 / 8.0),
- REAL_CONST(95089.219191953176 / 8.0),
- REAL_CONST(95112.633693841635 / 8.0),
- REAL_CONST(95136.04963684424 / 8.0),
- REAL_CONST(95159.467020783617 / 8.0),
- REAL_CONST(95182.885845482466 / 8.0),
- REAL_CONST(95206.306110763529 / 8.0),
- REAL_CONST(95229.727816449609 / 8.0),
- REAL_CONST(95253.150962363579 / 8.0),
- REAL_CONST(95276.575548328314 / 8.0),
- REAL_CONST(95300.001574166803 / 8.0),
- REAL_CONST(95323.429039702052 / 8.0),
- REAL_CONST(95346.857944757154 / 8.0),
- REAL_CONST(95370.288289155214 / 8.0),
- REAL_CONST(95393.720072719429 / 8.0),
- REAL_CONST(95417.153295273019 / 8.0),
- REAL_CONST(95440.587956639298 / 8.0),
- REAL_CONST(95464.024056641589 / 8.0),
- REAL_CONST(95487.461595103305 / 8.0),
- REAL_CONST(95510.900571847902 / 8.0),
- REAL_CONST(95534.340986698866 / 8.0),
- REAL_CONST(95557.782839479783 / 8.0),
- REAL_CONST(95581.226130014256 / 8.0),
- REAL_CONST(95604.670858125959 / 8.0),
- REAL_CONST(95628.117023638595 / 8.0),
- REAL_CONST(95651.564626375985 / 8.0),
- REAL_CONST(95675.013666161918 / 8.0),
- REAL_CONST(95698.464142820303 / 8.0),
- REAL_CONST(95721.916056175076 / 8.0),
- REAL_CONST(95745.369406050231 / 8.0),
- REAL_CONST(95768.824192269807 / 8.0),
- REAL_CONST(95792.280414657915 / 8.0),
- REAL_CONST(95815.738073038709 / 8.0),
- REAL_CONST(95839.197167236387 / 8.0),
- REAL_CONST(95862.657697075221 / 8.0),
- REAL_CONST(95886.11966237954 / 8.0),
- REAL_CONST(95909.583062973688 / 8.0),
- REAL_CONST(95933.047898682111 / 8.0),
- REAL_CONST(95956.514169329268 / 8.0),
- REAL_CONST(95979.981874739708 / 8.0),
- REAL_CONST(96003.451014738006 / 8.0),
- REAL_CONST(96026.921589148798 / 8.0),
- REAL_CONST(96050.393597796792 / 8.0),
- REAL_CONST(96073.867040506724 / 8.0),
- REAL_CONST(96097.341917103375 / 8.0),
- REAL_CONST(96120.818227411626 / 8.0),
- REAL_CONST(96144.295971256375 / 8.0),
- REAL_CONST(96167.775148462577 / 8.0),
- REAL_CONST(96191.255758855244 / 8.0),
- REAL_CONST(96214.737802259449 / 8.0),
- REAL_CONST(96238.221278500292 / 8.0),
- REAL_CONST(96261.70618740299 / 8.0),
- REAL_CONST(96285.192528792715 / 8.0),
- REAL_CONST(96308.680302494788 / 8.0),
- REAL_CONST(96332.169508334526 / 8.0),
- REAL_CONST(96355.660146137321 / 8.0),
- REAL_CONST(96379.152215728609 / 8.0),
- REAL_CONST(96402.645716933868 / 8.0),
- REAL_CONST(96426.14064957868 / 8.0),
- REAL_CONST(96449.637013488609 / 8.0),
- REAL_CONST(96473.134808489311 / 8.0),
- REAL_CONST(96496.63403440651 / 8.0),
- REAL_CONST(96520.134691065963 / 8.0),
- REAL_CONST(96543.636778293469 / 8.0),
- REAL_CONST(96567.140295914898 / 8.0),
- REAL_CONST(96590.645243756153 / 8.0),
- REAL_CONST(96614.151621643221 / 8.0),
- REAL_CONST(96637.659429402134 / 8.0),
- REAL_CONST(96661.168666858954 / 8.0),
- REAL_CONST(96684.679333839798 / 8.0),
- REAL_CONST(96708.191430170875 / 8.0),
- REAL_CONST(96731.70495567839 / 8.0),
- REAL_CONST(96755.219910188665 / 8.0),
- REAL_CONST(96778.736293528011 / 8.0),
- REAL_CONST(96802.254105522836 / 8.0),
- REAL_CONST(96825.77334599958 / 8.0),
- REAL_CONST(96849.29401478474 / 8.0),
- REAL_CONST(96872.816111704873 / 8.0),
- REAL_CONST(96896.339636586577 / 8.0),
- REAL_CONST(96919.864589256511 / 8.0),
- REAL_CONST(96943.390969541389 / 8.0),
- REAL_CONST(96966.918777267958 / 8.0),
- REAL_CONST(96990.448012263048 / 8.0),
- REAL_CONST(97013.978674353522 / 8.0),
- REAL_CONST(97037.510763366285 / 8.0),
- REAL_CONST(97061.044279128328 / 8.0),
- REAL_CONST(97084.579221466673 / 8.0),
- REAL_CONST(97108.115590208385 / 8.0),
- REAL_CONST(97131.653385180587 / 8.0),
- REAL_CONST(97155.19260621049 / 8.0),
- REAL_CONST(97178.733253125291 / 8.0),
- REAL_CONST(97202.2753257523 / 8.0),
- REAL_CONST(97225.81882391886 / 8.0),
- REAL_CONST(97249.363747452342 / 8.0),
- REAL_CONST(97272.910096180189 / 8.0),
- REAL_CONST(97296.457869929916 / 8.0),
- REAL_CONST(97320.007068529041 / 8.0),
- REAL_CONST(97343.557691805196 / 8.0),
- REAL_CONST(97367.109739586012 / 8.0),
- REAL_CONST(97390.663211699197 / 8.0),
- REAL_CONST(97414.218107972498 / 8.0),
- REAL_CONST(97437.774428233737 / 8.0),
- REAL_CONST(97461.332172310766 / 8.0),
- REAL_CONST(97484.891340031507 / 8.0),
- REAL_CONST(97508.451931223899 / 8.0),
- REAL_CONST(97532.013945715982 / 8.0),
- REAL_CONST(97555.577383335811 / 8.0),
- REAL_CONST(97579.142243911512 / 8.0),
- REAL_CONST(97602.708527271257 / 8.0),
- REAL_CONST(97626.276233243261 / 8.0),
- REAL_CONST(97649.845361655811 / 8.0),
- REAL_CONST(97673.415912337223 / 8.0),
- REAL_CONST(97696.987885115886 / 8.0),
- REAL_CONST(97720.561279820206 / 8.0),
- REAL_CONST(97744.1360962787 / 8.0),
- REAL_CONST(97767.712334319876 / 8.0),
- REAL_CONST(97791.289993772341 / 8.0),
- REAL_CONST(97814.869074464703 / 8.0),
- REAL_CONST(97838.449576225685 / 8.0),
- REAL_CONST(97862.031498883996 / 8.0),
- REAL_CONST(97885.614842268449 / 8.0),
- REAL_CONST(97909.199606207883 / 8.0),
- REAL_CONST(97932.785790531183 / 8.0),
- REAL_CONST(97956.37339506732 / 8.0),
- REAL_CONST(97979.962419645264 / 8.0),
- REAL_CONST(98003.552864094076 / 8.0),
- REAL_CONST(98027.144728242856 / 8.0),
- REAL_CONST(98050.738011920766 / 8.0),
- REAL_CONST(98074.332714956996 / 8.0),
- REAL_CONST(98097.928837180807 / 8.0),
- REAL_CONST(98121.526378421506 / 8.0),
- REAL_CONST(98145.125338508456 / 8.0),
- REAL_CONST(98168.725717271067 / 8.0),
- REAL_CONST(98192.327514538789 / 8.0),
- REAL_CONST(98215.930730141132 / 8.0),
- REAL_CONST(98239.535363907664 / 8.0),
- REAL_CONST(98263.141415668011 / 8.0),
- REAL_CONST(98286.748885251814 / 8.0),
- REAL_CONST(98310.357772488816 / 8.0),
- REAL_CONST(98333.968077208759 / 8.0),
- REAL_CONST(98357.579799241488 / 8.0),
- REAL_CONST(98381.192938416847 / 8.0),
- REAL_CONST(98404.807494564782 / 8.0),
- REAL_CONST(98428.42346751524 / 8.0),
- REAL_CONST(98452.040857098269 / 8.0),
- REAL_CONST(98475.659663143917 / 8.0),
- REAL_CONST(98499.27988548232 / 8.0),
- REAL_CONST(98522.901523943656 / 8.0),
- REAL_CONST(98546.524578358163 / 8.0),
- REAL_CONST(98570.149048556093 / 8.0),
- REAL_CONST(98593.774934367786 / 8.0),
- REAL_CONST(98617.402235623624 / 8.0),
- REAL_CONST(98641.030952154048 / 8.0),
- REAL_CONST(98664.661083789513 / 8.0),
- REAL_CONST(98688.292630360564 / 8.0),
- REAL_CONST(98711.925591697771 / 8.0),
- REAL_CONST(98735.559967631794 / 8.0),
- REAL_CONST(98759.195757993293 / 8.0),
- REAL_CONST(98782.832962613014 / 8.0),
- REAL_CONST(98806.471581321734 / 8.0),
- REAL_CONST(98830.111613950285 / 8.0),
- REAL_CONST(98853.753060329575 / 8.0),
- REAL_CONST(98877.39592029051 / 8.0),
- REAL_CONST(98901.040193664099 / 8.0),
- REAL_CONST(98924.68588028138 / 8.0),
- REAL_CONST(98948.33297997342 / 8.0),
- REAL_CONST(98971.981492571387 / 8.0),
- REAL_CONST(98995.63141790645 / 8.0),
- REAL_CONST(99019.282755809851 / 8.0),
- REAL_CONST(99042.935506112874 / 8.0),
- REAL_CONST(99066.589668646877 / 8.0),
- REAL_CONST(99090.245243243233 / 8.0),
- REAL_CONST(99113.902229733401 / 8.0),
- REAL_CONST(99137.560627948857 / 8.0),
- REAL_CONST(99161.220437721131 / 8.0),
- REAL_CONST(99184.881658881859 / 8.0),
- REAL_CONST(99208.544291262631 / 8.0),
- REAL_CONST(99232.208334695169 / 8.0),
- REAL_CONST(99255.87378901121 / 8.0),
- REAL_CONST(99279.540654042547 / 8.0),
- REAL_CONST(99303.208929621018 / 8.0),
- REAL_CONST(99326.878615578535 / 8.0),
- REAL_CONST(99350.549711746993 / 8.0),
- REAL_CONST(99374.222217958435 / 8.0),
- REAL_CONST(99397.896134044888 / 8.0),
- REAL_CONST(99421.571459838422 / 8.0),
- REAL_CONST(99445.248195171211 / 8.0),
- REAL_CONST(99468.926339875441 / 8.0),
- REAL_CONST(99492.605893783344 / 8.0),
- REAL_CONST(99516.286856727209 / 8.0),
- REAL_CONST(99539.969228539398 / 8.0),
- REAL_CONST(99563.653009052287 / 8.0),
- REAL_CONST(99587.338198098325 / 8.0),
- REAL_CONST(99611.024795510006 / 8.0),
- REAL_CONST(99634.712801119866 / 8.0),
- REAL_CONST(99658.402214760499 / 8.0),
- REAL_CONST(99682.093036264545 / 8.0),
- REAL_CONST(99705.785265464699 / 8.0),
- REAL_CONST(99729.478902193689 / 8.0),
- REAL_CONST(99753.173946284325 / 8.0),
- REAL_CONST(99776.870397569437 / 8.0),
- REAL_CONST(99800.56825588191 / 8.0),
- REAL_CONST(99824.267521054688 / 8.0),
- REAL_CONST(99847.968192920773 / 8.0),
- REAL_CONST(99871.670271313182 / 8.0),
- REAL_CONST(99895.373756065004 / 8.0),
- REAL_CONST(99919.078647009388 / 8.0),
- REAL_CONST(99942.78494397951 / 8.0),
- REAL_CONST(99966.492646808634 / 8.0),
- REAL_CONST(99990.20175533001 / 8.0),
- REAL_CONST(100013.91226937699 / 8.0),
- REAL_CONST(100037.62418878295 / 8.0),
- REAL_CONST(100061.33751338134 / 8.0),
- REAL_CONST(100085.05224300563 / 8.0),
- REAL_CONST(100108.76837748935 / 8.0),
- REAL_CONST(100132.4859166661 / 8.0),
- REAL_CONST(100156.2048603695 / 8.0),
- REAL_CONST(100179.92520843323 / 8.0),
- REAL_CONST(100203.64696069101 / 8.0),
- REAL_CONST(100227.37011697664 / 8.0),
- REAL_CONST(100251.09467712394 / 8.0),
- REAL_CONST(100274.82064096678 / 8.0),
- REAL_CONST(100298.54800833909 / 8.0),
- REAL_CONST(100322.27677907483 / 8.0),
- REAL_CONST(100346.00695300807 / 8.0),
- REAL_CONST(100369.73852997283 / 8.0),
- REAL_CONST(100393.47150980328 / 8.0),
- REAL_CONST(100417.20589233354 / 8.0),
- REAL_CONST(100440.94167739789 / 8.0),
- REAL_CONST(100464.67886483055 / 8.0),
- REAL_CONST(100488.41745446586 / 8.0),
- REAL_CONST(100512.1574461382 / 8.0),
- REAL_CONST(100535.89883968196 / 8.0),
- REAL_CONST(100559.64163493161 / 8.0),
- REAL_CONST(100583.38583172169 / 8.0),
- REAL_CONST(100607.13142988674 / 8.0),
- REAL_CONST(100630.87842926137 / 8.0),
- REAL_CONST(100654.62682968024 / 8.0),
- REAL_CONST(100678.37663097809 / 8.0),
- REAL_CONST(100702.12783298964 / 8.0),
- REAL_CONST(100725.88043554971 / 8.0),
- REAL_CONST(100749.63443849317 / 8.0),
- REAL_CONST(100773.38984165489 / 8.0),
- REAL_CONST(100797.14664486986 / 8.0),
- REAL_CONST(100820.90484797307 / 8.0),
- REAL_CONST(100844.66445079957 / 8.0),
- REAL_CONST(100868.42545318443 / 8.0),
- REAL_CONST(100892.18785496285 / 8.0),
- REAL_CONST(100915.95165596998 / 8.0),
- REAL_CONST(100939.71685604109 / 8.0),
- REAL_CONST(100963.48345501146 / 8.0),
- REAL_CONST(100987.25145271645 / 8.0),
- REAL_CONST(101011.02084899142 / 8.0),
- REAL_CONST(101034.79164367182 / 8.0),
- REAL_CONST(101058.56383659317 / 8.0),
- REAL_CONST(101082.33742759094 / 8.0),
- REAL_CONST(101106.11241650078 / 8.0),
- REAL_CONST(101129.88880315828 / 8.0),
- REAL_CONST(101153.66658739912 / 8.0),
- REAL_CONST(101177.44576905905 / 8.0),
- REAL_CONST(101201.22634797383 / 8.0),
- REAL_CONST(101225.00832397929 / 8.0),
- REAL_CONST(101248.7916969113 / 8.0),
- REAL_CONST(101272.57646660579 / 8.0),
- REAL_CONST(101296.36263289873 / 8.0),
- REAL_CONST(101320.15019562612 / 8.0),
- REAL_CONST(101343.93915462404 / 8.0),
- REAL_CONST(101367.7295097286 / 8.0),
- REAL_CONST(101391.52126077596 / 8.0),
- REAL_CONST(101415.31440760233 / 8.0),
- REAL_CONST(101439.10895004397 / 8.0),
- REAL_CONST(101462.9048879372 / 8.0),
- REAL_CONST(101486.70222111834 / 8.0),
- REAL_CONST(101510.50094942382 / 8.0),
- REAL_CONST(101534.30107269008 / 8.0),
- REAL_CONST(101558.10259075361 / 8.0),
- REAL_CONST(101581.90550345098 / 8.0),
- REAL_CONST(101605.70981061876 / 8.0),
- REAL_CONST(101629.5155120936 / 8.0),
- REAL_CONST(101653.32260771218 / 8.0),
- REAL_CONST(101677.13109731126 / 8.0),
- REAL_CONST(101700.9409807276 / 8.0),
- REAL_CONST(101724.75225779804 / 8.0),
- REAL_CONST(101748.56492835947 / 8.0),
- REAL_CONST(101772.37899224881 / 8.0),
- REAL_CONST(101796.19444930303 / 8.0),
- REAL_CONST(101820.01129935916 / 8.0),
- REAL_CONST(101843.82954225427 / 8.0),
- REAL_CONST(101867.64917782549 / 8.0),
- REAL_CONST(101891.47020590997 / 8.0),
- REAL_CONST(101915.29262634492 / 8.0),
- REAL_CONST(101939.11643896763 / 8.0),
- REAL_CONST(101962.94164361537 / 8.0),
- REAL_CONST(101986.76824012553 / 8.0),
- REAL_CONST(102010.59622833549 / 8.0),
- REAL_CONST(102034.42560808272 / 8.0),
- REAL_CONST(102058.25637920471 / 8.0),
- REAL_CONST(102082.08854153901 / 8.0),
- REAL_CONST(102105.9220949232 / 8.0),
- REAL_CONST(102129.75703919494 / 8.0),
- REAL_CONST(102153.59337419191 / 8.0),
- REAL_CONST(102177.43109975185 / 8.0),
- REAL_CONST(102201.27021571253 / 8.0),
- REAL_CONST(102225.1107219118 / 8.0),
- REAL_CONST(102248.95261818753 / 8.0),
- REAL_CONST(102272.79590437764 / 8.0),
- REAL_CONST(102296.64058032009 / 8.0),
- REAL_CONST(102320.48664585294 / 8.0),
- REAL_CONST(102344.33410081422 / 8.0),
- REAL_CONST(102368.18294504205 / 8.0),
- REAL_CONST(102392.03317837461 / 8.0),
- REAL_CONST(102415.88480065008 / 8.0),
- REAL_CONST(102439.73781170673 / 8.0),
- REAL_CONST(102463.59221138287 / 8.0),
- REAL_CONST(102487.44799951684 / 8.0),
- REAL_CONST(102511.30517594704 / 8.0),
- REAL_CONST(102535.1637405119 / 8.0),
- REAL_CONST(102559.02369304992 / 8.0),
- REAL_CONST(102582.88503339965 / 8.0),
- REAL_CONST(102606.74776139967 / 8.0),
- REAL_CONST(102630.61187688859 / 8.0),
- REAL_CONST(102654.4773797051 / 8.0),
- REAL_CONST(102678.34426968795 / 8.0),
- REAL_CONST(102702.21254667587 / 8.0),
- REAL_CONST(102726.08221050771 / 8.0),
- REAL_CONST(102749.95326102231 / 8.0),
- REAL_CONST(102773.8256980586 / 8.0),
- REAL_CONST(102797.69952145554 / 8.0),
- REAL_CONST(102821.57473105213 / 8.0),
- REAL_CONST(102845.45132668741 / 8.0),
- REAL_CONST(102869.32930820051 / 8.0),
- REAL_CONST(102893.20867543056 / 8.0),
- REAL_CONST(102917.08942821674 / 8.0),
- REAL_CONST(102940.97156639832 / 8.0),
- REAL_CONST(102964.85508981455 / 8.0),
- REAL_CONST(102988.73999830478 / 8.0),
- REAL_CONST(103012.6262917084 / 8.0),
- REAL_CONST(103036.51396986481 / 8.0),
- REAL_CONST(103060.40303261351 / 8.0),
- REAL_CONST(103084.293479794 / 8.0),
- REAL_CONST(103108.18531124585 / 8.0),
- REAL_CONST(103132.07852680866 / 8.0),
- REAL_CONST(103155.97312632212 / 8.0),
- REAL_CONST(103179.8691096259 / 8.0),
- REAL_CONST(103203.76647655977 / 8.0),
- REAL_CONST(103227.66522696352 / 8.0),
- REAL_CONST(103251.56536067701 / 8.0),
- REAL_CONST(103275.46687754011 / 8.0),
- REAL_CONST(103299.36977739276 / 8.0),
- REAL_CONST(103323.27406007495 / 8.0),
- REAL_CONST(103347.1797254267 / 8.0),
- REAL_CONST(103371.0867732881 / 8.0),
- REAL_CONST(103394.99520349925 / 8.0),
- REAL_CONST(103418.90501590034 / 8.0),
- REAL_CONST(103442.81621033157 / 8.0),
- REAL_CONST(103466.72878663319 / 8.0),
- REAL_CONST(103490.64274464553 / 8.0),
- REAL_CONST(103514.55808420894 / 8.0),
- REAL_CONST(103538.4748051638 / 8.0),
- REAL_CONST(103562.39290735057 / 8.0),
- REAL_CONST(103586.31239060973 / 8.0),
- REAL_CONST(103610.23325478184 / 8.0),
- REAL_CONST(103634.15549970744 / 8.0),
- REAL_CONST(103658.07912522719 / 8.0),
- REAL_CONST(103682.00413118176 / 8.0),
- REAL_CONST(103705.93051741188 / 8.0),
- REAL_CONST(103729.85828375829 / 8.0),
- REAL_CONST(103753.78743006183 / 8.0),
- REAL_CONST(103777.71795616332 / 8.0),
- REAL_CONST(103801.64986190372 / 8.0),
- REAL_CONST(103825.58314712394 / 8.0),
- REAL_CONST(103849.51781166498 / 8.0),
- REAL_CONST(103873.4538553679 / 8.0),
- REAL_CONST(103897.39127807376 / 8.0),
- REAL_CONST(103921.33007962372 / 8.0),
- REAL_CONST(103945.27025985894 / 8.0),
- REAL_CONST(103969.21181862066 / 8.0),
- REAL_CONST(103993.15475575015 / 8.0),
- REAL_CONST(104017.0990710887 / 8.0),
- REAL_CONST(104041.0447644777 / 8.0),
- REAL_CONST(104064.99183575854 / 8.0),
- REAL_CONST(104088.94028477269 / 8.0),
- REAL_CONST(104112.89011136163 / 8.0),
- REAL_CONST(104136.84131536692 / 8.0),
- REAL_CONST(104160.79389663014 / 8.0),
- REAL_CONST(104184.74785499295 / 8.0),
- REAL_CONST(104208.70319029699 / 8.0),
- REAL_CONST(104232.65990238401 / 8.0),
- REAL_CONST(104256.61799109577 / 8.0),
- REAL_CONST(104280.57745627411 / 8.0),
- REAL_CONST(104304.53829776087 / 8.0),
- REAL_CONST(104328.50051539797 / 8.0),
- REAL_CONST(104352.46410902737 / 8.0),
- REAL_CONST(104376.42907849104 / 8.0),
- REAL_CONST(104400.39542363105 / 8.0),
- REAL_CONST(104424.36314428948 / 8.0),
- REAL_CONST(104448.33224030846 / 8.0),
- REAL_CONST(104472.3027115302 / 8.0),
- REAL_CONST(104496.27455779689 / 8.0),
- REAL_CONST(104520.24777895081 / 8.0),
- REAL_CONST(104544.22237483428 / 8.0),
- REAL_CONST(104568.19834528965 / 8.0),
- REAL_CONST(104592.17569015936 / 8.0),
- REAL_CONST(104616.15440928582 / 8.0),
- REAL_CONST(104640.13450251156 / 8.0),
- REAL_CONST(104664.1159696791 / 8.0),
- REAL_CONST(104688.09881063103 / 8.0),
- REAL_CONST(104712.08302520998 / 8.0),
- REAL_CONST(104736.06861325864 / 8.0),
- REAL_CONST(104760.05557461972 / 8.0),
- REAL_CONST(104784.043909136 / 8.0),
- REAL_CONST(104808.03361665027 / 8.0),
- REAL_CONST(104832.0246970054 / 8.0),
- REAL_CONST(104856.01715004431 / 8.0),
- REAL_CONST(104880.01097560991 / 8.0),
- REAL_CONST(104904.00617354522 / 8.0),
- REAL_CONST(104928.00274369326 / 8.0),
- REAL_CONST(104952.00068589712 / 8.0),
- REAL_CONST(104975.99999999993 / 8.0),
- REAL_CONST(105000.00068584486 / 8.0),
- REAL_CONST(105024.00274327511 / 8.0),
- REAL_CONST(105048.00617213396 / 8.0),
- REAL_CONST(105072.0109722647 / 8.0),
- REAL_CONST(105096.0171435107 / 8.0),
- REAL_CONST(105120.02468571534 / 8.0),
- REAL_CONST(105144.03359872208 / 8.0),
- REAL_CONST(105168.04388237436 / 8.0),
- REAL_CONST(105192.05553651576 / 8.0),
- REAL_CONST(105216.06856098982 / 8.0),
- REAL_CONST(105240.08295564017 / 8.0),
- REAL_CONST(105264.09872031047 / 8.0),
- REAL_CONST(105288.11585484444 / 8.0),
- REAL_CONST(105312.13435908582 / 8.0),
- REAL_CONST(105336.1542328784 / 8.0),
- REAL_CONST(105360.17547606604 / 8.0),
- REAL_CONST(105384.19808849262 / 8.0),
- REAL_CONST(105408.22207000206 / 8.0),
- REAL_CONST(105432.24742043833 / 8.0),
- REAL_CONST(105456.27413964548 / 8.0),
- REAL_CONST(105480.30222746753 / 8.0),
- REAL_CONST(105504.33168374863 / 8.0),
- REAL_CONST(105528.36250833291 / 8.0),
- REAL_CONST(105552.39470106458 / 8.0),
- REAL_CONST(105576.42826178786 / 8.0),
- REAL_CONST(105600.46319034706 / 8.0),
- REAL_CONST(105624.49948658649 / 8.0),
- REAL_CONST(105648.53715035053 / 8.0),
- REAL_CONST(105672.5761814836 / 8.0),
- REAL_CONST(105696.61657983017 / 8.0),
- REAL_CONST(105720.65834523473 / 8.0),
- REAL_CONST(105744.70147754184 / 8.0),
- REAL_CONST(105768.7459765961 / 8.0),
- REAL_CONST(105792.79184224214 / 8.0),
- REAL_CONST(105816.83907432464 / 8.0),
- REAL_CONST(105840.88767268835 / 8.0),
- REAL_CONST(105864.93763717801 / 8.0),
- REAL_CONST(105888.98896763846 / 8.0),
- REAL_CONST(105913.04166391456 / 8.0),
- REAL_CONST(105937.09572585119 / 8.0),
- REAL_CONST(105961.15115329332 / 8.0),
- REAL_CONST(105985.20794608595 / 8.0),
- REAL_CONST(106009.26610407409 / 8.0),
- REAL_CONST(106033.32562710284 / 8.0),
- REAL_CONST(106057.38651501729 / 8.0),
- REAL_CONST(106081.44876766266 / 8.0),
- REAL_CONST(106105.51238488412 / 8.0),
- REAL_CONST(106129.57736652695 / 8.0),
- REAL_CONST(106153.64371243643 / 8.0),
- REAL_CONST(106177.71142245791 / 8.0),
- REAL_CONST(106201.78049643678 / 8.0),
- REAL_CONST(106225.85093421848 / 8.0),
- REAL_CONST(106249.92273564848 / 8.0),
- REAL_CONST(106273.99590057228 / 8.0),
- REAL_CONST(106298.07042883546 / 8.0),
- REAL_CONST(106322.14632028362 / 8.0),
- REAL_CONST(106346.22357476239 / 8.0),
- REAL_CONST(106370.30219211751 / 8.0),
- REAL_CONST(106394.38217219469 / 8.0),
- REAL_CONST(106418.46351483969 / 8.0),
- REAL_CONST(106442.54621989837 / 8.0),
- REAL_CONST(106466.63028721658 / 8.0),
- REAL_CONST(106490.71571664025 / 8.0),
- REAL_CONST(106514.80250801529 / 8.0),
- REAL_CONST(106538.89066118775 / 8.0),
- REAL_CONST(106562.98017600364 / 8.0),
- REAL_CONST(106587.07105230905 / 8.0),
- REAL_CONST(106611.16328995011 / 8.0),
- REAL_CONST(106635.25688877302 / 8.0),
- REAL_CONST(106659.35184862395 / 8.0),
- REAL_CONST(106683.44816934918 / 8.0),
- REAL_CONST(106707.54585079502 / 8.0),
- REAL_CONST(106731.64489280782 / 8.0),
- REAL_CONST(106755.74529523395 / 8.0),
- REAL_CONST(106779.84705791986 / 8.0),
- REAL_CONST(106803.95018071201 / 8.0),
- REAL_CONST(106828.05466345693 / 8.0),
- REAL_CONST(106852.16050600118 / 8.0),
- REAL_CONST(106876.26770819137 / 8.0),
- REAL_CONST(106900.37626987413 / 8.0),
- REAL_CONST(106924.48619089619 / 8.0),
- REAL_CONST(106948.59747110425 / 8.0),
- REAL_CONST(106972.71011034511 / 8.0),
- REAL_CONST(106996.82410846559 / 8.0),
- REAL_CONST(107020.93946531253 / 8.0),
- REAL_CONST(107045.05618073288 / 8.0),
- REAL_CONST(107069.17425457356 / 8.0),
- REAL_CONST(107093.29368668159 / 8.0),
- REAL_CONST(107117.41447690397 / 8.0),
- REAL_CONST(107141.53662508781 / 8.0),
- REAL_CONST(107165.66013108024 / 8.0),
- REAL_CONST(107189.7849947284 / 8.0),
- REAL_CONST(107213.91121587952 / 8.0),
- REAL_CONST(107238.03879438085 / 8.0),
- REAL_CONST(107262.16773007967 / 8.0),
- REAL_CONST(107286.29802282334 / 8.0),
- REAL_CONST(107310.42967245923 / 8.0),
- REAL_CONST(107334.56267883476 / 8.0),
- REAL_CONST(107358.69704179741 / 8.0),
- REAL_CONST(107382.83276119467 / 8.0),
- REAL_CONST(107406.96983687414 / 8.0),
- REAL_CONST(107431.10826868335 / 8.0),
- REAL_CONST(107455.24805646999 / 8.0),
- REAL_CONST(107479.38920008171 / 8.0),
- REAL_CONST(107503.53169936626 / 8.0),
- REAL_CONST(107527.67555417139 / 8.0),
- REAL_CONST(107551.82076434491 / 8.0),
- REAL_CONST(107575.96732973469 / 8.0),
- REAL_CONST(107600.11525018861 / 8.0),
- REAL_CONST(107624.26452555459 / 8.0),
- REAL_CONST(107648.41515568066 / 8.0),
- REAL_CONST(107672.56714041479 / 8.0),
- REAL_CONST(107696.72047960508 / 8.0),
- REAL_CONST(107720.87517309963 / 8.0),
- REAL_CONST(107745.03122074658 / 8.0),
- REAL_CONST(107769.18862239413 / 8.0),
- REAL_CONST(107793.34737789053 / 8.0),
- REAL_CONST(107817.50748708403 / 8.0),
- REAL_CONST(107841.66894982298 / 8.0),
- REAL_CONST(107865.83176595572 / 8.0),
- REAL_CONST(107889.99593533068 / 8.0),
- REAL_CONST(107914.16145779629 / 8.0),
- REAL_CONST(107938.32833320105 / 8.0),
- REAL_CONST(107962.49656139348 / 8.0),
- REAL_CONST(107986.66614222217 / 8.0),
- REAL_CONST(108010.83707553572 / 8.0),
- REAL_CONST(108035.00936118282 / 8.0),
- REAL_CONST(108059.18299901215 / 8.0),
- REAL_CONST(108083.35798887245 / 8.0),
- REAL_CONST(108107.53433061253 / 8.0),
- REAL_CONST(108131.71202408121 / 8.0),
- REAL_CONST(108155.89106912735 / 8.0),
- REAL_CONST(108180.07146559987 / 8.0),
- REAL_CONST(108204.25321334775 / 8.0),
- REAL_CONST(108228.43631221994 / 8.0),
- REAL_CONST(108252.62076206553 / 8.0),
- REAL_CONST(108276.80656273357 / 8.0),
- REAL_CONST(108300.99371407321 / 8.0),
- REAL_CONST(108325.18221593359 / 8.0),
- REAL_CONST(108349.37206816394 / 8.0),
- REAL_CONST(108373.56327061349 / 8.0),
- REAL_CONST(108397.75582313156 / 8.0),
- REAL_CONST(108421.94972556747 / 8.0),
- REAL_CONST(108446.1449777706 / 8.0),
- REAL_CONST(108470.34157959036 / 8.0),
- REAL_CONST(108494.53953087622 / 8.0),
- REAL_CONST(108518.73883147769 / 8.0),
- REAL_CONST(108542.93948124432 / 8.0),
- REAL_CONST(108567.14148002568 / 8.0),
- REAL_CONST(108591.34482767139 / 8.0),
- REAL_CONST(108615.54952403114 / 8.0),
- REAL_CONST(108639.75556895464 / 8.0),
- REAL_CONST(108663.96296229165 / 8.0),
- REAL_CONST(108688.17170389196 / 8.0),
- REAL_CONST(108712.38179360541 / 8.0),
- REAL_CONST(108736.59323128188 / 8.0),
- REAL_CONST(108760.80601677128 / 8.0),
- REAL_CONST(108785.02014992358 / 8.0),
- REAL_CONST(108809.23563058881 / 8.0),
- REAL_CONST(108833.45245861699 / 8.0),
- REAL_CONST(108857.67063385822 / 8.0),
- REAL_CONST(108881.89015616261 / 8.0),
- REAL_CONST(108906.11102538036 / 8.0),
- REAL_CONST(108930.33324136167 / 8.0),
- REAL_CONST(108954.55680395682 / 8.0),
- REAL_CONST(108978.78171301607 / 8.0),
- REAL_CONST(109003.00796838976 / 8.0),
- REAL_CONST(109027.23556992831 / 8.0),
- REAL_CONST(109051.46451748211 / 8.0),
- REAL_CONST(109075.69481090162 / 8.0),
- REAL_CONST(109099.92645003737 / 8.0),
- REAL_CONST(109124.15943473989 / 8.0),
- REAL_CONST(109148.39376485976 / 8.0),
- REAL_CONST(109172.62944024763 / 8.0),
- REAL_CONST(109196.86646075416 / 8.0),
- REAL_CONST(109221.10482623006 / 8.0),
- REAL_CONST(109245.34453652608 / 8.0),
- REAL_CONST(109269.58559149304 / 8.0),
- REAL_CONST(109293.82799098175 / 8.0),
- REAL_CONST(109318.07173484311 / 8.0),
- REAL_CONST(109342.31682292801 / 8.0),
- REAL_CONST(109366.56325508743 / 8.0),
- REAL_CONST(109390.81103117237 / 8.0),
- REAL_CONST(109415.06015103387 / 8.0),
- REAL_CONST(109439.31061452301 / 8.0),
- REAL_CONST(109463.56242149093 / 8.0),
- REAL_CONST(109487.8155717888 / 8.0),
- REAL_CONST(109512.07006526781 / 8.0),
- REAL_CONST(109536.3259017792 / 8.0),
- REAL_CONST(109560.58308117429 / 8.0),
- REAL_CONST(109584.8416033044 / 8.0),
- REAL_CONST(109609.1014680209 / 8.0),
- REAL_CONST(109633.36267517522 / 8.0),
- REAL_CONST(109657.62522461878 / 8.0),
- REAL_CONST(109681.88911620311 / 8.0),
- REAL_CONST(109706.15434977971 / 8.0),
- REAL_CONST(109730.4209252002 / 8.0),
- REAL_CONST(109754.68884231619 / 8.0),
- REAL_CONST(109778.95810097932 / 8.0),
- REAL_CONST(109803.22870104131 / 8.0),
- REAL_CONST(109827.50064235389 / 8.0),
- REAL_CONST(109851.77392476884 / 8.0),
- REAL_CONST(109876.04854813802 / 8.0),
- REAL_CONST(109900.32451231324 / 8.0),
- REAL_CONST(109924.60181714644 / 8.0),
- REAL_CONST(109948.88046248957 / 8.0),
- REAL_CONST(109973.1604481946 / 8.0),
- REAL_CONST(109997.44177411357 / 8.0),
- REAL_CONST(110021.72444009855 / 8.0),
- REAL_CONST(110046.00844600165 / 8.0),
- REAL_CONST(110070.29379167501 / 8.0),
- REAL_CONST(110094.58047697082 / 8.0),
- REAL_CONST(110118.86850174134 / 8.0),
- REAL_CONST(110143.15786583882 / 8.0),
- REAL_CONST(110167.44856911557 / 8.0),
- REAL_CONST(110191.74061142397 / 8.0),
- REAL_CONST(110216.03399261639 / 8.0),
- REAL_CONST(110240.32871254528 / 8.0),
- REAL_CONST(110264.62477106311 / 8.0),
- REAL_CONST(110288.9221680224 / 8.0),
- REAL_CONST(110313.22090327571 / 8.0),
- REAL_CONST(110337.52097667565 / 8.0),
- REAL_CONST(110361.82238807483 / 8.0),
- REAL_CONST(110386.12513732594 / 8.0),
- REAL_CONST(110410.42922428172 / 8.0),
- REAL_CONST(110434.73464879491 / 8.0),
- REAL_CONST(110459.04141071832 / 8.0),
- REAL_CONST(110483.34950990479 / 8.0),
- REAL_CONST(110507.6589462072 / 8.0),
- REAL_CONST(110531.96971947847 / 8.0),
- REAL_CONST(110556.28182957157 / 8.0),
- REAL_CONST(110580.5952763395 / 8.0),
- REAL_CONST(110604.91005963532 / 8.0),
- REAL_CONST(110629.22617931209 / 8.0),
- REAL_CONST(110653.54363522294 / 8.0),
- REAL_CONST(110677.86242722106 / 8.0),
- REAL_CONST(110702.18255515963 / 8.0),
- REAL_CONST(110726.50401889188 / 8.0),
- REAL_CONST(110750.82681827113 / 8.0),
- REAL_CONST(110775.1509531507 / 8.0),
- REAL_CONST(110799.47642338395 / 8.0),
- REAL_CONST(110823.80322882428 / 8.0),
- REAL_CONST(110848.13136932514 / 8.0),
- REAL_CONST(110872.46084474004 / 8.0),
- REAL_CONST(110896.79165492248 / 8.0),
- REAL_CONST(110921.12379972603 / 8.0),
- REAL_CONST(110945.4572790043 / 8.0),
- REAL_CONST(110969.79209261097 / 8.0),
- REAL_CONST(110994.12824039967 / 8.0),
- REAL_CONST(111018.46572222417 / 8.0),
- REAL_CONST(111042.80453793822 / 8.0),
- REAL_CONST(111067.14468739564 / 8.0),
- REAL_CONST(111091.48617045028 / 8.0),
- REAL_CONST(111115.82898695602 / 8.0),
- REAL_CONST(111140.1731367668 / 8.0),
- REAL_CONST(111164.51861973655 / 8.0),
- REAL_CONST(111188.86543571933 / 8.0),
- REAL_CONST(111213.21358456917 / 8.0),
- REAL_CONST(111237.56306614014 / 8.0),
- REAL_CONST(111261.91388028639 / 8.0),
- REAL_CONST(111286.26602686207 / 8.0),
- REAL_CONST(111310.61950572141 / 8.0),
- REAL_CONST(111334.97431671864 / 8.0),
- REAL_CONST(111359.33045970804 / 8.0),
- REAL_CONST(111383.68793454397 / 8.0),
- REAL_CONST(111408.04674108078 / 8.0),
- REAL_CONST(111432.40687917286 / 8.0),
- REAL_CONST(111456.76834867468 / 8.0),
- REAL_CONST(111481.13114944073 / 8.0),
- REAL_CONST(111505.49528132551 / 8.0),
- REAL_CONST(111529.86074418361 / 8.0),
- REAL_CONST(111554.22753786964 / 8.0),
- REAL_CONST(111578.59566223821 / 8.0),
- REAL_CONST(111602.96511714405 / 8.0),
- REAL_CONST(111627.33590244185 / 8.0),
- REAL_CONST(111651.7080179864 / 8.0),
- REAL_CONST(111676.08146363248 / 8.0),
- REAL_CONST(111700.45623923496 / 8.0),
- REAL_CONST(111724.8323446487 / 8.0),
- REAL_CONST(111749.20977972864 / 8.0),
- REAL_CONST(111773.58854432974 / 8.0),
- REAL_CONST(111797.96863830699 / 8.0),
- REAL_CONST(111822.35006151545 / 8.0),
- REAL_CONST(111846.73281381019 / 8.0),
- REAL_CONST(111871.11689504632 / 8.0),
- REAL_CONST(111895.50230507903 / 8.0),
- REAL_CONST(111919.8890437635 / 8.0),
- REAL_CONST(111944.27711095495 / 8.0),
- REAL_CONST(111968.6665065087 / 8.0),
- REAL_CONST(111993.05723028004 / 8.0),
- REAL_CONST(112017.44928212435 / 8.0),
- REAL_CONST(112041.842661897 / 8.0),
- REAL_CONST(112066.23736945343 / 8.0),
- REAL_CONST(112090.63340464912 / 8.0),
- REAL_CONST(112115.03076733962 / 8.0),
- REAL_CONST(112139.42945738042 / 8.0),
- REAL_CONST(112163.82947462716 / 8.0),
- REAL_CONST(112188.23081893545 / 8.0),
- REAL_CONST(112212.63349016097 / 8.0),
- REAL_CONST(112237.03748815943 / 8.0),
- REAL_CONST(112261.44281278658 / 8.0),
- REAL_CONST(112285.84946389822 / 8.0),
- REAL_CONST(112310.25744135017 / 8.0),
- REAL_CONST(112334.66674499828 / 8.0),
- REAL_CONST(112359.07737469849 / 8.0),
- REAL_CONST(112383.48933030672 / 8.0),
- REAL_CONST(112407.90261167898 / 8.0),
- REAL_CONST(112432.31721867126 / 8.0),
- REAL_CONST(112456.73315113965 / 8.0),
- REAL_CONST(112481.15040894024 / 8.0),
- REAL_CONST(112505.56899192919 / 8.0),
- REAL_CONST(112529.98889996267 / 8.0),
- REAL_CONST(112554.41013289688 / 8.0),
- REAL_CONST(112578.8326905881 / 8.0),
- REAL_CONST(112603.25657289263 / 8.0),
- REAL_CONST(112627.68177966679 / 8.0),
- REAL_CONST(112652.10831076698 / 8.0),
- REAL_CONST(112676.53616604958 / 8.0),
- REAL_CONST(112700.96534537108 / 8.0),
- REAL_CONST(112725.39584858794 / 8.0),
- REAL_CONST(112749.82767555672 / 8.0),
- REAL_CONST(112774.26082613398 / 8.0),
- REAL_CONST(112798.6953001763 / 8.0),
- REAL_CONST(112823.13109754038 / 8.0),
- REAL_CONST(112847.56821808286 / 8.0),
- REAL_CONST(112872.00666166049 / 8.0),
- REAL_CONST(112896.44642813003 / 8.0),
- REAL_CONST(112920.88751734827 / 8.0),
- REAL_CONST(112945.32992917208 / 8.0),
- REAL_CONST(112969.77366345831 / 8.0),
- REAL_CONST(112994.21872006389 / 8.0),
- REAL_CONST(113018.66509884578 / 8.0),
- REAL_CONST(113043.11279966099 / 8.0),
- REAL_CONST(113067.56182236652 / 8.0),
- REAL_CONST(113092.01216681948 / 8.0),
- REAL_CONST(113116.46383287695 / 8.0),
- REAL_CONST(113140.9168203961 / 8.0),
- REAL_CONST(113165.37112923413 / 8.0),
- REAL_CONST(113189.82675924824 / 8.0),
- REAL_CONST(113214.28371029573 / 8.0),
- REAL_CONST(113238.74198223387 / 8.0),
- REAL_CONST(113263.20157492002 / 8.0),
- REAL_CONST(113287.66248821157 / 8.0),
- REAL_CONST(113312.12472196593 / 8.0),
- REAL_CONST(113336.58827604055 / 8.0),
- REAL_CONST(113361.05315029295 / 8.0),
- REAL_CONST(113385.51934458067 / 8.0),
- REAL_CONST(113409.98685876124 / 8.0),
- REAL_CONST(113434.45569269233 / 8.0),
- REAL_CONST(113458.92584623155 / 8.0),
- REAL_CONST(113483.39731923661 / 8.0),
- REAL_CONST(113507.87011156522 / 8.0),
- REAL_CONST(113532.34422307517 / 8.0),
- REAL_CONST(113556.81965362425 / 8.0),
- REAL_CONST(113581.2964030703 / 8.0),
- REAL_CONST(113605.77447127122 / 8.0),
- REAL_CONST(113630.25385808491 / 8.0),
- REAL_CONST(113654.73456336933 / 8.0),
- REAL_CONST(113679.2165869825 / 8.0),
- REAL_CONST(113703.69992878241 / 8.0),
- REAL_CONST(113728.18458862718 / 8.0),
- REAL_CONST(113752.67056637487 / 8.0),
- REAL_CONST(113777.15786188368 / 8.0),
- REAL_CONST(113801.64647501177 / 8.0),
- REAL_CONST(113826.13640561736 / 8.0),
- REAL_CONST(113850.62765355874 / 8.0),
- REAL_CONST(113875.12021869418 / 8.0),
- REAL_CONST(113899.61410088204 / 8.0),
- REAL_CONST(113924.1092999807 / 8.0),
- REAL_CONST(113948.60581584855 / 8.0),
- REAL_CONST(113973.10364834407 / 8.0),
- REAL_CONST(113997.60279732574 / 8.0),
- REAL_CONST(114022.1032626521 / 8.0),
- REAL_CONST(114046.60504418171 / 8.0),
- REAL_CONST(114071.10814177318 / 8.0),
- REAL_CONST(114095.61255528514 / 8.0),
- REAL_CONST(114120.11828457628 / 8.0),
- REAL_CONST(114144.62532950533 / 8.0),
- REAL_CONST(114169.13368993104 / 8.0),
- REAL_CONST(114193.6433657122 / 8.0),
- REAL_CONST(114218.15435670764 / 8.0),
- REAL_CONST(114242.66666277625 / 8.0),
- REAL_CONST(114267.18028377694 / 8.0),
- REAL_CONST(114291.69521956862 / 8.0),
- REAL_CONST(114316.21147001031 / 8.0),
- REAL_CONST(114340.72903496103 / 8.0),
- REAL_CONST(114365.24791427983 / 8.0),
- REAL_CONST(114389.7681078258 / 8.0),
- REAL_CONST(114414.2896154581 / 8.0),
- REAL_CONST(114438.81243703589 / 8.0),
- REAL_CONST(114463.33657241837 / 8.0),
- REAL_CONST(114487.8620214648 / 8.0),
- REAL_CONST(114512.38878403447 / 8.0),
- REAL_CONST(114536.91685998671 / 8.0),
- REAL_CONST(114561.44624918087 / 8.0),
- REAL_CONST(114585.97695147636 / 8.0),
- REAL_CONST(114610.5089667326 / 8.0),
- REAL_CONST(114635.04229480909 / 8.0),
- REAL_CONST(114659.57693556532 / 8.0),
- REAL_CONST(114684.11288886084 / 8.0),
- REAL_CONST(114708.65015455526 / 8.0),
- REAL_CONST(114733.18873250818 / 8.0),
- REAL_CONST(114757.72862257928 / 8.0),
- REAL_CONST(114782.26982462825 / 8.0),
- REAL_CONST(114806.81233851484 / 8.0),
- REAL_CONST(114831.35616409882 / 8.0),
- REAL_CONST(114855.90130123998 / 8.0),
- REAL_CONST(114880.44774979822 / 8.0),
- REAL_CONST(114904.99550963337 / 8.0),
- REAL_CONST(114929.5445806054 / 8.0),
- REAL_CONST(114954.09496257425 / 8.0),
- REAL_CONST(114978.64665539992 / 8.0),
- REAL_CONST(115003.19965894247 / 8.0),
- REAL_CONST(115027.75397306195 / 8.0),
- REAL_CONST(115052.30959761847 / 8.0),
- REAL_CONST(115076.86653247218 / 8.0),
- REAL_CONST(115101.42477748329 / 8.0),
- REAL_CONST(115125.984332512 / 8.0),
- REAL_CONST(115150.54519741859 / 8.0),
- REAL_CONST(115175.10737206334 / 8.0),
- REAL_CONST(115199.67085630659 / 8.0),
- REAL_CONST(115224.23565000873 / 8.0),
- REAL_CONST(115248.80175303014 / 8.0),
- REAL_CONST(115273.3691652313 / 8.0),
- REAL_CONST(115297.93788647266 / 8.0),
- REAL_CONST(115322.50791661476 / 8.0),
- REAL_CONST(115347.07925551817 / 8.0),
- REAL_CONST(115371.65190304347 / 8.0),
- REAL_CONST(115396.22585905129 / 8.0),
- REAL_CONST(115420.80112340231 / 8.0),
- REAL_CONST(115445.37769595724 / 8.0),
- REAL_CONST(115469.95557657682 / 8.0),
- REAL_CONST(115494.53476512182 / 8.0),
- REAL_CONST(115519.11526145306 / 8.0),
- REAL_CONST(115543.69706543141 / 8.0),
- REAL_CONST(115568.28017691776 / 8.0),
- REAL_CONST(115592.86459577303 / 8.0),
- REAL_CONST(115617.4503218582 / 8.0),
- REAL_CONST(115642.03735503425 / 8.0),
- REAL_CONST(115666.62569516223 / 8.0),
- REAL_CONST(115691.21534210323 / 8.0),
- REAL_CONST(115715.80629571836 / 8.0),
- REAL_CONST(115740.39855586876 / 8.0),
- REAL_CONST(115764.99212241563 / 8.0),
- REAL_CONST(115789.58699522018 / 8.0),
- REAL_CONST(115814.18317414368 / 8.0),
- REAL_CONST(115838.78065904744 / 8.0),
- REAL_CONST(115863.37944979276 / 8.0),
- REAL_CONST(115887.97954624105 / 8.0),
- REAL_CONST(115912.5809482537 / 8.0),
- REAL_CONST(115937.18365569216 / 8.0),
- REAL_CONST(115961.78766841792 / 8.0),
- REAL_CONST(115986.39298629249 / 8.0),
- REAL_CONST(116010.99960917742 / 8.0),
- REAL_CONST(116035.60753693432 / 8.0),
- REAL_CONST(116060.21676942479 / 8.0),
- REAL_CONST(116084.82730651053 / 8.0),
- REAL_CONST(116109.43914805322 / 8.0),
- REAL_CONST(116134.0522939146 / 8.0),
- REAL_CONST(116158.66674395646 / 8.0),
- REAL_CONST(116183.2824980406 / 8.0),
- REAL_CONST(116207.89955602887 / 8.0),
- REAL_CONST(116232.51791778316 / 8.0),
- REAL_CONST(116257.13758316539 / 8.0),
- REAL_CONST(116281.75855203751 / 8.0),
- REAL_CONST(116306.38082426153 / 8.0),
- REAL_CONST(116331.00439969949 / 8.0),
- REAL_CONST(116355.62927821343 / 8.0),
- REAL_CONST(116380.25545966547 / 8.0),
- REAL_CONST(116404.88294391775 / 8.0),
- REAL_CONST(116429.51173083246 / 8.0),
- REAL_CONST(116454.14182027178 / 8.0),
- REAL_CONST(116478.77321209799 / 8.0),
- REAL_CONST(116503.40590617337 / 8.0),
- REAL_CONST(116528.03990236025 / 8.0),
- REAL_CONST(116552.67520052097 / 8.0),
- REAL_CONST(116577.31180051794 / 8.0),
- REAL_CONST(116601.94970221359 / 8.0),
- REAL_CONST(116626.5889054704 / 8.0),
- REAL_CONST(116651.22941015086 / 8.0),
- REAL_CONST(116675.87121611751 / 8.0),
- REAL_CONST(116700.51432323294 / 8.0),
- REAL_CONST(116725.15873135976 / 8.0),
- REAL_CONST(116749.8044403606 / 8.0),
- REAL_CONST(116774.45145009817 / 8.0),
- REAL_CONST(116799.0997604352 / 8.0),
- REAL_CONST(116823.74937123443 / 8.0),
- REAL_CONST(116848.40028235866 / 8.0),
- REAL_CONST(116873.05249367072 / 8.0),
- REAL_CONST(116897.70600503348 / 8.0),
- REAL_CONST(116922.36081630984 / 8.0),
- REAL_CONST(116947.01692736275 / 8.0),
- REAL_CONST(116971.67433805518 / 8.0),
- REAL_CONST(116996.33304825013 / 8.0),
- REAL_CONST(117020.99305781067 / 8.0),
- REAL_CONST(117045.65436659988 / 8.0),
- REAL_CONST(117070.31697448085 / 8.0),
- REAL_CONST(117094.98088131678 / 8.0),
- REAL_CONST(117119.64608697082 / 8.0),
- REAL_CONST(117144.31259130624 / 8.0),
- REAL_CONST(117168.98039418629 / 8.0),
- REAL_CONST(117193.64949547425 / 8.0),
- REAL_CONST(117218.31989503348 / 8.0),
- REAL_CONST(117242.99159272734 / 8.0),
- REAL_CONST(117267.66458841923 / 8.0),
- REAL_CONST(117292.33888197262 / 8.0),
- REAL_CONST(117317.01447325097 / 8.0),
- REAL_CONST(117341.6913621178 / 8.0),
- REAL_CONST(117366.36954843666 / 8.0),
- REAL_CONST(117391.04903207115 / 8.0),
- REAL_CONST(117415.72981288488 / 8.0),
- REAL_CONST(117440.41189074152 / 8.0),
- REAL_CONST(117465.09526550474 / 8.0),
- REAL_CONST(117489.77993703831 / 8.0),
- REAL_CONST(117514.46590520597 / 8.0),
- REAL_CONST(117539.15316987153 / 8.0),
- REAL_CONST(117563.84173089883 / 8.0),
- REAL_CONST(117588.53158815173 / 8.0),
- REAL_CONST(117613.22274149416 / 8.0),
- REAL_CONST(117637.91519079007 / 8.0),
- REAL_CONST(117662.60893590341 / 8.0),
- REAL_CONST(117687.30397669821 / 8.0),
- REAL_CONST(117712.00031303853 / 8.0),
- REAL_CONST(117736.69794478847 / 8.0),
- REAL_CONST(117761.39687181212 / 8.0),
- REAL_CONST(117786.09709397367 / 8.0),
- REAL_CONST(117810.7986111373 / 8.0),
- REAL_CONST(117835.50142316725 / 8.0),
- REAL_CONST(117860.20552992777 / 8.0),
- REAL_CONST(117884.91093128319 / 8.0),
- REAL_CONST(117909.6176270978 / 8.0),
- REAL_CONST(117934.32561723603 / 8.0),
- REAL_CONST(117959.03490156225 / 8.0),
- REAL_CONST(117983.74547994092 / 8.0),
- REAL_CONST(118008.45735223651 / 8.0),
- REAL_CONST(118033.17051831353 / 8.0),
- REAL_CONST(118057.88497803656 / 8.0),
- REAL_CONST(118082.60073127014 / 8.0),
- REAL_CONST(118107.31777787894 / 8.0),
- REAL_CONST(118132.03611772758 / 8.0),
- REAL_CONST(118156.75575068076 / 8.0),
- REAL_CONST(118181.47667660323 / 8.0),
- REAL_CONST(118206.19889535972 / 8.0),
- REAL_CONST(118230.92240681504 / 8.0),
- REAL_CONST(118255.64721083404 / 8.0),
- REAL_CONST(118280.37330728157 / 8.0),
- REAL_CONST(118305.10069602253 / 8.0),
- REAL_CONST(118329.82937692189 / 8.0),
- REAL_CONST(118354.55934984458 / 8.0),
- REAL_CONST(118379.29061465565 / 8.0),
- REAL_CONST(118404.02317122012 / 8.0),
- REAL_CONST(118428.75701940308 / 8.0),
- REAL_CONST(118453.49215906965 / 8.0),
- REAL_CONST(118478.22859008498 / 8.0),
- REAL_CONST(118502.96631231424 / 8.0),
- REAL_CONST(118527.70532562268 / 8.0),
- REAL_CONST(118552.44562987552 / 8.0),
- REAL_CONST(118577.18722493808 / 8.0),
- REAL_CONST(118601.93011067568 / 8.0),
- REAL_CONST(118626.67428695368 / 8.0),
- REAL_CONST(118651.41975363747 / 8.0),
- REAL_CONST(118676.16651059251 / 8.0),
- REAL_CONST(118700.91455768423 / 8.0),
- REAL_CONST(118725.66389477813 / 8.0),
- REAL_CONST(118750.41452173979 / 8.0),
- REAL_CONST(118775.16643843475 / 8.0),
- REAL_CONST(118799.91964472862 / 8.0),
- REAL_CONST(118824.67414048707 / 8.0),
- REAL_CONST(118849.42992557574 / 8.0),
- REAL_CONST(118874.18699986035 / 8.0),
- REAL_CONST(118898.94536320666 / 8.0),
- REAL_CONST(118923.70501548045 / 8.0),
- REAL_CONST(118948.46595654752 / 8.0),
- REAL_CONST(118973.22818627374 / 8.0),
- REAL_CONST(118997.99170452499 / 8.0),
- REAL_CONST(119022.7565111672 / 8.0),
- REAL_CONST(119047.52260606633 / 8.0),
- REAL_CONST(119072.28998908834 / 8.0),
- REAL_CONST(119097.0586600993 / 8.0),
- REAL_CONST(119121.82861896523 / 8.0),
- REAL_CONST(119146.59986555226 / 8.0),
- REAL_CONST(119171.3723997265 / 8.0),
- REAL_CONST(119196.14622135412 / 8.0),
- REAL_CONST(119220.92133030134 / 8.0),
- REAL_CONST(119245.69772643436 / 8.0),
- REAL_CONST(119270.47540961947 / 8.0),
- REAL_CONST(119295.25437972297 / 8.0),
- REAL_CONST(119320.03463661121 / 8.0),
- REAL_CONST(119344.81618015055 / 8.0),
- REAL_CONST(119369.5990102074 / 8.0),
- REAL_CONST(119394.38312664822 / 8.0),
- REAL_CONST(119419.16852933947 / 8.0),
- REAL_CONST(119443.95521814766 / 8.0),
- REAL_CONST(119468.74319293935 / 8.0),
- REAL_CONST(119493.53245358112 / 8.0),
- REAL_CONST(119518.32299993958 / 8.0),
- REAL_CONST(119543.11483188139 / 8.0),
- REAL_CONST(119567.90794927324 / 8.0),
- REAL_CONST(119592.70235198183 / 8.0),
- REAL_CONST(119617.49803987393 / 8.0),
- REAL_CONST(119642.29501281632 / 8.0),
- REAL_CONST(119667.09327067583 / 8.0),
- REAL_CONST(119691.89281331931 / 8.0),
- REAL_CONST(119716.69364061367 / 8.0),
- REAL_CONST(119741.49575242582 / 8.0),
- REAL_CONST(119766.29914862274 / 8.0),
- REAL_CONST(119791.10382907141 / 8.0),
- REAL_CONST(119815.90979363887 / 8.0),
- REAL_CONST(119840.71704219218 / 8.0),
- REAL_CONST(119865.52557459843 / 8.0),
- REAL_CONST(119890.33539072477 / 8.0),
- REAL_CONST(119915.14649043836 / 8.0),
- REAL_CONST(119939.95887360642 / 8.0),
- REAL_CONST(119964.77254009615 / 8.0),
- REAL_CONST(119989.58748977486 / 8.0),
- REAL_CONST(120014.40372250983 / 8.0),
- REAL_CONST(120039.22123816841 / 8.0),
- REAL_CONST(120064.04003661797 / 8.0),
- REAL_CONST(120088.86011772591 / 8.0),
- REAL_CONST(120113.6814813597 / 8.0),
- REAL_CONST(120138.5041273868 / 8.0),
- REAL_CONST(120163.3280556747 / 8.0),
- REAL_CONST(120188.15326609099 / 8.0),
- REAL_CONST(120212.97975850321 / 8.0),
- REAL_CONST(120237.807532779 / 8.0),
- REAL_CONST(120262.63658878599 / 8.0),
- REAL_CONST(120287.46692639188 / 8.0),
- REAL_CONST(120312.29854546436 / 8.0),
- REAL_CONST(120337.13144587121 / 8.0),
- REAL_CONST(120361.9656274802 / 8.0),
- REAL_CONST(120386.80109015915 / 8.0),
- REAL_CONST(120411.63783377589 / 8.0),
- REAL_CONST(120436.47585819835 / 8.0),
- REAL_CONST(120461.31516329442 / 8.0),
- REAL_CONST(120486.15574893207 / 8.0),
- REAL_CONST(120510.99761497928 / 8.0),
- REAL_CONST(120535.84076130406 / 8.0),
- REAL_CONST(120560.68518777451 / 8.0),
- REAL_CONST(120585.53089425867 / 8.0),
- REAL_CONST(120610.3778806247 / 8.0),
- REAL_CONST(120635.22614674074 / 8.0),
- REAL_CONST(120660.07569247499 / 8.0),
- REAL_CONST(120684.92651769568 / 8.0),
- REAL_CONST(120709.77862227106 / 8.0),
- REAL_CONST(120734.63200606944 / 8.0),
- REAL_CONST(120759.48666895913 / 8.0),
- REAL_CONST(120784.3426108085 / 8.0),
- REAL_CONST(120809.19983148595 / 8.0),
- REAL_CONST(120834.05833085992 / 8.0),
- REAL_CONST(120858.91810879884 / 8.0),
- REAL_CONST(120883.77916517125 / 8.0),
- REAL_CONST(120908.64149984565 / 8.0),
- REAL_CONST(120933.5051126906 / 8.0),
- REAL_CONST(120958.37000357473 / 8.0),
- REAL_CONST(120983.23617236665 / 8.0),
- REAL_CONST(121008.10361893504 / 8.0),
- REAL_CONST(121032.97234314861 / 8.0),
- REAL_CONST(121057.84234487606 / 8.0),
- REAL_CONST(121082.71362398617 / 8.0),
- REAL_CONST(121107.58618034775 / 8.0),
- REAL_CONST(121132.46001382964 / 8.0),
- REAL_CONST(121157.33512430069 / 8.0),
- REAL_CONST(121182.21151162982 / 8.0),
- REAL_CONST(121207.08917568595 / 8.0),
- REAL_CONST(121231.96811633807 / 8.0),
- REAL_CONST(121256.84833345517 / 8.0),
- REAL_CONST(121281.72982690629 / 8.0),
- REAL_CONST(121306.61259656049 / 8.0),
- REAL_CONST(121331.49664228689 / 8.0),
- REAL_CONST(121356.38196395461 / 8.0),
- REAL_CONST(121381.26856143285 / 8.0),
- REAL_CONST(121406.15643459078 / 8.0),
- REAL_CONST(121431.04558329767 / 8.0),
- REAL_CONST(121455.93600742276 / 8.0),
- REAL_CONST(121480.82770683538 / 8.0),
- REAL_CONST(121505.72068140487 / 8.0),
- REAL_CONST(121530.61493100057 / 8.0),
- REAL_CONST(121555.51045549192 / 8.0),
- REAL_CONST(121580.40725474835 / 8.0),
- REAL_CONST(121605.30532863933 / 8.0),
- REAL_CONST(121630.20467703436 / 8.0),
- REAL_CONST(121655.10529980299 / 8.0),
- REAL_CONST(121680.00719681478 / 8.0),
- REAL_CONST(121704.91036793934 / 8.0),
- REAL_CONST(121729.81481304632 / 8.0),
- REAL_CONST(121754.72053200539 / 8.0),
- REAL_CONST(121779.62752468624 / 8.0),
- REAL_CONST(121804.53579095862 / 8.0),
- REAL_CONST(121829.44533069231 / 8.0),
- REAL_CONST(121854.3561437571 / 8.0),
- REAL_CONST(121879.26823002285 / 8.0),
- REAL_CONST(121904.1815893594 / 8.0),
- REAL_CONST(121929.09622163669 / 8.0),
- REAL_CONST(121954.01212672464 / 8.0),
- REAL_CONST(121978.92930449323 / 8.0),
- REAL_CONST(122003.84775481246 / 8.0),
- REAL_CONST(122028.76747755238 / 8.0),
- REAL_CONST(122053.68847258303 / 8.0),
- REAL_CONST(122078.61073977455 / 8.0),
- REAL_CONST(122103.53427899707 / 8.0),
- REAL_CONST(122128.45909012076 / 8.0),
- REAL_CONST(122153.38517301581 / 8.0),
- REAL_CONST(122178.31252755247 / 8.0),
- REAL_CONST(122203.24115360099 / 8.0),
- REAL_CONST(122228.17105103172 / 8.0),
- REAL_CONST(122253.10221971494 / 8.0),
- REAL_CONST(122278.03465952107 / 8.0),
- REAL_CONST(122302.96837032049 / 8.0),
- REAL_CONST(122327.90335198362 / 8.0),
- REAL_CONST(122352.83960438096 / 8.0),
- REAL_CONST(122377.777127383 / 8.0),
- REAL_CONST(122402.71592086025 / 8.0),
- REAL_CONST(122427.65598468333 / 8.0),
- REAL_CONST(122452.59731872278 / 8.0),
- REAL_CONST(122477.53992284928 / 8.0),
- REAL_CONST(122502.48379693348 / 8.0),
- REAL_CONST(122527.42894084606 / 8.0),
- REAL_CONST(122552.37535445779 / 8.0),
- REAL_CONST(122577.32303763942 / 8.0),
- REAL_CONST(122602.27199026172 / 8.0),
- REAL_CONST(122627.22221219557 / 8.0),
- REAL_CONST(122652.17370331181 / 8.0),
- REAL_CONST(122677.12646348133 / 8.0),
- REAL_CONST(122702.08049257506 / 8.0),
- REAL_CONST(122727.03579046397 / 8.0),
- REAL_CONST(122751.99235701906 / 8.0),
- REAL_CONST(122776.95019211136 / 8.0),
- REAL_CONST(122801.9092956119 / 8.0),
- REAL_CONST(122826.8696673918 / 8.0),
- REAL_CONST(122851.83130732219 / 8.0),
- REAL_CONST(122876.79421527422 / 8.0),
- REAL_CONST(122901.75839111909 / 8.0),
- REAL_CONST(122926.72383472799 / 8.0),
- REAL_CONST(122951.69054597223 / 8.0),
- REAL_CONST(122976.65852472307 / 8.0),
- REAL_CONST(123001.62777085182 / 8.0),
- REAL_CONST(123026.59828422987 / 8.0),
- REAL_CONST(123051.57006472857 / 8.0),
- REAL_CONST(123076.54311221937 / 8.0),
- REAL_CONST(123101.5174265737 / 8.0),
- REAL_CONST(123126.49300766307 / 8.0),
- REAL_CONST(123151.46985535898 / 8.0),
- REAL_CONST(123176.44796953299 / 8.0),
- REAL_CONST(123201.42735005668 / 8.0),
- REAL_CONST(123226.40799680166 / 8.0),
- REAL_CONST(123251.38990963959 / 8.0),
- REAL_CONST(123276.37308844214 / 8.0),
- REAL_CONST(123301.35753308103 / 8.0),
- REAL_CONST(123326.343243428 / 8.0),
- REAL_CONST(123351.33021935483 / 8.0),
- REAL_CONST(123376.31846073334 / 8.0),
- REAL_CONST(123401.30796743535 / 8.0),
- REAL_CONST(123426.29873933276 / 8.0),
- REAL_CONST(123451.29077629748 / 8.0),
- REAL_CONST(123476.28407820144 / 8.0),
- REAL_CONST(123501.2786449166 / 8.0),
- REAL_CONST(123526.27447631498 / 8.0),
- REAL_CONST(123551.27157226863 / 8.0),
- REAL_CONST(123576.26993264959 / 8.0),
- REAL_CONST(123601.26955732999 / 8.0),
- REAL_CONST(123626.27044618195 / 8.0),
- REAL_CONST(123651.27259907764 / 8.0),
- REAL_CONST(123676.27601588926 / 8.0),
- REAL_CONST(123701.28069648903 / 8.0),
- REAL_CONST(123726.28664074924 / 8.0),
- REAL_CONST(123751.29384854218 / 8.0),
- REAL_CONST(123776.30231974016 / 8.0),
- REAL_CONST(123801.31205421555 / 8.0),
- REAL_CONST(123826.32305184075 / 8.0),
- REAL_CONST(123851.33531248817 / 8.0),
- REAL_CONST(123876.34883603029 / 8.0),
- REAL_CONST(123901.36362233957 / 8.0),
- REAL_CONST(123926.37967128855 / 8.0),
- REAL_CONST(123951.39698274979 / 8.0),
- REAL_CONST(123976.41555659588 / 8.0),
- REAL_CONST(124001.43539269941 / 8.0),
- REAL_CONST(124026.45649093305 / 8.0),
- REAL_CONST(124051.47885116948 / 8.0),
- REAL_CONST(124076.50247328142 / 8.0),
- REAL_CONST(124101.5273571416 / 8.0),
- REAL_CONST(124126.55350262282 / 8.0),
- REAL_CONST(124151.58090959788 / 8.0),
- REAL_CONST(124176.60957793961 / 8.0),
- REAL_CONST(124201.63950752091 / 8.0),
- REAL_CONST(124226.67069821467 / 8.0),
- REAL_CONST(124251.70314989384 / 8.0),
- REAL_CONST(124276.73686243138 / 8.0),
- REAL_CONST(124301.7718357003 / 8.0),
- REAL_CONST(124326.80806957364 / 8.0),
- REAL_CONST(124351.84556392446 / 8.0),
- REAL_CONST(124376.88431862585 / 8.0),
- REAL_CONST(124401.92433355095 / 8.0),
- REAL_CONST(124426.96560857294 / 8.0),
- REAL_CONST(124452.00814356498 / 8.0),
- REAL_CONST(124477.05193840031 / 8.0),
- REAL_CONST(124502.0969929522 / 8.0),
- REAL_CONST(124527.14330709392 / 8.0),
- REAL_CONST(124552.19088069882 / 8.0),
- REAL_CONST(124577.23971364023 / 8.0),
- REAL_CONST(124602.28980579154 / 8.0),
- REAL_CONST(124627.34115702618 / 8.0),
- REAL_CONST(124652.3937672176 / 8.0),
- REAL_CONST(124677.44763623926 / 8.0),
- REAL_CONST(124702.50276396469 / 8.0),
- REAL_CONST(124727.55915026742 / 8.0),
- REAL_CONST(124752.61679502104 / 8.0),
- REAL_CONST(124777.67569809916 / 8.0),
- REAL_CONST(124802.73585937542 / 8.0),
- REAL_CONST(124827.79727872348 / 8.0),
- REAL_CONST(124852.85995601704 / 8.0),
- REAL_CONST(124877.92389112986 / 8.0),
- REAL_CONST(124902.98908393568 / 8.0),
- REAL_CONST(124928.05553430831 / 8.0),
- REAL_CONST(124953.1232421216 / 8.0),
- REAL_CONST(124978.19220724938 / 8.0),
- REAL_CONST(125003.26242956554 / 8.0),
- REAL_CONST(125028.33390894404 / 8.0),
- REAL_CONST(125053.40664525882 / 8.0),
- REAL_CONST(125078.48063838384 / 8.0),
- REAL_CONST(125103.55588819318 / 8.0),
- REAL_CONST(125128.63239456083 / 8.0),
- REAL_CONST(125153.71015736091 / 8.0),
- REAL_CONST(125178.78917646752 / 8.0),
- REAL_CONST(125203.86945175481 / 8.0),
- REAL_CONST(125228.95098309696 / 8.0),
- REAL_CONST(125254.03377036817 / 8.0),
- REAL_CONST(125279.1178134427 / 8.0),
- REAL_CONST(125304.20311219479 / 8.0),
- REAL_CONST(125329.28966649878 / 8.0),
- REAL_CONST(125354.37747622898 / 8.0),
- REAL_CONST(125379.46654125977 / 8.0),
- REAL_CONST(125404.55686146552 / 8.0),
- REAL_CONST(125429.6484367207 / 8.0),
- REAL_CONST(125454.74126689974 / 8.0),
- REAL_CONST(125479.83535187715 / 8.0),
- REAL_CONST(125504.93069152744 / 8.0),
- REAL_CONST(125530.02728572517 / 8.0),
- REAL_CONST(125555.12513434493 / 8.0),
- REAL_CONST(125580.22423726133 / 8.0),
- REAL_CONST(125605.32459434902 / 8.0),
- REAL_CONST(125630.4262054827 / 8.0),
- REAL_CONST(125655.52907053704 / 8.0),
- REAL_CONST(125680.63318938682 / 8.0),
- REAL_CONST(125705.73856190679 / 8.0),
- REAL_CONST(125730.84518797178 / 8.0),
- REAL_CONST(125755.9530674566 / 8.0),
- REAL_CONST(125781.06220023613 / 8.0),
- REAL_CONST(125806.17258618528 / 8.0),
- REAL_CONST(125831.28422517896 / 8.0),
- REAL_CONST(125856.39711709213 / 8.0),
- REAL_CONST(125881.51126179981 / 8.0),
- REAL_CONST(125906.62665917698 / 8.0),
- REAL_CONST(125931.74330909875 / 8.0),
- REAL_CONST(125956.86121144016 / 8.0),
- REAL_CONST(125981.98036607634 / 8.0),
- REAL_CONST(126007.10077288245 / 8.0),
- REAL_CONST(126032.22243173365 / 8.0),
- REAL_CONST(126057.34534250517 / 8.0),
- REAL_CONST(126082.46950507225 / 8.0),
- REAL_CONST(126107.59491931014 / 8.0),
- REAL_CONST(126132.72158509417 / 8.0),
- REAL_CONST(126157.84950229966 / 8.0),
- REAL_CONST(126182.97867080198 / 8.0),
- REAL_CONST(126208.10909047653 / 8.0),
- REAL_CONST(126233.24076119871 / 8.0),
- REAL_CONST(126258.37368284403 / 8.0),
- REAL_CONST(126283.50785528794 / 8.0),
- REAL_CONST(126308.64327840599 / 8.0),
- REAL_CONST(126333.77995207369 / 8.0),
- REAL_CONST(126358.91787616667 / 8.0),
- REAL_CONST(126384.0570505605 / 8.0),
- REAL_CONST(126409.19747513086 / 8.0),
- REAL_CONST(126434.3391497534 / 8.0),
- REAL_CONST(126459.48207430386 / 8.0),
- REAL_CONST(126484.62624865794 / 8.0),
- REAL_CONST(126509.77167269142 / 8.0),
- REAL_CONST(126534.9183462801 / 8.0),
- REAL_CONST(126560.06626929982 / 8.0),
- REAL_CONST(126585.21544162642 / 8.0),
- REAL_CONST(126610.36586313581 / 8.0),
- REAL_CONST(126635.51753370393 / 8.0),
- REAL_CONST(126660.67045320668 / 8.0),
- REAL_CONST(126685.82462152008 / 8.0),
- REAL_CONST(126710.98003852014 / 8.0),
- REAL_CONST(126736.13670408291 / 8.0),
- REAL_CONST(126761.29461808444 / 8.0),
- REAL_CONST(126786.45378040087 / 8.0),
- REAL_CONST(126811.61419090834 / 8.0),
- REAL_CONST(126836.77584948298 / 8.0),
- REAL_CONST(126861.93875600102 / 8.0),
- REAL_CONST(126887.10291033868 / 8.0),
- REAL_CONST(126912.26831237224 / 8.0),
- REAL_CONST(126937.43496197795 / 8.0),
- REAL_CONST(126962.60285903217 / 8.0),
- REAL_CONST(126987.77200341123 / 8.0),
- REAL_CONST(127012.94239499152 / 8.0),
- REAL_CONST(127038.11403364947 / 8.0),
- REAL_CONST(127063.2869192615 / 8.0),
- REAL_CONST(127088.46105170409 / 8.0),
- REAL_CONST(127113.63643085376 / 8.0),
- REAL_CONST(127138.81305658702 / 8.0),
- REAL_CONST(127163.99092878048 / 8.0),
- REAL_CONST(127189.17004731069 / 8.0),
- REAL_CONST(127214.35041205429 / 8.0),
- REAL_CONST(127239.53202288797 / 8.0),
- REAL_CONST(127264.71487968838 / 8.0),
- REAL_CONST(127289.89898233226 / 8.0),
- REAL_CONST(127315.08433069635 / 8.0),
- REAL_CONST(127340.27092465744 / 8.0),
- REAL_CONST(127365.45876409234 / 8.0),
- REAL_CONST(127390.64784887788 / 8.0),
- REAL_CONST(127415.83817889093 / 8.0),
- REAL_CONST(127441.02975400841 / 8.0),
- REAL_CONST(127466.22257410725 / 8.0),
- REAL_CONST(127491.41663906439 / 8.0),
- REAL_CONST(127516.61194875685 / 8.0),
- REAL_CONST(127541.80850306165 / 8.0),
- REAL_CONST(127567.00630185583 / 8.0),
- REAL_CONST(127592.20534501647 / 8.0),
- REAL_CONST(127617.4056324207 / 8.0),
- REAL_CONST(127642.60716394568 / 8.0),
- REAL_CONST(127667.80993946856 / 8.0),
- REAL_CONST(127693.01395886653 / 8.0),
- REAL_CONST(127718.21922201688 / 8.0),
- REAL_CONST(127743.42572879682 / 8.0),
- REAL_CONST(127768.63347908368 / 8.0),
- REAL_CONST(127793.84247275478 / 8.0),
- REAL_CONST(127819.05270968749 / 8.0),
- REAL_CONST(127844.26418975917 / 8.0),
- REAL_CONST(127869.47691284724 / 8.0),
- REAL_CONST(127894.69087882918 / 8.0),
- REAL_CONST(127919.90608758242 / 8.0),
- REAL_CONST(127945.12253898452 / 8.0),
- REAL_CONST(127970.34023291297 / 8.0),
- REAL_CONST(127995.55916924537 / 8.0),
- REAL_CONST(128020.77934785932 / 8.0),
- REAL_CONST(128046.00076863244 / 8.0),
- REAL_CONST(128071.22343144237 / 8.0),
- REAL_CONST(128096.44733616684 / 8.0),
- REAL_CONST(128121.67248268353 / 8.0),
- REAL_CONST(128146.89887087021 / 8.0),
- REAL_CONST(128172.12650060465 / 8.0),
- REAL_CONST(128197.35537176467 / 8.0),
- REAL_CONST(128222.5854842281 / 8.0),
- REAL_CONST(128247.81683787282 / 8.0),
- REAL_CONST(128273.04943257671 / 8.0),
- REAL_CONST(128298.28326821771 / 8.0),
- REAL_CONST(128323.51834467379 / 8.0),
- REAL_CONST(128348.75466182294 / 8.0),
- REAL_CONST(128373.99221954317 / 8.0),
- REAL_CONST(128399.23101771252 / 8.0),
- REAL_CONST(128424.47105620909 / 8.0),
- REAL_CONST(128449.71233491098 / 8.0),
- REAL_CONST(128474.95485369631 / 8.0),
- REAL_CONST(128500.19861244329 / 8.0),
- REAL_CONST(128525.44361103009 / 8.0),
- REAL_CONST(128550.68984933494 / 8.0),
- REAL_CONST(128575.93732723613 / 8.0),
- REAL_CONST(128601.18604461191 / 8.0),
- REAL_CONST(128626.43600134061 / 8.0),
- REAL_CONST(128651.68719730059 / 8.0),
- REAL_CONST(128676.93963237021 / 8.0),
- REAL_CONST(128702.1933064279 / 8.0),
- REAL_CONST(128727.44821935208 / 8.0),
- REAL_CONST(128752.70437102125 / 8.0),
- REAL_CONST(128777.96176131385 / 8.0),
- REAL_CONST(128803.22039010846 / 8.0),
- REAL_CONST(128828.48025728362 / 8.0),
- REAL_CONST(128853.74136271792 / 8.0),
- REAL_CONST(128879.00370628996 / 8.0),
- REAL_CONST(128904.26728787841 / 8.0),
- REAL_CONST(128929.53210736193 / 8.0),
- REAL_CONST(128954.79816461923 / 8.0),
- REAL_CONST(128980.06545952905 / 8.0),
- REAL_CONST(129005.33399197015 / 8.0),
- REAL_CONST(129030.60376182134 / 8.0),
- REAL_CONST(129055.87476896142 / 8.0),
- REAL_CONST(129081.14701326926 / 8.0),
- REAL_CONST(129106.42049462376 / 8.0),
- REAL_CONST(129131.6952129038 / 8.0),
- REAL_CONST(129156.97116798835 / 8.0),
- REAL_CONST(129182.24835975636 / 8.0),
- REAL_CONST(129207.52678808685 / 8.0),
- REAL_CONST(129232.80645285884 / 8.0),
- REAL_CONST(129258.08735395141 / 8.0),
- REAL_CONST(129283.36949124365 / 8.0),
- REAL_CONST(129308.65286461466 / 8.0),
- REAL_CONST(129333.9374739436 / 8.0),
- REAL_CONST(129359.22331910966 / 8.0),
- REAL_CONST(129384.51039999202 / 8.0),
- REAL_CONST(129409.79871646997 / 8.0),
- REAL_CONST(129435.08826842274 / 8.0),
- REAL_CONST(129460.37905572963 / 8.0),
- REAL_CONST(129485.67107826998 / 8.0),
- REAL_CONST(129510.96433592314 / 8.0),
- REAL_CONST(129536.25882856851 / 8.0),
- REAL_CONST(129561.55455608548 / 8.0),
- REAL_CONST(129586.85151835352 / 8.0),
- REAL_CONST(129612.14971525209 / 8.0),
- REAL_CONST(129637.4491466607 / 8.0),
- REAL_CONST(129662.74981245887 / 8.0),
- REAL_CONST(129688.0517125262 / 8.0),
- REAL_CONST(129713.35484674224 / 8.0),
- REAL_CONST(129738.65921498663 / 8.0),
- REAL_CONST(129763.96481713903 / 8.0),
- REAL_CONST(129789.27165307909 / 8.0),
- REAL_CONST(129814.57972268655 / 8.0),
- REAL_CONST(129839.88902584116 / 8.0),
- REAL_CONST(129865.19956242264 / 8.0),
- REAL_CONST(129890.51133231082 / 8.0),
- REAL_CONST(129915.82433538554 / 8.0),
- REAL_CONST(129941.13857152662 / 8.0),
- REAL_CONST(129966.45404061397 / 8.0),
- REAL_CONST(129991.7707425275 / 8.0),
- REAL_CONST(130017.08867714716 / 8.0),
- REAL_CONST(130042.4078443529 / 8.0),
- REAL_CONST(130067.72824402474 / 8.0),
- REAL_CONST(130093.04987604271 / 8.0),
- REAL_CONST(130118.37274028687 / 8.0),
- REAL_CONST(130143.69683663732 / 8.0),
- REAL_CONST(130169.02216497416 / 8.0),
- REAL_CONST(130194.34872517755 / 8.0),
- REAL_CONST(130219.67651712766 / 8.0),
- REAL_CONST(130245.0055407047 / 8.0),
- REAL_CONST(130270.33579578891 / 8.0),
- REAL_CONST(130295.66728226055 / 8.0),
- REAL_CONST(130320.99999999991 / 8.0),
- REAL_CONST(130346.33394888733 / 8.0),
- REAL_CONST(130371.66912880314 / 8.0),
- REAL_CONST(130397.00553962773 / 8.0),
- REAL_CONST(130422.34318124152 / 8.0),
- REAL_CONST(130447.68205352494 / 8.0),
- REAL_CONST(130473.02215635845 / 8.0),
- REAL_CONST(130498.36348962256 / 8.0),
- REAL_CONST(130523.70605319779 / 8.0),
- REAL_CONST(130549.0498469647 / 8.0),
- REAL_CONST(130574.39487080388 / 8.0),
- REAL_CONST(130599.74112459592 / 8.0),
- REAL_CONST(130625.08860822149 / 8.0),
- REAL_CONST(130650.43732156123 / 8.0),
- REAL_CONST(130675.78726449587 / 8.0),
- REAL_CONST(130701.13843690613 / 8.0),
- REAL_CONST(130726.49083867275 / 8.0),
- REAL_CONST(130751.84446967654 / 8.0),
- REAL_CONST(130777.19932979831 / 8.0),
- REAL_CONST(130802.5554189189 / 8.0),
- REAL_CONST(130827.91273691918 / 8.0),
- REAL_CONST(130853.27128368006 / 8.0),
- REAL_CONST(130878.63105908247 / 8.0),
- REAL_CONST(130903.99206300738 / 8.0),
- REAL_CONST(130929.35429533575 / 8.0),
- REAL_CONST(130954.71775594862 / 8.0),
- REAL_CONST(130980.08244472703 / 8.0),
- REAL_CONST(131005.44836155206 / 8.0),
- REAL_CONST(131030.81550630482 / 8.0),
- REAL_CONST(131056.18387886642 / 8.0),
- REAL_CONST(131081.55347911804 / 8.0),
- REAL_CONST(131106.92430694087 / 8.0),
- REAL_CONST(131132.29636221612 / 8.0),
- REAL_CONST(131157.66964482504 / 8.0),
- REAL_CONST(131183.0441546489 / 8.0),
- REAL_CONST(131208.41989156904 / 8.0),
- REAL_CONST(131233.79685546676 / 8.0),
- REAL_CONST(131259.17504622342 / 8.0),
- REAL_CONST(131284.55446372041 / 8.0),
- REAL_CONST(131309.93510783918 / 8.0),
- REAL_CONST(131335.31697846117 / 8.0),
- REAL_CONST(131360.70007546784 / 8.0),
- REAL_CONST(131386.0843987407 / 8.0),
- REAL_CONST(131411.46994816128 / 8.0),
- REAL_CONST(131436.85672361116 / 8.0),
- REAL_CONST(131462.24472497194 / 8.0),
- REAL_CONST(131487.63395212521 / 8.0),
- REAL_CONST(131513.02440495262 / 8.0),
- REAL_CONST(131538.41608333588 / 8.0),
- REAL_CONST(131563.80898715663 / 8.0),
- REAL_CONST(131589.2031162967 / 8.0),
- REAL_CONST(131614.59847063778 / 8.0),
- REAL_CONST(131639.9950500617 / 8.0),
- REAL_CONST(131665.39285445024 / 8.0),
- REAL_CONST(131690.79188368531 / 8.0),
- REAL_CONST(131716.19213764873 / 8.0),
- REAL_CONST(131741.59361622241 / 8.0),
- REAL_CONST(131766.99631928833 / 8.0),
- REAL_CONST(131792.40024672839 / 8.0),
- REAL_CONST(131817.80539842462 / 8.0),
- REAL_CONST(131843.21177425905 / 8.0),
- REAL_CONST(131868.61937411371 / 8.0),
- REAL_CONST(131894.02819787065 / 8.0),
- REAL_CONST(131919.43824541202 / 8.0),
- REAL_CONST(131944.84951661993 / 8.0),
- REAL_CONST(131970.26201137656 / 8.0),
- REAL_CONST(131995.67572956407 / 8.0),
- REAL_CONST(132021.09067106468 / 8.0),
- REAL_CONST(132046.50683576067 / 8.0),
- REAL_CONST(132071.9242235343 / 8.0),
- REAL_CONST(132097.34283426782 / 8.0),
- REAL_CONST(132122.76266784366 / 8.0),
- REAL_CONST(132148.1837241441 / 8.0),
- REAL_CONST(132173.60600305157 / 8.0),
- REAL_CONST(132199.02950444847 / 8.0),
- REAL_CONST(132224.45422821722 / 8.0),
- REAL_CONST(132249.88017424036 / 8.0),
- REAL_CONST(132275.30734240031 / 8.0),
- REAL_CONST(132300.73573257966 / 8.0),
- REAL_CONST(132326.16534466096 / 8.0),
- REAL_CONST(132351.59617852676 / 8.0),
- REAL_CONST(132377.02823405969 / 8.0),
- REAL_CONST(132402.46151114244 / 8.0),
- REAL_CONST(132427.89600965759 / 8.0),
- REAL_CONST(132453.33172948789 / 8.0),
- REAL_CONST(132478.76867051609 / 8.0),
- REAL_CONST(132504.20683262491 / 8.0),
- REAL_CONST(132529.64621569714 / 8.0),
- REAL_CONST(132555.08681961559 / 8.0),
- REAL_CONST(132580.5286442631 / 8.0),
- REAL_CONST(132605.97168952253 / 8.0),
- REAL_CONST(132631.41595527678 / 8.0),
- REAL_CONST(132656.86144140881 / 8.0),
- REAL_CONST(132682.30814780149 / 8.0),
- REAL_CONST(132707.75607433787 / 8.0),
- REAL_CONST(132733.20522090094 / 8.0),
- REAL_CONST(132758.65558737374 / 8.0),
- REAL_CONST(132784.10717363929 / 8.0),
- REAL_CONST(132809.55997958075 / 8.0),
- REAL_CONST(132835.01400508118 / 8.0),
- REAL_CONST(132860.46925002377 / 8.0),
- REAL_CONST(132885.92571429166 / 8.0),
- REAL_CONST(132911.38339776811 / 8.0),
- REAL_CONST(132936.84230033628 / 8.0),
- REAL_CONST(132962.30242187946 / 8.0),
- REAL_CONST(132987.76376228096 / 8.0),
- REAL_CONST(133013.22632142407 / 8.0),
- REAL_CONST(133038.69009919214 / 8.0),
- REAL_CONST(133064.15509546854 / 8.0),
- REAL_CONST(133089.62131013666 / 8.0),
- REAL_CONST(133115.08874307995 / 8.0),
- REAL_CONST(133140.55739418184 / 8.0),
- REAL_CONST(133166.02726332581 / 8.0),
- REAL_CONST(133191.49835039541 / 8.0),
- REAL_CONST(133216.97065527414 / 8.0),
- REAL_CONST(133242.44417784561 / 8.0),
- REAL_CONST(133267.91891799335 / 8.0),
- REAL_CONST(133293.39487560102 / 8.0),
- REAL_CONST(133318.87205055228 / 8.0),
- REAL_CONST(133344.35044273079 / 8.0),
- REAL_CONST(133369.83005202023 / 8.0),
- REAL_CONST(133395.31087830439 / 8.0),
- REAL_CONST(133420.79292146701 / 8.0),
- REAL_CONST(133446.27618139185 / 8.0),
- REAL_CONST(133471.76065796276 / 8.0),
- REAL_CONST(133497.24635106357 / 8.0),
- REAL_CONST(133522.73326057816 / 8.0),
- REAL_CONST(133548.22138639039 / 8.0),
- REAL_CONST(133573.71072838426 / 8.0),
- REAL_CONST(133599.20128644365 / 8.0),
- REAL_CONST(133624.69306045261 / 8.0),
- REAL_CONST(133650.1860502951 / 8.0),
- REAL_CONST(133675.68025585517 / 8.0),
- REAL_CONST(133701.1756770169 / 8.0),
- REAL_CONST(133726.67231366437 / 8.0),
- REAL_CONST(133752.17016568172 / 8.0),
- REAL_CONST(133777.66923295305 / 8.0),
- REAL_CONST(133803.16951536259 / 8.0),
- REAL_CONST(133828.67101279454 / 8.0),
- REAL_CONST(133854.17372513309 / 8.0),
- REAL_CONST(133879.67765226253 / 8.0),
- REAL_CONST(133905.18279406714 / 8.0),
- REAL_CONST(133930.68915043125 / 8.0),
- REAL_CONST(133956.19672123916 / 8.0),
- REAL_CONST(133981.70550637526 / 8.0),
- REAL_CONST(134007.21550572399 / 8.0),
- REAL_CONST(134032.7267191697 / 8.0),
- REAL_CONST(134058.23914659687 / 8.0),
- REAL_CONST(134083.75278789 / 8.0),
- REAL_CONST(134109.26764293358 / 8.0),
- REAL_CONST(134134.78371161217 / 8.0),
- REAL_CONST(134160.30099381026 / 8.0),
- REAL_CONST(134185.8194894125 / 8.0),
- REAL_CONST(134211.33919830353 / 8.0),
- REAL_CONST(134236.8601203679 / 8.0),
- REAL_CONST(134262.38225549037 / 8.0),
- REAL_CONST(134287.90560355558 / 8.0),
- REAL_CONST(134313.43016444831 / 8.0),
- REAL_CONST(134338.95593805326 / 8.0),
- REAL_CONST(134364.48292425525 / 8.0),
- REAL_CONST(134390.01112293909 / 8.0),
- REAL_CONST(134415.54053398955 / 8.0),
- REAL_CONST(134441.07115729159 / 8.0),
- REAL_CONST(134466.60299273001 / 8.0),
- REAL_CONST(134492.1360401898 / 8.0),
- REAL_CONST(134517.67029955584 / 8.0),
- REAL_CONST(134543.20577071316 / 8.0),
- REAL_CONST(134568.74245354676 / 8.0),
- REAL_CONST(134594.28034794159 / 8.0),
- REAL_CONST(134619.81945378278 / 8.0),
- REAL_CONST(134645.35977095537 / 8.0),
- REAL_CONST(134670.90129934452 / 8.0),
- REAL_CONST(134696.4440388353 / 8.0),
- REAL_CONST(134721.98798931291 / 8.0),
- REAL_CONST(134747.53315066252 / 8.0),
- REAL_CONST(134773.07952276937 / 8.0),
- REAL_CONST(134798.62710551871 / 8.0),
- REAL_CONST(134824.17589879577 / 8.0),
- REAL_CONST(134849.72590248589 / 8.0),
- REAL_CONST(134875.27711647438 / 8.0),
- REAL_CONST(134900.82954064661 / 8.0),
- REAL_CONST(134926.38317488792 / 8.0),
- REAL_CONST(134951.93801908373 / 8.0),
- REAL_CONST(134977.49407311951 / 8.0),
- REAL_CONST(135003.05133688069 / 8.0),
- REAL_CONST(135028.60981025276 / 8.0),
- REAL_CONST(135054.16949312127 / 8.0),
- REAL_CONST(135079.73038537172 / 8.0),
- REAL_CONST(135105.29248688967 / 8.0),
- REAL_CONST(135130.85579756077 / 8.0),
- REAL_CONST(135156.42031727062 / 8.0),
- REAL_CONST(135181.98604590484 / 8.0),
- REAL_CONST(135207.55298334916 / 8.0),
- REAL_CONST(135233.12112948924 / 8.0),
- REAL_CONST(135258.69048421088 / 8.0),
- REAL_CONST(135284.26104739975 / 8.0),
- REAL_CONST(135309.83281894168 / 8.0),
- REAL_CONST(135335.4057987225 / 8.0),
- REAL_CONST(135360.97998662802 / 8.0),
- REAL_CONST(135386.55538254412 / 8.0),
- REAL_CONST(135412.13198635669 / 8.0),
- REAL_CONST(135437.70979795168 / 8.0),
- REAL_CONST(135463.28881721498 / 8.0),
- REAL_CONST(135488.86904403262 / 8.0),
- REAL_CONST(135514.45047829056 / 8.0),
- REAL_CONST(135540.03311987486 / 8.0),
- REAL_CONST(135565.61696867159 / 8.0),
- REAL_CONST(135591.20202456677 / 8.0),
- REAL_CONST(135616.78828744654 / 8.0),
- REAL_CONST(135642.37575719706 / 8.0),
- REAL_CONST(135667.96443370447 / 8.0),
- REAL_CONST(135693.55431685498 / 8.0),
- REAL_CONST(135719.14540653475 / 8.0),
- REAL_CONST(135744.73770263011 / 8.0),
- REAL_CONST(135770.33120502727 / 8.0),
- REAL_CONST(135795.92591361253 / 8.0),
- REAL_CONST(135821.52182827223 / 8.0),
- REAL_CONST(135847.11894889272 / 8.0),
- REAL_CONST(135872.7172753604 / 8.0),
- REAL_CONST(135898.31680756161 / 8.0),
- REAL_CONST(135923.91754538284 / 8.0),
- REAL_CONST(135949.51948871053 / 8.0),
- REAL_CONST(135975.12263743114 / 8.0),
- REAL_CONST(136000.72699143123 / 8.0),
- REAL_CONST(136026.33255059729 / 8.0),
- REAL_CONST(136051.93931481591 / 8.0),
- REAL_CONST(136077.54728397369 / 8.0),
- REAL_CONST(136103.15645795723 / 8.0),
- REAL_CONST(136128.76683665317 / 8.0),
- REAL_CONST(136154.37841994822 / 8.0),
- REAL_CONST(136179.99120772901 / 8.0),
- REAL_CONST(136205.60519988232 / 8.0),
- REAL_CONST(136231.2203962949 / 8.0),
- REAL_CONST(136256.83679685349 / 8.0),
- REAL_CONST(136282.45440144493 / 8.0),
- REAL_CONST(136308.07320995603 / 8.0),
- REAL_CONST(136333.69322227367 / 8.0),
- REAL_CONST(136359.31443828469 / 8.0),
- REAL_CONST(136384.93685787608 / 8.0),
- REAL_CONST(136410.56048093468 / 8.0),
- REAL_CONST(136436.18530734754 / 8.0),
- REAL_CONST(136461.81133700156 / 8.0),
- REAL_CONST(136487.43856978384 / 8.0),
- REAL_CONST(136513.06700558143 / 8.0),
- REAL_CONST(136538.6966442813 / 8.0),
- REAL_CONST(136564.32748577066 / 8.0),
- REAL_CONST(136589.95952993655 / 8.0),
- REAL_CONST(136615.59277666616 / 8.0),
- REAL_CONST(136641.22722584667 / 8.0),
- REAL_CONST(136666.86287736523 / 8.0),
- REAL_CONST(136692.49973110916 / 8.0),
- REAL_CONST(136718.13778696564 / 8.0),
- REAL_CONST(136743.77704482197 / 8.0),
- REAL_CONST(136769.41750456547 / 8.0),
- REAL_CONST(136795.05916608346 / 8.0),
- REAL_CONST(136820.70202926331 / 8.0),
- REAL_CONST(136846.34609399244 / 8.0),
- REAL_CONST(136871.99136015819 / 8.0),
- REAL_CONST(136897.63782764805 / 8.0),
- REAL_CONST(136923.28549634948 / 8.0),
- REAL_CONST(136948.93436614997 / 8.0),
- REAL_CONST(136974.58443693706 / 8.0),
- REAL_CONST(137000.23570859825 / 8.0),
- REAL_CONST(137025.88818102115 / 8.0),
- REAL_CONST(137051.54185409332 / 8.0),
- REAL_CONST(137077.19672770242 / 8.0),
- REAL_CONST(137102.85280173609 / 8.0),
- REAL_CONST(137128.51007608202 / 8.0),
- REAL_CONST(137154.16855062786 / 8.0),
- REAL_CONST(137179.82822526142 / 8.0),
- REAL_CONST(137205.48909987041 / 8.0),
- REAL_CONST(137231.15117434258 / 8.0),
- REAL_CONST(137256.8144485658 / 8.0),
- REAL_CONST(137282.47892242789 / 8.0),
- REAL_CONST(137308.14459581667 / 8.0),
- REAL_CONST(137333.81146862009 / 8.0),
- REAL_CONST(137359.47954072602 / 8.0),
- REAL_CONST(137385.14881202241 / 8.0),
- REAL_CONST(137410.81928239719 / 8.0),
- REAL_CONST(137436.49095173844 / 8.0),
- REAL_CONST(137462.16381993407 / 8.0),
- REAL_CONST(137487.83788687221 / 8.0),
- REAL_CONST(137513.51315244089 / 8.0),
- REAL_CONST(137539.18961652822 / 8.0),
- REAL_CONST(137564.86727902229 / 8.0),
- REAL_CONST(137590.54613981131 / 8.0),
- REAL_CONST(137616.22619878338 / 8.0),
- REAL_CONST(137641.90745582676 / 8.0),
- REAL_CONST(137667.58991082967 / 8.0),
- REAL_CONST(137693.27356368033 / 8.0),
- REAL_CONST(137718.95841426702 / 8.0),
- REAL_CONST(137744.64446247809 / 8.0),
- REAL_CONST(137770.33170820182 / 8.0),
- REAL_CONST(137796.02015132661 / 8.0),
- REAL_CONST(137821.70979174081 / 8.0),
- REAL_CONST(137847.40062933284 / 8.0),
- REAL_CONST(137873.09266399115 / 8.0),
- REAL_CONST(137898.78589560417 / 8.0),
- REAL_CONST(137924.48032406042 / 8.0),
- REAL_CONST(137950.17594924837 / 8.0),
- REAL_CONST(137975.8727710566 / 8.0),
- REAL_CONST(138001.57078937365 / 8.0),
- REAL_CONST(138027.27000408815 / 8.0),
- REAL_CONST(138052.97041508864 / 8.0),
- REAL_CONST(138078.67202226384 / 8.0),
- REAL_CONST(138104.3748255024 / 8.0),
- REAL_CONST(138130.07882469296 / 8.0),
- REAL_CONST(138155.78401972432 / 8.0),
- REAL_CONST(138181.49041048516 / 8.0),
- REAL_CONST(138207.1979968643 / 8.0),
- REAL_CONST(138232.9067787505 / 8.0),
- REAL_CONST(138258.61675603263 / 8.0),
- REAL_CONST(138284.32792859949 / 8.0),
- REAL_CONST(138310.04029633995 / 8.0),
- REAL_CONST(138335.75385914298 / 8.0),
- REAL_CONST(138361.46861689744 / 8.0),
- REAL_CONST(138387.18456949232 / 8.0),
- REAL_CONST(138412.90171681659 / 8.0),
- REAL_CONST(138438.62005875923 / 8.0),
- REAL_CONST(138464.33959520931 / 8.0),
- REAL_CONST(138490.06032605586 / 8.0),
- REAL_CONST(138515.78225118798 / 8.0),
- REAL_CONST(138541.50537049473 / 8.0),
- REAL_CONST(138567.2296838653 / 8.0),
- REAL_CONST(138592.95519118884 / 8.0),
- REAL_CONST(138618.68189235451 / 8.0),
- REAL_CONST(138644.40978725153 / 8.0),
- REAL_CONST(138670.13887576913 / 8.0),
- REAL_CONST(138695.86915779658 / 8.0),
- REAL_CONST(138721.60063322316 / 8.0),
- REAL_CONST(138747.33330193823 / 8.0),
- REAL_CONST(138773.06716383106 / 8.0),
- REAL_CONST(138798.80221879104 / 8.0),
- REAL_CONST(138824.53846670757 / 8.0),
- REAL_CONST(138850.27590747006 / 8.0),
- REAL_CONST(138876.01454096794 / 8.0),
- REAL_CONST(138901.7543670907 / 8.0),
- REAL_CONST(138927.49538572782 / 8.0),
- REAL_CONST(138953.2375967688 / 8.0),
- REAL_CONST(138978.9810001032 / 8.0),
- REAL_CONST(139004.72559562061 / 8.0),
- REAL_CONST(139030.47138321059 / 8.0),
- REAL_CONST(139056.2183627628 / 8.0),
- REAL_CONST(139081.96653416683 / 8.0),
- REAL_CONST(139107.71589731239 / 8.0),
- REAL_CONST(139133.46645208917 / 8.0),
- REAL_CONST(139159.21819838689 / 8.0),
- REAL_CONST(139184.97113609532 / 8.0),
- REAL_CONST(139210.72526510421 / 8.0),
- REAL_CONST(139236.48058530336 / 8.0),
- REAL_CONST(139262.23709658257 / 8.0),
- REAL_CONST(139287.99479883176 / 8.0),
- REAL_CONST(139313.75369194071 / 8.0),
- REAL_CONST(139339.51377579942 / 8.0),
- REAL_CONST(139365.27505029776 / 8.0),
- REAL_CONST(139391.03751532568 / 8.0),
- REAL_CONST(139416.80117077316 / 8.0),
- REAL_CONST(139442.56601653024 / 8.0),
- REAL_CONST(139468.33205248689 / 8.0),
- REAL_CONST(139494.09927853322 / 8.0),
- REAL_CONST(139519.86769455927 / 8.0),
- REAL_CONST(139545.63730045516 / 8.0),
- REAL_CONST(139571.408096111 / 8.0),
- REAL_CONST(139597.18008141697 / 8.0),
- REAL_CONST(139622.95325626322 / 8.0),
- REAL_CONST(139648.72762054001 / 8.0),
- REAL_CONST(139674.5031741375 / 8.0),
- REAL_CONST(139700.27991694602 / 8.0),
- REAL_CONST(139726.05784885579 / 8.0),
- REAL_CONST(139751.83696975713 / 8.0),
- REAL_CONST(139777.61727954043 / 8.0),
- REAL_CONST(139803.39877809596 / 8.0),
- REAL_CONST(139829.18146531415 / 8.0),
- REAL_CONST(139854.96534108539 / 8.0),
- REAL_CONST(139880.75040530015 / 8.0),
- REAL_CONST(139906.53665784886 / 8.0),
- REAL_CONST(139932.32409862199 / 8.0),
- REAL_CONST(139958.11272751007 / 8.0),
- REAL_CONST(139983.90254440365 / 8.0),
- REAL_CONST(140009.69354919327 / 8.0),
- REAL_CONST(140035.48574176949 / 8.0),
- REAL_CONST(140061.27912202294 / 8.0),
- REAL_CONST(140087.07368984428 / 8.0),
- REAL_CONST(140112.86944512415 / 8.0),
- REAL_CONST(140138.66638775321 / 8.0),
- REAL_CONST(140164.4645176222 / 8.0),
- REAL_CONST(140190.26383462184 / 8.0),
- REAL_CONST(140216.06433864293 / 8.0),
- REAL_CONST(140241.86602957622 / 8.0),
- REAL_CONST(140267.66890731253 / 8.0),
- REAL_CONST(140293.47297174268 / 8.0),
- REAL_CONST(140319.27822275754 / 8.0),
- REAL_CONST(140345.08466024802 / 8.0),
- REAL_CONST(140370.89228410498 / 8.0),
- REAL_CONST(140396.70109421943 / 8.0),
- REAL_CONST(140422.51109048226 / 8.0),
- REAL_CONST(140448.32227278448 / 8.0),
- REAL_CONST(140474.13464101712 / 8.0),
- REAL_CONST(140499.94819507122 / 8.0),
- REAL_CONST(140525.76293483781 / 8.0),
- REAL_CONST(140551.57886020801 / 8.0),
- REAL_CONST(140577.3959710729 / 8.0),
- REAL_CONST(140603.21426732364 / 8.0),
- REAL_CONST(140629.03374885136 / 8.0),
- REAL_CONST(140654.85441554731 / 8.0),
- REAL_CONST(140680.67626730262 / 8.0),
- REAL_CONST(140706.49930400858 / 8.0),
- REAL_CONST(140732.32352555645 / 8.0),
- REAL_CONST(140758.1489318375 / 8.0),
- REAL_CONST(140783.97552274304 / 8.0),
- REAL_CONST(140809.80329816442 / 8.0),
- REAL_CONST(140835.63225799298 / 8.0),
- REAL_CONST(140861.46240212015 / 8.0),
- REAL_CONST(140887.29373043729 / 8.0),
- REAL_CONST(140913.12624283586 / 8.0),
- REAL_CONST(140938.95993920733 / 8.0),
- REAL_CONST(140964.79481944317 / 8.0),
- REAL_CONST(140990.63088343487 / 8.0),
- REAL_CONST(141016.46813107401 / 8.0),
- REAL_CONST(141042.30656225214 / 8.0),
- REAL_CONST(141068.14617686081 / 8.0),
- REAL_CONST(141093.98697479168 / 8.0),
- REAL_CONST(141119.82895593636 / 8.0),
- REAL_CONST(141145.6721201865 / 8.0),
- REAL_CONST(141171.51646743377 / 8.0),
- REAL_CONST(141197.36199756994 / 8.0),
- REAL_CONST(141223.20871048668 / 8.0),
- REAL_CONST(141249.05660607578 / 8.0),
- REAL_CONST(141274.90568422904 / 8.0),
- REAL_CONST(141300.75594483822 / 8.0),
- REAL_CONST(141326.6073877952 / 8.0),
- REAL_CONST(141352.4600129918 / 8.0),
- REAL_CONST(141378.31382031992 / 8.0),
- REAL_CONST(141404.16880967148 / 8.0),
- REAL_CONST(141430.02498093838 / 8.0),
- REAL_CONST(141455.8823340126 / 8.0),
- REAL_CONST(141481.74086878612 / 8.0),
- REAL_CONST(141507.60058515094 / 8.0),
- REAL_CONST(141533.46148299909 / 8.0),
- REAL_CONST(141559.32356222265 / 8.0),
- REAL_CONST(141585.18682271364 / 8.0),
- REAL_CONST(141611.05126436421 / 8.0),
- REAL_CONST(141636.9168870665 / 8.0),
- REAL_CONST(141662.78369071262 / 8.0),
- REAL_CONST(141688.65167519479 / 8.0),
- REAL_CONST(141714.5208404052 / 8.0),
- REAL_CONST(141740.39118623605 / 8.0),
- REAL_CONST(141766.26271257963 / 8.0),
- REAL_CONST(141792.1354193282 / 8.0),
- REAL_CONST(141818.00930637406 / 8.0),
- REAL_CONST(141843.88437360956 / 8.0),
- REAL_CONST(141869.760620927 / 8.0),
- REAL_CONST(141895.6380482188 / 8.0),
- REAL_CONST(141921.51665537735 / 8.0),
- REAL_CONST(141947.39644229505 / 8.0),
- REAL_CONST(141973.27740886438 / 8.0),
- REAL_CONST(141999.15955497778 / 8.0),
- REAL_CONST(142025.04288052776 / 8.0),
- REAL_CONST(142050.92738540689 / 8.0),
- REAL_CONST(142076.81306950765 / 8.0),
- REAL_CONST(142102.69993272264 / 8.0),
- REAL_CONST(142128.58797494444 / 8.0),
- REAL_CONST(142154.47719606571 / 8.0),
- REAL_CONST(142180.36759597904 / 8.0),
- REAL_CONST(142206.25917457714 / 8.0),
- REAL_CONST(142232.15193175265 / 8.0),
- REAL_CONST(142258.04586739838 / 8.0),
- REAL_CONST(142283.94098140698 / 8.0),
- REAL_CONST(142309.83727367126 / 8.0),
- REAL_CONST(142335.73474408401 / 8.0),
- REAL_CONST(142361.63339253806 / 8.0),
- REAL_CONST(142387.5332189262 / 8.0),
- REAL_CONST(142413.43422314132 / 8.0),
- REAL_CONST(142439.33640507635 / 8.0),
- REAL_CONST(142465.23976462413 / 8.0),
- REAL_CONST(142491.14430167765 / 8.0),
- REAL_CONST(142517.05001612983 / 8.0),
- REAL_CONST(142542.95690787368 / 8.0),
- REAL_CONST(142568.86497680223 / 8.0),
- REAL_CONST(142594.77422280848 / 8.0),
- REAL_CONST(142620.68464578551 / 8.0),
- REAL_CONST(142646.5962456264 / 8.0),
- REAL_CONST(142672.50902222423 / 8.0),
- REAL_CONST(142698.42297547215 / 8.0),
- REAL_CONST(142724.33810526333 / 8.0),
- REAL_CONST(142750.25441149093 / 8.0),
- REAL_CONST(142776.17189404817 / 8.0),
- REAL_CONST(142802.09055282827 / 8.0),
- REAL_CONST(142828.01038772447 / 8.0),
- REAL_CONST(142853.93139863008 / 8.0),
- REAL_CONST(142879.85358543837 / 8.0),
- REAL_CONST(142905.77694804268 / 8.0),
- REAL_CONST(142931.70148633636 / 8.0),
- REAL_CONST(142957.62720021277 / 8.0),
- REAL_CONST(142983.55408956532 / 8.0),
- REAL_CONST(143009.48215428743 / 8.0),
- REAL_CONST(143035.41139427255 / 8.0),
- REAL_CONST(143061.34180941415 / 8.0),
- REAL_CONST(143087.27339960571 / 8.0),
- REAL_CONST(143113.20616474075 / 8.0),
- REAL_CONST(143139.14010471283 / 8.0),
- REAL_CONST(143165.07521941551 / 8.0),
- REAL_CONST(143191.01150874238 / 8.0),
- REAL_CONST(143216.94897258704 / 8.0),
- REAL_CONST(143242.88761084314 / 8.0),
- REAL_CONST(143268.82742340435 / 8.0),
- REAL_CONST(143294.76841016437 / 8.0),
- REAL_CONST(143320.71057101688 / 8.0),
- REAL_CONST(143346.65390585564 / 8.0),
- REAL_CONST(143372.59841457437 / 8.0),
- REAL_CONST(143398.54409706692 / 8.0),
- REAL_CONST(143424.49095322701 / 8.0),
- REAL_CONST(143450.43898294857 / 8.0),
- REAL_CONST(143476.38818612538 / 8.0),
- REAL_CONST(143502.33856265133 / 8.0),
- REAL_CONST(143528.29011242036 / 8.0),
- REAL_CONST(143554.24283532638 / 8.0),
- REAL_CONST(143580.19673126334 / 8.0),
- REAL_CONST(143606.1518001252 / 8.0),
- REAL_CONST(143632.10804180597 / 8.0),
- REAL_CONST(143658.06545619969 / 8.0),
- REAL_CONST(143684.02404320039 / 8.0),
- REAL_CONST(143709.98380270213 / 8.0),
- REAL_CONST(143735.944734599 / 8.0),
- REAL_CONST(143761.90683878519 / 8.0),
- REAL_CONST(143787.87011515474 / 8.0),
- REAL_CONST(143813.83456360188 / 8.0),
- REAL_CONST(143839.8001840208 / 8.0),
- REAL_CONST(143865.76697630569 / 8.0),
- REAL_CONST(143891.73494035081 / 8.0),
- REAL_CONST(143917.7040760504 / 8.0),
- REAL_CONST(143943.67438329876 / 8.0),
- REAL_CONST(143969.6458619902 / 8.0),
- REAL_CONST(143995.61851201905 / 8.0),
- REAL_CONST(144021.59233327967 / 8.0),
- REAL_CONST(144047.56732566646 / 8.0),
- REAL_CONST(144073.54348907378 / 8.0),
- REAL_CONST(144099.52082339607 / 8.0),
- REAL_CONST(144125.49932852783 / 8.0),
- REAL_CONST(144151.4790043635 / 8.0),
- REAL_CONST(144177.45985079758 / 8.0),
- REAL_CONST(144203.44186772458 / 8.0),
- REAL_CONST(144229.42505503909 / 8.0),
- REAL_CONST(144255.40941263564 / 8.0),
- REAL_CONST(144281.39494040885 / 8.0),
- REAL_CONST(144307.38163825331 / 8.0),
- REAL_CONST(144333.36950606373 / 8.0),
- REAL_CONST(144359.35854373468 / 8.0),
- REAL_CONST(144385.34875116093 / 8.0),
- REAL_CONST(144411.34012823718 / 8.0),
- REAL_CONST(144437.33267485813 / 8.0),
- REAL_CONST(144463.32639091855 / 8.0),
- REAL_CONST(144489.32127631325 / 8.0),
- REAL_CONST(144515.31733093705 / 8.0),
- REAL_CONST(144541.31455468474 / 8.0),
- REAL_CONST(144567.3129474512 / 8.0),
- REAL_CONST(144593.3125091313 / 8.0),
- REAL_CONST(144619.31323961995 / 8.0),
- REAL_CONST(144645.31513881206 / 8.0),
- REAL_CONST(144671.31820660262 / 8.0),
- REAL_CONST(144697.32244288657 / 8.0),
- REAL_CONST(144723.32784755889 / 8.0),
- REAL_CONST(144749.33442051467 / 8.0),
- REAL_CONST(144775.34216164888 / 8.0),
- REAL_CONST(144801.35107085665 / 8.0),
- REAL_CONST(144827.36114803303 / 8.0),
- REAL_CONST(144853.37239307314 / 8.0),
- REAL_CONST(144879.38480587213 / 8.0),
- REAL_CONST(144905.39838632516 / 8.0),
- REAL_CONST(144931.41313432742 / 8.0),
- REAL_CONST(144957.4290497741 / 8.0),
- REAL_CONST(144983.44613256046 / 8.0),
- REAL_CONST(145009.46438258173 / 8.0),
- REAL_CONST(145035.48379973322 / 8.0),
- REAL_CONST(145061.50438391021 / 8.0),
- REAL_CONST(145087.52613500805 / 8.0),
- REAL_CONST(145113.54905292206 / 8.0),
- REAL_CONST(145139.57313754765 / 8.0),
- REAL_CONST(145165.59838878017 / 8.0),
- REAL_CONST(145191.62480651509 / 8.0),
- REAL_CONST(145217.65239064783 / 8.0),
- REAL_CONST(145243.68114107384 / 8.0),
- REAL_CONST(145269.71105768863 / 8.0),
- REAL_CONST(145295.74214038774 / 8.0),
- REAL_CONST(145321.77438906668 / 8.0),
- REAL_CONST(145347.80780362099 / 8.0),
- REAL_CONST(145373.84238394629 / 8.0),
- REAL_CONST(145399.87812993818 / 8.0),
- REAL_CONST(145425.91504149229 / 8.0),
- REAL_CONST(145451.95311850426 / 8.0),
- REAL_CONST(145477.9923608698 / 8.0),
- REAL_CONST(145504.03276848458 / 8.0),
- REAL_CONST(145530.07434124436 / 8.0),
- REAL_CONST(145556.11707904484 / 8.0),
- REAL_CONST(145582.16098178181 / 8.0),
- REAL_CONST(145608.20604935108 / 8.0),
- REAL_CONST(145634.25228164849 / 8.0),
- REAL_CONST(145660.29967856981 / 8.0),
- REAL_CONST(145686.34824001096 / 8.0),
- REAL_CONST(145712.39796586783 / 8.0),
- REAL_CONST(145738.4488560363 / 8.0),
- REAL_CONST(145764.50091041232 / 8.0),
- REAL_CONST(145790.55412889185 / 8.0),
- REAL_CONST(145816.60851137087 / 8.0),
- REAL_CONST(145842.66405774537 / 8.0),
- REAL_CONST(145868.72076791141 / 8.0),
- REAL_CONST(145894.77864176501 / 8.0),
- REAL_CONST(145920.83767920226 / 8.0),
- REAL_CONST(145946.89788011924 / 8.0),
- REAL_CONST(145972.95924441208 / 8.0),
- REAL_CONST(145999.02177197693 / 8.0),
- REAL_CONST(146025.08546270995 / 8.0),
- REAL_CONST(146051.15031650732 / 8.0),
- REAL_CONST(146077.21633326527 / 8.0),
- REAL_CONST(146103.28351288004 / 8.0),
- REAL_CONST(146129.35185524789 / 8.0),
- REAL_CONST(146155.42136026506 / 8.0),
- REAL_CONST(146181.49202782792 / 8.0),
- REAL_CONST(146207.56385783272 / 8.0),
- REAL_CONST(146233.63685017588 / 8.0),
- REAL_CONST(146259.71100475377 / 8.0),
- REAL_CONST(146285.78632146274 / 8.0),
- REAL_CONST(146311.86280019928 / 8.0),
- REAL_CONST(146337.94044085976 / 8.0),
- REAL_CONST(146364.01924334071 / 8.0),
- REAL_CONST(146390.09920753856 / 8.0),
- REAL_CONST(146416.18033334985 / 8.0),
- REAL_CONST(146442.26262067116 / 8.0),
- REAL_CONST(146468.34606939898 / 8.0),
- REAL_CONST(146494.43067942993 / 8.0),
- REAL_CONST(146520.51645066062 / 8.0),
- REAL_CONST(146546.60338298764 / 8.0),
- REAL_CONST(146572.69147630769 / 8.0),
- REAL_CONST(146598.78073051744 / 8.0),
- REAL_CONST(146624.87114551352 / 8.0),
- REAL_CONST(146650.96272119274 / 8.0),
- REAL_CONST(146677.05545745179 / 8.0),
- REAL_CONST(146703.14935418745 / 8.0),
- REAL_CONST(146729.2444112965 / 8.0),
- REAL_CONST(146755.34062867577 / 8.0),
- REAL_CONST(146781.43800622207 / 8.0),
- REAL_CONST(146807.53654383228 / 8.0),
- REAL_CONST(146833.63624140329 / 8.0),
- REAL_CONST(146859.73709883197 / 8.0),
- REAL_CONST(146885.83911601527 / 8.0),
- REAL_CONST(146911.94229285014 / 8.0),
- REAL_CONST(146938.04662923355 / 8.0),
- REAL_CONST(146964.15212506248 / 8.0),
- REAL_CONST(146990.25878023397 / 8.0),
- REAL_CONST(147016.36659464505 / 8.0),
- REAL_CONST(147042.47556819281 / 8.0),
- REAL_CONST(147068.58570077427 / 8.0),
- REAL_CONST(147094.6969922866 / 8.0),
- REAL_CONST(147120.80944262692 / 8.0),
- REAL_CONST(147146.92305169237 / 8.0),
- REAL_CONST(147173.03781938017 / 8.0),
- REAL_CONST(147199.15374558745 / 8.0),
- REAL_CONST(147225.27083021149 / 8.0),
- REAL_CONST(147251.38907314953 / 8.0),
- REAL_CONST(147277.50847429881 / 8.0),
- REAL_CONST(147303.62903355664 / 8.0),
- REAL_CONST(147329.75075082036 / 8.0),
- REAL_CONST(147355.87362598727 / 8.0),
- REAL_CONST(147381.99765895473 / 8.0),
- REAL_CONST(147408.12284962015 / 8.0),
- REAL_CONST(147434.24919788091 / 8.0),
- REAL_CONST(147460.37670363448 / 8.0),
- REAL_CONST(147486.50536677826 / 8.0),
- REAL_CONST(147512.63518720976 / 8.0),
- REAL_CONST(147538.76616482646 / 8.0),
- REAL_CONST(147564.89829952587 / 8.0),
- REAL_CONST(147591.03159120557 / 8.0),
- REAL_CONST(147617.16603976308 / 8.0),
- REAL_CONST(147643.30164509601 / 8.0),
- REAL_CONST(147669.43840710199 / 8.0),
- REAL_CONST(147695.57632567859 / 8.0),
- REAL_CONST(147721.71540072354 / 8.0),
- REAL_CONST(147747.85563213445 / 8.0),
- REAL_CONST(147773.99701980909 / 8.0),
- REAL_CONST(147800.13956364512 / 8.0),
- REAL_CONST(147826.28326354033 / 8.0),
- REAL_CONST(147852.42811939248 / 8.0),
- REAL_CONST(147878.57413109933 / 8.0),
- REAL_CONST(147904.72129855872 / 8.0),
- REAL_CONST(147930.86962166851 / 8.0),
- REAL_CONST(147957.01910032652 / 8.0),
- REAL_CONST(147983.16973443062 / 8.0),
- REAL_CONST(148009.32152387875 / 8.0),
- REAL_CONST(148035.47446856883 / 8.0),
- REAL_CONST(148061.62856839882 / 8.0),
- REAL_CONST(148087.78382326665 / 8.0),
- REAL_CONST(148113.94023307035 / 8.0),
- REAL_CONST(148140.09779770792 / 8.0),
- REAL_CONST(148166.25651707739 / 8.0),
- REAL_CONST(148192.41639107687 / 8.0),
- REAL_CONST(148218.57741960438 / 8.0),
- REAL_CONST(148244.73960255808 / 8.0),
- REAL_CONST(148270.90293983606 / 8.0),
- REAL_CONST(148297.0674313365 / 8.0),
- REAL_CONST(148323.23307695755 / 8.0),
- REAL_CONST(148349.39987659742 / 8.0),
- REAL_CONST(148375.56783015432 / 8.0),
- REAL_CONST(148401.73693752653 / 8.0),
- REAL_CONST(148427.90719861226 / 8.0),
- REAL_CONST(148454.07861330983 / 8.0),
- REAL_CONST(148480.25118151752 / 8.0),
- REAL_CONST(148506.42490313368 / 8.0),
- REAL_CONST(148532.59977805667 / 8.0),
- REAL_CONST(148558.77580618486 / 8.0),
- REAL_CONST(148584.95298741665 / 8.0),
- REAL_CONST(148611.13132165043 / 8.0),
- REAL_CONST(148637.31080878471 / 8.0),
- REAL_CONST(148663.49144871789 / 8.0),
- REAL_CONST(148689.6732413485 / 8.0),
- REAL_CONST(148715.85618657502 / 8.0),
- REAL_CONST(148742.040284296 / 8.0),
- REAL_CONST(148768.22553440998 / 8.0),
- REAL_CONST(148794.41193681557 / 8.0),
- REAL_CONST(148820.59949141133 / 8.0),
- REAL_CONST(148846.78819809589 / 8.0),
- REAL_CONST(148872.97805676793 / 8.0),
- REAL_CONST(148899.16906732606 / 8.0),
- REAL_CONST(148925.36122966901 / 8.0),
- REAL_CONST(148951.55454369547 / 8.0),
- REAL_CONST(148977.74900930419 / 8.0),
- REAL_CONST(149003.9446263939 / 8.0),
- REAL_CONST(149030.1413948634 / 8.0),
- REAL_CONST(149056.33931461151 / 8.0),
- REAL_CONST(149082.53838553699 / 8.0),
- REAL_CONST(149108.73860753875 / 8.0),
- REAL_CONST(149134.9399805156 / 8.0),
- REAL_CONST(149161.14250436646 / 8.0),
- REAL_CONST(149187.34617899026 / 8.0),
- REAL_CONST(149213.5510042859 / 8.0),
- REAL_CONST(149239.75698015234 / 8.0),
- REAL_CONST(149265.96410648854 / 8.0),
- REAL_CONST(149292.17238319354 / 8.0),
- REAL_CONST(149318.38181016635 / 8.0),
- REAL_CONST(149344.59238730598 / 8.0),
- REAL_CONST(149370.80411451156 / 8.0),
- REAL_CONST(149397.01699168212 / 8.0),
- REAL_CONST(149423.23101871679 / 8.0),
- REAL_CONST(149449.44619551473 / 8.0),
- REAL_CONST(149475.66252197503 / 8.0),
- REAL_CONST(149501.87999799693 / 8.0),
- REAL_CONST(149528.0986234796 / 8.0),
- REAL_CONST(149554.31839832227 / 8.0),
- REAL_CONST(149580.53932242419 / 8.0),
- REAL_CONST(149606.76139568459 / 8.0),
- REAL_CONST(149632.98461800278 / 8.0),
- REAL_CONST(149659.20898927809 / 8.0),
- REAL_CONST(149685.43450940982 / 8.0),
- REAL_CONST(149711.66117829733 / 8.0),
- REAL_CONST(149737.88899584001 / 8.0),
- REAL_CONST(149764.11796193724 / 8.0),
- REAL_CONST(149790.34807648844 / 8.0),
- REAL_CONST(149816.57933939309 / 8.0),
- REAL_CONST(149842.81175055061 / 8.0),
- REAL_CONST(149869.04530986046 / 8.0),
- REAL_CONST(149895.28001722222 / 8.0),
- REAL_CONST(149921.51587253538 / 8.0),
- REAL_CONST(149947.75287569952 / 8.0),
- REAL_CONST(149973.99102661415 / 8.0),
- REAL_CONST(150000.23032517891 / 8.0),
- REAL_CONST(150026.47077129342 / 8.0),
- REAL_CONST(150052.71236485732 / 8.0),
- REAL_CONST(150078.95510577026 / 8.0),
- REAL_CONST(150105.1989939319 / 8.0),
- REAL_CONST(150131.444029242 / 8.0),
- REAL_CONST(150157.69021160025 / 8.0),
- REAL_CONST(150183.93754090639 / 8.0),
- REAL_CONST(150210.18601706024 / 8.0),
- REAL_CONST(150236.43563996154 / 8.0),
- REAL_CONST(150262.68640951012 / 8.0),
- REAL_CONST(150288.93832560582 / 8.0),
- REAL_CONST(150315.19138814852 / 8.0),
- REAL_CONST(150341.44559703805 / 8.0),
- REAL_CONST(150367.70095217437 / 8.0),
- REAL_CONST(150393.95745345735 / 8.0),
- REAL_CONST(150420.21510078697 / 8.0),
- REAL_CONST(150446.47389406321 / 8.0),
- REAL_CONST(150472.73383318601 / 8.0),
- REAL_CONST(150498.99491805542 / 8.0),
- REAL_CONST(150525.25714857146 / 8.0),
- REAL_CONST(150551.52052463419 / 8.0),
- REAL_CONST(150577.78504614369 / 8.0),
- REAL_CONST(150604.05071300003 / 8.0),
- REAL_CONST(150630.31752510337 / 8.0),
- REAL_CONST(150656.58548235384 / 8.0),
- REAL_CONST(150682.85458465159 / 8.0),
- REAL_CONST(150709.1248318968 / 8.0),
- REAL_CONST(150735.39622398972 / 8.0),
- REAL_CONST(150761.66876083051 / 8.0),
- REAL_CONST(150787.9424423195 / 8.0),
- REAL_CONST(150814.21726835691 / 8.0),
- REAL_CONST(150840.49323884305 / 8.0),
- REAL_CONST(150866.77035367821 / 8.0),
- REAL_CONST(150893.04861276277 / 8.0),
- REAL_CONST(150919.32801599705 / 8.0),
- REAL_CONST(150945.60856328148 / 8.0),
- REAL_CONST(150971.89025451642 / 8.0),
- REAL_CONST(150998.17308960229 / 8.0),
- REAL_CONST(151024.45706843957 / 8.0),
- REAL_CONST(151050.74219092872 / 8.0),
- REAL_CONST(151077.02845697021 / 8.0),
- REAL_CONST(151103.31586646455 / 8.0),
- REAL_CONST(151129.60441931229 / 8.0),
- REAL_CONST(151155.894115414 / 8.0),
- REAL_CONST(151182.1849546702 / 8.0),
- REAL_CONST(151208.47693698155 / 8.0),
- REAL_CONST(151234.77006224863 / 8.0),
- REAL_CONST(151261.06433037209 / 8.0),
- REAL_CONST(151287.35974125259 / 8.0),
- REAL_CONST(151313.65629479082 / 8.0),
- REAL_CONST(151339.95399088747 / 8.0),
- REAL_CONST(151366.25282944329 / 8.0),
- REAL_CONST(151392.55281035902 / 8.0),
- REAL_CONST(151418.85393353543 / 8.0),
- REAL_CONST(151445.1561988733 / 8.0),
- REAL_CONST(151471.45960627345 / 8.0),
- REAL_CONST(151497.76415563675 / 8.0),
- REAL_CONST(151524.06984686397 / 8.0),
- REAL_CONST(151550.37667985607 / 8.0),
- REAL_CONST(151576.68465451393 / 8.0),
- REAL_CONST(151602.99377073845 / 8.0),
- REAL_CONST(151629.30402843058 / 8.0),
- REAL_CONST(151655.61542749128 / 8.0),
- REAL_CONST(151681.92796782157 / 8.0),
- REAL_CONST(151708.24164932242 / 8.0),
- REAL_CONST(151734.55647189484 / 8.0),
- REAL_CONST(151760.87243543993 / 8.0),
- REAL_CONST(151787.18953985872 / 8.0),
- REAL_CONST(151813.50778505235 / 8.0),
- REAL_CONST(151839.82717092187 / 8.0),
- REAL_CONST(151866.14769736846 / 8.0),
- REAL_CONST(151892.46936429327 / 8.0),
- REAL_CONST(151918.79217159748 / 8.0),
- REAL_CONST(151945.11611918229 / 8.0),
- REAL_CONST(151971.44120694889 / 8.0),
- REAL_CONST(151997.76743479856 / 8.0),
- REAL_CONST(152024.09480263255 / 8.0),
- REAL_CONST(152050.42331035214 / 8.0),
- REAL_CONST(152076.75295785864 / 8.0),
- REAL_CONST(152103.08374505339 / 8.0),
- REAL_CONST(152129.41567183775 / 8.0),
- REAL_CONST(152155.74873811303 / 8.0),
- REAL_CONST(152182.08294378067 / 8.0),
- REAL_CONST(152208.41828874208 / 8.0),
- REAL_CONST(152234.75477289871 / 8.0),
- REAL_CONST(152261.09239615197 / 8.0),
- REAL_CONST(152287.43115840337 / 8.0),
- REAL_CONST(152313.77105955439 / 8.0),
- REAL_CONST(152340.11209950657 / 8.0),
- REAL_CONST(152366.45427816146 / 8.0),
- REAL_CONST(152392.79759542056 / 8.0),
- REAL_CONST(152419.14205118554 / 8.0),
- REAL_CONST(152445.48764535793 / 8.0),
- REAL_CONST(152471.8343778394 / 8.0),
- REAL_CONST(152498.18224853161 / 8.0),
- REAL_CONST(152524.53125733617 / 8.0),
- REAL_CONST(152550.88140415482 / 8.0),
- REAL_CONST(152577.23268888926 / 8.0),
- REAL_CONST(152603.58511144121 / 8.0),
- REAL_CONST(152629.93867171241 / 8.0),
- REAL_CONST(152656.29336960468 / 8.0),
- REAL_CONST(152682.64920501978 / 8.0),
- REAL_CONST(152709.00617785956 / 8.0),
- REAL_CONST(152735.36428802583 / 8.0),
- REAL_CONST(152761.72353542043 / 8.0),
- REAL_CONST(152788.08391994529 / 8.0),
- REAL_CONST(152814.44544150229 / 8.0),
- REAL_CONST(152840.80809999333 / 8.0),
- REAL_CONST(152867.17189532038 / 8.0),
- REAL_CONST(152893.53682738543 / 8.0),
- REAL_CONST(152919.90289609041 / 8.0),
- REAL_CONST(152946.27010133737 / 8.0),
- REAL_CONST(152972.63844302832 / 8.0),
- REAL_CONST(152999.00792106529 / 8.0),
- REAL_CONST(153025.37853535041 / 8.0),
- REAL_CONST(153051.7502857857 / 8.0),
- REAL_CONST(153078.12317227334 / 8.0),
- REAL_CONST(153104.4971947154 / 8.0),
- REAL_CONST(153130.8723530141 / 8.0),
- REAL_CONST(153157.24864707157 / 8.0),
- REAL_CONST(153183.62607679001 / 8.0),
- REAL_CONST(153210.00464207167 / 8.0),
- REAL_CONST(153236.38434281875 / 8.0),
- REAL_CONST(153262.76517893354 / 8.0),
- REAL_CONST(153289.14715031831 / 8.0),
- REAL_CONST(153315.53025687535 / 8.0),
- REAL_CONST(153341.91449850702 / 8.0),
- REAL_CONST(153368.2998751156 / 8.0),
- REAL_CONST(153394.68638660354 / 8.0),
- REAL_CONST(153421.07403287315 / 8.0),
- REAL_CONST(153447.46281382689 / 8.0),
- REAL_CONST(153473.85272936718 / 8.0),
- REAL_CONST(153500.24377939643 / 8.0),
- REAL_CONST(153526.63596381716 / 8.0),
- REAL_CONST(153553.02928253182 / 8.0),
- REAL_CONST(153579.42373544298 / 8.0),
- REAL_CONST(153605.81932245308 / 8.0),
- REAL_CONST(153632.21604346478 / 8.0),
- REAL_CONST(153658.61389838057 / 8.0),
- REAL_CONST(153685.0128871031 / 8.0),
- REAL_CONST(153711.41300953497 / 8.0),
- REAL_CONST(153737.81426557881 / 8.0),
- REAL_CONST(153764.21665513728 / 8.0),
- REAL_CONST(153790.62017811305 / 8.0),
- REAL_CONST(153817.02483440886 / 8.0),
- REAL_CONST(153843.43062392739 / 8.0),
- REAL_CONST(153869.83754657139 / 8.0),
- REAL_CONST(153896.24560224367 / 8.0),
- REAL_CONST(153922.65479084692 / 8.0),
- REAL_CONST(153949.06511228404 / 8.0),
- REAL_CONST(153975.4765664578 / 8.0),
- REAL_CONST(154001.88915327107 / 8.0),
- REAL_CONST(154028.30287262669 / 8.0),
- REAL_CONST(154054.71772442761 / 8.0),
- REAL_CONST(154081.13370857667 / 8.0),
- REAL_CONST(154107.55082497682 / 8.0),
- REAL_CONST(154133.96907353101 / 8.0),
- REAL_CONST(154160.38845414223 / 8.0),
- REAL_CONST(154186.80896671346 / 8.0),
- REAL_CONST(154213.23061114774 / 8.0),
- REAL_CONST(154239.65338734805 / 8.0),
- REAL_CONST(154266.07729521746 / 8.0),
- REAL_CONST(154292.50233465908 / 8.0),
- REAL_CONST(154318.92850557598 / 8.0),
- REAL_CONST(154345.35580787127 / 8.0),
- REAL_CONST(154371.7842414481 / 8.0),
- REAL_CONST(154398.21380620965 / 8.0),
- REAL_CONST(154424.64450205903 / 8.0),
- REAL_CONST(154451.07632889951 / 8.0),
- REAL_CONST(154477.50928663427 / 8.0),
- REAL_CONST(154503.94337516659 / 8.0),
- REAL_CONST(154530.37859439969 / 8.0),
- REAL_CONST(154556.81494423689 / 8.0),
- REAL_CONST(154583.25242458144 / 8.0),
- REAL_CONST(154609.69103533673 / 8.0),
- REAL_CONST(154636.13077640603 / 8.0),
- REAL_CONST(154662.57164769279 / 8.0),
- REAL_CONST(154689.01364910032 / 8.0),
- REAL_CONST(154715.45678053208 / 8.0),
- REAL_CONST(154741.90104189145 / 8.0),
- REAL_CONST(154768.34643308193 / 8.0),
- REAL_CONST(154794.79295400696 / 8.0),
- REAL_CONST(154821.24060457002 / 8.0),
- REAL_CONST(154847.68938467462 / 8.0),
- REAL_CONST(154874.13929422433 / 8.0),
- REAL_CONST(154900.59033312264 / 8.0),
- REAL_CONST(154927.04250127316 / 8.0),
- REAL_CONST(154953.49579857948 / 8.0),
- REAL_CONST(154979.95022494521 / 8.0),
- REAL_CONST(155006.40578027396 / 8.0),
- REAL_CONST(155032.86246446942 / 8.0),
- REAL_CONST(155059.32027743524 / 8.0),
- REAL_CONST(155085.77921907514 / 8.0),
- REAL_CONST(155112.2392892928 / 8.0),
- REAL_CONST(155138.70048799197 / 8.0),
- REAL_CONST(155165.16281507642 / 8.0),
- REAL_CONST(155191.62627044989 / 8.0),
- REAL_CONST(155218.09085401625 / 8.0),
- REAL_CONST(155244.55656567923 / 8.0),
- REAL_CONST(155271.02340534274 / 8.0),
- REAL_CONST(155297.49137291059 / 8.0),
- REAL_CONST(155323.96046828668 / 8.0),
- REAL_CONST(155350.4306913749 / 8.0),
- REAL_CONST(155376.90204207919 / 8.0),
- REAL_CONST(155403.37452030348 / 8.0),
- REAL_CONST(155429.84812595171 / 8.0),
- REAL_CONST(155456.32285892789 / 8.0),
- REAL_CONST(155482.79871913602 / 8.0),
- REAL_CONST(155509.27570648011 / 8.0),
- REAL_CONST(155535.75382086422 / 8.0),
- REAL_CONST(155562.23306219239 / 8.0),
- REAL_CONST(155588.71343036872 / 8.0),
- REAL_CONST(155615.19492529731 / 8.0),
- REAL_CONST(155641.67754688227 / 8.0),
- REAL_CONST(155668.16129502779 / 8.0),
- REAL_CONST(155694.64616963797 / 8.0),
- REAL_CONST(155721.13217061706 / 8.0),
- REAL_CONST(155747.61929786921 / 8.0),
- REAL_CONST(155774.10755129869 / 8.0),
- REAL_CONST(155800.59693080973 / 8.0),
- REAL_CONST(155827.08743630661 / 8.0),
- REAL_CONST(155853.57906769359 / 8.0),
- REAL_CONST(155880.07182487496 / 8.0),
- REAL_CONST(155906.56570775513 / 8.0),
- REAL_CONST(155933.06071623837 / 8.0),
- REAL_CONST(155959.55685022907 / 8.0),
- REAL_CONST(155986.05410963166 / 8.0),
- REAL_CONST(156012.5524943505 / 8.0),
- REAL_CONST(156039.05200429002 / 8.0),
- REAL_CONST(156065.55263935472 / 8.0),
- REAL_CONST(156092.054399449 / 8.0),
- REAL_CONST(156118.5572844774 / 8.0),
- REAL_CONST(156145.06129434443 / 8.0),
- REAL_CONST(156171.5664289546 / 8.0),
- REAL_CONST(156198.07268821247 / 8.0),
- REAL_CONST(156224.5800720226 / 8.0),
- REAL_CONST(156251.08858028959 / 8.0),
- REAL_CONST(156277.59821291809 / 8.0),
- REAL_CONST(156304.10896981266 / 8.0),
- REAL_CONST(156330.62085087801 / 8.0),
- REAL_CONST(156357.1338560188 / 8.0),
- REAL_CONST(156383.64798513969 / 8.0),
- REAL_CONST(156410.16323814544 / 8.0),
- REAL_CONST(156436.67961494075 / 8.0),
- REAL_CONST(156463.1971154304 / 8.0),
- REAL_CONST(156489.71573951913 / 8.0),
- REAL_CONST(156516.23548711176 / 8.0),
- REAL_CONST(156542.75635811311 / 8.0),
- REAL_CONST(156569.27835242799 / 8.0),
- REAL_CONST(156595.80146996127 / 8.0),
- REAL_CONST(156622.32571061782 / 8.0),
- REAL_CONST(156648.85107430254 / 8.0),
- REAL_CONST(156675.37756092031 / 8.0),
- REAL_CONST(156701.90517037612 / 8.0),
- REAL_CONST(156728.43390257491 / 8.0),
- REAL_CONST(156754.96375742162 / 8.0),
- REAL_CONST(156781.49473482129 / 8.0),
- REAL_CONST(156808.02683467892 / 8.0),
- REAL_CONST(156834.5600568995 / 8.0),
- REAL_CONST(156861.09440138817 / 8.0),
- REAL_CONST(156887.62986804993 / 8.0),
- REAL_CONST(156914.16645678994 / 8.0),
- REAL_CONST(156940.70416751326 / 8.0),
- REAL_CONST(156967.24300012505 / 8.0),
- REAL_CONST(156993.78295453047 / 8.0),
- REAL_CONST(157020.32403063469 / 8.0),
- REAL_CONST(157046.8662283429 / 8.0),
- REAL_CONST(157073.40954756032 / 8.0),
- REAL_CONST(157099.9539881922 / 8.0),
- REAL_CONST(157126.49955014378 / 8.0),
- REAL_CONST(157153.04623332032 / 8.0),
- REAL_CONST(157179.59403762716 / 8.0),
- REAL_CONST(157206.14296296958 / 8.0),
- REAL_CONST(157232.69300925292 / 8.0),
- REAL_CONST(157259.24417638258 / 8.0),
- REAL_CONST(157285.79646426387 / 8.0),
- REAL_CONST(157312.34987280221 / 8.0),
- REAL_CONST(157338.90440190304 / 8.0),
- REAL_CONST(157365.46005147175 / 8.0),
- REAL_CONST(157392.01682141385 / 8.0),
- REAL_CONST(157418.57471163478 / 8.0),
- REAL_CONST(157445.13372204005 / 8.0),
- REAL_CONST(157471.69385253513 / 8.0),
- REAL_CONST(157498.25510302564 / 8.0),
- REAL_CONST(157524.81747341706 / 8.0),
- REAL_CONST(157551.38096361503 / 8.0),
- REAL_CONST(157577.9455735251 / 8.0),
- REAL_CONST(157604.51130305286 / 8.0),
- REAL_CONST(157631.07815210402 / 8.0),
- REAL_CONST(157657.64612058419 / 8.0),
- REAL_CONST(157684.21520839902 / 8.0),
- REAL_CONST(157710.78541545427 / 8.0),
- REAL_CONST(157737.35674165559 / 8.0),
- REAL_CONST(157763.92918690876 / 8.0),
- REAL_CONST(157790.50275111952 / 8.0),
- REAL_CONST(157817.07743419363 / 8.0),
- REAL_CONST(157843.65323603692 / 8.0),
- REAL_CONST(157870.23015655516 / 8.0),
- REAL_CONST(157896.80819565422 / 8.0),
- REAL_CONST(157923.3873532399 / 8.0),
- REAL_CONST(157949.96762921812 / 8.0),
- REAL_CONST(157976.54902349479 / 8.0),
- REAL_CONST(158003.13153597576 / 8.0),
- REAL_CONST(158029.71516656701 / 8.0),
- REAL_CONST(158056.29991517449 / 8.0),
- REAL_CONST(158082.88578170416 / 8.0),
- REAL_CONST(158109.47276606198 / 8.0),
- REAL_CONST(158136.06086815402 / 8.0),
- REAL_CONST(158162.65008788629 / 8.0),
- REAL_CONST(158189.24042516484 / 8.0),
- REAL_CONST(158215.83187989573 / 8.0),
- REAL_CONST(158242.42445198505 / 8.0),
- REAL_CONST(158269.01814133892 / 8.0),
- REAL_CONST(158295.61294786347 / 8.0),
- REAL_CONST(158322.20887146486 / 8.0),
- REAL_CONST(158348.80591204923 / 8.0),
- REAL_CONST(158375.4040695228 / 8.0),
- REAL_CONST(158402.00334379176 / 8.0),
- REAL_CONST(158428.60373476235 / 8.0),
- REAL_CONST(158455.2052423408 / 8.0),
- REAL_CONST(158481.80786643337 / 8.0),
- REAL_CONST(158508.41160694641 / 8.0),
- REAL_CONST(158535.01646378616 / 8.0),
- REAL_CONST(158561.62243685898 / 8.0),
- REAL_CONST(158588.2295260712 / 8.0),
- REAL_CONST(158614.8377313292 / 8.0),
- REAL_CONST(158641.44705253936 / 8.0),
- REAL_CONST(158668.05748960807 / 8.0),
- REAL_CONST(158694.66904244179 / 8.0),
- REAL_CONST(158721.28171094693 / 8.0),
- REAL_CONST(158747.89549502998 / 8.0),
- REAL_CONST(158774.5103945974 / 8.0),
- REAL_CONST(158801.12640955573 / 8.0),
- REAL_CONST(158827.74353981143 / 8.0),
- REAL_CONST(158854.36178527112 / 8.0),
- REAL_CONST(158880.9811458413 / 8.0),
- REAL_CONST(158907.60162142856 / 8.0),
- REAL_CONST(158934.22321193956 / 8.0),
- REAL_CONST(158960.84591728085 / 8.0),
- REAL_CONST(158987.46973735912 / 8.0),
- REAL_CONST(159014.09467208097 / 8.0),
- REAL_CONST(159040.72072135314 / 8.0),
- REAL_CONST(159067.3478850823 / 8.0),
- REAL_CONST(159093.97616317519 / 8.0),
- REAL_CONST(159120.60555553852 / 8.0),
- REAL_CONST(159147.23606207906 / 8.0),
- REAL_CONST(159173.8676827036 / 8.0),
- REAL_CONST(159200.50041731889 / 8.0),
- REAL_CONST(159227.13426583182 / 8.0),
- REAL_CONST(159253.76922814918 / 8.0),
- REAL_CONST(159280.40530417781 / 8.0),
- REAL_CONST(159307.04249382461 / 8.0),
- REAL_CONST(159333.68079699649 / 8.0),
- REAL_CONST(159360.32021360032 / 8.0),
- REAL_CONST(159386.96074354305 / 8.0),
- REAL_CONST(159413.60238673165 / 8.0),
- REAL_CONST(159440.24514307309 / 8.0),
- REAL_CONST(159466.88901247433 / 8.0),
- REAL_CONST(159493.53399484244 / 8.0),
- REAL_CONST(159520.18009008438 / 8.0),
- REAL_CONST(159546.82729810724 / 8.0),
- REAL_CONST(159573.47561881805 / 8.0),
- REAL_CONST(159600.12505212394 / 8.0),
- REAL_CONST(159626.77559793202 / 8.0),
- REAL_CONST(159653.42725614941 / 8.0),
- REAL_CONST(159680.08002668325 / 8.0),
- REAL_CONST(159706.73390944069 / 8.0),
- REAL_CONST(159733.38890432892 / 8.0),
- REAL_CONST(159760.04501125516 / 8.0),
- REAL_CONST(159786.70223012666 / 8.0),
- REAL_CONST(159813.36056085059 / 8.0),
- REAL_CONST(159840.02000333427 / 8.0),
- REAL_CONST(159866.68055748497 / 8.0),
- REAL_CONST(159893.34222320997 / 8.0),
- REAL_CONST(159920.00500041663 / 8.0),
- REAL_CONST(159946.66888901225 / 8.0),
- REAL_CONST(159973.33388890422 / 8.0),
- REAL_CONST(159999.99999999988 / 8.0),
- REAL_CONST(160026.66722220668 / 8.0),
- REAL_CONST(160053.33555543202 / 8.0),
- REAL_CONST(160080.0049995833 / 8.0),
- REAL_CONST(160106.67555456801 / 8.0),
- REAL_CONST(160133.3472202936 / 8.0),
- REAL_CONST(160160.0199966676 / 8.0),
- REAL_CONST(160186.6938835975 / 8.0),
- REAL_CONST(160213.36888099083 / 8.0),
- REAL_CONST(160240.04498875517 / 8.0),
- REAL_CONST(160266.72220679806 / 8.0),
- REAL_CONST(160293.40053502709 / 8.0),
- REAL_CONST(160320.07997334987 / 8.0),
- REAL_CONST(160346.76052167406 / 8.0),
- REAL_CONST(160373.44217990729 / 8.0),
- REAL_CONST(160400.1249479572 / 8.0),
- REAL_CONST(160426.80882573154 / 8.0),
- REAL_CONST(160453.49381313793 / 8.0),
- REAL_CONST(160480.17991008417 / 8.0),
- REAL_CONST(160506.86711647795 / 8.0),
- REAL_CONST(160533.55543222709 / 8.0),
- REAL_CONST(160560.24485723933 / 8.0),
- REAL_CONST(160586.93539142248 / 8.0),
- REAL_CONST(160613.62703468435 / 8.0),
- REAL_CONST(160640.31978693281 / 8.0),
- REAL_CONST(160667.01364807569 / 8.0),
- REAL_CONST(160693.70861802087 / 8.0),
- REAL_CONST(160720.40469667627 / 8.0),
- REAL_CONST(160747.1018839498 / 8.0),
- REAL_CONST(160773.80017974938 / 8.0),
- REAL_CONST(160800.49958398298 / 8.0),
- REAL_CONST(160827.20009655855 / 8.0),
- REAL_CONST(160853.90171738411 / 8.0),
- REAL_CONST(160880.60444636765 / 8.0),
- REAL_CONST(160907.30828341722 / 8.0),
- REAL_CONST(160934.01322844089 / 8.0),
- REAL_CONST(160960.71928134665 / 8.0),
- REAL_CONST(160987.42644204266 / 8.0),
- REAL_CONST(161014.13471043704 / 8.0),
- REAL_CONST(161040.84408643784 / 8.0),
- REAL_CONST(161067.55456995327 / 8.0),
- REAL_CONST(161094.26616089148 / 8.0),
- REAL_CONST(161120.97885916062 / 8.0),
- REAL_CONST(161147.69266466892 / 8.0),
- REAL_CONST(161174.40757732463 / 8.0),
- REAL_CONST(161201.12359703594 / 8.0),
- REAL_CONST(161227.84072371112 / 8.0),
- REAL_CONST(161254.55895725847 / 8.0),
- REAL_CONST(161281.27829758628 / 8.0),
- REAL_CONST(161307.99874460287 / 8.0),
- REAL_CONST(161334.72029821656 / 8.0),
- REAL_CONST(161361.44295833571 / 8.0),
- REAL_CONST(161388.1667248687 / 8.0),
- REAL_CONST(161414.89159772391 / 8.0),
- REAL_CONST(161441.61757680977 / 8.0),
- REAL_CONST(161468.34466203468 / 8.0),
- REAL_CONST(161495.07285330712 / 8.0),
- REAL_CONST(161521.80215053557 / 8.0),
- REAL_CONST(161548.53255362847 / 8.0),
- REAL_CONST(161575.26406249436 / 8.0),
- REAL_CONST(161601.99667704175 / 8.0),
- REAL_CONST(161628.7303971792 / 8.0),
- REAL_CONST(161655.46522281526 / 8.0),
- REAL_CONST(161682.20115385848 / 8.0),
- REAL_CONST(161708.93819021754 / 8.0),
- REAL_CONST(161735.67633180099 / 8.0),
- REAL_CONST(161762.41557851751 / 8.0),
- REAL_CONST(161789.15593027571 / 8.0),
- REAL_CONST(161815.89738698432 / 8.0),
- REAL_CONST(161842.63994855201 / 8.0),
- REAL_CONST(161869.38361488748 / 8.0),
- REAL_CONST(161896.1283858995 / 8.0),
- REAL_CONST(161922.87426149679 / 8.0),
- REAL_CONST(161949.62124158812 / 8.0),
- REAL_CONST(161976.36932608229 / 8.0),
- REAL_CONST(162003.1185148881 / 8.0),
- REAL_CONST(162029.8688079144 / 8.0),
- REAL_CONST(162056.62020507001 / 8.0),
- REAL_CONST(162083.37270626382 / 8.0),
- REAL_CONST(162110.12631140469 / 8.0),
- REAL_CONST(162136.88102040152 / 8.0),
- REAL_CONST(162163.63683316324 / 8.0),
- REAL_CONST(162190.39374959879 / 8.0),
- REAL_CONST(162217.15176961714 / 8.0),
- REAL_CONST(162243.91089312723 / 8.0),
- REAL_CONST(162270.67112003808 / 8.0),
- REAL_CONST(162297.43245025873 / 8.0),
- REAL_CONST(162324.19488369819 / 8.0),
- REAL_CONST(162350.9584202655 / 8.0),
- REAL_CONST(162377.72305986975 / 8.0),
- REAL_CONST(162404.48880242003 / 8.0),
- REAL_CONST(162431.25564782543 / 8.0),
- REAL_CONST(162458.02359599507 / 8.0),
- REAL_CONST(162484.79264683815 / 8.0),
- REAL_CONST(162511.56280026378 / 8.0),
- REAL_CONST(162538.33405618116 / 8.0),
- REAL_CONST(162565.10641449949 / 8.0),
- REAL_CONST(162591.87987512801 / 8.0),
- REAL_CONST(162618.65443797593 / 8.0),
- REAL_CONST(162645.43010295252 / 8.0),
- REAL_CONST(162672.20686996708 / 8.0),
- REAL_CONST(162698.98473892888 / 8.0),
- REAL_CONST(162725.76370974723 / 8.0),
- REAL_CONST(162752.54378233149 / 8.0),
- REAL_CONST(162779.32495659095 / 8.0),
- REAL_CONST(162806.10723243505 / 8.0),
- REAL_CONST(162832.89060977317 / 8.0),
- REAL_CONST(162859.67508851466 / 8.0),
- REAL_CONST(162886.46066856899 / 8.0),
- REAL_CONST(162913.24734984562 / 8.0),
- REAL_CONST(162940.03513225398 / 8.0),
- REAL_CONST(162966.82401570358 / 8.0),
- REAL_CONST(162993.6140001039 / 8.0),
- REAL_CONST(163020.40508536444 / 8.0),
- REAL_CONST(163047.19727139481 / 8.0),
- REAL_CONST(163073.99055810447 / 8.0),
- REAL_CONST(163100.78494540305 / 8.0),
- REAL_CONST(163127.58043320014 / 8.0),
- REAL_CONST(163154.37702140535 / 8.0),
- REAL_CONST(163181.17470992831 / 8.0),
- REAL_CONST(163207.97349867865 / 8.0),
- REAL_CONST(163234.77338756606 / 8.0),
- REAL_CONST(163261.57437650024 / 8.0),
- REAL_CONST(163288.37646539087 / 8.0),
- REAL_CONST(163315.17965414765 / 8.0),
- REAL_CONST(163341.98394268038 / 8.0),
- REAL_CONST(163368.78933089875 / 8.0),
- REAL_CONST(163395.59581871261 / 8.0),
- REAL_CONST(163422.40340603172 / 8.0),
- REAL_CONST(163449.2120927659 / 8.0),
- REAL_CONST(163476.02187882498 / 8.0),
- REAL_CONST(163502.83276411882 / 8.0),
- REAL_CONST(163529.6447485573 / 8.0),
- REAL_CONST(163556.45783205028 / 8.0),
- REAL_CONST(163583.2720145077 / 8.0),
- REAL_CONST(163610.08729583945 / 8.0),
- REAL_CONST(163636.90367595552 / 8.0),
- REAL_CONST(163663.72115476584 / 8.0),
- REAL_CONST(163690.53973218042 / 8.0),
- REAL_CONST(163717.35940810922 / 8.0),
- REAL_CONST(163744.18018246227 / 8.0),
- REAL_CONST(163771.00205514964 / 8.0),
- REAL_CONST(163797.82502608138 / 8.0),
- REAL_CONST(163824.64909516752 / 8.0),
- REAL_CONST(163851.4742623182 / 8.0),
- REAL_CONST(163878.3005274435 / 8.0),
- REAL_CONST(163905.12789045356 / 8.0),
- REAL_CONST(163931.95635125853 / 8.0),
- REAL_CONST(163958.78590976857 / 8.0),
- REAL_CONST(163985.61656589387 / 8.0),
- REAL_CONST(164012.44831954464 / 8.0),
- REAL_CONST(164039.28117063109 / 8.0),
- REAL_CONST(164066.11511906344 / 8.0),
- REAL_CONST(164092.95016475199 / 8.0),
- REAL_CONST(164119.78630760699 / 8.0),
- REAL_CONST(164146.62354753874 / 8.0),
- REAL_CONST(164173.46188445756 / 8.0),
- REAL_CONST(164200.30131827376 / 8.0),
- REAL_CONST(164227.14184889771 / 8.0),
- REAL_CONST(164253.98347623978 / 8.0),
- REAL_CONST(164280.82620021031 / 8.0),
- REAL_CONST(164307.67002071979 / 8.0),
- REAL_CONST(164334.51493767856 / 8.0),
- REAL_CONST(164361.3609509971 / 8.0),
- REAL_CONST(164388.20806058586 / 8.0),
- REAL_CONST(164415.05626635533 / 8.0),
- REAL_CONST(164441.905568216 / 8.0),
- REAL_CONST(164468.75596607837 / 8.0),
- REAL_CONST(164495.607459853 / 8.0),
- REAL_CONST(164522.4600494504 / 8.0),
- REAL_CONST(164549.31373478117 / 8.0),
- REAL_CONST(164576.16851575591 / 8.0),
- REAL_CONST(164603.02439228518 / 8.0),
- REAL_CONST(164629.88136427966 / 8.0),
- REAL_CONST(164656.73943164994 / 8.0),
- REAL_CONST(164683.59859430668 / 8.0),
- REAL_CONST(164710.45885216061 / 8.0),
- REAL_CONST(164737.32020512238 / 8.0),
- REAL_CONST(164764.1826531027 / 8.0),
- REAL_CONST(164791.04619601235 / 8.0),
- REAL_CONST(164817.91083376206 / 8.0),
- REAL_CONST(164844.77656626256 / 8.0),
- REAL_CONST(164871.64339342469 / 8.0),
- REAL_CONST(164898.51131515924 / 8.0),
- REAL_CONST(164925.38033137703 / 8.0),
- REAL_CONST(164952.25044198887 / 8.0),
- REAL_CONST(164979.1216469057 / 8.0),
- REAL_CONST(165005.9939460383 / 8.0),
- REAL_CONST(165032.86733929763 / 8.0),
- REAL_CONST(165059.7418265946 / 8.0),
- REAL_CONST(165086.61740784015 / 8.0),
- REAL_CONST(165113.4940829452 / 8.0)
+ ,REAL_CONST(10348.160302127204/8.0),
+ REAL_CONST(10361.610387800878/8.0),
+ REAL_CONST(10375.064839677221/8.0),
+ REAL_CONST(10388.523654924258/8.0),
+ REAL_CONST(10401.986830714593/8.0),
+ REAL_CONST(10415.454364225412/8.0),
+ REAL_CONST(10428.926252638465/8.0),
+ REAL_CONST(10442.402493140049/8.0),
+ REAL_CONST(10455.883082921007/8.0),
+ REAL_CONST(10469.368019176709/8.0),
+ REAL_CONST(10482.85729910704/8.0),
+ REAL_CONST(10496.350919916393/8.0),
+ REAL_CONST(10509.848878813653/8.0),
+ REAL_CONST(10523.351173012188/8.0),
+ REAL_CONST(10536.857799729838/8.0),
+ REAL_CONST(10550.3687561889/8.0),
+ REAL_CONST(10563.884039616123/8.0),
+ REAL_CONST(10577.403647242685/8.0),
+ REAL_CONST(10590.927576304197/8.0),
+ REAL_CONST(10604.455824040679/8.0),
+ REAL_CONST(10617.988387696556/8.0),
+ REAL_CONST(10631.525264520642/8.0),
+ REAL_CONST(10645.066451766135/8.0),
+ REAL_CONST(10658.611946690598/8.0),
+ REAL_CONST(10672.161746555956/8.0),
+ REAL_CONST(10685.715848628475/8.0),
+ REAL_CONST(10699.274250178762/8.0),
+ REAL_CONST(10712.836948481747/8.0),
+ REAL_CONST(10726.403940816675/8.0),
+ REAL_CONST(10739.975224467091/8.0),
+ REAL_CONST(10753.550796720834/8.0),
+ REAL_CONST(10767.130654870027/8.0),
+ REAL_CONST(10780.714796211059/8.0),
+ REAL_CONST(10794.303218044579/8.0),
+ REAL_CONST(10807.895917675487/8.0),
+ REAL_CONST(10821.492892412922/8.0),
+ REAL_CONST(10835.094139570248/8.0),
+ REAL_CONST(10848.699656465047/8.0),
+ REAL_CONST(10862.309440419107/8.0),
+ REAL_CONST(10875.923488758415/8.0),
+ REAL_CONST(10889.541798813138/8.0),
+ REAL_CONST(10903.16436791762/8.0),
+ REAL_CONST(10916.791193410372/8.0),
+ REAL_CONST(10930.422272634056/8.0),
+ REAL_CONST(10944.05760293548/8.0),
+ REAL_CONST(10957.697181665582/8.0),
+ REAL_CONST(10971.341006179427/8.0),
+ REAL_CONST(10984.98907383619/8.0),
+ REAL_CONST(10998.641381999149/8.0),
+ REAL_CONST(11012.297928035676/8.0),
+ REAL_CONST(11025.958709317223/8.0),
+ REAL_CONST(11039.623723219316/8.0),
+ REAL_CONST(11053.292967121541/8.0),
+ REAL_CONST(11066.966438407539/8.0),
+ REAL_CONST(11080.64413446499/8.0),
+ REAL_CONST(11094.326052685608/8.0),
+ REAL_CONST(11108.012190465128/8.0),
+ REAL_CONST(11121.702545203296/8.0),
+ REAL_CONST(11135.397114303863/8.0),
+ REAL_CONST(11149.095895174571/8.0),
+ REAL_CONST(11162.798885227143/8.0),
+ REAL_CONST(11176.506081877278/8.0),
+ REAL_CONST(11190.217482544635/8.0),
+ REAL_CONST(11203.933084652828/8.0),
+ REAL_CONST(11217.652885629415/8.0),
+ REAL_CONST(11231.376882905886/8.0),
+ REAL_CONST(11245.105073917659/8.0),
+ REAL_CONST(11258.837456104062/8.0),
+ REAL_CONST(11272.574026908333/8.0),
+ REAL_CONST(11286.314783777601/8.0),
+ REAL_CONST(11300.059724162888/8.0),
+ REAL_CONST(11313.808845519083/8.0),
+ REAL_CONST(11327.562145304952/8.0),
+ REAL_CONST(11341.319620983111/8.0),
+ REAL_CONST(11355.081270020033/8.0),
+ REAL_CONST(11368.847089886023/8.0),
+ REAL_CONST(11382.617078055218/8.0),
+ REAL_CONST(11396.391232005579/8.0),
+ REAL_CONST(11410.169549218874/8.0),
+ REAL_CONST(11423.952027180676/8.0),
+ REAL_CONST(11437.738663380349/8.0),
+ REAL_CONST(11451.529455311042/8.0),
+ REAL_CONST(11465.324400469679/8.0),
+ REAL_CONST(11479.123496356951/8.0),
+ REAL_CONST(11492.926740477304/8.0),
+ REAL_CONST(11506.734130338931/8.0),
+ REAL_CONST(11520.545663453764/8.0),
+ REAL_CONST(11534.361337337466/8.0),
+ REAL_CONST(11548.181149509423/8.0),
+ REAL_CONST(11562.005097492724/8.0),
+ REAL_CONST(11575.83317881417/8.0),
+ REAL_CONST(11589.665391004253/8.0),
+ REAL_CONST(11603.501731597149/8.0),
+ REAL_CONST(11617.342198130715/8.0),
+ REAL_CONST(11631.186788146468/8.0),
+ REAL_CONST(11645.035499189589/8.0),
+ REAL_CONST(11658.888328808911/8.0),
+ REAL_CONST(11672.745274556904/8.0),
+ REAL_CONST(11686.606333989675/8.0),
+ REAL_CONST(11700.471504666955/8.0),
+ REAL_CONST(11714.340784152086/8.0),
+ REAL_CONST(11728.214170012021/8.0),
+ REAL_CONST(11742.091659817312/8.0),
+ REAL_CONST(11755.973251142101/8.0),
+ REAL_CONST(11769.858941564111/8.0),
+ REAL_CONST(11783.748728664636/8.0),
+ REAL_CONST(11797.642610028539/8.0),
+ REAL_CONST(11811.540583244237/8.0),
+ REAL_CONST(11825.442645903697/8.0),
+ REAL_CONST(11839.34879560242/8.0),
+ REAL_CONST(11853.259029939445/8.0),
+ REAL_CONST(11867.173346517333/8.0),
+ REAL_CONST(11881.091742942155/8.0),
+ REAL_CONST(11895.014216823492/8.0),
+ REAL_CONST(11908.940765774427/8.0),
+ REAL_CONST(11922.871387411526/8.0),
+ REAL_CONST(11936.806079354839/8.0),
+ REAL_CONST(11950.744839227897/8.0),
+ REAL_CONST(11964.687664657684/8.0),
+ REAL_CONST(11978.634553274653/8.0),
+ REAL_CONST(11992.585502712702/8.0),
+ REAL_CONST(12006.540510609168/8.0),
+ REAL_CONST(12020.499574604828/8.0),
+ REAL_CONST(12034.462692343877/8.0),
+ REAL_CONST(12048.429861473938/8.0),
+ REAL_CONST(12062.401079646032/8.0),
+ REAL_CONST(12076.376344514589/8.0),
+ REAL_CONST(12090.355653737433/8.0),
+ REAL_CONST(12104.339004975769/8.0),
+ REAL_CONST(12118.326395894188/8.0),
+ REAL_CONST(12132.317824160644/8.0),
+ REAL_CONST(12146.313287446457/8.0),
+ REAL_CONST(12160.312783426305/8.0),
+ REAL_CONST(12174.316309778205/8.0),
+ REAL_CONST(12188.323864183525/8.0),
+ REAL_CONST(12202.335444326955/8.0),
+ REAL_CONST(12216.351047896511/8.0),
+ REAL_CONST(12230.370672583531/8.0),
+ REAL_CONST(12244.394316082657/8.0),
+ REAL_CONST(12258.421976091831/8.0),
+ REAL_CONST(12272.453650312296/8.0),
+ REAL_CONST(12286.489336448574/8.0),
+ REAL_CONST(12300.529032208471/8.0),
+ REAL_CONST(12314.572735303058/8.0),
+ REAL_CONST(12328.620443446678/8.0),
+ REAL_CONST(12342.672154356922/8.0),
+ REAL_CONST(12356.727865754638/8.0),
+ REAL_CONST(12370.787575363909/8.0),
+ REAL_CONST(12384.851280912055/8.0),
+ REAL_CONST(12398.918980129623/8.0),
+ REAL_CONST(12412.990670750381/8.0),
+ REAL_CONST(12427.066350511306/8.0),
+ REAL_CONST(12441.146017152583/8.0),
+ REAL_CONST(12455.229668417589/8.0),
+ REAL_CONST(12469.317302052901/8.0),
+ REAL_CONST(12483.40891580827/8.0),
+ REAL_CONST(12497.50450743663/8.0),
+ REAL_CONST(12511.604074694078/8.0),
+ REAL_CONST(12525.707615339878/8.0),
+ REAL_CONST(12539.815127136444/8.0),
+ REAL_CONST(12553.926607849342/8.0),
+ REAL_CONST(12568.042055247275/8.0),
+ REAL_CONST(12582.161467102082/8.0),
+ REAL_CONST(12596.284841188726/8.0),
+ REAL_CONST(12610.41217528529/8.0),
+ REAL_CONST(12624.543467172971/8.0),
+ REAL_CONST(12638.678714636069/8.0),
+ REAL_CONST(12652.817915461985/8.0),
+ REAL_CONST(12666.961067441209/8.0),
+ REAL_CONST(12681.108168367316/8.0),
+ REAL_CONST(12695.259216036962/8.0),
+ REAL_CONST(12709.414208249869/8.0),
+ REAL_CONST(12723.573142808827/8.0),
+ REAL_CONST(12737.736017519681/8.0),
+ REAL_CONST(12751.902830191326/8.0),
+ REAL_CONST(12766.073578635704/8.0),
+ REAL_CONST(12780.248260667788/8.0),
+ REAL_CONST(12794.426874105588/8.0),
+ REAL_CONST(12808.609416770132/8.0),
+ REAL_CONST(12822.795886485468/8.0),
+ REAL_CONST(12836.986281078653/8.0),
+ REAL_CONST(12851.180598379744/8.0),
+ REAL_CONST(12865.378836221802/8.0),
+ REAL_CONST(12879.580992440871/8.0),
+ REAL_CONST(12893.787064875984/8.0),
+ REAL_CONST(12907.997051369144/8.0),
+ REAL_CONST(12922.210949765335/8.0),
+ REAL_CONST(12936.428757912496/8.0),
+ REAL_CONST(12950.650473661524/8.0),
+ REAL_CONST(12964.876094866273/8.0),
+ REAL_CONST(12979.105619383534/8.0),
+ REAL_CONST(12993.339045073039/8.0),
+ REAL_CONST(13007.576369797454/8.0),
+ REAL_CONST(13021.817591422368/8.0),
+ REAL_CONST(13036.062707816285/8.0),
+ REAL_CONST(13050.311716850629/8.0),
+ REAL_CONST(13064.564616399723/8.0),
+ REAL_CONST(13078.821404340792/8.0),
+ REAL_CONST(13093.082078553954/8.0),
+ REAL_CONST(13107.346636922217/8.0),
+ REAL_CONST(13121.615077331464/8.0),
+ REAL_CONST(13135.887397670458/8.0),
+ REAL_CONST(13150.163595830827/8.0),
+ REAL_CONST(13164.44366970706/8.0),
+ REAL_CONST(13178.727617196502/8.0),
+ REAL_CONST(13193.015436199352/8.0),
+ REAL_CONST(13207.307124618648/8.0),
+ REAL_CONST(13221.602680360265/8.0),
+ REAL_CONST(13235.902101332911/8.0),
+ REAL_CONST(13250.205385448118/8.0),
+ REAL_CONST(13264.512530620239/8.0),
+ REAL_CONST(13278.823534766434/8.0),
+ REAL_CONST(13293.138395806676/8.0),
+ REAL_CONST(13307.457111663734/8.0),
+ REAL_CONST(13321.779680263176/8.0),
+ REAL_CONST(13336.106099533356/8.0),
+ REAL_CONST(13350.436367405409/8.0),
+ REAL_CONST(13364.77048181325/8.0),
+ REAL_CONST(13379.108440693562/8.0),
+ REAL_CONST(13393.450241985796/8.0),
+ REAL_CONST(13407.795883632158/8.0),
+ REAL_CONST(13422.145363577607/8.0),
+ REAL_CONST(13436.498679769853/8.0),
+ REAL_CONST(13450.855830159346/8.0),
+ REAL_CONST(13465.216812699266/8.0),
+ REAL_CONST(13479.581625345529/8.0),
+ REAL_CONST(13493.950266056772/8.0),
+ REAL_CONST(13508.32273279435/8.0),
+ REAL_CONST(13522.699023522329/8.0),
+ REAL_CONST(13537.079136207483/8.0),
+ REAL_CONST(13551.463068819286/8.0),
+ REAL_CONST(13565.850819329906/8.0),
+ REAL_CONST(13580.2423857142/8.0),
+ REAL_CONST(13594.63776594971/8.0),
+ REAL_CONST(13609.036958016657/8.0),
+ REAL_CONST(13623.439959897927/8.0),
+ REAL_CONST(13637.846769579081/8.0),
+ REAL_CONST(13652.257385048335/8.0),
+ REAL_CONST(13666.67180429656/8.0),
+ REAL_CONST(13681.090025317284/8.0),
+ REAL_CONST(13695.512046106669/8.0),
+ REAL_CONST(13709.937864663521/8.0),
+ REAL_CONST(13724.367478989278/8.0),
+ REAL_CONST(13738.800887088004/8.0),
+ REAL_CONST(13753.238086966385/8.0),
+ REAL_CONST(13767.679076633727/8.0),
+ REAL_CONST(13782.123854101939/8.0),
+ REAL_CONST(13796.572417385545/8.0),
+ REAL_CONST(13811.024764501659/8.0),
+ REAL_CONST(13825.480893469998/8.0),
+ REAL_CONST(13839.94080231286/8.0),
+ REAL_CONST(13854.404489055134/8.0),
+ REAL_CONST(13868.871951724283/8.0),
+ REAL_CONST(13883.34318835034/8.0),
+ REAL_CONST(13897.818196965914/8.0),
+ REAL_CONST(13912.296975606168/8.0),
+ REAL_CONST(13926.779522308825/8.0),
+ REAL_CONST(13941.26583511416/8.0),
+ REAL_CONST(13955.755912064991/8.0),
+ REAL_CONST(13970.249751206682/8.0),
+ REAL_CONST(13984.747350587126/8.0),
+ REAL_CONST(13999.248708256751/8.0),
+ REAL_CONST(14013.753822268511/8.0),
+ REAL_CONST(14028.262690677873/8.0),
+ REAL_CONST(14042.775311542828/8.0),
+ REAL_CONST(14057.291682923867/8.0),
+ REAL_CONST(14071.811802883994/8.0),
+ REAL_CONST(14086.335669488704/8.0),
+ REAL_CONST(14100.863280805994/8.0),
+ REAL_CONST(14115.394634906341/8.0),
+ REAL_CONST(14129.92972986271/8.0),
+ REAL_CONST(14144.468563750548/8.0),
+ REAL_CONST(14159.01113464777/8.0),
+ REAL_CONST(14173.55744063476/8.0),
+ REAL_CONST(14188.107479794369/8.0),
+ REAL_CONST(14202.661250211901/8.0),
+ REAL_CONST(14217.218749975118/8.0),
+ REAL_CONST(14231.779977174227/8.0),
+ REAL_CONST(14246.344929901879/8.0),
+ REAL_CONST(14260.913606253163/8.0),
+ REAL_CONST(14275.486004325601/8.0),
+ REAL_CONST(14290.062122219146/8.0),
+ REAL_CONST(14304.641958036171/8.0),
+ REAL_CONST(14319.225509881464/8.0),
+ REAL_CONST(14333.812775862236/8.0),
+ REAL_CONST(14348.403754088098/8.0),
+ REAL_CONST(14362.998442671067/8.0),
+ REAL_CONST(14377.59683972556/8.0),
+ REAL_CONST(14392.198943368388/8.0),
+ REAL_CONST(14406.804751718748/8.0),
+ REAL_CONST(14421.414262898223/8.0),
+ REAL_CONST(14436.027475030774/8.0),
+ REAL_CONST(14450.64438624274/8.0),
+ REAL_CONST(14465.264994662828/8.0),
+ REAL_CONST(14479.889298422106/8.0),
+ REAL_CONST(14494.517295654005/8.0),
+ REAL_CONST(14509.148984494313/8.0),
+ REAL_CONST(14523.784363081166/8.0),
+ REAL_CONST(14538.423429555049/8.0),
+ REAL_CONST(14553.066182058781/8.0),
+ REAL_CONST(14567.712618737527/8.0),
+ REAL_CONST(14582.362737738777/8.0),
+ REAL_CONST(14597.016537212348/8.0),
+ REAL_CONST(14611.674015310382/8.0),
+ REAL_CONST(14626.33517018734/8.0),
+ REAL_CONST(14640.999999999993/8.0),
+ REAL_CONST(14655.668502907418/8.0),
+ REAL_CONST(14670.340677071003/8.0),
+ REAL_CONST(14685.016520654426/8.0),
+ REAL_CONST(14699.696031823671/8.0),
+ REAL_CONST(14714.379208746999/8.0),
+ REAL_CONST(14729.066049594967/8.0),
+ REAL_CONST(14743.756552540408/8.0),
+ REAL_CONST(14758.45071575843/8.0),
+ REAL_CONST(14773.148537426418/8.0),
+ REAL_CONST(14787.850015724018/8.0),
+ REAL_CONST(14802.555148833142/8.0),
+ REAL_CONST(14817.263934937961/8.0),
+ REAL_CONST(14831.976372224897/8.0),
+ REAL_CONST(14846.692458882624/8.0),
+ REAL_CONST(14861.41219310206/8.0),
+ REAL_CONST(14876.135573076363/8.0),
+ REAL_CONST(14890.862597000923/8.0),
+ REAL_CONST(14905.593263073371/8.0),
+ REAL_CONST(14920.327569493558/8.0),
+ REAL_CONST(14935.065514463557/8.0),
+ REAL_CONST(14949.807096187662/8.0),
+ REAL_CONST(14964.552312872382/8.0),
+ REAL_CONST(14979.301162726431/8.0),
+ REAL_CONST(14994.053643960735/8.0),
+ REAL_CONST(15008.809754788414/8.0),
+ REAL_CONST(15023.569493424788/8.0),
+ REAL_CONST(15038.332858087369/8.0),
+ REAL_CONST(15053.099846995858/8.0),
+ REAL_CONST(15067.870458372134/8.0),
+ REAL_CONST(15082.644690440264/8.0),
+ REAL_CONST(15097.422541426484/8.0),
+ REAL_CONST(15112.204009559202/8.0),
+ REAL_CONST(15126.989093068994/8.0),
+ REAL_CONST(15141.777790188597/8.0),
+ REAL_CONST(15156.570099152905/8.0),
+ REAL_CONST(15171.366018198967/8.0),
+ REAL_CONST(15186.165545565986/8.0),
+ REAL_CONST(15200.968679495301/8.0),
+ REAL_CONST(15215.775418230402/8.0),
+ REAL_CONST(15230.585760016909/8.0),
+ REAL_CONST(15245.399703102579/8.0),
+ REAL_CONST(15260.217245737298/8.0),
+ REAL_CONST(15275.038386173073/8.0),
+ REAL_CONST(15289.863122664035/8.0),
+ REAL_CONST(15304.691453466432/8.0),
+ REAL_CONST(15319.523376838621/8.0),
+ REAL_CONST(15334.358891041069/8.0),
+ REAL_CONST(15349.197994336346/8.0),
+ REAL_CONST(15364.040684989128/8.0),
+ REAL_CONST(15378.886961266177/8.0),
+ REAL_CONST(15393.736821436356/8.0),
+ REAL_CONST(15408.590263770609/8.0),
+ REAL_CONST(15423.447286541972/8.0),
+ REAL_CONST(15438.307888025554/8.0),
+ REAL_CONST(15453.172066498542/8.0),
+ REAL_CONST(15468.039820240196/8.0),
+ REAL_CONST(15482.91114753184/8.0),
+ REAL_CONST(15497.786046656869/8.0),
+ REAL_CONST(15512.664515900733/8.0),
+ REAL_CONST(15527.546553550939/8.0),
+ REAL_CONST(15542.432157897045/8.0),
+ REAL_CONST(15557.32132723066/8.0),
+ REAL_CONST(15572.214059845435/8.0),
+ REAL_CONST(15587.110354037064/8.0),
+ REAL_CONST(15602.010208103273/8.0),
+ REAL_CONST(15616.913620343823/8.0),
+ REAL_CONST(15631.820589060506/8.0),
+ REAL_CONST(15646.731112557136/8.0),
+ REAL_CONST(15661.645189139546/8.0),
+ REAL_CONST(15676.562817115593/8.0),
+ REAL_CONST(15691.483994795139/8.0),
+ REAL_CONST(15706.408720490062/8.0),
+ REAL_CONST(15721.336992514242/8.0),
+ REAL_CONST(15736.268809183561/8.0),
+ REAL_CONST(15751.204168815901/8.0),
+ REAL_CONST(15766.143069731135/8.0),
+ REAL_CONST(15781.085510251132/8.0),
+ REAL_CONST(15796.03148869974/8.0),
+ REAL_CONST(15810.981003402798/8.0),
+ REAL_CONST(15825.934052688119/8.0),
+ REAL_CONST(15840.890634885489/8.0),
+ REAL_CONST(15855.850748326673/8.0),
+ REAL_CONST(15870.814391345401/8.0),
+ REAL_CONST(15885.781562277361/8.0),
+ REAL_CONST(15900.752259460214/8.0),
+ REAL_CONST(15915.726481233565/8.0),
+ REAL_CONST(15930.704225938984/8.0),
+ REAL_CONST(15945.685491919978/8.0),
+ REAL_CONST(15960.670277522009/8.0),
+ REAL_CONST(15975.658581092481/8.0),
+ REAL_CONST(15990.65040098073/8.0),
+ REAL_CONST(16005.645735538035/8.0),
+ REAL_CONST(16020.644583117599/8.0),
+ REAL_CONST(16035.646942074556/8.0),
+ REAL_CONST(16050.652810765967/8.0),
+ REAL_CONST(16065.662187550806/8.0),
+ REAL_CONST(16080.675070789974/8.0),
+ REAL_CONST(16095.691458846273/8.0),
+ REAL_CONST(16110.711350084424/8.0),
+ REAL_CONST(16125.734742871053/8.0),
+ REAL_CONST(16140.761635574685/8.0),
+ REAL_CONST(16155.792026565747/8.0),
+ REAL_CONST(16170.825914216561/8.0),
+ REAL_CONST(16185.863296901338/8.0),
+ REAL_CONST(16200.904172996183/8.0),
+ REAL_CONST(16215.948540879079/8.0),
+ REAL_CONST(16230.996398929899/8.0),
+ REAL_CONST(16246.047745530386/8.0),
+ REAL_CONST(16261.102579064163/8.0),
+ REAL_CONST(16276.160897916721/8.0),
+ REAL_CONST(16291.22270047542/8.0),
+ REAL_CONST(16306.287985129484/8.0),
+ REAL_CONST(16321.356750269995/8.0),
+ REAL_CONST(16336.428994289896/8.0),
+ REAL_CONST(16351.504715583982/8.0),
+ REAL_CONST(16366.5839125489/8.0),
+ REAL_CONST(16381.666583583141/8.0),
+ REAL_CONST(16396.752727087041/8.0),
+ REAL_CONST(16411.842341462776/8.0),
+ REAL_CONST(16426.935425114363/8.0),
+ REAL_CONST(16442.031976447644/8.0),
+ REAL_CONST(16457.131993870298/8.0),
+ REAL_CONST(16472.235475791829/8.0),
+ REAL_CONST(16487.342420623561/8.0),
+ REAL_CONST(16502.452826778641/8.0),
+ REAL_CONST(16517.566692672033/8.0),
+ REAL_CONST(16532.684016720516/8.0),
+ REAL_CONST(16547.804797342676/8.0),
+ REAL_CONST(16562.929032958902/8.0),
+ REAL_CONST(16578.056721991394/8.0),
+ REAL_CONST(16593.18786286415/8.0),
+ REAL_CONST(16608.322454002962/8.0),
+ REAL_CONST(16623.460493835417/8.0),
+ REAL_CONST(16638.601980790896/8.0),
+ REAL_CONST(16653.746913300558/8.0),
+ REAL_CONST(16668.895289797354/8.0),
+ REAL_CONST(16684.047108716015/8.0),
+ REAL_CONST(16699.202368493046/8.0),
+ REAL_CONST(16714.361067566726/8.0),
+ REAL_CONST(16729.523204377107/8.0),
+ REAL_CONST(16744.688777366009/8.0),
+ REAL_CONST(16759.857784977012/8.0),
+ REAL_CONST(16775.030225655464/8.0),
+ REAL_CONST(16790.206097848466/8.0),
+ REAL_CONST(16805.385400004874/8.0),
+ REAL_CONST(16820.568130575302/8.0),
+ REAL_CONST(16835.754288012104/8.0),
+ REAL_CONST(16850.943870769381/8.0),
+ REAL_CONST(16866.136877302983/8.0),
+ REAL_CONST(16881.333306070494/8.0),
+ REAL_CONST(16896.53315553123/8.0),
+ REAL_CONST(16911.736424146249/8.0),
+ REAL_CONST(16926.943110378332/8.0),
+ REAL_CONST(16942.153212691992/8.0),
+ REAL_CONST(16957.366729553454/8.0),
+ REAL_CONST(16972.583659430682/8.0),
+ REAL_CONST(16987.804000793338/8.0),
+ REAL_CONST(17003.027752112816/8.0),
+ REAL_CONST(17018.254911862205/8.0),
+ REAL_CONST(17033.485478516312/8.0),
+ REAL_CONST(17048.719450551645/8.0),
+ REAL_CONST(17063.956826446421/8.0),
+ REAL_CONST(17079.197604680547/8.0),
+ REAL_CONST(17094.44178373563/8.0),
+ REAL_CONST(17109.689362094967/8.0),
+ REAL_CONST(17124.940338243552/8.0),
+ REAL_CONST(17140.194710668064/8.0),
+ REAL_CONST(17155.452477856852/8.0),
+ REAL_CONST(17170.713638299967/8.0),
+ REAL_CONST(17185.978190489128/8.0),
+ REAL_CONST(17201.246132917724/8.0),
+ REAL_CONST(17216.517464080825/8.0),
+ REAL_CONST(17231.792182475165/8.0),
+ REAL_CONST(17247.070286599141/8.0),
+ REAL_CONST(17262.351774952826/8.0),
+ REAL_CONST(17277.636646037936/8.0),
+ REAL_CONST(17292.924898357855/8.0),
+ REAL_CONST(17308.216530417623/8.0),
+ REAL_CONST(17323.511540723921/8.0),
+ REAL_CONST(17338.809927785089/8.0),
+ REAL_CONST(17354.111690111105/8.0),
+ REAL_CONST(17369.416826213594/8.0),
+ REAL_CONST(17384.725334605821/8.0),
+ REAL_CONST(17400.037213802683/8.0),
+ REAL_CONST(17415.352462320716/8.0),
+ REAL_CONST(17430.67107867809/8.0),
+ REAL_CONST(17445.993061394587/8.0),
+ REAL_CONST(17461.318408991636/8.0),
+ REAL_CONST(17476.647119992274/8.0),
+ REAL_CONST(17491.979192921168/8.0),
+ REAL_CONST(17507.314626304586/8.0),
+ REAL_CONST(17522.653418670423/8.0),
+ REAL_CONST(17537.995568548187/8.0),
+ REAL_CONST(17553.341074468986/8.0),
+ REAL_CONST(17568.689934965536/8.0),
+ REAL_CONST(17584.042148572156/8.0),
+ REAL_CONST(17599.397713824768/8.0),
+ REAL_CONST(17614.75662926089/8.0),
+ REAL_CONST(17630.118893419625/8.0),
+ REAL_CONST(17645.484504841683/8.0),
+ REAL_CONST(17660.853462069354/8.0),
+ REAL_CONST(17676.225763646511/8.0),
+ REAL_CONST(17691.601408118619/8.0),
+ REAL_CONST(17706.980394032718/8.0),
+ REAL_CONST(17722.362719937424/8.0),
+ REAL_CONST(17737.748384382936/8.0),
+ REAL_CONST(17753.137385921014/8.0),
+ REAL_CONST(17768.529723104999/8.0),
+ REAL_CONST(17783.92539448979/8.0),
+ REAL_CONST(17799.324398631856/8.0),
+ REAL_CONST(17814.726734089225/8.0),
+ REAL_CONST(17830.13239942148/8.0),
+ REAL_CONST(17845.541393189767/8.0),
+ REAL_CONST(17860.95371395678/8.0),
+ REAL_CONST(17876.369360286772/8.0),
+ REAL_CONST(17891.788330745527/8.0),
+ REAL_CONST(17907.210623900395/8.0),
+ REAL_CONST(17922.636238320254/8.0),
+ REAL_CONST(17938.065172575527/8.0),
+ REAL_CONST(17953.497425238176/8.0),
+ REAL_CONST(17968.932994881692/8.0),
+ REAL_CONST(17984.371880081104/8.0),
+ REAL_CONST(17999.814079412972/8.0),
+ REAL_CONST(18015.259591455371/8.0),
+ REAL_CONST(18030.708414787914/8.0),
+ REAL_CONST(18046.160547991731/8.0),
+ REAL_CONST(18061.615989649465/8.0),
+ REAL_CONST(18077.074738345284/8.0),
+ REAL_CONST(18092.536792664861/8.0),
+ REAL_CONST(18108.002151195393/8.0),
+ REAL_CONST(18123.470812525571/8.0),
+ REAL_CONST(18138.942775245599/8.0),
+ REAL_CONST(18154.418037947191/8.0),
+ REAL_CONST(18169.896599223546/8.0),
+ REAL_CONST(18185.37845766938/8.0),
+ REAL_CONST(18200.863611880886/8.0),
+ REAL_CONST(18216.352060455767/8.0),
+ REAL_CONST(18231.843801993204/8.0),
+ REAL_CONST(18247.338835093873/8.0),
+ REAL_CONST(18262.837158359936/8.0),
+ REAL_CONST(18278.338770395032/8.0),
+ REAL_CONST(18293.84366980429/8.0),
+ REAL_CONST(18309.351855194309/8.0),
+ REAL_CONST(18324.863325173166/8.0),
+ REAL_CONST(18340.378078350412/8.0),
+ REAL_CONST(18355.896113337069/8.0),
+ REAL_CONST(18371.417428745623/8.0),
+ REAL_CONST(18386.942023190033/8.0),
+ REAL_CONST(18402.469895285718/8.0),
+ REAL_CONST(18418.00104364955/8.0),
+ REAL_CONST(18433.53546689987/8.0),
+ REAL_CONST(18449.073163656474/8.0),
+ REAL_CONST(18464.614132540602/8.0),
+ REAL_CONST(18480.158372174956/8.0),
+ REAL_CONST(18495.705881183676/8.0),
+ REAL_CONST(18511.256658192357/8.0),
+ REAL_CONST(18526.810701828035/8.0),
+ REAL_CONST(18542.368010719183/8.0),
+ REAL_CONST(18557.928583495715/8.0),
+ REAL_CONST(18573.492418788985/8.0),
+ REAL_CONST(18589.059515231773/8.0),
+ REAL_CONST(18604.629871458303/8.0),
+ REAL_CONST(18620.203486104212/8.0),
+ REAL_CONST(18635.78035780658/8.0),
+ REAL_CONST(18651.360485203899/8.0),
+ REAL_CONST(18666.943866936086/8.0),
+ REAL_CONST(18682.53050164448/8.0),
+ REAL_CONST(18698.120387971841/8.0),
+ REAL_CONST(18713.713524562332/8.0),
+ REAL_CONST(18729.30991006154/8.0),
+ REAL_CONST(18744.909543116457/8.0),
+ REAL_CONST(18760.512422375479/8.0),
+ REAL_CONST(18776.118546488418/8.0),
+ REAL_CONST(18791.727914106479/8.0),
+ REAL_CONST(18807.340523882274/8.0),
+ REAL_CONST(18822.95637446981/8.0),
+ REAL_CONST(18838.575464524489/8.0),
+ REAL_CONST(18854.197792703111/8.0),
+ REAL_CONST(18869.823357663863/8.0),
+ REAL_CONST(18885.452158066328/8.0),
+ REAL_CONST(18901.08419257147/8.0),
+ REAL_CONST(18916.719459841639/8.0),
+ REAL_CONST(18932.357958540564/8.0),
+ REAL_CONST(18947.999687333362/8.0),
+ REAL_CONST(18963.644644886521/8.0),
+ REAL_CONST(18979.292829867907/8.0),
+ REAL_CONST(18994.944240946759/8.0),
+ REAL_CONST(19010.598876793687/8.0),
+ REAL_CONST(19026.256736080668/8.0),
+ REAL_CONST(19041.917817481048/8.0),
+ REAL_CONST(19057.582119669532/8.0),
+ REAL_CONST(19073.2496413222/8.0),
+ REAL_CONST(19088.920381116473/8.0),
+ REAL_CONST(19104.594337731145/8.0),
+ REAL_CONST(19120.271509846356/8.0),
+ REAL_CONST(19135.951896143604/8.0),
+ REAL_CONST(19151.635495305738/8.0),
+ REAL_CONST(19167.322306016948/8.0),
+ REAL_CONST(19183.012326962784/8.0),
+ REAL_CONST(19198.705556830122/8.0),
+ REAL_CONST(19214.401994307198/8.0),
+ REAL_CONST(19230.101638083579/8.0),
+ REAL_CONST(19245.804486850167/8.0),
+ REAL_CONST(19261.510539299208/8.0),
+ REAL_CONST(19277.219794124274/8.0),
+ REAL_CONST(19292.932250020265/8.0),
+ REAL_CONST(19308.647905683421/8.0),
+ REAL_CONST(19324.366759811302/8.0),
+ REAL_CONST(19340.088811102793/8.0),
+ REAL_CONST(19355.8140582581/8.0),
+ REAL_CONST(19371.542499978754/8.0),
+ REAL_CONST(19387.2741349676/8.0),
+ REAL_CONST(19403.008961928797/8.0),
+ REAL_CONST(19418.746979567823/8.0),
+ REAL_CONST(19434.488186591469/8.0),
+ REAL_CONST(19450.232581707827/8.0),
+ REAL_CONST(19465.980163626304/8.0),
+ REAL_CONST(19481.730931057613/8.0),
+ REAL_CONST(19497.484882713761/8.0),
+ REAL_CONST(19513.242017308068/8.0),
+ REAL_CONST(19529.002333555141/8.0),
+ REAL_CONST(19544.765830170898/8.0),
+ REAL_CONST(19560.532505872539/8.0),
+ REAL_CONST(19576.302359378566/8.0),
+ REAL_CONST(19592.075389408761/8.0),
+ REAL_CONST(19607.851594684209/8.0),
+ REAL_CONST(19623.630973927269/8.0),
+ REAL_CONST(19639.41352586159/8.0),
+ REAL_CONST(19655.199249212103/8.0),
+ REAL_CONST(19670.988142705017/8.0),
+ REAL_CONST(19686.780205067826/8.0),
+ REAL_CONST(19702.575435029288/8.0),
+ REAL_CONST(19718.373831319448/8.0),
+ REAL_CONST(19734.175392669615/8.0),
+ REAL_CONST(19749.980117812371/8.0),
+ REAL_CONST(19765.788005481569/8.0),
+ REAL_CONST(19781.599054412323/8.0),
+ REAL_CONST(19797.413263341008/8.0),
+ REAL_CONST(19813.230631005274/8.0),
+ REAL_CONST(19829.051156144014/8.0),
+ REAL_CONST(19844.874837497395/8.0),
+ REAL_CONST(19860.701673806827/8.0),
+ REAL_CONST(19876.531663814985/8.0),
+ REAL_CONST(19892.364806265789/8.0),
+ REAL_CONST(19908.201099904403/8.0),
+ REAL_CONST(19924.040543477258/8.0),
+ REAL_CONST(19939.883135732012/8.0),
+ REAL_CONST(19955.728875417579/8.0),
+ REAL_CONST(19971.577761284105/8.0),
+ REAL_CONST(19987.429792082985/8.0),
+ REAL_CONST(20003.284966566847/8.0),
+ REAL_CONST(20019.14328348956/8.0),
+ REAL_CONST(20035.004741606219/8.0),
+ REAL_CONST(20050.869339673161/8.0),
+ REAL_CONST(20066.737076447946/8.0),
+ REAL_CONST(20082.607950689362/8.0),
+ REAL_CONST(20098.481961157428/8.0),
+ REAL_CONST(20114.359106613385/8.0),
+ REAL_CONST(20130.239385819699/8.0),
+ REAL_CONST(20146.122797540058/8.0),
+ REAL_CONST(20162.009340539353/8.0),
+ REAL_CONST(20177.899013583716/8.0),
+ REAL_CONST(20193.791815440476/8.0),
+ REAL_CONST(20209.687744878182/8.0),
+ REAL_CONST(20225.586800666591/8.0),
+ REAL_CONST(20241.488981576669/8.0),
+ REAL_CONST(20257.394286380597/8.0),
+ REAL_CONST(20273.302713851754/8.0),
+ REAL_CONST(20289.214262764715/8.0),
+ REAL_CONST(20305.128931895277/8.0),
+ REAL_CONST(20321.046720020415/8.0),
+ REAL_CONST(20336.967625918318/8.0),
+ REAL_CONST(20352.891648368361/8.0),
+ REAL_CONST(20368.818786151114/8.0),
+ REAL_CONST(20384.749038048347/8.0),
+ REAL_CONST(20400.682402843009/8.0),
+ REAL_CONST(20416.618879319249/8.0),
+ REAL_CONST(20432.558466262391/8.0),
+ REAL_CONST(20448.501162458953/8.0),
+ REAL_CONST(20464.446966696629/8.0),
+ REAL_CONST(20480.395877764302/8.0),
+ REAL_CONST(20496.347894452025/8.0),
+ REAL_CONST(20512.303015551031/8.0),
+ REAL_CONST(20528.261239853735/8.0),
+ REAL_CONST(20544.22256615372/8.0),
+ REAL_CONST(20560.186993245738/8.0),
+ REAL_CONST(20576.15451992572/8.0),
+ REAL_CONST(20592.125144990758/8.0),
+ REAL_CONST(20608.098867239107/8.0),
+ REAL_CONST(20624.075685470198/8.0),
+ REAL_CONST(20640.055598484618/8.0),
+ REAL_CONST(20656.038605084115/8.0),
+ REAL_CONST(20672.024704071595/8.0),
+ REAL_CONST(20688.013894251126/8.0),
+ REAL_CONST(20704.006174427926/8.0),
+ REAL_CONST(20720.001543408373/8.0),
+ REAL_CONST(20735.999999999989/8.0),
+ REAL_CONST(20752.001543011454/8.0),
+ REAL_CONST(20768.006171252597/8.0),
+ REAL_CONST(20784.013883534382/8.0),
+ REAL_CONST(20800.024678668931/8.0),
+ REAL_CONST(20816.038555469506/8.0),
+ REAL_CONST(20832.055512750507/8.0),
+ REAL_CONST(20848.075549327474/8.0),
+ REAL_CONST(20864.098664017085/8.0),
+ REAL_CONST(20880.124855637161/8.0),
+ REAL_CONST(20896.154123006647/8.0),
+ REAL_CONST(20912.186464945626/8.0),
+ REAL_CONST(20928.221880275312/8.0),
+ REAL_CONST(20944.260367818049/8.0),
+ REAL_CONST(20960.301926397311/8.0),
+ REAL_CONST(20976.346554837684/8.0),
+ REAL_CONST(20992.394251964895/8.0),
+ REAL_CONST(21008.445016605787/8.0),
+ REAL_CONST(21024.498847588318/8.0),
+ REAL_CONST(21040.555743741574/8.0),
+ REAL_CONST(21056.615703895754/8.0),
+ REAL_CONST(21072.678726882168/8.0),
+ REAL_CONST(21088.744811533252/8.0),
+ REAL_CONST(21104.813956682538/8.0),
+ REAL_CONST(21120.886161164683/8.0),
+ REAL_CONST(21136.961423815443/8.0),
+ REAL_CONST(21153.039743471683/8.0),
+ REAL_CONST(21169.121118971379/8.0),
+ REAL_CONST(21185.205549153605/8.0),
+ REAL_CONST(21201.293032858535/8.0),
+ REAL_CONST(21217.383568927453/8.0),
+ REAL_CONST(21233.477156202731/8.0),
+ REAL_CONST(21249.573793527841/8.0),
+ REAL_CONST(21265.673479747358/8.0),
+ REAL_CONST(21281.776213706937/8.0),
+ REAL_CONST(21297.881994253334/8.0),
+ REAL_CONST(21313.990820234398/8.0),
+ REAL_CONST(21330.102690499054/8.0),
+ REAL_CONST(21346.21760389733/8.0),
+ REAL_CONST(21362.335559280327/8.0),
+ REAL_CONST(21378.456555500241/8.0),
+ REAL_CONST(21394.580591410333/8.0),
+ REAL_CONST(21410.707665864964/8.0),
+ REAL_CONST(21426.83777771956/8.0),
+ REAL_CONST(21442.970925830628/8.0),
+ REAL_CONST(21459.107109055756/8.0),
+ REAL_CONST(21475.246326253604/8.0),
+ REAL_CONST(21491.388576283895/8.0),
+ REAL_CONST(21507.533858007431/8.0),
+ REAL_CONST(21523.682170286087/8.0),
+ REAL_CONST(21539.833511982797/8.0),
+ REAL_CONST(21555.987881961566/8.0),
+ REAL_CONST(21572.145279087465/8.0),
+ REAL_CONST(21588.305702226615/8.0),
+ REAL_CONST(21604.469150246216/8.0),
+ REAL_CONST(21620.635622014521/8.0),
+ REAL_CONST(21636.805116400832/8.0),
+ REAL_CONST(21652.977632275521/8.0),
+ REAL_CONST(21669.153168510009/8.0),
+ REAL_CONST(21685.331723976764/8.0),
+ REAL_CONST(21701.513297549318/8.0),
+ REAL_CONST(21717.697888102244/8.0),
+ REAL_CONST(21733.885494511167/8.0),
+ REAL_CONST(21750.076115652759/8.0),
+ REAL_CONST(21766.269750404736/8.0),
+ REAL_CONST(21782.466397645861/8.0),
+ REAL_CONST(21798.666056255934/8.0),
+ REAL_CONST(21814.868725115801/8.0),
+ REAL_CONST(21831.074403107345/8.0),
+ REAL_CONST(21847.283089113484/8.0),
+ REAL_CONST(21863.494782018177/8.0),
+ REAL_CONST(21879.709480706417/8.0),
+ REAL_CONST(21895.927184064229/8.0),
+ REAL_CONST(21912.147890978667/8.0),
+ REAL_CONST(21928.371600337818/8.0),
+ REAL_CONST(21944.598311030797/8.0),
+ REAL_CONST(21960.828021947746/8.0),
+ REAL_CONST(21977.060731979829/8.0),
+ REAL_CONST(21993.296440019243/8.0),
+ REAL_CONST(22009.535144959198/8.0),
+ REAL_CONST(22025.77684569393/8.0),
+ REAL_CONST(22042.021541118691/8.0),
+ REAL_CONST(22058.269230129757/8.0),
+ REAL_CONST(22074.519911624411/8.0),
+ REAL_CONST(22090.773584500959/8.0),
+ REAL_CONST(22107.030247658717/8.0),
+ REAL_CONST(22123.289899998013/8.0),
+ REAL_CONST(22139.552540420187/8.0),
+ REAL_CONST(22155.818167827587/8.0),
+ REAL_CONST(22172.086781123569/8.0),
+ REAL_CONST(22188.358379212495/8.0),
+ REAL_CONST(22204.632960999726/8.0),
+ REAL_CONST(22220.910525391639/8.0),
+ REAL_CONST(22237.191071295601/8.0),
+ REAL_CONST(22253.474597619981/8.0),
+ REAL_CONST(22269.761103274148/8.0),
+ REAL_CONST(22286.050587168469/8.0),
+ REAL_CONST(22302.343048214312/8.0),
+ REAL_CONST(22318.638485324027/8.0),
+ REAL_CONST(22334.936897410968/8.0),
+ REAL_CONST(22351.23828338947/8.0),
+ REAL_CONST(22367.542642174871/8.0),
+ REAL_CONST(22383.849972683485/8.0),
+ REAL_CONST(22400.160273832618/8.0),
+ REAL_CONST(22416.473544540564/8.0),
+ REAL_CONST(22432.789783726603/8.0),
+ REAL_CONST(22449.108990310986/8.0),
+ REAL_CONST(22465.431163214958/8.0),
+ REAL_CONST(22481.75630136074/8.0),
+ REAL_CONST(22498.084403671528/8.0),
+ REAL_CONST(22514.415469071497/8.0),
+ REAL_CONST(22530.749496485802/8.0),
+ REAL_CONST(22547.086484840562/8.0),
+ REAL_CONST(22563.426433062879/8.0),
+ REAL_CONST(22579.769340080824/8.0),
+ REAL_CONST(22596.115204823436/8.0),
+ REAL_CONST(22612.464026220721/8.0),
+ REAL_CONST(22628.815803203655/8.0),
+ REAL_CONST(22645.170534704179/8.0),
+ REAL_CONST(22661.5282196552/8.0),
+ REAL_CONST(22677.888856990587/8.0),
+ REAL_CONST(22694.252445645168/8.0),
+ REAL_CONST(22710.618984554734/8.0),
+ REAL_CONST(22726.988472656034/8.0),
+ REAL_CONST(22743.360908886778/8.0),
+ REAL_CONST(22759.736292185622/8.0),
+ REAL_CONST(22776.114621492186/8.0),
+ REAL_CONST(22792.495895747044/8.0),
+ REAL_CONST(22808.880113891719/8.0),
+ REAL_CONST(22825.267274868678/8.0),
+ REAL_CONST(22841.657377621348/8.0),
+ REAL_CONST(22858.050421094096/8.0),
+ REAL_CONST(22874.446404232243/8.0),
+ REAL_CONST(22890.845325982053/8.0),
+ REAL_CONST(22907.247185290722/8.0),
+ REAL_CONST(22923.651981106406/8.0),
+ REAL_CONST(22940.059712378195/8.0),
+ REAL_CONST(22956.470378056114/8.0),
+ REAL_CONST(22972.883977091129/8.0),
+ REAL_CONST(22989.300508435153/8.0),
+ REAL_CONST(23005.719971041017/8.0),
+ REAL_CONST(23022.142363862498/8.0),
+ REAL_CONST(23038.567685854305/8.0),
+ REAL_CONST(23054.995935972078/8.0),
+ REAL_CONST(23071.427113172387/8.0),
+ REAL_CONST(23087.86121641273/8.0),
+ REAL_CONST(23104.298244651531/8.0),
+ REAL_CONST(23120.738196848146/8.0),
+ REAL_CONST(23137.181071962848/8.0),
+ REAL_CONST(23153.626868956846/8.0),
+ REAL_CONST(23170.075586792263/8.0),
+ REAL_CONST(23186.527224432142/8.0),
+ REAL_CONST(23202.981780840448/8.0),
+ REAL_CONST(23219.439254982066/8.0),
+ REAL_CONST(23235.899645822796/8.0),
+ REAL_CONST(23252.362952329357/8.0),
+ REAL_CONST(23268.829173469378/8.0),
+ REAL_CONST(23285.298308211408/8.0),
+ REAL_CONST(23301.770355524899/8.0),
+ REAL_CONST(23318.245314380223/8.0),
+ REAL_CONST(23334.723183748658/8.0),
+ REAL_CONST(23351.203962602387/8.0),
+ REAL_CONST(23367.687649914504/8.0),
+ REAL_CONST(23384.174244659007/8.0),
+ REAL_CONST(23400.663745810798/8.0),
+ REAL_CONST(23417.15615234568/8.0),
+ REAL_CONST(23433.651463240367/8.0),
+ REAL_CONST(23450.149677472462/8.0),
+ REAL_CONST(23466.650794020472/8.0),
+ REAL_CONST(23483.154811863806/8.0),
+ REAL_CONST(23499.661729982763/8.0),
+ REAL_CONST(23516.171547358543/8.0),
+ REAL_CONST(23532.684262973235/8.0),
+ REAL_CONST(23549.199875809823/8.0),
+ REAL_CONST(23565.718384852185/8.0),
+ REAL_CONST(23582.239789085092/8.0),
+ REAL_CONST(23598.764087494197/8.0),
+ REAL_CONST(23615.291279066041/8.0),
+ REAL_CONST(23631.821362788058/8.0),
+ REAL_CONST(23648.354337648565/8.0),
+ REAL_CONST(23664.890202636761/8.0),
+ REAL_CONST(23681.428956742733/8.0),
+ REAL_CONST(23697.970598957443/8.0),
+ REAL_CONST(23714.515128272738/8.0),
+ REAL_CONST(23731.062543681343/8.0),
+ REAL_CONST(23747.612844176863/8.0),
+ REAL_CONST(23764.166028753778/8.0),
+ REAL_CONST(23780.72209640744/8.0),
+ REAL_CONST(23797.281046134085/8.0),
+ REAL_CONST(23813.842876930816/8.0),
+ REAL_CONST(23830.407587795606/8.0),
+ REAL_CONST(23846.975177727301/8.0),
+ REAL_CONST(23863.545645725622/8.0),
+ REAL_CONST(23880.11899079115/8.0),
+ REAL_CONST(23896.695211925336/8.0),
+ REAL_CONST(23913.274308130498/8.0),
+ REAL_CONST(23929.856278409821/8.0),
+ REAL_CONST(23946.441121767348/8.0),
+ REAL_CONST(23963.028837207989/8.0),
+ REAL_CONST(23979.619423737513/8.0),
+ REAL_CONST(23996.212880362549/8.0),
+ REAL_CONST(24012.809206090584/8.0),
+ REAL_CONST(24029.408399929966/8.0),
+ REAL_CONST(24046.010460889898/8.0),
+ REAL_CONST(24062.615387980433/8.0),
+ REAL_CONST(24079.223180212492/8.0),
+ REAL_CONST(24095.833836597827/8.0),
+ REAL_CONST(24112.447356149063/8.0),
+ REAL_CONST(24129.063737879667/8.0),
+ REAL_CONST(24145.682980803951/8.0),
+ REAL_CONST(24162.305083937081/8.0),
+ REAL_CONST(24178.930046295067/8.0),
+ REAL_CONST(24195.557866894767/8.0),
+ REAL_CONST(24212.188544753884/8.0),
+ REAL_CONST(24228.822078890964/8.0),
+ REAL_CONST(24245.458468325389/8.0),
+ REAL_CONST(24262.097712077397/8.0),
+ REAL_CONST(24278.739809168052/8.0),
+ REAL_CONST(24295.384758619261/8.0),
+ REAL_CONST(24312.032559453768/8.0),
+ REAL_CONST(24328.683210695162/8.0),
+ REAL_CONST(24345.336711367858/8.0),
+ REAL_CONST(24361.993060497109/8.0),
+ REAL_CONST(24378.652257108995/8.0),
+ REAL_CONST(24395.314300230442/8.0),
+ REAL_CONST(24411.979188889192/8.0),
+ REAL_CONST(24428.646922113825/8.0),
+ REAL_CONST(24445.317498933746/8.0),
+ REAL_CONST(24461.990918379193/8.0),
+ REAL_CONST(24478.667179481225/8.0),
+ REAL_CONST(24495.346281271726/8.0),
+ REAL_CONST(24512.028222783407/8.0),
+ REAL_CONST(24528.713003049801/8.0),
+ REAL_CONST(24545.400621105266/8.0),
+ REAL_CONST(24562.091075984976/8.0),
+ REAL_CONST(24578.784366724925/8.0),
+ REAL_CONST(24595.480492361927/8.0),
+ REAL_CONST(24612.179451933614/8.0),
+ REAL_CONST(24628.881244478438/8.0),
+ REAL_CONST(24645.585869035654/8.0),
+ REAL_CONST(24662.293324645343/8.0),
+ REAL_CONST(24679.003610348394/8.0),
+ REAL_CONST(24695.716725186514/8.0),
+ REAL_CONST(24712.432668202211/8.0),
+ REAL_CONST(24729.151438438807/8.0),
+ REAL_CONST(24745.873034940436/8.0),
+ REAL_CONST(24762.597456752032/8.0),
+ REAL_CONST(24779.324702919344/8.0),
+ REAL_CONST(24796.054772488926/8.0),
+ REAL_CONST(24812.787664508123/8.0),
+ REAL_CONST(24829.5233780251/8.0),
+ REAL_CONST(24846.261912088819/8.0),
+ REAL_CONST(24863.003265749034/8.0),
+ REAL_CONST(24879.747438056307/8.0),
+ REAL_CONST(24896.494428062004/8.0),
+ REAL_CONST(24913.244234818278/8.0),
+ REAL_CONST(24929.996857378079/8.0),
+ REAL_CONST(24946.752294795166/8.0),
+ REAL_CONST(24963.510546124078/8.0),
+ REAL_CONST(24980.271610420157/8.0),
+ REAL_CONST(24997.035486739525/8.0),
+ REAL_CONST(25013.802174139113/8.0),
+ REAL_CONST(25030.571671676629/8.0),
+ REAL_CONST(25047.343978410572/8.0),
+ REAL_CONST(25064.119093400237/8.0),
+ REAL_CONST(25080.897015705697/8.0),
+ REAL_CONST(25097.677744387816/8.0),
+ REAL_CONST(25114.461278508239/8.0),
+ REAL_CONST(25131.2476171294/8.0),
+ REAL_CONST(25148.036759314517/8.0),
+ REAL_CONST(25164.828704127583/8.0),
+ REAL_CONST(25181.623450633375/8.0),
+ REAL_CONST(25198.42099789745/8.0),
+ REAL_CONST(25215.221344986145/8.0),
+ REAL_CONST(25232.024490966574/8.0),
+ REAL_CONST(25248.830434906627/8.0),
+ REAL_CONST(25265.639175874974/8.0),
+ REAL_CONST(25282.450712941049/8.0),
+ REAL_CONST(25299.265045175071/8.0),
+ REAL_CONST(25316.082171648024/8.0),
+ REAL_CONST(25332.902091431668/8.0),
+ REAL_CONST(25349.724803598532/8.0),
+ REAL_CONST(25366.550307221914/8.0),
+ REAL_CONST(25383.378601375884/8.0),
+ REAL_CONST(25400.209685135269/8.0),
+ REAL_CONST(25417.043557575678/8.0),
+ REAL_CONST(25433.880217773472/8.0),
+ REAL_CONST(25450.719664805783/8.0),
+ REAL_CONST(25467.561897750507/8.0),
+ REAL_CONST(25484.406915686297/8.0),
+ REAL_CONST(25501.254717692573/8.0),
+ REAL_CONST(25518.105302849512/8.0),
+ REAL_CONST(25534.958670238051/8.0),
+ REAL_CONST(25551.814818939893/8.0),
+ REAL_CONST(25568.67374803748/8.0),
+ REAL_CONST(25585.535456614027/8.0),
+ REAL_CONST(25602.399943753502/8.0),
+ REAL_CONST(25619.267208540619/8.0),
+ REAL_CONST(25636.137250060852/8.0),
+ REAL_CONST(25653.010067400432/8.0),
+ REAL_CONST(25669.885659646327/8.0),
+ REAL_CONST(25686.76402588627/8.0),
+ REAL_CONST(25703.645165208734/8.0),
+ REAL_CONST(25720.529076702944/8.0),
+ REAL_CONST(25737.415759458876/8.0),
+ REAL_CONST(25754.305212567244/8.0),
+ REAL_CONST(25771.197435119517/8.0),
+ REAL_CONST(25788.092426207899/8.0),
+ REAL_CONST(25804.990184925344/8.0),
+ REAL_CONST(25821.890710365547/8.0),
+ REAL_CONST(25838.794001622944/8.0),
+ REAL_CONST(25855.700057792714/8.0),
+ REAL_CONST(25872.608877970775/8.0),
+ REAL_CONST(25889.520461253778/8.0),
+ REAL_CONST(25906.434806739118/8.0),
+ REAL_CONST(25923.351913524923/8.0),
+ REAL_CONST(25940.271780710063/8.0),
+ REAL_CONST(25957.194407394138/8.0),
+ REAL_CONST(25974.11979267748/8.0),
+ REAL_CONST(25991.047935661154/8.0),
+ REAL_CONST(26007.978835446964/8.0),
+ REAL_CONST(26024.912491137442/8.0),
+ REAL_CONST(26041.848901835841/8.0),
+ REAL_CONST(26058.788066646157/8.0),
+ REAL_CONST(26075.729984673108/8.0),
+ REAL_CONST(26092.674655022136/8.0),
+ REAL_CONST(26109.622076799409/8.0),
+ REAL_CONST(26126.572249111829/8.0),
+ REAL_CONST(26143.525171067016/8.0),
+ REAL_CONST(26160.480841773315/8.0),
+ REAL_CONST(26177.43926033979/8.0),
+ REAL_CONST(26194.400425876229/8.0),
+ REAL_CONST(26211.364337493149/8.0),
+ REAL_CONST(26228.330994301767/8.0),
+ REAL_CONST(26245.30039541404/8.0),
+ REAL_CONST(26262.272539942627/8.0),
+ REAL_CONST(26279.247427000919/8.0),
+ REAL_CONST(26296.225055703002/8.0),
+ REAL_CONST(26313.205425163702/8.0),
+ REAL_CONST(26330.188534498539/8.0),
+ REAL_CONST(26347.174382823756/8.0),
+ REAL_CONST(26364.162969256304/8.0),
+ REAL_CONST(26381.154292913852/8.0),
+ REAL_CONST(26398.148352914774/8.0),
+ REAL_CONST(26415.145148378149/8.0),
+ REAL_CONST(26432.144678423778/8.0),
+ REAL_CONST(26449.146942172156/8.0),
+ REAL_CONST(26466.151938744493/8.0),
+ REAL_CONST(26483.159667262702/8.0),
+ REAL_CONST(26500.170126849403/8.0),
+ REAL_CONST(26517.183316627921/8.0),
+ REAL_CONST(26534.199235722277/8.0),
+ REAL_CONST(26551.217883257199/8.0),
+ REAL_CONST(26568.239258358124/8.0),
+ REAL_CONST(26585.263360151173/8.0),
+ REAL_CONST(26602.290187763181/8.0),
+ REAL_CONST(26619.319740321676/8.0),
+ REAL_CONST(26636.352016954883/8.0),
+ REAL_CONST(26653.387016791727/8.0),
+ REAL_CONST(26670.424738961825/8.0),
+ REAL_CONST(26687.465182595493/8.0),
+ REAL_CONST(26704.508346823739/8.0),
+ REAL_CONST(26721.554230778267/8.0),
+ REAL_CONST(26738.602833591467/8.0),
+ REAL_CONST(26755.65415439643/8.0),
+ REAL_CONST(26772.708192326929/8.0),
+ REAL_CONST(26789.764946517433/8.0),
+ REAL_CONST(26806.824416103096/8.0),
+ REAL_CONST(26823.886600219761/8.0),
+ REAL_CONST(26840.95149800396/8.0),
+ REAL_CONST(26858.019108592915/8.0),
+ REAL_CONST(26875.089431124517/8.0),
+ REAL_CONST(26892.162464737365/8.0),
+ REAL_CONST(26909.238208570721/8.0),
+ REAL_CONST(26926.316661764544/8.0),
+ REAL_CONST(26943.397823459472/8.0),
+ REAL_CONST(26960.481692796813/8.0),
+ REAL_CONST(26977.568268918571/8.0),
+ REAL_CONST(26994.657550967422/8.0),
+ REAL_CONST(27011.749538086722/8.0),
+ REAL_CONST(27028.844229420498/8.0),
+ REAL_CONST(27045.941624113464/8.0),
+ REAL_CONST(27063.041721311005/8.0),
+ REAL_CONST(27080.144520159181/8.0),
+ REAL_CONST(27097.250019804727/8.0),
+ REAL_CONST(27114.35821939505/8.0),
+ REAL_CONST(27131.469118078236/8.0),
+ REAL_CONST(27148.582715003027/8.0),
+ REAL_CONST(27165.699009318858/8.0),
+ REAL_CONST(27182.818000175819/8.0),
+ REAL_CONST(27199.939686724665/8.0),
+ REAL_CONST(27217.064068116837/8.0),
+ REAL_CONST(27234.191143504428/8.0),
+ REAL_CONST(27251.320912040203/8.0),
+ REAL_CONST(27268.453372877593/8.0),
+ REAL_CONST(27285.588525170693/8.0),
+ REAL_CONST(27302.726368074269/8.0),
+ REAL_CONST(27319.866900743735/8.0),
+ REAL_CONST(27337.010122335181/8.0),
+ REAL_CONST(27354.156032005358/8.0),
+ REAL_CONST(27371.304628911668/8.0),
+ REAL_CONST(27388.455912212183/8.0),
+ REAL_CONST(27405.609881065626/8.0),
+ REAL_CONST(27422.766534631384/8.0),
+ REAL_CONST(27439.925872069507/8.0),
+ REAL_CONST(27457.087892540683/8.0),
+ REAL_CONST(27474.252595206275/8.0),
+ REAL_CONST(27491.419979228293/8.0),
+ REAL_CONST(27508.5900437694/8.0),
+ REAL_CONST(27525.762787992917/8.0),
+ REAL_CONST(27542.93821106281/8.0),
+ REAL_CONST(27560.116312143706/8.0),
+ REAL_CONST(27577.297090400876/8.0),
+ REAL_CONST(27594.480545000242/8.0),
+ REAL_CONST(27611.666675108383/8.0),
+ REAL_CONST(27628.855479892518/8.0),
+ REAL_CONST(27646.046958520514/8.0),
+ REAL_CONST(27663.241110160889/8.0),
+ REAL_CONST(27680.437933982801/8.0),
+ REAL_CONST(27697.637429156068/8.0),
+ REAL_CONST(27714.839594851132/8.0),
+ REAL_CONST(27732.04443023909/8.0),
+ REAL_CONST(27749.251934491687/8.0),
+ REAL_CONST(27766.462106781299/8.0),
+ REAL_CONST(27783.674946280949/8.0),
+ REAL_CONST(27800.890452164302/8.0),
+ REAL_CONST(27818.108623605654/8.0),
+ REAL_CONST(27835.329459779954/8.0),
+ REAL_CONST(27852.55295986278/8.0),
+ REAL_CONST(27869.779123030345/8.0),
+ REAL_CONST(27887.007948459504/8.0),
+ REAL_CONST(27904.239435327745/8.0),
+ REAL_CONST(27921.473582813196/8.0),
+ REAL_CONST(27938.710390094613/8.0),
+ REAL_CONST(27955.949856351392/8.0),
+ REAL_CONST(27973.19198076355/8.0),
+ REAL_CONST(27990.436762511745/8.0),
+ REAL_CONST(28007.684200777272/8.0),
+ REAL_CONST(28024.934294742041/8.0),
+ REAL_CONST(28042.187043588601/8.0),
+ REAL_CONST(28059.442446500128/8.0),
+ REAL_CONST(28076.700502660427/8.0),
+ REAL_CONST(28093.961211253929/8.0),
+ REAL_CONST(28111.224571465693/8.0),
+ REAL_CONST(28128.490582481401/8.0),
+ REAL_CONST(28145.759243487362/8.0),
+ REAL_CONST(28163.030553670509/8.0),
+ REAL_CONST(28180.304512218394/8.0),
+ REAL_CONST(28197.581118319198/8.0),
+ REAL_CONST(28214.860371161725/8.0),
+ REAL_CONST(28232.14226993539/8.0),
+ REAL_CONST(28249.42681383024/8.0),
+ REAL_CONST(28266.71400203693/8.0),
+ REAL_CONST(28284.003833746745/8.0),
+ REAL_CONST(28301.296308151585/8.0),
+ REAL_CONST(28318.591424443959/8.0),
+ REAL_CONST(28335.889181817001/8.0),
+ REAL_CONST(28353.189579464462/8.0),
+ REAL_CONST(28370.492616580705/8.0),
+ REAL_CONST(28387.798292360701/8.0),
+ REAL_CONST(28405.106606000048/8.0),
+ REAL_CONST(28422.417556694945/8.0),
+ REAL_CONST(28439.731143642206/8.0),
+ REAL_CONST(28457.047366039264/8.0),
+ REAL_CONST(28474.366223084147/8.0),
+ REAL_CONST(28491.687713975512/8.0),
+ REAL_CONST(28509.011837912611/8.0),
+ REAL_CONST(28526.338594095305/8.0),
+ REAL_CONST(28543.667981724069/8.0),
+ REAL_CONST(28560.999999999982/8.0),
+ REAL_CONST(28578.334648124732/8.0),
+ REAL_CONST(28595.671925300605/8.0),
+ REAL_CONST(28613.011830730498/8.0),
+ REAL_CONST(28630.354363617909/8.0),
+ REAL_CONST(28647.699523166943/8.0),
+ REAL_CONST(28665.0473085823/8.0),
+ REAL_CONST(28682.397719069289/8.0),
+ REAL_CONST(28699.750753833818/8.0),
+ REAL_CONST(28717.10641208239/8.0),
+ REAL_CONST(28734.464693022121/8.0),
+ REAL_CONST(28751.825595860708/8.0),
+ REAL_CONST(28769.189119806462/8.0),
+ REAL_CONST(28786.55526406828/8.0),
+ REAL_CONST(28803.924027855664/8.0),
+ REAL_CONST(28821.295410378701/8.0),
+ REAL_CONST(28838.669410848088/8.0),
+ REAL_CONST(28856.046028475103/8.0),
+ REAL_CONST(28873.425262471628/8.0),
+ REAL_CONST(28890.80711205013/8.0),
+ REAL_CONST(28908.191576423673/8.0),
+ REAL_CONST(28925.578654805915/8.0),
+ REAL_CONST(28942.968346411097/8.0),
+ REAL_CONST(28960.360650454055/8.0),
+ REAL_CONST(28977.755566150216/8.0),
+ REAL_CONST(28995.153092715591/8.0),
+ REAL_CONST(29012.553229366786/8.0),
+ REAL_CONST(29029.955975320987/8.0),
+ REAL_CONST(29047.361329795975/8.0),
+ REAL_CONST(29064.769292010107/8.0),
+ REAL_CONST(29082.179861182336/8.0),
+ REAL_CONST(29099.593036532187/8.0),
+ REAL_CONST(29117.00881727978/8.0),
+ REAL_CONST(29134.427202645813/8.0),
+ REAL_CONST(29151.848191851568/8.0),
+ REAL_CONST(29169.271784118911/8.0),
+ REAL_CONST(29186.697978670283/8.0),
+ REAL_CONST(29204.126774728706/8.0),
+ REAL_CONST(29221.55817151779/8.0),
+ REAL_CONST(29238.992168261717/8.0),
+ REAL_CONST(29256.42876418525/8.0),
+ REAL_CONST(29273.867958513725/8.0),
+ REAL_CONST(29291.309750473058/8.0),
+ REAL_CONST(29308.754139289747/8.0),
+ REAL_CONST(29326.201124190855/8.0),
+ REAL_CONST(29343.65070440403/8.0),
+ REAL_CONST(29361.102879157483/8.0),
+ REAL_CONST(29378.557647680012/8.0),
+ REAL_CONST(29396.015009200975/8.0),
+ REAL_CONST(29413.474962950309/8.0),
+ REAL_CONST(29430.937508158524/8.0),
+ REAL_CONST(29448.402644056692/8.0),
+ REAL_CONST(29465.870369876469/8.0),
+ REAL_CONST(29483.340684850071/8.0),
+ REAL_CONST(29500.81358821028/8.0),
+ REAL_CONST(29518.289079190454/8.0),
+ REAL_CONST(29535.767157024511/8.0),
+ REAL_CONST(29553.247820946945/8.0),
+ REAL_CONST(29570.731070192807/8.0),
+ REAL_CONST(29588.216903997723/8.0),
+ REAL_CONST(29605.70532159787/8.0),
+ REAL_CONST(29623.19632223/8.0),
+ REAL_CONST(29640.689905131429/8.0),
+ REAL_CONST(29658.186069540028/8.0),
+ REAL_CONST(29675.684814694236/8.0),
+ REAL_CONST(29693.186139833047/8.0),
+ REAL_CONST(29710.690044196028/8.0),
+ REAL_CONST(29728.196527023298/8.0),
+ REAL_CONST(29745.705587555527/8.0),
+ REAL_CONST(29763.217225033964/8.0),
+ REAL_CONST(29780.731438700397/8.0),
+ REAL_CONST(29798.248227797183/8.0),
+ REAL_CONST(29815.76759156723/8.0),
+ REAL_CONST(29833.289529254005/8.0),
+ REAL_CONST(29850.81404010153/8.0),
+ REAL_CONST(29868.341123354381/8.0),
+ REAL_CONST(29885.870778257693/8.0),
+ REAL_CONST(29903.403004057145/8.0),
+ REAL_CONST(29920.937799998974/8.0),
+ REAL_CONST(29938.475165329975/8.0),
+ REAL_CONST(29956.015099297485/8.0),
+ REAL_CONST(29973.557601149394/8.0),
+ REAL_CONST(29991.102670134147/8.0),
+ REAL_CONST(30008.650305500738/8.0),
+ REAL_CONST(30026.200506498706/8.0),
+ REAL_CONST(30043.753272378144/8.0),
+ REAL_CONST(30061.308602389683/8.0),
+ REAL_CONST(30078.866495784507/8.0),
+ REAL_CONST(30096.426951814352/8.0),
+ REAL_CONST(30113.989969731494/8.0),
+ REAL_CONST(30131.55554878875/8.0),
+ REAL_CONST(30149.123688239491/8.0),
+ REAL_CONST(30166.694387337629/8.0),
+ REAL_CONST(30184.267645337608/8.0),
+ REAL_CONST(30201.843461494434/8.0),
+ REAL_CONST(30219.42183506364/8.0),
+ REAL_CONST(30237.002765301309/8.0),
+ REAL_CONST(30254.586251464058/8.0),
+ REAL_CONST(30272.172292809046/8.0),
+ REAL_CONST(30289.760888593977/8.0),
+ REAL_CONST(30307.35203807709/8.0),
+ REAL_CONST(30324.94574051716/8.0),
+ REAL_CONST(30342.541995173502/8.0),
+ REAL_CONST(30360.140801305966/8.0),
+ REAL_CONST(30377.742158174944/8.0),
+ REAL_CONST(30395.346065041358/8.0),
+ REAL_CONST(30412.952521166666/8.0),
+ REAL_CONST(30430.561525812864/8.0),
+ REAL_CONST(30448.173078242475/8.0),
+ REAL_CONST(30465.787177718561/8.0),
+ REAL_CONST(30483.403823504719/8.0),
+ REAL_CONST(30501.02301486507/8.0),
+ REAL_CONST(30518.644751064272/8.0),
+ REAL_CONST(30536.269031367516/8.0),
+ REAL_CONST(30553.895855040515/8.0),
+ REAL_CONST(30571.525221349519/8.0),
+ REAL_CONST(30589.157129561307/8.0),
+ REAL_CONST(30606.791578943175/8.0),
+ REAL_CONST(30624.428568762964/8.0),
+ REAL_CONST(30642.06809828903/8.0),
+ REAL_CONST(30659.710166790261/8.0),
+ REAL_CONST(30677.35477353607/8.0),
+ REAL_CONST(30695.001917796391/8.0),
+ REAL_CONST(30712.651598841687/8.0),
+ REAL_CONST(30730.303815942945/8.0),
+ REAL_CONST(30747.958568371676/8.0),
+ REAL_CONST(30765.615855399912/8.0),
+ REAL_CONST(30783.275676300211/8.0),
+ REAL_CONST(30800.938030345646/8.0),
+ REAL_CONST(30818.602916809814/8.0),
+ REAL_CONST(30836.270334966837/8.0),
+ REAL_CONST(30853.940284091354/8.0),
+ REAL_CONST(30871.612763458521/8.0),
+ REAL_CONST(30889.287772344011/8.0),
+ REAL_CONST(30906.965310024025/8.0),
+ REAL_CONST(30924.645375775272/8.0),
+ REAL_CONST(30942.327968874983/8.0),
+ REAL_CONST(30960.013088600903/8.0),
+ REAL_CONST(30977.700734231294/8.0),
+ REAL_CONST(30995.390905044929/8.0),
+ REAL_CONST(31013.083600321101/8.0),
+ REAL_CONST(31030.778819339619/8.0),
+ REAL_CONST(31048.476561380798/8.0),
+ REAL_CONST(31066.17682572547/8.0),
+ REAL_CONST(31083.879611654978/8.0),
+ REAL_CONST(31101.584918451179/8.0),
+ REAL_CONST(31119.29274539644/8.0),
+ REAL_CONST(31137.003091773637/8.0),
+ REAL_CONST(31154.715956866155/8.0),
+ REAL_CONST(31172.431339957893/8.0),
+ REAL_CONST(31190.14924033326/8.0),
+ REAL_CONST(31207.869657277162/8.0),
+ REAL_CONST(31225.592590075023/8.0),
+ REAL_CONST(31243.318038012771/8.0),
+ REAL_CONST(31261.046000376838/8.0),
+ REAL_CONST(31278.776476454172/8.0),
+ REAL_CONST(31296.50946553221/8.0),
+ REAL_CONST(31314.24496689891/8.0),
+ REAL_CONST(31331.98297984272/8.0),
+ REAL_CONST(31349.7235036526/8.0),
+ REAL_CONST(31367.466537618013/8.0),
+ REAL_CONST(31385.212081028923/8.0),
+ REAL_CONST(31402.960133175795/8.0),
+ REAL_CONST(31420.710693349596/8.0),
+ REAL_CONST(31438.463760841791/8.0),
+ REAL_CONST(31456.219334944351/8.0),
+ REAL_CONST(31473.977414949743/8.0),
+ REAL_CONST(31491.738000150934/8.0),
+ REAL_CONST(31509.501089841389/8.0),
+ REAL_CONST(31527.266683315069/8.0),
+ REAL_CONST(31545.034779866437/8.0),
+ REAL_CONST(31562.80537879045/8.0),
+ REAL_CONST(31580.578479382562/8.0),
+ REAL_CONST(31598.35408093872/8.0),
+ REAL_CONST(31616.132182755369/8.0),
+ REAL_CONST(31633.91278412945/8.0),
+ REAL_CONST(31651.695884358396/8.0),
+ REAL_CONST(31669.481482740131/8.0),
+ REAL_CONST(31687.269578573076/8.0),
+ REAL_CONST(31705.060171156143/8.0),
+ REAL_CONST(31722.853259788735/8.0),
+ REAL_CONST(31740.648843770748/8.0),
+ REAL_CONST(31758.446922402567/8.0),
+ REAL_CONST(31776.247494985066/8.0),
+ REAL_CONST(31794.050560819614/8.0),
+ REAL_CONST(31811.85611920806/8.0),
+ REAL_CONST(31829.664169452753/8.0),
+ REAL_CONST(31847.474710856521/8.0),
+ REAL_CONST(31865.287742722685/8.0),
+ REAL_CONST(31883.103264355046/8.0),
+ REAL_CONST(31900.921275057899/8.0),
+ REAL_CONST(31918.741774136019/8.0),
+ REAL_CONST(31936.564760894671/8.0),
+ REAL_CONST(31954.390234639599/8.0),
+ REAL_CONST(31972.21819467704/8.0),
+ REAL_CONST(31990.048640313704/8.0),
+ REAL_CONST(32007.881570856793/8.0),
+ REAL_CONST(32025.716985613984/8.0),
+ REAL_CONST(32043.554883893445/8.0),
+ REAL_CONST(32061.395265003815/8.0),
+ REAL_CONST(32079.238128254223/8.0),
+ REAL_CONST(32097.083472954269/8.0),
+ REAL_CONST(32114.931298414049/8.0),
+ REAL_CONST(32132.781603944117/8.0),
+ REAL_CONST(32150.634388855524/8.0),
+ REAL_CONST(32168.48965245979/8.0),
+ REAL_CONST(32186.347394068915/8.0),
+ REAL_CONST(32204.207612995371/8.0),
+ REAL_CONST(32222.07030855212/8.0),
+ REAL_CONST(32239.935480052583/8.0),
+ REAL_CONST(32257.803126810672/8.0),
+ REAL_CONST(32275.673248140767/8.0),
+ REAL_CONST(32293.545843357719/8.0),
+ REAL_CONST(32311.420911776862/8.0),
+ REAL_CONST(32329.298452713996/8.0),
+ REAL_CONST(32347.178465485395/8.0),
+ REAL_CONST(32365.060949407813/8.0),
+ REAL_CONST(32382.945903798463/8.0),
+ REAL_CONST(32400.83332797504/8.0),
+ REAL_CONST(32418.723221255706/8.0),
+ REAL_CONST(32436.615582959093/8.0),
+ REAL_CONST(32454.510412404306/8.0),
+ REAL_CONST(32472.407708910916/8.0),
+ REAL_CONST(32490.307471798966/8.0),
+ REAL_CONST(32508.209700388961/8.0),
+ REAL_CONST(32526.114394001877/8.0),
+ REAL_CONST(32544.021551959166/8.0),
+ REAL_CONST(32561.931173582732/8.0),
+ REAL_CONST(32579.843258194956/8.0),
+ REAL_CONST(32597.757805118679/8.0),
+ REAL_CONST(32615.674813677211/8.0),
+ REAL_CONST(32633.594283194328/8.0),
+ REAL_CONST(32651.516212994258/8.0),
+ REAL_CONST(32669.440602401712/8.0),
+ REAL_CONST(32687.367450741847/8.0),
+ REAL_CONST(32705.296757340297/8.0),
+ REAL_CONST(32723.228521523146/8.0),
+ REAL_CONST(32741.162742616943/8.0),
+ REAL_CONST(32759.099419948703/8.0),
+ REAL_CONST(32777.038552845901/8.0),
+ REAL_CONST(32794.980140636464/8.0),
+ REAL_CONST(32812.924182648792/8.0),
+ REAL_CONST(32830.87067821173/8.0),
+ REAL_CONST(32848.819626654593/8.0),
+ REAL_CONST(32866.77102730715/8.0),
+ REAL_CONST(32884.724879499619/8.0),
+ REAL_CONST(32902.681182562686/8.0),
+ REAL_CONST(32920.639935827494/8.0),
+ REAL_CONST(32938.601138625643/8.0),
+ REAL_CONST(32956.56479028918/8.0),
+ REAL_CONST(32974.530890150607/8.0),
+ REAL_CONST(32992.499437542894/8.0),
+ REAL_CONST(33010.470431799447/8.0),
+ REAL_CONST(33028.443872254145/8.0),
+ REAL_CONST(33046.419758241311/8.0),
+ REAL_CONST(33064.39808909571/8.0),
+ REAL_CONST(33082.378864152583/8.0),
+ REAL_CONST(33100.36208274759/8.0),
+ REAL_CONST(33118.347744216881/8.0),
+ REAL_CONST(33136.335847897026/8.0),
+ REAL_CONST(33154.326393125062/8.0),
+ REAL_CONST(33172.31937923847/8.0),
+ REAL_CONST(33190.314805575174/8.0),
+ REAL_CONST(33208.312671473555/8.0),
+ REAL_CONST(33226.312976272442/8.0),
+ REAL_CONST(33244.315719311111/8.0),
+ REAL_CONST(33262.320899929284/8.0),
+ REAL_CONST(33280.328517467125/8.0),
+ REAL_CONST(33298.33857126526/8.0),
+ REAL_CONST(33316.351060664747/8.0),
+ REAL_CONST(33334.365985007091/8.0),
+ REAL_CONST(33352.383343634239/8.0),
+ REAL_CONST(33370.403135888591/8.0),
+ REAL_CONST(33388.42536111299/8.0),
+ REAL_CONST(33406.450018650721/8.0),
+ REAL_CONST(33424.477107845501/8.0),
+ REAL_CONST(33442.506628041512/8.0),
+ REAL_CONST(33460.53857858335/8.0),
+ REAL_CONST(33478.572958816083/8.0),
+ REAL_CONST(33496.609768085189/8.0),
+ REAL_CONST(33514.649005736617/8.0),
+ REAL_CONST(33532.690671116739/8.0),
+ REAL_CONST(33550.734763572356/8.0),
+ REAL_CONST(33568.781282450735/8.0),
+ REAL_CONST(33586.830227099563/8.0),
+ REAL_CONST(33604.881596866973/8.0),
+ REAL_CONST(33622.935391101528/8.0),
+ REAL_CONST(33640.991609152239/8.0),
+ REAL_CONST(33659.050250368542/8.0),
+ REAL_CONST(33677.111314100322/8.0),
+ REAL_CONST(33695.174799697881/8.0),
+ REAL_CONST(33713.240706511984/8.0),
+ REAL_CONST(33731.309033893805/8.0),
+ REAL_CONST(33749.37978119497/8.0),
+ REAL_CONST(33767.452947767531/8.0),
+ REAL_CONST(33785.528532963974/8.0),
+ REAL_CONST(33803.606536137209/8.0),
+ REAL_CONST(33821.686956640602/8.0),
+ REAL_CONST(33839.769793827938/8.0),
+ REAL_CONST(33857.855047053425/8.0),
+ REAL_CONST(33875.942715671707/8.0),
+ REAL_CONST(33894.032799037872/8.0),
+ REAL_CONST(33912.125296507431/8.0),
+ REAL_CONST(33930.220207436316/8.0),
+ REAL_CONST(33948.317531180888/8.0),
+ REAL_CONST(33966.417267097961/8.0),
+ REAL_CONST(33984.519414544746/8.0),
+ REAL_CONST(34002.623972878901/8.0),
+ REAL_CONST(34020.730941458511/8.0),
+ REAL_CONST(34038.840319642077/8.0),
+ REAL_CONST(34056.952106788536/8.0),
+ REAL_CONST(34075.066302257255/8.0),
+ REAL_CONST(34093.182905408015/8.0),
+ REAL_CONST(34111.301915601027/8.0),
+ REAL_CONST(34129.42333219693/8.0),
+ REAL_CONST(34147.547154556785/8.0),
+ REAL_CONST(34165.673382042078/8.0),
+ REAL_CONST(34183.80201401472/8.0),
+ REAL_CONST(34201.933049837033/8.0),
+ REAL_CONST(34220.06648887178/8.0),
+ REAL_CONST(34238.202330482141/8.0),
+ REAL_CONST(34256.340574031703/8.0),
+ REAL_CONST(34274.481218884495/8.0),
+ REAL_CONST(34292.624264404949/8.0),
+ REAL_CONST(34310.769709957938/8.0),
+ REAL_CONST(34328.91755490873/8.0),
+ REAL_CONST(34347.067798623029/8.0),
+ REAL_CONST(34365.220440466954/8.0),
+ REAL_CONST(34383.375479807051/8.0),
+ REAL_CONST(34401.532916010263/8.0),
+ REAL_CONST(34419.692748443973/8.0),
+ REAL_CONST(34437.854976475966/8.0),
+ REAL_CONST(34456.01959947445/8.0),
+ REAL_CONST(34474.18661680806/8.0),
+ REAL_CONST(34492.356027845817/8.0),
+ REAL_CONST(34510.527831957188/8.0),
+ REAL_CONST(34528.702028512052/8.0),
+ REAL_CONST(34546.878616880676/8.0),
+ REAL_CONST(34565.05759643377/8.0),
+ REAL_CONST(34583.238966542449/8.0),
+ REAL_CONST(34601.422726578232/8.0),
+ REAL_CONST(34619.608875913065/8.0),
+ REAL_CONST(34637.797413919296/8.0),
+ REAL_CONST(34655.988339969692/8.0),
+ REAL_CONST(34674.181653437423/8.0),
+ REAL_CONST(34692.37735369608/8.0),
+ REAL_CONST(34710.575440119668/8.0),
+ REAL_CONST(34728.775912082579/8.0),
+ REAL_CONST(34746.978768959649/8.0),
+ REAL_CONST(34765.184010126082/8.0),
+ REAL_CONST(34783.391634957537/8.0),
+ REAL_CONST(34801.60164283005/8.0),
+ REAL_CONST(34819.814033120063/8.0),
+ REAL_CONST(34838.028805204456/8.0),
+ REAL_CONST(34856.24595846048/8.0),
+ REAL_CONST(34874.465492265823/8.0),
+ REAL_CONST(34892.687405998557/8.0),
+ REAL_CONST(34910.911699037177/8.0),
+ REAL_CONST(34929.138370760564/8.0),
+ REAL_CONST(34947.367420548027/8.0),
+ REAL_CONST(34965.598847779271/8.0),
+ REAL_CONST(34983.832651834389/8.0),
+ REAL_CONST(35002.068832093908/8.0),
+ REAL_CONST(35020.307387938738/8.0),
+ REAL_CONST(35038.548318750189/8.0),
+ REAL_CONST(35056.79162390998/8.0),
+ REAL_CONST(35075.03730280025/8.0),
+ REAL_CONST(35093.285354803513/8.0),
+ REAL_CONST(35111.535779302685/8.0),
+ REAL_CONST(35129.788575681116/8.0),
+ REAL_CONST(35148.043743322516/8.0),
+ REAL_CONST(35166.301281611013/8.0),
+ REAL_CONST(35184.561189931141/8.0),
+ REAL_CONST(35202.823467667826/8.0),
+ REAL_CONST(35221.088114206388/8.0),
+ REAL_CONST(35239.355128932555/8.0),
+ REAL_CONST(35257.624511232447/8.0),
+ REAL_CONST(35275.896260492584/8.0),
+ REAL_CONST(35294.170376099886/8.0),
+ REAL_CONST(35312.446857441668/8.0),
+ REAL_CONST(35330.725703905628/8.0),
+ REAL_CONST(35349.006914879887/8.0),
+ REAL_CONST(35367.290489752944/8.0),
+ REAL_CONST(35385.576427913686/8.0),
+ REAL_CONST(35403.864728751418/8.0),
+ REAL_CONST(35422.155391655811/8.0),
+ REAL_CONST(35440.448416016967/8.0),
+ REAL_CONST(35458.743801225341/8.0),
+ REAL_CONST(35477.041546671804/8.0),
+ REAL_CONST(35495.341651747622/8.0),
+ REAL_CONST(35513.644115844436/8.0),
+ REAL_CONST(35531.948938354304/8.0),
+ REAL_CONST(35550.256118669655/8.0),
+ REAL_CONST(35568.565656183309/8.0),
+ REAL_CONST(35586.877550288496/8.0),
+ REAL_CONST(35605.191800378816/8.0),
+ REAL_CONST(35623.508405848268/8.0),
+ REAL_CONST(35641.827366091238/8.0),
+ REAL_CONST(35660.148680502505/8.0),
+ REAL_CONST(35678.472348477233/8.0),
+ REAL_CONST(35696.798369410979/8.0),
+ REAL_CONST(35715.126742699678/8.0),
+ REAL_CONST(35733.457467739659/8.0),
+ REAL_CONST(35751.790543927644/8.0),
+ REAL_CONST(35770.125970660738/8.0),
+ REAL_CONST(35788.46374733642/8.0),
+ REAL_CONST(35806.803873352568/8.0),
+ REAL_CONST(35825.146348107453/8.0),
+ REAL_CONST(35843.49117099971/8.0),
+ REAL_CONST(35861.838341428367/8.0),
+ REAL_CONST(35880.187858792851/8.0),
+ REAL_CONST(35898.539722492955/8.0),
+ REAL_CONST(35916.893931928862/8.0),
+ REAL_CONST(35935.250486501129/8.0),
+ REAL_CONST(35953.609385610718/8.0),
+ REAL_CONST(35971.970628658957/8.0),
+ REAL_CONST(35990.334215047558/8.0),
+ REAL_CONST(36008.700144178612/8.0),
+ REAL_CONST(36027.068415454596/8.0),
+ REAL_CONST(36045.439028278372/8.0),
+ REAL_CONST(36063.811982053165/8.0),
+ REAL_CONST(36082.187276182609/8.0),
+ REAL_CONST(36100.564910070694/8.0),
+ REAL_CONST(36118.944883121789/8.0),
+ REAL_CONST(36137.327194740654/8.0),
+ REAL_CONST(36155.711844332429/8.0),
+ REAL_CONST(36174.098831302617/8.0),
+ REAL_CONST(36192.488155057115/8.0),
+ REAL_CONST(36210.87981500219/8.0),
+ REAL_CONST(36229.273810544473/8.0),
+ REAL_CONST(36247.670141091003/8.0),
+ REAL_CONST(36266.068806049167/8.0),
+ REAL_CONST(36284.469804826738/8.0),
+ REAL_CONST(36302.873136831862/8.0),
+ REAL_CONST(36321.278801473069/8.0),
+ REAL_CONST(36339.686798159251/8.0),
+ REAL_CONST(36358.097126299683/8.0),
+ REAL_CONST(36376.509785304013/8.0),
+ REAL_CONST(36394.924774582258/8.0),
+ REAL_CONST(36413.342093544816/8.0),
+ REAL_CONST(36431.761741602444/8.0),
+ REAL_CONST(36450.183718166292/8.0),
+ REAL_CONST(36468.608022647859/8.0),
+ REAL_CONST(36487.034654459028/8.0),
+ REAL_CONST(36505.463613012063/8.0),
+ REAL_CONST(36523.894897719583/8.0),
+ REAL_CONST(36542.328507994578/8.0),
+ REAL_CONST(36560.764443250409/8.0),
+ REAL_CONST(36579.202702900831/8.0),
+ REAL_CONST(36597.643286359926/8.0),
+ REAL_CONST(36616.086193042182/8.0),
+ REAL_CONST(36634.531422362437/8.0),
+ REAL_CONST(36652.978973735895/8.0),
+ REAL_CONST(36671.428846578143/8.0),
+ REAL_CONST(36689.881040305125/8.0),
+ REAL_CONST(36708.335554333149/8.0),
+ REAL_CONST(36726.792388078902/8.0),
+ REAL_CONST(36745.251540959427/8.0),
+ REAL_CONST(36763.713012392138/8.0),
+ REAL_CONST(36782.176801794812/8.0),
+ REAL_CONST(36800.642908585593/8.0),
+ REAL_CONST(36819.111332182983/8.0),
+ REAL_CONST(36837.582072005869/8.0),
+ REAL_CONST(36856.055127473483/8.0),
+ REAL_CONST(36874.530498005421/8.0),
+ REAL_CONST(36893.008183021651/8.0),
+ REAL_CONST(36911.488181942506/8.0),
+ REAL_CONST(36929.970494188674/8.0),
+ REAL_CONST(36948.455119181206/8.0),
+ REAL_CONST(36966.942056341519/8.0),
+ REAL_CONST(36985.431305091392/8.0),
+ REAL_CONST(37003.922864852961/8.0),
+ REAL_CONST(37022.416735048733/8.0),
+ REAL_CONST(37040.912915101559/8.0),
+ REAL_CONST(37059.411404434657/8.0),
+ REAL_CONST(37077.91220247162/8.0),
+ REAL_CONST(37096.415308636388/8.0),
+ REAL_CONST(37114.920722353243/8.0),
+ REAL_CONST(37133.428443046862/8.0),
+ REAL_CONST(37151.938470142253/8.0),
+ REAL_CONST(37170.450803064785/8.0),
+ REAL_CONST(37188.965441240209/8.0),
+ REAL_CONST(37207.482384094597/8.0),
+ REAL_CONST(37226.001631054402/8.0),
+ REAL_CONST(37244.523181546429/8.0),
+ REAL_CONST(37263.047034997842/8.0),
+ REAL_CONST(37281.573190836149/8.0),
+ REAL_CONST(37300.101648489224/8.0),
+ REAL_CONST(37318.632407385296/8.0),
+ REAL_CONST(37337.165466952945/8.0),
+ REAL_CONST(37355.700826621112/8.0),
+ REAL_CONST(37374.238485819085/8.0),
+ REAL_CONST(37392.778443976509/8.0),
+ REAL_CONST(37411.320700523385/8.0),
+ REAL_CONST(37429.865254890057/8.0),
+ REAL_CONST(37448.412106507232/8.0),
+ REAL_CONST(37466.961254805974/8.0),
+ REAL_CONST(37485.512699217681/8.0),
+ REAL_CONST(37504.066439174116/8.0),
+ REAL_CONST(37522.622474107404/8.0),
+ REAL_CONST(37541.180803449992/8.0),
+ REAL_CONST(37559.741426634704/8.0),
+ REAL_CONST(37578.304343094693/8.0),
+ REAL_CONST(37596.869552263488/8.0),
+ REAL_CONST(37615.43705357494/8.0),
+ REAL_CONST(37634.006846463279/8.0),
+ REAL_CONST(37652.578930363044/8.0),
+ REAL_CONST(37671.153304709165/8.0),
+ REAL_CONST(37689.729968936896/8.0),
+ REAL_CONST(37708.308922481847/8.0),
+ REAL_CONST(37726.890164779965/8.0),
+ REAL_CONST(37745.473695267559/8.0),
+ REAL_CONST(37764.059513381275/8.0),
+ REAL_CONST(37782.647618558112/8.0),
+ REAL_CONST(37801.238010235415/8.0),
+ REAL_CONST(37819.830687850859/8.0),
+ REAL_CONST(37838.425650842495/8.0),
+ REAL_CONST(37857.022898648691/8.0),
+ REAL_CONST(37875.622430708172/8.0),
+ REAL_CONST(37894.224246460013/8.0),
+ REAL_CONST(37912.828345343616/8.0),
+ REAL_CONST(37931.434726798747/8.0),
+ REAL_CONST(37950.043390265506/8.0),
+ REAL_CONST(37968.654335184328/8.0),
+ REAL_CONST(37987.267560995999/8.0),
+ REAL_CONST(38005.883067141665/8.0),
+ REAL_CONST(38024.500853062775/8.0),
+ REAL_CONST(38043.120918201159/8.0),
+ REAL_CONST(38061.743261998963/8.0),
+ REAL_CONST(38080.367883898682/8.0),
+ REAL_CONST(38098.994783343158/8.0),
+ REAL_CONST(38117.623959775563/8.0),
+ REAL_CONST(38136.255412639417/8.0),
+ REAL_CONST(38154.889141378575/8.0),
+ REAL_CONST(38173.525145437234/8.0),
+ REAL_CONST(38192.163424259939/8.0),
+ REAL_CONST(38210.803977291551/8.0),
+ REAL_CONST(38229.446803977284/8.0),
+ REAL_CONST(38248.091903762703/8.0),
+ REAL_CONST(38266.739276093685/8.0),
+ REAL_CONST(38285.388920416466/8.0),
+ REAL_CONST(38304.040836177606/8.0),
+ REAL_CONST(38322.695022824002/8.0),
+ REAL_CONST(38341.351479802899/8.0),
+ REAL_CONST(38360.010206561863/8.0),
+ REAL_CONST(38378.671202548816/8.0),
+ REAL_CONST(38397.334467211993/8.0),
+ REAL_CONST(38415.999999999978/8.0),
+ REAL_CONST(38434.667800361683/8.0),
+ REAL_CONST(38453.33786774637/8.0),
+ REAL_CONST(38472.010201603611/8.0),
+ REAL_CONST(38490.684801383337/8.0),
+ REAL_CONST(38509.361666535784/8.0),
+ REAL_CONST(38528.040796511552/8.0),
+ REAL_CONST(38546.722190761553/8.0),
+ REAL_CONST(38565.405848737035/8.0),
+ REAL_CONST(38584.091769889594/8.0),
+ REAL_CONST(38602.779953671132/8.0),
+ REAL_CONST(38621.470399533908/8.0),
+ REAL_CONST(38640.163106930493/8.0),
+ REAL_CONST(38658.858075313794/8.0),
+ REAL_CONST(38677.555304137059/8.0),
+ REAL_CONST(38696.254792853862/8.0),
+ REAL_CONST(38714.956540918094/8.0),
+ REAL_CONST(38733.660547783991/8.0),
+ REAL_CONST(38752.366812906112/8.0),
+ REAL_CONST(38771.075335739348/8.0),
+ REAL_CONST(38789.78611573892/8.0),
+ REAL_CONST(38808.499152360368/8.0),
+ REAL_CONST(38827.214445059573/8.0),
+ REAL_CONST(38845.931993292739/8.0),
+ REAL_CONST(38864.651796516388/8.0),
+ REAL_CONST(38883.373854187383/8.0),
+ REAL_CONST(38902.098165762916/8.0),
+ REAL_CONST(38920.824730700486/8.0),
+ REAL_CONST(38939.553548457938/8.0),
+ REAL_CONST(38958.284618493431/8.0),
+ REAL_CONST(38977.017940265461/8.0),
+ REAL_CONST(38995.753513232834/8.0),
+ REAL_CONST(39014.491336854699/8.0),
+ REAL_CONST(39033.231410590517/8.0),
+ REAL_CONST(39051.973733900079/8.0),
+ REAL_CONST(39070.718306243485/8.0),
+ REAL_CONST(39089.465127081188/8.0),
+ REAL_CONST(39108.214195873945/8.0),
+ REAL_CONST(39126.965512082832/8.0),
+ REAL_CONST(39145.719075169261/8.0),
+ REAL_CONST(39164.474884594965/8.0),
+ REAL_CONST(39183.232939821988/8.0),
+ REAL_CONST(39201.99324031271/8.0),
+ REAL_CONST(39220.755785529815/8.0),
+ REAL_CONST(39239.52057493633/8.0),
+ REAL_CONST(39258.287607995589/8.0),
+ REAL_CONST(39277.056884171245/8.0),
+ REAL_CONST(39295.828402927284/8.0),
+ REAL_CONST(39314.602163728006/8.0),
+ REAL_CONST(39333.378166038019/8.0),
+ REAL_CONST(39352.15640932227/8.0),
+ REAL_CONST(39370.936893046004/8.0),
+ REAL_CONST(39389.719616674811/8.0),
+ REAL_CONST(39408.504579674584/8.0),
+ REAL_CONST(39427.291781511522/8.0),
+ REAL_CONST(39446.081221652174/8.0),
+ REAL_CONST(39464.872899563372/8.0),
+ REAL_CONST(39483.666814712291/8.0),
+ REAL_CONST(39502.462966566411/8.0),
+ REAL_CONST(39521.261354593538/8.0),
+ REAL_CONST(39540.06197826178/8.0),
+ REAL_CONST(39558.864837039568/8.0),
+ REAL_CONST(39577.669930395656/8.0),
+ REAL_CONST(39596.47725779911/8.0),
+ REAL_CONST(39615.286818719302/8.0),
+ REAL_CONST(39634.098612625923/8.0),
+ REAL_CONST(39652.912638988993/8.0),
+ REAL_CONST(39671.728897278823/8.0),
+ REAL_CONST(39690.547386966064/8.0),
+ REAL_CONST(39709.368107521652/8.0),
+ REAL_CONST(39728.191058416858/8.0),
+ REAL_CONST(39747.016239123259/8.0),
+ REAL_CONST(39765.84364911275/8.0),
+ REAL_CONST(39784.673287857528/8.0),
+ REAL_CONST(39803.505154830105/8.0),
+ REAL_CONST(39822.339249503319/8.0),
+ REAL_CONST(39841.175571350293/8.0),
+ REAL_CONST(39860.014119844491/8.0),
+ REAL_CONST(39878.854894459677/8.0),
+ REAL_CONST(39897.697894669909/8.0),
+ REAL_CONST(39916.54311994958/8.0),
+ REAL_CONST(39935.390569773372/8.0),
+ REAL_CONST(39954.240243616303/8.0),
+ REAL_CONST(39973.092140953675/8.0),
+ REAL_CONST(39991.946261261117/8.0),
+ REAL_CONST(40010.802604014549/8.0),
+ REAL_CONST(40029.661168690225/8.0),
+ REAL_CONST(40048.521954764678/8.0),
+ REAL_CONST(40067.384961714779/8.0),
+ REAL_CONST(40086.250189017679/8.0),
+ REAL_CONST(40105.117636150855/8.0),
+ REAL_CONST(40123.98730259209/8.0),
+ REAL_CONST(40142.859187819471/8.0),
+ REAL_CONST(40161.733291311379/8.0),
+ REAL_CONST(40180.609612546526/8.0),
+ REAL_CONST(40199.488151003912/8.0),
+ REAL_CONST(40218.368906162854/8.0),
+ REAL_CONST(40237.25187750296/8.0),
+ REAL_CONST(40256.137064504153/8.0),
+ REAL_CONST(40275.024466646668/8.0),
+ REAL_CONST(40293.914083411029/8.0),
+ REAL_CONST(40312.805914278084/8.0),
+ REAL_CONST(40331.699958728961/8.0),
+ REAL_CONST(40350.596216245103/8.0),
+ REAL_CONST(40369.494686308273/8.0),
+ REAL_CONST(40388.39536840051/8.0),
+ REAL_CONST(40407.298262004173/8.0),
+ REAL_CONST(40426.20336660192/8.0),
+ REAL_CONST(40445.110681676706/8.0),
+ REAL_CONST(40464.020206711793/8.0),
+ REAL_CONST(40482.931941190756/8.0),
+ REAL_CONST(40501.845884597446/8.0),
+ REAL_CONST(40520.762036416032/8.0),
+ REAL_CONST(40539.680396130985/8.0),
+ REAL_CONST(40558.600963227072/8.0),
+ REAL_CONST(40577.523737189367/8.0),
+ REAL_CONST(40596.448717503234/8.0),
+ REAL_CONST(40615.375903654342/8.0),
+ REAL_CONST(40634.305295128659/8.0),
+ REAL_CONST(40653.236891412453/8.0),
+ REAL_CONST(40672.170691992294/8.0),
+ REAL_CONST(40691.106696355047/8.0),
+ REAL_CONST(40710.044903987873/8.0),
+ REAL_CONST(40728.985314378238/8.0),
+ REAL_CONST(40747.927927013901/8.0),
+ REAL_CONST(40766.872741382918/8.0),
+ REAL_CONST(40785.819756973651/8.0),
+ REAL_CONST(40804.768973274746/8.0),
+ REAL_CONST(40823.720389775161/8.0),
+ REAL_CONST(40842.674005964131/8.0),
+ REAL_CONST(40861.629821331211/8.0),
+ REAL_CONST(40880.587835366234/8.0),
+ REAL_CONST(40899.548047559321/8.0),
+ REAL_CONST(40918.510457400931/8.0),
+ REAL_CONST(40937.475064381761/8.0),
+ REAL_CONST(40956.441867992849/8.0),
+ REAL_CONST(40975.410867725499/8.0),
+ REAL_CONST(40994.382063071331/8.0),
+ REAL_CONST(41013.355453522236/8.0),
+ REAL_CONST(41032.331038570417/8.0),
+ REAL_CONST(41051.308817708363/8.0),
+ REAL_CONST(41070.288790428858/8.0),
+ REAL_CONST(41089.270956224987/8.0),
+ REAL_CONST(41108.255314590111/8.0),
+ REAL_CONST(41127.241865017888/8.0),
+ REAL_CONST(41146.23060700229/8.0),
+ REAL_CONST(41165.221540037543/8.0),
+ REAL_CONST(41184.214663618193/8.0),
+ REAL_CONST(41203.209977239079/8.0),
+ REAL_CONST(41222.207480395307/8.0),
+ REAL_CONST(41241.207172582297/8.0),
+ REAL_CONST(41260.209053295752/8.0),
+ REAL_CONST(41279.213122031659/8.0),
+ REAL_CONST(41298.219378286303/8.0),
+ REAL_CONST(41317.227821556255/8.0),
+ REAL_CONST(41336.23845133838/8.0),
+ REAL_CONST(41355.251267129832/8.0),
+ REAL_CONST(41374.266268428037/8.0),
+ REAL_CONST(41393.283454730743/8.0),
+ REAL_CONST(41412.302825535953/8.0),
+ REAL_CONST(41431.324380341983/8.0),
+ REAL_CONST(41450.348118647416/8.0),
+ REAL_CONST(41469.374039951144/8.0),
+ REAL_CONST(41488.402143752326/8.0),
+ REAL_CONST(41507.432429550427/8.0),
+ REAL_CONST(41526.464896845187/8.0),
+ REAL_CONST(41545.499545136627/8.0),
+ REAL_CONST(41564.536373925075/8.0),
+ REAL_CONST(41583.575382711126/8.0),
+ REAL_CONST(41602.616570995662/8.0),
+ REAL_CONST(41621.659938279874/8.0),
+ REAL_CONST(41640.705484065205/8.0),
+ REAL_CONST(41659.753207853406/8.0),
+ REAL_CONST(41678.803109146495/8.0),
+ REAL_CONST(41697.855187446803/8.0),
+ REAL_CONST(41716.909442256911/8.0),
+ REAL_CONST(41735.965873079709/8.0),
+ REAL_CONST(41755.02447941836/8.0),
+ REAL_CONST(41774.085260776315/8.0),
+ REAL_CONST(41793.148216657297/8.0),
+ REAL_CONST(41812.213346565331/8.0),
+ REAL_CONST(41831.280650004708/8.0),
+ REAL_CONST(41850.350126480014/8.0),
+ REAL_CONST(41869.421775496106/8.0),
+ REAL_CONST(41888.495596558132/8.0),
+ REAL_CONST(41907.571589171515/8.0),
+ REAL_CONST(41926.649752841957/8.0),
+ REAL_CONST(41945.730087075463/8.0),
+ REAL_CONST(41964.812591378286/8.0),
+ REAL_CONST(41983.897265256979/8.0),
+ REAL_CONST(42002.984108218378/8.0),
+ REAL_CONST(42022.073119769593/8.0),
+ REAL_CONST(42041.164299418015/8.0),
+ REAL_CONST(42060.257646671307/8.0),
+ REAL_CONST(42079.353161037419/8.0),
+ REAL_CONST(42098.450842024591/8.0),
+ REAL_CONST(42117.550689141324/8.0),
+ REAL_CONST(42136.652701896404/8.0),
+ REAL_CONST(42155.756879798893/8.0),
+ REAL_CONST(42174.863222358137/8.0),
+ REAL_CONST(42193.971729083758/8.0),
+ REAL_CONST(42213.082399485655/8.0),
+ REAL_CONST(42232.195233074002/8.0),
+ REAL_CONST(42251.310229359246/8.0),
+ REAL_CONST(42270.427387852127/8.0),
+ REAL_CONST(42289.546708063644/8.0),
+ REAL_CONST(42308.668189505079/8.0),
+ REAL_CONST(42327.791831687995/8.0),
+ REAL_CONST(42346.917634124227/8.0),
+ REAL_CONST(42366.045596325886/8.0),
+ REAL_CONST(42385.175717805352/8.0),
+ REAL_CONST(42404.307998075295/8.0),
+ REAL_CONST(42423.442436648642/8.0),
+ REAL_CONST(42442.579033038608/8.0),
+ REAL_CONST(42461.717786758672/8.0),
+ REAL_CONST(42480.858697322597/8.0),
+ REAL_CONST(42500.001764244422/8.0),
+ REAL_CONST(42519.146987038446/8.0),
+ REAL_CONST(42538.294365219248/8.0),
+ REAL_CONST(42557.443898301688/8.0),
+ REAL_CONST(42576.595585800882/8.0),
+ REAL_CONST(42595.749427232236/8.0),
+ REAL_CONST(42614.90542211142/8.0),
+ REAL_CONST(42634.063569954378/8.0),
+ REAL_CONST(42653.223870277317/8.0),
+ REAL_CONST(42672.386322596729/8.0),
+ REAL_CONST(42691.55092642938/8.0),
+ REAL_CONST(42710.717681292292/8.0),
+ REAL_CONST(42729.886586702756/8.0),
+ REAL_CONST(42749.057642178363/8.0),
+ REAL_CONST(42768.23084723694/8.0),
+ REAL_CONST(42787.406201396603/8.0),
+ REAL_CONST(42806.58370417574/8.0),
+ REAL_CONST(42825.76335509299/8.0),
+ REAL_CONST(42844.945153667286/8.0),
+ REAL_CONST(42864.129099417805/8.0),
+ REAL_CONST(42883.315191864014/8.0),
+ REAL_CONST(42902.503430525649/8.0),
+ REAL_CONST(42921.693814922692/8.0),
+ REAL_CONST(42940.88634457541/8.0),
+ REAL_CONST(42960.081019004348/8.0),
+ REAL_CONST(42979.277837730297/8.0),
+ REAL_CONST(42998.476800274322/8.0),
+ REAL_CONST(43017.677906157769/8.0),
+ REAL_CONST(43036.881154902228/8.0),
+ REAL_CONST(43056.086546029583/8.0),
+ REAL_CONST(43075.294079061961/8.0),
+ REAL_CONST(43094.503753521763/8.0),
+ REAL_CONST(43113.715568931671/8.0),
+ REAL_CONST(43132.929524814601/8.0),
+ REAL_CONST(43152.145620693766/8.0),
+ REAL_CONST(43171.363856092619/8.0),
+ REAL_CONST(43190.584230534907/8.0),
+ REAL_CONST(43209.806743544621/8.0),
+ REAL_CONST(43229.031394646016/8.0),
+ REAL_CONST(43248.258183363621/8.0),
+ REAL_CONST(43267.487109222224/8.0),
+ REAL_CONST(43286.718171746885/8.0),
+ REAL_CONST(43305.951370462906/8.0),
+ REAL_CONST(43325.186704895881/8.0),
+ REAL_CONST(43344.42417457165/8.0),
+ REAL_CONST(43363.663779016322/8.0),
+ REAL_CONST(43382.905517756262/8.0),
+ REAL_CONST(43402.149390318104/8.0),
+ REAL_CONST(43421.395396228749/8.0),
+ REAL_CONST(43440.643535015348/8.0),
+ REAL_CONST(43459.89380620532/8.0),
+ REAL_CONST(43479.146209326354/8.0),
+ REAL_CONST(43498.400743906379/8.0),
+ REAL_CONST(43517.657409473606/8.0),
+ REAL_CONST(43536.916205556496/8.0),
+ REAL_CONST(43556.177131683784/8.0),
+ REAL_CONST(43575.44018738444/8.0),
+ REAL_CONST(43594.705372187724/8.0),
+ REAL_CONST(43613.972685623135/8.0),
+ REAL_CONST(43633.242127220445/8.0),
+ REAL_CONST(43652.513696509668/8.0),
+ REAL_CONST(43671.787393021099/8.0),
+ REAL_CONST(43691.063216285271/8.0),
+ REAL_CONST(43710.341165833001/8.0),
+ REAL_CONST(43729.621241195346/8.0),
+ REAL_CONST(43748.903441903625/8.0),
+ REAL_CONST(43768.187767489413/8.0),
+ REAL_CONST(43787.474217484552/8.0),
+ REAL_CONST(43806.762791421126/8.0),
+ REAL_CONST(43826.053488831501/8.0),
+ REAL_CONST(43845.346309248278/8.0),
+ REAL_CONST(43864.641252204325/8.0),
+ REAL_CONST(43883.938317232765/8.0),
+ REAL_CONST(43903.237503866971/8.0),
+ REAL_CONST(43922.538811640596/8.0),
+ REAL_CONST(43941.842240087513/8.0),
+ REAL_CONST(43961.147788741881/8.0),
+ REAL_CONST(43980.455457138101/8.0),
+ REAL_CONST(43999.765244810835/8.0),
+ REAL_CONST(44019.077151295001/8.0),
+ REAL_CONST(44038.391176125755/8.0),
+ REAL_CONST(44057.70731883854/8.0),
+ REAL_CONST(44077.02557896902/8.0),
+ REAL_CONST(44096.345956053141/8.0),
+ REAL_CONST(44115.668449627083/8.0),
+ REAL_CONST(44134.993059227287/8.0),
+ REAL_CONST(44154.319784390456/8.0),
+ REAL_CONST(44173.648624653535/8.0),
+ REAL_CONST(44192.979579553728/8.0),
+ REAL_CONST(44212.312648628489/8.0),
+ REAL_CONST(44231.647831415532/8.0),
+ REAL_CONST(44250.985127452805/8.0),
+ REAL_CONST(44270.324536278538/8.0),
+ REAL_CONST(44289.666057431183/8.0),
+ REAL_CONST(44309.009690449464/8.0),
+ REAL_CONST(44328.355434872348/8.0),
+ REAL_CONST(44347.703290239064/8.0),
+ REAL_CONST(44367.053256089079/8.0),
+ REAL_CONST(44386.405331962109/8.0),
+ REAL_CONST(44405.759517398139/8.0),
+ REAL_CONST(44425.115811937387/8.0),
+ REAL_CONST(44444.474215120332/8.0),
+ REAL_CONST(44463.834726487694/8.0),
+ REAL_CONST(44483.197345580462/8.0),
+ REAL_CONST(44502.562071939843/8.0),
+ REAL_CONST(44521.928905107328/8.0),
+ REAL_CONST(44541.297844624634/8.0),
+ REAL_CONST(44560.668890033732/8.0),
+ REAL_CONST(44580.042040876848/8.0),
+ REAL_CONST(44599.417296696454/8.0),
+ REAL_CONST(44618.794657035272/8.0),
+ REAL_CONST(44638.174121436256/8.0),
+ REAL_CONST(44657.555689442641/8.0),
+ REAL_CONST(44676.939360597877/8.0),
+ REAL_CONST(44696.325134445673/8.0),
+ REAL_CONST(44715.713010530002/8.0),
+ REAL_CONST(44735.102988395054/8.0),
+ REAL_CONST(44754.495067585296/8.0),
+ REAL_CONST(44773.88924764542/8.0),
+ REAL_CONST(44793.285528120374/8.0),
+ REAL_CONST(44812.683908555344/8.0),
+ REAL_CONST(44832.084388495779/8.0),
+ REAL_CONST(44851.486967487363/8.0),
+ REAL_CONST(44870.891645076015/8.0),
+ REAL_CONST(44890.298420807922/8.0),
+ REAL_CONST(44909.707294229491/8.0),
+ REAL_CONST(44929.118264887409/8.0),
+ REAL_CONST(44948.531332328566/8.0),
+ REAL_CONST(44967.946496100136/8.0),
+ REAL_CONST(44987.363755749502/8.0),
+ REAL_CONST(45006.783110824319/8.0),
+ REAL_CONST(45026.204560872473/8.0),
+ REAL_CONST(45045.628105442098/8.0),
+ REAL_CONST(45065.053744081561/8.0),
+ REAL_CONST(45084.48147633949/8.0),
+ REAL_CONST(45103.911301764747/8.0),
+ REAL_CONST(45123.343219906426/8.0),
+ REAL_CONST(45142.777230313885/8.0),
+ REAL_CONST(45162.21333253671/8.0),
+ REAL_CONST(45181.651526124733/8.0),
+ REAL_CONST(45201.091810628037/8.0),
+ REAL_CONST(45220.534185596924/8.0),
+ REAL_CONST(45239.978650581965/8.0),
+ REAL_CONST(45259.425205133957/8.0),
+ REAL_CONST(45278.873848803938/8.0),
+ REAL_CONST(45298.324581143192/8.0),
+ REAL_CONST(45317.777401703235/8.0),
+ REAL_CONST(45337.232310035848/8.0),
+ REAL_CONST(45356.68930569302/8.0),
+ REAL_CONST(45376.148388226997/8.0),
+ REAL_CONST(45395.60955719027/8.0),
+ REAL_CONST(45415.072812135557/8.0),
+ REAL_CONST(45434.538152615823/8.0),
+ REAL_CONST(45454.005578184282/8.0),
+ REAL_CONST(45473.475088394356/8.0),
+ REAL_CONST(45492.946682799746/8.0),
+ REAL_CONST(45512.420360954362/8.0),
+ REAL_CONST(45531.896122412363/8.0),
+ REAL_CONST(45551.373966728155/8.0),
+ REAL_CONST(45570.853893456362/8.0),
+ REAL_CONST(45590.33590215187/8.0),
+ REAL_CONST(45609.819992369776/8.0),
+ REAL_CONST(45629.306163665438/8.0),
+ REAL_CONST(45648.794415594442/8.0),
+ REAL_CONST(45668.284747712612/8.0),
+ REAL_CONST(45687.777159576006/8.0),
+ REAL_CONST(45707.27165074092/8.0),
+ REAL_CONST(45726.768220763894/8.0),
+ REAL_CONST(45746.266869201696/8.0),
+ REAL_CONST(45765.767595611323/8.0),
+ REAL_CONST(45785.270399550034/8.0),
+ REAL_CONST(45804.775280575297/8.0),
+ REAL_CONST(45824.282238244828/8.0),
+ REAL_CONST(45843.79127211657/8.0),
+ REAL_CONST(45863.302381748719/8.0),
+ REAL_CONST(45882.815566699683/8.0),
+ REAL_CONST(45902.33082652813/8.0),
+ REAL_CONST(45921.848160792935/8.0),
+ REAL_CONST(45941.367569053225/8.0),
+ REAL_CONST(45960.889050868354/8.0),
+ REAL_CONST(45980.41260579793/8.0),
+ REAL_CONST(45999.938233401757/8.0),
+ REAL_CONST(46019.465933239902/8.0),
+ REAL_CONST(46038.995704872657/8.0),
+ REAL_CONST(46058.527547860547/8.0),
+ REAL_CONST(46078.06146176433/8.0),
+ REAL_CONST(46097.597446144995/8.0),
+ REAL_CONST(46117.135500563774/8.0),
+ REAL_CONST(46136.675624582109/8.0),
+ REAL_CONST(46156.217817761702/8.0),
+ REAL_CONST(46175.762079664462/8.0),
+ REAL_CONST(46195.308409852543/8.0),
+ REAL_CONST(46214.856807888333/8.0),
+ REAL_CONST(46234.407273334444/8.0),
+ REAL_CONST(46253.959805753715/8.0),
+ REAL_CONST(46273.51440470924/8.0),
+ REAL_CONST(46293.071069764315/8.0),
+ REAL_CONST(46312.629800482478/8.0),
+ REAL_CONST(46332.190596427499/8.0),
+ REAL_CONST(46351.753457163381/8.0),
+ REAL_CONST(46371.318382254351/8.0),
+ REAL_CONST(46390.885371264863/8.0),
+ REAL_CONST(46410.45442375962/8.0),
+ REAL_CONST(46430.025539303526/8.0),
+ REAL_CONST(46449.598717461733/8.0),
+ REAL_CONST(46469.17395779962/8.0),
+ REAL_CONST(46488.751259882782/8.0),
+ REAL_CONST(46508.33062327707/8.0),
+ REAL_CONST(46527.912047548532/8.0),
+ REAL_CONST(46547.495532263471/8.0),
+ REAL_CONST(46567.081076988397/8.0),
+ REAL_CONST(46586.668681290059/8.0),
+ REAL_CONST(46606.258344735434/8.0),
+ REAL_CONST(46625.850066891719/8.0),
+ REAL_CONST(46645.443847326351/8.0),
+ REAL_CONST(46665.039685606986/8.0),
+ REAL_CONST(46684.637581301497/8.0),
+ REAL_CONST(46704.237533978005/8.0),
+ REAL_CONST(46723.839543204842/8.0),
+ REAL_CONST(46743.443608550573/8.0),
+ REAL_CONST(46763.049729583989/8.0),
+ REAL_CONST(46782.657905874104/8.0),
+ REAL_CONST(46802.268136990162/8.0),
+ REAL_CONST(46821.880422501628/8.0),
+ REAL_CONST(46841.494761978196/8.0),
+ REAL_CONST(46861.111154989776/8.0),
+ REAL_CONST(46880.729601106526/8.0),
+ REAL_CONST(46900.350099898795/8.0),
+ REAL_CONST(46919.97265093719/8.0),
+ REAL_CONST(46939.597253792526/8.0),
+ REAL_CONST(46959.223908035841/8.0),
+ REAL_CONST(46978.852613238392/8.0),
+ REAL_CONST(46998.483368971691/8.0),
+ REAL_CONST(47018.11617480743/8.0),
+ REAL_CONST(47037.751030317551/8.0),
+ REAL_CONST(47057.387935074221/8.0),
+ REAL_CONST(47077.026888649809/8.0),
+ REAL_CONST(47096.66789061694/8.0),
+ REAL_CONST(47116.310940548428/8.0),
+ REAL_CONST(47135.956038017328/8.0),
+ REAL_CONST(47155.603182596918/8.0),
+ REAL_CONST(47175.252373860698/8.0),
+ REAL_CONST(47194.903611382375/8.0),
+ REAL_CONST(47214.556894735892/8.0),
+ REAL_CONST(47234.212223495422/8.0),
+ REAL_CONST(47253.869597235338/8.0),
+ REAL_CONST(47273.52901553025/8.0),
+ REAL_CONST(47293.19047795498/8.0),
+ REAL_CONST(47312.853984084577/8.0),
+ REAL_CONST(47332.519533494306/8.0),
+ REAL_CONST(47352.187125759658/8.0),
+ REAL_CONST(47371.856760456343/8.0),
+ REAL_CONST(47391.528437160297/8.0),
+ REAL_CONST(47411.202155447652/8.0),
+ REAL_CONST(47430.877914894787/8.0),
+ REAL_CONST(47450.555715078299/8.0),
+ REAL_CONST(47470.235555574982/8.0),
+ REAL_CONST(47489.917435961863/8.0),
+ REAL_CONST(47509.601355816201/8.0),
+ REAL_CONST(47529.287314715453/8.0),
+ REAL_CONST(47548.975312237308/8.0),
+ REAL_CONST(47568.665347959672/8.0),
+ REAL_CONST(47588.357421460656/8.0),
+ REAL_CONST(47608.051532318605/8.0),
+ REAL_CONST(47627.747680112072/8.0),
+ REAL_CONST(47647.445864419846/8.0),
+ REAL_CONST(47667.14608482091/8.0),
+ REAL_CONST(47686.848340894474/8.0),
+ REAL_CONST(47706.552632219973/8.0),
+ REAL_CONST(47726.258958377046/8.0),
+ REAL_CONST(47745.967318945557/8.0),
+ REAL_CONST(47765.677713505589/8.0),
+ REAL_CONST(47785.390141637428/8.0),
+ REAL_CONST(47805.104602921601/8.0),
+ REAL_CONST(47824.821096938824/8.0),
+ REAL_CONST(47844.539623270044/8.0),
+ REAL_CONST(47864.260181496429/8.0),
+ REAL_CONST(47883.982771199349/8.0),
+ REAL_CONST(47903.707391960394/8.0),
+ REAL_CONST(47923.434043361369/8.0),
+ REAL_CONST(47943.162724984308/8.0),
+ REAL_CONST(47962.893436411439/8.0),
+ REAL_CONST(47982.626177225218/8.0),
+ REAL_CONST(48002.36094700831/8.0),
+ REAL_CONST(48022.097745343599/8.0),
+ REAL_CONST(48041.836571814172/8.0),
+ REAL_CONST(48061.57742600335/8.0),
+ REAL_CONST(48081.32030749465/8.0),
+ REAL_CONST(48101.065215871815/8.0),
+ REAL_CONST(48120.81215071879/8.0),
+ REAL_CONST(48140.56111161974/8.0),
+ REAL_CONST(48160.312098159047/8.0),
+ REAL_CONST(48180.065109921306/8.0),
+ REAL_CONST(48199.820146491307/8.0),
+ REAL_CONST(48219.577207454073/8.0),
+ REAL_CONST(48239.336292394844/8.0),
+ REAL_CONST(48259.097400899045/8.0),
+ REAL_CONST(48278.860532552339/8.0),
+ REAL_CONST(48298.625686940592/8.0),
+ REAL_CONST(48318.392863649875/8.0),
+ REAL_CONST(48338.162062266485/8.0),
+ REAL_CONST(48357.933282376915/8.0),
+ REAL_CONST(48377.706523567889/8.0),
+ REAL_CONST(48397.481785426316/8.0),
+ REAL_CONST(48417.259067539344/8.0),
+ REAL_CONST(48437.038369494308/8.0),
+ REAL_CONST(48456.819690878765/8.0),
+ REAL_CONST(48476.603031280487/8.0),
+ REAL_CONST(48496.388390287451/8.0),
+ REAL_CONST(48516.175767487839/8.0),
+ REAL_CONST(48535.965162470042/8.0),
+ REAL_CONST(48555.756574822684/8.0),
+ REAL_CONST(48575.550004134566/8.0),
+ REAL_CONST(48595.345449994718/8.0),
+ REAL_CONST(48615.142911992378/8.0),
+ REAL_CONST(48634.942389716991/8.0),
+ REAL_CONST(48654.743882758201/8.0),
+ REAL_CONST(48674.547390705877/8.0),
+ REAL_CONST(48694.352913150084/8.0),
+ REAL_CONST(48714.160449681112/8.0),
+ REAL_CONST(48733.969999889443/8.0),
+ REAL_CONST(48753.781563365759/8.0),
+ REAL_CONST(48773.595139700978/8.0),
+ REAL_CONST(48793.410728486211/8.0),
+ REAL_CONST(48813.228329312769/8.0),
+ REAL_CONST(48833.047941772187/8.0),
+ REAL_CONST(48852.869565456189/8.0),
+ REAL_CONST(48872.693199956717/8.0),
+ REAL_CONST(48892.518844865925/8.0),
+ REAL_CONST(48912.346499776155/8.0),
+ REAL_CONST(48932.176164279976/8.0),
+ REAL_CONST(48952.007837970152/8.0),
+ REAL_CONST(48971.841520439666/8.0),
+ REAL_CONST(48991.677211281676/8.0),
+ REAL_CONST(49011.514910089587/8.0),
+ REAL_CONST(49031.354616456978/8.0),
+ REAL_CONST(49051.196329977654/8.0),
+ REAL_CONST(49071.04005024561/8.0),
+ REAL_CONST(49090.885776855059/8.0),
+ REAL_CONST(49110.733509400408/8.0),
+ REAL_CONST(49130.583247476279/8.0),
+ REAL_CONST(49150.434990677488/8.0),
+ REAL_CONST(49170.288738599062/8.0),
+ REAL_CONST(49190.144490836232/8.0),
+ REAL_CONST(49210.002246984441/8.0),
+ REAL_CONST(49229.86200663932/8.0),
+ REAL_CONST(49249.723769396718/8.0),
+ REAL_CONST(49269.587534852675/8.0),
+ REAL_CONST(49289.453302603448/8.0),
+ REAL_CONST(49309.32107224549/8.0),
+ REAL_CONST(49329.190843375451/8.0),
+ REAL_CONST(49349.062615590192/8.0),
+ REAL_CONST(49368.936388486785/8.0),
+ REAL_CONST(49388.812161662492/8.0),
+ REAL_CONST(49408.689934714785/8.0),
+ REAL_CONST(49428.569707241324/8.0),
+ REAL_CONST(49448.45147883999/8.0),
+ REAL_CONST(49468.335249108866/8.0),
+ REAL_CONST(49488.22101764621/8.0),
+ REAL_CONST(49508.108784050521/8.0),
+ REAL_CONST(49527.99854792047/8.0),
+ REAL_CONST(49547.890308854934/8.0),
+ REAL_CONST(49567.784066453009/8.0),
+ REAL_CONST(49587.679820313977/8.0),
+ REAL_CONST(49607.57757003732/8.0),
+ REAL_CONST(49627.477315222721/8.0),
+ REAL_CONST(49647.379055470075/8.0),
+ REAL_CONST(49667.28279037946/8.0),
+ REAL_CONST(49687.188519551179/8.0),
+ REAL_CONST(49707.096242585707/8.0),
+ REAL_CONST(49727.005959083741/8.0),
+ REAL_CONST(49746.917668646165/8.0),
+ REAL_CONST(49766.831370874068/8.0),
+ REAL_CONST(49786.747065368734/8.0),
+ REAL_CONST(49806.66475173166/8.0),
+ REAL_CONST(49826.584429564515/8.0),
+ REAL_CONST(49846.506098469203/8.0),
+ REAL_CONST(49866.429758047794/8.0),
+ REAL_CONST(49886.355407902578/8.0),
+ REAL_CONST(49906.283047636032/8.0),
+ REAL_CONST(49926.212676850846/8.0),
+ REAL_CONST(49946.144295149883/8.0),
+ REAL_CONST(49966.077902136225/8.0),
+ REAL_CONST(49986.013497413151/8.0),
+ REAL_CONST(50005.951080584135/8.0),
+ REAL_CONST(50025.890651252834/8.0),
+ REAL_CONST(50045.832209023123/8.0),
+ REAL_CONST(50065.775753499074/8.0),
+ REAL_CONST(50085.721284284933/8.0),
+ REAL_CONST(50105.668800985164/8.0),
+ REAL_CONST(50125.618303204428/8.0),
+ REAL_CONST(50145.569790547575/8.0),
+ REAL_CONST(50165.523262619652/8.0),
+ REAL_CONST(50185.478719025901/8.0),
+ REAL_CONST(50205.436159371769/8.0),
+ REAL_CONST(50225.395583262893/8.0),
+ REAL_CONST(50245.356990305103/8.0),
+ REAL_CONST(50265.320380104429/8.0),
+ REAL_CONST(50285.285752267104/8.0),
+ REAL_CONST(50305.253106399534/8.0),
+ REAL_CONST(50325.222442108337/8.0),
+ REAL_CONST(50345.193759000336/8.0),
+ REAL_CONST(50365.16705668252/8.0),
+ REAL_CONST(50385.142334762102/8.0),
+ REAL_CONST(50405.119592846473/8.0),
+ REAL_CONST(50425.098830543218/8.0),
+ REAL_CONST(50445.080047460127/8.0),
+ REAL_CONST(50465.063243205179/8.0),
+ REAL_CONST(50485.048417386541/8.0),
+ REAL_CONST(50505.035569612577/8.0),
+ REAL_CONST(50525.024699491856/8.0),
+ REAL_CONST(50545.015806633128/8.0),
+ REAL_CONST(50565.008890645338/8.0),
+ REAL_CONST(50585.003951137631/8.0),
+ REAL_CONST(50605.00098771933/8.0),
+ REAL_CONST(50624.999999999971/8.0),
+ REAL_CONST(50645.000987589265/8.0),
+ REAL_CONST(50665.003950097132/8.0),
+ REAL_CONST(50685.008887133677/8.0),
+ REAL_CONST(50705.015798309192/8.0),
+ REAL_CONST(50725.024683234165/8.0),
+ REAL_CONST(50745.035541519283/8.0),
+ REAL_CONST(50765.048372775411/8.0),
+ REAL_CONST(50785.063176613621/8.0),
+ REAL_CONST(50805.079952645159/8.0),
+ REAL_CONST(50825.098700481489/8.0),
+ REAL_CONST(50845.119419734241/8.0),
+ REAL_CONST(50865.142110015244/8.0),
+ REAL_CONST(50885.166770936521/8.0),
+ REAL_CONST(50905.193402110279/8.0),
+ REAL_CONST(50925.222003148934/8.0),
+ REAL_CONST(50945.252573665071/8.0),
+ REAL_CONST(50965.285113271471/8.0),
+ REAL_CONST(50985.319621581119/8.0),
+ REAL_CONST(51005.356098207172/8.0),
+ REAL_CONST(51025.394542762981/8.0),
+ REAL_CONST(51045.434954862096/8.0),
+ REAL_CONST(51065.477334118244/8.0),
+ REAL_CONST(51085.521680145357/8.0),
+ REAL_CONST(51105.567992557546/8.0),
+ REAL_CONST(51125.616270969113/8.0),
+ REAL_CONST(51145.66651499454/8.0),
+ REAL_CONST(51165.718724248516/8.0),
+ REAL_CONST(51185.772898345916/8.0),
+ REAL_CONST(51205.829036901778/8.0),
+ REAL_CONST(51225.887139531362/8.0),
+ REAL_CONST(51245.947205850105/8.0),
+ REAL_CONST(51266.009235473619/8.0),
+ REAL_CONST(51286.073228017718/8.0),
+ REAL_CONST(51306.139183098399/8.0),
+ REAL_CONST(51326.207100331856/8.0),
+ REAL_CONST(51346.276979334456/8.0),
+ REAL_CONST(51366.348819722756/8.0),
+ REAL_CONST(51386.42262111351/8.0),
+ REAL_CONST(51406.498383123653/8.0),
+ REAL_CONST(51426.57610537031/8.0),
+ REAL_CONST(51446.655787470787/8.0),
+ REAL_CONST(51466.737429042587/8.0),
+ REAL_CONST(51486.82102970338/8.0),
+ REAL_CONST(51506.906589071048/8.0),
+ REAL_CONST(51526.994106763632/8.0),
+ REAL_CONST(51547.083582399391/8.0),
+ REAL_CONST(51567.175015596738/8.0),
+ REAL_CONST(51587.268405974297/8.0),
+ REAL_CONST(51607.363753150858/8.0),
+ REAL_CONST(51627.461056745415/8.0),
+ REAL_CONST(51647.56031637713/8.0),
+ REAL_CONST(51667.661531665362/8.0),
+ REAL_CONST(51687.764702229651/8.0),
+ REAL_CONST(51707.869827689727/8.0),
+ REAL_CONST(51727.976907665499/8.0),
+ REAL_CONST(51748.085941777055/8.0),
+ REAL_CONST(51768.196929644677/8.0),
+ REAL_CONST(51788.309870888836/8.0),
+ REAL_CONST(51808.42476513017/8.0),
+ REAL_CONST(51828.541611989524/8.0),
+ REAL_CONST(51848.660411087905/8.0),
+ REAL_CONST(51868.781162046515/8.0),
+ REAL_CONST(51888.90386448674/8.0),
+ REAL_CONST(51909.028518030143/8.0),
+ REAL_CONST(51929.155122298485/8.0),
+ REAL_CONST(51949.283676913685/8.0),
+ REAL_CONST(51969.414181497872/8.0),
+ REAL_CONST(51989.546635673345/8.0),
+ REAL_CONST(52009.681039062583/8.0),
+ REAL_CONST(52029.817391288263/8.0),
+ REAL_CONST(52049.955691973213/8.0),
+ REAL_CONST(52070.095940740481/8.0),
+ REAL_CONST(52090.238137213273/8.0),
+ REAL_CONST(52110.382281014987/8.0),
+ REAL_CONST(52130.5283717692/8.0),
+ REAL_CONST(52150.676409099666/8.0),
+ REAL_CONST(52170.826392630333/8.0),
+ REAL_CONST(52190.97832198532/8.0),
+ REAL_CONST(52211.132196788931/8.0),
+ REAL_CONST(52231.288016665654/8.0),
+ REAL_CONST(52251.445781240145/8.0),
+ REAL_CONST(52271.60549013727/8.0),
+ REAL_CONST(52291.76714298204/8.0),
+ REAL_CONST(52311.930739399664/8.0),
+ REAL_CONST(52332.096279015546/8.0),
+ REAL_CONST(52352.263761455244/8.0),
+ REAL_CONST(52372.433186344519/8.0),
+ REAL_CONST(52392.604553309284/8.0),
+ REAL_CONST(52412.777861975665/8.0),
+ REAL_CONST(52432.953111969946/8.0),
+ REAL_CONST(52453.130302918595/8.0),
+ REAL_CONST(52473.309434448267/8.0),
+ REAL_CONST(52493.490506185793/8.0),
+ REAL_CONST(52513.67351775818/8.0),
+ REAL_CONST(52533.858468792605/8.0),
+ REAL_CONST(52554.045358916446/8.0),
+ REAL_CONST(52574.234187757254/8.0),
+ REAL_CONST(52594.42495494274/8.0),
+ REAL_CONST(52614.617660100812/8.0),
+ REAL_CONST(52634.812302859558/8.0),
+ REAL_CONST(52655.008882847229/8.0),
+ REAL_CONST(52675.20739969227/8.0),
+ REAL_CONST(52695.407853023295/8.0),
+ REAL_CONST(52715.610242469098/8.0),
+ REAL_CONST(52735.814567658657/8.0),
+ REAL_CONST(52756.02082822111/8.0),
+ REAL_CONST(52776.229023785803/8.0),
+ REAL_CONST(52796.439153982225/8.0),
+ REAL_CONST(52816.651218440056/8.0),
+ REAL_CONST(52836.865216789171/8.0),
+ REAL_CONST(52857.081148659599/8.0),
+ REAL_CONST(52877.29901368155/8.0),
+ REAL_CONST(52897.518811485425/8.0),
+ REAL_CONST(52917.740541701773/8.0),
+ REAL_CONST(52937.964203961354/8.0),
+ REAL_CONST(52958.18979789508/8.0),
+ REAL_CONST(52978.417323134046/8.0),
+ REAL_CONST(52998.646779309529/8.0),
+ REAL_CONST(53018.878166052978/8.0),
+ REAL_CONST(53039.111482996006/8.0),
+ REAL_CONST(53059.346729770419/8.0),
+ REAL_CONST(53079.583906008193/8.0),
+ REAL_CONST(53099.823011341483/8.0),
+ REAL_CONST(53120.0640454026/8.0),
+ REAL_CONST(53140.307007824063/8.0),
+ REAL_CONST(53160.551898238533/8.0),
+ REAL_CONST(53180.79871627887/8.0),
+ REAL_CONST(53201.047461578091/8.0),
+ REAL_CONST(53221.2981337694/8.0),
+ REAL_CONST(53241.550732486176/8.0),
+ REAL_CONST(53261.805257361964/8.0),
+ REAL_CONST(53282.061708030487/8.0),
+ REAL_CONST(53302.32008412564/8.0),
+ REAL_CONST(53322.580385281493/8.0),
+ REAL_CONST(53342.842611132299/8.0),
+ REAL_CONST(53363.106761312469/8.0),
+ REAL_CONST(53383.372835456597/8.0),
+ REAL_CONST(53403.640833199453/8.0),
+ REAL_CONST(53423.910754175973/8.0),
+ REAL_CONST(53444.18259802126/8.0),
+ REAL_CONST(53464.456364370613/8.0),
+ REAL_CONST(53484.732052859479/8.0),
+ REAL_CONST(53505.009663123499/8.0),
+ REAL_CONST(53525.289194798468/8.0),
+ REAL_CONST(53545.570647520362/8.0),
+ REAL_CONST(53565.854020925333/8.0),
+ REAL_CONST(53586.139314649699/8.0),
+ REAL_CONST(53606.426528329954/8.0),
+ REAL_CONST(53626.715661602764/8.0),
+ REAL_CONST(53647.006714104959/8.0),
+ REAL_CONST(53667.299685473547/8.0),
+ REAL_CONST(53687.59457534572/8.0),
+ REAL_CONST(53707.891383358816/8.0),
+ REAL_CONST(53728.190109150361/8.0),
+ REAL_CONST(53748.490752358055/8.0),
+ REAL_CONST(53768.793312619753/8.0),
+ REAL_CONST(53789.09778957349/8.0),
+ REAL_CONST(53809.404182857485/8.0),
+ REAL_CONST(53829.712492110106/8.0),
+ REAL_CONST(53850.022716969899/8.0),
+ REAL_CONST(53870.334857075584/8.0),
+ REAL_CONST(53890.648912066055/8.0),
+ REAL_CONST(53910.964881580367/8.0),
+ REAL_CONST(53931.28276525774/8.0),
+ REAL_CONST(53951.602562737586/8.0),
+ REAL_CONST(53971.924273659461/8.0),
+ REAL_CONST(53992.24789766311/8.0),
+ REAL_CONST(54012.57343438844/8.0),
+ REAL_CONST(54032.90088347553/8.0),
+ REAL_CONST(54053.23024456462/8.0),
+ REAL_CONST(54073.561517296133/8.0),
+ REAL_CONST(54093.894701310644/8.0),
+ REAL_CONST(54114.22979624891/8.0),
+ REAL_CONST(54134.566801751855/8.0),
+ REAL_CONST(54154.90571746057/8.0),
+ REAL_CONST(54175.246543016314/8.0),
+ REAL_CONST(54195.589278060506/8.0),
+ REAL_CONST(54215.933922234755/8.0),
+ REAL_CONST(54236.280475180814/8.0),
+ REAL_CONST(54256.628936540626/8.0),
+ REAL_CONST(54276.97930595628/8.0),
+ REAL_CONST(54297.331583070045/8.0),
+ REAL_CONST(54317.685767524359/8.0),
+ REAL_CONST(54338.041858961828/8.0),
+ REAL_CONST(54358.399857025215/8.0),
+ REAL_CONST(54378.759761357462/8.0),
+ REAL_CONST(54399.121571601667/8.0),
+ REAL_CONST(54419.485287401105/8.0),
+ REAL_CONST(54439.850908399218/8.0),
+ REAL_CONST(54460.218434239614/8.0),
+ REAL_CONST(54480.587864566056/8.0),
+ REAL_CONST(54500.95919902248/8.0),
+ REAL_CONST(54521.332437252997/8.0),
+ REAL_CONST(54541.707578901878/8.0),
+ REAL_CONST(54562.084623613555/8.0),
+ REAL_CONST(54582.46357103264/8.0),
+ REAL_CONST(54602.844420803893/8.0),
+ REAL_CONST(54623.227172572246/8.0),
+ REAL_CONST(54643.611825982807/8.0),
+ REAL_CONST(54663.998380680838/8.0),
+ REAL_CONST(54684.386836311773/8.0),
+ REAL_CONST(54704.777192521207/8.0),
+ REAL_CONST(54725.169448954897/8.0),
+ REAL_CONST(54745.563605258772/8.0),
+ REAL_CONST(54765.959661078923/8.0),
+ REAL_CONST(54786.357616061614/8.0),
+ REAL_CONST(54806.757469853255/8.0),
+ REAL_CONST(54827.159222100439/8.0),
+ REAL_CONST(54847.562872449904/8.0),
+ REAL_CONST(54867.968420548583/8.0),
+ REAL_CONST(54888.375866043534/8.0),
+ REAL_CONST(54908.785208582012/8.0),
+ REAL_CONST(54929.196447811417/8.0),
+ REAL_CONST(54949.609583379322/8.0),
+ REAL_CONST(54970.024614933463/8.0),
+ REAL_CONST(54990.441542121727/8.0),
+ REAL_CONST(55010.86036459219/8.0),
+ REAL_CONST(55031.28108199306/8.0),
+ REAL_CONST(55051.703693972733/8.0),
+ REAL_CONST(55072.128200179759/8.0),
+ REAL_CONST(55092.554600262847/8.0),
+ REAL_CONST(55112.982893870874/8.0),
+ REAL_CONST(55133.413080652877/8.0),
+ REAL_CONST(55153.845160258061/8.0),
+ REAL_CONST(55174.279132335789/8.0),
+ REAL_CONST(55194.714996535586/8.0),
+ REAL_CONST(55215.152752507143/8.0),
+ REAL_CONST(55235.592399900306/8.0),
+ REAL_CONST(55256.033938365079/8.0),
+ REAL_CONST(55276.477367551655/8.0),
+ REAL_CONST(55296.92268711036/8.0),
+ REAL_CONST(55317.369896691685/8.0),
+ REAL_CONST(55337.818995946305/8.0),
+ REAL_CONST(55358.269984525024/8.0),
+ REAL_CONST(55378.72286207883/8.0),
+ REAL_CONST(55399.177628258869/8.0),
+ REAL_CONST(55419.634282716441/8.0),
+ REAL_CONST(55440.092825103013/8.0),
+ REAL_CONST(55460.553255070205/8.0),
+ REAL_CONST(55481.015572269804/8.0),
+ REAL_CONST(55501.479776353764/8.0),
+ REAL_CONST(55521.945866974187/8.0),
+ REAL_CONST(55542.413843783339/8.0),
+ REAL_CONST(55562.883706433655/8.0),
+ REAL_CONST(55583.355454577715/8.0),
+ REAL_CONST(55603.82908786826/8.0),
+ REAL_CONST(55624.304605958219/8.0),
+ REAL_CONST(55644.782008500639/8.0),
+ REAL_CONST(55665.261295148754/8.0),
+ REAL_CONST(55685.742465555952/8.0),
+ REAL_CONST(55706.225519375774/8.0),
+ REAL_CONST(55726.710456261928/8.0),
+ REAL_CONST(55747.197275868275/8.0),
+ REAL_CONST(55767.685977848843/8.0),
+ REAL_CONST(55788.176561857814/8.0),
+ REAL_CONST(55808.669027549528/8.0),
+ REAL_CONST(55829.163374578478/8.0),
+ REAL_CONST(55849.659602599328/8.0),
+ REAL_CONST(55870.157711266889/8.0),
+ REAL_CONST(55890.657700236145/8.0),
+ REAL_CONST(55911.159569162221/8.0),
+ REAL_CONST(55931.663317700411/8.0),
+ REAL_CONST(55952.168945506164/8.0),
+ REAL_CONST(55972.676452235086/8.0),
+ REAL_CONST(55993.185837542944/8.0),
+ REAL_CONST(56013.697101085651/8.0),
+ REAL_CONST(56034.210242519301/8.0),
+ REAL_CONST(56054.72526150012/8.0),
+ REAL_CONST(56075.242157684508/8.0),
+ REAL_CONST(56095.760930729011/8.0),
+ REAL_CONST(56116.281580290342/8.0),
+ REAL_CONST(56136.804106025367/8.0),
+ REAL_CONST(56157.328507591104/8.0),
+ REAL_CONST(56177.85478464474/8.0),
+ REAL_CONST(56198.382936843598/8.0),
+ REAL_CONST(56218.912963845185/8.0),
+ REAL_CONST(56239.444865307138/8.0),
+ REAL_CONST(56259.978640887268/8.0),
+ REAL_CONST(56280.514290243525/8.0),
+ REAL_CONST(56301.051813034042/8.0),
+ REAL_CONST(56321.591208917082/8.0),
+ REAL_CONST(56342.13247755108/8.0),
+ REAL_CONST(56362.675618594607/8.0),
+ REAL_CONST(56383.220631706419/8.0),
+ REAL_CONST(56403.767516545398/8.0),
+ REAL_CONST(56424.316272770608/8.0),
+ REAL_CONST(56444.866900041241/8.0),
+ REAL_CONST(56465.419398016667/8.0),
+ REAL_CONST(56485.973766356394/8.0),
+ REAL_CONST(56506.530004720102/8.0),
+ REAL_CONST(56527.088112767611/8.0),
+ REAL_CONST(56547.648090158902/8.0),
+ REAL_CONST(56568.209936554107/8.0),
+ REAL_CONST(56588.773651613519/8.0),
+ REAL_CONST(56609.339234997584/8.0),
+ REAL_CONST(56629.9066863669/8.0),
+ REAL_CONST(56650.47600538221/8.0),
+ REAL_CONST(56671.04719170442/8.0),
+ REAL_CONST(56691.620244994599/8.0),
+ REAL_CONST(56712.195164913959/8.0),
+ REAL_CONST(56732.771951123868/8.0),
+ REAL_CONST(56753.350603285835/8.0),
+ REAL_CONST(56773.931121061541/8.0),
+ REAL_CONST(56794.513504112823/8.0),
+ REAL_CONST(56815.097752101647/8.0),
+ REAL_CONST(56835.683864690152/8.0),
+ REAL_CONST(56856.271841540627/8.0),
+ REAL_CONST(56876.86168231551/8.0),
+ REAL_CONST(56897.453386677393/8.0),
+ REAL_CONST(56918.046954289028/8.0),
+ REAL_CONST(56938.642384813298/8.0),
+ REAL_CONST(56959.239677913261/8.0),
+ REAL_CONST(56979.838833252121/8.0),
+ REAL_CONST(57000.439850493225/8.0),
+ REAL_CONST(57021.04272930009/8.0),
+ REAL_CONST(57041.647469336371/8.0),
+ REAL_CONST(57062.254070265873/8.0),
+ REAL_CONST(57082.862531752558/8.0),
+ REAL_CONST(57103.472853460553/8.0),
+ REAL_CONST(57124.085035054108/8.0),
+ REAL_CONST(57144.699076197649/8.0),
+ REAL_CONST(57165.314976555739/8.0),
+ REAL_CONST(57185.932735793103/8.0),
+ REAL_CONST(57206.552353574611/8.0),
+ REAL_CONST(57227.173829565276/8.0),
+ REAL_CONST(57247.797163430281/8.0),
+ REAL_CONST(57268.42235483494/8.0),
+ REAL_CONST(57289.049403444733/8.0),
+ REAL_CONST(57309.678308925286/8.0),
+ REAL_CONST(57330.30907094237/8.0),
+ REAL_CONST(57350.941689161911/8.0),
+ REAL_CONST(57371.576163249985/8.0),
+ REAL_CONST(57392.212492872815/8.0),
+ REAL_CONST(57412.850677696784/8.0),
+ REAL_CONST(57433.490717388406/8.0),
+ REAL_CONST(57454.132611614368/8.0),
+ REAL_CONST(57474.776360041491/8.0),
+ REAL_CONST(57495.421962336746/8.0),
+ REAL_CONST(57516.069418167266/8.0),
+ REAL_CONST(57536.718727200314/8.0),
+ REAL_CONST(57557.36988910332/8.0),
+ REAL_CONST(57578.022903543861/8.0),
+ REAL_CONST(57598.677770189643/8.0),
+ REAL_CONST(57619.334488708548/8.0),
+ REAL_CONST(57639.993058768589/8.0),
+ REAL_CONST(57660.653480037938/8.0),
+ REAL_CONST(57681.315752184906/8.0),
+ REAL_CONST(57701.979874877965/8.0),
+ REAL_CONST(57722.64584778573/8.0),
+ REAL_CONST(57743.31367057695/8.0),
+ REAL_CONST(57763.983342920546/8.0),
+ REAL_CONST(57784.654864485572/8.0),
+ REAL_CONST(57805.328234941233/8.0),
+ REAL_CONST(57826.003453956881/8.0),
+ REAL_CONST(57846.680521202026/8.0),
+ REAL_CONST(57867.359436346305/8.0),
+ REAL_CONST(57888.040199059527/8.0),
+ REAL_CONST(57908.722809011633/8.0),
+ REAL_CONST(57929.407265872709/8.0),
+ REAL_CONST(57950.093569313001/8.0),
+ REAL_CONST(57970.781719002895/8.0),
+ REAL_CONST(57991.471714612911/8.0),
+ REAL_CONST(58012.16355581375/8.0),
+ REAL_CONST(58032.857242276223/8.0),
+ REAL_CONST(58053.552773671312/8.0),
+ REAL_CONST(58074.25014967013/8.0),
+ REAL_CONST(58094.949369943948/8.0),
+ REAL_CONST(58115.650434164185/8.0),
+ REAL_CONST(58136.353342002389/8.0),
+ REAL_CONST(58157.058093130276/8.0),
+ REAL_CONST(58177.764687219693/8.0),
+ REAL_CONST(58198.47312394264/8.0),
+ REAL_CONST(58219.183402971255/8.0),
+ REAL_CONST(58239.895523977837/8.0),
+ REAL_CONST(58260.609486634821/8.0),
+ REAL_CONST(58281.325290614775/8.0),
+ REAL_CONST(58302.042935590434/8.0),
+ REAL_CONST(58322.762421234678/8.0),
+ REAL_CONST(58343.483747220511/8.0),
+ REAL_CONST(58364.206913221096/8.0),
+ REAL_CONST(58384.931918909751/8.0),
+ REAL_CONST(58405.658763959924/8.0),
+ REAL_CONST(58426.3874480452/8.0),
+ REAL_CONST(58447.117970839339/8.0),
+ REAL_CONST(58467.85033201622/8.0),
+ REAL_CONST(58488.584531249864/8.0),
+ REAL_CONST(58509.320568214462/8.0),
+ REAL_CONST(58530.058442584334/8.0),
+ REAL_CONST(58550.798154033931/8.0),
+ REAL_CONST(58571.539702237875/8.0),
+ REAL_CONST(58592.283086870906/8.0),
+ REAL_CONST(58613.028307607929/8.0),
+ REAL_CONST(58633.775364123983/8.0),
+ REAL_CONST(58654.52425609425/8.0),
+ REAL_CONST(58675.274983194053/8.0),
+ REAL_CONST(58696.027545098877/8.0),
+ REAL_CONST(58716.781941484325/8.0),
+ REAL_CONST(58737.538172026158/8.0),
+ REAL_CONST(58758.296236400274/8.0),
+ REAL_CONST(58779.056134282728/8.0),
+ REAL_CONST(58799.817865349694/8.0),
+ REAL_CONST(58820.581429277503/8.0),
+ REAL_CONST(58841.346825742643/8.0),
+ REAL_CONST(58862.114054421712/8.0),
+ REAL_CONST(58882.883114991484/8.0),
+ REAL_CONST(58903.654007128847/8.0),
+ REAL_CONST(58924.426730510851/8.0),
+ REAL_CONST(58945.201284814684/8.0),
+ REAL_CONST(58965.977669717664/8.0),
+ REAL_CONST(58986.755884897269/8.0),
+ REAL_CONST(59007.535930031117/8.0),
+ REAL_CONST(59028.317804796949/8.0),
+ REAL_CONST(59049.101508872664/8.0),
+ REAL_CONST(59069.887041936301/8.0),
+ REAL_CONST(59090.674403666046/8.0),
+ REAL_CONST(59111.463593740213/8.0),
+ REAL_CONST(59132.254611837263/8.0),
+ REAL_CONST(59153.047457635803/8.0),
+ REAL_CONST(59173.84213081457/8.0),
+ REAL_CONST(59194.638631052461/8.0),
+ REAL_CONST(59215.436958028506/8.0),
+ REAL_CONST(59236.237111421855/8.0),
+ REAL_CONST(59257.039090911829/8.0),
+ REAL_CONST(59277.842896177877/8.0),
+ REAL_CONST(59298.648526899589/8.0),
+ REAL_CONST(59319.455982756685/8.0),
+ REAL_CONST(59340.26526342905/8.0),
+ REAL_CONST(59361.076368596696/8.0),
+ REAL_CONST(59381.889297939757/8.0),
+ REAL_CONST(59402.704051138542/8.0),
+ REAL_CONST(59423.520627873484/8.0),
+ REAL_CONST(59444.339027825139/8.0),
+ REAL_CONST(59465.159250674224/8.0),
+ REAL_CONST(59485.9812961016/8.0),
+ REAL_CONST(59506.805163788253/8.0),
+ REAL_CONST(59527.630853415307/8.0),
+ REAL_CONST(59548.458364664046/8.0),
+ REAL_CONST(59569.287697215863/8.0),
+ REAL_CONST(59590.118850752311/8.0),
+ REAL_CONST(59610.951824955089/8.0),
+ REAL_CONST(59631.786619506012/8.0),
+ REAL_CONST(59652.623234087048/8.0),
+ REAL_CONST(59673.461668380311/8.0),
+ REAL_CONST(59694.301922068029/8.0),
+ REAL_CONST(59715.143994832593/8.0),
+ REAL_CONST(59735.987886356525/8.0),
+ REAL_CONST(59756.833596322482/8.0),
+ REAL_CONST(59777.681124413255/8.0),
+ REAL_CONST(59798.530470311794/8.0),
+ REAL_CONST(59819.381633701159/8.0),
+ REAL_CONST(59840.234614264569/8.0),
+ REAL_CONST(59861.089411685381/8.0),
+ REAL_CONST(59881.94602564707/8.0),
+ REAL_CONST(59902.804455833269/8.0),
+ REAL_CONST(59923.664701927737/8.0),
+ REAL_CONST(59944.526763614384/8.0),
+ REAL_CONST(59965.390640577243/8.0),
+ REAL_CONST(59986.256332500488/8.0),
+ REAL_CONST(60007.123839068438/8.0),
+ REAL_CONST(60027.993159965539/8.0),
+ REAL_CONST(60048.864294876381/8.0),
+ REAL_CONST(60069.737243485688/8.0),
+ REAL_CONST(60090.612005478324/8.0),
+ REAL_CONST(60111.488580539284/8.0),
+ REAL_CONST(60132.366968353708/8.0),
+ REAL_CONST(60153.247168606867/8.0),
+ REAL_CONST(60174.129180984164/8.0),
+ REAL_CONST(60195.013005171153/8.0),
+ REAL_CONST(60215.898640853513/8.0),
+ REAL_CONST(60236.786087717061/8.0),
+ REAL_CONST(60257.675345447751/8.0),
+ REAL_CONST(60278.566413731671/8.0),
+ REAL_CONST(60299.459292255044/8.0),
+ REAL_CONST(60320.353980704247/8.0),
+ REAL_CONST(60341.25047876576/8.0),
+ REAL_CONST(60362.148786126229/8.0),
+ REAL_CONST(60383.048902472423/8.0),
+ REAL_CONST(60403.950827491237/8.0),
+ REAL_CONST(60424.854560869717/8.0),
+ REAL_CONST(60445.76010229504/8.0),
+ REAL_CONST(60466.667451454516/8.0),
+ REAL_CONST(60487.57660803559/8.0),
+ REAL_CONST(60508.487571725847/8.0),
+ REAL_CONST(60529.400342212997/8.0),
+ REAL_CONST(60550.314919184893/8.0),
+ REAL_CONST(60571.231302329521/8.0),
+ REAL_CONST(60592.149491335003/8.0),
+ REAL_CONST(60613.069485889588/8.0),
+ REAL_CONST(60633.991285681674/8.0),
+ REAL_CONST(60654.914890399785/8.0),
+ REAL_CONST(60675.840299732568/8.0),
+ REAL_CONST(60696.767513368832/8.0),
+ REAL_CONST(60717.696530997484/8.0),
+ REAL_CONST(60738.627352307602/8.0),
+ REAL_CONST(60759.55997698837/8.0),
+ REAL_CONST(60780.494404729128/8.0),
+ REAL_CONST(60801.430635219323/8.0),
+ REAL_CONST(60822.368668148556/8.0),
+ REAL_CONST(60843.308503206565/8.0),
+ REAL_CONST(60864.250140083204/8.0),
+ REAL_CONST(60885.193578468468/8.0),
+ REAL_CONST(60906.138818052495/8.0),
+ REAL_CONST(60927.085858525541/8.0),
+ REAL_CONST(60948.034699578006/8.0),
+ REAL_CONST(60968.985340900421/8.0),
+ REAL_CONST(60989.937782183442/8.0),
+ REAL_CONST(61010.892023117864/8.0),
+ REAL_CONST(61031.848063394616/8.0),
+ REAL_CONST(61052.805902704764/8.0),
+ REAL_CONST(61073.765540739492/8.0),
+ REAL_CONST(61094.726977190134/8.0),
+ REAL_CONST(61115.690211748137/8.0),
+ REAL_CONST(61136.655244105103/8.0),
+ REAL_CONST(61157.622073952742/8.0),
+ REAL_CONST(61178.590700982917/8.0),
+ REAL_CONST(61199.561124887616/8.0),
+ REAL_CONST(61220.533345358948/8.0),
+ REAL_CONST(61241.507362089171/8.0),
+ REAL_CONST(61262.483174770663/8.0),
+ REAL_CONST(61283.460783095943/8.0),
+ REAL_CONST(61304.440186757645/8.0),
+ REAL_CONST(61325.421385448557/8.0),
+ REAL_CONST(61346.404378861582/8.0),
+ REAL_CONST(61367.389166689762/8.0),
+ REAL_CONST(61388.375748626262/8.0),
+ REAL_CONST(61409.364124364387/8.0),
+ REAL_CONST(61430.354293597571/8.0),
+ REAL_CONST(61451.346256019373/8.0),
+ REAL_CONST(61472.340011323497/8.0),
+ REAL_CONST(61493.335559203762/8.0),
+ REAL_CONST(61514.332899354122/8.0),
+ REAL_CONST(61535.332031468672/8.0),
+ REAL_CONST(61556.332955241618/8.0),
+ REAL_CONST(61577.335670367313/8.0),
+ REAL_CONST(61598.340176540238/8.0),
+ REAL_CONST(61619.346473454993/8.0),
+ REAL_CONST(61640.354560806329/8.0),
+ REAL_CONST(61661.3644382891/8.0),
+ REAL_CONST(61682.376105598312/8.0),
+ REAL_CONST(61703.389562429089/8.0),
+ REAL_CONST(61724.404808476691/8.0),
+ REAL_CONST(61745.42184343651/8.0),
+ REAL_CONST(61766.440667004063/8.0),
+ REAL_CONST(61787.461278874987/8.0),
+ REAL_CONST(61808.483678745069/8.0),
+ REAL_CONST(61829.507866310203/8.0),
+ REAL_CONST(61850.533841266435/8.0),
+ REAL_CONST(61871.561603309929/8.0),
+ REAL_CONST(61892.591152136971/8.0),
+ REAL_CONST(61913.622487443987/8.0),
+ REAL_CONST(61934.655608927525/8.0),
+ REAL_CONST(61955.690516284267/8.0),
+ REAL_CONST(61976.727209211022/8.0),
+ REAL_CONST(61997.765687404724/8.0),
+ REAL_CONST(62018.805950562448/8.0),
+ REAL_CONST(62039.847998381381/8.0),
+ REAL_CONST(62060.891830558845/8.0),
+ REAL_CONST(62081.93744679229/8.0),
+ REAL_CONST(62102.984846779298/8.0),
+ REAL_CONST(62124.034030217575/8.0),
+ REAL_CONST(62145.084996804966/8.0),
+ REAL_CONST(62166.137746239416/8.0),
+ REAL_CONST(62187.19227821903/8.0),
+ REAL_CONST(62208.248592442025/8.0),
+ REAL_CONST(62229.306688606739/8.0),
+ REAL_CONST(62250.366566411656/8.0),
+ REAL_CONST(62271.428225555377/8.0),
+ REAL_CONST(62292.491665736627/8.0),
+ REAL_CONST(62313.556886654267/8.0),
+ REAL_CONST(62334.623888007271/8.0),
+ REAL_CONST(62355.692669494762/8.0),
+ REAL_CONST(62376.763230815974/8.0),
+ REAL_CONST(62397.835571670272/8.0),
+ REAL_CONST(62418.909691757144/8.0),
+ REAL_CONST(62439.98559077621/8.0),
+ REAL_CONST(62461.063268427228/8.0),
+ REAL_CONST(62482.142724410049/8.0),
+ REAL_CONST(62503.223958424685/8.0),
+ REAL_CONST(62524.306970171267/8.0),
+ REAL_CONST(62545.39175935003/8.0),
+ REAL_CONST(62566.478325661366/8.0),
+ REAL_CONST(62587.566668805768/8.0),
+ REAL_CONST(62608.656788483881/8.0),
+ REAL_CONST(62629.748684396451/8.0),
+ REAL_CONST(62650.842356244357/8.0),
+ REAL_CONST(62671.937803728622/8.0),
+ REAL_CONST(62693.035026550366/8.0),
+ REAL_CONST(62714.134024410858/8.0),
+ REAL_CONST(62735.234797011479/8.0),
+ REAL_CONST(62756.337344053733/8.0),
+ REAL_CONST(62777.441665239276/8.0),
+ REAL_CONST(62798.547760269852/8.0),
+ REAL_CONST(62819.655628847358/8.0),
+ REAL_CONST(62840.765270673801/8.0),
+ REAL_CONST(62861.876685451323/8.0),
+ REAL_CONST(62882.989872882186/8.0),
+ REAL_CONST(62904.104832668774/8.0),
+ REAL_CONST(62925.221564513602/8.0),
+ REAL_CONST(62946.340068119309/8.0),
+ REAL_CONST(62967.460343188657/8.0),
+ REAL_CONST(62988.582389424526/8.0),
+ REAL_CONST(63009.70620652994/8.0),
+ REAL_CONST(63030.831794208025/8.0),
+ REAL_CONST(63051.959152162039/8.0),
+ REAL_CONST(63073.08828009537/8.0),
+ REAL_CONST(63094.219177711529/8.0),
+ REAL_CONST(63115.351844714154/8.0),
+ REAL_CONST(63136.486280806988/8.0),
+ REAL_CONST(63157.622485693922/8.0),
+ REAL_CONST(63178.760459078956/8.0),
+ REAL_CONST(63199.900200666219/8.0),
+ REAL_CONST(63221.041710159967/8.0),
+ REAL_CONST(63242.184987264569/8.0),
+ REAL_CONST(63263.330031684534/8.0),
+ REAL_CONST(63284.476843124474/8.0),
+ REAL_CONST(63305.625421289144/8.0),
+ REAL_CONST(63326.775765883409/8.0),
+ REAL_CONST(63347.927876612259/8.0),
+ REAL_CONST(63369.081753180813/8.0),
+ REAL_CONST(63390.237395294316/8.0),
+ REAL_CONST(63411.39480265812/8.0),
+ REAL_CONST(63432.553974977716/8.0),
+ REAL_CONST(63453.714911958712/8.0),
+ REAL_CONST(63474.877613306839/8.0),
+ REAL_CONST(63496.042078727944/8.0),
+ REAL_CONST(63517.208307927998/8.0),
+ REAL_CONST(63538.376300613119/8.0),
+ REAL_CONST(63559.546056489504/8.0),
+ REAL_CONST(63580.717575263516/8.0),
+ REAL_CONST(63601.890856641607/8.0),
+ REAL_CONST(63623.065900330374/8.0),
+ REAL_CONST(63644.242706036515/8.0),
+ REAL_CONST(63665.421273466869/8.0),
+ REAL_CONST(63686.601602328381/8.0),
+ REAL_CONST(63707.783692328136/8.0),
+ REAL_CONST(63728.967543173334/8.0),
+ REAL_CONST(63750.153154571279/8.0),
+ REAL_CONST(63771.340526229418/8.0),
+ REAL_CONST(63792.529657855317/8.0),
+ REAL_CONST(63813.720549156649/8.0),
+ REAL_CONST(63834.913199841227/8.0),
+ REAL_CONST(63856.107609616978/8.0),
+ REAL_CONST(63877.303778191941/8.0),
+ REAL_CONST(63898.501705274284/8.0),
+ REAL_CONST(63919.7013905723/8.0),
+ REAL_CONST(63940.902833794404/8.0),
+ REAL_CONST(63962.106034649114/8.0),
+ REAL_CONST(63983.310992845094/8.0),
+ REAL_CONST(64004.517708091109/8.0),
+ REAL_CONST(64025.726180096048/8.0),
+ REAL_CONST(64046.936408568938/8.0),
+ REAL_CONST(64068.1483932189/8.0),
+ REAL_CONST(64089.362133755196/8.0),
+ REAL_CONST(64110.577629887193/8.0),
+ REAL_CONST(64131.794881324393/8.0),
+ REAL_CONST(64153.013887776404/8.0),
+ REAL_CONST(64174.234648952966/8.0),
+ REAL_CONST(64195.457164563937/8.0),
+ REAL_CONST(64216.681434319289/8.0),
+ REAL_CONST(64237.907457929112/8.0),
+ REAL_CONST(64259.135235103626/8.0),
+ REAL_CONST(64280.36476555316/8.0),
+ REAL_CONST(64301.596048988169/8.0),
+ REAL_CONST(64322.829085119236/8.0),
+ REAL_CONST(64344.06387365704/8.0),
+ REAL_CONST(64365.300414312398/8.0),
+ REAL_CONST(64386.538706796251/8.0),
+ REAL_CONST(64407.778750819634/8.0),
+ REAL_CONST(64429.020546093721/8.0),
+ REAL_CONST(64450.26409232981/8.0),
+ REAL_CONST(64471.509389239291/8.0),
+ REAL_CONST(64492.756436533709/8.0),
+ REAL_CONST(64514.005233924705/8.0),
+ REAL_CONST(64535.255781124033/8.0),
+ REAL_CONST(64556.50807784358/8.0),
+ REAL_CONST(64577.762123795357/8.0),
+ REAL_CONST(64599.017918691468/8.0),
+ REAL_CONST(64620.275462244172/8.0),
+ REAL_CONST(64641.534754165805/8.0),
+ REAL_CONST(64662.795794168844/8.0),
+ REAL_CONST(64684.058581965895/8.0),
+ REAL_CONST(64705.323117269661/8.0),
+ REAL_CONST(64726.589399792974/8.0),
+ REAL_CONST(64747.857429248776/8.0),
+ REAL_CONST(64769.127205350138/8.0),
+ REAL_CONST(64790.398727810236/8.0),
+ REAL_CONST(64811.671996342375/8.0),
+ REAL_CONST(64832.947010659969/8.0),
+ REAL_CONST(64854.223770476558/8.0),
+ REAL_CONST(64875.502275505794/8.0),
+ REAL_CONST(64896.782525461451/8.0),
+ REAL_CONST(64918.064520057414/8.0),
+ REAL_CONST(64939.348259007682/8.0),
+ REAL_CONST(64960.633742026388/8.0),
+ REAL_CONST(64981.920968827762/8.0),
+ REAL_CONST(65003.209939126165/8.0),
+ REAL_CONST(65024.500652636067/8.0),
+ REAL_CONST(65045.793109072067/8.0),
+ REAL_CONST(65067.087308148861/8.0),
+ REAL_CONST(65088.383249581282/8.0),
+ REAL_CONST(65109.680933084259/8.0),
+ REAL_CONST(65130.980358372864/8.0),
+ REAL_CONST(65152.28152516226/8.0),
+ REAL_CONST(65173.584433167736/8.0),
+ REAL_CONST(65194.889082104703/8.0),
+ REAL_CONST(65216.195471688683/8.0),
+ REAL_CONST(65237.503601635319/8.0),
+ REAL_CONST(65258.813471660353/8.0),
+ REAL_CONST(65280.125081479666/8.0),
+ REAL_CONST(65301.438430809241/8.0),
+ REAL_CONST(65322.753519365178/8.0),
+ REAL_CONST(65344.070346863708/8.0),
+ REAL_CONST(65365.388913021146/8.0),
+ REAL_CONST(65386.709217553958/8.0),
+ REAL_CONST(65408.031260178701/8.0),
+ REAL_CONST(65429.355040612056/8.0),
+ REAL_CONST(65450.680558570821/8.0),
+ REAL_CONST(65472.00781377191/8.0),
+ REAL_CONST(65493.336805932355/8.0),
+ REAL_CONST(65514.66753476928/8.0),
+ REAL_CONST(65535.999999999956/8.0),
+ REAL_CONST(65557.334201341757/8.0),
+ REAL_CONST(65578.670138512171/8.0),
+ REAL_CONST(65600.007811228788/8.0),
+ REAL_CONST(65621.347219209332/8.0),
+ REAL_CONST(65642.688362171626/8.0),
+ REAL_CONST(65664.031239833639/8.0),
+ REAL_CONST(65685.375851913413/8.0),
+ REAL_CONST(65706.722198129137/8.0),
+ REAL_CONST(65728.070278199084/8.0),
+ REAL_CONST(65749.420091841661/8.0),
+ REAL_CONST(65770.771638775404/8.0),
+ REAL_CONST(65792.124918718939/8.0),
+ REAL_CONST(65813.479931391004/8.0),
+ REAL_CONST(65834.836676510458/8.0),
+ REAL_CONST(65856.195153796303/8.0),
+ REAL_CONST(65877.5553629676/8.0),
+ REAL_CONST(65898.917303743554/8.0),
+ REAL_CONST(65920.280975843489/8.0),
+ REAL_CONST(65941.646378986843/8.0),
+ REAL_CONST(65963.013512893158/8.0),
+ REAL_CONST(65984.382377282076/8.0),
+ REAL_CONST(66005.752971873386/8.0),
+ REAL_CONST(66027.125296386963/8.0),
+ REAL_CONST(66048.499350542799/8.0),
+ REAL_CONST(66069.875134061018/8.0),
+ REAL_CONST(66091.252646661844/8.0),
+ REAL_CONST(66112.631888065618/8.0),
+ REAL_CONST(66134.01285799277/8.0),
+ REAL_CONST(66155.395556163887/8.0),
+ REAL_CONST(66176.779982299631/8.0),
+ REAL_CONST(66198.166136120795/8.0),
+ REAL_CONST(66219.554017348273/8.0),
+ REAL_CONST(66240.943625703105/8.0),
+ REAL_CONST(66262.334960906388/8.0),
+ REAL_CONST(66283.728022679396/8.0),
+ REAL_CONST(66305.122810743444/8.0),
+ REAL_CONST(66326.519324820023/8.0),
+ REAL_CONST(66347.917564630698/8.0),
+ REAL_CONST(66369.317529897162/8.0),
+ REAL_CONST(66390.719220341227/8.0),
+ REAL_CONST(66412.122635684791/8.0),
+ REAL_CONST(66433.527775649884/8.0),
+ REAL_CONST(66454.934639958636/8.0),
+ REAL_CONST(66476.343228333324/8.0),
+ REAL_CONST(66497.753540496284/8.0),
+ REAL_CONST(66519.165576169995/8.0),
+ REAL_CONST(66540.57933507704/8.0),
+ REAL_CONST(66561.994816940118/8.0),
+ REAL_CONST(66583.412021482043/8.0),
+ REAL_CONST(66604.830948425733/8.0),
+ REAL_CONST(66626.251597494222/8.0),
+ REAL_CONST(66647.673968410629/8.0),
+ REAL_CONST(66669.098060898235/8.0),
+ REAL_CONST(66690.523874680381/8.0),
+ REAL_CONST(66711.951409480564/8.0),
+ REAL_CONST(66733.380665022371/8.0),
+ REAL_CONST(66754.811641029475/8.0),
+ REAL_CONST(66776.244337225711/8.0),
+ REAL_CONST(66797.678753334985/8.0),
+ REAL_CONST(66819.11488908132/8.0),
+ REAL_CONST(66840.552744188884/8.0),
+ REAL_CONST(66861.992318381905/8.0),
+ REAL_CONST(66883.433611384738/8.0),
+ REAL_CONST(66904.876622921889/8.0),
+ REAL_CONST(66926.321352717903/8.0),
+ REAL_CONST(66947.767800497502/8.0),
+ REAL_CONST(66969.215965985466/8.0),
+ REAL_CONST(66990.665848906734/8.0),
+ REAL_CONST(67012.117448986304/8.0),
+ REAL_CONST(67033.570765949335/8.0),
+ REAL_CONST(67055.025799521056/8.0),
+ REAL_CONST(67076.482549426815/8.0),
+ REAL_CONST(67097.941015392076/8.0),
+ REAL_CONST(67119.401197142433/8.0),
+ REAL_CONST(67140.863094403554/8.0),
+ REAL_CONST(67162.326706901222/8.0),
+ REAL_CONST(67183.792034361351/8.0),
+ REAL_CONST(67205.259076509959/8.0),
+ REAL_CONST(67226.72783307315/8.0),
+ REAL_CONST(67248.198303777172/8.0),
+ REAL_CONST(67269.670488348347/8.0),
+ REAL_CONST(67291.144386513144/8.0),
+ REAL_CONST(67312.619997998088/8.0),
+ REAL_CONST(67334.09732252988/8.0),
+ REAL_CONST(67355.576359835293/8.0),
+ REAL_CONST(67377.057109641188/8.0),
+ REAL_CONST(67398.53957167457/8.0),
+ REAL_CONST(67420.023745662547/8.0),
+ REAL_CONST(67441.50963133233/8.0),
+ REAL_CONST(67462.99722841123/8.0),
+ REAL_CONST(67484.486536626689/8.0),
+ REAL_CONST(67505.977555706224/8.0),
+ REAL_CONST(67527.470285377494/8.0),
+ REAL_CONST(67548.964725368263/8.0),
+ REAL_CONST(67570.460875406367/8.0),
+ REAL_CONST(67591.9587352198/8.0),
+ REAL_CONST(67613.458304536631/8.0),
+ REAL_CONST(67634.95958308503/8.0),
+ REAL_CONST(67656.462570593329/8.0),
+ REAL_CONST(67677.967266789899/8.0),
+ REAL_CONST(67699.473671403248/8.0),
+ REAL_CONST(67720.981784162024/8.0),
+ REAL_CONST(67742.491604794923/8.0),
+ REAL_CONST(67764.003133030797/8.0),
+ REAL_CONST(67785.516368598575/8.0),
+ REAL_CONST(67807.031311227314/8.0),
+ REAL_CONST(67828.547960646174/8.0),
+ REAL_CONST(67850.066316584402/8.0),
+ REAL_CONST(67871.58637877139/8.0),
+ REAL_CONST(67893.108146936589/8.0),
+ REAL_CONST(67914.63162080961/8.0),
+ REAL_CONST(67936.156800120138/8.0),
+ REAL_CONST(67957.683684597971/8.0),
+ REAL_CONST(67979.212273973011/8.0),
+ REAL_CONST(68000.742567975263/8.0),
+ REAL_CONST(68022.274566334876/8.0),
+ REAL_CONST(68043.808268782057/8.0),
+ REAL_CONST(68065.343675047145/8.0),
+ REAL_CONST(68086.880784860579/8.0),
+ REAL_CONST(68108.419597952918/8.0),
+ REAL_CONST(68129.960114054789/8.0),
+ REAL_CONST(68151.502332896969/8.0),
+ REAL_CONST(68173.04625421032/8.0),
+ REAL_CONST(68194.591877725834/8.0),
+ REAL_CONST(68216.139203174564/8.0),
+ REAL_CONST(68237.688230287706/8.0),
+ REAL_CONST(68259.238958796544/8.0),
+ REAL_CONST(68280.791388432481/8.0),
+ REAL_CONST(68302.345518927032/8.0),
+ REAL_CONST(68323.901350011787/8.0),
+ REAL_CONST(68345.458881418483/8.0),
+ REAL_CONST(68367.018112878912/8.0),
+ REAL_CONST(68388.579044125028/8.0),
+ REAL_CONST(68410.141674888844/8.0),
+ REAL_CONST(68431.706004902502/8.0),
+ REAL_CONST(68453.272033898262/8.0),
+ REAL_CONST(68474.839761608455/8.0),
+ REAL_CONST(68496.409187765545/8.0),
+ REAL_CONST(68517.980312102081/8.0),
+ REAL_CONST(68539.553134350732/8.0),
+ REAL_CONST(68561.127654244279/8.0),
+ REAL_CONST(68582.70387151558/8.0),
+ REAL_CONST(68604.281785897634/8.0),
+ REAL_CONST(68625.861397123503/8.0),
+ REAL_CONST(68647.44270492639/8.0),
+ REAL_CONST(68669.025709039604/8.0),
+ REAL_CONST(68690.610409196524/8.0),
+ REAL_CONST(68712.196805130661/8.0),
+ REAL_CONST(68733.784896575627/8.0),
+ REAL_CONST(68755.374683265123/8.0),
+ REAL_CONST(68776.966164932994/8.0),
+ REAL_CONST(68798.559341313128/8.0),
+ REAL_CONST(68820.154212139591/8.0),
+ REAL_CONST(68841.750777146473/8.0),
+ REAL_CONST(68863.349036068044/8.0),
+ REAL_CONST(68884.948988638629/8.0),
+ REAL_CONST(68906.550634592684/8.0),
+ REAL_CONST(68928.153973664739/8.0),
+ REAL_CONST(68949.75900558944/8.0),
+ REAL_CONST(68971.365730101577/8.0),
+ REAL_CONST(68992.974146935987/8.0),
+ REAL_CONST(69014.584255827634/8.0),
+ REAL_CONST(69036.196056511588/8.0),
+ REAL_CONST(69057.809548723017/8.0),
+ REAL_CONST(69079.424732197207/8.0),
+ REAL_CONST(69101.041606669532/8.0),
+ REAL_CONST(69122.660171875468/8.0),
+ REAL_CONST(69144.280427550606/8.0),
+ REAL_CONST(69165.902373430625/8.0),
+ REAL_CONST(69187.526009251334/8.0),
+ REAL_CONST(69209.151334748618/8.0),
+ REAL_CONST(69230.778349658474/8.0),
+ REAL_CONST(69252.40705371699/8.0),
+ REAL_CONST(69274.037446660412/8.0),
+ REAL_CONST(69295.669528225/8.0),
+ REAL_CONST(69317.303298147192/8.0),
+ REAL_CONST(69338.938756163494/8.0),
+ REAL_CONST(69360.575902010532/8.0),
+ REAL_CONST(69382.214735425005/8.0),
+ REAL_CONST(69403.855256143754/8.0),
+ REAL_CONST(69425.497463903681/8.0),
+ REAL_CONST(69447.141358441833/8.0),
+ REAL_CONST(69468.78693949533/8.0),
+ REAL_CONST(69490.434206801394/8.0),
+ REAL_CONST(69512.083160097391/8.0),
+ REAL_CONST(69533.733799120717/8.0),
+ REAL_CONST(69555.386123608929/8.0),
+ REAL_CONST(69577.04013329967/8.0),
+ REAL_CONST(69598.695827930685/8.0),
+ REAL_CONST(69620.353207239794/8.0),
+ REAL_CONST(69642.012270964973/8.0),
+ REAL_CONST(69663.67301884426/8.0),
+ REAL_CONST(69685.335450615792/8.0),
+ REAL_CONST(69706.999566017839/8.0),
+ REAL_CONST(69728.665364788743/8.0),
+ REAL_CONST(69750.332846666963/8.0),
+ REAL_CONST(69772.002011391058/8.0),
+ REAL_CONST(69793.672858699691/8.0),
+ REAL_CONST(69815.345388331611/8.0),
+ REAL_CONST(69837.019600025669/8.0),
+ REAL_CONST(69858.695493520849/8.0),
+ REAL_CONST(69880.373068556204/8.0),
+ REAL_CONST(69902.052324870907/8.0),
+ REAL_CONST(69923.733262204216/8.0),
+ REAL_CONST(69945.415880295492/8.0),
+ REAL_CONST(69967.100178884211/8.0),
+ REAL_CONST(69988.786157709939/8.0),
+ REAL_CONST(70010.473816512356/8.0),
+ REAL_CONST(70032.163155031216/8.0),
+ REAL_CONST(70053.854173006403/8.0),
+ REAL_CONST(70075.546870177874/8.0),
+ REAL_CONST(70097.241246285717/8.0),
+ REAL_CONST(70118.937301070109/8.0),
+ REAL_CONST(70140.635034271298/8.0),
+ REAL_CONST(70162.334445629691/8.0),
+ REAL_CONST(70184.035534885741/8.0),
+ REAL_CONST(70205.738301780017/8.0),
+ REAL_CONST(70227.442746053217/8.0),
+ REAL_CONST(70249.1488674461/8.0),
+ REAL_CONST(70270.856665699539/8.0),
+ REAL_CONST(70292.566140554511/8.0),
+ REAL_CONST(70314.277291752107/8.0),
+ REAL_CONST(70335.990119033493/8.0),
+ REAL_CONST(70357.704622139936/8.0),
+ REAL_CONST(70379.420800812819/8.0),
+ REAL_CONST(70401.138654793613/8.0),
+ REAL_CONST(70422.85818382389/8.0),
+ REAL_CONST(70444.579387645339/8.0),
+ REAL_CONST(70466.302265999722/8.0),
+ REAL_CONST(70488.026818628918/8.0),
+ REAL_CONST(70509.753045274876/8.0),
+ REAL_CONST(70531.480945679708/8.0),
+ REAL_CONST(70553.210519585555/8.0),
+ REAL_CONST(70574.941766734701/8.0),
+ REAL_CONST(70596.674686869505/8.0),
+ REAL_CONST(70618.409279732456/8.0),
+ REAL_CONST(70640.145545066101/8.0),
+ REAL_CONST(70661.883482613106/8.0),
+ REAL_CONST(70683.623092116264/8.0),
+ REAL_CONST(70705.364373318414/8.0),
+ REAL_CONST(70727.107325962526/8.0),
+ REAL_CONST(70748.851949791671/8.0),
+ REAL_CONST(70770.598244549008/8.0),
+ REAL_CONST(70792.346209977783/8.0),
+ REAL_CONST(70814.095845821372/8.0),
+ REAL_CONST(70835.847151823225/8.0),
+ REAL_CONST(70857.600127726895/8.0),
+ REAL_CONST(70879.354773276034/8.0),
+ REAL_CONST(70901.111088214413/8.0),
+ REAL_CONST(70922.869072285859/8.0),
+ REAL_CONST(70944.628725234332/8.0),
+ REAL_CONST(70966.390046803877/8.0),
+ REAL_CONST(70988.153036738629/8.0),
+ REAL_CONST(71009.917694782853/8.0),
+ REAL_CONST(71031.684020680885/8.0),
+ REAL_CONST(71053.45201417715/8.0),
+ REAL_CONST(71075.221675016204/8.0),
+ REAL_CONST(71096.993002942661/8.0),
+ REAL_CONST(71118.765997701266/8.0),
+ REAL_CONST(71140.540659036851/8.0),
+ REAL_CONST(71162.316986694335/8.0),
+ REAL_CONST(71184.09498041874/8.0),
+ REAL_CONST(71205.874639955218/8.0),
+ REAL_CONST(71227.655965048951/8.0),
+ REAL_CONST(71249.438955445294/8.0),
+ REAL_CONST(71271.223610889632/8.0),
+ REAL_CONST(71293.009931127483/8.0),
+ REAL_CONST(71314.797915904477/8.0),
+ REAL_CONST(71336.587564966307/8.0),
+ REAL_CONST(71358.378878058764/8.0),
+ REAL_CONST(71380.171854927772/8.0),
+ REAL_CONST(71401.966495319313/8.0),
+ REAL_CONST(71423.762798979486/8.0),
+ REAL_CONST(71445.560765654489/8.0),
+ REAL_CONST(71467.360395090596/8.0),
+ REAL_CONST(71489.161687034211/8.0),
+ REAL_CONST(71510.964641231811/8.0),
+ REAL_CONST(71532.769257429973/8.0),
+ REAL_CONST(71554.575535375348/8.0),
+ REAL_CONST(71576.383474814749/8.0),
+ REAL_CONST(71598.19307549503/8.0),
+ REAL_CONST(71620.004337163133/8.0),
+ REAL_CONST(71641.817259566145/8.0),
+ REAL_CONST(71663.631842451214/8.0),
+ REAL_CONST(71685.4480855656/8.0),
+ REAL_CONST(71707.26598865664/8.0),
+ REAL_CONST(71729.085551471784/8.0),
+ REAL_CONST(71750.906773758586/8.0),
+ REAL_CONST(71772.729655264673/8.0),
+ REAL_CONST(71794.554195737772/8.0),
+ REAL_CONST(71816.380394925713/8.0),
+ REAL_CONST(71838.208252576442/8.0),
+ REAL_CONST(71860.037768437964/8.0),
+ REAL_CONST(71881.868942258385/8.0),
+ REAL_CONST(71903.701773785942/8.0),
+ REAL_CONST(71925.536262768932/8.0),
+ REAL_CONST(71947.372408955751/8.0),
+ REAL_CONST(71969.210212094898/8.0),
+ REAL_CONST(71991.049671934976/8.0),
+ REAL_CONST(72012.890788224686/8.0),
+ REAL_CONST(72034.73356071279/8.0),
+ REAL_CONST(72056.577989148165/8.0),
+ REAL_CONST(72078.424073279821/8.0),
+ REAL_CONST(72100.271812856794/8.0),
+ REAL_CONST(72122.121207628254/8.0),
+ REAL_CONST(72143.97225734347/8.0),
+ REAL_CONST(72165.824961751801/8.0),
+ REAL_CONST(72187.679320602692/8.0),
+ REAL_CONST(72209.53533364569/8.0),
+ REAL_CONST(72231.393000630429/8.0),
+ REAL_CONST(72253.252321306645/8.0),
+ REAL_CONST(72275.113295424177/8.0),
+ REAL_CONST(72296.975922732949/8.0),
+ REAL_CONST(72318.840202982959/8.0),
+ REAL_CONST(72340.706135924338/8.0),
+ REAL_CONST(72362.573721307272/8.0),
+ REAL_CONST(72384.442958882093/8.0),
+ REAL_CONST(72406.313848399179/8.0),
+ REAL_CONST(72428.186389609036/8.0),
+ REAL_CONST(72450.060582262216/8.0),
+ REAL_CONST(72471.936426109431/8.0),
+ REAL_CONST(72493.813920901433/8.0),
+ REAL_CONST(72515.693066389096/8.0),
+ REAL_CONST(72537.573862323392/8.0),
+ REAL_CONST(72559.456308455352/8.0),
+ REAL_CONST(72581.340404536139/8.0),
+ REAL_CONST(72603.226150316987/8.0),
+ REAL_CONST(72625.113545549248/8.0),
+ REAL_CONST(72647.002589984331/8.0),
+ REAL_CONST(72668.893283373764/8.0),
+ REAL_CONST(72690.785625469172/8.0),
+ REAL_CONST(72712.679616022273/8.0),
+ REAL_CONST(72734.575254784853/8.0),
+ REAL_CONST(72756.472541508803/8.0),
+ REAL_CONST(72778.371475946144/8.0),
+ REAL_CONST(72800.272057848939/8.0),
+ REAL_CONST(72822.174286969355/8.0),
+ REAL_CONST(72844.07816305969/8.0),
+ REAL_CONST(72865.983685872285/8.0),
+ REAL_CONST(72887.890855159596/8.0),
+ REAL_CONST(72909.799670674183/8.0),
+ REAL_CONST(72931.710132168693/8.0),
+ REAL_CONST(72953.622239395845/8.0),
+ REAL_CONST(72975.535992108475/8.0),
+ REAL_CONST(72997.451390059519/8.0),
+ REAL_CONST(73019.368433001961/8.0),
+ REAL_CONST(73041.287120688925/8.0),
+ REAL_CONST(73063.207452873612/8.0),
+ REAL_CONST(73085.129429309294/8.0),
+ REAL_CONST(73107.053049749389/8.0),
+ REAL_CONST(73128.978313947344/8.0),
+ REAL_CONST(73150.905221656736/8.0),
+ REAL_CONST(73172.833772631217/8.0),
+ REAL_CONST(73194.763966624567/8.0),
+ REAL_CONST(73216.695803390612/8.0),
+ REAL_CONST(73238.62928268328/8.0),
+ REAL_CONST(73260.564404256627/8.0),
+ REAL_CONST(73282.501167864757/8.0),
+ REAL_CONST(73304.439573261901/8.0),
+ REAL_CONST(73326.379620202337/8.0),
+ REAL_CONST(73348.321308440485/8.0),
+ REAL_CONST(73370.264637730841/8.0),
+ REAL_CONST(73392.209607827957/8.0),
+ REAL_CONST(73414.156218486532/8.0),
+ REAL_CONST(73436.104469461323/8.0),
+ REAL_CONST(73458.054360507173/8.0),
+ REAL_CONST(73480.005891379056/8.0),
+ REAL_CONST(73501.959061831993/8.0),
+ REAL_CONST(73523.913871621116/8.0),
+ REAL_CONST(73545.870320501665/8.0),
+ REAL_CONST(73567.828408228932/8.0),
+ REAL_CONST(73589.78813455833/8.0),
+ REAL_CONST(73611.749499245358/8.0),
+ REAL_CONST(73633.712502045615/8.0),
+ REAL_CONST(73655.677142714747/8.0),
+ REAL_CONST(73677.643421008557/8.0),
+ REAL_CONST(73699.611336682879/8.0),
+ REAL_CONST(73721.580889493693/8.0),
+ REAL_CONST(73743.552079197019/8.0),
+ REAL_CONST(73765.524905548999/8.0),
+ REAL_CONST(73787.499368305856/8.0),
+ REAL_CONST(73809.475467223907/8.0),
+ REAL_CONST(73831.453202059551/8.0),
+ REAL_CONST(73853.432572569291/8.0),
+ REAL_CONST(73875.413578509717/8.0),
+ REAL_CONST(73897.396219637507/8.0),
+ REAL_CONST(73919.380495709411/8.0),
+ REAL_CONST(73941.36640648231/8.0),
+ REAL_CONST(73963.353951713143/8.0),
+ REAL_CONST(73985.343131158952/8.0),
+ REAL_CONST(74007.333944576865/8.0),
+ REAL_CONST(74029.326391724098/8.0),
+ REAL_CONST(74051.320472357969/8.0),
+ REAL_CONST(74073.316186235883/8.0),
+ REAL_CONST(74095.313533115303/8.0),
+ REAL_CONST(74117.312512753837/8.0),
+ REAL_CONST(74139.313124909138/8.0),
+ REAL_CONST(74161.315369338976/8.0),
+ REAL_CONST(74183.319245801191/8.0),
+ REAL_CONST(74205.324754053727/8.0),
+ REAL_CONST(74227.331893854629/8.0),
+ REAL_CONST(74249.340664961986/8.0),
+ REAL_CONST(74271.351067134034/8.0),
+ REAL_CONST(74293.363100129049/8.0),
+ REAL_CONST(74315.376763705441/8.0),
+ REAL_CONST(74337.392057621662/8.0),
+ REAL_CONST(74359.408981636298/8.0),
+ REAL_CONST(74381.427535508003/8.0),
+ REAL_CONST(74403.447718995507/8.0),
+ REAL_CONST(74425.469531857671/8.0),
+ REAL_CONST(74447.492973853383/8.0),
+ REAL_CONST(74469.518044741693/8.0),
+ REAL_CONST(74491.54474428168/8.0),
+ REAL_CONST(74513.573072232539/8.0),
+ REAL_CONST(74535.603028353551/8.0),
+ REAL_CONST(74557.634612404087/8.0),
+ REAL_CONST(74579.667824143602/8.0),
+ REAL_CONST(74601.702663331642/8.0),
+ REAL_CONST(74623.739129727837/8.0),
+ REAL_CONST(74645.777223091936/8.0),
+ REAL_CONST(74667.816943183716/8.0),
+ REAL_CONST(74689.858289763113/8.0),
+ REAL_CONST(74711.901262590094/8.0),
+ REAL_CONST(74733.945861424741/8.0),
+ REAL_CONST(74755.992086027225/8.0),
+ REAL_CONST(74778.039936157802/8.0),
+ REAL_CONST(74800.089411576817/8.0),
+ REAL_CONST(74822.140512044702/8.0),
+ REAL_CONST(74844.193237321961/8.0),
+ REAL_CONST(74866.24758716923/8.0),
+ REAL_CONST(74888.303561347187/8.0),
+ REAL_CONST(74910.36115961663/8.0),
+ REAL_CONST(74932.420381738411/8.0),
+ REAL_CONST(74954.481227473516/8.0),
+ REAL_CONST(74976.543696582972/8.0),
+ REAL_CONST(74998.607788827925/8.0),
+ REAL_CONST(75020.673503969607/8.0),
+ REAL_CONST(75042.740841769322/8.0),
+ REAL_CONST(75064.809801988464/8.0),
+ REAL_CONST(75086.88038438854/8.0),
+ REAL_CONST(75108.952588731103/8.0),
+ REAL_CONST(75131.026414777836/8.0),
+ REAL_CONST(75153.101862290467/8.0),
+ REAL_CONST(75175.178931030852/8.0),
+ REAL_CONST(75197.257620760924/8.0),
+ REAL_CONST(75219.33793124267/8.0),
+ REAL_CONST(75241.419862238225/8.0),
+ REAL_CONST(75263.503413509738/8.0),
+ REAL_CONST(75285.588584819503/8.0),
+ REAL_CONST(75307.675375929874/8.0),
+ REAL_CONST(75329.763786603318/8.0),
+ REAL_CONST(75351.853816602365/8.0),
+ REAL_CONST(75373.945465689612/8.0),
+ REAL_CONST(75396.038733627807/8.0),
+ REAL_CONST(75418.133620179724/8.0),
+ REAL_CONST(75440.230125108254/8.0),
+ REAL_CONST(75462.32824817636/8.0),
+ REAL_CONST(75484.427989147109/8.0),
+ REAL_CONST(75506.529347783653/8.0),
+ REAL_CONST(75528.63232384919/8.0),
+ REAL_CONST(75550.736917107075/8.0),
+ REAL_CONST(75572.843127320695/8.0),
+ REAL_CONST(75594.950954253538/8.0),
+ REAL_CONST(75617.060397669193/8.0),
+ REAL_CONST(75639.171457331307/8.0),
+ REAL_CONST(75661.284133003646/8.0),
+ REAL_CONST(75683.398424450032/8.0),
+ REAL_CONST(75705.514331434402/8.0),
+ REAL_CONST(75727.631853720741/8.0),
+ REAL_CONST(75749.750991073175/8.0),
+ REAL_CONST(75771.871743255862/8.0),
+ REAL_CONST(75793.994110033076/8.0),
+ REAL_CONST(75816.118091169177/8.0),
+ REAL_CONST(75838.243686428585/8.0),
+ REAL_CONST(75860.370895575848/8.0),
+ REAL_CONST(75882.499718375562/8.0),
+ REAL_CONST(75904.630154592422/8.0),
+ REAL_CONST(75926.762203991224/8.0),
+ REAL_CONST(75948.895866336825/8.0),
+ REAL_CONST(75971.031141394182/8.0),
+ REAL_CONST(75993.168028928325/8.0),
+ REAL_CONST(76015.306528704401/8.0),
+ REAL_CONST(76037.4466404876/8.0),
+ REAL_CONST(76059.588364043215/8.0),
+ REAL_CONST(76081.731699136653/8.0),
+ REAL_CONST(76103.876645533353/8.0),
+ REAL_CONST(76126.023202998884/8.0),
+ REAL_CONST(76148.171371298871/8.0),
+ REAL_CONST(76170.321150199044/8.0),
+ REAL_CONST(76192.472539465205/8.0),
+ REAL_CONST(76214.625538863256/8.0),
+ REAL_CONST(76236.780148159174/8.0),
+ REAL_CONST(76258.936367119008/8.0),
+ REAL_CONST(76281.094195508922/8.0),
+ REAL_CONST(76303.253633095141/8.0),
+ REAL_CONST(76325.414679643975/8.0),
+ REAL_CONST(76347.577334921851/8.0),
+ REAL_CONST(76369.741598695226/8.0),
+ REAL_CONST(76391.907470730686/8.0),
+ REAL_CONST(76414.074950794879/8.0),
+ REAL_CONST(76436.244038654564/8.0),
+ REAL_CONST(76458.414734076548/8.0),
+ REAL_CONST(76480.587036827754/8.0),
+ REAL_CONST(76502.760946675175/8.0),
+ REAL_CONST(76524.936463385893/8.0),
+ REAL_CONST(76547.11358672705/8.0),
+ REAL_CONST(76569.292316465915/8.0),
+ REAL_CONST(76591.472652369819/8.0),
+ REAL_CONST(76613.654594206164/8.0),
+ REAL_CONST(76635.838141742468/8.0),
+ REAL_CONST(76658.023294746308/8.0),
+ REAL_CONST(76680.210052985349/8.0),
+ REAL_CONST(76702.398416227341/8.0),
+ REAL_CONST(76724.588384240138/8.0),
+ REAL_CONST(76746.779956791637/8.0),
+ REAL_CONST(76768.973133649866/8.0),
+ REAL_CONST(76791.167914582897/8.0),
+ REAL_CONST(76813.364299358902/8.0),
+ REAL_CONST(76835.562287746157/8.0),
+ REAL_CONST(76857.761879512967/8.0),
+ REAL_CONST(76879.963074427797/8.0),
+ REAL_CONST(76902.165872259109/8.0),
+ REAL_CONST(76924.37027277553/8.0),
+ REAL_CONST(76946.576275745727/8.0),
+ REAL_CONST(76968.783880938441/8.0),
+ REAL_CONST(76990.993088122515/8.0),
+ REAL_CONST(77013.203897066895/8.0),
+ REAL_CONST(77035.416307540567/8.0),
+ REAL_CONST(77057.630319312622/8.0),
+ REAL_CONST(77079.845932152239/8.0),
+ REAL_CONST(77102.063145828695/8.0),
+ REAL_CONST(77124.281960111301/8.0),
+ REAL_CONST(77146.50237476948/8.0),
+ REAL_CONST(77168.724389572759/8.0),
+ REAL_CONST(77190.948004290723/8.0),
+ REAL_CONST(77213.173218693031/8.0),
+ REAL_CONST(77235.400032549442/8.0),
+ REAL_CONST(77257.628445629802/8.0),
+ REAL_CONST(77279.858457704031/8.0),
+ REAL_CONST(77302.090068542122/8.0),
+ REAL_CONST(77324.323277914169/8.0),
+ REAL_CONST(77346.558085590339/8.0),
+ REAL_CONST(77368.794491340886/8.0),
+ REAL_CONST(77391.032494936138/8.0),
+ REAL_CONST(77413.272096146524/8.0),
+ REAL_CONST(77435.51329474253/8.0),
+ REAL_CONST(77457.756090494731/8.0),
+ REAL_CONST(77480.000483173804/8.0),
+ REAL_CONST(77502.246472550498/8.0),
+ REAL_CONST(77524.494058395634/8.0),
+ REAL_CONST(77546.743240480107/8.0),
+ REAL_CONST(77568.994018574944/8.0),
+ REAL_CONST(77591.246392451198/8.0),
+ REAL_CONST(77613.500361880026/8.0),
+ REAL_CONST(77635.755926632657/8.0),
+ REAL_CONST(77658.013086480438/8.0),
+ REAL_CONST(77680.271841194757/8.0),
+ REAL_CONST(77702.532190547092/8.0),
+ REAL_CONST(77724.794134309021/8.0),
+ REAL_CONST(77747.057672252195/8.0),
+ REAL_CONST(77769.322804148323/8.0),
+ REAL_CONST(77791.589529769248/8.0),
+ REAL_CONST(77813.857848886837/8.0),
+ REAL_CONST(77836.127761273063/8.0),
+ REAL_CONST(77858.399266699998/8.0),
+ REAL_CONST(77880.67236493979/8.0),
+ REAL_CONST(77902.947055764627/8.0),
+ REAL_CONST(77925.223338946831/8.0),
+ REAL_CONST(77947.50121425878/8.0),
+ REAL_CONST(77969.780681472927/8.0),
+ REAL_CONST(77992.061740361838/8.0),
+ REAL_CONST(78014.344390698127/8.0),
+ REAL_CONST(78036.628632254491/8.0),
+ REAL_CONST(78058.914464803747/8.0),
+ REAL_CONST(78081.201888118725/8.0),
+ REAL_CONST(78103.490901972415/8.0),
+ REAL_CONST(78125.781506137821/8.0),
+ REAL_CONST(78148.073700388064/8.0),
+ REAL_CONST(78170.367484496339/8.0),
+ REAL_CONST(78192.662858235926/8.0),
+ REAL_CONST(78214.959821380166/8.0),
+ REAL_CONST(78237.258373702498/8.0),
+ REAL_CONST(78259.558514976452/8.0),
+ REAL_CONST(78281.860244975614/8.0),
+ REAL_CONST(78304.163563473659/8.0),
+ REAL_CONST(78326.468470244363/8.0),
+ REAL_CONST(78348.77496506153/8.0),
+ REAL_CONST(78371.083047699125/8.0),
+ REAL_CONST(78393.392717931114/8.0),
+ REAL_CONST(78415.703975531578/8.0),
+ REAL_CONST(78438.016820274701/8.0),
+ REAL_CONST(78460.331251934695/8.0),
+ REAL_CONST(78482.647270285903/8.0),
+ REAL_CONST(78504.964875102727/8.0),
+ REAL_CONST(78527.284066159627/8.0),
+ REAL_CONST(78549.604843231195/8.0),
+ REAL_CONST(78571.927206092048/8.0),
+ REAL_CONST(78594.251154516911/8.0),
+ REAL_CONST(78616.576688280606/8.0),
+ REAL_CONST(78638.903807157985/8.0),
+ REAL_CONST(78661.232510924034/8.0),
+ REAL_CONST(78683.562799353778/8.0),
+ REAL_CONST(78705.894672222363/8.0),
+ REAL_CONST(78728.228129304945/8.0),
+ REAL_CONST(78750.563170376859/8.0),
+ REAL_CONST(78772.899795213423/8.0),
+ REAL_CONST(78795.238003590101/8.0),
+ REAL_CONST(78817.577795282399/8.0),
+ REAL_CONST(78839.919170065928/8.0),
+ REAL_CONST(78862.262127716356/8.0),
+ REAL_CONST(78884.606668009452/8.0),
+ REAL_CONST(78906.952790721043/8.0),
+ REAL_CONST(78929.300495627045/8.0),
+ REAL_CONST(78951.64978250346/8.0),
+ REAL_CONST(78974.000651126378/8.0),
+ REAL_CONST(78996.353101271932/8.0),
+ REAL_CONST(79018.707132716358/8.0),
+ REAL_CONST(79041.062745235977/8.0),
+ REAL_CONST(79063.41993860717/8.0),
+ REAL_CONST(79085.778712606436/8.0),
+ REAL_CONST(79108.139067010285/8.0),
+ REAL_CONST(79130.501001595389/8.0),
+ REAL_CONST(79152.864516138419/8.0),
+ REAL_CONST(79175.22961041618/8.0),
+ REAL_CONST(79197.596284205531/8.0),
+ REAL_CONST(79219.96453728342/8.0),
+ REAL_CONST(79242.33436942687/8.0),
+ REAL_CONST(79264.705780412987/8.0),
+ REAL_CONST(79287.078770018954/8.0),
+ REAL_CONST(79309.453338022009/8.0),
+ REAL_CONST(79331.829484199508/8.0),
+ REAL_CONST(79354.207208328866/8.0),
+ REAL_CONST(79376.586510187582/8.0),
+ REAL_CONST(79398.967389553218/8.0),
+ REAL_CONST(79421.349846203433/8.0),
+ REAL_CONST(79443.733879915948/8.0),
+ REAL_CONST(79466.119490468584/8.0),
+ REAL_CONST(79488.50667763922/8.0),
+ REAL_CONST(79510.895441205823/8.0),
+ REAL_CONST(79533.285780946433/8.0),
+ REAL_CONST(79555.677696639163/8.0),
+ REAL_CONST(79578.071188062226/8.0),
+ REAL_CONST(79600.466254993895/8.0),
+ REAL_CONST(79622.862897212515/8.0),
+ REAL_CONST(79645.261114496549/8.0),
+ REAL_CONST(79667.660906624471/8.0),
+ REAL_CONST(79690.062273374875/8.0),
+ REAL_CONST(79712.465214526455/8.0),
+ REAL_CONST(79734.869729857935/8.0),
+ REAL_CONST(79757.275819148126/8.0),
+ REAL_CONST(79779.683482175955/8.0),
+ REAL_CONST(79802.092718720378/8.0),
+ REAL_CONST(79824.503528560454/8.0),
+ REAL_CONST(79846.915911475327/8.0),
+ REAL_CONST(79869.329867244203/8.0),
+ REAL_CONST(79891.745395646343/8.0),
+ REAL_CONST(79914.162496461155/8.0),
+ REAL_CONST(79936.581169468045/8.0),
+ REAL_CONST(79959.001414446553/8.0),
+ REAL_CONST(79981.423231176261/8.0),
+ REAL_CONST(80003.846619436852/8.0),
+ REAL_CONST(80026.271579008084/8.0),
+ REAL_CONST(80048.698109669771/8.0),
+ REAL_CONST(80071.12621120183/8.0),
+ REAL_CONST(80093.555883384237/8.0),
+ REAL_CONST(80115.987125997053/8.0),
+ REAL_CONST(80138.419938820414/8.0),
+ REAL_CONST(80160.854321634528/8.0),
+ REAL_CONST(80183.290274219689/8.0),
+ REAL_CONST(80205.727796356281/8.0),
+ REAL_CONST(80228.166887824715/8.0),
+ REAL_CONST(80250.607548405547/8.0),
+ REAL_CONST(80273.049777879336/8.0),
+ REAL_CONST(80295.493576026798/8.0),
+ REAL_CONST(80317.938942628651/8.0),
+ REAL_CONST(80340.385877465727/8.0),
+ REAL_CONST(80362.834380318949/8.0),
+ REAL_CONST(80385.28445096928/8.0),
+ REAL_CONST(80407.736089197788/8.0),
+ REAL_CONST(80430.189294785596/8.0),
+ REAL_CONST(80452.644067513917/8.0),
+ REAL_CONST(80475.100407164035/8.0),
+ REAL_CONST(80497.558313517322/8.0),
+ REAL_CONST(80520.017786355209/8.0),
+ REAL_CONST(80542.478825459213/8.0),
+ REAL_CONST(80564.941430610925/8.0),
+ REAL_CONST(80587.405601592007/8.0),
+ REAL_CONST(80609.871338184195/8.0),
+ REAL_CONST(80632.338640169342/8.0),
+ REAL_CONST(80654.8075073293/8.0),
+ REAL_CONST(80677.277939446067/8.0),
+ REAL_CONST(80699.749936301683/8.0),
+ REAL_CONST(80722.223497678278/8.0),
+ REAL_CONST(80744.698623358039/8.0),
+ REAL_CONST(80767.17531312324/8.0),
+ REAL_CONST(80789.653566756242/8.0),
+ REAL_CONST(80812.133384039465/8.0),
+ REAL_CONST(80834.614764755403/8.0),
+ REAL_CONST(80857.097708686648/8.0),
+ REAL_CONST(80879.582215615854/8.0),
+ REAL_CONST(80902.068285325731/8.0),
+ REAL_CONST(80924.555917599093/8.0),
+ REAL_CONST(80947.045112218824/8.0),
+ REAL_CONST(80969.535868967869/8.0),
+ REAL_CONST(80992.028187629272/8.0),
+ REAL_CONST(81014.522067986123/8.0),
+ REAL_CONST(81037.017509821613/8.0),
+ REAL_CONST(81059.514512919006/8.0),
+ REAL_CONST(81082.013077061609/8.0),
+ REAL_CONST(81104.513202032831/8.0),
+ REAL_CONST(81127.014887616184/8.0),
+ REAL_CONST(81149.518133595193/8.0),
+ REAL_CONST(81172.022939753486/8.0),
+ REAL_CONST(81194.529305874807/8.0),
+ REAL_CONST(81217.037231742899/8.0),
+ REAL_CONST(81239.546717141639/8.0),
+ REAL_CONST(81262.057761854958/8.0),
+ REAL_CONST(81284.570365666848/8.0),
+ REAL_CONST(81307.084528361403/8.0),
+ REAL_CONST(81329.600249722775/8.0),
+ REAL_CONST(81352.117529535186/8.0),
+ REAL_CONST(81374.636367582949/8.0),
+ REAL_CONST(81397.156763650448/8.0),
+ REAL_CONST(81419.678717522125/8.0),
+ REAL_CONST(81442.202228982511/8.0),
+ REAL_CONST(81464.727297816222/8.0),
+ REAL_CONST(81487.253923807933/8.0),
+ REAL_CONST(81509.782106742379/8.0),
+ REAL_CONST(81532.311846404409/8.0),
+ REAL_CONST(81554.843142578902/8.0),
+ REAL_CONST(81577.375995050839/8.0),
+ REAL_CONST(81599.910403605274/8.0),
+ REAL_CONST(81622.446368027333/8.0),
+ REAL_CONST(81644.983888102215/8.0),
+ REAL_CONST(81667.522963615178/8.0),
+ REAL_CONST(81690.063594351581/8.0),
+ REAL_CONST(81712.605780096841/8.0),
+ REAL_CONST(81735.149520636449/8.0),
+ REAL_CONST(81757.694815755967/8.0),
+ REAL_CONST(81780.241665241047/8.0),
+ REAL_CONST(81802.79006887741/8.0),
+ REAL_CONST(81825.340026450824/8.0),
+ REAL_CONST(81847.891537747171/8.0),
+ REAL_CONST(81870.444602552379/8.0),
+ REAL_CONST(81892.999220652477/8.0),
+ REAL_CONST(81915.555391833506/8.0),
+ REAL_CONST(81938.113115881672/8.0),
+ REAL_CONST(81960.672392583176/8.0),
+ REAL_CONST(81983.233221724338/8.0),
+ REAL_CONST(82005.795603091537/8.0),
+ REAL_CONST(82028.359536471224/8.0),
+ REAL_CONST(82050.925021649906/8.0),
+ REAL_CONST(82073.492058414209/8.0),
+ REAL_CONST(82096.060646550788/8.0),
+ REAL_CONST(82118.630785846399/8.0),
+ REAL_CONST(82141.202476087841/8.0),
+ REAL_CONST(82163.775717062032/8.0),
+ REAL_CONST(82186.35050855593/8.0),
+ REAL_CONST(82208.926850356569/8.0),
+ REAL_CONST(82231.504742251054/8.0),
+ REAL_CONST(82254.084184026578/8.0),
+ REAL_CONST(82276.665175470393/8.0),
+ REAL_CONST(82299.24771636985/8.0),
+ REAL_CONST(82321.831806512317/8.0),
+ REAL_CONST(82344.417445685307/8.0),
+ REAL_CONST(82367.004633676348/8.0),
+ REAL_CONST(82389.593370273054/8.0),
+ REAL_CONST(82412.183655263143/8.0),
+ REAL_CONST(82434.775488434374/8.0),
+ REAL_CONST(82457.368869574595/8.0),
+ REAL_CONST(82479.963798471697/8.0),
+ REAL_CONST(82502.560274913689/8.0),
+ REAL_CONST(82525.158298688606/8.0),
+ REAL_CONST(82547.757869584602/8.0),
+ REAL_CONST(82570.35898738986/8.0),
+ REAL_CONST(82592.961651892678/8.0),
+ REAL_CONST(82615.565862881398/8.0),
+ REAL_CONST(82638.171620144421/8.0),
+ REAL_CONST(82660.778923470265/8.0),
+ REAL_CONST(82683.387772647475/8.0),
+ REAL_CONST(82705.998167464713/8.0),
+ REAL_CONST(82728.610107710658/8.0),
+ REAL_CONST(82751.223593174116/8.0),
+ REAL_CONST(82773.83862364394/8.0),
+ REAL_CONST(82796.45519890904/8.0),
+ REAL_CONST(82819.073318758441/8.0),
+ REAL_CONST(82841.692982981185/8.0),
+ REAL_CONST(82864.314191366429/8.0),
+ REAL_CONST(82886.936943703375/8.0),
+ REAL_CONST(82909.561239781324/8.0),
+ REAL_CONST(82932.187079389638/8.0),
+ REAL_CONST(82954.814462317736/8.0),
+ REAL_CONST(82977.443388355125/8.0),
+ REAL_CONST(83000.073857291369/8.0),
+ REAL_CONST(83022.70586891612/8.0),
+ REAL_CONST(83045.339423019104/8.0),
+ REAL_CONST(83067.974519390089/8.0),
+ REAL_CONST(83090.611157818959/8.0),
+ REAL_CONST(83113.249338095629/8.0),
+ REAL_CONST(83135.8890600101/8.0),
+ REAL_CONST(83158.530323352461/8.0),
+ REAL_CONST(83181.173127912858/8.0),
+ REAL_CONST(83203.817473481497/8.0),
+ REAL_CONST(83226.463359848669/8.0),
+ REAL_CONST(83249.11078680474/8.0),
+ REAL_CONST(83271.759754140134/8.0),
+ REAL_CONST(83294.410261645375/8.0),
+ REAL_CONST(83317.062309111003/8.0),
+ REAL_CONST(83339.715896327703/8.0),
+ REAL_CONST(83362.371023086147/8.0),
+ REAL_CONST(83385.027689177165/8.0),
+ REAL_CONST(83407.685894391587/8.0),
+ REAL_CONST(83430.345638520361/8.0),
+ REAL_CONST(83453.006921354478/8.0),
+ REAL_CONST(83475.669742685001/8.0),
+ REAL_CONST(83498.334102303095/8.0),
+ REAL_CONST(83520.999999999942/8.0),
+ REAL_CONST(83543.667435566866/8.0),
+ REAL_CONST(83566.336408795192/8.0),
+ REAL_CONST(83589.006919476349/8.0),
+ REAL_CONST(83611.678967401851/8.0),
+ REAL_CONST(83634.352552363242/8.0),
+ REAL_CONST(83657.027674152167/8.0),
+ REAL_CONST(83679.704332560359/8.0),
+ REAL_CONST(83702.382527379552/8.0),
+ REAL_CONST(83725.062258401638/8.0),
+ REAL_CONST(83747.743525418511/8.0),
+ REAL_CONST(83770.42632822218/8.0),
+ REAL_CONST(83793.110666604684/8.0),
+ REAL_CONST(83815.796540358162/8.0),
+ REAL_CONST(83838.483949274829/8.0),
+ REAL_CONST(83861.172893146941/8.0),
+ REAL_CONST(83883.863371766842/8.0),
+ REAL_CONST(83906.555384926964/8.0),
+ REAL_CONST(83929.248932419752/8.0),
+ REAL_CONST(83951.944014037799/8.0),
+ REAL_CONST(83974.640629573696/8.0),
+ REAL_CONST(83997.338778820151/8.0),
+ REAL_CONST(84020.038461569929/8.0),
+ REAL_CONST(84042.739677615857/8.0),
+ REAL_CONST(84065.442426750829/8.0),
+ REAL_CONST(84088.146708767847/8.0),
+ REAL_CONST(84110.852523459922/8.0),
+ REAL_CONST(84133.559870620171/8.0),
+ REAL_CONST(84156.268750041796/8.0),
+ REAL_CONST(84178.979161518029/8.0),
+ REAL_CONST(84201.691104842204/8.0),
+ REAL_CONST(84224.404579807713/8.0),
+ REAL_CONST(84247.119586208006/8.0),
+ REAL_CONST(84269.83612383662/8.0),
+ REAL_CONST(84292.55419248715/8.0),
+ REAL_CONST(84315.273791953281/8.0),
+ REAL_CONST(84337.994922028738/8.0),
+ REAL_CONST(84360.717582507335/8.0),
+ REAL_CONST(84383.441773182945/8.0),
+ REAL_CONST(84406.167493849513/8.0),
+ REAL_CONST(84428.894744301069/8.0),
+ REAL_CONST(84451.623524331691/8.0),
+ REAL_CONST(84474.353833735542/8.0),
+ REAL_CONST(84497.085672306828/8.0),
+ REAL_CONST(84519.819039839858/8.0),
+ REAL_CONST(84542.553936128999/8.0),
+ REAL_CONST(84565.290360968676/8.0),
+ REAL_CONST(84588.028314153402/8.0),
+ REAL_CONST(84610.767795477717/8.0),
+ REAL_CONST(84633.508804736295/8.0),
+ REAL_CONST(84656.251341723822/8.0),
+ REAL_CONST(84678.995406235073/8.0),
+ REAL_CONST(84701.740998064924/8.0),
+ REAL_CONST(84724.488117008252/8.0),
+ REAL_CONST(84747.236762860062/8.0),
+ REAL_CONST(84769.986935415407/8.0),
+ REAL_CONST(84792.73863446941/8.0),
+ REAL_CONST(84815.491859817252/8.0),
+ REAL_CONST(84838.246611254188/8.0),
+ REAL_CONST(84861.002888575575/8.0),
+ REAL_CONST(84883.760691576768/8.0),
+ REAL_CONST(84906.520020053256/8.0),
+ REAL_CONST(84929.28087380057/8.0),
+ REAL_CONST(84952.043252614312/8.0),
+ REAL_CONST(84974.807156290146/8.0),
+ REAL_CONST(84997.572584623806/8.0),
+ REAL_CONST(85020.339537411113/8.0),
+ REAL_CONST(85043.108014447949/8.0),
+ REAL_CONST(85065.878015530237/8.0),
+ REAL_CONST(85088.649540453989/8.0),
+ REAL_CONST(85111.422589015303/8.0),
+ REAL_CONST(85134.197161010321/8.0),
+ REAL_CONST(85156.973256235244/8.0),
+ REAL_CONST(85179.750874486374/8.0),
+ REAL_CONST(85202.530015560071/8.0),
+ REAL_CONST(85225.310679252725/8.0),
+ REAL_CONST(85248.092865360857/8.0),
+ REAL_CONST(85270.876573681016/8.0),
+ REAL_CONST(85293.661804009811/8.0),
+ REAL_CONST(85316.448556143951/8.0),
+ REAL_CONST(85339.236829880188/8.0),
+ REAL_CONST(85362.026625015351/8.0),
+ REAL_CONST(85384.817941346351/8.0),
+ REAL_CONST(85407.610778670132/8.0),
+ REAL_CONST(85430.405136783724/8.0),
+ REAL_CONST(85453.201015484257/8.0),
+ REAL_CONST(85475.998414568865/8.0),
+ REAL_CONST(85498.797333834795/8.0),
+ REAL_CONST(85521.597773079353/8.0),
+ REAL_CONST(85544.399732099904/8.0),
+ REAL_CONST(85567.203210693886/8.0),
+ REAL_CONST(85590.008208658808/8.0),
+ REAL_CONST(85612.814725792239/8.0),
+ REAL_CONST(85635.62276189182/8.0),
+ REAL_CONST(85658.432316755265/8.0),
+ REAL_CONST(85681.243390180331/8.0),
+ REAL_CONST(85704.055981964877/8.0),
+ REAL_CONST(85726.870091906807/8.0),
+ REAL_CONST(85749.685719804082/8.0),
+ REAL_CONST(85772.502865454764/8.0),
+ REAL_CONST(85795.321528656961/8.0),
+ REAL_CONST(85818.141709208852/8.0),
+ REAL_CONST(85840.963406908675/8.0),
+ REAL_CONST(85863.78662155474/8.0),
+ REAL_CONST(85886.611352945445/8.0),
+ REAL_CONST(85909.437600879217/8.0),
+ REAL_CONST(85932.26536515457/8.0),
+ REAL_CONST(85955.094645570091/8.0),
+ REAL_CONST(85977.92544192441/8.0),
+ REAL_CONST(86000.757754016275/8.0),
+ REAL_CONST(86023.591581644432/8.0),
+ REAL_CONST(86046.426924607746/8.0),
+ REAL_CONST(86069.263782705122/8.0),
+ REAL_CONST(86092.102155735556/8.0),
+ REAL_CONST(86114.942043498071/8.0),
+ REAL_CONST(86137.783445791807/8.0),
+ REAL_CONST(86160.626362415918/8.0),
+ REAL_CONST(86183.470793169676/8.0),
+ REAL_CONST(86206.316737852379/8.0),
+ REAL_CONST(86229.164196263402/8.0),
+ REAL_CONST(86252.013168202204/8.0),
+ REAL_CONST(86274.863653468303/8.0),
+ REAL_CONST(86297.715651861261/8.0),
+ REAL_CONST(86320.569163180728/8.0),
+ REAL_CONST(86343.424187226425/8.0),
+ REAL_CONST(86366.280723798132/8.0),
+ REAL_CONST(86389.138772695675/8.0),
+ REAL_CONST(86411.998333718977/8.0),
+ REAL_CONST(86434.859406668009/8.0),
+ REAL_CONST(86457.721991342827/8.0),
+ REAL_CONST(86480.586087543532/8.0),
+ REAL_CONST(86503.451695070296/8.0),
+ REAL_CONST(86526.318813723352/8.0),
+ REAL_CONST(86549.187443303032/8.0),
+ REAL_CONST(86572.057583609683/8.0),
+ REAL_CONST(86594.929234443756/8.0),
+ REAL_CONST(86617.802395605773/8.0),
+ REAL_CONST(86640.677066896271/8.0),
+ REAL_CONST(86663.553248115903/8.0),
+ REAL_CONST(86686.43093906538/8.0),
+ REAL_CONST(86709.310139545443/8.0),
+ REAL_CONST(86732.190849356964/8.0),
+ REAL_CONST(86755.073068300815/8.0),
+ REAL_CONST(86777.956796177954/8.0),
+ REAL_CONST(86800.842032789442/8.0),
+ REAL_CONST(86823.728777936354/8.0),
+ REAL_CONST(86846.617031419853/8.0),
+ REAL_CONST(86869.506793041175/8.0),
+ REAL_CONST(86892.398062601613/8.0),
+ REAL_CONST(86915.290839902518/8.0),
+ REAL_CONST(86938.185124745316/8.0),
+ REAL_CONST(86961.080916931489/8.0),
+ REAL_CONST(86983.978216262592/8.0),
+ REAL_CONST(87006.87702254027/8.0),
+ REAL_CONST(87029.777335566177/8.0),
+ REAL_CONST(87052.67915514209/8.0),
+ REAL_CONST(87075.582481069796/8.0),
+ REAL_CONST(87098.487313151185/8.0),
+ REAL_CONST(87121.39365118822/8.0),
+ REAL_CONST(87144.301494982894/8.0),
+ REAL_CONST(87167.210844337285/8.0),
+ REAL_CONST(87190.121699053532/8.0),
+ REAL_CONST(87213.034058933845/8.0),
+ REAL_CONST(87235.947923780506/8.0),
+ REAL_CONST(87258.863293395829/8.0),
+ REAL_CONST(87281.780167582241/8.0),
+ REAL_CONST(87304.698546142172/8.0),
+ REAL_CONST(87327.618428878181/8.0),
+ REAL_CONST(87350.539815592856/8.0),
+ REAL_CONST(87373.462706088845/8.0),
+ REAL_CONST(87396.387100168897/8.0),
+ REAL_CONST(87419.312997635774/8.0),
+ REAL_CONST(87442.240398292357/8.0),
+ REAL_CONST(87465.16930194154/8.0),
+ REAL_CONST(87488.099708386319/8.0),
+ REAL_CONST(87511.031617429733/8.0),
+ REAL_CONST(87533.965028874911/8.0),
+ REAL_CONST(87556.899942525008/8.0),
+ REAL_CONST(87579.836358183282/8.0),
+ REAL_CONST(87602.774275653021/8.0),
+ REAL_CONST(87625.713694737613/8.0),
+ REAL_CONST(87648.654615240492/8.0),
+ REAL_CONST(87671.597036965148/8.0),
+ REAL_CONST(87694.540959715145/8.0),
+ REAL_CONST(87717.486383294105/8.0),
+ REAL_CONST(87740.433307505737/8.0),
+ REAL_CONST(87763.381732153779/8.0),
+ REAL_CONST(87786.331657042057/8.0),
+ REAL_CONST(87809.283081974456/8.0),
+ REAL_CONST(87832.236006754916/8.0),
+ REAL_CONST(87855.190431187453/8.0),
+ REAL_CONST(87878.146355076155/8.0),
+ REAL_CONST(87901.103778225151/8.0),
+ REAL_CONST(87924.062700438633/8.0),
+ REAL_CONST(87947.023121520891/8.0),
+ REAL_CONST(87969.985041276246/8.0),
+ REAL_CONST(87992.948459509105/8.0),
+ REAL_CONST(88015.913376023906/8.0),
+ REAL_CONST(88038.879790625171/8.0),
+ REAL_CONST(88061.847703117513/8.0),
+ REAL_CONST(88084.817113305573/8.0),
+ REAL_CONST(88107.788020994049/8.0),
+ REAL_CONST(88130.760425987726/8.0),
+ REAL_CONST(88153.734328091465/8.0),
+ REAL_CONST(88176.709727110137/8.0),
+ REAL_CONST(88199.686622848749/8.0),
+ REAL_CONST(88222.665015112303/8.0),
+ REAL_CONST(88245.644903705906/8.0),
+ REAL_CONST(88268.626288434709/8.0),
+ REAL_CONST(88291.609169103947/8.0),
+ REAL_CONST(88314.593545518903/8.0),
+ REAL_CONST(88337.579417484914/8.0),
+ REAL_CONST(88360.566784807408/8.0),
+ REAL_CONST(88383.555647291854/8.0),
+ REAL_CONST(88406.546004743795/8.0),
+ REAL_CONST(88429.537856968818/8.0),
+ REAL_CONST(88452.531203772611/8.0),
+ REAL_CONST(88475.52604496089/8.0),
+ REAL_CONST(88498.522380339447/8.0),
+ REAL_CONST(88521.52020971413/8.0),
+ REAL_CONST(88544.519532890874/8.0),
+ REAL_CONST(88567.520349675644/8.0),
+ REAL_CONST(88590.522659874507/8.0),
+ REAL_CONST(88613.526463293543/8.0),
+ REAL_CONST(88636.531759738922/8.0),
+ REAL_CONST(88659.538549016899/8.0),
+ REAL_CONST(88682.546830933745/8.0),
+ REAL_CONST(88705.556605295846/8.0),
+ REAL_CONST(88728.567871909589/8.0),
+ REAL_CONST(88751.580630581491/8.0),
+ REAL_CONST(88774.594881118086/8.0),
+ REAL_CONST(88797.610623325963/8.0),
+ REAL_CONST(88820.62785701183/8.0),
+ REAL_CONST(88843.646581982393/8.0),
+ REAL_CONST(88866.666798044462/8.0),
+ REAL_CONST(88889.688505004888/8.0),
+ REAL_CONST(88912.711702670611/8.0),
+ REAL_CONST(88935.7363908486/8.0),
+ REAL_CONST(88958.762569345898/8.0),
+ REAL_CONST(88981.790237969632/8.0),
+ REAL_CONST(89004.81939652696/8.0),
+ REAL_CONST(89027.850044825114/8.0),
+ REAL_CONST(89050.882182671412/8.0),
+ REAL_CONST(89073.9158098732/8.0),
+ REAL_CONST(89096.950926237885/8.0),
+ REAL_CONST(89119.987531572973/8.0),
+ REAL_CONST(89143.025625686001/8.0),
+ REAL_CONST(89166.065208384563/8.0),
+ REAL_CONST(89189.106279476357/8.0),
+ REAL_CONST(89212.148838769106/8.0),
+ REAL_CONST(89235.192886070581/8.0),
+ REAL_CONST(89258.238421188667/8.0),
+ REAL_CONST(89281.285443931265/8.0),
+ REAL_CONST(89304.333954106376/8.0),
+ REAL_CONST(89327.383951522017/8.0),
+ REAL_CONST(89350.435435986306/8.0),
+ REAL_CONST(89373.488407307406/8.0),
+ REAL_CONST(89396.542865293537/8.0),
+ REAL_CONST(89419.598809753006/8.0),
+ REAL_CONST(89442.656240494165/8.0),
+ REAL_CONST(89465.715157325409/8.0),
+ REAL_CONST(89488.775560055219/8.0),
+ REAL_CONST(89511.837448492137/8.0),
+ REAL_CONST(89534.900822444746/8.0),
+ REAL_CONST(89557.965681721733/8.0),
+ REAL_CONST(89581.032026131812/8.0),
+ REAL_CONST(89604.099855483742/8.0),
+ REAL_CONST(89627.169169586399/8.0),
+ REAL_CONST(89650.239968248672/8.0),
+ REAL_CONST(89673.312251279538/8.0),
+ REAL_CONST(89696.386018488018/8.0),
+ REAL_CONST(89719.461269683205/8.0),
+ REAL_CONST(89742.53800467425/8.0),
+ REAL_CONST(89765.616223270365/8.0),
+ REAL_CONST(89788.69592528083/8.0),
+ REAL_CONST(89811.777110514988/8.0),
+ REAL_CONST(89834.859778782207/8.0),
+ REAL_CONST(89857.943929891975/8.0),
+ REAL_CONST(89881.029563653807/8.0),
+ REAL_CONST(89904.116679877261/8.0),
+ REAL_CONST(89927.205278372014/8.0),
+ REAL_CONST(89950.29535894774/8.0),
+ REAL_CONST(89973.386921414218/8.0),
+ REAL_CONST(89996.479965581268/8.0),
+ REAL_CONST(90019.574491258769/8.0),
+ REAL_CONST(90042.670498256688/8.0),
+ REAL_CONST(90065.767986385021/8.0),
+ REAL_CONST(90088.866955453836/8.0),
+ REAL_CONST(90111.967405273259/8.0),
+ REAL_CONST(90135.069335653476/8.0),
+ REAL_CONST(90158.172746404758/8.0),
+ REAL_CONST(90181.277637337407/8.0),
+ REAL_CONST(90204.384008261797/8.0),
+ REAL_CONST(90227.49185898836/8.0),
+ REAL_CONST(90250.601189327586/8.0),
+ REAL_CONST(90273.711999090039/8.0),
+ REAL_CONST(90296.824288086325/8.0),
+ REAL_CONST(90319.938056127125/8.0),
+ REAL_CONST(90343.053303023189/8.0),
+ REAL_CONST(90366.170028585286/8.0),
+ REAL_CONST(90389.288232624298/8.0),
+ REAL_CONST(90412.407914951138/8.0),
+ REAL_CONST(90435.529075376777/8.0),
+ REAL_CONST(90458.651713712257/8.0),
+ REAL_CONST(90481.775829768681/8.0),
+ REAL_CONST(90504.901423357209/8.0),
+ REAL_CONST(90528.028494289058/8.0),
+ REAL_CONST(90551.157042375504/8.0),
+ REAL_CONST(90574.287067427911/8.0),
+ REAL_CONST(90597.418569257643/8.0),
+ REAL_CONST(90620.551547676194/8.0),
+ REAL_CONST(90643.686002495073/8.0),
+ REAL_CONST(90666.821933525847/8.0),
+ REAL_CONST(90689.959340580186/8.0),
+ REAL_CONST(90713.098223469773/8.0),
+ REAL_CONST(90736.238582006365/8.0),
+ REAL_CONST(90759.380416001804/8.0),
+ REAL_CONST(90782.523725267951/8.0),
+ REAL_CONST(90805.668509616764/8.0),
+ REAL_CONST(90828.814768860233/8.0),
+ REAL_CONST(90851.962502810435/8.0),
+ REAL_CONST(90875.11171127946/8.0),
+ REAL_CONST(90898.262394079517/8.0),
+ REAL_CONST(90921.414551022855/8.0),
+ REAL_CONST(90944.568181921743/8.0),
+ REAL_CONST(90967.72328658856/8.0),
+ REAL_CONST(90990.879864835719/8.0),
+ REAL_CONST(91014.037916475718/8.0),
+ REAL_CONST(91037.19744132107/8.0),
+ REAL_CONST(91060.358439184391/8.0),
+ REAL_CONST(91083.520909878338/8.0),
+ REAL_CONST(91106.684853215629/8.0),
+ REAL_CONST(91129.850269009039/8.0),
+ REAL_CONST(91153.017157071401/8.0),
+ REAL_CONST(91176.185517215621/8.0),
+ REAL_CONST(91199.355349254649/8.0),
+ REAL_CONST(91222.526653001492/8.0),
+ REAL_CONST(91245.699428269247/8.0),
+ REAL_CONST(91268.873674871036/8.0),
+ REAL_CONST(91292.049392620058/8.0),
+ REAL_CONST(91315.226581329553/8.0),
+ REAL_CONST(91338.405240812834/8.0),
+ REAL_CONST(91361.585370883287/8.0),
+ REAL_CONST(91384.766971354344/8.0),
+ REAL_CONST(91407.950042039476/8.0),
+ REAL_CONST(91431.134582752245/8.0),
+ REAL_CONST(91454.320593306256/8.0),
+ REAL_CONST(91477.508073515171/8.0),
+ REAL_CONST(91500.697023192712/8.0),
+ REAL_CONST(91523.887442152685/8.0),
+ REAL_CONST(91547.07933020893/8.0),
+ REAL_CONST(91570.272687175326/8.0),
+ REAL_CONST(91593.467512865856/8.0),
+ REAL_CONST(91616.663807094534/8.0),
+ REAL_CONST(91639.861569675442/8.0),
+ REAL_CONST(91663.060800422725/8.0),
+ REAL_CONST(91686.261499150554/8.0),
+ REAL_CONST(91709.463665673218/8.0),
+ REAL_CONST(91732.66729980502/8.0),
+ REAL_CONST(91755.872401360321/8.0),
+ REAL_CONST(91779.078970153569/8.0),
+ REAL_CONST(91802.287005999257/8.0),
+ REAL_CONST(91825.49650871192/8.0),
+ REAL_CONST(91848.707478106167/8.0),
+ REAL_CONST(91871.91991399668/8.0),
+ REAL_CONST(91895.133816198169/8.0),
+ REAL_CONST(91918.349184525418/8.0),
+ REAL_CONST(91941.566018793281/8.0),
+ REAL_CONST(91964.784318816659/8.0),
+ REAL_CONST(91988.004084410495/8.0),
+ REAL_CONST(92011.22531538982/8.0),
+ REAL_CONST(92034.448011569708/8.0),
+ REAL_CONST(92057.672172765277/8.0),
+ REAL_CONST(92080.897798791746/8.0),
+ REAL_CONST(92104.124889464365/8.0),
+ REAL_CONST(92127.353444598411/8.0),
+ REAL_CONST(92150.58346400928/8.0),
+ REAL_CONST(92173.814947512379/8.0),
+ REAL_CONST(92197.04789492322/8.0),
+ REAL_CONST(92220.282306057314/8.0),
+ REAL_CONST(92243.518180730272/8.0),
+ REAL_CONST(92266.755518757753/8.0),
+ REAL_CONST(92289.994319955469/8.0),
+ REAL_CONST(92313.234584139194/8.0),
+ REAL_CONST(92336.476311124774/8.0),
+ REAL_CONST(92359.719500728082/8.0),
+ REAL_CONST(92382.964152765067/8.0),
+ REAL_CONST(92406.210267051734/8.0),
+ REAL_CONST(92429.457843404161/8.0),
+ REAL_CONST(92452.706881638471/8.0),
+ REAL_CONST(92475.957381570814/8.0),
+ REAL_CONST(92499.209343017443/8.0),
+ REAL_CONST(92522.462765794655/8.0),
+ REAL_CONST(92545.717649718805/8.0),
+ REAL_CONST(92568.973994606305/8.0),
+ REAL_CONST(92592.231800273614/8.0),
+ REAL_CONST(92615.491066537259/8.0),
+ REAL_CONST(92638.751793213814/8.0),
+ REAL_CONST(92662.01398011994/8.0),
+ REAL_CONST(92685.277627072326/8.0),
+ REAL_CONST(92708.54273388772/8.0),
+ REAL_CONST(92731.809300382942/8.0),
+ REAL_CONST(92755.077326374871/8.0),
+ REAL_CONST(92778.346811680414/8.0),
+ REAL_CONST(92801.617756116568/8.0),
+ REAL_CONST(92824.890159500384/8.0),
+ REAL_CONST(92848.164021648947/8.0),
+ REAL_CONST(92871.439342379424/8.0),
+ REAL_CONST(92894.716121509016/8.0),
+ REAL_CONST(92917.994358855023/8.0),
+ REAL_CONST(92941.274054234746/8.0),
+ REAL_CONST(92964.555207465572/8.0),
+ REAL_CONST(92987.837818364962/8.0),
+ REAL_CONST(93011.121886750407/8.0),
+ REAL_CONST(93034.407412439468/8.0),
+ REAL_CONST(93057.694395249753/8.0),
+ REAL_CONST(93080.982834998955/8.0),
+ REAL_CONST(93104.272731504767/8.0),
+ REAL_CONST(93127.564084584999/8.0),
+ REAL_CONST(93150.856894057491/8.0),
+ REAL_CONST(93174.15115974014/8.0),
+ REAL_CONST(93197.446881450916/8.0),
+ REAL_CONST(93220.744059007804/8.0),
+ REAL_CONST(93244.04269222889/8.0),
+ REAL_CONST(93267.342780932304/8.0),
+ REAL_CONST(93290.644324936235/8.0),
+ REAL_CONST(93313.947324058914/8.0),
+ REAL_CONST(93337.251778118633/8.0),
+ REAL_CONST(93360.557686933767/8.0),
+ REAL_CONST(93383.865050322696/8.0),
+ REAL_CONST(93407.173868103928/8.0),
+ REAL_CONST(93430.484140095941/8.0),
+ REAL_CONST(93453.795866117362/8.0),
+ REAL_CONST(93477.109045986799/8.0),
+ REAL_CONST(93500.423679522952/8.0),
+ REAL_CONST(93523.739766544561/8.0),
+ REAL_CONST(93547.057306870454/8.0),
+ REAL_CONST(93570.376300319491/8.0),
+ REAL_CONST(93593.696746710571/8.0),
+ REAL_CONST(93617.018645862699/8.0),
+ REAL_CONST(93640.341997594893/8.0),
+ REAL_CONST(93663.666801726242/8.0),
+ REAL_CONST(93686.993058075881/8.0),
+ REAL_CONST(93710.320766463032/8.0),
+ REAL_CONST(93733.64992670693/8.0),
+ REAL_CONST(93756.980538626914/8.0),
+ REAL_CONST(93780.312602042337/8.0),
+ REAL_CONST(93803.646116772637/8.0),
+ REAL_CONST(93826.981082637285/8.0),
+ REAL_CONST(93850.317499455836/8.0),
+ REAL_CONST(93873.655367047861/8.0),
+ REAL_CONST(93896.994685233032/8.0),
+ REAL_CONST(93920.335453831038/8.0),
+ REAL_CONST(93943.677672661666/8.0),
+ REAL_CONST(93967.021341544707/8.0),
+ REAL_CONST(93990.366460300051/8.0),
+ REAL_CONST(94013.713028747632/8.0),
+ REAL_CONST(94037.061046707429/8.0),
+ REAL_CONST(94060.410513999494/8.0),
+ REAL_CONST(94083.761430443905/8.0),
+ REAL_CONST(94107.113795860845/8.0),
+ REAL_CONST(94130.467610070496/8.0),
+ REAL_CONST(94153.822872893157/8.0),
+ REAL_CONST(94177.179584149111/8.0),
+ REAL_CONST(94200.537743658759/8.0),
+ REAL_CONST(94223.897351242529/8.0),
+ REAL_CONST(94247.25840672091/8.0),
+ REAL_CONST(94270.620909914433/8.0),
+ REAL_CONST(94293.98486064373/8.0),
+ REAL_CONST(94317.350258729421/8.0),
+ REAL_CONST(94340.71710399224/8.0),
+ REAL_CONST(94364.085396252936/8.0),
+ REAL_CONST(94387.455135332348/8.0),
+ REAL_CONST(94410.82632105134/8.0),
+ REAL_CONST(94434.198953230851/8.0),
+ REAL_CONST(94457.573031691878/8.0),
+ REAL_CONST(94480.948556255447/8.0),
+ REAL_CONST(94504.325526742658/8.0),
+ REAL_CONST(94527.70394297468/8.0),
+ REAL_CONST(94551.083804772716/8.0),
+ REAL_CONST(94574.465111958023/8.0),
+ REAL_CONST(94597.847864351934/8.0),
+ REAL_CONST(94621.232061775823/8.0),
+ REAL_CONST(94644.617704051096/8.0),
+ REAL_CONST(94668.004790999272/8.0),
+ REAL_CONST(94691.393322441872/8.0),
+ REAL_CONST(94714.783298200506/8.0),
+ REAL_CONST(94738.174718096794/8.0),
+ REAL_CONST(94761.567581952477/8.0),
+ REAL_CONST(94784.961889589307/8.0),
+ REAL_CONST(94808.357640829097/8.0),
+ REAL_CONST(94831.754835493703/8.0),
+ REAL_CONST(94855.153473405066/8.0),
+ REAL_CONST(94878.553554385173/8.0),
+ REAL_CONST(94901.955078256055/8.0),
+ REAL_CONST(94925.358044839784/8.0),
+ REAL_CONST(94948.762453958523/8.0),
+ REAL_CONST(94972.168305434476/8.0),
+ REAL_CONST(94995.575599089891/8.0),
+ REAL_CONST(95018.984334747074/8.0),
+ REAL_CONST(95042.394512228391/8.0),
+ REAL_CONST(95065.806131356265/8.0),
+ REAL_CONST(95089.219191953176/8.0),
+ REAL_CONST(95112.633693841635/8.0),
+ REAL_CONST(95136.04963684424/8.0),
+ REAL_CONST(95159.467020783617/8.0),
+ REAL_CONST(95182.885845482466/8.0),
+ REAL_CONST(95206.306110763529/8.0),
+ REAL_CONST(95229.727816449609/8.0),
+ REAL_CONST(95253.150962363579/8.0),
+ REAL_CONST(95276.575548328314/8.0),
+ REAL_CONST(95300.001574166803/8.0),
+ REAL_CONST(95323.429039702052/8.0),
+ REAL_CONST(95346.857944757154/8.0),
+ REAL_CONST(95370.288289155214/8.0),
+ REAL_CONST(95393.720072719429/8.0),
+ REAL_CONST(95417.153295273019/8.0),
+ REAL_CONST(95440.587956639298/8.0),
+ REAL_CONST(95464.024056641589/8.0),
+ REAL_CONST(95487.461595103305/8.0),
+ REAL_CONST(95510.900571847902/8.0),
+ REAL_CONST(95534.340986698866/8.0),
+ REAL_CONST(95557.782839479783/8.0),
+ REAL_CONST(95581.226130014256/8.0),
+ REAL_CONST(95604.670858125959/8.0),
+ REAL_CONST(95628.117023638595/8.0),
+ REAL_CONST(95651.564626375985/8.0),
+ REAL_CONST(95675.013666161918/8.0),
+ REAL_CONST(95698.464142820303/8.0),
+ REAL_CONST(95721.916056175076/8.0),
+ REAL_CONST(95745.369406050231/8.0),
+ REAL_CONST(95768.824192269807/8.0),
+ REAL_CONST(95792.280414657915/8.0),
+ REAL_CONST(95815.738073038709/8.0),
+ REAL_CONST(95839.197167236387/8.0),
+ REAL_CONST(95862.657697075221/8.0),
+ REAL_CONST(95886.11966237954/8.0),
+ REAL_CONST(95909.583062973688/8.0),
+ REAL_CONST(95933.047898682111/8.0),
+ REAL_CONST(95956.514169329268/8.0),
+ REAL_CONST(95979.981874739708/8.0),
+ REAL_CONST(96003.451014738006/8.0),
+ REAL_CONST(96026.921589148798/8.0),
+ REAL_CONST(96050.393597796792/8.0),
+ REAL_CONST(96073.867040506724/8.0),
+ REAL_CONST(96097.341917103375/8.0),
+ REAL_CONST(96120.818227411626/8.0),
+ REAL_CONST(96144.295971256375/8.0),
+ REAL_CONST(96167.775148462577/8.0),
+ REAL_CONST(96191.255758855244/8.0),
+ REAL_CONST(96214.737802259449/8.0),
+ REAL_CONST(96238.221278500292/8.0),
+ REAL_CONST(96261.70618740299/8.0),
+ REAL_CONST(96285.192528792715/8.0),
+ REAL_CONST(96308.680302494788/8.0),
+ REAL_CONST(96332.169508334526/8.0),
+ REAL_CONST(96355.660146137321/8.0),
+ REAL_CONST(96379.152215728609/8.0),
+ REAL_CONST(96402.645716933868/8.0),
+ REAL_CONST(96426.14064957868/8.0),
+ REAL_CONST(96449.637013488609/8.0),
+ REAL_CONST(96473.134808489311/8.0),
+ REAL_CONST(96496.63403440651/8.0),
+ REAL_CONST(96520.134691065963/8.0),
+ REAL_CONST(96543.636778293469/8.0),
+ REAL_CONST(96567.140295914898/8.0),
+ REAL_CONST(96590.645243756153/8.0),
+ REAL_CONST(96614.151621643221/8.0),
+ REAL_CONST(96637.659429402134/8.0),
+ REAL_CONST(96661.168666858954/8.0),
+ REAL_CONST(96684.679333839798/8.0),
+ REAL_CONST(96708.191430170875/8.0),
+ REAL_CONST(96731.70495567839/8.0),
+ REAL_CONST(96755.219910188665/8.0),
+ REAL_CONST(96778.736293528011/8.0),
+ REAL_CONST(96802.254105522836/8.0),
+ REAL_CONST(96825.77334599958/8.0),
+ REAL_CONST(96849.29401478474/8.0),
+ REAL_CONST(96872.816111704873/8.0),
+ REAL_CONST(96896.339636586577/8.0),
+ REAL_CONST(96919.864589256511/8.0),
+ REAL_CONST(96943.390969541389/8.0),
+ REAL_CONST(96966.918777267958/8.0),
+ REAL_CONST(96990.448012263048/8.0),
+ REAL_CONST(97013.978674353522/8.0),
+ REAL_CONST(97037.510763366285/8.0),
+ REAL_CONST(97061.044279128328/8.0),
+ REAL_CONST(97084.579221466673/8.0),
+ REAL_CONST(97108.115590208385/8.0),
+ REAL_CONST(97131.653385180587/8.0),
+ REAL_CONST(97155.19260621049/8.0),
+ REAL_CONST(97178.733253125291/8.0),
+ REAL_CONST(97202.2753257523/8.0),
+ REAL_CONST(97225.81882391886/8.0),
+ REAL_CONST(97249.363747452342/8.0),
+ REAL_CONST(97272.910096180189/8.0),
+ REAL_CONST(97296.457869929916/8.0),
+ REAL_CONST(97320.007068529041/8.0),
+ REAL_CONST(97343.557691805196/8.0),
+ REAL_CONST(97367.109739586012/8.0),
+ REAL_CONST(97390.663211699197/8.0),
+ REAL_CONST(97414.218107972498/8.0),
+ REAL_CONST(97437.774428233737/8.0),
+ REAL_CONST(97461.332172310766/8.0),
+ REAL_CONST(97484.891340031507/8.0),
+ REAL_CONST(97508.451931223899/8.0),
+ REAL_CONST(97532.013945715982/8.0),
+ REAL_CONST(97555.577383335811/8.0),
+ REAL_CONST(97579.142243911512/8.0),
+ REAL_CONST(97602.708527271257/8.0),
+ REAL_CONST(97626.276233243261/8.0),
+ REAL_CONST(97649.845361655811/8.0),
+ REAL_CONST(97673.415912337223/8.0),
+ REAL_CONST(97696.987885115886/8.0),
+ REAL_CONST(97720.561279820206/8.0),
+ REAL_CONST(97744.1360962787/8.0),
+ REAL_CONST(97767.712334319876/8.0),
+ REAL_CONST(97791.289993772341/8.0),
+ REAL_CONST(97814.869074464703/8.0),
+ REAL_CONST(97838.449576225685/8.0),
+ REAL_CONST(97862.031498883996/8.0),
+ REAL_CONST(97885.614842268449/8.0),
+ REAL_CONST(97909.199606207883/8.0),
+ REAL_CONST(97932.785790531183/8.0),
+ REAL_CONST(97956.37339506732/8.0),
+ REAL_CONST(97979.962419645264/8.0),
+ REAL_CONST(98003.552864094076/8.0),
+ REAL_CONST(98027.144728242856/8.0),
+ REAL_CONST(98050.738011920766/8.0),
+ REAL_CONST(98074.332714956996/8.0),
+ REAL_CONST(98097.928837180807/8.0),
+ REAL_CONST(98121.526378421506/8.0),
+ REAL_CONST(98145.125338508456/8.0),
+ REAL_CONST(98168.725717271067/8.0),
+ REAL_CONST(98192.327514538789/8.0),
+ REAL_CONST(98215.930730141132/8.0),
+ REAL_CONST(98239.535363907664/8.0),
+ REAL_CONST(98263.141415668011/8.0),
+ REAL_CONST(98286.748885251814/8.0),
+ REAL_CONST(98310.357772488816/8.0),
+ REAL_CONST(98333.968077208759/8.0),
+ REAL_CONST(98357.579799241488/8.0),
+ REAL_CONST(98381.192938416847/8.0),
+ REAL_CONST(98404.807494564782/8.0),
+ REAL_CONST(98428.42346751524/8.0),
+ REAL_CONST(98452.040857098269/8.0),
+ REAL_CONST(98475.659663143917/8.0),
+ REAL_CONST(98499.27988548232/8.0),
+ REAL_CONST(98522.901523943656/8.0),
+ REAL_CONST(98546.524578358163/8.0),
+ REAL_CONST(98570.149048556093/8.0),
+ REAL_CONST(98593.774934367786/8.0),
+ REAL_CONST(98617.402235623624/8.0),
+ REAL_CONST(98641.030952154048/8.0),
+ REAL_CONST(98664.661083789513/8.0),
+ REAL_CONST(98688.292630360564/8.0),
+ REAL_CONST(98711.925591697771/8.0),
+ REAL_CONST(98735.559967631794/8.0),
+ REAL_CONST(98759.195757993293/8.0),
+ REAL_CONST(98782.832962613014/8.0),
+ REAL_CONST(98806.471581321734/8.0),
+ REAL_CONST(98830.111613950285/8.0),
+ REAL_CONST(98853.753060329575/8.0),
+ REAL_CONST(98877.39592029051/8.0),
+ REAL_CONST(98901.040193664099/8.0),
+ REAL_CONST(98924.68588028138/8.0),
+ REAL_CONST(98948.33297997342/8.0),
+ REAL_CONST(98971.981492571387/8.0),
+ REAL_CONST(98995.63141790645/8.0),
+ REAL_CONST(99019.282755809851/8.0),
+ REAL_CONST(99042.935506112874/8.0),
+ REAL_CONST(99066.589668646877/8.0),
+ REAL_CONST(99090.245243243233/8.0),
+ REAL_CONST(99113.902229733401/8.0),
+ REAL_CONST(99137.560627948857/8.0),
+ REAL_CONST(99161.220437721131/8.0),
+ REAL_CONST(99184.881658881859/8.0),
+ REAL_CONST(99208.544291262631/8.0),
+ REAL_CONST(99232.208334695169/8.0),
+ REAL_CONST(99255.87378901121/8.0),
+ REAL_CONST(99279.540654042547/8.0),
+ REAL_CONST(99303.208929621018/8.0),
+ REAL_CONST(99326.878615578535/8.0),
+ REAL_CONST(99350.549711746993/8.0),
+ REAL_CONST(99374.222217958435/8.0),
+ REAL_CONST(99397.896134044888/8.0),
+ REAL_CONST(99421.571459838422/8.0),
+ REAL_CONST(99445.248195171211/8.0),
+ REAL_CONST(99468.926339875441/8.0),
+ REAL_CONST(99492.605893783344/8.0),
+ REAL_CONST(99516.286856727209/8.0),
+ REAL_CONST(99539.969228539398/8.0),
+ REAL_CONST(99563.653009052287/8.0),
+ REAL_CONST(99587.338198098325/8.0),
+ REAL_CONST(99611.024795510006/8.0),
+ REAL_CONST(99634.712801119866/8.0),
+ REAL_CONST(99658.402214760499/8.0),
+ REAL_CONST(99682.093036264545/8.0),
+ REAL_CONST(99705.785265464699/8.0),
+ REAL_CONST(99729.478902193689/8.0),
+ REAL_CONST(99753.173946284325/8.0),
+ REAL_CONST(99776.870397569437/8.0),
+ REAL_CONST(99800.56825588191/8.0),
+ REAL_CONST(99824.267521054688/8.0),
+ REAL_CONST(99847.968192920773/8.0),
+ REAL_CONST(99871.670271313182/8.0),
+ REAL_CONST(99895.373756065004/8.0),
+ REAL_CONST(99919.078647009388/8.0),
+ REAL_CONST(99942.78494397951/8.0),
+ REAL_CONST(99966.492646808634/8.0),
+ REAL_CONST(99990.20175533001/8.0),
+ REAL_CONST(100013.91226937699/8.0),
+ REAL_CONST(100037.62418878295/8.0),
+ REAL_CONST(100061.33751338134/8.0),
+ REAL_CONST(100085.05224300563/8.0),
+ REAL_CONST(100108.76837748935/8.0),
+ REAL_CONST(100132.4859166661/8.0),
+ REAL_CONST(100156.2048603695/8.0),
+ REAL_CONST(100179.92520843323/8.0),
+ REAL_CONST(100203.64696069101/8.0),
+ REAL_CONST(100227.37011697664/8.0),
+ REAL_CONST(100251.09467712394/8.0),
+ REAL_CONST(100274.82064096678/8.0),
+ REAL_CONST(100298.54800833909/8.0),
+ REAL_CONST(100322.27677907483/8.0),
+ REAL_CONST(100346.00695300807/8.0),
+ REAL_CONST(100369.73852997283/8.0),
+ REAL_CONST(100393.47150980328/8.0),
+ REAL_CONST(100417.20589233354/8.0),
+ REAL_CONST(100440.94167739789/8.0),
+ REAL_CONST(100464.67886483055/8.0),
+ REAL_CONST(100488.41745446586/8.0),
+ REAL_CONST(100512.1574461382/8.0),
+ REAL_CONST(100535.89883968196/8.0),
+ REAL_CONST(100559.64163493161/8.0),
+ REAL_CONST(100583.38583172169/8.0),
+ REAL_CONST(100607.13142988674/8.0),
+ REAL_CONST(100630.87842926137/8.0),
+ REAL_CONST(100654.62682968024/8.0),
+ REAL_CONST(100678.37663097809/8.0),
+ REAL_CONST(100702.12783298964/8.0),
+ REAL_CONST(100725.88043554971/8.0),
+ REAL_CONST(100749.63443849317/8.0),
+ REAL_CONST(100773.38984165489/8.0),
+ REAL_CONST(100797.14664486986/8.0),
+ REAL_CONST(100820.90484797307/8.0),
+ REAL_CONST(100844.66445079957/8.0),
+ REAL_CONST(100868.42545318443/8.0),
+ REAL_CONST(100892.18785496285/8.0),
+ REAL_CONST(100915.95165596998/8.0),
+ REAL_CONST(100939.71685604109/8.0),
+ REAL_CONST(100963.48345501146/8.0),
+ REAL_CONST(100987.25145271645/8.0),
+ REAL_CONST(101011.02084899142/8.0),
+ REAL_CONST(101034.79164367182/8.0),
+ REAL_CONST(101058.56383659317/8.0),
+ REAL_CONST(101082.33742759094/8.0),
+ REAL_CONST(101106.11241650078/8.0),
+ REAL_CONST(101129.88880315828/8.0),
+ REAL_CONST(101153.66658739912/8.0),
+ REAL_CONST(101177.44576905905/8.0),
+ REAL_CONST(101201.22634797383/8.0),
+ REAL_CONST(101225.00832397929/8.0),
+ REAL_CONST(101248.7916969113/8.0),
+ REAL_CONST(101272.57646660579/8.0),
+ REAL_CONST(101296.36263289873/8.0),
+ REAL_CONST(101320.15019562612/8.0),
+ REAL_CONST(101343.93915462404/8.0),
+ REAL_CONST(101367.7295097286/8.0),
+ REAL_CONST(101391.52126077596/8.0),
+ REAL_CONST(101415.31440760233/8.0),
+ REAL_CONST(101439.10895004397/8.0),
+ REAL_CONST(101462.9048879372/8.0),
+ REAL_CONST(101486.70222111834/8.0),
+ REAL_CONST(101510.50094942382/8.0),
+ REAL_CONST(101534.30107269008/8.0),
+ REAL_CONST(101558.10259075361/8.0),
+ REAL_CONST(101581.90550345098/8.0),
+ REAL_CONST(101605.70981061876/8.0),
+ REAL_CONST(101629.5155120936/8.0),
+ REAL_CONST(101653.32260771218/8.0),
+ REAL_CONST(101677.13109731126/8.0),
+ REAL_CONST(101700.9409807276/8.0),
+ REAL_CONST(101724.75225779804/8.0),
+ REAL_CONST(101748.56492835947/8.0),
+ REAL_CONST(101772.37899224881/8.0),
+ REAL_CONST(101796.19444930303/8.0),
+ REAL_CONST(101820.01129935916/8.0),
+ REAL_CONST(101843.82954225427/8.0),
+ REAL_CONST(101867.64917782549/8.0),
+ REAL_CONST(101891.47020590997/8.0),
+ REAL_CONST(101915.29262634492/8.0),
+ REAL_CONST(101939.11643896763/8.0),
+ REAL_CONST(101962.94164361537/8.0),
+ REAL_CONST(101986.76824012553/8.0),
+ REAL_CONST(102010.59622833549/8.0),
+ REAL_CONST(102034.42560808272/8.0),
+ REAL_CONST(102058.25637920471/8.0),
+ REAL_CONST(102082.08854153901/8.0),
+ REAL_CONST(102105.9220949232/8.0),
+ REAL_CONST(102129.75703919494/8.0),
+ REAL_CONST(102153.59337419191/8.0),
+ REAL_CONST(102177.43109975185/8.0),
+ REAL_CONST(102201.27021571253/8.0),
+ REAL_CONST(102225.1107219118/8.0),
+ REAL_CONST(102248.95261818753/8.0),
+ REAL_CONST(102272.79590437764/8.0),
+ REAL_CONST(102296.64058032009/8.0),
+ REAL_CONST(102320.48664585294/8.0),
+ REAL_CONST(102344.33410081422/8.0),
+ REAL_CONST(102368.18294504205/8.0),
+ REAL_CONST(102392.03317837461/8.0),
+ REAL_CONST(102415.88480065008/8.0),
+ REAL_CONST(102439.73781170673/8.0),
+ REAL_CONST(102463.59221138287/8.0),
+ REAL_CONST(102487.44799951684/8.0),
+ REAL_CONST(102511.30517594704/8.0),
+ REAL_CONST(102535.1637405119/8.0),
+ REAL_CONST(102559.02369304992/8.0),
+ REAL_CONST(102582.88503339965/8.0),
+ REAL_CONST(102606.74776139967/8.0),
+ REAL_CONST(102630.61187688859/8.0),
+ REAL_CONST(102654.4773797051/8.0),
+ REAL_CONST(102678.34426968795/8.0),
+ REAL_CONST(102702.21254667587/8.0),
+ REAL_CONST(102726.08221050771/8.0),
+ REAL_CONST(102749.95326102231/8.0),
+ REAL_CONST(102773.8256980586/8.0),
+ REAL_CONST(102797.69952145554/8.0),
+ REAL_CONST(102821.57473105213/8.0),
+ REAL_CONST(102845.45132668741/8.0),
+ REAL_CONST(102869.32930820051/8.0),
+ REAL_CONST(102893.20867543056/8.0),
+ REAL_CONST(102917.08942821674/8.0),
+ REAL_CONST(102940.97156639832/8.0),
+ REAL_CONST(102964.85508981455/8.0),
+ REAL_CONST(102988.73999830478/8.0),
+ REAL_CONST(103012.6262917084/8.0),
+ REAL_CONST(103036.51396986481/8.0),
+ REAL_CONST(103060.40303261351/8.0),
+ REAL_CONST(103084.293479794/8.0),
+ REAL_CONST(103108.18531124585/8.0),
+ REAL_CONST(103132.07852680866/8.0),
+ REAL_CONST(103155.97312632212/8.0),
+ REAL_CONST(103179.8691096259/8.0),
+ REAL_CONST(103203.76647655977/8.0),
+ REAL_CONST(103227.66522696352/8.0),
+ REAL_CONST(103251.56536067701/8.0),
+ REAL_CONST(103275.46687754011/8.0),
+ REAL_CONST(103299.36977739276/8.0),
+ REAL_CONST(103323.27406007495/8.0),
+ REAL_CONST(103347.1797254267/8.0),
+ REAL_CONST(103371.0867732881/8.0),
+ REAL_CONST(103394.99520349925/8.0),
+ REAL_CONST(103418.90501590034/8.0),
+ REAL_CONST(103442.81621033157/8.0),
+ REAL_CONST(103466.72878663319/8.0),
+ REAL_CONST(103490.64274464553/8.0),
+ REAL_CONST(103514.55808420894/8.0),
+ REAL_CONST(103538.4748051638/8.0),
+ REAL_CONST(103562.39290735057/8.0),
+ REAL_CONST(103586.31239060973/8.0),
+ REAL_CONST(103610.23325478184/8.0),
+ REAL_CONST(103634.15549970744/8.0),
+ REAL_CONST(103658.07912522719/8.0),
+ REAL_CONST(103682.00413118176/8.0),
+ REAL_CONST(103705.93051741188/8.0),
+ REAL_CONST(103729.85828375829/8.0),
+ REAL_CONST(103753.78743006183/8.0),
+ REAL_CONST(103777.71795616332/8.0),
+ REAL_CONST(103801.64986190372/8.0),
+ REAL_CONST(103825.58314712394/8.0),
+ REAL_CONST(103849.51781166498/8.0),
+ REAL_CONST(103873.4538553679/8.0),
+ REAL_CONST(103897.39127807376/8.0),
+ REAL_CONST(103921.33007962372/8.0),
+ REAL_CONST(103945.27025985894/8.0),
+ REAL_CONST(103969.21181862066/8.0),
+ REAL_CONST(103993.15475575015/8.0),
+ REAL_CONST(104017.0990710887/8.0),
+ REAL_CONST(104041.0447644777/8.0),
+ REAL_CONST(104064.99183575854/8.0),
+ REAL_CONST(104088.94028477269/8.0),
+ REAL_CONST(104112.89011136163/8.0),
+ REAL_CONST(104136.84131536692/8.0),
+ REAL_CONST(104160.79389663014/8.0),
+ REAL_CONST(104184.74785499295/8.0),
+ REAL_CONST(104208.70319029699/8.0),
+ REAL_CONST(104232.65990238401/8.0),
+ REAL_CONST(104256.61799109577/8.0),
+ REAL_CONST(104280.57745627411/8.0),
+ REAL_CONST(104304.53829776087/8.0),
+ REAL_CONST(104328.50051539797/8.0),
+ REAL_CONST(104352.46410902737/8.0),
+ REAL_CONST(104376.42907849104/8.0),
+ REAL_CONST(104400.39542363105/8.0),
+ REAL_CONST(104424.36314428948/8.0),
+ REAL_CONST(104448.33224030846/8.0),
+ REAL_CONST(104472.3027115302/8.0),
+ REAL_CONST(104496.27455779689/8.0),
+ REAL_CONST(104520.24777895081/8.0),
+ REAL_CONST(104544.22237483428/8.0),
+ REAL_CONST(104568.19834528965/8.0),
+ REAL_CONST(104592.17569015936/8.0),
+ REAL_CONST(104616.15440928582/8.0),
+ REAL_CONST(104640.13450251156/8.0),
+ REAL_CONST(104664.1159696791/8.0),
+ REAL_CONST(104688.09881063103/8.0),
+ REAL_CONST(104712.08302520998/8.0),
+ REAL_CONST(104736.06861325864/8.0),
+ REAL_CONST(104760.05557461972/8.0),
+ REAL_CONST(104784.043909136/8.0),
+ REAL_CONST(104808.03361665027/8.0),
+ REAL_CONST(104832.0246970054/8.0),
+ REAL_CONST(104856.01715004431/8.0),
+ REAL_CONST(104880.01097560991/8.0),
+ REAL_CONST(104904.00617354522/8.0),
+ REAL_CONST(104928.00274369326/8.0),
+ REAL_CONST(104952.00068589712/8.0),
+ REAL_CONST(104975.99999999993/8.0),
+ REAL_CONST(105000.00068584486/8.0),
+ REAL_CONST(105024.00274327511/8.0),
+ REAL_CONST(105048.00617213396/8.0),
+ REAL_CONST(105072.0109722647/8.0),
+ REAL_CONST(105096.0171435107/8.0),
+ REAL_CONST(105120.02468571534/8.0),
+ REAL_CONST(105144.03359872208/8.0),
+ REAL_CONST(105168.04388237436/8.0),
+ REAL_CONST(105192.05553651576/8.0),
+ REAL_CONST(105216.06856098982/8.0),
+ REAL_CONST(105240.08295564017/8.0),
+ REAL_CONST(105264.09872031047/8.0),
+ REAL_CONST(105288.11585484444/8.0),
+ REAL_CONST(105312.13435908582/8.0),
+ REAL_CONST(105336.1542328784/8.0),
+ REAL_CONST(105360.17547606604/8.0),
+ REAL_CONST(105384.19808849262/8.0),
+ REAL_CONST(105408.22207000206/8.0),
+ REAL_CONST(105432.24742043833/8.0),
+ REAL_CONST(105456.27413964548/8.0),
+ REAL_CONST(105480.30222746753/8.0),
+ REAL_CONST(105504.33168374863/8.0),
+ REAL_CONST(105528.36250833291/8.0),
+ REAL_CONST(105552.39470106458/8.0),
+ REAL_CONST(105576.42826178786/8.0),
+ REAL_CONST(105600.46319034706/8.0),
+ REAL_CONST(105624.49948658649/8.0),
+ REAL_CONST(105648.53715035053/8.0),
+ REAL_CONST(105672.5761814836/8.0),
+ REAL_CONST(105696.61657983017/8.0),
+ REAL_CONST(105720.65834523473/8.0),
+ REAL_CONST(105744.70147754184/8.0),
+ REAL_CONST(105768.7459765961/8.0),
+ REAL_CONST(105792.79184224214/8.0),
+ REAL_CONST(105816.83907432464/8.0),
+ REAL_CONST(105840.88767268835/8.0),
+ REAL_CONST(105864.93763717801/8.0),
+ REAL_CONST(105888.98896763846/8.0),
+ REAL_CONST(105913.04166391456/8.0),
+ REAL_CONST(105937.09572585119/8.0),
+ REAL_CONST(105961.15115329332/8.0),
+ REAL_CONST(105985.20794608595/8.0),
+ REAL_CONST(106009.26610407409/8.0),
+ REAL_CONST(106033.32562710284/8.0),
+ REAL_CONST(106057.38651501729/8.0),
+ REAL_CONST(106081.44876766266/8.0),
+ REAL_CONST(106105.51238488412/8.0),
+ REAL_CONST(106129.57736652695/8.0),
+ REAL_CONST(106153.64371243643/8.0),
+ REAL_CONST(106177.71142245791/8.0),
+ REAL_CONST(106201.78049643678/8.0),
+ REAL_CONST(106225.85093421848/8.0),
+ REAL_CONST(106249.92273564848/8.0),
+ REAL_CONST(106273.99590057228/8.0),
+ REAL_CONST(106298.07042883546/8.0),
+ REAL_CONST(106322.14632028362/8.0),
+ REAL_CONST(106346.22357476239/8.0),
+ REAL_CONST(106370.30219211751/8.0),
+ REAL_CONST(106394.38217219469/8.0),
+ REAL_CONST(106418.46351483969/8.0),
+ REAL_CONST(106442.54621989837/8.0),
+ REAL_CONST(106466.63028721658/8.0),
+ REAL_CONST(106490.71571664025/8.0),
+ REAL_CONST(106514.80250801529/8.0),
+ REAL_CONST(106538.89066118775/8.0),
+ REAL_CONST(106562.98017600364/8.0),
+ REAL_CONST(106587.07105230905/8.0),
+ REAL_CONST(106611.16328995011/8.0),
+ REAL_CONST(106635.25688877302/8.0),
+ REAL_CONST(106659.35184862395/8.0),
+ REAL_CONST(106683.44816934918/8.0),
+ REAL_CONST(106707.54585079502/8.0),
+ REAL_CONST(106731.64489280782/8.0),
+ REAL_CONST(106755.74529523395/8.0),
+ REAL_CONST(106779.84705791986/8.0),
+ REAL_CONST(106803.95018071201/8.0),
+ REAL_CONST(106828.05466345693/8.0),
+ REAL_CONST(106852.16050600118/8.0),
+ REAL_CONST(106876.26770819137/8.0),
+ REAL_CONST(106900.37626987413/8.0),
+ REAL_CONST(106924.48619089619/8.0),
+ REAL_CONST(106948.59747110425/8.0),
+ REAL_CONST(106972.71011034511/8.0),
+ REAL_CONST(106996.82410846559/8.0),
+ REAL_CONST(107020.93946531253/8.0),
+ REAL_CONST(107045.05618073288/8.0),
+ REAL_CONST(107069.17425457356/8.0),
+ REAL_CONST(107093.29368668159/8.0),
+ REAL_CONST(107117.41447690397/8.0),
+ REAL_CONST(107141.53662508781/8.0),
+ REAL_CONST(107165.66013108024/8.0),
+ REAL_CONST(107189.7849947284/8.0),
+ REAL_CONST(107213.91121587952/8.0),
+ REAL_CONST(107238.03879438085/8.0),
+ REAL_CONST(107262.16773007967/8.0),
+ REAL_CONST(107286.29802282334/8.0),
+ REAL_CONST(107310.42967245923/8.0),
+ REAL_CONST(107334.56267883476/8.0),
+ REAL_CONST(107358.69704179741/8.0),
+ REAL_CONST(107382.83276119467/8.0),
+ REAL_CONST(107406.96983687414/8.0),
+ REAL_CONST(107431.10826868335/8.0),
+ REAL_CONST(107455.24805646999/8.0),
+ REAL_CONST(107479.38920008171/8.0),
+ REAL_CONST(107503.53169936626/8.0),
+ REAL_CONST(107527.67555417139/8.0),
+ REAL_CONST(107551.82076434491/8.0),
+ REAL_CONST(107575.96732973469/8.0),
+ REAL_CONST(107600.11525018861/8.0),
+ REAL_CONST(107624.26452555459/8.0),
+ REAL_CONST(107648.41515568066/8.0),
+ REAL_CONST(107672.56714041479/8.0),
+ REAL_CONST(107696.72047960508/8.0),
+ REAL_CONST(107720.87517309963/8.0),
+ REAL_CONST(107745.03122074658/8.0),
+ REAL_CONST(107769.18862239413/8.0),
+ REAL_CONST(107793.34737789053/8.0),
+ REAL_CONST(107817.50748708403/8.0),
+ REAL_CONST(107841.66894982298/8.0),
+ REAL_CONST(107865.83176595572/8.0),
+ REAL_CONST(107889.99593533068/8.0),
+ REAL_CONST(107914.16145779629/8.0),
+ REAL_CONST(107938.32833320105/8.0),
+ REAL_CONST(107962.49656139348/8.0),
+ REAL_CONST(107986.66614222217/8.0),
+ REAL_CONST(108010.83707553572/8.0),
+ REAL_CONST(108035.00936118282/8.0),
+ REAL_CONST(108059.18299901215/8.0),
+ REAL_CONST(108083.35798887245/8.0),
+ REAL_CONST(108107.53433061253/8.0),
+ REAL_CONST(108131.71202408121/8.0),
+ REAL_CONST(108155.89106912735/8.0),
+ REAL_CONST(108180.07146559987/8.0),
+ REAL_CONST(108204.25321334775/8.0),
+ REAL_CONST(108228.43631221994/8.0),
+ REAL_CONST(108252.62076206553/8.0),
+ REAL_CONST(108276.80656273357/8.0),
+ REAL_CONST(108300.99371407321/8.0),
+ REAL_CONST(108325.18221593359/8.0),
+ REAL_CONST(108349.37206816394/8.0),
+ REAL_CONST(108373.56327061349/8.0),
+ REAL_CONST(108397.75582313156/8.0),
+ REAL_CONST(108421.94972556747/8.0),
+ REAL_CONST(108446.1449777706/8.0),
+ REAL_CONST(108470.34157959036/8.0),
+ REAL_CONST(108494.53953087622/8.0),
+ REAL_CONST(108518.73883147769/8.0),
+ REAL_CONST(108542.93948124432/8.0),
+ REAL_CONST(108567.14148002568/8.0),
+ REAL_CONST(108591.34482767139/8.0),
+ REAL_CONST(108615.54952403114/8.0),
+ REAL_CONST(108639.75556895464/8.0),
+ REAL_CONST(108663.96296229165/8.0),
+ REAL_CONST(108688.17170389196/8.0),
+ REAL_CONST(108712.38179360541/8.0),
+ REAL_CONST(108736.59323128188/8.0),
+ REAL_CONST(108760.80601677128/8.0),
+ REAL_CONST(108785.02014992358/8.0),
+ REAL_CONST(108809.23563058881/8.0),
+ REAL_CONST(108833.45245861699/8.0),
+ REAL_CONST(108857.67063385822/8.0),
+ REAL_CONST(108881.89015616261/8.0),
+ REAL_CONST(108906.11102538036/8.0),
+ REAL_CONST(108930.33324136167/8.0),
+ REAL_CONST(108954.55680395682/8.0),
+ REAL_CONST(108978.78171301607/8.0),
+ REAL_CONST(109003.00796838976/8.0),
+ REAL_CONST(109027.23556992831/8.0),
+ REAL_CONST(109051.46451748211/8.0),
+ REAL_CONST(109075.69481090162/8.0),
+ REAL_CONST(109099.92645003737/8.0),
+ REAL_CONST(109124.15943473989/8.0),
+ REAL_CONST(109148.39376485976/8.0),
+ REAL_CONST(109172.62944024763/8.0),
+ REAL_CONST(109196.86646075416/8.0),
+ REAL_CONST(109221.10482623006/8.0),
+ REAL_CONST(109245.34453652608/8.0),
+ REAL_CONST(109269.58559149304/8.0),
+ REAL_CONST(109293.82799098175/8.0),
+ REAL_CONST(109318.07173484311/8.0),
+ REAL_CONST(109342.31682292801/8.0),
+ REAL_CONST(109366.56325508743/8.0),
+ REAL_CONST(109390.81103117237/8.0),
+ REAL_CONST(109415.06015103387/8.0),
+ REAL_CONST(109439.31061452301/8.0),
+ REAL_CONST(109463.56242149093/8.0),
+ REAL_CONST(109487.8155717888/8.0),
+ REAL_CONST(109512.07006526781/8.0),
+ REAL_CONST(109536.3259017792/8.0),
+ REAL_CONST(109560.58308117429/8.0),
+ REAL_CONST(109584.8416033044/8.0),
+ REAL_CONST(109609.1014680209/8.0),
+ REAL_CONST(109633.36267517522/8.0),
+ REAL_CONST(109657.62522461878/8.0),
+ REAL_CONST(109681.88911620311/8.0),
+ REAL_CONST(109706.15434977971/8.0),
+ REAL_CONST(109730.4209252002/8.0),
+ REAL_CONST(109754.68884231619/8.0),
+ REAL_CONST(109778.95810097932/8.0),
+ REAL_CONST(109803.22870104131/8.0),
+ REAL_CONST(109827.50064235389/8.0),
+ REAL_CONST(109851.77392476884/8.0),
+ REAL_CONST(109876.04854813802/8.0),
+ REAL_CONST(109900.32451231324/8.0),
+ REAL_CONST(109924.60181714644/8.0),
+ REAL_CONST(109948.88046248957/8.0),
+ REAL_CONST(109973.1604481946/8.0),
+ REAL_CONST(109997.44177411357/8.0),
+ REAL_CONST(110021.72444009855/8.0),
+ REAL_CONST(110046.00844600165/8.0),
+ REAL_CONST(110070.29379167501/8.0),
+ REAL_CONST(110094.58047697082/8.0),
+ REAL_CONST(110118.86850174134/8.0),
+ REAL_CONST(110143.15786583882/8.0),
+ REAL_CONST(110167.44856911557/8.0),
+ REAL_CONST(110191.74061142397/8.0),
+ REAL_CONST(110216.03399261639/8.0),
+ REAL_CONST(110240.32871254528/8.0),
+ REAL_CONST(110264.62477106311/8.0),
+ REAL_CONST(110288.9221680224/8.0),
+ REAL_CONST(110313.22090327571/8.0),
+ REAL_CONST(110337.52097667565/8.0),
+ REAL_CONST(110361.82238807483/8.0),
+ REAL_CONST(110386.12513732594/8.0),
+ REAL_CONST(110410.42922428172/8.0),
+ REAL_CONST(110434.73464879491/8.0),
+ REAL_CONST(110459.04141071832/8.0),
+ REAL_CONST(110483.34950990479/8.0),
+ REAL_CONST(110507.6589462072/8.0),
+ REAL_CONST(110531.96971947847/8.0),
+ REAL_CONST(110556.28182957157/8.0),
+ REAL_CONST(110580.5952763395/8.0),
+ REAL_CONST(110604.91005963532/8.0),
+ REAL_CONST(110629.22617931209/8.0),
+ REAL_CONST(110653.54363522294/8.0),
+ REAL_CONST(110677.86242722106/8.0),
+ REAL_CONST(110702.18255515963/8.0),
+ REAL_CONST(110726.50401889188/8.0),
+ REAL_CONST(110750.82681827113/8.0),
+ REAL_CONST(110775.1509531507/8.0),
+ REAL_CONST(110799.47642338395/8.0),
+ REAL_CONST(110823.80322882428/8.0),
+ REAL_CONST(110848.13136932514/8.0),
+ REAL_CONST(110872.46084474004/8.0),
+ REAL_CONST(110896.79165492248/8.0),
+ REAL_CONST(110921.12379972603/8.0),
+ REAL_CONST(110945.4572790043/8.0),
+ REAL_CONST(110969.79209261097/8.0),
+ REAL_CONST(110994.12824039967/8.0),
+ REAL_CONST(111018.46572222417/8.0),
+ REAL_CONST(111042.80453793822/8.0),
+ REAL_CONST(111067.14468739564/8.0),
+ REAL_CONST(111091.48617045028/8.0),
+ REAL_CONST(111115.82898695602/8.0),
+ REAL_CONST(111140.1731367668/8.0),
+ REAL_CONST(111164.51861973655/8.0),
+ REAL_CONST(111188.86543571933/8.0),
+ REAL_CONST(111213.21358456917/8.0),
+ REAL_CONST(111237.56306614014/8.0),
+ REAL_CONST(111261.91388028639/8.0),
+ REAL_CONST(111286.26602686207/8.0),
+ REAL_CONST(111310.61950572141/8.0),
+ REAL_CONST(111334.97431671864/8.0),
+ REAL_CONST(111359.33045970804/8.0),
+ REAL_CONST(111383.68793454397/8.0),
+ REAL_CONST(111408.04674108078/8.0),
+ REAL_CONST(111432.40687917286/8.0),
+ REAL_CONST(111456.76834867468/8.0),
+ REAL_CONST(111481.13114944073/8.0),
+ REAL_CONST(111505.49528132551/8.0),
+ REAL_CONST(111529.86074418361/8.0),
+ REAL_CONST(111554.22753786964/8.0),
+ REAL_CONST(111578.59566223821/8.0),
+ REAL_CONST(111602.96511714405/8.0),
+ REAL_CONST(111627.33590244185/8.0),
+ REAL_CONST(111651.7080179864/8.0),
+ REAL_CONST(111676.08146363248/8.0),
+ REAL_CONST(111700.45623923496/8.0),
+ REAL_CONST(111724.8323446487/8.0),
+ REAL_CONST(111749.20977972864/8.0),
+ REAL_CONST(111773.58854432974/8.0),
+ REAL_CONST(111797.96863830699/8.0),
+ REAL_CONST(111822.35006151545/8.0),
+ REAL_CONST(111846.73281381019/8.0),
+ REAL_CONST(111871.11689504632/8.0),
+ REAL_CONST(111895.50230507903/8.0),
+ REAL_CONST(111919.8890437635/8.0),
+ REAL_CONST(111944.27711095495/8.0),
+ REAL_CONST(111968.6665065087/8.0),
+ REAL_CONST(111993.05723028004/8.0),
+ REAL_CONST(112017.44928212435/8.0),
+ REAL_CONST(112041.842661897/8.0),
+ REAL_CONST(112066.23736945343/8.0),
+ REAL_CONST(112090.63340464912/8.0),
+ REAL_CONST(112115.03076733962/8.0),
+ REAL_CONST(112139.42945738042/8.0),
+ REAL_CONST(112163.82947462716/8.0),
+ REAL_CONST(112188.23081893545/8.0),
+ REAL_CONST(112212.63349016097/8.0),
+ REAL_CONST(112237.03748815943/8.0),
+ REAL_CONST(112261.44281278658/8.0),
+ REAL_CONST(112285.84946389822/8.0),
+ REAL_CONST(112310.25744135017/8.0),
+ REAL_CONST(112334.66674499828/8.0),
+ REAL_CONST(112359.07737469849/8.0),
+ REAL_CONST(112383.48933030672/8.0),
+ REAL_CONST(112407.90261167898/8.0),
+ REAL_CONST(112432.31721867126/8.0),
+ REAL_CONST(112456.73315113965/8.0),
+ REAL_CONST(112481.15040894024/8.0),
+ REAL_CONST(112505.56899192919/8.0),
+ REAL_CONST(112529.98889996267/8.0),
+ REAL_CONST(112554.41013289688/8.0),
+ REAL_CONST(112578.8326905881/8.0),
+ REAL_CONST(112603.25657289263/8.0),
+ REAL_CONST(112627.68177966679/8.0),
+ REAL_CONST(112652.10831076698/8.0),
+ REAL_CONST(112676.53616604958/8.0),
+ REAL_CONST(112700.96534537108/8.0),
+ REAL_CONST(112725.39584858794/8.0),
+ REAL_CONST(112749.82767555672/8.0),
+ REAL_CONST(112774.26082613398/8.0),
+ REAL_CONST(112798.6953001763/8.0),
+ REAL_CONST(112823.13109754038/8.0),
+ REAL_CONST(112847.56821808286/8.0),
+ REAL_CONST(112872.00666166049/8.0),
+ REAL_CONST(112896.44642813003/8.0),
+ REAL_CONST(112920.88751734827/8.0),
+ REAL_CONST(112945.32992917208/8.0),
+ REAL_CONST(112969.77366345831/8.0),
+ REAL_CONST(112994.21872006389/8.0),
+ REAL_CONST(113018.66509884578/8.0),
+ REAL_CONST(113043.11279966099/8.0),
+ REAL_CONST(113067.56182236652/8.0),
+ REAL_CONST(113092.01216681948/8.0),
+ REAL_CONST(113116.46383287695/8.0),
+ REAL_CONST(113140.9168203961/8.0),
+ REAL_CONST(113165.37112923413/8.0),
+ REAL_CONST(113189.82675924824/8.0),
+ REAL_CONST(113214.28371029573/8.0),
+ REAL_CONST(113238.74198223387/8.0),
+ REAL_CONST(113263.20157492002/8.0),
+ REAL_CONST(113287.66248821157/8.0),
+ REAL_CONST(113312.12472196593/8.0),
+ REAL_CONST(113336.58827604055/8.0),
+ REAL_CONST(113361.05315029295/8.0),
+ REAL_CONST(113385.51934458067/8.0),
+ REAL_CONST(113409.98685876124/8.0),
+ REAL_CONST(113434.45569269233/8.0),
+ REAL_CONST(113458.92584623155/8.0),
+ REAL_CONST(113483.39731923661/8.0),
+ REAL_CONST(113507.87011156522/8.0),
+ REAL_CONST(113532.34422307517/8.0),
+ REAL_CONST(113556.81965362425/8.0),
+ REAL_CONST(113581.2964030703/8.0),
+ REAL_CONST(113605.77447127122/8.0),
+ REAL_CONST(113630.25385808491/8.0),
+ REAL_CONST(113654.73456336933/8.0),
+ REAL_CONST(113679.2165869825/8.0),
+ REAL_CONST(113703.69992878241/8.0),
+ REAL_CONST(113728.18458862718/8.0),
+ REAL_CONST(113752.67056637487/8.0),
+ REAL_CONST(113777.15786188368/8.0),
+ REAL_CONST(113801.64647501177/8.0),
+ REAL_CONST(113826.13640561736/8.0),
+ REAL_CONST(113850.62765355874/8.0),
+ REAL_CONST(113875.12021869418/8.0),
+ REAL_CONST(113899.61410088204/8.0),
+ REAL_CONST(113924.1092999807/8.0),
+ REAL_CONST(113948.60581584855/8.0),
+ REAL_CONST(113973.10364834407/8.0),
+ REAL_CONST(113997.60279732574/8.0),
+ REAL_CONST(114022.1032626521/8.0),
+ REAL_CONST(114046.60504418171/8.0),
+ REAL_CONST(114071.10814177318/8.0),
+ REAL_CONST(114095.61255528514/8.0),
+ REAL_CONST(114120.11828457628/8.0),
+ REAL_CONST(114144.62532950533/8.0),
+ REAL_CONST(114169.13368993104/8.0),
+ REAL_CONST(114193.6433657122/8.0),
+ REAL_CONST(114218.15435670764/8.0),
+ REAL_CONST(114242.66666277625/8.0),
+ REAL_CONST(114267.18028377694/8.0),
+ REAL_CONST(114291.69521956862/8.0),
+ REAL_CONST(114316.21147001031/8.0),
+ REAL_CONST(114340.72903496103/8.0),
+ REAL_CONST(114365.24791427983/8.0),
+ REAL_CONST(114389.7681078258/8.0),
+ REAL_CONST(114414.2896154581/8.0),
+ REAL_CONST(114438.81243703589/8.0),
+ REAL_CONST(114463.33657241837/8.0),
+ REAL_CONST(114487.8620214648/8.0),
+ REAL_CONST(114512.38878403447/8.0),
+ REAL_CONST(114536.91685998671/8.0),
+ REAL_CONST(114561.44624918087/8.0),
+ REAL_CONST(114585.97695147636/8.0),
+ REAL_CONST(114610.5089667326/8.0),
+ REAL_CONST(114635.04229480909/8.0),
+ REAL_CONST(114659.57693556532/8.0),
+ REAL_CONST(114684.11288886084/8.0),
+ REAL_CONST(114708.65015455526/8.0),
+ REAL_CONST(114733.18873250818/8.0),
+ REAL_CONST(114757.72862257928/8.0),
+ REAL_CONST(114782.26982462825/8.0),
+ REAL_CONST(114806.81233851484/8.0),
+ REAL_CONST(114831.35616409882/8.0),
+ REAL_CONST(114855.90130123998/8.0),
+ REAL_CONST(114880.44774979822/8.0),
+ REAL_CONST(114904.99550963337/8.0),
+ REAL_CONST(114929.5445806054/8.0),
+ REAL_CONST(114954.09496257425/8.0),
+ REAL_CONST(114978.64665539992/8.0),
+ REAL_CONST(115003.19965894247/8.0),
+ REAL_CONST(115027.75397306195/8.0),
+ REAL_CONST(115052.30959761847/8.0),
+ REAL_CONST(115076.86653247218/8.0),
+ REAL_CONST(115101.42477748329/8.0),
+ REAL_CONST(115125.984332512/8.0),
+ REAL_CONST(115150.54519741859/8.0),
+ REAL_CONST(115175.10737206334/8.0),
+ REAL_CONST(115199.67085630659/8.0),
+ REAL_CONST(115224.23565000873/8.0),
+ REAL_CONST(115248.80175303014/8.0),
+ REAL_CONST(115273.3691652313/8.0),
+ REAL_CONST(115297.93788647266/8.0),
+ REAL_CONST(115322.50791661476/8.0),
+ REAL_CONST(115347.07925551817/8.0),
+ REAL_CONST(115371.65190304347/8.0),
+ REAL_CONST(115396.22585905129/8.0),
+ REAL_CONST(115420.80112340231/8.0),
+ REAL_CONST(115445.37769595724/8.0),
+ REAL_CONST(115469.95557657682/8.0),
+ REAL_CONST(115494.53476512182/8.0),
+ REAL_CONST(115519.11526145306/8.0),
+ REAL_CONST(115543.69706543141/8.0),
+ REAL_CONST(115568.28017691776/8.0),
+ REAL_CONST(115592.86459577303/8.0),
+ REAL_CONST(115617.4503218582/8.0),
+ REAL_CONST(115642.03735503425/8.0),
+ REAL_CONST(115666.62569516223/8.0),
+ REAL_CONST(115691.21534210323/8.0),
+ REAL_CONST(115715.80629571836/8.0),
+ REAL_CONST(115740.39855586876/8.0),
+ REAL_CONST(115764.99212241563/8.0),
+ REAL_CONST(115789.58699522018/8.0),
+ REAL_CONST(115814.18317414368/8.0),
+ REAL_CONST(115838.78065904744/8.0),
+ REAL_CONST(115863.37944979276/8.0),
+ REAL_CONST(115887.97954624105/8.0),
+ REAL_CONST(115912.5809482537/8.0),
+ REAL_CONST(115937.18365569216/8.0),
+ REAL_CONST(115961.78766841792/8.0),
+ REAL_CONST(115986.39298629249/8.0),
+ REAL_CONST(116010.99960917742/8.0),
+ REAL_CONST(116035.60753693432/8.0),
+ REAL_CONST(116060.21676942479/8.0),
+ REAL_CONST(116084.82730651053/8.0),
+ REAL_CONST(116109.43914805322/8.0),
+ REAL_CONST(116134.0522939146/8.0),
+ REAL_CONST(116158.66674395646/8.0),
+ REAL_CONST(116183.2824980406/8.0),
+ REAL_CONST(116207.89955602887/8.0),
+ REAL_CONST(116232.51791778316/8.0),
+ REAL_CONST(116257.13758316539/8.0),
+ REAL_CONST(116281.75855203751/8.0),
+ REAL_CONST(116306.38082426153/8.0),
+ REAL_CONST(116331.00439969949/8.0),
+ REAL_CONST(116355.62927821343/8.0),
+ REAL_CONST(116380.25545966547/8.0),
+ REAL_CONST(116404.88294391775/8.0),
+ REAL_CONST(116429.51173083246/8.0),
+ REAL_CONST(116454.14182027178/8.0),
+ REAL_CONST(116478.77321209799/8.0),
+ REAL_CONST(116503.40590617337/8.0),
+ REAL_CONST(116528.03990236025/8.0),
+ REAL_CONST(116552.67520052097/8.0),
+ REAL_CONST(116577.31180051794/8.0),
+ REAL_CONST(116601.94970221359/8.0),
+ REAL_CONST(116626.5889054704/8.0),
+ REAL_CONST(116651.22941015086/8.0),
+ REAL_CONST(116675.87121611751/8.0),
+ REAL_CONST(116700.51432323294/8.0),
+ REAL_CONST(116725.15873135976/8.0),
+ REAL_CONST(116749.8044403606/8.0),
+ REAL_CONST(116774.45145009817/8.0),
+ REAL_CONST(116799.0997604352/8.0),
+ REAL_CONST(116823.74937123443/8.0),
+ REAL_CONST(116848.40028235866/8.0),
+ REAL_CONST(116873.05249367072/8.0),
+ REAL_CONST(116897.70600503348/8.0),
+ REAL_CONST(116922.36081630984/8.0),
+ REAL_CONST(116947.01692736275/8.0),
+ REAL_CONST(116971.67433805518/8.0),
+ REAL_CONST(116996.33304825013/8.0),
+ REAL_CONST(117020.99305781067/8.0),
+ REAL_CONST(117045.65436659988/8.0),
+ REAL_CONST(117070.31697448085/8.0),
+ REAL_CONST(117094.98088131678/8.0),
+ REAL_CONST(117119.64608697082/8.0),
+ REAL_CONST(117144.31259130624/8.0),
+ REAL_CONST(117168.98039418629/8.0),
+ REAL_CONST(117193.64949547425/8.0),
+ REAL_CONST(117218.31989503348/8.0),
+ REAL_CONST(117242.99159272734/8.0),
+ REAL_CONST(117267.66458841923/8.0),
+ REAL_CONST(117292.33888197262/8.0),
+ REAL_CONST(117317.01447325097/8.0),
+ REAL_CONST(117341.6913621178/8.0),
+ REAL_CONST(117366.36954843666/8.0),
+ REAL_CONST(117391.04903207115/8.0),
+ REAL_CONST(117415.72981288488/8.0),
+ REAL_CONST(117440.41189074152/8.0),
+ REAL_CONST(117465.09526550474/8.0),
+ REAL_CONST(117489.77993703831/8.0),
+ REAL_CONST(117514.46590520597/8.0),
+ REAL_CONST(117539.15316987153/8.0),
+ REAL_CONST(117563.84173089883/8.0),
+ REAL_CONST(117588.53158815173/8.0),
+ REAL_CONST(117613.22274149416/8.0),
+ REAL_CONST(117637.91519079007/8.0),
+ REAL_CONST(117662.60893590341/8.0),
+ REAL_CONST(117687.30397669821/8.0),
+ REAL_CONST(117712.00031303853/8.0),
+ REAL_CONST(117736.69794478847/8.0),
+ REAL_CONST(117761.39687181212/8.0),
+ REAL_CONST(117786.09709397367/8.0),
+ REAL_CONST(117810.7986111373/8.0),
+ REAL_CONST(117835.50142316725/8.0),
+ REAL_CONST(117860.20552992777/8.0),
+ REAL_CONST(117884.91093128319/8.0),
+ REAL_CONST(117909.6176270978/8.0),
+ REAL_CONST(117934.32561723603/8.0),
+ REAL_CONST(117959.03490156225/8.0),
+ REAL_CONST(117983.74547994092/8.0),
+ REAL_CONST(118008.45735223651/8.0),
+ REAL_CONST(118033.17051831353/8.0),
+ REAL_CONST(118057.88497803656/8.0),
+ REAL_CONST(118082.60073127014/8.0),
+ REAL_CONST(118107.31777787894/8.0),
+ REAL_CONST(118132.03611772758/8.0),
+ REAL_CONST(118156.75575068076/8.0),
+ REAL_CONST(118181.47667660323/8.0),
+ REAL_CONST(118206.19889535972/8.0),
+ REAL_CONST(118230.92240681504/8.0),
+ REAL_CONST(118255.64721083404/8.0),
+ REAL_CONST(118280.37330728157/8.0),
+ REAL_CONST(118305.10069602253/8.0),
+ REAL_CONST(118329.82937692189/8.0),
+ REAL_CONST(118354.55934984458/8.0),
+ REAL_CONST(118379.29061465565/8.0),
+ REAL_CONST(118404.02317122012/8.0),
+ REAL_CONST(118428.75701940308/8.0),
+ REAL_CONST(118453.49215906965/8.0),
+ REAL_CONST(118478.22859008498/8.0),
+ REAL_CONST(118502.96631231424/8.0),
+ REAL_CONST(118527.70532562268/8.0),
+ REAL_CONST(118552.44562987552/8.0),
+ REAL_CONST(118577.18722493808/8.0),
+ REAL_CONST(118601.93011067568/8.0),
+ REAL_CONST(118626.67428695368/8.0),
+ REAL_CONST(118651.41975363747/8.0),
+ REAL_CONST(118676.16651059251/8.0),
+ REAL_CONST(118700.91455768423/8.0),
+ REAL_CONST(118725.66389477813/8.0),
+ REAL_CONST(118750.41452173979/8.0),
+ REAL_CONST(118775.16643843475/8.0),
+ REAL_CONST(118799.91964472862/8.0),
+ REAL_CONST(118824.67414048707/8.0),
+ REAL_CONST(118849.42992557574/8.0),
+ REAL_CONST(118874.18699986035/8.0),
+ REAL_CONST(118898.94536320666/8.0),
+ REAL_CONST(118923.70501548045/8.0),
+ REAL_CONST(118948.46595654752/8.0),
+ REAL_CONST(118973.22818627374/8.0),
+ REAL_CONST(118997.99170452499/8.0),
+ REAL_CONST(119022.7565111672/8.0),
+ REAL_CONST(119047.52260606633/8.0),
+ REAL_CONST(119072.28998908834/8.0),
+ REAL_CONST(119097.0586600993/8.0),
+ REAL_CONST(119121.82861896523/8.0),
+ REAL_CONST(119146.59986555226/8.0),
+ REAL_CONST(119171.3723997265/8.0),
+ REAL_CONST(119196.14622135412/8.0),
+ REAL_CONST(119220.92133030134/8.0),
+ REAL_CONST(119245.69772643436/8.0),
+ REAL_CONST(119270.47540961947/8.0),
+ REAL_CONST(119295.25437972297/8.0),
+ REAL_CONST(119320.03463661121/8.0),
+ REAL_CONST(119344.81618015055/8.0),
+ REAL_CONST(119369.5990102074/8.0),
+ REAL_CONST(119394.38312664822/8.0),
+ REAL_CONST(119419.16852933947/8.0),
+ REAL_CONST(119443.95521814766/8.0),
+ REAL_CONST(119468.74319293935/8.0),
+ REAL_CONST(119493.53245358112/8.0),
+ REAL_CONST(119518.32299993958/8.0),
+ REAL_CONST(119543.11483188139/8.0),
+ REAL_CONST(119567.90794927324/8.0),
+ REAL_CONST(119592.70235198183/8.0),
+ REAL_CONST(119617.49803987393/8.0),
+ REAL_CONST(119642.29501281632/8.0),
+ REAL_CONST(119667.09327067583/8.0),
+ REAL_CONST(119691.89281331931/8.0),
+ REAL_CONST(119716.69364061367/8.0),
+ REAL_CONST(119741.49575242582/8.0),
+ REAL_CONST(119766.29914862274/8.0),
+ REAL_CONST(119791.10382907141/8.0),
+ REAL_CONST(119815.90979363887/8.0),
+ REAL_CONST(119840.71704219218/8.0),
+ REAL_CONST(119865.52557459843/8.0),
+ REAL_CONST(119890.33539072477/8.0),
+ REAL_CONST(119915.14649043836/8.0),
+ REAL_CONST(119939.95887360642/8.0),
+ REAL_CONST(119964.77254009615/8.0),
+ REAL_CONST(119989.58748977486/8.0),
+ REAL_CONST(120014.40372250983/8.0),
+ REAL_CONST(120039.22123816841/8.0),
+ REAL_CONST(120064.04003661797/8.0),
+ REAL_CONST(120088.86011772591/8.0),
+ REAL_CONST(120113.6814813597/8.0),
+ REAL_CONST(120138.5041273868/8.0),
+ REAL_CONST(120163.3280556747/8.0),
+ REAL_CONST(120188.15326609099/8.0),
+ REAL_CONST(120212.97975850321/8.0),
+ REAL_CONST(120237.807532779/8.0),
+ REAL_CONST(120262.63658878599/8.0),
+ REAL_CONST(120287.46692639188/8.0),
+ REAL_CONST(120312.29854546436/8.0),
+ REAL_CONST(120337.13144587121/8.0),
+ REAL_CONST(120361.9656274802/8.0),
+ REAL_CONST(120386.80109015915/8.0),
+ REAL_CONST(120411.63783377589/8.0),
+ REAL_CONST(120436.47585819835/8.0),
+ REAL_CONST(120461.31516329442/8.0),
+ REAL_CONST(120486.15574893207/8.0),
+ REAL_CONST(120510.99761497928/8.0),
+ REAL_CONST(120535.84076130406/8.0),
+ REAL_CONST(120560.68518777451/8.0),
+ REAL_CONST(120585.53089425867/8.0),
+ REAL_CONST(120610.3778806247/8.0),
+ REAL_CONST(120635.22614674074/8.0),
+ REAL_CONST(120660.07569247499/8.0),
+ REAL_CONST(120684.92651769568/8.0),
+ REAL_CONST(120709.77862227106/8.0),
+ REAL_CONST(120734.63200606944/8.0),
+ REAL_CONST(120759.48666895913/8.0),
+ REAL_CONST(120784.3426108085/8.0),
+ REAL_CONST(120809.19983148595/8.0),
+ REAL_CONST(120834.05833085992/8.0),
+ REAL_CONST(120858.91810879884/8.0),
+ REAL_CONST(120883.77916517125/8.0),
+ REAL_CONST(120908.64149984565/8.0),
+ REAL_CONST(120933.5051126906/8.0),
+ REAL_CONST(120958.37000357473/8.0),
+ REAL_CONST(120983.23617236665/8.0),
+ REAL_CONST(121008.10361893504/8.0),
+ REAL_CONST(121032.97234314861/8.0),
+ REAL_CONST(121057.84234487606/8.0),
+ REAL_CONST(121082.71362398617/8.0),
+ REAL_CONST(121107.58618034775/8.0),
+ REAL_CONST(121132.46001382964/8.0),
+ REAL_CONST(121157.33512430069/8.0),
+ REAL_CONST(121182.21151162982/8.0),
+ REAL_CONST(121207.08917568595/8.0),
+ REAL_CONST(121231.96811633807/8.0),
+ REAL_CONST(121256.84833345517/8.0),
+ REAL_CONST(121281.72982690629/8.0),
+ REAL_CONST(121306.61259656049/8.0),
+ REAL_CONST(121331.49664228689/8.0),
+ REAL_CONST(121356.38196395461/8.0),
+ REAL_CONST(121381.26856143285/8.0),
+ REAL_CONST(121406.15643459078/8.0),
+ REAL_CONST(121431.04558329767/8.0),
+ REAL_CONST(121455.93600742276/8.0),
+ REAL_CONST(121480.82770683538/8.0),
+ REAL_CONST(121505.72068140487/8.0),
+ REAL_CONST(121530.61493100057/8.0),
+ REAL_CONST(121555.51045549192/8.0),
+ REAL_CONST(121580.40725474835/8.0),
+ REAL_CONST(121605.30532863933/8.0),
+ REAL_CONST(121630.20467703436/8.0),
+ REAL_CONST(121655.10529980299/8.0),
+ REAL_CONST(121680.00719681478/8.0),
+ REAL_CONST(121704.91036793934/8.0),
+ REAL_CONST(121729.81481304632/8.0),
+ REAL_CONST(121754.72053200539/8.0),
+ REAL_CONST(121779.62752468624/8.0),
+ REAL_CONST(121804.53579095862/8.0),
+ REAL_CONST(121829.44533069231/8.0),
+ REAL_CONST(121854.3561437571/8.0),
+ REAL_CONST(121879.26823002285/8.0),
+ REAL_CONST(121904.1815893594/8.0),
+ REAL_CONST(121929.09622163669/8.0),
+ REAL_CONST(121954.01212672464/8.0),
+ REAL_CONST(121978.92930449323/8.0),
+ REAL_CONST(122003.84775481246/8.0),
+ REAL_CONST(122028.76747755238/8.0),
+ REAL_CONST(122053.68847258303/8.0),
+ REAL_CONST(122078.61073977455/8.0),
+ REAL_CONST(122103.53427899707/8.0),
+ REAL_CONST(122128.45909012076/8.0),
+ REAL_CONST(122153.38517301581/8.0),
+ REAL_CONST(122178.31252755247/8.0),
+ REAL_CONST(122203.24115360099/8.0),
+ REAL_CONST(122228.17105103172/8.0),
+ REAL_CONST(122253.10221971494/8.0),
+ REAL_CONST(122278.03465952107/8.0),
+ REAL_CONST(122302.96837032049/8.0),
+ REAL_CONST(122327.90335198362/8.0),
+ REAL_CONST(122352.83960438096/8.0),
+ REAL_CONST(122377.777127383/8.0),
+ REAL_CONST(122402.71592086025/8.0),
+ REAL_CONST(122427.65598468333/8.0),
+ REAL_CONST(122452.59731872278/8.0),
+ REAL_CONST(122477.53992284928/8.0),
+ REAL_CONST(122502.48379693348/8.0),
+ REAL_CONST(122527.42894084606/8.0),
+ REAL_CONST(122552.37535445779/8.0),
+ REAL_CONST(122577.32303763942/8.0),
+ REAL_CONST(122602.27199026172/8.0),
+ REAL_CONST(122627.22221219557/8.0),
+ REAL_CONST(122652.17370331181/8.0),
+ REAL_CONST(122677.12646348133/8.0),
+ REAL_CONST(122702.08049257506/8.0),
+ REAL_CONST(122727.03579046397/8.0),
+ REAL_CONST(122751.99235701906/8.0),
+ REAL_CONST(122776.95019211136/8.0),
+ REAL_CONST(122801.9092956119/8.0),
+ REAL_CONST(122826.8696673918/8.0),
+ REAL_CONST(122851.83130732219/8.0),
+ REAL_CONST(122876.79421527422/8.0),
+ REAL_CONST(122901.75839111909/8.0),
+ REAL_CONST(122926.72383472799/8.0),
+ REAL_CONST(122951.69054597223/8.0),
+ REAL_CONST(122976.65852472307/8.0),
+ REAL_CONST(123001.62777085182/8.0),
+ REAL_CONST(123026.59828422987/8.0),
+ REAL_CONST(123051.57006472857/8.0),
+ REAL_CONST(123076.54311221937/8.0),
+ REAL_CONST(123101.5174265737/8.0),
+ REAL_CONST(123126.49300766307/8.0),
+ REAL_CONST(123151.46985535898/8.0),
+ REAL_CONST(123176.44796953299/8.0),
+ REAL_CONST(123201.42735005668/8.0),
+ REAL_CONST(123226.40799680166/8.0),
+ REAL_CONST(123251.38990963959/8.0),
+ REAL_CONST(123276.37308844214/8.0),
+ REAL_CONST(123301.35753308103/8.0),
+ REAL_CONST(123326.343243428/8.0),
+ REAL_CONST(123351.33021935483/8.0),
+ REAL_CONST(123376.31846073334/8.0),
+ REAL_CONST(123401.30796743535/8.0),
+ REAL_CONST(123426.29873933276/8.0),
+ REAL_CONST(123451.29077629748/8.0),
+ REAL_CONST(123476.28407820144/8.0),
+ REAL_CONST(123501.2786449166/8.0),
+ REAL_CONST(123526.27447631498/8.0),
+ REAL_CONST(123551.27157226863/8.0),
+ REAL_CONST(123576.26993264959/8.0),
+ REAL_CONST(123601.26955732999/8.0),
+ REAL_CONST(123626.27044618195/8.0),
+ REAL_CONST(123651.27259907764/8.0),
+ REAL_CONST(123676.27601588926/8.0),
+ REAL_CONST(123701.28069648903/8.0),
+ REAL_CONST(123726.28664074924/8.0),
+ REAL_CONST(123751.29384854218/8.0),
+ REAL_CONST(123776.30231974016/8.0),
+ REAL_CONST(123801.31205421555/8.0),
+ REAL_CONST(123826.32305184075/8.0),
+ REAL_CONST(123851.33531248817/8.0),
+ REAL_CONST(123876.34883603029/8.0),
+ REAL_CONST(123901.36362233957/8.0),
+ REAL_CONST(123926.37967128855/8.0),
+ REAL_CONST(123951.39698274979/8.0),
+ REAL_CONST(123976.41555659588/8.0),
+ REAL_CONST(124001.43539269941/8.0),
+ REAL_CONST(124026.45649093305/8.0),
+ REAL_CONST(124051.47885116948/8.0),
+ REAL_CONST(124076.50247328142/8.0),
+ REAL_CONST(124101.5273571416/8.0),
+ REAL_CONST(124126.55350262282/8.0),
+ REAL_CONST(124151.58090959788/8.0),
+ REAL_CONST(124176.60957793961/8.0),
+ REAL_CONST(124201.63950752091/8.0),
+ REAL_CONST(124226.67069821467/8.0),
+ REAL_CONST(124251.70314989384/8.0),
+ REAL_CONST(124276.73686243138/8.0),
+ REAL_CONST(124301.7718357003/8.0),
+ REAL_CONST(124326.80806957364/8.0),
+ REAL_CONST(124351.84556392446/8.0),
+ REAL_CONST(124376.88431862585/8.0),
+ REAL_CONST(124401.92433355095/8.0),
+ REAL_CONST(124426.96560857294/8.0),
+ REAL_CONST(124452.00814356498/8.0),
+ REAL_CONST(124477.05193840031/8.0),
+ REAL_CONST(124502.0969929522/8.0),
+ REAL_CONST(124527.14330709392/8.0),
+ REAL_CONST(124552.19088069882/8.0),
+ REAL_CONST(124577.23971364023/8.0),
+ REAL_CONST(124602.28980579154/8.0),
+ REAL_CONST(124627.34115702618/8.0),
+ REAL_CONST(124652.3937672176/8.0),
+ REAL_CONST(124677.44763623926/8.0),
+ REAL_CONST(124702.50276396469/8.0),
+ REAL_CONST(124727.55915026742/8.0),
+ REAL_CONST(124752.61679502104/8.0),
+ REAL_CONST(124777.67569809916/8.0),
+ REAL_CONST(124802.73585937542/8.0),
+ REAL_CONST(124827.79727872348/8.0),
+ REAL_CONST(124852.85995601704/8.0),
+ REAL_CONST(124877.92389112986/8.0),
+ REAL_CONST(124902.98908393568/8.0),
+ REAL_CONST(124928.05553430831/8.0),
+ REAL_CONST(124953.1232421216/8.0),
+ REAL_CONST(124978.19220724938/8.0),
+ REAL_CONST(125003.26242956554/8.0),
+ REAL_CONST(125028.33390894404/8.0),
+ REAL_CONST(125053.40664525882/8.0),
+ REAL_CONST(125078.48063838384/8.0),
+ REAL_CONST(125103.55588819318/8.0),
+ REAL_CONST(125128.63239456083/8.0),
+ REAL_CONST(125153.71015736091/8.0),
+ REAL_CONST(125178.78917646752/8.0),
+ REAL_CONST(125203.86945175481/8.0),
+ REAL_CONST(125228.95098309696/8.0),
+ REAL_CONST(125254.03377036817/8.0),
+ REAL_CONST(125279.1178134427/8.0),
+ REAL_CONST(125304.20311219479/8.0),
+ REAL_CONST(125329.28966649878/8.0),
+ REAL_CONST(125354.37747622898/8.0),
+ REAL_CONST(125379.46654125977/8.0),
+ REAL_CONST(125404.55686146552/8.0),
+ REAL_CONST(125429.6484367207/8.0),
+ REAL_CONST(125454.74126689974/8.0),
+ REAL_CONST(125479.83535187715/8.0),
+ REAL_CONST(125504.93069152744/8.0),
+ REAL_CONST(125530.02728572517/8.0),
+ REAL_CONST(125555.12513434493/8.0),
+ REAL_CONST(125580.22423726133/8.0),
+ REAL_CONST(125605.32459434902/8.0),
+ REAL_CONST(125630.4262054827/8.0),
+ REAL_CONST(125655.52907053704/8.0),
+ REAL_CONST(125680.63318938682/8.0),
+ REAL_CONST(125705.73856190679/8.0),
+ REAL_CONST(125730.84518797178/8.0),
+ REAL_CONST(125755.9530674566/8.0),
+ REAL_CONST(125781.06220023613/8.0),
+ REAL_CONST(125806.17258618528/8.0),
+ REAL_CONST(125831.28422517896/8.0),
+ REAL_CONST(125856.39711709213/8.0),
+ REAL_CONST(125881.51126179981/8.0),
+ REAL_CONST(125906.62665917698/8.0),
+ REAL_CONST(125931.74330909875/8.0),
+ REAL_CONST(125956.86121144016/8.0),
+ REAL_CONST(125981.98036607634/8.0),
+ REAL_CONST(126007.10077288245/8.0),
+ REAL_CONST(126032.22243173365/8.0),
+ REAL_CONST(126057.34534250517/8.0),
+ REAL_CONST(126082.46950507225/8.0),
+ REAL_CONST(126107.59491931014/8.0),
+ REAL_CONST(126132.72158509417/8.0),
+ REAL_CONST(126157.84950229966/8.0),
+ REAL_CONST(126182.97867080198/8.0),
+ REAL_CONST(126208.10909047653/8.0),
+ REAL_CONST(126233.24076119871/8.0),
+ REAL_CONST(126258.37368284403/8.0),
+ REAL_CONST(126283.50785528794/8.0),
+ REAL_CONST(126308.64327840599/8.0),
+ REAL_CONST(126333.77995207369/8.0),
+ REAL_CONST(126358.91787616667/8.0),
+ REAL_CONST(126384.0570505605/8.0),
+ REAL_CONST(126409.19747513086/8.0),
+ REAL_CONST(126434.3391497534/8.0),
+ REAL_CONST(126459.48207430386/8.0),
+ REAL_CONST(126484.62624865794/8.0),
+ REAL_CONST(126509.77167269142/8.0),
+ REAL_CONST(126534.9183462801/8.0),
+ REAL_CONST(126560.06626929982/8.0),
+ REAL_CONST(126585.21544162642/8.0),
+ REAL_CONST(126610.36586313581/8.0),
+ REAL_CONST(126635.51753370393/8.0),
+ REAL_CONST(126660.67045320668/8.0),
+ REAL_CONST(126685.82462152008/8.0),
+ REAL_CONST(126710.98003852014/8.0),
+ REAL_CONST(126736.13670408291/8.0),
+ REAL_CONST(126761.29461808444/8.0),
+ REAL_CONST(126786.45378040087/8.0),
+ REAL_CONST(126811.61419090834/8.0),
+ REAL_CONST(126836.77584948298/8.0),
+ REAL_CONST(126861.93875600102/8.0),
+ REAL_CONST(126887.10291033868/8.0),
+ REAL_CONST(126912.26831237224/8.0),
+ REAL_CONST(126937.43496197795/8.0),
+ REAL_CONST(126962.60285903217/8.0),
+ REAL_CONST(126987.77200341123/8.0),
+ REAL_CONST(127012.94239499152/8.0),
+ REAL_CONST(127038.11403364947/8.0),
+ REAL_CONST(127063.2869192615/8.0),
+ REAL_CONST(127088.46105170409/8.0),
+ REAL_CONST(127113.63643085376/8.0),
+ REAL_CONST(127138.81305658702/8.0),
+ REAL_CONST(127163.99092878048/8.0),
+ REAL_CONST(127189.17004731069/8.0),
+ REAL_CONST(127214.35041205429/8.0),
+ REAL_CONST(127239.53202288797/8.0),
+ REAL_CONST(127264.71487968838/8.0),
+ REAL_CONST(127289.89898233226/8.0),
+ REAL_CONST(127315.08433069635/8.0),
+ REAL_CONST(127340.27092465744/8.0),
+ REAL_CONST(127365.45876409234/8.0),
+ REAL_CONST(127390.64784887788/8.0),
+ REAL_CONST(127415.83817889093/8.0),
+ REAL_CONST(127441.02975400841/8.0),
+ REAL_CONST(127466.22257410725/8.0),
+ REAL_CONST(127491.41663906439/8.0),
+ REAL_CONST(127516.61194875685/8.0),
+ REAL_CONST(127541.80850306165/8.0),
+ REAL_CONST(127567.00630185583/8.0),
+ REAL_CONST(127592.20534501647/8.0),
+ REAL_CONST(127617.4056324207/8.0),
+ REAL_CONST(127642.60716394568/8.0),
+ REAL_CONST(127667.80993946856/8.0),
+ REAL_CONST(127693.01395886653/8.0),
+ REAL_CONST(127718.21922201688/8.0),
+ REAL_CONST(127743.42572879682/8.0),
+ REAL_CONST(127768.63347908368/8.0),
+ REAL_CONST(127793.84247275478/8.0),
+ REAL_CONST(127819.05270968749/8.0),
+ REAL_CONST(127844.26418975917/8.0),
+ REAL_CONST(127869.47691284724/8.0),
+ REAL_CONST(127894.69087882918/8.0),
+ REAL_CONST(127919.90608758242/8.0),
+ REAL_CONST(127945.12253898452/8.0),
+ REAL_CONST(127970.34023291297/8.0),
+ REAL_CONST(127995.55916924537/8.0),
+ REAL_CONST(128020.77934785932/8.0),
+ REAL_CONST(128046.00076863244/8.0),
+ REAL_CONST(128071.22343144237/8.0),
+ REAL_CONST(128096.44733616684/8.0),
+ REAL_CONST(128121.67248268353/8.0),
+ REAL_CONST(128146.89887087021/8.0),
+ REAL_CONST(128172.12650060465/8.0),
+ REAL_CONST(128197.35537176467/8.0),
+ REAL_CONST(128222.5854842281/8.0),
+ REAL_CONST(128247.81683787282/8.0),
+ REAL_CONST(128273.04943257671/8.0),
+ REAL_CONST(128298.28326821771/8.0),
+ REAL_CONST(128323.51834467379/8.0),
+ REAL_CONST(128348.75466182294/8.0),
+ REAL_CONST(128373.99221954317/8.0),
+ REAL_CONST(128399.23101771252/8.0),
+ REAL_CONST(128424.47105620909/8.0),
+ REAL_CONST(128449.71233491098/8.0),
+ REAL_CONST(128474.95485369631/8.0),
+ REAL_CONST(128500.19861244329/8.0),
+ REAL_CONST(128525.44361103009/8.0),
+ REAL_CONST(128550.68984933494/8.0),
+ REAL_CONST(128575.93732723613/8.0),
+ REAL_CONST(128601.18604461191/8.0),
+ REAL_CONST(128626.43600134061/8.0),
+ REAL_CONST(128651.68719730059/8.0),
+ REAL_CONST(128676.93963237021/8.0),
+ REAL_CONST(128702.1933064279/8.0),
+ REAL_CONST(128727.44821935208/8.0),
+ REAL_CONST(128752.70437102125/8.0),
+ REAL_CONST(128777.96176131385/8.0),
+ REAL_CONST(128803.22039010846/8.0),
+ REAL_CONST(128828.48025728362/8.0),
+ REAL_CONST(128853.74136271792/8.0),
+ REAL_CONST(128879.00370628996/8.0),
+ REAL_CONST(128904.26728787841/8.0),
+ REAL_CONST(128929.53210736193/8.0),
+ REAL_CONST(128954.79816461923/8.0),
+ REAL_CONST(128980.06545952905/8.0),
+ REAL_CONST(129005.33399197015/8.0),
+ REAL_CONST(129030.60376182134/8.0),
+ REAL_CONST(129055.87476896142/8.0),
+ REAL_CONST(129081.14701326926/8.0),
+ REAL_CONST(129106.42049462376/8.0),
+ REAL_CONST(129131.6952129038/8.0),
+ REAL_CONST(129156.97116798835/8.0),
+ REAL_CONST(129182.24835975636/8.0),
+ REAL_CONST(129207.52678808685/8.0),
+ REAL_CONST(129232.80645285884/8.0),
+ REAL_CONST(129258.08735395141/8.0),
+ REAL_CONST(129283.36949124365/8.0),
+ REAL_CONST(129308.65286461466/8.0),
+ REAL_CONST(129333.9374739436/8.0),
+ REAL_CONST(129359.22331910966/8.0),
+ REAL_CONST(129384.51039999202/8.0),
+ REAL_CONST(129409.79871646997/8.0),
+ REAL_CONST(129435.08826842274/8.0),
+ REAL_CONST(129460.37905572963/8.0),
+ REAL_CONST(129485.67107826998/8.0),
+ REAL_CONST(129510.96433592314/8.0),
+ REAL_CONST(129536.25882856851/8.0),
+ REAL_CONST(129561.55455608548/8.0),
+ REAL_CONST(129586.85151835352/8.0),
+ REAL_CONST(129612.14971525209/8.0),
+ REAL_CONST(129637.4491466607/8.0),
+ REAL_CONST(129662.74981245887/8.0),
+ REAL_CONST(129688.0517125262/8.0),
+ REAL_CONST(129713.35484674224/8.0),
+ REAL_CONST(129738.65921498663/8.0),
+ REAL_CONST(129763.96481713903/8.0),
+ REAL_CONST(129789.27165307909/8.0),
+ REAL_CONST(129814.57972268655/8.0),
+ REAL_CONST(129839.88902584116/8.0),
+ REAL_CONST(129865.19956242264/8.0),
+ REAL_CONST(129890.51133231082/8.0),
+ REAL_CONST(129915.82433538554/8.0),
+ REAL_CONST(129941.13857152662/8.0),
+ REAL_CONST(129966.45404061397/8.0),
+ REAL_CONST(129991.7707425275/8.0),
+ REAL_CONST(130017.08867714716/8.0),
+ REAL_CONST(130042.4078443529/8.0),
+ REAL_CONST(130067.72824402474/8.0),
+ REAL_CONST(130093.04987604271/8.0),
+ REAL_CONST(130118.37274028687/8.0),
+ REAL_CONST(130143.69683663732/8.0),
+ REAL_CONST(130169.02216497416/8.0),
+ REAL_CONST(130194.34872517755/8.0),
+ REAL_CONST(130219.67651712766/8.0),
+ REAL_CONST(130245.0055407047/8.0),
+ REAL_CONST(130270.33579578891/8.0),
+ REAL_CONST(130295.66728226055/8.0),
+ REAL_CONST(130320.99999999991/8.0),
+ REAL_CONST(130346.33394888733/8.0),
+ REAL_CONST(130371.66912880314/8.0),
+ REAL_CONST(130397.00553962773/8.0),
+ REAL_CONST(130422.34318124152/8.0),
+ REAL_CONST(130447.68205352494/8.0),
+ REAL_CONST(130473.02215635845/8.0),
+ REAL_CONST(130498.36348962256/8.0),
+ REAL_CONST(130523.70605319779/8.0),
+ REAL_CONST(130549.0498469647/8.0),
+ REAL_CONST(130574.39487080388/8.0),
+ REAL_CONST(130599.74112459592/8.0),
+ REAL_CONST(130625.08860822149/8.0),
+ REAL_CONST(130650.43732156123/8.0),
+ REAL_CONST(130675.78726449587/8.0),
+ REAL_CONST(130701.13843690613/8.0),
+ REAL_CONST(130726.49083867275/8.0),
+ REAL_CONST(130751.84446967654/8.0),
+ REAL_CONST(130777.19932979831/8.0),
+ REAL_CONST(130802.5554189189/8.0),
+ REAL_CONST(130827.91273691918/8.0),
+ REAL_CONST(130853.27128368006/8.0),
+ REAL_CONST(130878.63105908247/8.0),
+ REAL_CONST(130903.99206300738/8.0),
+ REAL_CONST(130929.35429533575/8.0),
+ REAL_CONST(130954.71775594862/8.0),
+ REAL_CONST(130980.08244472703/8.0),
+ REAL_CONST(131005.44836155206/8.0),
+ REAL_CONST(131030.81550630482/8.0),
+ REAL_CONST(131056.18387886642/8.0),
+ REAL_CONST(131081.55347911804/8.0),
+ REAL_CONST(131106.92430694087/8.0),
+ REAL_CONST(131132.29636221612/8.0),
+ REAL_CONST(131157.66964482504/8.0),
+ REAL_CONST(131183.0441546489/8.0),
+ REAL_CONST(131208.41989156904/8.0),
+ REAL_CONST(131233.79685546676/8.0),
+ REAL_CONST(131259.17504622342/8.0),
+ REAL_CONST(131284.55446372041/8.0),
+ REAL_CONST(131309.93510783918/8.0),
+ REAL_CONST(131335.31697846117/8.0),
+ REAL_CONST(131360.70007546784/8.0),
+ REAL_CONST(131386.0843987407/8.0),
+ REAL_CONST(131411.46994816128/8.0),
+ REAL_CONST(131436.85672361116/8.0),
+ REAL_CONST(131462.24472497194/8.0),
+ REAL_CONST(131487.63395212521/8.0),
+ REAL_CONST(131513.02440495262/8.0),
+ REAL_CONST(131538.41608333588/8.0),
+ REAL_CONST(131563.80898715663/8.0),
+ REAL_CONST(131589.2031162967/8.0),
+ REAL_CONST(131614.59847063778/8.0),
+ REAL_CONST(131639.9950500617/8.0),
+ REAL_CONST(131665.39285445024/8.0),
+ REAL_CONST(131690.79188368531/8.0),
+ REAL_CONST(131716.19213764873/8.0),
+ REAL_CONST(131741.59361622241/8.0),
+ REAL_CONST(131766.99631928833/8.0),
+ REAL_CONST(131792.40024672839/8.0),
+ REAL_CONST(131817.80539842462/8.0),
+ REAL_CONST(131843.21177425905/8.0),
+ REAL_CONST(131868.61937411371/8.0),
+ REAL_CONST(131894.02819787065/8.0),
+ REAL_CONST(131919.43824541202/8.0),
+ REAL_CONST(131944.84951661993/8.0),
+ REAL_CONST(131970.26201137656/8.0),
+ REAL_CONST(131995.67572956407/8.0),
+ REAL_CONST(132021.09067106468/8.0),
+ REAL_CONST(132046.50683576067/8.0),
+ REAL_CONST(132071.9242235343/8.0),
+ REAL_CONST(132097.34283426782/8.0),
+ REAL_CONST(132122.76266784366/8.0),
+ REAL_CONST(132148.1837241441/8.0),
+ REAL_CONST(132173.60600305157/8.0),
+ REAL_CONST(132199.02950444847/8.0),
+ REAL_CONST(132224.45422821722/8.0),
+ REAL_CONST(132249.88017424036/8.0),
+ REAL_CONST(132275.30734240031/8.0),
+ REAL_CONST(132300.73573257966/8.0),
+ REAL_CONST(132326.16534466096/8.0),
+ REAL_CONST(132351.59617852676/8.0),
+ REAL_CONST(132377.02823405969/8.0),
+ REAL_CONST(132402.46151114244/8.0),
+ REAL_CONST(132427.89600965759/8.0),
+ REAL_CONST(132453.33172948789/8.0),
+ REAL_CONST(132478.76867051609/8.0),
+ REAL_CONST(132504.20683262491/8.0),
+ REAL_CONST(132529.64621569714/8.0),
+ REAL_CONST(132555.08681961559/8.0),
+ REAL_CONST(132580.5286442631/8.0),
+ REAL_CONST(132605.97168952253/8.0),
+ REAL_CONST(132631.41595527678/8.0),
+ REAL_CONST(132656.86144140881/8.0),
+ REAL_CONST(132682.30814780149/8.0),
+ REAL_CONST(132707.75607433787/8.0),
+ REAL_CONST(132733.20522090094/8.0),
+ REAL_CONST(132758.65558737374/8.0),
+ REAL_CONST(132784.10717363929/8.0),
+ REAL_CONST(132809.55997958075/8.0),
+ REAL_CONST(132835.01400508118/8.0),
+ REAL_CONST(132860.46925002377/8.0),
+ REAL_CONST(132885.92571429166/8.0),
+ REAL_CONST(132911.38339776811/8.0),
+ REAL_CONST(132936.84230033628/8.0),
+ REAL_CONST(132962.30242187946/8.0),
+ REAL_CONST(132987.76376228096/8.0),
+ REAL_CONST(133013.22632142407/8.0),
+ REAL_CONST(133038.69009919214/8.0),
+ REAL_CONST(133064.15509546854/8.0),
+ REAL_CONST(133089.62131013666/8.0),
+ REAL_CONST(133115.08874307995/8.0),
+ REAL_CONST(133140.55739418184/8.0),
+ REAL_CONST(133166.02726332581/8.0),
+ REAL_CONST(133191.49835039541/8.0),
+ REAL_CONST(133216.97065527414/8.0),
+ REAL_CONST(133242.44417784561/8.0),
+ REAL_CONST(133267.91891799335/8.0),
+ REAL_CONST(133293.39487560102/8.0),
+ REAL_CONST(133318.87205055228/8.0),
+ REAL_CONST(133344.35044273079/8.0),
+ REAL_CONST(133369.83005202023/8.0),
+ REAL_CONST(133395.31087830439/8.0),
+ REAL_CONST(133420.79292146701/8.0),
+ REAL_CONST(133446.27618139185/8.0),
+ REAL_CONST(133471.76065796276/8.0),
+ REAL_CONST(133497.24635106357/8.0),
+ REAL_CONST(133522.73326057816/8.0),
+ REAL_CONST(133548.22138639039/8.0),
+ REAL_CONST(133573.71072838426/8.0),
+ REAL_CONST(133599.20128644365/8.0),
+ REAL_CONST(133624.69306045261/8.0),
+ REAL_CONST(133650.1860502951/8.0),
+ REAL_CONST(133675.68025585517/8.0),
+ REAL_CONST(133701.1756770169/8.0),
+ REAL_CONST(133726.67231366437/8.0),
+ REAL_CONST(133752.17016568172/8.0),
+ REAL_CONST(133777.66923295305/8.0),
+ REAL_CONST(133803.16951536259/8.0),
+ REAL_CONST(133828.67101279454/8.0),
+ REAL_CONST(133854.17372513309/8.0),
+ REAL_CONST(133879.67765226253/8.0),
+ REAL_CONST(133905.18279406714/8.0),
+ REAL_CONST(133930.68915043125/8.0),
+ REAL_CONST(133956.19672123916/8.0),
+ REAL_CONST(133981.70550637526/8.0),
+ REAL_CONST(134007.21550572399/8.0),
+ REAL_CONST(134032.7267191697/8.0),
+ REAL_CONST(134058.23914659687/8.0),
+ REAL_CONST(134083.75278789/8.0),
+ REAL_CONST(134109.26764293358/8.0),
+ REAL_CONST(134134.78371161217/8.0),
+ REAL_CONST(134160.30099381026/8.0),
+ REAL_CONST(134185.8194894125/8.0),
+ REAL_CONST(134211.33919830353/8.0),
+ REAL_CONST(134236.8601203679/8.0),
+ REAL_CONST(134262.38225549037/8.0),
+ REAL_CONST(134287.90560355558/8.0),
+ REAL_CONST(134313.43016444831/8.0),
+ REAL_CONST(134338.95593805326/8.0),
+ REAL_CONST(134364.48292425525/8.0),
+ REAL_CONST(134390.01112293909/8.0),
+ REAL_CONST(134415.54053398955/8.0),
+ REAL_CONST(134441.07115729159/8.0),
+ REAL_CONST(134466.60299273001/8.0),
+ REAL_CONST(134492.1360401898/8.0),
+ REAL_CONST(134517.67029955584/8.0),
+ REAL_CONST(134543.20577071316/8.0),
+ REAL_CONST(134568.74245354676/8.0),
+ REAL_CONST(134594.28034794159/8.0),
+ REAL_CONST(134619.81945378278/8.0),
+ REAL_CONST(134645.35977095537/8.0),
+ REAL_CONST(134670.90129934452/8.0),
+ REAL_CONST(134696.4440388353/8.0),
+ REAL_CONST(134721.98798931291/8.0),
+ REAL_CONST(134747.53315066252/8.0),
+ REAL_CONST(134773.07952276937/8.0),
+ REAL_CONST(134798.62710551871/8.0),
+ REAL_CONST(134824.17589879577/8.0),
+ REAL_CONST(134849.72590248589/8.0),
+ REAL_CONST(134875.27711647438/8.0),
+ REAL_CONST(134900.82954064661/8.0),
+ REAL_CONST(134926.38317488792/8.0),
+ REAL_CONST(134951.93801908373/8.0),
+ REAL_CONST(134977.49407311951/8.0),
+ REAL_CONST(135003.05133688069/8.0),
+ REAL_CONST(135028.60981025276/8.0),
+ REAL_CONST(135054.16949312127/8.0),
+ REAL_CONST(135079.73038537172/8.0),
+ REAL_CONST(135105.29248688967/8.0),
+ REAL_CONST(135130.85579756077/8.0),
+ REAL_CONST(135156.42031727062/8.0),
+ REAL_CONST(135181.98604590484/8.0),
+ REAL_CONST(135207.55298334916/8.0),
+ REAL_CONST(135233.12112948924/8.0),
+ REAL_CONST(135258.69048421088/8.0),
+ REAL_CONST(135284.26104739975/8.0),
+ REAL_CONST(135309.83281894168/8.0),
+ REAL_CONST(135335.4057987225/8.0),
+ REAL_CONST(135360.97998662802/8.0),
+ REAL_CONST(135386.55538254412/8.0),
+ REAL_CONST(135412.13198635669/8.0),
+ REAL_CONST(135437.70979795168/8.0),
+ REAL_CONST(135463.28881721498/8.0),
+ REAL_CONST(135488.86904403262/8.0),
+ REAL_CONST(135514.45047829056/8.0),
+ REAL_CONST(135540.03311987486/8.0),
+ REAL_CONST(135565.61696867159/8.0),
+ REAL_CONST(135591.20202456677/8.0),
+ REAL_CONST(135616.78828744654/8.0),
+ REAL_CONST(135642.37575719706/8.0),
+ REAL_CONST(135667.96443370447/8.0),
+ REAL_CONST(135693.55431685498/8.0),
+ REAL_CONST(135719.14540653475/8.0),
+ REAL_CONST(135744.73770263011/8.0),
+ REAL_CONST(135770.33120502727/8.0),
+ REAL_CONST(135795.92591361253/8.0),
+ REAL_CONST(135821.52182827223/8.0),
+ REAL_CONST(135847.11894889272/8.0),
+ REAL_CONST(135872.7172753604/8.0),
+ REAL_CONST(135898.31680756161/8.0),
+ REAL_CONST(135923.91754538284/8.0),
+ REAL_CONST(135949.51948871053/8.0),
+ REAL_CONST(135975.12263743114/8.0),
+ REAL_CONST(136000.72699143123/8.0),
+ REAL_CONST(136026.33255059729/8.0),
+ REAL_CONST(136051.93931481591/8.0),
+ REAL_CONST(136077.54728397369/8.0),
+ REAL_CONST(136103.15645795723/8.0),
+ REAL_CONST(136128.76683665317/8.0),
+ REAL_CONST(136154.37841994822/8.0),
+ REAL_CONST(136179.99120772901/8.0),
+ REAL_CONST(136205.60519988232/8.0),
+ REAL_CONST(136231.2203962949/8.0),
+ REAL_CONST(136256.83679685349/8.0),
+ REAL_CONST(136282.45440144493/8.0),
+ REAL_CONST(136308.07320995603/8.0),
+ REAL_CONST(136333.69322227367/8.0),
+ REAL_CONST(136359.31443828469/8.0),
+ REAL_CONST(136384.93685787608/8.0),
+ REAL_CONST(136410.56048093468/8.0),
+ REAL_CONST(136436.18530734754/8.0),
+ REAL_CONST(136461.81133700156/8.0),
+ REAL_CONST(136487.43856978384/8.0),
+ REAL_CONST(136513.06700558143/8.0),
+ REAL_CONST(136538.6966442813/8.0),
+ REAL_CONST(136564.32748577066/8.0),
+ REAL_CONST(136589.95952993655/8.0),
+ REAL_CONST(136615.59277666616/8.0),
+ REAL_CONST(136641.22722584667/8.0),
+ REAL_CONST(136666.86287736523/8.0),
+ REAL_CONST(136692.49973110916/8.0),
+ REAL_CONST(136718.13778696564/8.0),
+ REAL_CONST(136743.77704482197/8.0),
+ REAL_CONST(136769.41750456547/8.0),
+ REAL_CONST(136795.05916608346/8.0),
+ REAL_CONST(136820.70202926331/8.0),
+ REAL_CONST(136846.34609399244/8.0),
+ REAL_CONST(136871.99136015819/8.0),
+ REAL_CONST(136897.63782764805/8.0),
+ REAL_CONST(136923.28549634948/8.0),
+ REAL_CONST(136948.93436614997/8.0),
+ REAL_CONST(136974.58443693706/8.0),
+ REAL_CONST(137000.23570859825/8.0),
+ REAL_CONST(137025.88818102115/8.0),
+ REAL_CONST(137051.54185409332/8.0),
+ REAL_CONST(137077.19672770242/8.0),
+ REAL_CONST(137102.85280173609/8.0),
+ REAL_CONST(137128.51007608202/8.0),
+ REAL_CONST(137154.16855062786/8.0),
+ REAL_CONST(137179.82822526142/8.0),
+ REAL_CONST(137205.48909987041/8.0),
+ REAL_CONST(137231.15117434258/8.0),
+ REAL_CONST(137256.8144485658/8.0),
+ REAL_CONST(137282.47892242789/8.0),
+ REAL_CONST(137308.14459581667/8.0),
+ REAL_CONST(137333.81146862009/8.0),
+ REAL_CONST(137359.47954072602/8.0),
+ REAL_CONST(137385.14881202241/8.0),
+ REAL_CONST(137410.81928239719/8.0),
+ REAL_CONST(137436.49095173844/8.0),
+ REAL_CONST(137462.16381993407/8.0),
+ REAL_CONST(137487.83788687221/8.0),
+ REAL_CONST(137513.51315244089/8.0),
+ REAL_CONST(137539.18961652822/8.0),
+ REAL_CONST(137564.86727902229/8.0),
+ REAL_CONST(137590.54613981131/8.0),
+ REAL_CONST(137616.22619878338/8.0),
+ REAL_CONST(137641.90745582676/8.0),
+ REAL_CONST(137667.58991082967/8.0),
+ REAL_CONST(137693.27356368033/8.0),
+ REAL_CONST(137718.95841426702/8.0),
+ REAL_CONST(137744.64446247809/8.0),
+ REAL_CONST(137770.33170820182/8.0),
+ REAL_CONST(137796.02015132661/8.0),
+ REAL_CONST(137821.70979174081/8.0),
+ REAL_CONST(137847.40062933284/8.0),
+ REAL_CONST(137873.09266399115/8.0),
+ REAL_CONST(137898.78589560417/8.0),
+ REAL_CONST(137924.48032406042/8.0),
+ REAL_CONST(137950.17594924837/8.0),
+ REAL_CONST(137975.8727710566/8.0),
+ REAL_CONST(138001.57078937365/8.0),
+ REAL_CONST(138027.27000408815/8.0),
+ REAL_CONST(138052.97041508864/8.0),
+ REAL_CONST(138078.67202226384/8.0),
+ REAL_CONST(138104.3748255024/8.0),
+ REAL_CONST(138130.07882469296/8.0),
+ REAL_CONST(138155.78401972432/8.0),
+ REAL_CONST(138181.49041048516/8.0),
+ REAL_CONST(138207.1979968643/8.0),
+ REAL_CONST(138232.9067787505/8.0),
+ REAL_CONST(138258.61675603263/8.0),
+ REAL_CONST(138284.32792859949/8.0),
+ REAL_CONST(138310.04029633995/8.0),
+ REAL_CONST(138335.75385914298/8.0),
+ REAL_CONST(138361.46861689744/8.0),
+ REAL_CONST(138387.18456949232/8.0),
+ REAL_CONST(138412.90171681659/8.0),
+ REAL_CONST(138438.62005875923/8.0),
+ REAL_CONST(138464.33959520931/8.0),
+ REAL_CONST(138490.06032605586/8.0),
+ REAL_CONST(138515.78225118798/8.0),
+ REAL_CONST(138541.50537049473/8.0),
+ REAL_CONST(138567.2296838653/8.0),
+ REAL_CONST(138592.95519118884/8.0),
+ REAL_CONST(138618.68189235451/8.0),
+ REAL_CONST(138644.40978725153/8.0),
+ REAL_CONST(138670.13887576913/8.0),
+ REAL_CONST(138695.86915779658/8.0),
+ REAL_CONST(138721.60063322316/8.0),
+ REAL_CONST(138747.33330193823/8.0),
+ REAL_CONST(138773.06716383106/8.0),
+ REAL_CONST(138798.80221879104/8.0),
+ REAL_CONST(138824.53846670757/8.0),
+ REAL_CONST(138850.27590747006/8.0),
+ REAL_CONST(138876.01454096794/8.0),
+ REAL_CONST(138901.7543670907/8.0),
+ REAL_CONST(138927.49538572782/8.0),
+ REAL_CONST(138953.2375967688/8.0),
+ REAL_CONST(138978.9810001032/8.0),
+ REAL_CONST(139004.72559562061/8.0),
+ REAL_CONST(139030.47138321059/8.0),
+ REAL_CONST(139056.2183627628/8.0),
+ REAL_CONST(139081.96653416683/8.0),
+ REAL_CONST(139107.71589731239/8.0),
+ REAL_CONST(139133.46645208917/8.0),
+ REAL_CONST(139159.21819838689/8.0),
+ REAL_CONST(139184.97113609532/8.0),
+ REAL_CONST(139210.72526510421/8.0),
+ REAL_CONST(139236.48058530336/8.0),
+ REAL_CONST(139262.23709658257/8.0),
+ REAL_CONST(139287.99479883176/8.0),
+ REAL_CONST(139313.75369194071/8.0),
+ REAL_CONST(139339.51377579942/8.0),
+ REAL_CONST(139365.27505029776/8.0),
+ REAL_CONST(139391.03751532568/8.0),
+ REAL_CONST(139416.80117077316/8.0),
+ REAL_CONST(139442.56601653024/8.0),
+ REAL_CONST(139468.33205248689/8.0),
+ REAL_CONST(139494.09927853322/8.0),
+ REAL_CONST(139519.86769455927/8.0),
+ REAL_CONST(139545.63730045516/8.0),
+ REAL_CONST(139571.408096111/8.0),
+ REAL_CONST(139597.18008141697/8.0),
+ REAL_CONST(139622.95325626322/8.0),
+ REAL_CONST(139648.72762054001/8.0),
+ REAL_CONST(139674.5031741375/8.0),
+ REAL_CONST(139700.27991694602/8.0),
+ REAL_CONST(139726.05784885579/8.0),
+ REAL_CONST(139751.83696975713/8.0),
+ REAL_CONST(139777.61727954043/8.0),
+ REAL_CONST(139803.39877809596/8.0),
+ REAL_CONST(139829.18146531415/8.0),
+ REAL_CONST(139854.96534108539/8.0),
+ REAL_CONST(139880.75040530015/8.0),
+ REAL_CONST(139906.53665784886/8.0),
+ REAL_CONST(139932.32409862199/8.0),
+ REAL_CONST(139958.11272751007/8.0),
+ REAL_CONST(139983.90254440365/8.0),
+ REAL_CONST(140009.69354919327/8.0),
+ REAL_CONST(140035.48574176949/8.0),
+ REAL_CONST(140061.27912202294/8.0),
+ REAL_CONST(140087.07368984428/8.0),
+ REAL_CONST(140112.86944512415/8.0),
+ REAL_CONST(140138.66638775321/8.0),
+ REAL_CONST(140164.4645176222/8.0),
+ REAL_CONST(140190.26383462184/8.0),
+ REAL_CONST(140216.06433864293/8.0),
+ REAL_CONST(140241.86602957622/8.0),
+ REAL_CONST(140267.66890731253/8.0),
+ REAL_CONST(140293.47297174268/8.0),
+ REAL_CONST(140319.27822275754/8.0),
+ REAL_CONST(140345.08466024802/8.0),
+ REAL_CONST(140370.89228410498/8.0),
+ REAL_CONST(140396.70109421943/8.0),
+ REAL_CONST(140422.51109048226/8.0),
+ REAL_CONST(140448.32227278448/8.0),
+ REAL_CONST(140474.13464101712/8.0),
+ REAL_CONST(140499.94819507122/8.0),
+ REAL_CONST(140525.76293483781/8.0),
+ REAL_CONST(140551.57886020801/8.0),
+ REAL_CONST(140577.3959710729/8.0),
+ REAL_CONST(140603.21426732364/8.0),
+ REAL_CONST(140629.03374885136/8.0),
+ REAL_CONST(140654.85441554731/8.0),
+ REAL_CONST(140680.67626730262/8.0),
+ REAL_CONST(140706.49930400858/8.0),
+ REAL_CONST(140732.32352555645/8.0),
+ REAL_CONST(140758.1489318375/8.0),
+ REAL_CONST(140783.97552274304/8.0),
+ REAL_CONST(140809.80329816442/8.0),
+ REAL_CONST(140835.63225799298/8.0),
+ REAL_CONST(140861.46240212015/8.0),
+ REAL_CONST(140887.29373043729/8.0),
+ REAL_CONST(140913.12624283586/8.0),
+ REAL_CONST(140938.95993920733/8.0),
+ REAL_CONST(140964.79481944317/8.0),
+ REAL_CONST(140990.63088343487/8.0),
+ REAL_CONST(141016.46813107401/8.0),
+ REAL_CONST(141042.30656225214/8.0),
+ REAL_CONST(141068.14617686081/8.0),
+ REAL_CONST(141093.98697479168/8.0),
+ REAL_CONST(141119.82895593636/8.0),
+ REAL_CONST(141145.6721201865/8.0),
+ REAL_CONST(141171.51646743377/8.0),
+ REAL_CONST(141197.36199756994/8.0),
+ REAL_CONST(141223.20871048668/8.0),
+ REAL_CONST(141249.05660607578/8.0),
+ REAL_CONST(141274.90568422904/8.0),
+ REAL_CONST(141300.75594483822/8.0),
+ REAL_CONST(141326.6073877952/8.0),
+ REAL_CONST(141352.4600129918/8.0),
+ REAL_CONST(141378.31382031992/8.0),
+ REAL_CONST(141404.16880967148/8.0),
+ REAL_CONST(141430.02498093838/8.0),
+ REAL_CONST(141455.8823340126/8.0),
+ REAL_CONST(141481.74086878612/8.0),
+ REAL_CONST(141507.60058515094/8.0),
+ REAL_CONST(141533.46148299909/8.0),
+ REAL_CONST(141559.32356222265/8.0),
+ REAL_CONST(141585.18682271364/8.0),
+ REAL_CONST(141611.05126436421/8.0),
+ REAL_CONST(141636.9168870665/8.0),
+ REAL_CONST(141662.78369071262/8.0),
+ REAL_CONST(141688.65167519479/8.0),
+ REAL_CONST(141714.5208404052/8.0),
+ REAL_CONST(141740.39118623605/8.0),
+ REAL_CONST(141766.26271257963/8.0),
+ REAL_CONST(141792.1354193282/8.0),
+ REAL_CONST(141818.00930637406/8.0),
+ REAL_CONST(141843.88437360956/8.0),
+ REAL_CONST(141869.760620927/8.0),
+ REAL_CONST(141895.6380482188/8.0),
+ REAL_CONST(141921.51665537735/8.0),
+ REAL_CONST(141947.39644229505/8.0),
+ REAL_CONST(141973.27740886438/8.0),
+ REAL_CONST(141999.15955497778/8.0),
+ REAL_CONST(142025.04288052776/8.0),
+ REAL_CONST(142050.92738540689/8.0),
+ REAL_CONST(142076.81306950765/8.0),
+ REAL_CONST(142102.69993272264/8.0),
+ REAL_CONST(142128.58797494444/8.0),
+ REAL_CONST(142154.47719606571/8.0),
+ REAL_CONST(142180.36759597904/8.0),
+ REAL_CONST(142206.25917457714/8.0),
+ REAL_CONST(142232.15193175265/8.0),
+ REAL_CONST(142258.04586739838/8.0),
+ REAL_CONST(142283.94098140698/8.0),
+ REAL_CONST(142309.83727367126/8.0),
+ REAL_CONST(142335.73474408401/8.0),
+ REAL_CONST(142361.63339253806/8.0),
+ REAL_CONST(142387.5332189262/8.0),
+ REAL_CONST(142413.43422314132/8.0),
+ REAL_CONST(142439.33640507635/8.0),
+ REAL_CONST(142465.23976462413/8.0),
+ REAL_CONST(142491.14430167765/8.0),
+ REAL_CONST(142517.05001612983/8.0),
+ REAL_CONST(142542.95690787368/8.0),
+ REAL_CONST(142568.86497680223/8.0),
+ REAL_CONST(142594.77422280848/8.0),
+ REAL_CONST(142620.68464578551/8.0),
+ REAL_CONST(142646.5962456264/8.0),
+ REAL_CONST(142672.50902222423/8.0),
+ REAL_CONST(142698.42297547215/8.0),
+ REAL_CONST(142724.33810526333/8.0),
+ REAL_CONST(142750.25441149093/8.0),
+ REAL_CONST(142776.17189404817/8.0),
+ REAL_CONST(142802.09055282827/8.0),
+ REAL_CONST(142828.01038772447/8.0),
+ REAL_CONST(142853.93139863008/8.0),
+ REAL_CONST(142879.85358543837/8.0),
+ REAL_CONST(142905.77694804268/8.0),
+ REAL_CONST(142931.70148633636/8.0),
+ REAL_CONST(142957.62720021277/8.0),
+ REAL_CONST(142983.55408956532/8.0),
+ REAL_CONST(143009.48215428743/8.0),
+ REAL_CONST(143035.41139427255/8.0),
+ REAL_CONST(143061.34180941415/8.0),
+ REAL_CONST(143087.27339960571/8.0),
+ REAL_CONST(143113.20616474075/8.0),
+ REAL_CONST(143139.14010471283/8.0),
+ REAL_CONST(143165.07521941551/8.0),
+ REAL_CONST(143191.01150874238/8.0),
+ REAL_CONST(143216.94897258704/8.0),
+ REAL_CONST(143242.88761084314/8.0),
+ REAL_CONST(143268.82742340435/8.0),
+ REAL_CONST(143294.76841016437/8.0),
+ REAL_CONST(143320.71057101688/8.0),
+ REAL_CONST(143346.65390585564/8.0),
+ REAL_CONST(143372.59841457437/8.0),
+ REAL_CONST(143398.54409706692/8.0),
+ REAL_CONST(143424.49095322701/8.0),
+ REAL_CONST(143450.43898294857/8.0),
+ REAL_CONST(143476.38818612538/8.0),
+ REAL_CONST(143502.33856265133/8.0),
+ REAL_CONST(143528.29011242036/8.0),
+ REAL_CONST(143554.24283532638/8.0),
+ REAL_CONST(143580.19673126334/8.0),
+ REAL_CONST(143606.1518001252/8.0),
+ REAL_CONST(143632.10804180597/8.0),
+ REAL_CONST(143658.06545619969/8.0),
+ REAL_CONST(143684.02404320039/8.0),
+ REAL_CONST(143709.98380270213/8.0),
+ REAL_CONST(143735.944734599/8.0),
+ REAL_CONST(143761.90683878519/8.0),
+ REAL_CONST(143787.87011515474/8.0),
+ REAL_CONST(143813.83456360188/8.0),
+ REAL_CONST(143839.8001840208/8.0),
+ REAL_CONST(143865.76697630569/8.0),
+ REAL_CONST(143891.73494035081/8.0),
+ REAL_CONST(143917.7040760504/8.0),
+ REAL_CONST(143943.67438329876/8.0),
+ REAL_CONST(143969.6458619902/8.0),
+ REAL_CONST(143995.61851201905/8.0),
+ REAL_CONST(144021.59233327967/8.0),
+ REAL_CONST(144047.56732566646/8.0),
+ REAL_CONST(144073.54348907378/8.0),
+ REAL_CONST(144099.52082339607/8.0),
+ REAL_CONST(144125.49932852783/8.0),
+ REAL_CONST(144151.4790043635/8.0),
+ REAL_CONST(144177.45985079758/8.0),
+ REAL_CONST(144203.44186772458/8.0),
+ REAL_CONST(144229.42505503909/8.0),
+ REAL_CONST(144255.40941263564/8.0),
+ REAL_CONST(144281.39494040885/8.0),
+ REAL_CONST(144307.38163825331/8.0),
+ REAL_CONST(144333.36950606373/8.0),
+ REAL_CONST(144359.35854373468/8.0),
+ REAL_CONST(144385.34875116093/8.0),
+ REAL_CONST(144411.34012823718/8.0),
+ REAL_CONST(144437.33267485813/8.0),
+ REAL_CONST(144463.32639091855/8.0),
+ REAL_CONST(144489.32127631325/8.0),
+ REAL_CONST(144515.31733093705/8.0),
+ REAL_CONST(144541.31455468474/8.0),
+ REAL_CONST(144567.3129474512/8.0),
+ REAL_CONST(144593.3125091313/8.0),
+ REAL_CONST(144619.31323961995/8.0),
+ REAL_CONST(144645.31513881206/8.0),
+ REAL_CONST(144671.31820660262/8.0),
+ REAL_CONST(144697.32244288657/8.0),
+ REAL_CONST(144723.32784755889/8.0),
+ REAL_CONST(144749.33442051467/8.0),
+ REAL_CONST(144775.34216164888/8.0),
+ REAL_CONST(144801.35107085665/8.0),
+ REAL_CONST(144827.36114803303/8.0),
+ REAL_CONST(144853.37239307314/8.0),
+ REAL_CONST(144879.38480587213/8.0),
+ REAL_CONST(144905.39838632516/8.0),
+ REAL_CONST(144931.41313432742/8.0),
+ REAL_CONST(144957.4290497741/8.0),
+ REAL_CONST(144983.44613256046/8.0),
+ REAL_CONST(145009.46438258173/8.0),
+ REAL_CONST(145035.48379973322/8.0),
+ REAL_CONST(145061.50438391021/8.0),
+ REAL_CONST(145087.52613500805/8.0),
+ REAL_CONST(145113.54905292206/8.0),
+ REAL_CONST(145139.57313754765/8.0),
+ REAL_CONST(145165.59838878017/8.0),
+ REAL_CONST(145191.62480651509/8.0),
+ REAL_CONST(145217.65239064783/8.0),
+ REAL_CONST(145243.68114107384/8.0),
+ REAL_CONST(145269.71105768863/8.0),
+ REAL_CONST(145295.74214038774/8.0),
+ REAL_CONST(145321.77438906668/8.0),
+ REAL_CONST(145347.80780362099/8.0),
+ REAL_CONST(145373.84238394629/8.0),
+ REAL_CONST(145399.87812993818/8.0),
+ REAL_CONST(145425.91504149229/8.0),
+ REAL_CONST(145451.95311850426/8.0),
+ REAL_CONST(145477.9923608698/8.0),
+ REAL_CONST(145504.03276848458/8.0),
+ REAL_CONST(145530.07434124436/8.0),
+ REAL_CONST(145556.11707904484/8.0),
+ REAL_CONST(145582.16098178181/8.0),
+ REAL_CONST(145608.20604935108/8.0),
+ REAL_CONST(145634.25228164849/8.0),
+ REAL_CONST(145660.29967856981/8.0),
+ REAL_CONST(145686.34824001096/8.0),
+ REAL_CONST(145712.39796586783/8.0),
+ REAL_CONST(145738.4488560363/8.0),
+ REAL_CONST(145764.50091041232/8.0),
+ REAL_CONST(145790.55412889185/8.0),
+ REAL_CONST(145816.60851137087/8.0),
+ REAL_CONST(145842.66405774537/8.0),
+ REAL_CONST(145868.72076791141/8.0),
+ REAL_CONST(145894.77864176501/8.0),
+ REAL_CONST(145920.83767920226/8.0),
+ REAL_CONST(145946.89788011924/8.0),
+ REAL_CONST(145972.95924441208/8.0),
+ REAL_CONST(145999.02177197693/8.0),
+ REAL_CONST(146025.08546270995/8.0),
+ REAL_CONST(146051.15031650732/8.0),
+ REAL_CONST(146077.21633326527/8.0),
+ REAL_CONST(146103.28351288004/8.0),
+ REAL_CONST(146129.35185524789/8.0),
+ REAL_CONST(146155.42136026506/8.0),
+ REAL_CONST(146181.49202782792/8.0),
+ REAL_CONST(146207.56385783272/8.0),
+ REAL_CONST(146233.63685017588/8.0),
+ REAL_CONST(146259.71100475377/8.0),
+ REAL_CONST(146285.78632146274/8.0),
+ REAL_CONST(146311.86280019928/8.0),
+ REAL_CONST(146337.94044085976/8.0),
+ REAL_CONST(146364.01924334071/8.0),
+ REAL_CONST(146390.09920753856/8.0),
+ REAL_CONST(146416.18033334985/8.0),
+ REAL_CONST(146442.26262067116/8.0),
+ REAL_CONST(146468.34606939898/8.0),
+ REAL_CONST(146494.43067942993/8.0),
+ REAL_CONST(146520.51645066062/8.0),
+ REAL_CONST(146546.60338298764/8.0),
+ REAL_CONST(146572.69147630769/8.0),
+ REAL_CONST(146598.78073051744/8.0),
+ REAL_CONST(146624.87114551352/8.0),
+ REAL_CONST(146650.96272119274/8.0),
+ REAL_CONST(146677.05545745179/8.0),
+ REAL_CONST(146703.14935418745/8.0),
+ REAL_CONST(146729.2444112965/8.0),
+ REAL_CONST(146755.34062867577/8.0),
+ REAL_CONST(146781.43800622207/8.0),
+ REAL_CONST(146807.53654383228/8.0),
+ REAL_CONST(146833.63624140329/8.0),
+ REAL_CONST(146859.73709883197/8.0),
+ REAL_CONST(146885.83911601527/8.0),
+ REAL_CONST(146911.94229285014/8.0),
+ REAL_CONST(146938.04662923355/8.0),
+ REAL_CONST(146964.15212506248/8.0),
+ REAL_CONST(146990.25878023397/8.0),
+ REAL_CONST(147016.36659464505/8.0),
+ REAL_CONST(147042.47556819281/8.0),
+ REAL_CONST(147068.58570077427/8.0),
+ REAL_CONST(147094.6969922866/8.0),
+ REAL_CONST(147120.80944262692/8.0),
+ REAL_CONST(147146.92305169237/8.0),
+ REAL_CONST(147173.03781938017/8.0),
+ REAL_CONST(147199.15374558745/8.0),
+ REAL_CONST(147225.27083021149/8.0),
+ REAL_CONST(147251.38907314953/8.0),
+ REAL_CONST(147277.50847429881/8.0),
+ REAL_CONST(147303.62903355664/8.0),
+ REAL_CONST(147329.75075082036/8.0),
+ REAL_CONST(147355.87362598727/8.0),
+ REAL_CONST(147381.99765895473/8.0),
+ REAL_CONST(147408.12284962015/8.0),
+ REAL_CONST(147434.24919788091/8.0),
+ REAL_CONST(147460.37670363448/8.0),
+ REAL_CONST(147486.50536677826/8.0),
+ REAL_CONST(147512.63518720976/8.0),
+ REAL_CONST(147538.76616482646/8.0),
+ REAL_CONST(147564.89829952587/8.0),
+ REAL_CONST(147591.03159120557/8.0),
+ REAL_CONST(147617.16603976308/8.0),
+ REAL_CONST(147643.30164509601/8.0),
+ REAL_CONST(147669.43840710199/8.0),
+ REAL_CONST(147695.57632567859/8.0),
+ REAL_CONST(147721.71540072354/8.0),
+ REAL_CONST(147747.85563213445/8.0),
+ REAL_CONST(147773.99701980909/8.0),
+ REAL_CONST(147800.13956364512/8.0),
+ REAL_CONST(147826.28326354033/8.0),
+ REAL_CONST(147852.42811939248/8.0),
+ REAL_CONST(147878.57413109933/8.0),
+ REAL_CONST(147904.72129855872/8.0),
+ REAL_CONST(147930.86962166851/8.0),
+ REAL_CONST(147957.01910032652/8.0),
+ REAL_CONST(147983.16973443062/8.0),
+ REAL_CONST(148009.32152387875/8.0),
+ REAL_CONST(148035.47446856883/8.0),
+ REAL_CONST(148061.62856839882/8.0),
+ REAL_CONST(148087.78382326665/8.0),
+ REAL_CONST(148113.94023307035/8.0),
+ REAL_CONST(148140.09779770792/8.0),
+ REAL_CONST(148166.25651707739/8.0),
+ REAL_CONST(148192.41639107687/8.0),
+ REAL_CONST(148218.57741960438/8.0),
+ REAL_CONST(148244.73960255808/8.0),
+ REAL_CONST(148270.90293983606/8.0),
+ REAL_CONST(148297.0674313365/8.0),
+ REAL_CONST(148323.23307695755/8.0),
+ REAL_CONST(148349.39987659742/8.0),
+ REAL_CONST(148375.56783015432/8.0),
+ REAL_CONST(148401.73693752653/8.0),
+ REAL_CONST(148427.90719861226/8.0),
+ REAL_CONST(148454.07861330983/8.0),
+ REAL_CONST(148480.25118151752/8.0),
+ REAL_CONST(148506.42490313368/8.0),
+ REAL_CONST(148532.59977805667/8.0),
+ REAL_CONST(148558.77580618486/8.0),
+ REAL_CONST(148584.95298741665/8.0),
+ REAL_CONST(148611.13132165043/8.0),
+ REAL_CONST(148637.31080878471/8.0),
+ REAL_CONST(148663.49144871789/8.0),
+ REAL_CONST(148689.6732413485/8.0),
+ REAL_CONST(148715.85618657502/8.0),
+ REAL_CONST(148742.040284296/8.0),
+ REAL_CONST(148768.22553440998/8.0),
+ REAL_CONST(148794.41193681557/8.0),
+ REAL_CONST(148820.59949141133/8.0),
+ REAL_CONST(148846.78819809589/8.0),
+ REAL_CONST(148872.97805676793/8.0),
+ REAL_CONST(148899.16906732606/8.0),
+ REAL_CONST(148925.36122966901/8.0),
+ REAL_CONST(148951.55454369547/8.0),
+ REAL_CONST(148977.74900930419/8.0),
+ REAL_CONST(149003.9446263939/8.0),
+ REAL_CONST(149030.1413948634/8.0),
+ REAL_CONST(149056.33931461151/8.0),
+ REAL_CONST(149082.53838553699/8.0),
+ REAL_CONST(149108.73860753875/8.0),
+ REAL_CONST(149134.9399805156/8.0),
+ REAL_CONST(149161.14250436646/8.0),
+ REAL_CONST(149187.34617899026/8.0),
+ REAL_CONST(149213.5510042859/8.0),
+ REAL_CONST(149239.75698015234/8.0),
+ REAL_CONST(149265.96410648854/8.0),
+ REAL_CONST(149292.17238319354/8.0),
+ REAL_CONST(149318.38181016635/8.0),
+ REAL_CONST(149344.59238730598/8.0),
+ REAL_CONST(149370.80411451156/8.0),
+ REAL_CONST(149397.01699168212/8.0),
+ REAL_CONST(149423.23101871679/8.0),
+ REAL_CONST(149449.44619551473/8.0),
+ REAL_CONST(149475.66252197503/8.0),
+ REAL_CONST(149501.87999799693/8.0),
+ REAL_CONST(149528.0986234796/8.0),
+ REAL_CONST(149554.31839832227/8.0),
+ REAL_CONST(149580.53932242419/8.0),
+ REAL_CONST(149606.76139568459/8.0),
+ REAL_CONST(149632.98461800278/8.0),
+ REAL_CONST(149659.20898927809/8.0),
+ REAL_CONST(149685.43450940982/8.0),
+ REAL_CONST(149711.66117829733/8.0),
+ REAL_CONST(149737.88899584001/8.0),
+ REAL_CONST(149764.11796193724/8.0),
+ REAL_CONST(149790.34807648844/8.0),
+ REAL_CONST(149816.57933939309/8.0),
+ REAL_CONST(149842.81175055061/8.0),
+ REAL_CONST(149869.04530986046/8.0),
+ REAL_CONST(149895.28001722222/8.0),
+ REAL_CONST(149921.51587253538/8.0),
+ REAL_CONST(149947.75287569952/8.0),
+ REAL_CONST(149973.99102661415/8.0),
+ REAL_CONST(150000.23032517891/8.0),
+ REAL_CONST(150026.47077129342/8.0),
+ REAL_CONST(150052.71236485732/8.0),
+ REAL_CONST(150078.95510577026/8.0),
+ REAL_CONST(150105.1989939319/8.0),
+ REAL_CONST(150131.444029242/8.0),
+ REAL_CONST(150157.69021160025/8.0),
+ REAL_CONST(150183.93754090639/8.0),
+ REAL_CONST(150210.18601706024/8.0),
+ REAL_CONST(150236.43563996154/8.0),
+ REAL_CONST(150262.68640951012/8.0),
+ REAL_CONST(150288.93832560582/8.0),
+ REAL_CONST(150315.19138814852/8.0),
+ REAL_CONST(150341.44559703805/8.0),
+ REAL_CONST(150367.70095217437/8.0),
+ REAL_CONST(150393.95745345735/8.0),
+ REAL_CONST(150420.21510078697/8.0),
+ REAL_CONST(150446.47389406321/8.0),
+ REAL_CONST(150472.73383318601/8.0),
+ REAL_CONST(150498.99491805542/8.0),
+ REAL_CONST(150525.25714857146/8.0),
+ REAL_CONST(150551.52052463419/8.0),
+ REAL_CONST(150577.78504614369/8.0),
+ REAL_CONST(150604.05071300003/8.0),
+ REAL_CONST(150630.31752510337/8.0),
+ REAL_CONST(150656.58548235384/8.0),
+ REAL_CONST(150682.85458465159/8.0),
+ REAL_CONST(150709.1248318968/8.0),
+ REAL_CONST(150735.39622398972/8.0),
+ REAL_CONST(150761.66876083051/8.0),
+ REAL_CONST(150787.9424423195/8.0),
+ REAL_CONST(150814.21726835691/8.0),
+ REAL_CONST(150840.49323884305/8.0),
+ REAL_CONST(150866.77035367821/8.0),
+ REAL_CONST(150893.04861276277/8.0),
+ REAL_CONST(150919.32801599705/8.0),
+ REAL_CONST(150945.60856328148/8.0),
+ REAL_CONST(150971.89025451642/8.0),
+ REAL_CONST(150998.17308960229/8.0),
+ REAL_CONST(151024.45706843957/8.0),
+ REAL_CONST(151050.74219092872/8.0),
+ REAL_CONST(151077.02845697021/8.0),
+ REAL_CONST(151103.31586646455/8.0),
+ REAL_CONST(151129.60441931229/8.0),
+ REAL_CONST(151155.894115414/8.0),
+ REAL_CONST(151182.1849546702/8.0),
+ REAL_CONST(151208.47693698155/8.0),
+ REAL_CONST(151234.77006224863/8.0),
+ REAL_CONST(151261.06433037209/8.0),
+ REAL_CONST(151287.35974125259/8.0),
+ REAL_CONST(151313.65629479082/8.0),
+ REAL_CONST(151339.95399088747/8.0),
+ REAL_CONST(151366.25282944329/8.0),
+ REAL_CONST(151392.55281035902/8.0),
+ REAL_CONST(151418.85393353543/8.0),
+ REAL_CONST(151445.1561988733/8.0),
+ REAL_CONST(151471.45960627345/8.0),
+ REAL_CONST(151497.76415563675/8.0),
+ REAL_CONST(151524.06984686397/8.0),
+ REAL_CONST(151550.37667985607/8.0),
+ REAL_CONST(151576.68465451393/8.0),
+ REAL_CONST(151602.99377073845/8.0),
+ REAL_CONST(151629.30402843058/8.0),
+ REAL_CONST(151655.61542749128/8.0),
+ REAL_CONST(151681.92796782157/8.0),
+ REAL_CONST(151708.24164932242/8.0),
+ REAL_CONST(151734.55647189484/8.0),
+ REAL_CONST(151760.87243543993/8.0),
+ REAL_CONST(151787.18953985872/8.0),
+ REAL_CONST(151813.50778505235/8.0),
+ REAL_CONST(151839.82717092187/8.0),
+ REAL_CONST(151866.14769736846/8.0),
+ REAL_CONST(151892.46936429327/8.0),
+ REAL_CONST(151918.79217159748/8.0),
+ REAL_CONST(151945.11611918229/8.0),
+ REAL_CONST(151971.44120694889/8.0),
+ REAL_CONST(151997.76743479856/8.0),
+ REAL_CONST(152024.09480263255/8.0),
+ REAL_CONST(152050.42331035214/8.0),
+ REAL_CONST(152076.75295785864/8.0),
+ REAL_CONST(152103.08374505339/8.0),
+ REAL_CONST(152129.41567183775/8.0),
+ REAL_CONST(152155.74873811303/8.0),
+ REAL_CONST(152182.08294378067/8.0),
+ REAL_CONST(152208.41828874208/8.0),
+ REAL_CONST(152234.75477289871/8.0),
+ REAL_CONST(152261.09239615197/8.0),
+ REAL_CONST(152287.43115840337/8.0),
+ REAL_CONST(152313.77105955439/8.0),
+ REAL_CONST(152340.11209950657/8.0),
+ REAL_CONST(152366.45427816146/8.0),
+ REAL_CONST(152392.79759542056/8.0),
+ REAL_CONST(152419.14205118554/8.0),
+ REAL_CONST(152445.48764535793/8.0),
+ REAL_CONST(152471.8343778394/8.0),
+ REAL_CONST(152498.18224853161/8.0),
+ REAL_CONST(152524.53125733617/8.0),
+ REAL_CONST(152550.88140415482/8.0),
+ REAL_CONST(152577.23268888926/8.0),
+ REAL_CONST(152603.58511144121/8.0),
+ REAL_CONST(152629.93867171241/8.0),
+ REAL_CONST(152656.29336960468/8.0),
+ REAL_CONST(152682.64920501978/8.0),
+ REAL_CONST(152709.00617785956/8.0),
+ REAL_CONST(152735.36428802583/8.0),
+ REAL_CONST(152761.72353542043/8.0),
+ REAL_CONST(152788.08391994529/8.0),
+ REAL_CONST(152814.44544150229/8.0),
+ REAL_CONST(152840.80809999333/8.0),
+ REAL_CONST(152867.17189532038/8.0),
+ REAL_CONST(152893.53682738543/8.0),
+ REAL_CONST(152919.90289609041/8.0),
+ REAL_CONST(152946.27010133737/8.0),
+ REAL_CONST(152972.63844302832/8.0),
+ REAL_CONST(152999.00792106529/8.0),
+ REAL_CONST(153025.37853535041/8.0),
+ REAL_CONST(153051.7502857857/8.0),
+ REAL_CONST(153078.12317227334/8.0),
+ REAL_CONST(153104.4971947154/8.0),
+ REAL_CONST(153130.8723530141/8.0),
+ REAL_CONST(153157.24864707157/8.0),
+ REAL_CONST(153183.62607679001/8.0),
+ REAL_CONST(153210.00464207167/8.0),
+ REAL_CONST(153236.38434281875/8.0),
+ REAL_CONST(153262.76517893354/8.0),
+ REAL_CONST(153289.14715031831/8.0),
+ REAL_CONST(153315.53025687535/8.0),
+ REAL_CONST(153341.91449850702/8.0),
+ REAL_CONST(153368.2998751156/8.0),
+ REAL_CONST(153394.68638660354/8.0),
+ REAL_CONST(153421.07403287315/8.0),
+ REAL_CONST(153447.46281382689/8.0),
+ REAL_CONST(153473.85272936718/8.0),
+ REAL_CONST(153500.24377939643/8.0),
+ REAL_CONST(153526.63596381716/8.0),
+ REAL_CONST(153553.02928253182/8.0),
+ REAL_CONST(153579.42373544298/8.0),
+ REAL_CONST(153605.81932245308/8.0),
+ REAL_CONST(153632.21604346478/8.0),
+ REAL_CONST(153658.61389838057/8.0),
+ REAL_CONST(153685.0128871031/8.0),
+ REAL_CONST(153711.41300953497/8.0),
+ REAL_CONST(153737.81426557881/8.0),
+ REAL_CONST(153764.21665513728/8.0),
+ REAL_CONST(153790.62017811305/8.0),
+ REAL_CONST(153817.02483440886/8.0),
+ REAL_CONST(153843.43062392739/8.0),
+ REAL_CONST(153869.83754657139/8.0),
+ REAL_CONST(153896.24560224367/8.0),
+ REAL_CONST(153922.65479084692/8.0),
+ REAL_CONST(153949.06511228404/8.0),
+ REAL_CONST(153975.4765664578/8.0),
+ REAL_CONST(154001.88915327107/8.0),
+ REAL_CONST(154028.30287262669/8.0),
+ REAL_CONST(154054.71772442761/8.0),
+ REAL_CONST(154081.13370857667/8.0),
+ REAL_CONST(154107.55082497682/8.0),
+ REAL_CONST(154133.96907353101/8.0),
+ REAL_CONST(154160.38845414223/8.0),
+ REAL_CONST(154186.80896671346/8.0),
+ REAL_CONST(154213.23061114774/8.0),
+ REAL_CONST(154239.65338734805/8.0),
+ REAL_CONST(154266.07729521746/8.0),
+ REAL_CONST(154292.50233465908/8.0),
+ REAL_CONST(154318.92850557598/8.0),
+ REAL_CONST(154345.35580787127/8.0),
+ REAL_CONST(154371.7842414481/8.0),
+ REAL_CONST(154398.21380620965/8.0),
+ REAL_CONST(154424.64450205903/8.0),
+ REAL_CONST(154451.07632889951/8.0),
+ REAL_CONST(154477.50928663427/8.0),
+ REAL_CONST(154503.94337516659/8.0),
+ REAL_CONST(154530.37859439969/8.0),
+ REAL_CONST(154556.81494423689/8.0),
+ REAL_CONST(154583.25242458144/8.0),
+ REAL_CONST(154609.69103533673/8.0),
+ REAL_CONST(154636.13077640603/8.0),
+ REAL_CONST(154662.57164769279/8.0),
+ REAL_CONST(154689.01364910032/8.0),
+ REAL_CONST(154715.45678053208/8.0),
+ REAL_CONST(154741.90104189145/8.0),
+ REAL_CONST(154768.34643308193/8.0),
+ REAL_CONST(154794.79295400696/8.0),
+ REAL_CONST(154821.24060457002/8.0),
+ REAL_CONST(154847.68938467462/8.0),
+ REAL_CONST(154874.13929422433/8.0),
+ REAL_CONST(154900.59033312264/8.0),
+ REAL_CONST(154927.04250127316/8.0),
+ REAL_CONST(154953.49579857948/8.0),
+ REAL_CONST(154979.95022494521/8.0),
+ REAL_CONST(155006.40578027396/8.0),
+ REAL_CONST(155032.86246446942/8.0),
+ REAL_CONST(155059.32027743524/8.0),
+ REAL_CONST(155085.77921907514/8.0),
+ REAL_CONST(155112.2392892928/8.0),
+ REAL_CONST(155138.70048799197/8.0),
+ REAL_CONST(155165.16281507642/8.0),
+ REAL_CONST(155191.62627044989/8.0),
+ REAL_CONST(155218.09085401625/8.0),
+ REAL_CONST(155244.55656567923/8.0),
+ REAL_CONST(155271.02340534274/8.0),
+ REAL_CONST(155297.49137291059/8.0),
+ REAL_CONST(155323.96046828668/8.0),
+ REAL_CONST(155350.4306913749/8.0),
+ REAL_CONST(155376.90204207919/8.0),
+ REAL_CONST(155403.37452030348/8.0),
+ REAL_CONST(155429.84812595171/8.0),
+ REAL_CONST(155456.32285892789/8.0),
+ REAL_CONST(155482.79871913602/8.0),
+ REAL_CONST(155509.27570648011/8.0),
+ REAL_CONST(155535.75382086422/8.0),
+ REAL_CONST(155562.23306219239/8.0),
+ REAL_CONST(155588.71343036872/8.0),
+ REAL_CONST(155615.19492529731/8.0),
+ REAL_CONST(155641.67754688227/8.0),
+ REAL_CONST(155668.16129502779/8.0),
+ REAL_CONST(155694.64616963797/8.0),
+ REAL_CONST(155721.13217061706/8.0),
+ REAL_CONST(155747.61929786921/8.0),
+ REAL_CONST(155774.10755129869/8.0),
+ REAL_CONST(155800.59693080973/8.0),
+ REAL_CONST(155827.08743630661/8.0),
+ REAL_CONST(155853.57906769359/8.0),
+ REAL_CONST(155880.07182487496/8.0),
+ REAL_CONST(155906.56570775513/8.0),
+ REAL_CONST(155933.06071623837/8.0),
+ REAL_CONST(155959.55685022907/8.0),
+ REAL_CONST(155986.05410963166/8.0),
+ REAL_CONST(156012.5524943505/8.0),
+ REAL_CONST(156039.05200429002/8.0),
+ REAL_CONST(156065.55263935472/8.0),
+ REAL_CONST(156092.054399449/8.0),
+ REAL_CONST(156118.5572844774/8.0),
+ REAL_CONST(156145.06129434443/8.0),
+ REAL_CONST(156171.5664289546/8.0),
+ REAL_CONST(156198.07268821247/8.0),
+ REAL_CONST(156224.5800720226/8.0),
+ REAL_CONST(156251.08858028959/8.0),
+ REAL_CONST(156277.59821291809/8.0),
+ REAL_CONST(156304.10896981266/8.0),
+ REAL_CONST(156330.62085087801/8.0),
+ REAL_CONST(156357.1338560188/8.0),
+ REAL_CONST(156383.64798513969/8.0),
+ REAL_CONST(156410.16323814544/8.0),
+ REAL_CONST(156436.67961494075/8.0),
+ REAL_CONST(156463.1971154304/8.0),
+ REAL_CONST(156489.71573951913/8.0),
+ REAL_CONST(156516.23548711176/8.0),
+ REAL_CONST(156542.75635811311/8.0),
+ REAL_CONST(156569.27835242799/8.0),
+ REAL_CONST(156595.80146996127/8.0),
+ REAL_CONST(156622.32571061782/8.0),
+ REAL_CONST(156648.85107430254/8.0),
+ REAL_CONST(156675.37756092031/8.0),
+ REAL_CONST(156701.90517037612/8.0),
+ REAL_CONST(156728.43390257491/8.0),
+ REAL_CONST(156754.96375742162/8.0),
+ REAL_CONST(156781.49473482129/8.0),
+ REAL_CONST(156808.02683467892/8.0),
+ REAL_CONST(156834.5600568995/8.0),
+ REAL_CONST(156861.09440138817/8.0),
+ REAL_CONST(156887.62986804993/8.0),
+ REAL_CONST(156914.16645678994/8.0),
+ REAL_CONST(156940.70416751326/8.0),
+ REAL_CONST(156967.24300012505/8.0),
+ REAL_CONST(156993.78295453047/8.0),
+ REAL_CONST(157020.32403063469/8.0),
+ REAL_CONST(157046.8662283429/8.0),
+ REAL_CONST(157073.40954756032/8.0),
+ REAL_CONST(157099.9539881922/8.0),
+ REAL_CONST(157126.49955014378/8.0),
+ REAL_CONST(157153.04623332032/8.0),
+ REAL_CONST(157179.59403762716/8.0),
+ REAL_CONST(157206.14296296958/8.0),
+ REAL_CONST(157232.69300925292/8.0),
+ REAL_CONST(157259.24417638258/8.0),
+ REAL_CONST(157285.79646426387/8.0),
+ REAL_CONST(157312.34987280221/8.0),
+ REAL_CONST(157338.90440190304/8.0),
+ REAL_CONST(157365.46005147175/8.0),
+ REAL_CONST(157392.01682141385/8.0),
+ REAL_CONST(157418.57471163478/8.0),
+ REAL_CONST(157445.13372204005/8.0),
+ REAL_CONST(157471.69385253513/8.0),
+ REAL_CONST(157498.25510302564/8.0),
+ REAL_CONST(157524.81747341706/8.0),
+ REAL_CONST(157551.38096361503/8.0),
+ REAL_CONST(157577.9455735251/8.0),
+ REAL_CONST(157604.51130305286/8.0),
+ REAL_CONST(157631.07815210402/8.0),
+ REAL_CONST(157657.64612058419/8.0),
+ REAL_CONST(157684.21520839902/8.0),
+ REAL_CONST(157710.78541545427/8.0),
+ REAL_CONST(157737.35674165559/8.0),
+ REAL_CONST(157763.92918690876/8.0),
+ REAL_CONST(157790.50275111952/8.0),
+ REAL_CONST(157817.07743419363/8.0),
+ REAL_CONST(157843.65323603692/8.0),
+ REAL_CONST(157870.23015655516/8.0),
+ REAL_CONST(157896.80819565422/8.0),
+ REAL_CONST(157923.3873532399/8.0),
+ REAL_CONST(157949.96762921812/8.0),
+ REAL_CONST(157976.54902349479/8.0),
+ REAL_CONST(158003.13153597576/8.0),
+ REAL_CONST(158029.71516656701/8.0),
+ REAL_CONST(158056.29991517449/8.0),
+ REAL_CONST(158082.88578170416/8.0),
+ REAL_CONST(158109.47276606198/8.0),
+ REAL_CONST(158136.06086815402/8.0),
+ REAL_CONST(158162.65008788629/8.0),
+ REAL_CONST(158189.24042516484/8.0),
+ REAL_CONST(158215.83187989573/8.0),
+ REAL_CONST(158242.42445198505/8.0),
+ REAL_CONST(158269.01814133892/8.0),
+ REAL_CONST(158295.61294786347/8.0),
+ REAL_CONST(158322.20887146486/8.0),
+ REAL_CONST(158348.80591204923/8.0),
+ REAL_CONST(158375.4040695228/8.0),
+ REAL_CONST(158402.00334379176/8.0),
+ REAL_CONST(158428.60373476235/8.0),
+ REAL_CONST(158455.2052423408/8.0),
+ REAL_CONST(158481.80786643337/8.0),
+ REAL_CONST(158508.41160694641/8.0),
+ REAL_CONST(158535.01646378616/8.0),
+ REAL_CONST(158561.62243685898/8.0),
+ REAL_CONST(158588.2295260712/8.0),
+ REAL_CONST(158614.8377313292/8.0),
+ REAL_CONST(158641.44705253936/8.0),
+ REAL_CONST(158668.05748960807/8.0),
+ REAL_CONST(158694.66904244179/8.0),
+ REAL_CONST(158721.28171094693/8.0),
+ REAL_CONST(158747.89549502998/8.0),
+ REAL_CONST(158774.5103945974/8.0),
+ REAL_CONST(158801.12640955573/8.0),
+ REAL_CONST(158827.74353981143/8.0),
+ REAL_CONST(158854.36178527112/8.0),
+ REAL_CONST(158880.9811458413/8.0),
+ REAL_CONST(158907.60162142856/8.0),
+ REAL_CONST(158934.22321193956/8.0),
+ REAL_CONST(158960.84591728085/8.0),
+ REAL_CONST(158987.46973735912/8.0),
+ REAL_CONST(159014.09467208097/8.0),
+ REAL_CONST(159040.72072135314/8.0),
+ REAL_CONST(159067.3478850823/8.0),
+ REAL_CONST(159093.97616317519/8.0),
+ REAL_CONST(159120.60555553852/8.0),
+ REAL_CONST(159147.23606207906/8.0),
+ REAL_CONST(159173.8676827036/8.0),
+ REAL_CONST(159200.50041731889/8.0),
+ REAL_CONST(159227.13426583182/8.0),
+ REAL_CONST(159253.76922814918/8.0),
+ REAL_CONST(159280.40530417781/8.0),
+ REAL_CONST(159307.04249382461/8.0),
+ REAL_CONST(159333.68079699649/8.0),
+ REAL_CONST(159360.32021360032/8.0),
+ REAL_CONST(159386.96074354305/8.0),
+ REAL_CONST(159413.60238673165/8.0),
+ REAL_CONST(159440.24514307309/8.0),
+ REAL_CONST(159466.88901247433/8.0),
+ REAL_CONST(159493.53399484244/8.0),
+ REAL_CONST(159520.18009008438/8.0),
+ REAL_CONST(159546.82729810724/8.0),
+ REAL_CONST(159573.47561881805/8.0),
+ REAL_CONST(159600.12505212394/8.0),
+ REAL_CONST(159626.77559793202/8.0),
+ REAL_CONST(159653.42725614941/8.0),
+ REAL_CONST(159680.08002668325/8.0),
+ REAL_CONST(159706.73390944069/8.0),
+ REAL_CONST(159733.38890432892/8.0),
+ REAL_CONST(159760.04501125516/8.0),
+ REAL_CONST(159786.70223012666/8.0),
+ REAL_CONST(159813.36056085059/8.0),
+ REAL_CONST(159840.02000333427/8.0),
+ REAL_CONST(159866.68055748497/8.0),
+ REAL_CONST(159893.34222320997/8.0),
+ REAL_CONST(159920.00500041663/8.0),
+ REAL_CONST(159946.66888901225/8.0),
+ REAL_CONST(159973.33388890422/8.0),
+ REAL_CONST(159999.99999999988/8.0),
+ REAL_CONST(160026.66722220668/8.0),
+ REAL_CONST(160053.33555543202/8.0),
+ REAL_CONST(160080.0049995833/8.0),
+ REAL_CONST(160106.67555456801/8.0),
+ REAL_CONST(160133.3472202936/8.0),
+ REAL_CONST(160160.0199966676/8.0),
+ REAL_CONST(160186.6938835975/8.0),
+ REAL_CONST(160213.36888099083/8.0),
+ REAL_CONST(160240.04498875517/8.0),
+ REAL_CONST(160266.72220679806/8.0),
+ REAL_CONST(160293.40053502709/8.0),
+ REAL_CONST(160320.07997334987/8.0),
+ REAL_CONST(160346.76052167406/8.0),
+ REAL_CONST(160373.44217990729/8.0),
+ REAL_CONST(160400.1249479572/8.0),
+ REAL_CONST(160426.80882573154/8.0),
+ REAL_CONST(160453.49381313793/8.0),
+ REAL_CONST(160480.17991008417/8.0),
+ REAL_CONST(160506.86711647795/8.0),
+ REAL_CONST(160533.55543222709/8.0),
+ REAL_CONST(160560.24485723933/8.0),
+ REAL_CONST(160586.93539142248/8.0),
+ REAL_CONST(160613.62703468435/8.0),
+ REAL_CONST(160640.31978693281/8.0),
+ REAL_CONST(160667.01364807569/8.0),
+ REAL_CONST(160693.70861802087/8.0),
+ REAL_CONST(160720.40469667627/8.0),
+ REAL_CONST(160747.1018839498/8.0),
+ REAL_CONST(160773.80017974938/8.0),
+ REAL_CONST(160800.49958398298/8.0),
+ REAL_CONST(160827.20009655855/8.0),
+ REAL_CONST(160853.90171738411/8.0),
+ REAL_CONST(160880.60444636765/8.0),
+ REAL_CONST(160907.30828341722/8.0),
+ REAL_CONST(160934.01322844089/8.0),
+ REAL_CONST(160960.71928134665/8.0),
+ REAL_CONST(160987.42644204266/8.0),
+ REAL_CONST(161014.13471043704/8.0),
+ REAL_CONST(161040.84408643784/8.0),
+ REAL_CONST(161067.55456995327/8.0),
+ REAL_CONST(161094.26616089148/8.0),
+ REAL_CONST(161120.97885916062/8.0),
+ REAL_CONST(161147.69266466892/8.0),
+ REAL_CONST(161174.40757732463/8.0),
+ REAL_CONST(161201.12359703594/8.0),
+ REAL_CONST(161227.84072371112/8.0),
+ REAL_CONST(161254.55895725847/8.0),
+ REAL_CONST(161281.27829758628/8.0),
+ REAL_CONST(161307.99874460287/8.0),
+ REAL_CONST(161334.72029821656/8.0),
+ REAL_CONST(161361.44295833571/8.0),
+ REAL_CONST(161388.1667248687/8.0),
+ REAL_CONST(161414.89159772391/8.0),
+ REAL_CONST(161441.61757680977/8.0),
+ REAL_CONST(161468.34466203468/8.0),
+ REAL_CONST(161495.07285330712/8.0),
+ REAL_CONST(161521.80215053557/8.0),
+ REAL_CONST(161548.53255362847/8.0),
+ REAL_CONST(161575.26406249436/8.0),
+ REAL_CONST(161601.99667704175/8.0),
+ REAL_CONST(161628.7303971792/8.0),
+ REAL_CONST(161655.46522281526/8.0),
+ REAL_CONST(161682.20115385848/8.0),
+ REAL_CONST(161708.93819021754/8.0),
+ REAL_CONST(161735.67633180099/8.0),
+ REAL_CONST(161762.41557851751/8.0),
+ REAL_CONST(161789.15593027571/8.0),
+ REAL_CONST(161815.89738698432/8.0),
+ REAL_CONST(161842.63994855201/8.0),
+ REAL_CONST(161869.38361488748/8.0),
+ REAL_CONST(161896.1283858995/8.0),
+ REAL_CONST(161922.87426149679/8.0),
+ REAL_CONST(161949.62124158812/8.0),
+ REAL_CONST(161976.36932608229/8.0),
+ REAL_CONST(162003.1185148881/8.0),
+ REAL_CONST(162029.8688079144/8.0),
+ REAL_CONST(162056.62020507001/8.0),
+ REAL_CONST(162083.37270626382/8.0),
+ REAL_CONST(162110.12631140469/8.0),
+ REAL_CONST(162136.88102040152/8.0),
+ REAL_CONST(162163.63683316324/8.0),
+ REAL_CONST(162190.39374959879/8.0),
+ REAL_CONST(162217.15176961714/8.0),
+ REAL_CONST(162243.91089312723/8.0),
+ REAL_CONST(162270.67112003808/8.0),
+ REAL_CONST(162297.43245025873/8.0),
+ REAL_CONST(162324.19488369819/8.0),
+ REAL_CONST(162350.9584202655/8.0),
+ REAL_CONST(162377.72305986975/8.0),
+ REAL_CONST(162404.48880242003/8.0),
+ REAL_CONST(162431.25564782543/8.0),
+ REAL_CONST(162458.02359599507/8.0),
+ REAL_CONST(162484.79264683815/8.0),
+ REAL_CONST(162511.56280026378/8.0),
+ REAL_CONST(162538.33405618116/8.0),
+ REAL_CONST(162565.10641449949/8.0),
+ REAL_CONST(162591.87987512801/8.0),
+ REAL_CONST(162618.65443797593/8.0),
+ REAL_CONST(162645.43010295252/8.0),
+ REAL_CONST(162672.20686996708/8.0),
+ REAL_CONST(162698.98473892888/8.0),
+ REAL_CONST(162725.76370974723/8.0),
+ REAL_CONST(162752.54378233149/8.0),
+ REAL_CONST(162779.32495659095/8.0),
+ REAL_CONST(162806.10723243505/8.0),
+ REAL_CONST(162832.89060977317/8.0),
+ REAL_CONST(162859.67508851466/8.0),
+ REAL_CONST(162886.46066856899/8.0),
+ REAL_CONST(162913.24734984562/8.0),
+ REAL_CONST(162940.03513225398/8.0),
+ REAL_CONST(162966.82401570358/8.0),
+ REAL_CONST(162993.6140001039/8.0),
+ REAL_CONST(163020.40508536444/8.0),
+ REAL_CONST(163047.19727139481/8.0),
+ REAL_CONST(163073.99055810447/8.0),
+ REAL_CONST(163100.78494540305/8.0),
+ REAL_CONST(163127.58043320014/8.0),
+ REAL_CONST(163154.37702140535/8.0),
+ REAL_CONST(163181.17470992831/8.0),
+ REAL_CONST(163207.97349867865/8.0),
+ REAL_CONST(163234.77338756606/8.0),
+ REAL_CONST(163261.57437650024/8.0),
+ REAL_CONST(163288.37646539087/8.0),
+ REAL_CONST(163315.17965414765/8.0),
+ REAL_CONST(163341.98394268038/8.0),
+ REAL_CONST(163368.78933089875/8.0),
+ REAL_CONST(163395.59581871261/8.0),
+ REAL_CONST(163422.40340603172/8.0),
+ REAL_CONST(163449.2120927659/8.0),
+ REAL_CONST(163476.02187882498/8.0),
+ REAL_CONST(163502.83276411882/8.0),
+ REAL_CONST(163529.6447485573/8.0),
+ REAL_CONST(163556.45783205028/8.0),
+ REAL_CONST(163583.2720145077/8.0),
+ REAL_CONST(163610.08729583945/8.0),
+ REAL_CONST(163636.90367595552/8.0),
+ REAL_CONST(163663.72115476584/8.0),
+ REAL_CONST(163690.53973218042/8.0),
+ REAL_CONST(163717.35940810922/8.0),
+ REAL_CONST(163744.18018246227/8.0),
+ REAL_CONST(163771.00205514964/8.0),
+ REAL_CONST(163797.82502608138/8.0),
+ REAL_CONST(163824.64909516752/8.0),
+ REAL_CONST(163851.4742623182/8.0),
+ REAL_CONST(163878.3005274435/8.0),
+ REAL_CONST(163905.12789045356/8.0),
+ REAL_CONST(163931.95635125853/8.0),
+ REAL_CONST(163958.78590976857/8.0),
+ REAL_CONST(163985.61656589387/8.0),
+ REAL_CONST(164012.44831954464/8.0),
+ REAL_CONST(164039.28117063109/8.0),
+ REAL_CONST(164066.11511906344/8.0),
+ REAL_CONST(164092.95016475199/8.0),
+ REAL_CONST(164119.78630760699/8.0),
+ REAL_CONST(164146.62354753874/8.0),
+ REAL_CONST(164173.46188445756/8.0),
+ REAL_CONST(164200.30131827376/8.0),
+ REAL_CONST(164227.14184889771/8.0),
+ REAL_CONST(164253.98347623978/8.0),
+ REAL_CONST(164280.82620021031/8.0),
+ REAL_CONST(164307.67002071979/8.0),
+ REAL_CONST(164334.51493767856/8.0),
+ REAL_CONST(164361.3609509971/8.0),
+ REAL_CONST(164388.20806058586/8.0),
+ REAL_CONST(164415.05626635533/8.0),
+ REAL_CONST(164441.905568216/8.0),
+ REAL_CONST(164468.75596607837/8.0),
+ REAL_CONST(164495.607459853/8.0),
+ REAL_CONST(164522.4600494504/8.0),
+ REAL_CONST(164549.31373478117/8.0),
+ REAL_CONST(164576.16851575591/8.0),
+ REAL_CONST(164603.02439228518/8.0),
+ REAL_CONST(164629.88136427966/8.0),
+ REAL_CONST(164656.73943164994/8.0),
+ REAL_CONST(164683.59859430668/8.0),
+ REAL_CONST(164710.45885216061/8.0),
+ REAL_CONST(164737.32020512238/8.0),
+ REAL_CONST(164764.1826531027/8.0),
+ REAL_CONST(164791.04619601235/8.0),
+ REAL_CONST(164817.91083376206/8.0),
+ REAL_CONST(164844.77656626256/8.0),
+ REAL_CONST(164871.64339342469/8.0),
+ REAL_CONST(164898.51131515924/8.0),
+ REAL_CONST(164925.38033137703/8.0),
+ REAL_CONST(164952.25044198887/8.0),
+ REAL_CONST(164979.1216469057/8.0),
+ REAL_CONST(165005.9939460383/8.0),
+ REAL_CONST(165032.86733929763/8.0),
+ REAL_CONST(165059.7418265946/8.0),
+ REAL_CONST(165086.61740784015/8.0),
+ REAL_CONST(165113.4940829452/8.0)
#endif
- };
+};
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/is.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/is.c
index 704e5c46b..5236db077 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/is.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/is.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,8 +35,7 @@
#include "is.h"
#ifdef FIXED_POINT
-static real_t pow05_table[] =
-{
+static real_t pow05_table[] = {
COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
@@ -58,17 +57,17 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
int32_t exp, frac;
#endif
- uint16_t nshort = frame_len / 8;
+ uint16_t nshort = frame_len/8;
uint8_t group = 0;
- for(g = 0; g < icsr->num_window_groups; g++)
+ for (g = 0; g < icsr->num_window_groups; g++)
{
/* Do intensity stereo decoding */
- for(b = 0; b < icsr->window_group_length[g]; b++)
+ for (b = 0; b < icsr->window_group_length[g]; b++)
{
- for(sfb = 0; sfb < icsr->max_sfb; sfb++)
+ for (sfb = 0; sfb < icsr->max_sfb; sfb++)
{
- if(is_intensity(icsr, g, sfb))
+ if (is_intensity(icsr, g, sfb))
{
#ifdef MAIN_DEC
/* For scalefactor bands coded in intensity stereo the
@@ -80,7 +79,7 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
#endif
#ifndef FIXED_POINT
- scale = (real_t)pow(0.5, (0.25 * icsr->scale_factors[g][sfb]));
+ scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
#else
exp = icsr->scale_factors[g][sfb] >> 2;
frac = icsr->scale_factors[g][sfb] & 3;
@@ -88,18 +87,18 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
/* Scale from left to right channel,
do not touch left channel */
- for(i = icsr->swb_offset[sfb]; i < min(icsr->swb_offset[sfb+1], ics->swb_offset_max); i++)
+ for (i = icsr->swb_offset[sfb]; i < min(icsr->swb_offset[sfb+1], ics->swb_offset_max); i++)
{
#ifndef FIXED_POINT
r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
#else
- if(exp < 0)
+ if (exp < 0)
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
else
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
#endif
- if(is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
+ if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/is.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/is.h
index b4ebfc36d..3e3b750ab 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/is.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/is.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,28 +37,28 @@ extern "C" {
#include "syntax.h"
- void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
- uint16_t frame_len);
+void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+ uint16_t frame_len);
- static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+ switch (ics->sfb_cb[group][sfb])
{
- switch(ics->sfb_cb[group][sfb])
- {
- case INTENSITY_HCB:
- return 1;
- case INTENSITY_HCB2:
- return -1;
- default:
- return 0;
- }
- }
-
- static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
- {
- if(ics->ms_mask_present == 1)
- return (1 - 2 * ics->ms_used[group][sfb]);
+ case INTENSITY_HCB:
return 1;
+ case INTENSITY_HCB2:
+ return -1;
+ default:
+ return 0;
}
+}
+
+static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+ if (ics->ms_mask_present == 1)
+ return (1-2*ics->ms_used[group][sfb]);
+ return 1;
+}
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/kbd_win.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/kbd_win.h
index 9e5449702..de404c7ea 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/kbd_win.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/kbd_win.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -40,2256 +40,2255 @@ extern "C" {
#pragma warning(disable:4244)
#endif
- ALIGN static const real_t kbd_long_1024[] =
- {
- FRAC_CONST(0.00029256153896361),
- FRAC_CONST(0.00042998567353047),
- FRAC_CONST(0.00054674074589540),
- FRAC_CONST(0.00065482304299792),
- FRAC_CONST(0.00075870195068747),
- FRAC_CONST(0.00086059331713336),
- FRAC_CONST(0.00096177541439010),
- FRAC_CONST(0.0010630609410878),
- FRAC_CONST(0.0011650036308132),
- FRAC_CONST(0.0012680012194148),
- FRAC_CONST(0.0013723517232956),
- FRAC_CONST(0.0014782864109136),
- FRAC_CONST(0.0015859901976719),
- FRAC_CONST(0.0016956148252373),
- FRAC_CONST(0.0018072876903517),
- FRAC_CONST(0.0019211179405514),
- FRAC_CONST(0.0020372007924215),
- FRAC_CONST(0.0021556206591754),
- FRAC_CONST(0.0022764534599614),
- FRAC_CONST(0.0023997683540995),
- FRAC_CONST(0.0025256290631156),
- FRAC_CONST(0.0026540948920831),
- FRAC_CONST(0.0027852215281403),
- FRAC_CONST(0.0029190616715331),
- FRAC_CONST(0.0030556655443223),
- FRAC_CONST(0.0031950812943391),
- FRAC_CONST(0.0033373553240392),
- FRAC_CONST(0.0034825325586930),
- FRAC_CONST(0.0036306566699199),
- FRAC_CONST(0.0037817702604646),
- FRAC_CONST(0.0039359150179719),
- FRAC_CONST(0.0040931318437260),
- FRAC_CONST(0.0042534609610026),
- FRAC_CONST(0.0044169420066964),
- FRAC_CONST(0.0045836141091341),
- FRAC_CONST(0.0047535159544086),
- FRAC_CONST(0.0049266858431214),
- FRAC_CONST(0.0051031617390698),
- FRAC_CONST(0.0052829813111335),
- FRAC_CONST(0.0054661819693975),
- FRAC_CONST(0.0056528008963682),
- FRAC_CONST(0.0058428750739943),
- FRAC_CONST(0.0060364413070882),
- FRAC_CONST(0.0062335362436492),
- FRAC_CONST(0.0064341963925079),
- FRAC_CONST(0.0066384581386503),
- FRAC_CONST(0.0068463577565218),
- FRAC_CONST(0.0070579314215715),
- FRAC_CONST(0.0072732152202559),
- FRAC_CONST(0.0074922451586909),
- FRAC_CONST(0.0077150571701162),
- FRAC_CONST(0.0079416871213115),
- FRAC_CONST(0.0081721708180857),
- FRAC_CONST(0.0084065440099458),
- FRAC_CONST(0.0086448423940363),
- FRAC_CONST(0.0088871016184291),
- FRAC_CONST(0.0091333572848345),
- FRAC_CONST(0.0093836449507939),
- FRAC_CONST(0.0096380001314086),
- FRAC_CONST(0.0098964583006517),
- FRAC_CONST(0.010159054892306),
- FRAC_CONST(0.010425825300561),
- FRAC_CONST(0.010696804880310),
- FRAC_CONST(0.010972028947167),
- FRAC_CONST(0.011251532777236),
- FRAC_CONST(0.011535351606646),
- FRAC_CONST(0.011823520630897),
- FRAC_CONST(0.012116075003993),
- FRAC_CONST(0.012413049837429),
- FRAC_CONST(0.012714480198999),
- FRAC_CONST(0.013020401111478),
- FRAC_CONST(0.013330847551161),
- FRAC_CONST(0.013645854446288),
- FRAC_CONST(0.013965456675352),
- FRAC_CONST(0.014289689065314),
- FRAC_CONST(0.014618586389712),
- FRAC_CONST(0.014952183366697),
- FRAC_CONST(0.015290514656976),
- FRAC_CONST(0.015633614861688),
- FRAC_CONST(0.015981518520214),
- FRAC_CONST(0.016334260107915),
- FRAC_CONST(0.016691874033817),
- FRAC_CONST(0.017054394638241),
- FRAC_CONST(0.017421856190380),
- FRAC_CONST(0.017794292885832),
- FRAC_CONST(0.018171738844085),
- FRAC_CONST(0.018554228105962),
- FRAC_CONST(0.018941794631032),
- FRAC_CONST(0.019334472294980),
- FRAC_CONST(0.019732294886947),
- FRAC_CONST(0.020135296106839),
- FRAC_CONST(0.020543509562604),
- FRAC_CONST(0.020956968767488),
- FRAC_CONST(0.021375707137257),
- FRAC_CONST(0.021799757987407),
- FRAC_CONST(0.022229154530343),
- FRAC_CONST(0.022663929872540),
- FRAC_CONST(0.023104117011689),
- FRAC_CONST(0.023549748833816),
- FRAC_CONST(0.024000858110398),
- FRAC_CONST(0.024457477495451),
- FRAC_CONST(0.024919639522613),
- FRAC_CONST(0.025387376602207),
- FRAC_CONST(0.025860721018295),
- FRAC_CONST(0.026339704925726),
- FRAC_CONST(0.026824360347160),
- FRAC_CONST(0.027314719170100),
- FRAC_CONST(0.027810813143900),
- FRAC_CONST(0.028312673876775),
- FRAC_CONST(0.028820332832801),
- FRAC_CONST(0.029333821328905),
- FRAC_CONST(0.029853170531859),
- FRAC_CONST(0.030378411455255),
- FRAC_CONST(0.030909574956490),
- FRAC_CONST(0.031446691733739),
- FRAC_CONST(0.031989792322926),
- FRAC_CONST(0.032538907094693),
- FRAC_CONST(0.033094066251369),
- FRAC_CONST(0.033655299823935),
- FRAC_CONST(0.034222637668991),
- FRAC_CONST(0.034796109465717),
- FRAC_CONST(0.035375744712844),
- FRAC_CONST(0.035961572725616),
- FRAC_CONST(0.036553622632758),
- FRAC_CONST(0.037151923373446),
- FRAC_CONST(0.037756503694277),
- FRAC_CONST(0.038367392146243),
- FRAC_CONST(0.038984617081711),
- FRAC_CONST(0.039608206651398),
- FRAC_CONST(0.040238188801359),
- FRAC_CONST(0.040874591269976),
- FRAC_CONST(0.041517441584950),
- FRAC_CONST(0.042166767060301),
- FRAC_CONST(0.042822594793376),
- FRAC_CONST(0.043484951661852),
- FRAC_CONST(0.044153864320760),
- FRAC_CONST(0.044829359199509),
- FRAC_CONST(0.045511462498913),
- FRAC_CONST(0.046200200188234),
- FRAC_CONST(0.046895598002228),
- FRAC_CONST(0.047597681438201),
- FRAC_CONST(0.048306475753074),
- FRAC_CONST(0.049022005960455),
- FRAC_CONST(0.049744296827725),
- FRAC_CONST(0.050473372873129),
- FRAC_CONST(0.051209258362879),
- FRAC_CONST(0.051951977308273),
- FRAC_CONST(0.052701553462813),
- FRAC_CONST(0.053458010319350),
- FRAC_CONST(0.054221371107223),
- FRAC_CONST(0.054991658789428),
- FRAC_CONST(0.055768896059787),
- FRAC_CONST(0.056553105340134),
- FRAC_CONST(0.057344308777513),
- FRAC_CONST(0.058142528241393),
- FRAC_CONST(0.058947785320893),
- FRAC_CONST(0.059760101322019),
- FRAC_CONST(0.060579497264926),
- FRAC_CONST(0.061405993881180),
- FRAC_CONST(0.062239611611049),
- FRAC_CONST(0.063080370600799),
- FRAC_CONST(0.063928290700012),
- FRAC_CONST(0.064783391458919),
- FRAC_CONST(0.065645692125747),
- FRAC_CONST(0.066515211644086),
- FRAC_CONST(0.067391968650269),
- FRAC_CONST(0.068275981470777),
- FRAC_CONST(0.069167268119652),
- FRAC_CONST(0.070065846295935),
- FRAC_CONST(0.070971733381121),
- FRAC_CONST(0.071884946436630),
- FRAC_CONST(0.072805502201299),
- FRAC_CONST(0.073733417088896),
- FRAC_CONST(0.074668707185649),
- FRAC_CONST(0.075611388247794),
- FRAC_CONST(0.076561475699152),
- FRAC_CONST(0.077518984628715),
- FRAC_CONST(0.078483929788261),
- FRAC_CONST(0.079456325589986),
- FRAC_CONST(0.080436186104162),
- FRAC_CONST(0.081423525056808),
- FRAC_CONST(0.082418355827392),
- FRAC_CONST(0.083420691446553),
- FRAC_CONST(0.084430544593841),
- FRAC_CONST(0.085447927595483),
- FRAC_CONST(0.086472852422178),
- FRAC_CONST(0.087505330686900),
- FRAC_CONST(0.088545373642744),
- FRAC_CONST(0.089592992180780),
- FRAC_CONST(0.090648196827937),
- FRAC_CONST(0.091710997744919),
- FRAC_CONST(0.092781404724131),
- FRAC_CONST(0.093859427187640),
- FRAC_CONST(0.094945074185163),
- FRAC_CONST(0.096038354392069),
- FRAC_CONST(0.097139276107423),
- FRAC_CONST(0.098247847252041),
- FRAC_CONST(0.099364075366580),
- FRAC_CONST(0.10048796760965),
- FRAC_CONST(0.10161953075597),
- FRAC_CONST(0.10275877119451),
- FRAC_CONST(0.10390569492671),
- FRAC_CONST(0.10506030756469),
- FRAC_CONST(0.10622261432949),
- FRAC_CONST(0.10739262004941),
- FRAC_CONST(0.10857032915821),
- FRAC_CONST(0.10975574569357),
- FRAC_CONST(0.11094887329534),
- FRAC_CONST(0.11214971520402),
- FRAC_CONST(0.11335827425914),
- FRAC_CONST(0.11457455289772),
- FRAC_CONST(0.11579855315274),
- FRAC_CONST(0.11703027665170),
- FRAC_CONST(0.11826972461510),
- FRAC_CONST(0.11951689785504),
- FRAC_CONST(0.12077179677383),
- FRAC_CONST(0.12203442136263),
- FRAC_CONST(0.12330477120008),
- FRAC_CONST(0.12458284545102),
- FRAC_CONST(0.12586864286523),
- FRAC_CONST(0.12716216177615),
- FRAC_CONST(0.12846340009971),
- FRAC_CONST(0.12977235533312),
- FRAC_CONST(0.13108902455375),
- FRAC_CONST(0.13241340441801),
- FRAC_CONST(0.13374549116025),
- FRAC_CONST(0.13508528059173),
- FRAC_CONST(0.13643276809961),
- FRAC_CONST(0.13778794864595),
- FRAC_CONST(0.13915081676677),
- FRAC_CONST(0.14052136657114),
- FRAC_CONST(0.14189959174027),
- FRAC_CONST(0.14328548552671),
- FRAC_CONST(0.14467904075349),
- FRAC_CONST(0.14608024981336),
- FRAC_CONST(0.14748910466804),
- FRAC_CONST(0.14890559684750),
- FRAC_CONST(0.15032971744929),
- FRAC_CONST(0.15176145713790),
- FRAC_CONST(0.15320080614414),
- FRAC_CONST(0.15464775426459),
- FRAC_CONST(0.15610229086100),
- FRAC_CONST(0.15756440485987),
- FRAC_CONST(0.15903408475193),
- FRAC_CONST(0.16051131859170),
- FRAC_CONST(0.16199609399712),
- FRAC_CONST(0.16348839814917),
- FRAC_CONST(0.16498821779156),
- FRAC_CONST(0.16649553923042),
- FRAC_CONST(0.16801034833404),
- FRAC_CONST(0.16953263053270),
- FRAC_CONST(0.17106237081842),
- FRAC_CONST(0.17259955374484),
- FRAC_CONST(0.17414416342714),
- FRAC_CONST(0.17569618354193),
- FRAC_CONST(0.17725559732720),
- FRAC_CONST(0.17882238758238),
- FRAC_CONST(0.18039653666830),
- FRAC_CONST(0.18197802650733),
- FRAC_CONST(0.18356683858343),
- FRAC_CONST(0.18516295394233),
- FRAC_CONST(0.18676635319174),
- FRAC_CONST(0.18837701650148),
- FRAC_CONST(0.18999492360384),
- FRAC_CONST(0.19162005379380),
- FRAC_CONST(0.19325238592940),
- FRAC_CONST(0.19489189843209),
- FRAC_CONST(0.19653856928714),
- FRAC_CONST(0.19819237604409),
- FRAC_CONST(0.19985329581721),
- FRAC_CONST(0.20152130528605),
- FRAC_CONST(0.20319638069594),
- FRAC_CONST(0.20487849785865),
- FRAC_CONST(0.20656763215298),
- FRAC_CONST(0.20826375852540),
- FRAC_CONST(0.20996685149083),
- FRAC_CONST(0.21167688513330),
- FRAC_CONST(0.21339383310678),
- FRAC_CONST(0.21511766863598),
- FRAC_CONST(0.21684836451719),
- FRAC_CONST(0.21858589311922),
- FRAC_CONST(0.22033022638425),
- FRAC_CONST(0.22208133582887),
- FRAC_CONST(0.22383919254503),
- FRAC_CONST(0.22560376720111),
- FRAC_CONST(0.22737503004300),
- FRAC_CONST(0.22915295089517),
- FRAC_CONST(0.23093749916189),
- FRAC_CONST(0.23272864382838),
- FRAC_CONST(0.23452635346201),
- FRAC_CONST(0.23633059621364),
- FRAC_CONST(0.23814133981883),
- FRAC_CONST(0.23995855159925),
- FRAC_CONST(0.24178219846403),
- FRAC_CONST(0.24361224691114),
- FRAC_CONST(0.24544866302890),
- FRAC_CONST(0.24729141249740),
- FRAC_CONST(0.24914046059007),
- FRAC_CONST(0.25099577217522),
- FRAC_CONST(0.25285731171763),
- FRAC_CONST(0.25472504328019),
- FRAC_CONST(0.25659893052556),
- FRAC_CONST(0.25847893671788),
- FRAC_CONST(0.26036502472451),
- FRAC_CONST(0.26225715701781),
- FRAC_CONST(0.26415529567692),
- FRAC_CONST(0.26605940238966),
- FRAC_CONST(0.26796943845439),
- FRAC_CONST(0.26988536478190),
- FRAC_CONST(0.27180714189742),
- FRAC_CONST(0.27373472994256),
- FRAC_CONST(0.27566808867736),
- FRAC_CONST(0.27760717748238),
- FRAC_CONST(0.27955195536071),
- FRAC_CONST(0.28150238094021),
- FRAC_CONST(0.28345841247557),
- FRAC_CONST(0.28542000785059),
- FRAC_CONST(0.28738712458038),
- FRAC_CONST(0.28935971981364),
- FRAC_CONST(0.29133775033492),
- FRAC_CONST(0.29332117256704),
- FRAC_CONST(0.29530994257338),
- FRAC_CONST(0.29730401606034),
- FRAC_CONST(0.29930334837974),
- FRAC_CONST(0.30130789453132),
- FRAC_CONST(0.30331760916521),
- FRAC_CONST(0.30533244658452),
- FRAC_CONST(0.30735236074785),
- FRAC_CONST(0.30937730527195),
- FRAC_CONST(0.31140723343430),
- FRAC_CONST(0.31344209817583),
- FRAC_CONST(0.31548185210356),
- FRAC_CONST(0.31752644749341),
- FRAC_CONST(0.31957583629288),
- FRAC_CONST(0.32162997012390),
- FRAC_CONST(0.32368880028565),
- FRAC_CONST(0.32575227775738),
- FRAC_CONST(0.32782035320134),
- FRAC_CONST(0.32989297696566),
- FRAC_CONST(0.33197009908736),
- FRAC_CONST(0.33405166929523),
- FRAC_CONST(0.33613763701295),
- FRAC_CONST(0.33822795136203),
- FRAC_CONST(0.34032256116495),
- FRAC_CONST(0.34242141494820),
- FRAC_CONST(0.34452446094547),
- FRAC_CONST(0.34663164710072),
- FRAC_CONST(0.34874292107143),
- FRAC_CONST(0.35085823023181),
- FRAC_CONST(0.35297752167598),
- FRAC_CONST(0.35510074222129),
- FRAC_CONST(0.35722783841160),
- FRAC_CONST(0.35935875652060),
- FRAC_CONST(0.36149344255514),
- FRAC_CONST(0.36363184225864),
- FRAC_CONST(0.36577390111444),
- FRAC_CONST(0.36791956434930),
- FRAC_CONST(0.37006877693676),
- FRAC_CONST(0.37222148360070),
- FRAC_CONST(0.37437762881878),
- FRAC_CONST(0.37653715682603),
- FRAC_CONST(0.37870001161834),
- FRAC_CONST(0.38086613695607),
- FRAC_CONST(0.38303547636766),
- FRAC_CONST(0.38520797315322),
- FRAC_CONST(0.38738357038821),
- FRAC_CONST(0.38956221092708),
- FRAC_CONST(0.39174383740701),
- FRAC_CONST(0.39392839225157),
- FRAC_CONST(0.39611581767449),
- FRAC_CONST(0.39830605568342),
- FRAC_CONST(0.40049904808370),
- FRAC_CONST(0.40269473648218),
- FRAC_CONST(0.40489306229101),
- FRAC_CONST(0.40709396673153),
- FRAC_CONST(0.40929739083810),
- FRAC_CONST(0.41150327546197),
- FRAC_CONST(0.41371156127524),
- FRAC_CONST(0.41592218877472),
- FRAC_CONST(0.41813509828594),
- FRAC_CONST(0.42035022996702),
- FRAC_CONST(0.42256752381274),
- FRAC_CONST(0.42478691965848),
- FRAC_CONST(0.42700835718423),
- FRAC_CONST(0.42923177591866),
- FRAC_CONST(0.43145711524314),
- FRAC_CONST(0.43368431439580),
- FRAC_CONST(0.43591331247564),
- FRAC_CONST(0.43814404844658),
- FRAC_CONST(0.44037646114161),
- FRAC_CONST(0.44261048926688),
- FRAC_CONST(0.44484607140589),
- FRAC_CONST(0.44708314602359),
- FRAC_CONST(0.44932165147057),
- FRAC_CONST(0.45156152598727),
- FRAC_CONST(0.45380270770813),
- FRAC_CONST(0.45604513466581),
- FRAC_CONST(0.45828874479543),
- FRAC_CONST(0.46053347593880),
- FRAC_CONST(0.46277926584861),
- FRAC_CONST(0.46502605219277),
- FRAC_CONST(0.46727377255861),
- FRAC_CONST(0.46952236445718),
- FRAC_CONST(0.47177176532752),
- FRAC_CONST(0.47402191254100),
- FRAC_CONST(0.47627274340557),
- FRAC_CONST(0.47852419517009),
- FRAC_CONST(0.48077620502869),
- FRAC_CONST(0.48302871012505),
- FRAC_CONST(0.48528164755674),
- FRAC_CONST(0.48753495437962),
- FRAC_CONST(0.48978856761212),
- FRAC_CONST(0.49204242423966),
- FRAC_CONST(0.49429646121898),
- FRAC_CONST(0.49655061548250),
- FRAC_CONST(0.49880482394273),
- FRAC_CONST(0.50105902349665),
- FRAC_CONST(0.50331315103004),
- FRAC_CONST(0.50556714342194),
- FRAC_CONST(0.50782093754901),
- FRAC_CONST(0.51007447028990),
- FRAC_CONST(0.51232767852971),
- FRAC_CONST(0.51458049916433),
- FRAC_CONST(0.51683286910489),
- FRAC_CONST(0.51908472528213),
- FRAC_CONST(0.52133600465083),
- FRAC_CONST(0.52358664419420),
- FRAC_CONST(0.52583658092832),
- FRAC_CONST(0.52808575190648),
- FRAC_CONST(0.53033409422367),
- FRAC_CONST(0.53258154502092),
- FRAC_CONST(0.53482804148974),
- FRAC_CONST(0.53707352087652),
- FRAC_CONST(0.53931792048690),
- FRAC_CONST(0.54156117769021),
- FRAC_CONST(0.54380322992385),
- FRAC_CONST(0.54604401469766),
- FRAC_CONST(0.54828346959835),
- FRAC_CONST(0.55052153229384),
- FRAC_CONST(0.55275814053768),
- FRAC_CONST(0.55499323217338),
- FRAC_CONST(0.55722674513883),
- FRAC_CONST(0.55945861747062),
- FRAC_CONST(0.56168878730842),
- FRAC_CONST(0.56391719289930),
- FRAC_CONST(0.56614377260214),
- FRAC_CONST(0.56836846489188),
- FRAC_CONST(0.57059120836390),
- FRAC_CONST(0.57281194173835),
- FRAC_CONST(0.57503060386439),
- FRAC_CONST(0.57724713372458),
- FRAC_CONST(0.57946147043912),
- FRAC_CONST(0.58167355327012),
- FRAC_CONST(0.58388332162591),
- FRAC_CONST(0.58609071506528),
- FRAC_CONST(0.58829567330173),
- FRAC_CONST(0.59049813620770),
- FRAC_CONST(0.59269804381879),
- FRAC_CONST(0.59489533633802),
- FRAC_CONST(0.59708995413996),
- FRAC_CONST(0.59928183777495),
- FRAC_CONST(0.60147092797329),
- FRAC_CONST(0.60365716564937),
- FRAC_CONST(0.60584049190582),
- FRAC_CONST(0.60802084803764),
- FRAC_CONST(0.61019817553632),
- FRAC_CONST(0.61237241609393),
- FRAC_CONST(0.61454351160718),
- FRAC_CONST(0.61671140418155),
- FRAC_CONST(0.61887603613527),
- FRAC_CONST(0.62103735000336),
- FRAC_CONST(0.62319528854167),
- FRAC_CONST(0.62534979473088),
- FRAC_CONST(0.62750081178042),
- FRAC_CONST(0.62964828313250),
- FRAC_CONST(0.63179215246597),
- FRAC_CONST(0.63393236370030),
- FRAC_CONST(0.63606886099946),
- FRAC_CONST(0.63820158877577),
- FRAC_CONST(0.64033049169379),
- FRAC_CONST(0.64245551467413),
- FRAC_CONST(0.64457660289729),
- FRAC_CONST(0.64669370180740),
- FRAC_CONST(0.64880675711607),
- FRAC_CONST(0.65091571480603),
- FRAC_CONST(0.65302052113494),
- FRAC_CONST(0.65512112263906),
- FRAC_CONST(0.65721746613689),
- FRAC_CONST(0.65930949873289),
- FRAC_CONST(0.66139716782102),
- FRAC_CONST(0.66348042108842),
- FRAC_CONST(0.66555920651892),
- FRAC_CONST(0.66763347239664),
- FRAC_CONST(0.66970316730947),
- FRAC_CONST(0.67176824015260),
- FRAC_CONST(0.67382864013196),
- FRAC_CONST(0.67588431676768),
- FRAC_CONST(0.67793521989751),
- FRAC_CONST(0.67998129968017),
- FRAC_CONST(0.68202250659876),
- FRAC_CONST(0.68405879146403),
- FRAC_CONST(0.68609010541774),
- FRAC_CONST(0.68811639993588),
- FRAC_CONST(0.69013762683195),
- FRAC_CONST(0.69215373826012),
- FRAC_CONST(0.69416468671849),
- FRAC_CONST(0.69617042505214),
- FRAC_CONST(0.69817090645634),
- FRAC_CONST(0.70016608447958),
- FRAC_CONST(0.70215591302664),
- FRAC_CONST(0.70414034636163),
- FRAC_CONST(0.70611933911096),
- FRAC_CONST(0.70809284626630),
- FRAC_CONST(0.71006082318751),
- FRAC_CONST(0.71202322560554),
- FRAC_CONST(0.71398000962530),
- FRAC_CONST(0.71593113172842),
- FRAC_CONST(0.71787654877613),
- FRAC_CONST(0.71981621801195),
- FRAC_CONST(0.72175009706445),
- FRAC_CONST(0.72367814394990),
- FRAC_CONST(0.72560031707496),
- FRAC_CONST(0.72751657523927),
- FRAC_CONST(0.72942687763803),
- FRAC_CONST(0.73133118386457),
- FRAC_CONST(0.73322945391280),
- FRAC_CONST(0.73512164817975),
- FRAC_CONST(0.73700772746796),
- FRAC_CONST(0.73888765298787),
- FRAC_CONST(0.74076138636020),
- FRAC_CONST(0.74262888961827),
- FRAC_CONST(0.74449012521027),
- FRAC_CONST(0.74634505600152),
- FRAC_CONST(0.74819364527663),
- FRAC_CONST(0.75003585674175),
- FRAC_CONST(0.75187165452661),
- FRAC_CONST(0.75370100318668),
- FRAC_CONST(0.75552386770515),
- FRAC_CONST(0.75734021349500),
- FRAC_CONST(0.75915000640095),
- FRAC_CONST(0.76095321270137),
- FRAC_CONST(0.76274979911019),
- FRAC_CONST(0.76453973277875),
- FRAC_CONST(0.76632298129757),
- FRAC_CONST(0.76809951269819),
- FRAC_CONST(0.76986929545481),
- FRAC_CONST(0.77163229848604),
- FRAC_CONST(0.77338849115651),
- FRAC_CONST(0.77513784327849),
- FRAC_CONST(0.77688032511340),
- FRAC_CONST(0.77861590737340),
- FRAC_CONST(0.78034456122283),
- FRAC_CONST(0.78206625827961),
- FRAC_CONST(0.78378097061667),
- FRAC_CONST(0.78548867076330),
- FRAC_CONST(0.78718933170643),
- FRAC_CONST(0.78888292689189),
- FRAC_CONST(0.79056943022564),
- FRAC_CONST(0.79224881607494),
- FRAC_CONST(0.79392105926949),
- FRAC_CONST(0.79558613510249),
- FRAC_CONST(0.79724401933170),
- FRAC_CONST(0.79889468818046),
- FRAC_CONST(0.80053811833858),
- FRAC_CONST(0.80217428696334),
- FRAC_CONST(0.80380317168028),
- FRAC_CONST(0.80542475058405),
- FRAC_CONST(0.80703900223920),
- FRAC_CONST(0.80864590568089),
- FRAC_CONST(0.81024544041560),
- FRAC_CONST(0.81183758642175),
- FRAC_CONST(0.81342232415032),
- FRAC_CONST(0.81499963452540),
- FRAC_CONST(0.81656949894467),
- FRAC_CONST(0.81813189927991),
- FRAC_CONST(0.81968681787738),
- FRAC_CONST(0.82123423755821),
- FRAC_CONST(0.82277414161874),
- FRAC_CONST(0.82430651383076),
- FRAC_CONST(0.82583133844180),
- FRAC_CONST(0.82734860017528),
- FRAC_CONST(0.82885828423070),
- FRAC_CONST(0.83036037628369),
- FRAC_CONST(0.83185486248609),
- FRAC_CONST(0.83334172946597),
- FRAC_CONST(0.83482096432759),
- FRAC_CONST(0.83629255465130),
- FRAC_CONST(0.83775648849344),
- FRAC_CONST(0.83921275438615),
- FRAC_CONST(0.84066134133716),
- FRAC_CONST(0.84210223882952),
- FRAC_CONST(0.84353543682130),
- FRAC_CONST(0.84496092574524),
- FRAC_CONST(0.84637869650833),
- FRAC_CONST(0.84778874049138),
- FRAC_CONST(0.84919104954855),
- FRAC_CONST(0.85058561600677),
- FRAC_CONST(0.85197243266520),
- FRAC_CONST(0.85335149279457),
- FRAC_CONST(0.85472279013653),
- FRAC_CONST(0.85608631890295),
- FRAC_CONST(0.85744207377513),
- FRAC_CONST(0.85879004990298),
- FRAC_CONST(0.86013024290422),
- FRAC_CONST(0.86146264886346),
- FRAC_CONST(0.86278726433124),
- FRAC_CONST(0.86410408632306),
- FRAC_CONST(0.86541311231838),
- FRAC_CONST(0.86671434025950),
- FRAC_CONST(0.86800776855046),
- FRAC_CONST(0.86929339605590),
- FRAC_CONST(0.87057122209981),
- FRAC_CONST(0.87184124646433),
- FRAC_CONST(0.87310346938840),
- FRAC_CONST(0.87435789156650),
- FRAC_CONST(0.87560451414719),
- FRAC_CONST(0.87684333873173),
- FRAC_CONST(0.87807436737261),
- FRAC_CONST(0.87929760257204),
- FRAC_CONST(0.88051304728038),
- FRAC_CONST(0.88172070489456),
- FRAC_CONST(0.88292057925645),
- FRAC_CONST(0.88411267465117),
- FRAC_CONST(0.88529699580537),
- FRAC_CONST(0.88647354788545),
- FRAC_CONST(0.88764233649580),
- FRAC_CONST(0.88880336767692),
- FRAC_CONST(0.88995664790351),
- FRAC_CONST(0.89110218408260),
- FRAC_CONST(0.89223998355154),
- FRAC_CONST(0.89337005407600),
- FRAC_CONST(0.89449240384793),
- FRAC_CONST(0.89560704148345),
- FRAC_CONST(0.89671397602074),
- FRAC_CONST(0.89781321691786),
- FRAC_CONST(0.89890477405053),
- FRAC_CONST(0.89998865770993),
- FRAC_CONST(0.90106487860034),
- FRAC_CONST(0.90213344783689),
- FRAC_CONST(0.90319437694315),
- FRAC_CONST(0.90424767784873),
- FRAC_CONST(0.90529336288690),
- FRAC_CONST(0.90633144479201),
- FRAC_CONST(0.90736193669708),
- FRAC_CONST(0.90838485213119),
- FRAC_CONST(0.90940020501694),
- FRAC_CONST(0.91040800966776),
- FRAC_CONST(0.91140828078533),
- FRAC_CONST(0.91240103345685),
- FRAC_CONST(0.91338628315231),
- FRAC_CONST(0.91436404572173),
- FRAC_CONST(0.91533433739238),
- FRAC_CONST(0.91629717476594),
- FRAC_CONST(0.91725257481564),
- FRAC_CONST(0.91820055488334),
- FRAC_CONST(0.91914113267664),
- FRAC_CONST(0.92007432626589),
- FRAC_CONST(0.92100015408120),
- FRAC_CONST(0.92191863490944),
- FRAC_CONST(0.92282978789113),
- FRAC_CONST(0.92373363251740),
- FRAC_CONST(0.92463018862687),
- FRAC_CONST(0.92551947640245),
- FRAC_CONST(0.92640151636824),
- FRAC_CONST(0.92727632938624),
- FRAC_CONST(0.92814393665320),
- FRAC_CONST(0.92900435969727),
- FRAC_CONST(0.92985762037477),
- FRAC_CONST(0.93070374086684),
- FRAC_CONST(0.93154274367610),
- FRAC_CONST(0.93237465162328),
- FRAC_CONST(0.93319948784382),
- FRAC_CONST(0.93401727578443),
- FRAC_CONST(0.93482803919967),
- FRAC_CONST(0.93563180214841),
- FRAC_CONST(0.93642858899043),
- FRAC_CONST(0.93721842438279),
- FRAC_CONST(0.93800133327637),
- FRAC_CONST(0.93877734091223),
- FRAC_CONST(0.93954647281807),
- FRAC_CONST(0.94030875480458),
- FRAC_CONST(0.94106421296182),
- FRAC_CONST(0.94181287365556),
- FRAC_CONST(0.94255476352362),
- FRAC_CONST(0.94328990947213),
- FRAC_CONST(0.94401833867184),
- FRAC_CONST(0.94474007855439),
- FRAC_CONST(0.94545515680855),
- FRAC_CONST(0.94616360137644),
- FRAC_CONST(0.94686544044975),
- FRAC_CONST(0.94756070246592),
- FRAC_CONST(0.94824941610434),
- FRAC_CONST(0.94893161028248),
- FRAC_CONST(0.94960731415209),
- FRAC_CONST(0.95027655709525),
- FRAC_CONST(0.95093936872056),
- FRAC_CONST(0.95159577885924),
- FRAC_CONST(0.95224581756115),
- FRAC_CONST(0.95288951509097),
- FRAC_CONST(0.95352690192417),
- FRAC_CONST(0.95415800874314),
- FRAC_CONST(0.95478286643320),
- FRAC_CONST(0.95540150607863),
- FRAC_CONST(0.95601395895871),
- FRAC_CONST(0.95662025654373),
- FRAC_CONST(0.95722043049100),
- FRAC_CONST(0.95781451264084),
- FRAC_CONST(0.95840253501260),
- FRAC_CONST(0.95898452980058),
- FRAC_CONST(0.95956052937008),
- FRAC_CONST(0.96013056625336),
- FRAC_CONST(0.96069467314557),
- FRAC_CONST(0.96125288290073),
- FRAC_CONST(0.96180522852773),
- FRAC_CONST(0.96235174318622),
- FRAC_CONST(0.96289246018262),
- FRAC_CONST(0.96342741296604),
- FRAC_CONST(0.96395663512424),
- FRAC_CONST(0.96448016037959),
- FRAC_CONST(0.96499802258499),
- FRAC_CONST(0.96551025571985),
- FRAC_CONST(0.96601689388602),
- FRAC_CONST(0.96651797130376),
- FRAC_CONST(0.96701352230768),
- FRAC_CONST(0.96750358134269),
- FRAC_CONST(0.96798818295998),
- FRAC_CONST(0.96846736181297),
- FRAC_CONST(0.96894115265327),
- FRAC_CONST(0.96940959032667),
- FRAC_CONST(0.96987270976912),
- FRAC_CONST(0.97033054600270),
- FRAC_CONST(0.97078313413161),
- FRAC_CONST(0.97123050933818),
- FRAC_CONST(0.97167270687887),
- FRAC_CONST(0.97210976208030),
- FRAC_CONST(0.97254171033525),
- FRAC_CONST(0.97296858709871),
- FRAC_CONST(0.97339042788392),
- FRAC_CONST(0.97380726825843),
- FRAC_CONST(0.97421914384017),
- FRAC_CONST(0.97462609029350),
- FRAC_CONST(0.97502814332534),
- FRAC_CONST(0.97542533868127),
- FRAC_CONST(0.97581771214160),
- FRAC_CONST(0.97620529951759),
- FRAC_CONST(0.97658813664749),
- FRAC_CONST(0.97696625939282),
- FRAC_CONST(0.97733970363445),
- FRAC_CONST(0.97770850526884),
- FRAC_CONST(0.97807270020427),
- FRAC_CONST(0.97843232435704),
- FRAC_CONST(0.97878741364771),
- FRAC_CONST(0.97913800399743),
- FRAC_CONST(0.97948413132414),
- FRAC_CONST(0.97982583153895),
- FRAC_CONST(0.98016314054243),
- FRAC_CONST(0.98049609422096),
- FRAC_CONST(0.98082472844313),
- FRAC_CONST(0.98114907905608),
- FRAC_CONST(0.98146918188197),
- FRAC_CONST(0.98178507271438),
- FRAC_CONST(0.98209678731477),
- FRAC_CONST(0.98240436140902),
- FRAC_CONST(0.98270783068385),
- FRAC_CONST(0.98300723078342),
- FRAC_CONST(0.98330259730589),
- FRAC_CONST(0.98359396579995),
- FRAC_CONST(0.98388137176152),
- FRAC_CONST(0.98416485063031),
- FRAC_CONST(0.98444443778651),
- FRAC_CONST(0.98472016854752),
- FRAC_CONST(0.98499207816463),
- FRAC_CONST(0.98526020181980),
- FRAC_CONST(0.98552457462240),
- FRAC_CONST(0.98578523160609),
- FRAC_CONST(0.98604220772560),
- FRAC_CONST(0.98629553785362),
- FRAC_CONST(0.98654525677772),
- FRAC_CONST(0.98679139919726),
- FRAC_CONST(0.98703399972035),
- FRAC_CONST(0.98727309286089),
- FRAC_CONST(0.98750871303556),
- FRAC_CONST(0.98774089456089),
- FRAC_CONST(0.98796967165036),
- FRAC_CONST(0.98819507841154),
- FRAC_CONST(0.98841714884323),
- FRAC_CONST(0.98863591683269),
- FRAC_CONST(0.98885141615285),
- FRAC_CONST(0.98906368045957),
- FRAC_CONST(0.98927274328896),
- FRAC_CONST(0.98947863805473),
- FRAC_CONST(0.98968139804554),
- FRAC_CONST(0.98988105642241),
- FRAC_CONST(0.99007764621618),
- FRAC_CONST(0.99027120032501),
- FRAC_CONST(0.99046175151186),
- FRAC_CONST(0.99064933240208),
- FRAC_CONST(0.99083397548099),
- FRAC_CONST(0.99101571309153),
- FRAC_CONST(0.99119457743191),
- FRAC_CONST(0.99137060055337),
- FRAC_CONST(0.99154381435784),
- FRAC_CONST(0.99171425059582),
- FRAC_CONST(0.99188194086414),
- FRAC_CONST(0.99204691660388),
- FRAC_CONST(0.99220920909823),
- FRAC_CONST(0.99236884947045),
- FRAC_CONST(0.99252586868186),
- FRAC_CONST(0.99268029752989),
- FRAC_CONST(0.99283216664606),
- FRAC_CONST(0.99298150649419),
- FRAC_CONST(0.99312834736847),
- FRAC_CONST(0.99327271939167),
- FRAC_CONST(0.99341465251338),
- FRAC_CONST(0.99355417650825),
- FRAC_CONST(0.99369132097430),
- FRAC_CONST(0.99382611533130),
- FRAC_CONST(0.99395858881910),
- FRAC_CONST(0.99408877049612),
- FRAC_CONST(0.99421668923778),
- FRAC_CONST(0.99434237373503),
- FRAC_CONST(0.99446585249289),
- FRAC_CONST(0.99458715382906),
- FRAC_CONST(0.99470630587254),
- FRAC_CONST(0.99482333656229),
- FRAC_CONST(0.99493827364600),
- FRAC_CONST(0.99505114467878),
- FRAC_CONST(0.99516197702200),
- FRAC_CONST(0.99527079784214),
- FRAC_CONST(0.99537763410962),
- FRAC_CONST(0.99548251259777),
- FRAC_CONST(0.99558545988178),
- FRAC_CONST(0.99568650233767),
- FRAC_CONST(0.99578566614138),
- FRAC_CONST(0.99588297726783),
- FRAC_CONST(0.99597846149005),
- FRAC_CONST(0.99607214437834),
- FRAC_CONST(0.99616405129947),
- FRAC_CONST(0.99625420741595),
- FRAC_CONST(0.99634263768527),
- FRAC_CONST(0.99642936685928),
- FRAC_CONST(0.99651441948352),
- FRAC_CONST(0.99659781989663),
- FRAC_CONST(0.99667959222978),
- FRAC_CONST(0.99675976040620),
- FRAC_CONST(0.99683834814063),
- FRAC_CONST(0.99691537893895),
- FRAC_CONST(0.99699087609774),
- FRAC_CONST(0.99706486270391),
- FRAC_CONST(0.99713736163442),
- FRAC_CONST(0.99720839555593),
- FRAC_CONST(0.99727798692461),
- FRAC_CONST(0.99734615798589),
- FRAC_CONST(0.99741293077431),
- FRAC_CONST(0.99747832711337),
- FRAC_CONST(0.99754236861541),
- FRAC_CONST(0.99760507668158),
- FRAC_CONST(0.99766647250181),
- FRAC_CONST(0.99772657705478),
- FRAC_CONST(0.99778541110799),
- FRAC_CONST(0.99784299521785),
- FRAC_CONST(0.99789934972976),
- FRAC_CONST(0.99795449477828),
- FRAC_CONST(0.99800845028730),
- FRAC_CONST(0.99806123597027),
- FRAC_CONST(0.99811287133042),
- FRAC_CONST(0.99816337566108),
- FRAC_CONST(0.99821276804596),
- FRAC_CONST(0.99826106735952),
- FRAC_CONST(0.99830829226732),
- FRAC_CONST(0.99835446122649),
- FRAC_CONST(0.99839959248609),
- FRAC_CONST(0.99844370408765),
- FRAC_CONST(0.99848681386566),
- FRAC_CONST(0.99852893944805),
- FRAC_CONST(0.99857009825685),
- FRAC_CONST(0.99861030750869),
- FRAC_CONST(0.99864958421549),
- FRAC_CONST(0.99868794518504),
- FRAC_CONST(0.99872540702178),
- FRAC_CONST(0.99876198612738),
- FRAC_CONST(0.99879769870160),
- FRAC_CONST(0.99883256074295),
- FRAC_CONST(0.99886658804953),
- FRAC_CONST(0.99889979621983),
- FRAC_CONST(0.99893220065356),
- FRAC_CONST(0.99896381655254),
- FRAC_CONST(0.99899465892154),
- FRAC_CONST(0.99902474256924),
- FRAC_CONST(0.99905408210916),
- FRAC_CONST(0.99908269196056),
- FRAC_CONST(0.99911058634952),
- FRAC_CONST(0.99913777930986),
- FRAC_CONST(0.99916428468421),
- FRAC_CONST(0.99919011612505),
- FRAC_CONST(0.99921528709576),
- FRAC_CONST(0.99923981087174),
- FRAC_CONST(0.99926370054150),
- FRAC_CONST(0.99928696900779),
- FRAC_CONST(0.99930962898876),
- FRAC_CONST(0.99933169301910),
- FRAC_CONST(0.99935317345126),
- FRAC_CONST(0.99937408245662),
- FRAC_CONST(0.99939443202674),
- FRAC_CONST(0.99941423397457),
- FRAC_CONST(0.99943349993572),
- FRAC_CONST(0.99945224136972),
- FRAC_CONST(0.99947046956130),
- FRAC_CONST(0.99948819562171),
- FRAC_CONST(0.99950543049000),
- FRAC_CONST(0.99952218493439),
- FRAC_CONST(0.99953846955355),
- FRAC_CONST(0.99955429477803),
- FRAC_CONST(0.99956967087154),
- FRAC_CONST(0.99958460793242),
- FRAC_CONST(0.99959911589494),
- FRAC_CONST(0.99961320453077),
- FRAC_CONST(0.99962688345035),
- FRAC_CONST(0.99964016210433),
- FRAC_CONST(0.99965304978499),
- FRAC_CONST(0.99966555562769),
- FRAC_CONST(0.99967768861231),
- FRAC_CONST(0.99968945756473),
- FRAC_CONST(0.99970087115825),
- FRAC_CONST(0.99971193791510),
- FRAC_CONST(0.99972266620792),
- FRAC_CONST(0.99973306426121),
- FRAC_CONST(0.99974314015288),
- FRAC_CONST(0.99975290181568),
- FRAC_CONST(0.99976235703876),
- FRAC_CONST(0.99977151346914),
- FRAC_CONST(0.99978037861326),
- FRAC_CONST(0.99978895983845),
- FRAC_CONST(0.99979726437448),
- FRAC_CONST(0.99980529931507),
- FRAC_CONST(0.99981307161943),
- FRAC_CONST(0.99982058811377),
- FRAC_CONST(0.99982785549283),
- FRAC_CONST(0.99983488032144),
- FRAC_CONST(0.99984166903600),
- FRAC_CONST(0.99984822794606),
- FRAC_CONST(0.99985456323584),
- FRAC_CONST(0.99986068096572),
- FRAC_CONST(0.99986658707386),
- FRAC_CONST(0.99987228737764),
- FRAC_CONST(0.99987778757524),
- FRAC_CONST(0.99988309324717),
- FRAC_CONST(0.99988820985777),
- FRAC_CONST(0.99989314275675),
- FRAC_CONST(0.99989789718072),
- FRAC_CONST(0.99990247825468),
- FRAC_CONST(0.99990689099357),
- FRAC_CONST(0.99991114030376),
- FRAC_CONST(0.99991523098456),
- FRAC_CONST(0.99991916772971),
- FRAC_CONST(0.99992295512891),
- FRAC_CONST(0.99992659766930),
- FRAC_CONST(0.99993009973692),
- FRAC_CONST(0.99993346561824),
- FRAC_CONST(0.99993669950161),
- FRAC_CONST(0.99993980547870),
- FRAC_CONST(0.99994278754604),
- FRAC_CONST(0.99994564960642),
- FRAC_CONST(0.99994839547033),
- FRAC_CONST(0.99995102885747),
- FRAC_CONST(0.99995355339809),
- FRAC_CONST(0.99995597263451),
- FRAC_CONST(0.99995829002249),
- FRAC_CONST(0.99996050893264),
- FRAC_CONST(0.99996263265183),
- FRAC_CONST(0.99996466438460),
- FRAC_CONST(0.99996660725452),
- FRAC_CONST(0.99996846430558),
- FRAC_CONST(0.99997023850356),
- FRAC_CONST(0.99997193273736),
- FRAC_CONST(0.99997354982037),
- FRAC_CONST(0.99997509249183),
- FRAC_CONST(0.99997656341810),
- FRAC_CONST(0.99997796519400),
- FRAC_CONST(0.99997930034415),
- FRAC_CONST(0.99998057132421),
- FRAC_CONST(0.99998178052220),
- FRAC_CONST(0.99998293025975),
- FRAC_CONST(0.99998402279338),
- FRAC_CONST(0.99998506031574),
- FRAC_CONST(0.99998604495686),
- FRAC_CONST(0.99998697878536),
- FRAC_CONST(0.99998786380966),
- FRAC_CONST(0.99998870197921),
- FRAC_CONST(0.99998949518567),
- FRAC_CONST(0.99999024526408),
- FRAC_CONST(0.99999095399401),
- FRAC_CONST(0.99999162310077),
- FRAC_CONST(0.99999225425649),
- FRAC_CONST(0.99999284908128),
- FRAC_CONST(0.99999340914435),
- FRAC_CONST(0.99999393596510),
- FRAC_CONST(0.99999443101421),
- FRAC_CONST(0.99999489571473),
- FRAC_CONST(0.99999533144314),
- FRAC_CONST(0.99999573953040),
- FRAC_CONST(0.99999612126300),
- FRAC_CONST(0.99999647788395),
- FRAC_CONST(0.99999681059383),
- FRAC_CONST(0.99999712055178),
- FRAC_CONST(0.99999740887647),
- FRAC_CONST(0.99999767664709),
- FRAC_CONST(0.99999792490431),
- FRAC_CONST(0.99999815465123),
- FRAC_CONST(0.99999836685427),
- FRAC_CONST(0.99999856244415),
- FRAC_CONST(0.99999874231676),
- FRAC_CONST(0.99999890733405),
- FRAC_CONST(0.99999905832493),
- FRAC_CONST(0.99999919608613),
- FRAC_CONST(0.99999932138304),
- FRAC_CONST(0.99999943495056),
- FRAC_CONST(0.99999953749392),
- FRAC_CONST(0.99999962968950),
- FRAC_CONST(0.99999971218563),
- FRAC_CONST(0.99999978560337),
- FRAC_CONST(0.99999985053727),
- FRAC_CONST(0.99999990755616),
- FRAC_CONST(0.99999995720387)
- };
+ALIGN static const real_t kbd_long_1024[] =
+{
+ FRAC_CONST(0.00029256153896361),
+ FRAC_CONST(0.00042998567353047),
+ FRAC_CONST(0.00054674074589540),
+ FRAC_CONST(0.00065482304299792),
+ FRAC_CONST(0.00075870195068747),
+ FRAC_CONST(0.00086059331713336),
+ FRAC_CONST(0.00096177541439010),
+ FRAC_CONST(0.0010630609410878),
+ FRAC_CONST(0.0011650036308132),
+ FRAC_CONST(0.0012680012194148),
+ FRAC_CONST(0.0013723517232956),
+ FRAC_CONST(0.0014782864109136),
+ FRAC_CONST(0.0015859901976719),
+ FRAC_CONST(0.0016956148252373),
+ FRAC_CONST(0.0018072876903517),
+ FRAC_CONST(0.0019211179405514),
+ FRAC_CONST(0.0020372007924215),
+ FRAC_CONST(0.0021556206591754),
+ FRAC_CONST(0.0022764534599614),
+ FRAC_CONST(0.0023997683540995),
+ FRAC_CONST(0.0025256290631156),
+ FRAC_CONST(0.0026540948920831),
+ FRAC_CONST(0.0027852215281403),
+ FRAC_CONST(0.0029190616715331),
+ FRAC_CONST(0.0030556655443223),
+ FRAC_CONST(0.0031950812943391),
+ FRAC_CONST(0.0033373553240392),
+ FRAC_CONST(0.0034825325586930),
+ FRAC_CONST(0.0036306566699199),
+ FRAC_CONST(0.0037817702604646),
+ FRAC_CONST(0.0039359150179719),
+ FRAC_CONST(0.0040931318437260),
+ FRAC_CONST(0.0042534609610026),
+ FRAC_CONST(0.0044169420066964),
+ FRAC_CONST(0.0045836141091341),
+ FRAC_CONST(0.0047535159544086),
+ FRAC_CONST(0.0049266858431214),
+ FRAC_CONST(0.0051031617390698),
+ FRAC_CONST(0.0052829813111335),
+ FRAC_CONST(0.0054661819693975),
+ FRAC_CONST(0.0056528008963682),
+ FRAC_CONST(0.0058428750739943),
+ FRAC_CONST(0.0060364413070882),
+ FRAC_CONST(0.0062335362436492),
+ FRAC_CONST(0.0064341963925079),
+ FRAC_CONST(0.0066384581386503),
+ FRAC_CONST(0.0068463577565218),
+ FRAC_CONST(0.0070579314215715),
+ FRAC_CONST(0.0072732152202559),
+ FRAC_CONST(0.0074922451586909),
+ FRAC_CONST(0.0077150571701162),
+ FRAC_CONST(0.0079416871213115),
+ FRAC_CONST(0.0081721708180857),
+ FRAC_CONST(0.0084065440099458),
+ FRAC_CONST(0.0086448423940363),
+ FRAC_CONST(0.0088871016184291),
+ FRAC_CONST(0.0091333572848345),
+ FRAC_CONST(0.0093836449507939),
+ FRAC_CONST(0.0096380001314086),
+ FRAC_CONST(0.0098964583006517),
+ FRAC_CONST(0.010159054892306),
+ FRAC_CONST(0.010425825300561),
+ FRAC_CONST(0.010696804880310),
+ FRAC_CONST(0.010972028947167),
+ FRAC_CONST(0.011251532777236),
+ FRAC_CONST(0.011535351606646),
+ FRAC_CONST(0.011823520630897),
+ FRAC_CONST(0.012116075003993),
+ FRAC_CONST(0.012413049837429),
+ FRAC_CONST(0.012714480198999),
+ FRAC_CONST(0.013020401111478),
+ FRAC_CONST(0.013330847551161),
+ FRAC_CONST(0.013645854446288),
+ FRAC_CONST(0.013965456675352),
+ FRAC_CONST(0.014289689065314),
+ FRAC_CONST(0.014618586389712),
+ FRAC_CONST(0.014952183366697),
+ FRAC_CONST(0.015290514656976),
+ FRAC_CONST(0.015633614861688),
+ FRAC_CONST(0.015981518520214),
+ FRAC_CONST(0.016334260107915),
+ FRAC_CONST(0.016691874033817),
+ FRAC_CONST(0.017054394638241),
+ FRAC_CONST(0.017421856190380),
+ FRAC_CONST(0.017794292885832),
+ FRAC_CONST(0.018171738844085),
+ FRAC_CONST(0.018554228105962),
+ FRAC_CONST(0.018941794631032),
+ FRAC_CONST(0.019334472294980),
+ FRAC_CONST(0.019732294886947),
+ FRAC_CONST(0.020135296106839),
+ FRAC_CONST(0.020543509562604),
+ FRAC_CONST(0.020956968767488),
+ FRAC_CONST(0.021375707137257),
+ FRAC_CONST(0.021799757987407),
+ FRAC_CONST(0.022229154530343),
+ FRAC_CONST(0.022663929872540),
+ FRAC_CONST(0.023104117011689),
+ FRAC_CONST(0.023549748833816),
+ FRAC_CONST(0.024000858110398),
+ FRAC_CONST(0.024457477495451),
+ FRAC_CONST(0.024919639522613),
+ FRAC_CONST(0.025387376602207),
+ FRAC_CONST(0.025860721018295),
+ FRAC_CONST(0.026339704925726),
+ FRAC_CONST(0.026824360347160),
+ FRAC_CONST(0.027314719170100),
+ FRAC_CONST(0.027810813143900),
+ FRAC_CONST(0.028312673876775),
+ FRAC_CONST(0.028820332832801),
+ FRAC_CONST(0.029333821328905),
+ FRAC_CONST(0.029853170531859),
+ FRAC_CONST(0.030378411455255),
+ FRAC_CONST(0.030909574956490),
+ FRAC_CONST(0.031446691733739),
+ FRAC_CONST(0.031989792322926),
+ FRAC_CONST(0.032538907094693),
+ FRAC_CONST(0.033094066251369),
+ FRAC_CONST(0.033655299823935),
+ FRAC_CONST(0.034222637668991),
+ FRAC_CONST(0.034796109465717),
+ FRAC_CONST(0.035375744712844),
+ FRAC_CONST(0.035961572725616),
+ FRAC_CONST(0.036553622632758),
+ FRAC_CONST(0.037151923373446),
+ FRAC_CONST(0.037756503694277),
+ FRAC_CONST(0.038367392146243),
+ FRAC_CONST(0.038984617081711),
+ FRAC_CONST(0.039608206651398),
+ FRAC_CONST(0.040238188801359),
+ FRAC_CONST(0.040874591269976),
+ FRAC_CONST(0.041517441584950),
+ FRAC_CONST(0.042166767060301),
+ FRAC_CONST(0.042822594793376),
+ FRAC_CONST(0.043484951661852),
+ FRAC_CONST(0.044153864320760),
+ FRAC_CONST(0.044829359199509),
+ FRAC_CONST(0.045511462498913),
+ FRAC_CONST(0.046200200188234),
+ FRAC_CONST(0.046895598002228),
+ FRAC_CONST(0.047597681438201),
+ FRAC_CONST(0.048306475753074),
+ FRAC_CONST(0.049022005960455),
+ FRAC_CONST(0.049744296827725),
+ FRAC_CONST(0.050473372873129),
+ FRAC_CONST(0.051209258362879),
+ FRAC_CONST(0.051951977308273),
+ FRAC_CONST(0.052701553462813),
+ FRAC_CONST(0.053458010319350),
+ FRAC_CONST(0.054221371107223),
+ FRAC_CONST(0.054991658789428),
+ FRAC_CONST(0.055768896059787),
+ FRAC_CONST(0.056553105340134),
+ FRAC_CONST(0.057344308777513),
+ FRAC_CONST(0.058142528241393),
+ FRAC_CONST(0.058947785320893),
+ FRAC_CONST(0.059760101322019),
+ FRAC_CONST(0.060579497264926),
+ FRAC_CONST(0.061405993881180),
+ FRAC_CONST(0.062239611611049),
+ FRAC_CONST(0.063080370600799),
+ FRAC_CONST(0.063928290700012),
+ FRAC_CONST(0.064783391458919),
+ FRAC_CONST(0.065645692125747),
+ FRAC_CONST(0.066515211644086),
+ FRAC_CONST(0.067391968650269),
+ FRAC_CONST(0.068275981470777),
+ FRAC_CONST(0.069167268119652),
+ FRAC_CONST(0.070065846295935),
+ FRAC_CONST(0.070971733381121),
+ FRAC_CONST(0.071884946436630),
+ FRAC_CONST(0.072805502201299),
+ FRAC_CONST(0.073733417088896),
+ FRAC_CONST(0.074668707185649),
+ FRAC_CONST(0.075611388247794),
+ FRAC_CONST(0.076561475699152),
+ FRAC_CONST(0.077518984628715),
+ FRAC_CONST(0.078483929788261),
+ FRAC_CONST(0.079456325589986),
+ FRAC_CONST(0.080436186104162),
+ FRAC_CONST(0.081423525056808),
+ FRAC_CONST(0.082418355827392),
+ FRAC_CONST(0.083420691446553),
+ FRAC_CONST(0.084430544593841),
+ FRAC_CONST(0.085447927595483),
+ FRAC_CONST(0.086472852422178),
+ FRAC_CONST(0.087505330686900),
+ FRAC_CONST(0.088545373642744),
+ FRAC_CONST(0.089592992180780),
+ FRAC_CONST(0.090648196827937),
+ FRAC_CONST(0.091710997744919),
+ FRAC_CONST(0.092781404724131),
+ FRAC_CONST(0.093859427187640),
+ FRAC_CONST(0.094945074185163),
+ FRAC_CONST(0.096038354392069),
+ FRAC_CONST(0.097139276107423),
+ FRAC_CONST(0.098247847252041),
+ FRAC_CONST(0.099364075366580),
+ FRAC_CONST(0.10048796760965),
+ FRAC_CONST(0.10161953075597),
+ FRAC_CONST(0.10275877119451),
+ FRAC_CONST(0.10390569492671),
+ FRAC_CONST(0.10506030756469),
+ FRAC_CONST(0.10622261432949),
+ FRAC_CONST(0.10739262004941),
+ FRAC_CONST(0.10857032915821),
+ FRAC_CONST(0.10975574569357),
+ FRAC_CONST(0.11094887329534),
+ FRAC_CONST(0.11214971520402),
+ FRAC_CONST(0.11335827425914),
+ FRAC_CONST(0.11457455289772),
+ FRAC_CONST(0.11579855315274),
+ FRAC_CONST(0.11703027665170),
+ FRAC_CONST(0.11826972461510),
+ FRAC_CONST(0.11951689785504),
+ FRAC_CONST(0.12077179677383),
+ FRAC_CONST(0.12203442136263),
+ FRAC_CONST(0.12330477120008),
+ FRAC_CONST(0.12458284545102),
+ FRAC_CONST(0.12586864286523),
+ FRAC_CONST(0.12716216177615),
+ FRAC_CONST(0.12846340009971),
+ FRAC_CONST(0.12977235533312),
+ FRAC_CONST(0.13108902455375),
+ FRAC_CONST(0.13241340441801),
+ FRAC_CONST(0.13374549116025),
+ FRAC_CONST(0.13508528059173),
+ FRAC_CONST(0.13643276809961),
+ FRAC_CONST(0.13778794864595),
+ FRAC_CONST(0.13915081676677),
+ FRAC_CONST(0.14052136657114),
+ FRAC_CONST(0.14189959174027),
+ FRAC_CONST(0.14328548552671),
+ FRAC_CONST(0.14467904075349),
+ FRAC_CONST(0.14608024981336),
+ FRAC_CONST(0.14748910466804),
+ FRAC_CONST(0.14890559684750),
+ FRAC_CONST(0.15032971744929),
+ FRAC_CONST(0.15176145713790),
+ FRAC_CONST(0.15320080614414),
+ FRAC_CONST(0.15464775426459),
+ FRAC_CONST(0.15610229086100),
+ FRAC_CONST(0.15756440485987),
+ FRAC_CONST(0.15903408475193),
+ FRAC_CONST(0.16051131859170),
+ FRAC_CONST(0.16199609399712),
+ FRAC_CONST(0.16348839814917),
+ FRAC_CONST(0.16498821779156),
+ FRAC_CONST(0.16649553923042),
+ FRAC_CONST(0.16801034833404),
+ FRAC_CONST(0.16953263053270),
+ FRAC_CONST(0.17106237081842),
+ FRAC_CONST(0.17259955374484),
+ FRAC_CONST(0.17414416342714),
+ FRAC_CONST(0.17569618354193),
+ FRAC_CONST(0.17725559732720),
+ FRAC_CONST(0.17882238758238),
+ FRAC_CONST(0.18039653666830),
+ FRAC_CONST(0.18197802650733),
+ FRAC_CONST(0.18356683858343),
+ FRAC_CONST(0.18516295394233),
+ FRAC_CONST(0.18676635319174),
+ FRAC_CONST(0.18837701650148),
+ FRAC_CONST(0.18999492360384),
+ FRAC_CONST(0.19162005379380),
+ FRAC_CONST(0.19325238592940),
+ FRAC_CONST(0.19489189843209),
+ FRAC_CONST(0.19653856928714),
+ FRAC_CONST(0.19819237604409),
+ FRAC_CONST(0.19985329581721),
+ FRAC_CONST(0.20152130528605),
+ FRAC_CONST(0.20319638069594),
+ FRAC_CONST(0.20487849785865),
+ FRAC_CONST(0.20656763215298),
+ FRAC_CONST(0.20826375852540),
+ FRAC_CONST(0.20996685149083),
+ FRAC_CONST(0.21167688513330),
+ FRAC_CONST(0.21339383310678),
+ FRAC_CONST(0.21511766863598),
+ FRAC_CONST(0.21684836451719),
+ FRAC_CONST(0.21858589311922),
+ FRAC_CONST(0.22033022638425),
+ FRAC_CONST(0.22208133582887),
+ FRAC_CONST(0.22383919254503),
+ FRAC_CONST(0.22560376720111),
+ FRAC_CONST(0.22737503004300),
+ FRAC_CONST(0.22915295089517),
+ FRAC_CONST(0.23093749916189),
+ FRAC_CONST(0.23272864382838),
+ FRAC_CONST(0.23452635346201),
+ FRAC_CONST(0.23633059621364),
+ FRAC_CONST(0.23814133981883),
+ FRAC_CONST(0.23995855159925),
+ FRAC_CONST(0.24178219846403),
+ FRAC_CONST(0.24361224691114),
+ FRAC_CONST(0.24544866302890),
+ FRAC_CONST(0.24729141249740),
+ FRAC_CONST(0.24914046059007),
+ FRAC_CONST(0.25099577217522),
+ FRAC_CONST(0.25285731171763),
+ FRAC_CONST(0.25472504328019),
+ FRAC_CONST(0.25659893052556),
+ FRAC_CONST(0.25847893671788),
+ FRAC_CONST(0.26036502472451),
+ FRAC_CONST(0.26225715701781),
+ FRAC_CONST(0.26415529567692),
+ FRAC_CONST(0.26605940238966),
+ FRAC_CONST(0.26796943845439),
+ FRAC_CONST(0.26988536478190),
+ FRAC_CONST(0.27180714189742),
+ FRAC_CONST(0.27373472994256),
+ FRAC_CONST(0.27566808867736),
+ FRAC_CONST(0.27760717748238),
+ FRAC_CONST(0.27955195536071),
+ FRAC_CONST(0.28150238094021),
+ FRAC_CONST(0.28345841247557),
+ FRAC_CONST(0.28542000785059),
+ FRAC_CONST(0.28738712458038),
+ FRAC_CONST(0.28935971981364),
+ FRAC_CONST(0.29133775033492),
+ FRAC_CONST(0.29332117256704),
+ FRAC_CONST(0.29530994257338),
+ FRAC_CONST(0.29730401606034),
+ FRAC_CONST(0.29930334837974),
+ FRAC_CONST(0.30130789453132),
+ FRAC_CONST(0.30331760916521),
+ FRAC_CONST(0.30533244658452),
+ FRAC_CONST(0.30735236074785),
+ FRAC_CONST(0.30937730527195),
+ FRAC_CONST(0.31140723343430),
+ FRAC_CONST(0.31344209817583),
+ FRAC_CONST(0.31548185210356),
+ FRAC_CONST(0.31752644749341),
+ FRAC_CONST(0.31957583629288),
+ FRAC_CONST(0.32162997012390),
+ FRAC_CONST(0.32368880028565),
+ FRAC_CONST(0.32575227775738),
+ FRAC_CONST(0.32782035320134),
+ FRAC_CONST(0.32989297696566),
+ FRAC_CONST(0.33197009908736),
+ FRAC_CONST(0.33405166929523),
+ FRAC_CONST(0.33613763701295),
+ FRAC_CONST(0.33822795136203),
+ FRAC_CONST(0.34032256116495),
+ FRAC_CONST(0.34242141494820),
+ FRAC_CONST(0.34452446094547),
+ FRAC_CONST(0.34663164710072),
+ FRAC_CONST(0.34874292107143),
+ FRAC_CONST(0.35085823023181),
+ FRAC_CONST(0.35297752167598),
+ FRAC_CONST(0.35510074222129),
+ FRAC_CONST(0.35722783841160),
+ FRAC_CONST(0.35935875652060),
+ FRAC_CONST(0.36149344255514),
+ FRAC_CONST(0.36363184225864),
+ FRAC_CONST(0.36577390111444),
+ FRAC_CONST(0.36791956434930),
+ FRAC_CONST(0.37006877693676),
+ FRAC_CONST(0.37222148360070),
+ FRAC_CONST(0.37437762881878),
+ FRAC_CONST(0.37653715682603),
+ FRAC_CONST(0.37870001161834),
+ FRAC_CONST(0.38086613695607),
+ FRAC_CONST(0.38303547636766),
+ FRAC_CONST(0.38520797315322),
+ FRAC_CONST(0.38738357038821),
+ FRAC_CONST(0.38956221092708),
+ FRAC_CONST(0.39174383740701),
+ FRAC_CONST(0.39392839225157),
+ FRAC_CONST(0.39611581767449),
+ FRAC_CONST(0.39830605568342),
+ FRAC_CONST(0.40049904808370),
+ FRAC_CONST(0.40269473648218),
+ FRAC_CONST(0.40489306229101),
+ FRAC_CONST(0.40709396673153),
+ FRAC_CONST(0.40929739083810),
+ FRAC_CONST(0.41150327546197),
+ FRAC_CONST(0.41371156127524),
+ FRAC_CONST(0.41592218877472),
+ FRAC_CONST(0.41813509828594),
+ FRAC_CONST(0.42035022996702),
+ FRAC_CONST(0.42256752381274),
+ FRAC_CONST(0.42478691965848),
+ FRAC_CONST(0.42700835718423),
+ FRAC_CONST(0.42923177591866),
+ FRAC_CONST(0.43145711524314),
+ FRAC_CONST(0.43368431439580),
+ FRAC_CONST(0.43591331247564),
+ FRAC_CONST(0.43814404844658),
+ FRAC_CONST(0.44037646114161),
+ FRAC_CONST(0.44261048926688),
+ FRAC_CONST(0.44484607140589),
+ FRAC_CONST(0.44708314602359),
+ FRAC_CONST(0.44932165147057),
+ FRAC_CONST(0.45156152598727),
+ FRAC_CONST(0.45380270770813),
+ FRAC_CONST(0.45604513466581),
+ FRAC_CONST(0.45828874479543),
+ FRAC_CONST(0.46053347593880),
+ FRAC_CONST(0.46277926584861),
+ FRAC_CONST(0.46502605219277),
+ FRAC_CONST(0.46727377255861),
+ FRAC_CONST(0.46952236445718),
+ FRAC_CONST(0.47177176532752),
+ FRAC_CONST(0.47402191254100),
+ FRAC_CONST(0.47627274340557),
+ FRAC_CONST(0.47852419517009),
+ FRAC_CONST(0.48077620502869),
+ FRAC_CONST(0.48302871012505),
+ FRAC_CONST(0.48528164755674),
+ FRAC_CONST(0.48753495437962),
+ FRAC_CONST(0.48978856761212),
+ FRAC_CONST(0.49204242423966),
+ FRAC_CONST(0.49429646121898),
+ FRAC_CONST(0.49655061548250),
+ FRAC_CONST(0.49880482394273),
+ FRAC_CONST(0.50105902349665),
+ FRAC_CONST(0.50331315103004),
+ FRAC_CONST(0.50556714342194),
+ FRAC_CONST(0.50782093754901),
+ FRAC_CONST(0.51007447028990),
+ FRAC_CONST(0.51232767852971),
+ FRAC_CONST(0.51458049916433),
+ FRAC_CONST(0.51683286910489),
+ FRAC_CONST(0.51908472528213),
+ FRAC_CONST(0.52133600465083),
+ FRAC_CONST(0.52358664419420),
+ FRAC_CONST(0.52583658092832),
+ FRAC_CONST(0.52808575190648),
+ FRAC_CONST(0.53033409422367),
+ FRAC_CONST(0.53258154502092),
+ FRAC_CONST(0.53482804148974),
+ FRAC_CONST(0.53707352087652),
+ FRAC_CONST(0.53931792048690),
+ FRAC_CONST(0.54156117769021),
+ FRAC_CONST(0.54380322992385),
+ FRAC_CONST(0.54604401469766),
+ FRAC_CONST(0.54828346959835),
+ FRAC_CONST(0.55052153229384),
+ FRAC_CONST(0.55275814053768),
+ FRAC_CONST(0.55499323217338),
+ FRAC_CONST(0.55722674513883),
+ FRAC_CONST(0.55945861747062),
+ FRAC_CONST(0.56168878730842),
+ FRAC_CONST(0.56391719289930),
+ FRAC_CONST(0.56614377260214),
+ FRAC_CONST(0.56836846489188),
+ FRAC_CONST(0.57059120836390),
+ FRAC_CONST(0.57281194173835),
+ FRAC_CONST(0.57503060386439),
+ FRAC_CONST(0.57724713372458),
+ FRAC_CONST(0.57946147043912),
+ FRAC_CONST(0.58167355327012),
+ FRAC_CONST(0.58388332162591),
+ FRAC_CONST(0.58609071506528),
+ FRAC_CONST(0.58829567330173),
+ FRAC_CONST(0.59049813620770),
+ FRAC_CONST(0.59269804381879),
+ FRAC_CONST(0.59489533633802),
+ FRAC_CONST(0.59708995413996),
+ FRAC_CONST(0.59928183777495),
+ FRAC_CONST(0.60147092797329),
+ FRAC_CONST(0.60365716564937),
+ FRAC_CONST(0.60584049190582),
+ FRAC_CONST(0.60802084803764),
+ FRAC_CONST(0.61019817553632),
+ FRAC_CONST(0.61237241609393),
+ FRAC_CONST(0.61454351160718),
+ FRAC_CONST(0.61671140418155),
+ FRAC_CONST(0.61887603613527),
+ FRAC_CONST(0.62103735000336),
+ FRAC_CONST(0.62319528854167),
+ FRAC_CONST(0.62534979473088),
+ FRAC_CONST(0.62750081178042),
+ FRAC_CONST(0.62964828313250),
+ FRAC_CONST(0.63179215246597),
+ FRAC_CONST(0.63393236370030),
+ FRAC_CONST(0.63606886099946),
+ FRAC_CONST(0.63820158877577),
+ FRAC_CONST(0.64033049169379),
+ FRAC_CONST(0.64245551467413),
+ FRAC_CONST(0.64457660289729),
+ FRAC_CONST(0.64669370180740),
+ FRAC_CONST(0.64880675711607),
+ FRAC_CONST(0.65091571480603),
+ FRAC_CONST(0.65302052113494),
+ FRAC_CONST(0.65512112263906),
+ FRAC_CONST(0.65721746613689),
+ FRAC_CONST(0.65930949873289),
+ FRAC_CONST(0.66139716782102),
+ FRAC_CONST(0.66348042108842),
+ FRAC_CONST(0.66555920651892),
+ FRAC_CONST(0.66763347239664),
+ FRAC_CONST(0.66970316730947),
+ FRAC_CONST(0.67176824015260),
+ FRAC_CONST(0.67382864013196),
+ FRAC_CONST(0.67588431676768),
+ FRAC_CONST(0.67793521989751),
+ FRAC_CONST(0.67998129968017),
+ FRAC_CONST(0.68202250659876),
+ FRAC_CONST(0.68405879146403),
+ FRAC_CONST(0.68609010541774),
+ FRAC_CONST(0.68811639993588),
+ FRAC_CONST(0.69013762683195),
+ FRAC_CONST(0.69215373826012),
+ FRAC_CONST(0.69416468671849),
+ FRAC_CONST(0.69617042505214),
+ FRAC_CONST(0.69817090645634),
+ FRAC_CONST(0.70016608447958),
+ FRAC_CONST(0.70215591302664),
+ FRAC_CONST(0.70414034636163),
+ FRAC_CONST(0.70611933911096),
+ FRAC_CONST(0.70809284626630),
+ FRAC_CONST(0.71006082318751),
+ FRAC_CONST(0.71202322560554),
+ FRAC_CONST(0.71398000962530),
+ FRAC_CONST(0.71593113172842),
+ FRAC_CONST(0.71787654877613),
+ FRAC_CONST(0.71981621801195),
+ FRAC_CONST(0.72175009706445),
+ FRAC_CONST(0.72367814394990),
+ FRAC_CONST(0.72560031707496),
+ FRAC_CONST(0.72751657523927),
+ FRAC_CONST(0.72942687763803),
+ FRAC_CONST(0.73133118386457),
+ FRAC_CONST(0.73322945391280),
+ FRAC_CONST(0.73512164817975),
+ FRAC_CONST(0.73700772746796),
+ FRAC_CONST(0.73888765298787),
+ FRAC_CONST(0.74076138636020),
+ FRAC_CONST(0.74262888961827),
+ FRAC_CONST(0.74449012521027),
+ FRAC_CONST(0.74634505600152),
+ FRAC_CONST(0.74819364527663),
+ FRAC_CONST(0.75003585674175),
+ FRAC_CONST(0.75187165452661),
+ FRAC_CONST(0.75370100318668),
+ FRAC_CONST(0.75552386770515),
+ FRAC_CONST(0.75734021349500),
+ FRAC_CONST(0.75915000640095),
+ FRAC_CONST(0.76095321270137),
+ FRAC_CONST(0.76274979911019),
+ FRAC_CONST(0.76453973277875),
+ FRAC_CONST(0.76632298129757),
+ FRAC_CONST(0.76809951269819),
+ FRAC_CONST(0.76986929545481),
+ FRAC_CONST(0.77163229848604),
+ FRAC_CONST(0.77338849115651),
+ FRAC_CONST(0.77513784327849),
+ FRAC_CONST(0.77688032511340),
+ FRAC_CONST(0.77861590737340),
+ FRAC_CONST(0.78034456122283),
+ FRAC_CONST(0.78206625827961),
+ FRAC_CONST(0.78378097061667),
+ FRAC_CONST(0.78548867076330),
+ FRAC_CONST(0.78718933170643),
+ FRAC_CONST(0.78888292689189),
+ FRAC_CONST(0.79056943022564),
+ FRAC_CONST(0.79224881607494),
+ FRAC_CONST(0.79392105926949),
+ FRAC_CONST(0.79558613510249),
+ FRAC_CONST(0.79724401933170),
+ FRAC_CONST(0.79889468818046),
+ FRAC_CONST(0.80053811833858),
+ FRAC_CONST(0.80217428696334),
+ FRAC_CONST(0.80380317168028),
+ FRAC_CONST(0.80542475058405),
+ FRAC_CONST(0.80703900223920),
+ FRAC_CONST(0.80864590568089),
+ FRAC_CONST(0.81024544041560),
+ FRAC_CONST(0.81183758642175),
+ FRAC_CONST(0.81342232415032),
+ FRAC_CONST(0.81499963452540),
+ FRAC_CONST(0.81656949894467),
+ FRAC_CONST(0.81813189927991),
+ FRAC_CONST(0.81968681787738),
+ FRAC_CONST(0.82123423755821),
+ FRAC_CONST(0.82277414161874),
+ FRAC_CONST(0.82430651383076),
+ FRAC_CONST(0.82583133844180),
+ FRAC_CONST(0.82734860017528),
+ FRAC_CONST(0.82885828423070),
+ FRAC_CONST(0.83036037628369),
+ FRAC_CONST(0.83185486248609),
+ FRAC_CONST(0.83334172946597),
+ FRAC_CONST(0.83482096432759),
+ FRAC_CONST(0.83629255465130),
+ FRAC_CONST(0.83775648849344),
+ FRAC_CONST(0.83921275438615),
+ FRAC_CONST(0.84066134133716),
+ FRAC_CONST(0.84210223882952),
+ FRAC_CONST(0.84353543682130),
+ FRAC_CONST(0.84496092574524),
+ FRAC_CONST(0.84637869650833),
+ FRAC_CONST(0.84778874049138),
+ FRAC_CONST(0.84919104954855),
+ FRAC_CONST(0.85058561600677),
+ FRAC_CONST(0.85197243266520),
+ FRAC_CONST(0.85335149279457),
+ FRAC_CONST(0.85472279013653),
+ FRAC_CONST(0.85608631890295),
+ FRAC_CONST(0.85744207377513),
+ FRAC_CONST(0.85879004990298),
+ FRAC_CONST(0.86013024290422),
+ FRAC_CONST(0.86146264886346),
+ FRAC_CONST(0.86278726433124),
+ FRAC_CONST(0.86410408632306),
+ FRAC_CONST(0.86541311231838),
+ FRAC_CONST(0.86671434025950),
+ FRAC_CONST(0.86800776855046),
+ FRAC_CONST(0.86929339605590),
+ FRAC_CONST(0.87057122209981),
+ FRAC_CONST(0.87184124646433),
+ FRAC_CONST(0.87310346938840),
+ FRAC_CONST(0.87435789156650),
+ FRAC_CONST(0.87560451414719),
+ FRAC_CONST(0.87684333873173),
+ FRAC_CONST(0.87807436737261),
+ FRAC_CONST(0.87929760257204),
+ FRAC_CONST(0.88051304728038),
+ FRAC_CONST(0.88172070489456),
+ FRAC_CONST(0.88292057925645),
+ FRAC_CONST(0.88411267465117),
+ FRAC_CONST(0.88529699580537),
+ FRAC_CONST(0.88647354788545),
+ FRAC_CONST(0.88764233649580),
+ FRAC_CONST(0.88880336767692),
+ FRAC_CONST(0.88995664790351),
+ FRAC_CONST(0.89110218408260),
+ FRAC_CONST(0.89223998355154),
+ FRAC_CONST(0.89337005407600),
+ FRAC_CONST(0.89449240384793),
+ FRAC_CONST(0.89560704148345),
+ FRAC_CONST(0.89671397602074),
+ FRAC_CONST(0.89781321691786),
+ FRAC_CONST(0.89890477405053),
+ FRAC_CONST(0.89998865770993),
+ FRAC_CONST(0.90106487860034),
+ FRAC_CONST(0.90213344783689),
+ FRAC_CONST(0.90319437694315),
+ FRAC_CONST(0.90424767784873),
+ FRAC_CONST(0.90529336288690),
+ FRAC_CONST(0.90633144479201),
+ FRAC_CONST(0.90736193669708),
+ FRAC_CONST(0.90838485213119),
+ FRAC_CONST(0.90940020501694),
+ FRAC_CONST(0.91040800966776),
+ FRAC_CONST(0.91140828078533),
+ FRAC_CONST(0.91240103345685),
+ FRAC_CONST(0.91338628315231),
+ FRAC_CONST(0.91436404572173),
+ FRAC_CONST(0.91533433739238),
+ FRAC_CONST(0.91629717476594),
+ FRAC_CONST(0.91725257481564),
+ FRAC_CONST(0.91820055488334),
+ FRAC_CONST(0.91914113267664),
+ FRAC_CONST(0.92007432626589),
+ FRAC_CONST(0.92100015408120),
+ FRAC_CONST(0.92191863490944),
+ FRAC_CONST(0.92282978789113),
+ FRAC_CONST(0.92373363251740),
+ FRAC_CONST(0.92463018862687),
+ FRAC_CONST(0.92551947640245),
+ FRAC_CONST(0.92640151636824),
+ FRAC_CONST(0.92727632938624),
+ FRAC_CONST(0.92814393665320),
+ FRAC_CONST(0.92900435969727),
+ FRAC_CONST(0.92985762037477),
+ FRAC_CONST(0.93070374086684),
+ FRAC_CONST(0.93154274367610),
+ FRAC_CONST(0.93237465162328),
+ FRAC_CONST(0.93319948784382),
+ FRAC_CONST(0.93401727578443),
+ FRAC_CONST(0.93482803919967),
+ FRAC_CONST(0.93563180214841),
+ FRAC_CONST(0.93642858899043),
+ FRAC_CONST(0.93721842438279),
+ FRAC_CONST(0.93800133327637),
+ FRAC_CONST(0.93877734091223),
+ FRAC_CONST(0.93954647281807),
+ FRAC_CONST(0.94030875480458),
+ FRAC_CONST(0.94106421296182),
+ FRAC_CONST(0.94181287365556),
+ FRAC_CONST(0.94255476352362),
+ FRAC_CONST(0.94328990947213),
+ FRAC_CONST(0.94401833867184),
+ FRAC_CONST(0.94474007855439),
+ FRAC_CONST(0.94545515680855),
+ FRAC_CONST(0.94616360137644),
+ FRAC_CONST(0.94686544044975),
+ FRAC_CONST(0.94756070246592),
+ FRAC_CONST(0.94824941610434),
+ FRAC_CONST(0.94893161028248),
+ FRAC_CONST(0.94960731415209),
+ FRAC_CONST(0.95027655709525),
+ FRAC_CONST(0.95093936872056),
+ FRAC_CONST(0.95159577885924),
+ FRAC_CONST(0.95224581756115),
+ FRAC_CONST(0.95288951509097),
+ FRAC_CONST(0.95352690192417),
+ FRAC_CONST(0.95415800874314),
+ FRAC_CONST(0.95478286643320),
+ FRAC_CONST(0.95540150607863),
+ FRAC_CONST(0.95601395895871),
+ FRAC_CONST(0.95662025654373),
+ FRAC_CONST(0.95722043049100),
+ FRAC_CONST(0.95781451264084),
+ FRAC_CONST(0.95840253501260),
+ FRAC_CONST(0.95898452980058),
+ FRAC_CONST(0.95956052937008),
+ FRAC_CONST(0.96013056625336),
+ FRAC_CONST(0.96069467314557),
+ FRAC_CONST(0.96125288290073),
+ FRAC_CONST(0.96180522852773),
+ FRAC_CONST(0.96235174318622),
+ FRAC_CONST(0.96289246018262),
+ FRAC_CONST(0.96342741296604),
+ FRAC_CONST(0.96395663512424),
+ FRAC_CONST(0.96448016037959),
+ FRAC_CONST(0.96499802258499),
+ FRAC_CONST(0.96551025571985),
+ FRAC_CONST(0.96601689388602),
+ FRAC_CONST(0.96651797130376),
+ FRAC_CONST(0.96701352230768),
+ FRAC_CONST(0.96750358134269),
+ FRAC_CONST(0.96798818295998),
+ FRAC_CONST(0.96846736181297),
+ FRAC_CONST(0.96894115265327),
+ FRAC_CONST(0.96940959032667),
+ FRAC_CONST(0.96987270976912),
+ FRAC_CONST(0.97033054600270),
+ FRAC_CONST(0.97078313413161),
+ FRAC_CONST(0.97123050933818),
+ FRAC_CONST(0.97167270687887),
+ FRAC_CONST(0.97210976208030),
+ FRAC_CONST(0.97254171033525),
+ FRAC_CONST(0.97296858709871),
+ FRAC_CONST(0.97339042788392),
+ FRAC_CONST(0.97380726825843),
+ FRAC_CONST(0.97421914384017),
+ FRAC_CONST(0.97462609029350),
+ FRAC_CONST(0.97502814332534),
+ FRAC_CONST(0.97542533868127),
+ FRAC_CONST(0.97581771214160),
+ FRAC_CONST(0.97620529951759),
+ FRAC_CONST(0.97658813664749),
+ FRAC_CONST(0.97696625939282),
+ FRAC_CONST(0.97733970363445),
+ FRAC_CONST(0.97770850526884),
+ FRAC_CONST(0.97807270020427),
+ FRAC_CONST(0.97843232435704),
+ FRAC_CONST(0.97878741364771),
+ FRAC_CONST(0.97913800399743),
+ FRAC_CONST(0.97948413132414),
+ FRAC_CONST(0.97982583153895),
+ FRAC_CONST(0.98016314054243),
+ FRAC_CONST(0.98049609422096),
+ FRAC_CONST(0.98082472844313),
+ FRAC_CONST(0.98114907905608),
+ FRAC_CONST(0.98146918188197),
+ FRAC_CONST(0.98178507271438),
+ FRAC_CONST(0.98209678731477),
+ FRAC_CONST(0.98240436140902),
+ FRAC_CONST(0.98270783068385),
+ FRAC_CONST(0.98300723078342),
+ FRAC_CONST(0.98330259730589),
+ FRAC_CONST(0.98359396579995),
+ FRAC_CONST(0.98388137176152),
+ FRAC_CONST(0.98416485063031),
+ FRAC_CONST(0.98444443778651),
+ FRAC_CONST(0.98472016854752),
+ FRAC_CONST(0.98499207816463),
+ FRAC_CONST(0.98526020181980),
+ FRAC_CONST(0.98552457462240),
+ FRAC_CONST(0.98578523160609),
+ FRAC_CONST(0.98604220772560),
+ FRAC_CONST(0.98629553785362),
+ FRAC_CONST(0.98654525677772),
+ FRAC_CONST(0.98679139919726),
+ FRAC_CONST(0.98703399972035),
+ FRAC_CONST(0.98727309286089),
+ FRAC_CONST(0.98750871303556),
+ FRAC_CONST(0.98774089456089),
+ FRAC_CONST(0.98796967165036),
+ FRAC_CONST(0.98819507841154),
+ FRAC_CONST(0.98841714884323),
+ FRAC_CONST(0.98863591683269),
+ FRAC_CONST(0.98885141615285),
+ FRAC_CONST(0.98906368045957),
+ FRAC_CONST(0.98927274328896),
+ FRAC_CONST(0.98947863805473),
+ FRAC_CONST(0.98968139804554),
+ FRAC_CONST(0.98988105642241),
+ FRAC_CONST(0.99007764621618),
+ FRAC_CONST(0.99027120032501),
+ FRAC_CONST(0.99046175151186),
+ FRAC_CONST(0.99064933240208),
+ FRAC_CONST(0.99083397548099),
+ FRAC_CONST(0.99101571309153),
+ FRAC_CONST(0.99119457743191),
+ FRAC_CONST(0.99137060055337),
+ FRAC_CONST(0.99154381435784),
+ FRAC_CONST(0.99171425059582),
+ FRAC_CONST(0.99188194086414),
+ FRAC_CONST(0.99204691660388),
+ FRAC_CONST(0.99220920909823),
+ FRAC_CONST(0.99236884947045),
+ FRAC_CONST(0.99252586868186),
+ FRAC_CONST(0.99268029752989),
+ FRAC_CONST(0.99283216664606),
+ FRAC_CONST(0.99298150649419),
+ FRAC_CONST(0.99312834736847),
+ FRAC_CONST(0.99327271939167),
+ FRAC_CONST(0.99341465251338),
+ FRAC_CONST(0.99355417650825),
+ FRAC_CONST(0.99369132097430),
+ FRAC_CONST(0.99382611533130),
+ FRAC_CONST(0.99395858881910),
+ FRAC_CONST(0.99408877049612),
+ FRAC_CONST(0.99421668923778),
+ FRAC_CONST(0.99434237373503),
+ FRAC_CONST(0.99446585249289),
+ FRAC_CONST(0.99458715382906),
+ FRAC_CONST(0.99470630587254),
+ FRAC_CONST(0.99482333656229),
+ FRAC_CONST(0.99493827364600),
+ FRAC_CONST(0.99505114467878),
+ FRAC_CONST(0.99516197702200),
+ FRAC_CONST(0.99527079784214),
+ FRAC_CONST(0.99537763410962),
+ FRAC_CONST(0.99548251259777),
+ FRAC_CONST(0.99558545988178),
+ FRAC_CONST(0.99568650233767),
+ FRAC_CONST(0.99578566614138),
+ FRAC_CONST(0.99588297726783),
+ FRAC_CONST(0.99597846149005),
+ FRAC_CONST(0.99607214437834),
+ FRAC_CONST(0.99616405129947),
+ FRAC_CONST(0.99625420741595),
+ FRAC_CONST(0.99634263768527),
+ FRAC_CONST(0.99642936685928),
+ FRAC_CONST(0.99651441948352),
+ FRAC_CONST(0.99659781989663),
+ FRAC_CONST(0.99667959222978),
+ FRAC_CONST(0.99675976040620),
+ FRAC_CONST(0.99683834814063),
+ FRAC_CONST(0.99691537893895),
+ FRAC_CONST(0.99699087609774),
+ FRAC_CONST(0.99706486270391),
+ FRAC_CONST(0.99713736163442),
+ FRAC_CONST(0.99720839555593),
+ FRAC_CONST(0.99727798692461),
+ FRAC_CONST(0.99734615798589),
+ FRAC_CONST(0.99741293077431),
+ FRAC_CONST(0.99747832711337),
+ FRAC_CONST(0.99754236861541),
+ FRAC_CONST(0.99760507668158),
+ FRAC_CONST(0.99766647250181),
+ FRAC_CONST(0.99772657705478),
+ FRAC_CONST(0.99778541110799),
+ FRAC_CONST(0.99784299521785),
+ FRAC_CONST(0.99789934972976),
+ FRAC_CONST(0.99795449477828),
+ FRAC_CONST(0.99800845028730),
+ FRAC_CONST(0.99806123597027),
+ FRAC_CONST(0.99811287133042),
+ FRAC_CONST(0.99816337566108),
+ FRAC_CONST(0.99821276804596),
+ FRAC_CONST(0.99826106735952),
+ FRAC_CONST(0.99830829226732),
+ FRAC_CONST(0.99835446122649),
+ FRAC_CONST(0.99839959248609),
+ FRAC_CONST(0.99844370408765),
+ FRAC_CONST(0.99848681386566),
+ FRAC_CONST(0.99852893944805),
+ FRAC_CONST(0.99857009825685),
+ FRAC_CONST(0.99861030750869),
+ FRAC_CONST(0.99864958421549),
+ FRAC_CONST(0.99868794518504),
+ FRAC_CONST(0.99872540702178),
+ FRAC_CONST(0.99876198612738),
+ FRAC_CONST(0.99879769870160),
+ FRAC_CONST(0.99883256074295),
+ FRAC_CONST(0.99886658804953),
+ FRAC_CONST(0.99889979621983),
+ FRAC_CONST(0.99893220065356),
+ FRAC_CONST(0.99896381655254),
+ FRAC_CONST(0.99899465892154),
+ FRAC_CONST(0.99902474256924),
+ FRAC_CONST(0.99905408210916),
+ FRAC_CONST(0.99908269196056),
+ FRAC_CONST(0.99911058634952),
+ FRAC_CONST(0.99913777930986),
+ FRAC_CONST(0.99916428468421),
+ FRAC_CONST(0.99919011612505),
+ FRAC_CONST(0.99921528709576),
+ FRAC_CONST(0.99923981087174),
+ FRAC_CONST(0.99926370054150),
+ FRAC_CONST(0.99928696900779),
+ FRAC_CONST(0.99930962898876),
+ FRAC_CONST(0.99933169301910),
+ FRAC_CONST(0.99935317345126),
+ FRAC_CONST(0.99937408245662),
+ FRAC_CONST(0.99939443202674),
+ FRAC_CONST(0.99941423397457),
+ FRAC_CONST(0.99943349993572),
+ FRAC_CONST(0.99945224136972),
+ FRAC_CONST(0.99947046956130),
+ FRAC_CONST(0.99948819562171),
+ FRAC_CONST(0.99950543049000),
+ FRAC_CONST(0.99952218493439),
+ FRAC_CONST(0.99953846955355),
+ FRAC_CONST(0.99955429477803),
+ FRAC_CONST(0.99956967087154),
+ FRAC_CONST(0.99958460793242),
+ FRAC_CONST(0.99959911589494),
+ FRAC_CONST(0.99961320453077),
+ FRAC_CONST(0.99962688345035),
+ FRAC_CONST(0.99964016210433),
+ FRAC_CONST(0.99965304978499),
+ FRAC_CONST(0.99966555562769),
+ FRAC_CONST(0.99967768861231),
+ FRAC_CONST(0.99968945756473),
+ FRAC_CONST(0.99970087115825),
+ FRAC_CONST(0.99971193791510),
+ FRAC_CONST(0.99972266620792),
+ FRAC_CONST(0.99973306426121),
+ FRAC_CONST(0.99974314015288),
+ FRAC_CONST(0.99975290181568),
+ FRAC_CONST(0.99976235703876),
+ FRAC_CONST(0.99977151346914),
+ FRAC_CONST(0.99978037861326),
+ FRAC_CONST(0.99978895983845),
+ FRAC_CONST(0.99979726437448),
+ FRAC_CONST(0.99980529931507),
+ FRAC_CONST(0.99981307161943),
+ FRAC_CONST(0.99982058811377),
+ FRAC_CONST(0.99982785549283),
+ FRAC_CONST(0.99983488032144),
+ FRAC_CONST(0.99984166903600),
+ FRAC_CONST(0.99984822794606),
+ FRAC_CONST(0.99985456323584),
+ FRAC_CONST(0.99986068096572),
+ FRAC_CONST(0.99986658707386),
+ FRAC_CONST(0.99987228737764),
+ FRAC_CONST(0.99987778757524),
+ FRAC_CONST(0.99988309324717),
+ FRAC_CONST(0.99988820985777),
+ FRAC_CONST(0.99989314275675),
+ FRAC_CONST(0.99989789718072),
+ FRAC_CONST(0.99990247825468),
+ FRAC_CONST(0.99990689099357),
+ FRAC_CONST(0.99991114030376),
+ FRAC_CONST(0.99991523098456),
+ FRAC_CONST(0.99991916772971),
+ FRAC_CONST(0.99992295512891),
+ FRAC_CONST(0.99992659766930),
+ FRAC_CONST(0.99993009973692),
+ FRAC_CONST(0.99993346561824),
+ FRAC_CONST(0.99993669950161),
+ FRAC_CONST(0.99993980547870),
+ FRAC_CONST(0.99994278754604),
+ FRAC_CONST(0.99994564960642),
+ FRAC_CONST(0.99994839547033),
+ FRAC_CONST(0.99995102885747),
+ FRAC_CONST(0.99995355339809),
+ FRAC_CONST(0.99995597263451),
+ FRAC_CONST(0.99995829002249),
+ FRAC_CONST(0.99996050893264),
+ FRAC_CONST(0.99996263265183),
+ FRAC_CONST(0.99996466438460),
+ FRAC_CONST(0.99996660725452),
+ FRAC_CONST(0.99996846430558),
+ FRAC_CONST(0.99997023850356),
+ FRAC_CONST(0.99997193273736),
+ FRAC_CONST(0.99997354982037),
+ FRAC_CONST(0.99997509249183),
+ FRAC_CONST(0.99997656341810),
+ FRAC_CONST(0.99997796519400),
+ FRAC_CONST(0.99997930034415),
+ FRAC_CONST(0.99998057132421),
+ FRAC_CONST(0.99998178052220),
+ FRAC_CONST(0.99998293025975),
+ FRAC_CONST(0.99998402279338),
+ FRAC_CONST(0.99998506031574),
+ FRAC_CONST(0.99998604495686),
+ FRAC_CONST(0.99998697878536),
+ FRAC_CONST(0.99998786380966),
+ FRAC_CONST(0.99998870197921),
+ FRAC_CONST(0.99998949518567),
+ FRAC_CONST(0.99999024526408),
+ FRAC_CONST(0.99999095399401),
+ FRAC_CONST(0.99999162310077),
+ FRAC_CONST(0.99999225425649),
+ FRAC_CONST(0.99999284908128),
+ FRAC_CONST(0.99999340914435),
+ FRAC_CONST(0.99999393596510),
+ FRAC_CONST(0.99999443101421),
+ FRAC_CONST(0.99999489571473),
+ FRAC_CONST(0.99999533144314),
+ FRAC_CONST(0.99999573953040),
+ FRAC_CONST(0.99999612126300),
+ FRAC_CONST(0.99999647788395),
+ FRAC_CONST(0.99999681059383),
+ FRAC_CONST(0.99999712055178),
+ FRAC_CONST(0.99999740887647),
+ FRAC_CONST(0.99999767664709),
+ FRAC_CONST(0.99999792490431),
+ FRAC_CONST(0.99999815465123),
+ FRAC_CONST(0.99999836685427),
+ FRAC_CONST(0.99999856244415),
+ FRAC_CONST(0.99999874231676),
+ FRAC_CONST(0.99999890733405),
+ FRAC_CONST(0.99999905832493),
+ FRAC_CONST(0.99999919608613),
+ FRAC_CONST(0.99999932138304),
+ FRAC_CONST(0.99999943495056),
+ FRAC_CONST(0.99999953749392),
+ FRAC_CONST(0.99999962968950),
+ FRAC_CONST(0.99999971218563),
+ FRAC_CONST(0.99999978560337),
+ FRAC_CONST(0.99999985053727),
+ FRAC_CONST(0.99999990755616),
+ FRAC_CONST(0.99999995720387)
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const real_t kbd_long_960[] =
- {
- FRAC_CONST(0.0003021562530949),
- FRAC_CONST(0.0004452267024786),
- FRAC_CONST(0.0005674947527496),
- FRAC_CONST(0.0006812465553466),
- FRAC_CONST(0.0007910496776387),
- FRAC_CONST(0.0008991655033895),
- FRAC_CONST(0.0010068978259384),
- FRAC_CONST(0.0011150758515751),
- FRAC_CONST(0.0012242653193642),
- FRAC_CONST(0.0013348735658205),
- FRAC_CONST(0.0014472068670273),
- FRAC_CONST(0.0015615039850448),
- FRAC_CONST(0.0016779568885263),
- FRAC_CONST(0.0017967241232412),
- FRAC_CONST(0.0019179397560955),
- FRAC_CONST(0.0020417195415393),
- FRAC_CONST(0.0021681652836642),
- FRAC_CONST(0.0022973679910599),
- FRAC_CONST(0.0024294102029937),
- FRAC_CONST(0.0025643677339078),
- FRAC_CONST(0.0027023110014772),
- FRAC_CONST(0.0028433060512612),
- FRAC_CONST(0.0029874153568025),
- FRAC_CONST(0.0031346984511728),
- FRAC_CONST(0.0032852124303662),
- FRAC_CONST(0.0034390123581190),
- FRAC_CONST(0.0035961515940931),
- FRAC_CONST(0.0037566820618961),
- FRAC_CONST(0.0039206544694386),
- FRAC_CONST(0.0040881184912194),
- FRAC_CONST(0.0042591229199617),
- FRAC_CONST(0.0044337157933972),
- FRAC_CONST(0.0046119445007641),
- FRAC_CONST(0.0047938558726415),
- FRAC_CONST(0.0049794962570131),
- FRAC_CONST(0.0051689115838900),
- FRAC_CONST(0.0053621474203763),
- FRAC_CONST(0.0055592490177131),
- FRAC_CONST(0.0057602613515573),
- FRAC_CONST(0.0059652291565289),
- FRAC_CONST(0.0061741969558843),
- FRAC_CONST(0.0063872090870253),
- FRAC_CONST(0.0066043097234387),
- FRAC_CONST(0.0068255428935640),
- FRAC_CONST(0.0070509524970088),
- FRAC_CONST(0.0072805823184660),
- FRAC_CONST(0.0075144760396340),
- FRAC_CONST(0.0077526772493942),
- FRAC_CONST(0.0079952294524673),
- FRAC_CONST(0.0082421760767325),
- FRAC_CONST(0.0084935604793733),
- FRAC_CONST(0.0087494259519870),
- FRAC_CONST(0.0090098157247792),
- FRAC_CONST(0.0092747729699467),
- FRAC_CONST(0.0095443408043399),
- FRAC_CONST(0.0098185622914832),
- FRAC_CONST(0.0100974804430226),
- FRAC_CONST(0.0103811382196612),
- FRAC_CONST(0.0106695785316351),
- FRAC_CONST(0.0109628442387771),
- FRAC_CONST(0.0112609781502091),
- FRAC_CONST(0.0115640230236993),
- FRAC_CONST(0.0118720215647169),
- FRAC_CONST(0.0121850164252137),
- FRAC_CONST(0.0125030502021561),
- FRAC_CONST(0.0128261654358321),
- FRAC_CONST(0.0131544046079532),
- FRAC_CONST(0.0134878101395681),
- FRAC_CONST(0.0138264243888068),
- FRAC_CONST(0.0141702896484671),
- FRAC_CONST(0.0145194481434592),
- FRAC_CONST(0.0148739420281182),
- FRAC_CONST(0.0152338133833959),
- FRAC_CONST(0.0155991042139432),
- FRAC_CONST(0.0159698564450882),
- FRAC_CONST(0.0163461119197227),
- FRAC_CONST(0.0167279123950996),
- FRAC_CONST(0.0171152995395520),
- FRAC_CONST(0.0175083149291368),
- FRAC_CONST(0.0179070000442104),
- FRAC_CONST(0.0183113962659409),
- FRAC_CONST(0.0187215448727609),
- FRAC_CONST(0.0191374870367659),
- FRAC_CONST(0.0195592638200623),
- FRAC_CONST(0.0199869161710679),
- FRAC_CONST(0.0204204849207691),
- FRAC_CONST(0.0208600107789370),
- FRAC_CONST(0.0213055343303066),
- FRAC_CONST(0.0217570960307201),
- FRAC_CONST(0.0222147362032386),
- FRAC_CONST(0.0226784950342228),
- FRAC_CONST(0.0231484125693867),
- FRAC_CONST(0.0236245287098244),
- FRAC_CONST(0.0241068832080138),
- FRAC_CONST(0.0245955156637973),
- FRAC_CONST(0.0250904655203431),
- FRAC_CONST(0.0255917720600868),
- FRAC_CONST(0.0260994744006559),
- FRAC_CONST(0.0266136114907790),
- FRAC_CONST(0.0271342221061795),
- FRAC_CONST(0.0276613448454576),
- FRAC_CONST(0.0281950181259587),
- FRAC_CONST(0.0287352801796329),
- FRAC_CONST(0.0292821690488833),
- FRAC_CONST(0.0298357225824074),
- FRAC_CONST(0.0303959784310299),
- FRAC_CONST(0.0309629740435296),
- FRAC_CONST(0.0315367466624615),
- FRAC_CONST(0.0321173333199732),
- FRAC_CONST(0.0327047708336193),
- FRAC_CONST(0.0332990958021720),
- FRAC_CONST(0.0339003446014307),
- FRAC_CONST(0.0345085533800302),
- FRAC_CONST(0.0351237580552491),
- FRAC_CONST(0.0357459943088193),
- FRAC_CONST(0.0363752975827358),
- FRAC_CONST(0.0370117030750704),
- FRAC_CONST(0.0376552457357870),
- FRAC_CONST(0.0383059602625614),
- FRAC_CONST(0.0389638810966056),
- FRAC_CONST(0.0396290424184964),
- FRAC_CONST(0.0403014781440112),
- FRAC_CONST(0.0409812219199691),
- FRAC_CONST(0.0416683071200799),
- FRAC_CONST(0.0423627668408009),
- FRAC_CONST(0.0430646338972016),
- FRAC_CONST(0.0437739408188385),
- FRAC_CONST(0.0444907198456388),
- FRAC_CONST(0.0452150029237951),
- FRAC_CONST(0.0459468217016708),
- FRAC_CONST(0.0466862075257170),
- FRAC_CONST(0.0474331914364021),
- FRAC_CONST(0.0481878041641539),
- FRAC_CONST(0.0489500761253148),
- FRAC_CONST(0.0497200374181119),
- FRAC_CONST(0.0504977178186404),
- FRAC_CONST(0.0512831467768636),
- FRAC_CONST(0.0520763534126273),
- FRAC_CONST(0.0528773665116913),
- FRAC_CONST(0.0536862145217772),
- FRAC_CONST(0.0545029255486345),
- FRAC_CONST(0.0553275273521232),
- FRAC_CONST(0.0561600473423164),
- FRAC_CONST(0.0570005125756209),
- FRAC_CONST(0.0578489497509179),
- FRAC_CONST(0.0587053852057233),
- FRAC_CONST(0.0595698449123695),
- FRAC_CONST(0.0604423544742077),
- FRAC_CONST(0.0613229391218317),
- FRAC_CONST(0.0622116237093247),
- FRAC_CONST(0.0631084327105284),
- FRAC_CONST(0.0640133902153352),
- FRAC_CONST(0.0649265199260043),
- FRAC_CONST(0.0658478451535027),
- FRAC_CONST(0.0667773888138695),
- FRAC_CONST(0.0677151734246072),
- FRAC_CONST(0.0686612211010977),
- FRAC_CONST(0.0696155535530446),
- FRAC_CONST(0.0705781920809429),
- FRAC_CONST(0.0715491575725758),
- FRAC_CONST(0.0725284704995383),
- FRAC_CONST(0.0735161509137906),
- FRAC_CONST(0.0745122184442388),
- FRAC_CONST(0.0755166922933461),
- FRAC_CONST(0.0765295912337720),
- FRAC_CONST(0.0775509336050437),
- FRAC_CONST(0.0785807373102561),
- FRAC_CONST(0.0796190198128044),
- FRAC_CONST(0.0806657981331473),
- FRAC_CONST(0.0817210888456026),
- FRAC_CONST(0.0827849080751753),
- FRAC_CONST(0.0838572714944183),
- FRAC_CONST(0.0849381943203265),
- FRAC_CONST(0.0860276913112652),
- FRAC_CONST(0.0871257767639319),
- FRAC_CONST(0.0882324645103534),
- FRAC_CONST(0.0893477679149177),
- FRAC_CONST(0.0904716998714418),
- FRAC_CONST(0.0916042728002747),
- FRAC_CONST(0.0927454986454381),
- FRAC_CONST(0.0938953888718020),
- FRAC_CONST(0.0950539544622996),
- FRAC_CONST(0.0962212059151784),
- FRAC_CONST(0.0973971532412897),
- FRAC_CONST(0.0985818059614169),
- FRAC_CONST(0.0997751731036425),
- FRAC_CONST(0.1009772632007537),
- FRAC_CONST(0.1021880842876888),
- FRAC_CONST(0.1034076438990227),
- FRAC_CONST(0.1046359490664932),
- FRAC_CONST(0.1058730063165681),
- FRAC_CONST(0.1071188216680533),
- FRAC_CONST(0.1083734006297428),
- FRAC_CONST(0.1096367481981100),
- FRAC_CONST(0.1109088688550422),
- FRAC_CONST(0.1121897665656167),
- FRAC_CONST(0.1134794447759207),
- FRAC_CONST(0.1147779064109143),
- FRAC_CONST(0.1160851538723372),
- FRAC_CONST(0.1174011890366591),
- FRAC_CONST(0.1187260132530751),
- FRAC_CONST(0.1200596273415457),
- FRAC_CONST(0.1214020315908810),
- FRAC_CONST(0.1227532257568719),
- FRAC_CONST(0.1241132090604651),
- FRAC_CONST(0.1254819801859856),
- FRAC_CONST(0.1268595372794049),
- FRAC_CONST(0.1282458779466558),
- FRAC_CONST(0.1296409992519942),
- FRAC_CONST(0.1310448977164081),
- FRAC_CONST(0.1324575693160745),
- FRAC_CONST(0.1338790094808633),
- FRAC_CONST(0.1353092130928902),
- FRAC_CONST(0.1367481744851168),
- FRAC_CONST(0.1381958874400010),
- FRAC_CONST(0.1396523451881945),
- FRAC_CONST(0.1411175404072910),
- FRAC_CONST(0.1425914652206223),
- FRAC_CONST(0.1440741111961058),
- FRAC_CONST(0.1455654693451402),
- FRAC_CONST(0.1470655301215526),
- FRAC_CONST(0.1485742834205956),
- FRAC_CONST(0.1500917185779945),
- FRAC_CONST(0.1516178243690463),
- FRAC_CONST(0.1531525890077689),
- FRAC_CONST(0.1546960001461024),
- FRAC_CONST(0.1562480448731608),
- FRAC_CONST(0.1578087097145364),
- FRAC_CONST(0.1593779806316558),
- FRAC_CONST(0.1609558430211876),
- FRAC_CONST(0.1625422817145027),
- FRAC_CONST(0.1641372809771871),
- FRAC_CONST(0.1657408245086070),
- FRAC_CONST(0.1673528954415270),
- FRAC_CONST(0.1689734763417811),
- FRAC_CONST(0.1706025492079969),
- FRAC_CONST(0.1722400954713725),
- FRAC_CONST(0.1738860959955082),
- FRAC_CONST(0.1755405310762898),
- FRAC_CONST(0.1772033804418275),
- FRAC_CONST(0.1788746232524467),
- FRAC_CONST(0.1805542381007349),
- FRAC_CONST(0.1822422030116404),
- FRAC_CONST(0.1839384954426268),
- FRAC_CONST(0.1856430922838810),
- FRAC_CONST(0.1873559698585756),
- FRAC_CONST(0.1890771039231862),
- FRAC_CONST(0.1908064696678625),
- FRAC_CONST(0.1925440417168546),
- FRAC_CONST(0.1942897941289937),
- FRAC_CONST(0.1960437003982277),
- FRAC_CONST(0.1978057334542116),
- FRAC_CONST(0.1995758656629525),
- FRAC_CONST(0.2013540688275098),
- FRAC_CONST(0.2031403141887507),
- FRAC_CONST(0.2049345724261595),
- FRAC_CONST(0.2067368136587033),
- FRAC_CONST(0.2085470074457521),
- FRAC_CONST(0.2103651227880538),
- FRAC_CONST(0.2121911281287646),
- FRAC_CONST(0.2140249913545346),
- FRAC_CONST(0.2158666797966480),
- FRAC_CONST(0.2177161602322188),
- FRAC_CONST(0.2195733988854414),
- FRAC_CONST(0.2214383614288963),
- FRAC_CONST(0.2233110129849106),
- FRAC_CONST(0.2251913181269740),
- FRAC_CONST(0.2270792408812093),
- FRAC_CONST(0.2289747447278976),
- FRAC_CONST(0.2308777926030592),
- FRAC_CONST(0.2327883469000885),
- FRAC_CONST(0.2347063694714437),
- FRAC_CONST(0.2366318216303919),
- FRAC_CONST(0.2385646641528076),
- FRAC_CONST(0.2405048572790267),
- FRAC_CONST(0.2424523607157545),
- FRAC_CONST(0.2444071336380283),
- FRAC_CONST(0.2463691346912334),
- FRAC_CONST(0.2483383219931741),
- FRAC_CONST(0.2503146531361985),
- FRAC_CONST(0.2522980851893767),
- FRAC_CONST(0.2542885747007335),
- FRAC_CONST(0.2562860776995335),
- FRAC_CONST(0.2582905496986215),
- FRAC_CONST(0.2603019456968142),
- FRAC_CONST(0.2623202201813464),
- FRAC_CONST(0.2643453271303700),
- FRAC_CONST(0.2663772200155053),
- FRAC_CONST(0.2684158518044454),
- FRAC_CONST(0.2704611749636135),
- FRAC_CONST(0.2725131414608710),
- FRAC_CONST(0.2745717027682799),
- FRAC_CONST(0.2766368098649151),
- FRAC_CONST(0.2787084132397296),
- FRAC_CONST(0.2807864628944707),
- FRAC_CONST(0.2828709083466482),
- FRAC_CONST(0.2849616986325523),
- FRAC_CONST(0.2870587823103237),
- FRAC_CONST(0.2891621074630737),
- FRAC_CONST(0.2912716217020546),
- FRAC_CONST(0.2933872721698803),
- FRAC_CONST(0.2955090055437973),
- FRAC_CONST(0.2976367680390041),
- FRAC_CONST(0.2997705054120213),
- FRAC_CONST(0.3019101629641097),
- FRAC_CONST(0.3040556855447379),
- FRAC_CONST(0.3062070175550981),
- FRAC_CONST(0.3083641029516701),
- FRAC_CONST(0.3105268852498334),
- FRAC_CONST(0.3126953075275265),
- FRAC_CONST(0.3148693124289546),
- FRAC_CONST(0.3170488421683428),
- FRAC_CONST(0.3192338385337370),
- FRAC_CONST(0.3214242428908514),
- FRAC_CONST(0.3236199961869606),
- FRAC_CONST(0.3258210389548392),
- FRAC_CONST(0.3280273113167459),
- FRAC_CONST(0.3302387529884521),
- FRAC_CONST(0.3324553032833160),
- FRAC_CONST(0.3346769011164010),
- FRAC_CONST(0.3369034850086373),
- FRAC_CONST(0.3391349930910280),
- FRAC_CONST(0.3413713631088974),
- FRAC_CONST(0.3436125324261830),
- FRAC_CONST(0.3458584380297697),
- FRAC_CONST(0.3481090165338656),
- FRAC_CONST(0.3503642041844199),
- FRAC_CONST(0.3526239368635820),
- FRAC_CONST(0.3548881500942010),
- FRAC_CONST(0.3571567790443668),
- FRAC_CONST(0.3594297585319891),
- FRAC_CONST(0.3617070230294185),
- FRAC_CONST(0.3639885066681048),
- FRAC_CONST(0.3662741432432950),
- FRAC_CONST(0.3685638662187693),
- FRAC_CONST(0.3708576087316147),
- FRAC_CONST(0.3731553035970366),
- FRAC_CONST(0.3754568833132069),
- FRAC_CONST(0.3777622800661488),
- FRAC_CONST(0.3800714257346570),
- FRAC_CONST(0.3823842518952546),
- FRAC_CONST(0.3847006898271841),
- FRAC_CONST(0.3870206705174334),
- FRAC_CONST(0.3893441246657958),
- FRAC_CONST(0.3916709826899639),
- FRAC_CONST(0.3940011747306560),
- FRAC_CONST(0.3963346306567764),
- FRAC_CONST(0.3986712800706062),
- FRAC_CONST(0.4010110523130271),
- FRAC_CONST(0.4033538764687756),
- FRAC_CONST(0.4056996813717284),
- FRAC_CONST(0.4080483956102172),
- FRAC_CONST(0.4103999475323736),
- FRAC_CONST(0.4127542652515031),
- FRAC_CONST(0.4151112766514873),
- FRAC_CONST(0.4174709093922143),
- FRAC_CONST(0.4198330909150365),
- FRAC_CONST(0.4221977484482556),
- FRAC_CONST(0.4245648090126334),
- FRAC_CONST(0.4269341994269293),
- FRAC_CONST(0.4293058463134616),
- FRAC_CONST(0.4316796761036958),
- FRAC_CONST(0.4340556150438547),
- FRAC_CONST(0.4364335892005536),
- FRAC_CONST(0.4388135244664580),
- FRAC_CONST(0.4411953465659639),
- FRAC_CONST(0.4435789810609000),
- FRAC_CONST(0.4459643533562509),
- FRAC_CONST(0.4483513887059016),
- FRAC_CONST(0.4507400122184019),
- FRAC_CONST(0.4531301488627497),
- FRAC_CONST(0.4555217234741947),
- FRAC_CONST(0.4579146607600593),
- FRAC_CONST(0.4603088853055777),
- FRAC_CONST(0.4627043215797521),
- FRAC_CONST(0.4651008939412254),
- FRAC_CONST(0.4674985266441709),
- FRAC_CONST(0.4698971438441951),
- FRAC_CONST(0.4722966696042580),
- FRAC_CONST(0.4746970279006055),
- FRAC_CONST(0.4770981426287164),
- FRAC_CONST(0.4794999376092619),
- FRAC_CONST(0.4819023365940778),
- FRAC_CONST(0.4843052632721476),
- FRAC_CONST(0.4867086412755978),
- FRAC_CONST(0.4891123941857028),
- FRAC_CONST(0.4915164455388997),
- FRAC_CONST(0.4939207188328126),
- FRAC_CONST(0.4963251375322855),
- FRAC_CONST(0.4987296250754225),
- FRAC_CONST(0.5011341048796359),
- FRAC_CONST(0.5035385003477012),
- FRAC_CONST(0.5059427348738168),
- FRAC_CONST(0.5083467318496706),
- FRAC_CONST(0.5107504146705106),
- FRAC_CONST(0.5131537067412193),
- FRAC_CONST(0.5155565314823923),
- FRAC_CONST(0.5179588123364193),
- FRAC_CONST(0.5203604727735667),
- FRAC_CONST(0.5227614362980630),
- FRAC_CONST(0.5251616264541841),
- FRAC_CONST(0.5275609668323384),
- FRAC_CONST(0.5299593810751532),
- FRAC_CONST(0.5323567928835578),
- FRAC_CONST(0.5347531260228663),
- FRAC_CONST(0.5371483043288580),
- FRAC_CONST(0.5395422517138538),
- FRAC_CONST(0.5419348921727899),
- FRAC_CONST(0.5443261497892862),
- FRAC_CONST(0.5467159487417104),
- FRAC_CONST(0.5491042133092364),
- FRAC_CONST(0.5514908678778958),
- FRAC_CONST(0.5538758369466227),
- FRAC_CONST(0.5562590451332913),
- FRAC_CONST(0.5586404171807443),
- FRAC_CONST(0.5610198779628133),
- FRAC_CONST(0.5633973524903286),
- FRAC_CONST(0.5657727659171199),
- FRAC_CONST(0.5681460435460047),
- FRAC_CONST(0.5705171108347663),
- FRAC_CONST(0.5728858934021188),
- FRAC_CONST(0.5752523170336598),
- FRAC_CONST(0.5776163076878088),
- FRAC_CONST(0.5799777915017323),
- FRAC_CONST(0.5823366947972535),
- FRAC_CONST(0.5846929440867458),
- FRAC_CONST(0.5870464660790119),
- FRAC_CONST(0.5893971876851449),
- FRAC_CONST(0.5917450360243719),
- FRAC_CONST(0.5940899384298793),
- FRAC_CONST(0.5964318224546208),
- FRAC_CONST(0.5987706158771039),
- FRAC_CONST(0.6011062467071583),
- FRAC_CONST(0.6034386431916822),
- FRAC_CONST(0.6057677338203681),
- FRAC_CONST(0.6080934473314057),
- FRAC_CONST(0.6104157127171639),
- FRAC_CONST(0.6127344592298474),
- FRAC_CONST(0.6150496163871310),
- FRAC_CONST(0.6173611139777690),
- FRAC_CONST(0.6196688820671789),
- FRAC_CONST(0.6219728510029997),
- FRAC_CONST(0.6242729514206247),
- FRAC_CONST(0.6265691142487051),
- FRAC_CONST(0.6288612707146283),
- FRAC_CONST(0.6311493523499663),
- FRAC_CONST(0.6334332909958958),
- FRAC_CONST(0.6357130188085891),
- FRAC_CONST(0.6379884682645743),
- FRAC_CONST(0.6402595721660647),
- FRAC_CONST(0.6425262636462578),
- FRAC_CONST(0.6447884761746012),
- FRAC_CONST(0.6470461435620266),
- FRAC_CONST(0.6492991999661505),
- FRAC_CONST(0.6515475798964411),
- FRAC_CONST(0.6537912182193508),
- FRAC_CONST(0.6560300501634142),
- FRAC_CONST(0.6582640113243098),
- FRAC_CONST(0.6604930376698862),
- FRAC_CONST(0.6627170655451516),
- FRAC_CONST(0.6649360316772256),
- FRAC_CONST(0.6671498731802533),
- FRAC_CONST(0.6693585275602818),
- FRAC_CONST(0.6715619327200959),
- FRAC_CONST(0.6737600269640164),
- FRAC_CONST(0.6759527490026566),
- FRAC_CONST(0.6781400379576392),
- FRAC_CONST(0.6803218333662715),
- FRAC_CONST(0.6824980751861787),
- FRAC_CONST(0.6846687037998949),
- FRAC_CONST(0.6868336600194123),
- FRAC_CONST(0.6889928850906855),
- FRAC_CONST(0.6911463206980928),
- FRAC_CONST(0.6932939089688525),
- FRAC_CONST(0.6954355924773949),
- FRAC_CONST(0.6975713142496884),
- FRAC_CONST(0.6997010177675195),
- FRAC_CONST(0.7018246469727265),
- FRAC_CONST(0.7039421462713862),
- FRAC_CONST(0.7060534605379528),
- FRAC_CONST(0.7081585351193496),
- FRAC_CONST(0.7102573158390105),
- FRAC_CONST(0.7123497490008750),
- FRAC_CONST(0.7144357813933307),
- FRAC_CONST(0.7165153602931092),
- FRAC_CONST(0.7185884334691287),
- FRAC_CONST(0.7206549491862871),
- FRAC_CONST(0.7227148562092042),
- FRAC_CONST(0.7247681038059106),
- FRAC_CONST(0.7268146417514855),
- FRAC_CONST(0.7288544203316418),
- FRAC_CONST(0.7308873903462577),
- FRAC_CONST(0.7329135031128549),
- FRAC_CONST(0.7349327104700221),
- FRAC_CONST(0.7369449647807855),
- FRAC_CONST(0.7389502189359237),
- FRAC_CONST(0.7409484263572271),
- FRAC_CONST(0.7429395410007016),
- FRAC_CONST(0.7449235173597176),
- FRAC_CONST(0.7469003104681008),
- FRAC_CONST(0.7488698759031670),
- FRAC_CONST(0.7508321697887005),
- FRAC_CONST(0.7527871487978728),
- FRAC_CONST(0.7547347701561059),
- FRAC_CONST(0.7566749916438754),
- FRAC_CONST(0.7586077715994560),
- FRAC_CONST(0.7605330689216074),
- FRAC_CONST(0.7624508430722016),
- FRAC_CONST(0.7643610540787891),
- FRAC_CONST(0.7662636625371070),
- FRAC_CONST(0.7681586296135255),
- FRAC_CONST(0.7700459170474343),
- FRAC_CONST(0.7719254871535672),
- FRAC_CONST(0.7737973028242671),
- FRAC_CONST(0.7756613275316875),
- FRAC_CONST(0.7775175253299340),
- FRAC_CONST(0.7793658608571425),
- FRAC_CONST(0.7812062993374951),
- FRAC_CONST(0.7830388065831744),
- FRAC_CONST(0.7848633489962533),
- FRAC_CONST(0.7866798935705233),
- FRAC_CONST(0.7884884078932579),
- FRAC_CONST(0.7902888601469138),
- FRAC_CONST(0.7920812191107668),
- FRAC_CONST(0.7938654541624850),
- FRAC_CONST(0.7956415352796368),
- FRAC_CONST(0.7974094330411343),
- FRAC_CONST(0.7991691186286133),
- FRAC_CONST(0.8009205638277465),
- FRAC_CONST(0.8026637410294932),
- FRAC_CONST(0.8043986232312831),
- FRAC_CONST(0.8061251840381346),
- FRAC_CONST(0.8078433976637077),
- FRAC_CONST(0.8095532389312917),
- FRAC_CONST(0.8112546832747255),
- FRAC_CONST(0.8129477067392539),
- FRAC_CONST(0.8146322859823164),
- FRAC_CONST(0.8163083982742698),
- FRAC_CONST(0.8179760214990457),
- FRAC_CONST(0.8196351341547393),
- FRAC_CONST(0.8212857153541345),
- FRAC_CONST(0.8229277448251595),
- FRAC_CONST(0.8245612029112778),
- FRAC_CONST(0.8261860705718113),
- FRAC_CONST(0.8278023293821971),
- FRAC_CONST(0.8294099615341773),
- FRAC_CONST(0.8310089498359212),
- FRAC_CONST(0.8325992777120815),
- FRAC_CONST(0.8341809292037831),
- FRAC_CONST(0.8357538889685445),
- FRAC_CONST(0.8373181422801330),
- FRAC_CONST(0.8388736750283521),
- FRAC_CONST(0.8404204737187619),
- FRAC_CONST(0.8419585254723335),
- FRAC_CONST(0.8434878180250348),
- FRAC_CONST(0.8450083397273509),
- FRAC_CONST(0.8465200795437368),
- FRAC_CONST(0.8480230270520029),
- FRAC_CONST(0.8495171724426350),
- FRAC_CONST(0.8510025065180464),
- FRAC_CONST(0.8524790206917633),
- FRAC_CONST(0.8539467069875448),
- FRAC_CONST(0.8554055580384357),
- FRAC_CONST(0.8568555670857525),
- FRAC_CONST(0.8582967279780043),
- FRAC_CONST(0.8597290351697464),
- FRAC_CONST(0.8611524837203691),
- FRAC_CONST(0.8625670692928198),
- FRAC_CONST(0.8639727881522599),
- FRAC_CONST(0.8653696371646555),
- FRAC_CONST(0.8667576137953045),
- FRAC_CONST(0.8681367161072958),
- FRAC_CONST(0.8695069427599065),
- FRAC_CONST(0.8708682930069319),
- FRAC_CONST(0.8722207666949527),
- FRAC_CONST(0.8735643642615368),
- FRAC_CONST(0.8748990867333771),
- FRAC_CONST(0.8762249357243662),
- FRAC_CONST(0.8775419134336067),
- FRAC_CONST(0.8788500226433579),
- FRAC_CONST(0.8801492667169208),
- FRAC_CONST(0.8814396495964587),
- FRAC_CONST(0.8827211758007560),
- FRAC_CONST(0.8839938504229149),
- FRAC_CONST(0.8852576791279895),
- FRAC_CONST(0.8865126681505587),
- FRAC_CONST(0.8877588242922386),
- FRAC_CONST(0.8889961549191320),
- FRAC_CONST(0.8902246679592184),
- FRAC_CONST(0.8914443718996848),
- FRAC_CONST(0.8926552757841945),
- FRAC_CONST(0.8938573892100969),
- FRAC_CONST(0.8950507223255798),
- FRAC_CONST(0.8962352858267605),
- FRAC_CONST(0.8974110909547198),
- FRAC_CONST(0.8985781494924783),
- FRAC_CONST(0.8997364737619142),
- FRAC_CONST(0.9008860766206249),
- FRAC_CONST(0.9020269714587307),
- FRAC_CONST(0.9031591721956235),
- FRAC_CONST(0.9042826932766591),
- FRAC_CONST(0.9053975496697941),
- FRAC_CONST(0.9065037568621681),
- FRAC_CONST(0.9076013308566311),
- FRAC_CONST(0.9086902881682180),
- FRAC_CONST(0.9097706458205682),
- FRAC_CONST(0.9108424213422940),
- FRAC_CONST(0.9119056327632955),
- FRAC_CONST(0.9129602986110235),
- FRAC_CONST(0.9140064379066919),
- FRAC_CONST(0.9150440701614393),
- FRAC_CONST(0.9160732153724396),
- FRAC_CONST(0.9170938940189634),
- FRAC_CONST(0.9181061270583908),
- FRAC_CONST(0.9191099359221748),
- FRAC_CONST(0.9201053425117579),
- FRAC_CONST(0.9210923691944400),
- FRAC_CONST(0.9220710387992010),
- FRAC_CONST(0.9230413746124764),
- FRAC_CONST(0.9240034003738882),
- FRAC_CONST(0.9249571402719298),
- FRAC_CONST(0.9259026189396085),
- FRAC_CONST(0.9268398614500427),
- FRAC_CONST(0.9277688933120170),
- FRAC_CONST(0.9286897404654957),
- FRAC_CONST(0.9296024292770939),
- FRAC_CONST(0.9305069865355076),
- FRAC_CONST(0.9314034394469048),
- FRAC_CONST(0.9322918156302762),
- FRAC_CONST(0.9331721431127471),
- FRAC_CONST(0.9340444503248519),
- FRAC_CONST(0.9349087660957711),
- FRAC_CONST(0.9357651196485313),
- FRAC_CONST(0.9366135405951697),
- FRAC_CONST(0.9374540589318637),
- FRAC_CONST(0.9382867050340261),
- FRAC_CONST(0.9391115096513655),
- FRAC_CONST(0.9399285039029165),
- FRAC_CONST(0.9407377192720349),
- FRAC_CONST(0.9415391876013639),
- FRAC_CONST(0.9423329410877687),
- FRAC_CONST(0.9431190122772415),
- FRAC_CONST(0.9438974340597782),
- FRAC_CONST(0.9446682396642262),
- FRAC_CONST(0.9454314626531054),
- FRAC_CONST(0.9461871369174033),
- FRAC_CONST(0.9469352966713429),
- FRAC_CONST(0.9476759764471278),
- FRAC_CONST(0.9484092110896616),
- FRAC_CONST(0.9491350357512457),
- FRAC_CONST(0.9498534858862532),
- FRAC_CONST(0.9505645972457831),
- FRAC_CONST(0.9512684058722927),
- FRAC_CONST(0.9519649480942105),
- FRAC_CONST(0.9526542605205314),
- FRAC_CONST(0.9533363800353921),
- FRAC_CONST(0.9540113437926313),
- FRAC_CONST(0.9546791892103320),
- FRAC_CONST(0.9553399539653500),
- FRAC_CONST(0.9559936759878265),
- FRAC_CONST(0.9566403934556893),
- FRAC_CONST(0.9572801447891388),
- FRAC_CONST(0.9579129686451244),
- FRAC_CONST(0.9585389039118085),
- FRAC_CONST(0.9591579897030224),
- FRAC_CONST(0.9597702653527108),
- FRAC_CONST(0.9603757704093711),
- FRAC_CONST(0.9609745446304828),
- FRAC_CONST(0.9615666279769324),
- FRAC_CONST(0.9621520606074324),
- FRAC_CONST(0.9627308828729358),
- FRAC_CONST(0.9633031353110477),
- FRAC_CONST(0.9638688586404335),
- FRAC_CONST(0.9644280937552258),
- FRAC_CONST(0.9649808817194311),
- FRAC_CONST(0.9655272637613366),
- FRAC_CONST(0.9660672812679171),
- FRAC_CONST(0.9666009757792454),
- FRAC_CONST(0.9671283889829055),
- FRAC_CONST(0.9676495627084089),
- FRAC_CONST(0.9681645389216160),
- FRAC_CONST(0.9686733597191652),
- FRAC_CONST(0.9691760673229058),
- FRAC_CONST(0.9696727040743406),
- FRAC_CONST(0.9701633124290767),
- FRAC_CONST(0.9706479349512860),
- FRAC_CONST(0.9711266143081750),
- FRAC_CONST(0.9715993932644684),
- FRAC_CONST(0.9720663146769026),
- FRAC_CONST(0.9725274214887337),
- FRAC_CONST(0.9729827567242596),
- FRAC_CONST(0.9734323634833574),
- FRAC_CONST(0.9738762849360358),
- FRAC_CONST(0.9743145643170059),
- FRAC_CONST(0.9747472449202687),
- FRAC_CONST(0.9751743700937215),
- FRAC_CONST(0.9755959832337850),
- FRAC_CONST(0.9760121277800496),
- FRAC_CONST(0.9764228472099433),
- FRAC_CONST(0.9768281850334235),
- FRAC_CONST(0.9772281847876897),
- FRAC_CONST(0.9776228900319223),
- FRAC_CONST(0.9780123443420448),
- FRAC_CONST(0.9783965913055132),
- FRAC_CONST(0.9787756745161313),
- FRAC_CONST(0.9791496375688939),
- FRAC_CONST(0.9795185240548578),
- FRAC_CONST(0.9798823775560431),
- FRAC_CONST(0.9802412416403639),
- FRAC_CONST(0.9805951598565897),
- FRAC_CONST(0.9809441757293399),
- FRAC_CONST(0.9812883327541090),
- FRAC_CONST(0.9816276743923267),
- FRAC_CONST(0.9819622440664515),
- FRAC_CONST(0.9822920851550995),
- FRAC_CONST(0.9826172409882086),
- FRAC_CONST(0.9829377548422400),
- FRAC_CONST(0.9832536699354163),
- FRAC_CONST(0.9835650294229984),
- FRAC_CONST(0.9838718763926001),
- FRAC_CONST(0.9841742538595437),
- FRAC_CONST(0.9844722047622547),
- FRAC_CONST(0.9847657719576983),
- FRAC_CONST(0.9850549982168574),
- FRAC_CONST(0.9853399262202529),
- FRAC_CONST(0.9856205985535073),
- FRAC_CONST(0.9858970577029519),
- FRAC_CONST(0.9861693460512790),
- FRAC_CONST(0.9864375058732389),
- FRAC_CONST(0.9867015793313820),
- FRAC_CONST(0.9869616084718489),
- FRAC_CONST(0.9872176352202061),
- FRAC_CONST(0.9874697013773301),
- FRAC_CONST(0.9877178486153397),
- FRAC_CONST(0.9879621184735767),
- FRAC_CONST(0.9882025523546365),
- FRAC_CONST(0.9884391915204485),
- FRAC_CONST(0.9886720770884069),
- FRAC_CONST(0.9889012500275530),
- FRAC_CONST(0.9891267511548089),
- FRAC_CONST(0.9893486211312621),
- FRAC_CONST(0.9895669004585049),
- FRAC_CONST(0.9897816294750255),
- FRAC_CONST(0.9899928483526520),
- FRAC_CONST(0.9902005970930525),
- FRAC_CONST(0.9904049155242876),
- FRAC_CONST(0.9906058432974180),
- FRAC_CONST(0.9908034198831690),
- FRAC_CONST(0.9909976845686489),
- FRAC_CONST(0.9911886764541239),
- FRAC_CONST(0.9913764344498495),
- FRAC_CONST(0.9915609972729590),
- FRAC_CONST(0.9917424034444086),
- FRAC_CONST(0.9919206912859797),
- FRAC_CONST(0.9920958989173397),
- FRAC_CONST(0.9922680642531603),
- FRAC_CONST(0.9924372250002933),
- FRAC_CONST(0.9926034186550070),
- FRAC_CONST(0.9927666825002789),
- FRAC_CONST(0.9929270536031491),
- FRAC_CONST(0.9930845688121325),
- FRAC_CONST(0.9932392647546895),
- FRAC_CONST(0.9933911778347579),
- FRAC_CONST(0.9935403442303433),
- FRAC_CONST(0.9936867998911693),
- FRAC_CONST(0.9938305805363887),
- FRAC_CONST(0.9939717216523539),
- FRAC_CONST(0.9941102584904481),
- FRAC_CONST(0.9942462260649764),
- FRAC_CONST(0.9943796591511174),
- FRAC_CONST(0.9945105922829353),
- FRAC_CONST(0.9946390597514524),
- FRAC_CONST(0.9947650956027824),
- FRAC_CONST(0.9948887336363228),
- FRAC_CONST(0.9950100074030103),
- FRAC_CONST(0.9951289502036336),
- FRAC_CONST(0.9952455950872091),
- FRAC_CONST(0.9953599748494155),
- FRAC_CONST(0.9954721220310890),
- FRAC_CONST(0.9955820689167787),
- FRAC_CONST(0.9956898475333619),
- FRAC_CONST(0.9957954896487196),
- FRAC_CONST(0.9958990267704713),
- FRAC_CONST(0.9960004901447701),
- FRAC_CONST(0.9960999107551559),
- FRAC_CONST(0.9961973193214694),
- FRAC_CONST(0.9962927462988245),
- FRAC_CONST(0.9963862218766388),
- FRAC_CONST(0.9964777759777242),
- FRAC_CONST(0.9965674382574342),
- FRAC_CONST(0.9966552381028704),
- FRAC_CONST(0.9967412046321465),
- FRAC_CONST(0.9968253666937095),
- FRAC_CONST(0.9969077528657186),
- FRAC_CONST(0.9969883914554805),
- FRAC_CONST(0.9970673104989413),
- FRAC_CONST(0.9971445377602348),
- FRAC_CONST(0.9972201007312871),
- FRAC_CONST(0.9972940266314749),
- FRAC_CONST(0.9973663424073412),
- FRAC_CONST(0.9974370747323638),
- FRAC_CONST(0.9975062500067785),
- FRAC_CONST(0.9975738943574574),
- FRAC_CONST(0.9976400336378379),
- FRAC_CONST(0.9977046934279079),
- FRAC_CONST(0.9977678990342401),
- FRAC_CONST(0.9978296754900812),
- FRAC_CONST(0.9978900475554902),
- FRAC_CONST(0.9979490397175296),
- FRAC_CONST(0.9980066761905056),
- FRAC_CONST(0.9980629809162593),
- FRAC_CONST(0.9981179775645063),
- FRAC_CONST(0.9981716895332257),
- FRAC_CONST(0.9982241399490979),
- FRAC_CONST(0.9982753516679893),
- FRAC_CONST(0.9983253472754841),
- FRAC_CONST(0.9983741490874634),
- FRAC_CONST(0.9984217791507299),
- FRAC_CONST(0.9984682592436778),
- FRAC_CONST(0.9985136108770075),
- FRAC_CONST(0.9985578552944850),
- FRAC_CONST(0.9986010134737439),
- FRAC_CONST(0.9986431061271304),
- FRAC_CONST(0.9986841537025921),
- FRAC_CONST(0.9987241763846056),
- FRAC_CONST(0.9987631940951476),
- FRAC_CONST(0.9988012264947044),
- FRAC_CONST(0.9988382929833222),
- FRAC_CONST(0.9988744127016956),
- FRAC_CONST(0.9989096045322947),
- FRAC_CONST(0.9989438871005292),
- FRAC_CONST(0.9989772787759494),
- FRAC_CONST(0.9990097976734847),
- FRAC_CONST(0.9990414616547146),
- FRAC_CONST(0.9990722883291779),
- FRAC_CONST(0.9991022950557125),
- FRAC_CONST(0.9991314989438310),
- FRAC_CONST(0.9991599168551279),
- FRAC_CONST(0.9991875654047181),
- FRAC_CONST(0.9992144609627068),
- FRAC_CONST(0.9992406196556911),
- FRAC_CONST(0.9992660573682882),
- FRAC_CONST(0.9992907897446957),
- FRAC_CONST(0.9993148321902777),
- FRAC_CONST(0.9993381998731797),
- FRAC_CONST(0.9993609077259696),
- FRAC_CONST(0.9993829704473038),
- FRAC_CONST(0.9994044025036201),
- FRAC_CONST(0.9994252181308537),
- FRAC_CONST(0.9994454313361775),
- FRAC_CONST(0.9994650558997651),
- FRAC_CONST(0.9994841053765757),
- FRAC_CONST(0.9995025930981609),
- FRAC_CONST(0.9995205321744921),
- FRAC_CONST(0.9995379354958073),
- FRAC_CONST(0.9995548157344778),
- FRAC_CONST(0.9995711853468930),
- FRAC_CONST(0.9995870565753632),
- FRAC_CONST(0.9996024414500382),
- FRAC_CONST(0.9996173517908444),
- FRAC_CONST(0.9996317992094352),
- FRAC_CONST(0.9996457951111574),
- FRAC_CONST(0.9996593506970310),
- FRAC_CONST(0.9996724769657434),
- FRAC_CONST(0.9996851847156547),
- FRAC_CONST(0.9996974845468164),
- FRAC_CONST(0.9997093868630000),
- FRAC_CONST(0.9997209018737374),
- FRAC_CONST(0.9997320395963699),
- FRAC_CONST(0.9997428098581069),
- FRAC_CONST(0.9997532222980933),
- FRAC_CONST(0.9997632863694836),
- FRAC_CONST(0.9997730113415246),
- FRAC_CONST(0.9997824063016426),
- FRAC_CONST(0.9997914801575380),
- FRAC_CONST(0.9998002416392840),
- FRAC_CONST(0.9998086993014300),
- FRAC_CONST(0.9998168615251084),
- FRAC_CONST(0.9998247365201450),
- FRAC_CONST(0.9998323323271717),
- FRAC_CONST(0.9998396568197407),
- FRAC_CONST(0.9998467177064404),
- FRAC_CONST(0.9998535225330116),
- FRAC_CONST(0.9998600786844637),
- FRAC_CONST(0.9998663933871905),
- FRAC_CONST(0.9998724737110845),
- FRAC_CONST(0.9998783265716498),
- FRAC_CONST(0.9998839587321121),
- FRAC_CONST(0.9998893768055266),
- FRAC_CONST(0.9998945872568815),
- FRAC_CONST(0.9998995964051983),
- FRAC_CONST(0.9999044104256269),
- FRAC_CONST(0.9999090353515359),
- FRAC_CONST(0.9999134770765971),
- FRAC_CONST(0.9999177413568642),
- FRAC_CONST(0.9999218338128448),
- FRAC_CONST(0.9999257599315647),
- FRAC_CONST(0.9999295250686255),
- FRAC_CONST(0.9999331344502529),
- FRAC_CONST(0.9999365931753376),
- FRAC_CONST(0.9999399062174669),
- FRAC_CONST(0.9999430784269460),
- FRAC_CONST(0.9999461145328103),
- FRAC_CONST(0.9999490191448277),
- FRAC_CONST(0.9999517967554878),
- FRAC_CONST(0.9999544517419835),
- FRAC_CONST(0.9999569883681778),
- FRAC_CONST(0.9999594107865607),
- FRAC_CONST(0.9999617230401926),
- FRAC_CONST(0.9999639290646355),
- FRAC_CONST(0.9999660326898712),
- FRAC_CONST(0.9999680376422052),
- FRAC_CONST(0.9999699475461585),
- FRAC_CONST(0.9999717659263435),
- FRAC_CONST(0.9999734962093266),
- FRAC_CONST(0.9999751417254756),
- FRAC_CONST(0.9999767057107922),
- FRAC_CONST(0.9999781913087290),
- FRAC_CONST(0.9999796015719915),
- FRAC_CONST(0.9999809394643231),
- FRAC_CONST(0.9999822078622751),
- FRAC_CONST(0.9999834095569596),
- FRAC_CONST(0.9999845472557860),
- FRAC_CONST(0.9999856235841805),
- FRAC_CONST(0.9999866410872889),
- FRAC_CONST(0.9999876022316609),
- FRAC_CONST(0.9999885094069193),
- FRAC_CONST(0.9999893649274085),
- FRAC_CONST(0.9999901710338274),
- FRAC_CONST(0.9999909298948430),
- FRAC_CONST(0.9999916436086862),
- FRAC_CONST(0.9999923142047299),
- FRAC_CONST(0.9999929436450469),
- FRAC_CONST(0.9999935338259505),
- FRAC_CONST(0.9999940865795161),
- FRAC_CONST(0.9999946036750835),
- FRAC_CONST(0.9999950868207405),
- FRAC_CONST(0.9999955376647868),
- FRAC_CONST(0.9999959577971798),
- FRAC_CONST(0.9999963487509599),
- FRAC_CONST(0.9999967120036571),
- FRAC_CONST(0.9999970489786785),
- FRAC_CONST(0.9999973610466748),
- FRAC_CONST(0.9999976495268890),
- FRAC_CONST(0.9999979156884846),
- FRAC_CONST(0.9999981607518545),
- FRAC_CONST(0.9999983858899099),
- FRAC_CONST(0.9999985922293493),
- FRAC_CONST(0.9999987808519092),
- FRAC_CONST(0.9999989527955938),
- FRAC_CONST(0.9999991090558848),
- FRAC_CONST(0.9999992505869332),
- FRAC_CONST(0.9999993783027293),
- FRAC_CONST(0.9999994930782556),
- FRAC_CONST(0.9999995957506171),
- FRAC_CONST(0.9999996871201549),
- FRAC_CONST(0.9999997679515386),
- FRAC_CONST(0.9999998389748399),
- FRAC_CONST(0.9999999008865869),
- FRAC_CONST(0.9999999543507984)
- };
+ALIGN static const real_t kbd_long_960[] = {
+ FRAC_CONST(0.0003021562530949),
+ FRAC_CONST(0.0004452267024786),
+ FRAC_CONST(0.0005674947527496),
+ FRAC_CONST(0.0006812465553466),
+ FRAC_CONST(0.0007910496776387),
+ FRAC_CONST(0.0008991655033895),
+ FRAC_CONST(0.0010068978259384),
+ FRAC_CONST(0.0011150758515751),
+ FRAC_CONST(0.0012242653193642),
+ FRAC_CONST(0.0013348735658205),
+ FRAC_CONST(0.0014472068670273),
+ FRAC_CONST(0.0015615039850448),
+ FRAC_CONST(0.0016779568885263),
+ FRAC_CONST(0.0017967241232412),
+ FRAC_CONST(0.0019179397560955),
+ FRAC_CONST(0.0020417195415393),
+ FRAC_CONST(0.0021681652836642),
+ FRAC_CONST(0.0022973679910599),
+ FRAC_CONST(0.0024294102029937),
+ FRAC_CONST(0.0025643677339078),
+ FRAC_CONST(0.0027023110014772),
+ FRAC_CONST(0.0028433060512612),
+ FRAC_CONST(0.0029874153568025),
+ FRAC_CONST(0.0031346984511728),
+ FRAC_CONST(0.0032852124303662),
+ FRAC_CONST(0.0034390123581190),
+ FRAC_CONST(0.0035961515940931),
+ FRAC_CONST(0.0037566820618961),
+ FRAC_CONST(0.0039206544694386),
+ FRAC_CONST(0.0040881184912194),
+ FRAC_CONST(0.0042591229199617),
+ FRAC_CONST(0.0044337157933972),
+ FRAC_CONST(0.0046119445007641),
+ FRAC_CONST(0.0047938558726415),
+ FRAC_CONST(0.0049794962570131),
+ FRAC_CONST(0.0051689115838900),
+ FRAC_CONST(0.0053621474203763),
+ FRAC_CONST(0.0055592490177131),
+ FRAC_CONST(0.0057602613515573),
+ FRAC_CONST(0.0059652291565289),
+ FRAC_CONST(0.0061741969558843),
+ FRAC_CONST(0.0063872090870253),
+ FRAC_CONST(0.0066043097234387),
+ FRAC_CONST(0.0068255428935640),
+ FRAC_CONST(0.0070509524970088),
+ FRAC_CONST(0.0072805823184660),
+ FRAC_CONST(0.0075144760396340),
+ FRAC_CONST(0.0077526772493942),
+ FRAC_CONST(0.0079952294524673),
+ FRAC_CONST(0.0082421760767325),
+ FRAC_CONST(0.0084935604793733),
+ FRAC_CONST(0.0087494259519870),
+ FRAC_CONST(0.0090098157247792),
+ FRAC_CONST(0.0092747729699467),
+ FRAC_CONST(0.0095443408043399),
+ FRAC_CONST(0.0098185622914832),
+ FRAC_CONST(0.0100974804430226),
+ FRAC_CONST(0.0103811382196612),
+ FRAC_CONST(0.0106695785316351),
+ FRAC_CONST(0.0109628442387771),
+ FRAC_CONST(0.0112609781502091),
+ FRAC_CONST(0.0115640230236993),
+ FRAC_CONST(0.0118720215647169),
+ FRAC_CONST(0.0121850164252137),
+ FRAC_CONST(0.0125030502021561),
+ FRAC_CONST(0.0128261654358321),
+ FRAC_CONST(0.0131544046079532),
+ FRAC_CONST(0.0134878101395681),
+ FRAC_CONST(0.0138264243888068),
+ FRAC_CONST(0.0141702896484671),
+ FRAC_CONST(0.0145194481434592),
+ FRAC_CONST(0.0148739420281182),
+ FRAC_CONST(0.0152338133833959),
+ FRAC_CONST(0.0155991042139432),
+ FRAC_CONST(0.0159698564450882),
+ FRAC_CONST(0.0163461119197227),
+ FRAC_CONST(0.0167279123950996),
+ FRAC_CONST(0.0171152995395520),
+ FRAC_CONST(0.0175083149291368),
+ FRAC_CONST(0.0179070000442104),
+ FRAC_CONST(0.0183113962659409),
+ FRAC_CONST(0.0187215448727609),
+ FRAC_CONST(0.0191374870367659),
+ FRAC_CONST(0.0195592638200623),
+ FRAC_CONST(0.0199869161710679),
+ FRAC_CONST(0.0204204849207691),
+ FRAC_CONST(0.0208600107789370),
+ FRAC_CONST(0.0213055343303066),
+ FRAC_CONST(0.0217570960307201),
+ FRAC_CONST(0.0222147362032386),
+ FRAC_CONST(0.0226784950342228),
+ FRAC_CONST(0.0231484125693867),
+ FRAC_CONST(0.0236245287098244),
+ FRAC_CONST(0.0241068832080138),
+ FRAC_CONST(0.0245955156637973),
+ FRAC_CONST(0.0250904655203431),
+ FRAC_CONST(0.0255917720600868),
+ FRAC_CONST(0.0260994744006559),
+ FRAC_CONST(0.0266136114907790),
+ FRAC_CONST(0.0271342221061795),
+ FRAC_CONST(0.0276613448454576),
+ FRAC_CONST(0.0281950181259587),
+ FRAC_CONST(0.0287352801796329),
+ FRAC_CONST(0.0292821690488833),
+ FRAC_CONST(0.0298357225824074),
+ FRAC_CONST(0.0303959784310299),
+ FRAC_CONST(0.0309629740435296),
+ FRAC_CONST(0.0315367466624615),
+ FRAC_CONST(0.0321173333199732),
+ FRAC_CONST(0.0327047708336193),
+ FRAC_CONST(0.0332990958021720),
+ FRAC_CONST(0.0339003446014307),
+ FRAC_CONST(0.0345085533800302),
+ FRAC_CONST(0.0351237580552491),
+ FRAC_CONST(0.0357459943088193),
+ FRAC_CONST(0.0363752975827358),
+ FRAC_CONST(0.0370117030750704),
+ FRAC_CONST(0.0376552457357870),
+ FRAC_CONST(0.0383059602625614),
+ FRAC_CONST(0.0389638810966056),
+ FRAC_CONST(0.0396290424184964),
+ FRAC_CONST(0.0403014781440112),
+ FRAC_CONST(0.0409812219199691),
+ FRAC_CONST(0.0416683071200799),
+ FRAC_CONST(0.0423627668408009),
+ FRAC_CONST(0.0430646338972016),
+ FRAC_CONST(0.0437739408188385),
+ FRAC_CONST(0.0444907198456388),
+ FRAC_CONST(0.0452150029237951),
+ FRAC_CONST(0.0459468217016708),
+ FRAC_CONST(0.0466862075257170),
+ FRAC_CONST(0.0474331914364021),
+ FRAC_CONST(0.0481878041641539),
+ FRAC_CONST(0.0489500761253148),
+ FRAC_CONST(0.0497200374181119),
+ FRAC_CONST(0.0504977178186404),
+ FRAC_CONST(0.0512831467768636),
+ FRAC_CONST(0.0520763534126273),
+ FRAC_CONST(0.0528773665116913),
+ FRAC_CONST(0.0536862145217772),
+ FRAC_CONST(0.0545029255486345),
+ FRAC_CONST(0.0553275273521232),
+ FRAC_CONST(0.0561600473423164),
+ FRAC_CONST(0.0570005125756209),
+ FRAC_CONST(0.0578489497509179),
+ FRAC_CONST(0.0587053852057233),
+ FRAC_CONST(0.0595698449123695),
+ FRAC_CONST(0.0604423544742077),
+ FRAC_CONST(0.0613229391218317),
+ FRAC_CONST(0.0622116237093247),
+ FRAC_CONST(0.0631084327105284),
+ FRAC_CONST(0.0640133902153352),
+ FRAC_CONST(0.0649265199260043),
+ FRAC_CONST(0.0658478451535027),
+ FRAC_CONST(0.0667773888138695),
+ FRAC_CONST(0.0677151734246072),
+ FRAC_CONST(0.0686612211010977),
+ FRAC_CONST(0.0696155535530446),
+ FRAC_CONST(0.0705781920809429),
+ FRAC_CONST(0.0715491575725758),
+ FRAC_CONST(0.0725284704995383),
+ FRAC_CONST(0.0735161509137906),
+ FRAC_CONST(0.0745122184442388),
+ FRAC_CONST(0.0755166922933461),
+ FRAC_CONST(0.0765295912337720),
+ FRAC_CONST(0.0775509336050437),
+ FRAC_CONST(0.0785807373102561),
+ FRAC_CONST(0.0796190198128044),
+ FRAC_CONST(0.0806657981331473),
+ FRAC_CONST(0.0817210888456026),
+ FRAC_CONST(0.0827849080751753),
+ FRAC_CONST(0.0838572714944183),
+ FRAC_CONST(0.0849381943203265),
+ FRAC_CONST(0.0860276913112652),
+ FRAC_CONST(0.0871257767639319),
+ FRAC_CONST(0.0882324645103534),
+ FRAC_CONST(0.0893477679149177),
+ FRAC_CONST(0.0904716998714418),
+ FRAC_CONST(0.0916042728002747),
+ FRAC_CONST(0.0927454986454381),
+ FRAC_CONST(0.0938953888718020),
+ FRAC_CONST(0.0950539544622996),
+ FRAC_CONST(0.0962212059151784),
+ FRAC_CONST(0.0973971532412897),
+ FRAC_CONST(0.0985818059614169),
+ FRAC_CONST(0.0997751731036425),
+ FRAC_CONST(0.1009772632007537),
+ FRAC_CONST(0.1021880842876888),
+ FRAC_CONST(0.1034076438990227),
+ FRAC_CONST(0.1046359490664932),
+ FRAC_CONST(0.1058730063165681),
+ FRAC_CONST(0.1071188216680533),
+ FRAC_CONST(0.1083734006297428),
+ FRAC_CONST(0.1096367481981100),
+ FRAC_CONST(0.1109088688550422),
+ FRAC_CONST(0.1121897665656167),
+ FRAC_CONST(0.1134794447759207),
+ FRAC_CONST(0.1147779064109143),
+ FRAC_CONST(0.1160851538723372),
+ FRAC_CONST(0.1174011890366591),
+ FRAC_CONST(0.1187260132530751),
+ FRAC_CONST(0.1200596273415457),
+ FRAC_CONST(0.1214020315908810),
+ FRAC_CONST(0.1227532257568719),
+ FRAC_CONST(0.1241132090604651),
+ FRAC_CONST(0.1254819801859856),
+ FRAC_CONST(0.1268595372794049),
+ FRAC_CONST(0.1282458779466558),
+ FRAC_CONST(0.1296409992519942),
+ FRAC_CONST(0.1310448977164081),
+ FRAC_CONST(0.1324575693160745),
+ FRAC_CONST(0.1338790094808633),
+ FRAC_CONST(0.1353092130928902),
+ FRAC_CONST(0.1367481744851168),
+ FRAC_CONST(0.1381958874400010),
+ FRAC_CONST(0.1396523451881945),
+ FRAC_CONST(0.1411175404072910),
+ FRAC_CONST(0.1425914652206223),
+ FRAC_CONST(0.1440741111961058),
+ FRAC_CONST(0.1455654693451402),
+ FRAC_CONST(0.1470655301215526),
+ FRAC_CONST(0.1485742834205956),
+ FRAC_CONST(0.1500917185779945),
+ FRAC_CONST(0.1516178243690463),
+ FRAC_CONST(0.1531525890077689),
+ FRAC_CONST(0.1546960001461024),
+ FRAC_CONST(0.1562480448731608),
+ FRAC_CONST(0.1578087097145364),
+ FRAC_CONST(0.1593779806316558),
+ FRAC_CONST(0.1609558430211876),
+ FRAC_CONST(0.1625422817145027),
+ FRAC_CONST(0.1641372809771871),
+ FRAC_CONST(0.1657408245086070),
+ FRAC_CONST(0.1673528954415270),
+ FRAC_CONST(0.1689734763417811),
+ FRAC_CONST(0.1706025492079969),
+ FRAC_CONST(0.1722400954713725),
+ FRAC_CONST(0.1738860959955082),
+ FRAC_CONST(0.1755405310762898),
+ FRAC_CONST(0.1772033804418275),
+ FRAC_CONST(0.1788746232524467),
+ FRAC_CONST(0.1805542381007349),
+ FRAC_CONST(0.1822422030116404),
+ FRAC_CONST(0.1839384954426268),
+ FRAC_CONST(0.1856430922838810),
+ FRAC_CONST(0.1873559698585756),
+ FRAC_CONST(0.1890771039231862),
+ FRAC_CONST(0.1908064696678625),
+ FRAC_CONST(0.1925440417168546),
+ FRAC_CONST(0.1942897941289937),
+ FRAC_CONST(0.1960437003982277),
+ FRAC_CONST(0.1978057334542116),
+ FRAC_CONST(0.1995758656629525),
+ FRAC_CONST(0.2013540688275098),
+ FRAC_CONST(0.2031403141887507),
+ FRAC_CONST(0.2049345724261595),
+ FRAC_CONST(0.2067368136587033),
+ FRAC_CONST(0.2085470074457521),
+ FRAC_CONST(0.2103651227880538),
+ FRAC_CONST(0.2121911281287646),
+ FRAC_CONST(0.2140249913545346),
+ FRAC_CONST(0.2158666797966480),
+ FRAC_CONST(0.2177161602322188),
+ FRAC_CONST(0.2195733988854414),
+ FRAC_CONST(0.2214383614288963),
+ FRAC_CONST(0.2233110129849106),
+ FRAC_CONST(0.2251913181269740),
+ FRAC_CONST(0.2270792408812093),
+ FRAC_CONST(0.2289747447278976),
+ FRAC_CONST(0.2308777926030592),
+ FRAC_CONST(0.2327883469000885),
+ FRAC_CONST(0.2347063694714437),
+ FRAC_CONST(0.2366318216303919),
+ FRAC_CONST(0.2385646641528076),
+ FRAC_CONST(0.2405048572790267),
+ FRAC_CONST(0.2424523607157545),
+ FRAC_CONST(0.2444071336380283),
+ FRAC_CONST(0.2463691346912334),
+ FRAC_CONST(0.2483383219931741),
+ FRAC_CONST(0.2503146531361985),
+ FRAC_CONST(0.2522980851893767),
+ FRAC_CONST(0.2542885747007335),
+ FRAC_CONST(0.2562860776995335),
+ FRAC_CONST(0.2582905496986215),
+ FRAC_CONST(0.2603019456968142),
+ FRAC_CONST(0.2623202201813464),
+ FRAC_CONST(0.2643453271303700),
+ FRAC_CONST(0.2663772200155053),
+ FRAC_CONST(0.2684158518044454),
+ FRAC_CONST(0.2704611749636135),
+ FRAC_CONST(0.2725131414608710),
+ FRAC_CONST(0.2745717027682799),
+ FRAC_CONST(0.2766368098649151),
+ FRAC_CONST(0.2787084132397296),
+ FRAC_CONST(0.2807864628944707),
+ FRAC_CONST(0.2828709083466482),
+ FRAC_CONST(0.2849616986325523),
+ FRAC_CONST(0.2870587823103237),
+ FRAC_CONST(0.2891621074630737),
+ FRAC_CONST(0.2912716217020546),
+ FRAC_CONST(0.2933872721698803),
+ FRAC_CONST(0.2955090055437973),
+ FRAC_CONST(0.2976367680390041),
+ FRAC_CONST(0.2997705054120213),
+ FRAC_CONST(0.3019101629641097),
+ FRAC_CONST(0.3040556855447379),
+ FRAC_CONST(0.3062070175550981),
+ FRAC_CONST(0.3083641029516701),
+ FRAC_CONST(0.3105268852498334),
+ FRAC_CONST(0.3126953075275265),
+ FRAC_CONST(0.3148693124289546),
+ FRAC_CONST(0.3170488421683428),
+ FRAC_CONST(0.3192338385337370),
+ FRAC_CONST(0.3214242428908514),
+ FRAC_CONST(0.3236199961869606),
+ FRAC_CONST(0.3258210389548392),
+ FRAC_CONST(0.3280273113167459),
+ FRAC_CONST(0.3302387529884521),
+ FRAC_CONST(0.3324553032833160),
+ FRAC_CONST(0.3346769011164010),
+ FRAC_CONST(0.3369034850086373),
+ FRAC_CONST(0.3391349930910280),
+ FRAC_CONST(0.3413713631088974),
+ FRAC_CONST(0.3436125324261830),
+ FRAC_CONST(0.3458584380297697),
+ FRAC_CONST(0.3481090165338656),
+ FRAC_CONST(0.3503642041844199),
+ FRAC_CONST(0.3526239368635820),
+ FRAC_CONST(0.3548881500942010),
+ FRAC_CONST(0.3571567790443668),
+ FRAC_CONST(0.3594297585319891),
+ FRAC_CONST(0.3617070230294185),
+ FRAC_CONST(0.3639885066681048),
+ FRAC_CONST(0.3662741432432950),
+ FRAC_CONST(0.3685638662187693),
+ FRAC_CONST(0.3708576087316147),
+ FRAC_CONST(0.3731553035970366),
+ FRAC_CONST(0.3754568833132069),
+ FRAC_CONST(0.3777622800661488),
+ FRAC_CONST(0.3800714257346570),
+ FRAC_CONST(0.3823842518952546),
+ FRAC_CONST(0.3847006898271841),
+ FRAC_CONST(0.3870206705174334),
+ FRAC_CONST(0.3893441246657958),
+ FRAC_CONST(0.3916709826899639),
+ FRAC_CONST(0.3940011747306560),
+ FRAC_CONST(0.3963346306567764),
+ FRAC_CONST(0.3986712800706062),
+ FRAC_CONST(0.4010110523130271),
+ FRAC_CONST(0.4033538764687756),
+ FRAC_CONST(0.4056996813717284),
+ FRAC_CONST(0.4080483956102172),
+ FRAC_CONST(0.4103999475323736),
+ FRAC_CONST(0.4127542652515031),
+ FRAC_CONST(0.4151112766514873),
+ FRAC_CONST(0.4174709093922143),
+ FRAC_CONST(0.4198330909150365),
+ FRAC_CONST(0.4221977484482556),
+ FRAC_CONST(0.4245648090126334),
+ FRAC_CONST(0.4269341994269293),
+ FRAC_CONST(0.4293058463134616),
+ FRAC_CONST(0.4316796761036958),
+ FRAC_CONST(0.4340556150438547),
+ FRAC_CONST(0.4364335892005536),
+ FRAC_CONST(0.4388135244664580),
+ FRAC_CONST(0.4411953465659639),
+ FRAC_CONST(0.4435789810609000),
+ FRAC_CONST(0.4459643533562509),
+ FRAC_CONST(0.4483513887059016),
+ FRAC_CONST(0.4507400122184019),
+ FRAC_CONST(0.4531301488627497),
+ FRAC_CONST(0.4555217234741947),
+ FRAC_CONST(0.4579146607600593),
+ FRAC_CONST(0.4603088853055777),
+ FRAC_CONST(0.4627043215797521),
+ FRAC_CONST(0.4651008939412254),
+ FRAC_CONST(0.4674985266441709),
+ FRAC_CONST(0.4698971438441951),
+ FRAC_CONST(0.4722966696042580),
+ FRAC_CONST(0.4746970279006055),
+ FRAC_CONST(0.4770981426287164),
+ FRAC_CONST(0.4794999376092619),
+ FRAC_CONST(0.4819023365940778),
+ FRAC_CONST(0.4843052632721476),
+ FRAC_CONST(0.4867086412755978),
+ FRAC_CONST(0.4891123941857028),
+ FRAC_CONST(0.4915164455388997),
+ FRAC_CONST(0.4939207188328126),
+ FRAC_CONST(0.4963251375322855),
+ FRAC_CONST(0.4987296250754225),
+ FRAC_CONST(0.5011341048796359),
+ FRAC_CONST(0.5035385003477012),
+ FRAC_CONST(0.5059427348738168),
+ FRAC_CONST(0.5083467318496706),
+ FRAC_CONST(0.5107504146705106),
+ FRAC_CONST(0.5131537067412193),
+ FRAC_CONST(0.5155565314823923),
+ FRAC_CONST(0.5179588123364193),
+ FRAC_CONST(0.5203604727735667),
+ FRAC_CONST(0.5227614362980630),
+ FRAC_CONST(0.5251616264541841),
+ FRAC_CONST(0.5275609668323384),
+ FRAC_CONST(0.5299593810751532),
+ FRAC_CONST(0.5323567928835578),
+ FRAC_CONST(0.5347531260228663),
+ FRAC_CONST(0.5371483043288580),
+ FRAC_CONST(0.5395422517138538),
+ FRAC_CONST(0.5419348921727899),
+ FRAC_CONST(0.5443261497892862),
+ FRAC_CONST(0.5467159487417104),
+ FRAC_CONST(0.5491042133092364),
+ FRAC_CONST(0.5514908678778958),
+ FRAC_CONST(0.5538758369466227),
+ FRAC_CONST(0.5562590451332913),
+ FRAC_CONST(0.5586404171807443),
+ FRAC_CONST(0.5610198779628133),
+ FRAC_CONST(0.5633973524903286),
+ FRAC_CONST(0.5657727659171199),
+ FRAC_CONST(0.5681460435460047),
+ FRAC_CONST(0.5705171108347663),
+ FRAC_CONST(0.5728858934021188),
+ FRAC_CONST(0.5752523170336598),
+ FRAC_CONST(0.5776163076878088),
+ FRAC_CONST(0.5799777915017323),
+ FRAC_CONST(0.5823366947972535),
+ FRAC_CONST(0.5846929440867458),
+ FRAC_CONST(0.5870464660790119),
+ FRAC_CONST(0.5893971876851449),
+ FRAC_CONST(0.5917450360243719),
+ FRAC_CONST(0.5940899384298793),
+ FRAC_CONST(0.5964318224546208),
+ FRAC_CONST(0.5987706158771039),
+ FRAC_CONST(0.6011062467071583),
+ FRAC_CONST(0.6034386431916822),
+ FRAC_CONST(0.6057677338203681),
+ FRAC_CONST(0.6080934473314057),
+ FRAC_CONST(0.6104157127171639),
+ FRAC_CONST(0.6127344592298474),
+ FRAC_CONST(0.6150496163871310),
+ FRAC_CONST(0.6173611139777690),
+ FRAC_CONST(0.6196688820671789),
+ FRAC_CONST(0.6219728510029997),
+ FRAC_CONST(0.6242729514206247),
+ FRAC_CONST(0.6265691142487051),
+ FRAC_CONST(0.6288612707146283),
+ FRAC_CONST(0.6311493523499663),
+ FRAC_CONST(0.6334332909958958),
+ FRAC_CONST(0.6357130188085891),
+ FRAC_CONST(0.6379884682645743),
+ FRAC_CONST(0.6402595721660647),
+ FRAC_CONST(0.6425262636462578),
+ FRAC_CONST(0.6447884761746012),
+ FRAC_CONST(0.6470461435620266),
+ FRAC_CONST(0.6492991999661505),
+ FRAC_CONST(0.6515475798964411),
+ FRAC_CONST(0.6537912182193508),
+ FRAC_CONST(0.6560300501634142),
+ FRAC_CONST(0.6582640113243098),
+ FRAC_CONST(0.6604930376698862),
+ FRAC_CONST(0.6627170655451516),
+ FRAC_CONST(0.6649360316772256),
+ FRAC_CONST(0.6671498731802533),
+ FRAC_CONST(0.6693585275602818),
+ FRAC_CONST(0.6715619327200959),
+ FRAC_CONST(0.6737600269640164),
+ FRAC_CONST(0.6759527490026566),
+ FRAC_CONST(0.6781400379576392),
+ FRAC_CONST(0.6803218333662715),
+ FRAC_CONST(0.6824980751861787),
+ FRAC_CONST(0.6846687037998949),
+ FRAC_CONST(0.6868336600194123),
+ FRAC_CONST(0.6889928850906855),
+ FRAC_CONST(0.6911463206980928),
+ FRAC_CONST(0.6932939089688525),
+ FRAC_CONST(0.6954355924773949),
+ FRAC_CONST(0.6975713142496884),
+ FRAC_CONST(0.6997010177675195),
+ FRAC_CONST(0.7018246469727265),
+ FRAC_CONST(0.7039421462713862),
+ FRAC_CONST(0.7060534605379528),
+ FRAC_CONST(0.7081585351193496),
+ FRAC_CONST(0.7102573158390105),
+ FRAC_CONST(0.7123497490008750),
+ FRAC_CONST(0.7144357813933307),
+ FRAC_CONST(0.7165153602931092),
+ FRAC_CONST(0.7185884334691287),
+ FRAC_CONST(0.7206549491862871),
+ FRAC_CONST(0.7227148562092042),
+ FRAC_CONST(0.7247681038059106),
+ FRAC_CONST(0.7268146417514855),
+ FRAC_CONST(0.7288544203316418),
+ FRAC_CONST(0.7308873903462577),
+ FRAC_CONST(0.7329135031128549),
+ FRAC_CONST(0.7349327104700221),
+ FRAC_CONST(0.7369449647807855),
+ FRAC_CONST(0.7389502189359237),
+ FRAC_CONST(0.7409484263572271),
+ FRAC_CONST(0.7429395410007016),
+ FRAC_CONST(0.7449235173597176),
+ FRAC_CONST(0.7469003104681008),
+ FRAC_CONST(0.7488698759031670),
+ FRAC_CONST(0.7508321697887005),
+ FRAC_CONST(0.7527871487978728),
+ FRAC_CONST(0.7547347701561059),
+ FRAC_CONST(0.7566749916438754),
+ FRAC_CONST(0.7586077715994560),
+ FRAC_CONST(0.7605330689216074),
+ FRAC_CONST(0.7624508430722016),
+ FRAC_CONST(0.7643610540787891),
+ FRAC_CONST(0.7662636625371070),
+ FRAC_CONST(0.7681586296135255),
+ FRAC_CONST(0.7700459170474343),
+ FRAC_CONST(0.7719254871535672),
+ FRAC_CONST(0.7737973028242671),
+ FRAC_CONST(0.7756613275316875),
+ FRAC_CONST(0.7775175253299340),
+ FRAC_CONST(0.7793658608571425),
+ FRAC_CONST(0.7812062993374951),
+ FRAC_CONST(0.7830388065831744),
+ FRAC_CONST(0.7848633489962533),
+ FRAC_CONST(0.7866798935705233),
+ FRAC_CONST(0.7884884078932579),
+ FRAC_CONST(0.7902888601469138),
+ FRAC_CONST(0.7920812191107668),
+ FRAC_CONST(0.7938654541624850),
+ FRAC_CONST(0.7956415352796368),
+ FRAC_CONST(0.7974094330411343),
+ FRAC_CONST(0.7991691186286133),
+ FRAC_CONST(0.8009205638277465),
+ FRAC_CONST(0.8026637410294932),
+ FRAC_CONST(0.8043986232312831),
+ FRAC_CONST(0.8061251840381346),
+ FRAC_CONST(0.8078433976637077),
+ FRAC_CONST(0.8095532389312917),
+ FRAC_CONST(0.8112546832747255),
+ FRAC_CONST(0.8129477067392539),
+ FRAC_CONST(0.8146322859823164),
+ FRAC_CONST(0.8163083982742698),
+ FRAC_CONST(0.8179760214990457),
+ FRAC_CONST(0.8196351341547393),
+ FRAC_CONST(0.8212857153541345),
+ FRAC_CONST(0.8229277448251595),
+ FRAC_CONST(0.8245612029112778),
+ FRAC_CONST(0.8261860705718113),
+ FRAC_CONST(0.8278023293821971),
+ FRAC_CONST(0.8294099615341773),
+ FRAC_CONST(0.8310089498359212),
+ FRAC_CONST(0.8325992777120815),
+ FRAC_CONST(0.8341809292037831),
+ FRAC_CONST(0.8357538889685445),
+ FRAC_CONST(0.8373181422801330),
+ FRAC_CONST(0.8388736750283521),
+ FRAC_CONST(0.8404204737187619),
+ FRAC_CONST(0.8419585254723335),
+ FRAC_CONST(0.8434878180250348),
+ FRAC_CONST(0.8450083397273509),
+ FRAC_CONST(0.8465200795437368),
+ FRAC_CONST(0.8480230270520029),
+ FRAC_CONST(0.8495171724426350),
+ FRAC_CONST(0.8510025065180464),
+ FRAC_CONST(0.8524790206917633),
+ FRAC_CONST(0.8539467069875448),
+ FRAC_CONST(0.8554055580384357),
+ FRAC_CONST(0.8568555670857525),
+ FRAC_CONST(0.8582967279780043),
+ FRAC_CONST(0.8597290351697464),
+ FRAC_CONST(0.8611524837203691),
+ FRAC_CONST(0.8625670692928198),
+ FRAC_CONST(0.8639727881522599),
+ FRAC_CONST(0.8653696371646555),
+ FRAC_CONST(0.8667576137953045),
+ FRAC_CONST(0.8681367161072958),
+ FRAC_CONST(0.8695069427599065),
+ FRAC_CONST(0.8708682930069319),
+ FRAC_CONST(0.8722207666949527),
+ FRAC_CONST(0.8735643642615368),
+ FRAC_CONST(0.8748990867333771),
+ FRAC_CONST(0.8762249357243662),
+ FRAC_CONST(0.8775419134336067),
+ FRAC_CONST(0.8788500226433579),
+ FRAC_CONST(0.8801492667169208),
+ FRAC_CONST(0.8814396495964587),
+ FRAC_CONST(0.8827211758007560),
+ FRAC_CONST(0.8839938504229149),
+ FRAC_CONST(0.8852576791279895),
+ FRAC_CONST(0.8865126681505587),
+ FRAC_CONST(0.8877588242922386),
+ FRAC_CONST(0.8889961549191320),
+ FRAC_CONST(0.8902246679592184),
+ FRAC_CONST(0.8914443718996848),
+ FRAC_CONST(0.8926552757841945),
+ FRAC_CONST(0.8938573892100969),
+ FRAC_CONST(0.8950507223255798),
+ FRAC_CONST(0.8962352858267605),
+ FRAC_CONST(0.8974110909547198),
+ FRAC_CONST(0.8985781494924783),
+ FRAC_CONST(0.8997364737619142),
+ FRAC_CONST(0.9008860766206249),
+ FRAC_CONST(0.9020269714587307),
+ FRAC_CONST(0.9031591721956235),
+ FRAC_CONST(0.9042826932766591),
+ FRAC_CONST(0.9053975496697941),
+ FRAC_CONST(0.9065037568621681),
+ FRAC_CONST(0.9076013308566311),
+ FRAC_CONST(0.9086902881682180),
+ FRAC_CONST(0.9097706458205682),
+ FRAC_CONST(0.9108424213422940),
+ FRAC_CONST(0.9119056327632955),
+ FRAC_CONST(0.9129602986110235),
+ FRAC_CONST(0.9140064379066919),
+ FRAC_CONST(0.9150440701614393),
+ FRAC_CONST(0.9160732153724396),
+ FRAC_CONST(0.9170938940189634),
+ FRAC_CONST(0.9181061270583908),
+ FRAC_CONST(0.9191099359221748),
+ FRAC_CONST(0.9201053425117579),
+ FRAC_CONST(0.9210923691944400),
+ FRAC_CONST(0.9220710387992010),
+ FRAC_CONST(0.9230413746124764),
+ FRAC_CONST(0.9240034003738882),
+ FRAC_CONST(0.9249571402719298),
+ FRAC_CONST(0.9259026189396085),
+ FRAC_CONST(0.9268398614500427),
+ FRAC_CONST(0.9277688933120170),
+ FRAC_CONST(0.9286897404654957),
+ FRAC_CONST(0.9296024292770939),
+ FRAC_CONST(0.9305069865355076),
+ FRAC_CONST(0.9314034394469048),
+ FRAC_CONST(0.9322918156302762),
+ FRAC_CONST(0.9331721431127471),
+ FRAC_CONST(0.9340444503248519),
+ FRAC_CONST(0.9349087660957711),
+ FRAC_CONST(0.9357651196485313),
+ FRAC_CONST(0.9366135405951697),
+ FRAC_CONST(0.9374540589318637),
+ FRAC_CONST(0.9382867050340261),
+ FRAC_CONST(0.9391115096513655),
+ FRAC_CONST(0.9399285039029165),
+ FRAC_CONST(0.9407377192720349),
+ FRAC_CONST(0.9415391876013639),
+ FRAC_CONST(0.9423329410877687),
+ FRAC_CONST(0.9431190122772415),
+ FRAC_CONST(0.9438974340597782),
+ FRAC_CONST(0.9446682396642262),
+ FRAC_CONST(0.9454314626531054),
+ FRAC_CONST(0.9461871369174033),
+ FRAC_CONST(0.9469352966713429),
+ FRAC_CONST(0.9476759764471278),
+ FRAC_CONST(0.9484092110896616),
+ FRAC_CONST(0.9491350357512457),
+ FRAC_CONST(0.9498534858862532),
+ FRAC_CONST(0.9505645972457831),
+ FRAC_CONST(0.9512684058722927),
+ FRAC_CONST(0.9519649480942105),
+ FRAC_CONST(0.9526542605205314),
+ FRAC_CONST(0.9533363800353921),
+ FRAC_CONST(0.9540113437926313),
+ FRAC_CONST(0.9546791892103320),
+ FRAC_CONST(0.9553399539653500),
+ FRAC_CONST(0.9559936759878265),
+ FRAC_CONST(0.9566403934556893),
+ FRAC_CONST(0.9572801447891388),
+ FRAC_CONST(0.9579129686451244),
+ FRAC_CONST(0.9585389039118085),
+ FRAC_CONST(0.9591579897030224),
+ FRAC_CONST(0.9597702653527108),
+ FRAC_CONST(0.9603757704093711),
+ FRAC_CONST(0.9609745446304828),
+ FRAC_CONST(0.9615666279769324),
+ FRAC_CONST(0.9621520606074324),
+ FRAC_CONST(0.9627308828729358),
+ FRAC_CONST(0.9633031353110477),
+ FRAC_CONST(0.9638688586404335),
+ FRAC_CONST(0.9644280937552258),
+ FRAC_CONST(0.9649808817194311),
+ FRAC_CONST(0.9655272637613366),
+ FRAC_CONST(0.9660672812679171),
+ FRAC_CONST(0.9666009757792454),
+ FRAC_CONST(0.9671283889829055),
+ FRAC_CONST(0.9676495627084089),
+ FRAC_CONST(0.9681645389216160),
+ FRAC_CONST(0.9686733597191652),
+ FRAC_CONST(0.9691760673229058),
+ FRAC_CONST(0.9696727040743406),
+ FRAC_CONST(0.9701633124290767),
+ FRAC_CONST(0.9706479349512860),
+ FRAC_CONST(0.9711266143081750),
+ FRAC_CONST(0.9715993932644684),
+ FRAC_CONST(0.9720663146769026),
+ FRAC_CONST(0.9725274214887337),
+ FRAC_CONST(0.9729827567242596),
+ FRAC_CONST(0.9734323634833574),
+ FRAC_CONST(0.9738762849360358),
+ FRAC_CONST(0.9743145643170059),
+ FRAC_CONST(0.9747472449202687),
+ FRAC_CONST(0.9751743700937215),
+ FRAC_CONST(0.9755959832337850),
+ FRAC_CONST(0.9760121277800496),
+ FRAC_CONST(0.9764228472099433),
+ FRAC_CONST(0.9768281850334235),
+ FRAC_CONST(0.9772281847876897),
+ FRAC_CONST(0.9776228900319223),
+ FRAC_CONST(0.9780123443420448),
+ FRAC_CONST(0.9783965913055132),
+ FRAC_CONST(0.9787756745161313),
+ FRAC_CONST(0.9791496375688939),
+ FRAC_CONST(0.9795185240548578),
+ FRAC_CONST(0.9798823775560431),
+ FRAC_CONST(0.9802412416403639),
+ FRAC_CONST(0.9805951598565897),
+ FRAC_CONST(0.9809441757293399),
+ FRAC_CONST(0.9812883327541090),
+ FRAC_CONST(0.9816276743923267),
+ FRAC_CONST(0.9819622440664515),
+ FRAC_CONST(0.9822920851550995),
+ FRAC_CONST(0.9826172409882086),
+ FRAC_CONST(0.9829377548422400),
+ FRAC_CONST(0.9832536699354163),
+ FRAC_CONST(0.9835650294229984),
+ FRAC_CONST(0.9838718763926001),
+ FRAC_CONST(0.9841742538595437),
+ FRAC_CONST(0.9844722047622547),
+ FRAC_CONST(0.9847657719576983),
+ FRAC_CONST(0.9850549982168574),
+ FRAC_CONST(0.9853399262202529),
+ FRAC_CONST(0.9856205985535073),
+ FRAC_CONST(0.9858970577029519),
+ FRAC_CONST(0.9861693460512790),
+ FRAC_CONST(0.9864375058732389),
+ FRAC_CONST(0.9867015793313820),
+ FRAC_CONST(0.9869616084718489),
+ FRAC_CONST(0.9872176352202061),
+ FRAC_CONST(0.9874697013773301),
+ FRAC_CONST(0.9877178486153397),
+ FRAC_CONST(0.9879621184735767),
+ FRAC_CONST(0.9882025523546365),
+ FRAC_CONST(0.9884391915204485),
+ FRAC_CONST(0.9886720770884069),
+ FRAC_CONST(0.9889012500275530),
+ FRAC_CONST(0.9891267511548089),
+ FRAC_CONST(0.9893486211312621),
+ FRAC_CONST(0.9895669004585049),
+ FRAC_CONST(0.9897816294750255),
+ FRAC_CONST(0.9899928483526520),
+ FRAC_CONST(0.9902005970930525),
+ FRAC_CONST(0.9904049155242876),
+ FRAC_CONST(0.9906058432974180),
+ FRAC_CONST(0.9908034198831690),
+ FRAC_CONST(0.9909976845686489),
+ FRAC_CONST(0.9911886764541239),
+ FRAC_CONST(0.9913764344498495),
+ FRAC_CONST(0.9915609972729590),
+ FRAC_CONST(0.9917424034444086),
+ FRAC_CONST(0.9919206912859797),
+ FRAC_CONST(0.9920958989173397),
+ FRAC_CONST(0.9922680642531603),
+ FRAC_CONST(0.9924372250002933),
+ FRAC_CONST(0.9926034186550070),
+ FRAC_CONST(0.9927666825002789),
+ FRAC_CONST(0.9929270536031491),
+ FRAC_CONST(0.9930845688121325),
+ FRAC_CONST(0.9932392647546895),
+ FRAC_CONST(0.9933911778347579),
+ FRAC_CONST(0.9935403442303433),
+ FRAC_CONST(0.9936867998911693),
+ FRAC_CONST(0.9938305805363887),
+ FRAC_CONST(0.9939717216523539),
+ FRAC_CONST(0.9941102584904481),
+ FRAC_CONST(0.9942462260649764),
+ FRAC_CONST(0.9943796591511174),
+ FRAC_CONST(0.9945105922829353),
+ FRAC_CONST(0.9946390597514524),
+ FRAC_CONST(0.9947650956027824),
+ FRAC_CONST(0.9948887336363228),
+ FRAC_CONST(0.9950100074030103),
+ FRAC_CONST(0.9951289502036336),
+ FRAC_CONST(0.9952455950872091),
+ FRAC_CONST(0.9953599748494155),
+ FRAC_CONST(0.9954721220310890),
+ FRAC_CONST(0.9955820689167787),
+ FRAC_CONST(0.9956898475333619),
+ FRAC_CONST(0.9957954896487196),
+ FRAC_CONST(0.9958990267704713),
+ FRAC_CONST(0.9960004901447701),
+ FRAC_CONST(0.9960999107551559),
+ FRAC_CONST(0.9961973193214694),
+ FRAC_CONST(0.9962927462988245),
+ FRAC_CONST(0.9963862218766388),
+ FRAC_CONST(0.9964777759777242),
+ FRAC_CONST(0.9965674382574342),
+ FRAC_CONST(0.9966552381028704),
+ FRAC_CONST(0.9967412046321465),
+ FRAC_CONST(0.9968253666937095),
+ FRAC_CONST(0.9969077528657186),
+ FRAC_CONST(0.9969883914554805),
+ FRAC_CONST(0.9970673104989413),
+ FRAC_CONST(0.9971445377602348),
+ FRAC_CONST(0.9972201007312871),
+ FRAC_CONST(0.9972940266314749),
+ FRAC_CONST(0.9973663424073412),
+ FRAC_CONST(0.9974370747323638),
+ FRAC_CONST(0.9975062500067785),
+ FRAC_CONST(0.9975738943574574),
+ FRAC_CONST(0.9976400336378379),
+ FRAC_CONST(0.9977046934279079),
+ FRAC_CONST(0.9977678990342401),
+ FRAC_CONST(0.9978296754900812),
+ FRAC_CONST(0.9978900475554902),
+ FRAC_CONST(0.9979490397175296),
+ FRAC_CONST(0.9980066761905056),
+ FRAC_CONST(0.9980629809162593),
+ FRAC_CONST(0.9981179775645063),
+ FRAC_CONST(0.9981716895332257),
+ FRAC_CONST(0.9982241399490979),
+ FRAC_CONST(0.9982753516679893),
+ FRAC_CONST(0.9983253472754841),
+ FRAC_CONST(0.9983741490874634),
+ FRAC_CONST(0.9984217791507299),
+ FRAC_CONST(0.9984682592436778),
+ FRAC_CONST(0.9985136108770075),
+ FRAC_CONST(0.9985578552944850),
+ FRAC_CONST(0.9986010134737439),
+ FRAC_CONST(0.9986431061271304),
+ FRAC_CONST(0.9986841537025921),
+ FRAC_CONST(0.9987241763846056),
+ FRAC_CONST(0.9987631940951476),
+ FRAC_CONST(0.9988012264947044),
+ FRAC_CONST(0.9988382929833222),
+ FRAC_CONST(0.9988744127016956),
+ FRAC_CONST(0.9989096045322947),
+ FRAC_CONST(0.9989438871005292),
+ FRAC_CONST(0.9989772787759494),
+ FRAC_CONST(0.9990097976734847),
+ FRAC_CONST(0.9990414616547146),
+ FRAC_CONST(0.9990722883291779),
+ FRAC_CONST(0.9991022950557125),
+ FRAC_CONST(0.9991314989438310),
+ FRAC_CONST(0.9991599168551279),
+ FRAC_CONST(0.9991875654047181),
+ FRAC_CONST(0.9992144609627068),
+ FRAC_CONST(0.9992406196556911),
+ FRAC_CONST(0.9992660573682882),
+ FRAC_CONST(0.9992907897446957),
+ FRAC_CONST(0.9993148321902777),
+ FRAC_CONST(0.9993381998731797),
+ FRAC_CONST(0.9993609077259696),
+ FRAC_CONST(0.9993829704473038),
+ FRAC_CONST(0.9994044025036201),
+ FRAC_CONST(0.9994252181308537),
+ FRAC_CONST(0.9994454313361775),
+ FRAC_CONST(0.9994650558997651),
+ FRAC_CONST(0.9994841053765757),
+ FRAC_CONST(0.9995025930981609),
+ FRAC_CONST(0.9995205321744921),
+ FRAC_CONST(0.9995379354958073),
+ FRAC_CONST(0.9995548157344778),
+ FRAC_CONST(0.9995711853468930),
+ FRAC_CONST(0.9995870565753632),
+ FRAC_CONST(0.9996024414500382),
+ FRAC_CONST(0.9996173517908444),
+ FRAC_CONST(0.9996317992094352),
+ FRAC_CONST(0.9996457951111574),
+ FRAC_CONST(0.9996593506970310),
+ FRAC_CONST(0.9996724769657434),
+ FRAC_CONST(0.9996851847156547),
+ FRAC_CONST(0.9996974845468164),
+ FRAC_CONST(0.9997093868630000),
+ FRAC_CONST(0.9997209018737374),
+ FRAC_CONST(0.9997320395963699),
+ FRAC_CONST(0.9997428098581069),
+ FRAC_CONST(0.9997532222980933),
+ FRAC_CONST(0.9997632863694836),
+ FRAC_CONST(0.9997730113415246),
+ FRAC_CONST(0.9997824063016426),
+ FRAC_CONST(0.9997914801575380),
+ FRAC_CONST(0.9998002416392840),
+ FRAC_CONST(0.9998086993014300),
+ FRAC_CONST(0.9998168615251084),
+ FRAC_CONST(0.9998247365201450),
+ FRAC_CONST(0.9998323323271717),
+ FRAC_CONST(0.9998396568197407),
+ FRAC_CONST(0.9998467177064404),
+ FRAC_CONST(0.9998535225330116),
+ FRAC_CONST(0.9998600786844637),
+ FRAC_CONST(0.9998663933871905),
+ FRAC_CONST(0.9998724737110845),
+ FRAC_CONST(0.9998783265716498),
+ FRAC_CONST(0.9998839587321121),
+ FRAC_CONST(0.9998893768055266),
+ FRAC_CONST(0.9998945872568815),
+ FRAC_CONST(0.9998995964051983),
+ FRAC_CONST(0.9999044104256269),
+ FRAC_CONST(0.9999090353515359),
+ FRAC_CONST(0.9999134770765971),
+ FRAC_CONST(0.9999177413568642),
+ FRAC_CONST(0.9999218338128448),
+ FRAC_CONST(0.9999257599315647),
+ FRAC_CONST(0.9999295250686255),
+ FRAC_CONST(0.9999331344502529),
+ FRAC_CONST(0.9999365931753376),
+ FRAC_CONST(0.9999399062174669),
+ FRAC_CONST(0.9999430784269460),
+ FRAC_CONST(0.9999461145328103),
+ FRAC_CONST(0.9999490191448277),
+ FRAC_CONST(0.9999517967554878),
+ FRAC_CONST(0.9999544517419835),
+ FRAC_CONST(0.9999569883681778),
+ FRAC_CONST(0.9999594107865607),
+ FRAC_CONST(0.9999617230401926),
+ FRAC_CONST(0.9999639290646355),
+ FRAC_CONST(0.9999660326898712),
+ FRAC_CONST(0.9999680376422052),
+ FRAC_CONST(0.9999699475461585),
+ FRAC_CONST(0.9999717659263435),
+ FRAC_CONST(0.9999734962093266),
+ FRAC_CONST(0.9999751417254756),
+ FRAC_CONST(0.9999767057107922),
+ FRAC_CONST(0.9999781913087290),
+ FRAC_CONST(0.9999796015719915),
+ FRAC_CONST(0.9999809394643231),
+ FRAC_CONST(0.9999822078622751),
+ FRAC_CONST(0.9999834095569596),
+ FRAC_CONST(0.9999845472557860),
+ FRAC_CONST(0.9999856235841805),
+ FRAC_CONST(0.9999866410872889),
+ FRAC_CONST(0.9999876022316609),
+ FRAC_CONST(0.9999885094069193),
+ FRAC_CONST(0.9999893649274085),
+ FRAC_CONST(0.9999901710338274),
+ FRAC_CONST(0.9999909298948430),
+ FRAC_CONST(0.9999916436086862),
+ FRAC_CONST(0.9999923142047299),
+ FRAC_CONST(0.9999929436450469),
+ FRAC_CONST(0.9999935338259505),
+ FRAC_CONST(0.9999940865795161),
+ FRAC_CONST(0.9999946036750835),
+ FRAC_CONST(0.9999950868207405),
+ FRAC_CONST(0.9999955376647868),
+ FRAC_CONST(0.9999959577971798),
+ FRAC_CONST(0.9999963487509599),
+ FRAC_CONST(0.9999967120036571),
+ FRAC_CONST(0.9999970489786785),
+ FRAC_CONST(0.9999973610466748),
+ FRAC_CONST(0.9999976495268890),
+ FRAC_CONST(0.9999979156884846),
+ FRAC_CONST(0.9999981607518545),
+ FRAC_CONST(0.9999983858899099),
+ FRAC_CONST(0.9999985922293493),
+ FRAC_CONST(0.9999987808519092),
+ FRAC_CONST(0.9999989527955938),
+ FRAC_CONST(0.9999991090558848),
+ FRAC_CONST(0.9999992505869332),
+ FRAC_CONST(0.9999993783027293),
+ FRAC_CONST(0.9999994930782556),
+ FRAC_CONST(0.9999995957506171),
+ FRAC_CONST(0.9999996871201549),
+ FRAC_CONST(0.9999997679515386),
+ FRAC_CONST(0.9999998389748399),
+ FRAC_CONST(0.9999999008865869),
+ FRAC_CONST(0.9999999543507984)
+};
#endif
- ALIGN static const real_t kbd_short_128[] =
- {
- FRAC_CONST(4.3795702929468881e-005),
- FRAC_CONST(0.00011867384265436617),
- FRAC_CONST(0.0002307165763996192),
- FRAC_CONST(0.00038947282760568383),
- FRAC_CONST(0.00060581272288302553),
- FRAC_CONST(0.00089199695169487453),
- FRAC_CONST(0.0012617254423430522),
- FRAC_CONST(0.0017301724373162003),
- FRAC_CONST(0.0023140071937421476),
- FRAC_CONST(0.0030313989666022221),
- FRAC_CONST(0.0039020049735530842),
- FRAC_CONST(0.0049469401815512024),
- FRAC_CONST(0.0061887279335368318),
- FRAC_CONST(0.0076512306364647726),
- FRAC_CONST(0.0093595599562652423),
- FRAC_CONST(0.011339966208377799),
- FRAC_CONST(0.013619706891715299),
- FRAC_CONST(0.016226894586323766),
- FRAC_CONST(0.019190324717288168),
- FRAC_CONST(0.022539283975960878),
- FRAC_CONST(0.026303340480472455),
- FRAC_CONST(0.030512117046644357),
- FRAC_CONST(0.03519504922365594),
- FRAC_CONST(0.040381130021856941),
- FRAC_CONST(0.046098643518702249),
- FRAC_CONST(0.052374889768730587),
- FRAC_CONST(0.059235903660769147),
- FRAC_CONST(0.066706170556282418),
- FRAC_CONST(0.074808341703430481),
- FRAC_CONST(0.083562952548726227),
- FRAC_CONST(0.092988147159339674),
- FRAC_CONST(0.1030994120216919),
- FRAC_CONST(0.11390932249409955),
- FRAC_CONST(0.12542730516149531),
- FRAC_CONST(0.13765941926783826),
- FRAC_CONST(0.15060816028651081),
- FRAC_CONST(0.16427228853114245),
- FRAC_CONST(0.17864668550988483),
- FRAC_CONST(0.19372224048676889),
- FRAC_CONST(0.20948576943658073),
- FRAC_CONST(0.22591996826744942),
- FRAC_CONST(0.24300340184133981),
- FRAC_CONST(0.26071052995068139),
- FRAC_CONST(0.27901177101369551),
- FRAC_CONST(0.29787360383626599),
- FRAC_CONST(0.3172587073594233),
- FRAC_CONST(0.33712613787396362),
- FRAC_CONST(0.35743154274286698),
- FRAC_CONST(0.37812740923363009),
- FRAC_CONST(0.39916334663203618),
- FRAC_CONST(0.42048639939189658),
- FRAC_CONST(0.4420413886774246),
- FRAC_CONST(0.4637712792815169),
- FRAC_CONST(0.4856175685594023),
- FRAC_CONST(0.50752069370766872),
- FRAC_CONST(0.52942045344797806),
- FRAC_CONST(0.55125643994680196),
- FRAC_CONST(0.57296847662071559),
- FRAC_CONST(0.59449705734411495),
- FRAC_CONST(0.61578378249506627),
- FRAC_CONST(0.63677178724712891),
- FRAC_CONST(0.65740615754163356),
- FRAC_CONST(0.67763432925662526),
- FRAC_CONST(0.69740646622548552),
- FRAC_CONST(0.71667581294953808),
- FRAC_CONST(0.73539901809352737),
- FRAC_CONST(0.75353642514900732),
- FRAC_CONST(0.77105232699609816),
- FRAC_CONST(0.78791518148597028),
- FRAC_CONST(0.80409778560147072),
- FRAC_CONST(0.81957740622770781),
- FRAC_CONST(0.83433586607383625),
- FRAC_CONST(0.84835958382689225),
- FRAC_CONST(0.86163956818294229),
- FRAC_CONST(0.87417136598406997),
- FRAC_CONST(0.88595496528524853),
- FRAC_CONST(0.89699465477567619),
- FRAC_CONST(0.90729884157670959),
- FRAC_CONST(0.91687983002436779),
- FRAC_CONST(0.92575356460899649),
- FRAC_CONST(0.93393934077779084),
- FRAC_CONST(0.94145948779657318),
- FRAC_CONST(0.94833902830402828),
- FRAC_CONST(0.95460531956280026),
- FRAC_CONST(0.96028768170574896),
- FRAC_CONST(0.96541701848104766),
- FRAC_CONST(0.97002543610646474),
- FRAC_CONST(0.97414586584250062),
- FRAC_CONST(0.97781169577969584),
- FRAC_CONST(0.98105641710392333),
- FRAC_CONST(0.98391328975491177),
- FRAC_CONST(0.98641503193166202),
- FRAC_CONST(0.98859353733226141),
- FRAC_CONST(0.99047962335771556),
- FRAC_CONST(0.9921028127769449),
- FRAC_CONST(0.99349115056397752),
- FRAC_CONST(0.99467105680259038),
- FRAC_CONST(0.9956672157341897),
- FRAC_CONST(0.99650250022834352),
- FRAC_CONST(0.99719793020823266),
- FRAC_CONST(0.99777266288955657),
- FRAC_CONST(0.99824401211201486),
- FRAC_CONST(0.99862749357391212),
- FRAC_CONST(0.99893689243401962),
- FRAC_CONST(0.99918434952623147),
- FRAC_CONST(0.99938046234161726),
- FRAC_CONST(0.99953439696357238),
- FRAC_CONST(0.99965400728430465),
- FRAC_CONST(0.99974595807027455),
- FRAC_CONST(0.99981584876278362),
- FRAC_CONST(0.99986833527824281),
- FRAC_CONST(0.99990724749057802),
- FRAC_CONST(0.99993570051598468),
- FRAC_CONST(0.99995619835942084),
- FRAC_CONST(0.99997072890647543),
- FRAC_CONST(0.9999808496399144),
- FRAC_CONST(0.99998776381655818),
- FRAC_CONST(0.99999238714961569),
- FRAC_CONST(0.99999540529959718),
- FRAC_CONST(0.99999732268176988),
- FRAC_CONST(0.99999850325054862),
- FRAC_CONST(0.99999920402413744),
- FRAC_CONST(0.9999996021706401),
- FRAC_CONST(0.99999981649545566),
- FRAC_CONST(0.99999992415545547),
- FRAC_CONST(0.99999997338493041),
- FRAC_CONST(0.99999999295825959),
- FRAC_CONST(0.99999999904096815)
- };
+ALIGN static const real_t kbd_short_128[] =
+{
+ FRAC_CONST(4.3795702929468881e-005),
+ FRAC_CONST(0.00011867384265436617),
+ FRAC_CONST(0.0002307165763996192),
+ FRAC_CONST(0.00038947282760568383),
+ FRAC_CONST(0.00060581272288302553),
+ FRAC_CONST(0.00089199695169487453),
+ FRAC_CONST(0.0012617254423430522),
+ FRAC_CONST(0.0017301724373162003),
+ FRAC_CONST(0.0023140071937421476),
+ FRAC_CONST(0.0030313989666022221),
+ FRAC_CONST(0.0039020049735530842),
+ FRAC_CONST(0.0049469401815512024),
+ FRAC_CONST(0.0061887279335368318),
+ FRAC_CONST(0.0076512306364647726),
+ FRAC_CONST(0.0093595599562652423),
+ FRAC_CONST(0.011339966208377799),
+ FRAC_CONST(0.013619706891715299),
+ FRAC_CONST(0.016226894586323766),
+ FRAC_CONST(0.019190324717288168),
+ FRAC_CONST(0.022539283975960878),
+ FRAC_CONST(0.026303340480472455),
+ FRAC_CONST(0.030512117046644357),
+ FRAC_CONST(0.03519504922365594),
+ FRAC_CONST(0.040381130021856941),
+ FRAC_CONST(0.046098643518702249),
+ FRAC_CONST(0.052374889768730587),
+ FRAC_CONST(0.059235903660769147),
+ FRAC_CONST(0.066706170556282418),
+ FRAC_CONST(0.074808341703430481),
+ FRAC_CONST(0.083562952548726227),
+ FRAC_CONST(0.092988147159339674),
+ FRAC_CONST(0.1030994120216919),
+ FRAC_CONST(0.11390932249409955),
+ FRAC_CONST(0.12542730516149531),
+ FRAC_CONST(0.13765941926783826),
+ FRAC_CONST(0.15060816028651081),
+ FRAC_CONST(0.16427228853114245),
+ FRAC_CONST(0.17864668550988483),
+ FRAC_CONST(0.19372224048676889),
+ FRAC_CONST(0.20948576943658073),
+ FRAC_CONST(0.22591996826744942),
+ FRAC_CONST(0.24300340184133981),
+ FRAC_CONST(0.26071052995068139),
+ FRAC_CONST(0.27901177101369551),
+ FRAC_CONST(0.29787360383626599),
+ FRAC_CONST(0.3172587073594233),
+ FRAC_CONST(0.33712613787396362),
+ FRAC_CONST(0.35743154274286698),
+ FRAC_CONST(0.37812740923363009),
+ FRAC_CONST(0.39916334663203618),
+ FRAC_CONST(0.42048639939189658),
+ FRAC_CONST(0.4420413886774246),
+ FRAC_CONST(0.4637712792815169),
+ FRAC_CONST(0.4856175685594023),
+ FRAC_CONST(0.50752069370766872),
+ FRAC_CONST(0.52942045344797806),
+ FRAC_CONST(0.55125643994680196),
+ FRAC_CONST(0.57296847662071559),
+ FRAC_CONST(0.59449705734411495),
+ FRAC_CONST(0.61578378249506627),
+ FRAC_CONST(0.63677178724712891),
+ FRAC_CONST(0.65740615754163356),
+ FRAC_CONST(0.67763432925662526),
+ FRAC_CONST(0.69740646622548552),
+ FRAC_CONST(0.71667581294953808),
+ FRAC_CONST(0.73539901809352737),
+ FRAC_CONST(0.75353642514900732),
+ FRAC_CONST(0.77105232699609816),
+ FRAC_CONST(0.78791518148597028),
+ FRAC_CONST(0.80409778560147072),
+ FRAC_CONST(0.81957740622770781),
+ FRAC_CONST(0.83433586607383625),
+ FRAC_CONST(0.84835958382689225),
+ FRAC_CONST(0.86163956818294229),
+ FRAC_CONST(0.87417136598406997),
+ FRAC_CONST(0.88595496528524853),
+ FRAC_CONST(0.89699465477567619),
+ FRAC_CONST(0.90729884157670959),
+ FRAC_CONST(0.91687983002436779),
+ FRAC_CONST(0.92575356460899649),
+ FRAC_CONST(0.93393934077779084),
+ FRAC_CONST(0.94145948779657318),
+ FRAC_CONST(0.94833902830402828),
+ FRAC_CONST(0.95460531956280026),
+ FRAC_CONST(0.96028768170574896),
+ FRAC_CONST(0.96541701848104766),
+ FRAC_CONST(0.97002543610646474),
+ FRAC_CONST(0.97414586584250062),
+ FRAC_CONST(0.97781169577969584),
+ FRAC_CONST(0.98105641710392333),
+ FRAC_CONST(0.98391328975491177),
+ FRAC_CONST(0.98641503193166202),
+ FRAC_CONST(0.98859353733226141),
+ FRAC_CONST(0.99047962335771556),
+ FRAC_CONST(0.9921028127769449),
+ FRAC_CONST(0.99349115056397752),
+ FRAC_CONST(0.99467105680259038),
+ FRAC_CONST(0.9956672157341897),
+ FRAC_CONST(0.99650250022834352),
+ FRAC_CONST(0.99719793020823266),
+ FRAC_CONST(0.99777266288955657),
+ FRAC_CONST(0.99824401211201486),
+ FRAC_CONST(0.99862749357391212),
+ FRAC_CONST(0.99893689243401962),
+ FRAC_CONST(0.99918434952623147),
+ FRAC_CONST(0.99938046234161726),
+ FRAC_CONST(0.99953439696357238),
+ FRAC_CONST(0.99965400728430465),
+ FRAC_CONST(0.99974595807027455),
+ FRAC_CONST(0.99981584876278362),
+ FRAC_CONST(0.99986833527824281),
+ FRAC_CONST(0.99990724749057802),
+ FRAC_CONST(0.99993570051598468),
+ FRAC_CONST(0.99995619835942084),
+ FRAC_CONST(0.99997072890647543),
+ FRAC_CONST(0.9999808496399144),
+ FRAC_CONST(0.99998776381655818),
+ FRAC_CONST(0.99999238714961569),
+ FRAC_CONST(0.99999540529959718),
+ FRAC_CONST(0.99999732268176988),
+ FRAC_CONST(0.99999850325054862),
+ FRAC_CONST(0.99999920402413744),
+ FRAC_CONST(0.9999996021706401),
+ FRAC_CONST(0.99999981649545566),
+ FRAC_CONST(0.99999992415545547),
+ FRAC_CONST(0.99999997338493041),
+ FRAC_CONST(0.99999999295825959),
+ FRAC_CONST(0.99999999904096815)
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const real_t kbd_short_120[] =
- {
- FRAC_CONST(0.0000452320086910),
- FRAC_CONST(0.0001274564692111),
- FRAC_CONST(0.0002529398385345),
- FRAC_CONST(0.0004335140496648),
- FRAC_CONST(0.0006827100966952),
- FRAC_CONST(0.0010158708222246),
- FRAC_CONST(0.0014502162869659),
- FRAC_CONST(0.0020048865156264),
- FRAC_CONST(0.0027009618393178),
- FRAC_CONST(0.0035614590925043),
- FRAC_CONST(0.0046113018122711),
- FRAC_CONST(0.0058772627936484),
- FRAC_CONST(0.0073878776584103),
- FRAC_CONST(0.0091733284512589),
- FRAC_CONST(0.0112652966728373),
- FRAC_CONST(0.0136967855861945),
- FRAC_CONST(0.0165019120857793),
- FRAC_CONST(0.0197156688892217),
- FRAC_CONST(0.0233736582950619),
- FRAC_CONST(0.0275117992367496),
- FRAC_CONST(0.0321660098468534),
- FRAC_CONST(0.0373718682174417),
- FRAC_CONST(0.0431642544948834),
- FRAC_CONST(0.0495769778717676),
- FRAC_CONST(0.0566423924273392),
- FRAC_CONST(0.0643910061132260),
- FRAC_CONST(0.0728510874761729),
- FRAC_CONST(0.0820482749475221),
- FRAC_CONST(0.0920051937045235),
- FRAC_CONST(0.1027410852163450),
- FRAC_CONST(0.1142714546239370),
- FRAC_CONST(0.1266077410648368),
- FRAC_CONST(0.1397570159398145),
- FRAC_CONST(0.1537217139274270),
- FRAC_CONST(0.1684994012857075),
- FRAC_CONST(0.1840825856392944),
- FRAC_CONST(0.2004585710384133),
- FRAC_CONST(0.2176093615976121),
- FRAC_CONST(0.2355116164824983),
- FRAC_CONST(0.2541366584185075),
- FRAC_CONST(0.2734505372545160),
- FRAC_CONST(0.2934141494343369),
- FRAC_CONST(0.3139834135200387),
- FRAC_CONST(0.3351095011824163),
- FRAC_CONST(0.3567391223361566),
- FRAC_CONST(0.3788148623608774),
- FRAC_CONST(0.4012755686250732),
- FRAC_CONST(0.4240567828288110),
- FRAC_CONST(0.4470912150133537),
- FRAC_CONST(0.4703092544619664),
- FRAC_CONST(0.4936395121456694),
- FRAC_CONST(0.5170093888596962),
- FRAC_CONST(0.5403456627591340),
- FRAC_CONST(0.5635750896430154),
- FRAC_CONST(0.5866250090612892),
- FRAC_CONST(0.6094239491338723),
- FRAC_CONST(0.6319022228794100),
- FRAC_CONST(0.6539925088563087),
- FRAC_CONST(0.6756304090216887),
- FRAC_CONST(0.6967549769155277),
- FRAC_CONST(0.7173092095766250),
- FRAC_CONST(0.7372404969921184),
- FRAC_CONST(0.7565010233699827),
- FRAC_CONST(0.7750481150999984),
- FRAC_CONST(0.7928445309277697),
- FRAC_CONST(0.8098586906021583),
- FRAC_CONST(0.8260648390616000),
- FRAC_CONST(0.8414431440907889),
- FRAC_CONST(0.8559797262966709),
- FRAC_CONST(0.8696666212110165),
- FRAC_CONST(0.8825016743142358),
- FRAC_CONST(0.8944883707784486),
- FRAC_CONST(0.9056356027326216),
- FRAC_CONST(0.9159573778427816),
- FRAC_CONST(0.9254724739583072),
- FRAC_CONST(0.9342040454819434),
- FRAC_CONST(0.9421791879559176),
- FRAC_CONST(0.9494284680976784),
- FRAC_CONST(0.9559854271440150),
- FRAC_CONST(0.9618860658493898),
- FRAC_CONST(0.9671683198119525),
- FRAC_CONST(0.9718715339497299),
- FRAC_CONST(0.9760359449042233),
- FRAC_CONST(0.9797021798981759),
- FRAC_CONST(0.9829107801140203),
- FRAC_CONST(0.9857017559923277),
- FRAC_CONST(0.9881141809867999),
- FRAC_CONST(0.9901858292742826),
- FRAC_CONST(0.9919528617340944),
- FRAC_CONST(0.9934495632180476),
- FRAC_CONST(0.9947081327749199),
- FRAC_CONST(0.9957585271195989),
- FRAC_CONST(0.9966283562984427),
- FRAC_CONST(0.9973428292485683),
- FRAC_CONST(0.9979247458259197),
- FRAC_CONST(0.9983945309245774),
- FRAC_CONST(0.9987703055583410),
- FRAC_CONST(0.9990679892449266),
- FRAC_CONST(0.9993014277313617),
- FRAC_CONST(0.9994825400228521),
- FRAC_CONST(0.9996214788122335),
- FRAC_CONST(0.9997267987294857),
- FRAC_CONST(0.9998056273097539),
- FRAC_CONST(0.9998638341781910),
- FRAC_CONST(0.9999061946325793),
- FRAC_CONST(0.9999365445321382),
- FRAC_CONST(0.9999579241373735),
- FRAC_CONST(0.9999727092594598),
- FRAC_CONST(0.9999827287418790),
- FRAC_CONST(0.9999893678912771),
- FRAC_CONST(0.9999936579844555),
- FRAC_CONST(0.9999963523959187),
- FRAC_CONST(0.9999979902130101),
- FRAC_CONST(0.9999989484358076),
- FRAC_CONST(0.9999994840031031),
- FRAC_CONST(0.9999997669534347),
- FRAC_CONST(0.9999999060327799),
- FRAC_CONST(0.9999999680107184),
- FRAC_CONST(0.9999999918774242),
- FRAC_CONST(0.9999999989770326)
- };
+ALIGN static const real_t kbd_short_120[] =
+{
+ FRAC_CONST(0.0000452320086910),
+ FRAC_CONST(0.0001274564692111),
+ FRAC_CONST(0.0002529398385345),
+ FRAC_CONST(0.0004335140496648),
+ FRAC_CONST(0.0006827100966952),
+ FRAC_CONST(0.0010158708222246),
+ FRAC_CONST(0.0014502162869659),
+ FRAC_CONST(0.0020048865156264),
+ FRAC_CONST(0.0027009618393178),
+ FRAC_CONST(0.0035614590925043),
+ FRAC_CONST(0.0046113018122711),
+ FRAC_CONST(0.0058772627936484),
+ FRAC_CONST(0.0073878776584103),
+ FRAC_CONST(0.0091733284512589),
+ FRAC_CONST(0.0112652966728373),
+ FRAC_CONST(0.0136967855861945),
+ FRAC_CONST(0.0165019120857793),
+ FRAC_CONST(0.0197156688892217),
+ FRAC_CONST(0.0233736582950619),
+ FRAC_CONST(0.0275117992367496),
+ FRAC_CONST(0.0321660098468534),
+ FRAC_CONST(0.0373718682174417),
+ FRAC_CONST(0.0431642544948834),
+ FRAC_CONST(0.0495769778717676),
+ FRAC_CONST(0.0566423924273392),
+ FRAC_CONST(0.0643910061132260),
+ FRAC_CONST(0.0728510874761729),
+ FRAC_CONST(0.0820482749475221),
+ FRAC_CONST(0.0920051937045235),
+ FRAC_CONST(0.1027410852163450),
+ FRAC_CONST(0.1142714546239370),
+ FRAC_CONST(0.1266077410648368),
+ FRAC_CONST(0.1397570159398145),
+ FRAC_CONST(0.1537217139274270),
+ FRAC_CONST(0.1684994012857075),
+ FRAC_CONST(0.1840825856392944),
+ FRAC_CONST(0.2004585710384133),
+ FRAC_CONST(0.2176093615976121),
+ FRAC_CONST(0.2355116164824983),
+ FRAC_CONST(0.2541366584185075),
+ FRAC_CONST(0.2734505372545160),
+ FRAC_CONST(0.2934141494343369),
+ FRAC_CONST(0.3139834135200387),
+ FRAC_CONST(0.3351095011824163),
+ FRAC_CONST(0.3567391223361566),
+ FRAC_CONST(0.3788148623608774),
+ FRAC_CONST(0.4012755686250732),
+ FRAC_CONST(0.4240567828288110),
+ FRAC_CONST(0.4470912150133537),
+ FRAC_CONST(0.4703092544619664),
+ FRAC_CONST(0.4936395121456694),
+ FRAC_CONST(0.5170093888596962),
+ FRAC_CONST(0.5403456627591340),
+ FRAC_CONST(0.5635750896430154),
+ FRAC_CONST(0.5866250090612892),
+ FRAC_CONST(0.6094239491338723),
+ FRAC_CONST(0.6319022228794100),
+ FRAC_CONST(0.6539925088563087),
+ FRAC_CONST(0.6756304090216887),
+ FRAC_CONST(0.6967549769155277),
+ FRAC_CONST(0.7173092095766250),
+ FRAC_CONST(0.7372404969921184),
+ FRAC_CONST(0.7565010233699827),
+ FRAC_CONST(0.7750481150999984),
+ FRAC_CONST(0.7928445309277697),
+ FRAC_CONST(0.8098586906021583),
+ FRAC_CONST(0.8260648390616000),
+ FRAC_CONST(0.8414431440907889),
+ FRAC_CONST(0.8559797262966709),
+ FRAC_CONST(0.8696666212110165),
+ FRAC_CONST(0.8825016743142358),
+ FRAC_CONST(0.8944883707784486),
+ FRAC_CONST(0.9056356027326216),
+ FRAC_CONST(0.9159573778427816),
+ FRAC_CONST(0.9254724739583072),
+ FRAC_CONST(0.9342040454819434),
+ FRAC_CONST(0.9421791879559176),
+ FRAC_CONST(0.9494284680976784),
+ FRAC_CONST(0.9559854271440150),
+ FRAC_CONST(0.9618860658493898),
+ FRAC_CONST(0.9671683198119525),
+ FRAC_CONST(0.9718715339497299),
+ FRAC_CONST(0.9760359449042233),
+ FRAC_CONST(0.9797021798981759),
+ FRAC_CONST(0.9829107801140203),
+ FRAC_CONST(0.9857017559923277),
+ FRAC_CONST(0.9881141809867999),
+ FRAC_CONST(0.9901858292742826),
+ FRAC_CONST(0.9919528617340944),
+ FRAC_CONST(0.9934495632180476),
+ FRAC_CONST(0.9947081327749199),
+ FRAC_CONST(0.9957585271195989),
+ FRAC_CONST(0.9966283562984427),
+ FRAC_CONST(0.9973428292485683),
+ FRAC_CONST(0.9979247458259197),
+ FRAC_CONST(0.9983945309245774),
+ FRAC_CONST(0.9987703055583410),
+ FRAC_CONST(0.9990679892449266),
+ FRAC_CONST(0.9993014277313617),
+ FRAC_CONST(0.9994825400228521),
+ FRAC_CONST(0.9996214788122335),
+ FRAC_CONST(0.9997267987294857),
+ FRAC_CONST(0.9998056273097539),
+ FRAC_CONST(0.9998638341781910),
+ FRAC_CONST(0.9999061946325793),
+ FRAC_CONST(0.9999365445321382),
+ FRAC_CONST(0.9999579241373735),
+ FRAC_CONST(0.9999727092594598),
+ FRAC_CONST(0.9999827287418790),
+ FRAC_CONST(0.9999893678912771),
+ FRAC_CONST(0.9999936579844555),
+ FRAC_CONST(0.9999963523959187),
+ FRAC_CONST(0.9999979902130101),
+ FRAC_CONST(0.9999989484358076),
+ FRAC_CONST(0.9999994840031031),
+ FRAC_CONST(0.9999997669534347),
+ FRAC_CONST(0.9999999060327799),
+ FRAC_CONST(0.9999999680107184),
+ FRAC_CONST(0.9999999918774242),
+ FRAC_CONST(0.9999999989770326)
+};
#endif
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.c
index f941bb964..2be18ae9f 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -49,14 +49,14 @@ static int16_t real_to_int16(real_t sig_in);
uint8_t is_ltp_ot(uint8_t object_type)
{
#ifdef LTP_DEC
- if((object_type == LTP)
+ if ((object_type == LTP)
#ifdef ERROR_RESILIENCE
- || (object_type == ER_LTP)
+ || (object_type == ER_LTP)
#endif
#ifdef LD_DEC
- || (object_type == LD)
+ || (object_type == LD)
#endif
- )
+ )
{
return 1;
}
@@ -87,9 +87,9 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
ALIGN real_t x_est[2048];
ALIGN real_t X_est[2048];
- if(ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{
- if(ltp->data_present)
+ if (ltp->data_present)
{
num_samples = frame_len << 1;
@@ -100,7 +100,7 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
#if 0
x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
- codebook[ltp->coef]);
+ codebook[ltp->coef]);
#else
/* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
this gives a real for x_est
@@ -110,19 +110,19 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
}
filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
- x_est, X_est, object_type, frame_len);
+ x_est, X_est, object_type, frame_len);
tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
- frame_len);
+ frame_len);
- for(sfb = 0; sfb < ltp->last_band; sfb++)
+ for (sfb = 0; sfb < ltp->last_band; sfb++)
{
- if(ltp->long_used[sfb])
+ if (ltp->long_used[sfb])
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
- for(bin = low; bin < high; bin++)
+ for (bin = low; bin < high; bin++)
{
spec[bin] += X_est[bin];
}
@@ -135,16 +135,14 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
#ifdef FIXED_POINT
static INLINE int16_t real_to_int16(real_t sig_in)
{
- if(sig_in >= 0)
+ if (sig_in >= 0)
{
- sig_in += (1 << (REAL_BITS - 1));
- if(sig_in >= REAL_CONST(32768))
+ sig_in += (1 << (REAL_BITS-1));
+ if (sig_in >= REAL_CONST(32768))
return 32767;
- }
- else
- {
- sig_in += -(1 << (REAL_BITS - 1));
- if(sig_in <= REAL_CONST(-32768))
+ } else {
+ sig_in += -(1 << (REAL_BITS-1));
+ if (sig_in <= REAL_CONST(-32768))
return -32768;
}
@@ -153,20 +151,18 @@ static INLINE int16_t real_to_int16(real_t sig_in)
#else
static INLINE int16_t real_to_int16(real_t sig_in)
{
- if(sig_in >= 0)
+ if (sig_in >= 0)
{
#ifndef HAS_LRINTF
sig_in += 0.5f;
#endif
- if(sig_in >= 32768.0f)
+ if (sig_in >= 32768.0f)
return 32767;
- }
- else
- {
+ } else {
#ifndef HAS_LRINTF
sig_in += -0.5f;
#endif
- if(sig_in <= -32768.0f)
+ if (sig_in <= -32768.0f)
return -32768;
}
@@ -191,20 +187,18 @@ void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap,
* For the LD object type an extra 512 samples lookback is accomodated here.
*/
#ifdef LD_DEC
- if(object_type == LD)
+ if (object_type == LD)
{
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)];
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]);
}
- }
- else
- {
+ } else {
#endif
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = real_to_int16(time[i]);
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.h
index 30e392c40..117f83424 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/lt_predict.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -39,24 +39,24 @@ extern "C" {
#include "filtbank.h"
- uint8_t is_ltp_ot(uint8_t object_type);
+uint8_t is_ltp_ot(uint8_t object_type);
- void lt_prediction(ic_stream *ics,
- ltp_info *ltp,
- real_t *spec,
- int16_t *lt_pred_stat,
- fb_info *fb,
- uint8_t win_shape,
- uint8_t win_shape_prev,
- uint8_t sr_index,
- uint8_t object_type,
- uint16_t frame_len);
+void lt_prediction(ic_stream *ics,
+ ltp_info *ltp,
+ real_t *spec,
+ int16_t *lt_pred_stat,
+ fb_info *fb,
+ uint8_t win_shape,
+ uint8_t win_shape_prev,
+ uint8_t sr_index,
+ uint8_t object_type,
+ uint16_t frame_len);
- void lt_update_state(int16_t *lt_pred_stat,
- real_t *time,
- real_t *overlap,
- uint16_t frame_len,
- uint8_t object_type);
+void lt_update_state(int16_t *lt_pred_stat,
+ real_t *time,
+ real_t *overlap,
+ uint16_t frame_len,
+ uint8_t object_type);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.c
index 4de5681f9..247691e40 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -32,7 +32,7 @@
* Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
* and consists of three steps: pre-(I)FFT complex multiplication, complex
* (I)FFT, post-(I)FFT complex multiplication,
- *
+ *
* As described in:
* P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
* Implementation of Filter Banks Based on 'Time Domain Aliasing
@@ -73,44 +73,28 @@ mdct_info *faad_mdct_init(uint16_t N)
/* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
* IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */
/* scale is 1 for fixed point, sqrt(N) for floating point */
- switch(N)
+ switch (N)
{
- case 2048:
- mdct->sincos = (complex_t*)mdct_tab_2048;
- break;
- case 256:
- mdct->sincos = (complex_t*)mdct_tab_256;
- break;
+ case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break;
+ case 256: mdct->sincos = (complex_t*)mdct_tab_256; break;
#ifdef LD_DEC
- case 1024:
- mdct->sincos = (complex_t*)mdct_tab_1024;
- break;
+ case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
- case 1920:
- mdct->sincos = (complex_t*)mdct_tab_1920;
- break;
- case 240:
- mdct->sincos = (complex_t*)mdct_tab_240;
- break;
+ case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break;
+ case 240: mdct->sincos = (complex_t*)mdct_tab_240; break;
#ifdef LD_DEC
- case 960:
- mdct->sincos = (complex_t*)mdct_tab_960;
- break;
+ case 960: mdct->sincos = (complex_t*)mdct_tab_960; break;
#endif
#endif
#ifdef SSR_DEC
- case 512:
- mdct->sincos = (complex_t*)mdct_tab_512;
- break;
- case 64:
- mdct->sincos = (complex_t*)mdct_tab_64;
- break;
+ case 512: mdct->sincos = (complex_t*)mdct_tab_512; break;
+ case 64: mdct->sincos = (complex_t*)mdct_tab_64; break;
#endif
}
/* initialise fft */
- mdct->cfft = cffti(N / 4);
+ mdct->cfft = cffti(N/4);
#ifdef PROFILE
mdct->cycles = 0;
@@ -122,11 +106,11 @@ mdct_info *faad_mdct_init(uint16_t N)
void faad_mdct_end(mdct_info *mdct)
{
- if(mdct != NULL)
+ if (mdct != NULL)
{
#ifdef PROFILE
printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles);
- printf("CFFT[%.4d]: %I64d cycles\n", mdct->N / 4, mdct->fft_cycles);
+ printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
#endif
cfftu(mdct->cfft);
@@ -160,7 +144,7 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* detect non-power of 2 */
- if(N & (N - 1))
+ if (N & (N-1))
{
/* adjust scale for non-power of 2 MDCT */
/* 2048/1920 */
@@ -171,10 +155,10 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
#endif
/* pre-IFFT complex multiplication */
- for(k = 0; k < N4; k++)
+ for (k = 0; k < N4; k++)
{
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
- X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
+ X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
}
#ifdef PROFILE
@@ -189,17 +173,17 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
#endif
/* post-IFFT complex multiplication */
- for(k = 0; k < N4; k++)
+ for (k = 0; k < N4; k++)
{
RE(x) = RE(Z1[k]);
IM(x) = IM(Z1[k]);
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
- IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
+ IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* non-power of 2 MDCT scaling */
- if(b_scale)
+ if (b_scale)
{
RE(Z1[k]) = MUL_C(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_C(IM(Z1[k]), scale);
@@ -209,7 +193,7 @@ void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
}
/* reordering */
- for(k = 0; k < N8; k += 2)
+ for (k = 0; k < N8; k+=2)
{
X_out[ 2*k] = IM(Z1[N8 + k]);
X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]);
@@ -258,15 +242,15 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
uint16_t N8 = N >> 3;
#ifndef FIXED_POINT
- real_t scale = REAL_CONST(N);
+ real_t scale = REAL_CONST(N);
#else
- real_t scale = REAL_CONST(4.0 / N);
+ real_t scale = REAL_CONST(4.0/N);
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* detect non-power of 2 */
- if(N & (N - 1))
+ if (N & (N-1))
{
/* adjust scale for non-power of 2 MDCT */
/* *= sqrt(2048/1920) */
@@ -276,14 +260,14 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
#endif
/* pre-FFT complex multiplication */
- for(k = 0; k < N8; k++)
+ for (k = 0; k < N8; k++)
{
uint16_t n = k << 1;
RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n];
ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
- RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
+ RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
@@ -292,7 +276,7 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
IM(x) = X_in[N2 + n] + X_in[N - 1 - n];
ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
- RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
+ RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
@@ -302,11 +286,11 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
cfftf(mdct->cfft, Z1);
/* post-FFT complex multiplication */
- for(k = 0; k < N4; k++)
+ for (k = 0; k < N4; k++)
{
uint16_t n = k << 1;
ComplexMult(&RE(x), &IM(x),
- RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
+ RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
X_out[ n] = -RE(x);
X_out[N2 - 1 - n] = IM(x);
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.h
index 70aa910e4..736180ead 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,10 +36,10 @@ extern "C" {
#endif
- mdct_info *faad_mdct_init(uint16_t N);
- void faad_mdct_end(mdct_info *mdct);
- void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
- void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
+mdct_info *faad_mdct_init(uint16_t N);
+void faad_mdct_end(mdct_info *mdct);
+void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
+void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct_tab.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct_tab.h
index a9d98b288..eea285b67 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct_tab.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/mdct_tab.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,3614 +37,3614 @@ extern "C" {
#ifdef FIXED_POINT
- /* 256 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_2048[] =
- {
- { FRAC_CONST(0.999999926465718), FRAC_CONST(0.000383495187571) },
- { FRAC_CONST(0.999994043728986), FRAC_CONST(0.003451449920136) },
- { FRAC_CONST(0.999978748667469), FRAC_CONST(0.006519372166339) },
- { FRAC_CONST(0.999954041425130), FRAC_CONST(0.009587233049729) },
- { FRAC_CONST(0.999919922234523), FRAC_CONST(0.012655003694430) },
- { FRAC_CONST(0.999876391416790), FRAC_CONST(0.015722655225417) },
- { FRAC_CONST(0.999823449381662), FRAC_CONST(0.018790158768785) },
- { FRAC_CONST(0.999761096627447), FRAC_CONST(0.021857485452022) },
- { FRAC_CONST(0.999689333741034), FRAC_CONST(0.024924606404281) },
- { FRAC_CONST(0.999608161397882), FRAC_CONST(0.027991492756653) },
- { FRAC_CONST(0.999517580362017), FRAC_CONST(0.031058115642435) },
- { FRAC_CONST(0.999417591486022), FRAC_CONST(0.034124446197403) },
- { FRAC_CONST(0.999308195711029), FRAC_CONST(0.037190455560088) },
- { FRAC_CONST(0.999189394066715), FRAC_CONST(0.040256114872041) },
- { FRAC_CONST(0.999061187671285), FRAC_CONST(0.043321395278110) },
- { FRAC_CONST(0.998923577731466), FRAC_CONST(0.046386267926707) },
- { FRAC_CONST(0.998776565542496), FRAC_CONST(0.049450703970085) },
- { FRAC_CONST(0.998620152488109), FRAC_CONST(0.052514674564603) },
- { FRAC_CONST(0.998454340040525), FRAC_CONST(0.055578150871005) },
- { FRAC_CONST(0.998279129760433), FRAC_CONST(0.058641104054683) },
- { FRAC_CONST(0.998094523296980), FRAC_CONST(0.061703505285957) },
- { FRAC_CONST(0.997900522387752), FRAC_CONST(0.064765325740340) },
- { FRAC_CONST(0.997697128858759), FRAC_CONST(0.067826536598811) },
- { FRAC_CONST(0.997484344624418), FRAC_CONST(0.070887109048088) },
- { FRAC_CONST(0.997262171687536), FRAC_CONST(0.073947014280897) },
- { FRAC_CONST(0.997030612139289), FRAC_CONST(0.077006223496246) },
- { FRAC_CONST(0.996789668159205), FRAC_CONST(0.080064707899691) },
- { FRAC_CONST(0.996539342015138), FRAC_CONST(0.083122438703613) },
- { FRAC_CONST(0.996279636063255), FRAC_CONST(0.086179387127485) },
- { FRAC_CONST(0.996010552748006), FRAC_CONST(0.089235524398144) },
- { FRAC_CONST(0.995732094602106), FRAC_CONST(0.092290821750062) },
- { FRAC_CONST(0.995444264246510), FRAC_CONST(0.095345250425618) },
- { FRAC_CONST(0.995147064390386), FRAC_CONST(0.098398781675364) },
- { FRAC_CONST(0.994840497831093), FRAC_CONST(0.101451386758302) },
- { FRAC_CONST(0.994524567454152), FRAC_CONST(0.104503036942151) },
- { FRAC_CONST(0.994199276233219), FRAC_CONST(0.107553703503616) },
- { FRAC_CONST(0.993864627230060), FRAC_CONST(0.110603357728662) },
- { FRAC_CONST(0.993520623594518), FRAC_CONST(0.113651970912782) },
- { FRAC_CONST(0.993167268564487), FRAC_CONST(0.116699514361268) },
- { FRAC_CONST(0.992804565465879), FRAC_CONST(0.119745959389480) },
- { FRAC_CONST(0.992432517712594), FRAC_CONST(0.122791277323117) },
- { FRAC_CONST(0.992051128806486), FRAC_CONST(0.125835439498487) },
- { FRAC_CONST(0.991660402337333), FRAC_CONST(0.128878417262777) },
- { FRAC_CONST(0.991260341982802), FRAC_CONST(0.131920181974320) },
- { FRAC_CONST(0.990850951508414), FRAC_CONST(0.134960705002869) },
- { FRAC_CONST(0.990432234767506), FRAC_CONST(0.137999957729863) },
- { FRAC_CONST(0.990004195701201), FRAC_CONST(0.141037911548698) },
- { FRAC_CONST(0.989566838338365), FRAC_CONST(0.144074537864995) },
- { FRAC_CONST(0.989120166795573), FRAC_CONST(0.147109808096872) },
- { FRAC_CONST(0.988664185277066), FRAC_CONST(0.150143693675208) },
- { FRAC_CONST(0.988198898074718), FRAC_CONST(0.153176166043918) },
- { FRAC_CONST(0.987724309567987), FRAC_CONST(0.156207196660216) },
- { FRAC_CONST(0.987240424223882), FRAC_CONST(0.159236756994888) },
- { FRAC_CONST(0.986747246596917), FRAC_CONST(0.162264818532558) },
- { FRAC_CONST(0.986244781329065), FRAC_CONST(0.165291352771958) },
- { FRAC_CONST(0.985733033149723), FRAC_CONST(0.168316331226195) },
- { FRAC_CONST(0.985212006875659), FRAC_CONST(0.171339725423019) },
- { FRAC_CONST(0.984681707410971), FRAC_CONST(0.174361506905094) },
- { FRAC_CONST(0.984142139747039), FRAC_CONST(0.177381647230260) },
- { FRAC_CONST(0.983593308962479), FRAC_CONST(0.180400117971807) },
- { FRAC_CONST(0.983035220223096), FRAC_CONST(0.183416890718739) },
- { FRAC_CONST(0.982467878781833), FRAC_CONST(0.186431937076042) },
- { FRAC_CONST(0.981891289978725), FRAC_CONST(0.189445228664950) },
- { FRAC_CONST(0.981305459240845), FRAC_CONST(0.192456737123217) },
- { FRAC_CONST(0.980710392082254), FRAC_CONST(0.195466434105377) },
- { FRAC_CONST(0.980106094103952), FRAC_CONST(0.198474291283016) },
- { FRAC_CONST(0.979492570993821), FRAC_CONST(0.201480280345038) },
- { FRAC_CONST(0.978869828526574), FRAC_CONST(0.204484372997927) },
- { FRAC_CONST(0.978237872563701), FRAC_CONST(0.207486540966021) },
- { FRAC_CONST(0.977596709053412), FRAC_CONST(0.210486755991770) },
- { FRAC_CONST(0.976946344030582), FRAC_CONST(0.213484989836008) },
- { FRAC_CONST(0.976286783616694), FRAC_CONST(0.216481214278217) },
- { FRAC_CONST(0.975618034019782), FRAC_CONST(0.219475401116790) },
- { FRAC_CONST(0.974940101534372), FRAC_CONST(0.222467522169302) },
- { FRAC_CONST(0.974252992541423), FRAC_CONST(0.225457549272769) },
- { FRAC_CONST(0.973556713508266), FRAC_CONST(0.228445454283916) },
- { FRAC_CONST(0.972851270988544), FRAC_CONST(0.231431209079446) },
- { FRAC_CONST(0.972136671622152), FRAC_CONST(0.234414785556295) },
- { FRAC_CONST(0.971412922135171), FRAC_CONST(0.237396155631907) },
- { FRAC_CONST(0.970680029339806), FRAC_CONST(0.240375291244489) },
- { FRAC_CONST(0.969938000134324), FRAC_CONST(0.243352164353285) },
- { FRAC_CONST(0.969186841502986), FRAC_CONST(0.246326746938829) },
- { FRAC_CONST(0.968426560515983), FRAC_CONST(0.249299011003218) },
- { FRAC_CONST(0.967657164329370), FRAC_CONST(0.252268928570371) },
- { FRAC_CONST(0.966878660184996), FRAC_CONST(0.255236471686292) },
- { FRAC_CONST(0.966091055410439), FRAC_CONST(0.258201612419335) },
- { FRAC_CONST(0.965294357418935), FRAC_CONST(0.261164322860466) },
- { FRAC_CONST(0.964488573709308), FRAC_CONST(0.264124575123528) },
- { FRAC_CONST(0.963673711865903), FRAC_CONST(0.267082341345496) },
- { FRAC_CONST(0.962849779558509), FRAC_CONST(0.270037593686751) },
- { FRAC_CONST(0.962016784542291), FRAC_CONST(0.272990304331330) },
- { FRAC_CONST(0.961174734657714), FRAC_CONST(0.275940445487197) },
- { FRAC_CONST(0.960323637830474), FRAC_CONST(0.278887989386500) },
- { FRAC_CONST(0.959463502071418), FRAC_CONST(0.281832908285833) },
- { FRAC_CONST(0.958594335476470), FRAC_CONST(0.284775174466498) },
- { FRAC_CONST(0.957716146226559), FRAC_CONST(0.287714760234765) },
- { FRAC_CONST(0.956828942587535), FRAC_CONST(0.290651637922133) },
- { FRAC_CONST(0.955932732910098), FRAC_CONST(0.293585779885591) },
- { FRAC_CONST(0.955027525629714), FRAC_CONST(0.296517158507877) },
- { FRAC_CONST(0.954113329266539), FRAC_CONST(0.299445746197740) },
- { FRAC_CONST(0.953190152425337), FRAC_CONST(0.302371515390196) },
- { FRAC_CONST(0.952258003795400), FRAC_CONST(0.305294438546792) },
- { FRAC_CONST(0.951316892150466), FRAC_CONST(0.308214488155861) },
- { FRAC_CONST(0.950366826348636), FRAC_CONST(0.311131636732785) },
- { FRAC_CONST(0.949407815332292), FRAC_CONST(0.314045856820251) },
- { FRAC_CONST(0.948439868128010), FRAC_CONST(0.316957120988508) },
- { FRAC_CONST(0.947462993846478), FRAC_CONST(0.319865401835631) },
- { FRAC_CONST(0.946477201682409), FRAC_CONST(0.322770671987771) },
- { FRAC_CONST(0.945482500914454), FRAC_CONST(0.325672904099420) },
- { FRAC_CONST(0.944478900905116), FRAC_CONST(0.328572070853664) },
- { FRAC_CONST(0.943466411100659), FRAC_CONST(0.331468144962441) },
- { FRAC_CONST(0.942445041031025), FRAC_CONST(0.334361099166799) },
- { FRAC_CONST(0.941414800309736), FRAC_CONST(0.337250906237151) },
- { FRAC_CONST(0.940375698633812), FRAC_CONST(0.340137538973532) },
- { FRAC_CONST(0.939327745783671), FRAC_CONST(0.343020970205856) },
- { FRAC_CONST(0.938270951623047), FRAC_CONST(0.345901172794169) },
- { FRAC_CONST(0.937205326098888), FRAC_CONST(0.348778119628908) },
- { FRAC_CONST(0.936130879241267), FRAC_CONST(0.351651783631155) },
- { FRAC_CONST(0.935047621163287), FRAC_CONST(0.354522137752887) },
- { FRAC_CONST(0.933955562060987), FRAC_CONST(0.357389154977241) },
- { FRAC_CONST(0.932854712213241), FRAC_CONST(0.360252808318757) },
- { FRAC_CONST(0.931745081981669), FRAC_CONST(0.363113070823639) },
- { FRAC_CONST(0.930626681810532), FRAC_CONST(0.365969915570009) },
- { FRAC_CONST(0.929499522226639), FRAC_CONST(0.368823315668154) },
- { FRAC_CONST(0.928363613839244), FRAC_CONST(0.371673244260787) },
- { FRAC_CONST(0.927218967339952), FRAC_CONST(0.374519674523293) },
- { FRAC_CONST(0.926065593502609), FRAC_CONST(0.377362579663988) },
- { FRAC_CONST(0.924903503183211), FRAC_CONST(0.380201932924366) },
- { FRAC_CONST(0.923732707319793), FRAC_CONST(0.383037707579352) },
- { FRAC_CONST(0.922553216932333), FRAC_CONST(0.385869876937555) },
- { FRAC_CONST(0.921365043122642), FRAC_CONST(0.388698414341519) },
- { FRAC_CONST(0.920168197074266), FRAC_CONST(0.391523293167972) },
- { FRAC_CONST(0.918962690052376), FRAC_CONST(0.394344486828080) },
- { FRAC_CONST(0.917748533403661), FRAC_CONST(0.397161968767692) },
- { FRAC_CONST(0.916525738556228), FRAC_CONST(0.399975712467595) },
- { FRAC_CONST(0.915294317019487), FRAC_CONST(0.402785691443764) },
- { FRAC_CONST(0.914054280384047), FRAC_CONST(0.405591879247604) },
- { FRAC_CONST(0.912805640321604), FRAC_CONST(0.408394249466208) },
- { FRAC_CONST(0.911548408584834), FRAC_CONST(0.411192775722600) },
- { FRAC_CONST(0.910282597007282), FRAC_CONST(0.413987431675985) },
- { FRAC_CONST(0.909008217503247), FRAC_CONST(0.416778191021998) },
- { FRAC_CONST(0.907725282067676), FRAC_CONST(0.419565027492947) },
- { FRAC_CONST(0.906433802776045), FRAC_CONST(0.422347914858067) },
- { FRAC_CONST(0.905133791784250), FRAC_CONST(0.425126826923762) },
- { FRAC_CONST(0.903825261328488), FRAC_CONST(0.427901737533854) },
- { FRAC_CONST(0.902508223725146), FRAC_CONST(0.430672620569827) },
- { FRAC_CONST(0.901182691370685), FRAC_CONST(0.433439449951074) },
- { FRAC_CONST(0.899848676741519), FRAC_CONST(0.436202199635144) },
- { FRAC_CONST(0.898506192393902), FRAC_CONST(0.438960843617984) },
- { FRAC_CONST(0.897155250963809), FRAC_CONST(0.441715355934187) },
- { FRAC_CONST(0.895795865166814), FRAC_CONST(0.444465710657234) },
- { FRAC_CONST(0.894428047797974), FRAC_CONST(0.447211881899738) },
- { FRAC_CONST(0.893051811731707), FRAC_CONST(0.449953843813691) },
- { FRAC_CONST(0.891667169921672), FRAC_CONST(0.452691570590701) },
- { FRAC_CONST(0.890274135400645), FRAC_CONST(0.455425036462242) },
- { FRAC_CONST(0.888872721280396), FRAC_CONST(0.458154215699893) },
- { FRAC_CONST(0.887462940751569), FRAC_CONST(0.460879082615579) },
- { FRAC_CONST(0.886044807083556), FRAC_CONST(0.463599611561814) },
- { FRAC_CONST(0.884618333624370), FRAC_CONST(0.466315776931944) },
- { FRAC_CONST(0.883183533800523), FRAC_CONST(0.469027553160387) },
- { FRAC_CONST(0.881740421116898), FRAC_CONST(0.471734914722871) },
- { FRAC_CONST(0.880289009156621), FRAC_CONST(0.474437836136679) },
- { FRAC_CONST(0.878829311580933), FRAC_CONST(0.477136291960885) },
- { FRAC_CONST(0.877361342129065), FRAC_CONST(0.479830256796594) },
- { FRAC_CONST(0.875885114618104), FRAC_CONST(0.482519705287184) },
- { FRAC_CONST(0.874400642942865), FRAC_CONST(0.485204612118542) },
- { FRAC_CONST(0.872907941075761), FRAC_CONST(0.487884952019301) },
- { FRAC_CONST(0.871407023066671), FRAC_CONST(0.490560699761082) },
- { FRAC_CONST(0.869897903042806), FRAC_CONST(0.493231830158728) },
- { FRAC_CONST(0.868380595208580), FRAC_CONST(0.495898318070542) },
- { FRAC_CONST(0.866855113845470), FRAC_CONST(0.498560138398525) },
- { FRAC_CONST(0.865321473311890), FRAC_CONST(0.501217266088610) },
- { FRAC_CONST(0.863779688043047), FRAC_CONST(0.503869676130899) },
- { FRAC_CONST(0.862229772550811), FRAC_CONST(0.506517343559899) },
- { FRAC_CONST(0.860671741423578), FRAC_CONST(0.509160243454755) },
- { FRAC_CONST(0.859105609326130), FRAC_CONST(0.511798350939487) },
- { FRAC_CONST(0.857531390999499), FRAC_CONST(0.514431641183223) },
- { FRAC_CONST(0.855949101260827), FRAC_CONST(0.517060089400432) },
- { FRAC_CONST(0.854358755003227), FRAC_CONST(0.519683670851158) },
- { FRAC_CONST(0.852760367195645), FRAC_CONST(0.522302360841255) },
- { FRAC_CONST(0.851153952882715), FRAC_CONST(0.524916134722613) },
- { FRAC_CONST(0.849539527184621), FRAC_CONST(0.527524967893398) },
- { FRAC_CONST(0.847917105296951), FRAC_CONST(0.530128835798279) },
- { FRAC_CONST(0.846286702490560), FRAC_CONST(0.532727713928659) },
- { FRAC_CONST(0.844648334111418), FRAC_CONST(0.535321577822907) },
- { FRAC_CONST(0.843002015580473), FRAC_CONST(0.537910403066589) },
- { FRAC_CONST(0.841347762393502), FRAC_CONST(0.540494165292695) },
- { FRAC_CONST(0.839685590120966), FRAC_CONST(0.543072840181872) },
- { FRAC_CONST(0.838015514407864), FRAC_CONST(0.545646403462649) },
- { FRAC_CONST(0.836337550973584), FRAC_CONST(0.548214830911668) },
- { FRAC_CONST(0.834651715611756), FRAC_CONST(0.550778098353912) },
- { FRAC_CONST(0.832958024190107), FRAC_CONST(0.553336181662932) },
- { FRAC_CONST(0.831256492650303), FRAC_CONST(0.555889056761074) },
- { FRAC_CONST(0.829547137007809), FRAC_CONST(0.558436699619704) },
- { FRAC_CONST(0.827829973351730), FRAC_CONST(0.560979086259438) },
- { FRAC_CONST(0.826105017844665), FRAC_CONST(0.563516192750365) },
- { FRAC_CONST(0.824372286722551), FRAC_CONST(0.566047995212271) },
- { FRAC_CONST(0.822631796294515), FRAC_CONST(0.568574469814869) },
- { FRAC_CONST(0.820883562942715), FRAC_CONST(0.571095592778017) },
- { FRAC_CONST(0.819127603122188), FRAC_CONST(0.573611340371945) },
- { FRAC_CONST(0.817363933360698), FRAC_CONST(0.576121688917478) },
- { FRAC_CONST(0.815592570258577), FRAC_CONST(0.578626614786261) },
- { FRAC_CONST(0.813813530488567), FRAC_CONST(0.581126094400978) },
- { FRAC_CONST(0.812026830795670), FRAC_CONST(0.583620104235573) },
- { FRAC_CONST(0.810232487996982), FRAC_CONST(0.586108620815476) },
- { FRAC_CONST(0.808430518981543), FRAC_CONST(0.588591620717823) },
- { FRAC_CONST(0.806620940710170), FRAC_CONST(0.591069080571671) },
- { FRAC_CONST(0.804803770215303), FRAC_CONST(0.593540977058226) },
- { FRAC_CONST(0.802979024600843), FRAC_CONST(0.596007286911057) },
- { FRAC_CONST(0.801146721041991), FRAC_CONST(0.598467986916314) },
- { FRAC_CONST(0.799306876785086), FRAC_CONST(0.600923053912954) },
- { FRAC_CONST(0.797459509147442), FRAC_CONST(0.603372464792950) },
- { FRAC_CONST(0.795604635517188), FRAC_CONST(0.605816196501515) },
- { FRAC_CONST(0.793742273353100), FRAC_CONST(0.608254226037314) },
- { FRAC_CONST(0.791872440184440), FRAC_CONST(0.610686530452686) },
- { FRAC_CONST(0.789995153610791), FRAC_CONST(0.613113086853855) },
- { FRAC_CONST(0.788110431301888), FRAC_CONST(0.615533872401147) },
- { FRAC_CONST(0.786218290997456), FRAC_CONST(0.617948864309208) },
- { FRAC_CONST(0.784318750507039), FRAC_CONST(0.620358039847214) },
- { FRAC_CONST(0.782411827709837), FRAC_CONST(0.622761376339086) },
- { FRAC_CONST(0.780497540554532), FRAC_CONST(0.625158851163708) },
- { FRAC_CONST(0.778575907059125), FRAC_CONST(0.627550441755132) },
- { FRAC_CONST(0.776646945310762), FRAC_CONST(0.629936125602796) },
- { FRAC_CONST(0.774710673465566), FRAC_CONST(0.632315880251738) },
- { FRAC_CONST(0.772767109748464), FRAC_CONST(0.634689683302798) },
- { FRAC_CONST(0.770816272453019), FRAC_CONST(0.637057512412839) },
- { FRAC_CONST(0.768858179941253), FRAC_CONST(0.639419345294951) },
- { FRAC_CONST(0.766892850643481), FRAC_CONST(0.641775159718664) },
- { FRAC_CONST(0.764920303058128), FRAC_CONST(0.644124933510155) },
- { FRAC_CONST(0.762940555751566), FRAC_CONST(0.646468644552458) },
- { FRAC_CONST(0.760953627357928), FRAC_CONST(0.648806270785673) },
- { FRAC_CONST(0.758959536578942), FRAC_CONST(0.651137790207170) },
- { FRAC_CONST(0.756958302183750), FRAC_CONST(0.653463180871802) },
- { FRAC_CONST(0.754949943008733), FRAC_CONST(0.655782420892106) },
- { FRAC_CONST(0.752934477957330), FRAC_CONST(0.658095488438511) },
- { FRAC_CONST(0.750911925999868), FRAC_CONST(0.660402361739545) },
- { FRAC_CONST(0.748882306173375), FRAC_CONST(0.662703019082037) },
- { FRAC_CONST(0.746845637581407), FRAC_CONST(0.664997438811325) },
- { FRAC_CONST(0.744801939393863), FRAC_CONST(0.667285599331456) },
- { FRAC_CONST(0.742751230846809), FRAC_CONST(0.669567479105392) },
- { FRAC_CONST(0.740693531242296), FRAC_CONST(0.671843056655212) },
- { FRAC_CONST(0.738628859948175), FRAC_CONST(0.674112310562312) },
- { FRAC_CONST(0.736557236397919), FRAC_CONST(0.676375219467612) },
- { FRAC_CONST(0.734478680090438), FRAC_CONST(0.678631762071749) },
- { FRAC_CONST(0.732393210589896), FRAC_CONST(0.680881917135287) },
- { FRAC_CONST(0.730300847525525), FRAC_CONST(0.683125663478909) },
- { FRAC_CONST(0.728201610591445), FRAC_CONST(0.685362979983619) },
- { FRAC_CONST(0.726095519546471), FRAC_CONST(0.687593845590942) },
- { FRAC_CONST(0.723982594213936), FRAC_CONST(0.689818239303122) },
- { FRAC_CONST(0.721862854481496), FRAC_CONST(0.692036140183319) },
- { FRAC_CONST(0.719736320300951), FRAC_CONST(0.694247527355803) },
- { FRAC_CONST(0.717603011688049), FRAC_CONST(0.696452380006158) },
- { FRAC_CONST(0.715462948722304), FRAC_CONST(0.698650677381469) },
- { FRAC_CONST(0.713316151546803), FRAC_CONST(0.700842398790526) },
- { FRAC_CONST(0.711162640368018), FRAC_CONST(0.703027523604011) },
- { FRAC_CONST(0.709002435455618), FRAC_CONST(0.705206031254698) },
- { FRAC_CONST(0.706835557142274), FRAC_CONST(0.707377901237642) },
- { FRAC_CONST(0.704662025823469), FRAC_CONST(0.709543113110377) },
- { FRAC_CONST(0.702481861957308), FRAC_CONST(0.711701646493103) },
- { FRAC_CONST(0.700295086064324), FRAC_CONST(0.713853481068882) },
- { FRAC_CONST(0.698101718727284), FRAC_CONST(0.715998596583829) },
- { FRAC_CONST(0.695901780590997), FRAC_CONST(0.718136972847297) },
- { FRAC_CONST(0.693695292362118), FRAC_CONST(0.720268589732077) },
- { FRAC_CONST(0.691482274808956), FRAC_CONST(0.722393427174578) },
- { FRAC_CONST(0.689262748761273), FRAC_CONST(0.724511465175020) },
- { FRAC_CONST(0.687036735110096), FRAC_CONST(0.726622683797623) },
- { FRAC_CONST(0.684804254807511), FRAC_CONST(0.728727063170794) },
- { FRAC_CONST(0.682565328866473), FRAC_CONST(0.730824583487312) },
- { FRAC_CONST(0.680319978360607), FRAC_CONST(0.732915225004518) },
- { FRAC_CONST(0.678068224424007), FRAC_CONST(0.734998968044497) },
- { FRAC_CONST(0.675810088251037), FRAC_CONST(0.737075792994266) },
- { FRAC_CONST(0.673545591096136), FRAC_CONST(0.739145680305957) },
- { FRAC_CONST(0.671274754273613), FRAC_CONST(0.741208610497004) },
- { FRAC_CONST(0.668997599157450), FRAC_CONST(0.743264564150321) },
- { FRAC_CONST(0.666714147181098), FRAC_CONST(0.745313521914490) },
- { FRAC_CONST(0.664424419837275), FRAC_CONST(0.747355464503940) },
- { FRAC_CONST(0.662128438677769), FRAC_CONST(0.749390372699130) },
- { FRAC_CONST(0.659826225313227), FRAC_CONST(0.751418227346727) },
- { FRAC_CONST(0.657517801412960), FRAC_CONST(0.753439009359794) },
- { FRAC_CONST(0.655203188704732), FRAC_CONST(0.755452699717958) },
- { FRAC_CONST(0.652882408974559), FRAC_CONST(0.757459279467601) },
- { FRAC_CONST(0.650555484066504), FRAC_CONST(0.759458729722028) },
- { FRAC_CONST(0.648222435882470), FRAC_CONST(0.761451031661654) },
- { FRAC_CONST(0.645883286381996), FRAC_CONST(0.763436166534172) },
- { FRAC_CONST(0.643538057582048), FRAC_CONST(0.765414115654738) },
- { FRAC_CONST(0.641186771556811), FRAC_CONST(0.767384860406142) },
- { FRAC_CONST(0.638829450437486), FRAC_CONST(0.769348382238982) },
- { FRAC_CONST(0.636466116412077), FRAC_CONST(0.771304662671845) },
- { FRAC_CONST(0.634096791725184), FRAC_CONST(0.773253683291473) },
- { FRAC_CONST(0.631721498677792), FRAC_CONST(0.775195425752941) },
- { FRAC_CONST(0.629340259627066), FRAC_CONST(0.777129871779832) },
- { FRAC_CONST(0.626953096986133), FRAC_CONST(0.779057003164401) },
- { FRAC_CONST(0.624560033223877), FRAC_CONST(0.780976801767754) },
- { FRAC_CONST(0.622161090864727), FRAC_CONST(0.782889249520015) },
- { FRAC_CONST(0.619756292488441), FRAC_CONST(0.784794328420499) },
- { FRAC_CONST(0.617345660729897), FRAC_CONST(0.786692020537877) },
- { FRAC_CONST(0.614929218278880), FRAC_CONST(0.788582308010347) },
- { FRAC_CONST(0.612506987879866), FRAC_CONST(0.790465173045805) },
- { FRAC_CONST(0.610078992331810), FRAC_CONST(0.792340597922007) },
- { FRAC_CONST(0.607645254487931), FRAC_CONST(0.794208564986741) },
- { FRAC_CONST(0.605205797255497), FRAC_CONST(0.796069056657988) },
- { FRAC_CONST(0.602760643595607), FRAC_CONST(0.797922055424093) },
- { FRAC_CONST(0.600309816522980), FRAC_CONST(0.799767543843926) },
- { FRAC_CONST(0.597853339105734), FRAC_CONST(0.801605504547046) },
- { FRAC_CONST(0.595391234465169), FRAC_CONST(0.803435920233868) },
- { FRAC_CONST(0.592923525775551), FRAC_CONST(0.805258773675822) },
- { FRAC_CONST(0.590450236263896), FRAC_CONST(0.807074047715518) },
- { FRAC_CONST(0.587971389209745), FRAC_CONST(0.808881725266904) },
- { FRAC_CONST(0.585487007944951), FRAC_CONST(0.810681789315431) },
- { FRAC_CONST(0.582997115853458), FRAC_CONST(0.812474222918210) },
- { FRAC_CONST(0.580501736371077), FRAC_CONST(0.814259009204175) },
- { FRAC_CONST(0.578000892985270), FRAC_CONST(0.816036131374237) },
- { FRAC_CONST(0.575494609234928), FRAC_CONST(0.817805572701444) },
- { FRAC_CONST(0.572982908710149), FRAC_CONST(0.819567316531142) },
- { FRAC_CONST(0.570465815052013), FRAC_CONST(0.821321346281127) },
- { FRAC_CONST(0.567943351952366), FRAC_CONST(0.823067645441802) },
- { FRAC_CONST(0.565415543153590), FRAC_CONST(0.824806197576334) },
- { FRAC_CONST(0.562882412448385), FRAC_CONST(0.826536986320810) },
- { FRAC_CONST(0.560343983679541), FRAC_CONST(0.828259995384386) },
- { FRAC_CONST(0.557800280739717), FRAC_CONST(0.829975208549444) },
- { FRAC_CONST(0.555251327571214), FRAC_CONST(0.831682609671745) },
- { FRAC_CONST(0.552697148165750), FRAC_CONST(0.833382182680580) },
- { FRAC_CONST(0.550137766564234), FRAC_CONST(0.835073911578919) },
- { FRAC_CONST(0.547573206856540), FRAC_CONST(0.836757780443567) },
- { FRAC_CONST(0.545003493181281), FRAC_CONST(0.838433773425308) },
- { FRAC_CONST(0.542428649725581), FRAC_CONST(0.840101874749058) },
- { FRAC_CONST(0.539848700724848), FRAC_CONST(0.841762068714012) },
- { FRAC_CONST(0.537263670462543), FRAC_CONST(0.843414339693793) },
- { FRAC_CONST(0.534673583269956), FRAC_CONST(0.845058672136595) },
- { FRAC_CONST(0.532078463525974), FRAC_CONST(0.846695050565337) },
- { FRAC_CONST(0.529478335656852), FRAC_CONST(0.848323459577802) },
- { FRAC_CONST(0.526873224135985), FRAC_CONST(0.849943883846782) },
- { FRAC_CONST(0.524263153483673), FRAC_CONST(0.851556308120229) },
- { FRAC_CONST(0.521648148266897), FRAC_CONST(0.853160717221390) },
- { FRAC_CONST(0.519028233099081), FRAC_CONST(0.854757096048957) },
- { FRAC_CONST(0.516403432639864), FRAC_CONST(0.856345429577204) },
- { FRAC_CONST(0.513773771594868), FRAC_CONST(0.857925702856130) },
- { FRAC_CONST(0.511139274715464), FRAC_CONST(0.859497901011602) },
- { FRAC_CONST(0.508499966798541), FRAC_CONST(0.861062009245491) },
- { FRAC_CONST(0.505855872686269), FRAC_CONST(0.862618012835817) },
- { FRAC_CONST(0.503207017265869), FRAC_CONST(0.864165897136879) },
- { FRAC_CONST(0.500553425469378), FRAC_CONST(0.865705647579402) },
- { FRAC_CONST(0.497895122273411), FRAC_CONST(0.867237249670668) },
- { FRAC_CONST(0.495232132698931), FRAC_CONST(0.868760688994655) },
- { FRAC_CONST(0.492564481811011), FRAC_CONST(0.870275951212172) },
- { FRAC_CONST(0.489892194718595), FRAC_CONST(0.871783022060993) },
- { FRAC_CONST(0.487215296574269), FRAC_CONST(0.873281887355994) },
- { FRAC_CONST(0.484533812574016), FRAC_CONST(0.874772532989284) },
- { FRAC_CONST(0.481847767956986), FRAC_CONST(0.876254944930338) },
- { FRAC_CONST(0.479157188005253), FRAC_CONST(0.877729109226132) },
- { FRAC_CONST(0.476462098043581), FRAC_CONST(0.879195012001267) },
- { FRAC_CONST(0.473762523439183), FRAC_CONST(0.880652639458111) },
- { FRAC_CONST(0.471058489601483), FRAC_CONST(0.882101977876918) },
- { FRAC_CONST(0.468350021981877), FRAC_CONST(0.883543013615962) },
- { FRAC_CONST(0.465637146073494), FRAC_CONST(0.884975733111667) },
- { FRAC_CONST(0.462919887410955), FRAC_CONST(0.886400122878730) },
- { FRAC_CONST(0.460198271570134), FRAC_CONST(0.887816169510255) },
- { FRAC_CONST(0.457472324167916), FRAC_CONST(0.889223859677868) },
- { FRAC_CONST(0.454742070861955), FRAC_CONST(0.890623180131856) },
- { FRAC_CONST(0.452007537350437), FRAC_CONST(0.892014117701280) },
- { FRAC_CONST(0.449268749371830), FRAC_CONST(0.893396659294108) },
- { FRAC_CONST(0.446525732704651), FRAC_CONST(0.894770791897330) },
- { FRAC_CONST(0.443778513167218), FRAC_CONST(0.896136502577087) },
- { FRAC_CONST(0.441027116617407), FRAC_CONST(0.897493778478790) },
- { FRAC_CONST(0.438271568952410), FRAC_CONST(0.898842606827242) },
- { FRAC_CONST(0.435511896108492), FRAC_CONST(0.900182974926757) },
- { FRAC_CONST(0.432748124060744), FRAC_CONST(0.901514870161279) },
- { FRAC_CONST(0.429980278822841), FRAC_CONST(0.902838279994503) },
- { FRAC_CONST(0.427208386446796), FRAC_CONST(0.904153191969992) },
- { FRAC_CONST(0.424432473022717), FRAC_CONST(0.905459593711293) },
- { FRAC_CONST(0.421652564678558), FRAC_CONST(0.906757472922057) },
- { FRAC_CONST(0.418868687579875), FRAC_CONST(0.908046817386148) },
- { FRAC_CONST(0.416080867929579), FRAC_CONST(0.909327614967767) },
- { FRAC_CONST(0.413289131967691), FRAC_CONST(0.910599853611559) },
- { FRAC_CONST(0.410493505971093), FRAC_CONST(0.911863521342729) },
- { FRAC_CONST(0.407694016253280), FRAC_CONST(0.913118606267154) },
- { FRAC_CONST(0.404890689164118), FRAC_CONST(0.914365096571498) },
- { FRAC_CONST(0.402083551089587), FRAC_CONST(0.915602980523320) },
- { FRAC_CONST(0.399272628451541), FRAC_CONST(0.916832246471184) },
- { FRAC_CONST(0.396457947707454), FRAC_CONST(0.918052882844770) },
- { FRAC_CONST(0.393639535350173), FRAC_CONST(0.919264878154985) },
- { FRAC_CONST(0.390817417907669), FRAC_CONST(0.920468220994067) },
- { FRAC_CONST(0.387991621942785), FRAC_CONST(0.921662900035695) },
- { FRAC_CONST(0.385162174052990), FRAC_CONST(0.922848904035094) },
- { FRAC_CONST(0.382329100870125), FRAC_CONST(0.924026221829144) },
- { FRAC_CONST(0.379492429060153), FRAC_CONST(0.925194842336480) },
- { FRAC_CONST(0.376652185322910), FRAC_CONST(0.926354754557603) },
- { FRAC_CONST(0.373808396391851), FRAC_CONST(0.927505947574975) },
- { FRAC_CONST(0.370961089033802), FRAC_CONST(0.928648410553131) },
- { FRAC_CONST(0.368110290048703), FRAC_CONST(0.929782132738772) },
- { FRAC_CONST(0.365256026269360), FRAC_CONST(0.930907103460875) },
- { FRAC_CONST(0.362398324561191), FRAC_CONST(0.932023312130786) },
- { FRAC_CONST(0.359537211821973), FRAC_CONST(0.933130748242325) },
- { FRAC_CONST(0.356672714981588), FRAC_CONST(0.934229401371881) },
- { FRAC_CONST(0.353804861001772), FRAC_CONST(0.935319261178512) },
- { FRAC_CONST(0.350933676875858), FRAC_CONST(0.936400317404042) },
- { FRAC_CONST(0.348059189628526), FRAC_CONST(0.937472559873159) },
- { FRAC_CONST(0.345181426315543), FRAC_CONST(0.938535978493509) },
- { FRAC_CONST(0.342300414023514), FRAC_CONST(0.939590563255789) },
- { FRAC_CONST(0.339416179869623), FRAC_CONST(0.940636304233848) },
- { FRAC_CONST(0.336528751001382), FRAC_CONST(0.941673191584771) },
- { FRAC_CONST(0.333638154596371), FRAC_CONST(0.942701215548982) },
- { FRAC_CONST(0.330744417861983), FRAC_CONST(0.943720366450326) },
- { FRAC_CONST(0.327847568035171), FRAC_CONST(0.944730634696168) },
- { FRAC_CONST(0.324947632382188), FRAC_CONST(0.945732010777477) },
- { FRAC_CONST(0.322044638198335), FRAC_CONST(0.946724485268921) },
- { FRAC_CONST(0.319138612807696), FRAC_CONST(0.947708048828952) },
- { FRAC_CONST(0.316229583562890), FRAC_CONST(0.948682692199895) },
- { FRAC_CONST(0.313317577844809), FRAC_CONST(0.949648406208035) },
- { FRAC_CONST(0.310402623062359), FRAC_CONST(0.950605181763705) },
- { FRAC_CONST(0.307484746652204), FRAC_CONST(0.951553009861369) },
- { FRAC_CONST(0.304563976078509), FRAC_CONST(0.952491881579706) },
- { FRAC_CONST(0.301640338832679), FRAC_CONST(0.953421788081700) },
- { FRAC_CONST(0.298713862433100), FRAC_CONST(0.954342720614716) },
- { FRAC_CONST(0.295784574424884), FRAC_CONST(0.955254670510587) },
- { FRAC_CONST(0.292852502379605), FRAC_CONST(0.956157629185692) },
- { FRAC_CONST(0.289917673895041), FRAC_CONST(0.957051588141041) },
- { FRAC_CONST(0.286980116594916), FRAC_CONST(0.957936538962351) },
- { FRAC_CONST(0.284039858128637), FRAC_CONST(0.958812473320129) },
- { FRAC_CONST(0.281096926171038), FRAC_CONST(0.959679382969747) },
- { FRAC_CONST(0.278151348422115), FRAC_CONST(0.960537259751520) },
- { FRAC_CONST(0.275203152606767), FRAC_CONST(0.961386095590786) },
- { FRAC_CONST(0.272252366474537), FRAC_CONST(0.962225882497979) },
- { FRAC_CONST(0.269299017799346), FRAC_CONST(0.963056612568704) },
- { FRAC_CONST(0.266343134379238), FRAC_CONST(0.963878277983814) },
- { FRAC_CONST(0.263384744036113), FRAC_CONST(0.964690871009481) },
- { FRAC_CONST(0.260423874615468), FRAC_CONST(0.965494383997270) },
- { FRAC_CONST(0.257460553986133), FRAC_CONST(0.966288809384210) },
- { FRAC_CONST(0.254494810040011), FRAC_CONST(0.967074139692867) },
- { FRAC_CONST(0.251526670691813), FRAC_CONST(0.967850367531414) },
- { FRAC_CONST(0.248556163878797), FRAC_CONST(0.968617485593698) },
- { FRAC_CONST(0.245583317560504), FRAC_CONST(0.969375486659311) },
- { FRAC_CONST(0.242608159718497), FRAC_CONST(0.970124363593660) },
- { FRAC_CONST(0.239630718356094), FRAC_CONST(0.970864109348029) },
- { FRAC_CONST(0.236651021498106), FRAC_CONST(0.971594716959650) },
- { FRAC_CONST(0.233669097190577), FRAC_CONST(0.972316179551765) },
- { FRAC_CONST(0.230684973500512), FRAC_CONST(0.973028490333694) },
- { FRAC_CONST(0.227698678515621), FRAC_CONST(0.973731642600896) },
- { FRAC_CONST(0.224710240344050), FRAC_CONST(0.974425629735035) },
- { FRAC_CONST(0.221719687114115), FRAC_CONST(0.975110445204039) },
- { FRAC_CONST(0.218727046974045), FRAC_CONST(0.975786082562164) },
- { FRAC_CONST(0.215732348091706), FRAC_CONST(0.976452535450054) },
- { FRAC_CONST(0.212735618654346), FRAC_CONST(0.977109797594801) },
- { FRAC_CONST(0.209736886868323), FRAC_CONST(0.977757862810003) },
- { FRAC_CONST(0.206736180958844), FRAC_CONST(0.978396724995823) },
- { FRAC_CONST(0.203733529169694), FRAC_CONST(0.979026378139048) },
- { FRAC_CONST(0.200728959762976), FRAC_CONST(0.979646816313141) },
- { FRAC_CONST(0.197722501018842), FRAC_CONST(0.980258033678304) },
- { FRAC_CONST(0.194714181235226), FRAC_CONST(0.980860024481524) },
- { FRAC_CONST(0.191704028727580), FRAC_CONST(0.981452783056636) },
- { FRAC_CONST(0.188692071828605), FRAC_CONST(0.982036303824369) },
- { FRAC_CONST(0.185678338887988), FRAC_CONST(0.982610581292405) },
- { FRAC_CONST(0.182662858272129), FRAC_CONST(0.983175610055424) },
- { FRAC_CONST(0.179645658363882), FRAC_CONST(0.983731384795162) },
- { FRAC_CONST(0.176626767562281), FRAC_CONST(0.984277900280454) },
- { FRAC_CONST(0.173606214282275), FRAC_CONST(0.984815151367289) },
- { FRAC_CONST(0.170584026954464), FRAC_CONST(0.985343132998855) },
- { FRAC_CONST(0.167560234024824), FRAC_CONST(0.985861840205587) },
- { FRAC_CONST(0.164534863954446), FRAC_CONST(0.986371268105216) },
- { FRAC_CONST(0.161507945219266), FRAC_CONST(0.986871411902812) },
- { FRAC_CONST(0.158479506309796), FRAC_CONST(0.987362266890832) },
- { FRAC_CONST(0.155449575730856), FRAC_CONST(0.987843828449162) },
- { FRAC_CONST(0.152418182001307), FRAC_CONST(0.988316092045160) },
- { FRAC_CONST(0.149385353653780), FRAC_CONST(0.988779053233702) },
- { FRAC_CONST(0.146351119234411), FRAC_CONST(0.989232707657220) },
- { FRAC_CONST(0.143315507302572), FRAC_CONST(0.989677051045747) },
- { FRAC_CONST(0.140278546430595), FRAC_CONST(0.990112079216954) },
- { FRAC_CONST(0.137240265203516), FRAC_CONST(0.990537788076189) },
- { FRAC_CONST(0.134200692218792), FRAC_CONST(0.990954173616519) },
- { FRAC_CONST(0.131159856086043), FRAC_CONST(0.991361231918763) },
- { FRAC_CONST(0.128117785426777), FRAC_CONST(0.991758959151536) },
- { FRAC_CONST(0.125074508874121), FRAC_CONST(0.992147351571276) },
- { FRAC_CONST(0.122030055072553), FRAC_CONST(0.992526405522286) },
- { FRAC_CONST(0.118984452677633), FRAC_CONST(0.992896117436766) },
- { FRAC_CONST(0.115937730355728), FRAC_CONST(0.993256483834846) },
- { FRAC_CONST(0.112889916783750), FRAC_CONST(0.993607501324622) },
- { FRAC_CONST(0.109841040648883), FRAC_CONST(0.993949166602181) },
- { FRAC_CONST(0.106791130648307), FRAC_CONST(0.994281476451642) },
- { FRAC_CONST(0.103740215488939), FRAC_CONST(0.994604427745176) },
- { FRAC_CONST(0.100688323887154), FRAC_CONST(0.994918017443043) },
- { FRAC_CONST(0.097635484568517), FRAC_CONST(0.995222242593618) },
- { FRAC_CONST(0.094581726267515), FRAC_CONST(0.995517100333418) },
- { FRAC_CONST(0.091527077727285), FRAC_CONST(0.995802587887129) },
- { FRAC_CONST(0.088471567699341), FRAC_CONST(0.996078702567634) },
- { FRAC_CONST(0.085415224943307), FRAC_CONST(0.996345441776036) },
- { FRAC_CONST(0.082358078226647), FRAC_CONST(0.996602803001684) },
- { FRAC_CONST(0.079300156324388), FRAC_CONST(0.996850783822197) },
- { FRAC_CONST(0.076241488018856), FRAC_CONST(0.997089381903483) },
- { FRAC_CONST(0.073182102099403), FRAC_CONST(0.997318594999769) },
- { FRAC_CONST(0.070122027362134), FRAC_CONST(0.997538420953611) },
- { FRAC_CONST(0.067061292609637), FRAC_CONST(0.997748857695926) },
- { FRAC_CONST(0.063999926650714), FRAC_CONST(0.997949903246001) },
- { FRAC_CONST(0.060937958300107), FRAC_CONST(0.998141555711521) },
- { FRAC_CONST(0.057875416378229), FRAC_CONST(0.998323813288578) },
- { FRAC_CONST(0.054812329710890), FRAC_CONST(0.998496674261695) },
- { FRAC_CONST(0.051748727129028), FRAC_CONST(0.998660137003838) },
- { FRAC_CONST(0.048684637468439), FRAC_CONST(0.998814199976435) },
- { FRAC_CONST(0.045620089569500), FRAC_CONST(0.998958861729386) },
- { FRAC_CONST(0.042555112276904), FRAC_CONST(0.999094120901079) },
- { FRAC_CONST(0.039489734439384), FRAC_CONST(0.999219976218404) },
- { FRAC_CONST(0.036423984909444), FRAC_CONST(0.999336426496761) },
- { FRAC_CONST(0.033357892543086), FRAC_CONST(0.999443470640078) },
- { FRAC_CONST(0.030291486199539), FRAC_CONST(0.999541107640813) },
- { FRAC_CONST(0.027224794740988), FRAC_CONST(0.999629336579970) },
- { FRAC_CONST(0.024157847032300), FRAC_CONST(0.999708156627105) },
- { FRAC_CONST(0.021090671940755), FRAC_CONST(0.999777567040333) },
- { FRAC_CONST(0.018023298335774), FRAC_CONST(0.999837567166337) },
- { FRAC_CONST(0.014955755088644), FRAC_CONST(0.999888156440373) },
- { FRAC_CONST(0.011888071072252), FRAC_CONST(0.999929334386276) },
- { FRAC_CONST(0.008820275160808), FRAC_CONST(0.999961100616463) },
- { FRAC_CONST(0.005752396229574), FRAC_CONST(0.999983454831938) },
- { FRAC_CONST(0.002684463154596), FRAC_CONST(0.999996396822294) }
- };
+/* 256 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_2048[] =
+{
+ { FRAC_CONST(0.999999926465718), FRAC_CONST(0.000383495187571) },
+ { FRAC_CONST(0.999994043728986), FRAC_CONST(0.003451449920136) },
+ { FRAC_CONST(0.999978748667469), FRAC_CONST(0.006519372166339) },
+ { FRAC_CONST(0.999954041425130), FRAC_CONST(0.009587233049729) },
+ { FRAC_CONST(0.999919922234523), FRAC_CONST(0.012655003694430) },
+ { FRAC_CONST(0.999876391416790), FRAC_CONST(0.015722655225417) },
+ { FRAC_CONST(0.999823449381662), FRAC_CONST(0.018790158768785) },
+ { FRAC_CONST(0.999761096627447), FRAC_CONST(0.021857485452022) },
+ { FRAC_CONST(0.999689333741034), FRAC_CONST(0.024924606404281) },
+ { FRAC_CONST(0.999608161397882), FRAC_CONST(0.027991492756653) },
+ { FRAC_CONST(0.999517580362017), FRAC_CONST(0.031058115642435) },
+ { FRAC_CONST(0.999417591486022), FRAC_CONST(0.034124446197403) },
+ { FRAC_CONST(0.999308195711029), FRAC_CONST(0.037190455560088) },
+ { FRAC_CONST(0.999189394066715), FRAC_CONST(0.040256114872041) },
+ { FRAC_CONST(0.999061187671285), FRAC_CONST(0.043321395278110) },
+ { FRAC_CONST(0.998923577731466), FRAC_CONST(0.046386267926707) },
+ { FRAC_CONST(0.998776565542496), FRAC_CONST(0.049450703970085) },
+ { FRAC_CONST(0.998620152488109), FRAC_CONST(0.052514674564603) },
+ { FRAC_CONST(0.998454340040525), FRAC_CONST(0.055578150871005) },
+ { FRAC_CONST(0.998279129760433), FRAC_CONST(0.058641104054683) },
+ { FRAC_CONST(0.998094523296980), FRAC_CONST(0.061703505285957) },
+ { FRAC_CONST(0.997900522387752), FRAC_CONST(0.064765325740340) },
+ { FRAC_CONST(0.997697128858759), FRAC_CONST(0.067826536598811) },
+ { FRAC_CONST(0.997484344624418), FRAC_CONST(0.070887109048088) },
+ { FRAC_CONST(0.997262171687536), FRAC_CONST(0.073947014280897) },
+ { FRAC_CONST(0.997030612139289), FRAC_CONST(0.077006223496246) },
+ { FRAC_CONST(0.996789668159205), FRAC_CONST(0.080064707899691) },
+ { FRAC_CONST(0.996539342015138), FRAC_CONST(0.083122438703613) },
+ { FRAC_CONST(0.996279636063255), FRAC_CONST(0.086179387127485) },
+ { FRAC_CONST(0.996010552748006), FRAC_CONST(0.089235524398144) },
+ { FRAC_CONST(0.995732094602106), FRAC_CONST(0.092290821750062) },
+ { FRAC_CONST(0.995444264246510), FRAC_CONST(0.095345250425618) },
+ { FRAC_CONST(0.995147064390386), FRAC_CONST(0.098398781675364) },
+ { FRAC_CONST(0.994840497831093), FRAC_CONST(0.101451386758302) },
+ { FRAC_CONST(0.994524567454152), FRAC_CONST(0.104503036942151) },
+ { FRAC_CONST(0.994199276233219), FRAC_CONST(0.107553703503616) },
+ { FRAC_CONST(0.993864627230060), FRAC_CONST(0.110603357728662) },
+ { FRAC_CONST(0.993520623594518), FRAC_CONST(0.113651970912782) },
+ { FRAC_CONST(0.993167268564487), FRAC_CONST(0.116699514361268) },
+ { FRAC_CONST(0.992804565465879), FRAC_CONST(0.119745959389480) },
+ { FRAC_CONST(0.992432517712594), FRAC_CONST(0.122791277323117) },
+ { FRAC_CONST(0.992051128806486), FRAC_CONST(0.125835439498487) },
+ { FRAC_CONST(0.991660402337333), FRAC_CONST(0.128878417262777) },
+ { FRAC_CONST(0.991260341982802), FRAC_CONST(0.131920181974320) },
+ { FRAC_CONST(0.990850951508414), FRAC_CONST(0.134960705002869) },
+ { FRAC_CONST(0.990432234767506), FRAC_CONST(0.137999957729863) },
+ { FRAC_CONST(0.990004195701201), FRAC_CONST(0.141037911548698) },
+ { FRAC_CONST(0.989566838338365), FRAC_CONST(0.144074537864995) },
+ { FRAC_CONST(0.989120166795573), FRAC_CONST(0.147109808096872) },
+ { FRAC_CONST(0.988664185277066), FRAC_CONST(0.150143693675208) },
+ { FRAC_CONST(0.988198898074718), FRAC_CONST(0.153176166043918) },
+ { FRAC_CONST(0.987724309567987), FRAC_CONST(0.156207196660216) },
+ { FRAC_CONST(0.987240424223882), FRAC_CONST(0.159236756994888) },
+ { FRAC_CONST(0.986747246596917), FRAC_CONST(0.162264818532558) },
+ { FRAC_CONST(0.986244781329065), FRAC_CONST(0.165291352771958) },
+ { FRAC_CONST(0.985733033149723), FRAC_CONST(0.168316331226195) },
+ { FRAC_CONST(0.985212006875659), FRAC_CONST(0.171339725423019) },
+ { FRAC_CONST(0.984681707410971), FRAC_CONST(0.174361506905094) },
+ { FRAC_CONST(0.984142139747039), FRAC_CONST(0.177381647230260) },
+ { FRAC_CONST(0.983593308962479), FRAC_CONST(0.180400117971807) },
+ { FRAC_CONST(0.983035220223096), FRAC_CONST(0.183416890718739) },
+ { FRAC_CONST(0.982467878781833), FRAC_CONST(0.186431937076042) },
+ { FRAC_CONST(0.981891289978725), FRAC_CONST(0.189445228664950) },
+ { FRAC_CONST(0.981305459240845), FRAC_CONST(0.192456737123217) },
+ { FRAC_CONST(0.980710392082254), FRAC_CONST(0.195466434105377) },
+ { FRAC_CONST(0.980106094103952), FRAC_CONST(0.198474291283016) },
+ { FRAC_CONST(0.979492570993821), FRAC_CONST(0.201480280345038) },
+ { FRAC_CONST(0.978869828526574), FRAC_CONST(0.204484372997927) },
+ { FRAC_CONST(0.978237872563701), FRAC_CONST(0.207486540966021) },
+ { FRAC_CONST(0.977596709053412), FRAC_CONST(0.210486755991770) },
+ { FRAC_CONST(0.976946344030582), FRAC_CONST(0.213484989836008) },
+ { FRAC_CONST(0.976286783616694), FRAC_CONST(0.216481214278217) },
+ { FRAC_CONST(0.975618034019782), FRAC_CONST(0.219475401116790) },
+ { FRAC_CONST(0.974940101534372), FRAC_CONST(0.222467522169302) },
+ { FRAC_CONST(0.974252992541423), FRAC_CONST(0.225457549272769) },
+ { FRAC_CONST(0.973556713508266), FRAC_CONST(0.228445454283916) },
+ { FRAC_CONST(0.972851270988544), FRAC_CONST(0.231431209079446) },
+ { FRAC_CONST(0.972136671622152), FRAC_CONST(0.234414785556295) },
+ { FRAC_CONST(0.971412922135171), FRAC_CONST(0.237396155631907) },
+ { FRAC_CONST(0.970680029339806), FRAC_CONST(0.240375291244489) },
+ { FRAC_CONST(0.969938000134324), FRAC_CONST(0.243352164353285) },
+ { FRAC_CONST(0.969186841502986), FRAC_CONST(0.246326746938829) },
+ { FRAC_CONST(0.968426560515983), FRAC_CONST(0.249299011003218) },
+ { FRAC_CONST(0.967657164329370), FRAC_CONST(0.252268928570371) },
+ { FRAC_CONST(0.966878660184996), FRAC_CONST(0.255236471686292) },
+ { FRAC_CONST(0.966091055410439), FRAC_CONST(0.258201612419335) },
+ { FRAC_CONST(0.965294357418935), FRAC_CONST(0.261164322860466) },
+ { FRAC_CONST(0.964488573709308), FRAC_CONST(0.264124575123528) },
+ { FRAC_CONST(0.963673711865903), FRAC_CONST(0.267082341345496) },
+ { FRAC_CONST(0.962849779558509), FRAC_CONST(0.270037593686751) },
+ { FRAC_CONST(0.962016784542291), FRAC_CONST(0.272990304331330) },
+ { FRAC_CONST(0.961174734657714), FRAC_CONST(0.275940445487197) },
+ { FRAC_CONST(0.960323637830474), FRAC_CONST(0.278887989386500) },
+ { FRAC_CONST(0.959463502071418), FRAC_CONST(0.281832908285833) },
+ { FRAC_CONST(0.958594335476470), FRAC_CONST(0.284775174466498) },
+ { FRAC_CONST(0.957716146226559), FRAC_CONST(0.287714760234765) },
+ { FRAC_CONST(0.956828942587535), FRAC_CONST(0.290651637922133) },
+ { FRAC_CONST(0.955932732910098), FRAC_CONST(0.293585779885591) },
+ { FRAC_CONST(0.955027525629714), FRAC_CONST(0.296517158507877) },
+ { FRAC_CONST(0.954113329266539), FRAC_CONST(0.299445746197740) },
+ { FRAC_CONST(0.953190152425337), FRAC_CONST(0.302371515390196) },
+ { FRAC_CONST(0.952258003795400), FRAC_CONST(0.305294438546792) },
+ { FRAC_CONST(0.951316892150466), FRAC_CONST(0.308214488155861) },
+ { FRAC_CONST(0.950366826348636), FRAC_CONST(0.311131636732785) },
+ { FRAC_CONST(0.949407815332292), FRAC_CONST(0.314045856820251) },
+ { FRAC_CONST(0.948439868128010), FRAC_CONST(0.316957120988508) },
+ { FRAC_CONST(0.947462993846478), FRAC_CONST(0.319865401835631) },
+ { FRAC_CONST(0.946477201682409), FRAC_CONST(0.322770671987771) },
+ { FRAC_CONST(0.945482500914454), FRAC_CONST(0.325672904099420) },
+ { FRAC_CONST(0.944478900905116), FRAC_CONST(0.328572070853664) },
+ { FRAC_CONST(0.943466411100659), FRAC_CONST(0.331468144962441) },
+ { FRAC_CONST(0.942445041031025), FRAC_CONST(0.334361099166799) },
+ { FRAC_CONST(0.941414800309736), FRAC_CONST(0.337250906237151) },
+ { FRAC_CONST(0.940375698633812), FRAC_CONST(0.340137538973532) },
+ { FRAC_CONST(0.939327745783671), FRAC_CONST(0.343020970205856) },
+ { FRAC_CONST(0.938270951623047), FRAC_CONST(0.345901172794169) },
+ { FRAC_CONST(0.937205326098888), FRAC_CONST(0.348778119628908) },
+ { FRAC_CONST(0.936130879241267), FRAC_CONST(0.351651783631155) },
+ { FRAC_CONST(0.935047621163287), FRAC_CONST(0.354522137752887) },
+ { FRAC_CONST(0.933955562060987), FRAC_CONST(0.357389154977241) },
+ { FRAC_CONST(0.932854712213241), FRAC_CONST(0.360252808318757) },
+ { FRAC_CONST(0.931745081981669), FRAC_CONST(0.363113070823639) },
+ { FRAC_CONST(0.930626681810532), FRAC_CONST(0.365969915570009) },
+ { FRAC_CONST(0.929499522226639), FRAC_CONST(0.368823315668154) },
+ { FRAC_CONST(0.928363613839244), FRAC_CONST(0.371673244260787) },
+ { FRAC_CONST(0.927218967339952), FRAC_CONST(0.374519674523293) },
+ { FRAC_CONST(0.926065593502609), FRAC_CONST(0.377362579663988) },
+ { FRAC_CONST(0.924903503183211), FRAC_CONST(0.380201932924366) },
+ { FRAC_CONST(0.923732707319793), FRAC_CONST(0.383037707579352) },
+ { FRAC_CONST(0.922553216932333), FRAC_CONST(0.385869876937555) },
+ { FRAC_CONST(0.921365043122642), FRAC_CONST(0.388698414341519) },
+ { FRAC_CONST(0.920168197074266), FRAC_CONST(0.391523293167972) },
+ { FRAC_CONST(0.918962690052376), FRAC_CONST(0.394344486828080) },
+ { FRAC_CONST(0.917748533403661), FRAC_CONST(0.397161968767692) },
+ { FRAC_CONST(0.916525738556228), FRAC_CONST(0.399975712467595) },
+ { FRAC_CONST(0.915294317019487), FRAC_CONST(0.402785691443764) },
+ { FRAC_CONST(0.914054280384047), FRAC_CONST(0.405591879247604) },
+ { FRAC_CONST(0.912805640321604), FRAC_CONST(0.408394249466208) },
+ { FRAC_CONST(0.911548408584834), FRAC_CONST(0.411192775722600) },
+ { FRAC_CONST(0.910282597007282), FRAC_CONST(0.413987431675985) },
+ { FRAC_CONST(0.909008217503247), FRAC_CONST(0.416778191021998) },
+ { FRAC_CONST(0.907725282067676), FRAC_CONST(0.419565027492947) },
+ { FRAC_CONST(0.906433802776045), FRAC_CONST(0.422347914858067) },
+ { FRAC_CONST(0.905133791784250), FRAC_CONST(0.425126826923762) },
+ { FRAC_CONST(0.903825261328488), FRAC_CONST(0.427901737533854) },
+ { FRAC_CONST(0.902508223725146), FRAC_CONST(0.430672620569827) },
+ { FRAC_CONST(0.901182691370685), FRAC_CONST(0.433439449951074) },
+ { FRAC_CONST(0.899848676741519), FRAC_CONST(0.436202199635144) },
+ { FRAC_CONST(0.898506192393902), FRAC_CONST(0.438960843617984) },
+ { FRAC_CONST(0.897155250963809), FRAC_CONST(0.441715355934187) },
+ { FRAC_CONST(0.895795865166814), FRAC_CONST(0.444465710657234) },
+ { FRAC_CONST(0.894428047797974), FRAC_CONST(0.447211881899738) },
+ { FRAC_CONST(0.893051811731707), FRAC_CONST(0.449953843813691) },
+ { FRAC_CONST(0.891667169921672), FRAC_CONST(0.452691570590701) },
+ { FRAC_CONST(0.890274135400645), FRAC_CONST(0.455425036462242) },
+ { FRAC_CONST(0.888872721280396), FRAC_CONST(0.458154215699893) },
+ { FRAC_CONST(0.887462940751569), FRAC_CONST(0.460879082615579) },
+ { FRAC_CONST(0.886044807083556), FRAC_CONST(0.463599611561814) },
+ { FRAC_CONST(0.884618333624370), FRAC_CONST(0.466315776931944) },
+ { FRAC_CONST(0.883183533800523), FRAC_CONST(0.469027553160387) },
+ { FRAC_CONST(0.881740421116898), FRAC_CONST(0.471734914722871) },
+ { FRAC_CONST(0.880289009156621), FRAC_CONST(0.474437836136679) },
+ { FRAC_CONST(0.878829311580933), FRAC_CONST(0.477136291960885) },
+ { FRAC_CONST(0.877361342129065), FRAC_CONST(0.479830256796594) },
+ { FRAC_CONST(0.875885114618104), FRAC_CONST(0.482519705287184) },
+ { FRAC_CONST(0.874400642942865), FRAC_CONST(0.485204612118542) },
+ { FRAC_CONST(0.872907941075761), FRAC_CONST(0.487884952019301) },
+ { FRAC_CONST(0.871407023066671), FRAC_CONST(0.490560699761082) },
+ { FRAC_CONST(0.869897903042806), FRAC_CONST(0.493231830158728) },
+ { FRAC_CONST(0.868380595208580), FRAC_CONST(0.495898318070542) },
+ { FRAC_CONST(0.866855113845470), FRAC_CONST(0.498560138398525) },
+ { FRAC_CONST(0.865321473311890), FRAC_CONST(0.501217266088610) },
+ { FRAC_CONST(0.863779688043047), FRAC_CONST(0.503869676130899) },
+ { FRAC_CONST(0.862229772550811), FRAC_CONST(0.506517343559899) },
+ { FRAC_CONST(0.860671741423578), FRAC_CONST(0.509160243454755) },
+ { FRAC_CONST(0.859105609326130), FRAC_CONST(0.511798350939487) },
+ { FRAC_CONST(0.857531390999499), FRAC_CONST(0.514431641183223) },
+ { FRAC_CONST(0.855949101260827), FRAC_CONST(0.517060089400432) },
+ { FRAC_CONST(0.854358755003227), FRAC_CONST(0.519683670851158) },
+ { FRAC_CONST(0.852760367195645), FRAC_CONST(0.522302360841255) },
+ { FRAC_CONST(0.851153952882715), FRAC_CONST(0.524916134722613) },
+ { FRAC_CONST(0.849539527184621), FRAC_CONST(0.527524967893398) },
+ { FRAC_CONST(0.847917105296951), FRAC_CONST(0.530128835798279) },
+ { FRAC_CONST(0.846286702490560), FRAC_CONST(0.532727713928659) },
+ { FRAC_CONST(0.844648334111418), FRAC_CONST(0.535321577822907) },
+ { FRAC_CONST(0.843002015580473), FRAC_CONST(0.537910403066589) },
+ { FRAC_CONST(0.841347762393502), FRAC_CONST(0.540494165292695) },
+ { FRAC_CONST(0.839685590120966), FRAC_CONST(0.543072840181872) },
+ { FRAC_CONST(0.838015514407864), FRAC_CONST(0.545646403462649) },
+ { FRAC_CONST(0.836337550973584), FRAC_CONST(0.548214830911668) },
+ { FRAC_CONST(0.834651715611756), FRAC_CONST(0.550778098353912) },
+ { FRAC_CONST(0.832958024190107), FRAC_CONST(0.553336181662932) },
+ { FRAC_CONST(0.831256492650303), FRAC_CONST(0.555889056761074) },
+ { FRAC_CONST(0.829547137007809), FRAC_CONST(0.558436699619704) },
+ { FRAC_CONST(0.827829973351730), FRAC_CONST(0.560979086259438) },
+ { FRAC_CONST(0.826105017844665), FRAC_CONST(0.563516192750365) },
+ { FRAC_CONST(0.824372286722551), FRAC_CONST(0.566047995212271) },
+ { FRAC_CONST(0.822631796294515), FRAC_CONST(0.568574469814869) },
+ { FRAC_CONST(0.820883562942715), FRAC_CONST(0.571095592778017) },
+ { FRAC_CONST(0.819127603122188), FRAC_CONST(0.573611340371945) },
+ { FRAC_CONST(0.817363933360698), FRAC_CONST(0.576121688917478) },
+ { FRAC_CONST(0.815592570258577), FRAC_CONST(0.578626614786261) },
+ { FRAC_CONST(0.813813530488567), FRAC_CONST(0.581126094400978) },
+ { FRAC_CONST(0.812026830795670), FRAC_CONST(0.583620104235573) },
+ { FRAC_CONST(0.810232487996982), FRAC_CONST(0.586108620815476) },
+ { FRAC_CONST(0.808430518981543), FRAC_CONST(0.588591620717823) },
+ { FRAC_CONST(0.806620940710170), FRAC_CONST(0.591069080571671) },
+ { FRAC_CONST(0.804803770215303), FRAC_CONST(0.593540977058226) },
+ { FRAC_CONST(0.802979024600843), FRAC_CONST(0.596007286911057) },
+ { FRAC_CONST(0.801146721041991), FRAC_CONST(0.598467986916314) },
+ { FRAC_CONST(0.799306876785086), FRAC_CONST(0.600923053912954) },
+ { FRAC_CONST(0.797459509147442), FRAC_CONST(0.603372464792950) },
+ { FRAC_CONST(0.795604635517188), FRAC_CONST(0.605816196501515) },
+ { FRAC_CONST(0.793742273353100), FRAC_CONST(0.608254226037314) },
+ { FRAC_CONST(0.791872440184440), FRAC_CONST(0.610686530452686) },
+ { FRAC_CONST(0.789995153610791), FRAC_CONST(0.613113086853855) },
+ { FRAC_CONST(0.788110431301888), FRAC_CONST(0.615533872401147) },
+ { FRAC_CONST(0.786218290997456), FRAC_CONST(0.617948864309208) },
+ { FRAC_CONST(0.784318750507039), FRAC_CONST(0.620358039847214) },
+ { FRAC_CONST(0.782411827709837), FRAC_CONST(0.622761376339086) },
+ { FRAC_CONST(0.780497540554532), FRAC_CONST(0.625158851163708) },
+ { FRAC_CONST(0.778575907059125), FRAC_CONST(0.627550441755132) },
+ { FRAC_CONST(0.776646945310762), FRAC_CONST(0.629936125602796) },
+ { FRAC_CONST(0.774710673465566), FRAC_CONST(0.632315880251738) },
+ { FRAC_CONST(0.772767109748464), FRAC_CONST(0.634689683302798) },
+ { FRAC_CONST(0.770816272453019), FRAC_CONST(0.637057512412839) },
+ { FRAC_CONST(0.768858179941253), FRAC_CONST(0.639419345294951) },
+ { FRAC_CONST(0.766892850643481), FRAC_CONST(0.641775159718664) },
+ { FRAC_CONST(0.764920303058128), FRAC_CONST(0.644124933510155) },
+ { FRAC_CONST(0.762940555751566), FRAC_CONST(0.646468644552458) },
+ { FRAC_CONST(0.760953627357928), FRAC_CONST(0.648806270785673) },
+ { FRAC_CONST(0.758959536578942), FRAC_CONST(0.651137790207170) },
+ { FRAC_CONST(0.756958302183750), FRAC_CONST(0.653463180871802) },
+ { FRAC_CONST(0.754949943008733), FRAC_CONST(0.655782420892106) },
+ { FRAC_CONST(0.752934477957330), FRAC_CONST(0.658095488438511) },
+ { FRAC_CONST(0.750911925999868), FRAC_CONST(0.660402361739545) },
+ { FRAC_CONST(0.748882306173375), FRAC_CONST(0.662703019082037) },
+ { FRAC_CONST(0.746845637581407), FRAC_CONST(0.664997438811325) },
+ { FRAC_CONST(0.744801939393863), FRAC_CONST(0.667285599331456) },
+ { FRAC_CONST(0.742751230846809), FRAC_CONST(0.669567479105392) },
+ { FRAC_CONST(0.740693531242296), FRAC_CONST(0.671843056655212) },
+ { FRAC_CONST(0.738628859948175), FRAC_CONST(0.674112310562312) },
+ { FRAC_CONST(0.736557236397919), FRAC_CONST(0.676375219467612) },
+ { FRAC_CONST(0.734478680090438), FRAC_CONST(0.678631762071749) },
+ { FRAC_CONST(0.732393210589896), FRAC_CONST(0.680881917135287) },
+ { FRAC_CONST(0.730300847525525), FRAC_CONST(0.683125663478909) },
+ { FRAC_CONST(0.728201610591445), FRAC_CONST(0.685362979983619) },
+ { FRAC_CONST(0.726095519546471), FRAC_CONST(0.687593845590942) },
+ { FRAC_CONST(0.723982594213936), FRAC_CONST(0.689818239303122) },
+ { FRAC_CONST(0.721862854481496), FRAC_CONST(0.692036140183319) },
+ { FRAC_CONST(0.719736320300951), FRAC_CONST(0.694247527355803) },
+ { FRAC_CONST(0.717603011688049), FRAC_CONST(0.696452380006158) },
+ { FRAC_CONST(0.715462948722304), FRAC_CONST(0.698650677381469) },
+ { FRAC_CONST(0.713316151546803), FRAC_CONST(0.700842398790526) },
+ { FRAC_CONST(0.711162640368018), FRAC_CONST(0.703027523604011) },
+ { FRAC_CONST(0.709002435455618), FRAC_CONST(0.705206031254698) },
+ { FRAC_CONST(0.706835557142274), FRAC_CONST(0.707377901237642) },
+ { FRAC_CONST(0.704662025823469), FRAC_CONST(0.709543113110377) },
+ { FRAC_CONST(0.702481861957308), FRAC_CONST(0.711701646493103) },
+ { FRAC_CONST(0.700295086064324), FRAC_CONST(0.713853481068882) },
+ { FRAC_CONST(0.698101718727284), FRAC_CONST(0.715998596583829) },
+ { FRAC_CONST(0.695901780590997), FRAC_CONST(0.718136972847297) },
+ { FRAC_CONST(0.693695292362118), FRAC_CONST(0.720268589732077) },
+ { FRAC_CONST(0.691482274808956), FRAC_CONST(0.722393427174578) },
+ { FRAC_CONST(0.689262748761273), FRAC_CONST(0.724511465175020) },
+ { FRAC_CONST(0.687036735110096), FRAC_CONST(0.726622683797623) },
+ { FRAC_CONST(0.684804254807511), FRAC_CONST(0.728727063170794) },
+ { FRAC_CONST(0.682565328866473), FRAC_CONST(0.730824583487312) },
+ { FRAC_CONST(0.680319978360607), FRAC_CONST(0.732915225004518) },
+ { FRAC_CONST(0.678068224424007), FRAC_CONST(0.734998968044497) },
+ { FRAC_CONST(0.675810088251037), FRAC_CONST(0.737075792994266) },
+ { FRAC_CONST(0.673545591096136), FRAC_CONST(0.739145680305957) },
+ { FRAC_CONST(0.671274754273613), FRAC_CONST(0.741208610497004) },
+ { FRAC_CONST(0.668997599157450), FRAC_CONST(0.743264564150321) },
+ { FRAC_CONST(0.666714147181098), FRAC_CONST(0.745313521914490) },
+ { FRAC_CONST(0.664424419837275), FRAC_CONST(0.747355464503940) },
+ { FRAC_CONST(0.662128438677769), FRAC_CONST(0.749390372699130) },
+ { FRAC_CONST(0.659826225313227), FRAC_CONST(0.751418227346727) },
+ { FRAC_CONST(0.657517801412960), FRAC_CONST(0.753439009359794) },
+ { FRAC_CONST(0.655203188704732), FRAC_CONST(0.755452699717958) },
+ { FRAC_CONST(0.652882408974559), FRAC_CONST(0.757459279467601) },
+ { FRAC_CONST(0.650555484066504), FRAC_CONST(0.759458729722028) },
+ { FRAC_CONST(0.648222435882470), FRAC_CONST(0.761451031661654) },
+ { FRAC_CONST(0.645883286381996), FRAC_CONST(0.763436166534172) },
+ { FRAC_CONST(0.643538057582048), FRAC_CONST(0.765414115654738) },
+ { FRAC_CONST(0.641186771556811), FRAC_CONST(0.767384860406142) },
+ { FRAC_CONST(0.638829450437486), FRAC_CONST(0.769348382238982) },
+ { FRAC_CONST(0.636466116412077), FRAC_CONST(0.771304662671845) },
+ { FRAC_CONST(0.634096791725184), FRAC_CONST(0.773253683291473) },
+ { FRAC_CONST(0.631721498677792), FRAC_CONST(0.775195425752941) },
+ { FRAC_CONST(0.629340259627066), FRAC_CONST(0.777129871779832) },
+ { FRAC_CONST(0.626953096986133), FRAC_CONST(0.779057003164401) },
+ { FRAC_CONST(0.624560033223877), FRAC_CONST(0.780976801767754) },
+ { FRAC_CONST(0.622161090864727), FRAC_CONST(0.782889249520015) },
+ { FRAC_CONST(0.619756292488441), FRAC_CONST(0.784794328420499) },
+ { FRAC_CONST(0.617345660729897), FRAC_CONST(0.786692020537877) },
+ { FRAC_CONST(0.614929218278880), FRAC_CONST(0.788582308010347) },
+ { FRAC_CONST(0.612506987879866), FRAC_CONST(0.790465173045805) },
+ { FRAC_CONST(0.610078992331810), FRAC_CONST(0.792340597922007) },
+ { FRAC_CONST(0.607645254487931), FRAC_CONST(0.794208564986741) },
+ { FRAC_CONST(0.605205797255497), FRAC_CONST(0.796069056657988) },
+ { FRAC_CONST(0.602760643595607), FRAC_CONST(0.797922055424093) },
+ { FRAC_CONST(0.600309816522980), FRAC_CONST(0.799767543843926) },
+ { FRAC_CONST(0.597853339105734), FRAC_CONST(0.801605504547046) },
+ { FRAC_CONST(0.595391234465169), FRAC_CONST(0.803435920233868) },
+ { FRAC_CONST(0.592923525775551), FRAC_CONST(0.805258773675822) },
+ { FRAC_CONST(0.590450236263896), FRAC_CONST(0.807074047715518) },
+ { FRAC_CONST(0.587971389209745), FRAC_CONST(0.808881725266904) },
+ { FRAC_CONST(0.585487007944951), FRAC_CONST(0.810681789315431) },
+ { FRAC_CONST(0.582997115853458), FRAC_CONST(0.812474222918210) },
+ { FRAC_CONST(0.580501736371077), FRAC_CONST(0.814259009204175) },
+ { FRAC_CONST(0.578000892985270), FRAC_CONST(0.816036131374237) },
+ { FRAC_CONST(0.575494609234928), FRAC_CONST(0.817805572701444) },
+ { FRAC_CONST(0.572982908710149), FRAC_CONST(0.819567316531142) },
+ { FRAC_CONST(0.570465815052013), FRAC_CONST(0.821321346281127) },
+ { FRAC_CONST(0.567943351952366), FRAC_CONST(0.823067645441802) },
+ { FRAC_CONST(0.565415543153590), FRAC_CONST(0.824806197576334) },
+ { FRAC_CONST(0.562882412448385), FRAC_CONST(0.826536986320810) },
+ { FRAC_CONST(0.560343983679541), FRAC_CONST(0.828259995384386) },
+ { FRAC_CONST(0.557800280739717), FRAC_CONST(0.829975208549444) },
+ { FRAC_CONST(0.555251327571214), FRAC_CONST(0.831682609671745) },
+ { FRAC_CONST(0.552697148165750), FRAC_CONST(0.833382182680580) },
+ { FRAC_CONST(0.550137766564234), FRAC_CONST(0.835073911578919) },
+ { FRAC_CONST(0.547573206856540), FRAC_CONST(0.836757780443567) },
+ { FRAC_CONST(0.545003493181281), FRAC_CONST(0.838433773425308) },
+ { FRAC_CONST(0.542428649725581), FRAC_CONST(0.840101874749058) },
+ { FRAC_CONST(0.539848700724848), FRAC_CONST(0.841762068714012) },
+ { FRAC_CONST(0.537263670462543), FRAC_CONST(0.843414339693793) },
+ { FRAC_CONST(0.534673583269956), FRAC_CONST(0.845058672136595) },
+ { FRAC_CONST(0.532078463525974), FRAC_CONST(0.846695050565337) },
+ { FRAC_CONST(0.529478335656852), FRAC_CONST(0.848323459577802) },
+ { FRAC_CONST(0.526873224135985), FRAC_CONST(0.849943883846782) },
+ { FRAC_CONST(0.524263153483673), FRAC_CONST(0.851556308120229) },
+ { FRAC_CONST(0.521648148266897), FRAC_CONST(0.853160717221390) },
+ { FRAC_CONST(0.519028233099081), FRAC_CONST(0.854757096048957) },
+ { FRAC_CONST(0.516403432639864), FRAC_CONST(0.856345429577204) },
+ { FRAC_CONST(0.513773771594868), FRAC_CONST(0.857925702856130) },
+ { FRAC_CONST(0.511139274715464), FRAC_CONST(0.859497901011602) },
+ { FRAC_CONST(0.508499966798541), FRAC_CONST(0.861062009245491) },
+ { FRAC_CONST(0.505855872686269), FRAC_CONST(0.862618012835817) },
+ { FRAC_CONST(0.503207017265869), FRAC_CONST(0.864165897136879) },
+ { FRAC_CONST(0.500553425469378), FRAC_CONST(0.865705647579402) },
+ { FRAC_CONST(0.497895122273411), FRAC_CONST(0.867237249670668) },
+ { FRAC_CONST(0.495232132698931), FRAC_CONST(0.868760688994655) },
+ { FRAC_CONST(0.492564481811011), FRAC_CONST(0.870275951212172) },
+ { FRAC_CONST(0.489892194718595), FRAC_CONST(0.871783022060993) },
+ { FRAC_CONST(0.487215296574269), FRAC_CONST(0.873281887355994) },
+ { FRAC_CONST(0.484533812574016), FRAC_CONST(0.874772532989284) },
+ { FRAC_CONST(0.481847767956986), FRAC_CONST(0.876254944930338) },
+ { FRAC_CONST(0.479157188005253), FRAC_CONST(0.877729109226132) },
+ { FRAC_CONST(0.476462098043581), FRAC_CONST(0.879195012001267) },
+ { FRAC_CONST(0.473762523439183), FRAC_CONST(0.880652639458111) },
+ { FRAC_CONST(0.471058489601483), FRAC_CONST(0.882101977876918) },
+ { FRAC_CONST(0.468350021981877), FRAC_CONST(0.883543013615962) },
+ { FRAC_CONST(0.465637146073494), FRAC_CONST(0.884975733111667) },
+ { FRAC_CONST(0.462919887410955), FRAC_CONST(0.886400122878730) },
+ { FRAC_CONST(0.460198271570134), FRAC_CONST(0.887816169510255) },
+ { FRAC_CONST(0.457472324167916), FRAC_CONST(0.889223859677868) },
+ { FRAC_CONST(0.454742070861955), FRAC_CONST(0.890623180131856) },
+ { FRAC_CONST(0.452007537350437), FRAC_CONST(0.892014117701280) },
+ { FRAC_CONST(0.449268749371830), FRAC_CONST(0.893396659294108) },
+ { FRAC_CONST(0.446525732704651), FRAC_CONST(0.894770791897330) },
+ { FRAC_CONST(0.443778513167218), FRAC_CONST(0.896136502577087) },
+ { FRAC_CONST(0.441027116617407), FRAC_CONST(0.897493778478790) },
+ { FRAC_CONST(0.438271568952410), FRAC_CONST(0.898842606827242) },
+ { FRAC_CONST(0.435511896108492), FRAC_CONST(0.900182974926757) },
+ { FRAC_CONST(0.432748124060744), FRAC_CONST(0.901514870161279) },
+ { FRAC_CONST(0.429980278822841), FRAC_CONST(0.902838279994503) },
+ { FRAC_CONST(0.427208386446796), FRAC_CONST(0.904153191969992) },
+ { FRAC_CONST(0.424432473022717), FRAC_CONST(0.905459593711293) },
+ { FRAC_CONST(0.421652564678558), FRAC_CONST(0.906757472922057) },
+ { FRAC_CONST(0.418868687579875), FRAC_CONST(0.908046817386148) },
+ { FRAC_CONST(0.416080867929579), FRAC_CONST(0.909327614967767) },
+ { FRAC_CONST(0.413289131967691), FRAC_CONST(0.910599853611559) },
+ { FRAC_CONST(0.410493505971093), FRAC_CONST(0.911863521342729) },
+ { FRAC_CONST(0.407694016253280), FRAC_CONST(0.913118606267154) },
+ { FRAC_CONST(0.404890689164118), FRAC_CONST(0.914365096571498) },
+ { FRAC_CONST(0.402083551089587), FRAC_CONST(0.915602980523320) },
+ { FRAC_CONST(0.399272628451541), FRAC_CONST(0.916832246471184) },
+ { FRAC_CONST(0.396457947707454), FRAC_CONST(0.918052882844770) },
+ { FRAC_CONST(0.393639535350173), FRAC_CONST(0.919264878154985) },
+ { FRAC_CONST(0.390817417907669), FRAC_CONST(0.920468220994067) },
+ { FRAC_CONST(0.387991621942785), FRAC_CONST(0.921662900035695) },
+ { FRAC_CONST(0.385162174052990), FRAC_CONST(0.922848904035094) },
+ { FRAC_CONST(0.382329100870125), FRAC_CONST(0.924026221829144) },
+ { FRAC_CONST(0.379492429060153), FRAC_CONST(0.925194842336480) },
+ { FRAC_CONST(0.376652185322910), FRAC_CONST(0.926354754557603) },
+ { FRAC_CONST(0.373808396391851), FRAC_CONST(0.927505947574975) },
+ { FRAC_CONST(0.370961089033802), FRAC_CONST(0.928648410553131) },
+ { FRAC_CONST(0.368110290048703), FRAC_CONST(0.929782132738772) },
+ { FRAC_CONST(0.365256026269360), FRAC_CONST(0.930907103460875) },
+ { FRAC_CONST(0.362398324561191), FRAC_CONST(0.932023312130786) },
+ { FRAC_CONST(0.359537211821973), FRAC_CONST(0.933130748242325) },
+ { FRAC_CONST(0.356672714981588), FRAC_CONST(0.934229401371881) },
+ { FRAC_CONST(0.353804861001772), FRAC_CONST(0.935319261178512) },
+ { FRAC_CONST(0.350933676875858), FRAC_CONST(0.936400317404042) },
+ { FRAC_CONST(0.348059189628526), FRAC_CONST(0.937472559873159) },
+ { FRAC_CONST(0.345181426315543), FRAC_CONST(0.938535978493509) },
+ { FRAC_CONST(0.342300414023514), FRAC_CONST(0.939590563255789) },
+ { FRAC_CONST(0.339416179869623), FRAC_CONST(0.940636304233848) },
+ { FRAC_CONST(0.336528751001382), FRAC_CONST(0.941673191584771) },
+ { FRAC_CONST(0.333638154596371), FRAC_CONST(0.942701215548982) },
+ { FRAC_CONST(0.330744417861983), FRAC_CONST(0.943720366450326) },
+ { FRAC_CONST(0.327847568035171), FRAC_CONST(0.944730634696168) },
+ { FRAC_CONST(0.324947632382188), FRAC_CONST(0.945732010777477) },
+ { FRAC_CONST(0.322044638198335), FRAC_CONST(0.946724485268921) },
+ { FRAC_CONST(0.319138612807696), FRAC_CONST(0.947708048828952) },
+ { FRAC_CONST(0.316229583562890), FRAC_CONST(0.948682692199895) },
+ { FRAC_CONST(0.313317577844809), FRAC_CONST(0.949648406208035) },
+ { FRAC_CONST(0.310402623062359), FRAC_CONST(0.950605181763705) },
+ { FRAC_CONST(0.307484746652204), FRAC_CONST(0.951553009861369) },
+ { FRAC_CONST(0.304563976078509), FRAC_CONST(0.952491881579706) },
+ { FRAC_CONST(0.301640338832679), FRAC_CONST(0.953421788081700) },
+ { FRAC_CONST(0.298713862433100), FRAC_CONST(0.954342720614716) },
+ { FRAC_CONST(0.295784574424884), FRAC_CONST(0.955254670510587) },
+ { FRAC_CONST(0.292852502379605), FRAC_CONST(0.956157629185692) },
+ { FRAC_CONST(0.289917673895041), FRAC_CONST(0.957051588141041) },
+ { FRAC_CONST(0.286980116594916), FRAC_CONST(0.957936538962351) },
+ { FRAC_CONST(0.284039858128637), FRAC_CONST(0.958812473320129) },
+ { FRAC_CONST(0.281096926171038), FRAC_CONST(0.959679382969747) },
+ { FRAC_CONST(0.278151348422115), FRAC_CONST(0.960537259751520) },
+ { FRAC_CONST(0.275203152606767), FRAC_CONST(0.961386095590786) },
+ { FRAC_CONST(0.272252366474537), FRAC_CONST(0.962225882497979) },
+ { FRAC_CONST(0.269299017799346), FRAC_CONST(0.963056612568704) },
+ { FRAC_CONST(0.266343134379238), FRAC_CONST(0.963878277983814) },
+ { FRAC_CONST(0.263384744036113), FRAC_CONST(0.964690871009481) },
+ { FRAC_CONST(0.260423874615468), FRAC_CONST(0.965494383997270) },
+ { FRAC_CONST(0.257460553986133), FRAC_CONST(0.966288809384210) },
+ { FRAC_CONST(0.254494810040011), FRAC_CONST(0.967074139692867) },
+ { FRAC_CONST(0.251526670691813), FRAC_CONST(0.967850367531414) },
+ { FRAC_CONST(0.248556163878797), FRAC_CONST(0.968617485593698) },
+ { FRAC_CONST(0.245583317560504), FRAC_CONST(0.969375486659311) },
+ { FRAC_CONST(0.242608159718497), FRAC_CONST(0.970124363593660) },
+ { FRAC_CONST(0.239630718356094), FRAC_CONST(0.970864109348029) },
+ { FRAC_CONST(0.236651021498106), FRAC_CONST(0.971594716959650) },
+ { FRAC_CONST(0.233669097190577), FRAC_CONST(0.972316179551765) },
+ { FRAC_CONST(0.230684973500512), FRAC_CONST(0.973028490333694) },
+ { FRAC_CONST(0.227698678515621), FRAC_CONST(0.973731642600896) },
+ { FRAC_CONST(0.224710240344050), FRAC_CONST(0.974425629735035) },
+ { FRAC_CONST(0.221719687114115), FRAC_CONST(0.975110445204039) },
+ { FRAC_CONST(0.218727046974045), FRAC_CONST(0.975786082562164) },
+ { FRAC_CONST(0.215732348091706), FRAC_CONST(0.976452535450054) },
+ { FRAC_CONST(0.212735618654346), FRAC_CONST(0.977109797594801) },
+ { FRAC_CONST(0.209736886868323), FRAC_CONST(0.977757862810003) },
+ { FRAC_CONST(0.206736180958844), FRAC_CONST(0.978396724995823) },
+ { FRAC_CONST(0.203733529169694), FRAC_CONST(0.979026378139048) },
+ { FRAC_CONST(0.200728959762976), FRAC_CONST(0.979646816313141) },
+ { FRAC_CONST(0.197722501018842), FRAC_CONST(0.980258033678304) },
+ { FRAC_CONST(0.194714181235226), FRAC_CONST(0.980860024481524) },
+ { FRAC_CONST(0.191704028727580), FRAC_CONST(0.981452783056636) },
+ { FRAC_CONST(0.188692071828605), FRAC_CONST(0.982036303824369) },
+ { FRAC_CONST(0.185678338887988), FRAC_CONST(0.982610581292405) },
+ { FRAC_CONST(0.182662858272129), FRAC_CONST(0.983175610055424) },
+ { FRAC_CONST(0.179645658363882), FRAC_CONST(0.983731384795162) },
+ { FRAC_CONST(0.176626767562281), FRAC_CONST(0.984277900280454) },
+ { FRAC_CONST(0.173606214282275), FRAC_CONST(0.984815151367289) },
+ { FRAC_CONST(0.170584026954464), FRAC_CONST(0.985343132998855) },
+ { FRAC_CONST(0.167560234024824), FRAC_CONST(0.985861840205587) },
+ { FRAC_CONST(0.164534863954446), FRAC_CONST(0.986371268105216) },
+ { FRAC_CONST(0.161507945219266), FRAC_CONST(0.986871411902812) },
+ { FRAC_CONST(0.158479506309796), FRAC_CONST(0.987362266890832) },
+ { FRAC_CONST(0.155449575730856), FRAC_CONST(0.987843828449162) },
+ { FRAC_CONST(0.152418182001307), FRAC_CONST(0.988316092045160) },
+ { FRAC_CONST(0.149385353653780), FRAC_CONST(0.988779053233702) },
+ { FRAC_CONST(0.146351119234411), FRAC_CONST(0.989232707657220) },
+ { FRAC_CONST(0.143315507302572), FRAC_CONST(0.989677051045747) },
+ { FRAC_CONST(0.140278546430595), FRAC_CONST(0.990112079216954) },
+ { FRAC_CONST(0.137240265203516), FRAC_CONST(0.990537788076189) },
+ { FRAC_CONST(0.134200692218792), FRAC_CONST(0.990954173616519) },
+ { FRAC_CONST(0.131159856086043), FRAC_CONST(0.991361231918763) },
+ { FRAC_CONST(0.128117785426777), FRAC_CONST(0.991758959151536) },
+ { FRAC_CONST(0.125074508874121), FRAC_CONST(0.992147351571276) },
+ { FRAC_CONST(0.122030055072553), FRAC_CONST(0.992526405522286) },
+ { FRAC_CONST(0.118984452677633), FRAC_CONST(0.992896117436766) },
+ { FRAC_CONST(0.115937730355728), FRAC_CONST(0.993256483834846) },
+ { FRAC_CONST(0.112889916783750), FRAC_CONST(0.993607501324622) },
+ { FRAC_CONST(0.109841040648883), FRAC_CONST(0.993949166602181) },
+ { FRAC_CONST(0.106791130648307), FRAC_CONST(0.994281476451642) },
+ { FRAC_CONST(0.103740215488939), FRAC_CONST(0.994604427745176) },
+ { FRAC_CONST(0.100688323887154), FRAC_CONST(0.994918017443043) },
+ { FRAC_CONST(0.097635484568517), FRAC_CONST(0.995222242593618) },
+ { FRAC_CONST(0.094581726267515), FRAC_CONST(0.995517100333418) },
+ { FRAC_CONST(0.091527077727285), FRAC_CONST(0.995802587887129) },
+ { FRAC_CONST(0.088471567699341), FRAC_CONST(0.996078702567634) },
+ { FRAC_CONST(0.085415224943307), FRAC_CONST(0.996345441776036) },
+ { FRAC_CONST(0.082358078226647), FRAC_CONST(0.996602803001684) },
+ { FRAC_CONST(0.079300156324388), FRAC_CONST(0.996850783822197) },
+ { FRAC_CONST(0.076241488018856), FRAC_CONST(0.997089381903483) },
+ { FRAC_CONST(0.073182102099403), FRAC_CONST(0.997318594999769) },
+ { FRAC_CONST(0.070122027362134), FRAC_CONST(0.997538420953611) },
+ { FRAC_CONST(0.067061292609637), FRAC_CONST(0.997748857695926) },
+ { FRAC_CONST(0.063999926650714), FRAC_CONST(0.997949903246001) },
+ { FRAC_CONST(0.060937958300107), FRAC_CONST(0.998141555711521) },
+ { FRAC_CONST(0.057875416378229), FRAC_CONST(0.998323813288578) },
+ { FRAC_CONST(0.054812329710890), FRAC_CONST(0.998496674261695) },
+ { FRAC_CONST(0.051748727129028), FRAC_CONST(0.998660137003838) },
+ { FRAC_CONST(0.048684637468439), FRAC_CONST(0.998814199976435) },
+ { FRAC_CONST(0.045620089569500), FRAC_CONST(0.998958861729386) },
+ { FRAC_CONST(0.042555112276904), FRAC_CONST(0.999094120901079) },
+ { FRAC_CONST(0.039489734439384), FRAC_CONST(0.999219976218404) },
+ { FRAC_CONST(0.036423984909444), FRAC_CONST(0.999336426496761) },
+ { FRAC_CONST(0.033357892543086), FRAC_CONST(0.999443470640078) },
+ { FRAC_CONST(0.030291486199539), FRAC_CONST(0.999541107640813) },
+ { FRAC_CONST(0.027224794740988), FRAC_CONST(0.999629336579970) },
+ { FRAC_CONST(0.024157847032300), FRAC_CONST(0.999708156627105) },
+ { FRAC_CONST(0.021090671940755), FRAC_CONST(0.999777567040333) },
+ { FRAC_CONST(0.018023298335774), FRAC_CONST(0.999837567166337) },
+ { FRAC_CONST(0.014955755088644), FRAC_CONST(0.999888156440373) },
+ { FRAC_CONST(0.011888071072252), FRAC_CONST(0.999929334386276) },
+ { FRAC_CONST(0.008820275160808), FRAC_CONST(0.999961100616463) },
+ { FRAC_CONST(0.005752396229574), FRAC_CONST(0.999983454831938) },
+ { FRAC_CONST(0.002684463154596), FRAC_CONST(0.999996396822294) }
+};
- /* 64 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_256[] =
- {
- { FRAC_CONST(0.999995293809576), FRAC_CONST(0.003067956762966) },
- { FRAC_CONST(0.999618822495179), FRAC_CONST(0.027608145778966) },
- { FRAC_CONST(0.998640218180265), FRAC_CONST(0.052131704680283) },
- { FRAC_CONST(0.997060070339483), FRAC_CONST(0.076623861392031) },
- { FRAC_CONST(0.994879330794806), FRAC_CONST(0.101069862754828) },
- { FRAC_CONST(0.992099313142192), FRAC_CONST(0.125454983411546) },
- { FRAC_CONST(0.988721691960324), FRAC_CONST(0.149764534677322) },
- { FRAC_CONST(0.984748501801904), FRAC_CONST(0.173983873387464) },
- { FRAC_CONST(0.980182135968117), FRAC_CONST(0.198098410717954) },
- { FRAC_CONST(0.975025345066994), FRAC_CONST(0.222093620973204) },
- { FRAC_CONST(0.969281235356549), FRAC_CONST(0.245955050335795) },
- { FRAC_CONST(0.962953266873684), FRAC_CONST(0.269668325572915) },
- { FRAC_CONST(0.956045251349996), FRAC_CONST(0.293219162694259) },
- { FRAC_CONST(0.948561349915730), FRAC_CONST(0.316593375556166) },
- { FRAC_CONST(0.940506070593268), FRAC_CONST(0.339776884406827) },
- { FRAC_CONST(0.931884265581668), FRAC_CONST(0.362755724367397) },
- { FRAC_CONST(0.922701128333879), FRAC_CONST(0.385516053843919) },
- { FRAC_CONST(0.912962190428398), FRAC_CONST(0.408044162864979) },
- { FRAC_CONST(0.902673318237259), FRAC_CONST(0.430326481340083) },
- { FRAC_CONST(0.891840709392343), FRAC_CONST(0.452349587233771) },
- { FRAC_CONST(0.880470889052161), FRAC_CONST(0.474100214650550) },
- { FRAC_CONST(0.868570705971341), FRAC_CONST(0.495565261825773) },
- { FRAC_CONST(0.856147328375194), FRAC_CONST(0.516731799017650) },
- { FRAC_CONST(0.843208239641845), FRAC_CONST(0.537587076295645) },
- { FRAC_CONST(0.829761233794523), FRAC_CONST(0.558118531220556) },
- { FRAC_CONST(0.815814410806734), FRAC_CONST(0.578313796411656) },
- { FRAC_CONST(0.801376171723140), FRAC_CONST(0.598160706996342) },
- { FRAC_CONST(0.786455213599086), FRAC_CONST(0.617647307937804) },
- { FRAC_CONST(0.771060524261814), FRAC_CONST(0.636761861236284) },
- { FRAC_CONST(0.755201376896537), FRAC_CONST(0.655492852999615) },
- { FRAC_CONST(0.738887324460615), FRAC_CONST(0.673829000378756) },
- { FRAC_CONST(0.722128193929215), FRAC_CONST(0.691759258364158) },
- { FRAC_CONST(0.704934080375905), FRAC_CONST(0.709272826438866) },
- { FRAC_CONST(0.687315340891759), FRAC_CONST(0.726359155084346) },
- { FRAC_CONST(0.669282588346636), FRAC_CONST(0.743007952135122) },
- { FRAC_CONST(0.650846684996381), FRAC_CONST(0.759209188978388) },
- { FRAC_CONST(0.632018735939809), FRAC_CONST(0.774953106594874) },
- { FRAC_CONST(0.612810082429410), FRAC_CONST(0.790230221437310) },
- { FRAC_CONST(0.593232295039800), FRAC_CONST(0.805031331142964) },
- { FRAC_CONST(0.573297166698042), FRAC_CONST(0.819347520076797) },
- { FRAC_CONST(0.553016705580028), FRAC_CONST(0.833170164701913) },
- { FRAC_CONST(0.532403127877198), FRAC_CONST(0.846490938774052) },
- { FRAC_CONST(0.511468850437971), FRAC_CONST(0.859301818357008) },
- { FRAC_CONST(0.490226483288291), FRAC_CONST(0.871595086655951) },
- { FRAC_CONST(0.468688822035828), FRAC_CONST(0.883363338665732) },
- { FRAC_CONST(0.446868840162374), FRAC_CONST(0.894599485631383) },
- { FRAC_CONST(0.424779681209109), FRAC_CONST(0.905296759318119) },
- { FRAC_CONST(0.402434650859419), FRAC_CONST(0.915448716088268) },
- { FRAC_CONST(0.379847208924051), FRAC_CONST(0.925049240782678) },
- { FRAC_CONST(0.357030961233430), FRAC_CONST(0.934092550404259) },
- { FRAC_CONST(0.333999651442009), FRAC_CONST(0.942573197601447) },
- { FRAC_CONST(0.310767152749611), FRAC_CONST(0.950486073949482) },
- { FRAC_CONST(0.287347459544730), FRAC_CONST(0.957826413027533) },
- { FRAC_CONST(0.263754678974832), FRAC_CONST(0.964589793289813) },
- { FRAC_CONST(0.240003022448742), FRAC_CONST(0.970772140728950) },
- { FRAC_CONST(0.216106797076220), FRAC_CONST(0.976369731330021) },
- { FRAC_CONST(0.192080397049892), FRAC_CONST(0.981379193313755) },
- { FRAC_CONST(0.167938294974731), FRAC_CONST(0.985797509167567) },
- { FRAC_CONST(0.143695033150295), FRAC_CONST(0.989622017463201) },
- { FRAC_CONST(0.119365214810991), FRAC_CONST(0.992850414459865) },
- { FRAC_CONST(0.094963495329639), FRAC_CONST(0.995480755491927) },
- { FRAC_CONST(0.070504573389614), FRAC_CONST(0.997511456140303) },
- { FRAC_CONST(0.046003182130915), FRAC_CONST(0.998941293186857) },
- { FRAC_CONST(0.021474080275470), FRAC_CONST(0.999769405351215) }
- };
+/* 64 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_256[] =
+{
+ { FRAC_CONST(0.999995293809576), FRAC_CONST(0.003067956762966) },
+ { FRAC_CONST(0.999618822495179), FRAC_CONST(0.027608145778966) },
+ { FRAC_CONST(0.998640218180265), FRAC_CONST(0.052131704680283) },
+ { FRAC_CONST(0.997060070339483), FRAC_CONST(0.076623861392031) },
+ { FRAC_CONST(0.994879330794806), FRAC_CONST(0.101069862754828) },
+ { FRAC_CONST(0.992099313142192), FRAC_CONST(0.125454983411546) },
+ { FRAC_CONST(0.988721691960324), FRAC_CONST(0.149764534677322) },
+ { FRAC_CONST(0.984748501801904), FRAC_CONST(0.173983873387464) },
+ { FRAC_CONST(0.980182135968117), FRAC_CONST(0.198098410717954) },
+ { FRAC_CONST(0.975025345066994), FRAC_CONST(0.222093620973204) },
+ { FRAC_CONST(0.969281235356549), FRAC_CONST(0.245955050335795) },
+ { FRAC_CONST(0.962953266873684), FRAC_CONST(0.269668325572915) },
+ { FRAC_CONST(0.956045251349996), FRAC_CONST(0.293219162694259) },
+ { FRAC_CONST(0.948561349915730), FRAC_CONST(0.316593375556166) },
+ { FRAC_CONST(0.940506070593268), FRAC_CONST(0.339776884406827) },
+ { FRAC_CONST(0.931884265581668), FRAC_CONST(0.362755724367397) },
+ { FRAC_CONST(0.922701128333879), FRAC_CONST(0.385516053843919) },
+ { FRAC_CONST(0.912962190428398), FRAC_CONST(0.408044162864979) },
+ { FRAC_CONST(0.902673318237259), FRAC_CONST(0.430326481340083) },
+ { FRAC_CONST(0.891840709392343), FRAC_CONST(0.452349587233771) },
+ { FRAC_CONST(0.880470889052161), FRAC_CONST(0.474100214650550) },
+ { FRAC_CONST(0.868570705971341), FRAC_CONST(0.495565261825773) },
+ { FRAC_CONST(0.856147328375194), FRAC_CONST(0.516731799017650) },
+ { FRAC_CONST(0.843208239641845), FRAC_CONST(0.537587076295645) },
+ { FRAC_CONST(0.829761233794523), FRAC_CONST(0.558118531220556) },
+ { FRAC_CONST(0.815814410806734), FRAC_CONST(0.578313796411656) },
+ { FRAC_CONST(0.801376171723140), FRAC_CONST(0.598160706996342) },
+ { FRAC_CONST(0.786455213599086), FRAC_CONST(0.617647307937804) },
+ { FRAC_CONST(0.771060524261814), FRAC_CONST(0.636761861236284) },
+ { FRAC_CONST(0.755201376896537), FRAC_CONST(0.655492852999615) },
+ { FRAC_CONST(0.738887324460615), FRAC_CONST(0.673829000378756) },
+ { FRAC_CONST(0.722128193929215), FRAC_CONST(0.691759258364158) },
+ { FRAC_CONST(0.704934080375905), FRAC_CONST(0.709272826438866) },
+ { FRAC_CONST(0.687315340891759), FRAC_CONST(0.726359155084346) },
+ { FRAC_CONST(0.669282588346636), FRAC_CONST(0.743007952135122) },
+ { FRAC_CONST(0.650846684996381), FRAC_CONST(0.759209188978388) },
+ { FRAC_CONST(0.632018735939809), FRAC_CONST(0.774953106594874) },
+ { FRAC_CONST(0.612810082429410), FRAC_CONST(0.790230221437310) },
+ { FRAC_CONST(0.593232295039800), FRAC_CONST(0.805031331142964) },
+ { FRAC_CONST(0.573297166698042), FRAC_CONST(0.819347520076797) },
+ { FRAC_CONST(0.553016705580028), FRAC_CONST(0.833170164701913) },
+ { FRAC_CONST(0.532403127877198), FRAC_CONST(0.846490938774052) },
+ { FRAC_CONST(0.511468850437971), FRAC_CONST(0.859301818357008) },
+ { FRAC_CONST(0.490226483288291), FRAC_CONST(0.871595086655951) },
+ { FRAC_CONST(0.468688822035828), FRAC_CONST(0.883363338665732) },
+ { FRAC_CONST(0.446868840162374), FRAC_CONST(0.894599485631383) },
+ { FRAC_CONST(0.424779681209109), FRAC_CONST(0.905296759318119) },
+ { FRAC_CONST(0.402434650859419), FRAC_CONST(0.915448716088268) },
+ { FRAC_CONST(0.379847208924051), FRAC_CONST(0.925049240782678) },
+ { FRAC_CONST(0.357030961233430), FRAC_CONST(0.934092550404259) },
+ { FRAC_CONST(0.333999651442009), FRAC_CONST(0.942573197601447) },
+ { FRAC_CONST(0.310767152749611), FRAC_CONST(0.950486073949482) },
+ { FRAC_CONST(0.287347459544730), FRAC_CONST(0.957826413027533) },
+ { FRAC_CONST(0.263754678974832), FRAC_CONST(0.964589793289813) },
+ { FRAC_CONST(0.240003022448742), FRAC_CONST(0.970772140728950) },
+ { FRAC_CONST(0.216106797076220), FRAC_CONST(0.976369731330021) },
+ { FRAC_CONST(0.192080397049892), FRAC_CONST(0.981379193313755) },
+ { FRAC_CONST(0.167938294974731), FRAC_CONST(0.985797509167567) },
+ { FRAC_CONST(0.143695033150295), FRAC_CONST(0.989622017463201) },
+ { FRAC_CONST(0.119365214810991), FRAC_CONST(0.992850414459865) },
+ { FRAC_CONST(0.094963495329639), FRAC_CONST(0.995480755491927) },
+ { FRAC_CONST(0.070504573389614), FRAC_CONST(0.997511456140303) },
+ { FRAC_CONST(0.046003182130915), FRAC_CONST(0.998941293186857) },
+ { FRAC_CONST(0.021474080275470), FRAC_CONST(0.999769405351215) }
+};
#ifdef LD_DEC
- /* 256 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_1024[] =
- {
- { FRAC_CONST(0.999999705862882), FRAC_CONST(0.000766990318743) },
- { FRAC_CONST(0.999976174986898), FRAC_CONST(0.006902858724730) },
- { FRAC_CONST(0.999914995573113), FRAC_CONST(0.013038467241987) },
- { FRAC_CONST(0.999816169924900), FRAC_CONST(0.019173584868323) },
- { FRAC_CONST(0.999679701762988), FRAC_CONST(0.025307980620025) },
- { FRAC_CONST(0.999505596225325), FRAC_CONST(0.031441423540560) },
- { FRAC_CONST(0.999293859866888), FRAC_CONST(0.037573682709270) },
- { FRAC_CONST(0.999044500659429), FRAC_CONST(0.043704527250063) },
- { FRAC_CONST(0.998757527991183), FRAC_CONST(0.049833726340107) },
- { FRAC_CONST(0.998432952666508), FRAC_CONST(0.055961049218521) },
- { FRAC_CONST(0.998070786905482), FRAC_CONST(0.062086265195060) },
- { FRAC_CONST(0.997671044343441), FRAC_CONST(0.068209143658806) },
- { FRAC_CONST(0.997233740030466), FRAC_CONST(0.074329454086846) },
- { FRAC_CONST(0.996758890430818), FRAC_CONST(0.080446966052950) },
- { FRAC_CONST(0.996246513422316), FRAC_CONST(0.086561449236251) },
- { FRAC_CONST(0.995696628295664), FRAC_CONST(0.092672673429913) },
- { FRAC_CONST(0.995109255753726), FRAC_CONST(0.098780408549800) },
- { FRAC_CONST(0.994484417910748), FRAC_CONST(0.104884424643135) },
- { FRAC_CONST(0.993822138291520), FRAC_CONST(0.110984491897163) },
- { FRAC_CONST(0.993122441830496), FRAC_CONST(0.117080380647801) },
- { FRAC_CONST(0.992385354870852), FRAC_CONST(0.123171861388280) },
- { FRAC_CONST(0.991610905163495), FRAC_CONST(0.129258704777796) },
- { FRAC_CONST(0.990799121866020), FRAC_CONST(0.135340681650134) },
- { FRAC_CONST(0.989950035541609), FRAC_CONST(0.141417563022303) },
- { FRAC_CONST(0.989063678157882), FRAC_CONST(0.147489120103154) },
- { FRAC_CONST(0.988140083085693), FRAC_CONST(0.153555124301993) },
- { FRAC_CONST(0.987179285097874), FRAC_CONST(0.159615347237193) },
- { FRAC_CONST(0.986181320367928), FRAC_CONST(0.165669560744784) },
- { FRAC_CONST(0.985146226468662), FRAC_CONST(0.171717536887050) },
- { FRAC_CONST(0.984074042370776), FRAC_CONST(0.177759047961107) },
- { FRAC_CONST(0.982964808441396), FRAC_CONST(0.183793866507478) },
- { FRAC_CONST(0.981818566442553), FRAC_CONST(0.189821765318656) },
- { FRAC_CONST(0.980635359529608), FRAC_CONST(0.195842517447658) },
- { FRAC_CONST(0.979415232249635), FRAC_CONST(0.201855896216568) },
- { FRAC_CONST(0.978158230539735), FRAC_CONST(0.207861675225075) },
- { FRAC_CONST(0.976864401725313), FRAC_CONST(0.213859628358994) },
- { FRAC_CONST(0.975533794518291), FRAC_CONST(0.219849529798779) },
- { FRAC_CONST(0.974166459015280), FRAC_CONST(0.225831154028026) },
- { FRAC_CONST(0.972762446695689), FRAC_CONST(0.231804275841965) },
- { FRAC_CONST(0.971321810419786), FRAC_CONST(0.237768670355934) },
- { FRAC_CONST(0.969844604426715), FRAC_CONST(0.243724113013852) },
- { FRAC_CONST(0.968330884332445), FRAC_CONST(0.249670379596669) },
- { FRAC_CONST(0.966780707127683), FRAC_CONST(0.255607246230807) },
- { FRAC_CONST(0.965194131175725), FRAC_CONST(0.261534489396596) },
- { FRAC_CONST(0.963571216210257), FRAC_CONST(0.267451885936678) },
- { FRAC_CONST(0.961912023333112), FRAC_CONST(0.273359213064419) },
- { FRAC_CONST(0.960216615011963), FRAC_CONST(0.279256248372291) },
- { FRAC_CONST(0.958485055077976), FRAC_CONST(0.285142769840249) },
- { FRAC_CONST(0.956717408723403), FRAC_CONST(0.291018555844085) },
- { FRAC_CONST(0.954913742499131), FRAC_CONST(0.296883385163778) },
- { FRAC_CONST(0.953074124312172), FRAC_CONST(0.302737036991819) },
- { FRAC_CONST(0.951198623423113), FRAC_CONST(0.308579290941525) },
- { FRAC_CONST(0.949287310443502), FRAC_CONST(0.314409927055337) },
- { FRAC_CONST(0.947340257333192), FRAC_CONST(0.320228725813100) },
- { FRAC_CONST(0.945357537397632), FRAC_CONST(0.326035468140330) },
- { FRAC_CONST(0.943339225285108), FRAC_CONST(0.331829935416461) },
- { FRAC_CONST(0.941285396983929), FRAC_CONST(0.337611909483075) },
- { FRAC_CONST(0.939196129819570), FRAC_CONST(0.343381172652115) },
- { FRAC_CONST(0.937071502451759), FRAC_CONST(0.349137507714085) },
- { FRAC_CONST(0.934911594871516), FRAC_CONST(0.354880697946223) },
- { FRAC_CONST(0.932716488398140), FRAC_CONST(0.360610527120662) },
- { FRAC_CONST(0.930486265676150), FRAC_CONST(0.366326779512574) },
- { FRAC_CONST(0.928221010672169), FRAC_CONST(0.372029239908285) },
- { FRAC_CONST(0.925920808671770), FRAC_CONST(0.377717693613386) },
- { FRAC_CONST(0.923585746276257), FRAC_CONST(0.383391926460809) },
- { FRAC_CONST(0.921215911399409), FRAC_CONST(0.389051724818894) },
- { FRAC_CONST(0.918811393264170), FRAC_CONST(0.394696875599434) },
- { FRAC_CONST(0.916372282399289), FRAC_CONST(0.400327166265690) },
- { FRAC_CONST(0.913898670635912), FRAC_CONST(0.405942384840403) },
- { FRAC_CONST(0.911390651104122), FRAC_CONST(0.411542319913765) },
- { FRAC_CONST(0.908848318229439), FRAC_CONST(0.417126760651388) },
- { FRAC_CONST(0.906271767729258), FRAC_CONST(0.422695496802233) },
- { FRAC_CONST(0.903661096609248), FRAC_CONST(0.428248318706532) },
- { FRAC_CONST(0.901016403159702), FRAC_CONST(0.433785017303679) },
- { FRAC_CONST(0.898337786951834), FRAC_CONST(0.439305384140100) },
- { FRAC_CONST(0.895625348834030), FRAC_CONST(0.444809211377105) },
- { FRAC_CONST(0.892879190928052), FRAC_CONST(0.450296291798709) },
- { FRAC_CONST(0.890099416625192), FRAC_CONST(0.455766418819435) },
- { FRAC_CONST(0.887286130582383), FRAC_CONST(0.461219386492092) },
- { FRAC_CONST(0.884439438718254), FRAC_CONST(0.466654989515531) },
- { FRAC_CONST(0.881559448209144), FRAC_CONST(0.472073023242369) },
- { FRAC_CONST(0.878646267485068), FRAC_CONST(0.477473283686698) },
- { FRAC_CONST(0.875700006225635), FRAC_CONST(0.482855567531766) },
- { FRAC_CONST(0.872720775355914), FRAC_CONST(0.488219672137627) },
- { FRAC_CONST(0.869708687042266), FRAC_CONST(0.493565395548775) },
- { FRAC_CONST(0.866663854688111), FRAC_CONST(0.498892536501745) },
- { FRAC_CONST(0.863586392929668), FRAC_CONST(0.504200894432690) },
- { FRAC_CONST(0.860476417631632), FRAC_CONST(0.509490269484936) },
- { FRAC_CONST(0.857334045882816), FRAC_CONST(0.514760462516501) },
- { FRAC_CONST(0.854159395991739), FRAC_CONST(0.520011275107596) },
- { FRAC_CONST(0.850952587482176), FRAC_CONST(0.525242509568095) },
- { FRAC_CONST(0.847713741088654), FRAC_CONST(0.530453968944976) },
- { FRAC_CONST(0.844442978751911), FRAC_CONST(0.535645457029741) },
- { FRAC_CONST(0.841140423614298), FRAC_CONST(0.540816778365797) },
- { FRAC_CONST(0.837806200015151), FRAC_CONST(0.545967738255818) },
- { FRAC_CONST(0.834440433486103), FRAC_CONST(0.551098142769075) },
- { FRAC_CONST(0.831043250746362), FRAC_CONST(0.556207798748740) },
- { FRAC_CONST(0.827614779697938), FRAC_CONST(0.561296513819151) },
- { FRAC_CONST(0.824155149420829), FRAC_CONST(0.566364096393064) },
- { FRAC_CONST(0.820664490168157), FRAC_CONST(0.571410355678857) },
- { FRAC_CONST(0.817142933361273), FRAC_CONST(0.576435101687722) },
- { FRAC_CONST(0.813590611584799), FRAC_CONST(0.581438145240810) },
- { FRAC_CONST(0.810007658581641), FRAC_CONST(0.586419297976361) },
- { FRAC_CONST(0.806394209247956), FRAC_CONST(0.591378372356788) },
- { FRAC_CONST(0.802750399628069), FRAC_CONST(0.596315181675744) },
- { FRAC_CONST(0.799076366909352), FRAC_CONST(0.601229540065149) },
- { FRAC_CONST(0.795372249417061), FRAC_CONST(0.606121262502186) },
- { FRAC_CONST(0.791638186609126), FRAC_CONST(0.610990164816272) },
- { FRAC_CONST(0.787874319070900), FRAC_CONST(0.615836063695985) },
- { FRAC_CONST(0.784080788509870), FRAC_CONST(0.620658776695972) },
- { FRAC_CONST(0.780257737750317), FRAC_CONST(0.625458122243814) },
- { FRAC_CONST(0.776405310727940), FRAC_CONST(0.630233919646864) },
- { FRAC_CONST(0.772523652484441), FRAC_CONST(0.634985989099049) },
- { FRAC_CONST(0.768612909162058), FRAC_CONST(0.639714151687640) },
- { FRAC_CONST(0.764673227998067), FRAC_CONST(0.644418229399988) },
- { FRAC_CONST(0.760704757319237), FRAC_CONST(0.649098045130226) },
- { FRAC_CONST(0.756707646536246), FRAC_CONST(0.653753422685936) },
- { FRAC_CONST(0.752682046138055), FRAC_CONST(0.658384186794785) },
- { FRAC_CONST(0.748628107686245), FRAC_CONST(0.662990163111121) },
- { FRAC_CONST(0.744545983809307), FRAC_CONST(0.667571178222540) },
- { FRAC_CONST(0.740435828196898), FRAC_CONST(0.672127059656412) },
- { FRAC_CONST(0.736297795594053), FRAC_CONST(0.676657635886375) },
- { FRAC_CONST(0.732132041795361), FRAC_CONST(0.681162736338795) },
- { FRAC_CONST(0.727938723639099), FRAC_CONST(0.685642191399187) },
- { FRAC_CONST(0.723717999001324), FRAC_CONST(0.690095832418600) },
- { FRAC_CONST(0.719470026789933), FRAC_CONST(0.694523491719966) },
- { FRAC_CONST(0.715194966938680), FRAC_CONST(0.698925002604414) },
- { FRAC_CONST(0.710892980401152), FRAC_CONST(0.703300199357549) },
- { FRAC_CONST(0.706564229144710), FRAC_CONST(0.707648917255684) },
- { FRAC_CONST(0.702208876144392), FRAC_CONST(0.711970992572050) },
- { FRAC_CONST(0.697827085376777), FRAC_CONST(0.716266262582953) },
- { FRAC_CONST(0.693419021813812), FRAC_CONST(0.720534565573905) },
- { FRAC_CONST(0.688984851416597), FRAC_CONST(0.724775740845711) },
- { FRAC_CONST(0.684524741129142), FRAC_CONST(0.728989628720519) },
- { FRAC_CONST(0.680038858872079), FRAC_CONST(0.733176070547833) },
- { FRAC_CONST(0.675527373536339), FRAC_CONST(0.737334908710483) },
- { FRAC_CONST(0.670990454976794), FRAC_CONST(0.741465986630563) },
- { FRAC_CONST(0.666428274005865), FRAC_CONST(0.745569148775325) },
- { FRAC_CONST(0.661841002387087), FRAC_CONST(0.749644240663033) },
- { FRAC_CONST(0.657228812828643), FRAC_CONST(0.753691108868781) },
- { FRAC_CONST(0.652591878976863), FRAC_CONST(0.757709601030268) },
- { FRAC_CONST(0.647930375409685), FRAC_CONST(0.761699565853535) },
- { FRAC_CONST(0.643244477630086), FRAC_CONST(0.765660853118662) },
- { FRAC_CONST(0.638534362059467), FRAC_CONST(0.769593313685423) },
- { FRAC_CONST(0.633800206031017), FRAC_CONST(0.773496799498899) },
- { FRAC_CONST(0.629042187783036), FRAC_CONST(0.777371163595056) },
- { FRAC_CONST(0.624260486452221), FRAC_CONST(0.781216260106276) },
- { FRAC_CONST(0.619455282066924), FRAC_CONST(0.785031944266848) },
- { FRAC_CONST(0.614626755540375), FRAC_CONST(0.788818072418420) },
- { FRAC_CONST(0.609775088663868), FRAC_CONST(0.792574502015408) },
- { FRAC_CONST(0.604900464099920), FRAC_CONST(0.796301091630359) },
- { FRAC_CONST(0.600003065375389), FRAC_CONST(0.799997700959282) },
- { FRAC_CONST(0.595083076874570), FRAC_CONST(0.803664190826924) },
- { FRAC_CONST(0.590140683832249), FRAC_CONST(0.807300423192014) },
- { FRAC_CONST(0.585176072326730), FRAC_CONST(0.810906261152460) },
- { FRAC_CONST(0.580189429272832), FRAC_CONST(0.814481568950499) },
- { FRAC_CONST(0.575180942414845), FRAC_CONST(0.818026211977813) },
- { FRAC_CONST(0.570150800319470), FRAC_CONST(0.821540056780598) },
- { FRAC_CONST(0.565099192368714), FRAC_CONST(0.825022971064580) },
- { FRAC_CONST(0.560026308752760), FRAC_CONST(0.828474823700007) },
- { FRAC_CONST(0.554932340462810), FRAC_CONST(0.831895484726578) },
- { FRAC_CONST(0.549817479283891), FRAC_CONST(0.835284825358337) },
- { FRAC_CONST(0.544681917787635), FRAC_CONST(0.838642717988527) },
- { FRAC_CONST(0.539525849325029), FRAC_CONST(0.841969036194388) },
- { FRAC_CONST(0.534349468019138), FRAC_CONST(0.845263654741918) },
- { FRAC_CONST(0.529152968757791), FRAC_CONST(0.848526449590593) },
- { FRAC_CONST(0.523936547186249), FRAC_CONST(0.851757297898029) },
- { FRAC_CONST(0.518700399699835), FRAC_CONST(0.854956078024615) },
- { FRAC_CONST(0.513444723436544), FRAC_CONST(0.858122669538086) },
- { FRAC_CONST(0.508169716269615), FRAC_CONST(0.861256953218062) },
- { FRAC_CONST(0.502875576800087), FRAC_CONST(0.864358811060534) },
- { FRAC_CONST(0.497562504349319), FRAC_CONST(0.867428126282307) },
- { FRAC_CONST(0.492230698951486), FRAC_CONST(0.870464783325398) },
- { FRAC_CONST(0.486880361346047), FRAC_CONST(0.873468667861385) },
- { FRAC_CONST(0.481511692970190), FRAC_CONST(0.876439666795714) },
- { FRAC_CONST(0.476124895951244), FRAC_CONST(0.879377668271953) },
- { FRAC_CONST(0.470720173099072), FRAC_CONST(0.882282561676009) },
- { FRAC_CONST(0.465297727898435), FRAC_CONST(0.885154237640285) },
- { FRAC_CONST(0.459857764501330), FRAC_CONST(0.887992588047806) },
- { FRAC_CONST(0.454400487719304), FRAC_CONST(0.890797506036281) },
- { FRAC_CONST(0.448926103015743), FRAC_CONST(0.893568886002136) },
- { FRAC_CONST(0.443434816498138), FRAC_CONST(0.896306623604480) },
- { FRAC_CONST(0.437926834910323), FRAC_CONST(0.899010615769039) },
- { FRAC_CONST(0.432402365624690), FRAC_CONST(0.901680760692038) },
- { FRAC_CONST(0.426861616634386), FRAC_CONST(0.904316957844028) },
- { FRAC_CONST(0.421304796545480), FRAC_CONST(0.906919107973678) },
- { FRAC_CONST(0.415732114569105), FRAC_CONST(0.909487113111505) },
- { FRAC_CONST(0.410143780513590), FRAC_CONST(0.912020876573568) },
- { FRAC_CONST(0.404540004776553), FRAC_CONST(0.914520302965104) },
- { FRAC_CONST(0.398920998336983), FRAC_CONST(0.916985298184123) },
- { FRAC_CONST(0.393286972747297), FRAC_CONST(0.919415769424947) },
- { FRAC_CONST(0.387638140125373), FRAC_CONST(0.921811625181708) },
- { FRAC_CONST(0.381974713146567), FRAC_CONST(0.924172775251791) },
- { FRAC_CONST(0.376296905035705), FRAC_CONST(0.926499130739231) },
- { FRAC_CONST(0.370604929559052), FRAC_CONST(0.928790604058057) },
- { FRAC_CONST(0.364899001016267), FRAC_CONST(0.931047108935595) },
- { FRAC_CONST(0.359179334232337), FRAC_CONST(0.933268560415712) },
- { FRAC_CONST(0.353446144549481), FRAC_CONST(0.935454874862015) },
- { FRAC_CONST(0.347699647819051), FRAC_CONST(0.937605969961000) },
- { FRAC_CONST(0.341940060393402), FRAC_CONST(0.939721764725153) },
- { FRAC_CONST(0.336167599117745), FRAC_CONST(0.941802179495998) },
- { FRAC_CONST(0.330382481321983), FRAC_CONST(0.943847135947093) },
- { FRAC_CONST(0.324584924812532), FRAC_CONST(0.945856557086984) },
- { FRAC_CONST(0.318775147864118), FRAC_CONST(0.947830367262101) },
- { FRAC_CONST(0.312953369211560), FRAC_CONST(0.949768492159607) },
- { FRAC_CONST(0.307119808041533), FRAC_CONST(0.951670858810194) },
- { FRAC_CONST(0.301274683984318), FRAC_CONST(0.953537395590833) },
- { FRAC_CONST(0.295418217105532), FRAC_CONST(0.955368032227470) },
- { FRAC_CONST(0.289550627897843), FRAC_CONST(0.957162699797670) },
- { FRAC_CONST(0.283672137272669), FRAC_CONST(0.958921330733213) },
- { FRAC_CONST(0.277782966551858), FRAC_CONST(0.960643858822638) },
- { FRAC_CONST(0.271883337459360), FRAC_CONST(0.962330219213737) },
- { FRAC_CONST(0.265973472112876), FRAC_CONST(0.963980348415994) },
- { FRAC_CONST(0.260053593015495), FRAC_CONST(0.965594184302977) },
- { FRAC_CONST(0.254123923047321), FRAC_CONST(0.967171666114677) },
- { FRAC_CONST(0.248184685457075), FRAC_CONST(0.968712734459795) },
- { FRAC_CONST(0.242236103853696), FRAC_CONST(0.970217331317979) },
- { FRAC_CONST(0.236278402197920), FRAC_CONST(0.971685400042009) },
- { FRAC_CONST(0.230311804793846), FRAC_CONST(0.973116885359925) },
- { FRAC_CONST(0.224336536280494), FRAC_CONST(0.974511733377116) },
- { FRAC_CONST(0.218352821623346), FRAC_CONST(0.975869891578341) },
- { FRAC_CONST(0.212360886105879), FRAC_CONST(0.977191308829712) },
- { FRAC_CONST(0.206360955321076), FRAC_CONST(0.978475935380617) },
- { FRAC_CONST(0.200353255162940), FRAC_CONST(0.979723722865591) },
- { FRAC_CONST(0.194338011817989), FRAC_CONST(0.980934624306142) },
- { FRAC_CONST(0.188315451756732), FRAC_CONST(0.982108594112514) },
- { FRAC_CONST(0.182285801725153), FRAC_CONST(0.983245588085407) },
- { FRAC_CONST(0.176249288736168), FRAC_CONST(0.984345563417642) },
- { FRAC_CONST(0.170206140061078), FRAC_CONST(0.985408478695768) },
- { FRAC_CONST(0.164156583221016), FRAC_CONST(0.986434293901627) },
- { FRAC_CONST(0.158100845978377), FRAC_CONST(0.987422970413855) },
- { FRAC_CONST(0.152039156328246), FRAC_CONST(0.988374471009341) },
- { FRAC_CONST(0.145971742489812), FRAC_CONST(0.989288759864625) },
- { FRAC_CONST(0.139898832897777), FRAC_CONST(0.990165802557248) },
- { FRAC_CONST(0.133820656193755), FRAC_CONST(0.991005566067049) },
- { FRAC_CONST(0.127737441217662), FRAC_CONST(0.991808018777406) },
- { FRAC_CONST(0.121649416999106), FRAC_CONST(0.992573130476429) },
- { FRAC_CONST(0.115556812748755), FRAC_CONST(0.993300872358093) },
- { FRAC_CONST(0.109459857849718), FRAC_CONST(0.993991217023329) },
- { FRAC_CONST(0.103358781848900), FRAC_CONST(0.994644138481051) },
- { FRAC_CONST(0.097253814448363), FRAC_CONST(0.995259612149133) },
- { FRAC_CONST(0.091145185496681), FRAC_CONST(0.995837614855342) },
- { FRAC_CONST(0.085033124980280), FRAC_CONST(0.996378124838200) },
- { FRAC_CONST(0.078917863014785), FRAC_CONST(0.996881121747814) },
- { FRAC_CONST(0.072799629836352), FRAC_CONST(0.997346586646633) },
- { FRAC_CONST(0.066678655793002), FRAC_CONST(0.997774502010168) },
- { FRAC_CONST(0.060555171335948), FRAC_CONST(0.998164851727646) },
- { FRAC_CONST(0.054429407010919), FRAC_CONST(0.998517621102622) },
- { FRAC_CONST(0.048301593449480), FRAC_CONST(0.998832796853528) },
- { FRAC_CONST(0.042171961360348), FRAC_CONST(0.999110367114175) },
- { FRAC_CONST(0.036040741520706), FRAC_CONST(0.999350321434199) },
- { FRAC_CONST(0.029908164767517), FRAC_CONST(0.999552650779457) },
- { FRAC_CONST(0.023774461988828), FRAC_CONST(0.999717347532362) },
- { FRAC_CONST(0.017639864115082), FRAC_CONST(0.999844405492175) },
- { FRAC_CONST(0.011504602110423), FRAC_CONST(0.999933819875236) },
- { FRAC_CONST(0.005368906963996), FRAC_CONST(0.999985587315143) }
- };
+/* 256 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1024[] =
+{
+ { FRAC_CONST(0.999999705862882), FRAC_CONST(0.000766990318743) },
+ { FRAC_CONST(0.999976174986898), FRAC_CONST(0.006902858724730) },
+ { FRAC_CONST(0.999914995573113), FRAC_CONST(0.013038467241987) },
+ { FRAC_CONST(0.999816169924900), FRAC_CONST(0.019173584868323) },
+ { FRAC_CONST(0.999679701762988), FRAC_CONST(0.025307980620025) },
+ { FRAC_CONST(0.999505596225325), FRAC_CONST(0.031441423540560) },
+ { FRAC_CONST(0.999293859866888), FRAC_CONST(0.037573682709270) },
+ { FRAC_CONST(0.999044500659429), FRAC_CONST(0.043704527250063) },
+ { FRAC_CONST(0.998757527991183), FRAC_CONST(0.049833726340107) },
+ { FRAC_CONST(0.998432952666508), FRAC_CONST(0.055961049218521) },
+ { FRAC_CONST(0.998070786905482), FRAC_CONST(0.062086265195060) },
+ { FRAC_CONST(0.997671044343441), FRAC_CONST(0.068209143658806) },
+ { FRAC_CONST(0.997233740030466), FRAC_CONST(0.074329454086846) },
+ { FRAC_CONST(0.996758890430818), FRAC_CONST(0.080446966052950) },
+ { FRAC_CONST(0.996246513422316), FRAC_CONST(0.086561449236251) },
+ { FRAC_CONST(0.995696628295664), FRAC_CONST(0.092672673429913) },
+ { FRAC_CONST(0.995109255753726), FRAC_CONST(0.098780408549800) },
+ { FRAC_CONST(0.994484417910748), FRAC_CONST(0.104884424643135) },
+ { FRAC_CONST(0.993822138291520), FRAC_CONST(0.110984491897163) },
+ { FRAC_CONST(0.993122441830496), FRAC_CONST(0.117080380647801) },
+ { FRAC_CONST(0.992385354870852), FRAC_CONST(0.123171861388280) },
+ { FRAC_CONST(0.991610905163495), FRAC_CONST(0.129258704777796) },
+ { FRAC_CONST(0.990799121866020), FRAC_CONST(0.135340681650134) },
+ { FRAC_CONST(0.989950035541609), FRAC_CONST(0.141417563022303) },
+ { FRAC_CONST(0.989063678157882), FRAC_CONST(0.147489120103154) },
+ { FRAC_CONST(0.988140083085693), FRAC_CONST(0.153555124301993) },
+ { FRAC_CONST(0.987179285097874), FRAC_CONST(0.159615347237193) },
+ { FRAC_CONST(0.986181320367928), FRAC_CONST(0.165669560744784) },
+ { FRAC_CONST(0.985146226468662), FRAC_CONST(0.171717536887050) },
+ { FRAC_CONST(0.984074042370776), FRAC_CONST(0.177759047961107) },
+ { FRAC_CONST(0.982964808441396), FRAC_CONST(0.183793866507478) },
+ { FRAC_CONST(0.981818566442553), FRAC_CONST(0.189821765318656) },
+ { FRAC_CONST(0.980635359529608), FRAC_CONST(0.195842517447658) },
+ { FRAC_CONST(0.979415232249635), FRAC_CONST(0.201855896216568) },
+ { FRAC_CONST(0.978158230539735), FRAC_CONST(0.207861675225075) },
+ { FRAC_CONST(0.976864401725313), FRAC_CONST(0.213859628358994) },
+ { FRAC_CONST(0.975533794518291), FRAC_CONST(0.219849529798779) },
+ { FRAC_CONST(0.974166459015280), FRAC_CONST(0.225831154028026) },
+ { FRAC_CONST(0.972762446695689), FRAC_CONST(0.231804275841965) },
+ { FRAC_CONST(0.971321810419786), FRAC_CONST(0.237768670355934) },
+ { FRAC_CONST(0.969844604426715), FRAC_CONST(0.243724113013852) },
+ { FRAC_CONST(0.968330884332445), FRAC_CONST(0.249670379596669) },
+ { FRAC_CONST(0.966780707127683), FRAC_CONST(0.255607246230807) },
+ { FRAC_CONST(0.965194131175725), FRAC_CONST(0.261534489396596) },
+ { FRAC_CONST(0.963571216210257), FRAC_CONST(0.267451885936678) },
+ { FRAC_CONST(0.961912023333112), FRAC_CONST(0.273359213064419) },
+ { FRAC_CONST(0.960216615011963), FRAC_CONST(0.279256248372291) },
+ { FRAC_CONST(0.958485055077976), FRAC_CONST(0.285142769840249) },
+ { FRAC_CONST(0.956717408723403), FRAC_CONST(0.291018555844085) },
+ { FRAC_CONST(0.954913742499131), FRAC_CONST(0.296883385163778) },
+ { FRAC_CONST(0.953074124312172), FRAC_CONST(0.302737036991819) },
+ { FRAC_CONST(0.951198623423113), FRAC_CONST(0.308579290941525) },
+ { FRAC_CONST(0.949287310443502), FRAC_CONST(0.314409927055337) },
+ { FRAC_CONST(0.947340257333192), FRAC_CONST(0.320228725813100) },
+ { FRAC_CONST(0.945357537397632), FRAC_CONST(0.326035468140330) },
+ { FRAC_CONST(0.943339225285108), FRAC_CONST(0.331829935416461) },
+ { FRAC_CONST(0.941285396983929), FRAC_CONST(0.337611909483075) },
+ { FRAC_CONST(0.939196129819570), FRAC_CONST(0.343381172652115) },
+ { FRAC_CONST(0.937071502451759), FRAC_CONST(0.349137507714085) },
+ { FRAC_CONST(0.934911594871516), FRAC_CONST(0.354880697946223) },
+ { FRAC_CONST(0.932716488398140), FRAC_CONST(0.360610527120662) },
+ { FRAC_CONST(0.930486265676150), FRAC_CONST(0.366326779512574) },
+ { FRAC_CONST(0.928221010672169), FRAC_CONST(0.372029239908285) },
+ { FRAC_CONST(0.925920808671770), FRAC_CONST(0.377717693613386) },
+ { FRAC_CONST(0.923585746276257), FRAC_CONST(0.383391926460809) },
+ { FRAC_CONST(0.921215911399409), FRAC_CONST(0.389051724818894) },
+ { FRAC_CONST(0.918811393264170), FRAC_CONST(0.394696875599434) },
+ { FRAC_CONST(0.916372282399289), FRAC_CONST(0.400327166265690) },
+ { FRAC_CONST(0.913898670635912), FRAC_CONST(0.405942384840403) },
+ { FRAC_CONST(0.911390651104122), FRAC_CONST(0.411542319913765) },
+ { FRAC_CONST(0.908848318229439), FRAC_CONST(0.417126760651388) },
+ { FRAC_CONST(0.906271767729258), FRAC_CONST(0.422695496802233) },
+ { FRAC_CONST(0.903661096609248), FRAC_CONST(0.428248318706532) },
+ { FRAC_CONST(0.901016403159702), FRAC_CONST(0.433785017303679) },
+ { FRAC_CONST(0.898337786951834), FRAC_CONST(0.439305384140100) },
+ { FRAC_CONST(0.895625348834030), FRAC_CONST(0.444809211377105) },
+ { FRAC_CONST(0.892879190928052), FRAC_CONST(0.450296291798709) },
+ { FRAC_CONST(0.890099416625192), FRAC_CONST(0.455766418819435) },
+ { FRAC_CONST(0.887286130582383), FRAC_CONST(0.461219386492092) },
+ { FRAC_CONST(0.884439438718254), FRAC_CONST(0.466654989515531) },
+ { FRAC_CONST(0.881559448209144), FRAC_CONST(0.472073023242369) },
+ { FRAC_CONST(0.878646267485068), FRAC_CONST(0.477473283686698) },
+ { FRAC_CONST(0.875700006225635), FRAC_CONST(0.482855567531766) },
+ { FRAC_CONST(0.872720775355914), FRAC_CONST(0.488219672137627) },
+ { FRAC_CONST(0.869708687042266), FRAC_CONST(0.493565395548775) },
+ { FRAC_CONST(0.866663854688111), FRAC_CONST(0.498892536501745) },
+ { FRAC_CONST(0.863586392929668), FRAC_CONST(0.504200894432690) },
+ { FRAC_CONST(0.860476417631632), FRAC_CONST(0.509490269484936) },
+ { FRAC_CONST(0.857334045882816), FRAC_CONST(0.514760462516501) },
+ { FRAC_CONST(0.854159395991739), FRAC_CONST(0.520011275107596) },
+ { FRAC_CONST(0.850952587482176), FRAC_CONST(0.525242509568095) },
+ { FRAC_CONST(0.847713741088654), FRAC_CONST(0.530453968944976) },
+ { FRAC_CONST(0.844442978751911), FRAC_CONST(0.535645457029741) },
+ { FRAC_CONST(0.841140423614298), FRAC_CONST(0.540816778365797) },
+ { FRAC_CONST(0.837806200015151), FRAC_CONST(0.545967738255818) },
+ { FRAC_CONST(0.834440433486103), FRAC_CONST(0.551098142769075) },
+ { FRAC_CONST(0.831043250746362), FRAC_CONST(0.556207798748740) },
+ { FRAC_CONST(0.827614779697938), FRAC_CONST(0.561296513819151) },
+ { FRAC_CONST(0.824155149420829), FRAC_CONST(0.566364096393064) },
+ { FRAC_CONST(0.820664490168157), FRAC_CONST(0.571410355678857) },
+ { FRAC_CONST(0.817142933361273), FRAC_CONST(0.576435101687722) },
+ { FRAC_CONST(0.813590611584799), FRAC_CONST(0.581438145240810) },
+ { FRAC_CONST(0.810007658581641), FRAC_CONST(0.586419297976361) },
+ { FRAC_CONST(0.806394209247956), FRAC_CONST(0.591378372356788) },
+ { FRAC_CONST(0.802750399628069), FRAC_CONST(0.596315181675744) },
+ { FRAC_CONST(0.799076366909352), FRAC_CONST(0.601229540065149) },
+ { FRAC_CONST(0.795372249417061), FRAC_CONST(0.606121262502186) },
+ { FRAC_CONST(0.791638186609126), FRAC_CONST(0.610990164816272) },
+ { FRAC_CONST(0.787874319070900), FRAC_CONST(0.615836063695985) },
+ { FRAC_CONST(0.784080788509870), FRAC_CONST(0.620658776695972) },
+ { FRAC_CONST(0.780257737750317), FRAC_CONST(0.625458122243814) },
+ { FRAC_CONST(0.776405310727940), FRAC_CONST(0.630233919646864) },
+ { FRAC_CONST(0.772523652484441), FRAC_CONST(0.634985989099049) },
+ { FRAC_CONST(0.768612909162058), FRAC_CONST(0.639714151687640) },
+ { FRAC_CONST(0.764673227998067), FRAC_CONST(0.644418229399988) },
+ { FRAC_CONST(0.760704757319237), FRAC_CONST(0.649098045130226) },
+ { FRAC_CONST(0.756707646536246), FRAC_CONST(0.653753422685936) },
+ { FRAC_CONST(0.752682046138055), FRAC_CONST(0.658384186794785) },
+ { FRAC_CONST(0.748628107686245), FRAC_CONST(0.662990163111121) },
+ { FRAC_CONST(0.744545983809307), FRAC_CONST(0.667571178222540) },
+ { FRAC_CONST(0.740435828196898), FRAC_CONST(0.672127059656412) },
+ { FRAC_CONST(0.736297795594053), FRAC_CONST(0.676657635886375) },
+ { FRAC_CONST(0.732132041795361), FRAC_CONST(0.681162736338795) },
+ { FRAC_CONST(0.727938723639099), FRAC_CONST(0.685642191399187) },
+ { FRAC_CONST(0.723717999001324), FRAC_CONST(0.690095832418600) },
+ { FRAC_CONST(0.719470026789933), FRAC_CONST(0.694523491719966) },
+ { FRAC_CONST(0.715194966938680), FRAC_CONST(0.698925002604414) },
+ { FRAC_CONST(0.710892980401152), FRAC_CONST(0.703300199357549) },
+ { FRAC_CONST(0.706564229144710), FRAC_CONST(0.707648917255684) },
+ { FRAC_CONST(0.702208876144392), FRAC_CONST(0.711970992572050) },
+ { FRAC_CONST(0.697827085376777), FRAC_CONST(0.716266262582953) },
+ { FRAC_CONST(0.693419021813812), FRAC_CONST(0.720534565573905) },
+ { FRAC_CONST(0.688984851416597), FRAC_CONST(0.724775740845711) },
+ { FRAC_CONST(0.684524741129142), FRAC_CONST(0.728989628720519) },
+ { FRAC_CONST(0.680038858872079), FRAC_CONST(0.733176070547833) },
+ { FRAC_CONST(0.675527373536339), FRAC_CONST(0.737334908710483) },
+ { FRAC_CONST(0.670990454976794), FRAC_CONST(0.741465986630563) },
+ { FRAC_CONST(0.666428274005865), FRAC_CONST(0.745569148775325) },
+ { FRAC_CONST(0.661841002387087), FRAC_CONST(0.749644240663033) },
+ { FRAC_CONST(0.657228812828643), FRAC_CONST(0.753691108868781) },
+ { FRAC_CONST(0.652591878976863), FRAC_CONST(0.757709601030268) },
+ { FRAC_CONST(0.647930375409685), FRAC_CONST(0.761699565853535) },
+ { FRAC_CONST(0.643244477630086), FRAC_CONST(0.765660853118662) },
+ { FRAC_CONST(0.638534362059467), FRAC_CONST(0.769593313685423) },
+ { FRAC_CONST(0.633800206031017), FRAC_CONST(0.773496799498899) },
+ { FRAC_CONST(0.629042187783036), FRAC_CONST(0.777371163595056) },
+ { FRAC_CONST(0.624260486452221), FRAC_CONST(0.781216260106276) },
+ { FRAC_CONST(0.619455282066924), FRAC_CONST(0.785031944266848) },
+ { FRAC_CONST(0.614626755540375), FRAC_CONST(0.788818072418420) },
+ { FRAC_CONST(0.609775088663868), FRAC_CONST(0.792574502015408) },
+ { FRAC_CONST(0.604900464099920), FRAC_CONST(0.796301091630359) },
+ { FRAC_CONST(0.600003065375389), FRAC_CONST(0.799997700959282) },
+ { FRAC_CONST(0.595083076874570), FRAC_CONST(0.803664190826924) },
+ { FRAC_CONST(0.590140683832249), FRAC_CONST(0.807300423192014) },
+ { FRAC_CONST(0.585176072326730), FRAC_CONST(0.810906261152460) },
+ { FRAC_CONST(0.580189429272832), FRAC_CONST(0.814481568950499) },
+ { FRAC_CONST(0.575180942414845), FRAC_CONST(0.818026211977813) },
+ { FRAC_CONST(0.570150800319470), FRAC_CONST(0.821540056780598) },
+ { FRAC_CONST(0.565099192368714), FRAC_CONST(0.825022971064580) },
+ { FRAC_CONST(0.560026308752760), FRAC_CONST(0.828474823700007) },
+ { FRAC_CONST(0.554932340462810), FRAC_CONST(0.831895484726578) },
+ { FRAC_CONST(0.549817479283891), FRAC_CONST(0.835284825358337) },
+ { FRAC_CONST(0.544681917787635), FRAC_CONST(0.838642717988527) },
+ { FRAC_CONST(0.539525849325029), FRAC_CONST(0.841969036194388) },
+ { FRAC_CONST(0.534349468019138), FRAC_CONST(0.845263654741918) },
+ { FRAC_CONST(0.529152968757791), FRAC_CONST(0.848526449590593) },
+ { FRAC_CONST(0.523936547186249), FRAC_CONST(0.851757297898029) },
+ { FRAC_CONST(0.518700399699835), FRAC_CONST(0.854956078024615) },
+ { FRAC_CONST(0.513444723436544), FRAC_CONST(0.858122669538086) },
+ { FRAC_CONST(0.508169716269615), FRAC_CONST(0.861256953218062) },
+ { FRAC_CONST(0.502875576800087), FRAC_CONST(0.864358811060534) },
+ { FRAC_CONST(0.497562504349319), FRAC_CONST(0.867428126282307) },
+ { FRAC_CONST(0.492230698951486), FRAC_CONST(0.870464783325398) },
+ { FRAC_CONST(0.486880361346047), FRAC_CONST(0.873468667861385) },
+ { FRAC_CONST(0.481511692970190), FRAC_CONST(0.876439666795714) },
+ { FRAC_CONST(0.476124895951244), FRAC_CONST(0.879377668271953) },
+ { FRAC_CONST(0.470720173099072), FRAC_CONST(0.882282561676009) },
+ { FRAC_CONST(0.465297727898435), FRAC_CONST(0.885154237640285) },
+ { FRAC_CONST(0.459857764501330), FRAC_CONST(0.887992588047806) },
+ { FRAC_CONST(0.454400487719304), FRAC_CONST(0.890797506036281) },
+ { FRAC_CONST(0.448926103015743), FRAC_CONST(0.893568886002136) },
+ { FRAC_CONST(0.443434816498138), FRAC_CONST(0.896306623604480) },
+ { FRAC_CONST(0.437926834910323), FRAC_CONST(0.899010615769039) },
+ { FRAC_CONST(0.432402365624690), FRAC_CONST(0.901680760692038) },
+ { FRAC_CONST(0.426861616634386), FRAC_CONST(0.904316957844028) },
+ { FRAC_CONST(0.421304796545480), FRAC_CONST(0.906919107973678) },
+ { FRAC_CONST(0.415732114569105), FRAC_CONST(0.909487113111505) },
+ { FRAC_CONST(0.410143780513590), FRAC_CONST(0.912020876573568) },
+ { FRAC_CONST(0.404540004776553), FRAC_CONST(0.914520302965104) },
+ { FRAC_CONST(0.398920998336983), FRAC_CONST(0.916985298184123) },
+ { FRAC_CONST(0.393286972747297), FRAC_CONST(0.919415769424947) },
+ { FRAC_CONST(0.387638140125373), FRAC_CONST(0.921811625181708) },
+ { FRAC_CONST(0.381974713146567), FRAC_CONST(0.924172775251791) },
+ { FRAC_CONST(0.376296905035705), FRAC_CONST(0.926499130739231) },
+ { FRAC_CONST(0.370604929559052), FRAC_CONST(0.928790604058057) },
+ { FRAC_CONST(0.364899001016267), FRAC_CONST(0.931047108935595) },
+ { FRAC_CONST(0.359179334232337), FRAC_CONST(0.933268560415712) },
+ { FRAC_CONST(0.353446144549481), FRAC_CONST(0.935454874862015) },
+ { FRAC_CONST(0.347699647819051), FRAC_CONST(0.937605969961000) },
+ { FRAC_CONST(0.341940060393402), FRAC_CONST(0.939721764725153) },
+ { FRAC_CONST(0.336167599117745), FRAC_CONST(0.941802179495998) },
+ { FRAC_CONST(0.330382481321983), FRAC_CONST(0.943847135947093) },
+ { FRAC_CONST(0.324584924812532), FRAC_CONST(0.945856557086984) },
+ { FRAC_CONST(0.318775147864118), FRAC_CONST(0.947830367262101) },
+ { FRAC_CONST(0.312953369211560), FRAC_CONST(0.949768492159607) },
+ { FRAC_CONST(0.307119808041533), FRAC_CONST(0.951670858810194) },
+ { FRAC_CONST(0.301274683984318), FRAC_CONST(0.953537395590833) },
+ { FRAC_CONST(0.295418217105532), FRAC_CONST(0.955368032227470) },
+ { FRAC_CONST(0.289550627897843), FRAC_CONST(0.957162699797670) },
+ { FRAC_CONST(0.283672137272669), FRAC_CONST(0.958921330733213) },
+ { FRAC_CONST(0.277782966551858), FRAC_CONST(0.960643858822638) },
+ { FRAC_CONST(0.271883337459360), FRAC_CONST(0.962330219213737) },
+ { FRAC_CONST(0.265973472112876), FRAC_CONST(0.963980348415994) },
+ { FRAC_CONST(0.260053593015495), FRAC_CONST(0.965594184302977) },
+ { FRAC_CONST(0.254123923047321), FRAC_CONST(0.967171666114677) },
+ { FRAC_CONST(0.248184685457075), FRAC_CONST(0.968712734459795) },
+ { FRAC_CONST(0.242236103853696), FRAC_CONST(0.970217331317979) },
+ { FRAC_CONST(0.236278402197920), FRAC_CONST(0.971685400042009) },
+ { FRAC_CONST(0.230311804793846), FRAC_CONST(0.973116885359925) },
+ { FRAC_CONST(0.224336536280494), FRAC_CONST(0.974511733377116) },
+ { FRAC_CONST(0.218352821623346), FRAC_CONST(0.975869891578341) },
+ { FRAC_CONST(0.212360886105879), FRAC_CONST(0.977191308829712) },
+ { FRAC_CONST(0.206360955321076), FRAC_CONST(0.978475935380617) },
+ { FRAC_CONST(0.200353255162940), FRAC_CONST(0.979723722865591) },
+ { FRAC_CONST(0.194338011817989), FRAC_CONST(0.980934624306142) },
+ { FRAC_CONST(0.188315451756732), FRAC_CONST(0.982108594112514) },
+ { FRAC_CONST(0.182285801725153), FRAC_CONST(0.983245588085407) },
+ { FRAC_CONST(0.176249288736168), FRAC_CONST(0.984345563417642) },
+ { FRAC_CONST(0.170206140061078), FRAC_CONST(0.985408478695768) },
+ { FRAC_CONST(0.164156583221016), FRAC_CONST(0.986434293901627) },
+ { FRAC_CONST(0.158100845978377), FRAC_CONST(0.987422970413855) },
+ { FRAC_CONST(0.152039156328246), FRAC_CONST(0.988374471009341) },
+ { FRAC_CONST(0.145971742489812), FRAC_CONST(0.989288759864625) },
+ { FRAC_CONST(0.139898832897777), FRAC_CONST(0.990165802557248) },
+ { FRAC_CONST(0.133820656193755), FRAC_CONST(0.991005566067049) },
+ { FRAC_CONST(0.127737441217662), FRAC_CONST(0.991808018777406) },
+ { FRAC_CONST(0.121649416999106), FRAC_CONST(0.992573130476429) },
+ { FRAC_CONST(0.115556812748755), FRAC_CONST(0.993300872358093) },
+ { FRAC_CONST(0.109459857849718), FRAC_CONST(0.993991217023329) },
+ { FRAC_CONST(0.103358781848900), FRAC_CONST(0.994644138481051) },
+ { FRAC_CONST(0.097253814448363), FRAC_CONST(0.995259612149133) },
+ { FRAC_CONST(0.091145185496681), FRAC_CONST(0.995837614855342) },
+ { FRAC_CONST(0.085033124980280), FRAC_CONST(0.996378124838200) },
+ { FRAC_CONST(0.078917863014785), FRAC_CONST(0.996881121747814) },
+ { FRAC_CONST(0.072799629836352), FRAC_CONST(0.997346586646633) },
+ { FRAC_CONST(0.066678655793002), FRAC_CONST(0.997774502010168) },
+ { FRAC_CONST(0.060555171335948), FRAC_CONST(0.998164851727646) },
+ { FRAC_CONST(0.054429407010919), FRAC_CONST(0.998517621102622) },
+ { FRAC_CONST(0.048301593449480), FRAC_CONST(0.998832796853528) },
+ { FRAC_CONST(0.042171961360348), FRAC_CONST(0.999110367114175) },
+ { FRAC_CONST(0.036040741520706), FRAC_CONST(0.999350321434199) },
+ { FRAC_CONST(0.029908164767517), FRAC_CONST(0.999552650779457) },
+ { FRAC_CONST(0.023774461988828), FRAC_CONST(0.999717347532362) },
+ { FRAC_CONST(0.017639864115082), FRAC_CONST(0.999844405492175) },
+ { FRAC_CONST(0.011504602110423), FRAC_CONST(0.999933819875236) },
+ { FRAC_CONST(0.005368906963996), FRAC_CONST(0.999985587315143) }
+};
#endif // LD_DEC
#ifdef ALLOW_SMALL_FRAMELENGTH
- /* 480 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_1920[] =
- {
- { FRAC_CONST(0.999999916334328), FRAC_CONST(0.000409061532028) },
- { FRAC_CONST(0.999993223088129), FRAC_CONST(0.003681545574400) },
- { FRAC_CONST(0.999975820717897), FRAC_CONST(0.006953990190376) },
- { FRAC_CONST(0.999947709409999), FRAC_CONST(0.010226360334704) },
- { FRAC_CONST(0.999908889465485), FRAC_CONST(0.013498620962929) },
- { FRAC_CONST(0.999859361300084), FRAC_CONST(0.016770737031768) },
- { FRAC_CONST(0.999799125444203), FRAC_CONST(0.020042673499487) },
- { FRAC_CONST(0.999728182542920), FRAC_CONST(0.023314395326274) },
- { FRAC_CONST(0.999646533355977), FRAC_CONST(0.026585867474619) },
- { FRAC_CONST(0.999554178757770), FRAC_CONST(0.029857054909681) },
- { FRAC_CONST(0.999451119737344), FRAC_CONST(0.033127922599673) },
- { FRAC_CONST(0.999337357398377), FRAC_CONST(0.036398435516228) },
- { FRAC_CONST(0.999212892959173), FRAC_CONST(0.039668558634781) },
- { FRAC_CONST(0.999077727752645), FRAC_CONST(0.042938256934941) },
- { FRAC_CONST(0.998931863226306), FRAC_CONST(0.046207495400865) },
- { FRAC_CONST(0.998775300942246), FRAC_CONST(0.049476239021636) },
- { FRAC_CONST(0.998608042577122), FRAC_CONST(0.052744452791636) },
- { FRAC_CONST(0.998430089922136), FRAC_CONST(0.056012101710921) },
- { FRAC_CONST(0.998241444883019), FRAC_CONST(0.059279150785597) },
- { FRAC_CONST(0.998042109480008), FRAC_CONST(0.062545565028192) },
- { FRAC_CONST(0.997832085847824), FRAC_CONST(0.065811309458034) },
- { FRAC_CONST(0.997611376235651), FRAC_CONST(0.069076349101624) },
- { FRAC_CONST(0.997379983007114), FRAC_CONST(0.072340648993011) },
- { FRAC_CONST(0.997137908640245), FRAC_CONST(0.075604174174166) },
- { FRAC_CONST(0.996885155727469), FRAC_CONST(0.078866889695354) },
- { FRAC_CONST(0.996621726975566), FRAC_CONST(0.082128760615515) },
- { FRAC_CONST(0.996347625205645), FRAC_CONST(0.085389752002632) },
- { FRAC_CONST(0.996062853353117), FRAC_CONST(0.088649828934106) },
- { FRAC_CONST(0.995767414467660), FRAC_CONST(0.091908956497133) },
- { FRAC_CONST(0.995461311713186), FRAC_CONST(0.095167099789075) },
- { FRAC_CONST(0.995144548367810), FRAC_CONST(0.098424223917834) },
- { FRAC_CONST(0.994817127823813), FRAC_CONST(0.101680294002229) },
- { FRAC_CONST(0.994479053587606), FRAC_CONST(0.104935275172364) },
- { FRAC_CONST(0.994130329279692), FRAC_CONST(0.108189132570007) },
- { FRAC_CONST(0.993770958634630), FRAC_CONST(0.111441831348957) },
- { FRAC_CONST(0.993400945500988), FRAC_CONST(0.114693336675426) },
- { FRAC_CONST(0.993020293841312), FRAC_CONST(0.117943613728403) },
- { FRAC_CONST(0.992629007732074), FRAC_CONST(0.121192627700032) },
- { FRAC_CONST(0.992227091363634), FRAC_CONST(0.124440343795983) },
- { FRAC_CONST(0.991814549040194), FRAC_CONST(0.127686727235827) },
- { FRAC_CONST(0.991391385179751), FRAC_CONST(0.130931743253405) },
- { FRAC_CONST(0.990957604314048), FRAC_CONST(0.134175357097202) },
- { FRAC_CONST(0.990513211088533), FRAC_CONST(0.137417534030720) },
- { FRAC_CONST(0.990058210262297), FRAC_CONST(0.140658239332849) },
- { FRAC_CONST(0.989592606708036), FRAC_CONST(0.143897438298239) },
- { FRAC_CONST(0.989116405411988), FRAC_CONST(0.147135096237670) },
- { FRAC_CONST(0.988629611473887), FRAC_CONST(0.150371178478428) },
- { FRAC_CONST(0.988132230106905), FRAC_CONST(0.153605650364672) },
- { FRAC_CONST(0.987624266637598), FRAC_CONST(0.156838477257806) },
- { FRAC_CONST(0.987105726505845), FRAC_CONST(0.160069624536852) },
- { FRAC_CONST(0.986576615264794), FRAC_CONST(0.163299057598817) },
- { FRAC_CONST(0.986036938580803), FRAC_CONST(0.166526741859069) },
- { FRAC_CONST(0.985486702233375), FRAC_CONST(0.169752642751702) },
- { FRAC_CONST(0.984925912115099), FRAC_CONST(0.172976725729910) },
- { FRAC_CONST(0.984354574231587), FRAC_CONST(0.176198956266353) },
- { FRAC_CONST(0.983772694701407), FRAC_CONST(0.179419299853531) },
- { FRAC_CONST(0.983180279756024), FRAC_CONST(0.182637722004152) },
- { FRAC_CONST(0.982577335739725), FRAC_CONST(0.185854188251500) },
- { FRAC_CONST(0.981963869109555), FRAC_CONST(0.189068664149806) },
- { FRAC_CONST(0.981339886435250), FRAC_CONST(0.192281115274616) },
- { FRAC_CONST(0.980705394399163), FRAC_CONST(0.195491507223158) },
- { FRAC_CONST(0.980060399796194), FRAC_CONST(0.198699805614714) },
- { FRAC_CONST(0.979404909533716), FRAC_CONST(0.201905976090986) },
- { FRAC_CONST(0.978738930631504), FRAC_CONST(0.205109984316464) },
- { FRAC_CONST(0.978062470221657), FRAC_CONST(0.208311795978794) },
- { FRAC_CONST(0.977375535548522), FRAC_CONST(0.211511376789145) },
- { FRAC_CONST(0.976678133968618), FRAC_CONST(0.214708692482577) },
- { FRAC_CONST(0.975970272950556), FRAC_CONST(0.217903708818409) },
- { FRAC_CONST(0.975251960074958), FRAC_CONST(0.221096391580581) },
- { FRAC_CONST(0.974523203034377), FRAC_CONST(0.224286706578026) },
- { FRAC_CONST(0.973784009633218), FRAC_CONST(0.227474619645035) },
- { FRAC_CONST(0.973034387787646), FRAC_CONST(0.230660096641619) },
- { FRAC_CONST(0.972274345525510), FRAC_CONST(0.233843103453878) },
- { FRAC_CONST(0.971503890986252), FRAC_CONST(0.237023605994367) },
- { FRAC_CONST(0.970723032420820), FRAC_CONST(0.240201570202459) },
- { FRAC_CONST(0.969931778191584), FRAC_CONST(0.243376962044711) },
- { FRAC_CONST(0.969130136772239), FRAC_CONST(0.246549747515226) },
- { FRAC_CONST(0.968318116747721), FRAC_CONST(0.249719892636022) },
- { FRAC_CONST(0.967495726814114), FRAC_CONST(0.252887363457390) },
- { FRAC_CONST(0.966662975778551), FRAC_CONST(0.256052126058264) },
- { FRAC_CONST(0.965819872559127), FRAC_CONST(0.259214146546579) },
- { FRAC_CONST(0.964966426184802), FRAC_CONST(0.262373391059634) },
- { FRAC_CONST(0.964102645795299), FRAC_CONST(0.265529825764461) },
- { FRAC_CONST(0.963228540641012), FRAC_CONST(0.268683416858178) },
- { FRAC_CONST(0.962344120082907), FRAC_CONST(0.271834130568359) },
- { FRAC_CONST(0.961449393592416), FRAC_CONST(0.274981933153391) },
- { FRAC_CONST(0.960544370751341), FRAC_CONST(0.278126790902837) },
- { FRAC_CONST(0.959629061251750), FRAC_CONST(0.281268670137799) },
- { FRAC_CONST(0.958703474895872), FRAC_CONST(0.284407537211272) },
- { FRAC_CONST(0.957767621595993), FRAC_CONST(0.287543358508512) },
- { FRAC_CONST(0.956821511374351), FRAC_CONST(0.290676100447394) },
- { FRAC_CONST(0.955865154363025), FRAC_CONST(0.293805729478766) },
- { FRAC_CONST(0.954898560803832), FRAC_CONST(0.296932212086818) },
- { FRAC_CONST(0.953921741048211), FRAC_CONST(0.300055514789431) },
- { FRAC_CONST(0.952934705557117), FRAC_CONST(0.303175604138543) },
- { FRAC_CONST(0.951937464900908), FRAC_CONST(0.306292446720504) },
- { FRAC_CONST(0.950930029759229), FRAC_CONST(0.309406009156434) },
- { FRAC_CONST(0.949912410920903), FRAC_CONST(0.312516258102580) },
- { FRAC_CONST(0.948884619283808), FRAC_CONST(0.315623160250676) },
- { FRAC_CONST(0.947846665854767), FRAC_CONST(0.318726682328294) },
- { FRAC_CONST(0.946798561749429), FRAC_CONST(0.321826791099207) },
- { FRAC_CONST(0.945740318192145), FRAC_CONST(0.324923453363742) },
- { FRAC_CONST(0.944671946515855), FRAC_CONST(0.328016635959131) },
- { FRAC_CONST(0.943593458161960), FRAC_CONST(0.331106305759876) },
- { FRAC_CONST(0.942504864680205), FRAC_CONST(0.334192429678095) },
- { FRAC_CONST(0.941406177728551), FRAC_CONST(0.337274974663880) },
- { FRAC_CONST(0.940297409073052), FRAC_CONST(0.340353907705650) },
- { FRAC_CONST(0.939178570587730), FRAC_CONST(0.343429195830507) },
- { FRAC_CONST(0.938049674254446), FRAC_CONST(0.346500806104585) },
- { FRAC_CONST(0.936910732162774), FRAC_CONST(0.349568705633406) },
- { FRAC_CONST(0.935761756509868), FRAC_CONST(0.352632861562230) },
- { FRAC_CONST(0.934602759600334), FRAC_CONST(0.355693241076410) },
- { FRAC_CONST(0.933433753846097), FRAC_CONST(0.358749811401739) },
- { FRAC_CONST(0.932254751766271), FRAC_CONST(0.361802539804806) },
- { FRAC_CONST(0.931065765987021), FRAC_CONST(0.364851393593340) },
- { FRAC_CONST(0.929866809241428), FRAC_CONST(0.367896340116568) },
- { FRAC_CONST(0.928657894369357), FRAC_CONST(0.370937346765559) },
- { FRAC_CONST(0.927439034317314), FRAC_CONST(0.373974380973575) },
- { FRAC_CONST(0.926210242138311), FRAC_CONST(0.377007410216418) },
- { FRAC_CONST(0.924971530991726), FRAC_CONST(0.380036402012783) },
- { FRAC_CONST(0.923722914143160), FRAC_CONST(0.383061323924602) },
- { FRAC_CONST(0.922464404964295), FRAC_CONST(0.386082143557389) },
- { FRAC_CONST(0.921196016932755), FRAC_CONST(0.389098828560595) },
- { FRAC_CONST(0.919917763631956), FRAC_CONST(0.392111346627946) },
- { FRAC_CONST(0.918629658750963), FRAC_CONST(0.395119665497795) },
- { FRAC_CONST(0.917331716084346), FRAC_CONST(0.398123752953462) },
- { FRAC_CONST(0.916023949532027), FRAC_CONST(0.401123576823585) },
- { FRAC_CONST(0.914706373099136), FRAC_CONST(0.404119104982459) },
- { FRAC_CONST(0.913379000895858), FRAC_CONST(0.407110305350386) },
- { FRAC_CONST(0.912041847137282), FRAC_CONST(0.410097145894012) },
- { FRAC_CONST(0.910694926143251), FRAC_CONST(0.413079594626675) },
- { FRAC_CONST(0.909338252338207), FRAC_CONST(0.416057619608744) },
- { FRAC_CONST(0.907971840251037), FRAC_CONST(0.419031188947965) },
- { FRAC_CONST(0.906595704514915), FRAC_CONST(0.422000270799800) },
- { FRAC_CONST(0.905209859867151), FRAC_CONST(0.424964833367766) },
- { FRAC_CONST(0.903814321149027), FRAC_CONST(0.427924844903780) },
- { FRAC_CONST(0.902409103305641), FRAC_CONST(0.430880273708497) },
- { FRAC_CONST(0.900994221385748), FRAC_CONST(0.433831088131649) },
- { FRAC_CONST(0.899569690541596), FRAC_CONST(0.436777256572384) },
- { FRAC_CONST(0.898135526028766), FRAC_CONST(0.439718747479604) },
- { FRAC_CONST(0.896691743206008), FRAC_CONST(0.442655529352306) },
- { FRAC_CONST(0.895238357535076), FRAC_CONST(0.445587570739915) },
- { FRAC_CONST(0.893775384580563), FRAC_CONST(0.448514840242624) },
- { FRAC_CONST(0.892302840009734), FRAC_CONST(0.451437306511726) },
- { FRAC_CONST(0.890820739592359), FRAC_CONST(0.454354938249958) },
- { FRAC_CONST(0.889329099200541), FRAC_CONST(0.457267704211826) },
- { FRAC_CONST(0.887827934808551), FRAC_CONST(0.460175573203949) },
- { FRAC_CONST(0.886317262492655), FRAC_CONST(0.463078514085383) },
- { FRAC_CONST(0.884797098430938), FRAC_CONST(0.465976495767966) },
- { FRAC_CONST(0.883267458903136), FRAC_CONST(0.468869487216642) },
- { FRAC_CONST(0.881728360290461), FRAC_CONST(0.471757457449795) },
- { FRAC_CONST(0.880179819075421), FRAC_CONST(0.474640375539586) },
- { FRAC_CONST(0.878621851841649), FRAC_CONST(0.477518210612278) },
- { FRAC_CONST(0.877054475273722), FRAC_CONST(0.480390931848569) },
- { FRAC_CONST(0.875477706156984), FRAC_CONST(0.483258508483922) },
- { FRAC_CONST(0.873891561377366), FRAC_CONST(0.486120909808896) },
- { FRAC_CONST(0.872296057921204), FRAC_CONST(0.488978105169472) },
- { FRAC_CONST(0.870691212875058), FRAC_CONST(0.491830063967383) },
- { FRAC_CONST(0.869077043425529), FRAC_CONST(0.494676755660442) },
- { FRAC_CONST(0.867453566859076), FRAC_CONST(0.497518149762867) },
- { FRAC_CONST(0.865820800561827), FRAC_CONST(0.500354215845611) },
- { FRAC_CONST(0.864178762019399), FRAC_CONST(0.503184923536685) },
- { FRAC_CONST(0.862527468816704), FRAC_CONST(0.506010242521482) },
- { FRAC_CONST(0.860866938637767), FRAC_CONST(0.508830142543107) },
- { FRAC_CONST(0.859197189265532), FRAC_CONST(0.511644593402696) },
- { FRAC_CONST(0.857518238581672), FRAC_CONST(0.514453564959741) },
- { FRAC_CONST(0.855830104566401), FRAC_CONST(0.517257027132414) },
- { FRAC_CONST(0.854132805298278), FRAC_CONST(0.520054949897887) },
- { FRAC_CONST(0.852426358954015), FRAC_CONST(0.522847303292655) },
- { FRAC_CONST(0.850710783808280), FRAC_CONST(0.525634057412856) },
- { FRAC_CONST(0.848986098233506), FRAC_CONST(0.528415182414593) },
- { FRAC_CONST(0.847252320699689), FRAC_CONST(0.531190648514252) },
- { FRAC_CONST(0.845509469774194), FRAC_CONST(0.533960425988819) },
- { FRAC_CONST(0.843757564121554), FRAC_CONST(0.536724485176205) },
- { FRAC_CONST(0.841996622503271), FRAC_CONST(0.539482796475555) },
- { FRAC_CONST(0.840226663777615), FRAC_CONST(0.542235330347571) },
- { FRAC_CONST(0.838447706899422), FRAC_CONST(0.544982057314827) },
- { FRAC_CONST(0.836659770919891), FRAC_CONST(0.547722947962084) },
- { FRAC_CONST(0.834862874986380), FRAC_CONST(0.550457972936605) },
- { FRAC_CONST(0.833057038342201), FRAC_CONST(0.553187102948470) },
- { FRAC_CONST(0.831242280326413), FRAC_CONST(0.555910308770889) },
- { FRAC_CONST(0.829418620373617), FRAC_CONST(0.558627561240515) },
- { FRAC_CONST(0.827586078013746), FRAC_CONST(0.561338831257758) },
- { FRAC_CONST(0.825744672871856), FRAC_CONST(0.564044089787093) },
- { FRAC_CONST(0.823894424667918), FRAC_CONST(0.566743307857377) },
- { FRAC_CONST(0.822035353216601), FRAC_CONST(0.569436456562150) },
- { FRAC_CONST(0.820167478427070), FRAC_CONST(0.572123507059955) },
- { FRAC_CONST(0.818290820302761), FRAC_CONST(0.574804430574639) },
- { FRAC_CONST(0.816405398941175), FRAC_CONST(0.577479198395666) },
- { FRAC_CONST(0.814511234533661), FRAC_CONST(0.580147781878420) },
- { FRAC_CONST(0.812608347365198), FRAC_CONST(0.582810152444517) },
- { FRAC_CONST(0.810696757814178), FRAC_CONST(0.585466281582107) },
- { FRAC_CONST(0.808776486352191), FRAC_CONST(0.588116140846181) },
- { FRAC_CONST(0.806847553543799), FRAC_CONST(0.590759701858874) },
- { FRAC_CONST(0.804909980046325), FRAC_CONST(0.593396936309773) },
- { FRAC_CONST(0.802963786609623), FRAC_CONST(0.596027815956215) },
- { FRAC_CONST(0.801008994075862), FRAC_CONST(0.598652312623592) },
- { FRAC_CONST(0.799045623379300), FRAC_CONST(0.601270398205654) },
- { FRAC_CONST(0.797073695546059), FRAC_CONST(0.603882044664808) },
- { FRAC_CONST(0.795093231693901), FRAC_CONST(0.606487224032418) },
- { FRAC_CONST(0.793104253032005), FRAC_CONST(0.609085908409106) },
- { FRAC_CONST(0.791106780860733), FRAC_CONST(0.611678069965050) },
- { FRAC_CONST(0.789100836571407), FRAC_CONST(0.614263680940283) },
- { FRAC_CONST(0.787086441646080), FRAC_CONST(0.616842713644988) },
- { FRAC_CONST(0.785063617657302), FRAC_CONST(0.619415140459796) },
- { FRAC_CONST(0.783032386267894), FRAC_CONST(0.621980933836084) },
- { FRAC_CONST(0.780992769230711), FRAC_CONST(0.624540066296266) },
- { FRAC_CONST(0.778944788388414), FRAC_CONST(0.627092510434089) },
- { FRAC_CONST(0.776888465673232), FRAC_CONST(0.629638238914927) },
- { FRAC_CONST(0.774823823106730), FRAC_CONST(0.632177224476073) },
- { FRAC_CONST(0.772750882799570), FRAC_CONST(0.634709439927031) },
- { FRAC_CONST(0.770669666951277), FRAC_CONST(0.637234858149809) },
- { FRAC_CONST(0.768580197850002), FRAC_CONST(0.639753452099206) },
- { FRAC_CONST(0.766482497872280), FRAC_CONST(0.642265194803105) },
- { FRAC_CONST(0.764376589482793), FRAC_CONST(0.644770059362758) },
- { FRAC_CONST(0.762262495234126), FRAC_CONST(0.647268018953079) },
- { FRAC_CONST(0.760140237766532), FRAC_CONST(0.649759046822928) },
- { FRAC_CONST(0.758009839807683), FRAC_CONST(0.652243116295397) },
- { FRAC_CONST(0.755871324172429), FRAC_CONST(0.654720200768098) },
- { FRAC_CONST(0.753724713762555), FRAC_CONST(0.657190273713446) },
- { FRAC_CONST(0.751570031566534), FRAC_CONST(0.659653308678945) },
- { FRAC_CONST(0.749407300659280), FRAC_CONST(0.662109279287469) },
- { FRAC_CONST(0.747236544201905), FRAC_CONST(0.664558159237545) },
- { FRAC_CONST(0.745057785441466), FRAC_CONST(0.666999922303638) },
- { FRAC_CONST(0.742871047710719), FRAC_CONST(0.669434542336425) },
- { FRAC_CONST(0.740676354427868), FRAC_CONST(0.671861993263083) },
- { FRAC_CONST(0.738473729096316), FRAC_CONST(0.674282249087562) },
- { FRAC_CONST(0.736263195304409), FRAC_CONST(0.676695283890867) },
- { FRAC_CONST(0.734044776725190), FRAC_CONST(0.679101071831334) },
- { FRAC_CONST(0.731818497116138), FRAC_CONST(0.681499587144906) },
- { FRAC_CONST(0.729584380318920), FRAC_CONST(0.683890804145412) },
- { FRAC_CONST(0.727342450259131), FRAC_CONST(0.686274697224838) },
- { FRAC_CONST(0.725092730946042), FRAC_CONST(0.688651240853606) },
- { FRAC_CONST(0.722835246472338), FRAC_CONST(0.691020409580841) },
- { FRAC_CONST(0.720570021013866), FRAC_CONST(0.693382178034651) },
- { FRAC_CONST(0.718297078829369), FRAC_CONST(0.695736520922392) },
- { FRAC_CONST(0.716016444260233), FRAC_CONST(0.698083413030944) },
- { FRAC_CONST(0.713728141730222), FRAC_CONST(0.700422829226978) },
- { FRAC_CONST(0.711432195745216), FRAC_CONST(0.702754744457225) },
- { FRAC_CONST(0.709128630892954), FRAC_CONST(0.705079133748748) },
- { FRAC_CONST(0.706817471842764), FRAC_CONST(0.707395972209203) },
- { FRAC_CONST(0.704498743345302), FRAC_CONST(0.709705235027113) },
- { FRAC_CONST(0.702172470232289), FRAC_CONST(0.712006897472128) },
- { FRAC_CONST(0.699838677416240), FRAC_CONST(0.714300934895292) },
- { FRAC_CONST(0.697497389890200), FRAC_CONST(0.716587322729308) },
- { FRAC_CONST(0.695148632727480), FRAC_CONST(0.718866036488799) },
- { FRAC_CONST(0.692792431081381), FRAC_CONST(0.721137051770570) },
- { FRAC_CONST(0.690428810184929), FRAC_CONST(0.723400344253874) },
- { FRAC_CONST(0.688057795350606), FRAC_CONST(0.725655889700665) },
- { FRAC_CONST(0.685679411970075), FRAC_CONST(0.727903663955865) },
- { FRAC_CONST(0.683293685513912), FRAC_CONST(0.730143642947616) },
- { FRAC_CONST(0.680900641531330), FRAC_CONST(0.732375802687543) },
- { FRAC_CONST(0.678500305649909), FRAC_CONST(0.734600119271009) },
- { FRAC_CONST(0.676092703575316), FRAC_CONST(0.736816568877370) },
- { FRAC_CONST(0.673677861091036), FRAC_CONST(0.739025127770231) },
- { FRAC_CONST(0.671255804058092), FRAC_CONST(0.741225772297702) },
- { FRAC_CONST(0.668826558414768), FRAC_CONST(0.743418478892647) },
- { FRAC_CONST(0.666390150176334), FRAC_CONST(0.745603224072940) },
- { FRAC_CONST(0.663946605434765), FRAC_CONST(0.747779984441716) },
- { FRAC_CONST(0.661495950358462), FRAC_CONST(0.749948736687619) },
- { FRAC_CONST(0.659038211191971), FRAC_CONST(0.752109457585056) },
- { FRAC_CONST(0.656573414255705), FRAC_CONST(0.754262123994441) },
- { FRAC_CONST(0.654101585945659), FRAC_CONST(0.756406712862448) },
- { FRAC_CONST(0.651622752733128), FRAC_CONST(0.758543201222251) },
- { FRAC_CONST(0.649136941164425), FRAC_CONST(0.760671566193777) },
- { FRAC_CONST(0.646644177860593), FRAC_CONST(0.762791784983948) },
- { FRAC_CONST(0.644144489517126), FRAC_CONST(0.764903834886923) },
- { FRAC_CONST(0.641637902903677), FRAC_CONST(0.767007693284345) },
- { FRAC_CONST(0.639124444863776), FRAC_CONST(0.769103337645580) },
- { FRAC_CONST(0.636604142314538), FRAC_CONST(0.771190745527961) },
- { FRAC_CONST(0.634077022246379), FRAC_CONST(0.773269894577026) },
- { FRAC_CONST(0.631543111722725), FRAC_CONST(0.775340762526760) },
- { FRAC_CONST(0.629002437879721), FRAC_CONST(0.777403327199831) },
- { FRAC_CONST(0.626455027925944), FRAC_CONST(0.779457566507828) },
- { FRAC_CONST(0.623900909142107), FRAC_CONST(0.781503458451498) },
- { FRAC_CONST(0.621340108880771), FRAC_CONST(0.783540981120982) },
- { FRAC_CONST(0.618772654566049), FRAC_CONST(0.785570112696050) },
- { FRAC_CONST(0.616198573693314), FRAC_CONST(0.787590831446332) },
- { FRAC_CONST(0.613617893828905), FRAC_CONST(0.789603115731555) },
- { FRAC_CONST(0.611030642609828), FRAC_CONST(0.791606944001769) },
- { FRAC_CONST(0.608436847743468), FRAC_CONST(0.793602294797585) },
- { FRAC_CONST(0.605836537007281), FRAC_CONST(0.795589146750397) },
- { FRAC_CONST(0.603229738248508), FRAC_CONST(0.797567478582619) },
- { FRAC_CONST(0.600616479383869), FRAC_CONST(0.799537269107905) },
- { FRAC_CONST(0.597996788399267), FRAC_CONST(0.801498497231381) },
- { FRAC_CONST(0.595370693349487), FRAC_CONST(0.803451141949871) },
- { FRAC_CONST(0.592738222357898), FRAC_CONST(0.805395182352117) },
- { FRAC_CONST(0.590099403616149), FRAC_CONST(0.807330597619008) },
- { FRAC_CONST(0.587454265383869), FRAC_CONST(0.809257367023803) },
- { FRAC_CONST(0.584802835988364), FRAC_CONST(0.811175469932349) },
- { FRAC_CONST(0.582145143824311), FRAC_CONST(0.813084885803304) },
- { FRAC_CONST(0.579481217353460), FRAC_CONST(0.814985594188359) },
- { FRAC_CONST(0.576811085104321), FRAC_CONST(0.816877574732454) },
- { FRAC_CONST(0.574134775671867), FRAC_CONST(0.818760807173997) },
- { FRAC_CONST(0.571452317717222), FRAC_CONST(0.820635271345081) },
- { FRAC_CONST(0.568763739967354), FRAC_CONST(0.822500947171703) },
- { FRAC_CONST(0.566069071214772), FRAC_CONST(0.824357814673971) },
- { FRAC_CONST(0.563368340317214), FRAC_CONST(0.826205853966327) },
- { FRAC_CONST(0.560661576197336), FRAC_CONST(0.828045045257756) },
- { FRAC_CONST(0.557948807842409), FRAC_CONST(0.829875368851995) },
- { FRAC_CONST(0.555230064304002), FRAC_CONST(0.831696805147750) },
- { FRAC_CONST(0.552505374697674), FRAC_CONST(0.833509334638900) },
- { FRAC_CONST(0.549774768202663), FRAC_CONST(0.835312937914713) },
- { FRAC_CONST(0.547038274061568), FRAC_CONST(0.837107595660044) },
- { FRAC_CONST(0.544295921580046), FRAC_CONST(0.838893288655553) },
- { FRAC_CONST(0.541547740126486), FRAC_CONST(0.840669997777901) },
- { FRAC_CONST(0.538793759131706), FRAC_CONST(0.842437703999961) },
- { FRAC_CONST(0.536034008088628), FRAC_CONST(0.844196388391019) },
- { FRAC_CONST(0.533268516551970), FRAC_CONST(0.845946032116980) },
- { FRAC_CONST(0.530497314137923), FRAC_CONST(0.847686616440563) },
- { FRAC_CONST(0.527720430523840), FRAC_CONST(0.849418122721510) },
- { FRAC_CONST(0.524937895447912), FRAC_CONST(0.851140532416778) },
- { FRAC_CONST(0.522149738708856), FRAC_CONST(0.852853827080745) },
- { FRAC_CONST(0.519355990165590), FRAC_CONST(0.854557988365401) },
- { FRAC_CONST(0.516556679736915), FRAC_CONST(0.856252998020546) },
- { FRAC_CONST(0.513751837401199), FRAC_CONST(0.857938837893991) },
- { FRAC_CONST(0.510941493196049), FRAC_CONST(0.859615489931744) },
- { FRAC_CONST(0.508125677217994), FRAC_CONST(0.861282936178208) },
- { FRAC_CONST(0.505304419622159), FRAC_CONST(0.862941158776375) },
- { FRAC_CONST(0.502477750621949), FRAC_CONST(0.864590139968012) },
- { FRAC_CONST(0.499645700488717), FRAC_CONST(0.866229862093855) },
- { FRAC_CONST(0.496808299551444), FRAC_CONST(0.867860307593799) },
- { FRAC_CONST(0.493965578196415), FRAC_CONST(0.869481459007080) },
- { FRAC_CONST(0.491117566866892), FRAC_CONST(0.871093298972471) },
- { FRAC_CONST(0.488264296062789), FRAC_CONST(0.872695810228461) },
- { FRAC_CONST(0.485405796340343), FRAC_CONST(0.874288975613440) },
- { FRAC_CONST(0.482542098311789), FRAC_CONST(0.875872778065888) },
- { FRAC_CONST(0.479673232645033), FRAC_CONST(0.877447200624553) },
- { FRAC_CONST(0.476799230063322), FRAC_CONST(0.879012226428633) },
- { FRAC_CONST(0.473920121344914), FRAC_CONST(0.880567838717962) },
- { FRAC_CONST(0.471035937322751), FRAC_CONST(0.882114020833179) },
- { FRAC_CONST(0.468146708884125), FRAC_CONST(0.883650756215917) },
- { FRAC_CONST(0.465252466970353), FRAC_CONST(0.885178028408975) },
- { FRAC_CONST(0.462353242576441), FRAC_CONST(0.886695821056495) },
- { FRAC_CONST(0.459449066750752), FRAC_CONST(0.888204117904136) },
- { FRAC_CONST(0.456539970594675), FRAC_CONST(0.889702902799251) },
- { FRAC_CONST(0.453625985262295), FRAC_CONST(0.891192159691058) },
- { FRAC_CONST(0.450707141960053), FRAC_CONST(0.892671872630812) },
- { FRAC_CONST(0.447783471946415), FRAC_CONST(0.894142025771977) },
- { FRAC_CONST(0.444855006531538), FRAC_CONST(0.895602603370393) },
- { FRAC_CONST(0.441921777076935), FRAC_CONST(0.897053589784447) },
- { FRAC_CONST(0.438983814995137), FRAC_CONST(0.898494969475242) },
- { FRAC_CONST(0.436041151749356), FRAC_CONST(0.899926727006758) },
- { FRAC_CONST(0.433093818853152), FRAC_CONST(0.901348847046022) },
- { FRAC_CONST(0.430141847870093), FRAC_CONST(0.902761314363272) },
- { FRAC_CONST(0.427185270413416), FRAC_CONST(0.904164113832116) },
- { FRAC_CONST(0.424224118145690), FRAC_CONST(0.905557230429701) },
- { FRAC_CONST(0.421258422778478), FRAC_CONST(0.906940649236866) },
- { FRAC_CONST(0.418288216071994), FRAC_CONST(0.908314355438308) },
- { FRAC_CONST(0.415313529834766), FRAC_CONST(0.909678334322736) },
- { FRAC_CONST(0.412334395923293), FRAC_CONST(0.911032571283032) },
- { FRAC_CONST(0.409350846241706), FRAC_CONST(0.912377051816407) },
- { FRAC_CONST(0.406362912741425), FRAC_CONST(0.913711761524555) },
- { FRAC_CONST(0.403370627420818), FRAC_CONST(0.915036686113806) },
- { FRAC_CONST(0.400374022324857), FRAC_CONST(0.916351811395282) },
- { FRAC_CONST(0.397373129544774), FRAC_CONST(0.917657123285050) },
- { FRAC_CONST(0.394367981217720), FRAC_CONST(0.918952607804266) },
- { FRAC_CONST(0.391358609526420), FRAC_CONST(0.920238251079332) },
- { FRAC_CONST(0.388345046698826), FRAC_CONST(0.921514039342042) },
- { FRAC_CONST(0.385327325007776), FRAC_CONST(0.922779958929729) },
- { FRAC_CONST(0.382305476770645), FRAC_CONST(0.924035996285410) },
- { FRAC_CONST(0.379279534348999), FRAC_CONST(0.925282137957935) },
- { FRAC_CONST(0.376249530148250), FRAC_CONST(0.926518370602127) },
- { FRAC_CONST(0.373215496617310), FRAC_CONST(0.927744680978929) },
- { FRAC_CONST(0.370177466248239), FRAC_CONST(0.928961055955541) },
- { FRAC_CONST(0.367135471575903), FRAC_CONST(0.930167482505564) },
- { FRAC_CONST(0.364089545177621), FRAC_CONST(0.931363947709140) },
- { FRAC_CONST(0.361039719672816), FRAC_CONST(0.932550438753087) },
- { FRAC_CONST(0.357986027722671), FRAC_CONST(0.933726942931039) },
- { FRAC_CONST(0.354928502029772), FRAC_CONST(0.934893447643582) },
- { FRAC_CONST(0.351867175337763), FRAC_CONST(0.936049940398387) },
- { FRAC_CONST(0.348802080430994), FRAC_CONST(0.937196408810347) },
- { FRAC_CONST(0.345733250134169), FRAC_CONST(0.938332840601705) },
- { FRAC_CONST(0.342660717311994), FRAC_CONST(0.939459223602190) },
- { FRAC_CONST(0.339584514868829), FRAC_CONST(0.940575545749145) },
- { FRAC_CONST(0.336504675748328), FRAC_CONST(0.941681795087657) },
- { FRAC_CONST(0.333421232933097), FRAC_CONST(0.942777959770684) },
- { FRAC_CONST(0.330334219444328), FRAC_CONST(0.943864028059183) },
- { FRAC_CONST(0.327243668341457), FRAC_CONST(0.944939988322235) },
- { FRAC_CONST(0.324149612721804), FRAC_CONST(0.946005829037171) },
- { FRAC_CONST(0.321052085720218), FRAC_CONST(0.947061538789691) },
- { FRAC_CONST(0.317951120508725), FRAC_CONST(0.948107106273994) },
- { FRAC_CONST(0.314846750296171), FRAC_CONST(0.949142520292891) },
- { FRAC_CONST(0.311739008327867), FRAC_CONST(0.950167769757930) },
- { FRAC_CONST(0.308627927885232), FRAC_CONST(0.951182843689513) },
- { FRAC_CONST(0.305513542285440), FRAC_CONST(0.952187731217013) },
- { FRAC_CONST(0.302395884881056), FRAC_CONST(0.953182421578893) },
- { FRAC_CONST(0.299274989059689), FRAC_CONST(0.954166904122818) },
- { FRAC_CONST(0.296150888243624), FRAC_CONST(0.955141168305771) },
- { FRAC_CONST(0.293023615889471), FRAC_CONST(0.956105203694164) },
- { FRAC_CONST(0.289893205487806), FRAC_CONST(0.957058999963955) },
- { FRAC_CONST(0.286759690562807), FRAC_CONST(0.958002546900750) },
- { FRAC_CONST(0.283623104671904), FRAC_CONST(0.958935834399920) },
- { FRAC_CONST(0.280483481405410), FRAC_CONST(0.959858852466706) },
- { FRAC_CONST(0.277340854386169), FRAC_CONST(0.960771591216325) },
- { FRAC_CONST(0.274195257269191), FRAC_CONST(0.961674040874080) },
- { FRAC_CONST(0.271046723741295), FRAC_CONST(0.962566191775459) },
- { FRAC_CONST(0.267895287520743), FRAC_CONST(0.963448034366243) },
- { FRAC_CONST(0.264740982356888), FRAC_CONST(0.964319559202607) },
- { FRAC_CONST(0.261583842029803), FRAC_CONST(0.965180756951218) },
- { FRAC_CONST(0.258423900349924), FRAC_CONST(0.966031618389343) },
- { FRAC_CONST(0.255261191157689), FRAC_CONST(0.966872134404937) },
- { FRAC_CONST(0.252095748323171), FRAC_CONST(0.967702295996750) },
- { FRAC_CONST(0.248927605745720), FRAC_CONST(0.968522094274417) },
- { FRAC_CONST(0.245756797353599), FRAC_CONST(0.969331520458559) },
- { FRAC_CONST(0.242583357103617), FRAC_CONST(0.970130565880871) },
- { FRAC_CONST(0.239407318980770), FRAC_CONST(0.970919221984218) },
- { FRAC_CONST(0.236228716997876), FRAC_CONST(0.971697480322728) },
- { FRAC_CONST(0.233047585195206), FRAC_CONST(0.972465332561878) },
- { FRAC_CONST(0.229863957640129), FRAC_CONST(0.973222770478587) },
- { FRAC_CONST(0.226677868426735), FRAC_CONST(0.973969785961306) },
- { FRAC_CONST(0.223489351675482), FRAC_CONST(0.974706371010097) },
- { FRAC_CONST(0.220298441532823), FRAC_CONST(0.975432517736727) },
- { FRAC_CONST(0.217105172170841), FRAC_CONST(0.976148218364747) },
- { FRAC_CONST(0.213909577786886), FRAC_CONST(0.976853465229579) },
- { FRAC_CONST(0.210711692603206), FRAC_CONST(0.977548250778596) },
- { FRAC_CONST(0.207511550866582), FRAC_CONST(0.978232567571202) },
- { FRAC_CONST(0.204309186847962), FRAC_CONST(0.978906408278914) },
- { FRAC_CONST(0.201104634842092), FRAC_CONST(0.979569765685441) },
- { FRAC_CONST(0.197897929167148), FRAC_CONST(0.980222632686756) },
- { FRAC_CONST(0.194689104164373), FRAC_CONST(0.980865002291179) },
- { FRAC_CONST(0.191478194197704), FRAC_CONST(0.981496867619447) },
- { FRAC_CONST(0.188265233653407), FRAC_CONST(0.982118221904791) },
- { FRAC_CONST(0.185050256939710), FRAC_CONST(0.982729058493005) },
- { FRAC_CONST(0.181833298486427), FRAC_CONST(0.983329370842520) },
- { FRAC_CONST(0.178614392744603), FRAC_CONST(0.983919152524473) },
- { FRAC_CONST(0.175393574186129), FRAC_CONST(0.984498397222776) },
- { FRAC_CONST(0.172170877303385), FRAC_CONST(0.985067098734184) },
- { FRAC_CONST(0.168946336608867), FRAC_CONST(0.985625250968360) },
- { FRAC_CONST(0.165719986634814), FRAC_CONST(0.986172847947943) },
- { FRAC_CONST(0.162491861932842), FRAC_CONST(0.986709883808609) },
- { FRAC_CONST(0.159261997073573), FRAC_CONST(0.987236352799134) },
- { FRAC_CONST(0.156030426646266), FRAC_CONST(0.987752249281460) },
- { FRAC_CONST(0.152797185258443), FRAC_CONST(0.988257567730749) },
- { FRAC_CONST(0.149562307535523), FRAC_CONST(0.988752302735447) },
- { FRAC_CONST(0.146325828120446), FRAC_CONST(0.989236448997339) },
- { FRAC_CONST(0.143087781673307), FRAC_CONST(0.989710001331608) },
- { FRAC_CONST(0.139848202870981), FRAC_CONST(0.990172954666889) },
- { FRAC_CONST(0.136607126406757), FRAC_CONST(0.990625304045323) },
- { FRAC_CONST(0.133364586989957), FRAC_CONST(0.991067044622612) },
- { FRAC_CONST(0.130120619345575), FRAC_CONST(0.991498171668069) },
- { FRAC_CONST(0.126875258213898), FRAC_CONST(0.991918680564670) },
- { FRAC_CONST(0.123628538350136), FRAC_CONST(0.992328566809103) },
- { FRAC_CONST(0.120380494524051), FRAC_CONST(0.992727826011815) },
- { FRAC_CONST(0.117131161519582), FRAC_CONST(0.993116453897061) },
- { FRAC_CONST(0.113880574134475), FRAC_CONST(0.993494446302948) },
- { FRAC_CONST(0.110628767179910), FRAC_CONST(0.993861799181482) },
- { FRAC_CONST(0.107375775480128), FRAC_CONST(0.994218508598608) },
- { FRAC_CONST(0.104121633872055), FRAC_CONST(0.994564570734255) },
- { FRAC_CONST(0.100866377204933), FRAC_CONST(0.994899981882376) },
- { FRAC_CONST(0.097610040339947), FRAC_CONST(0.995224738450986) },
- { FRAC_CONST(0.094352658149849), FRAC_CONST(0.995538836962204) },
- { FRAC_CONST(0.091094265518583), FRAC_CONST(0.995842274052287) },
- { FRAC_CONST(0.087834897340919), FRAC_CONST(0.996135046471667) },
- { FRAC_CONST(0.084574588522070), FRAC_CONST(0.996417151084987) },
- { FRAC_CONST(0.081313373977324), FRAC_CONST(0.996688584871134) },
- { FRAC_CONST(0.078051288631670), FRAC_CONST(0.996949344923269) },
- { FRAC_CONST(0.074788367419420), FRAC_CONST(0.997199428448862) },
- { FRAC_CONST(0.071524645283840), FRAC_CONST(0.997438832769720) },
- { FRAC_CONST(0.068260157176771), FRAC_CONST(0.997667555322013) },
- { FRAC_CONST(0.064994938058259), FRAC_CONST(0.997885593656308) },
- { FRAC_CONST(0.061729022896176), FRAC_CONST(0.998092945437590) },
- { FRAC_CONST(0.058462446665851), FRAC_CONST(0.998289608445286) },
- { FRAC_CONST(0.055195244349690), FRAC_CONST(0.998475580573295) },
- { FRAC_CONST(0.051927450936806), FRAC_CONST(0.998650859830004) },
- { FRAC_CONST(0.048659101422640), FRAC_CONST(0.998815444338313) },
- { FRAC_CONST(0.045390230808591), FRAC_CONST(0.998969332335654) },
- { FRAC_CONST(0.042120874101635), FRAC_CONST(0.999112522174011) },
- { FRAC_CONST(0.038851066313958), FRAC_CONST(0.999245012319936) },
- { FRAC_CONST(0.035580842462574), FRAC_CONST(0.999366801354564) },
- { FRAC_CONST(0.032310237568951), FRAC_CONST(0.999477887973635) },
- { FRAC_CONST(0.029039286658643), FRAC_CONST(0.999578270987499) },
- { FRAC_CONST(0.025768024760904), FRAC_CONST(0.999667949321134) },
- { FRAC_CONST(0.022496486908322), FRAC_CONST(0.999746922014158) },
- { FRAC_CONST(0.019224708136438), FRAC_CONST(0.999815188220837) },
- { FRAC_CONST(0.015952723483375), FRAC_CONST(0.999872747210095) },
- { FRAC_CONST(0.012680567989461), FRAC_CONST(0.999919598365521) },
- { FRAC_CONST(0.009408276696850), FRAC_CONST(0.999955741185376) },
- { FRAC_CONST(0.006135884649155), FRAC_CONST(0.999981175282601) },
- { FRAC_CONST(0.002863426891064), FRAC_CONST(0.999995900384816) }
- };
+/* 480 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1920[] =
+{
+ { FRAC_CONST(0.999999916334328), FRAC_CONST(0.000409061532028) },
+ { FRAC_CONST(0.999993223088129), FRAC_CONST(0.003681545574400) },
+ { FRAC_CONST(0.999975820717897), FRAC_CONST(0.006953990190376) },
+ { FRAC_CONST(0.999947709409999), FRAC_CONST(0.010226360334704) },
+ { FRAC_CONST(0.999908889465485), FRAC_CONST(0.013498620962929) },
+ { FRAC_CONST(0.999859361300084), FRAC_CONST(0.016770737031768) },
+ { FRAC_CONST(0.999799125444203), FRAC_CONST(0.020042673499487) },
+ { FRAC_CONST(0.999728182542920), FRAC_CONST(0.023314395326274) },
+ { FRAC_CONST(0.999646533355977), FRAC_CONST(0.026585867474619) },
+ { FRAC_CONST(0.999554178757770), FRAC_CONST(0.029857054909681) },
+ { FRAC_CONST(0.999451119737344), FRAC_CONST(0.033127922599673) },
+ { FRAC_CONST(0.999337357398377), FRAC_CONST(0.036398435516228) },
+ { FRAC_CONST(0.999212892959173), FRAC_CONST(0.039668558634781) },
+ { FRAC_CONST(0.999077727752645), FRAC_CONST(0.042938256934941) },
+ { FRAC_CONST(0.998931863226306), FRAC_CONST(0.046207495400865) },
+ { FRAC_CONST(0.998775300942246), FRAC_CONST(0.049476239021636) },
+ { FRAC_CONST(0.998608042577122), FRAC_CONST(0.052744452791636) },
+ { FRAC_CONST(0.998430089922136), FRAC_CONST(0.056012101710921) },
+ { FRAC_CONST(0.998241444883019), FRAC_CONST(0.059279150785597) },
+ { FRAC_CONST(0.998042109480008), FRAC_CONST(0.062545565028192) },
+ { FRAC_CONST(0.997832085847824), FRAC_CONST(0.065811309458034) },
+ { FRAC_CONST(0.997611376235651), FRAC_CONST(0.069076349101624) },
+ { FRAC_CONST(0.997379983007114), FRAC_CONST(0.072340648993011) },
+ { FRAC_CONST(0.997137908640245), FRAC_CONST(0.075604174174166) },
+ { FRAC_CONST(0.996885155727469), FRAC_CONST(0.078866889695354) },
+ { FRAC_CONST(0.996621726975566), FRAC_CONST(0.082128760615515) },
+ { FRAC_CONST(0.996347625205645), FRAC_CONST(0.085389752002632) },
+ { FRAC_CONST(0.996062853353117), FRAC_CONST(0.088649828934106) },
+ { FRAC_CONST(0.995767414467660), FRAC_CONST(0.091908956497133) },
+ { FRAC_CONST(0.995461311713186), FRAC_CONST(0.095167099789075) },
+ { FRAC_CONST(0.995144548367810), FRAC_CONST(0.098424223917834) },
+ { FRAC_CONST(0.994817127823813), FRAC_CONST(0.101680294002229) },
+ { FRAC_CONST(0.994479053587606), FRAC_CONST(0.104935275172364) },
+ { FRAC_CONST(0.994130329279692), FRAC_CONST(0.108189132570007) },
+ { FRAC_CONST(0.993770958634630), FRAC_CONST(0.111441831348957) },
+ { FRAC_CONST(0.993400945500988), FRAC_CONST(0.114693336675426) },
+ { FRAC_CONST(0.993020293841312), FRAC_CONST(0.117943613728403) },
+ { FRAC_CONST(0.992629007732074), FRAC_CONST(0.121192627700032) },
+ { FRAC_CONST(0.992227091363634), FRAC_CONST(0.124440343795983) },
+ { FRAC_CONST(0.991814549040194), FRAC_CONST(0.127686727235827) },
+ { FRAC_CONST(0.991391385179751), FRAC_CONST(0.130931743253405) },
+ { FRAC_CONST(0.990957604314048), FRAC_CONST(0.134175357097202) },
+ { FRAC_CONST(0.990513211088533), FRAC_CONST(0.137417534030720) },
+ { FRAC_CONST(0.990058210262297), FRAC_CONST(0.140658239332849) },
+ { FRAC_CONST(0.989592606708036), FRAC_CONST(0.143897438298239) },
+ { FRAC_CONST(0.989116405411988), FRAC_CONST(0.147135096237670) },
+ { FRAC_CONST(0.988629611473887), FRAC_CONST(0.150371178478428) },
+ { FRAC_CONST(0.988132230106905), FRAC_CONST(0.153605650364672) },
+ { FRAC_CONST(0.987624266637598), FRAC_CONST(0.156838477257806) },
+ { FRAC_CONST(0.987105726505845), FRAC_CONST(0.160069624536852) },
+ { FRAC_CONST(0.986576615264794), FRAC_CONST(0.163299057598817) },
+ { FRAC_CONST(0.986036938580803), FRAC_CONST(0.166526741859069) },
+ { FRAC_CONST(0.985486702233375), FRAC_CONST(0.169752642751702) },
+ { FRAC_CONST(0.984925912115099), FRAC_CONST(0.172976725729910) },
+ { FRAC_CONST(0.984354574231587), FRAC_CONST(0.176198956266353) },
+ { FRAC_CONST(0.983772694701407), FRAC_CONST(0.179419299853531) },
+ { FRAC_CONST(0.983180279756024), FRAC_CONST(0.182637722004152) },
+ { FRAC_CONST(0.982577335739725), FRAC_CONST(0.185854188251500) },
+ { FRAC_CONST(0.981963869109555), FRAC_CONST(0.189068664149806) },
+ { FRAC_CONST(0.981339886435250), FRAC_CONST(0.192281115274616) },
+ { FRAC_CONST(0.980705394399163), FRAC_CONST(0.195491507223158) },
+ { FRAC_CONST(0.980060399796194), FRAC_CONST(0.198699805614714) },
+ { FRAC_CONST(0.979404909533716), FRAC_CONST(0.201905976090986) },
+ { FRAC_CONST(0.978738930631504), FRAC_CONST(0.205109984316464) },
+ { FRAC_CONST(0.978062470221657), FRAC_CONST(0.208311795978794) },
+ { FRAC_CONST(0.977375535548522), FRAC_CONST(0.211511376789145) },
+ { FRAC_CONST(0.976678133968618), FRAC_CONST(0.214708692482577) },
+ { FRAC_CONST(0.975970272950556), FRAC_CONST(0.217903708818409) },
+ { FRAC_CONST(0.975251960074958), FRAC_CONST(0.221096391580581) },
+ { FRAC_CONST(0.974523203034377), FRAC_CONST(0.224286706578026) },
+ { FRAC_CONST(0.973784009633218), FRAC_CONST(0.227474619645035) },
+ { FRAC_CONST(0.973034387787646), FRAC_CONST(0.230660096641619) },
+ { FRAC_CONST(0.972274345525510), FRAC_CONST(0.233843103453878) },
+ { FRAC_CONST(0.971503890986252), FRAC_CONST(0.237023605994367) },
+ { FRAC_CONST(0.970723032420820), FRAC_CONST(0.240201570202459) },
+ { FRAC_CONST(0.969931778191584), FRAC_CONST(0.243376962044711) },
+ { FRAC_CONST(0.969130136772239), FRAC_CONST(0.246549747515226) },
+ { FRAC_CONST(0.968318116747721), FRAC_CONST(0.249719892636022) },
+ { FRAC_CONST(0.967495726814114), FRAC_CONST(0.252887363457390) },
+ { FRAC_CONST(0.966662975778551), FRAC_CONST(0.256052126058264) },
+ { FRAC_CONST(0.965819872559127), FRAC_CONST(0.259214146546579) },
+ { FRAC_CONST(0.964966426184802), FRAC_CONST(0.262373391059634) },
+ { FRAC_CONST(0.964102645795299), FRAC_CONST(0.265529825764461) },
+ { FRAC_CONST(0.963228540641012), FRAC_CONST(0.268683416858178) },
+ { FRAC_CONST(0.962344120082907), FRAC_CONST(0.271834130568359) },
+ { FRAC_CONST(0.961449393592416), FRAC_CONST(0.274981933153391) },
+ { FRAC_CONST(0.960544370751341), FRAC_CONST(0.278126790902837) },
+ { FRAC_CONST(0.959629061251750), FRAC_CONST(0.281268670137799) },
+ { FRAC_CONST(0.958703474895872), FRAC_CONST(0.284407537211272) },
+ { FRAC_CONST(0.957767621595993), FRAC_CONST(0.287543358508512) },
+ { FRAC_CONST(0.956821511374351), FRAC_CONST(0.290676100447394) },
+ { FRAC_CONST(0.955865154363025), FRAC_CONST(0.293805729478766) },
+ { FRAC_CONST(0.954898560803832), FRAC_CONST(0.296932212086818) },
+ { FRAC_CONST(0.953921741048211), FRAC_CONST(0.300055514789431) },
+ { FRAC_CONST(0.952934705557117), FRAC_CONST(0.303175604138543) },
+ { FRAC_CONST(0.951937464900908), FRAC_CONST(0.306292446720504) },
+ { FRAC_CONST(0.950930029759229), FRAC_CONST(0.309406009156434) },
+ { FRAC_CONST(0.949912410920903), FRAC_CONST(0.312516258102580) },
+ { FRAC_CONST(0.948884619283808), FRAC_CONST(0.315623160250676) },
+ { FRAC_CONST(0.947846665854767), FRAC_CONST(0.318726682328294) },
+ { FRAC_CONST(0.946798561749429), FRAC_CONST(0.321826791099207) },
+ { FRAC_CONST(0.945740318192145), FRAC_CONST(0.324923453363742) },
+ { FRAC_CONST(0.944671946515855), FRAC_CONST(0.328016635959131) },
+ { FRAC_CONST(0.943593458161960), FRAC_CONST(0.331106305759876) },
+ { FRAC_CONST(0.942504864680205), FRAC_CONST(0.334192429678095) },
+ { FRAC_CONST(0.941406177728551), FRAC_CONST(0.337274974663880) },
+ { FRAC_CONST(0.940297409073052), FRAC_CONST(0.340353907705650) },
+ { FRAC_CONST(0.939178570587730), FRAC_CONST(0.343429195830507) },
+ { FRAC_CONST(0.938049674254446), FRAC_CONST(0.346500806104585) },
+ { FRAC_CONST(0.936910732162774), FRAC_CONST(0.349568705633406) },
+ { FRAC_CONST(0.935761756509868), FRAC_CONST(0.352632861562230) },
+ { FRAC_CONST(0.934602759600334), FRAC_CONST(0.355693241076410) },
+ { FRAC_CONST(0.933433753846097), FRAC_CONST(0.358749811401739) },
+ { FRAC_CONST(0.932254751766271), FRAC_CONST(0.361802539804806) },
+ { FRAC_CONST(0.931065765987021), FRAC_CONST(0.364851393593340) },
+ { FRAC_CONST(0.929866809241428), FRAC_CONST(0.367896340116568) },
+ { FRAC_CONST(0.928657894369357), FRAC_CONST(0.370937346765559) },
+ { FRAC_CONST(0.927439034317314), FRAC_CONST(0.373974380973575) },
+ { FRAC_CONST(0.926210242138311), FRAC_CONST(0.377007410216418) },
+ { FRAC_CONST(0.924971530991726), FRAC_CONST(0.380036402012783) },
+ { FRAC_CONST(0.923722914143160), FRAC_CONST(0.383061323924602) },
+ { FRAC_CONST(0.922464404964295), FRAC_CONST(0.386082143557389) },
+ { FRAC_CONST(0.921196016932755), FRAC_CONST(0.389098828560595) },
+ { FRAC_CONST(0.919917763631956), FRAC_CONST(0.392111346627946) },
+ { FRAC_CONST(0.918629658750963), FRAC_CONST(0.395119665497795) },
+ { FRAC_CONST(0.917331716084346), FRAC_CONST(0.398123752953462) },
+ { FRAC_CONST(0.916023949532027), FRAC_CONST(0.401123576823585) },
+ { FRAC_CONST(0.914706373099136), FRAC_CONST(0.404119104982459) },
+ { FRAC_CONST(0.913379000895858), FRAC_CONST(0.407110305350386) },
+ { FRAC_CONST(0.912041847137282), FRAC_CONST(0.410097145894012) },
+ { FRAC_CONST(0.910694926143251), FRAC_CONST(0.413079594626675) },
+ { FRAC_CONST(0.909338252338207), FRAC_CONST(0.416057619608744) },
+ { FRAC_CONST(0.907971840251037), FRAC_CONST(0.419031188947965) },
+ { FRAC_CONST(0.906595704514915), FRAC_CONST(0.422000270799800) },
+ { FRAC_CONST(0.905209859867151), FRAC_CONST(0.424964833367766) },
+ { FRAC_CONST(0.903814321149027), FRAC_CONST(0.427924844903780) },
+ { FRAC_CONST(0.902409103305641), FRAC_CONST(0.430880273708497) },
+ { FRAC_CONST(0.900994221385748), FRAC_CONST(0.433831088131649) },
+ { FRAC_CONST(0.899569690541596), FRAC_CONST(0.436777256572384) },
+ { FRAC_CONST(0.898135526028766), FRAC_CONST(0.439718747479604) },
+ { FRAC_CONST(0.896691743206008), FRAC_CONST(0.442655529352306) },
+ { FRAC_CONST(0.895238357535076), FRAC_CONST(0.445587570739915) },
+ { FRAC_CONST(0.893775384580563), FRAC_CONST(0.448514840242624) },
+ { FRAC_CONST(0.892302840009734), FRAC_CONST(0.451437306511726) },
+ { FRAC_CONST(0.890820739592359), FRAC_CONST(0.454354938249958) },
+ { FRAC_CONST(0.889329099200541), FRAC_CONST(0.457267704211826) },
+ { FRAC_CONST(0.887827934808551), FRAC_CONST(0.460175573203949) },
+ { FRAC_CONST(0.886317262492655), FRAC_CONST(0.463078514085383) },
+ { FRAC_CONST(0.884797098430938), FRAC_CONST(0.465976495767966) },
+ { FRAC_CONST(0.883267458903136), FRAC_CONST(0.468869487216642) },
+ { FRAC_CONST(0.881728360290461), FRAC_CONST(0.471757457449795) },
+ { FRAC_CONST(0.880179819075421), FRAC_CONST(0.474640375539586) },
+ { FRAC_CONST(0.878621851841649), FRAC_CONST(0.477518210612278) },
+ { FRAC_CONST(0.877054475273722), FRAC_CONST(0.480390931848569) },
+ { FRAC_CONST(0.875477706156984), FRAC_CONST(0.483258508483922) },
+ { FRAC_CONST(0.873891561377366), FRAC_CONST(0.486120909808896) },
+ { FRAC_CONST(0.872296057921204), FRAC_CONST(0.488978105169472) },
+ { FRAC_CONST(0.870691212875058), FRAC_CONST(0.491830063967383) },
+ { FRAC_CONST(0.869077043425529), FRAC_CONST(0.494676755660442) },
+ { FRAC_CONST(0.867453566859076), FRAC_CONST(0.497518149762867) },
+ { FRAC_CONST(0.865820800561827), FRAC_CONST(0.500354215845611) },
+ { FRAC_CONST(0.864178762019399), FRAC_CONST(0.503184923536685) },
+ { FRAC_CONST(0.862527468816704), FRAC_CONST(0.506010242521482) },
+ { FRAC_CONST(0.860866938637767), FRAC_CONST(0.508830142543107) },
+ { FRAC_CONST(0.859197189265532), FRAC_CONST(0.511644593402696) },
+ { FRAC_CONST(0.857518238581672), FRAC_CONST(0.514453564959741) },
+ { FRAC_CONST(0.855830104566401), FRAC_CONST(0.517257027132414) },
+ { FRAC_CONST(0.854132805298278), FRAC_CONST(0.520054949897887) },
+ { FRAC_CONST(0.852426358954015), FRAC_CONST(0.522847303292655) },
+ { FRAC_CONST(0.850710783808280), FRAC_CONST(0.525634057412856) },
+ { FRAC_CONST(0.848986098233506), FRAC_CONST(0.528415182414593) },
+ { FRAC_CONST(0.847252320699689), FRAC_CONST(0.531190648514252) },
+ { FRAC_CONST(0.845509469774194), FRAC_CONST(0.533960425988819) },
+ { FRAC_CONST(0.843757564121554), FRAC_CONST(0.536724485176205) },
+ { FRAC_CONST(0.841996622503271), FRAC_CONST(0.539482796475555) },
+ { FRAC_CONST(0.840226663777615), FRAC_CONST(0.542235330347571) },
+ { FRAC_CONST(0.838447706899422), FRAC_CONST(0.544982057314827) },
+ { FRAC_CONST(0.836659770919891), FRAC_CONST(0.547722947962084) },
+ { FRAC_CONST(0.834862874986380), FRAC_CONST(0.550457972936605) },
+ { FRAC_CONST(0.833057038342201), FRAC_CONST(0.553187102948470) },
+ { FRAC_CONST(0.831242280326413), FRAC_CONST(0.555910308770889) },
+ { FRAC_CONST(0.829418620373617), FRAC_CONST(0.558627561240515) },
+ { FRAC_CONST(0.827586078013746), FRAC_CONST(0.561338831257758) },
+ { FRAC_CONST(0.825744672871856), FRAC_CONST(0.564044089787093) },
+ { FRAC_CONST(0.823894424667918), FRAC_CONST(0.566743307857377) },
+ { FRAC_CONST(0.822035353216601), FRAC_CONST(0.569436456562150) },
+ { FRAC_CONST(0.820167478427070), FRAC_CONST(0.572123507059955) },
+ { FRAC_CONST(0.818290820302761), FRAC_CONST(0.574804430574639) },
+ { FRAC_CONST(0.816405398941175), FRAC_CONST(0.577479198395666) },
+ { FRAC_CONST(0.814511234533661), FRAC_CONST(0.580147781878420) },
+ { FRAC_CONST(0.812608347365198), FRAC_CONST(0.582810152444517) },
+ { FRAC_CONST(0.810696757814178), FRAC_CONST(0.585466281582107) },
+ { FRAC_CONST(0.808776486352191), FRAC_CONST(0.588116140846181) },
+ { FRAC_CONST(0.806847553543799), FRAC_CONST(0.590759701858874) },
+ { FRAC_CONST(0.804909980046325), FRAC_CONST(0.593396936309773) },
+ { FRAC_CONST(0.802963786609623), FRAC_CONST(0.596027815956215) },
+ { FRAC_CONST(0.801008994075862), FRAC_CONST(0.598652312623592) },
+ { FRAC_CONST(0.799045623379300), FRAC_CONST(0.601270398205654) },
+ { FRAC_CONST(0.797073695546059), FRAC_CONST(0.603882044664808) },
+ { FRAC_CONST(0.795093231693901), FRAC_CONST(0.606487224032418) },
+ { FRAC_CONST(0.793104253032005), FRAC_CONST(0.609085908409106) },
+ { FRAC_CONST(0.791106780860733), FRAC_CONST(0.611678069965050) },
+ { FRAC_CONST(0.789100836571407), FRAC_CONST(0.614263680940283) },
+ { FRAC_CONST(0.787086441646080), FRAC_CONST(0.616842713644988) },
+ { FRAC_CONST(0.785063617657302), FRAC_CONST(0.619415140459796) },
+ { FRAC_CONST(0.783032386267894), FRAC_CONST(0.621980933836084) },
+ { FRAC_CONST(0.780992769230711), FRAC_CONST(0.624540066296266) },
+ { FRAC_CONST(0.778944788388414), FRAC_CONST(0.627092510434089) },
+ { FRAC_CONST(0.776888465673232), FRAC_CONST(0.629638238914927) },
+ { FRAC_CONST(0.774823823106730), FRAC_CONST(0.632177224476073) },
+ { FRAC_CONST(0.772750882799570), FRAC_CONST(0.634709439927031) },
+ { FRAC_CONST(0.770669666951277), FRAC_CONST(0.637234858149809) },
+ { FRAC_CONST(0.768580197850002), FRAC_CONST(0.639753452099206) },
+ { FRAC_CONST(0.766482497872280), FRAC_CONST(0.642265194803105) },
+ { FRAC_CONST(0.764376589482793), FRAC_CONST(0.644770059362758) },
+ { FRAC_CONST(0.762262495234126), FRAC_CONST(0.647268018953079) },
+ { FRAC_CONST(0.760140237766532), FRAC_CONST(0.649759046822928) },
+ { FRAC_CONST(0.758009839807683), FRAC_CONST(0.652243116295397) },
+ { FRAC_CONST(0.755871324172429), FRAC_CONST(0.654720200768098) },
+ { FRAC_CONST(0.753724713762555), FRAC_CONST(0.657190273713446) },
+ { FRAC_CONST(0.751570031566534), FRAC_CONST(0.659653308678945) },
+ { FRAC_CONST(0.749407300659280), FRAC_CONST(0.662109279287469) },
+ { FRAC_CONST(0.747236544201905), FRAC_CONST(0.664558159237545) },
+ { FRAC_CONST(0.745057785441466), FRAC_CONST(0.666999922303638) },
+ { FRAC_CONST(0.742871047710719), FRAC_CONST(0.669434542336425) },
+ { FRAC_CONST(0.740676354427868), FRAC_CONST(0.671861993263083) },
+ { FRAC_CONST(0.738473729096316), FRAC_CONST(0.674282249087562) },
+ { FRAC_CONST(0.736263195304409), FRAC_CONST(0.676695283890867) },
+ { FRAC_CONST(0.734044776725190), FRAC_CONST(0.679101071831334) },
+ { FRAC_CONST(0.731818497116138), FRAC_CONST(0.681499587144906) },
+ { FRAC_CONST(0.729584380318920), FRAC_CONST(0.683890804145412) },
+ { FRAC_CONST(0.727342450259131), FRAC_CONST(0.686274697224838) },
+ { FRAC_CONST(0.725092730946042), FRAC_CONST(0.688651240853606) },
+ { FRAC_CONST(0.722835246472338), FRAC_CONST(0.691020409580841) },
+ { FRAC_CONST(0.720570021013866), FRAC_CONST(0.693382178034651) },
+ { FRAC_CONST(0.718297078829369), FRAC_CONST(0.695736520922392) },
+ { FRAC_CONST(0.716016444260233), FRAC_CONST(0.698083413030944) },
+ { FRAC_CONST(0.713728141730222), FRAC_CONST(0.700422829226978) },
+ { FRAC_CONST(0.711432195745216), FRAC_CONST(0.702754744457225) },
+ { FRAC_CONST(0.709128630892954), FRAC_CONST(0.705079133748748) },
+ { FRAC_CONST(0.706817471842764), FRAC_CONST(0.707395972209203) },
+ { FRAC_CONST(0.704498743345302), FRAC_CONST(0.709705235027113) },
+ { FRAC_CONST(0.702172470232289), FRAC_CONST(0.712006897472128) },
+ { FRAC_CONST(0.699838677416240), FRAC_CONST(0.714300934895292) },
+ { FRAC_CONST(0.697497389890200), FRAC_CONST(0.716587322729308) },
+ { FRAC_CONST(0.695148632727480), FRAC_CONST(0.718866036488799) },
+ { FRAC_CONST(0.692792431081381), FRAC_CONST(0.721137051770570) },
+ { FRAC_CONST(0.690428810184929), FRAC_CONST(0.723400344253874) },
+ { FRAC_CONST(0.688057795350606), FRAC_CONST(0.725655889700665) },
+ { FRAC_CONST(0.685679411970075), FRAC_CONST(0.727903663955865) },
+ { FRAC_CONST(0.683293685513912), FRAC_CONST(0.730143642947616) },
+ { FRAC_CONST(0.680900641531330), FRAC_CONST(0.732375802687543) },
+ { FRAC_CONST(0.678500305649909), FRAC_CONST(0.734600119271009) },
+ { FRAC_CONST(0.676092703575316), FRAC_CONST(0.736816568877370) },
+ { FRAC_CONST(0.673677861091036), FRAC_CONST(0.739025127770231) },
+ { FRAC_CONST(0.671255804058092), FRAC_CONST(0.741225772297702) },
+ { FRAC_CONST(0.668826558414768), FRAC_CONST(0.743418478892647) },
+ { FRAC_CONST(0.666390150176334), FRAC_CONST(0.745603224072940) },
+ { FRAC_CONST(0.663946605434765), FRAC_CONST(0.747779984441716) },
+ { FRAC_CONST(0.661495950358462), FRAC_CONST(0.749948736687619) },
+ { FRAC_CONST(0.659038211191971), FRAC_CONST(0.752109457585056) },
+ { FRAC_CONST(0.656573414255705), FRAC_CONST(0.754262123994441) },
+ { FRAC_CONST(0.654101585945659), FRAC_CONST(0.756406712862448) },
+ { FRAC_CONST(0.651622752733128), FRAC_CONST(0.758543201222251) },
+ { FRAC_CONST(0.649136941164425), FRAC_CONST(0.760671566193777) },
+ { FRAC_CONST(0.646644177860593), FRAC_CONST(0.762791784983948) },
+ { FRAC_CONST(0.644144489517126), FRAC_CONST(0.764903834886923) },
+ { FRAC_CONST(0.641637902903677), FRAC_CONST(0.767007693284345) },
+ { FRAC_CONST(0.639124444863776), FRAC_CONST(0.769103337645580) },
+ { FRAC_CONST(0.636604142314538), FRAC_CONST(0.771190745527961) },
+ { FRAC_CONST(0.634077022246379), FRAC_CONST(0.773269894577026) },
+ { FRAC_CONST(0.631543111722725), FRAC_CONST(0.775340762526760) },
+ { FRAC_CONST(0.629002437879721), FRAC_CONST(0.777403327199831) },
+ { FRAC_CONST(0.626455027925944), FRAC_CONST(0.779457566507828) },
+ { FRAC_CONST(0.623900909142107), FRAC_CONST(0.781503458451498) },
+ { FRAC_CONST(0.621340108880771), FRAC_CONST(0.783540981120982) },
+ { FRAC_CONST(0.618772654566049), FRAC_CONST(0.785570112696050) },
+ { FRAC_CONST(0.616198573693314), FRAC_CONST(0.787590831446332) },
+ { FRAC_CONST(0.613617893828905), FRAC_CONST(0.789603115731555) },
+ { FRAC_CONST(0.611030642609828), FRAC_CONST(0.791606944001769) },
+ { FRAC_CONST(0.608436847743468), FRAC_CONST(0.793602294797585) },
+ { FRAC_CONST(0.605836537007281), FRAC_CONST(0.795589146750397) },
+ { FRAC_CONST(0.603229738248508), FRAC_CONST(0.797567478582619) },
+ { FRAC_CONST(0.600616479383869), FRAC_CONST(0.799537269107905) },
+ { FRAC_CONST(0.597996788399267), FRAC_CONST(0.801498497231381) },
+ { FRAC_CONST(0.595370693349487), FRAC_CONST(0.803451141949871) },
+ { FRAC_CONST(0.592738222357898), FRAC_CONST(0.805395182352117) },
+ { FRAC_CONST(0.590099403616149), FRAC_CONST(0.807330597619008) },
+ { FRAC_CONST(0.587454265383869), FRAC_CONST(0.809257367023803) },
+ { FRAC_CONST(0.584802835988364), FRAC_CONST(0.811175469932349) },
+ { FRAC_CONST(0.582145143824311), FRAC_CONST(0.813084885803304) },
+ { FRAC_CONST(0.579481217353460), FRAC_CONST(0.814985594188359) },
+ { FRAC_CONST(0.576811085104321), FRAC_CONST(0.816877574732454) },
+ { FRAC_CONST(0.574134775671867), FRAC_CONST(0.818760807173997) },
+ { FRAC_CONST(0.571452317717222), FRAC_CONST(0.820635271345081) },
+ { FRAC_CONST(0.568763739967354), FRAC_CONST(0.822500947171703) },
+ { FRAC_CONST(0.566069071214772), FRAC_CONST(0.824357814673971) },
+ { FRAC_CONST(0.563368340317214), FRAC_CONST(0.826205853966327) },
+ { FRAC_CONST(0.560661576197336), FRAC_CONST(0.828045045257756) },
+ { FRAC_CONST(0.557948807842409), FRAC_CONST(0.829875368851995) },
+ { FRAC_CONST(0.555230064304002), FRAC_CONST(0.831696805147750) },
+ { FRAC_CONST(0.552505374697674), FRAC_CONST(0.833509334638900) },
+ { FRAC_CONST(0.549774768202663), FRAC_CONST(0.835312937914713) },
+ { FRAC_CONST(0.547038274061568), FRAC_CONST(0.837107595660044) },
+ { FRAC_CONST(0.544295921580046), FRAC_CONST(0.838893288655553) },
+ { FRAC_CONST(0.541547740126486), FRAC_CONST(0.840669997777901) },
+ { FRAC_CONST(0.538793759131706), FRAC_CONST(0.842437703999961) },
+ { FRAC_CONST(0.536034008088628), FRAC_CONST(0.844196388391019) },
+ { FRAC_CONST(0.533268516551970), FRAC_CONST(0.845946032116980) },
+ { FRAC_CONST(0.530497314137923), FRAC_CONST(0.847686616440563) },
+ { FRAC_CONST(0.527720430523840), FRAC_CONST(0.849418122721510) },
+ { FRAC_CONST(0.524937895447912), FRAC_CONST(0.851140532416778) },
+ { FRAC_CONST(0.522149738708856), FRAC_CONST(0.852853827080745) },
+ { FRAC_CONST(0.519355990165590), FRAC_CONST(0.854557988365401) },
+ { FRAC_CONST(0.516556679736915), FRAC_CONST(0.856252998020546) },
+ { FRAC_CONST(0.513751837401199), FRAC_CONST(0.857938837893991) },
+ { FRAC_CONST(0.510941493196049), FRAC_CONST(0.859615489931744) },
+ { FRAC_CONST(0.508125677217994), FRAC_CONST(0.861282936178208) },
+ { FRAC_CONST(0.505304419622159), FRAC_CONST(0.862941158776375) },
+ { FRAC_CONST(0.502477750621949), FRAC_CONST(0.864590139968012) },
+ { FRAC_CONST(0.499645700488717), FRAC_CONST(0.866229862093855) },
+ { FRAC_CONST(0.496808299551444), FRAC_CONST(0.867860307593799) },
+ { FRAC_CONST(0.493965578196415), FRAC_CONST(0.869481459007080) },
+ { FRAC_CONST(0.491117566866892), FRAC_CONST(0.871093298972471) },
+ { FRAC_CONST(0.488264296062789), FRAC_CONST(0.872695810228461) },
+ { FRAC_CONST(0.485405796340343), FRAC_CONST(0.874288975613440) },
+ { FRAC_CONST(0.482542098311789), FRAC_CONST(0.875872778065888) },
+ { FRAC_CONST(0.479673232645033), FRAC_CONST(0.877447200624553) },
+ { FRAC_CONST(0.476799230063322), FRAC_CONST(0.879012226428633) },
+ { FRAC_CONST(0.473920121344914), FRAC_CONST(0.880567838717962) },
+ { FRAC_CONST(0.471035937322751), FRAC_CONST(0.882114020833179) },
+ { FRAC_CONST(0.468146708884125), FRAC_CONST(0.883650756215917) },
+ { FRAC_CONST(0.465252466970353), FRAC_CONST(0.885178028408975) },
+ { FRAC_CONST(0.462353242576441), FRAC_CONST(0.886695821056495) },
+ { FRAC_CONST(0.459449066750752), FRAC_CONST(0.888204117904136) },
+ { FRAC_CONST(0.456539970594675), FRAC_CONST(0.889702902799251) },
+ { FRAC_CONST(0.453625985262295), FRAC_CONST(0.891192159691058) },
+ { FRAC_CONST(0.450707141960053), FRAC_CONST(0.892671872630812) },
+ { FRAC_CONST(0.447783471946415), FRAC_CONST(0.894142025771977) },
+ { FRAC_CONST(0.444855006531538), FRAC_CONST(0.895602603370393) },
+ { FRAC_CONST(0.441921777076935), FRAC_CONST(0.897053589784447) },
+ { FRAC_CONST(0.438983814995137), FRAC_CONST(0.898494969475242) },
+ { FRAC_CONST(0.436041151749356), FRAC_CONST(0.899926727006758) },
+ { FRAC_CONST(0.433093818853152), FRAC_CONST(0.901348847046022) },
+ { FRAC_CONST(0.430141847870093), FRAC_CONST(0.902761314363272) },
+ { FRAC_CONST(0.427185270413416), FRAC_CONST(0.904164113832116) },
+ { FRAC_CONST(0.424224118145690), FRAC_CONST(0.905557230429701) },
+ { FRAC_CONST(0.421258422778478), FRAC_CONST(0.906940649236866) },
+ { FRAC_CONST(0.418288216071994), FRAC_CONST(0.908314355438308) },
+ { FRAC_CONST(0.415313529834766), FRAC_CONST(0.909678334322736) },
+ { FRAC_CONST(0.412334395923293), FRAC_CONST(0.911032571283032) },
+ { FRAC_CONST(0.409350846241706), FRAC_CONST(0.912377051816407) },
+ { FRAC_CONST(0.406362912741425), FRAC_CONST(0.913711761524555) },
+ { FRAC_CONST(0.403370627420818), FRAC_CONST(0.915036686113806) },
+ { FRAC_CONST(0.400374022324857), FRAC_CONST(0.916351811395282) },
+ { FRAC_CONST(0.397373129544774), FRAC_CONST(0.917657123285050) },
+ { FRAC_CONST(0.394367981217720), FRAC_CONST(0.918952607804266) },
+ { FRAC_CONST(0.391358609526420), FRAC_CONST(0.920238251079332) },
+ { FRAC_CONST(0.388345046698826), FRAC_CONST(0.921514039342042) },
+ { FRAC_CONST(0.385327325007776), FRAC_CONST(0.922779958929729) },
+ { FRAC_CONST(0.382305476770645), FRAC_CONST(0.924035996285410) },
+ { FRAC_CONST(0.379279534348999), FRAC_CONST(0.925282137957935) },
+ { FRAC_CONST(0.376249530148250), FRAC_CONST(0.926518370602127) },
+ { FRAC_CONST(0.373215496617310), FRAC_CONST(0.927744680978929) },
+ { FRAC_CONST(0.370177466248239), FRAC_CONST(0.928961055955541) },
+ { FRAC_CONST(0.367135471575903), FRAC_CONST(0.930167482505564) },
+ { FRAC_CONST(0.364089545177621), FRAC_CONST(0.931363947709140) },
+ { FRAC_CONST(0.361039719672816), FRAC_CONST(0.932550438753087) },
+ { FRAC_CONST(0.357986027722671), FRAC_CONST(0.933726942931039) },
+ { FRAC_CONST(0.354928502029772), FRAC_CONST(0.934893447643582) },
+ { FRAC_CONST(0.351867175337763), FRAC_CONST(0.936049940398387) },
+ { FRAC_CONST(0.348802080430994), FRAC_CONST(0.937196408810347) },
+ { FRAC_CONST(0.345733250134169), FRAC_CONST(0.938332840601705) },
+ { FRAC_CONST(0.342660717311994), FRAC_CONST(0.939459223602190) },
+ { FRAC_CONST(0.339584514868829), FRAC_CONST(0.940575545749145) },
+ { FRAC_CONST(0.336504675748328), FRAC_CONST(0.941681795087657) },
+ { FRAC_CONST(0.333421232933097), FRAC_CONST(0.942777959770684) },
+ { FRAC_CONST(0.330334219444328), FRAC_CONST(0.943864028059183) },
+ { FRAC_CONST(0.327243668341457), FRAC_CONST(0.944939988322235) },
+ { FRAC_CONST(0.324149612721804), FRAC_CONST(0.946005829037171) },
+ { FRAC_CONST(0.321052085720218), FRAC_CONST(0.947061538789691) },
+ { FRAC_CONST(0.317951120508725), FRAC_CONST(0.948107106273994) },
+ { FRAC_CONST(0.314846750296171), FRAC_CONST(0.949142520292891) },
+ { FRAC_CONST(0.311739008327867), FRAC_CONST(0.950167769757930) },
+ { FRAC_CONST(0.308627927885232), FRAC_CONST(0.951182843689513) },
+ { FRAC_CONST(0.305513542285440), FRAC_CONST(0.952187731217013) },
+ { FRAC_CONST(0.302395884881056), FRAC_CONST(0.953182421578893) },
+ { FRAC_CONST(0.299274989059689), FRAC_CONST(0.954166904122818) },
+ { FRAC_CONST(0.296150888243624), FRAC_CONST(0.955141168305771) },
+ { FRAC_CONST(0.293023615889471), FRAC_CONST(0.956105203694164) },
+ { FRAC_CONST(0.289893205487806), FRAC_CONST(0.957058999963955) },
+ { FRAC_CONST(0.286759690562807), FRAC_CONST(0.958002546900750) },
+ { FRAC_CONST(0.283623104671904), FRAC_CONST(0.958935834399920) },
+ { FRAC_CONST(0.280483481405410), FRAC_CONST(0.959858852466706) },
+ { FRAC_CONST(0.277340854386169), FRAC_CONST(0.960771591216325) },
+ { FRAC_CONST(0.274195257269191), FRAC_CONST(0.961674040874080) },
+ { FRAC_CONST(0.271046723741295), FRAC_CONST(0.962566191775459) },
+ { FRAC_CONST(0.267895287520743), FRAC_CONST(0.963448034366243) },
+ { FRAC_CONST(0.264740982356888), FRAC_CONST(0.964319559202607) },
+ { FRAC_CONST(0.261583842029803), FRAC_CONST(0.965180756951218) },
+ { FRAC_CONST(0.258423900349924), FRAC_CONST(0.966031618389343) },
+ { FRAC_CONST(0.255261191157689), FRAC_CONST(0.966872134404937) },
+ { FRAC_CONST(0.252095748323171), FRAC_CONST(0.967702295996750) },
+ { FRAC_CONST(0.248927605745720), FRAC_CONST(0.968522094274417) },
+ { FRAC_CONST(0.245756797353599), FRAC_CONST(0.969331520458559) },
+ { FRAC_CONST(0.242583357103617), FRAC_CONST(0.970130565880871) },
+ { FRAC_CONST(0.239407318980770), FRAC_CONST(0.970919221984218) },
+ { FRAC_CONST(0.236228716997876), FRAC_CONST(0.971697480322728) },
+ { FRAC_CONST(0.233047585195206), FRAC_CONST(0.972465332561878) },
+ { FRAC_CONST(0.229863957640129), FRAC_CONST(0.973222770478587) },
+ { FRAC_CONST(0.226677868426735), FRAC_CONST(0.973969785961306) },
+ { FRAC_CONST(0.223489351675482), FRAC_CONST(0.974706371010097) },
+ { FRAC_CONST(0.220298441532823), FRAC_CONST(0.975432517736727) },
+ { FRAC_CONST(0.217105172170841), FRAC_CONST(0.976148218364747) },
+ { FRAC_CONST(0.213909577786886), FRAC_CONST(0.976853465229579) },
+ { FRAC_CONST(0.210711692603206), FRAC_CONST(0.977548250778596) },
+ { FRAC_CONST(0.207511550866582), FRAC_CONST(0.978232567571202) },
+ { FRAC_CONST(0.204309186847962), FRAC_CONST(0.978906408278914) },
+ { FRAC_CONST(0.201104634842092), FRAC_CONST(0.979569765685441) },
+ { FRAC_CONST(0.197897929167148), FRAC_CONST(0.980222632686756) },
+ { FRAC_CONST(0.194689104164373), FRAC_CONST(0.980865002291179) },
+ { FRAC_CONST(0.191478194197704), FRAC_CONST(0.981496867619447) },
+ { FRAC_CONST(0.188265233653407), FRAC_CONST(0.982118221904791) },
+ { FRAC_CONST(0.185050256939710), FRAC_CONST(0.982729058493005) },
+ { FRAC_CONST(0.181833298486427), FRAC_CONST(0.983329370842520) },
+ { FRAC_CONST(0.178614392744603), FRAC_CONST(0.983919152524473) },
+ { FRAC_CONST(0.175393574186129), FRAC_CONST(0.984498397222776) },
+ { FRAC_CONST(0.172170877303385), FRAC_CONST(0.985067098734184) },
+ { FRAC_CONST(0.168946336608867), FRAC_CONST(0.985625250968360) },
+ { FRAC_CONST(0.165719986634814), FRAC_CONST(0.986172847947943) },
+ { FRAC_CONST(0.162491861932842), FRAC_CONST(0.986709883808609) },
+ { FRAC_CONST(0.159261997073573), FRAC_CONST(0.987236352799134) },
+ { FRAC_CONST(0.156030426646266), FRAC_CONST(0.987752249281460) },
+ { FRAC_CONST(0.152797185258443), FRAC_CONST(0.988257567730749) },
+ { FRAC_CONST(0.149562307535523), FRAC_CONST(0.988752302735447) },
+ { FRAC_CONST(0.146325828120446), FRAC_CONST(0.989236448997339) },
+ { FRAC_CONST(0.143087781673307), FRAC_CONST(0.989710001331608) },
+ { FRAC_CONST(0.139848202870981), FRAC_CONST(0.990172954666889) },
+ { FRAC_CONST(0.136607126406757), FRAC_CONST(0.990625304045323) },
+ { FRAC_CONST(0.133364586989957), FRAC_CONST(0.991067044622612) },
+ { FRAC_CONST(0.130120619345575), FRAC_CONST(0.991498171668069) },
+ { FRAC_CONST(0.126875258213898), FRAC_CONST(0.991918680564670) },
+ { FRAC_CONST(0.123628538350136), FRAC_CONST(0.992328566809103) },
+ { FRAC_CONST(0.120380494524051), FRAC_CONST(0.992727826011815) },
+ { FRAC_CONST(0.117131161519582), FRAC_CONST(0.993116453897061) },
+ { FRAC_CONST(0.113880574134475), FRAC_CONST(0.993494446302948) },
+ { FRAC_CONST(0.110628767179910), FRAC_CONST(0.993861799181482) },
+ { FRAC_CONST(0.107375775480128), FRAC_CONST(0.994218508598608) },
+ { FRAC_CONST(0.104121633872055), FRAC_CONST(0.994564570734255) },
+ { FRAC_CONST(0.100866377204933), FRAC_CONST(0.994899981882376) },
+ { FRAC_CONST(0.097610040339947), FRAC_CONST(0.995224738450986) },
+ { FRAC_CONST(0.094352658149849), FRAC_CONST(0.995538836962204) },
+ { FRAC_CONST(0.091094265518583), FRAC_CONST(0.995842274052287) },
+ { FRAC_CONST(0.087834897340919), FRAC_CONST(0.996135046471667) },
+ { FRAC_CONST(0.084574588522070), FRAC_CONST(0.996417151084987) },
+ { FRAC_CONST(0.081313373977324), FRAC_CONST(0.996688584871134) },
+ { FRAC_CONST(0.078051288631670), FRAC_CONST(0.996949344923269) },
+ { FRAC_CONST(0.074788367419420), FRAC_CONST(0.997199428448862) },
+ { FRAC_CONST(0.071524645283840), FRAC_CONST(0.997438832769720) },
+ { FRAC_CONST(0.068260157176771), FRAC_CONST(0.997667555322013) },
+ { FRAC_CONST(0.064994938058259), FRAC_CONST(0.997885593656308) },
+ { FRAC_CONST(0.061729022896176), FRAC_CONST(0.998092945437590) },
+ { FRAC_CONST(0.058462446665851), FRAC_CONST(0.998289608445286) },
+ { FRAC_CONST(0.055195244349690), FRAC_CONST(0.998475580573295) },
+ { FRAC_CONST(0.051927450936806), FRAC_CONST(0.998650859830004) },
+ { FRAC_CONST(0.048659101422640), FRAC_CONST(0.998815444338313) },
+ { FRAC_CONST(0.045390230808591), FRAC_CONST(0.998969332335654) },
+ { FRAC_CONST(0.042120874101635), FRAC_CONST(0.999112522174011) },
+ { FRAC_CONST(0.038851066313958), FRAC_CONST(0.999245012319936) },
+ { FRAC_CONST(0.035580842462574), FRAC_CONST(0.999366801354564) },
+ { FRAC_CONST(0.032310237568951), FRAC_CONST(0.999477887973635) },
+ { FRAC_CONST(0.029039286658643), FRAC_CONST(0.999578270987499) },
+ { FRAC_CONST(0.025768024760904), FRAC_CONST(0.999667949321134) },
+ { FRAC_CONST(0.022496486908322), FRAC_CONST(0.999746922014158) },
+ { FRAC_CONST(0.019224708136438), FRAC_CONST(0.999815188220837) },
+ { FRAC_CONST(0.015952723483375), FRAC_CONST(0.999872747210095) },
+ { FRAC_CONST(0.012680567989461), FRAC_CONST(0.999919598365521) },
+ { FRAC_CONST(0.009408276696850), FRAC_CONST(0.999955741185376) },
+ { FRAC_CONST(0.006135884649155), FRAC_CONST(0.999981175282601) },
+ { FRAC_CONST(0.002863426891064), FRAC_CONST(0.999995900384816) }
+};
#ifdef LD_DEC
- /* 240 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_960[] =
- {
- { FRAC_CONST(0.999999665337326), FRAC_CONST(0.000818122995607) },
- { FRAC_CONST(0.999972892444367), FRAC_CONST(0.007363041249780) },
- { FRAC_CONST(0.999903284040864), FRAC_CONST(0.013907644095771) },
- { FRAC_CONST(0.999790843108610), FRAC_CONST(0.020451651184577) },
- { FRAC_CONST(0.999635574464198), FRAC_CONST(0.026994782192715) },
- { FRAC_CONST(0.999437484758823), FRAC_CONST(0.033536756834230) },
- { FRAC_CONST(0.999196582477986), FRAC_CONST(0.040077294872701) },
- { FRAC_CONST(0.998912877941140), FRAC_CONST(0.046616116133247) },
- { FRAC_CONST(0.998586383301244), FRAC_CONST(0.053152940514528) },
- { FRAC_CONST(0.998217112544241), FRAC_CONST(0.059687488000744) },
- { FRAC_CONST(0.997805081488460), FRAC_CONST(0.066219478673630) },
- { FRAC_CONST(0.997350307783942), FRAC_CONST(0.072748632724445) },
- { FRAC_CONST(0.996852810911678), FRAC_CONST(0.079274670465961) },
- { FRAC_CONST(0.996312612182778), FRAC_CONST(0.085797312344440) },
- { FRAC_CONST(0.995729734737558), FRAC_CONST(0.092316278951614) },
- { FRAC_CONST(0.995104203544548), FRAC_CONST(0.098831291036650) },
- { FRAC_CONST(0.994436045399422), FRAC_CONST(0.105342069518114) },
- { FRAC_CONST(0.993725288923851), FRAC_CONST(0.111848335495926) },
- { FRAC_CONST(0.992971964564277), FRAC_CONST(0.118349810263305) },
- { FRAC_CONST(0.992176104590608), FRAC_CONST(0.124846215318711) },
- { FRAC_CONST(0.991337743094838), FRAC_CONST(0.131337272377774) },
- { FRAC_CONST(0.990456915989581), FRAC_CONST(0.137822703385212) },
- { FRAC_CONST(0.989533661006540), FRAC_CONST(0.144302230526747) },
- { FRAC_CONST(0.988568017694885), FRAC_CONST(0.150775576241001) },
- { FRAC_CONST(0.987560027419562), FRAC_CONST(0.157242463231389) },
- { FRAC_CONST(0.986509733359519), FRAC_CONST(0.163702614477995) },
- { FRAC_CONST(0.985417180505858), FRAC_CONST(0.170155753249442) },
- { FRAC_CONST(0.984282415659907), FRAC_CONST(0.176601603114742) },
- { FRAC_CONST(0.983105487431216), FRAC_CONST(0.183039887955141) },
- { FRAC_CONST(0.981886446235473), FRAC_CONST(0.189470331975943) },
- { FRAC_CONST(0.980625344292344), FRAC_CONST(0.195892659718330) },
- { FRAC_CONST(0.979322235623241), FRAC_CONST(0.202306596071156) },
- { FRAC_CONST(0.977977176049000), FRAC_CONST(0.208711866282735) },
- { FRAC_CONST(0.976590223187499), FRAC_CONST(0.215108195972610) },
- { FRAC_CONST(0.975161436451181), FRAC_CONST(0.221495311143304) },
- { FRAC_CONST(0.973690877044515), FRAC_CONST(0.227872938192063) },
- { FRAC_CONST(0.972178607961371), FRAC_CONST(0.234240803922570) },
- { FRAC_CONST(0.970624693982323), FRAC_CONST(0.240598635556650) },
- { FRAC_CONST(0.969029201671875), FRAC_CONST(0.246946160745958) },
- { FRAC_CONST(0.967392199375607), FRAC_CONST(0.253283107583640) },
- { FRAC_CONST(0.965713757217249), FRAC_CONST(0.259609204615985) },
- { FRAC_CONST(0.963993947095677), FRAC_CONST(0.265924180854051) },
- { FRAC_CONST(0.962232842681832), FRAC_CONST(0.272227765785273) },
- { FRAC_CONST(0.960430519415566), FRAC_CONST(0.278519689385053) },
- { FRAC_CONST(0.958587054502409), FRAC_CONST(0.284799682128326) },
- { FRAC_CONST(0.956702526910263), FRAC_CONST(0.291067475001103) },
- { FRAC_CONST(0.954777017366017), FRAC_CONST(0.297322799511998) },
- { FRAC_CONST(0.952810608352092), FRAC_CONST(0.303565387703730) },
- { FRAC_CONST(0.950803384102905), FRAC_CONST(0.309794972164597) },
- { FRAC_CONST(0.948755430601263), FRAC_CONST(0.316011286039934) },
- { FRAC_CONST(0.946666835574676), FRAC_CONST(0.322214063043544) },
- { FRAC_CONST(0.944537688491606), FRAC_CONST(0.328403037469105) },
- { FRAC_CONST(0.942368080557626), FRAC_CONST(0.334577944201551) },
- { FRAC_CONST(0.940158104711519), FRAC_CONST(0.340738518728429) },
- { FRAC_CONST(0.937907855621296), FRAC_CONST(0.346884497151231) },
- { FRAC_CONST(0.935617429680138), FRAC_CONST(0.353015616196696) },
- { FRAC_CONST(0.933286925002268), FRAC_CONST(0.359131613228090) },
- { FRAC_CONST(0.930916441418752), FRAC_CONST(0.365232226256457) },
- { FRAC_CONST(0.928506080473216), FRAC_CONST(0.371317193951838) },
- { FRAC_CONST(0.926055945417500), FRAC_CONST(0.377386255654469) },
- { FRAC_CONST(0.923566141207236), FRAC_CONST(0.383439151385947) },
- { FRAC_CONST(0.921036774497350), FRAC_CONST(0.389475621860365) },
- { FRAC_CONST(0.918467953637492), FRAC_CONST(0.395495408495417) },
- { FRAC_CONST(0.915859788667400), FRAC_CONST(0.401498253423481) },
- { FRAC_CONST(0.913212391312179), FRAC_CONST(0.407483899502658) },
- { FRAC_CONST(0.910525874977521), FRAC_CONST(0.413452090327791) },
- { FRAC_CONST(0.907800354744844), FRAC_CONST(0.419402570241451) },
- { FRAC_CONST(0.905035947366364), FRAC_CONST(0.425335084344881) },
- { FRAC_CONST(0.902232771260093), FRAC_CONST(0.431249378508924) },
- { FRAC_CONST(0.899390946504764), FRAC_CONST(0.437145199384900) },
- { FRAC_CONST(0.896510594834693), FRAC_CONST(0.443022294415467) },
- { FRAC_CONST(0.893591839634558), FRAC_CONST(0.448880411845433) },
- { FRAC_CONST(0.890634805934118), FRAC_CONST(0.454719300732547) },
- { FRAC_CONST(0.887639620402854), FRAC_CONST(0.460538710958240) },
- { FRAC_CONST(0.884606411344546), FRAC_CONST(0.466338393238348) },
- { FRAC_CONST(0.881535308691775), FRAC_CONST(0.472118099133784) },
- { FRAC_CONST(0.878426444000357), FRAC_CONST(0.477877581061184) },
- { FRAC_CONST(0.875279950443708), FRAC_CONST(0.483616592303511) },
- { FRAC_CONST(0.872095962807140), FRAC_CONST(0.489334887020625) },
- { FRAC_CONST(0.868874617482085), FRAC_CONST(0.495032220259813) },
- { FRAC_CONST(0.865616052460258), FRAC_CONST(0.500708347966279) },
- { FRAC_CONST(0.862320407327736), FRAC_CONST(0.506363026993605) },
- { FRAC_CONST(0.858987823258990), FRAC_CONST(0.511996015114162) },
- { FRAC_CONST(0.855618443010829), FRAC_CONST(0.517607071029487) },
- { FRAC_CONST(0.852212410916289), FRAC_CONST(0.523195954380619) },
- { FRAC_CONST(0.848769872878448), FRAC_CONST(0.528762425758396) },
- { FRAC_CONST(0.845290976364179), FRAC_CONST(0.534306246713712) },
- { FRAC_CONST(0.841775870397828), FRAC_CONST(0.539827179767727) },
- { FRAC_CONST(0.838224705554838), FRAC_CONST(0.545324988422046) },
- { FRAC_CONST(0.834637633955290), FRAC_CONST(0.550799437168844) },
- { FRAC_CONST(0.831014809257393), FRAC_CONST(0.556250291500956) },
- { FRAC_CONST(0.827356386650900), FRAC_CONST(0.561677317921925) },
- { FRAC_CONST(0.823662522850458), FRAC_CONST(0.567080283956001) },
- { FRAC_CONST(0.819933376088899), FRAC_CONST(0.572458958158102) },
- { FRAC_CONST(0.816169106110459), FRAC_CONST(0.577813110123727) },
- { FRAC_CONST(0.812369874163934), FRAC_CONST(0.583142510498826) },
- { FRAC_CONST(0.808535842995778), FRAC_CONST(0.588446930989624) },
- { FRAC_CONST(0.804667176843123), FRAC_CONST(0.593726144372402) },
- { FRAC_CONST(0.800764041426753), FRAC_CONST(0.598979924503229) },
- { FRAC_CONST(0.796826603943998), FRAC_CONST(0.604208046327650) },
- { FRAC_CONST(0.792855033061574), FRAC_CONST(0.609410285890327) },
- { FRAC_CONST(0.788849498908361), FRAC_CONST(0.614586420344631) },
- { FRAC_CONST(0.784810173068109), FRAC_CONST(0.619736227962191) },
- { FRAC_CONST(0.780737228572094), FRAC_CONST(0.624859488142386) },
- { FRAC_CONST(0.776630839891703), FRAC_CONST(0.629955981421804) },
- { FRAC_CONST(0.772491182930959), FRAC_CONST(0.635025489483633) },
- { FRAC_CONST(0.768318435018988), FRAC_CONST(0.640067795167023) },
- { FRAC_CONST(0.764112774902423), FRAC_CONST(0.645082682476378) },
- { FRAC_CONST(0.759874382737746), FRAC_CONST(0.650069936590618) },
- { FRAC_CONST(0.755603440083571), FRAC_CONST(0.655029343872374) },
- { FRAC_CONST(0.751300129892866), FRAC_CONST(0.659960691877147) },
- { FRAC_CONST(0.746964636505118), FRAC_CONST(0.664863769362399) },
- { FRAC_CONST(0.742597145638433), FRAC_CONST(0.669738366296610) },
- { FRAC_CONST(0.738197844381584), FRAC_CONST(0.674584273868271) },
- { FRAC_CONST(0.733766921185995), FRAC_CONST(0.679401284494831) },
- { FRAC_CONST(0.729304565857668), FRAC_CONST(0.684189191831585) },
- { FRAC_CONST(0.724810969549055), FRAC_CONST(0.688947790780520) },
- { FRAC_CONST(0.720286324750863), FRAC_CONST(0.693676877499095) },
- { FRAC_CONST(0.715730825283819), FRAC_CONST(0.698376249408973) },
- { FRAC_CONST(0.711144666290356), FRAC_CONST(0.703045705204703) },
- { FRAC_CONST(0.706528044226263), FRAC_CONST(0.707685044862340) },
- { FRAC_CONST(0.701881156852263), FRAC_CONST(0.712294069648014) },
- { FRAC_CONST(0.697204203225545), FRAC_CONST(0.716872582126442) },
- { FRAC_CONST(0.692497383691237), FRAC_CONST(0.721420386169390) },
- { FRAC_CONST(0.687760899873822), FRAC_CONST(0.725937286964068) },
- { FRAC_CONST(0.682994954668502), FRAC_CONST(0.730423091021479) },
- { FRAC_CONST(0.678199752232508), FRAC_CONST(0.734877606184707) },
- { FRAC_CONST(0.673375497976352), FRAC_CONST(0.739300641637149) },
- { FRAC_CONST(0.668522398555031), FRAC_CONST(0.743692007910687) },
- { FRAC_CONST(0.663640661859171), FRAC_CONST(0.748051516893805) },
- { FRAC_CONST(0.658730497006124), FRAC_CONST(0.752378981839648) },
- { FRAC_CONST(0.653792114331011), FRAC_CONST(0.756674217374021) },
- { FRAC_CONST(0.648825725377709), FRAC_CONST(0.760937039503328) },
- { FRAC_CONST(0.643831542889792), FRAC_CONST(0.765167265622459) },
- { FRAC_CONST(0.638809780801414), FRAC_CONST(0.769364714522605) },
- { FRAC_CONST(0.633760654228152), FRAC_CONST(0.773529206399025) },
- { FRAC_CONST(0.628684379457781), FRAC_CONST(0.777660562858748) },
- { FRAC_CONST(0.623581173941019), FRAC_CONST(0.781758606928213) },
- { FRAC_CONST(0.618451256282204), FRAC_CONST(0.785823163060853) },
- { FRAC_CONST(0.613294846229936), FRAC_CONST(0.789854057144609) },
- { FRAC_CONST(0.608112164667659), FRAC_CONST(0.793851116509396) },
- { FRAC_CONST(0.602903433604202), FRAC_CONST(0.797814169934493) },
- { FRAC_CONST(0.597668876164268), FRAC_CONST(0.801743047655882) },
- { FRAC_CONST(0.592408716578875), FRAC_CONST(0.805637581373517) },
- { FRAC_CONST(0.587123180175754), FRAC_CONST(0.809497604258536) },
- { FRAC_CONST(0.581812493369691), FRAC_CONST(0.813322950960406) },
- { FRAC_CONST(0.576476883652835), FRAC_CONST(0.817113457614006) },
- { FRAC_CONST(0.571116579584947), FRAC_CONST(0.820868961846646) },
- { FRAC_CONST(0.565731810783613), FRAC_CONST(0.824589302785025) },
- { FRAC_CONST(0.560322807914407), FRAC_CONST(0.828274321062119) },
- { FRAC_CONST(0.554889802681009), FRAC_CONST(0.831923858824010) },
- { FRAC_CONST(0.549433027815281), FRAC_CONST(0.835537759736646) },
- { FRAC_CONST(0.543952717067296), FRAC_CONST(0.839115868992540) },
- { FRAC_CONST(0.538449105195327), FRAC_CONST(0.842658033317402) },
- { FRAC_CONST(0.532922427955790), FRAC_CONST(0.846164100976699) },
- { FRAC_CONST(0.527372922093142), FRAC_CONST(0.849633921782164) },
- { FRAC_CONST(0.521800825329746), FRAC_CONST(0.853067347098221) },
- { FRAC_CONST(0.516206376355680), FRAC_CONST(0.856464229848356) },
- { FRAC_CONST(0.510589814818519), FRAC_CONST(0.859824424521420) },
- { FRAC_CONST(0.504951381313066), FRAC_CONST(0.863147787177854) },
- { FRAC_CONST(0.499291317371047), FRAC_CONST(0.866434175455865) },
- { FRAC_CONST(0.493609865450762), FRAC_CONST(0.869683448577516) },
- { FRAC_CONST(0.487907268926702), FRAC_CONST(0.872895467354761) },
- { FRAC_CONST(0.482183772079123), FRAC_CONST(0.876070094195407) },
- { FRAC_CONST(0.476439620083580), FRAC_CONST(0.879207193109004) },
- { FRAC_CONST(0.470675059000427), FRAC_CONST(0.882306629712678) },
- { FRAC_CONST(0.464890335764274), FRAC_CONST(0.885368271236879) },
- { FRAC_CONST(0.459085698173413), FRAC_CONST(0.888391986531075) },
- { FRAC_CONST(0.453261394879198), FRAC_CONST(0.891377646069366) },
- { FRAC_CONST(0.447417675375397), FRAC_CONST(0.894325121956035) },
- { FRAC_CONST(0.441554789987504), FRAC_CONST(0.897234287931024) },
- { FRAC_CONST(0.435672989862017), FRAC_CONST(0.900105019375345) },
- { FRAC_CONST(0.429772526955677), FRAC_CONST(0.902937193316419) },
- { FRAC_CONST(0.423853654024676), FRAC_CONST(0.905730688433339) },
- { FRAC_CONST(0.417916624613831), FRAC_CONST(0.908485385062073) },
- { FRAC_CONST(0.411961693045722), FRAC_CONST(0.911201165200584) },
- { FRAC_CONST(0.405989114409798), FRAC_CONST(0.913877912513892) },
- { FRAC_CONST(0.399999144551449), FRAC_CONST(0.916515512339049) },
- { FRAC_CONST(0.393992040061048), FRAC_CONST(0.919113851690058) },
- { FRAC_CONST(0.387968058262959), FRAC_CONST(0.921672819262709) },
- { FRAC_CONST(0.381927457204511), FRAC_CONST(0.924192305439348) },
- { FRAC_CONST(0.375870495644949), FRAC_CONST(0.926672202293573) },
- { FRAC_CONST(0.369797433044349), FRAC_CONST(0.929112403594856) },
- { FRAC_CONST(0.363708529552499), FRAC_CONST(0.931512804813095) },
- { FRAC_CONST(0.357604045997758), FRAC_CONST(0.933873303123091) },
- { FRAC_CONST(0.351484243875885), FRAC_CONST(0.936193797408954) },
- { FRAC_CONST(0.345349385338836), FRAC_CONST(0.938474188268430) },
- { FRAC_CONST(0.339199733183530), FRAC_CONST(0.940714378017165) },
- { FRAC_CONST(0.333035550840599), FRAC_CONST(0.942914270692887) },
- { FRAC_CONST(0.326857102363098), FRAC_CONST(0.945073772059514) },
- { FRAC_CONST(0.320664652415198), FRAC_CONST(0.947192789611197) },
- { FRAC_CONST(0.314458466260842), FRAC_CONST(0.949271232576274) },
- { FRAC_CONST(0.308238809752391), FRAC_CONST(0.951309011921168) },
- { FRAC_CONST(0.302005949319228), FRAC_CONST(0.953306040354194) },
- { FRAC_CONST(0.295760151956351), FRAC_CONST(0.955262232329299) },
- { FRAC_CONST(0.289501685212929), FRAC_CONST(0.957177504049732) },
- { FRAC_CONST(0.283230817180850), FRAC_CONST(0.959051773471624) },
- { FRAC_CONST(0.276947816483228), FRAC_CONST(0.960884960307514) },
- { FRAC_CONST(0.270652952262902), FRAC_CONST(0.962676986029777) },
- { FRAC_CONST(0.264346494170904), FRAC_CONST(0.964427773873996) },
- { FRAC_CONST(0.258028712354909), FRAC_CONST(0.966137248842248) },
- { FRAC_CONST(0.251699877447663), FRAC_CONST(0.967805337706313) },
- { FRAC_CONST(0.245360260555389), FRAC_CONST(0.969431969010818) },
- { FRAC_CONST(0.239010133246176), FRAC_CONST(0.971017073076290) },
- { FRAC_CONST(0.232649767538342), FRAC_CONST(0.972560582002147) },
- { FRAC_CONST(0.226279435888785), FRAC_CONST(0.974062429669605) },
- { FRAC_CONST(0.219899411181310), FRAC_CONST(0.975522551744506) },
- { FRAC_CONST(0.213509966714943), FRAC_CONST(0.976940885680082) },
- { FRAC_CONST(0.207111376192219), FRAC_CONST(0.978317370719628) },
- { FRAC_CONST(0.200703913707458), FRAC_CONST(0.979651947899104) },
- { FRAC_CONST(0.194287853735029), FRAC_CONST(0.980944560049668) },
- { FRAC_CONST(0.187863471117585), FRAC_CONST(0.982195151800116) },
- { FRAC_CONST(0.181431041054297), FRAC_CONST(0.983403669579260) },
- { FRAC_CONST(0.174990839089060), FRAC_CONST(0.984570061618221) },
- { FRAC_CONST(0.168543141098691), FRAC_CONST(0.985694277952645) },
- { FRAC_CONST(0.162088223281113), FRAC_CONST(0.986776270424848) },
- { FRAC_CONST(0.155626362143520), FRAC_CONST(0.987815992685872) },
- { FRAC_CONST(0.149157834490539), FRAC_CONST(0.988813400197476) },
- { FRAC_CONST(0.142682917412363), FRAC_CONST(0.989768450234042) },
- { FRAC_CONST(0.136201888272891), FRAC_CONST(0.990681101884405) },
- { FRAC_CONST(0.129715024697841), FRAC_CONST(0.991551316053606) },
- { FRAC_CONST(0.123222604562857), FRAC_CONST(0.992379055464567) },
- { FRAC_CONST(0.116724905981611), FRAC_CONST(0.993164284659685) },
- { FRAC_CONST(0.110222207293883), FRAC_CONST(0.993906970002356) },
- { FRAC_CONST(0.103714787053643), FRAC_CONST(0.994607079678411) },
- { FRAC_CONST(0.097202924017115), FRAC_CONST(0.995264583697482) },
- { FRAC_CONST(0.090686897130838), FRAC_CONST(0.995879453894286) },
- { FRAC_CONST(0.084166985519718), FRAC_CONST(0.996451663929828) },
- { FRAC_CONST(0.077643468475068), FRAC_CONST(0.996981189292537) },
- { FRAC_CONST(0.071116625442645), FRAC_CONST(0.997468007299307) },
- { FRAC_CONST(0.064586736010684), FRAC_CONST(0.997912097096476) },
- { FRAC_CONST(0.058054079897912), FRAC_CONST(0.998313439660714) },
- { FRAC_CONST(0.051518936941578), FRAC_CONST(0.998672017799843) },
- { FRAC_CONST(0.044981587085452), FRAC_CONST(0.998987816153567) },
- { FRAC_CONST(0.038442310367847), FRAC_CONST(0.999260821194138) },
- { FRAC_CONST(0.031901386909611), FRAC_CONST(0.999491021226926) },
- { FRAC_CONST(0.025359096902136), FRAC_CONST(0.999678406390929) },
- { FRAC_CONST(0.018815720595351), FRAC_CONST(0.999822968659191) },
- { FRAC_CONST(0.012271538285720), FRAC_CONST(0.999924701839145) },
- { FRAC_CONST(0.005726830304231), FRAC_CONST(0.999983601572879) }
- };
+/* 240 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_960[] =
+{
+ { FRAC_CONST(0.999999665337326), FRAC_CONST(0.000818122995607) },
+ { FRAC_CONST(0.999972892444367), FRAC_CONST(0.007363041249780) },
+ { FRAC_CONST(0.999903284040864), FRAC_CONST(0.013907644095771) },
+ { FRAC_CONST(0.999790843108610), FRAC_CONST(0.020451651184577) },
+ { FRAC_CONST(0.999635574464198), FRAC_CONST(0.026994782192715) },
+ { FRAC_CONST(0.999437484758823), FRAC_CONST(0.033536756834230) },
+ { FRAC_CONST(0.999196582477986), FRAC_CONST(0.040077294872701) },
+ { FRAC_CONST(0.998912877941140), FRAC_CONST(0.046616116133247) },
+ { FRAC_CONST(0.998586383301244), FRAC_CONST(0.053152940514528) },
+ { FRAC_CONST(0.998217112544241), FRAC_CONST(0.059687488000744) },
+ { FRAC_CONST(0.997805081488460), FRAC_CONST(0.066219478673630) },
+ { FRAC_CONST(0.997350307783942), FRAC_CONST(0.072748632724445) },
+ { FRAC_CONST(0.996852810911678), FRAC_CONST(0.079274670465961) },
+ { FRAC_CONST(0.996312612182778), FRAC_CONST(0.085797312344440) },
+ { FRAC_CONST(0.995729734737558), FRAC_CONST(0.092316278951614) },
+ { FRAC_CONST(0.995104203544548), FRAC_CONST(0.098831291036650) },
+ { FRAC_CONST(0.994436045399422), FRAC_CONST(0.105342069518114) },
+ { FRAC_CONST(0.993725288923851), FRAC_CONST(0.111848335495926) },
+ { FRAC_CONST(0.992971964564277), FRAC_CONST(0.118349810263305) },
+ { FRAC_CONST(0.992176104590608), FRAC_CONST(0.124846215318711) },
+ { FRAC_CONST(0.991337743094838), FRAC_CONST(0.131337272377774) },
+ { FRAC_CONST(0.990456915989581), FRAC_CONST(0.137822703385212) },
+ { FRAC_CONST(0.989533661006540), FRAC_CONST(0.144302230526747) },
+ { FRAC_CONST(0.988568017694885), FRAC_CONST(0.150775576241001) },
+ { FRAC_CONST(0.987560027419562), FRAC_CONST(0.157242463231389) },
+ { FRAC_CONST(0.986509733359519), FRAC_CONST(0.163702614477995) },
+ { FRAC_CONST(0.985417180505858), FRAC_CONST(0.170155753249442) },
+ { FRAC_CONST(0.984282415659907), FRAC_CONST(0.176601603114742) },
+ { FRAC_CONST(0.983105487431216), FRAC_CONST(0.183039887955141) },
+ { FRAC_CONST(0.981886446235473), FRAC_CONST(0.189470331975943) },
+ { FRAC_CONST(0.980625344292344), FRAC_CONST(0.195892659718330) },
+ { FRAC_CONST(0.979322235623241), FRAC_CONST(0.202306596071156) },
+ { FRAC_CONST(0.977977176049000), FRAC_CONST(0.208711866282735) },
+ { FRAC_CONST(0.976590223187499), FRAC_CONST(0.215108195972610) },
+ { FRAC_CONST(0.975161436451181), FRAC_CONST(0.221495311143304) },
+ { FRAC_CONST(0.973690877044515), FRAC_CONST(0.227872938192063) },
+ { FRAC_CONST(0.972178607961371), FRAC_CONST(0.234240803922570) },
+ { FRAC_CONST(0.970624693982323), FRAC_CONST(0.240598635556650) },
+ { FRAC_CONST(0.969029201671875), FRAC_CONST(0.246946160745958) },
+ { FRAC_CONST(0.967392199375607), FRAC_CONST(0.253283107583640) },
+ { FRAC_CONST(0.965713757217249), FRAC_CONST(0.259609204615985) },
+ { FRAC_CONST(0.963993947095677), FRAC_CONST(0.265924180854051) },
+ { FRAC_CONST(0.962232842681832), FRAC_CONST(0.272227765785273) },
+ { FRAC_CONST(0.960430519415566), FRAC_CONST(0.278519689385053) },
+ { FRAC_CONST(0.958587054502409), FRAC_CONST(0.284799682128326) },
+ { FRAC_CONST(0.956702526910263), FRAC_CONST(0.291067475001103) },
+ { FRAC_CONST(0.954777017366017), FRAC_CONST(0.297322799511998) },
+ { FRAC_CONST(0.952810608352092), FRAC_CONST(0.303565387703730) },
+ { FRAC_CONST(0.950803384102905), FRAC_CONST(0.309794972164597) },
+ { FRAC_CONST(0.948755430601263), FRAC_CONST(0.316011286039934) },
+ { FRAC_CONST(0.946666835574676), FRAC_CONST(0.322214063043544) },
+ { FRAC_CONST(0.944537688491606), FRAC_CONST(0.328403037469105) },
+ { FRAC_CONST(0.942368080557626), FRAC_CONST(0.334577944201551) },
+ { FRAC_CONST(0.940158104711519), FRAC_CONST(0.340738518728429) },
+ { FRAC_CONST(0.937907855621296), FRAC_CONST(0.346884497151231) },
+ { FRAC_CONST(0.935617429680138), FRAC_CONST(0.353015616196696) },
+ { FRAC_CONST(0.933286925002268), FRAC_CONST(0.359131613228090) },
+ { FRAC_CONST(0.930916441418752), FRAC_CONST(0.365232226256457) },
+ { FRAC_CONST(0.928506080473216), FRAC_CONST(0.371317193951838) },
+ { FRAC_CONST(0.926055945417500), FRAC_CONST(0.377386255654469) },
+ { FRAC_CONST(0.923566141207236), FRAC_CONST(0.383439151385947) },
+ { FRAC_CONST(0.921036774497350), FRAC_CONST(0.389475621860365) },
+ { FRAC_CONST(0.918467953637492), FRAC_CONST(0.395495408495417) },
+ { FRAC_CONST(0.915859788667400), FRAC_CONST(0.401498253423481) },
+ { FRAC_CONST(0.913212391312179), FRAC_CONST(0.407483899502658) },
+ { FRAC_CONST(0.910525874977521), FRAC_CONST(0.413452090327791) },
+ { FRAC_CONST(0.907800354744844), FRAC_CONST(0.419402570241451) },
+ { FRAC_CONST(0.905035947366364), FRAC_CONST(0.425335084344881) },
+ { FRAC_CONST(0.902232771260093), FRAC_CONST(0.431249378508924) },
+ { FRAC_CONST(0.899390946504764), FRAC_CONST(0.437145199384900) },
+ { FRAC_CONST(0.896510594834693), FRAC_CONST(0.443022294415467) },
+ { FRAC_CONST(0.893591839634558), FRAC_CONST(0.448880411845433) },
+ { FRAC_CONST(0.890634805934118), FRAC_CONST(0.454719300732547) },
+ { FRAC_CONST(0.887639620402854), FRAC_CONST(0.460538710958240) },
+ { FRAC_CONST(0.884606411344546), FRAC_CONST(0.466338393238348) },
+ { FRAC_CONST(0.881535308691775), FRAC_CONST(0.472118099133784) },
+ { FRAC_CONST(0.878426444000357), FRAC_CONST(0.477877581061184) },
+ { FRAC_CONST(0.875279950443708), FRAC_CONST(0.483616592303511) },
+ { FRAC_CONST(0.872095962807140), FRAC_CONST(0.489334887020625) },
+ { FRAC_CONST(0.868874617482085), FRAC_CONST(0.495032220259813) },
+ { FRAC_CONST(0.865616052460258), FRAC_CONST(0.500708347966279) },
+ { FRAC_CONST(0.862320407327736), FRAC_CONST(0.506363026993605) },
+ { FRAC_CONST(0.858987823258990), FRAC_CONST(0.511996015114162) },
+ { FRAC_CONST(0.855618443010829), FRAC_CONST(0.517607071029487) },
+ { FRAC_CONST(0.852212410916289), FRAC_CONST(0.523195954380619) },
+ { FRAC_CONST(0.848769872878448), FRAC_CONST(0.528762425758396) },
+ { FRAC_CONST(0.845290976364179), FRAC_CONST(0.534306246713712) },
+ { FRAC_CONST(0.841775870397828), FRAC_CONST(0.539827179767727) },
+ { FRAC_CONST(0.838224705554838), FRAC_CONST(0.545324988422046) },
+ { FRAC_CONST(0.834637633955290), FRAC_CONST(0.550799437168844) },
+ { FRAC_CONST(0.831014809257393), FRAC_CONST(0.556250291500956) },
+ { FRAC_CONST(0.827356386650900), FRAC_CONST(0.561677317921925) },
+ { FRAC_CONST(0.823662522850458), FRAC_CONST(0.567080283956001) },
+ { FRAC_CONST(0.819933376088899), FRAC_CONST(0.572458958158102) },
+ { FRAC_CONST(0.816169106110459), FRAC_CONST(0.577813110123727) },
+ { FRAC_CONST(0.812369874163934), FRAC_CONST(0.583142510498826) },
+ { FRAC_CONST(0.808535842995778), FRAC_CONST(0.588446930989624) },
+ { FRAC_CONST(0.804667176843123), FRAC_CONST(0.593726144372402) },
+ { FRAC_CONST(0.800764041426753), FRAC_CONST(0.598979924503229) },
+ { FRAC_CONST(0.796826603943998), FRAC_CONST(0.604208046327650) },
+ { FRAC_CONST(0.792855033061574), FRAC_CONST(0.609410285890327) },
+ { FRAC_CONST(0.788849498908361), FRAC_CONST(0.614586420344631) },
+ { FRAC_CONST(0.784810173068109), FRAC_CONST(0.619736227962191) },
+ { FRAC_CONST(0.780737228572094), FRAC_CONST(0.624859488142386) },
+ { FRAC_CONST(0.776630839891703), FRAC_CONST(0.629955981421804) },
+ { FRAC_CONST(0.772491182930959), FRAC_CONST(0.635025489483633) },
+ { FRAC_CONST(0.768318435018988), FRAC_CONST(0.640067795167023) },
+ { FRAC_CONST(0.764112774902423), FRAC_CONST(0.645082682476378) },
+ { FRAC_CONST(0.759874382737746), FRAC_CONST(0.650069936590618) },
+ { FRAC_CONST(0.755603440083571), FRAC_CONST(0.655029343872374) },
+ { FRAC_CONST(0.751300129892866), FRAC_CONST(0.659960691877147) },
+ { FRAC_CONST(0.746964636505118), FRAC_CONST(0.664863769362399) },
+ { FRAC_CONST(0.742597145638433), FRAC_CONST(0.669738366296610) },
+ { FRAC_CONST(0.738197844381584), FRAC_CONST(0.674584273868271) },
+ { FRAC_CONST(0.733766921185995), FRAC_CONST(0.679401284494831) },
+ { FRAC_CONST(0.729304565857668), FRAC_CONST(0.684189191831585) },
+ { FRAC_CONST(0.724810969549055), FRAC_CONST(0.688947790780520) },
+ { FRAC_CONST(0.720286324750863), FRAC_CONST(0.693676877499095) },
+ { FRAC_CONST(0.715730825283819), FRAC_CONST(0.698376249408973) },
+ { FRAC_CONST(0.711144666290356), FRAC_CONST(0.703045705204703) },
+ { FRAC_CONST(0.706528044226263), FRAC_CONST(0.707685044862340) },
+ { FRAC_CONST(0.701881156852263), FRAC_CONST(0.712294069648014) },
+ { FRAC_CONST(0.697204203225545), FRAC_CONST(0.716872582126442) },
+ { FRAC_CONST(0.692497383691237), FRAC_CONST(0.721420386169390) },
+ { FRAC_CONST(0.687760899873822), FRAC_CONST(0.725937286964068) },
+ { FRAC_CONST(0.682994954668502), FRAC_CONST(0.730423091021479) },
+ { FRAC_CONST(0.678199752232508), FRAC_CONST(0.734877606184707) },
+ { FRAC_CONST(0.673375497976352), FRAC_CONST(0.739300641637149) },
+ { FRAC_CONST(0.668522398555031), FRAC_CONST(0.743692007910687) },
+ { FRAC_CONST(0.663640661859171), FRAC_CONST(0.748051516893805) },
+ { FRAC_CONST(0.658730497006124), FRAC_CONST(0.752378981839648) },
+ { FRAC_CONST(0.653792114331011), FRAC_CONST(0.756674217374021) },
+ { FRAC_CONST(0.648825725377709), FRAC_CONST(0.760937039503328) },
+ { FRAC_CONST(0.643831542889792), FRAC_CONST(0.765167265622459) },
+ { FRAC_CONST(0.638809780801414), FRAC_CONST(0.769364714522605) },
+ { FRAC_CONST(0.633760654228152), FRAC_CONST(0.773529206399025) },
+ { FRAC_CONST(0.628684379457781), FRAC_CONST(0.777660562858748) },
+ { FRAC_CONST(0.623581173941019), FRAC_CONST(0.781758606928213) },
+ { FRAC_CONST(0.618451256282204), FRAC_CONST(0.785823163060853) },
+ { FRAC_CONST(0.613294846229936), FRAC_CONST(0.789854057144609) },
+ { FRAC_CONST(0.608112164667659), FRAC_CONST(0.793851116509396) },
+ { FRAC_CONST(0.602903433604202), FRAC_CONST(0.797814169934493) },
+ { FRAC_CONST(0.597668876164268), FRAC_CONST(0.801743047655882) },
+ { FRAC_CONST(0.592408716578875), FRAC_CONST(0.805637581373517) },
+ { FRAC_CONST(0.587123180175754), FRAC_CONST(0.809497604258536) },
+ { FRAC_CONST(0.581812493369691), FRAC_CONST(0.813322950960406) },
+ { FRAC_CONST(0.576476883652835), FRAC_CONST(0.817113457614006) },
+ { FRAC_CONST(0.571116579584947), FRAC_CONST(0.820868961846646) },
+ { FRAC_CONST(0.565731810783613), FRAC_CONST(0.824589302785025) },
+ { FRAC_CONST(0.560322807914407), FRAC_CONST(0.828274321062119) },
+ { FRAC_CONST(0.554889802681009), FRAC_CONST(0.831923858824010) },
+ { FRAC_CONST(0.549433027815281), FRAC_CONST(0.835537759736646) },
+ { FRAC_CONST(0.543952717067296), FRAC_CONST(0.839115868992540) },
+ { FRAC_CONST(0.538449105195327), FRAC_CONST(0.842658033317402) },
+ { FRAC_CONST(0.532922427955790), FRAC_CONST(0.846164100976699) },
+ { FRAC_CONST(0.527372922093142), FRAC_CONST(0.849633921782164) },
+ { FRAC_CONST(0.521800825329746), FRAC_CONST(0.853067347098221) },
+ { FRAC_CONST(0.516206376355680), FRAC_CONST(0.856464229848356) },
+ { FRAC_CONST(0.510589814818519), FRAC_CONST(0.859824424521420) },
+ { FRAC_CONST(0.504951381313066), FRAC_CONST(0.863147787177854) },
+ { FRAC_CONST(0.499291317371047), FRAC_CONST(0.866434175455865) },
+ { FRAC_CONST(0.493609865450762), FRAC_CONST(0.869683448577516) },
+ { FRAC_CONST(0.487907268926702), FRAC_CONST(0.872895467354761) },
+ { FRAC_CONST(0.482183772079123), FRAC_CONST(0.876070094195407) },
+ { FRAC_CONST(0.476439620083580), FRAC_CONST(0.879207193109004) },
+ { FRAC_CONST(0.470675059000427), FRAC_CONST(0.882306629712678) },
+ { FRAC_CONST(0.464890335764274), FRAC_CONST(0.885368271236879) },
+ { FRAC_CONST(0.459085698173413), FRAC_CONST(0.888391986531075) },
+ { FRAC_CONST(0.453261394879198), FRAC_CONST(0.891377646069366) },
+ { FRAC_CONST(0.447417675375397), FRAC_CONST(0.894325121956035) },
+ { FRAC_CONST(0.441554789987504), FRAC_CONST(0.897234287931024) },
+ { FRAC_CONST(0.435672989862017), FRAC_CONST(0.900105019375345) },
+ { FRAC_CONST(0.429772526955677), FRAC_CONST(0.902937193316419) },
+ { FRAC_CONST(0.423853654024676), FRAC_CONST(0.905730688433339) },
+ { FRAC_CONST(0.417916624613831), FRAC_CONST(0.908485385062073) },
+ { FRAC_CONST(0.411961693045722), FRAC_CONST(0.911201165200584) },
+ { FRAC_CONST(0.405989114409798), FRAC_CONST(0.913877912513892) },
+ { FRAC_CONST(0.399999144551449), FRAC_CONST(0.916515512339049) },
+ { FRAC_CONST(0.393992040061048), FRAC_CONST(0.919113851690058) },
+ { FRAC_CONST(0.387968058262959), FRAC_CONST(0.921672819262709) },
+ { FRAC_CONST(0.381927457204511), FRAC_CONST(0.924192305439348) },
+ { FRAC_CONST(0.375870495644949), FRAC_CONST(0.926672202293573) },
+ { FRAC_CONST(0.369797433044349), FRAC_CONST(0.929112403594856) },
+ { FRAC_CONST(0.363708529552499), FRAC_CONST(0.931512804813095) },
+ { FRAC_CONST(0.357604045997758), FRAC_CONST(0.933873303123091) },
+ { FRAC_CONST(0.351484243875885), FRAC_CONST(0.936193797408954) },
+ { FRAC_CONST(0.345349385338836), FRAC_CONST(0.938474188268430) },
+ { FRAC_CONST(0.339199733183530), FRAC_CONST(0.940714378017165) },
+ { FRAC_CONST(0.333035550840599), FRAC_CONST(0.942914270692887) },
+ { FRAC_CONST(0.326857102363098), FRAC_CONST(0.945073772059514) },
+ { FRAC_CONST(0.320664652415198), FRAC_CONST(0.947192789611197) },
+ { FRAC_CONST(0.314458466260842), FRAC_CONST(0.949271232576274) },
+ { FRAC_CONST(0.308238809752391), FRAC_CONST(0.951309011921168) },
+ { FRAC_CONST(0.302005949319228), FRAC_CONST(0.953306040354194) },
+ { FRAC_CONST(0.295760151956351), FRAC_CONST(0.955262232329299) },
+ { FRAC_CONST(0.289501685212929), FRAC_CONST(0.957177504049732) },
+ { FRAC_CONST(0.283230817180850), FRAC_CONST(0.959051773471624) },
+ { FRAC_CONST(0.276947816483228), FRAC_CONST(0.960884960307514) },
+ { FRAC_CONST(0.270652952262902), FRAC_CONST(0.962676986029777) },
+ { FRAC_CONST(0.264346494170904), FRAC_CONST(0.964427773873996) },
+ { FRAC_CONST(0.258028712354909), FRAC_CONST(0.966137248842248) },
+ { FRAC_CONST(0.251699877447663), FRAC_CONST(0.967805337706313) },
+ { FRAC_CONST(0.245360260555389), FRAC_CONST(0.969431969010818) },
+ { FRAC_CONST(0.239010133246176), FRAC_CONST(0.971017073076290) },
+ { FRAC_CONST(0.232649767538342), FRAC_CONST(0.972560582002147) },
+ { FRAC_CONST(0.226279435888785), FRAC_CONST(0.974062429669605) },
+ { FRAC_CONST(0.219899411181310), FRAC_CONST(0.975522551744506) },
+ { FRAC_CONST(0.213509966714943), FRAC_CONST(0.976940885680082) },
+ { FRAC_CONST(0.207111376192219), FRAC_CONST(0.978317370719628) },
+ { FRAC_CONST(0.200703913707458), FRAC_CONST(0.979651947899104) },
+ { FRAC_CONST(0.194287853735029), FRAC_CONST(0.980944560049668) },
+ { FRAC_CONST(0.187863471117585), FRAC_CONST(0.982195151800116) },
+ { FRAC_CONST(0.181431041054297), FRAC_CONST(0.983403669579260) },
+ { FRAC_CONST(0.174990839089060), FRAC_CONST(0.984570061618221) },
+ { FRAC_CONST(0.168543141098691), FRAC_CONST(0.985694277952645) },
+ { FRAC_CONST(0.162088223281113), FRAC_CONST(0.986776270424848) },
+ { FRAC_CONST(0.155626362143520), FRAC_CONST(0.987815992685872) },
+ { FRAC_CONST(0.149157834490539), FRAC_CONST(0.988813400197476) },
+ { FRAC_CONST(0.142682917412363), FRAC_CONST(0.989768450234042) },
+ { FRAC_CONST(0.136201888272891), FRAC_CONST(0.990681101884405) },
+ { FRAC_CONST(0.129715024697841), FRAC_CONST(0.991551316053606) },
+ { FRAC_CONST(0.123222604562857), FRAC_CONST(0.992379055464567) },
+ { FRAC_CONST(0.116724905981611), FRAC_CONST(0.993164284659685) },
+ { FRAC_CONST(0.110222207293883), FRAC_CONST(0.993906970002356) },
+ { FRAC_CONST(0.103714787053643), FRAC_CONST(0.994607079678411) },
+ { FRAC_CONST(0.097202924017115), FRAC_CONST(0.995264583697482) },
+ { FRAC_CONST(0.090686897130838), FRAC_CONST(0.995879453894286) },
+ { FRAC_CONST(0.084166985519718), FRAC_CONST(0.996451663929828) },
+ { FRAC_CONST(0.077643468475068), FRAC_CONST(0.996981189292537) },
+ { FRAC_CONST(0.071116625442645), FRAC_CONST(0.997468007299307) },
+ { FRAC_CONST(0.064586736010684), FRAC_CONST(0.997912097096476) },
+ { FRAC_CONST(0.058054079897912), FRAC_CONST(0.998313439660714) },
+ { FRAC_CONST(0.051518936941578), FRAC_CONST(0.998672017799843) },
+ { FRAC_CONST(0.044981587085452), FRAC_CONST(0.998987816153567) },
+ { FRAC_CONST(0.038442310367847), FRAC_CONST(0.999260821194138) },
+ { FRAC_CONST(0.031901386909611), FRAC_CONST(0.999491021226926) },
+ { FRAC_CONST(0.025359096902136), FRAC_CONST(0.999678406390929) },
+ { FRAC_CONST(0.018815720595351), FRAC_CONST(0.999822968659191) },
+ { FRAC_CONST(0.012271538285720), FRAC_CONST(0.999924701839145) },
+ { FRAC_CONST(0.005726830304231), FRAC_CONST(0.999983601572879) }
+};
#endif // LD_DEC
- /* 60 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_240[] =
- {
- { FRAC_CONST(0.999994645401696), FRAC_CONST(0.003272486506527) },
- { FRAC_CONST(0.999566308502021), FRAC_CONST(0.029448173247963) },
- { FRAC_CONST(0.998452918783950), FRAC_CONST(0.055603677682425) },
- { FRAC_CONST(0.996655239309180), FRAC_CONST(0.081721074133668) },
- { FRAC_CONST(0.994174502117428), FRAC_CONST(0.107782463042759) },
- { FRAC_CONST(0.991012407382049), FRAC_CONST(0.133769983235535) },
- { FRAC_CONST(0.987171122244825), FRAC_CONST(0.159665824163761) },
- { FRAC_CONST(0.982653279330712), FRAC_CONST(0.185452238111591) },
- { FRAC_CONST(0.977461974943572), FRAC_CONST(0.211111552358965) },
- { FRAC_CONST(0.971600766944121), FRAC_CONST(0.236626181293610) },
- { FRAC_CONST(0.965073672311547), FRAC_CONST(0.261978638463337) },
- { FRAC_CONST(0.957885164390477), FRAC_CONST(0.287151548560387) },
- { FRAC_CONST(0.950040169825165), FRAC_CONST(0.312127659329594) },
- { FRAC_CONST(0.941544065183021), FRAC_CONST(0.336889853392220) },
- { FRAC_CONST(0.932402673269775), FRAC_CONST(0.361421159977355) },
- { FRAC_CONST(0.922622259138823), FRAC_CONST(0.385704766552831) },
- { FRAC_CONST(0.912209525797468), FRAC_CONST(0.409724030347695) },
- { FRAC_CONST(0.901171609613013), FRAC_CONST(0.433462489758331) },
- { FRAC_CONST(0.889516075421856), FRAC_CONST(0.456903875630421) },
- { FRAC_CONST(0.877250911344924), FRAC_CONST(0.480032122409011) },
- { FRAC_CONST(0.864384523313017), FRAC_CONST(0.502831379149042) },
- { FRAC_CONST(0.850925729305802), FRAC_CONST(0.525286020378792) },
- { FRAC_CONST(0.836883753308409), FRAC_CONST(0.547380656808797) },
- { FRAC_CONST(0.822268218989775), FRAC_CONST(0.569100145878898) },
- { FRAC_CONST(0.807089143107059), FRAC_CONST(0.590429602136201) },
- { FRAC_CONST(0.791356928640660), FRAC_CONST(0.611354407436816) },
- { FRAC_CONST(0.775082357664531), FRAC_CONST(0.631860220964409) },
- { FRAC_CONST(0.758276583956687), FRAC_CONST(0.651932989058674) },
- { FRAC_CONST(0.740951125354959), FRAC_CONST(0.671558954847018) },
- { FRAC_CONST(0.723117855863248), FRAC_CONST(0.690724667672829) },
- { FRAC_CONST(0.704788997513670), FRAC_CONST(0.709416992313883) },
- { FRAC_CONST(0.685977111990193), FRAC_CONST(0.727623117984575) },
- { FRAC_CONST(0.666695092019479), FRAC_CONST(0.745330567115786) },
- { FRAC_CONST(0.646956152534857), FRAC_CONST(0.762527203906388) },
- { FRAC_CONST(0.626773821619469), FRAC_CONST(0.779201242640517) },
- { FRAC_CONST(0.606161931234795), FRAC_CONST(0.795341255764910) },
- { FRAC_CONST(0.585134607740916), FRAC_CONST(0.810936181720784) },
- { FRAC_CONST(0.563706262215017), FRAC_CONST(0.825975332524873) },
- { FRAC_CONST(0.541891580574752), FRAC_CONST(0.840448401094438) },
- { FRAC_CONST(0.519705513513249), FRAC_CONST(0.854345468311227) },
- { FRAC_CONST(0.497163266252654), FRAC_CONST(0.867657009819544) },
- { FRAC_CONST(0.474280288123229), FRAC_CONST(0.880373902553765) },
- { FRAC_CONST(0.451072261975153), FRAC_CONST(0.892487430990834) },
- { FRAC_CONST(0.427555093430282), FRAC_CONST(0.903989293123443) },
- { FRAC_CONST(0.403744899981227), FRAC_CONST(0.914871606149819) },
- { FRAC_CONST(0.379657999945233), FRAC_CONST(0.925126911876195) },
- { FRAC_CONST(0.355310901280416), FRAC_CONST(0.934748181828292) },
- { FRAC_CONST(0.330720290272038), FRAC_CONST(0.943728822068278) },
- { FRAC_CONST(0.305903020096554), FRAC_CONST(0.952062677713924) },
- { FRAC_CONST(0.280876099271292), FRAC_CONST(0.959744037156857) },
- { FRAC_CONST(0.255656679997665), FRAC_CONST(0.966767635977008) },
- { FRAC_CONST(0.230262046405902), FRAC_CONST(0.973128660550580) },
- { FRAC_CONST(0.204709602709380), FRAC_CONST(0.978822751349072) },
- { FRAC_CONST(0.179016861276633), FRAC_CONST(0.983846005927077) },
- { FRAC_CONST(0.153201430629259), FRAC_CONST(0.988194981596825) },
- { FRAC_CONST(0.127281003373913), FRAC_CONST(0.991866697787626) },
- { FRAC_CONST(0.101273344076683), FRAC_CONST(0.994858638088611) },
- { FRAC_CONST(0.075196277088140), FRAC_CONST(0.997168751973348) },
- { FRAC_CONST(0.049067674327418), FRAC_CONST(0.998795456205172) },
- { FRAC_CONST(0.022905443033697), FRAC_CONST(0.999737635922260) }
- };
+/* 60 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_240[] =
+{
+ { FRAC_CONST(0.999994645401696), FRAC_CONST(0.003272486506527) },
+ { FRAC_CONST(0.999566308502021), FRAC_CONST(0.029448173247963) },
+ { FRAC_CONST(0.998452918783950), FRAC_CONST(0.055603677682425) },
+ { FRAC_CONST(0.996655239309180), FRAC_CONST(0.081721074133668) },
+ { FRAC_CONST(0.994174502117428), FRAC_CONST(0.107782463042759) },
+ { FRAC_CONST(0.991012407382049), FRAC_CONST(0.133769983235535) },
+ { FRAC_CONST(0.987171122244825), FRAC_CONST(0.159665824163761) },
+ { FRAC_CONST(0.982653279330712), FRAC_CONST(0.185452238111591) },
+ { FRAC_CONST(0.977461974943572), FRAC_CONST(0.211111552358965) },
+ { FRAC_CONST(0.971600766944121), FRAC_CONST(0.236626181293610) },
+ { FRAC_CONST(0.965073672311547), FRAC_CONST(0.261978638463337) },
+ { FRAC_CONST(0.957885164390477), FRAC_CONST(0.287151548560387) },
+ { FRAC_CONST(0.950040169825165), FRAC_CONST(0.312127659329594) },
+ { FRAC_CONST(0.941544065183021), FRAC_CONST(0.336889853392220) },
+ { FRAC_CONST(0.932402673269775), FRAC_CONST(0.361421159977355) },
+ { FRAC_CONST(0.922622259138823), FRAC_CONST(0.385704766552831) },
+ { FRAC_CONST(0.912209525797468), FRAC_CONST(0.409724030347695) },
+ { FRAC_CONST(0.901171609613013), FRAC_CONST(0.433462489758331) },
+ { FRAC_CONST(0.889516075421856), FRAC_CONST(0.456903875630421) },
+ { FRAC_CONST(0.877250911344924), FRAC_CONST(0.480032122409011) },
+ { FRAC_CONST(0.864384523313017), FRAC_CONST(0.502831379149042) },
+ { FRAC_CONST(0.850925729305802), FRAC_CONST(0.525286020378792) },
+ { FRAC_CONST(0.836883753308409), FRAC_CONST(0.547380656808797) },
+ { FRAC_CONST(0.822268218989775), FRAC_CONST(0.569100145878898) },
+ { FRAC_CONST(0.807089143107059), FRAC_CONST(0.590429602136201) },
+ { FRAC_CONST(0.791356928640660), FRAC_CONST(0.611354407436816) },
+ { FRAC_CONST(0.775082357664531), FRAC_CONST(0.631860220964409) },
+ { FRAC_CONST(0.758276583956687), FRAC_CONST(0.651932989058674) },
+ { FRAC_CONST(0.740951125354959), FRAC_CONST(0.671558954847018) },
+ { FRAC_CONST(0.723117855863248), FRAC_CONST(0.690724667672829) },
+ { FRAC_CONST(0.704788997513670), FRAC_CONST(0.709416992313883) },
+ { FRAC_CONST(0.685977111990193), FRAC_CONST(0.727623117984575) },
+ { FRAC_CONST(0.666695092019479), FRAC_CONST(0.745330567115786) },
+ { FRAC_CONST(0.646956152534857), FRAC_CONST(0.762527203906388) },
+ { FRAC_CONST(0.626773821619469), FRAC_CONST(0.779201242640517) },
+ { FRAC_CONST(0.606161931234795), FRAC_CONST(0.795341255764910) },
+ { FRAC_CONST(0.585134607740916), FRAC_CONST(0.810936181720784) },
+ { FRAC_CONST(0.563706262215017), FRAC_CONST(0.825975332524873) },
+ { FRAC_CONST(0.541891580574752), FRAC_CONST(0.840448401094438) },
+ { FRAC_CONST(0.519705513513249), FRAC_CONST(0.854345468311227) },
+ { FRAC_CONST(0.497163266252654), FRAC_CONST(0.867657009819544) },
+ { FRAC_CONST(0.474280288123229), FRAC_CONST(0.880373902553765) },
+ { FRAC_CONST(0.451072261975153), FRAC_CONST(0.892487430990834) },
+ { FRAC_CONST(0.427555093430282), FRAC_CONST(0.903989293123443) },
+ { FRAC_CONST(0.403744899981227), FRAC_CONST(0.914871606149819) },
+ { FRAC_CONST(0.379657999945233), FRAC_CONST(0.925126911876195) },
+ { FRAC_CONST(0.355310901280416), FRAC_CONST(0.934748181828292) },
+ { FRAC_CONST(0.330720290272038), FRAC_CONST(0.943728822068278) },
+ { FRAC_CONST(0.305903020096554), FRAC_CONST(0.952062677713924) },
+ { FRAC_CONST(0.280876099271292), FRAC_CONST(0.959744037156857) },
+ { FRAC_CONST(0.255656679997665), FRAC_CONST(0.966767635977008) },
+ { FRAC_CONST(0.230262046405902), FRAC_CONST(0.973128660550580) },
+ { FRAC_CONST(0.204709602709380), FRAC_CONST(0.978822751349072) },
+ { FRAC_CONST(0.179016861276633), FRAC_CONST(0.983846005927077) },
+ { FRAC_CONST(0.153201430629259), FRAC_CONST(0.988194981596825) },
+ { FRAC_CONST(0.127281003373913), FRAC_CONST(0.991866697787626) },
+ { FRAC_CONST(0.101273344076683), FRAC_CONST(0.994858638088611) },
+ { FRAC_CONST(0.075196277088140), FRAC_CONST(0.997168751973348) },
+ { FRAC_CONST(0.049067674327418), FRAC_CONST(0.998795456205172) },
+ { FRAC_CONST(0.022905443033697), FRAC_CONST(0.999737635922260) }
+};
#endif // ALLOW_SMALL_FRAMELENGTH
#ifdef SSR_DEC
- /* 128 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_512[] =
- {
- { FRAC_CONST(0.999998823451702), FRAC_CONST(0.001533980186285) },
- { FRAC_CONST(0.999904701082853), FRAC_CONST(0.013805388528060) },
- { FRAC_CONST(0.999659996743959), FRAC_CONST(0.026074717829104) },
- { FRAC_CONST(0.999264747286594), FRAC_CONST(0.038340120373553) },
- { FRAC_CONST(0.998719012233873), FRAC_CONST(0.050599749036899) },
- { FRAC_CONST(0.998022873771486), FRAC_CONST(0.062851757564161) },
- { FRAC_CONST(0.997176436735326), FRAC_CONST(0.075094300847921) },
- { FRAC_CONST(0.996179828595697), FRAC_CONST(0.087325535206192) },
- { FRAC_CONST(0.995033199438119), FRAC_CONST(0.099543618660069) },
- { FRAC_CONST(0.993736721940725), FRAC_CONST(0.111746711211127) },
- { FRAC_CONST(0.992290591348257), FRAC_CONST(0.123932975118512) },
- { FRAC_CONST(0.990695025442665), FRAC_CONST(0.136100575175706) },
- { FRAC_CONST(0.988950264510303), FRAC_CONST(0.148247678986896) },
- { FRAC_CONST(0.987056571305751), FRAC_CONST(0.160372457242928) },
- { FRAC_CONST(0.985014231012240), FRAC_CONST(0.172473083996796) },
- { FRAC_CONST(0.982823551198705), FRAC_CONST(0.184547736938620) },
- { FRAC_CONST(0.980484861773469), FRAC_CONST(0.196594597670080) },
- { FRAC_CONST(0.977998514934557), FRAC_CONST(0.208611851978263) },
- { FRAC_CONST(0.975364885116657), FRAC_CONST(0.220597690108874) },
- { FRAC_CONST(0.972584368934732), FRAC_CONST(0.232550307038775) },
- { FRAC_CONST(0.969657385124292), FRAC_CONST(0.244467902747824) },
- { FRAC_CONST(0.966584374478333), FRAC_CONST(0.256348682489943) },
- { FRAC_CONST(0.963365799780954), FRAC_CONST(0.268190857063403) },
- { FRAC_CONST(0.960002145737666), FRAC_CONST(0.279992643080273) },
- { FRAC_CONST(0.956493918902395), FRAC_CONST(0.291752263234989) },
- { FRAC_CONST(0.952841647601199), FRAC_CONST(0.303467946572011) },
- { FRAC_CONST(0.949045881852701), FRAC_CONST(0.315137928752522) },
- { FRAC_CONST(0.945107193285261), FRAC_CONST(0.326760452320132) },
- { FRAC_CONST(0.941026175050889), FRAC_CONST(0.338333766965541) },
- { FRAC_CONST(0.936803441735922), FRAC_CONST(0.349856129790135) },
- { FRAC_CONST(0.932439629268462), FRAC_CONST(0.361325805568454) },
- { FRAC_CONST(0.927935394822618), FRAC_CONST(0.372741067009516) },
- { FRAC_CONST(0.923291416719528), FRAC_CONST(0.384100195016935) },
- { FRAC_CONST(0.918508394325212), FRAC_CONST(0.395401478947816) },
- { FRAC_CONST(0.913587047945251), FRAC_CONST(0.406643216870369) },
- { FRAC_CONST(0.908528118716306), FRAC_CONST(0.417823715820212) },
- { FRAC_CONST(0.903332368494512), FRAC_CONST(0.428941292055329) },
- { FRAC_CONST(0.898000579740740), FRAC_CONST(0.439994271309633) },
- { FRAC_CONST(0.892533555402765), FRAC_CONST(0.450980989045104) },
- { FRAC_CONST(0.886932118794342), FRAC_CONST(0.461899790702463) },
- { FRAC_CONST(0.881197113471222), FRAC_CONST(0.472749031950343) },
- { FRAC_CONST(0.875329403104111), FRAC_CONST(0.483527078932919) },
- { FRAC_CONST(0.869329871348607), FRAC_CONST(0.494232308515960) },
- { FRAC_CONST(0.863199421712124), FRAC_CONST(0.504863108531268) },
- { FRAC_CONST(0.856938977417829), FRAC_CONST(0.515417878019463) },
- { FRAC_CONST(0.850549481265603), FRAC_CONST(0.525895027471085) },
- { FRAC_CONST(0.844031895490066), FRAC_CONST(0.536292979065963) },
- { FRAC_CONST(0.837387201615662), FRAC_CONST(0.546610166910835) },
- { FRAC_CONST(0.830616400308846), FRAC_CONST(0.556845037275160) },
- { FRAC_CONST(0.823720511227391), FRAC_CONST(0.566996048825109) },
- { FRAC_CONST(0.816700572866828), FRAC_CONST(0.577061672855679) },
- { FRAC_CONST(0.809557642404051), FRAC_CONST(0.587040393520918) },
- { FRAC_CONST(0.802292795538116), FRAC_CONST(0.596930708062197) },
- { FRAC_CONST(0.794907126328237), FRAC_CONST(0.606731127034524) },
- { FRAC_CONST(0.787401747029031), FRAC_CONST(0.616440174530854) },
- { FRAC_CONST(0.779777787923015), FRAC_CONST(0.626056388404344) },
- { FRAC_CONST(0.772036397150385), FRAC_CONST(0.635578320488556) },
- { FRAC_CONST(0.764178740536117), FRAC_CONST(0.645004536815544) },
- { FRAC_CONST(0.756206001414395), FRAC_CONST(0.654333617831800) },
- { FRAC_CONST(0.748119380450404), FRAC_CONST(0.663564158612040) },
- { FRAC_CONST(0.739920095459516), FRAC_CONST(0.672694769070773) },
- { FRAC_CONST(0.731609381223893), FRAC_CONST(0.681724074171650) },
- { FRAC_CONST(0.723188489306527), FRAC_CONST(0.690650714134535) },
- { FRAC_CONST(0.714658687862769), FRAC_CONST(0.699473344640284) },
- { FRAC_CONST(0.706021261449340), FRAC_CONST(0.708190637033195) },
- { FRAC_CONST(0.697277510830887), FRAC_CONST(0.716801278521100) },
- { FRAC_CONST(0.688428752784091), FRAC_CONST(0.725303972373061) },
- { FRAC_CONST(0.679476319899365), FRAC_CONST(0.733697438114660) },
- { FRAC_CONST(0.670421560380173), FRAC_CONST(0.741980411720831) },
- { FRAC_CONST(0.661265837839992), FRAC_CONST(0.750151645806215) },
- { FRAC_CONST(0.652010531096960), FRAC_CONST(0.758209909813015) },
- { FRAC_CONST(0.642657033966227), FRAC_CONST(0.766153990196313) },
- { FRAC_CONST(0.633206755050057), FRAC_CONST(0.773982690606823) },
- { FRAC_CONST(0.623661117525695), FRAC_CONST(0.781694832071059) },
- { FRAC_CONST(0.614021558931038), FRAC_CONST(0.789289253168886) },
- { FRAC_CONST(0.604289530948156), FRAC_CONST(0.796764810208419) },
- { FRAC_CONST(0.594466499184665), FRAC_CONST(0.804120377398266) },
- { FRAC_CONST(0.584553942953015), FRAC_CONST(0.811354847017064) },
- { FRAC_CONST(0.574553355047716), FRAC_CONST(0.818467129580299) },
- { FRAC_CONST(0.564466241520520), FRAC_CONST(0.825456154004377) },
- { FRAC_CONST(0.554294121453620), FRAC_CONST(0.832320867767930) },
- { FRAC_CONST(0.544038526730884), FRAC_CONST(0.839060237070313) },
- { FRAC_CONST(0.533701001807153), FRAC_CONST(0.845673246987299) },
- { FRAC_CONST(0.523283103475656), FRAC_CONST(0.852158901623920) },
- { FRAC_CONST(0.512786400633563), FRAC_CONST(0.858516224264443) },
- { FRAC_CONST(0.502212474045711), FRAC_CONST(0.864744257519462) },
- { FRAC_CONST(0.491562916106550), FRAC_CONST(0.870842063470079) },
- { FRAC_CONST(0.480839330600334), FRAC_CONST(0.876808723809146) },
- { FRAC_CONST(0.470043332459596), FRAC_CONST(0.882643339979563) },
- { FRAC_CONST(0.459176547521944), FRAC_CONST(0.888345033309596) },
- { FRAC_CONST(0.448240612285220), FRAC_CONST(0.893912945145203) },
- { FRAC_CONST(0.437237173661044), FRAC_CONST(0.899346236979341) },
- { FRAC_CONST(0.426167888726800), FRAC_CONST(0.904644090578246) },
- { FRAC_CONST(0.415034424476082), FRAC_CONST(0.909805708104652) },
- { FRAC_CONST(0.403838457567654), FRAC_CONST(0.914830312237946) },
- { FRAC_CONST(0.392581674072952), FRAC_CONST(0.919717146291227) },
- { FRAC_CONST(0.381265769222162), FRAC_CONST(0.924465474325263) },
- { FRAC_CONST(0.369892447148934), FRAC_CONST(0.929074581259316) },
- { FRAC_CONST(0.358463420633737), FRAC_CONST(0.933543772978836) },
- { FRAC_CONST(0.346980410845924), FRAC_CONST(0.937872376439990) },
- { FRAC_CONST(0.335445147084532), FRAC_CONST(0.942059739771017) },
- { FRAC_CONST(0.323859366517853), FRAC_CONST(0.946105232370403) },
- { FRAC_CONST(0.312224813921825), FRAC_CONST(0.950008245001843) },
- { FRAC_CONST(0.300543241417273), FRAC_CONST(0.953768189885990) },
- { FRAC_CONST(0.288816408206049), FRAC_CONST(0.957384500788976) },
- { FRAC_CONST(0.277046080306100), FRAC_CONST(0.960856633107680) },
- { FRAC_CONST(0.265234030285512), FRAC_CONST(0.964184063951746) },
- { FRAC_CONST(0.253382036995570), FRAC_CONST(0.967366292222329) },
- { FRAC_CONST(0.241491885302869), FRAC_CONST(0.970402838687556) },
- { FRAC_CONST(0.229565365820519), FRAC_CONST(0.973293246054698) },
- { FRAC_CONST(0.217604274638484), FRAC_CONST(0.976037079039039) },
- { FRAC_CONST(0.205610413053099), FRAC_CONST(0.978633924429423) },
- { FRAC_CONST(0.193585587295804), FRAC_CONST(0.981083391150487) },
- { FRAC_CONST(0.181531608261125), FRAC_CONST(0.983385110321551) },
- { FRAC_CONST(0.169450291233968), FRAC_CONST(0.985538735312176) },
- { FRAC_CONST(0.157343455616238), FRAC_CONST(0.987543941794359) },
- { FRAC_CONST(0.145212924652848), FRAC_CONST(0.989400427791380) },
- { FRAC_CONST(0.133060525157139), FRAC_CONST(0.991107913723277) },
- { FRAC_CONST(0.120888087235777), FRAC_CONST(0.992666142448948) },
- { FRAC_CONST(0.108697444013139), FRAC_CONST(0.994074879304879) },
- { FRAC_CONST(0.096490431355253), FRAC_CONST(0.995333912140482) },
- { FRAC_CONST(0.084268887593324), FRAC_CONST(0.996443051350043) },
- { FRAC_CONST(0.072034653246889), FRAC_CONST(0.997402129901275) },
- { FRAC_CONST(0.059789570746640), FRAC_CONST(0.998211003360478) },
- { FRAC_CONST(0.047535484156959), FRAC_CONST(0.998869549914284) },
- { FRAC_CONST(0.035274238898214), FRAC_CONST(0.999377670388003) },
- { FRAC_CONST(0.023007681468839), FRAC_CONST(0.999735288260562) },
- { FRAC_CONST(0.010737659167265), FRAC_CONST(0.999942349676024) }
- };
+/* 128 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_512[] =
+{
+ { FRAC_CONST(0.999998823451702), FRAC_CONST(0.001533980186285) },
+ { FRAC_CONST(0.999904701082853), FRAC_CONST(0.013805388528060) },
+ { FRAC_CONST(0.999659996743959), FRAC_CONST(0.026074717829104) },
+ { FRAC_CONST(0.999264747286594), FRAC_CONST(0.038340120373553) },
+ { FRAC_CONST(0.998719012233873), FRAC_CONST(0.050599749036899) },
+ { FRAC_CONST(0.998022873771486), FRAC_CONST(0.062851757564161) },
+ { FRAC_CONST(0.997176436735326), FRAC_CONST(0.075094300847921) },
+ { FRAC_CONST(0.996179828595697), FRAC_CONST(0.087325535206192) },
+ { FRAC_CONST(0.995033199438119), FRAC_CONST(0.099543618660069) },
+ { FRAC_CONST(0.993736721940725), FRAC_CONST(0.111746711211127) },
+ { FRAC_CONST(0.992290591348257), FRAC_CONST(0.123932975118512) },
+ { FRAC_CONST(0.990695025442665), FRAC_CONST(0.136100575175706) },
+ { FRAC_CONST(0.988950264510303), FRAC_CONST(0.148247678986896) },
+ { FRAC_CONST(0.987056571305751), FRAC_CONST(0.160372457242928) },
+ { FRAC_CONST(0.985014231012240), FRAC_CONST(0.172473083996796) },
+ { FRAC_CONST(0.982823551198705), FRAC_CONST(0.184547736938620) },
+ { FRAC_CONST(0.980484861773469), FRAC_CONST(0.196594597670080) },
+ { FRAC_CONST(0.977998514934557), FRAC_CONST(0.208611851978263) },
+ { FRAC_CONST(0.975364885116657), FRAC_CONST(0.220597690108874) },
+ { FRAC_CONST(0.972584368934732), FRAC_CONST(0.232550307038775) },
+ { FRAC_CONST(0.969657385124292), FRAC_CONST(0.244467902747824) },
+ { FRAC_CONST(0.966584374478333), FRAC_CONST(0.256348682489943) },
+ { FRAC_CONST(0.963365799780954), FRAC_CONST(0.268190857063403) },
+ { FRAC_CONST(0.960002145737666), FRAC_CONST(0.279992643080273) },
+ { FRAC_CONST(0.956493918902395), FRAC_CONST(0.291752263234989) },
+ { FRAC_CONST(0.952841647601199), FRAC_CONST(0.303467946572011) },
+ { FRAC_CONST(0.949045881852701), FRAC_CONST(0.315137928752522) },
+ { FRAC_CONST(0.945107193285261), FRAC_CONST(0.326760452320132) },
+ { FRAC_CONST(0.941026175050889), FRAC_CONST(0.338333766965541) },
+ { FRAC_CONST(0.936803441735922), FRAC_CONST(0.349856129790135) },
+ { FRAC_CONST(0.932439629268462), FRAC_CONST(0.361325805568454) },
+ { FRAC_CONST(0.927935394822618), FRAC_CONST(0.372741067009516) },
+ { FRAC_CONST(0.923291416719528), FRAC_CONST(0.384100195016935) },
+ { FRAC_CONST(0.918508394325212), FRAC_CONST(0.395401478947816) },
+ { FRAC_CONST(0.913587047945251), FRAC_CONST(0.406643216870369) },
+ { FRAC_CONST(0.908528118716306), FRAC_CONST(0.417823715820212) },
+ { FRAC_CONST(0.903332368494512), FRAC_CONST(0.428941292055329) },
+ { FRAC_CONST(0.898000579740740), FRAC_CONST(0.439994271309633) },
+ { FRAC_CONST(0.892533555402765), FRAC_CONST(0.450980989045104) },
+ { FRAC_CONST(0.886932118794342), FRAC_CONST(0.461899790702463) },
+ { FRAC_CONST(0.881197113471222), FRAC_CONST(0.472749031950343) },
+ { FRAC_CONST(0.875329403104111), FRAC_CONST(0.483527078932919) },
+ { FRAC_CONST(0.869329871348607), FRAC_CONST(0.494232308515960) },
+ { FRAC_CONST(0.863199421712124), FRAC_CONST(0.504863108531268) },
+ { FRAC_CONST(0.856938977417829), FRAC_CONST(0.515417878019463) },
+ { FRAC_CONST(0.850549481265603), FRAC_CONST(0.525895027471085) },
+ { FRAC_CONST(0.844031895490066), FRAC_CONST(0.536292979065963) },
+ { FRAC_CONST(0.837387201615662), FRAC_CONST(0.546610166910835) },
+ { FRAC_CONST(0.830616400308846), FRAC_CONST(0.556845037275160) },
+ { FRAC_CONST(0.823720511227391), FRAC_CONST(0.566996048825109) },
+ { FRAC_CONST(0.816700572866828), FRAC_CONST(0.577061672855679) },
+ { FRAC_CONST(0.809557642404051), FRAC_CONST(0.587040393520918) },
+ { FRAC_CONST(0.802292795538116), FRAC_CONST(0.596930708062197) },
+ { FRAC_CONST(0.794907126328237), FRAC_CONST(0.606731127034524) },
+ { FRAC_CONST(0.787401747029031), FRAC_CONST(0.616440174530854) },
+ { FRAC_CONST(0.779777787923015), FRAC_CONST(0.626056388404344) },
+ { FRAC_CONST(0.772036397150385), FRAC_CONST(0.635578320488556) },
+ { FRAC_CONST(0.764178740536117), FRAC_CONST(0.645004536815544) },
+ { FRAC_CONST(0.756206001414395), FRAC_CONST(0.654333617831800) },
+ { FRAC_CONST(0.748119380450404), FRAC_CONST(0.663564158612040) },
+ { FRAC_CONST(0.739920095459516), FRAC_CONST(0.672694769070773) },
+ { FRAC_CONST(0.731609381223893), FRAC_CONST(0.681724074171650) },
+ { FRAC_CONST(0.723188489306527), FRAC_CONST(0.690650714134535) },
+ { FRAC_CONST(0.714658687862769), FRAC_CONST(0.699473344640284) },
+ { FRAC_CONST(0.706021261449340), FRAC_CONST(0.708190637033195) },
+ { FRAC_CONST(0.697277510830887), FRAC_CONST(0.716801278521100) },
+ { FRAC_CONST(0.688428752784091), FRAC_CONST(0.725303972373061) },
+ { FRAC_CONST(0.679476319899365), FRAC_CONST(0.733697438114660) },
+ { FRAC_CONST(0.670421560380173), FRAC_CONST(0.741980411720831) },
+ { FRAC_CONST(0.661265837839992), FRAC_CONST(0.750151645806215) },
+ { FRAC_CONST(0.652010531096960), FRAC_CONST(0.758209909813015) },
+ { FRAC_CONST(0.642657033966227), FRAC_CONST(0.766153990196313) },
+ { FRAC_CONST(0.633206755050057), FRAC_CONST(0.773982690606823) },
+ { FRAC_CONST(0.623661117525695), FRAC_CONST(0.781694832071059) },
+ { FRAC_CONST(0.614021558931038), FRAC_CONST(0.789289253168886) },
+ { FRAC_CONST(0.604289530948156), FRAC_CONST(0.796764810208419) },
+ { FRAC_CONST(0.594466499184665), FRAC_CONST(0.804120377398266) },
+ { FRAC_CONST(0.584553942953015), FRAC_CONST(0.811354847017064) },
+ { FRAC_CONST(0.574553355047716), FRAC_CONST(0.818467129580299) },
+ { FRAC_CONST(0.564466241520520), FRAC_CONST(0.825456154004377) },
+ { FRAC_CONST(0.554294121453620), FRAC_CONST(0.832320867767930) },
+ { FRAC_CONST(0.544038526730884), FRAC_CONST(0.839060237070313) },
+ { FRAC_CONST(0.533701001807153), FRAC_CONST(0.845673246987299) },
+ { FRAC_CONST(0.523283103475656), FRAC_CONST(0.852158901623920) },
+ { FRAC_CONST(0.512786400633563), FRAC_CONST(0.858516224264443) },
+ { FRAC_CONST(0.502212474045711), FRAC_CONST(0.864744257519462) },
+ { FRAC_CONST(0.491562916106550), FRAC_CONST(0.870842063470079) },
+ { FRAC_CONST(0.480839330600334), FRAC_CONST(0.876808723809146) },
+ { FRAC_CONST(0.470043332459596), FRAC_CONST(0.882643339979563) },
+ { FRAC_CONST(0.459176547521944), FRAC_CONST(0.888345033309596) },
+ { FRAC_CONST(0.448240612285220), FRAC_CONST(0.893912945145203) },
+ { FRAC_CONST(0.437237173661044), FRAC_CONST(0.899346236979341) },
+ { FRAC_CONST(0.426167888726800), FRAC_CONST(0.904644090578246) },
+ { FRAC_CONST(0.415034424476082), FRAC_CONST(0.909805708104652) },
+ { FRAC_CONST(0.403838457567654), FRAC_CONST(0.914830312237946) },
+ { FRAC_CONST(0.392581674072952), FRAC_CONST(0.919717146291227) },
+ { FRAC_CONST(0.381265769222162), FRAC_CONST(0.924465474325263) },
+ { FRAC_CONST(0.369892447148934), FRAC_CONST(0.929074581259316) },
+ { FRAC_CONST(0.358463420633737), FRAC_CONST(0.933543772978836) },
+ { FRAC_CONST(0.346980410845924), FRAC_CONST(0.937872376439990) },
+ { FRAC_CONST(0.335445147084532), FRAC_CONST(0.942059739771017) },
+ { FRAC_CONST(0.323859366517853), FRAC_CONST(0.946105232370403) },
+ { FRAC_CONST(0.312224813921825), FRAC_CONST(0.950008245001843) },
+ { FRAC_CONST(0.300543241417273), FRAC_CONST(0.953768189885990) },
+ { FRAC_CONST(0.288816408206049), FRAC_CONST(0.957384500788976) },
+ { FRAC_CONST(0.277046080306100), FRAC_CONST(0.960856633107680) },
+ { FRAC_CONST(0.265234030285512), FRAC_CONST(0.964184063951746) },
+ { FRAC_CONST(0.253382036995570), FRAC_CONST(0.967366292222329) },
+ { FRAC_CONST(0.241491885302869), FRAC_CONST(0.970402838687556) },
+ { FRAC_CONST(0.229565365820519), FRAC_CONST(0.973293246054698) },
+ { FRAC_CONST(0.217604274638484), FRAC_CONST(0.976037079039039) },
+ { FRAC_CONST(0.205610413053099), FRAC_CONST(0.978633924429423) },
+ { FRAC_CONST(0.193585587295804), FRAC_CONST(0.981083391150487) },
+ { FRAC_CONST(0.181531608261125), FRAC_CONST(0.983385110321551) },
+ { FRAC_CONST(0.169450291233968), FRAC_CONST(0.985538735312176) },
+ { FRAC_CONST(0.157343455616238), FRAC_CONST(0.987543941794359) },
+ { FRAC_CONST(0.145212924652848), FRAC_CONST(0.989400427791380) },
+ { FRAC_CONST(0.133060525157139), FRAC_CONST(0.991107913723277) },
+ { FRAC_CONST(0.120888087235777), FRAC_CONST(0.992666142448948) },
+ { FRAC_CONST(0.108697444013139), FRAC_CONST(0.994074879304879) },
+ { FRAC_CONST(0.096490431355253), FRAC_CONST(0.995333912140482) },
+ { FRAC_CONST(0.084268887593324), FRAC_CONST(0.996443051350043) },
+ { FRAC_CONST(0.072034653246889), FRAC_CONST(0.997402129901275) },
+ { FRAC_CONST(0.059789570746640), FRAC_CONST(0.998211003360478) },
+ { FRAC_CONST(0.047535484156959), FRAC_CONST(0.998869549914284) },
+ { FRAC_CONST(0.035274238898214), FRAC_CONST(0.999377670388003) },
+ { FRAC_CONST(0.023007681468839), FRAC_CONST(0.999735288260562) },
+ { FRAC_CONST(0.010737659167265), FRAC_CONST(0.999942349676024) }
+};
- /* 16 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_64[] =
- {
- { FRAC_CONST(0.999924701839145), FRAC_CONST(0.012271538285720) },
- { FRAC_CONST(0.993906970002356), FRAC_CONST(0.110222207293883) },
- { FRAC_CONST(0.978317370719628), FRAC_CONST(0.207111376192219) },
- { FRAC_CONST(0.953306040354194), FRAC_CONST(0.302005949319228) },
- { FRAC_CONST(0.919113851690058), FRAC_CONST(0.393992040061048) },
- { FRAC_CONST(0.876070094195407), FRAC_CONST(0.482183772079123) },
- { FRAC_CONST(0.824589302785025), FRAC_CONST(0.565731810783613) },
- { FRAC_CONST(0.765167265622459), FRAC_CONST(0.643831542889791) },
- { FRAC_CONST(0.698376249408973), FRAC_CONST(0.715730825283819) },
- { FRAC_CONST(0.624859488142386), FRAC_CONST(0.780737228572094) },
- { FRAC_CONST(0.545324988422046), FRAC_CONST(0.838224705554838) },
- { FRAC_CONST(0.460538710958240), FRAC_CONST(0.887639620402854) },
- { FRAC_CONST(0.371317193951838), FRAC_CONST(0.928506080473215) },
- { FRAC_CONST(0.278519689385053), FRAC_CONST(0.960430519415566) },
- { FRAC_CONST(0.183039887955141), FRAC_CONST(0.983105487431216) },
- { FRAC_CONST(0.085797312344440), FRAC_CONST(0.996312612182778) }
- };
+/* 16 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_64[] =
+{
+ { FRAC_CONST(0.999924701839145), FRAC_CONST(0.012271538285720) },
+ { FRAC_CONST(0.993906970002356), FRAC_CONST(0.110222207293883) },
+ { FRAC_CONST(0.978317370719628), FRAC_CONST(0.207111376192219) },
+ { FRAC_CONST(0.953306040354194), FRAC_CONST(0.302005949319228) },
+ { FRAC_CONST(0.919113851690058), FRAC_CONST(0.393992040061048) },
+ { FRAC_CONST(0.876070094195407), FRAC_CONST(0.482183772079123) },
+ { FRAC_CONST(0.824589302785025), FRAC_CONST(0.565731810783613) },
+ { FRAC_CONST(0.765167265622459), FRAC_CONST(0.643831542889791) },
+ { FRAC_CONST(0.698376249408973), FRAC_CONST(0.715730825283819) },
+ { FRAC_CONST(0.624859488142386), FRAC_CONST(0.780737228572094) },
+ { FRAC_CONST(0.545324988422046), FRAC_CONST(0.838224705554838) },
+ { FRAC_CONST(0.460538710958240), FRAC_CONST(0.887639620402854) },
+ { FRAC_CONST(0.371317193951838), FRAC_CONST(0.928506080473215) },
+ { FRAC_CONST(0.278519689385053), FRAC_CONST(0.960430519415566) },
+ { FRAC_CONST(0.183039887955141), FRAC_CONST(0.983105487431216) },
+ { FRAC_CONST(0.085797312344440), FRAC_CONST(0.996312612182778) }
+};
#endif // SSR_DEC
#else // FIXED_POINT
- /* 256 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_2048[] =
- {
- { FRAC_CONST(0.031249997702054), FRAC_CONST(0.000011984224612) },
- { FRAC_CONST(0.031249813866531), FRAC_CONST(0.000107857810004) },
- { FRAC_CONST(0.031249335895858), FRAC_CONST(0.000203730380198) },
- { FRAC_CONST(0.031248563794535), FRAC_CONST(0.000299601032804) },
- { FRAC_CONST(0.031247497569829), FRAC_CONST(0.000395468865451) },
- { FRAC_CONST(0.031246137231775), FRAC_CONST(0.000491332975794) },
- { FRAC_CONST(0.031244482793177), FRAC_CONST(0.000587192461525) },
- { FRAC_CONST(0.031242534269608), FRAC_CONST(0.000683046420376) },
- { FRAC_CONST(0.031240291679407), FRAC_CONST(0.000778893950134) },
- { FRAC_CONST(0.031237755043684), FRAC_CONST(0.000874734148645) },
- { FRAC_CONST(0.031234924386313), FRAC_CONST(0.000970566113826) },
- { FRAC_CONST(0.031231799733938), FRAC_CONST(0.001066388943669) },
- { FRAC_CONST(0.031228381115970), FRAC_CONST(0.001162201736253) },
- { FRAC_CONST(0.031224668564585), FRAC_CONST(0.001258003589751) },
- { FRAC_CONST(0.031220662114728), FRAC_CONST(0.001353793602441) },
- { FRAC_CONST(0.031216361804108), FRAC_CONST(0.001449570872710) },
- { FRAC_CONST(0.031211767673203), FRAC_CONST(0.001545334499065) },
- { FRAC_CONST(0.031206879765253), FRAC_CONST(0.001641083580144) },
- { FRAC_CONST(0.031201698126266), FRAC_CONST(0.001736817214719) },
- { FRAC_CONST(0.031196222805014), FRAC_CONST(0.001832534501709) },
- { FRAC_CONST(0.031190453853031), FRAC_CONST(0.001928234540186) },
- { FRAC_CONST(0.031184391324617), FRAC_CONST(0.002023916429386) },
- { FRAC_CONST(0.031178035276836), FRAC_CONST(0.002119579268713) },
- { FRAC_CONST(0.031171385769513), FRAC_CONST(0.002215222157753) },
- { FRAC_CONST(0.031164442865236), FRAC_CONST(0.002310844196278) },
- { FRAC_CONST(0.031157206629353), FRAC_CONST(0.002406444484258) },
- { FRAC_CONST(0.031149677129975), FRAC_CONST(0.002502022121865) },
- { FRAC_CONST(0.031141854437973), FRAC_CONST(0.002597576209488) },
- { FRAC_CONST(0.031133738626977), FRAC_CONST(0.002693105847734) },
- { FRAC_CONST(0.031125329773375), FRAC_CONST(0.002788610137442) },
- { FRAC_CONST(0.031116627956316), FRAC_CONST(0.002884088179689) },
- { FRAC_CONST(0.031107633257703), FRAC_CONST(0.002979539075801) },
- { FRAC_CONST(0.031098345762200), FRAC_CONST(0.003074961927355) },
- { FRAC_CONST(0.031088765557222), FRAC_CONST(0.003170355836197) },
- { FRAC_CONST(0.031078892732942), FRAC_CONST(0.003265719904442) },
- { FRAC_CONST(0.031068727382288), FRAC_CONST(0.003361053234488) },
- { FRAC_CONST(0.031058269600939), FRAC_CONST(0.003456354929021) },
- { FRAC_CONST(0.031047519487329), FRAC_CONST(0.003551624091024) },
- { FRAC_CONST(0.031036477142640), FRAC_CONST(0.003646859823790) },
- { FRAC_CONST(0.031025142670809), FRAC_CONST(0.003742061230921) },
- { FRAC_CONST(0.031013516178519), FRAC_CONST(0.003837227416347) },
- { FRAC_CONST(0.031001597775203), FRAC_CONST(0.003932357484328) },
- { FRAC_CONST(0.030989387573042), FRAC_CONST(0.004027450539462) },
- { FRAC_CONST(0.030976885686963), FRAC_CONST(0.004122505686697) },
- { FRAC_CONST(0.030964092234638), FRAC_CONST(0.004217522031340) },
- { FRAC_CONST(0.030951007336485), FRAC_CONST(0.004312498679058) },
- { FRAC_CONST(0.030937631115663), FRAC_CONST(0.004407434735897) },
- { FRAC_CONST(0.030923963698074), FRAC_CONST(0.004502329308281) },
- { FRAC_CONST(0.030910005212362), FRAC_CONST(0.004597181503027) },
- { FRAC_CONST(0.030895755789908), FRAC_CONST(0.004691990427350) },
- { FRAC_CONST(0.030881215564835), FRAC_CONST(0.004786755188872) },
- { FRAC_CONST(0.030866384674000), FRAC_CONST(0.004881474895632) },
- { FRAC_CONST(0.030851263256996), FRAC_CONST(0.004976148656090) },
- { FRAC_CONST(0.030835851456154), FRAC_CONST(0.005070775579142) },
- { FRAC_CONST(0.030820149416533), FRAC_CONST(0.005165354774124) },
- { FRAC_CONST(0.030804157285929), FRAC_CONST(0.005259885350819) },
- { FRAC_CONST(0.030787875214864), FRAC_CONST(0.005354366419469) },
- { FRAC_CONST(0.030771303356593), FRAC_CONST(0.005448797090784) },
- { FRAC_CONST(0.030754441867095), FRAC_CONST(0.005543176475946) },
- { FRAC_CONST(0.030737290905077), FRAC_CONST(0.005637503686619) },
- { FRAC_CONST(0.030719850631972), FRAC_CONST(0.005731777834961) },
- { FRAC_CONST(0.030702121211932), FRAC_CONST(0.005825998033626) },
- { FRAC_CONST(0.030684102811835), FRAC_CONST(0.005920163395780) },
- { FRAC_CONST(0.030665795601276), FRAC_CONST(0.006014273035101) },
- { FRAC_CONST(0.030647199752570), FRAC_CONST(0.006108326065793) },
- { FRAC_CONST(0.030628315440748), FRAC_CONST(0.006202321602594) },
- { FRAC_CONST(0.030609142843557), FRAC_CONST(0.006296258760782) },
- { FRAC_CONST(0.030589682141455), FRAC_CONST(0.006390136656185) },
- { FRAC_CONST(0.030569933517616), FRAC_CONST(0.006483954405188) },
- { FRAC_CONST(0.030549897157919), FRAC_CONST(0.006577711124743) },
- { FRAC_CONST(0.030529573250956), FRAC_CONST(0.006671405932375) },
- { FRAC_CONST(0.030508961988022), FRAC_CONST(0.006765037946194) },
- { FRAC_CONST(0.030488063563118), FRAC_CONST(0.006858606284900) },
- { FRAC_CONST(0.030466878172949), FRAC_CONST(0.006952110067791) },
- { FRAC_CONST(0.030445406016919), FRAC_CONST(0.007045548414774) },
- { FRAC_CONST(0.030423647297133), FRAC_CONST(0.007138920446372) },
- { FRAC_CONST(0.030401602218392), FRAC_CONST(0.007232225283733) },
- { FRAC_CONST(0.030379270988192), FRAC_CONST(0.007325462048634) },
- { FRAC_CONST(0.030356653816724), FRAC_CONST(0.007418629863497) },
- { FRAC_CONST(0.030333750916869), FRAC_CONST(0.007511727851390) },
- { FRAC_CONST(0.030310562504198), FRAC_CONST(0.007604755136040) },
- { FRAC_CONST(0.030287088796968), FRAC_CONST(0.007697710841838) },
- { FRAC_CONST(0.030263330016124), FRAC_CONST(0.007790594093851) },
- { FRAC_CONST(0.030239286385293), FRAC_CONST(0.007883404017824) },
- { FRAC_CONST(0.030214958130781), FRAC_CONST(0.007976139740197) },
- { FRAC_CONST(0.030190345481576), FRAC_CONST(0.008068800388104) },
- { FRAC_CONST(0.030165448669342), FRAC_CONST(0.008161385089390) },
- { FRAC_CONST(0.030140267928416), FRAC_CONST(0.008253892972610) },
- { FRAC_CONST(0.030114803495809), FRAC_CONST(0.008346323167047) },
- { FRAC_CONST(0.030089055611203), FRAC_CONST(0.008438674802711) },
- { FRAC_CONST(0.030063024516947), FRAC_CONST(0.008530947010354) },
- { FRAC_CONST(0.030036710458054), FRAC_CONST(0.008623138921475) },
- { FRAC_CONST(0.030010113682202), FRAC_CONST(0.008715249668328) },
- { FRAC_CONST(0.029983234439732), FRAC_CONST(0.008807278383932) },
- { FRAC_CONST(0.029956072983640), FRAC_CONST(0.008899224202078) },
- { FRAC_CONST(0.029928629569580), FRAC_CONST(0.008991086257336) },
- { FRAC_CONST(0.029900904455860), FRAC_CONST(0.009082863685067) },
- { FRAC_CONST(0.029872897903441), FRAC_CONST(0.009174555621425) },
- { FRAC_CONST(0.029844610175929), FRAC_CONST(0.009266161203371) },
- { FRAC_CONST(0.029816041539579), FRAC_CONST(0.009357679568679) },
- { FRAC_CONST(0.029787192263292), FRAC_CONST(0.009449109855944) },
- { FRAC_CONST(0.029758062618606), FRAC_CONST(0.009540451204587) },
- { FRAC_CONST(0.029728652879702), FRAC_CONST(0.009631702754871) },
- { FRAC_CONST(0.029698963323395), FRAC_CONST(0.009722863647900) },
- { FRAC_CONST(0.029668994229134), FRAC_CONST(0.009813933025633) },
- { FRAC_CONST(0.029638745879000), FRAC_CONST(0.009904910030891) },
- { FRAC_CONST(0.029608218557702), FRAC_CONST(0.009995793807363) },
- { FRAC_CONST(0.029577412552575), FRAC_CONST(0.010086583499618) },
- { FRAC_CONST(0.029546328153577), FRAC_CONST(0.010177278253107) },
- { FRAC_CONST(0.029514965653285), FRAC_CONST(0.010267877214177) },
- { FRAC_CONST(0.029483325346896), FRAC_CONST(0.010358379530076) },
- { FRAC_CONST(0.029451407532220), FRAC_CONST(0.010448784348962) },
- { FRAC_CONST(0.029419212509679), FRAC_CONST(0.010539090819911) },
- { FRAC_CONST(0.029386740582307), FRAC_CONST(0.010629298092923) },
- { FRAC_CONST(0.029353992055740), FRAC_CONST(0.010719405318933) },
- { FRAC_CONST(0.029320967238220), FRAC_CONST(0.010809411649818) },
- { FRAC_CONST(0.029287666440590), FRAC_CONST(0.010899316238403) },
- { FRAC_CONST(0.029254089976290), FRAC_CONST(0.010989118238474) },
- { FRAC_CONST(0.029220238161353), FRAC_CONST(0.011078816804778) },
- { FRAC_CONST(0.029186111314406), FRAC_CONST(0.011168411093039) },
- { FRAC_CONST(0.029151709756664), FRAC_CONST(0.011257900259961) },
- { FRAC_CONST(0.029117033811927), FRAC_CONST(0.011347283463239) },
- { FRAC_CONST(0.029082083806579), FRAC_CONST(0.011436559861563) },
- { FRAC_CONST(0.029046860069582), FRAC_CONST(0.011525728614630) },
- { FRAC_CONST(0.029011362932476), FRAC_CONST(0.011614788883150) },
- { FRAC_CONST(0.028975592729373), FRAC_CONST(0.011703739828853) },
- { FRAC_CONST(0.028939549796957), FRAC_CONST(0.011792580614500) },
- { FRAC_CONST(0.028903234474475), FRAC_CONST(0.011881310403886) },
- { FRAC_CONST(0.028866647103744), FRAC_CONST(0.011969928361855) },
- { FRAC_CONST(0.028829788029135), FRAC_CONST(0.012058433654299) },
- { FRAC_CONST(0.028792657597583), FRAC_CONST(0.012146825448172) },
- { FRAC_CONST(0.028755256158571), FRAC_CONST(0.012235102911499) },
- { FRAC_CONST(0.028717584064137), FRAC_CONST(0.012323265213377) },
- { FRAC_CONST(0.028679641668864), FRAC_CONST(0.012411311523990) },
- { FRAC_CONST(0.028641429329882), FRAC_CONST(0.012499241014612) },
- { FRAC_CONST(0.028602947406859), FRAC_CONST(0.012587052857618) },
- { FRAC_CONST(0.028564196262001), FRAC_CONST(0.012674746226488) },
- { FRAC_CONST(0.028525176260050), FRAC_CONST(0.012762320295819) },
- { FRAC_CONST(0.028485887768276), FRAC_CONST(0.012849774241331) },
- { FRAC_CONST(0.028446331156478), FRAC_CONST(0.012937107239875) },
- { FRAC_CONST(0.028406506796976), FRAC_CONST(0.013024318469437) },
- { FRAC_CONST(0.028366415064615), FRAC_CONST(0.013111407109155) },
- { FRAC_CONST(0.028326056336751), FRAC_CONST(0.013198372339315) },
- { FRAC_CONST(0.028285430993258), FRAC_CONST(0.013285213341368) },
- { FRAC_CONST(0.028244539416515), FRAC_CONST(0.013371929297933) },
- { FRAC_CONST(0.028203381991411), FRAC_CONST(0.013458519392807) },
- { FRAC_CONST(0.028161959105334), FRAC_CONST(0.013544982810971) },
- { FRAC_CONST(0.028120271148172), FRAC_CONST(0.013631318738598) },
- { FRAC_CONST(0.028078318512309), FRAC_CONST(0.013717526363062) },
- { FRAC_CONST(0.028036101592619), FRAC_CONST(0.013803604872943) },
- { FRAC_CONST(0.027993620786463), FRAC_CONST(0.013889553458039) },
- { FRAC_CONST(0.027950876493687), FRAC_CONST(0.013975371309367) },
- { FRAC_CONST(0.027907869116616), FRAC_CONST(0.014061057619178) },
- { FRAC_CONST(0.027864599060052), FRAC_CONST(0.014146611580959) },
- { FRAC_CONST(0.027821066731270), FRAC_CONST(0.014232032389445) },
- { FRAC_CONST(0.027777272540012), FRAC_CONST(0.014317319240622) },
- { FRAC_CONST(0.027733216898487), FRAC_CONST(0.014402471331737) },
- { FRAC_CONST(0.027688900221361), FRAC_CONST(0.014487487861307) },
- { FRAC_CONST(0.027644322925762), FRAC_CONST(0.014572368029123) },
- { FRAC_CONST(0.027599485431266), FRAC_CONST(0.014657111036262) },
- { FRAC_CONST(0.027554388159903), FRAC_CONST(0.014741716085090) },
- { FRAC_CONST(0.027509031536144), FRAC_CONST(0.014826182379271) },
- { FRAC_CONST(0.027463415986904), FRAC_CONST(0.014910509123778) },
- { FRAC_CONST(0.027417541941533), FRAC_CONST(0.014994695524894) },
- { FRAC_CONST(0.027371409831816), FRAC_CONST(0.015078740790225) },
- { FRAC_CONST(0.027325020091965), FRAC_CONST(0.015162644128704) },
- { FRAC_CONST(0.027278373158618), FRAC_CONST(0.015246404750603) },
- { FRAC_CONST(0.027231469470833), FRAC_CONST(0.015330021867534) },
- { FRAC_CONST(0.027184309470088), FRAC_CONST(0.015413494692460) },
- { FRAC_CONST(0.027136893600268), FRAC_CONST(0.015496822439704) },
- { FRAC_CONST(0.027089222307671), FRAC_CONST(0.015580004324954) },
- { FRAC_CONST(0.027041296040997), FRAC_CONST(0.015663039565269) },
- { FRAC_CONST(0.026993115251345), FRAC_CONST(0.015745927379091) },
- { FRAC_CONST(0.026944680392213), FRAC_CONST(0.015828666986247) },
- { FRAC_CONST(0.026895991919487), FRAC_CONST(0.015911257607961) },
- { FRAC_CONST(0.026847050291442), FRAC_CONST(0.015993698466859) },
- { FRAC_CONST(0.026797855968734), FRAC_CONST(0.016075988786976) },
- { FRAC_CONST(0.026748409414401), FRAC_CONST(0.016158127793763) },
- { FRAC_CONST(0.026698711093851), FRAC_CONST(0.016240114714099) },
- { FRAC_CONST(0.026648761474864), FRAC_CONST(0.016321948776289) },
- { FRAC_CONST(0.026598561027585), FRAC_CONST(0.016403629210082) },
- { FRAC_CONST(0.026548110224519), FRAC_CONST(0.016485155246669) },
- { FRAC_CONST(0.026497409540530), FRAC_CONST(0.016566526118696) },
- { FRAC_CONST(0.026446459452830), FRAC_CONST(0.016647741060271) },
- { FRAC_CONST(0.026395260440982), FRAC_CONST(0.016728799306966) },
- { FRAC_CONST(0.026343812986890), FRAC_CONST(0.016809700095831) },
- { FRAC_CONST(0.026292117574797), FRAC_CONST(0.016890442665397) },
- { FRAC_CONST(0.026240174691280), FRAC_CONST(0.016971026255683) },
- { FRAC_CONST(0.026187984825246), FRAC_CONST(0.017051450108208) },
- { FRAC_CONST(0.026135548467924), FRAC_CONST(0.017131713465990) },
- { FRAC_CONST(0.026082866112867), FRAC_CONST(0.017211815573560) },
- { FRAC_CONST(0.026029938255941), FRAC_CONST(0.017291755676967) },
- { FRAC_CONST(0.025976765395322), FRAC_CONST(0.017371533023784) },
- { FRAC_CONST(0.025923348031494), FRAC_CONST(0.017451146863116) },
- { FRAC_CONST(0.025869686667242), FRAC_CONST(0.017530596445607) },
- { FRAC_CONST(0.025815781807646), FRAC_CONST(0.017609881023449) },
- { FRAC_CONST(0.025761633960080), FRAC_CONST(0.017688999850383) },
- { FRAC_CONST(0.025707243634204), FRAC_CONST(0.017767952181715) },
- { FRAC_CONST(0.025652611341960), FRAC_CONST(0.017846737274313) },
- { FRAC_CONST(0.025597737597568), FRAC_CONST(0.017925354386623) },
- { FRAC_CONST(0.025542622917522), FRAC_CONST(0.018003802778671) },
- { FRAC_CONST(0.025487267820581), FRAC_CONST(0.018082081712071) },
- { FRAC_CONST(0.025431672827768), FRAC_CONST(0.018160190450031) },
- { FRAC_CONST(0.025375838462365), FRAC_CONST(0.018238128257362) },
- { FRAC_CONST(0.025319765249906), FRAC_CONST(0.018315894400484) },
- { FRAC_CONST(0.025263453718173), FRAC_CONST(0.018393488147432) },
- { FRAC_CONST(0.025206904397193), FRAC_CONST(0.018470908767865) },
- { FRAC_CONST(0.025150117819228), FRAC_CONST(0.018548155533070) },
- { FRAC_CONST(0.025093094518776), FRAC_CONST(0.018625227715971) },
- { FRAC_CONST(0.025035835032562), FRAC_CONST(0.018702124591135) },
- { FRAC_CONST(0.024978339899534), FRAC_CONST(0.018778845434780) },
- { FRAC_CONST(0.024920609660858), FRAC_CONST(0.018855389524780) },
- { FRAC_CONST(0.024862644859912), FRAC_CONST(0.018931756140672) },
- { FRAC_CONST(0.024804446042284), FRAC_CONST(0.019007944563666) },
- { FRAC_CONST(0.024746013755764), FRAC_CONST(0.019083954076646) },
- { FRAC_CONST(0.024687348550337), FRAC_CONST(0.019159783964183) },
- { FRAC_CONST(0.024628450978184), FRAC_CONST(0.019235433512536) },
- { FRAC_CONST(0.024569321593670), FRAC_CONST(0.019310902009663) },
- { FRAC_CONST(0.024509960953345), FRAC_CONST(0.019386188745225) },
- { FRAC_CONST(0.024450369615932), FRAC_CONST(0.019461293010596) },
- { FRAC_CONST(0.024390548142329), FRAC_CONST(0.019536214098866) },
- { FRAC_CONST(0.024330497095598), FRAC_CONST(0.019610951304848) },
- { FRAC_CONST(0.024270217040961), FRAC_CONST(0.019685503925087) },
- { FRAC_CONST(0.024209708545799), FRAC_CONST(0.019759871257867) },
- { FRAC_CONST(0.024148972179639), FRAC_CONST(0.019834052603212) },
- { FRAC_CONST(0.024088008514157), FRAC_CONST(0.019908047262901) },
- { FRAC_CONST(0.024026818123164), FRAC_CONST(0.019981854540467) },
- { FRAC_CONST(0.023965401582609), FRAC_CONST(0.020055473741208) },
- { FRAC_CONST(0.023903759470567), FRAC_CONST(0.020128904172192) },
- { FRAC_CONST(0.023841892367236), FRAC_CONST(0.020202145142264) },
- { FRAC_CONST(0.023779800854935), FRAC_CONST(0.020275195962052) },
- { FRAC_CONST(0.023717485518092), FRAC_CONST(0.020348055943974) },
- { FRAC_CONST(0.023654946943242), FRAC_CONST(0.020420724402244) },
- { FRAC_CONST(0.023592185719023), FRAC_CONST(0.020493200652878) },
- { FRAC_CONST(0.023529202436167), FRAC_CONST(0.020565484013703) },
- { FRAC_CONST(0.023465997687496), FRAC_CONST(0.020637573804361) },
- { FRAC_CONST(0.023402572067918), FRAC_CONST(0.020709469346314) },
- { FRAC_CONST(0.023338926174419), FRAC_CONST(0.020781169962854) },
- { FRAC_CONST(0.023275060606058), FRAC_CONST(0.020852674979108) },
- { FRAC_CONST(0.023210975963963), FRAC_CONST(0.020923983722044) },
- { FRAC_CONST(0.023146672851322), FRAC_CONST(0.020995095520475) },
- { FRAC_CONST(0.023082151873380), FRAC_CONST(0.021066009705072) },
- { FRAC_CONST(0.023017413637435), FRAC_CONST(0.021136725608363) },
- { FRAC_CONST(0.022952458752826), FRAC_CONST(0.021207242564742) },
- { FRAC_CONST(0.022887287830934), FRAC_CONST(0.021277559910478) },
- { FRAC_CONST(0.022821901485173), FRAC_CONST(0.021347676983716) },
- { FRAC_CONST(0.022756300330983), FRAC_CONST(0.021417593124488) },
- { FRAC_CONST(0.022690484985827), FRAC_CONST(0.021487307674717) },
- { FRAC_CONST(0.022624456069185), FRAC_CONST(0.021556819978223) },
- { FRAC_CONST(0.022558214202547), FRAC_CONST(0.021626129380729) },
- { FRAC_CONST(0.022491760009405), FRAC_CONST(0.021695235229869) },
- { FRAC_CONST(0.022425094115252), FRAC_CONST(0.021764136875192) },
- { FRAC_CONST(0.022358217147572), FRAC_CONST(0.021832833668171) },
- { FRAC_CONST(0.022291129735838), FRAC_CONST(0.021901324962204) },
- { FRAC_CONST(0.022223832511501), FRAC_CONST(0.021969610112625) },
- { FRAC_CONST(0.022156326107988), FRAC_CONST(0.022037688476709) },
- { FRAC_CONST(0.022088611160696), FRAC_CONST(0.022105559413676) },
- { FRAC_CONST(0.022020688306983), FRAC_CONST(0.022173222284699) },
- { FRAC_CONST(0.021952558186166), FRAC_CONST(0.022240676452909) },
- { FRAC_CONST(0.021884221439510), FRAC_CONST(0.022307921283403) },
- { FRAC_CONST(0.021815678710228), FRAC_CONST(0.022374956143245) },
- { FRAC_CONST(0.021746930643469), FRAC_CONST(0.022441780401478) },
- { FRAC_CONST(0.021677977886316), FRAC_CONST(0.022508393429127) },
- { FRAC_CONST(0.021608821087780), FRAC_CONST(0.022574794599206) },
- { FRAC_CONST(0.021539460898790), FRAC_CONST(0.022640983286719) },
- { FRAC_CONST(0.021469897972190), FRAC_CONST(0.022706958868676) },
- { FRAC_CONST(0.021400132962735), FRAC_CONST(0.022772720724087) },
- { FRAC_CONST(0.021330166527077), FRAC_CONST(0.022838268233979) },
- { FRAC_CONST(0.021259999323769), FRAC_CONST(0.022903600781391) },
- { FRAC_CONST(0.021189632013250), FRAC_CONST(0.022968717751391) },
- { FRAC_CONST(0.021119065257845), FRAC_CONST(0.023033618531071) },
- { FRAC_CONST(0.021048299721754), FRAC_CONST(0.023098302509561) },
- { FRAC_CONST(0.020977336071050), FRAC_CONST(0.023162769078031) },
- { FRAC_CONST(0.020906174973670), FRAC_CONST(0.023227017629698) },
- { FRAC_CONST(0.020834817099409), FRAC_CONST(0.023291047559828) },
- { FRAC_CONST(0.020763263119915), FRAC_CONST(0.023354858265748) },
- { FRAC_CONST(0.020691513708680), FRAC_CONST(0.023418449146848) },
- { FRAC_CONST(0.020619569541038), FRAC_CONST(0.023481819604585) },
- { FRAC_CONST(0.020547431294155), FRAC_CONST(0.023544969042494) },
- { FRAC_CONST(0.020475099647023), FRAC_CONST(0.023607896866186) },
- { FRAC_CONST(0.020402575280455), FRAC_CONST(0.023670602483363) },
- { FRAC_CONST(0.020329858877078), FRAC_CONST(0.023733085303813) },
- { FRAC_CONST(0.020256951121327), FRAC_CONST(0.023795344739427) },
- { FRAC_CONST(0.020183852699437), FRAC_CONST(0.023857380204193) },
- { FRAC_CONST(0.020110564299439), FRAC_CONST(0.023919191114211) },
- { FRAC_CONST(0.020037086611150), FRAC_CONST(0.023980776887692) },
- { FRAC_CONST(0.019963420326171), FRAC_CONST(0.024042136944968) },
- { FRAC_CONST(0.019889566137877), FRAC_CONST(0.024103270708495) },
- { FRAC_CONST(0.019815524741412), FRAC_CONST(0.024164177602859) },
- { FRAC_CONST(0.019741296833681), FRAC_CONST(0.024224857054779) },
- { FRAC_CONST(0.019666883113346), FRAC_CONST(0.024285308493120) },
- { FRAC_CONST(0.019592284280817), FRAC_CONST(0.024345531348888) },
- { FRAC_CONST(0.019517501038246), FRAC_CONST(0.024405525055242) },
- { FRAC_CONST(0.019442534089523), FRAC_CONST(0.024465289047500) },
- { FRAC_CONST(0.019367384140264), FRAC_CONST(0.024524822763141) },
- { FRAC_CONST(0.019292051897809), FRAC_CONST(0.024584125641809) },
- { FRAC_CONST(0.019216538071215), FRAC_CONST(0.024643197125323) },
- { FRAC_CONST(0.019140843371246), FRAC_CONST(0.024702036657681) },
- { FRAC_CONST(0.019064968510369), FRAC_CONST(0.024760643685063) },
- { FRAC_CONST(0.018988914202748), FRAC_CONST(0.024819017655836) },
- { FRAC_CONST(0.018912681164234), FRAC_CONST(0.024877158020562) },
- { FRAC_CONST(0.018836270112363), FRAC_CONST(0.024935064232003) },
- { FRAC_CONST(0.018759681766343), FRAC_CONST(0.024992735745123) },
- { FRAC_CONST(0.018682916847054), FRAC_CONST(0.025050172017095) },
- { FRAC_CONST(0.018605976077037), FRAC_CONST(0.025107372507308) },
- { FRAC_CONST(0.018528860180486), FRAC_CONST(0.025164336677369) },
- { FRAC_CONST(0.018451569883247), FRAC_CONST(0.025221063991110) },
- { FRAC_CONST(0.018374105912805), FRAC_CONST(0.025277553914591) },
- { FRAC_CONST(0.018296468998280), FRAC_CONST(0.025333805916107) },
- { FRAC_CONST(0.018218659870421), FRAC_CONST(0.025389819466194) },
- { FRAC_CONST(0.018140679261596), FRAC_CONST(0.025445594037630) },
- { FRAC_CONST(0.018062527905790), FRAC_CONST(0.025501129105445) },
- { FRAC_CONST(0.017984206538592), FRAC_CONST(0.025556424146920) },
- { FRAC_CONST(0.017905715897192), FRAC_CONST(0.025611478641598) },
- { FRAC_CONST(0.017827056720375), FRAC_CONST(0.025666292071285) },
- { FRAC_CONST(0.017748229748511), FRAC_CONST(0.025720863920056) },
- { FRAC_CONST(0.017669235723550), FRAC_CONST(0.025775193674260) },
- { FRAC_CONST(0.017590075389012), FRAC_CONST(0.025829280822525) },
- { FRAC_CONST(0.017510749489986), FRAC_CONST(0.025883124855762) },
- { FRAC_CONST(0.017431258773116), FRAC_CONST(0.025936725267170) },
- { FRAC_CONST(0.017351603986600), FRAC_CONST(0.025990081552242) },
- { FRAC_CONST(0.017271785880180), FRAC_CONST(0.026043193208768) },
- { FRAC_CONST(0.017191805205132), FRAC_CONST(0.026096059736841) },
- { FRAC_CONST(0.017111662714267), FRAC_CONST(0.026148680638861) },
- { FRAC_CONST(0.017031359161915), FRAC_CONST(0.026201055419541) },
- { FRAC_CONST(0.016950895303924), FRAC_CONST(0.026253183585908) },
- { FRAC_CONST(0.016870271897651), FRAC_CONST(0.026305064647313) },
- { FRAC_CONST(0.016789489701954), FRAC_CONST(0.026356698115431) },
- { FRAC_CONST(0.016708549477186), FRAC_CONST(0.026408083504269) },
- { FRAC_CONST(0.016627451985187), FRAC_CONST(0.026459220330167) },
- { FRAC_CONST(0.016546197989277), FRAC_CONST(0.026510108111806) },
- { FRAC_CONST(0.016464788254250), FRAC_CONST(0.026560746370212) },
- { FRAC_CONST(0.016383223546365), FRAC_CONST(0.026611134628757) },
- { FRAC_CONST(0.016301504633341), FRAC_CONST(0.026661272413168) },
- { FRAC_CONST(0.016219632284346), FRAC_CONST(0.026711159251530) },
- { FRAC_CONST(0.016137607269996), FRAC_CONST(0.026760794674288) },
- { FRAC_CONST(0.016055430362340), FRAC_CONST(0.026810178214254) },
- { FRAC_CONST(0.015973102334858), FRAC_CONST(0.026859309406613) },
- { FRAC_CONST(0.015890623962454), FRAC_CONST(0.026908187788922) },
- { FRAC_CONST(0.015807996021446), FRAC_CONST(0.026956812901119) },
- { FRAC_CONST(0.015725219289558), FRAC_CONST(0.027005184285527) },
- { FRAC_CONST(0.015642294545918), FRAC_CONST(0.027053301486856) },
- { FRAC_CONST(0.015559222571044), FRAC_CONST(0.027101164052208) },
- { FRAC_CONST(0.015476004146842), FRAC_CONST(0.027148771531083) },
- { FRAC_CONST(0.015392640056594), FRAC_CONST(0.027196123475380) },
- { FRAC_CONST(0.015309131084956), FRAC_CONST(0.027243219439406) },
- { FRAC_CONST(0.015225478017946), FRAC_CONST(0.027290058979875) },
- { FRAC_CONST(0.015141681642938), FRAC_CONST(0.027336641655915) },
- { FRAC_CONST(0.015057742748656), FRAC_CONST(0.027382967029073) },
- { FRAC_CONST(0.014973662125164), FRAC_CONST(0.027429034663317) },
- { FRAC_CONST(0.014889440563862), FRAC_CONST(0.027474844125040) },
- { FRAC_CONST(0.014805078857474), FRAC_CONST(0.027520394983066) },
- { FRAC_CONST(0.014720577800046), FRAC_CONST(0.027565686808654) },
- { FRAC_CONST(0.014635938186934), FRAC_CONST(0.027610719175499) },
- { FRAC_CONST(0.014551160814797), FRAC_CONST(0.027655491659740) },
- { FRAC_CONST(0.014466246481592), FRAC_CONST(0.027700003839960) },
- { FRAC_CONST(0.014381195986567), FRAC_CONST(0.027744255297195) },
- { FRAC_CONST(0.014296010130247), FRAC_CONST(0.027788245614933) },
- { FRAC_CONST(0.014210689714436), FRAC_CONST(0.027831974379120) },
- { FRAC_CONST(0.014125235542201), FRAC_CONST(0.027875441178165) },
- { FRAC_CONST(0.014039648417870), FRAC_CONST(0.027918645602941) },
- { FRAC_CONST(0.013953929147020), FRAC_CONST(0.027961587246792) },
- { FRAC_CONST(0.013868078536476), FRAC_CONST(0.028004265705534) },
- { FRAC_CONST(0.013782097394294), FRAC_CONST(0.028046680577462) },
- { FRAC_CONST(0.013695986529763), FRAC_CONST(0.028088831463351) },
- { FRAC_CONST(0.013609746753390), FRAC_CONST(0.028130717966461) },
- { FRAC_CONST(0.013523378876898), FRAC_CONST(0.028172339692540) },
- { FRAC_CONST(0.013436883713214), FRAC_CONST(0.028213696249828) },
- { FRAC_CONST(0.013350262076462), FRAC_CONST(0.028254787249062) },
- { FRAC_CONST(0.013263514781960), FRAC_CONST(0.028295612303478) },
- { FRAC_CONST(0.013176642646205), FRAC_CONST(0.028336171028814) },
- { FRAC_CONST(0.013089646486871), FRAC_CONST(0.028376463043317) },
- { FRAC_CONST(0.013002527122799), FRAC_CONST(0.028416487967743) },
- { FRAC_CONST(0.012915285373990), FRAC_CONST(0.028456245425361) },
- { FRAC_CONST(0.012827922061597), FRAC_CONST(0.028495735041960) },
- { FRAC_CONST(0.012740438007915), FRAC_CONST(0.028534956445849) },
- { FRAC_CONST(0.012652834036379), FRAC_CONST(0.028573909267859) },
- { FRAC_CONST(0.012565110971550), FRAC_CONST(0.028612593141354) },
- { FRAC_CONST(0.012477269639111), FRAC_CONST(0.028651007702224) },
- { FRAC_CONST(0.012389310865858), FRAC_CONST(0.028689152588899) },
- { FRAC_CONST(0.012301235479693), FRAC_CONST(0.028727027442343) },
- { FRAC_CONST(0.012213044309615), FRAC_CONST(0.028764631906065) },
- { FRAC_CONST(0.012124738185712), FRAC_CONST(0.028801965626115) },
- { FRAC_CONST(0.012036317939156), FRAC_CONST(0.028839028251097) },
- { FRAC_CONST(0.011947784402191), FRAC_CONST(0.028875819432161) },
- { FRAC_CONST(0.011859138408130), FRAC_CONST(0.028912338823015) },
- { FRAC_CONST(0.011770380791341), FRAC_CONST(0.028948586079925) },
- { FRAC_CONST(0.011681512387245), FRAC_CONST(0.028984560861718) },
- { FRAC_CONST(0.011592534032306), FRAC_CONST(0.029020262829785) },
- { FRAC_CONST(0.011503446564022), FRAC_CONST(0.029055691648087) },
- { FRAC_CONST(0.011414250820918), FRAC_CONST(0.029090846983152) },
- { FRAC_CONST(0.011324947642537), FRAC_CONST(0.029125728504087) },
- { FRAC_CONST(0.011235537869437), FRAC_CONST(0.029160335882573) },
- { FRAC_CONST(0.011146022343175), FRAC_CONST(0.029194668792871) },
- { FRAC_CONST(0.011056401906305), FRAC_CONST(0.029228726911828) },
- { FRAC_CONST(0.010966677402371), FRAC_CONST(0.029262509918876) },
- { FRAC_CONST(0.010876849675891), FRAC_CONST(0.029296017496036) },
- { FRAC_CONST(0.010786919572361), FRAC_CONST(0.029329249327922) },
- { FRAC_CONST(0.010696887938235), FRAC_CONST(0.029362205101743) },
- { FRAC_CONST(0.010606755620926), FRAC_CONST(0.029394884507308) },
- { FRAC_CONST(0.010516523468793), FRAC_CONST(0.029427287237024) },
- { FRAC_CONST(0.010426192331137), FRAC_CONST(0.029459412985906) },
- { FRAC_CONST(0.010335763058187), FRAC_CONST(0.029491261451573) },
- { FRAC_CONST(0.010245236501099), FRAC_CONST(0.029522832334255) },
- { FRAC_CONST(0.010154613511943), FRAC_CONST(0.029554125336796) },
- { FRAC_CONST(0.010063894943698), FRAC_CONST(0.029585140164654) },
- { FRAC_CONST(0.009973081650240), FRAC_CONST(0.029615876525905) },
- { FRAC_CONST(0.009882174486340), FRAC_CONST(0.029646334131247) },
- { FRAC_CONST(0.009791174307650), FRAC_CONST(0.029676512694001) },
- { FRAC_CONST(0.009700081970699), FRAC_CONST(0.029706411930116) },
- { FRAC_CONST(0.009608898332881), FRAC_CONST(0.029736031558168) },
- { FRAC_CONST(0.009517624252453), FRAC_CONST(0.029765371299366) },
- { FRAC_CONST(0.009426260588521), FRAC_CONST(0.029794430877553) },
- { FRAC_CONST(0.009334808201034), FRAC_CONST(0.029823210019210) },
- { FRAC_CONST(0.009243267950778), FRAC_CONST(0.029851708453456) },
- { FRAC_CONST(0.009151640699363), FRAC_CONST(0.029879925912053) },
- { FRAC_CONST(0.009059927309220), FRAC_CONST(0.029907862129408) },
- { FRAC_CONST(0.008968128643591), FRAC_CONST(0.029935516842573) },
- { FRAC_CONST(0.008876245566520), FRAC_CONST(0.029962889791254) },
- { FRAC_CONST(0.008784278942845), FRAC_CONST(0.029989980717805) },
- { FRAC_CONST(0.008692229638191), FRAC_CONST(0.030016789367235) },
- { FRAC_CONST(0.008600098518961), FRAC_CONST(0.030043315487212) },
- { FRAC_CONST(0.008507886452329), FRAC_CONST(0.030069558828062) },
- { FRAC_CONST(0.008415594306230), FRAC_CONST(0.030095519142772) },
- { FRAC_CONST(0.008323222949351), FRAC_CONST(0.030121196186994) },
- { FRAC_CONST(0.008230773251129), FRAC_CONST(0.030146589719046) },
- { FRAC_CONST(0.008138246081733), FRAC_CONST(0.030171699499915) },
- { FRAC_CONST(0.008045642312067), FRAC_CONST(0.030196525293257) },
- { FRAC_CONST(0.007952962813750), FRAC_CONST(0.030221066865402) },
- { FRAC_CONST(0.007860208459119), FRAC_CONST(0.030245323985357) },
- { FRAC_CONST(0.007767380121212), FRAC_CONST(0.030269296424803) },
- { FRAC_CONST(0.007674478673766), FRAC_CONST(0.030292983958103) },
- { FRAC_CONST(0.007581504991203), FRAC_CONST(0.030316386362302) },
- { FRAC_CONST(0.007488459948628), FRAC_CONST(0.030339503417126) },
- { FRAC_CONST(0.007395344421816), FRAC_CONST(0.030362334904989) },
- { FRAC_CONST(0.007302159287206), FRAC_CONST(0.030384880610993) },
- { FRAC_CONST(0.007208905421891), FRAC_CONST(0.030407140322928) },
- { FRAC_CONST(0.007115583703613), FRAC_CONST(0.030429113831278) },
- { FRAC_CONST(0.007022195010752), FRAC_CONST(0.030450800929220) },
- { FRAC_CONST(0.006928740222316), FRAC_CONST(0.030472201412626) },
- { FRAC_CONST(0.006835220217939), FRAC_CONST(0.030493315080068) },
- { FRAC_CONST(0.006741635877866), FRAC_CONST(0.030514141732814) },
- { FRAC_CONST(0.006647988082948), FRAC_CONST(0.030534681174838) },
- { FRAC_CONST(0.006554277714635), FRAC_CONST(0.030554933212813) },
- { FRAC_CONST(0.006460505654964), FRAC_CONST(0.030574897656119) },
- { FRAC_CONST(0.006366672786553), FRAC_CONST(0.030594574316845) },
- { FRAC_CONST(0.006272779992593), FRAC_CONST(0.030613963009786) },
- { FRAC_CONST(0.006178828156839), FRAC_CONST(0.030633063552447) },
- { FRAC_CONST(0.006084818163601), FRAC_CONST(0.030651875765048) },
- { FRAC_CONST(0.005990750897737), FRAC_CONST(0.030670399470520) },
- { FRAC_CONST(0.005896627244644), FRAC_CONST(0.030688634494512) },
- { FRAC_CONST(0.005802448090250), FRAC_CONST(0.030706580665388) },
- { FRAC_CONST(0.005708214321004), FRAC_CONST(0.030724237814232) },
- { FRAC_CONST(0.005613926823871), FRAC_CONST(0.030741605774849) },
- { FRAC_CONST(0.005519586486321), FRAC_CONST(0.030758684383764) },
- { FRAC_CONST(0.005425194196321), FRAC_CONST(0.030775473480228) },
- { FRAC_CONST(0.005330750842327), FRAC_CONST(0.030791972906214) },
- { FRAC_CONST(0.005236257313276), FRAC_CONST(0.030808182506425) },
- { FRAC_CONST(0.005141714498576), FRAC_CONST(0.030824102128288) },
- { FRAC_CONST(0.005047123288102), FRAC_CONST(0.030839731621963) },
- { FRAC_CONST(0.004952484572181), FRAC_CONST(0.030855070840339) },
- { FRAC_CONST(0.004857799241589), FRAC_CONST(0.030870119639036) },
- { FRAC_CONST(0.004763068187541), FRAC_CONST(0.030884877876411) },
- { FRAC_CONST(0.004668292301681), FRAC_CONST(0.030899345413553) },
- { FRAC_CONST(0.004573472476075), FRAC_CONST(0.030913522114288) },
- { FRAC_CONST(0.004478609603205), FRAC_CONST(0.030927407845180) },
- { FRAC_CONST(0.004383704575956), FRAC_CONST(0.030941002475530) },
- { FRAC_CONST(0.004288758287610), FRAC_CONST(0.030954305877381) },
- { FRAC_CONST(0.004193771631837), FRAC_CONST(0.030967317925516) },
- { FRAC_CONST(0.004098745502689), FRAC_CONST(0.030980038497461) },
- { FRAC_CONST(0.004003680794587), FRAC_CONST(0.030992467473486) },
- { FRAC_CONST(0.003908578402316), FRAC_CONST(0.031004604736602) },
- { FRAC_CONST(0.003813439221017), FRAC_CONST(0.031016450172571) },
- { FRAC_CONST(0.003718264146176), FRAC_CONST(0.031028003669899) },
- { FRAC_CONST(0.003623054073616), FRAC_CONST(0.031039265119839) },
- { FRAC_CONST(0.003527809899492), FRAC_CONST(0.031050234416394) },
- { FRAC_CONST(0.003432532520278), FRAC_CONST(0.031060911456318) },
- { FRAC_CONST(0.003337222832760), FRAC_CONST(0.031071296139114) },
- { FRAC_CONST(0.003241881734029), FRAC_CONST(0.031081388367037) },
- { FRAC_CONST(0.003146510121474), FRAC_CONST(0.031091188045095) },
- { FRAC_CONST(0.003051108892766), FRAC_CONST(0.031100695081051) },
- { FRAC_CONST(0.002955678945860), FRAC_CONST(0.031109909385419) },
- { FRAC_CONST(0.002860221178978), FRAC_CONST(0.031118830871473) },
- { FRAC_CONST(0.002764736490604), FRAC_CONST(0.031127459455239) },
- { FRAC_CONST(0.002669225779478), FRAC_CONST(0.031135795055501) },
- { FRAC_CONST(0.002573689944583), FRAC_CONST(0.031143837593803) },
- { FRAC_CONST(0.002478129885137), FRAC_CONST(0.031151586994444) },
- { FRAC_CONST(0.002382546500589), FRAC_CONST(0.031159043184484) },
- { FRAC_CONST(0.002286940690606), FRAC_CONST(0.031166206093743) },
- { FRAC_CONST(0.002191313355067), FRAC_CONST(0.031173075654800) },
- { FRAC_CONST(0.002095665394051), FRAC_CONST(0.031179651802998) },
- { FRAC_CONST(0.001999997707835), FRAC_CONST(0.031185934476438) },
- { FRAC_CONST(0.001904311196878), FRAC_CONST(0.031191923615985) },
- { FRAC_CONST(0.001808606761820), FRAC_CONST(0.031197619165268) },
- { FRAC_CONST(0.001712885303465), FRAC_CONST(0.031203021070678) },
- { FRAC_CONST(0.001617147722782), FRAC_CONST(0.031208129281370) },
- { FRAC_CONST(0.001521394920889), FRAC_CONST(0.031212943749264) },
- { FRAC_CONST(0.001425627799047), FRAC_CONST(0.031217464429043) },
- { FRAC_CONST(0.001329847258653), FRAC_CONST(0.031221691278159) },
- { FRAC_CONST(0.001234054201231), FRAC_CONST(0.031225624256825) },
- { FRAC_CONST(0.001138249528420), FRAC_CONST(0.031229263328024) },
- { FRAC_CONST(0.001042434141971), FRAC_CONST(0.031232608457502) },
- { FRAC_CONST(0.000946608943736), FRAC_CONST(0.031235659613775) },
- { FRAC_CONST(0.000850774835656), FRAC_CONST(0.031238416768124) },
- { FRAC_CONST(0.000754932719759), FRAC_CONST(0.031240879894597) },
- { FRAC_CONST(0.000659083498149), FRAC_CONST(0.031243048970010) },
- { FRAC_CONST(0.000563228072993), FRAC_CONST(0.031244923973948) },
- { FRAC_CONST(0.000467367346520), FRAC_CONST(0.031246504888762) },
- { FRAC_CONST(0.000371502221008), FRAC_CONST(0.031247791699571) },
- { FRAC_CONST(0.000275633598775), FRAC_CONST(0.031248784394264) },
- { FRAC_CONST(0.000179762382174), FRAC_CONST(0.031249482963498) },
- { FRAC_CONST(0.000083889473581), FRAC_CONST(0.031249887400697) }
- };
+/* 256 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_2048[] =
+{
+ { FRAC_CONST(0.031249997702054), FRAC_CONST(0.000011984224612) },
+ { FRAC_CONST(0.031249813866531), FRAC_CONST(0.000107857810004) },
+ { FRAC_CONST(0.031249335895858), FRAC_CONST(0.000203730380198) },
+ { FRAC_CONST(0.031248563794535), FRAC_CONST(0.000299601032804) },
+ { FRAC_CONST(0.031247497569829), FRAC_CONST(0.000395468865451) },
+ { FRAC_CONST(0.031246137231775), FRAC_CONST(0.000491332975794) },
+ { FRAC_CONST(0.031244482793177), FRAC_CONST(0.000587192461525) },
+ { FRAC_CONST(0.031242534269608), FRAC_CONST(0.000683046420376) },
+ { FRAC_CONST(0.031240291679407), FRAC_CONST(0.000778893950134) },
+ { FRAC_CONST(0.031237755043684), FRAC_CONST(0.000874734148645) },
+ { FRAC_CONST(0.031234924386313), FRAC_CONST(0.000970566113826) },
+ { FRAC_CONST(0.031231799733938), FRAC_CONST(0.001066388943669) },
+ { FRAC_CONST(0.031228381115970), FRAC_CONST(0.001162201736253) },
+ { FRAC_CONST(0.031224668564585), FRAC_CONST(0.001258003589751) },
+ { FRAC_CONST(0.031220662114728), FRAC_CONST(0.001353793602441) },
+ { FRAC_CONST(0.031216361804108), FRAC_CONST(0.001449570872710) },
+ { FRAC_CONST(0.031211767673203), FRAC_CONST(0.001545334499065) },
+ { FRAC_CONST(0.031206879765253), FRAC_CONST(0.001641083580144) },
+ { FRAC_CONST(0.031201698126266), FRAC_CONST(0.001736817214719) },
+ { FRAC_CONST(0.031196222805014), FRAC_CONST(0.001832534501709) },
+ { FRAC_CONST(0.031190453853031), FRAC_CONST(0.001928234540186) },
+ { FRAC_CONST(0.031184391324617), FRAC_CONST(0.002023916429386) },
+ { FRAC_CONST(0.031178035276836), FRAC_CONST(0.002119579268713) },
+ { FRAC_CONST(0.031171385769513), FRAC_CONST(0.002215222157753) },
+ { FRAC_CONST(0.031164442865236), FRAC_CONST(0.002310844196278) },
+ { FRAC_CONST(0.031157206629353), FRAC_CONST(0.002406444484258) },
+ { FRAC_CONST(0.031149677129975), FRAC_CONST(0.002502022121865) },
+ { FRAC_CONST(0.031141854437973), FRAC_CONST(0.002597576209488) },
+ { FRAC_CONST(0.031133738626977), FRAC_CONST(0.002693105847734) },
+ { FRAC_CONST(0.031125329773375), FRAC_CONST(0.002788610137442) },
+ { FRAC_CONST(0.031116627956316), FRAC_CONST(0.002884088179689) },
+ { FRAC_CONST(0.031107633257703), FRAC_CONST(0.002979539075801) },
+ { FRAC_CONST(0.031098345762200), FRAC_CONST(0.003074961927355) },
+ { FRAC_CONST(0.031088765557222), FRAC_CONST(0.003170355836197) },
+ { FRAC_CONST(0.031078892732942), FRAC_CONST(0.003265719904442) },
+ { FRAC_CONST(0.031068727382288), FRAC_CONST(0.003361053234488) },
+ { FRAC_CONST(0.031058269600939), FRAC_CONST(0.003456354929021) },
+ { FRAC_CONST(0.031047519487329), FRAC_CONST(0.003551624091024) },
+ { FRAC_CONST(0.031036477142640), FRAC_CONST(0.003646859823790) },
+ { FRAC_CONST(0.031025142670809), FRAC_CONST(0.003742061230921) },
+ { FRAC_CONST(0.031013516178519), FRAC_CONST(0.003837227416347) },
+ { FRAC_CONST(0.031001597775203), FRAC_CONST(0.003932357484328) },
+ { FRAC_CONST(0.030989387573042), FRAC_CONST(0.004027450539462) },
+ { FRAC_CONST(0.030976885686963), FRAC_CONST(0.004122505686697) },
+ { FRAC_CONST(0.030964092234638), FRAC_CONST(0.004217522031340) },
+ { FRAC_CONST(0.030951007336485), FRAC_CONST(0.004312498679058) },
+ { FRAC_CONST(0.030937631115663), FRAC_CONST(0.004407434735897) },
+ { FRAC_CONST(0.030923963698074), FRAC_CONST(0.004502329308281) },
+ { FRAC_CONST(0.030910005212362), FRAC_CONST(0.004597181503027) },
+ { FRAC_CONST(0.030895755789908), FRAC_CONST(0.004691990427350) },
+ { FRAC_CONST(0.030881215564835), FRAC_CONST(0.004786755188872) },
+ { FRAC_CONST(0.030866384674000), FRAC_CONST(0.004881474895632) },
+ { FRAC_CONST(0.030851263256996), FRAC_CONST(0.004976148656090) },
+ { FRAC_CONST(0.030835851456154), FRAC_CONST(0.005070775579142) },
+ { FRAC_CONST(0.030820149416533), FRAC_CONST(0.005165354774124) },
+ { FRAC_CONST(0.030804157285929), FRAC_CONST(0.005259885350819) },
+ { FRAC_CONST(0.030787875214864), FRAC_CONST(0.005354366419469) },
+ { FRAC_CONST(0.030771303356593), FRAC_CONST(0.005448797090784) },
+ { FRAC_CONST(0.030754441867095), FRAC_CONST(0.005543176475946) },
+ { FRAC_CONST(0.030737290905077), FRAC_CONST(0.005637503686619) },
+ { FRAC_CONST(0.030719850631972), FRAC_CONST(0.005731777834961) },
+ { FRAC_CONST(0.030702121211932), FRAC_CONST(0.005825998033626) },
+ { FRAC_CONST(0.030684102811835), FRAC_CONST(0.005920163395780) },
+ { FRAC_CONST(0.030665795601276), FRAC_CONST(0.006014273035101) },
+ { FRAC_CONST(0.030647199752570), FRAC_CONST(0.006108326065793) },
+ { FRAC_CONST(0.030628315440748), FRAC_CONST(0.006202321602594) },
+ { FRAC_CONST(0.030609142843557), FRAC_CONST(0.006296258760782) },
+ { FRAC_CONST(0.030589682141455), FRAC_CONST(0.006390136656185) },
+ { FRAC_CONST(0.030569933517616), FRAC_CONST(0.006483954405188) },
+ { FRAC_CONST(0.030549897157919), FRAC_CONST(0.006577711124743) },
+ { FRAC_CONST(0.030529573250956), FRAC_CONST(0.006671405932375) },
+ { FRAC_CONST(0.030508961988022), FRAC_CONST(0.006765037946194) },
+ { FRAC_CONST(0.030488063563118), FRAC_CONST(0.006858606284900) },
+ { FRAC_CONST(0.030466878172949), FRAC_CONST(0.006952110067791) },
+ { FRAC_CONST(0.030445406016919), FRAC_CONST(0.007045548414774) },
+ { FRAC_CONST(0.030423647297133), FRAC_CONST(0.007138920446372) },
+ { FRAC_CONST(0.030401602218392), FRAC_CONST(0.007232225283733) },
+ { FRAC_CONST(0.030379270988192), FRAC_CONST(0.007325462048634) },
+ { FRAC_CONST(0.030356653816724), FRAC_CONST(0.007418629863497) },
+ { FRAC_CONST(0.030333750916869), FRAC_CONST(0.007511727851390) },
+ { FRAC_CONST(0.030310562504198), FRAC_CONST(0.007604755136040) },
+ { FRAC_CONST(0.030287088796968), FRAC_CONST(0.007697710841838) },
+ { FRAC_CONST(0.030263330016124), FRAC_CONST(0.007790594093851) },
+ { FRAC_CONST(0.030239286385293), FRAC_CONST(0.007883404017824) },
+ { FRAC_CONST(0.030214958130781), FRAC_CONST(0.007976139740197) },
+ { FRAC_CONST(0.030190345481576), FRAC_CONST(0.008068800388104) },
+ { FRAC_CONST(0.030165448669342), FRAC_CONST(0.008161385089390) },
+ { FRAC_CONST(0.030140267928416), FRAC_CONST(0.008253892972610) },
+ { FRAC_CONST(0.030114803495809), FRAC_CONST(0.008346323167047) },
+ { FRAC_CONST(0.030089055611203), FRAC_CONST(0.008438674802711) },
+ { FRAC_CONST(0.030063024516947), FRAC_CONST(0.008530947010354) },
+ { FRAC_CONST(0.030036710458054), FRAC_CONST(0.008623138921475) },
+ { FRAC_CONST(0.030010113682202), FRAC_CONST(0.008715249668328) },
+ { FRAC_CONST(0.029983234439732), FRAC_CONST(0.008807278383932) },
+ { FRAC_CONST(0.029956072983640), FRAC_CONST(0.008899224202078) },
+ { FRAC_CONST(0.029928629569580), FRAC_CONST(0.008991086257336) },
+ { FRAC_CONST(0.029900904455860), FRAC_CONST(0.009082863685067) },
+ { FRAC_CONST(0.029872897903441), FRAC_CONST(0.009174555621425) },
+ { FRAC_CONST(0.029844610175929), FRAC_CONST(0.009266161203371) },
+ { FRAC_CONST(0.029816041539579), FRAC_CONST(0.009357679568679) },
+ { FRAC_CONST(0.029787192263292), FRAC_CONST(0.009449109855944) },
+ { FRAC_CONST(0.029758062618606), FRAC_CONST(0.009540451204587) },
+ { FRAC_CONST(0.029728652879702), FRAC_CONST(0.009631702754871) },
+ { FRAC_CONST(0.029698963323395), FRAC_CONST(0.009722863647900) },
+ { FRAC_CONST(0.029668994229134), FRAC_CONST(0.009813933025633) },
+ { FRAC_CONST(0.029638745879000), FRAC_CONST(0.009904910030891) },
+ { FRAC_CONST(0.029608218557702), FRAC_CONST(0.009995793807363) },
+ { FRAC_CONST(0.029577412552575), FRAC_CONST(0.010086583499618) },
+ { FRAC_CONST(0.029546328153577), FRAC_CONST(0.010177278253107) },
+ { FRAC_CONST(0.029514965653285), FRAC_CONST(0.010267877214177) },
+ { FRAC_CONST(0.029483325346896), FRAC_CONST(0.010358379530076) },
+ { FRAC_CONST(0.029451407532220), FRAC_CONST(0.010448784348962) },
+ { FRAC_CONST(0.029419212509679), FRAC_CONST(0.010539090819911) },
+ { FRAC_CONST(0.029386740582307), FRAC_CONST(0.010629298092923) },
+ { FRAC_CONST(0.029353992055740), FRAC_CONST(0.010719405318933) },
+ { FRAC_CONST(0.029320967238220), FRAC_CONST(0.010809411649818) },
+ { FRAC_CONST(0.029287666440590), FRAC_CONST(0.010899316238403) },
+ { FRAC_CONST(0.029254089976290), FRAC_CONST(0.010989118238474) },
+ { FRAC_CONST(0.029220238161353), FRAC_CONST(0.011078816804778) },
+ { FRAC_CONST(0.029186111314406), FRAC_CONST(0.011168411093039) },
+ { FRAC_CONST(0.029151709756664), FRAC_CONST(0.011257900259961) },
+ { FRAC_CONST(0.029117033811927), FRAC_CONST(0.011347283463239) },
+ { FRAC_CONST(0.029082083806579), FRAC_CONST(0.011436559861563) },
+ { FRAC_CONST(0.029046860069582), FRAC_CONST(0.011525728614630) },
+ { FRAC_CONST(0.029011362932476), FRAC_CONST(0.011614788883150) },
+ { FRAC_CONST(0.028975592729373), FRAC_CONST(0.011703739828853) },
+ { FRAC_CONST(0.028939549796957), FRAC_CONST(0.011792580614500) },
+ { FRAC_CONST(0.028903234474475), FRAC_CONST(0.011881310403886) },
+ { FRAC_CONST(0.028866647103744), FRAC_CONST(0.011969928361855) },
+ { FRAC_CONST(0.028829788029135), FRAC_CONST(0.012058433654299) },
+ { FRAC_CONST(0.028792657597583), FRAC_CONST(0.012146825448172) },
+ { FRAC_CONST(0.028755256158571), FRAC_CONST(0.012235102911499) },
+ { FRAC_CONST(0.028717584064137), FRAC_CONST(0.012323265213377) },
+ { FRAC_CONST(0.028679641668864), FRAC_CONST(0.012411311523990) },
+ { FRAC_CONST(0.028641429329882), FRAC_CONST(0.012499241014612) },
+ { FRAC_CONST(0.028602947406859), FRAC_CONST(0.012587052857618) },
+ { FRAC_CONST(0.028564196262001), FRAC_CONST(0.012674746226488) },
+ { FRAC_CONST(0.028525176260050), FRAC_CONST(0.012762320295819) },
+ { FRAC_CONST(0.028485887768276), FRAC_CONST(0.012849774241331) },
+ { FRAC_CONST(0.028446331156478), FRAC_CONST(0.012937107239875) },
+ { FRAC_CONST(0.028406506796976), FRAC_CONST(0.013024318469437) },
+ { FRAC_CONST(0.028366415064615), FRAC_CONST(0.013111407109155) },
+ { FRAC_CONST(0.028326056336751), FRAC_CONST(0.013198372339315) },
+ { FRAC_CONST(0.028285430993258), FRAC_CONST(0.013285213341368) },
+ { FRAC_CONST(0.028244539416515), FRAC_CONST(0.013371929297933) },
+ { FRAC_CONST(0.028203381991411), FRAC_CONST(0.013458519392807) },
+ { FRAC_CONST(0.028161959105334), FRAC_CONST(0.013544982810971) },
+ { FRAC_CONST(0.028120271148172), FRAC_CONST(0.013631318738598) },
+ { FRAC_CONST(0.028078318512309), FRAC_CONST(0.013717526363062) },
+ { FRAC_CONST(0.028036101592619), FRAC_CONST(0.013803604872943) },
+ { FRAC_CONST(0.027993620786463), FRAC_CONST(0.013889553458039) },
+ { FRAC_CONST(0.027950876493687), FRAC_CONST(0.013975371309367) },
+ { FRAC_CONST(0.027907869116616), FRAC_CONST(0.014061057619178) },
+ { FRAC_CONST(0.027864599060052), FRAC_CONST(0.014146611580959) },
+ { FRAC_CONST(0.027821066731270), FRAC_CONST(0.014232032389445) },
+ { FRAC_CONST(0.027777272540012), FRAC_CONST(0.014317319240622) },
+ { FRAC_CONST(0.027733216898487), FRAC_CONST(0.014402471331737) },
+ { FRAC_CONST(0.027688900221361), FRAC_CONST(0.014487487861307) },
+ { FRAC_CONST(0.027644322925762), FRAC_CONST(0.014572368029123) },
+ { FRAC_CONST(0.027599485431266), FRAC_CONST(0.014657111036262) },
+ { FRAC_CONST(0.027554388159903), FRAC_CONST(0.014741716085090) },
+ { FRAC_CONST(0.027509031536144), FRAC_CONST(0.014826182379271) },
+ { FRAC_CONST(0.027463415986904), FRAC_CONST(0.014910509123778) },
+ { FRAC_CONST(0.027417541941533), FRAC_CONST(0.014994695524894) },
+ { FRAC_CONST(0.027371409831816), FRAC_CONST(0.015078740790225) },
+ { FRAC_CONST(0.027325020091965), FRAC_CONST(0.015162644128704) },
+ { FRAC_CONST(0.027278373158618), FRAC_CONST(0.015246404750603) },
+ { FRAC_CONST(0.027231469470833), FRAC_CONST(0.015330021867534) },
+ { FRAC_CONST(0.027184309470088), FRAC_CONST(0.015413494692460) },
+ { FRAC_CONST(0.027136893600268), FRAC_CONST(0.015496822439704) },
+ { FRAC_CONST(0.027089222307671), FRAC_CONST(0.015580004324954) },
+ { FRAC_CONST(0.027041296040997), FRAC_CONST(0.015663039565269) },
+ { FRAC_CONST(0.026993115251345), FRAC_CONST(0.015745927379091) },
+ { FRAC_CONST(0.026944680392213), FRAC_CONST(0.015828666986247) },
+ { FRAC_CONST(0.026895991919487), FRAC_CONST(0.015911257607961) },
+ { FRAC_CONST(0.026847050291442), FRAC_CONST(0.015993698466859) },
+ { FRAC_CONST(0.026797855968734), FRAC_CONST(0.016075988786976) },
+ { FRAC_CONST(0.026748409414401), FRAC_CONST(0.016158127793763) },
+ { FRAC_CONST(0.026698711093851), FRAC_CONST(0.016240114714099) },
+ { FRAC_CONST(0.026648761474864), FRAC_CONST(0.016321948776289) },
+ { FRAC_CONST(0.026598561027585), FRAC_CONST(0.016403629210082) },
+ { FRAC_CONST(0.026548110224519), FRAC_CONST(0.016485155246669) },
+ { FRAC_CONST(0.026497409540530), FRAC_CONST(0.016566526118696) },
+ { FRAC_CONST(0.026446459452830), FRAC_CONST(0.016647741060271) },
+ { FRAC_CONST(0.026395260440982), FRAC_CONST(0.016728799306966) },
+ { FRAC_CONST(0.026343812986890), FRAC_CONST(0.016809700095831) },
+ { FRAC_CONST(0.026292117574797), FRAC_CONST(0.016890442665397) },
+ { FRAC_CONST(0.026240174691280), FRAC_CONST(0.016971026255683) },
+ { FRAC_CONST(0.026187984825246), FRAC_CONST(0.017051450108208) },
+ { FRAC_CONST(0.026135548467924), FRAC_CONST(0.017131713465990) },
+ { FRAC_CONST(0.026082866112867), FRAC_CONST(0.017211815573560) },
+ { FRAC_CONST(0.026029938255941), FRAC_CONST(0.017291755676967) },
+ { FRAC_CONST(0.025976765395322), FRAC_CONST(0.017371533023784) },
+ { FRAC_CONST(0.025923348031494), FRAC_CONST(0.017451146863116) },
+ { FRAC_CONST(0.025869686667242), FRAC_CONST(0.017530596445607) },
+ { FRAC_CONST(0.025815781807646), FRAC_CONST(0.017609881023449) },
+ { FRAC_CONST(0.025761633960080), FRAC_CONST(0.017688999850383) },
+ { FRAC_CONST(0.025707243634204), FRAC_CONST(0.017767952181715) },
+ { FRAC_CONST(0.025652611341960), FRAC_CONST(0.017846737274313) },
+ { FRAC_CONST(0.025597737597568), FRAC_CONST(0.017925354386623) },
+ { FRAC_CONST(0.025542622917522), FRAC_CONST(0.018003802778671) },
+ { FRAC_CONST(0.025487267820581), FRAC_CONST(0.018082081712071) },
+ { FRAC_CONST(0.025431672827768), FRAC_CONST(0.018160190450031) },
+ { FRAC_CONST(0.025375838462365), FRAC_CONST(0.018238128257362) },
+ { FRAC_CONST(0.025319765249906), FRAC_CONST(0.018315894400484) },
+ { FRAC_CONST(0.025263453718173), FRAC_CONST(0.018393488147432) },
+ { FRAC_CONST(0.025206904397193), FRAC_CONST(0.018470908767865) },
+ { FRAC_CONST(0.025150117819228), FRAC_CONST(0.018548155533070) },
+ { FRAC_CONST(0.025093094518776), FRAC_CONST(0.018625227715971) },
+ { FRAC_CONST(0.025035835032562), FRAC_CONST(0.018702124591135) },
+ { FRAC_CONST(0.024978339899534), FRAC_CONST(0.018778845434780) },
+ { FRAC_CONST(0.024920609660858), FRAC_CONST(0.018855389524780) },
+ { FRAC_CONST(0.024862644859912), FRAC_CONST(0.018931756140672) },
+ { FRAC_CONST(0.024804446042284), FRAC_CONST(0.019007944563666) },
+ { FRAC_CONST(0.024746013755764), FRAC_CONST(0.019083954076646) },
+ { FRAC_CONST(0.024687348550337), FRAC_CONST(0.019159783964183) },
+ { FRAC_CONST(0.024628450978184), FRAC_CONST(0.019235433512536) },
+ { FRAC_CONST(0.024569321593670), FRAC_CONST(0.019310902009663) },
+ { FRAC_CONST(0.024509960953345), FRAC_CONST(0.019386188745225) },
+ { FRAC_CONST(0.024450369615932), FRAC_CONST(0.019461293010596) },
+ { FRAC_CONST(0.024390548142329), FRAC_CONST(0.019536214098866) },
+ { FRAC_CONST(0.024330497095598), FRAC_CONST(0.019610951304848) },
+ { FRAC_CONST(0.024270217040961), FRAC_CONST(0.019685503925087) },
+ { FRAC_CONST(0.024209708545799), FRAC_CONST(0.019759871257867) },
+ { FRAC_CONST(0.024148972179639), FRAC_CONST(0.019834052603212) },
+ { FRAC_CONST(0.024088008514157), FRAC_CONST(0.019908047262901) },
+ { FRAC_CONST(0.024026818123164), FRAC_CONST(0.019981854540467) },
+ { FRAC_CONST(0.023965401582609), FRAC_CONST(0.020055473741208) },
+ { FRAC_CONST(0.023903759470567), FRAC_CONST(0.020128904172192) },
+ { FRAC_CONST(0.023841892367236), FRAC_CONST(0.020202145142264) },
+ { FRAC_CONST(0.023779800854935), FRAC_CONST(0.020275195962052) },
+ { FRAC_CONST(0.023717485518092), FRAC_CONST(0.020348055943974) },
+ { FRAC_CONST(0.023654946943242), FRAC_CONST(0.020420724402244) },
+ { FRAC_CONST(0.023592185719023), FRAC_CONST(0.020493200652878) },
+ { FRAC_CONST(0.023529202436167), FRAC_CONST(0.020565484013703) },
+ { FRAC_CONST(0.023465997687496), FRAC_CONST(0.020637573804361) },
+ { FRAC_CONST(0.023402572067918), FRAC_CONST(0.020709469346314) },
+ { FRAC_CONST(0.023338926174419), FRAC_CONST(0.020781169962854) },
+ { FRAC_CONST(0.023275060606058), FRAC_CONST(0.020852674979108) },
+ { FRAC_CONST(0.023210975963963), FRAC_CONST(0.020923983722044) },
+ { FRAC_CONST(0.023146672851322), FRAC_CONST(0.020995095520475) },
+ { FRAC_CONST(0.023082151873380), FRAC_CONST(0.021066009705072) },
+ { FRAC_CONST(0.023017413637435), FRAC_CONST(0.021136725608363) },
+ { FRAC_CONST(0.022952458752826), FRAC_CONST(0.021207242564742) },
+ { FRAC_CONST(0.022887287830934), FRAC_CONST(0.021277559910478) },
+ { FRAC_CONST(0.022821901485173), FRAC_CONST(0.021347676983716) },
+ { FRAC_CONST(0.022756300330983), FRAC_CONST(0.021417593124488) },
+ { FRAC_CONST(0.022690484985827), FRAC_CONST(0.021487307674717) },
+ { FRAC_CONST(0.022624456069185), FRAC_CONST(0.021556819978223) },
+ { FRAC_CONST(0.022558214202547), FRAC_CONST(0.021626129380729) },
+ { FRAC_CONST(0.022491760009405), FRAC_CONST(0.021695235229869) },
+ { FRAC_CONST(0.022425094115252), FRAC_CONST(0.021764136875192) },
+ { FRAC_CONST(0.022358217147572), FRAC_CONST(0.021832833668171) },
+ { FRAC_CONST(0.022291129735838), FRAC_CONST(0.021901324962204) },
+ { FRAC_CONST(0.022223832511501), FRAC_CONST(0.021969610112625) },
+ { FRAC_CONST(0.022156326107988), FRAC_CONST(0.022037688476709) },
+ { FRAC_CONST(0.022088611160696), FRAC_CONST(0.022105559413676) },
+ { FRAC_CONST(0.022020688306983), FRAC_CONST(0.022173222284699) },
+ { FRAC_CONST(0.021952558186166), FRAC_CONST(0.022240676452909) },
+ { FRAC_CONST(0.021884221439510), FRAC_CONST(0.022307921283403) },
+ { FRAC_CONST(0.021815678710228), FRAC_CONST(0.022374956143245) },
+ { FRAC_CONST(0.021746930643469), FRAC_CONST(0.022441780401478) },
+ { FRAC_CONST(0.021677977886316), FRAC_CONST(0.022508393429127) },
+ { FRAC_CONST(0.021608821087780), FRAC_CONST(0.022574794599206) },
+ { FRAC_CONST(0.021539460898790), FRAC_CONST(0.022640983286719) },
+ { FRAC_CONST(0.021469897972190), FRAC_CONST(0.022706958868676) },
+ { FRAC_CONST(0.021400132962735), FRAC_CONST(0.022772720724087) },
+ { FRAC_CONST(0.021330166527077), FRAC_CONST(0.022838268233979) },
+ { FRAC_CONST(0.021259999323769), FRAC_CONST(0.022903600781391) },
+ { FRAC_CONST(0.021189632013250), FRAC_CONST(0.022968717751391) },
+ { FRAC_CONST(0.021119065257845), FRAC_CONST(0.023033618531071) },
+ { FRAC_CONST(0.021048299721754), FRAC_CONST(0.023098302509561) },
+ { FRAC_CONST(0.020977336071050), FRAC_CONST(0.023162769078031) },
+ { FRAC_CONST(0.020906174973670), FRAC_CONST(0.023227017629698) },
+ { FRAC_CONST(0.020834817099409), FRAC_CONST(0.023291047559828) },
+ { FRAC_CONST(0.020763263119915), FRAC_CONST(0.023354858265748) },
+ { FRAC_CONST(0.020691513708680), FRAC_CONST(0.023418449146848) },
+ { FRAC_CONST(0.020619569541038), FRAC_CONST(0.023481819604585) },
+ { FRAC_CONST(0.020547431294155), FRAC_CONST(0.023544969042494) },
+ { FRAC_CONST(0.020475099647023), FRAC_CONST(0.023607896866186) },
+ { FRAC_CONST(0.020402575280455), FRAC_CONST(0.023670602483363) },
+ { FRAC_CONST(0.020329858877078), FRAC_CONST(0.023733085303813) },
+ { FRAC_CONST(0.020256951121327), FRAC_CONST(0.023795344739427) },
+ { FRAC_CONST(0.020183852699437), FRAC_CONST(0.023857380204193) },
+ { FRAC_CONST(0.020110564299439), FRAC_CONST(0.023919191114211) },
+ { FRAC_CONST(0.020037086611150), FRAC_CONST(0.023980776887692) },
+ { FRAC_CONST(0.019963420326171), FRAC_CONST(0.024042136944968) },
+ { FRAC_CONST(0.019889566137877), FRAC_CONST(0.024103270708495) },
+ { FRAC_CONST(0.019815524741412), FRAC_CONST(0.024164177602859) },
+ { FRAC_CONST(0.019741296833681), FRAC_CONST(0.024224857054779) },
+ { FRAC_CONST(0.019666883113346), FRAC_CONST(0.024285308493120) },
+ { FRAC_CONST(0.019592284280817), FRAC_CONST(0.024345531348888) },
+ { FRAC_CONST(0.019517501038246), FRAC_CONST(0.024405525055242) },
+ { FRAC_CONST(0.019442534089523), FRAC_CONST(0.024465289047500) },
+ { FRAC_CONST(0.019367384140264), FRAC_CONST(0.024524822763141) },
+ { FRAC_CONST(0.019292051897809), FRAC_CONST(0.024584125641809) },
+ { FRAC_CONST(0.019216538071215), FRAC_CONST(0.024643197125323) },
+ { FRAC_CONST(0.019140843371246), FRAC_CONST(0.024702036657681) },
+ { FRAC_CONST(0.019064968510369), FRAC_CONST(0.024760643685063) },
+ { FRAC_CONST(0.018988914202748), FRAC_CONST(0.024819017655836) },
+ { FRAC_CONST(0.018912681164234), FRAC_CONST(0.024877158020562) },
+ { FRAC_CONST(0.018836270112363), FRAC_CONST(0.024935064232003) },
+ { FRAC_CONST(0.018759681766343), FRAC_CONST(0.024992735745123) },
+ { FRAC_CONST(0.018682916847054), FRAC_CONST(0.025050172017095) },
+ { FRAC_CONST(0.018605976077037), FRAC_CONST(0.025107372507308) },
+ { FRAC_CONST(0.018528860180486), FRAC_CONST(0.025164336677369) },
+ { FRAC_CONST(0.018451569883247), FRAC_CONST(0.025221063991110) },
+ { FRAC_CONST(0.018374105912805), FRAC_CONST(0.025277553914591) },
+ { FRAC_CONST(0.018296468998280), FRAC_CONST(0.025333805916107) },
+ { FRAC_CONST(0.018218659870421), FRAC_CONST(0.025389819466194) },
+ { FRAC_CONST(0.018140679261596), FRAC_CONST(0.025445594037630) },
+ { FRAC_CONST(0.018062527905790), FRAC_CONST(0.025501129105445) },
+ { FRAC_CONST(0.017984206538592), FRAC_CONST(0.025556424146920) },
+ { FRAC_CONST(0.017905715897192), FRAC_CONST(0.025611478641598) },
+ { FRAC_CONST(0.017827056720375), FRAC_CONST(0.025666292071285) },
+ { FRAC_CONST(0.017748229748511), FRAC_CONST(0.025720863920056) },
+ { FRAC_CONST(0.017669235723550), FRAC_CONST(0.025775193674260) },
+ { FRAC_CONST(0.017590075389012), FRAC_CONST(0.025829280822525) },
+ { FRAC_CONST(0.017510749489986), FRAC_CONST(0.025883124855762) },
+ { FRAC_CONST(0.017431258773116), FRAC_CONST(0.025936725267170) },
+ { FRAC_CONST(0.017351603986600), FRAC_CONST(0.025990081552242) },
+ { FRAC_CONST(0.017271785880180), FRAC_CONST(0.026043193208768) },
+ { FRAC_CONST(0.017191805205132), FRAC_CONST(0.026096059736841) },
+ { FRAC_CONST(0.017111662714267), FRAC_CONST(0.026148680638861) },
+ { FRAC_CONST(0.017031359161915), FRAC_CONST(0.026201055419541) },
+ { FRAC_CONST(0.016950895303924), FRAC_CONST(0.026253183585908) },
+ { FRAC_CONST(0.016870271897651), FRAC_CONST(0.026305064647313) },
+ { FRAC_CONST(0.016789489701954), FRAC_CONST(0.026356698115431) },
+ { FRAC_CONST(0.016708549477186), FRAC_CONST(0.026408083504269) },
+ { FRAC_CONST(0.016627451985187), FRAC_CONST(0.026459220330167) },
+ { FRAC_CONST(0.016546197989277), FRAC_CONST(0.026510108111806) },
+ { FRAC_CONST(0.016464788254250), FRAC_CONST(0.026560746370212) },
+ { FRAC_CONST(0.016383223546365), FRAC_CONST(0.026611134628757) },
+ { FRAC_CONST(0.016301504633341), FRAC_CONST(0.026661272413168) },
+ { FRAC_CONST(0.016219632284346), FRAC_CONST(0.026711159251530) },
+ { FRAC_CONST(0.016137607269996), FRAC_CONST(0.026760794674288) },
+ { FRAC_CONST(0.016055430362340), FRAC_CONST(0.026810178214254) },
+ { FRAC_CONST(0.015973102334858), FRAC_CONST(0.026859309406613) },
+ { FRAC_CONST(0.015890623962454), FRAC_CONST(0.026908187788922) },
+ { FRAC_CONST(0.015807996021446), FRAC_CONST(0.026956812901119) },
+ { FRAC_CONST(0.015725219289558), FRAC_CONST(0.027005184285527) },
+ { FRAC_CONST(0.015642294545918), FRAC_CONST(0.027053301486856) },
+ { FRAC_CONST(0.015559222571044), FRAC_CONST(0.027101164052208) },
+ { FRAC_CONST(0.015476004146842), FRAC_CONST(0.027148771531083) },
+ { FRAC_CONST(0.015392640056594), FRAC_CONST(0.027196123475380) },
+ { FRAC_CONST(0.015309131084956), FRAC_CONST(0.027243219439406) },
+ { FRAC_CONST(0.015225478017946), FRAC_CONST(0.027290058979875) },
+ { FRAC_CONST(0.015141681642938), FRAC_CONST(0.027336641655915) },
+ { FRAC_CONST(0.015057742748656), FRAC_CONST(0.027382967029073) },
+ { FRAC_CONST(0.014973662125164), FRAC_CONST(0.027429034663317) },
+ { FRAC_CONST(0.014889440563862), FRAC_CONST(0.027474844125040) },
+ { FRAC_CONST(0.014805078857474), FRAC_CONST(0.027520394983066) },
+ { FRAC_CONST(0.014720577800046), FRAC_CONST(0.027565686808654) },
+ { FRAC_CONST(0.014635938186934), FRAC_CONST(0.027610719175499) },
+ { FRAC_CONST(0.014551160814797), FRAC_CONST(0.027655491659740) },
+ { FRAC_CONST(0.014466246481592), FRAC_CONST(0.027700003839960) },
+ { FRAC_CONST(0.014381195986567), FRAC_CONST(0.027744255297195) },
+ { FRAC_CONST(0.014296010130247), FRAC_CONST(0.027788245614933) },
+ { FRAC_CONST(0.014210689714436), FRAC_CONST(0.027831974379120) },
+ { FRAC_CONST(0.014125235542201), FRAC_CONST(0.027875441178165) },
+ { FRAC_CONST(0.014039648417870), FRAC_CONST(0.027918645602941) },
+ { FRAC_CONST(0.013953929147020), FRAC_CONST(0.027961587246792) },
+ { FRAC_CONST(0.013868078536476), FRAC_CONST(0.028004265705534) },
+ { FRAC_CONST(0.013782097394294), FRAC_CONST(0.028046680577462) },
+ { FRAC_CONST(0.013695986529763), FRAC_CONST(0.028088831463351) },
+ { FRAC_CONST(0.013609746753390), FRAC_CONST(0.028130717966461) },
+ { FRAC_CONST(0.013523378876898), FRAC_CONST(0.028172339692540) },
+ { FRAC_CONST(0.013436883713214), FRAC_CONST(0.028213696249828) },
+ { FRAC_CONST(0.013350262076462), FRAC_CONST(0.028254787249062) },
+ { FRAC_CONST(0.013263514781960), FRAC_CONST(0.028295612303478) },
+ { FRAC_CONST(0.013176642646205), FRAC_CONST(0.028336171028814) },
+ { FRAC_CONST(0.013089646486871), FRAC_CONST(0.028376463043317) },
+ { FRAC_CONST(0.013002527122799), FRAC_CONST(0.028416487967743) },
+ { FRAC_CONST(0.012915285373990), FRAC_CONST(0.028456245425361) },
+ { FRAC_CONST(0.012827922061597), FRAC_CONST(0.028495735041960) },
+ { FRAC_CONST(0.012740438007915), FRAC_CONST(0.028534956445849) },
+ { FRAC_CONST(0.012652834036379), FRAC_CONST(0.028573909267859) },
+ { FRAC_CONST(0.012565110971550), FRAC_CONST(0.028612593141354) },
+ { FRAC_CONST(0.012477269639111), FRAC_CONST(0.028651007702224) },
+ { FRAC_CONST(0.012389310865858), FRAC_CONST(0.028689152588899) },
+ { FRAC_CONST(0.012301235479693), FRAC_CONST(0.028727027442343) },
+ { FRAC_CONST(0.012213044309615), FRAC_CONST(0.028764631906065) },
+ { FRAC_CONST(0.012124738185712), FRAC_CONST(0.028801965626115) },
+ { FRAC_CONST(0.012036317939156), FRAC_CONST(0.028839028251097) },
+ { FRAC_CONST(0.011947784402191), FRAC_CONST(0.028875819432161) },
+ { FRAC_CONST(0.011859138408130), FRAC_CONST(0.028912338823015) },
+ { FRAC_CONST(0.011770380791341), FRAC_CONST(0.028948586079925) },
+ { FRAC_CONST(0.011681512387245), FRAC_CONST(0.028984560861718) },
+ { FRAC_CONST(0.011592534032306), FRAC_CONST(0.029020262829785) },
+ { FRAC_CONST(0.011503446564022), FRAC_CONST(0.029055691648087) },
+ { FRAC_CONST(0.011414250820918), FRAC_CONST(0.029090846983152) },
+ { FRAC_CONST(0.011324947642537), FRAC_CONST(0.029125728504087) },
+ { FRAC_CONST(0.011235537869437), FRAC_CONST(0.029160335882573) },
+ { FRAC_CONST(0.011146022343175), FRAC_CONST(0.029194668792871) },
+ { FRAC_CONST(0.011056401906305), FRAC_CONST(0.029228726911828) },
+ { FRAC_CONST(0.010966677402371), FRAC_CONST(0.029262509918876) },
+ { FRAC_CONST(0.010876849675891), FRAC_CONST(0.029296017496036) },
+ { FRAC_CONST(0.010786919572361), FRAC_CONST(0.029329249327922) },
+ { FRAC_CONST(0.010696887938235), FRAC_CONST(0.029362205101743) },
+ { FRAC_CONST(0.010606755620926), FRAC_CONST(0.029394884507308) },
+ { FRAC_CONST(0.010516523468793), FRAC_CONST(0.029427287237024) },
+ { FRAC_CONST(0.010426192331137), FRAC_CONST(0.029459412985906) },
+ { FRAC_CONST(0.010335763058187), FRAC_CONST(0.029491261451573) },
+ { FRAC_CONST(0.010245236501099), FRAC_CONST(0.029522832334255) },
+ { FRAC_CONST(0.010154613511943), FRAC_CONST(0.029554125336796) },
+ { FRAC_CONST(0.010063894943698), FRAC_CONST(0.029585140164654) },
+ { FRAC_CONST(0.009973081650240), FRAC_CONST(0.029615876525905) },
+ { FRAC_CONST(0.009882174486340), FRAC_CONST(0.029646334131247) },
+ { FRAC_CONST(0.009791174307650), FRAC_CONST(0.029676512694001) },
+ { FRAC_CONST(0.009700081970699), FRAC_CONST(0.029706411930116) },
+ { FRAC_CONST(0.009608898332881), FRAC_CONST(0.029736031558168) },
+ { FRAC_CONST(0.009517624252453), FRAC_CONST(0.029765371299366) },
+ { FRAC_CONST(0.009426260588521), FRAC_CONST(0.029794430877553) },
+ { FRAC_CONST(0.009334808201034), FRAC_CONST(0.029823210019210) },
+ { FRAC_CONST(0.009243267950778), FRAC_CONST(0.029851708453456) },
+ { FRAC_CONST(0.009151640699363), FRAC_CONST(0.029879925912053) },
+ { FRAC_CONST(0.009059927309220), FRAC_CONST(0.029907862129408) },
+ { FRAC_CONST(0.008968128643591), FRAC_CONST(0.029935516842573) },
+ { FRAC_CONST(0.008876245566520), FRAC_CONST(0.029962889791254) },
+ { FRAC_CONST(0.008784278942845), FRAC_CONST(0.029989980717805) },
+ { FRAC_CONST(0.008692229638191), FRAC_CONST(0.030016789367235) },
+ { FRAC_CONST(0.008600098518961), FRAC_CONST(0.030043315487212) },
+ { FRAC_CONST(0.008507886452329), FRAC_CONST(0.030069558828062) },
+ { FRAC_CONST(0.008415594306230), FRAC_CONST(0.030095519142772) },
+ { FRAC_CONST(0.008323222949351), FRAC_CONST(0.030121196186994) },
+ { FRAC_CONST(0.008230773251129), FRAC_CONST(0.030146589719046) },
+ { FRAC_CONST(0.008138246081733), FRAC_CONST(0.030171699499915) },
+ { FRAC_CONST(0.008045642312067), FRAC_CONST(0.030196525293257) },
+ { FRAC_CONST(0.007952962813750), FRAC_CONST(0.030221066865402) },
+ { FRAC_CONST(0.007860208459119), FRAC_CONST(0.030245323985357) },
+ { FRAC_CONST(0.007767380121212), FRAC_CONST(0.030269296424803) },
+ { FRAC_CONST(0.007674478673766), FRAC_CONST(0.030292983958103) },
+ { FRAC_CONST(0.007581504991203), FRAC_CONST(0.030316386362302) },
+ { FRAC_CONST(0.007488459948628), FRAC_CONST(0.030339503417126) },
+ { FRAC_CONST(0.007395344421816), FRAC_CONST(0.030362334904989) },
+ { FRAC_CONST(0.007302159287206), FRAC_CONST(0.030384880610993) },
+ { FRAC_CONST(0.007208905421891), FRAC_CONST(0.030407140322928) },
+ { FRAC_CONST(0.007115583703613), FRAC_CONST(0.030429113831278) },
+ { FRAC_CONST(0.007022195010752), FRAC_CONST(0.030450800929220) },
+ { FRAC_CONST(0.006928740222316), FRAC_CONST(0.030472201412626) },
+ { FRAC_CONST(0.006835220217939), FRAC_CONST(0.030493315080068) },
+ { FRAC_CONST(0.006741635877866), FRAC_CONST(0.030514141732814) },
+ { FRAC_CONST(0.006647988082948), FRAC_CONST(0.030534681174838) },
+ { FRAC_CONST(0.006554277714635), FRAC_CONST(0.030554933212813) },
+ { FRAC_CONST(0.006460505654964), FRAC_CONST(0.030574897656119) },
+ { FRAC_CONST(0.006366672786553), FRAC_CONST(0.030594574316845) },
+ { FRAC_CONST(0.006272779992593), FRAC_CONST(0.030613963009786) },
+ { FRAC_CONST(0.006178828156839), FRAC_CONST(0.030633063552447) },
+ { FRAC_CONST(0.006084818163601), FRAC_CONST(0.030651875765048) },
+ { FRAC_CONST(0.005990750897737), FRAC_CONST(0.030670399470520) },
+ { FRAC_CONST(0.005896627244644), FRAC_CONST(0.030688634494512) },
+ { FRAC_CONST(0.005802448090250), FRAC_CONST(0.030706580665388) },
+ { FRAC_CONST(0.005708214321004), FRAC_CONST(0.030724237814232) },
+ { FRAC_CONST(0.005613926823871), FRAC_CONST(0.030741605774849) },
+ { FRAC_CONST(0.005519586486321), FRAC_CONST(0.030758684383764) },
+ { FRAC_CONST(0.005425194196321), FRAC_CONST(0.030775473480228) },
+ { FRAC_CONST(0.005330750842327), FRAC_CONST(0.030791972906214) },
+ { FRAC_CONST(0.005236257313276), FRAC_CONST(0.030808182506425) },
+ { FRAC_CONST(0.005141714498576), FRAC_CONST(0.030824102128288) },
+ { FRAC_CONST(0.005047123288102), FRAC_CONST(0.030839731621963) },
+ { FRAC_CONST(0.004952484572181), FRAC_CONST(0.030855070840339) },
+ { FRAC_CONST(0.004857799241589), FRAC_CONST(0.030870119639036) },
+ { FRAC_CONST(0.004763068187541), FRAC_CONST(0.030884877876411) },
+ { FRAC_CONST(0.004668292301681), FRAC_CONST(0.030899345413553) },
+ { FRAC_CONST(0.004573472476075), FRAC_CONST(0.030913522114288) },
+ { FRAC_CONST(0.004478609603205), FRAC_CONST(0.030927407845180) },
+ { FRAC_CONST(0.004383704575956), FRAC_CONST(0.030941002475530) },
+ { FRAC_CONST(0.004288758287610), FRAC_CONST(0.030954305877381) },
+ { FRAC_CONST(0.004193771631837), FRAC_CONST(0.030967317925516) },
+ { FRAC_CONST(0.004098745502689), FRAC_CONST(0.030980038497461) },
+ { FRAC_CONST(0.004003680794587), FRAC_CONST(0.030992467473486) },
+ { FRAC_CONST(0.003908578402316), FRAC_CONST(0.031004604736602) },
+ { FRAC_CONST(0.003813439221017), FRAC_CONST(0.031016450172571) },
+ { FRAC_CONST(0.003718264146176), FRAC_CONST(0.031028003669899) },
+ { FRAC_CONST(0.003623054073616), FRAC_CONST(0.031039265119839) },
+ { FRAC_CONST(0.003527809899492), FRAC_CONST(0.031050234416394) },
+ { FRAC_CONST(0.003432532520278), FRAC_CONST(0.031060911456318) },
+ { FRAC_CONST(0.003337222832760), FRAC_CONST(0.031071296139114) },
+ { FRAC_CONST(0.003241881734029), FRAC_CONST(0.031081388367037) },
+ { FRAC_CONST(0.003146510121474), FRAC_CONST(0.031091188045095) },
+ { FRAC_CONST(0.003051108892766), FRAC_CONST(0.031100695081051) },
+ { FRAC_CONST(0.002955678945860), FRAC_CONST(0.031109909385419) },
+ { FRAC_CONST(0.002860221178978), FRAC_CONST(0.031118830871473) },
+ { FRAC_CONST(0.002764736490604), FRAC_CONST(0.031127459455239) },
+ { FRAC_CONST(0.002669225779478), FRAC_CONST(0.031135795055501) },
+ { FRAC_CONST(0.002573689944583), FRAC_CONST(0.031143837593803) },
+ { FRAC_CONST(0.002478129885137), FRAC_CONST(0.031151586994444) },
+ { FRAC_CONST(0.002382546500589), FRAC_CONST(0.031159043184484) },
+ { FRAC_CONST(0.002286940690606), FRAC_CONST(0.031166206093743) },
+ { FRAC_CONST(0.002191313355067), FRAC_CONST(0.031173075654800) },
+ { FRAC_CONST(0.002095665394051), FRAC_CONST(0.031179651802998) },
+ { FRAC_CONST(0.001999997707835), FRAC_CONST(0.031185934476438) },
+ { FRAC_CONST(0.001904311196878), FRAC_CONST(0.031191923615985) },
+ { FRAC_CONST(0.001808606761820), FRAC_CONST(0.031197619165268) },
+ { FRAC_CONST(0.001712885303465), FRAC_CONST(0.031203021070678) },
+ { FRAC_CONST(0.001617147722782), FRAC_CONST(0.031208129281370) },
+ { FRAC_CONST(0.001521394920889), FRAC_CONST(0.031212943749264) },
+ { FRAC_CONST(0.001425627799047), FRAC_CONST(0.031217464429043) },
+ { FRAC_CONST(0.001329847258653), FRAC_CONST(0.031221691278159) },
+ { FRAC_CONST(0.001234054201231), FRAC_CONST(0.031225624256825) },
+ { FRAC_CONST(0.001138249528420), FRAC_CONST(0.031229263328024) },
+ { FRAC_CONST(0.001042434141971), FRAC_CONST(0.031232608457502) },
+ { FRAC_CONST(0.000946608943736), FRAC_CONST(0.031235659613775) },
+ { FRAC_CONST(0.000850774835656), FRAC_CONST(0.031238416768124) },
+ { FRAC_CONST(0.000754932719759), FRAC_CONST(0.031240879894597) },
+ { FRAC_CONST(0.000659083498149), FRAC_CONST(0.031243048970010) },
+ { FRAC_CONST(0.000563228072993), FRAC_CONST(0.031244923973948) },
+ { FRAC_CONST(0.000467367346520), FRAC_CONST(0.031246504888762) },
+ { FRAC_CONST(0.000371502221008), FRAC_CONST(0.031247791699571) },
+ { FRAC_CONST(0.000275633598775), FRAC_CONST(0.031248784394264) },
+ { FRAC_CONST(0.000179762382174), FRAC_CONST(0.031249482963498) },
+ { FRAC_CONST(0.000083889473581), FRAC_CONST(0.031249887400697) }
+};
- /* 64 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_256[] =
- {
- { FRAC_CONST(0.088387931675923), FRAC_CONST(0.000271171628935) },
- { FRAC_CONST(0.088354655998507), FRAC_CONST(0.002440238387037) },
- { FRAC_CONST(0.088268158780110), FRAC_CONST(0.004607835236780) },
- { FRAC_CONST(0.088128492123423), FRAC_CONST(0.006772656498875) },
- { FRAC_CONST(0.087935740158418), FRAC_CONST(0.008933398165942) },
- { FRAC_CONST(0.087690018991670), FRAC_CONST(0.011088758687994) },
- { FRAC_CONST(0.087391476636423), FRAC_CONST(0.013237439756448) },
- { FRAC_CONST(0.087040292923427), FRAC_CONST(0.015378147086172) },
- { FRAC_CONST(0.086636679392621), FRAC_CONST(0.017509591195118) },
- { FRAC_CONST(0.086180879165703), FRAC_CONST(0.019630488181053) },
- { FRAC_CONST(0.085673166799686), FRAC_CONST(0.021739560494940) },
- { FRAC_CONST(0.085113848121515), FRAC_CONST(0.023835537710479) },
- { FRAC_CONST(0.084503260043847), FRAC_CONST(0.025917157289369) },
- { FRAC_CONST(0.083841770362110), FRAC_CONST(0.027983165341813) },
- { FRAC_CONST(0.083129777532952), FRAC_CONST(0.030032317381813) },
- { FRAC_CONST(0.082367710434230), FRAC_CONST(0.032063379076803) },
- { FRAC_CONST(0.081556028106671), FRAC_CONST(0.034075126991164) },
- { FRAC_CONST(0.080695219477356), FRAC_CONST(0.036066349323177) },
- { FRAC_CONST(0.079785803065216), FRAC_CONST(0.038035846634965) },
- { FRAC_CONST(0.078828326668693), FRAC_CONST(0.039982432574992) },
- { FRAC_CONST(0.077823367035766), FRAC_CONST(0.041904934592675) },
- { FRAC_CONST(0.076771529516540), FRAC_CONST(0.043802194644686) },
- { FRAC_CONST(0.075673447698606), FRAC_CONST(0.045673069892513) },
- { FRAC_CONST(0.074529783025390), FRAC_CONST(0.047516433390863) },
- { FRAC_CONST(0.073341224397728), FRAC_CONST(0.049331174766491) },
- { FRAC_CONST(0.072108487758894), FRAC_CONST(0.051116200887052) },
- { FRAC_CONST(0.070832315663343), FRAC_CONST(0.052870436519557) },
- { FRAC_CONST(0.069513476829429), FRAC_CONST(0.054592824978055) },
- { FRAC_CONST(0.068152765676348), FRAC_CONST(0.056282328760143) },
- { FRAC_CONST(0.066751001845620), FRAC_CONST(0.057937930171918) },
- { FRAC_CONST(0.065309029707361), FRAC_CONST(0.059558631940996) },
- { FRAC_CONST(0.063827717851668), FRAC_CONST(0.061143457817234) },
- { FRAC_CONST(0.062307958565413), FRAC_CONST(0.062691453160784) },
- { FRAC_CONST(0.060750667294763), FRAC_CONST(0.064201685517134) },
- { FRAC_CONST(0.059156782093749), FRAC_CONST(0.065673245178784) },
- { FRAC_CONST(0.057527263059216), FRAC_CONST(0.067105245733220) },
- { FRAC_CONST(0.055863091752499), FRAC_CONST(0.068496824596852) },
- { FRAC_CONST(0.054165270608165), FRAC_CONST(0.069847143534609) },
- { FRAC_CONST(0.052434822330188), FRAC_CONST(0.071155389164853) },
- { FRAC_CONST(0.050672789275903), FRAC_CONST(0.072420773449336) },
- { FRAC_CONST(0.048880232828135), FRAC_CONST(0.073642534167879) },
- { FRAC_CONST(0.047058232755862), FRAC_CONST(0.074819935377512) },
- { FRAC_CONST(0.045207886563797), FRAC_CONST(0.075952267855771) },
- { FRAC_CONST(0.043330308831298), FRAC_CONST(0.077038849527912) },
- { FRAC_CONST(0.041426630540984), FRAC_CONST(0.078079025877766) },
- { FRAC_CONST(0.039497998397473), FRAC_CONST(0.079072170341994) },
- { FRAC_CONST(0.037545574136653), FRAC_CONST(0.080017684687506) },
- { FRAC_CONST(0.035570533825892), FRAC_CONST(0.080914999371817) },
- { FRAC_CONST(0.033574067155622), FRAC_CONST(0.081763573886112) },
- { FRAC_CONST(0.031557376722714), FRAC_CONST(0.082562897080836) },
- { FRAC_CONST(0.029521677306074), FRAC_CONST(0.083312487473584) },
- { FRAC_CONST(0.027468195134911), FRAC_CONST(0.084011893539132) },
- { FRAC_CONST(0.025398167150101), FRAC_CONST(0.084660693981419) },
- { FRAC_CONST(0.023312840259098), FRAC_CONST(0.085258497987320) },
- { FRAC_CONST(0.021213470584847), FRAC_CONST(0.085804945462053) },
- { FRAC_CONST(0.019101322709138), FRAC_CONST(0.086299707246093) },
- { FRAC_CONST(0.016977668910873), FRAC_CONST(0.086742485313442) },
- { FRAC_CONST(0.014843788399692), FRAC_CONST(0.087133012951149) },
- { FRAC_CONST(0.012700966545425), FRAC_CONST(0.087471054919968) },
- { FRAC_CONST(0.010550494103830), FRAC_CONST(0.087756407596056) },
- { FRAC_CONST(0.008393666439096), FRAC_CONST(0.087988899093631) },
- { FRAC_CONST(0.006231782743558), FRAC_CONST(0.088168389368510) },
- { FRAC_CONST(0.004066145255116), FRAC_CONST(0.088294770302461) },
- { FRAC_CONST(0.001898058472816), FRAC_CONST(0.088367965768336) }
- };
+/* 64 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_256[] =
+{
+ { FRAC_CONST(0.088387931675923), FRAC_CONST(0.000271171628935) },
+ { FRAC_CONST(0.088354655998507), FRAC_CONST(0.002440238387037) },
+ { FRAC_CONST(0.088268158780110), FRAC_CONST(0.004607835236780) },
+ { FRAC_CONST(0.088128492123423), FRAC_CONST(0.006772656498875) },
+ { FRAC_CONST(0.087935740158418), FRAC_CONST(0.008933398165942) },
+ { FRAC_CONST(0.087690018991670), FRAC_CONST(0.011088758687994) },
+ { FRAC_CONST(0.087391476636423), FRAC_CONST(0.013237439756448) },
+ { FRAC_CONST(0.087040292923427), FRAC_CONST(0.015378147086172) },
+ { FRAC_CONST(0.086636679392621), FRAC_CONST(0.017509591195118) },
+ { FRAC_CONST(0.086180879165703), FRAC_CONST(0.019630488181053) },
+ { FRAC_CONST(0.085673166799686), FRAC_CONST(0.021739560494940) },
+ { FRAC_CONST(0.085113848121515), FRAC_CONST(0.023835537710479) },
+ { FRAC_CONST(0.084503260043847), FRAC_CONST(0.025917157289369) },
+ { FRAC_CONST(0.083841770362110), FRAC_CONST(0.027983165341813) },
+ { FRAC_CONST(0.083129777532952), FRAC_CONST(0.030032317381813) },
+ { FRAC_CONST(0.082367710434230), FRAC_CONST(0.032063379076803) },
+ { FRAC_CONST(0.081556028106671), FRAC_CONST(0.034075126991164) },
+ { FRAC_CONST(0.080695219477356), FRAC_CONST(0.036066349323177) },
+ { FRAC_CONST(0.079785803065216), FRAC_CONST(0.038035846634965) },
+ { FRAC_CONST(0.078828326668693), FRAC_CONST(0.039982432574992) },
+ { FRAC_CONST(0.077823367035766), FRAC_CONST(0.041904934592675) },
+ { FRAC_CONST(0.076771529516540), FRAC_CONST(0.043802194644686) },
+ { FRAC_CONST(0.075673447698606), FRAC_CONST(0.045673069892513) },
+ { FRAC_CONST(0.074529783025390), FRAC_CONST(0.047516433390863) },
+ { FRAC_CONST(0.073341224397728), FRAC_CONST(0.049331174766491) },
+ { FRAC_CONST(0.072108487758894), FRAC_CONST(0.051116200887052) },
+ { FRAC_CONST(0.070832315663343), FRAC_CONST(0.052870436519557) },
+ { FRAC_CONST(0.069513476829429), FRAC_CONST(0.054592824978055) },
+ { FRAC_CONST(0.068152765676348), FRAC_CONST(0.056282328760143) },
+ { FRAC_CONST(0.066751001845620), FRAC_CONST(0.057937930171918) },
+ { FRAC_CONST(0.065309029707361), FRAC_CONST(0.059558631940996) },
+ { FRAC_CONST(0.063827717851668), FRAC_CONST(0.061143457817234) },
+ { FRAC_CONST(0.062307958565413), FRAC_CONST(0.062691453160784) },
+ { FRAC_CONST(0.060750667294763), FRAC_CONST(0.064201685517134) },
+ { FRAC_CONST(0.059156782093749), FRAC_CONST(0.065673245178784) },
+ { FRAC_CONST(0.057527263059216), FRAC_CONST(0.067105245733220) },
+ { FRAC_CONST(0.055863091752499), FRAC_CONST(0.068496824596852) },
+ { FRAC_CONST(0.054165270608165), FRAC_CONST(0.069847143534609) },
+ { FRAC_CONST(0.052434822330188), FRAC_CONST(0.071155389164853) },
+ { FRAC_CONST(0.050672789275903), FRAC_CONST(0.072420773449336) },
+ { FRAC_CONST(0.048880232828135), FRAC_CONST(0.073642534167879) },
+ { FRAC_CONST(0.047058232755862), FRAC_CONST(0.074819935377512) },
+ { FRAC_CONST(0.045207886563797), FRAC_CONST(0.075952267855771) },
+ { FRAC_CONST(0.043330308831298), FRAC_CONST(0.077038849527912) },
+ { FRAC_CONST(0.041426630540984), FRAC_CONST(0.078079025877766) },
+ { FRAC_CONST(0.039497998397473), FRAC_CONST(0.079072170341994) },
+ { FRAC_CONST(0.037545574136653), FRAC_CONST(0.080017684687506) },
+ { FRAC_CONST(0.035570533825892), FRAC_CONST(0.080914999371817) },
+ { FRAC_CONST(0.033574067155622), FRAC_CONST(0.081763573886112) },
+ { FRAC_CONST(0.031557376722714), FRAC_CONST(0.082562897080836) },
+ { FRAC_CONST(0.029521677306074), FRAC_CONST(0.083312487473584) },
+ { FRAC_CONST(0.027468195134911), FRAC_CONST(0.084011893539132) },
+ { FRAC_CONST(0.025398167150101), FRAC_CONST(0.084660693981419) },
+ { FRAC_CONST(0.023312840259098), FRAC_CONST(0.085258497987320) },
+ { FRAC_CONST(0.021213470584847), FRAC_CONST(0.085804945462053) },
+ { FRAC_CONST(0.019101322709138), FRAC_CONST(0.086299707246093) },
+ { FRAC_CONST(0.016977668910873), FRAC_CONST(0.086742485313442) },
+ { FRAC_CONST(0.014843788399692), FRAC_CONST(0.087133012951149) },
+ { FRAC_CONST(0.012700966545425), FRAC_CONST(0.087471054919968) },
+ { FRAC_CONST(0.010550494103830), FRAC_CONST(0.087756407596056) },
+ { FRAC_CONST(0.008393666439096), FRAC_CONST(0.087988899093631) },
+ { FRAC_CONST(0.006231782743558), FRAC_CONST(0.088168389368510) },
+ { FRAC_CONST(0.004066145255116), FRAC_CONST(0.088294770302461) },
+ { FRAC_CONST(0.001898058472816), FRAC_CONST(0.088367965768336) }
+};
#ifdef LD_DEC
- /* 128 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_1024[] =
- {
- { FRAC_CONST(0.044194160825012), FRAC_CONST(0.000033896503468) },
- { FRAC_CONST(0.044193120897389), FRAC_CONST(0.000305066138364) },
- { FRAC_CONST(0.044190417123742), FRAC_CONST(0.000576224287693) },
- { FRAC_CONST(0.044186049605866), FRAC_CONST(0.000847360742503) },
- { FRAC_CONST(0.044180018508197), FRAC_CONST(0.001118465294660) },
- { FRAC_CONST(0.044172324057802), FRAC_CONST(0.001389527737231) },
- { FRAC_CONST(0.044162966544372), FRAC_CONST(0.001660537864867) },
- { FRAC_CONST(0.044151946320213), FRAC_CONST(0.001931485474192) },
- { FRAC_CONST(0.044139263800230), FRAC_CONST(0.002202360364180) },
- { FRAC_CONST(0.044124919461912), FRAC_CONST(0.002473152336546) },
- { FRAC_CONST(0.044108913845316), FRAC_CONST(0.002743851196123) },
- { FRAC_CONST(0.044091247553044), FRAC_CONST(0.003014446751254) },
- { FRAC_CONST(0.044071921250223), FRAC_CONST(0.003284928814169) },
- { FRAC_CONST(0.044050935664476), FRAC_CONST(0.003555287201370) },
- { FRAC_CONST(0.044028291585898), FRAC_CONST(0.003825511734018) },
- { FRAC_CONST(0.044003989867028), FRAC_CONST(0.004095592238311) },
- { FRAC_CONST(0.043978031422810), FRAC_CONST(0.004365518545871) },
- { FRAC_CONST(0.043950417230565), FRAC_CONST(0.004635280494126) },
- { FRAC_CONST(0.043921148329953), FRAC_CONST(0.004904867926689) },
- { FRAC_CONST(0.043890225822930), FRAC_CONST(0.005174270693748) },
- { FRAC_CONST(0.043857650873712), FRAC_CONST(0.005443478652439) },
- { FRAC_CONST(0.043823424708727), FRAC_CONST(0.005712481667236) },
- { FRAC_CONST(0.043787548616571), FRAC_CONST(0.005981269610326) },
- { FRAC_CONST(0.043750023947958), FRAC_CONST(0.006249832361997) },
- { FRAC_CONST(0.043710852115672), FRAC_CONST(0.006518159811011) },
- { FRAC_CONST(0.043670034594508), FRAC_CONST(0.006786241854993) },
- { FRAC_CONST(0.043627572921225), FRAC_CONST(0.007054068400804) },
- { FRAC_CONST(0.043583468694479), FRAC_CONST(0.007321629364927) },
- { FRAC_CONST(0.043537723574771), FRAC_CONST(0.007588914673843) },
- { FRAC_CONST(0.043490339284377), FRAC_CONST(0.007855914264410) },
- { FRAC_CONST(0.043441317607290), FRAC_CONST(0.008122618084246) },
- { FRAC_CONST(0.043390660389149), FRAC_CONST(0.008389016092101) },
- { FRAC_CONST(0.043338369537168), FRAC_CONST(0.008655098258243) },
- { FRAC_CONST(0.043284447020070), FRAC_CONST(0.008920854564826) },
- { FRAC_CONST(0.043228894868005), FRAC_CONST(0.009186275006278) },
- { FRAC_CONST(0.043171715172482), FRAC_CONST(0.009451349589667) },
- { FRAC_CONST(0.043112910086283), FRAC_CONST(0.009716068335087) },
- { FRAC_CONST(0.043052481823387), FRAC_CONST(0.009980421276025) },
- { FRAC_CONST(0.042990432658884), FRAC_CONST(0.010244398459743) },
- { FRAC_CONST(0.042926764928889), FRAC_CONST(0.010507989947649) },
- { FRAC_CONST(0.042861481030457), FRAC_CONST(0.010771185815673) },
- { FRAC_CONST(0.042794583421490), FRAC_CONST(0.011033976154639) },
- { FRAC_CONST(0.042726074620644), FRAC_CONST(0.011296351070639) },
- { FRAC_CONST(0.042655957207238), FRAC_CONST(0.011558300685406) },
- { FRAC_CONST(0.042584233821153), FRAC_CONST(0.011819815136685) },
- { FRAC_CONST(0.042510907162732), FRAC_CONST(0.012080884578604) },
- { FRAC_CONST(0.042435979992684), FRAC_CONST(0.012341499182048) },
- { FRAC_CONST(0.042359455131975), FRAC_CONST(0.012601649135022) },
- { FRAC_CONST(0.042281335461721), FRAC_CONST(0.012861324643029) },
- { FRAC_CONST(0.042201623923085), FRAC_CONST(0.013120515929433) },
- { FRAC_CONST(0.042120323517160), FRAC_CONST(0.013379213235827) },
- { FRAC_CONST(0.042037437304862), FRAC_CONST(0.013637406822406) },
- { FRAC_CONST(0.041952968406809), FRAC_CONST(0.013895086968325) },
- { FRAC_CONST(0.041866920003207), FRAC_CONST(0.014152243972073) },
- { FRAC_CONST(0.041779295333730), FRAC_CONST(0.014408868151835) },
- { FRAC_CONST(0.041690097697398), FRAC_CONST(0.014664949845855) },
- { FRAC_CONST(0.041599330452450), FRAC_CONST(0.014920479412801) },
- { FRAC_CONST(0.041506997016224), FRAC_CONST(0.015175447232131) },
- { FRAC_CONST(0.041413100865019), FRAC_CONST(0.015429843704450) },
- { FRAC_CONST(0.041317645533974), FRAC_CONST(0.015683659251874) },
- { FRAC_CONST(0.041220634616927), FRAC_CONST(0.015936884318392) },
- { FRAC_CONST(0.041122071766285), FRAC_CONST(0.016189509370223) },
- { FRAC_CONST(0.041021960692883), FRAC_CONST(0.016441524896177) },
- { FRAC_CONST(0.040920305165846), FRAC_CONST(0.016692921408010) },
- { FRAC_CONST(0.040817109012449), FRAC_CONST(0.016943689440788) },
- { FRAC_CONST(0.040712376117967), FRAC_CONST(0.017193819553235) },
- { FRAC_CONST(0.040606110425535), FRAC_CONST(0.017443302328094) },
- { FRAC_CONST(0.040498315935996), FRAC_CONST(0.017692128372479) },
- { FRAC_CONST(0.040388996707752), FRAC_CONST(0.017940288318230) },
- { FRAC_CONST(0.040278156856609), FRAC_CONST(0.018187772822267) },
- { FRAC_CONST(0.040165800555627), FRAC_CONST(0.018434572566936) },
- { FRAC_CONST(0.040051932034955), FRAC_CONST(0.018680678260367) },
- { FRAC_CONST(0.039936555581679), FRAC_CONST(0.018926080636820) },
- { FRAC_CONST(0.039819675539659), FRAC_CONST(0.019170770457035) },
- { FRAC_CONST(0.039701296309360), FRAC_CONST(0.019414738508577) },
- { FRAC_CONST(0.039581422347694), FRAC_CONST(0.019657975606187) },
- { FRAC_CONST(0.039460058167849), FRAC_CONST(0.019900472592126) },
- { FRAC_CONST(0.039337208339116), FRAC_CONST(0.020142220336521) },
- { FRAC_CONST(0.039212877486723), FRAC_CONST(0.020383209737704) },
- { FRAC_CONST(0.039087070291656), FRAC_CONST(0.020623431722561) },
- { FRAC_CONST(0.038959791490485), FRAC_CONST(0.020862877246870) },
- { FRAC_CONST(0.038831045875184), FRAC_CONST(0.021101537295642) },
- { FRAC_CONST(0.038700838292953), FRAC_CONST(0.021339402883462) },
- { FRAC_CONST(0.038569173646034), FRAC_CONST(0.021576465054824) },
- { FRAC_CONST(0.038436056891527), FRAC_CONST(0.021812714884472) },
- { FRAC_CONST(0.038301493041202), FRAC_CONST(0.022048143477734) },
- { FRAC_CONST(0.038165487161312), FRAC_CONST(0.022282741970855) },
- { FRAC_CONST(0.038028044372402), FRAC_CONST(0.022516501531335) },
- { FRAC_CONST(0.037889169849115), FRAC_CONST(0.022749413358259) },
- { FRAC_CONST(0.037748868819998), FRAC_CONST(0.022981468682628) },
- { FRAC_CONST(0.037607146567305), FRAC_CONST(0.023212658767690) },
- { FRAC_CONST(0.037464008426800), FRAC_CONST(0.023442974909269) },
- { FRAC_CONST(0.037319459787553), FRAC_CONST(0.023672408436094) },
- { FRAC_CONST(0.037173506091737), FRAC_CONST(0.023900950710120) },
- { FRAC_CONST(0.037026152834428), FRAC_CONST(0.024128593126861) },
- { FRAC_CONST(0.036877405563392), FRAC_CONST(0.024355327115708) },
- { FRAC_CONST(0.036727269878879), FRAC_CONST(0.024581144140255) },
- { FRAC_CONST(0.036575751433414), FRAC_CONST(0.024806035698618) },
- { FRAC_CONST(0.036422855931580), FRAC_CONST(0.025029993323758) },
- { FRAC_CONST(0.036268589129807), FRAC_CONST(0.025253008583796) },
- { FRAC_CONST(0.036112956836151), FRAC_CONST(0.025475073082334) },
- { FRAC_CONST(0.035955964910083), FRAC_CONST(0.025696178458769) },
- { FRAC_CONST(0.035797619262257), FRAC_CONST(0.025916316388609) },
- { FRAC_CONST(0.035637925854300), FRAC_CONST(0.026135478583784) },
- { FRAC_CONST(0.035476890698576), FRAC_CONST(0.026353656792963) },
- { FRAC_CONST(0.035314519857970), FRAC_CONST(0.026570842801858) },
- { FRAC_CONST(0.035150819445650), FRAC_CONST(0.026787028433540) },
- { FRAC_CONST(0.034985795624846), FRAC_CONST(0.027002205548742) },
- { FRAC_CONST(0.034819454608610), FRAC_CONST(0.027216366046166) },
- { FRAC_CONST(0.034651802659589), FRAC_CONST(0.027429501862792) },
- { FRAC_CONST(0.034482846089783), FRAC_CONST(0.027641604974175) },
- { FRAC_CONST(0.034312591260311), FRAC_CONST(0.027852667394755) },
- { FRAC_CONST(0.034141044581172), FRAC_CONST(0.028062681178149) },
- { FRAC_CONST(0.033968212511001), FRAC_CONST(0.028271638417458) },
- { FRAC_CONST(0.033794101556828), FRAC_CONST(0.028479531245560) },
- { FRAC_CONST(0.033618718273831), FRAC_CONST(0.028686351835407) },
- { FRAC_CONST(0.033442069265093), FRAC_CONST(0.028892092400321) },
- { FRAC_CONST(0.033264161181349), FRAC_CONST(0.029096745194286) },
- { FRAC_CONST(0.033085000720737), FRAC_CONST(0.029300302512241) },
- { FRAC_CONST(0.032904594628548), FRAC_CONST(0.029502756690366) },
- { FRAC_CONST(0.032722949696969), FRAC_CONST(0.029704100106376) },
- { FRAC_CONST(0.032540072764829), FRAC_CONST(0.029904325179807) },
- { FRAC_CONST(0.032355970717341), FRAC_CONST(0.030103424372297) },
- { FRAC_CONST(0.032170650485843), FRAC_CONST(0.030301390187873) },
- { FRAC_CONST(0.031984119047537), FRAC_CONST(0.030498215173235) },
- { FRAC_CONST(0.031796383425227), FRAC_CONST(0.030693891918034) },
- { FRAC_CONST(0.031607450687052), FRAC_CONST(0.030888413055150) },
- { FRAC_CONST(0.031417327946223), FRAC_CONST(0.031081771260973) },
- { FRAC_CONST(0.031226022360754), FRAC_CONST(0.031273959255676) },
- { FRAC_CONST(0.031033541133193), FRAC_CONST(0.031464969803488) },
- { FRAC_CONST(0.030839891510348), FRAC_CONST(0.031654795712972) },
- { FRAC_CONST(0.030645080783018), FRAC_CONST(0.031843429837288) },
- { FRAC_CONST(0.030449116285718), FRAC_CONST(0.032030865074469) },
- { FRAC_CONST(0.030252005396399), FRAC_CONST(0.032217094367684) },
- { FRAC_CONST(0.030053755536176), FRAC_CONST(0.032402110705505) },
- { FRAC_CONST(0.029854374169043), FRAC_CONST(0.032585907122172) },
- { FRAC_CONST(0.029653868801596), FRAC_CONST(0.032768476697853) },
- { FRAC_CONST(0.029452246982750), FRAC_CONST(0.032949812558907) },
- { FRAC_CONST(0.029249516303451), FRAC_CONST(0.033129907878142) },
- { FRAC_CONST(0.029045684396395), FRAC_CONST(0.033308755875070) },
- { FRAC_CONST(0.028840758935738), FRAC_CONST(0.033486349816166) },
- { FRAC_CONST(0.028634747636808), FRAC_CONST(0.033662683015118) },
- { FRAC_CONST(0.028427658255815), FRAC_CONST(0.033837748833080) },
- { FRAC_CONST(0.028219498589555), FRAC_CONST(0.034011540678924) },
- { FRAC_CONST(0.028010276475123), FRAC_CONST(0.034184052009485) },
- { FRAC_CONST(0.027799999789613), FRAC_CONST(0.034355276329809) },
- { FRAC_CONST(0.027588676449824), FRAC_CONST(0.034525207193396) },
- { FRAC_CONST(0.027376314411959), FRAC_CONST(0.034693838202447) },
- { FRAC_CONST(0.027162921671330), FRAC_CONST(0.034861163008098) },
- { FRAC_CONST(0.026948506262053), FRAC_CONST(0.035027175310665) },
- { FRAC_CONST(0.026733076256746), FRAC_CONST(0.035191868859880) },
- { FRAC_CONST(0.026516639766228), FRAC_CONST(0.035355237455122) },
- { FRAC_CONST(0.026299204939210), FRAC_CONST(0.035517274945657) },
- { FRAC_CONST(0.026080779961991), FRAC_CONST(0.035677975230865) },
- { FRAC_CONST(0.025861373058146), FRAC_CONST(0.035837332260471) },
- { FRAC_CONST(0.025640992488223), FRAC_CONST(0.035995340034772) },
- { FRAC_CONST(0.025419646549425), FRAC_CONST(0.036151992604866) },
- { FRAC_CONST(0.025197343575302), FRAC_CONST(0.036307284072871) },
- { FRAC_CONST(0.024974091935435), FRAC_CONST(0.036461208592152) },
- { FRAC_CONST(0.024749900035122), FRAC_CONST(0.036613760367538) },
- { FRAC_CONST(0.024524776315061), FRAC_CONST(0.036764933655540) },
- { FRAC_CONST(0.024298729251033), FRAC_CONST(0.036914722764569) },
- { FRAC_CONST(0.024071767353583), FRAC_CONST(0.037063122055150) },
- { FRAC_CONST(0.023843899167697), FRAC_CONST(0.037210125940135) },
- { FRAC_CONST(0.023615133272485), FRAC_CONST(0.037355728884908) },
- { FRAC_CONST(0.023385478280852), FRAC_CONST(0.037499925407603) },
- { FRAC_CONST(0.023154942839179), FRAC_CONST(0.037642710079302) },
- { FRAC_CONST(0.022923535626995), FRAC_CONST(0.037784077524241) },
- { FRAC_CONST(0.022691265356652), FRAC_CONST(0.037924022420018) },
- { FRAC_CONST(0.022458140772993), FRAC_CONST(0.038062539497785) },
- { FRAC_CONST(0.022224170653027), FRAC_CONST(0.038199623542453) },
- { FRAC_CONST(0.021989363805598), FRAC_CONST(0.038335269392885) },
- { FRAC_CONST(0.021753729071049), FRAC_CONST(0.038469471942092) },
- { FRAC_CONST(0.021517275320897), FRAC_CONST(0.038602226137423) },
- { FRAC_CONST(0.021280011457490), FRAC_CONST(0.038733526980758) },
- { FRAC_CONST(0.021041946413679), FRAC_CONST(0.038863369528695) },
- { FRAC_CONST(0.020803089152479), FRAC_CONST(0.038991748892734) },
- { FRAC_CONST(0.020563448666730), FRAC_CONST(0.039118660239466) },
- { FRAC_CONST(0.020323033978761), FRAC_CONST(0.039244098790750) },
- { FRAC_CONST(0.020081854140050), FRAC_CONST(0.039368059823895) },
- { FRAC_CONST(0.019839918230880), FRAC_CONST(0.039490538671839) },
- { FRAC_CONST(0.019597235360003), FRAC_CONST(0.039611530723322) },
- { FRAC_CONST(0.019353814664291), FRAC_CONST(0.039731031423061) },
- { FRAC_CONST(0.019109665308395), FRAC_CONST(0.039849036271924) },
- { FRAC_CONST(0.018864796484402), FRAC_CONST(0.039965540827094) },
- { FRAC_CONST(0.018619217411483), FRAC_CONST(0.040080540702240) },
- { FRAC_CONST(0.018372937335552), FRAC_CONST(0.040194031567683) },
- { FRAC_CONST(0.018125965528915), FRAC_CONST(0.040306009150554) },
- { FRAC_CONST(0.017878311289921), FRAC_CONST(0.040416469234963) },
- { FRAC_CONST(0.017629983942612), FRAC_CONST(0.040525407662148) },
- { FRAC_CONST(0.017380992836371), FRAC_CONST(0.040632820330639) },
- { FRAC_CONST(0.017131347345575), FRAC_CONST(0.040738703196411) },
- { FRAC_CONST(0.016881056869233), FRAC_CONST(0.040843052273033) },
- { FRAC_CONST(0.016630130830641), FRAC_CONST(0.040945863631822) },
- { FRAC_CONST(0.016378578677023), FRAC_CONST(0.041047133401988) },
- { FRAC_CONST(0.016126409879175), FRAC_CONST(0.041146857770781) },
- { FRAC_CONST(0.015873633931110), FRAC_CONST(0.041245032983635) },
- { FRAC_CONST(0.015620260349699), FRAC_CONST(0.041341655344309) },
- { FRAC_CONST(0.015366298674314), FRAC_CONST(0.041436721215026) },
- { FRAC_CONST(0.015111758466470), FRAC_CONST(0.041530227016609) },
- { FRAC_CONST(0.014856649309460), FRAC_CONST(0.041622169228618) },
- { FRAC_CONST(0.014600980808001), FRAC_CONST(0.041712544389481) },
- { FRAC_CONST(0.014344762587867), FRAC_CONST(0.041801349096623) },
- { FRAC_CONST(0.014088004295529), FRAC_CONST(0.041888580006598) },
- { FRAC_CONST(0.013830715597792), FRAC_CONST(0.041974233835211) },
- { FRAC_CONST(0.013572906181430), FRAC_CONST(0.042058307357645) },
- { FRAC_CONST(0.013314585752822), FRAC_CONST(0.042140797408577) },
- { FRAC_CONST(0.013055764037585), FRAC_CONST(0.042221700882306) },
- { FRAC_CONST(0.012796450780212), FRAC_CONST(0.042301014732860) },
- { FRAC_CONST(0.012536655743699), FRAC_CONST(0.042378735974118) },
- { FRAC_CONST(0.012276388709183), FRAC_CONST(0.042454861679919) },
- { FRAC_CONST(0.012015659475571), FRAC_CONST(0.042529388984173) },
- { FRAC_CONST(0.011754477859172), FRAC_CONST(0.042602315080970) },
- { FRAC_CONST(0.011492853693324), FRAC_CONST(0.042673637224683) },
- { FRAC_CONST(0.011230796828031), FRAC_CONST(0.042743352730074) },
- { FRAC_CONST(0.010968317129584), FRAC_CONST(0.042811458972393) },
- { FRAC_CONST(0.010705424480197), FRAC_CONST(0.042877953387479) },
- { FRAC_CONST(0.010442128777629), FRAC_CONST(0.042942833471854) },
- { FRAC_CONST(0.010178439934815), FRAC_CONST(0.043006096782821) },
- { FRAC_CONST(0.009914367879490), FRAC_CONST(0.043067740938551) },
- { FRAC_CONST(0.009649922553818), FRAC_CONST(0.043127763618177) },
- { FRAC_CONST(0.009385113914016), FRAC_CONST(0.043186162561878) },
- { FRAC_CONST(0.009119951929979), FRAC_CONST(0.043242935570968) },
- { FRAC_CONST(0.008854446584907), FRAC_CONST(0.043298080507974) },
- { FRAC_CONST(0.008588607874926), FRAC_CONST(0.043351595296722) },
- { FRAC_CONST(0.008322445808712), FRAC_CONST(0.043403477922409) },
- { FRAC_CONST(0.008055970407118), FRAC_CONST(0.043453726431684) },
- { FRAC_CONST(0.007789191702791), FRAC_CONST(0.043502338932719) },
- { FRAC_CONST(0.007522119739798), FRAC_CONST(0.043549313595281) },
- { FRAC_CONST(0.007254764573250), FRAC_CONST(0.043594648650800) },
- { FRAC_CONST(0.006987136268915), FRAC_CONST(0.043638342392438) },
- { FRAC_CONST(0.006719244902849), FRAC_CONST(0.043680393175148) },
- { FRAC_CONST(0.006451100561010), FRAC_CONST(0.043720799415744) },
- { FRAC_CONST(0.006182713338881), FRAC_CONST(0.043759559592953) },
- { FRAC_CONST(0.005914093341090), FRAC_CONST(0.043796672247476) },
- { FRAC_CONST(0.005645250681027), FRAC_CONST(0.043832135982044) },
- { FRAC_CONST(0.005376195480466), FRAC_CONST(0.043865949461465) },
- { FRAC_CONST(0.005106937869184), FRAC_CONST(0.043898111412683) },
- { FRAC_CONST(0.004837487984578), FRAC_CONST(0.043928620624817) },
- { FRAC_CONST(0.004567855971284), FRAC_CONST(0.043957475949213) },
- { FRAC_CONST(0.004298051980793), FRAC_CONST(0.043984676299484) },
- { FRAC_CONST(0.004028086171076), FRAC_CONST(0.044010220651553) },
- { FRAC_CONST(0.003757968706190), FRAC_CONST(0.044034108043689) },
- { FRAC_CONST(0.003487709755907), FRAC_CONST(0.044056337576546) },
- { FRAC_CONST(0.003217319495322), FRAC_CONST(0.044076908413193) },
- { FRAC_CONST(0.002946808104477), FRAC_CONST(0.044095819779151) },
- { FRAC_CONST(0.002676185767973), FRAC_CONST(0.044113070962418) },
- { FRAC_CONST(0.002405462674586), FRAC_CONST(0.044128661313495) },
- { FRAC_CONST(0.002134649016890), FRAC_CONST(0.044142590245416) },
- { FRAC_CONST(0.001863754990865), FRAC_CONST(0.044154857233763) },
- { FRAC_CONST(0.001592790795518), FRAC_CONST(0.044165461816692) },
- { FRAC_CONST(0.001321766632497), FRAC_CONST(0.044174403594946) },
- { FRAC_CONST(0.001050692705710), FRAC_CONST(0.044181682231873) },
- { FRAC_CONST(0.000779579220936), FRAC_CONST(0.044187297453434) },
- { FRAC_CONST(0.000508436385446), FRAC_CONST(0.044191249048222) },
- { FRAC_CONST(0.000237274407613), FRAC_CONST(0.044193536867459) }
- };
+/* 128 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1024[] =
+{
+ { FRAC_CONST(0.044194160825012), FRAC_CONST(0.000033896503468) },
+ { FRAC_CONST(0.044193120897389), FRAC_CONST(0.000305066138364) },
+ { FRAC_CONST(0.044190417123742), FRAC_CONST(0.000576224287693) },
+ { FRAC_CONST(0.044186049605866), FRAC_CONST(0.000847360742503) },
+ { FRAC_CONST(0.044180018508197), FRAC_CONST(0.001118465294660) },
+ { FRAC_CONST(0.044172324057802), FRAC_CONST(0.001389527737231) },
+ { FRAC_CONST(0.044162966544372), FRAC_CONST(0.001660537864867) },
+ { FRAC_CONST(0.044151946320213), FRAC_CONST(0.001931485474192) },
+ { FRAC_CONST(0.044139263800230), FRAC_CONST(0.002202360364180) },
+ { FRAC_CONST(0.044124919461912), FRAC_CONST(0.002473152336546) },
+ { FRAC_CONST(0.044108913845316), FRAC_CONST(0.002743851196123) },
+ { FRAC_CONST(0.044091247553044), FRAC_CONST(0.003014446751254) },
+ { FRAC_CONST(0.044071921250223), FRAC_CONST(0.003284928814169) },
+ { FRAC_CONST(0.044050935664476), FRAC_CONST(0.003555287201370) },
+ { FRAC_CONST(0.044028291585898), FRAC_CONST(0.003825511734018) },
+ { FRAC_CONST(0.044003989867028), FRAC_CONST(0.004095592238311) },
+ { FRAC_CONST(0.043978031422810), FRAC_CONST(0.004365518545871) },
+ { FRAC_CONST(0.043950417230565), FRAC_CONST(0.004635280494126) },
+ { FRAC_CONST(0.043921148329953), FRAC_CONST(0.004904867926689) },
+ { FRAC_CONST(0.043890225822930), FRAC_CONST(0.005174270693748) },
+ { FRAC_CONST(0.043857650873712), FRAC_CONST(0.005443478652439) },
+ { FRAC_CONST(0.043823424708727), FRAC_CONST(0.005712481667236) },
+ { FRAC_CONST(0.043787548616571), FRAC_CONST(0.005981269610326) },
+ { FRAC_CONST(0.043750023947958), FRAC_CONST(0.006249832361997) },
+ { FRAC_CONST(0.043710852115672), FRAC_CONST(0.006518159811011) },
+ { FRAC_CONST(0.043670034594508), FRAC_CONST(0.006786241854993) },
+ { FRAC_CONST(0.043627572921225), FRAC_CONST(0.007054068400804) },
+ { FRAC_CONST(0.043583468694479), FRAC_CONST(0.007321629364927) },
+ { FRAC_CONST(0.043537723574771), FRAC_CONST(0.007588914673843) },
+ { FRAC_CONST(0.043490339284377), FRAC_CONST(0.007855914264410) },
+ { FRAC_CONST(0.043441317607290), FRAC_CONST(0.008122618084246) },
+ { FRAC_CONST(0.043390660389149), FRAC_CONST(0.008389016092101) },
+ { FRAC_CONST(0.043338369537168), FRAC_CONST(0.008655098258243) },
+ { FRAC_CONST(0.043284447020070), FRAC_CONST(0.008920854564826) },
+ { FRAC_CONST(0.043228894868005), FRAC_CONST(0.009186275006278) },
+ { FRAC_CONST(0.043171715172482), FRAC_CONST(0.009451349589667) },
+ { FRAC_CONST(0.043112910086283), FRAC_CONST(0.009716068335087) },
+ { FRAC_CONST(0.043052481823387), FRAC_CONST(0.009980421276025) },
+ { FRAC_CONST(0.042990432658884), FRAC_CONST(0.010244398459743) },
+ { FRAC_CONST(0.042926764928889), FRAC_CONST(0.010507989947649) },
+ { FRAC_CONST(0.042861481030457), FRAC_CONST(0.010771185815673) },
+ { FRAC_CONST(0.042794583421490), FRAC_CONST(0.011033976154639) },
+ { FRAC_CONST(0.042726074620644), FRAC_CONST(0.011296351070639) },
+ { FRAC_CONST(0.042655957207238), FRAC_CONST(0.011558300685406) },
+ { FRAC_CONST(0.042584233821153), FRAC_CONST(0.011819815136685) },
+ { FRAC_CONST(0.042510907162732), FRAC_CONST(0.012080884578604) },
+ { FRAC_CONST(0.042435979992684), FRAC_CONST(0.012341499182048) },
+ { FRAC_CONST(0.042359455131975), FRAC_CONST(0.012601649135022) },
+ { FRAC_CONST(0.042281335461721), FRAC_CONST(0.012861324643029) },
+ { FRAC_CONST(0.042201623923085), FRAC_CONST(0.013120515929433) },
+ { FRAC_CONST(0.042120323517160), FRAC_CONST(0.013379213235827) },
+ { FRAC_CONST(0.042037437304862), FRAC_CONST(0.013637406822406) },
+ { FRAC_CONST(0.041952968406809), FRAC_CONST(0.013895086968325) },
+ { FRAC_CONST(0.041866920003207), FRAC_CONST(0.014152243972073) },
+ { FRAC_CONST(0.041779295333730), FRAC_CONST(0.014408868151835) },
+ { FRAC_CONST(0.041690097697398), FRAC_CONST(0.014664949845855) },
+ { FRAC_CONST(0.041599330452450), FRAC_CONST(0.014920479412801) },
+ { FRAC_CONST(0.041506997016224), FRAC_CONST(0.015175447232131) },
+ { FRAC_CONST(0.041413100865019), FRAC_CONST(0.015429843704450) },
+ { FRAC_CONST(0.041317645533974), FRAC_CONST(0.015683659251874) },
+ { FRAC_CONST(0.041220634616927), FRAC_CONST(0.015936884318392) },
+ { FRAC_CONST(0.041122071766285), FRAC_CONST(0.016189509370223) },
+ { FRAC_CONST(0.041021960692883), FRAC_CONST(0.016441524896177) },
+ { FRAC_CONST(0.040920305165846), FRAC_CONST(0.016692921408010) },
+ { FRAC_CONST(0.040817109012449), FRAC_CONST(0.016943689440788) },
+ { FRAC_CONST(0.040712376117967), FRAC_CONST(0.017193819553235) },
+ { FRAC_CONST(0.040606110425535), FRAC_CONST(0.017443302328094) },
+ { FRAC_CONST(0.040498315935996), FRAC_CONST(0.017692128372479) },
+ { FRAC_CONST(0.040388996707752), FRAC_CONST(0.017940288318230) },
+ { FRAC_CONST(0.040278156856609), FRAC_CONST(0.018187772822267) },
+ { FRAC_CONST(0.040165800555627), FRAC_CONST(0.018434572566936) },
+ { FRAC_CONST(0.040051932034955), FRAC_CONST(0.018680678260367) },
+ { FRAC_CONST(0.039936555581679), FRAC_CONST(0.018926080636820) },
+ { FRAC_CONST(0.039819675539659), FRAC_CONST(0.019170770457035) },
+ { FRAC_CONST(0.039701296309360), FRAC_CONST(0.019414738508577) },
+ { FRAC_CONST(0.039581422347694), FRAC_CONST(0.019657975606187) },
+ { FRAC_CONST(0.039460058167849), FRAC_CONST(0.019900472592126) },
+ { FRAC_CONST(0.039337208339116), FRAC_CONST(0.020142220336521) },
+ { FRAC_CONST(0.039212877486723), FRAC_CONST(0.020383209737704) },
+ { FRAC_CONST(0.039087070291656), FRAC_CONST(0.020623431722561) },
+ { FRAC_CONST(0.038959791490485), FRAC_CONST(0.020862877246870) },
+ { FRAC_CONST(0.038831045875184), FRAC_CONST(0.021101537295642) },
+ { FRAC_CONST(0.038700838292953), FRAC_CONST(0.021339402883462) },
+ { FRAC_CONST(0.038569173646034), FRAC_CONST(0.021576465054824) },
+ { FRAC_CONST(0.038436056891527), FRAC_CONST(0.021812714884472) },
+ { FRAC_CONST(0.038301493041202), FRAC_CONST(0.022048143477734) },
+ { FRAC_CONST(0.038165487161312), FRAC_CONST(0.022282741970855) },
+ { FRAC_CONST(0.038028044372402), FRAC_CONST(0.022516501531335) },
+ { FRAC_CONST(0.037889169849115), FRAC_CONST(0.022749413358259) },
+ { FRAC_CONST(0.037748868819998), FRAC_CONST(0.022981468682628) },
+ { FRAC_CONST(0.037607146567305), FRAC_CONST(0.023212658767690) },
+ { FRAC_CONST(0.037464008426800), FRAC_CONST(0.023442974909269) },
+ { FRAC_CONST(0.037319459787553), FRAC_CONST(0.023672408436094) },
+ { FRAC_CONST(0.037173506091737), FRAC_CONST(0.023900950710120) },
+ { FRAC_CONST(0.037026152834428), FRAC_CONST(0.024128593126861) },
+ { FRAC_CONST(0.036877405563392), FRAC_CONST(0.024355327115708) },
+ { FRAC_CONST(0.036727269878879), FRAC_CONST(0.024581144140255) },
+ { FRAC_CONST(0.036575751433414), FRAC_CONST(0.024806035698618) },
+ { FRAC_CONST(0.036422855931580), FRAC_CONST(0.025029993323758) },
+ { FRAC_CONST(0.036268589129807), FRAC_CONST(0.025253008583796) },
+ { FRAC_CONST(0.036112956836151), FRAC_CONST(0.025475073082334) },
+ { FRAC_CONST(0.035955964910083), FRAC_CONST(0.025696178458769) },
+ { FRAC_CONST(0.035797619262257), FRAC_CONST(0.025916316388609) },
+ { FRAC_CONST(0.035637925854300), FRAC_CONST(0.026135478583784) },
+ { FRAC_CONST(0.035476890698576), FRAC_CONST(0.026353656792963) },
+ { FRAC_CONST(0.035314519857970), FRAC_CONST(0.026570842801858) },
+ { FRAC_CONST(0.035150819445650), FRAC_CONST(0.026787028433540) },
+ { FRAC_CONST(0.034985795624846), FRAC_CONST(0.027002205548742) },
+ { FRAC_CONST(0.034819454608610), FRAC_CONST(0.027216366046166) },
+ { FRAC_CONST(0.034651802659589), FRAC_CONST(0.027429501862792) },
+ { FRAC_CONST(0.034482846089783), FRAC_CONST(0.027641604974175) },
+ { FRAC_CONST(0.034312591260311), FRAC_CONST(0.027852667394755) },
+ { FRAC_CONST(0.034141044581172), FRAC_CONST(0.028062681178149) },
+ { FRAC_CONST(0.033968212511001), FRAC_CONST(0.028271638417458) },
+ { FRAC_CONST(0.033794101556828), FRAC_CONST(0.028479531245560) },
+ { FRAC_CONST(0.033618718273831), FRAC_CONST(0.028686351835407) },
+ { FRAC_CONST(0.033442069265093), FRAC_CONST(0.028892092400321) },
+ { FRAC_CONST(0.033264161181349), FRAC_CONST(0.029096745194286) },
+ { FRAC_CONST(0.033085000720737), FRAC_CONST(0.029300302512241) },
+ { FRAC_CONST(0.032904594628548), FRAC_CONST(0.029502756690366) },
+ { FRAC_CONST(0.032722949696969), FRAC_CONST(0.029704100106376) },
+ { FRAC_CONST(0.032540072764829), FRAC_CONST(0.029904325179807) },
+ { FRAC_CONST(0.032355970717341), FRAC_CONST(0.030103424372297) },
+ { FRAC_CONST(0.032170650485843), FRAC_CONST(0.030301390187873) },
+ { FRAC_CONST(0.031984119047537), FRAC_CONST(0.030498215173235) },
+ { FRAC_CONST(0.031796383425227), FRAC_CONST(0.030693891918034) },
+ { FRAC_CONST(0.031607450687052), FRAC_CONST(0.030888413055150) },
+ { FRAC_CONST(0.031417327946223), FRAC_CONST(0.031081771260973) },
+ { FRAC_CONST(0.031226022360754), FRAC_CONST(0.031273959255676) },
+ { FRAC_CONST(0.031033541133193), FRAC_CONST(0.031464969803488) },
+ { FRAC_CONST(0.030839891510348), FRAC_CONST(0.031654795712972) },
+ { FRAC_CONST(0.030645080783018), FRAC_CONST(0.031843429837288) },
+ { FRAC_CONST(0.030449116285718), FRAC_CONST(0.032030865074469) },
+ { FRAC_CONST(0.030252005396399), FRAC_CONST(0.032217094367684) },
+ { FRAC_CONST(0.030053755536176), FRAC_CONST(0.032402110705505) },
+ { FRAC_CONST(0.029854374169043), FRAC_CONST(0.032585907122172) },
+ { FRAC_CONST(0.029653868801596), FRAC_CONST(0.032768476697853) },
+ { FRAC_CONST(0.029452246982750), FRAC_CONST(0.032949812558907) },
+ { FRAC_CONST(0.029249516303451), FRAC_CONST(0.033129907878142) },
+ { FRAC_CONST(0.029045684396395), FRAC_CONST(0.033308755875070) },
+ { FRAC_CONST(0.028840758935738), FRAC_CONST(0.033486349816166) },
+ { FRAC_CONST(0.028634747636808), FRAC_CONST(0.033662683015118) },
+ { FRAC_CONST(0.028427658255815), FRAC_CONST(0.033837748833080) },
+ { FRAC_CONST(0.028219498589555), FRAC_CONST(0.034011540678924) },
+ { FRAC_CONST(0.028010276475123), FRAC_CONST(0.034184052009485) },
+ { FRAC_CONST(0.027799999789613), FRAC_CONST(0.034355276329809) },
+ { FRAC_CONST(0.027588676449824), FRAC_CONST(0.034525207193396) },
+ { FRAC_CONST(0.027376314411959), FRAC_CONST(0.034693838202447) },
+ { FRAC_CONST(0.027162921671330), FRAC_CONST(0.034861163008098) },
+ { FRAC_CONST(0.026948506262053), FRAC_CONST(0.035027175310665) },
+ { FRAC_CONST(0.026733076256746), FRAC_CONST(0.035191868859880) },
+ { FRAC_CONST(0.026516639766228), FRAC_CONST(0.035355237455122) },
+ { FRAC_CONST(0.026299204939210), FRAC_CONST(0.035517274945657) },
+ { FRAC_CONST(0.026080779961991), FRAC_CONST(0.035677975230865) },
+ { FRAC_CONST(0.025861373058146), FRAC_CONST(0.035837332260471) },
+ { FRAC_CONST(0.025640992488223), FRAC_CONST(0.035995340034772) },
+ { FRAC_CONST(0.025419646549425), FRAC_CONST(0.036151992604866) },
+ { FRAC_CONST(0.025197343575302), FRAC_CONST(0.036307284072871) },
+ { FRAC_CONST(0.024974091935435), FRAC_CONST(0.036461208592152) },
+ { FRAC_CONST(0.024749900035122), FRAC_CONST(0.036613760367538) },
+ { FRAC_CONST(0.024524776315061), FRAC_CONST(0.036764933655540) },
+ { FRAC_CONST(0.024298729251033), FRAC_CONST(0.036914722764569) },
+ { FRAC_CONST(0.024071767353583), FRAC_CONST(0.037063122055150) },
+ { FRAC_CONST(0.023843899167697), FRAC_CONST(0.037210125940135) },
+ { FRAC_CONST(0.023615133272485), FRAC_CONST(0.037355728884908) },
+ { FRAC_CONST(0.023385478280852), FRAC_CONST(0.037499925407603) },
+ { FRAC_CONST(0.023154942839179), FRAC_CONST(0.037642710079302) },
+ { FRAC_CONST(0.022923535626995), FRAC_CONST(0.037784077524241) },
+ { FRAC_CONST(0.022691265356652), FRAC_CONST(0.037924022420018) },
+ { FRAC_CONST(0.022458140772993), FRAC_CONST(0.038062539497785) },
+ { FRAC_CONST(0.022224170653027), FRAC_CONST(0.038199623542453) },
+ { FRAC_CONST(0.021989363805598), FRAC_CONST(0.038335269392885) },
+ { FRAC_CONST(0.021753729071049), FRAC_CONST(0.038469471942092) },
+ { FRAC_CONST(0.021517275320897), FRAC_CONST(0.038602226137423) },
+ { FRAC_CONST(0.021280011457490), FRAC_CONST(0.038733526980758) },
+ { FRAC_CONST(0.021041946413679), FRAC_CONST(0.038863369528695) },
+ { FRAC_CONST(0.020803089152479), FRAC_CONST(0.038991748892734) },
+ { FRAC_CONST(0.020563448666730), FRAC_CONST(0.039118660239466) },
+ { FRAC_CONST(0.020323033978761), FRAC_CONST(0.039244098790750) },
+ { FRAC_CONST(0.020081854140050), FRAC_CONST(0.039368059823895) },
+ { FRAC_CONST(0.019839918230880), FRAC_CONST(0.039490538671839) },
+ { FRAC_CONST(0.019597235360003), FRAC_CONST(0.039611530723322) },
+ { FRAC_CONST(0.019353814664291), FRAC_CONST(0.039731031423061) },
+ { FRAC_CONST(0.019109665308395), FRAC_CONST(0.039849036271924) },
+ { FRAC_CONST(0.018864796484402), FRAC_CONST(0.039965540827094) },
+ { FRAC_CONST(0.018619217411483), FRAC_CONST(0.040080540702240) },
+ { FRAC_CONST(0.018372937335552), FRAC_CONST(0.040194031567683) },
+ { FRAC_CONST(0.018125965528915), FRAC_CONST(0.040306009150554) },
+ { FRAC_CONST(0.017878311289921), FRAC_CONST(0.040416469234963) },
+ { FRAC_CONST(0.017629983942612), FRAC_CONST(0.040525407662148) },
+ { FRAC_CONST(0.017380992836371), FRAC_CONST(0.040632820330639) },
+ { FRAC_CONST(0.017131347345575), FRAC_CONST(0.040738703196411) },
+ { FRAC_CONST(0.016881056869233), FRAC_CONST(0.040843052273033) },
+ { FRAC_CONST(0.016630130830641), FRAC_CONST(0.040945863631822) },
+ { FRAC_CONST(0.016378578677023), FRAC_CONST(0.041047133401988) },
+ { FRAC_CONST(0.016126409879175), FRAC_CONST(0.041146857770781) },
+ { FRAC_CONST(0.015873633931110), FRAC_CONST(0.041245032983635) },
+ { FRAC_CONST(0.015620260349699), FRAC_CONST(0.041341655344309) },
+ { FRAC_CONST(0.015366298674314), FRAC_CONST(0.041436721215026) },
+ { FRAC_CONST(0.015111758466470), FRAC_CONST(0.041530227016609) },
+ { FRAC_CONST(0.014856649309460), FRAC_CONST(0.041622169228618) },
+ { FRAC_CONST(0.014600980808001), FRAC_CONST(0.041712544389481) },
+ { FRAC_CONST(0.014344762587867), FRAC_CONST(0.041801349096623) },
+ { FRAC_CONST(0.014088004295529), FRAC_CONST(0.041888580006598) },
+ { FRAC_CONST(0.013830715597792), FRAC_CONST(0.041974233835211) },
+ { FRAC_CONST(0.013572906181430), FRAC_CONST(0.042058307357645) },
+ { FRAC_CONST(0.013314585752822), FRAC_CONST(0.042140797408577) },
+ { FRAC_CONST(0.013055764037585), FRAC_CONST(0.042221700882306) },
+ { FRAC_CONST(0.012796450780212), FRAC_CONST(0.042301014732860) },
+ { FRAC_CONST(0.012536655743699), FRAC_CONST(0.042378735974118) },
+ { FRAC_CONST(0.012276388709183), FRAC_CONST(0.042454861679919) },
+ { FRAC_CONST(0.012015659475571), FRAC_CONST(0.042529388984173) },
+ { FRAC_CONST(0.011754477859172), FRAC_CONST(0.042602315080970) },
+ { FRAC_CONST(0.011492853693324), FRAC_CONST(0.042673637224683) },
+ { FRAC_CONST(0.011230796828031), FRAC_CONST(0.042743352730074) },
+ { FRAC_CONST(0.010968317129584), FRAC_CONST(0.042811458972393) },
+ { FRAC_CONST(0.010705424480197), FRAC_CONST(0.042877953387479) },
+ { FRAC_CONST(0.010442128777629), FRAC_CONST(0.042942833471854) },
+ { FRAC_CONST(0.010178439934815), FRAC_CONST(0.043006096782821) },
+ { FRAC_CONST(0.009914367879490), FRAC_CONST(0.043067740938551) },
+ { FRAC_CONST(0.009649922553818), FRAC_CONST(0.043127763618177) },
+ { FRAC_CONST(0.009385113914016), FRAC_CONST(0.043186162561878) },
+ { FRAC_CONST(0.009119951929979), FRAC_CONST(0.043242935570968) },
+ { FRAC_CONST(0.008854446584907), FRAC_CONST(0.043298080507974) },
+ { FRAC_CONST(0.008588607874926), FRAC_CONST(0.043351595296722) },
+ { FRAC_CONST(0.008322445808712), FRAC_CONST(0.043403477922409) },
+ { FRAC_CONST(0.008055970407118), FRAC_CONST(0.043453726431684) },
+ { FRAC_CONST(0.007789191702791), FRAC_CONST(0.043502338932719) },
+ { FRAC_CONST(0.007522119739798), FRAC_CONST(0.043549313595281) },
+ { FRAC_CONST(0.007254764573250), FRAC_CONST(0.043594648650800) },
+ { FRAC_CONST(0.006987136268915), FRAC_CONST(0.043638342392438) },
+ { FRAC_CONST(0.006719244902849), FRAC_CONST(0.043680393175148) },
+ { FRAC_CONST(0.006451100561010), FRAC_CONST(0.043720799415744) },
+ { FRAC_CONST(0.006182713338881), FRAC_CONST(0.043759559592953) },
+ { FRAC_CONST(0.005914093341090), FRAC_CONST(0.043796672247476) },
+ { FRAC_CONST(0.005645250681027), FRAC_CONST(0.043832135982044) },
+ { FRAC_CONST(0.005376195480466), FRAC_CONST(0.043865949461465) },
+ { FRAC_CONST(0.005106937869184), FRAC_CONST(0.043898111412683) },
+ { FRAC_CONST(0.004837487984578), FRAC_CONST(0.043928620624817) },
+ { FRAC_CONST(0.004567855971284), FRAC_CONST(0.043957475949213) },
+ { FRAC_CONST(0.004298051980793), FRAC_CONST(0.043984676299484) },
+ { FRAC_CONST(0.004028086171076), FRAC_CONST(0.044010220651553) },
+ { FRAC_CONST(0.003757968706190), FRAC_CONST(0.044034108043689) },
+ { FRAC_CONST(0.003487709755907), FRAC_CONST(0.044056337576546) },
+ { FRAC_CONST(0.003217319495322), FRAC_CONST(0.044076908413193) },
+ { FRAC_CONST(0.002946808104477), FRAC_CONST(0.044095819779151) },
+ { FRAC_CONST(0.002676185767973), FRAC_CONST(0.044113070962418) },
+ { FRAC_CONST(0.002405462674586), FRAC_CONST(0.044128661313495) },
+ { FRAC_CONST(0.002134649016890), FRAC_CONST(0.044142590245416) },
+ { FRAC_CONST(0.001863754990865), FRAC_CONST(0.044154857233763) },
+ { FRAC_CONST(0.001592790795518), FRAC_CONST(0.044165461816692) },
+ { FRAC_CONST(0.001321766632497), FRAC_CONST(0.044174403594946) },
+ { FRAC_CONST(0.001050692705710), FRAC_CONST(0.044181682231873) },
+ { FRAC_CONST(0.000779579220936), FRAC_CONST(0.044187297453434) },
+ { FRAC_CONST(0.000508436385446), FRAC_CONST(0.044191249048222) },
+ { FRAC_CONST(0.000237274407613), FRAC_CONST(0.044193536867459) }
+};
#endif // LD_DEC
#ifdef ALLOW_SMALL_FRAMELENGTH
- /* 480 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_1920[] =
- {
- { FRAC_CONST(0.032274858518097), FRAC_CONST(0.000013202404176) },
- { FRAC_CONST(0.032274642494505), FRAC_CONST(0.000118821372483) },
- { FRAC_CONST(0.032274080835421), FRAC_CONST(0.000224439068308) },
- { FRAC_CONST(0.032273173546860), FRAC_CONST(0.000330054360572) },
- { FRAC_CONST(0.032271920638538), FRAC_CONST(0.000435666118218) },
- { FRAC_CONST(0.032270322123873), FRAC_CONST(0.000541273210231) },
- { FRAC_CONST(0.032268378019984), FRAC_CONST(0.000646874505642) },
- { FRAC_CONST(0.032266088347691), FRAC_CONST(0.000752468873546) },
- { FRAC_CONST(0.032263453131514), FRAC_CONST(0.000858055183114) },
- { FRAC_CONST(0.032260472399674), FRAC_CONST(0.000963632303600) },
- { FRAC_CONST(0.032257146184092), FRAC_CONST(0.001069199104358) },
- { FRAC_CONST(0.032253474520390), FRAC_CONST(0.001174754454853) },
- { FRAC_CONST(0.032249457447888), FRAC_CONST(0.001280297224671) },
- { FRAC_CONST(0.032245095009606), FRAC_CONST(0.001385826283535) },
- { FRAC_CONST(0.032240387252262), FRAC_CONST(0.001491340501313) },
- { FRAC_CONST(0.032235334226272), FRAC_CONST(0.001596838748031) },
- { FRAC_CONST(0.032229935985750), FRAC_CONST(0.001702319893890) },
- { FRAC_CONST(0.032224192588507), FRAC_CONST(0.001807782809271) },
- { FRAC_CONST(0.032218104096050), FRAC_CONST(0.001913226364749) },
- { FRAC_CONST(0.032211670573582), FRAC_CONST(0.002018649431111) },
- { FRAC_CONST(0.032204892090000), FRAC_CONST(0.002124050879359) },
- { FRAC_CONST(0.032197768717898), FRAC_CONST(0.002229429580728) },
- { FRAC_CONST(0.032190300533560), FRAC_CONST(0.002334784406698) },
- { FRAC_CONST(0.032182487616965), FRAC_CONST(0.002440114229003) },
- { FRAC_CONST(0.032174330051782), FRAC_CONST(0.002545417919644) },
- { FRAC_CONST(0.032165827925374), FRAC_CONST(0.002650694350905) },
- { FRAC_CONST(0.032156981328790), FRAC_CONST(0.002755942395358) },
- { FRAC_CONST(0.032147790356771), FRAC_CONST(0.002861160925883) },
- { FRAC_CONST(0.032138255107744), FRAC_CONST(0.002966348815672) },
- { FRAC_CONST(0.032128375683825), FRAC_CONST(0.003071504938250) },
- { FRAC_CONST(0.032118152190814), FRAC_CONST(0.003176628167476) },
- { FRAC_CONST(0.032107584738196), FRAC_CONST(0.003281717377568) },
- { FRAC_CONST(0.032096673439141), FRAC_CONST(0.003386771443102) },
- { FRAC_CONST(0.032085418410500), FRAC_CONST(0.003491789239036) },
- { FRAC_CONST(0.032073819772804), FRAC_CONST(0.003596769640711) },
- { FRAC_CONST(0.032061877650267), FRAC_CONST(0.003701711523874) },
- { FRAC_CONST(0.032049592170778), FRAC_CONST(0.003806613764680) },
- { FRAC_CONST(0.032036963465906), FRAC_CONST(0.003911475239711) },
- { FRAC_CONST(0.032023991670893), FRAC_CONST(0.004016294825985) },
- { FRAC_CONST(0.032010676924657), FRAC_CONST(0.004121071400967) },
- { FRAC_CONST(0.031997019369789), FRAC_CONST(0.004225803842586) },
- { FRAC_CONST(0.031983019152549), FRAC_CONST(0.004330491029241) },
- { FRAC_CONST(0.031968676422869), FRAC_CONST(0.004435131839816) },
- { FRAC_CONST(0.031953991334348), FRAC_CONST(0.004539725153692) },
- { FRAC_CONST(0.031938964044252), FRAC_CONST(0.004644269850758) },
- { FRAC_CONST(0.031923594713510), FRAC_CONST(0.004748764811426) },
- { FRAC_CONST(0.031907883506716), FRAC_CONST(0.004853208916638) },
- { FRAC_CONST(0.031891830592124), FRAC_CONST(0.004957601047881) },
- { FRAC_CONST(0.031875436141648), FRAC_CONST(0.005061940087200) },
- { FRAC_CONST(0.031858700330859), FRAC_CONST(0.005166224917208) },
- { FRAC_CONST(0.031841623338985), FRAC_CONST(0.005270454421097) },
- { FRAC_CONST(0.031824205348907), FRAC_CONST(0.005374627482653) },
- { FRAC_CONST(0.031806446547156), FRAC_CONST(0.005478742986267) },
- { FRAC_CONST(0.031788347123916), FRAC_CONST(0.005582799816945) },
- { FRAC_CONST(0.031769907273017), FRAC_CONST(0.005686796860323) },
- { FRAC_CONST(0.031751127191935), FRAC_CONST(0.005790733002674) },
- { FRAC_CONST(0.031732007081789), FRAC_CONST(0.005894607130928) },
- { FRAC_CONST(0.031712547147340), FRAC_CONST(0.005998418132675) },
- { FRAC_CONST(0.031692747596989), FRAC_CONST(0.006102164896182) },
- { FRAC_CONST(0.031672608642773), FRAC_CONST(0.006205846310406) },
- { FRAC_CONST(0.031652130500364), FRAC_CONST(0.006309461265002) },
- { FRAC_CONST(0.031631313389067), FRAC_CONST(0.006413008650337) },
- { FRAC_CONST(0.031610157531816), FRAC_CONST(0.006516487357501) },
- { FRAC_CONST(0.031588663155172), FRAC_CONST(0.006619896278321) },
- { FRAC_CONST(0.031566830489325), FRAC_CONST(0.006723234305370) },
- { FRAC_CONST(0.031544659768083), FRAC_CONST(0.006826500331981) },
- { FRAC_CONST(0.031522151228878), FRAC_CONST(0.006929693252258) },
- { FRAC_CONST(0.031499305112758), FRAC_CONST(0.007032811961088) },
- { FRAC_CONST(0.031476121664387), FRAC_CONST(0.007135855354151) },
- { FRAC_CONST(0.031452601132040), FRAC_CONST(0.007238822327937) },
- { FRAC_CONST(0.031428743767604), FRAC_CONST(0.007341711779751) },
- { FRAC_CONST(0.031404549826572), FRAC_CONST(0.007444522607730) },
- { FRAC_CONST(0.031380019568042), FRAC_CONST(0.007547253710853) },
- { FRAC_CONST(0.031355153254712), FRAC_CONST(0.007649903988952) },
- { FRAC_CONST(0.031329951152882), FRAC_CONST(0.007752472342725) },
- { FRAC_CONST(0.031304413532445), FRAC_CONST(0.007854957673748) },
- { FRAC_CONST(0.031278540666888), FRAC_CONST(0.007957358884484) },
- { FRAC_CONST(0.031252332833290), FRAC_CONST(0.008059674878300) },
- { FRAC_CONST(0.031225790312316), FRAC_CONST(0.008161904559473) },
- { FRAC_CONST(0.031198913388214), FRAC_CONST(0.008264046833205) },
- { FRAC_CONST(0.031171702348814), FRAC_CONST(0.008366100605636) },
- { FRAC_CONST(0.031144157485525), FRAC_CONST(0.008468064783849) },
- { FRAC_CONST(0.031116279093331), FRAC_CONST(0.008569938275893) },
- { FRAC_CONST(0.031088067470786), FRAC_CONST(0.008671719990782) },
- { FRAC_CONST(0.031059522920014), FRAC_CONST(0.008773408838517) },
- { FRAC_CONST(0.031030645746705), FRAC_CONST(0.008875003730092) },
- { FRAC_CONST(0.031001436260110), FRAC_CONST(0.008976503577507) },
- { FRAC_CONST(0.030971894773039), FRAC_CONST(0.009077907293780) },
- { FRAC_CONST(0.030942021601857), FRAC_CONST(0.009179213792959) },
- { FRAC_CONST(0.030911817066483), FRAC_CONST(0.009280421990133) },
- { FRAC_CONST(0.030881281490382), FRAC_CONST(0.009381530801444) },
- { FRAC_CONST(0.030850415200566), FRAC_CONST(0.009482539144097) },
- { FRAC_CONST(0.030819218527589), FRAC_CONST(0.009583445936373) },
- { FRAC_CONST(0.030787691805541), FRAC_CONST(0.009684250097643) },
- { FRAC_CONST(0.030755835372048), FRAC_CONST(0.009784950548375) },
- { FRAC_CONST(0.030723649568268), FRAC_CONST(0.009885546210147) },
- { FRAC_CONST(0.030691134738883), FRAC_CONST(0.009986036005661) },
- { FRAC_CONST(0.030658291232103), FRAC_CONST(0.010086418858753) },
- { FRAC_CONST(0.030625119399655), FRAC_CONST(0.010186693694402) },
- { FRAC_CONST(0.030591619596781), FRAC_CONST(0.010286859438745) },
- { FRAC_CONST(0.030557792182239), FRAC_CONST(0.010386915019088) },
- { FRAC_CONST(0.030523637518292), FRAC_CONST(0.010486859363916) },
- { FRAC_CONST(0.030489155970710), FRAC_CONST(0.010586691402906) },
- { FRAC_CONST(0.030454347908763), FRAC_CONST(0.010686410066936) },
- { FRAC_CONST(0.030419213705216), FRAC_CONST(0.010786014288099) },
- { FRAC_CONST(0.030383753736329), FRAC_CONST(0.010885502999714) },
- { FRAC_CONST(0.030347968381849), FRAC_CONST(0.010984875136338) },
- { FRAC_CONST(0.030311858025010), FRAC_CONST(0.011084129633775) },
- { FRAC_CONST(0.030275423052523), FRAC_CONST(0.011183265429088) },
- { FRAC_CONST(0.030238663854579), FRAC_CONST(0.011282281460612) },
- { FRAC_CONST(0.030201580824838), FRAC_CONST(0.011381176667967) },
- { FRAC_CONST(0.030164174360430), FRAC_CONST(0.011479949992062) },
- { FRAC_CONST(0.030126444861948), FRAC_CONST(0.011578600375117) },
- { FRAC_CONST(0.030088392733446), FRAC_CONST(0.011677126760663) },
- { FRAC_CONST(0.030050018382430), FRAC_CONST(0.011775528093563) },
- { FRAC_CONST(0.030011322219859), FRAC_CONST(0.011873803320018) },
- { FRAC_CONST(0.029972304660138), FRAC_CONST(0.011971951387578) },
- { FRAC_CONST(0.029932966121114), FRAC_CONST(0.012069971245157) },
- { FRAC_CONST(0.029893307024070), FRAC_CONST(0.012167861843041) },
- { FRAC_CONST(0.029853327793724), FRAC_CONST(0.012265622132901) },
- { FRAC_CONST(0.029813028858222), FRAC_CONST(0.012363251067801) },
- { FRAC_CONST(0.029772410649132), FRAC_CONST(0.012460747602215) },
- { FRAC_CONST(0.029731473601443), FRAC_CONST(0.012558110692033) },
- { FRAC_CONST(0.029690218153558), FRAC_CONST(0.012655339294575) },
- { FRAC_CONST(0.029648644747289), FRAC_CONST(0.012752432368600) },
- { FRAC_CONST(0.029606753827855), FRAC_CONST(0.012849388874320) },
- { FRAC_CONST(0.029564545843872), FRAC_CONST(0.012946207773407) },
- { FRAC_CONST(0.029522021247356), FRAC_CONST(0.013042888029011) },
- { FRAC_CONST(0.029479180493710), FRAC_CONST(0.013139428605762) },
- { FRAC_CONST(0.029436024041725), FRAC_CONST(0.013235828469789) },
- { FRAC_CONST(0.029392552353570), FRAC_CONST(0.013332086588727) },
- { FRAC_CONST(0.029348765894794), FRAC_CONST(0.013428201931728) },
- { FRAC_CONST(0.029304665134313), FRAC_CONST(0.013524173469475) },
- { FRAC_CONST(0.029260250544412), FRAC_CONST(0.013620000174189) },
- { FRAC_CONST(0.029215522600735), FRAC_CONST(0.013715681019643) },
- { FRAC_CONST(0.029170481782283), FRAC_CONST(0.013811214981173) },
- { FRAC_CONST(0.029125128571406), FRAC_CONST(0.013906601035686) },
- { FRAC_CONST(0.029079463453801), FRAC_CONST(0.014001838161674) },
- { FRAC_CONST(0.029033486918505), FRAC_CONST(0.014096925339225) },
- { FRAC_CONST(0.028987199457889), FRAC_CONST(0.014191861550031) },
- { FRAC_CONST(0.028940601567655), FRAC_CONST(0.014286645777401) },
- { FRAC_CONST(0.028893693746829), FRAC_CONST(0.014381277006273) },
- { FRAC_CONST(0.028846476497755), FRAC_CONST(0.014475754223221) },
- { FRAC_CONST(0.028798950326094), FRAC_CONST(0.014570076416472) },
- { FRAC_CONST(0.028751115740811), FRAC_CONST(0.014664242575910) },
- { FRAC_CONST(0.028702973254178), FRAC_CONST(0.014758251693091) },
- { FRAC_CONST(0.028654523381760), FRAC_CONST(0.014852102761253) },
- { FRAC_CONST(0.028605766642418), FRAC_CONST(0.014945794775326) },
- { FRAC_CONST(0.028556703558297), FRAC_CONST(0.015039326731945) },
- { FRAC_CONST(0.028507334654823), FRAC_CONST(0.015132697629457) },
- { FRAC_CONST(0.028457660460698), FRAC_CONST(0.015225906467935) },
- { FRAC_CONST(0.028407681507891), FRAC_CONST(0.015318952249187) },
- { FRAC_CONST(0.028357398331639), FRAC_CONST(0.015411833976768) },
- { FRAC_CONST(0.028306811470432), FRAC_CONST(0.015504550655988) },
- { FRAC_CONST(0.028255921466016), FRAC_CONST(0.015597101293927) },
- { FRAC_CONST(0.028204728863381), FRAC_CONST(0.015689484899442) },
- { FRAC_CONST(0.028153234210760), FRAC_CONST(0.015781700483179) },
- { FRAC_CONST(0.028101438059619), FRAC_CONST(0.015873747057582) },
- { FRAC_CONST(0.028049340964652), FRAC_CONST(0.015965623636907) },
- { FRAC_CONST(0.027996943483779), FRAC_CONST(0.016057329237229) },
- { FRAC_CONST(0.027944246178133), FRAC_CONST(0.016148862876456) },
- { FRAC_CONST(0.027891249612061), FRAC_CONST(0.016240223574335) },
- { FRAC_CONST(0.027837954353113), FRAC_CONST(0.016331410352467) },
- { FRAC_CONST(0.027784360972039), FRAC_CONST(0.016422422234315) },
- { FRAC_CONST(0.027730470042780), FRAC_CONST(0.016513258245214) },
- { FRAC_CONST(0.027676282142466), FRAC_CONST(0.016603917412384) },
- { FRAC_CONST(0.027621797851405), FRAC_CONST(0.016694398764938) },
- { FRAC_CONST(0.027567017753080), FRAC_CONST(0.016784701333894) },
- { FRAC_CONST(0.027511942434143), FRAC_CONST(0.016874824152183) },
- { FRAC_CONST(0.027456572484404), FRAC_CONST(0.016964766254662) },
- { FRAC_CONST(0.027400908496833), FRAC_CONST(0.017054526678124) },
- { FRAC_CONST(0.027344951067546), FRAC_CONST(0.017144104461307) },
- { FRAC_CONST(0.027288700795801), FRAC_CONST(0.017233498644904) },
- { FRAC_CONST(0.027232158283994), FRAC_CONST(0.017322708271577) },
- { FRAC_CONST(0.027175324137651), FRAC_CONST(0.017411732385960) },
- { FRAC_CONST(0.027118198965418), FRAC_CONST(0.017500570034678) },
- { FRAC_CONST(0.027060783379060), FRAC_CONST(0.017589220266351) },
- { FRAC_CONST(0.027003077993454), FRAC_CONST(0.017677682131607) },
- { FRAC_CONST(0.026945083426576), FRAC_CONST(0.017765954683088) },
- { FRAC_CONST(0.026886800299502), FRAC_CONST(0.017854036975468) },
- { FRAC_CONST(0.026828229236397), FRAC_CONST(0.017941928065456) },
- { FRAC_CONST(0.026769370864511), FRAC_CONST(0.018029627011808) },
- { FRAC_CONST(0.026710225814170), FRAC_CONST(0.018117132875340) },
- { FRAC_CONST(0.026650794718768), FRAC_CONST(0.018204444718934) },
- { FRAC_CONST(0.026591078214767), FRAC_CONST(0.018291561607551) },
- { FRAC_CONST(0.026531076941680), FRAC_CONST(0.018378482608238) },
- { FRAC_CONST(0.026470791542075), FRAC_CONST(0.018465206790142) },
- { FRAC_CONST(0.026410222661558), FRAC_CONST(0.018551733224515) },
- { FRAC_CONST(0.026349370948775), FRAC_CONST(0.018638060984730) },
- { FRAC_CONST(0.026288237055398), FRAC_CONST(0.018724189146286) },
- { FRAC_CONST(0.026226821636121), FRAC_CONST(0.018810116786819) },
- { FRAC_CONST(0.026165125348656), FRAC_CONST(0.018895842986112) },
- { FRAC_CONST(0.026103148853718), FRAC_CONST(0.018981366826109) },
- { FRAC_CONST(0.026040892815028), FRAC_CONST(0.019066687390916) },
- { FRAC_CONST(0.025978357899296), FRAC_CONST(0.019151803766819) },
- { FRAC_CONST(0.025915544776223), FRAC_CONST(0.019236715042290) },
- { FRAC_CONST(0.025852454118485), FRAC_CONST(0.019321420307998) },
- { FRAC_CONST(0.025789086601733), FRAC_CONST(0.019405918656817) },
- { FRAC_CONST(0.025725442904582), FRAC_CONST(0.019490209183837) },
- { FRAC_CONST(0.025661523708606), FRAC_CONST(0.019574290986376) },
- { FRAC_CONST(0.025597329698327), FRAC_CONST(0.019658163163984) },
- { FRAC_CONST(0.025532861561211), FRAC_CONST(0.019741824818458) },
- { FRAC_CONST(0.025468119987662), FRAC_CONST(0.019825275053848) },
- { FRAC_CONST(0.025403105671008), FRAC_CONST(0.019908512976470) },
- { FRAC_CONST(0.025337819307501), FRAC_CONST(0.019991537694913) },
- { FRAC_CONST(0.025272261596305), FRAC_CONST(0.020074348320047) },
- { FRAC_CONST(0.025206433239491), FRAC_CONST(0.020156943965039) },
- { FRAC_CONST(0.025140334942028), FRAC_CONST(0.020239323745355) },
- { FRAC_CONST(0.025073967411776), FRAC_CONST(0.020321486778774) },
- { FRAC_CONST(0.025007331359476), FRAC_CONST(0.020403432185395) },
- { FRAC_CONST(0.024940427498748), FRAC_CONST(0.020485159087650) },
- { FRAC_CONST(0.024873256546079), FRAC_CONST(0.020566666610309) },
- { FRAC_CONST(0.024805819220816), FRAC_CONST(0.020647953880491) },
- { FRAC_CONST(0.024738116245157), FRAC_CONST(0.020729020027676) },
- { FRAC_CONST(0.024670148344147), FRAC_CONST(0.020809864183709) },
- { FRAC_CONST(0.024601916245669), FRAC_CONST(0.020890485482816) },
- { FRAC_CONST(0.024533420680433), FRAC_CONST(0.020970883061607) },
- { FRAC_CONST(0.024464662381971), FRAC_CONST(0.021051056059087) },
- { FRAC_CONST(0.024395642086630), FRAC_CONST(0.021131003616670) },
- { FRAC_CONST(0.024326360533561), FRAC_CONST(0.021210724878181) },
- { FRAC_CONST(0.024256818464715), FRAC_CONST(0.021290218989868) },
- { FRAC_CONST(0.024187016624830), FRAC_CONST(0.021369485100415) },
- { FRAC_CONST(0.024116955761430), FRAC_CONST(0.021448522360944) },
- { FRAC_CONST(0.024046636624808), FRAC_CONST(0.021527329925030) },
- { FRAC_CONST(0.023976059968027), FRAC_CONST(0.021605906948708) },
- { FRAC_CONST(0.023905226546906), FRAC_CONST(0.021684252590480) },
- { FRAC_CONST(0.023834137120014), FRAC_CONST(0.021762366011328) },
- { FRAC_CONST(0.023762792448662), FRAC_CONST(0.021840246374720) },
- { FRAC_CONST(0.023691193296893), FRAC_CONST(0.021917892846620) },
- { FRAC_CONST(0.023619340431478), FRAC_CONST(0.021995304595495) },
- { FRAC_CONST(0.023547234621902), FRAC_CONST(0.022072480792330) },
- { FRAC_CONST(0.023474876640361), FRAC_CONST(0.022149420610628) },
- { FRAC_CONST(0.023402267261751), FRAC_CONST(0.022226123226426) },
- { FRAC_CONST(0.023329407263659), FRAC_CONST(0.022302587818300) },
- { FRAC_CONST(0.023256297426359), FRAC_CONST(0.022378813567377) },
- { FRAC_CONST(0.023182938532797), FRAC_CONST(0.022454799657339) },
- { FRAC_CONST(0.023109331368588), FRAC_CONST(0.022530545274437) },
- { FRAC_CONST(0.023035476722006), FRAC_CONST(0.022606049607496) },
- { FRAC_CONST(0.022961375383975), FRAC_CONST(0.022681311847926) },
- { FRAC_CONST(0.022887028148061), FRAC_CONST(0.022756331189727) },
- { FRAC_CONST(0.022812435810462), FRAC_CONST(0.022831106829504) },
- { FRAC_CONST(0.022737599170003), FRAC_CONST(0.022905637966469) },
- { FRAC_CONST(0.022662519028125), FRAC_CONST(0.022979923802453) },
- { FRAC_CONST(0.022587196188874), FRAC_CONST(0.023053963541915) },
- { FRAC_CONST(0.022511631458899), FRAC_CONST(0.023127756391950) },
- { FRAC_CONST(0.022435825647437), FRAC_CONST(0.023201301562294) },
- { FRAC_CONST(0.022359779566306), FRAC_CONST(0.023274598265338) },
- { FRAC_CONST(0.022283494029900), FRAC_CONST(0.023347645716133) },
- { FRAC_CONST(0.022206969855176), FRAC_CONST(0.023420443132400) },
- { FRAC_CONST(0.022130207861645), FRAC_CONST(0.023492989734537) },
- { FRAC_CONST(0.022053208871367), FRAC_CONST(0.023565284745628) },
- { FRAC_CONST(0.021975973708940), FRAC_CONST(0.023637327391451) },
- { FRAC_CONST(0.021898503201489), FRAC_CONST(0.023709116900488) },
- { FRAC_CONST(0.021820798178663), FRAC_CONST(0.023780652503931) },
- { FRAC_CONST(0.021742859472618), FRAC_CONST(0.023851933435691) },
- { FRAC_CONST(0.021664687918017), FRAC_CONST(0.023922958932406) },
- { FRAC_CONST(0.021586284352013), FRAC_CONST(0.023993728233451) },
- { FRAC_CONST(0.021507649614247), FRAC_CONST(0.024064240580942) },
- { FRAC_CONST(0.021428784546832), FRAC_CONST(0.024134495219750) },
- { FRAC_CONST(0.021349689994350), FRAC_CONST(0.024204491397504) },
- { FRAC_CONST(0.021270366803840), FRAC_CONST(0.024274228364600) },
- { FRAC_CONST(0.021190815824791), FRAC_CONST(0.024343705374213) },
- { FRAC_CONST(0.021111037909128), FRAC_CONST(0.024412921682298) },
- { FRAC_CONST(0.021031033911210), FRAC_CONST(0.024481876547605) },
- { FRAC_CONST(0.020950804687815), FRAC_CONST(0.024550569231683) },
- { FRAC_CONST(0.020870351098134), FRAC_CONST(0.024618998998889) },
- { FRAC_CONST(0.020789674003759), FRAC_CONST(0.024687165116394) },
- { FRAC_CONST(0.020708774268678), FRAC_CONST(0.024755066854194) },
- { FRAC_CONST(0.020627652759262), FRAC_CONST(0.024822703485116) },
- { FRAC_CONST(0.020546310344257), FRAC_CONST(0.024890074284826) },
- { FRAC_CONST(0.020464747894775), FRAC_CONST(0.024957178531837) },
- { FRAC_CONST(0.020382966284284), FRAC_CONST(0.025024015507516) },
- { FRAC_CONST(0.020300966388600), FRAC_CONST(0.025090584496093) },
- { FRAC_CONST(0.020218749085876), FRAC_CONST(0.025156884784668) },
- { FRAC_CONST(0.020136315256592), FRAC_CONST(0.025222915663218) },
- { FRAC_CONST(0.020053665783549), FRAC_CONST(0.025288676424605) },
- { FRAC_CONST(0.019970801551857), FRAC_CONST(0.025354166364584) },
- { FRAC_CONST(0.019887723448925), FRAC_CONST(0.025419384781811) },
- { FRAC_CONST(0.019804432364452), FRAC_CONST(0.025484330977848) },
- { FRAC_CONST(0.019720929190419), FRAC_CONST(0.025549004257175) },
- { FRAC_CONST(0.019637214821078), FRAC_CONST(0.025613403927192) },
- { FRAC_CONST(0.019553290152943), FRAC_CONST(0.025677529298230) },
- { FRAC_CONST(0.019469156084779), FRAC_CONST(0.025741379683559) },
- { FRAC_CONST(0.019384813517595), FRAC_CONST(0.025804954399392) },
- { FRAC_CONST(0.019300263354632), FRAC_CONST(0.025868252764895) },
- { FRAC_CONST(0.019215506501354), FRAC_CONST(0.025931274102193) },
- { FRAC_CONST(0.019130543865439), FRAC_CONST(0.025994017736379) },
- { FRAC_CONST(0.019045376356769), FRAC_CONST(0.026056482995518) },
- { FRAC_CONST(0.018960004887419), FRAC_CONST(0.026118669210657) },
- { FRAC_CONST(0.018874430371648), FRAC_CONST(0.026180575715833) },
- { FRAC_CONST(0.018788653725892), FRAC_CONST(0.026242201848076) },
- { FRAC_CONST(0.018702675868750), FRAC_CONST(0.026303546947421) },
- { FRAC_CONST(0.018616497720974), FRAC_CONST(0.026364610356909) },
- { FRAC_CONST(0.018530120205464), FRAC_CONST(0.026425391422602) },
- { FRAC_CONST(0.018443544247254), FRAC_CONST(0.026485889493583) },
- { FRAC_CONST(0.018356770773502), FRAC_CONST(0.026546103921965) },
- { FRAC_CONST(0.018269800713483), FRAC_CONST(0.026606034062902) },
- { FRAC_CONST(0.018182634998576), FRAC_CONST(0.026665679274589) },
- { FRAC_CONST(0.018095274562256), FRAC_CONST(0.026725038918274) },
- { FRAC_CONST(0.018007720340083), FRAC_CONST(0.026784112358263) },
- { FRAC_CONST(0.017919973269692), FRAC_CONST(0.026842898961926) },
- { FRAC_CONST(0.017832034290785), FRAC_CONST(0.026901398099707) },
- { FRAC_CONST(0.017743904345116), FRAC_CONST(0.026959609145127) },
- { FRAC_CONST(0.017655584376488), FRAC_CONST(0.027017531474792) },
- { FRAC_CONST(0.017567075330734), FRAC_CONST(0.027075164468401) },
- { FRAC_CONST(0.017478378155718), FRAC_CONST(0.027132507508750) },
- { FRAC_CONST(0.017389493801313), FRAC_CONST(0.027189559981742) },
- { FRAC_CONST(0.017300423219401), FRAC_CONST(0.027246321276391) },
- { FRAC_CONST(0.017211167363854), FRAC_CONST(0.027302790784828) },
- { FRAC_CONST(0.017121727190533), FRAC_CONST(0.027358967902310) },
- { FRAC_CONST(0.017032103657269), FRAC_CONST(0.027414852027226) },
- { FRAC_CONST(0.016942297723858), FRAC_CONST(0.027470442561102) },
- { FRAC_CONST(0.016852310352050), FRAC_CONST(0.027525738908608) },
- { FRAC_CONST(0.016762142505537), FRAC_CONST(0.027580740477564) },
- { FRAC_CONST(0.016671795149944), FRAC_CONST(0.027635446678948) },
- { FRAC_CONST(0.016581269252819), FRAC_CONST(0.027689856926900) },
- { FRAC_CONST(0.016490565783622), FRAC_CONST(0.027743970638730) },
- { FRAC_CONST(0.016399685713714), FRAC_CONST(0.027797787234924) },
- { FRAC_CONST(0.016308630016347), FRAC_CONST(0.027851306139149) },
- { FRAC_CONST(0.016217399666655), FRAC_CONST(0.027904526778260) },
- { FRAC_CONST(0.016125995641641), FRAC_CONST(0.027957448582309) },
- { FRAC_CONST(0.016034418920170), FRAC_CONST(0.028010070984544) },
- { FRAC_CONST(0.015942670482954), FRAC_CONST(0.028062393421421) },
- { FRAC_CONST(0.015850751312545), FRAC_CONST(0.028114415332610) },
- { FRAC_CONST(0.015758662393324), FRAC_CONST(0.028166136160998) },
- { FRAC_CONST(0.015666404711489), FRAC_CONST(0.028217555352697) },
- { FRAC_CONST(0.015573979255046), FRAC_CONST(0.028268672357047) },
- { FRAC_CONST(0.015481387013797), FRAC_CONST(0.028319486626627) },
- { FRAC_CONST(0.015388628979331), FRAC_CONST(0.028369997617257) },
- { FRAC_CONST(0.015295706145012), FRAC_CONST(0.028420204788004) },
- { FRAC_CONST(0.015202619505968), FRAC_CONST(0.028470107601191) },
- { FRAC_CONST(0.015109370059084), FRAC_CONST(0.028519705522399) },
- { FRAC_CONST(0.015015958802984), FRAC_CONST(0.028568998020472) },
- { FRAC_CONST(0.014922386738030), FRAC_CONST(0.028617984567529) },
- { FRAC_CONST(0.014828654866302), FRAC_CONST(0.028666664638963) },
- { FRAC_CONST(0.014734764191593), FRAC_CONST(0.028715037713449) },
- { FRAC_CONST(0.014640715719398), FRAC_CONST(0.028763103272951) },
- { FRAC_CONST(0.014546510456900), FRAC_CONST(0.028810860802724) },
- { FRAC_CONST(0.014452149412962), FRAC_CONST(0.028858309791325) },
- { FRAC_CONST(0.014357633598114), FRAC_CONST(0.028905449730613) },
- { FRAC_CONST(0.014262964024545), FRAC_CONST(0.028952280115756) },
- { FRAC_CONST(0.014168141706090), FRAC_CONST(0.028998800445240) },
- { FRAC_CONST(0.014073167658220), FRAC_CONST(0.029045010220868) },
- { FRAC_CONST(0.013978042898030), FRAC_CONST(0.029090908947771) },
- { FRAC_CONST(0.013882768444231), FRAC_CONST(0.029136496134411) },
- { FRAC_CONST(0.013787345317136), FRAC_CONST(0.029181771292585) },
- { FRAC_CONST(0.013691774538648), FRAC_CONST(0.029226733937433) },
- { FRAC_CONST(0.013596057132255), FRAC_CONST(0.029271383587441) },
- { FRAC_CONST(0.013500194123014), FRAC_CONST(0.029315719764447) },
- { FRAC_CONST(0.013404186537539), FRAC_CONST(0.029359741993647) },
- { FRAC_CONST(0.013308035403995), FRAC_CONST(0.029403449803598) },
- { FRAC_CONST(0.013211741752084), FRAC_CONST(0.029446842726223) },
- { FRAC_CONST(0.013115306613032), FRAC_CONST(0.029489920296820) },
- { FRAC_CONST(0.013018731019584), FRAC_CONST(0.029532682054063) },
- { FRAC_CONST(0.012922016005985), FRAC_CONST(0.029575127540008) },
- { FRAC_CONST(0.012825162607977), FRAC_CONST(0.029617256300097) },
- { FRAC_CONST(0.012728171862781), FRAC_CONST(0.029659067883165) },
- { FRAC_CONST(0.012631044809089), FRAC_CONST(0.029700561841444) },
- { FRAC_CONST(0.012533782487056), FRAC_CONST(0.029741737730567) },
- { FRAC_CONST(0.012436385938281), FRAC_CONST(0.029782595109573) },
- { FRAC_CONST(0.012338856205805), FRAC_CONST(0.029823133540913) },
- { FRAC_CONST(0.012241194334091), FRAC_CONST(0.029863352590452) },
- { FRAC_CONST(0.012143401369021), FRAC_CONST(0.029903251827477) },
- { FRAC_CONST(0.012045478357878), FRAC_CONST(0.029942830824699) },
- { FRAC_CONST(0.011947426349339), FRAC_CONST(0.029982089158259) },
- { FRAC_CONST(0.011849246393462), FRAC_CONST(0.030021026407731) },
- { FRAC_CONST(0.011750939541676), FRAC_CONST(0.030059642156129) },
- { FRAC_CONST(0.011652506846768), FRAC_CONST(0.030097935989909) },
- { FRAC_CONST(0.011553949362874), FRAC_CONST(0.030135907498976) },
- { FRAC_CONST(0.011455268145464), FRAC_CONST(0.030173556276684) },
- { FRAC_CONST(0.011356464251335), FRAC_CONST(0.030210881919845) },
- { FRAC_CONST(0.011257538738598), FRAC_CONST(0.030247884028732) },
- { FRAC_CONST(0.011158492666665), FRAC_CONST(0.030284562207083) },
- { FRAC_CONST(0.011059327096240), FRAC_CONST(0.030320916062102) },
- { FRAC_CONST(0.010960043089307), FRAC_CONST(0.030356945204470) },
- { FRAC_CONST(0.010860641709118), FRAC_CONST(0.030392649248343) },
- { FRAC_CONST(0.010761124020182), FRAC_CONST(0.030428027811361) },
- { FRAC_CONST(0.010661491088253), FRAC_CONST(0.030463080514646) },
- { FRAC_CONST(0.010561743980319), FRAC_CONST(0.030497806982812) },
- { FRAC_CONST(0.010461883764593), FRAC_CONST(0.030532206843968) },
- { FRAC_CONST(0.010361911510496), FRAC_CONST(0.030566279729717) },
- { FRAC_CONST(0.010261828288652), FRAC_CONST(0.030600025275167) },
- { FRAC_CONST(0.010161635170872), FRAC_CONST(0.030633443118931) },
- { FRAC_CONST(0.010061333230142), FRAC_CONST(0.030666532903129) },
- { FRAC_CONST(0.009960923540617), FRAC_CONST(0.030699294273397) },
- { FRAC_CONST(0.009860407177603), FRAC_CONST(0.030731726878888) },
- { FRAC_CONST(0.009759785217550), FRAC_CONST(0.030763830372273) },
- { FRAC_CONST(0.009659058738038), FRAC_CONST(0.030795604409750) },
- { FRAC_CONST(0.009558228817767), FRAC_CONST(0.030827048651045) },
- { FRAC_CONST(0.009457296536545), FRAC_CONST(0.030858162759415) },
- { FRAC_CONST(0.009356262975275), FRAC_CONST(0.030888946401653) },
- { FRAC_CONST(0.009255129215945), FRAC_CONST(0.030919399248091) },
- { FRAC_CONST(0.009153896341616), FRAC_CONST(0.030949520972603) },
- { FRAC_CONST(0.009052565436412), FRAC_CONST(0.030979311252611) },
- { FRAC_CONST(0.008951137585505), FRAC_CONST(0.031008769769084) },
- { FRAC_CONST(0.008849613875105), FRAC_CONST(0.031037896206544) },
- { FRAC_CONST(0.008747995392451), FRAC_CONST(0.031066690253072) },
- { FRAC_CONST(0.008646283225794), FRAC_CONST(0.031095151600306) },
- { FRAC_CONST(0.008544478464390), FRAC_CONST(0.031123279943448) },
- { FRAC_CONST(0.008442582198486), FRAC_CONST(0.031151074981266) },
- { FRAC_CONST(0.008340595519310), FRAC_CONST(0.031178536416098) },
- { FRAC_CONST(0.008238519519057), FRAC_CONST(0.031205663953853) },
- { FRAC_CONST(0.008136355290878), FRAC_CONST(0.031232457304017) },
- { FRAC_CONST(0.008034103928871), FRAC_CONST(0.031258916179656) },
- { FRAC_CONST(0.007931766528065), FRAC_CONST(0.031285040297416) },
- { FRAC_CONST(0.007829344184412), FRAC_CONST(0.031310829377528) },
- { FRAC_CONST(0.007726837994772), FRAC_CONST(0.031336283143813) },
- { FRAC_CONST(0.007624249056906), FRAC_CONST(0.031361401323680) },
- { FRAC_CONST(0.007521578469457), FRAC_CONST(0.031386183648135) },
- { FRAC_CONST(0.007418827331946), FRAC_CONST(0.031410629851778) },
- { FRAC_CONST(0.007315996744755), FRAC_CONST(0.031434739672811) },
- { FRAC_CONST(0.007213087809115), FRAC_CONST(0.031458512853036) },
- { FRAC_CONST(0.007110101627101), FRAC_CONST(0.031481949137863) },
- { FRAC_CONST(0.007007039301610), FRAC_CONST(0.031505048276306) },
- { FRAC_CONST(0.006903901936357), FRAC_CONST(0.031527810020993) },
- { FRAC_CONST(0.006800690635862), FRAC_CONST(0.031550234128164) },
- { FRAC_CONST(0.006697406505433), FRAC_CONST(0.031572320357675) },
- { FRAC_CONST(0.006594050651161), FRAC_CONST(0.031594068473000) },
- { FRAC_CONST(0.006490624179905), FRAC_CONST(0.031615478241233) },
- { FRAC_CONST(0.006387128199278), FRAC_CONST(0.031636549433095) },
- { FRAC_CONST(0.006283563817639), FRAC_CONST(0.031657281822929) },
- { FRAC_CONST(0.006179932144080), FRAC_CONST(0.031677675188707) },
- { FRAC_CONST(0.006076234288412), FRAC_CONST(0.031697729312034) },
- { FRAC_CONST(0.005972471361157), FRAC_CONST(0.031717443978146) },
- { FRAC_CONST(0.005868644473532), FRAC_CONST(0.031736818975914) },
- { FRAC_CONST(0.005764754737440), FRAC_CONST(0.031755854097848) },
- { FRAC_CONST(0.005660803265456), FRAC_CONST(0.031774549140098) },
- { FRAC_CONST(0.005556791170816), FRAC_CONST(0.031792903902453) },
- { FRAC_CONST(0.005452719567407), FRAC_CONST(0.031810918188350) },
- { FRAC_CONST(0.005348589569753), FRAC_CONST(0.031828591804869) },
- { FRAC_CONST(0.005244402293001), FRAC_CONST(0.031845924562742) },
- { FRAC_CONST(0.005140158852914), FRAC_CONST(0.031862916276347) },
- { FRAC_CONST(0.005035860365855), FRAC_CONST(0.031879566763717) },
- { FRAC_CONST(0.004931507948778), FRAC_CONST(0.031895875846539) },
- { FRAC_CONST(0.004827102719212), FRAC_CONST(0.031911843350155) },
- { FRAC_CONST(0.004722645795254), FRAC_CONST(0.031927469103567) },
- { FRAC_CONST(0.004618138295554), FRAC_CONST(0.031942752939435) },
- { FRAC_CONST(0.004513581339303), FRAC_CONST(0.031957694694082) },
- { FRAC_CONST(0.004408976046222), FRAC_CONST(0.031972294207493) },
- { FRAC_CONST(0.004304323536549), FRAC_CONST(0.031986551323320) },
- { FRAC_CONST(0.004199624931030), FRAC_CONST(0.032000465888879) },
- { FRAC_CONST(0.004094881350902), FRAC_CONST(0.032014037755158) },
- { FRAC_CONST(0.003990093917884), FRAC_CONST(0.032027266776813) },
- { FRAC_CONST(0.003885263754166), FRAC_CONST(0.032040152812170) },
- { FRAC_CONST(0.003780391982394), FRAC_CONST(0.032052695723232) },
- { FRAC_CONST(0.003675479725661), FRAC_CONST(0.032064895375674) },
- { FRAC_CONST(0.003570528107494), FRAC_CONST(0.032076751638847) },
- { FRAC_CONST(0.003465538251839), FRAC_CONST(0.032088264385780) },
- { FRAC_CONST(0.003360511283053), FRAC_CONST(0.032099433493181) },
- { FRAC_CONST(0.003255448325892), FRAC_CONST(0.032110258841438) },
- { FRAC_CONST(0.003150350505494), FRAC_CONST(0.032120740314619) },
- { FRAC_CONST(0.003045218947373), FRAC_CONST(0.032130877800478) },
- { FRAC_CONST(0.002940054777404), FRAC_CONST(0.032140671190449) },
- { FRAC_CONST(0.002834859121810), FRAC_CONST(0.032150120379653) },
- { FRAC_CONST(0.002729633107153), FRAC_CONST(0.032159225266897) },
- { FRAC_CONST(0.002624377860318), FRAC_CONST(0.032167985754674) },
- { FRAC_CONST(0.002519094508504), FRAC_CONST(0.032176401749168) },
- { FRAC_CONST(0.002413784179212), FRAC_CONST(0.032184473160250) },
- { FRAC_CONST(0.002308448000231), FRAC_CONST(0.032192199901481) },
- { FRAC_CONST(0.002203087099626), FRAC_CONST(0.032199581890114) },
- { FRAC_CONST(0.002097702605728), FRAC_CONST(0.032206619047093) },
- { FRAC_CONST(0.001992295647121), FRAC_CONST(0.032213311297057) },
- { FRAC_CONST(0.001886867352628), FRAC_CONST(0.032219658568338) },
- { FRAC_CONST(0.001781418851302), FRAC_CONST(0.032225660792960) },
- { FRAC_CONST(0.001675951272410), FRAC_CONST(0.032231317906644) },
- { FRAC_CONST(0.001570465745428), FRAC_CONST(0.032236629848809) },
- { FRAC_CONST(0.001464963400018), FRAC_CONST(0.032241596562566) },
- { FRAC_CONST(0.001359445366028), FRAC_CONST(0.032246217994727) },
- { FRAC_CONST(0.001253912773470), FRAC_CONST(0.032250494095799) },
- { FRAC_CONST(0.001148366752513), FRAC_CONST(0.032254424819990) },
- { FRAC_CONST(0.001042808433471), FRAC_CONST(0.032258010125204) },
- { FRAC_CONST(0.000937238946789), FRAC_CONST(0.032261249973045) },
- { FRAC_CONST(0.000831659423030), FRAC_CONST(0.032264144328817) },
- { FRAC_CONST(0.000726070992868), FRAC_CONST(0.032266693161525) },
- { FRAC_CONST(0.000620474787068), FRAC_CONST(0.032268896443871) },
- { FRAC_CONST(0.000514871936481), FRAC_CONST(0.032270754152261) },
- { FRAC_CONST(0.000409263572030), FRAC_CONST(0.032272266266801) },
- { FRAC_CONST(0.000303650824695), FRAC_CONST(0.032273432771295) },
- { FRAC_CONST(0.000198034825504), FRAC_CONST(0.032274253653254) },
- { FRAC_CONST(0.000092416705518), FRAC_CONST(0.032274728903884) }
- };
+/* 480 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1920[] =
+{
+ { FRAC_CONST(0.032274858518097), FRAC_CONST(0.000013202404176) },
+ { FRAC_CONST(0.032274642494505), FRAC_CONST(0.000118821372483) },
+ { FRAC_CONST(0.032274080835421), FRAC_CONST(0.000224439068308) },
+ { FRAC_CONST(0.032273173546860), FRAC_CONST(0.000330054360572) },
+ { FRAC_CONST(0.032271920638538), FRAC_CONST(0.000435666118218) },
+ { FRAC_CONST(0.032270322123873), FRAC_CONST(0.000541273210231) },
+ { FRAC_CONST(0.032268378019984), FRAC_CONST(0.000646874505642) },
+ { FRAC_CONST(0.032266088347691), FRAC_CONST(0.000752468873546) },
+ { FRAC_CONST(0.032263453131514), FRAC_CONST(0.000858055183114) },
+ { FRAC_CONST(0.032260472399674), FRAC_CONST(0.000963632303600) },
+ { FRAC_CONST(0.032257146184092), FRAC_CONST(0.001069199104358) },
+ { FRAC_CONST(0.032253474520390), FRAC_CONST(0.001174754454853) },
+ { FRAC_CONST(0.032249457447888), FRAC_CONST(0.001280297224671) },
+ { FRAC_CONST(0.032245095009606), FRAC_CONST(0.001385826283535) },
+ { FRAC_CONST(0.032240387252262), FRAC_CONST(0.001491340501313) },
+ { FRAC_CONST(0.032235334226272), FRAC_CONST(0.001596838748031) },
+ { FRAC_CONST(0.032229935985750), FRAC_CONST(0.001702319893890) },
+ { FRAC_CONST(0.032224192588507), FRAC_CONST(0.001807782809271) },
+ { FRAC_CONST(0.032218104096050), FRAC_CONST(0.001913226364749) },
+ { FRAC_CONST(0.032211670573582), FRAC_CONST(0.002018649431111) },
+ { FRAC_CONST(0.032204892090000), FRAC_CONST(0.002124050879359) },
+ { FRAC_CONST(0.032197768717898), FRAC_CONST(0.002229429580728) },
+ { FRAC_CONST(0.032190300533560), FRAC_CONST(0.002334784406698) },
+ { FRAC_CONST(0.032182487616965), FRAC_CONST(0.002440114229003) },
+ { FRAC_CONST(0.032174330051782), FRAC_CONST(0.002545417919644) },
+ { FRAC_CONST(0.032165827925374), FRAC_CONST(0.002650694350905) },
+ { FRAC_CONST(0.032156981328790), FRAC_CONST(0.002755942395358) },
+ { FRAC_CONST(0.032147790356771), FRAC_CONST(0.002861160925883) },
+ { FRAC_CONST(0.032138255107744), FRAC_CONST(0.002966348815672) },
+ { FRAC_CONST(0.032128375683825), FRAC_CONST(0.003071504938250) },
+ { FRAC_CONST(0.032118152190814), FRAC_CONST(0.003176628167476) },
+ { FRAC_CONST(0.032107584738196), FRAC_CONST(0.003281717377568) },
+ { FRAC_CONST(0.032096673439141), FRAC_CONST(0.003386771443102) },
+ { FRAC_CONST(0.032085418410500), FRAC_CONST(0.003491789239036) },
+ { FRAC_CONST(0.032073819772804), FRAC_CONST(0.003596769640711) },
+ { FRAC_CONST(0.032061877650267), FRAC_CONST(0.003701711523874) },
+ { FRAC_CONST(0.032049592170778), FRAC_CONST(0.003806613764680) },
+ { FRAC_CONST(0.032036963465906), FRAC_CONST(0.003911475239711) },
+ { FRAC_CONST(0.032023991670893), FRAC_CONST(0.004016294825985) },
+ { FRAC_CONST(0.032010676924657), FRAC_CONST(0.004121071400967) },
+ { FRAC_CONST(0.031997019369789), FRAC_CONST(0.004225803842586) },
+ { FRAC_CONST(0.031983019152549), FRAC_CONST(0.004330491029241) },
+ { FRAC_CONST(0.031968676422869), FRAC_CONST(0.004435131839816) },
+ { FRAC_CONST(0.031953991334348), FRAC_CONST(0.004539725153692) },
+ { FRAC_CONST(0.031938964044252), FRAC_CONST(0.004644269850758) },
+ { FRAC_CONST(0.031923594713510), FRAC_CONST(0.004748764811426) },
+ { FRAC_CONST(0.031907883506716), FRAC_CONST(0.004853208916638) },
+ { FRAC_CONST(0.031891830592124), FRAC_CONST(0.004957601047881) },
+ { FRAC_CONST(0.031875436141648), FRAC_CONST(0.005061940087200) },
+ { FRAC_CONST(0.031858700330859), FRAC_CONST(0.005166224917208) },
+ { FRAC_CONST(0.031841623338985), FRAC_CONST(0.005270454421097) },
+ { FRAC_CONST(0.031824205348907), FRAC_CONST(0.005374627482653) },
+ { FRAC_CONST(0.031806446547156), FRAC_CONST(0.005478742986267) },
+ { FRAC_CONST(0.031788347123916), FRAC_CONST(0.005582799816945) },
+ { FRAC_CONST(0.031769907273017), FRAC_CONST(0.005686796860323) },
+ { FRAC_CONST(0.031751127191935), FRAC_CONST(0.005790733002674) },
+ { FRAC_CONST(0.031732007081789), FRAC_CONST(0.005894607130928) },
+ { FRAC_CONST(0.031712547147340), FRAC_CONST(0.005998418132675) },
+ { FRAC_CONST(0.031692747596989), FRAC_CONST(0.006102164896182) },
+ { FRAC_CONST(0.031672608642773), FRAC_CONST(0.006205846310406) },
+ { FRAC_CONST(0.031652130500364), FRAC_CONST(0.006309461265002) },
+ { FRAC_CONST(0.031631313389067), FRAC_CONST(0.006413008650337) },
+ { FRAC_CONST(0.031610157531816), FRAC_CONST(0.006516487357501) },
+ { FRAC_CONST(0.031588663155172), FRAC_CONST(0.006619896278321) },
+ { FRAC_CONST(0.031566830489325), FRAC_CONST(0.006723234305370) },
+ { FRAC_CONST(0.031544659768083), FRAC_CONST(0.006826500331981) },
+ { FRAC_CONST(0.031522151228878), FRAC_CONST(0.006929693252258) },
+ { FRAC_CONST(0.031499305112758), FRAC_CONST(0.007032811961088) },
+ { FRAC_CONST(0.031476121664387), FRAC_CONST(0.007135855354151) },
+ { FRAC_CONST(0.031452601132040), FRAC_CONST(0.007238822327937) },
+ { FRAC_CONST(0.031428743767604), FRAC_CONST(0.007341711779751) },
+ { FRAC_CONST(0.031404549826572), FRAC_CONST(0.007444522607730) },
+ { FRAC_CONST(0.031380019568042), FRAC_CONST(0.007547253710853) },
+ { FRAC_CONST(0.031355153254712), FRAC_CONST(0.007649903988952) },
+ { FRAC_CONST(0.031329951152882), FRAC_CONST(0.007752472342725) },
+ { FRAC_CONST(0.031304413532445), FRAC_CONST(0.007854957673748) },
+ { FRAC_CONST(0.031278540666888), FRAC_CONST(0.007957358884484) },
+ { FRAC_CONST(0.031252332833290), FRAC_CONST(0.008059674878300) },
+ { FRAC_CONST(0.031225790312316), FRAC_CONST(0.008161904559473) },
+ { FRAC_CONST(0.031198913388214), FRAC_CONST(0.008264046833205) },
+ { FRAC_CONST(0.031171702348814), FRAC_CONST(0.008366100605636) },
+ { FRAC_CONST(0.031144157485525), FRAC_CONST(0.008468064783849) },
+ { FRAC_CONST(0.031116279093331), FRAC_CONST(0.008569938275893) },
+ { FRAC_CONST(0.031088067470786), FRAC_CONST(0.008671719990782) },
+ { FRAC_CONST(0.031059522920014), FRAC_CONST(0.008773408838517) },
+ { FRAC_CONST(0.031030645746705), FRAC_CONST(0.008875003730092) },
+ { FRAC_CONST(0.031001436260110), FRAC_CONST(0.008976503577507) },
+ { FRAC_CONST(0.030971894773039), FRAC_CONST(0.009077907293780) },
+ { FRAC_CONST(0.030942021601857), FRAC_CONST(0.009179213792959) },
+ { FRAC_CONST(0.030911817066483), FRAC_CONST(0.009280421990133) },
+ { FRAC_CONST(0.030881281490382), FRAC_CONST(0.009381530801444) },
+ { FRAC_CONST(0.030850415200566), FRAC_CONST(0.009482539144097) },
+ { FRAC_CONST(0.030819218527589), FRAC_CONST(0.009583445936373) },
+ { FRAC_CONST(0.030787691805541), FRAC_CONST(0.009684250097643) },
+ { FRAC_CONST(0.030755835372048), FRAC_CONST(0.009784950548375) },
+ { FRAC_CONST(0.030723649568268), FRAC_CONST(0.009885546210147) },
+ { FRAC_CONST(0.030691134738883), FRAC_CONST(0.009986036005661) },
+ { FRAC_CONST(0.030658291232103), FRAC_CONST(0.010086418858753) },
+ { FRAC_CONST(0.030625119399655), FRAC_CONST(0.010186693694402) },
+ { FRAC_CONST(0.030591619596781), FRAC_CONST(0.010286859438745) },
+ { FRAC_CONST(0.030557792182239), FRAC_CONST(0.010386915019088) },
+ { FRAC_CONST(0.030523637518292), FRAC_CONST(0.010486859363916) },
+ { FRAC_CONST(0.030489155970710), FRAC_CONST(0.010586691402906) },
+ { FRAC_CONST(0.030454347908763), FRAC_CONST(0.010686410066936) },
+ { FRAC_CONST(0.030419213705216), FRAC_CONST(0.010786014288099) },
+ { FRAC_CONST(0.030383753736329), FRAC_CONST(0.010885502999714) },
+ { FRAC_CONST(0.030347968381849), FRAC_CONST(0.010984875136338) },
+ { FRAC_CONST(0.030311858025010), FRAC_CONST(0.011084129633775) },
+ { FRAC_CONST(0.030275423052523), FRAC_CONST(0.011183265429088) },
+ { FRAC_CONST(0.030238663854579), FRAC_CONST(0.011282281460612) },
+ { FRAC_CONST(0.030201580824838), FRAC_CONST(0.011381176667967) },
+ { FRAC_CONST(0.030164174360430), FRAC_CONST(0.011479949992062) },
+ { FRAC_CONST(0.030126444861948), FRAC_CONST(0.011578600375117) },
+ { FRAC_CONST(0.030088392733446), FRAC_CONST(0.011677126760663) },
+ { FRAC_CONST(0.030050018382430), FRAC_CONST(0.011775528093563) },
+ { FRAC_CONST(0.030011322219859), FRAC_CONST(0.011873803320018) },
+ { FRAC_CONST(0.029972304660138), FRAC_CONST(0.011971951387578) },
+ { FRAC_CONST(0.029932966121114), FRAC_CONST(0.012069971245157) },
+ { FRAC_CONST(0.029893307024070), FRAC_CONST(0.012167861843041) },
+ { FRAC_CONST(0.029853327793724), FRAC_CONST(0.012265622132901) },
+ { FRAC_CONST(0.029813028858222), FRAC_CONST(0.012363251067801) },
+ { FRAC_CONST(0.029772410649132), FRAC_CONST(0.012460747602215) },
+ { FRAC_CONST(0.029731473601443), FRAC_CONST(0.012558110692033) },
+ { FRAC_CONST(0.029690218153558), FRAC_CONST(0.012655339294575) },
+ { FRAC_CONST(0.029648644747289), FRAC_CONST(0.012752432368600) },
+ { FRAC_CONST(0.029606753827855), FRAC_CONST(0.012849388874320) },
+ { FRAC_CONST(0.029564545843872), FRAC_CONST(0.012946207773407) },
+ { FRAC_CONST(0.029522021247356), FRAC_CONST(0.013042888029011) },
+ { FRAC_CONST(0.029479180493710), FRAC_CONST(0.013139428605762) },
+ { FRAC_CONST(0.029436024041725), FRAC_CONST(0.013235828469789) },
+ { FRAC_CONST(0.029392552353570), FRAC_CONST(0.013332086588727) },
+ { FRAC_CONST(0.029348765894794), FRAC_CONST(0.013428201931728) },
+ { FRAC_CONST(0.029304665134313), FRAC_CONST(0.013524173469475) },
+ { FRAC_CONST(0.029260250544412), FRAC_CONST(0.013620000174189) },
+ { FRAC_CONST(0.029215522600735), FRAC_CONST(0.013715681019643) },
+ { FRAC_CONST(0.029170481782283), FRAC_CONST(0.013811214981173) },
+ { FRAC_CONST(0.029125128571406), FRAC_CONST(0.013906601035686) },
+ { FRAC_CONST(0.029079463453801), FRAC_CONST(0.014001838161674) },
+ { FRAC_CONST(0.029033486918505), FRAC_CONST(0.014096925339225) },
+ { FRAC_CONST(0.028987199457889), FRAC_CONST(0.014191861550031) },
+ { FRAC_CONST(0.028940601567655), FRAC_CONST(0.014286645777401) },
+ { FRAC_CONST(0.028893693746829), FRAC_CONST(0.014381277006273) },
+ { FRAC_CONST(0.028846476497755), FRAC_CONST(0.014475754223221) },
+ { FRAC_CONST(0.028798950326094), FRAC_CONST(0.014570076416472) },
+ { FRAC_CONST(0.028751115740811), FRAC_CONST(0.014664242575910) },
+ { FRAC_CONST(0.028702973254178), FRAC_CONST(0.014758251693091) },
+ { FRAC_CONST(0.028654523381760), FRAC_CONST(0.014852102761253) },
+ { FRAC_CONST(0.028605766642418), FRAC_CONST(0.014945794775326) },
+ { FRAC_CONST(0.028556703558297), FRAC_CONST(0.015039326731945) },
+ { FRAC_CONST(0.028507334654823), FRAC_CONST(0.015132697629457) },
+ { FRAC_CONST(0.028457660460698), FRAC_CONST(0.015225906467935) },
+ { FRAC_CONST(0.028407681507891), FRAC_CONST(0.015318952249187) },
+ { FRAC_CONST(0.028357398331639), FRAC_CONST(0.015411833976768) },
+ { FRAC_CONST(0.028306811470432), FRAC_CONST(0.015504550655988) },
+ { FRAC_CONST(0.028255921466016), FRAC_CONST(0.015597101293927) },
+ { FRAC_CONST(0.028204728863381), FRAC_CONST(0.015689484899442) },
+ { FRAC_CONST(0.028153234210760), FRAC_CONST(0.015781700483179) },
+ { FRAC_CONST(0.028101438059619), FRAC_CONST(0.015873747057582) },
+ { FRAC_CONST(0.028049340964652), FRAC_CONST(0.015965623636907) },
+ { FRAC_CONST(0.027996943483779), FRAC_CONST(0.016057329237229) },
+ { FRAC_CONST(0.027944246178133), FRAC_CONST(0.016148862876456) },
+ { FRAC_CONST(0.027891249612061), FRAC_CONST(0.016240223574335) },
+ { FRAC_CONST(0.027837954353113), FRAC_CONST(0.016331410352467) },
+ { FRAC_CONST(0.027784360972039), FRAC_CONST(0.016422422234315) },
+ { FRAC_CONST(0.027730470042780), FRAC_CONST(0.016513258245214) },
+ { FRAC_CONST(0.027676282142466), FRAC_CONST(0.016603917412384) },
+ { FRAC_CONST(0.027621797851405), FRAC_CONST(0.016694398764938) },
+ { FRAC_CONST(0.027567017753080), FRAC_CONST(0.016784701333894) },
+ { FRAC_CONST(0.027511942434143), FRAC_CONST(0.016874824152183) },
+ { FRAC_CONST(0.027456572484404), FRAC_CONST(0.016964766254662) },
+ { FRAC_CONST(0.027400908496833), FRAC_CONST(0.017054526678124) },
+ { FRAC_CONST(0.027344951067546), FRAC_CONST(0.017144104461307) },
+ { FRAC_CONST(0.027288700795801), FRAC_CONST(0.017233498644904) },
+ { FRAC_CONST(0.027232158283994), FRAC_CONST(0.017322708271577) },
+ { FRAC_CONST(0.027175324137651), FRAC_CONST(0.017411732385960) },
+ { FRAC_CONST(0.027118198965418), FRAC_CONST(0.017500570034678) },
+ { FRAC_CONST(0.027060783379060), FRAC_CONST(0.017589220266351) },
+ { FRAC_CONST(0.027003077993454), FRAC_CONST(0.017677682131607) },
+ { FRAC_CONST(0.026945083426576), FRAC_CONST(0.017765954683088) },
+ { FRAC_CONST(0.026886800299502), FRAC_CONST(0.017854036975468) },
+ { FRAC_CONST(0.026828229236397), FRAC_CONST(0.017941928065456) },
+ { FRAC_CONST(0.026769370864511), FRAC_CONST(0.018029627011808) },
+ { FRAC_CONST(0.026710225814170), FRAC_CONST(0.018117132875340) },
+ { FRAC_CONST(0.026650794718768), FRAC_CONST(0.018204444718934) },
+ { FRAC_CONST(0.026591078214767), FRAC_CONST(0.018291561607551) },
+ { FRAC_CONST(0.026531076941680), FRAC_CONST(0.018378482608238) },
+ { FRAC_CONST(0.026470791542075), FRAC_CONST(0.018465206790142) },
+ { FRAC_CONST(0.026410222661558), FRAC_CONST(0.018551733224515) },
+ { FRAC_CONST(0.026349370948775), FRAC_CONST(0.018638060984730) },
+ { FRAC_CONST(0.026288237055398), FRAC_CONST(0.018724189146286) },
+ { FRAC_CONST(0.026226821636121), FRAC_CONST(0.018810116786819) },
+ { FRAC_CONST(0.026165125348656), FRAC_CONST(0.018895842986112) },
+ { FRAC_CONST(0.026103148853718), FRAC_CONST(0.018981366826109) },
+ { FRAC_CONST(0.026040892815028), FRAC_CONST(0.019066687390916) },
+ { FRAC_CONST(0.025978357899296), FRAC_CONST(0.019151803766819) },
+ { FRAC_CONST(0.025915544776223), FRAC_CONST(0.019236715042290) },
+ { FRAC_CONST(0.025852454118485), FRAC_CONST(0.019321420307998) },
+ { FRAC_CONST(0.025789086601733), FRAC_CONST(0.019405918656817) },
+ { FRAC_CONST(0.025725442904582), FRAC_CONST(0.019490209183837) },
+ { FRAC_CONST(0.025661523708606), FRAC_CONST(0.019574290986376) },
+ { FRAC_CONST(0.025597329698327), FRAC_CONST(0.019658163163984) },
+ { FRAC_CONST(0.025532861561211), FRAC_CONST(0.019741824818458) },
+ { FRAC_CONST(0.025468119987662), FRAC_CONST(0.019825275053848) },
+ { FRAC_CONST(0.025403105671008), FRAC_CONST(0.019908512976470) },
+ { FRAC_CONST(0.025337819307501), FRAC_CONST(0.019991537694913) },
+ { FRAC_CONST(0.025272261596305), FRAC_CONST(0.020074348320047) },
+ { FRAC_CONST(0.025206433239491), FRAC_CONST(0.020156943965039) },
+ { FRAC_CONST(0.025140334942028), FRAC_CONST(0.020239323745355) },
+ { FRAC_CONST(0.025073967411776), FRAC_CONST(0.020321486778774) },
+ { FRAC_CONST(0.025007331359476), FRAC_CONST(0.020403432185395) },
+ { FRAC_CONST(0.024940427498748), FRAC_CONST(0.020485159087650) },
+ { FRAC_CONST(0.024873256546079), FRAC_CONST(0.020566666610309) },
+ { FRAC_CONST(0.024805819220816), FRAC_CONST(0.020647953880491) },
+ { FRAC_CONST(0.024738116245157), FRAC_CONST(0.020729020027676) },
+ { FRAC_CONST(0.024670148344147), FRAC_CONST(0.020809864183709) },
+ { FRAC_CONST(0.024601916245669), FRAC_CONST(0.020890485482816) },
+ { FRAC_CONST(0.024533420680433), FRAC_CONST(0.020970883061607) },
+ { FRAC_CONST(0.024464662381971), FRAC_CONST(0.021051056059087) },
+ { FRAC_CONST(0.024395642086630), FRAC_CONST(0.021131003616670) },
+ { FRAC_CONST(0.024326360533561), FRAC_CONST(0.021210724878181) },
+ { FRAC_CONST(0.024256818464715), FRAC_CONST(0.021290218989868) },
+ { FRAC_CONST(0.024187016624830), FRAC_CONST(0.021369485100415) },
+ { FRAC_CONST(0.024116955761430), FRAC_CONST(0.021448522360944) },
+ { FRAC_CONST(0.024046636624808), FRAC_CONST(0.021527329925030) },
+ { FRAC_CONST(0.023976059968027), FRAC_CONST(0.021605906948708) },
+ { FRAC_CONST(0.023905226546906), FRAC_CONST(0.021684252590480) },
+ { FRAC_CONST(0.023834137120014), FRAC_CONST(0.021762366011328) },
+ { FRAC_CONST(0.023762792448662), FRAC_CONST(0.021840246374720) },
+ { FRAC_CONST(0.023691193296893), FRAC_CONST(0.021917892846620) },
+ { FRAC_CONST(0.023619340431478), FRAC_CONST(0.021995304595495) },
+ { FRAC_CONST(0.023547234621902), FRAC_CONST(0.022072480792330) },
+ { FRAC_CONST(0.023474876640361), FRAC_CONST(0.022149420610628) },
+ { FRAC_CONST(0.023402267261751), FRAC_CONST(0.022226123226426) },
+ { FRAC_CONST(0.023329407263659), FRAC_CONST(0.022302587818300) },
+ { FRAC_CONST(0.023256297426359), FRAC_CONST(0.022378813567377) },
+ { FRAC_CONST(0.023182938532797), FRAC_CONST(0.022454799657339) },
+ { FRAC_CONST(0.023109331368588), FRAC_CONST(0.022530545274437) },
+ { FRAC_CONST(0.023035476722006), FRAC_CONST(0.022606049607496) },
+ { FRAC_CONST(0.022961375383975), FRAC_CONST(0.022681311847926) },
+ { FRAC_CONST(0.022887028148061), FRAC_CONST(0.022756331189727) },
+ { FRAC_CONST(0.022812435810462), FRAC_CONST(0.022831106829504) },
+ { FRAC_CONST(0.022737599170003), FRAC_CONST(0.022905637966469) },
+ { FRAC_CONST(0.022662519028125), FRAC_CONST(0.022979923802453) },
+ { FRAC_CONST(0.022587196188874), FRAC_CONST(0.023053963541915) },
+ { FRAC_CONST(0.022511631458899), FRAC_CONST(0.023127756391950) },
+ { FRAC_CONST(0.022435825647437), FRAC_CONST(0.023201301562294) },
+ { FRAC_CONST(0.022359779566306), FRAC_CONST(0.023274598265338) },
+ { FRAC_CONST(0.022283494029900), FRAC_CONST(0.023347645716133) },
+ { FRAC_CONST(0.022206969855176), FRAC_CONST(0.023420443132400) },
+ { FRAC_CONST(0.022130207861645), FRAC_CONST(0.023492989734537) },
+ { FRAC_CONST(0.022053208871367), FRAC_CONST(0.023565284745628) },
+ { FRAC_CONST(0.021975973708940), FRAC_CONST(0.023637327391451) },
+ { FRAC_CONST(0.021898503201489), FRAC_CONST(0.023709116900488) },
+ { FRAC_CONST(0.021820798178663), FRAC_CONST(0.023780652503931) },
+ { FRAC_CONST(0.021742859472618), FRAC_CONST(0.023851933435691) },
+ { FRAC_CONST(0.021664687918017), FRAC_CONST(0.023922958932406) },
+ { FRAC_CONST(0.021586284352013), FRAC_CONST(0.023993728233451) },
+ { FRAC_CONST(0.021507649614247), FRAC_CONST(0.024064240580942) },
+ { FRAC_CONST(0.021428784546832), FRAC_CONST(0.024134495219750) },
+ { FRAC_CONST(0.021349689994350), FRAC_CONST(0.024204491397504) },
+ { FRAC_CONST(0.021270366803840), FRAC_CONST(0.024274228364600) },
+ { FRAC_CONST(0.021190815824791), FRAC_CONST(0.024343705374213) },
+ { FRAC_CONST(0.021111037909128), FRAC_CONST(0.024412921682298) },
+ { FRAC_CONST(0.021031033911210), FRAC_CONST(0.024481876547605) },
+ { FRAC_CONST(0.020950804687815), FRAC_CONST(0.024550569231683) },
+ { FRAC_CONST(0.020870351098134), FRAC_CONST(0.024618998998889) },
+ { FRAC_CONST(0.020789674003759), FRAC_CONST(0.024687165116394) },
+ { FRAC_CONST(0.020708774268678), FRAC_CONST(0.024755066854194) },
+ { FRAC_CONST(0.020627652759262), FRAC_CONST(0.024822703485116) },
+ { FRAC_CONST(0.020546310344257), FRAC_CONST(0.024890074284826) },
+ { FRAC_CONST(0.020464747894775), FRAC_CONST(0.024957178531837) },
+ { FRAC_CONST(0.020382966284284), FRAC_CONST(0.025024015507516) },
+ { FRAC_CONST(0.020300966388600), FRAC_CONST(0.025090584496093) },
+ { FRAC_CONST(0.020218749085876), FRAC_CONST(0.025156884784668) },
+ { FRAC_CONST(0.020136315256592), FRAC_CONST(0.025222915663218) },
+ { FRAC_CONST(0.020053665783549), FRAC_CONST(0.025288676424605) },
+ { FRAC_CONST(0.019970801551857), FRAC_CONST(0.025354166364584) },
+ { FRAC_CONST(0.019887723448925), FRAC_CONST(0.025419384781811) },
+ { FRAC_CONST(0.019804432364452), FRAC_CONST(0.025484330977848) },
+ { FRAC_CONST(0.019720929190419), FRAC_CONST(0.025549004257175) },
+ { FRAC_CONST(0.019637214821078), FRAC_CONST(0.025613403927192) },
+ { FRAC_CONST(0.019553290152943), FRAC_CONST(0.025677529298230) },
+ { FRAC_CONST(0.019469156084779), FRAC_CONST(0.025741379683559) },
+ { FRAC_CONST(0.019384813517595), FRAC_CONST(0.025804954399392) },
+ { FRAC_CONST(0.019300263354632), FRAC_CONST(0.025868252764895) },
+ { FRAC_CONST(0.019215506501354), FRAC_CONST(0.025931274102193) },
+ { FRAC_CONST(0.019130543865439), FRAC_CONST(0.025994017736379) },
+ { FRAC_CONST(0.019045376356769), FRAC_CONST(0.026056482995518) },
+ { FRAC_CONST(0.018960004887419), FRAC_CONST(0.026118669210657) },
+ { FRAC_CONST(0.018874430371648), FRAC_CONST(0.026180575715833) },
+ { FRAC_CONST(0.018788653725892), FRAC_CONST(0.026242201848076) },
+ { FRAC_CONST(0.018702675868750), FRAC_CONST(0.026303546947421) },
+ { FRAC_CONST(0.018616497720974), FRAC_CONST(0.026364610356909) },
+ { FRAC_CONST(0.018530120205464), FRAC_CONST(0.026425391422602) },
+ { FRAC_CONST(0.018443544247254), FRAC_CONST(0.026485889493583) },
+ { FRAC_CONST(0.018356770773502), FRAC_CONST(0.026546103921965) },
+ { FRAC_CONST(0.018269800713483), FRAC_CONST(0.026606034062902) },
+ { FRAC_CONST(0.018182634998576), FRAC_CONST(0.026665679274589) },
+ { FRAC_CONST(0.018095274562256), FRAC_CONST(0.026725038918274) },
+ { FRAC_CONST(0.018007720340083), FRAC_CONST(0.026784112358263) },
+ { FRAC_CONST(0.017919973269692), FRAC_CONST(0.026842898961926) },
+ { FRAC_CONST(0.017832034290785), FRAC_CONST(0.026901398099707) },
+ { FRAC_CONST(0.017743904345116), FRAC_CONST(0.026959609145127) },
+ { FRAC_CONST(0.017655584376488), FRAC_CONST(0.027017531474792) },
+ { FRAC_CONST(0.017567075330734), FRAC_CONST(0.027075164468401) },
+ { FRAC_CONST(0.017478378155718), FRAC_CONST(0.027132507508750) },
+ { FRAC_CONST(0.017389493801313), FRAC_CONST(0.027189559981742) },
+ { FRAC_CONST(0.017300423219401), FRAC_CONST(0.027246321276391) },
+ { FRAC_CONST(0.017211167363854), FRAC_CONST(0.027302790784828) },
+ { FRAC_CONST(0.017121727190533), FRAC_CONST(0.027358967902310) },
+ { FRAC_CONST(0.017032103657269), FRAC_CONST(0.027414852027226) },
+ { FRAC_CONST(0.016942297723858), FRAC_CONST(0.027470442561102) },
+ { FRAC_CONST(0.016852310352050), FRAC_CONST(0.027525738908608) },
+ { FRAC_CONST(0.016762142505537), FRAC_CONST(0.027580740477564) },
+ { FRAC_CONST(0.016671795149944), FRAC_CONST(0.027635446678948) },
+ { FRAC_CONST(0.016581269252819), FRAC_CONST(0.027689856926900) },
+ { FRAC_CONST(0.016490565783622), FRAC_CONST(0.027743970638730) },
+ { FRAC_CONST(0.016399685713714), FRAC_CONST(0.027797787234924) },
+ { FRAC_CONST(0.016308630016347), FRAC_CONST(0.027851306139149) },
+ { FRAC_CONST(0.016217399666655), FRAC_CONST(0.027904526778260) },
+ { FRAC_CONST(0.016125995641641), FRAC_CONST(0.027957448582309) },
+ { FRAC_CONST(0.016034418920170), FRAC_CONST(0.028010070984544) },
+ { FRAC_CONST(0.015942670482954), FRAC_CONST(0.028062393421421) },
+ { FRAC_CONST(0.015850751312545), FRAC_CONST(0.028114415332610) },
+ { FRAC_CONST(0.015758662393324), FRAC_CONST(0.028166136160998) },
+ { FRAC_CONST(0.015666404711489), FRAC_CONST(0.028217555352697) },
+ { FRAC_CONST(0.015573979255046), FRAC_CONST(0.028268672357047) },
+ { FRAC_CONST(0.015481387013797), FRAC_CONST(0.028319486626627) },
+ { FRAC_CONST(0.015388628979331), FRAC_CONST(0.028369997617257) },
+ { FRAC_CONST(0.015295706145012), FRAC_CONST(0.028420204788004) },
+ { FRAC_CONST(0.015202619505968), FRAC_CONST(0.028470107601191) },
+ { FRAC_CONST(0.015109370059084), FRAC_CONST(0.028519705522399) },
+ { FRAC_CONST(0.015015958802984), FRAC_CONST(0.028568998020472) },
+ { FRAC_CONST(0.014922386738030), FRAC_CONST(0.028617984567529) },
+ { FRAC_CONST(0.014828654866302), FRAC_CONST(0.028666664638963) },
+ { FRAC_CONST(0.014734764191593), FRAC_CONST(0.028715037713449) },
+ { FRAC_CONST(0.014640715719398), FRAC_CONST(0.028763103272951) },
+ { FRAC_CONST(0.014546510456900), FRAC_CONST(0.028810860802724) },
+ { FRAC_CONST(0.014452149412962), FRAC_CONST(0.028858309791325) },
+ { FRAC_CONST(0.014357633598114), FRAC_CONST(0.028905449730613) },
+ { FRAC_CONST(0.014262964024545), FRAC_CONST(0.028952280115756) },
+ { FRAC_CONST(0.014168141706090), FRAC_CONST(0.028998800445240) },
+ { FRAC_CONST(0.014073167658220), FRAC_CONST(0.029045010220868) },
+ { FRAC_CONST(0.013978042898030), FRAC_CONST(0.029090908947771) },
+ { FRAC_CONST(0.013882768444231), FRAC_CONST(0.029136496134411) },
+ { FRAC_CONST(0.013787345317136), FRAC_CONST(0.029181771292585) },
+ { FRAC_CONST(0.013691774538648), FRAC_CONST(0.029226733937433) },
+ { FRAC_CONST(0.013596057132255), FRAC_CONST(0.029271383587441) },
+ { FRAC_CONST(0.013500194123014), FRAC_CONST(0.029315719764447) },
+ { FRAC_CONST(0.013404186537539), FRAC_CONST(0.029359741993647) },
+ { FRAC_CONST(0.013308035403995), FRAC_CONST(0.029403449803598) },
+ { FRAC_CONST(0.013211741752084), FRAC_CONST(0.029446842726223) },
+ { FRAC_CONST(0.013115306613032), FRAC_CONST(0.029489920296820) },
+ { FRAC_CONST(0.013018731019584), FRAC_CONST(0.029532682054063) },
+ { FRAC_CONST(0.012922016005985), FRAC_CONST(0.029575127540008) },
+ { FRAC_CONST(0.012825162607977), FRAC_CONST(0.029617256300097) },
+ { FRAC_CONST(0.012728171862781), FRAC_CONST(0.029659067883165) },
+ { FRAC_CONST(0.012631044809089), FRAC_CONST(0.029700561841444) },
+ { FRAC_CONST(0.012533782487056), FRAC_CONST(0.029741737730567) },
+ { FRAC_CONST(0.012436385938281), FRAC_CONST(0.029782595109573) },
+ { FRAC_CONST(0.012338856205805), FRAC_CONST(0.029823133540913) },
+ { FRAC_CONST(0.012241194334091), FRAC_CONST(0.029863352590452) },
+ { FRAC_CONST(0.012143401369021), FRAC_CONST(0.029903251827477) },
+ { FRAC_CONST(0.012045478357878), FRAC_CONST(0.029942830824699) },
+ { FRAC_CONST(0.011947426349339), FRAC_CONST(0.029982089158259) },
+ { FRAC_CONST(0.011849246393462), FRAC_CONST(0.030021026407731) },
+ { FRAC_CONST(0.011750939541676), FRAC_CONST(0.030059642156129) },
+ { FRAC_CONST(0.011652506846768), FRAC_CONST(0.030097935989909) },
+ { FRAC_CONST(0.011553949362874), FRAC_CONST(0.030135907498976) },
+ { FRAC_CONST(0.011455268145464), FRAC_CONST(0.030173556276684) },
+ { FRAC_CONST(0.011356464251335), FRAC_CONST(0.030210881919845) },
+ { FRAC_CONST(0.011257538738598), FRAC_CONST(0.030247884028732) },
+ { FRAC_CONST(0.011158492666665), FRAC_CONST(0.030284562207083) },
+ { FRAC_CONST(0.011059327096240), FRAC_CONST(0.030320916062102) },
+ { FRAC_CONST(0.010960043089307), FRAC_CONST(0.030356945204470) },
+ { FRAC_CONST(0.010860641709118), FRAC_CONST(0.030392649248343) },
+ { FRAC_CONST(0.010761124020182), FRAC_CONST(0.030428027811361) },
+ { FRAC_CONST(0.010661491088253), FRAC_CONST(0.030463080514646) },
+ { FRAC_CONST(0.010561743980319), FRAC_CONST(0.030497806982812) },
+ { FRAC_CONST(0.010461883764593), FRAC_CONST(0.030532206843968) },
+ { FRAC_CONST(0.010361911510496), FRAC_CONST(0.030566279729717) },
+ { FRAC_CONST(0.010261828288652), FRAC_CONST(0.030600025275167) },
+ { FRAC_CONST(0.010161635170872), FRAC_CONST(0.030633443118931) },
+ { FRAC_CONST(0.010061333230142), FRAC_CONST(0.030666532903129) },
+ { FRAC_CONST(0.009960923540617), FRAC_CONST(0.030699294273397) },
+ { FRAC_CONST(0.009860407177603), FRAC_CONST(0.030731726878888) },
+ { FRAC_CONST(0.009759785217550), FRAC_CONST(0.030763830372273) },
+ { FRAC_CONST(0.009659058738038), FRAC_CONST(0.030795604409750) },
+ { FRAC_CONST(0.009558228817767), FRAC_CONST(0.030827048651045) },
+ { FRAC_CONST(0.009457296536545), FRAC_CONST(0.030858162759415) },
+ { FRAC_CONST(0.009356262975275), FRAC_CONST(0.030888946401653) },
+ { FRAC_CONST(0.009255129215945), FRAC_CONST(0.030919399248091) },
+ { FRAC_CONST(0.009153896341616), FRAC_CONST(0.030949520972603) },
+ { FRAC_CONST(0.009052565436412), FRAC_CONST(0.030979311252611) },
+ { FRAC_CONST(0.008951137585505), FRAC_CONST(0.031008769769084) },
+ { FRAC_CONST(0.008849613875105), FRAC_CONST(0.031037896206544) },
+ { FRAC_CONST(0.008747995392451), FRAC_CONST(0.031066690253072) },
+ { FRAC_CONST(0.008646283225794), FRAC_CONST(0.031095151600306) },
+ { FRAC_CONST(0.008544478464390), FRAC_CONST(0.031123279943448) },
+ { FRAC_CONST(0.008442582198486), FRAC_CONST(0.031151074981266) },
+ { FRAC_CONST(0.008340595519310), FRAC_CONST(0.031178536416098) },
+ { FRAC_CONST(0.008238519519057), FRAC_CONST(0.031205663953853) },
+ { FRAC_CONST(0.008136355290878), FRAC_CONST(0.031232457304017) },
+ { FRAC_CONST(0.008034103928871), FRAC_CONST(0.031258916179656) },
+ { FRAC_CONST(0.007931766528065), FRAC_CONST(0.031285040297416) },
+ { FRAC_CONST(0.007829344184412), FRAC_CONST(0.031310829377528) },
+ { FRAC_CONST(0.007726837994772), FRAC_CONST(0.031336283143813) },
+ { FRAC_CONST(0.007624249056906), FRAC_CONST(0.031361401323680) },
+ { FRAC_CONST(0.007521578469457), FRAC_CONST(0.031386183648135) },
+ { FRAC_CONST(0.007418827331946), FRAC_CONST(0.031410629851778) },
+ { FRAC_CONST(0.007315996744755), FRAC_CONST(0.031434739672811) },
+ { FRAC_CONST(0.007213087809115), FRAC_CONST(0.031458512853036) },
+ { FRAC_CONST(0.007110101627101), FRAC_CONST(0.031481949137863) },
+ { FRAC_CONST(0.007007039301610), FRAC_CONST(0.031505048276306) },
+ { FRAC_CONST(0.006903901936357), FRAC_CONST(0.031527810020993) },
+ { FRAC_CONST(0.006800690635862), FRAC_CONST(0.031550234128164) },
+ { FRAC_CONST(0.006697406505433), FRAC_CONST(0.031572320357675) },
+ { FRAC_CONST(0.006594050651161), FRAC_CONST(0.031594068473000) },
+ { FRAC_CONST(0.006490624179905), FRAC_CONST(0.031615478241233) },
+ { FRAC_CONST(0.006387128199278), FRAC_CONST(0.031636549433095) },
+ { FRAC_CONST(0.006283563817639), FRAC_CONST(0.031657281822929) },
+ { FRAC_CONST(0.006179932144080), FRAC_CONST(0.031677675188707) },
+ { FRAC_CONST(0.006076234288412), FRAC_CONST(0.031697729312034) },
+ { FRAC_CONST(0.005972471361157), FRAC_CONST(0.031717443978146) },
+ { FRAC_CONST(0.005868644473532), FRAC_CONST(0.031736818975914) },
+ { FRAC_CONST(0.005764754737440), FRAC_CONST(0.031755854097848) },
+ { FRAC_CONST(0.005660803265456), FRAC_CONST(0.031774549140098) },
+ { FRAC_CONST(0.005556791170816), FRAC_CONST(0.031792903902453) },
+ { FRAC_CONST(0.005452719567407), FRAC_CONST(0.031810918188350) },
+ { FRAC_CONST(0.005348589569753), FRAC_CONST(0.031828591804869) },
+ { FRAC_CONST(0.005244402293001), FRAC_CONST(0.031845924562742) },
+ { FRAC_CONST(0.005140158852914), FRAC_CONST(0.031862916276347) },
+ { FRAC_CONST(0.005035860365855), FRAC_CONST(0.031879566763717) },
+ { FRAC_CONST(0.004931507948778), FRAC_CONST(0.031895875846539) },
+ { FRAC_CONST(0.004827102719212), FRAC_CONST(0.031911843350155) },
+ { FRAC_CONST(0.004722645795254), FRAC_CONST(0.031927469103567) },
+ { FRAC_CONST(0.004618138295554), FRAC_CONST(0.031942752939435) },
+ { FRAC_CONST(0.004513581339303), FRAC_CONST(0.031957694694082) },
+ { FRAC_CONST(0.004408976046222), FRAC_CONST(0.031972294207493) },
+ { FRAC_CONST(0.004304323536549), FRAC_CONST(0.031986551323320) },
+ { FRAC_CONST(0.004199624931030), FRAC_CONST(0.032000465888879) },
+ { FRAC_CONST(0.004094881350902), FRAC_CONST(0.032014037755158) },
+ { FRAC_CONST(0.003990093917884), FRAC_CONST(0.032027266776813) },
+ { FRAC_CONST(0.003885263754166), FRAC_CONST(0.032040152812170) },
+ { FRAC_CONST(0.003780391982394), FRAC_CONST(0.032052695723232) },
+ { FRAC_CONST(0.003675479725661), FRAC_CONST(0.032064895375674) },
+ { FRAC_CONST(0.003570528107494), FRAC_CONST(0.032076751638847) },
+ { FRAC_CONST(0.003465538251839), FRAC_CONST(0.032088264385780) },
+ { FRAC_CONST(0.003360511283053), FRAC_CONST(0.032099433493181) },
+ { FRAC_CONST(0.003255448325892), FRAC_CONST(0.032110258841438) },
+ { FRAC_CONST(0.003150350505494), FRAC_CONST(0.032120740314619) },
+ { FRAC_CONST(0.003045218947373), FRAC_CONST(0.032130877800478) },
+ { FRAC_CONST(0.002940054777404), FRAC_CONST(0.032140671190449) },
+ { FRAC_CONST(0.002834859121810), FRAC_CONST(0.032150120379653) },
+ { FRAC_CONST(0.002729633107153), FRAC_CONST(0.032159225266897) },
+ { FRAC_CONST(0.002624377860318), FRAC_CONST(0.032167985754674) },
+ { FRAC_CONST(0.002519094508504), FRAC_CONST(0.032176401749168) },
+ { FRAC_CONST(0.002413784179212), FRAC_CONST(0.032184473160250) },
+ { FRAC_CONST(0.002308448000231), FRAC_CONST(0.032192199901481) },
+ { FRAC_CONST(0.002203087099626), FRAC_CONST(0.032199581890114) },
+ { FRAC_CONST(0.002097702605728), FRAC_CONST(0.032206619047093) },
+ { FRAC_CONST(0.001992295647121), FRAC_CONST(0.032213311297057) },
+ { FRAC_CONST(0.001886867352628), FRAC_CONST(0.032219658568338) },
+ { FRAC_CONST(0.001781418851302), FRAC_CONST(0.032225660792960) },
+ { FRAC_CONST(0.001675951272410), FRAC_CONST(0.032231317906644) },
+ { FRAC_CONST(0.001570465745428), FRAC_CONST(0.032236629848809) },
+ { FRAC_CONST(0.001464963400018), FRAC_CONST(0.032241596562566) },
+ { FRAC_CONST(0.001359445366028), FRAC_CONST(0.032246217994727) },
+ { FRAC_CONST(0.001253912773470), FRAC_CONST(0.032250494095799) },
+ { FRAC_CONST(0.001148366752513), FRAC_CONST(0.032254424819990) },
+ { FRAC_CONST(0.001042808433471), FRAC_CONST(0.032258010125204) },
+ { FRAC_CONST(0.000937238946789), FRAC_CONST(0.032261249973045) },
+ { FRAC_CONST(0.000831659423030), FRAC_CONST(0.032264144328817) },
+ { FRAC_CONST(0.000726070992868), FRAC_CONST(0.032266693161525) },
+ { FRAC_CONST(0.000620474787068), FRAC_CONST(0.032268896443871) },
+ { FRAC_CONST(0.000514871936481), FRAC_CONST(0.032270754152261) },
+ { FRAC_CONST(0.000409263572030), FRAC_CONST(0.032272266266801) },
+ { FRAC_CONST(0.000303650824695), FRAC_CONST(0.032273432771295) },
+ { FRAC_CONST(0.000198034825504), FRAC_CONST(0.032274253653254) },
+ { FRAC_CONST(0.000092416705518), FRAC_CONST(0.032274728903884) }
+};
#ifdef LD_DEC
- /* 240 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_960[] =
- {
- { FRAC_CONST(0.045643531183573), FRAC_CONST(0.000037342034959) },
- { FRAC_CONST(0.045642309173789), FRAC_CONST(0.000336075315362) },
- { FRAC_CONST(0.045639131999390), FRAC_CONST(0.000634794199417) },
- { FRAC_CONST(0.045633999796474), FRAC_CONST(0.000933485891002) },
- { FRAC_CONST(0.045626912784890), FRAC_CONST(0.001232137595157) },
- { FRAC_CONST(0.045617871268219), FRAC_CONST(0.001530736518639) },
- { FRAC_CONST(0.045606875633772), FRAC_CONST(0.001829269870464) },
- { FRAC_CONST(0.045593926352564), FRAC_CONST(0.002127724862455) },
- { FRAC_CONST(0.045579023979299), FRAC_CONST(0.002426088709795) },
- { FRAC_CONST(0.045562169152346), FRAC_CONST(0.002724348631569) },
- { FRAC_CONST(0.045543362593709), FRAC_CONST(0.003022491851315) },
- { FRAC_CONST(0.045522605108999), FRAC_CONST(0.003320505597570) },
- { FRAC_CONST(0.045499897587396), FRAC_CONST(0.003618377104416) },
- { FRAC_CONST(0.045475241001617), FRAC_CONST(0.003916093612031) },
- { FRAC_CONST(0.045448636407866), FRAC_CONST(0.004213642367228) },
- { FRAC_CONST(0.045420084945797), FRAC_CONST(0.004511010624011) },
- { FRAC_CONST(0.045389587838458), FRAC_CONST(0.004808185644112) },
- { FRAC_CONST(0.045357146392244), FRAC_CONST(0.005105154697544) },
- { FRAC_CONST(0.045322761996840), FRAC_CONST(0.005401905063139) },
- { FRAC_CONST(0.045286436125157), FRAC_CONST(0.005698424029100) },
- { FRAC_CONST(0.045248170333275), FRAC_CONST(0.005994698893542) },
- { FRAC_CONST(0.045207966260374), FRAC_CONST(0.006290716965035) },
- { FRAC_CONST(0.045165825628663), FRAC_CONST(0.006586465563151) },
- { FRAC_CONST(0.045121750243305), FRAC_CONST(0.006881932019003) },
- { FRAC_CONST(0.045075741992343), FRAC_CONST(0.007177103675792) },
- { FRAC_CONST(0.045027802846618), FRAC_CONST(0.007471967889347) },
- { FRAC_CONST(0.044977934859683), FRAC_CONST(0.007766512028667) },
- { FRAC_CONST(0.044926140167717), FRAC_CONST(0.008060723476460) },
- { FRAC_CONST(0.044872420989432), FRAC_CONST(0.008354589629687) },
- { FRAC_CONST(0.044816779625979), FRAC_CONST(0.008648097900101) },
- { FRAC_CONST(0.044759218460849), FRAC_CONST(0.008941235714784) },
- { FRAC_CONST(0.044699739959770), FRAC_CONST(0.009233990516688) },
- { FRAC_CONST(0.044638346670603), FRAC_CONST(0.009526349765171) },
- { FRAC_CONST(0.044575041223233), FRAC_CONST(0.009818300936537) },
- { FRAC_CONST(0.044509826329454), FRAC_CONST(0.010109831524568) },
- { FRAC_CONST(0.044442704782856), FRAC_CONST(0.010400929041064) },
- { FRAC_CONST(0.044373679458701), FRAC_CONST(0.010691581016378) },
- { FRAC_CONST(0.044302753313806), FRAC_CONST(0.010981774999945) },
- { FRAC_CONST(0.044229929386409), FRAC_CONST(0.011271498560822) },
- { FRAC_CONST(0.044155210796046), FRAC_CONST(0.011560739288214) },
- { FRAC_CONST(0.044078600743413), FRAC_CONST(0.011849484792012) },
- { FRAC_CONST(0.044000102510229), FRAC_CONST(0.012137722703321) },
- { FRAC_CONST(0.043919719459097), FRAC_CONST(0.012425440674986) },
- { FRAC_CONST(0.043837455033359), FRAC_CONST(0.012712626382127) },
- { FRAC_CONST(0.043753312756950), FRAC_CONST(0.012999267522665) },
- { FRAC_CONST(0.043667296234245), FRAC_CONST(0.013285351817848) },
- { FRAC_CONST(0.043579409149906), FRAC_CONST(0.013570867012776) },
- { FRAC_CONST(0.043489655268722), FRAC_CONST(0.013855800876928) },
- { FRAC_CONST(0.043398038435451), FRAC_CONST(0.014140141204686) },
- { FRAC_CONST(0.043304562574653), FRAC_CONST(0.014423875815857) },
- { FRAC_CONST(0.043209231690524), FRAC_CONST(0.014706992556195) },
- { FRAC_CONST(0.043112049866720), FRAC_CONST(0.014989479297920) },
- { FRAC_CONST(0.043013021266188), FRAC_CONST(0.015271323940241) },
- { FRAC_CONST(0.042912150130984), FRAC_CONST(0.015552514409871) },
- { FRAC_CONST(0.042809440782090), FRAC_CONST(0.015833038661547) },
- { FRAC_CONST(0.042704897619235), FRAC_CONST(0.016112884678543) },
- { FRAC_CONST(0.042598525120698), FRAC_CONST(0.016392040473187) },
- { FRAC_CONST(0.042490327843124), FRAC_CONST(0.016670494087374) },
- { FRAC_CONST(0.042380310421324), FRAC_CONST(0.016948233593079) },
- { FRAC_CONST(0.042268477568078), FRAC_CONST(0.017225247092864) },
- { FRAC_CONST(0.042154834073934), FRAC_CONST(0.017501522720393) },
- { FRAC_CONST(0.042039384807000), FRAC_CONST(0.017777048640940) },
- { FRAC_CONST(0.041922134712739), FRAC_CONST(0.018051813051888) },
- { FRAC_CONST(0.041803088813754), FRAC_CONST(0.018325804183247) },
- { FRAC_CONST(0.041682252209576), FRAC_CONST(0.018599010298148) },
- { FRAC_CONST(0.041559630076443), FRAC_CONST(0.018871419693350) },
- { FRAC_CONST(0.041435227667079), FRAC_CONST(0.019143020699741) },
- { FRAC_CONST(0.041309050310468), FRAC_CONST(0.019413801682838) },
- { FRAC_CONST(0.041181103411629), FRAC_CONST(0.019683751043285) },
- { FRAC_CONST(0.041051392451382), FRAC_CONST(0.019952857217350) },
- { FRAC_CONST(0.040919922986111), FRAC_CONST(0.020221108677421) },
- { FRAC_CONST(0.040786700647532), FRAC_CONST(0.020488493932496) },
- { FRAC_CONST(0.040651731142446), FRAC_CONST(0.020755001528683) },
- { FRAC_CONST(0.040515020252497), FRAC_CONST(0.021020620049682) },
- { FRAC_CONST(0.040376573833925), FRAC_CONST(0.021285338117280) },
- { FRAC_CONST(0.040236397817314), FRAC_CONST(0.021549144391836) },
- { FRAC_CONST(0.040094498207337), FRAC_CONST(0.021812027572768) },
- { FRAC_CONST(0.039950881082502), FRAC_CONST(0.022073976399034) },
- { FRAC_CONST(0.039805552594888), FRAC_CONST(0.022334979649620) },
- { FRAC_CONST(0.039658518969884), FRAC_CONST(0.022595026144014) },
- { FRAC_CONST(0.039509786505922), FRAC_CONST(0.022854104742690) },
- { FRAC_CONST(0.039359361574204), FRAC_CONST(0.023112204347583) },
- { FRAC_CONST(0.039207250618434), FRAC_CONST(0.023369313902565) },
- { FRAC_CONST(0.039053460154540), FRAC_CONST(0.023625422393919) },
- { FRAC_CONST(0.038897996770393), FRAC_CONST(0.023880518850809) },
- { FRAC_CONST(0.038740867125527), FRAC_CONST(0.024134592345752) },
- { FRAC_CONST(0.038582077950852), FRAC_CONST(0.024387631995085) },
- { FRAC_CONST(0.038421636048370), FRAC_CONST(0.024639626959432) },
- { FRAC_CONST(0.038259548290876), FRAC_CONST(0.024890566444167) },
- { FRAC_CONST(0.038095821621671), FRAC_CONST(0.025140439699877) },
- { FRAC_CONST(0.037930463054261), FRAC_CONST(0.025389236022825) },
- { FRAC_CONST(0.037763479672055), FRAC_CONST(0.025636944755403) },
- { FRAC_CONST(0.037594878628068), FRAC_CONST(0.025883555286595) },
- { FRAC_CONST(0.037424667144605), FRAC_CONST(0.026129057052425) },
- { FRAC_CONST(0.037252852512960), FRAC_CONST(0.026373439536415) },
- { FRAC_CONST(0.037079442093102), FRAC_CONST(0.026616692270033) },
- { FRAC_CONST(0.036904443313354), FRAC_CONST(0.026858804833142) },
- { FRAC_CONST(0.036727863670081), FRAC_CONST(0.027099766854444) },
- { FRAC_CONST(0.036549710727369), FRAC_CONST(0.027339568011930) },
- { FRAC_CONST(0.036369992116697), FRAC_CONST(0.027578198033315) },
- { FRAC_CONST(0.036188715536611), FRAC_CONST(0.027815646696484) },
- { FRAC_CONST(0.036005888752396), FRAC_CONST(0.028051903829926) },
- { FRAC_CONST(0.035821519595745), FRAC_CONST(0.028286959313171) },
- { FRAC_CONST(0.035635615964417), FRAC_CONST(0.028520803077226) },
- { FRAC_CONST(0.035448185821906), FRAC_CONST(0.028753425105002) },
- { FRAC_CONST(0.035259237197095), FRAC_CONST(0.028984815431745) },
- { FRAC_CONST(0.035068778183914), FRAC_CONST(0.029214964145465) },
- { FRAC_CONST(0.034876816940994), FRAC_CONST(0.029443861387355) },
- { FRAC_CONST(0.034683361691315), FRAC_CONST(0.029671497352220) },
- { FRAC_CONST(0.034488420721856), FRAC_CONST(0.029897862288892) },
- { FRAC_CONST(0.034292002383240), FRAC_CONST(0.030122946500652) },
- { FRAC_CONST(0.034094115089375), FRAC_CONST(0.030346740345641) },
- { FRAC_CONST(0.033894767317093), FRAC_CONST(0.030569234237276) },
- { FRAC_CONST(0.033693967605790), FRAC_CONST(0.030790418644658) },
- { FRAC_CONST(0.033491724557057), FRAC_CONST(0.031010284092984) },
- { FRAC_CONST(0.033288046834313), FRAC_CONST(0.031228821163949) },
- { FRAC_CONST(0.033082943162434), FRAC_CONST(0.031446020496153) },
- { FRAC_CONST(0.032876422327378), FRAC_CONST(0.031661872785500) },
- { FRAC_CONST(0.032668493175811), FRAC_CONST(0.031876368785596) },
- { FRAC_CONST(0.032459164614726), FRAC_CONST(0.032089499308145) },
- { FRAC_CONST(0.032248445611061), FRAC_CONST(0.032301255223347) },
- { FRAC_CONST(0.032036345191317), FRAC_CONST(0.032511627460281) },
- { FRAC_CONST(0.031822872441171), FRAC_CONST(0.032720607007302) },
- { FRAC_CONST(0.031608036505083), FRAC_CONST(0.032928184912422) },
- { FRAC_CONST(0.031391846585912), FRAC_CONST(0.033134352283693) },
- { FRAC_CONST(0.031174311944513), FRAC_CONST(0.033339100289593) },
- { FRAC_CONST(0.030955441899347), FRAC_CONST(0.033542420159397) },
- { FRAC_CONST(0.030735245826077), FRAC_CONST(0.033744303183559) },
- { FRAC_CONST(0.030513733157171), FRAC_CONST(0.033944740714083) },
- { FRAC_CONST(0.030290913381494), FRAC_CONST(0.034143724164891) },
- { FRAC_CONST(0.030066796043904), FRAC_CONST(0.034341245012195) },
- { FRAC_CONST(0.029841390744841), FRAC_CONST(0.034537294794860) },
- { FRAC_CONST(0.029614707139919), FRAC_CONST(0.034731865114764) },
- { FRAC_CONST(0.029386754939508), FRAC_CONST(0.034924947637164) },
- { FRAC_CONST(0.029157543908322), FRAC_CONST(0.035116534091046) },
- { FRAC_CONST(0.028927083864999), FRAC_CONST(0.035306616269485) },
- { FRAC_CONST(0.028695384681680), FRAC_CONST(0.035495186029992) },
- { FRAC_CONST(0.028462456283587), FRAC_CONST(0.035682235294866) },
- { FRAC_CONST(0.028228308648598), FRAC_CONST(0.035867756051541) },
- { FRAC_CONST(0.027992951806817), FRAC_CONST(0.036051740352923) },
- { FRAC_CONST(0.027756395840148), FRAC_CONST(0.036234180317738) },
- { FRAC_CONST(0.027518650881862), FRAC_CONST(0.036415068130865) },
- { FRAC_CONST(0.027279727116161), FRAC_CONST(0.036594396043672) },
- { FRAC_CONST(0.027039634777745), FRAC_CONST(0.036772156374348) },
- { FRAC_CONST(0.026798384151369), FRAC_CONST(0.036948341508233) },
- { FRAC_CONST(0.026555985571409), FRAC_CONST(0.037122943898140) },
- { FRAC_CONST(0.026312449421412), FRAC_CONST(0.037295956064686) },
- { FRAC_CONST(0.026067786133656), FRAC_CONST(0.037467370596605) },
- { FRAC_CONST(0.025822006188702), FRAC_CONST(0.037637180151068) },
- { FRAC_CONST(0.025575120114946), FRAC_CONST(0.037805377454000) },
- { FRAC_CONST(0.025327138488165), FRAC_CONST(0.037971955300388) },
- { FRAC_CONST(0.025078071931066), FRAC_CONST(0.038136906554591) },
- { FRAC_CONST(0.024827931112832), FRAC_CONST(0.038300224150647) },
- { FRAC_CONST(0.024576726748663), FRAC_CONST(0.038461901092573) },
- { FRAC_CONST(0.024324469599317), FRAC_CONST(0.038621930454668) },
- { FRAC_CONST(0.024071170470652), FRAC_CONST(0.038780305381806) },
- { FRAC_CONST(0.023816840213160), FRAC_CONST(0.038937019089732) },
- { FRAC_CONST(0.023561489721501), FRAC_CONST(0.039092064865353) },
- { FRAC_CONST(0.023305129934041), FRAC_CONST(0.039245436067023) },
- { FRAC_CONST(0.023047771832380), FRAC_CONST(0.039397126124832) },
- { FRAC_CONST(0.022789426440883), FRAC_CONST(0.039547128540881) },
- { FRAC_CONST(0.022530104826206), FRAC_CONST(0.039695436889566) },
- { FRAC_CONST(0.022269818096825), FRAC_CONST(0.039842044817851) },
- { FRAC_CONST(0.022008577402555), FRAC_CONST(0.039986946045542) },
- { FRAC_CONST(0.021746393934081), FRAC_CONST(0.040130134365550) },
- { FRAC_CONST(0.021483278922467), FRAC_CONST(0.040271603644166) },
- { FRAC_CONST(0.021219243638687), FRAC_CONST(0.040411347821316) },
- { FRAC_CONST(0.020954299393132), FRAC_CONST(0.040549360910825) },
- { FRAC_CONST(0.020688457535133), FRAC_CONST(0.040685637000671) },
- { FRAC_CONST(0.020421729452469), FRAC_CONST(0.040820170253240) },
- { FRAC_CONST(0.020154126570884), FRAC_CONST(0.040952954905576) },
- { FRAC_CONST(0.019885660353596), FRAC_CONST(0.041083985269625) },
- { FRAC_CONST(0.019616342300802), FRAC_CONST(0.041213255732484) },
- { FRAC_CONST(0.019346183949192), FRAC_CONST(0.041340760756635) },
- { FRAC_CONST(0.019075196871451), FRAC_CONST(0.041466494880189) },
- { FRAC_CONST(0.018803392675763), FRAC_CONST(0.041590452717113) },
- { FRAC_CONST(0.018530783005316), FRAC_CONST(0.041712628957466) },
- { FRAC_CONST(0.018257379537800), FRAC_CONST(0.041833018367625) },
- { FRAC_CONST(0.017983193984910), FRAC_CONST(0.041951615790509) },
- { FRAC_CONST(0.017708238091842), FRAC_CONST(0.042068416145797) },
- { FRAC_CONST(0.017432523636792), FRAC_CONST(0.042183414430153) },
- { FRAC_CONST(0.017156062430449), FRAC_CONST(0.042296605717432) },
- { FRAC_CONST(0.016878866315491), FRAC_CONST(0.042407985158896) },
- { FRAC_CONST(0.016600947166078), FRAC_CONST(0.042517547983420) },
- { FRAC_CONST(0.016322316887341), FRAC_CONST(0.042625289497698) },
- { FRAC_CONST(0.016042987414872), FRAC_CONST(0.042731205086442) },
- { FRAC_CONST(0.015762970714219), FRAC_CONST(0.042835290212581) },
- { FRAC_CONST(0.015482278780363), FRAC_CONST(0.042937540417454) },
- { FRAC_CONST(0.015200923637213), FRAC_CONST(0.043037951321002) },
- { FRAC_CONST(0.014918917337087), FRAC_CONST(0.043136518621958) },
- { FRAC_CONST(0.014636271960196), FRAC_CONST(0.043233238098025) },
- { FRAC_CONST(0.014352999614128), FRAC_CONST(0.043328105606063) },
- { FRAC_CONST(0.014069112433327), FRAC_CONST(0.043421117082265) },
- { FRAC_CONST(0.013784622578575), FRAC_CONST(0.043512268542327) },
- { FRAC_CONST(0.013499542236471), FRAC_CONST(0.043601556081625) },
- { FRAC_CONST(0.013213883618907), FRAC_CONST(0.043688975875378) },
- { FRAC_CONST(0.012927658962548), FRAC_CONST(0.043774524178812) },
- { FRAC_CONST(0.012640880528305), FRAC_CONST(0.043858197327323) },
- { FRAC_CONST(0.012353560600813), FRAC_CONST(0.043939991736633) },
- { FRAC_CONST(0.012065711487901), FRAC_CONST(0.044019903902940) },
- { FRAC_CONST(0.011777345520066), FRAC_CONST(0.044097930403073) },
- { FRAC_CONST(0.011488475049948), FRAC_CONST(0.044174067894638) },
- { FRAC_CONST(0.011199112451794), FRAC_CONST(0.044248313116156) },
- { FRAC_CONST(0.010909270120937), FRAC_CONST(0.044320662887211) },
- { FRAC_CONST(0.010618960473257), FRAC_CONST(0.044391114108577) },
- { FRAC_CONST(0.010328195944653), FRAC_CONST(0.044459663762361) },
- { FRAC_CONST(0.010036988990509), FRAC_CONST(0.044526308912122) },
- { FRAC_CONST(0.009745352085163), FRAC_CONST(0.044591046703005) },
- { FRAC_CONST(0.009453297721368), FRAC_CONST(0.044653874361857) },
- { FRAC_CONST(0.009160838409762), FRAC_CONST(0.044714789197351) },
- { FRAC_CONST(0.008867986678328), FRAC_CONST(0.044773788600099) },
- { FRAC_CONST(0.008574755071860), FRAC_CONST(0.044830870042761) },
- { FRAC_CONST(0.008281156151424), FRAC_CONST(0.044886031080160) },
- { FRAC_CONST(0.007987202493820), FRAC_CONST(0.044939269349379) },
- { FRAC_CONST(0.007692906691044), FRAC_CONST(0.044990582569869) },
- { FRAC_CONST(0.007398281349750), FRAC_CONST(0.045039968543542) },
- { FRAC_CONST(0.007103339090706), FRAC_CONST(0.045087425154868) },
- { FRAC_CONST(0.006808092548258), FRAC_CONST(0.045132950370962) },
- { FRAC_CONST(0.006512554369783), FRAC_CONST(0.045176542241676) },
- { FRAC_CONST(0.006216737215155), FRAC_CONST(0.045218198899680) },
- { FRAC_CONST(0.005920653756196), FRAC_CONST(0.045257918560541) },
- { FRAC_CONST(0.005624316676135), FRAC_CONST(0.045295699522801) },
- { FRAC_CONST(0.005327738669067), FRAC_CONST(0.045331540168049) },
- { FRAC_CONST(0.005030932439406), FRAC_CONST(0.045365438960992) },
- { FRAC_CONST(0.004733910701344), FRAC_CONST(0.045397394449517) },
- { FRAC_CONST(0.004436686178303), FRAC_CONST(0.045427405264758) },
- { FRAC_CONST(0.004139271602393), FRAC_CONST(0.045455470121152) },
- { FRAC_CONST(0.003841679713863), FRAC_CONST(0.045481587816494) },
- { FRAC_CONST(0.003543923260561), FRAC_CONST(0.045505757231988) },
- { FRAC_CONST(0.003246014997382), FRAC_CONST(0.045527977332297) },
- { FRAC_CONST(0.002947967685724), FRAC_CONST(0.045548247165585) },
- { FRAC_CONST(0.002649794092941), FRAC_CONST(0.045566565863562) },
- { FRAC_CONST(0.002351506991799), FRAC_CONST(0.045582932641515) },
- { FRAC_CONST(0.002053119159924), FRAC_CONST(0.045597346798344) },
- { FRAC_CONST(0.001754643379257), FRAC_CONST(0.045609807716597) },
- { FRAC_CONST(0.001456092435508), FRAC_CONST(0.045620314862489) },
- { FRAC_CONST(0.001157479117605), FRAC_CONST(0.045628867785927) },
- { FRAC_CONST(0.000858816217149), FRAC_CONST(0.045635466120535) },
- { FRAC_CONST(0.000560116527865), FRAC_CONST(0.045640109583661) },
- { FRAC_CONST(0.000261392845053), FRAC_CONST(0.045642797976394) }
- };
+/* 240 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_960[] =
+{
+ { FRAC_CONST(0.045643531183573), FRAC_CONST(0.000037342034959) },
+ { FRAC_CONST(0.045642309173789), FRAC_CONST(0.000336075315362) },
+ { FRAC_CONST(0.045639131999390), FRAC_CONST(0.000634794199417) },
+ { FRAC_CONST(0.045633999796474), FRAC_CONST(0.000933485891002) },
+ { FRAC_CONST(0.045626912784890), FRAC_CONST(0.001232137595157) },
+ { FRAC_CONST(0.045617871268219), FRAC_CONST(0.001530736518639) },
+ { FRAC_CONST(0.045606875633772), FRAC_CONST(0.001829269870464) },
+ { FRAC_CONST(0.045593926352564), FRAC_CONST(0.002127724862455) },
+ { FRAC_CONST(0.045579023979299), FRAC_CONST(0.002426088709795) },
+ { FRAC_CONST(0.045562169152346), FRAC_CONST(0.002724348631569) },
+ { FRAC_CONST(0.045543362593709), FRAC_CONST(0.003022491851315) },
+ { FRAC_CONST(0.045522605108999), FRAC_CONST(0.003320505597570) },
+ { FRAC_CONST(0.045499897587396), FRAC_CONST(0.003618377104416) },
+ { FRAC_CONST(0.045475241001617), FRAC_CONST(0.003916093612031) },
+ { FRAC_CONST(0.045448636407866), FRAC_CONST(0.004213642367228) },
+ { FRAC_CONST(0.045420084945797), FRAC_CONST(0.004511010624011) },
+ { FRAC_CONST(0.045389587838458), FRAC_CONST(0.004808185644112) },
+ { FRAC_CONST(0.045357146392244), FRAC_CONST(0.005105154697544) },
+ { FRAC_CONST(0.045322761996840), FRAC_CONST(0.005401905063139) },
+ { FRAC_CONST(0.045286436125157), FRAC_CONST(0.005698424029100) },
+ { FRAC_CONST(0.045248170333275), FRAC_CONST(0.005994698893542) },
+ { FRAC_CONST(0.045207966260374), FRAC_CONST(0.006290716965035) },
+ { FRAC_CONST(0.045165825628663), FRAC_CONST(0.006586465563151) },
+ { FRAC_CONST(0.045121750243305), FRAC_CONST(0.006881932019003) },
+ { FRAC_CONST(0.045075741992343), FRAC_CONST(0.007177103675792) },
+ { FRAC_CONST(0.045027802846618), FRAC_CONST(0.007471967889347) },
+ { FRAC_CONST(0.044977934859683), FRAC_CONST(0.007766512028667) },
+ { FRAC_CONST(0.044926140167717), FRAC_CONST(0.008060723476460) },
+ { FRAC_CONST(0.044872420989432), FRAC_CONST(0.008354589629687) },
+ { FRAC_CONST(0.044816779625979), FRAC_CONST(0.008648097900101) },
+ { FRAC_CONST(0.044759218460849), FRAC_CONST(0.008941235714784) },
+ { FRAC_CONST(0.044699739959770), FRAC_CONST(0.009233990516688) },
+ { FRAC_CONST(0.044638346670603), FRAC_CONST(0.009526349765171) },
+ { FRAC_CONST(0.044575041223233), FRAC_CONST(0.009818300936537) },
+ { FRAC_CONST(0.044509826329454), FRAC_CONST(0.010109831524568) },
+ { FRAC_CONST(0.044442704782856), FRAC_CONST(0.010400929041064) },
+ { FRAC_CONST(0.044373679458701), FRAC_CONST(0.010691581016378) },
+ { FRAC_CONST(0.044302753313806), FRAC_CONST(0.010981774999945) },
+ { FRAC_CONST(0.044229929386409), FRAC_CONST(0.011271498560822) },
+ { FRAC_CONST(0.044155210796046), FRAC_CONST(0.011560739288214) },
+ { FRAC_CONST(0.044078600743413), FRAC_CONST(0.011849484792012) },
+ { FRAC_CONST(0.044000102510229), FRAC_CONST(0.012137722703321) },
+ { FRAC_CONST(0.043919719459097), FRAC_CONST(0.012425440674986) },
+ { FRAC_CONST(0.043837455033359), FRAC_CONST(0.012712626382127) },
+ { FRAC_CONST(0.043753312756950), FRAC_CONST(0.012999267522665) },
+ { FRAC_CONST(0.043667296234245), FRAC_CONST(0.013285351817848) },
+ { FRAC_CONST(0.043579409149906), FRAC_CONST(0.013570867012776) },
+ { FRAC_CONST(0.043489655268722), FRAC_CONST(0.013855800876928) },
+ { FRAC_CONST(0.043398038435451), FRAC_CONST(0.014140141204686) },
+ { FRAC_CONST(0.043304562574653), FRAC_CONST(0.014423875815857) },
+ { FRAC_CONST(0.043209231690524), FRAC_CONST(0.014706992556195) },
+ { FRAC_CONST(0.043112049866720), FRAC_CONST(0.014989479297920) },
+ { FRAC_CONST(0.043013021266188), FRAC_CONST(0.015271323940241) },
+ { FRAC_CONST(0.042912150130984), FRAC_CONST(0.015552514409871) },
+ { FRAC_CONST(0.042809440782090), FRAC_CONST(0.015833038661547) },
+ { FRAC_CONST(0.042704897619235), FRAC_CONST(0.016112884678543) },
+ { FRAC_CONST(0.042598525120698), FRAC_CONST(0.016392040473187) },
+ { FRAC_CONST(0.042490327843124), FRAC_CONST(0.016670494087374) },
+ { FRAC_CONST(0.042380310421324), FRAC_CONST(0.016948233593079) },
+ { FRAC_CONST(0.042268477568078), FRAC_CONST(0.017225247092864) },
+ { FRAC_CONST(0.042154834073934), FRAC_CONST(0.017501522720393) },
+ { FRAC_CONST(0.042039384807000), FRAC_CONST(0.017777048640940) },
+ { FRAC_CONST(0.041922134712739), FRAC_CONST(0.018051813051888) },
+ { FRAC_CONST(0.041803088813754), FRAC_CONST(0.018325804183247) },
+ { FRAC_CONST(0.041682252209576), FRAC_CONST(0.018599010298148) },
+ { FRAC_CONST(0.041559630076443), FRAC_CONST(0.018871419693350) },
+ { FRAC_CONST(0.041435227667079), FRAC_CONST(0.019143020699741) },
+ { FRAC_CONST(0.041309050310468), FRAC_CONST(0.019413801682838) },
+ { FRAC_CONST(0.041181103411629), FRAC_CONST(0.019683751043285) },
+ { FRAC_CONST(0.041051392451382), FRAC_CONST(0.019952857217350) },
+ { FRAC_CONST(0.040919922986111), FRAC_CONST(0.020221108677421) },
+ { FRAC_CONST(0.040786700647532), FRAC_CONST(0.020488493932496) },
+ { FRAC_CONST(0.040651731142446), FRAC_CONST(0.020755001528683) },
+ { FRAC_CONST(0.040515020252497), FRAC_CONST(0.021020620049682) },
+ { FRAC_CONST(0.040376573833925), FRAC_CONST(0.021285338117280) },
+ { FRAC_CONST(0.040236397817314), FRAC_CONST(0.021549144391836) },
+ { FRAC_CONST(0.040094498207337), FRAC_CONST(0.021812027572768) },
+ { FRAC_CONST(0.039950881082502), FRAC_CONST(0.022073976399034) },
+ { FRAC_CONST(0.039805552594888), FRAC_CONST(0.022334979649620) },
+ { FRAC_CONST(0.039658518969884), FRAC_CONST(0.022595026144014) },
+ { FRAC_CONST(0.039509786505922), FRAC_CONST(0.022854104742690) },
+ { FRAC_CONST(0.039359361574204), FRAC_CONST(0.023112204347583) },
+ { FRAC_CONST(0.039207250618434), FRAC_CONST(0.023369313902565) },
+ { FRAC_CONST(0.039053460154540), FRAC_CONST(0.023625422393919) },
+ { FRAC_CONST(0.038897996770393), FRAC_CONST(0.023880518850809) },
+ { FRAC_CONST(0.038740867125527), FRAC_CONST(0.024134592345752) },
+ { FRAC_CONST(0.038582077950852), FRAC_CONST(0.024387631995085) },
+ { FRAC_CONST(0.038421636048370), FRAC_CONST(0.024639626959432) },
+ { FRAC_CONST(0.038259548290876), FRAC_CONST(0.024890566444167) },
+ { FRAC_CONST(0.038095821621671), FRAC_CONST(0.025140439699877) },
+ { FRAC_CONST(0.037930463054261), FRAC_CONST(0.025389236022825) },
+ { FRAC_CONST(0.037763479672055), FRAC_CONST(0.025636944755403) },
+ { FRAC_CONST(0.037594878628068), FRAC_CONST(0.025883555286595) },
+ { FRAC_CONST(0.037424667144605), FRAC_CONST(0.026129057052425) },
+ { FRAC_CONST(0.037252852512960), FRAC_CONST(0.026373439536415) },
+ { FRAC_CONST(0.037079442093102), FRAC_CONST(0.026616692270033) },
+ { FRAC_CONST(0.036904443313354), FRAC_CONST(0.026858804833142) },
+ { FRAC_CONST(0.036727863670081), FRAC_CONST(0.027099766854444) },
+ { FRAC_CONST(0.036549710727369), FRAC_CONST(0.027339568011930) },
+ { FRAC_CONST(0.036369992116697), FRAC_CONST(0.027578198033315) },
+ { FRAC_CONST(0.036188715536611), FRAC_CONST(0.027815646696484) },
+ { FRAC_CONST(0.036005888752396), FRAC_CONST(0.028051903829926) },
+ { FRAC_CONST(0.035821519595745), FRAC_CONST(0.028286959313171) },
+ { FRAC_CONST(0.035635615964417), FRAC_CONST(0.028520803077226) },
+ { FRAC_CONST(0.035448185821906), FRAC_CONST(0.028753425105002) },
+ { FRAC_CONST(0.035259237197095), FRAC_CONST(0.028984815431745) },
+ { FRAC_CONST(0.035068778183914), FRAC_CONST(0.029214964145465) },
+ { FRAC_CONST(0.034876816940994), FRAC_CONST(0.029443861387355) },
+ { FRAC_CONST(0.034683361691315), FRAC_CONST(0.029671497352220) },
+ { FRAC_CONST(0.034488420721856), FRAC_CONST(0.029897862288892) },
+ { FRAC_CONST(0.034292002383240), FRAC_CONST(0.030122946500652) },
+ { FRAC_CONST(0.034094115089375), FRAC_CONST(0.030346740345641) },
+ { FRAC_CONST(0.033894767317093), FRAC_CONST(0.030569234237276) },
+ { FRAC_CONST(0.033693967605790), FRAC_CONST(0.030790418644658) },
+ { FRAC_CONST(0.033491724557057), FRAC_CONST(0.031010284092984) },
+ { FRAC_CONST(0.033288046834313), FRAC_CONST(0.031228821163949) },
+ { FRAC_CONST(0.033082943162434), FRAC_CONST(0.031446020496153) },
+ { FRAC_CONST(0.032876422327378), FRAC_CONST(0.031661872785500) },
+ { FRAC_CONST(0.032668493175811), FRAC_CONST(0.031876368785596) },
+ { FRAC_CONST(0.032459164614726), FRAC_CONST(0.032089499308145) },
+ { FRAC_CONST(0.032248445611061), FRAC_CONST(0.032301255223347) },
+ { FRAC_CONST(0.032036345191317), FRAC_CONST(0.032511627460281) },
+ { FRAC_CONST(0.031822872441171), FRAC_CONST(0.032720607007302) },
+ { FRAC_CONST(0.031608036505083), FRAC_CONST(0.032928184912422) },
+ { FRAC_CONST(0.031391846585912), FRAC_CONST(0.033134352283693) },
+ { FRAC_CONST(0.031174311944513), FRAC_CONST(0.033339100289593) },
+ { FRAC_CONST(0.030955441899347), FRAC_CONST(0.033542420159397) },
+ { FRAC_CONST(0.030735245826077), FRAC_CONST(0.033744303183559) },
+ { FRAC_CONST(0.030513733157171), FRAC_CONST(0.033944740714083) },
+ { FRAC_CONST(0.030290913381494), FRAC_CONST(0.034143724164891) },
+ { FRAC_CONST(0.030066796043904), FRAC_CONST(0.034341245012195) },
+ { FRAC_CONST(0.029841390744841), FRAC_CONST(0.034537294794860) },
+ { FRAC_CONST(0.029614707139919), FRAC_CONST(0.034731865114764) },
+ { FRAC_CONST(0.029386754939508), FRAC_CONST(0.034924947637164) },
+ { FRAC_CONST(0.029157543908322), FRAC_CONST(0.035116534091046) },
+ { FRAC_CONST(0.028927083864999), FRAC_CONST(0.035306616269485) },
+ { FRAC_CONST(0.028695384681680), FRAC_CONST(0.035495186029992) },
+ { FRAC_CONST(0.028462456283587), FRAC_CONST(0.035682235294866) },
+ { FRAC_CONST(0.028228308648598), FRAC_CONST(0.035867756051541) },
+ { FRAC_CONST(0.027992951806817), FRAC_CONST(0.036051740352923) },
+ { FRAC_CONST(0.027756395840148), FRAC_CONST(0.036234180317738) },
+ { FRAC_CONST(0.027518650881862), FRAC_CONST(0.036415068130865) },
+ { FRAC_CONST(0.027279727116161), FRAC_CONST(0.036594396043672) },
+ { FRAC_CONST(0.027039634777745), FRAC_CONST(0.036772156374348) },
+ { FRAC_CONST(0.026798384151369), FRAC_CONST(0.036948341508233) },
+ { FRAC_CONST(0.026555985571409), FRAC_CONST(0.037122943898140) },
+ { FRAC_CONST(0.026312449421412), FRAC_CONST(0.037295956064686) },
+ { FRAC_CONST(0.026067786133656), FRAC_CONST(0.037467370596605) },
+ { FRAC_CONST(0.025822006188702), FRAC_CONST(0.037637180151068) },
+ { FRAC_CONST(0.025575120114946), FRAC_CONST(0.037805377454000) },
+ { FRAC_CONST(0.025327138488165), FRAC_CONST(0.037971955300388) },
+ { FRAC_CONST(0.025078071931066), FRAC_CONST(0.038136906554591) },
+ { FRAC_CONST(0.024827931112832), FRAC_CONST(0.038300224150647) },
+ { FRAC_CONST(0.024576726748663), FRAC_CONST(0.038461901092573) },
+ { FRAC_CONST(0.024324469599317), FRAC_CONST(0.038621930454668) },
+ { FRAC_CONST(0.024071170470652), FRAC_CONST(0.038780305381806) },
+ { FRAC_CONST(0.023816840213160), FRAC_CONST(0.038937019089732) },
+ { FRAC_CONST(0.023561489721501), FRAC_CONST(0.039092064865353) },
+ { FRAC_CONST(0.023305129934041), FRAC_CONST(0.039245436067023) },
+ { FRAC_CONST(0.023047771832380), FRAC_CONST(0.039397126124832) },
+ { FRAC_CONST(0.022789426440883), FRAC_CONST(0.039547128540881) },
+ { FRAC_CONST(0.022530104826206), FRAC_CONST(0.039695436889566) },
+ { FRAC_CONST(0.022269818096825), FRAC_CONST(0.039842044817851) },
+ { FRAC_CONST(0.022008577402555), FRAC_CONST(0.039986946045542) },
+ { FRAC_CONST(0.021746393934081), FRAC_CONST(0.040130134365550) },
+ { FRAC_CONST(0.021483278922467), FRAC_CONST(0.040271603644166) },
+ { FRAC_CONST(0.021219243638687), FRAC_CONST(0.040411347821316) },
+ { FRAC_CONST(0.020954299393132), FRAC_CONST(0.040549360910825) },
+ { FRAC_CONST(0.020688457535133), FRAC_CONST(0.040685637000671) },
+ { FRAC_CONST(0.020421729452469), FRAC_CONST(0.040820170253240) },
+ { FRAC_CONST(0.020154126570884), FRAC_CONST(0.040952954905576) },
+ { FRAC_CONST(0.019885660353596), FRAC_CONST(0.041083985269625) },
+ { FRAC_CONST(0.019616342300802), FRAC_CONST(0.041213255732484) },
+ { FRAC_CONST(0.019346183949192), FRAC_CONST(0.041340760756635) },
+ { FRAC_CONST(0.019075196871451), FRAC_CONST(0.041466494880189) },
+ { FRAC_CONST(0.018803392675763), FRAC_CONST(0.041590452717113) },
+ { FRAC_CONST(0.018530783005316), FRAC_CONST(0.041712628957466) },
+ { FRAC_CONST(0.018257379537800), FRAC_CONST(0.041833018367625) },
+ { FRAC_CONST(0.017983193984910), FRAC_CONST(0.041951615790509) },
+ { FRAC_CONST(0.017708238091842), FRAC_CONST(0.042068416145797) },
+ { FRAC_CONST(0.017432523636792), FRAC_CONST(0.042183414430153) },
+ { FRAC_CONST(0.017156062430449), FRAC_CONST(0.042296605717432) },
+ { FRAC_CONST(0.016878866315491), FRAC_CONST(0.042407985158896) },
+ { FRAC_CONST(0.016600947166078), FRAC_CONST(0.042517547983420) },
+ { FRAC_CONST(0.016322316887341), FRAC_CONST(0.042625289497698) },
+ { FRAC_CONST(0.016042987414872), FRAC_CONST(0.042731205086442) },
+ { FRAC_CONST(0.015762970714219), FRAC_CONST(0.042835290212581) },
+ { FRAC_CONST(0.015482278780363), FRAC_CONST(0.042937540417454) },
+ { FRAC_CONST(0.015200923637213), FRAC_CONST(0.043037951321002) },
+ { FRAC_CONST(0.014918917337087), FRAC_CONST(0.043136518621958) },
+ { FRAC_CONST(0.014636271960196), FRAC_CONST(0.043233238098025) },
+ { FRAC_CONST(0.014352999614128), FRAC_CONST(0.043328105606063) },
+ { FRAC_CONST(0.014069112433327), FRAC_CONST(0.043421117082265) },
+ { FRAC_CONST(0.013784622578575), FRAC_CONST(0.043512268542327) },
+ { FRAC_CONST(0.013499542236471), FRAC_CONST(0.043601556081625) },
+ { FRAC_CONST(0.013213883618907), FRAC_CONST(0.043688975875378) },
+ { FRAC_CONST(0.012927658962548), FRAC_CONST(0.043774524178812) },
+ { FRAC_CONST(0.012640880528305), FRAC_CONST(0.043858197327323) },
+ { FRAC_CONST(0.012353560600813), FRAC_CONST(0.043939991736633) },
+ { FRAC_CONST(0.012065711487901), FRAC_CONST(0.044019903902940) },
+ { FRAC_CONST(0.011777345520066), FRAC_CONST(0.044097930403073) },
+ { FRAC_CONST(0.011488475049948), FRAC_CONST(0.044174067894638) },
+ { FRAC_CONST(0.011199112451794), FRAC_CONST(0.044248313116156) },
+ { FRAC_CONST(0.010909270120937), FRAC_CONST(0.044320662887211) },
+ { FRAC_CONST(0.010618960473257), FRAC_CONST(0.044391114108577) },
+ { FRAC_CONST(0.010328195944653), FRAC_CONST(0.044459663762361) },
+ { FRAC_CONST(0.010036988990509), FRAC_CONST(0.044526308912122) },
+ { FRAC_CONST(0.009745352085163), FRAC_CONST(0.044591046703005) },
+ { FRAC_CONST(0.009453297721368), FRAC_CONST(0.044653874361857) },
+ { FRAC_CONST(0.009160838409762), FRAC_CONST(0.044714789197351) },
+ { FRAC_CONST(0.008867986678328), FRAC_CONST(0.044773788600099) },
+ { FRAC_CONST(0.008574755071860), FRAC_CONST(0.044830870042761) },
+ { FRAC_CONST(0.008281156151424), FRAC_CONST(0.044886031080160) },
+ { FRAC_CONST(0.007987202493820), FRAC_CONST(0.044939269349379) },
+ { FRAC_CONST(0.007692906691044), FRAC_CONST(0.044990582569869) },
+ { FRAC_CONST(0.007398281349750), FRAC_CONST(0.045039968543542) },
+ { FRAC_CONST(0.007103339090706), FRAC_CONST(0.045087425154868) },
+ { FRAC_CONST(0.006808092548258), FRAC_CONST(0.045132950370962) },
+ { FRAC_CONST(0.006512554369783), FRAC_CONST(0.045176542241676) },
+ { FRAC_CONST(0.006216737215155), FRAC_CONST(0.045218198899680) },
+ { FRAC_CONST(0.005920653756196), FRAC_CONST(0.045257918560541) },
+ { FRAC_CONST(0.005624316676135), FRAC_CONST(0.045295699522801) },
+ { FRAC_CONST(0.005327738669067), FRAC_CONST(0.045331540168049) },
+ { FRAC_CONST(0.005030932439406), FRAC_CONST(0.045365438960992) },
+ { FRAC_CONST(0.004733910701344), FRAC_CONST(0.045397394449517) },
+ { FRAC_CONST(0.004436686178303), FRAC_CONST(0.045427405264758) },
+ { FRAC_CONST(0.004139271602393), FRAC_CONST(0.045455470121152) },
+ { FRAC_CONST(0.003841679713863), FRAC_CONST(0.045481587816494) },
+ { FRAC_CONST(0.003543923260561), FRAC_CONST(0.045505757231988) },
+ { FRAC_CONST(0.003246014997382), FRAC_CONST(0.045527977332297) },
+ { FRAC_CONST(0.002947967685724), FRAC_CONST(0.045548247165585) },
+ { FRAC_CONST(0.002649794092941), FRAC_CONST(0.045566565863562) },
+ { FRAC_CONST(0.002351506991799), FRAC_CONST(0.045582932641515) },
+ { FRAC_CONST(0.002053119159924), FRAC_CONST(0.045597346798344) },
+ { FRAC_CONST(0.001754643379257), FRAC_CONST(0.045609807716597) },
+ { FRAC_CONST(0.001456092435508), FRAC_CONST(0.045620314862489) },
+ { FRAC_CONST(0.001157479117605), FRAC_CONST(0.045628867785927) },
+ { FRAC_CONST(0.000858816217149), FRAC_CONST(0.045635466120535) },
+ { FRAC_CONST(0.000560116527865), FRAC_CONST(0.045640109583661) },
+ { FRAC_CONST(0.000261392845053), FRAC_CONST(0.045642797976394) }
+};
#endif // LD_DEC
- /* 60 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_240[] =
- {
- { FRAC_CONST(0.091286604111815), FRAC_CONST(0.000298735779793) },
- { FRAC_CONST(0.091247502481454), FRAC_CONST(0.002688238127538) },
- { FRAC_CONST(0.091145864370807), FRAC_CONST(0.005075898091152) },
- { FRAC_CONST(0.090981759437558), FRAC_CONST(0.007460079287760) },
- { FRAC_CONST(0.090755300151030), FRAC_CONST(0.009839147718664) },
- { FRAC_CONST(0.090466641715108), FRAC_CONST(0.012211472889198) },
- { FRAC_CONST(0.090115981961863), FRAC_CONST(0.014575428926191) },
- { FRAC_CONST(0.089703561215976), FRAC_CONST(0.016929395692256) },
- { FRAC_CONST(0.089229662130024), FRAC_CONST(0.019271759896156) },
- { FRAC_CONST(0.088694609490769), FRAC_CONST(0.021600916198470) },
- { FRAC_CONST(0.088098769996564), FRAC_CONST(0.023915268311810) },
- { FRAC_CONST(0.087442552006035), FRAC_CONST(0.026213230094844) },
- { FRAC_CONST(0.086726405258214), FRAC_CONST(0.028493226639351) },
- { FRAC_CONST(0.085950820564309), FRAC_CONST(0.030753695349588) },
- { FRAC_CONST(0.085116329471329), FRAC_CONST(0.032993087013213) },
- { FRAC_CONST(0.084223503897785), FRAC_CONST(0.035209866863042) },
- { FRAC_CONST(0.083272955741727), FRAC_CONST(0.037402515628894) },
- { FRAC_CONST(0.082265336461381), FRAC_CONST(0.039569530578832) },
- { FRAC_CONST(0.081201336628670), FRAC_CONST(0.041709426549053) },
- { FRAC_CONST(0.080081685455930), FRAC_CONST(0.043820736961749) },
- { FRAC_CONST(0.078907150296148), FRAC_CONST(0.045902014830227) },
- { FRAC_CONST(0.077678536117054), FRAC_CONST(0.047951833750597) },
- { FRAC_CONST(0.076396684949434), FRAC_CONST(0.049968788879362) },
- { FRAC_CONST(0.075062475310050), FRAC_CONST(0.051951497896226) },
- { FRAC_CONST(0.073676821599542), FRAC_CONST(0.053898601951466) },
- { FRAC_CONST(0.072240673475749), FRAC_CONST(0.055808766597225) },
- { FRAC_CONST(0.070755015202858), FRAC_CONST(0.057680682702068) },
- { FRAC_CONST(0.069220864976840), FRAC_CONST(0.059513067348201) },
- { FRAC_CONST(0.067639274227625), FRAC_CONST(0.061304664710718) },
- { FRAC_CONST(0.066011326898512), FRAC_CONST(0.063054246918278) },
- { FRAC_CONST(0.064338138703282), FRAC_CONST(0.064760614894630) },
- { FRAC_CONST(0.062620856361546), FRAC_CONST(0.066422599180399) },
- { FRAC_CONST(0.060860656812842), FRAC_CONST(0.068039060734572) },
- { FRAC_CONST(0.059058746410016), FRAC_CONST(0.069608891715145) },
- { FRAC_CONST(0.057216360092450), FRAC_CONST(0.071131016238378) },
- { FRAC_CONST(0.055334760539699), FRAC_CONST(0.072604391116154) },
- { FRAC_CONST(0.053415237306106), FRAC_CONST(0.074028006570930) },
- { FRAC_CONST(0.051459105937014), FRAC_CONST(0.075400886927784) },
- { FRAC_CONST(0.049467707067153), FRAC_CONST(0.076722091283096) },
- { FRAC_CONST(0.047442405501835), FRAC_CONST(0.077990714149396) },
- { FRAC_CONST(0.045384589281588), FRAC_CONST(0.079205886075941) },
- { FRAC_CONST(0.043295668730857), FRAC_CONST(0.080366774244592) },
- { FRAC_CONST(0.041177075491445), FRAC_CONST(0.081472583040586) },
- { FRAC_CONST(0.039030261541332), FRAC_CONST(0.082522554597810) },
- { FRAC_CONST(0.036856698199564), FRAC_CONST(0.083515969318206) },
- { FRAC_CONST(0.034657875117883), FRAC_CONST(0.084452146364948) },
- { FRAC_CONST(0.032435299259796), FRAC_CONST(0.085330444129049) },
- { FRAC_CONST(0.030190493867775), FRAC_CONST(0.086150260669096) },
- { FRAC_CONST(0.027924997419306), FRAC_CONST(0.086911034123781) },
- { FRAC_CONST(0.025640362572491), FRAC_CONST(0.087612243096981) },
- { FRAC_CONST(0.023338155101933), FRAC_CONST(0.088253407015092) },
- { FRAC_CONST(0.021019952825636), FRAC_CONST(0.088834086456390) },
- { FRAC_CONST(0.018687344523641), FRAC_CONST(0.089353883452193) },
- { FRAC_CONST(0.016341928849164), FRAC_CONST(0.089812441759604) },
- { FRAC_CONST(0.013985313232951), FRAC_CONST(0.090209447105664) },
- { FRAC_CONST(0.011619112781631), FRAC_CONST(0.090544627402740) },
- { FRAC_CONST(0.009244949170797), FRAC_CONST(0.090817752935000) },
- { FRAC_CONST(0.006864449533597), FRAC_CONST(0.091028636515846) },
- { FRAC_CONST(0.004479245345574), FRAC_CONST(0.091177133616206) },
- { FRAC_CONST(0.002090971306534), FRAC_CONST(0.091263142463585) }
- };
+/* 60 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_240[] =
+{
+ { FRAC_CONST(0.091286604111815), FRAC_CONST(0.000298735779793) },
+ { FRAC_CONST(0.091247502481454), FRAC_CONST(0.002688238127538) },
+ { FRAC_CONST(0.091145864370807), FRAC_CONST(0.005075898091152) },
+ { FRAC_CONST(0.090981759437558), FRAC_CONST(0.007460079287760) },
+ { FRAC_CONST(0.090755300151030), FRAC_CONST(0.009839147718664) },
+ { FRAC_CONST(0.090466641715108), FRAC_CONST(0.012211472889198) },
+ { FRAC_CONST(0.090115981961863), FRAC_CONST(0.014575428926191) },
+ { FRAC_CONST(0.089703561215976), FRAC_CONST(0.016929395692256) },
+ { FRAC_CONST(0.089229662130024), FRAC_CONST(0.019271759896156) },
+ { FRAC_CONST(0.088694609490769), FRAC_CONST(0.021600916198470) },
+ { FRAC_CONST(0.088098769996564), FRAC_CONST(0.023915268311810) },
+ { FRAC_CONST(0.087442552006035), FRAC_CONST(0.026213230094844) },
+ { FRAC_CONST(0.086726405258214), FRAC_CONST(0.028493226639351) },
+ { FRAC_CONST(0.085950820564309), FRAC_CONST(0.030753695349588) },
+ { FRAC_CONST(0.085116329471329), FRAC_CONST(0.032993087013213) },
+ { FRAC_CONST(0.084223503897785), FRAC_CONST(0.035209866863042) },
+ { FRAC_CONST(0.083272955741727), FRAC_CONST(0.037402515628894) },
+ { FRAC_CONST(0.082265336461381), FRAC_CONST(0.039569530578832) },
+ { FRAC_CONST(0.081201336628670), FRAC_CONST(0.041709426549053) },
+ { FRAC_CONST(0.080081685455930), FRAC_CONST(0.043820736961749) },
+ { FRAC_CONST(0.078907150296148), FRAC_CONST(0.045902014830227) },
+ { FRAC_CONST(0.077678536117054), FRAC_CONST(0.047951833750597) },
+ { FRAC_CONST(0.076396684949434), FRAC_CONST(0.049968788879362) },
+ { FRAC_CONST(0.075062475310050), FRAC_CONST(0.051951497896226) },
+ { FRAC_CONST(0.073676821599542), FRAC_CONST(0.053898601951466) },
+ { FRAC_CONST(0.072240673475749), FRAC_CONST(0.055808766597225) },
+ { FRAC_CONST(0.070755015202858), FRAC_CONST(0.057680682702068) },
+ { FRAC_CONST(0.069220864976840), FRAC_CONST(0.059513067348201) },
+ { FRAC_CONST(0.067639274227625), FRAC_CONST(0.061304664710718) },
+ { FRAC_CONST(0.066011326898512), FRAC_CONST(0.063054246918278) },
+ { FRAC_CONST(0.064338138703282), FRAC_CONST(0.064760614894630) },
+ { FRAC_CONST(0.062620856361546), FRAC_CONST(0.066422599180399) },
+ { FRAC_CONST(0.060860656812842), FRAC_CONST(0.068039060734572) },
+ { FRAC_CONST(0.059058746410016), FRAC_CONST(0.069608891715145) },
+ { FRAC_CONST(0.057216360092450), FRAC_CONST(0.071131016238378) },
+ { FRAC_CONST(0.055334760539699), FRAC_CONST(0.072604391116154) },
+ { FRAC_CONST(0.053415237306106), FRAC_CONST(0.074028006570930) },
+ { FRAC_CONST(0.051459105937014), FRAC_CONST(0.075400886927784) },
+ { FRAC_CONST(0.049467707067153), FRAC_CONST(0.076722091283096) },
+ { FRAC_CONST(0.047442405501835), FRAC_CONST(0.077990714149396) },
+ { FRAC_CONST(0.045384589281588), FRAC_CONST(0.079205886075941) },
+ { FRAC_CONST(0.043295668730857), FRAC_CONST(0.080366774244592) },
+ { FRAC_CONST(0.041177075491445), FRAC_CONST(0.081472583040586) },
+ { FRAC_CONST(0.039030261541332), FRAC_CONST(0.082522554597810) },
+ { FRAC_CONST(0.036856698199564), FRAC_CONST(0.083515969318206) },
+ { FRAC_CONST(0.034657875117883), FRAC_CONST(0.084452146364948) },
+ { FRAC_CONST(0.032435299259796), FRAC_CONST(0.085330444129049) },
+ { FRAC_CONST(0.030190493867775), FRAC_CONST(0.086150260669096) },
+ { FRAC_CONST(0.027924997419306), FRAC_CONST(0.086911034123781) },
+ { FRAC_CONST(0.025640362572491), FRAC_CONST(0.087612243096981) },
+ { FRAC_CONST(0.023338155101933), FRAC_CONST(0.088253407015092) },
+ { FRAC_CONST(0.021019952825636), FRAC_CONST(0.088834086456390) },
+ { FRAC_CONST(0.018687344523641), FRAC_CONST(0.089353883452193) },
+ { FRAC_CONST(0.016341928849164), FRAC_CONST(0.089812441759604) },
+ { FRAC_CONST(0.013985313232951), FRAC_CONST(0.090209447105664) },
+ { FRAC_CONST(0.011619112781631), FRAC_CONST(0.090544627402740) },
+ { FRAC_CONST(0.009244949170797), FRAC_CONST(0.090817752935000) },
+ { FRAC_CONST(0.006864449533597), FRAC_CONST(0.091028636515846) },
+ { FRAC_CONST(0.004479245345574), FRAC_CONST(0.091177133616206) },
+ { FRAC_CONST(0.002090971306534), FRAC_CONST(0.091263142463585) }
+};
#endif // ALLOW_SMALL_FRAMELENGTH
#ifdef SSR_DEC
- /* 128 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_512[] =
- {
- { FRAC_CONST(0.062499926465731), FRAC_CONST(0.000095873761643) },
- { FRAC_CONST(0.062494043817678), FRAC_CONST(0.000862836783004) },
- { FRAC_CONST(0.062478749796497), FRAC_CONST(0.001629669864319) },
- { FRAC_CONST(0.062454046705412), FRAC_CONST(0.002396257523347) },
- { FRAC_CONST(0.062419938264617), FRAC_CONST(0.003162484314806) },
- { FRAC_CONST(0.062376429610718), FRAC_CONST(0.003928234847760) },
- { FRAC_CONST(0.062323527295958), FRAC_CONST(0.004693393802995) },
- { FRAC_CONST(0.062261239287231), FRAC_CONST(0.005457845950387) },
- { FRAC_CONST(0.062189574964882), FRAC_CONST(0.006221476166254) },
- { FRAC_CONST(0.062108545121295), FRAC_CONST(0.006984169450695) },
- { FRAC_CONST(0.062018161959266), FRAC_CONST(0.007745810944907) },
- { FRAC_CONST(0.061918439090167), FRAC_CONST(0.008506285948482) },
- { FRAC_CONST(0.061809391531894), FRAC_CONST(0.009265479936681) },
- { FRAC_CONST(0.061691035706609), FRAC_CONST(0.010023278577683) },
- { FRAC_CONST(0.061563389438265), FRAC_CONST(0.010779567749800) },
- { FRAC_CONST(0.061426471949919), FRAC_CONST(0.011534233558664) },
- { FRAC_CONST(0.061280303860842), FRAC_CONST(0.012287162354380) },
- { FRAC_CONST(0.061124907183410), FRAC_CONST(0.013038240748641) },
- { FRAC_CONST(0.060960305319791), FRAC_CONST(0.013787355631805) },
- { FRAC_CONST(0.060786523058421), FRAC_CONST(0.014534394189923) },
- { FRAC_CONST(0.060603586570268), FRAC_CONST(0.015279243921739) },
- { FRAC_CONST(0.060411523404896), FRAC_CONST(0.016021792655621) },
- { FRAC_CONST(0.060210362486310), FRAC_CONST(0.016761928566463) },
- { FRAC_CONST(0.060000134108604), FRAC_CONST(0.017499540192517) },
- { FRAC_CONST(0.059780869931400), FRAC_CONST(0.018234516452187) },
- { FRAC_CONST(0.059552602975075), FRAC_CONST(0.018966746660751) },
- { FRAC_CONST(0.059315367615794), FRAC_CONST(0.019696120547033) },
- { FRAC_CONST(0.059069199580329), FRAC_CONST(0.020422528270008) },
- { FRAC_CONST(0.058814135940681), FRAC_CONST(0.021145860435346) },
- { FRAC_CONST(0.058550215108495), FRAC_CONST(0.021866008111883) },
- { FRAC_CONST(0.058277476829279), FRAC_CONST(0.022582862848028) },
- { FRAC_CONST(0.057995962176414), FRAC_CONST(0.023296316688095) },
- { FRAC_CONST(0.057705713544970), FRAC_CONST(0.024006262188558) },
- { FRAC_CONST(0.057406774645326), FRAC_CONST(0.024712592434239) },
- { FRAC_CONST(0.057099190496578), FRAC_CONST(0.025415201054398) },
- { FRAC_CONST(0.056783007419769), FRAC_CONST(0.026113982238763) },
- { FRAC_CONST(0.056458273030907), FRAC_CONST(0.026808830753458) },
- { FRAC_CONST(0.056125036233796), FRAC_CONST(0.027499641956852) },
- { FRAC_CONST(0.055783347212673), FRAC_CONST(0.028186311815319) },
- { FRAC_CONST(0.055433257424646), FRAC_CONST(0.028868736918904) },
- { FRAC_CONST(0.055074819591951), FRAC_CONST(0.029546814496896) },
- { FRAC_CONST(0.054708087694007), FRAC_CONST(0.030220442433307) },
- { FRAC_CONST(0.054333116959288), FRAC_CONST(0.030889519282247) },
- { FRAC_CONST(0.053949963857008), FRAC_CONST(0.031553944283204) },
- { FRAC_CONST(0.053558686088614), FRAC_CONST(0.032213617376216) },
- { FRAC_CONST(0.053159342579100), FRAC_CONST(0.032868439216943) },
- { FRAC_CONST(0.052751993468129), FRAC_CONST(0.033518311191623) },
- { FRAC_CONST(0.052336700100979), FRAC_CONST(0.034163135431927) },
- { FRAC_CONST(0.051913525019303), FRAC_CONST(0.034802814829698) },
- { FRAC_CONST(0.051482531951712), FRAC_CONST(0.035437253051569) },
- { FRAC_CONST(0.051043785804177), FRAC_CONST(0.036066354553480) },
- { FRAC_CONST(0.050597352650253), FRAC_CONST(0.036690024595057) },
- { FRAC_CONST(0.050143299721132), FRAC_CONST(0.037308169253887) },
- { FRAC_CONST(0.049681695395515), FRAC_CONST(0.037920695439658) },
- { FRAC_CONST(0.049212609189314), FRAC_CONST(0.038527510908178) },
- { FRAC_CONST(0.048736111745188), FRAC_CONST(0.039128524275271) },
- { FRAC_CONST(0.048252274821899), FRAC_CONST(0.039723645030535) },
- { FRAC_CONST(0.047761171283507), FRAC_CONST(0.040312783550971) },
- { FRAC_CONST(0.047262875088400), FRAC_CONST(0.040895851114488) },
- { FRAC_CONST(0.046757461278150), FRAC_CONST(0.041472759913252) },
- { FRAC_CONST(0.046245005966220), FRAC_CONST(0.042043423066923) },
- { FRAC_CONST(0.045725586326493), FRAC_CONST(0.042607754635728) },
- { FRAC_CONST(0.045199280581658), FRAC_CONST(0.043165669633408) },
- { FRAC_CONST(0.044666167991423), FRAC_CONST(0.043717084040018) },
- { FRAC_CONST(0.044126328840584), FRAC_CONST(0.044261914814575) },
- { FRAC_CONST(0.043579844426930), FRAC_CONST(0.044800079907569) },
- { FRAC_CONST(0.043026797049006), FRAC_CONST(0.045331498273316) },
- { FRAC_CONST(0.042467269993710), FRAC_CONST(0.045856089882166) },
- { FRAC_CONST(0.041901347523761), FRAC_CONST(0.046373775732552) },
- { FRAC_CONST(0.041329114865000), FRAC_CONST(0.046884477862888) },
- { FRAC_CONST(0.040750658193560), FRAC_CONST(0.047388119363313) },
- { FRAC_CONST(0.040166064622889), FRAC_CONST(0.047884624387270) },
- { FRAC_CONST(0.039575422190629), FRAC_CONST(0.048373918162926) },
- { FRAC_CONST(0.038978819845356), FRAC_CONST(0.048855927004441) },
- { FRAC_CONST(0.038376347433190), FRAC_CONST(0.049330578323055) },
- { FRAC_CONST(0.037768095684260), FRAC_CONST(0.049797800638026) },
- { FRAC_CONST(0.037154156199042), FRAC_CONST(0.050257523587392) },
- { FRAC_CONST(0.036534621434563), FRAC_CONST(0.050709677938566) },
- { FRAC_CONST(0.035909584690482), FRAC_CONST(0.051154195598769) },
- { FRAC_CONST(0.035279140095032), FRAC_CONST(0.051591009625274) },
- { FRAC_CONST(0.034643382590851), FRAC_CONST(0.052020054235496) },
- { FRAC_CONST(0.034002407920680), FRAC_CONST(0.052441264816895) },
- { FRAC_CONST(0.033356312612947), FRAC_CONST(0.052854577936706) },
- { FRAC_CONST(0.032705193967229), FRAC_CONST(0.053259931351495) },
- { FRAC_CONST(0.032049150039598), FRAC_CONST(0.053657264016528) },
- { FRAC_CONST(0.031388279627857), FRAC_CONST(0.054046516094966) },
- { FRAC_CONST(0.030722682256659), FRAC_CONST(0.054427628966880) },
- { FRAC_CONST(0.030052458162521), FRAC_CONST(0.054800545238072) },
- { FRAC_CONST(0.029377708278725), FRAC_CONST(0.055165208748723) },
- { FRAC_CONST(0.028698534220122), FRAC_CONST(0.055521564581850) },
- { FRAC_CONST(0.028015038267826), FRAC_CONST(0.055869559071575) },
- { FRAC_CONST(0.027327323353815), FRAC_CONST(0.056209139811209) },
- { FRAC_CONST(0.026635493045425), FRAC_CONST(0.056540255661140) },
- { FRAC_CONST(0.025939651529755), FRAC_CONST(0.056862856756541) },
- { FRAC_CONST(0.025239903597978), FRAC_CONST(0.057176894514872) },
- { FRAC_CONST(0.024536354629559), FRAC_CONST(0.057482321643202) },
- { FRAC_CONST(0.023829110576385), FRAC_CONST(0.057779092145329) },
- { FRAC_CONST(0.023118277946808), FRAC_CONST(0.058067161328707) },
- { FRAC_CONST(0.022403963789609), FRAC_CONST(0.058346485811177) },
- { FRAC_CONST(0.021686275677870), FRAC_CONST(0.058617023527499) },
- { FRAC_CONST(0.020965321692783), FRAC_CONST(0.058878733735689) },
- { FRAC_CONST(0.020241210407366), FRAC_CONST(0.059131577023150) },
- { FRAC_CONST(0.019514050870114), FRAC_CONST(0.059375515312615) },
- { FRAC_CONST(0.018783952588580), FRAC_CONST(0.059610511867874) },
- { FRAC_CONST(0.018051025512878), FRAC_CONST(0.059836531299311) },
- { FRAC_CONST(0.017315380019131), FRAC_CONST(0.060053539569230) },
- { FRAC_CONST(0.016577126892844), FRAC_CONST(0.060261503996984) },
- { FRAC_CONST(0.015836377312223), FRAC_CONST(0.060460393263896) },
- { FRAC_CONST(0.015093242831429), FRAC_CONST(0.060650177417972) },
- { FRAC_CONST(0.014347835363782), FRAC_CONST(0.060830827878419) },
- { FRAC_CONST(0.013600267164905), FRAC_CONST(0.061002317439940) },
- { FRAC_CONST(0.012850650815819), FRAC_CONST(0.061164620276839) },
- { FRAC_CONST(0.012099099205988), FRAC_CONST(0.061317711946905) },
- { FRAC_CONST(0.011345725516320), FRAC_CONST(0.061461569395097) },
- { FRAC_CONST(0.010590643202123), FRAC_CONST(0.061596170957011) },
- { FRAC_CONST(0.009833965976015), FRAC_CONST(0.061721496362147) },
- { FRAC_CONST(0.009075807790803), FRAC_CONST(0.061837526736961) },
- { FRAC_CONST(0.008316282822321), FRAC_CONST(0.061944244607705) },
- { FRAC_CONST(0.007555505452236), FRAC_CONST(0.062041633903059) },
- { FRAC_CONST(0.006793590250821), FRAC_CONST(0.062129679956555) },
- { FRAC_CONST(0.006030651959703), FRAC_CONST(0.062208369508780) },
- { FRAC_CONST(0.005266805474583), FRAC_CONST(0.062277690709378) },
- { FRAC_CONST(0.004502165827931), FRAC_CONST(0.062337633118830) },
- { FRAC_CONST(0.003736848171665), FRAC_CONST(0.062388187710030) },
- { FRAC_CONST(0.002970967759810), FRAC_CONST(0.062429346869643) },
- { FRAC_CONST(0.002204639931138), FRAC_CONST(0.062461104399250) },
- { FRAC_CONST(0.001437980091802), FRAC_CONST(0.062483455516285) },
- { FRAC_CONST(0.000671103697954), FRAC_CONST(0.062496396854751) }
- };
+/* 128 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_512[] =
+{
+ { FRAC_CONST(0.062499926465731), FRAC_CONST(0.000095873761643) },
+ { FRAC_CONST(0.062494043817678), FRAC_CONST(0.000862836783004) },
+ { FRAC_CONST(0.062478749796497), FRAC_CONST(0.001629669864319) },
+ { FRAC_CONST(0.062454046705412), FRAC_CONST(0.002396257523347) },
+ { FRAC_CONST(0.062419938264617), FRAC_CONST(0.003162484314806) },
+ { FRAC_CONST(0.062376429610718), FRAC_CONST(0.003928234847760) },
+ { FRAC_CONST(0.062323527295958), FRAC_CONST(0.004693393802995) },
+ { FRAC_CONST(0.062261239287231), FRAC_CONST(0.005457845950387) },
+ { FRAC_CONST(0.062189574964882), FRAC_CONST(0.006221476166254) },
+ { FRAC_CONST(0.062108545121295), FRAC_CONST(0.006984169450695) },
+ { FRAC_CONST(0.062018161959266), FRAC_CONST(0.007745810944907) },
+ { FRAC_CONST(0.061918439090167), FRAC_CONST(0.008506285948482) },
+ { FRAC_CONST(0.061809391531894), FRAC_CONST(0.009265479936681) },
+ { FRAC_CONST(0.061691035706609), FRAC_CONST(0.010023278577683) },
+ { FRAC_CONST(0.061563389438265), FRAC_CONST(0.010779567749800) },
+ { FRAC_CONST(0.061426471949919), FRAC_CONST(0.011534233558664) },
+ { FRAC_CONST(0.061280303860842), FRAC_CONST(0.012287162354380) },
+ { FRAC_CONST(0.061124907183410), FRAC_CONST(0.013038240748641) },
+ { FRAC_CONST(0.060960305319791), FRAC_CONST(0.013787355631805) },
+ { FRAC_CONST(0.060786523058421), FRAC_CONST(0.014534394189923) },
+ { FRAC_CONST(0.060603586570268), FRAC_CONST(0.015279243921739) },
+ { FRAC_CONST(0.060411523404896), FRAC_CONST(0.016021792655621) },
+ { FRAC_CONST(0.060210362486310), FRAC_CONST(0.016761928566463) },
+ { FRAC_CONST(0.060000134108604), FRAC_CONST(0.017499540192517) },
+ { FRAC_CONST(0.059780869931400), FRAC_CONST(0.018234516452187) },
+ { FRAC_CONST(0.059552602975075), FRAC_CONST(0.018966746660751) },
+ { FRAC_CONST(0.059315367615794), FRAC_CONST(0.019696120547033) },
+ { FRAC_CONST(0.059069199580329), FRAC_CONST(0.020422528270008) },
+ { FRAC_CONST(0.058814135940681), FRAC_CONST(0.021145860435346) },
+ { FRAC_CONST(0.058550215108495), FRAC_CONST(0.021866008111883) },
+ { FRAC_CONST(0.058277476829279), FRAC_CONST(0.022582862848028) },
+ { FRAC_CONST(0.057995962176414), FRAC_CONST(0.023296316688095) },
+ { FRAC_CONST(0.057705713544970), FRAC_CONST(0.024006262188558) },
+ { FRAC_CONST(0.057406774645326), FRAC_CONST(0.024712592434239) },
+ { FRAC_CONST(0.057099190496578), FRAC_CONST(0.025415201054398) },
+ { FRAC_CONST(0.056783007419769), FRAC_CONST(0.026113982238763) },
+ { FRAC_CONST(0.056458273030907), FRAC_CONST(0.026808830753458) },
+ { FRAC_CONST(0.056125036233796), FRAC_CONST(0.027499641956852) },
+ { FRAC_CONST(0.055783347212673), FRAC_CONST(0.028186311815319) },
+ { FRAC_CONST(0.055433257424646), FRAC_CONST(0.028868736918904) },
+ { FRAC_CONST(0.055074819591951), FRAC_CONST(0.029546814496896) },
+ { FRAC_CONST(0.054708087694007), FRAC_CONST(0.030220442433307) },
+ { FRAC_CONST(0.054333116959288), FRAC_CONST(0.030889519282247) },
+ { FRAC_CONST(0.053949963857008), FRAC_CONST(0.031553944283204) },
+ { FRAC_CONST(0.053558686088614), FRAC_CONST(0.032213617376216) },
+ { FRAC_CONST(0.053159342579100), FRAC_CONST(0.032868439216943) },
+ { FRAC_CONST(0.052751993468129), FRAC_CONST(0.033518311191623) },
+ { FRAC_CONST(0.052336700100979), FRAC_CONST(0.034163135431927) },
+ { FRAC_CONST(0.051913525019303), FRAC_CONST(0.034802814829698) },
+ { FRAC_CONST(0.051482531951712), FRAC_CONST(0.035437253051569) },
+ { FRAC_CONST(0.051043785804177), FRAC_CONST(0.036066354553480) },
+ { FRAC_CONST(0.050597352650253), FRAC_CONST(0.036690024595057) },
+ { FRAC_CONST(0.050143299721132), FRAC_CONST(0.037308169253887) },
+ { FRAC_CONST(0.049681695395515), FRAC_CONST(0.037920695439658) },
+ { FRAC_CONST(0.049212609189314), FRAC_CONST(0.038527510908178) },
+ { FRAC_CONST(0.048736111745188), FRAC_CONST(0.039128524275271) },
+ { FRAC_CONST(0.048252274821899), FRAC_CONST(0.039723645030535) },
+ { FRAC_CONST(0.047761171283507), FRAC_CONST(0.040312783550971) },
+ { FRAC_CONST(0.047262875088400), FRAC_CONST(0.040895851114488) },
+ { FRAC_CONST(0.046757461278150), FRAC_CONST(0.041472759913252) },
+ { FRAC_CONST(0.046245005966220), FRAC_CONST(0.042043423066923) },
+ { FRAC_CONST(0.045725586326493), FRAC_CONST(0.042607754635728) },
+ { FRAC_CONST(0.045199280581658), FRAC_CONST(0.043165669633408) },
+ { FRAC_CONST(0.044666167991423), FRAC_CONST(0.043717084040018) },
+ { FRAC_CONST(0.044126328840584), FRAC_CONST(0.044261914814575) },
+ { FRAC_CONST(0.043579844426930), FRAC_CONST(0.044800079907569) },
+ { FRAC_CONST(0.043026797049006), FRAC_CONST(0.045331498273316) },
+ { FRAC_CONST(0.042467269993710), FRAC_CONST(0.045856089882166) },
+ { FRAC_CONST(0.041901347523761), FRAC_CONST(0.046373775732552) },
+ { FRAC_CONST(0.041329114865000), FRAC_CONST(0.046884477862888) },
+ { FRAC_CONST(0.040750658193560), FRAC_CONST(0.047388119363313) },
+ { FRAC_CONST(0.040166064622889), FRAC_CONST(0.047884624387270) },
+ { FRAC_CONST(0.039575422190629), FRAC_CONST(0.048373918162926) },
+ { FRAC_CONST(0.038978819845356), FRAC_CONST(0.048855927004441) },
+ { FRAC_CONST(0.038376347433190), FRAC_CONST(0.049330578323055) },
+ { FRAC_CONST(0.037768095684260), FRAC_CONST(0.049797800638026) },
+ { FRAC_CONST(0.037154156199042), FRAC_CONST(0.050257523587392) },
+ { FRAC_CONST(0.036534621434563), FRAC_CONST(0.050709677938566) },
+ { FRAC_CONST(0.035909584690482), FRAC_CONST(0.051154195598769) },
+ { FRAC_CONST(0.035279140095032), FRAC_CONST(0.051591009625274) },
+ { FRAC_CONST(0.034643382590851), FRAC_CONST(0.052020054235496) },
+ { FRAC_CONST(0.034002407920680), FRAC_CONST(0.052441264816895) },
+ { FRAC_CONST(0.033356312612947), FRAC_CONST(0.052854577936706) },
+ { FRAC_CONST(0.032705193967229), FRAC_CONST(0.053259931351495) },
+ { FRAC_CONST(0.032049150039598), FRAC_CONST(0.053657264016528) },
+ { FRAC_CONST(0.031388279627857), FRAC_CONST(0.054046516094966) },
+ { FRAC_CONST(0.030722682256659), FRAC_CONST(0.054427628966880) },
+ { FRAC_CONST(0.030052458162521), FRAC_CONST(0.054800545238072) },
+ { FRAC_CONST(0.029377708278725), FRAC_CONST(0.055165208748723) },
+ { FRAC_CONST(0.028698534220122), FRAC_CONST(0.055521564581850) },
+ { FRAC_CONST(0.028015038267826), FRAC_CONST(0.055869559071575) },
+ { FRAC_CONST(0.027327323353815), FRAC_CONST(0.056209139811209) },
+ { FRAC_CONST(0.026635493045425), FRAC_CONST(0.056540255661140) },
+ { FRAC_CONST(0.025939651529755), FRAC_CONST(0.056862856756541) },
+ { FRAC_CONST(0.025239903597978), FRAC_CONST(0.057176894514872) },
+ { FRAC_CONST(0.024536354629559), FRAC_CONST(0.057482321643202) },
+ { FRAC_CONST(0.023829110576385), FRAC_CONST(0.057779092145329) },
+ { FRAC_CONST(0.023118277946808), FRAC_CONST(0.058067161328707) },
+ { FRAC_CONST(0.022403963789609), FRAC_CONST(0.058346485811177) },
+ { FRAC_CONST(0.021686275677870), FRAC_CONST(0.058617023527499) },
+ { FRAC_CONST(0.020965321692783), FRAC_CONST(0.058878733735689) },
+ { FRAC_CONST(0.020241210407366), FRAC_CONST(0.059131577023150) },
+ { FRAC_CONST(0.019514050870114), FRAC_CONST(0.059375515312615) },
+ { FRAC_CONST(0.018783952588580), FRAC_CONST(0.059610511867874) },
+ { FRAC_CONST(0.018051025512878), FRAC_CONST(0.059836531299311) },
+ { FRAC_CONST(0.017315380019131), FRAC_CONST(0.060053539569230) },
+ { FRAC_CONST(0.016577126892844), FRAC_CONST(0.060261503996984) },
+ { FRAC_CONST(0.015836377312223), FRAC_CONST(0.060460393263896) },
+ { FRAC_CONST(0.015093242831429), FRAC_CONST(0.060650177417972) },
+ { FRAC_CONST(0.014347835363782), FRAC_CONST(0.060830827878419) },
+ { FRAC_CONST(0.013600267164905), FRAC_CONST(0.061002317439940) },
+ { FRAC_CONST(0.012850650815819), FRAC_CONST(0.061164620276839) },
+ { FRAC_CONST(0.012099099205988), FRAC_CONST(0.061317711946905) },
+ { FRAC_CONST(0.011345725516320), FRAC_CONST(0.061461569395097) },
+ { FRAC_CONST(0.010590643202123), FRAC_CONST(0.061596170957011) },
+ { FRAC_CONST(0.009833965976015), FRAC_CONST(0.061721496362147) },
+ { FRAC_CONST(0.009075807790803), FRAC_CONST(0.061837526736961) },
+ { FRAC_CONST(0.008316282822321), FRAC_CONST(0.061944244607705) },
+ { FRAC_CONST(0.007555505452236), FRAC_CONST(0.062041633903059) },
+ { FRAC_CONST(0.006793590250821), FRAC_CONST(0.062129679956555) },
+ { FRAC_CONST(0.006030651959703), FRAC_CONST(0.062208369508780) },
+ { FRAC_CONST(0.005266805474583), FRAC_CONST(0.062277690709378) },
+ { FRAC_CONST(0.004502165827931), FRAC_CONST(0.062337633118830) },
+ { FRAC_CONST(0.003736848171665), FRAC_CONST(0.062388187710030) },
+ { FRAC_CONST(0.002970967759810), FRAC_CONST(0.062429346869643) },
+ { FRAC_CONST(0.002204639931138), FRAC_CONST(0.062461104399250) },
+ { FRAC_CONST(0.001437980091802), FRAC_CONST(0.062483455516285) },
+ { FRAC_CONST(0.000671103697954), FRAC_CONST(0.062496396854751) }
+};
- /* 16 (N/4) complex twiddle factors */
- ALIGN static const complex_t mdct_tab_64[] =
- {
- { FRAC_CONST(0.176763384336599), FRAC_CONST(0.002169321984356) },
- { FRAC_CONST(0.175699589589310), FRAC_CONST(0.019484717553714) },
- { FRAC_CONST(0.172943711747111), FRAC_CONST(0.036612464641599) },
- { FRAC_CONST(0.168522291420137), FRAC_CONST(0.053387613680577) },
- { FRAC_CONST(0.162477909303132), FRAC_CONST(0.069648610815172) },
- { FRAC_CONST(0.154868776100077), FRAC_CONST(0.085238853753814) },
- { FRAC_CONST(0.145768171923295), FRAC_CONST(0.100008199934509) },
- { FRAC_CONST(0.135263740565902), FRAC_CONST(0.113814412479792) },
- { FRAC_CONST(0.123456645444178), FRAC_CONST(0.126524530015608) },
- { FRAC_CONST(0.110460595338559), FRAC_CONST(0.138016147162030) },
- { FRAC_CONST(0.096400749315926), FRAC_CONST(0.148178593363981) },
- { FRAC_CONST(0.081412511379371), FRAC_CONST(0.156913998709178) },
- { FRAC_CONST(0.065640226453626), FRAC_CONST(0.164138236468888) },
- { FRAC_CONST(0.049235790264535), FRAC_CONST(0.169781733284316) },
- { FRAC_CONST(0.032357186500177), FRAC_CONST(0.173790139196080) },
- { FRAC_CONST(0.015166965341583), FRAC_CONST(0.176124851064031) }
- };
+/* 16 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_64[] =
+{
+ { FRAC_CONST(0.176763384336599), FRAC_CONST(0.002169321984356) },
+ { FRAC_CONST(0.175699589589310), FRAC_CONST(0.019484717553714) },
+ { FRAC_CONST(0.172943711747111), FRAC_CONST(0.036612464641599) },
+ { FRAC_CONST(0.168522291420137), FRAC_CONST(0.053387613680577) },
+ { FRAC_CONST(0.162477909303132), FRAC_CONST(0.069648610815172) },
+ { FRAC_CONST(0.154868776100077), FRAC_CONST(0.085238853753814) },
+ { FRAC_CONST(0.145768171923295), FRAC_CONST(0.100008199934509) },
+ { FRAC_CONST(0.135263740565902), FRAC_CONST(0.113814412479792) },
+ { FRAC_CONST(0.123456645444178), FRAC_CONST(0.126524530015608) },
+ { FRAC_CONST(0.110460595338559), FRAC_CONST(0.138016147162030) },
+ { FRAC_CONST(0.096400749315926), FRAC_CONST(0.148178593363981) },
+ { FRAC_CONST(0.081412511379371), FRAC_CONST(0.156913998709178) },
+ { FRAC_CONST(0.065640226453626), FRAC_CONST(0.164138236468888) },
+ { FRAC_CONST(0.049235790264535), FRAC_CONST(0.169781733284316) },
+ { FRAC_CONST(0.032357186500177), FRAC_CONST(0.173790139196080) },
+ { FRAC_CONST(0.015166965341583), FRAC_CONST(0.176124851064031) }
+};
#endif // SSR_DEC
#endif // FIXED_POINT
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.c
index 4547f43ff..c8c8fa8ba 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -39,8 +39,7 @@
#include "syntax.h"
/* defines if an object type can be decoded by this library or not */
-static uint8_t ObjectTypesTable[32] =
-{
+static uint8_t ObjectTypesTable[32] = {
0, /* 0 NULL */
#ifdef MAIN_DEC
1, /* 1 AAC Main */
@@ -117,15 +116,15 @@ static uint8_t ObjectTypesTable[32] =
/* Table 1.6.1 */
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
- unsigned long buffer_size,
- mp4AudioSpecificConfig *mp4ASC)
+ unsigned long buffer_size,
+ mp4AudioSpecificConfig *mp4ASC)
{
return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL, 0);
}
int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
- mp4AudioSpecificConfig *mp4ASC,
- program_config *pce, uint32_t buffer_size, uint8_t short_form)
+ mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce, uint32_t buffer_size, uint8_t short_form)
{
int8_t result = 0;
uint32_t startpos = faad_get_processed_bits(ld);
@@ -133,42 +132,42 @@ int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
int8_t bits_to_decode = 0;
#endif
- if(mp4ASC == NULL)
+ if (mp4ASC == NULL)
return -8;
memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig));
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 1, "parse_audio_decoder_specific_info(): ObjectTypeIndex"));
+ DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 2, "parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
- if(mp4ASC->samplingFrequencyIndex == 0x0f)
- faad_getbits(ld, 24);
+ DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
+ if(mp4ASC->samplingFrequencyIndex==0x0f)
+ faad_getbits(ld, 24);
mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 3, "parse_audio_decoder_specific_info(): ChannelsConfiguration"));
+ DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration"));
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
- if(ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
+ if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
{
return -1;
}
- if(mp4ASC->samplingFrequency == 0)
+ if (mp4ASC->samplingFrequency == 0)
{
return -2;
}
- if(mp4ASC->channelsConfiguration > 7)
+ if (mp4ASC->channelsConfiguration > 7)
{
return -3;
}
#if (defined(PS_DEC) || defined(DRM_PS))
/* check if we have a mono file */
- if(mp4ASC->channelsConfiguration == 1)
+ if (mp4ASC->channelsConfiguration == 1)
{
/* upMatrix to 2 channels for implicit signalling of PS */
mp4ASC->channelsConfiguration = 2;
@@ -177,59 +176,53 @@ int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
#ifdef SBR_DEC
mp4ASC->sbr_present_flag = -1;
- if(mp4ASC->objectTypeIndex == 5)
+ if (mp4ASC->objectTypeIndex == 5)
{
uint8_t tmp;
mp4ASC->sbr_present_flag = 1;
tmp = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 5, "parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
/* check for downsampled SBR */
- if(tmp == mp4ASC->samplingFrequencyIndex)
+ if (tmp == mp4ASC->samplingFrequencyIndex)
mp4ASC->downSampledSBR = 1;
mp4ASC->samplingFrequencyIndex = tmp;
- if(mp4ASC->samplingFrequencyIndex == 15)
+ if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24
- DEBUGVAR(1, 6, "parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
- }
- else
- {
+ DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ } else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 7, "parse_audio_decoder_specific_info(): ObjectTypeIndex"));
+ DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
}
#endif
/* get GASpecificConfig */
- if(mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
- mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
- mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
+ if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
+ mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
+ mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
{
result = GASpecificConfig(ld, mp4ASC, pce);
#ifdef ERROR_RESILIENCE
- }
- else if(mp4ASC->objectTypeIndex >= ER_OBJECT_START) /* ER */
- {
+ } else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */
result = GASpecificConfig(ld, mp4ASC, pce);
mp4ASC->epConfig = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 143, "parse_audio_decoder_specific_info(): epConfig"));
+ DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig"));
- if(mp4ASC->epConfig != 0)
+ if (mp4ASC->epConfig != 0)
result = -5;
#endif
- }
- else
- {
+ } else {
result = -4;
}
#ifdef SSR_DEC
/* shorter frames not allowed for SSR */
- if((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
+ if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
return -6;
#endif
@@ -238,45 +231,43 @@ int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
if(short_form)
bits_to_decode = 0;
else
- bits_to_decode = (int8_t)(buffer_size * 8 - (startpos - faad_get_processed_bits(ld)));
+ bits_to_decode = (int8_t)(buffer_size*8 - (startpos-faad_get_processed_bits(ld)));
- if((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
+ if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
{
int16_t syncExtensionType = (int16_t)faad_getbits(ld, 11
- DEBUGVAR(1, 9, "parse_audio_decoder_specific_info(): syncExtensionType"));
+ DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
- if(syncExtensionType == 0x2b7)
+ if (syncExtensionType == 0x2b7)
{
uint8_t tmp_OTi = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 10, "parse_audio_decoder_specific_info(): extensionAudioObjectType"));
+ DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
- if(tmp_OTi == 5)
+ if (tmp_OTi == 5)
{
mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 11, "parse_audio_decoder_specific_info(): sbr_present_flag"));
+ DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
- if(mp4ASC->sbr_present_flag)
+ if (mp4ASC->sbr_present_flag)
{
uint8_t tmp;
- /* Don't set OT to SBR until checked that it is actually there */
- mp4ASC->objectTypeIndex = tmp_OTi;
+ /* Don't set OT to SBR until checked that it is actually there */
+ mp4ASC->objectTypeIndex = tmp_OTi;
tmp = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 12, "parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
/* check for downsampled SBR */
- if(tmp == mp4ASC->samplingFrequencyIndex)
+ if (tmp == mp4ASC->samplingFrequencyIndex)
mp4ASC->downSampledSBR = 1;
mp4ASC->samplingFrequencyIndex = tmp;
- if(mp4ASC->samplingFrequencyIndex == 15)
+ if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24
- DEBUGVAR(1, 13, "parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
- }
- else
- {
+ DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ } else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
}
@@ -286,15 +277,13 @@ int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
/* no SBR signalled, this could mean either implicit signalling or no SBR in this file */
/* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */
- if(mp4ASC->sbr_present_flag == -1)
+ if (mp4ASC->sbr_present_flag == -1)
{
- if(mp4ASC->samplingFrequency <= 24000)
+ if (mp4ASC->samplingFrequency <= 24000)
{
mp4ASC->samplingFrequency *= 2;
mp4ASC->forceUpSampling = 1;
- }
- else /* > 24000*/
- {
+ } else /* > 24000*/ {
mp4ASC->downSampledSBR = 1;
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.h
index 28c3db2b0..5a94be480 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/mp4.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,14 +37,14 @@ extern "C" {
#include "neaacdec.h"
- int8_t AudioSpecificConfig2(uint8_t *pBuffer,
- uint32_t buffer_size,
- mp4AudioSpecificConfig *mp4ASC,
- program_config *pce, uint8_t short_form);
-
- int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
- mp4AudioSpecificConfig *mp4ASC,
- program_config *pce, uint32_t bsize, uint8_t short_form);
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+ uint32_t buffer_size,
+ mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce, uint8_t short_form);
+
+int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
+ mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce, uint32_t bsize, uint8_t short_form);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.c
index 33a00a884..97c8fb198 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -41,29 +41,29 @@ void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
{
uint8_t g, b, sfb;
uint8_t group = 0;
- uint16_t nshort = frame_len / 8;
+ uint16_t nshort = frame_len/8;
uint16_t i, k;
real_t tmp;
- if(ics->ms_mask_present >= 1)
+ if (ics->ms_mask_present >= 1)
{
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
- for(b = 0; b < ics->window_group_length[g]; b++)
+ for (b = 0; b < ics->window_group_length[g]; b++)
{
- for(sfb = 0; sfb < ics->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* If intensity stereo coding or noise substitution is on
for a particular scalefactor band, no M/S stereo decoding
is carried out.
*/
- if((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
- !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
+ if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
+ !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
{
- for(i = ics->swb_offset[sfb]; i < min(ics->swb_offset[sfb+1], ics->swb_offset_max); i++)
+ for (i = ics->swb_offset[sfb]; i < min(ics->swb_offset[sfb+1], ics->swb_offset_max); i++)
{
- k = (group * nshort) + i;
+ k = (group*nshort) + i;
tmp = l_spec[k] - r_spec[k];
l_spec[k] = l_spec[k] + r_spec[k];
r_spec[k] = tmp;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.h
index d37eff414..30cfadaf6 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ms.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,8 +35,8 @@
extern "C" {
#endif
- void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
- uint16_t frame_len);
+void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+ uint16_t frame_len);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/output.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/output.c
index d87d01806..424562705 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/output.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/output.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -45,20 +45,18 @@
static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
uint8_t down_matrix, uint8_t *internal_channel)
{
- if(!down_matrix)
+ if (!down_matrix)
return input[internal_channel[channel]][sample];
- if(channel == 0)
+ if (channel == 0)
{
return DM_MUL * (input[internal_channel[1]][sample] +
- input[internal_channel[0]][sample] * RSQRT2 +
- input[internal_channel[3]][sample] * RSQRT2);
- }
- else
- {
+ input[internal_channel[0]][sample] * RSQRT2 +
+ input[internal_channel[3]][sample] * RSQRT2);
+ } else {
return DM_MUL * (input[internal_channel[2]][sample] +
- input[internal_channel[0]][sample] * RSQRT2 +
- input[internal_channel[4]][sample] * RSQRT2);
+ input[internal_channel[0]][sample] * RSQRT2 +
+ input[internal_channel[4]][sample] * RSQRT2);
}
}
@@ -95,10 +93,10 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
uint8_t ch, ch1;
uint16_t i;
- switch(CONV(channels, hDecoder->downMatrix))
+ switch (CONV(channels,hDecoder->downMatrix))
{
- case CONV(1, 0):
- case CONV(1, 1):
+ case CONV(1,0):
+ case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
@@ -108,8 +106,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
(*sample_buffer)[i] = (int16_t)lrintf(inp);
}
break;
- case CONV(2, 0):
- if(hDecoder->upMatrix)
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
@@ -121,9 +119,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
(*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
}
- }
- else
- {
+ } else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
@@ -140,7 +136,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
}
break;
default:
- for(ch = 0; ch < channels; ch++)
+ for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
@@ -162,10 +158,10 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
uint8_t ch, ch1;
uint16_t i;
- switch(CONV(channels, hDecoder->downMatrix))
+ switch (CONV(channels,hDecoder->downMatrix))
{
- case CONV(1, 0):
- case CONV(1, 1):
+ case CONV(1,0):
+ case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
@@ -176,8 +172,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
(*sample_buffer)[i] = (int32_t)lrintf(inp);
}
break;
- case CONV(2, 0):
- if(hDecoder->upMatrix)
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
@@ -190,9 +186,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
}
- }
- else
- {
+ } else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
@@ -211,7 +205,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
}
break;
default:
- for(ch = 0; ch < channels; ch++)
+ for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
@@ -234,10 +228,10 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
uint8_t ch, ch1;
uint16_t i;
- switch(CONV(channels, hDecoder->downMatrix))
+ switch (CONV(channels,hDecoder->downMatrix))
{
- case CONV(1, 0):
- case CONV(1, 1):
+ case CONV(1,0):
+ case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
@@ -248,8 +242,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
(*sample_buffer)[i] = (int32_t)lrintf(inp);
}
break;
- case CONV(2, 0):
- if(hDecoder->upMatrix)
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
@@ -262,9 +256,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
}
- }
- else
- {
+ } else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
@@ -283,7 +275,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
}
break;
default:
- for(ch = 0; ch < channels; ch++)
+ for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
@@ -306,47 +298,45 @@ static void to_PCM_float(NeAACDecStruct *hDecoder, real_t **input,
uint8_t ch, ch1;
uint16_t i;
- switch(CONV(channels, hDecoder->downMatrix))
+ switch (CONV(channels,hDecoder->downMatrix))
{
- case CONV(1, 0):
- case CONV(1, 1):
+ case CONV(1,0):
+ case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
- (*sample_buffer)[i] = inp * FLOAT_SCALE;
+ (*sample_buffer)[i] = inp*FLOAT_SCALE;
}
break;
- case CONV(2, 0):
- if(hDecoder->upMatrix)
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
- (*sample_buffer)[(i*2)+0] = inp0 * FLOAT_SCALE;
- (*sample_buffer)[(i*2)+1] = inp0 * FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
}
- }
- else
- {
+ } else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
- (*sample_buffer)[(i*2)+0] = inp0 * FLOAT_SCALE;
- (*sample_buffer)[(i*2)+1] = inp1 * FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
}
}
break;
default:
- for(ch = 0; ch < channels; ch++)
+ for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
- (*sample_buffer)[(i*channels)+ch] = inp * FLOAT_SCALE;
+ (*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE;
}
}
break;
@@ -360,47 +350,45 @@ static void to_PCM_double(NeAACDecStruct *hDecoder, real_t **input,
uint8_t ch, ch1;
uint16_t i;
- switch(CONV(channels, hDecoder->downMatrix))
+ switch (CONV(channels,hDecoder->downMatrix))
{
- case CONV(1, 0):
- case CONV(1, 1):
+ case CONV(1,0):
+ case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
- (*sample_buffer)[i] = (double)inp * FLOAT_SCALE;
+ (*sample_buffer)[i] = (double)inp*FLOAT_SCALE;
}
break;
- case CONV(2, 0):
- if(hDecoder->upMatrix)
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
- (*sample_buffer)[(i*2)+0] = (double)inp0 * FLOAT_SCALE;
- (*sample_buffer)[(i*2)+1] = (double)inp0 * FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
}
- }
- else
- {
+ } else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
- (*sample_buffer)[(i*2)+0] = (double)inp0 * FLOAT_SCALE;
- (*sample_buffer)[(i*2)+1] = (double)inp1 * FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
}
}
break;
default:
- for(ch = 0; ch < channels; ch++)
+ for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
- (*sample_buffer)[(i*channels)+ch] = (double)inp * FLOAT_SCALE;
+ (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
}
}
break;
@@ -421,7 +409,7 @@ void *output_to_PCM(NeAACDecStruct *hDecoder,
#endif
/* Copy output to a standard PCM buffer */
- switch(format)
+ switch (format)
{
case FAAD_FMT_16BIT:
to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer);
@@ -457,21 +445,19 @@ static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample
uint8_t down_matrix, uint8_t up_matrix,
uint8_t *internal_channel)
{
- if(up_matrix == 1)
+ if (up_matrix == 1)
return input[internal_channel[0]][sample];
- if(!down_matrix)
+ if (!down_matrix)
return input[internal_channel[channel]][sample];
- if(channel == 0)
+ if (channel == 0)
{
real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2);
real_t cum = input[internal_channel[1]][sample] + C + L_S;
return MUL_F(cum, DM_MUL);
- }
- else
- {
+ } else {
real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2);
real_t cum = input[internal_channel[2]][sample] + C + R_S;
@@ -489,27 +475,25 @@ void* output_to_PCM(NeAACDecStruct *hDecoder,
int32_t *int_sample_buffer = (int32_t*)sample_buffer;
/* Copy output to a standard PCM buffer */
- for(ch = 0; ch < channels; ch++)
+ for (ch = 0; ch < channels; ch++)
{
- switch(format)
+ switch (format)
{
case FAAD_FMT_16BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
- hDecoder->internal_channel);
- if(tmp >= 0)
+ hDecoder->internal_channel);
+ if (tmp >= 0)
{
- tmp += (1 << (REAL_BITS - 1));
- if(tmp >= REAL_CONST(32767))
+ tmp += (1 << (REAL_BITS-1));
+ if (tmp >= REAL_CONST(32767))
{
tmp = REAL_CONST(32767);
}
- }
- else
- {
- tmp += -(1 << (REAL_BITS - 1));
- if(tmp <= REAL_CONST(-32768))
+ } else {
+ tmp += -(1 << (REAL_BITS-1));
+ if (tmp <= REAL_CONST(-32768))
{
tmp = REAL_CONST(-32768);
}
@@ -522,21 +506,19 @@ void* output_to_PCM(NeAACDecStruct *hDecoder,
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
- hDecoder->internal_channel);
- if(tmp >= 0)
+ hDecoder->internal_channel);
+ if (tmp >= 0)
{
- tmp += (1 << (REAL_BITS - 9));
- tmp >>= (REAL_BITS - 8);
- if(tmp >= 8388607)
+ tmp += (1 << (REAL_BITS-9));
+ tmp >>= (REAL_BITS-8);
+ if (tmp >= 8388607)
{
tmp = 8388607;
}
- }
- else
- {
- tmp += -(1 << (REAL_BITS - 9));
- tmp >>= (REAL_BITS - 8);
- if(tmp <= -8388608)
+ } else {
+ tmp += -(1 << (REAL_BITS-9));
+ tmp >>= (REAL_BITS-8);
+ if (tmp <= -8388608)
{
tmp = -8388608;
}
@@ -548,16 +530,14 @@ void* output_to_PCM(NeAACDecStruct *hDecoder,
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
- hDecoder->internal_channel);
- if(tmp >= 0)
- {
- tmp += (1 << (16 - REAL_BITS - 1));
- tmp <<= (16 - REAL_BITS);
- }
- else
+ hDecoder->internal_channel);
+ if (tmp >= 0)
{
- tmp += -(1 << (16 - REAL_BITS - 1));
- tmp <<= (16 - REAL_BITS);
+ tmp += (1 << (16-REAL_BITS-1));
+ tmp <<= (16-REAL_BITS);
+ } else {
+ tmp += -(1 << (16-REAL_BITS-1));
+ tmp <<= (16-REAL_BITS);
}
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
@@ -566,7 +546,7 @@ void* output_to_PCM(NeAACDecStruct *hDecoder,
for(i = 0; i < frame_len; i++)
{
real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
- hDecoder->internal_channel);
+ hDecoder->internal_channel);
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/output.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/output.h
index b4e2a63f6..9ab5c9e83 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/output.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/output.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,12 +35,12 @@
extern "C" {
#endif
- void* output_to_PCM(NeAACDecStruct *hDecoder,
- real_t **input,
- void *samplebuffer,
- uint8_t channels,
- uint16_t frame_len,
- uint8_t format);
+void* output_to_PCM(NeAACDecStruct *hDecoder,
+ real_t **input,
+ void *samplebuffer,
+ uint8_t channels,
+ uint16_t frame_len,
+ uint8_t format);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.c
index 6cbf44270..248fd05ef 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -59,27 +59,15 @@ real_t fp_sqrt(real_t value)
{
real_t root = 0;
- step(0);
- step(2);
- step(4);
- step(6);
- step(8);
- step(10);
- step(12);
- step(14);
- step(16);
- step(18);
- step(20);
- step(22);
- step(24);
- step(26);
- step(28);
- step(30);
-
- if(root < value)
+ step( 0); step( 2); step( 4); step( 6);
+ step( 8); step(10); step(12); step(14);
+ step(16); step(18); step(20); step(22);
+ step(24); step(26); step(28); step(30);
+
+ if (root < value)
++root;
- root <<= (REAL_BITS / 2);
+ root <<= (REAL_BITS/2);
return root;
}
@@ -106,18 +94,18 @@ static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t
uint16_t i;
real_t energy = 0.0;
- real_t scale = (real_t)1.0 / (real_t)size;
+ real_t scale = (real_t)1.0/(real_t)size;
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
{
- real_t tmp = scale * (real_t)(int32_t)ne_rng(__r1, __r2);
+ real_t tmp = scale*(real_t)(int32_t)ne_rng(__r1, __r2);
spec[i] = tmp;
- energy += tmp * tmp;
+ energy += tmp*tmp;
}
- scale = (real_t)1.0 / (real_t)sqrt(energy);
+ scale = (real_t)1.0/(real_t)sqrt(energy);
scale *= (real_t)pow(2.0, 0.25 * scale_factor);
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
{
spec[i] *= scale;
}
@@ -126,24 +114,24 @@ static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t
real_t energy = 0, scale;
int32_t exp, frac;
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
{
/* this can be replaced by a 16 bit random generator!!!! */
real_t tmp = (int32_t)ne_rng(__r1, __r2);
- if(tmp < 0)
- tmp = -(tmp & ((1 << (REAL_BITS - 1)) - 1));
+ if (tmp < 0)
+ tmp = -(tmp & ((1<<(REAL_BITS-1))-1));
else
- tmp = (tmp & ((1 << (REAL_BITS - 1)) - 1));
+ tmp = (tmp & ((1<<(REAL_BITS-1))-1));
- energy += MUL_R(tmp, tmp);
+ energy += MUL_R(tmp,tmp);
spec[i] = tmp;
}
energy = fp_sqrt(energy);
- if(energy > 0)
+ if (energy > 0)
{
- scale = DIV(REAL_CONST(1), energy);
+ scale = DIV(REAL_CONST(1),energy);
exp = scale_factor >> 2;
frac = scale_factor & 3;
@@ -151,15 +139,15 @@ static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t
/* IMDCT pre-scaling */
exp -= sub;
- if(exp < 0)
+ if (exp < 0)
scale >>= -exp;
else
scale <<= exp;
- if(frac)
+ if (frac)
scale = MUL_C(scale, pow2_table[frac]);
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
{
spec[i] = MUL_R(spec[i], scale);
}
@@ -182,27 +170,25 @@ void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
#ifdef FIXED_POINT
/* IMDCT scaling */
- if(object_type == LD)
+ if (object_type == LD)
{
sub = 9 /*9*/;
- }
- else
- {
- if(ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
+ } else {
+ if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
sub = 7 /*7*/;
else
sub = 10 /*10*/;
}
#endif
- for(g = 0; g < ics_left->num_window_groups; g++)
+ for (g = 0; g < ics_left->num_window_groups; g++)
{
/* Do perceptual noise substitution decoding */
- for(b = 0; b < ics_left->window_group_length[g]; b++)
+ for (b = 0; b < ics_left->window_group_length[g]; b++)
{
- for(sfb = 0; sfb < ics_left->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics_left->max_sfb; sfb++)
{
- if(is_noise(ics_left, g, sfb))
+ if (is_noise(ics_left, g, sfb))
{
#ifdef LTP_DEC
/* Simultaneous use of LTP and PNS is not prevented in the
@@ -226,43 +212,41 @@ void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
/* Generate random vector */
gen_rand_vector(&spec_left[(group*nshort)+offs],
- ics_left->scale_factors[g][sfb], size, sub, __r1, __r2);
+ ics_left->scale_factors[g][sfb], size, sub, __r1, __r2);
}
- /* From the spec:
- If the same scalefactor band and group is coded by perceptual noise
- substitution in both channels of a channel pair, the correlation of
- the noise signal can be controlled by means of the ms_used field: While
- the default noise generation process works independently for each channel
- (separate generation of random vectors), the same random vector is used
- for both channels if ms_used[] is set for a particular scalefactor band
- and group. In this case, no M/S stereo coding is carried out (because M/S
- stereo coding and noise substitution coding are mutually exclusive).
- If the same scalefactor band and group is coded by perceptual noise
- substitution in only one channel of a channel pair the setting of ms_used[]
- is not evaluated.
- */
- if(channel_pair)
+/* From the spec:
+ If the same scalefactor band and group is coded by perceptual noise
+ substitution in both channels of a channel pair, the correlation of
+ the noise signal can be controlled by means of the ms_used field: While
+ the default noise generation process works independently for each channel
+ (separate generation of random vectors), the same random vector is used
+ for both channels if ms_used[] is set for a particular scalefactor band
+ and group. In this case, no M/S stereo coding is carried out (because M/S
+ stereo coding and noise substitution coding are mutually exclusive).
+ If the same scalefactor band and group is coded by perceptual noise
+ substitution in only one channel of a channel pair the setting of ms_used[]
+ is not evaluated.
+*/
+ if (channel_pair)
{
- if(is_noise(ics_right, g, sfb))
+ if (is_noise(ics_right, g, sfb))
{
- if(((ics_left->ms_mask_present == 1) &&
+ if (((ics_left->ms_mask_present == 1) &&
(ics_left->ms_used[g][sfb])) ||
- (ics_left->ms_mask_present == 2))
+ (ics_left->ms_mask_present == 2))
{
uint16_t c;
offs = ics_right->swb_offset[sfb];
size = min(ics_right->swb_offset[sfb+1], ics_right->swb_offset_max) - offs;
- for(c = 0; c < size; c++)
+ for (c = 0; c < size; c++)
{
spec_right[(group*nshort) + offs + c] =
spec_left[(group*nshort) + offs + c];
}
- }
- else /*if (ics_left->ms_mask_present == 0)*/
- {
+ } else /*if (ics_left->ms_mask_present == 0)*/ {
#ifdef LTP_DEC
ics_right->ltp.long_used[sfb] = 0;
ics_right->ltp2.long_used[sfb] = 0;
@@ -276,7 +260,7 @@ void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
/* Generate random vector */
gen_rand_vector(&spec_right[(group*nshort)+offs],
- ics_right->scale_factors[g][sfb], size, sub, __r1, __r2);
+ ics_right->scale_factors[g][sfb], size, sub, __r1, __r2);
}
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.h
index 690b80185..38ced252d 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/pns.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -39,17 +39,17 @@ extern "C" {
#define NOISE_OFFSET 90
- void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
- real_t *spec_left, real_t *spec_right, uint16_t frame_len,
- uint8_t channel_pair, uint8_t object_type,
- /* RNG states */ uint32_t *__r1, uint32_t *__r2);
+void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
+ real_t *spec_left, real_t *spec_right, uint16_t frame_len,
+ uint8_t channel_pair, uint8_t object_type,
+ /* RNG states */ uint32_t *__r1, uint32_t *__r2);
- static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
- {
- if(ics->sfb_cb[group][sfb] == NOISE_HCB)
- return 1;
- return 0;
- }
+static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+ if (ics->sfb_cb[group][sfb] == NOISE_HCB)
+ return 1;
+ return 0;
+}
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.c
index 8f633ada6..e7b87f8f2 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -101,19 +101,16 @@ static const real_t p4_13_34[7] =
};
#ifdef PARAM_32KHZ
-static const uint8_t delay_length_d[2][NO_ALLPASS_LINKS] =
-{
+static const uint8_t delay_length_d[2][NO_ALLPASS_LINKS] = {
{ 1, 2, 3 } /* d_24kHz */,
{ 3, 4, 5 } /* d_48kHz */
};
#else
-static const uint8_t delay_length_d[NO_ALLPASS_LINKS] =
-{
+static const uint8_t delay_length_d[NO_ALLPASS_LINKS] = {
3, 4, 5 /* d_48kHz */
};
#endif
-static const real_t filter_a[NO_ALLPASS_LINKS] = /* a(m) = exp(-d_48kHz(m)/7) */
-{
+static const real_t filter_a[NO_ALLPASS_LINKS] = { /* a(m) = exp(-d_48kHz(m)/7) */
FRAC_CONST(0.65143905753106),
FRAC_CONST(0.56471812200776),
FRAC_CONST(0.48954165955695)
@@ -129,12 +126,12 @@ static const uint8_t group_border20[10+12 + 1] =
static const uint8_t group_border34[32+18 + 1] =
{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 12 subqmf subbands */
- 12, 13, 14, 15, 16, 17, 18, 19, /* 8 subqmf subbands */
- 20, 21, 22, 23, /* 4 subqmf subbands */
- 24, 25, 26, 27, /* 4 subqmf subbands */
- 28, 29, 30, 31, /* 4 subqmf subbands */
- 32 - 27, 33 - 27, 34 - 27, 35 - 27, 36 - 27, 37 - 27, 38 - 27, 40 - 27, 42 - 27, 44 - 27, 46 - 27, 48 - 27, 51 - 27, 54 - 27, 57 - 27, 60 - 27, 64 - 27, 68 - 27, 91 - 27
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 12 subqmf subbands */
+ 12, 13, 14, 15, 16, 17, 18, 19, /* 8 subqmf subbands */
+ 20, 21, 22, 23, /* 4 subqmf subbands */
+ 24, 25, 26, 27, /* 4 subqmf subbands */
+ 28, 29, 30, 31, /* 4 subqmf subbands */
+ 32-27, 33-27, 34-27, 35-27, 36-27, 37-27, 38-27, 40-27, 42-27, 44-27, 46-27, 48-27, 51-27, 54-27, 57-27, 60-27, 64-27, 68-27, 91-27
};
static const uint16_t map_group2bk20[10+12] =
@@ -215,18 +212,18 @@ static hyb_info *hybrid_init(uint8_t numTimeSlotsRate)
hyb->frame_len = numTimeSlotsRate;
- hyb->work = (qmf_t*)faad_malloc((hyb->frame_len + 12) * sizeof(qmf_t));
- memset(hyb->work, 0, (hyb->frame_len + 12) * sizeof(qmf_t));
+ hyb->work = (qmf_t*)faad_malloc((hyb->frame_len+12) * sizeof(qmf_t));
+ memset(hyb->work, 0, (hyb->frame_len+12) * sizeof(qmf_t));
hyb->buffer = (qmf_t**)faad_malloc(5 * sizeof(qmf_t*));
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
{
hyb->buffer[i] = (qmf_t*)faad_malloc(hyb->frame_len * sizeof(qmf_t));
memset(hyb->buffer[i], 0, hyb->frame_len * sizeof(qmf_t));
}
hyb->temp = (qmf_t**)faad_malloc(hyb->frame_len * sizeof(qmf_t*));
- for(i = 0; i < hyb->frame_len; i++)
+ for (i = 0; i < hyb->frame_len; i++)
{
hyb->temp[i] = (qmf_t*)faad_malloc(12 /*max*/ * sizeof(qmf_t));
}
@@ -238,28 +235,28 @@ static void hybrid_free(hyb_info *hyb)
{
uint8_t i;
- if(!hyb) return;
+ if (!hyb) return;
- if(hyb->work)
+ if (hyb->work)
faad_free(hyb->work);
- for(i = 0; i < 5; i++)
+ for (i = 0; i < 5; i++)
{
- if(hyb->buffer[i])
+ if (hyb->buffer[i])
faad_free(hyb->buffer[i]);
}
- if(hyb->buffer)
+ if (hyb->buffer)
faad_free(hyb->buffer);
- for(i = 0; i < hyb->frame_len; i++)
+ for (i = 0; i < hyb->frame_len; i++)
{
- if(hyb->temp[i])
+ if (hyb->temp[i])
faad_free(hyb->temp[i]);
}
- if(hyb->temp)
+ if (hyb->temp)
faad_free(hyb->temp);
- faad_free(hyb);
+ faad_free(hyb);
}
/* real filter, size 2 */
@@ -268,22 +265,22 @@ static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filt
{
uint8_t i;
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
- real_t r0 = MUL_F(filter[0], (QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i])));
- real_t r1 = MUL_F(filter[1], (QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i])));
- real_t r2 = MUL_F(filter[2], (QMF_RE(buffer[2+i]) + QMF_RE(buffer[10+i])));
- real_t r3 = MUL_F(filter[3], (QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i])));
- real_t r4 = MUL_F(filter[4], (QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i])));
- real_t r5 = MUL_F(filter[5], (QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i])));
- real_t r6 = MUL_F(filter[6], QMF_RE(buffer[6+i]));
- real_t i0 = MUL_F(filter[0], (QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i])));
- real_t i1 = MUL_F(filter[1], (QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i])));
- real_t i2 = MUL_F(filter[2], (QMF_IM(buffer[2+i]) + QMF_IM(buffer[10+i])));
- real_t i3 = MUL_F(filter[3], (QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i])));
- real_t i4 = MUL_F(filter[4], (QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i])));
- real_t i5 = MUL_F(filter[5], (QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i])));
- real_t i6 = MUL_F(filter[6], QMF_IM(buffer[6+i]));
+ real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i])));
+ real_t r1 = MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i])));
+ real_t r2 = MUL_F(filter[2],(QMF_RE(buffer[2+i]) + QMF_RE(buffer[10+i])));
+ real_t r3 = MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i])));
+ real_t r4 = MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i])));
+ real_t r5 = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i])));
+ real_t r6 = MUL_F(filter[6],QMF_RE(buffer[6+i]));
+ real_t i0 = MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i])));
+ real_t i1 = MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i])));
+ real_t i2 = MUL_F(filter[2],(QMF_IM(buffer[2+i]) + QMF_IM(buffer[10+i])));
+ real_t i3 = MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i])));
+ real_t i4 = MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i])));
+ real_t i5 = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i])));
+ real_t i6 = MUL_F(filter[6],QMF_IM(buffer[6+i]));
/* q = 0 */
QMF_RE(X_hybrid[i][0]) = r0 + r1 + r2 + r3 + r4 + r5 + r6;
@@ -302,35 +299,35 @@ static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filt
uint8_t i;
real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2];
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) +
- MUL_F(filter[6], QMF_RE(buffer[i+6]));
+ MUL_F(filter[6], QMF_RE(buffer[i+6]));
input_re1[1] = MUL_F(FRAC_CONST(-0.70710678118655),
- (MUL_F(filter[1], (QMF_RE(buffer[i+1]) + QMF_RE(buffer[i+11]))) +
- MUL_F(filter[3], (QMF_RE(buffer[i+3]) + QMF_RE(buffer[i+9]))) -
- MUL_F(filter[5], (QMF_RE(buffer[i+5]) + QMF_RE(buffer[i+7])))));
+ (MUL_F(filter[1], (QMF_RE(buffer[i+1]) + QMF_RE(buffer[i+11]))) +
+ MUL_F(filter[3], (QMF_RE(buffer[i+3]) + QMF_RE(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_RE(buffer[i+5]) + QMF_RE(buffer[i+7])))));
input_im1[0] = MUL_F(filter[0], (QMF_IM(buffer[i+0]) - QMF_IM(buffer[i+12]))) -
- MUL_F(filter[4], (QMF_IM(buffer[i+4]) - QMF_IM(buffer[i+8])));
+ MUL_F(filter[4], (QMF_IM(buffer[i+4]) - QMF_IM(buffer[i+8])));
input_im1[1] = MUL_F(FRAC_CONST(0.70710678118655),
- (MUL_F(filter[1], (QMF_IM(buffer[i+1]) - QMF_IM(buffer[i+11]))) -
- MUL_F(filter[3], (QMF_IM(buffer[i+3]) - QMF_IM(buffer[i+9]))) -
- MUL_F(filter[5], (QMF_IM(buffer[i+5]) - QMF_IM(buffer[i+7])))));
+ (MUL_F(filter[1], (QMF_IM(buffer[i+1]) - QMF_IM(buffer[i+11]))) -
+ MUL_F(filter[3], (QMF_IM(buffer[i+3]) - QMF_IM(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_IM(buffer[i+5]) - QMF_IM(buffer[i+7])))));
input_re2[0] = MUL_F(filter[0], (QMF_RE(buffer[i+0]) - QMF_RE(buffer[i+12]))) -
- MUL_F(filter[4], (QMF_RE(buffer[i+4]) - QMF_RE(buffer[i+8])));
+ MUL_F(filter[4], (QMF_RE(buffer[i+4]) - QMF_RE(buffer[i+8])));
input_re2[1] = MUL_F(FRAC_CONST(0.70710678118655),
- (MUL_F(filter[1], (QMF_RE(buffer[i+1]) - QMF_RE(buffer[i+11]))) -
- MUL_F(filter[3], (QMF_RE(buffer[i+3]) - QMF_RE(buffer[i+9]))) -
- MUL_F(filter[5], (QMF_RE(buffer[i+5]) - QMF_RE(buffer[i+7])))));
+ (MUL_F(filter[1], (QMF_RE(buffer[i+1]) - QMF_RE(buffer[i+11]))) -
+ MUL_F(filter[3], (QMF_RE(buffer[i+3]) - QMF_RE(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_RE(buffer[i+5]) - QMF_RE(buffer[i+7])))));
input_im2[0] = -MUL_F(filter[2], (QMF_IM(buffer[i+2]) + QMF_IM(buffer[i+10]))) +
- MUL_F(filter[6], QMF_IM(buffer[i+6]));
+ MUL_F(filter[6], QMF_IM(buffer[i+6]));
input_im2[1] = MUL_F(FRAC_CONST(-0.70710678118655),
- (MUL_F(filter[1], (QMF_IM(buffer[i+1]) + QMF_IM(buffer[i+11]))) +
- MUL_F(filter[3], (QMF_IM(buffer[i+3]) + QMF_IM(buffer[i+9]))) -
- MUL_F(filter[5], (QMF_IM(buffer[i+5]) + QMF_IM(buffer[i+7])))));
+ (MUL_F(filter[1], (QMF_IM(buffer[i+1]) + QMF_IM(buffer[i+11]))) +
+ MUL_F(filter[3], (QMF_IM(buffer[i+3]) + QMF_IM(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_IM(buffer[i+5]) + QMF_IM(buffer[i+7])))));
/* q == 0 */
QMF_RE(X_hybrid[i][0]) = input_re1[0] + input_re1[1] + input_im1[0] + input_im1[1];
@@ -377,19 +374,19 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt
real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4];
real_t x[4];
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
- input_re1[0] = MUL_F(filter[6], QMF_RE(buffer[6+i]));
- input_re1[1] = MUL_F(filter[5], (QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i])));
- input_re1[2] = -MUL_F(filter[0], (QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))) + MUL_F(filter[4], (QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i])));
- input_re1[3] = -MUL_F(filter[1], (QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))) + MUL_F(filter[3], (QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i])));
+ input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i]));
+ input_re1[1] = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i])));
+ input_re1[2] = -MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))) + MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i])));
+ input_re1[3] = -MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))) + MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i])));
- input_im1[0] = MUL_F(filter[5], (QMF_IM(buffer[7+i]) - QMF_IM(buffer[5+i])));
- input_im1[1] = MUL_F(filter[0], (QMF_IM(buffer[12+i]) - QMF_IM(buffer[0+i]))) + MUL_F(filter[4], (QMF_IM(buffer[8+i]) - QMF_IM(buffer[4+i])));
- input_im1[2] = MUL_F(filter[1], (QMF_IM(buffer[11+i]) - QMF_IM(buffer[1+i]))) + MUL_F(filter[3], (QMF_IM(buffer[9+i]) - QMF_IM(buffer[3+i])));
- input_im1[3] = MUL_F(filter[2], (QMF_IM(buffer[10+i]) - QMF_IM(buffer[2+i])));
+ input_im1[0] = MUL_F(filter[5],(QMF_IM(buffer[7+i]) - QMF_IM(buffer[5+i])));
+ input_im1[1] = MUL_F(filter[0],(QMF_IM(buffer[12+i]) - QMF_IM(buffer[0+i]))) + MUL_F(filter[4],(QMF_IM(buffer[8+i]) - QMF_IM(buffer[4+i])));
+ input_im1[2] = MUL_F(filter[1],(QMF_IM(buffer[11+i]) - QMF_IM(buffer[1+i]))) + MUL_F(filter[3],(QMF_IM(buffer[9+i]) - QMF_IM(buffer[3+i])));
+ input_im1[3] = MUL_F(filter[2],(QMF_IM(buffer[10+i]) - QMF_IM(buffer[2+i])));
- for(n = 0; n < 4; n++)
+ for (n = 0; n < 4; n++)
{
x[n] = input_re1[n] - input_im1[3-n];
}
@@ -399,7 +396,7 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt
QMF_RE(X_hybrid[i][3]) = x[3];
QMF_RE(X_hybrid[i][1]) = x[1];
- for(n = 0; n < 4; n++)
+ for (n = 0; n < 4; n++)
{
x[n] = input_re1[n] + input_im1[3-n];
}
@@ -409,17 +406,17 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt
QMF_RE(X_hybrid[i][2]) = x[2];
QMF_RE(X_hybrid[i][0]) = x[0];
- input_im2[0] = MUL_F(filter[6], QMF_IM(buffer[6+i]));
- input_im2[1] = MUL_F(filter[5], (QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i])));
- input_im2[2] = -MUL_F(filter[0], (QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))) + MUL_F(filter[4], (QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i])));
- input_im2[3] = -MUL_F(filter[1], (QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))) + MUL_F(filter[3], (QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i])));
+ input_im2[0] = MUL_F(filter[6],QMF_IM(buffer[6+i]));
+ input_im2[1] = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i])));
+ input_im2[2] = -MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))) + MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i])));
+ input_im2[3] = -MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))) + MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i])));
- input_re2[0] = MUL_F(filter[5], (QMF_RE(buffer[7+i]) - QMF_RE(buffer[5+i])));
- input_re2[1] = MUL_F(filter[0], (QMF_RE(buffer[12+i]) - QMF_RE(buffer[0+i]))) + MUL_F(filter[4], (QMF_RE(buffer[8+i]) - QMF_RE(buffer[4+i])));
- input_re2[2] = MUL_F(filter[1], (QMF_RE(buffer[11+i]) - QMF_RE(buffer[1+i]))) + MUL_F(filter[3], (QMF_RE(buffer[9+i]) - QMF_RE(buffer[3+i])));
- input_re2[3] = MUL_F(filter[2], (QMF_RE(buffer[10+i]) - QMF_RE(buffer[2+i])));
+ input_re2[0] = MUL_F(filter[5],(QMF_RE(buffer[7+i]) - QMF_RE(buffer[5+i])));
+ input_re2[1] = MUL_F(filter[0],(QMF_RE(buffer[12+i]) - QMF_RE(buffer[0+i]))) + MUL_F(filter[4],(QMF_RE(buffer[8+i]) - QMF_RE(buffer[4+i])));
+ input_re2[2] = MUL_F(filter[1],(QMF_RE(buffer[11+i]) - QMF_RE(buffer[1+i]))) + MUL_F(filter[3],(QMF_RE(buffer[9+i]) - QMF_RE(buffer[3+i])));
+ input_re2[3] = MUL_F(filter[2],(QMF_RE(buffer[10+i]) - QMF_RE(buffer[2+i])));
- for(n = 0; n < 4; n++)
+ for (n = 0; n < 4; n++)
{
x[n] = input_im2[n] + input_re2[3-n];
}
@@ -429,7 +426,7 @@ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filt
QMF_IM(X_hybrid[i][3]) = x[3];
QMF_IM(X_hybrid[i][1]) = x[1];
- for(n = 0; n < 4; n++)
+ for (n = 0; n < 4; n++)
{
x[n] = input_im2[n] - input_re2[3-n];
}
@@ -469,17 +466,15 @@ static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *fil
real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6];
real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6];
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
- for(n = 0; n < 6; n++)
+ for (n = 0; n < 6; n++)
{
- if(n == 0)
+ if (n == 0)
{
input_re1[0] = MUL_F(QMF_RE(buffer[6+i]), filter[6]);
input_re2[0] = MUL_F(QMF_IM(buffer[6+i]), filter[6]);
- }
- else
- {
+ } else {
input_re1[6-n] = MUL_F((QMF_RE(buffer[n+i]) + QMF_RE(buffer[12-n+i])), filter[n]);
input_re2[6-n] = MUL_F((QMF_IM(buffer[n+i]) + QMF_IM(buffer[12-n+i])), filter[n]);
}
@@ -493,7 +488,7 @@ static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *fil
DCT3_6_unscaled(out_im1, input_im1);
DCT3_6_unscaled(out_im2, input_im2);
- for(n = 0; n < 6; n += 2)
+ for (n = 0; n < 6; n += 2)
{
QMF_RE(X_hybrid[i][n]) = out_re1[n] - out_im1[n];
QMF_IM(X_hybrid[i][n]) = out_re2[n] + out_im2[n];
@@ -519,13 +514,13 @@ static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][3
uint8_t qmf_bands = (use34) ? 5 : 3;
uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20;
- for(band = 0; band < qmf_bands; band++)
+ for (band = 0; band < qmf_bands; band++)
{
/* build working buffer */
memcpy(hyb->work, hyb->buffer[band], 12 * sizeof(qmf_t));
/* add new samples */
- for(n = 0; n < hyb->frame_len; n++)
+ for (n = 0; n < hyb->frame_len; n++)
{
QMF_RE(hyb->work[12 + n]) = QMF_RE(X[n + 6 /*delay*/][band]);
QMF_IM(hyb->work[12 + n]) = QMF_IM(X[n + 6 /*delay*/][band]);
@@ -548,7 +543,7 @@ static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][3
case 8:
/* Type A complex filter, Q[p] = 8 */
channel_filter8(hyb, hyb->frame_len, (use34) ? p8_13_34 : p8_13_20,
- hyb->work, hyb->temp);
+ hyb->work, hyb->temp);
break;
case 12:
/* Type A complex filter, Q[p] = 12 */
@@ -556,9 +551,9 @@ static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][3
break;
}
- for(n = 0; n < hyb->frame_len; n++)
+ for (n = 0; n < hyb->frame_len; n++)
{
- for(k = 0; k < resolution[band]; k++)
+ for (k = 0; k < resolution[band]; k++)
{
QMF_RE(X_hybrid[n][offset + k]) = QMF_RE(hyb->temp[n][k]);
QMF_IM(X_hybrid[n][offset + k]) = QMF_IM(hyb->temp[n][k]);
@@ -568,9 +563,9 @@ static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][3
}
/* group hybrid channels */
- if(!use34)
+ if (!use34)
{
- for(n = 0; n < numTimeSlotsRate; n++)
+ for (n = 0; n < numTimeSlotsRate; n++)
{
QMF_RE(X_hybrid[n][3]) += QMF_RE(X_hybrid[n][4]);
QMF_IM(X_hybrid[n][3]) += QMF_IM(X_hybrid[n][4]);
@@ -595,12 +590,12 @@ static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][
for(band = 0; band < qmf_bands; band++)
{
- for(n = 0; n < hyb->frame_len; n++)
+ for (n = 0; n < hyb->frame_len; n++)
{
QMF_RE(X[n][band]) = 0;
QMF_IM(X[n][band]) = 0;
- for(k = 0; k < resolution[band]; k++)
+ for (k = 0; k < resolution[band]; k++)
{
QMF_RE(X[n][band]) += QMF_RE(X_hybrid[n][offset + k]);
QMF_IM(X[n][band]) += QMF_IM(X_hybrid[n][offset + k]);
@@ -613,9 +608,9 @@ static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][
/* limits the value i to the range [min,max] */
static int8_t delta_clip(int8_t i, int8_t min, int8_t max)
{
- if(i < min)
+ if (i < min)
return min;
- else if(i > max)
+ else if (i > max)
return max;
else
return i;
@@ -630,24 +625,22 @@ static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev,
{
int8_t i;
- if(enable == 1)
+ if (enable == 1)
{
- if(dt_flag == 0)
+ if (dt_flag == 0)
{
/* delta coded in frequency direction */
index[0] = 0 + index[0];
index[0] = delta_clip(index[0], min_index, max_index);
- for(i = 1; i < nr_par; i++)
+ for (i = 1; i < nr_par; i++)
{
index[i] = index[i-1] + index[i];
index[i] = delta_clip(index[i], min_index, max_index);
}
- }
- else
- {
+ } else {
/* delta coded in time direction */
- for(i = 0; i < nr_par; i++)
+ for (i = 0; i < nr_par; i++)
{
//int8_t tmp2;
//int8_t tmp = index[i];
@@ -668,20 +661,18 @@ static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev,
//}
}
}
- }
- else
- {
+ } else {
/* set indices to zero */
- for(i = 0; i < nr_par; i++)
+ for (i = 0; i < nr_par; i++)
{
index[i] = 0;
}
}
/* coarse */
- if(stride == 2)
+ if (stride == 2)
{
- for(i = (nr_par << 1) - 1; i > 0; i--)
+ for (i = (nr_par<<1)-1; i > 0; i--)
{
index[i] = index[i>>1];
}
@@ -696,44 +687,40 @@ static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_pre
{
int8_t i;
- if(enable == 1)
+ if (enable == 1)
{
- if(dt_flag == 0)
+ if (dt_flag == 0)
{
/* delta coded in frequency direction */
index[0] = 0 + index[0];
index[0] &= and_modulo;
- for(i = 1; i < nr_par; i++)
+ for (i = 1; i < nr_par; i++)
{
index[i] = index[i-1] + index[i];
index[i] &= and_modulo;
}
- }
- else
- {
+ } else {
/* delta coded in time direction */
- for(i = 0; i < nr_par; i++)
+ for (i = 0; i < nr_par; i++)
{
index[i] = index_prev[i*stride] + index[i];
index[i] &= and_modulo;
}
}
- }
- else
- {
+ } else {
/* set indices to zero */
- for(i = 0; i < nr_par; i++)
+ for (i = 0; i < nr_par; i++)
{
index[i] = 0;
}
}
/* coarse */
- if(stride == 2)
+ if (stride == 2)
{
index[0] = 0;
- for(i = (nr_par << 1) - 1; i > 0; i--)
+ for (i = (nr_par<<1)-1; i > 0; i--)
{
index[i] = index[i>>1];
}
@@ -743,29 +730,29 @@ static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_pre
#ifdef PS_LOW_POWER
static void map34indexto20(int8_t *index, uint8_t bins)
{
- index[0] = (2 * index[0] + index[1]) / 3;
- index[1] = (index[1] + 2 * index[2]) / 3;
- index[2] = (2 * index[3] + index[4]) / 3;
- index[3] = (index[4] + 2 * index[5]) / 3;
- index[4] = (index[6] + index[7]) / 2;
- index[5] = (index[8] + index[9]) / 2;
+ index[0] = (2*index[0]+index[1])/3;
+ index[1] = (index[1]+2*index[2])/3;
+ index[2] = (2*index[3]+index[4])/3;
+ index[3] = (index[4]+2*index[5])/3;
+ index[4] = (index[6]+index[7])/2;
+ index[5] = (index[8]+index[9])/2;
index[6] = index[10];
index[7] = index[11];
- index[8] = (index[12] + index[13]) / 2;
- index[9] = (index[14] + index[15]) / 2;
+ index[8] = (index[12]+index[13])/2;
+ index[9] = (index[14]+index[15])/2;
index[10] = index[16];
- if(bins == 34)
+ if (bins == 34)
{
index[11] = index[17];
index[12] = index[18];
index[13] = index[19];
- index[14] = (index[20] + index[21]) / 2;
- index[15] = (index[22] + index[23]) / 2;
- index[16] = (index[24] + index[25]) / 2;
- index[17] = (index[26] + index[27]) / 2;
- index[18] = (index[28] + index[29] + index[30] + index[31]) / 4;
- index[19] = (index[32] + index[33]) / 2;
+ index[14] = (index[20]+index[21])/2;
+ index[15] = (index[22]+index[23])/2;
+ index[16] = (index[24]+index[25])/2;
+ index[17] = (index[26]+index[27])/2;
+ index[18] = (index[28]+index[29]+index[30]+index[31])/4;
+ index[19] = (index[32]+index[33])/2;
}
}
#endif
@@ -773,10 +760,10 @@ static void map34indexto20(int8_t *index, uint8_t bins)
static void map20indexto34(int8_t *index, uint8_t bins)
{
index[0] = index[0];
- index[1] = (index[0] + index[1]) / 2;
+ index[1] = (index[0] + index[1])/2;
index[2] = index[1];
index[3] = index[2];
- index[4] = (index[2] + index[3]) / 2;
+ index[4] = (index[2] + index[3])/2;
index[5] = index[3];
index[6] = index[4];
index[7] = index[4];
@@ -790,7 +777,7 @@ static void map20indexto34(int8_t *index, uint8_t bins)
index[15] = index[9];
index[16] = index[10];
- if(bins == 34)
+ if (bins == 34)
{
index[17] = index[11];
index[18] = index[12];
@@ -818,12 +805,12 @@ static void ps_data_decode(ps_info *ps)
uint8_t env, bin;
/* ps data not available, use data from previous frame */
- if(ps->ps_data_available == 0)
+ if (ps->ps_data_available == 0)
{
ps->num_env = 0;
}
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
int8_t *iid_index_prev;
int8_t *icc_index_prev;
@@ -832,16 +819,14 @@ static void ps_data_decode(ps_info *ps)
int8_t num_iid_steps = (ps->iid_mode < 3) ? 7 : 15 /*fine quant*/;
- if(env == 0)
+ if (env == 0)
{
/* take last envelope from previous frame */
iid_index_prev = ps->iid_index_prev;
icc_index_prev = ps->icc_index_prev;
ipd_index_prev = ps->ipd_index_prev;
opd_index_prev = ps->opd_index_prev;
- }
- else
- {
+ } else {
/* take index values from previous envelope */
iid_index_prev = ps->iid_index[env - 1];
icc_index_prev = ps->icc_index[env - 1];
@@ -852,65 +837,59 @@ static void ps_data_decode(ps_info *ps)
// iid = 1;
/* delta decode iid parameters */
delta_decode(ps->enable_iid, ps->iid_index[env], iid_index_prev,
- ps->iid_dt[env], ps->nr_iid_par,
- (ps->iid_mode == 0 || ps->iid_mode == 3) ? 2 : 1,
- -num_iid_steps, num_iid_steps);
+ ps->iid_dt[env], ps->nr_iid_par,
+ (ps->iid_mode == 0 || ps->iid_mode == 3) ? 2 : 1,
+ -num_iid_steps, num_iid_steps);
// iid = 0;
/* delta decode icc parameters */
delta_decode(ps->enable_icc, ps->icc_index[env], icc_index_prev,
- ps->icc_dt[env], ps->nr_icc_par,
- (ps->icc_mode == 0 || ps->icc_mode == 3) ? 2 : 1,
- 0, 7);
+ ps->icc_dt[env], ps->nr_icc_par,
+ (ps->icc_mode == 0 || ps->icc_mode == 3) ? 2 : 1,
+ 0, 7);
/* delta modulo decode ipd parameters */
delta_modulo_decode(ps->enable_ipdopd, ps->ipd_index[env], ipd_index_prev,
- ps->ipd_dt[env], ps->nr_ipdopd_par, 1, 7);
+ ps->ipd_dt[env], ps->nr_ipdopd_par, 1, 7);
/* delta modulo decode opd parameters */
delta_modulo_decode(ps->enable_ipdopd, ps->opd_index[env], opd_index_prev,
- ps->opd_dt[env], ps->nr_ipdopd_par, 1, 7);
+ ps->opd_dt[env], ps->nr_ipdopd_par, 1, 7);
}
/* handle error case */
- if(ps->num_env == 0)
+ if (ps->num_env == 0)
{
/* force to 1 */
ps->num_env = 1;
- if(ps->enable_iid)
+ if (ps->enable_iid)
{
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
ps->iid_index[0][bin] = ps->iid_index_prev[bin];
- }
- else
- {
- for(bin = 0; bin < 34; bin++)
+ } else {
+ for (bin = 0; bin < 34; bin++)
ps->iid_index[0][bin] = 0;
}
- if(ps->enable_icc)
+ if (ps->enable_icc)
{
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
ps->icc_index[0][bin] = ps->icc_index_prev[bin];
- }
- else
- {
- for(bin = 0; bin < 34; bin++)
+ } else {
+ for (bin = 0; bin < 34; bin++)
ps->icc_index[0][bin] = 0;
}
- if(ps->enable_ipdopd)
+ if (ps->enable_ipdopd)
{
- for(bin = 0; bin < 17; bin++)
+ for (bin = 0; bin < 17; bin++)
{
ps->ipd_index[0][bin] = ps->ipd_index_prev[bin];
ps->opd_index[0][bin] = ps->opd_index_prev[bin];
}
- }
- else
- {
- for(bin = 0; bin < 17; bin++)
+ } else {
+ for (bin = 0; bin < 17; bin++)
{
ps->ipd_index[0][bin] = 0;
ps->opd_index[0][bin] = 0;
@@ -919,11 +898,11 @@ static void ps_data_decode(ps_info *ps)
}
/* update previous indices */
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
ps->iid_index_prev[bin] = ps->iid_index[ps->num_env-1][bin];
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
ps->icc_index_prev[bin] = ps->icc_index[ps->num_env-1][bin];
- for(bin = 0; bin < 17; bin++)
+ for (bin = 0; bin < 17; bin++)
{
ps->ipd_index_prev[bin] = ps->ipd_index[ps->num_env-1][bin];
ps->opd_index_prev[bin] = ps->opd_index[ps->num_env-1][bin];
@@ -931,27 +910,25 @@ static void ps_data_decode(ps_info *ps)
ps->ps_data_available = 0;
- if(ps->frame_class == 0)
+ if (ps->frame_class == 0)
{
ps->border_position[0] = 0;
- for(env = 1; env < ps->num_env; env++)
+ for (env = 1; env < ps->num_env; env++)
{
ps->border_position[env] = (env * ps->numTimeSlotsRate) / ps->num_env;
}
ps->border_position[ps->num_env] = ps->numTimeSlotsRate;
- }
- else
- {
+ } else {
ps->border_position[0] = 0;
- if(ps->border_position[ps->num_env] < ps->numTimeSlotsRate)
+ if (ps->border_position[ps->num_env] < ps->numTimeSlotsRate)
{
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
{
ps->iid_index[ps->num_env][bin] = ps->iid_index[ps->num_env-1][bin];
ps->icc_index[ps->num_env][bin] = ps->icc_index[ps->num_env-1][bin];
}
- for(bin = 0; bin < 17; bin++)
+ for (bin = 0; bin < 17; bin++)
{
ps->ipd_index[ps->num_env][bin] = ps->ipd_index[ps->num_env-1][bin];
ps->opd_index[ps->num_env][bin] = ps->opd_index[ps->num_env-1][bin];
@@ -960,18 +937,16 @@ static void ps_data_decode(ps_info *ps)
ps->border_position[ps->num_env] = ps->numTimeSlotsRate;
}
- for(env = 1; env < ps->num_env; env++)
+ for (env = 1; env < ps->num_env; env++)
{
int8_t thr = ps->numTimeSlotsRate - (ps->num_env - env);
- if(ps->border_position[env] > thr)
+ if (ps->border_position[env] > thr)
{
ps->border_position[env] = thr;
- }
- else
- {
- thr = ps->border_position[env-1] + 1;
- if(ps->border_position[env] < thr)
+ } else {
+ thr = ps->border_position[env-1]+1;
+ if (ps->border_position[env] < thr)
{
ps->border_position[env] = thr;
}
@@ -983,30 +958,30 @@ static void ps_data_decode(ps_info *ps)
* to the same hybrid synthesis filterbank
*/
#ifdef PS_LOW_POWER
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
- if(ps->iid_mode == 2 || ps->iid_mode == 5)
+ if (ps->iid_mode == 2 || ps->iid_mode == 5)
map34indexto20(ps->iid_index[env], 34);
- if(ps->icc_mode == 2 || ps->icc_mode == 5)
+ if (ps->icc_mode == 2 || ps->icc_mode == 5)
map34indexto20(ps->icc_index[env], 34);
/* disable ipd/opd */
- for(bin = 0; bin < 17; bin++)
+ for (bin = 0; bin < 17; bin++)
{
ps->aaIpdIndex[env][bin] = 0;
ps->aaOpdIndex[env][bin] = 0;
}
}
#else
- if(ps->use34hybrid_bands)
+ if (ps->use34hybrid_bands)
{
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
- if(ps->iid_mode != 2 && ps->iid_mode != 5)
+ if (ps->iid_mode != 2 && ps->iid_mode != 5)
map20indexto34(ps->iid_index[env], 34);
- if(ps->icc_mode != 2 && ps->icc_mode != 5)
+ if (ps->icc_mode != 2 && ps->icc_mode != 5)
map20indexto34(ps->icc_index[env], 34);
- if(ps->ipd_mode != 2 && ps->ipd_mode != 5)
+ if (ps->ipd_mode != 2 && ps->ipd_mode != 5)
{
map20indexto34(ps->ipd_index[env], 17);
map20indexto34(ps->opd_index[env], 17);
@@ -1016,37 +991,37 @@ static void ps_data_decode(ps_info *ps)
#endif
#if 0
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
printf("iid[env:%d]:", env);
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
{
printf(" %d", ps->iid_index[env][bin]);
}
printf("\n");
}
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
printf("icc[env:%d]:", env);
- for(bin = 0; bin < 34; bin++)
+ for (bin = 0; bin < 34; bin++)
{
printf(" %d", ps->icc_index[env][bin]);
}
printf("\n");
}
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
printf("ipd[env:%d]:", env);
- for(bin = 0; bin < 17; bin++)
+ for (bin = 0; bin < 17; bin++)
{
printf(" %d", ps->ipd_index[env][bin]);
}
printf("\n");
}
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
printf("opd[env:%d]:", env);
- for(bin = 0; bin < 17; bin++)
+ for (bin = 0; bin < 17; bin++)
{
printf(" %d", ps->opd_index[env][bin]);
}
@@ -1072,49 +1047,45 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
/* chose hybrid filterbank: 20 or 34 band case */
- if(ps->use34hybrid_bands)
+ if (ps->use34hybrid_bands)
{
Phi_Fract_SubQmf = Phi_Fract_SubQmf34;
- }
- else
- {
+ } else{
Phi_Fract_SubQmf = Phi_Fract_SubQmf20;
}
/* clear the energy values */
- for(n = 0; n < 32; n++)
+ for (n = 0; n < 32; n++)
{
- for(bk = 0; bk < 34; bk++)
+ for (bk = 0; bk < 34; bk++)
{
P[n][bk] = 0;
}
}
/* calculate the energy in each parameter band b(k) */
- for(gr = 0; gr < ps->num_groups; gr++)
+ for (gr = 0; gr < ps->num_groups; gr++)
{
/* select the parameter index b(k) to which this group belongs */
bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr];
/* select the upper subband border for this group */
- maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr] + 1 : ps->group_border[gr+1];
+ maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr]+1 : ps->group_border[gr+1];
- for(sb = ps->group_border[gr]; sb < maxsb; sb++)
+ for (sb = ps->group_border[gr]; sb < maxsb; sb++)
{
- for(n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
+ for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
{
#ifdef FIXED_POINT
uint32_t in_re, in_im;
#endif
/* input from hybrid subbands or QMF subbands */
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]);
IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]);
- }
- else
- {
+ } else {
RE(inputLeft) = QMF_RE(X_left[n][sb]);
IM(inputLeft) = QMF_IM(X_left[n][sb]);
}
@@ -1124,39 +1095,39 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
/* NOTE: all input is scaled by 2^(-5) because of fixed point QMF
* meaning that P will be scaled by 2^(-10) compared to floating point version
*/
- in_re = ((abs(RE(inputLeft)) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
- in_im = ((abs(IM(inputLeft)) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
- P[n][bk] += in_re * in_re + in_im * in_im;
+ in_re = ((abs(RE(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ in_im = ((abs(IM(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ P[n][bk] += in_re*in_re + in_im*in_im;
#else
- P[n][bk] += MUL_R(RE(inputLeft), RE(inputLeft)) + MUL_R(IM(inputLeft), IM(inputLeft));
+ P[n][bk] += MUL_R(RE(inputLeft),RE(inputLeft)) + MUL_R(IM(inputLeft),IM(inputLeft));
#endif
}
}
}
#if 0
- for(n = 0; n < 32; n++)
+ for (n = 0; n < 32; n++)
{
- for(bk = 0; bk < 34; bk++)
+ for (bk = 0; bk < 34; bk++)
{
#ifdef FIXED_POINT
printf("%d %d: %d\n", n, bk, P[n][bk] /*/(float)REAL_PRECISION*/);
#else
- printf("%d %d: %f\n", n, bk, P[n][bk] / 1024.0);
+ printf("%d %d: %f\n", n, bk, P[n][bk]/1024.0);
#endif
}
}
#endif
/* calculate transient reduction ratio for each parameter band b(k) */
- for(bk = 0; bk < ps->nr_par_bands; bk++)
+ for (bk = 0; bk < ps->nr_par_bands; bk++)
{
- for(n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
+ for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
{
const real_t gamma = COEF_CONST(1.5);
ps->P_PeakDecayNrg[bk] = MUL_F(ps->P_PeakDecayNrg[bk], ps->alpha_decay);
- if(ps->P_PeakDecayNrg[bk] < P[n][bk])
+ if (ps->P_PeakDecayNrg[bk] < P[n][bk])
ps->P_PeakDecayNrg[bk] = P[n][bk];
/* apply smoothing filter to peak decay energy */
@@ -1170,24 +1141,22 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
ps->P_prev[bk] = nrg;
/* calculate transient ratio */
- if(MUL_C(P_SmoothPeakDecayDiffNrg, gamma) <= nrg)
+ if (MUL_C(P_SmoothPeakDecayDiffNrg, gamma) <= nrg)
{
G_TransientRatio[n][bk] = REAL_CONST(1.0);
- }
- else
- {
+ } else {
G_TransientRatio[n][bk] = DIV_R(nrg, (MUL_C(P_SmoothPeakDecayDiffNrg, gamma)));
}
}
}
#if 0
- for(n = 0; n < 32; n++)
+ for (n = 0; n < 32; n++)
{
- for(bk = 0; bk < 34; bk++)
+ for (bk = 0; bk < 34; bk++)
{
#ifdef FIXED_POINT
- printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk] / (float)REAL_PRECISION);
+ printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]/(float)REAL_PRECISION);
#else
printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]);
#endif
@@ -1196,40 +1165,36 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
#endif
/* apply stereo decorrelation filter to the signal */
- for(gr = 0; gr < ps->num_groups; gr++)
+ for (gr = 0; gr < ps->num_groups; gr++)
{
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
maxsb = ps->group_border[gr] + 1;
else
maxsb = ps->group_border[gr + 1];
/* QMF channel */
- for(sb = ps->group_border[gr]; sb < maxsb; sb++)
+ for (sb = ps->group_border[gr]; sb < maxsb; sb++)
{
real_t g_DecaySlope;
real_t g_DecaySlope_filt[NO_ALLPASS_LINKS];
/* g_DecaySlope: [0..1] */
- if(gr < ps->num_hybrid_groups || sb <= ps->decay_cutoff)
+ if (gr < ps->num_hybrid_groups || sb <= ps->decay_cutoff)
{
g_DecaySlope = FRAC_CONST(1.0);
- }
- else
- {
+ } else {
int8_t decay = ps->decay_cutoff - sb;
- if(decay <= -20 /* -1/DECAY_SLOPE */)
+ if (decay <= -20 /* -1/DECAY_SLOPE */)
{
g_DecaySlope = 0;
- }
- else
- {
+ } else {
/* decay(int)*decay_slope(frac) = g_DecaySlope(frac) */
g_DecaySlope = FRAC_CONST(1.0) + DECAY_SLOPE * decay;
}
}
/* calculate g_DecaySlope_filt for every m multiplied by filter_a[m] */
- for(m = 0; m < NO_ALLPASS_LINKS; m++)
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
{
g_DecaySlope_filt[m] = MUL_F(g_DecaySlope, filter_a[m]);
}
@@ -1237,27 +1202,25 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
/* set delay indices */
temp_delay = ps->saved_delay;
- for(n = 0; n < NO_ALLPASS_LINKS; n++)
+ for (n = 0; n < NO_ALLPASS_LINKS; n++)
temp_delay_ser[n] = ps->delay_buf_index_ser[n];
- for(n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
+ for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
{
complex_t tmp, tmp0, R0;
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
/* hybrid filterbank input */
RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]);
IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]);
- }
- else
- {
+ } else {
/* QMF filterbank input */
RE(inputLeft) = QMF_RE(X_left[n][sb]);
IM(inputLeft) = QMF_IM(X_left[n][sb]);
}
- if(sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups)
+ if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups)
{
/* delay */
@@ -1268,15 +1231,13 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
IM(R0) = IM(tmp);
RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = RE(inputLeft);
IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = IM(inputLeft);
- }
- else
- {
+ } else {
/* allpass filter */
uint8_t m;
complex_t Phi_Fract;
/* fetch parameters */
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
/* select data from the hybrid subbands */
RE(tmp0) = RE(ps->delay_SubQmf[temp_delay][sb]);
@@ -1287,9 +1248,7 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
RE(Phi_Fract) = RE(Phi_Fract_SubQmf[sb]);
IM(Phi_Fract) = IM(Phi_Fract_SubQmf[sb]);
- }
- else
- {
+ } else {
/* select data from the QMF subbands */
RE(tmp0) = RE(ps->delay_Qmf[temp_delay][sb]);
IM(tmp0) = IM(ps->delay_Qmf[temp_delay][sb]);
@@ -1306,30 +1265,26 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
RE(R0) = RE(tmp);
IM(R0) = IM(tmp);
- for(m = 0; m < NO_ALLPASS_LINKS; m++)
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
{
complex_t Q_Fract_allpass, tmp2;
/* fetch parameters */
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
/* select data from the hybrid subbands */
RE(tmp0) = RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]);
IM(tmp0) = IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]);
- if(ps->use34hybrid_bands)
+ if (ps->use34hybrid_bands)
{
RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf34[sb][m]);
IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf34[sb][m]);
- }
- else
- {
+ } else {
RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf20[sb][m]);
IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf20[sb][m]);
}
- }
- else
- {
+ } else {
/* select data from the QMF subbands */
RE(tmp0) = RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]);
IM(tmp0) = IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]);
@@ -1351,13 +1306,11 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
IM(tmp2) = IM(R0) + MUL_F(g_DecaySlope_filt[m], IM(tmp));
/* store sample */
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2);
IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2);
- }
- else
- {
+ } else {
RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2);
IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2);
}
@@ -1375,38 +1328,36 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
RE(R0) = MUL_R(G_TransientRatio[n][bk], RE(R0));
IM(R0) = MUL_R(G_TransientRatio[n][bk], IM(R0));
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
/* hybrid */
QMF_RE(X_hybrid_right[n][sb]) = RE(R0);
QMF_IM(X_hybrid_right[n][sb]) = IM(R0);
- }
- else
- {
+ } else {
/* QMF */
QMF_RE(X_right[n][sb]) = RE(R0);
QMF_IM(X_right[n][sb]) = IM(R0);
}
/* Update delay buffer index */
- if(++temp_delay >= 2)
+ if (++temp_delay >= 2)
{
temp_delay = 0;
}
/* update delay indices */
- if(sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups)
+ if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups)
{
/* delay_D depends on the samplerate, it can hold the values 14 and 1 */
- if(++ps->delay_buf_index_delay[sb] >= ps->delay_D[sb])
+ if (++ps->delay_buf_index_delay[sb] >= ps->delay_D[sb])
{
ps->delay_buf_index_delay[sb] = 0;
}
}
- for(m = 0; m < NO_ALLPASS_LINKS; m++)
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
{
- if(++temp_delay_ser[m] >= ps->num_sample_delay_ser[m])
+ if (++temp_delay_ser[m] >= ps->num_sample_delay_ser[m])
{
temp_delay_ser[m] = 0;
}
@@ -1417,7 +1368,7 @@ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][
/* update delay indices */
ps->saved_delay = temp_delay;
- for(m = 0; m < NO_ALLPASS_LINKS; m++)
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
ps->delay_buf_index_ser[m] = temp_delay_ser[m];
}
@@ -1436,27 +1387,15 @@ static real_t ps_sqrt(real_t value)
{
real_t root = 0;
- step(0);
- step(2);
- step(4);
- step(6);
- step(8);
- step(10);
- step(12);
- step(14);
- step(16);
- step(18);
- step(20);
- step(22);
- step(24);
- step(26);
- step(28);
- step(30);
-
- if(root < value)
+ step( 0); step( 2); step( 4); step( 6);
+ step( 8); step(10); step(12); step(14);
+ step(16); step(18); step(20); step(22);
+ step(24); step(26); step(28); step(30);
+
+ if (root < value)
++root;
- root <<= (REAL_BITS / 2);
+ root <<= (REAL_BITS/2);
return root;
}
@@ -1464,8 +1403,7 @@ static real_t ps_sqrt(real_t value)
#define ps_sqrt(A) sqrt(A)
#endif
-static const real_t ipdopd_cos_tab[] =
-{
+static const real_t ipdopd_cos_tab[] = {
FRAC_CONST(1.000000000000000),
FRAC_CONST(0.707106781186548),
FRAC_CONST(0.000000000000000),
@@ -1477,8 +1415,7 @@ static const real_t ipdopd_cos_tab[] =
FRAC_CONST(1.000000000000000)
};
-static const real_t ipdopd_sin_tab[] =
-{
+static const real_t ipdopd_sin_tab[] = {
FRAC_CONST(0.000000000000000),
FRAC_CONST(0.707106781186547),
FRAC_CONST(1.000000000000000),
@@ -1500,16 +1437,13 @@ static real_t magnitude_c(complex_t c)
real_t abs_inphase = ps_abs(RE(c));
real_t abs_quadrature = ps_abs(IM(c));
- if(abs_inphase > abs_quadrature)
- {
+ if (abs_inphase > abs_quadrature) {
return MUL_F(abs_inphase, ALPHA) + MUL_F(abs_quadrature, BETA);
- }
- else
- {
+ } else {
return MUL_F(abs_quadrature, ALPHA) + MUL_F(abs_inphase, BETA);
}
#else
- return sqrt(RE(c) * RE(c) + IM(c) * IM(c));
+ return sqrt(RE(c)*RE(c) + IM(c)*IM(c));
#endif
}
@@ -1533,36 +1467,32 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
const real_t *sf_iid;
uint8_t no_iid_steps;
- if(ps->iid_mode >= 3)
+ if (ps->iid_mode >= 3)
{
no_iid_steps = 15;
sf_iid = sf_iid_fine;
- }
- else
- {
+ } else {
no_iid_steps = 7;
sf_iid = sf_iid_normal;
}
- if(ps->ipd_mode == 0 || ps->ipd_mode == 3)
+ if (ps->ipd_mode == 0 || ps->ipd_mode == 3)
{
nr_ipdopd_par = 11; /* resolution */
- }
- else
- {
+ } else {
nr_ipdopd_par = ps->nr_ipdopd_par;
}
- for(gr = 0; gr < ps->num_groups; gr++)
+ for (gr = 0; gr < ps->num_groups; gr++)
{
bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr];
/* use one channel per group in the subqmf domain */
maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr] + 1 : ps->group_border[gr + 1];
- for(env = 0; env < ps->num_env; env++)
+ for (env = 0; env < ps->num_env; env++)
{
- if(ps->icc_mode < 3)
+ if (ps->icc_mode < 3)
{
/* type 'A' mixing as described in 8.6.4.6.2.1 */
real_t c_1, c_2;
@@ -1588,28 +1518,22 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
cosa = cos_alphas[ps->icc_index[env][bk]];
sina = sin_alphas[ps->icc_index[env][bk]];
- if(ps->iid_mode >= 3)
+ if (ps->iid_mode >= 3)
{
- if(ps->iid_index[env][bk] < 0)
+ if (ps->iid_index[env][bk] < 0)
{
cosb = cos_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
sinb = -sin_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
- }
- else
- {
+ } else {
cosb = cos_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
sinb = sin_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
}
- }
- else
- {
- if(ps->iid_index[env][bk] < 0)
+ } else {
+ if (ps->iid_index[env][bk] < 0)
{
cosb = cos_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
sinb = -sin_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
- }
- else
- {
+ } else {
cosb = cos_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
sinb = sin_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
}
@@ -1625,9 +1549,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
RE(h12) = MUL_C(c_1, (ab1 + ab2));
RE(h21) = MUL_C(c_2, (ab3 + ab4));
RE(h22) = MUL_C(c_1, (ab3 - ab4));
- }
- else
- {
+ } else {
/* type 'B' mixing as described in 8.6.4.6.2.2 */
real_t sina, cosa;
real_t cosg, sing;
@@ -1665,7 +1587,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
gamma = (real_t)atan(sqrt((1.0f-sqrt(mu))/(1.0f+sqrt(mu))));
*/
- if(ps->iid_mode >= 3)
+ if (ps->iid_mode >= 3)
{
uint8_t abs_iid = abs(ps->iid_index[env][bk]);
@@ -1673,9 +1595,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
sina = sincos_alphas_B_fine[30 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]];
cosg = cos_gammas_fine[abs_iid][ps->icc_index[env][bk]];
sing = sin_gammas_fine[abs_iid][ps->icc_index[env][bk]];
- }
- else
- {
+ } else {
uint8_t abs_iid = abs(ps->iid_index[env][bk]);
cosa = sincos_alphas_B_normal[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]];
@@ -1694,7 +1614,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
/* note that the imaginary part of these parameters are only calculated when
IPD and OPD are enabled
*/
- if((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
{
int8_t i;
real_t xy, pq, xypq;
@@ -1729,7 +1649,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
IM(tempRight) += IM(ps->opd_prev[bk][i]);
/* ringbuffer index */
- if(i == 0)
+ if (i == 0)
{
i = 2;
}
@@ -1773,29 +1693,25 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
xy = magnitude_c(tempRight);
pq = magnitude_c(tempLeft);
- if(xy != 0)
+ if (xy != 0)
{
RE(phaseLeft) = DIV_R(RE(tempRight), xy);
IM(phaseLeft) = DIV_R(IM(tempRight), xy);
- }
- else
- {
+ } else {
RE(phaseLeft) = 0;
IM(phaseLeft) = 0;
}
xypq = MUL_R(xy, pq);
- if(xypq != 0)
+ if (xypq != 0)
{
real_t tmp1 = MUL_R(RE(tempRight), RE(tempLeft)) + MUL_R(IM(tempRight), IM(tempLeft));
real_t tmp2 = MUL_R(IM(tempRight), RE(tempLeft)) - MUL_R(RE(tempRight), IM(tempLeft));
RE(phaseRight) = DIV_R(tmp1, xypq);
IM(phaseRight) = DIV_R(tmp2, xypq);
- }
- else
- {
+ } else {
RE(phaseRight) = 0;
IM(phaseRight) = 0;
}
@@ -1835,7 +1751,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
RE(ps->h22_prev[gr]) = RE(h22);
/* only calculate imaginary part when needed */
- if((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
{
/* obtain final H_xy by means of linear interpolation */
IM(deltaH11) = (IM(h11) - IM(ps->h11_prev[gr])) / L;
@@ -1848,7 +1764,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
IM(H21) = IM(ps->h21_prev[gr]);
IM(H22) = IM(ps->h22_prev[gr]);
- if((NEGATE_IPD_MASK & ps->map_group2bk[gr]) != 0)
+ if ((NEGATE_IPD_MASK & ps->map_group2bk[gr]) != 0)
{
IM(deltaH11) = -IM(deltaH11);
IM(deltaH12) = -IM(deltaH12);
@@ -1868,14 +1784,14 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
}
/* apply H_xy to the current envelope band of the decorrelated subband */
- for(n = ps->border_position[env]; n < ps->border_position[env + 1]; n++)
+ for (n = ps->border_position[env]; n < ps->border_position[env + 1]; n++)
{
/* addition finalises the interpolation over every n */
RE(H11) += RE(deltaH11);
RE(H12) += RE(deltaH12);
RE(H21) += RE(deltaH21);
RE(H22) += RE(deltaH22);
- if((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
{
IM(H11) += IM(deltaH11);
IM(H12) += IM(deltaH12);
@@ -1884,20 +1800,18 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
}
/* channel is an alias to the subband */
- for(sb = ps->group_border[gr]; sb < maxsb; sb++)
+ for (sb = ps->group_border[gr]; sb < maxsb; sb++)
{
complex_t inLeft, inRight;
/* load decorrelated samples */
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
RE(inLeft) = RE(X_hybrid_left[n][sb]);
IM(inLeft) = IM(X_hybrid_left[n][sb]);
RE(inRight) = RE(X_hybrid_right[n][sb]);
IM(inRight) = IM(X_hybrid_right[n][sb]);
- }
- else
- {
+ } else {
RE(inLeft) = RE(X_left[n][sb]);
IM(inLeft) = IM(X_left[n][sb]);
RE(inRight) = RE(X_right[n][sb]);
@@ -1911,7 +1825,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
IM(tempRight) = MUL_C(RE(H12), IM(inLeft)) + MUL_C(RE(H22), IM(inRight));
/* only perform imaginary operations when needed */
- if((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
{
/* apply rotation */
RE(tempLeft) -= MUL_C(IM(H11), IM(inLeft)) + MUL_C(IM(H21), IM(inRight));
@@ -1921,15 +1835,13 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
}
/* store final samples */
- if(gr < ps->num_hybrid_groups)
+ if (gr < ps->num_hybrid_groups)
{
RE(X_hybrid_left[n][sb]) = RE(tempLeft);
IM(X_hybrid_left[n][sb]) = IM(tempLeft);
RE(X_hybrid_right[n][sb]) = RE(tempRight);
IM(X_hybrid_right[n][sb]) = IM(tempRight);
- }
- else
- {
+ } else {
RE(X_left[n][sb]) = RE(tempLeft);
IM(X_left[n][sb]) = IM(tempLeft);
RE(X_right[n][sb]) = RE(tempRight);
@@ -1940,7 +1852,7 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64
/* shift phase smoother's circular buffer index */
ps->phase_hist++;
- if(ps->phase_hist == 2)
+ if (ps->phase_hist == 2)
{
ps->phase_hist = 0;
}
@@ -1972,21 +1884,19 @@ ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate)
/* delay stuff*/
ps->saved_delay = 0;
- for(i = 0; i < 64; i++)
+ for (i = 0; i < 64; i++)
{
ps->delay_buf_index_delay[i] = 0;
}
- for(i = 0; i < NO_ALLPASS_LINKS; i++)
+ for (i = 0; i < NO_ALLPASS_LINKS; i++)
{
ps->delay_buf_index_ser[i] = 0;
#ifdef PARAM_32KHZ
- if(sr_index <= 5) /* >= 32 kHz*/
+ if (sr_index <= 5) /* >= 32 kHz*/
{
ps->num_sample_delay_ser[i] = delay_length_d[1][i];
- }
- else
- {
+ } else {
ps->num_sample_delay_ser[i] = delay_length_d[0][i];
}
#else
@@ -1996,15 +1906,13 @@ ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate)
}
#ifdef PARAM_32KHZ
- if(sr_index <= 5) /* >= 32 kHz*/
+ if (sr_index <= 5) /* >= 32 kHz*/
{
short_delay_band = 35;
ps->nr_allpass_bands = 22;
ps->alpha_decay = FRAC_CONST(0.76592833836465);
ps->alpha_smooth = FRAC_CONST(0.25);
- }
- else
- {
+ } else {
short_delay_band = 64;
ps->nr_allpass_bands = 45;
ps->alpha_decay = FRAC_CONST(0.58664621951003);
@@ -2019,17 +1927,17 @@ ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate)
#endif
/* THESE ARE CONSTANT NOW IF PS IS INDEPENDANT OF SAMPLERATE */
- for(i = 0; i < short_delay_band; i++)
+ for (i = 0; i < short_delay_band; i++)
{
ps->delay_D[i] = 14;
}
- for(i = short_delay_band; i < 64; i++)
+ for (i = short_delay_band; i < 64; i++)
{
ps->delay_D[i] = 1;
}
/* mixing and phase */
- for(i = 0; i < 50; i++)
+ for (i = 0; i < 50; i++)
{
RE(ps->h11_prev[i]) = 1;
IM(ps->h12_prev[i]) = 1;
@@ -2039,7 +1947,7 @@ ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate)
ps->phase_hist = 0;
- for(i = 0; i < 20; i++)
+ for (i = 0; i < 20; i++)
{
RE(ps->ipd_prev[i][0]) = 0;
IM(ps->ipd_prev[i][0]) = 0;
@@ -2064,20 +1972,18 @@ uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
ps_data_decode(ps);
/* set up some parameters depending on filterbank type */
- if(ps->use34hybrid_bands)
+ if (ps->use34hybrid_bands)
{
ps->group_border = (uint8_t*)group_border34;
ps->map_group2bk = (uint16_t*)map_group2bk34;
- ps->num_groups = 32 + 18;
+ ps->num_groups = 32+18;
ps->num_hybrid_groups = 32;
ps->nr_par_bands = 34;
ps->decay_cutoff = 5;
- }
- else
- {
+ } else {
ps->group_border = (uint8_t*)group_border20;
ps->map_group2bk = (uint16_t*)map_group2bk20;
- ps->num_groups = 10 + 12;
+ ps->num_groups = 10+12;
ps->num_hybrid_groups = 10;
ps->nr_par_bands = 20;
ps->decay_cutoff = 3;
@@ -2087,7 +1993,7 @@ uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
* frequency resolution
*/
hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left,
- ps->use34hybrid_bands, ps->numTimeSlotsRate);
+ ps->use34hybrid_bands, ps->numTimeSlotsRate);
/* decorrelate mono signal */
ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
@@ -2097,10 +2003,10 @@ uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
/* hybrid synthesis, to rebuild the SBR QMF matrices */
hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left,
- ps->use34hybrid_bands, ps->numTimeSlotsRate);
+ ps->use34hybrid_bands, ps->numTimeSlotsRate);
hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right,
- ps->use34hybrid_bands, ps->numTimeSlotsRate);
+ ps->use34hybrid_bands, ps->numTimeSlotsRate);
return 0;
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.h
index 4e84b1bfd..090244693 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_dec.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -42,107 +42,107 @@ extern "C" {
#define MAX_PS_ENVELOPES 5
#define NO_ALLPASS_LINKS 3
- typedef struct
- {
- /* bitstream parameters */
- uint8_t enable_iid;
- uint8_t enable_icc;
- uint8_t enable_ext;
-
- uint8_t iid_mode;
- uint8_t icc_mode;
- uint8_t nr_iid_par;
- uint8_t nr_ipdopd_par;
- uint8_t nr_icc_par;
-
- uint8_t frame_class;
- uint8_t num_env;
-
- uint8_t border_position[MAX_PS_ENVELOPES+1];
-
- uint8_t iid_dt[MAX_PS_ENVELOPES];
- uint8_t icc_dt[MAX_PS_ENVELOPES];
-
- uint8_t enable_ipdopd;
- uint8_t ipd_mode;
- uint8_t ipd_dt[MAX_PS_ENVELOPES];
- uint8_t opd_dt[MAX_PS_ENVELOPES];
-
- /* indices */
- int8_t iid_index_prev[34];
- int8_t icc_index_prev[34];
- int8_t ipd_index_prev[17];
- int8_t opd_index_prev[17];
- int8_t iid_index[MAX_PS_ENVELOPES][34];
- int8_t icc_index[MAX_PS_ENVELOPES][34];
- int8_t ipd_index[MAX_PS_ENVELOPES][17];
- int8_t opd_index[MAX_PS_ENVELOPES][17];
-
- int8_t ipd_index_1[17];
- int8_t opd_index_1[17];
- int8_t ipd_index_2[17];
- int8_t opd_index_2[17];
-
- /* ps data was correctly read */
- uint8_t ps_data_available;
-
- /* a header has been read */
- uint8_t header_read;
-
- /* hybrid filterbank parameters */
- void *hyb;
- uint8_t use34hybrid_bands;
- uint8_t numTimeSlotsRate;
-
- /**/
- uint8_t num_groups;
- uint8_t num_hybrid_groups;
- uint8_t nr_par_bands;
- uint8_t nr_allpass_bands;
- uint8_t decay_cutoff;
-
- uint8_t *group_border;
- uint16_t *map_group2bk;
-
- /* filter delay handling */
- uint8_t saved_delay;
- uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS];
- uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS];
- uint8_t delay_D[64];
- uint8_t delay_buf_index_delay[64];
-
- complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */
- complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */
- complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */
- complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */
-
- /* transients */
- real_t alpha_decay;
- real_t alpha_smooth;
-
- real_t P_PeakDecayNrg[34];
- real_t P_prev[34];
- real_t P_SmoothPeakDecayDiffNrg_prev[34];
-
- /* mixing and phase */
- complex_t h11_prev[50];
- complex_t h12_prev[50];
- complex_t h21_prev[50];
- complex_t h22_prev[50];
- uint8_t phase_hist;
- complex_t ipd_prev[20][2];
- complex_t opd_prev[20][2];
-
- } ps_info;
-
- /* ps_syntax.c */
- uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
-
- /* ps_dec.c */
- ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate);
- void ps_free(ps_info *ps);
-
- uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]);
+typedef struct
+{
+ /* bitstream parameters */
+ uint8_t enable_iid;
+ uint8_t enable_icc;
+ uint8_t enable_ext;
+
+ uint8_t iid_mode;
+ uint8_t icc_mode;
+ uint8_t nr_iid_par;
+ uint8_t nr_ipdopd_par;
+ uint8_t nr_icc_par;
+
+ uint8_t frame_class;
+ uint8_t num_env;
+
+ uint8_t border_position[MAX_PS_ENVELOPES+1];
+
+ uint8_t iid_dt[MAX_PS_ENVELOPES];
+ uint8_t icc_dt[MAX_PS_ENVELOPES];
+
+ uint8_t enable_ipdopd;
+ uint8_t ipd_mode;
+ uint8_t ipd_dt[MAX_PS_ENVELOPES];
+ uint8_t opd_dt[MAX_PS_ENVELOPES];
+
+ /* indices */
+ int8_t iid_index_prev[34];
+ int8_t icc_index_prev[34];
+ int8_t ipd_index_prev[17];
+ int8_t opd_index_prev[17];
+ int8_t iid_index[MAX_PS_ENVELOPES][34];
+ int8_t icc_index[MAX_PS_ENVELOPES][34];
+ int8_t ipd_index[MAX_PS_ENVELOPES][17];
+ int8_t opd_index[MAX_PS_ENVELOPES][17];
+
+ int8_t ipd_index_1[17];
+ int8_t opd_index_1[17];
+ int8_t ipd_index_2[17];
+ int8_t opd_index_2[17];
+
+ /* ps data was correctly read */
+ uint8_t ps_data_available;
+
+ /* a header has been read */
+ uint8_t header_read;
+
+ /* hybrid filterbank parameters */
+ void *hyb;
+ uint8_t use34hybrid_bands;
+ uint8_t numTimeSlotsRate;
+
+ /**/
+ uint8_t num_groups;
+ uint8_t num_hybrid_groups;
+ uint8_t nr_par_bands;
+ uint8_t nr_allpass_bands;
+ uint8_t decay_cutoff;
+
+ uint8_t *group_border;
+ uint16_t *map_group2bk;
+
+ /* filter delay handling */
+ uint8_t saved_delay;
+ uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS];
+ uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS];
+ uint8_t delay_D[64];
+ uint8_t delay_buf_index_delay[64];
+
+ complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */
+ complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */
+ complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */
+ complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */
+
+ /* transients */
+ real_t alpha_decay;
+ real_t alpha_smooth;
+
+ real_t P_PeakDecayNrg[34];
+ real_t P_prev[34];
+ real_t P_SmoothPeakDecayDiffNrg_prev[34];
+
+ /* mixing and phase */
+ complex_t h11_prev[50];
+ complex_t h12_prev[50];
+ complex_t h21_prev[50];
+ complex_t h22_prev[50];
+ uint8_t phase_hist;
+ complex_t ipd_prev[20][2];
+ complex_t opd_prev[20][2];
+
+} ps_info;
+
+/* ps_syntax.c */
+uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
+
+/* ps_dec.c */
+ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate);
+void ps_free(ps_info *ps);
+
+uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_syntax.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_syntax.c
index 6e988bfde..50253d459 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_syntax.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_syntax.c
@@ -39,27 +39,22 @@
typedef const int8_t (*ps_huff_tab)[2];
/* static data tables */
-static const uint8_t nr_iid_par_tab[] =
-{
+static const uint8_t nr_iid_par_tab[] = {
10, 20, 34, 10, 20, 34, 0, 0
};
-static const uint8_t nr_ipdopd_par_tab[] =
-{
+static const uint8_t nr_ipdopd_par_tab[] = {
5, 11, 17, 5, 11, 17, 0, 0
};
-static const uint8_t nr_icc_par_tab[] =
-{
+static const uint8_t nr_icc_par_tab[] = {
10, 20, 34, 10, 20, 34, 0, 0
};
-static const uint8_t num_env_tab[][4] =
-{
+static const uint8_t num_env_tab[][4] = {
{ 0, 1, 2, 4 },
{ 1, 2, 3, 4 }
};
/* binary lookup huffman tables */
-static const int8_t f_huff_iid_def[][2] =
-{
+static const int8_t f_huff_iid_def[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
{ /*1*/ -30, /*-1*/ -32 }, /* index 2: 3 bits: 10x */
@@ -90,8 +85,7 @@ static const int8_t f_huff_iid_def[][2] =
{ /*13*/ -18, /*14*/ -17 } /* index 27: 18 bits: 11111111111111111x */
};
-static const int8_t t_huff_iid_def[][2] =
-{
+static const int8_t t_huff_iid_def[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -32, 2 }, /* index 1: 2 bits: 1x */
{ /*1*/ -30, 3 }, /* index 2: 3 bits: 11x */
@@ -122,8 +116,7 @@ static const int8_t t_huff_iid_def[][2] =
{ /*13*/ -18, /*14*/ -17 } /* index 27: 20 bits: 1111111111111111111x */
};
-static const int8_t f_huff_iid_fine[][2] =
-{
+static const int8_t f_huff_iid_fine[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ 4, /*-1*/ -32 }, /* index 2: 3 bits: 00x */
@@ -186,8 +179,7 @@ static const int8_t f_huff_iid_fine[][2] =
{ /*-20*/ -51, /*20*/ -11 } /* index 59: 18 bits: 01111111101011011x */
};
-static const int8_t t_huff_iid_fine[][2] =
-{
+static const int8_t t_huff_iid_fine[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ /*1*/ -30, 2 }, /* index 1: 2 bits: 0x */
{ 3, /*-1*/ -32 }, /* index 2: 3 bits: 01x */
@@ -250,8 +242,7 @@ static const int8_t t_huff_iid_fine[][2] =
{ /*20*/ -11, /*21*/ -10 } /* index 59: 16 bits: 010011110110011x */
};
-static const int8_t f_huff_icc[][2] =
-{
+static const int8_t f_huff_icc[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */
{ /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */
@@ -268,8 +259,7 @@ static const int8_t f_huff_icc[][2] =
{ /*-6*/ -37, /*-7*/ -38 } /* index 13: 14 bits: 1111111111111x */
};
-static const int8_t t_huff_icc[][2] =
-{
+static const int8_t t_huff_icc[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */
{ /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */
@@ -286,8 +276,7 @@ static const int8_t t_huff_icc[][2] =
{ /*-7*/ -38, /*7*/ -24 } /* index 13: 14 bits: 1111111111111x */
};
-static const int8_t f_huff_ipd[][2] =
-{
+static const int8_t f_huff_ipd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ /*1*/ -30, 4 }, /* index 2: 3 bits: 00x */
@@ -297,8 +286,7 @@ static const int8_t f_huff_ipd[][2] =
{ /*2*/ -29, /*7*/ -24 } /* index 6: 4 bits: 011x */
};
-static const int8_t t_huff_ipd[][2] =
-{
+static const int8_t t_huff_ipd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ 4, 5 }, /* index 2: 3 bits: 00x */
@@ -308,8 +296,7 @@ static const int8_t t_huff_ipd[][2] =
{ /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */
};
-static const int8_t f_huff_opd[][2] =
-{
+static const int8_t f_huff_opd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ /*7*/ -24, /*1*/ -30 }, /* index 2: 3 bits: 00x */
@@ -319,8 +306,7 @@ static const int8_t f_huff_opd[][2] =
{ /*5*/ -26, /*4*/ -27 } /* index 6: 5 bits: 0111x */
};
-static const int8_t t_huff_opd[][2] =
-{
+static const int8_t t_huff_opd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ 4, 5 }, /* index 2: 3 bits: 00x */
@@ -347,8 +333,8 @@ uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header)
*header = 0;
/* check for new PS header */
- if(faad_get1bit(ld
- DEBUGVAR(1, 1000, "ps_data(): enable_ps_header")))
+ if (faad_get1bit(ld
+ DEBUGVAR(1,1000,"ps_data(): enable_ps_header")))
{
*header = 1;
@@ -358,17 +344,17 @@ uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header)
/* Inter-channel Intensity Difference (IID) parameters enabled */
ps->enable_iid = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1001, "ps_data(): enable_iid"));
+ DEBUGVAR(1,1001,"ps_data(): enable_iid"));
- if(ps->enable_iid)
+ if (ps->enable_iid)
{
ps->iid_mode = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 1002, "ps_data(): iid_mode"));
+ DEBUGVAR(1,1002,"ps_data(): iid_mode"));
ps->nr_iid_par = nr_iid_par_tab[ps->iid_mode];
ps->nr_ipdopd_par = nr_ipdopd_par_tab[ps->iid_mode];
- if(ps->iid_mode == 2 || ps->iid_mode == 5)
+ if (ps->iid_mode == 2 || ps->iid_mode == 5)
ps->use34hybrid_bands = 1;
/* IPD freq res equal to IID freq res */
@@ -377,104 +363,102 @@ uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header)
/* Inter-channel Coherence (ICC) parameters enabled */
ps->enable_icc = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1003, "ps_data(): enable_icc"));
+ DEBUGVAR(1,1003,"ps_data(): enable_icc"));
- if(ps->enable_icc)
+ if (ps->enable_icc)
{
ps->icc_mode = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 1004, "ps_data(): icc_mode"));
+ DEBUGVAR(1,1004,"ps_data(): icc_mode"));
ps->nr_icc_par = nr_icc_par_tab[ps->icc_mode];
- if(ps->icc_mode == 2 || ps->icc_mode == 5)
+ if (ps->icc_mode == 2 || ps->icc_mode == 5)
ps->use34hybrid_bands = 1;
}
/* PS extension layer enabled */
ps->enable_ext = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1005, "ps_data(): enable_ext"));
+ DEBUGVAR(1,1005,"ps_data(): enable_ext"));
}
/* we are here, but no header has been read yet */
- if(ps->header_read == 0)
+ if (ps->header_read == 0)
{
ps->ps_data_available = 0;
return 1;
}
ps->frame_class = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1006, "ps_data(): frame_class"));
+ DEBUGVAR(1,1006,"ps_data(): frame_class"));
tmp = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 1007, "ps_data(): num_env_idx"));
+ DEBUGVAR(1,1007,"ps_data(): num_env_idx"));
ps->num_env = num_env_tab[ps->frame_class][tmp];
- if(ps->frame_class)
+ if (ps->frame_class)
{
- for(n = 1; n < ps->num_env + 1; n++)
+ for (n = 1; n < ps->num_env+1; n++)
{
ps->border_position[n] = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 1008, "ps_data(): border_position")) + 1;
+ DEBUGVAR(1,1008,"ps_data(): border_position")) + 1;
}
}
- if(ps->enable_iid)
+ if (ps->enable_iid)
{
- for(n = 0; n < ps->num_env; n++)
+ for (n = 0; n < ps->num_env; n++)
{
ps->iid_dt[n] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1009, "ps_data(): iid_dt"));
+ DEBUGVAR(1,1009,"ps_data(): iid_dt"));
/* iid_data */
- if(ps->iid_mode < 3)
+ if (ps->iid_mode < 3)
{
huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_def,
- f_huff_iid_def, ps->iid_index[n]);
- }
- else
- {
+ f_huff_iid_def, ps->iid_index[n]);
+ } else {
huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_fine,
- f_huff_iid_fine, ps->iid_index[n]);
+ f_huff_iid_fine, ps->iid_index[n]);
}
}
}
- if(ps->enable_icc)
+ if (ps->enable_icc)
{
- for(n = 0; n < ps->num_env; n++)
+ for (n = 0; n < ps->num_env; n++)
{
ps->icc_dt[n] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1010, "ps_data(): icc_dt"));
+ DEBUGVAR(1,1010,"ps_data(): icc_dt"));
/* icc_data */
huff_data(ld, ps->icc_dt[n], ps->nr_icc_par, t_huff_icc,
- f_huff_icc, ps->icc_index[n]);
+ f_huff_icc, ps->icc_index[n]);
}
}
- if(ps->enable_ext)
+ if (ps->enable_ext)
{
uint16_t num_bits_left;
uint16_t cnt = (uint16_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1011, "ps_data(): ps_extension_size"));
- if(cnt == 15)
+ DEBUGVAR(1,1011,"ps_data(): ps_extension_size"));
+ if (cnt == 15)
{
cnt += (uint16_t)faad_getbits(ld, 8
- DEBUGVAR(1, 1012, "ps_data(): esc_count"));
+ DEBUGVAR(1,1012,"ps_data(): esc_count"));
}
num_bits_left = 8 * cnt;
- while(num_bits_left > 7)
+ while (num_bits_left > 7)
{
uint8_t ps_extension_id = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 1013, "ps_data(): ps_extension_size"));
+ DEBUGVAR(1,1013,"ps_data(): ps_extension_size"));
num_bits_left -= 2;
num_bits_left -= ps_extension(ps, ld, ps_extension_id, num_bits_left);
}
faad_getbits(ld, num_bits_left
- DEBUGVAR(1, 1014, "ps_data(): fill_bits"));
+ DEBUGVAR(1,1014,"ps_data(): fill_bits"));
}
bits = (uint16_t)faad_get_processed_bits(ld) - bits;
@@ -491,32 +475,32 @@ static uint16_t ps_extension(ps_info *ps, bitfile *ld,
uint8_t n;
uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
- if(ps_extension_id == 0)
+ if (ps_extension_id == 0)
{
ps->enable_ipdopd = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1015, "ps_extension(): enable_ipdopd"));
+ DEBUGVAR(1,1015,"ps_extension(): enable_ipdopd"));
- if(ps->enable_ipdopd)
+ if (ps->enable_ipdopd)
{
- for(n = 0; n < ps->num_env; n++)
+ for (n = 0; n < ps->num_env; n++)
{
ps->ipd_dt[n] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1016, "ps_extension(): ipd_dt"));
+ DEBUGVAR(1,1016,"ps_extension(): ipd_dt"));
/* ipd_data */
huff_data(ld, ps->ipd_dt[n], ps->nr_ipdopd_par, t_huff_ipd,
- f_huff_ipd, ps->ipd_index[n]);
+ f_huff_ipd, ps->ipd_index[n]);
ps->opd_dt[n] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 1017, "ps_extension(): opd_dt"));
+ DEBUGVAR(1,1017,"ps_extension(): opd_dt"));
/* opd_data */
huff_data(ld, ps->opd_dt[n], ps->nr_ipdopd_par, t_huff_opd,
- f_huff_opd, ps->opd_index[n]);
+ f_huff_opd, ps->opd_index[n]);
}
}
faad_get1bit(ld
- DEBUGVAR(1, 1018, "ps_extension(): reserved_ps"));
+ DEBUGVAR(1,1018,"ps_extension(): reserved_ps"));
}
/* return number of bits read */
@@ -531,20 +515,18 @@ static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par,
{
uint8_t n;
- if(dt)
+ if (dt)
{
/* coded in time direction */
- for(n = 0; n < nr_par; n++)
+ for (n = 0; n < nr_par; n++)
{
par[n] = ps_huff_dec(ld, t_huff);
}
- }
- else
- {
+ } else {
/* coded in frequency direction */
par[0] = ps_huff_dec(ld, f_huff);
- for(n = 1; n < nr_par; n++)
+ for (n = 1; n < nr_par; n++)
{
par[n] = ps_huff_dec(ld, f_huff);
}
@@ -557,7 +539,7 @@ static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff)
uint8_t bit;
int16_t index = 0;
- while(index >= 0)
+ while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = t_huff[index][bit];
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_tables.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_tables.h
index fd333fdba..f3370be9d 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_tables.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ps_tables.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -42,530 +42,506 @@ extern "C" {
#if 0
#if 0
- float f_center_20[12] =
- {
- 0.5 / 4, 1.5 / 4, 2.5 / 4, 3.5 / 4,
- 4.5 / 4 * 0, 5.5 / 4 * 0, -1.5 / 4, -0.5 / 4,
- 3.5 / 2, 2.5 / 2, 4.5 / 2, 5.5 / 2
- };
+float f_center_20[12] = {
+ 0.5/4, 1.5/4, 2.5/4, 3.5/4,
+ 4.5/4*0, 5.5/4*0, -1.5/4, -0.5/4,
+ 3.5/2, 2.5/2, 4.5/2, 5.5/2
+};
#else
- float f_center_20[12] =
- {
- 0.5 / 8, 1.5 / 8, 2.5 / 8, 3.5 / 8,
- 4.5 / 8 * 0, 5.5 / 8 * 0, -1.5 / 8, -0.5 / 8,
- 3.5 / 4, 2.5 / 4, 4.5 / 4, 5.5 / 4
- };
+float f_center_20[12] = {
+ 0.5/8, 1.5/8, 2.5/8, 3.5/8,
+ 4.5/8*0, 5.5/8*0, -1.5/8, -0.5/8,
+ 3.5/4, 2.5/4, 4.5/4, 5.5/4
+};
#endif
- float f_center_34[32] =
- {
- 1 / 12, 3 / 12, 5 / 12, 7 / 12,
- 9 / 12, 11 / 12, 13 / 12, 15 / 12,
- 17 / 12, -5 / 12, -3 / 12, -1 / 12,
- 17 / 8, 19 / 8, 5 / 8, 7 / 8,
- 9 / 8, 11 / 8, 13 / 8, 15 / 8,
- 9 / 4, 11 / 4, 13 / 4, 7 / 4,
- 17 / 4, 11 / 4, 13 / 4, 15 / 4,
- 17 / 4, 19 / 4, 21 / 4, 15 / 4
- };
+float f_center_34[32] = {
+ 1/12, 3/12, 5/12, 7/12,
+ 9/12, 11/12, 13/12, 15/12,
+ 17/12, -5/12, -3/12, -1/12,
+ 17/8, 19/8, 5/8, 7/8,
+ 9/8, 11/8, 13/8, 15/8,
+ 9/4, 11/4, 13/4, 7/4,
+ 17/4, 11/4, 13/4, 15/4,
+ 17/4, 19/4, 21/4, 15/4
+};
- static const real_t frac_delay_q[] =
- {
- FRAC_CONST(0.43),
- FRAC_CONST(0.75),
- FRAC_CONST(0.347)
- };
+static const real_t frac_delay_q[] = {
+ FRAC_CONST(0.43),
+ FRAC_CONST(0.75),
+ FRAC_CONST(0.347)
+};
#endif
- /* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */
- /* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */
- static const complex_t Phi_Fract_Qmf[] =
- {
- { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
- { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
- { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
- { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
- { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
- { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
- { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
- { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
- { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
- { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
- { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
- { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
- { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
- { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
- { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
- { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
- { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
- { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
- { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
- { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
- { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
- { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
- { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
- { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
- { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
- { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
- { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
- { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
- { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
- { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
- { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
- { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
- { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
- { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
- { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
- { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
- { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
- { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
- { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
- { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
- { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
- { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
- { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
- { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
- { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
- { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
- { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
- { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
- { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
- { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
- { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
- { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
- { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
- { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
- { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
- { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
- { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
- { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
- { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
- { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
- { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
- { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
- { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
- { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
- };
+/* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */
+/* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */
+static const complex_t Phi_Fract_Qmf[] = {
+ { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
+ { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
+ { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
+ { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
+ { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
+ { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
+ { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
+ { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
+ { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
+ { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
+ { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
+ { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
+ { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
+ { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
+ { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
+ { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
+ { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
+ { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
+ { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
+ { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
+ { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
+ { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
+ { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
+ { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
+ { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
+ { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
+ { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
+ { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
+ { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
+ { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
+ { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
+ { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
+ { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
+ { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
+ { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
+ { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
+ { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
+ { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
+ { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
+ { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
+ { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
+ { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
+ { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
+ { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
+ { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
+ { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
+ { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
+ { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
+ { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
+ { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
+ { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
+ { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
+ { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
+ { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
+ { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
+ { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
+ { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
+ { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
+ { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
+ { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
+ { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
+ { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
+ { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
+ { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
+};
- /* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */
- /* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */
- static const complex_t Phi_Fract_SubQmf20[] =
- {
- { FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) },
- { FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) },
- { FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) },
- { FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) },
- { FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) },
- { FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) },
- { FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) },
- { FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) },
- { FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) }
- };
+/* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */
+/* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */
+static const complex_t Phi_Fract_SubQmf20[] = {
+ { FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) },
+ { FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) },
+ { FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) },
+ { FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) },
+ { FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) },
+ { FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) },
+ { FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) },
+ { FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) },
+ { FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) }
+};
- /* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */
- /* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */
- static const complex_t Phi_Fract_SubQmf34[] =
- {
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
- { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
- { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
- { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
- { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
- { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
- { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
- { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
- { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
- { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
- { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
- { FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) },
- { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }
- };
+/* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */
+/* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */
+static const complex_t Phi_Fract_SubQmf34[] = {
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
+ { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
+ { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
+ { FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }
+};
- /* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */
- /* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */
- static const complex_t Q_Fract_allpass_Qmf[][3] =
- {
- { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
- { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
- { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
- { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
- { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
- { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
- { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
- { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
- { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
- { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
- { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
- { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
- { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
- { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
- { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
- { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
- { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
- { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
- { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
- { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
- { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
- { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
- { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
- { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
- { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
- { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
- { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
- { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
- { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
- { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
- { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
- { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
- { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
- { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
- { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
- { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
- { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
- { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
- { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
- { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
- { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
- { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
- { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
- { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
- { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
- { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
- { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
- { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
- { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
- { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
- { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
- { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
- { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
- { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
- { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
- { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
- { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
- { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
- { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
- { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
- { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
- { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
- { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
- { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
- };
+/* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */
+/* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */
+static const complex_t Q_Fract_allpass_Qmf[][3] = {
+ { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
+ { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
+ { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
+ { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
+ { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
+ { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
+ { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
+ { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
+ { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
+ { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
+ { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
+ { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
+ { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
+ { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
+ { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
+ { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
+ { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
+ { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
+ { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
+ { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
+ { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
+ { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
+ { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
+ { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
+ { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
+ { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
+ { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
+ { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
+ { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
+ { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
+ { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
+ { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
+ { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
+ { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
+ { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
+ { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
+ { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
+ { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
+ { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
+ { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
+ { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
+ { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
+ { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
+ { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
+ { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
+ { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
+ { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
+ { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
+ { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
+ { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
+ { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
+ { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
+ { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
+ { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
+ { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
+ { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
+ { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
+ { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
+ { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
+ { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
+ { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
+ { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
+ { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
+ { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
+};
- /* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */
- /* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */
- static const complex_t Q_Fract_allpass_SubQmf20[][3] =
- {
- { { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } },
- { { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } },
- { { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } },
- { { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } },
- { { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } },
- { { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } },
- { { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } },
- { { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } },
- { { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } }
- };
+/* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */
+/* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */
+static const complex_t Q_Fract_allpass_SubQmf20[][3] = {
+ { { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } },
+ { { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } },
+ { { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } },
+ { { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } },
+ { { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } },
+ { { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } },
+ { { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } },
+ { { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } },
+ { { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } }
+};
- /* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */
- /* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */
- static const complex_t Q_Fract_allpass_SubQmf34[][3] =
- {
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
- { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
- { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
- { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
- { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
- { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
- { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
- { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
- { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
- { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
- { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
- { { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } },
- { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }
- };
+/* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */
+/* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */
+static const complex_t Q_Fract_allpass_SubQmf34[][3] = {
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
+ { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
+ { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
+ { { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }
+};
#if 0
- static float quant_rho[8] =
- {
- FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092),
- FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0)
- };
+static float quant_rho[8] =
+{
+ FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092),
+ FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0)
+};
- static const uint8_t quant_iid_normal[7] =
- {
- 2, 4, 7, 10, 14, 18, 25
- };
+static const uint8_t quant_iid_normal[7] =
+{
+ 2, 4, 7, 10, 14, 18, 25
+};
- static const uint8_t quant_iid_fine[15] =
- {
- 2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50
- };
+static const uint8_t quant_iid_fine[15] =
+{
+ 2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50
+};
#endif
- static const real_t cos_alphas[] =
- {
- COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210),
- COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812),
- COEF_CONST(0.4533210856), COEF_CONST(0.0000000000)
- };
+static const real_t cos_alphas[] = {
+ COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210),
+ COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812),
+ COEF_CONST(0.4533210856), COEF_CONST(0.0000000000)
+};
- static const real_t sin_alphas[] =
- {
- COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763),
- COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812),
- COEF_CONST(0.8913472911), COEF_CONST(1.0000000000)
- };
+static const real_t sin_alphas[] = {
+ COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763),
+ COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812),
+ COEF_CONST(0.8913472911), COEF_CONST(1.0000000000)
+};
- static const real_t cos_betas_normal[][8] =
- {
- { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }
- };
+static const real_t cos_betas_normal[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }
+};
- static const real_t sin_betas_normal[][8] =
- {
- { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }
- };
+static const real_t sin_betas_normal[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }
+};
- static const real_t cos_betas_fine[][8] =
- {
- { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) }
- };
+static const real_t cos_betas_fine[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) }
+};
- static const real_t sin_betas_fine[][8] =
- {
- { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) },
- { COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) }
- };
+static const real_t sin_betas_fine[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) }
+};
- static const real_t sincos_alphas_B_normal[][8] =
- {
- { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
- { COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) },
- { COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) },
- { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
- { COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) },
- { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
- { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
- { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
- { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
- { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
- { COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) },
- { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
- { COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) },
- { COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) },
- { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }
- };
+static const real_t sincos_alphas_B_normal[][8] = {
+ { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
+ { COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) },
+ { COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) },
+ { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
+ { COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) },
+ { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
+ { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
+ { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
+ { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
+ { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
+ { COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) },
+ { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
+ { COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) },
+ { COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) },
+ { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }
+};
- static const real_t sincos_alphas_B_fine[][8] =
- {
- { COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) },
- { COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) },
- { COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) },
- { COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) },
- { COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) },
- { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
- { COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) },
- { COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) },
- { COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) },
- { COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) },
- { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
- { COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) },
- { COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) },
- { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
- { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
- { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
- { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
- { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
- { COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) },
- { COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) },
- { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
- { COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) },
- { COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) },
- { COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) },
- { COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) },
- { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) },
- { COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) },
- { COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) },
- { COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) },
- { COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) },
- { COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) }
- };
+static const real_t sincos_alphas_B_fine[][8] = {
+ { COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) },
+ { COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) },
+ { COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) },
+ { COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) },
+ { COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) },
+ { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
+ { COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) },
+ { COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) },
+ { COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) },
+ { COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) },
+ { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
+ { COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) },
+ { COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) },
+ { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
+ { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
+ { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
+ { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
+ { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
+ { COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) },
+ { COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) },
+ { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
+ { COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) },
+ { COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) },
+ { COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) },
+ { COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) },
+ { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) },
+ { COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) },
+ { COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) },
+ { COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) },
+ { COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) },
+ { COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) }
+};
- static const real_t cos_gammas_normal[][8] =
- {
- { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }
- };
+static const real_t cos_gammas_normal[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }
+};
- static const real_t cos_gammas_fine[][8] =
- {
- { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) },
- { COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) }
- };
+static const real_t cos_gammas_fine[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) }
+};
- static const real_t sin_gammas_normal[][8] =
- {
- { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }
- };
+static const real_t sin_gammas_normal[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }
+};
- static const real_t sin_gammas_fine[][8] =
- {
- { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) },
- { COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) }
- };
+static const real_t sin_gammas_fine[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) }
+};
- static const real_t sf_iid_normal[] =
- {
- COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023),
- COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117),
- COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546),
- COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363),
- COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272)
- };
+static const real_t sf_iid_normal[] = {
+ COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023),
+ COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117),
+ COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546),
+ COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363),
+ COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272)
+};
- static const real_t sf_iid_fine[] =
- {
- COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471),
- COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747),
- COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564),
- COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403),
- COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031),
- COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662),
- COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363),
- COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875),
- COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170),
- COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812),
- COEF_CONST(0.0044721137)
- };
+static const real_t sf_iid_fine[] = {
+ COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471),
+ COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747),
+ COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564),
+ COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403),
+ COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031),
+ COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662),
+ COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363),
+ COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875),
+ COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170),
+ COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812),
+ COEF_CONST(0.0044721137)
+};
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.c
index 22c761064..3dd973abf 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -41,14 +41,14 @@ uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen)
k = min(ics->swb_offset[pul->pulse_start_sfb], ics->swb_offset_max);
- for(i = 0; i <= pul->number_pulse; i++)
+ for (i = 0; i <= pul->number_pulse; i++)
{
k += pul->pulse_offset[i];
- if(k >= framelen)
+ if (k >= framelen)
return 15; /* should not be possible */
- if(spec_data[k] > 0)
+ if (spec_data[k] > 0)
spec_data[k] += pul->pulse_amp[i];
else
spec_data[k] -= pul->pulse_amp[i];
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.h
index e74409c6e..f7676cd89 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/pulse.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,7 +35,7 @@
extern "C" {
#endif
- uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen);
+uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.c
index b8139b5ef..73619c6d1 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -76,38 +76,38 @@ uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld)
uint8_t bits = 9;
ics->sf_concealment = faad_get1bit(ld
- DEBUGVAR(1, 149, "rvlc_scale_factor_data(): sf_concealment"));
+ DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment"));
ics->rev_global_gain = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 150, "rvlc_scale_factor_data(): rev_global_gain"));
+ DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain"));
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
bits = 11;
/* the number of bits used for the huffman codewords */
ics->length_of_rvlc_sf = (uint16_t)faad_getbits(ld, bits
- DEBUGVAR(1, 151, "rvlc_scale_factor_data(): length_of_rvlc_sf"));
+ DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf"));
- if(ics->noise_used)
+ if (ics->noise_used)
{
ics->dpcm_noise_nrg = (uint16_t)faad_getbits(ld, 9
- DEBUGVAR(1, 152, "rvlc_scale_factor_data(): dpcm_noise_nrg"));
+ DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg"));
ics->length_of_rvlc_sf -= 9;
}
ics->sf_escapes_present = faad_get1bit(ld
- DEBUGVAR(1, 153, "rvlc_scale_factor_data(): sf_escapes_present"));
+ DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present"));
- if(ics->sf_escapes_present)
+ if (ics->sf_escapes_present)
{
ics->length_of_rvlc_escapes = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 154, "rvlc_scale_factor_data(): length_of_rvlc_escapes"));
+ DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes"));
}
- if(ics->noise_used)
+ if (ics->noise_used)
{
ics->dpcm_noise_last_position = (uint16_t)faad_getbits(ld, 9
- DEBUGVAR(1, 155, "rvlc_scale_factor_data(): dpcm_noise_last_position"));
+ DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position"));
}
return 0;
@@ -122,26 +122,26 @@ uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld)
bitfile ld_rvlc_sf, ld_rvlc_esc;
// bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev;
- if(ics->length_of_rvlc_sf > 0)
+ if (ics->length_of_rvlc_sf > 0)
{
/* We read length_of_rvlc_sf bits here to put it in a
seperate bitfile.
*/
rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf
- DEBUGVAR(1, 156, "rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf"));
+ DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf"));
faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf));
// faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer,
// ics->length_of_rvlc_sf);
}
- if(ics->sf_escapes_present)
+ if (ics->sf_escapes_present)
{
/* We read length_of_rvlc_escapes bits here to put it in a
seperate bitfile.
*/
rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes
- DEBUGVAR(1, 157, "rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes"));
+ DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes"));
faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes));
// faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer,
@@ -150,17 +150,17 @@ uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld)
/* decode the rvlc scale factors and escapes */
result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf,
- &ld_rvlc_esc, &intensity_used);
+ &ld_rvlc_esc, &intensity_used);
// result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev,
// &ld_rvlc_esc_rev, intensity_used);
- if(rvlc_esc_buffer) faad_free(rvlc_esc_buffer);
- if(rvlc_sf_buffer) faad_free(rvlc_sf_buffer);
+ if (rvlc_esc_buffer) faad_free(rvlc_esc_buffer);
+ if (rvlc_sf_buffer) faad_free(rvlc_sf_buffer);
- if(ics->length_of_rvlc_sf > 0)
+ if (ics->length_of_rvlc_sf > 0)
faad_endbits(&ld_rvlc_sf);
- if(ics->sf_escapes_present)
+ if (ics->sf_escapes_present)
faad_endbits(&ld_rvlc_esc);
return result;
@@ -182,17 +182,15 @@ static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *l
printf("\nglobal_gain: %d\n", ics->global_gain);
#endif
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
- for(sfb = 0; sfb < ics->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
- if(error)
+ if (error)
{
ics->scale_factors[g][sfb] = 0;
- }
- else
- {
- switch(ics->sfb_cb[g][sfb])
+ } else {
+ switch (ics->sfb_cb[g][sfb])
{
case ZERO_HCB: /* zero book */
ics->scale_factors[g][sfb] = 0;
@@ -212,14 +210,12 @@ static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *l
case NOISE_HCB: /* noise books */
/* decode noise energy */
- if(noise_pcm_flag)
+ if (noise_pcm_flag)
{
int16_t n = ics->dpcm_noise_nrg;
noise_pcm_flag = 0;
noise_energy += n;
- }
- else
- {
+ } else {
t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
noise_energy += t;
}
@@ -233,7 +229,7 @@ static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *l
t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
scale_factor += t;
- if(scale_factor < 0)
+ if (scale_factor < 0)
return 4;
ics->scale_factors[g][sfb] = scale_factor;
@@ -242,9 +238,9 @@ static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *l
}
#ifdef PRINT_RVLC
printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
- ics->scale_factors[g][sfb]);
+ ics->scale_factors[g][sfb]);
#endif
- if(t == 99)
+ if (t == 99)
{
error = 1;
}
@@ -275,7 +271,7 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
printf("\nrev_global_gain: %d\n", ics->rev_global_gain);
#endif
- if(intensity_used)
+ if (intensity_used)
{
is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1);
#ifdef PRINT_RVLC
@@ -283,17 +279,15 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
#endif
}
- for(g = ics->num_window_groups - 1; g >= 0; g--)
+ for (g = ics->num_window_groups-1; g >= 0; g--)
{
- for(sfb = ics->max_sfb - 1; sfb >= 0; sfb--)
+ for (sfb = ics->max_sfb-1; sfb >= 0; sfb--)
{
- if(error)
+ if (error)
{
ics->scale_factors[g][sfb] = 0;
- }
- else
- {
- switch(ics->sfb_cb[g][sfb])
+ } else {
+ switch (ics->sfb_cb[g][sfb])
{
case ZERO_HCB: /* zero book */
ics->scale_factors[g][sfb] = 0;
@@ -301,13 +295,11 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
case INTENSITY_HCB: /* intensity books */
case INTENSITY_HCB2:
- if(is_pcm_flag)
+ if (is_pcm_flag)
{
is_pcm_flag = 0;
ics->scale_factors[g][sfb] = is_position;
- }
- else
- {
+ } else {
t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
is_position -= t;
@@ -317,13 +309,11 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
case NOISE_HCB: /* noise books */
/* decode noise energy */
- if(noise_pcm_flag)
+ if (noise_pcm_flag)
{
noise_pcm_flag = 0;
noise_energy = ics->dpcm_noise_last_position;
- }
- else
- {
+ } else {
t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
noise_energy -= t;
}
@@ -332,20 +322,18 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
break;
default: /* spectral books */
- if(sf_pcm_flag || (sfb == 0))
+ if (sf_pcm_flag || (sfb == 0))
{
sf_pcm_flag = 0;
- if(sfb == 0)
+ if (sfb == 0)
scale_factor = ics->global_gain;
- }
- else
- {
+ } else {
/* decode scale factor */
t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
scale_factor -= t;
}
- if(scale_factor < 0)
+ if (scale_factor < 0)
return 4;
ics->scale_factors[g][sfb] = (uint8_t)scale_factor;
@@ -353,9 +341,9 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
}
#ifdef PRINT_RVLC
printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
- ics->scale_factors[g][sfb]);
+ ics->scale_factors[g][sfb]);
#endif
- if(t == 99)
+ if (t == 99)
{
error = 1;
}
@@ -372,8 +360,7 @@ static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *l
#endif
/* index == 99 means not allowed codeword */
-static rvlc_huff_table book_rvlc[] =
-{
+static rvlc_huff_table book_rvlc[] = {
/*index length codeword */
{ 0, 1, 0 }, /* 0 */
{ -1, 3, 5 }, /* 101 */
@@ -401,8 +388,7 @@ static rvlc_huff_table book_rvlc[] =
{ 99, 10, 0 } /* Shouldn't come this far */
};
-static rvlc_huff_table book_escape[] =
-{
+static rvlc_huff_table book_escape[] = {
/*index length codeword */
{ 1, 2, 0 },
{ 0, 2, 2 },
@@ -468,42 +454,42 @@ static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
int8_t index;
uint32_t cw;
rvlc_huff_table *h = book_rvlc;
-
+
i = h->len;
- if(direction > 0)
- cw = faad_getbits(ld_sf, i DEBUGVAR(1, 0, ""));
+ if (direction > 0)
+ cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,""));
else
- cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1, 0, ""));
+ cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,""));
- while((cw != h->cw)
- && (i < 10))
+ while ((cw != h->cw)
+ && (i < 10))
{
h++;
- j = h->len - i;
+ j = h->len-i;
i += j;
cw <<= j;
- if(direction > 0)
- cw |= faad_getbits(ld_sf, j DEBUGVAR(1, 0, ""));
+ if (direction > 0)
+ cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,""));
else
- cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1, 0, ""));
+ cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,""));
}
index = h->index;
- if(index == +ESC_VAL)
+ if (index == +ESC_VAL)
{
int8_t esc = rvlc_huffman_esc(ld_esc, direction);
- if(esc == 99)
+ if (esc == 99)
return 99;
index += esc;
#ifdef PRINT_RVLC
printf("esc: %d - ", esc);
#endif
}
- if(index == -ESC_VAL)
+ if (index == -ESC_VAL)
{
int8_t esc = rvlc_huffman_esc(ld_esc, direction);
- if(esc == 99)
+ if (esc == 99)
return 99;
index -= esc;
#ifdef PRINT_RVLC
@@ -522,22 +508,22 @@ static int8_t rvlc_huffman_esc(bitfile *ld,
rvlc_huff_table *h = book_escape;
i = h->len;
- if(direction > 0)
- cw = faad_getbits(ld, i DEBUGVAR(1, 0, ""));
+ if (direction > 0)
+ cw = faad_getbits(ld, i DEBUGVAR(1,0,""));
else
- cw = faad_getbits_rev(ld, i DEBUGVAR(1, 0, ""));
+ cw = faad_getbits_rev(ld, i DEBUGVAR(1,0,""));
- while((cw != h->cw)
- && (i < 21))
+ while ((cw != h->cw)
+ && (i < 21))
{
h++;
- j = h->len - i;
+ j = h->len-i;
i += j;
cw <<= j;
- if(direction > 0)
- cw |= faad_getbits(ld, j DEBUGVAR(1, 0, ""));
+ if (direction > 0)
+ cw |= faad_getbits(ld, j DEBUGVAR(1,0,""));
else
- cw |= faad_getbits_rev(ld, j DEBUGVAR(1, 0, ""));
+ cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,""));
}
return h->index;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.h
index 4136ea34f..56f630fa4 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/rvlc.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,19 +35,19 @@
extern "C" {
#endif
- typedef struct
- {
- int8_t index;
- uint8_t len;
- uint32_t cw;
- } rvlc_huff_table;
+typedef struct
+{
+ int8_t index;
+ uint8_t len;
+ uint32_t cw;
+} rvlc_huff_table;
#define ESC_VAL 7
- uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
- uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
+uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
+uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.c
index 76365d528..16e7128ea 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -1869,8 +1869,7 @@ void DCT2_32_unscaled(real_t *y, real_t *x)
#define log2n 5
// w_array_real[i] = cos(2*M_PI*i/32)
-static const real_t w_array_real[] =
-{
+static const real_t w_array_real[] = {
FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272),
FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765),
FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169),
@@ -1882,8 +1881,7 @@ static const real_t w_array_real[] =
};
// w_array_imag[i] = sin(-2*M_PI*i/32)
-static const real_t w_array_imag[] =
-{
+static const real_t w_array_imag[] = {
FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064),
FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862),
FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512),
@@ -1906,12 +1904,12 @@ static void fft_dif(real_t * Real, real_t * Imag)
// First 2 stages of 32 point FFT decimation in frequency
// 4*16*2=64*2=128 multiplications
// 6*16*2=96*2=192 additions
- // Stage 1 of 32 point FFT decimation in frequency
- for(i = 0; i < 16; i++)
+ // Stage 1 of 32 point FFT decimation in frequency
+ for (i = 0; i < 16; i++)
{
point1_real = Real[i];
point1_imag = Imag[i];
- i2 = i + 16;
+ i2 = i+16;
point2_real = Real[i2];
point2_imag = Imag[i2];
@@ -1927,19 +1925,19 @@ static void fft_dif(real_t * Real, real_t * Imag)
Imag[i] += point2_imag;
// x[i2] = (x[i] - x[i2]) * w
- Real[i2] = (MUL_F(point1_real, w_real) - MUL_F(point1_imag, w_imag));
- Imag[i2] = (MUL_F(point1_real, w_imag) + MUL_F(point1_imag, w_real));
- }
+ Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+ Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+ }
// Stage 2 of 32 point FFT decimation in frequency
- for(j = 0, w_index = 0; j < 8; j++, w_index += 2)
+ for (j = 0, w_index = 0; j < 8; j++, w_index += 2)
{
w_real = w_array_real[w_index];
w_imag = w_array_imag[w_index];
- i = j;
+ i = j;
point1_real = Real[i];
point1_imag = Imag[i];
- i2 = i + 8;
+ i2 = i+8;
point2_real = Real[i2];
point2_imag = Imag[i2];
@@ -1952,13 +1950,13 @@ static void fft_dif(real_t * Real, real_t * Imag)
Imag[i] += point2_imag;
// x[i2] = (x[i] - x[i2]) * w
- Real[i2] = (MUL_F(point1_real, w_real) - MUL_F(point1_imag, w_imag));
- Imag[i2] = (MUL_F(point1_real, w_imag) + MUL_F(point1_imag, w_real));
+ Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+ Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
- i = j + 16;
+ i = j+16;
point1_real = Real[i];
point1_imag = Imag[i];
- i2 = i + 8;
+ i2 = i+8;
point2_real = Real[i2];
point2_imag = Imag[i2];
@@ -1971,16 +1969,16 @@ static void fft_dif(real_t * Real, real_t * Imag)
Imag[i] += point2_imag;
// x[i2] = (x[i] - x[i2]) * w
- Real[i2] = (MUL_F(point1_real, w_real) - MUL_F(point1_imag, w_imag));
- Imag[i2] = (MUL_F(point1_real, w_imag) + MUL_F(point1_imag, w_real));
+ Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+ Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
}
// Stage 3 of 32 point FFT decimation in frequency
// 2*4*2=16 multiplications
// 4*4*2+6*4*2=10*8=80 additions
- for(i = 0; i < n; i += 8)
+ for (i = 0; i < n; i += 8)
{
- i2 = i + 4;
+ i2 = i+4;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -1997,9 +1995,9 @@ static void fft_dif(real_t * Real, real_t * Imag)
}
w_real = w_array_real[4]; // = sqrt(2)/2
// w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2
- for(i = 1; i < n; i += 8)
+ for (i = 1; i < n; i += 8)
{
- i2 = i + 4;
+ i2 = i+4;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -2015,12 +2013,12 @@ static void fft_dif(real_t * Real, real_t * Imag)
Imag[i] += point2_imag;
// x[i2] = (x[i] - x[i2]) * w
- Real[i2] = MUL_F(point1_real + point1_imag, w_real);
- Imag[i2] = MUL_F(point1_imag - point1_real, w_real);
+ Real[i2] = MUL_F(point1_real+point1_imag, w_real);
+ Imag[i2] = MUL_F(point1_imag-point1_real, w_real);
}
- for(i = 2; i < n; i += 8)
+ for (i = 2; i < n; i += 8)
{
- i2 = i + 4;
+ i2 = i+4;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -2037,9 +2035,9 @@ static void fft_dif(real_t * Real, real_t * Imag)
}
w_real = w_array_real[12]; // = -sqrt(2)/2
// w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2
- for(i = 3; i < n; i += 8)
+ for (i = 3; i < n; i += 8)
{
- i2 = i + 4;
+ i2 = i+4;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -2055,16 +2053,16 @@ static void fft_dif(real_t * Real, real_t * Imag)
Imag[i] += point2_imag;
// x[i2] = (x[i] - x[i2]) * w
- Real[i2] = MUL_F(point1_real - point1_imag, w_real);
- Imag[i2] = MUL_F(point1_real + point1_imag, w_real);
+ Real[i2] = MUL_F(point1_real-point1_imag, w_real);
+ Imag[i2] = MUL_F(point1_real+point1_imag, w_real);
}
// Stage 4 of 32 point FFT decimation in frequency (no multiplications)
// 16*4=64 additions
- for(i = 0; i < n; i += 4)
+ for (i = 0; i < n; i += 4)
{
- i2 = i + 2;
+ i2 = i+2;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -2079,9 +2077,9 @@ static void fft_dif(real_t * Real, real_t * Imag)
Real[i2] = point1_real - point2_real;
Imag[i2] = point1_imag - point2_imag;
}
- for(i = 1; i < n; i += 4)
+ for (i = 1; i < n; i += 4)
{
- i2 = i + 2;
+ i2 = i+2;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -2099,9 +2097,9 @@ static void fft_dif(real_t * Real, real_t * Imag)
// Stage 5 of 32 point FFT decimation in frequency (no multiplications)
// 16*4=64 additions
- for(i = 0; i < n; i += 2)
+ for (i = 0; i < n; i += 2)
{
- i2 = i + 1;
+ i2 = i+1;
point1_real = Real[i];
point1_imag = Imag[i];
@@ -2124,8 +2122,7 @@ static void fft_dif(real_t * Real, real_t * Imag)
#undef n
#undef log2n
-static const real_t dct4_64_tab[] =
-{
+static const real_t dct4_64_tab[] = {
COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507),
COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537),
COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708),
@@ -2228,17 +2225,17 @@ static const real_t dct4_64_tab[] =
void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag)
{
// Tables with bit reverse values for 5 bits, bit reverse of i at i-th position
- const uint8_t bit_rev_tab[32] = { 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31 };
+ const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 };
uint32_t i, i_rev;
/* Step 2: modulate */
// 3*32=96 multiplications
// 3*32=96 additions
- for(i = 0; i < 32; i++)
+ for (i = 0; i < 32; i++)
{
- real_t x_re, x_im, tmp;
- x_re = in_real[i];
- x_im = in_imag[i];
+ real_t x_re, x_im, tmp;
+ x_re = in_real[i];
+ x_im = in_imag[i];
tmp = MUL_C(x_re + x_im, dct4_64_tab[i]);
in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp;
in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp;
@@ -2250,12 +2247,12 @@ void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t *
/* Step 4: modulate + bitreverse reordering */
// 3*31+2=95 multiplications
// 3*31+2=95 additions
- for(i = 0; i < 16; i++)
+ for (i = 0; i < 16; i++)
{
- real_t x_re, x_im, tmp;
- i_rev = bit_rev_tab[i];
- x_re = in_real[i_rev];
- x_im = in_imag[i_rev];
+ real_t x_re, x_im, tmp;
+ i_rev = bit_rev_tab[i];
+ x_re = in_real[i_rev];
+ x_im = in_imag[i_rev];
tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
@@ -2264,12 +2261,12 @@ void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t *
// i = 16, i_rev = 1 = rev(16);
out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]);
out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]);
- for(i = 17; i < 32; i++)
+ for (i = 17; i < 32; i++)
{
- real_t x_re, x_im, tmp;
- i_rev = bit_rev_tab[i];
- x_re = in_real[i_rev];
- x_im = in_imag[i_rev];
+ real_t x_re, x_im, tmp;
+ i_rev = bit_rev_tab[i];
+ x_re = in_real[i_rev];
+ x_im = in_imag[i_rev];
tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.h
index 5ef1d8cd3..ce44fd7ef 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dct.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,14 +35,14 @@
extern "C" {
#endif
- void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag);
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag);
- void DCT3_32_unscaled(real_t *y, real_t *x);
- void DCT4_32(real_t *y, real_t *x);
- void DST4_32(real_t *y, real_t *x);
- void DCT2_32_unscaled(real_t *y, real_t *x);
- void DCT4_16(real_t *y, real_t *x);
- void DCT2_16_unscaled(real_t *y, real_t *x);
+void DCT3_32_unscaled(real_t *y, real_t *x);
+void DCT4_32(real_t *y, real_t *x);
+void DST4_32(real_t *y, real_t *x);
+void DCT2_32_unscaled(real_t *y, real_t *x);
+void DCT4_16(real_t *y, real_t *x);
+void DCT2_16_unscaled(real_t *y, real_t *x);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.c
index ceab5f479..0705ddd91 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -53,9 +53,9 @@ static void sbr_save_matrix(sbr_info *sbr, uint8_t ch);
sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
uint32_t sample_rate, uint8_t downSampledSBR
#ifdef DRM
- , uint8_t IsDRM
+ , uint8_t IsDRM
#endif
- )
+ )
{
sbr_info *sbr = faad_malloc(sizeof(sbr_info));
memset(sbr, 0, sizeof(sbr_info));
@@ -93,13 +93,11 @@ sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
/* force sbr reset */
sbr->bs_start_freq_prev = -1;
- if(framelength == 960)
+ if (framelength == 960)
{
sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960;
sbr->numTimeSlots = NO_TIME_SLOTS_960;
- }
- else
- {
+ } else {
sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS;
sbr->numTimeSlots = NO_TIME_SLOTS;
}
@@ -107,41 +105,39 @@ sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
sbr->GQ_ringbuf_index[0] = 0;
sbr->GQ_ringbuf_index[1] = 0;
- if(id_aac == ID_CPE)
+ if (id_aac == ID_CPE)
{
/* stereo */
uint8_t j;
sbr->qmfa[0] = qmfa_init(32);
sbr->qmfa[1] = qmfa_init(32);
- sbr->qmfs[0] = qmfs_init((downSampledSBR) ? 32 : 64);
- sbr->qmfs[1] = qmfs_init((downSampledSBR) ? 32 : 64);
+ sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+ sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
- for(j = 0; j < 5; j++)
+ for (j = 0; j < 5; j++)
{
- sbr->G_temp_prev[0][j] = faad_malloc(64 * sizeof(real_t));
- sbr->G_temp_prev[1][j] = faad_malloc(64 * sizeof(real_t));
- sbr->Q_temp_prev[0][j] = faad_malloc(64 * sizeof(real_t));
- sbr->Q_temp_prev[1][j] = faad_malloc(64 * sizeof(real_t));
+ sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+ sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
}
- memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate + sbr->tHFGen) * 64 * sizeof(qmf_t));
- memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate + sbr->tHFGen) * 64 * sizeof(qmf_t));
- }
- else
- {
+ memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ } else {
/* mono */
uint8_t j;
sbr->qmfa[0] = qmfa_init(32);
- sbr->qmfs[0] = qmfs_init((downSampledSBR) ? 32 : 64);
+ sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
sbr->qmfs[1] = NULL;
- for(j = 0; j < 5; j++)
+ for (j = 0; j < 5; j++)
{
- sbr->G_temp_prev[0][j] = faad_malloc(64 * sizeof(real_t));
- sbr->Q_temp_prev[0][j] = faad_malloc(64 * sizeof(real_t));
+ sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
}
- memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate + sbr->tHFGen) * 64 * sizeof(qmf_t));
+ memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
}
return sbr;
@@ -151,31 +147,31 @@ void sbrDecodeEnd(sbr_info *sbr)
{
uint8_t j;
- if(sbr)
+ if (sbr)
{
qmfa_end(sbr->qmfa[0]);
qmfs_end(sbr->qmfs[0]);
- if(sbr->qmfs[1] != NULL)
+ if (sbr->qmfs[1] != NULL)
{
qmfa_end(sbr->qmfa[1]);
qmfs_end(sbr->qmfs[1]);
}
- for(j = 0; j < 5; j++)
+ for (j = 0; j < 5; j++)
{
- if(sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]);
- if(sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]);
- if(sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]);
- if(sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]);
+ if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]);
+ if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]);
+ if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]);
+ if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]);
}
#ifdef PS_DEC
- if(sbr->ps != NULL)
+ if (sbr->ps != NULL)
ps_free(sbr->ps);
#endif
#ifdef DRM_PS
- if(sbr->drm_ps != NULL)
+ if (sbr->drm_ps != NULL)
drm_ps_free(sbr->drm_ps);
#endif
@@ -186,30 +182,30 @@ void sbrDecodeEnd(sbr_info *sbr)
void sbrReset(sbr_info *sbr)
{
uint8_t j;
- if(sbr->qmfa[0] != NULL)
+ if (sbr->qmfa[0] != NULL)
memset(sbr->qmfa[0]->x, 0, 2 * sbr->qmfa[0]->channels * 10 * sizeof(real_t));
- if(sbr->qmfa[1] != NULL)
+ if (sbr->qmfa[1] != NULL)
memset(sbr->qmfa[1]->x, 0, 2 * sbr->qmfa[1]->channels * 10 * sizeof(real_t));
- if(sbr->qmfs[0] != NULL)
+ if (sbr->qmfs[0] != NULL)
memset(sbr->qmfs[0]->v, 0, 2 * sbr->qmfs[0]->channels * 20 * sizeof(real_t));
- if(sbr->qmfs[1] != NULL)
+ if (sbr->qmfs[1] != NULL)
memset(sbr->qmfs[1]->v, 0, 2 * sbr->qmfs[1]->channels * 20 * sizeof(real_t));
- for(j = 0; j < 5; j++)
+ for (j = 0; j < 5; j++)
{
- if(sbr->G_temp_prev[0][j] != NULL)
- memset(sbr->G_temp_prev[0][j], 0, 64 * sizeof(real_t));
- if(sbr->G_temp_prev[1][j] != NULL)
- memset(sbr->G_temp_prev[1][j], 0, 64 * sizeof(real_t));
- if(sbr->Q_temp_prev[0][j] != NULL)
- memset(sbr->Q_temp_prev[0][j], 0, 64 * sizeof(real_t));
- if(sbr->Q_temp_prev[1][j] != NULL)
- memset(sbr->Q_temp_prev[1][j], 0, 64 * sizeof(real_t));
+ if (sbr->G_temp_prev[0][j] != NULL)
+ memset(sbr->G_temp_prev[0][j], 0, 64*sizeof(real_t));
+ if (sbr->G_temp_prev[1][j] != NULL)
+ memset(sbr->G_temp_prev[1][j], 0, 64*sizeof(real_t));
+ if (sbr->Q_temp_prev[0][j] != NULL)
+ memset(sbr->Q_temp_prev[0][j], 0, 64*sizeof(real_t));
+ if (sbr->Q_temp_prev[1][j] != NULL)
+ memset(sbr->Q_temp_prev[1][j], 0, 64*sizeof(real_t));
}
- memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate + sbr->tHFGen) * 64 * sizeof(qmf_t));
- memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate + sbr->tHFGen) * 64 * sizeof(qmf_t));
-
+ memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+
sbr->GQ_ringbuf_index[0] = 0;
sbr->GQ_ringbuf_index[1] = 0;
sbr->header_count = 0;
@@ -236,7 +232,7 @@ void sbrReset(sbr_info *sbr)
sbr->f_prev[0] = 0;
sbr->f_prev[1] = 0;
- for(j = 0; j < MAX_M; j++)
+ for (j = 0; j < MAX_M; j++)
{
sbr->E_prev[0][j] = 0;
sbr->Q_prev[0][j] = 0;
@@ -261,23 +257,23 @@ static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
sbr->L_E_prev[ch] = sbr->L_E[ch];
/* sbr->L_E[ch] can become 0 on files with bit errors */
- if(sbr->L_E[ch] <= 0)
+ if (sbr->L_E[ch] <= 0)
return 19;
sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1];
- for(i = 0; i < MAX_M; i++)
+ for (i = 0; i < MAX_M; i++)
{
sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1];
sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1];
}
- for(i = 0; i < MAX_M; i++)
+ for (i = 0; i < MAX_M; i++)
{
sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i];
}
sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch];
- if(sbr->l_A[ch] == sbr->L_E[ch])
+ if (sbr->l_A[ch] == sbr->L_E[ch])
sbr->prevEnvIsShort[ch] = 0;
else
sbr->prevEnvIsShort[ch] = -1;
@@ -289,11 +285,11 @@ static void sbr_save_matrix(sbr_info *sbr, uint8_t ch)
{
uint8_t i;
- for(i = 0; i < sbr->tHFGen; i++)
+ for (i = 0; i < sbr->tHFGen; i++)
{
memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t));
}
- for(i = sbr->tHFGen; i < MAX_NTSRHFG; i++)
+ for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++)
{
memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t));
}
@@ -311,12 +307,10 @@ static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[M
#endif
#ifdef DRM
- if(sbr->Is_DRM_SBR)
- {
- sbr->bsco = max((int32_t)sbr->maxAACLine * 32 / (int32_t)sbr->frame_len - (int32_t)sbr->kx, 0);
- }
- else
+ if (sbr->Is_DRM_SBR)
{
+ sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0);
+ } else {
#endif
sbr->bsco = 0;
#ifdef DRM
@@ -328,7 +322,7 @@ static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[M
#ifdef PRE_QMF_PRINT
{
int i;
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
printf("%d\n", channel_buf[i]);
}
@@ -337,27 +331,27 @@ static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[M
/* subband analysis */
- if(dont_process)
+ if (dont_process)
sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32);
else
sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx);
- if(!dont_process)
+ if (!dont_process)
{
#if 1
/* insert high frequencies here */
/* hf generation using patching */
hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch]
#ifdef SBR_LOW_POWER
- , deg
+ ,deg
#endif
- , ch);
+ ,ch);
#endif
#if 0 //def SBR_LOW_POWER
- for(l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++)
+ for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++)
{
- for(k = 0; k < sbr->kx; k++)
+ for (k = 0; k < sbr->kx; k++)
{
QMF_RE(sbr->Xsbr[ch][sbr->tHFAdj + l][k]) = 0;
}
@@ -368,28 +362,28 @@ static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[M
/* hf adjustment */
ret = hf_adjustment(sbr, sbr->Xsbr[ch]
#ifdef SBR_LOW_POWER
- , deg
+ ,deg
#endif
- , ch);
+ ,ch);
#endif
- if(ret > 0)
+ if (ret > 0)
{
dont_process = 1;
}
}
- if((sbr->just_seeked != 0) || dont_process)
+ if ((sbr->just_seeked != 0) || dont_process)
{
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
- for(k = 0; k < 32; k++)
+ for (k = 0; k < 32; k++)
{
QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
#ifndef SBR_LOW_POWER
QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
#endif
}
- for(k = 32; k < 64; k++)
+ for (k = 32; k < 64; k++)
{
QMF_RE(X[l][k]) = 0;
#ifndef SBR_LOW_POWER
@@ -397,52 +391,48 @@ static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[M
#endif
}
}
- }
- else
- {
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ } else {
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
uint8_t kx_band, M_band, bsco_band;
- if(l < sbr->t_E[ch][0])
+ if (l < sbr->t_E[ch][0])
{
kx_band = sbr->kx_prev;
M_band = sbr->M_prev;
bsco_band = sbr->bsco_prev;
- }
- else
- {
+ } else {
kx_band = sbr->kx;
M_band = sbr->M;
bsco_band = sbr->bsco;
}
#ifndef SBR_LOW_POWER
- for(k = 0; k < kx_band + bsco_band; k++)
+ for (k = 0; k < kx_band + bsco_band; k++)
{
QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
}
- for(k = kx_band + bsco_band; k < kx_band + M_band; k++)
+ for (k = kx_band + bsco_band; k < kx_band + M_band; k++)
{
QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
}
- for(k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+ for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
{
QMF_RE(X[l][k]) = 0;
QMF_IM(X[l][k]) = 0;
}
#else
- for(k = 0; k < kx_band + bsco_band; k++)
+ for (k = 0; k < kx_band + bsco_band; k++)
{
QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
}
- for(k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++)
+ for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++)
{
QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
}
- for(k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+ for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
{
QMF_RE(X[l][k]) = 0;
}
@@ -462,63 +452,57 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha
uint8_t ret = 0;
ALIGN qmf_t X[MAX_NTSR][64];
- if(sbr == NULL)
+ if (sbr == NULL)
return 20;
/* case can occur due to bit errors */
- if(sbr->id_aac != ID_CPE)
+ if (sbr->id_aac != ID_CPE)
return 21;
- if(sbr->ret || (sbr->header_count == 0))
+ if (sbr->ret || (sbr->header_count == 0))
{
/* don't process just upsample */
dont_process = 1;
/* Re-activate reset for next frame */
- if(sbr->ret && sbr->Reset)
+ if (sbr->ret && sbr->Reset)
sbr->bs_start_freq_prev = -1;
}
- if(just_seeked)
+ if (just_seeked)
{
sbr->just_seeked = 1;
- }
- else
- {
+ } else {
sbr->just_seeked = 0;
}
sbr->ret += sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR);
/* subband synthesis */
- if(downSampledSBR)
+ if (downSampledSBR)
{
sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan);
- }
- else
- {
+ } else {
sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
}
sbr->ret += sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR);
/* subband synthesis */
- if(downSampledSBR)
+ if (downSampledSBR)
{
sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan);
- }
- else
- {
+ } else {
sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
}
- if(sbr->bs_header_flag)
+ if (sbr->bs_header_flag)
sbr->just_seeked = 0;
- if(sbr->header_count != 0 && sbr->ret == 0)
+ if (sbr->header_count != 0 && sbr->ret == 0)
{
ret = sbr_save_prev_data(sbr, 0);
- if(ret) return ret;
+ if (ret) return ret;
ret = sbr_save_prev_data(sbr, 1);
- if(ret) return ret;
+ if (ret) return ret;
}
sbr_save_matrix(sbr, 0);
@@ -530,11 +514,11 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha
#ifdef POST_QMF_PRINT
{
int i;
- for(i = 0; i < 2048; i++)
+ for (i = 0; i < 2048; i++)
{
printf("%d\n", left_chan[i]);
}
- for(i = 0; i < 2048; i++)
+ for (i = 0; i < 2048; i++)
{
printf("%d\n", right_chan[i]);
}
@@ -551,50 +535,46 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
uint8_t ret = 0;
ALIGN qmf_t X[MAX_NTSR][64];
- if(sbr == NULL)
+ if (sbr == NULL)
return 20;
/* case can occur due to bit errors */
- if(sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
+ if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
return 21;
- if(sbr->ret || (sbr->header_count == 0))
+ if (sbr->ret || (sbr->header_count == 0))
{
/* don't process just upsample */
dont_process = 1;
/* Re-activate reset for next frame */
- if(sbr->ret && sbr->Reset)
+ if (sbr->ret && sbr->Reset)
sbr->bs_start_freq_prev = -1;
}
- if(just_seeked)
+ if (just_seeked)
{
sbr->just_seeked = 1;
- }
- else
- {
+ } else {
sbr->just_seeked = 0;
}
sbr->ret += sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR);
/* subband synthesis */
- if(downSampledSBR)
+ if (downSampledSBR)
{
sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel);
- }
- else
- {
+ } else {
sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
}
- if(sbr->bs_header_flag)
+ if (sbr->bs_header_flag)
sbr->just_seeked = 0;
- if(sbr->header_count != 0 && sbr->ret == 0)
+ if (sbr->header_count != 0 && sbr->ret == 0)
{
ret = sbr_save_prev_data(sbr, 0);
- if(ret) return ret;
+ if (ret) return ret;
}
sbr_save_matrix(sbr, 0);
@@ -605,7 +585,7 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
#ifdef POST_QMF_PRINT
{
int i;
- for(i = 0; i < 2048; i++)
+ for (i = 0; i < 2048; i++)
{
printf("%d\n", channel[i]);
}
@@ -625,43 +605,41 @@ uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *righ
ALIGN qmf_t X_left[38][64] = {{0}};
ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
- if(sbr == NULL)
+ if (sbr == NULL)
return 20;
/* case can occur due to bit errors */
- if(sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
+ if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
return 21;
- if(sbr->ret || (sbr->header_count == 0))
+ if (sbr->ret || (sbr->header_count == 0))
{
/* don't process just upsample */
dont_process = 1;
/* Re-activate reset for next frame */
- if(sbr->ret && sbr->Reset)
+ if (sbr->ret && sbr->Reset)
sbr->bs_start_freq_prev = -1;
}
- if(just_seeked)
+ if (just_seeked)
{
sbr->just_seeked = 1;
- }
- else
- {
+ } else {
sbr->just_seeked = 0;
}
- if(sbr->qmfs[1] == NULL)
+ if (sbr->qmfs[1] == NULL)
{
- sbr->qmfs[1] = qmfs_init((downSampledSBR) ? 32 : 64);
+ sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
}
sbr->ret += sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR);
/* copy some extra data for PS */
- for(l = sbr->numTimeSlotsRate; l < sbr->numTimeSlotsRate + 6; l++)
+ for (l = sbr->numTimeSlotsRate; l < sbr->numTimeSlotsRate + 6; l++)
{
- for(k = 0; k < 5; k++)
+ for (k = 0; k < 5; k++)
{
QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
@@ -670,12 +648,10 @@ uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *righ
/* perform parametric stereo */
#ifdef DRM_PS
- if(sbr->Is_DRM_SBR)
+ if (sbr->Is_DRM_SBR)
{
drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), X_left, X_right);
- }
- else
- {
+ } else {
#endif
#ifdef PS_DEC
ps_decode(sbr->ps, X_left, X_right);
@@ -685,24 +661,22 @@ uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *righ
#endif
/* subband synthesis */
- if(downSampledSBR)
+ if (downSampledSBR)
{
sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel);
sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel);
- }
- else
- {
+ } else {
sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
}
- if(sbr->bs_header_flag)
+ if (sbr->bs_header_flag)
sbr->just_seeked = 0;
- if(sbr->header_count != 0 && sbr->ret == 0)
+ if (sbr->header_count != 0 && sbr->ret == 0)
{
ret = sbr_save_prev_data(sbr, 0);
- if(ret) return ret;
+ if (ret) return ret;
}
sbr_save_matrix(sbr, 0);
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.h
index 95e00103e..40c1d5388 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_dec.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -42,210 +42,208 @@ extern "C" {
#include "drm_dec.h"
#endif
- /* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
+/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
#define MAX_NTSRHFG 40
#define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
- /* MAX_M: maximum value for M */
+/* MAX_M: maximum value for M */
#define MAX_M 49
- /* MAX_L_E: maximum value for L_E */
+/* MAX_L_E: maximum value for L_E */
#define MAX_L_E 5
- typedef struct
- {
- real_t *x;
- int16_t x_index;
- uint8_t channels;
- } qmfa_info;
-
- typedef struct
- {
- real_t *v;
- int16_t v_index;
- uint8_t channels;
- } qmfs_info;
-
- typedef struct
- {
- uint32_t sample_rate;
- uint32_t maxAACLine;
-
- uint8_t rate;
- uint8_t just_seeked;
- uint8_t ret;
-
- uint8_t amp_res[2];
-
- uint8_t k0;
- uint8_t kx;
- uint8_t M;
- uint8_t N_master;
- uint8_t N_high;
- uint8_t N_low;
- uint8_t N_Q;
- uint8_t N_L[4];
- uint8_t n[2];
-
- uint8_t f_master[64];
- uint8_t f_table_res[2][64];
- uint8_t f_table_noise[64];
- uint8_t f_table_lim[4][64];
+typedef struct {
+ real_t *x;
+ int16_t x_index;
+ uint8_t channels;
+} qmfa_info;
+
+typedef struct {
+ real_t *v;
+ int16_t v_index;
+ uint8_t channels;
+} qmfs_info;
+
+typedef struct
+{
+ uint32_t sample_rate;
+ uint32_t maxAACLine;
+
+ uint8_t rate;
+ uint8_t just_seeked;
+ uint8_t ret;
+
+ uint8_t amp_res[2];
+
+ uint8_t k0;
+ uint8_t kx;
+ uint8_t M;
+ uint8_t N_master;
+ uint8_t N_high;
+ uint8_t N_low;
+ uint8_t N_Q;
+ uint8_t N_L[4];
+ uint8_t n[2];
+
+ uint8_t f_master[64];
+ uint8_t f_table_res[2][64];
+ uint8_t f_table_noise[64];
+ uint8_t f_table_lim[4][64];
#ifdef SBR_LOW_POWER
- uint8_t f_group[5][64];
- uint8_t N_G[5];
+ uint8_t f_group[5][64];
+ uint8_t N_G[5];
#endif
- uint8_t table_map_k_to_g[64];
+ uint8_t table_map_k_to_g[64];
- uint8_t abs_bord_lead[2];
- uint8_t abs_bord_trail[2];
- uint8_t n_rel_lead[2];
- uint8_t n_rel_trail[2];
+ uint8_t abs_bord_lead[2];
+ uint8_t abs_bord_trail[2];
+ uint8_t n_rel_lead[2];
+ uint8_t n_rel_trail[2];
- uint8_t L_E[2];
- uint8_t L_E_prev[2];
- uint8_t L_Q[2];
+ uint8_t L_E[2];
+ uint8_t L_E_prev[2];
+ uint8_t L_Q[2];
- uint8_t t_E[2][MAX_L_E+1];
- uint8_t t_Q[2][3];
- uint8_t f[2][MAX_L_E+1];
- uint8_t f_prev[2];
+ uint8_t t_E[2][MAX_L_E+1];
+ uint8_t t_Q[2][3];
+ uint8_t f[2][MAX_L_E+1];
+ uint8_t f_prev[2];
- real_t *G_temp_prev[2][5];
- real_t *Q_temp_prev[2][5];
- int8_t GQ_ringbuf_index[2];
+ real_t *G_temp_prev[2][5];
+ real_t *Q_temp_prev[2][5];
+ int8_t GQ_ringbuf_index[2];
- int16_t E[2][64][MAX_L_E];
- int16_t E_prev[2][64];
+ int16_t E[2][64][MAX_L_E];
+ int16_t E_prev[2][64];
#ifndef FIXED_POINT
- real_t E_orig[2][64][MAX_L_E];
+ real_t E_orig[2][64][MAX_L_E];
#endif
- real_t E_curr[2][64][MAX_L_E];
- int32_t Q[2][64][2];
+ real_t E_curr[2][64][MAX_L_E];
+ int32_t Q[2][64][2];
#ifndef FIXED_POINT
- real_t Q_div[2][64][2];
- real_t Q_div2[2][64][2];
+ real_t Q_div[2][64][2];
+ real_t Q_div2[2][64][2];
#endif
- int32_t Q_prev[2][64];
+ int32_t Q_prev[2][64];
- int8_t l_A[2];
- int8_t l_A_prev[2];
+ int8_t l_A[2];
+ int8_t l_A_prev[2];
- uint8_t bs_invf_mode[2][MAX_L_E];
- uint8_t bs_invf_mode_prev[2][MAX_L_E];
- real_t bwArray[2][64];
- real_t bwArray_prev[2][64];
+ uint8_t bs_invf_mode[2][MAX_L_E];
+ uint8_t bs_invf_mode_prev[2][MAX_L_E];
+ real_t bwArray[2][64];
+ real_t bwArray_prev[2][64];
- uint8_t noPatches;
- uint8_t patchNoSubbands[64];
- uint8_t patchStartSubband[64];
+ uint8_t noPatches;
+ uint8_t patchNoSubbands[64];
+ uint8_t patchStartSubband[64];
- uint8_t bs_add_harmonic[2][64];
- uint8_t bs_add_harmonic_prev[2][64];
+ uint8_t bs_add_harmonic[2][64];
+ uint8_t bs_add_harmonic_prev[2][64];
- uint16_t index_noise_prev[2];
- uint8_t psi_is_prev[2];
+ uint16_t index_noise_prev[2];
+ uint8_t psi_is_prev[2];
- uint8_t bs_start_freq_prev;
- uint8_t bs_stop_freq_prev;
- uint8_t bs_xover_band_prev;
- uint8_t bs_freq_scale_prev;
- uint8_t bs_alter_scale_prev;
- uint8_t bs_noise_bands_prev;
+ uint8_t bs_start_freq_prev;
+ uint8_t bs_stop_freq_prev;
+ uint8_t bs_xover_band_prev;
+ uint8_t bs_freq_scale_prev;
+ uint8_t bs_alter_scale_prev;
+ uint8_t bs_noise_bands_prev;
- int8_t prevEnvIsShort[2];
+ int8_t prevEnvIsShort[2];
- int8_t kx_prev;
- uint8_t bsco;
- uint8_t bsco_prev;
- uint8_t M_prev;
- uint16_t frame_len;
+ int8_t kx_prev;
+ uint8_t bsco;
+ uint8_t bsco_prev;
+ uint8_t M_prev;
+ uint16_t frame_len;
- uint8_t Reset;
- uint32_t frame;
- uint32_t header_count;
+ uint8_t Reset;
+ uint32_t frame;
+ uint32_t header_count;
- uint8_t id_aac;
- qmfa_info *qmfa[2];
- qmfs_info *qmfs[2];
+ uint8_t id_aac;
+ qmfa_info *qmfa[2];
+ qmfs_info *qmfs[2];
- qmf_t Xsbr[2][MAX_NTSRHFG][64];
+ qmf_t Xsbr[2][MAX_NTSRHFG][64];
#ifdef DRM
- uint8_t Is_DRM_SBR;
+ uint8_t Is_DRM_SBR;
#ifdef DRM_PS
- drm_ps_info *drm_ps;
+ drm_ps_info *drm_ps;
#endif
#endif
- uint8_t numTimeSlotsRate;
- uint8_t numTimeSlots;
- uint8_t tHFGen;
- uint8_t tHFAdj;
+ uint8_t numTimeSlotsRate;
+ uint8_t numTimeSlots;
+ uint8_t tHFGen;
+ uint8_t tHFAdj;
#ifdef PS_DEC
- ps_info *ps;
+ ps_info *ps;
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
- uint8_t ps_used;
- uint8_t psResetFlag;
+ uint8_t ps_used;
+ uint8_t psResetFlag;
#endif
- /* to get it compiling */
- /* we'll see during the coding of all the tools, whether
- these are all used or not.
- */
- uint8_t bs_header_flag;
- uint8_t bs_crc_flag;
- uint16_t bs_sbr_crc_bits;
- uint8_t bs_protocol_version;
- uint8_t bs_amp_res;
- uint8_t bs_start_freq;
- uint8_t bs_stop_freq;
- uint8_t bs_xover_band;
- uint8_t bs_freq_scale;
- uint8_t bs_alter_scale;
- uint8_t bs_noise_bands;
- uint8_t bs_limiter_bands;
- uint8_t bs_limiter_gains;
- uint8_t bs_interpol_freq;
- uint8_t bs_smoothing_mode;
- uint8_t bs_samplerate_mode;
- uint8_t bs_add_harmonic_flag[2];
- uint8_t bs_add_harmonic_flag_prev[2];
- uint8_t bs_extended_data;
- uint8_t bs_extension_id;
- uint8_t bs_extension_data;
- uint8_t bs_coupling;
- uint8_t bs_frame_class[2];
- uint8_t bs_rel_bord[2][9];
- uint8_t bs_rel_bord_0[2][9];
- uint8_t bs_rel_bord_1[2][9];
- uint8_t bs_pointer[2];
- uint8_t bs_abs_bord_0[2];
- uint8_t bs_abs_bord_1[2];
- uint8_t bs_num_rel_0[2];
- uint8_t bs_num_rel_1[2];
- uint8_t bs_df_env[2][9];
- uint8_t bs_df_noise[2][3];
- } sbr_info;
-
- sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
- uint32_t sample_rate, uint8_t downSampledSBR
+ /* to get it compiling */
+ /* we'll see during the coding of all the tools, whether
+ these are all used or not.
+ */
+ uint8_t bs_header_flag;
+ uint8_t bs_crc_flag;
+ uint16_t bs_sbr_crc_bits;
+ uint8_t bs_protocol_version;
+ uint8_t bs_amp_res;
+ uint8_t bs_start_freq;
+ uint8_t bs_stop_freq;
+ uint8_t bs_xover_band;
+ uint8_t bs_freq_scale;
+ uint8_t bs_alter_scale;
+ uint8_t bs_noise_bands;
+ uint8_t bs_limiter_bands;
+ uint8_t bs_limiter_gains;
+ uint8_t bs_interpol_freq;
+ uint8_t bs_smoothing_mode;
+ uint8_t bs_samplerate_mode;
+ uint8_t bs_add_harmonic_flag[2];
+ uint8_t bs_add_harmonic_flag_prev[2];
+ uint8_t bs_extended_data;
+ uint8_t bs_extension_id;
+ uint8_t bs_extension_data;
+ uint8_t bs_coupling;
+ uint8_t bs_frame_class[2];
+ uint8_t bs_rel_bord[2][9];
+ uint8_t bs_rel_bord_0[2][9];
+ uint8_t bs_rel_bord_1[2][9];
+ uint8_t bs_pointer[2];
+ uint8_t bs_abs_bord_0[2];
+ uint8_t bs_abs_bord_1[2];
+ uint8_t bs_num_rel_0[2];
+ uint8_t bs_num_rel_1[2];
+ uint8_t bs_df_env[2][9];
+ uint8_t bs_df_noise[2][3];
+} sbr_info;
+
+sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
+ uint32_t sample_rate, uint8_t downSampledSBR
#ifdef DRM
- , uint8_t IsDRM
+ , uint8_t IsDRM
#endif
- );
- void sbrDecodeEnd(sbr_info *sbr);
- void sbrReset(sbr_info *sbr);
-
- uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
- const uint8_t just_seeked, const uint8_t downSampledSBR);
- uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
- const uint8_t just_seeked, const uint8_t downSampledSBR);
+ );
+void sbrDecodeEnd(sbr_info *sbr);
+void sbrReset(sbr_info *sbr);
+
+uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
+ const uint8_t just_seeked, const uint8_t downSampledSBR);
+uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
+ const uint8_t just_seeked, const uint8_t downSampledSBR);
#if (defined(PS_DEC) || defined(DRM_PS))
- uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
- const uint8_t just_seeked, const uint8_t downSampledSBR);
+uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
+ const uint8_t just_seeked, const uint8_t downSampledSBR);
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.c
index 91db2163b..2181dffeb 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -42,29 +42,27 @@ void extract_envelope_data(sbr_info *sbr, uint8_t ch)
{
uint8_t l, k;
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
- if(sbr->bs_df_env[ch][l] == 0)
+ if (sbr->bs_df_env[ch][l] == 0)
{
- for(k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
+ for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
{
sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
- if(sbr->E[ch][k][l] < 0)
+ if (sbr->E[ch][k][l] < 0)
sbr->E[ch][k][l] = 0;
}
- }
- else /* bs_df_env == 1 */
- {
+ } else { /* bs_df_env == 1 */
uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
int16_t E_prev;
- if(sbr->f[ch][l] == g)
+ if (sbr->f[ch][l] == g)
{
- for(k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
- if(l == 0)
+ if (l == 0)
E_prev = sbr->E_prev[ch][k];
else
E_prev = sbr->E[ch][k][l - 1];
@@ -72,18 +70,16 @@ void extract_envelope_data(sbr_info *sbr, uint8_t ch)
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
- }
- else if((g == 1) && (sbr->f[ch][l] == 0))
- {
+ } else if ((g == 1) && (sbr->f[ch][l] == 0)) {
uint8_t i;
- for(k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
- for(i = 0; i < sbr->N_high; i++)
+ for (i = 0; i < sbr->N_high; i++)
{
- if(sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
+ if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
{
- if(l == 0)
+ if (l == 0)
E_prev = sbr->E_prev[ch][i];
else
E_prev = sbr->E[ch][i][l - 1];
@@ -93,19 +89,17 @@ void extract_envelope_data(sbr_info *sbr, uint8_t ch)
}
}
- }
- else if((g == 0) && (sbr->f[ch][l] == 1))
- {
+ } else if ((g == 0) && (sbr->f[ch][l] == 1)) {
uint8_t i;
- for(k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
- for(i = 0; i < sbr->N_low; i++)
+ for (i = 0; i < sbr->N_low; i++)
{
- if((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
- (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
+ if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
+ (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
{
- if(l == 0)
+ if (l == 0)
E_prev = sbr->E_prev[ch][i];
else
E_prev = sbr->E[ch][i][l - 1];
@@ -123,27 +117,23 @@ void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
{
uint8_t l, k;
- for(l = 0; l < sbr->L_Q[ch]; l++)
+ for (l = 0; l < sbr->L_Q[ch]; l++)
{
- if(sbr->bs_df_noise[ch][l] == 0)
+ if (sbr->bs_df_noise[ch][l] == 0)
{
- for(k = 1; k < sbr->N_Q; k++)
+ for (k = 1; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l];
}
- }
- else
- {
- if(l == 0)
+ } else {
+ if (l == 0)
{
- for(k = 0; k < sbr->N_Q; k++)
+ for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
}
- }
- else
- {
- for(k = 0; k < sbr->N_Q; k++)
+ } else {
+ for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l];
}
@@ -155,8 +145,7 @@ void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
#ifndef FIXED_POINT
/* table for Q_div values when no coupling */
-static const real_t Q_div_tab[31] =
-{
+static const real_t Q_div_tab[31] = {
FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
FRAC_CONST(0.2), FRAC_CONST(0.333333),
@@ -175,8 +164,7 @@ static const real_t Q_div_tab[31] =
FRAC_CONST(1)
};
-static const real_t Q_div_tab_left[31][13] =
-{
+static const real_t Q_div_tab_left[31][13] = {
{ FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) },
{ FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) },
{ FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) },
@@ -210,8 +198,7 @@ static const real_t Q_div_tab_left[31][13] =
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
};
-static const real_t Q_div_tab_right[31][13] =
-{
+static const real_t Q_div_tab_right[31][13] = {
{ FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) },
{ FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) },
{ FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) },
@@ -249,44 +236,35 @@ static const real_t Q_div_tab_right[31][13] =
/* [0..1] */
static real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
{
- if(sbr->bs_coupling)
+ if (sbr->bs_coupling)
{
/* left channel */
- if((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
- (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+ if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+ (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
{
return 0;
- }
- else
- {
+ } else {
/* the pan parameter is always even */
- if(ch == 0)
+ if (ch == 0)
{
return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
- }
- else
- {
+ } else {
return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
}
}
- }
- else
- {
+ } else {
/* no coupling */
- if(sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+ if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
{
return 0;
- }
- else
- {
+ } else {
return Q_div_tab[sbr->Q[ch][m][l]];
}
}
}
/* table for Q_div2 values when no coupling */
-static const real_t Q_div2_tab[31] =
-{
+static const real_t Q_div2_tab[31] = {
FRAC_CONST(0.984615), FRAC_CONST(0.969697),
FRAC_CONST(0.941176), FRAC_CONST(0.888889),
FRAC_CONST(0.8), FRAC_CONST(0.666667),
@@ -305,8 +283,7 @@ static const real_t Q_div2_tab[31] =
FRAC_CONST(5.96046E-008)
};
-static const real_t Q_div2_tab_left[31][13] =
-{
+static const real_t Q_div2_tab_left[31][13] = {
{ FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) },
{ FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) },
{ FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) },
@@ -340,8 +317,7 @@ static const real_t Q_div2_tab_left[31][13] =
{ FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) }
};
-static const real_t Q_div2_tab_right[31][13] =
-{
+static const real_t Q_div2_tab_right[31][13] = {
{ FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) },
{ FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) },
{ FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) },
@@ -379,42 +355,33 @@ static const real_t Q_div2_tab_right[31][13] =
/* [0..1] */
static real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
{
- if(sbr->bs_coupling)
+ if (sbr->bs_coupling)
{
- if((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
- (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+ if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+ (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
{
return 0;
- }
- else
- {
+ } else {
/* the pan parameter is always even */
- if(ch == 0)
+ if (ch == 0)
{
return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
- }
- else
- {
+ } else {
return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
}
}
- }
- else
- {
+ } else {
/* no coupling */
- if(sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+ if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
{
return 0;
- }
- else
- {
+ } else {
return Q_div2_tab[sbr->Q[ch][m][l]];
}
}
}
-static const real_t E_deq_tab[64] =
-{
+static const real_t E_deq_tab[64] = {
64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f,
16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f,
4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f,
@@ -427,15 +394,15 @@ static const real_t E_deq_tab[64] =
void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
{
- if(sbr->bs_coupling == 0)
+ if (sbr->bs_coupling == 0)
{
int16_t exp;
uint8_t l, k;
uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
- for(k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
/* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed)
* since this is a energy value: (x/32)^2 = (x^2)/1024
@@ -443,16 +410,14 @@ void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
/* exp = (sbr->E[ch][k][l] >> amp) + 6; */
exp = (sbr->E[ch][k][l] >> amp);
- if((exp < 0) || (exp >= 64))
+ if ((exp < 0) || (exp >= 64))
{
sbr->E_orig[ch][k][l] = 0;
- }
- else
- {
+ } else {
sbr->E_orig[ch][k][l] = E_deq_tab[exp];
/* save half the table size at the cost of 1 multiply */
- if(amp && (sbr->E[ch][k][l] & 1))
+ if (amp && (sbr->E[ch][k][l] & 1))
{
sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562));
}
@@ -460,9 +425,9 @@ void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
}
}
- for(l = 0; l < sbr->L_Q[ch]; l++)
+ for (l = 0; l < sbr->L_Q[ch]; l++)
{
- for(k = 0; k < sbr->N_Q; k++)
+ for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l);
sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l);
@@ -471,8 +436,7 @@ void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
}
}
-static const real_t E_pan_tab[25] =
-{
+static const real_t E_pan_tab[25] = {
FRAC_CONST(0.000244081), FRAC_CONST(0.000488043),
FRAC_CONST(0.00097561), FRAC_CONST(0.00194932),
FRAC_CONST(0.00389105), FRAC_CONST(0.00775194),
@@ -496,9 +460,9 @@ void unmap_envelope_noise(sbr_info *sbr)
uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
- for(l = 0; l < sbr->L_E[0]; l++)
+ for (l = 0; l < sbr->L_E[0]; l++)
{
- for(k = 0; k < sbr->n[sbr->f[0][l]]; k++)
+ for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
{
/* +6: * 64 ; +1: * 2 ; */
exp0 = (sbr->E[0][k][l] >> amp0) + 1;
@@ -510,16 +474,14 @@ void unmap_envelope_noise(sbr_info *sbr)
/* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */
exp1 = (sbr->E[1][k][l] >> amp1);
- if((exp0 < 0) || (exp0 >= 64) ||
- (exp1 < 0) || (exp1 > 24))
+ if ((exp0 < 0) || (exp0 >= 64) ||
+ (exp1 < 0) || (exp1 > 24))
{
sbr->E_orig[1][k][l] = 0;
sbr->E_orig[0][k][l] = 0;
- }
- else
- {
+ } else {
tmp = E_deq_tab[exp0];
- if(amp0 && (sbr->E[0][k][l] & 1))
+ if (amp0 && (sbr->E[0][k][l] & 1))
{
tmp = MUL_C(tmp, COEF_CONST(1.414213562));
}
@@ -531,9 +493,9 @@ void unmap_envelope_noise(sbr_info *sbr)
}
}
- for(l = 0; l < sbr->L_Q[0]; l++)
+ for (l = 0; l < sbr->L_Q[0]; l++)
{
- for(k = 0; k < sbr->N_Q; k++)
+ for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l);
sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l);
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.h
index 21115c616..59017a906 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_e_nf.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,11 +36,11 @@ extern "C" {
#endif
- void extract_envelope_data(sbr_info *sbr, uint8_t ch);
- void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
+void extract_envelope_data(sbr_info *sbr, uint8_t ch);
+void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
#ifndef FIXED_POINT
- void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
- void unmap_envelope_noise(sbr_info *sbr);
+void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
+void unmap_envelope_noise(sbr_info *sbr);
#endif
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.c
index 70c01f5db..5919c7b56 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -47,16 +47,13 @@ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
/* calculate the start QMF channel for the master frequency band table */
/* parameter is also called k0 */
uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
- uint32_t sample_rate)
+ uint32_t sample_rate)
{
static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16,
- 17, 24, 32, 35, 48
- };
+ 17, 24, 32, 35, 48 };
static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0,
- 6, 6, 6
- };
- static const int8_t offset[7][16] =
- {
+ 6, 6, 6 };
+ static const int8_t offset[7][16] = {
{ -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 },
{ -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 },
{ -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
@@ -69,26 +66,22 @@ uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)];
#if 0 /* replaced with table (startMinTable) */
- if(sample_rate >= 64000)
- {
- startMin = (uint8_t)((5000.*128.) / (float)sample_rate + 0.5);
- }
- else if(sample_rate < 32000)
- {
- startMin = (uint8_t)((3000.*128.) / (float)sample_rate + 0.5);
- }
- else
+ if (sample_rate >= 64000)
{
- startMin = (uint8_t)((4000.*128.) / (float)sample_rate + 0.5);
+ startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5);
+ } else if (sample_rate < 32000) {
+ startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5);
+ } else {
+ startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5);
}
#endif
- if(bs_samplerate_mode)
+ if (bs_samplerate_mode)
{
return startMin + offset[offsetIndex][bs_start_freq];
-#if 0 /* replaced by offsetIndexTable */
- switch(sample_rate)
+#if 0 /* replaced by offsetIndexTable */
+ switch (sample_rate)
{
case 16000:
return startMin + offset[0][bs_start_freq];
@@ -99,19 +92,15 @@ uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
case 32000:
return startMin + offset[3][bs_start_freq];
default:
- if(sample_rate > 64000)
+ if (sample_rate > 64000)
{
return startMin + offset[5][bs_start_freq];
- }
- else /* 44100 <= sample_rate <= 64000 */
- {
+ } else { /* 44100 <= sample_rate <= 64000 */
return startMin + offset[4][bs_start_freq];
}
}
#endif
- }
- else
- {
+ } else {
return startMin + offset[6][bs_start_freq];
}
}
@@ -124,23 +113,17 @@ static int longcmp(const void *a, const void *b)
/* calculate the stop QMF channel for the master frequency band table */
/* parameter is also called k2 */
uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
- uint8_t k0)
+ uint8_t k0)
{
- if(bs_stop_freq == 15)
+ if (bs_stop_freq == 15)
{
return min(64, k0 * 3);
- }
- else if(bs_stop_freq == 14)
- {
+ } else if (bs_stop_freq == 14) {
return min(64, k0 * 2);
- }
- else
- {
+ } else {
static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23,
- 32, 32, 35, 48, 64, 70, 96
- };
- static const int8_t offset[12][14] =
- {
+ 32, 32, 35, 48, 64, 70, 96 };
+ static const int8_t offset[12][14] = {
{ 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 },
{ 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 },
{ 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 },
@@ -161,27 +144,23 @@ uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)];
#if 0 /* replaced by table lookup */
- if(sample_rate >= 64000)
- {
- stopMin = (uint8_t)((10000.*128.) / (float)sample_rate + 0.5);
- }
- else if(sample_rate < 32000)
+ if (sample_rate >= 64000)
{
- stopMin = (uint8_t)((6000.*128.) / (float)sample_rate + 0.5);
- }
- else
- {
- stopMin = (uint8_t)((8000.*128.) / (float)sample_rate + 0.5);
+ stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5);
+ } else if (sample_rate < 32000) {
+ stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5);
+ } else {
+ stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5);
}
#endif
#if 0 /* replaced by table lookup */
/* diverging power series */
- for(i = 0; i <= 13; i++)
+ for (i = 0; i <= 13; i++)
{
- stopDk_t[i] = (int32_t)(stopMin * pow(64.0 / stopMin, i / 13.0) + 0.5);
+ stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5);
}
- for(i = 0; i < 13; i++)
+ for (i = 0; i < 13; i++)
{
stopDk[i] = stopDk_t[i+1] - stopDk_t[i];
}
@@ -190,7 +169,7 @@ uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
qsort(stopDk, 13, sizeof(stopDk[0]), longcmp);
k2 = stopMin;
- for(i = 0; i < bs_stop_freq; i++)
+ for (i = 0; i < bs_stop_freq; i++)
{
k2 += stopDk[i];
}
@@ -218,7 +197,7 @@ uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
int32_t k2Diff, vDk[64] = {0};
/* mft only defined for k2 > k0 */
- if(k2 <= k0)
+ if (k2 <= k0)
{
sbr->N_master = 0;
return 1;
@@ -227,32 +206,30 @@ uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
dk = bs_alter_scale ? 2 : 1;
#if 0 /* replaced by float-less design */
- nrBands = 2 * (int32_t)((float)(k2 - k0) / (dk * 2) + (-1 + dk) / 2.0f);
+ nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f);
#else
- if(bs_alter_scale)
- {
- nrBands = (((k2 - k0 + 2) >> 2) << 1);
- }
- else
+ if (bs_alter_scale)
{
- nrBands = (((k2 - k0) >> 1) << 1);
+ nrBands = (((k2-k0+2)>>2)<<1);
+ } else {
+ nrBands = (((k2-k0)>>1)<<1);
}
#endif
nrBands = min(nrBands, 63);
- if(nrBands <= 0)
+ if (nrBands <= 0)
return 1;
k2Achieved = k0 + nrBands * dk;
k2Diff = k2 - k2Achieved;
- for(k = 0; k < nrBands; k++)
+ for (k = 0; k < nrBands; k++)
vDk[k] = dk;
- if(k2Diff)
+ if (k2Diff)
{
incr = (k2Diff > 0) ? -1 : 1;
- k = (uint8_t)((k2Diff > 0) ? (nrBands - 1) : 0);
+ k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0);
- while(k2Diff != 0)
+ while (k2Diff != 0)
{
vDk[k] -= incr;
k += incr;
@@ -261,7 +238,7 @@ uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
}
sbr->f_master[0] = k0;
- for(k = 1; k <= nrBands; k++)
+ for (k = 1; k <= nrBands; k++)
sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]);
sbr->N_master = (uint8_t)nrBands;
@@ -269,7 +246,7 @@ uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
#if 0
printf("f_master[%d]: ", nrBands);
- for(k = 0; k <= nrBands; k++)
+ for (k = 0; k <= nrBands; k++)
{
printf("%d ", sbr->f_master[k]);
}
@@ -287,8 +264,7 @@ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1)
{
#ifdef FIXED_POINT
/* table with log2() values */
- static const real_t log2Table[65] =
- {
+ static const real_t log2Table[65] = {
COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007),
COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221),
COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186),
@@ -311,18 +287,18 @@ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1)
real_t r1 = log2Table[a1]; /* coef */
real_t r2 = (r1 - r0); /* coef */
- if(warp)
- r2 = MUL_C(r2, COEF_CONST(1.0 / 1.3));
+ if (warp)
+ r2 = MUL_C(r2, COEF_CONST(1.0/1.3));
/* convert r2 to real and then multiply and round */
- r2 = (r2 >> (COEF_BITS - REAL_BITS)) * bands + (1 << (REAL_BITS - 1));
+ r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1));
return (r2 >> REAL_BITS);
#else
real_t div = (real_t)log(2.0);
- if(warp) div *= (real_t)1.3;
+ if (warp) div *= (real_t)1.3;
- return (int32_t)(bands * log((float)a1 / (float)a0) / div + 0.5);
+ return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5);
#endif
}
@@ -330,8 +306,7 @@ static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1)
{
#ifdef FIXED_POINT
/* table with log() values */
- static const real_t logTable[65] =
- {
+ static const real_t logTable[65] = {
COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887),
COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491),
COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728),
@@ -354,18 +329,18 @@ static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1)
/* a polynomial around x=1 is more precise, as most values are around 1.07,
but this is just fine already */
static const real_t c1 = COEF_CONST(1.0);
- static const real_t c2 = COEF_CONST(1.0 / 2.0);
- static const real_t c3 = COEF_CONST(1.0 / 6.0);
- static const real_t c4 = COEF_CONST(1.0 / 24.0);
+ static const real_t c2 = COEF_CONST(1.0/2.0);
+ static const real_t c3 = COEF_CONST(1.0/6.0);
+ static const real_t c4 = COEF_CONST(1.0/24.0);
real_t r0 = logTable[a0]; /* coef */
real_t r1 = logTable[a1]; /* coef */
real_t r2 = (r1 - r0) / bands; /* coef */
- real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4, r2)), r2)), r2)), r2);
+ real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2);
- return (rexp >> (COEF_BITS - REAL_BITS)); /* real */
+ return (rexp >> (COEF_BITS-REAL_BITS)); /* real */
#else
- return (real_t)pow((real_t)a1 / (real_t)a0, 1.0 / (real_t)bands);
+ return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands);
#endif
}
@@ -388,7 +363,7 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
#endif
/* mft only defined for k2 > k0 */
- if(k2 <= k0)
+ if (k2 <= k0)
{
sbr->N_master = 0;
return 1;
@@ -399,23 +374,21 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
#ifdef FIXED_POINT
rk0 = (real_t)k0 << REAL_BITS;
rk2 = (real_t)k2 << REAL_BITS;
- if(rk2 > MUL_C(rk0, COEF_CONST(2.2449)))
+ if (rk2 > MUL_C(rk0, COEF_CONST(2.2449)))
#else
- if((float)k2 / (float)k0 > 2.2449)
+ if ((float)k2/(float)k0 > 2.2449)
#endif
{
twoRegions = 1;
k1 = k0 << 1;
- }
- else
- {
+ } else {
twoRegions = 0;
k1 = k2;
}
nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1));
nrBand0 = min(nrBand0, 63);
- if(nrBand0 <= 0)
+ if (nrBand0 <= 0)
return 1;
q = find_initial_power(nrBand0, k0, k1);
@@ -427,11 +400,11 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
qk = REAL_CONST(k0);
A_1 = (int32_t)(qk + .5);
#endif
- for(k = 0; k <= nrBand0; k++)
+ for (k = 0; k <= nrBand0; k++)
{
int32_t A_0 = A_1;
#ifdef FIXED_POINT
- qk = MUL_R(qk, q);
+ qk = MUL_R(qk,q);
A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
#else
qk *= q;
@@ -444,16 +417,16 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp);
vk0[0] = k0;
- for(k = 1; k <= nrBand0; k++)
+ for (k = 1; k <= nrBand0; k++)
{
vk0[k] = vk0[k-1] + vDk0[k-1];
- if(vDk0[k-1] == 0)
+ if (vDk0[k-1] == 0)
return 1;
}
- if(!twoRegions)
+ if (!twoRegions)
{
- for(k = 0; k <= nrBand0; k++)
+ for (k = 0; k <= nrBand0; k++)
sbr->f_master[k] = (uint8_t) vk0[k];
sbr->N_master = nrBand0;
@@ -473,11 +446,11 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
qk = REAL_CONST(k1);
A_1 = (int32_t)(qk + .5);
#endif
- for(k = 0; k <= nrBand1 - 1; k++)
+ for (k = 0; k <= nrBand1 - 1; k++)
{
int32_t A_0 = A_1;
#ifdef FIXED_POINT
- qk = MUL_R(qk, q);
+ qk = MUL_R(qk,q);
A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
#else
qk *= q;
@@ -486,7 +459,7 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
vDk1[k] = A_1 - A_0;
}
- if(vDk1[0] < vDk0[nrBand0 - 1])
+ if (vDk1[0] < vDk0[nrBand0 - 1])
{
int32_t change;
@@ -500,27 +473,27 @@ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
/* needed? */
qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp);
vk1[0] = k1;
- for(k = 1; k <= nrBand1; k++)
+ for (k = 1; k <= nrBand1; k++)
{
vk1[k] = vk1[k-1] + vDk1[k-1];
- if(vDk1[k-1] == 0)
+ if (vDk1[k-1] == 0)
return 1;
}
sbr->N_master = nrBand0 + nrBand1;
sbr->N_master = min(sbr->N_master, 64);
- for(k = 0; k <= nrBand0; k++)
+ for (k = 0; k <= nrBand0; k++)
{
- sbr->f_master[k] = (uint8_t) vk0[k];
+ sbr->f_master[k] = (uint8_t) vk0[k];
}
- for(k = nrBand0 + 1; k <= sbr->N_master; k++)
+ for (k = nrBand0 + 1; k <= sbr->N_master; k++)
{
sbr->f_master[k] = (uint8_t) vk1[k - nrBand0];
}
#if 0
printf("f_master[%d]: ", sbr->N_master);
- for(k = 0; k <= sbr->N_master; k++)
+ for (k = 0; k <= sbr->N_master; k++)
{
printf("%d ", sbr->f_master[k]);
}
@@ -538,35 +511,35 @@ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
uint32_t minus;
/* The following relation shall be satisfied: bs_xover_band < N_Master */
- if(sbr->N_master <= bs_xover_band)
+ if (sbr->N_master <= bs_xover_band)
return 1;
sbr->N_high = sbr->N_master - bs_xover_band;
- sbr->N_low = (sbr->N_high >> 1) + (sbr->N_high - ((sbr->N_high >> 1) << 1));
+ sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1));
sbr->n[0] = sbr->N_low;
sbr->n[1] = sbr->N_high;
- for(k = 0; k <= sbr->N_high; k++)
+ for (k = 0; k <= sbr->N_high; k++)
{
sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band];
}
sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0];
sbr->kx = sbr->f_table_res[HI_RES][0];
- if(sbr->kx > 32)
+ if (sbr->kx > 32)
return 1;
- if(sbr->kx + sbr->M > 64)
+ if (sbr->kx + sbr->M > 64)
return 1;
minus = (sbr->N_high & 1) ? 1 : 0;
- for(k = 0; k <= sbr->N_low; k++)
+ for (k = 0; k <= sbr->N_low; k++)
{
- if(k == 0)
+ if (k == 0)
i = 0;
else
- i = (uint8_t)(2 * k - minus);
+ i = (uint8_t)(2*k - minus);
sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
}
@@ -574,7 +547,7 @@ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
printf("f_table_res[HI_RES][%d]: ", sbr->N_high);
- for(k = 0; k <= sbr->N_high; k++)
+ for (k = 0; k <= sbr->N_high; k++)
{
printf("%d ", sbr->f_table_res[HI_RES][k]);
}
@@ -582,7 +555,7 @@ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
#endif
#if 0
printf("f_table_res[LO_RES][%d]: ", sbr->N_low);
- for(k = 0; k <= sbr->N_low; k++)
+ for (k = 0; k <= sbr->N_low; k++)
{
printf("%d ", sbr->f_table_res[LO_RES][k]);
}
@@ -590,42 +563,38 @@ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
#endif
sbr->N_Q = 0;
- if(sbr->bs_noise_bands == 0)
+ if (sbr->bs_noise_bands == 0)
{
sbr->N_Q = 1;
- }
- else
- {
+ } else {
#if 0
- sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands * (log(k2 / (float)sbr->kx) / log(2.0)) + 0.5));
+ sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
#else
sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2)));
#endif
sbr->N_Q = min(5, sbr->N_Q);
}
- for(k = 0; k <= sbr->N_Q; k++)
+ for (k = 0; k <= sbr->N_Q; k++)
{
- if(k == 0)
+ if (k == 0)
{
i = 0;
- }
- else
- {
+ } else {
/* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */
- i = i + (sbr->N_low - i) / (sbr->N_Q + 1 - k);
+ i = i + (sbr->N_low - i)/(sbr->N_Q + 1 - k);
}
sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i];
}
/* build table for mapping k to g in hf patching */
- for(k = 0; k < 64; k++)
+ for (k = 0; k < 64; k++)
{
uint8_t g;
- for(g = 0; g < sbr->N_Q; g++)
+ for (g = 0; g < sbr->N_Q; g++)
{
- if((sbr->f_table_noise[g] <= k) &&
- (k < sbr->f_table_noise[g+1]))
+ if ((sbr->f_table_noise[g] <= k) &&
+ (k < sbr->f_table_noise[g+1]))
{
sbr->table_map_k_to_g[k] = g;
break;
@@ -635,7 +604,7 @@ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
#if 0
printf("f_table_noise[%d]: ", sbr->N_Q);
- for(k = 0; k <= sbr->N_Q; k++)
+ for (k = 0; k <= sbr->N_Q; k++)
{
printf("%d ", sbr->f_table_noise[k] - sbr->kx);
}
@@ -654,12 +623,10 @@ void limiter_frequency_table(sbr_info *sbr)
{
#if 0
static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
- REAL_CONST(2), REAL_CONST(3)
- };
+ REAL_CONST(2), REAL_CONST(3) };
#else
static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152),
- REAL_CONST(1.185093), REAL_CONST(1.119872)
- };
+ REAL_CONST(1.185093), REAL_CONST(1.119872) };
#endif
uint8_t k, s;
int8_t nrLim;
@@ -673,14 +640,14 @@ void limiter_frequency_table(sbr_info *sbr)
#if 0
printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]);
- for(k = 0; k <= sbr->N_L[0]; k++)
+ for (k = 0; k <= sbr->N_L[0]; k++)
{
printf("%d ", sbr->f_table_lim[0][k]);
}
printf("\n");
#endif
- for(s = 1; s < 4; s++)
+ for (s = 1; s < 4; s++)
{
int32_t limTable[100 /*TODO*/] = {0};
uint8_t patchBorders[64/*??*/] = {0};
@@ -690,16 +657,16 @@ void limiter_frequency_table(sbr_info *sbr)
#endif
patchBorders[0] = sbr->kx;
- for(k = 1; k <= sbr->noPatches; k++)
+ for (k = 1; k <= sbr->noPatches; k++)
{
patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1];
}
- for(k = 0; k <= sbr->N_low; k++)
+ for (k = 0; k <= sbr->N_low; k++)
{
limTable[k] = sbr->f_table_res[LO_RES][k];
}
- for(k = 1; k < sbr->noPatches; k++)
+ for (k = 1; k < sbr->noPatches; k++)
{
limTable[k+sbr->N_low] = patchBorders[k];
}
@@ -709,57 +676,55 @@ void limiter_frequency_table(sbr_info *sbr)
k = 1;
nrLim = sbr->noPatches + sbr->N_low - 1;
- if(nrLim < 0) // TODO: BIG FAT PROBLEM
+ if (nrLim < 0) // TODO: BIG FAT PROBLEM
return;
restart:
- if(k <= nrLim)
+ if (k <= nrLim)
{
real_t nOctaves;
- if(limTable[k-1] != 0)
+ if (limTable[k-1] != 0)
#if 0
- nOctaves = REAL_CONST(log((float)limTable[k] / (float)limTable[k-1]) / log(2.0));
+ nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
#else
#ifdef FIXED_POINT
- nOctaves = DIV_R((limTable[k] << REAL_BITS), REAL_CONST(limTable[k-1]));
+ nOctaves = DIV_R((limTable[k]<<REAL_BITS),REAL_CONST(limTable[k-1]));
#else
- nOctaves = (real_t)limTable[k] / (real_t)limTable[k-1];
+ nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
#endif
#endif
else
nOctaves = 0;
#if 0
- if((MUL_R(nOctaves, limBands)) < REAL_CONST(0.49))
+ if ((MUL_R(nOctaves,limBands)) < REAL_CONST(0.49))
#else
- if(nOctaves < limiterBandsCompare[s - 1])
+ if (nOctaves < limiterBandsCompare[s - 1])
#endif
{
uint8_t i;
- if(limTable[k] != limTable[k-1])
+ if (limTable[k] != limTable[k-1])
{
uint8_t found = 0, found2 = 0;
- for(i = 0; i <= sbr->noPatches; i++)
+ for (i = 0; i <= sbr->noPatches; i++)
{
- if(limTable[k] == patchBorders[i])
+ if (limTable[k] == patchBorders[i])
found = 1;
}
- if(found)
+ if (found)
{
found2 = 0;
- for(i = 0; i <= sbr->noPatches; i++)
+ for (i = 0; i <= sbr->noPatches; i++)
{
- if(limTable[k-1] == patchBorders[i])
+ if (limTable[k-1] == patchBorders[i])
found2 = 1;
}
- if(found2)
+ if (found2)
{
k++;
goto restart;
- }
- else
- {
+ } else {
/* remove (k-1)th element */
limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low];
qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
@@ -773,23 +738,21 @@ restart:
qsort(limTable, nrLim, sizeof(limTable[0]), longcmp);
nrLim--;
goto restart;
- }
- else
- {
+ } else {
k++;
goto restart;
}
}
sbr->N_L[s] = nrLim;
- for(k = 0; k <= nrLim; k++)
+ for (k = 0; k <= nrLim; k++)
{
sbr->f_table_lim[s][k] = limTable[k] - sbr->kx;
}
#if 0
printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]);
- for(k = 0; k <= sbr->N_L[s]; k++)
+ for (k = 0; k <= sbr->N_L[s]; k++)
{
printf("%d ", sbr->f_table_lim[s][k]);
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.h
index ca57985b9..d24a25e27 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_fbt.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,17 +35,17 @@
extern "C" {
#endif
- uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
- uint32_t sample_rate);
- uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
- uint8_t k0);
- uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
- uint8_t bs_alter_scale);
- uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
- uint8_t bs_freq_scale, uint8_t bs_alter_scale);
- uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
- uint8_t k2);
- void limiter_frequency_table(sbr_info *sbr);
+uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+ uint32_t sample_rate);
+uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+ uint8_t k0);
+uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_alter_scale);
+uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_freq_scale, uint8_t bs_alter_scale);
+uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+ uint8_t k2);
+void limiter_frequency_table(sbr_info *sbr);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.c
index 1b9c6c4b8..3f310b819 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -43,7 +43,7 @@
/* static function declarations */
static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
- qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
#ifdef SBR_LOW_POWER
static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
@@ -54,34 +54,30 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRH
uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
- , real_t *deg /* aliasing degree */
+ ,real_t *deg /* aliasing degree */
#endif
- , uint8_t ch)
+ ,uint8_t ch)
{
ALIGN sbr_hfadj_info adj = {{{0}}};
uint8_t ret = 0;
- if(sbr->bs_frame_class[ch] == FIXFIX)
+ if (sbr->bs_frame_class[ch] == FIXFIX)
{
sbr->l_A[ch] = -1;
- }
- else if(sbr->bs_frame_class[ch] == VARFIX)
- {
- if(sbr->bs_pointer[ch] > 1)
+ } else if (sbr->bs_frame_class[ch] == VARFIX) {
+ if (sbr->bs_pointer[ch] > 1)
sbr->l_A[ch] = sbr->bs_pointer[ch] - 1;
else
sbr->l_A[ch] = -1;
- }
- else
- {
- if(sbr->bs_pointer[ch] == 0)
+ } else {
+ if (sbr->bs_pointer[ch] == 0)
sbr->l_A[ch] = -1;
else
sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
}
ret = estimate_current_envelope(sbr, &adj, Xsbr, ch);
- if(ret > 0)
+ if (ret > 0)
return 1;
calculate_gain(sbr, &adj, ch);
@@ -98,19 +94,17 @@ uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band)
{
- if(sbr->f[ch][l] == HI_RES)
+ if (sbr->f[ch][l] == HI_RES)
{
/* in case of using f_table_high we just have 1 to 1 mapping
* from bs_add_harmonic[l][k]
*/
- if((l >= sbr->l_A[ch]) ||
- (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch]))
{
return sbr->bs_add_harmonic[ch][current_band];
}
- }
- else
- {
+ } else {
uint8_t b, lb, ub;
/* in case of f_table_low we check if any of the HI_RES bands
@@ -120,17 +114,17 @@ static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t curren
*/
/* find first HI_RES band in current LO_RES band */
- lb = 2 * current_band - ((sbr->N_high & 1) ? 1 : 0);
+ lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0);
/* find first HI_RES band in next LO_RES band */
- ub = 2 * (current_band + 1) - ((sbr->N_high & 1) ? 1 : 0);
+ ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0);
/* check all HI_RES bands in current LO_RES band for sinusoid */
- for(b = lb; b < ub; b++)
+ for (b = lb; b < ub; b++)
{
- if((l >= sbr->l_A[ch]) ||
- (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch]))
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch]))
{
- if(sbr->bs_add_harmonic[ch][b] == 1)
+ if (sbr->bs_add_harmonic[ch][b] == 1)
return 1;
}
}
@@ -140,14 +134,14 @@ static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t curren
}
static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
-qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
+ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
{
uint8_t m, l, j, k, k_l, k_h, p;
real_t nrg, div;
- if(sbr->bs_interpol_freq == 1)
+ if (sbr->bs_interpol_freq == 1)
{
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
uint8_t i, l_i, u_i;
@@ -156,28 +150,28 @@ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
div = (real_t)(u_i - l_i);
- if(div == 0)
+ if (div == 0)
div = 1;
- for(m = 0; m < sbr->M; m++)
+ for (m = 0; m < sbr->M; m++)
{
nrg = 0;
- for(i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
+ for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
{
#ifdef FIXED_POINT
#ifdef SBR_LOW_POWER
- nrg += ((QMF_RE(Xsbr[i][m + sbr->kx]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) * ((QMF_RE(Xsbr[i][m + sbr->kx]) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
+ nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
#else
- nrg += ((QMF_RE(Xsbr[i][m + sbr->kx]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) * ((QMF_RE(Xsbr[i][m + sbr->kx]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) +
- ((QMF_IM(Xsbr[i][m + sbr->kx]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) * ((QMF_IM(Xsbr[i][m + sbr->kx]) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
+ nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+ ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
#endif
#else
nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx]))
#ifndef SBR_LOW_POWER
- + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
+ + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
#endif
- ;
+ ;
#endif
}
@@ -191,17 +185,15 @@ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
#endif
}
}
- }
- else
- {
- for(l = 0; l < sbr->L_E[ch]; l++)
+ } else {
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
- for(p = 0; p < sbr->n[sbr->f[ch][l]]; p++)
+ for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++)
{
k_l = sbr->f_table_res[sbr->f[ch][l]][p];
k_h = sbr->f_table_res[sbr->f[ch][l]][p+1];
- for(k = k_l; k < k_h; k++)
+ for (k = k_l; k < k_h; k++)
{
uint8_t i, l_i, u_i;
nrg = 0;
@@ -209,28 +201,28 @@ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
l_i = sbr->t_E[ch][l];
u_i = sbr->t_E[ch][l+1];
- div = (real_t)((u_i - l_i) * (k_h - k_l));
+ div = (real_t)((u_i - l_i)*(k_h - k_l));
- if(div == 0)
+ if (div == 0)
div = 1;
- for(i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
+ for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
{
- for(j = k_l; j < k_h; j++)
+ for (j = k_l; j < k_h; j++)
{
#ifdef FIXED_POINT
#ifdef SBR_LOW_POWER
- nrg += ((QMF_RE(Xsbr[i][j]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) * ((QMF_RE(Xsbr[i][j]) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
+ nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
#else
- nrg += ((QMF_RE(Xsbr[i][j]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) * ((QMF_RE(Xsbr[i][j]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) +
- ((QMF_IM(Xsbr[i][j]) + (1 << (REAL_BITS - 1))) >> REAL_BITS) * ((QMF_IM(Xsbr[i][j]) + (1 << (REAL_BITS - 1))) >> REAL_BITS);
+ nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+ ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
#endif
#else
nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j]))
#ifndef SBR_LOW_POWER
- + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
+ + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
#endif
- ;
+ ;
#endif
}
}
@@ -262,8 +254,7 @@ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
#ifdef FIXED_POINT
/* log2 values of [0..63] */
-static const real_t log2_int_tab[] =
-{
+static const real_t log2_int_tab[] = {
LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156),
REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604),
REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297),
@@ -282,8 +273,7 @@ static const real_t log2_int_tab[] =
REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916)
};
-static const real_t pan_log2_tab[] =
-{
+static const real_t pan_log2_tab[] = {
REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339),
REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054),
REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
@@ -293,102 +283,85 @@ static const real_t pan_log2_tab[] =
static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
{
/* check for coupled energy/noise data */
- if(sbr->bs_coupling == 1)
+ if (sbr->bs_coupling == 1)
{
uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
- real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS - amp0));
+ real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0));
real_t pan;
/* E[1] should always be even so shifting is OK */
uint8_t E = sbr->E[1][k][l] >> amp1;
- if(ch == 0)
+ if (ch == 0)
{
- if(E > 12)
+ if (E > 12)
{
/* negative */
pan = pan_log2_tab[-12 + E];
- }
- else
- {
+ } else {
/* positive */
- pan = pan_log2_tab[12 - E] + ((12 - E) << REAL_BITS);
+ pan = pan_log2_tab[12 - E] + ((12 - E)<<REAL_BITS);
}
- }
- else
- {
- if(E < 12)
+ } else {
+ if (E < 12)
{
/* negative */
pan = pan_log2_tab[-E + 12];
- }
- else
- {
+ } else {
/* positive */
- pan = pan_log2_tab[E - 12] + ((E - 12) << REAL_BITS);
+ pan = pan_log2_tab[E - 12] + ((E - 12)<<REAL_BITS);
}
}
/* tmp / pan in log2 */
return tmp - pan;
- }
- else
- {
+ } else {
uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
- return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS - amp));
+ return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp));
}
}
static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
{
/* check for coupled energy/noise data */
- if(sbr->bs_coupling == 1)
+ if (sbr->bs_coupling == 1)
{
real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS);
real_t pan;
uint8_t Q = sbr->Q[1][k][l];
- if(ch == 0)
+ if (ch == 0)
{
- if(Q > 12)
+ if (Q > 12)
{
/* negative */
pan = pan_log2_tab[-12 + Q];
- }
- else
- {
+ } else {
/* positive */
- pan = pan_log2_tab[12 - Q] + ((12 - Q) << REAL_BITS);
+ pan = pan_log2_tab[12 - Q] + ((12 - Q)<<REAL_BITS);
}
- }
- else
- {
- if(Q < 12)
+ } else {
+ if (Q < 12)
{
/* negative */
pan = pan_log2_tab[-Q + 12];
- }
- else
- {
+ } else {
/* positive */
- pan = pan_log2_tab[Q - 12] + ((Q - 12) << REAL_BITS);
+ pan = pan_log2_tab[Q - 12] + ((Q - 12)<<REAL_BITS);
}
}
/* tmp / pan in log2 */
return tmp - pan;
- }
- else
- {
+ } else {
return (6 << REAL_BITS) - (sbr->Q[ch][k][l] << REAL_BITS);
}
}
-static const real_t log_Qplus1_pan[31][13] =
-{
+static const real_t log_Qplus1_pan[31][13] = {
{ REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
{ REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
{ REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
@@ -422,51 +395,42 @@ static const real_t log_Qplus1_pan[31][13] =
{ REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
};
-static const real_t log_Qplus1[31] =
-{
- REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339),
- REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156),
- REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362),
- REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453),
- REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878),
- REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247),
- REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
- REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667),
- REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551),
- REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641),
+static const real_t log_Qplus1[31] = {
+ REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339),
+ REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156),
+ REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362),
+ REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453),
+ REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878),
+ REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247),
+ REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+ REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667),
+ REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551),
+ REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641),
REAL_CONST(0.000000000000000)
};
static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
{
/* check for coupled energy/noise data */
- if(sbr->bs_coupling == 1)
+ if (sbr->bs_coupling == 1)
{
- if((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
- (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+ if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+ (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
{
- if(ch == 0)
+ if (ch == 0)
{
return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1];
- }
- else
- {
+ } else {
return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)];
}
- }
- else
- {
+ } else {
return 0;
}
- }
- else
- {
- if(sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+ } else {
+ if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
{
return log_Qplus1[sbr->Q[ch][k][l]];
- }
- else
- {
+ } else {
return 0;
}
}
@@ -475,8 +439,7 @@ static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
{
/* log2 values of limiter gains */
- static real_t limGain[] =
- {
+ static real_t limGain[] = {
REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219)
};
uint8_t m, l, k;
@@ -490,7 +453,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
ALIGN real_t S_M[MAX_M];
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
uint8_t current_f_noise_band = 0;
uint8_t current_res_band = 0;
@@ -501,12 +464,12 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
- if(sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+ if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
{
current_t_noise_band++;
}
- for(k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
{
real_t Q_M = 0;
real_t G_max;
@@ -524,14 +487,12 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* calculate the accumulated E_orig and E_curr over the limiter band */
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
- if((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
{
current_res_band_size++;
- }
- else
- {
+ } else {
acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
current_res_band++;
@@ -543,7 +504,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
- if(acc1 == 0)
+ if (acc1 == 0)
acc1 = LOG2_MIN_INF;
else
acc1 = log2_int(acc1);
@@ -557,7 +518,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
G_max = min(G_max, limGain[3]);
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
real_t G;
real_t E_curr, E_orig;
@@ -566,7 +527,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a noise band border */
- if((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
{
/* step to next noise band */
current_f_noise_band++;
@@ -574,10 +535,10 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a resolution band border */
- if((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
{
/* accumulate a whole range of equal Q_Ms */
- if(Q_M_size > 0)
+ if (Q_M_size > 0)
den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
Q_M_size = 0;
@@ -592,7 +553,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a HI_RES band border */
- if((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
{
/* step to next HI_RES band */
current_hi_res_band++;
@@ -604,17 +565,17 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
* current HI_RES band
*/
S_index_mapped = 0;
- if((l >= sbr->l_A[ch]) ||
- (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
{
/* find the middle subband of the HI_RES frequency band */
- if((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
}
/* find bitstream parameters */
- if(sbr->E_curr[ch][m][l] == 0)
+ if (sbr->E_curr[ch][m][l] == 0)
E_curr = LOG2_MIN_INF;
else
E_curr = log2_int(sbr->E_curr[ch][m][l]);
@@ -635,12 +596,10 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* S_M only depends on E_orig, Q_div and S_index_mapped:
* S_index_mapped can only be non-zero once per HI_RES band
*/
- if(S_index_mapped == 0)
+ if (S_index_mapped == 0)
{
S_M[m] = LOG2_MIN_INF; /* -inf */
- }
- else
- {
+ } else {
S_M[m] = E_orig - Q_orig_plus1;
/* accumulate sinusoid part of the total energy */
@@ -655,13 +614,11 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
/* scaled by -10 */
G = E_orig - max(-REAL_CONST(10), E_curr);
- if((S_mapped == 0) && (delta == 1))
+ if ((S_mapped == 0) && (delta == 1))
{
/* G = G * 1/(1+Q) */
G -= Q_orig_plus1;
- }
- else if(S_mapped == 1)
- {
+ } else if (S_mapped == 1) {
/* G = G * Q/(1+Q) */
G += Q_orig - Q_orig_plus1;
}
@@ -669,24 +626,22 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* limit the additional noise energy level */
/* and apply the limiter */
- if(G_max > G)
+ if (G_max > G)
{
Q_M_lim[m] = Q_M;
G_lim[m] = G;
- if((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
{
Q_M_size++;
}
- }
- else
- {
+ } else {
/* G > G_max */
Q_M_lim[m] = Q_M + G_max - G;
G_lim[m] = G_max;
/* accumulate limited Q_M */
- if((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
{
den += pow2_int(Q_M_lim[m]);
}
@@ -699,7 +654,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
}
/* accumulate last range of equal Q_Ms */
- if(Q_M_size > 0)
+ if (Q_M_size > 0)
{
den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
}
@@ -711,7 +666,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */);
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
/* apply compensation to gain, noise floor sf's and sinusoid levels */
#ifndef SBR_LOW_POWER
@@ -724,12 +679,10 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
#endif
adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1);
- if(S_M[m] != LOG2_MIN_INF)
+ if (S_M[m] != LOG2_MIN_INF)
{
adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1);
- }
- else
- {
+ } else {
adj->S_M_boost[l][m] = 0;
}
}
@@ -751,15 +704,15 @@ __inline float pow2(float val)
}
__inline float log2(float val)
{
- return log(val) / log(2.0);
+ return log(val)/log(2.0);
}
#define RB 14
float QUANTISE2REAL(float val)
{
- __int32 ival = (__int32)(val * (1 << RB));
- return (float)ival / (float)((1 << RB));
+ __int32 ival = (__int32)(val * (1<<RB));
+ return (float)ival / (float)((1<<RB));
}
float QUANTISE2INT(float val)
@@ -768,8 +721,7 @@ float QUANTISE2INT(float val)
}
/* log2 values of [0..63] */
-static const real_t log2_int_tab[] =
-{
+static const real_t log2_int_tab[] = {
LOG2_MIN_INF, 0.000000000000000, 1.000000000000000, 1.584962500721156,
2.000000000000000, 2.321928094887362, 2.584962500721156, 2.807354922057604,
3.000000000000000, 3.169925001442313, 3.321928094887363, 3.459431618637297,
@@ -788,8 +740,7 @@ static const real_t log2_int_tab[] =
5.906890595608518, 5.930737337562887, 5.954196310386876, 5.977279923499916
};
-static const real_t pan_log2_tab[] =
-{
+static const real_t pan_log2_tab[] = {
1.000000000000000, 0.584962500721156, 0.321928094887362, 0.169925001442312, 0.087462841250339,
0.044394119358453, 0.022367813028455, 0.011227255423254, 0.005624549193878, 0.002815015607054,
0.001408194392808, 0.000704269011247, 0.000352177480301, 0.000176099486443, 0.000088052430122,
@@ -799,7 +750,7 @@ static const real_t pan_log2_tab[] =
static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
{
/* check for coupled energy/noise data */
- if(sbr->bs_coupling == 1)
+ if (sbr->bs_coupling == 1)
{
real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5;
real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5;
@@ -808,28 +759,22 @@ static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
int E = (int)(sbr->E[1][k][l] * amp1);
- if(ch == 0)
+ if (ch == 0)
{
- if(E > 12)
+ if (E > 12)
{
/* negative */
pan = QUANTISE2REAL(pan_log2_tab[-12 + E]);
- }
- else
- {
+ } else {
/* positive */
pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E));
}
- }
- else
- {
- if(E < 12)
+ } else {
+ if (E < 12)
{
/* negative */
pan = QUANTISE2REAL(pan_log2_tab[-E + 12]);
- }
- else
- {
+ } else {
/* positive */
pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12));
}
@@ -837,9 +782,7 @@ static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
/* tmp / pan in log2 */
return QUANTISE2REAL(tmp - pan);
- }
- else
- {
+ } else {
real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5;
return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp);
@@ -849,35 +792,29 @@ static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
{
/* check for coupled energy/noise data */
- if(sbr->bs_coupling == 1)
+ if (sbr->bs_coupling == 1)
{
float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]);
float pan;
int Q = (int)(sbr->Q[1][k][l]);
- if(ch == 0)
+ if (ch == 0)
{
- if(Q > 12)
+ if (Q > 12)
{
/* negative */
pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]);
- }
- else
- {
+ } else {
/* positive */
pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q));
}
- }
- else
- {
- if(Q < 12)
+ } else {
+ if (Q < 12)
{
/* negative */
pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]);
- }
- else
- {
+ } else {
/* positive */
pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12));
}
@@ -885,15 +822,12 @@ static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
/* tmp / pan in log2 */
return QUANTISE2REAL(tmp - pan);
- }
- else
- {
+ } else {
return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]);
}
}
-static const real_t log_Qplus1_pan[31][13] =
-{
+static const real_t log_Qplus1_pan[31][13] = {
{ REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
{ REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
{ REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
@@ -927,51 +861,42 @@ static const real_t log_Qplus1_pan[31][13] =
{ REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
};
-static const real_t log_Qplus1[31] =
-{
- REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339),
- REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156),
- REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362),
- REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453),
- REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878),
- REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247),
- REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
- REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667),
- REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551),
- REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641),
+static const real_t log_Qplus1[31] = {
+ REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339),
+ REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156),
+ REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362),
+ REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453),
+ REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878),
+ REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247),
+ REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+ REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667),
+ REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551),
+ REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641),
REAL_CONST(0.000000000000000)
};
static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
{
/* check for coupled energy/noise data */
- if(sbr->bs_coupling == 1)
+ if (sbr->bs_coupling == 1)
{
- if((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
- (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+ if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+ (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
{
- if(ch == 0)
+ if (ch == 0)
{
return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]);
- }
- else
- {
+ } else {
return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]);
}
- }
- else
- {
+ } else {
return 0;
}
- }
- else
- {
- if(sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+ } else {
+ if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
{
return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]);
- }
- else
- {
+ } else {
return 0;
}
}
@@ -992,7 +917,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
ALIGN real_t S_M[MAX_M];
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
uint8_t current_f_noise_band = 0;
uint8_t current_res_band = 0;
@@ -1003,12 +928,12 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
- if(sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+ if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
{
current_t_noise_band++;
}
- for(k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
{
real_t Q_M = 0;
real_t G_max;
@@ -1026,25 +951,23 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* calculate the accumulated E_orig and E_curr over the limiter band */
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
- if((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
{
current_res_band_size++;
- }
- else
- {
+ } else {
acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
current_res_band++;
current_res_band_size = 1;
}
- acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l] / 1024.0);
+ acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0);
}
acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
- acc1 = QUANTISE2REAL(log2(EPS + acc1));
+ acc1 = QUANTISE2REAL( log2(EPS + acc1) );
/* calculate the maximum gain */
@@ -1055,7 +978,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
G_max = min(G_max, QUANTISE2REAL(limGain[3]));
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
real_t G;
real_t E_curr, E_orig;
@@ -1064,7 +987,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a noise band border */
- if((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
{
/* step to next noise band */
current_f_noise_band++;
@@ -1072,10 +995,10 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a resolution band border */
- if((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
{
/* accumulate a whole range of equal Q_Ms */
- if(Q_M_size > 0)
+ if (Q_M_size > 0)
den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
Q_M_size = 0;
@@ -1090,7 +1013,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a HI_RES band border */
- if((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
{
/* step to next HI_RES band */
current_hi_res_band++;
@@ -1102,17 +1025,17 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
* current HI_RES band
*/
S_index_mapped = 0;
- if((l >= sbr->l_A[ch]) ||
- (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
{
/* find the middle subband of the HI_RES frequency band */
- if((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
}
/* find bitstream parameters */
- if(sbr->E_curr[ch][m][l] == 0)
+ if (sbr->E_curr[ch][m][l] == 0)
E_curr = LOG2_MIN_INF;
else
E_curr = -10 + log2(sbr->E_curr[ch][m][l]);
@@ -1132,12 +1055,10 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* S_M only depends on E_orig, Q_div and S_index_mapped:
* S_index_mapped can only be non-zero once per HI_RES band
*/
- if(S_index_mapped == 0)
+ if (S_index_mapped == 0)
{
S_M[m] = LOG2_MIN_INF; /* -inf */
- }
- else
- {
+ } else {
S_M[m] = E_orig - Q_orig_plus1;
/* accumulate sinusoid part of the total energy */
@@ -1152,13 +1073,11 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
/* scaled by -10 */
G = E_orig - max(-10, E_curr);
- if((S_mapped == 0) && (delta == 1))
+ if ((S_mapped == 0) && (delta == 1))
{
/* G = G * 1/(1+Q) */
G -= Q_orig_plus1;
- }
- else if(S_mapped == 1)
- {
+ } else if (S_mapped == 1) {
/* G = G * Q/(1+Q) */
G += Q_orig - Q_orig_plus1;
}
@@ -1166,24 +1085,22 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* limit the additional noise energy level */
/* and apply the limiter */
- if(G_max > G)
+ if (G_max > G)
{
Q_M_lim[m] = QUANTISE2REAL(Q_M);
G_lim[m] = QUANTISE2REAL(G);
- if((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
{
Q_M_size++;
}
- }
- else
- {
+ } else {
/* G > G_max */
Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G);
G_lim[m] = G_max;
/* accumulate limited Q_M */
- if((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
{
den += QUANTISE2INT(pow2(Q_M_lim[m]));
}
@@ -1196,7 +1113,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
}
/* accumulate last range of equal Q_Ms */
- if(Q_M_size > 0)
+ if (Q_M_size > 0)
{
den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
}
@@ -1208,25 +1125,23 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */);
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
/* apply compensation to gain, noise floor sf's and sinusoid levels */
#ifndef SBR_LOW_POWER
adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0));
#else
-/* sqrt() will be done after the aliasing reduction to save a
- * few multiplies
- */
-adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost));
+ /* sqrt() will be done after the aliasing reduction to save a
+ * few multiplies
+ */
+ adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost));
#endif
adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0));
- if(S_M[m] != LOG2_MIN_INF)
+ if (S_M[m] != LOG2_MIN_INF)
{
adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0));
- }
- else
- {
+ } else {
adj->S_M_boost[l][m] = 0;
}
}
@@ -1249,7 +1164,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
ALIGN real_t G_boost;
ALIGN real_t S_M[MAX_M];
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
uint8_t current_f_noise_band = 0;
uint8_t current_res_band = 0;
@@ -1260,12 +1175,12 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
- if(sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+ if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
{
current_t_noise_band++;
}
- for(k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
{
real_t G_max;
real_t den = 0;
@@ -1280,9 +1195,9 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* calculate the accumulated E_orig and E_curr over the limiter band */
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
- if((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
{
current_res_band++;
}
@@ -1299,7 +1214,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
G_max = min(G_max, 1e10);
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
real_t Q_M, G;
real_t Q_div, Q_div2;
@@ -1307,7 +1222,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a noise band border */
- if((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
{
/* step to next noise band */
current_f_noise_band++;
@@ -1315,7 +1230,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a resolution band border */
- if((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
{
/* step to next resolution band */
current_res_band2++;
@@ -1328,7 +1243,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* check if m is on a HI_RES band border */
- if((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
{
/* step to next HI_RES band */
current_hi_res_band++;
@@ -1340,11 +1255,11 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
* current HI_RES band
*/
S_index_mapped = 0;
- if((l >= sbr->l_A[ch]) ||
- (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
{
/* find the middle subband of the HI_RES frequency band */
- if((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
}
@@ -1367,12 +1282,10 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* S_M only depends on E_orig, Q_div and S_index_mapped:
* S_index_mapped can only be non-zero once per HI_RES band
*/
- if(S_index_mapped == 0)
+ if (S_index_mapped == 0)
{
S_M[m] = 0;
- }
- else
- {
+ } else {
S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div;
/* accumulate sinusoid part of the total energy */
@@ -1385,21 +1298,19 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
* of the HF generated signal
*/
G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]);
- if((S_mapped == 0) && (delta == 1))
+ if ((S_mapped == 0) && (delta == 1))
G *= Q_div;
- else if(S_mapped == 1)
+ else if (S_mapped == 1)
G *= Q_div2;
/* limit the additional noise energy level */
/* and apply the limiter */
- if(G_max > G)
+ if (G_max > G)
{
Q_M_lim[m] = Q_M;
G_lim[m] = G;
- }
- else
- {
+ } else {
Q_M_lim[m] = Q_M * G_max / G;
G_lim[m] = G_max;
}
@@ -1407,7 +1318,7 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
/* accumulate the total energy */
den += sbr->E_curr[ch][m][l] * G_lim[m];
- if((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
den += Q_M_lim[m];
}
@@ -1415,25 +1326,23 @@ static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
G_boost = (acc1 + EPS) / (den + EPS);
G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */);
- for(m = ml1; m < ml2; m++)
+ for (m = ml1; m < ml2; m++)
{
/* apply compensation to gain, noise floor sf's and sinusoid levels */
#ifndef SBR_LOW_POWER
adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost);
#else
-/* sqrt() will be done after the aliasing reduction to save a
- * few multiplies
- */
-adj->G_lim_boost[l][m] = G_lim[m] * G_boost;
+ /* sqrt() will be done after the aliasing reduction to save a
+ * few multiplies
+ */
+ adj->G_lim_boost[l][m] = G_lim[m] * G_boost;
#endif
adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost);
- if(S_M[m] != 0)
+ if (S_M[m] != 0)
{
adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost);
- }
- else
- {
+ } else {
adj->S_M_boost[l][m] = 0;
}
}
@@ -1451,7 +1360,7 @@ static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, ui
uint8_t grouping;
uint8_t S_mapped;
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
uint8_t current_res_band = 0;
i = 0;
@@ -1459,9 +1368,9 @@ static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, ui
S_mapped = get_S_mapped(sbr, ch, l, current_res_band);
- for(k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
+ for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
{
- if(k == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ if (k == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
{
/* step to next resolution band */
current_res_band++;
@@ -1469,34 +1378,30 @@ static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, ui
S_mapped = get_S_mapped(sbr, ch, l, current_res_band);
}
- if(deg[k + 1] && S_mapped == 0)
+ if (deg[k + 1] && S_mapped == 0)
{
- if(grouping == 0)
+ if (grouping == 0)
{
sbr->f_group[l][i] = k;
grouping = 1;
i++;
}
- }
- else
- {
- if(grouping)
+ } else {
+ if (grouping)
{
- if(S_mapped)
+ if (S_mapped)
{
sbr->f_group[l][i] = k;
- }
- else
- {
+ } else {
sbr->f_group[l][i] = k + 1;
}
grouping = 0;
i++;
}
}
- }
+ }
- if(grouping)
+ if (grouping)
{
sbr->f_group[l][i] = sbr->kx + sbr->M;
i++;
@@ -1511,13 +1416,13 @@ static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg,
uint8_t l, k, m;
real_t E_total, E_total_est, G_target, acc;
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
- for(k = 0; k < sbr->N_G[l]; k++)
+ for (k = 0; k < sbr->N_G[l]; k++)
{
E_total_est = E_total = 0;
-
- for(m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+
+ for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++)
{
/* E_curr: integer */
/* G_lim_boost: fixed point */
@@ -1532,36 +1437,32 @@ static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg,
}
/* G_target: fixed point */
- if((E_total_est + EPS) == 0)
+ if ((E_total_est + EPS) == 0)
{
G_target = 0;
- }
- else
- {
+ } else {
#ifdef FIXED_POINT
- G_target = (((int64_t)(E_total)) << Q2_BITS) / (E_total_est + EPS);
+ G_target = (((int64_t)(E_total))<<Q2_BITS)/(E_total_est + EPS);
#else
G_target = E_total / (E_total_est + EPS);
#endif
}
acc = 0;
- for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+ for (m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
{
real_t alpha;
/* alpha: (COEF) fixed point */
- if(m < sbr->kx + sbr->M - 1)
+ if (m < sbr->kx + sbr->M - 1)
{
alpha = max(deg[m], deg[m + 1]);
- }
- else
- {
+ } else {
alpha = deg[m];
}
adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) +
- MUL_C((COEF_CONST(1) - alpha), adj->G_lim_boost[l][m-sbr->kx]);
+ MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
/* acc: integer */
#ifdef FIXED_POINT
@@ -1572,14 +1473,12 @@ static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg,
}
/* acc: fixed point */
- if(acc + EPS == 0)
+ if (acc + EPS == 0)
{
acc = 0;
- }
- else
- {
+ } else {
#ifdef FIXED_POINT
- acc = (((int64_t)(E_total)) << Q2_BITS) / (acc + EPS);
+ acc = (((int64_t)(E_total))<<Q2_BITS)/(acc + EPS);
#else
acc = E_total / (acc + EPS);
#endif
@@ -1595,17 +1494,17 @@ static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg,
}
}
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
- for(k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
{
- for(m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
- m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+ for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+ m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
{
#ifdef FIXED_POINT
- adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]);
+ adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]);
#else
- adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+ adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
#endif
}
}
@@ -1616,8 +1515,7 @@ static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg,
static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
{
- static real_t h_smooth[] =
- {
+ static real_t h_smooth[] = {
FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084),
FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582),
FRAC_CONST(0.33333333333333)
@@ -1635,19 +1533,17 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
uint8_t h_SL;
- if(sbr->Reset == 1)
+ if (sbr->Reset == 1)
{
assembly_reset = 1;
fIndexNoise = 0;
- }
- else
- {
+ } else {
fIndexNoise = sbr->index_noise_prev[ch];
}
fIndexSine = sbr->psi_is_prev[ch];
- for(l = 0; l < sbr->L_E[ch]; l++)
+ for (l = 0; l < sbr->L_E[ch]; l++)
{
uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0;
@@ -1658,19 +1554,19 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
h_SL = (no_noise ? 0 : h_SL);
#endif
- if(assembly_reset)
+ if (assembly_reset)
{
- for(n = 0; n < 4; n++)
+ for (n = 0; n < 4; n++)
{
- memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M * sizeof(real_t));
- memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M * sizeof(real_t));
+ memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
+ memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
}
/* reset ringbuffer index */
sbr->GQ_ringbuf_index[ch] = 4;
assembly_reset = 0;
}
- for(i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++)
+ for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++)
{
#ifdef SBR_LOW_POWER
uint8_t i_min1, i_plus1;
@@ -1678,10 +1574,10 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
#endif
/* load new values into ringbuffer */
- memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M * sizeof(real_t));
- memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M * sizeof(real_t));
+ memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
+ memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
- for(m = 0; m < sbr->M; m++)
+ for (m = 0; m < sbr->M; m++)
{
qmf_t psi;
@@ -1689,21 +1585,19 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
Q_filt = 0;
#ifndef SBR_LOW_POWER
- if(h_SL != 0)
+ if (h_SL != 0)
{
- uint8_t ri = sbr->GQ_ringbuf_index[ch];
- for(n = 0; n <= 4; n++)
+ uint8_t ri = sbr->GQ_ringbuf_index[ch];
+ for (n = 0; n <= 4; n++)
{
real_t curr_h_smooth = h_smooth[n];
ri++;
- if(ri >= 5)
+ if (ri >= 5)
ri -= 5;
G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth);
Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth);
}
- }
- else
- {
+ } else {
#endif
G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
@@ -1720,24 +1614,24 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
/* V is defined, not calculated */
#ifndef FIXED_POINT
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
- + MUL_F(Q_filt, RE(V[fIndexNoise]));
+ + MUL_F(Q_filt, RE(V[fIndexNoise]));
#else
//QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
// + MUL_F(Q_filt, RE(V[fIndexNoise]));
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
- + MUL_F(Q_filt, RE(V[fIndexNoise]));
+ + MUL_F(Q_filt, RE(V[fIndexNoise]));
#endif
- if(sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
+ if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
#ifndef SBR_LOW_POWER
#ifndef FIXED_POINT
QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
- + MUL_F(Q_filt, IM(V[fIndexNoise]));
+ + MUL_F(Q_filt, IM(V[fIndexNoise]));
#else
//QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
// + MUL_F(Q_filt, IM(V[fIndexNoise]));
QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
- + MUL_F(Q_filt, IM(V[fIndexNoise]));
+ + MUL_F(Q_filt, IM(V[fIndexNoise]));
#endif
#endif
@@ -1763,76 +1657,76 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
i_plus1 = (fIndexSine + 1) & 3;
#ifndef FIXED_POINT
- if((m == 0) && (phi_re[i_plus1] != 0))
+ if ((m == 0) && (phi_re[i_plus1] != 0))
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
- (rev * phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815)));
- if(sbr->M != 0)
+ (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815)));
+ if (sbr->M != 0)
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815)));
+ (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815)));
}
}
- if((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+ (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
}
- if((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815)));
+ (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815)));
}
- if((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
{
- if(m > 0)
+ if (m > 0)
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+ (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
}
- if(m + sbr->kx < 64)
+ if (m + sbr->kx < 64)
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
- (rev * phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
+ (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
}
}
#else
- if((m == 0) && (phi_re[i_plus1] != 0))
+ if ((m == 0) && (phi_re[i_plus1] != 0))
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
- (rev * phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0] << REAL_BITS), FRAC_CONST(0.00815)));
- if(sbr->M != 0)
+ (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815)));
+ if (sbr->M != 0)
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1] << REAL_BITS), FRAC_CONST(0.00815)));
+ (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815)));
}
}
- if((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1] << REAL_BITS), FRAC_CONST(0.00815)));
+ (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
}
- if((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1] << REAL_BITS), FRAC_CONST(0.00815)));
+ (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815)));
}
- if((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
{
- if(m > 0)
+ if (m > 0)
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
- (rev * phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1] << REAL_BITS), FRAC_CONST(0.00815)));
+ (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
}
- if(m + sbr->kx < 64)
+ if (m + sbr->kx < 64)
{
QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
- (rev * phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m] << REAL_BITS), FRAC_CONST(0.00815)));
+ (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815)));
}
}
#endif
- if(adj->S_M_boost[l][m] != 0)
+ if (adj->S_M_boost[l][m] != 0)
sinusoids++;
#endif
}
@@ -1842,7 +1736,7 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
/* update the ringbuffer index used for filtering G and Q with h_smooth */
sbr->GQ_ringbuf_index[ch]++;
- if(sbr->GQ_ringbuf_index[ch] >= 5)
+ if (sbr->GQ_ringbuf_index[ch] >= 5)
sbr->GQ_ringbuf_index[ch] = 0;
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.h
index c7e8bcdec..03ef71a0c 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfadj.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,19 +35,19 @@
extern "C" {
#endif
- typedef struct
- {
- real_t G_lim_boost[MAX_L_E][MAX_M];
- real_t Q_M_lim_boost[MAX_L_E][MAX_M];
- real_t S_M_boost[MAX_L_E][MAX_M];
- } sbr_hfadj_info;
+typedef struct
+{
+ real_t G_lim_boost[MAX_L_E][MAX_M];
+ real_t Q_M_lim_boost[MAX_L_E][MAX_M];
+ real_t S_M_boost[MAX_L_E][MAX_M];
+} sbr_hfadj_info;
- uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
+uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
- , real_t *deg
+ ,real_t *deg
#endif
- , uint8_t ch);
+ ,uint8_t ch);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.c
index ae2999b20..b0f3219c3 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -55,9 +55,9 @@ static void patch_construction(sbr_info *sbr);
void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
qmf_t Xhigh[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
- , real_t *deg
+ ,real_t *deg
#endif
- , uint8_t ch)
+ ,uint8_t ch)
{
uint8_t l, i, x;
ALIGN complex_t alpha_0[64], alpha_1[64];
@@ -72,10 +72,10 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
calc_chirp_factors(sbr, ch);
#ifdef SBR_LOW_POWER
- memset(deg, 0, 64 * sizeof(real_t));
+ memset(deg, 0, 64*sizeof(real_t));
#endif
- if((ch == 0) && (sbr->Reset))
+ if ((ch == 0) && (sbr->Reset))
patch_construction(sbr);
/* calculate the prediction coefficients */
@@ -85,9 +85,9 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
#endif
/* actual HF generation */
- for(i = 0; i < sbr->noPatches; i++)
+ for (i = 0; i < sbr->noPatches; i++)
{
- for(x = 0; x < sbr->patchNoSubbands[i]; x++)
+ for (x = 0; x < sbr->patchNoSubbands[i]; x++)
{
real_t a0_r, a0_i, a1_r, a1_i;
real_t bw, bw2;
@@ -95,14 +95,14 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
/* find the low and high band for patching */
k = sbr->kx + x;
- for(q = 0; q < i; q++)
+ for (q = 0; q < i; q++)
{
k += sbr->patchNoSubbands[q];
}
p = sbr->patchStartSubband[i] + x;
#ifdef SBR_LOW_POWER
- if(x != 0 /*x < sbr->patchNoSubbands[i]-1*/)
+ if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/)
deg[k] = deg[p];
else
deg[k] = 0;
@@ -115,7 +115,7 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
/* do the patching */
/* with or without filtering */
- if(bw2 > 0)
+ if (bw2 > 0)
{
real_t temp1_r, temp2_r, temp3_r;
#ifndef SBR_LOW_POWER
@@ -130,47 +130,45 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
a1_i = MUL_C(IM(alpha_1[p]), bw2);
#endif
- temp2_r = QMF_RE(Xlow[first - 2 + offset][p]);
- temp3_r = QMF_RE(Xlow[first - 1 + offset][p]);
+ temp2_r = QMF_RE(Xlow[first - 2 + offset][p]);
+ temp3_r = QMF_RE(Xlow[first - 1 + offset][p]);
#ifndef SBR_LOW_POWER
- temp2_i = QMF_IM(Xlow[first - 2 + offset][p]);
- temp3_i = QMF_IM(Xlow[first - 1 + offset][p]);
+ temp2_i = QMF_IM(Xlow[first - 2 + offset][p]);
+ temp3_i = QMF_IM(Xlow[first - 1 + offset][p]);
#endif
- for(l = first; l < last; l++)
+ for (l = first; l < last; l++)
{
- temp1_r = temp2_r;
- temp2_r = temp3_r;
- temp3_r = QMF_RE(Xlow[l + offset][p]);
+ temp1_r = temp2_r;
+ temp2_r = temp3_r;
+ temp3_r = QMF_RE(Xlow[l + offset][p]);
#ifndef SBR_LOW_POWER
- temp1_i = temp2_i;
- temp2_i = temp3_i;
+ temp1_i = temp2_i;
+ temp2_i = temp3_i;
temp3_i = QMF_IM(Xlow[l + offset][p]);
#endif
#ifdef SBR_LOW_POWER
QMF_RE(Xhigh[l + offset][k]) =
temp3_r
- + (MUL_R(a0_r, temp2_r) +
- MUL_R(a1_r, temp1_r));
+ +(MUL_R(a0_r, temp2_r) +
+ MUL_R(a1_r, temp1_r));
#else
QMF_RE(Xhigh[l + offset][k]) =
temp3_r
- + (MUL_R(a0_r, temp2_r) -
- MUL_R(a0_i, temp2_i) +
- MUL_R(a1_r, temp1_r) -
- MUL_R(a1_i, temp1_i));
+ +(MUL_R(a0_r, temp2_r) -
+ MUL_R(a0_i, temp2_i) +
+ MUL_R(a1_r, temp1_r) -
+ MUL_R(a1_i, temp1_i));
QMF_IM(Xhigh[l + offset][k]) =
temp3_i
- + (MUL_R(a0_i, temp2_r) +
- MUL_R(a0_r, temp2_i) +
- MUL_R(a1_i, temp1_r) +
- MUL_R(a1_r, temp1_i));
+ +(MUL_R(a0_i, temp2_r) +
+ MUL_R(a0_r, temp2_i) +
+ MUL_R(a1_i, temp1_r) +
+ MUL_R(a1_r, temp1_i));
#endif
}
- }
- else
- {
- for(l = first; l < last; l++)
+ } else {
+ for (l = first; l < last; l++)
{
QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]);
#ifndef SBR_LOW_POWER
@@ -181,7 +179,7 @@ void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
}
}
- if(sbr->Reset)
+ if (sbr->Reset)
{
limiter_frequency_table(sbr);
}
@@ -217,24 +215,24 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
#ifdef FIXED_POINT
mask = 0;
- for(j = (offset - 2); j < (len + offset); j++)
+ for (j = (offset-2); j < (len + offset); j++)
{
real_t x;
- x = QMF_RE(buffer[j][bd]) >> REAL_BITS;
- mask |= x ^(x >> 31);
+ x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+ mask |= x ^ (x >> 31);
}
exp = wl_min_lzc(mask);
/* improves accuracy */
- if(exp > 0)
+ if (exp > 0)
exp -= 1;
- for(j = offset; j < len + offset; j++)
+ for (j = offset; j < len + offset; j++)
{
- real_t buf_j = ((QMF_RE(buffer[j][bd]) + (1 << (exp - 1))) >> exp);
- real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd]) + (1 << (exp - 1))) >> exp);
- real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd]) + (1 << (exp - 1))) >> exp);
+ real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp);
+ real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+ real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
/* normalisation with rounding */
r01 += MUL_R(buf_j, buf_j_1);
@@ -242,24 +240,24 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
r11 += MUL_R(buf_j_1, buf_j_1);
}
RE(ac->r12) = r01 -
- MUL_R(((QMF_RE(buffer[len+offset-1][bd]) + (1 << (exp - 1))) >> exp), ((QMF_RE(buffer[len+offset-2][bd]) + (1 << (exp - 1))) >> exp)) +
- MUL_R(((QMF_RE(buffer[offset-1][bd]) + (1 << (exp - 1))) >> exp), ((QMF_RE(buffer[offset-2][bd]) + (1 << (exp - 1))) >> exp));
+ MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+ MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
RE(ac->r22) = r11 -
- MUL_R(((QMF_RE(buffer[len+offset-2][bd]) + (1 << (exp - 1))) >> exp), ((QMF_RE(buffer[len+offset-2][bd]) + (1 << (exp - 1))) >> exp)) +
- MUL_R(((QMF_RE(buffer[offset-2][bd]) + (1 << (exp - 1))) >> exp), ((QMF_RE(buffer[offset-2][bd]) + (1 << (exp - 1))) >> exp));
+ MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+ MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
#else
- for(j = offset; j < len + offset; j++)
+ for (j = offset; j < len + offset; j++)
{
r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]);
r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]);
}
RE(ac->r12) = r01 -
- QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
- QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]);
+ QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
+ QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]);
RE(ac->r22) = r11 -
- QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
- QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
+ QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
+ QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
#endif
RE(ac->r01) = r01;
RE(ac->r02) = r02;
@@ -278,7 +276,7 @@ static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTS
uint32_t mask, exp;
real_t pow2_to_exp;
#else
-const real_t rel = 1 / (1 + 1e-6f);
+ const real_t rel = 1 / (1 + 1e-6f);
#endif
int8_t j;
uint8_t offset = sbr->tHFAdj;
@@ -286,22 +284,22 @@ const real_t rel = 1 / (1 + 1e-6f);
#ifdef FIXED_POINT
mask = 0;
- for(j = (offset - 2); j < (len + offset); j++)
+ for (j = (offset-2); j < (len + offset); j++)
{
real_t x;
- x = QMF_RE(buffer[j][bd]) >> REAL_BITS;
- mask |= x ^(x >> 31);
- x = QMF_IM(buffer[j][bd]) >> REAL_BITS;
- mask |= x ^(x >> 31);
+ x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+ mask |= x ^ (x >> 31);
+ x = QMF_IM(buffer[j][bd])>>REAL_BITS;
+ mask |= x ^ (x >> 31);
}
exp = wl_min_lzc(mask);
/* improves accuracy */
- if(exp > 0)
+ if (exp > 0)
exp -= 1;
-
- pow2_to_exp = 1 << (exp - 1);
+
+ pow2_to_exp = 1<<(exp-1);
temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
@@ -313,12 +311,12 @@ const real_t rel = 1 / (1 + 1e-6f);
temp5_r = temp3_r;
temp5_i = temp3_i;
- for(j = offset; j < len + offset; j++)
+ for (j = offset; j < len + offset; j++)
{
- temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
- temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
- temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
- temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+ temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+ temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+ temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+ temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp;
temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp;
r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i);
@@ -341,63 +339,63 @@ const real_t rel = 1 / (1 + 1e-6f);
// temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
RE(ac->r12) = r01r -
- (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
- (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
+ (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
+ (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
IM(ac->r12) = r01i -
- (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
- (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
+ (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
+ (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
RE(ac->r22) = r11r -
- (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
- (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));
+ (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
+ (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));
#else
-temp2_r = QMF_RE(buffer[offset-2][bd]);
-temp2_i = QMF_IM(buffer[offset-2][bd]);
-temp3_r = QMF_RE(buffer[offset-1][bd]);
-temp3_i = QMF_IM(buffer[offset-1][bd]);
-// Save these because they are needed after loop
-temp4_r = temp2_r;
-temp4_i = temp2_i;
-temp5_r = temp3_r;
-temp5_i = temp3_i;
-
-for(j = offset; j < len + offset; j++)
-{
- temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd];
- temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd];
- temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd];
- temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd];
- temp3_r = QMF_RE(buffer[j][bd]);
- temp3_i = QMF_IM(buffer[j][bd]);
- r01r += temp3_r * temp2_r + temp3_i * temp2_i;
- r01i += temp3_i * temp2_r - temp3_r * temp2_i;
- r02r += temp3_r * temp1_r + temp3_i * temp1_i;
- r02i += temp3_i * temp1_r - temp3_r * temp1_i;
- r11r += temp2_r * temp2_r + temp2_i * temp2_i;
-}
+ temp2_r = QMF_RE(buffer[offset-2][bd]);
+ temp2_i = QMF_IM(buffer[offset-2][bd]);
+ temp3_r = QMF_RE(buffer[offset-1][bd]);
+ temp3_i = QMF_IM(buffer[offset-1][bd]);
+ // Save these because they are needed after loop
+ temp4_r = temp2_r;
+ temp4_i = temp2_i;
+ temp5_r = temp3_r;
+ temp5_i = temp3_i;
-// These are actual values in temporary variable at this point
-// temp1_r = QMF_RE(buffer[len+offset-1-2][bd];
-// temp1_i = QMF_IM(buffer[len+offset-1-2][bd];
-// temp2_r = QMF_RE(buffer[len+offset-1-1][bd];
-// temp2_i = QMF_IM(buffer[len+offset-1-1][bd];
-// temp3_r = QMF_RE(buffer[len+offset-1][bd]);
-// temp3_i = QMF_IM(buffer[len+offset-1][bd]);
-// temp4_r = QMF_RE(buffer[offset-2][bd]);
-// temp4_i = QMF_IM(buffer[offset-2][bd]);
-// temp5_r = QMF_RE(buffer[offset-1][bd]);
-// temp5_i = QMF_IM(buffer[offset-1][bd]);
-
-RE(ac->r12) = r01r -
- (temp3_r * temp2_r + temp3_i * temp2_i) +
- (temp5_r * temp4_r + temp5_i * temp4_i);
-IM(ac->r12) = r01i -
- (temp3_i * temp2_r - temp3_r * temp2_i) +
- (temp5_i * temp4_r - temp5_r * temp4_i);
-RE(ac->r22) = r11r -
- (temp2_r * temp2_r + temp2_i * temp2_i) +
- (temp4_r * temp4_r + temp4_i * temp4_i);
+ for (j = offset; j < len + offset; j++)
+ {
+ temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd];
+ temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd];
+ temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd];
+ temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd];
+ temp3_r = QMF_RE(buffer[j][bd]);
+ temp3_i = QMF_IM(buffer[j][bd]);
+ r01r += temp3_r * temp2_r + temp3_i * temp2_i;
+ r01i += temp3_i * temp2_r - temp3_r * temp2_i;
+ r02r += temp3_r * temp1_r + temp3_i * temp1_i;
+ r02i += temp3_i * temp1_r - temp3_r * temp1_i;
+ r11r += temp2_r * temp2_r + temp2_i * temp2_i;
+ }
+
+ // These are actual values in temporary variable at this point
+ // temp1_r = QMF_RE(buffer[len+offset-1-2][bd];
+ // temp1_i = QMF_IM(buffer[len+offset-1-2][bd];
+ // temp2_r = QMF_RE(buffer[len+offset-1-1][bd];
+ // temp2_i = QMF_IM(buffer[len+offset-1-1][bd];
+ // temp3_r = QMF_RE(buffer[len+offset-1][bd]);
+ // temp3_i = QMF_IM(buffer[len+offset-1][bd]);
+ // temp4_r = QMF_RE(buffer[offset-2][bd]);
+ // temp4_i = QMF_IM(buffer[offset-2][bd]);
+ // temp5_r = QMF_RE(buffer[offset-1][bd]);
+ // temp5_i = QMF_IM(buffer[offset-1][bd]);
+
+ RE(ac->r12) = r01r -
+ (temp3_r * temp2_r + temp3_i * temp2_i) +
+ (temp5_r * temp4_r + temp5_i * temp4_i);
+ IM(ac->r12) = r01i -
+ (temp3_i * temp2_r - temp3_r * temp2_i) +
+ (temp5_i * temp4_r - temp5_r * temp4_i);
+ RE(ac->r22) = r11r -
+ (temp2_r * temp2_r + temp2_i * temp2_i) +
+ (temp4_r * temp4_r + temp4_i * temp4_i);
#endif
@@ -421,13 +419,11 @@ static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
- if(ac.det == 0)
+ if (ac.det == 0)
{
RE(alpha_1[k]) = 0;
IM(alpha_1[k]) = 0;
- }
- else
- {
+ } else {
#ifdef FIXED_POINT
tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)));
RE(alpha_1[k]) = DIV_R(tmp, ac.det);
@@ -440,13 +436,11 @@ static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
#endif
}
- if(RE(ac.r11) == 0)
+ if (RE(ac.r11) == 0)
{
RE(alpha_0[k]) = 0;
IM(alpha_0[k]) = 0;
- }
- else
- {
+ } else {
#ifdef FIXED_POINT
tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12)));
RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
@@ -459,8 +453,8 @@ static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
#endif
}
- if((MUL_R(RE(alpha_0[k]), RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]), IM(alpha_0[k])) >= REAL_CONST(16)) ||
- (MUL_R(RE(alpha_1[k]), RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]), IM(alpha_1[k])) >= REAL_CONST(16)))
+ if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) ||
+ (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16)))
{
RE(alpha_0[k]) = 0;
IM(alpha_0[k]) = 0;
@@ -476,17 +470,15 @@ static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
real_t tmp;
acorr_coef ac;
- for(k = 1; k < sbr->f_master[0]; k++)
+ for (k = 1; k < sbr->f_master[0]; k++)
{
auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
- if(ac.det == 0)
+ if (ac.det == 0)
{
RE(alpha_0[k]) = 0;
RE(alpha_1[k]) = 0;
- }
- else
- {
+ } else {
tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02));
RE(alpha_0[k]) = DIV_R(tmp, (-ac.det));
@@ -494,23 +486,21 @@ static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
RE(alpha_1[k]) = DIV_R(tmp, ac.det);
}
- if((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
+ if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
{
RE(alpha_0[k]) = REAL_CONST(0);
RE(alpha_1[k]) = REAL_CONST(0);
}
/* reflection coefficient */
- if(RE(ac.r11) == 0)
+ if (RE(ac.r11) == 0)
{
rxx[k] = COEF_CONST(0.0);
- }
- else
- {
+ } else {
rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11));
rxx[k] = -rxx[k];
- if(rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0);
- if(rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0);
+ if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0);
+ if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0);
}
}
}
@@ -522,40 +512,36 @@ static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg)
rxx[0] = COEF_CONST(0.0);
deg[1] = COEF_CONST(0.0);
- for(k = 2; k < sbr->k0; k++)
+ for (k = 2; k < sbr->k0; k++)
{
deg[k] = 0.0;
- if((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0)))
+ if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0)))
{
- if(rxx[k-1] < 0.0)
+ if (rxx[k-1] < 0.0)
{
deg[k] = COEF_CONST(1.0);
- if(rxx[k-2] > COEF_CONST(0.0))
+ if (rxx[k-2] > COEF_CONST(0.0))
{
deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
}
- }
- else if(rxx[k-2] > COEF_CONST(0.0))
- {
+ } else if (rxx[k-2] > COEF_CONST(0.0)) {
deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
}
}
- if((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0)))
+ if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0)))
{
- if(rxx[k-1] > COEF_CONST(0.0))
+ if (rxx[k-1] > COEF_CONST(0.0))
{
deg[k] = COEF_CONST(1.0);
- if(rxx[k-2] < COEF_CONST(0.0))
+ if (rxx[k-2] < COEF_CONST(0.0))
{
deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
}
- }
- else if(rxx[k-2] < COEF_CONST(0.0))
- {
+ } else if (rxx[k-2] < COEF_CONST(0.0)) {
deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
}
}
@@ -566,10 +552,10 @@ static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg)
/* FIXED POINT: bwArray = COEF */
static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev)
{
- switch(invf_mode)
+ switch (invf_mode)
{
case 1: /* LOW */
- if(invf_mode_prev == 0) /* NONE */
+ if (invf_mode_prev == 0) /* NONE */
return COEF_CONST(0.6);
else
return COEF_CONST(0.75);
@@ -581,7 +567,7 @@ static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev)
return COEF_CONST(0.98);
default: /* NONE */
- if(invf_mode_prev == 1) /* LOW */
+ if (invf_mode_prev == 1) /* LOW */
return COEF_CONST(0.6);
else
return COEF_CONST(0.0);
@@ -593,19 +579,19 @@ static void calc_chirp_factors(sbr_info *sbr, uint8_t ch)
{
uint8_t i;
- for(i = 0; i < sbr->N_Q; i++)
+ for (i = 0; i < sbr->N_Q; i++)
{
sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]);
- if(sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i])
+ if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i])
sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25));
else
sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375));
- if(sbr->bwArray[ch][i] < COEF_CONST(0.015625))
+ if (sbr->bwArray[ch][i] < COEF_CONST(0.015625))
sbr->bwArray[ch][i] = COEF_CONST(0.0);
- if(sbr->bwArray[ch][i] >= COEF_CONST(0.99609375))
+ if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375))
sbr->bwArray[ch][i] = COEF_CONST(0.99609375);
sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i];
@@ -625,17 +611,15 @@ static void patch_construction(sbr_info *sbr)
sbr->noPatches = 0;
- if(goalSb < (sbr->kx + sbr->M))
- {
- for(i = 0, k = 0; sbr->f_master[i] < goalSb; i++)
- k = i + 1;
- }
- else
+ if (goalSb < (sbr->kx + sbr->M))
{
+ for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++)
+ k = i+1;
+ } else {
k = sbr->N_master;
}
- if(sbr->N_master == 0)
+ if (sbr->N_master == 0)
{
sbr->noPatches = 0;
sbr->patchNoSubbands[0] = 0;
@@ -654,30 +638,26 @@ static void patch_construction(sbr_info *sbr)
sb = sbr->f_master[j];
odd = (sb - 2 + sbr->k0) % 2;
- }
- while(sb > (sbr->k0 - 1 + msb - odd));
+ } while (sb > (sbr->k0 - 1 + msb - odd));
sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0);
sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd -
- sbr->patchNoSubbands[sbr->noPatches];
+ sbr->patchNoSubbands[sbr->noPatches];
- if(sbr->patchNoSubbands[sbr->noPatches] > 0)
+ if (sbr->patchNoSubbands[sbr->noPatches] > 0)
{
usb = sb;
msb = sb;
sbr->noPatches++;
- }
- else
- {
+ } else {
msb = sbr->kx;
}
- if(sbr->f_master[k] - sb < 3)
+ if (sbr->f_master[k] - sb < 3)
k = sbr->N_master;
- }
- while(sb != (sbr->kx + sbr->M));
+ } while (sb != (sbr->kx + sbr->M));
- if((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1))
+ if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1))
{
sbr->noPatches--;
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.h
index a8f1c82a2..a7c842494 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_hfgen.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,12 +35,12 @@
extern "C" {
#endif
- void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
- qmf_t Xhigh[MAX_NTSRHFG][64]
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ qmf_t Xhigh[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
- , real_t *deg
+ ,real_t *deg
#endif
- , uint8_t ch);
+ ,uint8_t ch);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.c
index ab964723c..6ba878640 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -41,8 +41,7 @@
typedef const int8_t (*sbr_huff_tab)[2];
-static const int8_t t_huffman_env_1_5dB[120][2] =
-{
+static const int8_t t_huffman_env_1_5dB[120][2] = {
{ 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
{ 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 },
{ 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
@@ -54,13 +53,13 @@ static const int8_t t_huffman_env_1_5dB[120][2] =
{ -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 },
{ 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 },
{ 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 },
- { -89, -86 }, { -124, -123 }, { 47, 50 }, { 48, 49 },
- { -122, -121 }, { -120, -119 }, { 51, 54 }, { 52, 53 },
- { -118, -117 }, { -116, -115 }, { 55, 56 }, { -114, -113 },
- { -112, -111 }, { 58, 89 }, { 59, 74 }, { 60, 67 },
- { 61, 64 }, { 62, 63 }, { -110, -109 }, { -108, -107 },
- { 65, 66 }, { -106, -105 }, { -104, -103 }, { 68, 71 },
- { 69, 70 }, { -102, -101 }, { -100, -99 }, { 72, 73 },
+ { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 },
+ {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 },
+ {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 },
+ {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 },
+ { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 },
+ { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 },
+ { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 },
{ -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 },
{ 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 },
{ -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 },
@@ -75,8 +74,7 @@ static const int8_t t_huffman_env_1_5dB[120][2] =
{ -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
};
-static const int8_t f_huffman_env_1_5dB[120][2] =
-{
+static const int8_t f_huffman_env_1_5dB[120][2] = {
{ 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
{ 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 },
{ 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 },
@@ -90,17 +88,17 @@ static const int8_t f_huffman_env_1_5dB[120][2] =
{ -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 },
{ 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 },
{ 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 },
- { -41, -39 }, { 54, 55 }, { -105, -89 }, { -38, -37 },
+ { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 },
{ 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 },
- { 61, 63 }, { -20, 62 }, { -115, -110 }, { 64, 65 },
- { -108, -107 }, { -101, -97 }, { 67, 89 }, { 68, 75 },
+ { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 },
+ {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 },
{ 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 },
- { 73, 74 }, { -22, -17 }, { -16, -124 }, { 76, 82 },
- { 77, 79 }, { -123, 78 }, { -122, -121 }, { 80, 81 },
- { -120, -119 }, { -118, -117 }, { 83, 86 }, { 84, 85 },
- { -116, -114 }, { -113, -112 }, { 87, 88 }, { -111, -109 },
- { -106, -104 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
- { 93, 94 }, { -103, -102 }, { -100, -99 }, { 96, 97 },
+ { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 },
+ { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 },
+ {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 },
+ {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 },
+ {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
+ { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 },
{ -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 },
{ -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 },
{ -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
@@ -109,8 +107,7 @@ static const int8_t f_huffman_env_1_5dB[120][2] =
{ -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
};
-static const int8_t t_huffman_env_bal_1_5dB[48][2] =
-{
+static const int8_t t_huffman_env_bal_1_5dB[48][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 },
{ -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 },
{ -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 },
@@ -125,8 +122,7 @@ static const int8_t t_huffman_env_bal_1_5dB[48][2] =
{ -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 }
};
-static const int8_t f_huffman_env_bal_1_5dB[48][2] =
-{
+static const int8_t f_huffman_env_bal_1_5dB[48][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 },
@@ -141,8 +137,7 @@ static const int8_t f_huffman_env_bal_1_5dB[48][2] =
{ 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 }
};
-static const int8_t t_huffman_env_3_0dB[62][2] =
-{
+static const int8_t t_huffman_env_3_0dB[62][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 },
@@ -161,8 +156,7 @@ static const int8_t t_huffman_env_3_0dB[62][2] =
{ -36, -35 }, { -34, -33 }
};
-static const int8_t f_huffman_env_3_0dB[62][2] =
-{
+static const int8_t f_huffman_env_3_0dB[62][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
{ 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
@@ -181,8 +175,7 @@ static const int8_t f_huffman_env_3_0dB[62][2] =
{ -36, -35 }, { -34, -33 }
};
-static const int8_t t_huffman_env_bal_3_0dB[24][2] =
-{
+static const int8_t t_huffman_env_bal_3_0dB[24][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 },
@@ -191,8 +184,7 @@ static const int8_t t_huffman_env_bal_3_0dB[24][2] =
{ 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 }
};
-static const int8_t f_huffman_env_bal_3_0dB[24][2] =
-{
+static const int8_t f_huffman_env_bal_3_0dB[24][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 },
@@ -201,8 +193,7 @@ static const int8_t f_huffman_env_bal_3_0dB[24][2] =
{ -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
};
-static const int8_t t_huffman_noise_3_0dB[62][2] =
-{
+static const int8_t t_huffman_noise_3_0dB[62][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
{ 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 },
@@ -221,8 +212,7 @@ static const int8_t t_huffman_noise_3_0dB[62][2] =
{ -35, 61 }, { -34, -33 }
};
-static const int8_t t_huffman_noise_bal_3_0dB[24][2] =
-{
+static const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 },
{ -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 },
{ -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 },
@@ -237,7 +227,7 @@ static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
uint8_t bit;
int16_t index = 0;
- while(index >= 0)
+ while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = t_huff[index][bit];
@@ -253,80 +243,66 @@ void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
int8_t delta = 0;
sbr_huff_tab t_huff, f_huff;
- if((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
+ if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
sbr->amp_res[ch] = 0;
else
sbr->amp_res[ch] = sbr->bs_amp_res;
- if((sbr->bs_coupling) && (ch == 1))
+ if ((sbr->bs_coupling) && (ch == 1))
{
delta = 1;
- if(sbr->amp_res[ch])
+ if (sbr->amp_res[ch])
{
t_huff = t_huffman_env_bal_3_0dB;
f_huff = f_huffman_env_bal_3_0dB;
- }
- else
- {
+ } else {
t_huff = t_huffman_env_bal_1_5dB;
f_huff = f_huffman_env_bal_1_5dB;
}
- }
- else
- {
+ } else {
delta = 0;
- if(sbr->amp_res[ch])
+ if (sbr->amp_res[ch])
{
t_huff = t_huffman_env_3_0dB;
f_huff = f_huffman_env_3_0dB;
- }
- else
- {
+ } else {
t_huff = t_huffman_env_1_5dB;
f_huff = f_huffman_env_1_5dB;
}
}
- for(env = 0; env < sbr->L_E[ch]; env++)
+ for (env = 0; env < sbr->L_E[ch]; env++)
{
- if(sbr->bs_df_env[ch][env] == 0)
+ if (sbr->bs_df_env[ch][env] == 0)
{
- if((sbr->bs_coupling == 1) && (ch == 1))
+ if ((sbr->bs_coupling == 1) && (ch == 1))
{
- if(sbr->amp_res[ch])
+ if (sbr->amp_res[ch])
{
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5
- DEBUGVAR(1, 272, "sbr_envelope(): bs_data_env")) << delta);
- }
- else
- {
+ DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
+ } else {
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
- DEBUGVAR(1, 273, "sbr_envelope(): bs_data_env")) << delta);
+ DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta);
}
- }
- else
- {
- if(sbr->amp_res[ch])
+ } else {
+ if (sbr->amp_res[ch])
{
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
- DEBUGVAR(1, 274, "sbr_envelope(): bs_data_env")) << delta);
- }
- else
- {
+ DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
+ } else {
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7
- DEBUGVAR(1, 275, "sbr_envelope(): bs_data_env")) << delta);
+ DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
}
}
- for(band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
+ for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
{
sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta);
}
- }
- else
- {
- for(band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
+ } else {
+ for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
{
sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta);
}
@@ -343,41 +319,35 @@ void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
int8_t delta = 0;
sbr_huff_tab t_huff, f_huff;
- if((sbr->bs_coupling == 1) && (ch == 1))
+ if ((sbr->bs_coupling == 1) && (ch == 1))
{
delta = 1;
t_huff = t_huffman_noise_bal_3_0dB;
f_huff = f_huffman_env_bal_3_0dB;
- }
- else
- {
+ } else {
delta = 0;
t_huff = t_huffman_noise_3_0dB;
f_huff = f_huffman_env_3_0dB;
}
- for(noise = 0; noise < sbr->L_Q[ch]; noise++)
+ for (noise = 0; noise < sbr->L_Q[ch]; noise++)
{
if(sbr->bs_df_noise[ch][noise] == 0)
{
- if((sbr->bs_coupling == 1) && (ch == 1))
+ if ((sbr->bs_coupling == 1) && (ch == 1))
{
sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
- DEBUGVAR(1, 276, "sbr_noise(): bs_data_noise")) << delta);
- }
- else
- {
+ DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta);
+ } else {
sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
- DEBUGVAR(1, 277, "sbr_noise(): bs_data_noise")) << delta);
+ DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta);
}
- for(band = 1; band < sbr->N_Q; band++)
+ for (band = 1; band < sbr->N_Q; band++)
{
sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta);
}
- }
- else
- {
- for(band = 0; band < sbr->N_Q; band++)
+ } else {
+ for (band = 0; band < sbr->N_Q; band++)
{
sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta);
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.h
index 24d9ab882..f749f2e08 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_huff.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,8 @@ extern "C" {
#endif
- void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
- void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
+void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
+void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_noise.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_noise.h
index f3f3231d4..1cf7190de 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_noise.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_noise.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -41,522 +41,521 @@ extern "C" {
#endif
- /* Table 1.A.13 Noise table V */
- ALIGN static const complex_t V[] =
- {
- { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) },
- { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) },
- { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) },
- { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) },
- { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) },
- { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) },
- { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) },
- { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) },
- { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) },
- { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) },
- { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) },
- { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) },
- { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) },
- { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) },
- { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) },
- { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) },
- { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) },
- { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) },
- { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) },
- { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) },
- { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) },
- { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) },
- { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) },
- { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) },
- { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) },
- { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) },
- { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) },
- { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) },
- { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) },
- { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) },
- { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) },
- { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) },
- { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) },
- { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) },
- { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) },
- { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) },
- { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) },
- { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) },
- { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) },
- { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) },
- { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) },
- { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) },
- { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) },
- { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) },
- { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) },
- { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) },
- { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) },
- { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) },
- { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) },
- { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) },
- { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) },
- { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) },
- { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) },
- { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) },
- { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) },
- { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) },
- { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) },
- { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) },
- { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) },
- { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) },
- { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) },
- { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) },
- { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) },
- { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) },
- { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) },
- { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) },
- { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) },
- { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) },
- { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) },
- { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) },
- { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) },
- { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) },
- { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) },
- { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) },
- { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) },
- { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) },
- { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) },
- { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) },
- { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) },
- { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) },
- { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) },
- { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) },
- { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) },
- { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) },
- { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) },
- { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) },
- { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) },
- { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) },
- { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) },
- { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) },
- { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) },
- { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) },
- { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) },
- { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) },
- { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) },
- { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) },
- { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) },
- { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) },
- { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) },
- { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) },
- { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) },
- { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) },
- { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) },
- { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) },
- { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) },
- { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) },
- { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) },
- { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) },
- { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) },
- { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) },
- { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) },
- { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) },
- { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) },
- { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) },
- { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) },
- { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) },
- { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) },
- { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) },
- { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) },
- { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) },
- { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) },
- { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) },
- { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) },
- { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) },
- { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) },
- { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) },
- { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) },
- { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) },
- { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) },
- { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) },
- { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) },
- { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) },
- { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) },
- { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) },
- { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) },
- { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) },
- { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) },
- { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) },
- { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) },
- { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) },
- { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) },
- { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) },
- { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) },
- { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) },
- { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) },
- { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) },
- { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) },
- { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) },
- { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) },
- { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) },
- { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) },
- { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) },
- { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) },
- { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) },
- { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) },
- { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) },
- { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) },
- { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) },
- { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) },
- { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) },
- { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) },
- { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) },
- { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) },
- { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) },
- { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) },
- { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) },
- { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) },
- { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) },
- { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) },
- { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) },
- { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) },
- { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) },
- { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) },
- { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) },
- { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) },
- { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) },
- { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) },
- { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) },
- { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) },
- { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) },
- { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) },
- { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) },
- { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) },
- { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) },
- { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) },
- { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) },
- { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) },
- { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) },
- { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) },
- { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) },
- { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) },
- { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) },
- { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) },
- { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) },
- { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) },
- { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) },
- { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) },
- { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) },
- { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) },
- { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) },
- { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) },
- { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) },
- { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) },
- { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) },
- { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) },
- { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) },
- { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) },
- { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) },
- { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) },
- { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) },
- { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) },
- { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) },
- { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) },
- { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) },
- { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) },
- { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) },
- { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) },
- { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) },
- { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) },
- { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) },
- { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) },
- { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) },
- { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) },
- { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) },
- { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) },
- { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) },
- { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) },
- { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) },
- { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) },
- { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) },
- { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) },
- { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) },
- { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) },
- { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) },
- { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) },
- { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) },
- { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) },
- { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) },
- { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) },
- { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) },
- { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) },
- { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) },
- { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) },
- { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) },
- { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) },
- { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) },
- { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) },
- { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) },
- { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) },
- { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) },
- { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) },
- { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) },
- { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) },
- { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) },
- { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) },
- { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) },
- { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) },
- { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) },
- { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) },
- { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) },
- { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) },
- { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) },
- { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) },
- { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) },
- { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) },
- { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) },
- { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) },
- { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) },
- { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) },
- { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) },
- { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) },
- { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) },
- { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) },
- { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) },
- { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) },
- { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) },
- { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) },
- { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) },
- { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) },
- { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) },
- { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) },
- { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) },
- { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) },
- { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) },
- { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) },
- { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) },
- { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) },
- { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) },
- { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) },
- { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) },
- { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) },
- { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) },
- { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) },
- { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) },
- { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) },
- { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) },
- { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) },
- { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) },
- { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) },
- { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) },
- { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) },
- { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) },
- { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) },
- { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) },
- { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) },
- { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) },
- { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) },
- { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) },
- { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) },
- { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) },
- { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) },
- { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) },
- { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) },
- { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) },
- { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) },
- { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) },
- { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) },
- { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) },
- { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) },
- { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) },
- { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) },
- { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) },
- { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) },
- { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) },
- { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) },
- { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) },
- { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) },
- { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) },
- { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) },
- { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) },
- { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) },
- { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) },
- { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) },
- { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) },
- { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) },
- { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) },
- { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) },
- { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) },
- { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) },
- { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) },
- { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) },
- { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) },
- { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) },
- { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) },
- { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) },
- { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) },
- { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) },
- { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) },
- { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) },
- { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) },
- { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) },
- { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) },
- { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) },
- { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) },
- { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) },
- { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) },
- { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) },
- { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) },
- { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) },
- { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) },
- { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) },
- { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) },
- { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) },
- { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) },
- { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) },
- { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) },
- { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) },
- { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) },
- { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) },
- { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) },
- { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) },
- { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) },
- { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) },
- { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) },
- { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) },
- { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) },
- { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) },
- { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) },
- { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) },
- { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) },
- { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) },
- { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) },
- { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) },
- { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) },
- { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) },
- { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) },
- { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) },
- { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) },
- { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) },
- { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) },
- { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) },
- { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) },
- { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) },
- { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) },
- { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) },
- { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) },
- { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) },
- { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) },
- { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) },
- { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) },
- { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) },
- { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) },
- { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) },
- { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) },
- { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) },
- { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) },
- { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) },
- { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) },
- { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) },
- { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) },
- { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) },
- { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) },
- { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) },
- { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) },
- { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) },
- { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) },
- { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) },
- { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) },
- { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) },
- { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) },
- { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) },
- { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) },
- { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) },
- { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) },
- { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) },
- { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) },
- { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) },
- { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) },
- { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) },
- { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) },
- { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) },
- { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) },
- { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) },
- { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) },
- { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) },
- { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) },
- { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) },
- { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) },
- { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) },
- { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) },
- { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) },
- { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) },
- { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) },
- { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) },
- { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) },
- { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) },
- { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) },
- { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) },
- { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) },
- { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) },
- { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) },
- { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) },
- { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) },
- { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) },
- { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) },
- { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) },
- { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) },
- { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) },
- { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) },
- { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) },
- { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) },
- { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) },
- { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) },
- { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) },
- { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) },
- { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) },
- { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) },
- { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) },
- { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) },
- { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) },
- { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) },
- { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) },
- { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) },
- { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) },
- { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) },
- { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) },
- { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) },
- { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) },
- { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) },
- { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) },
- { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) },
- { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) },
- { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) },
- { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) },
- { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) },
- { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) },
- { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) },
- { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) },
- { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) },
- { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) },
- { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) },
- { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) },
- { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) },
- { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) },
- { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) },
- { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) },
- { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) },
- { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) },
- { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) },
- { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) },
- { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) },
- { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) },
- { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) },
- { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) },
- { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) },
- { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) },
- { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) },
- { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) },
- { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) },
- { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) },
- { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) },
- { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) }
- };
+/* Table 1.A.13 Noise table V */
+ALIGN static const complex_t V[] = {
+ { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) },
+ { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) },
+ { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) },
+ { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) },
+ { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) },
+ { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) },
+ { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) },
+ { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) },
+ { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) },
+ { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) },
+ { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) },
+ { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) },
+ { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) },
+ { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) },
+ { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) },
+ { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) },
+ { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) },
+ { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) },
+ { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) },
+ { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) },
+ { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) },
+ { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) },
+ { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) },
+ { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) },
+ { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) },
+ { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) },
+ { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) },
+ { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) },
+ { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) },
+ { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) },
+ { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) },
+ { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) },
+ { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) },
+ { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) },
+ { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) },
+ { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) },
+ { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) },
+ { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) },
+ { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) },
+ { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) },
+ { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) },
+ { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) },
+ { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) },
+ { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) },
+ { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) },
+ { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) },
+ { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) },
+ { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) },
+ { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) },
+ { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) },
+ { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) },
+ { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) },
+ { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) },
+ { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) },
+ { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) },
+ { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) },
+ { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) },
+ { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) },
+ { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) },
+ { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) },
+ { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) },
+ { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) },
+ { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) },
+ { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) },
+ { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) },
+ { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) },
+ { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) },
+ { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) },
+ { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) },
+ { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) },
+ { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) },
+ { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) },
+ { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) },
+ { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) },
+ { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) },
+ { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) },
+ { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) },
+ { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) },
+ { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) },
+ { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) },
+ { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) },
+ { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) },
+ { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) },
+ { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) },
+ { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) },
+ { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) },
+ { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) },
+ { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) },
+ { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) },
+ { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) },
+ { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) },
+ { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) },
+ { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) },
+ { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) },
+ { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) },
+ { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) },
+ { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) },
+ { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) },
+ { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) },
+ { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) },
+ { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) },
+ { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) },
+ { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) },
+ { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) },
+ { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) },
+ { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) },
+ { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) },
+ { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) },
+ { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) },
+ { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) },
+ { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) },
+ { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) },
+ { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) },
+ { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) },
+ { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) },
+ { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) },
+ { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) },
+ { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) },
+ { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) },
+ { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) },
+ { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) },
+ { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) },
+ { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) },
+ { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) },
+ { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) },
+ { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) },
+ { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) },
+ { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) },
+ { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) },
+ { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) },
+ { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) },
+ { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) },
+ { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) },
+ { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) },
+ { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) },
+ { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) },
+ { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) },
+ { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) },
+ { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) },
+ { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) },
+ { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) },
+ { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) },
+ { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) },
+ { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) },
+ { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) },
+ { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) },
+ { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) },
+ { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) },
+ { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) },
+ { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) },
+ { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) },
+ { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) },
+ { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) },
+ { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) },
+ { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) },
+ { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) },
+ { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) },
+ { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) },
+ { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) },
+ { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) },
+ { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) },
+ { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) },
+ { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) },
+ { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) },
+ { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) },
+ { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) },
+ { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) },
+ { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) },
+ { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) },
+ { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) },
+ { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) },
+ { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) },
+ { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) },
+ { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) },
+ { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) },
+ { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) },
+ { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) },
+ { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) },
+ { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) },
+ { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) },
+ { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) },
+ { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) },
+ { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) },
+ { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) },
+ { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) },
+ { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) },
+ { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) },
+ { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) },
+ { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) },
+ { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) },
+ { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) },
+ { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) },
+ { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) },
+ { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) },
+ { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) },
+ { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) },
+ { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) },
+ { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) },
+ { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) },
+ { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) },
+ { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) },
+ { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) },
+ { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) },
+ { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) },
+ { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) },
+ { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) },
+ { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) },
+ { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) },
+ { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) },
+ { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) },
+ { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) },
+ { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) },
+ { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) },
+ { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) },
+ { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) },
+ { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) },
+ { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) },
+ { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) },
+ { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) },
+ { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) },
+ { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) },
+ { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) },
+ { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) },
+ { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) },
+ { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) },
+ { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) },
+ { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) },
+ { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) },
+ { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) },
+ { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) },
+ { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) },
+ { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) },
+ { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) },
+ { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) },
+ { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) },
+ { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) },
+ { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) },
+ { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) },
+ { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) },
+ { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) },
+ { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) },
+ { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) },
+ { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) },
+ { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) },
+ { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) },
+ { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) },
+ { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) },
+ { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) },
+ { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) },
+ { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) },
+ { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) },
+ { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) },
+ { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) },
+ { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) },
+ { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) },
+ { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) },
+ { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) },
+ { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) },
+ { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) },
+ { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) },
+ { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) },
+ { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) },
+ { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) },
+ { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) },
+ { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) },
+ { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) },
+ { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) },
+ { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) },
+ { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) },
+ { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) },
+ { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) },
+ { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) },
+ { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) },
+ { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) },
+ { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) },
+ { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) },
+ { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) },
+ { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) },
+ { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) },
+ { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) },
+ { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) },
+ { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) },
+ { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) },
+ { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) },
+ { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) },
+ { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) },
+ { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) },
+ { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) },
+ { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) },
+ { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) },
+ { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) },
+ { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) },
+ { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) },
+ { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) },
+ { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) },
+ { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) },
+ { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) },
+ { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) },
+ { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) },
+ { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) },
+ { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) },
+ { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) },
+ { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) },
+ { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) },
+ { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) },
+ { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) },
+ { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) },
+ { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) },
+ { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) },
+ { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) },
+ { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) },
+ { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) },
+ { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) },
+ { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) },
+ { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) },
+ { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) },
+ { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) },
+ { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) },
+ { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) },
+ { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) },
+ { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) },
+ { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) },
+ { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) },
+ { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) },
+ { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) },
+ { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) },
+ { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) },
+ { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) },
+ { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) },
+ { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) },
+ { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) },
+ { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) },
+ { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) },
+ { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) },
+ { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) },
+ { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) },
+ { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) },
+ { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) },
+ { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) },
+ { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) },
+ { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) },
+ { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) },
+ { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) },
+ { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) },
+ { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) },
+ { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) },
+ { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) },
+ { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) },
+ { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) },
+ { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) },
+ { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) },
+ { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) },
+ { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) },
+ { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) },
+ { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) },
+ { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) },
+ { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) },
+ { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) },
+ { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) },
+ { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) },
+ { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) },
+ { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) },
+ { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) },
+ { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) },
+ { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) },
+ { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) },
+ { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) },
+ { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) },
+ { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) },
+ { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) },
+ { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) },
+ { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) },
+ { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) },
+ { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) },
+ { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) },
+ { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) },
+ { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) },
+ { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) },
+ { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) },
+ { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) },
+ { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) },
+ { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) },
+ { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) },
+ { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) },
+ { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) },
+ { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) },
+ { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) },
+ { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) },
+ { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) },
+ { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) },
+ { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) },
+ { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) },
+ { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) },
+ { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) },
+ { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) },
+ { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) },
+ { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) },
+ { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) },
+ { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) },
+ { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) },
+ { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) },
+ { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) },
+ { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) },
+ { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) },
+ { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) },
+ { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) },
+ { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) },
+ { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) },
+ { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) },
+ { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) },
+ { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) },
+ { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) },
+ { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) },
+ { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) },
+ { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) },
+ { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) },
+ { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) },
+ { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) },
+ { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) },
+ { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) },
+ { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) },
+ { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) },
+ { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) },
+ { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) },
+ { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) },
+ { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) },
+ { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) },
+ { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) },
+ { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) },
+ { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) },
+ { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) },
+ { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) },
+ { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) },
+ { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) },
+ { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) },
+ { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) },
+ { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) },
+ { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) },
+ { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) },
+ { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) },
+ { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) },
+ { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) },
+ { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) },
+ { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) },
+ { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) },
+ { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) },
+ { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) },
+ { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) },
+ { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) },
+ { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) },
+ { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) },
+ { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) },
+ { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) },
+ { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) },
+ { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) },
+ { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) },
+ { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) },
+ { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) },
+ { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) },
+ { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) },
+ { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) },
+ { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) },
+ { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) },
+ { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) },
+ { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) },
+ { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) },
+ { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) },
+ { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) },
+ { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) },
+ { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) },
+ { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) },
+ { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) },
+ { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) },
+ { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) },
+ { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) },
+ { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) },
+ { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) },
+ { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) },
+ { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) },
+ { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) },
+ { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) },
+ { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) },
+ { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) },
+ { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) },
+ { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) },
+ { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) },
+ { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) },
+ { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) },
+ { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) },
+ { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) },
+ { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) },
+ { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) },
+ { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) },
+ { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) },
+ { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) },
+ { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) },
+ { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) },
+ { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) },
+ { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) },
+ { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) },
+ { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) },
+ { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) },
+ { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) },
+ { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) },
+ { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) },
+ { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) },
+ { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) },
+ { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) },
+ { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) },
+ { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) },
+ { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) },
+ { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) }
+};
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.c
index 519d20bce..68f408916 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -45,12 +45,12 @@ qmfa_info *qmfa_init(uint8_t channels)
{
qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info));
- /* x is implemented as double ringbuffer */
+ /* x is implemented as double ringbuffer */
qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t));
memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t));
- /* ringbuffer index */
- qmfa->x_index = 0;
+ /* ringbuffer index */
+ qmfa->x_index = 0;
qmfa->channels = channels;
@@ -59,9 +59,9 @@ qmfa_info *qmfa_init(uint8_t channels)
void qmfa_end(qmfa_info *qmfa)
{
- if(qmfa)
+ if (qmfa)
{
- if(qmfa->x) faad_free(qmfa->x);
+ if (qmfa->x) faad_free(qmfa->x);
faad_free(qmfa);
}
}
@@ -79,16 +79,16 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
uint8_t l;
/* qmf subsample l */
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
int16_t n;
/* shift input buffer x */
- /* input buffer is not shifted anymore, x is implemented as double ringbuffer */
+ /* input buffer is not shifted anymore, x is implemented as double ringbuffer */
//memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
/* add new samples to input buffer x */
- for(n = 32 - 1; n >= 0; n--)
+ for (n = 32 - 1; n >= 0; n--)
{
#ifdef FIXED_POINT
qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4;
@@ -98,42 +98,40 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
}
/* window and summation to create array u */
- for(n = 0; n < 64; n++)
+ for (n = 0; n < 64; n++)
{
u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) +
- MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) +
- MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) +
- MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) +
- MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]);
+ MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]);
}
- /* update ringbuffer index */
- qmfa->x_index -= 32;
- if(qmfa->x_index < 0)
- qmfa->x_index = (320 - 32);
+ /* update ringbuffer index */
+ qmfa->x_index -= 32;
+ if (qmfa->x_index < 0)
+ qmfa->x_index = (320-32);
/* calculate 32 subband samples by introducing X */
#ifdef SBR_LOW_POWER
y[0] = u[48];
- for(n = 1; n < 16; n++)
+ for (n = 1; n < 16; n++)
y[n] = u[n+48] + u[48-n];
- for(n = 16; n < 32; n++)
+ for (n = 16; n < 32; n++)
y[n] = -u[n-16] + u[48-n];
DCT3_32_unscaled(u, y);
- for(n = 0; n < 32; n++)
+ for (n = 0; n < 32; n++)
{
- if(n < kx)
+ if (n < kx)
{
#ifdef FIXED_POINT
QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/;
#else
QMF_RE(X[l + offset][n]) = 2. * u[n];
#endif
- }
- else
- {
+ } else {
QMF_RE(X[l + offset][n]) = 0;
}
}
@@ -142,7 +140,7 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
// Reordering of data moved from DCT_IV to here
in_imag[31] = u[1];
in_real[0] = u[0];
- for(n = 1; n < 31; n++)
+ for (n = 1; n < 31; n++)
{
in_imag[31 - n] = u[n+1];
in_real[n] = -u[64-n];
@@ -154,36 +152,30 @@ void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
dct4_kernel(in_real, in_imag, out_real, out_imag);
// Reordering of data moved from DCT_IV to here
- for(n = 0; n < 16; n++)
- {
- if(2 * n + 1 < kx)
- {
+ for (n = 0; n < 16; n++) {
+ if (2*n+1 < kx) {
#ifdef FIXED_POINT
QMF_RE(X[l + offset][2*n]) = out_real[n];
QMF_IM(X[l + offset][2*n]) = out_imag[n];
QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n];
QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n];
#else
- QMF_RE(X[l + offset][2*n]) = 2. * out_real[n];
- QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n];
- QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n];
- QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n];
+ QMF_RE(X[l + offset][2*n]) = 2. * out_real[n];
+ QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n];
+ QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n];
+ QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n];
#endif
- }
- else
- {
- if(2 * n < kx)
- {
+ } else {
+ if (2*n < kx) {
#ifdef FIXED_POINT
QMF_RE(X[l + offset][2*n]) = out_real[n];
QMF_IM(X[l + offset][2*n]) = out_imag[n];
#else
- QMF_RE(X[l + offset][2*n]) = 2. * out_real[n];
- QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n];
+ QMF_RE(X[l + offset][2*n]) = 2. * out_real[n];
+ QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n];
#endif
}
- else
- {
+ else {
QMF_RE(X[l + offset][2*n]) = 0;
QMF_IM(X[l + offset][2*n]) = 0;
}
@@ -235,7 +227,7 @@ qmfs_info *qmfs_init(uint8_t channels)
{
qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info));
- /* v is a double ringbuffer */
+ /* v is a double ringbuffer */
qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t));
memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t));
@@ -248,9 +240,9 @@ qmfs_info *qmfs_init(uint8_t channels)
void qmfs_end(qmfs_info *qmfs)
{
- if(qmfs)
+ if (qmfs)
{
- if(qmfs->v) faad_free(qmfs->v);
+ if (qmfs->v) faad_free(qmfs->v);
faad_free(qmfs);
}
}
@@ -266,14 +258,14 @@ void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
uint8_t l;
/* qmf subsample l */
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
/* shift buffers */
/* we are not shifting v, it is a double ringbuffer */
//memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
/* calculate 64 samples */
- for(k = 0; k < 16; k++)
+ for (k = 0; k < 16; k++)
{
#ifdef FIXED_POINT
y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k]));
@@ -289,40 +281,40 @@ void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
/* odd n samples */
DCT4_16(y, y);
- for(n = 8; n < 24; n++)
+ for (n = 8; n < 24; n++)
{
qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8];
qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8];
}
- for(n = 0; n < 16; n++)
+ for (n = 0; n < 16; n++)
{
qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n];
}
qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0;
- for(n = 1; n < 16; n++)
+ for (n = 1; n < 16; n++)
{
qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n];
}
/* calculate 32 output samples and window */
- for(k = 0; k < 32; k++)
+ for (k = 0; k < 32; k++)
{
output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
+ MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
}
/* update the ringbuffer index */
qmfs->v_index -= 64;
- if(qmfs->v_index < 0)
- qmfs->v_index = (640 - 64);
+ if (qmfs->v_index < 0)
+ qmfs->v_index = (640-64);
}
}
@@ -336,14 +328,14 @@ void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
/* qmf subsample l */
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
/* shift buffers */
/* we are not shifting v, it is a double ringbuffer */
//memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
/* calculate 128 samples */
- for(k = 0; k < 32; k++)
+ for (k = 0; k < 32; k++)
{
#ifdef FIXED_POINT
y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k]));
@@ -359,40 +351,40 @@ void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
/* odd n samples */
DCT4_32(y, y);
- for(n = 16; n < 48; n++)
+ for (n = 16; n < 48; n++)
{
qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 1280 + n*2] = x[n-16];
qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16];
}
- for(n = 0; n < 32; n++)
+ for (n = 0; n < 32; n++)
{
qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n];
}
qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0;
- for(n = 1; n < 32; n++)
+ for (n = 1; n < 32; n++)
{
qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n];
}
/* calculate 64 output samples and window */
- for(k = 0; k < 64; k++)
+ for (k = 0; k < 64; k++)
{
output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) +
- MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) +
- MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]);
+ MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]);
}
/* update the ringbuffer index */
qmfs->v_index -= 128;
- if(qmfs->v_index < 0)
- qmfs->v_index = (1280 - 128);
+ if (qmfs->v_index < 0)
+ qmfs->v_index = (1280-128);
}
}
#else
@@ -401,14 +393,14 @@ void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
{
ALIGN real_t x1[32], x2[32];
#ifndef FIXED_POINT
- real_t scale = 1.f / 64.f;
+ real_t scale = 1.f/64.f;
#endif
int32_t n, k, out = 0;
uint8_t l;
/* qmf subsample l */
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
/* shift buffer v */
/* buffer is not shifted, we are using a ringbuffer */
@@ -416,7 +408,7 @@ void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
/* calculate 64 samples */
/* complex pre-twiddle */
- for(k = 0; k < 32; k++)
+ for (k = 0; k < 32; k++)
{
x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k]));
x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k]));
@@ -425,8 +417,8 @@ void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
x1[k] *= scale;
x2[k] *= scale;
#else
-x1[k] >>= 1;
-x2[k] >>= 1;
+ x1[k] >>= 1;
+ x2[k] >>= 1;
#endif
}
@@ -434,30 +426,30 @@ x2[k] >>= 1;
DCT4_32(x1, x1);
DST4_32(x2, x2);
- for(n = 0; n < 32; n++)
+ for (n = 0; n < 32; n++)
{
qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = -x1[n] + x2[n];
qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] = x1[n] + x2[n];
}
/* calculate 32 output samples and window */
- for(k = 0; k < 32; k++)
+ for (k = 0; k < 32; k++)
{
output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
- MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
+ MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
}
/* update ringbuffer index */
qmfs->v_index -= 64;
- if(qmfs->v_index < 0)
+ if (qmfs->v_index < 0)
qmfs->v_index = (640 - 64);
}
}
@@ -484,59 +476,59 @@ void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][6
const real_t * pqmf_c_9, * pqmf_c_10;
#endif // #ifdef PREFER_POINTERS
#ifndef FIXED_POINT
- real_t scale = 1.f / 64.f;
+ real_t scale = 1.f/64.f;
#endif
int32_t n, k, out = 0;
uint8_t l;
/* qmf subsample l */
- for(l = 0; l < sbr->numTimeSlotsRate; l++)
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
{
/* shift buffer v */
- /* buffer is not shifted, we use double ringbuffer */
- //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
+ /* buffer is not shifted, we use double ringbuffer */
+ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
/* calculate 128 samples */
#ifndef FIXED_POINT
pX = X[l];
- in_imag1[31] = scale * QMF_RE(pX[1]);
- in_real1[0] = scale * QMF_RE(pX[0]);
- in_imag2[31] = scale * QMF_IM(pX[63-1]);
- in_real2[0] = scale * QMF_IM(pX[63-0]);
- for(k = 1; k < 31; k++)
+ in_imag1[31] = scale*QMF_RE(pX[1]);
+ in_real1[0] = scale*QMF_RE(pX[0]);
+ in_imag2[31] = scale*QMF_IM(pX[63-1]);
+ in_real2[0] = scale*QMF_IM(pX[63-0]);
+ for (k = 1; k < 31; k++)
{
- in_imag1[31 - k] = scale * QMF_RE(pX[2*k + 1]);
- in_real1[ k] = scale * QMF_RE(pX[2*k ]);
- in_imag2[31 - k] = scale * QMF_IM(pX[63 - (2*k + 1)]);
- in_real2[ k] = scale * QMF_IM(pX[63 - (2*k)]);
+ in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]);
+ in_real1[ k] = scale*QMF_RE(pX[2*k ]);
+ in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]);
+ in_real2[ k] = scale*QMF_IM(pX[63 - (2*k )]);
}
- in_imag1[0] = scale * QMF_RE(pX[63]);
- in_real1[31] = scale * QMF_RE(pX[62]);
- in_imag2[0] = scale * QMF_IM(pX[63-63]);
- in_real2[31] = scale * QMF_IM(pX[63-62]);
+ in_imag1[0] = scale*QMF_RE(pX[63]);
+ in_real1[31] = scale*QMF_RE(pX[62]);
+ in_imag2[0] = scale*QMF_IM(pX[63-63]);
+ in_real2[31] = scale*QMF_IM(pX[63-62]);
#else
-pX = X[l];
+ pX = X[l];
-in_imag1[31] = QMF_RE(pX[1]) >> 1;
-in_real1[0] = QMF_RE(pX[0]) >> 1;
-in_imag2[31] = QMF_IM(pX[62]) >> 1;
-in_real2[0] = QMF_IM(pX[63]) >> 1;
-for(k = 1; k < 31; k++)
-{
- in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1;
- in_real1[ k] = QMF_RE(pX[2*k ]) >> 1;
- in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1;
- in_real2[ k] = QMF_IM(pX[63 - (2*k)]) >> 1;
-}
-in_imag1[0] = QMF_RE(pX[63]) >> 1;
-in_real1[31] = QMF_RE(pX[62]) >> 1;
-in_imag2[0] = QMF_IM(pX[0]) >> 1;
-in_real2[31] = QMF_IM(pX[1]) >> 1;
+ in_imag1[31] = QMF_RE(pX[1]) >> 1;
+ in_real1[0] = QMF_RE(pX[0]) >> 1;
+ in_imag2[31] = QMF_IM(pX[62]) >> 1;
+ in_real2[0] = QMF_IM(pX[63]) >> 1;
+ for (k = 1; k < 31; k++)
+ {
+ in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1;
+ in_real1[ k] = QMF_RE(pX[2*k ]) >> 1;
+ in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1;
+ in_real2[ k] = QMF_IM(pX[63 - (2*k )]) >> 1;
+ }
+ in_imag1[0] = QMF_RE(pX[63]) >> 1;
+ in_real1[31] = QMF_RE(pX[62]) >> 1;
+ in_imag2[0] = QMF_IM(pX[0]) >> 1;
+ in_real2[31] = QMF_IM(pX[1]) >> 1;
#endif
@@ -555,7 +547,7 @@ in_real2[31] = QMF_IM(pX[1]) >> 1;
// ptemp_1 = x1;
// ptemp_2 = x2;
#ifdef PREFER_POINTERS
- for(n = 0; n < 32; n ++)
+ for (n = 0; n < 32; n ++)
{
//real_t x1 = *ptemp_1++;
//real_t x2 = *ptemp_2++;
@@ -569,14 +561,14 @@ in_real2[31] = QMF_IM(pX[1]) >> 1;
}
#else // #ifdef PREFER_POINTERS
-for(n = 0; n < 32; n++)
-{
- // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
- pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n];
- pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n];
- pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n];
- pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n];
-}
+ for (n = 0; n < 32; n++)
+ {
+ // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+ pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n];
+ pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n];
+ pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n];
+ pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n];
+ }
#endif // #ifdef PREFER_POINTERS
@@ -604,7 +596,7 @@ for(n = 0; n < 32; n++)
#endif // #ifdef PREFER_POINTERS
/* calculate 64 output samples and window */
- for(k = 0; k < 64; k++)
+ for (k = 0; k < 64; k++)
{
#ifdef PREFER_POINTERS
output[out++] =
@@ -619,23 +611,23 @@ for(n = 0; n < 32; n++)
MUL_F(*pring_buffer_9++, *pqmf_c_9++) +
MUL_F(*pring_buffer_10++, *pqmf_c_10++);
#else // #ifdef PREFER_POINTERS
-output[out++] =
- MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) +
- MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) +
- MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) +
- MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) +
- MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) +
- MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) +
- MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) +
- MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) +
- MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) +
- MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]);
+ output[out++] =
+ MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) +
+ MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) +
+ MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) +
+ MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) +
+ MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) +
+ MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) +
+ MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) +
+ MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) +
+ MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) +
+ MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]);
#endif // #ifdef PREFER_POINTERS
}
/* update ringbuffer index */
qmfs->v_index -= 128;
- if(qmfs->v_index < 0)
+ if (qmfs->v_index < 0)
qmfs->v_index = (1280 - 128);
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.h
index b4b8a8b57..efb167be9 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,17 +35,17 @@
extern "C" {
#endif
- qmfa_info *qmfa_init(uint8_t channels);
- void qmfa_end(qmfa_info *qmfa);
- qmfs_info *qmfs_init(uint8_t channels);
- void qmfs_end(qmfs_info *qmfs);
+qmfa_info *qmfa_init(uint8_t channels);
+void qmfa_end(qmfa_info *qmfa);
+qmfs_info *qmfs_init(uint8_t channels);
+void qmfs_end(qmfs_info *qmfs);
- void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
- qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
- void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
- real_t *output);
- void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
- real_t *output);
+void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
+ qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output);
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf_c.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf_c.h
index 895d13dad..c2fcd2739 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf_c.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_qmf_c.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -41,329 +41,328 @@ extern "C" {
#pragma warning(disable:4244)
#endif
- ALIGN static const real_t qmf_c[640] =
- {
- FRAC_CONST(0), FRAC_CONST(-0.00055252865047),
- FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896),
- FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498),
- FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972),
- FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613),
- FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938),
- FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621),
- FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273),
- FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222),
- FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532),
- FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949),
- FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927),
- FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257),
- FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757),
- FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525),
- FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372),
- FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025),
- FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906),
- FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803),
- FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756),
- FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344),
- FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005),
- FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274),
- FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041),
- FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952),
- FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865),
- FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015),
- FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475),
- FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471),
- FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224),
- FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557),
- FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126),
- FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465),
- FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525),
- FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828),
- FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104),
- FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935),
- FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781),
- FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118),
- FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745),
- FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032),
- FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982),
- FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507),
- FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045),
- FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164),
- FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932),
- FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394),
- FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897),
- FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514),
- FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906),
- FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447),
- FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246),
- FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098),
- FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321),
- FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768),
- FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248),
- FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664),
- FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893),
- FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839),
- FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624),
- FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685),
- FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726),
- FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986),
- FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508),
- FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792),
- FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989),
- FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698),
- FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535),
- FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285),
- FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329),
- FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279),
- FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337),
- FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542),
- FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745),
- FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367),
- FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413),
- FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672),
- FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216),
- FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589),
- FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299),
- FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761),
- FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172),
- FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438),
- FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228),
- FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127),
- FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102),
- FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803),
- FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194),
- FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584),
- FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119),
- FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964),
- FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746),
- FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536),
- FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287),
- FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762),
- FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903),
- FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951),
- FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508),
- FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387),
- FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867),
- FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366),
- FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701),
- FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127),
- FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691),
- FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909),
- FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228),
- FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617),
- FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304),
- FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558),
- FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064),
- FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822),
- FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934),
- FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359),
- FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279),
- FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914),
- FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773),
- FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878),
- FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187),
- FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669),
- FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142),
- FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103),
- FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149),
- FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974),
- FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603),
- FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085),
- FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916),
- FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105),
- FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931),
- FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061),
- FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675),
- FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409),
- FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665),
- FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757),
- FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099),
- FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434),
- FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855),
- FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061),
- FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923),
- FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496),
- FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291),
- FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286),
- FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671),
- FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712),
- FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032),
- FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095),
- FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994),
- FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488),
- FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242),
- FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327),
- FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392),
- FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377),
- FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491),
- FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468),
- FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336),
- FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402),
- FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722),
- FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206),
- FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
- FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
- FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
- FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
- FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
- FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
- FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
- FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722),
- FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402),
- FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336),
- FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468),
- FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491),
- FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377),
- FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392),
- FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327),
- FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242),
- FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488),
- FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994),
- FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095),
- FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032),
- FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712),
- FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671),
- FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286),
- FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291),
- FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496),
- FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923),
- FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061),
- FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855),
- FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434),
- FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099),
- FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757),
- FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665),
- FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409),
- FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675),
- FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061),
- FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931),
- FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105),
- FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916),
- FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085),
- FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603),
- FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974),
- FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149),
- FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103),
- FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142),
- FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669),
- FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187),
- FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878),
- FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773),
- FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914),
- FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279),
- FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359),
- FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934),
- FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822),
- FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064),
- FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558),
- FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304),
- FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617),
- FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228),
- FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909),
- FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691),
- FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127),
- FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701),
- FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366),
- FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867),
- FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387),
- FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508),
- FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951),
- FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903),
- FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762),
- FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287),
- FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536),
- FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746),
- FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964),
- FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119),
- FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584),
- FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194),
- FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803),
- FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102),
- FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127),
- FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228),
- FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438),
- FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172),
- FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761),
- FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299),
- FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589),
- FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216),
- FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672),
- FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413),
- FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367),
- FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745),
- FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542),
- FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337),
- FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279),
- FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329),
- FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285),
- FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535),
- FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698),
- FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989),
- FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792),
- FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508),
- FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986),
- FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726),
- FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685),
- FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624),
- FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839),
- FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893),
- FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664),
- FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248),
- FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768),
- FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321),
- FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098),
- FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246),
- FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447),
- FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906),
- FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514),
- FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897),
- FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394),
- FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932),
- FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164),
- FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045),
- FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507),
- FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982),
- FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032),
- FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745),
- FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118),
- FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781),
- FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935),
- FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104),
- FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828),
- FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525),
- FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465),
- FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126),
- FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557),
- FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224),
- FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471),
- FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475),
- FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015),
- FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865),
- FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952),
- FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041),
- FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274),
- FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005),
- FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344),
- FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756),
- FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803),
- FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906),
- FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025),
- FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372),
- FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525),
- FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757),
- FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257),
- FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927),
- FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949),
- FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532),
- FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222),
- FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273),
- FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621),
- FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938),
- FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613),
- FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972),
- FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498),
- FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896),
- FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
- };
+ALIGN static const real_t qmf_c[640] = {
+ FRAC_CONST(0), FRAC_CONST(-0.00055252865047),
+ FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896),
+ FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498),
+ FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972),
+ FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613),
+ FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938),
+ FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621),
+ FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273),
+ FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222),
+ FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532),
+ FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949),
+ FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927),
+ FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257),
+ FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757),
+ FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525),
+ FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372),
+ FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025),
+ FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906),
+ FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803),
+ FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756),
+ FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344),
+ FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005),
+ FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274),
+ FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041),
+ FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952),
+ FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865),
+ FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015),
+ FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475),
+ FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471),
+ FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224),
+ FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557),
+ FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126),
+ FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465),
+ FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525),
+ FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828),
+ FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104),
+ FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935),
+ FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781),
+ FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118),
+ FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745),
+ FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032),
+ FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982),
+ FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507),
+ FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045),
+ FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164),
+ FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932),
+ FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394),
+ FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897),
+ FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514),
+ FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906),
+ FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447),
+ FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246),
+ FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098),
+ FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321),
+ FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768),
+ FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248),
+ FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664),
+ FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893),
+ FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839),
+ FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624),
+ FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685),
+ FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726),
+ FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986),
+ FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508),
+ FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792),
+ FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989),
+ FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698),
+ FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535),
+ FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285),
+ FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329),
+ FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279),
+ FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337),
+ FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542),
+ FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745),
+ FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367),
+ FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413),
+ FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672),
+ FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216),
+ FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589),
+ FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299),
+ FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761),
+ FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172),
+ FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438),
+ FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228),
+ FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127),
+ FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102),
+ FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803),
+ FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194),
+ FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584),
+ FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119),
+ FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964),
+ FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746),
+ FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536),
+ FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287),
+ FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762),
+ FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903),
+ FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951),
+ FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508),
+ FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387),
+ FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867),
+ FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366),
+ FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701),
+ FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127),
+ FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691),
+ FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909),
+ FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228),
+ FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617),
+ FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304),
+ FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558),
+ FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064),
+ FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822),
+ FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934),
+ FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359),
+ FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279),
+ FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914),
+ FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773),
+ FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878),
+ FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187),
+ FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669),
+ FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142),
+ FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103),
+ FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149),
+ FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974),
+ FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603),
+ FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085),
+ FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916),
+ FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105),
+ FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931),
+ FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061),
+ FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675),
+ FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409),
+ FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665),
+ FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757),
+ FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099),
+ FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434),
+ FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855),
+ FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061),
+ FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923),
+ FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496),
+ FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291),
+ FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286),
+ FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671),
+ FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712),
+ FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032),
+ FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095),
+ FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994),
+ FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488),
+ FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242),
+ FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327),
+ FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392),
+ FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377),
+ FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491),
+ FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468),
+ FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336),
+ FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402),
+ FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722),
+ FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206),
+ FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
+ FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
+ FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
+ FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
+ FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
+ FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
+ FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
+ FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722),
+ FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402),
+ FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336),
+ FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468),
+ FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491),
+ FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377),
+ FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392),
+ FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327),
+ FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242),
+ FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488),
+ FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994),
+ FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095),
+ FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032),
+ FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712),
+ FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671),
+ FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286),
+ FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291),
+ FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496),
+ FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923),
+ FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061),
+ FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855),
+ FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434),
+ FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099),
+ FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757),
+ FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665),
+ FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409),
+ FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675),
+ FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061),
+ FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931),
+ FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105),
+ FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916),
+ FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085),
+ FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603),
+ FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974),
+ FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149),
+ FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103),
+ FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142),
+ FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669),
+ FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187),
+ FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878),
+ FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773),
+ FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914),
+ FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279),
+ FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359),
+ FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934),
+ FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822),
+ FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064),
+ FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558),
+ FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304),
+ FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617),
+ FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228),
+ FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909),
+ FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691),
+ FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127),
+ FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701),
+ FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366),
+ FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867),
+ FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387),
+ FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508),
+ FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951),
+ FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903),
+ FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762),
+ FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287),
+ FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536),
+ FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746),
+ FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964),
+ FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119),
+ FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584),
+ FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194),
+ FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803),
+ FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102),
+ FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127),
+ FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228),
+ FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438),
+ FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172),
+ FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761),
+ FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299),
+ FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589),
+ FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216),
+ FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672),
+ FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413),
+ FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367),
+ FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745),
+ FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542),
+ FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337),
+ FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279),
+ FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329),
+ FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285),
+ FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535),
+ FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698),
+ FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989),
+ FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792),
+ FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508),
+ FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986),
+ FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726),
+ FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685),
+ FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624),
+ FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839),
+ FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893),
+ FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664),
+ FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248),
+ FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768),
+ FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321),
+ FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098),
+ FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246),
+ FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447),
+ FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906),
+ FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514),
+ FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897),
+ FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394),
+ FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932),
+ FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164),
+ FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045),
+ FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507),
+ FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982),
+ FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032),
+ FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745),
+ FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118),
+ FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781),
+ FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935),
+ FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104),
+ FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828),
+ FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525),
+ FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465),
+ FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126),
+ FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557),
+ FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224),
+ FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471),
+ FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475),
+ FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015),
+ FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865),
+ FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952),
+ FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041),
+ FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274),
+ FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005),
+ FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344),
+ FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756),
+ FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803),
+ FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906),
+ FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025),
+ FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372),
+ FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525),
+ FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757),
+ FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257),
+ FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927),
+ FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949),
+ FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532),
+ FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222),
+ FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273),
+ FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621),
+ FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938),
+ FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613),
+ FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972),
+ FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498),
+ FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896),
+ FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
+};
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.c
index d3327b26c..6c9b97c24 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -77,17 +77,15 @@ static void sbr_reset(sbr_info *sbr)
#endif
/* if these are different from the previous frame: Reset = 1 */
- if((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
- (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
- (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
- (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) ||
- (sbr->bs_xover_band != sbr->bs_xover_band_prev) ||
- (sbr->bs_noise_bands != sbr->bs_noise_bands_prev))
+ if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
+ (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
+ (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
+ (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) ||
+ (sbr->bs_xover_band != sbr->bs_xover_band_prev) ||
+ (sbr->bs_noise_bands != sbr->bs_noise_bands_prev))
{
sbr->Reset = 1;
- }
- else
- {
+ } else {
sbr->Reset = 0;
}
@@ -111,28 +109,22 @@ static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_f
k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0);
/* check k0 and k2 */
- if(sbr->sample_rate >= 48000)
+ if (sbr->sample_rate >= 48000)
{
- if((k2 - sbr->k0) > 32)
+ if ((k2 - sbr->k0) > 32)
result += 1;
- }
- else if(sbr->sample_rate <= 32000)
- {
- if((k2 - sbr->k0) > 48)
+ } else if (sbr->sample_rate <= 32000) {
+ if ((k2 - sbr->k0) > 48)
result += 1;
- }
- else /* (sbr->sample_rate == 44100) */
- {
- if((k2 - sbr->k0) > 45)
+ } else { /* (sbr->sample_rate == 44100) */
+ if ((k2 - sbr->k0) > 45)
result += 1;
}
- if(freq_scale == 0)
+ if (freq_scale == 0)
{
result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale);
- }
- else
- {
+ } else {
result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale);
}
result += derived_frequency_table(sbr, xover_band, k2);
@@ -156,21 +148,21 @@ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
uint8_t saved_alter_scale, saved_xover_band;
#if (defined(PS_DEC) || defined(DRM_PS))
- if(psResetFlag)
+ if (psResetFlag)
sbr->psResetFlag = psResetFlag;
#endif
#ifdef DRM
- if(!sbr->Is_DRM_SBR)
+ if (!sbr->Is_DRM_SBR)
#endif
{
uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 198, "sbr_bitstream(): bs_extension_type"));
+ DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type"));
- if(bs_extension_type == EXT_SBR_DATA_CRC)
+ if (bs_extension_type == EXT_SBR_DATA_CRC)
{
sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10
- DEBUGVAR(1, 199, "sbr_bitstream(): bs_sbr_crc_bits"));
+ DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits"));
}
}
@@ -183,9 +175,9 @@ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
saved_xover_band = sbr->bs_xover_band;
sbr->bs_header_flag = faad_get1bit(ld
- DEBUGVAR(1, 200, "sbr_bitstream(): bs_header_flag"));
+ DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag"));
- if(sbr->bs_header_flag)
+ if (sbr->bs_header_flag)
sbr_header(ld, sbr);
/* Reset? */
@@ -193,24 +185,24 @@ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
/* first frame should have a header */
//if (!(sbr->frame == 0 && sbr->bs_header_flag == 0))
- if(sbr->header_count != 0)
+ if (sbr->header_count != 0)
{
- if(sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
+ if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
{
uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq,
- sbr->bs_samplerate_mode, sbr->bs_freq_scale,
- sbr->bs_alter_scale, sbr->bs_xover_band);
+ sbr->bs_samplerate_mode, sbr->bs_freq_scale,
+ sbr->bs_alter_scale, sbr->bs_xover_band);
/* if an error occured with the new header values revert to the old ones */
- if(rt > 0)
+ if (rt > 0)
{
calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
- saved_samplerate_mode, saved_freq_scale,
- saved_alter_scale, saved_xover_band);
+ saved_samplerate_mode, saved_freq_scale,
+ saved_alter_scale, saved_xover_band);
}
}
- if(result == 0)
+ if (result == 0)
{
result = sbr_data(ld, sbr);
@@ -220,30 +212,28 @@ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
data normally read after sbr_grid() is saved.
*/
/* to be on the safe side, calculate old sbr tables in case of error */
- if((result > 0) &&
- (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)))
+ if ((result > 0) &&
+ (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)))
{
calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
- saved_samplerate_mode, saved_freq_scale,
- saved_alter_scale, saved_xover_band);
+ saved_samplerate_mode, saved_freq_scale,
+ saved_alter_scale, saved_xover_band);
}
/* we should be able to safely set result to 0 now, */
/* but practise indicates this doesn't work well */
}
- }
- else
- {
+ } else {
result = 1;
}
num_sbr_bits2 = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits1;
/* check if we read more bits then were available for sbr */
- if(8 * cnt < num_sbr_bits2)
+ if (8*cnt < num_sbr_bits2)
{
- faad_resetbits(ld, num_sbr_bits1 + 8 * cnt);
- num_sbr_bits2 = 8 * cnt;
+ faad_resetbits(ld, num_sbr_bits1 + 8*cnt);
+ num_sbr_bits2 = 8*cnt;
#ifdef PS_DEC
/* turn off PS for the unfortunate case that we randomly read some
@@ -256,20 +246,20 @@ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
}
#ifdef DRM
- if(!sbr->Is_DRM_SBR)
+ if (!sbr->Is_DRM_SBR)
#endif
- {
+ {
/* -4 does not apply, bs_extension_type is re-read in this function */
- num_align_bits = 8 * cnt /*- 4*/ - num_sbr_bits2;
+ num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits2;
- while(num_align_bits > 7)
+ while (num_align_bits > 7)
{
faad_getbits(ld, 8
- DEBUGVAR(1, 999, "sbr_bitstream(): num_align_bits"));
+ DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
num_align_bits -= 8;
}
faad_getbits(ld, num_align_bits
- DEBUGVAR(1, 999, "sbr_bitstream(): num_align_bits"));
+ DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
}
return result;
@@ -283,53 +273,49 @@ static void sbr_header(bitfile *ld, sbr_info *sbr)
sbr->header_count++;
sbr->bs_amp_res = faad_get1bit(ld
- DEBUGVAR(1, 203, "sbr_header(): bs_amp_res"));
+ DEBUGVAR(1,203,"sbr_header(): bs_amp_res"));
/* bs_start_freq and bs_stop_freq must define a fequency band that does
not exceed 48 channels */
sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 204, "sbr_header(): bs_start_freq"));
+ DEBUGVAR(1,204,"sbr_header(): bs_start_freq"));
sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 205, "sbr_header(): bs_stop_freq"));
+ DEBUGVAR(1,205,"sbr_header(): bs_stop_freq"));
sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 206, "sbr_header(): bs_xover_band"));
+ DEBUGVAR(1,206,"sbr_header(): bs_xover_band"));
faad_getbits(ld, 2
- DEBUGVAR(1, 207, "sbr_header(): bs_reserved_bits_hdr"));
+ DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr"));
bs_header_extra_1 = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 208, "sbr_header(): bs_header_extra_1"));
+ DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1"));
bs_header_extra_2 = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 209, "sbr_header(): bs_header_extra_2"));
+ DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2"));
- if(bs_header_extra_1)
+ if (bs_header_extra_1)
{
sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 211, "sbr_header(): bs_freq_scale"));
+ DEBUGVAR(1,211,"sbr_header(): bs_freq_scale"));
sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 212, "sbr_header(): bs_alter_scale"));
+ DEBUGVAR(1,212,"sbr_header(): bs_alter_scale"));
sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 213, "sbr_header(): bs_noise_bands"));
- }
- else
- {
+ DEBUGVAR(1,213,"sbr_header(): bs_noise_bands"));
+ } else {
/* Default values */
sbr->bs_freq_scale = 2;
sbr->bs_alter_scale = 1;
sbr->bs_noise_bands = 2;
}
- if(bs_header_extra_2)
+ if (bs_header_extra_2)
{
sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 214, "sbr_header(): bs_limiter_bands"));
+ DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands"));
sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 215, "sbr_header(): bs_limiter_gains"));
+ DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains"));
sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 216, "sbr_header(): bs_interpol_freq"));
+ DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq"));
sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 217, "sbr_header(): bs_smoothing_mode"));
- }
- else
- {
+ DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode"));
+ } else {
/* Default values */
sbr->bs_limiter_bands = 2;
sbr->bs_limiter_gains = 2;
@@ -343,13 +329,13 @@ static void sbr_header(bitfile *ld, sbr_info *sbr)
printf("bs_start_freq: %d\n", sbr->bs_start_freq);
printf("bs_stop_freq: %d\n", sbr->bs_stop_freq);
printf("bs_xover_band: %d\n", sbr->bs_xover_band);
- if(bs_header_extra_1)
+ if (bs_header_extra_1)
{
printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
printf("bs_alter_scale: %d\n", sbr->bs_alter_scale);
printf("bs_noise_bands: %d\n", sbr->bs_noise_bands);
}
- if(bs_header_extra_2)
+ if (bs_header_extra_2)
{
printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains);
@@ -366,24 +352,24 @@ static uint8_t sbr_data(bitfile *ld, sbr_info *sbr)
uint8_t result;
#if 0
sbr->bs_samplerate_mode = faad_get1bit(ld
- DEBUGVAR(1, 219, "sbr_data(): bs_samplerate_mode"));
+ DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode"));
#endif
sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1;
- switch(sbr->id_aac)
+ switch (sbr->id_aac)
{
case ID_SCE:
- if((result = sbr_single_channel_element(ld, sbr)) > 0)
- return result;
+ if ((result = sbr_single_channel_element(ld, sbr)) > 0)
+ return result;
break;
case ID_CPE:
- if((result = sbr_channel_pair_element(ld, sbr)) > 0)
- return result;
+ if ((result = sbr_channel_pair_element(ld, sbr)) > 0)
+ return result;
break;
}
- return 0;
+ return 0;
}
/* table 5 */
@@ -391,22 +377,22 @@ static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
{
uint8_t result;
- if(faad_get1bit(ld
- DEBUGVAR(1, 220, "sbr_single_channel_element(): bs_data_extra")))
+ if (faad_get1bit(ld
+ DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra")))
{
faad_getbits(ld, 4
- DEBUGVAR(1, 221, "sbr_single_channel_element(): bs_reserved_bits_data"));
+ DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data"));
}
#ifdef DRM
/* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */
- if(sbr->Is_DRM_SBR)
+ if (sbr->Is_DRM_SBR)
{
faad_get1bit(ld);
}
#endif
- if((result = sbr_grid(ld, sbr, 0)) > 0)
+ if ((result = sbr_grid(ld, sbr, 0)) > 0)
return result;
sbr_dtdf(ld, sbr, 0);
@@ -418,59 +404,57 @@ static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
envelope_noise_dequantisation(sbr, 0);
#endif
- memset(sbr->bs_add_harmonic[0], 0, 64 * sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
- DEBUGVAR(1, 223, "sbr_single_channel_element(): bs_add_harmonic_flag[0]"));
- if(sbr->bs_add_harmonic_flag[0])
+ DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]"));
+ if (sbr->bs_add_harmonic_flag[0])
sinusoidal_coding(ld, sbr, 0);
sbr->bs_extended_data = faad_get1bit(ld
- DEBUGVAR(1, 224, "sbr_single_channel_element(): bs_extended_data[0]"));
+ DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]"));
- if(sbr->bs_extended_data)
+ if (sbr->bs_extended_data)
{
uint16_t nr_bits_left;
#if (defined(PS_DEC) || defined(DRM_PS))
uint8_t ps_ext_read = 0;
#endif
uint16_t cnt = (uint16_t)faad_getbits(ld, 4
- DEBUGVAR(1, 225, "sbr_single_channel_element(): bs_extension_size"));
- if(cnt == 15)
+ DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
+ if (cnt == 15)
{
cnt += (uint16_t)faad_getbits(ld, 8
- DEBUGVAR(1, 226, "sbr_single_channel_element(): bs_esc_count"));
+ DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count"));
}
nr_bits_left = 8 * cnt;
- while(nr_bits_left > 7)
+ while (nr_bits_left > 7)
{
uint16_t tmp_nr_bits = 0;
sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 227, "sbr_single_channel_element(): bs_extension_id"));
+ DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
tmp_nr_bits += 2;
/* allow only 1 PS extension element per extension data */
#if (defined(PS_DEC) || defined(DRM_PS))
#if (defined(PS_DEC) && defined(DRM_PS))
- if(sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+ if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
#else
#ifdef PS_DEC
- if(sbr->bs_extension_id == EXTENSION_ID_PS)
+ if (sbr->bs_extension_id == EXTENSION_ID_PS)
#else
#ifdef DRM_PS
- if(sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+ if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
#endif
#endif
#endif
{
- if(ps_ext_read == 0)
+ if (ps_ext_read == 0)
{
ps_ext_read = 1;
- }
- else
- {
+ } else {
/* to be safe make it 3, will switch to "default"
* in sbr_extension() */
#ifdef DRM
@@ -485,17 +469,17 @@ static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
/* check if the data read is bigger than the number of available bits */
- if(tmp_nr_bits > nr_bits_left)
+ if (tmp_nr_bits > nr_bits_left)
return 1;
nr_bits_left -= tmp_nr_bits;
}
/* Corrigendum */
- if(nr_bits_left > 0)
+ if (nr_bits_left > 0)
{
faad_getbits(ld, nr_bits_left
- DEBUGVAR(1, 280, "sbr_single_channel_element(): nr_bits_left"));
+ DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left"));
}
}
@@ -507,21 +491,21 @@ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
{
uint8_t n, result;
- if(faad_get1bit(ld
- DEBUGVAR(1, 228, "sbr_single_channel_element(): bs_data_extra")))
+ if (faad_get1bit(ld
+ DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra")))
{
faad_getbits(ld, 4
- DEBUGVAR(1, 228, "sbr_channel_pair_element(): bs_reserved_bits_data"));
+ DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
faad_getbits(ld, 4
- DEBUGVAR(1, 228, "sbr_channel_pair_element(): bs_reserved_bits_data"));
+ DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
}
sbr->bs_coupling = faad_get1bit(ld
- DEBUGVAR(1, 228, "sbr_channel_pair_element(): bs_coupling"));
+ DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling"));
- if(sbr->bs_coupling)
+ if (sbr->bs_coupling)
{
- if((result = sbr_grid(ld, sbr, 0)) > 0)
+ if ((result = sbr_grid(ld, sbr, 0)) > 0)
return result;
/* need to copy some data from left to right */
@@ -530,12 +514,12 @@ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
sbr->L_Q[1] = sbr->L_Q[0];
sbr->bs_pointer[1] = sbr->bs_pointer[0];
- for(n = 0; n <= sbr->L_E[0]; n++)
+ for (n = 0; n <= sbr->L_E[0]; n++)
{
sbr->t_E[1][n] = sbr->t_E[0][n];
sbr->f[1][n] = sbr->f[0][n];
}
- for(n = 0; n <= sbr->L_Q[0]; n++)
+ for (n = 0; n <= sbr->L_Q[0]; n++)
sbr->t_Q[1][n] = sbr->t_Q[0][n];
sbr_dtdf(ld, sbr, 0);
@@ -543,7 +527,7 @@ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
invf_mode(ld, sbr, 0);
/* more copying */
- for(n = 0; n < sbr->N_Q; n++)
+ for (n = 0; n < sbr->N_Q; n++)
sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n];
sbr_envelope(ld, sbr, 0);
@@ -551,42 +535,40 @@ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
sbr_envelope(ld, sbr, 1);
sbr_noise(ld, sbr, 1);
- memset(sbr->bs_add_harmonic[0], 0, 64 * sizeof(uint8_t));
- memset(sbr->bs_add_harmonic[1], 0, 64 * sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
- DEBUGVAR(1, 231, "sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
- if(sbr->bs_add_harmonic_flag[0])
+ DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
+ if (sbr->bs_add_harmonic_flag[0])
sinusoidal_coding(ld, sbr, 0);
sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
- DEBUGVAR(1, 232, "sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
- if(sbr->bs_add_harmonic_flag[1])
+ DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
+ if (sbr->bs_add_harmonic_flag[1])
sinusoidal_coding(ld, sbr, 1);
- }
- else
- {
+ } else {
uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0};
uint8_t saved_L_E = sbr->L_E[0];
uint8_t saved_L_Q = sbr->L_Q[0];
uint8_t saved_frame_class = sbr->bs_frame_class[0];
- for(n = 0; n < saved_L_E; n++)
+ for (n = 0; n < saved_L_E; n++)
saved_t_E[n] = sbr->t_E[0][n];
- for(n = 0; n < saved_L_Q; n++)
+ for (n = 0; n < saved_L_Q; n++)
saved_t_Q[n] = sbr->t_Q[0][n];
- if((result = sbr_grid(ld, sbr, 0)) > 0)
+ if ((result = sbr_grid(ld, sbr, 0)) > 0)
return result;
- if((result = sbr_grid(ld, sbr, 1)) > 0)
+ if ((result = sbr_grid(ld, sbr, 1)) > 0)
{
/* restore first channel data as well */
sbr->bs_frame_class[0] = saved_frame_class;
sbr->L_E[0] = saved_L_E;
sbr->L_Q[0] = saved_L_Q;
- for(n = 0; n < 6; n++)
+ for (n = 0; n < 6; n++)
sbr->t_E[0][n] = saved_t_E[n];
- for(n = 0; n < 3; n++)
+ for (n = 0; n < 3; n++)
sbr->t_Q[0][n] = saved_t_Q[n];
return result;
@@ -600,62 +582,62 @@ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
sbr_noise(ld, sbr, 0);
sbr_noise(ld, sbr, 1);
- memset(sbr->bs_add_harmonic[0], 0, 64 * sizeof(uint8_t));
- memset(sbr->bs_add_harmonic[1], 0, 64 * sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
- DEBUGVAR(1, 239, "sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
- if(sbr->bs_add_harmonic_flag[0])
+ DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
+ if (sbr->bs_add_harmonic_flag[0])
sinusoidal_coding(ld, sbr, 0);
sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
- DEBUGVAR(1, 240, "sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
- if(sbr->bs_add_harmonic_flag[1])
+ DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
+ if (sbr->bs_add_harmonic_flag[1])
sinusoidal_coding(ld, sbr, 1);
}
#ifndef FIXED_POINT
envelope_noise_dequantisation(sbr, 0);
envelope_noise_dequantisation(sbr, 1);
- if(sbr->bs_coupling)
+ if (sbr->bs_coupling)
unmap_envelope_noise(sbr);
#endif
sbr->bs_extended_data = faad_get1bit(ld
- DEBUGVAR(1, 233, "sbr_channel_pair_element(): bs_extended_data[0]"));
- if(sbr->bs_extended_data)
+ DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
+ if (sbr->bs_extended_data)
{
uint16_t nr_bits_left;
uint16_t cnt = (uint16_t)faad_getbits(ld, 4
- DEBUGVAR(1, 234, "sbr_channel_pair_element(): bs_extension_size"));
- if(cnt == 15)
+ DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size"));
+ if (cnt == 15)
{
cnt += (uint16_t)faad_getbits(ld, 8
- DEBUGVAR(1, 235, "sbr_channel_pair_element(): bs_esc_count"));
+ DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count"));
}
nr_bits_left = 8 * cnt;
- while(nr_bits_left > 7)
+ while (nr_bits_left > 7)
{
uint16_t tmp_nr_bits = 0;
sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 236, "sbr_channel_pair_element(): bs_extension_id"));
+ DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
tmp_nr_bits += 2;
tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
/* check if the data read is bigger than the number of available bits */
- if(tmp_nr_bits > nr_bits_left)
+ if (tmp_nr_bits > nr_bits_left)
return 1;
nr_bits_left -= tmp_nr_bits;
}
/* Corrigendum */
- if(nr_bits_left > 0)
+ if (nr_bits_left > 0)
{
faad_getbits(ld, nr_bits_left
- DEBUGVAR(1, 280, "sbr_channel_pair_element(): nr_bits_left"));
+ DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left"));
}
}
@@ -666,7 +648,7 @@ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
static int8_t sbr_log2(const int8_t val)
{
int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 };
- if(val < 10 && val >= 0)
+ if (val < 10 && val >= 0)
return log2tab[val];
else
return 0;
@@ -684,19 +666,19 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
uint8_t saved_frame_class = sbr->bs_frame_class[ch];
sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 248, "sbr_grid(): bs_frame_class"));
+ DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
- switch(sbr->bs_frame_class[ch])
+ switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
i = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 249, "sbr_grid(): bs_num_env_raw"));
+ DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw"));
bs_num_env = min(1 << i, 5);
i = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 250, "sbr_grid(): bs_freq_res_flag"));
- for(env = 0; env < bs_num_env; env++)
+ DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag"));
+ for (env = 0; env < bs_num_env; env++)
sbr->f[ch][env] = i;
sbr->abs_bord_lead[ch] = 0;
@@ -707,23 +689,23 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
case FIXVAR:
bs_abs_bord = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 251, "sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
+ DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
bs_num_env = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 252, "sbr_grid(): bs_num_env")) + 1;
+ DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1;
- for(rel = 0; rel < bs_num_env - 1; rel++)
+ for (rel = 0; rel < bs_num_env-1; rel++)
{
sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 253, "sbr_grid(): bs_rel_bord")) + 2;
+ DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2;
}
i = sbr_log2(bs_num_env + 1);
sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
- DEBUGVAR(1, 254, "sbr_grid(): bs_pointer"));
+ DEBUGVAR(1,254,"sbr_grid(): bs_pointer"));
- for(env = 0; env < bs_num_env; env++)
+ for (env = 0; env < bs_num_env; env++)
{
sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 255, "sbr_grid(): bs_freq_res"));
+ DEBUGVAR(1,255,"sbr_grid(): bs_freq_res"));
}
sbr->abs_bord_lead[ch] = 0;
@@ -734,23 +716,23 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
case VARFIX:
bs_abs_bord = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 256, "sbr_grid(): bs_abs_bord"));
+ DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
bs_num_env = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 257, "sbr_grid(): bs_num_env")) + 1;
+ DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1;
- for(rel = 0; rel < bs_num_env - 1; rel++)
+ for (rel = 0; rel < bs_num_env-1; rel++)
{
sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 258, "sbr_grid(): bs_rel_bord")) + 2;
+ DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2;
}
i = sbr_log2(bs_num_env + 1);
sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
- DEBUGVAR(1, 259, "sbr_grid(): bs_pointer"));
+ DEBUGVAR(1,259,"sbr_grid(): bs_pointer"));
- for(env = 0; env < bs_num_env; env++)
+ for (env = 0; env < bs_num_env; env++)
{
sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 260, "sbr_grid(): bs_freq_res"));
+ DEBUGVAR(1,260,"sbr_grid(): bs_freq_res"));
}
sbr->abs_bord_lead[ch] = bs_abs_bord;
@@ -761,34 +743,34 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
case VARVAR:
bs_abs_bord = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 261, "sbr_grid(): bs_abs_bord_0"));
+ DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 262, "sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots;
+ DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots;
sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 263, "sbr_grid(): bs_num_rel_0"));
+ DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0"));
sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 264, "sbr_grid(): bs_num_rel_1"));
+ DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1"));
bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1);
- for(rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++)
+ for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++)
{
sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 265, "sbr_grid(): bs_rel_bord")) + 2;
+ DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2;
}
for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++)
{
sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 266, "sbr_grid(): bs_rel_bord")) + 2;
+ DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2;
}
i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2);
sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
- DEBUGVAR(1, 267, "sbr_grid(): bs_pointer"));
+ DEBUGVAR(1,267,"sbr_grid(): bs_pointer"));
- for(env = 0; env < bs_num_env; env++)
+ for (env = 0; env < bs_num_env; env++)
{
sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
- DEBUGVAR(1, 268, "sbr_grid(): bs_freq_res"));
+ DEBUGVAR(1,268,"sbr_grid(): bs_freq_res"));
}
sbr->abs_bord_lead[ch] = bs_abs_bord;
@@ -798,21 +780,21 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
break;
}
- if(sbr->bs_frame_class[ch] == VARVAR)
+ if (sbr->bs_frame_class[ch] == VARVAR)
sbr->L_E[ch] = min(bs_num_env, 5);
else
sbr->L_E[ch] = min(bs_num_env, 4);
- if(sbr->L_E[ch] <= 0)
+ if (sbr->L_E[ch] <= 0)
return 1;
- if(sbr->L_E[ch] > 1)
+ if (sbr->L_E[ch] > 1)
sbr->L_Q[ch] = 2;
else
sbr->L_Q[ch] = 1;
/* TODO: this code can probably be integrated into the code above! */
- if((result = envelope_time_border_vector(sbr, ch)) > 0)
+ if ((result = envelope_time_border_vector(sbr, ch)) > 0)
{
sbr->bs_frame_class[ch] = saved_frame_class;
sbr->L_E[ch] = saved_L_E;
@@ -822,7 +804,7 @@ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
noise_floor_time_border_vector(sbr, ch);
#if 0
- for(env = 0; env < bs_num_env; env++)
+ for (env = 0; env < bs_num_env; env++)
{
printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]);
}
@@ -836,16 +818,16 @@ static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t i;
- for(i = 0; i < sbr->L_E[ch]; i++)
+ for (i = 0; i < sbr->L_E[ch]; i++)
{
sbr->bs_df_env[ch][i] = faad_get1bit(ld
- DEBUGVAR(1, 269, "sbr_dtdf(): bs_df_env"));
+ DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env"));
}
- for(i = 0; i < sbr->L_Q[ch]; i++)
+ for (i = 0; i < sbr->L_Q[ch]; i++)
{
sbr->bs_df_noise[ch][i] = faad_get1bit(ld
- DEBUGVAR(1, 270, "sbr_dtdf(): bs_df_noise"));
+ DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise"));
}
}
@@ -854,10 +836,10 @@ static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t n;
- for(n = 0; n < sbr->N_Q; n++)
+ for (n = 0; n < sbr->N_Q; n++)
{
sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 271, "invf_mode(): bs_invf_mode"));
+ DEBUGVAR(1,271,"invf_mode(): bs_invf_mode"));
}
}
@@ -869,27 +851,27 @@ static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
uint16_t ret;
#endif
- switch(bs_extension_id)
+ switch (bs_extension_id)
{
#ifdef PS_DEC
case EXTENSION_ID_PS:
- if(!sbr->ps)
+ if (!sbr->ps)
{
sbr->ps = ps_init(get_sr_index(sbr->sample_rate), sbr->numTimeSlotsRate);
}
- if(sbr->psResetFlag)
+ if (sbr->psResetFlag)
{
sbr->ps->header_read = 0;
}
ret = ps_data(sbr->ps, ld, &header);
/* enable PS if and only if: a header has been decoded */
- if(sbr->ps_used == 0 && header == 1)
+ if (sbr->ps_used == 0 && header == 1)
{
sbr->ps_used = 1;
}
- if(header == 1)
+ if (header == 1)
{
sbr->psResetFlag = 0;
}
@@ -899,7 +881,7 @@ static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
#ifdef DRM_PS
case DRM_PARAMETRIC_STEREO:
sbr->ps_used = 1;
- if(!sbr->drm_ps)
+ if (!sbr->drm_ps)
{
sbr->drm_ps = drm_ps_init();
}
@@ -907,7 +889,7 @@ static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
#endif
default:
sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
- DEBUGVAR(1, 279, "sbr_single_channel_element(): bs_extension_data"));
+ DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
return 6;
}
}
@@ -917,10 +899,10 @@ static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t n;
- for(n = 0; n < sbr->N_high; n++)
+ for (n = 0; n < sbr->N_high; n++)
{
sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld
- DEBUGVAR(1, 278, "sinusoidal_coding(): bs_add_harmonic"));
+ DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic"));
}
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.h
index fd3993470..a13b2708f 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_syntax.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -58,8 +58,8 @@ extern "C" {
#define NOISE_FLOOR_OFFSET 6
- uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
- uint8_t resetFlag);
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
+ uint8_t resetFlag);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.c
index 6e86848dc..a073d96ce 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -59,10 +59,10 @@ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];
t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
- switch(sbr->bs_frame_class[ch])
+ switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
- switch(sbr->L_E[ch])
+ switch (sbr->L_E[ch])
{
case 4:
temp = (sbr->numTimeSlots / 4);
@@ -79,14 +79,14 @@ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
break;
case FIXVAR:
- if(sbr->L_E[ch] > 1)
+ if (sbr->L_E[ch] > 1)
{
int8_t i = sbr->L_E[ch];
border = sbr->abs_bord_trail[ch];
- for(l = 0; l < (sbr->L_E[ch] - 1); l++)
+ for (l = 0; l < (sbr->L_E[ch] - 1); l++)
{
- if(border < sbr->bs_rel_bord[ch][l])
+ if (border < sbr->bs_rel_bord[ch][l])
return 1;
border -= sbr->bs_rel_bord[ch][l];
@@ -96,16 +96,16 @@ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
break;
case VARFIX:
- if(sbr->L_E[ch] > 1)
+ if (sbr->L_E[ch] > 1)
{
int8_t i = 1;
border = sbr->abs_bord_lead[ch];
- for(l = 0; l < (sbr->L_E[ch] - 1); l++)
+ for (l = 0; l < (sbr->L_E[ch] - 1); l++)
{
border += sbr->bs_rel_bord[ch][l];
- if(sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate + sbr->tHFGen)
+ if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
return 1;
t_E_temp[i++] = sbr->rate * border;
@@ -114,30 +114,30 @@ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
break;
case VARVAR:
- if(sbr->bs_num_rel_0[ch])
+ if (sbr->bs_num_rel_0[ch])
{
int8_t i = 1;
border = sbr->abs_bord_lead[ch];
- for(l = 0; l < sbr->bs_num_rel_0[ch]; l++)
+ for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
{
border += sbr->bs_rel_bord_0[ch][l];
- if(sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate + sbr->tHFGen)
+ if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
return 1;
t_E_temp[i++] = sbr->rate * border;
}
}
- if(sbr->bs_num_rel_1[ch])
+ if (sbr->bs_num_rel_1[ch])
{
int8_t i = sbr->L_E[ch];
border = sbr->abs_bord_trail[ch];
- for(l = 0; l < sbr->bs_num_rel_1[ch]; l++)
+ for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
{
- if(border < sbr->bs_rel_bord_1[ch][l])
+ if (border < sbr->bs_rel_bord_1[ch][l])
return 1;
border -= sbr->bs_rel_bord_1[ch][l];
@@ -148,7 +148,7 @@ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
}
/* no error occured, we can safely use this t_E vector */
- for(l = 0; l < 6; l++)
+ for (l = 0; l < 6; l++)
{
sbr->t_E[ch][l] = t_E_temp[l];
}
@@ -160,13 +160,11 @@ void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
{
sbr->t_Q[ch][0] = sbr->t_E[ch][0];
- if(sbr->L_E[ch] == 1)
+ if (sbr->L_E[ch] == 1)
{
sbr->t_Q[ch][1] = sbr->t_E[ch][1];
sbr->t_Q[ch][2] = 0;
- }
- else
- {
+ } else {
uint8_t index = middleBorder(sbr, ch);
sbr->t_Q[ch][1] = sbr->t_E[ch][index];
sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
@@ -179,20 +177,20 @@ static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
uint8_t i;
int16_t acc = 0;
- switch(sbr->bs_frame_class[ch])
+ switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
- return sbr->numTimeSlots / sbr->L_E[ch];
+ return sbr->numTimeSlots/sbr->L_E[ch];
case FIXVAR:
return 0;
case VARFIX:
- for(i = 0; i < l; i++)
+ for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord[ch][i];
}
return acc;
case VARVAR:
- for(i = 0; i < l; i++)
+ for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord_0[ch][i];
}
@@ -207,19 +205,19 @@ static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
uint8_t i;
int16_t acc = 0;
- switch(sbr->bs_frame_class[ch])
+ switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
case VARFIX:
return 0;
case FIXVAR:
- for(i = 0; i < l; i++)
+ for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord[ch][i];
}
return acc;
case VARVAR:
- for(i = 0; i < l; i++)
+ for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord_1[ch][i];
}
@@ -234,22 +232,22 @@ static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
{
int8_t retval = 0;
- switch(sbr->bs_frame_class[ch])
+ switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
- retval = sbr->L_E[ch] / 2;
+ retval = sbr->L_E[ch]/2;
break;
case VARFIX:
- if(sbr->bs_pointer[ch] == 0)
+ if (sbr->bs_pointer[ch] == 0)
retval = 1;
- else if(sbr->bs_pointer[ch] == 1)
+ else if (sbr->bs_pointer[ch] == 1)
retval = sbr->L_E[ch] - 1;
else
retval = sbr->bs_pointer[ch] - 1;
break;
case FIXVAR:
case VARVAR:
- if(sbr->bs_pointer[ch] > 1)
+ if (sbr->bs_pointer[ch] > 1)
retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
else
retval = sbr->L_E[ch] - 1;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.h
index 009e09534..27a8f908e 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sbr_tf_grid.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -36,8 +36,8 @@ extern "C" {
#endif
- uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
- void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
+uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
+void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/sine_win.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/sine_win.h
index ee5cc1a78..e4198da3a 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/sine_win.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/sine_win.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -40,4261 +40,4261 @@ extern "C" {
#pragma warning(disable:4244)
#endif
- ALIGN static const real_t sine_long_1024[] =
- {
- FRAC_CONST(0.00076699031874270449),
- FRAC_CONST(0.002300969151425805),
- FRAC_CONST(0.0038349425697062275),
- FRAC_CONST(0.0053689069639963425),
- FRAC_CONST(0.0069028587247297558),
- FRAC_CONST(0.0084367942423697988),
- FRAC_CONST(0.0099707099074180308),
- FRAC_CONST(0.011504602110422714),
- FRAC_CONST(0.013038467241987334),
- FRAC_CONST(0.014572301692779064),
- FRAC_CONST(0.016106101853537287),
- FRAC_CONST(0.017639864115082053),
- FRAC_CONST(0.019173584868322623),
- FRAC_CONST(0.020707260504265895),
- FRAC_CONST(0.022240887414024961),
- FRAC_CONST(0.023774461988827555),
- FRAC_CONST(0.025307980620024571),
- FRAC_CONST(0.026841439699098531),
- FRAC_CONST(0.028374835617672099),
- FRAC_CONST(0.029908164767516555),
- FRAC_CONST(0.031441423540560301),
- FRAC_CONST(0.032974608328897335),
- FRAC_CONST(0.03450771552479575),
- FRAC_CONST(0.036040741520706229),
- FRAC_CONST(0.037573682709270494),
- FRAC_CONST(0.039106535483329888),
- FRAC_CONST(0.040639296235933736),
- FRAC_CONST(0.042171961360347947),
- FRAC_CONST(0.043704527250063421),
- FRAC_CONST(0.04523699029880459),
- FRAC_CONST(0.046769346900537863),
- FRAC_CONST(0.048301593449480144),
- FRAC_CONST(0.049833726340107277),
- FRAC_CONST(0.051365741967162593),
- FRAC_CONST(0.052897636725665324),
- FRAC_CONST(0.054429407010919133),
- FRAC_CONST(0.055961049218520569),
- FRAC_CONST(0.057492559744367566),
- FRAC_CONST(0.059023934984667931),
- FRAC_CONST(0.060555171335947788),
- FRAC_CONST(0.062086265195060088),
- FRAC_CONST(0.063617212959193106),
- FRAC_CONST(0.065148011025878833),
- FRAC_CONST(0.066678655793001557),
- FRAC_CONST(0.068209143658806329),
- FRAC_CONST(0.069739471021907307),
- FRAC_CONST(0.071269634281296401),
- FRAC_CONST(0.072799629836351673),
- FRAC_CONST(0.074329454086845756),
- FRAC_CONST(0.075859103432954447),
- FRAC_CONST(0.077388574275265049),
- FRAC_CONST(0.078917863014784942),
- FRAC_CONST(0.080446966052950014),
- FRAC_CONST(0.081975879791633066),
- FRAC_CONST(0.083504600633152432),
- FRAC_CONST(0.085033124980280275),
- FRAC_CONST(0.08656144923625117),
- FRAC_CONST(0.088089569804770507),
- FRAC_CONST(0.089617483090022959),
- FRAC_CONST(0.091145185496681005),
- FRAC_CONST(0.09267267342991331),
- FRAC_CONST(0.094199943295393204),
- FRAC_CONST(0.095726991499307162),
- FRAC_CONST(0.097253814448363271),
- FRAC_CONST(0.098780408549799623),
- FRAC_CONST(0.10030677021139286),
- FRAC_CONST(0.10183289584146653),
- FRAC_CONST(0.10335878184889961),
- FRAC_CONST(0.10488442464313497),
- FRAC_CONST(0.10640982063418768),
- FRAC_CONST(0.10793496623265365),
- FRAC_CONST(0.10945985784971798),
- FRAC_CONST(0.11098449189716339),
- FRAC_CONST(0.11250886478737869),
- FRAC_CONST(0.1140329729333672),
- FRAC_CONST(0.11555681274875526),
- FRAC_CONST(0.11708038064780059),
- FRAC_CONST(0.11860367304540072),
- FRAC_CONST(0.1201266863571015),
- FRAC_CONST(0.12164941699910553),
- FRAC_CONST(0.12317186138828048),
- FRAC_CONST(0.12469401594216764),
- FRAC_CONST(0.12621587707899035),
- FRAC_CONST(0.12773744121766231),
- FRAC_CONST(0.12925870477779614),
- FRAC_CONST(0.13077966417971171),
- FRAC_CONST(0.13230031584444465),
- FRAC_CONST(0.13382065619375472),
- FRAC_CONST(0.13534068165013421),
- FRAC_CONST(0.13686038863681638),
- FRAC_CONST(0.13837977357778389),
- FRAC_CONST(0.13989883289777721),
- FRAC_CONST(0.14141756302230302),
- FRAC_CONST(0.14293596037764267),
- FRAC_CONST(0.14445402139086047),
- FRAC_CONST(0.14597174248981221),
- FRAC_CONST(0.14748912010315357),
- FRAC_CONST(0.14900615066034845),
- FRAC_CONST(0.1505228305916774),
- FRAC_CONST(0.15203915632824605),
- FRAC_CONST(0.15355512430199345),
- FRAC_CONST(0.15507073094570051),
- FRAC_CONST(0.15658597269299843),
- FRAC_CONST(0.15810084597837698),
- FRAC_CONST(0.15961534723719306),
- FRAC_CONST(0.16112947290567881),
- FRAC_CONST(0.16264321942095031),
- FRAC_CONST(0.16415658322101581),
- FRAC_CONST(0.16566956074478412),
- FRAC_CONST(0.16718214843207294),
- FRAC_CONST(0.16869434272361733),
- FRAC_CONST(0.17020614006107807),
- FRAC_CONST(0.17171753688704997),
- FRAC_CONST(0.17322852964507032),
- FRAC_CONST(0.1747391147796272),
- FRAC_CONST(0.17624928873616788),
- FRAC_CONST(0.17775904796110717),
- FRAC_CONST(0.17926838890183575),
- FRAC_CONST(0.18077730800672859),
- FRAC_CONST(0.1822858017251533),
- FRAC_CONST(0.18379386650747845),
- FRAC_CONST(0.1853014988050819),
- FRAC_CONST(0.18680869507035927),
- FRAC_CONST(0.18831545175673212),
- FRAC_CONST(0.18982176531865641),
- FRAC_CONST(0.1913276322116309),
- FRAC_CONST(0.19283304889220523),
- FRAC_CONST(0.1943380118179886),
- FRAC_CONST(0.19584251744765785),
- FRAC_CONST(0.19734656224096592),
- FRAC_CONST(0.19885014265875009),
- FRAC_CONST(0.20035325516294045),
- FRAC_CONST(0.20185589621656805),
- FRAC_CONST(0.20335806228377332),
- FRAC_CONST(0.20485974982981442),
- FRAC_CONST(0.20636095532107551),
- FRAC_CONST(0.20786167522507507),
- FRAC_CONST(0.20936190601047416),
- FRAC_CONST(0.21086164414708486),
- FRAC_CONST(0.21236088610587842),
- FRAC_CONST(0.21385962835899375),
- FRAC_CONST(0.21535786737974555),
- FRAC_CONST(0.21685559964263262),
- FRAC_CONST(0.21835282162334632),
- FRAC_CONST(0.2198495297987787),
- FRAC_CONST(0.22134572064703081),
- FRAC_CONST(0.22284139064742112),
- FRAC_CONST(0.2243365362804936),
- FRAC_CONST(0.22583115402802617),
- FRAC_CONST(0.22732524037303886),
- FRAC_CONST(0.22881879179980222),
- FRAC_CONST(0.23031180479384544),
- FRAC_CONST(0.23180427584196478),
- FRAC_CONST(0.23329620143223159),
- FRAC_CONST(0.23478757805400097),
- FRAC_CONST(0.23627840219791957),
- FRAC_CONST(0.23776867035593419),
- FRAC_CONST(0.23925837902129998),
- FRAC_CONST(0.24074752468858843),
- FRAC_CONST(0.24223610385369601),
- FRAC_CONST(0.24372411301385216),
- FRAC_CONST(0.24521154866762754),
- FRAC_CONST(0.24669840731494241),
- FRAC_CONST(0.24818468545707478),
- FRAC_CONST(0.24967037959666857),
- FRAC_CONST(0.25115548623774192),
- FRAC_CONST(0.25264000188569552),
- FRAC_CONST(0.25412392304732062),
- FRAC_CONST(0.25560724623080738),
- FRAC_CONST(0.25708996794575312),
- FRAC_CONST(0.25857208470317034),
- FRAC_CONST(0.26005359301549519),
- FRAC_CONST(0.26153448939659552),
- FRAC_CONST(0.263014770361779),
- FRAC_CONST(0.26449443242780163),
- FRAC_CONST(0.26597347211287559),
- FRAC_CONST(0.26745188593667762),
- FRAC_CONST(0.26892967042035726),
- FRAC_CONST(0.27040682208654482),
- FRAC_CONST(0.27188333745935972),
- FRAC_CONST(0.27335921306441868),
- FRAC_CONST(0.27483444542884394),
- FRAC_CONST(0.27630903108127108),
- FRAC_CONST(0.27778296655185769),
- FRAC_CONST(0.27925624837229118),
- FRAC_CONST(0.28072887307579719),
- FRAC_CONST(0.28220083719714756),
- FRAC_CONST(0.28367213727266843),
- FRAC_CONST(0.28514276984024867),
- FRAC_CONST(0.28661273143934779),
- FRAC_CONST(0.28808201861100413),
- FRAC_CONST(0.28955062789784303),
- FRAC_CONST(0.29101855584408509),
- FRAC_CONST(0.29248579899555388),
- FRAC_CONST(0.29395235389968466),
- FRAC_CONST(0.29541821710553201),
- FRAC_CONST(0.29688338516377827),
- FRAC_CONST(0.2983478546267414),
- FRAC_CONST(0.29981162204838335),
- FRAC_CONST(0.30127468398431795),
- FRAC_CONST(0.30273703699181914),
- FRAC_CONST(0.30419867762982911),
- FRAC_CONST(0.30565960245896612),
- FRAC_CONST(0.3071198080415331),
- FRAC_CONST(0.30857929094152509),
- FRAC_CONST(0.31003804772463789),
- FRAC_CONST(0.31149607495827591),
- FRAC_CONST(0.3129533692115602),
- FRAC_CONST(0.31440992705533666),
- FRAC_CONST(0.31586574506218396),
- FRAC_CONST(0.31732081980642174),
- FRAC_CONST(0.31877514786411848),
- FRAC_CONST(0.32022872581309986),
- FRAC_CONST(0.32168155023295658),
- FRAC_CONST(0.32313361770505233),
- FRAC_CONST(0.32458492481253215),
- FRAC_CONST(0.32603546814033024),
- FRAC_CONST(0.327485244275178),
- FRAC_CONST(0.3289342498056122),
- FRAC_CONST(0.33038248132198278),
- FRAC_CONST(0.33182993541646111),
- FRAC_CONST(0.33327660868304793),
- FRAC_CONST(0.33472249771758122),
- FRAC_CONST(0.33616759911774452),
- FRAC_CONST(0.33761190948307462),
- FRAC_CONST(0.33905542541496964),
- FRAC_CONST(0.34049814351669716),
- FRAC_CONST(0.34194006039340219),
- FRAC_CONST(0.34338117265211504),
- FRAC_CONST(0.34482147690175929),
- FRAC_CONST(0.34626096975316001),
- FRAC_CONST(0.34769964781905138),
- FRAC_CONST(0.34913750771408497),
- FRAC_CONST(0.35057454605483751),
- FRAC_CONST(0.35201075945981908),
- FRAC_CONST(0.35344614454948081),
- FRAC_CONST(0.35488069794622279),
- FRAC_CONST(0.35631441627440241),
- FRAC_CONST(0.3577472961603419),
- FRAC_CONST(0.3591793342323365),
- FRAC_CONST(0.36061052712066227),
- FRAC_CONST(0.36204087145758418),
- FRAC_CONST(0.36347036387736376),
- FRAC_CONST(0.36489900101626732),
- FRAC_CONST(0.36632677951257359),
- FRAC_CONST(0.36775369600658198),
- FRAC_CONST(0.36917974714062002),
- FRAC_CONST(0.37060492955905167),
- FRAC_CONST(0.37202923990828501),
- FRAC_CONST(0.3734526748367803),
- FRAC_CONST(0.37487523099505754),
- FRAC_CONST(0.37629690503570479),
- FRAC_CONST(0.37771769361338564),
- FRAC_CONST(0.37913759338484732),
- FRAC_CONST(0.38055660100892852),
- FRAC_CONST(0.38197471314656722),
- FRAC_CONST(0.38339192646080866),
- FRAC_CONST(0.38480823761681288),
- FRAC_CONST(0.38622364328186298),
- FRAC_CONST(0.38763814012537273),
- FRAC_CONST(0.38905172481889438),
- FRAC_CONST(0.39046439403612659),
- FRAC_CONST(0.39187614445292235),
- FRAC_CONST(0.3932869727472964),
- FRAC_CONST(0.39469687559943356),
- FRAC_CONST(0.39610584969169627),
- FRAC_CONST(0.39751389170863233),
- FRAC_CONST(0.39892099833698291),
- FRAC_CONST(0.40032716626569009),
- FRAC_CONST(0.40173239218590501),
- FRAC_CONST(0.4031366727909953),
- FRAC_CONST(0.404540004776553),
- FRAC_CONST(0.40594238484040251),
- FRAC_CONST(0.40734380968260797),
- FRAC_CONST(0.40874427600548136),
- FRAC_CONST(0.41014378051359024),
- FRAC_CONST(0.41154231991376522),
- FRAC_CONST(0.41293989091510808),
- FRAC_CONST(0.4143364902289991),
- FRAC_CONST(0.41573211456910536),
- FRAC_CONST(0.41712676065138787),
- FRAC_CONST(0.4185204251941097),
- FRAC_CONST(0.41991310491784362),
- FRAC_CONST(0.42130479654547964),
- FRAC_CONST(0.42269549680223295),
- FRAC_CONST(0.42408520241565156),
- FRAC_CONST(0.4254739101156238),
- FRAC_CONST(0.42686161663438643),
- FRAC_CONST(0.42824831870653196),
- FRAC_CONST(0.42963401306901638),
- FRAC_CONST(0.43101869646116703),
- FRAC_CONST(0.43240236562469014),
- FRAC_CONST(0.43378501730367852),
- FRAC_CONST(0.43516664824461926),
- FRAC_CONST(0.4365472551964012),
- FRAC_CONST(0.43792683491032286),
- FRAC_CONST(0.43930538414009995),
- FRAC_CONST(0.4406828996418729),
- FRAC_CONST(0.4420593781742147),
- FRAC_CONST(0.44343481649813848),
- FRAC_CONST(0.44480921137710488),
- FRAC_CONST(0.44618255957703007),
- FRAC_CONST(0.44755485786629301),
- FRAC_CONST(0.44892610301574326),
- FRAC_CONST(0.45029629179870861),
- FRAC_CONST(0.45166542099100249),
- FRAC_CONST(0.45303348737093158),
- FRAC_CONST(0.45440048771930358),
- FRAC_CONST(0.45576641881943464),
- FRAC_CONST(0.45713127745715698),
- FRAC_CONST(0.45849506042082627),
- FRAC_CONST(0.45985776450132954),
- FRAC_CONST(0.46121938649209238),
- FRAC_CONST(0.46257992318908681),
- FRAC_CONST(0.46393937139083852),
- FRAC_CONST(0.4652977278984346),
- FRAC_CONST(0.46665498951553092),
- FRAC_CONST(0.46801115304835983),
- FRAC_CONST(0.46936621530573752),
- FRAC_CONST(0.4707201730990716),
- FRAC_CONST(0.47207302324236866),
- FRAC_CONST(0.47342476255224153),
- FRAC_CONST(0.47477538784791712),
- FRAC_CONST(0.47612489595124358),
- FRAC_CONST(0.47747328368669806),
- FRAC_CONST(0.47882054788139389),
- FRAC_CONST(0.48016668536508839),
- FRAC_CONST(0.48151169297018986),
- FRAC_CONST(0.48285556753176567),
- FRAC_CONST(0.48419830588754903),
- FRAC_CONST(0.48553990487794696),
- FRAC_CONST(0.48688036134604734),
- FRAC_CONST(0.48821967213762679),
- FRAC_CONST(0.48955783410115744),
- FRAC_CONST(0.49089484408781509),
- FRAC_CONST(0.49223069895148602),
- FRAC_CONST(0.49356539554877477),
- FRAC_CONST(0.49489893073901126),
- FRAC_CONST(0.49623130138425825),
- FRAC_CONST(0.49756250434931915),
- FRAC_CONST(0.49889253650174459),
- FRAC_CONST(0.50022139471184068),
- FRAC_CONST(0.50154907585267539),
- FRAC_CONST(0.50287557680008699),
- FRAC_CONST(0.50420089443269034),
- FRAC_CONST(0.50552502563188539),
- FRAC_CONST(0.50684796728186321),
- FRAC_CONST(0.5081697162696146),
- FRAC_CONST(0.50949026948493636),
- FRAC_CONST(0.51080962382043904),
- FRAC_CONST(0.51212777617155469),
- FRAC_CONST(0.51344472343654346),
- FRAC_CONST(0.5147604625165012),
- FRAC_CONST(0.51607499031536663),
- FRAC_CONST(0.51738830373992906),
- FRAC_CONST(0.51870039969983495),
- FRAC_CONST(0.52001127510759604),
- FRAC_CONST(0.52132092687859566),
- FRAC_CONST(0.52262935193109661),
- FRAC_CONST(0.5239365471862486),
- FRAC_CONST(0.52524250956809471),
- FRAC_CONST(0.52654723600357944),
- FRAC_CONST(0.52785072342255523),
- FRAC_CONST(0.52915296875779061),
- FRAC_CONST(0.53045396894497632),
- FRAC_CONST(0.53175372092273332),
- FRAC_CONST(0.53305222163261945),
- FRAC_CONST(0.53434946801913752),
- FRAC_CONST(0.53564545702974109),
- FRAC_CONST(0.53694018561484291),
- FRAC_CONST(0.5382336507278217),
- FRAC_CONST(0.53952584932502889),
- FRAC_CONST(0.54081677836579667),
- FRAC_CONST(0.54210643481244392),
- FRAC_CONST(0.5433948156302848),
- FRAC_CONST(0.54468191778763453),
- FRAC_CONST(0.54596773825581757),
- FRAC_CONST(0.54725227400917409),
- FRAC_CONST(0.54853552202506739),
- FRAC_CONST(0.54981747928389091),
- FRAC_CONST(0.55109814276907543),
- FRAC_CONST(0.55237750946709607),
- FRAC_CONST(0.55365557636747931),
- FRAC_CONST(0.55493234046281037),
- FRAC_CONST(0.55620779874873993),
- FRAC_CONST(0.55748194822399155),
- FRAC_CONST(0.55875478589036831),
- FRAC_CONST(0.56002630875276038),
- FRAC_CONST(0.56129651381915147),
- FRAC_CONST(0.56256539810062656),
- FRAC_CONST(0.56383295861137817),
- FRAC_CONST(0.56509919236871398),
- FRAC_CONST(0.56636409639306384),
- FRAC_CONST(0.56762766770798623),
- FRAC_CONST(0.56888990334017586),
- FRAC_CONST(0.5701508003194703),
- FRAC_CONST(0.57141035567885723),
- FRAC_CONST(0.57266856645448116),
- FRAC_CONST(0.57392542968565075),
- FRAC_CONST(0.57518094241484508),
- FRAC_CONST(0.57643510168772183),
- FRAC_CONST(0.5776879045531228),
- FRAC_CONST(0.57893934806308178),
- FRAC_CONST(0.58018942927283168),
- FRAC_CONST(0.58143814524081017),
- FRAC_CONST(0.58268549302866846),
- FRAC_CONST(0.58393146970127618),
- FRAC_CONST(0.58517607232673041),
- FRAC_CONST(0.5864192979763605),
- FRAC_CONST(0.58766114372473666),
- FRAC_CONST(0.58890160664967572),
- FRAC_CONST(0.59014068383224882),
- FRAC_CONST(0.59137837235678758),
- FRAC_CONST(0.59261466931089113),
- FRAC_CONST(0.59384957178543363),
- FRAC_CONST(0.59508307687456996),
- FRAC_CONST(0.59631518167574371),
- FRAC_CONST(0.59754588328969316),
- FRAC_CONST(0.59877517882045872),
- FRAC_CONST(0.60000306537538894),
- FRAC_CONST(0.6012295400651485),
- FRAC_CONST(0.60245460000372375),
- FRAC_CONST(0.60367824230843037),
- FRAC_CONST(0.60490046409991982),
- FRAC_CONST(0.60612126250218612),
- FRAC_CONST(0.60734063464257293),
- FRAC_CONST(0.60855857765177945),
- FRAC_CONST(0.60977508866386843),
- FRAC_CONST(0.61099016481627166),
- FRAC_CONST(0.61220380324979795),
- FRAC_CONST(0.61341600110863859),
- FRAC_CONST(0.61462675554037505),
- FRAC_CONST(0.61583606369598509),
- FRAC_CONST(0.61704392272984976),
- FRAC_CONST(0.61825032979976025),
- FRAC_CONST(0.61945528206692402),
- FRAC_CONST(0.62065877669597214),
- FRAC_CONST(0.62186081085496536),
- FRAC_CONST(0.62306138171540126),
- FRAC_CONST(0.62426048645222065),
- FRAC_CONST(0.62545812224381436),
- FRAC_CONST(0.62665428627202935),
- FRAC_CONST(0.62784897572217646),
- FRAC_CONST(0.629042187783036),
- FRAC_CONST(0.63023391964686437),
- FRAC_CONST(0.63142416850940186),
- FRAC_CONST(0.63261293156987741),
- FRAC_CONST(0.63380020603101728),
- FRAC_CONST(0.63498598909904946),
- FRAC_CONST(0.63617027798371217),
- FRAC_CONST(0.63735306989825913),
- FRAC_CONST(0.63853436205946679),
- FRAC_CONST(0.63971415168764045),
- FRAC_CONST(0.64089243600662138),
- FRAC_CONST(0.64206921224379254),
- FRAC_CONST(0.64324447763008585),
- FRAC_CONST(0.64441822939998838),
- FRAC_CONST(0.64559046479154869),
- FRAC_CONST(0.64676118104638392),
- FRAC_CONST(0.64793037540968534),
- FRAC_CONST(0.64909804513022595),
- FRAC_CONST(0.65026418746036585),
- FRAC_CONST(0.65142879965605982),
- FRAC_CONST(0.65259187897686244),
- FRAC_CONST(0.65375342268593606),
- FRAC_CONST(0.65491342805005603),
- FRAC_CONST(0.6560718923396176),
- FRAC_CONST(0.65722881282864254),
- FRAC_CONST(0.65838418679478505),
- FRAC_CONST(0.65953801151933866),
- FRAC_CONST(0.6606902842872423),
- FRAC_CONST(0.66184100238708687),
- FRAC_CONST(0.66299016311112147),
- FRAC_CONST(0.66413776375526001),
- FRAC_CONST(0.66528380161908718),
- FRAC_CONST(0.66642827400586524),
- FRAC_CONST(0.66757117822254031),
- FRAC_CONST(0.66871251157974798),
- FRAC_CONST(0.66985227139182102),
- FRAC_CONST(0.67099045497679422),
- FRAC_CONST(0.67212705965641173),
- FRAC_CONST(0.67326208275613297),
- FRAC_CONST(0.67439552160513905),
- FRAC_CONST(0.67552737353633852),
- FRAC_CONST(0.67665763588637495),
- FRAC_CONST(0.6777863059956315),
- FRAC_CONST(0.67891338120823841),
- FRAC_CONST(0.68003885887207893),
- FRAC_CONST(0.68116273633879543),
- FRAC_CONST(0.68228501096379557),
- FRAC_CONST(0.68340568010625868),
- FRAC_CONST(0.6845247411291423),
- FRAC_CONST(0.68564219139918747),
- FRAC_CONST(0.68675802828692589),
- FRAC_CONST(0.68787224916668555),
- FRAC_CONST(0.68898485141659704),
- FRAC_CONST(0.69009583241859995),
- FRAC_CONST(0.69120518955844845),
- FRAC_CONST(0.69231292022571822),
- FRAC_CONST(0.69341902181381176),
- FRAC_CONST(0.69452349171996552),
- FRAC_CONST(0.69562632734525487),
- FRAC_CONST(0.6967275260946012),
- FRAC_CONST(0.69782708537677729),
- FRAC_CONST(0.69892500260441415),
- FRAC_CONST(0.70002127519400625),
- FRAC_CONST(0.70111590056591866),
- FRAC_CONST(0.70220887614439187),
- FRAC_CONST(0.70330019935754873),
- FRAC_CONST(0.70438986763740041),
- FRAC_CONST(0.7054778784198521),
- FRAC_CONST(0.70656422914470951),
- FRAC_CONST(0.70764891725568435),
- FRAC_CONST(0.70873194020040065),
- FRAC_CONST(0.70981329543040084),
- FRAC_CONST(0.71089298040115168),
- FRAC_CONST(0.71197099257204999),
- FRAC_CONST(0.71304732940642923),
- FRAC_CONST(0.71412198837156471),
- FRAC_CONST(0.71519496693868001),
- FRAC_CONST(0.71626626258295312),
- FRAC_CONST(0.71733587278352173),
- FRAC_CONST(0.71840379502348972),
- FRAC_CONST(0.71947002678993299),
- FRAC_CONST(0.72053456557390527),
- FRAC_CONST(0.72159740887044366),
- FRAC_CONST(0.72265855417857561),
- FRAC_CONST(0.72371799900132339),
- FRAC_CONST(0.72477574084571128),
- FRAC_CONST(0.72583177722277037),
- FRAC_CONST(0.72688610564754497),
- FRAC_CONST(0.72793872363909862),
- FRAC_CONST(0.72898962872051931),
- FRAC_CONST(0.73003881841892615),
- FRAC_CONST(0.73108629026547423),
- FRAC_CONST(0.73213204179536129),
- FRAC_CONST(0.73317607054783274),
- FRAC_CONST(0.73421837406618817),
- FRAC_CONST(0.73525894989778673),
- FRAC_CONST(0.73629779559405306),
- FRAC_CONST(0.73733490871048279),
- FRAC_CONST(0.73837028680664851),
- FRAC_CONST(0.73940392744620576),
- FRAC_CONST(0.74043582819689802),
- FRAC_CONST(0.74146598663056329),
- FRAC_CONST(0.74249440032313918),
- FRAC_CONST(0.74352106685466912),
- FRAC_CONST(0.74454598380930725),
- FRAC_CONST(0.74556914877532543),
- FRAC_CONST(0.74659055934511731),
- FRAC_CONST(0.74761021311520515),
- FRAC_CONST(0.74862810768624533),
- FRAC_CONST(0.74964424066303348),
- FRAC_CONST(0.75065860965451059),
- FRAC_CONST(0.75167121227376843),
- FRAC_CONST(0.75268204613805523),
- FRAC_CONST(0.75369110886878121),
- FRAC_CONST(0.75469839809152439),
- FRAC_CONST(0.75570391143603588),
- FRAC_CONST(0.75670764653624567),
- FRAC_CONST(0.75770960103026808),
- FRAC_CONST(0.75870977256040739),
- FRAC_CONST(0.75970815877316344),
- FRAC_CONST(0.76070475731923692),
- FRAC_CONST(0.76169956585353527),
- FRAC_CONST(0.76269258203517787),
- FRAC_CONST(0.76368380352750187),
- FRAC_CONST(0.76467322799806714),
- FRAC_CONST(0.76566085311866239),
- FRAC_CONST(0.76664667656531038),
- FRAC_CONST(0.76763069601827327),
- FRAC_CONST(0.76861290916205827),
- FRAC_CONST(0.76959331368542294),
- FRAC_CONST(0.7705719072813807),
- FRAC_CONST(0.7715486876472063),
- FRAC_CONST(0.77252365248444133),
- FRAC_CONST(0.77349679949889905),
- FRAC_CONST(0.77446812640067086),
- FRAC_CONST(0.77543763090413043),
- FRAC_CONST(0.77640531072794039),
- FRAC_CONST(0.7773711635950562),
- FRAC_CONST(0.77833518723273309),
- FRAC_CONST(0.7792973793725303),
- FRAC_CONST(0.78025773775031659),
- FRAC_CONST(0.78121626010627609),
- FRAC_CONST(0.7821729441849129),
- FRAC_CONST(0.78312778773505731),
- FRAC_CONST(0.78408078850986995),
- FRAC_CONST(0.78503194426684808),
- FRAC_CONST(0.78598125276783015),
- FRAC_CONST(0.7869287117790017),
- FRAC_CONST(0.78787431907090011),
- FRAC_CONST(0.78881807241842017),
- FRAC_CONST(0.78975996960081907),
- FRAC_CONST(0.79070000840172161),
- FRAC_CONST(0.79163818660912577),
- FRAC_CONST(0.79257450201540758),
- FRAC_CONST(0.79350895241732666),
- FRAC_CONST(0.79444153561603059),
- FRAC_CONST(0.79537224941706119),
- FRAC_CONST(0.79630109163035911),
- FRAC_CONST(0.7972280600702687),
- FRAC_CONST(0.79815315255554375),
- FRAC_CONST(0.79907636690935235),
- FRAC_CONST(0.79999770095928191),
- FRAC_CONST(0.8009171525373443),
- FRAC_CONST(0.80183471947998131),
- FRAC_CONST(0.80275039962806916),
- FRAC_CONST(0.80366419082692409),
- FRAC_CONST(0.804576090926307),
- FRAC_CONST(0.80548609778042912),
- FRAC_CONST(0.80639420924795624),
- FRAC_CONST(0.80730042319201445),
- FRAC_CONST(0.80820473748019472),
- FRAC_CONST(0.80910714998455813),
- FRAC_CONST(0.81000765858164114),
- FRAC_CONST(0.81090626115245967),
- FRAC_CONST(0.81180295558251536),
- FRAC_CONST(0.81269773976179949),
- FRAC_CONST(0.81359061158479851),
- FRAC_CONST(0.81448156895049861),
- FRAC_CONST(0.81537060976239129),
- FRAC_CONST(0.81625773192847739),
- FRAC_CONST(0.81714293336127297),
- FRAC_CONST(0.81802621197781344),
- FRAC_CONST(0.81890756569965895),
- FRAC_CONST(0.81978699245289899),
- FRAC_CONST(0.82066449016815746),
- FRAC_CONST(0.82154005678059761),
- FRAC_CONST(0.82241369022992639),
- FRAC_CONST(0.82328538846040011),
- FRAC_CONST(0.82415514942082857),
- FRAC_CONST(0.82502297106458022),
- FRAC_CONST(0.82588885134958678),
- FRAC_CONST(0.82675278823834852),
- FRAC_CONST(0.8276147796979384),
- FRAC_CONST(0.82847482370000713),
- FRAC_CONST(0.82933291822078825),
- FRAC_CONST(0.83018906124110237),
- FRAC_CONST(0.83104325074636232),
- FRAC_CONST(0.83189548472657759),
- FRAC_CONST(0.83274576117635946),
- FRAC_CONST(0.83359407809492514),
- FRAC_CONST(0.83444043348610319),
- FRAC_CONST(0.83528482535833737),
- FRAC_CONST(0.83612725172469216),
- FRAC_CONST(0.83696771060285702),
- FRAC_CONST(0.83780620001515094),
- FRAC_CONST(0.8386427179885273),
- FRAC_CONST(0.83947726255457855),
- FRAC_CONST(0.84030983174954077),
- FRAC_CONST(0.84114042361429808),
- FRAC_CONST(0.84196903619438768),
- FRAC_CONST(0.84279566754000412),
- FRAC_CONST(0.84362031570600404),
- FRAC_CONST(0.84444297875191066),
- FRAC_CONST(0.84526365474191822),
- FRAC_CONST(0.84608234174489694),
- FRAC_CONST(0.84689903783439735),
- FRAC_CONST(0.84771374108865427),
- FRAC_CONST(0.84852644959059265),
- FRAC_CONST(0.84933716142783067),
- FRAC_CONST(0.85014587469268521),
- FRAC_CONST(0.85095258748217573),
- FRAC_CONST(0.85175729789802912),
- FRAC_CONST(0.85256000404668397),
- FRAC_CONST(0.85336070403929543),
- FRAC_CONST(0.85415939599173873),
- FRAC_CONST(0.85495607802461482),
- FRAC_CONST(0.85575074826325392),
- FRAC_CONST(0.85654340483771996),
- FRAC_CONST(0.85733404588281559),
- FRAC_CONST(0.85812266953808602),
- FRAC_CONST(0.8589092739478239),
- FRAC_CONST(0.85969385726107261),
- FRAC_CONST(0.86047641763163207),
- FRAC_CONST(0.86125695321806206),
- FRAC_CONST(0.86203546218368721),
- FRAC_CONST(0.86281194269660033),
- FRAC_CONST(0.86358639292966799),
- FRAC_CONST(0.86435881106053403),
- FRAC_CONST(0.86512919527162369),
- FRAC_CONST(0.86589754375014882),
- FRAC_CONST(0.86666385468811102),
- FRAC_CONST(0.86742812628230692),
- FRAC_CONST(0.86819035673433131),
- FRAC_CONST(0.86895054425058238),
- FRAC_CONST(0.86970868704226556),
- FRAC_CONST(0.87046478332539767),
- FRAC_CONST(0.8712188313208109),
- FRAC_CONST(0.8719708292541577),
- FRAC_CONST(0.8727207753559143),
- FRAC_CONST(0.87346866786138488),
- FRAC_CONST(0.8742145050107063),
- FRAC_CONST(0.87495828504885154),
- FRAC_CONST(0.8757000062256346),
- FRAC_CONST(0.87643966679571361),
- FRAC_CONST(0.87717726501859594),
- FRAC_CONST(0.87791279915864173),
- FRAC_CONST(0.87864626748506813),
- FRAC_CONST(0.87937766827195318),
- FRAC_CONST(0.88010699979824036),
- FRAC_CONST(0.88083426034774204),
- FRAC_CONST(0.88155944820914378),
- FRAC_CONST(0.8822825616760086),
- FRAC_CONST(0.88300359904678072),
- FRAC_CONST(0.88372255862478966),
- FRAC_CONST(0.8844394387182537),
- FRAC_CONST(0.88515423764028511),
- FRAC_CONST(0.88586695370889279),
- FRAC_CONST(0.88657758524698704),
- FRAC_CONST(0.88728613058238315),
- FRAC_CONST(0.88799258804780556),
- FRAC_CONST(0.88869695598089171),
- FRAC_CONST(0.88939923272419552),
- FRAC_CONST(0.89009941662519221),
- FRAC_CONST(0.89079750603628149),
- FRAC_CONST(0.89149349931479138),
- FRAC_CONST(0.89218739482298248),
- FRAC_CONST(0.89287919092805168),
- FRAC_CONST(0.89356888600213602),
- FRAC_CONST(0.89425647842231604),
- FRAC_CONST(0.89494196657062075),
- FRAC_CONST(0.89562534883403),
- FRAC_CONST(0.89630662360447966),
- FRAC_CONST(0.89698578927886397),
- FRAC_CONST(0.89766284425904075),
- FRAC_CONST(0.89833778695183419),
- FRAC_CONST(0.89901061576903907),
- FRAC_CONST(0.89968132912742393),
- FRAC_CONST(0.9003499254487356),
- FRAC_CONST(0.90101640315970233),
- FRAC_CONST(0.90168076069203773),
- FRAC_CONST(0.9023429964824442),
- FRAC_CONST(0.90300310897261704),
- FRAC_CONST(0.90366109660924798),
- FRAC_CONST(0.90431695784402832),
- FRAC_CONST(0.90497069113365325),
- FRAC_CONST(0.90562229493982516),
- FRAC_CONST(0.90627176772925766),
- FRAC_CONST(0.90691910797367803),
- FRAC_CONST(0.90756431414983252),
- FRAC_CONST(0.9082073847394887),
- FRAC_CONST(0.90884831822943912),
- FRAC_CONST(0.90948711311150543),
- FRAC_CONST(0.91012376788254157),
- FRAC_CONST(0.91075828104443757),
- FRAC_CONST(0.91139065110412232),
- FRAC_CONST(0.91202087657356823),
- FRAC_CONST(0.9126489559697939),
- FRAC_CONST(0.91327488781486776),
- FRAC_CONST(0.91389867063591168),
- FRAC_CONST(0.91452030296510445),
- FRAC_CONST(0.91513978333968526),
- FRAC_CONST(0.91575711030195672),
- FRAC_CONST(0.91637228239928914),
- FRAC_CONST(0.91698529818412289),
- FRAC_CONST(0.91759615621397295),
- FRAC_CONST(0.9182048550514309),
- FRAC_CONST(0.91881139326416994),
- FRAC_CONST(0.91941576942494696),
- FRAC_CONST(0.92001798211160657),
- FRAC_CONST(0.92061802990708386),
- FRAC_CONST(0.92121591139940873),
- FRAC_CONST(0.92181162518170812),
- FRAC_CONST(0.92240516985220988),
- FRAC_CONST(0.92299654401424625),
- FRAC_CONST(0.92358574627625656),
- FRAC_CONST(0.9241727752517912),
- FRAC_CONST(0.92475762955951391),
- FRAC_CONST(0.9253403078232062),
- FRAC_CONST(0.92592080867176996),
- FRAC_CONST(0.92649913073923051),
- FRAC_CONST(0.9270752726647401),
- FRAC_CONST(0.92764923309258118),
- FRAC_CONST(0.92822101067216944),
- FRAC_CONST(0.92879060405805702),
- FRAC_CONST(0.9293580119099355),
- FRAC_CONST(0.92992323289263956),
- FRAC_CONST(0.93048626567614978),
- FRAC_CONST(0.93104710893559517),
- FRAC_CONST(0.93160576135125783),
- FRAC_CONST(0.93216222160857432),
- FRAC_CONST(0.93271648839814025),
- FRAC_CONST(0.93326856041571205),
- FRAC_CONST(0.93381843636221096),
- FRAC_CONST(0.9343661149437259),
- FRAC_CONST(0.93491159487151609),
- FRAC_CONST(0.93545487486201462),
- FRAC_CONST(0.9359959536368313),
- FRAC_CONST(0.9365348299227555),
- FRAC_CONST(0.93707150245175919),
- FRAC_CONST(0.93760596996099999),
- FRAC_CONST(0.93813823119282436),
- FRAC_CONST(0.93866828489477017),
- FRAC_CONST(0.9391961298195699),
- FRAC_CONST(0.93972176472515334),
- FRAC_CONST(0.94024518837465088),
- FRAC_CONST(0.94076639953639607),
- FRAC_CONST(0.94128539698392866),
- FRAC_CONST(0.94180217949599765),
- FRAC_CONST(0.94231674585656378),
- FRAC_CONST(0.94282909485480271),
- FRAC_CONST(0.94333922528510772),
- FRAC_CONST(0.94384713594709269),
- FRAC_CONST(0.94435282564559475),
- FRAC_CONST(0.94485629319067721),
- FRAC_CONST(0.94535753739763229),
- FRAC_CONST(0.94585655708698391),
- FRAC_CONST(0.94635335108449059),
- FRAC_CONST(0.946847918221148),
- FRAC_CONST(0.94734025733319194),
- FRAC_CONST(0.94783036726210101),
- FRAC_CONST(0.94831824685459909),
- FRAC_CONST(0.94880389496265838),
- FRAC_CONST(0.94928731044350201),
- FRAC_CONST(0.94976849215960668),
- FRAC_CONST(0.95024743897870523),
- FRAC_CONST(0.95072414977378961),
- FRAC_CONST(0.95119862342311323),
- FRAC_CONST(0.95167085881019386),
- FRAC_CONST(0.95214085482381583),
- FRAC_CONST(0.95260861035803324),
- FRAC_CONST(0.9530741243121722),
- FRAC_CONST(0.95353739559083328),
- FRAC_CONST(0.95399842310389449),
- FRAC_CONST(0.95445720576651349),
- FRAC_CONST(0.95491374249913052),
- FRAC_CONST(0.95536803222747024),
- FRAC_CONST(0.95582007388254542),
- FRAC_CONST(0.95626986640065814),
- FRAC_CONST(0.95671740872340305),
- FRAC_CONST(0.9571626997976701),
- FRAC_CONST(0.95760573857564624),
- FRAC_CONST(0.9580465240148186),
- FRAC_CONST(0.9584850550779761),
- FRAC_CONST(0.95892133073321306),
- FRAC_CONST(0.95935534995393079),
- FRAC_CONST(0.9597871117188399),
- FRAC_CONST(0.96021661501196343),
- FRAC_CONST(0.96064385882263847),
- FRAC_CONST(0.96106884214551935),
- FRAC_CONST(0.961491563980579),
- FRAC_CONST(0.9619120233331121),
- FRAC_CONST(0.9623302192137374),
- FRAC_CONST(0.96274615063839941),
- FRAC_CONST(0.96315981662837136),
- FRAC_CONST(0.96357121621025721),
- FRAC_CONST(0.96398034841599411),
- FRAC_CONST(0.96438721228285429),
- FRAC_CONST(0.9647918068534479),
- FRAC_CONST(0.96519413117572472),
- FRAC_CONST(0.96559418430297683),
- FRAC_CONST(0.96599196529384057),
- FRAC_CONST(0.96638747321229879),
- FRAC_CONST(0.96678070712768327),
- FRAC_CONST(0.96717166611467664),
- FRAC_CONST(0.96756034925331436),
- FRAC_CONST(0.9679467556289878),
- FRAC_CONST(0.9683308843324453),
- FRAC_CONST(0.96871273445979478),
- FRAC_CONST(0.9690923051125061),
- FRAC_CONST(0.96946959539741295),
- FRAC_CONST(0.96984460442671483),
- FRAC_CONST(0.97021733131797916),
- FRAC_CONST(0.97058777519414363),
- FRAC_CONST(0.97095593518351797),
- FRAC_CONST(0.97132181041978616),
- FRAC_CONST(0.97168540004200854),
- FRAC_CONST(0.9720467031946235),
- FRAC_CONST(0.97240571902744977),
- FRAC_CONST(0.97276244669568857),
- FRAC_CONST(0.97311688535992513),
- FRAC_CONST(0.97346903418613095),
- FRAC_CONST(0.9738188923456661),
- FRAC_CONST(0.97416645901528032),
- FRAC_CONST(0.97451173337711572),
- FRAC_CONST(0.97485471461870843),
- FRAC_CONST(0.97519540193299037),
- FRAC_CONST(0.97553379451829136),
- FRAC_CONST(0.97586989157834103),
- FRAC_CONST(0.97620369232227056),
- FRAC_CONST(0.97653519596461447),
- FRAC_CONST(0.97686440172531264),
- FRAC_CONST(0.97719130882971228),
- FRAC_CONST(0.97751591650856928),
- FRAC_CONST(0.97783822399805043),
- FRAC_CONST(0.97815823053973505),
- FRAC_CONST(0.97847593538061683),
- FRAC_CONST(0.97879133777310567),
- FRAC_CONST(0.97910443697502925),
- FRAC_CONST(0.97941523224963478),
- FRAC_CONST(0.97972372286559117),
- FRAC_CONST(0.98002990809698998),
- FRAC_CONST(0.98033378722334796),
- FRAC_CONST(0.98063535952960812),
- FRAC_CONST(0.98093462430614164),
- FRAC_CONST(0.98123158084874973),
- FRAC_CONST(0.98152622845866466),
- FRAC_CONST(0.9818185664425525),
- FRAC_CONST(0.98210859411251361),
- FRAC_CONST(0.98239631078608469),
- FRAC_CONST(0.98268171578624086),
- FRAC_CONST(0.98296480844139644),
- FRAC_CONST(0.98324558808540707),
- FRAC_CONST(0.98352405405757126),
- FRAC_CONST(0.98380020570263149),
- FRAC_CONST(0.98407404237077645),
- FRAC_CONST(0.9843455634176419),
- FRAC_CONST(0.9846147682043126),
- FRAC_CONST(0.9848816560973237),
- FRAC_CONST(0.98514622646866223),
- FRAC_CONST(0.98540847869576842),
- FRAC_CONST(0.98566841216153755),
- FRAC_CONST(0.98592602625432113),
- FRAC_CONST(0.98618132036792827),
- FRAC_CONST(0.98643429390162707),
- FRAC_CONST(0.98668494626014669),
- FRAC_CONST(0.98693327685367771),
- FRAC_CONST(0.98717928509787434),
- FRAC_CONST(0.98742297041385541),
- FRAC_CONST(0.98766433222820571),
- FRAC_CONST(0.98790336997297779),
- FRAC_CONST(0.98814008308569257),
- FRAC_CONST(0.98837447100934128),
- FRAC_CONST(0.98860653319238645),
- FRAC_CONST(0.98883626908876354),
- FRAC_CONST(0.98906367815788154),
- FRAC_CONST(0.98928875986462517),
- FRAC_CONST(0.98951151367935519),
- FRAC_CONST(0.98973193907791057),
- FRAC_CONST(0.98995003554160899),
- FRAC_CONST(0.9901658025572484),
- FRAC_CONST(0.99037923961710816),
- FRAC_CONST(0.99059034621895015),
- FRAC_CONST(0.99079912186602037),
- FRAC_CONST(0.99100556606704937),
- FRAC_CONST(0.99120967833625406),
- FRAC_CONST(0.99141145819333854),
- FRAC_CONST(0.99161090516349537),
- FRAC_CONST(0.99180801877740643),
- FRAC_CONST(0.99200279857124452),
- FRAC_CONST(0.99219524408667392),
- FRAC_CONST(0.99238535487085167),
- FRAC_CONST(0.99257313047642881),
- FRAC_CONST(0.99275857046155114),
- FRAC_CONST(0.99294167438986047),
- FRAC_CONST(0.99312244183049558),
- FRAC_CONST(0.99330087235809328),
- FRAC_CONST(0.99347696555278919),
- FRAC_CONST(0.99365072100021912),
- FRAC_CONST(0.99382213829151966),
- FRAC_CONST(0.99399121702332938),
- FRAC_CONST(0.99415795679778973),
- FRAC_CONST(0.99432235722254581),
- FRAC_CONST(0.9944844179107476),
- FRAC_CONST(0.99464413848105071),
- FRAC_CONST(0.99480151855761711),
- FRAC_CONST(0.99495655777011638),
- FRAC_CONST(0.99510925575372611),
- FRAC_CONST(0.99525961214913339),
- FRAC_CONST(0.9954076266025349),
- FRAC_CONST(0.99555329876563847),
- FRAC_CONST(0.99569662829566352),
- FRAC_CONST(0.99583761485534161),
- FRAC_CONST(0.99597625811291779),
- FRAC_CONST(0.99611255774215113),
- FRAC_CONST(0.99624651342231552),
- FRAC_CONST(0.99637812483820021),
- FRAC_CONST(0.99650739168011082),
- FRAC_CONST(0.9966343136438699),
- FRAC_CONST(0.996758890430818),
- FRAC_CONST(0.99688112174781385),
- FRAC_CONST(0.99700100730723529),
- FRAC_CONST(0.99711854682697998),
- FRAC_CONST(0.99723374003046616),
- FRAC_CONST(0.99734658664663323),
- FRAC_CONST(0.99745708640994191),
- FRAC_CONST(0.99756523906037575),
- FRAC_CONST(0.997671044343441),
- FRAC_CONST(0.99777450201016782),
- FRAC_CONST(0.99787561181711015),
- FRAC_CONST(0.99797437352634699),
- FRAC_CONST(0.99807078690548234),
- FRAC_CONST(0.99816485172764624),
- FRAC_CONST(0.99825656777149518),
- FRAC_CONST(0.99834593482121237),
- FRAC_CONST(0.99843295266650844),
- FRAC_CONST(0.99851762110262221),
- FRAC_CONST(0.99859993993032037),
- FRAC_CONST(0.99867990895589909),
- FRAC_CONST(0.99875752799118334),
- FRAC_CONST(0.99883279685352799),
- FRAC_CONST(0.99890571536581829),
- FRAC_CONST(0.99897628335646982),
- FRAC_CONST(0.99904450065942929),
- FRAC_CONST(0.99911036711417489),
- FRAC_CONST(0.99917388256571638),
- FRAC_CONST(0.99923504686459585),
- FRAC_CONST(0.99929385986688779),
- FRAC_CONST(0.99935032143419944),
- FRAC_CONST(0.9994044314336713),
- FRAC_CONST(0.99945618973797734),
- FRAC_CONST(0.99950559622532531),
- FRAC_CONST(0.99955265077945699),
- FRAC_CONST(0.99959735328964838),
- FRAC_CONST(0.9996397036507102),
- FRAC_CONST(0.99967970176298793),
- FRAC_CONST(0.99971734753236219),
- FRAC_CONST(0.99975264087024884),
- FRAC_CONST(0.99978558169359921),
- FRAC_CONST(0.99981616992490041),
- FRAC_CONST(0.99984440549217524),
- FRAC_CONST(0.99987028832898295),
- FRAC_CONST(0.99989381837441849),
- FRAC_CONST(0.99991499557311347),
- FRAC_CONST(0.999933819875236),
- FRAC_CONST(0.99995029123649048),
- FRAC_CONST(0.99996440961811828),
- FRAC_CONST(0.99997617498689761),
- FRAC_CONST(0.9999855873151432),
- FRAC_CONST(0.99999264658070719),
- FRAC_CONST(0.99999735276697821),
- FRAC_CONST(0.99999970586288223)
- };
+ALIGN static const real_t sine_long_1024[] =
+{
+ FRAC_CONST(0.00076699031874270449),
+ FRAC_CONST(0.002300969151425805),
+ FRAC_CONST(0.0038349425697062275),
+ FRAC_CONST(0.0053689069639963425),
+ FRAC_CONST(0.0069028587247297558),
+ FRAC_CONST(0.0084367942423697988),
+ FRAC_CONST(0.0099707099074180308),
+ FRAC_CONST(0.011504602110422714),
+ FRAC_CONST(0.013038467241987334),
+ FRAC_CONST(0.014572301692779064),
+ FRAC_CONST(0.016106101853537287),
+ FRAC_CONST(0.017639864115082053),
+ FRAC_CONST(0.019173584868322623),
+ FRAC_CONST(0.020707260504265895),
+ FRAC_CONST(0.022240887414024961),
+ FRAC_CONST(0.023774461988827555),
+ FRAC_CONST(0.025307980620024571),
+ FRAC_CONST(0.026841439699098531),
+ FRAC_CONST(0.028374835617672099),
+ FRAC_CONST(0.029908164767516555),
+ FRAC_CONST(0.031441423540560301),
+ FRAC_CONST(0.032974608328897335),
+ FRAC_CONST(0.03450771552479575),
+ FRAC_CONST(0.036040741520706229),
+ FRAC_CONST(0.037573682709270494),
+ FRAC_CONST(0.039106535483329888),
+ FRAC_CONST(0.040639296235933736),
+ FRAC_CONST(0.042171961360347947),
+ FRAC_CONST(0.043704527250063421),
+ FRAC_CONST(0.04523699029880459),
+ FRAC_CONST(0.046769346900537863),
+ FRAC_CONST(0.048301593449480144),
+ FRAC_CONST(0.049833726340107277),
+ FRAC_CONST(0.051365741967162593),
+ FRAC_CONST(0.052897636725665324),
+ FRAC_CONST(0.054429407010919133),
+ FRAC_CONST(0.055961049218520569),
+ FRAC_CONST(0.057492559744367566),
+ FRAC_CONST(0.059023934984667931),
+ FRAC_CONST(0.060555171335947788),
+ FRAC_CONST(0.062086265195060088),
+ FRAC_CONST(0.063617212959193106),
+ FRAC_CONST(0.065148011025878833),
+ FRAC_CONST(0.066678655793001557),
+ FRAC_CONST(0.068209143658806329),
+ FRAC_CONST(0.069739471021907307),
+ FRAC_CONST(0.071269634281296401),
+ FRAC_CONST(0.072799629836351673),
+ FRAC_CONST(0.074329454086845756),
+ FRAC_CONST(0.075859103432954447),
+ FRAC_CONST(0.077388574275265049),
+ FRAC_CONST(0.078917863014784942),
+ FRAC_CONST(0.080446966052950014),
+ FRAC_CONST(0.081975879791633066),
+ FRAC_CONST(0.083504600633152432),
+ FRAC_CONST(0.085033124980280275),
+ FRAC_CONST(0.08656144923625117),
+ FRAC_CONST(0.088089569804770507),
+ FRAC_CONST(0.089617483090022959),
+ FRAC_CONST(0.091145185496681005),
+ FRAC_CONST(0.09267267342991331),
+ FRAC_CONST(0.094199943295393204),
+ FRAC_CONST(0.095726991499307162),
+ FRAC_CONST(0.097253814448363271),
+ FRAC_CONST(0.098780408549799623),
+ FRAC_CONST(0.10030677021139286),
+ FRAC_CONST(0.10183289584146653),
+ FRAC_CONST(0.10335878184889961),
+ FRAC_CONST(0.10488442464313497),
+ FRAC_CONST(0.10640982063418768),
+ FRAC_CONST(0.10793496623265365),
+ FRAC_CONST(0.10945985784971798),
+ FRAC_CONST(0.11098449189716339),
+ FRAC_CONST(0.11250886478737869),
+ FRAC_CONST(0.1140329729333672),
+ FRAC_CONST(0.11555681274875526),
+ FRAC_CONST(0.11708038064780059),
+ FRAC_CONST(0.11860367304540072),
+ FRAC_CONST(0.1201266863571015),
+ FRAC_CONST(0.12164941699910553),
+ FRAC_CONST(0.12317186138828048),
+ FRAC_CONST(0.12469401594216764),
+ FRAC_CONST(0.12621587707899035),
+ FRAC_CONST(0.12773744121766231),
+ FRAC_CONST(0.12925870477779614),
+ FRAC_CONST(0.13077966417971171),
+ FRAC_CONST(0.13230031584444465),
+ FRAC_CONST(0.13382065619375472),
+ FRAC_CONST(0.13534068165013421),
+ FRAC_CONST(0.13686038863681638),
+ FRAC_CONST(0.13837977357778389),
+ FRAC_CONST(0.13989883289777721),
+ FRAC_CONST(0.14141756302230302),
+ FRAC_CONST(0.14293596037764267),
+ FRAC_CONST(0.14445402139086047),
+ FRAC_CONST(0.14597174248981221),
+ FRAC_CONST(0.14748912010315357),
+ FRAC_CONST(0.14900615066034845),
+ FRAC_CONST(0.1505228305916774),
+ FRAC_CONST(0.15203915632824605),
+ FRAC_CONST(0.15355512430199345),
+ FRAC_CONST(0.15507073094570051),
+ FRAC_CONST(0.15658597269299843),
+ FRAC_CONST(0.15810084597837698),
+ FRAC_CONST(0.15961534723719306),
+ FRAC_CONST(0.16112947290567881),
+ FRAC_CONST(0.16264321942095031),
+ FRAC_CONST(0.16415658322101581),
+ FRAC_CONST(0.16566956074478412),
+ FRAC_CONST(0.16718214843207294),
+ FRAC_CONST(0.16869434272361733),
+ FRAC_CONST(0.17020614006107807),
+ FRAC_CONST(0.17171753688704997),
+ FRAC_CONST(0.17322852964507032),
+ FRAC_CONST(0.1747391147796272),
+ FRAC_CONST(0.17624928873616788),
+ FRAC_CONST(0.17775904796110717),
+ FRAC_CONST(0.17926838890183575),
+ FRAC_CONST(0.18077730800672859),
+ FRAC_CONST(0.1822858017251533),
+ FRAC_CONST(0.18379386650747845),
+ FRAC_CONST(0.1853014988050819),
+ FRAC_CONST(0.18680869507035927),
+ FRAC_CONST(0.18831545175673212),
+ FRAC_CONST(0.18982176531865641),
+ FRAC_CONST(0.1913276322116309),
+ FRAC_CONST(0.19283304889220523),
+ FRAC_CONST(0.1943380118179886),
+ FRAC_CONST(0.19584251744765785),
+ FRAC_CONST(0.19734656224096592),
+ FRAC_CONST(0.19885014265875009),
+ FRAC_CONST(0.20035325516294045),
+ FRAC_CONST(0.20185589621656805),
+ FRAC_CONST(0.20335806228377332),
+ FRAC_CONST(0.20485974982981442),
+ FRAC_CONST(0.20636095532107551),
+ FRAC_CONST(0.20786167522507507),
+ FRAC_CONST(0.20936190601047416),
+ FRAC_CONST(0.21086164414708486),
+ FRAC_CONST(0.21236088610587842),
+ FRAC_CONST(0.21385962835899375),
+ FRAC_CONST(0.21535786737974555),
+ FRAC_CONST(0.21685559964263262),
+ FRAC_CONST(0.21835282162334632),
+ FRAC_CONST(0.2198495297987787),
+ FRAC_CONST(0.22134572064703081),
+ FRAC_CONST(0.22284139064742112),
+ FRAC_CONST(0.2243365362804936),
+ FRAC_CONST(0.22583115402802617),
+ FRAC_CONST(0.22732524037303886),
+ FRAC_CONST(0.22881879179980222),
+ FRAC_CONST(0.23031180479384544),
+ FRAC_CONST(0.23180427584196478),
+ FRAC_CONST(0.23329620143223159),
+ FRAC_CONST(0.23478757805400097),
+ FRAC_CONST(0.23627840219791957),
+ FRAC_CONST(0.23776867035593419),
+ FRAC_CONST(0.23925837902129998),
+ FRAC_CONST(0.24074752468858843),
+ FRAC_CONST(0.24223610385369601),
+ FRAC_CONST(0.24372411301385216),
+ FRAC_CONST(0.24521154866762754),
+ FRAC_CONST(0.24669840731494241),
+ FRAC_CONST(0.24818468545707478),
+ FRAC_CONST(0.24967037959666857),
+ FRAC_CONST(0.25115548623774192),
+ FRAC_CONST(0.25264000188569552),
+ FRAC_CONST(0.25412392304732062),
+ FRAC_CONST(0.25560724623080738),
+ FRAC_CONST(0.25708996794575312),
+ FRAC_CONST(0.25857208470317034),
+ FRAC_CONST(0.26005359301549519),
+ FRAC_CONST(0.26153448939659552),
+ FRAC_CONST(0.263014770361779),
+ FRAC_CONST(0.26449443242780163),
+ FRAC_CONST(0.26597347211287559),
+ FRAC_CONST(0.26745188593667762),
+ FRAC_CONST(0.26892967042035726),
+ FRAC_CONST(0.27040682208654482),
+ FRAC_CONST(0.27188333745935972),
+ FRAC_CONST(0.27335921306441868),
+ FRAC_CONST(0.27483444542884394),
+ FRAC_CONST(0.27630903108127108),
+ FRAC_CONST(0.27778296655185769),
+ FRAC_CONST(0.27925624837229118),
+ FRAC_CONST(0.28072887307579719),
+ FRAC_CONST(0.28220083719714756),
+ FRAC_CONST(0.28367213727266843),
+ FRAC_CONST(0.28514276984024867),
+ FRAC_CONST(0.28661273143934779),
+ FRAC_CONST(0.28808201861100413),
+ FRAC_CONST(0.28955062789784303),
+ FRAC_CONST(0.29101855584408509),
+ FRAC_CONST(0.29248579899555388),
+ FRAC_CONST(0.29395235389968466),
+ FRAC_CONST(0.29541821710553201),
+ FRAC_CONST(0.29688338516377827),
+ FRAC_CONST(0.2983478546267414),
+ FRAC_CONST(0.29981162204838335),
+ FRAC_CONST(0.30127468398431795),
+ FRAC_CONST(0.30273703699181914),
+ FRAC_CONST(0.30419867762982911),
+ FRAC_CONST(0.30565960245896612),
+ FRAC_CONST(0.3071198080415331),
+ FRAC_CONST(0.30857929094152509),
+ FRAC_CONST(0.31003804772463789),
+ FRAC_CONST(0.31149607495827591),
+ FRAC_CONST(0.3129533692115602),
+ FRAC_CONST(0.31440992705533666),
+ FRAC_CONST(0.31586574506218396),
+ FRAC_CONST(0.31732081980642174),
+ FRAC_CONST(0.31877514786411848),
+ FRAC_CONST(0.32022872581309986),
+ FRAC_CONST(0.32168155023295658),
+ FRAC_CONST(0.32313361770505233),
+ FRAC_CONST(0.32458492481253215),
+ FRAC_CONST(0.32603546814033024),
+ FRAC_CONST(0.327485244275178),
+ FRAC_CONST(0.3289342498056122),
+ FRAC_CONST(0.33038248132198278),
+ FRAC_CONST(0.33182993541646111),
+ FRAC_CONST(0.33327660868304793),
+ FRAC_CONST(0.33472249771758122),
+ FRAC_CONST(0.33616759911774452),
+ FRAC_CONST(0.33761190948307462),
+ FRAC_CONST(0.33905542541496964),
+ FRAC_CONST(0.34049814351669716),
+ FRAC_CONST(0.34194006039340219),
+ FRAC_CONST(0.34338117265211504),
+ FRAC_CONST(0.34482147690175929),
+ FRAC_CONST(0.34626096975316001),
+ FRAC_CONST(0.34769964781905138),
+ FRAC_CONST(0.34913750771408497),
+ FRAC_CONST(0.35057454605483751),
+ FRAC_CONST(0.35201075945981908),
+ FRAC_CONST(0.35344614454948081),
+ FRAC_CONST(0.35488069794622279),
+ FRAC_CONST(0.35631441627440241),
+ FRAC_CONST(0.3577472961603419),
+ FRAC_CONST(0.3591793342323365),
+ FRAC_CONST(0.36061052712066227),
+ FRAC_CONST(0.36204087145758418),
+ FRAC_CONST(0.36347036387736376),
+ FRAC_CONST(0.36489900101626732),
+ FRAC_CONST(0.36632677951257359),
+ FRAC_CONST(0.36775369600658198),
+ FRAC_CONST(0.36917974714062002),
+ FRAC_CONST(0.37060492955905167),
+ FRAC_CONST(0.37202923990828501),
+ FRAC_CONST(0.3734526748367803),
+ FRAC_CONST(0.37487523099505754),
+ FRAC_CONST(0.37629690503570479),
+ FRAC_CONST(0.37771769361338564),
+ FRAC_CONST(0.37913759338484732),
+ FRAC_CONST(0.38055660100892852),
+ FRAC_CONST(0.38197471314656722),
+ FRAC_CONST(0.38339192646080866),
+ FRAC_CONST(0.38480823761681288),
+ FRAC_CONST(0.38622364328186298),
+ FRAC_CONST(0.38763814012537273),
+ FRAC_CONST(0.38905172481889438),
+ FRAC_CONST(0.39046439403612659),
+ FRAC_CONST(0.39187614445292235),
+ FRAC_CONST(0.3932869727472964),
+ FRAC_CONST(0.39469687559943356),
+ FRAC_CONST(0.39610584969169627),
+ FRAC_CONST(0.39751389170863233),
+ FRAC_CONST(0.39892099833698291),
+ FRAC_CONST(0.40032716626569009),
+ FRAC_CONST(0.40173239218590501),
+ FRAC_CONST(0.4031366727909953),
+ FRAC_CONST(0.404540004776553),
+ FRAC_CONST(0.40594238484040251),
+ FRAC_CONST(0.40734380968260797),
+ FRAC_CONST(0.40874427600548136),
+ FRAC_CONST(0.41014378051359024),
+ FRAC_CONST(0.41154231991376522),
+ FRAC_CONST(0.41293989091510808),
+ FRAC_CONST(0.4143364902289991),
+ FRAC_CONST(0.41573211456910536),
+ FRAC_CONST(0.41712676065138787),
+ FRAC_CONST(0.4185204251941097),
+ FRAC_CONST(0.41991310491784362),
+ FRAC_CONST(0.42130479654547964),
+ FRAC_CONST(0.42269549680223295),
+ FRAC_CONST(0.42408520241565156),
+ FRAC_CONST(0.4254739101156238),
+ FRAC_CONST(0.42686161663438643),
+ FRAC_CONST(0.42824831870653196),
+ FRAC_CONST(0.42963401306901638),
+ FRAC_CONST(0.43101869646116703),
+ FRAC_CONST(0.43240236562469014),
+ FRAC_CONST(0.43378501730367852),
+ FRAC_CONST(0.43516664824461926),
+ FRAC_CONST(0.4365472551964012),
+ FRAC_CONST(0.43792683491032286),
+ FRAC_CONST(0.43930538414009995),
+ FRAC_CONST(0.4406828996418729),
+ FRAC_CONST(0.4420593781742147),
+ FRAC_CONST(0.44343481649813848),
+ FRAC_CONST(0.44480921137710488),
+ FRAC_CONST(0.44618255957703007),
+ FRAC_CONST(0.44755485786629301),
+ FRAC_CONST(0.44892610301574326),
+ FRAC_CONST(0.45029629179870861),
+ FRAC_CONST(0.45166542099100249),
+ FRAC_CONST(0.45303348737093158),
+ FRAC_CONST(0.45440048771930358),
+ FRAC_CONST(0.45576641881943464),
+ FRAC_CONST(0.45713127745715698),
+ FRAC_CONST(0.45849506042082627),
+ FRAC_CONST(0.45985776450132954),
+ FRAC_CONST(0.46121938649209238),
+ FRAC_CONST(0.46257992318908681),
+ FRAC_CONST(0.46393937139083852),
+ FRAC_CONST(0.4652977278984346),
+ FRAC_CONST(0.46665498951553092),
+ FRAC_CONST(0.46801115304835983),
+ FRAC_CONST(0.46936621530573752),
+ FRAC_CONST(0.4707201730990716),
+ FRAC_CONST(0.47207302324236866),
+ FRAC_CONST(0.47342476255224153),
+ FRAC_CONST(0.47477538784791712),
+ FRAC_CONST(0.47612489595124358),
+ FRAC_CONST(0.47747328368669806),
+ FRAC_CONST(0.47882054788139389),
+ FRAC_CONST(0.48016668536508839),
+ FRAC_CONST(0.48151169297018986),
+ FRAC_CONST(0.48285556753176567),
+ FRAC_CONST(0.48419830588754903),
+ FRAC_CONST(0.48553990487794696),
+ FRAC_CONST(0.48688036134604734),
+ FRAC_CONST(0.48821967213762679),
+ FRAC_CONST(0.48955783410115744),
+ FRAC_CONST(0.49089484408781509),
+ FRAC_CONST(0.49223069895148602),
+ FRAC_CONST(0.49356539554877477),
+ FRAC_CONST(0.49489893073901126),
+ FRAC_CONST(0.49623130138425825),
+ FRAC_CONST(0.49756250434931915),
+ FRAC_CONST(0.49889253650174459),
+ FRAC_CONST(0.50022139471184068),
+ FRAC_CONST(0.50154907585267539),
+ FRAC_CONST(0.50287557680008699),
+ FRAC_CONST(0.50420089443269034),
+ FRAC_CONST(0.50552502563188539),
+ FRAC_CONST(0.50684796728186321),
+ FRAC_CONST(0.5081697162696146),
+ FRAC_CONST(0.50949026948493636),
+ FRAC_CONST(0.51080962382043904),
+ FRAC_CONST(0.51212777617155469),
+ FRAC_CONST(0.51344472343654346),
+ FRAC_CONST(0.5147604625165012),
+ FRAC_CONST(0.51607499031536663),
+ FRAC_CONST(0.51738830373992906),
+ FRAC_CONST(0.51870039969983495),
+ FRAC_CONST(0.52001127510759604),
+ FRAC_CONST(0.52132092687859566),
+ FRAC_CONST(0.52262935193109661),
+ FRAC_CONST(0.5239365471862486),
+ FRAC_CONST(0.52524250956809471),
+ FRAC_CONST(0.52654723600357944),
+ FRAC_CONST(0.52785072342255523),
+ FRAC_CONST(0.52915296875779061),
+ FRAC_CONST(0.53045396894497632),
+ FRAC_CONST(0.53175372092273332),
+ FRAC_CONST(0.53305222163261945),
+ FRAC_CONST(0.53434946801913752),
+ FRAC_CONST(0.53564545702974109),
+ FRAC_CONST(0.53694018561484291),
+ FRAC_CONST(0.5382336507278217),
+ FRAC_CONST(0.53952584932502889),
+ FRAC_CONST(0.54081677836579667),
+ FRAC_CONST(0.54210643481244392),
+ FRAC_CONST(0.5433948156302848),
+ FRAC_CONST(0.54468191778763453),
+ FRAC_CONST(0.54596773825581757),
+ FRAC_CONST(0.54725227400917409),
+ FRAC_CONST(0.54853552202506739),
+ FRAC_CONST(0.54981747928389091),
+ FRAC_CONST(0.55109814276907543),
+ FRAC_CONST(0.55237750946709607),
+ FRAC_CONST(0.55365557636747931),
+ FRAC_CONST(0.55493234046281037),
+ FRAC_CONST(0.55620779874873993),
+ FRAC_CONST(0.55748194822399155),
+ FRAC_CONST(0.55875478589036831),
+ FRAC_CONST(0.56002630875276038),
+ FRAC_CONST(0.56129651381915147),
+ FRAC_CONST(0.56256539810062656),
+ FRAC_CONST(0.56383295861137817),
+ FRAC_CONST(0.56509919236871398),
+ FRAC_CONST(0.56636409639306384),
+ FRAC_CONST(0.56762766770798623),
+ FRAC_CONST(0.56888990334017586),
+ FRAC_CONST(0.5701508003194703),
+ FRAC_CONST(0.57141035567885723),
+ FRAC_CONST(0.57266856645448116),
+ FRAC_CONST(0.57392542968565075),
+ FRAC_CONST(0.57518094241484508),
+ FRAC_CONST(0.57643510168772183),
+ FRAC_CONST(0.5776879045531228),
+ FRAC_CONST(0.57893934806308178),
+ FRAC_CONST(0.58018942927283168),
+ FRAC_CONST(0.58143814524081017),
+ FRAC_CONST(0.58268549302866846),
+ FRAC_CONST(0.58393146970127618),
+ FRAC_CONST(0.58517607232673041),
+ FRAC_CONST(0.5864192979763605),
+ FRAC_CONST(0.58766114372473666),
+ FRAC_CONST(0.58890160664967572),
+ FRAC_CONST(0.59014068383224882),
+ FRAC_CONST(0.59137837235678758),
+ FRAC_CONST(0.59261466931089113),
+ FRAC_CONST(0.59384957178543363),
+ FRAC_CONST(0.59508307687456996),
+ FRAC_CONST(0.59631518167574371),
+ FRAC_CONST(0.59754588328969316),
+ FRAC_CONST(0.59877517882045872),
+ FRAC_CONST(0.60000306537538894),
+ FRAC_CONST(0.6012295400651485),
+ FRAC_CONST(0.60245460000372375),
+ FRAC_CONST(0.60367824230843037),
+ FRAC_CONST(0.60490046409991982),
+ FRAC_CONST(0.60612126250218612),
+ FRAC_CONST(0.60734063464257293),
+ FRAC_CONST(0.60855857765177945),
+ FRAC_CONST(0.60977508866386843),
+ FRAC_CONST(0.61099016481627166),
+ FRAC_CONST(0.61220380324979795),
+ FRAC_CONST(0.61341600110863859),
+ FRAC_CONST(0.61462675554037505),
+ FRAC_CONST(0.61583606369598509),
+ FRAC_CONST(0.61704392272984976),
+ FRAC_CONST(0.61825032979976025),
+ FRAC_CONST(0.61945528206692402),
+ FRAC_CONST(0.62065877669597214),
+ FRAC_CONST(0.62186081085496536),
+ FRAC_CONST(0.62306138171540126),
+ FRAC_CONST(0.62426048645222065),
+ FRAC_CONST(0.62545812224381436),
+ FRAC_CONST(0.62665428627202935),
+ FRAC_CONST(0.62784897572217646),
+ FRAC_CONST(0.629042187783036),
+ FRAC_CONST(0.63023391964686437),
+ FRAC_CONST(0.63142416850940186),
+ FRAC_CONST(0.63261293156987741),
+ FRAC_CONST(0.63380020603101728),
+ FRAC_CONST(0.63498598909904946),
+ FRAC_CONST(0.63617027798371217),
+ FRAC_CONST(0.63735306989825913),
+ FRAC_CONST(0.63853436205946679),
+ FRAC_CONST(0.63971415168764045),
+ FRAC_CONST(0.64089243600662138),
+ FRAC_CONST(0.64206921224379254),
+ FRAC_CONST(0.64324447763008585),
+ FRAC_CONST(0.64441822939998838),
+ FRAC_CONST(0.64559046479154869),
+ FRAC_CONST(0.64676118104638392),
+ FRAC_CONST(0.64793037540968534),
+ FRAC_CONST(0.64909804513022595),
+ FRAC_CONST(0.65026418746036585),
+ FRAC_CONST(0.65142879965605982),
+ FRAC_CONST(0.65259187897686244),
+ FRAC_CONST(0.65375342268593606),
+ FRAC_CONST(0.65491342805005603),
+ FRAC_CONST(0.6560718923396176),
+ FRAC_CONST(0.65722881282864254),
+ FRAC_CONST(0.65838418679478505),
+ FRAC_CONST(0.65953801151933866),
+ FRAC_CONST(0.6606902842872423),
+ FRAC_CONST(0.66184100238708687),
+ FRAC_CONST(0.66299016311112147),
+ FRAC_CONST(0.66413776375526001),
+ FRAC_CONST(0.66528380161908718),
+ FRAC_CONST(0.66642827400586524),
+ FRAC_CONST(0.66757117822254031),
+ FRAC_CONST(0.66871251157974798),
+ FRAC_CONST(0.66985227139182102),
+ FRAC_CONST(0.67099045497679422),
+ FRAC_CONST(0.67212705965641173),
+ FRAC_CONST(0.67326208275613297),
+ FRAC_CONST(0.67439552160513905),
+ FRAC_CONST(0.67552737353633852),
+ FRAC_CONST(0.67665763588637495),
+ FRAC_CONST(0.6777863059956315),
+ FRAC_CONST(0.67891338120823841),
+ FRAC_CONST(0.68003885887207893),
+ FRAC_CONST(0.68116273633879543),
+ FRAC_CONST(0.68228501096379557),
+ FRAC_CONST(0.68340568010625868),
+ FRAC_CONST(0.6845247411291423),
+ FRAC_CONST(0.68564219139918747),
+ FRAC_CONST(0.68675802828692589),
+ FRAC_CONST(0.68787224916668555),
+ FRAC_CONST(0.68898485141659704),
+ FRAC_CONST(0.69009583241859995),
+ FRAC_CONST(0.69120518955844845),
+ FRAC_CONST(0.69231292022571822),
+ FRAC_CONST(0.69341902181381176),
+ FRAC_CONST(0.69452349171996552),
+ FRAC_CONST(0.69562632734525487),
+ FRAC_CONST(0.6967275260946012),
+ FRAC_CONST(0.69782708537677729),
+ FRAC_CONST(0.69892500260441415),
+ FRAC_CONST(0.70002127519400625),
+ FRAC_CONST(0.70111590056591866),
+ FRAC_CONST(0.70220887614439187),
+ FRAC_CONST(0.70330019935754873),
+ FRAC_CONST(0.70438986763740041),
+ FRAC_CONST(0.7054778784198521),
+ FRAC_CONST(0.70656422914470951),
+ FRAC_CONST(0.70764891725568435),
+ FRAC_CONST(0.70873194020040065),
+ FRAC_CONST(0.70981329543040084),
+ FRAC_CONST(0.71089298040115168),
+ FRAC_CONST(0.71197099257204999),
+ FRAC_CONST(0.71304732940642923),
+ FRAC_CONST(0.71412198837156471),
+ FRAC_CONST(0.71519496693868001),
+ FRAC_CONST(0.71626626258295312),
+ FRAC_CONST(0.71733587278352173),
+ FRAC_CONST(0.71840379502348972),
+ FRAC_CONST(0.71947002678993299),
+ FRAC_CONST(0.72053456557390527),
+ FRAC_CONST(0.72159740887044366),
+ FRAC_CONST(0.72265855417857561),
+ FRAC_CONST(0.72371799900132339),
+ FRAC_CONST(0.72477574084571128),
+ FRAC_CONST(0.72583177722277037),
+ FRAC_CONST(0.72688610564754497),
+ FRAC_CONST(0.72793872363909862),
+ FRAC_CONST(0.72898962872051931),
+ FRAC_CONST(0.73003881841892615),
+ FRAC_CONST(0.73108629026547423),
+ FRAC_CONST(0.73213204179536129),
+ FRAC_CONST(0.73317607054783274),
+ FRAC_CONST(0.73421837406618817),
+ FRAC_CONST(0.73525894989778673),
+ FRAC_CONST(0.73629779559405306),
+ FRAC_CONST(0.73733490871048279),
+ FRAC_CONST(0.73837028680664851),
+ FRAC_CONST(0.73940392744620576),
+ FRAC_CONST(0.74043582819689802),
+ FRAC_CONST(0.74146598663056329),
+ FRAC_CONST(0.74249440032313918),
+ FRAC_CONST(0.74352106685466912),
+ FRAC_CONST(0.74454598380930725),
+ FRAC_CONST(0.74556914877532543),
+ FRAC_CONST(0.74659055934511731),
+ FRAC_CONST(0.74761021311520515),
+ FRAC_CONST(0.74862810768624533),
+ FRAC_CONST(0.74964424066303348),
+ FRAC_CONST(0.75065860965451059),
+ FRAC_CONST(0.75167121227376843),
+ FRAC_CONST(0.75268204613805523),
+ FRAC_CONST(0.75369110886878121),
+ FRAC_CONST(0.75469839809152439),
+ FRAC_CONST(0.75570391143603588),
+ FRAC_CONST(0.75670764653624567),
+ FRAC_CONST(0.75770960103026808),
+ FRAC_CONST(0.75870977256040739),
+ FRAC_CONST(0.75970815877316344),
+ FRAC_CONST(0.76070475731923692),
+ FRAC_CONST(0.76169956585353527),
+ FRAC_CONST(0.76269258203517787),
+ FRAC_CONST(0.76368380352750187),
+ FRAC_CONST(0.76467322799806714),
+ FRAC_CONST(0.76566085311866239),
+ FRAC_CONST(0.76664667656531038),
+ FRAC_CONST(0.76763069601827327),
+ FRAC_CONST(0.76861290916205827),
+ FRAC_CONST(0.76959331368542294),
+ FRAC_CONST(0.7705719072813807),
+ FRAC_CONST(0.7715486876472063),
+ FRAC_CONST(0.77252365248444133),
+ FRAC_CONST(0.77349679949889905),
+ FRAC_CONST(0.77446812640067086),
+ FRAC_CONST(0.77543763090413043),
+ FRAC_CONST(0.77640531072794039),
+ FRAC_CONST(0.7773711635950562),
+ FRAC_CONST(0.77833518723273309),
+ FRAC_CONST(0.7792973793725303),
+ FRAC_CONST(0.78025773775031659),
+ FRAC_CONST(0.78121626010627609),
+ FRAC_CONST(0.7821729441849129),
+ FRAC_CONST(0.78312778773505731),
+ FRAC_CONST(0.78408078850986995),
+ FRAC_CONST(0.78503194426684808),
+ FRAC_CONST(0.78598125276783015),
+ FRAC_CONST(0.7869287117790017),
+ FRAC_CONST(0.78787431907090011),
+ FRAC_CONST(0.78881807241842017),
+ FRAC_CONST(0.78975996960081907),
+ FRAC_CONST(0.79070000840172161),
+ FRAC_CONST(0.79163818660912577),
+ FRAC_CONST(0.79257450201540758),
+ FRAC_CONST(0.79350895241732666),
+ FRAC_CONST(0.79444153561603059),
+ FRAC_CONST(0.79537224941706119),
+ FRAC_CONST(0.79630109163035911),
+ FRAC_CONST(0.7972280600702687),
+ FRAC_CONST(0.79815315255554375),
+ FRAC_CONST(0.79907636690935235),
+ FRAC_CONST(0.79999770095928191),
+ FRAC_CONST(0.8009171525373443),
+ FRAC_CONST(0.80183471947998131),
+ FRAC_CONST(0.80275039962806916),
+ FRAC_CONST(0.80366419082692409),
+ FRAC_CONST(0.804576090926307),
+ FRAC_CONST(0.80548609778042912),
+ FRAC_CONST(0.80639420924795624),
+ FRAC_CONST(0.80730042319201445),
+ FRAC_CONST(0.80820473748019472),
+ FRAC_CONST(0.80910714998455813),
+ FRAC_CONST(0.81000765858164114),
+ FRAC_CONST(0.81090626115245967),
+ FRAC_CONST(0.81180295558251536),
+ FRAC_CONST(0.81269773976179949),
+ FRAC_CONST(0.81359061158479851),
+ FRAC_CONST(0.81448156895049861),
+ FRAC_CONST(0.81537060976239129),
+ FRAC_CONST(0.81625773192847739),
+ FRAC_CONST(0.81714293336127297),
+ FRAC_CONST(0.81802621197781344),
+ FRAC_CONST(0.81890756569965895),
+ FRAC_CONST(0.81978699245289899),
+ FRAC_CONST(0.82066449016815746),
+ FRAC_CONST(0.82154005678059761),
+ FRAC_CONST(0.82241369022992639),
+ FRAC_CONST(0.82328538846040011),
+ FRAC_CONST(0.82415514942082857),
+ FRAC_CONST(0.82502297106458022),
+ FRAC_CONST(0.82588885134958678),
+ FRAC_CONST(0.82675278823834852),
+ FRAC_CONST(0.8276147796979384),
+ FRAC_CONST(0.82847482370000713),
+ FRAC_CONST(0.82933291822078825),
+ FRAC_CONST(0.83018906124110237),
+ FRAC_CONST(0.83104325074636232),
+ FRAC_CONST(0.83189548472657759),
+ FRAC_CONST(0.83274576117635946),
+ FRAC_CONST(0.83359407809492514),
+ FRAC_CONST(0.83444043348610319),
+ FRAC_CONST(0.83528482535833737),
+ FRAC_CONST(0.83612725172469216),
+ FRAC_CONST(0.83696771060285702),
+ FRAC_CONST(0.83780620001515094),
+ FRAC_CONST(0.8386427179885273),
+ FRAC_CONST(0.83947726255457855),
+ FRAC_CONST(0.84030983174954077),
+ FRAC_CONST(0.84114042361429808),
+ FRAC_CONST(0.84196903619438768),
+ FRAC_CONST(0.84279566754000412),
+ FRAC_CONST(0.84362031570600404),
+ FRAC_CONST(0.84444297875191066),
+ FRAC_CONST(0.84526365474191822),
+ FRAC_CONST(0.84608234174489694),
+ FRAC_CONST(0.84689903783439735),
+ FRAC_CONST(0.84771374108865427),
+ FRAC_CONST(0.84852644959059265),
+ FRAC_CONST(0.84933716142783067),
+ FRAC_CONST(0.85014587469268521),
+ FRAC_CONST(0.85095258748217573),
+ FRAC_CONST(0.85175729789802912),
+ FRAC_CONST(0.85256000404668397),
+ FRAC_CONST(0.85336070403929543),
+ FRAC_CONST(0.85415939599173873),
+ FRAC_CONST(0.85495607802461482),
+ FRAC_CONST(0.85575074826325392),
+ FRAC_CONST(0.85654340483771996),
+ FRAC_CONST(0.85733404588281559),
+ FRAC_CONST(0.85812266953808602),
+ FRAC_CONST(0.8589092739478239),
+ FRAC_CONST(0.85969385726107261),
+ FRAC_CONST(0.86047641763163207),
+ FRAC_CONST(0.86125695321806206),
+ FRAC_CONST(0.86203546218368721),
+ FRAC_CONST(0.86281194269660033),
+ FRAC_CONST(0.86358639292966799),
+ FRAC_CONST(0.86435881106053403),
+ FRAC_CONST(0.86512919527162369),
+ FRAC_CONST(0.86589754375014882),
+ FRAC_CONST(0.86666385468811102),
+ FRAC_CONST(0.86742812628230692),
+ FRAC_CONST(0.86819035673433131),
+ FRAC_CONST(0.86895054425058238),
+ FRAC_CONST(0.86970868704226556),
+ FRAC_CONST(0.87046478332539767),
+ FRAC_CONST(0.8712188313208109),
+ FRAC_CONST(0.8719708292541577),
+ FRAC_CONST(0.8727207753559143),
+ FRAC_CONST(0.87346866786138488),
+ FRAC_CONST(0.8742145050107063),
+ FRAC_CONST(0.87495828504885154),
+ FRAC_CONST(0.8757000062256346),
+ FRAC_CONST(0.87643966679571361),
+ FRAC_CONST(0.87717726501859594),
+ FRAC_CONST(0.87791279915864173),
+ FRAC_CONST(0.87864626748506813),
+ FRAC_CONST(0.87937766827195318),
+ FRAC_CONST(0.88010699979824036),
+ FRAC_CONST(0.88083426034774204),
+ FRAC_CONST(0.88155944820914378),
+ FRAC_CONST(0.8822825616760086),
+ FRAC_CONST(0.88300359904678072),
+ FRAC_CONST(0.88372255862478966),
+ FRAC_CONST(0.8844394387182537),
+ FRAC_CONST(0.88515423764028511),
+ FRAC_CONST(0.88586695370889279),
+ FRAC_CONST(0.88657758524698704),
+ FRAC_CONST(0.88728613058238315),
+ FRAC_CONST(0.88799258804780556),
+ FRAC_CONST(0.88869695598089171),
+ FRAC_CONST(0.88939923272419552),
+ FRAC_CONST(0.89009941662519221),
+ FRAC_CONST(0.89079750603628149),
+ FRAC_CONST(0.89149349931479138),
+ FRAC_CONST(0.89218739482298248),
+ FRAC_CONST(0.89287919092805168),
+ FRAC_CONST(0.89356888600213602),
+ FRAC_CONST(0.89425647842231604),
+ FRAC_CONST(0.89494196657062075),
+ FRAC_CONST(0.89562534883403),
+ FRAC_CONST(0.89630662360447966),
+ FRAC_CONST(0.89698578927886397),
+ FRAC_CONST(0.89766284425904075),
+ FRAC_CONST(0.89833778695183419),
+ FRAC_CONST(0.89901061576903907),
+ FRAC_CONST(0.89968132912742393),
+ FRAC_CONST(0.9003499254487356),
+ FRAC_CONST(0.90101640315970233),
+ FRAC_CONST(0.90168076069203773),
+ FRAC_CONST(0.9023429964824442),
+ FRAC_CONST(0.90300310897261704),
+ FRAC_CONST(0.90366109660924798),
+ FRAC_CONST(0.90431695784402832),
+ FRAC_CONST(0.90497069113365325),
+ FRAC_CONST(0.90562229493982516),
+ FRAC_CONST(0.90627176772925766),
+ FRAC_CONST(0.90691910797367803),
+ FRAC_CONST(0.90756431414983252),
+ FRAC_CONST(0.9082073847394887),
+ FRAC_CONST(0.90884831822943912),
+ FRAC_CONST(0.90948711311150543),
+ FRAC_CONST(0.91012376788254157),
+ FRAC_CONST(0.91075828104443757),
+ FRAC_CONST(0.91139065110412232),
+ FRAC_CONST(0.91202087657356823),
+ FRAC_CONST(0.9126489559697939),
+ FRAC_CONST(0.91327488781486776),
+ FRAC_CONST(0.91389867063591168),
+ FRAC_CONST(0.91452030296510445),
+ FRAC_CONST(0.91513978333968526),
+ FRAC_CONST(0.91575711030195672),
+ FRAC_CONST(0.91637228239928914),
+ FRAC_CONST(0.91698529818412289),
+ FRAC_CONST(0.91759615621397295),
+ FRAC_CONST(0.9182048550514309),
+ FRAC_CONST(0.91881139326416994),
+ FRAC_CONST(0.91941576942494696),
+ FRAC_CONST(0.92001798211160657),
+ FRAC_CONST(0.92061802990708386),
+ FRAC_CONST(0.92121591139940873),
+ FRAC_CONST(0.92181162518170812),
+ FRAC_CONST(0.92240516985220988),
+ FRAC_CONST(0.92299654401424625),
+ FRAC_CONST(0.92358574627625656),
+ FRAC_CONST(0.9241727752517912),
+ FRAC_CONST(0.92475762955951391),
+ FRAC_CONST(0.9253403078232062),
+ FRAC_CONST(0.92592080867176996),
+ FRAC_CONST(0.92649913073923051),
+ FRAC_CONST(0.9270752726647401),
+ FRAC_CONST(0.92764923309258118),
+ FRAC_CONST(0.92822101067216944),
+ FRAC_CONST(0.92879060405805702),
+ FRAC_CONST(0.9293580119099355),
+ FRAC_CONST(0.92992323289263956),
+ FRAC_CONST(0.93048626567614978),
+ FRAC_CONST(0.93104710893559517),
+ FRAC_CONST(0.93160576135125783),
+ FRAC_CONST(0.93216222160857432),
+ FRAC_CONST(0.93271648839814025),
+ FRAC_CONST(0.93326856041571205),
+ FRAC_CONST(0.93381843636221096),
+ FRAC_CONST(0.9343661149437259),
+ FRAC_CONST(0.93491159487151609),
+ FRAC_CONST(0.93545487486201462),
+ FRAC_CONST(0.9359959536368313),
+ FRAC_CONST(0.9365348299227555),
+ FRAC_CONST(0.93707150245175919),
+ FRAC_CONST(0.93760596996099999),
+ FRAC_CONST(0.93813823119282436),
+ FRAC_CONST(0.93866828489477017),
+ FRAC_CONST(0.9391961298195699),
+ FRAC_CONST(0.93972176472515334),
+ FRAC_CONST(0.94024518837465088),
+ FRAC_CONST(0.94076639953639607),
+ FRAC_CONST(0.94128539698392866),
+ FRAC_CONST(0.94180217949599765),
+ FRAC_CONST(0.94231674585656378),
+ FRAC_CONST(0.94282909485480271),
+ FRAC_CONST(0.94333922528510772),
+ FRAC_CONST(0.94384713594709269),
+ FRAC_CONST(0.94435282564559475),
+ FRAC_CONST(0.94485629319067721),
+ FRAC_CONST(0.94535753739763229),
+ FRAC_CONST(0.94585655708698391),
+ FRAC_CONST(0.94635335108449059),
+ FRAC_CONST(0.946847918221148),
+ FRAC_CONST(0.94734025733319194),
+ FRAC_CONST(0.94783036726210101),
+ FRAC_CONST(0.94831824685459909),
+ FRAC_CONST(0.94880389496265838),
+ FRAC_CONST(0.94928731044350201),
+ FRAC_CONST(0.94976849215960668),
+ FRAC_CONST(0.95024743897870523),
+ FRAC_CONST(0.95072414977378961),
+ FRAC_CONST(0.95119862342311323),
+ FRAC_CONST(0.95167085881019386),
+ FRAC_CONST(0.95214085482381583),
+ FRAC_CONST(0.95260861035803324),
+ FRAC_CONST(0.9530741243121722),
+ FRAC_CONST(0.95353739559083328),
+ FRAC_CONST(0.95399842310389449),
+ FRAC_CONST(0.95445720576651349),
+ FRAC_CONST(0.95491374249913052),
+ FRAC_CONST(0.95536803222747024),
+ FRAC_CONST(0.95582007388254542),
+ FRAC_CONST(0.95626986640065814),
+ FRAC_CONST(0.95671740872340305),
+ FRAC_CONST(0.9571626997976701),
+ FRAC_CONST(0.95760573857564624),
+ FRAC_CONST(0.9580465240148186),
+ FRAC_CONST(0.9584850550779761),
+ FRAC_CONST(0.95892133073321306),
+ FRAC_CONST(0.95935534995393079),
+ FRAC_CONST(0.9597871117188399),
+ FRAC_CONST(0.96021661501196343),
+ FRAC_CONST(0.96064385882263847),
+ FRAC_CONST(0.96106884214551935),
+ FRAC_CONST(0.961491563980579),
+ FRAC_CONST(0.9619120233331121),
+ FRAC_CONST(0.9623302192137374),
+ FRAC_CONST(0.96274615063839941),
+ FRAC_CONST(0.96315981662837136),
+ FRAC_CONST(0.96357121621025721),
+ FRAC_CONST(0.96398034841599411),
+ FRAC_CONST(0.96438721228285429),
+ FRAC_CONST(0.9647918068534479),
+ FRAC_CONST(0.96519413117572472),
+ FRAC_CONST(0.96559418430297683),
+ FRAC_CONST(0.96599196529384057),
+ FRAC_CONST(0.96638747321229879),
+ FRAC_CONST(0.96678070712768327),
+ FRAC_CONST(0.96717166611467664),
+ FRAC_CONST(0.96756034925331436),
+ FRAC_CONST(0.9679467556289878),
+ FRAC_CONST(0.9683308843324453),
+ FRAC_CONST(0.96871273445979478),
+ FRAC_CONST(0.9690923051125061),
+ FRAC_CONST(0.96946959539741295),
+ FRAC_CONST(0.96984460442671483),
+ FRAC_CONST(0.97021733131797916),
+ FRAC_CONST(0.97058777519414363),
+ FRAC_CONST(0.97095593518351797),
+ FRAC_CONST(0.97132181041978616),
+ FRAC_CONST(0.97168540004200854),
+ FRAC_CONST(0.9720467031946235),
+ FRAC_CONST(0.97240571902744977),
+ FRAC_CONST(0.97276244669568857),
+ FRAC_CONST(0.97311688535992513),
+ FRAC_CONST(0.97346903418613095),
+ FRAC_CONST(0.9738188923456661),
+ FRAC_CONST(0.97416645901528032),
+ FRAC_CONST(0.97451173337711572),
+ FRAC_CONST(0.97485471461870843),
+ FRAC_CONST(0.97519540193299037),
+ FRAC_CONST(0.97553379451829136),
+ FRAC_CONST(0.97586989157834103),
+ FRAC_CONST(0.97620369232227056),
+ FRAC_CONST(0.97653519596461447),
+ FRAC_CONST(0.97686440172531264),
+ FRAC_CONST(0.97719130882971228),
+ FRAC_CONST(0.97751591650856928),
+ FRAC_CONST(0.97783822399805043),
+ FRAC_CONST(0.97815823053973505),
+ FRAC_CONST(0.97847593538061683),
+ FRAC_CONST(0.97879133777310567),
+ FRAC_CONST(0.97910443697502925),
+ FRAC_CONST(0.97941523224963478),
+ FRAC_CONST(0.97972372286559117),
+ FRAC_CONST(0.98002990809698998),
+ FRAC_CONST(0.98033378722334796),
+ FRAC_CONST(0.98063535952960812),
+ FRAC_CONST(0.98093462430614164),
+ FRAC_CONST(0.98123158084874973),
+ FRAC_CONST(0.98152622845866466),
+ FRAC_CONST(0.9818185664425525),
+ FRAC_CONST(0.98210859411251361),
+ FRAC_CONST(0.98239631078608469),
+ FRAC_CONST(0.98268171578624086),
+ FRAC_CONST(0.98296480844139644),
+ FRAC_CONST(0.98324558808540707),
+ FRAC_CONST(0.98352405405757126),
+ FRAC_CONST(0.98380020570263149),
+ FRAC_CONST(0.98407404237077645),
+ FRAC_CONST(0.9843455634176419),
+ FRAC_CONST(0.9846147682043126),
+ FRAC_CONST(0.9848816560973237),
+ FRAC_CONST(0.98514622646866223),
+ FRAC_CONST(0.98540847869576842),
+ FRAC_CONST(0.98566841216153755),
+ FRAC_CONST(0.98592602625432113),
+ FRAC_CONST(0.98618132036792827),
+ FRAC_CONST(0.98643429390162707),
+ FRAC_CONST(0.98668494626014669),
+ FRAC_CONST(0.98693327685367771),
+ FRAC_CONST(0.98717928509787434),
+ FRAC_CONST(0.98742297041385541),
+ FRAC_CONST(0.98766433222820571),
+ FRAC_CONST(0.98790336997297779),
+ FRAC_CONST(0.98814008308569257),
+ FRAC_CONST(0.98837447100934128),
+ FRAC_CONST(0.98860653319238645),
+ FRAC_CONST(0.98883626908876354),
+ FRAC_CONST(0.98906367815788154),
+ FRAC_CONST(0.98928875986462517),
+ FRAC_CONST(0.98951151367935519),
+ FRAC_CONST(0.98973193907791057),
+ FRAC_CONST(0.98995003554160899),
+ FRAC_CONST(0.9901658025572484),
+ FRAC_CONST(0.99037923961710816),
+ FRAC_CONST(0.99059034621895015),
+ FRAC_CONST(0.99079912186602037),
+ FRAC_CONST(0.99100556606704937),
+ FRAC_CONST(0.99120967833625406),
+ FRAC_CONST(0.99141145819333854),
+ FRAC_CONST(0.99161090516349537),
+ FRAC_CONST(0.99180801877740643),
+ FRAC_CONST(0.99200279857124452),
+ FRAC_CONST(0.99219524408667392),
+ FRAC_CONST(0.99238535487085167),
+ FRAC_CONST(0.99257313047642881),
+ FRAC_CONST(0.99275857046155114),
+ FRAC_CONST(0.99294167438986047),
+ FRAC_CONST(0.99312244183049558),
+ FRAC_CONST(0.99330087235809328),
+ FRAC_CONST(0.99347696555278919),
+ FRAC_CONST(0.99365072100021912),
+ FRAC_CONST(0.99382213829151966),
+ FRAC_CONST(0.99399121702332938),
+ FRAC_CONST(0.99415795679778973),
+ FRAC_CONST(0.99432235722254581),
+ FRAC_CONST(0.9944844179107476),
+ FRAC_CONST(0.99464413848105071),
+ FRAC_CONST(0.99480151855761711),
+ FRAC_CONST(0.99495655777011638),
+ FRAC_CONST(0.99510925575372611),
+ FRAC_CONST(0.99525961214913339),
+ FRAC_CONST(0.9954076266025349),
+ FRAC_CONST(0.99555329876563847),
+ FRAC_CONST(0.99569662829566352),
+ FRAC_CONST(0.99583761485534161),
+ FRAC_CONST(0.99597625811291779),
+ FRAC_CONST(0.99611255774215113),
+ FRAC_CONST(0.99624651342231552),
+ FRAC_CONST(0.99637812483820021),
+ FRAC_CONST(0.99650739168011082),
+ FRAC_CONST(0.9966343136438699),
+ FRAC_CONST(0.996758890430818),
+ FRAC_CONST(0.99688112174781385),
+ FRAC_CONST(0.99700100730723529),
+ FRAC_CONST(0.99711854682697998),
+ FRAC_CONST(0.99723374003046616),
+ FRAC_CONST(0.99734658664663323),
+ FRAC_CONST(0.99745708640994191),
+ FRAC_CONST(0.99756523906037575),
+ FRAC_CONST(0.997671044343441),
+ FRAC_CONST(0.99777450201016782),
+ FRAC_CONST(0.99787561181711015),
+ FRAC_CONST(0.99797437352634699),
+ FRAC_CONST(0.99807078690548234),
+ FRAC_CONST(0.99816485172764624),
+ FRAC_CONST(0.99825656777149518),
+ FRAC_CONST(0.99834593482121237),
+ FRAC_CONST(0.99843295266650844),
+ FRAC_CONST(0.99851762110262221),
+ FRAC_CONST(0.99859993993032037),
+ FRAC_CONST(0.99867990895589909),
+ FRAC_CONST(0.99875752799118334),
+ FRAC_CONST(0.99883279685352799),
+ FRAC_CONST(0.99890571536581829),
+ FRAC_CONST(0.99897628335646982),
+ FRAC_CONST(0.99904450065942929),
+ FRAC_CONST(0.99911036711417489),
+ FRAC_CONST(0.99917388256571638),
+ FRAC_CONST(0.99923504686459585),
+ FRAC_CONST(0.99929385986688779),
+ FRAC_CONST(0.99935032143419944),
+ FRAC_CONST(0.9994044314336713),
+ FRAC_CONST(0.99945618973797734),
+ FRAC_CONST(0.99950559622532531),
+ FRAC_CONST(0.99955265077945699),
+ FRAC_CONST(0.99959735328964838),
+ FRAC_CONST(0.9996397036507102),
+ FRAC_CONST(0.99967970176298793),
+ FRAC_CONST(0.99971734753236219),
+ FRAC_CONST(0.99975264087024884),
+ FRAC_CONST(0.99978558169359921),
+ FRAC_CONST(0.99981616992490041),
+ FRAC_CONST(0.99984440549217524),
+ FRAC_CONST(0.99987028832898295),
+ FRAC_CONST(0.99989381837441849),
+ FRAC_CONST(0.99991499557311347),
+ FRAC_CONST(0.999933819875236),
+ FRAC_CONST(0.99995029123649048),
+ FRAC_CONST(0.99996440961811828),
+ FRAC_CONST(0.99997617498689761),
+ FRAC_CONST(0.9999855873151432),
+ FRAC_CONST(0.99999264658070719),
+ FRAC_CONST(0.99999735276697821),
+ FRAC_CONST(0.99999970586288223)
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const real_t sine_long_960[] =
- {
- FRAC_CONST(0.00081812299560725323),
- FRAC_CONST(0.0024543667964602917),
- FRAC_CONST(0.0040906040262347889),
- FRAC_CONST(0.0057268303042312674),
- FRAC_CONST(0.0073630412497795667),
- FRAC_CONST(0.0089992324822505774),
- FRAC_CONST(0.010635399621067975),
- FRAC_CONST(0.012271538285719924),
- FRAC_CONST(0.013907644095770845),
- FRAC_CONST(0.015543712670873098),
- FRAC_CONST(0.017179739630778748),
- FRAC_CONST(0.018815720595351273),
- FRAC_CONST(0.020451651184577292),
- FRAC_CONST(0.022087527018578291),
- FRAC_CONST(0.023723343717622358),
- FRAC_CONST(0.025359096902135895),
- FRAC_CONST(0.02699478219271537),
- FRAC_CONST(0.028630395210139003),
- FRAC_CONST(0.030265931575378519),
- FRAC_CONST(0.031901386909610863),
- FRAC_CONST(0.033536756834229922),
- FRAC_CONST(0.035172036970858266),
- FRAC_CONST(0.036807222941358832),
- FRAC_CONST(0.038442310367846677),
- FRAC_CONST(0.040077294872700696),
- FRAC_CONST(0.041712172078575326),
- FRAC_CONST(0.043346937608412288),
- FRAC_CONST(0.044981587085452281),
- FRAC_CONST(0.046616116133246711),
- FRAC_CONST(0.048250520375669431),
- FRAC_CONST(0.049884795436928406),
- FRAC_CONST(0.051518936941577477),
- FRAC_CONST(0.053152940514528055),
- FRAC_CONST(0.05478680178106083),
- FRAC_CONST(0.056420516366837495),
- FRAC_CONST(0.05805407989791244),
- FRAC_CONST(0.059687488000744485),
- FRAC_CONST(0.061320736302208578),
- FRAC_CONST(0.062953820429607482),
- FRAC_CONST(0.064586736010683557),
- FRAC_CONST(0.066219478673630344),
- FRAC_CONST(0.06785204404710439),
- FRAC_CONST(0.069484427760236861),
- FRAC_CONST(0.071116625442645326),
- FRAC_CONST(0.072748632724445372),
- FRAC_CONST(0.07438044523626236),
- FRAC_CONST(0.076012058609243122),
- FRAC_CONST(0.077643468475067631),
- FRAC_CONST(0.079274670465960706),
- FRAC_CONST(0.080905660214703745),
- FRAC_CONST(0.082536433354646319),
- FRAC_CONST(0.084166985519717977),
- FRAC_CONST(0.085797312344439894),
- FRAC_CONST(0.08742740946393647),
- FRAC_CONST(0.089057272513947183),
- FRAC_CONST(0.090686897130838162),
- FRAC_CONST(0.092316278951613845),
- FRAC_CONST(0.093945413613928788),
- FRAC_CONST(0.095574296756099186),
- FRAC_CONST(0.097202924017114667),
- FRAC_CONST(0.098831291036649963),
- FRAC_CONST(0.10045939345507648),
- FRAC_CONST(0.10208722691347409),
- FRAC_CONST(0.10371478705364276),
- FRAC_CONST(0.10534206951811415),
- FRAC_CONST(0.10696906995016341),
- FRAC_CONST(0.10859578399382072),
- FRAC_CONST(0.11022220729388306),
- FRAC_CONST(0.11184833549592579),
- FRAC_CONST(0.11347416424631435),
- FRAC_CONST(0.11509968919221586),
- FRAC_CONST(0.11672490598161089),
- FRAC_CONST(0.11834981026330495),
- FRAC_CONST(0.11997439768694031),
- FRAC_CONST(0.12159866390300751),
- FRAC_CONST(0.12322260456285709),
- FRAC_CONST(0.12484621531871121),
- FRAC_CONST(0.12646949182367517),
- FRAC_CONST(0.12809242973174936),
- FRAC_CONST(0.12971502469784052),
- FRAC_CONST(0.13133727237777362),
- FRAC_CONST(0.13295916842830346),
- FRAC_CONST(0.13458070850712617),
- FRAC_CONST(0.13620188827289101),
- FRAC_CONST(0.1378227033852118),
- FRAC_CONST(0.13944314950467873),
- FRAC_CONST(0.14106322229286994),
- FRAC_CONST(0.14268291741236291),
- FRAC_CONST(0.14430223052674654),
- FRAC_CONST(0.1459211573006321),
- FRAC_CONST(0.14753969339966552),
- FRAC_CONST(0.14915783449053857),
- FRAC_CONST(0.15077557624100058),
- FRAC_CONST(0.15239291431987001),
- FRAC_CONST(0.1540098443970461),
- FRAC_CONST(0.15562636214352044),
- FRAC_CONST(0.15724246323138855),
- FRAC_CONST(0.15885814333386142),
- FRAC_CONST(0.16047339812527725),
- FRAC_CONST(0.16208822328111283),
- FRAC_CONST(0.16370261447799525),
- FRAC_CONST(0.16531656739371339),
- FRAC_CONST(0.16693007770722967),
- FRAC_CONST(0.16854314109869134),
- FRAC_CONST(0.17015575324944232),
- FRAC_CONST(0.17176790984203447),
- FRAC_CONST(0.17337960656023954),
- FRAC_CONST(0.1749908390890603),
- FRAC_CONST(0.17660160311474243),
- FRAC_CONST(0.17821189432478593),
- FRAC_CONST(0.17982170840795647),
- FRAC_CONST(0.18143104105429744),
- FRAC_CONST(0.18303988795514095),
- FRAC_CONST(0.1846482448031197),
- FRAC_CONST(0.18625610729217834),
- FRAC_CONST(0.1878634711175852),
- FRAC_CONST(0.18947033197594348),
- FRAC_CONST(0.19107668556520319),
- FRAC_CONST(0.19268252758467228),
- FRAC_CONST(0.19428785373502844),
- FRAC_CONST(0.19589265971833042),
- FRAC_CONST(0.19749694123802966),
- FRAC_CONST(0.19910069399898173),
- FRAC_CONST(0.20070391370745785),
- FRAC_CONST(0.20230659607115639),
- FRAC_CONST(0.20390873679921437),
- FRAC_CONST(0.20551033160221882),
- FRAC_CONST(0.20711137619221856),
- FRAC_CONST(0.2087118662827353),
- FRAC_CONST(0.21031179758877552),
- FRAC_CONST(0.21191116582684155),
- FRAC_CONST(0.21350996671494335),
- FRAC_CONST(0.21510819597260972),
- FRAC_CONST(0.21670584932089998),
- FRAC_CONST(0.2183029224824154),
- FRAC_CONST(0.21989941118131037),
- FRAC_CONST(0.22149531114330431),
- FRAC_CONST(0.22309061809569264),
- FRAC_CONST(0.22468532776735861),
- FRAC_CONST(0.22627943588878449),
- FRAC_CONST(0.22787293819206314),
- FRAC_CONST(0.22946583041090929),
- FRAC_CONST(0.23105810828067114),
- FRAC_CONST(0.23264976753834157),
- FRAC_CONST(0.23424080392256985),
- FRAC_CONST(0.2358312131736727),
- FRAC_CONST(0.23742099103364595),
- FRAC_CONST(0.23901013324617584),
- FRAC_CONST(0.24059863555665045),
- FRAC_CONST(0.24218649371217096),
- FRAC_CONST(0.24377370346156332),
- FRAC_CONST(0.24536026055538934),
- FRAC_CONST(0.24694616074595824),
- FRAC_CONST(0.24853139978733788),
- FRAC_CONST(0.25011597343536629),
- FRAC_CONST(0.25169987744766298),
- FRAC_CONST(0.25328310758364025),
- FRAC_CONST(0.25486565960451457),
- FRAC_CONST(0.25644752927331788),
- FRAC_CONST(0.25802871235490898),
- FRAC_CONST(0.25960920461598508),
- FRAC_CONST(0.26118900182509258),
- FRAC_CONST(0.26276809975263904),
- FRAC_CONST(0.264346494170904),
- FRAC_CONST(0.26592418085405067),
- FRAC_CONST(0.26750115557813692),
- FRAC_CONST(0.2690774141211269),
- FRAC_CONST(0.27065295226290209),
- FRAC_CONST(0.2722277657852728),
- FRAC_CONST(0.27380185047198918),
- FRAC_CONST(0.27537520210875299),
- FRAC_CONST(0.2769478164832283),
- FRAC_CONST(0.27851968938505312),
- FRAC_CONST(0.28009081660585067),
- FRAC_CONST(0.28166119393924061),
- FRAC_CONST(0.28323081718085019),
- FRAC_CONST(0.28479968212832563),
- FRAC_CONST(0.28636778458134327),
- FRAC_CONST(0.28793512034162105),
- FRAC_CONST(0.2895016852129294),
- FRAC_CONST(0.29106747500110264),
- FRAC_CONST(0.29263248551405047),
- FRAC_CONST(0.2941967125617686),
- FRAC_CONST(0.29576015195635058),
- FRAC_CONST(0.29732279951199847),
- FRAC_CONST(0.29888465104503475),
- FRAC_CONST(0.30044570237391266),
- FRAC_CONST(0.30200594931922808),
- FRAC_CONST(0.30356538770373032),
- FRAC_CONST(0.30512401335233358),
- FRAC_CONST(0.30668182209212791),
- FRAC_CONST(0.3082388097523906),
- FRAC_CONST(0.30979497216459695),
- FRAC_CONST(0.31135030516243201),
- FRAC_CONST(0.3129048045818012),
- FRAC_CONST(0.31445846626084178),
- FRAC_CONST(0.31601128603993378),
- FRAC_CONST(0.31756325976171151),
- FRAC_CONST(0.31911438327107416),
- FRAC_CONST(0.32066465241519732),
- FRAC_CONST(0.32221406304354389),
- FRAC_CONST(0.3237626110078754),
- FRAC_CONST(0.32531029216226293),
- FRAC_CONST(0.32685710236309828),
- FRAC_CONST(0.32840303746910487),
- FRAC_CONST(0.32994809334134939),
- FRAC_CONST(0.3314922658432522),
- FRAC_CONST(0.33303555084059877),
- FRAC_CONST(0.33457794420155085),
- FRAC_CONST(0.33611944179665709),
- FRAC_CONST(0.33766003949886464),
- FRAC_CONST(0.33919973318352969),
- FRAC_CONST(0.34073851872842903),
- FRAC_CONST(0.34227639201377064),
- FRAC_CONST(0.34381334892220483),
- FRAC_CONST(0.34534938533883547),
- FRAC_CONST(0.34688449715123082),
- FRAC_CONST(0.34841868024943456),
- FRAC_CONST(0.34995193052597684),
- FRAC_CONST(0.35148424387588523),
- FRAC_CONST(0.3530156161966958),
- FRAC_CONST(0.35454604338846402),
- FRAC_CONST(0.35607552135377557),
- FRAC_CONST(0.35760404599775775),
- FRAC_CONST(0.35913161322809023),
- FRAC_CONST(0.36065821895501554),
- FRAC_CONST(0.36218385909135092),
- FRAC_CONST(0.36370852955249849),
- FRAC_CONST(0.36523222625645668),
- FRAC_CONST(0.36675494512383078),
- FRAC_CONST(0.36827668207784414),
- FRAC_CONST(0.36979743304434909),
- FRAC_CONST(0.37131719395183754),
- FRAC_CONST(0.37283596073145214),
- FRAC_CONST(0.37435372931699717),
- FRAC_CONST(0.37587049564494951),
- FRAC_CONST(0.37738625565446909),
- FRAC_CONST(0.37890100528741022),
- FRAC_CONST(0.38041474048833229),
- FRAC_CONST(0.38192745720451066),
- FRAC_CONST(0.38343915138594736),
- FRAC_CONST(0.38494981898538222),
- FRAC_CONST(0.38645945595830333),
- FRAC_CONST(0.38796805826295838),
- FRAC_CONST(0.38947562186036483),
- FRAC_CONST(0.39098214271432141),
- FRAC_CONST(0.39248761679141814),
- FRAC_CONST(0.3939920400610481),
- FRAC_CONST(0.39549540849541737),
- FRAC_CONST(0.39699771806955625),
- FRAC_CONST(0.39849896476132979),
- FRAC_CONST(0.39999914455144892),
- FRAC_CONST(0.40149825342348083),
- FRAC_CONST(0.4029962873638599),
- FRAC_CONST(0.40449324236189854),
- FRAC_CONST(0.40598911440979762),
- FRAC_CONST(0.40748389950265762),
- FRAC_CONST(0.40897759363848879),
- FRAC_CONST(0.41047019281822261),
- FRAC_CONST(0.41196169304572178),
- FRAC_CONST(0.4134520903277914),
- FRAC_CONST(0.41494138067418929),
- FRAC_CONST(0.41642956009763715),
- FRAC_CONST(0.41791662461383078),
- FRAC_CONST(0.41940257024145089),
- FRAC_CONST(0.42088739300217382),
- FRAC_CONST(0.42237108892068231),
- FRAC_CONST(0.42385365402467584),
- FRAC_CONST(0.42533508434488143),
- FRAC_CONST(0.42681537591506419),
- FRAC_CONST(0.42829452477203828),
- FRAC_CONST(0.42977252695567697),
- FRAC_CONST(0.43124937850892364),
- FRAC_CONST(0.4327250754778022),
- FRAC_CONST(0.43419961391142781),
- FRAC_CONST(0.43567298986201736),
- FRAC_CONST(0.43714519938489987),
- FRAC_CONST(0.43861623853852766),
- FRAC_CONST(0.44008610338448595),
- FRAC_CONST(0.44155478998750436),
- FRAC_CONST(0.44302229441546676),
- FRAC_CONST(0.4444886127394222),
- FRAC_CONST(0.44595374103359531),
- FRAC_CONST(0.44741767537539667),
- FRAC_CONST(0.44888041184543348),
- FRAC_CONST(0.45034194652752002),
- FRAC_CONST(0.45180227550868812),
- FRAC_CONST(0.45326139487919759),
- FRAC_CONST(0.45471930073254679),
- FRAC_CONST(0.45617598916548296),
- FRAC_CONST(0.45763145627801283),
- FRAC_CONST(0.45908569817341294),
- FRAC_CONST(0.46053871095824001),
- FRAC_CONST(0.46199049074234161),
- FRAC_CONST(0.46344103363886635),
- FRAC_CONST(0.46489033576427435),
- FRAC_CONST(0.46633839323834758),
- FRAC_CONST(0.46778520218420055),
- FRAC_CONST(0.46923075872829029),
- FRAC_CONST(0.47067505900042683),
- FRAC_CONST(0.47211809913378361),
- FRAC_CONST(0.47355987526490806),
- FRAC_CONST(0.47500038353373153),
- FRAC_CONST(0.47643962008357982),
- FRAC_CONST(0.47787758106118372),
- FRAC_CONST(0.47931426261668875),
- FRAC_CONST(0.48074966090366611),
- FRAC_CONST(0.48218377207912272),
- FRAC_CONST(0.48361659230351117),
- FRAC_CONST(0.48504811774074069),
- FRAC_CONST(0.48647834455818684),
- FRAC_CONST(0.48790726892670194),
- FRAC_CONST(0.48933488702062544),
- FRAC_CONST(0.49076119501779414),
- FRAC_CONST(0.49218618909955225),
- FRAC_CONST(0.4936098654507618),
- FRAC_CONST(0.49503222025981269),
- FRAC_CONST(0.49645324971863303),
- FRAC_CONST(0.49787295002269943),
- FRAC_CONST(0.49929131737104687),
- FRAC_CONST(0.50070834796627917),
- FRAC_CONST(0.50212403801457872),
- FRAC_CONST(0.50353838372571758),
- FRAC_CONST(0.50495138131306638),
- FRAC_CONST(0.50636302699360547),
- FRAC_CONST(0.50777331698793449),
- FRAC_CONST(0.50918224752028263),
- FRAC_CONST(0.51058981481851906),
- FRAC_CONST(0.51199601511416237),
- FRAC_CONST(0.51340084464239111),
- FRAC_CONST(0.51480429964205421),
- FRAC_CONST(0.51620637635567967),
- FRAC_CONST(0.51760707102948678),
- FRAC_CONST(0.51900637991339404),
- FRAC_CONST(0.5204042992610306),
- FRAC_CONST(0.52180082532974559),
- FRAC_CONST(0.5231959543806185),
- FRAC_CONST(0.52458968267846895),
- FRAC_CONST(0.52598200649186677),
- FRAC_CONST(0.52737292209314235),
- FRAC_CONST(0.52876242575839572),
- FRAC_CONST(0.53015051376750777),
- FRAC_CONST(0.53153718240414882),
- FRAC_CONST(0.53292242795578992),
- FRAC_CONST(0.53430624671371152),
- FRAC_CONST(0.53568863497301467),
- FRAC_CONST(0.5370695890326298),
- FRAC_CONST(0.5384491051953274),
- FRAC_CONST(0.53982717976772743),
- FRAC_CONST(0.54120380906030963),
- FRAC_CONST(0.54257898938742311),
- FRAC_CONST(0.54395271706729609),
- FRAC_CONST(0.54532498842204646),
- FRAC_CONST(0.54669579977769045),
- FRAC_CONST(0.54806514746415402),
- FRAC_CONST(0.54943302781528081),
- FRAC_CONST(0.55079943716884383),
- FRAC_CONST(0.55216437186655387),
- FRAC_CONST(0.55352782825406999),
- FRAC_CONST(0.55488980268100907),
- FRAC_CONST(0.55625029150095584),
- FRAC_CONST(0.55760929107147217),
- FRAC_CONST(0.55896679775410718),
- FRAC_CONST(0.56032280791440714),
- FRAC_CONST(0.56167731792192455),
- FRAC_CONST(0.56303032415022869),
- FRAC_CONST(0.56438182297691453),
- FRAC_CONST(0.56573181078361312),
- FRAC_CONST(0.56708028395600085),
- FRAC_CONST(0.56842723888380908),
- FRAC_CONST(0.56977267196083425),
- FRAC_CONST(0.57111657958494688),
- FRAC_CONST(0.5724589581581021),
- FRAC_CONST(0.57379980408634845),
- FRAC_CONST(0.57513911377983773),
- FRAC_CONST(0.57647688365283478),
- FRAC_CONST(0.57781311012372738),
- FRAC_CONST(0.57914778961503466),
- FRAC_CONST(0.58048091855341843),
- FRAC_CONST(0.5818124933696911),
- FRAC_CONST(0.58314251049882604),
- FRAC_CONST(0.58447096637996743),
- FRAC_CONST(0.58579785745643886),
- FRAC_CONST(0.5871231801757536),
- FRAC_CONST(0.58844693098962408),
- FRAC_CONST(0.58976910635397084),
- FRAC_CONST(0.59108970272893235),
- FRAC_CONST(0.59240871657887517),
- FRAC_CONST(0.59372614437240179),
- FRAC_CONST(0.59504198258236196),
- FRAC_CONST(0.5963562276858605),
- FRAC_CONST(0.59766887616426767),
- FRAC_CONST(0.5989799245032289),
- FRAC_CONST(0.60028936919267273),
- FRAC_CONST(0.60159720672682204),
- FRAC_CONST(0.60290343360420195),
- FRAC_CONST(0.60420804632765002),
- FRAC_CONST(0.60551104140432543),
- FRAC_CONST(0.60681241534571839),
- FRAC_CONST(0.60811216466765883),
- FRAC_CONST(0.60941028589032709),
- FRAC_CONST(0.61070677553826169),
- FRAC_CONST(0.61200163014036979),
- FRAC_CONST(0.61329484622993602),
- FRAC_CONST(0.6145864203446314),
- FRAC_CONST(0.61587634902652377),
- FRAC_CONST(0.61716462882208556),
- FRAC_CONST(0.61845125628220421),
- FRAC_CONST(0.61973622796219074),
- FRAC_CONST(0.6210195404217892),
- FRAC_CONST(0.62230119022518593),
- FRAC_CONST(0.62358117394101897),
- FRAC_CONST(0.62485948814238634),
- FRAC_CONST(0.62613612940685637),
- FRAC_CONST(0.62741109431647646),
- FRAC_CONST(0.62868437945778133),
- FRAC_CONST(0.62995598142180387),
- FRAC_CONST(0.6312258968040827),
- FRAC_CONST(0.63249412220467238),
- FRAC_CONST(0.63376065422815175),
- FRAC_CONST(0.63502548948363347),
- FRAC_CONST(0.63628862458477287),
- FRAC_CONST(0.63755005614977711),
- FRAC_CONST(0.63880978080141437),
- FRAC_CONST(0.6400677951670225),
- FRAC_CONST(0.6413240958785188),
- FRAC_CONST(0.64257867957240766),
- FRAC_CONST(0.6438315428897915),
- FRAC_CONST(0.64508268247637779),
- FRAC_CONST(0.64633209498248945),
- FRAC_CONST(0.64757977706307335),
- FRAC_CONST(0.64882572537770888),
- FRAC_CONST(0.65006993659061751),
- FRAC_CONST(0.65131240737067142),
- FRAC_CONST(0.65255313439140239),
- FRAC_CONST(0.65379211433101081),
- FRAC_CONST(0.65502934387237444),
- FRAC_CONST(0.6562648197030575),
- FRAC_CONST(0.65749853851531959),
- FRAC_CONST(0.65873049700612374),
- FRAC_CONST(0.65996069187714679),
- FRAC_CONST(0.66118911983478657),
- FRAC_CONST(0.66241577759017178),
- FRAC_CONST(0.66364066185917048),
- FRAC_CONST(0.66486376936239888),
- FRAC_CONST(0.66608509682523009),
- FRAC_CONST(0.66730464097780284),
- FRAC_CONST(0.66852239855503071),
- FRAC_CONST(0.66973836629660977),
- FRAC_CONST(0.67095254094702894),
- FRAC_CONST(0.67216491925557675),
- FRAC_CONST(0.67337549797635199),
- FRAC_CONST(0.67458427386827102),
- FRAC_CONST(0.67579124369507693),
- FRAC_CONST(0.67699640422534846),
- FRAC_CONST(0.67819975223250772),
- FRAC_CONST(0.6794012844948305),
- FRAC_CONST(0.68060099779545302),
- FRAC_CONST(0.68179888892238183),
- FRAC_CONST(0.6829949546685018),
- FRAC_CONST(0.68418919183158522),
- FRAC_CONST(0.68538159721429948),
- FRAC_CONST(0.6865721676242168),
- FRAC_CONST(0.68776089987382172),
- FRAC_CONST(0.68894779078052026),
- FRAC_CONST(0.69013283716664853),
- FRAC_CONST(0.69131603585948032),
- FRAC_CONST(0.69249738369123692),
- FRAC_CONST(0.69367687749909468),
- FRAC_CONST(0.69485451412519361),
- FRAC_CONST(0.69603029041664599),
- FRAC_CONST(0.6972042032255451),
- FRAC_CONST(0.6983762494089728),
- FRAC_CONST(0.69954642582900894),
- FRAC_CONST(0.70071472935273893),
- FRAC_CONST(0.70188115685226271),
- FRAC_CONST(0.703045705204703),
- FRAC_CONST(0.70420837129221303),
- FRAC_CONST(0.70536915200198613),
- FRAC_CONST(0.70652804422626281),
- FRAC_CONST(0.70768504486233985),
- FRAC_CONST(0.70884015081257845),
- FRAC_CONST(0.70999335898441229),
- FRAC_CONST(0.711144666290356),
- FRAC_CONST(0.71229406964801356),
- FRAC_CONST(0.71344156598008623),
- FRAC_CONST(0.71458715221438096),
- FRAC_CONST(0.71573082528381871),
- FRAC_CONST(0.71687258212644234),
- FRAC_CONST(0.7180124196854254),
- FRAC_CONST(0.71915033490907943),
- FRAC_CONST(0.72028632475086318),
- FRAC_CONST(0.72142038616938997),
- FRAC_CONST(0.72255251612843596),
- FRAC_CONST(0.72368271159694852),
- FRAC_CONST(0.72481096954905444),
- FRAC_CONST(0.72593728696406756),
- FRAC_CONST(0.72706166082649704),
- FRAC_CONST(0.72818408812605595),
- FRAC_CONST(0.72930456585766834),
- FRAC_CONST(0.73042309102147851),
- FRAC_CONST(0.73153966062285747),
- FRAC_CONST(0.73265427167241282),
- FRAC_CONST(0.73376692118599507),
- FRAC_CONST(0.73487760618470677),
- FRAC_CONST(0.73598632369490979),
- FRAC_CONST(0.73709307074823405),
- FRAC_CONST(0.73819784438158409),
- FRAC_CONST(0.73930064163714881),
- FRAC_CONST(0.74040145956240788),
- FRAC_CONST(0.74150029521014049),
- FRAC_CONST(0.74259714563843304),
- FRAC_CONST(0.74369200791068657),
- FRAC_CONST(0.74478487909562552),
- FRAC_CONST(0.74587575626730485),
- FRAC_CONST(0.74696463650511791),
- FRAC_CONST(0.74805151689380456),
- FRAC_CONST(0.74913639452345926),
- FRAC_CONST(0.75021926648953785),
- FRAC_CONST(0.75130012989286621),
- FRAC_CONST(0.7523789818396478),
- FRAC_CONST(0.75345581944147111),
- FRAC_CONST(0.75453063981531809),
- FRAC_CONST(0.75560344008357094),
- FRAC_CONST(0.75667421737402052),
- FRAC_CONST(0.7577429688198738),
- FRAC_CONST(0.75880969155976163),
- FRAC_CONST(0.75987438273774599),
- FRAC_CONST(0.76093703950332836),
- FRAC_CONST(0.76199765901145666),
- FRAC_CONST(0.76305623842253345),
- FRAC_CONST(0.76411277490242291),
- FRAC_CONST(0.76516726562245885),
- FRAC_CONST(0.76621970775945258),
- FRAC_CONST(0.76727009849569949),
- FRAC_CONST(0.76831843501898767),
- FRAC_CONST(0.76936471452260458),
- FRAC_CONST(0.77040893420534517),
- FRAC_CONST(0.77145109127151923),
- FRAC_CONST(0.77249118293095853),
- FRAC_CONST(0.77352920639902467),
- FRAC_CONST(0.77456515889661659),
- FRAC_CONST(0.77559903765017746),
- FRAC_CONST(0.7766308398917029),
- FRAC_CONST(0.77766056285874774),
- FRAC_CONST(0.77868820379443371),
- FRAC_CONST(0.77971375994745684),
- FRAC_CONST(0.78073722857209438),
- FRAC_CONST(0.7817586069282132),
- FRAC_CONST(0.78277789228127592),
- FRAC_CONST(0.78379508190234881),
- FRAC_CONST(0.78481017306810918),
- FRAC_CONST(0.78582316306085265),
- FRAC_CONST(0.78683404916849986),
- FRAC_CONST(0.78784282868460476),
- FRAC_CONST(0.78884949890836087),
- FRAC_CONST(0.78985405714460888),
- FRAC_CONST(0.7908565007038445),
- FRAC_CONST(0.79185682690222425),
- FRAC_CONST(0.79285503306157412),
- FRAC_CONST(0.79385111650939566),
- FRAC_CONST(0.79484507457887377),
- FRAC_CONST(0.79583690460888357),
- FRAC_CONST(0.79682660394399751),
- FRAC_CONST(0.79781416993449272),
- FRAC_CONST(0.79879959993635785),
- FRAC_CONST(0.7997828913113002),
- FRAC_CONST(0.80076404142675273),
- FRAC_CONST(0.80174304765588156),
- FRAC_CONST(0.80271990737759213),
- FRAC_CONST(0.80369461797653707),
- FRAC_CONST(0.80466717684312306),
- FRAC_CONST(0.80563758137351682),
- FRAC_CONST(0.80660582896965372),
- FRAC_CONST(0.80757191703924336),
- FRAC_CONST(0.80853584299577752),
- FRAC_CONST(0.80949760425853612),
- FRAC_CONST(0.81045719825259477),
- FRAC_CONST(0.81141462240883167),
- FRAC_CONST(0.81236987416393436),
- FRAC_CONST(0.81332295096040608),
- FRAC_CONST(0.81427385024657373),
- FRAC_CONST(0.81522256947659355),
- FRAC_CONST(0.81616910611045879),
- FRAC_CONST(0.817113457614006),
- FRAC_CONST(0.81805562145892186),
- FRAC_CONST(0.81899559512275044),
- FRAC_CONST(0.81993337608889916),
- FRAC_CONST(0.82086896184664637),
- FRAC_CONST(0.8218023498911472),
- FRAC_CONST(0.82273353772344116),
- FRAC_CONST(0.82366252285045805),
- FRAC_CONST(0.82458930278502529),
- FRAC_CONST(0.82551387504587381),
- FRAC_CONST(0.82643623715764558),
- FRAC_CONST(0.82735638665089983),
- FRAC_CONST(0.82827432106211907),
- FRAC_CONST(0.82919003793371693),
- FRAC_CONST(0.83010353481404364),
- FRAC_CONST(0.83101480925739324),
- FRAC_CONST(0.83192385882400965),
- FRAC_CONST(0.83283068108009373),
- FRAC_CONST(0.8337352735978093),
- FRAC_CONST(0.83463763395529011),
- FRAC_CONST(0.83553775973664579),
- FRAC_CONST(0.83643564853196872),
- FRAC_CONST(0.83733129793734051),
- FRAC_CONST(0.83822470555483797),
- FRAC_CONST(0.83911586899254031),
- FRAC_CONST(0.84000478586453453),
- FRAC_CONST(0.84089145379092289),
- FRAC_CONST(0.84177587039782842),
- FRAC_CONST(0.84265803331740163),
- FRAC_CONST(0.84353794018782702),
- FRAC_CONST(0.844415588653329),
- FRAC_CONST(0.8452909763641786),
- FRAC_CONST(0.84616410097669936),
- FRAC_CONST(0.84703496015327406),
- FRAC_CONST(0.84790355156235053),
- FRAC_CONST(0.84876987287844818),
- FRAC_CONST(0.8496339217821639),
- FRAC_CONST(0.85049569596017938),
- FRAC_CONST(0.85135519310526508),
- FRAC_CONST(0.85221241091628896),
- FRAC_CONST(0.85306734709822085),
- FRAC_CONST(0.85391999936213903),
- FRAC_CONST(0.85477036542523732),
- FRAC_CONST(0.85561844301082923),
- FRAC_CONST(0.85646422984835635),
- FRAC_CONST(0.85730772367339259),
- FRAC_CONST(0.85814892222765116),
- FRAC_CONST(0.85898782325899026),
- FRAC_CONST(0.85982442452141961),
- FRAC_CONST(0.86065872377510555),
- FRAC_CONST(0.86149071878637817),
- FRAC_CONST(0.8623204073277364),
- FRAC_CONST(0.86314778717785412),
- FRAC_CONST(0.8639728561215867),
- FRAC_CONST(0.86479561194997623),
- FRAC_CONST(0.86561605246025763),
- FRAC_CONST(0.86643417545586487),
- FRAC_CONST(0.8672499787464365),
- FRAC_CONST(0.86806346014782154),
- FRAC_CONST(0.8688746174820855),
- FRAC_CONST(0.86968344857751589),
- FRAC_CONST(0.87048995126862883),
- FRAC_CONST(0.87129412339617363),
- FRAC_CONST(0.87209596280713941),
- FRAC_CONST(0.8728954673547612),
- FRAC_CONST(0.87369263489852422),
- FRAC_CONST(0.87448746330417149),
- FRAC_CONST(0.87527995044370765),
- FRAC_CONST(0.8760700941954066),
- FRAC_CONST(0.87685789244381551),
- FRAC_CONST(0.87764334307976144),
- FRAC_CONST(0.87842644400035663),
- FRAC_CONST(0.8792071931090043),
- FRAC_CONST(0.87998558831540408),
- FRAC_CONST(0.88076162753555787),
- FRAC_CONST(0.88153530869177488),
- FRAC_CONST(0.88230662971267804),
- FRAC_CONST(0.88307558853320878),
- FRAC_CONST(0.88384218309463292),
- FRAC_CONST(0.8846064113445461),
- FRAC_CONST(0.88536827123687933),
- FRAC_CONST(0.88612776073190425),
- FRAC_CONST(0.88688487779623937),
- FRAC_CONST(0.88763962040285393),
- FRAC_CONST(0.8883919865310751),
- FRAC_CONST(0.88914197416659235),
- FRAC_CONST(0.88988958130146301),
- FRAC_CONST(0.8906348059341177),
- FRAC_CONST(0.89137764606936609),
- FRAC_CONST(0.89211809971840139),
- FRAC_CONST(0.89285616489880615),
- FRAC_CONST(0.89359183963455813),
- FRAC_CONST(0.89432512195603453),
- FRAC_CONST(0.89505600990001799),
- FRAC_CONST(0.89578450150970124),
- FRAC_CONST(0.8965105948346932),
- FRAC_CONST(0.89723428793102367),
- FRAC_CONST(0.89795557886114807),
- FRAC_CONST(0.89867446569395382),
- FRAC_CONST(0.89939094650476448),
- FRAC_CONST(0.90010501937534515),
- FRAC_CONST(0.900816682393908),
- FRAC_CONST(0.90152593365511691),
- FRAC_CONST(0.90223277126009283),
- FRAC_CONST(0.90293719331641886),
- FRAC_CONST(0.90363919793814496),
- FRAC_CONST(0.90433878324579353),
- FRAC_CONST(0.90503594736636439),
- FRAC_CONST(0.90573068843333915),
- FRAC_CONST(0.90642300458668679),
- FRAC_CONST(0.90711289397286898),
- FRAC_CONST(0.90780035474484411),
- FRAC_CONST(0.90848538506207266),
- FRAC_CONST(0.90916798309052227),
- FRAC_CONST(0.90984814700267291),
- FRAC_CONST(0.9105258749775208),
- FRAC_CONST(0.91120116520058425),
- FRAC_CONST(0.91187401586390815),
- FRAC_CONST(0.91254442516606893),
- FRAC_CONST(0.9132123913121788),
- FRAC_CONST(0.91387791251389161),
- FRAC_CONST(0.91454098698940678),
- FRAC_CONST(0.91520161296347435),
- FRAC_CONST(0.91585978866739981),
- FRAC_CONST(0.91651551233904871),
- FRAC_CONST(0.91716878222285148),
- FRAC_CONST(0.91781959656980805),
- FRAC_CONST(0.91846795363749245),
- FRAC_CONST(0.91911385169005766),
- FRAC_CONST(0.9197572889982405),
- FRAC_CONST(0.9203982638393654),
- FRAC_CONST(0.92103677449734989),
- FRAC_CONST(0.92167281926270861),
- FRAC_CONST(0.92230639643255874),
- FRAC_CONST(0.92293750431062316),
- FRAC_CONST(0.92356614120723612),
- FRAC_CONST(0.92419230543934783),
- FRAC_CONST(0.92481599533052783),
- FRAC_CONST(0.92543720921097061),
- FRAC_CONST(0.92605594541749991),
- FRAC_CONST(0.92667220229357261),
- FRAC_CONST(0.92728597818928349),
- FRAC_CONST(0.9278972714613698),
- FRAC_CONST(0.92850608047321548),
- FRAC_CONST(0.9291124035948557),
- FRAC_CONST(0.92971623920298097),
- FRAC_CONST(0.93031758568094147),
- FRAC_CONST(0.93091644141875196),
- FRAC_CONST(0.93151280481309506),
- FRAC_CONST(0.93210667426732674),
- FRAC_CONST(0.93269804819147983),
- FRAC_CONST(0.93328692500226818),
- FRAC_CONST(0.93387330312309147),
- FRAC_CONST(0.93445718098403896),
- FRAC_CONST(0.93503855702189376),
- FRAC_CONST(0.9356174296801375),
- FRAC_CONST(0.93619379740895381),
- FRAC_CONST(0.93676765866523259),
- FRAC_CONST(0.93733901191257496),
- FRAC_CONST(0.93790785562129597),
- FRAC_CONST(0.93847418826842988),
- FRAC_CONST(0.93903800833773399),
- FRAC_CONST(0.93959931431969212),
- FRAC_CONST(0.94015810471151917),
- FRAC_CONST(0.94071437801716529),
- FRAC_CONST(0.94126813274731924),
- FRAC_CONST(0.94181936741941319),
- FRAC_CONST(0.94236808055762578),
- FRAC_CONST(0.94291427069288691),
- FRAC_CONST(0.94345793636288133),
- FRAC_CONST(0.94399907611205225),
- FRAC_CONST(0.9445376884916058),
- FRAC_CONST(0.94507377205951448),
- FRAC_CONST(0.94560732538052128),
- FRAC_CONST(0.94613834702614352),
- FRAC_CONST(0.94666683557467624),
- FRAC_CONST(0.94719278961119657),
- FRAC_CONST(0.94771620772756759),
- FRAC_CONST(0.94823708852244104),
- FRAC_CONST(0.94875543060126255),
- FRAC_CONST(0.94927123257627433),
- FRAC_CONST(0.94978449306651924),
- FRAC_CONST(0.95029521069784428),
- FRAC_CONST(0.9508033841029051),
- FRAC_CONST(0.95130901192116835),
- FRAC_CONST(0.9518120927989161),
- FRAC_CONST(0.95231262538924943),
- FRAC_CONST(0.95281060835209208),
- FRAC_CONST(0.95330604035419386),
- FRAC_CONST(0.95379892006913403),
- FRAC_CONST(0.95428924617732525),
- FRAC_CONST(0.95477701736601728),
- FRAC_CONST(0.95526223232929941),
- FRAC_CONST(0.95574488976810545),
- FRAC_CONST(0.95622498839021619),
- FRAC_CONST(0.95670252691026292),
- FRAC_CONST(0.95717750404973156),
- FRAC_CONST(0.95764991853696524),
- FRAC_CONST(0.95811976910716812),
- FRAC_CONST(0.95858705450240911),
- FRAC_CONST(0.95905177347162429),
- FRAC_CONST(0.95951392477062125),
- FRAC_CONST(0.95997350716208196),
- FRAC_CONST(0.96043051941556579),
- FRAC_CONST(0.96088496030751369),
- FRAC_CONST(0.96133682862125036),
- FRAC_CONST(0.96178612314698864),
- FRAC_CONST(0.96223284268183173),
- FRAC_CONST(0.9626769860297768),
- FRAC_CONST(0.96311855200171881),
- FRAC_CONST(0.96355753941545252),
- FRAC_CONST(0.96399394709567654),
- FRAC_CONST(0.96442777387399625),
- FRAC_CONST(0.96485901858892686),
- FRAC_CONST(0.96528768008589627),
- FRAC_CONST(0.96571375721724895),
- FRAC_CONST(0.96613724884224783),
- FRAC_CONST(0.96655815382707866),
- FRAC_CONST(0.96697647104485207),
- FRAC_CONST(0.96739219937560694),
- FRAC_CONST(0.96780533770631338),
- FRAC_CONST(0.96821588493087585),
- FRAC_CONST(0.9686238399501359),
- FRAC_CONST(0.96902920167187501),
- FRAC_CONST(0.96943196901081796),
- FRAC_CONST(0.96983214088863534),
- FRAC_CONST(0.9702297162339466),
- FRAC_CONST(0.97062469398232287),
- FRAC_CONST(0.97101707307629004),
- FRAC_CONST(0.97140685246533098),
- FRAC_CONST(0.97179403110588902),
- FRAC_CONST(0.97217860796137046),
- FRAC_CONST(0.97256058200214734),
- FRAC_CONST(0.97293995220556007),
- FRAC_CONST(0.97331671755592064),
- FRAC_CONST(0.97369087704451474),
- FRAC_CONST(0.97406242966960455),
- FRAC_CONST(0.97443137443643235),
- FRAC_CONST(0.97479771035722163),
- FRAC_CONST(0.97516143645118103),
- FRAC_CONST(0.97552255174450631),
- FRAC_CONST(0.97588105527038305),
- FRAC_CONST(0.97623694606898959),
- FRAC_CONST(0.97659022318749911),
- FRAC_CONST(0.97694088568008242),
- FRAC_CONST(0.97728893260791039),
- FRAC_CONST(0.97763436303915685),
- FRAC_CONST(0.97797717604900047),
- FRAC_CONST(0.97831737071962765),
- FRAC_CONST(0.97865494614023485),
- FRAC_CONST(0.97898990140703124),
- FRAC_CONST(0.97932223562324061),
- FRAC_CONST(0.97965194789910426),
- FRAC_CONST(0.9799790373518833),
- FRAC_CONST(0.98030350310586067),
- FRAC_CONST(0.98062534429234405),
- FRAC_CONST(0.98094456004966768),
- FRAC_CONST(0.98126114952319499),
- FRAC_CONST(0.98157511186532054),
- FRAC_CONST(0.98188644623547261),
- FRAC_CONST(0.98219515180011563),
- FRAC_CONST(0.98250122773275184),
- FRAC_CONST(0.98280467321392362),
- FRAC_CONST(0.98310548743121629),
- FRAC_CONST(0.98340366957925973),
- FRAC_CONST(0.98369921885973044),
- FRAC_CONST(0.98399213448135414),
- FRAC_CONST(0.98428241565990748),
- FRAC_CONST(0.98457006161822058),
- FRAC_CONST(0.98485507158617835),
- FRAC_CONST(0.98513744480072363),
- FRAC_CONST(0.98541718050585803),
- FRAC_CONST(0.98569427795264519),
- FRAC_CONST(0.98596873639921168),
- FRAC_CONST(0.98624055511074971),
- FRAC_CONST(0.98650973335951875),
- FRAC_CONST(0.98677627042484772),
- FRAC_CONST(0.98704016559313645),
- FRAC_CONST(0.98730141815785832),
- FRAC_CONST(0.98756002741956173),
- FRAC_CONST(0.9878159926858715),
- FRAC_CONST(0.98806931327149194),
- FRAC_CONST(0.98831998849820735),
- FRAC_CONST(0.98856801769488489),
- FRAC_CONST(0.98881340019747566),
- FRAC_CONST(0.98905613534901682),
- FRAC_CONST(0.98929622249963345),
- FRAC_CONST(0.98953366100653983),
- FRAC_CONST(0.98976845023404181),
- FRAC_CONST(0.99000058955353776),
- FRAC_CONST(0.99023007834352106),
- FRAC_CONST(0.99045691598958097),
- FRAC_CONST(0.99068110188440506),
- FRAC_CONST(0.99090263542778001),
- FRAC_CONST(0.99112151602659404),
- FRAC_CONST(0.99133774309483769),
- FRAC_CONST(0.99155131605360625),
- FRAC_CONST(0.99176223433110056),
- FRAC_CONST(0.99197049736262888),
- FRAC_CONST(0.99217610459060845),
- FRAC_CONST(0.99237905546456673),
- FRAC_CONST(0.99257934944114334),
- FRAC_CONST(0.99277698598409092),
- FRAC_CONST(0.99297196456427694),
- FRAC_CONST(0.99316428465968509),
- FRAC_CONST(0.99335394575541669),
- FRAC_CONST(0.99354094734369169),
- FRAC_CONST(0.99372528892385081),
- FRAC_CONST(0.99390697000235606),
- FRAC_CONST(0.99408599009279242),
- FRAC_CONST(0.99426234871586938),
- FRAC_CONST(0.99443604539942176),
- FRAC_CONST(0.99460707967841133),
- FRAC_CONST(0.99477545109492771),
- FRAC_CONST(0.99494115919819004),
- FRAC_CONST(0.99510420354454787),
- FRAC_CONST(0.99526458369748239),
- FRAC_CONST(0.99542229922760772),
- FRAC_CONST(0.99557734971267187),
- FRAC_CONST(0.9957297347375581),
- FRAC_CONST(0.99587945389428578),
- FRAC_CONST(0.99602650678201154),
- FRAC_CONST(0.99617089300703077),
- FRAC_CONST(0.996312612182778),
- FRAC_CONST(0.99645166392982831),
- FRAC_CONST(0.99658804787589839),
- FRAC_CONST(0.99672176365584741),
- FRAC_CONST(0.99685281091167788),
- FRAC_CONST(0.99698118929253687),
- FRAC_CONST(0.99710689845471678),
- FRAC_CONST(0.99722993806165661),
- FRAC_CONST(0.99735030778394196),
- FRAC_CONST(0.99746800729930707),
- FRAC_CONST(0.99758303629263489),
- FRAC_CONST(0.99769539445595812),
- FRAC_CONST(0.99780508148846014),
- FRAC_CONST(0.99791209709647588),
- FRAC_CONST(0.99801644099349218),
- FRAC_CONST(0.99811811290014918),
- FRAC_CONST(0.9982171125442405),
- FRAC_CONST(0.9983134396607144),
- FRAC_CONST(0.99840709399167404),
- FRAC_CONST(0.99849807528637868),
- FRAC_CONST(0.99858638330124405),
- FRAC_CONST(0.99867201779984294),
- FRAC_CONST(0.99875497855290607),
- FRAC_CONST(0.99883526533832245),
- FRAC_CONST(0.99891287794114036),
- FRAC_CONST(0.99898781615356746),
- FRAC_CONST(0.99906007977497147),
- FRAC_CONST(0.99912966861188113),
- FRAC_CONST(0.99919658247798593),
- FRAC_CONST(0.99926082119413751),
- FRAC_CONST(0.99932238458834954),
- FRAC_CONST(0.999381272495798),
- FRAC_CONST(0.99943748475882255),
- FRAC_CONST(0.9994910212269259),
- FRAC_CONST(0.99954188175677483),
- FRAC_CONST(0.99959006621220048),
- FRAC_CONST(0.99963557446419837),
- FRAC_CONST(0.99967840639092931),
- FRAC_CONST(0.99971856187771946),
- FRAC_CONST(0.99975604081706027),
- FRAC_CONST(0.99979084310860955),
- FRAC_CONST(0.99982296865919107),
- FRAC_CONST(0.99985241738279484),
- FRAC_CONST(0.99987918920057806),
- FRAC_CONST(0.99990328404086426),
- FRAC_CONST(0.9999247018391445),
- FRAC_CONST(0.99994344253807688),
- FRAC_CONST(0.99995950608748674),
- FRAC_CONST(0.99997289244436727),
- FRAC_CONST(0.99998360157287902),
- FRAC_CONST(0.9999916334443506),
- FRAC_CONST(0.99999698803727821),
- FRAC_CONST(0.99999966533732598)
- };
+ALIGN static const real_t sine_long_960[] =
+{
+ FRAC_CONST(0.00081812299560725323),
+ FRAC_CONST(0.0024543667964602917),
+ FRAC_CONST(0.0040906040262347889),
+ FRAC_CONST(0.0057268303042312674),
+ FRAC_CONST(0.0073630412497795667),
+ FRAC_CONST(0.0089992324822505774),
+ FRAC_CONST(0.010635399621067975),
+ FRAC_CONST(0.012271538285719924),
+ FRAC_CONST(0.013907644095770845),
+ FRAC_CONST(0.015543712670873098),
+ FRAC_CONST(0.017179739630778748),
+ FRAC_CONST(0.018815720595351273),
+ FRAC_CONST(0.020451651184577292),
+ FRAC_CONST(0.022087527018578291),
+ FRAC_CONST(0.023723343717622358),
+ FRAC_CONST(0.025359096902135895),
+ FRAC_CONST(0.02699478219271537),
+ FRAC_CONST(0.028630395210139003),
+ FRAC_CONST(0.030265931575378519),
+ FRAC_CONST(0.031901386909610863),
+ FRAC_CONST(0.033536756834229922),
+ FRAC_CONST(0.035172036970858266),
+ FRAC_CONST(0.036807222941358832),
+ FRAC_CONST(0.038442310367846677),
+ FRAC_CONST(0.040077294872700696),
+ FRAC_CONST(0.041712172078575326),
+ FRAC_CONST(0.043346937608412288),
+ FRAC_CONST(0.044981587085452281),
+ FRAC_CONST(0.046616116133246711),
+ FRAC_CONST(0.048250520375669431),
+ FRAC_CONST(0.049884795436928406),
+ FRAC_CONST(0.051518936941577477),
+ FRAC_CONST(0.053152940514528055),
+ FRAC_CONST(0.05478680178106083),
+ FRAC_CONST(0.056420516366837495),
+ FRAC_CONST(0.05805407989791244),
+ FRAC_CONST(0.059687488000744485),
+ FRAC_CONST(0.061320736302208578),
+ FRAC_CONST(0.062953820429607482),
+ FRAC_CONST(0.064586736010683557),
+ FRAC_CONST(0.066219478673630344),
+ FRAC_CONST(0.06785204404710439),
+ FRAC_CONST(0.069484427760236861),
+ FRAC_CONST(0.071116625442645326),
+ FRAC_CONST(0.072748632724445372),
+ FRAC_CONST(0.07438044523626236),
+ FRAC_CONST(0.076012058609243122),
+ FRAC_CONST(0.077643468475067631),
+ FRAC_CONST(0.079274670465960706),
+ FRAC_CONST(0.080905660214703745),
+ FRAC_CONST(0.082536433354646319),
+ FRAC_CONST(0.084166985519717977),
+ FRAC_CONST(0.085797312344439894),
+ FRAC_CONST(0.08742740946393647),
+ FRAC_CONST(0.089057272513947183),
+ FRAC_CONST(0.090686897130838162),
+ FRAC_CONST(0.092316278951613845),
+ FRAC_CONST(0.093945413613928788),
+ FRAC_CONST(0.095574296756099186),
+ FRAC_CONST(0.097202924017114667),
+ FRAC_CONST(0.098831291036649963),
+ FRAC_CONST(0.10045939345507648),
+ FRAC_CONST(0.10208722691347409),
+ FRAC_CONST(0.10371478705364276),
+ FRAC_CONST(0.10534206951811415),
+ FRAC_CONST(0.10696906995016341),
+ FRAC_CONST(0.10859578399382072),
+ FRAC_CONST(0.11022220729388306),
+ FRAC_CONST(0.11184833549592579),
+ FRAC_CONST(0.11347416424631435),
+ FRAC_CONST(0.11509968919221586),
+ FRAC_CONST(0.11672490598161089),
+ FRAC_CONST(0.11834981026330495),
+ FRAC_CONST(0.11997439768694031),
+ FRAC_CONST(0.12159866390300751),
+ FRAC_CONST(0.12322260456285709),
+ FRAC_CONST(0.12484621531871121),
+ FRAC_CONST(0.12646949182367517),
+ FRAC_CONST(0.12809242973174936),
+ FRAC_CONST(0.12971502469784052),
+ FRAC_CONST(0.13133727237777362),
+ FRAC_CONST(0.13295916842830346),
+ FRAC_CONST(0.13458070850712617),
+ FRAC_CONST(0.13620188827289101),
+ FRAC_CONST(0.1378227033852118),
+ FRAC_CONST(0.13944314950467873),
+ FRAC_CONST(0.14106322229286994),
+ FRAC_CONST(0.14268291741236291),
+ FRAC_CONST(0.14430223052674654),
+ FRAC_CONST(0.1459211573006321),
+ FRAC_CONST(0.14753969339966552),
+ FRAC_CONST(0.14915783449053857),
+ FRAC_CONST(0.15077557624100058),
+ FRAC_CONST(0.15239291431987001),
+ FRAC_CONST(0.1540098443970461),
+ FRAC_CONST(0.15562636214352044),
+ FRAC_CONST(0.15724246323138855),
+ FRAC_CONST(0.15885814333386142),
+ FRAC_CONST(0.16047339812527725),
+ FRAC_CONST(0.16208822328111283),
+ FRAC_CONST(0.16370261447799525),
+ FRAC_CONST(0.16531656739371339),
+ FRAC_CONST(0.16693007770722967),
+ FRAC_CONST(0.16854314109869134),
+ FRAC_CONST(0.17015575324944232),
+ FRAC_CONST(0.17176790984203447),
+ FRAC_CONST(0.17337960656023954),
+ FRAC_CONST(0.1749908390890603),
+ FRAC_CONST(0.17660160311474243),
+ FRAC_CONST(0.17821189432478593),
+ FRAC_CONST(0.17982170840795647),
+ FRAC_CONST(0.18143104105429744),
+ FRAC_CONST(0.18303988795514095),
+ FRAC_CONST(0.1846482448031197),
+ FRAC_CONST(0.18625610729217834),
+ FRAC_CONST(0.1878634711175852),
+ FRAC_CONST(0.18947033197594348),
+ FRAC_CONST(0.19107668556520319),
+ FRAC_CONST(0.19268252758467228),
+ FRAC_CONST(0.19428785373502844),
+ FRAC_CONST(0.19589265971833042),
+ FRAC_CONST(0.19749694123802966),
+ FRAC_CONST(0.19910069399898173),
+ FRAC_CONST(0.20070391370745785),
+ FRAC_CONST(0.20230659607115639),
+ FRAC_CONST(0.20390873679921437),
+ FRAC_CONST(0.20551033160221882),
+ FRAC_CONST(0.20711137619221856),
+ FRAC_CONST(0.2087118662827353),
+ FRAC_CONST(0.21031179758877552),
+ FRAC_CONST(0.21191116582684155),
+ FRAC_CONST(0.21350996671494335),
+ FRAC_CONST(0.21510819597260972),
+ FRAC_CONST(0.21670584932089998),
+ FRAC_CONST(0.2183029224824154),
+ FRAC_CONST(0.21989941118131037),
+ FRAC_CONST(0.22149531114330431),
+ FRAC_CONST(0.22309061809569264),
+ FRAC_CONST(0.22468532776735861),
+ FRAC_CONST(0.22627943588878449),
+ FRAC_CONST(0.22787293819206314),
+ FRAC_CONST(0.22946583041090929),
+ FRAC_CONST(0.23105810828067114),
+ FRAC_CONST(0.23264976753834157),
+ FRAC_CONST(0.23424080392256985),
+ FRAC_CONST(0.2358312131736727),
+ FRAC_CONST(0.23742099103364595),
+ FRAC_CONST(0.23901013324617584),
+ FRAC_CONST(0.24059863555665045),
+ FRAC_CONST(0.24218649371217096),
+ FRAC_CONST(0.24377370346156332),
+ FRAC_CONST(0.24536026055538934),
+ FRAC_CONST(0.24694616074595824),
+ FRAC_CONST(0.24853139978733788),
+ FRAC_CONST(0.25011597343536629),
+ FRAC_CONST(0.25169987744766298),
+ FRAC_CONST(0.25328310758364025),
+ FRAC_CONST(0.25486565960451457),
+ FRAC_CONST(0.25644752927331788),
+ FRAC_CONST(0.25802871235490898),
+ FRAC_CONST(0.25960920461598508),
+ FRAC_CONST(0.26118900182509258),
+ FRAC_CONST(0.26276809975263904),
+ FRAC_CONST(0.264346494170904),
+ FRAC_CONST(0.26592418085405067),
+ FRAC_CONST(0.26750115557813692),
+ FRAC_CONST(0.2690774141211269),
+ FRAC_CONST(0.27065295226290209),
+ FRAC_CONST(0.2722277657852728),
+ FRAC_CONST(0.27380185047198918),
+ FRAC_CONST(0.27537520210875299),
+ FRAC_CONST(0.2769478164832283),
+ FRAC_CONST(0.27851968938505312),
+ FRAC_CONST(0.28009081660585067),
+ FRAC_CONST(0.28166119393924061),
+ FRAC_CONST(0.28323081718085019),
+ FRAC_CONST(0.28479968212832563),
+ FRAC_CONST(0.28636778458134327),
+ FRAC_CONST(0.28793512034162105),
+ FRAC_CONST(0.2895016852129294),
+ FRAC_CONST(0.29106747500110264),
+ FRAC_CONST(0.29263248551405047),
+ FRAC_CONST(0.2941967125617686),
+ FRAC_CONST(0.29576015195635058),
+ FRAC_CONST(0.29732279951199847),
+ FRAC_CONST(0.29888465104503475),
+ FRAC_CONST(0.30044570237391266),
+ FRAC_CONST(0.30200594931922808),
+ FRAC_CONST(0.30356538770373032),
+ FRAC_CONST(0.30512401335233358),
+ FRAC_CONST(0.30668182209212791),
+ FRAC_CONST(0.3082388097523906),
+ FRAC_CONST(0.30979497216459695),
+ FRAC_CONST(0.31135030516243201),
+ FRAC_CONST(0.3129048045818012),
+ FRAC_CONST(0.31445846626084178),
+ FRAC_CONST(0.31601128603993378),
+ FRAC_CONST(0.31756325976171151),
+ FRAC_CONST(0.31911438327107416),
+ FRAC_CONST(0.32066465241519732),
+ FRAC_CONST(0.32221406304354389),
+ FRAC_CONST(0.3237626110078754),
+ FRAC_CONST(0.32531029216226293),
+ FRAC_CONST(0.32685710236309828),
+ FRAC_CONST(0.32840303746910487),
+ FRAC_CONST(0.32994809334134939),
+ FRAC_CONST(0.3314922658432522),
+ FRAC_CONST(0.33303555084059877),
+ FRAC_CONST(0.33457794420155085),
+ FRAC_CONST(0.33611944179665709),
+ FRAC_CONST(0.33766003949886464),
+ FRAC_CONST(0.33919973318352969),
+ FRAC_CONST(0.34073851872842903),
+ FRAC_CONST(0.34227639201377064),
+ FRAC_CONST(0.34381334892220483),
+ FRAC_CONST(0.34534938533883547),
+ FRAC_CONST(0.34688449715123082),
+ FRAC_CONST(0.34841868024943456),
+ FRAC_CONST(0.34995193052597684),
+ FRAC_CONST(0.35148424387588523),
+ FRAC_CONST(0.3530156161966958),
+ FRAC_CONST(0.35454604338846402),
+ FRAC_CONST(0.35607552135377557),
+ FRAC_CONST(0.35760404599775775),
+ FRAC_CONST(0.35913161322809023),
+ FRAC_CONST(0.36065821895501554),
+ FRAC_CONST(0.36218385909135092),
+ FRAC_CONST(0.36370852955249849),
+ FRAC_CONST(0.36523222625645668),
+ FRAC_CONST(0.36675494512383078),
+ FRAC_CONST(0.36827668207784414),
+ FRAC_CONST(0.36979743304434909),
+ FRAC_CONST(0.37131719395183754),
+ FRAC_CONST(0.37283596073145214),
+ FRAC_CONST(0.37435372931699717),
+ FRAC_CONST(0.37587049564494951),
+ FRAC_CONST(0.37738625565446909),
+ FRAC_CONST(0.37890100528741022),
+ FRAC_CONST(0.38041474048833229),
+ FRAC_CONST(0.38192745720451066),
+ FRAC_CONST(0.38343915138594736),
+ FRAC_CONST(0.38494981898538222),
+ FRAC_CONST(0.38645945595830333),
+ FRAC_CONST(0.38796805826295838),
+ FRAC_CONST(0.38947562186036483),
+ FRAC_CONST(0.39098214271432141),
+ FRAC_CONST(0.39248761679141814),
+ FRAC_CONST(0.3939920400610481),
+ FRAC_CONST(0.39549540849541737),
+ FRAC_CONST(0.39699771806955625),
+ FRAC_CONST(0.39849896476132979),
+ FRAC_CONST(0.39999914455144892),
+ FRAC_CONST(0.40149825342348083),
+ FRAC_CONST(0.4029962873638599),
+ FRAC_CONST(0.40449324236189854),
+ FRAC_CONST(0.40598911440979762),
+ FRAC_CONST(0.40748389950265762),
+ FRAC_CONST(0.40897759363848879),
+ FRAC_CONST(0.41047019281822261),
+ FRAC_CONST(0.41196169304572178),
+ FRAC_CONST(0.4134520903277914),
+ FRAC_CONST(0.41494138067418929),
+ FRAC_CONST(0.41642956009763715),
+ FRAC_CONST(0.41791662461383078),
+ FRAC_CONST(0.41940257024145089),
+ FRAC_CONST(0.42088739300217382),
+ FRAC_CONST(0.42237108892068231),
+ FRAC_CONST(0.42385365402467584),
+ FRAC_CONST(0.42533508434488143),
+ FRAC_CONST(0.42681537591506419),
+ FRAC_CONST(0.42829452477203828),
+ FRAC_CONST(0.42977252695567697),
+ FRAC_CONST(0.43124937850892364),
+ FRAC_CONST(0.4327250754778022),
+ FRAC_CONST(0.43419961391142781),
+ FRAC_CONST(0.43567298986201736),
+ FRAC_CONST(0.43714519938489987),
+ FRAC_CONST(0.43861623853852766),
+ FRAC_CONST(0.44008610338448595),
+ FRAC_CONST(0.44155478998750436),
+ FRAC_CONST(0.44302229441546676),
+ FRAC_CONST(0.4444886127394222),
+ FRAC_CONST(0.44595374103359531),
+ FRAC_CONST(0.44741767537539667),
+ FRAC_CONST(0.44888041184543348),
+ FRAC_CONST(0.45034194652752002),
+ FRAC_CONST(0.45180227550868812),
+ FRAC_CONST(0.45326139487919759),
+ FRAC_CONST(0.45471930073254679),
+ FRAC_CONST(0.45617598916548296),
+ FRAC_CONST(0.45763145627801283),
+ FRAC_CONST(0.45908569817341294),
+ FRAC_CONST(0.46053871095824001),
+ FRAC_CONST(0.46199049074234161),
+ FRAC_CONST(0.46344103363886635),
+ FRAC_CONST(0.46489033576427435),
+ FRAC_CONST(0.46633839323834758),
+ FRAC_CONST(0.46778520218420055),
+ FRAC_CONST(0.46923075872829029),
+ FRAC_CONST(0.47067505900042683),
+ FRAC_CONST(0.47211809913378361),
+ FRAC_CONST(0.47355987526490806),
+ FRAC_CONST(0.47500038353373153),
+ FRAC_CONST(0.47643962008357982),
+ FRAC_CONST(0.47787758106118372),
+ FRAC_CONST(0.47931426261668875),
+ FRAC_CONST(0.48074966090366611),
+ FRAC_CONST(0.48218377207912272),
+ FRAC_CONST(0.48361659230351117),
+ FRAC_CONST(0.48504811774074069),
+ FRAC_CONST(0.48647834455818684),
+ FRAC_CONST(0.48790726892670194),
+ FRAC_CONST(0.48933488702062544),
+ FRAC_CONST(0.49076119501779414),
+ FRAC_CONST(0.49218618909955225),
+ FRAC_CONST(0.4936098654507618),
+ FRAC_CONST(0.49503222025981269),
+ FRAC_CONST(0.49645324971863303),
+ FRAC_CONST(0.49787295002269943),
+ FRAC_CONST(0.49929131737104687),
+ FRAC_CONST(0.50070834796627917),
+ FRAC_CONST(0.50212403801457872),
+ FRAC_CONST(0.50353838372571758),
+ FRAC_CONST(0.50495138131306638),
+ FRAC_CONST(0.50636302699360547),
+ FRAC_CONST(0.50777331698793449),
+ FRAC_CONST(0.50918224752028263),
+ FRAC_CONST(0.51058981481851906),
+ FRAC_CONST(0.51199601511416237),
+ FRAC_CONST(0.51340084464239111),
+ FRAC_CONST(0.51480429964205421),
+ FRAC_CONST(0.51620637635567967),
+ FRAC_CONST(0.51760707102948678),
+ FRAC_CONST(0.51900637991339404),
+ FRAC_CONST(0.5204042992610306),
+ FRAC_CONST(0.52180082532974559),
+ FRAC_CONST(0.5231959543806185),
+ FRAC_CONST(0.52458968267846895),
+ FRAC_CONST(0.52598200649186677),
+ FRAC_CONST(0.52737292209314235),
+ FRAC_CONST(0.52876242575839572),
+ FRAC_CONST(0.53015051376750777),
+ FRAC_CONST(0.53153718240414882),
+ FRAC_CONST(0.53292242795578992),
+ FRAC_CONST(0.53430624671371152),
+ FRAC_CONST(0.53568863497301467),
+ FRAC_CONST(0.5370695890326298),
+ FRAC_CONST(0.5384491051953274),
+ FRAC_CONST(0.53982717976772743),
+ FRAC_CONST(0.54120380906030963),
+ FRAC_CONST(0.54257898938742311),
+ FRAC_CONST(0.54395271706729609),
+ FRAC_CONST(0.54532498842204646),
+ FRAC_CONST(0.54669579977769045),
+ FRAC_CONST(0.54806514746415402),
+ FRAC_CONST(0.54943302781528081),
+ FRAC_CONST(0.55079943716884383),
+ FRAC_CONST(0.55216437186655387),
+ FRAC_CONST(0.55352782825406999),
+ FRAC_CONST(0.55488980268100907),
+ FRAC_CONST(0.55625029150095584),
+ FRAC_CONST(0.55760929107147217),
+ FRAC_CONST(0.55896679775410718),
+ FRAC_CONST(0.56032280791440714),
+ FRAC_CONST(0.56167731792192455),
+ FRAC_CONST(0.56303032415022869),
+ FRAC_CONST(0.56438182297691453),
+ FRAC_CONST(0.56573181078361312),
+ FRAC_CONST(0.56708028395600085),
+ FRAC_CONST(0.56842723888380908),
+ FRAC_CONST(0.56977267196083425),
+ FRAC_CONST(0.57111657958494688),
+ FRAC_CONST(0.5724589581581021),
+ FRAC_CONST(0.57379980408634845),
+ FRAC_CONST(0.57513911377983773),
+ FRAC_CONST(0.57647688365283478),
+ FRAC_CONST(0.57781311012372738),
+ FRAC_CONST(0.57914778961503466),
+ FRAC_CONST(0.58048091855341843),
+ FRAC_CONST(0.5818124933696911),
+ FRAC_CONST(0.58314251049882604),
+ FRAC_CONST(0.58447096637996743),
+ FRAC_CONST(0.58579785745643886),
+ FRAC_CONST(0.5871231801757536),
+ FRAC_CONST(0.58844693098962408),
+ FRAC_CONST(0.58976910635397084),
+ FRAC_CONST(0.59108970272893235),
+ FRAC_CONST(0.59240871657887517),
+ FRAC_CONST(0.59372614437240179),
+ FRAC_CONST(0.59504198258236196),
+ FRAC_CONST(0.5963562276858605),
+ FRAC_CONST(0.59766887616426767),
+ FRAC_CONST(0.5989799245032289),
+ FRAC_CONST(0.60028936919267273),
+ FRAC_CONST(0.60159720672682204),
+ FRAC_CONST(0.60290343360420195),
+ FRAC_CONST(0.60420804632765002),
+ FRAC_CONST(0.60551104140432543),
+ FRAC_CONST(0.60681241534571839),
+ FRAC_CONST(0.60811216466765883),
+ FRAC_CONST(0.60941028589032709),
+ FRAC_CONST(0.61070677553826169),
+ FRAC_CONST(0.61200163014036979),
+ FRAC_CONST(0.61329484622993602),
+ FRAC_CONST(0.6145864203446314),
+ FRAC_CONST(0.61587634902652377),
+ FRAC_CONST(0.61716462882208556),
+ FRAC_CONST(0.61845125628220421),
+ FRAC_CONST(0.61973622796219074),
+ FRAC_CONST(0.6210195404217892),
+ FRAC_CONST(0.62230119022518593),
+ FRAC_CONST(0.62358117394101897),
+ FRAC_CONST(0.62485948814238634),
+ FRAC_CONST(0.62613612940685637),
+ FRAC_CONST(0.62741109431647646),
+ FRAC_CONST(0.62868437945778133),
+ FRAC_CONST(0.62995598142180387),
+ FRAC_CONST(0.6312258968040827),
+ FRAC_CONST(0.63249412220467238),
+ FRAC_CONST(0.63376065422815175),
+ FRAC_CONST(0.63502548948363347),
+ FRAC_CONST(0.63628862458477287),
+ FRAC_CONST(0.63755005614977711),
+ FRAC_CONST(0.63880978080141437),
+ FRAC_CONST(0.6400677951670225),
+ FRAC_CONST(0.6413240958785188),
+ FRAC_CONST(0.64257867957240766),
+ FRAC_CONST(0.6438315428897915),
+ FRAC_CONST(0.64508268247637779),
+ FRAC_CONST(0.64633209498248945),
+ FRAC_CONST(0.64757977706307335),
+ FRAC_CONST(0.64882572537770888),
+ FRAC_CONST(0.65006993659061751),
+ FRAC_CONST(0.65131240737067142),
+ FRAC_CONST(0.65255313439140239),
+ FRAC_CONST(0.65379211433101081),
+ FRAC_CONST(0.65502934387237444),
+ FRAC_CONST(0.6562648197030575),
+ FRAC_CONST(0.65749853851531959),
+ FRAC_CONST(0.65873049700612374),
+ FRAC_CONST(0.65996069187714679),
+ FRAC_CONST(0.66118911983478657),
+ FRAC_CONST(0.66241577759017178),
+ FRAC_CONST(0.66364066185917048),
+ FRAC_CONST(0.66486376936239888),
+ FRAC_CONST(0.66608509682523009),
+ FRAC_CONST(0.66730464097780284),
+ FRAC_CONST(0.66852239855503071),
+ FRAC_CONST(0.66973836629660977),
+ FRAC_CONST(0.67095254094702894),
+ FRAC_CONST(0.67216491925557675),
+ FRAC_CONST(0.67337549797635199),
+ FRAC_CONST(0.67458427386827102),
+ FRAC_CONST(0.67579124369507693),
+ FRAC_CONST(0.67699640422534846),
+ FRAC_CONST(0.67819975223250772),
+ FRAC_CONST(0.6794012844948305),
+ FRAC_CONST(0.68060099779545302),
+ FRAC_CONST(0.68179888892238183),
+ FRAC_CONST(0.6829949546685018),
+ FRAC_CONST(0.68418919183158522),
+ FRAC_CONST(0.68538159721429948),
+ FRAC_CONST(0.6865721676242168),
+ FRAC_CONST(0.68776089987382172),
+ FRAC_CONST(0.68894779078052026),
+ FRAC_CONST(0.69013283716664853),
+ FRAC_CONST(0.69131603585948032),
+ FRAC_CONST(0.69249738369123692),
+ FRAC_CONST(0.69367687749909468),
+ FRAC_CONST(0.69485451412519361),
+ FRAC_CONST(0.69603029041664599),
+ FRAC_CONST(0.6972042032255451),
+ FRAC_CONST(0.6983762494089728),
+ FRAC_CONST(0.69954642582900894),
+ FRAC_CONST(0.70071472935273893),
+ FRAC_CONST(0.70188115685226271),
+ FRAC_CONST(0.703045705204703),
+ FRAC_CONST(0.70420837129221303),
+ FRAC_CONST(0.70536915200198613),
+ FRAC_CONST(0.70652804422626281),
+ FRAC_CONST(0.70768504486233985),
+ FRAC_CONST(0.70884015081257845),
+ FRAC_CONST(0.70999335898441229),
+ FRAC_CONST(0.711144666290356),
+ FRAC_CONST(0.71229406964801356),
+ FRAC_CONST(0.71344156598008623),
+ FRAC_CONST(0.71458715221438096),
+ FRAC_CONST(0.71573082528381871),
+ FRAC_CONST(0.71687258212644234),
+ FRAC_CONST(0.7180124196854254),
+ FRAC_CONST(0.71915033490907943),
+ FRAC_CONST(0.72028632475086318),
+ FRAC_CONST(0.72142038616938997),
+ FRAC_CONST(0.72255251612843596),
+ FRAC_CONST(0.72368271159694852),
+ FRAC_CONST(0.72481096954905444),
+ FRAC_CONST(0.72593728696406756),
+ FRAC_CONST(0.72706166082649704),
+ FRAC_CONST(0.72818408812605595),
+ FRAC_CONST(0.72930456585766834),
+ FRAC_CONST(0.73042309102147851),
+ FRAC_CONST(0.73153966062285747),
+ FRAC_CONST(0.73265427167241282),
+ FRAC_CONST(0.73376692118599507),
+ FRAC_CONST(0.73487760618470677),
+ FRAC_CONST(0.73598632369490979),
+ FRAC_CONST(0.73709307074823405),
+ FRAC_CONST(0.73819784438158409),
+ FRAC_CONST(0.73930064163714881),
+ FRAC_CONST(0.74040145956240788),
+ FRAC_CONST(0.74150029521014049),
+ FRAC_CONST(0.74259714563843304),
+ FRAC_CONST(0.74369200791068657),
+ FRAC_CONST(0.74478487909562552),
+ FRAC_CONST(0.74587575626730485),
+ FRAC_CONST(0.74696463650511791),
+ FRAC_CONST(0.74805151689380456),
+ FRAC_CONST(0.74913639452345926),
+ FRAC_CONST(0.75021926648953785),
+ FRAC_CONST(0.75130012989286621),
+ FRAC_CONST(0.7523789818396478),
+ FRAC_CONST(0.75345581944147111),
+ FRAC_CONST(0.75453063981531809),
+ FRAC_CONST(0.75560344008357094),
+ FRAC_CONST(0.75667421737402052),
+ FRAC_CONST(0.7577429688198738),
+ FRAC_CONST(0.75880969155976163),
+ FRAC_CONST(0.75987438273774599),
+ FRAC_CONST(0.76093703950332836),
+ FRAC_CONST(0.76199765901145666),
+ FRAC_CONST(0.76305623842253345),
+ FRAC_CONST(0.76411277490242291),
+ FRAC_CONST(0.76516726562245885),
+ FRAC_CONST(0.76621970775945258),
+ FRAC_CONST(0.76727009849569949),
+ FRAC_CONST(0.76831843501898767),
+ FRAC_CONST(0.76936471452260458),
+ FRAC_CONST(0.77040893420534517),
+ FRAC_CONST(0.77145109127151923),
+ FRAC_CONST(0.77249118293095853),
+ FRAC_CONST(0.77352920639902467),
+ FRAC_CONST(0.77456515889661659),
+ FRAC_CONST(0.77559903765017746),
+ FRAC_CONST(0.7766308398917029),
+ FRAC_CONST(0.77766056285874774),
+ FRAC_CONST(0.77868820379443371),
+ FRAC_CONST(0.77971375994745684),
+ FRAC_CONST(0.78073722857209438),
+ FRAC_CONST(0.7817586069282132),
+ FRAC_CONST(0.78277789228127592),
+ FRAC_CONST(0.78379508190234881),
+ FRAC_CONST(0.78481017306810918),
+ FRAC_CONST(0.78582316306085265),
+ FRAC_CONST(0.78683404916849986),
+ FRAC_CONST(0.78784282868460476),
+ FRAC_CONST(0.78884949890836087),
+ FRAC_CONST(0.78985405714460888),
+ FRAC_CONST(0.7908565007038445),
+ FRAC_CONST(0.79185682690222425),
+ FRAC_CONST(0.79285503306157412),
+ FRAC_CONST(0.79385111650939566),
+ FRAC_CONST(0.79484507457887377),
+ FRAC_CONST(0.79583690460888357),
+ FRAC_CONST(0.79682660394399751),
+ FRAC_CONST(0.79781416993449272),
+ FRAC_CONST(0.79879959993635785),
+ FRAC_CONST(0.7997828913113002),
+ FRAC_CONST(0.80076404142675273),
+ FRAC_CONST(0.80174304765588156),
+ FRAC_CONST(0.80271990737759213),
+ FRAC_CONST(0.80369461797653707),
+ FRAC_CONST(0.80466717684312306),
+ FRAC_CONST(0.80563758137351682),
+ FRAC_CONST(0.80660582896965372),
+ FRAC_CONST(0.80757191703924336),
+ FRAC_CONST(0.80853584299577752),
+ FRAC_CONST(0.80949760425853612),
+ FRAC_CONST(0.81045719825259477),
+ FRAC_CONST(0.81141462240883167),
+ FRAC_CONST(0.81236987416393436),
+ FRAC_CONST(0.81332295096040608),
+ FRAC_CONST(0.81427385024657373),
+ FRAC_CONST(0.81522256947659355),
+ FRAC_CONST(0.81616910611045879),
+ FRAC_CONST(0.817113457614006),
+ FRAC_CONST(0.81805562145892186),
+ FRAC_CONST(0.81899559512275044),
+ FRAC_CONST(0.81993337608889916),
+ FRAC_CONST(0.82086896184664637),
+ FRAC_CONST(0.8218023498911472),
+ FRAC_CONST(0.82273353772344116),
+ FRAC_CONST(0.82366252285045805),
+ FRAC_CONST(0.82458930278502529),
+ FRAC_CONST(0.82551387504587381),
+ FRAC_CONST(0.82643623715764558),
+ FRAC_CONST(0.82735638665089983),
+ FRAC_CONST(0.82827432106211907),
+ FRAC_CONST(0.82919003793371693),
+ FRAC_CONST(0.83010353481404364),
+ FRAC_CONST(0.83101480925739324),
+ FRAC_CONST(0.83192385882400965),
+ FRAC_CONST(0.83283068108009373),
+ FRAC_CONST(0.8337352735978093),
+ FRAC_CONST(0.83463763395529011),
+ FRAC_CONST(0.83553775973664579),
+ FRAC_CONST(0.83643564853196872),
+ FRAC_CONST(0.83733129793734051),
+ FRAC_CONST(0.83822470555483797),
+ FRAC_CONST(0.83911586899254031),
+ FRAC_CONST(0.84000478586453453),
+ FRAC_CONST(0.84089145379092289),
+ FRAC_CONST(0.84177587039782842),
+ FRAC_CONST(0.84265803331740163),
+ FRAC_CONST(0.84353794018782702),
+ FRAC_CONST(0.844415588653329),
+ FRAC_CONST(0.8452909763641786),
+ FRAC_CONST(0.84616410097669936),
+ FRAC_CONST(0.84703496015327406),
+ FRAC_CONST(0.84790355156235053),
+ FRAC_CONST(0.84876987287844818),
+ FRAC_CONST(0.8496339217821639),
+ FRAC_CONST(0.85049569596017938),
+ FRAC_CONST(0.85135519310526508),
+ FRAC_CONST(0.85221241091628896),
+ FRAC_CONST(0.85306734709822085),
+ FRAC_CONST(0.85391999936213903),
+ FRAC_CONST(0.85477036542523732),
+ FRAC_CONST(0.85561844301082923),
+ FRAC_CONST(0.85646422984835635),
+ FRAC_CONST(0.85730772367339259),
+ FRAC_CONST(0.85814892222765116),
+ FRAC_CONST(0.85898782325899026),
+ FRAC_CONST(0.85982442452141961),
+ FRAC_CONST(0.86065872377510555),
+ FRAC_CONST(0.86149071878637817),
+ FRAC_CONST(0.8623204073277364),
+ FRAC_CONST(0.86314778717785412),
+ FRAC_CONST(0.8639728561215867),
+ FRAC_CONST(0.86479561194997623),
+ FRAC_CONST(0.86561605246025763),
+ FRAC_CONST(0.86643417545586487),
+ FRAC_CONST(0.8672499787464365),
+ FRAC_CONST(0.86806346014782154),
+ FRAC_CONST(0.8688746174820855),
+ FRAC_CONST(0.86968344857751589),
+ FRAC_CONST(0.87048995126862883),
+ FRAC_CONST(0.87129412339617363),
+ FRAC_CONST(0.87209596280713941),
+ FRAC_CONST(0.8728954673547612),
+ FRAC_CONST(0.87369263489852422),
+ FRAC_CONST(0.87448746330417149),
+ FRAC_CONST(0.87527995044370765),
+ FRAC_CONST(0.8760700941954066),
+ FRAC_CONST(0.87685789244381551),
+ FRAC_CONST(0.87764334307976144),
+ FRAC_CONST(0.87842644400035663),
+ FRAC_CONST(0.8792071931090043),
+ FRAC_CONST(0.87998558831540408),
+ FRAC_CONST(0.88076162753555787),
+ FRAC_CONST(0.88153530869177488),
+ FRAC_CONST(0.88230662971267804),
+ FRAC_CONST(0.88307558853320878),
+ FRAC_CONST(0.88384218309463292),
+ FRAC_CONST(0.8846064113445461),
+ FRAC_CONST(0.88536827123687933),
+ FRAC_CONST(0.88612776073190425),
+ FRAC_CONST(0.88688487779623937),
+ FRAC_CONST(0.88763962040285393),
+ FRAC_CONST(0.8883919865310751),
+ FRAC_CONST(0.88914197416659235),
+ FRAC_CONST(0.88988958130146301),
+ FRAC_CONST(0.8906348059341177),
+ FRAC_CONST(0.89137764606936609),
+ FRAC_CONST(0.89211809971840139),
+ FRAC_CONST(0.89285616489880615),
+ FRAC_CONST(0.89359183963455813),
+ FRAC_CONST(0.89432512195603453),
+ FRAC_CONST(0.89505600990001799),
+ FRAC_CONST(0.89578450150970124),
+ FRAC_CONST(0.8965105948346932),
+ FRAC_CONST(0.89723428793102367),
+ FRAC_CONST(0.89795557886114807),
+ FRAC_CONST(0.89867446569395382),
+ FRAC_CONST(0.89939094650476448),
+ FRAC_CONST(0.90010501937534515),
+ FRAC_CONST(0.900816682393908),
+ FRAC_CONST(0.90152593365511691),
+ FRAC_CONST(0.90223277126009283),
+ FRAC_CONST(0.90293719331641886),
+ FRAC_CONST(0.90363919793814496),
+ FRAC_CONST(0.90433878324579353),
+ FRAC_CONST(0.90503594736636439),
+ FRAC_CONST(0.90573068843333915),
+ FRAC_CONST(0.90642300458668679),
+ FRAC_CONST(0.90711289397286898),
+ FRAC_CONST(0.90780035474484411),
+ FRAC_CONST(0.90848538506207266),
+ FRAC_CONST(0.90916798309052227),
+ FRAC_CONST(0.90984814700267291),
+ FRAC_CONST(0.9105258749775208),
+ FRAC_CONST(0.91120116520058425),
+ FRAC_CONST(0.91187401586390815),
+ FRAC_CONST(0.91254442516606893),
+ FRAC_CONST(0.9132123913121788),
+ FRAC_CONST(0.91387791251389161),
+ FRAC_CONST(0.91454098698940678),
+ FRAC_CONST(0.91520161296347435),
+ FRAC_CONST(0.91585978866739981),
+ FRAC_CONST(0.91651551233904871),
+ FRAC_CONST(0.91716878222285148),
+ FRAC_CONST(0.91781959656980805),
+ FRAC_CONST(0.91846795363749245),
+ FRAC_CONST(0.91911385169005766),
+ FRAC_CONST(0.9197572889982405),
+ FRAC_CONST(0.9203982638393654),
+ FRAC_CONST(0.92103677449734989),
+ FRAC_CONST(0.92167281926270861),
+ FRAC_CONST(0.92230639643255874),
+ FRAC_CONST(0.92293750431062316),
+ FRAC_CONST(0.92356614120723612),
+ FRAC_CONST(0.92419230543934783),
+ FRAC_CONST(0.92481599533052783),
+ FRAC_CONST(0.92543720921097061),
+ FRAC_CONST(0.92605594541749991),
+ FRAC_CONST(0.92667220229357261),
+ FRAC_CONST(0.92728597818928349),
+ FRAC_CONST(0.9278972714613698),
+ FRAC_CONST(0.92850608047321548),
+ FRAC_CONST(0.9291124035948557),
+ FRAC_CONST(0.92971623920298097),
+ FRAC_CONST(0.93031758568094147),
+ FRAC_CONST(0.93091644141875196),
+ FRAC_CONST(0.93151280481309506),
+ FRAC_CONST(0.93210667426732674),
+ FRAC_CONST(0.93269804819147983),
+ FRAC_CONST(0.93328692500226818),
+ FRAC_CONST(0.93387330312309147),
+ FRAC_CONST(0.93445718098403896),
+ FRAC_CONST(0.93503855702189376),
+ FRAC_CONST(0.9356174296801375),
+ FRAC_CONST(0.93619379740895381),
+ FRAC_CONST(0.93676765866523259),
+ FRAC_CONST(0.93733901191257496),
+ FRAC_CONST(0.93790785562129597),
+ FRAC_CONST(0.93847418826842988),
+ FRAC_CONST(0.93903800833773399),
+ FRAC_CONST(0.93959931431969212),
+ FRAC_CONST(0.94015810471151917),
+ FRAC_CONST(0.94071437801716529),
+ FRAC_CONST(0.94126813274731924),
+ FRAC_CONST(0.94181936741941319),
+ FRAC_CONST(0.94236808055762578),
+ FRAC_CONST(0.94291427069288691),
+ FRAC_CONST(0.94345793636288133),
+ FRAC_CONST(0.94399907611205225),
+ FRAC_CONST(0.9445376884916058),
+ FRAC_CONST(0.94507377205951448),
+ FRAC_CONST(0.94560732538052128),
+ FRAC_CONST(0.94613834702614352),
+ FRAC_CONST(0.94666683557467624),
+ FRAC_CONST(0.94719278961119657),
+ FRAC_CONST(0.94771620772756759),
+ FRAC_CONST(0.94823708852244104),
+ FRAC_CONST(0.94875543060126255),
+ FRAC_CONST(0.94927123257627433),
+ FRAC_CONST(0.94978449306651924),
+ FRAC_CONST(0.95029521069784428),
+ FRAC_CONST(0.9508033841029051),
+ FRAC_CONST(0.95130901192116835),
+ FRAC_CONST(0.9518120927989161),
+ FRAC_CONST(0.95231262538924943),
+ FRAC_CONST(0.95281060835209208),
+ FRAC_CONST(0.95330604035419386),
+ FRAC_CONST(0.95379892006913403),
+ FRAC_CONST(0.95428924617732525),
+ FRAC_CONST(0.95477701736601728),
+ FRAC_CONST(0.95526223232929941),
+ FRAC_CONST(0.95574488976810545),
+ FRAC_CONST(0.95622498839021619),
+ FRAC_CONST(0.95670252691026292),
+ FRAC_CONST(0.95717750404973156),
+ FRAC_CONST(0.95764991853696524),
+ FRAC_CONST(0.95811976910716812),
+ FRAC_CONST(0.95858705450240911),
+ FRAC_CONST(0.95905177347162429),
+ FRAC_CONST(0.95951392477062125),
+ FRAC_CONST(0.95997350716208196),
+ FRAC_CONST(0.96043051941556579),
+ FRAC_CONST(0.96088496030751369),
+ FRAC_CONST(0.96133682862125036),
+ FRAC_CONST(0.96178612314698864),
+ FRAC_CONST(0.96223284268183173),
+ FRAC_CONST(0.9626769860297768),
+ FRAC_CONST(0.96311855200171881),
+ FRAC_CONST(0.96355753941545252),
+ FRAC_CONST(0.96399394709567654),
+ FRAC_CONST(0.96442777387399625),
+ FRAC_CONST(0.96485901858892686),
+ FRAC_CONST(0.96528768008589627),
+ FRAC_CONST(0.96571375721724895),
+ FRAC_CONST(0.96613724884224783),
+ FRAC_CONST(0.96655815382707866),
+ FRAC_CONST(0.96697647104485207),
+ FRAC_CONST(0.96739219937560694),
+ FRAC_CONST(0.96780533770631338),
+ FRAC_CONST(0.96821588493087585),
+ FRAC_CONST(0.9686238399501359),
+ FRAC_CONST(0.96902920167187501),
+ FRAC_CONST(0.96943196901081796),
+ FRAC_CONST(0.96983214088863534),
+ FRAC_CONST(0.9702297162339466),
+ FRAC_CONST(0.97062469398232287),
+ FRAC_CONST(0.97101707307629004),
+ FRAC_CONST(0.97140685246533098),
+ FRAC_CONST(0.97179403110588902),
+ FRAC_CONST(0.97217860796137046),
+ FRAC_CONST(0.97256058200214734),
+ FRAC_CONST(0.97293995220556007),
+ FRAC_CONST(0.97331671755592064),
+ FRAC_CONST(0.97369087704451474),
+ FRAC_CONST(0.97406242966960455),
+ FRAC_CONST(0.97443137443643235),
+ FRAC_CONST(0.97479771035722163),
+ FRAC_CONST(0.97516143645118103),
+ FRAC_CONST(0.97552255174450631),
+ FRAC_CONST(0.97588105527038305),
+ FRAC_CONST(0.97623694606898959),
+ FRAC_CONST(0.97659022318749911),
+ FRAC_CONST(0.97694088568008242),
+ FRAC_CONST(0.97728893260791039),
+ FRAC_CONST(0.97763436303915685),
+ FRAC_CONST(0.97797717604900047),
+ FRAC_CONST(0.97831737071962765),
+ FRAC_CONST(0.97865494614023485),
+ FRAC_CONST(0.97898990140703124),
+ FRAC_CONST(0.97932223562324061),
+ FRAC_CONST(0.97965194789910426),
+ FRAC_CONST(0.9799790373518833),
+ FRAC_CONST(0.98030350310586067),
+ FRAC_CONST(0.98062534429234405),
+ FRAC_CONST(0.98094456004966768),
+ FRAC_CONST(0.98126114952319499),
+ FRAC_CONST(0.98157511186532054),
+ FRAC_CONST(0.98188644623547261),
+ FRAC_CONST(0.98219515180011563),
+ FRAC_CONST(0.98250122773275184),
+ FRAC_CONST(0.98280467321392362),
+ FRAC_CONST(0.98310548743121629),
+ FRAC_CONST(0.98340366957925973),
+ FRAC_CONST(0.98369921885973044),
+ FRAC_CONST(0.98399213448135414),
+ FRAC_CONST(0.98428241565990748),
+ FRAC_CONST(0.98457006161822058),
+ FRAC_CONST(0.98485507158617835),
+ FRAC_CONST(0.98513744480072363),
+ FRAC_CONST(0.98541718050585803),
+ FRAC_CONST(0.98569427795264519),
+ FRAC_CONST(0.98596873639921168),
+ FRAC_CONST(0.98624055511074971),
+ FRAC_CONST(0.98650973335951875),
+ FRAC_CONST(0.98677627042484772),
+ FRAC_CONST(0.98704016559313645),
+ FRAC_CONST(0.98730141815785832),
+ FRAC_CONST(0.98756002741956173),
+ FRAC_CONST(0.9878159926858715),
+ FRAC_CONST(0.98806931327149194),
+ FRAC_CONST(0.98831998849820735),
+ FRAC_CONST(0.98856801769488489),
+ FRAC_CONST(0.98881340019747566),
+ FRAC_CONST(0.98905613534901682),
+ FRAC_CONST(0.98929622249963345),
+ FRAC_CONST(0.98953366100653983),
+ FRAC_CONST(0.98976845023404181),
+ FRAC_CONST(0.99000058955353776),
+ FRAC_CONST(0.99023007834352106),
+ FRAC_CONST(0.99045691598958097),
+ FRAC_CONST(0.99068110188440506),
+ FRAC_CONST(0.99090263542778001),
+ FRAC_CONST(0.99112151602659404),
+ FRAC_CONST(0.99133774309483769),
+ FRAC_CONST(0.99155131605360625),
+ FRAC_CONST(0.99176223433110056),
+ FRAC_CONST(0.99197049736262888),
+ FRAC_CONST(0.99217610459060845),
+ FRAC_CONST(0.99237905546456673),
+ FRAC_CONST(0.99257934944114334),
+ FRAC_CONST(0.99277698598409092),
+ FRAC_CONST(0.99297196456427694),
+ FRAC_CONST(0.99316428465968509),
+ FRAC_CONST(0.99335394575541669),
+ FRAC_CONST(0.99354094734369169),
+ FRAC_CONST(0.99372528892385081),
+ FRAC_CONST(0.99390697000235606),
+ FRAC_CONST(0.99408599009279242),
+ FRAC_CONST(0.99426234871586938),
+ FRAC_CONST(0.99443604539942176),
+ FRAC_CONST(0.99460707967841133),
+ FRAC_CONST(0.99477545109492771),
+ FRAC_CONST(0.99494115919819004),
+ FRAC_CONST(0.99510420354454787),
+ FRAC_CONST(0.99526458369748239),
+ FRAC_CONST(0.99542229922760772),
+ FRAC_CONST(0.99557734971267187),
+ FRAC_CONST(0.9957297347375581),
+ FRAC_CONST(0.99587945389428578),
+ FRAC_CONST(0.99602650678201154),
+ FRAC_CONST(0.99617089300703077),
+ FRAC_CONST(0.996312612182778),
+ FRAC_CONST(0.99645166392982831),
+ FRAC_CONST(0.99658804787589839),
+ FRAC_CONST(0.99672176365584741),
+ FRAC_CONST(0.99685281091167788),
+ FRAC_CONST(0.99698118929253687),
+ FRAC_CONST(0.99710689845471678),
+ FRAC_CONST(0.99722993806165661),
+ FRAC_CONST(0.99735030778394196),
+ FRAC_CONST(0.99746800729930707),
+ FRAC_CONST(0.99758303629263489),
+ FRAC_CONST(0.99769539445595812),
+ FRAC_CONST(0.99780508148846014),
+ FRAC_CONST(0.99791209709647588),
+ FRAC_CONST(0.99801644099349218),
+ FRAC_CONST(0.99811811290014918),
+ FRAC_CONST(0.9982171125442405),
+ FRAC_CONST(0.9983134396607144),
+ FRAC_CONST(0.99840709399167404),
+ FRAC_CONST(0.99849807528637868),
+ FRAC_CONST(0.99858638330124405),
+ FRAC_CONST(0.99867201779984294),
+ FRAC_CONST(0.99875497855290607),
+ FRAC_CONST(0.99883526533832245),
+ FRAC_CONST(0.99891287794114036),
+ FRAC_CONST(0.99898781615356746),
+ FRAC_CONST(0.99906007977497147),
+ FRAC_CONST(0.99912966861188113),
+ FRAC_CONST(0.99919658247798593),
+ FRAC_CONST(0.99926082119413751),
+ FRAC_CONST(0.99932238458834954),
+ FRAC_CONST(0.999381272495798),
+ FRAC_CONST(0.99943748475882255),
+ FRAC_CONST(0.9994910212269259),
+ FRAC_CONST(0.99954188175677483),
+ FRAC_CONST(0.99959006621220048),
+ FRAC_CONST(0.99963557446419837),
+ FRAC_CONST(0.99967840639092931),
+ FRAC_CONST(0.99971856187771946),
+ FRAC_CONST(0.99975604081706027),
+ FRAC_CONST(0.99979084310860955),
+ FRAC_CONST(0.99982296865919107),
+ FRAC_CONST(0.99985241738279484),
+ FRAC_CONST(0.99987918920057806),
+ FRAC_CONST(0.99990328404086426),
+ FRAC_CONST(0.9999247018391445),
+ FRAC_CONST(0.99994344253807688),
+ FRAC_CONST(0.99995950608748674),
+ FRAC_CONST(0.99997289244436727),
+ FRAC_CONST(0.99998360157287902),
+ FRAC_CONST(0.9999916334443506),
+ FRAC_CONST(0.99999698803727821),
+ FRAC_CONST(0.99999966533732598)
+};
#endif
- ALIGN static const real_t sine_short_128[] =
- {
- FRAC_CONST(0.0061358846491544753),
- FRAC_CONST(0.01840672990580482),
- FRAC_CONST(0.030674803176636626),
- FRAC_CONST(0.04293825693494082),
- FRAC_CONST(0.055195244349689934),
- FRAC_CONST(0.067443919563664051),
- FRAC_CONST(0.079682437971430126),
- FRAC_CONST(0.091908956497132724),
- FRAC_CONST(0.10412163387205459),
- FRAC_CONST(0.11631863091190475),
- FRAC_CONST(0.12849811079379317),
- FRAC_CONST(0.14065823933284921),
- FRAC_CONST(0.15279718525844344),
- FRAC_CONST(0.16491312048996989),
- FRAC_CONST(0.17700422041214875),
- FRAC_CONST(0.18906866414980619),
- FRAC_CONST(0.2011046348420919),
- FRAC_CONST(0.21311031991609136),
- FRAC_CONST(0.22508391135979283),
- FRAC_CONST(0.2370236059943672),
- FRAC_CONST(0.24892760574572015),
- FRAC_CONST(0.26079411791527551),
- FRAC_CONST(0.27262135544994898),
- FRAC_CONST(0.28440753721127188),
- FRAC_CONST(0.29615088824362379),
- FRAC_CONST(0.30784964004153487),
- FRAC_CONST(0.31950203081601569),
- FRAC_CONST(0.33110630575987643),
- FRAC_CONST(0.34266071731199438),
- FRAC_CONST(0.35416352542049034),
- FRAC_CONST(0.36561299780477385),
- FRAC_CONST(0.37700741021641826),
- FRAC_CONST(0.38834504669882625),
- FRAC_CONST(0.39962419984564679),
- FRAC_CONST(0.41084317105790391),
- FRAC_CONST(0.42200027079979968),
- FRAC_CONST(0.43309381885315196),
- FRAC_CONST(0.4441221445704292),
- FRAC_CONST(0.45508358712634384),
- FRAC_CONST(0.46597649576796618),
- FRAC_CONST(0.47679923006332209),
- FRAC_CONST(0.487550160148436),
- FRAC_CONST(0.49822766697278187),
- FRAC_CONST(0.50883014254310699),
- FRAC_CONST(0.51935599016558964),
- FRAC_CONST(0.52980362468629461),
- FRAC_CONST(0.54017147272989285),
- FRAC_CONST(0.55045797293660481),
- FRAC_CONST(0.56066157619733603),
- FRAC_CONST(0.57078074588696726),
- FRAC_CONST(0.58081395809576453),
- FRAC_CONST(0.59075970185887416),
- FRAC_CONST(0.60061647938386897),
- FRAC_CONST(0.61038280627630948),
- FRAC_CONST(0.6200572117632891),
- FRAC_CONST(0.62963823891492698),
- FRAC_CONST(0.63912444486377573),
- FRAC_CONST(0.64851440102211244),
- FRAC_CONST(0.65780669329707864),
- FRAC_CONST(0.66699992230363747),
- FRAC_CONST(0.67609270357531592),
- FRAC_CONST(0.68508366777270036),
- FRAC_CONST(0.693971460889654),
- FRAC_CONST(0.7027547444572253),
- FRAC_CONST(0.71143219574521643),
- FRAC_CONST(0.72000250796138165),
- FRAC_CONST(0.7284643904482252),
- FRAC_CONST(0.73681656887736979),
- FRAC_CONST(0.74505778544146595),
- FRAC_CONST(0.75318679904361241),
- FRAC_CONST(0.76120238548426178),
- FRAC_CONST(0.76910333764557959),
- FRAC_CONST(0.77688846567323244),
- FRAC_CONST(0.78455659715557524),
- FRAC_CONST(0.79210657730021239),
- FRAC_CONST(0.79953726910790501),
- FRAC_CONST(0.80684755354379922),
- FRAC_CONST(0.8140363297059483),
- FRAC_CONST(0.82110251499110465),
- FRAC_CONST(0.8280450452577558),
- FRAC_CONST(0.83486287498638001),
- FRAC_CONST(0.84155497743689833),
- FRAC_CONST(0.84812034480329712),
- FRAC_CONST(0.85455798836540053),
- FRAC_CONST(0.86086693863776731),
- FRAC_CONST(0.86704624551569265),
- FRAC_CONST(0.87309497841829009),
- FRAC_CONST(0.87901222642863341),
- FRAC_CONST(0.88479709843093779),
- FRAC_CONST(0.89044872324475788),
- FRAC_CONST(0.89596624975618511),
- FRAC_CONST(0.90134884704602203),
- FRAC_CONST(0.90659570451491533),
- FRAC_CONST(0.91170603200542988),
- FRAC_CONST(0.9166790599210427),
- FRAC_CONST(0.9215140393420419),
- FRAC_CONST(0.92621024213831127),
- FRAC_CONST(0.93076696107898371),
- FRAC_CONST(0.9351835099389475),
- FRAC_CONST(0.93945922360218992),
- FRAC_CONST(0.94359345816196039),
- FRAC_CONST(0.94758559101774109),
- FRAC_CONST(0.95143502096900834),
- FRAC_CONST(0.95514116830577067),
- FRAC_CONST(0.9587034748958716),
- FRAC_CONST(0.96212140426904158),
- FRAC_CONST(0.9653944416976894),
- FRAC_CONST(0.96852209427441727),
- FRAC_CONST(0.97150389098625178),
- FRAC_CONST(0.97433938278557586),
- FRAC_CONST(0.97702814265775439),
- FRAC_CONST(0.97956976568544052),
- FRAC_CONST(0.98196386910955524),
- FRAC_CONST(0.98421009238692903),
- FRAC_CONST(0.98630809724459867),
- FRAC_CONST(0.98825756773074946),
- FRAC_CONST(0.99005821026229712),
- FRAC_CONST(0.99170975366909953),
- FRAC_CONST(0.9932119492347945),
- FRAC_CONST(0.99456457073425542),
- FRAC_CONST(0.99576741446765982),
- FRAC_CONST(0.99682029929116567),
- FRAC_CONST(0.99772306664419164),
- FRAC_CONST(0.99847558057329477),
- FRAC_CONST(0.99907772775264536),
- FRAC_CONST(0.99952941750109314),
- FRAC_CONST(0.9998305817958234),
- FRAC_CONST(0.99998117528260111)
- };
+ALIGN static const real_t sine_short_128[] =
+{
+ FRAC_CONST(0.0061358846491544753),
+ FRAC_CONST(0.01840672990580482),
+ FRAC_CONST(0.030674803176636626),
+ FRAC_CONST(0.04293825693494082),
+ FRAC_CONST(0.055195244349689934),
+ FRAC_CONST(0.067443919563664051),
+ FRAC_CONST(0.079682437971430126),
+ FRAC_CONST(0.091908956497132724),
+ FRAC_CONST(0.10412163387205459),
+ FRAC_CONST(0.11631863091190475),
+ FRAC_CONST(0.12849811079379317),
+ FRAC_CONST(0.14065823933284921),
+ FRAC_CONST(0.15279718525844344),
+ FRAC_CONST(0.16491312048996989),
+ FRAC_CONST(0.17700422041214875),
+ FRAC_CONST(0.18906866414980619),
+ FRAC_CONST(0.2011046348420919),
+ FRAC_CONST(0.21311031991609136),
+ FRAC_CONST(0.22508391135979283),
+ FRAC_CONST(0.2370236059943672),
+ FRAC_CONST(0.24892760574572015),
+ FRAC_CONST(0.26079411791527551),
+ FRAC_CONST(0.27262135544994898),
+ FRAC_CONST(0.28440753721127188),
+ FRAC_CONST(0.29615088824362379),
+ FRAC_CONST(0.30784964004153487),
+ FRAC_CONST(0.31950203081601569),
+ FRAC_CONST(0.33110630575987643),
+ FRAC_CONST(0.34266071731199438),
+ FRAC_CONST(0.35416352542049034),
+ FRAC_CONST(0.36561299780477385),
+ FRAC_CONST(0.37700741021641826),
+ FRAC_CONST(0.38834504669882625),
+ FRAC_CONST(0.39962419984564679),
+ FRAC_CONST(0.41084317105790391),
+ FRAC_CONST(0.42200027079979968),
+ FRAC_CONST(0.43309381885315196),
+ FRAC_CONST(0.4441221445704292),
+ FRAC_CONST(0.45508358712634384),
+ FRAC_CONST(0.46597649576796618),
+ FRAC_CONST(0.47679923006332209),
+ FRAC_CONST(0.487550160148436),
+ FRAC_CONST(0.49822766697278187),
+ FRAC_CONST(0.50883014254310699),
+ FRAC_CONST(0.51935599016558964),
+ FRAC_CONST(0.52980362468629461),
+ FRAC_CONST(0.54017147272989285),
+ FRAC_CONST(0.55045797293660481),
+ FRAC_CONST(0.56066157619733603),
+ FRAC_CONST(0.57078074588696726),
+ FRAC_CONST(0.58081395809576453),
+ FRAC_CONST(0.59075970185887416),
+ FRAC_CONST(0.60061647938386897),
+ FRAC_CONST(0.61038280627630948),
+ FRAC_CONST(0.6200572117632891),
+ FRAC_CONST(0.62963823891492698),
+ FRAC_CONST(0.63912444486377573),
+ FRAC_CONST(0.64851440102211244),
+ FRAC_CONST(0.65780669329707864),
+ FRAC_CONST(0.66699992230363747),
+ FRAC_CONST(0.67609270357531592),
+ FRAC_CONST(0.68508366777270036),
+ FRAC_CONST(0.693971460889654),
+ FRAC_CONST(0.7027547444572253),
+ FRAC_CONST(0.71143219574521643),
+ FRAC_CONST(0.72000250796138165),
+ FRAC_CONST(0.7284643904482252),
+ FRAC_CONST(0.73681656887736979),
+ FRAC_CONST(0.74505778544146595),
+ FRAC_CONST(0.75318679904361241),
+ FRAC_CONST(0.76120238548426178),
+ FRAC_CONST(0.76910333764557959),
+ FRAC_CONST(0.77688846567323244),
+ FRAC_CONST(0.78455659715557524),
+ FRAC_CONST(0.79210657730021239),
+ FRAC_CONST(0.79953726910790501),
+ FRAC_CONST(0.80684755354379922),
+ FRAC_CONST(0.8140363297059483),
+ FRAC_CONST(0.82110251499110465),
+ FRAC_CONST(0.8280450452577558),
+ FRAC_CONST(0.83486287498638001),
+ FRAC_CONST(0.84155497743689833),
+ FRAC_CONST(0.84812034480329712),
+ FRAC_CONST(0.85455798836540053),
+ FRAC_CONST(0.86086693863776731),
+ FRAC_CONST(0.86704624551569265),
+ FRAC_CONST(0.87309497841829009),
+ FRAC_CONST(0.87901222642863341),
+ FRAC_CONST(0.88479709843093779),
+ FRAC_CONST(0.89044872324475788),
+ FRAC_CONST(0.89596624975618511),
+ FRAC_CONST(0.90134884704602203),
+ FRAC_CONST(0.90659570451491533),
+ FRAC_CONST(0.91170603200542988),
+ FRAC_CONST(0.9166790599210427),
+ FRAC_CONST(0.9215140393420419),
+ FRAC_CONST(0.92621024213831127),
+ FRAC_CONST(0.93076696107898371),
+ FRAC_CONST(0.9351835099389475),
+ FRAC_CONST(0.93945922360218992),
+ FRAC_CONST(0.94359345816196039),
+ FRAC_CONST(0.94758559101774109),
+ FRAC_CONST(0.95143502096900834),
+ FRAC_CONST(0.95514116830577067),
+ FRAC_CONST(0.9587034748958716),
+ FRAC_CONST(0.96212140426904158),
+ FRAC_CONST(0.9653944416976894),
+ FRAC_CONST(0.96852209427441727),
+ FRAC_CONST(0.97150389098625178),
+ FRAC_CONST(0.97433938278557586),
+ FRAC_CONST(0.97702814265775439),
+ FRAC_CONST(0.97956976568544052),
+ FRAC_CONST(0.98196386910955524),
+ FRAC_CONST(0.98421009238692903),
+ FRAC_CONST(0.98630809724459867),
+ FRAC_CONST(0.98825756773074946),
+ FRAC_CONST(0.99005821026229712),
+ FRAC_CONST(0.99170975366909953),
+ FRAC_CONST(0.9932119492347945),
+ FRAC_CONST(0.99456457073425542),
+ FRAC_CONST(0.99576741446765982),
+ FRAC_CONST(0.99682029929116567),
+ FRAC_CONST(0.99772306664419164),
+ FRAC_CONST(0.99847558057329477),
+ FRAC_CONST(0.99907772775264536),
+ FRAC_CONST(0.99952941750109314),
+ FRAC_CONST(0.9998305817958234),
+ FRAC_CONST(0.99998117528260111)
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const real_t sine_short_120[] =
- {
- FRAC_CONST(0.0065449379673518581),
- FRAC_CONST(0.019633692460628301),
- FRAC_CONST(0.032719082821776137),
- FRAC_CONST(0.045798866936520771),
- FRAC_CONST(0.058870803651189033),
- FRAC_CONST(0.071932653156719387),
- FRAC_CONST(0.084982177372441667),
- FRAC_CONST(0.09801714032956059),
- FRAC_CONST(0.11103530855427769),
- FRAC_CONST(0.12403445145048532),
- FRAC_CONST(0.13701234168196802),
- FRAC_CONST(0.14996675555404498),
- FRAC_CONST(0.16289547339458874),
- FRAC_CONST(0.17579627993435451),
- FRAC_CONST(0.18866696468655525),
- FRAC_CONST(0.2015053223256171),
- FRAC_CONST(0.21430915306505074),
- FRAC_CONST(0.2270762630343732),
- FRAC_CONST(0.23980446465501654),
- FRAC_CONST(0.25249157701515795),
- FRAC_CONST(0.26513542624340797),
- FRAC_CONST(0.27773384588129219),
- FRAC_CONST(0.29028467725446233),
- FRAC_CONST(0.3027857698425746),
- FRAC_CONST(0.31523498164776964),
- FRAC_CONST(0.32763017956169349),
- FRAC_CONST(0.33996923973099424),
- FRAC_CONST(0.35225004792123354),
- FRAC_CONST(0.36447049987914965),
- FRAC_CONST(0.37662850169321077),
- FRAC_CONST(0.38872197015239557),
- FRAC_CONST(0.40074883310314097),
- FRAC_CONST(0.41270702980439467),
- FRAC_CONST(0.42459451128071307),
- FRAC_CONST(0.43640924067334208),
- FRAC_CONST(0.44814919358922256),
- FRAC_CONST(0.45981235844785984),
- FRAC_CONST(0.47139673682599764),
- FRAC_CONST(0.48290034380003727),
- FRAC_CONST(0.49432120828614462),
- FRAC_CONST(0.50565737337798455),
- FRAC_CONST(0.51690689668202761),
- FRAC_CONST(0.52806785065036799),
- FRAC_CONST(0.53913832291100017),
- FRAC_CONST(0.55011641659549337),
- FRAC_CONST(0.56100025066400983),
- FRAC_CONST(0.57178796022761225),
- FRAC_CONST(0.58247769686780215),
- FRAC_CONST(0.59306762895323706),
- FRAC_CONST(0.60355594195357143),
- FRAC_CONST(0.61394083875036642),
- FRAC_CONST(0.62422053994501758),
- FRAC_CONST(0.63439328416364549),
- FRAC_CONST(0.64445732835889735),
- FRAC_CONST(0.65441094810861034),
- FRAC_CONST(0.66425243791128175),
- FRAC_CONST(0.67398011147829784),
- FRAC_CONST(0.68359230202287125),
- FRAC_CONST(0.69308736254563585),
- FRAC_CONST(0.70246366611685174),
- FRAC_CONST(0.71171960615517138),
- FRAC_CONST(0.72085359670291882),
- FRAC_CONST(0.7298640726978356),
- FRAC_CONST(0.73874949024124625),
- FRAC_CONST(0.74750832686259672),
- FRAC_CONST(0.75613908178032285),
- FRAC_CONST(0.76464027615900032),
- FRAC_CONST(0.77301045336273699),
- FRAC_CONST(0.78124817920475853),
- FRAC_CONST(0.78935204219315003),
- FRAC_CONST(0.79732065377270711),
- FRAC_CONST(0.80515264856285829),
- FRAC_CONST(0.81284668459161513),
- FRAC_CONST(0.82040144352551359),
- FRAC_CONST(0.82781563089550203),
- FRAC_CONST(0.83508797631874299),
- FRAC_CONST(0.84221723371628654),
- FRAC_CONST(0.84920218152657889),
- FRAC_CONST(0.85604162291477137),
- FRAC_CONST(0.86273438597779184),
- FRAC_CONST(0.86927932394514362),
- FRAC_CONST(0.87567531537539967),
- FRAC_CONST(0.88192126434835494),
- FRAC_CONST(0.88801610065280734),
- FRAC_CONST(0.89395877996993212),
- FRAC_CONST(0.8997482840522214),
- FRAC_CONST(0.90538362089795521),
- FRAC_CONST(0.91086382492117568),
- FRAC_CONST(0.91618795711713596),
- FRAC_CONST(0.92135510522319242),
- FRAC_CONST(0.9263643838751181),
- FRAC_CONST(0.93121493475880346),
- FRAC_CONST(0.93590592675732565),
- FRAC_CONST(0.94043655609335486),
- FRAC_CONST(0.94480604646687805),
- FRAC_CONST(0.94901364918821385),
- FRAC_CONST(0.95305864330629697),
- FRAC_CONST(0.95694033573220882),
- FRAC_CONST(0.9606580613579353),
- FRAC_CONST(0.96421118317032928),
- FRAC_CONST(0.96759909236025976),
- FRAC_CONST(0.9708212084269281),
- FRAC_CONST(0.97387697927733363),
- FRAC_CONST(0.97676588132087239),
- FRAC_CONST(0.97948741955905139),
- FRAC_CONST(0.98204112767030394),
- FRAC_CONST(0.98442656808989171),
- FRAC_CONST(0.98664333208487898),
- FRAC_CONST(0.98869103982416728),
- FRAC_CONST(0.99056934044357725),
- FRAC_CONST(0.99227791210596705),
- FRAC_CONST(0.99381646205637808),
- FRAC_CONST(0.99518472667219682),
- FRAC_CONST(0.99638247150832537),
- FRAC_CONST(0.99740949133735191),
- FRAC_CONST(0.99826561018471593),
- FRAC_CONST(0.99895068135886012),
- FRAC_CONST(0.99946458747636568),
- FRAC_CONST(0.99980724048206482),
- FRAC_CONST(0.99997858166412923)
- };
+ALIGN static const real_t sine_short_120[] =
+{
+ FRAC_CONST(0.0065449379673518581),
+ FRAC_CONST(0.019633692460628301),
+ FRAC_CONST(0.032719082821776137),
+ FRAC_CONST(0.045798866936520771),
+ FRAC_CONST(0.058870803651189033),
+ FRAC_CONST(0.071932653156719387),
+ FRAC_CONST(0.084982177372441667),
+ FRAC_CONST(0.09801714032956059),
+ FRAC_CONST(0.11103530855427769),
+ FRAC_CONST(0.12403445145048532),
+ FRAC_CONST(0.13701234168196802),
+ FRAC_CONST(0.14996675555404498),
+ FRAC_CONST(0.16289547339458874),
+ FRAC_CONST(0.17579627993435451),
+ FRAC_CONST(0.18866696468655525),
+ FRAC_CONST(0.2015053223256171),
+ FRAC_CONST(0.21430915306505074),
+ FRAC_CONST(0.2270762630343732),
+ FRAC_CONST(0.23980446465501654),
+ FRAC_CONST(0.25249157701515795),
+ FRAC_CONST(0.26513542624340797),
+ FRAC_CONST(0.27773384588129219),
+ FRAC_CONST(0.29028467725446233),
+ FRAC_CONST(0.3027857698425746),
+ FRAC_CONST(0.31523498164776964),
+ FRAC_CONST(0.32763017956169349),
+ FRAC_CONST(0.33996923973099424),
+ FRAC_CONST(0.35225004792123354),
+ FRAC_CONST(0.36447049987914965),
+ FRAC_CONST(0.37662850169321077),
+ FRAC_CONST(0.38872197015239557),
+ FRAC_CONST(0.40074883310314097),
+ FRAC_CONST(0.41270702980439467),
+ FRAC_CONST(0.42459451128071307),
+ FRAC_CONST(0.43640924067334208),
+ FRAC_CONST(0.44814919358922256),
+ FRAC_CONST(0.45981235844785984),
+ FRAC_CONST(0.47139673682599764),
+ FRAC_CONST(0.48290034380003727),
+ FRAC_CONST(0.49432120828614462),
+ FRAC_CONST(0.50565737337798455),
+ FRAC_CONST(0.51690689668202761),
+ FRAC_CONST(0.52806785065036799),
+ FRAC_CONST(0.53913832291100017),
+ FRAC_CONST(0.55011641659549337),
+ FRAC_CONST(0.56100025066400983),
+ FRAC_CONST(0.57178796022761225),
+ FRAC_CONST(0.58247769686780215),
+ FRAC_CONST(0.59306762895323706),
+ FRAC_CONST(0.60355594195357143),
+ FRAC_CONST(0.61394083875036642),
+ FRAC_CONST(0.62422053994501758),
+ FRAC_CONST(0.63439328416364549),
+ FRAC_CONST(0.64445732835889735),
+ FRAC_CONST(0.65441094810861034),
+ FRAC_CONST(0.66425243791128175),
+ FRAC_CONST(0.67398011147829784),
+ FRAC_CONST(0.68359230202287125),
+ FRAC_CONST(0.69308736254563585),
+ FRAC_CONST(0.70246366611685174),
+ FRAC_CONST(0.71171960615517138),
+ FRAC_CONST(0.72085359670291882),
+ FRAC_CONST(0.7298640726978356),
+ FRAC_CONST(0.73874949024124625),
+ FRAC_CONST(0.74750832686259672),
+ FRAC_CONST(0.75613908178032285),
+ FRAC_CONST(0.76464027615900032),
+ FRAC_CONST(0.77301045336273699),
+ FRAC_CONST(0.78124817920475853),
+ FRAC_CONST(0.78935204219315003),
+ FRAC_CONST(0.79732065377270711),
+ FRAC_CONST(0.80515264856285829),
+ FRAC_CONST(0.81284668459161513),
+ FRAC_CONST(0.82040144352551359),
+ FRAC_CONST(0.82781563089550203),
+ FRAC_CONST(0.83508797631874299),
+ FRAC_CONST(0.84221723371628654),
+ FRAC_CONST(0.84920218152657889),
+ FRAC_CONST(0.85604162291477137),
+ FRAC_CONST(0.86273438597779184),
+ FRAC_CONST(0.86927932394514362),
+ FRAC_CONST(0.87567531537539967),
+ FRAC_CONST(0.88192126434835494),
+ FRAC_CONST(0.88801610065280734),
+ FRAC_CONST(0.89395877996993212),
+ FRAC_CONST(0.8997482840522214),
+ FRAC_CONST(0.90538362089795521),
+ FRAC_CONST(0.91086382492117568),
+ FRAC_CONST(0.91618795711713596),
+ FRAC_CONST(0.92135510522319242),
+ FRAC_CONST(0.9263643838751181),
+ FRAC_CONST(0.93121493475880346),
+ FRAC_CONST(0.93590592675732565),
+ FRAC_CONST(0.94043655609335486),
+ FRAC_CONST(0.94480604646687805),
+ FRAC_CONST(0.94901364918821385),
+ FRAC_CONST(0.95305864330629697),
+ FRAC_CONST(0.95694033573220882),
+ FRAC_CONST(0.9606580613579353),
+ FRAC_CONST(0.96421118317032928),
+ FRAC_CONST(0.96759909236025976),
+ FRAC_CONST(0.9708212084269281),
+ FRAC_CONST(0.97387697927733363),
+ FRAC_CONST(0.97676588132087239),
+ FRAC_CONST(0.97948741955905139),
+ FRAC_CONST(0.98204112767030394),
+ FRAC_CONST(0.98442656808989171),
+ FRAC_CONST(0.98664333208487898),
+ FRAC_CONST(0.98869103982416728),
+ FRAC_CONST(0.99056934044357725),
+ FRAC_CONST(0.99227791210596705),
+ FRAC_CONST(0.99381646205637808),
+ FRAC_CONST(0.99518472667219682),
+ FRAC_CONST(0.99638247150832537),
+ FRAC_CONST(0.99740949133735191),
+ FRAC_CONST(0.99826561018471593),
+ FRAC_CONST(0.99895068135886012),
+ FRAC_CONST(0.99946458747636568),
+ FRAC_CONST(0.99980724048206482),
+ FRAC_CONST(0.99997858166412923)
+};
#endif
#ifdef LD_DEC
- ALIGN static const real_t sine_mid_512[] =
- {
- FRAC_CONST(0.0015339801862847655),
- FRAC_CONST(0.0046019261204485705),
- FRAC_CONST(0.007669828739531097),
- FRAC_CONST(0.010737659167264491),
- FRAC_CONST(0.013805388528060391),
- FRAC_CONST(0.01687298794728171),
- FRAC_CONST(0.019940428551514441),
- FRAC_CONST(0.023007681468839369),
- FRAC_CONST(0.026074717829103901),
- FRAC_CONST(0.029141508764193722),
- FRAC_CONST(0.032208025408304586),
- FRAC_CONST(0.035274238898213947),
- FRAC_CONST(0.038340120373552694),
- FRAC_CONST(0.041405640977076739),
- FRAC_CONST(0.044470771854938668),
- FRAC_CONST(0.047535484156959303),
- FRAC_CONST(0.050599749036899282),
- FRAC_CONST(0.05366353765273052),
- FRAC_CONST(0.056726821166907748),
- FRAC_CONST(0.059789570746639868),
- FRAC_CONST(0.062851757564161406),
- FRAC_CONST(0.065913352797003805),
- FRAC_CONST(0.068974327628266746),
- FRAC_CONST(0.072034653246889332),
- FRAC_CONST(0.075094300847921305),
- FRAC_CONST(0.078153241632794232),
- FRAC_CONST(0.081211446809592441),
- FRAC_CONST(0.084268887593324071),
- FRAC_CONST(0.087325535206192059),
- FRAC_CONST(0.090381360877864983),
- FRAC_CONST(0.093436335845747787),
- FRAC_CONST(0.096490431355252593),
- FRAC_CONST(0.099543618660069319),
- FRAC_CONST(0.10259586902243628),
- FRAC_CONST(0.10564715371341062),
- FRAC_CONST(0.10869744401313872),
- FRAC_CONST(0.11174671121112659),
- FRAC_CONST(0.11479492660651008),
- FRAC_CONST(0.11784206150832498),
- FRAC_CONST(0.12088808723577708),
- FRAC_CONST(0.12393297511851216),
- FRAC_CONST(0.12697669649688587),
- FRAC_CONST(0.13001922272223335),
- FRAC_CONST(0.13306052515713906),
- FRAC_CONST(0.1361005751757062),
- FRAC_CONST(0.1391393441638262),
- FRAC_CONST(0.14217680351944803),
- FRAC_CONST(0.14521292465284746),
- FRAC_CONST(0.14824767898689603),
- FRAC_CONST(0.15128103795733022),
- FRAC_CONST(0.1543129730130201),
- FRAC_CONST(0.15734345561623825),
- FRAC_CONST(0.16037245724292828),
- FRAC_CONST(0.16339994938297323),
- FRAC_CONST(0.1664259035404641),
- FRAC_CONST(0.16945029123396796),
- FRAC_CONST(0.17247308399679595),
- FRAC_CONST(0.17549425337727143),
- FRAC_CONST(0.17851377093899751),
- FRAC_CONST(0.18153160826112497),
- FRAC_CONST(0.18454773693861962),
- FRAC_CONST(0.1875621285825296),
- FRAC_CONST(0.19057475482025274),
- FRAC_CONST(0.19358558729580361),
- FRAC_CONST(0.19659459767008022),
- FRAC_CONST(0.19960175762113097),
- FRAC_CONST(0.20260703884442113),
- FRAC_CONST(0.20561041305309924),
- FRAC_CONST(0.20861185197826349),
- FRAC_CONST(0.21161132736922755),
- FRAC_CONST(0.21460881099378676),
- FRAC_CONST(0.21760427463848364),
- FRAC_CONST(0.22059769010887351),
- FRAC_CONST(0.22358902922978999),
- FRAC_CONST(0.22657826384561),
- FRAC_CONST(0.22956536582051887),
- FRAC_CONST(0.23255030703877524),
- FRAC_CONST(0.23553305940497549),
- FRAC_CONST(0.23851359484431842),
- FRAC_CONST(0.24149188530286933),
- FRAC_CONST(0.24446790274782415),
- FRAC_CONST(0.24744161916777327),
- FRAC_CONST(0.25041300657296522),
- FRAC_CONST(0.25338203699557016),
- FRAC_CONST(0.25634868248994291),
- FRAC_CONST(0.25931291513288623),
- FRAC_CONST(0.26227470702391359),
- FRAC_CONST(0.26523403028551179),
- FRAC_CONST(0.26819085706340318),
- FRAC_CONST(0.27114515952680801),
- FRAC_CONST(0.27409690986870638),
- FRAC_CONST(0.2770460803060999),
- FRAC_CONST(0.27999264308027322),
- FRAC_CONST(0.28293657045705539),
- FRAC_CONST(0.28587783472708062),
- FRAC_CONST(0.28881640820604948),
- FRAC_CONST(0.29175226323498926),
- FRAC_CONST(0.29468537218051433),
- FRAC_CONST(0.2976157074350862),
- FRAC_CONST(0.30054324141727345),
- FRAC_CONST(0.30346794657201132),
- FRAC_CONST(0.30638979537086092),
- FRAC_CONST(0.30930876031226873),
- FRAC_CONST(0.31222481392182488),
- FRAC_CONST(0.31513792875252244),
- FRAC_CONST(0.31804807738501495),
- FRAC_CONST(0.32095523242787521),
- FRAC_CONST(0.32385936651785285),
- FRAC_CONST(0.32676045232013173),
- FRAC_CONST(0.32965846252858749),
- FRAC_CONST(0.33255336986604422),
- FRAC_CONST(0.3354451470845316),
- FRAC_CONST(0.33833376696554113),
- FRAC_CONST(0.34121920232028236),
- FRAC_CONST(0.34410142598993881),
- FRAC_CONST(0.34698041084592368),
- FRAC_CONST(0.34985612979013492),
- FRAC_CONST(0.35272855575521073),
- FRAC_CONST(0.35559766170478385),
- FRAC_CONST(0.35846342063373654),
- FRAC_CONST(0.36132580556845428),
- FRAC_CONST(0.36418478956707989),
- FRAC_CONST(0.36704034571976718),
- FRAC_CONST(0.3698924471489341),
- FRAC_CONST(0.37274106700951576),
- FRAC_CONST(0.37558617848921722),
- FRAC_CONST(0.37842775480876556),
- FRAC_CONST(0.38126576922216238),
- FRAC_CONST(0.38410019501693504),
- FRAC_CONST(0.38693100551438858),
- FRAC_CONST(0.38975817406985641),
- FRAC_CONST(0.39258167407295147),
- FRAC_CONST(0.39540147894781635),
- FRAC_CONST(0.39821756215337356),
- FRAC_CONST(0.40102989718357562),
- FRAC_CONST(0.40383845756765407),
- FRAC_CONST(0.40664321687036903),
- FRAC_CONST(0.40944414869225759),
- FRAC_CONST(0.41224122666988289),
- FRAC_CONST(0.41503442447608163),
- FRAC_CONST(0.41782371582021227),
- FRAC_CONST(0.42060907444840251),
- FRAC_CONST(0.42339047414379605),
- FRAC_CONST(0.42616788872679962),
- FRAC_CONST(0.42894129205532949),
- FRAC_CONST(0.43171065802505726),
- FRAC_CONST(0.43447596056965565),
- FRAC_CONST(0.43723717366104409),
- FRAC_CONST(0.43999427130963326),
- FRAC_CONST(0.44274722756457002),
- FRAC_CONST(0.44549601651398174),
- FRAC_CONST(0.44824061228521989),
- FRAC_CONST(0.45098098904510386),
- FRAC_CONST(0.45371712100016387),
- FRAC_CONST(0.45644898239688392),
- FRAC_CONST(0.45917654752194409),
- FRAC_CONST(0.46189979070246273),
- FRAC_CONST(0.46461868630623782),
- FRAC_CONST(0.46733320874198842),
- FRAC_CONST(0.47004333245959562),
- FRAC_CONST(0.47274903195034279),
- FRAC_CONST(0.47545028174715587),
- FRAC_CONST(0.47814705642484301),
- FRAC_CONST(0.48083933060033396),
- FRAC_CONST(0.48352707893291874),
- FRAC_CONST(0.48621027612448642),
- FRAC_CONST(0.48888889691976317),
- FRAC_CONST(0.4915629161065499),
- FRAC_CONST(0.49423230851595967),
- FRAC_CONST(0.49689704902265447),
- FRAC_CONST(0.49955711254508184),
- FRAC_CONST(0.50221247404571079),
- FRAC_CONST(0.50486310853126759),
- FRAC_CONST(0.50750899105297087),
- FRAC_CONST(0.51015009670676681),
- FRAC_CONST(0.51278640063356296),
- FRAC_CONST(0.51541787801946293),
- FRAC_CONST(0.51804450409599934),
- FRAC_CONST(0.52066625414036716),
- FRAC_CONST(0.52328310347565643),
- FRAC_CONST(0.52589502747108463),
- FRAC_CONST(0.52850200154222848),
- FRAC_CONST(0.531104001151255),
- FRAC_CONST(0.53370100180715296),
- FRAC_CONST(0.53629297906596318),
- FRAC_CONST(0.53887990853100842),
- FRAC_CONST(0.54146176585312344),
- FRAC_CONST(0.54403852673088382),
- FRAC_CONST(0.54661016691083486),
- FRAC_CONST(0.54917666218771966),
- FRAC_CONST(0.55173798840470734),
- FRAC_CONST(0.55429412145362),
- FRAC_CONST(0.5568450372751601),
- FRAC_CONST(0.55939071185913614),
- FRAC_CONST(0.56193112124468947),
- FRAC_CONST(0.5644662415205195),
- FRAC_CONST(0.56699604882510868),
- FRAC_CONST(0.56952051934694714),
- FRAC_CONST(0.57203962932475705),
- FRAC_CONST(0.57455335504771576),
- FRAC_CONST(0.57706167285567944),
- FRAC_CONST(0.57956455913940563),
- FRAC_CONST(0.58206199034077544),
- FRAC_CONST(0.58455394295301533),
- FRAC_CONST(0.58704039352091797),
- FRAC_CONST(0.58952131864106394),
- FRAC_CONST(0.59199669496204099),
- FRAC_CONST(0.59446649918466443),
- FRAC_CONST(0.5969307080621965),
- FRAC_CONST(0.59938929840056454),
- FRAC_CONST(0.60184224705858003),
- FRAC_CONST(0.60428953094815596),
- FRAC_CONST(0.60673112703452448),
- FRAC_CONST(0.60916701233645321),
- FRAC_CONST(0.61159716392646191),
- FRAC_CONST(0.61402155893103838),
- FRAC_CONST(0.61644017453085365),
- FRAC_CONST(0.61885298796097632),
- FRAC_CONST(0.62125997651108755),
- FRAC_CONST(0.62366111752569453),
- FRAC_CONST(0.62605638840434352),
- FRAC_CONST(0.62844576660183271),
- FRAC_CONST(0.63082922962842447),
- FRAC_CONST(0.63320675505005719),
- FRAC_CONST(0.63557832048855611),
- FRAC_CONST(0.63794390362184406),
- FRAC_CONST(0.64030348218415167),
- FRAC_CONST(0.64265703396622686),
- FRAC_CONST(0.64500453681554393),
- FRAC_CONST(0.64734596863651206),
- FRAC_CONST(0.64968130739068319),
- FRAC_CONST(0.6520105310969595),
- FRAC_CONST(0.65433361783180044),
- FRAC_CONST(0.65665054572942894),
- FRAC_CONST(0.65896129298203732),
- FRAC_CONST(0.66126583783999227),
- FRAC_CONST(0.66356415861203977),
- FRAC_CONST(0.66585623366550972),
- FRAC_CONST(0.66814204142651845),
- FRAC_CONST(0.67042156038017309),
- FRAC_CONST(0.67269476907077286),
- FRAC_CONST(0.67496164610201193),
- FRAC_CONST(0.67722217013718033),
- FRAC_CONST(0.67947631989936497),
- FRAC_CONST(0.68172407417164971),
- FRAC_CONST(0.6839654117973154),
- FRAC_CONST(0.68620031168003859),
- FRAC_CONST(0.68842875278409044),
- FRAC_CONST(0.6906507141345346),
- FRAC_CONST(0.69286617481742463),
- FRAC_CONST(0.69507511398000088),
- FRAC_CONST(0.69727751083088652),
- FRAC_CONST(0.69947334464028377),
- FRAC_CONST(0.70166259474016845),
- FRAC_CONST(0.70384524052448494),
- FRAC_CONST(0.70602126144933974),
- FRAC_CONST(0.70819063703319529),
- FRAC_CONST(0.71035334685706231),
- FRAC_CONST(0.71250937056469232),
- FRAC_CONST(0.71465868786276898),
- FRAC_CONST(0.71680127852109954),
- FRAC_CONST(0.71893712237280438),
- FRAC_CONST(0.72106619931450811),
- FRAC_CONST(0.72318848930652735),
- FRAC_CONST(0.72530397237306066),
- FRAC_CONST(0.72741262860237577),
- FRAC_CONST(0.7295144381469969),
- FRAC_CONST(0.73160938122389252),
- FRAC_CONST(0.73369743811466026),
- FRAC_CONST(0.73577858916571348),
- FRAC_CONST(0.73785281478846598),
- FRAC_CONST(0.73992009545951609),
- FRAC_CONST(0.74198041172083096),
- FRAC_CONST(0.74403374417992918),
- FRAC_CONST(0.74608007351006378),
- FRAC_CONST(0.74811938045040349),
- FRAC_CONST(0.75015164580621496),
- FRAC_CONST(0.7521768504490427),
- FRAC_CONST(0.75419497531688917),
- FRAC_CONST(0.75620600141439454),
- FRAC_CONST(0.75820990981301528),
- FRAC_CONST(0.76020668165120242),
- FRAC_CONST(0.7621962981345789),
- FRAC_CONST(0.76417874053611667),
- FRAC_CONST(0.76615399019631281),
- FRAC_CONST(0.76812202852336531),
- FRAC_CONST(0.7700828369933479),
- FRAC_CONST(0.77203639715038441),
- FRAC_CONST(0.77398269060682279),
- FRAC_CONST(0.77592169904340758),
- FRAC_CONST(0.77785340420945304),
- FRAC_CONST(0.77977778792301444),
- FRAC_CONST(0.78169483207105939),
- FRAC_CONST(0.7836045186096382),
- FRAC_CONST(0.78550682956405393),
- FRAC_CONST(0.78740174702903132),
- FRAC_CONST(0.78928925316888565),
- FRAC_CONST(0.79116933021769009),
- FRAC_CONST(0.79304196047944364),
- FRAC_CONST(0.79490712632823701),
- FRAC_CONST(0.79676481020841872),
- FRAC_CONST(0.79861499463476082),
- FRAC_CONST(0.80045766219262271),
- FRAC_CONST(0.80229279553811572),
- FRAC_CONST(0.8041203773982657),
- FRAC_CONST(0.80594039057117628),
- FRAC_CONST(0.80775281792619036),
- FRAC_CONST(0.80955764240405126),
- FRAC_CONST(0.81135484701706373),
- FRAC_CONST(0.81314441484925359),
- FRAC_CONST(0.81492632905652662),
- FRAC_CONST(0.81670057286682785),
- FRAC_CONST(0.81846712958029866),
- FRAC_CONST(0.82022598256943469),
- FRAC_CONST(0.82197711527924155),
- FRAC_CONST(0.82372051122739132),
- FRAC_CONST(0.82545615400437744),
- FRAC_CONST(0.82718402727366902),
- FRAC_CONST(0.82890411477186487),
- FRAC_CONST(0.8306164003088462),
- FRAC_CONST(0.83232086776792968),
- FRAC_CONST(0.83401750110601813),
- FRAC_CONST(0.8357062843537526),
- FRAC_CONST(0.83738720161566194),
- FRAC_CONST(0.83906023707031263),
- FRAC_CONST(0.84072537497045807),
- FRAC_CONST(0.84238259964318596),
- FRAC_CONST(0.84403189549006641),
- FRAC_CONST(0.84567324698729907),
- FRAC_CONST(0.84730663868585832),
- FRAC_CONST(0.84893205521163961),
- FRAC_CONST(0.85054948126560337),
- FRAC_CONST(0.85215890162391983),
- FRAC_CONST(0.8537603011381113),
- FRAC_CONST(0.85535366473519603),
- FRAC_CONST(0.85693897741782865),
- FRAC_CONST(0.85851622426444274),
- FRAC_CONST(0.86008539042939014),
- FRAC_CONST(0.8616464611430813),
- FRAC_CONST(0.86319942171212416),
- FRAC_CONST(0.86474425751946238),
- FRAC_CONST(0.86628095402451299),
- FRAC_CONST(0.86780949676330321),
- FRAC_CONST(0.86932987134860673),
- FRAC_CONST(0.87084206347007886),
- FRAC_CONST(0.87234605889439154),
- FRAC_CONST(0.87384184346536675),
- FRAC_CONST(0.87532940310411078),
- FRAC_CONST(0.87680872380914576),
- FRAC_CONST(0.87827979165654146),
- FRAC_CONST(0.87974259280004741),
- FRAC_CONST(0.88119711347122198),
- FRAC_CONST(0.88264333997956279),
- FRAC_CONST(0.88408125871263499),
- FRAC_CONST(0.88551085613619995),
- FRAC_CONST(0.88693211879434208),
- FRAC_CONST(0.88834503330959624),
- FRAC_CONST(0.88974958638307289),
- FRAC_CONST(0.89114576479458318),
- FRAC_CONST(0.89253355540276469),
- FRAC_CONST(0.89391294514520325),
- FRAC_CONST(0.89528392103855758),
- FRAC_CONST(0.89664647017868015),
- FRAC_CONST(0.89800057974073988),
- FRAC_CONST(0.89934623697934146),
- FRAC_CONST(0.90068342922864686),
- FRAC_CONST(0.90201214390249307),
- FRAC_CONST(0.90333236849451182),
- FRAC_CONST(0.90464409057824624),
- FRAC_CONST(0.90594729780726846),
- FRAC_CONST(0.90724197791529593),
- FRAC_CONST(0.90852811871630612),
- FRAC_CONST(0.90980570810465222),
- FRAC_CONST(0.91107473405517625),
- FRAC_CONST(0.91233518462332275),
- FRAC_CONST(0.91358704794525081),
- FRAC_CONST(0.91483031223794609),
- FRAC_CONST(0.91606496579933161),
- FRAC_CONST(0.91729099700837791),
- FRAC_CONST(0.91850839432521225),
- FRAC_CONST(0.91971714629122736),
- FRAC_CONST(0.92091724152918952),
- FRAC_CONST(0.92210866874334507),
- FRAC_CONST(0.92329141671952764),
- FRAC_CONST(0.9244654743252626),
- FRAC_CONST(0.92563083050987272),
- FRAC_CONST(0.92678747430458175),
- FRAC_CONST(0.92793539482261789),
- FRAC_CONST(0.92907458125931575),
- FRAC_CONST(0.93020502289221907),
- FRAC_CONST(0.93132670908118043),
- FRAC_CONST(0.93243962926846236),
- FRAC_CONST(0.93354377297883617),
- FRAC_CONST(0.93463912981968078),
- FRAC_CONST(0.93572568948108037),
- FRAC_CONST(0.93680344173592156),
- FRAC_CONST(0.93787237643998989),
- FRAC_CONST(0.93893248353206449),
- FRAC_CONST(0.93998375303401394),
- FRAC_CONST(0.94102617505088926),
- FRAC_CONST(0.94205973977101731),
- FRAC_CONST(0.94308443746609349),
- FRAC_CONST(0.94410025849127266),
- FRAC_CONST(0.94510719328526061),
- FRAC_CONST(0.94610523237040334),
- FRAC_CONST(0.94709436635277722),
- FRAC_CONST(0.94807458592227623),
- FRAC_CONST(0.94904588185270056),
- FRAC_CONST(0.950008245001843),
- FRAC_CONST(0.95096166631157508),
- FRAC_CONST(0.95190613680793223),
- FRAC_CONST(0.95284164760119872),
- FRAC_CONST(0.95376818988599033),
- FRAC_CONST(0.95468575494133834),
- FRAC_CONST(0.95559433413077111),
- FRAC_CONST(0.95649391890239499),
- FRAC_CONST(0.95738450078897586),
- FRAC_CONST(0.95826607140801767),
- FRAC_CONST(0.95913862246184189),
- FRAC_CONST(0.96000214573766585),
- FRAC_CONST(0.96085663310767966),
- FRAC_CONST(0.96170207652912254),
- FRAC_CONST(0.96253846804435916),
- FRAC_CONST(0.96336579978095405),
- FRAC_CONST(0.96418406395174572),
- FRAC_CONST(0.96499325285492032),
- FRAC_CONST(0.96579335887408357),
- FRAC_CONST(0.96658437447833312),
- FRAC_CONST(0.96736629222232851),
- FRAC_CONST(0.96813910474636233),
- FRAC_CONST(0.96890280477642887),
- FRAC_CONST(0.96965738512429245),
- FRAC_CONST(0.9704028386875555),
- FRAC_CONST(0.97113915844972509),
- FRAC_CONST(0.9718663374802794),
- FRAC_CONST(0.97258436893473221),
- FRAC_CONST(0.97329324605469825),
- FRAC_CONST(0.97399296216795583),
- FRAC_CONST(0.97468351068851067),
- FRAC_CONST(0.97536488511665687),
- FRAC_CONST(0.97603707903903902),
- FRAC_CONST(0.97670008612871184),
- FRAC_CONST(0.97735390014519996),
- FRAC_CONST(0.97799851493455714),
- FRAC_CONST(0.9786339244294231),
- FRAC_CONST(0.97926012264908202),
- FRAC_CONST(0.97987710369951764),
- FRAC_CONST(0.98048486177346938),
- FRAC_CONST(0.98108339115048659),
- FRAC_CONST(0.98167268619698311),
- FRAC_CONST(0.98225274136628937),
- FRAC_CONST(0.98282355119870524),
- FRAC_CONST(0.98338511032155118),
- FRAC_CONST(0.98393741344921892),
- FRAC_CONST(0.98448045538322093),
- FRAC_CONST(0.98501423101223984),
- FRAC_CONST(0.98553873531217606),
- FRAC_CONST(0.98605396334619544),
- FRAC_CONST(0.98655991026477541),
- FRAC_CONST(0.98705657130575097),
- FRAC_CONST(0.98754394179435923),
- FRAC_CONST(0.98802201714328353),
- FRAC_CONST(0.98849079285269659),
- FRAC_CONST(0.98895026451030299),
- FRAC_CONST(0.98940042779138038),
- FRAC_CONST(0.98984127845882053),
- FRAC_CONST(0.99027281236316911),
- FRAC_CONST(0.99069502544266463),
- FRAC_CONST(0.99110791372327678),
- FRAC_CONST(0.9915114733187439),
- FRAC_CONST(0.99190570043060933),
- FRAC_CONST(0.99229059134825737),
- FRAC_CONST(0.99266614244894802),
- FRAC_CONST(0.99303235019785141),
- FRAC_CONST(0.99338921114808065),
- FRAC_CONST(0.9937367219407246),
- FRAC_CONST(0.99407487930487937),
- FRAC_CONST(0.9944036800576791),
- FRAC_CONST(0.9947231211043257),
- FRAC_CONST(0.99503319943811863),
- FRAC_CONST(0.99533391214048228),
- FRAC_CONST(0.99562525638099431),
- FRAC_CONST(0.99590722941741172),
- FRAC_CONST(0.99617982859569687),
- FRAC_CONST(0.99644305135004263),
- FRAC_CONST(0.99669689520289606),
- FRAC_CONST(0.99694135776498216),
- FRAC_CONST(0.99717643673532619),
- FRAC_CONST(0.9974021299012753),
- FRAC_CONST(0.99761843513851955),
- FRAC_CONST(0.99782535041111164),
- FRAC_CONST(0.99802287377148624),
- FRAC_CONST(0.99821100336047819),
- FRAC_CONST(0.99838973740734016),
- FRAC_CONST(0.99855907422975931),
- FRAC_CONST(0.99871901223387294),
- FRAC_CONST(0.99886954991428356),
- FRAC_CONST(0.99901068585407338),
- FRAC_CONST(0.99914241872481691),
- FRAC_CONST(0.99926474728659442),
- FRAC_CONST(0.99937767038800285),
- FRAC_CONST(0.99948118696616695),
- FRAC_CONST(0.99957529604674922),
- FRAC_CONST(0.99965999674395922),
- FRAC_CONST(0.99973528826056168),
- FRAC_CONST(0.99980116988788426),
- FRAC_CONST(0.99985764100582386),
- FRAC_CONST(0.9999047010828529),
- FRAC_CONST(0.99994234967602391),
- FRAC_CONST(0.99997058643097414),
- FRAC_CONST(0.9999894110819284),
- FRAC_CONST(0.99999882345170188)
- };
+ALIGN static const real_t sine_mid_512[] =
+{
+ FRAC_CONST(0.0015339801862847655),
+ FRAC_CONST(0.0046019261204485705),
+ FRAC_CONST(0.007669828739531097),
+ FRAC_CONST(0.010737659167264491),
+ FRAC_CONST(0.013805388528060391),
+ FRAC_CONST(0.01687298794728171),
+ FRAC_CONST(0.019940428551514441),
+ FRAC_CONST(0.023007681468839369),
+ FRAC_CONST(0.026074717829103901),
+ FRAC_CONST(0.029141508764193722),
+ FRAC_CONST(0.032208025408304586),
+ FRAC_CONST(0.035274238898213947),
+ FRAC_CONST(0.038340120373552694),
+ FRAC_CONST(0.041405640977076739),
+ FRAC_CONST(0.044470771854938668),
+ FRAC_CONST(0.047535484156959303),
+ FRAC_CONST(0.050599749036899282),
+ FRAC_CONST(0.05366353765273052),
+ FRAC_CONST(0.056726821166907748),
+ FRAC_CONST(0.059789570746639868),
+ FRAC_CONST(0.062851757564161406),
+ FRAC_CONST(0.065913352797003805),
+ FRAC_CONST(0.068974327628266746),
+ FRAC_CONST(0.072034653246889332),
+ FRAC_CONST(0.075094300847921305),
+ FRAC_CONST(0.078153241632794232),
+ FRAC_CONST(0.081211446809592441),
+ FRAC_CONST(0.084268887593324071),
+ FRAC_CONST(0.087325535206192059),
+ FRAC_CONST(0.090381360877864983),
+ FRAC_CONST(0.093436335845747787),
+ FRAC_CONST(0.096490431355252593),
+ FRAC_CONST(0.099543618660069319),
+ FRAC_CONST(0.10259586902243628),
+ FRAC_CONST(0.10564715371341062),
+ FRAC_CONST(0.10869744401313872),
+ FRAC_CONST(0.11174671121112659),
+ FRAC_CONST(0.11479492660651008),
+ FRAC_CONST(0.11784206150832498),
+ FRAC_CONST(0.12088808723577708),
+ FRAC_CONST(0.12393297511851216),
+ FRAC_CONST(0.12697669649688587),
+ FRAC_CONST(0.13001922272223335),
+ FRAC_CONST(0.13306052515713906),
+ FRAC_CONST(0.1361005751757062),
+ FRAC_CONST(0.1391393441638262),
+ FRAC_CONST(0.14217680351944803),
+ FRAC_CONST(0.14521292465284746),
+ FRAC_CONST(0.14824767898689603),
+ FRAC_CONST(0.15128103795733022),
+ FRAC_CONST(0.1543129730130201),
+ FRAC_CONST(0.15734345561623825),
+ FRAC_CONST(0.16037245724292828),
+ FRAC_CONST(0.16339994938297323),
+ FRAC_CONST(0.1664259035404641),
+ FRAC_CONST(0.16945029123396796),
+ FRAC_CONST(0.17247308399679595),
+ FRAC_CONST(0.17549425337727143),
+ FRAC_CONST(0.17851377093899751),
+ FRAC_CONST(0.18153160826112497),
+ FRAC_CONST(0.18454773693861962),
+ FRAC_CONST(0.1875621285825296),
+ FRAC_CONST(0.19057475482025274),
+ FRAC_CONST(0.19358558729580361),
+ FRAC_CONST(0.19659459767008022),
+ FRAC_CONST(0.19960175762113097),
+ FRAC_CONST(0.20260703884442113),
+ FRAC_CONST(0.20561041305309924),
+ FRAC_CONST(0.20861185197826349),
+ FRAC_CONST(0.21161132736922755),
+ FRAC_CONST(0.21460881099378676),
+ FRAC_CONST(0.21760427463848364),
+ FRAC_CONST(0.22059769010887351),
+ FRAC_CONST(0.22358902922978999),
+ FRAC_CONST(0.22657826384561),
+ FRAC_CONST(0.22956536582051887),
+ FRAC_CONST(0.23255030703877524),
+ FRAC_CONST(0.23553305940497549),
+ FRAC_CONST(0.23851359484431842),
+ FRAC_CONST(0.24149188530286933),
+ FRAC_CONST(0.24446790274782415),
+ FRAC_CONST(0.24744161916777327),
+ FRAC_CONST(0.25041300657296522),
+ FRAC_CONST(0.25338203699557016),
+ FRAC_CONST(0.25634868248994291),
+ FRAC_CONST(0.25931291513288623),
+ FRAC_CONST(0.26227470702391359),
+ FRAC_CONST(0.26523403028551179),
+ FRAC_CONST(0.26819085706340318),
+ FRAC_CONST(0.27114515952680801),
+ FRAC_CONST(0.27409690986870638),
+ FRAC_CONST(0.2770460803060999),
+ FRAC_CONST(0.27999264308027322),
+ FRAC_CONST(0.28293657045705539),
+ FRAC_CONST(0.28587783472708062),
+ FRAC_CONST(0.28881640820604948),
+ FRAC_CONST(0.29175226323498926),
+ FRAC_CONST(0.29468537218051433),
+ FRAC_CONST(0.2976157074350862),
+ FRAC_CONST(0.30054324141727345),
+ FRAC_CONST(0.30346794657201132),
+ FRAC_CONST(0.30638979537086092),
+ FRAC_CONST(0.30930876031226873),
+ FRAC_CONST(0.31222481392182488),
+ FRAC_CONST(0.31513792875252244),
+ FRAC_CONST(0.31804807738501495),
+ FRAC_CONST(0.32095523242787521),
+ FRAC_CONST(0.32385936651785285),
+ FRAC_CONST(0.32676045232013173),
+ FRAC_CONST(0.32965846252858749),
+ FRAC_CONST(0.33255336986604422),
+ FRAC_CONST(0.3354451470845316),
+ FRAC_CONST(0.33833376696554113),
+ FRAC_CONST(0.34121920232028236),
+ FRAC_CONST(0.34410142598993881),
+ FRAC_CONST(0.34698041084592368),
+ FRAC_CONST(0.34985612979013492),
+ FRAC_CONST(0.35272855575521073),
+ FRAC_CONST(0.35559766170478385),
+ FRAC_CONST(0.35846342063373654),
+ FRAC_CONST(0.36132580556845428),
+ FRAC_CONST(0.36418478956707989),
+ FRAC_CONST(0.36704034571976718),
+ FRAC_CONST(0.3698924471489341),
+ FRAC_CONST(0.37274106700951576),
+ FRAC_CONST(0.37558617848921722),
+ FRAC_CONST(0.37842775480876556),
+ FRAC_CONST(0.38126576922216238),
+ FRAC_CONST(0.38410019501693504),
+ FRAC_CONST(0.38693100551438858),
+ FRAC_CONST(0.38975817406985641),
+ FRAC_CONST(0.39258167407295147),
+ FRAC_CONST(0.39540147894781635),
+ FRAC_CONST(0.39821756215337356),
+ FRAC_CONST(0.40102989718357562),
+ FRAC_CONST(0.40383845756765407),
+ FRAC_CONST(0.40664321687036903),
+ FRAC_CONST(0.40944414869225759),
+ FRAC_CONST(0.41224122666988289),
+ FRAC_CONST(0.41503442447608163),
+ FRAC_CONST(0.41782371582021227),
+ FRAC_CONST(0.42060907444840251),
+ FRAC_CONST(0.42339047414379605),
+ FRAC_CONST(0.42616788872679962),
+ FRAC_CONST(0.42894129205532949),
+ FRAC_CONST(0.43171065802505726),
+ FRAC_CONST(0.43447596056965565),
+ FRAC_CONST(0.43723717366104409),
+ FRAC_CONST(0.43999427130963326),
+ FRAC_CONST(0.44274722756457002),
+ FRAC_CONST(0.44549601651398174),
+ FRAC_CONST(0.44824061228521989),
+ FRAC_CONST(0.45098098904510386),
+ FRAC_CONST(0.45371712100016387),
+ FRAC_CONST(0.45644898239688392),
+ FRAC_CONST(0.45917654752194409),
+ FRAC_CONST(0.46189979070246273),
+ FRAC_CONST(0.46461868630623782),
+ FRAC_CONST(0.46733320874198842),
+ FRAC_CONST(0.47004333245959562),
+ FRAC_CONST(0.47274903195034279),
+ FRAC_CONST(0.47545028174715587),
+ FRAC_CONST(0.47814705642484301),
+ FRAC_CONST(0.48083933060033396),
+ FRAC_CONST(0.48352707893291874),
+ FRAC_CONST(0.48621027612448642),
+ FRAC_CONST(0.48888889691976317),
+ FRAC_CONST(0.4915629161065499),
+ FRAC_CONST(0.49423230851595967),
+ FRAC_CONST(0.49689704902265447),
+ FRAC_CONST(0.49955711254508184),
+ FRAC_CONST(0.50221247404571079),
+ FRAC_CONST(0.50486310853126759),
+ FRAC_CONST(0.50750899105297087),
+ FRAC_CONST(0.51015009670676681),
+ FRAC_CONST(0.51278640063356296),
+ FRAC_CONST(0.51541787801946293),
+ FRAC_CONST(0.51804450409599934),
+ FRAC_CONST(0.52066625414036716),
+ FRAC_CONST(0.52328310347565643),
+ FRAC_CONST(0.52589502747108463),
+ FRAC_CONST(0.52850200154222848),
+ FRAC_CONST(0.531104001151255),
+ FRAC_CONST(0.53370100180715296),
+ FRAC_CONST(0.53629297906596318),
+ FRAC_CONST(0.53887990853100842),
+ FRAC_CONST(0.54146176585312344),
+ FRAC_CONST(0.54403852673088382),
+ FRAC_CONST(0.54661016691083486),
+ FRAC_CONST(0.54917666218771966),
+ FRAC_CONST(0.55173798840470734),
+ FRAC_CONST(0.55429412145362),
+ FRAC_CONST(0.5568450372751601),
+ FRAC_CONST(0.55939071185913614),
+ FRAC_CONST(0.56193112124468947),
+ FRAC_CONST(0.5644662415205195),
+ FRAC_CONST(0.56699604882510868),
+ FRAC_CONST(0.56952051934694714),
+ FRAC_CONST(0.57203962932475705),
+ FRAC_CONST(0.57455335504771576),
+ FRAC_CONST(0.57706167285567944),
+ FRAC_CONST(0.57956455913940563),
+ FRAC_CONST(0.58206199034077544),
+ FRAC_CONST(0.58455394295301533),
+ FRAC_CONST(0.58704039352091797),
+ FRAC_CONST(0.58952131864106394),
+ FRAC_CONST(0.59199669496204099),
+ FRAC_CONST(0.59446649918466443),
+ FRAC_CONST(0.5969307080621965),
+ FRAC_CONST(0.59938929840056454),
+ FRAC_CONST(0.60184224705858003),
+ FRAC_CONST(0.60428953094815596),
+ FRAC_CONST(0.60673112703452448),
+ FRAC_CONST(0.60916701233645321),
+ FRAC_CONST(0.61159716392646191),
+ FRAC_CONST(0.61402155893103838),
+ FRAC_CONST(0.61644017453085365),
+ FRAC_CONST(0.61885298796097632),
+ FRAC_CONST(0.62125997651108755),
+ FRAC_CONST(0.62366111752569453),
+ FRAC_CONST(0.62605638840434352),
+ FRAC_CONST(0.62844576660183271),
+ FRAC_CONST(0.63082922962842447),
+ FRAC_CONST(0.63320675505005719),
+ FRAC_CONST(0.63557832048855611),
+ FRAC_CONST(0.63794390362184406),
+ FRAC_CONST(0.64030348218415167),
+ FRAC_CONST(0.64265703396622686),
+ FRAC_CONST(0.64500453681554393),
+ FRAC_CONST(0.64734596863651206),
+ FRAC_CONST(0.64968130739068319),
+ FRAC_CONST(0.6520105310969595),
+ FRAC_CONST(0.65433361783180044),
+ FRAC_CONST(0.65665054572942894),
+ FRAC_CONST(0.65896129298203732),
+ FRAC_CONST(0.66126583783999227),
+ FRAC_CONST(0.66356415861203977),
+ FRAC_CONST(0.66585623366550972),
+ FRAC_CONST(0.66814204142651845),
+ FRAC_CONST(0.67042156038017309),
+ FRAC_CONST(0.67269476907077286),
+ FRAC_CONST(0.67496164610201193),
+ FRAC_CONST(0.67722217013718033),
+ FRAC_CONST(0.67947631989936497),
+ FRAC_CONST(0.68172407417164971),
+ FRAC_CONST(0.6839654117973154),
+ FRAC_CONST(0.68620031168003859),
+ FRAC_CONST(0.68842875278409044),
+ FRAC_CONST(0.6906507141345346),
+ FRAC_CONST(0.69286617481742463),
+ FRAC_CONST(0.69507511398000088),
+ FRAC_CONST(0.69727751083088652),
+ FRAC_CONST(0.69947334464028377),
+ FRAC_CONST(0.70166259474016845),
+ FRAC_CONST(0.70384524052448494),
+ FRAC_CONST(0.70602126144933974),
+ FRAC_CONST(0.70819063703319529),
+ FRAC_CONST(0.71035334685706231),
+ FRAC_CONST(0.71250937056469232),
+ FRAC_CONST(0.71465868786276898),
+ FRAC_CONST(0.71680127852109954),
+ FRAC_CONST(0.71893712237280438),
+ FRAC_CONST(0.72106619931450811),
+ FRAC_CONST(0.72318848930652735),
+ FRAC_CONST(0.72530397237306066),
+ FRAC_CONST(0.72741262860237577),
+ FRAC_CONST(0.7295144381469969),
+ FRAC_CONST(0.73160938122389252),
+ FRAC_CONST(0.73369743811466026),
+ FRAC_CONST(0.73577858916571348),
+ FRAC_CONST(0.73785281478846598),
+ FRAC_CONST(0.73992009545951609),
+ FRAC_CONST(0.74198041172083096),
+ FRAC_CONST(0.74403374417992918),
+ FRAC_CONST(0.74608007351006378),
+ FRAC_CONST(0.74811938045040349),
+ FRAC_CONST(0.75015164580621496),
+ FRAC_CONST(0.7521768504490427),
+ FRAC_CONST(0.75419497531688917),
+ FRAC_CONST(0.75620600141439454),
+ FRAC_CONST(0.75820990981301528),
+ FRAC_CONST(0.76020668165120242),
+ FRAC_CONST(0.7621962981345789),
+ FRAC_CONST(0.76417874053611667),
+ FRAC_CONST(0.76615399019631281),
+ FRAC_CONST(0.76812202852336531),
+ FRAC_CONST(0.7700828369933479),
+ FRAC_CONST(0.77203639715038441),
+ FRAC_CONST(0.77398269060682279),
+ FRAC_CONST(0.77592169904340758),
+ FRAC_CONST(0.77785340420945304),
+ FRAC_CONST(0.77977778792301444),
+ FRAC_CONST(0.78169483207105939),
+ FRAC_CONST(0.7836045186096382),
+ FRAC_CONST(0.78550682956405393),
+ FRAC_CONST(0.78740174702903132),
+ FRAC_CONST(0.78928925316888565),
+ FRAC_CONST(0.79116933021769009),
+ FRAC_CONST(0.79304196047944364),
+ FRAC_CONST(0.79490712632823701),
+ FRAC_CONST(0.79676481020841872),
+ FRAC_CONST(0.79861499463476082),
+ FRAC_CONST(0.80045766219262271),
+ FRAC_CONST(0.80229279553811572),
+ FRAC_CONST(0.8041203773982657),
+ FRAC_CONST(0.80594039057117628),
+ FRAC_CONST(0.80775281792619036),
+ FRAC_CONST(0.80955764240405126),
+ FRAC_CONST(0.81135484701706373),
+ FRAC_CONST(0.81314441484925359),
+ FRAC_CONST(0.81492632905652662),
+ FRAC_CONST(0.81670057286682785),
+ FRAC_CONST(0.81846712958029866),
+ FRAC_CONST(0.82022598256943469),
+ FRAC_CONST(0.82197711527924155),
+ FRAC_CONST(0.82372051122739132),
+ FRAC_CONST(0.82545615400437744),
+ FRAC_CONST(0.82718402727366902),
+ FRAC_CONST(0.82890411477186487),
+ FRAC_CONST(0.8306164003088462),
+ FRAC_CONST(0.83232086776792968),
+ FRAC_CONST(0.83401750110601813),
+ FRAC_CONST(0.8357062843537526),
+ FRAC_CONST(0.83738720161566194),
+ FRAC_CONST(0.83906023707031263),
+ FRAC_CONST(0.84072537497045807),
+ FRAC_CONST(0.84238259964318596),
+ FRAC_CONST(0.84403189549006641),
+ FRAC_CONST(0.84567324698729907),
+ FRAC_CONST(0.84730663868585832),
+ FRAC_CONST(0.84893205521163961),
+ FRAC_CONST(0.85054948126560337),
+ FRAC_CONST(0.85215890162391983),
+ FRAC_CONST(0.8537603011381113),
+ FRAC_CONST(0.85535366473519603),
+ FRAC_CONST(0.85693897741782865),
+ FRAC_CONST(0.85851622426444274),
+ FRAC_CONST(0.86008539042939014),
+ FRAC_CONST(0.8616464611430813),
+ FRAC_CONST(0.86319942171212416),
+ FRAC_CONST(0.86474425751946238),
+ FRAC_CONST(0.86628095402451299),
+ FRAC_CONST(0.86780949676330321),
+ FRAC_CONST(0.86932987134860673),
+ FRAC_CONST(0.87084206347007886),
+ FRAC_CONST(0.87234605889439154),
+ FRAC_CONST(0.87384184346536675),
+ FRAC_CONST(0.87532940310411078),
+ FRAC_CONST(0.87680872380914576),
+ FRAC_CONST(0.87827979165654146),
+ FRAC_CONST(0.87974259280004741),
+ FRAC_CONST(0.88119711347122198),
+ FRAC_CONST(0.88264333997956279),
+ FRAC_CONST(0.88408125871263499),
+ FRAC_CONST(0.88551085613619995),
+ FRAC_CONST(0.88693211879434208),
+ FRAC_CONST(0.88834503330959624),
+ FRAC_CONST(0.88974958638307289),
+ FRAC_CONST(0.89114576479458318),
+ FRAC_CONST(0.89253355540276469),
+ FRAC_CONST(0.89391294514520325),
+ FRAC_CONST(0.89528392103855758),
+ FRAC_CONST(0.89664647017868015),
+ FRAC_CONST(0.89800057974073988),
+ FRAC_CONST(0.89934623697934146),
+ FRAC_CONST(0.90068342922864686),
+ FRAC_CONST(0.90201214390249307),
+ FRAC_CONST(0.90333236849451182),
+ FRAC_CONST(0.90464409057824624),
+ FRAC_CONST(0.90594729780726846),
+ FRAC_CONST(0.90724197791529593),
+ FRAC_CONST(0.90852811871630612),
+ FRAC_CONST(0.90980570810465222),
+ FRAC_CONST(0.91107473405517625),
+ FRAC_CONST(0.91233518462332275),
+ FRAC_CONST(0.91358704794525081),
+ FRAC_CONST(0.91483031223794609),
+ FRAC_CONST(0.91606496579933161),
+ FRAC_CONST(0.91729099700837791),
+ FRAC_CONST(0.91850839432521225),
+ FRAC_CONST(0.91971714629122736),
+ FRAC_CONST(0.92091724152918952),
+ FRAC_CONST(0.92210866874334507),
+ FRAC_CONST(0.92329141671952764),
+ FRAC_CONST(0.9244654743252626),
+ FRAC_CONST(0.92563083050987272),
+ FRAC_CONST(0.92678747430458175),
+ FRAC_CONST(0.92793539482261789),
+ FRAC_CONST(0.92907458125931575),
+ FRAC_CONST(0.93020502289221907),
+ FRAC_CONST(0.93132670908118043),
+ FRAC_CONST(0.93243962926846236),
+ FRAC_CONST(0.93354377297883617),
+ FRAC_CONST(0.93463912981968078),
+ FRAC_CONST(0.93572568948108037),
+ FRAC_CONST(0.93680344173592156),
+ FRAC_CONST(0.93787237643998989),
+ FRAC_CONST(0.93893248353206449),
+ FRAC_CONST(0.93998375303401394),
+ FRAC_CONST(0.94102617505088926),
+ FRAC_CONST(0.94205973977101731),
+ FRAC_CONST(0.94308443746609349),
+ FRAC_CONST(0.94410025849127266),
+ FRAC_CONST(0.94510719328526061),
+ FRAC_CONST(0.94610523237040334),
+ FRAC_CONST(0.94709436635277722),
+ FRAC_CONST(0.94807458592227623),
+ FRAC_CONST(0.94904588185270056),
+ FRAC_CONST(0.950008245001843),
+ FRAC_CONST(0.95096166631157508),
+ FRAC_CONST(0.95190613680793223),
+ FRAC_CONST(0.95284164760119872),
+ FRAC_CONST(0.95376818988599033),
+ FRAC_CONST(0.95468575494133834),
+ FRAC_CONST(0.95559433413077111),
+ FRAC_CONST(0.95649391890239499),
+ FRAC_CONST(0.95738450078897586),
+ FRAC_CONST(0.95826607140801767),
+ FRAC_CONST(0.95913862246184189),
+ FRAC_CONST(0.96000214573766585),
+ FRAC_CONST(0.96085663310767966),
+ FRAC_CONST(0.96170207652912254),
+ FRAC_CONST(0.96253846804435916),
+ FRAC_CONST(0.96336579978095405),
+ FRAC_CONST(0.96418406395174572),
+ FRAC_CONST(0.96499325285492032),
+ FRAC_CONST(0.96579335887408357),
+ FRAC_CONST(0.96658437447833312),
+ FRAC_CONST(0.96736629222232851),
+ FRAC_CONST(0.96813910474636233),
+ FRAC_CONST(0.96890280477642887),
+ FRAC_CONST(0.96965738512429245),
+ FRAC_CONST(0.9704028386875555),
+ FRAC_CONST(0.97113915844972509),
+ FRAC_CONST(0.9718663374802794),
+ FRAC_CONST(0.97258436893473221),
+ FRAC_CONST(0.97329324605469825),
+ FRAC_CONST(0.97399296216795583),
+ FRAC_CONST(0.97468351068851067),
+ FRAC_CONST(0.97536488511665687),
+ FRAC_CONST(0.97603707903903902),
+ FRAC_CONST(0.97670008612871184),
+ FRAC_CONST(0.97735390014519996),
+ FRAC_CONST(0.97799851493455714),
+ FRAC_CONST(0.9786339244294231),
+ FRAC_CONST(0.97926012264908202),
+ FRAC_CONST(0.97987710369951764),
+ FRAC_CONST(0.98048486177346938),
+ FRAC_CONST(0.98108339115048659),
+ FRAC_CONST(0.98167268619698311),
+ FRAC_CONST(0.98225274136628937),
+ FRAC_CONST(0.98282355119870524),
+ FRAC_CONST(0.98338511032155118),
+ FRAC_CONST(0.98393741344921892),
+ FRAC_CONST(0.98448045538322093),
+ FRAC_CONST(0.98501423101223984),
+ FRAC_CONST(0.98553873531217606),
+ FRAC_CONST(0.98605396334619544),
+ FRAC_CONST(0.98655991026477541),
+ FRAC_CONST(0.98705657130575097),
+ FRAC_CONST(0.98754394179435923),
+ FRAC_CONST(0.98802201714328353),
+ FRAC_CONST(0.98849079285269659),
+ FRAC_CONST(0.98895026451030299),
+ FRAC_CONST(0.98940042779138038),
+ FRAC_CONST(0.98984127845882053),
+ FRAC_CONST(0.99027281236316911),
+ FRAC_CONST(0.99069502544266463),
+ FRAC_CONST(0.99110791372327678),
+ FRAC_CONST(0.9915114733187439),
+ FRAC_CONST(0.99190570043060933),
+ FRAC_CONST(0.99229059134825737),
+ FRAC_CONST(0.99266614244894802),
+ FRAC_CONST(0.99303235019785141),
+ FRAC_CONST(0.99338921114808065),
+ FRAC_CONST(0.9937367219407246),
+ FRAC_CONST(0.99407487930487937),
+ FRAC_CONST(0.9944036800576791),
+ FRAC_CONST(0.9947231211043257),
+ FRAC_CONST(0.99503319943811863),
+ FRAC_CONST(0.99533391214048228),
+ FRAC_CONST(0.99562525638099431),
+ FRAC_CONST(0.99590722941741172),
+ FRAC_CONST(0.99617982859569687),
+ FRAC_CONST(0.99644305135004263),
+ FRAC_CONST(0.99669689520289606),
+ FRAC_CONST(0.99694135776498216),
+ FRAC_CONST(0.99717643673532619),
+ FRAC_CONST(0.9974021299012753),
+ FRAC_CONST(0.99761843513851955),
+ FRAC_CONST(0.99782535041111164),
+ FRAC_CONST(0.99802287377148624),
+ FRAC_CONST(0.99821100336047819),
+ FRAC_CONST(0.99838973740734016),
+ FRAC_CONST(0.99855907422975931),
+ FRAC_CONST(0.99871901223387294),
+ FRAC_CONST(0.99886954991428356),
+ FRAC_CONST(0.99901068585407338),
+ FRAC_CONST(0.99914241872481691),
+ FRAC_CONST(0.99926474728659442),
+ FRAC_CONST(0.99937767038800285),
+ FRAC_CONST(0.99948118696616695),
+ FRAC_CONST(0.99957529604674922),
+ FRAC_CONST(0.99965999674395922),
+ FRAC_CONST(0.99973528826056168),
+ FRAC_CONST(0.99980116988788426),
+ FRAC_CONST(0.99985764100582386),
+ FRAC_CONST(0.9999047010828529),
+ FRAC_CONST(0.99994234967602391),
+ FRAC_CONST(0.99997058643097414),
+ FRAC_CONST(0.9999894110819284),
+ FRAC_CONST(0.99999882345170188)
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const real_t sine_mid_480[] =
- {
- FRAC_CONST(0.0016362454436240478),
- FRAC_CONST(0.00490871880799799),
- FRAC_CONST(0.0081811396039371282),
- FRAC_CONST(0.011453472786443779),
- FRAC_CONST(0.014725683311458524),
- FRAC_CONST(0.017997736136235509),
- FRAC_CONST(0.021269596219717739),
- FRAC_CONST(0.024541228522912285),
- FRAC_CONST(0.027812598009265607),
- FRAC_CONST(0.03108366964503869),
- FRAC_CONST(0.034354408399682276),
- FRAC_CONST(0.037624779246211978),
- FRAC_CONST(0.04089474716158345),
- FRAC_CONST(0.044164277127067358),
- FRAC_CONST(0.047433334128624507),
- FRAC_CONST(0.050701883157280733),
- FRAC_CONST(0.053969889209501881),
- FRAC_CONST(0.057237317287568618),
- FRAC_CONST(0.060504132399951269),
- FRAC_CONST(0.063770299561684493),
- FRAC_CONST(0.06703578379474201),
- FRAC_CONST(0.070300550128411174),
- FRAC_CONST(0.073564563599667426),
- FRAC_CONST(0.076827789253548759),
- FRAC_CONST(0.080090192143530081),
- FRAC_CONST(0.083351737331897449),
- FRAC_CONST(0.086612389890122182),
- FRAC_CONST(0.089872114899234967),
- FRAC_CONST(0.093130877450199795),
- FRAC_CONST(0.096388642644287828),
- FRAC_CONST(0.09964537559345106),
- FRAC_CONST(0.1029010414206961),
- FRAC_CONST(0.10615560526045748),
- FRAC_CONST(0.10940903225897117),
- FRAC_CONST(0.11266128757464781),
- FRAC_CONST(0.11591233637844581),
- FRAC_CONST(0.11916214385424433),
- FRAC_CONST(0.1224106751992162),
- FRAC_CONST(0.12565789562420052),
- FRAC_CONST(0.12890377035407541),
- FRAC_CONST(0.13214826462813015),
- FRAC_CONST(0.13539134370043773),
- FRAC_CONST(0.13863297284022669),
- FRAC_CONST(0.14187311733225325),
- FRAC_CONST(0.14511174247717309),
- FRAC_CONST(0.14834881359191271),
- FRAC_CONST(0.15158429601004111),
- FRAC_CONST(0.15481815508214106),
- FRAC_CONST(0.1580503561761798),
- FRAC_CONST(0.16128086467788047),
- FRAC_CONST(0.16450964599109233),
- FRAC_CONST(0.16773666553816149),
- FRAC_CONST(0.17096188876030122),
- FRAC_CONST(0.17418528111796186),
- FRAC_CONST(0.17740680809120093),
- FRAC_CONST(0.18062643518005275),
- FRAC_CONST(0.18384412790489776),
- FRAC_CONST(0.18705985180683199),
- FRAC_CONST(0.19027357244803589),
- FRAC_CONST(0.19348525541214331),
- FRAC_CONST(0.19669486630460997),
- FRAC_CONST(0.19990237075308173),
- FRAC_CONST(0.20310773440776286),
- FRAC_CONST(0.20631092294178383),
- FRAC_CONST(0.20951190205156878),
- FRAC_CONST(0.21271063745720317),
- FRAC_CONST(0.21590709490280058),
- FRAC_CONST(0.2191012401568698),
- FRAC_CONST(0.22229303901268133),
- FRAC_CONST(0.22548245728863364),
- FRAC_CONST(0.22866946082861941),
- FRAC_CONST(0.23185401550239115),
- FRAC_CONST(0.23503608720592667),
- FRAC_CONST(0.23821564186179459),
- FRAC_CONST(0.24139264541951888),
- FRAC_CONST(0.24456706385594387),
- FRAC_CONST(0.24773886317559846),
- FRAC_CONST(0.25090800941106001),
- FRAC_CONST(0.25407446862331851),
- FRAC_CONST(0.25723820690213967),
- FRAC_CONST(0.26039919036642817),
- FRAC_CONST(0.26355738516459076),
- FRAC_CONST(0.26671275747489837),
- FRAC_CONST(0.2698652735058486),
- FRAC_CONST(0.27301489949652735),
- FRAC_CONST(0.27616160171697068),
- FRAC_CONST(0.27930534646852595),
- FRAC_CONST(0.28244610008421245),
- FRAC_CONST(0.2855838289290823),
- FRAC_CONST(0.28871849940058025),
- FRAC_CONST(0.29185007792890405),
- FRAC_CONST(0.29497853097736348),
- FRAC_CONST(0.2981038250427398),
- FRAC_CONST(0.30122592665564446),
- FRAC_CONST(0.30434480238087736),
- FRAC_CONST(0.30746041881778519),
- FRAC_CONST(0.31057274260061901),
- FRAC_CONST(0.31368174039889146),
- FRAC_CONST(0.31678737891773395),
- FRAC_CONST(0.31988962489825296),
- FRAC_CONST(0.32298844511788638),
- FRAC_CONST(0.32608380639075912),
- FRAC_CONST(0.32917567556803889),
- FRAC_CONST(0.33226401953829071),
- FRAC_CONST(0.33534880522783189),
- FRAC_CONST(0.33842999960108583),
- FRAC_CONST(0.34150756966093632),
- FRAC_CONST(0.34458148244908043),
- FRAC_CONST(0.34765170504638188),
- FRAC_CONST(0.35071820457322322),
- FRAC_CONST(0.35378094818985806),
- FRAC_CONST(0.35683990309676283),
- FRAC_CONST(0.35989503653498811),
- FRAC_CONST(0.36294631578650921),
- FRAC_CONST(0.36599370817457672),
- FRAC_CONST(0.36903718106406647),
- FRAC_CONST(0.37207670186182878),
- FRAC_CONST(0.37511223801703802),
- FRAC_CONST(0.37814375702154046),
- FRAC_CONST(0.38117122641020335),
- FRAC_CONST(0.38419461376126157),
- FRAC_CONST(0.38721388669666562),
- FRAC_CONST(0.39022901288242801),
- FRAC_CONST(0.39323996002896966),
- FRAC_CONST(0.39624669589146555),
- FRAC_CONST(0.39924918827019029),
- FRAC_CONST(0.40224740501086254),
- FRAC_CONST(0.40524131400498986),
- FRAC_CONST(0.40823088319021217),
- FRAC_CONST(0.41121608055064529),
- FRAC_CONST(0.41419687411722372),
- FRAC_CONST(0.41717323196804335),
- FRAC_CONST(0.42014512222870243),
- FRAC_CONST(0.42311251307264408),
- FRAC_CONST(0.42607537272149631),
- FRAC_CONST(0.4290336694454126),
- FRAC_CONST(0.43198737156341183),
- FRAC_CONST(0.43493644744371707),
- FRAC_CONST(0.43788086550409511),
- FRAC_CONST(0.44082059421219388),
- FRAC_CONST(0.44375560208588088),
- FRAC_CONST(0.44668585769357955),
- FRAC_CONST(0.4496113296546066),
- FRAC_CONST(0.45253198663950756),
- FRAC_CONST(0.45544779737039259),
- FRAC_CONST(0.45835873062127125),
- FRAC_CONST(0.46126475521838717),
- FRAC_CONST(0.46416584004055156),
- FRAC_CONST(0.46706195401947659),
- FRAC_CONST(0.46995306614010829),
- FRAC_CONST(0.47283914544095862),
- FRAC_CONST(0.47572016101443682),
- FRAC_CONST(0.47859608200718085),
- FRAC_CONST(0.4814668776203872),
- FRAC_CONST(0.48433251711014125),
- FRAC_CONST(0.4871929697877464),
- FRAC_CONST(0.49004820502005247),
- FRAC_CONST(0.49289819222978404),
- FRAC_CONST(0.49574290089586776),
- FRAC_CONST(0.49858230055375902),
- FRAC_CONST(0.50141636079576901),
- FRAC_CONST(0.50424505127138919),
- FRAC_CONST(0.50706834168761705),
- FRAC_CONST(0.50988620180928057),
- FRAC_CONST(0.51269860145936175),
- FRAC_CONST(0.51550551051931948),
- FRAC_CONST(0.51830689892941317),
- FRAC_CONST(0.5211027366890234),
- FRAC_CONST(0.52389299385697385),
- FRAC_CONST(0.52667764055185196),
- FRAC_CONST(0.52945664695232897),
- FRAC_CONST(0.53222998329747884),
- FRAC_CONST(0.53499761988709726),
- FRAC_CONST(0.53775952708201991),
- FRAC_CONST(0.54051567530443978),
- FRAC_CONST(0.54326603503822357),
- FRAC_CONST(0.54601057682922816),
- FRAC_CONST(0.54874927128561579),
- FRAC_CONST(0.55148208907816942),
- FRAC_CONST(0.55420900094060566),
- FRAC_CONST(0.55692997766988939),
- FRAC_CONST(0.559644990126546),
- FRAC_CONST(0.56235400923497314),
- FRAC_CONST(0.56505700598375252),
- FRAC_CONST(0.56775395142596052),
- FRAC_CONST(0.57044481667947822),
- FRAC_CONST(0.57312957292730071),
- FRAC_CONST(0.57580819141784534),
- FRAC_CONST(0.57848064346525996),
- FRAC_CONST(0.58114690044973039),
- FRAC_CONST(0.58380693381778626),
- FRAC_CONST(0.58646071508260733),
- FRAC_CONST(0.58910821582432815),
- FRAC_CONST(0.5917494076903429),
- FRAC_CONST(0.5943842623956086),
- FRAC_CONST(0.59701275172294799),
- FRAC_CONST(0.59963484752335228),
- FRAC_CONST(0.60225052171628191),
- FRAC_CONST(0.60485974628996786),
- FRAC_CONST(0.60746249330171098),
- FRAC_CONST(0.61005873487818185),
- FRAC_CONST(0.61264844321571899),
- FRAC_CONST(0.61523159058062682),
- FRAC_CONST(0.61780814930947225),
- FRAC_CONST(0.62037809180938108),
- FRAC_CONST(0.62294139055833397),
- FRAC_CONST(0.6254980181054608),
- FRAC_CONST(0.62804794707133416),
- FRAC_CONST(0.63059115014826372),
- FRAC_CONST(0.63312760010058777),
- FRAC_CONST(0.63565726976496484),
- FRAC_CONST(0.63818013205066515),
- FRAC_CONST(0.64069615993986073),
- FRAC_CONST(0.64320532648791406),
- FRAC_CONST(0.64570760482366729),
- FRAC_CONST(0.64820296814972966),
- FRAC_CONST(0.65069138974276486),
- FRAC_CONST(0.65317284295377676),
- FRAC_CONST(0.65564730120839498),
- FRAC_CONST(0.65811473800715958),
- FRAC_CONST(0.660575126925805),
- FRAC_CONST(0.66302844161554231),
- FRAC_CONST(0.6654746558033422),
- FRAC_CONST(0.66791374329221598),
- FRAC_CONST(0.67034567796149647),
- FRAC_CONST(0.67277043376711676),
- FRAC_CONST(0.67518798474189046),
- FRAC_CONST(0.67759830499578866),
- FRAC_CONST(0.68000136871621808),
- FRAC_CONST(0.68239715016829683),
- FRAC_CONST(0.6847856236951303),
- FRAC_CONST(0.68716676371808583),
- FRAC_CONST(0.68954054473706683),
- FRAC_CONST(0.69190694133078579),
- FRAC_CONST(0.69426592815703603),
- FRAC_CONST(0.69661747995296419),
- FRAC_CONST(0.69896157153533944),
- FRAC_CONST(0.70129817780082437),
- FRAC_CONST(0.7036272737262429),
- FRAC_CONST(0.70594883436884903),
- FRAC_CONST(0.70826283486659336),
- FRAC_CONST(0.71056925043838959),
- FRAC_CONST(0.71286805638437978),
- FRAC_CONST(0.71515922808619936),
- FRAC_CONST(0.71744274100723993),
- FRAC_CONST(0.71971857069291278),
- FRAC_CONST(0.7219866927709101),
- FRAC_CONST(0.72424708295146689),
- FRAC_CONST(0.72649971702762028),
- FRAC_CONST(0.72874457087546896),
- FRAC_CONST(0.73098162045443171),
- FRAC_CONST(0.73321084180750484),
- FRAC_CONST(0.73543221106151868),
- FRAC_CONST(0.73764570442739286),
- FRAC_CONST(0.73985129820039208),
- FRAC_CONST(0.74204896876037885),
- FRAC_CONST(0.7442386925720671),
- FRAC_CONST(0.74642044618527381),
- FRAC_CONST(0.74859420623517081),
- FRAC_CONST(0.75075994944253421),
- FRAC_CONST(0.75291765261399446),
- FRAC_CONST(0.75506729264228367),
- FRAC_CONST(0.75720884650648446),
- FRAC_CONST(0.75934229127227548),
- FRAC_CONST(0.76146760409217706),
- FRAC_CONST(0.76358476220579641),
- FRAC_CONST(0.7656937429400712),
- FRAC_CONST(0.76779452370951196),
- FRAC_CONST(0.76988708201644451),
- FRAC_CONST(0.77197139545125026),
- FRAC_CONST(0.7740474416926072),
- FRAC_CONST(0.77611519850772781),
- FRAC_CONST(0.77817464375259782),
- FRAC_CONST(0.78022575537221317),
- FRAC_CONST(0.78226851140081632),
- FRAC_CONST(0.78430288996213138),
- FRAC_CONST(0.78632886926959822),
- FRAC_CONST(0.78834642762660623),
- FRAC_CONST(0.79035554342672631),
- FRAC_CONST(0.79235619515394229),
- FRAC_CONST(0.79434836138288134),
- FRAC_CONST(0.79633202077904397),
- FRAC_CONST(0.79830715209903147),
- FRAC_CONST(0.8002737341907743),
- FRAC_CONST(0.80223174599375802),
- FRAC_CONST(0.80418116653924954),
- FRAC_CONST(0.80612197495052085),
- FRAC_CONST(0.80805415044307316),
- FRAC_CONST(0.80997767232485907),
- FRAC_CONST(0.81189251999650469),
- FRAC_CONST(0.81379867295152986),
- FRAC_CONST(0.81569611077656778),
- FRAC_CONST(0.81758481315158371),
- FRAC_CONST(0.81946475985009259),
- FRAC_CONST(0.82133593073937561),
- FRAC_CONST(0.82319830578069586),
- FRAC_CONST(0.82505186502951278),
- FRAC_CONST(0.82689658863569615),
- FRAC_CONST(0.82873245684373809),
- FRAC_CONST(0.83055944999296494),
- FRAC_CONST(0.83237754851774781),
- FRAC_CONST(0.83418673294771239),
- FRAC_CONST(0.83598698390794668),
- FRAC_CONST(0.83777828211920935),
- FRAC_CONST(0.83956060839813562),
- FRAC_CONST(0.84133394365744296),
- FRAC_CONST(0.84309826890613537),
- FRAC_CONST(0.84485356524970701),
- FRAC_CONST(0.84659981389034411),
- FRAC_CONST(0.84833699612712676),
- FRAC_CONST(0.85006509335622882),
- FRAC_CONST(0.8517840870711173),
- FRAC_CONST(0.85349395886275037),
- FRAC_CONST(0.85519469041977514),
- FRAC_CONST(0.85688626352872277),
- FRAC_CONST(0.85856866007420429),
- FRAC_CONST(0.86024186203910447),
- FRAC_CONST(0.86190585150477417),
- FRAC_CONST(0.86356061065122347),
- FRAC_CONST(0.86520612175731115),
- FRAC_CONST(0.86684236720093533),
- FRAC_CONST(0.86846932945922151),
- FRAC_CONST(0.87008699110871135),
- FRAC_CONST(0.87169533482554817),
- FRAC_CONST(0.87329434338566281),
- FRAC_CONST(0.87488399966495822),
- FRAC_CONST(0.87646428663949283),
- FRAC_CONST(0.87803518738566277),
- FRAC_CONST(0.87959668508038291),
- FRAC_CONST(0.88114876300126743),
- FRAC_CONST(0.88269140452680916),
- FRAC_CONST(0.8842245931365561),
- FRAC_CONST(0.88574831241129048),
- FRAC_CONST(0.88726254603320276),
- FRAC_CONST(0.88876727778606746),
- FRAC_CONST(0.89026249155541637),
- FRAC_CONST(0.8917481713287112),
- FRAC_CONST(0.89322430119551532),
- FRAC_CONST(0.89469086534766362),
- FRAC_CONST(0.89614784807943237),
- FRAC_CONST(0.89759523378770689),
- FRAC_CONST(0.89903300697214927),
- FRAC_CONST(0.9004611522353636),
- FRAC_CONST(0.90187965428306172),
- FRAC_CONST(0.90328849792422594),
- FRAC_CONST(0.90468766807127299),
- FRAC_CONST(0.90607714974021469),
- FRAC_CONST(0.90745692805081868),
- FRAC_CONST(0.90882698822676755),
- FRAC_CONST(0.91018731559581767),
- FRAC_CONST(0.91153789558995579),
- FRAC_CONST(0.91287871374555518),
- FRAC_CONST(0.91420975570353069),
- FRAC_CONST(0.9155310072094921),
- FRAC_CONST(0.91684245411389753),
- FRAC_CONST(0.91814408237220391),
- FRAC_CONST(0.91943587804501858),
- FRAC_CONST(0.92071782729824769),
- FRAC_CONST(0.92198991640324446),
- FRAC_CONST(0.92325213173695675),
- FRAC_CONST(0.92450445978207241),
- FRAC_CONST(0.92574688712716402),
- FRAC_CONST(0.92697940046683291),
- FRAC_CONST(0.92820198660185149),
- FRAC_CONST(0.92941463243930444),
- FRAC_CONST(0.93061732499272909),
- FRAC_CONST(0.93181005138225426),
- FRAC_CONST(0.93299279883473885),
- FRAC_CONST(0.93416555468390772),
- FRAC_CONST(0.93532830637048769),
- FRAC_CONST(0.93648104144234268),
- FRAC_CONST(0.93762374755460598),
- FRAC_CONST(0.93875641246981323),
- FRAC_CONST(0.93987902405803303),
- FRAC_CONST(0.94099157029699743),
- FRAC_CONST(0.94209403927222979),
- FRAC_CONST(0.94318641917717327),
- FRAC_CONST(0.9442686983133165),
- FRAC_CONST(0.94534086509031956),
- FRAC_CONST(0.9464029080261378),
- FRAC_CONST(0.94745481574714419),
- FRAC_CONST(0.94849657698825252),
- FRAC_CONST(0.94952818059303667),
- FRAC_CONST(0.95054961551385087),
- FRAC_CONST(0.95156087081194762),
- FRAC_CONST(0.95256193565759528),
- FRAC_CONST(0.95355279933019343),
- FRAC_CONST(0.9545334512183884),
- FRAC_CONST(0.95550388082018611),
- FRAC_CONST(0.95646407774306541),
- FRAC_CONST(0.95741403170408834),
- FRAC_CONST(0.95835373253001133),
- FRAC_CONST(0.95928317015739362),
- FRAC_CONST(0.96020233463270466),
- FRAC_CONST(0.96111121611243155),
- FRAC_CONST(0.96200980486318388),
- FRAC_CONST(0.96289809126179782),
- FRAC_CONST(0.96377606579543984),
- FRAC_CONST(0.96464371906170809),
- FRAC_CONST(0.96550104176873297),
- FRAC_CONST(0.96634802473527726),
- FRAC_CONST(0.96718465889083372),
- FRAC_CONST(0.96801093527572268),
- FRAC_CONST(0.96882684504118799),
- FRAC_CONST(0.96963237944949143),
- FRAC_CONST(0.97042752987400682),
- FRAC_CONST(0.97121228779931179),
- FRAC_CONST(0.97198664482127939),
- FRAC_CONST(0.97275059264716823),
- FRAC_CONST(0.97350412309571066),
- FRAC_CONST(0.97424722809720088),
- FRAC_CONST(0.97497989969358168),
- FRAC_CONST(0.97570213003852857),
- FRAC_CONST(0.97641391139753486),
- FRAC_CONST(0.97711523614799412),
- FRAC_CONST(0.97780609677928154),
- FRAC_CONST(0.97848648589283505),
- FRAC_CONST(0.97915639620223371),
- FRAC_CONST(0.9798158205332762),
- FRAC_CONST(0.98046475182405801),
- FRAC_CONST(0.98110318312504607),
- FRAC_CONST(0.98173110759915416),
- FRAC_CONST(0.98234851852181571),
- FRAC_CONST(0.98295540928105563),
- FRAC_CONST(0.9835517733775615),
- FRAC_CONST(0.98413760442475307),
- FRAC_CONST(0.98471289614885038),
- FRAC_CONST(0.98527764238894122),
- FRAC_CONST(0.98583183709704714),
- FRAC_CONST(0.98637547433818806),
- FRAC_CONST(0.98690854829044583),
- FRAC_CONST(0.98743105324502667),
- FRAC_CONST(0.98794298360632238),
- FRAC_CONST(0.98844433389196995),
- FRAC_CONST(0.98893509873291074),
- FRAC_CONST(0.98941527287344755),
- FRAC_CONST(0.98988485117130098),
- FRAC_CONST(0.99034382859766479),
- FRAC_CONST(0.99079220023725967),
- FRAC_CONST(0.99122996128838525),
- FRAC_CONST(0.9916571070629725),
- FRAC_CONST(0.99207363298663342),
- FRAC_CONST(0.99247953459870997),
- FRAC_CONST(0.99287480755232194),
- FRAC_CONST(0.99325944761441354),
- FRAC_CONST(0.99363345066579889),
- FRAC_CONST(0.99399681270120555),
- FRAC_CONST(0.99434952982931812),
- FRAC_CONST(0.9946915982728195),
- FRAC_CONST(0.99502301436843166),
- FRAC_CONST(0.99534377456695422),
- FRAC_CONST(0.9956538754333033),
- FRAC_CONST(0.99595331364654771),
- FRAC_CONST(0.99624208599994479),
- FRAC_CONST(0.99652018940097464),
- FRAC_CONST(0.99678762087137318),
- FRAC_CONST(0.99704437754716424),
- FRAC_CONST(0.99729045667869021),
- FRAC_CONST(0.99752585563064111),
- FRAC_CONST(0.99775057188208349),
- FRAC_CONST(0.9979646030264866),
- FRAC_CONST(0.99816794677174903),
- FRAC_CONST(0.9983606009402225),
- FRAC_CONST(0.99854256346873571),
- FRAC_CONST(0.99871383240861611),
- FRAC_CONST(0.99887440592571108),
- FRAC_CONST(0.99902428230040718),
- FRAC_CONST(0.99916345992764877),
- FRAC_CONST(0.99929193731695531),
- FRAC_CONST(0.99940971309243731),
- FRAC_CONST(0.99951678599281069),
- FRAC_CONST(0.99961315487141078),
- FRAC_CONST(0.99969881869620425),
- FRAC_CONST(0.99977377654980037),
- FRAC_CONST(0.99983802762946083),
- FRAC_CONST(0.99989157124710804),
- FRAC_CONST(0.9999344068293331),
- FRAC_CONST(0.99996653391740109),
- FRAC_CONST(0.99998795216725689),
- FRAC_CONST(0.99999866134952808)
- };
+ALIGN static const real_t sine_mid_480[] =
+{
+ FRAC_CONST(0.0016362454436240478),
+ FRAC_CONST(0.00490871880799799),
+ FRAC_CONST(0.0081811396039371282),
+ FRAC_CONST(0.011453472786443779),
+ FRAC_CONST(0.014725683311458524),
+ FRAC_CONST(0.017997736136235509),
+ FRAC_CONST(0.021269596219717739),
+ FRAC_CONST(0.024541228522912285),
+ FRAC_CONST(0.027812598009265607),
+ FRAC_CONST(0.03108366964503869),
+ FRAC_CONST(0.034354408399682276),
+ FRAC_CONST(0.037624779246211978),
+ FRAC_CONST(0.04089474716158345),
+ FRAC_CONST(0.044164277127067358),
+ FRAC_CONST(0.047433334128624507),
+ FRAC_CONST(0.050701883157280733),
+ FRAC_CONST(0.053969889209501881),
+ FRAC_CONST(0.057237317287568618),
+ FRAC_CONST(0.060504132399951269),
+ FRAC_CONST(0.063770299561684493),
+ FRAC_CONST(0.06703578379474201),
+ FRAC_CONST(0.070300550128411174),
+ FRAC_CONST(0.073564563599667426),
+ FRAC_CONST(0.076827789253548759),
+ FRAC_CONST(0.080090192143530081),
+ FRAC_CONST(0.083351737331897449),
+ FRAC_CONST(0.086612389890122182),
+ FRAC_CONST(0.089872114899234967),
+ FRAC_CONST(0.093130877450199795),
+ FRAC_CONST(0.096388642644287828),
+ FRAC_CONST(0.09964537559345106),
+ FRAC_CONST(0.1029010414206961),
+ FRAC_CONST(0.10615560526045748),
+ FRAC_CONST(0.10940903225897117),
+ FRAC_CONST(0.11266128757464781),
+ FRAC_CONST(0.11591233637844581),
+ FRAC_CONST(0.11916214385424433),
+ FRAC_CONST(0.1224106751992162),
+ FRAC_CONST(0.12565789562420052),
+ FRAC_CONST(0.12890377035407541),
+ FRAC_CONST(0.13214826462813015),
+ FRAC_CONST(0.13539134370043773),
+ FRAC_CONST(0.13863297284022669),
+ FRAC_CONST(0.14187311733225325),
+ FRAC_CONST(0.14511174247717309),
+ FRAC_CONST(0.14834881359191271),
+ FRAC_CONST(0.15158429601004111),
+ FRAC_CONST(0.15481815508214106),
+ FRAC_CONST(0.1580503561761798),
+ FRAC_CONST(0.16128086467788047),
+ FRAC_CONST(0.16450964599109233),
+ FRAC_CONST(0.16773666553816149),
+ FRAC_CONST(0.17096188876030122),
+ FRAC_CONST(0.17418528111796186),
+ FRAC_CONST(0.17740680809120093),
+ FRAC_CONST(0.18062643518005275),
+ FRAC_CONST(0.18384412790489776),
+ FRAC_CONST(0.18705985180683199),
+ FRAC_CONST(0.19027357244803589),
+ FRAC_CONST(0.19348525541214331),
+ FRAC_CONST(0.19669486630460997),
+ FRAC_CONST(0.19990237075308173),
+ FRAC_CONST(0.20310773440776286),
+ FRAC_CONST(0.20631092294178383),
+ FRAC_CONST(0.20951190205156878),
+ FRAC_CONST(0.21271063745720317),
+ FRAC_CONST(0.21590709490280058),
+ FRAC_CONST(0.2191012401568698),
+ FRAC_CONST(0.22229303901268133),
+ FRAC_CONST(0.22548245728863364),
+ FRAC_CONST(0.22866946082861941),
+ FRAC_CONST(0.23185401550239115),
+ FRAC_CONST(0.23503608720592667),
+ FRAC_CONST(0.23821564186179459),
+ FRAC_CONST(0.24139264541951888),
+ FRAC_CONST(0.24456706385594387),
+ FRAC_CONST(0.24773886317559846),
+ FRAC_CONST(0.25090800941106001),
+ FRAC_CONST(0.25407446862331851),
+ FRAC_CONST(0.25723820690213967),
+ FRAC_CONST(0.26039919036642817),
+ FRAC_CONST(0.26355738516459076),
+ FRAC_CONST(0.26671275747489837),
+ FRAC_CONST(0.2698652735058486),
+ FRAC_CONST(0.27301489949652735),
+ FRAC_CONST(0.27616160171697068),
+ FRAC_CONST(0.27930534646852595),
+ FRAC_CONST(0.28244610008421245),
+ FRAC_CONST(0.2855838289290823),
+ FRAC_CONST(0.28871849940058025),
+ FRAC_CONST(0.29185007792890405),
+ FRAC_CONST(0.29497853097736348),
+ FRAC_CONST(0.2981038250427398),
+ FRAC_CONST(0.30122592665564446),
+ FRAC_CONST(0.30434480238087736),
+ FRAC_CONST(0.30746041881778519),
+ FRAC_CONST(0.31057274260061901),
+ FRAC_CONST(0.31368174039889146),
+ FRAC_CONST(0.31678737891773395),
+ FRAC_CONST(0.31988962489825296),
+ FRAC_CONST(0.32298844511788638),
+ FRAC_CONST(0.32608380639075912),
+ FRAC_CONST(0.32917567556803889),
+ FRAC_CONST(0.33226401953829071),
+ FRAC_CONST(0.33534880522783189),
+ FRAC_CONST(0.33842999960108583),
+ FRAC_CONST(0.34150756966093632),
+ FRAC_CONST(0.34458148244908043),
+ FRAC_CONST(0.34765170504638188),
+ FRAC_CONST(0.35071820457322322),
+ FRAC_CONST(0.35378094818985806),
+ FRAC_CONST(0.35683990309676283),
+ FRAC_CONST(0.35989503653498811),
+ FRAC_CONST(0.36294631578650921),
+ FRAC_CONST(0.36599370817457672),
+ FRAC_CONST(0.36903718106406647),
+ FRAC_CONST(0.37207670186182878),
+ FRAC_CONST(0.37511223801703802),
+ FRAC_CONST(0.37814375702154046),
+ FRAC_CONST(0.38117122641020335),
+ FRAC_CONST(0.38419461376126157),
+ FRAC_CONST(0.38721388669666562),
+ FRAC_CONST(0.39022901288242801),
+ FRAC_CONST(0.39323996002896966),
+ FRAC_CONST(0.39624669589146555),
+ FRAC_CONST(0.39924918827019029),
+ FRAC_CONST(0.40224740501086254),
+ FRAC_CONST(0.40524131400498986),
+ FRAC_CONST(0.40823088319021217),
+ FRAC_CONST(0.41121608055064529),
+ FRAC_CONST(0.41419687411722372),
+ FRAC_CONST(0.41717323196804335),
+ FRAC_CONST(0.42014512222870243),
+ FRAC_CONST(0.42311251307264408),
+ FRAC_CONST(0.42607537272149631),
+ FRAC_CONST(0.4290336694454126),
+ FRAC_CONST(0.43198737156341183),
+ FRAC_CONST(0.43493644744371707),
+ FRAC_CONST(0.43788086550409511),
+ FRAC_CONST(0.44082059421219388),
+ FRAC_CONST(0.44375560208588088),
+ FRAC_CONST(0.44668585769357955),
+ FRAC_CONST(0.4496113296546066),
+ FRAC_CONST(0.45253198663950756),
+ FRAC_CONST(0.45544779737039259),
+ FRAC_CONST(0.45835873062127125),
+ FRAC_CONST(0.46126475521838717),
+ FRAC_CONST(0.46416584004055156),
+ FRAC_CONST(0.46706195401947659),
+ FRAC_CONST(0.46995306614010829),
+ FRAC_CONST(0.47283914544095862),
+ FRAC_CONST(0.47572016101443682),
+ FRAC_CONST(0.47859608200718085),
+ FRAC_CONST(0.4814668776203872),
+ FRAC_CONST(0.48433251711014125),
+ FRAC_CONST(0.4871929697877464),
+ FRAC_CONST(0.49004820502005247),
+ FRAC_CONST(0.49289819222978404),
+ FRAC_CONST(0.49574290089586776),
+ FRAC_CONST(0.49858230055375902),
+ FRAC_CONST(0.50141636079576901),
+ FRAC_CONST(0.50424505127138919),
+ FRAC_CONST(0.50706834168761705),
+ FRAC_CONST(0.50988620180928057),
+ FRAC_CONST(0.51269860145936175),
+ FRAC_CONST(0.51550551051931948),
+ FRAC_CONST(0.51830689892941317),
+ FRAC_CONST(0.5211027366890234),
+ FRAC_CONST(0.52389299385697385),
+ FRAC_CONST(0.52667764055185196),
+ FRAC_CONST(0.52945664695232897),
+ FRAC_CONST(0.53222998329747884),
+ FRAC_CONST(0.53499761988709726),
+ FRAC_CONST(0.53775952708201991),
+ FRAC_CONST(0.54051567530443978),
+ FRAC_CONST(0.54326603503822357),
+ FRAC_CONST(0.54601057682922816),
+ FRAC_CONST(0.54874927128561579),
+ FRAC_CONST(0.55148208907816942),
+ FRAC_CONST(0.55420900094060566),
+ FRAC_CONST(0.55692997766988939),
+ FRAC_CONST(0.559644990126546),
+ FRAC_CONST(0.56235400923497314),
+ FRAC_CONST(0.56505700598375252),
+ FRAC_CONST(0.56775395142596052),
+ FRAC_CONST(0.57044481667947822),
+ FRAC_CONST(0.57312957292730071),
+ FRAC_CONST(0.57580819141784534),
+ FRAC_CONST(0.57848064346525996),
+ FRAC_CONST(0.58114690044973039),
+ FRAC_CONST(0.58380693381778626),
+ FRAC_CONST(0.58646071508260733),
+ FRAC_CONST(0.58910821582432815),
+ FRAC_CONST(0.5917494076903429),
+ FRAC_CONST(0.5943842623956086),
+ FRAC_CONST(0.59701275172294799),
+ FRAC_CONST(0.59963484752335228),
+ FRAC_CONST(0.60225052171628191),
+ FRAC_CONST(0.60485974628996786),
+ FRAC_CONST(0.60746249330171098),
+ FRAC_CONST(0.61005873487818185),
+ FRAC_CONST(0.61264844321571899),
+ FRAC_CONST(0.61523159058062682),
+ FRAC_CONST(0.61780814930947225),
+ FRAC_CONST(0.62037809180938108),
+ FRAC_CONST(0.62294139055833397),
+ FRAC_CONST(0.6254980181054608),
+ FRAC_CONST(0.62804794707133416),
+ FRAC_CONST(0.63059115014826372),
+ FRAC_CONST(0.63312760010058777),
+ FRAC_CONST(0.63565726976496484),
+ FRAC_CONST(0.63818013205066515),
+ FRAC_CONST(0.64069615993986073),
+ FRAC_CONST(0.64320532648791406),
+ FRAC_CONST(0.64570760482366729),
+ FRAC_CONST(0.64820296814972966),
+ FRAC_CONST(0.65069138974276486),
+ FRAC_CONST(0.65317284295377676),
+ FRAC_CONST(0.65564730120839498),
+ FRAC_CONST(0.65811473800715958),
+ FRAC_CONST(0.660575126925805),
+ FRAC_CONST(0.66302844161554231),
+ FRAC_CONST(0.6654746558033422),
+ FRAC_CONST(0.66791374329221598),
+ FRAC_CONST(0.67034567796149647),
+ FRAC_CONST(0.67277043376711676),
+ FRAC_CONST(0.67518798474189046),
+ FRAC_CONST(0.67759830499578866),
+ FRAC_CONST(0.68000136871621808),
+ FRAC_CONST(0.68239715016829683),
+ FRAC_CONST(0.6847856236951303),
+ FRAC_CONST(0.68716676371808583),
+ FRAC_CONST(0.68954054473706683),
+ FRAC_CONST(0.69190694133078579),
+ FRAC_CONST(0.69426592815703603),
+ FRAC_CONST(0.69661747995296419),
+ FRAC_CONST(0.69896157153533944),
+ FRAC_CONST(0.70129817780082437),
+ FRAC_CONST(0.7036272737262429),
+ FRAC_CONST(0.70594883436884903),
+ FRAC_CONST(0.70826283486659336),
+ FRAC_CONST(0.71056925043838959),
+ FRAC_CONST(0.71286805638437978),
+ FRAC_CONST(0.71515922808619936),
+ FRAC_CONST(0.71744274100723993),
+ FRAC_CONST(0.71971857069291278),
+ FRAC_CONST(0.7219866927709101),
+ FRAC_CONST(0.72424708295146689),
+ FRAC_CONST(0.72649971702762028),
+ FRAC_CONST(0.72874457087546896),
+ FRAC_CONST(0.73098162045443171),
+ FRAC_CONST(0.73321084180750484),
+ FRAC_CONST(0.73543221106151868),
+ FRAC_CONST(0.73764570442739286),
+ FRAC_CONST(0.73985129820039208),
+ FRAC_CONST(0.74204896876037885),
+ FRAC_CONST(0.7442386925720671),
+ FRAC_CONST(0.74642044618527381),
+ FRAC_CONST(0.74859420623517081),
+ FRAC_CONST(0.75075994944253421),
+ FRAC_CONST(0.75291765261399446),
+ FRAC_CONST(0.75506729264228367),
+ FRAC_CONST(0.75720884650648446),
+ FRAC_CONST(0.75934229127227548),
+ FRAC_CONST(0.76146760409217706),
+ FRAC_CONST(0.76358476220579641),
+ FRAC_CONST(0.7656937429400712),
+ FRAC_CONST(0.76779452370951196),
+ FRAC_CONST(0.76988708201644451),
+ FRAC_CONST(0.77197139545125026),
+ FRAC_CONST(0.7740474416926072),
+ FRAC_CONST(0.77611519850772781),
+ FRAC_CONST(0.77817464375259782),
+ FRAC_CONST(0.78022575537221317),
+ FRAC_CONST(0.78226851140081632),
+ FRAC_CONST(0.78430288996213138),
+ FRAC_CONST(0.78632886926959822),
+ FRAC_CONST(0.78834642762660623),
+ FRAC_CONST(0.79035554342672631),
+ FRAC_CONST(0.79235619515394229),
+ FRAC_CONST(0.79434836138288134),
+ FRAC_CONST(0.79633202077904397),
+ FRAC_CONST(0.79830715209903147),
+ FRAC_CONST(0.8002737341907743),
+ FRAC_CONST(0.80223174599375802),
+ FRAC_CONST(0.80418116653924954),
+ FRAC_CONST(0.80612197495052085),
+ FRAC_CONST(0.80805415044307316),
+ FRAC_CONST(0.80997767232485907),
+ FRAC_CONST(0.81189251999650469),
+ FRAC_CONST(0.81379867295152986),
+ FRAC_CONST(0.81569611077656778),
+ FRAC_CONST(0.81758481315158371),
+ FRAC_CONST(0.81946475985009259),
+ FRAC_CONST(0.82133593073937561),
+ FRAC_CONST(0.82319830578069586),
+ FRAC_CONST(0.82505186502951278),
+ FRAC_CONST(0.82689658863569615),
+ FRAC_CONST(0.82873245684373809),
+ FRAC_CONST(0.83055944999296494),
+ FRAC_CONST(0.83237754851774781),
+ FRAC_CONST(0.83418673294771239),
+ FRAC_CONST(0.83598698390794668),
+ FRAC_CONST(0.83777828211920935),
+ FRAC_CONST(0.83956060839813562),
+ FRAC_CONST(0.84133394365744296),
+ FRAC_CONST(0.84309826890613537),
+ FRAC_CONST(0.84485356524970701),
+ FRAC_CONST(0.84659981389034411),
+ FRAC_CONST(0.84833699612712676),
+ FRAC_CONST(0.85006509335622882),
+ FRAC_CONST(0.8517840870711173),
+ FRAC_CONST(0.85349395886275037),
+ FRAC_CONST(0.85519469041977514),
+ FRAC_CONST(0.85688626352872277),
+ FRAC_CONST(0.85856866007420429),
+ FRAC_CONST(0.86024186203910447),
+ FRAC_CONST(0.86190585150477417),
+ FRAC_CONST(0.86356061065122347),
+ FRAC_CONST(0.86520612175731115),
+ FRAC_CONST(0.86684236720093533),
+ FRAC_CONST(0.86846932945922151),
+ FRAC_CONST(0.87008699110871135),
+ FRAC_CONST(0.87169533482554817),
+ FRAC_CONST(0.87329434338566281),
+ FRAC_CONST(0.87488399966495822),
+ FRAC_CONST(0.87646428663949283),
+ FRAC_CONST(0.87803518738566277),
+ FRAC_CONST(0.87959668508038291),
+ FRAC_CONST(0.88114876300126743),
+ FRAC_CONST(0.88269140452680916),
+ FRAC_CONST(0.8842245931365561),
+ FRAC_CONST(0.88574831241129048),
+ FRAC_CONST(0.88726254603320276),
+ FRAC_CONST(0.88876727778606746),
+ FRAC_CONST(0.89026249155541637),
+ FRAC_CONST(0.8917481713287112),
+ FRAC_CONST(0.89322430119551532),
+ FRAC_CONST(0.89469086534766362),
+ FRAC_CONST(0.89614784807943237),
+ FRAC_CONST(0.89759523378770689),
+ FRAC_CONST(0.89903300697214927),
+ FRAC_CONST(0.9004611522353636),
+ FRAC_CONST(0.90187965428306172),
+ FRAC_CONST(0.90328849792422594),
+ FRAC_CONST(0.90468766807127299),
+ FRAC_CONST(0.90607714974021469),
+ FRAC_CONST(0.90745692805081868),
+ FRAC_CONST(0.90882698822676755),
+ FRAC_CONST(0.91018731559581767),
+ FRAC_CONST(0.91153789558995579),
+ FRAC_CONST(0.91287871374555518),
+ FRAC_CONST(0.91420975570353069),
+ FRAC_CONST(0.9155310072094921),
+ FRAC_CONST(0.91684245411389753),
+ FRAC_CONST(0.91814408237220391),
+ FRAC_CONST(0.91943587804501858),
+ FRAC_CONST(0.92071782729824769),
+ FRAC_CONST(0.92198991640324446),
+ FRAC_CONST(0.92325213173695675),
+ FRAC_CONST(0.92450445978207241),
+ FRAC_CONST(0.92574688712716402),
+ FRAC_CONST(0.92697940046683291),
+ FRAC_CONST(0.92820198660185149),
+ FRAC_CONST(0.92941463243930444),
+ FRAC_CONST(0.93061732499272909),
+ FRAC_CONST(0.93181005138225426),
+ FRAC_CONST(0.93299279883473885),
+ FRAC_CONST(0.93416555468390772),
+ FRAC_CONST(0.93532830637048769),
+ FRAC_CONST(0.93648104144234268),
+ FRAC_CONST(0.93762374755460598),
+ FRAC_CONST(0.93875641246981323),
+ FRAC_CONST(0.93987902405803303),
+ FRAC_CONST(0.94099157029699743),
+ FRAC_CONST(0.94209403927222979),
+ FRAC_CONST(0.94318641917717327),
+ FRAC_CONST(0.9442686983133165),
+ FRAC_CONST(0.94534086509031956),
+ FRAC_CONST(0.9464029080261378),
+ FRAC_CONST(0.94745481574714419),
+ FRAC_CONST(0.94849657698825252),
+ FRAC_CONST(0.94952818059303667),
+ FRAC_CONST(0.95054961551385087),
+ FRAC_CONST(0.95156087081194762),
+ FRAC_CONST(0.95256193565759528),
+ FRAC_CONST(0.95355279933019343),
+ FRAC_CONST(0.9545334512183884),
+ FRAC_CONST(0.95550388082018611),
+ FRAC_CONST(0.95646407774306541),
+ FRAC_CONST(0.95741403170408834),
+ FRAC_CONST(0.95835373253001133),
+ FRAC_CONST(0.95928317015739362),
+ FRAC_CONST(0.96020233463270466),
+ FRAC_CONST(0.96111121611243155),
+ FRAC_CONST(0.96200980486318388),
+ FRAC_CONST(0.96289809126179782),
+ FRAC_CONST(0.96377606579543984),
+ FRAC_CONST(0.96464371906170809),
+ FRAC_CONST(0.96550104176873297),
+ FRAC_CONST(0.96634802473527726),
+ FRAC_CONST(0.96718465889083372),
+ FRAC_CONST(0.96801093527572268),
+ FRAC_CONST(0.96882684504118799),
+ FRAC_CONST(0.96963237944949143),
+ FRAC_CONST(0.97042752987400682),
+ FRAC_CONST(0.97121228779931179),
+ FRAC_CONST(0.97198664482127939),
+ FRAC_CONST(0.97275059264716823),
+ FRAC_CONST(0.97350412309571066),
+ FRAC_CONST(0.97424722809720088),
+ FRAC_CONST(0.97497989969358168),
+ FRAC_CONST(0.97570213003852857),
+ FRAC_CONST(0.97641391139753486),
+ FRAC_CONST(0.97711523614799412),
+ FRAC_CONST(0.97780609677928154),
+ FRAC_CONST(0.97848648589283505),
+ FRAC_CONST(0.97915639620223371),
+ FRAC_CONST(0.9798158205332762),
+ FRAC_CONST(0.98046475182405801),
+ FRAC_CONST(0.98110318312504607),
+ FRAC_CONST(0.98173110759915416),
+ FRAC_CONST(0.98234851852181571),
+ FRAC_CONST(0.98295540928105563),
+ FRAC_CONST(0.9835517733775615),
+ FRAC_CONST(0.98413760442475307),
+ FRAC_CONST(0.98471289614885038),
+ FRAC_CONST(0.98527764238894122),
+ FRAC_CONST(0.98583183709704714),
+ FRAC_CONST(0.98637547433818806),
+ FRAC_CONST(0.98690854829044583),
+ FRAC_CONST(0.98743105324502667),
+ FRAC_CONST(0.98794298360632238),
+ FRAC_CONST(0.98844433389196995),
+ FRAC_CONST(0.98893509873291074),
+ FRAC_CONST(0.98941527287344755),
+ FRAC_CONST(0.98988485117130098),
+ FRAC_CONST(0.99034382859766479),
+ FRAC_CONST(0.99079220023725967),
+ FRAC_CONST(0.99122996128838525),
+ FRAC_CONST(0.9916571070629725),
+ FRAC_CONST(0.99207363298663342),
+ FRAC_CONST(0.99247953459870997),
+ FRAC_CONST(0.99287480755232194),
+ FRAC_CONST(0.99325944761441354),
+ FRAC_CONST(0.99363345066579889),
+ FRAC_CONST(0.99399681270120555),
+ FRAC_CONST(0.99434952982931812),
+ FRAC_CONST(0.9946915982728195),
+ FRAC_CONST(0.99502301436843166),
+ FRAC_CONST(0.99534377456695422),
+ FRAC_CONST(0.9956538754333033),
+ FRAC_CONST(0.99595331364654771),
+ FRAC_CONST(0.99624208599994479),
+ FRAC_CONST(0.99652018940097464),
+ FRAC_CONST(0.99678762087137318),
+ FRAC_CONST(0.99704437754716424),
+ FRAC_CONST(0.99729045667869021),
+ FRAC_CONST(0.99752585563064111),
+ FRAC_CONST(0.99775057188208349),
+ FRAC_CONST(0.9979646030264866),
+ FRAC_CONST(0.99816794677174903),
+ FRAC_CONST(0.9983606009402225),
+ FRAC_CONST(0.99854256346873571),
+ FRAC_CONST(0.99871383240861611),
+ FRAC_CONST(0.99887440592571108),
+ FRAC_CONST(0.99902428230040718),
+ FRAC_CONST(0.99916345992764877),
+ FRAC_CONST(0.99929193731695531),
+ FRAC_CONST(0.99940971309243731),
+ FRAC_CONST(0.99951678599281069),
+ FRAC_CONST(0.99961315487141078),
+ FRAC_CONST(0.99969881869620425),
+ FRAC_CONST(0.99977377654980037),
+ FRAC_CONST(0.99983802762946083),
+ FRAC_CONST(0.99989157124710804),
+ FRAC_CONST(0.9999344068293331),
+ FRAC_CONST(0.99996653391740109),
+ FRAC_CONST(0.99998795216725689),
+ FRAC_CONST(0.99999866134952808)
+};
#endif
- ALIGN static const real_t ld_mid_512[] =
- {
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0.0061358846491544753),
- FRAC_CONST(0.01840672990580482),
- FRAC_CONST(0.030674803176636626),
- FRAC_CONST(0.04293825693494082),
- FRAC_CONST(0.055195244349689934),
- FRAC_CONST(0.067443919563664051),
- FRAC_CONST(0.079682437971430126),
- FRAC_CONST(0.091908956497132724),
- FRAC_CONST(0.10412163387205459),
- FRAC_CONST(0.11631863091190475),
- FRAC_CONST(0.12849811079379317),
- FRAC_CONST(0.14065823933284921),
- FRAC_CONST(0.15279718525844344),
- FRAC_CONST(0.16491312048996989),
- FRAC_CONST(0.17700422041214875),
- FRAC_CONST(0.18906866414980619),
- FRAC_CONST(0.2011046348420919),
- FRAC_CONST(0.21311031991609136),
- FRAC_CONST(0.22508391135979283),
- FRAC_CONST(0.2370236059943672),
- FRAC_CONST(0.24892760574572015),
- FRAC_CONST(0.26079411791527551),
- FRAC_CONST(0.27262135544994898),
- FRAC_CONST(0.28440753721127188),
- FRAC_CONST(0.29615088824362379),
- FRAC_CONST(0.30784964004153487),
- FRAC_CONST(0.31950203081601569),
- FRAC_CONST(0.33110630575987643),
- FRAC_CONST(0.34266071731199438),
- FRAC_CONST(0.35416352542049034),
- FRAC_CONST(0.36561299780477385),
- FRAC_CONST(0.37700741021641826),
- FRAC_CONST(0.38834504669882625),
- FRAC_CONST(0.39962419984564679),
- FRAC_CONST(0.41084317105790391),
- FRAC_CONST(0.42200027079979968),
- FRAC_CONST(0.43309381885315196),
- FRAC_CONST(0.4441221445704292),
- FRAC_CONST(0.45508358712634384),
- FRAC_CONST(0.46597649576796618),
- FRAC_CONST(0.47679923006332209),
- FRAC_CONST(0.487550160148436),
- FRAC_CONST(0.49822766697278187),
- FRAC_CONST(0.50883014254310699),
- FRAC_CONST(0.51935599016558964),
- FRAC_CONST(0.52980362468629461),
- FRAC_CONST(0.54017147272989285),
- FRAC_CONST(0.55045797293660481),
- FRAC_CONST(0.56066157619733603),
- FRAC_CONST(0.57078074588696726),
- FRAC_CONST(0.58081395809576453),
- FRAC_CONST(0.59075970185887416),
- FRAC_CONST(0.60061647938386897),
- FRAC_CONST(0.61038280627630948),
- FRAC_CONST(0.6200572117632891),
- FRAC_CONST(0.62963823891492698),
- FRAC_CONST(0.63912444486377573),
- FRAC_CONST(0.64851440102211244),
- FRAC_CONST(0.65780669329707864),
- FRAC_CONST(0.66699992230363747),
- FRAC_CONST(0.67609270357531592),
- FRAC_CONST(0.68508366777270036),
- FRAC_CONST(0.693971460889654),
- FRAC_CONST(0.7027547444572253),
- FRAC_CONST(0.71143219574521643),
- FRAC_CONST(0.72000250796138165),
- FRAC_CONST(0.7284643904482252),
- FRAC_CONST(0.73681656887736979),
- FRAC_CONST(0.74505778544146595),
- FRAC_CONST(0.75318679904361241),
- FRAC_CONST(0.76120238548426178),
- FRAC_CONST(0.76910333764557959),
- FRAC_CONST(0.77688846567323244),
- FRAC_CONST(0.78455659715557524),
- FRAC_CONST(0.79210657730021239),
- FRAC_CONST(0.79953726910790501),
- FRAC_CONST(0.80684755354379922),
- FRAC_CONST(0.8140363297059483),
- FRAC_CONST(0.82110251499110465),
- FRAC_CONST(0.8280450452577558),
- FRAC_CONST(0.83486287498638001),
- FRAC_CONST(0.84155497743689833),
- FRAC_CONST(0.84812034480329712),
- FRAC_CONST(0.85455798836540053),
- FRAC_CONST(0.86086693863776731),
- FRAC_CONST(0.86704624551569265),
- FRAC_CONST(0.87309497841829009),
- FRAC_CONST(0.87901222642863341),
- FRAC_CONST(0.88479709843093779),
- FRAC_CONST(0.89044872324475788),
- FRAC_CONST(0.89596624975618511),
- FRAC_CONST(0.90134884704602203),
- FRAC_CONST(0.90659570451491533),
- FRAC_CONST(0.91170603200542988),
- FRAC_CONST(0.9166790599210427),
- FRAC_CONST(0.9215140393420419),
- FRAC_CONST(0.92621024213831127),
- FRAC_CONST(0.93076696107898371),
- FRAC_CONST(0.9351835099389475),
- FRAC_CONST(0.93945922360218992),
- FRAC_CONST(0.94359345816196039),
- FRAC_CONST(0.94758559101774109),
- FRAC_CONST(0.95143502096900834),
- FRAC_CONST(0.95514116830577067),
- FRAC_CONST(0.9587034748958716),
- FRAC_CONST(0.96212140426904158),
- FRAC_CONST(0.9653944416976894),
- FRAC_CONST(0.96852209427441727),
- FRAC_CONST(0.97150389098625178),
- FRAC_CONST(0.97433938278557586),
- FRAC_CONST(0.97702814265775439),
- FRAC_CONST(0.97956976568544052),
- FRAC_CONST(0.98196386910955524),
- FRAC_CONST(0.98421009238692903),
- FRAC_CONST(0.98630809724459867),
- FRAC_CONST(0.98825756773074946),
- FRAC_CONST(0.99005821026229712),
- FRAC_CONST(0.99170975366909953),
- FRAC_CONST(0.9932119492347945),
- FRAC_CONST(0.99456457073425542),
- FRAC_CONST(0.99576741446765982),
- FRAC_CONST(0.99682029929116567),
- FRAC_CONST(0.99772306664419164),
- FRAC_CONST(0.99847558057329477),
- FRAC_CONST(0.99907772775264536),
- FRAC_CONST(0.99952941750109314),
- FRAC_CONST(0.9998305817958234),
- FRAC_CONST(0.99998117528260111),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1)
- };
+ALIGN static const real_t ld_mid_512[] =
+{
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0.0061358846491544753),
+ FRAC_CONST(0.01840672990580482),
+ FRAC_CONST(0.030674803176636626),
+ FRAC_CONST(0.04293825693494082),
+ FRAC_CONST(0.055195244349689934),
+ FRAC_CONST(0.067443919563664051),
+ FRAC_CONST(0.079682437971430126),
+ FRAC_CONST(0.091908956497132724),
+ FRAC_CONST(0.10412163387205459),
+ FRAC_CONST(0.11631863091190475),
+ FRAC_CONST(0.12849811079379317),
+ FRAC_CONST(0.14065823933284921),
+ FRAC_CONST(0.15279718525844344),
+ FRAC_CONST(0.16491312048996989),
+ FRAC_CONST(0.17700422041214875),
+ FRAC_CONST(0.18906866414980619),
+ FRAC_CONST(0.2011046348420919),
+ FRAC_CONST(0.21311031991609136),
+ FRAC_CONST(0.22508391135979283),
+ FRAC_CONST(0.2370236059943672),
+ FRAC_CONST(0.24892760574572015),
+ FRAC_CONST(0.26079411791527551),
+ FRAC_CONST(0.27262135544994898),
+ FRAC_CONST(0.28440753721127188),
+ FRAC_CONST(0.29615088824362379),
+ FRAC_CONST(0.30784964004153487),
+ FRAC_CONST(0.31950203081601569),
+ FRAC_CONST(0.33110630575987643),
+ FRAC_CONST(0.34266071731199438),
+ FRAC_CONST(0.35416352542049034),
+ FRAC_CONST(0.36561299780477385),
+ FRAC_CONST(0.37700741021641826),
+ FRAC_CONST(0.38834504669882625),
+ FRAC_CONST(0.39962419984564679),
+ FRAC_CONST(0.41084317105790391),
+ FRAC_CONST(0.42200027079979968),
+ FRAC_CONST(0.43309381885315196),
+ FRAC_CONST(0.4441221445704292),
+ FRAC_CONST(0.45508358712634384),
+ FRAC_CONST(0.46597649576796618),
+ FRAC_CONST(0.47679923006332209),
+ FRAC_CONST(0.487550160148436),
+ FRAC_CONST(0.49822766697278187),
+ FRAC_CONST(0.50883014254310699),
+ FRAC_CONST(0.51935599016558964),
+ FRAC_CONST(0.52980362468629461),
+ FRAC_CONST(0.54017147272989285),
+ FRAC_CONST(0.55045797293660481),
+ FRAC_CONST(0.56066157619733603),
+ FRAC_CONST(0.57078074588696726),
+ FRAC_CONST(0.58081395809576453),
+ FRAC_CONST(0.59075970185887416),
+ FRAC_CONST(0.60061647938386897),
+ FRAC_CONST(0.61038280627630948),
+ FRAC_CONST(0.6200572117632891),
+ FRAC_CONST(0.62963823891492698),
+ FRAC_CONST(0.63912444486377573),
+ FRAC_CONST(0.64851440102211244),
+ FRAC_CONST(0.65780669329707864),
+ FRAC_CONST(0.66699992230363747),
+ FRAC_CONST(0.67609270357531592),
+ FRAC_CONST(0.68508366777270036),
+ FRAC_CONST(0.693971460889654),
+ FRAC_CONST(0.7027547444572253),
+ FRAC_CONST(0.71143219574521643),
+ FRAC_CONST(0.72000250796138165),
+ FRAC_CONST(0.7284643904482252),
+ FRAC_CONST(0.73681656887736979),
+ FRAC_CONST(0.74505778544146595),
+ FRAC_CONST(0.75318679904361241),
+ FRAC_CONST(0.76120238548426178),
+ FRAC_CONST(0.76910333764557959),
+ FRAC_CONST(0.77688846567323244),
+ FRAC_CONST(0.78455659715557524),
+ FRAC_CONST(0.79210657730021239),
+ FRAC_CONST(0.79953726910790501),
+ FRAC_CONST(0.80684755354379922),
+ FRAC_CONST(0.8140363297059483),
+ FRAC_CONST(0.82110251499110465),
+ FRAC_CONST(0.8280450452577558),
+ FRAC_CONST(0.83486287498638001),
+ FRAC_CONST(0.84155497743689833),
+ FRAC_CONST(0.84812034480329712),
+ FRAC_CONST(0.85455798836540053),
+ FRAC_CONST(0.86086693863776731),
+ FRAC_CONST(0.86704624551569265),
+ FRAC_CONST(0.87309497841829009),
+ FRAC_CONST(0.87901222642863341),
+ FRAC_CONST(0.88479709843093779),
+ FRAC_CONST(0.89044872324475788),
+ FRAC_CONST(0.89596624975618511),
+ FRAC_CONST(0.90134884704602203),
+ FRAC_CONST(0.90659570451491533),
+ FRAC_CONST(0.91170603200542988),
+ FRAC_CONST(0.9166790599210427),
+ FRAC_CONST(0.9215140393420419),
+ FRAC_CONST(0.92621024213831127),
+ FRAC_CONST(0.93076696107898371),
+ FRAC_CONST(0.9351835099389475),
+ FRAC_CONST(0.93945922360218992),
+ FRAC_CONST(0.94359345816196039),
+ FRAC_CONST(0.94758559101774109),
+ FRAC_CONST(0.95143502096900834),
+ FRAC_CONST(0.95514116830577067),
+ FRAC_CONST(0.9587034748958716),
+ FRAC_CONST(0.96212140426904158),
+ FRAC_CONST(0.9653944416976894),
+ FRAC_CONST(0.96852209427441727),
+ FRAC_CONST(0.97150389098625178),
+ FRAC_CONST(0.97433938278557586),
+ FRAC_CONST(0.97702814265775439),
+ FRAC_CONST(0.97956976568544052),
+ FRAC_CONST(0.98196386910955524),
+ FRAC_CONST(0.98421009238692903),
+ FRAC_CONST(0.98630809724459867),
+ FRAC_CONST(0.98825756773074946),
+ FRAC_CONST(0.99005821026229712),
+ FRAC_CONST(0.99170975366909953),
+ FRAC_CONST(0.9932119492347945),
+ FRAC_CONST(0.99456457073425542),
+ FRAC_CONST(0.99576741446765982),
+ FRAC_CONST(0.99682029929116567),
+ FRAC_CONST(0.99772306664419164),
+ FRAC_CONST(0.99847558057329477),
+ FRAC_CONST(0.99907772775264536),
+ FRAC_CONST(0.99952941750109314),
+ FRAC_CONST(0.9998305817958234),
+ FRAC_CONST(0.99998117528260111),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1)
+};
#ifdef ALLOW_SMALL_FRAMELENGTH
- ALIGN static const real_t ld_mid_480[] =
- {
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0),
- FRAC_CONST(0.0065449379673518581),
- FRAC_CONST(0.019633692460628301),
- FRAC_CONST(0.032719082821776137),
- FRAC_CONST(0.045798866936520771),
- FRAC_CONST(0.058870803651189033),
- FRAC_CONST(0.071932653156719387),
- FRAC_CONST(0.084982177372441667),
- FRAC_CONST(0.09801714032956059),
- FRAC_CONST(0.11103530855427769),
- FRAC_CONST(0.12403445145048532),
- FRAC_CONST(0.13701234168196802),
- FRAC_CONST(0.14996675555404498),
- FRAC_CONST(0.16289547339458874),
- FRAC_CONST(0.17579627993435451),
- FRAC_CONST(0.18866696468655525),
- FRAC_CONST(0.2015053223256171),
- FRAC_CONST(0.21430915306505074),
- FRAC_CONST(0.2270762630343732),
- FRAC_CONST(0.23980446465501654),
- FRAC_CONST(0.25249157701515795),
- FRAC_CONST(0.26513542624340797),
- FRAC_CONST(0.27773384588129219),
- FRAC_CONST(0.29028467725446233),
- FRAC_CONST(0.3027857698425746),
- FRAC_CONST(0.31523498164776964),
- FRAC_CONST(0.32763017956169349),
- FRAC_CONST(0.33996923973099424),
- FRAC_CONST(0.35225004792123354),
- FRAC_CONST(0.36447049987914965),
- FRAC_CONST(0.37662850169321077),
- FRAC_CONST(0.38872197015239557),
- FRAC_CONST(0.40074883310314097),
- FRAC_CONST(0.41270702980439467),
- FRAC_CONST(0.42459451128071307),
- FRAC_CONST(0.43640924067334208),
- FRAC_CONST(0.44814919358922256),
- FRAC_CONST(0.45981235844785984),
- FRAC_CONST(0.47139673682599764),
- FRAC_CONST(0.48290034380003727),
- FRAC_CONST(0.49432120828614462),
- FRAC_CONST(0.50565737337798455),
- FRAC_CONST(0.51690689668202761),
- FRAC_CONST(0.52806785065036799),
- FRAC_CONST(0.53913832291100017),
- FRAC_CONST(0.55011641659549337),
- FRAC_CONST(0.56100025066400983),
- FRAC_CONST(0.57178796022761225),
- FRAC_CONST(0.58247769686780215),
- FRAC_CONST(0.59306762895323706),
- FRAC_CONST(0.60355594195357143),
- FRAC_CONST(0.61394083875036642),
- FRAC_CONST(0.62422053994501758),
- FRAC_CONST(0.63439328416364549),
- FRAC_CONST(0.64445732835889735),
- FRAC_CONST(0.65441094810861034),
- FRAC_CONST(0.66425243791128175),
- FRAC_CONST(0.67398011147829784),
- FRAC_CONST(0.68359230202287125),
- FRAC_CONST(0.69308736254563585),
- FRAC_CONST(0.70246366611685174),
- FRAC_CONST(0.71171960615517138),
- FRAC_CONST(0.72085359670291882),
- FRAC_CONST(0.7298640726978356),
- FRAC_CONST(0.73874949024124625),
- FRAC_CONST(0.74750832686259672),
- FRAC_CONST(0.75613908178032285),
- FRAC_CONST(0.76464027615900032),
- FRAC_CONST(0.77301045336273699),
- FRAC_CONST(0.78124817920475853),
- FRAC_CONST(0.78935204219315003),
- FRAC_CONST(0.79732065377270711),
- FRAC_CONST(0.80515264856285829),
- FRAC_CONST(0.81284668459161513),
- FRAC_CONST(0.82040144352551359),
- FRAC_CONST(0.82781563089550203),
- FRAC_CONST(0.83508797631874299),
- FRAC_CONST(0.84221723371628654),
- FRAC_CONST(0.84920218152657889),
- FRAC_CONST(0.85604162291477137),
- FRAC_CONST(0.86273438597779184),
- FRAC_CONST(0.86927932394514362),
- FRAC_CONST(0.87567531537539967),
- FRAC_CONST(0.88192126434835494),
- FRAC_CONST(0.88801610065280734),
- FRAC_CONST(0.89395877996993212),
- FRAC_CONST(0.8997482840522214),
- FRAC_CONST(0.90538362089795521),
- FRAC_CONST(0.91086382492117568),
- FRAC_CONST(0.91618795711713596),
- FRAC_CONST(0.92135510522319242),
- FRAC_CONST(0.9263643838751181),
- FRAC_CONST(0.93121493475880346),
- FRAC_CONST(0.93590592675732565),
- FRAC_CONST(0.94043655609335486),
- FRAC_CONST(0.94480604646687805),
- FRAC_CONST(0.94901364918821385),
- FRAC_CONST(0.95305864330629697),
- FRAC_CONST(0.95694033573220882),
- FRAC_CONST(0.9606580613579353),
- FRAC_CONST(0.96421118317032928),
- FRAC_CONST(0.96759909236025976),
- FRAC_CONST(0.9708212084269281),
- FRAC_CONST(0.97387697927733363),
- FRAC_CONST(0.97676588132087239),
- FRAC_CONST(0.97948741955905139),
- FRAC_CONST(0.98204112767030394),
- FRAC_CONST(0.98442656808989171),
- FRAC_CONST(0.98664333208487898),
- FRAC_CONST(0.98869103982416728),
- FRAC_CONST(0.99056934044357725),
- FRAC_CONST(0.99227791210596705),
- FRAC_CONST(0.99381646205637808),
- FRAC_CONST(0.99518472667219682),
- FRAC_CONST(0.99638247150832537),
- FRAC_CONST(0.99740949133735191),
- FRAC_CONST(0.99826561018471593),
- FRAC_CONST(0.99895068135886012),
- FRAC_CONST(0.99946458747636568),
- FRAC_CONST(0.99980724048206482),
- FRAC_CONST(0.99997858166412923),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1),
- FRAC_CONST(1)
- };
+ALIGN static const real_t ld_mid_480[] =
+{
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0.0065449379673518581),
+ FRAC_CONST(0.019633692460628301),
+ FRAC_CONST(0.032719082821776137),
+ FRAC_CONST(0.045798866936520771),
+ FRAC_CONST(0.058870803651189033),
+ FRAC_CONST(0.071932653156719387),
+ FRAC_CONST(0.084982177372441667),
+ FRAC_CONST(0.09801714032956059),
+ FRAC_CONST(0.11103530855427769),
+ FRAC_CONST(0.12403445145048532),
+ FRAC_CONST(0.13701234168196802),
+ FRAC_CONST(0.14996675555404498),
+ FRAC_CONST(0.16289547339458874),
+ FRAC_CONST(0.17579627993435451),
+ FRAC_CONST(0.18866696468655525),
+ FRAC_CONST(0.2015053223256171),
+ FRAC_CONST(0.21430915306505074),
+ FRAC_CONST(0.2270762630343732),
+ FRAC_CONST(0.23980446465501654),
+ FRAC_CONST(0.25249157701515795),
+ FRAC_CONST(0.26513542624340797),
+ FRAC_CONST(0.27773384588129219),
+ FRAC_CONST(0.29028467725446233),
+ FRAC_CONST(0.3027857698425746),
+ FRAC_CONST(0.31523498164776964),
+ FRAC_CONST(0.32763017956169349),
+ FRAC_CONST(0.33996923973099424),
+ FRAC_CONST(0.35225004792123354),
+ FRAC_CONST(0.36447049987914965),
+ FRAC_CONST(0.37662850169321077),
+ FRAC_CONST(0.38872197015239557),
+ FRAC_CONST(0.40074883310314097),
+ FRAC_CONST(0.41270702980439467),
+ FRAC_CONST(0.42459451128071307),
+ FRAC_CONST(0.43640924067334208),
+ FRAC_CONST(0.44814919358922256),
+ FRAC_CONST(0.45981235844785984),
+ FRAC_CONST(0.47139673682599764),
+ FRAC_CONST(0.48290034380003727),
+ FRAC_CONST(0.49432120828614462),
+ FRAC_CONST(0.50565737337798455),
+ FRAC_CONST(0.51690689668202761),
+ FRAC_CONST(0.52806785065036799),
+ FRAC_CONST(0.53913832291100017),
+ FRAC_CONST(0.55011641659549337),
+ FRAC_CONST(0.56100025066400983),
+ FRAC_CONST(0.57178796022761225),
+ FRAC_CONST(0.58247769686780215),
+ FRAC_CONST(0.59306762895323706),
+ FRAC_CONST(0.60355594195357143),
+ FRAC_CONST(0.61394083875036642),
+ FRAC_CONST(0.62422053994501758),
+ FRAC_CONST(0.63439328416364549),
+ FRAC_CONST(0.64445732835889735),
+ FRAC_CONST(0.65441094810861034),
+ FRAC_CONST(0.66425243791128175),
+ FRAC_CONST(0.67398011147829784),
+ FRAC_CONST(0.68359230202287125),
+ FRAC_CONST(0.69308736254563585),
+ FRAC_CONST(0.70246366611685174),
+ FRAC_CONST(0.71171960615517138),
+ FRAC_CONST(0.72085359670291882),
+ FRAC_CONST(0.7298640726978356),
+ FRAC_CONST(0.73874949024124625),
+ FRAC_CONST(0.74750832686259672),
+ FRAC_CONST(0.75613908178032285),
+ FRAC_CONST(0.76464027615900032),
+ FRAC_CONST(0.77301045336273699),
+ FRAC_CONST(0.78124817920475853),
+ FRAC_CONST(0.78935204219315003),
+ FRAC_CONST(0.79732065377270711),
+ FRAC_CONST(0.80515264856285829),
+ FRAC_CONST(0.81284668459161513),
+ FRAC_CONST(0.82040144352551359),
+ FRAC_CONST(0.82781563089550203),
+ FRAC_CONST(0.83508797631874299),
+ FRAC_CONST(0.84221723371628654),
+ FRAC_CONST(0.84920218152657889),
+ FRAC_CONST(0.85604162291477137),
+ FRAC_CONST(0.86273438597779184),
+ FRAC_CONST(0.86927932394514362),
+ FRAC_CONST(0.87567531537539967),
+ FRAC_CONST(0.88192126434835494),
+ FRAC_CONST(0.88801610065280734),
+ FRAC_CONST(0.89395877996993212),
+ FRAC_CONST(0.8997482840522214),
+ FRAC_CONST(0.90538362089795521),
+ FRAC_CONST(0.91086382492117568),
+ FRAC_CONST(0.91618795711713596),
+ FRAC_CONST(0.92135510522319242),
+ FRAC_CONST(0.9263643838751181),
+ FRAC_CONST(0.93121493475880346),
+ FRAC_CONST(0.93590592675732565),
+ FRAC_CONST(0.94043655609335486),
+ FRAC_CONST(0.94480604646687805),
+ FRAC_CONST(0.94901364918821385),
+ FRAC_CONST(0.95305864330629697),
+ FRAC_CONST(0.95694033573220882),
+ FRAC_CONST(0.9606580613579353),
+ FRAC_CONST(0.96421118317032928),
+ FRAC_CONST(0.96759909236025976),
+ FRAC_CONST(0.9708212084269281),
+ FRAC_CONST(0.97387697927733363),
+ FRAC_CONST(0.97676588132087239),
+ FRAC_CONST(0.97948741955905139),
+ FRAC_CONST(0.98204112767030394),
+ FRAC_CONST(0.98442656808989171),
+ FRAC_CONST(0.98664333208487898),
+ FRAC_CONST(0.98869103982416728),
+ FRAC_CONST(0.99056934044357725),
+ FRAC_CONST(0.99227791210596705),
+ FRAC_CONST(0.99381646205637808),
+ FRAC_CONST(0.99518472667219682),
+ FRAC_CONST(0.99638247150832537),
+ FRAC_CONST(0.99740949133735191),
+ FRAC_CONST(0.99826561018471593),
+ FRAC_CONST(0.99895068135886012),
+ FRAC_CONST(0.99946458747636568),
+ FRAC_CONST(0.99980724048206482),
+ FRAC_CONST(0.99997858166412923),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1)
+};
#endif
#endif
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.c
index ca85fb8d4..011b80bd7 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -132,7 +132,7 @@ ALIGN static const uint16_t swb_offset_512_48[] =
ALIGN static const uint16_t swb_offset_480_48[] =
{
- 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 , 80 , 88,
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88,
96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400,
432, 480
};
@@ -306,8 +306,7 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
uint8_t sf_index = hDecoder->sf_index;
- switch(ics->window_sequence)
- {
+ switch (ics->window_sequence) {
case ONLY_LONG_SEQUENCE:
case LONG_START_SEQUENCE:
case LONG_STOP_SEQUENCE:
@@ -315,17 +314,15 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
ics->num_window_groups = 1;
ics->window_group_length[ics->num_window_groups-1] = 1;
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
{
- if(hDecoder->frameLength == 512)
+ if (hDecoder->frameLength == 512)
ics->num_swb = num_swb_512_window[sf_index];
else /* if (hDecoder->frameLength == 480) */
ics->num_swb = num_swb_480_window[sf_index];
- }
- else
- {
+ } else {
#endif
- if(hDecoder->frameLength == 1024)
+ if (hDecoder->frameLength == 1024)
ics->num_swb = num_swb_1024_window[sf_index];
else /* if (hDecoder->frameLength == 960) */
ics->num_swb = num_swb_960_window[sf_index];
@@ -333,7 +330,7 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
}
#endif
- if(ics->max_sfb > ics->num_swb)
+ if (ics->max_sfb > ics->num_swb)
{
return 32;
}
@@ -341,19 +338,17 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
/* preparation of sect_sfb_offset for long blocks */
/* also copy the last value! */
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
{
- if(hDecoder->frameLength == 512)
+ if (hDecoder->frameLength == 512)
{
- for(i = 0; i < ics->num_swb; i++)
+ for (i = 0; i < ics->num_swb; i++)
{
ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i];
ics->swb_offset[i] = swb_offset_512_window[sf_index][i];
}
- }
- else /* if (hDecoder->frameLength == 480) */
- {
- for(i = 0; i < ics->num_swb; i++)
+ } else /* if (hDecoder->frameLength == 480) */ {
+ for (i = 0; i < ics->num_swb; i++)
{
ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i];
ics->swb_offset[i] = swb_offset_480_window[sf_index][i];
@@ -362,11 +357,9 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength;
ics->swb_offset[ics->num_swb] = hDecoder->frameLength;
ics->swb_offset_max = hDecoder->frameLength;
- }
- else
- {
+ } else {
#endif
- for(i = 0; i < ics->num_swb; i++)
+ for (i = 0; i < ics->num_swb; i++)
{
ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i];
ics->swb_offset[i] = swb_offset_1024_window[sf_index][i];
@@ -384,46 +377,41 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
ics->window_group_length[ics->num_window_groups-1] = 1;
ics->num_swb = num_swb_128_window[sf_index];
- if(ics->max_sfb > ics->num_swb)
+ if (ics->max_sfb > ics->num_swb)
{
return 32;
}
- for(i = 0; i < ics->num_swb; i++)
+ for (i = 0; i < ics->num_swb; i++)
ics->swb_offset[i] = swb_offset_128_window[sf_index][i];
- ics->swb_offset[ics->num_swb] = hDecoder->frameLength / 8;
- ics->swb_offset_max = hDecoder->frameLength / 8;
+ ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8;
+ ics->swb_offset_max = hDecoder->frameLength/8;
- for(i = 0; i < ics->num_windows - 1; i++)
- {
- if(bit_set(ics->scale_factor_grouping, 6 - i) == 0)
+ for (i = 0; i < ics->num_windows-1; i++) {
+ if (bit_set(ics->scale_factor_grouping, 6-i) == 0)
{
ics->num_window_groups += 1;
ics->window_group_length[ics->num_window_groups-1] = 1;
- }
- else
- {
+ } else {
ics->window_group_length[ics->num_window_groups-1] += 1;
}
}
/* preparation of sect_sfb_offset for short blocks */
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
uint16_t width;
uint8_t sect_sfb = 0;
uint16_t offset = 0;
- for(i = 0; i < ics->num_swb; i++)
+ for (i = 0; i < ics->num_swb; i++)
{
- if(i + 1 == ics->num_swb)
- {
- width = (hDecoder->frameLength / 8) - swb_offset_128_window[sf_index][i];
- }
- else
+ if (i+1 == ics->num_swb)
{
+ width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i];
+ } else {
width = swb_offset_128_window[sf_index][i+1] -
- swb_offset_128_window[sf_index][i];
+ swb_offset_128_window[sf_index][i];
}
width *= ics->window_group_length[g];
ics->sect_sfb_offset[g][sect_sfb++] = offset;
@@ -443,28 +431,27 @@ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics)
static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
{
#ifdef FIXED_POINT
- /* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */
- /* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not
- * defined a 1026 value table and interpolation will be used
- */
+/* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */
+/* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not
+ * defined a 1026 value table and interpolation will be used
+ */
#ifndef BIG_IQ_TABLE
- static const real_t errcorr[] =
- {
- REAL_CONST(0), REAL_CONST(1.0 / 8.0), REAL_CONST(2.0 / 8.0), REAL_CONST(3.0 / 8.0),
- REAL_CONST(4.0 / 8.0), REAL_CONST(5.0 / 8.0), REAL_CONST(6.0 / 8.0), REAL_CONST(7.0 / 8.0),
+ static const real_t errcorr[] = {
+ REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0),
+ REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0),
REAL_CONST(0)
};
real_t x1, x2;
#endif
int16_t sgn = 1;
- if(q < 0)
+ if (q < 0)
{
q = -q;
sgn = -1;
}
- if(q < IQ_TABLE_SIZE)
+ if (q < IQ_TABLE_SIZE)
{
//#define IQUANT_PRINT
#ifdef IQUANT_PRINT
@@ -475,7 +462,7 @@ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
}
#ifndef BIG_IQ_TABLE
- if(q >= 8192)
+ if (q >= 8192)
{
*error = 17;
return 0;
@@ -484,26 +471,24 @@ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
/* linear interpolation */
x1 = tab[q>>3];
x2 = tab[(q>>3) + 1];
- return sgn * 16 * (MUL_R(errcorr[q&7], (x2 - x1)) + x1);
+ return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1);
#else
*error = 17;
return 0;
#endif
#else
- if(q < 0)
+ if (q < 0)
{
/* tab contains a value for all possible q [0,8192] */
- if(-q < IQ_TABLE_SIZE)
+ if (-q < IQ_TABLE_SIZE)
return -tab[-q];
*error = 17;
return 0;
- }
- else
- {
+ } else {
/* tab contains a value for all possible q [0,8192] */
- if(q < IQ_TABLE_SIZE)
+ if (q < IQ_TABLE_SIZE)
return tab[q];
*error = 17;
@@ -513,8 +498,7 @@ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
}
#ifndef FIXED_POINT
-ALIGN static const real_t pow2sf_tab[] =
-{
+ALIGN static const real_t pow2sf_tab[] = {
2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007,
2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007,
1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006,
@@ -585,13 +569,13 @@ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder,
k = 0;
gindex = 0;
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
uint16_t j = 0;
uint16_t gincrease = 0;
uint16_t win_inc = ics->swb_offset[ics->num_swb];
- for(sfb = 0; sfb < ics->num_swb; sfb++)
+ for (sfb = 0; sfb < ics->num_swb; sfb++)
{
int32_t exp, frac;
@@ -599,13 +583,11 @@ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder,
/* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */
/* just ignore them */
- if(ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255)
+ if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255)
{
exp = 0;
frac = 0;
- }
- else
- {
+ } else {
/* ics->scale_factors[g][sfb] must be between 0 and 255 */
exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2;
/* frac must always be > 0 */
@@ -615,13 +597,11 @@ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder,
#ifdef FIXED_POINT
exp -= 25;
/* IMDCT pre-scaling */
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
{
exp -= 6 /*9*/;
- }
- else
- {
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ } else {
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
exp -= 4 /*7*/;
else
exp -= 7 /*10*/;
@@ -634,18 +614,18 @@ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder,
scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac];
#endif
- for(win = 0; win < ics->window_group_length[g]; win++)
+ for (win = 0; win < ics->window_group_length[g]; win++)
{
- for(bin = 0; bin < width; bin += 4)
+ for (bin = 0; bin < width; bin += 4)
{
#ifndef FIXED_POINT
wb = wa + bin;
spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf;
- spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf;
- spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf;
+ spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf;
+ spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf;
spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf;
-
+
#else
real_t iq0 = iquant(quant_data[k+0], tab, &error);
real_t iq1 = iquant(quant_data[k+1], tab, &error);
@@ -654,26 +634,24 @@ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder,
wb = wa + bin;
- if(exp < 0)
+ if (exp < 0)
{
spec_data[wb+0] = iq0 >>= -exp;
spec_data[wb+1] = iq1 >>= -exp;
spec_data[wb+2] = iq2 >>= -exp;
spec_data[wb+3] = iq3 >>= -exp;
- }
- else
- {
+ } else {
spec_data[wb+0] = iq0 <<= exp;
spec_data[wb+1] = iq1 <<= exp;
spec_data[wb+2] = iq2 <<= exp;
spec_data[wb+3] = iq3 <<= exp;
}
- if(frac != 0)
+ if (frac != 0)
{
- spec_data[wb+0] = MUL_C(spec_data[wb+0], pow2_table[frac]);
- spec_data[wb+1] = MUL_C(spec_data[wb+1], pow2_table[frac]);
- spec_data[wb+2] = MUL_C(spec_data[wb+2], pow2_table[frac]);
- spec_data[wb+3] = MUL_C(spec_data[wb+3], pow2_table[frac]);
+ spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]);
+ spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]);
+ spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]);
+ spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]);
}
//#define SCFS_PRINT
@@ -709,10 +687,10 @@ static uint8_t allocate_single_channel(NeAACDecStruct *hDecoder, uint8_t channel
#ifdef MAIN_DEC
/* MAIN object type prediction */
- if(hDecoder->object_type == MAIN)
+ if (hDecoder->object_type == MAIN)
{
/* allocate the state only when needed */
- if(hDecoder->pred_stat[channel] != NULL)
+ if (hDecoder->pred_stat[channel] != NULL)
{
faad_free(hDecoder->pred_stat[channel]);
hDecoder->pred_stat[channel] = NULL;
@@ -724,21 +702,21 @@ static uint8_t allocate_single_channel(NeAACDecStruct *hDecoder, uint8_t channel
#endif
#ifdef LTP_DEC
- if(is_ltp_ot(hDecoder->object_type))
+ if (is_ltp_ot(hDecoder->object_type))
{
/* allocate the state only when needed */
- if(hDecoder->lt_pred_stat[channel] != NULL)
+ if (hDecoder->lt_pred_stat[channel] != NULL)
{
faad_free(hDecoder->lt_pred_stat[channel]);
hDecoder->lt_pred_stat[channel] = NULL;
}
- hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength * 4 * sizeof(int16_t));
- memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength * 4 * sizeof(int16_t));
+ hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+ memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
}
#endif
- if(hDecoder->time_out[channel] != NULL)
+ if (hDecoder->time_out[channel] != NULL)
{
faad_free(hDecoder->time_out[channel]);
hDecoder->time_out[channel] = NULL;
@@ -748,53 +726,53 @@ static uint8_t allocate_single_channel(NeAACDecStruct *hDecoder, uint8_t channel
mul = 1;
#ifdef SBR_DEC
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
- if((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
{
/* SBR requires 2 times as much output data */
mul = 2;
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
}
#endif
- hDecoder->time_out[channel] = (real_t*)faad_malloc(mul * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->time_out[channel], 0, mul * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
}
#if (defined(PS_DEC) || defined(DRM_PS))
- if(output_channels == 2)
+ if (output_channels == 2)
{
- if(hDecoder->time_out[channel+1] != NULL)
+ if (hDecoder->time_out[channel+1] != NULL)
{
faad_free(hDecoder->time_out[channel+1]);
hDecoder->time_out[channel+1] = NULL;
}
- hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->time_out[channel+1], 0, mul * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t));
}
#endif
- if(hDecoder->fb_intermed[channel] != NULL)
+ if (hDecoder->fb_intermed[channel] != NULL)
{
faad_free(hDecoder->fb_intermed[channel]);
hDecoder->fb_intermed[channel] = NULL;
}
- hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength * sizeof(real_t));
+ hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
#ifdef SSR_DEC
- if(hDecoder->object_type == SSR)
+ if (hDecoder->object_type == SSR)
{
- if(hDecoder->ssr_overlap[channel] == NULL)
+ if (hDecoder->ssr_overlap[channel] == NULL)
{
- hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2 * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->ssr_overlap[channel], 0, 2 * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
}
- if(hDecoder->prev_fmd[channel] == NULL)
+ if (hDecoder->prev_fmd[channel] == NULL)
{
uint16_t k;
- hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2 * hDecoder->frameLength * sizeof(real_t));
- for(k = 0; k < 2 * hDecoder->frameLength; k++)
+ hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ for (k = 0; k < 2*hDecoder->frameLength; k++)
hDecoder->prev_fmd[channel][k] = REAL_CONST(-1);
}
}
@@ -810,15 +788,15 @@ static uint8_t allocate_channel_pair(NeAACDecStruct *hDecoder,
#ifdef MAIN_DEC
/* MAIN object type prediction */
- if(hDecoder->object_type == MAIN)
+ if (hDecoder->object_type == MAIN)
{
/* allocate the state only when needed */
- if(hDecoder->pred_stat[channel] == NULL)
+ if (hDecoder->pred_stat[channel] == NULL)
{
hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
}
- if(hDecoder->pred_stat[paired_channel] == NULL)
+ if (hDecoder->pred_stat[paired_channel] == NULL)
{
hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength);
@@ -827,79 +805,79 @@ static uint8_t allocate_channel_pair(NeAACDecStruct *hDecoder,
#endif
#ifdef LTP_DEC
- if(is_ltp_ot(hDecoder->object_type))
+ if (is_ltp_ot(hDecoder->object_type))
{
/* allocate the state only when needed */
- if(hDecoder->lt_pred_stat[channel] == NULL)
+ if (hDecoder->lt_pred_stat[channel] == NULL)
{
- hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength * 4 * sizeof(int16_t));
- memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength * 4 * sizeof(int16_t));
+ hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+ memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
}
- if(hDecoder->lt_pred_stat[paired_channel] == NULL)
+ if (hDecoder->lt_pred_stat[paired_channel] == NULL)
{
- hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength * 4 * sizeof(int16_t));
- memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength * 4 * sizeof(int16_t));
+ hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+ memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
}
}
#endif
- if(hDecoder->time_out[channel] == NULL)
+ if (hDecoder->time_out[channel] == NULL)
{
mul = 1;
#ifdef SBR_DEC
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
- if((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
{
/* SBR requires 2 times as much output data */
mul = 2;
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
}
#endif
- hDecoder->time_out[channel] = (real_t*)faad_malloc(mul * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->time_out[channel], 0, mul * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
}
- if(hDecoder->time_out[paired_channel] == NULL)
+ if (hDecoder->time_out[paired_channel] == NULL)
{
- hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->time_out[paired_channel], 0, mul * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
}
- if(hDecoder->fb_intermed[channel] == NULL)
+ if (hDecoder->fb_intermed[channel] == NULL)
{
- hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength * sizeof(real_t));
+ hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
}
- if(hDecoder->fb_intermed[paired_channel] == NULL)
+ if (hDecoder->fb_intermed[paired_channel] == NULL)
{
- hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength * sizeof(real_t));
+ hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t));
}
#ifdef SSR_DEC
- if(hDecoder->object_type == SSR)
+ if (hDecoder->object_type == SSR)
{
- if(hDecoder->ssr_overlap[cpe->channel] == NULL)
+ if (hDecoder->ssr_overlap[cpe->channel] == NULL)
{
- hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2 * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->ssr_overlap[cpe->channel], 0, 2 * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
}
- if(hDecoder->ssr_overlap[cpe->paired_channel] == NULL)
+ if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL)
{
- hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2 * hDecoder->frameLength * sizeof(real_t));
- memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2 * hDecoder->frameLength * sizeof(real_t));
+ hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
}
- if(hDecoder->prev_fmd[cpe->channel] == NULL)
+ if (hDecoder->prev_fmd[cpe->channel] == NULL)
{
uint16_t k;
- hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2 * hDecoder->frameLength * sizeof(real_t));
- for(k = 0; k < 2 * hDecoder->frameLength; k++)
+ hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ for (k = 0; k < 2*hDecoder->frameLength; k++)
hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1);
}
- if(hDecoder->prev_fmd[cpe->paired_channel] == NULL)
+ if (hDecoder->prev_fmd[cpe->paired_channel] == NULL)
{
uint16_t k;
- hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2 * hDecoder->frameLength * sizeof(real_t));
- for(k = 0; k < 2 * hDecoder->frameLength; k++)
+ hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ for (k = 0; k < 2*hDecoder->frameLength; k++)
hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1);
}
}
@@ -924,7 +902,7 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
#if ( (defined(DRM) && defined(DRM_PS)) )
output_channels = 2;
#elif defined(PS_DEC)
- if(hDecoder->ps_used[hDecoder->fr_ch_ele])
+ if (hDecoder->ps_used[hDecoder->fr_ch_ele])
output_channels = 2;
else
output_channels = 1;
@@ -932,13 +910,11 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
output_channels = 1;
#endif
- if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
{
/* element_output_channels not set yet */
hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
- }
- else if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels)
- {
+ } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
/* element inconsistency */
/* this only happens if PS is actually found but not in the first frame
@@ -953,10 +929,10 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
//return 21;
}
- if(hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
+ if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
{
retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
- if(retval > 0)
+ if (retval > 0)
return retval;
hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
@@ -965,7 +941,7 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
/* dequantisation and scaling */
retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength);
- if(retval > 0)
+ if (retval > 0)
return retval;
#ifdef PROFILE
@@ -976,18 +952,18 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
/* pns decoding */
pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type,
- &(hDecoder->__r1), &(hDecoder->__r2));
+ &(hDecoder->__r1), &(hDecoder->__r2));
#ifdef MAIN_DEC
/* MAIN object type prediction */
- if(hDecoder->object_type == MAIN)
+ if (hDecoder->object_type == MAIN)
{
- if(!hDecoder->pred_stat[sce->channel])
- return 33;
+ if (!hDecoder->pred_stat[sce->channel])
+ return 33;
/* intra channel prediction */
ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength,
- hDecoder->sf_index);
+ hDecoder->sf_index);
/* In addition, for scalefactor bands coded by perceptual
noise substitution the predictors belonging to the
@@ -998,14 +974,14 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
#endif
#ifdef LTP_DEC
- if(is_ltp_ot(hDecoder->object_type))
+ if (is_ltp_ot(hDecoder->object_type))
{
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
{
- if(ics->ltp.data_present)
+ if (ics->ltp.data_present)
{
- if(ics->ltp.lag_update)
+ if (ics->ltp.lag_update)
hDecoder->ltp_lag[sce->channel] = ics->ltp.lag;
}
ics->ltp.lag = hDecoder->ltp_lag[sce->channel];
@@ -1014,39 +990,37 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
/* long term prediction */
lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb,
- ics->window_shape, hDecoder->window_shape_prev[sce->channel],
- hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+ ics->window_shape, hDecoder->window_shape_prev[sce->channel],
+ hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
}
#endif
/* tns decoding */
tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type,
- spec_coef, hDecoder->frameLength);
+ spec_coef, hDecoder->frameLength);
/* drc decoding */
- if(hDecoder->drc->present)
+ if (hDecoder->drc->present)
{
- if(!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present)
+ if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present)
drc_decode(hDecoder->drc, spec_coef);
}
/* filter bank */
#ifdef SSR_DEC
- if(hDecoder->object_type != SSR)
+ if (hDecoder->object_type != SSR)
{
#endif
ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape,
- hDecoder->window_shape_prev[sce->channel], spec_coef,
- hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel],
- hDecoder->object_type, hDecoder->frameLength);
+ hDecoder->window_shape_prev[sce->channel], spec_coef,
+ hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel],
+ hDecoder->object_type, hDecoder->frameLength);
#ifdef SSR_DEC
- }
- else
- {
+ } else {
ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape,
- hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel],
- hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel],
- hDecoder->frameLength);
+ hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel],
+ hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel],
+ hDecoder->frameLength);
}
#endif
@@ -1054,58 +1028,55 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
hDecoder->window_shape_prev[sce->channel] = ics->window_shape;
#ifdef LTP_DEC
- if(is_ltp_ot(hDecoder->object_type))
+ if (is_ltp_ot(hDecoder->object_type))
{
lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel],
- hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type);
+ hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type);
}
#endif
#ifdef SBR_DEC
- if(((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
- && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
{
int ele = hDecoder->fr_ch_ele;
int ch = sce->channel;
/* following case can happen when forceUpSampling == 1 */
- if(hDecoder->sbr[ele] == NULL)
+ if (hDecoder->sbr[ele] == NULL)
{
hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
- hDecoder->element_id[ele], 2 * get_sample_rate(hDecoder->sf_index),
- hDecoder->downSampledSBR
+ hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+ hDecoder->downSampledSBR
#ifdef DRM
- , 0
+ , 0
#endif
- );
+ );
}
- if(sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
- hDecoder->sbr[ele]->maxAACLine = 8 * min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max);
+ if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+ hDecoder->sbr[ele]->maxAACLine = 8*min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max);
else
hDecoder->sbr[ele]->maxAACLine = min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max);
/* check if any of the PS tools is used */
#if (defined(PS_DEC) || defined(DRM_PS))
- if(hDecoder->ps_used[ele] == 0)
+ if (hDecoder->ps_used[ele] == 0)
{
#endif
retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch],
- hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
+ hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
#if (defined(PS_DEC) || defined(DRM_PS))
- }
- else
- {
+ } else {
retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch],
- hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag,
- hDecoder->downSampledSBR);
+ hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag,
+ hDecoder->downSampledSBR);
}
#endif
- if(retval > 0)
+ if (retval > 0)
return retval;
- }
- else if(((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
- && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
{
return 23;
}
@@ -1113,13 +1084,13 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics,
/* copy L to R when no PS is used */
#if (defined(PS_DEC) || defined(DRM_PS))
- if((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) &&
- (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2))
+ if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) &&
+ (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2))
{
int ele = hDecoder->fr_ch_ele;
int ch = sce->channel;
int frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1;
- frame_size *= hDecoder->frameLength * sizeof(real_t);
+ frame_size *= hDecoder->frameLength*sizeof(real_t);
memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
}
@@ -1138,10 +1109,10 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
- if(hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
+ if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
{
retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel);
- if(retval > 0)
+ if (retval > 0)
return retval;
hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
@@ -1149,10 +1120,10 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
/* dequantisation and scaling */
retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength);
- if(retval > 0)
+ if (retval > 0)
return retval;
retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength);
- if(retval > 0)
+ if (retval > 0)
return retval;
#ifdef PROFILE
@@ -1162,17 +1133,15 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
/* pns decoding */
- if(ics1->ms_mask_present)
+ if (ics1->ms_mask_present)
{
pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type,
- &(hDecoder->__r1), &(hDecoder->__r2));
- }
- else
- {
+ &(hDecoder->__r1), &(hDecoder->__r2));
+ } else {
pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type,
- &(hDecoder->__r1), &(hDecoder->__r2));
+ &(hDecoder->__r1), &(hDecoder->__r2));
pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type,
- &(hDecoder->__r1), &(hDecoder->__r2));
+ &(hDecoder->__r1), &(hDecoder->__r2));
}
/* mid/side decoding */
@@ -1181,12 +1150,12 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
#if 0
{
int i;
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
//printf("%d\n", spec_coef1[i]);
printf("0x%.8X\n", spec_coef1[i]);
}
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
//printf("%d\n", spec_coef2[i]);
printf("0x%.8X\n", spec_coef2[i]);
@@ -1200,12 +1169,12 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
#if 0
{
int i;
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
printf("%d\n", spec_coef1[i]);
//printf("0x%.8X\n", spec_coef1[i]);
}
- for(i = 0; i < 1024; i++)
+ for (i = 0; i < 1024; i++)
{
printf("%d\n", spec_coef2[i]);
//printf("0x%.8X\n", spec_coef2[i]);
@@ -1215,13 +1184,13 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
#ifdef MAIN_DEC
/* MAIN object type prediction */
- if(hDecoder->object_type == MAIN)
+ if (hDecoder->object_type == MAIN)
{
/* intra channel prediction */
ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength,
- hDecoder->sf_index);
+ hDecoder->sf_index);
ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength,
- hDecoder->sf_index);
+ hDecoder->sf_index);
/* In addition, for scalefactor bands coded by perceptual
noise substitution the predictors belonging to the
@@ -1233,22 +1202,22 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
#endif
#ifdef LTP_DEC
- if(is_ltp_ot(hDecoder->object_type))
+ if (is_ltp_ot(hDecoder->object_type))
{
ltp_info *ltp1 = &(ics1->ltp);
ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp);
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
{
- if(ltp1->data_present)
+ if (ltp1->data_present)
{
- if(ltp1->lag_update)
+ if (ltp1->lag_update)
hDecoder->ltp_lag[cpe->channel] = ltp1->lag;
}
ltp1->lag = hDecoder->ltp_lag[cpe->channel];
- if(ltp2->data_present)
+ if (ltp2->data_present)
{
- if(ltp2->lag_update)
+ if (ltp2->lag_update)
hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag;
}
ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel];
@@ -1257,54 +1226,52 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
/* long term prediction */
lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb,
- ics1->window_shape, hDecoder->window_shape_prev[cpe->channel],
- hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+ ics1->window_shape, hDecoder->window_shape_prev[cpe->channel],
+ hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb,
- ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel],
- hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+ ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel],
+ hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
}
#endif
/* tns decoding */
tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type,
- spec_coef1, hDecoder->frameLength);
+ spec_coef1, hDecoder->frameLength);
tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type,
- spec_coef2, hDecoder->frameLength);
+ spec_coef2, hDecoder->frameLength);
/* drc decoding */
- if(hDecoder->drc->present)
+ if (hDecoder->drc->present)
{
- if(!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present)
+ if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present)
drc_decode(hDecoder->drc, spec_coef1);
- if(!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present)
+ if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present)
drc_decode(hDecoder->drc, spec_coef2);
}
/* filter bank */
#ifdef SSR_DEC
- if(hDecoder->object_type != SSR)
+ if (hDecoder->object_type != SSR)
{
#endif
ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape,
- hDecoder->window_shape_prev[cpe->channel], spec_coef1,
- hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel],
- hDecoder->object_type, hDecoder->frameLength);
+ hDecoder->window_shape_prev[cpe->channel], spec_coef1,
+ hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel],
+ hDecoder->object_type, hDecoder->frameLength);
ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape,
- hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
- hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel],
- hDecoder->object_type, hDecoder->frameLength);
+ hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
+ hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel],
+ hDecoder->object_type, hDecoder->frameLength);
#ifdef SSR_DEC
- }
- else
- {
+ } else {
ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape,
- hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel],
- hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel],
- hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength);
+ hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel],
+ hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel],
+ hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength);
ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape,
- hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel],
- hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel],
- hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength);
+ hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel],
+ hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel],
+ hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength);
}
#endif
@@ -1313,48 +1280,47 @@ uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_s
hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape;
#ifdef LTP_DEC
- if(is_ltp_ot(hDecoder->object_type))
+ if (is_ltp_ot(hDecoder->object_type))
{
lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel],
- hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type);
+ hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type);
lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel],
- hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type);
+ hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type);
}
#endif
#ifdef SBR_DEC
- if(((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
- && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
{
int ele = hDecoder->fr_ch_ele;
int ch0 = cpe->channel;
int ch1 = cpe->paired_channel;
/* following case can happen when forceUpSampling == 1 */
- if(hDecoder->sbr[ele] == NULL)
+ if (hDecoder->sbr[ele] == NULL)
{
hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
- hDecoder->element_id[ele], 2 * get_sample_rate(hDecoder->sf_index),
- hDecoder->downSampledSBR
+ hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+ hDecoder->downSampledSBR
#ifdef DRM
- , 0
+ , 0
#endif
- );
+ );
}
- if(cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
- hDecoder->sbr[ele]->maxAACLine = 8 * min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max);
+ if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+ hDecoder->sbr[ele]->maxAACLine = 8*min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max);
else
hDecoder->sbr[ele]->maxAACLine = min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max);
retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele],
- hDecoder->time_out[ch0], hDecoder->time_out[ch1],
- hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
- if(retval > 0)
+ hDecoder->time_out[ch0], hDecoder->time_out[ch1],
+ hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
+ if (retval > 0)
return retval;
- }
- else if(((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
- && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
{
return 23;
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.h
index e81537e14..5f42e2cfe 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/specrec.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -37,11 +37,11 @@ extern "C" {
#include "syntax.h"
- uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics);
- uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2,
- element *cpe, int16_t *spec_data1, int16_t *spec_data2);
- uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce,
- int16_t *spec_data);
+uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics);
+uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2,
+ element *cpe, int16_t *spec_data1, int16_t *spec_data2);
+uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce,
+ int16_t *spec_data);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.c
index fe87d2f4f..368112407 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -45,18 +45,18 @@ void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
real_t *prev_fmd, uint16_t frame_len)
{
uint8_t band;
- uint16_t ssr_frame_len = frame_len / SSR_BANDS;
+ uint16_t ssr_frame_len = frame_len/SSR_BANDS;
real_t time_tmp[2048] = {0};
real_t output[1024] = {0};
- for(band = 0; band < SSR_BANDS; band++)
+ for (band = 0; band < SSR_BANDS; band++)
{
int16_t j;
/* uneven bands have inverted frequency scale */
- if(band == 1 || band == 3)
+ if (band == 1 || band == 3)
{
- for(j = 0; j < ssr_frame_len / 2; j++)
+ for (j = 0; j < ssr_frame_len/2; j++)
{
real_t tmp;
tmp = freq_in[j + ssr_frame_len*band];
@@ -68,12 +68,12 @@ void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
/* non-overlapping inverse filterbank for SSR */
ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev,
- freq_in + band * ssr_frame_len, time_tmp + band * ssr_frame_len,
- ssr_frame_len);
+ freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len,
+ ssr_frame_len);
/* gain control */
ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd,
- band, window_sequence, ssr_frame_len);
+ band, window_sequence, ssr_frame_len);
}
/* inverse pqf to bring subbands together again */
@@ -87,51 +87,49 @@ static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
uint16_t i;
real_t gc_function[2*1024/SSR_BANDS];
- if(window_sequence != EIGHT_SHORT_SEQUENCE)
+ if (window_sequence != EIGHT_SHORT_SEQUENCE)
{
ssr_gc_function(ssr, &prev_fmd[band * frame_len*2],
- gc_function, window_sequence, band, frame_len);
+ gc_function, window_sequence, band, frame_len);
- for(i = 0; i < frame_len * 2; i++)
+ for (i = 0; i < frame_len*2; i++)
data[band * frame_len*2 + i] *= gc_function[i];
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
output[band*frame_len + i] = overlap[band*frame_len + i] +
- data[band*frame_len*2 + i];
+ data[band*frame_len*2 + i];
}
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
{
overlap[band*frame_len + i] =
data[band*frame_len*2 + frame_len + i];
}
- }
- else
- {
+ } else {
uint8_t w;
- for(w = 0; w < 8; w++)
+ for (w = 0; w < 8; w++)
{
- uint16_t frame_len8 = frame_len / 8;
- uint16_t frame_len16 = frame_len / 16;
+ uint16_t frame_len8 = frame_len/8;
+ uint16_t frame_len16 = frame_len/16;
ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8],
- gc_function, window_sequence, frame_len);
+ gc_function, window_sequence, frame_len);
- for(i = 0; i < frame_len8 * 2; i++)
+ for (i = 0; i < frame_len8*2; i++)
data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i];
- for(i = 0; i < frame_len8; i++)
+ for (i = 0; i < frame_len8; i++)
{
overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] +=
data[band*frame_len*2 + 2*w*frame_len8 + i];
}
- for(i = 0; i < frame_len8; i++)
+ for (i = 0; i < frame_len8; i++)
{
overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] =
data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i];
}
}
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
output[band*frame_len + i] = overlap[band*frame_len + i];
- for(i = 0; i < frame_len; i++)
+ for (i = 0; i < frame_len; i++)
overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len];
}
}
@@ -145,22 +143,22 @@ static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
int32_t aloc[10];
real_t alev[10];
- switch(window_sequence)
+ switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
- len_area1 = frame_len / SSR_BANDS;
+ len_area1 = frame_len/SSR_BANDS;
len_area2 = 0;
break;
case LONG_START_SEQUENCE:
- len_area1 = (frame_len / SSR_BANDS) * 7 / 32;
- len_area2 = (frame_len / SSR_BANDS) / 16;
+ len_area1 = (frame_len/SSR_BANDS)*7/32;
+ len_area2 = (frame_len/SSR_BANDS)/16;
break;
case EIGHT_SHORT_SEQUENCE:
- len_area1 = (frame_len / 8) / SSR_BANDS;
+ len_area1 = (frame_len/8)/SSR_BANDS;
len_area2 = 0;
break;
case LONG_STOP_SEQUENCE:
- len_area1 = (frame_len / SSR_BANDS);
+ len_area1 = (frame_len/SSR_BANDS);
len_area2 = 0;
break;
}
@@ -170,7 +168,7 @@ static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
/* build array M */
- for(i = 0; i < frame_len * 2; i++)
+ for (i = 0; i < frame_len*2; i++)
gc_function[i] = 1;
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.h
index 065f9a2e5..7adcf2a11 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -38,19 +38,19 @@ extern "C" {
#define SSR_BANDS 4
#define PQFTAPS 96
- void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
- uint8_t window_shape, uint8_t window_shape_prev,
- real_t *freq_in, real_t *time_out, real_t *overlap,
- real_t ipqf_buffer[SSR_BANDS][96/4],
- real_t *prev_fmd, uint16_t frame_len);
+void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
+ uint8_t window_shape, uint8_t window_shape_prev,
+ real_t *freq_in, real_t *time_out, real_t *overlap,
+ real_t ipqf_buffer[SSR_BANDS][96/4],
+ real_t *prev_fmd, uint16_t frame_len);
- static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
- real_t *overlap, real_t *prev_fmd, uint8_t band,
- uint8_t window_sequence, uint16_t frame_len);
- static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
- real_t *gc_function, uint8_t window_sequence,
- uint16_t frame_len);
+static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
+ real_t *overlap, real_t *prev_fmd, uint8_t band,
+ uint8_t window_sequence, uint16_t frame_len);
+static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
+ real_t *gc_function, uint8_t window_sequence,
+ uint16_t frame_len);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.c
index 1fdf09f8d..a977c9411 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -43,14 +43,14 @@
fb_info *ssr_filter_bank_init(uint16_t frame_len)
{
- uint16_t nshort = frame_len / 8;
+ uint16_t nshort = frame_len/8;
fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
memset(fb, 0, sizeof(fb_info));
/* normal */
- fb->mdct256 = faad_mdct_init(2 * nshort);
- fb->mdct2048 = faad_mdct_init(2 * frame_len);
+ fb->mdct256 = faad_mdct_init(2*nshort);
+ fb->mdct2048 = faad_mdct_init(2*frame_len);
fb->long_window[0] = sine_long_256;
fb->short_window[0] = sine_short_32;
@@ -65,7 +65,7 @@ void ssr_filter_bank_end(fb_info *fb)
faad_mdct_end(fb->mdct256);
faad_mdct_end(fb->mdct2048);
- if(fb) faad_free(fb);
+ if (fb) faad_free(fb);
}
static INLINE void imdct_ssr(fb_info *fb, real_t *in_data,
@@ -73,7 +73,7 @@ static INLINE void imdct_ssr(fb_info *fb, real_t *in_data,
{
mdct_info *mdct;
- switch(len)
+ switch (len)
{
case 512:
mdct = fb->mdct2048;
@@ -100,82 +100,82 @@ void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape
real_t *window_short_prev;
uint16_t nlong = frame_len;
- uint16_t nshort = frame_len / 8;
- uint16_t trans = nshort / 2;
+ uint16_t nshort = frame_len/8;
+ uint16_t trans = nshort/2;
- uint16_t nflat_ls = (nlong - nshort) / 2;
+ uint16_t nflat_ls = (nlong-nshort)/2;
- transf_buf = (real_t*)faad_malloc(2 * nlong * sizeof(real_t));
+ transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t));
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
window_short = fb->short_window[window_shape];
window_short_prev = fb->short_window[window_shape_prev];
- switch(window_sequence)
+ switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
- imdct_ssr(fb, freq_in, transf_buf, 2 * nlong);
- for(i = nlong - 1; i >= 0; i--)
+ imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+ for (i = nlong-1; i >= 0; i--)
{
- time_out[i] = MUL_R_C(transf_buf[i], window_long_prev[i]);
- time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i], window_long[nlong-1-i]);
+ time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]);
+ time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
}
break;
case LONG_START_SEQUENCE:
- imdct_ssr(fb, freq_in, transf_buf, 2 * nlong);
- for(i = 0; i < nlong; i++)
- time_out[i] = MUL_R_C(transf_buf[i], window_long_prev[i]);
- for(i = 0; i < nflat_ls; i++)
+ imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+ for (i = 0; i < nlong; i++)
+ time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
time_out[nlong+i] = transf_buf[nlong+i];
- for(i = 0; i < nshort; i++)
- time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i], window_short[nshort-i-1]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nshort; i++)
+ time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+ for (i = 0; i < nflat_ls; i++)
time_out[nlong+nflat_ls+nshort+i] = 0;
break;
case EIGHT_SHORT_SEQUENCE:
- imdct_ssr(fb, freq_in + 0 * nshort, transf_buf + 2 * nshort * 0, 2 * nshort);
- imdct_ssr(fb, freq_in + 1 * nshort, transf_buf + 2 * nshort * 1, 2 * nshort);
- imdct_ssr(fb, freq_in + 2 * nshort, transf_buf + 2 * nshort * 2, 2 * nshort);
- imdct_ssr(fb, freq_in + 3 * nshort, transf_buf + 2 * nshort * 3, 2 * nshort);
- imdct_ssr(fb, freq_in + 4 * nshort, transf_buf + 2 * nshort * 4, 2 * nshort);
- imdct_ssr(fb, freq_in + 5 * nshort, transf_buf + 2 * nshort * 5, 2 * nshort);
- imdct_ssr(fb, freq_in + 6 * nshort, transf_buf + 2 * nshort * 6, 2 * nshort);
- imdct_ssr(fb, freq_in + 7 * nshort, transf_buf + 2 * nshort * 7, 2 * nshort);
- for(i = nshort - 1; i >= 0; i--)
+ imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort);
+ imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort);
+ imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort);
+ imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort);
+ imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort);
+ imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort);
+ imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort);
+ imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort);
+ for(i = nshort-1; i >= 0; i--)
{
- time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i], window_short_prev[i]);
- time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i], window_short[i]);
- time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i], window_short_prev[i]);
- time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i], window_short[i]);
- time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i], window_short_prev[i]);
- time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i], window_short[i]);
- time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i], window_short_prev[i]);
- time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i], window_short[i]);
- time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i], window_short_prev[i]);
- time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i], window_short[i]);
- time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i], window_short_prev[i]);
- time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i], window_short[i]);
- time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i], window_short_prev[i]);
- time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i], window_short[i]);
- time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i], window_short_prev[i]);
- time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i], window_short[i]);
+ time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]);
+ time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]);
+ time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]);
+ time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]);
+ time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]);
+ time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]);
+ time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]);
+ time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]);
+ time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]);
+ time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]);
+ time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]);
+ time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]);
+ time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]);
+ time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]);
+ time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]);
+ time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]);
}
break;
case LONG_STOP_SEQUENCE:
- imdct_ssr(fb, freq_in, transf_buf, 2 * nlong);
- for(i = 0; i < nflat_ls; i++)
+ imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+ for (i = 0; i < nflat_ls; i++)
time_out[i] = 0;
- for(i = 0; i < nshort; i++)
- time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i], window_short_prev[i]);
- for(i = 0; i < nflat_ls; i++)
+ for (i = 0; i < nshort; i++)
+ time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i];
- for(i = 0; i < nlong; i++)
- time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i], window_long[nlong-1-i]);
- break;
+ for (i = 0; i < nlong; i++)
+ time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+ break;
}
faad_free(transf_buf);
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.h
index 71402248b..3ae4eb04b 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_fb.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,17 +35,17 @@
extern "C" {
#endif
- fb_info *ssr_filter_bank_init(uint16_t frame_len);
- void ssr_filter_bank_end(fb_info *fb);
+fb_info *ssr_filter_bank_init(uint16_t frame_len);
+void ssr_filter_bank_end(fb_info *fb);
- /*non overlapping inverse filterbank */
- void ssr_ifilter_bank(fb_info *fb,
- uint8_t window_sequence,
- uint8_t window_shape,
- uint8_t window_shape_prev,
- real_t *freq_in,
- real_t *time_out,
- uint16_t frame_len);
+/*non overlapping inverse filterbank */
+void ssr_ifilter_bank(fb_info *fb,
+ uint8_t window_sequence,
+ uint8_t window_shape,
+ uint8_t window_shape_prev,
+ real_t *freq_in,
+ real_t *time_out,
+ uint16_t frame_len);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.c
index 08649c982..6963427c9 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -59,10 +59,10 @@ void gc_set_protopqf(real_t *p_proto)
-2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02,
-1.5122066420044672E-02, -1.7971713448186293E-03, 1.6903413428575379E-02,
3.9672315874127042E-02, 6.4487527248102796E-02, 8.8850025474701726E-02,
- 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012
+ 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012
};
- for(j = 0; j < 48; ++j)
+ for (j = 0; j < 48; ++j)
{
p_proto[j] = p_proto[95-j] = a_half[j];
}
@@ -80,18 +80,18 @@ void gc_setcoef_eff_pqfsyn(int mm,
/* Set 1st Mul&Acc Coef's */
*ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *));
- for(n = 0; n < mm; ++n)
+ for (n = 0; n < mm; ++n)
{
(*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t));
}
- for(n = 0; n < mm / 2; ++n)
+ for (n = 0; n < mm/2; ++n)
{
- for(i = 0; i < mm; ++i)
+ for (i = 0; i < mm; ++i)
{
- w = (2 * i + 1) * (2 * n + 1 - mm) * M_PI / (4 * mm);
+ w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm);
(*ppp_q0)[n][i] = 2.0 * cos((real_t) w);
- w = (2 * i + 1) * (2 * (mm + n) + 1 - mm) * M_PI / (4 * mm);
+ w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm);
(*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w);
}
}
@@ -99,19 +99,19 @@ void gc_setcoef_eff_pqfsyn(int mm,
/* Set 2nd Mul&Acc Coef's */
*ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *));
*ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *));
- for(n = 0; n < mm; ++n)
+ for (n = 0; n < mm; ++n)
{
(*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t));
(*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t));
}
- for(n = 0; n < mm; ++n)
+ for (n = 0; n < mm; ++n)
{
- for(k = 0; k < kk; ++k)
+ for (k = 0; k < kk; ++k)
{
(*ppp_t0)[n][k] = mm * p_proto[2*k *mm + n];
(*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n];
- if(k % 2 != 0)
+ if (k%2 != 0)
{
(*ppp_t0)[n][k] = -(*ppp_t0)[n][k];
(*ppp_t1)[n][k] = -(*ppp_t1)[n][k];
@@ -129,57 +129,57 @@ void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
int i;
- if(initFlag == 0)
+ if (initFlag == 0)
{
gc_set_protopqf(a_pqfproto);
- gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS / (2 * SSR_BANDS), a_pqfproto,
- &pp_q0, &pp_t0, &pp_t1);
+ gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto,
+ &pp_q0, &pp_t0, &pp_t1);
initFlag = 1;
}
- for(i = 0; i < frame_len / SSR_BANDS; i++)
+ for (i = 0; i < frame_len / SSR_BANDS; i++)
{
int l, n, k;
int mm = SSR_BANDS;
- int kk = PQFTAPS / (2 * SSR_BANDS);
+ int kk = PQFTAPS/(2*SSR_BANDS);
- for(n = 0; n < mm; n++)
+ for (n = 0; n < mm; n++)
{
- for(k = 0; k < 2 * kk - 1; k++)
+ for (k = 0; k < 2*kk-1; k++)
{
buffer[n][k] = buffer[n][k+1];
}
}
- for(n = 0; n < mm; n++)
+ for (n = 0; n < mm; n++)
{
real_t acc = 0.0;
- for(l = 0; l < mm; l++)
+ for (l = 0; l < mm; l++)
{
acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i];
}
buffer[n][2*kk-1] = acc;
}
- for(n = 0; n < mm / 2; n++)
+ for (n = 0; n < mm/2; n++)
{
real_t acc = 0.0;
- for(k = 0; k < kk; k++)
+ for (k = 0; k < kk; k++)
{
acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k];
}
- for(k = 0; k < kk; ++k)
+ for (k = 0; k < kk; ++k)
{
acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k];
}
out_data[i*SSR_BANDS + n] = acc;
acc = 0.0;
- for(k = 0; k < kk; k++)
+ for (k = 0; k < kk; k++)
{
acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k];
}
- for(k = 0; k < kk; k++)
+ for (k = 0; k < kk; k++)
{
acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k];
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.h
index 7b6e36e91..47299219c 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_ipqf.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -35,9 +35,9 @@
extern "C" {
#endif
- void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
- real_t buffer[SSR_BANDS][96/4],
- uint16_t frame_len, uint8_t bands);
+void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
+ real_t buffer[SSR_BANDS][96/4],
+ uint16_t frame_len, uint8_t bands);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_win.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_win.h
index e346b1bb8..64b0f98bf 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_win.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/ssr_win.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -40,598 +40,594 @@ extern "C" {
#pragma warning(disable:4244)
#endif
- static real_t sine_short_32[] =
- {
- 0.0245412290,
- 0.0735645667,
- 0.1224106774,
- 0.1709618866,
- 0.2191012502,
- 0.2667127550,
- 0.3136817515,
- 0.3598950505,
- 0.4052413106,
- 0.4496113360,
- 0.4928981960,
- 0.5349976420,
- 0.5758082271,
- 0.6152316332,
- 0.6531728506,
- 0.6895405650,
- 0.7242470980,
- 0.7572088838,
- 0.7883464694,
- 0.8175848126,
- 0.8448535800,
- 0.8700870275,
- 0.8932242990,
- 0.9142097831,
- 0.9329928160,
- 0.9495282173,
- 0.9637760520,
- 0.9757021666,
- 0.9852776527,
- 0.9924795628,
- 0.9972904325,
- 0.9996988177
- };
+static real_t sine_short_32[] = {
+ 0.0245412290,
+ 0.0735645667,
+ 0.1224106774,
+ 0.1709618866,
+ 0.2191012502,
+ 0.2667127550,
+ 0.3136817515,
+ 0.3598950505,
+ 0.4052413106,
+ 0.4496113360,
+ 0.4928981960,
+ 0.5349976420,
+ 0.5758082271,
+ 0.6152316332,
+ 0.6531728506,
+ 0.6895405650,
+ 0.7242470980,
+ 0.7572088838,
+ 0.7883464694,
+ 0.8175848126,
+ 0.8448535800,
+ 0.8700870275,
+ 0.8932242990,
+ 0.9142097831,
+ 0.9329928160,
+ 0.9495282173,
+ 0.9637760520,
+ 0.9757021666,
+ 0.9852776527,
+ 0.9924795628,
+ 0.9972904325,
+ 0.9996988177
+};
- static real_t sine_long_256[] =
- {
- 0.0030679568,
- 0.0092037553,
- 0.0153392069,
- 0.0214740802,
- 0.0276081469,
- 0.0337411724,
- 0.0398729295,
- 0.0460031852,
- 0.0521317050,
- 0.0582582653,
- 0.0643826351,
- 0.0705045760,
- 0.0766238645,
- 0.0827402696,
- 0.0888535529,
- 0.0949634984,
- 0.1010698676,
- 0.1071724296,
- 0.1132709533,
- 0.1193652153,
- 0.1254549921,
- 0.1315400302,
- 0.1376201212,
- 0.1436950415,
- 0.1497645378,
- 0.1558284014,
- 0.1618863940,
- 0.1679383069,
- 0.1739838719,
- 0.1800229102,
- 0.1860551536,
- 0.1920804083,
- 0.1980984211,
- 0.2041089684,
- 0.2101118416,
- 0.2161068022,
- 0.2220936269,
- 0.2280720919,
- 0.2340419590,
- 0.2400030345,
- 0.2459550500,
- 0.2518978119,
- 0.2578310966,
- 0.2637546957,
- 0.2696683407,
- 0.2755718231,
- 0.2814649343,
- 0.2873474658,
- 0.2932191789,
- 0.2990798354,
- 0.3049292266,
- 0.3107671738,
- 0.3165933788,
- 0.3224076927,
- 0.3282098472,
- 0.3339996636,
- 0.3397769034,
- 0.3455413282,
- 0.3512927592,
- 0.3570309579,
- 0.3627557456,
- 0.3684668541,
- 0.3741640747,
- 0.3798472285,
- 0.3855160773,
- 0.3911703825,
- 0.3968099952,
- 0.4024346471,
- 0.4080441594,
- 0.4136383235,
- 0.4192169011,
- 0.4247796834,
- 0.4303264916,
- 0.4358570874,
- 0.4413712919,
- 0.4468688369,
- 0.4523496032,
- 0.4578133225,
- 0.4632597864,
- 0.4686888456,
- 0.4741002321,
- 0.4794937670,
- 0.4848692715,
- 0.4902265072,
- 0.4955652654,
- 0.5008853674,
- 0.5061866641,
- 0.5114688873,
- 0.5167317986,
- 0.5219752789,
- 0.5271991491,
- 0.5324031115,
- 0.5375871062,
- 0.5427507758,
- 0.5478940606,
- 0.5530167222,
- 0.5581185222,
- 0.5631993413,
- 0.5682589412,
- 0.5732972026,
- 0.5783138275,
- 0.5833086967,
- 0.5882815719,
- 0.5932323337,
- 0.5981607437,
- 0.6030666232,
- 0.6079497933,
- 0.6128100753,
- 0.6176473498,
- 0.6224613190,
- 0.6272518039,
- 0.6320187449,
- 0.6367619038,
- 0.6414810419,
- 0.6461760402,
- 0.6508467197,
- 0.6554928422,
- 0.6601143479,
- 0.6647109985,
- 0.6692826152,
- 0.6738290191,
- 0.6783500314,
- 0.6828455329,
- 0.6873153448,
- 0.6917592883,
- 0.6961771250,
- 0.7005687952,
- 0.7049341202,
- 0.7092728615,
- 0.7135848999,
- 0.7178700566,
- 0.7221282125,
- 0.7263591886,
- 0.7305628061,
- 0.7347388864,
- 0.7388873696,
- 0.7430079579,
- 0.7471006513,
- 0.7511651516,
- 0.7552013993,
- 0.7592092156,
- 0.7631884217,
- 0.7671388984,
- 0.7710605264,
- 0.7749531269,
- 0.7788165212,
- 0.7826505899,
- 0.7864552140,
- 0.7902302146,
- 0.7939754725,
- 0.7976908684,
- 0.8013761640,
- 0.8050313592,
- 0.8086562157,
- 0.8122506142,
- 0.8158144355,
- 0.8193475604,
- 0.8228498101,
- 0.8263210654,
- 0.8297612667,
- 0.8331701756,
- 0.8365477324,
- 0.8398938179,
- 0.8432082534,
- 0.8464909792,
- 0.8497417569,
- 0.8529606462,
- 0.8561473489,
- 0.8593018055,
- 0.8624239564,
- 0.8655136228,
- 0.8685707450,
- 0.8715950847,
- 0.8745866418,
- 0.8775452971,
- 0.8804709315,
- 0.8833633661,
- 0.8862225413,
- 0.8890483975,
- 0.8918406963,
- 0.8945994973,
- 0.8973246217,
- 0.9000158906,
- 0.9026733041,
- 0.9052967429,
- 0.9078861475,
- 0.9104412794,
- 0.9129621983,
- 0.9154487252,
- 0.9179008007,
- 0.9203183055,
- 0.9227011204,
- 0.9250492454,
- 0.9273625612,
- 0.9296408892,
- 0.9318842888,
- 0.9340925813,
- 0.9362657070,
- 0.9384035468,
- 0.9405061007,
- 0.9425731897,
- 0.9446048737,
- 0.9466009140,
- 0.9485613704,
- 0.9504860640,
- 0.9523749948,
- 0.9542281032,
- 0.9560452700,
- 0.9578264356,
- 0.9595715404,
- 0.9612805247,
- 0.9629532695,
- 0.9645897746,
- 0.9661900401,
- 0.9677538276,
- 0.9692812562,
- 0.9707721472,
- 0.9722265005,
- 0.9736442566,
- 0.9750253558,
- 0.9763697386,
- 0.9776773453,
- 0.9789481759,
- 0.9801821709,
- 0.9813792109,
- 0.9825392962,
- 0.9836624265,
- 0.9847484827,
- 0.9857975245,
- 0.9868094325,
- 0.9877841473,
- 0.9887216687,
- 0.9896219969,
- 0.9904850721,
- 0.9913108945,
- 0.9920993447,
- 0.9928504229,
- 0.9935641289,
- 0.9942404628,
- 0.9948793054,
- 0.9954807758,
- 0.9960446954,
- 0.9965711236,
- 0.9970600605,
- 0.9975114465,
- 0.9979252815,
- 0.9983015656,
- 0.9986402392,
- 0.9989413023,
- 0.9992047548,
- 0.9994305968,
- 0.9996188283,
- 0.9997693896,
- 0.9998823404,
- 0.9999576211,
- 0.9999952912
- };
+static real_t sine_long_256[] = {
+ 0.0030679568,
+ 0.0092037553,
+ 0.0153392069,
+ 0.0214740802,
+ 0.0276081469,
+ 0.0337411724,
+ 0.0398729295,
+ 0.0460031852,
+ 0.0521317050,
+ 0.0582582653,
+ 0.0643826351,
+ 0.0705045760,
+ 0.0766238645,
+ 0.0827402696,
+ 0.0888535529,
+ 0.0949634984,
+ 0.1010698676,
+ 0.1071724296,
+ 0.1132709533,
+ 0.1193652153,
+ 0.1254549921,
+ 0.1315400302,
+ 0.1376201212,
+ 0.1436950415,
+ 0.1497645378,
+ 0.1558284014,
+ 0.1618863940,
+ 0.1679383069,
+ 0.1739838719,
+ 0.1800229102,
+ 0.1860551536,
+ 0.1920804083,
+ 0.1980984211,
+ 0.2041089684,
+ 0.2101118416,
+ 0.2161068022,
+ 0.2220936269,
+ 0.2280720919,
+ 0.2340419590,
+ 0.2400030345,
+ 0.2459550500,
+ 0.2518978119,
+ 0.2578310966,
+ 0.2637546957,
+ 0.2696683407,
+ 0.2755718231,
+ 0.2814649343,
+ 0.2873474658,
+ 0.2932191789,
+ 0.2990798354,
+ 0.3049292266,
+ 0.3107671738,
+ 0.3165933788,
+ 0.3224076927,
+ 0.3282098472,
+ 0.3339996636,
+ 0.3397769034,
+ 0.3455413282,
+ 0.3512927592,
+ 0.3570309579,
+ 0.3627557456,
+ 0.3684668541,
+ 0.3741640747,
+ 0.3798472285,
+ 0.3855160773,
+ 0.3911703825,
+ 0.3968099952,
+ 0.4024346471,
+ 0.4080441594,
+ 0.4136383235,
+ 0.4192169011,
+ 0.4247796834,
+ 0.4303264916,
+ 0.4358570874,
+ 0.4413712919,
+ 0.4468688369,
+ 0.4523496032,
+ 0.4578133225,
+ 0.4632597864,
+ 0.4686888456,
+ 0.4741002321,
+ 0.4794937670,
+ 0.4848692715,
+ 0.4902265072,
+ 0.4955652654,
+ 0.5008853674,
+ 0.5061866641,
+ 0.5114688873,
+ 0.5167317986,
+ 0.5219752789,
+ 0.5271991491,
+ 0.5324031115,
+ 0.5375871062,
+ 0.5427507758,
+ 0.5478940606,
+ 0.5530167222,
+ 0.5581185222,
+ 0.5631993413,
+ 0.5682589412,
+ 0.5732972026,
+ 0.5783138275,
+ 0.5833086967,
+ 0.5882815719,
+ 0.5932323337,
+ 0.5981607437,
+ 0.6030666232,
+ 0.6079497933,
+ 0.6128100753,
+ 0.6176473498,
+ 0.6224613190,
+ 0.6272518039,
+ 0.6320187449,
+ 0.6367619038,
+ 0.6414810419,
+ 0.6461760402,
+ 0.6508467197,
+ 0.6554928422,
+ 0.6601143479,
+ 0.6647109985,
+ 0.6692826152,
+ 0.6738290191,
+ 0.6783500314,
+ 0.6828455329,
+ 0.6873153448,
+ 0.6917592883,
+ 0.6961771250,
+ 0.7005687952,
+ 0.7049341202,
+ 0.7092728615,
+ 0.7135848999,
+ 0.7178700566,
+ 0.7221282125,
+ 0.7263591886,
+ 0.7305628061,
+ 0.7347388864,
+ 0.7388873696,
+ 0.7430079579,
+ 0.7471006513,
+ 0.7511651516,
+ 0.7552013993,
+ 0.7592092156,
+ 0.7631884217,
+ 0.7671388984,
+ 0.7710605264,
+ 0.7749531269,
+ 0.7788165212,
+ 0.7826505899,
+ 0.7864552140,
+ 0.7902302146,
+ 0.7939754725,
+ 0.7976908684,
+ 0.8013761640,
+ 0.8050313592,
+ 0.8086562157,
+ 0.8122506142,
+ 0.8158144355,
+ 0.8193475604,
+ 0.8228498101,
+ 0.8263210654,
+ 0.8297612667,
+ 0.8331701756,
+ 0.8365477324,
+ 0.8398938179,
+ 0.8432082534,
+ 0.8464909792,
+ 0.8497417569,
+ 0.8529606462,
+ 0.8561473489,
+ 0.8593018055,
+ 0.8624239564,
+ 0.8655136228,
+ 0.8685707450,
+ 0.8715950847,
+ 0.8745866418,
+ 0.8775452971,
+ 0.8804709315,
+ 0.8833633661,
+ 0.8862225413,
+ 0.8890483975,
+ 0.8918406963,
+ 0.8945994973,
+ 0.8973246217,
+ 0.9000158906,
+ 0.9026733041,
+ 0.9052967429,
+ 0.9078861475,
+ 0.9104412794,
+ 0.9129621983,
+ 0.9154487252,
+ 0.9179008007,
+ 0.9203183055,
+ 0.9227011204,
+ 0.9250492454,
+ 0.9273625612,
+ 0.9296408892,
+ 0.9318842888,
+ 0.9340925813,
+ 0.9362657070,
+ 0.9384035468,
+ 0.9405061007,
+ 0.9425731897,
+ 0.9446048737,
+ 0.9466009140,
+ 0.9485613704,
+ 0.9504860640,
+ 0.9523749948,
+ 0.9542281032,
+ 0.9560452700,
+ 0.9578264356,
+ 0.9595715404,
+ 0.9612805247,
+ 0.9629532695,
+ 0.9645897746,
+ 0.9661900401,
+ 0.9677538276,
+ 0.9692812562,
+ 0.9707721472,
+ 0.9722265005,
+ 0.9736442566,
+ 0.9750253558,
+ 0.9763697386,
+ 0.9776773453,
+ 0.9789481759,
+ 0.9801821709,
+ 0.9813792109,
+ 0.9825392962,
+ 0.9836624265,
+ 0.9847484827,
+ 0.9857975245,
+ 0.9868094325,
+ 0.9877841473,
+ 0.9887216687,
+ 0.9896219969,
+ 0.9904850721,
+ 0.9913108945,
+ 0.9920993447,
+ 0.9928504229,
+ 0.9935641289,
+ 0.9942404628,
+ 0.9948793054,
+ 0.9954807758,
+ 0.9960446954,
+ 0.9965711236,
+ 0.9970600605,
+ 0.9975114465,
+ 0.9979252815,
+ 0.9983015656,
+ 0.9986402392,
+ 0.9989413023,
+ 0.9992047548,
+ 0.9994305968,
+ 0.9996188283,
+ 0.9997693896,
+ 0.9998823404,
+ 0.9999576211,
+ 0.9999952912
+};
- static real_t kbd_short_32[] =
- {
- 0.0000875914060105,
- 0.0009321760265333,
- 0.0032114611466596,
- 0.0081009893216786,
- 0.0171240286619181,
- 0.0320720743527833,
- 0.0548307856028528,
- 0.0871361822564870,
- 0.1302923415174603,
- 0.1848955425508276,
- 0.2506163195331889,
- 0.3260874142923209,
- 0.4089316830907141,
- 0.4959414909423747,
- 0.5833939894958904,
- 0.6674601983218376,
- 0.7446454751465113,
- 0.8121892962974020,
- 0.8683559394406505,
- 0.9125649996381605,
- 0.9453396205809574,
- 0.9680864942677585,
- 0.9827581789763112,
- 0.9914756203467121,
- 0.9961964092194694,
- 0.9984956609571091,
- 0.9994855586984285,
- 0.9998533730714648,
- 0.9999671864476404,
- 0.9999948432453556,
- 0.9999995655238333,
- 0.9999999961638728
- };
+static real_t kbd_short_32[] = {
+ 0.0000875914060105,
+ 0.0009321760265333,
+ 0.0032114611466596,
+ 0.0081009893216786,
+ 0.0171240286619181,
+ 0.0320720743527833,
+ 0.0548307856028528,
+ 0.0871361822564870,
+ 0.1302923415174603,
+ 0.1848955425508276,
+ 0.2506163195331889,
+ 0.3260874142923209,
+ 0.4089316830907141,
+ 0.4959414909423747,
+ 0.5833939894958904,
+ 0.6674601983218376,
+ 0.7446454751465113,
+ 0.8121892962974020,
+ 0.8683559394406505,
+ 0.9125649996381605,
+ 0.9453396205809574,
+ 0.9680864942677585,
+ 0.9827581789763112,
+ 0.9914756203467121,
+ 0.9961964092194694,
+ 0.9984956609571091,
+ 0.9994855586984285,
+ 0.9998533730714648,
+ 0.9999671864476404,
+ 0.9999948432453556,
+ 0.9999995655238333,
+ 0.9999999961638728
+};
- static real_t kbd_long_256[] =
- {
- 0.0005851230124487,
- 0.0009642149851497,
- 0.0013558207534965,
- 0.0017771849644394,
- 0.0022352533849672,
- 0.0027342299070304,
- 0.0032773001022195,
- 0.0038671998069216,
- 0.0045064443384152,
- 0.0051974336885144,
- 0.0059425050016407,
- 0.0067439602523141,
- 0.0076040812644888,
- 0.0085251378135895,
- 0.0095093917383048,
- 0.0105590986429280,
- 0.0116765080854300,
- 0.0128638627792770,
- 0.0141233971318631,
- 0.0154573353235409,
- 0.0168678890600951,
- 0.0183572550877256,
- 0.0199276125319803,
- 0.0215811201042484,
- 0.0233199132076965,
- 0.0251461009666641,
- 0.0270617631981826,
- 0.0290689473405856,
- 0.0311696653515848,
- 0.0333658905863535,
- 0.0356595546648444,
- 0.0380525443366107,
- 0.0405466983507029,
- 0.0431438043376910,
- 0.0458455957104702,
- 0.0486537485902075,
- 0.0515698787635492,
- 0.0545955386770205,
- 0.0577322144743916,
- 0.0609813230826460,
- 0.0643442093520723,
- 0.0678221432558827,
- 0.0714163171546603,
- 0.0751278431308314,
- 0.0789577503982528,
- 0.0829069827918993,
- 0.0869763963425241,
- 0.0911667569410503,
- 0.0954787380973307,
- 0.0999129187977865,
- 0.1044697814663005,
- 0.1091497100326053,
- 0.1139529881122542,
- 0.1188797973021148,
- 0.1239302155951605,
- 0.1291042159181728,
- 0.1344016647957880,
- 0.1398223211441467,
- 0.1453658351972151,
- 0.1510317475686540,
- 0.1568194884519144,
- 0.1627283769610327,
- 0.1687576206143887,
- 0.1749063149634756,
- 0.1811734433685097,
- 0.1875578769224857,
- 0.1940583745250518,
- 0.2006735831073503,
- 0.2074020380087318,
- 0.2142421635060113,
- 0.2211922734956977,
- 0.2282505723293797,
- 0.2354151558022098,
- 0.2426840122941792,
- 0.2500550240636293,
- 0.2575259686921987,
- 0.2650945206801527,
- 0.2727582531907993,
- 0.2805146399424422,
- 0.2883610572460804,
- 0.2962947861868143,
- 0.3043130149466800,
- 0.3124128412663888,
- 0.3205912750432127,
- 0.3288452410620226,
- 0.3371715818562547,
- 0.3455670606953511,
- 0.3540283646950029,
- 0.3625521080463003,
- 0.3711348353596863,
- 0.3797730251194006,
- 0.3884630932439016,
- 0.3972013967475546,
- 0.4059842374986933,
- 0.4148078660689724,
- 0.4236684856687616,
- 0.4325622561631607,
- 0.4414852981630577,
- 0.4504336971855032,
- 0.4594035078775303,
- 0.4683907582974173,
- 0.4773914542472655,
- 0.4864015836506502,
- 0.4954171209689973,
- 0.5044340316502417,
- 0.5134482766032377,
- 0.5224558166913167,
- 0.5314526172383208,
- 0.5404346525403849,
- 0.5493979103766972,
- 0.5583383965124314,
- 0.5672521391870222,
- 0.5761351935809411,
- 0.5849836462541291,
- 0.5937936195492526,
- 0.6025612759529649,
- 0.6112828224083939,
- 0.6199545145721097,
- 0.6285726610088878,
- 0.6371336273176413,
- 0.6456338401819751,
- 0.6540697913388968,
- 0.6624380414593221,
- 0.6707352239341151,
- 0.6789580485595255,
- 0.6871033051160131,
- 0.6951678668345944,
- 0.7031486937449871,
- 0.7110428359000029,
- 0.7188474364707993,
- 0.7265597347077880,
- 0.7341770687621900,
- 0.7416968783634273,
- 0.7491167073477523,
- 0.7564342060337386,
- 0.7636471334404891,
- 0.7707533593446514,
- 0.7777508661725849,
- 0.7846377507242818,
- 0.7914122257259034,
- 0.7980726212080798,
- 0.8046173857073919,
- 0.8110450872887550,
- 0.8173544143867162,
- 0.8235441764639875,
- 0.8296133044858474,
- 0.8355608512093652,
- 0.8413859912867303,
- 0.8470880211822968,
- 0.8526663589032990,
- 0.8581205435445334,
- 0.8634502346476508,
- 0.8686552113760616,
- 0.8737353715068081,
- 0.8786907302411250,
- 0.8835214188357692,
- 0.8882276830575707,
- 0.8928098814640207,
- 0.8972684835130879,
- 0.9016040675058185,
- 0.9058173183656508,
- 0.9099090252587376,
- 0.9138800790599416,
- 0.9177314696695282,
- 0.9214642831859411,
- 0.9250796989403991,
- 0.9285789863994010,
- 0.9319635019415643,
- 0.9352346855155568,
- 0.9383940571861993,
- 0.9414432135761304,
- 0.9443838242107182,
- 0.9472176277741918,
- 0.9499464282852282,
- 0.9525720912004834,
- 0.9550965394547873,
- 0.9575217494469370,
- 0.9598497469802043,
- 0.9620826031668507,
- 0.9642224303060783,
- 0.9662713777449607,
- 0.9682316277319895,
- 0.9701053912729269,
- 0.9718949039986892,
- 0.9736024220549734,
- 0.9752302180233160,
- 0.9767805768831932,
- 0.9782557920246753,
- 0.9796581613210076,
- 0.9809899832703159,
- 0.9822535532154261,
- 0.9834511596505429,
- 0.9845850806232530,
- 0.9856575802399989,
- 0.9866709052828243,
- 0.9876272819448033,
- 0.9885289126911557,
- 0.9893779732525968,
- 0.9901766097569984,
- 0.9909269360049311,
- 0.9916310308941294,
- 0.9922909359973702,
- 0.9929086532976777,
- 0.9934861430841844,
- 0.9940253220113651,
- 0.9945280613237534,
- 0.9949961852476154,
- 0.9954314695504363,
- 0.9958356402684387,
- 0.9962103726017252,
- 0.9965572899760172,
- 0.9968779632693499,
- 0.9971739102014799,
- 0.9974465948831872,
- 0.9976974275220812,
- 0.9979277642809907,
- 0.9981389072844972,
- 0.9983321047686901,
- 0.9985085513687731,
- 0.9986693885387259,
- 0.9988157050968516,
- 0.9989485378906924,
- 0.9990688725744943,
- 0.9991776444921379,
- 0.9992757396582338,
- 0.9993639958299003,
- 0.9994432036616085,
- 0.9995141079353859,
- 0.9995774088586188,
- 0.9996337634216871,
- 0.9996837868076957,
- 0.9997280538466377,
- 0.9997671005064359,
- 0.9998014254134544,
- 0.9998314913952471,
- 0.9998577270385304,
- 0.9998805282555989,
- 0.9999002598526793,
- 0.9999172570940037,
- 0.9999318272557038,
- 0.9999442511639580,
- 0.9999547847121726,
- 0.9999636603523446,
- 0.9999710885561258,
- 0.9999772592414866,
- 0.9999823431612708,
- 0.9999864932503106,
- 0.9999898459281599,
- 0.9999925223548691,
- 0.9999946296375997,
- 0.9999962619864214,
- 0.9999975018180320,
- 0.9999984208055542,
- 0.9999990808746198,
- 0.9999995351446231,
- 0.9999998288155155
- };
+static real_t kbd_long_256[] = {
+ 0.0005851230124487,
+ 0.0009642149851497,
+ 0.0013558207534965,
+ 0.0017771849644394,
+ 0.0022352533849672,
+ 0.0027342299070304,
+ 0.0032773001022195,
+ 0.0038671998069216,
+ 0.0045064443384152,
+ 0.0051974336885144,
+ 0.0059425050016407,
+ 0.0067439602523141,
+ 0.0076040812644888,
+ 0.0085251378135895,
+ 0.0095093917383048,
+ 0.0105590986429280,
+ 0.0116765080854300,
+ 0.0128638627792770,
+ 0.0141233971318631,
+ 0.0154573353235409,
+ 0.0168678890600951,
+ 0.0183572550877256,
+ 0.0199276125319803,
+ 0.0215811201042484,
+ 0.0233199132076965,
+ 0.0251461009666641,
+ 0.0270617631981826,
+ 0.0290689473405856,
+ 0.0311696653515848,
+ 0.0333658905863535,
+ 0.0356595546648444,
+ 0.0380525443366107,
+ 0.0405466983507029,
+ 0.0431438043376910,
+ 0.0458455957104702,
+ 0.0486537485902075,
+ 0.0515698787635492,
+ 0.0545955386770205,
+ 0.0577322144743916,
+ 0.0609813230826460,
+ 0.0643442093520723,
+ 0.0678221432558827,
+ 0.0714163171546603,
+ 0.0751278431308314,
+ 0.0789577503982528,
+ 0.0829069827918993,
+ 0.0869763963425241,
+ 0.0911667569410503,
+ 0.0954787380973307,
+ 0.0999129187977865,
+ 0.1044697814663005,
+ 0.1091497100326053,
+ 0.1139529881122542,
+ 0.1188797973021148,
+ 0.1239302155951605,
+ 0.1291042159181728,
+ 0.1344016647957880,
+ 0.1398223211441467,
+ 0.1453658351972151,
+ 0.1510317475686540,
+ 0.1568194884519144,
+ 0.1627283769610327,
+ 0.1687576206143887,
+ 0.1749063149634756,
+ 0.1811734433685097,
+ 0.1875578769224857,
+ 0.1940583745250518,
+ 0.2006735831073503,
+ 0.2074020380087318,
+ 0.2142421635060113,
+ 0.2211922734956977,
+ 0.2282505723293797,
+ 0.2354151558022098,
+ 0.2426840122941792,
+ 0.2500550240636293,
+ 0.2575259686921987,
+ 0.2650945206801527,
+ 0.2727582531907993,
+ 0.2805146399424422,
+ 0.2883610572460804,
+ 0.2962947861868143,
+ 0.3043130149466800,
+ 0.3124128412663888,
+ 0.3205912750432127,
+ 0.3288452410620226,
+ 0.3371715818562547,
+ 0.3455670606953511,
+ 0.3540283646950029,
+ 0.3625521080463003,
+ 0.3711348353596863,
+ 0.3797730251194006,
+ 0.3884630932439016,
+ 0.3972013967475546,
+ 0.4059842374986933,
+ 0.4148078660689724,
+ 0.4236684856687616,
+ 0.4325622561631607,
+ 0.4414852981630577,
+ 0.4504336971855032,
+ 0.4594035078775303,
+ 0.4683907582974173,
+ 0.4773914542472655,
+ 0.4864015836506502,
+ 0.4954171209689973,
+ 0.5044340316502417,
+ 0.5134482766032377,
+ 0.5224558166913167,
+ 0.5314526172383208,
+ 0.5404346525403849,
+ 0.5493979103766972,
+ 0.5583383965124314,
+ 0.5672521391870222,
+ 0.5761351935809411,
+ 0.5849836462541291,
+ 0.5937936195492526,
+ 0.6025612759529649,
+ 0.6112828224083939,
+ 0.6199545145721097,
+ 0.6285726610088878,
+ 0.6371336273176413,
+ 0.6456338401819751,
+ 0.6540697913388968,
+ 0.6624380414593221,
+ 0.6707352239341151,
+ 0.6789580485595255,
+ 0.6871033051160131,
+ 0.6951678668345944,
+ 0.7031486937449871,
+ 0.7110428359000029,
+ 0.7188474364707993,
+ 0.7265597347077880,
+ 0.7341770687621900,
+ 0.7416968783634273,
+ 0.7491167073477523,
+ 0.7564342060337386,
+ 0.7636471334404891,
+ 0.7707533593446514,
+ 0.7777508661725849,
+ 0.7846377507242818,
+ 0.7914122257259034,
+ 0.7980726212080798,
+ 0.8046173857073919,
+ 0.8110450872887550,
+ 0.8173544143867162,
+ 0.8235441764639875,
+ 0.8296133044858474,
+ 0.8355608512093652,
+ 0.8413859912867303,
+ 0.8470880211822968,
+ 0.8526663589032990,
+ 0.8581205435445334,
+ 0.8634502346476508,
+ 0.8686552113760616,
+ 0.8737353715068081,
+ 0.8786907302411250,
+ 0.8835214188357692,
+ 0.8882276830575707,
+ 0.8928098814640207,
+ 0.8972684835130879,
+ 0.9016040675058185,
+ 0.9058173183656508,
+ 0.9099090252587376,
+ 0.9138800790599416,
+ 0.9177314696695282,
+ 0.9214642831859411,
+ 0.9250796989403991,
+ 0.9285789863994010,
+ 0.9319635019415643,
+ 0.9352346855155568,
+ 0.9383940571861993,
+ 0.9414432135761304,
+ 0.9443838242107182,
+ 0.9472176277741918,
+ 0.9499464282852282,
+ 0.9525720912004834,
+ 0.9550965394547873,
+ 0.9575217494469370,
+ 0.9598497469802043,
+ 0.9620826031668507,
+ 0.9642224303060783,
+ 0.9662713777449607,
+ 0.9682316277319895,
+ 0.9701053912729269,
+ 0.9718949039986892,
+ 0.9736024220549734,
+ 0.9752302180233160,
+ 0.9767805768831932,
+ 0.9782557920246753,
+ 0.9796581613210076,
+ 0.9809899832703159,
+ 0.9822535532154261,
+ 0.9834511596505429,
+ 0.9845850806232530,
+ 0.9856575802399989,
+ 0.9866709052828243,
+ 0.9876272819448033,
+ 0.9885289126911557,
+ 0.9893779732525968,
+ 0.9901766097569984,
+ 0.9909269360049311,
+ 0.9916310308941294,
+ 0.9922909359973702,
+ 0.9929086532976777,
+ 0.9934861430841844,
+ 0.9940253220113651,
+ 0.9945280613237534,
+ 0.9949961852476154,
+ 0.9954314695504363,
+ 0.9958356402684387,
+ 0.9962103726017252,
+ 0.9965572899760172,
+ 0.9968779632693499,
+ 0.9971739102014799,
+ 0.9974465948831872,
+ 0.9976974275220812,
+ 0.9979277642809907,
+ 0.9981389072844972,
+ 0.9983321047686901,
+ 0.9985085513687731,
+ 0.9986693885387259,
+ 0.9988157050968516,
+ 0.9989485378906924,
+ 0.9990688725744943,
+ 0.9991776444921379,
+ 0.9992757396582338,
+ 0.9993639958299003,
+ 0.9994432036616085,
+ 0.9995141079353859,
+ 0.9995774088586188,
+ 0.9996337634216871,
+ 0.9996837868076957,
+ 0.9997280538466377,
+ 0.9997671005064359,
+ 0.9998014254134544,
+ 0.9998314913952471,
+ 0.9998577270385304,
+ 0.9998805282555989,
+ 0.9999002598526793,
+ 0.9999172570940037,
+ 0.9999318272557038,
+ 0.9999442511639580,
+ 0.9999547847121726,
+ 0.9999636603523446,
+ 0.9999710885561258,
+ 0.9999772592414866,
+ 0.9999823431612708,
+ 0.9999864932503106,
+ 0.9999898459281599,
+ 0.9999925223548691,
+ 0.9999946296375997,
+ 0.9999962619864214,
+ 0.9999975018180320,
+ 0.9999984208055542,
+ 0.9999990808746198,
+ 0.9999995351446231,
+ 0.9999998288155155
+};
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/structs.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/structs.h
index faf03226a..9357c60cd 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/structs.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/structs.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -47,398 +47,395 @@ extern "C" {
#define MAX_LTP_SFB 40
#define MAX_LTP_SFB_S 8
- /* used to save the prediction state */
- typedef struct
- {
- int16_t r[2];
- int16_t COR[2];
- int16_t VAR[2];
- } pred_state;
-
- typedef struct
- {
- uint16_t N;
- cfft_info *cfft;
- complex_t *sincos;
+/* used to save the prediction state */
+typedef struct {
+ int16_t r[2];
+ int16_t COR[2];
+ int16_t VAR[2];
+} pred_state;
+
+typedef struct {
+ uint16_t N;
+ cfft_info *cfft;
+ complex_t *sincos;
#ifdef PROFILE
- int64_t cycles;
- int64_t fft_cycles;
+ int64_t cycles;
+ int64_t fft_cycles;
#endif
- } mdct_info;
+} mdct_info;
- typedef struct
- {
- const real_t *long_window[2];
- const real_t *short_window[2];
+typedef struct
+{
+ const real_t *long_window[2];
+ const real_t *short_window[2];
#ifdef LD_DEC
- const real_t *ld_window[2];
+ const real_t *ld_window[2];
#endif
- mdct_info *mdct256;
+ mdct_info *mdct256;
#ifdef LD_DEC
- mdct_info *mdct1024;
+ mdct_info *mdct1024;
#endif
- mdct_info *mdct2048;
+ mdct_info *mdct2048;
#ifdef PROFILE
- int64_t cycles;
+ int64_t cycles;
#endif
- } fb_info;
-
- typedef struct
- {
- uint8_t present;
-
- uint8_t num_bands;
- uint8_t pce_instance_tag;
- uint8_t excluded_chns_present;
- uint8_t band_top[17];
- uint8_t prog_ref_level;
- uint8_t dyn_rng_sgn[17];
- uint8_t dyn_rng_ctl[17];
- uint8_t exclude_mask[MAX_CHANNELS];
- uint8_t additional_excluded_chns[MAX_CHANNELS];
-
- real_t ctrl1;
- real_t ctrl2;
- } drc_info;
-
- typedef struct
- {
- uint8_t element_instance_tag;
- uint8_t object_type;
- uint8_t sf_index;
- uint8_t num_front_channel_elements;
- uint8_t num_side_channel_elements;
- uint8_t num_back_channel_elements;
- uint8_t num_lfe_channel_elements;
- uint8_t num_assoc_data_elements;
- uint8_t num_valid_cc_elements;
- uint8_t mono_mixdown_present;
- uint8_t mono_mixdown_element_number;
- uint8_t stereo_mixdown_present;
- uint8_t stereo_mixdown_element_number;
- uint8_t matrix_mixdown_idx_present;
- uint8_t pseudo_surround_enable;
- uint8_t matrix_mixdown_idx;
- uint8_t front_element_is_cpe[16];
- uint8_t front_element_tag_select[16];
- uint8_t side_element_is_cpe[16];
- uint8_t side_element_tag_select[16];
- uint8_t back_element_is_cpe[16];
- uint8_t back_element_tag_select[16];
- uint8_t lfe_element_tag_select[16];
- uint8_t assoc_data_element_tag_select[16];
- uint8_t cc_element_is_ind_sw[16];
- uint8_t valid_cc_element_tag_select[16];
-
- uint8_t channels;
-
- uint8_t comment_field_bytes;
- uint8_t comment_field_data[257];
-
- /* extra added values */
- uint8_t num_front_channels;
- uint8_t num_side_channels;
- uint8_t num_back_channels;
- uint8_t num_lfe_channels;
- uint8_t sce_channel[16];
- uint8_t cpe_channel[16];
- } program_config;
-
- typedef struct
- {
- uint16_t syncword;
- uint8_t id;
- uint8_t layer;
- uint8_t protection_absent;
- uint8_t profile;
- uint8_t sf_index;
- uint8_t private_bit;
- uint8_t channel_configuration;
- uint8_t original;
- uint8_t home;
- uint8_t emphasis;
- uint8_t copyright_identification_bit;
- uint8_t copyright_identification_start;
- uint16_t aac_frame_length;
- uint16_t adts_buffer_fullness;
- uint8_t no_raw_data_blocks_in_frame;
- uint16_t crc_check;
-
- /* control param */
- uint8_t old_format;
- } adts_header;
-
- typedef struct
- {
- uint8_t copyright_id_present;
- int8_t copyright_id[10];
- uint8_t original_copy;
- uint8_t home;
- uint8_t bitstream_type;
- uint32_t bitrate;
- uint8_t num_program_config_elements;
- uint32_t adif_buffer_fullness;
-
- /* maximum of 16 PCEs */
- program_config pce[16];
- } adif_header;
+} fb_info;
+
+typedef struct
+{
+ uint8_t present;
+
+ uint8_t num_bands;
+ uint8_t pce_instance_tag;
+ uint8_t excluded_chns_present;
+ uint8_t band_top[17];
+ uint8_t prog_ref_level;
+ uint8_t dyn_rng_sgn[17];
+ uint8_t dyn_rng_ctl[17];
+ uint8_t exclude_mask[MAX_CHANNELS];
+ uint8_t additional_excluded_chns[MAX_CHANNELS];
+
+ real_t ctrl1;
+ real_t ctrl2;
+} drc_info;
+
+typedef struct
+{
+ uint8_t element_instance_tag;
+ uint8_t object_type;
+ uint8_t sf_index;
+ uint8_t num_front_channel_elements;
+ uint8_t num_side_channel_elements;
+ uint8_t num_back_channel_elements;
+ uint8_t num_lfe_channel_elements;
+ uint8_t num_assoc_data_elements;
+ uint8_t num_valid_cc_elements;
+ uint8_t mono_mixdown_present;
+ uint8_t mono_mixdown_element_number;
+ uint8_t stereo_mixdown_present;
+ uint8_t stereo_mixdown_element_number;
+ uint8_t matrix_mixdown_idx_present;
+ uint8_t pseudo_surround_enable;
+ uint8_t matrix_mixdown_idx;
+ uint8_t front_element_is_cpe[16];
+ uint8_t front_element_tag_select[16];
+ uint8_t side_element_is_cpe[16];
+ uint8_t side_element_tag_select[16];
+ uint8_t back_element_is_cpe[16];
+ uint8_t back_element_tag_select[16];
+ uint8_t lfe_element_tag_select[16];
+ uint8_t assoc_data_element_tag_select[16];
+ uint8_t cc_element_is_ind_sw[16];
+ uint8_t valid_cc_element_tag_select[16];
+
+ uint8_t channels;
+
+ uint8_t comment_field_bytes;
+ uint8_t comment_field_data[257];
+
+ /* extra added values */
+ uint8_t num_front_channels;
+ uint8_t num_side_channels;
+ uint8_t num_back_channels;
+ uint8_t num_lfe_channels;
+ uint8_t sce_channel[16];
+ uint8_t cpe_channel[16];
+} program_config;
+
+typedef struct
+{
+ uint16_t syncword;
+ uint8_t id;
+ uint8_t layer;
+ uint8_t protection_absent;
+ uint8_t profile;
+ uint8_t sf_index;
+ uint8_t private_bit;
+ uint8_t channel_configuration;
+ uint8_t original;
+ uint8_t home;
+ uint8_t emphasis;
+ uint8_t copyright_identification_bit;
+ uint8_t copyright_identification_start;
+ uint16_t aac_frame_length;
+ uint16_t adts_buffer_fullness;
+ uint8_t no_raw_data_blocks_in_frame;
+ uint16_t crc_check;
+
+ /* control param */
+ uint8_t old_format;
+} adts_header;
+
+typedef struct
+{
+ uint8_t copyright_id_present;
+ int8_t copyright_id[10];
+ uint8_t original_copy;
+ uint8_t home;
+ uint8_t bitstream_type;
+ uint32_t bitrate;
+ uint8_t num_program_config_elements;
+ uint32_t adif_buffer_fullness;
+
+ /* maximum of 16 PCEs */
+ program_config pce[16];
+} adif_header;
#ifdef LTP_DEC
- typedef struct
- {
- uint8_t last_band;
- uint8_t data_present;
- uint16_t lag;
- uint8_t lag_update;
- uint8_t coef;
- uint8_t long_used[MAX_SFB];
- uint8_t short_used[8];
- uint8_t short_lag_present[8];
- uint8_t short_lag[8];
- } ltp_info;
+typedef struct
+{
+ uint8_t last_band;
+ uint8_t data_present;
+ uint16_t lag;
+ uint8_t lag_update;
+ uint8_t coef;
+ uint8_t long_used[MAX_SFB];
+ uint8_t short_used[8];
+ uint8_t short_lag_present[8];
+ uint8_t short_lag[8];
+} ltp_info;
#endif
#ifdef MAIN_DEC
- typedef struct
- {
- uint8_t limit;
- uint8_t predictor_reset;
- uint8_t predictor_reset_group_number;
- uint8_t prediction_used[MAX_SFB];
- } pred_info;
+typedef struct
+{
+ uint8_t limit;
+ uint8_t predictor_reset;
+ uint8_t predictor_reset_group_number;
+ uint8_t prediction_used[MAX_SFB];
+} pred_info;
#endif
- typedef struct
- {
- uint8_t number_pulse;
- uint8_t pulse_start_sfb;
- uint8_t pulse_offset[4];
- uint8_t pulse_amp[4];
- } pulse_info;
-
- typedef struct
- {
- uint8_t n_filt[8];
- uint8_t coef_res[8];
- uint8_t length[8][4];
- uint8_t order[8][4];
- uint8_t direction[8][4];
- uint8_t coef_compress[8][4];
- uint8_t coef[8][4][32];
- } tns_info;
+typedef struct
+{
+ uint8_t number_pulse;
+ uint8_t pulse_start_sfb;
+ uint8_t pulse_offset[4];
+ uint8_t pulse_amp[4];
+} pulse_info;
+
+typedef struct
+{
+ uint8_t n_filt[8];
+ uint8_t coef_res[8];
+ uint8_t length[8][4];
+ uint8_t order[8][4];
+ uint8_t direction[8][4];
+ uint8_t coef_compress[8][4];
+ uint8_t coef[8][4][32];
+} tns_info;
#ifdef SSR_DEC
- typedef struct
- {
- uint8_t max_band;
-
- uint8_t adjust_num[4][8];
- uint8_t alevcode[4][8][8];
- uint8_t aloccode[4][8][8];
- } ssr_info;
+typedef struct
+{
+ uint8_t max_band;
+
+ uint8_t adjust_num[4][8];
+ uint8_t alevcode[4][8][8];
+ uint8_t aloccode[4][8][8];
+} ssr_info;
#endif
- typedef struct
- {
- uint8_t max_sfb;
-
- uint8_t num_swb;
- uint8_t num_window_groups;
- uint8_t num_windows;
- uint8_t window_sequence;
- uint8_t window_group_length[8];
- uint8_t window_shape;
- uint8_t scale_factor_grouping;
- uint16_t sect_sfb_offset[8][15*8];
- uint16_t swb_offset[52];
- uint16_t swb_offset_max;
-
- uint8_t sect_cb[8][15*8];
- uint16_t sect_start[8][15*8];
- uint16_t sect_end[8][15*8];
- uint8_t sfb_cb[8][8*15];
- uint8_t num_sec[8]; /* number of sections in a group */
-
- uint8_t global_gain;
- int16_t scale_factors[8][51]; /* [0..255] */
-
- uint8_t ms_mask_present;
- uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
-
- uint8_t noise_used;
- uint8_t is_used;
-
- uint8_t pulse_data_present;
- uint8_t tns_data_present;
- uint8_t gain_control_data_present;
- uint8_t predictor_data_present;
-
- pulse_info pul;
- tns_info tns;
+typedef struct
+{
+ uint8_t max_sfb;
+
+ uint8_t num_swb;
+ uint8_t num_window_groups;
+ uint8_t num_windows;
+ uint8_t window_sequence;
+ uint8_t window_group_length[8];
+ uint8_t window_shape;
+ uint8_t scale_factor_grouping;
+ uint16_t sect_sfb_offset[8][15*8];
+ uint16_t swb_offset[52];
+ uint16_t swb_offset_max;
+
+ uint8_t sect_cb[8][15*8];
+ uint16_t sect_start[8][15*8];
+ uint16_t sect_end[8][15*8];
+ uint8_t sfb_cb[8][8*15];
+ uint8_t num_sec[8]; /* number of sections in a group */
+
+ uint8_t global_gain;
+ int16_t scale_factors[8][51]; /* [0..255] */
+
+ uint8_t ms_mask_present;
+ uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
+
+ uint8_t noise_used;
+ uint8_t is_used;
+
+ uint8_t pulse_data_present;
+ uint8_t tns_data_present;
+ uint8_t gain_control_data_present;
+ uint8_t predictor_data_present;
+
+ pulse_info pul;
+ tns_info tns;
#ifdef MAIN_DEC
- pred_info pred;
+ pred_info pred;
#endif
#ifdef LTP_DEC
- ltp_info ltp;
- ltp_info ltp2;
+ ltp_info ltp;
+ ltp_info ltp2;
#endif
#ifdef SSR_DEC
- ssr_info ssr;
+ ssr_info ssr;
#endif
#ifdef ERROR_RESILIENCE
- /* ER HCR data */
- uint16_t length_of_reordered_spectral_data;
- uint8_t length_of_longest_codeword;
- /* ER RLVC data */
- uint8_t sf_concealment;
- uint8_t rev_global_gain;
- uint16_t length_of_rvlc_sf;
- uint16_t dpcm_noise_nrg;
- uint8_t sf_escapes_present;
- uint8_t length_of_rvlc_escapes;
- uint16_t dpcm_noise_last_position;
+ /* ER HCR data */
+ uint16_t length_of_reordered_spectral_data;
+ uint8_t length_of_longest_codeword;
+ /* ER RLVC data */
+ uint8_t sf_concealment;
+ uint8_t rev_global_gain;
+ uint16_t length_of_rvlc_sf;
+ uint16_t dpcm_noise_nrg;
+ uint8_t sf_escapes_present;
+ uint8_t length_of_rvlc_escapes;
+ uint16_t dpcm_noise_last_position;
#endif
- } ic_stream; /* individual channel stream */
+} ic_stream; /* individual channel stream */
- typedef struct
- {
- uint8_t channel;
- int16_t paired_channel;
+typedef struct
+{
+ uint8_t channel;
+ int16_t paired_channel;
- uint8_t element_instance_tag;
- uint8_t common_window;
+ uint8_t element_instance_tag;
+ uint8_t common_window;
- ic_stream ics1;
- ic_stream ics2;
- } element; /* syntax element (SCE, CPE, LFE) */
+ ic_stream ics1;
+ ic_stream ics2;
+} element; /* syntax element (SCE, CPE, LFE) */
#define MAX_ASC_BYTES 64
- typedef struct
- {
- int inited;
- int version, versionA;
- int framelen_type;
- int useSameStreamMux;
- int allStreamsSameTimeFraming;
- int numSubFrames;
- int numPrograms;
- int numLayers;
- int otherDataPresent;
- uint32_t otherDataLenBits;
- uint32_t frameLength;
- uint8_t ASC[MAX_ASC_BYTES];
- uint32_t ASCbits;
- } latm_header;
-
- typedef struct
- {
- uint8_t adts_header_present;
- uint8_t adif_header_present;
- uint8_t latm_header_present;
- uint8_t sf_index;
- uint8_t object_type;
- uint8_t channelConfiguration;
+typedef struct {
+ int inited;
+ int version, versionA;
+ int framelen_type;
+ int useSameStreamMux;
+ int allStreamsSameTimeFraming;
+ int numSubFrames;
+ int numPrograms;
+ int numLayers;
+ int otherDataPresent;
+ uint32_t otherDataLenBits;
+ uint32_t frameLength;
+ uint8_t ASC[MAX_ASC_BYTES];
+ uint32_t ASCbits;
+} latm_header;
+
+typedef struct
+{
+ uint8_t adts_header_present;
+ uint8_t adif_header_present;
+ uint8_t latm_header_present;
+ uint8_t sf_index;
+ uint8_t object_type;
+ uint8_t channelConfiguration;
#ifdef ERROR_RESILIENCE
- uint8_t aacSectionDataResilienceFlag;
- uint8_t aacScalefactorDataResilienceFlag;
- uint8_t aacSpectralDataResilienceFlag;
+ uint8_t aacSectionDataResilienceFlag;
+ uint8_t aacScalefactorDataResilienceFlag;
+ uint8_t aacSpectralDataResilienceFlag;
#endif
- uint16_t frameLength;
- uint8_t postSeekResetFlag;
-
- uint32_t frame;
-
- uint8_t downMatrix;
- uint8_t upMatrix;
- uint8_t first_syn_ele;
- uint8_t has_lfe;
- /* number of channels in current frame */
- uint8_t fr_channels;
- /* number of elements in current frame */
- uint8_t fr_ch_ele;
-
- /* element_output_channels:
- determines the number of channels the element will output
- */
- uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS];
- /* element_alloced:
- determines whether the data needed for the element is allocated or not
- */
- uint8_t element_alloced[MAX_SYNTAX_ELEMENTS];
- /* alloced_channels:
- determines the number of channels where output data is allocated for
- */
- uint8_t alloced_channels;
-
- /* output data buffer */
- void *sample_buffer;
-
- uint8_t window_shape_prev[MAX_CHANNELS];
+ uint16_t frameLength;
+ uint8_t postSeekResetFlag;
+
+ uint32_t frame;
+
+ uint8_t downMatrix;
+ uint8_t upMatrix;
+ uint8_t first_syn_ele;
+ uint8_t has_lfe;
+ /* number of channels in current frame */
+ uint8_t fr_channels;
+ /* number of elements in current frame */
+ uint8_t fr_ch_ele;
+
+ /* element_output_channels:
+ determines the number of channels the element will output
+ */
+ uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS];
+ /* element_alloced:
+ determines whether the data needed for the element is allocated or not
+ */
+ uint8_t element_alloced[MAX_SYNTAX_ELEMENTS];
+ /* alloced_channels:
+ determines the number of channels where output data is allocated for
+ */
+ uint8_t alloced_channels;
+
+ /* output data buffer */
+ void *sample_buffer;
+
+ uint8_t window_shape_prev[MAX_CHANNELS];
#ifdef LTP_DEC
- uint16_t ltp_lag[MAX_CHANNELS];
+ uint16_t ltp_lag[MAX_CHANNELS];
#endif
- fb_info *fb;
- drc_info *drc;
+ fb_info *fb;
+ drc_info *drc;
- real_t *time_out[MAX_CHANNELS];
- real_t *fb_intermed[MAX_CHANNELS];
+ real_t *time_out[MAX_CHANNELS];
+ real_t *fb_intermed[MAX_CHANNELS];
#ifdef SBR_DEC
- int8_t sbr_present_flag;
- int8_t forceUpSampling;
- int8_t downSampledSBR;
- /* determines whether SBR data is allocated for the gives element */
- uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
+ int8_t sbr_present_flag;
+ int8_t forceUpSampling;
+ int8_t downSampledSBR;
+ /* determines whether SBR data is allocated for the gives element */
+ uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
- sbr_info *sbr[MAX_SYNTAX_ELEMENTS];
+ sbr_info *sbr[MAX_SYNTAX_ELEMENTS];
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
- uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
- uint8_t ps_used_global;
+ uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
+ uint8_t ps_used_global;
#endif
#ifdef SSR_DEC
- real_t *ssr_overlap[MAX_CHANNELS];
- real_t *prev_fmd[MAX_CHANNELS];
- real_t ipqf_buffer[MAX_CHANNELS][4][96/4];
+ real_t *ssr_overlap[MAX_CHANNELS];
+ real_t *prev_fmd[MAX_CHANNELS];
+ real_t ipqf_buffer[MAX_CHANNELS][4][96/4];
#endif
#ifdef MAIN_DEC
- pred_state *pred_stat[MAX_CHANNELS];
+ pred_state *pred_stat[MAX_CHANNELS];
#endif
#ifdef LTP_DEC
- int16_t *lt_pred_stat[MAX_CHANNELS];
+ int16_t *lt_pred_stat[MAX_CHANNELS];
#endif
#ifdef DRM
- uint8_t error_state;
+ uint8_t error_state;
#endif
- /* RNG states */
- uint32_t __r1;
- uint32_t __r2;
+ /* RNG states */
+ uint32_t __r1;
+ uint32_t __r2;
- /* Program Config Element */
- uint8_t pce_set;
- program_config pce;
- uint8_t element_id[MAX_CHANNELS];
- uint8_t internal_channel[MAX_CHANNELS];
+ /* Program Config Element */
+ uint8_t pce_set;
+ program_config pce;
+ uint8_t element_id[MAX_CHANNELS];
+ uint8_t internal_channel[MAX_CHANNELS];
- /* Configuration data */
- NeAACDecConfiguration config;
+ /* Configuration data */
+ NeAACDecConfiguration config;
#ifdef PROFILE
- int64_t cycles;
- int64_t spectral_cycles;
- int64_t output_cycles;
- int64_t scalefac_cycles;
- int64_t requant_cycles;
+ int64_t cycles;
+ int64_t spectral_cycles;
+ int64_t output_cycles;
+ int64_t scalefac_cycles;
+ int64_t requant_cycles;
#endif
- latm_header latm_config;
- const unsigned char *cmes;
- } NeAACDecStruct;
+ latm_header latm_config;
+ const unsigned char *cmes;
+} NeAACDecStruct;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.c
index f3c9e6f42..b7e45f3a3 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -61,7 +61,7 @@ static void decode_sce_lfe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, b
static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
uint8_t id_syn_ele);
static uint8_t single_lfe_channel_element(NeAACDecStruct *hDecoder, bitfile *ld,
- uint8_t channel, uint8_t *tag);
+ uint8_t channel, uint8_t *tag);
static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
uint8_t channel, uint8_t *tag);
#ifdef COUPLING_DEC
@@ -71,12 +71,12 @@ static uint16_t data_stream_element(NeAACDecStruct *hDecoder, bitfile *ld);
static uint8_t program_config_element(program_config *pce, bitfile *ld);
static uint8_t fill_element(NeAACDecStruct *hDecoder, bitfile *ld, drc_info *drc
#ifdef SBR_DEC
- , uint8_t sbr_ele
+ ,uint8_t sbr_ele
#endif
- );
+ );
static uint8_t individual_channel_stream(NeAACDecStruct *hDecoder, element *ele,
- bitfile *ld, ic_stream *ics, uint8_t scal_flag,
- int16_t *spec_data);
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+ int16_t *spec_data);
static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
uint8_t common_window);
static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld);
@@ -101,7 +101,7 @@ static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele,
bitfile *ld, ic_stream *ics, uint8_t scal_flag);
#ifdef DRM
static int8_t DRM_aac_scalable_main_header(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2,
- bitfile *ld, uint8_t this_layer_stereo);
+ bitfile *ld, uint8_t this_layer_stereo);
#endif
@@ -113,28 +113,28 @@ int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
/* 1024 or 960 */
mp4ASC->frameLengthFlag = faad_get1bit(ld
- DEBUGVAR(1, 138, "GASpecificConfig(): FrameLengthFlag"));
+ DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag"));
#ifndef ALLOW_SMALL_FRAMELENGTH
- if(mp4ASC->frameLengthFlag == 1)
+ if (mp4ASC->frameLengthFlag == 1)
return -3;
#endif
mp4ASC->dependsOnCoreCoder = faad_get1bit(ld
- DEBUGVAR(1, 139, "GASpecificConfig(): DependsOnCoreCoder"));
- if(mp4ASC->dependsOnCoreCoder == 1)
+ DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder"));
+ if (mp4ASC->dependsOnCoreCoder == 1)
{
mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14
- DEBUGVAR(1, 140, "GASpecificConfig(): CoreCoderDelay"));
+ DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay"));
}
- mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1, 141, "GASpecificConfig(): ExtensionFlag"));
- if(mp4ASC->channelsConfiguration == 0)
+ mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag"));
+ if (mp4ASC->channelsConfiguration == 0)
{
- if(program_config_element(&pce, ld))
+ if (program_config_element(&pce, ld))
return -3;
//mp4ASC->channelsConfiguration = pce.channels;
- if(pce_out != NULL)
+ if (pce_out != NULL)
memcpy(pce_out, &pce, sizeof(program_config));
/*
@@ -144,21 +144,21 @@ int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
}
#ifdef ERROR_RESILIENCE
- if(mp4ASC->extensionFlag == 1)
+ if (mp4ASC->extensionFlag == 1)
{
/* Error resilience not supported yet */
- if(mp4ASC->objectTypeIndex >= ER_OBJECT_START)
+ if (mp4ASC->objectTypeIndex >= ER_OBJECT_START)
{
mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld
- DEBUGVAR(1, 144, "GASpecificConfig(): aacSectionDataResilienceFlag"));
+ DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag"));
mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld
- DEBUGVAR(1, 145, "GASpecificConfig(): aacScalefactorDataResilienceFlag"));
+ DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag"));
mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld
- DEBUGVAR(1, 146, "GASpecificConfig(): aacSpectralDataResilienceFlag"));
+ DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag"));
}
/* 1 bit: extensionFlag3 */
faad_getbits(ld, 1);
- }
+ }
#endif
return 0;
@@ -180,149 +180,143 @@ static uint8_t program_config_element(program_config *pce, bitfile *ld)
pce->channels = 0;
pce->element_instance_tag = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 10, "program_config_element(): element_instance_tag"));
+ DEBUGVAR(1,10,"program_config_element(): element_instance_tag"));
pce->object_type = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 11, "program_config_element(): object_type"));
+ DEBUGVAR(1,11,"program_config_element(): object_type"));
pce->sf_index = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 12, "program_config_element(): sf_index"));
+ DEBUGVAR(1,12,"program_config_element(): sf_index"));
pce->num_front_channel_elements = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 13, "program_config_element(): num_front_channel_elements"));
+ DEBUGVAR(1,13,"program_config_element(): num_front_channel_elements"));
pce->num_side_channel_elements = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 14, "program_config_element(): num_side_channel_elements"));
+ DEBUGVAR(1,14,"program_config_element(): num_side_channel_elements"));
pce->num_back_channel_elements = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 15, "program_config_element(): num_back_channel_elements"));
+ DEBUGVAR(1,15,"program_config_element(): num_back_channel_elements"));
pce->num_lfe_channel_elements = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 16, "program_config_element(): num_lfe_channel_elements"));
+ DEBUGVAR(1,16,"program_config_element(): num_lfe_channel_elements"));
pce->num_assoc_data_elements = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 17, "program_config_element(): num_assoc_data_elements"));
+ DEBUGVAR(1,17,"program_config_element(): num_assoc_data_elements"));
pce->num_valid_cc_elements = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 18, "program_config_element(): num_valid_cc_elements"));
+ DEBUGVAR(1,18,"program_config_element(): num_valid_cc_elements"));
pce->mono_mixdown_present = faad_get1bit(ld
- DEBUGVAR(1, 19, "program_config_element(): mono_mixdown_present"));
- if(pce->mono_mixdown_present == 1)
+ DEBUGVAR(1,19,"program_config_element(): mono_mixdown_present"));
+ if (pce->mono_mixdown_present == 1)
{
pce->mono_mixdown_element_number = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 20, "program_config_element(): mono_mixdown_element_number"));
+ DEBUGVAR(1,20,"program_config_element(): mono_mixdown_element_number"));
}
pce->stereo_mixdown_present = faad_get1bit(ld
- DEBUGVAR(1, 21, "program_config_element(): stereo_mixdown_present"));
- if(pce->stereo_mixdown_present == 1)
+ DEBUGVAR(1,21,"program_config_element(): stereo_mixdown_present"));
+ if (pce->stereo_mixdown_present == 1)
{
pce->stereo_mixdown_element_number = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 22, "program_config_element(): stereo_mixdown_element_number"));
+ DEBUGVAR(1,22,"program_config_element(): stereo_mixdown_element_number"));
}
pce->matrix_mixdown_idx_present = faad_get1bit(ld
- DEBUGVAR(1, 23, "program_config_element(): matrix_mixdown_idx_present"));
- if(pce->matrix_mixdown_idx_present == 1)
+ DEBUGVAR(1,23,"program_config_element(): matrix_mixdown_idx_present"));
+ if (pce->matrix_mixdown_idx_present == 1)
{
pce->matrix_mixdown_idx = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 24, "program_config_element(): matrix_mixdown_idx"));
+ DEBUGVAR(1,24,"program_config_element(): matrix_mixdown_idx"));
pce->pseudo_surround_enable = faad_get1bit(ld
- DEBUGVAR(1, 25, "program_config_element(): pseudo_surround_enable"));
+ DEBUGVAR(1,25,"program_config_element(): pseudo_surround_enable"));
}
- for(i = 0; i < pce->num_front_channel_elements; i++)
+ for (i = 0; i < pce->num_front_channel_elements; i++)
{
pce->front_element_is_cpe[i] = faad_get1bit(ld
- DEBUGVAR(1, 26, "program_config_element(): front_element_is_cpe"));
+ DEBUGVAR(1,26,"program_config_element(): front_element_is_cpe"));
pce->front_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 27, "program_config_element(): front_element_tag_select"));
+ DEBUGVAR(1,27,"program_config_element(): front_element_tag_select"));
- if(pce->front_element_is_cpe[i] & 1)
+ if (pce->front_element_is_cpe[i] & 1)
{
pce->cpe_channel[pce->front_element_tag_select[i]] = pce->channels;
pce->num_front_channels += 2;
pce->channels += 2;
- }
- else
- {
+ } else {
pce->sce_channel[pce->front_element_tag_select[i]] = pce->channels;
pce->num_front_channels++;
pce->channels++;
}
}
- for(i = 0; i < pce->num_side_channel_elements; i++)
+ for (i = 0; i < pce->num_side_channel_elements; i++)
{
pce->side_element_is_cpe[i] = faad_get1bit(ld
- DEBUGVAR(1, 28, "program_config_element(): side_element_is_cpe"));
+ DEBUGVAR(1,28,"program_config_element(): side_element_is_cpe"));
pce->side_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 29, "program_config_element(): side_element_tag_select"));
+ DEBUGVAR(1,29,"program_config_element(): side_element_tag_select"));
- if(pce->side_element_is_cpe[i] & 1)
+ if (pce->side_element_is_cpe[i] & 1)
{
pce->cpe_channel[pce->side_element_tag_select[i]] = pce->channels;
pce->num_side_channels += 2;
pce->channels += 2;
- }
- else
- {
+ } else {
pce->sce_channel[pce->side_element_tag_select[i]] = pce->channels;
pce->num_side_channels++;
pce->channels++;
}
}
- for(i = 0; i < pce->num_back_channel_elements; i++)
+ for (i = 0; i < pce->num_back_channel_elements; i++)
{
pce->back_element_is_cpe[i] = faad_get1bit(ld
- DEBUGVAR(1, 30, "program_config_element(): back_element_is_cpe"));
+ DEBUGVAR(1,30,"program_config_element(): back_element_is_cpe"));
pce->back_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 31, "program_config_element(): back_element_tag_select"));
+ DEBUGVAR(1,31,"program_config_element(): back_element_tag_select"));
- if(pce->back_element_is_cpe[i] & 1)
+ if (pce->back_element_is_cpe[i] & 1)
{
pce->cpe_channel[pce->back_element_tag_select[i]] = pce->channels;
pce->channels += 2;
pce->num_back_channels += 2;
- }
- else
- {
+ } else {
pce->sce_channel[pce->back_element_tag_select[i]] = pce->channels;
pce->num_back_channels++;
pce->channels++;
}
}
- for(i = 0; i < pce->num_lfe_channel_elements; i++)
+ for (i = 0; i < pce->num_lfe_channel_elements; i++)
{
pce->lfe_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 32, "program_config_element(): lfe_element_tag_select"));
+ DEBUGVAR(1,32,"program_config_element(): lfe_element_tag_select"));
pce->sce_channel[pce->lfe_element_tag_select[i]] = pce->channels;
pce->num_lfe_channels++;
pce->channels++;
}
- for(i = 0; i < pce->num_assoc_data_elements; i++)
+ for (i = 0; i < pce->num_assoc_data_elements; i++)
pce->assoc_data_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 33, "program_config_element(): assoc_data_element_tag_select"));
+ DEBUGVAR(1,33,"program_config_element(): assoc_data_element_tag_select"));
- for(i = 0; i < pce->num_valid_cc_elements; i++)
+ for (i = 0; i < pce->num_valid_cc_elements; i++)
{
pce->cc_element_is_ind_sw[i] = faad_get1bit(ld
- DEBUGVAR(1, 34, "program_config_element(): cc_element_is_ind_sw"));
+ DEBUGVAR(1,34,"program_config_element(): cc_element_is_ind_sw"));
pce->valid_cc_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 35, "program_config_element(): valid_cc_element_tag_select"));
+ DEBUGVAR(1,35,"program_config_element(): valid_cc_element_tag_select"));
}
faad_byte_align(ld);
pce->comment_field_bytes = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 36, "program_config_element(): comment_field_bytes"));
+ DEBUGVAR(1,36,"program_config_element(): comment_field_bytes"));
- for(i = 0; i < pce->comment_field_bytes; i++)
+ for (i = 0; i < pce->comment_field_bytes; i++)
{
pce->comment_field_data[i] = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 37, "program_config_element(): comment_field_data"));
+ DEBUGVAR(1,37,"program_config_element(): comment_field_data"));
}
pce->comment_field_data[i] = 0;
- if(pce->channels > MAX_CHANNELS)
+ if (pce->channels > MAX_CHANNELS)
return 22;
return 0;
@@ -335,12 +329,12 @@ static void decode_sce_lfe(NeAACDecStruct *hDecoder,
uint8_t channels = hDecoder->fr_channels;
uint8_t tag = 0;
- if(channels + 1 > MAX_CHANNELS)
+ if (channels+1 > MAX_CHANNELS)
{
hInfo->error = 12;
return;
}
- if(hDecoder->fr_ch_ele + 1 > MAX_SYNTAX_ELEMENTS)
+ if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
{
hInfo->error = 13;
return;
@@ -357,15 +351,13 @@ static void decode_sce_lfe(NeAACDecStruct *hDecoder,
hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag);
/* map output channels position to internal data channels */
- if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
{
/* this might be faulty when pce_set is true */
hDecoder->internal_channel[channels] = channels;
- hDecoder->internal_channel[channels+1] = channels + 1;
- }
- else
- {
- if(hDecoder->pce_set)
+ hDecoder->internal_channel[channels+1] = channels+1;
+ } else {
+ if (hDecoder->pce_set)
hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels;
else
hDecoder->internal_channel[channels] = channels;
@@ -381,25 +373,23 @@ static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfi
uint8_t channels = hDecoder->fr_channels;
uint8_t tag = 0;
- if(channels + 2 > MAX_CHANNELS)
+ if (channels+2 > MAX_CHANNELS)
{
hInfo->error = 12;
return;
}
- if(hDecoder->fr_ch_ele + 1 > MAX_SYNTAX_ELEMENTS)
+ if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
{
hInfo->error = 13;
return;
}
/* for CPE the number of output channels is always 2 */
- if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
{
/* element_output_channels not set yet */
hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
- }
- else if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2)
- {
+ } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) {
/* element inconsistency */
hInfo->error = 21;
return;
@@ -412,15 +402,13 @@ static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfi
hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag);
/* map output channel position to internal data channels */
- if(hDecoder->pce_set)
+ if (hDecoder->pce_set)
{
hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels;
- hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag] + 1] = channels + 1;
- }
- else
- {
+ hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]+1] = channels+1;
+ } else {
hDecoder->internal_channel[channels] = channels;
- hDecoder->internal_channel[channels+1] = channels + 1;
+ hDecoder->internal_channel[channels+1] = channels+1;
}
hDecoder->fr_channels += 2;
@@ -439,27 +427,26 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
hDecoder->has_lfe = 0;
#ifdef ERROR_RESILIENCE
- if(hDecoder->object_type < ER_OBJECT_START)
+ if (hDecoder->object_type < ER_OBJECT_START)
{
#endif
/* Table 4.4.3: raw_data_block() */
- while((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID
- DEBUGVAR(1, 4, "NeAACDecDecode(): id_syn_ele"))) != ID_END)
+ while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID
+ DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END)
{
- switch(id_syn_ele)
- {
+ switch (id_syn_ele) {
case ID_SCE:
ele_this_frame++;
- if(hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+ if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case ID_CPE:
ele_this_frame++;
- if(hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+ if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
decode_cpe(hDecoder, hInfo, ld, id_syn_ele);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case ID_LFE:
@@ -470,7 +457,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
hDecoder->has_lfe++;
decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
#endif
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case ID_CCE: /* not implemented yet, but skip the bits */
@@ -484,7 +471,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
hInfo->error = 6;
#endif
#endif
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case ID_DSE:
@@ -492,7 +479,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
data_stream_element(hDecoder, ld);
break;
case ID_PCE:
- if(ele_this_frame != 0)
+ if (ele_this_frame != 0)
{
hInfo->error = 31;
return;
@@ -510,50 +497,48 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
/* one sbr_info describes a channel_element not a channel! */
/* if we encounter SBR data here: error */
/* SBR data will be read directly in the SCE/LFE/CPE element */
- if((hInfo->error = fill_element(hDecoder, ld, drc
+ if ((hInfo->error = fill_element(hDecoder, ld, drc
#ifdef SBR_DEC
- , INVALID_SBR_ELEMENT
+ , INVALID_SBR_ELEMENT
#endif
- )) > 0)
+ )) > 0)
return;
break;
}
}
#ifdef ERROR_RESILIENCE
- }
- else
- {
+ } else {
/* Table 262: er_raw_data_block() */
- switch(hDecoder->channelConfiguration)
+ switch (hDecoder->channelConfiguration)
{
case 1:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case 2:
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case 3:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case 4:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case 5:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case 6:
@@ -561,7 +546,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
case 7: /* 8 channels */
@@ -570,7 +555,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
break;
default:
@@ -579,7 +564,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
}
#if 0
cnt = bits_to_decode() / 8;
- while(cnt >= 1)
+ while (cnt >= 1)
{
cnt -= extension_payload(cnt);
}
@@ -589,11 +574,11 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
/* new in corrigendum 14496-3:2002 */
#ifdef DRM
- if(hDecoder->object_type != DRM_ER_LC
+ if (hDecoder->object_type != DRM_ER_LC
#if 0
- && !hDecoder->latm_header_present
+ && !hDecoder->latm_header_present
#endif
- )
+ )
#endif
{
faad_byte_align(ld);
@@ -605,7 +590,7 @@ void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
/* Table 4.4.4 and */
/* Table 4.4.9 */
static uint8_t single_lfe_channel_element(NeAACDecStruct *hDecoder, bitfile *ld,
- uint8_t channel, uint8_t *tag)
+ uint8_t channel, uint8_t *tag)
{
uint8_t retval = 0;
element sce = {0};
@@ -613,29 +598,29 @@ static uint8_t single_lfe_channel_element(NeAACDecStruct *hDecoder, bitfile *ld,
ALIGN int16_t spec_data[1024] = {0};
sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
- DEBUGVAR(1, 38, "single_lfe_channel_element(): element_instance_tag"));
+ DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag"));
*tag = sce.element_instance_tag;
sce.channel = channel;
sce.paired_channel = -1;
retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data);
- if(retval > 0)
+ if (retval > 0)
return retval;
/* IS not allowed in single channel */
- if(ics->is_used)
+ if (ics->is_used)
return 32;
#ifdef SBR_DEC
/* check if next bitstream element is a fill element */
/* if so, read it now so SBR decoding can be done in case of a file with SBR */
- if(faad_showbits(ld, LEN_SE_ID) == ID_FIL)
+ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
{
faad_flushbits(ld, LEN_SE_ID);
/* one sbr_info describes a channel_element not a channel! */
- if((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
+ if ((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
{
return retval;
}
@@ -644,7 +629,7 @@ static uint8_t single_lfe_channel_element(NeAACDecStruct *hDecoder, bitfile *ld,
/* noiseless coding is done, spectral reconstruction is done now */
retval = reconstruct_single_channel(hDecoder, ics, &sce, spec_data);
- if(retval > 0)
+ if (retval > 0)
return retval;
return 0;
@@ -662,50 +647,50 @@ static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
uint8_t result;
cpe.channel = channels;
- cpe.paired_channel = channels + 1;
+ cpe.paired_channel = channels+1;
cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
- DEBUGVAR(1, 39, "channel_pair_element(): element_instance_tag"));
+ DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag"));
*tag = cpe.element_instance_tag;
- if((cpe.common_window = faad_get1bit(ld
- DEBUGVAR(1, 40, "channel_pair_element(): common_window"))) & 1)
+ if ((cpe.common_window = faad_get1bit(ld
+ DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1)
{
/* both channels have common ics information */
- if((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0)
+ if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0)
return result;
ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 41, "channel_pair_element(): ms_mask_present"));
- if(ics1->ms_mask_present == 3)
+ DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present"));
+ if (ics1->ms_mask_present == 3)
{
/* bitstream error */
return 32;
}
- if(ics1->ms_mask_present == 1)
+ if (ics1->ms_mask_present == 1)
{
uint8_t g, sfb;
- for(g = 0; g < ics1->num_window_groups; g++)
+ for (g = 0; g < ics1->num_window_groups; g++)
{
- for(sfb = 0; sfb < ics1->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics1->max_sfb; sfb++)
{
ics1->ms_used[g][sfb] = faad_get1bit(ld
- DEBUGVAR(1, 42, "channel_pair_element(): faad_get1bit"));
+ DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit"));
}
}
}
#ifdef ERROR_RESILIENCE
- if((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present))
+ if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present))
{
- if((
+ if ((
#ifdef LTP_DEC
- ics1->ltp.data_present =
+ ics1->ltp.data_present =
#endif
- faad_get1bit(ld DEBUGVAR(1, 50, "channel_pair_element(): ltp.data_present"))) & 1)
+ faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
{
#ifdef LTP_DEC
- if((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0)
+ if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0)
{
return result;
}
@@ -717,30 +702,28 @@ static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
#endif
memcpy(ics2, ics1, sizeof(ic_stream));
- }
- else
- {
+ } else {
ics1->ms_mask_present = 0;
}
- if((result = individual_channel_stream(hDecoder, &cpe, ld, ics1,
- 0, spec_data1)) > 0)
+ if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1,
+ 0, spec_data1)) > 0)
{
return result;
}
#ifdef ERROR_RESILIENCE
- if(cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) &&
- (ics1->predictor_data_present))
+ if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) &&
+ (ics1->predictor_data_present))
{
- if((
+ if ((
#ifdef LTP_DEC
- ics1->ltp2.data_present =
+ ics1->ltp2.data_present =
#endif
- faad_get1bit(ld DEBUGVAR(1, 50, "channel_pair_element(): ltp.data_present"))) & 1)
+ faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
{
#ifdef LTP_DEC
- if((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0)
+ if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0)
{
return result;
}
@@ -751,8 +734,8 @@ static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
}
#endif
- if((result = individual_channel_stream(hDecoder, &cpe, ld, ics2,
- 0, spec_data2)) > 0)
+ if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2,
+ 0, spec_data2)) > 0)
{
return result;
}
@@ -760,12 +743,12 @@ static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
#ifdef SBR_DEC
/* check if next bitstream element is a fill element */
/* if so, read it now so SBR decoding can be done in case of a file with SBR */
- if(faad_showbits(ld, LEN_SE_ID) == ID_FIL)
+ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
{
faad_flushbits(ld, LEN_SE_ID);
/* one sbr_info describes a channel_element not a channel! */
- if((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
+ if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
{
return result;
}
@@ -773,8 +756,8 @@ static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
#endif
/* noiseless coding is done, spectral reconstruction is done now */
- if((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe,
- spec_data1, spec_data2)) > 0)
+ if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe,
+ spec_data1, spec_data2)) > 0)
{
return result;
}
@@ -790,49 +773,47 @@ static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
uint8_t ics_reserved_bit;
ics_reserved_bit = faad_get1bit(ld
- DEBUGVAR(1, 43, "ics_info(): ics_reserved_bit"));
- if(ics_reserved_bit != 0)
+ DEBUGVAR(1,43,"ics_info(): ics_reserved_bit"));
+ if (ics_reserved_bit != 0)
return 32;
ics->window_sequence = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 44, "ics_info(): window_sequence"));
+ DEBUGVAR(1,44,"ics_info(): window_sequence"));
ics->window_shape = faad_get1bit(ld
- DEBUGVAR(1, 45, "ics_info(): window_shape"));
+ DEBUGVAR(1,45,"ics_info(): window_shape"));
#ifdef LD_DEC
/* No block switching in LD */
- if((hDecoder->object_type == LD) && (ics->window_sequence != ONLY_LONG_SEQUENCE))
+ if ((hDecoder->object_type == LD) && (ics->window_sequence != ONLY_LONG_SEQUENCE))
return 32;
#endif
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
ics->max_sfb = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 46, "ics_info(): max_sfb (short)"));
+ DEBUGVAR(1,46,"ics_info(): max_sfb (short)"));
ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7
- DEBUGVAR(1, 47, "ics_info(): scale_factor_grouping"));
- }
- else
- {
+ DEBUGVAR(1,47,"ics_info(): scale_factor_grouping"));
+ } else {
ics->max_sfb = (uint8_t)faad_getbits(ld, 6
- DEBUGVAR(1, 48, "ics_info(): max_sfb (long)"));
+ DEBUGVAR(1,48,"ics_info(): max_sfb (long)"));
}
/* get the grouping information */
- if((retval = window_grouping_info(hDecoder, ics)) > 0)
+ if ((retval = window_grouping_info(hDecoder, ics)) > 0)
return retval;
/* should be an error */
/* check the range of max_sfb */
- if(ics->max_sfb > ics->num_swb)
+ if (ics->max_sfb > ics->num_swb)
return 16;
- if(ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{
- if((ics->predictor_data_present = faad_get1bit(ld
- DEBUGVAR(1, 49, "ics_info(): predictor_data_present"))) & 1)
+ if ((ics->predictor_data_present = faad_get1bit(ld
+ DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1)
{
- if(hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */
+ if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */
{
uint8_t sfb;
@@ -841,45 +822,44 @@ static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
ics->pred.limit = limit;
#endif
- if((
+ if ((
#ifdef MAIN_DEC
- ics->pred.predictor_reset =
+ ics->pred.predictor_reset =
#endif
- faad_get1bit(ld DEBUGVAR(1, 53, "ics_info(): pred.predictor_reset"))) & 1)
+ faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1)
{
#ifdef MAIN_DEC
ics->pred.predictor_reset_group_number =
#endif
- (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1, 54, "ics_info(): pred.predictor_reset_group_number"));
+ (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number"));
}
- for(sfb = 0; sfb < limit; sfb++)
+ for (sfb = 0; sfb < limit; sfb++)
{
#ifdef MAIN_DEC
ics->pred.prediction_used[sfb] =
#endif
- faad_get1bit(ld DEBUGVAR(1, 55, "ics_info(): pred.prediction_used"));
+ faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
}
}
#ifdef LTP_DEC
- else /* Long Term Prediction */
- {
- if(hDecoder->object_type < ER_OBJECT_START)
+ else { /* Long Term Prediction */
+ if (hDecoder->object_type < ER_OBJECT_START)
{
- if((ics->ltp.data_present = faad_get1bit(ld
- DEBUGVAR(1, 50, "ics_info(): ltp.data_present"))) & 1)
+ if ((ics->ltp.data_present = faad_get1bit(ld
+ DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1)
{
- if((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0)
+ if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0)
{
return retval;
}
}
- if(common_window)
+ if (common_window)
{
- if((ics->ltp2.data_present = faad_get1bit(ld
- DEBUGVAR(1, 51, "ics_info(): ltp2.data_present"))) & 1)
+ if ((ics->ltp2.data_present = faad_get1bit(ld
+ DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1)
{
- if((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0)
+ if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0)
{
return retval;
}
@@ -887,10 +867,10 @@ static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
}
}
#ifdef ERROR_RESILIENCE
- if(!common_window && (hDecoder->object_type >= ER_OBJECT_START))
+ if (!common_window && (hDecoder->object_type >= ER_OBJECT_START))
{
- if((ics->ltp.data_present = faad_get1bit(ld
- DEBUGVAR(1, 50, "ics_info(): ltp.data_present"))) & 1)
+ if ((ics->ltp.data_present = faad_get1bit(ld
+ DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1)
{
ltp_data(hDecoder, ics, &(ics->ltp), ld);
}
@@ -910,23 +890,23 @@ static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld)
uint8_t i;
pul->number_pulse = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 56, "pulse_data(): number_pulse"));
+ DEBUGVAR(1,56,"pulse_data(): number_pulse"));
pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6
- DEBUGVAR(1, 57, "pulse_data(): pulse_start_sfb"));
+ DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb"));
/* check the range of pulse_start_sfb */
- if(pul->pulse_start_sfb > ics->num_swb)
+ if (pul->pulse_start_sfb > ics->num_swb)
return 16;
- for(i = 0; i < pul->number_pulse + 1; i++)
+ for (i = 0; i < pul->number_pulse+1; i++)
{
pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 58, "pulse_data(): pulse_offset"));
+ DEBUGVAR(1,58,"pulse_data(): pulse_offset"));
#if 0
printf("%d\n", pul->pulse_offset[i]);
#endif
pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 59, "pulse_data(): pulse_amp"));
+ DEBUGVAR(1,59,"pulse_data(): pulse_amp"));
#if 0
printf("%d\n", pul->pulse_amp[i]);
#endif
@@ -949,80 +929,76 @@ static uint8_t coupling_channel_element(NeAACDecStruct *hDecoder, bitfile *ld)
int16_t sh_data[1024];
c = faad_getbits(ld, LEN_TAG
- DEBUGVAR(1, 900, "coupling_channel_element(): element_instance_tag"));
+ DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag"));
ind_sw_cce_flag = faad_get1bit(ld
- DEBUGVAR(1, 901, "coupling_channel_element(): ind_sw_cce_flag"));
+ DEBUGVAR(1,901,"coupling_channel_element(): ind_sw_cce_flag"));
num_coupled_elements = faad_getbits(ld, 3
- DEBUGVAR(1, 902, "coupling_channel_element(): num_coupled_elements"));
+ DEBUGVAR(1,902,"coupling_channel_element(): num_coupled_elements"));
- for(c = 0; c < num_coupled_elements + 1; c++)
+ for (c = 0; c < num_coupled_elements + 1; c++)
{
uint8_t cc_target_is_cpe, cc_target_tag_select;
num_gain_element_lists++;
cc_target_is_cpe = faad_get1bit(ld
- DEBUGVAR(1, 903, "coupling_channel_element(): cc_target_is_cpe"));
+ DEBUGVAR(1,903,"coupling_channel_element(): cc_target_is_cpe"));
cc_target_tag_select = faad_getbits(ld, 4
- DEBUGVAR(1, 904, "coupling_channel_element(): cc_target_tag_select"));
+ DEBUGVAR(1,904,"coupling_channel_element(): cc_target_tag_select"));
- if(cc_target_is_cpe)
+ if (cc_target_is_cpe)
{
uint8_t cc_l = faad_get1bit(ld
- DEBUGVAR(1, 905, "coupling_channel_element(): cc_l"));
+ DEBUGVAR(1,905,"coupling_channel_element(): cc_l"));
uint8_t cc_r = faad_get1bit(ld
- DEBUGVAR(1, 906, "coupling_channel_element(): cc_r"));
+ DEBUGVAR(1,906,"coupling_channel_element(): cc_r"));
- if(cc_l && cc_r)
+ if (cc_l && cc_r)
num_gain_element_lists++;
}
}
faad_get1bit(ld
- DEBUGVAR(1, 907, "coupling_channel_element(): cc_domain"));
+ DEBUGVAR(1,907,"coupling_channel_element(): cc_domain"));
faad_get1bit(ld
- DEBUGVAR(1, 908, "coupling_channel_element(): gain_element_sign"));
+ DEBUGVAR(1,908,"coupling_channel_element(): gain_element_sign"));
faad_getbits(ld, 2
- DEBUGVAR(1, 909, "coupling_channel_element(): gain_element_scale"));
+ DEBUGVAR(1,909,"coupling_channel_element(): gain_element_scale"));
- if((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty,
- 0, sh_data)) > 0)
+ if ((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty,
+ 0, sh_data)) > 0)
{
return result;
}
/* IS not allowed in single channel */
- if(ics->is_used)
+ if (ics->is_used)
return 32;
- for(c = 1; c < num_gain_element_lists; c++)
+ for (c = 1; c < num_gain_element_lists; c++)
{
uint8_t cge;
- if(ind_sw_cce_flag)
+ if (ind_sw_cce_flag)
{
cge = 1;
- }
- else
- {
+ } else {
cge = faad_get1bit(ld
- DEBUGVAR(1, 910, "coupling_channel_element(): common_gain_element_present"));
+ DEBUGVAR(1,910,"coupling_channel_element(): common_gain_element_present"));
}
- if(cge)
+ if (cge)
{
huffman_scale_factor(ld);
- }
- else
- {
+ } else {
uint8_t g, sfb;
- for(g = 0; g < ics_empty.num_window_groups; g++)
+ for (g = 0; g < ics_empty.num_window_groups; g++)
{
- for(sfb = 0; sfb < ics_empty.max_sfb; sfb++)
+ for (sfb = 0; sfb < ics_empty.max_sfb; sfb++)
{
- if(ics_empty.sfb_cb[g][sfb] != ZERO_HCB)
+ if (ics_empty.sfb_cb[g][sfb] != ZERO_HCB)
huffman_scale_factor(ld);
}
}
@@ -1039,25 +1015,24 @@ static uint16_t data_stream_element(NeAACDecStruct *hDecoder, bitfile *ld)
uint8_t byte_aligned;
uint16_t i, count;
- /* element_instance_tag = */
- faad_getbits(ld, LEN_TAG
- DEBUGVAR(1, 60, "data_stream_element(): element_instance_tag"));
+ /* element_instance_tag = */ faad_getbits(ld, LEN_TAG
+ DEBUGVAR(1,60,"data_stream_element(): element_instance_tag"));
byte_aligned = faad_get1bit(ld
- DEBUGVAR(1, 61, "data_stream_element(): byte_aligned"));
+ DEBUGVAR(1,61,"data_stream_element(): byte_aligned"));
count = (uint16_t)faad_getbits(ld, 8
- DEBUGVAR(1, 62, "data_stream_element(): count"));
- if(count == 255)
+ DEBUGVAR(1,62,"data_stream_element(): count"));
+ if (count == 255)
{
count += (uint16_t)faad_getbits(ld, 8
- DEBUGVAR(1, 63, "data_stream_element(): extra count"));
+ DEBUGVAR(1,63,"data_stream_element(): extra count"));
}
- if(byte_aligned)
+ if (byte_aligned)
faad_byte_align(ld);
- for(i = 0; i < count; i++)
+ for (i = 0; i < count; i++)
{
faad_getbits(ld, LEN_BYTE
- DEBUGVAR(1, 64, "data_stream_element(): data_stream_byte"));
+ DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
}
return count;
@@ -1066,9 +1041,9 @@ static uint16_t data_stream_element(NeAACDecStruct *hDecoder, bitfile *ld)
/* Table 4.4.11 */
static uint8_t fill_element(NeAACDecStruct *hDecoder, bitfile *ld, drc_info *drc
#ifdef SBR_DEC
- , uint8_t sbr_ele
+ ,uint8_t sbr_ele
#endif
- )
+ )
{
uint16_t count;
#ifdef SBR_DEC
@@ -1076,50 +1051,50 @@ static uint8_t fill_element(NeAACDecStruct *hDecoder, bitfile *ld, drc_info *drc
#endif
count = (uint16_t)faad_getbits(ld, 4
- DEBUGVAR(1, 65, "fill_element(): count"));
- if(count == 15)
+ DEBUGVAR(1,65,"fill_element(): count"));
+ if (count == 15)
{
count += (uint16_t)faad_getbits(ld, 8
- DEBUGVAR(1, 66, "fill_element(): extra count")) - 1;
+ DEBUGVAR(1,66,"fill_element(): extra count")) - 1;
}
- if(count > 0)
+ if (count > 0)
{
#ifdef SBR_DEC
bs_extension_type = (uint8_t)faad_showbits(ld, 4);
- if((bs_extension_type == EXT_SBR_DATA) ||
- (bs_extension_type == EXT_SBR_DATA_CRC))
+ if ((bs_extension_type == EXT_SBR_DATA) ||
+ (bs_extension_type == EXT_SBR_DATA_CRC))
{
- if(sbr_ele == INVALID_SBR_ELEMENT)
+ if (sbr_ele == INVALID_SBR_ELEMENT)
return 24;
- if(!hDecoder->sbr[sbr_ele])
+ if (!hDecoder->sbr[sbr_ele])
{
hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength,
- hDecoder->element_id[sbr_ele], 2 * get_sample_rate(hDecoder->sf_index),
- hDecoder->downSampledSBR
+ hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index),
+ hDecoder->downSampledSBR
#ifdef DRM
- , 0
+ , 0
#endif
- );
+ );
}
hDecoder->sbr_present_flag = 1;
/* parse the SBR data */
hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count,
- hDecoder->postSeekResetFlag);
+ hDecoder->postSeekResetFlag);
#if 0
- if(hDecoder->sbr[sbr_ele]->ret > 0)
+ if (hDecoder->sbr[sbr_ele]->ret > 0)
{
printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret));
}
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
- if(hDecoder->sbr[sbr_ele]->ps_used)
+ if (hDecoder->sbr[sbr_ele]->ps_used)
{
hDecoder->ps_used[sbr_ele] = 1;
@@ -1127,12 +1102,10 @@ static uint8_t fill_element(NeAACDecStruct *hDecoder, bitfile *ld, drc_info *drc
hDecoder->ps_used_global = 1;
}
#endif
- }
- else
- {
+ } else {
#endif
#ifndef DRM
- while(count > 0)
+ while (count > 0)
{
count -= extension_payload(ld, drc, count);
}
@@ -1155,96 +1128,86 @@ static void gain_control_data(bitfile *ld, ic_stream *ics)
ssr_info *ssr = &(ics->ssr);
ssr->max_band = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 1000, "gain_control_data(): max_band"));
+ DEBUGVAR(1,1000,"gain_control_data(): max_band"));
- if(ics->window_sequence == ONLY_LONG_SEQUENCE)
+ if (ics->window_sequence == ONLY_LONG_SEQUENCE)
{
- for(bd = 1; bd <= ssr->max_band; bd++)
+ for (bd = 1; bd <= ssr->max_band; bd++)
{
- for(wd = 0; wd < 1; wd++)
+ for (wd = 0; wd < 1; wd++)
{
ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 1001, "gain_control_data(): adjust_num"));
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
- for(ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
{
ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1002, "gain_control_data(): alevcode"));
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 1003, "gain_control_data(): aloccode"));
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
}
}
}
- }
- else if(ics->window_sequence == LONG_START_SEQUENCE)
- {
- for(bd = 1; bd <= ssr->max_band; bd++)
+ } else if (ics->window_sequence == LONG_START_SEQUENCE) {
+ for (bd = 1; bd <= ssr->max_band; bd++)
{
- for(wd = 0; wd < 2; wd++)
+ for (wd = 0; wd < 2; wd++)
{
ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 1001, "gain_control_data(): adjust_num"));
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
- for(ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
{
ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1002, "gain_control_data(): alevcode"));
- if(wd == 0)
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ if (wd == 0)
{
ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1003, "gain_control_data(): aloccode"));
- }
- else
- {
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ } else {
ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 1003, "gain_control_data(): aloccode"));
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
}
}
}
}
- }
- else if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
- {
- for(bd = 1; bd <= ssr->max_band; bd++)
+ } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) {
+ for (bd = 1; bd <= ssr->max_band; bd++)
{
- for(wd = 0; wd < 8; wd++)
+ for (wd = 0; wd < 8; wd++)
{
ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 1001, "gain_control_data(): adjust_num"));
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
- for(ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
{
ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1002, "gain_control_data(): alevcode"));
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 1003, "gain_control_data(): aloccode"));
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
}
}
}
- }
- else if(ics->window_sequence == LONG_STOP_SEQUENCE)
- {
- for(bd = 1; bd <= ssr->max_band; bd++)
+ } else if (ics->window_sequence == LONG_STOP_SEQUENCE) {
+ for (bd = 1; bd <= ssr->max_band; bd++)
{
- for(wd = 0; wd < 2; wd++)
+ for (wd = 0; wd < 2; wd++)
{
ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 1001, "gain_control_data(): adjust_num"));
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
- for(ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
{
ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1002, "gain_control_data(): alevcode"));
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
- if(wd == 0)
+ if (wd == 0)
{
ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 1003, "gain_control_data(): aloccode"));
- }
- else
- {
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ } else {
ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
- DEBUGVAR(1, 1003, "gain_control_data(): aloccode"));
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
}
}
}
@@ -1272,22 +1235,20 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
hDecoder->fr_ch_ele = 0;
hInfo->error = DRM_aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
cpe.common_window = 1;
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
hDecoder->element_id[0] = ID_CPE;
- if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
- }
- else
- {
+ } else {
hDecoder->element_id[0] = ID_SCE;
}
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
cpe.channel = 0;
cpe.paired_channel = 1;
@@ -1300,19 +1261,18 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
#if defined(LTP_DEC)
ics1->ltp.data_present = faad_get1bit(ld);
#elif defined (DRM)
- if(faad_get1bit(ld))
- {
- hInfo->error = 26;
- return;
+ if(faad_get1bit(ld)) {
+ hInfo->error = 26;
+ return;
}
#else
faad_get1bit(ld);
-#endif
+#endif
hInfo->error = side_info(hDecoder, &cpe, ld, ics1, 1);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
/* Stereo3 */
ics2->tns_data_present = faad_get1bit(ld);
@@ -1321,39 +1281,39 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
#endif
faad_get1bit(ld);
hInfo->error = side_info(hDecoder, &cpe, ld, ics2, 1);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
}
/* Stereo4 / Mono2 */
- if(ics1->tns_data_present)
+ if (ics1->tns_data_present)
tns_data(ics1, &(ics1->tns), ld);
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
/* Stereo5 */
- if(ics2->tns_data_present)
+ if (ics2->tns_data_present)
tns_data(ics2, &(ics2->tns), ld);
}
#ifdef DRM
/* CRC check */
- if(hDecoder->object_type == DRM_ER_LC)
+ if (hDecoder->object_type == DRM_ER_LC)
{
- if((hInfo->error = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
+ if ((hInfo->error = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
return;
}
#endif
/* Stereo6 / Mono3 */
/* error resilient spectral data decoding */
- if((hInfo->error = reordered_spectral_data(hDecoder, ics1, ld, spec_data1)) > 0)
+ if ((hInfo->error = reordered_spectral_data(hDecoder, ics1, ld, spec_data1)) > 0)
{
return;
}
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
/* Stereo7 */
/* error resilient spectral data decoding */
- if((hInfo->error = reordered_spectral_data(hDecoder, ics2, ld, spec_data2)) > 0)
+ if ((hInfo->error = reordered_spectral_data(hDecoder, ics2, ld, spec_data2)) > 0)
{
return;
}
@@ -1363,7 +1323,7 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
#ifdef DRM
#ifdef SBR_DEC
/* In case of DRM we need to read the SBR info before channel reconstruction */
- if((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC))
+ if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC))
{
bitfile ld_sbr = {0};
uint32_t i;
@@ -1377,29 +1337,29 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
uint32_t buffer_size = faad_origbitbuffer_size(ld);
uint8_t *buffer = (uint8_t*)faad_origbitbuffer(ld);
- if(bitsconsumed + 8 > buffer_size * 8)
+ if (bitsconsumed + 8 > buffer_size*8)
{
hInfo->error = 14;
return;
}
- if(!hDecoder->sbr[0])
+ if (!hDecoder->sbr[0])
{
hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0],
- 2 * get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1);
+ 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1);
}
/* Reverse bit reading of SBR data in DRM audio frame */
- revbuffer = (uint8_t*)faad_malloc(buffer_size * sizeof(uint8_t));
+ revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t));
prevbufstart = revbuffer;
pbufend = &buffer[buffer_size - 1];
- for(i = 0; i < buffer_size; i++)
+ for (i = 0; i < buffer_size; i++)
*prevbufstart++ = tabFlipbits[*pbufend--];
/* Set SBR data */
/* consider 8 bits from AAC-CRC */
/* SBR buffer size is original buffer size minus AAC buffer size */
- count = (uint16_t)bit2byte(buffer_size * 8 - bitsconsumed);
+ count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed);
faad_initbits(&ld_sbr, revbuffer, count);
hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index);
@@ -1409,59 +1369,55 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count, hDecoder->postSeekResetFlag);
#if (defined(PS_DEC) || defined(DRM_PS))
- if(hDecoder->sbr[0]->ps_used)
+ if (hDecoder->sbr[0]->ps_used)
{
hDecoder->ps_used[0] = 1;
hDecoder->ps_used_global = 1;
}
#endif
- if(ld_sbr.error)
+ if (ld_sbr.error)
{
hDecoder->sbr[0]->ret = 1;
}
/* check CRC */
/* no need to check it if there was already an error */
- if(hDecoder->sbr[0]->ret == 0)
+ if (hDecoder->sbr[0]->ret == 0)
hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8);
/* SBR data was corrupted, disable it until the next header */
- if(hDecoder->sbr[0]->ret != 0)
+ if (hDecoder->sbr[0]->ret != 0)
{
hDecoder->sbr[0]->header_count = 0;
}
faad_endbits(&ld_sbr);
- if(revbuffer)
+ if (revbuffer)
faad_free(revbuffer);
}
#endif
#endif
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
hInfo->error = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
- }
- else
- {
+ } else {
hInfo->error = reconstruct_single_channel(hDecoder, ics1, &cpe, spec_data1);
- if(hInfo->error > 0)
+ if (hInfo->error > 0)
return;
}
/* map output channels position to internal data channels */
- if(hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
{
/* this might be faulty when pce_set is true */
hDecoder->internal_channel[channels] = channels;
- hDecoder->internal_channel[channels+1] = channels + 1;
- }
- else
- {
+ hDecoder->internal_channel[channels+1] = channels+1;
+ } else {
hDecoder->internal_channel[channels] = channels;
}
@@ -1473,7 +1429,7 @@ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *
/* Table 4.4.15 */
static int8_t DRM_aac_scalable_main_header(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2,
- bitfile *ld, uint8_t this_layer_stereo)
+ bitfile *ld, uint8_t this_layer_stereo)
{
uint8_t retval = 0;
uint8_t ch;
@@ -1481,62 +1437,58 @@ static int8_t DRM_aac_scalable_main_header(NeAACDecStruct *hDecoder, ic_stream *
uint8_t ics_reserved_bit;
ics_reserved_bit = faad_get1bit(ld
- DEBUGVAR(1, 300, "aac_scalable_main_header(): ics_reserved_bits"));
- if(ics_reserved_bit != 0)
+ DEBUGVAR(1,300,"aac_scalable_main_header(): ics_reserved_bits"));
+ if (ics_reserved_bit != 0)
return 32;
ics1->window_sequence = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 301, "aac_scalable_main_header(): window_sequence"));
+ DEBUGVAR(1,301,"aac_scalable_main_header(): window_sequence"));
ics1->window_shape = faad_get1bit(ld
- DEBUGVAR(1, 302, "aac_scalable_main_header(): window_shape"));
+ DEBUGVAR(1,302,"aac_scalable_main_header(): window_shape"));
- if(ics1->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE)
{
ics1->max_sfb = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 303, "aac_scalable_main_header(): max_sfb (short)"));
+ DEBUGVAR(1,303,"aac_scalable_main_header(): max_sfb (short)"));
ics1->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7
- DEBUGVAR(1, 304, "aac_scalable_main_header(): scale_factor_grouping"));
- }
- else
- {
+ DEBUGVAR(1,304,"aac_scalable_main_header(): scale_factor_grouping"));
+ } else {
ics1->max_sfb = (uint8_t)faad_getbits(ld, 6
- DEBUGVAR(1, 305, "aac_scalable_main_header(): max_sfb (long)"));
+ DEBUGVAR(1,305,"aac_scalable_main_header(): max_sfb (long)"));
}
/* get the grouping information */
- if((retval = window_grouping_info(hDecoder, ics1)) > 0)
+ if ((retval = window_grouping_info(hDecoder, ics1)) > 0)
return retval;
/* should be an error */
/* check the range of max_sfb */
- if(ics1->max_sfb > ics1->num_swb)
+ if (ics1->max_sfb > ics1->num_swb)
return 16;
- if(this_layer_stereo)
+ if (this_layer_stereo)
{
ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 306, "aac_scalable_main_header(): ms_mask_present"));
- if(ics1->ms_mask_present == 3)
+ DEBUGVAR(1,306,"aac_scalable_main_header(): ms_mask_present"));
+ if (ics1->ms_mask_present == 3)
{
/* bitstream error */
return 32;
}
- if(ics1->ms_mask_present == 1)
+ if (ics1->ms_mask_present == 1)
{
uint8_t g, sfb;
- for(g = 0; g < ics1->num_window_groups; g++)
+ for (g = 0; g < ics1->num_window_groups; g++)
{
- for(sfb = 0; sfb < ics1->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics1->max_sfb; sfb++)
{
ics1->ms_used[g][sfb] = faad_get1bit(ld
- DEBUGVAR(1, 307, "aac_scalable_main_header(): faad_get1bit"));
+ DEBUGVAR(1,307,"aac_scalable_main_header(): faad_get1bit"));
}
}
}
memcpy(ics2, ics1, sizeof(ic_stream));
- }
- else
- {
+ } else {
ics1->ms_mask_present = 0;
}
@@ -1550,21 +1502,21 @@ static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele,
uint8_t result;
ics->global_gain = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 67, "individual_channel_stream(): global_gain"));
+ DEBUGVAR(1,67,"individual_channel_stream(): global_gain"));
- if(!ele->common_window && !scal_flag)
+ if (!ele->common_window && !scal_flag)
{
- if((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0)
+ if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0)
return result;
}
- if((result = section_data(hDecoder, ics, ld)) > 0)
+ if ((result = section_data(hDecoder, ics, ld)) > 0)
return result;
- if((result = scale_factor_data(hDecoder, ics, ld)) > 0)
+ if ((result = scale_factor_data(hDecoder, ics, ld)) > 0)
return result;
- if(!scal_flag)
+ if (!scal_flag)
{
/**
** NOTE: It could be that pulse data is available in scalable AAC too,
@@ -1572,29 +1524,29 @@ static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele,
** though. (have to check this out later)
**/
/* get pulse data */
- if((ics->pulse_data_present = faad_get1bit(ld
- DEBUGVAR(1, 68, "individual_channel_stream(): pulse_data_present"))) & 1)
+ if ((ics->pulse_data_present = faad_get1bit(ld
+ DEBUGVAR(1,68,"individual_channel_stream(): pulse_data_present"))) & 1)
{
- if((result = pulse_data(ics, &(ics->pul), ld)) > 0)
+ if ((result = pulse_data(ics, &(ics->pul), ld)) > 0)
return result;
}
/* get tns data */
- if((ics->tns_data_present = faad_get1bit(ld
- DEBUGVAR(1, 69, "individual_channel_stream(): tns_data_present"))) & 1)
+ if ((ics->tns_data_present = faad_get1bit(ld
+ DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1)
{
#ifdef ERROR_RESILIENCE
- if(hDecoder->object_type < ER_OBJECT_START)
+ if (hDecoder->object_type < ER_OBJECT_START)
#endif
tns_data(ics, &(ics->tns), ld);
}
/* get gain control data */
- if((ics->gain_control_data_present = faad_get1bit(ld
- DEBUGVAR(1, 70, "individual_channel_stream(): gain_control_data_present"))) & 1)
+ if ((ics->gain_control_data_present = faad_get1bit(ld
+ DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1)
{
#ifdef SSR_DEC
- if(hDecoder->object_type != SSR)
+ if (hDecoder->object_type != SSR)
return 1;
else
gain_control_data(ld, ics);
@@ -1605,32 +1557,30 @@ static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele,
}
#ifdef ERROR_RESILIENCE
- if(hDecoder->aacSpectralDataResilienceFlag)
+ if (hDecoder->aacSpectralDataResilienceFlag)
{
ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14
- DEBUGVAR(1, 147, "individual_channel_stream(): length_of_reordered_spectral_data"));
+ DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data"));
- if(hDecoder->channelConfiguration == 2)
+ if (hDecoder->channelConfiguration == 2)
{
- if(ics->length_of_reordered_spectral_data > 6144)
+ if (ics->length_of_reordered_spectral_data > 6144)
ics->length_of_reordered_spectral_data = 6144;
- }
- else
- {
- if(ics->length_of_reordered_spectral_data > 12288)
+ } else {
+ if (ics->length_of_reordered_spectral_data > 12288)
ics->length_of_reordered_spectral_data = 12288;
}
ics->length_of_longest_codeword = (uint8_t)faad_getbits(ld, 6
- DEBUGVAR(1, 148, "individual_channel_stream(): length_of_longest_codeword"));
- if(ics->length_of_longest_codeword >= 49)
+ DEBUGVAR(1,148,"individual_channel_stream(): length_of_longest_codeword"));
+ if (ics->length_of_longest_codeword >= 49)
ics->length_of_longest_codeword = 49;
}
/* RVLC spectral data is put here */
- if(hDecoder->aacScalefactorDataResilienceFlag)
+ if (hDecoder->aacScalefactorDataResilienceFlag)
{
- if((result = rvlc_decode_scale_factors(ics, ld)) > 0)
+ if ((result = rvlc_decode_scale_factors(ics, ld)) > 0)
return result;
}
#endif
@@ -1640,44 +1590,42 @@ static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele,
/* Table 4.4.24 */
static uint8_t individual_channel_stream(NeAACDecStruct *hDecoder, element *ele,
- bitfile *ld, ic_stream *ics, uint8_t scal_flag,
- int16_t *spec_data)
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+ int16_t *spec_data)
{
uint8_t result;
result = side_info(hDecoder, ele, ld, ics, scal_flag);
- if(result > 0)
+ if (result > 0)
return result;
- if(hDecoder->object_type >= ER_OBJECT_START)
+ if (hDecoder->object_type >= ER_OBJECT_START)
{
- if(ics->tns_data_present)
+ if (ics->tns_data_present)
tns_data(ics, &(ics->tns), ld);
}
#ifdef DRM
/* CRC check */
- if(hDecoder->object_type == DRM_ER_LC)
+ if (hDecoder->object_type == DRM_ER_LC)
{
- if((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
+ if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
return result;
}
#endif
#ifdef ERROR_RESILIENCE
- if(hDecoder->aacSpectralDataResilienceFlag)
+ if (hDecoder->aacSpectralDataResilienceFlag)
{
/* error resilient spectral data decoding */
- if((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+ if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0)
{
return result;
}
- }
- else
- {
+ } else {
#endif
/* decode the spectral data */
- if((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+ if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0)
{
return result;
}
@@ -1686,15 +1634,13 @@ static uint8_t individual_channel_stream(NeAACDecStruct *hDecoder, element *ele,
#endif
/* pulse coding reconstruction */
- if(ics->pulse_data_present)
+ if (ics->pulse_data_present)
{
- if(ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{
- if((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0)
+ if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0)
return result;
- }
- else
- {
+ } else {
return 2; /* pulse coding not allowed for short blocks */
}
}
@@ -1708,23 +1654,23 @@ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *l
uint8_t g;
uint8_t sect_esc_val, sect_bits;
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
sect_bits = 3;
else
sect_bits = 5;
- sect_esc_val = (1 << sect_bits) - 1;
+ sect_esc_val = (1<<sect_bits) - 1;
#if 0
printf("\ntotal sfb %d\n", ics->max_sfb);
printf(" sect top cb\n");
#endif
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
uint8_t k = 0;
uint8_t i = 0;
- while(k < ics->max_sfb)
+ while (k < ics->max_sfb)
{
#ifdef ERROR_RESILIENCE
uint8_t vcb11 = 0;
@@ -1736,18 +1682,18 @@ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *l
/* if "faad_getbits" detects error and returns "0", "k" is never
incremented and we cannot leave the while loop */
- if(ld->error != 0)
+ if (ld->error != 0)
return 14;
#ifdef ERROR_RESILIENCE
- if(hDecoder->aacSectionDataResilienceFlag)
+ if (hDecoder->aacSectionDataResilienceFlag)
sect_cb_bits = 5;
#endif
ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits
- DEBUGVAR(1, 71, "section_data(): sect_cb"));
+ DEBUGVAR(1,71,"section_data(): sect_cb"));
- if(ics->sect_cb[g][i] == 12)
+ if (ics->sect_cb[g][i] == 12)
return 32;
#if 0
@@ -1755,43 +1701,41 @@ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *l
#endif
#ifndef DRM
- if(ics->sect_cb[g][i] == NOISE_HCB)
+ if (ics->sect_cb[g][i] == NOISE_HCB)
ics->noise_used = 1;
#else
/* PNS not allowed in DRM */
- if(ics->sect_cb[g][i] == NOISE_HCB)
+ if (ics->sect_cb[g][i] == NOISE_HCB)
return 29;
#endif
- if(ics->sect_cb[g][i] == INTENSITY_HCB2 || ics->sect_cb[g][i] == INTENSITY_HCB)
+ if (ics->sect_cb[g][i] == INTENSITY_HCB2 || ics->sect_cb[g][i] == INTENSITY_HCB)
ics->is_used = 1;
#ifdef ERROR_RESILIENCE
- if(hDecoder->aacSectionDataResilienceFlag)
+ if (hDecoder->aacSectionDataResilienceFlag)
{
- if((ics->sect_cb[g][i] == 11) ||
- ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32)))
+ if ((ics->sect_cb[g][i] == 11) ||
+ ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32)))
{
vcb11 = 1;
}
}
- if(vcb11)
+ if (vcb11)
{
sect_len_incr = 1;
- }
- else
- {
+ } else {
#endif
sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits
- DEBUGVAR(1, 72, "section_data(): sect_len_incr"));
+ DEBUGVAR(1,72,"section_data(): sect_len_incr"));
#ifdef ERROR_RESILIENCE
}
#endif
- while((sect_len_incr == sect_esc_val) /* &&
+ while ((sect_len_incr == sect_esc_val) /* &&
(k+sect_len < ics->max_sfb)*/)
{
sect_len += sect_len_incr;
sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits
- DEBUGVAR(1, 72, "section_data(): sect_len_incr"));
+ DEBUGVAR(1,72,"section_data(): sect_len_incr"));
}
sect_len += sect_len_incr;
@@ -1806,22 +1750,20 @@ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *l
printf("%d\n", ics->sect_end[g][i]);
#endif
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
- if(k + sect_len > 8 * 15)
+ if (k + sect_len > 8*15)
return 15;
- if(i >= 8 * 15)
+ if (i >= 8*15)
return 15;
- }
- else
- {
- if(k + sect_len > MAX_SFB)
+ } else {
+ if (k + sect_len > MAX_SFB)
return 15;
- if(i >= MAX_SFB)
+ if (i >= MAX_SFB)
return 15;
}
- for(sfb = k; sfb < k + sect_len; sfb++)
+ for (sfb = k; sfb < k + sect_len; sfb++)
{
ics->sfb_cb[g][sfb] = ics->sect_cb[g][i];
#if 0
@@ -1831,9 +1773,9 @@ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *l
#if 0
printf(" %6d %6d %6d\n",
- i,
- ics->sect_end[g][i],
- ics->sect_cb[g][i]);
+ i,
+ ics->sect_end[g][i],
+ ics->sect_cb[g][i]);
#endif
k += sect_len;
@@ -1843,7 +1785,7 @@ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *l
/* the sum of all sect_len_incr elements for a given window
* group shall equal max_sfb */
- if(k != ics->max_sfb)
+ if (k != ics->max_sfb)
{
return 32;
}
@@ -1880,11 +1822,11 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld)
int16_t is_position = 0;
int16_t noise_energy = ics->global_gain - 90;
- for(g = 0; g < ics->num_window_groups; g++)
+ for (g = 0; g < ics->num_window_groups; g++)
{
- for(sfb = 0; sfb < ics->max_sfb; sfb++)
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
- switch(ics->sfb_cb[g][sfb])
+ switch (ics->sfb_cb[g][sfb])
{
case ZERO_HCB: /* zero book */
ics->scale_factors[g][sfb] = 0;
@@ -1909,14 +1851,12 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld)
#ifndef DRM
/* decode noise energy */
- if(noise_pcm_flag)
+ if (noise_pcm_flag)
{
noise_pcm_flag = 0;
t = (int16_t)faad_getbits(ld, 9
- DEBUGVAR(1, 73, "scale_factor_data(): first noise")) - 256;
- }
- else
- {
+ DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256;
+ } else {
t = huffman_scale_factor(ld);
t -= 60;
}
@@ -1940,7 +1880,7 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld)
/* decode scale factor */
t = huffman_scale_factor(ld);
scale_factor += (t - 60);
- if(scale_factor < 0 || scale_factor > 255)
+ if (scale_factor < 0 || scale_factor > 255)
return 4;
ics->scale_factors[g][sfb] = scale_factor;
#ifdef SF_PRINT
@@ -1964,14 +1904,12 @@ static uint8_t scale_factor_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfi
#endif
#ifdef ERROR_RESILIENCE
- if(!hDecoder->aacScalefactorDataResilienceFlag)
+ if (!hDecoder->aacScalefactorDataResilienceFlag)
{
#endif
ret = decode_scale_factors(ics, ld);
#ifdef ERROR_RESILIENCE
- }
- else
- {
+ } else {
/* In ER AAC the parameters for RVLC are seperated from the actual
data that holds the scale_factors.
Strangely enough, 2 parameters for HCR are put inbetween them.
@@ -1996,30 +1934,28 @@ static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld)
uint8_t length_bits = 6;
uint8_t order_bits = 5;
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
n_filt_bits = 1;
length_bits = 4;
order_bits = 3;
}
- for(w = 0; w < ics->num_windows; w++)
+ for (w = 0; w < ics->num_windows; w++)
{
tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits
- DEBUGVAR(1, 74, "tns_data(): n_filt"));
+ DEBUGVAR(1,74,"tns_data(): n_filt"));
#if 0
printf("%d\n", tns->n_filt[w]);
#endif
- if(tns->n_filt[w])
+ if (tns->n_filt[w])
{
- if((tns->coef_res[w] = faad_get1bit(ld
- DEBUGVAR(1, 75, "tns_data(): coef_res"))) & 1)
+ if ((tns->coef_res[w] = faad_get1bit(ld
+ DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1)
{
start_coef_bits = 4;
- }
- else
- {
+ } else {
start_coef_bits = 3;
}
#if 0
@@ -2027,36 +1963,36 @@ static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld)
#endif
}
- for(filt = 0; filt < tns->n_filt[w]; filt++)
+ for (filt = 0; filt < tns->n_filt[w]; filt++)
{
tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits
- DEBUGVAR(1, 76, "tns_data(): length"));
+ DEBUGVAR(1,76,"tns_data(): length"));
#if 0
printf("%d\n", tns->length[w][filt]);
#endif
tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits
- DEBUGVAR(1, 77, "tns_data(): order"));
+ DEBUGVAR(1,77,"tns_data(): order"));
#if 0
printf("%d\n", tns->order[w][filt]);
#endif
- if(tns->order[w][filt])
+ if (tns->order[w][filt])
{
tns->direction[w][filt] = faad_get1bit(ld
- DEBUGVAR(1, 78, "tns_data(): direction"));
+ DEBUGVAR(1,78,"tns_data(): direction"));
#if 0
printf("%d\n", tns->direction[w][filt]);
#endif
tns->coef_compress[w][filt] = faad_get1bit(ld
- DEBUGVAR(1, 79, "tns_data(): coef_compress"));
+ DEBUGVAR(1,79,"tns_data(): coef_compress"));
#if 0
printf("%d\n", tns->coef_compress[w][filt]);
#endif
coef_bits = start_coef_bits - tns->coef_compress[w][filt];
- for(i = 0; i < tns->order[w][filt]; i++)
+ for (i = 0; i < tns->order[w][filt]; i++)
{
tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits
- DEBUGVAR(1, 80, "tns_data(): coef"));
+ DEBUGVAR(1,80,"tns_data(): coef"));
#if 0
printf("%d\n", tns->coef[w][filt][i]);
#endif
@@ -2075,58 +2011,54 @@ static uint8_t ltp_data(NeAACDecStruct *hDecoder, ic_stream *ics, ltp_info *ltp,
ltp->lag = 0;
#ifdef LD_DEC
- if(hDecoder->object_type == LD)
+ if (hDecoder->object_type == LD)
{
ltp->lag_update = (uint8_t)faad_getbits(ld, 1
- DEBUGVAR(1, 142, "ltp_data(): lag_update"));
+ DEBUGVAR(1,142,"ltp_data(): lag_update"));
- if(ltp->lag_update)
+ if (ltp->lag_update)
{
ltp->lag = (uint16_t)faad_getbits(ld, 10
- DEBUGVAR(1, 81, "ltp_data(): lag"));
+ DEBUGVAR(1,81,"ltp_data(): lag"));
}
- }
- else
- {
+ } else {
#endif
ltp->lag = (uint16_t)faad_getbits(ld, 11
- DEBUGVAR(1, 81, "ltp_data(): lag"));
+ DEBUGVAR(1,81,"ltp_data(): lag"));
#ifdef LD_DEC
}
#endif
/* Check length of lag */
- if(ltp->lag > (hDecoder->frameLength << 1))
+ if (ltp->lag > (hDecoder->frameLength << 1))
return 18;
ltp->coef = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 82, "ltp_data(): coef"));
+ DEBUGVAR(1,82,"ltp_data(): coef"));
- if(ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
- for(w = 0; w < ics->num_windows; w++)
+ for (w = 0; w < ics->num_windows; w++)
{
- if((ltp->short_used[w] = faad_get1bit(ld
- DEBUGVAR(1, 83, "ltp_data(): short_used"))) & 1)
+ if ((ltp->short_used[w] = faad_get1bit(ld
+ DEBUGVAR(1,83,"ltp_data(): short_used"))) & 1)
{
ltp->short_lag_present[w] = faad_get1bit(ld
- DEBUGVAR(1, 84, "ltp_data(): short_lag_present"));
- if(ltp->short_lag_present[w])
+ DEBUGVAR(1,84,"ltp_data(): short_lag_present"));
+ if (ltp->short_lag_present[w])
{
ltp->short_lag[w] = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 85, "ltp_data(): short_lag"));
+ DEBUGVAR(1,85,"ltp_data(): short_lag"));
}
}
}
- }
- else
- {
+ } else {
ltp->last_band = (ics->max_sfb < MAX_LTP_SFB ? ics->max_sfb : MAX_LTP_SFB);
- for(sfb = 0; sfb < ltp->last_band; sfb++)
+ for (sfb = 0; sfb < ltp->last_band; sfb++)
{
ltp->long_used[sfb] = faad_get1bit(ld
- DEBUGVAR(1, 86, "ltp_data(): long_used"));
+ DEBUGVAR(1,86,"ltp_data(): long_used"));
}
}
@@ -2144,7 +2076,7 @@ static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *
uint8_t groups = 0;
uint8_t sect_cb;
uint8_t result;
- uint16_t nshort = hDecoder->frameLength / 8;
+ uint16_t nshort = hDecoder->frameLength/8;
#ifdef PROFILE
int64_t count = faad_get_ts();
@@ -2152,15 +2084,15 @@ static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *
for(g = 0; g < ics->num_window_groups; g++)
{
- p = groups * nshort;
+ p = groups*nshort;
- for(i = 0; i < ics->num_sec[g]; i++)
+ for (i = 0; i < ics->num_sec[g]; i++)
{
sect_cb = ics->sect_cb[g][i];
inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4;
- switch(sect_cb)
+ switch (sect_cb)
{
case ZERO_HCB:
case NOISE_HCB:
@@ -2170,7 +2102,7 @@ static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *
#ifdef SD_PRINT
{
int j;
- for(j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++)
+ for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++)
{
printf("%d\n", 0);
}
@@ -2181,21 +2113,21 @@ static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *
printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
#endif
p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] -
- ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+ ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
break;
default:
#ifdef SFBO_PRINT
printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
#endif
- for(k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
- k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
+ for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
+ k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
{
- if((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
+ if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
return result;
#ifdef SD_PRINT
{
int j;
- for(j = p; j < p + inc; j++)
+ for (j = p; j < p+inc; j++)
{
printf("%d\n", spectral_data[j]);
}
@@ -2225,46 +2157,43 @@ static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count)
uint8_t align = 4, data_element_version, loopCounter;
uint8_t extension_type = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 87, "extension_payload(): extension_type"));
+ DEBUGVAR(1,87,"extension_payload(): extension_type"));
- switch(extension_type)
+ switch (extension_type)
{
case EXT_DYNAMIC_RANGE:
drc->present = 1;
n = dynamic_range_info(ld, drc);
return n;
case EXT_FILL_DATA:
- /* fill_nibble = */
- faad_getbits(ld, 4
- DEBUGVAR(1, 136, "extension_payload(): fill_nibble")); /* must be ‘0000’ */
- for(i = 0; i < count - 1; i++)
+ /* fill_nibble = */ faad_getbits(ld, 4
+ DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be ‘0000’ */
+ for (i = 0; i < count-1; i++)
{
/* fill_byte[i] = */ faad_getbits(ld, 8
- DEBUGVAR(1, 88, "extension_payload(): fill_byte")); /* must be ‘10100101’ */
+ DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be ‘10100101’ */
}
return count;
case EXT_DATA_ELEMENT:
data_element_version = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 400, "extension_payload(): data_element_version"));
- switch(data_element_version)
+ DEBUGVAR(1,400,"extension_payload(): data_element_version"));
+ switch (data_element_version)
{
case ANC_DATA:
loopCounter = 0;
dataElementLength = 0;
- do
- {
+ do {
dataElementLengthPart = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 401, "extension_payload(): dataElementLengthPart"));
+ DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart"));
dataElementLength += dataElementLengthPart;
loopCounter++;
- }
- while(dataElementLengthPart == 255);
+ } while (dataElementLengthPart == 255);
- for(i = 0; i < dataElementLength; i++)
+ for (i = 0; i < dataElementLength; i++)
{
/* data_element_byte[i] = */ faad_getbits(ld, 8
- DEBUGVAR(1, 402, "extension_payload(): data_element_byte"));
- return (dataElementLength + loopCounter + 1);
+ DEBUGVAR(1,402,"extension_payload(): data_element_byte"));
+ return (dataElementLength+loopCounter+1);
}
default:
align = 0;
@@ -2272,11 +2201,11 @@ static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count)
case EXT_FIL:
default:
faad_getbits(ld, align
- DEBUGVAR(1, 88, "extension_payload(): fill_nibble"));
- for(i = 0; i < count - 1; i++)
+ DEBUGVAR(1,88,"extension_payload(): fill_nibble"));
+ for (i = 0; i < count-1; i++)
{
/* other_bits[i] = */ faad_getbits(ld, 8
- DEBUGVAR(1, 89, "extension_payload(): fill_bit"));
+ DEBUGVAR(1,89,"extension_payload(): fill_bit"));
}
return count;
}
@@ -2290,60 +2219,57 @@ static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc)
drc->num_bands = 1;
- if(faad_get1bit(ld
- DEBUGVAR(1, 90, "dynamic_range_info(): has instance_tag")) & 1)
+ if (faad_get1bit(ld
+ DEBUGVAR(1,90,"dynamic_range_info(): has instance_tag")) & 1)
{
drc->pce_instance_tag = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 91, "dynamic_range_info(): pce_instance_tag"));
- /* drc->drc_tag_reserved_bits = */
- faad_getbits(ld, 4
- DEBUGVAR(1, 92, "dynamic_range_info(): drc_tag_reserved_bits"));
+ DEBUGVAR(1,91,"dynamic_range_info(): pce_instance_tag"));
+ /* drc->drc_tag_reserved_bits = */ faad_getbits(ld, 4
+ DEBUGVAR(1,92,"dynamic_range_info(): drc_tag_reserved_bits"));
n++;
}
drc->excluded_chns_present = faad_get1bit(ld
- DEBUGVAR(1, 93, "dynamic_range_info(): excluded_chns_present"));
- if(drc->excluded_chns_present == 1)
+ DEBUGVAR(1,93,"dynamic_range_info(): excluded_chns_present"));
+ if (drc->excluded_chns_present == 1)
{
n += excluded_channels(ld, drc);
}
- if(faad_get1bit(ld
- DEBUGVAR(1, 94, "dynamic_range_info(): has bands data")) & 1)
+ if (faad_get1bit(ld
+ DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1)
{
band_incr = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 95, "dynamic_range_info(): band_incr"));
- /* drc->drc_bands_reserved_bits = */
- faad_getbits(ld, 4
- DEBUGVAR(1, 96, "dynamic_range_info(): drc_bands_reserved_bits"));
+ DEBUGVAR(1,95,"dynamic_range_info(): band_incr"));
+ /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4
+ DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits"));
n++;
drc->num_bands += band_incr;
- for(i = 0; i < drc->num_bands; i++)
+ for (i = 0; i < drc->num_bands; i++)
{
drc->band_top[i] = (uint8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 97, "dynamic_range_info(): band_top"));
+ DEBUGVAR(1,97,"dynamic_range_info(): band_top"));
n++;
}
}
- if(faad_get1bit(ld
- DEBUGVAR(1, 98, "dynamic_range_info(): has prog_ref_level")) & 1)
+ if (faad_get1bit(ld
+ DEBUGVAR(1,98,"dynamic_range_info(): has prog_ref_level")) & 1)
{
drc->prog_ref_level = (uint8_t)faad_getbits(ld, 7
- DEBUGVAR(1, 99, "dynamic_range_info(): prog_ref_level"));
- /* drc->prog_ref_level_reserved_bits = */
- faad_get1bit(ld
- DEBUGVAR(1, 100, "dynamic_range_info(): prog_ref_level_reserved_bits"));
+ DEBUGVAR(1,99,"dynamic_range_info(): prog_ref_level"));
+ /* drc->prog_ref_level_reserved_bits = */ faad_get1bit(ld
+ DEBUGVAR(1,100,"dynamic_range_info(): prog_ref_level_reserved_bits"));
n++;
}
- for(i = 0; i < drc->num_bands; i++)
+ for (i = 0; i < drc->num_bands; i++)
{
drc->dyn_rng_sgn[i] = faad_get1bit(ld
- DEBUGVAR(1, 101, "dynamic_range_info(): dyn_rng_sgn"));
+ DEBUGVAR(1,101,"dynamic_range_info(): dyn_rng_sgn"));
drc->dyn_rng_ctl[i] = (uint8_t)faad_getbits(ld, 7
- DEBUGVAR(1, 102, "dynamic_range_info(): dyn_rng_ctl"));
+ DEBUGVAR(1,102,"dynamic_range_info(): dyn_rng_ctl"));
n++;
}
@@ -2356,20 +2282,20 @@ static uint8_t excluded_channels(bitfile *ld, drc_info *drc)
uint8_t i, n = 0;
uint8_t num_excl_chan = 7;
- for(i = 0; i < 7; i++)
+ for (i = 0; i < 7; i++)
{
drc->exclude_mask[i] = faad_get1bit(ld
- DEBUGVAR(1, 103, "excluded_channels(): exclude_mask"));
+ DEBUGVAR(1,103,"excluded_channels(): exclude_mask"));
}
n++;
- while((drc->additional_excluded_chns[n-1] = faad_get1bit(ld
- DEBUGVAR(1, 104, "excluded_channels(): additional_excluded_chns"))) == 1)
+ while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld
+ DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1)
{
- for(i = num_excl_chan; i < num_excl_chan + 7; i++)
+ for (i = num_excl_chan; i < num_excl_chan+7; i++)
{
drc->exclude_mask[i] = faad_get1bit(ld
- DEBUGVAR(1, 105, "excluded_channels(): exclude_mask"));
+ DEBUGVAR(1,105,"excluded_channels(): exclude_mask"));
}
n++;
num_excl_chan += 7;
@@ -2385,49 +2311,43 @@ void get_adif_header(adif_header *adif, bitfile *ld)
{
uint8_t i;
- /* adif_id[0] = */
- faad_getbits(ld, 8
- DEBUGVAR(1, 106, "get_adif_header(): adif_id[0]"));
- /* adif_id[1] = */
- faad_getbits(ld, 8
- DEBUGVAR(1, 107, "get_adif_header(): adif_id[1]"));
- /* adif_id[2] = */
- faad_getbits(ld, 8
- DEBUGVAR(1, 108, "get_adif_header(): adif_id[2]"));
- /* adif_id[3] = */
- faad_getbits(ld, 8
- DEBUGVAR(1, 109, "get_adif_header(): adif_id[3]"));
+ /* adif_id[0] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,106,"get_adif_header(): adif_id[0]"));
+ /* adif_id[1] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,107,"get_adif_header(): adif_id[1]"));
+ /* adif_id[2] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,108,"get_adif_header(): adif_id[2]"));
+ /* adif_id[3] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,109,"get_adif_header(): adif_id[3]"));
adif->copyright_id_present = faad_get1bit(ld
- DEBUGVAR(1, 110, "get_adif_header(): copyright_id_present"));
+ DEBUGVAR(1,110,"get_adif_header(): copyright_id_present"));
if(adif->copyright_id_present)
{
- for(i = 0; i < 72 / 8; i++)
+ for (i = 0; i < 72/8; i++)
{
adif->copyright_id[i] = (int8_t)faad_getbits(ld, 8
- DEBUGVAR(1, 111, "get_adif_header(): copyright_id"));
+ DEBUGVAR(1,111,"get_adif_header(): copyright_id"));
}
adif->copyright_id[i] = 0;
}
adif->original_copy = faad_get1bit(ld
- DEBUGVAR(1, 112, "get_adif_header(): original_copy"));
+ DEBUGVAR(1,112,"get_adif_header(): original_copy"));
adif->home = faad_get1bit(ld
- DEBUGVAR(1, 113, "get_adif_header(): home"));
+ DEBUGVAR(1,113,"get_adif_header(): home"));
adif->bitstream_type = faad_get1bit(ld
- DEBUGVAR(1, 114, "get_adif_header(): bitstream_type"));
+ DEBUGVAR(1,114,"get_adif_header(): bitstream_type"));
adif->bitrate = faad_getbits(ld, 23
- DEBUGVAR(1, 115, "get_adif_header(): bitrate"));
+ DEBUGVAR(1,115,"get_adif_header(): bitrate"));
adif->num_program_config_elements = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 116, "get_adif_header(): num_program_config_elements"));
+ DEBUGVAR(1,116,"get_adif_header(): num_program_config_elements"));
- for(i = 0; i < adif->num_program_config_elements + 1; i++)
+ for (i = 0; i < adif->num_program_config_elements + 1; i++)
{
if(adif->bitstream_type == 0)
{
adif->adif_buffer_fullness = faad_getbits(ld, 20
- DEBUGVAR(1, 117, "get_adif_header(): adif_buffer_fullness"));
- }
- else
- {
+ DEBUGVAR(1,117,"get_adif_header(): adif_buffer_fullness"));
+ } else {
adif->adif_buffer_fullness = 0;
}
@@ -2439,7 +2359,7 @@ void get_adif_header(adif_header *adif, bitfile *ld)
uint8_t adts_frame(adts_header *adts, bitfile *ld)
{
/* faad_byte_align(ld); */
- if(adts_fixed_header(adts, ld))
+ if (adts_fixed_header(adts, ld))
return 5;
adts_variable_header(adts, ld);
adts_error_check(adts, ld);
@@ -2454,51 +2374,49 @@ static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld)
uint8_t sync_err = 1;
/* try to recover from sync errors */
- for(i = 0; i < 768; i++)
+ for (i = 0; i < 768; i++)
{
adts->syncword = (uint16_t)faad_showbits(ld, 12);
- if(adts->syncword != 0xFFF)
+ if (adts->syncword != 0xFFF)
{
faad_getbits(ld, 8
- DEBUGVAR(0, 0, ""));
- }
- else
- {
+ DEBUGVAR(0,0,""));
+ } else {
sync_err = 0;
faad_getbits(ld, 12
- DEBUGVAR(1, 118, "adts_fixed_header(): syncword"));
+ DEBUGVAR(1,118,"adts_fixed_header(): syncword"));
break;
}
}
- if(sync_err)
+ if (sync_err)
return 5;
adts->id = faad_get1bit(ld
- DEBUGVAR(1, 119, "adts_fixed_header(): id"));
+ DEBUGVAR(1,119,"adts_fixed_header(): id"));
adts->layer = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 120, "adts_fixed_header(): layer"));
+ DEBUGVAR(1,120,"adts_fixed_header(): layer"));
adts->protection_absent = faad_get1bit(ld
- DEBUGVAR(1, 121, "adts_fixed_header(): protection_absent"));
+ DEBUGVAR(1,121,"adts_fixed_header(): protection_absent"));
adts->profile = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 122, "adts_fixed_header(): profile"));
+ DEBUGVAR(1,122,"adts_fixed_header(): profile"));
adts->sf_index = (uint8_t)faad_getbits(ld, 4
- DEBUGVAR(1, 123, "adts_fixed_header(): sf_index"));
+ DEBUGVAR(1,123,"adts_fixed_header(): sf_index"));
adts->private_bit = faad_get1bit(ld
- DEBUGVAR(1, 124, "adts_fixed_header(): private_bit"));
+ DEBUGVAR(1,124,"adts_fixed_header(): private_bit"));
adts->channel_configuration = (uint8_t)faad_getbits(ld, 3
- DEBUGVAR(1, 125, "adts_fixed_header(): channel_configuration"));
+ DEBUGVAR(1,125,"adts_fixed_header(): channel_configuration"));
adts->original = faad_get1bit(ld
- DEBUGVAR(1, 126, "adts_fixed_header(): original"));
+ DEBUGVAR(1,126,"adts_fixed_header(): original"));
adts->home = faad_get1bit(ld
- DEBUGVAR(1, 127, "adts_fixed_header(): home"));
+ DEBUGVAR(1,127,"adts_fixed_header(): home"));
- if(adts->old_format == 1)
+ if (adts->old_format == 1)
{
/* Removed in corrigendum 14496-3:2002 */
- if(adts->id == 0)
+ if (adts->id == 0)
{
adts->emphasis = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 128, "adts_fixed_header(): emphasis"));
+ DEBUGVAR(1,128,"adts_fixed_header(): emphasis"));
}
}
@@ -2509,24 +2427,24 @@ static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld)
static void adts_variable_header(adts_header *adts, bitfile *ld)
{
adts->copyright_identification_bit = faad_get1bit(ld
- DEBUGVAR(1, 129, "adts_variable_header(): copyright_identification_bit"));
+ DEBUGVAR(1,129,"adts_variable_header(): copyright_identification_bit"));
adts->copyright_identification_start = faad_get1bit(ld
- DEBUGVAR(1, 130, "adts_variable_header(): copyright_identification_start"));
+ DEBUGVAR(1,130,"adts_variable_header(): copyright_identification_start"));
adts->aac_frame_length = (uint16_t)faad_getbits(ld, 13
- DEBUGVAR(1, 131, "adts_variable_header(): aac_frame_length"));
+ DEBUGVAR(1,131,"adts_variable_header(): aac_frame_length"));
adts->adts_buffer_fullness = (uint16_t)faad_getbits(ld, 11
- DEBUGVAR(1, 132, "adts_variable_header(): adts_buffer_fullness"));
+ DEBUGVAR(1,132,"adts_variable_header(): adts_buffer_fullness"));
adts->no_raw_data_blocks_in_frame = (uint8_t)faad_getbits(ld, 2
- DEBUGVAR(1, 133, "adts_variable_header(): no_raw_data_blocks_in_frame"));
+ DEBUGVAR(1,133,"adts_variable_header(): no_raw_data_blocks_in_frame"));
}
/* Table 1.A.8 */
static void adts_error_check(adts_header *adts, bitfile *ld)
{
- if(adts->protection_absent == 0)
+ if (adts->protection_absent == 0)
{
adts->crc_check = (uint16_t)faad_getbits(ld, 16
- DEBUGVAR(1, 134, "adts_error_check(): crc_check"));
+ DEBUGVAR(1,134,"adts_error_check(): crc_check"));
}
}
@@ -2539,7 +2457,7 @@ static uint32_t latm_get_value(bitfile *ld)
bytesForValue = (uint8_t)faad_getbits(ld, 2);
value = 0;
- for(l = 0; l < bytesForValue; l++)
+ for(l=0; l<bytesForValue; l++)
value = (value << 8) | (uint8_t)faad_getbits(ld, 8);
return value;
@@ -2555,17 +2473,16 @@ static uint32_t latmParsePayload(latm_header *latm, bitfile *ld)
//this should be the payload length field for the current configuration
framelen = 0;
- if(latm->framelen_type == 0)
+ if(latm->framelen_type==0)
{
do
{
tmp = (uint8_t)faad_getbits(ld, 8);
framelen += tmp;
- }
- while(tmp == 0xff);
+ } while(tmp==0xff);
}
- else if(latm->framelen_type == 1)
- framelen = latm->frameLength;
+ else if(latm->framelen_type==1)
+ framelen=latm->frameLength;
return framelen;
}
@@ -2573,7 +2490,7 @@ static uint32_t latmParsePayload(latm_header *latm, bitfile *ld)
static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld)
{
- uint32_t ascLen, asc_bits = 0;
+ uint32_t ascLen, asc_bits=0;
uint32_t x1, y1, m, n, i;
program_config pce;
mp4AudioSpecificConfig mp4ASC;
@@ -2597,10 +2514,10 @@ static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld)
latm->numSubFrames = (uint8_t)faad_getbits(ld, 6) + 1;
latm->numPrograms = (uint8_t)faad_getbits(ld, 4) + 1;
latm->numLayers = faad_getbits(ld, 3) + 1;
- if(latm->numPrograms > 1 || !latm->allStreamsSameTimeFraming || latm->numSubFrames > 1 || latm->numLayers > 1)
+ if(latm->numPrograms>1 || !latm->allStreamsSameTimeFraming || latm->numSubFrames>1 || latm->numLayers>1)
{
fprintf(stderr, "\r\nUnsupported LATM configuration: %d programs/ %d subframes, %d layers, allstreams: %d\n",
- latm->numPrograms, latm->numSubFrames, latm->numLayers, latm->allStreamsSameTimeFraming);
+ latm->numPrograms, latm->numSubFrames, latm->numLayers, latm->allStreamsSameTimeFraming);
return 0;
}
ascLen = 0;
@@ -2614,11 +2531,11 @@ static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld)
//horrid hack to unread the ASC bits and store them in latm->ASC
//the correct code would rely on an ideal faad_ungetbits()
y1 = faad_get_processed_bits(ld);
- if((y1 - x1) <= MAX_ASC_BYTES * 8)
+ if((y1-x1) <= MAX_ASC_BYTES*8)
{
faad_rewindbits(ld);
m = x1;
- while(m > 0)
+ while(m>0)
{
n = min(m, 32);
faad_getbits(ld, n);
@@ -2635,10 +2552,10 @@ static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld)
}
}
- asc_bits = y1 - x1;
+ asc_bits = y1-x1;
- if(ascLen > asc_bits)
- faad_getbits(ld, ascLen - asc_bits);
+ if(ascLen>asc_bits)
+ faad_getbits(ld, ascLen-asc_bits);
latm->framelen_type = (uint8_t) faad_getbits(ld, 3);
if(latm->framelen_type == 0)
@@ -2649,45 +2566,42 @@ static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld)
else if(latm->framelen_type == 1)
{
latm->frameLength = faad_getbits(ld, 9);
- if(latm->frameLength == 0)
+ if(latm->frameLength==0)
{
fprintf(stderr, "Invalid frameLength: 0\r\n");
return 0;
}
- latm->frameLength = (latm->frameLength + 20) * 8;
+ latm->frameLength = (latm->frameLength+20)*8;
}
else
- {
- //hellish CELP or HCVX stuff, discard
+ { //hellish CELP or HCVX stuff, discard
fprintf(stderr, "Unsupported CELP/HCVX framelentype: %d\n", latm->framelen_type);
return 0;
}
latm->otherDataLenBits = 0;
if(faad_getbits(ld, 1))
- {
- //other data present
+ { //other data present
int esc, tmp;
if(latm->version)
latm->otherDataLenBits = latm_get_value(ld);
else do
- {
- esc = faad_getbits(ld, 1);
- tmp = faad_getbits(ld, 8);
- latm->otherDataLenBits = (latm->otherDataLenBits << 8) + tmp;
- }
- while(esc);
+ {
+ esc = faad_getbits(ld, 1);
+ tmp = faad_getbits(ld, 8);
+ latm->otherDataLenBits = (latm->otherDataLenBits << 8) + tmp;
+ } while(esc);
}
if(faad_getbits(ld, 1)) //crc
faad_getbits(ld, 8);
latm->inited = 1;
- }
+ }
- //read payload
- if(latm->inited)
- return latmParsePayload(latm, ld);
- else
- return 0;
+ //read payload
+ if(latm->inited)
+ return latmParsePayload(latm, ld);
+ else
+ return 0;
}
@@ -2697,7 +2611,7 @@ uint32_t faad_latm_frame(latm_header *latm, bitfile *ld)
uint32_t initpos, endpos, firstpos, ret;
firstpos = faad_get_processed_bits(ld);
- while(ld->bytes_left)
+ while (ld->bytes_left)
{
faad_byte_align(ld);
if(faad_showbits(ld, 11) != 0x2B7)
@@ -2712,9 +2626,9 @@ uint32_t faad_latm_frame(latm_header *latm, bitfile *ld)
initpos = faad_get_processed_bits(ld);
ret = latmAudioMuxElement(latm, ld);
endpos = faad_get_processed_bits(ld);
- if(ret > 0)
- return (len * 8) - (endpos - initpos);
- //faad_getbits(ld, initpos-endpos); //go back to initpos, but is valid a getbits(-N) ?
+ if(ret>0)
+ return (len*8)-(endpos-initpos);
+ //faad_getbits(ld, initpos-endpos); //go back to initpos, but is valid a getbits(-N) ?
}
#pragma warning(disable: 4146)
return -1U;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.h
index 35d79f841..2a1fc6d93 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/syntax.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -47,19 +47,19 @@ extern "C" {
#define ER_LTP 19
#define DRM_ER_LC 27 /* special object type for DRM */
- /* header types */
+/* header types */
#define RAW 0
#define ADIF 1
#define ADTS 2
#define LATM 3
- /* SBR signalling */
+/* SBR signalling */
#define NO_SBR 0
#define SBR_UPSAMPLED 1
#define SBR_DOWNSAMPLED 2
#define NO_SBR_UPSAMPLED 3
- /* DRM channel definitions */
+/* DRM channel definitions */
#define DRMCH_MONO 1
#define DRMCH_STEREO 2
#define DRMCH_SBR_MONO 3
@@ -67,11 +67,11 @@ extern "C" {
#define DRMCH_SBR_PS_STEREO 5
- /* First object type that has ER */
+/* First object type that has ER */
#define ER_OBJECT_START 17
- /* Bitstream */
+/* Bitstream */
#define LEN_SE_ID 3
#define LEN_TAG 4
#define LEN_BYTE 8
@@ -82,7 +82,7 @@ extern "C" {
#define EXT_DYNAMIC_RANGE 11
#define ANC_DATA 0
- /* Syntax elements */
+/* Syntax elements */
#define ID_SCE 0x0
#define ID_CPE 0x1
#define ID_CCE 0x2
@@ -108,20 +108,20 @@ extern "C" {
#define INVALID_SBR_ELEMENT 255
- int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
- program_config *pce);
+int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce);
- uint8_t adts_frame(adts_header *adts, bitfile *ld);
- void get_adif_header(adif_header *adif, bitfile *ld);
- void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
- bitfile *ld, program_config *pce, drc_info *drc);
- uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
- int16_t *spectral_data);
+uint8_t adts_frame(adts_header *adts, bitfile *ld);
+void get_adif_header(adif_header *adif, bitfile *ld);
+void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
+ bitfile *ld, program_config *pce, drc_info *drc);
+uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
+ int16_t *spectral_data);
#ifdef DRM
- void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
- bitfile *ld, program_config *pce, drc_info *drc);
+void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
+ bitfile *ld, program_config *pce, drc_info *drc);
#endif
- uint32_t faad_latm_frame(latm_header *latm, bitfile *ld);
+uint32_t faad_latm_frame(latm_header *latm, bitfile *ld);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.c b/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.c
index 7c4155037..611865204 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.c
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.c
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -86,26 +86,26 @@ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
int8_t inc;
int16_t size;
uint16_t bottom, top, start, end;
- uint16_t nshort = frame_len / 8;
+ uint16_t nshort = frame_len/8;
real_t lpc[TNS_MAX_ORDER+1];
- if(!ics->tns_data_present)
+ if (!ics->tns_data_present)
return;
- for(w = 0; w < ics->num_windows; w++)
+ for (w = 0; w < ics->num_windows; w++)
{
bottom = ics->num_swb;
- for(f = 0; f < tns->n_filt[w]; f++)
+ for (f = 0; f < tns->n_filt[w]; f++)
{
top = bottom;
bottom = max(top - tns->length[w][f], 0);
tns_order = min(tns->order[w][f], TNS_MAX_ORDER);
- if(!tns_order)
+ if (!tns_order)
continue;
- tns_decode_coef(tns_order, tns->coef_res[w] + 3,
- tns->coef_compress[w][f], tns->coef[w][f], lpc);
+ tns_decode_coef(tns_order, tns->coef_res[w]+3,
+ tns->coef_compress[w][f], tns->coef[w][f], lpc);
start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
start = min(start, ics->max_sfb);
@@ -116,16 +116,14 @@ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
end = min(ics->swb_offset[end], ics->swb_offset_max);
size = end - start;
- if(size <= 0)
+ if (size <= 0)
continue;
- if(tns->direction[w][f])
+ if (tns->direction[w][f])
{
inc = -1;
start = end - 1;
- }
- else
- {
+ } else {
inc = 1;
}
@@ -142,26 +140,26 @@ void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
int8_t inc;
int16_t size;
uint16_t bottom, top, start, end;
- uint16_t nshort = frame_len / 8;
+ uint16_t nshort = frame_len/8;
real_t lpc[TNS_MAX_ORDER+1];
- if(!ics->tns_data_present)
+ if (!ics->tns_data_present)
return;
- for(w = 0; w < ics->num_windows; w++)
+ for (w = 0; w < ics->num_windows; w++)
{
bottom = ics->num_swb;
- for(f = 0; f < tns->n_filt[w]; f++)
+ for (f = 0; f < tns->n_filt[w]; f++)
{
top = bottom;
bottom = max(top - tns->length[w][f], 0);
tns_order = min(tns->order[w][f], TNS_MAX_ORDER);
- if(!tns_order)
+ if (!tns_order)
continue;
- tns_decode_coef(tns_order, tns->coef_res[w] + 3,
- tns->coef_compress[w][f], tns->coef[w][f], lpc);
+ tns_decode_coef(tns_order, tns->coef_res[w]+3,
+ tns->coef_compress[w][f], tns->coef[w][f], lpc);
start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
start = min(start, ics->max_sfb);
@@ -172,16 +170,14 @@ void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
end = min(ics->swb_offset[end], ics->swb_offset_max);
size = end - start;
- if(size <= 0)
+ if (size <= 0)
continue;
- if(tns->direction[w][f])
+ if (tns->direction[w][f])
{
inc = -1;
start = end - 1;
- }
- else
- {
+ } else {
inc = 1;
}
@@ -198,27 +194,21 @@ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_c
real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1];
/* Conversion to signed integer */
- for(i = 0; i < order; i++)
+ for (i = 0; i < order; i++)
{
- if(coef_compress == 0)
+ if (coef_compress == 0)
{
- if(coef_res_bits == 3)
+ if (coef_res_bits == 3)
{
tmp2[i] = tns_coef_0_3[coef[i]];
- }
- else
- {
+ } else {
tmp2[i] = tns_coef_0_4[coef[i]];
}
- }
- else
- {
- if(coef_res_bits == 3)
+ } else {
+ if (coef_res_bits == 3)
{
tmp2[i] = tns_coef_1_3[coef[i]];
- }
- else
- {
+ } else {
tmp2[i] = tns_coef_1_4[coef[i]];
}
}
@@ -226,12 +216,12 @@ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_c
/* Conversion to LPC coefficients */
a[0] = COEF_CONST(1.0);
- for(m = 1; m <= order; m++)
+ for (m = 1; m <= order; m++)
{
- for(i = 1; i < m; i++) /* loop only while i<m */
+ for (i = 1; i < m; i++) /* loop only while i<m */
b[i] = a[i] + MUL_C(tmp2[m-1], a[m-i]);
- for(i = 1; i < m; i++) /* loop only while i<m */
+ for (i = 1; i < m; i++) /* loop only while i<m */
a[i] = b[i];
a[m] = tmp2[m-1]; /* changed */
@@ -257,17 +247,17 @@ static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l
real_t state[2*TNS_MAX_ORDER] = {0};
int8_t state_index = 0;
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
{
y = *spectrum;
- for(j = 0; j < order; j++)
+ for (j = 0; j < order; j++)
y -= MUL_C(state[state_index+j], lpc[j+1]);
/* double ringbuffer state */
state_index--;
- if(state_index < 0)
- state_index = order - 1;
+ if (state_index < 0)
+ state_index = order-1;
state[state_index] = state[state_index + order] = y;
*spectrum = y;
@@ -300,17 +290,17 @@ static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l
real_t state[2*TNS_MAX_ORDER] = {0};
int8_t state_index = 0;
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
{
y = *spectrum;
- for(j = 0; j < order; j++)
+ for (j = 0; j < order; j++)
y += MUL_C(state[state_index+j], lpc[j+1]);
/* double ringbuffer state */
state_index--;
- if(state_index < 0)
- state_index = order - 1;
+ if (state_index < 0)
+ state_index = order-1;
state[state_index] = state[state_index + order] = *spectrum;
*spectrum = y;
diff --git a/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.h b/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.h
index 851bd7848..8848c3f2d 100644
--- a/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.h
+++ b/src/filters/transform/MpaDecFilter/faad2/libfaad/tns.h
@@ -1,19 +1,19 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
-**
+**
** 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 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.
-**
+**
** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
+** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
@@ -38,11 +38,11 @@ extern "C" {
#define TNS_MAX_ORDER 20
-
- void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
- uint8_t object_type, real_t *spec, uint16_t frame_len);
- void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
- uint8_t object_type, real_t *spec, uint16_t frame_len);
+
+void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+ uint8_t object_type, real_t *spec, uint16_t frame_len);
+void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+ uint8_t object_type, real_t *spec, uint16_t frame_len);
#ifdef __cplusplus
diff --git a/src/filters/transform/MpaDecFilter/libdca/include/dca.h b/src/filters/transform/MpaDecFilter/libdca/include/dca.h
index c66ace6fd..6c7efb0c3 100644
--- a/src/filters/transform/MpaDecFilter/libdca/include/dca.h
+++ b/src/filters/transform/MpaDecFilter/libdca/include/dca.h
@@ -30,25 +30,25 @@
extern "C" {
# endif
- /* x86 accelerations */
+/* x86 accelerations */
#define MM_ACCEL_X86_MMX 0x80000000
#define MM_ACCEL_X86_3DNOW 0x40000000
#define MM_ACCEL_X86_MMXEXT 0x20000000
- uint32_t mm_accel(void);
+uint32_t mm_accel (void);
#if defined(LIBDCA_FIXED)
- typedef int32_t sample_t;
- typedef int32_t level_t;
+typedef int32_t sample_t;
+typedef int32_t level_t;
#elif defined(LIBDCA_DOUBLE)
- typedef double sample_t;
- typedef double level_t;
+typedef double sample_t;
+typedef double level_t;
#else
- typedef float sample_t;
- typedef float level_t;
+typedef float sample_t;
+typedef float level_t;
#endif
- typedef struct dca_state_s dca_state_t;
+typedef struct dca_state_s dca_state_t;
#define DCA_MONO 0
#define DCA_CHANNEL 1
@@ -71,23 +71,23 @@ extern "C" {
#define DCA_LFE 0x80
#define DCA_ADJUST_LEVEL 0x100
- dca_state_t * dca_init(uint32_t mm_accel);
+dca_state_t * dca_init (uint32_t mm_accel);
- int dca_syncinfo(dca_state_t *state, uint8_t * buf, int * flags,
- int * sample_rate, int * bit_rate, int *frame_length);
+int dca_syncinfo (dca_state_t *state, uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate, int *frame_length);
- int dca_frame(dca_state_t * state, uint8_t * buf, int * flags,
- level_t * level, sample_t bias);
+int dca_frame (dca_state_t * state, uint8_t * buf, int * flags,
+ level_t * level, sample_t bias);
- void dca_dynrng(dca_state_t * state,
- level_t (* call)(level_t, void *), void * data);
+void dca_dynrng (dca_state_t * state,
+ level_t (* call) (level_t, void *), void * data);
- int dca_blocks_num(dca_state_t * state);
- int dca_block(dca_state_t * state);
+int dca_blocks_num (dca_state_t * state);
+int dca_block (dca_state_t * state);
- sample_t * dca_samples(dca_state_t * state);
+sample_t * dca_samples (dca_state_t * state);
- void dca_free(dca_state_t * state);
+void dca_free (dca_state_t * state);
# ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.c b/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.c
index 207afe6f4..b92714868 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.c
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.c
@@ -33,35 +33,35 @@
#define BUFFER_SIZE 4096
-void dca_bitstream_init(dca_state_t * state, uint8_t * buf, int word_mode,
- int bigendian_mode)
+void dca_bitstream_init (dca_state_t * state, uint8_t * buf, int word_mode,
+ int bigendian_mode)
{
intptr_t align;
align = (uintptr_t)buf & 3;
- state->buffer_start = (uint32_t *)((uintptr_t)buf - align);
+ state->buffer_start = (uint32_t *) ((uintptr_t)buf - align);
state->bits_left = 0;
state->current_word = 0;
state->word_mode = word_mode;
state->bigendian_mode = bigendian_mode;
- bitstream_get(state, align * 8);
+ bitstream_get (state, align * 8);
}
#include<stdio.h>
-static inline void bitstream_fill_current(dca_state_t * state)
+static inline void bitstream_fill_current (dca_state_t * state)
{
uint32_t tmp;
tmp = *(state->buffer_start++);
- if(state->bigendian_mode)
- state->current_word = swab32(tmp);
+ if (state->bigendian_mode)
+ state->current_word = swab32 (tmp);
else
- state->current_word = swable32(tmp);
+ state->current_word = swable32 (tmp);
- if(!state->word_mode)
+ if (!state->word_mode)
{
state->current_word = (state->current_word & 0x00003FFF) |
- ((state->current_word & 0x3FFF0000) >> 2);
+ ((state->current_word & 0x3FFF0000 ) >> 2);
}
}
@@ -74,39 +74,38 @@ static inline void bitstream_fill_current(dca_state_t * state)
* -ah
*/
-uint32_t dca_bitstream_get_bh(dca_state_t * state, uint32_t num_bits)
+uint32_t dca_bitstream_get_bh (dca_state_t * state, uint32_t num_bits)
{
uint32_t result;
num_bits -= state->bits_left;
result = ((state->current_word << (32 - state->bits_left)) >>
- (32 - state->bits_left));
+ (32 - state->bits_left));
- if(!state->word_mode && num_bits > 28)
- {
- bitstream_fill_current(state);
- result = (result << 28) | state->current_word;
- num_bits -= 28;
+ if ( !state->word_mode && num_bits > 28 ) {
+ bitstream_fill_current (state);
+ result = (result << 28) | state->current_word;
+ num_bits -= 28;
}
- bitstream_fill_current(state);
+ bitstream_fill_current (state);
- if(state->word_mode)
+ if ( state->word_mode )
{
- if(num_bits != 0)
- result = (result << num_bits) |
- (state->current_word >> (32 - num_bits));
+ if (num_bits != 0)
+ result = (result << num_bits) |
+ (state->current_word >> (32 - num_bits));
- state->bits_left = 32 - num_bits;
+ state->bits_left = 32 - num_bits;
}
else
{
- if(num_bits != 0)
- result = (result << num_bits) |
- (state->current_word >> (28 - num_bits));
+ if (num_bits != 0)
+ result = (result << num_bits) |
+ (state->current_word >> (28 - num_bits));
- state->bits_left = 28 - num_bits;
+ state->bits_left = 28 - num_bits;
}
return result;
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.h b/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.h
index 695fa8234..4bce80aab 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/bitstream.h
@@ -48,22 +48,21 @@
#endif
-void dca_bitstream_init(dca_state_t * state, uint8_t * buf, int word_mode,
- int endian_mode);
-uint32_t dca_bitstream_get_bh(dca_state_t * state, uint32_t num_bits);
+void dca_bitstream_init (dca_state_t * state, uint8_t * buf, int word_mode,
+ int endian_mode);
+uint32_t dca_bitstream_get_bh (dca_state_t * state, uint32_t num_bits);
-static inline uint32_t bitstream_get(dca_state_t * state, uint32_t num_bits)
+static inline uint32_t bitstream_get (dca_state_t * state, uint32_t num_bits)
{
uint32_t result;
- if(num_bits < state->bits_left)
- {
+ if (num_bits < state->bits_left) {
result = (state->current_word << (32 - state->bits_left))
- >> (32 - num_bits);
+ >> (32 - num_bits);
state->bits_left -= num_bits;
return result;
}
- return dca_bitstream_get_bh(state, num_bits);
+ return dca_bitstream_get_bh (state, num_bits);
}
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/dca_internal.h b/src/filters/transform/MpaDecFilter/libdca/libdca/dca_internal.h
index 1f471a278..2c43cf049 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/dca_internal.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/dca_internal.h
@@ -30,8 +30,7 @@
#define DCA_SUBSUBFAMES_MAX (4)
#define DCA_LFE_MAX (3)
-struct dca_state_s
-{
+struct dca_state_s {
/* Frame header */
int frame_type; /* type of the current frame */
@@ -130,7 +129,7 @@ struct dca_state_s
int dynrnge; /* apply dynamic range */
level_t dynrng; /* dynamic range */
void * dynrngdata; /* dynamic range callback funtion and data */
- level_t (* dynrngcall)(level_t range, void * dynrngdata);
+ level_t (* dynrngcall) (level_t range, void * dynrngdata);
/* Bitstream handling */
uint32_t * buffer_start;
@@ -156,13 +155,13 @@ struct dca_state_s
#define LEVEL_45DB 0.5946035575013605
#define LEVEL_6DB 0.5
-int dca_downmix_init(int input, int flags, level_t * level,
- level_t clev, level_t slev);
-int dca_downmix_coeff(level_t * coeff, int acmod, int output, level_t level,
+int dca_downmix_init (int input, int flags, level_t * level,
level_t clev, level_t slev);
-void dca_downmix(sample_t * samples, int acmod, int output, sample_t bias,
- level_t clev, level_t slev);
-void dca_upmix(sample_t * samples, int acmod, int output);
+int dca_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
+ level_t clev, level_t slev);
+void dca_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ level_t clev, level_t slev);
+void dca_upmix (sample_t * samples, int acmod, int output);
#define ROUND(x) ((int)((x) + ((x) > 0 ? 0.5 : -0.5)))
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/downmix.c b/src/filters/transform/MpaDecFilter/libdca/libdca/downmix.c
index 7f6fe76d1..ff02127f4 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/downmix.c
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/downmix.c
@@ -33,698 +33,662 @@
#define CONVERT(acmod,output) (((output) << DCA_CHANNEL_BITS) + (acmod))
-int dca_downmix_init(int input, int flags, level_t * level,
- level_t clev, level_t slev)
+int dca_downmix_init (int input, int flags, level_t * level,
+ level_t clev, level_t slev)
{
- static uint8_t table[11][10] =
- {
+ static uint8_t table[11][10] = {
/* DCA_MONO */
- {
- DCA_MONO, DCA_MONO, DCA_MONO, DCA_MONO,
- DCA_MONO, DCA_MONO, DCA_MONO, DCA_MONO,
- DCA_MONO, DCA_MONO
- },
+ {DCA_MONO, DCA_MONO, DCA_MONO, DCA_MONO,
+ DCA_MONO, DCA_MONO, DCA_MONO, DCA_MONO,
+ DCA_MONO, DCA_MONO},
/* DCA_CHANNEL */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO},
/* DCA_STEREO */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO},
/* DCA_STEREO_SUMDIFF */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO},
/* DCA_STEREO_TOTAL */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO},
/* DCA_3F */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_3F, DCA_3F, DCA_3F,
- DCA_3F, DCA_3F
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_3F, DCA_3F, DCA_3F,
+ DCA_3F, DCA_3F},
/* DCA_2F1R */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_2F1R, DCA_2F1R, DCA_2F1R,
- DCA_2F1R, DCA_2F1R
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_2F1R, DCA_2F1R, DCA_2F1R,
+ DCA_2F1R, DCA_2F1R},
/* DCA_3F1R */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_3F, DCA_3F1R, DCA_3F1R,
- DCA_3F1R, DCA_3F1R
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_3F, DCA_3F1R, DCA_3F1R,
+ DCA_3F1R, DCA_3F1R},
/* DCA_2F2R */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_STEREO, DCA_2F2R, DCA_2F2R,
- DCA_2F2R, DCA_2F2R
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_STEREO, DCA_2F2R, DCA_2F2R,
+ DCA_2F2R, DCA_2F2R},
/* DCA_3F2R */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_3F, DCA_3F2R, DCA_3F2R,
- DCA_3F2R, DCA_3F2R
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_3F, DCA_3F2R, DCA_3F2R,
+ DCA_3F2R, DCA_3F2R},
/* DCA_4F2R */
- {
- DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
- DCA_STEREO, DCA_4F2R, DCA_4F2R, DCA_4F2R,
- DCA_4F2R, DCA_4F2R
- },
+ {DCA_MONO, DCA_CHANNEL, DCA_STEREO, DCA_STEREO,
+ DCA_STEREO, DCA_4F2R, DCA_4F2R, DCA_4F2R,
+ DCA_4F2R, DCA_4F2R},
};
int output;
output = flags & DCA_CHANNEL_MASK;
- if(output > DCA_CHANNEL_MAX)
- return -1;
+ if (output > DCA_CHANNEL_MAX)
+ return -1;
output = table[output][input];
- if(output == DCA_STEREO &&
- (input == DCA_DOLBY || (input == DCA_3F && clev == LEVEL(LEVEL_3DB))))
- output = DCA_DOLBY;
-
- if(flags & DCA_ADJUST_LEVEL)
- {
- level_t adjust;
-
- switch(CONVERT(input & 7, output))
- {
-
- case CONVERT(DCA_3F, DCA_MONO):
- adjust = DIV(LEVEL_3DB, LEVEL(1) + clev);
- break;
-
- case CONVERT(DCA_STEREO, DCA_MONO):
- case CONVERT(DCA_2F2R, DCA_2F1R):
- case CONVERT(DCA_3F2R, DCA_3F1R):
-level_3db:
- adjust = LEVEL(LEVEL_3DB);
- break;
-
- case CONVERT(DCA_3F2R, DCA_2F1R):
- if(clev < LEVEL(LEVEL_PLUS3DB - 1))
- goto level_3db;
- /* break thru */
- case CONVERT(DCA_3F, DCA_STEREO):
- case CONVERT(DCA_3F1R, DCA_2F1R):
- case CONVERT(DCA_3F1R, DCA_2F2R):
- case CONVERT(DCA_3F2R, DCA_2F2R):
- adjust = DIV(1, LEVEL(1) + clev);
- break;
-
- case CONVERT(DCA_2F1R, DCA_MONO):
- adjust = DIV(LEVEL_PLUS3DB, LEVEL(2) + slev);
- break;
-
- case CONVERT(DCA_2F1R, DCA_STEREO):
- case CONVERT(DCA_3F1R, DCA_3F):
- adjust = DIV(1, LEVEL(1) + MUL_C(slev, LEVEL_3DB));
- break;
-
- case CONVERT(DCA_3F1R, DCA_MONO):
- adjust = DIV(LEVEL_3DB, LEVEL(1) + clev + MUL_C(slev, 0.5));
- break;
-
- case CONVERT(DCA_3F1R, DCA_STEREO):
- adjust = DIV(1, LEVEL(1) + clev + MUL_C(slev, LEVEL_3DB));
- break;
-
- case CONVERT(DCA_2F2R, DCA_MONO):
- adjust = DIV(LEVEL_3DB, LEVEL(1) + slev);
- break;
-
- case CONVERT(DCA_2F2R, DCA_STEREO):
- case CONVERT(DCA_3F2R, DCA_3F):
- adjust = DIV(1, LEVEL(1) + slev);
- break;
-
- case CONVERT(DCA_3F2R, DCA_MONO):
- adjust = DIV(LEVEL_3DB, LEVEL(1) + clev + slev);
- break;
-
- case CONVERT(DCA_3F2R, DCA_STEREO):
- adjust = DIV(1, LEVEL(1) + clev + slev);
- break;
-
- case CONVERT(DCA_MONO, DCA_DOLBY):
- adjust = LEVEL(LEVEL_PLUS3DB);
- break;
-
- case CONVERT(DCA_3F, DCA_DOLBY):
- case CONVERT(DCA_2F1R, DCA_DOLBY):
- adjust = LEVEL(1 / (1 + LEVEL_3DB));
- break;
-
- case CONVERT(DCA_3F1R, DCA_DOLBY):
- case CONVERT(DCA_2F2R, DCA_DOLBY):
- adjust = LEVEL(1 / (1 + 2 * LEVEL_3DB));
- break;
-
- case CONVERT(DCA_3F2R, DCA_DOLBY):
- adjust = LEVEL(1 / (1 + 3 * LEVEL_3DB));
- break;
-
- default:
- return output;
- }
-
- *level = MUL_L(*level, adjust);
+ if (output == DCA_STEREO &&
+ (input == DCA_DOLBY || (input == DCA_3F && clev == LEVEL (LEVEL_3DB))))
+ output = DCA_DOLBY;
+
+ if (flags & DCA_ADJUST_LEVEL) {
+ level_t adjust;
+
+ switch (CONVERT (input & 7, output)) {
+
+ case CONVERT (DCA_3F, DCA_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + clev);
+ break;
+
+ case CONVERT (DCA_STEREO, DCA_MONO):
+ case CONVERT (DCA_2F2R, DCA_2F1R):
+ case CONVERT (DCA_3F2R, DCA_3F1R):
+ level_3db:
+ adjust = LEVEL (LEVEL_3DB);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_2F1R):
+ if (clev < LEVEL (LEVEL_PLUS3DB - 1))
+ goto level_3db;
+ /* break thru */
+ case CONVERT (DCA_3F, DCA_STEREO):
+ case CONVERT (DCA_3F1R, DCA_2F1R):
+ case CONVERT (DCA_3F1R, DCA_2F2R):
+ case CONVERT (DCA_3F2R, DCA_2F2R):
+ adjust = DIV (1, LEVEL (1) + clev);
+ break;
+
+ case CONVERT (DCA_2F1R, DCA_MONO):
+ adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev);
+ break;
+
+ case CONVERT (DCA_2F1R, DCA_STEREO):
+ case CONVERT (DCA_3F1R, DCA_3F):
+ adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB));
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5));
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_STEREO):
+ adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB));
+ break;
+
+ case CONVERT (DCA_2F2R, DCA_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + slev);
+ break;
+
+ case CONVERT (DCA_2F2R, DCA_STEREO):
+ case CONVERT (DCA_3F2R, DCA_3F):
+ adjust = DIV (1, LEVEL (1) + slev);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_STEREO):
+ adjust = DIV (1, LEVEL (1) + clev + slev);
+ break;
+
+ case CONVERT (DCA_MONO, DCA_DOLBY):
+ adjust = LEVEL (LEVEL_PLUS3DB);
+ break;
+
+ case CONVERT (DCA_3F, DCA_DOLBY):
+ case CONVERT (DCA_2F1R, DCA_DOLBY):
+ adjust = LEVEL (1 / (1 + LEVEL_3DB));
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_DOLBY):
+ case CONVERT (DCA_2F2R, DCA_DOLBY):
+ adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB));
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_DOLBY):
+ adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB));
+ break;
+
+ default:
+ return output;
+ }
+
+ *level = MUL_L (*level, adjust);
}
return output;
}
-int dca_downmix_coeff(level_t * coeff, int acmod, int output, level_t level,
- level_t clev, level_t slev)
+int dca_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
+ level_t clev, level_t slev)
{
level_t level_3db;
- level_3db = MUL_C(level, LEVEL_3DB);
-
- switch(CONVERT(acmod, output & DCA_CHANNEL_MASK))
- {
-
- case CONVERT(DCA_CHANNEL, DCA_CHANNEL):
- case CONVERT(DCA_MONO, DCA_MONO):
- case CONVERT(DCA_STEREO, DCA_STEREO):
- case CONVERT(DCA_3F, DCA_3F):
- case CONVERT(DCA_2F1R, DCA_2F1R):
- case CONVERT(DCA_3F1R, DCA_3F1R):
- case CONVERT(DCA_2F2R, DCA_2F2R):
- case CONVERT(DCA_3F2R, DCA_3F2R):
- case CONVERT(DCA_STEREO, DCA_DOLBY):
- coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
- return 0;
-
- case CONVERT(DCA_CHANNEL, DCA_MONO):
- coeff[0] = coeff[1] = MUL_C(level, LEVEL_6DB);
- return 3;
-
- case CONVERT(DCA_STEREO, DCA_MONO):
- coeff[0] = coeff[1] = level_3db;
- return 3;
-
- case CONVERT(DCA_3F, DCA_MONO):
- coeff[0] = coeff[2] = level_3db;
- coeff[1] = MUL_C(MUL_L(level_3db, clev), LEVEL_PLUS6DB);
- return 7;
-
- case CONVERT(DCA_2F1R, DCA_MONO):
- coeff[0] = coeff[1] = level_3db;
- coeff[2] = MUL_L(level_3db, slev);
- return 7;
-
- case CONVERT(DCA_2F2R, DCA_MONO):
- coeff[0] = coeff[1] = level_3db;
- coeff[2] = coeff[3] = MUL_L(level_3db, slev);
- return 15;
-
- case CONVERT(DCA_3F1R, DCA_MONO):
- coeff[0] = coeff[2] = level_3db;
- coeff[1] = MUL_C(MUL_L(level_3db, clev), LEVEL_PLUS6DB);
- coeff[3] = MUL_L(level_3db, slev);
- return 15;
-
- case CONVERT(DCA_3F2R, DCA_MONO):
- coeff[0] = coeff[2] = level_3db;
- coeff[1] = MUL_C(MUL_L(level_3db, clev), LEVEL_PLUS6DB);
- coeff[3] = coeff[4] = MUL_L(level_3db, slev);
- return 31;
-
- case CONVERT(DCA_MONO, DCA_DOLBY):
- coeff[0] = level_3db;
- return 0;
-
- case CONVERT(DCA_3F, DCA_DOLBY):
- coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
- coeff[1] = level_3db;
- return 7;
-
- case CONVERT(DCA_3F, DCA_STEREO):
- case CONVERT(DCA_3F1R, DCA_2F1R):
- case CONVERT(DCA_3F2R, DCA_2F2R):
- coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
- coeff[1] = MUL_L(level, clev);
- return 7;
-
- case CONVERT(DCA_2F1R, DCA_DOLBY):
- coeff[0] = coeff[1] = level;
- coeff[2] = level_3db;
- return 7;
-
- case CONVERT(DCA_2F1R, DCA_STEREO):
- coeff[0] = coeff[1] = level;
- coeff[2] = MUL_L(level_3db, slev);
- return 7;
-
- case CONVERT(DCA_3F1R, DCA_DOLBY):
- coeff[0] = coeff[2] = level;
- coeff[1] = coeff[3] = level_3db;
- return 15;
-
- case CONVERT(DCA_3F1R, DCA_STEREO):
- coeff[0] = coeff[2] = level;
- coeff[1] = MUL_L(level, clev);
- coeff[3] = MUL_L(level_3db, slev);
- return 15;
-
- case CONVERT(DCA_2F2R, DCA_DOLBY):
- coeff[0] = coeff[1] = level;
- coeff[2] = coeff[3] = level_3db;
- return 15;
-
- case CONVERT(DCA_2F2R, DCA_STEREO):
- coeff[0] = coeff[1] = level;
- coeff[2] = coeff[3] = MUL_L(level, slev);
- return 15;
-
- case CONVERT(DCA_3F2R, DCA_DOLBY):
- coeff[0] = coeff[2] = level;
- coeff[1] = coeff[3] = coeff[4] = level_3db;
- return 31;
-
- case CONVERT(DCA_3F2R, DCA_2F1R):
- coeff[0] = coeff[2] = level;
- coeff[1] = MUL_L(level, clev);
- coeff[3] = coeff[4] = level_3db;
- return 31;
-
- case CONVERT(DCA_3F2R, DCA_STEREO):
- coeff[0] = coeff[2] = level;
- coeff[1] = MUL_L(level, clev);
- coeff[3] = coeff[4] = MUL_L(level, slev);
- return 31;
-
- case CONVERT(DCA_3F1R, DCA_3F):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = MUL_L(level_3db, slev);
- return 13;
-
- case CONVERT(DCA_3F2R, DCA_3F):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = coeff[4] = MUL_L(level, slev);
- return 29;
-
- case CONVERT(DCA_2F2R, DCA_2F1R):
- coeff[0] = coeff[1] = level;
- coeff[2] = coeff[3] = level_3db;
- return 12;
-
- case CONVERT(DCA_3F2R, DCA_3F1R):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = coeff[4] = level_3db;
- return 24;
-
- case CONVERT(DCA_2F1R, DCA_2F2R):
- coeff[0] = coeff[1] = level;
- coeff[2] = level_3db;
- return 0;
-
- case CONVERT(DCA_3F1R, DCA_2F2R):
- coeff[0] = coeff[2] = level;
- coeff[1] = MUL_L(level, clev);
- coeff[3] = level_3db;
- return 7;
-
- case CONVERT(DCA_3F1R, DCA_3F2R):
- coeff[0] = coeff[1] = coeff[2] = level;
- coeff[3] = level_3db;
- return 0;
+ level_3db = MUL_C (level, LEVEL_3DB);
+
+ switch (CONVERT (acmod, output & DCA_CHANNEL_MASK)) {
+
+ case CONVERT (DCA_CHANNEL, DCA_CHANNEL):
+ case CONVERT (DCA_MONO, DCA_MONO):
+ case CONVERT (DCA_STEREO, DCA_STEREO):
+ case CONVERT (DCA_3F, DCA_3F):
+ case CONVERT (DCA_2F1R, DCA_2F1R):
+ case CONVERT (DCA_3F1R, DCA_3F1R):
+ case CONVERT (DCA_2F2R, DCA_2F2R):
+ case CONVERT (DCA_3F2R, DCA_3F2R):
+ case CONVERT (DCA_STEREO, DCA_DOLBY):
+ coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
+ return 0;
+
+ case CONVERT (DCA_CHANNEL, DCA_MONO):
+ coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB);
+ return 3;
+
+ case CONVERT (DCA_STEREO, DCA_MONO):
+ coeff[0] = coeff[1] = level_3db;
+ return 3;
+
+ case CONVERT (DCA_3F, DCA_MONO):
+ coeff[0] = coeff[2] = level_3db;
+ coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
+ return 7;
+
+ case CONVERT (DCA_2F1R, DCA_MONO):
+ coeff[0] = coeff[1] = level_3db;
+ coeff[2] = MUL_L (level_3db, slev);
+ return 7;
+
+ case CONVERT (DCA_2F2R, DCA_MONO):
+ coeff[0] = coeff[1] = level_3db;
+ coeff[2] = coeff[3] = MUL_L (level_3db, slev);
+ return 15;
+
+ case CONVERT (DCA_3F1R, DCA_MONO):
+ coeff[0] = coeff[2] = level_3db;
+ coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
+ coeff[3] = MUL_L (level_3db, slev);
+ return 15;
+
+ case CONVERT (DCA_3F2R, DCA_MONO):
+ coeff[0] = coeff[2] = level_3db;
+ coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
+ coeff[3] = coeff[4] = MUL_L (level_3db, slev);
+ return 31;
+
+ case CONVERT (DCA_MONO, DCA_DOLBY):
+ coeff[0] = level_3db;
+ return 0;
+
+ case CONVERT (DCA_3F, DCA_DOLBY):
+ coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
+ coeff[1] = level_3db;
+ return 7;
+
+ case CONVERT (DCA_3F, DCA_STEREO):
+ case CONVERT (DCA_3F1R, DCA_2F1R):
+ case CONVERT (DCA_3F2R, DCA_2F2R):
+ coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
+ coeff[1] = MUL_L (level, clev);
+ return 7;
+
+ case CONVERT (DCA_2F1R, DCA_DOLBY):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level_3db;
+ return 7;
+
+ case CONVERT (DCA_2F1R, DCA_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = MUL_L (level_3db, slev);
+ return 7;
+
+ case CONVERT (DCA_3F1R, DCA_DOLBY):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = coeff[3] = level_3db;
+ return 15;
+
+ case CONVERT (DCA_3F1R, DCA_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = MUL_L (level_3db, slev);
+ return 15;
+
+ case CONVERT (DCA_2F2R, DCA_DOLBY):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level_3db;
+ return 15;
+
+ case CONVERT (DCA_2F2R, DCA_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = MUL_L (level, slev);
+ return 15;
+
+ case CONVERT (DCA_3F2R, DCA_DOLBY):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = coeff[3] = coeff[4] = level_3db;
+ return 31;
+
+ case CONVERT (DCA_3F2R, DCA_2F1R):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = coeff[4] = level_3db;
+ return 31;
+
+ case CONVERT (DCA_3F2R, DCA_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = coeff[4] = MUL_L (level, slev);
+ return 31;
+
+ case CONVERT (DCA_3F1R, DCA_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = MUL_L (level_3db, slev);
+ return 13;
+
+ case CONVERT (DCA_3F2R, DCA_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = MUL_L (level, slev);
+ return 29;
+
+ case CONVERT (DCA_2F2R, DCA_2F1R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level_3db;
+ return 12;
+
+ case CONVERT (DCA_3F2R, DCA_3F1R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = level_3db;
+ return 24;
+
+ case CONVERT (DCA_2F1R, DCA_2F2R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level_3db;
+ return 0;
+
+ case CONVERT (DCA_3F1R, DCA_2F2R):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = level_3db;
+ return 7;
+
+ case CONVERT (DCA_3F1R, DCA_3F2R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = level_3db;
+ return 0;
}
return -1; /* NOTREACHED */
}
-static void mix2to1(sample_t * dest, sample_t * src, sample_t bias)
+static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- dest[i] += BIAS(src[i]);
+ for (i = 0; i < 256; i++)
+ dest[i] += BIAS (src[i]);
}
-static void mix3to1(sample_t * samples, sample_t bias)
+static void mix3to1 (sample_t * samples, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] += BIAS(samples[i + 256] + samples[i + 512]);
+ for (i = 0; i < 256; i++)
+ samples[i] += BIAS (samples[i + 256] + samples[i + 512]);
}
-static void mix4to1(sample_t * samples, sample_t bias)
+static void mix4to1 (sample_t * samples, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] += BIAS(samples[i + 256] + samples[i + 512] +
- samples[i + 768]);
+ for (i = 0; i < 256; i++)
+ samples[i] += BIAS (samples[i + 256] + samples[i + 512] +
+ samples[i + 768]);
}
-static void mix5to1(sample_t * samples, sample_t bias)
+static void mix5to1 (sample_t * samples, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] += BIAS(samples[i + 256] + samples[i + 512] +
- samples[i + 768] + samples[i + 1024]);
+ for (i = 0; i < 256; i++)
+ samples[i] += BIAS (samples[i + 256] + samples[i + 512] +
+ samples[i + 768] + samples[i + 1024]);
}
-static void mix3to2(sample_t * samples, sample_t bias)
+static void mix3to2 (sample_t * samples, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = BIAS(samples[i]);
- samples[i] = samples[i + 256] + common;
- samples[i + 256] = samples[i + 512] + common;
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ samples[i] = samples[i + 256] + common;
+ samples[i + 256] = samples[i + 512] + common;
}
}
-static void mix21to2(sample_t * left, sample_t * right, sample_t bias)
+static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = BIAS(right[i + 256]);
- left[i] += common;
- right[i] += common;
+ for (i = 0; i < 256; i++) {
+ common = BIAS (right[i + 256]);
+ left[i] += common;
+ right[i] += common;
}
}
-static void mix21toS(sample_t * samples, sample_t bias)
+static void mix21toS (sample_t * samples, sample_t bias)
{
int i;
sample_t surround;
- for(i = 0; i < 256; i++)
- {
- surround = samples[i + 512];
- samples[i] += BIAS(-surround);
- samples[i + 256] += BIAS(surround);
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512];
+ samples[i] += BIAS (-surround);
+ samples[i + 256] += BIAS (surround);
}
}
-static void mix31to2(sample_t * samples, sample_t bias)
+static void mix31to2 (sample_t * samples, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = BIAS(samples[i] + samples[i + 768]);
- samples[i] = samples[i + 256] + common;
- samples[i + 256] = samples[i + 512] + common;
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i] + samples[i + 768]);
+ samples[i] = samples[i + 256] + common;
+ samples[i + 256] = samples[i + 512] + common;
}
}
-static void mix31toS(sample_t * samples, sample_t bias)
+static void mix31toS (sample_t * samples, sample_t bias)
{
int i;
sample_t common, surround;
- for(i = 0; i < 256; i++)
- {
- common = BIAS(samples[i]);
- surround = samples[i + 768];
- samples[i] = samples[i + 256] + common - surround;
- samples[i + 256] = samples[i + 512] + common + surround;
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ surround = samples[i + 768];
+ samples[i] = samples[i + 256] + common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
}
}
-static void mix22toS(sample_t * samples, sample_t bias)
+static void mix22toS (sample_t * samples, sample_t bias)
{
int i;
sample_t surround;
- for(i = 0; i < 256; i++)
- {
- surround = samples[i + 512] + samples[i + 768];
- samples[i] += BIAS(-surround);
- samples[i + 256] += BIAS(surround);
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512] + samples[i + 768];
+ samples[i] += BIAS (-surround);
+ samples[i + 256] += BIAS (surround);
}
}
-static void mix32to2(sample_t * samples, sample_t bias)
+static void mix32to2 (sample_t * samples, sample_t bias)
{
int i;
sample_t common;
- for(i = 0; i < 256; i++)
- {
- common = BIAS(samples[i]);
- samples[i] = common + samples[i + 256] + samples[i + 768];
- samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ samples[i] = common + samples[i + 256] + samples[i + 768];
+ samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
}
}
-static void mix32toS(sample_t * samples, sample_t bias)
+static void mix32toS (sample_t * samples, sample_t bias)
{
int i;
sample_t common, surround;
- for(i = 0; i < 256; i++)
- {
- common = BIAS(samples[i]);
- surround = samples[i + 768] + samples[i + 1024];
- samples[i] = samples[i + 256] + common - surround;
- samples[i + 256] = samples[i + 512] + common + surround;
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ surround = samples[i + 768] + samples[i + 1024];
+ samples[i] = samples[i + 256] + common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
}
}
-static void move2to1(sample_t * src, sample_t * dest, sample_t bias)
+static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
{
int i;
- for(i = 0; i < 256; i++)
- dest[i] = BIAS(src[i] + src[i + 256]);
+ for (i = 0; i < 256; i++)
+ dest[i] = BIAS (src[i] + src[i + 256]);
}
-static void zero(sample_t * samples)
+static void zero (sample_t * samples)
{
int i;
- for(i = 0; i < 256; i++)
- samples[i] = 0;
+ for (i = 0; i < 256; i++)
+ samples[i] = 0;
}
-void dca_downmix(sample_t * samples, int acmod, int output, sample_t bias,
- level_t clev, level_t slev)
+void dca_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ level_t clev, level_t slev)
{
(void)clev;
- switch(CONVERT(acmod, output & DCA_CHANNEL_MASK))
- {
-
- case CONVERT(DCA_CHANNEL, DCA_MONO):
- case CONVERT(DCA_STEREO, DCA_MONO):
-mix_2to1:
- mix2to1(samples, samples + 256, bias);
- break;
-
- case CONVERT(DCA_2F1R, DCA_MONO):
- if(slev == 0)
- goto mix_2to1;
- case CONVERT(DCA_3F, DCA_MONO):
-mix_3to1:
- mix3to1(samples, bias);
- break;
-
- case CONVERT(DCA_3F1R, DCA_MONO):
- if(slev == 0)
- goto mix_3to1;
- case CONVERT(DCA_2F2R, DCA_MONO):
- if(slev == 0)
- goto mix_2to1;
- mix4to1(samples, bias);
- break;
-
- case CONVERT(DCA_3F2R, DCA_MONO):
- if(slev == 0)
- goto mix_3to1;
- mix5to1(samples, bias);
- break;
-
- case CONVERT(DCA_MONO, DCA_DOLBY):
- memcpy(samples + 256, samples, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(DCA_3F, DCA_STEREO):
- case CONVERT(DCA_3F, DCA_DOLBY):
-mix_3to2:
- mix3to2(samples, bias);
- break;
-
- case CONVERT(DCA_2F1R, DCA_STEREO):
- if(slev == 0)
- break;
- mix21to2(samples, samples + 256, bias);
- break;
-
- case CONVERT(DCA_2F1R, DCA_DOLBY):
- mix21toS(samples, bias);
- break;
-
- case CONVERT(DCA_3F1R, DCA_STEREO):
- if(slev == 0)
- goto mix_3to2;
- mix31to2(samples, bias);
- break;
-
- case CONVERT(DCA_3F1R, DCA_DOLBY):
- mix31toS(samples, bias);
- break;
-
- case CONVERT(DCA_2F2R, DCA_STEREO):
- if(slev == 0)
- break;
- mix2to1(samples, samples + 512, bias);
- mix2to1(samples + 256, samples + 768, bias);
- break;
-
- case CONVERT(DCA_2F2R, DCA_DOLBY):
- mix22toS(samples, bias);
- break;
-
- case CONVERT(DCA_3F2R, DCA_STEREO):
- if(slev == 0)
- goto mix_3to2;
- mix32to2(samples, bias);
- break;
-
- case CONVERT(DCA_3F2R, DCA_DOLBY):
- mix32toS(samples, bias);
- break;
-
- case CONVERT(DCA_3F1R, DCA_3F):
- if(slev == 0)
- break;
- mix21to2(samples, samples + 512, bias);
- break;
-
- case CONVERT(DCA_3F2R, DCA_3F):
- if(slev == 0)
- break;
- mix2to1(samples, samples + 768, bias);
- mix2to1(samples + 512, samples + 1024, bias);
- break;
-
- case CONVERT(DCA_3F1R, DCA_2F1R):
- mix3to2(samples, bias);
- memcpy(samples + 512, samples + 768, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(DCA_2F2R, DCA_2F1R):
- mix2to1(samples + 512, samples + 768, bias);
- break;
-
- case CONVERT(DCA_3F2R, DCA_2F1R):
- mix3to2(samples, bias);
- move2to1(samples + 768, samples + 512, bias);
- break;
-
- case CONVERT(DCA_3F2R, DCA_3F1R):
- mix2to1(samples + 768, samples + 1024, bias);
- break;
-
- case CONVERT(DCA_2F1R, DCA_2F2R):
- memcpy(samples + 768, samples + 512, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(DCA_3F1R, DCA_2F2R):
- mix3to2(samples, bias);
- memcpy(samples + 512, samples + 768, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(DCA_3F2R, DCA_2F2R):
- mix3to2(samples, bias);
- memcpy(samples + 512, samples + 768, 256 * sizeof(sample_t));
- memcpy(samples + 768, samples + 1024, 256 * sizeof(sample_t));
- break;
-
- case CONVERT(DCA_3F1R, DCA_3F2R):
- memcpy(samples + 1024, samples + 768, 256 * sizeof(sample_t));
- break;
+ switch (CONVERT (acmod, output & DCA_CHANNEL_MASK)) {
+
+ case CONVERT (DCA_CHANNEL, DCA_MONO):
+ case CONVERT (DCA_STEREO, DCA_MONO):
+ mix_2to1:
+ mix2to1 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (DCA_2F1R, DCA_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ case CONVERT (DCA_3F, DCA_MONO):
+ mix_3to1:
+ mix3to1 (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ case CONVERT (DCA_2F2R, DCA_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ mix4to1 (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ mix5to1 (samples, bias);
+ break;
+
+ case CONVERT (DCA_MONO, DCA_DOLBY):
+ memcpy (samples + 256, samples, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DCA_3F, DCA_STEREO):
+ case CONVERT (DCA_3F, DCA_DOLBY):
+ mix_3to2:
+ mix3to2 (samples, bias);
+ break;
+
+ case CONVERT (DCA_2F1R, DCA_STEREO):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (DCA_2F1R, DCA_DOLBY):
+ mix21toS (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix31to2 (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_DOLBY):
+ mix31toS (samples, bias);
+ break;
+
+ case CONVERT (DCA_2F2R, DCA_STEREO):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 512, bias);
+ mix2to1 (samples + 256, samples + 768, bias);
+ break;
+
+ case CONVERT (DCA_2F2R, DCA_DOLBY):
+ mix22toS (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix32to2 (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_DOLBY):
+ mix32toS (samples, bias);
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_3F):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 512, bias);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_3F):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 768, bias);
+ mix2to1 (samples + 512, samples + 1024, bias);
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_2F1R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DCA_2F2R, DCA_2F1R):
+ mix2to1 (samples + 512, samples + 768, bias);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_2F1R):
+ mix3to2 (samples, bias);
+ move2to1 (samples + 768, samples + 512, bias);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_3F1R):
+ mix2to1 (samples + 768, samples + 1024, bias);
+ break;
+
+ case CONVERT (DCA_2F1R, DCA_2F2R):
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DCA_3F1R, DCA_3F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ break;
}
}
-void dca_upmix(sample_t * samples, int acmod, int output)
+void dca_upmix (sample_t * samples, int acmod, int output)
{
- switch(CONVERT(acmod, output & DCA_CHANNEL_MASK))
- {
-
- case CONVERT(DCA_3F2R, DCA_MONO):
- zero(samples + 1024);
- case CONVERT(DCA_3F1R, DCA_MONO):
- case CONVERT(DCA_2F2R, DCA_MONO):
- zero(samples + 768);
- case CONVERT(DCA_3F, DCA_MONO):
- case CONVERT(DCA_2F1R, DCA_MONO):
- zero(samples + 512);
- case CONVERT(DCA_CHANNEL, DCA_MONO):
- case CONVERT(DCA_STEREO, DCA_MONO):
- zero(samples + 256);
- break;
-
- case CONVERT(DCA_3F2R, DCA_STEREO):
- case CONVERT(DCA_3F2R, DCA_DOLBY):
- zero(samples + 1024);
- case CONVERT(DCA_3F1R, DCA_STEREO):
- case CONVERT(DCA_3F1R, DCA_DOLBY):
- zero(samples + 768);
- case CONVERT(DCA_3F, DCA_STEREO):
- case CONVERT(DCA_3F, DCA_DOLBY):
-mix_3to2:
- memcpy(samples + 512, samples + 256, 256 * sizeof(sample_t));
- zero(samples + 256);
- break;
-
- case CONVERT(DCA_2F2R, DCA_STEREO):
- case CONVERT(DCA_2F2R, DCA_DOLBY):
- zero(samples + 768);
- case CONVERT(DCA_2F1R, DCA_STEREO):
- case CONVERT(DCA_2F1R, DCA_DOLBY):
- zero(samples + 512);
- break;
-
- case CONVERT(DCA_3F2R, DCA_3F):
- zero(samples + 1024);
- case CONVERT(DCA_3F1R, DCA_3F):
- case CONVERT(DCA_2F2R, DCA_2F1R):
- zero(samples + 768);
- break;
-
- case CONVERT(DCA_3F2R, DCA_3F1R):
- zero(samples + 1024);
- break;
-
- case CONVERT(DCA_3F2R, DCA_2F1R):
- zero(samples + 1024);
- case CONVERT(DCA_3F1R, DCA_2F1R):
-mix_31to21:
- memcpy(samples + 768, samples + 512, 256 * sizeof(sample_t));
- goto mix_3to2;
-
- case CONVERT(DCA_3F2R, DCA_2F2R):
- memcpy(samples + 1024, samples + 768, 256 * sizeof(sample_t));
- goto mix_31to21;
+ switch (CONVERT (acmod, output & DCA_CHANNEL_MASK)) {
+
+ case CONVERT (DCA_3F2R, DCA_MONO):
+ zero (samples + 1024);
+ case CONVERT (DCA_3F1R, DCA_MONO):
+ case CONVERT (DCA_2F2R, DCA_MONO):
+ zero (samples + 768);
+ case CONVERT (DCA_3F, DCA_MONO):
+ case CONVERT (DCA_2F1R, DCA_MONO):
+ zero (samples + 512);
+ case CONVERT (DCA_CHANNEL, DCA_MONO):
+ case CONVERT (DCA_STEREO, DCA_MONO):
+ zero (samples + 256);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_STEREO):
+ case CONVERT (DCA_3F2R, DCA_DOLBY):
+ zero (samples + 1024);
+ case CONVERT (DCA_3F1R, DCA_STEREO):
+ case CONVERT (DCA_3F1R, DCA_DOLBY):
+ zero (samples + 768);
+ case CONVERT (DCA_3F, DCA_STEREO):
+ case CONVERT (DCA_3F, DCA_DOLBY):
+ mix_3to2:
+ memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
+ zero (samples + 256);
+ break;
+
+ case CONVERT (DCA_2F2R, DCA_STEREO):
+ case CONVERT (DCA_2F2R, DCA_DOLBY):
+ zero (samples + 768);
+ case CONVERT (DCA_2F1R, DCA_STEREO):
+ case CONVERT (DCA_2F1R, DCA_DOLBY):
+ zero (samples + 512);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_3F):
+ zero (samples + 1024);
+ case CONVERT (DCA_3F1R, DCA_3F):
+ case CONVERT (DCA_2F2R, DCA_2F1R):
+ zero (samples + 768);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_3F1R):
+ zero (samples + 1024);
+ break;
+
+ case CONVERT (DCA_3F2R, DCA_2F1R):
+ zero (samples + 1024);
+ case CONVERT (DCA_3F1R, DCA_2F1R):
+ mix_31to21:
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ goto mix_3to2;
+
+ case CONVERT (DCA_3F2R, DCA_2F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ goto mix_31to21;
}
}
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/parse.c b/src/filters/transform/MpaDecFilter/libdca/libdca/parse.c
index 9da8b2995..5a0c95f17 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/parse.c
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/parse.c
@@ -50,394 +50,390 @@
#if defined(HAVE_MEMALIGN) && !defined(__cplusplus)
/* some systems have memalign() but no declaration for it */
-void * memalign(size_t align, size_t size);
+void * memalign (size_t align, size_t size);
#else
/* assume malloc alignment is sufficient */
#define memalign(align,size) malloc (size)
#endif
-static int decode_blockcode(int code, int levels, int *values);
+static int decode_blockcode (int code, int levels, int *values);
-static void qmf_32_subbands(dca_state_t * state, int chans,
- double samples_in[32][8], sample_t *samples_out,
- double rScale, sample_t bias);
+static void qmf_32_subbands (dca_state_t * state, int chans,
+ double samples_in[32][8], sample_t *samples_out,
+ double rScale, sample_t bias);
-static void lfe_interpolation_fir(int nDecimationSelect, int nNumDeciSample,
- double *samples_in, sample_t *samples_out,
- double rScale, sample_t bias);
+static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
+ double *samples_in, sample_t *samples_out,
+ double rScale, sample_t bias );
-static void pre_calc_cosmod(dca_state_t * state);
+static void pre_calc_cosmod( dca_state_t * state );
-dca_state_t * dca_init(uint32_t mm_accel)
+dca_state_t * dca_init (uint32_t mm_accel)
{
dca_state_t * state;
int i;
(void)mm_accel;
- state = (dca_state_t *) malloc(sizeof(dca_state_t));
- if(state == NULL)
+ state = (dca_state_t *) malloc (sizeof (dca_state_t));
+ if (state == NULL)
return NULL;
- memset(state, 0, sizeof(dca_state_t));
+ memset (state, 0, sizeof(dca_state_t));
- state->samples = (sample_t *) memalign(16, 256 * 12 * sizeof(sample_t));
- if(state->samples == NULL)
- {
- free(state);
+ state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t));
+ if (state->samples == NULL) {
+ free (state);
return NULL;
}
- for(i = 0; i < 256 * 12; i++)
+ for (i = 0; i < 256 * 12; i++)
state->samples[i] = 0;
/* Pre-calculate cosine modulation coefficients */
- pre_calc_cosmod(state);
+ pre_calc_cosmod( state );
state->downmixed = 1;
return state;
}
-sample_t * dca_samples(dca_state_t * state)
+sample_t * dca_samples (dca_state_t * state)
{
return state->samples;
}
-int dca_blocks_num(dca_state_t * state)
+int dca_blocks_num (dca_state_t * state)
{
/* 8 samples per subsubframe and per subband */
return state->sample_blocks / 8;
}
-static int syncinfo(dca_state_t * state, int * flags,
- int * sample_rate, int * bit_rate, int * frame_length)
+static int syncinfo (dca_state_t * state, int * flags,
+ int * sample_rate, int * bit_rate, int * frame_length)
{
int frame_size;
/* Sync code */
- bitstream_get(state, 32);
+ bitstream_get (state, 32);
/* Frame type */
- bitstream_get(state, 1);
+ bitstream_get (state, 1);
/* Samples deficit */
- bitstream_get(state, 5);
+ bitstream_get (state, 5);
/* CRC present */
- bitstream_get(state, 1);
+ bitstream_get (state, 1);
- *frame_length = (bitstream_get(state, 7) + 1) * 32;
- frame_size = bitstream_get(state, 14) + 1;
- if(!state->word_mode) frame_size = frame_size * 8 / 14 * 2;
+ *frame_length = (bitstream_get (state, 7) + 1) * 32;
+ frame_size = bitstream_get (state, 14) + 1;
+ if (!state->word_mode) frame_size = frame_size * 8 / 14 * 2;
/* Audio channel arrangement */
- *flags = bitstream_get(state, 6);
- if(*flags > 63)
+ *flags = bitstream_get (state, 6);
+ if (*flags > 63)
return 0;
- *sample_rate = bitstream_get(state, 4);
- if((size_t)*sample_rate >= sizeof(dca_sample_rates) / sizeof(int))
+ *sample_rate = bitstream_get (state, 4);
+ if ((size_t)*sample_rate >= sizeof (dca_sample_rates) / sizeof (int))
return 0;
*sample_rate = dca_sample_rates[ *sample_rate ];
- if(!*sample_rate) return 0;
+ if (!*sample_rate) return 0;
- *bit_rate = bitstream_get(state, 5);
- if((size_t)*bit_rate >= sizeof(dca_bit_rates) / sizeof(int))
+ *bit_rate = bitstream_get (state, 5);
+ if ((size_t)*bit_rate >= sizeof (dca_bit_rates) / sizeof (int))
return 0;
*bit_rate = dca_bit_rates[ *bit_rate ];
- if(!*bit_rate) return 0;
+ if (!*bit_rate) return 0;
/* LFE */
- bitstream_get(state, 10);
- if(bitstream_get(state, 2)) *flags |= DCA_LFE;
+ bitstream_get (state, 10);
+ if (bitstream_get (state, 2)) *flags |= DCA_LFE;
return frame_size;
}
-int dca_syncinfo(dca_state_t * state, uint8_t * buf, int * flags,
- int * sample_rate, int * bit_rate, int * frame_length)
+int dca_syncinfo (dca_state_t * state, uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate, int * frame_length)
{
/*
* Look for sync code
*/
/* 14 bits and little endian bitstream */
- if(buf[0] == 0xff && buf[1] == 0x1f &&
- buf[2] == 0x00 && buf[3] == 0xe8 &&
- (buf[4] & 0xf0) == 0xf0 && buf[5] == 0x07)
+ if (buf[0] == 0xff && buf[1] == 0x1f &&
+ buf[2] == 0x00 && buf[3] == 0xe8 &&
+ (buf[4] & 0xf0) == 0xf0 && buf[5] == 0x07)
{
int frame_size;
- dca_bitstream_init(state, buf, 0, 0);
- frame_size = syncinfo(state, flags, sample_rate,
- bit_rate, frame_length);
+ dca_bitstream_init (state, buf, 0, 0);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
return frame_size;
}
/* 14 bits and big endian bitstream */
- if(buf[0] == 0x1f && buf[1] == 0xff &&
- buf[2] == 0xe8 && buf[3] == 0x00 &&
- buf[4] == 0x07 && (buf[5] & 0xf0) == 0xf0)
+ if (buf[0] == 0x1f && buf[1] == 0xff &&
+ buf[2] == 0xe8 && buf[3] == 0x00 &&
+ buf[4] == 0x07 && (buf[5] & 0xf0) == 0xf0)
{
int frame_size;
- dca_bitstream_init(state, buf, 0, 1);
- frame_size = syncinfo(state, flags, sample_rate,
- bit_rate, frame_length);
+ dca_bitstream_init (state, buf, 0, 1);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
return frame_size;
}
/* 16 bits and little endian bitstream */
- if(buf[0] == 0xfe && buf[1] == 0x7f &&
- buf[2] == 0x01 && buf[3] == 0x80)
+ if (buf[0] == 0xfe && buf[1] == 0x7f &&
+ buf[2] == 0x01 && buf[3] == 0x80)
{
int frame_size;
- dca_bitstream_init(state, buf, 1, 0);
- frame_size = syncinfo(state, flags, sample_rate,
- bit_rate, frame_length);
+ dca_bitstream_init (state, buf, 1, 0);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
return frame_size;
}
/* 16 bits and big endian bitstream */
- if(buf[0] == 0x7f && buf[1] == 0xfe &&
- buf[2] == 0x80 && buf[3] == 0x01)
+ if (buf[0] == 0x7f && buf[1] == 0xfe &&
+ buf[2] == 0x80 && buf[3] == 0x01)
{
int frame_size;
- dca_bitstream_init(state, buf, 1, 1);
- frame_size = syncinfo(state, flags, sample_rate,
- bit_rate, frame_length);
+ dca_bitstream_init (state, buf, 1, 1);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
return frame_size;
}
return 0;
}
-int dca_frame(dca_state_t * state, uint8_t * buf, int * flags,
- level_t * level, sample_t bias)
+int dca_frame (dca_state_t * state, uint8_t * buf, int * flags,
+ level_t * level, sample_t bias)
{
int i, j;
static float adj_table[] = { 1.0, 1.1250, 1.2500, 1.4375 };
- dca_bitstream_init(state, buf, state->word_mode, state->bigendian_mode);
+ dca_bitstream_init (state, buf, state->word_mode, state->bigendian_mode);
/* Sync code */
- bitstream_get(state, 32);
+ bitstream_get (state, 32);
/* Frame header */
- state->frame_type = bitstream_get(state, 1);
- state->samples_deficit = bitstream_get(state, 5) + 1;
- state->crc_present = bitstream_get(state, 1);
- state->sample_blocks = bitstream_get(state, 7) + 1;
- state->frame_size = bitstream_get(state, 14) + 1;
- state->amode = bitstream_get(state, 6);
- state->sample_rate = bitstream_get(state, 4);
- state->bit_rate = bitstream_get(state, 5);
-
- state->downmix = bitstream_get(state, 1);
- state->dynrange = bitstream_get(state, 1);
- state->timestamp = bitstream_get(state, 1);
- state->aux_data = bitstream_get(state, 1);
- state->hdcd = bitstream_get(state, 1);
- state->ext_descr = bitstream_get(state, 3);
- state->ext_coding = bitstream_get(state, 1);
- state->aspf = bitstream_get(state, 1);
- state->lfe = bitstream_get(state, 2);
- state->predictor_history = bitstream_get(state, 1);
+ state->frame_type = bitstream_get (state, 1);
+ state->samples_deficit = bitstream_get (state, 5) + 1;
+ state->crc_present = bitstream_get (state, 1);
+ state->sample_blocks = bitstream_get (state, 7) + 1;
+ state->frame_size = bitstream_get (state, 14) + 1;
+ state->amode = bitstream_get (state, 6);
+ state->sample_rate = bitstream_get (state, 4);
+ state->bit_rate = bitstream_get (state, 5);
+
+ state->downmix = bitstream_get (state, 1);
+ state->dynrange = bitstream_get (state, 1);
+ state->timestamp = bitstream_get (state, 1);
+ state->aux_data = bitstream_get (state, 1);
+ state->hdcd = bitstream_get (state, 1);
+ state->ext_descr = bitstream_get (state, 3);
+ state->ext_coding = bitstream_get (state, 1);
+ state->aspf = bitstream_get (state, 1);
+ state->lfe = bitstream_get (state, 2);
+ state->predictor_history = bitstream_get (state, 1);
/* TODO: check CRC */
- if(state->crc_present) state->header_crc = bitstream_get(state, 16);
+ if (state->crc_present) state->header_crc = bitstream_get (state, 16);
- state->multirate_inter = bitstream_get(state, 1);
- state->version = bitstream_get(state, 4);
- state->copy_history = bitstream_get(state, 2);
- state->source_pcm_res = bitstream_get(state, 3);
- state->front_sum = bitstream_get(state, 1);
- state->surround_sum = bitstream_get(state, 1);
- state->dialog_norm = bitstream_get(state, 4);
+ state->multirate_inter = bitstream_get (state, 1);
+ state->version = bitstream_get (state, 4);
+ state->copy_history = bitstream_get (state, 2);
+ state->source_pcm_res = bitstream_get (state, 3);
+ state->front_sum = bitstream_get (state, 1);
+ state->surround_sum = bitstream_get (state, 1);
+ state->dialog_norm = bitstream_get (state, 4);
/* FIME: channels mixing levels */
state->clev = state->slev = 1;
- state->output = dca_downmix_init(state->amode, *flags, level,
- state->clev, state->slev);
- if(state->output < 0)
+ state->output = dca_downmix_init (state->amode, *flags, level,
+ state->clev, state->slev);
+ if (state->output < 0)
return 1;
- if(state->lfe && (*flags & DCA_LFE))
+ if (state->lfe && (*flags & DCA_LFE))
state->output |= DCA_LFE;
*flags = state->output;
- state->dynrng = state->level = MUL_C(*level, 2);
+ state->dynrng = state->level = MUL_C (*level, 2);
state->bias = bias;
state->dynrnge = 1;
state->dynrngcall = NULL;
#ifdef DEBUG
- fprintf(stderr, "frame type: %i\n", state->frame_type);
- fprintf(stderr, "samples deficit: %i\n", state->samples_deficit);
- fprintf(stderr, "crc present: %i\n", state->crc_present);
- fprintf(stderr, "sample blocks: %i (%i samples)\n",
- state->sample_blocks, state->sample_blocks * 32);
- fprintf(stderr, "frame size: %i bytes\n", state->frame_size);
- fprintf(stderr, "amode: %i (%i channels)\n",
- state->amode, dca_channels[state->amode]);
- fprintf(stderr, "sample rate: %i (%i Hz)\n",
- state->sample_rate, dca_sample_rates[state->sample_rate]);
- fprintf(stderr, "bit rate: %i (%i bits/s)\n",
- state->bit_rate, dca_bit_rates[state->bit_rate]);
- fprintf(stderr, "downmix: %i\n", state->downmix);
- fprintf(stderr, "dynrange: %i\n", state->dynrange);
- fprintf(stderr, "timestamp: %i\n", state->timestamp);
- fprintf(stderr, "aux_data: %i\n", state->aux_data);
- fprintf(stderr, "hdcd: %i\n", state->hdcd);
- fprintf(stderr, "ext descr: %i\n", state->ext_descr);
- fprintf(stderr, "ext coding: %i\n", state->ext_coding);
- fprintf(stderr, "aspf: %i\n", state->aspf);
- fprintf(stderr, "lfe: %i\n", state->lfe);
- fprintf(stderr, "predictor history: %i\n", state->predictor_history);
- fprintf(stderr, "header crc: %i\n", state->header_crc);
- fprintf(stderr, "multirate inter: %i\n", state->multirate_inter);
- fprintf(stderr, "version number: %i\n", state->version);
- fprintf(stderr, "copy history: %i\n", state->copy_history);
- fprintf(stderr, "source pcm resolution: %i (%i bits/sample)\n",
- state->source_pcm_res,
- dca_bits_per_sample[state->source_pcm_res]);
- fprintf(stderr, "front sum: %i\n", state->front_sum);
- fprintf(stderr, "surround sum: %i\n", state->surround_sum);
- fprintf(stderr, "dialog norm: %i\n", state->dialog_norm);
- fprintf(stderr, "\n");
+ fprintf (stderr, "frame type: %i\n", state->frame_type);
+ fprintf (stderr, "samples deficit: %i\n", state->samples_deficit);
+ fprintf (stderr, "crc present: %i\n", state->crc_present);
+ fprintf (stderr, "sample blocks: %i (%i samples)\n",
+ state->sample_blocks, state->sample_blocks * 32);
+ fprintf (stderr, "frame size: %i bytes\n", state->frame_size);
+ fprintf (stderr, "amode: %i (%i channels)\n",
+ state->amode, dca_channels[state->amode]);
+ fprintf (stderr, "sample rate: %i (%i Hz)\n",
+ state->sample_rate, dca_sample_rates[state->sample_rate]);
+ fprintf (stderr, "bit rate: %i (%i bits/s)\n",
+ state->bit_rate, dca_bit_rates[state->bit_rate]);
+ fprintf (stderr, "downmix: %i\n", state->downmix);
+ fprintf (stderr, "dynrange: %i\n", state->dynrange);
+ fprintf (stderr, "timestamp: %i\n", state->timestamp);
+ fprintf (stderr, "aux_data: %i\n", state->aux_data);
+ fprintf (stderr, "hdcd: %i\n", state->hdcd);
+ fprintf (stderr, "ext descr: %i\n", state->ext_descr);
+ fprintf (stderr, "ext coding: %i\n", state->ext_coding);
+ fprintf (stderr, "aspf: %i\n", state->aspf);
+ fprintf (stderr, "lfe: %i\n", state->lfe);
+ fprintf (stderr, "predictor history: %i\n", state->predictor_history);
+ fprintf (stderr, "header crc: %i\n", state->header_crc);
+ fprintf (stderr, "multirate inter: %i\n", state->multirate_inter);
+ fprintf (stderr, "version number: %i\n", state->version);
+ fprintf (stderr, "copy history: %i\n", state->copy_history);
+ fprintf (stderr, "source pcm resolution: %i (%i bits/sample)\n",
+ state->source_pcm_res,
+ dca_bits_per_sample[state->source_pcm_res]);
+ fprintf (stderr, "front sum: %i\n", state->front_sum);
+ fprintf (stderr, "surround sum: %i\n", state->surround_sum);
+ fprintf (stderr, "dialog norm: %i\n", state->dialog_norm);
+ fprintf (stderr, "\n");
#endif
/* Primary audio coding header */
- state->subframes = bitstream_get(state, 4) + 1;
- state->prim_channels = bitstream_get(state, 3) + 1;
+ state->subframes = bitstream_get (state, 4) + 1;
+ state->prim_channels = bitstream_get (state, 3) + 1;
#ifdef DEBUG
- fprintf(stderr, "subframes: %i\n", state->subframes);
- fprintf(stderr, "prim channels: %i\n", state->prim_channels);
+ fprintf (stderr, "subframes: %i\n", state->subframes);
+ fprintf (stderr, "prim channels: %i\n", state->prim_channels);
#endif
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- state->subband_activity[i] = bitstream_get(state, 5) + 2;
+ state->subband_activity[i] = bitstream_get (state, 5) + 2;
#ifdef DEBUG
- fprintf(stderr, "subband activity: %i\n", state->subband_activity[i]);
+ fprintf (stderr, "subband activity: %i\n", state->subband_activity[i]);
#endif
- if(state->subband_activity[i] > DCA_SUBBANDS)
+ if (state->subband_activity[i] > DCA_SUBBANDS)
state->subband_activity[i] = DCA_SUBBANDS;
}
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- state->vq_start_subband[i] = bitstream_get(state, 5) + 1;
+ state->vq_start_subband[i] = bitstream_get (state, 5) + 1;
#ifdef DEBUG
- fprintf(stderr, "vq start subband: %i\n", state->vq_start_subband[i]);
+ fprintf (stderr, "vq start subband: %i\n", state->vq_start_subband[i]);
#endif
- if(state->vq_start_subband[i] > DCA_SUBBANDS)
+ if (state->vq_start_subband[i] > DCA_SUBBANDS)
state->vq_start_subband[i] = DCA_SUBBANDS;
}
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- state->joint_intensity[i] = bitstream_get(state, 3);
+ state->joint_intensity[i] = bitstream_get (state, 3);
#ifdef DEBUG
- fprintf(stderr, "joint intensity: %i\n", state->joint_intensity[i]);
- if(state->joint_intensity[i])
- {
- fprintf(stderr, "JOINTINTENSITY\n");
- }
+ fprintf (stderr, "joint intensity: %i\n", state->joint_intensity[i]);
+ if (state->joint_intensity[i]) {fprintf (stderr, "JOINTINTENSITY\n");}
#endif
}
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- state->transient_huffman[i] = bitstream_get(state, 2);
+ state->transient_huffman[i] = bitstream_get (state, 2);
#ifdef DEBUG
- fprintf(stderr, "transient mode codebook: %i\n",
- state->transient_huffman[i]);
+ fprintf (stderr, "transient mode codebook: %i\n",
+ state->transient_huffman[i]);
#endif
}
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- state->scalefactor_huffman[i] = bitstream_get(state, 3);
+ state->scalefactor_huffman[i] = bitstream_get (state, 3);
#ifdef DEBUG
- fprintf(stderr, "scale factor codebook: %i\n",
- state->scalefactor_huffman[i]);
+ fprintf (stderr, "scale factor codebook: %i\n",
+ state->scalefactor_huffman[i]);
#endif
}
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- state->bitalloc_huffman[i] = bitstream_get(state, 3);
+ state->bitalloc_huffman[i] = bitstream_get (state, 3);
/* if (state->bitalloc_huffman[i] == 7) bailout */
#ifdef DEBUG
- fprintf(stderr, "bit allocation quantizer: %i\n",
- state->bitalloc_huffman[i]);
+ fprintf (stderr, "bit allocation quantizer: %i\n",
+ state->bitalloc_huffman[i]);
#endif
}
/* Get codebooks quantization indexes */
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
state->quant_index_huffman[i][0] = 0; /* Not transmitted */
- state->quant_index_huffman[i][1] = bitstream_get(state, 1);
+ state->quant_index_huffman[i][1] = bitstream_get (state, 1);
}
- for(j = 2; j < 6; j++)
- for(i = 0; i < state->prim_channels; i++)
- state->quant_index_huffman[i][j] = bitstream_get(state, 2);
- for(j = 6; j < 11; j++)
- for(i = 0; i < state->prim_channels; i++)
- state->quant_index_huffman[i][j] = bitstream_get(state, 3);
- for(j = 11; j < 27; j++)
- for(i = 0; i < state->prim_channels; i++)
+ for (j = 2; j < 6; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ state->quant_index_huffman[i][j] = bitstream_get (state, 2);
+ for (j = 6; j < 11; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ state->quant_index_huffman[i][j] = bitstream_get (state, 3);
+ for (j = 11; j < 27; j++)
+ for (i = 0; i < state->prim_channels; i++)
state->quant_index_huffman[i][j] = 0; /* Not transmitted */
#ifdef DEBUG
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- fprintf(stderr, "quant index huff:");
- for(j = 0; j < 11; j++)
- fprintf(stderr, " %i", state->quant_index_huffman[i][j]);
- fprintf(stderr, "\n");
+ fprintf( stderr, "quant index huff:" );
+ for (j = 0; j < 11; j++)
+ fprintf (stderr, " %i", state->quant_index_huffman[i][j]);
+ fprintf (stderr, "\n");
}
#endif
/* Get scale factor adjustment */
- for(j = 0; j < 11; j++)
+ for (j = 0; j < 11; j++)
{
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
state->scalefactor_adj[i][j] = 1;
}
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- if(state->quant_index_huffman[i][1] == 0)
+ if (state->quant_index_huffman[i][1] == 0)
{
/* Transmitted only if quant_index_huffman=0 (Huffman code used) */
- state->scalefactor_adj[i][1] = adj_table[bitstream_get(state, 2)];
+ state->scalefactor_adj[i][1] = adj_table[bitstream_get (state, 2)];
}
}
- for(j = 2; j < 6; j++)
- for(i = 0; i < state->prim_channels; i++)
- if(state->quant_index_huffman[i][j] < 3)
+ for (j = 2; j < 6; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ if (state->quant_index_huffman[i][j] < 3)
{
/* Transmitted only if quant_index_huffman < 3 */
state->scalefactor_adj[i][j] =
- adj_table[bitstream_get(state, 2)];
+ adj_table[bitstream_get (state, 2)];
}
- for(j = 6; j < 11; j++)
- for(i = 0; i < state->prim_channels; i++)
- if(state->quant_index_huffman[i][j] < 7)
+ for (j = 6; j < 11; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ if (state->quant_index_huffman[i][j] < 7)
{
/* Transmitted only if quant_index_huffman < 7 */
state->scalefactor_adj[i][j] =
- adj_table[bitstream_get(state, 2)];
+ adj_table[bitstream_get (state, 2)];
}
#ifdef DEBUG
- for(i = 0; i < state->prim_channels; i++)
+ for (i = 0; i < state->prim_channels; i++)
{
- fprintf(stderr, "scalefac adj:");
- for(j = 0; j < 11; j++)
- fprintf(stderr, " %1.3f", state->scalefactor_adj[i][j]);
- fprintf(stderr, "\n");
+ fprintf (stderr, "scalefac adj:");
+ for (j = 0; j < 11; j++)
+ fprintf (stderr, " %1.3f", state->scalefactor_adj[i][j]);
+ fprintf (stderr, "\n");
}
#endif
- if(state->crc_present)
+ if (state->crc_present)
{
/* Audio header CRC check */
- bitstream_get(state, 16);
+ bitstream_get (state, 16);
}
state->current_subframe = 0;
@@ -446,122 +442,122 @@ int dca_frame(dca_state_t * state, uint8_t * buf, int * flags,
return 0;
}
-static int dca_subframe_header(dca_state_t * state)
+static int dca_subframe_header (dca_state_t * state)
{
/* Primary audio coding side information */
int j, k;
/* Subsubframe count */
- state->subsubframes = bitstream_get(state, 2) + 1;
+ state->subsubframes = bitstream_get (state, 2) + 1;
#ifdef DEBUG
- fprintf(stderr, "subsubframes: %i\n", state->subsubframes);
+ fprintf (stderr, "subsubframes: %i\n", state->subsubframes);
#endif
/* Partial subsubframe sample count */
- state->partial_samples = bitstream_get(state, 3);
+ state->partial_samples = bitstream_get (state, 3);
#ifdef DEBUG
- fprintf(stderr, "partial samples: %i\n", state->partial_samples);
+ fprintf (stderr, "partial samples: %i\n", state->partial_samples);
#endif
/* Get prediction mode for each subband */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
- for(k = 0; k < state->subband_activity[j]; k++)
- state->prediction_mode[j][k] = bitstream_get(state, 1);
+ for (k = 0; k < state->subband_activity[j]; k++)
+ state->prediction_mode[j][k] = bitstream_get (state, 1);
#ifdef DEBUG
- fprintf(stderr, "prediction mode:");
- for(k = 0; k < state->subband_activity[j]; k++)
- fprintf(stderr, " %i", state->prediction_mode[j][k]);
- fprintf(stderr, "\n");
+ fprintf (stderr, "prediction mode:");
+ for (k = 0; k < state->subband_activity[j]; k++)
+ fprintf (stderr, " %i", state->prediction_mode[j][k]);
+ fprintf (stderr, "\n");
#endif
}
/* Get prediction codebook */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
- for(k = 0; k < state->subband_activity[j]; k++)
+ for (k = 0; k < state->subband_activity[j]; k++)
{
- if(state->prediction_mode[j][k] > 0)
+ if (state->prediction_mode[j][k] > 0)
{
/* (Prediction coefficient VQ address) */
- state->prediction_vq[j][k] = bitstream_get(state, 12);
+ state->prediction_vq[j][k] = bitstream_get (state, 12);
#ifdef DEBUG
- fprintf(stderr, "prediction coefs: %f, %f, %f, %f\n",
- (double)adpcm_vb[state->prediction_vq[j][k]][0] / 8192,
- (double)adpcm_vb[state->prediction_vq[j][k]][1] / 8192,
- (double)adpcm_vb[state->prediction_vq[j][k]][2] / 8192,
- (double)adpcm_vb[state->prediction_vq[j][k]][3] / 8192);
+ fprintf (stderr, "prediction coefs: %f, %f, %f, %f\n",
+ (double)adpcm_vb[state->prediction_vq[j][k]][0]/8192,
+ (double)adpcm_vb[state->prediction_vq[j][k]][1]/8192,
+ (double)adpcm_vb[state->prediction_vq[j][k]][2]/8192,
+ (double)adpcm_vb[state->prediction_vq[j][k]][3]/8192);
#endif
}
}
}
/* Bit allocation index */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
- for(k = 0; k < state->vq_start_subband[j]; k++)
+ for (k = 0; k < state->vq_start_subband[j]; k++)
{
- if(state->bitalloc_huffman[j] == 6)
- state->bitalloc[j][k] = bitstream_get(state, 5);
- else if(state->bitalloc_huffman[j] == 5)
- state->bitalloc[j][k] = bitstream_get(state, 4);
+ if (state->bitalloc_huffman[j] == 6)
+ state->bitalloc[j][k] = bitstream_get (state, 5);
+ else if (state->bitalloc_huffman[j] == 5)
+ state->bitalloc[j][k] = bitstream_get (state, 4);
else
{
- state->bitalloc[j][k] = InverseQ(state,
- bitalloc_12[state->bitalloc_huffman[j]]);
+ state->bitalloc[j][k] = InverseQ (state,
+ bitalloc_12[state->bitalloc_huffman[j]]);
}
- if(state->bitalloc[j][k] > 26)
+ if (state->bitalloc[j][k] > 26)
{
- fprintf(stderr, "bitalloc index [%i][%i] too big (%i)\n",
- j, k, state->bitalloc[j][k]);
+ fprintf (stderr, "bitalloc index [%i][%i] too big (%i)\n",
+ j, k, state->bitalloc[j][k]);
return -1;
}
}
#ifdef DEBUG
- fprintf(stderr, "bitalloc index: ");
- for(k = 0; k < state->vq_start_subband[j]; k++)
- fprintf(stderr, "%2.2i ", state->bitalloc[j][k]);
- fprintf(stderr, "\n");
+ fprintf (stderr, "bitalloc index: ");
+ for (k = 0; k < state->vq_start_subband[j]; k++)
+ fprintf (stderr, "%2.2i ", state->bitalloc[j][k]);
+ fprintf (stderr, "\n");
#endif
}
/* Transition mode */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
- for(k = 0; k < state->subband_activity[j]; k++)
+ for (k = 0; k < state->subband_activity[j]; k++)
{
state->transition_mode[j][k] = 0;
- if(state->subsubframes > 1 &&
- k < state->vq_start_subband[j] &&
- state->bitalloc[j][k] > 0)
+ if (state->subsubframes > 1 &&
+ k < state->vq_start_subband[j] &&
+ state->bitalloc[j][k] > 0)
{
- state->transition_mode[j][k] = InverseQ(state,
- tmode[state->transient_huffman[j]]);
+ state->transition_mode[j][k] = InverseQ (state,
+ tmode[state->transient_huffman[j]]);
}
}
#ifdef DEBUG
- fprintf(stderr, "Transition mode:");
- for(k = 0; k < state->subband_activity[j]; k++)
- fprintf(stderr, " %i", state->transition_mode[j][k]);
- fprintf(stderr, "\n");
+ fprintf (stderr, "Transition mode:");
+ for (k = 0; k < state->subband_activity[j]; k++)
+ fprintf (stderr, " %i", state->transition_mode[j][k]);
+ fprintf (stderr, "\n");
#endif
}
/* Scale factors */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
int *scale_table;
int scale_sum;
- for(k = 0; k < state->subband_activity[j]; k++)
+ for (k = 0; k < state->subband_activity[j]; k++)
{
state->scale_factor[j][k][0] = 0;
state->scale_factor[j][k][1] = 0;
}
- if(state->scalefactor_huffman[j] == 6)
+ if (state->scalefactor_huffman[j] == 6)
scale_table = scale_factor_quant7;
else
scale_table = scale_factor_quant6;
@@ -569,44 +565,44 @@ static int dca_subframe_header(dca_state_t * state)
/* When huffman coded, only the difference is encoded */
scale_sum = 0;
- for(k = 0; k < state->subband_activity[j]; k++)
+ for (k = 0; k < state->subband_activity[j]; k++)
{
- if(k >= state->vq_start_subband[j] || state->bitalloc[j][k] > 0)
+ if (k >= state->vq_start_subband[j] || state->bitalloc[j][k] > 0)
{
- if(state->scalefactor_huffman[j] < 5)
+ if (state->scalefactor_huffman[j] < 5)
{
/* huffman encoded */
- scale_sum += InverseQ(state,
- scales_129[state->scalefactor_huffman[j]]);
+ scale_sum += InverseQ (state,
+ scales_129[state->scalefactor_huffman[j]]);
}
- else if(state->scalefactor_huffman[j] == 5)
+ else if (state->scalefactor_huffman[j] == 5)
{
- scale_sum = bitstream_get(state, 6);
+ scale_sum = bitstream_get (state, 6);
}
- else if(state->scalefactor_huffman[j] == 6)
+ else if (state->scalefactor_huffman[j] == 6)
{
- scale_sum = bitstream_get(state, 7);
+ scale_sum = bitstream_get (state, 7);
}
state->scale_factor[j][k][0] = scale_table[scale_sum];
}
- if(k < state->vq_start_subband[j] && state->transition_mode[j][k])
+ if (k < state->vq_start_subband[j] && state->transition_mode[j][k])
{
/* Get second scale factor */
- if(state->scalefactor_huffman[j] < 5)
+ if (state->scalefactor_huffman[j] < 5)
{
/* huffman encoded */
- scale_sum += InverseQ(state,
- scales_129[state->scalefactor_huffman[j]]);
+ scale_sum += InverseQ (state,
+ scales_129[state->scalefactor_huffman[j]]);
}
- else if(state->scalefactor_huffman[j] == 5)
+ else if (state->scalefactor_huffman[j] == 5)
{
- scale_sum = bitstream_get(state, 6);
+ scale_sum = bitstream_get (state, 6);
}
- else if(state->scalefactor_huffman[j] == 6)
+ else if (state->scalefactor_huffman[j] == 6)
{
- scale_sum = bitstream_get(state, 7);
+ scale_sum = bitstream_get (state, 7);
}
state->scale_factor[j][k][1] = scale_table[scale_sum];
@@ -614,33 +610,33 @@ static int dca_subframe_header(dca_state_t * state)
}
#ifdef DEBUG
- fprintf(stderr, "Scale factor:");
- for(k = 0; k < state->subband_activity[j]; k++)
+ fprintf (stderr, "Scale factor:");
+ for (k = 0; k < state->subband_activity[j]; k++)
{
- if(k >= state->vq_start_subband[j] || state->bitalloc[j][k] > 0)
- fprintf(stderr, " %i", state->scale_factor[j][k][0]);
- if(k < state->vq_start_subband[j] && state->transition_mode[j][k])
- fprintf(stderr, " %i(t)", state->scale_factor[j][k][1]);
+ if (k >= state->vq_start_subband[j] || state->bitalloc[j][k] > 0)
+ fprintf (stderr, " %i", state->scale_factor[j][k][0]);
+ if (k < state->vq_start_subband[j] && state->transition_mode[j][k])
+ fprintf (stderr, " %i(t)", state->scale_factor[j][k][1]);
}
- fprintf(stderr, "\n");
+ fprintf (stderr, "\n");
#endif
}
/* Joint subband scale factor codebook select */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
/* Transmitted only if joint subband coding enabled */
- if(state->joint_intensity[j] > 0)
- state->joint_huff[j] = bitstream_get(state, 3);
+ if (state->joint_intensity[j] > 0)
+ state->joint_huff[j] = bitstream_get (state, 3);
}
/* Scale factors for joint subband coding */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
int source_channel;
/* Transmitted only if joint subband coding enabled */
- if(state->joint_intensity[j] > 0)
+ if (state->joint_intensity[j] > 0)
{
int scale = 0;
source_channel = state->joint_intensity[j] - 1;
@@ -648,61 +644,61 @@ static int dca_subframe_header(dca_state_t * state)
/* When huffman coded, only the difference is encoded
* (is this valid as well for joint scales ???) */
- for(k = state->subband_activity[j];
- k < state->subband_activity[source_channel]; k++)
+ for (k = state->subband_activity[j];
+ k < state->subband_activity[source_channel]; k++)
{
- if(state->joint_huff[j] < 5)
+ if (state->joint_huff[j] < 5)
{
/* huffman encoded */
- scale = InverseQ(state,
- scales_129[state->joint_huff[j]]);
+ scale = InverseQ (state,
+ scales_129[state->joint_huff[j]]);
}
- else if(state->joint_huff[j] == 5)
+ else if (state->joint_huff[j] == 5)
{
- scale = bitstream_get(state, 6);
+ scale = bitstream_get (state, 6);
}
- else if(state->joint_huff[j] == 6)
+ else if (state->joint_huff[j] == 6)
{
- scale = bitstream_get(state, 7);
+ scale = bitstream_get (state, 7);
}
scale += 64; /* bias */
state->joint_scale_factor[j][k] = scale;/*joint_scale_table[scale];*/
}
- if(!state->debug_flag & 0x02)
+ if (!state->debug_flag & 0x02)
{
- fprintf(stderr, "Joint stereo coding not supported\n");
+ fprintf (stderr, "Joint stereo coding not supported\n");
state->debug_flag |= 0x02;
}
#ifdef DEBUG
- fprintf(stderr, "Joint scale factor index:\n");
- for(k = state->subband_activity[j];
- k < state->subband_activity[source_channel]; k++)
- fprintf(stderr, " %i", state->joint_scale_factor[j][k]);
- fprintf(stderr, "\n");
+ fprintf (stderr, "Joint scale factor index:\n");
+ for (k = state->subband_activity[j];
+ k < state->subband_activity[source_channel]; k++)
+ fprintf (stderr, " %i", state->joint_scale_factor[j][k]);
+ fprintf (stderr, "\n");
#endif
}
}
/* Stereo downmix coefficients */
- if(state->prim_channels > 2 && state->downmix)
+ if (state->prim_channels > 2 && state->downmix)
{
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
- state->downmix_coef[j][0] = bitstream_get(state, 7);
- state->downmix_coef[j][1] = bitstream_get(state, 7);
+ state->downmix_coef[j][0] = bitstream_get (state, 7);
+ state->downmix_coef[j][1] = bitstream_get (state, 7);
}
}
/* Dynamic range coefficient */
- if(state->dynrange) state->dynrange_coef = bitstream_get(state, 8);
+ if (state->dynrange) state->dynrange_coef = bitstream_get (state, 8);
/* Side information CRC check word */
- if(state->crc_present)
+ if (state->crc_present)
{
- bitstream_get(state, 16);
+ bitstream_get (state, 16);
}
/*
@@ -710,49 +706,49 @@ static int dca_subframe_header(dca_state_t * state)
*/
/* VQ encoded high frequency subbands */
- for(j = 0; j < state->prim_channels; j++)
+ for (j = 0; j < state->prim_channels; j++)
{
- for(k = state->vq_start_subband[j];
- k < state->subband_activity[j]; k++)
+ for (k = state->vq_start_subband[j];
+ k < state->subband_activity[j]; k++)
{
/* 1 vector -> 32 samples */
- state->high_freq_vq[j][k] = bitstream_get(state, 10);
+ state->high_freq_vq[j][k] = bitstream_get (state, 10);
#ifdef DEBUG
- fprintf(stderr, "VQ index: %i\n", state->high_freq_vq[j][k]);
+ fprintf( stderr, "VQ index: %i\n", state->high_freq_vq[j][k] );
#endif
}
}
/* Low frequency effect data */
- if(state->lfe)
+ if (state->lfe)
{
/* LFE samples */
int lfe_samples = 2 * state->lfe * state->subsubframes;
double lfe_scale;
- for(j = lfe_samples; j < lfe_samples * 2; j++)
+ for (j = lfe_samples; j < lfe_samples * 2; j++)
{
/* Signed 8 bits int */
state->lfe_data[j] =
- (signed int)(signed char)bitstream_get(state, 8);
+ (signed int)(signed char)bitstream_get (state, 8);
}
/* Scale factor index */
state->lfe_scale_factor =
- scale_factor_quant7[bitstream_get(state, 8)];
+ scale_factor_quant7[bitstream_get (state, 8)];
/* Quantization step size * scale factor */
lfe_scale = 0.035 * state->lfe_scale_factor;
- for(j = lfe_samples; j < lfe_samples * 2; j++)
+ for (j = lfe_samples; j < lfe_samples * 2; j++)
state->lfe_data[j] *= lfe_scale;
#ifdef DEBUG
- fprintf(stderr, "LFE samples:\n");
- for(j = lfe_samples; j < lfe_samples * 2; j++)
- fprintf(stderr, " %f", state->lfe_data[j]);
- fprintf(stderr, "\n");
+ fprintf (stderr, "LFE samples:\n");
+ for (j = lfe_samples; j < lfe_samples * 2; j++)
+ fprintf (stderr, " %f", state->lfe_data[j]);
+ fprintf (stderr, "\n");
#endif
}
@@ -760,7 +756,7 @@ static int dca_subframe_header(dca_state_t * state)
return 0;
}
-static int dca_subsubframe(dca_state_t * state)
+static int dca_subsubframe (dca_state_t * state)
{
int k, l;
int subsubframe = state->current_subsubframe;
@@ -775,14 +771,14 @@ static int dca_subsubframe(dca_state_t * state)
*/
/* Select quantization step size table */
- if(state->bit_rate == 0x1f)
+ if (state->bit_rate == 0x1f)
quant_step_table = lossless_quant_d;
else
quant_step_table = lossy_quant_d;
- for(k = 0; k < state->prim_channels; k++)
+ for (k = 0; k < state->prim_channels; k++)
{
- for(l = 0; l < state->vq_start_subband[k] ; l++)
+ for (l = 0; l < state->vq_start_subband[k] ; l++)
{
int m;
@@ -793,45 +789,45 @@ static int dca_subsubframe(dca_state_t * state)
double rscale;
/*
- * Determine quantization index code book and its type
+ * Determine quantization index code book and its type
*/
/* Select quantization index code book */
- int sel = state->quant_index_huffman[k][abits];
+ int sel = state->quant_index_huffman[k][abits];
/* Determine its type */
int q_type = 1; /* (Assume Huffman type by default) */
- if(abits >= 11 || !bitalloc_select[abits][sel])
+ if (abits >= 11 || !bitalloc_select[abits][sel])
{
/* Not Huffman type */
- if(abits <= 7) q_type = 3; /* Block code */
+ if (abits <= 7) q_type = 3; /* Block code */
else q_type = 2; /* No further encoding */
}
- if(abits == 0) q_type = 0; /* No bits allocated */
+ if (abits == 0) q_type = 0; /* No bits allocated */
/*
- * Extract bits from the bit stream
+ * Extract bits from the bit stream
*/
- switch(q_type)
+ switch (q_type)
{
case 0: /* No bits allocated */
- for(m = 0; m < 8; m++)
+ for (m=0; m<8; m++)
subband_samples[k][l][m] = 0;
break;
case 1: /* Huffman code */
- for(m = 0; m < 8; m++)
+ for (m=0; m<8; m++)
subband_samples[k][l][m] =
- InverseQ(state, bitalloc_select[abits][sel]);
+ InverseQ (state, bitalloc_select[abits][sel]);
break;
case 2: /* No further encoding */
- for(m = 0; m < 8; m++)
+ for (m=0; m<8; m++)
{
/* Extract (signed) quantization index */
- int q_index = bitstream_get(state, abits - 3);
- if(q_index & (1 << (abits - 4)))
+ int q_index = bitstream_get (state, abits - 3);
+ if( q_index & (1 << (abits - 4)) )
{
q_index = (1 << (abits - 3)) - q_index;
q_index = -q_index;
@@ -841,56 +837,56 @@ static int dca_subsubframe(dca_state_t * state)
break;
case 3: /* Block code */
- {
- int block_code1, block_code2, size, levels;
- int block[8];
-
- switch(abits)
{
- case 1:
- size = 7;
- levels = 3;
- break;
- case 2:
- size = 10;
- levels = 5;
- break;
- case 3:
- size = 12;
- levels = 7;
- break;
- case 4:
- size = 13;
- levels = 9;
- break;
- case 5:
- size = 15;
- levels = 13;
- break;
- case 6:
- size = 17;
- levels = 17;
- break;
- case 7:
- default:
- size = 19;
- levels = 25;
- break;
- }
+ int block_code1, block_code2, size, levels;
+ int block[8];
- block_code1 = bitstream_get(state, size);
- /* Should test return value */
- decode_blockcode(block_code1, levels, block);
- block_code2 = bitstream_get(state, size);
- decode_blockcode(block_code2, levels, &block[4]);
- for(m = 0; m < 8; m++)
- subband_samples[k][l][m] = block[m];
+ switch (abits)
+ {
+ case 1:
+ size = 7;
+ levels = 3;
+ break;
+ case 2:
+ size = 10;
+ levels = 5;
+ break;
+ case 3:
+ size = 12;
+ levels = 7;
+ break;
+ case 4:
+ size = 13;
+ levels = 9;
+ break;
+ case 5:
+ size = 15;
+ levels = 13;
+ break;
+ case 6:
+ size = 17;
+ levels = 17;
+ break;
+ case 7:
+ default:
+ size = 19;
+ levels = 25;
+ break;
+ }
- }
- break;
+ block_code1 = bitstream_get (state, size);
+ /* Should test return value */
+ decode_blockcode (block_code1, levels, block);
+ block_code2 = bitstream_get (state, size);
+ decode_blockcode (block_code2, levels, &block[4]);
+ for (m=0; m<8; m++)
+ subband_samples[k][l][m] = block[m];
+
+ }
+ break;
default: /* Undefined */
- fprintf(stderr, "Unknown quantization index codebook");
+ fprintf (stderr, "Unknown quantization index codebook");
return -1;
}
@@ -899,33 +895,33 @@ static int dca_subsubframe(dca_state_t * state)
*/
/* Deal with transients */
- if(state->transition_mode[k][l] &&
- subsubframe >= state->transition_mode[k][l])
+ if (state->transition_mode[k][l] &&
+ subsubframe >= state->transition_mode[k][l])
rscale = quant_step_size * state->scale_factor[k][l][1];
else
rscale = quant_step_size * state->scale_factor[k][l][0];
/* Adjustment */
rscale *= state->scalefactor_adj[k][sel];
- for(m = 0; m < 8; m++) subband_samples[k][l][m] *= rscale;
+ for (m=0; m<8; m++) subband_samples[k][l][m] *= rscale;
/*
* Inverse ADPCM if in prediction mode
*/
- if(state->prediction_mode[k][l])
+ if (state->prediction_mode[k][l])
{
int n;
- for(m = 0; m < 8; m++)
+ for (m=0; m<8; m++)
{
- for(n = 1; n <= 4; n++)
- if(m - n >= 0)
+ for (n=1; n<=4; n++)
+ if (m-n >= 0)
subband_samples[k][l][m] +=
- (adpcm_vb[state->prediction_vq[k][l]][n-1] *
- subband_samples[k][l][m-n] / 8192);
- else if(state->predictor_history)
+ (adpcm_vb[state->prediction_vq[k][l]][n-1] *
+ subband_samples[k][l][m-n]/8192);
+ else if (state->predictor_history)
subband_samples[k][l][m] +=
- (adpcm_vb[state->prediction_vq[k][l]][n-1] *
- state->subband_samples_hist[k][l][m-n+4] / 8192);
+ (adpcm_vb[state->prediction_vq[k][l]][n-1] *
+ state->subband_samples_hist[k][l][m-n+4]/8192);
}
}
}
@@ -933,97 +929,97 @@ static int dca_subsubframe(dca_state_t * state)
/*
* Decode VQ encoded high frequencies
*/
- for(l = state->vq_start_subband[k];
- l < state->subband_activity[k]; l++)
+ for (l = state->vq_start_subband[k];
+ l < state->subband_activity[k]; l++)
{
/* 1 vector -> 32 samples but we only need the 8 samples
* for this subsubframe. */
int m;
- if(!state->debug_flag & 0x01)
+ if (!state->debug_flag & 0x01)
{
- fprintf(stderr, "Stream with high frequencies VQ coding\n");
+ fprintf (stderr, "Stream with high frequencies VQ coding\n");
state->debug_flag |= 0x01;
}
- for(m = 0; m < 8; m++)
+ for (m=0; m<8; m++)
{
- subband_samples[k][l][m] =
+ subband_samples[k][l][m] =
high_freq_vq[state->high_freq_vq[k][l]][subsubframe*8+m]
- * (double)state->scale_factor[k][l][0] / 16.0;
+ * (double)state->scale_factor[k][l][0] / 16.0;
}
}
}
/* Check for DSYNC after subsubframe */
- if(state->aspf || subsubframe == state->subsubframes - 1)
+ if (state->aspf || subsubframe == state->subsubframes - 1)
{
- if(0xFFFF == bitstream_get(state, 16)) /* 0xFFFF */
+ if (0xFFFF == bitstream_get (state, 16)) /* 0xFFFF */
{
#ifdef DEBUG
- fprintf(stderr, "Got subframe DSYNC\n");
+ fprintf( stderr, "Got subframe DSYNC\n" );
#endif
}
else
{
- fprintf(stderr, "Didn't get subframe DSYNC\n");
+ fprintf( stderr, "Didn't get subframe DSYNC\n" );
}
}
/* Backup predictor history for adpcm */
- for(k = 0; k < state->prim_channels; k++)
+ for (k = 0; k < state->prim_channels; k++)
{
- for(l = 0; l < state->vq_start_subband[k] ; l++)
+ for (l = 0; l < state->vq_start_subband[k] ; l++)
{
int m;
- for(m = 0; m < 4; m++)
+ for (m = 0; m < 4; m++)
state->subband_samples_hist[k][l][m] =
subband_samples[k][l][4+m];
}
}
/* 32 subbands QMF */
- for(k = 0; k < state->prim_channels; k++)
+ for (k = 0; k < state->prim_channels; k++)
{
/*static double pcm_to_float[8] =
{32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/
- qmf_32_subbands(state, k,
- subband_samples[k],
- &state->samples[256*k],
- /*WTF ???*/ 32768.0 * 3 / 2/*pcm_to_float[state->source_pcm_res]*/,
- 0/*state->bias*/);
+ qmf_32_subbands (state, k,
+ subband_samples[k],
+ &state->samples[256*k],
+ /*WTF ???*/ 32768.0*3/2/*pcm_to_float[state->source_pcm_res]*/,
+ 0/*state->bias*/);
}
/* Down/Up mixing */
- if(state->prim_channels < dca_channels[state->output & DCA_CHANNEL_MASK])
+ if (state->prim_channels < dca_channels[state->output & DCA_CHANNEL_MASK])
{
- dca_upmix(state->samples, state->amode, state->output);
- }
- else if(state->prim_channels > dca_channels[state->output & DCA_CHANNEL_MASK])
+ dca_upmix (state->samples, state->amode, state->output);
+ } else
+ if (state->prim_channels > dca_channels[state->output & DCA_CHANNEL_MASK])
{
- dca_downmix(state->samples, state->amode, state->output, state->bias,
- state->clev, state->slev);
+ dca_downmix (state->samples, state->amode, state->output, state->bias,
+ state->clev, state->slev);
}
/* Generate LFE samples for this subsubframe FIXME!!! */
- if(state->output & DCA_LFE)
+ if (state->output & DCA_LFE)
{
int lfe_samples = 2 * state->lfe * state->subsubframes;
int i_channels = dca_channels[state->output & DCA_CHANNEL_MASK];
- lfe_interpolation_fir(state->lfe, 2 * state->lfe,
- state->lfe_data + lfe_samples +
- 2 * state->lfe * subsubframe,
- &state->samples[256*i_channels],
- 8388608.0, state->bias);
+ lfe_interpolation_fir (state->lfe, 2 * state->lfe,
+ state->lfe_data + lfe_samples +
+ 2 * state->lfe * subsubframe,
+ &state->samples[256*i_channels],
+ 8388608.0, state->bias);
/* Outputs 20bits pcm samples */
}
return 0;
}
-static int dca_subframe_footer(dca_state_t * state)
+static int dca_subframe_footer (dca_state_t * state)
{
int aux_data_count = 0, i;
int lfe_samples;
@@ -1033,72 +1029,72 @@ static int dca_subframe_footer(dca_state_t * state)
*/
/* Time code stamp */
- if(state->timestamp) bitstream_get(state, 32);
+ if (state->timestamp) bitstream_get (state, 32);
/* Auxiliary data byte count */
- if(state->aux_data) aux_data_count = bitstream_get(state, 6);
+ if (state->aux_data) aux_data_count = bitstream_get (state, 6);
/* Auxiliary data bytes */
for(i = 0; i < aux_data_count; i++)
- bitstream_get(state, 8);
+ bitstream_get (state, 8);
/* Optional CRC check bytes */
- if(state->crc_present && (state->downmix || state->dynrange))
- bitstream_get(state, 16);
+ if (state->crc_present && (state->downmix || state->dynrange))
+ bitstream_get (state, 16);
/* Backup LFE samples history */
lfe_samples = 2 * state->lfe * state->subsubframes;
- for(i = 0; i < lfe_samples; i++)
+ for (i = 0; i < lfe_samples; i++)
{
state->lfe_data[i] = state->lfe_data[i+lfe_samples];
}
#ifdef DEBUG
- fprintf(stderr, "\n");
+ fprintf( stderr, "\n" );
#endif
return 0;
}
-int dca_block(dca_state_t * state)
+int dca_block (dca_state_t * state)
{
/* Sanity check */
- if(state->current_subframe >= state->subframes)
+ if (state->current_subframe >= state->subframes)
{
- fprintf(stderr, "check failed: %i>%i",
- state->current_subframe, state->subframes);
+ fprintf (stderr, "check failed: %i>%i",
+ state->current_subframe, state->subframes);
return -1;
}
- if(!state->current_subsubframe)
+ if (!state->current_subsubframe)
{
#ifdef DEBUG
- fprintf(stderr, "DSYNC dca_subframe_header\n");
+ fprintf (stderr, "DSYNC dca_subframe_header\n");
#endif
/* Read subframe header */
- if(dca_subframe_header(state)) return -1;
+ if (dca_subframe_header (state)) return -1;
}
/* Read subsubframe */
#ifdef DEBUG
- fprintf(stderr, "DSYNC dca_subsubframe\n");
+ fprintf (stderr, "DSYNC dca_subsubframe\n");
#endif
- if(dca_subsubframe(state)) return -1;
+ if (dca_subsubframe (state)) return -1;
/* Update state */
state->current_subsubframe++;
- if(state->current_subsubframe >= state->subsubframes)
+ if (state->current_subsubframe >= state->subsubframes)
{
state->current_subsubframe = 0;
state->current_subframe++;
}
- if(state->current_subframe >= state->subframes)
+ if (state->current_subframe >= state->subframes)
{
#ifdef DEBUG
fprintf(stderr, "DSYNC dca_subframe_footer\n");
#endif
/* Read subframe footer */
- if(dca_subframe_footer(state)) return -1;
+ if (dca_subframe_footer (state)) return -1;
}
return 0;
@@ -1106,48 +1102,48 @@ int dca_block(dca_state_t * state)
/* Very compact version of the block code decoder that does not use table
* look-up but is slightly slower */
-int decode_blockcode(int code, int levels, int *values)
-{
+int decode_blockcode( int code, int levels, int *values )
+{
int i;
int offset = (levels - 1) >> 1;
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
values[i] = (code % levels) - offset;
code /= levels;
}
- if(code == 0)
+ if (code == 0)
return 1;
else
{
- fprintf(stderr, "ERROR: block code look-up failed\n");
+ fprintf (stderr, "ERROR: block code look-up failed\n");
return 0;
}
}
-static void pre_calc_cosmod(dca_state_t * state)
+static void pre_calc_cosmod( dca_state_t * state )
{
int i, j, k;
- for(j = 0, k = 0; k < 16; k++)
- for(i = 0; i < 16; i++)
- state->cos_mod[j++] = cos((2 * i + 1) * (2 * k + 1) * M_PI / 64);
+ for (j=0,k=0;k<16;k++)
+ for (i=0;i<16;i++)
+ state->cos_mod[j++] = cos((2*i+1)*(2*k+1)*M_PI/64);
- for(k = 0; k < 16; k++)
- for(i = 0; i < 16; i++)
- state->cos_mod[j++] = cos((i) * (2 * k + 1) * M_PI / 32);
+ for (k=0;k<16;k++)
+ for (i=0;i<16;i++)
+ state->cos_mod[j++] = cos((i)*(2*k+1)*M_PI/32);
- for(k = 0; k < 16; k++)
- state->cos_mod[j++] = 0.25 / (2 * cos((2 * k + 1) * M_PI / 128));
+ for (k=0;k<16;k++)
+ state->cos_mod[j++] = 0.25/(2*cos((2*k+1)*M_PI/128));
- for(k = 0; k < 16; k++)
- state->cos_mod[j++] = -0.25 / (2.0 * sin((2 * k + 1) * M_PI / 128));
+ for (k=0;k<16;k++)
+ state->cos_mod[j++] = -0.25/(2.0*sin((2*k+1)*M_PI/128));
}
-static void qmf_32_subbands(dca_state_t * state, int chans,
- double samples_in[32][8], sample_t *samples_out,
- double scale, sample_t bias)
+static void qmf_32_subbands (dca_state_t * state, int chans,
+ double samples_in[32][8], sample_t *samples_out,
+ double scale, sample_t bias)
{
double *prCoeff;
int i, j, k;
@@ -1159,77 +1155,77 @@ static void qmf_32_subbands(dca_state_t * state, int chans,
int nChIndex = 0, NumSubband = 32, nStart = 0, nEnd = 8, nSubIndex;
/* Select filter */
- if(!state->multirate_inter) /* Non-perfect reconstruction */
+ if (!state->multirate_inter) /* Non-perfect reconstruction */
prCoeff = fir_32bands_nonperfect;
else /* Perfect reconstruction */
prCoeff = fir_32bands_perfect;
/* Reconstructed channel sample index */
- for(nSubIndex = nStart; nSubIndex < nEnd; nSubIndex++)
+ for (nSubIndex=nStart; nSubIndex<nEnd; nSubIndex++)
{
double A[16], B[16], SUM[16], DIFF[16];
/* Load in one sample from each subband */
- for(i = 0; i < state->subband_activity[chans]; i++)
+ for (i=0; i<state->subband_activity[chans]; i++)
raXin[i] = samples_in[i][nSubIndex];
/* Clear inactive subbands */
- for(i = state->subband_activity[chans]; i < NumSubband; i++)
+ for (i=state->subband_activity[chans]; i<NumSubband; i++)
raXin[i] = 0.0;
/* Multiply by cosine modulation coefficients and
* create temporary arrays SUM and DIFF */
- for(j = 0, k = 0; k < 16; k++)
+ for (j=0,k=0;k<16;k++)
{
A[k] = 0.0;
- for(i = 0; i < 16; i++)
- A[k] += (raXin[2*i] + raXin[2*i+1]) * state->cos_mod[j++];
+ for (i=0;i<16;i++)
+ A[k]+=(raXin[2*i]+raXin[2*i+1])*state->cos_mod[j++];
}
- for(k = 0; k < 16; k++)
+ for (k=0;k<16;k++)
{
B[k] = 0.0;
- for(i = 0; i < 16; i++)
+ for (i=0;i<16;i++)
{
- if(i > 0) B[k] += (raXin[2*i] + raXin[2*i-1]) * state->cos_mod[j++];
- else B[k] += (raXin[2*i]) * state->cos_mod[j++];
+ if(i>0) B[k]+=(raXin[2*i]+raXin[2*i-1])*state->cos_mod[j++];
+ else B[k]+=(raXin[2*i])*state->cos_mod[j++];
}
- SUM[k] = A[k] + B[k];
- DIFF[k] = A[k] - B[k];
+ SUM[k]=A[k]+B[k];
+ DIFF[k]=A[k]-B[k];
}
/* Store history */
- for(k = 0; k < 16; k++)
- subband_fir_hist[k] = state->cos_mod[j++] * SUM[k];
- for(k = 0; k < 16; k++)
- subband_fir_hist[32-k-1] = state->cos_mod[j++] * DIFF[k];
+ for (k=0;k<16;k++)
+ subband_fir_hist[k]=state->cos_mod[j++]*SUM[k];
+ for (k=0;k<16;k++)
+ subband_fir_hist[32-k-1]=state->cos_mod[j++]*DIFF[k];
/* Multiply by filter coefficients */
- for(k = 31, i = 0; i < 32; i++, k--)
- for(j = 0; j < 512; j += 64)
- subband_fir_hist2[i] += prCoeff[i+j] *
- (subband_fir_hist[i+j] - subband_fir_hist[j+k]);
- for(k = 31, i = 0; i < 32; i++, k--)
- for(j = 0; j < 512; j += 64)
- subband_fir_hist2[32+i] += prCoeff[32+i+j] *
- (-subband_fir_hist[i+j] - subband_fir_hist[j+k]);
+ for (k=31,i=0;i<32;i++,k--)
+ for (j=0;j<512;j+=64)
+ subband_fir_hist2[i] += prCoeff[i+j]*
+ (subband_fir_hist[i+j] - subband_fir_hist[j+k]);
+ for (k=31,i=0;i<32;i++,k--)
+ for (j=0;j<512;j+=64)
+ subband_fir_hist2[32+i] += prCoeff[32+i+j]*
+ (-subband_fir_hist[i+j] - subband_fir_hist[j+k]);
/* Create 32 PCM output samples */
- for(i = 0; i < 32; i++)
+ for (i=0;i<32;i++)
samples_out[nChIndex++] = subband_fir_hist2[i] / scale + bias;
/* Update working arrays */
- for(i = 511; i >= 32; i--)
+ for (i=511;i>=32;i--)
subband_fir_hist[i] = subband_fir_hist[i-32];
- for(i = 0; i < NumSubband; i++)
+ for (i=0;i<NumSubband;i++)
subband_fir_hist2[i] = subband_fir_hist2[i+32];
- for(i = 0; i < NumSubband; i++)
+ for (i=0;i<NumSubband;i++)
subband_fir_hist2[i+32] = 0.0;
}
}
-static void lfe_interpolation_fir(int nDecimationSelect, int nNumDeciSample,
- double *samples_in, sample_t *samples_out,
- double scale, sample_t bias)
+static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
+ double *samples_in, sample_t *samples_out,
+ double scale, sample_t bias)
{
/* samples_in: An array holding decimated samples.
* Samples in current subframe starts from samples_in[0],
@@ -1247,32 +1243,30 @@ static void lfe_interpolation_fir(int nDecimationSelect, int nNumDeciSample,
int nDeciIndex;
/* Select decimation filter */
- if(nDecimationSelect == 1)
+ if (nDecimationSelect==1)
{
/* 128 decimation */
nDeciFactor = 128;
/* Pointer to the FIR coefficients array */
prCoeff = lfe_fir_128;
- }
- else
- {
+ } else {
/* 64 decimation */
nDeciFactor = 64;
prCoeff = lfe_fir_64;
}
/* Interpolation */
- for(nDeciIndex = 0; nDeciIndex < nNumDeciSample; nDeciIndex++)
+ for (nDeciIndex=0; nDeciIndex<nNumDeciSample; nDeciIndex++)
{
/* One decimated sample generates nDeciFactor interpolated ones */
- for(k = 0; k < nDeciFactor; k++)
+ for (k=0; k<nDeciFactor; k++)
{
/* Clear accumulation */
double rTmp = 0.0;
/* Accumulate */
- for(J = 0; J < NumFIRCoef / nDeciFactor; J++)
- rTmp += samples_in[nDeciIndex-J] * prCoeff[k+J*nDeciFactor];
+ for (J=0; J<NumFIRCoef/nDeciFactor; J++)
+ rTmp += samples_in[nDeciIndex-J]*prCoeff[k+J*nDeciFactor];
/* Save interpolated samples */
samples_out[nInterpIndex++] = rTmp / scale + bias;
@@ -1280,20 +1274,19 @@ static void lfe_interpolation_fir(int nDecimationSelect, int nNumDeciSample,
}
}
-void dca_dynrng(dca_state_t * state,
- level_t (* call)(level_t, void *), void * data)
+void dca_dynrng (dca_state_t * state,
+ level_t (* call) (level_t, void *), void * data)
{
state->dynrange = 0;
- if(call)
- {
+ if (call) {
state->dynrange = 1;
state->dynrngcall = call;
state->dynrngdata = data;
}
}
-void dca_free(dca_state_t * state)
+void dca_free (dca_state_t * state)
{
- free(state->samples);
- free(state);
+ free (state->samples);
+ free (state);
}
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_adpcm.h b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_adpcm.h
index 3ad6d3d83..c19378dab 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_adpcm.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_adpcm.h
@@ -24,4100 +24,4100 @@
/* 16bits signed fractional Q13 binary codes */
static int16_t adpcm_vb[4096][4] =
{
- { 9928, -2618, -1093, -1263 },
- { 11077, -2876, -1747, -308 },
- { 10503, -1082, -1426, -1167 },
- { 9337, -2403, -1495, 274 },
- { 10698, -2529, -532, -1122 },
- { 10368, -3974, -1264, -750 },
- { 10070, -3667, 346, 863 },
- { 10278, -3093, 311, -576 },
- { 9894, -1330, -1428, -860 },
- { 10544, -1923, -1058, -971 },
- { 10996, -1632, -841, -1404 },
- { 11832, -3465, 1658, -1990 },
- { 10852, -688, -2658, -499 },
- { 10546, -1749, -147, -1733 },
- { 10801, -1004, -708, -1453 },
- { 10588, -441, -2113, -952 },
- { 10141, -3331, -582, -1432 },
- { 9608, -2590, 383, 258 },
- { 11422, -3265, 229, -1544 },
- { 10460, -1338, -713, -1568 },
- { 10306, -1721, -1660, -603 },
- { 9580, -1812, -1235, -1061 },
- { 11471, -2285, -1617, -607 },
- { 10081, -2225, -1408, -868 },
- { 10715, -2624, -1367, -704 },
- { 10616, -1871, -2770, -35 },
- { 9352, -2340, -1024, -1566 },
- { 11065, -1458, -1926, -735 },
- { 11334, -2056, -1041, -1144 },
- { 9825, -2048, -794, -1536 },
- { 11850, -2695, -1123, -867 },
- { 10654, -2226, -1891, -373 },
- { 10024, -1557, -808, -1069 },
- { 11142, -1266, -3238, 128 },
- { 11729, -3282, -514, -1011 },
- { 11402, -2094, -2335, -189 },
- { 10195, -3658, 181, -1875 },
- { 11431, -2626, -404, -1377 },
- { 11001, -3868, -619, -1077 },
- { 10894, -2559, 274, -1758 },
- { 9633, -1482, -2253, -773 },
- { 11245, -3321, 830, -1972 },
- { 9768, -2701, -199, -1859 },
- { 10500, -2042, 525, -2043 },
- { 11669, -4069, 293, -1468 },
- { 9192, -1991, -583, -61 },
- { 10057, -3220, -2015, -473 },
- { 9497, -2315, -2490, -467 },
- { 10455, -3069, -1194, -1007 },
- { 9994, -1936, -60, -1225 },
- { 9295, -2156, -1761, -1134 },
- { 10085, -3748, -1026, 197 },
- { 9334, -2360, 804, -351 },
- { 11561, -2553, 1352, -2313 },
- { 12837, -3998, 1195, -1958 },
- { 10114, -1100, -2414, -394 },
- { 9341, -2530, 315, 755 },
- { 10131, -3164, 1411, -674 },
- { 9535, -905, -1551, 579 },
- { 11717, -1519, -3051, 91 },
- { 9824, -2911, -2775, 192 },
- { 9662, -2934, -561, 1450 },
- { 11085, -3392, -1298, -659 },
- { 8955, -2102, -1899, 703 },
- { 8607, -1742, -4348, 814 },
- { 7640, -2063, -3617, 52 },
- { 7074, -826, -4325, 4375 },
- { 7714, 584, -4238, 1927 },
- { 6355, -952, -4912, 3127 },
- { 7069, -660, -6413, 4087 },
- { 8313, -132, -2964, -876 },
- { 6952, -1422, -3962, -24 },
- { 9299, -734, -3088, -263 },
- { 9484, -574, -4513, 466 },
- { 7246, -91, -3735, -704 },
- { 8325, -1417, -3090, -530 },
- { 6469, -1226, -4757, 829 },
- { 6652, -368, -5682, 1393 },
- { 7971, -1278, -2284, 1205 },
- { 7229, -699, -3556, 1840 },
- { 7994, 1284, -2729, 732 },
- { 9005, -698, -4522, 2189 },
- { 6963, 197, -2727, 380 },
- { 8527, 135, -3991, -213 },
- { 8840, 934, -3014, -567 },
- { 10125, 418, -3284, -371 },
- { 6367, 361, -2318, 2554 },
- { 7892, 172, -5247, 4673 },
- { 6674, 387, -5424, 4398 },
- { 6240, 684, -4047, 1219 },
- { 11170, -794, -5081, 1195 },
- { 11765, -648, -6265, 2052 },
- { 10845, -775, -3837, 366 },
- { 12496, -689, -8260, 3562 },
- { 7893, -1166, -4972, 988 },
- { 8592, 1052, -5986, 3087 },
- { 7277, 1874, -5685, 3579 },
- { 6900, 2016, -4809, 3491 },
- { 8530, -2405, -3250, 1986 },
- { 9426, 494, -7067, 5038 },
- { 10285, 564, -8210, 5370 },
- { 8749, -2207, -3980, 2852 },
- { 9653, -2686, -4300, 1400 },
- { 9770, -2286, -5663, 4233 },
- { 8490, -4, -7048, 4496 },
- { 7697, -1209, -5328, 3183 },
- { 6451, 801, -4324, -554 },
- { 7387, 1806, -5265, 545 },
- { 7450, -2302, -4445, 1418 },
- { 8817, -1370, -5827, 2168 },
- { 10324, -2406, -5629, 2579 },
- { 8863, -2578, -3537, 467 },
- { 6901, -1624, -3169, 3392 },
- { 7846, 156, -6948, 3381 },
- { 7928, -1115, -5972, 4816 },
- { 6089, -599, -4368, -320 },
- { 7833, 1246, -3960, -621 },
- { 8931, 2521, -6768, 2052 },
- { 8900, 1944, -4126, 40 },
- { 7661, -34, -2855, 2480 },
- { 5873, 474, -3262, 3712 },
- { 7535, -234, -4699, 216 },
- { 5856, 143, -5142, 73 },
- { 8944, -106, -5874, 3663 },
- { 7134, 426, -5879, 2895 },
- { 10199, 1011, -4762, 369 },
- { 8454, 264, -5971, 1291 },
- { 7822, -2449, -4333, 4540 },
- { 6200, -2758, -2632, 1497 },
- { 6070, -4315, -2699, 414 },
- { 7047, -3739, -3210, 1060 },
- { 5675, -3801, -2717, -407 },
- { 4789, -4063, -2628, -744 },
- { 4023, -3366, -3133, -726 },
- { 4296, -2407, -3381, -513 },
- { 4388, -2931, -2820, 1512 },
- { 4559, -4233, -1941, 1976 },
- { 6702, -3208, -1755, 1680 },
- { 4416, -3521, -1052, 2984 },
- { 7154, -4266, -1203, 3732 },
- { 3625, -4242, -3244, 1395 },
- { 6518, -2856, -1304, 2887 },
- { 6170, -1949, -3014, 3973 },
- { 5189, -2451, -4020, 3477 },
- { 6218, -2988, -1921, 3844 },
- { 4827, -3688, -1928, 3343 },
- { 6668, -3991, -2805, 3095 },
- { 5297, -3115, -3684, 2390 },
- { 5354, -4614, -2662, 1504 },
- { 4196, -3091, -4147, 1135 },
- { 3540, -2893, -4007, 100 },
- { 5569, -1602, -4007, 1909 },
- { 4341, -2091, -4272, 252 },
- { 5559, -2878, -3832, 498 },
- { 4548, -4479, -2898, -27 },
- { 5176, -2494, -4635, 1476 },
- { 3294, -3485, -3738, 716 },
- { 4920, -1229, -4195, -365 },
- { 3257, -3518, -3349, 2862 },
- { 5286, -1948, -3485, -778 },
- { 6502, -3051, -152, 2854 },
- { 5864, -4192, -1076, 3451 },
- { 4656, -3122, -3448, 179 },
- { 5907, -754, -1596, 3116 },
- { 7229, -3680, -1590, 2892 },
- { 5107, -3888, -3364, 806 },
- { 6764, -2635, -3450, 134 },
- { 5258, -2827, -2844, -1052 },
- { 5798, -1725, -4305, 205 },
- { 5404, -1213, -3362, 449 },
- { 6224, -2738, -3046, -581 },
- { 4223, -2438, -2725, 3745 },
- { 4751, -3411, -2123, 116 },
- { 3868, -3000, -3954, 2297 },
- { 6819, -2899, -4277, 2825 },
- { 4207, -4754, -2808, 865 },
- { 4804, -1494, -1997, 4688 },
- { 5282, -2213, -548, 3559 },
- { 5580, -1912, -566, 4370 },
- { 6168, -2857, -672, 4053 },
- { 6583, -4515, -2850, 1670 },
- { 6511, -3093, -3988, 1421 },
- { 4646, -1790, -1443, 3650 },
- { 5915, -924, -2020, 896 },
- { 7814, -4181, -3152, 2007 },
- { 6190, -2238, -4817, 2279 },
- { 4737, -4034, -3288, 1835 },
- { 8161, -3633, -3423, 3137 },
- { 7415, -2351, -2088, 4290 },
- { 4106, -2517, -62, 2905 },
- { 4909, -3145, -614, 4112 },
- { 4938, -3281, -397, 1100 },
- { -173, 919, 1589, -5363 },
- { -13, 796, -295, -6655 },
- { -1860, -829, 1141, -4555 },
- { 2298, -838, -664, -5005 },
- { -884, -1097, 2074, -4613 },
- { -101, 281, 2846, -4535 },
- { 1166, 453, 2429, -5910 },
- { 879, -664, 2370, -5452 },
- { 1415, -370, -1699, -4727 },
- { -1413, 1277, -669, -6649 },
- { 2133, 304, -968, -4624 },
- { 380, 586, -2087, -4892 },
- { 1336, 275, -82, -5789 },
- { -2459, 1057, -34, -5416 },
- { 2278, -1758, 866, -5653 },
- { 1945, -2295, -149, -5302 },
- { 1287, -3525, 996, -5255 },
- { 2297, 803, 1177, -6067 },
- { 187, -180, -619, -6202 },
- { -793, -2537, 1554, -5057 },
- { -2703, -204, -629, -5853 },
- { -1007, -146, 313, -5582 },
- { 830, 357, 869, -6363 },
- { -228, -575, -3177, -4433 },
- { -1001, -1553, -142, -5708 },
- { -1644, 1683, 1721, -4533 },
- { 893, 1924, -15, -5791 },
- { 2195, 2061, -262, -5471 },
- { 3031, 270, 311, -5096 },
- { 1912, 1638, -1523, -4677 },
- { -3142, -55, 253, -4914 },
- { 356, -1680, 343, -6123 },
- { -2241, -1734, -976, -5939 },
- { -2196, -2893, 547, -4938 },
- { -1245, 126, -1916, -5419 },
- { -249, -3755, -1422, -5594 },
- { 575, -2683, -1926, -4566 },
- { -762, 1885, 192, -5880 },
- { -811, -2562, -1068, -6013 },
- { -2264, -3086, -976, -4775 },
- { 70, -1215, 2880, -4410 },
- { 714, -3760, 2916, -4691 },
- { -244, -3404, 1740, -4493 },
- { 684, -5137, -328, -5608 },
- { -529, -3825, -1786, -4535 },
- { -713, -4743, -1118, -5546 },
- { 2718, -3788, 1798, -5708 },
- { -1639, -3679, -1564, -6095 },
- { 1693, -2642, -1389, -4539 },
- { 505, -1573, -1651, -4878 },
- { -835, -2256, -1941, -5352 },
- { 1464, -411, 1993, -6441 },
- { 493, -3184, -145, -6148 },
- { -1413, 499, -1617, -6479 },
- { -294, 1722, -1419, -5725 },
- { -2937, -1528, -175, -4624 },
- { -594, -5911, -56, -6146 },
- { -300, -4275, 1156, -5947 },
- { 552, -2643, 2669, -3959 },
- { 905, -4158, 1789, -5809 },
- { 1336, -2009, 2108, -5903 },
- { 1555, -3600, 1110, -6759 },
- { -1294, -3464, 77, -6084 },
- { -1139, -4006, -1270, -4181 },
- { -5094, -3296, 1092, -2847 },
- { -5503, -2883, 1984, -2067 },
- { -4671, -4218, -1417, -4132 },
- { -3763, -3818, 1262, -3082 },
- { -5132, -3430, 2928, -728 },
- { -5957, -2877, 1251, -2446 },
- { -4425, -2319, -212, -4276 },
- { -6201, -1993, 1774, -2182 },
- { -5500, -3836, 2201, -1396 },
- { -6934, -2334, 2366, -1293 },
- { -6124, -4140, 1337, -1977 },
- { -6553, -4186, 1756, -1325 },
- { -5126, -1258, 744, -3656 },
- { -5167, -1390, 1581, -2895 },
- { -4525, -3398, 2429, -1865 },
- { -4076, -3183, 2027, -2510 },
- { -6191, -3274, 1838, -1814 },
- { -4454, -2753, 2723, -1185 },
- { -6655, -4797, 251, -2595 },
- { -6332, -2232, 1832, 217 },
- { -5869, -1698, 134, 340 },
- { -6614, -1045, 2126, -1932 },
- { -4859, -2107, 2010, -2435 },
- { -6274, -1622, 2808, -1374 },
- { -3119, -3209, 521, -3988 },
- { -5676, -2082, -420, -2711 },
- { -7073, -3623, 696, -2343 },
- { -5986, -4224, 572, -2454 },
- { -4340, -4521, 882, -2771 },
- { -6178, -1933, 535, -1444 },
- { -4923, -4163, 1744, -2066 },
- { -6410, -1519, 1058, -2683 },
- { -5077, -1185, 856, -2216 },
- { -7091, -2444, 687, -2597 },
- { -5284, -2165, 3239, -993 },
- { -4763, -1497, 197, -3179 },
- { -4128, -4958, -396, -3578 },
- { -5054, -3878, -647, -2672 },
- { -7005, -3348, 1679, -1579 },
- { -5767, -1017, 2582, -1915 },
- { -7069, -2787, 1331, -2070 },
- { -5532, -2296, 706, -2950 },
- { -5059, -3543, -821, -3637 },
- { -6639, -1835, 1016, -696 },
- { -5611, -5220, -694, -3371 },
- { -5994, -2803, 2933, -729 },
- { -5948, -619, 1596, -2676 },
- { -5486, -4419, 153, -3265 },
- { -4329, -3440, 1646, -1439 },
- { -4083, -3978, 177, -3569 },
- { -4289, -2599, 1224, -3075 },
- { -5707, -3253, 1912, -759 },
- { -6606, -3437, 2562, -571 },
- { -5254, -2444, 769, -352 },
- { -6545, -3154, 582, -1103 },
- { -5328, -2241, 2566, -1775 },
- { -7216, -1936, 1538, -1983 },
- { -3730, -2451, 426, -3869 },
- { -5110, -1385, 2031, -1169 },
- { -6470, -2715, 269, -3123 },
- { -5806, -2480, -97, -3832 },
- { -3683, -4916, -490, -4330 },
- { -6341, -2083, -669, -115 },
- { -4913, -4079, -837, -4673 },
- { -3274, -2497, 2334, -2652 },
- { -1286, -1731, 2550, -3756 },
- { -3375, -877, 926, -3977 },
- { -2525, -2079, 2879, -2625 },
- { -5308, -504, 3111, -1607 },
- { -4904, 460, 4093, -1232 },
- { -1993, 1616, 4656, -1913 },
- { -3481, -1176, 3119, -2236 },
- { -4132, -1502, 2339, -2545 },
- { -2542, 1151, 3569, -2550 },
- { -4381, 430, 3147, -2082 },
- { -3888, 867, 3899, -1657 },
- { -2861, 1290, 4202, -1979 },
- { -3893, -253, 2363, -2764 },
- { -1705, 688, 3827, -2923 },
- { -2223, 2312, 3700, -3148 },
- { -1986, -720, 5021, -795 },
- { -3177, 242, 1952, -3352 },
- { -1854, 1509, 2528, -3815 },
- { -3173, 97, 5019, -706 },
- { -2689, -145, 1375, -3915 },
- { -4838, -385, 2488, -2427 },
- { -4557, -355, 1603, -3060 },
- { -3522, 1832, 3292, -2674 },
- { -3769, 780, 2378, -2704 },
- { -4323, -1932, 3414, -1169 },
- { -2740, 1158, 2729, -3273 },
- { -3647, 210, 1464, -2892 },
- { -2342, -2097, 1513, -3727 },
- { -4422, -1242, 3130, -1833 },
- { -1308, -1039, 4290, -1875 },
- { -1754, -2535, 3298, -2314 },
- { -4102, -186, 4037, -1094 },
- { -1008, 1570, 3290, 171 },
- { -3322, -2621, 2791, -1536 },
- { -2539, -2597, 3442, -1672 },
- { -3411, -2015, 3670, -1174 },
- { -2097, 730, 5581, -1399 },
- { -1510, -74, 4820, -2004 },
- { -4086, -868, 4425, -771 },
- { -956, -986, 3640, -2925 },
- { -2087, -1250, 3464, -2458 },
- { -3308, -2411, 1334, -3667 },
- { -2264, -389, 4004, -1854 },
- { -680, 239, 4058, -3388 },
- { -1357, 30, 2993, -3658 },
- { -3601, -552, 1177, -1136 },
- { -2641, 442, 4374, -1625 },
- { -2525, 770, 1640, -3895 },
- { -3172, -891, 3893, -1608 },
- { -2996, 13, 3277, -2414 },
- { -899, 1055, 4470, -2501 },
- { -422, -584, 3475, -3787 },
- { -1978, -593, 2566, -3415 },
- { -3150, -1280, 2362, -3047 },
- { -3592, 224, 1026, -3932 },
- { -4840, -1189, 3633, -879 },
- { -3952, -2255, 2916, -1826 },
- { -1695, 28, 1810, -349 },
- { -745, -2484, 3308, -3293 },
- { -1016, 1563, 5365, -1823 },
- { -2172, -1787, 4266, -1287 },
- { -1241, -1951, 3982, -2413 },
- { -2009, -2639, 2330, -3480 },
- { 5105, -1618, -2588, -2015 },
- { 6497, -1523, -3218, -910 },
- { 6526, -2305, -2029, -1790 },
- { 5289, -99, -3436, -400 },
- { 5781, -1623, -1577, -2617 },
- { 5259, -670, -3125, -1700 },
- { 6343, -1256, -331, -3222 },
- { 7967, -678, -2195, -1462 },
- { 6119, -695, -2988, -1538 },
- { 6108, 494, -3359, -1548 },
- { 5067, 969, -2328, -2707 },
- { 7595, -435, -1497, -2056 },
- { 6929, -719, -2420, -1665 },
- { 5190, 584, -2982, -2103 },
- { 6106, -444, -1411, -2739 },
- { 5584, 289, -1804, -2803 },
- { 5276, 227, -1180, -3361 },
- { 7544, -1525, -1834, -1725 },
- { 5986, -1470, -2606, -1701 },
- { 5096, -765, -1712, -3006 },
- { 5423, -149, -3933, -1157 },
- { 7651, 26, -2445, -1507 },
- { 4745, -464, -1735, -2362 },
- { 5352, -1011, -1094, -1999 },
- { 6300, -672, -542, -1950 },
- { 6675, -1020, -1318, -1059 },
- { 7218, -2036, -603, -2462 },
- { 7755, -1514, -2430, -1229 },
- { 5041, 449, -1056, -2405 },
- { 6710, -2277, -1344, -2284 },
- { 6824, -1347, -2254, 251 },
- { 6068, -1857, -983, -1316 },
- { 5603, -2177, -2730, -1477 },
- { 5838, -1059, -3604, -970 },
- { 5076, -789, -335, -2413 },
- { 6191, -1634, -2000, -2129 },
- { 5092, -1292, -2543, -1034 },
- { 5305, 435, -1710, -1850 },
- { 6140, 561, -2176, -2380 },
- { 6752, 348, -2496, -1890 },
- { 6405, 273, -1098, -2778 },
- { 6942, -1340, -496, -1381 },
- { 5238, -687, -2454, -2349 },
- { 6959, -882, -1833, -2061 },
- { 6292, -253, -2125, -2199 },
- { 5838, -574, -759, -3215 },
- { 6954, -1484, -640, -2771 },
- { 7498, -1706, -1210, -2154 },
- { 6772, -1003, -1235, -2532 },
- { 6014, 228, -2154, -1108 },
- { 6943, -2178, -2644, -1122 },
- { 7262, -763, -3056, -1090 },
- { 6273, -1478, -1072, 177 },
- { 4734, 425, -2912, 357 },
- { 7129, 168, -1537, -2327 },
- { 7204, -434, -746, -2660 },
- { 6879, 57, -3087, -1310 },
- { 4623, -610, -718, -3459 },
- { 6565, -543, -1998, -339 },
- { 4752, -277, -2066, -1405 },
- { 7435, -1416, -1904, -505 },
- { 4076, 150, -1222, -3556 },
- { 7082, -28, -1456, -1174 },
- { 5941, -446, -1326, -1158 },
- { 3870, -1648, -2474, -2589 },
- { 858, 37, -3387, -3721 },
- { 3557, -1503, -1664, -3383 },
- { 3336, -1972, -3079, -2216 },
- { 3186, 60, -4185, -863 },
- { 3456, -773, -3066, -2457 },
- { 4131, -913, -2060, -2601 },
- { 4431, -691, -4114, -972 },
- { 3461, -334, -3680, -1751 },
- { 2006, -459, -2214, -3827 },
- { 1322, 32, -2816, -3203 },
- { 4425, -1897, -2791, -1946 },
- { 4504, 23, -3421, -1909 },
- { 3090, -885, -2366, -3264 },
- { 3209, -2363, -3730, -834 },
- { 3312, -1471, -3641, -1579 },
- { 4184, -1669, -3323, -1248 },
- { 2190, -931, -3302, -2944 },
- { 2947, -229, -4791, -1195 },
- { 2020, -1626, -2700, -3125 },
- { 2214, -326, -4352, -1683 },
- { 3286, -2619, -2412, -2458 },
- { 1000, -2571, -4129, -2158 },
- { 2496, -2627, -3611, -1433 },
- { 2043, -2191, -2167, -3827 },
- { 2571, -2544, -1915, -3222 },
- { 2022, -1501, -3856, -2165 },
- { 2685, -1180, -1461, -4038 },
- { 1610, -2313, -4391, -1173 },
- { 2340, -2490, -4215, -516 },
- { 1742, -2615, -3632, -2146 },
- { 523, -1293, -4246, -2442 },
- { 3725, -2723, -3014, -1576 },
- { 3554, -1381, -4200, -824 },
- { 1291, -1594, -4777, -1430 },
- { 1452, 515, -2960, -3830 },
- { 4264, -894, -3305, -1826 },
- { 2606, -1452, -4522, -966 },
- { 1196, -830, -4807, -1816 },
- { 1054, -775, -2616, -4071 },
- { 4206, 415, -4344, -1132 },
- { 3044, 491, -4126, -1934 },
- { 988, -901, -3353, -3443 },
- { 1729, -3063, -2267, -3370 },
- { 3915, 912, -2989, -2387 },
- { 3781, 300, -2457, -3050 },
- { 2712, 924, -1350, -1206 },
- { 4230, 405, -2343, 665 },
- { 1878, -873, -225, -29 },
- { 3510, 56, -1334, -3420 },
- { 2850, 1447, -2651, -3150 },
- { 1510, -706, -4125, -2483 },
- { 3115, 793, -1692, -3894 },
- { 2667, 213, -2973, -2786 },
- { 1184, -2384, -3051, -3173 },
- { 2139, 796, -2079, -3697 },
- { 1464, -1483, -3726, -2754 },
- { 2407, -1148, -3915, -1569 },
- { 2612, -1779, -3217, -2271 },
- { 2406, -2870, -2937, -2496 },
- { 2140, 126, -3646, -2758 },
- { 2952, -1036, 268, -1423 },
- { 93, -1931, -3841, -3535 },
- { 389, -2953, -3383, -3343 },
- { 8652, -5511, -1662, 565 },
- { 7427, -2791, -2535, -842 },
- { 8541, -4253, -1407, -988 },
- { 8018, -3203, -2998, 105 },
- { 7231, -3926, -958, 1308 },
- { 7331, -3690, -363, 2586 },
- { 6803, -3646, -2226, -903 },
- { 8163, -2811, -477, -2235 },
- { 9356, -3818, -1685, -684 },
- { 8466, -2854, -302, -698 },
- { 8458, -3224, 517, 279 },
- { 8074, -2619, -1326, 2596 },
- { 8779, -2761, -2527, -441 },
- { 6533, -2887, -899, -696 },
- { 7394, -2305, -1642, -120 },
- { 8281, -3780, -22, 1305 },
- { 9158, -4413, -779, 901 },
- { 9031, -5240, -1109, 1678 },
- { 8717, -3650, 410, -1075 },
- { 7317, -3197, -818, -2264 },
- { 7934, -2385, -1214, -1886 },
- { 8256, -4441, -291, -587 },
- { 7358, -3395, 1090, -270 },
- { 9446, -4910, -1343, -473 },
- { 8187, -4726, -808, 1166 },
- { 7504, -3845, -47, 267 },
- { 8029, -2146, -1283, -383 },
- { 7461, -2705, -853, 783 },
- { 9367, -3636, -645, -354 },
- { 8955, -3473, -308, -1947 },
- { 8676, -2683, -2099, 1485 },
- { 7481, -3003, -871, -444 },
- { 8015, -2839, -1673, 1175 },
- { 6947, -4643, -1527, -1047 },
- { 7622, -2575, -137, -960 },
- { 9388, -4279, -707, -1322 },
- { 8382, -5259, -1283, -565 },
- { 6856, -4138, -1030, 630 },
- { 8659, -2571, -1124, -1666 },
- { 8763, -3807, -537, 2543 },
- { 8049, -3578, -2186, -604 },
- { 8272, -2351, -1985, -1214 },
- { 6855, -3796, -1527, -1631 },
- { 7178, -2896, -1600, -1756 },
- { 7040, -2888, -89, -1586 },
- { 6261, -3403, -264, 998 },
- { 7756, -4699, -1543, -834 },
- { 7682, -4622, -758, -1721 },
- { 8839, -4232, -2932, 1959 },
- { 9363, -4679, -1956, 39 },
- { 7883, -3616, -1414, -1432 },
- { 8828, -3188, -1356, -1312 },
- { 7746, -3987, -121, -2424 },
- { 9262, -3256, -693, 818 },
- { 7670, -3420, -148, 3504 },
- { 7344, -3183, 608, 1595 },
- { 8976, -4139, -1848, 1304 },
- { 6708, -4131, 33, -852 },
- { 7840, -4429, -2275, 79 },
- { 8980, -3858, -2838, 453 },
- { 7815, -4604, -2563, 944 },
- { 8372, -4422, -1783, 3071 },
- { 8623, -5128, -1754, 2888 },
- { 7462, -3281, 889, 920 },
- { 8416, -59, -1320, -1825 },
- { 7928, -1488, -414, -2499 },
- { 8110, -977, -1047, -2042 },
- { 8278, -687, -1597, -1550 },
- { 7988, -174, -977, -2106 },
- { 8609, -1547, -1628, -1527 },
- { 9000, -1798, -946, -1761 },
- { 8954, -872, -1404, -1594 },
- { 8939, 466, -748, -1212 },
- { 9549, -329, -177, -1360 },
- { 9411, -18, -1126, -1568 },
- { 8859, -782, -488, -1338 },
- { 8955, -218, -43, -1209 },
- { 9131, -69, -453, -1001 },
- { 9069, -1519, -1091, -1199 },
- { 9247, -1309, -566, -1146 },
- { 8528, -1617, -287, -1313 },
- { 7763, -745, -149, -2040 },
- { 8294, -343, 257, -2633 },
- { 10149, -893, -552, -1649 },
- { 9398, -915, 218, -2042 },
- { 9703, -1194, -675, -1592 },
- { 9586, -700, -427, -1710 },
- { 8930, 497, -1445, -1218 },
- { 9285, -1323, -163, -1552 },
- { 8431, -1289, -985, -1404 },
- { 8965, -655, 653, -1483 },
- { 9542, -1001, -951, -1128 },
- { 9205, -647, -37, -882 },
- { 8603, -56, 514, -1793 },
- { 9300, -12, -1324, -567 },
- { 8773, 238, -184, -1456 },
- { 9941, -1306, -69, -1792 },
- { 9360, 279, -376, -1919 },
- { 9180, -285, 95, -2170 },
- { 9922, -501, -970, -1570 },
- { 8341, -1493, -856, -2092 },
- { 8780, -981, -850, -1014 },
- { 9721, -548, -1504, -1094 },
- { 9973, -1493, 482, -2105 },
- { 8707, -333, -1027, -1087 },
- { 9098, -469, -315, -1723 },
- { 8879, -1050, -661, -2020 },
- { 8857, 602, -866, -1918 },
- { 8945, -1025, -2154, -1071 },
- { 8484, -1930, -468, -2179 },
- { 9177, -1903, -224, -2112 },
- { 8652, -137, -2097, -1214 },
- { 9063, -973, -1405, -772 },
- { 9328, -456, 662, -2469 },
- { 10101, -697, 127, -2113 },
- { 9685, 811, -2359, -1024 },
- { 8586, -94, -460, -1982 },
- { 7924, -141, -509, -2513 },
- { 7773, -669, -107, -2835 },
- { 8636, -1064, -46, -2409 },
- { 9748, 596, -1815, -1349 },
- { 8924, 304, 547, -2614 },
- { 9442, 746, -1153, -1679 },
- { 9454, -278, -529, -1976 },
- { 8488, 561, -32, -2160 },
- { 10083, -63, -1544, -1364 },
- { 9390, -1278, 568, -1131 },
- { 9740, -49, -2253, -910 },
- { 3636, -2391, -1115, -3614 },
- { 6014, -3204, -1902, -1808 },
- { 5787, -3497, -1116, -2590 },
- { 4365, -3046, -1632, -2668 },
- { 4733, -2192, -2029, -2468 },
- { 5412, -2753, -1633, -2464 },
- { 4455, -3375, -767, -3399 },
- { 4456, -1644, -983, -2841 },
- { 4039, -2523, 38, -3967 },
- { 3406, -2662, 72, -4757 },
- { 4279, -2005, 1055, -4399 },
- { 4321, -1377, -860, -3786 },
- { 3743, -5739, -651, -3047 },
- { 3528, -5510, 361, -4060 },
- { 6496, -4886, -136, -2689 },
- { 4513, -5254, 551, -4010 },
- { 6557, -3413, -92, -3063 },
- { 4186, -2059, 187, 47 },
- { 6210, -4117, -1256, -1985 },
- { 6038, -4343, 351, -2124 },
- { 4305, -4780, -2077, -1897 },
- { 4480, -3815, -2228, -1533 },
- { 5582, -3689, 1221, -3429 },
- { 5532, -4874, 1195, -2765 },
- { 6518, -2853, -905, -2568 },
- { 5467, -2192, 470, -4115 },
- { 4139, -1577, 240, -3493 },
- { 5281, -1926, -729, -3340 },
- { 5214, -2870, 1359, -4289 },
- { 3046, -3510, -1536, -3214 },
- { 5433, -2881, -1230, -1184 },
- { 4861, -3932, -1071, -2791 },
- { 5693, -4234, -1906, -1502 },
- { 4004, -3935, -1804, -2383 },
- { 3728, -3792, 681, -4773 },
- { 3621, -3030, -1951, -2598 },
- { 5133, -3903, 44, -3700 },
- { 3561, -3451, 1183, -5301 },
- { 5026, -2762, -2341, -1780 },
- { 5841, -2492, -467, -3210 },
- { 5591, -1791, 497, -2472 },
- { 5054, -3898, -1822, -2097 },
- { 5813, -2792, 83, -1469 },
- { 4432, -4497, 1670, -5193 },
- { 5338, -4653, -1109, -2200 },
- { 3239, -4401, -648, -3655 },
- { 2147, -3598, -1200, -4242 },
- { 4417, -2271, -1552, -3210 },
- { 6494, -4360, 852, -3565 },
- { 2393, -6358, -856, -4524 },
- { 4959, -4196, -847, -1403 },
- { 4924, -5438, -226, -3026 },
- { 4254, -5303, -1306, -2424 },
- { 4121, -3126, -2334, -1981 },
- { 3437, -4443, -1464, -2953 },
- { 3203, -3459, -529, -4339 },
- { 5896, -5945, 543, -3246 },
- { 1987, -4733, -220, -4863 },
- { 4358, -4431, -514, -3081 },
- { 4583, -2416, -492, -2287 },
- { 2943, -5035, 419, -4927 },
- { 5358, -5129, 987, -4309 },
- { 4460, -3392, 1752, -5634 },
- { 3415, -4633, 1507, -5945 },
- { 811, -4692, -445, 2333 },
- { 1009, -5613, -1857, 1360 },
- { 1338, -2712, -2720, 3036 },
- { 1002, -3754, -2582, 2344 },
- { 750, -4608, -2334, 714 },
- { 2043, -3207, -2822, 2173 },
- { -140, -4654, -2953, 357 },
- { -54, -4026, -2376, 2695 },
- { 1858, -5022, -717, 2287 },
- { 2064, -3894, -722, 3255 },
- { 2727, -4558, -332, 2603 },
- { 1810, -5378, 283, 1826 },
- { 3935, -4326, 762, 3383 },
- { -767, -4697, -2510, 1922 },
- { 2146, -4312, -3090, 1641 },
- { 54, -5881, -2114, 921 },
- { 1992, -5766, -640, 1574 },
- { 1200, -5371, -1114, 1828 },
- { 2973, -5337, 34, 2266 },
- { 1531, -5018, -2817, 1192 },
- { 3078, -4570, 117, 1990 },
- { 924, -4286, -1388, 2713 },
- { 142, -5058, -2848, 1487 },
- { -106, -6180, -881, 842 },
- { 673, -5433, -229, 1596 },
- { 783, -5710, -2784, 562 },
- { 1935, -5729, -2009, 856 },
- { -410, -3375, -3326, 2734 },
- { 234, -3000, -2628, 3260 },
- { 733, -3405, -3806, 1589 },
- { 771, -4285, -3544, 1314 },
- { 1192, -3563, -3960, 2178 },
- { 206, -5555, -1250, 1546 },
- { -130, -3815, -1210, 3041 },
- { 646, -3940, -393, 2992 },
- { -184, -4931, -1767, 1925 },
- { 2746, -5120, -2275, 1464 },
- { 2440, -3731, -3352, 2729 },
- { -490, -4942, -3779, 997 },
- { 68, -2636, -4167, 3778 },
- { 48, -3986, -4118, 2106 },
- { -978, -5486, -1336, 1390 },
- { 1126, -5297, -855, 640 },
- { -472, -3975, -3622, 1557 },
- { 2456, -5344, -1523, 1648 },
- { -774, -5652, -2417, 1147 },
- { 995, -6122, -812, 1132 },
- { 3282, -4571, -1763, 2175 },
- { 3655, -3862, -676, 3568 },
- { 3038, -3647, -1672, 3381 },
- { 2595, -2964, -2772, 3263 },
- { 4176, -3353, -1148, 4354 },
- { 1603, -3442, -1500, 3444 },
- { 828, -6226, -1783, 678 },
- { 1421, -3333, -3080, 3403 },
- { 1121, -4727, -1924, 1984 },
- { -186, -5083, -682, 1796 },
- { 819, -2778, -3488, 530 },
- { 421, -2873, -3832, 2596 },
- { 2164, -4263, -1605, 2282 },
- { 585, -4437, -682, -491 },
- { -644, -4452, -1157, 2325 },
- { 1991, -4299, 210, 2834 },
- { 2135, -3632, -2113, 665 },
- { -7482, -2724, -2662, -1380 },
- { -6983, -2166, -3756, -3509 },
- { -7085, -1439, -2397, -3112 },
- { -7760, -3049, -3319, -2822 },
- { -8413, -2760, -4406, -3298 },
- { -5995, -3943, -1260, -3750 },
- { -7879, -1554, -3464, -2606 },
- { -6314, -2034, -3878, -1681 },
- { -8849, -2084, -1399, -1231 },
- { -7153, -2602, -1384, -817 },
- { -8041, -2571, -407, -2785 },
- { -7246, -2233, -1578, 260 },
- { -7336, -3883, -4061, -1342 },
- { -7619, -3908, -2342, 382 },
- { -8684, -3724, -1662, -727 },
- { -7850, -2922, -1770, -3449 },
- { -6766, -2034, -1293, -1988 },
- { -6895, -2116, -968, -3744 },
- { -7136, -5147, -2618, -2809 },
- { -8224, -3724, -2519, -1589 },
- { -6711, -2750, -3021, -219 },
- { -8059, -1638, -1102, -3175 },
- { -8710, -4839, -3963, -3143 },
- { -9363, -4965, -3257, -1002 },
- { -6099, -1751, -3157, -395 },
- { -6453, -3216, -4597, -483 },
- { -7879, -5477, -839, -2638 },
- { -7202, -4038, -526, -2856 },
- { -8022, -1228, -1910, -1646 },
- { -9117, -1393, -1582, -2535 },
- { -9095, -2693, -636, -2605 },
- { -9076, -2580, -3481, -2519 },
- { -8327, -4859, -2422, 83 },
- { -8368, -2129, -2324, -2173 },
- { -8554, -4563, -3842, -2007 },
- { -10462, -4261, -1934, -2084 },
- { -9717, -3187, -2294, -1896 },
- { -9625, -3889, -3020, -3224 },
- { -9857, -4955, -4239, -2184 },
- { -9752, -2351, -2277, -3129 },
- { -7219, -1302, -2639, -1603 },
- { -7477, -4360, -3718, -559 },
- { -5680, -2033, -2326, -3078 },
- { -10190, -5548, -4643, -3601 },
- { -9431, -4121, -879, -2479 },
- { -8365, -5450, -2020, -1439 },
- { -6289, -5178, -1605, -3845 },
- { -8319, -3866, -687, -2792 },
- { -8131, -1031, -3608, -3947 },
- { -10510, -2560, -1199, -2082 },
- { -11015, -3640, -2748, -3041 },
- { -8762, -5022, -5231, -1162 },
- { -10153, -2715, -4648, -4859 },
- { -7930, -5205, -1900, -3600 },
- { -9561, -3548, -4812, -3722 },
- { -7663, -4709, -1180, -1475 },
- { -9073, -5707, -1815, -2980 },
- { -8602, -2363, -2675, -3770 },
- { -9967, -5614, -3575, -3838 },
- { -8324, -1005, -2131, -3254 },
- { -10331, -5737, -2550, -2940 },
- { -8234, -3354, -3361, -4479 },
- { -8140, -1951, -4526, -4545 },
- { -6679, -2662, -2284, -4182 },
- { -1122, -1514, -6427, -212 },
- { 54, -1660, -5424, -1404 },
- { 254, -2778, -5222, 846 },
- { -267, -1661, -6577, 814 },
- { -305, -2021, -5759, 1484 },
- { -1791, -2446, -6867, -86 },
- { -2929, -3158, -6603, -1799 },
- { -1391, -3189, -5557, -1053 },
- { -1602, -884, -6767, -1213 },
- { -361, -318, -6219, -44 },
- { -4078, -2635, -5523, -433 },
- { -956, 478, -4382, 1470 },
- { -3300, -2462, -6021, -2721 },
- { 708, -2434, -5085, -540 },
- { -2435, -3607, -5647, -2110 },
- { -491, -1134, -4681, -2886 },
- { 87, -3435, -4641, -1194 },
- { -586, -2927, -4784, 366 },
- { -1394, -2326, -6021, 350 },
- { 97, -2519, -4678, -2120 },
- { -1547, -1907, -5069, -2993 },
- { 268, -3724, -4719, 127 },
- { -827, -1190, -5912, 1144 },
- { -3959, -2322, -6898, -1974 },
- { -2728, -2228, -6426, -562 },
- { -456, -666, -5785, -1609 },
- { 531, -1096, -5731, -656 },
- { -3569, -688, -3915, 110 },
- { -4752, -1725, -4393, -377 },
- { -3210, -3315, -6960, -840 },
- { -688, -3416, -4971, 1221 },
- { -1833, 77, -6491, -2434 },
- { -239, -255, -6850, -886 },
- { -2112, -1490, -6291, -2689 },
- { -1544, -4579, -5198, -1261 },
- { -2771, -4014, -5520, 683 },
- { -1635, -2829, -5512, 1214 },
- { -958, -2582, -4823, 2360 },
- { -2077, -4566, -4642, 365 },
- { -3112, -4214, -5960, -823 },
- { -2467, -2510, -4858, 1467 },
- { -1561, -3399, -5822, 211 },
- { -775, -1081, -4424, 2636 },
- { -1263, 25, -6378, -1392 },
- { -3476, -366, -5417, -1393 },
- { -3176, -1476, -4149, 1466 },
- { -2479, 518, -4448, -257 },
- { -2992, 158, -4660, -1279 },
- { -1320, -3872, -4479, 1147 },
- { -1475, -312, -5318, 539 },
- { -3527, -1679, -5860, -1681 },
- { -3397, -3438, -5593, 1866 },
- { -4089, -2439, -4763, 1275 },
- { -748, -4513, -4687, -48 },
- { -2166, -4531, -4691, -2856 },
- { -2385, -853, -6035, -627 },
- { -1194, -4091, -4472, -1963 },
- { -682, -3234, -4084, -3033 },
- { -3255, -5015, -5328, -12 },
- { -2313, -3436, -4601, -155 },
- { -2792, -1038, -6947, -2019 },
- { -1244, -1526, -5771, -1882 },
- { -4679, -3731, -5506, 283 },
- { -3062, -66, -3558, -758 },
- { -4895, -1187, 4751, 3728 },
- { -7600, -2752, 3320, 4613 },
- { -5703, -2975, 3944, 2659 },
- { -4972, -1257, -246, 2952 },
- { -4221, -2487, 1702, 4295 },
- { -2900, -1529, 2458, 4935 },
- { -5061, 407, 2416, 4050 },
- { -6931, -3478, 2761, 2213 },
- { -6037, -3921, 3192, 1866 },
- { -6113, -811, 2407, 3782 },
- { -5878, -1716, 1207, 3478 },
- { -5953, -2853, 2207, 2712 },
- { -6807, -3223, 2749, 3595 },
- { -3272, -3157, 1389, 3788 },
- { -5368, -1904, 1980, 5077 },
- { -7235, -1398, 3075, 4548 },
- { -4765, -3487, 2755, 2796 },
- { -7658, -4435, 2694, 2582 },
- { -6997, -4282, 456, 3832 },
- { -5563, -3115, -63, 3713 },
- { -4244, -4220, 1450, 2767 },
- { -3801, -2194, 190, 4303 },
- { -5458, -4119, 1958, 2274 },
- { -7300, -3469, 3514, 3193 },
- { -4594, -2067, 775, 4752 },
- { -3389, -1654, 1464, 5412 },
- { -4845, -3483, 964, 3437 },
- { -6007, -2818, 1666, 4659 },
- { -8709, -5007, 1757, 3287 },
- { -5833, -4389, 1025, 3171 },
- { -5788, -1780, 3944, 3661 },
- { -4430, -920, 1938, 4753 },
- { -7066, -1857, 4591, 4538 },
- { -3549, -513, 1427, 5317 },
- { -7517, -1220, 2883, 3049 },
- { -7605, -2687, 1874, 2735 },
- { -8718, -4035, 2676, 3730 },
- { -7990, -3907, 1185, 2607 },
- { -6058, -1744, 3349, 5157 },
- { -5954, 565, 3161, 3250 },
- { -6478, -612, 1930, 2271 },
- { -6535, -1445, -2, 1618 },
- { -8963, -4151, 1192, 4044 },
- { -7227, -3570, 1600, 4234 },
- { -4674, 79, 595, 3015 },
- { -3974, 430, 2727, 5137 },
- { -5299, 9, 3714, 4779 },
- { -6779, -2699, -8, 2436 },
- { -7016, -1145, 1293, 2310 },
- { -6955, -3312, 1534, 1801 },
- { -4025, 740, 1850, 4054 },
- { -9589, -3460, 4154, 5270 },
- { -4404, -1181, 4298, 5173 },
- { -7356, -4583, -18, 2644 },
- { -6516, -1235, 4439, 6234 },
- { -3453, -301, 4344, 4464 },
- { -4643, 1530, 3315, 4340 },
- { -4575, -2557, 3754, 3682 },
- { -3643, -3501, 2051, 2997 },
- { -5412, -2475, 2301, 1579 },
- { -5846, 259, 1360, 2348 },
- { -5258, -1358, 1050, 838 },
- { -5542, -219, 6377, 5750 },
- { -5713, -2952, 922, 899 },
- { -2049, -1135, 5206, 1033 },
- { -1693, -1886, 4835, -106 },
- { -2344, -3504, 4232, -13 },
- { -2475, -2334, 5043, 1126 },
- { -787, -2549, 3880, 2138 },
- { -3159, -2341, 4830, 2887 },
- { -1780, -1009, 6240, 2061 },
- { -4327, -3363, 2818, 886 },
- { -3376, -2743, 4104, 207 },
- { -3250, -4640, 2718, 1498 },
- { -382, -1075, 4382, 3460 },
- { -2416, -4168, 3530, 816 },
- { -1756, -2708, 4861, 622 },
- { -1879, -2097, 5156, 2889 },
- { -2496, -2418, 3722, 2671 },
- { -2717, -3252, 3341, 1944 },
- { -4063, -4091, 3306, 267 },
- { -3549, -3808, 3747, 842 },
- { -2635, 546, 5794, 1894 },
- { -1857, -1121, 4383, 3964 },
- { -2226, -2166, 3489, 3678 },
- { -3492, -660, 5323, 1063 },
- { -3033, -3130, 4382, 1828 },
- { -2703, -625, 6369, 2851 },
- { -1656, -2842, 4584, -528 },
- { -4781, -2622, 4390, 2097 },
- { -413, -2045, 5081, 3035 },
- { -3810, -2662, 4532, 1095 },
- { -3144, -1858, 5215, 1880 },
- { -3562, -1795, 4928, 670 },
- { -4800, -1509, 5189, 1859 },
- { -1085, -3832, 4169, 900 },
- { -1969, -3270, 2857, 2878 },
- { -4267, -4140, 3176, 1805 },
- { -5145, -3727, 3524, 1168 },
- { -1346, -1876, 5501, 1748 },
- { -4998, -2945, 3699, 338 },
- { -3458, -3096, 3406, -635 },
- { -1751, -3209, 3508, 395 },
- { -2507, 170, 5987, 705 },
- { -3756, -1072, 5647, 3536 },
- { -2870, -1439, 5026, 3212 },
- { -3913, -3225, 3669, 2144 },
- { -3739, 226, 5747, 764 },
- { -2052, -820, 5266, 3093 },
- { -3214, -3820, 2409, 2391 },
- { -4398, -2588, 3501, -218 },
- { -4484, -1763, 4180, -198 },
- { -3368, -1525, 4362, -134 },
- { -2407, 224, 4905, 3533 },
- { -1369, -2937, 4728, 1788 },
- { -4848, -1707, 4159, 851 },
- { -3454, -1749, 4281, 3230 },
- { -1990, -3853, 3487, 1735 },
- { -3117, 92, 6155, 4075 },
- { -2676, -2472, 4078, -589 },
- { -1547, -2012, 2626, 1835 },
- { -4275, -588, 4824, 725 },
- { -601, -2249, 3736, 3548 },
- { -4060, -61, 5333, 3097 },
- { -4303, 7, 6551, 3054 },
- { -5003, -1029, 5786, 3319 },
- { -2810, -728, 5392, 199 },
- { -1232, -200, 5228, 3121 },
- { 2621, 165, -6255, 298 },
- { 3669, 537, -6844, 1564 },
- { 1598, -1190, -6235, 2523 },
- { 2164, -32, -6894, 1383 },
- { 853, -1597, -6069, 1449 },
- { 1377, -1661, -5266, 108 },
- { 2660, 48, -5172, -517 },
- { 1903, -391, -5677, 1010 },
- { 3792, 206, -5274, -11 },
- { 1239, 2776, -2929, 2721 },
- { 4071, 149, -7259, 3125 },
- { 1436, -480, -6156, -196 },
- { 1373, -1960, -5005, 3122 },
- { 3413, -1271, -5176, 3283 },
- { 3060, -68, -6495, 2238 },
- { 2700, -2075, -4681, 91 },
- { 2928, -1728, -5168, 1858 },
- { 4424, 828, -4471, 88 },
- { 2672, -2604, -4038, 2753 },
- { 5223, -123, -6749, 2295 },
- { 4237, -420, -5538, 1353 },
- { 4744, -1281, -4097, 4708 },
- { 1103, -2764, -4751, 2024 },
- { 3747, -1913, -3911, 3960 },
- { 2470, -1416, -5542, 615 },
- { 4847, -1354, -5334, 1733 },
- { 5336, 88, -7593, 4007 },
- { 2388, -2880, -4807, 1037 },
- { 4495, 1391, -5685, -139 },
- { 5253, 1637, -6450, 1533 },
- { 1199, 795, -5515, 1261 },
- { 1397, -1259, -4252, 3838 },
- { 746, 70, -6640, 604 },
- { 1584, 166, -4972, 3072 },
- { 380, -999, -5397, 2267 },
- { 2974, 1707, -3242, 5360 },
- { 5202, -403, -5453, 2832 },
- { 3718, -1731, -4760, 714 },
- { 4150, -975, -4792, 61 },
- { 2925, -818, -4841, 15 },
- { 5301, 577, -4006, 3259 },
- { 5265, 1986, -5679, 3028 },
- { 3752, 1928, -4509, 3729 },
- { 3278, 1925, -6370, 1247 },
- { 5107, 1721, -4853, 3127 },
- { 3279, 2982, -2515, 4005 },
- { 4622, 668, -6204, 759 },
- { 6034, 317, -5763, 4818 },
- { -558, 57, -3785, 2817 },
- { 4476, 1616, -3965, 4536 },
- { 5953, 2056, -8215, 2715 },
- { 4387, 2613, -7463, 868 },
- { 5834, 1088, -4736, 4924 },
- { 6473, -856, -6991, 4172 },
- { 4959, -293, -5162, 76 },
- { 2731, -843, -6119, 3847 },
- { 3245, 1202, -6833, 616 },
- { 2553, 1383, -3829, 3859 },
- { 4332, 2099, -3480, 3622 },
- { 2110, 2683, -2728, 3990 },
- { 876, 1167, -3290, 3466 },
- { 3991, 1709, -2410, 4077 },
- { 5105, 939, -2584, 3256 },
- { 4719, 688, -1566, 3040 },
- { -3632, 4335, 1266, -3303 },
- { -4956, 3207, 1312, -2806 },
- { -4669, 2627, 2663, -2435 },
- { -4282, 3708, 2303, -3038 },
- { -4536, 2297, -175, -3350 },
- { -5234, 2503, -139, -880 },
- { -3978, 1512, 1092, -3619 },
- { -4519, 4649, 1363, -2455 },
- { -5118, 3132, 1961, -1577 },
- { -5196, 3379, -182, -1378 },
- { -6420, 4486, 2397, -1993 },
- { -5030, 5046, 1292, -1118 },
- { -4559, 2573, -927, -1406 },
- { -3501, 3730, 691, -4930 },
- { -4364, 2758, 1007, -3909 },
- { -4026, 2839, -1559, -2340 },
- { -5037, 4053, 836, -1571 },
- { -4727, 5136, 1110, -3588 },
- { -5245, 2799, -999, -2164 },
- { -4954, 1501, 422, -3963 },
- { -5994, 2726, 1462, -2833 },
- { -5621, 5159, 2038, -2512 },
- { -4991, 2291, 1917, -3151 },
- { -5469, 4382, -148, -2978 },
- { -5858, 1983, 807, -2720 },
- { -4709, 3556, 952, -467 },
- { -2489, 2362, 1714, -4230 },
- { -4717, 5004, -1180, -3672 },
- { -5914, 3653, 1359, -1317 },
- { -5506, 2995, 780, -1059 },
- { -5287, 3945, 2480, -2293 },
- { -3849, 4358, 322, -1770 },
- { -3911, 3570, 252, -3185 },
- { -3660, 5128, 158, -3719 },
- { -4599, 3277, -503, -2727 },
- { -3673, 3760, -1252, -3339 },
- { -5161, 2337, 388, -1943 },
- { -3529, 2216, 2156, -3080 },
- { -4309, 4331, 1808, -1460 },
- { -4782, 3820, 480, -2504 },
- { -4166, 3544, -378, -1567 },
- { -5572, 2466, -418, -2909 },
- { -6096, 2930, 119, -1878 },
- { -5963, 3554, 1011, -2233 },
- { -6433, 4335, 935, -2930 },
- { -5004, 3314, -1352, -3430 },
- { -6042, 3463, -1008, -3940 },
- { -4671, 2214, -640, -5040 },
- { -2795, 3759, 1412, -3803 },
- { -3647, 4436, 729, -515 },
- { -3594, 1033, 56, -4148 },
- { -2908, 3027, 2889, -3485 },
- { -3338, 2234, 313, -4285 },
- { -3825, 4497, -561, -2634 },
- { -6167, 3012, -48, -3149 },
- { -4828, 3515, -969, -4475 },
- { -5789, 2757, -539, -4173 },
- { -2452, 3067, 564, -4249 },
- { -4921, 1358, 1331, -2889 },
- { -3127, 4239, -1045, -1523 },
- { -4780, 2326, -1118, -3446 },
- { -3908, 5546, 152, -2622 },
- { -6972, 2976, 337, -2809 },
- { -4839, 4613, -35, -4077 },
- { -1408, 4822, -1149, -4997 },
- { -981, 4979, -912, -6304 },
- { -2098, 5689, -888, -2878 },
- { -3343, 4814, -657, -4434 },
- { -2461, 3601, -967, -4869 },
- { -2652, 3944, 87, -5520 },
- { -1104, 6076, 174, -6407 },
- { 355, 5370, -1721, -5869 },
- { 1242, 4497, -1107, -5091 },
- { -89, 4002, -1491, -5182 },
- { 1059, 5693, -1591, -4905 },
- { 1323, 4682, -2078, -4768 },
- { 818, 3996, -549, -5468 },
- { -287, 4529, 929, -5543 },
- { -919, 5519, -2791, -2844 },
- { -1407, 5679, -3289, -3974 },
- { -189, 6530, -3547, -4002 },
- { -900, 7039, -3371, -4855 },
- { -2983, 7211, -363, -4835 },
- { -814, 6503, -104, -5106 },
- { -2386, 6896, 809, -4919 },
- { 845, 4492, 352, -6621 },
- { -1998, 7237, -1646, -4231 },
- { -3380, 6251, 471, -4577 },
- { -1908, 7059, 84, -5726 },
- { -340, 6346, -803, -6265 },
- { -2279, 5834, -47, -4633 },
- { -1532, 5286, -1748, -1901 },
- { -2757, 6188, -453, -3415 },
- { -1255, 6405, -2043, -6357 },
- { 918, 5581, -121, -5667 },
- { 1840, 5336, -821, -5034 },
- { -2475, 4992, -1825, -3104 },
- { -2413, 5606, -1789, -4298 },
- { 132, 5128, -2389, -4442 },
- { 223, 6400, -2653, -4742 },
- { -673, 5012, 680, -4582 },
- { -1657, 6624, -349, -3596 },
- { -755, 6289, -1860, -3978 },
- { -572, 6894, -1946, -5207 },
- { -1141, 4756, -2665, -5586 },
- { -1073, 4269, -431, -4030 },
- { 186, 5761, 916, -5868 },
- { -1907, 4836, 1017, -5106 },
- { -963, 3363, -1248, -6348 },
- { -3262, 4774, -1818, -5858 },
- { 847, 3812, -2538, -4302 },
- { -1223, 5903, 1360, -5479 },
- { -1094, 6923, -1244, -2381 },
- { 267, 6276, -709, -2846 },
- { -157, 5840, 1124, -4266 },
- { 889, 3206, -910, -5305 },
- { -1736, 3344, 582, -4838 },
- { -2357, 5676, -2695, -6277 },
- { -1916, 6901, -986, -5397 },
- { -3062, 6028, -695, -5687 },
- { 1836, 3566, -1357, -5226 },
- { -2176, 4938, 646, -3872 },
- { -2199, 3055, -208, -6124 },
- { -236, 3032, -821, -5325 },
- { -3989, 7277, -565, -3899 },
- { -595, 4362, 74, -5975 },
- { 684, 5874, -841, -4424 },
- { -2731, 6305, -2389, -5465 },
- { -5775, 1325, -56, -2528 },
- { -7029, -534, -1890, -3278 },
- { -5798, -15, -2734, -2210 },
- { -5504, -1198, -353, -3659 },
- { -5079, 960, -894, -4336 },
- { -6073, -36, -133, -3014 },
- { -5782, -259, -1025, -3986 },
- { -6843, 1262, -807, -1639 },
- { -5263, -918, -3290, -579 },
- { -4840, 461, -2158, -533 },
- { -6014, -50, -620, 504 },
- { -5843, 241, -1359, -282 },
- { -5898, 577, 769, -3271 },
- { -6833, -946, -466, -3347 },
- { -6026, 1459, -512, -729 },
- { -7361, 747, -388, -1110 },
- { -6391, 2142, -1160, -2513 },
- { -6995, 304, 498, -2673 },
- { -6757, 679, -386, -433 },
- { -5222, 1688, -1093, -1032 },
- { -5019, 575, 184, -3627 },
- { -4237, 628, -3507, -1243 },
- { -7479, -456, -1722, -1486 },
- { -6464, 713, -1273, -1153 },
- { -6255, 1682, -606, -3607 },
- { -7033, 1497, -71, -1955 },
- { -6694, 1556, -1721, -3214 },
- { -6114, -356, 813, -2575 },
- { -5308, 632, -1851, -1636 },
- { -5742, -911, -1733, 383 },
- { -6083, -387, -2313, -879 },
- { -6535, -530, -1505, -2083 },
- { -4896, 1223, -2750, -1816 },
- { -6392, -463, -3247, -2093 },
- { -5373, 1264, -2706, -3042 },
- { -3894, -1390, -1020, -891 },
- { -6179, 1168, -1966, -1922 },
- { -5162, 1668, -1617, -1916 },
- { -6453, 920, -1169, -2432 },
- { -6130, 2005, -536, -1519 },
- { -6552, -98, -518, -1938 },
- { -7528, 355, -1101, -1772 },
- { -5745, 610, -247, -1360 },
- { -7003, 177, -2064, -1958 },
- { -6956, -570, -2220, -4225 },
- { -7830, 791, -1394, -2774 },
- { -7634, 480, -3171, -4224 },
- { -7913, 1154, -350, -2381 },
- { -5063, 1704, -1804, -2977 },
- { -4887, -524, -2703, 188 },
- { -5551, 406, -1620, -3063 },
- { -7109, 1342, 381, -3021 },
- { -6846, 631, -458, -3398 },
- { -4606, -605, 11, -3930 },
- { -8134, -225, -1738, -2648 },
- { -7043, 402, -2734, -3059 },
- { -7417, 1825, -2545, -4389 },
- { -6971, -236, -1031, -665 },
- { -5752, 2111, -1632, -3808 },
- { -7660, -78, -624, -3135 },
- { -6358, 619, -1951, -3911 },
- { -8134, 408, -1935, -3695 },
- { -6335, 1911, -2368, -4505 },
- { -7116, 2163, -344, -2753 },
- { 2357, 4488, 2220, -5682 },
- { 1385, 3206, 2300, -5305 },
- { 1419, 2557, 5203, -3516 },
- { 262, 4315, 3920, -1847 },
- { 3316, 3187, 1612, -5609 },
- { 1729, 2350, 1673, -6068 },
- { 1603, 6126, 1467, -2839 },
- { -1339, 3316, 3691, -3530 },
- { -563, 4618, 3180, -4548 },
- { 463, 4624, 3111, -5614 },
- { 1246, 5455, 3356, -5720 },
- { 480, 2149, 5422, -2893 },
- { 1768, 4827, 913, -5579 },
- { -149, 5381, 4366, -3297 },
- { 985, 3672, 2644, -92 },
- { -258, 2911, 5817, -2213 },
- { 3428, 3289, 3351, -3541 },
- { -666, 3295, 4727, -2869 },
- { 35, 6641, 4160, -4052 },
- { 623, 6787, 3156, -4560 },
- { 2654, 4360, 4676, -4632 },
- { 1386, 5246, 4834, -4497 },
- { 3488, 4574, 3856, -5946 },
- { 383, 4481, 4168, -4110 },
- { 1753, 3652, 4288, -3326 },
- { 1344, 4905, 2508, -4660 },
- { 1580, 4106, 3104, -2224 },
- { 2027, 5038, 1683, -1554 },
- { 446, 3699, 5872, -3013 },
- { 4637, 4087, 3578, -5018 },
- { 2629, 3560, 5331, -4900 },
- { 1527, 6674, 2523, -4131 },
- { -1437, 2804, 2528, -4464 },
- { -229, 3355, 2016, -5537 },
- { 3666, 3418, 4374, -4581 },
- { 1192, 3799, 923, -6596 },
- { 2040, 2956, 448, -5322 },
- { 2468, 5768, 4029, -5869 },
- { 3438, 6516, 3529, -6667 },
- { 2737, 5495, 680, -5535 },
- { 3896, 5727, 1801, -4958 },
- { 4988, 4957, 3592, -6518 },
- { -542, 4416, 5794, -2787 },
- { 4136, 4354, 2064, -4696 },
- { 3067, 5936, 1207, -3396 },
- { 2789, 4966, 2405, -3854 },
- { 1731, 3270, 3251, -1063 },
- { 1767, 5537, 2084, -2349 },
- { 465, 3116, 4532, -837 },
- { 1499, 2627, 4610, -2212 },
- { 122, 3095, 3642, -3552 },
- { 2542, 2866, 2705, -6402 },
- { 3134, 4323, 698, -4785 },
- { 731, 1859, 3112, -5242 },
- { 2553, 2980, 3241, -4846 },
- { 1329, 5310, 1607, -6624 },
- { 2468, 1858, 3476, -1034 },
- { -172, 4996, 2000, -5562 },
- { 2621, 4220, 1574, -3386 },
- { -333, 1832, 3362, -4117 },
- { 2169, 6762, 3065, -6225 },
- { 2844, 5528, 3223, -4765 },
- { 526, 5175, 1644, -4267 },
- { 2922, 4426, 2414, -2610 },
- { 452, 1399, -4516, -2636 },
- { 2872, 1720, -4667, -1435 },
- { 1279, 702, -5424, -1984 },
- { 2187, 870, -5021, -1341 },
- { 583, -144, -4628, -2464 },
- { 3, 2237, -5284, -2827 },
- { -19, 1005, -5460, -1819 },
- { 2897, 2084, -5885, -515 },
- { -400, 3370, -5527, -2947 },
- { 1505, 2593, -5518, -1802 },
- { 1341, 4534, -5094, -1899 },
- { 3241, 3670, -5493, -1252 },
- { -1287, 921, -5994, -1675 },
- { 627, 408, -6652, -364 },
- { -260, 1127, -4849, -3247 },
- { 371, 3400, -5976, -2285 },
- { 1533, 1566, -6373, -610 },
- { 2462, 4274, -6184, -1254 },
- { 1782, 3363, -6222, -1381 },
- { 572, 4650, -5673, -2754 },
- { 2674, 3414, -4460, -2154 },
- { 3614, 3820, -6883, -398 },
- { 1136, -1, -5511, -1112 },
- { -1773, 1137, -5647, -2377 },
- { -753, 2104, -6085, -2565 },
- { -204, 3025, -4731, -1418 },
- { -1486, 1438, -4380, -216 },
- { 302, 858, -5786, -264 },
- { 3486, 1495, -5234, -783 },
- { 888, 2327, -3423, -3720 },
- { -259, 772, -6596, -1311 },
- { -1197, 2073, -5174, -1826 },
- { 1500, 3470, -4462, -2645 },
- { 3072, 1960, -3277, -2264 },
- { 1841, 952, -4324, -2340 },
- { 1994, 2200, -3940, -2923 },
- { -1782, 1699, -4667, -1075 },
- { -1464, 2906, -3468, -375 },
- { 366, 2380, -3747, 1467 },
- { -545, 1645, -4619, 376 },
- { 1724, 2350, -2374, -3512 },
- { 3184, 2628, -2996, -3275 },
- { 734, 2010, -6239, -1479 },
- { 524, 3756, -4496, -3263 },
- { 1492, 3570, -3494, -3600 },
- { -932, 618, -5389, -2894 },
- { -133, 2161, -4083, -3267 },
- { 786, 774, -3279, -3731 },
- { 1078, 803, -3843, -3007 },
- { -332, 3405, -3347, 40 },
- { -17, 6, -4005, -3690 },
- { -189, 4372, -4488, -2561 },
- { -450, 3846, -3790, -1370 },
- { 362, 2212, -5272, -15 },
- { -1529, 791, -6802, -2296 },
- { 2145, 4241, -4474, 376 },
- { 1813, 2426, -2932, -2726 },
- { -542, 4557, -3140, -1080 },
- { 1192, 3784, -4371, -20 },
- { 2784, 5188, -6399, -1394 },
- { 431, 4561, -3673, -1398 },
- { 1382, 3096, -4083, 1253 },
- { 1209, 4224, -2930, 1500 },
- { 2798, 2684, -6676, -606 },
- { -2396, 1510, -5381, -2713 },
- { -2625, 2542, -4032, -2880 },
- { -1231, 3967, -4098, -2886 },
- { -1393, 2374, -3862, -4525 },
- { -2495, 1665, -1637, -5445 },
- { -3854, 1759, -1750, -4944 },
- { -2373, 1668, -2856, -6251 },
- { -2668, 1981, -886, -4557 },
- { -2927, 4427, -3451, -6172 },
- { -1925, 2596, -4696, -2527 },
- { -3202, 2847, -3928, -5896 },
- { -3332, 1665, -5025, -3412 },
- { -3212, 3115, -4155, -4062 },
- { -1013, 3205, -5133, -3751 },
- { -2022, 4595, -3947, -5611 },
- { -3556, 1755, -3715, -2300 },
- { -1784, 4114, -2723, -1773 },
- { -3586, 4081, -2733, -4942 },
- { -1608, 3685, -4154, -4573 },
- { -3368, 4042, -4452, -6227 },
- { -1407, 3881, -5729, -3719 },
- { -2751, 3281, -5077, -4999 },
- { -3791, 2410, -4906, -5288 },
- { -730, 2303, -4217, -3755 },
- { -1812, 2311, -5492, -3709 },
- { -610, 4336, -3915, -3783 },
- { -2841, 4337, -4278, -4430 },
- { -1662, 4666, -4661, -3964 },
- { -589, 5209, -4923, -3682 },
- { -4155, 2234, -4076, -4218 },
- { -3951, 2770, -2665, -2805 },
- { -2302, 3228, -3717, -1908 },
- { -3129, 4373, -2264, -2851 },
- { -447, 1363, -3578, -4323 },
- { -2648, 4237, -3159, -3071 },
- { -4072, 3241, -3541, -4605 },
- { -4507, 3458, -2339, -3838 },
- { -1646, 997, -4926, -3970 },
- { -3025, 1614, -3940, -1242 },
- { -1337, 1756, -3163, -5529 },
- { -3203, 1865, -3282, -4354 },
- { -1646, 2118, -2203, -6018 },
- { 174, 1871, -2707, -4639 },
- { -2607, 1485, -4778, -4750 },
- { -2199, 3991, -3134, -4879 },
- { -2962, 3323, -2816, -2419 },
- { -5286, 2495, -4548, -5395 },
- { -2810, 3710, -2274, -4211 },
- { -330, 3006, -2993, -4678 },
- { -1187, 2411, -2743, -5196 },
- { -664, 4033, -3101, -5641 },
- { -1458, 3602, -2816, -5371 },
- { -4116, 4923, -3321, -5630 },
- { -4165, 2528, -2592, -4798 },
- { -2759, 3080, -2333, -5719 },
- { -5157, 3011, -5526, -6348 },
- { -3095, 2126, -5881, -4234 },
- { -4377, 3849, -3600, -6099 },
- { -1994, 4947, -5235, -4753 },
- { -1067, 600, -3258, -5133 },
- { -4992, 3302, -2208, -5051 },
- { -3377, 2981, -1655, -4815 },
- { -3325, 2446, -1787, -6116 },
- { -2341, 2737, -3240, -6347 },
- { -2258, -3732, 3710, -1235 },
- { -1558, -3849, 2694, -3012 },
- { -599, -4837, 3050, -2951 },
- { -2246, -5433, 2798, -1910 },
- { -2255, -4989, 3260, 270 },
- { -3026, -5353, 2693, -1036 },
- { -1151, -6097, 1097, -3782 },
- { -3391, -6012, 2130, -1303 },
- { -2850, -4422, 3375, -480 },
- { -1138, -3779, 1491, -4162 },
- { -551, -3892, 3787, -2082 },
- { -3221, -3676, 3144, -1202 },
- { -3023, -5196, 2650, 605 },
- { -1756, -5729, 2646, 321 },
- { -2693, -4409, 494, -4797 },
- { -1913, -4573, 3372, -1730 },
- { -1277, -3604, 4061, -993 },
- { -420, -4993, 1351, -4796 },
- { -3052, -5333, 1435, -1242 },
- { -602, -5034, 3869, -1141 },
- { -2436, -4680, 1665, -3019 },
- { -2657, -3658, 1459, -3391 },
- { -1220, -6246, 2749, -525 },
- { -3838, -4844, 2265, -1735 },
- { -1247, -5679, 3356, -1417 },
- { -917, -5448, 3342, 105 },
- { -1756, -6839, 2276, -2350 },
- { -412, -5206, 1764, -3539 },
- { -1439, -6915, 1442, -3750 },
- { -1381, -4439, 3863, -282 },
- { -3482, -4953, 2726, -336 },
- { -1376, -5931, 1714, -1987 },
- { -1716, -4405, 2608, 105 },
- { -1590, -5191, 2652, -2704 },
- { -2149, -6442, 2453, -1263 },
- { -3426, -3832, 2334, -1829 },
- { -2747, -5948, 2362, -173 },
- { -2435, -3267, 2966, -1710 },
- { -3979, -4282, 2705, -775 },
- { -356, -4238, 2544, -4343 },
- { -1363, -6471, 2817, -1836 },
- { -2878, -5117, 218, -3149 },
- { -3539, -5196, 1710, -2356 },
- { -2888, -4537, 2746, -1701 },
- { -1870, -4439, 1496, -4121 },
- { -1486, -3388, 3349, -2145 },
- { -3333, -4138, 1467, -2876 },
- { -345, -5340, 1012, -1190 },
- { -1672, -4992, 2289, -1029 },
- { -2146, -5528, 3038, -635 },
- { -316, -3656, 3426, -3152 },
- { -2695, -5812, 2336, -2050 },
- { -2067, -6052, 737, -3258 },
- { -2664, -4205, -350, -1266 },
- { -617, -5406, 80, -4853 },
- { -2418, -3825, 1853, -1326 },
- { -1961, -4339, 583, -4315 },
- { -1495, -5141, -133, -5205 },
- { -3208, -6440, 1691, -2069 },
- { -2632, -3633, 2325, -2761 },
- { -2624, -5670, 1252, -3676 },
- { -3687, -5608, 687, -2833 },
- { -3320, -5707, 16, -3877 },
- { -2738, -6112, 84, -5135 },
- { 2277, -5661, 3076, 843 },
- { 1555, -5769, 2821, -5236 },
- { 536, -6381, 603, -4910 },
- { 734, -4609, 3314, -4092 },
- { 1836, -4547, 3267, -4322 },
- { -13, -5976, 3752, -1607 },
- { 1423, -6318, 2336, 398 },
- { 365, -7779, 1498, -534 },
- { 2104, -8366, 2946, -1345 },
- { 143, -5545, 1898, -3756 },
- { 655, -6852, 1430, 148 },
- { 4, -6653, 2397, -59 },
- { 2346, -5996, 4562, -934 },
- { 1229, -7104, 2963, -598 },
- { -528, -7048, 2887, -1790 },
- { 1451, -6857, 3900, -1637 },
- { 554, -6018, 3336, 9 },
- { 3278, -5758, 4034, 129 },
- { 3541, -7145, 4905, -1575 },
- { 2339, -6907, 3464, -301 },
- { 2775, -7301, 1667, -3894 },
- { 539, -7887, 991, -4156 },
- { 2115, -7421, 3131, -3075 },
- { 2803, -8546, 2564, -5836 },
- { 2869, -5833, 1620, -4561 },
- { 2591, -7281, 3215, -4719 },
- { -1228, -8477, 706, -4782 },
- { 1967, -5243, 4813, -1940 },
- { 701, -7010, 2273, -3893 },
- { 915, -8470, 1918, -5620 },
- { -94, -6715, 156, -3873 },
- { 1074, -5607, 4389, -1017 },
- { 2739, -6551, 1227, -3521 },
- { 725, -7835, 2701, -1291 },
- { -493, -7475, 2263, -1075 },
- { -412, -6508, 2984, -744 },
- { 665, -5451, 3725, -2692 },
- { 1499, -8129, 3564, -2072 },
- { 2870, -6333, 4487, -2108 },
- { 706, -5007, 3911, -152 },
- { -482, -8660, 1483, -2900 },
- { 2481, -6596, 2518, -1715 },
- { 1403, -6414, 1398, -5387 },
- { 652, -6267, 583, -5942 },
- { 694, -7540, 646, -6272 },
- { 2275, -7614, 256, -5015 },
- { 1416, -9727, 1900, -3153 },
- { 2760, -6433, 3875, -3771 },
- { 2325, -11196, 2182, -5155 },
- { 1223, -11061, 1377, -5097 },
- { 108, -10603, 307, -4952 },
- { -118, -8268, 1650, -1572 },
- { 1839, -7943, 1755, -612 },
- { 2501, -9056, 981, -2969 },
- { 2902, -8476, 1491, -5780 },
- { 1995, -11175, 1585, -3643 },
- { 696, -8212, 828, -2474 },
- { 1526, -8649, 1380, -1210 },
- { 461, -7253, 3222, -2229 },
- { 2966, -8641, 4121, -3271 },
- { 833, -6039, 2361, -1086 },
- { 3565, -7312, 1980, -5427 },
- { 2850, -8671, 3760, -1846 },
- { 2643, -7281, 2163, -173 },
- { 3463, -3706, -3132, -923 },
- { 1315, -3825, -3443, 2 },
- { 2594, -4083, -3815, 670 },
- { 1826, -4291, -2741, -155 },
- { 868, -3749, -4175, -298 },
- { 2008, -4237, -3897, -517 },
- { 1242, -3493, -4335, -1335 },
- { -88, -4142, -3390, -1529 },
- { 2176, -3488, -3822, -975 },
- { 1706, -5188, -3415, -637 },
- { 2717, -6159, -2333, -882 },
- { 1276, -3978, -4361, 537 },
- { 2471, -5556, -2866, -208 },
- { 799, -4673, -4086, 56 },
- { 1901, -4786, -3533, 270 },
- { 3036, -3902, -3606, -333 },
- { 2249, -3317, -4319, -144 },
- { 2594, -4207, -2105, -2930 },
- { 4008, -4774, -2626, -902 },
- { 1038, -3659, -3496, -2454 },
- { 2725, -3597, -3298, -1535 },
- { 1662, -5803, -2813, 175 },
- { 705, -3757, -3441, -1484 },
- { 1860, -5987, -2821, -886 },
- { 3786, -4918, -2199, -1929 },
- { 3683, -4235, -2547, -1287 },
- { 2531, -4896, -2956, -1593 },
- { 1005, -5585, -3324, -180 },
- { 1625, -5229, -1756, -3642 },
- { 1494, -5041, -2989, -2685 },
- { 2718, -4655, -3224, -867 },
- { 2374, -6640, -1745, -2975 },
- { 2133, -6436, -2477, -1499 },
- { 1833, -4418, -3523, -1512 },
- { 1128, -4910, -2658, -1106 },
- { 689, -4777, -2831, -2085 },
- { 3593, -5280, -2627, -315 },
- { 3264, -3771, -2673, -1861 },
- { 3202, -5602, -2409, 402 },
- { 552, -4618, -2221, -3002 },
- { 3095, -5356, -2666, -1083 },
- { 3401, -4609, -3146, 45 },
- { 3051, -4662, -2192, -2232 },
- { 2798, -5552, -2462, -1941 },
- { 2354, -5815, -2223, -2619 },
- { 192, -3708, -2807, -2658 },
- { 1886, -4226, -1862, -3529 },
- { 2526, -3976, -2819, -2332 },
- { 1577, -3870, -2711, -2806 },
- { 1288, -5588, -3382, -1403 },
- { 2711, -5399, -1564, -3253 },
- { 1459, -5492, -2222, -322 },
- { 2823, -5091, -2886, 776 },
- { 3559, -5821, -2109, -1360 },
- { 1587, -6331, -2760, -1909 },
- { 2139, -5213, -2874, -2120 },
- { 1318, -4337, -3695, -2098 },
- { 821, -4471, -1849, -565 },
- { 3329, -4782, -1725, -89 },
- { 582, -4914, -4105, -1119 },
- { 417, -4144, -4072, -2529 },
- { -199, -3803, -2765, -4042 },
- { 2731, -4283, -2143, 1 },
- { 2911, -6187, -1951, -2116 },
- { 1573, -6094, -493, -2838 },
- { 2081, -6927, -864, -3211 },
- { 1058, -7826, 79, -364 },
- { 3147, -5570, -684, -978 },
- { 3572, -5856, 1060, 1824 },
- { 1143, -6702, -1478, 338 },
- { 2341, -7220, -88, 260 },
- { 3639, -6861, 668, 815 },
- { 2227, -6268, -1706, 446 },
- { 3390, -6082, -353, 1302 },
- { 1123, -7556, -1237, -430 },
- { 1729, -7742, 729, -218 },
- { 1457, -6774, 587, 579 },
- { 505, -6919, -569, 371 },
- { 1106, -7245, 78, 158 },
- { 2755, -6745, -1122, 338 },
- { 3069, -6040, -1415, 986 },
- { 2174, -7064, -1430, -283 },
- { 1390, -8626, -446, -3031 },
- { 3534, -6890, -431, 547 },
- { 2267, -9618, 475, -2994 },
- { 3672, -7673, 75, -115 },
- { 2131, -7560, -1206, -750 },
- { 2972, -7477, -685, -262 },
- { 1604, -6637, -672, 699 },
- { 1666, -7577, -577, -240 },
- { 1591, -6554, -2158, -94 },
- { 2348, -6286, -353, 1123 },
- { 2017, -8810, -412, -1805 },
- { 2892, -6713, -1765, -554 },
- { 2500, -6828, -1995, -1197 },
- { 3877, -6639, -224, -1655 },
- { 2392, -7872, -91, -333 },
- { 3562, -7370, -532, -2836 },
- { 2552, -7614, 164, -1805 },
- { 990, -6104, 218, 438 },
- { 910, -7861, 312, -1195 },
- { 1472, -6327, 372, -640 },
- { 1576, -7143, -1983, -843 },
- { 422, -7625, -457, -278 },
- { 1797, -8532, 405, -1011 },
- { 1088, -7396, -238, -2277 },
- { 3209, -6753, -1431, -2072 },
- { 2617, -6839, 100, -2573 },
- { 2575, -8573, -387, -3188 },
- { 3618, -6971, -1190, -321 },
- { 2205, -7361, -1695, -2008 },
- { 2985, -6297, 1464, 1179 },
- { 2804, -7310, 1053, 338 },
- { 1362, -6074, -1163, -840 },
- { 3336, -6325, -1794, 21 },
- { 2836, -8109, 818, -329 },
- { 2791, -5879, 560, 1546 },
- { 2392, -6064, 135, 100 },
- { 1838, -6194, 596, 1085 },
- { 1926, -7515, -414, -4901 },
- { 3225, -7298, -1202, -1189 },
- { 3960, -7558, -659, -719 },
- { 3442, -6647, -1692, -1095 },
- { 3381, -6441, 262, -886 },
- { 1431, -8150, -1186, -1406 },
- { 340, -8498, -150, -899 },
- { 3004, -8149, -260, -953 },
- { 2749, -6611, 563, 873 },
- { -6647, -1325, -4517, -4691 },
- { -6005, -1657, -4089, -3797 },
- { -3157, 588, -5213, -3068 },
- { -3311, -1425, -6329, -3726 },
- { -5866, -819, -3857, -2744 },
- { -5001, -1799, -1075, -4621 },
- { -5330, -2650, -2672, -4664 },
- { -4930, -539, -2363, -4010 },
- { -2984, 10, -3863, -5749 },
- { -1055, -2106, -3713, -4267 },
- { -5476, -502, -4279, -6504 },
- { -5231, -1543, -5018, -6425 },
- { -5134, -363, -3165, -5109 },
- { -3953, -771, -4107, -6393 },
- { -2159, -563, -3652, -5342 },
- { -3888, -2321, -919, -5057 },
- { -1236, -597, -4235, -4193 },
- { -4053, 675, -3083, -6174 },
- { -2793, -1089, -5396, -3460 },
- { -3000, -44, -2209, -6575 },
- { -3336, -1531, -4313, -5160 },
- { -2127, 128, -4851, -3692 },
- { -3321, 136, -2067, -5660 },
- { -5215, 1404, -4374, -4356 },
- { -2747, 400, -6340, -3691 },
- { -3926, -599, -5361, -5006 },
- { -2875, -2592, -5143, -4092 },
- { -4991, -1958, -5322, -4891 },
- { -4965, -1318, -6652, -5333 },
- { -4920, -1691, -3388, -5561 },
- { -3644, -3354, -2688, -5982 },
- { -5076, -919, -4563, -2984 },
- { -6114, 250, -3884, -3915 },
- { -4014, 744, -3973, -1924 },
- { -5543, -1041, -5557, -3847 },
- { -4711, -1352, -5649, -2603 },
- { -3362, 775, -5305, -4879 },
- { -5001, 107, -3554, -2888 },
- { -6258, -1651, -6356, -6566 },
- { -4529, 407, -5003, -3865 },
- { -5154, 550, -5278, -5465 },
- { -4195, -467, -1894, -3129 },
- { -5022, 1127, -3349, -3314 },
- { -6075, 1250, -4313, -5641 },
- { -2677, -2283, -2312, -5903 },
- { -4113, 193, -1195, -4833 },
- { -3940, -1048, -1389, -5079 },
- { -3703, 917, -4043, -4451 },
- { -3366, -4231, -1534, -5488 },
- { -3326, -3583, -2091, -4903 },
- { -5144, 1254, -2532, -4949 },
- { -5982, -870, -2545, -4555 },
- { -3925, -157, -5367, -2281 },
- { -6419, -746, -5668, -4371 },
- { -5787, 518, -7096, -5805 },
- { -4258, 954, -6453, -4321 },
- { -4771, -695, -4158, -1639 },
- { -7078, -760, -5195, -5877 },
- { -7348, 83, -4101, -4586 },
- { -2430, 184, -2874, -1679 },
- { -2284, -3943, -2924, -5034 },
- { -1804, -1785, -3002, -4710 },
- { -4399, -2772, -1815, -4637 },
- { -6340, -2626, -2824, -5191 },
- { -4998, -5168, -3480, 1905 },
- { -3958, -5492, -1599, 1579 },
- { -2471, -3755, -276, 3182 },
- { -3033, -5779, -1063, 1554 },
- { -2936, -4829, -1290, 2386 },
- { -1835, -5073, -3051, 1299 },
- { -1724, -3771, -3935, 2324 },
- { -5070, -2550, -3692, 768 },
- { -4326, -5333, -297, 1878 },
- { -3472, -5619, -3094, 992 },
- { -3027, -4384, -3038, 2265 },
- { -3201, -5332, 67, 2200 },
- { -1681, -4373, -1947, 2461 },
- { -3221, -3329, -4238, 2564 },
- { -1262, -2968, -2915, 3227 },
- { -3419, -1878, -3373, 2110 },
- { -2244, -5583, -2012, 1288 },
- { -1971, -5266, -990, 1812 },
- { -2975, -2778, -452, 4063 },
- { -2198, -1165, -3298, 2965 },
- { -4782, -4894, -4767, 664 },
- { -6002, -3950, -2806, 2025 },
- { -3142, -3162, -2859, 3295 },
- { -3262, -3340, -4123, 1596 },
- { -4014, -3918, -1955, 3361 },
- { -1700, -3463, -1346, 3449 },
- { -4245, -4445, -4743, 1644 },
- { -4180, -3969, -401, 3281 },
- { -2782, -5240, -4117, 1156 },
- { -5744, -4040, -1439, 3470 },
- { -5063, -4663, -323, 3172 },
- { -4531, -3319, -844, 3988 },
- { -6226, -5125, -2064, 2976 },
- { -3115, -3267, -1531, 3898 },
- { -4628, -4421, -2864, 2808 },
- { -4559, -2989, -3442, 2024 },
- { -1775, -4487, -656, 2477 },
- { -2664, -1865, -1884, 4081 },
- { -1828, -2575, -3894, 3378 },
- { -6441, -3677, -2025, 1677 },
- { -4141, -2156, -1191, 3474 },
- { -4802, -1623, -1727, 2160 },
- { -5474, -2745, -1475, 2498 },
- { -3664, -1056, -1975, 2491 },
- { -4672, -3062, -2235, 2933 },
- { -4205, -5960, -2849, 1517 },
- { -4995, -5708, -1739, 1805 },
- { -4892, -6080, -4793, 872 },
- { -4270, -4172, -4263, 2185 },
- { -4687, -1470, -2905, 1023 },
- { -6446, -5017, -3919, 1000 },
- { -6046, -5538, -3943, 2006 },
- { -6028, -3750, -3953, 771 },
- { -5959, -4582, -5024, 824 },
- { -5818, -2576, -2249, 1326 },
- { -5659, -5345, -1119, 2500 },
- { -3346, -4155, 606, 2749 },
- { -5680, -4827, -2501, 1838 },
- { -6193, -2543, -1295, 840 },
- { -6871, -4925, -3512, 1801 },
- { -5605, -1788, -1895, 779 },
- { -3922, -5712, -4644, 510 },
- { -4745, -3869, -4533, 99 },
- { -2984, -4907, -399, 1497 },
- { 1847, -478, 3061, -5812 },
- { 4450, -1116, 3609, -6570 },
- { 3139, 99, 3007, -5532 },
- { 2590, -3782, 3138, -4770 },
- { 1881, 1204, 5778, -3404 },
- { 3631, 2060, 5566, -5038 },
- { 3461, 1961, 5167, -3800 },
- { 2947, 273, 4536, -4389 },
- { 4453, -1730, 5788, -4370 },
- { 4032, 1805, 2666, -4534 },
- { 3487, -944, 2313, -6028 },
- { 1313, 34, 4210, -4067 },
- { 5632, -1502, 5825, -5855 },
- { 7736, -547, 4879, -5476 },
- { 4906, -1512, 4760, -5760 },
- { 3843, 447, 1091, -4958 },
- { 2982, -1135, 5442, -4386 },
- { 3579, 271, 3031, -6770 },
- { 3932, -211, 4688, -5507 },
- { 4411, 1720, 2387, -5584 },
- { 5379, -479, 4575, -6280 },
- { 3613, -362, 2012, -4885 },
- { 3744, -2013, 4493, -5073 },
- { 5693, 109, 4379, -3362 },
- { 5475, -621, 5317, -3985 },
- { 6411, -673, 5708, -4752 },
- { 4933, -796, 7262, -4290 },
- { 2804, 444, 6276, -3655 },
- { 4120, -517, 6078, -4531 },
- { 5119, 841, 3486, -3910 },
- { 4738, 1539, 3525, -2970 },
- { 5086, 370, 5895, -5640 },
- { 4235, 2716, 4589, -5044 },
- { 3691, 682, 6199, -4700 },
- { 6111, -570, 6271, -6528 },
- { 2611, 1277, 3756, -4802 },
- { 4395, 970, 3807, -5879 },
- { 5225, 2299, 3242, -4333 },
- { 5144, 1778, 4946, -5545 },
- { 2989, -3016, 3247, -5495 },
- { 2983, 920, 2071, -6059 },
- { 5270, -903, 4434, -2350 },
- { 6415, -585, 3970, -3554 },
- { 3866, -197, 5216, -2884 },
- { 3767, -1298, 6702, -3315 },
- { 6299, 2620, 5284, -6824 },
- { 6654, 646, 3653, -4927 },
- { 4770, 3047, 5160, -6287 },
- { 5364, 434, 2919, -5207 },
- { 2998, 1344, 4801, -2456 },
- { 3896, 1013, 3773, -1864 },
- { 2115, 655, 2999, -6344 },
- { 5170, -981, 2849, -4464 },
- { 2735, -2159, 2717, -5776 },
- { 2430, -1952, 4392, -4559 },
- { 6143, -1180, 3659, -4746 },
- { 4978, -1483, 1726, -4875 },
- { 3486, -2383, 3306, -4301 },
- { 1434, -1372, 4171, -4770 },
- { 3354, -2627, 1525, -5093 },
- { 6790, 2386, 3995, -5909 },
- { 1475, -2674, 3451, -4204 },
- { 1999, -3494, 3693, -5556 },
- { 4764, -2848, 2856, -5589 },
- { -3677, 5131, 2827, -2934 },
- { -2844, 7078, 2852, -3580 },
- { -3902, 6434, 4118, -1911 },
- { -1769, 7530, 3492, -3541 },
- { -1937, 5679, -447, -1127 },
- { -2456, 4680, 4196, -2407 },
- { -2778, 8241, 1698, -4288 },
- { -2876, 6104, 5182, -2387 },
- { -2802, 7341, 4463, -2938 },
- { -1025, 6267, 4752, -3201 },
- { -2349, 5413, 2041, -3794 },
- { -2252, 8225, 2856, -4269 },
- { -1465, 4967, 4976, -2500 },
- { -636, 7565, 3517, -4233 },
- { -1905, 5618, 3904, -2942 },
- { -302, 6816, 3343, -3316 },
- { -2210, 4156, 2817, -3511 },
- { -717, 6568, 1863, -2951 },
- { -3873, 5682, 2164, -575 },
- { -2878, 5835, 440, -2597 },
- { -3228, 7701, 2610, -2514 },
- { -3608, 8888, 3377, -2468 },
- { -2582, 9717, 2519, -3126 },
- { -5238, 6202, 2866, -2831 },
- { -3428, 7370, 3056, -335 },
- { -1681, 8836, 1210, -2010 },
- { -3276, 6724, 1156, -3930 },
- { -894, 8149, 827, -1258 },
- { -2965, 8631, 2549, -1320 },
- { -3961, 6902, 3581, 55 },
- { -1894, 7745, 1750, -841 },
- { -821, 6844, 850, -676 },
- { -608, 6948, -4, -1376 },
- { 615, 6524, 1089, -1147 },
- { -2972, 5668, 1091, -489 },
- { -157, 4649, 2904, -413 },
- { 673, 5121, 1498, -66 },
- { -390, 5902, 1611, -245 },
- { -2349, 5478, 4772, -1320 },
- { 88, 6798, 1972, -1859 },
- { -1213, 5120, 2991, 200 },
- { -2347, 6040, 2839, 376 },
- { -578, 5976, 3364, -1796 },
- { -1391, 5872, 3002, -965 },
- { -564, 4496, 3946, -1186 },
- { -2299, 6386, 3135, -2176 },
- { -2131, 5641, 2011, 1223 },
- { -772, 5807, 1124, 895 },
- { -2837, 6758, 2297, -740 },
- { -3091, 6298, 1415, -2126 },
- { -4197, 6036, 1843, -3022 },
- { -41, 6459, 92, 344 },
- { -2241, 6860, 2095, -4396 },
- { -1931, 7088, 2117, -2135 },
- { -2375, 4422, 1688, -3169 },
- { -1742, 6674, 1538, -119 },
- { -4818, 7749, 4192, -1577 },
- { -2004, 5672, 193, -430 },
- { -3825, 6042, 2128, -1898 },
- { -1108, 8033, 2119, -3013 },
- { -2370, 5453, 1721, 266 },
- { -1570, 7134, 614, -2638 },
- { -1519, 8752, 3503, -4330 },
- { -2050, 3845, 2907, -1126 },
- { 5085, 4412, -335, -1923 },
- { 3618, 1423, -613, -4012 },
- { 4481, 3729, 589, -4631 },
- { 4270, 3216, -1763, -3168 },
- { 4241, 1796, -1701, -2796 },
- { 4787, 2338, -487, -3639 },
- { 2915, 3429, -621, -4753 },
- { 5175, 1660, -1265, -3223 },
- { 4280, 4057, -684, -4079 },
- { 4980, 4419, -1455, -2719 },
- { 5436, 2464, 387, -4197 },
- { 4507, 4018, 1121, -3314 },
- { 6020, 2401, -413, -3201 },
- { 4200, 3789, -333, -2813 },
- { 5229, 2493, -1194, -1878 },
- { 5851, 2695, -492, -2292 },
- { 5743, 3288, -697, -1221 },
- { 5692, 2612, 979, -2227 },
- { 5085, 2067, 1046, -1214 },
- { 3163, 2240, -2098, -3435 },
- { 5228, 1898, 145, -2397 },
- { 5860, 3976, -418, -2872 },
- { 6008, 3399, 1027, -3506 },
- { 4126, 2035, 1865, -893 },
- { 5375, 3596, 511, -2362 },
- { 1937, 1493, -852, -122 },
- { 3473, 4849, 547, -2603 },
- { 4631, 2977, 1141, -1768 },
- { 6149, 3050, -71, -1886 },
- { 4069, 4353, -289, -1429 },
- { 2884, 1225, -1388, 365 },
- { 5485, 2518, -235, -571 },
- { 1216, 4375, 1443, 398 },
- { 4988, 3106, 107, -1435 },
- { 4511, 2801, 307, -444 },
- { 3235, 4386, 327, -676 },
- { 2055, 3708, 1657, -305 },
- { 5839, 2374, 290, -1385 },
- { 5110, 3305, 1936, -4206 },
- { 6416, 2920, 338, -2736 },
- { 3350, 2824, -1269, -3881 },
- { 4840, 1815, 464, 186 },
- { 2399, 3332, 238, 1238 },
- { 3516, 1363, 1582, 688 },
- { 3582, 1874, 154, -4770 },
- { 3261, 2878, 886, 283 },
- { 3877, 2658, -327, 884 },
- { 4151, 3436, 2173, -2923 },
- { 3592, 3674, 1281, -1295 },
- { 4561, 3730, -1114, -1747 },
- { 4595, 3625, -558, -575 },
- { 2577, 2348, 2267, 120 },
- { 5242, 3299, 32, -3412 },
- { 4264, 3637, 709, -2320 },
- { 6556, 3570, -838, -2472 },
- { 5745, 4014, -940, -1973 },
- { 5629, 4475, 477, -3328 },
- { 5269, 3199, 1682, -3085 },
- { 4432, 2416, 1145, -3299 },
- { 4465, 2505, 2162, -2186 },
- { 4643, 4941, -88, -2885 },
- { 4568, 5231, 552, -3915 },
- { 5667, 3075, -1406, -2963 },
- { 5418, 5259, -771, -2818 },
- { -256, -7875, 511, -471 },
- { -1813, -7971, -424, -396 },
- { -306, -7006, 862, 282 },
- { -2306, -6422, -1440, 508 },
- { -245, -6787, 375, -100 },
- { -1309, -6065, -20, 779 },
- { -1656, -6047, -641, 1307 },
- { -1496, -6522, 964, 726 },
- { -2291, -6588, -202, 795 },
- { -762, -7522, 1454, -558 },
- { -2270, -7004, -834, -580 },
- { -1139, -7078, 259, 362 },
- { -2535, -7568, -1040, 49 },
- { -3786, -7280, 934, -476 },
- { -3336, -6368, 606, 1056 },
- { -3602, -6924, 52, 714 },
- { -2278, -6550, 1674, 204 },
- { -2855, -5765, 930, 1530 },
- { -2889, -7325, -215, 305 },
- { -2749, -6080, -237, 1452 },
- { -985, -6667, 1577, 400 },
- { -2036, -6083, 380, 1267 },
- { -2077, -7460, 380, -30 },
- { -1775, -7175, 1540, -386 },
- { -3065, -6927, 989, 168 },
- { -2836, -7602, 117, -3392 },
- { -1058, -6396, 593, -3078 },
- { -844, -6062, 999, -236 },
- { -3261, -6951, 1491, -720 },
- { -2186, -8484, 75, -1287 },
- { -2882, -7756, 456, -510 },
- { -1800, -6879, 960, -1183 },
- { -2554, -7241, 1614, -1474 },
- { -2608, -5305, 392, 851 },
- { -2973, -6562, -859, 858 },
- { -2640, -5989, 1031, -416 },
- { -977, -8366, 705, -1434 },
- { -1213, -7409, -77, -1390 },
- { -1335, -6657, 2125, -123 },
- { -2544, -6862, 1852, -737 },
- { -3235, -6422, 1752, -103 },
- { -1300, -7557, 939, -348 },
- { -3476, -7579, 202, -109 },
- { -2482, -6572, 753, 619 },
- { -2554, -8136, -648, -429 },
- { -1012, -7870, -3, -421 },
- { -3604, -6247, 32, -3102 },
- { -1486, -7271, 2013, -1021 },
- { -578, -6799, -523, 405 },
- { -2841, -5948, 1644, 911 },
- { -2411, -7473, 1084, -484 },
- { -2238, -6033, 294, -1059 },
- { -3459, -6470, -201, -790 },
- { -2027, -6009, 1833, 805 },
- { -1433, -8047, 1531, -1754 },
- { -3258, -7884, 763, -1422 },
- { -1544, -6928, -729, 478 },
- { -2314, -8415, 74, -3757 },
- { -3201, -5684, 95, -2214 },
- { -2423, -8694, 725, -3631 },
- { -3545, -7071, 1162, -1798 },
- { -294, -9662, 403, -2274 },
- { -2290, -5460, 1196, 402 },
- { -1603, -6713, 903, -2363 },
- { 4121, 2491, -3142, -2482 },
- { 4500, 3305, -3671, -1567 },
- { 5973, 3172, -1348, -534 },
- { 4830, 3379, -1549, 643 },
- { 5214, 3938, -2641, -2302 },
- { 4639, 4826, -5532, -847 },
- { 5639, 2731, -2170, -963 },
- { 6084, 3487, -3525, -1346 },
- { 5971, 3154, -2190, -2316 },
- { 5618, 4865, -6927, 116 },
- { 5345, 3568, -7391, 709 },
- { 5429, 5078, -3811, -1524 },
- { 6960, 2037, -3515, -1096 },
- { 7092, 2531, -4557, -588 },
- { 6061, 4247, -5651, -478 },
- { 4595, 3684, -4907, -827 },
- { 7497, 3213, -3048, -424 },
- { 5996, 2137, -3098, -1745 },
- { 6198, 5199, -2223, -2274 },
- { 6888, 2851, -2768, -1675 },
- { 6114, 4210, -2316, -954 },
- { 7127, 4242, -3041, -1408 },
- { 6126, 3668, -1517, -1427 },
- { 6245, 6129, -4225, -1186 },
- { 6816, 3213, -2101, -964 },
- { 5345, 5276, -2643, -847 },
- { 6592, 4665, -4338, 484 },
- { 6746, 3751, -3443, 124 },
- { 5453, 1980, -2738, 2606 },
- { 4662, 2179, -4226, -1059 },
- { 5571, 3208, -3554, 174 },
- { 5256, 4447, -1815, -1481 },
- { 5400, 2570, -1210, 235 },
- { 7056, 2549, -2674, 318 },
- { 4574, 4340, -2892, -130 },
- { 6203, 4587, -3273, -305 },
- { 5103, 1925, -2715, -2137 },
- { 3905, 4296, -1700, 247 },
- { 4421, 4605, -3299, 811 },
- { 5671, 1273, -3870, -924 },
- { 5486, 1805, -4901, 133 },
- { 6437, 2578, -1828, -106 },
- { 5530, 5253, -5058, 1223 },
- { 4816, 2025, -1215, 1443 },
- { 3457, 3525, -2456, 3217 },
- { 3316, 2595, -1108, 2459 },
- { 3068, 3810, -2207, 1926 },
- { 6351, 5436, -6470, 600 },
- { 6324, 4240, -5365, 2416 },
- { 4851, 4774, -4075, 1878 },
- { 4900, 3679, -5198, 1078 },
- { 8347, 3633, -4565, -171 },
- { 5244, 5718, -3853, 173 },
- { 3960, 3492, -2939, 2105 },
- { 6070, 3473, -2351, 161 },
- { 8228, 3034, -3360, -901 },
- { 7006, 3985, -1940, -1926 },
- { 7123, 4681, -4301, -878 },
- { 5122, 4097, -1851, -449 },
- { 6200, 2060, -2251, 1049 },
- { 7106, 3844, -7209, 2625 },
- { 7108, 3370, -6734, 533 },
- { 6859, 2849, -3992, 1360 },
- { 5458, 2278, -3253, 1131 },
- { -1072, -2109, 4783, -1073 },
- { -319, -2604, 4257, -2418 },
- { 2466, 1300, 3476, -314 },
- { 2847, -1502, 5296, -141 },
- { 1667, -1273, 5559, -2725 },
- { 2877, -3402, 6434, 204 },
- { 53, -2637, 5275, -1181 },
- { 1091, -2215, 5803, -1549 },
- { 2397, -922, 4327, 1182 },
- { 219, -3747, 4647, -1564 },
- { -29, -2705, 4812, 1277 },
- { 1499, -2608, 5648, 1407 },
- { 2139, -2399, 4202, 2791 },
- { -426, -2064, 5528, 151 },
- { 2560, -2803, 6179, -2806 },
- { 4537, -2479, 3797, 1095 },
- { 888, -3357, 5341, -415 },
- { 4460, -1814, 5388, -1227 },
- { 3920, -3268, 6364, -703 },
- { 3343, -4698, 4410, 784 },
- { 309, -1897, 6306, 1223 },
- { 958, -3318, 4254, -3167 },
- { -99, 1596, 6018, -1983 },
- { -429, -853, 6407, 878 },
- { 1170, -1322, 6290, -417 },
- { 2288, -505, 6303, -1999 },
- { 3312, -1674, 6749, -2494 },
- { -415, -3401, 4721, -371 },
- { -189, -1210, 4844, -2002 },
- { 888, -4142, 4377, 130 },
- { 2469, -4381, 5398, -2492 },
- { 2879, -2912, 5094, -2598 },
- { -717, -617, 5650, -685 },
- { 1470, -3863, 5352, -1684 },
- { 3935, -96, 3823, -730 },
- { 3769, -430, 3168, 694 },
- { 2556, 385, 3539, 512 },
- { 77, -1415, 5111, 2655 },
- { 2724, -2158, 6715, -822 },
- { 1832, 1001, 5385, -1900 },
- { 900, 2198, 4464, -559 },
- { 441, 69, 5921, -1743 },
- { -1161, 738, 6732, -308 },
- { 257, 2035, 4091, 736 },
- { 1607, 1288, 4355, -23 },
- { -13, 1316, 4180, 1672 },
- { 1511, 1336, 3057, 1435 },
- { 2189, -3813, 4530, 939 },
- { 3632, -706, 2646, 1375 },
- { 4266, -3761, 4241, 1077 },
- { 3101, -427, 5273, -1202 },
- { 2293, 276, 4810, -313 },
- { 3430, -1851, 3101, 2045 },
- { 3453, -2979, 5142, 942 },
- { 1683, -3281, 4802, 2002 },
- { 3954, -4715, 5611, 578 },
- { 1272, -155, 5085, 454 },
- { 128, -194, 5095, 1409 },
- { 820, 880, 5797, -2658 },
- { -1095, 656, 5774, 1095 },
- { 813, -1669, 4320, -3251 },
- { -119, 518, 6372, -651 },
- { 2922, -4299, 6115, -877 },
- { 4205, -4273, 4004, 2642 },
- { -1211, -3892, 224, 3127 },
- { -34, -4371, 1321, 2318 },
- { 77, -6326, 1201, 828 },
- { 3995, -3775, 1958, 3233 },
- { 178, -3301, 1985, 3318 },
- { 2330, -3801, 1033, 3195 },
- { 1413, -5536, 826, 1709 },
- { 2468, -3499, 3653, 3631 },
- { 741, -4617, 1723, 2008 },
- { 1246, -3043, 2978, 3949 },
- { -343, -4308, 2258, 2189 },
- { -682, -4640, 454, 2272 },
- { 1236, -4829, 2491, 1642 },
- { -512, -3766, 1182, 3052 },
- { 119, -3939, 3712, 971 },
- { -1145, -4624, 1360, 2281 },
- { 101, -4746, 2866, 1255 },
- { -1500, -5455, 539, 1637 },
- { -969, -5909, 1414, 1128 },
- { -1261, -4939, -231, 2022 },
- { -226, -5345, 1207, 705 },
- { 2712, -5109, 3205, 1866 },
- { -476, -5913, 273, 1208 },
- { -2039, -4464, 624, 2545 },
- { -2351, -3930, 2019, 2673 },
- { -2675, -4849, 1522, 1990 },
- { -1524, -3461, 1446, 3204 },
- { 477, -5314, 1710, 1577 },
- { 656, -3729, 2346, 2511 },
- { 550, -5917, 1975, 1040 },
- { 1728, -4704, 3067, 1058 },
- { -9, -5247, 506, 1760 },
- { -574, -5135, 1675, 1672 },
- { 2129, -3781, 3444, 2313 },
- { 1144, -4439, 2214, 2529 },
- { 1292, -4160, 3185, 1833 },
- { 2445, -3262, 2534, 3227 },
- { 2266, -4401, 2023, 2400 },
- { -587, -3602, 3408, 2067 },
- { -885, -4951, 3228, 1174 },
- { -728, -2711, 2807, 3552 },
- { 1019, -3043, 3195, 2954 },
- { 1888, -4615, 1140, 2454 },
- { 660, -5616, 754, 800 },
- { -1975, -5371, 1649, 1585 },
- { -1544, -5436, 2422, 1081 },
- { -422, -5882, 2390, 750 },
- { 1336, -5557, 2441, 1230 },
- { 136, -4001, 267, 2854 },
- { -522, -3289, 2226, 2728 },
- { -971, -4580, 2471, 708 },
- { 704, -5306, 3300, 1001 },
- { 325, -3464, 3555, 2398 },
- { 794, -3686, 848, 3169 },
- { 660, -3017, 4584, 3242 },
- { -1486, -3978, 2170, 1644 },
- { -1615, -4650, 2688, 1844 },
- { 750, -4578, 538, 2239 },
- { 1668, -5849, 1455, 1031 },
- { 3486, -4681, 2030, 2183 },
- { 2642, -5429, 1696, 1761 },
- { 4491, -4502, 3538, 2767 },
- { 3545, -4528, 3514, 2982 },
- { 3269, -3676, 2758, 3966 },
- { 5572, 1146, 209, -3379 },
- { 7459, 1053, 593, -1896 },
- { 4480, 200, -310, -4259 },
- { 5577, -939, 242, -3992 },
- { 8142, 442, 1257, -3083 },
- { 5442, 1261, 1424, -3236 },
- { 6260, -183, 3125, -2532 },
- { 7179, 889, 1618, -2548 },
- { 6416, 932, 2379, -2487 },
- { 7094, 2560, 961, -3392 },
- { 7322, 463, 2732, -3735 },
- { 6632, 1577, 1912, -3272 },
- { 6312, 1349, 3028, -3460 },
- { 6105, 386, 1213, -977 },
- { 5478, 1158, 1114, -486 },
- { 6493, 410, 1686, -2180 },
- { 6378, 1881, 1333, -2240 },
- { 5711, 812, 1958, -1300 },
- { 6844, 877, 730, -1189 },
- { 6824, -245, 2249, -2000 },
- { 7515, 1521, 1251, -3058 },
- { 6697, 1051, 1300, -1749 },
- { 6476, 1425, 811, -2773 },
- { 7350, 465, -76, -2849 },
- { 6975, 2095, 567, -2492 },
- { 4691, 1736, 2660, -2289 },
- { 7837, 1456, 340, -2767 },
- { 7930, 507, 838, -2074 },
- { 6106, 1502, 766, -1110 },
- { 4891, -659, 835, -3954 },
- { 7250, 141, 1369, -1523 },
- { 7651, 67, 1651, -2298 },
- { 7364, -305, 601, -3132 },
- { 7179, 193, 2491, -2871 },
- { 6504, -272, 2167, -1322 },
- { 4456, 983, 2300, -421 },
- { 4817, 457, 1695, 371 },
- { 6914, 555, 850, -3159 },
- { 5904, 1030, 202, -1959 },
- { 6258, 880, 2233, -4503 },
- { 6029, 10, 2130, -3600 },
- { 6449, 985, 1129, -3963 },
- { 6616, -18, -111, -3285 },
- { 4496, 775, 817, -4276 },
- { 6134, 2338, 1470, -2973 },
- { 6911, 152, 430, -1946 },
- { 4053, 991, 3218, -1193 },
- { 5435, 1285, 3124, -2412 },
- { 5507, 1836, 1935, -1988 },
- { 5240, 689, 2189, -2670 },
- { 6638, 1719, 606, -1799 },
- { 5556, -180, 129, -2595 },
- { 5644, 1918, 1281, -4316 },
- { 6410, 1088, -282, -3117 },
- { 6503, 1841, 312, -3514 },
- { 6947, 20, 1358, -3886 },
- { 5464, 2109, 2398, -3194 },
- { 5616, -407, 2140, -498 },
- { 6121, 2707, 2379, -4096 },
- { 7303, 1846, 2266, -4095 },
- { 5444, 470, 2718, -1553 },
- { 5817, -645, 3285, -1349 },
- { 5625, 1427, 1103, -1991 },
- { 6041, -806, 1196, -2943 },
- { 3050, -5722, 4070, -5460 },
- { 3420, -4386, 4078, -5155 },
- { 6020, -3982, 7268, -2689 },
- { 7502, -4317, 7894, -3973 },
- { 4156, -3558, 5247, -4316 },
- { 4725, -4401, 7290, -1540 },
- { 6688, -5122, 8216, -3210 },
- { 9176, -6576, 9276, -4963 },
- { 8706, -5708, 7987, -4621 },
- { 7060, -3535, 6532, -3308 },
- { 5600, -2719, 5363, -1568 },
- { 4661, -2803, 6263, -4716 },
- { 3673, -3636, 6147, -3433 },
- { 5305, -2585, 6073, -2638 },
- { 7614, -1962, 6079, -5266 },
- { 6760, -3366, 7382, -4322 },
- { 6385, -3883, 4797, -1353 },
- { 8182, -5120, 4298, -4641 },
- { 9130, -6198, 4975, -3063 },
- { 7421, -5436, 5576, -3713 },
- { 3483, -4898, 5443, -2745 },
- { 4907, -5643, 6390, -4105 },
- { 8119, -7008, 7992, -6764 },
- { 6528, -6122, 6967, -5590 },
- { 5890, -4190, 6624, -5688 },
- { 6815, -7934, 7275, -5456 },
- { 5434, -4306, 5169, -5378 },
- { 4364, -6436, 5376, -2604 },
- { 8152, -3404, 5913, -5048 },
- { 7983, -4863, 4262, -2461 },
- { 8023, -6188, 6238, -5062 },
- { 6753, -3692, 3935, -3723 },
- { 6826, -4760, 3284, -4051 },
- { 7224, -7423, 4492, -3875 },
- { 6904, -2590, 6587, -6248 },
- { 6106, -1944, 7345, -5506 },
- { 4956, -2990, 7808, -3146 },
- { 6908, -6885, 5949, -1288 },
- { 7162, -6058, 3419, -3401 },
- { 7015, -7080, 6907, -3018 },
- { 6971, -6832, 5646, -3273 },
- { 8014, -5546, 5471, -1544 },
- { 6792, -2220, 5105, -2879 },
- { 8494, -3974, 4408, -3999 },
- { 9591, -4866, 6027, -4558 },
- { 5264, -5161, 6101, -738 },
- { 5803, -6141, 5197, -5231 },
- { 4657, -6822, 3232, -5189 },
- { 4791, -5135, 3809, -4665 },
- { 6108, -5103, 2379, -3873 },
- { 4680, -3909, 3234, -5093 },
- { 5802, -3853, 3795, -4984 },
- { 4360, -7483, 4802, -3877 },
- { 5429, -7517, 5911, -3717 },
- { 6866, -2280, 4880, -4634 },
- { 10131, -4628, 4414, -4092 },
- { 10811, -5189, 7746, -5337 },
- { 5663, -8941, 5287, -5680 },
- { 8023, -5991, 7403, -2796 },
- { 9669, -6919, 6525, -4932 },
- { 7275, -3796, 4962, -2547 },
- { 8848, -4806, 5677, -3080 },
- { 8128, -4308, 7749, -6569 },
- { 4032, -5196, 2282, -6239 },
- { 6593, 700, -229, 304 },
- { 8260, 539, -66, -1259 },
- { 6605, 176, -814, -109 },
- { 8057, 0, -1, -136 },
- { 7382, -38, -484, -1129 },
- { 8373, -929, 682, -454 },
- { 7674, 690, -1278, 546 },
- { 7326, -517, 406, -1283 },
- { 7612, -1715, -1167, 1175 },
- { 8590, 441, -782, -710 },
- { 8572, -1202, -291, 260 },
- { 7308, -147, -1785, 414 },
- { 6787, -353, -672, 934 },
- { 5177, -133, 179, 82 },
- { 4161, -34, 447, 1497 },
- { 5997, -902, 1533, -121 },
- { 5727, -871, -1370, 945 },
- { 8386, -252, 293, -823 },
- { 6573, -1354, 682, 616 },
- { 7650, -2096, 725, 457 },
- { 8122, 78, 636, -1400 },
- { 8421, 428, -1620, 131 },
- { 7341, -1292, -717, 186 },
- { 7998, -49, -720, 266 },
- { 5987, -351, 669, 844 },
- { 7314, -1620, 250, -603 },
- { 7219, -1562, -572, 1994 },
- { 8682, -358, -290, -388 },
- { 5810, 155, -178, 1199 },
- { 7246, -12, 1042, -786 },
- { 7357, -923, 1468, -475 },
- { 7801, 621, -212, -724 },
- { 5346, -514, 1210, 1356 },
- { 8459, 36, -127, -779 },
- { 6878, -2429, 854, 1750 },
- { 7280, -1401, -1353, 2845 },
- { 7579, -2148, -1463, 2087 },
- { 6637, 946, -872, 750 },
- { 4807, -1100, 1289, 2602 },
- { 4495, 219, 1551, 1128 },
- { 7639, 506, 446, -1107 },
- { 6359, 188, 1009, -115 },
- { 6641, -1820, 1655, 723 },
- { 5394, -2382, 1604, 2542 },
- { 6021, -2644, 2396, 1407 },
- { 4698, 882, 245, 1525 },
- { 8103, 573, -798, -349 },
- { 8045, -519, 997, -1092 },
- { 7571, -122, 227, -338 },
- { 5347, -1200, 630, 1718 },
- { 7070, 790, 218, -544 },
- { 7440, 728, -527, -20 },
- { 6402, -355, 197, -736 },
- { 4031, 771, 866, 1895 },
- { 6009, 896, 445, -31 },
- { 5160, 1098, -856, 1784 },
- { 7980, -886, -1293, 1396 },
- { 6318, -1361, 2423, 252 },
- { 7547, -699, 133, 506 },
- { 8562, -2344, 940, 264 },
- { 5890, 1187, -1425, 2194 },
- { 6558, -645, -1311, 2621 },
- { 4634, -1671, 2075, 1623 },
- { 5614, 105, -816, 2376 },
- { 6646, 1558, -1365, 630 },
- { 6998, 1150, -2117, -990 },
- { 6555, 2311, -1093, -1783 },
- { 6682, 1430, -2391, -1940 },
- { 7861, 1555, -2977, -1188 },
- { 6745, 1723, -459, -2085 },
- { 7504, 1229, -1666, -2060 },
- { 7937, 671, -2128, -1529 },
- { 7139, 991, -735, -2632 },
- { 6867, 1592, -1303, -2324 },
- { 6401, 2230, -1732, -2508 },
- { 7201, 2184, -2169, -1988 },
- { 6636, 2190, -995, -2840 },
- { 7620, 2306, -2089, -651 },
- { 7584, 1875, -1438, -631 },
- { 9214, 1561, -2464, -1139 },
- { 6154, 1318, -1237, -2917 },
- { 7917, 2847, -1797, -1599 },
- { 8309, 2029, -2555, -465 },
- { 8204, 1282, -584, -2405 },
- { 8440, 1035, -1147, -1137 },
- { 7107, 1858, -60, -1568 },
- { 6781, 2912, -873, -1463 },
- { 7603, 1316, -319, -1249 },
- { 7833, 1335, -78, -1849 },
- { 7930, 1141, -1016, -695 },
- { 7883, 1610, -1017, -1314 },
- { 8069, 1409, -1811, -196 },
- { 8319, 1031, -582, -1590 },
- { 5948, 1537, -2153, -2373 },
- { 8684, 1171, -1871, -850 },
- { 8357, 2484, -2411, -1292 },
- { 6516, 2092, -193, -1167 },
- { 6112, 1697, 22, -525 },
- { 7161, 703, -602, -1879 },
- { 6047, 2351, -807, -219 },
- { 8072, 1854, -1817, -1553 },
- { 6956, 1304, 76, -1011 },
- { 6607, 1481, -544, -162 },
- { 6958, 2541, -265, -1938 },
- { 6416, 2514, -777, -850 },
- { 7272, 2110, -899, -1171 },
- { 7741, 2153, -283, -2614 },
- { 6482, 2041, -1758, -1221 },
- { 6762, 940, -1862, -2281 },
- { 5610, 1194, -1691, -1561 },
- { 7833, 2164, -823, -1952 },
- { 5460, 1438, -848, 1189 },
- { 6011, 1377, -771, -1557 },
- { 7679, 544, -1134, -2214 },
- { 7209, 1292, -2714, -1564 },
- { 5567, 1200, -404, -169 },
- { 5853, 1461, -1465, -518 },
- { 6782, 689, -844, -860 },
- { 7330, 1337, -1152, -71 },
- { 7189, 1506, -653, -685 },
- { 6860, 2116, -1403, -240 },
- { 8804, 1516, -1391, -1760 },
- { 7210, 2689, -1498, -989 },
- { 7030, 3022, -1441, -2083 },
- { 5649, 1836, -407, 525 },
- { 7451, 3099, -717, -2464 },
- { 7384, 1656, -2007, 398 },
- { 6504, 707, -1919, -134 },
- { -1851, 3639, -2279, -695 },
- { -4037, 1644, -77, 1329 },
- { -4025, 1960, -1565, -567 },
- { -3430, 2495, -795, 368 },
- { -4771, 2480, 993, 756 },
- { -3431, 2058, -2539, -971 },
- { -3802, 3418, 380, 217 },
- { -3074, 3350, -1652, -1056 },
- { -3705, 326, -1650, 1535 },
- { -3122, 1281, -1192, 1607 },
- { -4601, 1367, -968, 53 },
- { -3808, 958, 44, 2560 },
- { -2079, 2530, -1485, 1166 },
- { -3707, 343, -2889, 180 },
- { -5249, 1431, -31, 688 },
- { -4990, 125, -704, 1270 },
- { -2771, 1334, -2446, 746 },
- { -2292, 994, -1527, 2630 },
- { -1261, 3070, -2519, 268 },
- { -2544, 3890, -1057, -552 },
- { -4421, 255, -1980, 530 },
- { -2951, 454, -13, 3643 },
- { -2262, 1815, -370, 2880 },
- { -2383, 3657, -649, 576 },
- { -3541, -161, -1389, 2550 },
- { -4241, 1575, 1325, 2561 },
- { -2767, 4037, 1221, 1578 },
- { -3748, 2697, 1148, 1801 },
- { -4686, 2385, -220, 0 },
- { -1531, 1645, -2751, 1327 },
- { -45, 4032, -799, 2298 },
- { -2915, 2280, 709, 2495 },
- { -1199, 3278, -406, 2346 },
- { -2471, 116, -2706, 2060 },
- { -2440, 2173, -2894, -344 },
- { -3375, 2287, 1781, 3226 },
- { -2153, 3568, 1827, 2918 },
- { -862, 2267, -1626, 2527 },
- { -2698, 1135, 301, 4239 },
- { -2364, 2123, 1010, 3710 },
- { -2447, 3281, -81, 1408 },
- { -2660, 4735, 472, 258 },
- { -1053, 3097, 2682, 2398 },
- { -3366, -1037, -1152, -868 },
- { -643, 4242, 2212, 1259 },
- { 971, 3991, 934, 643 },
- { -1617, 2002, 2139, 2195 },
- { -4897, 972, 784, 1719 },
- { -1275, 2992, 1039, 3821 },
- { -392, 4973, -209, 1821 },
- { -1028, 4718, -1479, -137 },
- { 50, 3914, 553, 2210 },
- { 678, 4364, 359, 1303 },
- { -582, 4911, 514, 1671 },
- { 1276, 3914, -1252, 2934 },
- { -1496, 3984, 857, 2330 },
- { 772, 4744, -655, 2332 },
- { -799, 5283, -439, 624 },
- { 1341, 2937, 650, 2027 },
- { -1739, 4892, 1275, 1702 },
- { -892, 2596, -151, 3951 },
- { -3532, 1090, 1292, 32 },
- { 321, 3146, 2647, 1475 },
- { 264, 4199, -1591, 1317 },
- { -452, -2357, 2266, 4192 },
- { 3022, -1033, -2389, 5678 },
- { -1162, -1342, 3543, 4990 },
- { -474, -1477, -1223, 5016 },
- { -699, -2857, 900, 3835 },
- { -461, -2255, -117, 4626 },
- { 1204, -2062, -1211, 4403 },
- { 2192, -3035, -337, 3966 },
- { 108, -831, 279, 5643 },
- { 1457, -620, -2908, 5276 },
- { -2527, -78, 1085, 5460 },
- { -1978, -1918, -949, 4733 },
- { 32, 367, -1904, 5166 },
- { 1890, -1665, 440, 4752 },
- { -518, -348, 2816, 4891 },
- { 3695, -2490, -1374, 4603 },
- { 246, -1965, 3549, 3969 },
- { 1100, -3111, 656, 3737 },
- { -1379, 870, -414, 4575 },
- { 628, -357, -1227, 6179 },
- { -1129, -1318, -2457, 4576 },
- { -425, -98, -73, 6336 },
- { 367, -887, 2990, 4207 },
- { 2091, -1251, 2444, 3557 },
- { -1759, -1610, 2046, 5273 },
- { 3210, 1414, -20, 2616 },
- { 3303, -2636, 1005, 4237 },
- { -327, -3107, -640, 3687 },
- { -197, 764, 572, 5486 },
- { 646, -767, 1388, 5464 },
- { 104, 2742, -228, 3907 },
- { -236, 1829, -579, 4585 },
- { -2150, -474, -1525, 4006 },
- { -23, -2632, -2400, 3892 },
- { -12, -1739, -2910, 4867 },
- { -2310, -368, -102, 4583 },
- { -1991, -2061, 533, 4531 },
- { 3884, -1446, -153, 4393 },
- { 1568, 14, -289, 5268 },
- { -1376, -253, -2797, 3417 },
- { 3193, -2577, 2475, 3566 },
- { 3418, 617, 1350, 1857 },
- { 3792, -24, -272, 3370 },
- { 153, 1159, 2906, 2877 },
- { 511, 2162, 1548, 2741 },
- { 262, 819, -2791, 3734 },
- { 4232, -2015, 1486, 3477 },
- { 2943, -1110, -1014, 5480 },
- { 2842, 369, 703, 3476 },
- { 3011, 1634, -933, 3553 },
- { 4412, -1548, -942, 5021 },
- { -1405, 593, 2372, 5267 },
- { 2093, 2129, 896, 2365 },
- { 4845, -1980, 0, 3823 },
- { -2140, 81, 3278, 5637 },
- { 1484, 2665, -324, 3653 },
- { 10, 192, 1620, 5291 },
- { 2152, 738, -2269, 5000 },
- { 2102, 2748, -1652, 4707 },
- { 2855, -2131, -387, 5188 },
- { 1173, 676, 1338, 3277 },
- { 2340, -2329, -2064, 4095 },
- { 861, -2024, 1296, 5055 },
- { 2189, 3225, -695, 2626 },
- { 6196, -7079, 1943, -822 },
- { 4547, -4813, 3261, 1856 },
- { 4243, -6904, 3443, 448 },
- { 4581, -7503, 946, 506 },
- { 6626, -7754, 3427, 470 },
- { 3407, -9088, 3269, -1496 },
- { 4079, -6464, 2304, 777 },
- { 5621, -9336, 2684, -768 },
- { 5351, -6464, 5238, -214 },
- { 5961, -8007, 1724, -3091 },
- { 4213, -8067, 603, -246 },
- { 7208, -7403, 3168, -1738 },
- { 6098, -7700, 329, -1379 },
- { 6525, -6735, 4248, -1072 },
- { 6073, -6241, 2167, -2378 },
- { 4609, -9218, 3051, -1033 },
- { 6813, -7283, 1581, -1897 },
- { 6126, -6275, 2789, 681 },
- { 4423, -6538, 1621, -1692 },
- { 6272, -8298, 3167, -1855 },
- { 6172, -8558, 4498, -1169 },
- { 4844, -8588, 1647, -366 },
- { 6209, -8807, 1581, -369 },
- { 5389, -8059, 550, -192 },
- { 6654, -9775, 2504, -1063 },
- { 7103, -7998, 806, 530 },
- { 5662, -6736, 1565, -3620 },
- { 4165, -9564, 4191, -2131 },
- { 4526, -7181, 576, -2875 },
- { 4633, -8623, 2807, -4742 },
- { 3709, -7794, 1815, 34 },
- { 3634, -8622, 2313, -826 },
- { 6991, -8447, 2063, -3198 },
- { 7757, -9486, 2255, -558 },
- { 4149, -7778, 4728, -1696 },
- { 5767, -7427, 1113, 707 },
- { 4592, -6261, 2329, 1864 },
- { 3159, -10498, 1677, -4273 },
- { 3534, -9010, 2437, -3565 },
- { 4479, -10821, 2715, -4942 },
- { 3207, -9805, 3054, -3886 },
- { 4627, -8189, 3018, -2354 },
- { 5527, -10566, 3244, -2749 },
- { 4346, -10127, 3335, -3084 },
- { 6132, -10085, 3316, -1308 },
- { 5629, -9704, 2178, -3058 },
- { 3603, -8538, 1246, -624 },
- { 3737, -8488, 395, -3167 },
- { 5465, -11414, 2810, -4640 },
- { 5306, -7745, 2721, -3988 },
- { 7000, -9111, 1695, -1409 },
- { 6663, -7741, 2466, -4079 },
- { 4083, -7175, 1836, -4831 },
- { 3613, -9926, 1342, -3455 },
- { 6588, -8033, 457, -258 },
- { 4720, -8102, 17, -1209 },
- { 7414, -8709, 1294, -344 },
- { 5437, -10030, 4043, -1704 },
- { 4862, -9281, 1558, -1431 },
- { 6800, -6403, 5113, 862 },
- { 4623, -8242, 2667, -228 },
- { 5919, -5083, 3348, 2135 },
- { 5985, -8889, 2733, -5105 },
- { 5029, -5767, 4407, 719 },
- { 354, -6158, -838, -3001 },
- { 351, -5943, -2104, -1534 },
- { -633, -7190, -25, -4798 },
- { -1595, -7235, -3812, -1400 },
- { 103, -6197, -2933, -78 },
- { -1722, -5020, -3441, -4333 },
- { -1963, -5644, -4365, -270 },
- { -846, -5743, -3477, 196 },
- { -191, -5348, -4054, -469 },
- { -2515, -7754, -3495, -818 },
- { -2090, -6710, -2701, 117 },
- { -546, -7036, -1398, 163 },
- { -278, -7091, -2662, -536 },
- { -622, -7962, -2731, -1464 },
- { -1555, -8118, -3612, -2057 },
- { -1094, -6280, -2314, 505 },
- { -2556, -8538, -4024, -2247 },
- { 109, -7134, -3107, -1823 },
- { -900, -6954, -3340, -717 },
- { -605, -7113, -3656, -2154 },
- { 837, -6263, -3211, -2177 },
- { -417, -5810, -3871, -1469 },
- { -1318, -5649, -4207, -3198 },
- { 413, -6765, -2082, -33 },
- { -3101, -6450, -4362, -766 },
- { 755, -6489, -2967, -846 },
- { 1117, -7106, -2452, -1352 },
- { -1202, -8387, -3072, -2897 },
- { -365, -4894, -3561, -2937 },
- { -2372, -8776, -265, -4441 },
- { -1224, -8678, -896, -5074 },
- { -755, -10096, -600, -6623 },
- { 300, -8206, -225, -4568 },
- { -1176, -6824, -2633, -3527 },
- { -2006, -5443, -1526, -5849 },
- { -1115, -5540, -2363, -4785 },
- { 1059, -6812, -2543, -2654 },
- { -1976, -6861, -3062, -5508 },
- { -379, -5328, -2321, -3624 },
- { -2108, -5860, -4518, -1915 },
- { -379, -7885, -1329, -594 },
- { 774, -5389, -581, -5213 },
- { -2601, -5083, -1849, -4921 },
- { -176, -5580, 74, -5075 },
- { -204, -6780, -190, -6232 },
- { 418, -7594, -1987, -820 },
- { -1873, -8529, -2926, -1609 },
- { 1340, -6362, -919, -4975 },
- { 577, -7990, -2044, -1873 },
- { -2572, -7413, -1745, -2224 },
- { -2037, -7030, -1461, -7138 },
- { -2559, -8756, -2039, -5836 },
- { -2079, -6764, -1209, -5669 },
- { -1613, -7801, -2006, -685 },
- { -1865, -6583, -722, -3529 },
- { -589, -6358, -1377, -1003 },
- { -540, -7514, -1331, -3542 },
- { 419, -6192, -1677, -4927 },
- { -2786, -8763, -2966, -5065 },
- { -2172, -8411, -1726, -4675 },
- { -3382, -9833, -3497, -5722 },
- { -2433, -10169, -2077, -5775 },
- { -424, -9451, -1096, -3658 },
- { -537, -8522, -910, -1897 },
- { -5550, 2807, 1683, -693 },
- { -6395, 635, 3573, -1246 },
- { -7544, 2280, 2140, 44 },
- { -8751, 1136, 2951, -794 },
- { -5605, 2709, 2052, 916 },
- { -7650, 654, 869, 135 },
- { -6939, 967, 1409, 870 },
- { -7834, 2123, 3310, 974 },
- { -6935, 2818, 1274, -1678 },
- { -5605, 2233, 1013, 471 },
- { -7095, 1849, 1648, 198 },
- { -6636, 1634, 712, -37 },
- { -7279, 978, 296, -315 },
- { -7664, 3504, 3292, -216 },
- { -7836, 1209, 1221, -257 },
- { -7913, 2201, 1765, -1529 },
- { -7077, 3783, 2632, -1407 },
- { -5565, 1645, 1410, -622 },
- { -6494, 2879, 1181, -759 },
- { -7073, 3137, 3010, 550 },
- { -7249, 1839, 847, -805 },
- { -6630, 2197, 282, -1096 },
- { -8836, 1573, 1988, -1090 },
- { -7809, 1274, 836, -1198 },
- { -7895, 2970, 3511, -1097 },
- { -6960, 1664, 1356, -2442 },
- { -6582, 2866, 2273, 307 },
- { -7221, 821, 2851, -1435 },
- { -6015, 1703, 2001, -2367 },
- { -8082, 1034, 2103, 239 },
- { -5952, 1912, 301, -465 },
- { -6099, 841, 379, 567 },
- { -6343, 50, 494, 658 },
- { -6586, 983, 591, -893 },
- { -5500, 869, 2187, -2479 },
- { -6482, 60, 1545, -979 },
- { -6705, 515, 1974, -53 },
- { -6460, 1755, 1325, -1275 },
- { -6093, 2617, 2465, -623 },
- { -7330, 2161, 594, -2115 },
- { -7324, 762, 1593, -2004 },
- { -6385, 679, 1510, -2514 },
- { -6159, 241, 2976, -1631 },
- { -8583, 3030, 4045, -162 },
- { -6299, 66, 2209, -2103 },
- { -5428, 1279, 3267, -1846 },
- { -6438, 1335, 2728, -1631 },
- { -8012, 1070, 2428, -1151 },
- { -6201, 2781, 2349, -1918 },
- { -5918, 1139, 3121, -148 },
- { -6314, 2481, 3137, -1808 },
- { -7180, 1722, 2435, -1602 },
- { -6750, 1829, 3763, -1145 },
- { -6713, 1777, 2221, 1212 },
- { -7479, 1835, 3627, -479 },
- { -7299, 10, 2406, -1593 },
- { -8249, 3129, 996, -2870 },
- { -8374, 1534, 1333, -1882 },
- { -7507, 3353, 1598, -2299 },
- { -7379, 2701, 2326, -1167 },
- { -8440, 2276, 2796, -542 },
- { -10348, 1527, 2649, -1165 },
- { -8184, 3614, 2574, -1738 },
- { -5539, 1574, 1733, 1138 },
- { 9404, -7652, 67, 79 },
- { 8654, -3972, 1358, -60 },
- { 8617, -4794, 117, 2318 },
- { 7886, -4505, 1784, 1200 },
- { 8636, -6125, 3879, -1003 },
- { 9654, -6836, 1816, 205 },
- { 9374, -6553, 913, 1875 },
- { 8020, -6150, 1134, 2390 },
- { 7786, -4970, 2078, -1857 },
- { 8691, -6119, 711, 708 },
- { 9039, -5568, 2944, -1902 },
- { 9955, -5048, 1433, -601 },
- { 8089, -6927, 3093, -2846 },
- { 8487, -7024, 2415, 19 },
- { 9388, -5287, 3577, -2655 },
- { 8591, -7371, 2300, -996 },
- { 9104, -4763, 1453, -2558 },
- { 7615, -5457, 596, 164 },
- { 9860, -7047, 3433, -614 },
- { 8756, -4404, 2235, -964 },
- { 9462, -4660, 299, -1822 },
- { 10119, -5550, 2689, -1273 },
- { 10915, -7471, 2705, -1007 },
- { 11433, -7090, 1410, -1198 },
- { 9882, -7431, 2965, -1895 },
- { 7628, -5219, 769, -2661 },
- { 8169, -5318, 2262, 70 },
- { 8846, -6320, 1939, -754 },
- { 7147, -5593, 1248, -971 },
- { 10652, -5485, 935, 137 },
- { 7778, -6533, 2564, -1932 },
- { 8878, -5173, 1214, -361 },
- { 9828, -4943, 282, 510 },
- { 10042, -6134, 3895, -1914 },
- { 7965, -6630, 3566, -433 },
- { 8573, -4502, 3574, -1209 },
- { 8398, -4801, 1031, -1347 },
- { 10136, -7772, 2612, 1547 },
- { 9890, -7280, 1768, -1083 },
- { 8407, -6585, -706, -58 },
- { 7976, -7582, 229, -131 },
- { 10481, -8866, 1166, -147 },
- { 10914, -4342, 3189, -2412 },
- { 10440, -5198, -104, -1109 },
- { 11227, -6530, 2381, -2449 },
- { 8487, -8064, 1086, 230 },
- { 9975, -6123, -857, -134 },
- { 8339, -6498, 1232, -2337 },
- { 11042, -4506, 1119, -2098 },
- { 12563, -5592, 1837, -2062 },
- { 11801, -5590, 632, -1296 },
- { 10152, -5617, 1511, -1917 },
- { 7800, -6473, 51, -1337 },
- { 7941, -5560, 2438, -3270 },
- { 6554, -3834, 2100, 1476 },
- { 9065, -5520, -226, -1120 },
- { 10794, -7120, -243, 122 },
- { 10429, -6968, 272, -806 },
- { 8942, -8914, 1442, -392 },
- { 9969, -5051, 2033, -2953 },
- { 7275, -4152, 3058, -64 },
- { 11127, -5488, 4589, -3227 },
- { 9626, -6666, 2739, -2958 },
- { 6943, -5362, 4470, 1008 },
- { -7456, -967, 2936, -1002 },
- { -8622, -333, 6962, 2606 },
- { -7486, -3392, 3668, 1287 },
- { -8053, -827, 5148, 1097 },
- { -6610, 454, 4952, 96 },
- { -7701, -1982, 3161, -468 },
- { -7307, -1132, 4071, -36 },
- { -8125, -271, 5199, 3862 },
- { -9182, -1950, 2813, 1878 },
- { -9855, -952, 4794, 3010 },
- { -7241, 1431, 4202, 2468 },
- { -9646, 157, 4766, 1046 },
- { -9371, 1230, 6009, 2958 },
- { -11514, -64, 8630, 5248 },
- { -6766, 565, 2766, 2140 },
- { -8426, -9, 2852, 1271 },
- { -11291, -1113, 5087, 2937 },
- { -8297, 2092, 4495, 1264 },
- { -9983, 735, 3809, -51 },
- { -9048, -1000, 3191, -308 },
- { -7331, -1987, 2655, 1391 },
- { -7144, -21, 4333, 2161 },
- { -6032, -1540, 3543, 896 },
- { -7987, -1036, 1985, 1529 },
- { -9264, 2004, 5194, 290 },
- { -11308, -840, 5754, 1654 },
- { -9130, -2398, 4292, 2973 },
- { -6248, 838, 3563, 1223 },
- { -6819, -2760, 3511, 119 },
- { -7213, -2006, 4364, 762 },
- { -5431, -1047, 4533, 166 },
- { -7098, -641, 2021, 639 },
- { -8628, -2249, 3588, 399 },
- { -6352, -1498, 3560, -648 },
- { -7033, -2190, 4870, 2562 },
- { -7405, -46, 3772, -581 },
- { -6104, 796, 5143, 1965 },
- { -5787, 943, 5784, 3030 },
- { -8367, 1465, 7192, 4097 },
- { -8259, 789, 5694, 1963 },
- { -10614, -1899, 5748, 2645 },
- { -8258, -805, 3698, 2275 },
- { -6877, -972, 6431, 3160 },
- { -6483, 363, 7018, 3129 },
- { -6283, -1358, 5191, 1524 },
- { -8853, -3157, 4119, 1741 },
- { -6086, -267, 3883, -835 },
- { -7254, 1032, 6613, 4017 },
- { -11470, -3350, 4649, 3426 },
- { -6743, 481, 6148, 1239 },
- { -5394, -166, 5309, 3165 },
- { -7958, 1068, 4268, -240 },
- { -10520, 2256, 7916, 2828 },
- { -5132, -4, 5739, 1176 },
- { -8643, 120, 3255, -629 },
- { -9631, 1974, 8870, 4362 },
- { -10663, -1221, 3733, 589 },
- { -8224, -1843, 5806, 2655 },
- { -8282, 1255, 8647, 3478 },
- { -12311, -1505, 9043, 6256 },
- { -11312, -856, 7136, 4681 },
- { -11944, -722, 7941, 3309 },
- { -7868, -463, 6846, 4196 },
- { -8679, -241, 7410, 5347 },
- { 6759, -4680, -508, 1220 },
- { 5176, -6111, 944, 121 },
- { 6843, -5667, -1368, -533 },
- { 5616, -5884, -1471, -695 },
- { 6030, -5089, -1808, -940 },
- { 7444, -5463, -52, 1881 },
- { 4207, -6079, -506, 1571 },
- { 6785, -4410, -649, 3084 },
- { 4838, -5214, 2026, 2998 },
- { 4201, -5790, 645, 1811 },
- { 6930, -5129, -1940, 1698 },
- { 6332, -4627, 692, 3027 },
- { 6285, -4314, -106, 3644 },
- { 6255, -5450, -1975, 742 },
- { 4199, -4676, -459, 1796 },
- { 5592, -5500, 1345, 1300 },
- { 4358, -5556, -2236, 114 },
- { 4620, -5875, -1563, 888 },
- { 4892, -7550, -327, -419 },
- { 4734, -7085, 7, 613 },
- { 3883, -5562, -1969, 1080 },
- { 5610, -4990, -204, 834 },
- { 4117, -6482, -1271, 341 },
- { 6585, -5107, 892, 1169 },
- { 6632, -3683, 302, 3002 },
- { 6326, -5351, -983, -1250 },
- { 4382, -7192, -730, -158 },
- { 5227, -6540, -451, 1123 },
- { 5468, -6472, -870, -1471 },
- { 5191, -6402, -1365, -127 },
- { 7407, -6317, -973, -336 },
- { 4611, -6530, -820, -1980 },
- { 4963, -5159, -2050, -966 },
- { 4414, -5691, -211, -998 },
- { 5954, -5873, 750, -1749 },
- { 4394, -4796, -1268, 254 },
- { 7161, -6214, -1010, 689 },
- { 4965, -3598, 2372, 1711 },
- { 6248, -6180, 981, 864 },
- { 6473, -5336, 525, -600 },
- { 4591, -6864, -1131, -900 },
- { 6314, -6440, -1021, -375 },
- { 5838, -6209, -1199, 944 },
- { 5308, -5283, -2100, 1267 },
- { 4342, -5860, -1637, -1356 },
- { 5680, -4388, -1227, -104 },
- { 4900, -4098, 1449, 4046 },
- { 4677, -4284, -106, 3190 },
- { 7574, -6173, -848, 1859 },
- { 6493, -7207, -131, 726 },
- { 5513, -5261, -2117, 4 },
- { 6191, -7352, -193, -505 },
- { 5885, -4333, 324, -134 },
- { 6162, -6081, -312, -2044 },
- { 4216, -6200, -1810, -572 },
- { 5652, -7035, -696, -197 },
- { 7131, -7189, -366, -60 },
- { 5032, -4803, -1514, 2832 },
- { 7386, -4610, -606, 3489 },
- { 4211, -5031, 1221, 3047 },
- { 4050, -4653, 1584, 1469 },
- { 6852, -5302, -1861, 206 },
- { 7736, -4816, -1794, 3359 },
- { 6290, -3439, 1522, 2454 },
- { 1768, 5990, -5560, -2594 },
- { 3903, 5326, -1530, -1501 },
- { 2472, 3738, -2117, -4240 },
- { 3260, 5448, -904, -4733 },
- { 1435, 7297, -3676, -4102 },
- { 4096, 5951, -656, -3312 },
- { 2178, 6009, -3146, -3724 },
- { 3787, 5493, -5473, -1633 },
- { 2998, 7286, -3334, -3571 },
- { 2894, 6576, -4708, -2804 },
- { 830, 6163, -4286, -3348 },
- { 4755, 5569, -1730, -2739 },
- { 4604, 6065, -3562, -2605 },
- { 2749, 5141, -3986, -2775 },
- { 3942, 4875, -2143, -3340 },
- { 2819, 8517, -2004, -2724 },
- { 2146, 6298, -689, -3093 },
- { 5196, 6504, -3393, -1475 },
- { 1851, 8386, -1748, -1420 },
- { 3474, 8572, -3534, -2688 },
- { 4503, 7560, -3561, -2245 },
- { 4433, 6219, -2393, -1575 },
- { 3506, 7248, -2275, -1977 },
- { 3490, 7409, -3147, -604 },
- { 4214, 6447, -3520, 516 },
- { 619, 7034, -829, -1705 },
- { 1732, 7395, -356, -2208 },
- { 1226, 5204, -3294, -3732 },
- { 2027, 5619, -1813, -4146 },
- { 3078, 5877, 47, -2651 },
- { 1654, 5458, 424, -682 },
- { 3163, 5464, -2026, -270 },
- { 2884, 5375, -685, -530 },
- { 2950, 7286, -35, -2967 },
- { 1986, 5066, -597, 482 },
- { 3459, 4308, -3845, -2333 },
- { 3155, 7037, -1346, -4345 },
- { 2193, 6696, -717, -1319 },
- { 3677, 5089, -3892, -487 },
- { 2186, 5136, -4186, -1492 },
- { 773, 5796, -917, 817 },
- { 2489, 6546, -3570, -2117 },
- { 1223, 6469, -1362, -33 },
- { 271, 6061, -1466, -1725 },
- { 2540, 5171, -1847, 1032 },
- { 2548, 5251, -2697, 1677 },
- { 771, 7600, -768, -632 },
- { 4710, 6647, -4736, -1275 },
- { 1369, 5917, -2971, -1056 },
- { 163, 5239, -3499, -2275 },
- { 2104, 4285, -3211, -3286 },
- { 1107, 7411, -1972, -1671 },
- { 2196, 7262, -2310, -1926 },
- { -244, 6439, -1745, -839 },
- { 3293, 3832, -2890, -3000 },
- { 419, 6443, -379, -407 },
- { 3077, 4930, -1156, -2869 },
- { 2131, 5874, -2330, 224 },
- { 690, 6538, -2212, -2841 },
- { 1602, 4421, -2515, 1542 },
- { 3318, 9373, -3032, -3477 },
- { 5646, 7462, -5153, -1463 },
- { 4139, 7137, -1539, -3321 },
- { 3481, 9077, -1645, -3653 },
- { -7747, 375, -106, -543 },
- { -8587, -1379, -586, -461 },
- { -10146, -892, 2094, 694 },
- { -8103, 382, 504, -325 },
- { -8548, -92, 94, -656 },
- { -7460, 38, 152, 388 },
- { -8266, -271, -459, -883 },
- { -7935, -664, -1026, -802 },
- { -8341, -109, 853, 161 },
- { -8802, -1355, 1099, 630 },
- { -8957, -6, 1108, -669 },
- { -7260, -1520, -43, -407 },
- { -7555, -174, 668, -2562 },
- { -9014, -126, 227, -1191 },
- { -8184, 769, 290, -1375 },
- { -9476, 55, 962, -1528 },
- { -8679, 541, 755, -1030 },
- { -9842, -1626, 838, -1588 },
- { -8513, -702, 788, -1998 },
- { -10101, -1558, -366, -1841 },
- { -8135, 78, 1479, -1813 },
- { -9128, -454, 313, -1786 },
- { -7554, -1084, 831, -2442 },
- { -7576, -701, 2068, -1665 },
- { -7791, -1481, 1587, -1808 },
- { -6701, -596, -97, 802 },
- { -7418, -15, 684, -963 },
- { -7127, -477, -139, -426 },
- { -8097, -110, -36, -264 },
- { -7620, -1922, -590, -101 },
- { -7647, -1201, 279, 660 },
- { -7856, -1974, 758, -2271 },
- { -8496, -167, 2232, -1143 },
- { -8506, -1359, 624, -740 },
- { -7274, -1052, 1062, -139 },
- { -7800, -217, 91, -1794 },
- { -7030, -1694, -955, 615 },
- { -9020, -1864, 101, -2182 },
- { -9400, -740, 598, -667 },
- { -8448, -1184, 2024, -1272 },
- { -8812, -570, -897, -2384 },
- { -10559, -1286, 538, -1536 },
- { -8728, -888, -1089, -1397 },
- { -7080, -1185, 636, -1252 },
- { -9880, 233, 2344, -782 },
- { -7952, -1326, -378, -1947 },
- { -7207, -378, 1408, -2237 },
- { -8467, -1545, 902, -1987 },
- { -9163, -1474, 924, -1739 },
- { -8159, -992, -77, -2744 },
- { -8343, 148, -423, -1573 },
- { -9105, -649, -254, -1214 },
- { -8939, 456, 281, -1905 },
- { -8837, 179, -394, -2634 },
- { -9145, 757, 1547, -1319 },
- { -9775, -723, 441, -1680 },
- { -8910, -686, 1529, -1525 },
- { -9492, -1134, 2064, -938 },
- { -6111, -943, 677, -31 },
- { -7411, -613, -814, 46 },
- { -9479, -922, -430, -2061 },
- { -11298, -1268, 1318, -1117 },
- { -8190, 832, 671, -2214 },
- { -10453, -550, 1672, -886 },
- { 1044, 9353, -1651, -5423 },
- { 1034, 8149, -455, -6166 },
- { 761, 8293, -3214, -4838 },
- { 938, 8077, 164, -5130 },
- { 1295, 8673, 2582, -5490 },
- { -314, 7973, -2395, -5231 },
- { -507, 9012, -2497, -5775 },
- { 2396, 8314, -1022, -4673 },
- { -1516, 8501, 1950, -4969 },
- { -308, 7401, 1549, -4866 },
- { -112, 8340, 3003, -4920 },
- { -50, 9315, 1371, -5666 },
- { -659, 9449, 2496, -5547 },
- { 2573, 9148, -2270, -4783 },
- { 830, 7104, -438, -3907 },
- { 522, 10672, -677, -6483 },
- { -1190, 10108, -510, -6518 },
- { -427, 8271, -579, -6315 },
- { 1602, 8113, -1927, -4418 },
- { -2266, 8180, 448, -5190 },
- { -1633, 8816, -226, -5771 },
- { 759, 9481, -105, -5813 },
- { 2254, 6679, -466, -5662 },
- { -88, 6946, 895, -5958 },
- { -1705, 10009, 1394, -5574 },
- { 748, 7943, 540, -6692 },
- { 1411, 7009, 232, -6145 },
- { 697, 7290, -1221, -5342 },
- { -1764, 10580, 1944, -3981 },
- { -1334, 9124, 1195, -3903 },
- { -905, 10067, 635, -5039 },
- { 664, 10680, 49, -4625 },
- { 1374, 9536, -777, -3591 },
- { 252, 9698, -597, -2931 },
- { 824, 9164, -1014, -2144 },
- { 2438, 10569, -2289, -4424 },
- { 2101, 7102, 507, -3614 },
- { 294, 8051, -432, -1518 },
- { -665, 10337, 547, -2852 },
- { 1168, 11989, -492, -5427 },
- { 1344, 6416, 302, -5061 },
- { -1727, 12264, 1507, -4543 },
- { 674, 10889, -902, -3605 },
- { -582, 9504, 300, -3618 },
- { 641, 7654, 689, -2109 },
- { 2065, 9243, 508, -4367 },
- { 1055, 8373, 688, -3144 },
- { -641, 8185, 986, -3307 },
- { 1120, 7426, 1785, -3757 },
- { 1660, 8070, -593, -3104 },
- { 2002, 9467, -1722, -3475 },
- { 2361, 8368, 100, -3709 },
- { -772, 7845, -613, -4988 },
- { 1485, 7430, 1896, -6127 },
- { -432, 7823, -947, -2882 },
- { 313, 11122, -760, -4871 },
- { 412, 8412, -283, -4231 },
- { 1585, 10402, -1884, -3267 },
- { 321, 6952, 773, -3016 },
- { -105, 9014, 121, -2249 },
- { 1585, 10313, -977, -4812 },
- { 1619, 11869, 1306, -6876 },
- { -1168, 8886, -81, -2500 },
- { -395, 10886, 733, -6490 },
- { -4949, 4274, 3992, -1054 },
- { -4241, 5299, 4262, -1584 },
- { -2710, 3862, 4552, -1673 },
- { -4608, 2472, 3672, -1715 },
- { -2843, 2816, 4003, -2326 },
- { -5229, 2964, 5636, 90 },
- { -4924, 3442, 5015, -1096 },
- { -1281, 3313, 5537, -2066 },
- { -3808, 1939, 4351, -919 },
- { -1915, 2585, 4939, -1614 },
- { -3470, 1843, 5562, -682 },
- { -3800, 870, 5827, 144 },
- { -4985, 1452, 4728, -709 },
- { -3745, 2750, 7220, 259 },
- { -1875, 1900, 6514, -826 },
- { -4329, 1574, 7192, 1304 },
- { -5408, 1444, 6208, 631 },
- { -3327, 5312, 5707, -1541 },
- { -6966, 3334, 4034, 1028 },
- { -7484, 4245, 4218, -212 },
- { -6567, 5839, 4539, -512 },
- { -5715, 5935, 3747, -1186 },
- { -6410, 4881, 3356, -1610 },
- { -5146, 2590, 2850, 2172 },
- { -5196, 4095, 2569, -373 },
- { -5043, 6025, 4318, 692 },
- { -5525, 4884, 3513, 370 },
- { -6804, 7533, 5812, -488 },
- { -5657, 2480, 4061, 1234 },
- { -3155, 1472, 6071, 1188 },
- { -3427, 5217, 3442, 858 },
- { -4698, 3013, 5517, 2586 },
- { -4449, 2226, 5418, 3580 },
- { -6395, 3547, 5487, 2028 },
- { -3500, 5019, 4787, 1 },
- { -4038, 2578, 3073, 3151 },
- { -2750, 1955, 4469, 3856 },
- { -5696, 1659, 6118, 2469 },
- { -4350, 1241, 6840, 3126 },
- { -5565, 5058, 5196, 1314 },
- { -1642, 4190, 3948, 607 },
- { -1233, 4108, 4850, -640 },
- { -997, 3428, 3239, 1378 },
- { -6488, 2741, 6926, 2792 },
- { -4188, 3763, 4235, 2018 },
- { -3210, 3224, 5646, 1427 },
- { -5526, 6909, 5070, -627 },
- { -2815, 3994, 3425, 1903 },
- { -2163, 2734, 5423, 145 },
- { -4149, 4247, 2355, 734 },
- { -410, 2521, 4138, -16 },
- { -2411, 2385, 4927, 2105 },
- { -6077, 3591, 3114, 594 },
- { -4186, 4834, 5926, -1004 },
- { -7315, 3369, 5966, 448 },
- { -7042, 5721, 5771, 238 },
- { -4466, 3907, 3535, -1751 },
- { -2116, 3970, 6163, -1392 },
- { -7239, 2143, 8407, 3630 },
- { -5431, 4486, 6486, -42 },
- { -1874, 1617, 6333, 519 },
- { -6478, 2629, 4634, -505 },
- { -7784, 2342, 7216, 1365 },
- { -1154, 1432, 4831, 1544 },
- { -4964, -5801, 1797, 506 },
- { -4436, -6905, 1059, -1237 },
- { -5400, -6886, 884, -290 },
- { -6259, -7103, 523, -227 },
- { -4819, -6450, 1412, -450 },
- { -4056, -6213, 1725, -943 },
- { -5642, -6091, 1357, 605 },
- { -4196, -5678, 2187, -173 },
- { -4726, -5126, 2470, 321 },
- { -6642, -5091, 1507, -1005 },
- { -5304, -5250, 1944, 1579 },
- { -7179, -5520, 1468, -425 },
- { -6033, -4895, 1876, -955 },
- { -6595, -5143, 2207, 1291 },
- { -4224, -4943, 1846, 1792 },
- { -7128, -6950, 539, 724 },
- { -4369, -4901, 2590, 1103 },
- { -7413, -5696, 1712, 1440 },
- { -5885, -6821, 418, 871 },
- { -6828, -5599, 710, -1563 },
- { -6123, -5817, 1358, 1631 },
- { -5291, -5622, 578, 2138 },
- { -7171, -6004, 347, 2208 },
- { -6083, -5251, 2132, 425 },
- { -4329, -5721, 407, -2993 },
- { -5326, -5056, 1119, -1837 },
- { -5485, -5856, 185, -2389 },
- { -6529, -5178, 403, -697 },
- { -6719, -4412, 2726, 871 },
- { -5126, -5629, 1835, -771 },
- { -5622, -4361, 2973, 858 },
- { -5282, -5895, 45, -335 },
- { -4357, -5656, 1696, -1558 },
- { -7139, -6659, 627, -409 },
- { -4415, -6328, 35, 1306 },
- { -7639, -6110, 1134, 197 },
- { -3626, -5592, 2019, 901 },
- { -3547, -5064, 1176, 1738 },
- { -5075, -3899, 2087, 266 },
- { -4086, -6311, 1479, 360 },
- { -6210, -5220, -199, -1477 },
- { -3910, -5063, 1356, -15 },
- { -7616, -4977, 461, 2401 },
- { -6118, -6131, 1258, -563 },
- { -6127, -4968, 1286, -27 },
- { -4121, -5852, 1113, 1476 },
- { -5157, -4881, 1162, -662 },
- { -4637, -5031, 1179, 709 },
- { -5509, -5452, -397, 1224 },
- { -4597, -6861, 646, 467 },
- { -6247, -4043, 468, 278 },
- { -5336, -6465, 874, -1472 },
- { -6998, -6346, 78, -1798 },
- { -4915, -4530, 2756, -203 },
- { -6048, -4373, 1468, 1052 },
- { -4273, -7100, 942, -323 },
- { -6552, -4287, 2351, 69 },
- { -6954, -4613, 722, 1521 },
- { -4201, -5361, 763, -1562 },
- { -6881, -5596, -748, 669 },
- { -6695, -3547, -34, 1299 },
- { -3981, -5728, 84, 111 },
- { -4663, -4809, 2173, -1031 },
- { -6599, -6077, 1303, 256 },
- { -7596, -4265, -5791, -4140 },
- { -6610, -2758, -5288, -3936 },
- { -5880, -3865, -6563, -3088 },
- { -7228, -5510, -7677, -3912 },
- { -8854, -6553, -8318, -5361 },
- { -9362, -5249, -6413, -4319 },
- { -4418, -3110, -6368, -4358 },
- { -5544, -4203, -6863, -5013 },
- { -3056, -4316, -5567, -3181 },
- { -3078, -5999, -5051, -2657 },
- { -5884, -6292, -5756, -4013 },
- { -4825, -4549, -5535, -4053 },
- { -4443, -6126, -5316, -1368 },
- { -3972, -6341, -6098, -2686 },
- { -5751, -2781, -5398, -6230 },
- { -4466, -6135, -5570, -3679 },
- { -4291, -5992, -3564, -5189 },
- { -7189, -4429, -7279, -6082 },
- { -5076, -4433, -2748, -5366 },
- { -6225, -2825, -6833, -5663 },
- { -2989, -4792, -3960, -4492 },
- { -7836, -7773, -7722, -5741 },
- { -6559, -5703, -5844, -5589 },
- { -7612, -5438, -4136, -3774 },
- { -4218, -4176, -6591, -2333 },
- { -4837, -5063, -6581, 322 },
- { -6590, -5990, -2980, -3847 },
- { -5558, -2971, -5489, -1932 },
- { -7001, -5323, -4975, -1697 },
- { -4694, -2688, -6904, -3044 },
- { -8511, -5379, -5767, -2549 },
- { -7548, -5412, -6522, -2572 },
- { -6597, -4973, -6423, -1274 },
- { -6415, -4022, -5168, -1072 },
- { -5528, -5530, -7218, -2345 },
- { -4845, -4805, -5943, -1227 },
- { -6049, -7150, -6744, -2161 },
- { -9061, -7299, -8542, -4375 },
- { -5010, -5546, -5416, -82 },
- { -4135, -4205, -5109, -3373 },
- { -3311, -5869, -4007, -5061 },
- { -5993, -6472, -3962, -4718 },
- { -2966, -5832, -2821, -6305 },
- { -4851, -5152, -2067, -3930 },
- { -3620, -4441, -3362, -5836 },
- { -4469, -5221, -4534, -5592 },
- { -4022, -6335, -4321, -6107 },
- { -4899, -4503, -3084, -3725 },
- { -4490, -8276, -4620, -6236 },
- { -6591, -4342, -7365, -4063 },
- { -6498, -5057, -5553, 485 },
- { -6060, -2714, -7093, -4144 },
- { -6199, -7774, -7094, -4057 },
- { -7536, -6424, -6415, -4265 },
- { -7439, -2454, -6348, -4827 },
- { -5333, -7565, -4417, -4639 },
- { -4353, -7103, -4197, -2689 },
- { -5229, -6549, -5129, -6804 },
- { -6129, -7701, -5236, -4836 },
- { -6797, -3983, -3884, -4406 },
- { -6624, -4467, -4745, -5052 },
- { -3324, -7596, -2720, -6553 },
- { -5473, -6284, -1704, -4511 },
- { -4131, -7263, -3180, -5196 },
- { -7116, -5565, -3469, 685 },
- { -6002, -6021, -3858, 576 },
- { -3144, -8203, -1291, -434 },
- { -6096, -7027, -4004, 1353 },
- { -3943, -7709, -2344, -36 },
- { -4510, -6767, -2642, 631 },
- { -3657, -11541, -2570, -3984 },
- { -5959, -8854, -1333, -867 },
- { -6699, -8866, -1606, -344 },
- { -3836, -7961, -2334, -2028 },
- { -3430, -8045, -3037, -672 },
- { -3868, -9184, -3635, -1819 },
- { -4258, -9060, -2621, -1008 },
- { -3595, -8693, -2022, -752 },
- { -4573, -8048, -3166, -2622 },
- { -4852, -7903, -1405, 256 },
- { -4591, -7057, -1560, 965 },
- { -6963, -7655, -980, 808 },
- { -5179, -6641, -3356, 1196 },
- { -7102, -6941, -2798, 2123 },
- { -6867, -5834, -3320, -770 },
- { -5977, -7369, -2500, -778 },
- { -6160, -6400, -934, -2543 },
- { -6741, -7608, -355, -1289 },
- { -6856, -6466, -1433, -1643 },
- { -4786, -6292, -4970, 376 },
- { -5407, -8866, -2255, -400 },
- { -3814, -6506, -1387, -3620 },
- { -4998, -6137, -1200, -4092 },
- { -5123, -9557, -2849, -1306 },
- { -4259, -6444, -4395, -338 },
- { -5221, -6810, -883, 1225 },
- { -6137, -6215, -2165, 554 },
- { -3895, -6557, -3176, -1829 },
- { -3886, -8188, -87, -954 },
- { -7243, -6707, -2216, -316 },
- { -5592, -7606, 85, -432 },
- { -3957, -7945, -504, -144 },
- { -4617, -7624, 218, -312 },
- { -4797, -8737, -844, -1051 },
- { -4478, -8516, -1401, -454 },
- { -4557, -7058, -302, -2332 },
- { -6623, -7736, -271, -50 },
- { -3157, -7532, -1111, -2207 },
- { -3590, -7300, -1271, 517 },
- { -4442, -7306, -507, 590 },
- { -6458, -7524, -2807, 666 },
- { -4991, -8466, -3363, -785 },
- { -7474, -7541, -1056, -1839 },
- { -7501, -8316, -938, -180 },
- { -5329, -7739, -579, -2341 },
- { -4549, -7063, -176, -3539 },
- { -5191, -8612, -1504, -4250 },
- { -3083, -7058, -2251, 32 },
- { -4003, -7043, -1093, -791 },
- { -5523, -8093, -678, -114 },
- { -3022, -10265, -2070, -3109 },
- { -3905, -6274, -182, -3652 },
- { -3269, -9217, -551, -2650 },
- { -3138, -9314, -1726, -1704 },
- { -4420, -10339, -1744, -3459 },
- { -4163, -8609, -2298, -4113 },
- { -5566, -6505, -1241, -463 },
- { -3130, -9746, -2352, -4884 },
- { -7825, -3439, 1451, -1468 },
- { -8451, -3318, 2360, -435 },
- { -8462, -4130, 1438, -1024 },
- { -9425, -4564, 1328, -689 },
- { -11014, -3202, 2278, 2080 },
- { -8269, -2761, -146, -440 },
- { -7497, -2618, -166, 413 },
- { -8250, -3060, 522, -2133 },
- { -8365, -5366, 1347, -451 },
- { -8589, -3979, 2943, 714 },
- { -8111, -2572, 1272, -1748 },
- { -7830, -5193, 605, -1484 },
- { -8119, -4736, 2141, 256 },
- { -7724, -4769, 1463, -812 },
- { -7363, -3911, 2540, 4 },
- { -7974, -3397, 2363, 1366 },
- { -7359, -4204, 1752, -958 },
- { -7622, -3505, 660, 916 },
- { -9934, -3665, 3165, 828 },
- { -8721, -4162, 62, 1718 },
- { -9433, -4768, 2722, 1234 },
- { -7960, -4496, 138, 1528 },
- { -8198, -3454, -443, 631 },
- { -7756, -2246, 655, 1137 },
- { -8841, -3145, 1113, 829 },
- { -7817, -3298, 1251, 230 },
- { -9413, -2733, 323, -1862 },
- { -9408, -4168, 1270, 1549 },
- { -9037, -3892, -942, 283 },
- { -8255, -3849, 1301, 1762 },
- { -9057, -3987, -41, -682 },
- { -9441, -4187, 2019, -111 },
- { -9740, -3178, 1602, -871 },
- { -8344, -2474, 1461, 1506 },
- { -9752, -2925, 1996, 1243 },
- { -9199, -3796, 180, 537 },
- { -9060, -2405, 1140, -1562 },
- { -9348, -2376, 309, -162 },
- { -10786, -3182, -5, -1500 },
- { -8142, -4540, -434, -826 },
- { -7528, -2341, 1104, -73 },
- { -9360, -2658, 3062, 56 },
- { -8267, -2335, 2000, -1193 },
- { -12169, -3154, 1287, -640 },
- { -11398, -2120, 946, -1163 },
- { -8940, -4559, 328, -1696 },
- { -11025, -4213, 2813, 840 },
- { -9224, -3581, 2224, 2039 },
- { -8943, -3337, 1248, -1298 },
- { -7900, -4042, 485, -2080 },
- { -9221, -1947, 2191, -880 },
- { -10762, -1800, 2516, -324 },
- { -10095, -2238, 981, -1335 },
- { -11908, -2808, 3255, 645 },
- { -10640, -4105, 1283, -595 },
- { -7663, -2863, 2467, -797 },
- { -10712, -3854, 3710, 1538 },
- { -10823, -2893, 1408, -801 },
- { -9874, -3832, 256, -1638 },
- { -10394, -3391, 2315, -94 },
- { -11525, -4079, 4153, 2122 },
- { -9546, -2088, 1541, 481 },
- { -8731, -2433, 1042, 2160 },
- { -7852, -3977, -1370, 1677 },
- { 7072, -3420, 1398, -1741 },
- { 6180, -1976, 1280, -3557 },
- { 7692, -1793, 2844, -1700 },
- { 8363, -1773, 3104, -2679 },
- { 9213, -3266, 3756, -3542 },
- { 9650, -2644, 1426, -1318 },
- { 7712, -2796, 3686, -1975 },
- { 7316, -3517, 2821, -622 },
- { 7434, -2594, 2305, -2264 },
- { 7237, -1797, 255, -3114 },
- { 8663, -1983, 1338, -3056 },
- { 6616, -952, 4059, -2652 },
- { 8823, -1327, 1362, -1356 },
- { 9938, -1722, 1287, -2362 },
- { 7207, -1057, 1913, -1315 },
- { 7508, -1585, 870, -1982 },
- { 8217, -3680, 1417, -3170 },
- { 8329, -2541, 1684, -585 },
- { 8062, -2335, 252, -2800 },
- { 8204, -4108, 3097, -2569 },
- { 7701, -3367, 576, -3008 },
- { 7350, -786, 2414, -2129 },
- { 6948, -2568, 1607, -225 },
- { 7684, -2387, 1308, -3449 },
- { 8306, -3458, 2394, -1454 },
- { 8438, -2781, 1043, -1362 },
- { 9175, -2076, 2144, -1987 },
- { 8347, -2709, 3489, -4301 },
- { 5696, -2377, 2870, 851 },
- { 8825, -1243, 2219, -2603 },
- { 8801, -1614, 584, -2513 },
- { 8413, -384, 1421, -2244 },
- { 9228, -3050, 3279, -2164 },
- { 6342, -2698, 3547, -107 },
- { 10053, -2476, 2837, -3168 },
- { 7439, -604, 3177, -3991 },
- { 7749, -1064, 4329, -4855 },
- { 8655, -2177, 2252, -3519 },
- { 8490, -228, 1958, -3233 },
- { 10513, -2968, 1911, -2340 },
- { 8146, -862, 1884, -1723 },
- { 7788, -666, 3004, -2891 },
- { 7785, -1620, 4133, -3417 },
- { 10262, -3731, 3455, -2971 },
- { 8570, -905, 4519, -4649 },
- { 9129, -2562, 463, -2465 },
- { 9451, -3587, 1904, -3056 },
- { 6549, -2236, 3010, -4523 },
- { 7175, -2684, 2967, -3458 },
- { 9872, -3278, 1054, -2472 },
- { 9153, -931, 1217, -2565 },
- { 8789, -3469, 753, -2568 },
- { 6683, -3791, 1797, -3968 },
- { 6801, -1977, 2311, -452 },
- { 6336, -1572, 2612, -3264 },
- { 7996, -1008, 730, -2964 },
- { 7521, -1059, 1573, -3694 },
- { 8148, -3973, 2600, -3572 },
- { 7765, -1532, 2528, -3856 },
- { 7404, -3918, 4472, -143 },
- { 8894, -1398, 3299, -3685 },
- { 5768, -2041, 1487, -637 },
- { 5131, -2865, 2463, -811 },
- { 6439, -1568, 3500, -1550 },
- { -8878, -6798, -5319, -1452 },
- { -6332, -9713, -3112, -990 },
- { -8444, -6316, -3694, -687 },
- { -6123, -10840, -3637, -4358 },
- { -4784, -9580, -4577, -2581 },
- { -6108, -10515, -4859, -2524 },
- { -7605, -7518, -2327, -2797 },
- { -9662, -8775, -2467, -2010 },
- { -6494, -7523, -4715, -118 },
- { -8290, -8982, -1672, -317 },
- { -8798, -11051, -3888, -1426 },
- { -6273, -6623, -6791, -142 },
- { -8313, -7668, -2141, -1275 },
- { -6453, -8412, -3589, -4102 },
- { -6747, -7750, -5690, -2498 },
- { -7814, -6693, -3174, -2446 },
- { -10383, -10130, -3931, -2364 },
- { -10606, -8467, -5539, -2772 },
- { -9475, -6671, -3305, -2271 },
- { -8982, -9457, -5635, -4005 },
- { -10111, -7965, -6515, -4180 },
- { -7301, -6479, -5364, 720 },
- { -9543, -8999, -7921, -912 },
- { -9534, -8562, -3469, -384 },
- { -7601, -10344, -3205, -1127 },
- { -8088, -8620, -4954, -2888 },
- { -8202, -8406, -7038, -3775 },
- { -7312, -8324, -3334, -1775 },
- { -8566, -9262, -8071, -4174 },
- { -7068, -11300, -5573, -2907 },
- { -8295, -8952, -4366, -1544 },
- { -11104, -10210, -2285, -384 },
- { -5213, -7520, -5008, -1339 },
- { -5889, -7940, -5987, -1385 },
- { -10816, -8201, -4153, -1485 },
- { -10277, -8919, -6315, -1652 },
- { -5888, -10320, -3821, -1733 },
- { -10497, -7181, -6083, -3032 },
- { -7721, -9724, -6591, -5336 },
- { -5688, -7894, -3486, -2552 },
- { -10014, -10500, -3247, -820 },
- { -6301, -8765, -4506, -2923 },
- { -8261, -7847, -6213, -1552 },
- { -10212, -7481, -8113, -3954 },
- { -6938, -10874, -6074, -4703 },
- { -7183, -10968, -4446, -1773 },
- { -7120, -9193, -1966, -2509 },
- { -6234, -9263, -2313, -4284 },
- { -8503, -9857, -2429, -608 },
- { -9372, -7844, -8391, -2120 },
- { -7951, -7157, -6535, -11 },
- { -7256, -9473, -2172, -660 },
- { -10063, -9612, -2515, -15 },
- { -6684, -9134, -6109, -4206 },
- { -8204, -11932, -5220, -2306 },
- { -9710, -6706, -4115, -3275 },
- { -6855, -7078, -2409, -4447 },
- { -7344, -7673, -4479, -4116 },
- { -8851, -6842, -4927, -2948 },
- { -8927, -10452, -5633, -2194 },
- { -8627, -9002, -7176, -1575 },
- { -8209, -9722, -7021, -3324 },
- { -3770, -10249, -3623, -4816 },
- { -8183, -7465, -4090, 646 },
- { -8163, -7149, 200, 498 },
- { -8289, -6266, 686, -206 },
- { -10030, -6241, -1032, -1864 },
- { -8793, -8327, -773, -169 },
- { -9149, -6215, 969, -15 },
- { -8303, -5859, -7, 2006 },
- { -9682, -7283, 255, 1322 },
- { -9293, -7227, 71, -231 },
- { -8525, -6215, 287, -837 },
- { -10477, -5379, 1159, 1449 },
- { -10726, -7856, -130, 102 },
- { -8694, -7461, -1210, 690 },
- { -9367, -5324, 1103, 3170 },
- { -10686, -8055, -831, 1633 },
- { -9201, -6873, -2704, 2258 },
- { -8421, -5358, -1405, 226 },
- { -9066, -5830, -307, -1571 },
- { -11150, -7381, -2746, -900 },
- { -9978, -5925, -2006, -437 },
- { -9464, -4741, -273, 1061 },
- { -10543, -6684, -1113, 1660 },
- { -10073, -5576, 1083, -269 },
- { -8826, -5763, 1600, 1486 },
- { -10445, -9071, -1253, -64 },
- { -12085, -5799, 2, 769 },
- { -12939, -6663, 1650, 1437 },
- { -10932, -6434, -1252, -649 },
- { -11650, -7826, -2053, 710 },
- { -12122, -6733, -1889, -731 },
- { -9093, -6095, -2463, -842 },
- { -10977, -4364, 469, 420 },
- { -11488, -6908, -521, 893 },
- { -9669, -5478, -842, 337 },
- { -10606, -5203, -632, -1361 },
- { -10198, -6284, 1662, 1277 },
- { -10135, -5292, 2435, 3493 },
- { -11027, -6561, 655, 56 },
- { -10977, -5030, 1127, -358 },
- { -12766, -3986, 1348, -335 },
- { -14244, -7731, 264, 317 },
- { -15124, -10309, -508, 1447 },
- { -12821, -8638, -608, 137 },
- { -13076, -8693, -2852, -431 },
- { -11156, -5546, -2252, -1600 },
- { -8692, -7366, -819, -1223 },
- { -12507, -9816, -1714, -121 },
- { -10712, -6666, 544, 3349 },
- { -12462, -5890, -2491, -2318 },
- { -12468, -7226, 437, 232 },
- { -11300, -5226, 2068, 687 },
- { -11994, -8320, -626, 2728 },
- { -12222, -5476, 1142, 18 },
- { -10277, -8122, -2418, 2003 },
- { -13418, -6115, -3563, -2802 },
- { -14759, -9834, -1243, 21 },
- { -13699, -5665, 1525, 507 },
- { -16269, -9476, -701, 163 },
- { -12677, -5437, -247, -1019 },
- { -11827, -4295, -181, -1243 },
- { -12847, -4496, 2984, 1123 },
- { -13860, -7915, -1166, -547 },
- { -12276, -8145, -2290, -1527 },
- { -11417, -4830, 2983, 1854 },
- { -11793, -6002, 1163, 1940 },
- { 11443, -4920, -3235, 3151 },
- { 11300, -6616, -1506, 1175 },
- { 9198, -4628, -2060, 2390 },
- { 10532, -4027, -643, 912 },
- { 9902, -3573, -1606, 1327 },
- { 9653, -3536, -2240, 1869 },
- { 9948, -5171, -423, 2662 },
- { 12316, -4004, -1989, 281 },
- { 12125, -4800, -1265, -163 },
- { 10650, -2617, -2337, 1462 },
- { 9909, -4968, -2376, 916 },
- { 12944, -4647, -1958, 460 },
- { 12988, -5283, -1141, 41 },
- { 12321, -2915, -3621, 1025 },
- { 11449, -2894, -2728, 351 },
- { 12087, -3041, -2002, -32 },
- { 11558, -4031, -1343, -399 },
- { 12983, -3740, -3516, 1245 },
- { 12099, -2515, -2752, 225 },
- { 12515, -3465, -2701, 550 },
- { 14683, -5022, -5272, 2996 },
- { 12260, -3383, -1215, -528 },
- { 13810, -5422, -2443, 1166 },
- { 13421, -5378, -1886, 721 },
- { 12961, -4259, -2594, 796 },
- { 12266, -2104, -4768, 1591 },
- { 13523, -4710, -3045, 1342 },
- { 12437, -2099, -5610, 2117 },
- { 11850, -2183, -3497, 661 },
- { 12275, -3936, -597, -697 },
- { 12459, -5253, -517, -544 },
- { 12835, -4094, -1322, -168 },
- { 14360, -5677, -3305, 1859 },
- { 13905, -4552, -4309, 2117 },
- { 11559, -3412, -1847, -81 },
- { 13379, -3167, -5764, 2746 },
- { 11910, -1634, -4342, 1052 },
- { 12662, -4742, 71, -974 },
- { 13057, -3254, -4424, 1705 },
- { 15046, -5706, -4851, 3019 },
- { 14162, -4142, -5514, 2843 },
- { 12764, -1845, -6684, 2888 },
- { 13714, -2374, -7838, 3857 },
- { 13295, -1663, -8293, 4073 },
- { 10032, -4152, -3403, 1421 },
- { 10942, -5386, -2222, 950 },
- { 10532, -6385, -1750, 1925 },
- { 10273, -5972, -1534, 643 },
- { 10605, -4782, -1695, 27 },
- { 10988, -5153, -1123, -341 },
- { 11629, -5884, -1060, 48 },
- { 10441, -4045, -2431, 311 },
- { 10788, -3595, -4171, 1807 },
- { 12110, -5686, -2127, 976 },
- { 11746, -4773, -2639, 891 },
- { 11541, -5299, -3031, 1732 },
- { 11416, -2559, -5359, 2198 },
- { 11583, -5376, -704, 677 },
- { 10416, -3214, -3516, 872 },
- { 9651, -5435, -1618, 3255 },
- { 9973, -5133, -996, 3923 },
- { 11707, -4643, -430, -796 },
- { 10994, -2709, -3587, 2302 },
- { 10716, -5118, -645, 270 },
- { 14100, -10314, 1095, 1531 },
- { 12944, -8049, 1105, -741 },
- { 13276, -7035, -511, 274 },
- { 14008, -7254, -283, 139 },
- { 11594, -6536, -91, 1671 },
- { 11732, -8645, 746, 15 },
- { 14613, -7085, -1578, 1183 },
- { 13083, -6224, -750, -4 },
- { 13988, -6256, -1592, 820 },
- { 14678, -8683, 441, 126 },
- { 15571, -8872, -521, 1139 },
- { 15642, -9533, 341, 697 },
- { 15960, -9586, -168, 1121 },
- { 15464, -10239, 1433, -1 },
- { 14934, -7887, -1046, 1080 },
- { 15252, -7630, -1899, 1628 },
- { 15485, -8384, -1234, 1484 },
- { 15962, -8638, -1815, 1931 },
- { 16501, -10664, 398, 1167 },
- { 16146, -10145, 411, 918 },
- { 14573, -7475, -697, 601 },
- { 14302, -7996, 28, 257 },
- { 14769, -6792, -2286, 1574 },
- { 14144, -6137, -2169, 1257 },
- { 14770, -6271, -3111, 1933 },
- { 14110, -8312, 1083, -531 },
- { 15235, -6991, -2993, 2174 },
- { 13222, -5805, 547, -891 },
- { 14796, -8762, 1254, -246 },
- { 16040, -9181, -1005, 1551 },
- { 16487, -10086, -373, 1420 },
- { 15077, -9479, 966, 51 },
- { 13026, -6468, 932, -1080 },
- { 12703, -6152, -33, -573 },
- { 15641, -6810, -4128, 2874 },
- { 13282, -7673, 1583, -1283 },
- { 12373, -7150, 1512, -917 },
- { 12992, -7751, -678, 783 },
- { 10907, -6858, -313, 2597 },
- { 13026, -8963, 125, 2152 },
- { 12770, -9946, 1957, -505 },
- { 12482, -6849, -1268, 833 },
- { 13790, -6181, -138, -279 },
- { 12709, -8382, 2044, 227 },
- { 12244, -6630, 203, -457 },
- { 14209, -6816, -1032, 632 },
- { 15134, -8267, -288, 640 },
- { 13619, -6157, -1090, 356 },
- { 14044, -7413, 725, -484 },
- { 12958, -7753, 2585, -1980 },
- { 13188, -8396, 2306, -1558 },
- { 14379, -9980, 2132, -688 },
- { 14275, -9857, 1162, 179 },
- { 13690, -8648, 1621, -889 },
- { 11770, -6829, -746, 278 },
- { 12732, -8202, 286, 90 },
- { 13630, -10146, 1867, -207 },
- { 12072, -8740, 1299, -645 },
- { 12852, -9492, 1226, 62 },
- { 11792, -7382, -54, -116 },
- { 13779, -9014, 487, 351 },
- { 11951, -7729, 121, 834 },
- { 11970, -9781, 2276, -4 },
- { 12680, -7984, 2787, -787 },
- { 13300, -14488, 6408, -1927 },
- { 13635, -15355, 9153, -3073 },
- { 12804, -13566, 5517, -1625 },
- { 16624, -10854, 1690, 28 },
- { 20387, -18532, 6162, -261 },
- { 16515, -12642, 3392, -519 },
- { 15800, -11095, 2151, -202 },
- { 16824, -11790, 1651, 599 },
- { 17604, -13213, 2563, 538 },
- { 17892, -14177, 3562, 147 },
- { 16987, -11399, 869, 1052 },
- { 17003, -12456, 2442, 265 },
- { 21657, -21806, 9198, -1250 },
- { 16825, -13341, 3980, -686 },
- { 17525, -12714, 1887, 805 },
- { 16419, -11034, 1216, 617 },
- { 20931, -19939, 7469, -684 },
- { 18452, -15390, 4573, -191 },
- { 14778, -10077, 2841, -1209 },
- { 17402, -13319, 3042, 160 },
- { 19365, -17922, 7087, -1061 },
- { 16298, -11941, 2810, -351 },
- { 19087, -16176, 4775, -84 },
- { 17666, -12289, 938, 1224 },
- { 18581, -15894, 5132, -430 },
- { 19823, -16717, 4142, 545 },
- { 19960, -19423, 8400, -1492 },
- { 18973, -16817, 5906, -594 },
- { 19079, -15431, 3528, 503 },
- { 16667, -12485, 4467, -1302 },
- { 19791, -17797, 6196, -529 },
- { 20005, -17606, 5354, -20 },
- { 20123, -18599, 6886, -728 },
- { 19068, -14805, 2394, 1105 },
- { 14443, -13723, 5631, -2029 },
- { 14730, -14231, 5631, -1450 },
- { 16089, -15959, 7271, -2029 },
- { 13473, -11200, 3236, -924 },
- { 14413, -10902, 2347, -267 },
- { 17666, -18662, 11381, -3496 },
- { 14749, -11042, 3305, -275 },
- { 15304, -10486, 1869, -240 },
- { 14809, -12126, 3369, -616 },
- { 16896, -16561, 7307, -1845 },
- { 15782, -14336, 5380, -1264 },
- { 16395, -15520, 6415, -1588 },
- { 13681, -11114, 2584, -320 },
- { 14244, -12326, 4480, -1632 },
- { 15247, -13119, 4265, -898 },
- { 13987, -12091, 3469, -597 },
- { 13941, -12770, 4240, -839 },
- { 13771, -13627, 5252, -1384 },
- { 15010, -16074, 7592, -2249 },
- { 15852, -17226, 8619, -2655 },
- { 18921, -16916, 6875, -1501 },
- { 14909, -11678, 2768, -295 },
- { 18988, -18353, 8424, -2070 },
- { 15457, -15080, 6218, -1513 },
- { 14916, -15512, 6949, -1883 },
- { 18108, -14702, 4681, -701 },
- { 17600, -15733, 5616, -775 },
- { 14070, -13683, 6472, -2626 },
- { 13832, -11914, 5201, -2232 },
- { 18846, -19009, 9192, -1961 },
- { -11981, -10994, -6324, -2264 },
- { -10976, -9047, -6546, -3828 },
- { -11288, -10532, -7014, -4191 },
- { -10139, -10189, -7799, -2688 },
- { -10555, -9988, -9181, -2040 },
- { -11596, -11339, -10022, -2707 },
- { -13400, -13395, -11306, -4206 },
- { -9774, -12281, -7466, -4133 },
- { -10842, -13125, -8777, -4956 },
- { -11964, -15082, -9779, -5095 },
- { -9382, -10188, -9053, -4927 },
- { -11562, -11296, -3651, -985 },
- { -9287, -10083, -7918, -4069 },
- { -12821, -16556, -11410, -6195 },
- { -12628, -8959, -4521, -1113 },
- { -13845, -11581, -3649, -681 },
- { -12685, -10269, -5483, -1275 },
- { -14988, -12874, -5107, -1189 },
- { -13761, -11367, -6202, -1804 },
- { -13225, -11249, -7820, -3354 },
- { -14809, -11992, -3202, -312 },
- { -15620, -15519, -10210, -3433 },
- { -12954, -10200, -3139, -611 },
- { -11536, -9981, -5284, -923 },
- { -13034, -12417, -4612, -1098 },
- { -16911, -15505, -6123, -1352 },
- { -17396, -17685, -8330, -2171 },
- { -14120, -10764, -2265, -99 },
- { -12598, -7367, -5406, -3530 },
- { -14143, -12793, -10909, -5226 },
- { -14692, -16871, -11626, -5554 },
- { -12581, -11197, -9194, -3837 },
- { -16752, -16726, -9746, -2808 },
- { -10600, -10358, -6560, -1227 },
- { -14573, -13312, -8957, -3393 },
- { -10172, -8463, -8579, -3387 },
- { -11418, -12421, -5522, -1842 },
- { -11855, -14204, -6669, -2625 },
- { -13308, -8191, -3941, -2194 },
- { -10007, -12266, -5022, -1811 },
- { -13532, -15771, -9497, -3175 },
- { -11760, -11148, -10339, -5529 },
- { -12149, -12763, -11198, -3697 },
- { -12029, -12119, -8555, -1792 },
- { -16995, -19957, -11447, -3471 },
- { -13144, -14504, -9988, -3191 },
- { -9938, -11064, -6139, -3162 },
- { -8873, -11550, -8294, -6550 },
- { -9303, -13010, -6150, -2711 },
- { -15463, -10469, -1766, -170 },
- { -15985, -11693, -3007, -650 },
- { -17142, -10671, -1434, 47 },
- { -16063, -13858, -4817, -1058 },
- { -19446, -19599, -9594, -2464 },
- { -20076, -18744, -8313, -1889 },
- { -15047, -16085, -7590, -2250 },
- { -13481, -16195, -8552, -2998 },
- { -13829, -14869, -6704, -1932 },
- { -16357, -18484, -9802, -2959 },
- { -10551, -8393, -9303, -5070 },
- { -11345, -9156, -5641, -3107 },
- { -13217, -13449, -9270, -4541 },
- { -11988, -13732, -9995, -6374 },
- { -11007, -9519, -5168, -4107 },
- { 9930, -7858, 8061, -4375 },
- { 8274, -7867, 5992, -2096 },
- { 9692, -9675, 7621, -3670 },
- { 9589, -8110, 6509, -3010 },
- { 12617, -11976, 10122, -5360 },
- { 11867, -8895, 7948, -5323 },
- { 10388, -10482, 9234, -4324 },
- { 8188, -8220, 7810, -2737 },
- { 10407, -8787, 4806, -1930 },
- { 10348, -8845, 9233, -6614 },
- { 9422, -7091, 4820, -2878 },
- { 9758, -9796, 5584, -2256 },
- { 10188, -7994, 5347, -3343 },
- { 11133, -7455, 4015, -2306 },
- { 10676, -10744, 6093, -2629 },
- { 11522, -12184, 7848, -3375 },
- { 8805, -9883, 5317, -3071 },
- { 9498, -9654, 6555, -3592 },
- { 10488, -8008, 4066, -1252 },
- { 11261, -8930, 6068, -2738 },
- { 12180, -10397, 5027, -1531 },
- { 9138, -8531, 3601, -1959 },
- { 8107, -8380, 4970, -2061 },
- { 9737, -13248, 6438, -2617 },
- { 11178, -10423, 2622, -522 },
- { 9572, -12372, 5199, -2019 },
- { 12057, -12144, 4147, -1099 },
- { 9047, -9925, 2516, -665 },
- { 10790, -8030, 5882, -4386 },
- { 7199, -8426, 6337, -2841 },
- { 7778, -8285, 3529, -3442 },
- { 7559, -10569, 3484, -1332 },
- { 9404, -8115, 7484, -5541 },
- { 7792, -11976, 5546, -2573 },
- { 9313, -10264, 7661, -5195 },
- { 6701, -10725, 4370, -1784 },
- { 4918, -11361, 4507, -4527 },
- { 5147, -12305, 3978, -5556 },
- { 6525, -9899, 4481, -3129 },
- { 7538, -12855, 6060, -4826 },
- { 8659, -12111, 7159, -4430 },
- { 8440, -11304, 4547, -1747 },
- { 9216, -10918, 3507, -1195 },
- { 6165, -9254, 4771, -4677 },
- { 9163, -11019, 5637, -4935 },
- { 13441, -11509, 6676, -2434 },
- { 7912, -9398, 6663, -4048 },
- { 11723, -13745, 8131, -4148 },
- { 6065, -10257, 5005, -6327 },
- { 11618, -12417, 5336, -1894 },
- { 8891, -13924, 8407, -6131 },
- { 9622, -12563, 7908, -5109 },
- { 11479, -10315, 8349, -3991 },
- { 11676, -14103, 6611, -2330 },
- { 11951, -8953, 3829, -1550 },
- { 10486, -8044, 10493, -5920 },
- { 11801, -10769, 9763, -5305 },
- { 6109, -8676, 5827, -1346 },
- { 7030, -9611, 5624, -5761 },
- { 12808, -12886, 8683, -4148 },
- { 13213, -10464, 6381, -3189 },
- { 11796, -13681, 10703, -6075 },
- { 9639, -7949, 9625, -3944 },
- { 8538, -6997, 5309, 453 }
+ { 9928, -2618, -1093, -1263 },
+ { 11077, -2876, -1747, -308 },
+ { 10503, -1082, -1426, -1167 },
+ { 9337, -2403, -1495, 274 },
+ { 10698, -2529, -532, -1122 },
+ { 10368, -3974, -1264, -750 },
+ { 10070, -3667, 346, 863 },
+ { 10278, -3093, 311, -576 },
+ { 9894, -1330, -1428, -860 },
+ { 10544, -1923, -1058, -971 },
+ { 10996, -1632, -841, -1404 },
+ { 11832, -3465, 1658, -1990 },
+ { 10852, -688, -2658, -499 },
+ { 10546, -1749, -147, -1733 },
+ { 10801, -1004, -708, -1453 },
+ { 10588, -441, -2113, -952 },
+ { 10141, -3331, -582, -1432 },
+ { 9608, -2590, 383, 258 },
+ { 11422, -3265, 229, -1544 },
+ { 10460, -1338, -713, -1568 },
+ { 10306, -1721, -1660, -603 },
+ { 9580, -1812, -1235, -1061 },
+ { 11471, -2285, -1617, -607 },
+ { 10081, -2225, -1408, -868 },
+ { 10715, -2624, -1367, -704 },
+ { 10616, -1871, -2770, -35 },
+ { 9352, -2340, -1024, -1566 },
+ { 11065, -1458, -1926, -735 },
+ { 11334, -2056, -1041, -1144 },
+ { 9825, -2048, -794, -1536 },
+ { 11850, -2695, -1123, -867 },
+ { 10654, -2226, -1891, -373 },
+ { 10024, -1557, -808, -1069 },
+ { 11142, -1266, -3238, 128 },
+ { 11729, -3282, -514, -1011 },
+ { 11402, -2094, -2335, -189 },
+ { 10195, -3658, 181, -1875 },
+ { 11431, -2626, -404, -1377 },
+ { 11001, -3868, -619, -1077 },
+ { 10894, -2559, 274, -1758 },
+ { 9633, -1482, -2253, -773 },
+ { 11245, -3321, 830, -1972 },
+ { 9768, -2701, -199, -1859 },
+ { 10500, -2042, 525, -2043 },
+ { 11669, -4069, 293, -1468 },
+ { 9192, -1991, -583, -61 },
+ { 10057, -3220, -2015, -473 },
+ { 9497, -2315, -2490, -467 },
+ { 10455, -3069, -1194, -1007 },
+ { 9994, -1936, -60, -1225 },
+ { 9295, -2156, -1761, -1134 },
+ { 10085, -3748, -1026, 197 },
+ { 9334, -2360, 804, -351 },
+ { 11561, -2553, 1352, -2313 },
+ { 12837, -3998, 1195, -1958 },
+ { 10114, -1100, -2414, -394 },
+ { 9341, -2530, 315, 755 },
+ { 10131, -3164, 1411, -674 },
+ { 9535, -905, -1551, 579 },
+ { 11717, -1519, -3051, 91 },
+ { 9824, -2911, -2775, 192 },
+ { 9662, -2934, -561, 1450 },
+ { 11085, -3392, -1298, -659 },
+ { 8955, -2102, -1899, 703 },
+ { 8607, -1742, -4348, 814 },
+ { 7640, -2063, -3617, 52 },
+ { 7074, -826, -4325, 4375 },
+ { 7714, 584, -4238, 1927 },
+ { 6355, -952, -4912, 3127 },
+ { 7069, -660, -6413, 4087 },
+ { 8313, -132, -2964, -876 },
+ { 6952, -1422, -3962, -24 },
+ { 9299, -734, -3088, -263 },
+ { 9484, -574, -4513, 466 },
+ { 7246, -91, -3735, -704 },
+ { 8325, -1417, -3090, -530 },
+ { 6469, -1226, -4757, 829 },
+ { 6652, -368, -5682, 1393 },
+ { 7971, -1278, -2284, 1205 },
+ { 7229, -699, -3556, 1840 },
+ { 7994, 1284, -2729, 732 },
+ { 9005, -698, -4522, 2189 },
+ { 6963, 197, -2727, 380 },
+ { 8527, 135, -3991, -213 },
+ { 8840, 934, -3014, -567 },
+ { 10125, 418, -3284, -371 },
+ { 6367, 361, -2318, 2554 },
+ { 7892, 172, -5247, 4673 },
+ { 6674, 387, -5424, 4398 },
+ { 6240, 684, -4047, 1219 },
+ { 11170, -794, -5081, 1195 },
+ { 11765, -648, -6265, 2052 },
+ { 10845, -775, -3837, 366 },
+ { 12496, -689, -8260, 3562 },
+ { 7893, -1166, -4972, 988 },
+ { 8592, 1052, -5986, 3087 },
+ { 7277, 1874, -5685, 3579 },
+ { 6900, 2016, -4809, 3491 },
+ { 8530, -2405, -3250, 1986 },
+ { 9426, 494, -7067, 5038 },
+ { 10285, 564, -8210, 5370 },
+ { 8749, -2207, -3980, 2852 },
+ { 9653, -2686, -4300, 1400 },
+ { 9770, -2286, -5663, 4233 },
+ { 8490, -4, -7048, 4496 },
+ { 7697, -1209, -5328, 3183 },
+ { 6451, 801, -4324, -554 },
+ { 7387, 1806, -5265, 545 },
+ { 7450, -2302, -4445, 1418 },
+ { 8817, -1370, -5827, 2168 },
+ { 10324, -2406, -5629, 2579 },
+ { 8863, -2578, -3537, 467 },
+ { 6901, -1624, -3169, 3392 },
+ { 7846, 156, -6948, 3381 },
+ { 7928, -1115, -5972, 4816 },
+ { 6089, -599, -4368, -320 },
+ { 7833, 1246, -3960, -621 },
+ { 8931, 2521, -6768, 2052 },
+ { 8900, 1944, -4126, 40 },
+ { 7661, -34, -2855, 2480 },
+ { 5873, 474, -3262, 3712 },
+ { 7535, -234, -4699, 216 },
+ { 5856, 143, -5142, 73 },
+ { 8944, -106, -5874, 3663 },
+ { 7134, 426, -5879, 2895 },
+ { 10199, 1011, -4762, 369 },
+ { 8454, 264, -5971, 1291 },
+ { 7822, -2449, -4333, 4540 },
+ { 6200, -2758, -2632, 1497 },
+ { 6070, -4315, -2699, 414 },
+ { 7047, -3739, -3210, 1060 },
+ { 5675, -3801, -2717, -407 },
+ { 4789, -4063, -2628, -744 },
+ { 4023, -3366, -3133, -726 },
+ { 4296, -2407, -3381, -513 },
+ { 4388, -2931, -2820, 1512 },
+ { 4559, -4233, -1941, 1976 },
+ { 6702, -3208, -1755, 1680 },
+ { 4416, -3521, -1052, 2984 },
+ { 7154, -4266, -1203, 3732 },
+ { 3625, -4242, -3244, 1395 },
+ { 6518, -2856, -1304, 2887 },
+ { 6170, -1949, -3014, 3973 },
+ { 5189, -2451, -4020, 3477 },
+ { 6218, -2988, -1921, 3844 },
+ { 4827, -3688, -1928, 3343 },
+ { 6668, -3991, -2805, 3095 },
+ { 5297, -3115, -3684, 2390 },
+ { 5354, -4614, -2662, 1504 },
+ { 4196, -3091, -4147, 1135 },
+ { 3540, -2893, -4007, 100 },
+ { 5569, -1602, -4007, 1909 },
+ { 4341, -2091, -4272, 252 },
+ { 5559, -2878, -3832, 498 },
+ { 4548, -4479, -2898, -27 },
+ { 5176, -2494, -4635, 1476 },
+ { 3294, -3485, -3738, 716 },
+ { 4920, -1229, -4195, -365 },
+ { 3257, -3518, -3349, 2862 },
+ { 5286, -1948, -3485, -778 },
+ { 6502, -3051, -152, 2854 },
+ { 5864, -4192, -1076, 3451 },
+ { 4656, -3122, -3448, 179 },
+ { 5907, -754, -1596, 3116 },
+ { 7229, -3680, -1590, 2892 },
+ { 5107, -3888, -3364, 806 },
+ { 6764, -2635, -3450, 134 },
+ { 5258, -2827, -2844, -1052 },
+ { 5798, -1725, -4305, 205 },
+ { 5404, -1213, -3362, 449 },
+ { 6224, -2738, -3046, -581 },
+ { 4223, -2438, -2725, 3745 },
+ { 4751, -3411, -2123, 116 },
+ { 3868, -3000, -3954, 2297 },
+ { 6819, -2899, -4277, 2825 },
+ { 4207, -4754, -2808, 865 },
+ { 4804, -1494, -1997, 4688 },
+ { 5282, -2213, -548, 3559 },
+ { 5580, -1912, -566, 4370 },
+ { 6168, -2857, -672, 4053 },
+ { 6583, -4515, -2850, 1670 },
+ { 6511, -3093, -3988, 1421 },
+ { 4646, -1790, -1443, 3650 },
+ { 5915, -924, -2020, 896 },
+ { 7814, -4181, -3152, 2007 },
+ { 6190, -2238, -4817, 2279 },
+ { 4737, -4034, -3288, 1835 },
+ { 8161, -3633, -3423, 3137 },
+ { 7415, -2351, -2088, 4290 },
+ { 4106, -2517, -62, 2905 },
+ { 4909, -3145, -614, 4112 },
+ { 4938, -3281, -397, 1100 },
+ { -173, 919, 1589, -5363 },
+ { -13, 796, -295, -6655 },
+ { -1860, -829, 1141, -4555 },
+ { 2298, -838, -664, -5005 },
+ { -884, -1097, 2074, -4613 },
+ { -101, 281, 2846, -4535 },
+ { 1166, 453, 2429, -5910 },
+ { 879, -664, 2370, -5452 },
+ { 1415, -370, -1699, -4727 },
+ { -1413, 1277, -669, -6649 },
+ { 2133, 304, -968, -4624 },
+ { 380, 586, -2087, -4892 },
+ { 1336, 275, -82, -5789 },
+ { -2459, 1057, -34, -5416 },
+ { 2278, -1758, 866, -5653 },
+ { 1945, -2295, -149, -5302 },
+ { 1287, -3525, 996, -5255 },
+ { 2297, 803, 1177, -6067 },
+ { 187, -180, -619, -6202 },
+ { -793, -2537, 1554, -5057 },
+ { -2703, -204, -629, -5853 },
+ { -1007, -146, 313, -5582 },
+ { 830, 357, 869, -6363 },
+ { -228, -575, -3177, -4433 },
+ { -1001, -1553, -142, -5708 },
+ { -1644, 1683, 1721, -4533 },
+ { 893, 1924, -15, -5791 },
+ { 2195, 2061, -262, -5471 },
+ { 3031, 270, 311, -5096 },
+ { 1912, 1638, -1523, -4677 },
+ { -3142, -55, 253, -4914 },
+ { 356, -1680, 343, -6123 },
+ { -2241, -1734, -976, -5939 },
+ { -2196, -2893, 547, -4938 },
+ { -1245, 126, -1916, -5419 },
+ { -249, -3755, -1422, -5594 },
+ { 575, -2683, -1926, -4566 },
+ { -762, 1885, 192, -5880 },
+ { -811, -2562, -1068, -6013 },
+ { -2264, -3086, -976, -4775 },
+ { 70, -1215, 2880, -4410 },
+ { 714, -3760, 2916, -4691 },
+ { -244, -3404, 1740, -4493 },
+ { 684, -5137, -328, -5608 },
+ { -529, -3825, -1786, -4535 },
+ { -713, -4743, -1118, -5546 },
+ { 2718, -3788, 1798, -5708 },
+ { -1639, -3679, -1564, -6095 },
+ { 1693, -2642, -1389, -4539 },
+ { 505, -1573, -1651, -4878 },
+ { -835, -2256, -1941, -5352 },
+ { 1464, -411, 1993, -6441 },
+ { 493, -3184, -145, -6148 },
+ { -1413, 499, -1617, -6479 },
+ { -294, 1722, -1419, -5725 },
+ { -2937, -1528, -175, -4624 },
+ { -594, -5911, -56, -6146 },
+ { -300, -4275, 1156, -5947 },
+ { 552, -2643, 2669, -3959 },
+ { 905, -4158, 1789, -5809 },
+ { 1336, -2009, 2108, -5903 },
+ { 1555, -3600, 1110, -6759 },
+ { -1294, -3464, 77, -6084 },
+ { -1139, -4006, -1270, -4181 },
+ { -5094, -3296, 1092, -2847 },
+ { -5503, -2883, 1984, -2067 },
+ { -4671, -4218, -1417, -4132 },
+ { -3763, -3818, 1262, -3082 },
+ { -5132, -3430, 2928, -728 },
+ { -5957, -2877, 1251, -2446 },
+ { -4425, -2319, -212, -4276 },
+ { -6201, -1993, 1774, -2182 },
+ { -5500, -3836, 2201, -1396 },
+ { -6934, -2334, 2366, -1293 },
+ { -6124, -4140, 1337, -1977 },
+ { -6553, -4186, 1756, -1325 },
+ { -5126, -1258, 744, -3656 },
+ { -5167, -1390, 1581, -2895 },
+ { -4525, -3398, 2429, -1865 },
+ { -4076, -3183, 2027, -2510 },
+ { -6191, -3274, 1838, -1814 },
+ { -4454, -2753, 2723, -1185 },
+ { -6655, -4797, 251, -2595 },
+ { -6332, -2232, 1832, 217 },
+ { -5869, -1698, 134, 340 },
+ { -6614, -1045, 2126, -1932 },
+ { -4859, -2107, 2010, -2435 },
+ { -6274, -1622, 2808, -1374 },
+ { -3119, -3209, 521, -3988 },
+ { -5676, -2082, -420, -2711 },
+ { -7073, -3623, 696, -2343 },
+ { -5986, -4224, 572, -2454 },
+ { -4340, -4521, 882, -2771 },
+ { -6178, -1933, 535, -1444 },
+ { -4923, -4163, 1744, -2066 },
+ { -6410, -1519, 1058, -2683 },
+ { -5077, -1185, 856, -2216 },
+ { -7091, -2444, 687, -2597 },
+ { -5284, -2165, 3239, -993 },
+ { -4763, -1497, 197, -3179 },
+ { -4128, -4958, -396, -3578 },
+ { -5054, -3878, -647, -2672 },
+ { -7005, -3348, 1679, -1579 },
+ { -5767, -1017, 2582, -1915 },
+ { -7069, -2787, 1331, -2070 },
+ { -5532, -2296, 706, -2950 },
+ { -5059, -3543, -821, -3637 },
+ { -6639, -1835, 1016, -696 },
+ { -5611, -5220, -694, -3371 },
+ { -5994, -2803, 2933, -729 },
+ { -5948, -619, 1596, -2676 },
+ { -5486, -4419, 153, -3265 },
+ { -4329, -3440, 1646, -1439 },
+ { -4083, -3978, 177, -3569 },
+ { -4289, -2599, 1224, -3075 },
+ { -5707, -3253, 1912, -759 },
+ { -6606, -3437, 2562, -571 },
+ { -5254, -2444, 769, -352 },
+ { -6545, -3154, 582, -1103 },
+ { -5328, -2241, 2566, -1775 },
+ { -7216, -1936, 1538, -1983 },
+ { -3730, -2451, 426, -3869 },
+ { -5110, -1385, 2031, -1169 },
+ { -6470, -2715, 269, -3123 },
+ { -5806, -2480, -97, -3832 },
+ { -3683, -4916, -490, -4330 },
+ { -6341, -2083, -669, -115 },
+ { -4913, -4079, -837, -4673 },
+ { -3274, -2497, 2334, -2652 },
+ { -1286, -1731, 2550, -3756 },
+ { -3375, -877, 926, -3977 },
+ { -2525, -2079, 2879, -2625 },
+ { -5308, -504, 3111, -1607 },
+ { -4904, 460, 4093, -1232 },
+ { -1993, 1616, 4656, -1913 },
+ { -3481, -1176, 3119, -2236 },
+ { -4132, -1502, 2339, -2545 },
+ { -2542, 1151, 3569, -2550 },
+ { -4381, 430, 3147, -2082 },
+ { -3888, 867, 3899, -1657 },
+ { -2861, 1290, 4202, -1979 },
+ { -3893, -253, 2363, -2764 },
+ { -1705, 688, 3827, -2923 },
+ { -2223, 2312, 3700, -3148 },
+ { -1986, -720, 5021, -795 },
+ { -3177, 242, 1952, -3352 },
+ { -1854, 1509, 2528, -3815 },
+ { -3173, 97, 5019, -706 },
+ { -2689, -145, 1375, -3915 },
+ { -4838, -385, 2488, -2427 },
+ { -4557, -355, 1603, -3060 },
+ { -3522, 1832, 3292, -2674 },
+ { -3769, 780, 2378, -2704 },
+ { -4323, -1932, 3414, -1169 },
+ { -2740, 1158, 2729, -3273 },
+ { -3647, 210, 1464, -2892 },
+ { -2342, -2097, 1513, -3727 },
+ { -4422, -1242, 3130, -1833 },
+ { -1308, -1039, 4290, -1875 },
+ { -1754, -2535, 3298, -2314 },
+ { -4102, -186, 4037, -1094 },
+ { -1008, 1570, 3290, 171 },
+ { -3322, -2621, 2791, -1536 },
+ { -2539, -2597, 3442, -1672 },
+ { -3411, -2015, 3670, -1174 },
+ { -2097, 730, 5581, -1399 },
+ { -1510, -74, 4820, -2004 },
+ { -4086, -868, 4425, -771 },
+ { -956, -986, 3640, -2925 },
+ { -2087, -1250, 3464, -2458 },
+ { -3308, -2411, 1334, -3667 },
+ { -2264, -389, 4004, -1854 },
+ { -680, 239, 4058, -3388 },
+ { -1357, 30, 2993, -3658 },
+ { -3601, -552, 1177, -1136 },
+ { -2641, 442, 4374, -1625 },
+ { -2525, 770, 1640, -3895 },
+ { -3172, -891, 3893, -1608 },
+ { -2996, 13, 3277, -2414 },
+ { -899, 1055, 4470, -2501 },
+ { -422, -584, 3475, -3787 },
+ { -1978, -593, 2566, -3415 },
+ { -3150, -1280, 2362, -3047 },
+ { -3592, 224, 1026, -3932 },
+ { -4840, -1189, 3633, -879 },
+ { -3952, -2255, 2916, -1826 },
+ { -1695, 28, 1810, -349 },
+ { -745, -2484, 3308, -3293 },
+ { -1016, 1563, 5365, -1823 },
+ { -2172, -1787, 4266, -1287 },
+ { -1241, -1951, 3982, -2413 },
+ { -2009, -2639, 2330, -3480 },
+ { 5105, -1618, -2588, -2015 },
+ { 6497, -1523, -3218, -910 },
+ { 6526, -2305, -2029, -1790 },
+ { 5289, -99, -3436, -400 },
+ { 5781, -1623, -1577, -2617 },
+ { 5259, -670, -3125, -1700 },
+ { 6343, -1256, -331, -3222 },
+ { 7967, -678, -2195, -1462 },
+ { 6119, -695, -2988, -1538 },
+ { 6108, 494, -3359, -1548 },
+ { 5067, 969, -2328, -2707 },
+ { 7595, -435, -1497, -2056 },
+ { 6929, -719, -2420, -1665 },
+ { 5190, 584, -2982, -2103 },
+ { 6106, -444, -1411, -2739 },
+ { 5584, 289, -1804, -2803 },
+ { 5276, 227, -1180, -3361 },
+ { 7544, -1525, -1834, -1725 },
+ { 5986, -1470, -2606, -1701 },
+ { 5096, -765, -1712, -3006 },
+ { 5423, -149, -3933, -1157 },
+ { 7651, 26, -2445, -1507 },
+ { 4745, -464, -1735, -2362 },
+ { 5352, -1011, -1094, -1999 },
+ { 6300, -672, -542, -1950 },
+ { 6675, -1020, -1318, -1059 },
+ { 7218, -2036, -603, -2462 },
+ { 7755, -1514, -2430, -1229 },
+ { 5041, 449, -1056, -2405 },
+ { 6710, -2277, -1344, -2284 },
+ { 6824, -1347, -2254, 251 },
+ { 6068, -1857, -983, -1316 },
+ { 5603, -2177, -2730, -1477 },
+ { 5838, -1059, -3604, -970 },
+ { 5076, -789, -335, -2413 },
+ { 6191, -1634, -2000, -2129 },
+ { 5092, -1292, -2543, -1034 },
+ { 5305, 435, -1710, -1850 },
+ { 6140, 561, -2176, -2380 },
+ { 6752, 348, -2496, -1890 },
+ { 6405, 273, -1098, -2778 },
+ { 6942, -1340, -496, -1381 },
+ { 5238, -687, -2454, -2349 },
+ { 6959, -882, -1833, -2061 },
+ { 6292, -253, -2125, -2199 },
+ { 5838, -574, -759, -3215 },
+ { 6954, -1484, -640, -2771 },
+ { 7498, -1706, -1210, -2154 },
+ { 6772, -1003, -1235, -2532 },
+ { 6014, 228, -2154, -1108 },
+ { 6943, -2178, -2644, -1122 },
+ { 7262, -763, -3056, -1090 },
+ { 6273, -1478, -1072, 177 },
+ { 4734, 425, -2912, 357 },
+ { 7129, 168, -1537, -2327 },
+ { 7204, -434, -746, -2660 },
+ { 6879, 57, -3087, -1310 },
+ { 4623, -610, -718, -3459 },
+ { 6565, -543, -1998, -339 },
+ { 4752, -277, -2066, -1405 },
+ { 7435, -1416, -1904, -505 },
+ { 4076, 150, -1222, -3556 },
+ { 7082, -28, -1456, -1174 },
+ { 5941, -446, -1326, -1158 },
+ { 3870, -1648, -2474, -2589 },
+ { 858, 37, -3387, -3721 },
+ { 3557, -1503, -1664, -3383 },
+ { 3336, -1972, -3079, -2216 },
+ { 3186, 60, -4185, -863 },
+ { 3456, -773, -3066, -2457 },
+ { 4131, -913, -2060, -2601 },
+ { 4431, -691, -4114, -972 },
+ { 3461, -334, -3680, -1751 },
+ { 2006, -459, -2214, -3827 },
+ { 1322, 32, -2816, -3203 },
+ { 4425, -1897, -2791, -1946 },
+ { 4504, 23, -3421, -1909 },
+ { 3090, -885, -2366, -3264 },
+ { 3209, -2363, -3730, -834 },
+ { 3312, -1471, -3641, -1579 },
+ { 4184, -1669, -3323, -1248 },
+ { 2190, -931, -3302, -2944 },
+ { 2947, -229, -4791, -1195 },
+ { 2020, -1626, -2700, -3125 },
+ { 2214, -326, -4352, -1683 },
+ { 3286, -2619, -2412, -2458 },
+ { 1000, -2571, -4129, -2158 },
+ { 2496, -2627, -3611, -1433 },
+ { 2043, -2191, -2167, -3827 },
+ { 2571, -2544, -1915, -3222 },
+ { 2022, -1501, -3856, -2165 },
+ { 2685, -1180, -1461, -4038 },
+ { 1610, -2313, -4391, -1173 },
+ { 2340, -2490, -4215, -516 },
+ { 1742, -2615, -3632, -2146 },
+ { 523, -1293, -4246, -2442 },
+ { 3725, -2723, -3014, -1576 },
+ { 3554, -1381, -4200, -824 },
+ { 1291, -1594, -4777, -1430 },
+ { 1452, 515, -2960, -3830 },
+ { 4264, -894, -3305, -1826 },
+ { 2606, -1452, -4522, -966 },
+ { 1196, -830, -4807, -1816 },
+ { 1054, -775, -2616, -4071 },
+ { 4206, 415, -4344, -1132 },
+ { 3044, 491, -4126, -1934 },
+ { 988, -901, -3353, -3443 },
+ { 1729, -3063, -2267, -3370 },
+ { 3915, 912, -2989, -2387 },
+ { 3781, 300, -2457, -3050 },
+ { 2712, 924, -1350, -1206 },
+ { 4230, 405, -2343, 665 },
+ { 1878, -873, -225, -29 },
+ { 3510, 56, -1334, -3420 },
+ { 2850, 1447, -2651, -3150 },
+ { 1510, -706, -4125, -2483 },
+ { 3115, 793, -1692, -3894 },
+ { 2667, 213, -2973, -2786 },
+ { 1184, -2384, -3051, -3173 },
+ { 2139, 796, -2079, -3697 },
+ { 1464, -1483, -3726, -2754 },
+ { 2407, -1148, -3915, -1569 },
+ { 2612, -1779, -3217, -2271 },
+ { 2406, -2870, -2937, -2496 },
+ { 2140, 126, -3646, -2758 },
+ { 2952, -1036, 268, -1423 },
+ { 93, -1931, -3841, -3535 },
+ { 389, -2953, -3383, -3343 },
+ { 8652, -5511, -1662, 565 },
+ { 7427, -2791, -2535, -842 },
+ { 8541, -4253, -1407, -988 },
+ { 8018, -3203, -2998, 105 },
+ { 7231, -3926, -958, 1308 },
+ { 7331, -3690, -363, 2586 },
+ { 6803, -3646, -2226, -903 },
+ { 8163, -2811, -477, -2235 },
+ { 9356, -3818, -1685, -684 },
+ { 8466, -2854, -302, -698 },
+ { 8458, -3224, 517, 279 },
+ { 8074, -2619, -1326, 2596 },
+ { 8779, -2761, -2527, -441 },
+ { 6533, -2887, -899, -696 },
+ { 7394, -2305, -1642, -120 },
+ { 8281, -3780, -22, 1305 },
+ { 9158, -4413, -779, 901 },
+ { 9031, -5240, -1109, 1678 },
+ { 8717, -3650, 410, -1075 },
+ { 7317, -3197, -818, -2264 },
+ { 7934, -2385, -1214, -1886 },
+ { 8256, -4441, -291, -587 },
+ { 7358, -3395, 1090, -270 },
+ { 9446, -4910, -1343, -473 },
+ { 8187, -4726, -808, 1166 },
+ { 7504, -3845, -47, 267 },
+ { 8029, -2146, -1283, -383 },
+ { 7461, -2705, -853, 783 },
+ { 9367, -3636, -645, -354 },
+ { 8955, -3473, -308, -1947 },
+ { 8676, -2683, -2099, 1485 },
+ { 7481, -3003, -871, -444 },
+ { 8015, -2839, -1673, 1175 },
+ { 6947, -4643, -1527, -1047 },
+ { 7622, -2575, -137, -960 },
+ { 9388, -4279, -707, -1322 },
+ { 8382, -5259, -1283, -565 },
+ { 6856, -4138, -1030, 630 },
+ { 8659, -2571, -1124, -1666 },
+ { 8763, -3807, -537, 2543 },
+ { 8049, -3578, -2186, -604 },
+ { 8272, -2351, -1985, -1214 },
+ { 6855, -3796, -1527, -1631 },
+ { 7178, -2896, -1600, -1756 },
+ { 7040, -2888, -89, -1586 },
+ { 6261, -3403, -264, 998 },
+ { 7756, -4699, -1543, -834 },
+ { 7682, -4622, -758, -1721 },
+ { 8839, -4232, -2932, 1959 },
+ { 9363, -4679, -1956, 39 },
+ { 7883, -3616, -1414, -1432 },
+ { 8828, -3188, -1356, -1312 },
+ { 7746, -3987, -121, -2424 },
+ { 9262, -3256, -693, 818 },
+ { 7670, -3420, -148, 3504 },
+ { 7344, -3183, 608, 1595 },
+ { 8976, -4139, -1848, 1304 },
+ { 6708, -4131, 33, -852 },
+ { 7840, -4429, -2275, 79 },
+ { 8980, -3858, -2838, 453 },
+ { 7815, -4604, -2563, 944 },
+ { 8372, -4422, -1783, 3071 },
+ { 8623, -5128, -1754, 2888 },
+ { 7462, -3281, 889, 920 },
+ { 8416, -59, -1320, -1825 },
+ { 7928, -1488, -414, -2499 },
+ { 8110, -977, -1047, -2042 },
+ { 8278, -687, -1597, -1550 },
+ { 7988, -174, -977, -2106 },
+ { 8609, -1547, -1628, -1527 },
+ { 9000, -1798, -946, -1761 },
+ { 8954, -872, -1404, -1594 },
+ { 8939, 466, -748, -1212 },
+ { 9549, -329, -177, -1360 },
+ { 9411, -18, -1126, -1568 },
+ { 8859, -782, -488, -1338 },
+ { 8955, -218, -43, -1209 },
+ { 9131, -69, -453, -1001 },
+ { 9069, -1519, -1091, -1199 },
+ { 9247, -1309, -566, -1146 },
+ { 8528, -1617, -287, -1313 },
+ { 7763, -745, -149, -2040 },
+ { 8294, -343, 257, -2633 },
+ { 10149, -893, -552, -1649 },
+ { 9398, -915, 218, -2042 },
+ { 9703, -1194, -675, -1592 },
+ { 9586, -700, -427, -1710 },
+ { 8930, 497, -1445, -1218 },
+ { 9285, -1323, -163, -1552 },
+ { 8431, -1289, -985, -1404 },
+ { 8965, -655, 653, -1483 },
+ { 9542, -1001, -951, -1128 },
+ { 9205, -647, -37, -882 },
+ { 8603, -56, 514, -1793 },
+ { 9300, -12, -1324, -567 },
+ { 8773, 238, -184, -1456 },
+ { 9941, -1306, -69, -1792 },
+ { 9360, 279, -376, -1919 },
+ { 9180, -285, 95, -2170 },
+ { 9922, -501, -970, -1570 },
+ { 8341, -1493, -856, -2092 },
+ { 8780, -981, -850, -1014 },
+ { 9721, -548, -1504, -1094 },
+ { 9973, -1493, 482, -2105 },
+ { 8707, -333, -1027, -1087 },
+ { 9098, -469, -315, -1723 },
+ { 8879, -1050, -661, -2020 },
+ { 8857, 602, -866, -1918 },
+ { 8945, -1025, -2154, -1071 },
+ { 8484, -1930, -468, -2179 },
+ { 9177, -1903, -224, -2112 },
+ { 8652, -137, -2097, -1214 },
+ { 9063, -973, -1405, -772 },
+ { 9328, -456, 662, -2469 },
+ { 10101, -697, 127, -2113 },
+ { 9685, 811, -2359, -1024 },
+ { 8586, -94, -460, -1982 },
+ { 7924, -141, -509, -2513 },
+ { 7773, -669, -107, -2835 },
+ { 8636, -1064, -46, -2409 },
+ { 9748, 596, -1815, -1349 },
+ { 8924, 304, 547, -2614 },
+ { 9442, 746, -1153, -1679 },
+ { 9454, -278, -529, -1976 },
+ { 8488, 561, -32, -2160 },
+ { 10083, -63, -1544, -1364 },
+ { 9390, -1278, 568, -1131 },
+ { 9740, -49, -2253, -910 },
+ { 3636, -2391, -1115, -3614 },
+ { 6014, -3204, -1902, -1808 },
+ { 5787, -3497, -1116, -2590 },
+ { 4365, -3046, -1632, -2668 },
+ { 4733, -2192, -2029, -2468 },
+ { 5412, -2753, -1633, -2464 },
+ { 4455, -3375, -767, -3399 },
+ { 4456, -1644, -983, -2841 },
+ { 4039, -2523, 38, -3967 },
+ { 3406, -2662, 72, -4757 },
+ { 4279, -2005, 1055, -4399 },
+ { 4321, -1377, -860, -3786 },
+ { 3743, -5739, -651, -3047 },
+ { 3528, -5510, 361, -4060 },
+ { 6496, -4886, -136, -2689 },
+ { 4513, -5254, 551, -4010 },
+ { 6557, -3413, -92, -3063 },
+ { 4186, -2059, 187, 47 },
+ { 6210, -4117, -1256, -1985 },
+ { 6038, -4343, 351, -2124 },
+ { 4305, -4780, -2077, -1897 },
+ { 4480, -3815, -2228, -1533 },
+ { 5582, -3689, 1221, -3429 },
+ { 5532, -4874, 1195, -2765 },
+ { 6518, -2853, -905, -2568 },
+ { 5467, -2192, 470, -4115 },
+ { 4139, -1577, 240, -3493 },
+ { 5281, -1926, -729, -3340 },
+ { 5214, -2870, 1359, -4289 },
+ { 3046, -3510, -1536, -3214 },
+ { 5433, -2881, -1230, -1184 },
+ { 4861, -3932, -1071, -2791 },
+ { 5693, -4234, -1906, -1502 },
+ { 4004, -3935, -1804, -2383 },
+ { 3728, -3792, 681, -4773 },
+ { 3621, -3030, -1951, -2598 },
+ { 5133, -3903, 44, -3700 },
+ { 3561, -3451, 1183, -5301 },
+ { 5026, -2762, -2341, -1780 },
+ { 5841, -2492, -467, -3210 },
+ { 5591, -1791, 497, -2472 },
+ { 5054, -3898, -1822, -2097 },
+ { 5813, -2792, 83, -1469 },
+ { 4432, -4497, 1670, -5193 },
+ { 5338, -4653, -1109, -2200 },
+ { 3239, -4401, -648, -3655 },
+ { 2147, -3598, -1200, -4242 },
+ { 4417, -2271, -1552, -3210 },
+ { 6494, -4360, 852, -3565 },
+ { 2393, -6358, -856, -4524 },
+ { 4959, -4196, -847, -1403 },
+ { 4924, -5438, -226, -3026 },
+ { 4254, -5303, -1306, -2424 },
+ { 4121, -3126, -2334, -1981 },
+ { 3437, -4443, -1464, -2953 },
+ { 3203, -3459, -529, -4339 },
+ { 5896, -5945, 543, -3246 },
+ { 1987, -4733, -220, -4863 },
+ { 4358, -4431, -514, -3081 },
+ { 4583, -2416, -492, -2287 },
+ { 2943, -5035, 419, -4927 },
+ { 5358, -5129, 987, -4309 },
+ { 4460, -3392, 1752, -5634 },
+ { 3415, -4633, 1507, -5945 },
+ { 811, -4692, -445, 2333 },
+ { 1009, -5613, -1857, 1360 },
+ { 1338, -2712, -2720, 3036 },
+ { 1002, -3754, -2582, 2344 },
+ { 750, -4608, -2334, 714 },
+ { 2043, -3207, -2822, 2173 },
+ { -140, -4654, -2953, 357 },
+ { -54, -4026, -2376, 2695 },
+ { 1858, -5022, -717, 2287 },
+ { 2064, -3894, -722, 3255 },
+ { 2727, -4558, -332, 2603 },
+ { 1810, -5378, 283, 1826 },
+ { 3935, -4326, 762, 3383 },
+ { -767, -4697, -2510, 1922 },
+ { 2146, -4312, -3090, 1641 },
+ { 54, -5881, -2114, 921 },
+ { 1992, -5766, -640, 1574 },
+ { 1200, -5371, -1114, 1828 },
+ { 2973, -5337, 34, 2266 },
+ { 1531, -5018, -2817, 1192 },
+ { 3078, -4570, 117, 1990 },
+ { 924, -4286, -1388, 2713 },
+ { 142, -5058, -2848, 1487 },
+ { -106, -6180, -881, 842 },
+ { 673, -5433, -229, 1596 },
+ { 783, -5710, -2784, 562 },
+ { 1935, -5729, -2009, 856 },
+ { -410, -3375, -3326, 2734 },
+ { 234, -3000, -2628, 3260 },
+ { 733, -3405, -3806, 1589 },
+ { 771, -4285, -3544, 1314 },
+ { 1192, -3563, -3960, 2178 },
+ { 206, -5555, -1250, 1546 },
+ { -130, -3815, -1210, 3041 },
+ { 646, -3940, -393, 2992 },
+ { -184, -4931, -1767, 1925 },
+ { 2746, -5120, -2275, 1464 },
+ { 2440, -3731, -3352, 2729 },
+ { -490, -4942, -3779, 997 },
+ { 68, -2636, -4167, 3778 },
+ { 48, -3986, -4118, 2106 },
+ { -978, -5486, -1336, 1390 },
+ { 1126, -5297, -855, 640 },
+ { -472, -3975, -3622, 1557 },
+ { 2456, -5344, -1523, 1648 },
+ { -774, -5652, -2417, 1147 },
+ { 995, -6122, -812, 1132 },
+ { 3282, -4571, -1763, 2175 },
+ { 3655, -3862, -676, 3568 },
+ { 3038, -3647, -1672, 3381 },
+ { 2595, -2964, -2772, 3263 },
+ { 4176, -3353, -1148, 4354 },
+ { 1603, -3442, -1500, 3444 },
+ { 828, -6226, -1783, 678 },
+ { 1421, -3333, -3080, 3403 },
+ { 1121, -4727, -1924, 1984 },
+ { -186, -5083, -682, 1796 },
+ { 819, -2778, -3488, 530 },
+ { 421, -2873, -3832, 2596 },
+ { 2164, -4263, -1605, 2282 },
+ { 585, -4437, -682, -491 },
+ { -644, -4452, -1157, 2325 },
+ { 1991, -4299, 210, 2834 },
+ { 2135, -3632, -2113, 665 },
+ { -7482, -2724, -2662, -1380 },
+ { -6983, -2166, -3756, -3509 },
+ { -7085, -1439, -2397, -3112 },
+ { -7760, -3049, -3319, -2822 },
+ { -8413, -2760, -4406, -3298 },
+ { -5995, -3943, -1260, -3750 },
+ { -7879, -1554, -3464, -2606 },
+ { -6314, -2034, -3878, -1681 },
+ { -8849, -2084, -1399, -1231 },
+ { -7153, -2602, -1384, -817 },
+ { -8041, -2571, -407, -2785 },
+ { -7246, -2233, -1578, 260 },
+ { -7336, -3883, -4061, -1342 },
+ { -7619, -3908, -2342, 382 },
+ { -8684, -3724, -1662, -727 },
+ { -7850, -2922, -1770, -3449 },
+ { -6766, -2034, -1293, -1988 },
+ { -6895, -2116, -968, -3744 },
+ { -7136, -5147, -2618, -2809 },
+ { -8224, -3724, -2519, -1589 },
+ { -6711, -2750, -3021, -219 },
+ { -8059, -1638, -1102, -3175 },
+ { -8710, -4839, -3963, -3143 },
+ { -9363, -4965, -3257, -1002 },
+ { -6099, -1751, -3157, -395 },
+ { -6453, -3216, -4597, -483 },
+ { -7879, -5477, -839, -2638 },
+ { -7202, -4038, -526, -2856 },
+ { -8022, -1228, -1910, -1646 },
+ { -9117, -1393, -1582, -2535 },
+ { -9095, -2693, -636, -2605 },
+ { -9076, -2580, -3481, -2519 },
+ { -8327, -4859, -2422, 83 },
+ { -8368, -2129, -2324, -2173 },
+ { -8554, -4563, -3842, -2007 },
+ { -10462, -4261, -1934, -2084 },
+ { -9717, -3187, -2294, -1896 },
+ { -9625, -3889, -3020, -3224 },
+ { -9857, -4955, -4239, -2184 },
+ { -9752, -2351, -2277, -3129 },
+ { -7219, -1302, -2639, -1603 },
+ { -7477, -4360, -3718, -559 },
+ { -5680, -2033, -2326, -3078 },
+ { -10190, -5548, -4643, -3601 },
+ { -9431, -4121, -879, -2479 },
+ { -8365, -5450, -2020, -1439 },
+ { -6289, -5178, -1605, -3845 },
+ { -8319, -3866, -687, -2792 },
+ { -8131, -1031, -3608, -3947 },
+ { -10510, -2560, -1199, -2082 },
+ { -11015, -3640, -2748, -3041 },
+ { -8762, -5022, -5231, -1162 },
+ { -10153, -2715, -4648, -4859 },
+ { -7930, -5205, -1900, -3600 },
+ { -9561, -3548, -4812, -3722 },
+ { -7663, -4709, -1180, -1475 },
+ { -9073, -5707, -1815, -2980 },
+ { -8602, -2363, -2675, -3770 },
+ { -9967, -5614, -3575, -3838 },
+ { -8324, -1005, -2131, -3254 },
+ { -10331, -5737, -2550, -2940 },
+ { -8234, -3354, -3361, -4479 },
+ { -8140, -1951, -4526, -4545 },
+ { -6679, -2662, -2284, -4182 },
+ { -1122, -1514, -6427, -212 },
+ { 54, -1660, -5424, -1404 },
+ { 254, -2778, -5222, 846 },
+ { -267, -1661, -6577, 814 },
+ { -305, -2021, -5759, 1484 },
+ { -1791, -2446, -6867, -86 },
+ { -2929, -3158, -6603, -1799 },
+ { -1391, -3189, -5557, -1053 },
+ { -1602, -884, -6767, -1213 },
+ { -361, -318, -6219, -44 },
+ { -4078, -2635, -5523, -433 },
+ { -956, 478, -4382, 1470 },
+ { -3300, -2462, -6021, -2721 },
+ { 708, -2434, -5085, -540 },
+ { -2435, -3607, -5647, -2110 },
+ { -491, -1134, -4681, -2886 },
+ { 87, -3435, -4641, -1194 },
+ { -586, -2927, -4784, 366 },
+ { -1394, -2326, -6021, 350 },
+ { 97, -2519, -4678, -2120 },
+ { -1547, -1907, -5069, -2993 },
+ { 268, -3724, -4719, 127 },
+ { -827, -1190, -5912, 1144 },
+ { -3959, -2322, -6898, -1974 },
+ { -2728, -2228, -6426, -562 },
+ { -456, -666, -5785, -1609 },
+ { 531, -1096, -5731, -656 },
+ { -3569, -688, -3915, 110 },
+ { -4752, -1725, -4393, -377 },
+ { -3210, -3315, -6960, -840 },
+ { -688, -3416, -4971, 1221 },
+ { -1833, 77, -6491, -2434 },
+ { -239, -255, -6850, -886 },
+ { -2112, -1490, -6291, -2689 },
+ { -1544, -4579, -5198, -1261 },
+ { -2771, -4014, -5520, 683 },
+ { -1635, -2829, -5512, 1214 },
+ { -958, -2582, -4823, 2360 },
+ { -2077, -4566, -4642, 365 },
+ { -3112, -4214, -5960, -823 },
+ { -2467, -2510, -4858, 1467 },
+ { -1561, -3399, -5822, 211 },
+ { -775, -1081, -4424, 2636 },
+ { -1263, 25, -6378, -1392 },
+ { -3476, -366, -5417, -1393 },
+ { -3176, -1476, -4149, 1466 },
+ { -2479, 518, -4448, -257 },
+ { -2992, 158, -4660, -1279 },
+ { -1320, -3872, -4479, 1147 },
+ { -1475, -312, -5318, 539 },
+ { -3527, -1679, -5860, -1681 },
+ { -3397, -3438, -5593, 1866 },
+ { -4089, -2439, -4763, 1275 },
+ { -748, -4513, -4687, -48 },
+ { -2166, -4531, -4691, -2856 },
+ { -2385, -853, -6035, -627 },
+ { -1194, -4091, -4472, -1963 },
+ { -682, -3234, -4084, -3033 },
+ { -3255, -5015, -5328, -12 },
+ { -2313, -3436, -4601, -155 },
+ { -2792, -1038, -6947, -2019 },
+ { -1244, -1526, -5771, -1882 },
+ { -4679, -3731, -5506, 283 },
+ { -3062, -66, -3558, -758 },
+ { -4895, -1187, 4751, 3728 },
+ { -7600, -2752, 3320, 4613 },
+ { -5703, -2975, 3944, 2659 },
+ { -4972, -1257, -246, 2952 },
+ { -4221, -2487, 1702, 4295 },
+ { -2900, -1529, 2458, 4935 },
+ { -5061, 407, 2416, 4050 },
+ { -6931, -3478, 2761, 2213 },
+ { -6037, -3921, 3192, 1866 },
+ { -6113, -811, 2407, 3782 },
+ { -5878, -1716, 1207, 3478 },
+ { -5953, -2853, 2207, 2712 },
+ { -6807, -3223, 2749, 3595 },
+ { -3272, -3157, 1389, 3788 },
+ { -5368, -1904, 1980, 5077 },
+ { -7235, -1398, 3075, 4548 },
+ { -4765, -3487, 2755, 2796 },
+ { -7658, -4435, 2694, 2582 },
+ { -6997, -4282, 456, 3832 },
+ { -5563, -3115, -63, 3713 },
+ { -4244, -4220, 1450, 2767 },
+ { -3801, -2194, 190, 4303 },
+ { -5458, -4119, 1958, 2274 },
+ { -7300, -3469, 3514, 3193 },
+ { -4594, -2067, 775, 4752 },
+ { -3389, -1654, 1464, 5412 },
+ { -4845, -3483, 964, 3437 },
+ { -6007, -2818, 1666, 4659 },
+ { -8709, -5007, 1757, 3287 },
+ { -5833, -4389, 1025, 3171 },
+ { -5788, -1780, 3944, 3661 },
+ { -4430, -920, 1938, 4753 },
+ { -7066, -1857, 4591, 4538 },
+ { -3549, -513, 1427, 5317 },
+ { -7517, -1220, 2883, 3049 },
+ { -7605, -2687, 1874, 2735 },
+ { -8718, -4035, 2676, 3730 },
+ { -7990, -3907, 1185, 2607 },
+ { -6058, -1744, 3349, 5157 },
+ { -5954, 565, 3161, 3250 },
+ { -6478, -612, 1930, 2271 },
+ { -6535, -1445, -2, 1618 },
+ { -8963, -4151, 1192, 4044 },
+ { -7227, -3570, 1600, 4234 },
+ { -4674, 79, 595, 3015 },
+ { -3974, 430, 2727, 5137 },
+ { -5299, 9, 3714, 4779 },
+ { -6779, -2699, -8, 2436 },
+ { -7016, -1145, 1293, 2310 },
+ { -6955, -3312, 1534, 1801 },
+ { -4025, 740, 1850, 4054 },
+ { -9589, -3460, 4154, 5270 },
+ { -4404, -1181, 4298, 5173 },
+ { -7356, -4583, -18, 2644 },
+ { -6516, -1235, 4439, 6234 },
+ { -3453, -301, 4344, 4464 },
+ { -4643, 1530, 3315, 4340 },
+ { -4575, -2557, 3754, 3682 },
+ { -3643, -3501, 2051, 2997 },
+ { -5412, -2475, 2301, 1579 },
+ { -5846, 259, 1360, 2348 },
+ { -5258, -1358, 1050, 838 },
+ { -5542, -219, 6377, 5750 },
+ { -5713, -2952, 922, 899 },
+ { -2049, -1135, 5206, 1033 },
+ { -1693, -1886, 4835, -106 },
+ { -2344, -3504, 4232, -13 },
+ { -2475, -2334, 5043, 1126 },
+ { -787, -2549, 3880, 2138 },
+ { -3159, -2341, 4830, 2887 },
+ { -1780, -1009, 6240, 2061 },
+ { -4327, -3363, 2818, 886 },
+ { -3376, -2743, 4104, 207 },
+ { -3250, -4640, 2718, 1498 },
+ { -382, -1075, 4382, 3460 },
+ { -2416, -4168, 3530, 816 },
+ { -1756, -2708, 4861, 622 },
+ { -1879, -2097, 5156, 2889 },
+ { -2496, -2418, 3722, 2671 },
+ { -2717, -3252, 3341, 1944 },
+ { -4063, -4091, 3306, 267 },
+ { -3549, -3808, 3747, 842 },
+ { -2635, 546, 5794, 1894 },
+ { -1857, -1121, 4383, 3964 },
+ { -2226, -2166, 3489, 3678 },
+ { -3492, -660, 5323, 1063 },
+ { -3033, -3130, 4382, 1828 },
+ { -2703, -625, 6369, 2851 },
+ { -1656, -2842, 4584, -528 },
+ { -4781, -2622, 4390, 2097 },
+ { -413, -2045, 5081, 3035 },
+ { -3810, -2662, 4532, 1095 },
+ { -3144, -1858, 5215, 1880 },
+ { -3562, -1795, 4928, 670 },
+ { -4800, -1509, 5189, 1859 },
+ { -1085, -3832, 4169, 900 },
+ { -1969, -3270, 2857, 2878 },
+ { -4267, -4140, 3176, 1805 },
+ { -5145, -3727, 3524, 1168 },
+ { -1346, -1876, 5501, 1748 },
+ { -4998, -2945, 3699, 338 },
+ { -3458, -3096, 3406, -635 },
+ { -1751, -3209, 3508, 395 },
+ { -2507, 170, 5987, 705 },
+ { -3756, -1072, 5647, 3536 },
+ { -2870, -1439, 5026, 3212 },
+ { -3913, -3225, 3669, 2144 },
+ { -3739, 226, 5747, 764 },
+ { -2052, -820, 5266, 3093 },
+ { -3214, -3820, 2409, 2391 },
+ { -4398, -2588, 3501, -218 },
+ { -4484, -1763, 4180, -198 },
+ { -3368, -1525, 4362, -134 },
+ { -2407, 224, 4905, 3533 },
+ { -1369, -2937, 4728, 1788 },
+ { -4848, -1707, 4159, 851 },
+ { -3454, -1749, 4281, 3230 },
+ { -1990, -3853, 3487, 1735 },
+ { -3117, 92, 6155, 4075 },
+ { -2676, -2472, 4078, -589 },
+ { -1547, -2012, 2626, 1835 },
+ { -4275, -588, 4824, 725 },
+ { -601, -2249, 3736, 3548 },
+ { -4060, -61, 5333, 3097 },
+ { -4303, 7, 6551, 3054 },
+ { -5003, -1029, 5786, 3319 },
+ { -2810, -728, 5392, 199 },
+ { -1232, -200, 5228, 3121 },
+ { 2621, 165, -6255, 298 },
+ { 3669, 537, -6844, 1564 },
+ { 1598, -1190, -6235, 2523 },
+ { 2164, -32, -6894, 1383 },
+ { 853, -1597, -6069, 1449 },
+ { 1377, -1661, -5266, 108 },
+ { 2660, 48, -5172, -517 },
+ { 1903, -391, -5677, 1010 },
+ { 3792, 206, -5274, -11 },
+ { 1239, 2776, -2929, 2721 },
+ { 4071, 149, -7259, 3125 },
+ { 1436, -480, -6156, -196 },
+ { 1373, -1960, -5005, 3122 },
+ { 3413, -1271, -5176, 3283 },
+ { 3060, -68, -6495, 2238 },
+ { 2700, -2075, -4681, 91 },
+ { 2928, -1728, -5168, 1858 },
+ { 4424, 828, -4471, 88 },
+ { 2672, -2604, -4038, 2753 },
+ { 5223, -123, -6749, 2295 },
+ { 4237, -420, -5538, 1353 },
+ { 4744, -1281, -4097, 4708 },
+ { 1103, -2764, -4751, 2024 },
+ { 3747, -1913, -3911, 3960 },
+ { 2470, -1416, -5542, 615 },
+ { 4847, -1354, -5334, 1733 },
+ { 5336, 88, -7593, 4007 },
+ { 2388, -2880, -4807, 1037 },
+ { 4495, 1391, -5685, -139 },
+ { 5253, 1637, -6450, 1533 },
+ { 1199, 795, -5515, 1261 },
+ { 1397, -1259, -4252, 3838 },
+ { 746, 70, -6640, 604 },
+ { 1584, 166, -4972, 3072 },
+ { 380, -999, -5397, 2267 },
+ { 2974, 1707, -3242, 5360 },
+ { 5202, -403, -5453, 2832 },
+ { 3718, -1731, -4760, 714 },
+ { 4150, -975, -4792, 61 },
+ { 2925, -818, -4841, 15 },
+ { 5301, 577, -4006, 3259 },
+ { 5265, 1986, -5679, 3028 },
+ { 3752, 1928, -4509, 3729 },
+ { 3278, 1925, -6370, 1247 },
+ { 5107, 1721, -4853, 3127 },
+ { 3279, 2982, -2515, 4005 },
+ { 4622, 668, -6204, 759 },
+ { 6034, 317, -5763, 4818 },
+ { -558, 57, -3785, 2817 },
+ { 4476, 1616, -3965, 4536 },
+ { 5953, 2056, -8215, 2715 },
+ { 4387, 2613, -7463, 868 },
+ { 5834, 1088, -4736, 4924 },
+ { 6473, -856, -6991, 4172 },
+ { 4959, -293, -5162, 76 },
+ { 2731, -843, -6119, 3847 },
+ { 3245, 1202, -6833, 616 },
+ { 2553, 1383, -3829, 3859 },
+ { 4332, 2099, -3480, 3622 },
+ { 2110, 2683, -2728, 3990 },
+ { 876, 1167, -3290, 3466 },
+ { 3991, 1709, -2410, 4077 },
+ { 5105, 939, -2584, 3256 },
+ { 4719, 688, -1566, 3040 },
+ { -3632, 4335, 1266, -3303 },
+ { -4956, 3207, 1312, -2806 },
+ { -4669, 2627, 2663, -2435 },
+ { -4282, 3708, 2303, -3038 },
+ { -4536, 2297, -175, -3350 },
+ { -5234, 2503, -139, -880 },
+ { -3978, 1512, 1092, -3619 },
+ { -4519, 4649, 1363, -2455 },
+ { -5118, 3132, 1961, -1577 },
+ { -5196, 3379, -182, -1378 },
+ { -6420, 4486, 2397, -1993 },
+ { -5030, 5046, 1292, -1118 },
+ { -4559, 2573, -927, -1406 },
+ { -3501, 3730, 691, -4930 },
+ { -4364, 2758, 1007, -3909 },
+ { -4026, 2839, -1559, -2340 },
+ { -5037, 4053, 836, -1571 },
+ { -4727, 5136, 1110, -3588 },
+ { -5245, 2799, -999, -2164 },
+ { -4954, 1501, 422, -3963 },
+ { -5994, 2726, 1462, -2833 },
+ { -5621, 5159, 2038, -2512 },
+ { -4991, 2291, 1917, -3151 },
+ { -5469, 4382, -148, -2978 },
+ { -5858, 1983, 807, -2720 },
+ { -4709, 3556, 952, -467 },
+ { -2489, 2362, 1714, -4230 },
+ { -4717, 5004, -1180, -3672 },
+ { -5914, 3653, 1359, -1317 },
+ { -5506, 2995, 780, -1059 },
+ { -5287, 3945, 2480, -2293 },
+ { -3849, 4358, 322, -1770 },
+ { -3911, 3570, 252, -3185 },
+ { -3660, 5128, 158, -3719 },
+ { -4599, 3277, -503, -2727 },
+ { -3673, 3760, -1252, -3339 },
+ { -5161, 2337, 388, -1943 },
+ { -3529, 2216, 2156, -3080 },
+ { -4309, 4331, 1808, -1460 },
+ { -4782, 3820, 480, -2504 },
+ { -4166, 3544, -378, -1567 },
+ { -5572, 2466, -418, -2909 },
+ { -6096, 2930, 119, -1878 },
+ { -5963, 3554, 1011, -2233 },
+ { -6433, 4335, 935, -2930 },
+ { -5004, 3314, -1352, -3430 },
+ { -6042, 3463, -1008, -3940 },
+ { -4671, 2214, -640, -5040 },
+ { -2795, 3759, 1412, -3803 },
+ { -3647, 4436, 729, -515 },
+ { -3594, 1033, 56, -4148 },
+ { -2908, 3027, 2889, -3485 },
+ { -3338, 2234, 313, -4285 },
+ { -3825, 4497, -561, -2634 },
+ { -6167, 3012, -48, -3149 },
+ { -4828, 3515, -969, -4475 },
+ { -5789, 2757, -539, -4173 },
+ { -2452, 3067, 564, -4249 },
+ { -4921, 1358, 1331, -2889 },
+ { -3127, 4239, -1045, -1523 },
+ { -4780, 2326, -1118, -3446 },
+ { -3908, 5546, 152, -2622 },
+ { -6972, 2976, 337, -2809 },
+ { -4839, 4613, -35, -4077 },
+ { -1408, 4822, -1149, -4997 },
+ { -981, 4979, -912, -6304 },
+ { -2098, 5689, -888, -2878 },
+ { -3343, 4814, -657, -4434 },
+ { -2461, 3601, -967, -4869 },
+ { -2652, 3944, 87, -5520 },
+ { -1104, 6076, 174, -6407 },
+ { 355, 5370, -1721, -5869 },
+ { 1242, 4497, -1107, -5091 },
+ { -89, 4002, -1491, -5182 },
+ { 1059, 5693, -1591, -4905 },
+ { 1323, 4682, -2078, -4768 },
+ { 818, 3996, -549, -5468 },
+ { -287, 4529, 929, -5543 },
+ { -919, 5519, -2791, -2844 },
+ { -1407, 5679, -3289, -3974 },
+ { -189, 6530, -3547, -4002 },
+ { -900, 7039, -3371, -4855 },
+ { -2983, 7211, -363, -4835 },
+ { -814, 6503, -104, -5106 },
+ { -2386, 6896, 809, -4919 },
+ { 845, 4492, 352, -6621 },
+ { -1998, 7237, -1646, -4231 },
+ { -3380, 6251, 471, -4577 },
+ { -1908, 7059, 84, -5726 },
+ { -340, 6346, -803, -6265 },
+ { -2279, 5834, -47, -4633 },
+ { -1532, 5286, -1748, -1901 },
+ { -2757, 6188, -453, -3415 },
+ { -1255, 6405, -2043, -6357 },
+ { 918, 5581, -121, -5667 },
+ { 1840, 5336, -821, -5034 },
+ { -2475, 4992, -1825, -3104 },
+ { -2413, 5606, -1789, -4298 },
+ { 132, 5128, -2389, -4442 },
+ { 223, 6400, -2653, -4742 },
+ { -673, 5012, 680, -4582 },
+ { -1657, 6624, -349, -3596 },
+ { -755, 6289, -1860, -3978 },
+ { -572, 6894, -1946, -5207 },
+ { -1141, 4756, -2665, -5586 },
+ { -1073, 4269, -431, -4030 },
+ { 186, 5761, 916, -5868 },
+ { -1907, 4836, 1017, -5106 },
+ { -963, 3363, -1248, -6348 },
+ { -3262, 4774, -1818, -5858 },
+ { 847, 3812, -2538, -4302 },
+ { -1223, 5903, 1360, -5479 },
+ { -1094, 6923, -1244, -2381 },
+ { 267, 6276, -709, -2846 },
+ { -157, 5840, 1124, -4266 },
+ { 889, 3206, -910, -5305 },
+ { -1736, 3344, 582, -4838 },
+ { -2357, 5676, -2695, -6277 },
+ { -1916, 6901, -986, -5397 },
+ { -3062, 6028, -695, -5687 },
+ { 1836, 3566, -1357, -5226 },
+ { -2176, 4938, 646, -3872 },
+ { -2199, 3055, -208, -6124 },
+ { -236, 3032, -821, -5325 },
+ { -3989, 7277, -565, -3899 },
+ { -595, 4362, 74, -5975 },
+ { 684, 5874, -841, -4424 },
+ { -2731, 6305, -2389, -5465 },
+ { -5775, 1325, -56, -2528 },
+ { -7029, -534, -1890, -3278 },
+ { -5798, -15, -2734, -2210 },
+ { -5504, -1198, -353, -3659 },
+ { -5079, 960, -894, -4336 },
+ { -6073, -36, -133, -3014 },
+ { -5782, -259, -1025, -3986 },
+ { -6843, 1262, -807, -1639 },
+ { -5263, -918, -3290, -579 },
+ { -4840, 461, -2158, -533 },
+ { -6014, -50, -620, 504 },
+ { -5843, 241, -1359, -282 },
+ { -5898, 577, 769, -3271 },
+ { -6833, -946, -466, -3347 },
+ { -6026, 1459, -512, -729 },
+ { -7361, 747, -388, -1110 },
+ { -6391, 2142, -1160, -2513 },
+ { -6995, 304, 498, -2673 },
+ { -6757, 679, -386, -433 },
+ { -5222, 1688, -1093, -1032 },
+ { -5019, 575, 184, -3627 },
+ { -4237, 628, -3507, -1243 },
+ { -7479, -456, -1722, -1486 },
+ { -6464, 713, -1273, -1153 },
+ { -6255, 1682, -606, -3607 },
+ { -7033, 1497, -71, -1955 },
+ { -6694, 1556, -1721, -3214 },
+ { -6114, -356, 813, -2575 },
+ { -5308, 632, -1851, -1636 },
+ { -5742, -911, -1733, 383 },
+ { -6083, -387, -2313, -879 },
+ { -6535, -530, -1505, -2083 },
+ { -4896, 1223, -2750, -1816 },
+ { -6392, -463, -3247, -2093 },
+ { -5373, 1264, -2706, -3042 },
+ { -3894, -1390, -1020, -891 },
+ { -6179, 1168, -1966, -1922 },
+ { -5162, 1668, -1617, -1916 },
+ { -6453, 920, -1169, -2432 },
+ { -6130, 2005, -536, -1519 },
+ { -6552, -98, -518, -1938 },
+ { -7528, 355, -1101, -1772 },
+ { -5745, 610, -247, -1360 },
+ { -7003, 177, -2064, -1958 },
+ { -6956, -570, -2220, -4225 },
+ { -7830, 791, -1394, -2774 },
+ { -7634, 480, -3171, -4224 },
+ { -7913, 1154, -350, -2381 },
+ { -5063, 1704, -1804, -2977 },
+ { -4887, -524, -2703, 188 },
+ { -5551, 406, -1620, -3063 },
+ { -7109, 1342, 381, -3021 },
+ { -6846, 631, -458, -3398 },
+ { -4606, -605, 11, -3930 },
+ { -8134, -225, -1738, -2648 },
+ { -7043, 402, -2734, -3059 },
+ { -7417, 1825, -2545, -4389 },
+ { -6971, -236, -1031, -665 },
+ { -5752, 2111, -1632, -3808 },
+ { -7660, -78, -624, -3135 },
+ { -6358, 619, -1951, -3911 },
+ { -8134, 408, -1935, -3695 },
+ { -6335, 1911, -2368, -4505 },
+ { -7116, 2163, -344, -2753 },
+ { 2357, 4488, 2220, -5682 },
+ { 1385, 3206, 2300, -5305 },
+ { 1419, 2557, 5203, -3516 },
+ { 262, 4315, 3920, -1847 },
+ { 3316, 3187, 1612, -5609 },
+ { 1729, 2350, 1673, -6068 },
+ { 1603, 6126, 1467, -2839 },
+ { -1339, 3316, 3691, -3530 },
+ { -563, 4618, 3180, -4548 },
+ { 463, 4624, 3111, -5614 },
+ { 1246, 5455, 3356, -5720 },
+ { 480, 2149, 5422, -2893 },
+ { 1768, 4827, 913, -5579 },
+ { -149, 5381, 4366, -3297 },
+ { 985, 3672, 2644, -92 },
+ { -258, 2911, 5817, -2213 },
+ { 3428, 3289, 3351, -3541 },
+ { -666, 3295, 4727, -2869 },
+ { 35, 6641, 4160, -4052 },
+ { 623, 6787, 3156, -4560 },
+ { 2654, 4360, 4676, -4632 },
+ { 1386, 5246, 4834, -4497 },
+ { 3488, 4574, 3856, -5946 },
+ { 383, 4481, 4168, -4110 },
+ { 1753, 3652, 4288, -3326 },
+ { 1344, 4905, 2508, -4660 },
+ { 1580, 4106, 3104, -2224 },
+ { 2027, 5038, 1683, -1554 },
+ { 446, 3699, 5872, -3013 },
+ { 4637, 4087, 3578, -5018 },
+ { 2629, 3560, 5331, -4900 },
+ { 1527, 6674, 2523, -4131 },
+ { -1437, 2804, 2528, -4464 },
+ { -229, 3355, 2016, -5537 },
+ { 3666, 3418, 4374, -4581 },
+ { 1192, 3799, 923, -6596 },
+ { 2040, 2956, 448, -5322 },
+ { 2468, 5768, 4029, -5869 },
+ { 3438, 6516, 3529, -6667 },
+ { 2737, 5495, 680, -5535 },
+ { 3896, 5727, 1801, -4958 },
+ { 4988, 4957, 3592, -6518 },
+ { -542, 4416, 5794, -2787 },
+ { 4136, 4354, 2064, -4696 },
+ { 3067, 5936, 1207, -3396 },
+ { 2789, 4966, 2405, -3854 },
+ { 1731, 3270, 3251, -1063 },
+ { 1767, 5537, 2084, -2349 },
+ { 465, 3116, 4532, -837 },
+ { 1499, 2627, 4610, -2212 },
+ { 122, 3095, 3642, -3552 },
+ { 2542, 2866, 2705, -6402 },
+ { 3134, 4323, 698, -4785 },
+ { 731, 1859, 3112, -5242 },
+ { 2553, 2980, 3241, -4846 },
+ { 1329, 5310, 1607, -6624 },
+ { 2468, 1858, 3476, -1034 },
+ { -172, 4996, 2000, -5562 },
+ { 2621, 4220, 1574, -3386 },
+ { -333, 1832, 3362, -4117 },
+ { 2169, 6762, 3065, -6225 },
+ { 2844, 5528, 3223, -4765 },
+ { 526, 5175, 1644, -4267 },
+ { 2922, 4426, 2414, -2610 },
+ { 452, 1399, -4516, -2636 },
+ { 2872, 1720, -4667, -1435 },
+ { 1279, 702, -5424, -1984 },
+ { 2187, 870, -5021, -1341 },
+ { 583, -144, -4628, -2464 },
+ { 3, 2237, -5284, -2827 },
+ { -19, 1005, -5460, -1819 },
+ { 2897, 2084, -5885, -515 },
+ { -400, 3370, -5527, -2947 },
+ { 1505, 2593, -5518, -1802 },
+ { 1341, 4534, -5094, -1899 },
+ { 3241, 3670, -5493, -1252 },
+ { -1287, 921, -5994, -1675 },
+ { 627, 408, -6652, -364 },
+ { -260, 1127, -4849, -3247 },
+ { 371, 3400, -5976, -2285 },
+ { 1533, 1566, -6373, -610 },
+ { 2462, 4274, -6184, -1254 },
+ { 1782, 3363, -6222, -1381 },
+ { 572, 4650, -5673, -2754 },
+ { 2674, 3414, -4460, -2154 },
+ { 3614, 3820, -6883, -398 },
+ { 1136, -1, -5511, -1112 },
+ { -1773, 1137, -5647, -2377 },
+ { -753, 2104, -6085, -2565 },
+ { -204, 3025, -4731, -1418 },
+ { -1486, 1438, -4380, -216 },
+ { 302, 858, -5786, -264 },
+ { 3486, 1495, -5234, -783 },
+ { 888, 2327, -3423, -3720 },
+ { -259, 772, -6596, -1311 },
+ { -1197, 2073, -5174, -1826 },
+ { 1500, 3470, -4462, -2645 },
+ { 3072, 1960, -3277, -2264 },
+ { 1841, 952, -4324, -2340 },
+ { 1994, 2200, -3940, -2923 },
+ { -1782, 1699, -4667, -1075 },
+ { -1464, 2906, -3468, -375 },
+ { 366, 2380, -3747, 1467 },
+ { -545, 1645, -4619, 376 },
+ { 1724, 2350, -2374, -3512 },
+ { 3184, 2628, -2996, -3275 },
+ { 734, 2010, -6239, -1479 },
+ { 524, 3756, -4496, -3263 },
+ { 1492, 3570, -3494, -3600 },
+ { -932, 618, -5389, -2894 },
+ { -133, 2161, -4083, -3267 },
+ { 786, 774, -3279, -3731 },
+ { 1078, 803, -3843, -3007 },
+ { -332, 3405, -3347, 40 },
+ { -17, 6, -4005, -3690 },
+ { -189, 4372, -4488, -2561 },
+ { -450, 3846, -3790, -1370 },
+ { 362, 2212, -5272, -15 },
+ { -1529, 791, -6802, -2296 },
+ { 2145, 4241, -4474, 376 },
+ { 1813, 2426, -2932, -2726 },
+ { -542, 4557, -3140, -1080 },
+ { 1192, 3784, -4371, -20 },
+ { 2784, 5188, -6399, -1394 },
+ { 431, 4561, -3673, -1398 },
+ { 1382, 3096, -4083, 1253 },
+ { 1209, 4224, -2930, 1500 },
+ { 2798, 2684, -6676, -606 },
+ { -2396, 1510, -5381, -2713 },
+ { -2625, 2542, -4032, -2880 },
+ { -1231, 3967, -4098, -2886 },
+ { -1393, 2374, -3862, -4525 },
+ { -2495, 1665, -1637, -5445 },
+ { -3854, 1759, -1750, -4944 },
+ { -2373, 1668, -2856, -6251 },
+ { -2668, 1981, -886, -4557 },
+ { -2927, 4427, -3451, -6172 },
+ { -1925, 2596, -4696, -2527 },
+ { -3202, 2847, -3928, -5896 },
+ { -3332, 1665, -5025, -3412 },
+ { -3212, 3115, -4155, -4062 },
+ { -1013, 3205, -5133, -3751 },
+ { -2022, 4595, -3947, -5611 },
+ { -3556, 1755, -3715, -2300 },
+ { -1784, 4114, -2723, -1773 },
+ { -3586, 4081, -2733, -4942 },
+ { -1608, 3685, -4154, -4573 },
+ { -3368, 4042, -4452, -6227 },
+ { -1407, 3881, -5729, -3719 },
+ { -2751, 3281, -5077, -4999 },
+ { -3791, 2410, -4906, -5288 },
+ { -730, 2303, -4217, -3755 },
+ { -1812, 2311, -5492, -3709 },
+ { -610, 4336, -3915, -3783 },
+ { -2841, 4337, -4278, -4430 },
+ { -1662, 4666, -4661, -3964 },
+ { -589, 5209, -4923, -3682 },
+ { -4155, 2234, -4076, -4218 },
+ { -3951, 2770, -2665, -2805 },
+ { -2302, 3228, -3717, -1908 },
+ { -3129, 4373, -2264, -2851 },
+ { -447, 1363, -3578, -4323 },
+ { -2648, 4237, -3159, -3071 },
+ { -4072, 3241, -3541, -4605 },
+ { -4507, 3458, -2339, -3838 },
+ { -1646, 997, -4926, -3970 },
+ { -3025, 1614, -3940, -1242 },
+ { -1337, 1756, -3163, -5529 },
+ { -3203, 1865, -3282, -4354 },
+ { -1646, 2118, -2203, -6018 },
+ { 174, 1871, -2707, -4639 },
+ { -2607, 1485, -4778, -4750 },
+ { -2199, 3991, -3134, -4879 },
+ { -2962, 3323, -2816, -2419 },
+ { -5286, 2495, -4548, -5395 },
+ { -2810, 3710, -2274, -4211 },
+ { -330, 3006, -2993, -4678 },
+ { -1187, 2411, -2743, -5196 },
+ { -664, 4033, -3101, -5641 },
+ { -1458, 3602, -2816, -5371 },
+ { -4116, 4923, -3321, -5630 },
+ { -4165, 2528, -2592, -4798 },
+ { -2759, 3080, -2333, -5719 },
+ { -5157, 3011, -5526, -6348 },
+ { -3095, 2126, -5881, -4234 },
+ { -4377, 3849, -3600, -6099 },
+ { -1994, 4947, -5235, -4753 },
+ { -1067, 600, -3258, -5133 },
+ { -4992, 3302, -2208, -5051 },
+ { -3377, 2981, -1655, -4815 },
+ { -3325, 2446, -1787, -6116 },
+ { -2341, 2737, -3240, -6347 },
+ { -2258, -3732, 3710, -1235 },
+ { -1558, -3849, 2694, -3012 },
+ { -599, -4837, 3050, -2951 },
+ { -2246, -5433, 2798, -1910 },
+ { -2255, -4989, 3260, 270 },
+ { -3026, -5353, 2693, -1036 },
+ { -1151, -6097, 1097, -3782 },
+ { -3391, -6012, 2130, -1303 },
+ { -2850, -4422, 3375, -480 },
+ { -1138, -3779, 1491, -4162 },
+ { -551, -3892, 3787, -2082 },
+ { -3221, -3676, 3144, -1202 },
+ { -3023, -5196, 2650, 605 },
+ { -1756, -5729, 2646, 321 },
+ { -2693, -4409, 494, -4797 },
+ { -1913, -4573, 3372, -1730 },
+ { -1277, -3604, 4061, -993 },
+ { -420, -4993, 1351, -4796 },
+ { -3052, -5333, 1435, -1242 },
+ { -602, -5034, 3869, -1141 },
+ { -2436, -4680, 1665, -3019 },
+ { -2657, -3658, 1459, -3391 },
+ { -1220, -6246, 2749, -525 },
+ { -3838, -4844, 2265, -1735 },
+ { -1247, -5679, 3356, -1417 },
+ { -917, -5448, 3342, 105 },
+ { -1756, -6839, 2276, -2350 },
+ { -412, -5206, 1764, -3539 },
+ { -1439, -6915, 1442, -3750 },
+ { -1381, -4439, 3863, -282 },
+ { -3482, -4953, 2726, -336 },
+ { -1376, -5931, 1714, -1987 },
+ { -1716, -4405, 2608, 105 },
+ { -1590, -5191, 2652, -2704 },
+ { -2149, -6442, 2453, -1263 },
+ { -3426, -3832, 2334, -1829 },
+ { -2747, -5948, 2362, -173 },
+ { -2435, -3267, 2966, -1710 },
+ { -3979, -4282, 2705, -775 },
+ { -356, -4238, 2544, -4343 },
+ { -1363, -6471, 2817, -1836 },
+ { -2878, -5117, 218, -3149 },
+ { -3539, -5196, 1710, -2356 },
+ { -2888, -4537, 2746, -1701 },
+ { -1870, -4439, 1496, -4121 },
+ { -1486, -3388, 3349, -2145 },
+ { -3333, -4138, 1467, -2876 },
+ { -345, -5340, 1012, -1190 },
+ { -1672, -4992, 2289, -1029 },
+ { -2146, -5528, 3038, -635 },
+ { -316, -3656, 3426, -3152 },
+ { -2695, -5812, 2336, -2050 },
+ { -2067, -6052, 737, -3258 },
+ { -2664, -4205, -350, -1266 },
+ { -617, -5406, 80, -4853 },
+ { -2418, -3825, 1853, -1326 },
+ { -1961, -4339, 583, -4315 },
+ { -1495, -5141, -133, -5205 },
+ { -3208, -6440, 1691, -2069 },
+ { -2632, -3633, 2325, -2761 },
+ { -2624, -5670, 1252, -3676 },
+ { -3687, -5608, 687, -2833 },
+ { -3320, -5707, 16, -3877 },
+ { -2738, -6112, 84, -5135 },
+ { 2277, -5661, 3076, 843 },
+ { 1555, -5769, 2821, -5236 },
+ { 536, -6381, 603, -4910 },
+ { 734, -4609, 3314, -4092 },
+ { 1836, -4547, 3267, -4322 },
+ { -13, -5976, 3752, -1607 },
+ { 1423, -6318, 2336, 398 },
+ { 365, -7779, 1498, -534 },
+ { 2104, -8366, 2946, -1345 },
+ { 143, -5545, 1898, -3756 },
+ { 655, -6852, 1430, 148 },
+ { 4, -6653, 2397, -59 },
+ { 2346, -5996, 4562, -934 },
+ { 1229, -7104, 2963, -598 },
+ { -528, -7048, 2887, -1790 },
+ { 1451, -6857, 3900, -1637 },
+ { 554, -6018, 3336, 9 },
+ { 3278, -5758, 4034, 129 },
+ { 3541, -7145, 4905, -1575 },
+ { 2339, -6907, 3464, -301 },
+ { 2775, -7301, 1667, -3894 },
+ { 539, -7887, 991, -4156 },
+ { 2115, -7421, 3131, -3075 },
+ { 2803, -8546, 2564, -5836 },
+ { 2869, -5833, 1620, -4561 },
+ { 2591, -7281, 3215, -4719 },
+ { -1228, -8477, 706, -4782 },
+ { 1967, -5243, 4813, -1940 },
+ { 701, -7010, 2273, -3893 },
+ { 915, -8470, 1918, -5620 },
+ { -94, -6715, 156, -3873 },
+ { 1074, -5607, 4389, -1017 },
+ { 2739, -6551, 1227, -3521 },
+ { 725, -7835, 2701, -1291 },
+ { -493, -7475, 2263, -1075 },
+ { -412, -6508, 2984, -744 },
+ { 665, -5451, 3725, -2692 },
+ { 1499, -8129, 3564, -2072 },
+ { 2870, -6333, 4487, -2108 },
+ { 706, -5007, 3911, -152 },
+ { -482, -8660, 1483, -2900 },
+ { 2481, -6596, 2518, -1715 },
+ { 1403, -6414, 1398, -5387 },
+ { 652, -6267, 583, -5942 },
+ { 694, -7540, 646, -6272 },
+ { 2275, -7614, 256, -5015 },
+ { 1416, -9727, 1900, -3153 },
+ { 2760, -6433, 3875, -3771 },
+ { 2325, -11196, 2182, -5155 },
+ { 1223, -11061, 1377, -5097 },
+ { 108, -10603, 307, -4952 },
+ { -118, -8268, 1650, -1572 },
+ { 1839, -7943, 1755, -612 },
+ { 2501, -9056, 981, -2969 },
+ { 2902, -8476, 1491, -5780 },
+ { 1995, -11175, 1585, -3643 },
+ { 696, -8212, 828, -2474 },
+ { 1526, -8649, 1380, -1210 },
+ { 461, -7253, 3222, -2229 },
+ { 2966, -8641, 4121, -3271 },
+ { 833, -6039, 2361, -1086 },
+ { 3565, -7312, 1980, -5427 },
+ { 2850, -8671, 3760, -1846 },
+ { 2643, -7281, 2163, -173 },
+ { 3463, -3706, -3132, -923 },
+ { 1315, -3825, -3443, 2 },
+ { 2594, -4083, -3815, 670 },
+ { 1826, -4291, -2741, -155 },
+ { 868, -3749, -4175, -298 },
+ { 2008, -4237, -3897, -517 },
+ { 1242, -3493, -4335, -1335 },
+ { -88, -4142, -3390, -1529 },
+ { 2176, -3488, -3822, -975 },
+ { 1706, -5188, -3415, -637 },
+ { 2717, -6159, -2333, -882 },
+ { 1276, -3978, -4361, 537 },
+ { 2471, -5556, -2866, -208 },
+ { 799, -4673, -4086, 56 },
+ { 1901, -4786, -3533, 270 },
+ { 3036, -3902, -3606, -333 },
+ { 2249, -3317, -4319, -144 },
+ { 2594, -4207, -2105, -2930 },
+ { 4008, -4774, -2626, -902 },
+ { 1038, -3659, -3496, -2454 },
+ { 2725, -3597, -3298, -1535 },
+ { 1662, -5803, -2813, 175 },
+ { 705, -3757, -3441, -1484 },
+ { 1860, -5987, -2821, -886 },
+ { 3786, -4918, -2199, -1929 },
+ { 3683, -4235, -2547, -1287 },
+ { 2531, -4896, -2956, -1593 },
+ { 1005, -5585, -3324, -180 },
+ { 1625, -5229, -1756, -3642 },
+ { 1494, -5041, -2989, -2685 },
+ { 2718, -4655, -3224, -867 },
+ { 2374, -6640, -1745, -2975 },
+ { 2133, -6436, -2477, -1499 },
+ { 1833, -4418, -3523, -1512 },
+ { 1128, -4910, -2658, -1106 },
+ { 689, -4777, -2831, -2085 },
+ { 3593, -5280, -2627, -315 },
+ { 3264, -3771, -2673, -1861 },
+ { 3202, -5602, -2409, 402 },
+ { 552, -4618, -2221, -3002 },
+ { 3095, -5356, -2666, -1083 },
+ { 3401, -4609, -3146, 45 },
+ { 3051, -4662, -2192, -2232 },
+ { 2798, -5552, -2462, -1941 },
+ { 2354, -5815, -2223, -2619 },
+ { 192, -3708, -2807, -2658 },
+ { 1886, -4226, -1862, -3529 },
+ { 2526, -3976, -2819, -2332 },
+ { 1577, -3870, -2711, -2806 },
+ { 1288, -5588, -3382, -1403 },
+ { 2711, -5399, -1564, -3253 },
+ { 1459, -5492, -2222, -322 },
+ { 2823, -5091, -2886, 776 },
+ { 3559, -5821, -2109, -1360 },
+ { 1587, -6331, -2760, -1909 },
+ { 2139, -5213, -2874, -2120 },
+ { 1318, -4337, -3695, -2098 },
+ { 821, -4471, -1849, -565 },
+ { 3329, -4782, -1725, -89 },
+ { 582, -4914, -4105, -1119 },
+ { 417, -4144, -4072, -2529 },
+ { -199, -3803, -2765, -4042 },
+ { 2731, -4283, -2143, 1 },
+ { 2911, -6187, -1951, -2116 },
+ { 1573, -6094, -493, -2838 },
+ { 2081, -6927, -864, -3211 },
+ { 1058, -7826, 79, -364 },
+ { 3147, -5570, -684, -978 },
+ { 3572, -5856, 1060, 1824 },
+ { 1143, -6702, -1478, 338 },
+ { 2341, -7220, -88, 260 },
+ { 3639, -6861, 668, 815 },
+ { 2227, -6268, -1706, 446 },
+ { 3390, -6082, -353, 1302 },
+ { 1123, -7556, -1237, -430 },
+ { 1729, -7742, 729, -218 },
+ { 1457, -6774, 587, 579 },
+ { 505, -6919, -569, 371 },
+ { 1106, -7245, 78, 158 },
+ { 2755, -6745, -1122, 338 },
+ { 3069, -6040, -1415, 986 },
+ { 2174, -7064, -1430, -283 },
+ { 1390, -8626, -446, -3031 },
+ { 3534, -6890, -431, 547 },
+ { 2267, -9618, 475, -2994 },
+ { 3672, -7673, 75, -115 },
+ { 2131, -7560, -1206, -750 },
+ { 2972, -7477, -685, -262 },
+ { 1604, -6637, -672, 699 },
+ { 1666, -7577, -577, -240 },
+ { 1591, -6554, -2158, -94 },
+ { 2348, -6286, -353, 1123 },
+ { 2017, -8810, -412, -1805 },
+ { 2892, -6713, -1765, -554 },
+ { 2500, -6828, -1995, -1197 },
+ { 3877, -6639, -224, -1655 },
+ { 2392, -7872, -91, -333 },
+ { 3562, -7370, -532, -2836 },
+ { 2552, -7614, 164, -1805 },
+ { 990, -6104, 218, 438 },
+ { 910, -7861, 312, -1195 },
+ { 1472, -6327, 372, -640 },
+ { 1576, -7143, -1983, -843 },
+ { 422, -7625, -457, -278 },
+ { 1797, -8532, 405, -1011 },
+ { 1088, -7396, -238, -2277 },
+ { 3209, -6753, -1431, -2072 },
+ { 2617, -6839, 100, -2573 },
+ { 2575, -8573, -387, -3188 },
+ { 3618, -6971, -1190, -321 },
+ { 2205, -7361, -1695, -2008 },
+ { 2985, -6297, 1464, 1179 },
+ { 2804, -7310, 1053, 338 },
+ { 1362, -6074, -1163, -840 },
+ { 3336, -6325, -1794, 21 },
+ { 2836, -8109, 818, -329 },
+ { 2791, -5879, 560, 1546 },
+ { 2392, -6064, 135, 100 },
+ { 1838, -6194, 596, 1085 },
+ { 1926, -7515, -414, -4901 },
+ { 3225, -7298, -1202, -1189 },
+ { 3960, -7558, -659, -719 },
+ { 3442, -6647, -1692, -1095 },
+ { 3381, -6441, 262, -886 },
+ { 1431, -8150, -1186, -1406 },
+ { 340, -8498, -150, -899 },
+ { 3004, -8149, -260, -953 },
+ { 2749, -6611, 563, 873 },
+ { -6647, -1325, -4517, -4691 },
+ { -6005, -1657, -4089, -3797 },
+ { -3157, 588, -5213, -3068 },
+ { -3311, -1425, -6329, -3726 },
+ { -5866, -819, -3857, -2744 },
+ { -5001, -1799, -1075, -4621 },
+ { -5330, -2650, -2672, -4664 },
+ { -4930, -539, -2363, -4010 },
+ { -2984, 10, -3863, -5749 },
+ { -1055, -2106, -3713, -4267 },
+ { -5476, -502, -4279, -6504 },
+ { -5231, -1543, -5018, -6425 },
+ { -5134, -363, -3165, -5109 },
+ { -3953, -771, -4107, -6393 },
+ { -2159, -563, -3652, -5342 },
+ { -3888, -2321, -919, -5057 },
+ { -1236, -597, -4235, -4193 },
+ { -4053, 675, -3083, -6174 },
+ { -2793, -1089, -5396, -3460 },
+ { -3000, -44, -2209, -6575 },
+ { -3336, -1531, -4313, -5160 },
+ { -2127, 128, -4851, -3692 },
+ { -3321, 136, -2067, -5660 },
+ { -5215, 1404, -4374, -4356 },
+ { -2747, 400, -6340, -3691 },
+ { -3926, -599, -5361, -5006 },
+ { -2875, -2592, -5143, -4092 },
+ { -4991, -1958, -5322, -4891 },
+ { -4965, -1318, -6652, -5333 },
+ { -4920, -1691, -3388, -5561 },
+ { -3644, -3354, -2688, -5982 },
+ { -5076, -919, -4563, -2984 },
+ { -6114, 250, -3884, -3915 },
+ { -4014, 744, -3973, -1924 },
+ { -5543, -1041, -5557, -3847 },
+ { -4711, -1352, -5649, -2603 },
+ { -3362, 775, -5305, -4879 },
+ { -5001, 107, -3554, -2888 },
+ { -6258, -1651, -6356, -6566 },
+ { -4529, 407, -5003, -3865 },
+ { -5154, 550, -5278, -5465 },
+ { -4195, -467, -1894, -3129 },
+ { -5022, 1127, -3349, -3314 },
+ { -6075, 1250, -4313, -5641 },
+ { -2677, -2283, -2312, -5903 },
+ { -4113, 193, -1195, -4833 },
+ { -3940, -1048, -1389, -5079 },
+ { -3703, 917, -4043, -4451 },
+ { -3366, -4231, -1534, -5488 },
+ { -3326, -3583, -2091, -4903 },
+ { -5144, 1254, -2532, -4949 },
+ { -5982, -870, -2545, -4555 },
+ { -3925, -157, -5367, -2281 },
+ { -6419, -746, -5668, -4371 },
+ { -5787, 518, -7096, -5805 },
+ { -4258, 954, -6453, -4321 },
+ { -4771, -695, -4158, -1639 },
+ { -7078, -760, -5195, -5877 },
+ { -7348, 83, -4101, -4586 },
+ { -2430, 184, -2874, -1679 },
+ { -2284, -3943, -2924, -5034 },
+ { -1804, -1785, -3002, -4710 },
+ { -4399, -2772, -1815, -4637 },
+ { -6340, -2626, -2824, -5191 },
+ { -4998, -5168, -3480, 1905 },
+ { -3958, -5492, -1599, 1579 },
+ { -2471, -3755, -276, 3182 },
+ { -3033, -5779, -1063, 1554 },
+ { -2936, -4829, -1290, 2386 },
+ { -1835, -5073, -3051, 1299 },
+ { -1724, -3771, -3935, 2324 },
+ { -5070, -2550, -3692, 768 },
+ { -4326, -5333, -297, 1878 },
+ { -3472, -5619, -3094, 992 },
+ { -3027, -4384, -3038, 2265 },
+ { -3201, -5332, 67, 2200 },
+ { -1681, -4373, -1947, 2461 },
+ { -3221, -3329, -4238, 2564 },
+ { -1262, -2968, -2915, 3227 },
+ { -3419, -1878, -3373, 2110 },
+ { -2244, -5583, -2012, 1288 },
+ { -1971, -5266, -990, 1812 },
+ { -2975, -2778, -452, 4063 },
+ { -2198, -1165, -3298, 2965 },
+ { -4782, -4894, -4767, 664 },
+ { -6002, -3950, -2806, 2025 },
+ { -3142, -3162, -2859, 3295 },
+ { -3262, -3340, -4123, 1596 },
+ { -4014, -3918, -1955, 3361 },
+ { -1700, -3463, -1346, 3449 },
+ { -4245, -4445, -4743, 1644 },
+ { -4180, -3969, -401, 3281 },
+ { -2782, -5240, -4117, 1156 },
+ { -5744, -4040, -1439, 3470 },
+ { -5063, -4663, -323, 3172 },
+ { -4531, -3319, -844, 3988 },
+ { -6226, -5125, -2064, 2976 },
+ { -3115, -3267, -1531, 3898 },
+ { -4628, -4421, -2864, 2808 },
+ { -4559, -2989, -3442, 2024 },
+ { -1775, -4487, -656, 2477 },
+ { -2664, -1865, -1884, 4081 },
+ { -1828, -2575, -3894, 3378 },
+ { -6441, -3677, -2025, 1677 },
+ { -4141, -2156, -1191, 3474 },
+ { -4802, -1623, -1727, 2160 },
+ { -5474, -2745, -1475, 2498 },
+ { -3664, -1056, -1975, 2491 },
+ { -4672, -3062, -2235, 2933 },
+ { -4205, -5960, -2849, 1517 },
+ { -4995, -5708, -1739, 1805 },
+ { -4892, -6080, -4793, 872 },
+ { -4270, -4172, -4263, 2185 },
+ { -4687, -1470, -2905, 1023 },
+ { -6446, -5017, -3919, 1000 },
+ { -6046, -5538, -3943, 2006 },
+ { -6028, -3750, -3953, 771 },
+ { -5959, -4582, -5024, 824 },
+ { -5818, -2576, -2249, 1326 },
+ { -5659, -5345, -1119, 2500 },
+ { -3346, -4155, 606, 2749 },
+ { -5680, -4827, -2501, 1838 },
+ { -6193, -2543, -1295, 840 },
+ { -6871, -4925, -3512, 1801 },
+ { -5605, -1788, -1895, 779 },
+ { -3922, -5712, -4644, 510 },
+ { -4745, -3869, -4533, 99 },
+ { -2984, -4907, -399, 1497 },
+ { 1847, -478, 3061, -5812 },
+ { 4450, -1116, 3609, -6570 },
+ { 3139, 99, 3007, -5532 },
+ { 2590, -3782, 3138, -4770 },
+ { 1881, 1204, 5778, -3404 },
+ { 3631, 2060, 5566, -5038 },
+ { 3461, 1961, 5167, -3800 },
+ { 2947, 273, 4536, -4389 },
+ { 4453, -1730, 5788, -4370 },
+ { 4032, 1805, 2666, -4534 },
+ { 3487, -944, 2313, -6028 },
+ { 1313, 34, 4210, -4067 },
+ { 5632, -1502, 5825, -5855 },
+ { 7736, -547, 4879, -5476 },
+ { 4906, -1512, 4760, -5760 },
+ { 3843, 447, 1091, -4958 },
+ { 2982, -1135, 5442, -4386 },
+ { 3579, 271, 3031, -6770 },
+ { 3932, -211, 4688, -5507 },
+ { 4411, 1720, 2387, -5584 },
+ { 5379, -479, 4575, -6280 },
+ { 3613, -362, 2012, -4885 },
+ { 3744, -2013, 4493, -5073 },
+ { 5693, 109, 4379, -3362 },
+ { 5475, -621, 5317, -3985 },
+ { 6411, -673, 5708, -4752 },
+ { 4933, -796, 7262, -4290 },
+ { 2804, 444, 6276, -3655 },
+ { 4120, -517, 6078, -4531 },
+ { 5119, 841, 3486, -3910 },
+ { 4738, 1539, 3525, -2970 },
+ { 5086, 370, 5895, -5640 },
+ { 4235, 2716, 4589, -5044 },
+ { 3691, 682, 6199, -4700 },
+ { 6111, -570, 6271, -6528 },
+ { 2611, 1277, 3756, -4802 },
+ { 4395, 970, 3807, -5879 },
+ { 5225, 2299, 3242, -4333 },
+ { 5144, 1778, 4946, -5545 },
+ { 2989, -3016, 3247, -5495 },
+ { 2983, 920, 2071, -6059 },
+ { 5270, -903, 4434, -2350 },
+ { 6415, -585, 3970, -3554 },
+ { 3866, -197, 5216, -2884 },
+ { 3767, -1298, 6702, -3315 },
+ { 6299, 2620, 5284, -6824 },
+ { 6654, 646, 3653, -4927 },
+ { 4770, 3047, 5160, -6287 },
+ { 5364, 434, 2919, -5207 },
+ { 2998, 1344, 4801, -2456 },
+ { 3896, 1013, 3773, -1864 },
+ { 2115, 655, 2999, -6344 },
+ { 5170, -981, 2849, -4464 },
+ { 2735, -2159, 2717, -5776 },
+ { 2430, -1952, 4392, -4559 },
+ { 6143, -1180, 3659, -4746 },
+ { 4978, -1483, 1726, -4875 },
+ { 3486, -2383, 3306, -4301 },
+ { 1434, -1372, 4171, -4770 },
+ { 3354, -2627, 1525, -5093 },
+ { 6790, 2386, 3995, -5909 },
+ { 1475, -2674, 3451, -4204 },
+ { 1999, -3494, 3693, -5556 },
+ { 4764, -2848, 2856, -5589 },
+ { -3677, 5131, 2827, -2934 },
+ { -2844, 7078, 2852, -3580 },
+ { -3902, 6434, 4118, -1911 },
+ { -1769, 7530, 3492, -3541 },
+ { -1937, 5679, -447, -1127 },
+ { -2456, 4680, 4196, -2407 },
+ { -2778, 8241, 1698, -4288 },
+ { -2876, 6104, 5182, -2387 },
+ { -2802, 7341, 4463, -2938 },
+ { -1025, 6267, 4752, -3201 },
+ { -2349, 5413, 2041, -3794 },
+ { -2252, 8225, 2856, -4269 },
+ { -1465, 4967, 4976, -2500 },
+ { -636, 7565, 3517, -4233 },
+ { -1905, 5618, 3904, -2942 },
+ { -302, 6816, 3343, -3316 },
+ { -2210, 4156, 2817, -3511 },
+ { -717, 6568, 1863, -2951 },
+ { -3873, 5682, 2164, -575 },
+ { -2878, 5835, 440, -2597 },
+ { -3228, 7701, 2610, -2514 },
+ { -3608, 8888, 3377, -2468 },
+ { -2582, 9717, 2519, -3126 },
+ { -5238, 6202, 2866, -2831 },
+ { -3428, 7370, 3056, -335 },
+ { -1681, 8836, 1210, -2010 },
+ { -3276, 6724, 1156, -3930 },
+ { -894, 8149, 827, -1258 },
+ { -2965, 8631, 2549, -1320 },
+ { -3961, 6902, 3581, 55 },
+ { -1894, 7745, 1750, -841 },
+ { -821, 6844, 850, -676 },
+ { -608, 6948, -4, -1376 },
+ { 615, 6524, 1089, -1147 },
+ { -2972, 5668, 1091, -489 },
+ { -157, 4649, 2904, -413 },
+ { 673, 5121, 1498, -66 },
+ { -390, 5902, 1611, -245 },
+ { -2349, 5478, 4772, -1320 },
+ { 88, 6798, 1972, -1859 },
+ { -1213, 5120, 2991, 200 },
+ { -2347, 6040, 2839, 376 },
+ { -578, 5976, 3364, -1796 },
+ { -1391, 5872, 3002, -965 },
+ { -564, 4496, 3946, -1186 },
+ { -2299, 6386, 3135, -2176 },
+ { -2131, 5641, 2011, 1223 },
+ { -772, 5807, 1124, 895 },
+ { -2837, 6758, 2297, -740 },
+ { -3091, 6298, 1415, -2126 },
+ { -4197, 6036, 1843, -3022 },
+ { -41, 6459, 92, 344 },
+ { -2241, 6860, 2095, -4396 },
+ { -1931, 7088, 2117, -2135 },
+ { -2375, 4422, 1688, -3169 },
+ { -1742, 6674, 1538, -119 },
+ { -4818, 7749, 4192, -1577 },
+ { -2004, 5672, 193, -430 },
+ { -3825, 6042, 2128, -1898 },
+ { -1108, 8033, 2119, -3013 },
+ { -2370, 5453, 1721, 266 },
+ { -1570, 7134, 614, -2638 },
+ { -1519, 8752, 3503, -4330 },
+ { -2050, 3845, 2907, -1126 },
+ { 5085, 4412, -335, -1923 },
+ { 3618, 1423, -613, -4012 },
+ { 4481, 3729, 589, -4631 },
+ { 4270, 3216, -1763, -3168 },
+ { 4241, 1796, -1701, -2796 },
+ { 4787, 2338, -487, -3639 },
+ { 2915, 3429, -621, -4753 },
+ { 5175, 1660, -1265, -3223 },
+ { 4280, 4057, -684, -4079 },
+ { 4980, 4419, -1455, -2719 },
+ { 5436, 2464, 387, -4197 },
+ { 4507, 4018, 1121, -3314 },
+ { 6020, 2401, -413, -3201 },
+ { 4200, 3789, -333, -2813 },
+ { 5229, 2493, -1194, -1878 },
+ { 5851, 2695, -492, -2292 },
+ { 5743, 3288, -697, -1221 },
+ { 5692, 2612, 979, -2227 },
+ { 5085, 2067, 1046, -1214 },
+ { 3163, 2240, -2098, -3435 },
+ { 5228, 1898, 145, -2397 },
+ { 5860, 3976, -418, -2872 },
+ { 6008, 3399, 1027, -3506 },
+ { 4126, 2035, 1865, -893 },
+ { 5375, 3596, 511, -2362 },
+ { 1937, 1493, -852, -122 },
+ { 3473, 4849, 547, -2603 },
+ { 4631, 2977, 1141, -1768 },
+ { 6149, 3050, -71, -1886 },
+ { 4069, 4353, -289, -1429 },
+ { 2884, 1225, -1388, 365 },
+ { 5485, 2518, -235, -571 },
+ { 1216, 4375, 1443, 398 },
+ { 4988, 3106, 107, -1435 },
+ { 4511, 2801, 307, -444 },
+ { 3235, 4386, 327, -676 },
+ { 2055, 3708, 1657, -305 },
+ { 5839, 2374, 290, -1385 },
+ { 5110, 3305, 1936, -4206 },
+ { 6416, 2920, 338, -2736 },
+ { 3350, 2824, -1269, -3881 },
+ { 4840, 1815, 464, 186 },
+ { 2399, 3332, 238, 1238 },
+ { 3516, 1363, 1582, 688 },
+ { 3582, 1874, 154, -4770 },
+ { 3261, 2878, 886, 283 },
+ { 3877, 2658, -327, 884 },
+ { 4151, 3436, 2173, -2923 },
+ { 3592, 3674, 1281, -1295 },
+ { 4561, 3730, -1114, -1747 },
+ { 4595, 3625, -558, -575 },
+ { 2577, 2348, 2267, 120 },
+ { 5242, 3299, 32, -3412 },
+ { 4264, 3637, 709, -2320 },
+ { 6556, 3570, -838, -2472 },
+ { 5745, 4014, -940, -1973 },
+ { 5629, 4475, 477, -3328 },
+ { 5269, 3199, 1682, -3085 },
+ { 4432, 2416, 1145, -3299 },
+ { 4465, 2505, 2162, -2186 },
+ { 4643, 4941, -88, -2885 },
+ { 4568, 5231, 552, -3915 },
+ { 5667, 3075, -1406, -2963 },
+ { 5418, 5259, -771, -2818 },
+ { -256, -7875, 511, -471 },
+ { -1813, -7971, -424, -396 },
+ { -306, -7006, 862, 282 },
+ { -2306, -6422, -1440, 508 },
+ { -245, -6787, 375, -100 },
+ { -1309, -6065, -20, 779 },
+ { -1656, -6047, -641, 1307 },
+ { -1496, -6522, 964, 726 },
+ { -2291, -6588, -202, 795 },
+ { -762, -7522, 1454, -558 },
+ { -2270, -7004, -834, -580 },
+ { -1139, -7078, 259, 362 },
+ { -2535, -7568, -1040, 49 },
+ { -3786, -7280, 934, -476 },
+ { -3336, -6368, 606, 1056 },
+ { -3602, -6924, 52, 714 },
+ { -2278, -6550, 1674, 204 },
+ { -2855, -5765, 930, 1530 },
+ { -2889, -7325, -215, 305 },
+ { -2749, -6080, -237, 1452 },
+ { -985, -6667, 1577, 400 },
+ { -2036, -6083, 380, 1267 },
+ { -2077, -7460, 380, -30 },
+ { -1775, -7175, 1540, -386 },
+ { -3065, -6927, 989, 168 },
+ { -2836, -7602, 117, -3392 },
+ { -1058, -6396, 593, -3078 },
+ { -844, -6062, 999, -236 },
+ { -3261, -6951, 1491, -720 },
+ { -2186, -8484, 75, -1287 },
+ { -2882, -7756, 456, -510 },
+ { -1800, -6879, 960, -1183 },
+ { -2554, -7241, 1614, -1474 },
+ { -2608, -5305, 392, 851 },
+ { -2973, -6562, -859, 858 },
+ { -2640, -5989, 1031, -416 },
+ { -977, -8366, 705, -1434 },
+ { -1213, -7409, -77, -1390 },
+ { -1335, -6657, 2125, -123 },
+ { -2544, -6862, 1852, -737 },
+ { -3235, -6422, 1752, -103 },
+ { -1300, -7557, 939, -348 },
+ { -3476, -7579, 202, -109 },
+ { -2482, -6572, 753, 619 },
+ { -2554, -8136, -648, -429 },
+ { -1012, -7870, -3, -421 },
+ { -3604, -6247, 32, -3102 },
+ { -1486, -7271, 2013, -1021 },
+ { -578, -6799, -523, 405 },
+ { -2841, -5948, 1644, 911 },
+ { -2411, -7473, 1084, -484 },
+ { -2238, -6033, 294, -1059 },
+ { -3459, -6470, -201, -790 },
+ { -2027, -6009, 1833, 805 },
+ { -1433, -8047, 1531, -1754 },
+ { -3258, -7884, 763, -1422 },
+ { -1544, -6928, -729, 478 },
+ { -2314, -8415, 74, -3757 },
+ { -3201, -5684, 95, -2214 },
+ { -2423, -8694, 725, -3631 },
+ { -3545, -7071, 1162, -1798 },
+ { -294, -9662, 403, -2274 },
+ { -2290, -5460, 1196, 402 },
+ { -1603, -6713, 903, -2363 },
+ { 4121, 2491, -3142, -2482 },
+ { 4500, 3305, -3671, -1567 },
+ { 5973, 3172, -1348, -534 },
+ { 4830, 3379, -1549, 643 },
+ { 5214, 3938, -2641, -2302 },
+ { 4639, 4826, -5532, -847 },
+ { 5639, 2731, -2170, -963 },
+ { 6084, 3487, -3525, -1346 },
+ { 5971, 3154, -2190, -2316 },
+ { 5618, 4865, -6927, 116 },
+ { 5345, 3568, -7391, 709 },
+ { 5429, 5078, -3811, -1524 },
+ { 6960, 2037, -3515, -1096 },
+ { 7092, 2531, -4557, -588 },
+ { 6061, 4247, -5651, -478 },
+ { 4595, 3684, -4907, -827 },
+ { 7497, 3213, -3048, -424 },
+ { 5996, 2137, -3098, -1745 },
+ { 6198, 5199, -2223, -2274 },
+ { 6888, 2851, -2768, -1675 },
+ { 6114, 4210, -2316, -954 },
+ { 7127, 4242, -3041, -1408 },
+ { 6126, 3668, -1517, -1427 },
+ { 6245, 6129, -4225, -1186 },
+ { 6816, 3213, -2101, -964 },
+ { 5345, 5276, -2643, -847 },
+ { 6592, 4665, -4338, 484 },
+ { 6746, 3751, -3443, 124 },
+ { 5453, 1980, -2738, 2606 },
+ { 4662, 2179, -4226, -1059 },
+ { 5571, 3208, -3554, 174 },
+ { 5256, 4447, -1815, -1481 },
+ { 5400, 2570, -1210, 235 },
+ { 7056, 2549, -2674, 318 },
+ { 4574, 4340, -2892, -130 },
+ { 6203, 4587, -3273, -305 },
+ { 5103, 1925, -2715, -2137 },
+ { 3905, 4296, -1700, 247 },
+ { 4421, 4605, -3299, 811 },
+ { 5671, 1273, -3870, -924 },
+ { 5486, 1805, -4901, 133 },
+ { 6437, 2578, -1828, -106 },
+ { 5530, 5253, -5058, 1223 },
+ { 4816, 2025, -1215, 1443 },
+ { 3457, 3525, -2456, 3217 },
+ { 3316, 2595, -1108, 2459 },
+ { 3068, 3810, -2207, 1926 },
+ { 6351, 5436, -6470, 600 },
+ { 6324, 4240, -5365, 2416 },
+ { 4851, 4774, -4075, 1878 },
+ { 4900, 3679, -5198, 1078 },
+ { 8347, 3633, -4565, -171 },
+ { 5244, 5718, -3853, 173 },
+ { 3960, 3492, -2939, 2105 },
+ { 6070, 3473, -2351, 161 },
+ { 8228, 3034, -3360, -901 },
+ { 7006, 3985, -1940, -1926 },
+ { 7123, 4681, -4301, -878 },
+ { 5122, 4097, -1851, -449 },
+ { 6200, 2060, -2251, 1049 },
+ { 7106, 3844, -7209, 2625 },
+ { 7108, 3370, -6734, 533 },
+ { 6859, 2849, -3992, 1360 },
+ { 5458, 2278, -3253, 1131 },
+ { -1072, -2109, 4783, -1073 },
+ { -319, -2604, 4257, -2418 },
+ { 2466, 1300, 3476, -314 },
+ { 2847, -1502, 5296, -141 },
+ { 1667, -1273, 5559, -2725 },
+ { 2877, -3402, 6434, 204 },
+ { 53, -2637, 5275, -1181 },
+ { 1091, -2215, 5803, -1549 },
+ { 2397, -922, 4327, 1182 },
+ { 219, -3747, 4647, -1564 },
+ { -29, -2705, 4812, 1277 },
+ { 1499, -2608, 5648, 1407 },
+ { 2139, -2399, 4202, 2791 },
+ { -426, -2064, 5528, 151 },
+ { 2560, -2803, 6179, -2806 },
+ { 4537, -2479, 3797, 1095 },
+ { 888, -3357, 5341, -415 },
+ { 4460, -1814, 5388, -1227 },
+ { 3920, -3268, 6364, -703 },
+ { 3343, -4698, 4410, 784 },
+ { 309, -1897, 6306, 1223 },
+ { 958, -3318, 4254, -3167 },
+ { -99, 1596, 6018, -1983 },
+ { -429, -853, 6407, 878 },
+ { 1170, -1322, 6290, -417 },
+ { 2288, -505, 6303, -1999 },
+ { 3312, -1674, 6749, -2494 },
+ { -415, -3401, 4721, -371 },
+ { -189, -1210, 4844, -2002 },
+ { 888, -4142, 4377, 130 },
+ { 2469, -4381, 5398, -2492 },
+ { 2879, -2912, 5094, -2598 },
+ { -717, -617, 5650, -685 },
+ { 1470, -3863, 5352, -1684 },
+ { 3935, -96, 3823, -730 },
+ { 3769, -430, 3168, 694 },
+ { 2556, 385, 3539, 512 },
+ { 77, -1415, 5111, 2655 },
+ { 2724, -2158, 6715, -822 },
+ { 1832, 1001, 5385, -1900 },
+ { 900, 2198, 4464, -559 },
+ { 441, 69, 5921, -1743 },
+ { -1161, 738, 6732, -308 },
+ { 257, 2035, 4091, 736 },
+ { 1607, 1288, 4355, -23 },
+ { -13, 1316, 4180, 1672 },
+ { 1511, 1336, 3057, 1435 },
+ { 2189, -3813, 4530, 939 },
+ { 3632, -706, 2646, 1375 },
+ { 4266, -3761, 4241, 1077 },
+ { 3101, -427, 5273, -1202 },
+ { 2293, 276, 4810, -313 },
+ { 3430, -1851, 3101, 2045 },
+ { 3453, -2979, 5142, 942 },
+ { 1683, -3281, 4802, 2002 },
+ { 3954, -4715, 5611, 578 },
+ { 1272, -155, 5085, 454 },
+ { 128, -194, 5095, 1409 },
+ { 820, 880, 5797, -2658 },
+ { -1095, 656, 5774, 1095 },
+ { 813, -1669, 4320, -3251 },
+ { -119, 518, 6372, -651 },
+ { 2922, -4299, 6115, -877 },
+ { 4205, -4273, 4004, 2642 },
+ { -1211, -3892, 224, 3127 },
+ { -34, -4371, 1321, 2318 },
+ { 77, -6326, 1201, 828 },
+ { 3995, -3775, 1958, 3233 },
+ { 178, -3301, 1985, 3318 },
+ { 2330, -3801, 1033, 3195 },
+ { 1413, -5536, 826, 1709 },
+ { 2468, -3499, 3653, 3631 },
+ { 741, -4617, 1723, 2008 },
+ { 1246, -3043, 2978, 3949 },
+ { -343, -4308, 2258, 2189 },
+ { -682, -4640, 454, 2272 },
+ { 1236, -4829, 2491, 1642 },
+ { -512, -3766, 1182, 3052 },
+ { 119, -3939, 3712, 971 },
+ { -1145, -4624, 1360, 2281 },
+ { 101, -4746, 2866, 1255 },
+ { -1500, -5455, 539, 1637 },
+ { -969, -5909, 1414, 1128 },
+ { -1261, -4939, -231, 2022 },
+ { -226, -5345, 1207, 705 },
+ { 2712, -5109, 3205, 1866 },
+ { -476, -5913, 273, 1208 },
+ { -2039, -4464, 624, 2545 },
+ { -2351, -3930, 2019, 2673 },
+ { -2675, -4849, 1522, 1990 },
+ { -1524, -3461, 1446, 3204 },
+ { 477, -5314, 1710, 1577 },
+ { 656, -3729, 2346, 2511 },
+ { 550, -5917, 1975, 1040 },
+ { 1728, -4704, 3067, 1058 },
+ { -9, -5247, 506, 1760 },
+ { -574, -5135, 1675, 1672 },
+ { 2129, -3781, 3444, 2313 },
+ { 1144, -4439, 2214, 2529 },
+ { 1292, -4160, 3185, 1833 },
+ { 2445, -3262, 2534, 3227 },
+ { 2266, -4401, 2023, 2400 },
+ { -587, -3602, 3408, 2067 },
+ { -885, -4951, 3228, 1174 },
+ { -728, -2711, 2807, 3552 },
+ { 1019, -3043, 3195, 2954 },
+ { 1888, -4615, 1140, 2454 },
+ { 660, -5616, 754, 800 },
+ { -1975, -5371, 1649, 1585 },
+ { -1544, -5436, 2422, 1081 },
+ { -422, -5882, 2390, 750 },
+ { 1336, -5557, 2441, 1230 },
+ { 136, -4001, 267, 2854 },
+ { -522, -3289, 2226, 2728 },
+ { -971, -4580, 2471, 708 },
+ { 704, -5306, 3300, 1001 },
+ { 325, -3464, 3555, 2398 },
+ { 794, -3686, 848, 3169 },
+ { 660, -3017, 4584, 3242 },
+ { -1486, -3978, 2170, 1644 },
+ { -1615, -4650, 2688, 1844 },
+ { 750, -4578, 538, 2239 },
+ { 1668, -5849, 1455, 1031 },
+ { 3486, -4681, 2030, 2183 },
+ { 2642, -5429, 1696, 1761 },
+ { 4491, -4502, 3538, 2767 },
+ { 3545, -4528, 3514, 2982 },
+ { 3269, -3676, 2758, 3966 },
+ { 5572, 1146, 209, -3379 },
+ { 7459, 1053, 593, -1896 },
+ { 4480, 200, -310, -4259 },
+ { 5577, -939, 242, -3992 },
+ { 8142, 442, 1257, -3083 },
+ { 5442, 1261, 1424, -3236 },
+ { 6260, -183, 3125, -2532 },
+ { 7179, 889, 1618, -2548 },
+ { 6416, 932, 2379, -2487 },
+ { 7094, 2560, 961, -3392 },
+ { 7322, 463, 2732, -3735 },
+ { 6632, 1577, 1912, -3272 },
+ { 6312, 1349, 3028, -3460 },
+ { 6105, 386, 1213, -977 },
+ { 5478, 1158, 1114, -486 },
+ { 6493, 410, 1686, -2180 },
+ { 6378, 1881, 1333, -2240 },
+ { 5711, 812, 1958, -1300 },
+ { 6844, 877, 730, -1189 },
+ { 6824, -245, 2249, -2000 },
+ { 7515, 1521, 1251, -3058 },
+ { 6697, 1051, 1300, -1749 },
+ { 6476, 1425, 811, -2773 },
+ { 7350, 465, -76, -2849 },
+ { 6975, 2095, 567, -2492 },
+ { 4691, 1736, 2660, -2289 },
+ { 7837, 1456, 340, -2767 },
+ { 7930, 507, 838, -2074 },
+ { 6106, 1502, 766, -1110 },
+ { 4891, -659, 835, -3954 },
+ { 7250, 141, 1369, -1523 },
+ { 7651, 67, 1651, -2298 },
+ { 7364, -305, 601, -3132 },
+ { 7179, 193, 2491, -2871 },
+ { 6504, -272, 2167, -1322 },
+ { 4456, 983, 2300, -421 },
+ { 4817, 457, 1695, 371 },
+ { 6914, 555, 850, -3159 },
+ { 5904, 1030, 202, -1959 },
+ { 6258, 880, 2233, -4503 },
+ { 6029, 10, 2130, -3600 },
+ { 6449, 985, 1129, -3963 },
+ { 6616, -18, -111, -3285 },
+ { 4496, 775, 817, -4276 },
+ { 6134, 2338, 1470, -2973 },
+ { 6911, 152, 430, -1946 },
+ { 4053, 991, 3218, -1193 },
+ { 5435, 1285, 3124, -2412 },
+ { 5507, 1836, 1935, -1988 },
+ { 5240, 689, 2189, -2670 },
+ { 6638, 1719, 606, -1799 },
+ { 5556, -180, 129, -2595 },
+ { 5644, 1918, 1281, -4316 },
+ { 6410, 1088, -282, -3117 },
+ { 6503, 1841, 312, -3514 },
+ { 6947, 20, 1358, -3886 },
+ { 5464, 2109, 2398, -3194 },
+ { 5616, -407, 2140, -498 },
+ { 6121, 2707, 2379, -4096 },
+ { 7303, 1846, 2266, -4095 },
+ { 5444, 470, 2718, -1553 },
+ { 5817, -645, 3285, -1349 },
+ { 5625, 1427, 1103, -1991 },
+ { 6041, -806, 1196, -2943 },
+ { 3050, -5722, 4070, -5460 },
+ { 3420, -4386, 4078, -5155 },
+ { 6020, -3982, 7268, -2689 },
+ { 7502, -4317, 7894, -3973 },
+ { 4156, -3558, 5247, -4316 },
+ { 4725, -4401, 7290, -1540 },
+ { 6688, -5122, 8216, -3210 },
+ { 9176, -6576, 9276, -4963 },
+ { 8706, -5708, 7987, -4621 },
+ { 7060, -3535, 6532, -3308 },
+ { 5600, -2719, 5363, -1568 },
+ { 4661, -2803, 6263, -4716 },
+ { 3673, -3636, 6147, -3433 },
+ { 5305, -2585, 6073, -2638 },
+ { 7614, -1962, 6079, -5266 },
+ { 6760, -3366, 7382, -4322 },
+ { 6385, -3883, 4797, -1353 },
+ { 8182, -5120, 4298, -4641 },
+ { 9130, -6198, 4975, -3063 },
+ { 7421, -5436, 5576, -3713 },
+ { 3483, -4898, 5443, -2745 },
+ { 4907, -5643, 6390, -4105 },
+ { 8119, -7008, 7992, -6764 },
+ { 6528, -6122, 6967, -5590 },
+ { 5890, -4190, 6624, -5688 },
+ { 6815, -7934, 7275, -5456 },
+ { 5434, -4306, 5169, -5378 },
+ { 4364, -6436, 5376, -2604 },
+ { 8152, -3404, 5913, -5048 },
+ { 7983, -4863, 4262, -2461 },
+ { 8023, -6188, 6238, -5062 },
+ { 6753, -3692, 3935, -3723 },
+ { 6826, -4760, 3284, -4051 },
+ { 7224, -7423, 4492, -3875 },
+ { 6904, -2590, 6587, -6248 },
+ { 6106, -1944, 7345, -5506 },
+ { 4956, -2990, 7808, -3146 },
+ { 6908, -6885, 5949, -1288 },
+ { 7162, -6058, 3419, -3401 },
+ { 7015, -7080, 6907, -3018 },
+ { 6971, -6832, 5646, -3273 },
+ { 8014, -5546, 5471, -1544 },
+ { 6792, -2220, 5105, -2879 },
+ { 8494, -3974, 4408, -3999 },
+ { 9591, -4866, 6027, -4558 },
+ { 5264, -5161, 6101, -738 },
+ { 5803, -6141, 5197, -5231 },
+ { 4657, -6822, 3232, -5189 },
+ { 4791, -5135, 3809, -4665 },
+ { 6108, -5103, 2379, -3873 },
+ { 4680, -3909, 3234, -5093 },
+ { 5802, -3853, 3795, -4984 },
+ { 4360, -7483, 4802, -3877 },
+ { 5429, -7517, 5911, -3717 },
+ { 6866, -2280, 4880, -4634 },
+ { 10131, -4628, 4414, -4092 },
+ { 10811, -5189, 7746, -5337 },
+ { 5663, -8941, 5287, -5680 },
+ { 8023, -5991, 7403, -2796 },
+ { 9669, -6919, 6525, -4932 },
+ { 7275, -3796, 4962, -2547 },
+ { 8848, -4806, 5677, -3080 },
+ { 8128, -4308, 7749, -6569 },
+ { 4032, -5196, 2282, -6239 },
+ { 6593, 700, -229, 304 },
+ { 8260, 539, -66, -1259 },
+ { 6605, 176, -814, -109 },
+ { 8057, 0, -1, -136 },
+ { 7382, -38, -484, -1129 },
+ { 8373, -929, 682, -454 },
+ { 7674, 690, -1278, 546 },
+ { 7326, -517, 406, -1283 },
+ { 7612, -1715, -1167, 1175 },
+ { 8590, 441, -782, -710 },
+ { 8572, -1202, -291, 260 },
+ { 7308, -147, -1785, 414 },
+ { 6787, -353, -672, 934 },
+ { 5177, -133, 179, 82 },
+ { 4161, -34, 447, 1497 },
+ { 5997, -902, 1533, -121 },
+ { 5727, -871, -1370, 945 },
+ { 8386, -252, 293, -823 },
+ { 6573, -1354, 682, 616 },
+ { 7650, -2096, 725, 457 },
+ { 8122, 78, 636, -1400 },
+ { 8421, 428, -1620, 131 },
+ { 7341, -1292, -717, 186 },
+ { 7998, -49, -720, 266 },
+ { 5987, -351, 669, 844 },
+ { 7314, -1620, 250, -603 },
+ { 7219, -1562, -572, 1994 },
+ { 8682, -358, -290, -388 },
+ { 5810, 155, -178, 1199 },
+ { 7246, -12, 1042, -786 },
+ { 7357, -923, 1468, -475 },
+ { 7801, 621, -212, -724 },
+ { 5346, -514, 1210, 1356 },
+ { 8459, 36, -127, -779 },
+ { 6878, -2429, 854, 1750 },
+ { 7280, -1401, -1353, 2845 },
+ { 7579, -2148, -1463, 2087 },
+ { 6637, 946, -872, 750 },
+ { 4807, -1100, 1289, 2602 },
+ { 4495, 219, 1551, 1128 },
+ { 7639, 506, 446, -1107 },
+ { 6359, 188, 1009, -115 },
+ { 6641, -1820, 1655, 723 },
+ { 5394, -2382, 1604, 2542 },
+ { 6021, -2644, 2396, 1407 },
+ { 4698, 882, 245, 1525 },
+ { 8103, 573, -798, -349 },
+ { 8045, -519, 997, -1092 },
+ { 7571, -122, 227, -338 },
+ { 5347, -1200, 630, 1718 },
+ { 7070, 790, 218, -544 },
+ { 7440, 728, -527, -20 },
+ { 6402, -355, 197, -736 },
+ { 4031, 771, 866, 1895 },
+ { 6009, 896, 445, -31 },
+ { 5160, 1098, -856, 1784 },
+ { 7980, -886, -1293, 1396 },
+ { 6318, -1361, 2423, 252 },
+ { 7547, -699, 133, 506 },
+ { 8562, -2344, 940, 264 },
+ { 5890, 1187, -1425, 2194 },
+ { 6558, -645, -1311, 2621 },
+ { 4634, -1671, 2075, 1623 },
+ { 5614, 105, -816, 2376 },
+ { 6646, 1558, -1365, 630 },
+ { 6998, 1150, -2117, -990 },
+ { 6555, 2311, -1093, -1783 },
+ { 6682, 1430, -2391, -1940 },
+ { 7861, 1555, -2977, -1188 },
+ { 6745, 1723, -459, -2085 },
+ { 7504, 1229, -1666, -2060 },
+ { 7937, 671, -2128, -1529 },
+ { 7139, 991, -735, -2632 },
+ { 6867, 1592, -1303, -2324 },
+ { 6401, 2230, -1732, -2508 },
+ { 7201, 2184, -2169, -1988 },
+ { 6636, 2190, -995, -2840 },
+ { 7620, 2306, -2089, -651 },
+ { 7584, 1875, -1438, -631 },
+ { 9214, 1561, -2464, -1139 },
+ { 6154, 1318, -1237, -2917 },
+ { 7917, 2847, -1797, -1599 },
+ { 8309, 2029, -2555, -465 },
+ { 8204, 1282, -584, -2405 },
+ { 8440, 1035, -1147, -1137 },
+ { 7107, 1858, -60, -1568 },
+ { 6781, 2912, -873, -1463 },
+ { 7603, 1316, -319, -1249 },
+ { 7833, 1335, -78, -1849 },
+ { 7930, 1141, -1016, -695 },
+ { 7883, 1610, -1017, -1314 },
+ { 8069, 1409, -1811, -196 },
+ { 8319, 1031, -582, -1590 },
+ { 5948, 1537, -2153, -2373 },
+ { 8684, 1171, -1871, -850 },
+ { 8357, 2484, -2411, -1292 },
+ { 6516, 2092, -193, -1167 },
+ { 6112, 1697, 22, -525 },
+ { 7161, 703, -602, -1879 },
+ { 6047, 2351, -807, -219 },
+ { 8072, 1854, -1817, -1553 },
+ { 6956, 1304, 76, -1011 },
+ { 6607, 1481, -544, -162 },
+ { 6958, 2541, -265, -1938 },
+ { 6416, 2514, -777, -850 },
+ { 7272, 2110, -899, -1171 },
+ { 7741, 2153, -283, -2614 },
+ { 6482, 2041, -1758, -1221 },
+ { 6762, 940, -1862, -2281 },
+ { 5610, 1194, -1691, -1561 },
+ { 7833, 2164, -823, -1952 },
+ { 5460, 1438, -848, 1189 },
+ { 6011, 1377, -771, -1557 },
+ { 7679, 544, -1134, -2214 },
+ { 7209, 1292, -2714, -1564 },
+ { 5567, 1200, -404, -169 },
+ { 5853, 1461, -1465, -518 },
+ { 6782, 689, -844, -860 },
+ { 7330, 1337, -1152, -71 },
+ { 7189, 1506, -653, -685 },
+ { 6860, 2116, -1403, -240 },
+ { 8804, 1516, -1391, -1760 },
+ { 7210, 2689, -1498, -989 },
+ { 7030, 3022, -1441, -2083 },
+ { 5649, 1836, -407, 525 },
+ { 7451, 3099, -717, -2464 },
+ { 7384, 1656, -2007, 398 },
+ { 6504, 707, -1919, -134 },
+ { -1851, 3639, -2279, -695 },
+ { -4037, 1644, -77, 1329 },
+ { -4025, 1960, -1565, -567 },
+ { -3430, 2495, -795, 368 },
+ { -4771, 2480, 993, 756 },
+ { -3431, 2058, -2539, -971 },
+ { -3802, 3418, 380, 217 },
+ { -3074, 3350, -1652, -1056 },
+ { -3705, 326, -1650, 1535 },
+ { -3122, 1281, -1192, 1607 },
+ { -4601, 1367, -968, 53 },
+ { -3808, 958, 44, 2560 },
+ { -2079, 2530, -1485, 1166 },
+ { -3707, 343, -2889, 180 },
+ { -5249, 1431, -31, 688 },
+ { -4990, 125, -704, 1270 },
+ { -2771, 1334, -2446, 746 },
+ { -2292, 994, -1527, 2630 },
+ { -1261, 3070, -2519, 268 },
+ { -2544, 3890, -1057, -552 },
+ { -4421, 255, -1980, 530 },
+ { -2951, 454, -13, 3643 },
+ { -2262, 1815, -370, 2880 },
+ { -2383, 3657, -649, 576 },
+ { -3541, -161, -1389, 2550 },
+ { -4241, 1575, 1325, 2561 },
+ { -2767, 4037, 1221, 1578 },
+ { -3748, 2697, 1148, 1801 },
+ { -4686, 2385, -220, 0 },
+ { -1531, 1645, -2751, 1327 },
+ { -45, 4032, -799, 2298 },
+ { -2915, 2280, 709, 2495 },
+ { -1199, 3278, -406, 2346 },
+ { -2471, 116, -2706, 2060 },
+ { -2440, 2173, -2894, -344 },
+ { -3375, 2287, 1781, 3226 },
+ { -2153, 3568, 1827, 2918 },
+ { -862, 2267, -1626, 2527 },
+ { -2698, 1135, 301, 4239 },
+ { -2364, 2123, 1010, 3710 },
+ { -2447, 3281, -81, 1408 },
+ { -2660, 4735, 472, 258 },
+ { -1053, 3097, 2682, 2398 },
+ { -3366, -1037, -1152, -868 },
+ { -643, 4242, 2212, 1259 },
+ { 971, 3991, 934, 643 },
+ { -1617, 2002, 2139, 2195 },
+ { -4897, 972, 784, 1719 },
+ { -1275, 2992, 1039, 3821 },
+ { -392, 4973, -209, 1821 },
+ { -1028, 4718, -1479, -137 },
+ { 50, 3914, 553, 2210 },
+ { 678, 4364, 359, 1303 },
+ { -582, 4911, 514, 1671 },
+ { 1276, 3914, -1252, 2934 },
+ { -1496, 3984, 857, 2330 },
+ { 772, 4744, -655, 2332 },
+ { -799, 5283, -439, 624 },
+ { 1341, 2937, 650, 2027 },
+ { -1739, 4892, 1275, 1702 },
+ { -892, 2596, -151, 3951 },
+ { -3532, 1090, 1292, 32 },
+ { 321, 3146, 2647, 1475 },
+ { 264, 4199, -1591, 1317 },
+ { -452, -2357, 2266, 4192 },
+ { 3022, -1033, -2389, 5678 },
+ { -1162, -1342, 3543, 4990 },
+ { -474, -1477, -1223, 5016 },
+ { -699, -2857, 900, 3835 },
+ { -461, -2255, -117, 4626 },
+ { 1204, -2062, -1211, 4403 },
+ { 2192, -3035, -337, 3966 },
+ { 108, -831, 279, 5643 },
+ { 1457, -620, -2908, 5276 },
+ { -2527, -78, 1085, 5460 },
+ { -1978, -1918, -949, 4733 },
+ { 32, 367, -1904, 5166 },
+ { 1890, -1665, 440, 4752 },
+ { -518, -348, 2816, 4891 },
+ { 3695, -2490, -1374, 4603 },
+ { 246, -1965, 3549, 3969 },
+ { 1100, -3111, 656, 3737 },
+ { -1379, 870, -414, 4575 },
+ { 628, -357, -1227, 6179 },
+ { -1129, -1318, -2457, 4576 },
+ { -425, -98, -73, 6336 },
+ { 367, -887, 2990, 4207 },
+ { 2091, -1251, 2444, 3557 },
+ { -1759, -1610, 2046, 5273 },
+ { 3210, 1414, -20, 2616 },
+ { 3303, -2636, 1005, 4237 },
+ { -327, -3107, -640, 3687 },
+ { -197, 764, 572, 5486 },
+ { 646, -767, 1388, 5464 },
+ { 104, 2742, -228, 3907 },
+ { -236, 1829, -579, 4585 },
+ { -2150, -474, -1525, 4006 },
+ { -23, -2632, -2400, 3892 },
+ { -12, -1739, -2910, 4867 },
+ { -2310, -368, -102, 4583 },
+ { -1991, -2061, 533, 4531 },
+ { 3884, -1446, -153, 4393 },
+ { 1568, 14, -289, 5268 },
+ { -1376, -253, -2797, 3417 },
+ { 3193, -2577, 2475, 3566 },
+ { 3418, 617, 1350, 1857 },
+ { 3792, -24, -272, 3370 },
+ { 153, 1159, 2906, 2877 },
+ { 511, 2162, 1548, 2741 },
+ { 262, 819, -2791, 3734 },
+ { 4232, -2015, 1486, 3477 },
+ { 2943, -1110, -1014, 5480 },
+ { 2842, 369, 703, 3476 },
+ { 3011, 1634, -933, 3553 },
+ { 4412, -1548, -942, 5021 },
+ { -1405, 593, 2372, 5267 },
+ { 2093, 2129, 896, 2365 },
+ { 4845, -1980, 0, 3823 },
+ { -2140, 81, 3278, 5637 },
+ { 1484, 2665, -324, 3653 },
+ { 10, 192, 1620, 5291 },
+ { 2152, 738, -2269, 5000 },
+ { 2102, 2748, -1652, 4707 },
+ { 2855, -2131, -387, 5188 },
+ { 1173, 676, 1338, 3277 },
+ { 2340, -2329, -2064, 4095 },
+ { 861, -2024, 1296, 5055 },
+ { 2189, 3225, -695, 2626 },
+ { 6196, -7079, 1943, -822 },
+ { 4547, -4813, 3261, 1856 },
+ { 4243, -6904, 3443, 448 },
+ { 4581, -7503, 946, 506 },
+ { 6626, -7754, 3427, 470 },
+ { 3407, -9088, 3269, -1496 },
+ { 4079, -6464, 2304, 777 },
+ { 5621, -9336, 2684, -768 },
+ { 5351, -6464, 5238, -214 },
+ { 5961, -8007, 1724, -3091 },
+ { 4213, -8067, 603, -246 },
+ { 7208, -7403, 3168, -1738 },
+ { 6098, -7700, 329, -1379 },
+ { 6525, -6735, 4248, -1072 },
+ { 6073, -6241, 2167, -2378 },
+ { 4609, -9218, 3051, -1033 },
+ { 6813, -7283, 1581, -1897 },
+ { 6126, -6275, 2789, 681 },
+ { 4423, -6538, 1621, -1692 },
+ { 6272, -8298, 3167, -1855 },
+ { 6172, -8558, 4498, -1169 },
+ { 4844, -8588, 1647, -366 },
+ { 6209, -8807, 1581, -369 },
+ { 5389, -8059, 550, -192 },
+ { 6654, -9775, 2504, -1063 },
+ { 7103, -7998, 806, 530 },
+ { 5662, -6736, 1565, -3620 },
+ { 4165, -9564, 4191, -2131 },
+ { 4526, -7181, 576, -2875 },
+ { 4633, -8623, 2807, -4742 },
+ { 3709, -7794, 1815, 34 },
+ { 3634, -8622, 2313, -826 },
+ { 6991, -8447, 2063, -3198 },
+ { 7757, -9486, 2255, -558 },
+ { 4149, -7778, 4728, -1696 },
+ { 5767, -7427, 1113, 707 },
+ { 4592, -6261, 2329, 1864 },
+ { 3159, -10498, 1677, -4273 },
+ { 3534, -9010, 2437, -3565 },
+ { 4479, -10821, 2715, -4942 },
+ { 3207, -9805, 3054, -3886 },
+ { 4627, -8189, 3018, -2354 },
+ { 5527, -10566, 3244, -2749 },
+ { 4346, -10127, 3335, -3084 },
+ { 6132, -10085, 3316, -1308 },
+ { 5629, -9704, 2178, -3058 },
+ { 3603, -8538, 1246, -624 },
+ { 3737, -8488, 395, -3167 },
+ { 5465, -11414, 2810, -4640 },
+ { 5306, -7745, 2721, -3988 },
+ { 7000, -9111, 1695, -1409 },
+ { 6663, -7741, 2466, -4079 },
+ { 4083, -7175, 1836, -4831 },
+ { 3613, -9926, 1342, -3455 },
+ { 6588, -8033, 457, -258 },
+ { 4720, -8102, 17, -1209 },
+ { 7414, -8709, 1294, -344 },
+ { 5437, -10030, 4043, -1704 },
+ { 4862, -9281, 1558, -1431 },
+ { 6800, -6403, 5113, 862 },
+ { 4623, -8242, 2667, -228 },
+ { 5919, -5083, 3348, 2135 },
+ { 5985, -8889, 2733, -5105 },
+ { 5029, -5767, 4407, 719 },
+ { 354, -6158, -838, -3001 },
+ { 351, -5943, -2104, -1534 },
+ { -633, -7190, -25, -4798 },
+ { -1595, -7235, -3812, -1400 },
+ { 103, -6197, -2933, -78 },
+ { -1722, -5020, -3441, -4333 },
+ { -1963, -5644, -4365, -270 },
+ { -846, -5743, -3477, 196 },
+ { -191, -5348, -4054, -469 },
+ { -2515, -7754, -3495, -818 },
+ { -2090, -6710, -2701, 117 },
+ { -546, -7036, -1398, 163 },
+ { -278, -7091, -2662, -536 },
+ { -622, -7962, -2731, -1464 },
+ { -1555, -8118, -3612, -2057 },
+ { -1094, -6280, -2314, 505 },
+ { -2556, -8538, -4024, -2247 },
+ { 109, -7134, -3107, -1823 },
+ { -900, -6954, -3340, -717 },
+ { -605, -7113, -3656, -2154 },
+ { 837, -6263, -3211, -2177 },
+ { -417, -5810, -3871, -1469 },
+ { -1318, -5649, -4207, -3198 },
+ { 413, -6765, -2082, -33 },
+ { -3101, -6450, -4362, -766 },
+ { 755, -6489, -2967, -846 },
+ { 1117, -7106, -2452, -1352 },
+ { -1202, -8387, -3072, -2897 },
+ { -365, -4894, -3561, -2937 },
+ { -2372, -8776, -265, -4441 },
+ { -1224, -8678, -896, -5074 },
+ { -755, -10096, -600, -6623 },
+ { 300, -8206, -225, -4568 },
+ { -1176, -6824, -2633, -3527 },
+ { -2006, -5443, -1526, -5849 },
+ { -1115, -5540, -2363, -4785 },
+ { 1059, -6812, -2543, -2654 },
+ { -1976, -6861, -3062, -5508 },
+ { -379, -5328, -2321, -3624 },
+ { -2108, -5860, -4518, -1915 },
+ { -379, -7885, -1329, -594 },
+ { 774, -5389, -581, -5213 },
+ { -2601, -5083, -1849, -4921 },
+ { -176, -5580, 74, -5075 },
+ { -204, -6780, -190, -6232 },
+ { 418, -7594, -1987, -820 },
+ { -1873, -8529, -2926, -1609 },
+ { 1340, -6362, -919, -4975 },
+ { 577, -7990, -2044, -1873 },
+ { -2572, -7413, -1745, -2224 },
+ { -2037, -7030, -1461, -7138 },
+ { -2559, -8756, -2039, -5836 },
+ { -2079, -6764, -1209, -5669 },
+ { -1613, -7801, -2006, -685 },
+ { -1865, -6583, -722, -3529 },
+ { -589, -6358, -1377, -1003 },
+ { -540, -7514, -1331, -3542 },
+ { 419, -6192, -1677, -4927 },
+ { -2786, -8763, -2966, -5065 },
+ { -2172, -8411, -1726, -4675 },
+ { -3382, -9833, -3497, -5722 },
+ { -2433, -10169, -2077, -5775 },
+ { -424, -9451, -1096, -3658 },
+ { -537, -8522, -910, -1897 },
+ { -5550, 2807, 1683, -693 },
+ { -6395, 635, 3573, -1246 },
+ { -7544, 2280, 2140, 44 },
+ { -8751, 1136, 2951, -794 },
+ { -5605, 2709, 2052, 916 },
+ { -7650, 654, 869, 135 },
+ { -6939, 967, 1409, 870 },
+ { -7834, 2123, 3310, 974 },
+ { -6935, 2818, 1274, -1678 },
+ { -5605, 2233, 1013, 471 },
+ { -7095, 1849, 1648, 198 },
+ { -6636, 1634, 712, -37 },
+ { -7279, 978, 296, -315 },
+ { -7664, 3504, 3292, -216 },
+ { -7836, 1209, 1221, -257 },
+ { -7913, 2201, 1765, -1529 },
+ { -7077, 3783, 2632, -1407 },
+ { -5565, 1645, 1410, -622 },
+ { -6494, 2879, 1181, -759 },
+ { -7073, 3137, 3010, 550 },
+ { -7249, 1839, 847, -805 },
+ { -6630, 2197, 282, -1096 },
+ { -8836, 1573, 1988, -1090 },
+ { -7809, 1274, 836, -1198 },
+ { -7895, 2970, 3511, -1097 },
+ { -6960, 1664, 1356, -2442 },
+ { -6582, 2866, 2273, 307 },
+ { -7221, 821, 2851, -1435 },
+ { -6015, 1703, 2001, -2367 },
+ { -8082, 1034, 2103, 239 },
+ { -5952, 1912, 301, -465 },
+ { -6099, 841, 379, 567 },
+ { -6343, 50, 494, 658 },
+ { -6586, 983, 591, -893 },
+ { -5500, 869, 2187, -2479 },
+ { -6482, 60, 1545, -979 },
+ { -6705, 515, 1974, -53 },
+ { -6460, 1755, 1325, -1275 },
+ { -6093, 2617, 2465, -623 },
+ { -7330, 2161, 594, -2115 },
+ { -7324, 762, 1593, -2004 },
+ { -6385, 679, 1510, -2514 },
+ { -6159, 241, 2976, -1631 },
+ { -8583, 3030, 4045, -162 },
+ { -6299, 66, 2209, -2103 },
+ { -5428, 1279, 3267, -1846 },
+ { -6438, 1335, 2728, -1631 },
+ { -8012, 1070, 2428, -1151 },
+ { -6201, 2781, 2349, -1918 },
+ { -5918, 1139, 3121, -148 },
+ { -6314, 2481, 3137, -1808 },
+ { -7180, 1722, 2435, -1602 },
+ { -6750, 1829, 3763, -1145 },
+ { -6713, 1777, 2221, 1212 },
+ { -7479, 1835, 3627, -479 },
+ { -7299, 10, 2406, -1593 },
+ { -8249, 3129, 996, -2870 },
+ { -8374, 1534, 1333, -1882 },
+ { -7507, 3353, 1598, -2299 },
+ { -7379, 2701, 2326, -1167 },
+ { -8440, 2276, 2796, -542 },
+ { -10348, 1527, 2649, -1165 },
+ { -8184, 3614, 2574, -1738 },
+ { -5539, 1574, 1733, 1138 },
+ { 9404, -7652, 67, 79 },
+ { 8654, -3972, 1358, -60 },
+ { 8617, -4794, 117, 2318 },
+ { 7886, -4505, 1784, 1200 },
+ { 8636, -6125, 3879, -1003 },
+ { 9654, -6836, 1816, 205 },
+ { 9374, -6553, 913, 1875 },
+ { 8020, -6150, 1134, 2390 },
+ { 7786, -4970, 2078, -1857 },
+ { 8691, -6119, 711, 708 },
+ { 9039, -5568, 2944, -1902 },
+ { 9955, -5048, 1433, -601 },
+ { 8089, -6927, 3093, -2846 },
+ { 8487, -7024, 2415, 19 },
+ { 9388, -5287, 3577, -2655 },
+ { 8591, -7371, 2300, -996 },
+ { 9104, -4763, 1453, -2558 },
+ { 7615, -5457, 596, 164 },
+ { 9860, -7047, 3433, -614 },
+ { 8756, -4404, 2235, -964 },
+ { 9462, -4660, 299, -1822 },
+ { 10119, -5550, 2689, -1273 },
+ { 10915, -7471, 2705, -1007 },
+ { 11433, -7090, 1410, -1198 },
+ { 9882, -7431, 2965, -1895 },
+ { 7628, -5219, 769, -2661 },
+ { 8169, -5318, 2262, 70 },
+ { 8846, -6320, 1939, -754 },
+ { 7147, -5593, 1248, -971 },
+ { 10652, -5485, 935, 137 },
+ { 7778, -6533, 2564, -1932 },
+ { 8878, -5173, 1214, -361 },
+ { 9828, -4943, 282, 510 },
+ { 10042, -6134, 3895, -1914 },
+ { 7965, -6630, 3566, -433 },
+ { 8573, -4502, 3574, -1209 },
+ { 8398, -4801, 1031, -1347 },
+ { 10136, -7772, 2612, 1547 },
+ { 9890, -7280, 1768, -1083 },
+ { 8407, -6585, -706, -58 },
+ { 7976, -7582, 229, -131 },
+ { 10481, -8866, 1166, -147 },
+ { 10914, -4342, 3189, -2412 },
+ { 10440, -5198, -104, -1109 },
+ { 11227, -6530, 2381, -2449 },
+ { 8487, -8064, 1086, 230 },
+ { 9975, -6123, -857, -134 },
+ { 8339, -6498, 1232, -2337 },
+ { 11042, -4506, 1119, -2098 },
+ { 12563, -5592, 1837, -2062 },
+ { 11801, -5590, 632, -1296 },
+ { 10152, -5617, 1511, -1917 },
+ { 7800, -6473, 51, -1337 },
+ { 7941, -5560, 2438, -3270 },
+ { 6554, -3834, 2100, 1476 },
+ { 9065, -5520, -226, -1120 },
+ { 10794, -7120, -243, 122 },
+ { 10429, -6968, 272, -806 },
+ { 8942, -8914, 1442, -392 },
+ { 9969, -5051, 2033, -2953 },
+ { 7275, -4152, 3058, -64 },
+ { 11127, -5488, 4589, -3227 },
+ { 9626, -6666, 2739, -2958 },
+ { 6943, -5362, 4470, 1008 },
+ { -7456, -967, 2936, -1002 },
+ { -8622, -333, 6962, 2606 },
+ { -7486, -3392, 3668, 1287 },
+ { -8053, -827, 5148, 1097 },
+ { -6610, 454, 4952, 96 },
+ { -7701, -1982, 3161, -468 },
+ { -7307, -1132, 4071, -36 },
+ { -8125, -271, 5199, 3862 },
+ { -9182, -1950, 2813, 1878 },
+ { -9855, -952, 4794, 3010 },
+ { -7241, 1431, 4202, 2468 },
+ { -9646, 157, 4766, 1046 },
+ { -9371, 1230, 6009, 2958 },
+ { -11514, -64, 8630, 5248 },
+ { -6766, 565, 2766, 2140 },
+ { -8426, -9, 2852, 1271 },
+ { -11291, -1113, 5087, 2937 },
+ { -8297, 2092, 4495, 1264 },
+ { -9983, 735, 3809, -51 },
+ { -9048, -1000, 3191, -308 },
+ { -7331, -1987, 2655, 1391 },
+ { -7144, -21, 4333, 2161 },
+ { -6032, -1540, 3543, 896 },
+ { -7987, -1036, 1985, 1529 },
+ { -9264, 2004, 5194, 290 },
+ { -11308, -840, 5754, 1654 },
+ { -9130, -2398, 4292, 2973 },
+ { -6248, 838, 3563, 1223 },
+ { -6819, -2760, 3511, 119 },
+ { -7213, -2006, 4364, 762 },
+ { -5431, -1047, 4533, 166 },
+ { -7098, -641, 2021, 639 },
+ { -8628, -2249, 3588, 399 },
+ { -6352, -1498, 3560, -648 },
+ { -7033, -2190, 4870, 2562 },
+ { -7405, -46, 3772, -581 },
+ { -6104, 796, 5143, 1965 },
+ { -5787, 943, 5784, 3030 },
+ { -8367, 1465, 7192, 4097 },
+ { -8259, 789, 5694, 1963 },
+ { -10614, -1899, 5748, 2645 },
+ { -8258, -805, 3698, 2275 },
+ { -6877, -972, 6431, 3160 },
+ { -6483, 363, 7018, 3129 },
+ { -6283, -1358, 5191, 1524 },
+ { -8853, -3157, 4119, 1741 },
+ { -6086, -267, 3883, -835 },
+ { -7254, 1032, 6613, 4017 },
+ { -11470, -3350, 4649, 3426 },
+ { -6743, 481, 6148, 1239 },
+ { -5394, -166, 5309, 3165 },
+ { -7958, 1068, 4268, -240 },
+ { -10520, 2256, 7916, 2828 },
+ { -5132, -4, 5739, 1176 },
+ { -8643, 120, 3255, -629 },
+ { -9631, 1974, 8870, 4362 },
+ { -10663, -1221, 3733, 589 },
+ { -8224, -1843, 5806, 2655 },
+ { -8282, 1255, 8647, 3478 },
+ { -12311, -1505, 9043, 6256 },
+ { -11312, -856, 7136, 4681 },
+ { -11944, -722, 7941, 3309 },
+ { -7868, -463, 6846, 4196 },
+ { -8679, -241, 7410, 5347 },
+ { 6759, -4680, -508, 1220 },
+ { 5176, -6111, 944, 121 },
+ { 6843, -5667, -1368, -533 },
+ { 5616, -5884, -1471, -695 },
+ { 6030, -5089, -1808, -940 },
+ { 7444, -5463, -52, 1881 },
+ { 4207, -6079, -506, 1571 },
+ { 6785, -4410, -649, 3084 },
+ { 4838, -5214, 2026, 2998 },
+ { 4201, -5790, 645, 1811 },
+ { 6930, -5129, -1940, 1698 },
+ { 6332, -4627, 692, 3027 },
+ { 6285, -4314, -106, 3644 },
+ { 6255, -5450, -1975, 742 },
+ { 4199, -4676, -459, 1796 },
+ { 5592, -5500, 1345, 1300 },
+ { 4358, -5556, -2236, 114 },
+ { 4620, -5875, -1563, 888 },
+ { 4892, -7550, -327, -419 },
+ { 4734, -7085, 7, 613 },
+ { 3883, -5562, -1969, 1080 },
+ { 5610, -4990, -204, 834 },
+ { 4117, -6482, -1271, 341 },
+ { 6585, -5107, 892, 1169 },
+ { 6632, -3683, 302, 3002 },
+ { 6326, -5351, -983, -1250 },
+ { 4382, -7192, -730, -158 },
+ { 5227, -6540, -451, 1123 },
+ { 5468, -6472, -870, -1471 },
+ { 5191, -6402, -1365, -127 },
+ { 7407, -6317, -973, -336 },
+ { 4611, -6530, -820, -1980 },
+ { 4963, -5159, -2050, -966 },
+ { 4414, -5691, -211, -998 },
+ { 5954, -5873, 750, -1749 },
+ { 4394, -4796, -1268, 254 },
+ { 7161, -6214, -1010, 689 },
+ { 4965, -3598, 2372, 1711 },
+ { 6248, -6180, 981, 864 },
+ { 6473, -5336, 525, -600 },
+ { 4591, -6864, -1131, -900 },
+ { 6314, -6440, -1021, -375 },
+ { 5838, -6209, -1199, 944 },
+ { 5308, -5283, -2100, 1267 },
+ { 4342, -5860, -1637, -1356 },
+ { 5680, -4388, -1227, -104 },
+ { 4900, -4098, 1449, 4046 },
+ { 4677, -4284, -106, 3190 },
+ { 7574, -6173, -848, 1859 },
+ { 6493, -7207, -131, 726 },
+ { 5513, -5261, -2117, 4 },
+ { 6191, -7352, -193, -505 },
+ { 5885, -4333, 324, -134 },
+ { 6162, -6081, -312, -2044 },
+ { 4216, -6200, -1810, -572 },
+ { 5652, -7035, -696, -197 },
+ { 7131, -7189, -366, -60 },
+ { 5032, -4803, -1514, 2832 },
+ { 7386, -4610, -606, 3489 },
+ { 4211, -5031, 1221, 3047 },
+ { 4050, -4653, 1584, 1469 },
+ { 6852, -5302, -1861, 206 },
+ { 7736, -4816, -1794, 3359 },
+ { 6290, -3439, 1522, 2454 },
+ { 1768, 5990, -5560, -2594 },
+ { 3903, 5326, -1530, -1501 },
+ { 2472, 3738, -2117, -4240 },
+ { 3260, 5448, -904, -4733 },
+ { 1435, 7297, -3676, -4102 },
+ { 4096, 5951, -656, -3312 },
+ { 2178, 6009, -3146, -3724 },
+ { 3787, 5493, -5473, -1633 },
+ { 2998, 7286, -3334, -3571 },
+ { 2894, 6576, -4708, -2804 },
+ { 830, 6163, -4286, -3348 },
+ { 4755, 5569, -1730, -2739 },
+ { 4604, 6065, -3562, -2605 },
+ { 2749, 5141, -3986, -2775 },
+ { 3942, 4875, -2143, -3340 },
+ { 2819, 8517, -2004, -2724 },
+ { 2146, 6298, -689, -3093 },
+ { 5196, 6504, -3393, -1475 },
+ { 1851, 8386, -1748, -1420 },
+ { 3474, 8572, -3534, -2688 },
+ { 4503, 7560, -3561, -2245 },
+ { 4433, 6219, -2393, -1575 },
+ { 3506, 7248, -2275, -1977 },
+ { 3490, 7409, -3147, -604 },
+ { 4214, 6447, -3520, 516 },
+ { 619, 7034, -829, -1705 },
+ { 1732, 7395, -356, -2208 },
+ { 1226, 5204, -3294, -3732 },
+ { 2027, 5619, -1813, -4146 },
+ { 3078, 5877, 47, -2651 },
+ { 1654, 5458, 424, -682 },
+ { 3163, 5464, -2026, -270 },
+ { 2884, 5375, -685, -530 },
+ { 2950, 7286, -35, -2967 },
+ { 1986, 5066, -597, 482 },
+ { 3459, 4308, -3845, -2333 },
+ { 3155, 7037, -1346, -4345 },
+ { 2193, 6696, -717, -1319 },
+ { 3677, 5089, -3892, -487 },
+ { 2186, 5136, -4186, -1492 },
+ { 773, 5796, -917, 817 },
+ { 2489, 6546, -3570, -2117 },
+ { 1223, 6469, -1362, -33 },
+ { 271, 6061, -1466, -1725 },
+ { 2540, 5171, -1847, 1032 },
+ { 2548, 5251, -2697, 1677 },
+ { 771, 7600, -768, -632 },
+ { 4710, 6647, -4736, -1275 },
+ { 1369, 5917, -2971, -1056 },
+ { 163, 5239, -3499, -2275 },
+ { 2104, 4285, -3211, -3286 },
+ { 1107, 7411, -1972, -1671 },
+ { 2196, 7262, -2310, -1926 },
+ { -244, 6439, -1745, -839 },
+ { 3293, 3832, -2890, -3000 },
+ { 419, 6443, -379, -407 },
+ { 3077, 4930, -1156, -2869 },
+ { 2131, 5874, -2330, 224 },
+ { 690, 6538, -2212, -2841 },
+ { 1602, 4421, -2515, 1542 },
+ { 3318, 9373, -3032, -3477 },
+ { 5646, 7462, -5153, -1463 },
+ { 4139, 7137, -1539, -3321 },
+ { 3481, 9077, -1645, -3653 },
+ { -7747, 375, -106, -543 },
+ { -8587, -1379, -586, -461 },
+ { -10146, -892, 2094, 694 },
+ { -8103, 382, 504, -325 },
+ { -8548, -92, 94, -656 },
+ { -7460, 38, 152, 388 },
+ { -8266, -271, -459, -883 },
+ { -7935, -664, -1026, -802 },
+ { -8341, -109, 853, 161 },
+ { -8802, -1355, 1099, 630 },
+ { -8957, -6, 1108, -669 },
+ { -7260, -1520, -43, -407 },
+ { -7555, -174, 668, -2562 },
+ { -9014, -126, 227, -1191 },
+ { -8184, 769, 290, -1375 },
+ { -9476, 55, 962, -1528 },
+ { -8679, 541, 755, -1030 },
+ { -9842, -1626, 838, -1588 },
+ { -8513, -702, 788, -1998 },
+ { -10101, -1558, -366, -1841 },
+ { -8135, 78, 1479, -1813 },
+ { -9128, -454, 313, -1786 },
+ { -7554, -1084, 831, -2442 },
+ { -7576, -701, 2068, -1665 },
+ { -7791, -1481, 1587, -1808 },
+ { -6701, -596, -97, 802 },
+ { -7418, -15, 684, -963 },
+ { -7127, -477, -139, -426 },
+ { -8097, -110, -36, -264 },
+ { -7620, -1922, -590, -101 },
+ { -7647, -1201, 279, 660 },
+ { -7856, -1974, 758, -2271 },
+ { -8496, -167, 2232, -1143 },
+ { -8506, -1359, 624, -740 },
+ { -7274, -1052, 1062, -139 },
+ { -7800, -217, 91, -1794 },
+ { -7030, -1694, -955, 615 },
+ { -9020, -1864, 101, -2182 },
+ { -9400, -740, 598, -667 },
+ { -8448, -1184, 2024, -1272 },
+ { -8812, -570, -897, -2384 },
+ { -10559, -1286, 538, -1536 },
+ { -8728, -888, -1089, -1397 },
+ { -7080, -1185, 636, -1252 },
+ { -9880, 233, 2344, -782 },
+ { -7952, -1326, -378, -1947 },
+ { -7207, -378, 1408, -2237 },
+ { -8467, -1545, 902, -1987 },
+ { -9163, -1474, 924, -1739 },
+ { -8159, -992, -77, -2744 },
+ { -8343, 148, -423, -1573 },
+ { -9105, -649, -254, -1214 },
+ { -8939, 456, 281, -1905 },
+ { -8837, 179, -394, -2634 },
+ { -9145, 757, 1547, -1319 },
+ { -9775, -723, 441, -1680 },
+ { -8910, -686, 1529, -1525 },
+ { -9492, -1134, 2064, -938 },
+ { -6111, -943, 677, -31 },
+ { -7411, -613, -814, 46 },
+ { -9479, -922, -430, -2061 },
+ { -11298, -1268, 1318, -1117 },
+ { -8190, 832, 671, -2214 },
+ { -10453, -550, 1672, -886 },
+ { 1044, 9353, -1651, -5423 },
+ { 1034, 8149, -455, -6166 },
+ { 761, 8293, -3214, -4838 },
+ { 938, 8077, 164, -5130 },
+ { 1295, 8673, 2582, -5490 },
+ { -314, 7973, -2395, -5231 },
+ { -507, 9012, -2497, -5775 },
+ { 2396, 8314, -1022, -4673 },
+ { -1516, 8501, 1950, -4969 },
+ { -308, 7401, 1549, -4866 },
+ { -112, 8340, 3003, -4920 },
+ { -50, 9315, 1371, -5666 },
+ { -659, 9449, 2496, -5547 },
+ { 2573, 9148, -2270, -4783 },
+ { 830, 7104, -438, -3907 },
+ { 522, 10672, -677, -6483 },
+ { -1190, 10108, -510, -6518 },
+ { -427, 8271, -579, -6315 },
+ { 1602, 8113, -1927, -4418 },
+ { -2266, 8180, 448, -5190 },
+ { -1633, 8816, -226, -5771 },
+ { 759, 9481, -105, -5813 },
+ { 2254, 6679, -466, -5662 },
+ { -88, 6946, 895, -5958 },
+ { -1705, 10009, 1394, -5574 },
+ { 748, 7943, 540, -6692 },
+ { 1411, 7009, 232, -6145 },
+ { 697, 7290, -1221, -5342 },
+ { -1764, 10580, 1944, -3981 },
+ { -1334, 9124, 1195, -3903 },
+ { -905, 10067, 635, -5039 },
+ { 664, 10680, 49, -4625 },
+ { 1374, 9536, -777, -3591 },
+ { 252, 9698, -597, -2931 },
+ { 824, 9164, -1014, -2144 },
+ { 2438, 10569, -2289, -4424 },
+ { 2101, 7102, 507, -3614 },
+ { 294, 8051, -432, -1518 },
+ { -665, 10337, 547, -2852 },
+ { 1168, 11989, -492, -5427 },
+ { 1344, 6416, 302, -5061 },
+ { -1727, 12264, 1507, -4543 },
+ { 674, 10889, -902, -3605 },
+ { -582, 9504, 300, -3618 },
+ { 641, 7654, 689, -2109 },
+ { 2065, 9243, 508, -4367 },
+ { 1055, 8373, 688, -3144 },
+ { -641, 8185, 986, -3307 },
+ { 1120, 7426, 1785, -3757 },
+ { 1660, 8070, -593, -3104 },
+ { 2002, 9467, -1722, -3475 },
+ { 2361, 8368, 100, -3709 },
+ { -772, 7845, -613, -4988 },
+ { 1485, 7430, 1896, -6127 },
+ { -432, 7823, -947, -2882 },
+ { 313, 11122, -760, -4871 },
+ { 412, 8412, -283, -4231 },
+ { 1585, 10402, -1884, -3267 },
+ { 321, 6952, 773, -3016 },
+ { -105, 9014, 121, -2249 },
+ { 1585, 10313, -977, -4812 },
+ { 1619, 11869, 1306, -6876 },
+ { -1168, 8886, -81, -2500 },
+ { -395, 10886, 733, -6490 },
+ { -4949, 4274, 3992, -1054 },
+ { -4241, 5299, 4262, -1584 },
+ { -2710, 3862, 4552, -1673 },
+ { -4608, 2472, 3672, -1715 },
+ { -2843, 2816, 4003, -2326 },
+ { -5229, 2964, 5636, 90 },
+ { -4924, 3442, 5015, -1096 },
+ { -1281, 3313, 5537, -2066 },
+ { -3808, 1939, 4351, -919 },
+ { -1915, 2585, 4939, -1614 },
+ { -3470, 1843, 5562, -682 },
+ { -3800, 870, 5827, 144 },
+ { -4985, 1452, 4728, -709 },
+ { -3745, 2750, 7220, 259 },
+ { -1875, 1900, 6514, -826 },
+ { -4329, 1574, 7192, 1304 },
+ { -5408, 1444, 6208, 631 },
+ { -3327, 5312, 5707, -1541 },
+ { -6966, 3334, 4034, 1028 },
+ { -7484, 4245, 4218, -212 },
+ { -6567, 5839, 4539, -512 },
+ { -5715, 5935, 3747, -1186 },
+ { -6410, 4881, 3356, -1610 },
+ { -5146, 2590, 2850, 2172 },
+ { -5196, 4095, 2569, -373 },
+ { -5043, 6025, 4318, 692 },
+ { -5525, 4884, 3513, 370 },
+ { -6804, 7533, 5812, -488 },
+ { -5657, 2480, 4061, 1234 },
+ { -3155, 1472, 6071, 1188 },
+ { -3427, 5217, 3442, 858 },
+ { -4698, 3013, 5517, 2586 },
+ { -4449, 2226, 5418, 3580 },
+ { -6395, 3547, 5487, 2028 },
+ { -3500, 5019, 4787, 1 },
+ { -4038, 2578, 3073, 3151 },
+ { -2750, 1955, 4469, 3856 },
+ { -5696, 1659, 6118, 2469 },
+ { -4350, 1241, 6840, 3126 },
+ { -5565, 5058, 5196, 1314 },
+ { -1642, 4190, 3948, 607 },
+ { -1233, 4108, 4850, -640 },
+ { -997, 3428, 3239, 1378 },
+ { -6488, 2741, 6926, 2792 },
+ { -4188, 3763, 4235, 2018 },
+ { -3210, 3224, 5646, 1427 },
+ { -5526, 6909, 5070, -627 },
+ { -2815, 3994, 3425, 1903 },
+ { -2163, 2734, 5423, 145 },
+ { -4149, 4247, 2355, 734 },
+ { -410, 2521, 4138, -16 },
+ { -2411, 2385, 4927, 2105 },
+ { -6077, 3591, 3114, 594 },
+ { -4186, 4834, 5926, -1004 },
+ { -7315, 3369, 5966, 448 },
+ { -7042, 5721, 5771, 238 },
+ { -4466, 3907, 3535, -1751 },
+ { -2116, 3970, 6163, -1392 },
+ { -7239, 2143, 8407, 3630 },
+ { -5431, 4486, 6486, -42 },
+ { -1874, 1617, 6333, 519 },
+ { -6478, 2629, 4634, -505 },
+ { -7784, 2342, 7216, 1365 },
+ { -1154, 1432, 4831, 1544 },
+ { -4964, -5801, 1797, 506 },
+ { -4436, -6905, 1059, -1237 },
+ { -5400, -6886, 884, -290 },
+ { -6259, -7103, 523, -227 },
+ { -4819, -6450, 1412, -450 },
+ { -4056, -6213, 1725, -943 },
+ { -5642, -6091, 1357, 605 },
+ { -4196, -5678, 2187, -173 },
+ { -4726, -5126, 2470, 321 },
+ { -6642, -5091, 1507, -1005 },
+ { -5304, -5250, 1944, 1579 },
+ { -7179, -5520, 1468, -425 },
+ { -6033, -4895, 1876, -955 },
+ { -6595, -5143, 2207, 1291 },
+ { -4224, -4943, 1846, 1792 },
+ { -7128, -6950, 539, 724 },
+ { -4369, -4901, 2590, 1103 },
+ { -7413, -5696, 1712, 1440 },
+ { -5885, -6821, 418, 871 },
+ { -6828, -5599, 710, -1563 },
+ { -6123, -5817, 1358, 1631 },
+ { -5291, -5622, 578, 2138 },
+ { -7171, -6004, 347, 2208 },
+ { -6083, -5251, 2132, 425 },
+ { -4329, -5721, 407, -2993 },
+ { -5326, -5056, 1119, -1837 },
+ { -5485, -5856, 185, -2389 },
+ { -6529, -5178, 403, -697 },
+ { -6719, -4412, 2726, 871 },
+ { -5126, -5629, 1835, -771 },
+ { -5622, -4361, 2973, 858 },
+ { -5282, -5895, 45, -335 },
+ { -4357, -5656, 1696, -1558 },
+ { -7139, -6659, 627, -409 },
+ { -4415, -6328, 35, 1306 },
+ { -7639, -6110, 1134, 197 },
+ { -3626, -5592, 2019, 901 },
+ { -3547, -5064, 1176, 1738 },
+ { -5075, -3899, 2087, 266 },
+ { -4086, -6311, 1479, 360 },
+ { -6210, -5220, -199, -1477 },
+ { -3910, -5063, 1356, -15 },
+ { -7616, -4977, 461, 2401 },
+ { -6118, -6131, 1258, -563 },
+ { -6127, -4968, 1286, -27 },
+ { -4121, -5852, 1113, 1476 },
+ { -5157, -4881, 1162, -662 },
+ { -4637, -5031, 1179, 709 },
+ { -5509, -5452, -397, 1224 },
+ { -4597, -6861, 646, 467 },
+ { -6247, -4043, 468, 278 },
+ { -5336, -6465, 874, -1472 },
+ { -6998, -6346, 78, -1798 },
+ { -4915, -4530, 2756, -203 },
+ { -6048, -4373, 1468, 1052 },
+ { -4273, -7100, 942, -323 },
+ { -6552, -4287, 2351, 69 },
+ { -6954, -4613, 722, 1521 },
+ { -4201, -5361, 763, -1562 },
+ { -6881, -5596, -748, 669 },
+ { -6695, -3547, -34, 1299 },
+ { -3981, -5728, 84, 111 },
+ { -4663, -4809, 2173, -1031 },
+ { -6599, -6077, 1303, 256 },
+ { -7596, -4265, -5791, -4140 },
+ { -6610, -2758, -5288, -3936 },
+ { -5880, -3865, -6563, -3088 },
+ { -7228, -5510, -7677, -3912 },
+ { -8854, -6553, -8318, -5361 },
+ { -9362, -5249, -6413, -4319 },
+ { -4418, -3110, -6368, -4358 },
+ { -5544, -4203, -6863, -5013 },
+ { -3056, -4316, -5567, -3181 },
+ { -3078, -5999, -5051, -2657 },
+ { -5884, -6292, -5756, -4013 },
+ { -4825, -4549, -5535, -4053 },
+ { -4443, -6126, -5316, -1368 },
+ { -3972, -6341, -6098, -2686 },
+ { -5751, -2781, -5398, -6230 },
+ { -4466, -6135, -5570, -3679 },
+ { -4291, -5992, -3564, -5189 },
+ { -7189, -4429, -7279, -6082 },
+ { -5076, -4433, -2748, -5366 },
+ { -6225, -2825, -6833, -5663 },
+ { -2989, -4792, -3960, -4492 },
+ { -7836, -7773, -7722, -5741 },
+ { -6559, -5703, -5844, -5589 },
+ { -7612, -5438, -4136, -3774 },
+ { -4218, -4176, -6591, -2333 },
+ { -4837, -5063, -6581, 322 },
+ { -6590, -5990, -2980, -3847 },
+ { -5558, -2971, -5489, -1932 },
+ { -7001, -5323, -4975, -1697 },
+ { -4694, -2688, -6904, -3044 },
+ { -8511, -5379, -5767, -2549 },
+ { -7548, -5412, -6522, -2572 },
+ { -6597, -4973, -6423, -1274 },
+ { -6415, -4022, -5168, -1072 },
+ { -5528, -5530, -7218, -2345 },
+ { -4845, -4805, -5943, -1227 },
+ { -6049, -7150, -6744, -2161 },
+ { -9061, -7299, -8542, -4375 },
+ { -5010, -5546, -5416, -82 },
+ { -4135, -4205, -5109, -3373 },
+ { -3311, -5869, -4007, -5061 },
+ { -5993, -6472, -3962, -4718 },
+ { -2966, -5832, -2821, -6305 },
+ { -4851, -5152, -2067, -3930 },
+ { -3620, -4441, -3362, -5836 },
+ { -4469, -5221, -4534, -5592 },
+ { -4022, -6335, -4321, -6107 },
+ { -4899, -4503, -3084, -3725 },
+ { -4490, -8276, -4620, -6236 },
+ { -6591, -4342, -7365, -4063 },
+ { -6498, -5057, -5553, 485 },
+ { -6060, -2714, -7093, -4144 },
+ { -6199, -7774, -7094, -4057 },
+ { -7536, -6424, -6415, -4265 },
+ { -7439, -2454, -6348, -4827 },
+ { -5333, -7565, -4417, -4639 },
+ { -4353, -7103, -4197, -2689 },
+ { -5229, -6549, -5129, -6804 },
+ { -6129, -7701, -5236, -4836 },
+ { -6797, -3983, -3884, -4406 },
+ { -6624, -4467, -4745, -5052 },
+ { -3324, -7596, -2720, -6553 },
+ { -5473, -6284, -1704, -4511 },
+ { -4131, -7263, -3180, -5196 },
+ { -7116, -5565, -3469, 685 },
+ { -6002, -6021, -3858, 576 },
+ { -3144, -8203, -1291, -434 },
+ { -6096, -7027, -4004, 1353 },
+ { -3943, -7709, -2344, -36 },
+ { -4510, -6767, -2642, 631 },
+ { -3657, -11541, -2570, -3984 },
+ { -5959, -8854, -1333, -867 },
+ { -6699, -8866, -1606, -344 },
+ { -3836, -7961, -2334, -2028 },
+ { -3430, -8045, -3037, -672 },
+ { -3868, -9184, -3635, -1819 },
+ { -4258, -9060, -2621, -1008 },
+ { -3595, -8693, -2022, -752 },
+ { -4573, -8048, -3166, -2622 },
+ { -4852, -7903, -1405, 256 },
+ { -4591, -7057, -1560, 965 },
+ { -6963, -7655, -980, 808 },
+ { -5179, -6641, -3356, 1196 },
+ { -7102, -6941, -2798, 2123 },
+ { -6867, -5834, -3320, -770 },
+ { -5977, -7369, -2500, -778 },
+ { -6160, -6400, -934, -2543 },
+ { -6741, -7608, -355, -1289 },
+ { -6856, -6466, -1433, -1643 },
+ { -4786, -6292, -4970, 376 },
+ { -5407, -8866, -2255, -400 },
+ { -3814, -6506, -1387, -3620 },
+ { -4998, -6137, -1200, -4092 },
+ { -5123, -9557, -2849, -1306 },
+ { -4259, -6444, -4395, -338 },
+ { -5221, -6810, -883, 1225 },
+ { -6137, -6215, -2165, 554 },
+ { -3895, -6557, -3176, -1829 },
+ { -3886, -8188, -87, -954 },
+ { -7243, -6707, -2216, -316 },
+ { -5592, -7606, 85, -432 },
+ { -3957, -7945, -504, -144 },
+ { -4617, -7624, 218, -312 },
+ { -4797, -8737, -844, -1051 },
+ { -4478, -8516, -1401, -454 },
+ { -4557, -7058, -302, -2332 },
+ { -6623, -7736, -271, -50 },
+ { -3157, -7532, -1111, -2207 },
+ { -3590, -7300, -1271, 517 },
+ { -4442, -7306, -507, 590 },
+ { -6458, -7524, -2807, 666 },
+ { -4991, -8466, -3363, -785 },
+ { -7474, -7541, -1056, -1839 },
+ { -7501, -8316, -938, -180 },
+ { -5329, -7739, -579, -2341 },
+ { -4549, -7063, -176, -3539 },
+ { -5191, -8612, -1504, -4250 },
+ { -3083, -7058, -2251, 32 },
+ { -4003, -7043, -1093, -791 },
+ { -5523, -8093, -678, -114 },
+ { -3022, -10265, -2070, -3109 },
+ { -3905, -6274, -182, -3652 },
+ { -3269, -9217, -551, -2650 },
+ { -3138, -9314, -1726, -1704 },
+ { -4420, -10339, -1744, -3459 },
+ { -4163, -8609, -2298, -4113 },
+ { -5566, -6505, -1241, -463 },
+ { -3130, -9746, -2352, -4884 },
+ { -7825, -3439, 1451, -1468 },
+ { -8451, -3318, 2360, -435 },
+ { -8462, -4130, 1438, -1024 },
+ { -9425, -4564, 1328, -689 },
+ { -11014, -3202, 2278, 2080 },
+ { -8269, -2761, -146, -440 },
+ { -7497, -2618, -166, 413 },
+ { -8250, -3060, 522, -2133 },
+ { -8365, -5366, 1347, -451 },
+ { -8589, -3979, 2943, 714 },
+ { -8111, -2572, 1272, -1748 },
+ { -7830, -5193, 605, -1484 },
+ { -8119, -4736, 2141, 256 },
+ { -7724, -4769, 1463, -812 },
+ { -7363, -3911, 2540, 4 },
+ { -7974, -3397, 2363, 1366 },
+ { -7359, -4204, 1752, -958 },
+ { -7622, -3505, 660, 916 },
+ { -9934, -3665, 3165, 828 },
+ { -8721, -4162, 62, 1718 },
+ { -9433, -4768, 2722, 1234 },
+ { -7960, -4496, 138, 1528 },
+ { -8198, -3454, -443, 631 },
+ { -7756, -2246, 655, 1137 },
+ { -8841, -3145, 1113, 829 },
+ { -7817, -3298, 1251, 230 },
+ { -9413, -2733, 323, -1862 },
+ { -9408, -4168, 1270, 1549 },
+ { -9037, -3892, -942, 283 },
+ { -8255, -3849, 1301, 1762 },
+ { -9057, -3987, -41, -682 },
+ { -9441, -4187, 2019, -111 },
+ { -9740, -3178, 1602, -871 },
+ { -8344, -2474, 1461, 1506 },
+ { -9752, -2925, 1996, 1243 },
+ { -9199, -3796, 180, 537 },
+ { -9060, -2405, 1140, -1562 },
+ { -9348, -2376, 309, -162 },
+ { -10786, -3182, -5, -1500 },
+ { -8142, -4540, -434, -826 },
+ { -7528, -2341, 1104, -73 },
+ { -9360, -2658, 3062, 56 },
+ { -8267, -2335, 2000, -1193 },
+ { -12169, -3154, 1287, -640 },
+ { -11398, -2120, 946, -1163 },
+ { -8940, -4559, 328, -1696 },
+ { -11025, -4213, 2813, 840 },
+ { -9224, -3581, 2224, 2039 },
+ { -8943, -3337, 1248, -1298 },
+ { -7900, -4042, 485, -2080 },
+ { -9221, -1947, 2191, -880 },
+ { -10762, -1800, 2516, -324 },
+ { -10095, -2238, 981, -1335 },
+ { -11908, -2808, 3255, 645 },
+ { -10640, -4105, 1283, -595 },
+ { -7663, -2863, 2467, -797 },
+ { -10712, -3854, 3710, 1538 },
+ { -10823, -2893, 1408, -801 },
+ { -9874, -3832, 256, -1638 },
+ { -10394, -3391, 2315, -94 },
+ { -11525, -4079, 4153, 2122 },
+ { -9546, -2088, 1541, 481 },
+ { -8731, -2433, 1042, 2160 },
+ { -7852, -3977, -1370, 1677 },
+ { 7072, -3420, 1398, -1741 },
+ { 6180, -1976, 1280, -3557 },
+ { 7692, -1793, 2844, -1700 },
+ { 8363, -1773, 3104, -2679 },
+ { 9213, -3266, 3756, -3542 },
+ { 9650, -2644, 1426, -1318 },
+ { 7712, -2796, 3686, -1975 },
+ { 7316, -3517, 2821, -622 },
+ { 7434, -2594, 2305, -2264 },
+ { 7237, -1797, 255, -3114 },
+ { 8663, -1983, 1338, -3056 },
+ { 6616, -952, 4059, -2652 },
+ { 8823, -1327, 1362, -1356 },
+ { 9938, -1722, 1287, -2362 },
+ { 7207, -1057, 1913, -1315 },
+ { 7508, -1585, 870, -1982 },
+ { 8217, -3680, 1417, -3170 },
+ { 8329, -2541, 1684, -585 },
+ { 8062, -2335, 252, -2800 },
+ { 8204, -4108, 3097, -2569 },
+ { 7701, -3367, 576, -3008 },
+ { 7350, -786, 2414, -2129 },
+ { 6948, -2568, 1607, -225 },
+ { 7684, -2387, 1308, -3449 },
+ { 8306, -3458, 2394, -1454 },
+ { 8438, -2781, 1043, -1362 },
+ { 9175, -2076, 2144, -1987 },
+ { 8347, -2709, 3489, -4301 },
+ { 5696, -2377, 2870, 851 },
+ { 8825, -1243, 2219, -2603 },
+ { 8801, -1614, 584, -2513 },
+ { 8413, -384, 1421, -2244 },
+ { 9228, -3050, 3279, -2164 },
+ { 6342, -2698, 3547, -107 },
+ { 10053, -2476, 2837, -3168 },
+ { 7439, -604, 3177, -3991 },
+ { 7749, -1064, 4329, -4855 },
+ { 8655, -2177, 2252, -3519 },
+ { 8490, -228, 1958, -3233 },
+ { 10513, -2968, 1911, -2340 },
+ { 8146, -862, 1884, -1723 },
+ { 7788, -666, 3004, -2891 },
+ { 7785, -1620, 4133, -3417 },
+ { 10262, -3731, 3455, -2971 },
+ { 8570, -905, 4519, -4649 },
+ { 9129, -2562, 463, -2465 },
+ { 9451, -3587, 1904, -3056 },
+ { 6549, -2236, 3010, -4523 },
+ { 7175, -2684, 2967, -3458 },
+ { 9872, -3278, 1054, -2472 },
+ { 9153, -931, 1217, -2565 },
+ { 8789, -3469, 753, -2568 },
+ { 6683, -3791, 1797, -3968 },
+ { 6801, -1977, 2311, -452 },
+ { 6336, -1572, 2612, -3264 },
+ { 7996, -1008, 730, -2964 },
+ { 7521, -1059, 1573, -3694 },
+ { 8148, -3973, 2600, -3572 },
+ { 7765, -1532, 2528, -3856 },
+ { 7404, -3918, 4472, -143 },
+ { 8894, -1398, 3299, -3685 },
+ { 5768, -2041, 1487, -637 },
+ { 5131, -2865, 2463, -811 },
+ { 6439, -1568, 3500, -1550 },
+ { -8878, -6798, -5319, -1452 },
+ { -6332, -9713, -3112, -990 },
+ { -8444, -6316, -3694, -687 },
+ { -6123, -10840, -3637, -4358 },
+ { -4784, -9580, -4577, -2581 },
+ { -6108, -10515, -4859, -2524 },
+ { -7605, -7518, -2327, -2797 },
+ { -9662, -8775, -2467, -2010 },
+ { -6494, -7523, -4715, -118 },
+ { -8290, -8982, -1672, -317 },
+ { -8798, -11051, -3888, -1426 },
+ { -6273, -6623, -6791, -142 },
+ { -8313, -7668, -2141, -1275 },
+ { -6453, -8412, -3589, -4102 },
+ { -6747, -7750, -5690, -2498 },
+ { -7814, -6693, -3174, -2446 },
+ { -10383, -10130, -3931, -2364 },
+ { -10606, -8467, -5539, -2772 },
+ { -9475, -6671, -3305, -2271 },
+ { -8982, -9457, -5635, -4005 },
+ { -10111, -7965, -6515, -4180 },
+ { -7301, -6479, -5364, 720 },
+ { -9543, -8999, -7921, -912 },
+ { -9534, -8562, -3469, -384 },
+ { -7601, -10344, -3205, -1127 },
+ { -8088, -8620, -4954, -2888 },
+ { -8202, -8406, -7038, -3775 },
+ { -7312, -8324, -3334, -1775 },
+ { -8566, -9262, -8071, -4174 },
+ { -7068, -11300, -5573, -2907 },
+ { -8295, -8952, -4366, -1544 },
+ { -11104, -10210, -2285, -384 },
+ { -5213, -7520, -5008, -1339 },
+ { -5889, -7940, -5987, -1385 },
+ { -10816, -8201, -4153, -1485 },
+ { -10277, -8919, -6315, -1652 },
+ { -5888, -10320, -3821, -1733 },
+ { -10497, -7181, -6083, -3032 },
+ { -7721, -9724, -6591, -5336 },
+ { -5688, -7894, -3486, -2552 },
+ { -10014, -10500, -3247, -820 },
+ { -6301, -8765, -4506, -2923 },
+ { -8261, -7847, -6213, -1552 },
+ { -10212, -7481, -8113, -3954 },
+ { -6938, -10874, -6074, -4703 },
+ { -7183, -10968, -4446, -1773 },
+ { -7120, -9193, -1966, -2509 },
+ { -6234, -9263, -2313, -4284 },
+ { -8503, -9857, -2429, -608 },
+ { -9372, -7844, -8391, -2120 },
+ { -7951, -7157, -6535, -11 },
+ { -7256, -9473, -2172, -660 },
+ { -10063, -9612, -2515, -15 },
+ { -6684, -9134, -6109, -4206 },
+ { -8204, -11932, -5220, -2306 },
+ { -9710, -6706, -4115, -3275 },
+ { -6855, -7078, -2409, -4447 },
+ { -7344, -7673, -4479, -4116 },
+ { -8851, -6842, -4927, -2948 },
+ { -8927, -10452, -5633, -2194 },
+ { -8627, -9002, -7176, -1575 },
+ { -8209, -9722, -7021, -3324 },
+ { -3770, -10249, -3623, -4816 },
+ { -8183, -7465, -4090, 646 },
+ { -8163, -7149, 200, 498 },
+ { -8289, -6266, 686, -206 },
+ { -10030, -6241, -1032, -1864 },
+ { -8793, -8327, -773, -169 },
+ { -9149, -6215, 969, -15 },
+ { -8303, -5859, -7, 2006 },
+ { -9682, -7283, 255, 1322 },
+ { -9293, -7227, 71, -231 },
+ { -8525, -6215, 287, -837 },
+ { -10477, -5379, 1159, 1449 },
+ { -10726, -7856, -130, 102 },
+ { -8694, -7461, -1210, 690 },
+ { -9367, -5324, 1103, 3170 },
+ { -10686, -8055, -831, 1633 },
+ { -9201, -6873, -2704, 2258 },
+ { -8421, -5358, -1405, 226 },
+ { -9066, -5830, -307, -1571 },
+ { -11150, -7381, -2746, -900 },
+ { -9978, -5925, -2006, -437 },
+ { -9464, -4741, -273, 1061 },
+ { -10543, -6684, -1113, 1660 },
+ { -10073, -5576, 1083, -269 },
+ { -8826, -5763, 1600, 1486 },
+ { -10445, -9071, -1253, -64 },
+ { -12085, -5799, 2, 769 },
+ { -12939, -6663, 1650, 1437 },
+ { -10932, -6434, -1252, -649 },
+ { -11650, -7826, -2053, 710 },
+ { -12122, -6733, -1889, -731 },
+ { -9093, -6095, -2463, -842 },
+ { -10977, -4364, 469, 420 },
+ { -11488, -6908, -521, 893 },
+ { -9669, -5478, -842, 337 },
+ { -10606, -5203, -632, -1361 },
+ { -10198, -6284, 1662, 1277 },
+ { -10135, -5292, 2435, 3493 },
+ { -11027, -6561, 655, 56 },
+ { -10977, -5030, 1127, -358 },
+ { -12766, -3986, 1348, -335 },
+ { -14244, -7731, 264, 317 },
+ { -15124, -10309, -508, 1447 },
+ { -12821, -8638, -608, 137 },
+ { -13076, -8693, -2852, -431 },
+ { -11156, -5546, -2252, -1600 },
+ { -8692, -7366, -819, -1223 },
+ { -12507, -9816, -1714, -121 },
+ { -10712, -6666, 544, 3349 },
+ { -12462, -5890, -2491, -2318 },
+ { -12468, -7226, 437, 232 },
+ { -11300, -5226, 2068, 687 },
+ { -11994, -8320, -626, 2728 },
+ { -12222, -5476, 1142, 18 },
+ { -10277, -8122, -2418, 2003 },
+ { -13418, -6115, -3563, -2802 },
+ { -14759, -9834, -1243, 21 },
+ { -13699, -5665, 1525, 507 },
+ { -16269, -9476, -701, 163 },
+ { -12677, -5437, -247, -1019 },
+ { -11827, -4295, -181, -1243 },
+ { -12847, -4496, 2984, 1123 },
+ { -13860, -7915, -1166, -547 },
+ { -12276, -8145, -2290, -1527 },
+ { -11417, -4830, 2983, 1854 },
+ { -11793, -6002, 1163, 1940 },
+ { 11443, -4920, -3235, 3151 },
+ { 11300, -6616, -1506, 1175 },
+ { 9198, -4628, -2060, 2390 },
+ { 10532, -4027, -643, 912 },
+ { 9902, -3573, -1606, 1327 },
+ { 9653, -3536, -2240, 1869 },
+ { 9948, -5171, -423, 2662 },
+ { 12316, -4004, -1989, 281 },
+ { 12125, -4800, -1265, -163 },
+ { 10650, -2617, -2337, 1462 },
+ { 9909, -4968, -2376, 916 },
+ { 12944, -4647, -1958, 460 },
+ { 12988, -5283, -1141, 41 },
+ { 12321, -2915, -3621, 1025 },
+ { 11449, -2894, -2728, 351 },
+ { 12087, -3041, -2002, -32 },
+ { 11558, -4031, -1343, -399 },
+ { 12983, -3740, -3516, 1245 },
+ { 12099, -2515, -2752, 225 },
+ { 12515, -3465, -2701, 550 },
+ { 14683, -5022, -5272, 2996 },
+ { 12260, -3383, -1215, -528 },
+ { 13810, -5422, -2443, 1166 },
+ { 13421, -5378, -1886, 721 },
+ { 12961, -4259, -2594, 796 },
+ { 12266, -2104, -4768, 1591 },
+ { 13523, -4710, -3045, 1342 },
+ { 12437, -2099, -5610, 2117 },
+ { 11850, -2183, -3497, 661 },
+ { 12275, -3936, -597, -697 },
+ { 12459, -5253, -517, -544 },
+ { 12835, -4094, -1322, -168 },
+ { 14360, -5677, -3305, 1859 },
+ { 13905, -4552, -4309, 2117 },
+ { 11559, -3412, -1847, -81 },
+ { 13379, -3167, -5764, 2746 },
+ { 11910, -1634, -4342, 1052 },
+ { 12662, -4742, 71, -974 },
+ { 13057, -3254, -4424, 1705 },
+ { 15046, -5706, -4851, 3019 },
+ { 14162, -4142, -5514, 2843 },
+ { 12764, -1845, -6684, 2888 },
+ { 13714, -2374, -7838, 3857 },
+ { 13295, -1663, -8293, 4073 },
+ { 10032, -4152, -3403, 1421 },
+ { 10942, -5386, -2222, 950 },
+ { 10532, -6385, -1750, 1925 },
+ { 10273, -5972, -1534, 643 },
+ { 10605, -4782, -1695, 27 },
+ { 10988, -5153, -1123, -341 },
+ { 11629, -5884, -1060, 48 },
+ { 10441, -4045, -2431, 311 },
+ { 10788, -3595, -4171, 1807 },
+ { 12110, -5686, -2127, 976 },
+ { 11746, -4773, -2639, 891 },
+ { 11541, -5299, -3031, 1732 },
+ { 11416, -2559, -5359, 2198 },
+ { 11583, -5376, -704, 677 },
+ { 10416, -3214, -3516, 872 },
+ { 9651, -5435, -1618, 3255 },
+ { 9973, -5133, -996, 3923 },
+ { 11707, -4643, -430, -796 },
+ { 10994, -2709, -3587, 2302 },
+ { 10716, -5118, -645, 270 },
+ { 14100, -10314, 1095, 1531 },
+ { 12944, -8049, 1105, -741 },
+ { 13276, -7035, -511, 274 },
+ { 14008, -7254, -283, 139 },
+ { 11594, -6536, -91, 1671 },
+ { 11732, -8645, 746, 15 },
+ { 14613, -7085, -1578, 1183 },
+ { 13083, -6224, -750, -4 },
+ { 13988, -6256, -1592, 820 },
+ { 14678, -8683, 441, 126 },
+ { 15571, -8872, -521, 1139 },
+ { 15642, -9533, 341, 697 },
+ { 15960, -9586, -168, 1121 },
+ { 15464, -10239, 1433, -1 },
+ { 14934, -7887, -1046, 1080 },
+ { 15252, -7630, -1899, 1628 },
+ { 15485, -8384, -1234, 1484 },
+ { 15962, -8638, -1815, 1931 },
+ { 16501, -10664, 398, 1167 },
+ { 16146, -10145, 411, 918 },
+ { 14573, -7475, -697, 601 },
+ { 14302, -7996, 28, 257 },
+ { 14769, -6792, -2286, 1574 },
+ { 14144, -6137, -2169, 1257 },
+ { 14770, -6271, -3111, 1933 },
+ { 14110, -8312, 1083, -531 },
+ { 15235, -6991, -2993, 2174 },
+ { 13222, -5805, 547, -891 },
+ { 14796, -8762, 1254, -246 },
+ { 16040, -9181, -1005, 1551 },
+ { 16487, -10086, -373, 1420 },
+ { 15077, -9479, 966, 51 },
+ { 13026, -6468, 932, -1080 },
+ { 12703, -6152, -33, -573 },
+ { 15641, -6810, -4128, 2874 },
+ { 13282, -7673, 1583, -1283 },
+ { 12373, -7150, 1512, -917 },
+ { 12992, -7751, -678, 783 },
+ { 10907, -6858, -313, 2597 },
+ { 13026, -8963, 125, 2152 },
+ { 12770, -9946, 1957, -505 },
+ { 12482, -6849, -1268, 833 },
+ { 13790, -6181, -138, -279 },
+ { 12709, -8382, 2044, 227 },
+ { 12244, -6630, 203, -457 },
+ { 14209, -6816, -1032, 632 },
+ { 15134, -8267, -288, 640 },
+ { 13619, -6157, -1090, 356 },
+ { 14044, -7413, 725, -484 },
+ { 12958, -7753, 2585, -1980 },
+ { 13188, -8396, 2306, -1558 },
+ { 14379, -9980, 2132, -688 },
+ { 14275, -9857, 1162, 179 },
+ { 13690, -8648, 1621, -889 },
+ { 11770, -6829, -746, 278 },
+ { 12732, -8202, 286, 90 },
+ { 13630, -10146, 1867, -207 },
+ { 12072, -8740, 1299, -645 },
+ { 12852, -9492, 1226, 62 },
+ { 11792, -7382, -54, -116 },
+ { 13779, -9014, 487, 351 },
+ { 11951, -7729, 121, 834 },
+ { 11970, -9781, 2276, -4 },
+ { 12680, -7984, 2787, -787 },
+ { 13300, -14488, 6408, -1927 },
+ { 13635, -15355, 9153, -3073 },
+ { 12804, -13566, 5517, -1625 },
+ { 16624, -10854, 1690, 28 },
+ { 20387, -18532, 6162, -261 },
+ { 16515, -12642, 3392, -519 },
+ { 15800, -11095, 2151, -202 },
+ { 16824, -11790, 1651, 599 },
+ { 17604, -13213, 2563, 538 },
+ { 17892, -14177, 3562, 147 },
+ { 16987, -11399, 869, 1052 },
+ { 17003, -12456, 2442, 265 },
+ { 21657, -21806, 9198, -1250 },
+ { 16825, -13341, 3980, -686 },
+ { 17525, -12714, 1887, 805 },
+ { 16419, -11034, 1216, 617 },
+ { 20931, -19939, 7469, -684 },
+ { 18452, -15390, 4573, -191 },
+ { 14778, -10077, 2841, -1209 },
+ { 17402, -13319, 3042, 160 },
+ { 19365, -17922, 7087, -1061 },
+ { 16298, -11941, 2810, -351 },
+ { 19087, -16176, 4775, -84 },
+ { 17666, -12289, 938, 1224 },
+ { 18581, -15894, 5132, -430 },
+ { 19823, -16717, 4142, 545 },
+ { 19960, -19423, 8400, -1492 },
+ { 18973, -16817, 5906, -594 },
+ { 19079, -15431, 3528, 503 },
+ { 16667, -12485, 4467, -1302 },
+ { 19791, -17797, 6196, -529 },
+ { 20005, -17606, 5354, -20 },
+ { 20123, -18599, 6886, -728 },
+ { 19068, -14805, 2394, 1105 },
+ { 14443, -13723, 5631, -2029 },
+ { 14730, -14231, 5631, -1450 },
+ { 16089, -15959, 7271, -2029 },
+ { 13473, -11200, 3236, -924 },
+ { 14413, -10902, 2347, -267 },
+ { 17666, -18662, 11381, -3496 },
+ { 14749, -11042, 3305, -275 },
+ { 15304, -10486, 1869, -240 },
+ { 14809, -12126, 3369, -616 },
+ { 16896, -16561, 7307, -1845 },
+ { 15782, -14336, 5380, -1264 },
+ { 16395, -15520, 6415, -1588 },
+ { 13681, -11114, 2584, -320 },
+ { 14244, -12326, 4480, -1632 },
+ { 15247, -13119, 4265, -898 },
+ { 13987, -12091, 3469, -597 },
+ { 13941, -12770, 4240, -839 },
+ { 13771, -13627, 5252, -1384 },
+ { 15010, -16074, 7592, -2249 },
+ { 15852, -17226, 8619, -2655 },
+ { 18921, -16916, 6875, -1501 },
+ { 14909, -11678, 2768, -295 },
+ { 18988, -18353, 8424, -2070 },
+ { 15457, -15080, 6218, -1513 },
+ { 14916, -15512, 6949, -1883 },
+ { 18108, -14702, 4681, -701 },
+ { 17600, -15733, 5616, -775 },
+ { 14070, -13683, 6472, -2626 },
+ { 13832, -11914, 5201, -2232 },
+ { 18846, -19009, 9192, -1961 },
+ { -11981, -10994, -6324, -2264 },
+ { -10976, -9047, -6546, -3828 },
+ { -11288, -10532, -7014, -4191 },
+ { -10139, -10189, -7799, -2688 },
+ { -10555, -9988, -9181, -2040 },
+ { -11596, -11339, -10022, -2707 },
+ { -13400, -13395, -11306, -4206 },
+ { -9774, -12281, -7466, -4133 },
+ { -10842, -13125, -8777, -4956 },
+ { -11964, -15082, -9779, -5095 },
+ { -9382, -10188, -9053, -4927 },
+ { -11562, -11296, -3651, -985 },
+ { -9287, -10083, -7918, -4069 },
+ { -12821, -16556, -11410, -6195 },
+ { -12628, -8959, -4521, -1113 },
+ { -13845, -11581, -3649, -681 },
+ { -12685, -10269, -5483, -1275 },
+ { -14988, -12874, -5107, -1189 },
+ { -13761, -11367, -6202, -1804 },
+ { -13225, -11249, -7820, -3354 },
+ { -14809, -11992, -3202, -312 },
+ { -15620, -15519, -10210, -3433 },
+ { -12954, -10200, -3139, -611 },
+ { -11536, -9981, -5284, -923 },
+ { -13034, -12417, -4612, -1098 },
+ { -16911, -15505, -6123, -1352 },
+ { -17396, -17685, -8330, -2171 },
+ { -14120, -10764, -2265, -99 },
+ { -12598, -7367, -5406, -3530 },
+ { -14143, -12793, -10909, -5226 },
+ { -14692, -16871, -11626, -5554 },
+ { -12581, -11197, -9194, -3837 },
+ { -16752, -16726, -9746, -2808 },
+ { -10600, -10358, -6560, -1227 },
+ { -14573, -13312, -8957, -3393 },
+ { -10172, -8463, -8579, -3387 },
+ { -11418, -12421, -5522, -1842 },
+ { -11855, -14204, -6669, -2625 },
+ { -13308, -8191, -3941, -2194 },
+ { -10007, -12266, -5022, -1811 },
+ { -13532, -15771, -9497, -3175 },
+ { -11760, -11148, -10339, -5529 },
+ { -12149, -12763, -11198, -3697 },
+ { -12029, -12119, -8555, -1792 },
+ { -16995, -19957, -11447, -3471 },
+ { -13144, -14504, -9988, -3191 },
+ { -9938, -11064, -6139, -3162 },
+ { -8873, -11550, -8294, -6550 },
+ { -9303, -13010, -6150, -2711 },
+ { -15463, -10469, -1766, -170 },
+ { -15985, -11693, -3007, -650 },
+ { -17142, -10671, -1434, 47 },
+ { -16063, -13858, -4817, -1058 },
+ { -19446, -19599, -9594, -2464 },
+ { -20076, -18744, -8313, -1889 },
+ { -15047, -16085, -7590, -2250 },
+ { -13481, -16195, -8552, -2998 },
+ { -13829, -14869, -6704, -1932 },
+ { -16357, -18484, -9802, -2959 },
+ { -10551, -8393, -9303, -5070 },
+ { -11345, -9156, -5641, -3107 },
+ { -13217, -13449, -9270, -4541 },
+ { -11988, -13732, -9995, -6374 },
+ { -11007, -9519, -5168, -4107 },
+ { 9930, -7858, 8061, -4375 },
+ { 8274, -7867, 5992, -2096 },
+ { 9692, -9675, 7621, -3670 },
+ { 9589, -8110, 6509, -3010 },
+ { 12617, -11976, 10122, -5360 },
+ { 11867, -8895, 7948, -5323 },
+ { 10388, -10482, 9234, -4324 },
+ { 8188, -8220, 7810, -2737 },
+ { 10407, -8787, 4806, -1930 },
+ { 10348, -8845, 9233, -6614 },
+ { 9422, -7091, 4820, -2878 },
+ { 9758, -9796, 5584, -2256 },
+ { 10188, -7994, 5347, -3343 },
+ { 11133, -7455, 4015, -2306 },
+ { 10676, -10744, 6093, -2629 },
+ { 11522, -12184, 7848, -3375 },
+ { 8805, -9883, 5317, -3071 },
+ { 9498, -9654, 6555, -3592 },
+ { 10488, -8008, 4066, -1252 },
+ { 11261, -8930, 6068, -2738 },
+ { 12180, -10397, 5027, -1531 },
+ { 9138, -8531, 3601, -1959 },
+ { 8107, -8380, 4970, -2061 },
+ { 9737, -13248, 6438, -2617 },
+ { 11178, -10423, 2622, -522 },
+ { 9572, -12372, 5199, -2019 },
+ { 12057, -12144, 4147, -1099 },
+ { 9047, -9925, 2516, -665 },
+ { 10790, -8030, 5882, -4386 },
+ { 7199, -8426, 6337, -2841 },
+ { 7778, -8285, 3529, -3442 },
+ { 7559, -10569, 3484, -1332 },
+ { 9404, -8115, 7484, -5541 },
+ { 7792, -11976, 5546, -2573 },
+ { 9313, -10264, 7661, -5195 },
+ { 6701, -10725, 4370, -1784 },
+ { 4918, -11361, 4507, -4527 },
+ { 5147, -12305, 3978, -5556 },
+ { 6525, -9899, 4481, -3129 },
+ { 7538, -12855, 6060, -4826 },
+ { 8659, -12111, 7159, -4430 },
+ { 8440, -11304, 4547, -1747 },
+ { 9216, -10918, 3507, -1195 },
+ { 6165, -9254, 4771, -4677 },
+ { 9163, -11019, 5637, -4935 },
+ { 13441, -11509, 6676, -2434 },
+ { 7912, -9398, 6663, -4048 },
+ { 11723, -13745, 8131, -4148 },
+ { 6065, -10257, 5005, -6327 },
+ { 11618, -12417, 5336, -1894 },
+ { 8891, -13924, 8407, -6131 },
+ { 9622, -12563, 7908, -5109 },
+ { 11479, -10315, 8349, -3991 },
+ { 11676, -14103, 6611, -2330 },
+ { 11951, -8953, 3829, -1550 },
+ { 10486, -8044, 10493, -5920 },
+ { 11801, -10769, 9763, -5305 },
+ { 6109, -8676, 5827, -1346 },
+ { 7030, -9611, 5624, -5761 },
+ { 12808, -12886, 8683, -4148 },
+ { 13213, -10464, 6381, -3189 },
+ { 11796, -13681, 10703, -6075 },
+ { 9639, -7949, 9625, -3944 },
+ { 8538, -6997, 5309, 453 }
};
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_fir.h b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_fir.h
index a2b3dffcc..a127fee6f 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_fir.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_fir.h
@@ -23,2064 +23,2064 @@
double fir_32bands_perfect[] =
{
- +1.135985195E-010,
- -6.022448247E-007,
- +9.742954035E-007,
- +7.018770981E-011,
- -6.628192182E-007,
- +1.085227950E-006,
- -1.608403011E-008,
- -6.982898526E-007,
- +1.162929266E-006,
- -5.083275667E-008,
- -7.020648809E-007,
- +1.194632091E-006,
- -1.543309907E-007,
- -6.767839409E-007,
- +1.179182050E-006,
- -3.961981463E-007,
- -6.262345096E-007,
- +1.033426656E-006,
- -7.342250683E-007,
- -5.564140224E-007,
- +9.451737242E-007,
- -3.970030775E-007,
- +7.003467317E-007,
- +1.975324267E-006,
- -4.741137047E-007,
- +8.419976893E-007,
- +1.190443072E-006,
- +5.234479659E-007,
- +6.402664354E-008,
- -1.470520488E-006,
- +2.014677420E-007,
- -3.246264413E-008,
- -1.853591357E-006,
- +7.834767501E-008,
- -3.809887872E-008,
- +7.198007665E-007,
- +8.434094667E-008,
- +3.086857760E-006,
- -6.702406963E-010,
- +6.437721822E-008,
- +6.084746474E-006,
- -1.613285505E-009,
- +1.189317118E-006,
- +9.561075785E-006,
- -2.682709610E-009,
- +2.497214155E-006,
- +1.309637537E-005,
- -3.399493131E-009,
- +3.617151151E-006,
- +2.263354872E-005,
- +1.314406006E-008,
- +3.157242645E-006,
- +2.847247197E-005,
- +7.506701927E-009,
- +2.319611212E-006,
- +3.415624451E-005,
- +2.788728892E-008,
- +7.869333785E-006,
- +3.946387005E-005,
- +1.444918922E-007,
- +9.826449968E-006,
- +4.425736552E-005,
- +3.132386439E-007,
- +1.177108606E-005,
- +4.839275425E-005,
- +1.399798180E-006,
- +1.379448349E-005,
- +5.176846025E-005,
- +2.032118118E-006,
- +1.571428584E-005,
- +5.429694284E-005,
- +2.715013807E-006,
- +1.743183020E-005,
- +5.595519906E-005,
- +3.453840463E-006,
- +1.884208177E-005,
- +4.916387297E-006,
- +4.195037945E-006,
- +1.987093310E-005,
- +9.299508747E-006,
- +4.896494374E-006,
- +2.042970118E-005,
- +1.356193479E-005,
- +5.516381407E-006,
- -3.144468428E-005,
- +1.751866148E-005,
- +6.015239251E-006,
- -3.334947178E-005,
- +2.093936746E-005,
- +6.361419310E-006,
- -3.460439257E-005,
- +2.362549276E-005,
- +8.006985809E-006,
- -3.515914432E-005,
- +2.537086584E-005,
- +8.087732567E-006,
- -3.495384954E-005,
- +2.618136386E-005,
- +7.941360309E-006,
- -3.397853652E-005,
- +2.554462844E-005,
- +7.568834008E-006,
- -3.225446198E-005,
- +3.018750249E-005,
- +6.986399967E-006,
- -2.978993689E-005,
- +2.570833203E-005,
- +6.225028756E-006,
- -2.677291741E-005,
- +1.985177369E-005,
- +5.315936960E-006,
- -1.806914770E-005,
- +1.191342653E-005,
- +4.429412002E-006,
- -1.776598037E-005,
- +2.525620175E-006,
- +3.332600045E-006,
- -1.661818715E-005,
- -1.521241393E-005,
- +8.427224429E-007,
- -1.207003334E-005,
- -1.617751332E-005,
- +4.341498823E-007,
- -6.993315310E-006,
- +1.992636317E-005,
- +9.458596395E-008,
- -5.633860383E-007,
- +1.774702469E-005,
- +2.975164826E-008,
- -9.984935332E-007,
- +4.624524081E-005,
- +5.610509834E-005,
- -5.729619297E-004,
- +4.244441516E-004,
- +6.568001118E-005,
- -6.358824321E-004,
- +2.206075296E-004,
- +7.513730816E-005,
- -7.021900383E-004,
- -2.719412748E-007,
- +8.413690375E-005,
- -7.698345580E-004,
- -2.382978710E-004,
- +8.757545584E-005,
- -8.385353722E-004,
- -4.935106263E-004,
- +9.517164290E-005,
- -9.078957955E-004,
- -7.658848190E-004,
- +1.020687996E-004,
- -9.775133803E-004,
- -1.055365428E-003,
- +1.084438481E-004,
- -1.046945457E-003,
- -1.361547387E-003,
- +1.140582463E-004,
- -1.115717343E-003,
- -1.684492454E-003,
- +1.187910311E-004,
- -1.183370827E-003,
- -2.023874084E-003,
- +1.224978914E-004,
- -1.252829796E-003,
- -2.379294252E-003,
- +1.250260248E-004,
- -1.316190348E-003,
- -2.750317100E-003,
- +1.262027217E-004,
- -1.376571832E-003,
- -3.136433195E-003,
- +1.226499153E-004,
- -1.433344092E-003,
- -3.537061159E-003,
- +1.213575742E-004,
- -1.485876855E-003,
- -3.951539751E-003,
- +1.180980107E-004,
- -1.533520175E-003,
- -4.379155114E-003,
- +1.126275165E-004,
- -1.575609902E-003,
- -4.819062538E-003,
- +1.047207043E-004,
- -1.611457788E-003,
- -5.270531867E-003,
- +9.417100227E-005,
- -1.640390139E-003,
- -5.732392892E-003,
- +8.078388782E-005,
- -1.661288203E-003,
- -6.203945260E-003,
- +6.447290798E-005,
- -1.674512983E-003,
- -6.683901884E-003,
- +4.491530854E-005,
- -1.678415807E-003,
- -7.170005701E-003,
- +2.470704203E-005,
- -1.672798418E-003,
- -7.664063945E-003,
- -1.714242217E-006,
- -1.656501088E-003,
- -8.162760176E-003,
- -3.193307566E-005,
- -1.633993932E-003,
- -8.665001951E-003,
- -6.541742187E-005,
- -1.593449386E-003,
- -9.170533158E-003,
- -1.024175072E-004,
- +1.542080659E-003,
- -9.676489048E-003,
- -1.312203676E-004,
- +1.479332102E-003,
- -1.018219907E-002,
- -1.774113771E-004,
- +1.395521569E-003,
- -1.068630442E-002,
- -2.233728592E-004,
- +1.303116791E-003,
- -1.118756086E-002,
- -2.682086197E-004,
- +1.196175464E-003,
- -1.168460958E-002,
- -3.347633174E-004,
- +1.073757303E-003,
- -1.217562053E-002,
- -3.906481725E-004,
- +9.358961834E-004,
- -1.265939046E-002,
- -4.490280990E-004,
- +7.817269652E-004,
- -1.313448418E-002,
- -5.099929986E-004,
- +6.114174030E-004,
- -1.359948888E-002,
- -1.405300573E-002,
- +1.572482102E-002,
- +4.935106263E-004,
- -1.449365262E-002,
- +1.533095632E-002,
- +2.382978710E-004,
- -1.492007636E-002,
- +1.492007636E-002,
- +2.719412748E-007,
- -1.533095632E-002,
- +1.449365262E-002,
- -2.206075296E-004,
- -1.572482102E-002,
- +1.405300573E-002,
- -4.244441516E-004,
- -1.610082202E-002,
- +1.359948888E-002,
- -6.114174030E-004,
- -1.645756140E-002,
- +1.313448418E-002,
- -7.817269652E-004,
- -1.679391414E-002,
- +1.265939046E-002,
- -9.358961834E-004,
- -1.710879989E-002,
- +1.217562053E-002,
- -1.073757303E-003,
- -1.740120351E-002,
- +1.168460958E-002,
- -1.196175464E-003,
- -1.767017506E-002,
- +1.118756086E-002,
- -1.303116791E-003,
- -1.791484281E-002,
- +1.068630442E-002,
- -1.395521569E-003,
- -1.813439466E-002,
- +1.018219907E-002,
- -1.479332102E-003,
- -1.832821220E-002,
- +9.676489048E-003,
- -1.542080659E-003,
- -1.849545911E-002,
- +9.170533158E-003,
- +1.593449386E-003,
- -1.863567345E-002,
- +8.665001951E-003,
- +1.633993932E-003,
- -1.874836907E-002,
- +8.162760176E-003,
- +1.656501088E-003,
- -1.883326657E-002,
- +7.664063945E-003,
- +1.672798418E-003,
- -1.889026538E-002,
- +7.170005701E-003,
- +1.678415807E-003,
- -1.891860925E-002,
- +6.683901884E-003,
- +1.674512983E-003,
- +1.891860925E-002,
- +6.203945260E-003,
- +1.661288203E-003,
- +1.889026538E-002,
- +5.732392892E-003,
- +1.640390139E-003,
- +1.883326657E-002,
- +5.270531867E-003,
- +1.611457788E-003,
- +1.874836907E-002,
- +4.819062538E-003,
- +1.575609902E-003,
- +1.863567345E-002,
- +4.379155114E-003,
- +1.533520175E-003,
- +1.849545911E-002,
- +3.951539751E-003,
- +1.485876855E-003,
- +1.832821220E-002,
- +3.537061159E-003,
- +1.433344092E-003,
- +1.813439466E-002,
- +3.136433195E-003,
- +1.376571832E-003,
- +1.791484281E-002,
- +2.750317100E-003,
- +1.316190348E-003,
- +1.767017506E-002,
- +2.379294252E-003,
- +1.252829796E-003,
- +1.740120351E-002,
- +2.023874084E-003,
- +1.183370827E-003,
- +1.710879989E-002,
- +1.684492454E-003,
- +1.115717343E-003,
- +1.679391414E-002,
- +1.361547387E-003,
- +1.046945457E-003,
- +1.645756140E-002,
- +1.055365428E-003,
- +9.775133803E-004,
- +1.610082202E-002,
- +7.658848190E-004,
- +9.078957955E-004,
- +8.385353722E-004,
- -8.757545584E-005,
- -6.084746474E-006,
- +7.698345580E-004,
- -8.413690375E-005,
- -3.086857760E-006,
- +7.021900383E-004,
- -7.513730816E-005,
- -7.198007665E-007,
- +6.358824321E-004,
- -6.568001118E-005,
- +1.853591357E-006,
- +5.729619297E-004,
- -5.610509834E-005,
- +1.470520488E-006,
- +5.099929986E-004,
- -4.624524081E-005,
- +9.984935332E-007,
- +4.490280990E-004,
- -1.774702469E-005,
- +5.633860383E-007,
- +3.906481725E-004,
- -1.992636317E-005,
- +6.993315310E-006,
- +3.347633174E-004,
- +1.617751332E-005,
- +1.207003334E-005,
- +2.682086197E-004,
- +1.521241393E-005,
- +1.661818715E-005,
- +2.233728592E-004,
- -2.525620175E-006,
- +1.776598037E-005,
- +1.774113771E-004,
- -1.191342653E-005,
- +1.806914770E-005,
- +1.312203676E-004,
- -1.985177369E-005,
- +2.677291741E-005,
- +1.024175072E-004,
- -2.570833203E-005,
- +2.978993689E-005,
- +6.541742187E-005,
- -3.018750249E-005,
- +3.225446198E-005,
- +3.193307566E-005,
- -2.554462844E-005,
- +3.397853652E-005,
- +1.714242217E-006,
- -2.618136386E-005,
- +3.495384954E-005,
- -2.470704203E-005,
- -2.537086584E-005,
- +3.515914432E-005,
- -4.491530854E-005,
- -2.362549276E-005,
- +3.460439257E-005,
- -6.447290798E-005,
- -2.093936746E-005,
- +3.334947178E-005,
- -8.078388782E-005,
- -1.751866148E-005,
- +3.144468428E-005,
- -9.417100227E-005,
- -1.356193479E-005,
- -2.042970118E-005,
- -1.047207043E-004,
- -9.299508747E-006,
- -1.987093310E-005,
- -1.126275165E-004,
- -4.916387297E-006,
- -1.884208177E-005,
- -1.180980107E-004,
- -5.595519906E-005,
- -1.743183020E-005,
- -1.213575742E-004,
- -5.429694284E-005,
- -1.571428584E-005,
- -1.226499153E-004,
- -5.176846025E-005,
- -1.379448349E-005,
- -1.262027217E-004,
- -4.839275425E-005,
- -1.177108606E-005,
- -1.250260248E-004,
- -4.425736552E-005,
- -9.826449968E-006,
- -1.224978914E-004,
- -3.946387005E-005,
- -7.869333785E-006,
- -1.187910311E-004,
- -3.415624451E-005,
- -2.319611212E-006,
- -1.140582463E-004,
- -2.847247197E-005,
- -3.157242645E-006,
- -1.084438481E-004,
- -2.263354872E-005,
- -3.617151151E-006,
- -1.020687996E-004,
- -1.309637537E-005,
- -2.497214155E-006,
- -9.517164290E-005,
- -9.561075785E-006,
- -1.189317118E-006,
- -6.437721822E-008,
- -4.195037945E-006,
- -1.194632091E-006,
- -8.434094667E-008,
- -3.453840463E-006,
- -1.162929266E-006,
- +3.809887872E-008,
- -2.715013807E-006,
- -1.085227950E-006,
- +3.246264413E-008,
- -2.032118118E-006,
- -9.742954035E-007,
- -6.402664354E-008,
- -1.399798180E-006,
- -8.419976893E-007,
- -2.975164826E-008,
- -3.132386439E-007,
- -7.003467317E-007,
- -9.458596395E-008,
- -1.444918922E-007,
- +5.564140224E-007,
- -4.341498823E-007,
- -2.788728892E-008,
- +6.262345096E-007,
- -8.427224429E-007,
- -7.506701927E-009,
- +6.767839409E-007,
- -3.332600045E-006,
- -1.314406006E-008,
- +7.020648809E-007,
- -4.429412002E-006,
- +3.399493131E-009,
- +6.982898526E-007,
- -5.315936960E-006,
- +2.682709610E-009,
- +6.628192182E-007,
- -6.225028756E-006,
- +1.613285505E-009,
- +6.022448247E-007,
- -6.986399967E-006,
- +6.702406963E-010,
- +4.741137047E-007,
- -7.568834008E-006,
- -7.834767501E-008,
- +3.970030775E-007,
- -7.941360309E-006,
- -2.014677420E-007,
- +7.342250683E-007,
- -8.087732567E-006,
- -5.234479659E-007,
- +3.961981463E-007,
- -8.006985809E-006,
- -1.190443072E-006,
- +1.543309907E-007,
- -6.361419310E-006,
- -1.975324267E-006,
- +5.083275667E-008,
- -6.015239251E-006,
- -9.451737242E-007,
- +1.608403011E-008,
- -5.516381407E-006,
- -1.033426656E-006,
- -7.018770981E-011,
- -4.896494374E-006,
- -1.179182050E-006,
- -1.135985195E-010
++1.135985195E-010,
+-6.022448247E-007,
++9.742954035E-007,
++7.018770981E-011,
+-6.628192182E-007,
++1.085227950E-006,
+-1.608403011E-008,
+-6.982898526E-007,
++1.162929266E-006,
+-5.083275667E-008,
+-7.020648809E-007,
++1.194632091E-006,
+-1.543309907E-007,
+-6.767839409E-007,
++1.179182050E-006,
+-3.961981463E-007,
+-6.262345096E-007,
++1.033426656E-006,
+-7.342250683E-007,
+-5.564140224E-007,
++9.451737242E-007,
+-3.970030775E-007,
++7.003467317E-007,
++1.975324267E-006,
+-4.741137047E-007,
++8.419976893E-007,
++1.190443072E-006,
++5.234479659E-007,
++6.402664354E-008,
+-1.470520488E-006,
++2.014677420E-007,
+-3.246264413E-008,
+-1.853591357E-006,
++7.834767501E-008,
+-3.809887872E-008,
++7.198007665E-007,
++8.434094667E-008,
++3.086857760E-006,
+-6.702406963E-010,
++6.437721822E-008,
++6.084746474E-006,
+-1.613285505E-009,
++1.189317118E-006,
++9.561075785E-006,
+-2.682709610E-009,
++2.497214155E-006,
++1.309637537E-005,
+-3.399493131E-009,
++3.617151151E-006,
++2.263354872E-005,
++1.314406006E-008,
++3.157242645E-006,
++2.847247197E-005,
++7.506701927E-009,
++2.319611212E-006,
++3.415624451E-005,
++2.788728892E-008,
++7.869333785E-006,
++3.946387005E-005,
++1.444918922E-007,
++9.826449968E-006,
++4.425736552E-005,
++3.132386439E-007,
++1.177108606E-005,
++4.839275425E-005,
++1.399798180E-006,
++1.379448349E-005,
++5.176846025E-005,
++2.032118118E-006,
++1.571428584E-005,
++5.429694284E-005,
++2.715013807E-006,
++1.743183020E-005,
++5.595519906E-005,
++3.453840463E-006,
++1.884208177E-005,
++4.916387297E-006,
++4.195037945E-006,
++1.987093310E-005,
++9.299508747E-006,
++4.896494374E-006,
++2.042970118E-005,
++1.356193479E-005,
++5.516381407E-006,
+-3.144468428E-005,
++1.751866148E-005,
++6.015239251E-006,
+-3.334947178E-005,
++2.093936746E-005,
++6.361419310E-006,
+-3.460439257E-005,
++2.362549276E-005,
++8.006985809E-006,
+-3.515914432E-005,
++2.537086584E-005,
++8.087732567E-006,
+-3.495384954E-005,
++2.618136386E-005,
++7.941360309E-006,
+-3.397853652E-005,
++2.554462844E-005,
++7.568834008E-006,
+-3.225446198E-005,
++3.018750249E-005,
++6.986399967E-006,
+-2.978993689E-005,
++2.570833203E-005,
++6.225028756E-006,
+-2.677291741E-005,
++1.985177369E-005,
++5.315936960E-006,
+-1.806914770E-005,
++1.191342653E-005,
++4.429412002E-006,
+-1.776598037E-005,
++2.525620175E-006,
++3.332600045E-006,
+-1.661818715E-005,
+-1.521241393E-005,
++8.427224429E-007,
+-1.207003334E-005,
+-1.617751332E-005,
++4.341498823E-007,
+-6.993315310E-006,
++1.992636317E-005,
++9.458596395E-008,
+-5.633860383E-007,
++1.774702469E-005,
++2.975164826E-008,
+-9.984935332E-007,
++4.624524081E-005,
++5.610509834E-005,
+-5.729619297E-004,
++4.244441516E-004,
++6.568001118E-005,
+-6.358824321E-004,
++2.206075296E-004,
++7.513730816E-005,
+-7.021900383E-004,
+-2.719412748E-007,
++8.413690375E-005,
+-7.698345580E-004,
+-2.382978710E-004,
++8.757545584E-005,
+-8.385353722E-004,
+-4.935106263E-004,
++9.517164290E-005,
+-9.078957955E-004,
+-7.658848190E-004,
++1.020687996E-004,
+-9.775133803E-004,
+-1.055365428E-003,
++1.084438481E-004,
+-1.046945457E-003,
+-1.361547387E-003,
++1.140582463E-004,
+-1.115717343E-003,
+-1.684492454E-003,
++1.187910311E-004,
+-1.183370827E-003,
+-2.023874084E-003,
++1.224978914E-004,
+-1.252829796E-003,
+-2.379294252E-003,
++1.250260248E-004,
+-1.316190348E-003,
+-2.750317100E-003,
++1.262027217E-004,
+-1.376571832E-003,
+-3.136433195E-003,
++1.226499153E-004,
+-1.433344092E-003,
+-3.537061159E-003,
++1.213575742E-004,
+-1.485876855E-003,
+-3.951539751E-003,
++1.180980107E-004,
+-1.533520175E-003,
+-4.379155114E-003,
++1.126275165E-004,
+-1.575609902E-003,
+-4.819062538E-003,
++1.047207043E-004,
+-1.611457788E-003,
+-5.270531867E-003,
++9.417100227E-005,
+-1.640390139E-003,
+-5.732392892E-003,
++8.078388782E-005,
+-1.661288203E-003,
+-6.203945260E-003,
++6.447290798E-005,
+-1.674512983E-003,
+-6.683901884E-003,
++4.491530854E-005,
+-1.678415807E-003,
+-7.170005701E-003,
++2.470704203E-005,
+-1.672798418E-003,
+-7.664063945E-003,
+-1.714242217E-006,
+-1.656501088E-003,
+-8.162760176E-003,
+-3.193307566E-005,
+-1.633993932E-003,
+-8.665001951E-003,
+-6.541742187E-005,
+-1.593449386E-003,
+-9.170533158E-003,
+-1.024175072E-004,
++1.542080659E-003,
+-9.676489048E-003,
+-1.312203676E-004,
++1.479332102E-003,
+-1.018219907E-002,
+-1.774113771E-004,
++1.395521569E-003,
+-1.068630442E-002,
+-2.233728592E-004,
++1.303116791E-003,
+-1.118756086E-002,
+-2.682086197E-004,
++1.196175464E-003,
+-1.168460958E-002,
+-3.347633174E-004,
++1.073757303E-003,
+-1.217562053E-002,
+-3.906481725E-004,
++9.358961834E-004,
+-1.265939046E-002,
+-4.490280990E-004,
++7.817269652E-004,
+-1.313448418E-002,
+-5.099929986E-004,
++6.114174030E-004,
+-1.359948888E-002,
+-1.405300573E-002,
++1.572482102E-002,
++4.935106263E-004,
+-1.449365262E-002,
++1.533095632E-002,
++2.382978710E-004,
+-1.492007636E-002,
++1.492007636E-002,
++2.719412748E-007,
+-1.533095632E-002,
++1.449365262E-002,
+-2.206075296E-004,
+-1.572482102E-002,
++1.405300573E-002,
+-4.244441516E-004,
+-1.610082202E-002,
++1.359948888E-002,
+-6.114174030E-004,
+-1.645756140E-002,
++1.313448418E-002,
+-7.817269652E-004,
+-1.679391414E-002,
++1.265939046E-002,
+-9.358961834E-004,
+-1.710879989E-002,
++1.217562053E-002,
+-1.073757303E-003,
+-1.740120351E-002,
++1.168460958E-002,
+-1.196175464E-003,
+-1.767017506E-002,
++1.118756086E-002,
+-1.303116791E-003,
+-1.791484281E-002,
++1.068630442E-002,
+-1.395521569E-003,
+-1.813439466E-002,
++1.018219907E-002,
+-1.479332102E-003,
+-1.832821220E-002,
++9.676489048E-003,
+-1.542080659E-003,
+-1.849545911E-002,
++9.170533158E-003,
++1.593449386E-003,
+-1.863567345E-002,
++8.665001951E-003,
++1.633993932E-003,
+-1.874836907E-002,
++8.162760176E-003,
++1.656501088E-003,
+-1.883326657E-002,
++7.664063945E-003,
++1.672798418E-003,
+-1.889026538E-002,
++7.170005701E-003,
++1.678415807E-003,
+-1.891860925E-002,
++6.683901884E-003,
++1.674512983E-003,
++1.891860925E-002,
++6.203945260E-003,
++1.661288203E-003,
++1.889026538E-002,
++5.732392892E-003,
++1.640390139E-003,
++1.883326657E-002,
++5.270531867E-003,
++1.611457788E-003,
++1.874836907E-002,
++4.819062538E-003,
++1.575609902E-003,
++1.863567345E-002,
++4.379155114E-003,
++1.533520175E-003,
++1.849545911E-002,
++3.951539751E-003,
++1.485876855E-003,
++1.832821220E-002,
++3.537061159E-003,
++1.433344092E-003,
++1.813439466E-002,
++3.136433195E-003,
++1.376571832E-003,
++1.791484281E-002,
++2.750317100E-003,
++1.316190348E-003,
++1.767017506E-002,
++2.379294252E-003,
++1.252829796E-003,
++1.740120351E-002,
++2.023874084E-003,
++1.183370827E-003,
++1.710879989E-002,
++1.684492454E-003,
++1.115717343E-003,
++1.679391414E-002,
++1.361547387E-003,
++1.046945457E-003,
++1.645756140E-002,
++1.055365428E-003,
++9.775133803E-004,
++1.610082202E-002,
++7.658848190E-004,
++9.078957955E-004,
++8.385353722E-004,
+-8.757545584E-005,
+-6.084746474E-006,
++7.698345580E-004,
+-8.413690375E-005,
+-3.086857760E-006,
++7.021900383E-004,
+-7.513730816E-005,
+-7.198007665E-007,
++6.358824321E-004,
+-6.568001118E-005,
++1.853591357E-006,
++5.729619297E-004,
+-5.610509834E-005,
++1.470520488E-006,
++5.099929986E-004,
+-4.624524081E-005,
++9.984935332E-007,
++4.490280990E-004,
+-1.774702469E-005,
++5.633860383E-007,
++3.906481725E-004,
+-1.992636317E-005,
++6.993315310E-006,
++3.347633174E-004,
++1.617751332E-005,
++1.207003334E-005,
++2.682086197E-004,
++1.521241393E-005,
++1.661818715E-005,
++2.233728592E-004,
+-2.525620175E-006,
++1.776598037E-005,
++1.774113771E-004,
+-1.191342653E-005,
++1.806914770E-005,
++1.312203676E-004,
+-1.985177369E-005,
++2.677291741E-005,
++1.024175072E-004,
+-2.570833203E-005,
++2.978993689E-005,
++6.541742187E-005,
+-3.018750249E-005,
++3.225446198E-005,
++3.193307566E-005,
+-2.554462844E-005,
++3.397853652E-005,
++1.714242217E-006,
+-2.618136386E-005,
++3.495384954E-005,
+-2.470704203E-005,
+-2.537086584E-005,
++3.515914432E-005,
+-4.491530854E-005,
+-2.362549276E-005,
++3.460439257E-005,
+-6.447290798E-005,
+-2.093936746E-005,
++3.334947178E-005,
+-8.078388782E-005,
+-1.751866148E-005,
++3.144468428E-005,
+-9.417100227E-005,
+-1.356193479E-005,
+-2.042970118E-005,
+-1.047207043E-004,
+-9.299508747E-006,
+-1.987093310E-005,
+-1.126275165E-004,
+-4.916387297E-006,
+-1.884208177E-005,
+-1.180980107E-004,
+-5.595519906E-005,
+-1.743183020E-005,
+-1.213575742E-004,
+-5.429694284E-005,
+-1.571428584E-005,
+-1.226499153E-004,
+-5.176846025E-005,
+-1.379448349E-005,
+-1.262027217E-004,
+-4.839275425E-005,
+-1.177108606E-005,
+-1.250260248E-004,
+-4.425736552E-005,
+-9.826449968E-006,
+-1.224978914E-004,
+-3.946387005E-005,
+-7.869333785E-006,
+-1.187910311E-004,
+-3.415624451E-005,
+-2.319611212E-006,
+-1.140582463E-004,
+-2.847247197E-005,
+-3.157242645E-006,
+-1.084438481E-004,
+-2.263354872E-005,
+-3.617151151E-006,
+-1.020687996E-004,
+-1.309637537E-005,
+-2.497214155E-006,
+-9.517164290E-005,
+-9.561075785E-006,
+-1.189317118E-006,
+-6.437721822E-008,
+-4.195037945E-006,
+-1.194632091E-006,
+-8.434094667E-008,
+-3.453840463E-006,
+-1.162929266E-006,
++3.809887872E-008,
+-2.715013807E-006,
+-1.085227950E-006,
++3.246264413E-008,
+-2.032118118E-006,
+-9.742954035E-007,
+-6.402664354E-008,
+-1.399798180E-006,
+-8.419976893E-007,
+-2.975164826E-008,
+-3.132386439E-007,
+-7.003467317E-007,
+-9.458596395E-008,
+-1.444918922E-007,
++5.564140224E-007,
+-4.341498823E-007,
+-2.788728892E-008,
++6.262345096E-007,
+-8.427224429E-007,
+-7.506701927E-009,
++6.767839409E-007,
+-3.332600045E-006,
+-1.314406006E-008,
++7.020648809E-007,
+-4.429412002E-006,
++3.399493131E-009,
++6.982898526E-007,
+-5.315936960E-006,
++2.682709610E-009,
++6.628192182E-007,
+-6.225028756E-006,
++1.613285505E-009,
++6.022448247E-007,
+-6.986399967E-006,
++6.702406963E-010,
++4.741137047E-007,
+-7.568834008E-006,
+-7.834767501E-008,
++3.970030775E-007,
+-7.941360309E-006,
+-2.014677420E-007,
++7.342250683E-007,
+-8.087732567E-006,
+-5.234479659E-007,
++3.961981463E-007,
+-8.006985809E-006,
+-1.190443072E-006,
++1.543309907E-007,
+-6.361419310E-006,
+-1.975324267E-006,
++5.083275667E-008,
+-6.015239251E-006,
+-9.451737242E-007,
++1.608403011E-008,
+-5.516381407E-006,
+-1.033426656E-006,
+-7.018770981E-011,
+-4.896494374E-006,
+-1.179182050E-006,
+-1.135985195E-010
};
double fir_32bands_nonperfect[] =
{
- -1.390191784E-007,
- -1.693738625E-007,
- -2.030677564E-007,
- -2.404238444E-007,
- -2.818143514E-007,
- -3.276689142E-007,
- -3.784752209E-007,
- -4.347855338E-007,
- -4.972276315E-007,
- -5.665120852E-007,
- -6.434325428E-007,
- -7.288739425E-007,
- -8.238164355E-007,
- -9.293416952E-007,
- -1.046637067E-006,
- -1.176999604E-006,
- -1.321840614E-006,
- -1.482681114E-006,
- -1.661159786E-006,
- -1.859034001E-006,
- -2.078171747E-006,
- -2.320550948E-006,
- -2.588257530E-006,
- -2.883470643E-006,
- -3.208459020E-006,
- -3.565570978E-006,
- -3.957220997E-006,
- -4.385879038E-006,
- -4.854050530E-006,
- -5.364252502E-006,
- -5.918994248E-006,
- -6.520755960E-006,
- -7.171964626E-006,
- -7.874960829E-006,
- -8.631964192E-006,
- -9.445050637E-006,
- -1.031611009E-005,
- -1.124680875E-005,
- -1.223855270E-005,
- -1.329243969E-005,
- -1.440921824E-005,
- -1.558924305E-005,
- -1.683242772E-005,
- -1.813820381E-005,
- -1.950545993E-005,
- -2.093250441E-005,
- -2.241701623E-005,
- -2.395598858E-005,
- -2.554569073E-005,
- -2.718161704E-005,
- -2.885844333E-005,
- -3.056998685E-005,
- -3.230916263E-005,
- -3.406793985E-005,
- -3.583733633E-005,
- -3.760734762E-005,
- -3.936696885E-005,
- -4.110412556E-005,
- -4.280570283E-005,
- -4.445751256E-005,
- -4.604430433E-005,
- -4.754976908E-005,
- -4.895655002E-005,
- -5.024627535E-005,
- +5.139957648E-005,
- +5.239612074E-005,
- +5.321469871E-005,
- +5.383323878E-005,
- +5.422891263E-005,
- +5.437819709E-005,
- +5.425697600E-005,
- +5.384063843E-005,
- +5.310418419E-005,
- +5.202236207E-005,
- +5.056979353E-005,
- +4.872112549E-005,
- +4.645117951E-005,
- +4.373511547E-005,
- +4.054862075E-005,
- +3.686808850E-005,
- +3.267079956E-005,
- +2.793515523E-005,
- +2.264085742E-005,
- +1.676913780E-005,
- +1.030297699E-005,
- +3.227306706E-006,
- -4.470633485E-006,
- -1.280130618E-005,
- -2.177240640E-005,
- -3.138873581E-005,
- -4.165195787E-005,
- -5.256036457E-005,
- -6.410864444E-005,
- -7.628766616E-005,
- -8.908427117E-005,
- -1.024810626E-004,
- -1.164562127E-004,
- -1.309833024E-004,
- -1.460311323E-004,
- -1.615635992E-004,
- -1.775395358E-004,
- -1.939126523E-004,
- -2.106313768E-004,
- -2.276388550E-004,
- -2.448728774E-004,
- -2.622658503E-004,
- -2.797449124E-004,
- -2.972317743E-004,
- -3.146430245E-004,
- -3.318900708E-004,
- -3.488793736E-004,
- -3.655125911E-004,
- -3.816867538E-004,
- -3.972945851E-004,
- -4.122247046E-004,
- -4.263620067E-004,
- -4.395879805E-004,
- -4.517810594E-004,
- -4.628172028E-004,
- -4.725702747E-004,
- -4.809123348E-004,
- -4.877146275E-004,
- -4.928477574E-004,
- -4.961824161E-004,
- -4.975944757E-004,
- -4.969481961E-004,
- -4.941228544E-004,
- -4.889960401E-004,
- +4.814492422E-004,
- +4.713678791E-004,
- +4.586426076E-004,
- +4.431701091E-004,
- +4.248536134E-004,
- +4.036037717E-004,
- +3.793396754E-004,
- +3.519894381E-004,
- +3.214911267E-004,
- +2.877934603E-004,
- +2.508567995E-004,
- +2.106537577E-004,
- +1.671699720E-004,
- +1.204049113E-004,
- +7.037253090E-005,
- +1.710198012E-005,
- -3.936182839E-005,
- -9.895755647E-005,
- -1.616069785E-004,
- -2.272142592E-004,
- -2.956659591E-004,
- -3.668301215E-004,
- -4.405563814E-004,
- -5.166754709E-004,
- -5.949990009E-004,
- -6.753197522E-004,
- -7.574109477E-004,
- -8.410271257E-004,
- -9.259034996E-004,
- -1.011756598E-003,
- -1.098284614E-003,
- -1.185167348E-003,
- -1.272067428E-003,
- -1.358630019E-003,
- -1.444484224E-003,
- -1.529243193E-003,
- -1.612505526E-003,
- -1.693855622E-003,
- -1.772865304E-003,
- -1.849094522E-003,
- -1.922092517E-003,
- -1.991399564E-003,
- -2.056547208E-003,
- -2.117061289E-003,
- -2.172462177E-003,
- -2.222266514E-003,
- -2.265989315E-003,
- -2.303145360E-003,
- -2.333251061E-003,
- -2.355825622E-003,
- -2.370394068E-003,
- -2.376487479E-003,
- -2.373647178E-003,
- -2.361423569E-003,
- -2.339380793E-003,
- -2.307097195E-003,
- -2.264167881E-003,
- -2.210205887E-003,
- -2.144844970E-003,
- -2.067740774E-003,
- -1.978572691E-003,
- -1.877046190E-003,
- -1.762894331E-003,
- -1.635878929E-003,
- +1.495792647E-003,
- +1.342460280E-003,
- +1.175740734E-003,
- +9.955273708E-004,
- +8.017504588E-004,
- +5.943773431E-004,
- +3.734139318E-004,
- +1.389056415E-004,
- -1.090620208E-004,
- -3.703625989E-004,
- -6.448282511E-004,
- -9.322494152E-004,
- -1.232374110E-003,
- -1.544908970E-003,
- -1.869517611E-003,
- -2.205822384E-003,
- -2.553403843E-003,
- -2.911801683E-003,
- -3.280514618E-003,
- -3.659002949E-003,
- -4.046686925E-003,
- -4.442950245E-003,
- -4.847140983E-003,
- -5.258570891E-003,
- -5.676518660E-003,
- -6.100233644E-003,
- -6.528933067E-003,
- -6.961807609E-003,
- -7.398022339E-003,
- -7.836719044E-003,
- -8.277016692E-003,
- -8.718019351E-003,
- -9.158811532E-003,
- -9.598465636E-003,
- -1.003604382E-002,
- -1.047059800E-002,
- -1.090117730E-002,
- -1.132682897E-002,
- -1.174659748E-002,
- -1.215953380E-002,
- -1.256469358E-002,
- -1.296114177E-002,
- -1.334795821E-002,
- -1.372423489E-002,
- -1.408908330E-002,
- -1.444163360E-002,
- -1.478104480E-002,
- -1.510649733E-002,
- -1.541720331E-002,
- -1.571240649E-002,
- -1.599138230E-002,
- -1.625344716E-002,
- -1.649795473E-002,
- -1.672429405E-002,
- -1.693190821E-002,
- -1.712027565E-002,
- -1.728892699E-002,
- -1.743743755E-002,
- -1.756543480E-002,
- -1.767260395E-002,
- -1.775865816E-002,
- -1.782339066E-002,
- -1.786663756E-002,
- -1.788828894E-002,
- +1.788828894E-002,
- +1.786663756E-002,
- +1.782339066E-002,
- +1.775865816E-002,
- +1.767260395E-002,
- +1.756543480E-002,
- +1.743743755E-002,
- +1.728892699E-002,
- +1.712027565E-002,
- +1.693190821E-002,
- +1.672429405E-002,
- +1.649795473E-002,
- +1.625344716E-002,
- +1.599138230E-002,
- +1.571240649E-002,
- +1.541720331E-002,
- +1.510649733E-002,
- +1.478104480E-002,
- +1.444163360E-002,
- +1.408908330E-002,
- +1.372423489E-002,
- +1.334795821E-002,
- +1.296114177E-002,
- +1.256469358E-002,
- +1.215953380E-002,
- +1.174659748E-002,
- +1.132682897E-002,
- +1.090117730E-002,
- +1.047059800E-002,
- +1.003604382E-002,
- +9.598465636E-003,
- +9.158811532E-003,
- +8.718019351E-003,
- +8.277016692E-003,
- +7.836719044E-003,
- +7.398022339E-003,
- +6.961807609E-003,
- +6.528933067E-003,
- +6.100233644E-003,
- +5.676518660E-003,
- +5.258570891E-003,
- +4.847140983E-003,
- +4.442950245E-003,
- +4.046686925E-003,
- +3.659002949E-003,
- +3.280514618E-003,
- +2.911801683E-003,
- +2.553403843E-003,
- +2.205822384E-003,
- +1.869517611E-003,
- +1.544908970E-003,
- +1.232374110E-003,
- +9.322494152E-004,
- +6.448282511E-004,
- +3.703625989E-004,
- +1.090620208E-004,
- -1.389056415E-004,
- -3.734139318E-004,
- -5.943773431E-004,
- -8.017504588E-004,
- -9.955273708E-004,
- -1.175740734E-003,
- -1.342460280E-003,
- -1.495792647E-003,
- +1.635878929E-003,
- +1.762894331E-003,
- +1.877046190E-003,
- +1.978572691E-003,
- +2.067740774E-003,
- +2.144844970E-003,
- +2.210205887E-003,
- +2.264167881E-003,
- +2.307097195E-003,
- +2.339380793E-003,
- +2.361423569E-003,
- +2.373647178E-003,
- +2.376487479E-003,
- +2.370394068E-003,
- +2.355825622E-003,
- +2.333251061E-003,
- +2.303145360E-003,
- +2.265989315E-003,
- +2.222266514E-003,
- +2.172462177E-003,
- +2.117061289E-003,
- +2.056547208E-003,
- +1.991399564E-003,
- +1.922092517E-003,
- +1.849094522E-003,
- +1.772865304E-003,
- +1.693855622E-003,
- +1.612505526E-003,
- +1.529243193E-003,
- +1.444484224E-003,
- +1.358630019E-003,
- +1.272067428E-003,
- +1.185167348E-003,
- +1.098284614E-003,
- +1.011756598E-003,
- +9.259034996E-004,
- +8.410271257E-004,
- +7.574109477E-004,
- +6.753197522E-004,
- +5.949990009E-004,
- +5.166754709E-004,
- +4.405563814E-004,
- +3.668301215E-004,
- +2.956659591E-004,
- +2.272142592E-004,
- +1.616069785E-004,
- +9.895755647E-005,
- +3.936182839E-005,
- -1.710198012E-005,
- -7.037253090E-005,
- -1.204049113E-004,
- -1.671699720E-004,
- -2.106537577E-004,
- -2.508567995E-004,
- -2.877934603E-004,
- -3.214911267E-004,
- -3.519894381E-004,
- -3.793396754E-004,
- -4.036037717E-004,
- -4.248536134E-004,
- -4.431701091E-004,
- -4.586426076E-004,
- -4.713678791E-004,
- -4.814492422E-004,
- +4.889960401E-004,
- +4.941228544E-004,
- +4.969481961E-004,
- +4.975944757E-004,
- +4.961824161E-004,
- +4.928477574E-004,
- +4.877146275E-004,
- +4.809123348E-004,
- +4.725702747E-004,
- +4.628172028E-004,
- +4.517810594E-004,
- +4.395879805E-004,
- +4.263620067E-004,
- +4.122247046E-004,
- +3.972945851E-004,
- +3.816867538E-004,
- +3.655125911E-004,
- +3.488793736E-004,
- +3.318900708E-004,
- +3.146430245E-004,
- +2.972317743E-004,
- +2.797449124E-004,
- +2.622658503E-004,
- +2.448728774E-004,
- +2.276388550E-004,
- +2.106313768E-004,
- +1.939126523E-004,
- +1.775395358E-004,
- +1.615635992E-004,
- +1.460311323E-004,
- +1.309833024E-004,
- +1.164562127E-004,
- +1.024810626E-004,
- +8.908427117E-005,
- +7.628766616E-005,
- +6.410864444E-005,
- +5.256036457E-005,
- +4.165195787E-005,
- +3.138873581E-005,
- +2.177240640E-005,
- +1.280130618E-005,
- +4.470633485E-006,
- -3.227306706E-006,
- -1.030297699E-005,
- -1.676913780E-005,
- -2.264085742E-005,
- -2.793515523E-005,
- -3.267079956E-005,
- -3.686808850E-005,
- -4.054862075E-005,
- -4.373511547E-005,
- -4.645117951E-005,
- -4.872112549E-005,
- -5.056979353E-005,
- -5.202236207E-005,
- -5.310418419E-005,
- -5.384063843E-005,
- -5.425697600E-005,
- -5.437819709E-005,
- -5.422891263E-005,
- -5.383323878E-005,
- -5.321469871E-005,
- -5.239612074E-005,
- -5.139957648E-005,
- +5.024627535E-005,
- +4.895655002E-005,
- +4.754976908E-005,
- +4.604430433E-005,
- +4.445751256E-005,
- +4.280570283E-005,
- +4.110412556E-005,
- +3.936696885E-005,
- +3.760734762E-005,
- +3.583733633E-005,
- +3.406793985E-005,
- +3.230916263E-005,
- +3.056998685E-005,
- +2.885844333E-005,
- +2.718161704E-005,
- +2.554569073E-005,
- +2.395598858E-005,
- +2.241701623E-005,
- +2.093250441E-005,
- +1.950545993E-005,
- +1.813820381E-005,
- +1.683242772E-005,
- +1.558924305E-005,
- +1.440921824E-005,
- +1.329243969E-005,
- +1.223855270E-005,
- +1.124680875E-005,
- +1.031611009E-005,
- +9.445050637E-006,
- +8.631964192E-006,
- +7.874960829E-006,
- +7.171964626E-006,
- +6.520755960E-006,
- +5.918994248E-006,
- +5.364252502E-006,
- +4.854050530E-006,
- +4.385879038E-006,
- +3.957220997E-006,
- +3.565570978E-006,
- +3.208459020E-006,
- +2.883470643E-006,
- +2.588257530E-006,
- +2.320550948E-006,
- +2.078171747E-006,
- +1.859034001E-006,
- +1.661159786E-006,
- +1.482681114E-006,
- +1.321840614E-006,
- +1.176999604E-006,
- +1.046637067E-006,
- +9.293416952E-007,
- +8.238164355E-007,
- +7.288739425E-007,
- +6.434325428E-007,
- +5.665120852E-007,
- +4.972276315E-007,
- +4.347855338E-007,
- +3.784752209E-007,
- +3.276689142E-007,
- +2.818143514E-007,
- +2.404238444E-007,
- +2.030677564E-007,
- +1.693738625E-007,
- +1.390191784E-007
+-1.390191784E-007,
+-1.693738625E-007,
+-2.030677564E-007,
+-2.404238444E-007,
+-2.818143514E-007,
+-3.276689142E-007,
+-3.784752209E-007,
+-4.347855338E-007,
+-4.972276315E-007,
+-5.665120852E-007,
+-6.434325428E-007,
+-7.288739425E-007,
+-8.238164355E-007,
+-9.293416952E-007,
+-1.046637067E-006,
+-1.176999604E-006,
+-1.321840614E-006,
+-1.482681114E-006,
+-1.661159786E-006,
+-1.859034001E-006,
+-2.078171747E-006,
+-2.320550948E-006,
+-2.588257530E-006,
+-2.883470643E-006,
+-3.208459020E-006,
+-3.565570978E-006,
+-3.957220997E-006,
+-4.385879038E-006,
+-4.854050530E-006,
+-5.364252502E-006,
+-5.918994248E-006,
+-6.520755960E-006,
+-7.171964626E-006,
+-7.874960829E-006,
+-8.631964192E-006,
+-9.445050637E-006,
+-1.031611009E-005,
+-1.124680875E-005,
+-1.223855270E-005,
+-1.329243969E-005,
+-1.440921824E-005,
+-1.558924305E-005,
+-1.683242772E-005,
+-1.813820381E-005,
+-1.950545993E-005,
+-2.093250441E-005,
+-2.241701623E-005,
+-2.395598858E-005,
+-2.554569073E-005,
+-2.718161704E-005,
+-2.885844333E-005,
+-3.056998685E-005,
+-3.230916263E-005,
+-3.406793985E-005,
+-3.583733633E-005,
+-3.760734762E-005,
+-3.936696885E-005,
+-4.110412556E-005,
+-4.280570283E-005,
+-4.445751256E-005,
+-4.604430433E-005,
+-4.754976908E-005,
+-4.895655002E-005,
+-5.024627535E-005,
++5.139957648E-005,
++5.239612074E-005,
++5.321469871E-005,
++5.383323878E-005,
++5.422891263E-005,
++5.437819709E-005,
++5.425697600E-005,
++5.384063843E-005,
++5.310418419E-005,
++5.202236207E-005,
++5.056979353E-005,
++4.872112549E-005,
++4.645117951E-005,
++4.373511547E-005,
++4.054862075E-005,
++3.686808850E-005,
++3.267079956E-005,
++2.793515523E-005,
++2.264085742E-005,
++1.676913780E-005,
++1.030297699E-005,
++3.227306706E-006,
+-4.470633485E-006,
+-1.280130618E-005,
+-2.177240640E-005,
+-3.138873581E-005,
+-4.165195787E-005,
+-5.256036457E-005,
+-6.410864444E-005,
+-7.628766616E-005,
+-8.908427117E-005,
+-1.024810626E-004,
+-1.164562127E-004,
+-1.309833024E-004,
+-1.460311323E-004,
+-1.615635992E-004,
+-1.775395358E-004,
+-1.939126523E-004,
+-2.106313768E-004,
+-2.276388550E-004,
+-2.448728774E-004,
+-2.622658503E-004,
+-2.797449124E-004,
+-2.972317743E-004,
+-3.146430245E-004,
+-3.318900708E-004,
+-3.488793736E-004,
+-3.655125911E-004,
+-3.816867538E-004,
+-3.972945851E-004,
+-4.122247046E-004,
+-4.263620067E-004,
+-4.395879805E-004,
+-4.517810594E-004,
+-4.628172028E-004,
+-4.725702747E-004,
+-4.809123348E-004,
+-4.877146275E-004,
+-4.928477574E-004,
+-4.961824161E-004,
+-4.975944757E-004,
+-4.969481961E-004,
+-4.941228544E-004,
+-4.889960401E-004,
++4.814492422E-004,
++4.713678791E-004,
++4.586426076E-004,
++4.431701091E-004,
++4.248536134E-004,
++4.036037717E-004,
++3.793396754E-004,
++3.519894381E-004,
++3.214911267E-004,
++2.877934603E-004,
++2.508567995E-004,
++2.106537577E-004,
++1.671699720E-004,
++1.204049113E-004,
++7.037253090E-005,
++1.710198012E-005,
+-3.936182839E-005,
+-9.895755647E-005,
+-1.616069785E-004,
+-2.272142592E-004,
+-2.956659591E-004,
+-3.668301215E-004,
+-4.405563814E-004,
+-5.166754709E-004,
+-5.949990009E-004,
+-6.753197522E-004,
+-7.574109477E-004,
+-8.410271257E-004,
+-9.259034996E-004,
+-1.011756598E-003,
+-1.098284614E-003,
+-1.185167348E-003,
+-1.272067428E-003,
+-1.358630019E-003,
+-1.444484224E-003,
+-1.529243193E-003,
+-1.612505526E-003,
+-1.693855622E-003,
+-1.772865304E-003,
+-1.849094522E-003,
+-1.922092517E-003,
+-1.991399564E-003,
+-2.056547208E-003,
+-2.117061289E-003,
+-2.172462177E-003,
+-2.222266514E-003,
+-2.265989315E-003,
+-2.303145360E-003,
+-2.333251061E-003,
+-2.355825622E-003,
+-2.370394068E-003,
+-2.376487479E-003,
+-2.373647178E-003,
+-2.361423569E-003,
+-2.339380793E-003,
+-2.307097195E-003,
+-2.264167881E-003,
+-2.210205887E-003,
+-2.144844970E-003,
+-2.067740774E-003,
+-1.978572691E-003,
+-1.877046190E-003,
+-1.762894331E-003,
+-1.635878929E-003,
++1.495792647E-003,
++1.342460280E-003,
++1.175740734E-003,
++9.955273708E-004,
++8.017504588E-004,
++5.943773431E-004,
++3.734139318E-004,
++1.389056415E-004,
+-1.090620208E-004,
+-3.703625989E-004,
+-6.448282511E-004,
+-9.322494152E-004,
+-1.232374110E-003,
+-1.544908970E-003,
+-1.869517611E-003,
+-2.205822384E-003,
+-2.553403843E-003,
+-2.911801683E-003,
+-3.280514618E-003,
+-3.659002949E-003,
+-4.046686925E-003,
+-4.442950245E-003,
+-4.847140983E-003,
+-5.258570891E-003,
+-5.676518660E-003,
+-6.100233644E-003,
+-6.528933067E-003,
+-6.961807609E-003,
+-7.398022339E-003,
+-7.836719044E-003,
+-8.277016692E-003,
+-8.718019351E-003,
+-9.158811532E-003,
+-9.598465636E-003,
+-1.003604382E-002,
+-1.047059800E-002,
+-1.090117730E-002,
+-1.132682897E-002,
+-1.174659748E-002,
+-1.215953380E-002,
+-1.256469358E-002,
+-1.296114177E-002,
+-1.334795821E-002,
+-1.372423489E-002,
+-1.408908330E-002,
+-1.444163360E-002,
+-1.478104480E-002,
+-1.510649733E-002,
+-1.541720331E-002,
+-1.571240649E-002,
+-1.599138230E-002,
+-1.625344716E-002,
+-1.649795473E-002,
+-1.672429405E-002,
+-1.693190821E-002,
+-1.712027565E-002,
+-1.728892699E-002,
+-1.743743755E-002,
+-1.756543480E-002,
+-1.767260395E-002,
+-1.775865816E-002,
+-1.782339066E-002,
+-1.786663756E-002,
+-1.788828894E-002,
++1.788828894E-002,
++1.786663756E-002,
++1.782339066E-002,
++1.775865816E-002,
++1.767260395E-002,
++1.756543480E-002,
++1.743743755E-002,
++1.728892699E-002,
++1.712027565E-002,
++1.693190821E-002,
++1.672429405E-002,
++1.649795473E-002,
++1.625344716E-002,
++1.599138230E-002,
++1.571240649E-002,
++1.541720331E-002,
++1.510649733E-002,
++1.478104480E-002,
++1.444163360E-002,
++1.408908330E-002,
++1.372423489E-002,
++1.334795821E-002,
++1.296114177E-002,
++1.256469358E-002,
++1.215953380E-002,
++1.174659748E-002,
++1.132682897E-002,
++1.090117730E-002,
++1.047059800E-002,
++1.003604382E-002,
++9.598465636E-003,
++9.158811532E-003,
++8.718019351E-003,
++8.277016692E-003,
++7.836719044E-003,
++7.398022339E-003,
++6.961807609E-003,
++6.528933067E-003,
++6.100233644E-003,
++5.676518660E-003,
++5.258570891E-003,
++4.847140983E-003,
++4.442950245E-003,
++4.046686925E-003,
++3.659002949E-003,
++3.280514618E-003,
++2.911801683E-003,
++2.553403843E-003,
++2.205822384E-003,
++1.869517611E-003,
++1.544908970E-003,
++1.232374110E-003,
++9.322494152E-004,
++6.448282511E-004,
++3.703625989E-004,
++1.090620208E-004,
+-1.389056415E-004,
+-3.734139318E-004,
+-5.943773431E-004,
+-8.017504588E-004,
+-9.955273708E-004,
+-1.175740734E-003,
+-1.342460280E-003,
+-1.495792647E-003,
++1.635878929E-003,
++1.762894331E-003,
++1.877046190E-003,
++1.978572691E-003,
++2.067740774E-003,
++2.144844970E-003,
++2.210205887E-003,
++2.264167881E-003,
++2.307097195E-003,
++2.339380793E-003,
++2.361423569E-003,
++2.373647178E-003,
++2.376487479E-003,
++2.370394068E-003,
++2.355825622E-003,
++2.333251061E-003,
++2.303145360E-003,
++2.265989315E-003,
++2.222266514E-003,
++2.172462177E-003,
++2.117061289E-003,
++2.056547208E-003,
++1.991399564E-003,
++1.922092517E-003,
++1.849094522E-003,
++1.772865304E-003,
++1.693855622E-003,
++1.612505526E-003,
++1.529243193E-003,
++1.444484224E-003,
++1.358630019E-003,
++1.272067428E-003,
++1.185167348E-003,
++1.098284614E-003,
++1.011756598E-003,
++9.259034996E-004,
++8.410271257E-004,
++7.574109477E-004,
++6.753197522E-004,
++5.949990009E-004,
++5.166754709E-004,
++4.405563814E-004,
++3.668301215E-004,
++2.956659591E-004,
++2.272142592E-004,
++1.616069785E-004,
++9.895755647E-005,
++3.936182839E-005,
+-1.710198012E-005,
+-7.037253090E-005,
+-1.204049113E-004,
+-1.671699720E-004,
+-2.106537577E-004,
+-2.508567995E-004,
+-2.877934603E-004,
+-3.214911267E-004,
+-3.519894381E-004,
+-3.793396754E-004,
+-4.036037717E-004,
+-4.248536134E-004,
+-4.431701091E-004,
+-4.586426076E-004,
+-4.713678791E-004,
+-4.814492422E-004,
++4.889960401E-004,
++4.941228544E-004,
++4.969481961E-004,
++4.975944757E-004,
++4.961824161E-004,
++4.928477574E-004,
++4.877146275E-004,
++4.809123348E-004,
++4.725702747E-004,
++4.628172028E-004,
++4.517810594E-004,
++4.395879805E-004,
++4.263620067E-004,
++4.122247046E-004,
++3.972945851E-004,
++3.816867538E-004,
++3.655125911E-004,
++3.488793736E-004,
++3.318900708E-004,
++3.146430245E-004,
++2.972317743E-004,
++2.797449124E-004,
++2.622658503E-004,
++2.448728774E-004,
++2.276388550E-004,
++2.106313768E-004,
++1.939126523E-004,
++1.775395358E-004,
++1.615635992E-004,
++1.460311323E-004,
++1.309833024E-004,
++1.164562127E-004,
++1.024810626E-004,
++8.908427117E-005,
++7.628766616E-005,
++6.410864444E-005,
++5.256036457E-005,
++4.165195787E-005,
++3.138873581E-005,
++2.177240640E-005,
++1.280130618E-005,
++4.470633485E-006,
+-3.227306706E-006,
+-1.030297699E-005,
+-1.676913780E-005,
+-2.264085742E-005,
+-2.793515523E-005,
+-3.267079956E-005,
+-3.686808850E-005,
+-4.054862075E-005,
+-4.373511547E-005,
+-4.645117951E-005,
+-4.872112549E-005,
+-5.056979353E-005,
+-5.202236207E-005,
+-5.310418419E-005,
+-5.384063843E-005,
+-5.425697600E-005,
+-5.437819709E-005,
+-5.422891263E-005,
+-5.383323878E-005,
+-5.321469871E-005,
+-5.239612074E-005,
+-5.139957648E-005,
++5.024627535E-005,
++4.895655002E-005,
++4.754976908E-005,
++4.604430433E-005,
++4.445751256E-005,
++4.280570283E-005,
++4.110412556E-005,
++3.936696885E-005,
++3.760734762E-005,
++3.583733633E-005,
++3.406793985E-005,
++3.230916263E-005,
++3.056998685E-005,
++2.885844333E-005,
++2.718161704E-005,
++2.554569073E-005,
++2.395598858E-005,
++2.241701623E-005,
++2.093250441E-005,
++1.950545993E-005,
++1.813820381E-005,
++1.683242772E-005,
++1.558924305E-005,
++1.440921824E-005,
++1.329243969E-005,
++1.223855270E-005,
++1.124680875E-005,
++1.031611009E-005,
++9.445050637E-006,
++8.631964192E-006,
++7.874960829E-006,
++7.171964626E-006,
++6.520755960E-006,
++5.918994248E-006,
++5.364252502E-006,
++4.854050530E-006,
++4.385879038E-006,
++3.957220997E-006,
++3.565570978E-006,
++3.208459020E-006,
++2.883470643E-006,
++2.588257530E-006,
++2.320550948E-006,
++2.078171747E-006,
++1.859034001E-006,
++1.661159786E-006,
++1.482681114E-006,
++1.321840614E-006,
++1.176999604E-006,
++1.046637067E-006,
++9.293416952E-007,
++8.238164355E-007,
++7.288739425E-007,
++6.434325428E-007,
++5.665120852E-007,
++4.972276315E-007,
++4.347855338E-007,
++3.784752209E-007,
++3.276689142E-007,
++2.818143514E-007,
++2.404238444E-007,
++2.030677564E-007,
++1.693738625E-007,
++1.390191784E-007
};
double lfe_fir_64[] =
{
- 2.6584343868307770E-004,
- 8.1793652498163280E-005,
- 9.4393239123746760E-005,
- 1.0821702744578940E-004,
- 1.2333714403212070E-004,
- 1.3974857574794440E-004,
- 1.5759580128360540E-004,
- 1.7699223826639360E-004,
- 1.9817386055365200E-004,
- 2.2118473134469240E-004,
- 2.4602311896160240E-004,
- 2.7261159266345200E-004,
- 3.0138631700538100E-004,
- 3.3283955417573450E-004,
- 3.6589911906048660E-004,
- 4.0182814700528980E-004,
- 4.4018754852004350E-004,
- 4.8127761692740020E-004,
- 5.2524596685543660E-004,
- 5.7215924607589840E-004,
- 6.2221300322562460E-004,
- 6.7555153509601950E-004,
- 7.3241489008069040E-004,
- 7.9285167157649990E-004,
- 8.5701106581836940E-004,
- 9.2511920956894760E-004,
- 9.9747709464281800E-004,
- 1.0739302961155770E-003,
- 1.1550235794857140E-003,
- 1.2406768510118130E-003,
- 1.3312589144334200E-003,
- 1.4268938684836030E-003,
- 1.5278297942131760E-003,
- 1.6342115122824910E-003,
- 1.7463274998590350E-003,
- 1.8643775256350640E-003,
- 1.9886041991412640E-003,
- 2.1191518753767010E-003,
- 2.2563596721738580E-003,
- 2.4004334118217230E-003,
- 2.5515670422464610E-003,
- 2.7100932784378530E-003,
- 2.8761904686689380E-003,
- 3.0501529108732940E-003,
- 3.2322725746780640E-003,
- 3.4227769356220960E-003,
- 3.6219672765582800E-003,
- 3.8300913292914630E-003,
- 4.0474990382790560E-003,
- 4.2744171805679800E-003,
- 4.5111598446965220E-003,
- 4.7580120153725150E-003,
- 5.0153112970292570E-003,
- 5.2832840010523800E-003,
- 5.5623454973101620E-003,
- 5.8526843786239620E-003,
- 6.1547122895717620E-003,
- 6.4686913974583150E-003,
- 6.7949919030070300E-003,
- 7.1338820271193980E-003,
- 7.4857366271317010E-003,
- 7.8508658334612850E-003,
- 8.2296309992671010E-003,
- 8.6223213002085690E-003,
- 9.0293306857347480E-003,
- 9.4509534537792200E-003,
- 9.8875602707266800E-003,
- 1.0339494794607160E-002,
- 1.0807084850966930E-002,
- 1.1290682479739190E-002,
- 1.1790650896728040E-002,
- 1.2307321652770040E-002,
- 1.2841059826314450E-002,
- 1.3392185792326930E-002,
- 1.3961089774966240E-002,
- 1.4548087492585180E-002,
- 1.5153550542891020E-002,
- 1.5777811408042910E-002,
- 1.6421230509877200E-002,
- 1.7084129154682160E-002,
- 1.7766902223229410E-002,
- 1.8469827249646190E-002,
- 1.9193304702639580E-002,
- 1.9937623292207720E-002,
- 2.0703161135315900E-002,
- 2.1490212529897690E-002,
- 2.2299138829112050E-002,
- 2.3130238056182860E-002,
- 2.3983856663107870E-002,
- 2.4860285222530360E-002,
- 2.5759860873222350E-002,
- 2.6682861149311060E-002,
- 2.7629608288407320E-002,
- 2.8600392863154410E-002,
- 2.9595496132969860E-002,
- 3.0615204945206640E-002,
- 3.1659796833992000E-002,
- 3.2729536294937140E-002,
- 3.3824689686298370E-002,
- 3.4945506602525710E-002,
- 3.6092240363359450E-002,
- 3.7265110760927200E-002,
- 3.8464374840259550E-002,
- 3.9690230041742320E-002,
- 4.0942888706922530E-002,
- 4.2222552001476290E-002,
- 4.3529424816370010E-002,
- 4.4863656163215640E-002,
- 4.6225443482398990E-002,
- 4.7614917159080510E-002,
- 4.9032241106033330E-002,
- 5.0477534532547000E-002,
- 5.1950931549072270E-002,
- 5.3452525287866590E-002,
- 5.4982420057058330E-002,
- 5.6540694087743760E-002,
- 5.8127421885728840E-002,
- 5.9742655605077740E-002,
- 6.1386436223983760E-002,
- 6.3058786094188690E-002,
- 6.4759708940982820E-002,
- 6.6489234566688540E-002,
- 6.8247318267822270E-002,
- 7.0033922791481020E-002,
- 7.1849010884761810E-002,
- 7.3692522943019870E-002,
- 7.5564362108707430E-002,
- 7.7464438974857330E-002,
- 7.9392634332180020E-002,
- 8.1348828971385960E-002,
- 8.3332858979702000E-002,
- 8.5344567894935610E-002,
- 8.7383769452571870E-002,
- 8.9450262486934660E-002,
- 9.1543838381767280E-002,
- 9.3664251267910000E-002,
- 9.5811240375041960E-002,
- 9.7984537482261660E-002,
- 1.0018386691808700E-001,
- 1.0240890830755230E-001,
- 1.0465932637453080E-001,
- 1.0693479329347610E-001,
- 1.0923493653535840E-001,
- 1.1155936866998670E-001,
- 1.1390769481658940E-001,
- 1.1627949774265290E-001,
- 1.1867434531450270E-001,
- 1.2109176814556120E-001,
- 1.2353130429983140E-001,
- 1.2599244713783260E-001,
- 1.2847468256950380E-001,
- 1.3097748160362240E-001,
- 1.3350030779838560E-001,
- 1.3604259490966800E-001,
- 1.3860376179218290E-001,
- 1.4118319749832150E-001,
- 1.4378026127815250E-001,
- 1.4639437198638920E-001,
- 1.4902481436729430E-001,
- 1.5167096257209780E-001,
- 1.5433208644390100E-001,
- 1.5700751543045040E-001,
- 1.5969651937484740E-001,
- 1.6239835321903230E-001,
- 1.6511227190494540E-001,
- 1.6783750057220460E-001,
- 1.7057323455810550E-001,
- 1.7331869900226590E-001,
- 1.7607308924198150E-001,
- 1.7883554100990300E-001,
- 1.8160524964332580E-001,
- 1.8438133597373960E-001,
- 1.8716295063495640E-001,
- 1.8994916975498200E-001,
- 1.9273911416530610E-001,
- 1.9553191959857940E-001,
- 1.9832661747932440E-001,
- 2.0112232863903040E-001,
- 2.0391805469989780E-001,
- 2.0671287178993220E-001,
- 2.0950584113597870E-001,
- 2.1229594945907590E-001,
- 2.1508227288722990E-001,
- 2.1786379814147950E-001,
- 2.2063951194286350E-001,
- 2.2340846061706540E-001,
- 2.2616961598396300E-001,
- 2.2892196476459500E-001,
- 2.3166447877883910E-001,
- 2.3439615964889520E-001,
- 2.3711597919464110E-001,
- 2.3982289433479310E-001,
- 2.4251587688922880E-001,
- 2.4519388377666480E-001,
- 2.4785590171813960E-001,
- 2.5050088763237000E-001,
- 2.5312781333923340E-001,
- 2.5573557615280150E-001,
- 2.5832322239875800E-001,
- 2.6088967919349670E-001,
- 2.6343390345573420E-001,
- 2.6595494151115420E-001,
- 2.6845166087150580E-001,
- 2.7092313766479490E-001,
- 2.7336826920509340E-001,
- 2.7578607201576240E-001,
- 2.7817553281784060E-001,
- 2.8053569793701170E-001,
- 2.8286558389663700E-001,
- 2.8516408801078800E-001,
- 2.8743034601211550E-001,
- 2.8966337442398070E-001,
- 2.9186218976974480E-001,
- 2.9402589797973640E-001,
- 2.9615348577499390E-001,
- 2.9824411869049070E-001,
- 3.0029675364494320E-001,
- 3.0231067538261420E-001,
- 3.0428490042686460E-001,
- 3.0621853470802300E-001,
- 3.0811080336570740E-001,
- 3.0996081233024600E-001,
- 3.1176769733428960E-001,
- 3.1353080272674560E-001,
- 3.1524917483329780E-001,
- 3.1692212820053100E-001,
- 3.1854888796806340E-001,
- 3.2012873888015740E-001,
- 3.2166096568107600E-001,
- 3.2314485311508180E-001,
- 3.2457971572875980E-001,
- 3.2596495747566220E-001,
- 3.2729989290237420E-001,
- 3.2858389616012580E-001,
- 3.2981643080711360E-001,
- 3.3099696040153500E-001,
- 3.3212485909461980E-001,
- 3.3319962024688720E-001,
- 3.3422079682350160E-001,
- 3.3518791198730470E-001,
- 3.3610042929649360E-001,
- 3.3695802092552180E-001,
- 3.3776029944419860E-001,
- 3.3850681781768800E-001,
- 3.3919724822044380E-001,
- 3.3983129262924200E-001,
- 3.4040865302085880E-001,
- 3.4092903137207030E-001,
- 3.4139221906661980E-001,
- 3.4179797768592840E-001,
- 3.4214612841606140E-001,
- 3.4243649244308470E-001,
- 3.4266895055770880E-001,
- 3.4284341335296630E-001,
- 3.4295973181724550E-001,
- 3.4301793575286860E-001,
- 3.4301793575286860E-001,
- 3.4295973181724550E-001,
- 3.4284341335296630E-001,
- 3.4266895055770880E-001,
- 3.4243649244308470E-001,
- 3.4214612841606140E-001,
- 3.4179797768592840E-001,
- 3.4139221906661980E-001,
- 3.4092903137207030E-001,
- 3.4040865302085880E-001,
- 3.3983129262924200E-001,
- 3.3919724822044380E-001,
- 3.3850681781768800E-001,
- 3.3776029944419860E-001,
- 3.3695802092552180E-001,
- 3.3610042929649360E-001,
- 3.3518791198730470E-001,
- 3.3422079682350160E-001,
- 3.3319962024688720E-001,
- 3.3212485909461980E-001,
- 3.3099696040153500E-001,
- 3.2981643080711360E-001,
- 3.2858389616012580E-001,
- 3.2729989290237420E-001,
- 3.2596495747566220E-001,
- 3.2457971572875980E-001,
- 3.2314485311508180E-001,
- 3.2166096568107600E-001,
- 3.2012873888015740E-001,
- 3.1854888796806340E-001,
- 3.1692212820053100E-001,
- 3.1524917483329780E-001,
- 3.1353080272674560E-001,
- 3.1176769733428960E-001,
- 3.0996081233024600E-001,
- 3.0811080336570740E-001,
- 3.0621853470802300E-001,
- 3.0428490042686460E-001,
- 3.0231067538261420E-001,
- 3.0029675364494320E-001,
- 2.9824411869049070E-001,
- 2.9615348577499390E-001,
- 2.9402589797973640E-001,
- 2.9186218976974480E-001,
- 2.8966337442398070E-001,
- 2.8743034601211550E-001,
- 2.8516408801078800E-001,
- 2.8286558389663700E-001,
- 2.8053569793701170E-001,
- 2.7817553281784060E-001,
- 2.7578607201576240E-001,
- 2.7336826920509340E-001,
- 2.7092313766479490E-001,
- 2.6845166087150580E-001,
- 2.6595494151115420E-001,
- 2.6343390345573420E-001,
- 2.6088967919349670E-001,
- 2.5832322239875800E-001,
- 2.5573557615280150E-001,
- 2.5312781333923340E-001,
- 2.5050088763237000E-001,
- 2.4785590171813960E-001,
- 2.4519388377666480E-001,
- 2.4251587688922880E-001,
- 2.3982289433479310E-001,
- 2.3711597919464110E-001,
- 2.3439615964889520E-001,
- 2.3166447877883910E-001,
- 2.2892196476459500E-001,
- 2.2616961598396300E-001,
- 2.2340846061706540E-001,
- 2.2063951194286350E-001,
- 2.1786379814147950E-001,
- 2.1508227288722990E-001,
- 2.1229594945907590E-001,
- 2.0950584113597870E-001,
- 2.0671287178993220E-001,
- 2.0391805469989780E-001,
- 2.0112232863903040E-001,
- 1.9832661747932440E-001,
- 1.9553191959857940E-001,
- 1.9273911416530610E-001,
- 1.8994916975498200E-001,
- 1.8716295063495640E-001,
- 1.8438133597373960E-001,
- 1.8160524964332580E-001,
- 1.7883554100990300E-001,
- 1.7607308924198150E-001,
- 1.7331869900226590E-001,
- 1.7057323455810550E-001,
- 1.6783750057220460E-001,
- 1.6511227190494540E-001,
- 1.6239835321903230E-001,
- 1.5969651937484740E-001,
- 1.5700751543045040E-001,
- 1.5433208644390100E-001,
- 1.5167096257209780E-001,
- 1.4902481436729430E-001,
- 1.4639437198638920E-001,
- 1.4378026127815250E-001,
- 1.4118319749832150E-001,
- 1.3860376179218290E-001,
- 1.3604259490966800E-001,
- 1.3350030779838560E-001,
- 1.3097748160362240E-001,
- 1.2847468256950380E-001,
- 1.2599244713783260E-001,
- 1.2353130429983140E-001,
- 1.2109176814556120E-001,
- 1.1867434531450270E-001,
- 1.1627949774265290E-001,
- 1.1390769481658940E-001,
- 1.1155936866998670E-001,
- 1.0923493653535840E-001,
- 1.0693479329347610E-001,
- 1.0465932637453080E-001,
- 1.0240890830755230E-001,
- 1.0018386691808700E-001,
- 9.7984537482261660E-002,
- 9.5811240375041960E-002,
- 9.3664251267910000E-002,
- 9.1543838381767280E-002,
- 8.9450262486934660E-002,
- 8.7383769452571870E-002,
- 8.5344567894935610E-002,
- 8.3332858979702000E-002,
- 8.1348828971385960E-002,
- 7.9392634332180020E-002,
- 7.7464438974857330E-002,
- 7.5564362108707430E-002,
- 7.3692522943019870E-002,
- 7.1849010884761810E-002,
- 7.0033922791481020E-002,
- 6.8247318267822270E-002,
- 6.6489234566688540E-002,
- 6.4759708940982820E-002,
- 6.3058786094188690E-002,
- 6.1386436223983760E-002,
- 5.9742655605077740E-002,
- 5.8127421885728840E-002,
- 5.6540694087743760E-002,
- 5.4982420057058330E-002,
- 5.3452525287866590E-002,
- 5.1950931549072270E-002,
- 5.0477534532547000E-002,
- 4.9032241106033330E-002,
- 4.7614917159080510E-002,
- 4.6225443482398990E-002,
- 4.4863656163215640E-002,
- 4.3529424816370010E-002,
- 4.2222552001476290E-002,
- 4.0942888706922530E-002,
- 3.9690230041742320E-002,
- 3.8464374840259550E-002,
- 3.7265110760927200E-002,
- 3.6092240363359450E-002,
- 3.4945506602525710E-002,
- 3.3824689686298370E-002,
- 3.2729536294937140E-002,
- 3.1659796833992000E-002,
- 3.0615204945206640E-002,
- 2.9595496132969860E-002,
- 2.8600392863154410E-002,
- 2.7629608288407320E-002,
- 2.6682861149311060E-002,
- 2.5759860873222350E-002,
- 2.4860285222530360E-002,
- 2.3983856663107870E-002,
- 2.3130238056182860E-002,
- 2.2299138829112050E-002,
- 2.1490212529897690E-002,
- 2.0703161135315900E-002,
- 1.9937623292207720E-002,
- 1.9193304702639580E-002,
- 1.8469827249646190E-002,
- 1.7766902223229410E-002,
- 1.7084129154682160E-002,
- 1.6421230509877200E-002,
- 1.5777811408042910E-002,
- 1.5153550542891020E-002,
- 1.4548087492585180E-002,
- 1.3961089774966240E-002,
- 1.3392185792326930E-002,
- 1.2841059826314450E-002,
- 1.2307321652770040E-002,
- 1.1790650896728040E-002,
- 1.1290682479739190E-002,
- 1.0807084850966930E-002,
- 1.0339494794607160E-002,
- 9.8875602707266800E-003,
- 9.4509534537792200E-003,
- 9.0293306857347480E-003,
- 8.6223213002085690E-003,
- 8.2296309992671010E-003,
- 7.8508658334612850E-003,
- 7.4857366271317010E-003,
- 7.1338820271193980E-003,
- 6.7949919030070300E-003,
- 6.4686913974583150E-003,
- 6.1547122895717620E-003,
- 5.8526843786239620E-003,
- 5.5623454973101620E-003,
- 5.2832840010523800E-003,
- 5.0153112970292570E-003,
- 4.7580120153725150E-003,
- 4.5111598446965220E-003,
- 4.2744171805679800E-003,
- 4.0474990382790560E-003,
- 3.8300913292914630E-003,
- 3.6219672765582800E-003,
- 3.4227769356220960E-003,
- 3.2322725746780640E-003,
- 3.0501529108732940E-003,
- 2.8761904686689380E-003,
- 2.7100932784378530E-003,
- 2.5515670422464610E-003,
- 2.4004334118217230E-003,
- 2.2563596721738580E-003,
- 2.1191518753767010E-003,
- 1.9886041991412640E-003,
- 1.8643775256350640E-003,
- 1.7463274998590350E-003,
- 1.6342115122824910E-003,
- 1.5278297942131760E-003,
- 1.4268938684836030E-003,
- 1.3312589144334200E-003,
- 1.2406768510118130E-003,
- 1.1550235794857140E-003,
- 1.0739302961155770E-003,
- 9.9747709464281800E-004,
- 9.2511920956894760E-004,
- 8.5701106581836940E-004,
- 7.9285167157649990E-004,
- 7.3241489008069040E-004,
- 6.7555153509601950E-004,
- 6.2221300322562460E-004,
- 5.7215924607589840E-004,
- 5.2524596685543660E-004,
- 4.8127761692740020E-004,
- 4.4018754852004350E-004,
- 4.0182814700528980E-004,
- 3.6589911906048660E-004,
- 3.3283955417573450E-004,
- 3.0138631700538100E-004,
- 2.7261159266345200E-004,
- 2.4602311896160240E-004,
- 2.2118473134469240E-004,
- 1.9817386055365200E-004,
- 1.7699223826639360E-004,
- 1.5759580128360540E-004,
- 1.3974857574794440E-004,
- 1.2333714403212070E-004,
- 1.0821702744578940E-004,
- 9.4393239123746760E-005,
- 8.1793652498163280E-005,
- 2.6584343868307770E-004
+2.6584343868307770E-004,
+8.1793652498163280E-005,
+9.4393239123746760E-005,
+1.0821702744578940E-004,
+1.2333714403212070E-004,
+1.3974857574794440E-004,
+1.5759580128360540E-004,
+1.7699223826639360E-004,
+1.9817386055365200E-004,
+2.2118473134469240E-004,
+2.4602311896160240E-004,
+2.7261159266345200E-004,
+3.0138631700538100E-004,
+3.3283955417573450E-004,
+3.6589911906048660E-004,
+4.0182814700528980E-004,
+4.4018754852004350E-004,
+4.8127761692740020E-004,
+5.2524596685543660E-004,
+5.7215924607589840E-004,
+6.2221300322562460E-004,
+6.7555153509601950E-004,
+7.3241489008069040E-004,
+7.9285167157649990E-004,
+8.5701106581836940E-004,
+9.2511920956894760E-004,
+9.9747709464281800E-004,
+1.0739302961155770E-003,
+1.1550235794857140E-003,
+1.2406768510118130E-003,
+1.3312589144334200E-003,
+1.4268938684836030E-003,
+1.5278297942131760E-003,
+1.6342115122824910E-003,
+1.7463274998590350E-003,
+1.8643775256350640E-003,
+1.9886041991412640E-003,
+2.1191518753767010E-003,
+2.2563596721738580E-003,
+2.4004334118217230E-003,
+2.5515670422464610E-003,
+2.7100932784378530E-003,
+2.8761904686689380E-003,
+3.0501529108732940E-003,
+3.2322725746780640E-003,
+3.4227769356220960E-003,
+3.6219672765582800E-003,
+3.8300913292914630E-003,
+4.0474990382790560E-003,
+4.2744171805679800E-003,
+4.5111598446965220E-003,
+4.7580120153725150E-003,
+5.0153112970292570E-003,
+5.2832840010523800E-003,
+5.5623454973101620E-003,
+5.8526843786239620E-003,
+6.1547122895717620E-003,
+6.4686913974583150E-003,
+6.7949919030070300E-003,
+7.1338820271193980E-003,
+7.4857366271317010E-003,
+7.8508658334612850E-003,
+8.2296309992671010E-003,
+8.6223213002085690E-003,
+9.0293306857347480E-003,
+9.4509534537792200E-003,
+9.8875602707266800E-003,
+1.0339494794607160E-002,
+1.0807084850966930E-002,
+1.1290682479739190E-002,
+1.1790650896728040E-002,
+1.2307321652770040E-002,
+1.2841059826314450E-002,
+1.3392185792326930E-002,
+1.3961089774966240E-002,
+1.4548087492585180E-002,
+1.5153550542891020E-002,
+1.5777811408042910E-002,
+1.6421230509877200E-002,
+1.7084129154682160E-002,
+1.7766902223229410E-002,
+1.8469827249646190E-002,
+1.9193304702639580E-002,
+1.9937623292207720E-002,
+2.0703161135315900E-002,
+2.1490212529897690E-002,
+2.2299138829112050E-002,
+2.3130238056182860E-002,
+2.3983856663107870E-002,
+2.4860285222530360E-002,
+2.5759860873222350E-002,
+2.6682861149311060E-002,
+2.7629608288407320E-002,
+2.8600392863154410E-002,
+2.9595496132969860E-002,
+3.0615204945206640E-002,
+3.1659796833992000E-002,
+3.2729536294937140E-002,
+3.3824689686298370E-002,
+3.4945506602525710E-002,
+3.6092240363359450E-002,
+3.7265110760927200E-002,
+3.8464374840259550E-002,
+3.9690230041742320E-002,
+4.0942888706922530E-002,
+4.2222552001476290E-002,
+4.3529424816370010E-002,
+4.4863656163215640E-002,
+4.6225443482398990E-002,
+4.7614917159080510E-002,
+4.9032241106033330E-002,
+5.0477534532547000E-002,
+5.1950931549072270E-002,
+5.3452525287866590E-002,
+5.4982420057058330E-002,
+5.6540694087743760E-002,
+5.8127421885728840E-002,
+5.9742655605077740E-002,
+6.1386436223983760E-002,
+6.3058786094188690E-002,
+6.4759708940982820E-002,
+6.6489234566688540E-002,
+6.8247318267822270E-002,
+7.0033922791481020E-002,
+7.1849010884761810E-002,
+7.3692522943019870E-002,
+7.5564362108707430E-002,
+7.7464438974857330E-002,
+7.9392634332180020E-002,
+8.1348828971385960E-002,
+8.3332858979702000E-002,
+8.5344567894935610E-002,
+8.7383769452571870E-002,
+8.9450262486934660E-002,
+9.1543838381767280E-002,
+9.3664251267910000E-002,
+9.5811240375041960E-002,
+9.7984537482261660E-002,
+1.0018386691808700E-001,
+1.0240890830755230E-001,
+1.0465932637453080E-001,
+1.0693479329347610E-001,
+1.0923493653535840E-001,
+1.1155936866998670E-001,
+1.1390769481658940E-001,
+1.1627949774265290E-001,
+1.1867434531450270E-001,
+1.2109176814556120E-001,
+1.2353130429983140E-001,
+1.2599244713783260E-001,
+1.2847468256950380E-001,
+1.3097748160362240E-001,
+1.3350030779838560E-001,
+1.3604259490966800E-001,
+1.3860376179218290E-001,
+1.4118319749832150E-001,
+1.4378026127815250E-001,
+1.4639437198638920E-001,
+1.4902481436729430E-001,
+1.5167096257209780E-001,
+1.5433208644390100E-001,
+1.5700751543045040E-001,
+1.5969651937484740E-001,
+1.6239835321903230E-001,
+1.6511227190494540E-001,
+1.6783750057220460E-001,
+1.7057323455810550E-001,
+1.7331869900226590E-001,
+1.7607308924198150E-001,
+1.7883554100990300E-001,
+1.8160524964332580E-001,
+1.8438133597373960E-001,
+1.8716295063495640E-001,
+1.8994916975498200E-001,
+1.9273911416530610E-001,
+1.9553191959857940E-001,
+1.9832661747932440E-001,
+2.0112232863903040E-001,
+2.0391805469989780E-001,
+2.0671287178993220E-001,
+2.0950584113597870E-001,
+2.1229594945907590E-001,
+2.1508227288722990E-001,
+2.1786379814147950E-001,
+2.2063951194286350E-001,
+2.2340846061706540E-001,
+2.2616961598396300E-001,
+2.2892196476459500E-001,
+2.3166447877883910E-001,
+2.3439615964889520E-001,
+2.3711597919464110E-001,
+2.3982289433479310E-001,
+2.4251587688922880E-001,
+2.4519388377666480E-001,
+2.4785590171813960E-001,
+2.5050088763237000E-001,
+2.5312781333923340E-001,
+2.5573557615280150E-001,
+2.5832322239875800E-001,
+2.6088967919349670E-001,
+2.6343390345573420E-001,
+2.6595494151115420E-001,
+2.6845166087150580E-001,
+2.7092313766479490E-001,
+2.7336826920509340E-001,
+2.7578607201576240E-001,
+2.7817553281784060E-001,
+2.8053569793701170E-001,
+2.8286558389663700E-001,
+2.8516408801078800E-001,
+2.8743034601211550E-001,
+2.8966337442398070E-001,
+2.9186218976974480E-001,
+2.9402589797973640E-001,
+2.9615348577499390E-001,
+2.9824411869049070E-001,
+3.0029675364494320E-001,
+3.0231067538261420E-001,
+3.0428490042686460E-001,
+3.0621853470802300E-001,
+3.0811080336570740E-001,
+3.0996081233024600E-001,
+3.1176769733428960E-001,
+3.1353080272674560E-001,
+3.1524917483329780E-001,
+3.1692212820053100E-001,
+3.1854888796806340E-001,
+3.2012873888015740E-001,
+3.2166096568107600E-001,
+3.2314485311508180E-001,
+3.2457971572875980E-001,
+3.2596495747566220E-001,
+3.2729989290237420E-001,
+3.2858389616012580E-001,
+3.2981643080711360E-001,
+3.3099696040153500E-001,
+3.3212485909461980E-001,
+3.3319962024688720E-001,
+3.3422079682350160E-001,
+3.3518791198730470E-001,
+3.3610042929649360E-001,
+3.3695802092552180E-001,
+3.3776029944419860E-001,
+3.3850681781768800E-001,
+3.3919724822044380E-001,
+3.3983129262924200E-001,
+3.4040865302085880E-001,
+3.4092903137207030E-001,
+3.4139221906661980E-001,
+3.4179797768592840E-001,
+3.4214612841606140E-001,
+3.4243649244308470E-001,
+3.4266895055770880E-001,
+3.4284341335296630E-001,
+3.4295973181724550E-001,
+3.4301793575286860E-001,
+3.4301793575286860E-001,
+3.4295973181724550E-001,
+3.4284341335296630E-001,
+3.4266895055770880E-001,
+3.4243649244308470E-001,
+3.4214612841606140E-001,
+3.4179797768592840E-001,
+3.4139221906661980E-001,
+3.4092903137207030E-001,
+3.4040865302085880E-001,
+3.3983129262924200E-001,
+3.3919724822044380E-001,
+3.3850681781768800E-001,
+3.3776029944419860E-001,
+3.3695802092552180E-001,
+3.3610042929649360E-001,
+3.3518791198730470E-001,
+3.3422079682350160E-001,
+3.3319962024688720E-001,
+3.3212485909461980E-001,
+3.3099696040153500E-001,
+3.2981643080711360E-001,
+3.2858389616012580E-001,
+3.2729989290237420E-001,
+3.2596495747566220E-001,
+3.2457971572875980E-001,
+3.2314485311508180E-001,
+3.2166096568107600E-001,
+3.2012873888015740E-001,
+3.1854888796806340E-001,
+3.1692212820053100E-001,
+3.1524917483329780E-001,
+3.1353080272674560E-001,
+3.1176769733428960E-001,
+3.0996081233024600E-001,
+3.0811080336570740E-001,
+3.0621853470802300E-001,
+3.0428490042686460E-001,
+3.0231067538261420E-001,
+3.0029675364494320E-001,
+2.9824411869049070E-001,
+2.9615348577499390E-001,
+2.9402589797973640E-001,
+2.9186218976974480E-001,
+2.8966337442398070E-001,
+2.8743034601211550E-001,
+2.8516408801078800E-001,
+2.8286558389663700E-001,
+2.8053569793701170E-001,
+2.7817553281784060E-001,
+2.7578607201576240E-001,
+2.7336826920509340E-001,
+2.7092313766479490E-001,
+2.6845166087150580E-001,
+2.6595494151115420E-001,
+2.6343390345573420E-001,
+2.6088967919349670E-001,
+2.5832322239875800E-001,
+2.5573557615280150E-001,
+2.5312781333923340E-001,
+2.5050088763237000E-001,
+2.4785590171813960E-001,
+2.4519388377666480E-001,
+2.4251587688922880E-001,
+2.3982289433479310E-001,
+2.3711597919464110E-001,
+2.3439615964889520E-001,
+2.3166447877883910E-001,
+2.2892196476459500E-001,
+2.2616961598396300E-001,
+2.2340846061706540E-001,
+2.2063951194286350E-001,
+2.1786379814147950E-001,
+2.1508227288722990E-001,
+2.1229594945907590E-001,
+2.0950584113597870E-001,
+2.0671287178993220E-001,
+2.0391805469989780E-001,
+2.0112232863903040E-001,
+1.9832661747932440E-001,
+1.9553191959857940E-001,
+1.9273911416530610E-001,
+1.8994916975498200E-001,
+1.8716295063495640E-001,
+1.8438133597373960E-001,
+1.8160524964332580E-001,
+1.7883554100990300E-001,
+1.7607308924198150E-001,
+1.7331869900226590E-001,
+1.7057323455810550E-001,
+1.6783750057220460E-001,
+1.6511227190494540E-001,
+1.6239835321903230E-001,
+1.5969651937484740E-001,
+1.5700751543045040E-001,
+1.5433208644390100E-001,
+1.5167096257209780E-001,
+1.4902481436729430E-001,
+1.4639437198638920E-001,
+1.4378026127815250E-001,
+1.4118319749832150E-001,
+1.3860376179218290E-001,
+1.3604259490966800E-001,
+1.3350030779838560E-001,
+1.3097748160362240E-001,
+1.2847468256950380E-001,
+1.2599244713783260E-001,
+1.2353130429983140E-001,
+1.2109176814556120E-001,
+1.1867434531450270E-001,
+1.1627949774265290E-001,
+1.1390769481658940E-001,
+1.1155936866998670E-001,
+1.0923493653535840E-001,
+1.0693479329347610E-001,
+1.0465932637453080E-001,
+1.0240890830755230E-001,
+1.0018386691808700E-001,
+9.7984537482261660E-002,
+9.5811240375041960E-002,
+9.3664251267910000E-002,
+9.1543838381767280E-002,
+8.9450262486934660E-002,
+8.7383769452571870E-002,
+8.5344567894935610E-002,
+8.3332858979702000E-002,
+8.1348828971385960E-002,
+7.9392634332180020E-002,
+7.7464438974857330E-002,
+7.5564362108707430E-002,
+7.3692522943019870E-002,
+7.1849010884761810E-002,
+7.0033922791481020E-002,
+6.8247318267822270E-002,
+6.6489234566688540E-002,
+6.4759708940982820E-002,
+6.3058786094188690E-002,
+6.1386436223983760E-002,
+5.9742655605077740E-002,
+5.8127421885728840E-002,
+5.6540694087743760E-002,
+5.4982420057058330E-002,
+5.3452525287866590E-002,
+5.1950931549072270E-002,
+5.0477534532547000E-002,
+4.9032241106033330E-002,
+4.7614917159080510E-002,
+4.6225443482398990E-002,
+4.4863656163215640E-002,
+4.3529424816370010E-002,
+4.2222552001476290E-002,
+4.0942888706922530E-002,
+3.9690230041742320E-002,
+3.8464374840259550E-002,
+3.7265110760927200E-002,
+3.6092240363359450E-002,
+3.4945506602525710E-002,
+3.3824689686298370E-002,
+3.2729536294937140E-002,
+3.1659796833992000E-002,
+3.0615204945206640E-002,
+2.9595496132969860E-002,
+2.8600392863154410E-002,
+2.7629608288407320E-002,
+2.6682861149311060E-002,
+2.5759860873222350E-002,
+2.4860285222530360E-002,
+2.3983856663107870E-002,
+2.3130238056182860E-002,
+2.2299138829112050E-002,
+2.1490212529897690E-002,
+2.0703161135315900E-002,
+1.9937623292207720E-002,
+1.9193304702639580E-002,
+1.8469827249646190E-002,
+1.7766902223229410E-002,
+1.7084129154682160E-002,
+1.6421230509877200E-002,
+1.5777811408042910E-002,
+1.5153550542891020E-002,
+1.4548087492585180E-002,
+1.3961089774966240E-002,
+1.3392185792326930E-002,
+1.2841059826314450E-002,
+1.2307321652770040E-002,
+1.1790650896728040E-002,
+1.1290682479739190E-002,
+1.0807084850966930E-002,
+1.0339494794607160E-002,
+9.8875602707266800E-003,
+9.4509534537792200E-003,
+9.0293306857347480E-003,
+8.6223213002085690E-003,
+8.2296309992671010E-003,
+7.8508658334612850E-003,
+7.4857366271317010E-003,
+7.1338820271193980E-003,
+6.7949919030070300E-003,
+6.4686913974583150E-003,
+6.1547122895717620E-003,
+5.8526843786239620E-003,
+5.5623454973101620E-003,
+5.2832840010523800E-003,
+5.0153112970292570E-003,
+4.7580120153725150E-003,
+4.5111598446965220E-003,
+4.2744171805679800E-003,
+4.0474990382790560E-003,
+3.8300913292914630E-003,
+3.6219672765582800E-003,
+3.4227769356220960E-003,
+3.2322725746780640E-003,
+3.0501529108732940E-003,
+2.8761904686689380E-003,
+2.7100932784378530E-003,
+2.5515670422464610E-003,
+2.4004334118217230E-003,
+2.2563596721738580E-003,
+2.1191518753767010E-003,
+1.9886041991412640E-003,
+1.8643775256350640E-003,
+1.7463274998590350E-003,
+1.6342115122824910E-003,
+1.5278297942131760E-003,
+1.4268938684836030E-003,
+1.3312589144334200E-003,
+1.2406768510118130E-003,
+1.1550235794857140E-003,
+1.0739302961155770E-003,
+9.9747709464281800E-004,
+9.2511920956894760E-004,
+8.5701106581836940E-004,
+7.9285167157649990E-004,
+7.3241489008069040E-004,
+6.7555153509601950E-004,
+6.2221300322562460E-004,
+5.7215924607589840E-004,
+5.2524596685543660E-004,
+4.8127761692740020E-004,
+4.4018754852004350E-004,
+4.0182814700528980E-004,
+3.6589911906048660E-004,
+3.3283955417573450E-004,
+3.0138631700538100E-004,
+2.7261159266345200E-004,
+2.4602311896160240E-004,
+2.2118473134469240E-004,
+1.9817386055365200E-004,
+1.7699223826639360E-004,
+1.5759580128360540E-004,
+1.3974857574794440E-004,
+1.2333714403212070E-004,
+1.0821702744578940E-004,
+9.4393239123746760E-005,
+8.1793652498163280E-005,
+2.6584343868307770E-004
};
double lfe_fir_128[] =
{
- 0.00053168571,
- 0.00016358691,
- 0.00018878609,
- 0.00021643363,
- 0.00024667382,
- 0.00027949660,
- 0.00031519096,
- 0.00035398375,
- 0.00039634691,
- 0.00044236859,
- 0.00049204525,
- 0.00054522208,
- 0.00060277141,
- 0.00066567765,
- 0.00073179678,
- 0.00080365466,
- 0.00088037323,
- 0.00096255314,
- 0.00105048984,
- 0.00114431616,
- 0.00124442333,
- 0.00135110028,
- 0.00146482687,
- 0.00158570008,
- 0.00171401864,
- 0.00185023469,
- 0.00199495023,
- 0.00214785640,
- 0.00231004250,
- 0.00248134881,
- 0.00266251224,
- 0.00285378192,
- 0.00305565330,
- 0.00326841651,
- 0.00349264755,
- 0.00372874714,
- 0.00397720048,
- 0.00423829490,
- 0.00451271003,
- 0.00480085658,
- 0.00510312291,
- 0.00542017492,
- 0.00575236930,
- 0.00610029325,
- 0.00646453211,
- 0.00684553990,
- 0.00724391919,
- 0.00766016589,
- 0.00809498038,
- 0.00854881573,
- 0.00902230106,
- 0.00951600447,
- 0.01003060210,
- 0.01056654565,
- 0.01112466771,
- 0.01170534454,
- 0.01230939943,
- 0.01293735672,
- 0.01358995494,
- 0.01426773332,
- 0.01497144438,
- 0.01570170000,
- 0.01645922661,
- 0.01724460535,
- 0.01805862412,
- 0.01890186779,
- 0.01977507770,
- 0.02067894675,
- 0.02161412500,
- 0.02258131653,
- 0.02358125709,
- 0.02461459488,
- 0.02568206564,
- 0.02678431384,
- 0.02792212367,
- 0.02909611352,
- 0.03030703776,
- 0.03155555204,
- 0.03284239396,
- 0.03416819125,
- 0.03553372994,
- 0.03693958372,
- 0.03838652745,
- 0.03987516090,
- 0.04140623659,
- 0.04298033938,
- 0.04459818453,
- 0.04626038298,
- 0.04796761274,
- 0.04972046614,
- 0.05151961371,
- 0.05336561054,
- 0.05525910854,
- 0.05720067024,
- 0.05919086933,
- 0.06123027951,
- 0.06331945211,
- 0.06545893103,
- 0.06764923781,
- 0.06989086419,
- 0.07218432426,
- 0.07453006506,
- 0.07692859322,
- 0.07938029617,
- 0.08188561350,
- 0.08444493264,
- 0.08705867827,
- 0.08972713351,
- 0.09245070815,
- 0.09522963315,
- 0.09806428105,
- 0.10095486045,
- 0.10390164703,
- 0.10690483451,
- 0.10996460915,
- 0.11308115721,
- 0.11625462025,
- 0.11948505789,
- 0.12277261168,
- 0.12611730397,
- 0.12951917946,
- 0.13297818601,
- 0.13649433851,
- 0.14006754756,
- 0.14369773865,
- 0.14738474786,
- 0.15112841129,
- 0.15492856503,
- 0.15878495574,
- 0.16269733012,
- 0.16666537523,
- 0.17068879306,
- 0.17476719618,
- 0.17890018225,
- 0.18308731914,
- 0.18732811511,
- 0.19162209332,
- 0.19596865773,
- 0.20036731660,
- 0.20481738448,
- 0.20931822062,
- 0.21386915445,
- 0.21846942604,
- 0.22311829031,
- 0.22781492770,
- 0.23255851865,
- 0.23734821379,
- 0.24218304455,
- 0.24706205726,
- 0.25198432803,
- 0.25694879889,
- 0.26195442677,
- 0.26700007915,
- 0.27208462358,
- 0.27720692754,
- 0.28236576915,
- 0.28755992651,
- 0.29278811812,
- 0.29804900289,
- 0.30334126949,
- 0.30866351724,
- 0.31401440501,
- 0.31939238310,
- 0.32479602098,
- 0.33022382855,
- 0.33567428589,
- 0.34114575386,
- 0.34663668275,
- 0.35214546323,
- 0.35767036676,
- 0.36320972443,
- 0.36876192689,
- 0.37432509661,
- 0.37989753485,
- 0.38547745347,
- 0.39106300473,
- 0.39665243030,
- 0.40224379301,
- 0.40783521533,
- 0.41342487931,
- 0.41901078820,
- 0.42459106445,
- 0.43016362190,
- 0.43572667241,
- 0.44127810001,
- 0.44681602716,
- 0.45233830810,
- 0.45784294605,
- 0.46332800388,
- 0.46879136562,
- 0.47423094511,
- 0.47964480519,
- 0.48503074050,
- 0.49038675427,
- 0.49571081996,
- 0.50100076199,
- 0.50625455379,
- 0.51147013903,
- 0.51664537191,
- 0.52177828550,
- 0.52686679363,
- 0.53190881014,
- 0.53690224886,
- 0.54184508324,
- 0.54673534632,
- 0.55157101154,
- 0.55634999275,
- 0.56107026339,
- 0.56572991610,
- 0.57032698393,
- 0.57485944033,
- 0.57932555676,
- 0.58372318745,
- 0.58805054426,
- 0.59230577946,
- 0.59648692608,
- 0.60059231520,
- 0.60462015867,
- 0.60856848955,
- 0.61243581772,
- 0.61622029543,
- 0.61992025375,
- 0.62353414297,
- 0.62706029415,
- 0.63049703836,
- 0.63384294510,
- 0.63709646463,
- 0.64025616646,
- 0.64332056046,
- 0.64628833532,
- 0.64915806055,
- 0.65192854404,
- 0.65459835529,
- 0.65716648102,
- 0.65963155031,
- 0.66199249029,
- 0.66424828768,
- 0.66639786959,
- 0.66844022274,
- 0.67037439346,
- 0.67219948769,
- 0.67391467094,
- 0.67551922798,
- 0.67701220512,
- 0.67839306593,
- 0.67966115475,
- 0.68081587553,
- 0.68185669184,
- 0.68278300762,
- 0.68359452486,
- 0.68429082632,
- 0.68487155437,
- 0.68533653021,
- 0.68568539619,
- 0.68591803312,
- 0.68603444099,
- 0.68603444099,
- 0.68591803312,
- 0.68568539619,
- 0.68533653021,
- 0.68487155437,
- 0.68429082632,
- 0.68359452486,
- 0.68278300762,
- 0.68185669184,
- 0.68081587553,
- 0.67966115475,
- 0.67839306593,
- 0.67701220512,
- 0.67551922798,
- 0.67391467094,
- 0.67219948769,
- 0.67037439346,
- 0.66844022274,
- 0.66639786959,
- 0.66424828768,
- 0.66199249029,
- 0.65963155031,
- 0.65716648102,
- 0.65459835529,
- 0.65192854404,
- 0.64915806055,
- 0.64628833532,
- 0.64332056046,
- 0.64025616646,
- 0.63709646463,
- 0.63384294510,
- 0.63049703836,
- 0.62706029415,
- 0.62353414297,
- 0.61992025375,
- 0.61622029543,
- 0.61243581772,
- 0.60856848955,
- 0.60462015867,
- 0.60059231520,
- 0.59648692608,
- 0.59230577946,
- 0.58805054426,
- 0.58372318745,
- 0.57932555676,
- 0.57485944033,
- 0.57032698393,
- 0.56572991610,
- 0.56107026339,
- 0.55634999275,
- 0.55157101154,
- 0.54673534632,
- 0.54184508324,
- 0.53690224886,
- 0.53190881014,
- 0.52686679363,
- 0.52177828550,
- 0.51664537191,
- 0.51147013903,
- 0.50625455379,
- 0.50100076199,
- 0.49571081996,
- 0.49038675427,
- 0.48503074050,
- 0.47964480519,
- 0.47423094511,
- 0.46879136562,
- 0.46332800388,
- 0.45784294605,
- 0.45233830810,
- 0.44681602716,
- 0.44127810001,
- 0.43572667241,
- 0.43016362190,
- 0.42459106445,
- 0.41901078820,
- 0.41342487931,
- 0.40783521533,
- 0.40224379301,
- 0.39665243030,
- 0.39106300473,
- 0.38547745347,
- 0.37989753485,
- 0.37432509661,
- 0.36876192689,
- 0.36320972443,
- 0.35767036676,
- 0.35214546323,
- 0.34663668275,
- 0.34114575386,
- 0.33567428589,
- 0.33022382855,
- 0.32479602098,
- 0.31939238310,
- 0.31401440501,
- 0.30866351724,
- 0.30334126949,
- 0.29804900289,
- 0.29278811812,
- 0.28755992651,
- 0.28236576915,
- 0.27720692754,
- 0.27208462358,
- 0.26700007915,
- 0.26195442677,
- 0.25694879889,
- 0.25198432803,
- 0.24706205726,
- 0.24218304455,
- 0.23734821379,
- 0.23255851865,
- 0.22781492770,
- 0.22311829031,
- 0.21846942604,
- 0.21386915445,
- 0.20931822062,
- 0.20481738448,
- 0.20036731660,
- 0.19596865773,
- 0.19162209332,
- 0.18732811511,
- 0.18308731914,
- 0.17890018225,
- 0.17476719618,
- 0.17068879306,
- 0.16666537523,
- 0.16269733012,
- 0.15878495574,
- 0.15492856503,
- 0.15112841129,
- 0.14738474786,
- 0.14369773865,
- 0.14006754756,
- 0.13649433851,
- 0.13297818601,
- 0.12951917946,
- 0.12611730397,
- 0.12277261168,
- 0.11948505789,
- 0.11625462025,
- 0.11308115721,
- 0.10996460915,
- 0.10690483451,
- 0.10390164703,
- 0.10095486045,
- 0.09806428105,
- 0.09522963315,
- 0.09245070815,
- 0.08972713351,
- 0.08705867827,
- 0.08444493264,
- 0.08188561350,
- 0.07938029617,
- 0.07692859322,
- 0.07453006506,
- 0.07218432426,
- 0.06989086419,
- 0.06764923781,
- 0.06545893103,
- 0.06331945211,
- 0.06123027951,
- 0.05919086933,
- 0.05720067024,
- 0.05525910854,
- 0.05336561054,
- 0.05151961371,
- 0.04972046614,
- 0.04796761274,
- 0.04626038298,
- 0.04459818453,
- 0.04298033938,
- 0.04140623659,
- 0.03987516090,
- 0.03838652745,
- 0.03693958372,
- 0.03553372994,
- 0.03416819125,
- 0.03284239396,
- 0.03155555204,
- 0.03030703776,
- 0.02909611352,
- 0.02792212367,
- 0.02678431384,
- 0.02568206564,
- 0.02461459488,
- 0.02358125709,
- 0.02258131653,
- 0.02161412500,
- 0.02067894675,
- 0.01977507770,
- 0.01890186779,
- 0.01805862412,
- 0.01724460535,
- 0.01645922661,
- 0.01570170000,
- 0.01497144438,
- 0.01426773332,
- 0.01358995494,
- 0.01293735672,
- 0.01230939943,
- 0.01170534454,
- 0.01112466771,
- 0.01056654565,
- 0.01003060210,
- 0.00951600447,
- 0.00902230106,
- 0.00854881573,
- 0.00809498038,
- 0.00766016589,
- 0.00724391919,
- 0.00684553990,
- 0.00646453211,
- 0.00610029325,
- 0.00575236930,
- 0.00542017492,
- 0.00510312291,
- 0.00480085658,
- 0.00451271003,
- 0.00423829490,
- 0.00397720048,
- 0.00372874714,
- 0.00349264755,
- 0.00326841651,
- 0.00305565330,
- 0.00285378192,
- 0.00266251224,
- 0.00248134881,
- 0.00231004250,
- 0.00214785640,
- 0.00199495023,
- 0.00185023469,
- 0.00171401864,
- 0.00158570008,
- 0.00146482687,
- 0.00135110028,
- 0.00124442333,
- 0.00114431616,
- 0.00105048984,
- 0.00096255314,
- 0.00088037323,
- 0.00080365466,
- 0.00073179678,
- 0.00066567765,
- 0.00060277141,
- 0.00054522208,
- 0.00049204525,
- 0.00044236859,
- 0.00039634691,
- 0.00035398375,
- 0.00031519096,
- 0.00027949660,
- 0.00024667382,
- 0.00021643363,
- 0.00018878609,
- 0.00016358691,
- 0.00053168571
+0.00053168571,
+0.00016358691,
+0.00018878609,
+0.00021643363,
+0.00024667382,
+0.00027949660,
+0.00031519096,
+0.00035398375,
+0.00039634691,
+0.00044236859,
+0.00049204525,
+0.00054522208,
+0.00060277141,
+0.00066567765,
+0.00073179678,
+0.00080365466,
+0.00088037323,
+0.00096255314,
+0.00105048984,
+0.00114431616,
+0.00124442333,
+0.00135110028,
+0.00146482687,
+0.00158570008,
+0.00171401864,
+0.00185023469,
+0.00199495023,
+0.00214785640,
+0.00231004250,
+0.00248134881,
+0.00266251224,
+0.00285378192,
+0.00305565330,
+0.00326841651,
+0.00349264755,
+0.00372874714,
+0.00397720048,
+0.00423829490,
+0.00451271003,
+0.00480085658,
+0.00510312291,
+0.00542017492,
+0.00575236930,
+0.00610029325,
+0.00646453211,
+0.00684553990,
+0.00724391919,
+0.00766016589,
+0.00809498038,
+0.00854881573,
+0.00902230106,
+0.00951600447,
+0.01003060210,
+0.01056654565,
+0.01112466771,
+0.01170534454,
+0.01230939943,
+0.01293735672,
+0.01358995494,
+0.01426773332,
+0.01497144438,
+0.01570170000,
+0.01645922661,
+0.01724460535,
+0.01805862412,
+0.01890186779,
+0.01977507770,
+0.02067894675,
+0.02161412500,
+0.02258131653,
+0.02358125709,
+0.02461459488,
+0.02568206564,
+0.02678431384,
+0.02792212367,
+0.02909611352,
+0.03030703776,
+0.03155555204,
+0.03284239396,
+0.03416819125,
+0.03553372994,
+0.03693958372,
+0.03838652745,
+0.03987516090,
+0.04140623659,
+0.04298033938,
+0.04459818453,
+0.04626038298,
+0.04796761274,
+0.04972046614,
+0.05151961371,
+0.05336561054,
+0.05525910854,
+0.05720067024,
+0.05919086933,
+0.06123027951,
+0.06331945211,
+0.06545893103,
+0.06764923781,
+0.06989086419,
+0.07218432426,
+0.07453006506,
+0.07692859322,
+0.07938029617,
+0.08188561350,
+0.08444493264,
+0.08705867827,
+0.08972713351,
+0.09245070815,
+0.09522963315,
+0.09806428105,
+0.10095486045,
+0.10390164703,
+0.10690483451,
+0.10996460915,
+0.11308115721,
+0.11625462025,
+0.11948505789,
+0.12277261168,
+0.12611730397,
+0.12951917946,
+0.13297818601,
+0.13649433851,
+0.14006754756,
+0.14369773865,
+0.14738474786,
+0.15112841129,
+0.15492856503,
+0.15878495574,
+0.16269733012,
+0.16666537523,
+0.17068879306,
+0.17476719618,
+0.17890018225,
+0.18308731914,
+0.18732811511,
+0.19162209332,
+0.19596865773,
+0.20036731660,
+0.20481738448,
+0.20931822062,
+0.21386915445,
+0.21846942604,
+0.22311829031,
+0.22781492770,
+0.23255851865,
+0.23734821379,
+0.24218304455,
+0.24706205726,
+0.25198432803,
+0.25694879889,
+0.26195442677,
+0.26700007915,
+0.27208462358,
+0.27720692754,
+0.28236576915,
+0.28755992651,
+0.29278811812,
+0.29804900289,
+0.30334126949,
+0.30866351724,
+0.31401440501,
+0.31939238310,
+0.32479602098,
+0.33022382855,
+0.33567428589,
+0.34114575386,
+0.34663668275,
+0.35214546323,
+0.35767036676,
+0.36320972443,
+0.36876192689,
+0.37432509661,
+0.37989753485,
+0.38547745347,
+0.39106300473,
+0.39665243030,
+0.40224379301,
+0.40783521533,
+0.41342487931,
+0.41901078820,
+0.42459106445,
+0.43016362190,
+0.43572667241,
+0.44127810001,
+0.44681602716,
+0.45233830810,
+0.45784294605,
+0.46332800388,
+0.46879136562,
+0.47423094511,
+0.47964480519,
+0.48503074050,
+0.49038675427,
+0.49571081996,
+0.50100076199,
+0.50625455379,
+0.51147013903,
+0.51664537191,
+0.52177828550,
+0.52686679363,
+0.53190881014,
+0.53690224886,
+0.54184508324,
+0.54673534632,
+0.55157101154,
+0.55634999275,
+0.56107026339,
+0.56572991610,
+0.57032698393,
+0.57485944033,
+0.57932555676,
+0.58372318745,
+0.58805054426,
+0.59230577946,
+0.59648692608,
+0.60059231520,
+0.60462015867,
+0.60856848955,
+0.61243581772,
+0.61622029543,
+0.61992025375,
+0.62353414297,
+0.62706029415,
+0.63049703836,
+0.63384294510,
+0.63709646463,
+0.64025616646,
+0.64332056046,
+0.64628833532,
+0.64915806055,
+0.65192854404,
+0.65459835529,
+0.65716648102,
+0.65963155031,
+0.66199249029,
+0.66424828768,
+0.66639786959,
+0.66844022274,
+0.67037439346,
+0.67219948769,
+0.67391467094,
+0.67551922798,
+0.67701220512,
+0.67839306593,
+0.67966115475,
+0.68081587553,
+0.68185669184,
+0.68278300762,
+0.68359452486,
+0.68429082632,
+0.68487155437,
+0.68533653021,
+0.68568539619,
+0.68591803312,
+0.68603444099,
+0.68603444099,
+0.68591803312,
+0.68568539619,
+0.68533653021,
+0.68487155437,
+0.68429082632,
+0.68359452486,
+0.68278300762,
+0.68185669184,
+0.68081587553,
+0.67966115475,
+0.67839306593,
+0.67701220512,
+0.67551922798,
+0.67391467094,
+0.67219948769,
+0.67037439346,
+0.66844022274,
+0.66639786959,
+0.66424828768,
+0.66199249029,
+0.65963155031,
+0.65716648102,
+0.65459835529,
+0.65192854404,
+0.64915806055,
+0.64628833532,
+0.64332056046,
+0.64025616646,
+0.63709646463,
+0.63384294510,
+0.63049703836,
+0.62706029415,
+0.62353414297,
+0.61992025375,
+0.61622029543,
+0.61243581772,
+0.60856848955,
+0.60462015867,
+0.60059231520,
+0.59648692608,
+0.59230577946,
+0.58805054426,
+0.58372318745,
+0.57932555676,
+0.57485944033,
+0.57032698393,
+0.56572991610,
+0.56107026339,
+0.55634999275,
+0.55157101154,
+0.54673534632,
+0.54184508324,
+0.53690224886,
+0.53190881014,
+0.52686679363,
+0.52177828550,
+0.51664537191,
+0.51147013903,
+0.50625455379,
+0.50100076199,
+0.49571081996,
+0.49038675427,
+0.48503074050,
+0.47964480519,
+0.47423094511,
+0.46879136562,
+0.46332800388,
+0.45784294605,
+0.45233830810,
+0.44681602716,
+0.44127810001,
+0.43572667241,
+0.43016362190,
+0.42459106445,
+0.41901078820,
+0.41342487931,
+0.40783521533,
+0.40224379301,
+0.39665243030,
+0.39106300473,
+0.38547745347,
+0.37989753485,
+0.37432509661,
+0.36876192689,
+0.36320972443,
+0.35767036676,
+0.35214546323,
+0.34663668275,
+0.34114575386,
+0.33567428589,
+0.33022382855,
+0.32479602098,
+0.31939238310,
+0.31401440501,
+0.30866351724,
+0.30334126949,
+0.29804900289,
+0.29278811812,
+0.28755992651,
+0.28236576915,
+0.27720692754,
+0.27208462358,
+0.26700007915,
+0.26195442677,
+0.25694879889,
+0.25198432803,
+0.24706205726,
+0.24218304455,
+0.23734821379,
+0.23255851865,
+0.22781492770,
+0.22311829031,
+0.21846942604,
+0.21386915445,
+0.20931822062,
+0.20481738448,
+0.20036731660,
+0.19596865773,
+0.19162209332,
+0.18732811511,
+0.18308731914,
+0.17890018225,
+0.17476719618,
+0.17068879306,
+0.16666537523,
+0.16269733012,
+0.15878495574,
+0.15492856503,
+0.15112841129,
+0.14738474786,
+0.14369773865,
+0.14006754756,
+0.13649433851,
+0.13297818601,
+0.12951917946,
+0.12611730397,
+0.12277261168,
+0.11948505789,
+0.11625462025,
+0.11308115721,
+0.10996460915,
+0.10690483451,
+0.10390164703,
+0.10095486045,
+0.09806428105,
+0.09522963315,
+0.09245070815,
+0.08972713351,
+0.08705867827,
+0.08444493264,
+0.08188561350,
+0.07938029617,
+0.07692859322,
+0.07453006506,
+0.07218432426,
+0.06989086419,
+0.06764923781,
+0.06545893103,
+0.06331945211,
+0.06123027951,
+0.05919086933,
+0.05720067024,
+0.05525910854,
+0.05336561054,
+0.05151961371,
+0.04972046614,
+0.04796761274,
+0.04626038298,
+0.04459818453,
+0.04298033938,
+0.04140623659,
+0.03987516090,
+0.03838652745,
+0.03693958372,
+0.03553372994,
+0.03416819125,
+0.03284239396,
+0.03155555204,
+0.03030703776,
+0.02909611352,
+0.02792212367,
+0.02678431384,
+0.02568206564,
+0.02461459488,
+0.02358125709,
+0.02258131653,
+0.02161412500,
+0.02067894675,
+0.01977507770,
+0.01890186779,
+0.01805862412,
+0.01724460535,
+0.01645922661,
+0.01570170000,
+0.01497144438,
+0.01426773332,
+0.01358995494,
+0.01293735672,
+0.01230939943,
+0.01170534454,
+0.01112466771,
+0.01056654565,
+0.01003060210,
+0.00951600447,
+0.00902230106,
+0.00854881573,
+0.00809498038,
+0.00766016589,
+0.00724391919,
+0.00684553990,
+0.00646453211,
+0.00610029325,
+0.00575236930,
+0.00542017492,
+0.00510312291,
+0.00480085658,
+0.00451271003,
+0.00423829490,
+0.00397720048,
+0.00372874714,
+0.00349264755,
+0.00326841651,
+0.00305565330,
+0.00285378192,
+0.00266251224,
+0.00248134881,
+0.00231004250,
+0.00214785640,
+0.00199495023,
+0.00185023469,
+0.00171401864,
+0.00158570008,
+0.00146482687,
+0.00135110028,
+0.00124442333,
+0.00114431616,
+0.00105048984,
+0.00096255314,
+0.00088037323,
+0.00080365466,
+0.00073179678,
+0.00066567765,
+0.00060277141,
+0.00054522208,
+0.00049204525,
+0.00044236859,
+0.00039634691,
+0.00035398375,
+0.00031519096,
+0.00027949660,
+0.00024667382,
+0.00021643363,
+0.00018878609,
+0.00016358691,
+0.00053168571
};
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_huffman.h b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_huffman.h
index e247b257b..abe4c138c 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_huffman.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_huffman.h
@@ -31,1051 +31,1041 @@ typedef struct huff_entry_s
huff_entry_t bitalloc_a_12[] =
{
- { 1, 0, 1}, { 2, 2, 2}, { 3, 6, 3}, { 4, 14, 4},
- { 5, 30, 5}, { 6, 62, 6}, { 8, 255, 7}, { 8, 254, 8},
- { 9, 507, 9}, { 9, 506, 10}, { 9, 505, 11}, { 9, 504, 12},
- { 0, 0, 0}
+ { 1, 0, 1}, { 2, 2, 2}, { 3, 6, 3}, { 4, 14, 4},
+ { 5, 30, 5}, { 6, 62, 6}, { 8, 255, 7}, { 8, 254, 8},
+ { 9, 507, 9}, { 9, 506, 10}, { 9, 505, 11}, { 9, 504, 12},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_b_12[] =
{
- { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 5, 15, 4},
- { 5, 12, 5}, { 6, 29, 6}, { 7, 57, 7}, { 7, 56, 8},
- { 7, 55, 9}, { 7, 54, 10}, { 7, 53, 11}, { 7, 52, 12},
- { 0, 0, 0}
+ { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 5, 15, 4},
+ { 5, 12, 5}, { 6, 29, 6}, { 7, 57, 7}, { 7, 56, 8},
+ { 7, 55, 9}, { 7, 54, 10}, { 7, 53, 11}, { 7, 52, 12},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_c_12[] =
{
- { 2, 0, 1}, { 3, 7, 2}, { 3, 5, 3}, { 3, 4, 4},
- { 3, 2, 5}, { 4, 13, 6}, { 4, 12, 7}, { 4, 6, 8},
- { 5, 15, 9}, { 6, 29, 10}, { 7, 57, 11}, { 7, 56, 12},
- { 0, 0, 0}
+ { 2, 0, 1}, { 3, 7, 2}, { 3, 5, 3}, { 3, 4, 4},
+ { 3, 2, 5}, { 4, 13, 6}, { 4, 12, 7}, { 4, 6, 8},
+ { 5, 15, 9}, { 6, 29, 10}, { 7, 57, 11}, { 7, 56, 12},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_d_12[] =
{
- { 2, 3, 1}, { 2, 2, 2}, { 2, 0, 3}, { 3, 2, 4},
- { 4, 6, 5}, { 5, 14, 6}, { 6, 30, 7}, { 7, 62, 8},
- { 8, 126, 9}, { 9, 254, 10}, {10, 511, 11}, {10, 510, 12},
- { 0, 0, 0}
+ { 2, 3, 1}, { 2, 2, 2}, { 2, 0, 3}, { 3, 2, 4},
+ { 4, 6, 5}, { 5, 14, 6}, { 6, 30, 7}, { 7, 62, 8},
+ { 8, 126, 9}, { 9, 254, 10}, {10, 511, 11}, {10, 510, 12},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_e_12[] =
{
- { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 4, 6, 4},
- { 5, 14, 5}, { 7, 63, 6}, { 7, 61, 7}, { 8, 124, 8},
- { 8, 121, 9}, { 8, 120, 10}, { 9, 251, 11}, { 9, 250, 12},
- { 0, 0, 0}
+ { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 4, 6, 4},
+ { 5, 14, 5}, { 7, 63, 6}, { 7, 61, 7}, { 8, 124, 8},
+ { 8, 121, 9}, { 8, 120, 10}, { 9, 251, 11}, { 9, 250, 12},
+ { 0, 0, 0}
};
huff_entry_t *bitalloc_12[] =
{
- bitalloc_a_12,
- bitalloc_b_12,
- bitalloc_c_12,
- bitalloc_d_12,
- bitalloc_e_12
+ bitalloc_a_12,
+ bitalloc_b_12,
+ bitalloc_c_12,
+ bitalloc_d_12,
+ bitalloc_e_12
};
huff_entry_t scales_a_129[] =
{
- { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
- { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
- { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
- { 6, 11, -6}, { 7, 75, 7}, { 7, 74, -7}, { 8, 233, 8},
- { 8, 232, -8}, { 8, 41, 9}, { 8, 40, -9}, { 9, 87, 10},
- { 9, 86, -10}, {10, 937, 11}, {10, 936, -11}, {11, 1877, 12},
- {11, 1876, -12}, {11, 341, 13}, {11, 340, -13}, {12, 686, 14},
- {12, 685, -14}, {13, 1375, 15}, {13, 1374, -15}, {13, 1369, 16},
- {13, 1368, -16}, {13, 1359, 17}, {13, 1358, -17}, {13, 1357, 18},
- {13, 1356, -18}, {13, 1355, 19}, {13, 1354, -19}, {13, 1353, 20},
- {13, 1352, -20}, {13, 1351, 21}, {13, 1350, -21}, {13, 1349, 22},
- {13, 1348, -22}, {13, 1347, 23}, {13, 1346, -23}, {13, 1345, 24},
- {13, 1344, -24}, {14, 15103, 25}, {14, 15102, -25}, {14, 15101, 26},
- {14, 15100, -26}, {14, 15099, 27}, {14, 15098, -27}, {14, 15097, 28},
- {14, 15096, -28}, {14, 15095, 29}, {14, 15094, -29}, {14, 15093, 30},
- {14, 15092, -30}, {14, 15091, 31}, {14, 15090, -31}, {14, 15089, 32},
- {14, 15088, -32}, {14, 15087, 33}, {14, 15086, -33}, {14, 15085, 34},
- {14, 15084, -34}, {14, 15083, 35}, {14, 15082, -35}, {14, 15081, 36},
- {14, 15080, -36}, {14, 15079, 37}, {14, 15078, -37}, {14, 15077, 38},
- {14, 15076, -38}, {14, 15075, 39}, {14, 15074, -39}, {14, 15073, 40},
- {14, 15072, -40}, {14, 15071, 41}, {14, 15070, -41}, {14, 15069, 42},
- {14, 15068, -42}, {14, 15067, 43}, {14, 15066, -43}, {14, 15065, 44},
- {14, 15064, -44}, {14, 15063, 45}, {14, 15062, -45}, {14, 15061, 46},
- {14, 15060, -46}, {14, 15059, 47}, {14, 15058, -47}, {14, 15057, 48},
- {14, 15056, -48}, {14, 15055, 49}, {14, 15054, -49}, {14, 15053, 50},
- {14, 15052, -50}, {14, 15051, 51}, {14, 15050, -51}, {14, 15049, 52},
- {14, 15048, -52}, {14, 15047, 53}, {14, 15046, -53}, {14, 15045, 54},
- {14, 15044, -54}, {14, 15043, 55}, {14, 15042, -55}, {14, 15041, 56},
- {14, 15040, -56}, {14, 15039, 57}, {14, 15038, -57}, {14, 15037, 58},
- {14, 15036, -58}, {14, 15035, 59}, {14, 15034, -59}, {14, 15033, 60},
- {14, 15032, -60}, {14, 15031, 61}, {14, 15030, -61}, {14, 15029, 62},
- {14, 15028, -62}, {14, 15027, 63}, {14, 15026, -63}, {14, 15025, 64},
- {14, 15024, -64}, { 0, 0, 0}
+ { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
+ { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
+ { 6, 11, -6}, { 7, 75, 7}, { 7, 74, -7}, { 8, 233, 8},
+ { 8, 232, -8}, { 8, 41, 9}, { 8, 40, -9}, { 9, 87, 10},
+ { 9, 86,-10}, {10, 937, 11}, {10, 936,-11}, {11, 1877, 12},
+ {11, 1876,-12}, {11, 341, 13}, {11, 340,-13}, {12, 686, 14},
+ {12, 685,-14}, {13, 1375, 15}, {13, 1374,-15}, {13, 1369, 16},
+ {13, 1368,-16}, {13, 1359, 17}, {13, 1358,-17}, {13, 1357, 18},
+ {13, 1356,-18}, {13, 1355, 19}, {13, 1354,-19}, {13, 1353, 20},
+ {13, 1352,-20}, {13, 1351, 21}, {13, 1350,-21}, {13, 1349, 22},
+ {13, 1348,-22}, {13, 1347, 23}, {13, 1346,-23}, {13, 1345, 24},
+ {13, 1344,-24}, {14, 15103, 25}, {14, 15102,-25}, {14, 15101, 26},
+ {14, 15100,-26}, {14, 15099, 27}, {14, 15098,-27}, {14, 15097, 28},
+ {14, 15096,-28}, {14, 15095, 29}, {14, 15094,-29}, {14, 15093, 30},
+ {14, 15092,-30}, {14, 15091, 31}, {14, 15090,-31}, {14, 15089, 32},
+ {14, 15088,-32}, {14, 15087, 33}, {14, 15086,-33}, {14, 15085, 34},
+ {14, 15084,-34}, {14, 15083, 35}, {14, 15082,-35}, {14, 15081, 36},
+ {14, 15080,-36}, {14, 15079, 37}, {14, 15078,-37}, {14, 15077, 38},
+ {14, 15076,-38}, {14, 15075, 39}, {14, 15074,-39}, {14, 15073, 40},
+ {14, 15072,-40}, {14, 15071, 41}, {14, 15070,-41}, {14, 15069, 42},
+ {14, 15068,-42}, {14, 15067, 43}, {14, 15066,-43}, {14, 15065, 44},
+ {14, 15064,-44}, {14, 15063, 45}, {14, 15062,-45}, {14, 15061, 46},
+ {14, 15060,-46}, {14, 15059, 47}, {14, 15058,-47}, {14, 15057, 48},
+ {14, 15056,-48}, {14, 15055, 49}, {14, 15054,-49}, {14, 15053, 50},
+ {14, 15052,-50}, {14, 15051, 51}, {14, 15050,-51}, {14, 15049, 52},
+ {14, 15048,-52}, {14, 15047, 53}, {14, 15046,-53}, {14, 15045, 54},
+ {14, 15044,-54}, {14, 15043, 55}, {14, 15042,-55}, {14, 15041, 56},
+ {14, 15040,-56}, {14, 15039, 57}, {14, 15038,-57}, {14, 15037, 58},
+ {14, 15036,-58}, {14, 15035, 59}, {14, 15034,-59}, {14, 15033, 60},
+ {14, 15032,-60}, {14, 15031, 61}, {14, 15030,-61}, {14, 15029, 62},
+ {14, 15028,-62}, {14, 15027, 63}, {14, 15026,-63}, {14, 15025, 64},
+ {14, 15024,-64}, { 0, 0, 0}
};
huff_entry_t scales_b_129[] =
{
- { 3, 3, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2},
- { 4, 14, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 10, 4},
- { 4, 9, -4}, { 4, 0, 5}, { 5, 27, -5}, { 5, 17, 6},
- { 5, 16, -6}, { 6, 53, 7}, { 6, 52, -7}, { 6, 5, 8},
- { 6, 4, -8}, { 7, 13, 9}, { 7, 12, -9}, { 8, 29, 10},
- { 8, 28, -10}, { 9, 60, 11}, {10, 127, -11}, {11, 253, 12},
- {11, 252, -12}, {12, 491, 13}, {12, 490, -13}, {13, 979, 14},
- {13, 978, -14}, {14, 1955, 15}, {14, 1954, -15}, {14, 1953, 16},
- {14, 1952, -16}, {15, 4031, 17}, {15, 4030, -17}, {15, 4029, 18},
- {15, 4028, -18}, {15, 4027, 19}, {15, 4026, -19}, {15, 4025, 20},
- {15, 4024, -20}, {15, 4023, 21}, {15, 4022, -21}, {15, 4021, 22},
- {15, 4020, -22}, {15, 4019, 23}, {15, 4018, -23}, {15, 4017, 24},
- {15, 4016, -24}, {15, 4015, 25}, {15, 4014, -25}, {15, 4013, 26},
- {15, 4012, -26}, {15, 4011, 27}, {15, 4010, -27}, {15, 4009, 28},
- {15, 4008, -28}, {15, 4007, 29}, {15, 4006, -29}, {15, 4005, 30},
- {15, 4004, -30}, {15, 4003, 31}, {15, 4002, -31}, {15, 4001, 32},
- {15, 4000, -32}, {15, 3999, 33}, {15, 3998, -33}, {15, 3997, 34},
- {15, 3996, -34}, {15, 3995, 35}, {15, 3994, -35}, {15, 3993, 36},
- {15, 3992, -36}, {15, 3991, 37}, {15, 3990, -37}, {15, 3989, 38},
- {15, 3988, -38}, {15, 3987, 39}, {15, 3986, -39}, {15, 3985, 40},
- {15, 3984, -40}, {15, 3983, 41}, {15, 3982, -41}, {15, 3981, 42},
- {15, 3980, -42}, {15, 3979, 43}, {15, 3978, -43}, {15, 3977, 44},
- {15, 3976, -44}, {15, 3975, 45}, {15, 3974, -45}, {15, 3973, 46},
- {15, 3972, -46}, {15, 3971, 47}, {15, 3970, -47}, {15, 3969, 48},
- {15, 3968, -48}, {15, 3967, 49}, {15, 3966, -49}, {15, 3965, 50},
- {15, 3964, -50}, {15, 3963, 51}, {15, 3962, -51}, {15, 3961, 52},
- {15, 3960, -52}, {15, 3959, 53}, {15, 3958, -53}, {15, 3957, 54},
- {15, 3956, -54}, {15, 3955, 55}, {15, 3954, -55}, {15, 3953, 56},
- {15, 3952, -56}, {15, 3951, 57}, {15, 3950, -57}, {15, 3949, 58},
- {15, 3948, -58}, {15, 3947, 59}, {15, 3946, -59}, {15, 3945, 60},
- {15, 3944, -60}, {15, 3943, 61}, {15, 3942, -61}, {15, 3941, 62},
- {15, 3940, -62}, {15, 3939, 63}, {15, 3938, -63}, {15, 3937, 64},
- {15, 3936, -64}, { 0, 0, 0}
+ { 3, 3, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 10, 4},
+ { 4, 9, -4}, { 4, 0, 5}, { 5, 27, -5}, { 5, 17, 6},
+ { 5, 16, -6}, { 6, 53, 7}, { 6, 52, -7}, { 6, 5, 8},
+ { 6, 4, -8}, { 7, 13, 9}, { 7, 12, -9}, { 8, 29, 10},
+ { 8, 28,-10}, { 9, 60, 11}, {10, 127,-11}, {11, 253, 12},
+ {11, 252,-12}, {12, 491, 13}, {12, 490,-13}, {13, 979, 14},
+ {13, 978,-14}, {14, 1955, 15}, {14, 1954,-15}, {14, 1953, 16},
+ {14, 1952,-16}, {15, 4031, 17}, {15, 4030,-17}, {15, 4029, 18},
+ {15, 4028,-18}, {15, 4027, 19}, {15, 4026,-19}, {15, 4025, 20},
+ {15, 4024,-20}, {15, 4023, 21}, {15, 4022,-21}, {15, 4021, 22},
+ {15, 4020,-22}, {15, 4019, 23}, {15, 4018,-23}, {15, 4017, 24},
+ {15, 4016,-24}, {15, 4015, 25}, {15, 4014,-25}, {15, 4013, 26},
+ {15, 4012,-26}, {15, 4011, 27}, {15, 4010,-27}, {15, 4009, 28},
+ {15, 4008,-28}, {15, 4007, 29}, {15, 4006,-29}, {15, 4005, 30},
+ {15, 4004,-30}, {15, 4003, 31}, {15, 4002,-31}, {15, 4001, 32},
+ {15, 4000,-32}, {15, 3999, 33}, {15, 3998,-33}, {15, 3997, 34},
+ {15, 3996,-34}, {15, 3995, 35}, {15, 3994,-35}, {15, 3993, 36},
+ {15, 3992,-36}, {15, 3991, 37}, {15, 3990,-37}, {15, 3989, 38},
+ {15, 3988,-38}, {15, 3987, 39}, {15, 3986,-39}, {15, 3985, 40},
+ {15, 3984,-40}, {15, 3983, 41}, {15, 3982,-41}, {15, 3981, 42},
+ {15, 3980,-42}, {15, 3979, 43}, {15, 3978,-43}, {15, 3977, 44},
+ {15, 3976,-44}, {15, 3975, 45}, {15, 3974,-45}, {15, 3973, 46},
+ {15, 3972,-46}, {15, 3971, 47}, {15, 3970,-47}, {15, 3969, 48},
+ {15, 3968,-48}, {15, 3967, 49}, {15, 3966,-49}, {15, 3965, 50},
+ {15, 3964,-50}, {15, 3963, 51}, {15, 3962,-51}, {15, 3961, 52},
+ {15, 3960,-52}, {15, 3959, 53}, {15, 3958,-53}, {15, 3957, 54},
+ {15, 3956,-54}, {15, 3955, 55}, {15, 3954,-55}, {15, 3953, 56},
+ {15, 3952,-56}, {15, 3951, 57}, {15, 3950,-57}, {15, 3949, 58},
+ {15, 3948,-58}, {15, 3947, 59}, {15, 3946,-59}, {15, 3945, 60},
+ {15, 3944,-60}, {15, 3943, 61}, {15, 3942,-61}, {15, 3941, 62},
+ {15, 3940,-62}, {15, 3939, 63}, {15, 3938,-63}, {15, 3937, 64},
+ {15, 3936,-64}, { 0, 0, 0}
};
huff_entry_t scales_c_129[] =
{
- { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2},
- { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4},
- { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6},
- { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8},
- { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10},
- { 7, 114, -10}, { 7, 83, 11}, { 7, 82, -11}, { 7, 35, 12},
- { 7, 34, -12}, { 8, 227, 13}, { 8, 226, -13}, { 8, 162, 14},
- { 8, 161, -14}, { 8, 66, 15}, { 8, 65, -15}, { 9, 450, 16},
- { 9, 449, -16}, { 9, 321, 17}, { 9, 320, -17}, { 9, 129, 18},
- { 9, 128, -18}, {10, 897, 19}, {10, 896, -19}, {10, 652, 20},
- {10, 271, -20}, {10, 268, 21}, {11, 1807, -21}, {11, 1308, 22},
- {11, 1307, -22}, {11, 540, 23}, {11, 539, -23}, {12, 3612, 24},
- {12, 3611, -24}, {12, 2613, 25}, {12, 2612, -25}, {12, 1077, 26},
- {12, 1076, -26}, {13, 7226, 27}, {13, 7221, -27}, {13, 2167, 28},
- {13, 2166, -28}, {13, 2164, 29}, {14, 14455, -29}, {14, 14441, 30},
- {14, 14440, -30}, {14, 4331, 31}, {14, 4330, -31}, {15, 28909, 32},
- {15, 28908, -32}, {15, 28879, 33}, {15, 28878, -33}, {15, 28877, 34},
- {15, 28876, -34}, {15, 28875, 35}, {15, 28874, -35}, {15, 28873, 36},
- {15, 28872, -36}, {15, 28871, 37}, {15, 28870, -37}, {15, 28869, 38},
- {15, 28868, -38}, {15, 28867, 39}, {15, 28866, -39}, {15, 28865, 40},
- {15, 28864, -40}, {15, 20991, 41}, {15, 20990, -41}, {15, 20989, 42},
- {15, 20988, -42}, {15, 20987, 43}, {15, 20986, -43}, {15, 20985, 44},
- {15, 20984, -44}, {15, 20983, 45}, {15, 20982, -45}, {15, 20981, 46},
- {15, 20980, -46}, {15, 20979, 47}, {15, 20978, -47}, {15, 20977, 48},
- {15, 20976, -48}, {15, 20975, 49}, {15, 20974, -49}, {15, 20973, 50},
- {15, 20972, -50}, {15, 20971, 51}, {15, 20970, -51}, {15, 20969, 52},
- {15, 20968, -52}, {15, 20967, 53}, {15, 20966, -53}, {15, 20965, 54},
- {15, 20964, -54}, {15, 20963, 55}, {15, 20962, -55}, {15, 20961, 56},
- {15, 20960, -56}, {15, 20959, 57}, {15, 20958, -57}, {15, 20957, 58},
- {15, 20956, -58}, {15, 20955, 59}, {15, 20954, -59}, {15, 20953, 60},
- {15, 20952, -60}, {15, 20951, 61}, {15, 20950, -61}, {15, 20949, 62},
- {15, 20948, -62}, {15, 20947, 63}, {15, 20946, -63}, {15, 20945, 64},
- {15, 20944, -64}, { 0, 0, 0}
+ { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2},
+ { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4},
+ { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6},
+ { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8},
+ { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10},
+ { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12},
+ { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 162, 14},
+ { 8, 161,-14}, { 8, 66, 15}, { 8, 65,-15}, { 9, 450, 16},
+ { 9, 449,-16}, { 9, 321, 17}, { 9, 320,-17}, { 9, 129, 18},
+ { 9, 128,-18}, {10, 897, 19}, {10, 896,-19}, {10, 652, 20},
+ {10, 271,-20}, {10, 268, 21}, {11, 1807,-21}, {11, 1308, 22},
+ {11, 1307,-22}, {11, 540, 23}, {11, 539,-23}, {12, 3612, 24},
+ {12, 3611,-24}, {12, 2613, 25}, {12, 2612,-25}, {12, 1077, 26},
+ {12, 1076,-26}, {13, 7226, 27}, {13, 7221,-27}, {13, 2167, 28},
+ {13, 2166,-28}, {13, 2164, 29}, {14, 14455,-29}, {14, 14441, 30},
+ {14, 14440,-30}, {14, 4331, 31}, {14, 4330,-31}, {15, 28909, 32},
+ {15, 28908,-32}, {15, 28879, 33}, {15, 28878,-33}, {15, 28877, 34},
+ {15, 28876,-34}, {15, 28875, 35}, {15, 28874,-35}, {15, 28873, 36},
+ {15, 28872,-36}, {15, 28871, 37}, {15, 28870,-37}, {15, 28869, 38},
+ {15, 28868,-38}, {15, 28867, 39}, {15, 28866,-39}, {15, 28865, 40},
+ {15, 28864,-40}, {15, 20991, 41}, {15, 20990,-41}, {15, 20989, 42},
+ {15, 20988,-42}, {15, 20987, 43}, {15, 20986,-43}, {15, 20985, 44},
+ {15, 20984,-44}, {15, 20983, 45}, {15, 20982,-45}, {15, 20981, 46},
+ {15, 20980,-46}, {15, 20979, 47}, {15, 20978,-47}, {15, 20977, 48},
+ {15, 20976,-48}, {15, 20975, 49}, {15, 20974,-49}, {15, 20973, 50},
+ {15, 20972,-50}, {15, 20971, 51}, {15, 20970,-51}, {15, 20969, 52},
+ {15, 20968,-52}, {15, 20967, 53}, {15, 20966,-53}, {15, 20965, 54},
+ {15, 20964,-54}, {15, 20963, 55}, {15, 20962,-55}, {15, 20961, 56},
+ {15, 20960,-56}, {15, 20959, 57}, {15, 20958,-57}, {15, 20957, 58},
+ {15, 20956,-58}, {15, 20955, 59}, {15, 20954,-59}, {15, 20953, 60},
+ {15, 20952,-60}, {15, 20951, 61}, {15, 20950,-61}, {15, 20949, 62},
+ {15, 20948,-62}, {15, 20947, 63}, {15, 20946,-63}, {15, 20945, 64},
+ {15, 20944,-64}, { 0, 0, 0}
};
huff_entry_t scales_d_129[] =
{
- { 2, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 15, 2},
- { 4, 14, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 26, 4},
- { 5, 25, -4}, { 5, 10, 5}, { 5, 9, -5}, { 6, 54, 6},
- { 6, 49, -6}, { 6, 22, 7}, { 6, 17, -7}, { 7, 110, 8},
- { 7, 97, -8}, { 7, 46, 9}, { 7, 33, -9}, { 8, 193, 10},
- { 8, 192, -10}, { 8, 65, 11}, { 8, 64, -11}, { 9, 444, 12},
- { 9, 191, -12}, { 9, 188, 13}, {10, 895, -13}, {10, 890, 14},
- {10, 381, -14}, {10, 378, 15}, {11, 1789, -15}, {11, 761, 16},
- {11, 760, -16}, {12, 3577, 17}, {12, 3576, -17}, {12, 1519, 18},
- {12, 1518, -18}, {12, 1516, 19}, {13, 7151, -19}, {13, 7128, 20},
- {13, 3035, -20}, {14, 14301, 21}, {14, 14300, -21}, {14, 6069, 22},
- {14, 6068, -22}, {15, 28599, 23}, {15, 28598, -23}, {15, 28597, 24},
- {15, 28596, -24}, {15, 28595, 25}, {15, 28594, -25}, {15, 28593, 26},
- {15, 28592, -26}, {15, 28591, 27}, {15, 28590, -27}, {15, 28589, 28},
- {15, 28588, -28}, {15, 28587, 29}, {15, 28586, -29}, {15, 28585, 30},
- {15, 28584, -30}, {15, 28583, 31}, {15, 28582, -31}, {15, 28581, 32},
- {15, 28580, -32}, {15, 28579, 33}, {15, 28578, -33}, {15, 28577, 34},
- {15, 28576, -34}, {15, 28575, 35}, {15, 28574, -35}, {15, 28573, 36},
- {15, 28572, -36}, {15, 28571, 37}, {15, 28570, -37}, {15, 28569, 38},
- {15, 28568, -38}, {15, 28567, 39}, {15, 28566, -39}, {15, 28565, 40},
- {15, 28564, -40}, {15, 28563, 41}, {15, 28562, -41}, {15, 28561, 42},
- {15, 28560, -42}, {15, 28559, 43}, {15, 28558, -43}, {15, 28557, 44},
- {15, 28556, -44}, {15, 28555, 45}, {15, 28554, -45}, {15, 28553, 46},
- {15, 28552, -46}, {15, 28551, 47}, {15, 28550, -47}, {15, 28549, 48},
- {15, 28548, -48}, {15, 28547, 49}, {15, 28546, -49}, {15, 28545, 50},
- {15, 28544, -50}, {15, 28543, 51}, {15, 28542, -51}, {15, 28541, 52},
- {15, 28540, -52}, {15, 28539, 53}, {15, 28538, -53}, {15, 28537, 54},
- {15, 28536, -54}, {15, 28535, 55}, {15, 28534, -55}, {15, 28533, 56},
- {15, 28532, -56}, {15, 28531, 57}, {15, 28530, -57}, {15, 28529, 58},
- {15, 28528, -58}, {15, 28527, 59}, {15, 28526, -59}, {15, 28525, 60},
- {15, 28524, -60}, {15, 28523, 61}, {15, 28522, -61}, {15, 28521, 62},
- {15, 28520, -62}, {15, 28519, 63}, {15, 28518, -63}, {15, 28517, 64},
- {15, 28516, -64}, { 0, 0, 0}
+ { 2, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 26, 4},
+ { 5, 25, -4}, { 5, 10, 5}, { 5, 9, -5}, { 6, 54, 6},
+ { 6, 49, -6}, { 6, 22, 7}, { 6, 17, -7}, { 7, 110, 8},
+ { 7, 97, -8}, { 7, 46, 9}, { 7, 33, -9}, { 8, 193, 10},
+ { 8, 192,-10}, { 8, 65, 11}, { 8, 64,-11}, { 9, 444, 12},
+ { 9, 191,-12}, { 9, 188, 13}, {10, 895,-13}, {10, 890, 14},
+ {10, 381,-14}, {10, 378, 15}, {11, 1789,-15}, {11, 761, 16},
+ {11, 760,-16}, {12, 3577, 17}, {12, 3576,-17}, {12, 1519, 18},
+ {12, 1518,-18}, {12, 1516, 19}, {13, 7151,-19}, {13, 7128, 20},
+ {13, 3035,-20}, {14, 14301, 21}, {14, 14300,-21}, {14, 6069, 22},
+ {14, 6068,-22}, {15, 28599, 23}, {15, 28598,-23}, {15, 28597, 24},
+ {15, 28596,-24}, {15, 28595, 25}, {15, 28594,-25}, {15, 28593, 26},
+ {15, 28592,-26}, {15, 28591, 27}, {15, 28590,-27}, {15, 28589, 28},
+ {15, 28588,-28}, {15, 28587, 29}, {15, 28586,-29}, {15, 28585, 30},
+ {15, 28584,-30}, {15, 28583, 31}, {15, 28582,-31}, {15, 28581, 32},
+ {15, 28580,-32}, {15, 28579, 33}, {15, 28578,-33}, {15, 28577, 34},
+ {15, 28576,-34}, {15, 28575, 35}, {15, 28574,-35}, {15, 28573, 36},
+ {15, 28572,-36}, {15, 28571, 37}, {15, 28570,-37}, {15, 28569, 38},
+ {15, 28568,-38}, {15, 28567, 39}, {15, 28566,-39}, {15, 28565, 40},
+ {15, 28564,-40}, {15, 28563, 41}, {15, 28562,-41}, {15, 28561, 42},
+ {15, 28560,-42}, {15, 28559, 43}, {15, 28558,-43}, {15, 28557, 44},
+ {15, 28556,-44}, {15, 28555, 45}, {15, 28554,-45}, {15, 28553, 46},
+ {15, 28552,-46}, {15, 28551, 47}, {15, 28550,-47}, {15, 28549, 48},
+ {15, 28548,-48}, {15, 28547, 49}, {15, 28546,-49}, {15, 28545, 50},
+ {15, 28544,-50}, {15, 28543, 51}, {15, 28542,-51}, {15, 28541, 52},
+ {15, 28540,-52}, {15, 28539, 53}, {15, 28538,-53}, {15, 28537, 54},
+ {15, 28536,-54}, {15, 28535, 55}, {15, 28534,-55}, {15, 28533, 56},
+ {15, 28532,-56}, {15, 28531, 57}, {15, 28530,-57}, {15, 28529, 58},
+ {15, 28528,-58}, {15, 28527, 59}, {15, 28526,-59}, {15, 28525, 60},
+ {15, 28524,-60}, {15, 28523, 61}, {15, 28522,-61}, {15, 28521, 62},
+ {15, 28520,-62}, {15, 28519, 63}, {15, 28518,-63}, {15, 28517, 64},
+ {15, 28516,-64}, { 0, 0, 0}
};
huff_entry_t scales_e_129[] =
{
- { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 7, 2},
- { 4, 6, -2}, { 4, 3, 3}, { 4, 2, -3}, { 5, 31, 4},
- { 5, 30, -4}, { 5, 25, 5}, { 5, 24, -5}, { 5, 17, 6},
- { 5, 16, -6}, { 5, 9, 7}, { 5, 8, -7}, { 5, 1, 8},
- { 5, 0, -8}, { 6, 53, 9}, { 6, 52, -9}, { 6, 37, 10},
- { 6, 36, -10}, { 6, 21, 11}, { 6, 20, -11}, { 6, 5, 12},
- { 6, 4, -12}, { 7, 109, 13}, { 7, 108, -13}, { 7, 77, 14},
- { 7, 76, -14}, { 7, 45, 15}, { 7, 44, -15}, { 7, 13, 16},
- { 7, 12, -16}, { 8, 221, 17}, { 8, 220, -17}, { 8, 157, 18},
- { 8, 156, -18}, { 8, 93, 19}, { 8, 92, -19}, { 8, 29, 20},
- { 8, 28, -20}, { 9, 445, 21}, { 9, 444, -21}, { 9, 317, 22},
- { 9, 316, -22}, { 9, 189, 23}, { 9, 188, -23}, { 9, 61, 24},
- { 9, 60, -24}, {10, 892, 25}, {10, 639, -25}, {10, 637, 26},
- {10, 636, -26}, {10, 381, 27}, {10, 380, -27}, {10, 125, 28},
- {10, 124, -28}, {11, 1788, 29}, {11, 1787, -29}, {11, 1276, 30},
- {11, 767, -30}, {11, 764, 31}, {11, 255, -31}, {11, 252, 32},
- {12, 3583, -32}, {12, 3579, 33}, {12, 3578, -33}, {12, 2555, 34},
- {12, 2554, -34}, {12, 1531, 35}, {12, 1530, -35}, {12, 507, 36},
- {12, 506, -36}, {13, 7160, 37}, {13, 7147, -37}, {13, 7144, 38},
- {13, 3067, -38}, {13, 3065, 39}, {13, 3064, -39}, {13, 1017, 40},
- {13, 1016, -40}, {14, 14330, 41}, {14, 14329, -41}, {14, 14291, 42},
- {14, 14290, -42}, {14, 6132, 43}, {14, 2039, -43}, {14, 2038, 44},
- {14, 2037, -44}, {15, 28663, 45}, {15, 28662, -45}, {15, 28585, 46},
- {15, 28584, -46}, {15, 12267, 47}, {15, 12266, -47}, {15, 4073, 48},
- {15, 4072, -48}, {16, 57315, 49}, {16, 57314, -49}, {16, 57313, 50},
- {16, 57312, -50}, {16, 57311, 51}, {16, 57310, -51}, {16, 57309, 52},
- {16, 57308, -52}, {16, 57307, 53}, {16, 57306, -53}, {16, 57305, 54},
- {16, 57304, -54}, {16, 57303, 55}, {16, 57302, -55}, {16, 57301, 56},
- {16, 57300, -56}, {16, 57299, 57}, {16, 57298, -57}, {16, 57297, 58},
- {16, 57296, -58}, {16, 57295, 59}, {16, 57294, -59}, {16, 57293, 60},
- {16, 57292, -60}, {16, 57291, 61}, {16, 57290, -61}, {16, 57289, 62},
- {16, 57288, -62}, {16, 57175, 63}, {16, 57174, -63}, {16, 57173, 64},
- {16, 57172, -64}, { 0, 0, 0}
+ { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 7, 2},
+ { 4, 6, -2}, { 4, 3, 3}, { 4, 2, -3}, { 5, 31, 4},
+ { 5, 30, -4}, { 5, 25, 5}, { 5, 24, -5}, { 5, 17, 6},
+ { 5, 16, -6}, { 5, 9, 7}, { 5, 8, -7}, { 5, 1, 8},
+ { 5, 0, -8}, { 6, 53, 9}, { 6, 52, -9}, { 6, 37, 10},
+ { 6, 36,-10}, { 6, 21, 11}, { 6, 20,-11}, { 6, 5, 12},
+ { 6, 4,-12}, { 7, 109, 13}, { 7, 108,-13}, { 7, 77, 14},
+ { 7, 76,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 13, 16},
+ { 7, 12,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 157, 18},
+ { 8, 156,-18}, { 8, 93, 19}, { 8, 92,-19}, { 8, 29, 20},
+ { 8, 28,-20}, { 9, 445, 21}, { 9, 444,-21}, { 9, 317, 22},
+ { 9, 316,-22}, { 9, 189, 23}, { 9, 188,-23}, { 9, 61, 24},
+ { 9, 60,-24}, {10, 892, 25}, {10, 639,-25}, {10, 637, 26},
+ {10, 636,-26}, {10, 381, 27}, {10, 380,-27}, {10, 125, 28},
+ {10, 124,-28}, {11, 1788, 29}, {11, 1787,-29}, {11, 1276, 30},
+ {11, 767,-30}, {11, 764, 31}, {11, 255,-31}, {11, 252, 32},
+ {12, 3583,-32}, {12, 3579, 33}, {12, 3578,-33}, {12, 2555, 34},
+ {12, 2554,-34}, {12, 1531, 35}, {12, 1530,-35}, {12, 507, 36},
+ {12, 506,-36}, {13, 7160, 37}, {13, 7147,-37}, {13, 7144, 38},
+ {13, 3067,-38}, {13, 3065, 39}, {13, 3064,-39}, {13, 1017, 40},
+ {13, 1016,-40}, {14, 14330, 41}, {14, 14329,-41}, {14, 14291, 42},
+ {14, 14290,-42}, {14, 6132, 43}, {14, 2039,-43}, {14, 2038, 44},
+ {14, 2037,-44}, {15, 28663, 45}, {15, 28662,-45}, {15, 28585, 46},
+ {15, 28584,-46}, {15, 12267, 47}, {15, 12266,-47}, {15, 4073, 48},
+ {15, 4072,-48}, {16, 57315, 49}, {16, 57314,-49}, {16, 57313, 50},
+ {16, 57312,-50}, {16, 57311, 51}, {16, 57310,-51}, {16, 57309, 52},
+ {16, 57308,-52}, {16, 57307, 53}, {16, 57306,-53}, {16, 57305, 54},
+ {16, 57304,-54}, {16, 57303, 55}, {16, 57302,-55}, {16, 57301, 56},
+ {16, 57300,-56}, {16, 57299, 57}, {16, 57298,-57}, {16, 57297, 58},
+ {16, 57296,-58}, {16, 57295, 59}, {16, 57294,-59}, {16, 57293, 60},
+ {16, 57292,-60}, {16, 57291, 61}, {16, 57290,-61}, {16, 57289, 62},
+ {16, 57288,-62}, {16, 57175, 63}, {16, 57174,-63}, {16, 57173, 64},
+ {16, 57172,-64}, { 0, 0, 0}
};
huff_entry_t *scales_129[] =
{
- scales_a_129,
- scales_b_129,
- scales_c_129,
- scales_d_129,
- scales_e_129
+ scales_a_129,
+ scales_b_129,
+ scales_c_129,
+ scales_d_129,
+ scales_e_129
};
huff_entry_t bitalloc_a_3[] =
{
- { 1, 0, 0}, { 2, 2, 1}, { 2, 3, -1}, { 0, 0, 0}
+ { 1, 0, 0}, { 2, 2, 1}, { 2, 3, -1}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_4[] =
{
- { 1, 0, 0}, { 2, 2, 1}, { 3, 6, 2}, { 3, 7, 3},
- { 0, 0, 0}
+ { 1, 0, 0}, { 2, 2, 1}, { 3, 6, 2}, { 3, 7, 3},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_b_4[] =
{
- { 2, 2, 0}, { 3, 6, 1}, { 3, 7, 2}, { 1, 0, 3},
- { 0, 0, 0}
+ { 2, 2, 0}, { 3, 6, 1}, { 3, 7, 2}, { 1, 0, 3},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_c_4[] =
{
- { 3, 6, 0}, { 3, 7, 1}, { 1, 0, 2}, { 2, 2, 3},
- { 0, 0, 0}
+ { 3, 6, 0}, { 3, 7, 1}, { 1, 0, 2}, { 2, 2, 3},
+ { 0, 0, 0}
};
huff_entry_t bitalloc_d_4[] =
{
- { 2, 0, 0}, { 2, 1, 1}, { 2, 2, 2}, { 2, 3, 3},
- { 0, 0, 0}
+ { 2, 0, 0}, { 2, 1, 1}, { 2, 2, 2}, { 2, 3, 3},
+ { 0, 0, 0}
};
huff_entry_t *tmode[] =
{
- bitalloc_a_4,
- bitalloc_b_4,
- bitalloc_c_4,
- bitalloc_d_4
+ bitalloc_a_4,
+ bitalloc_b_4,
+ bitalloc_c_4,
+ bitalloc_d_4
};
huff_entry_t bitalloc_a_5[] =
{
- { 1, 0, 0}, { 2, 2, 1}, { 3, 6, -1}, { 4, 14, 2},
- { 4, 15, -2}, { 0, 0, 0}
+ { 1, 0, 0}, { 2, 2, 1}, { 3, 6, -1}, { 4, 14, 2},
+ { 4, 15, -2}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_5[] =
{
- { 2, 2, 0}, { 2, 0, 1}, { 2, 1, -1}, { 3, 6, 2},
- { 3, 7, -2}, { 0, 0, 0}
+ { 2, 2, 0}, { 2, 0, 1}, { 2, 1, -1}, { 3, 6, 2},
+ { 3, 7, -2}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_5[] =
{
- { 1, 0, 0}, { 3, 4, 1}, { 3, 5, -1}, { 3, 6, 2},
- { 3, 7, -2}, { 0, 0, 0}
+ { 1, 0, 0}, { 3, 4, 1}, { 3, 5, -1}, { 3, 6, 2},
+ { 3, 7, -2}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_7[] =
{
- { 1, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 4, 2},
- { 4, 14, -2}, { 5, 31, 3}, { 5, 30, -3}, { 0, 0, 0}
+ { 1, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 4, 2},
+ { 4, 14, -2}, { 5, 31, 3}, { 5, 30, -3}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_7[] =
{
- { 2, 3, 0}, { 2, 1, 1}, { 2, 0, -1}, { 3, 4, 2},
- { 4, 11, -2}, { 5, 21, 3}, { 5, 20, -3}, { 0, 0, 0}
+ { 2, 3, 0}, { 2, 1, 1}, { 2, 0, -1}, { 3, 4, 2},
+ { 4, 11, -2}, { 5, 21, 3}, { 5, 20, -3}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_7[] =
{
- { 2, 3, 0}, { 2, 2, 1}, { 2, 1, -1}, { 4, 3, 2},
- { 4, 2, -2}, { 4, 1, 3}, { 4, 0, -3}, { 0, 0, 0}
+ { 2, 3, 0}, { 2, 2, 1}, { 2, 1, -1}, { 4, 3, 2},
+ { 4, 2, -2}, { 4, 1, 3}, { 4, 0, -3}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_9[] =
{
- { 1, 0, 0}, { 3, 7, 1}, { 3, 5, -1}, { 4, 13, 2},
- { 4, 9, -2}, { 4, 8, 3}, { 5, 25, -3}, { 6, 49, 4},
- { 6, 48, -4}, { 0, 0, 0}
+ { 1, 0, 0}, { 3, 7, 1}, { 3, 5, -1}, { 4, 13, 2},
+ { 4, 9, -2}, { 4, 8, 3}, { 5, 25, -3}, { 6, 49, 4},
+ { 6, 48, -4}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_9[] =
{
- { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 3, 2},
- { 3, 2, -2}, { 5, 27, 3}, { 5, 26, -3}, { 5, 25, 4},
- { 5, 24, -4}, { 0, 0, 0}
+ { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 3, 2},
+ { 3, 2, -2}, { 5, 27, 3}, { 5, 26, -3}, { 5, 25, 4},
+ { 5, 24, -4}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_9[] =
{
- { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 6, 2},
- { 3, 2, -2}, { 4, 6, 3}, { 5, 15, -3}, { 6, 29, 4},
- { 6, 28, -4}, { 0, 0, 0}
+ { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 6, 2},
+ { 3, 2, -2}, { 4, 6, 3}, { 5, 15, -3}, { 6, 29, 4},
+ { 6, 28, -4}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_13[] =
{
- { 1, 0, 0}, { 3, 4, 1}, { 4, 15, -1}, { 4, 13, 2},
- { 4, 12, -2}, { 4, 10, 3}, { 5, 29, -3}, { 5, 22, 4},
- { 6, 57, -4}, { 6, 47, 5}, { 6, 46, -5}, { 7, 113, 6},
- { 7, 112, -6}, { 0, 0, 0}
+ { 1, 0, 0}, { 3, 4, 1}, { 4, 15, -1}, { 4, 13, 2},
+ { 4, 12, -2}, { 4, 10, 3}, { 5, 29, -3}, { 5, 22, 4},
+ { 6, 57, -4}, { 6, 47, 5}, { 6, 46, -5}, { 7, 113, 6},
+ { 7, 112, -6}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_13[] =
{
- { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2},
- { 4, 15, -2}, { 4, 9, 3}, { 4, 7, -3}, { 4, 6, 4},
- { 5, 29, -4}, { 5, 17, 5}, { 5, 16, -5}, { 6, 57, 6},
- { 6, 56, -6}, { 0, 0, 0}
+ { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2},
+ { 4, 15, -2}, { 4, 9, 3}, { 4, 7, -3}, { 4, 6, 4},
+ { 5, 29, -4}, { 5, 17, 5}, { 5, 16, -5}, { 6, 57, 6},
+ { 6, 56, -6}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_13[] =
{
- { 3, 5, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 2, 2},
- { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 12, 4},
- { 4, 3, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 5, 6},
- { 5, 4, -6}, { 0, 0, 0}
+ { 3, 5, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 2, 2},
+ { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 12, 4},
+ { 4, 3, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 5, 6},
+ { 5, 4, -6}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_17[] =
{
- { 2, 1, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 4, 2},
- { 3, 1, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 0, 4},
- { 5, 3, -4}, { 6, 4, 5}, { 7, 11, -5}, { 8, 20, 6},
- { 9, 43, -6}, {10, 84, 7}, {11, 171, -7}, {12, 341, 8},
- {12, 340, -8}, { 0, 0, 0}
+ { 2, 1, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 4, 2},
+ { 3, 1, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 0, 4},
+ { 5, 3, -4}, { 6, 4, 5}, { 7, 11, -5}, { 8, 20, 6},
+ { 9, 43, -6}, {10, 84, 7}, {11, 171, -7}, {12, 341, 8},
+ {12, 340, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_17[] =
{
- { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2},
- { 4, 15, -2}, { 4, 9, 3}, { 4, 8, -3}, { 5, 29, 4},
- { 5, 28, -4}, { 5, 14, 5}, { 5, 13, -5}, { 6, 30, 6},
- { 6, 25, -6}, { 6, 24, 7}, { 7, 63, -7}, { 8, 125, 8},
- { 8, 124, -8}, { 0, 0, 0}
+ { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2},
+ { 4, 15, -2}, { 4, 9, 3}, { 4, 8, -3}, { 5, 29, 4},
+ { 5, 28, -4}, { 5, 14, 5}, { 5, 13, -5}, { 6, 30, 6},
+ { 6, 25, -6}, { 6, 24, 7}, { 7, 63, -7}, { 8, 125, 8},
+ { 8, 124, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_17[] =
{
- { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 0, 2},
- { 4, 15, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 4, 4},
- { 4, 3, -4}, { 5, 29, 5}, { 5, 28, -5}, { 5, 10, 6},
- { 5, 5, -6}, { 5, 4, 7}, { 6, 23, -7}, { 7, 45, 8},
- { 7, 44, -8}, { 0, 0, 0}
+ { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 4, 4},
+ { 4, 3, -4}, { 5, 29, 5}, { 5, 28, -5}, { 5, 10, 6},
+ { 5, 5, -6}, { 5, 4, 7}, { 6, 23, -7}, { 7, 45, 8},
+ { 7, 44, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_d_17[] =
{
- { 1, 0, 0}, { 3, 7, 1}, { 3, 6, -1}, { 4, 11, 2},
- { 4, 10, -2}, { 5, 19, 3}, { 5, 18, -3}, { 6, 35, 4},
- { 6, 34, -4}, { 7, 67, 5}, { 7, 66, -5}, { 8, 131, 6},
- { 8, 130, -6}, { 9, 259, 7}, { 9, 258, -7}, { 9, 257, 8},
- { 9, 256, -8}, { 0, 0, 0}
+ { 1, 0, 0}, { 3, 7, 1}, { 3, 6, -1}, { 4, 11, 2},
+ { 4, 10, -2}, { 5, 19, 3}, { 5, 18, -3}, { 6, 35, 4},
+ { 6, 34, -4}, { 7, 67, 5}, { 7, 66, -5}, { 8, 131, 6},
+ { 8, 130, -6}, { 9, 259, 7}, { 9, 258, -7}, { 9, 257, 8},
+ { 9, 256, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_e_17[] =
{
- { 1, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 12, 2},
- { 5, 31, -2}, { 5, 28, 3}, { 5, 27, -3}, { 6, 60, 4},
- { 6, 59, -4}, { 6, 53, 5}, { 6, 52, -5}, { 7, 122, 6},
- { 7, 117, -6}, { 8, 247, 7}, { 8, 246, -7}, { 8, 233, 8},
- { 8, 232, -8}, { 0, 0, 0}
+ { 1, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 12, 2},
+ { 5, 31, -2}, { 5, 28, 3}, { 5, 27, -3}, { 6, 60, 4},
+ { 6, 59, -4}, { 6, 53, 5}, { 6, 52, -5}, { 7, 122, 6},
+ { 7, 117, -6}, { 8, 247, 7}, { 8, 246, -7}, { 8, 233, 8},
+ { 8, 232, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_f_17[] =
{
- { 3, 6, 0}, { 3, 5, 1}, { 3, 4, -1}, { 3, 2, 2},
- { 3, 1, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 6, 4},
- { 4, 1, -4}, { 5, 14, 5}, { 5, 1, -5}, { 6, 31, 6},
- { 6, 30, -6}, { 6, 0, 7}, { 7, 3, -7}, { 8, 5, 8},
- { 8, 4, -8}, { 0, 0, 0}
+ { 3, 6, 0}, { 3, 5, 1}, { 3, 4, -1}, { 3, 2, 2},
+ { 3, 1, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 6, 4},
+ { 4, 1, -4}, { 5, 14, 5}, { 5, 1, -5}, { 6, 31, 6},
+ { 6, 30, -6}, { 6, 0, 7}, { 7, 3, -7}, { 8, 5, 8},
+ { 8, 4, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_g_17[] =
{
- { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2},
- { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 14, 4},
- { 5, 13, -4}, { 6, 30, 5}, { 6, 25, -5}, { 7, 62, 6},
- { 7, 49, -6}, { 8, 127, 7}, { 8, 126, -7}, { 8, 97, 8},
- { 8, 96, -8}, { 0, 0, 0}
+ { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2},
+ { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 14, 4},
+ { 5, 13, -4}, { 6, 30, 5}, { 6, 25, -5}, { 7, 62, 6},
+ { 7, 49, -6}, { 8, 127, 7}, { 8, 126, -7}, { 8, 97, 8},
+ { 8, 96, -8}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_25[] =
{
- { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 1, 2},
- { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 5, 4},
- { 4, 4, -4}, { 5, 22, 5}, { 5, 21, -5}, { 6, 47, 6},
- { 6, 46, -6}, { 7, 83, 7}, { 7, 82, -7}, { 8, 163, 8},
- { 8, 162, -8}, { 8, 160, 9}, { 9, 323, -9}, {10, 644, 10},
- {11, 1291, -10}, {12, 2580, 11}, {13, 5163, -11}, {14, 10325, 12},
- {14, 10324, -12}, { 0, 0, 0}
+ { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 1, 2},
+ { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 5, 4},
+ { 4, 4, -4}, { 5, 22, 5}, { 5, 21, -5}, { 6, 47, 6},
+ { 6, 46, -6}, { 7, 83, 7}, { 7, 82, -7}, { 8, 163, 8},
+ { 8, 162, -8}, { 8, 160, 9}, { 9, 323, -9}, {10, 644, 10},
+ {11, 1291,-10}, {12, 2580, 11}, {13, 5163,-11}, {14, 10325, 12},
+ {14, 10324,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_25[] =
{
- { 3, 5, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2},
- { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4},
- { 4, 1, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 15, 6},
- { 5, 14, -6}, { 6, 55, 7}, { 6, 54, -7}, { 6, 49, 8},
- { 6, 48, -8}, { 6, 1, 9}, { 6, 0, -9}, { 7, 6, 10},
- { 7, 5, -10}, { 7, 4, 11}, { 8, 15, -11}, { 9, 29, 12},
- { 9, 28, -12}, { 0, 0, 0}
+ { 3, 5, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4},
+ { 4, 1, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 15, 6},
+ { 5, 14, -6}, { 6, 55, 7}, { 6, 54, -7}, { 6, 49, 8},
+ { 6, 48, -8}, { 6, 1, 9}, { 6, 0, -9}, { 7, 6, 10},
+ { 7, 5,-10}, { 7, 4, 11}, { 8, 15,-11}, { 9, 29, 12},
+ { 9, 28,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_25[] =
{
- { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 12, 2},
- { 4, 11, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4},
- { 4, 5, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 26, 6},
- { 5, 21, -6}, { 5, 15, 7}, { 5, 14, -7}, { 5, 8, 8},
- { 6, 55, -8}, { 6, 41, 9}, { 6, 40, -9}, { 6, 18, 10},
- { 7, 109, -10}, { 7, 108, 11}, { 7, 39, -11}, { 8, 77, 12},
- { 8, 76, -12}, { 0, 0, 0}
+ { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 12, 2},
+ { 4, 11, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4},
+ { 4, 5, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 26, 6},
+ { 5, 21, -6}, { 5, 15, 7}, { 5, 14, -7}, { 5, 8, 8},
+ { 6, 55, -8}, { 6, 41, 9}, { 6, 40, -9}, { 6, 18, 10},
+ { 7, 109,-10}, { 7, 108, 11}, { 7, 39,-11}, { 8, 77, 12},
+ { 8, 76,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_d_25[] =
{
- { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2},
- { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 13, 4},
- { 5, 12, -4}, { 6, 29, 5}, { 6, 28, -5}, { 7, 62, 6},
- { 7, 61, -6}, { 8, 126, 7}, { 8, 121, -7}, { 9, 255, 8},
- { 9, 254, -8}, {10, 483, 9}, {10, 482, -9}, {11, 963, 10},
- {11, 962, -10}, {12, 1923, 11}, {12, 1922, -11}, {12, 1921, 12},
- {12, 1920, -12}, { 0, 0, 0}
+ { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2},
+ { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 13, 4},
+ { 5, 12, -4}, { 6, 29, 5}, { 6, 28, -5}, { 7, 62, 6},
+ { 7, 61, -6}, { 8, 126, 7}, { 8, 121, -7}, { 9, 255, 8},
+ { 9, 254, -8}, {10, 483, 9}, {10, 482, -9}, {11, 963, 10},
+ {11, 962,-10}, {12, 1923, 11}, {12, 1922,-11}, {12, 1921, 12},
+ {12, 1920,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_e_25[] =
{
- { 2, 3, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 11, 2},
- { 4, 10, -2}, { 4, 1, 3}, { 4, 0, -3}, { 5, 17, 4},
- { 5, 16, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 38, 6},
- { 6, 37, -6}, { 6, 14, 7}, { 6, 13, -7}, { 7, 79, 8},
- { 7, 78, -8}, { 7, 72, 9}, { 7, 31, -9}, { 7, 25, 10},
- { 7, 24, -10}, { 8, 147, 11}, { 8, 146, -11}, { 8, 61, 12},
- { 8, 60, -12}, { 0, 0, 0}
+ { 2, 3, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 11, 2},
+ { 4, 10, -2}, { 4, 1, 3}, { 4, 0, -3}, { 5, 17, 4},
+ { 5, 16, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 38, 6},
+ { 6, 37, -6}, { 6, 14, 7}, { 6, 13, -7}, { 7, 79, 8},
+ { 7, 78, -8}, { 7, 72, 9}, { 7, 31, -9}, { 7, 25, 10},
+ { 7, 24,-10}, { 8, 147, 11}, { 8, 146,-11}, { 8, 61, 12},
+ { 8, 60,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_f_25[] =
{
- { 3, 1, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 14, 2},
- { 4, 13, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 8, 4},
- { 4, 7, -4}, { 4, 5, 5}, { 4, 4, -5}, { 5, 24, 6},
- { 5, 19, -6}, { 5, 13, 7}, { 5, 12, -7}, { 6, 37, 8},
- { 6, 36, -8}, { 7, 102, 9}, { 7, 101, -9}, { 8, 207, 10},
- { 8, 206, -10}, { 8, 200, 11}, { 9, 403, -11}, {10, 805, 12},
- {10, 804, -12}, { 0, 0, 0}
+ { 3, 1, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 14, 2},
+ { 4, 13, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 8, 4},
+ { 4, 7, -4}, { 4, 5, 5}, { 4, 4, -5}, { 5, 24, 6},
+ { 5, 19, -6}, { 5, 13, 7}, { 5, 12, -7}, { 6, 37, 8},
+ { 6, 36, -8}, { 7, 102, 9}, { 7, 101, -9}, { 8, 207, 10},
+ { 8, 206,-10}, { 8, 200, 11}, { 9, 403,-11}, {10, 805, 12},
+ {10, 804,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_g_25[] =
{
- { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
- { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
- { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
- { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8},
- { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 470, 10},
- { 9, 469, -10}, {10, 943, 11}, {10, 942, -11}, {10, 937, 12},
- {10, 936, -12}, { 0, 0, 0}
+ { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
+ { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
+ { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8},
+ { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 470, 10},
+ { 9, 469,-10}, {10, 943, 11}, {10, 942,-11}, {10, 937, 12},
+ {10, 936,-12}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_33[] =
{
- { 3, 2, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 14, 2},
- { 4, 13, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 9, 4},
- { 4, 8, -4}, { 4, 6, 5}, { 5, 31, -5}, { 5, 20, 6},
- { 5, 15, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 29, 8},
- { 6, 28, -8}, { 7, 85, 9}, { 7, 84, -9}, { 8, 174, 10},
- { 8, 173, -10}, { 9, 351, 11}, { 9, 350, -11}, {10, 691, 12},
- {10, 690, -12}, {11, 1379, 13}, {11, 1378, -13}, {12, 2755, 14},
- {12, 2754, -14}, {13, 5507, 15}, {13, 5506, -15}, {13, 5505, 16},
- {13, 5504, -16}, { 0, 0, 0}
+ { 3, 2, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 14, 2},
+ { 4, 13, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 9, 4},
+ { 4, 8, -4}, { 4, 6, 5}, { 5, 31, -5}, { 5, 20, 6},
+ { 5, 15, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 29, 8},
+ { 6, 28, -8}, { 7, 85, 9}, { 7, 84, -9}, { 8, 174, 10},
+ { 8, 173,-10}, { 9, 351, 11}, { 9, 350,-11}, {10, 691, 12},
+ {10, 690,-12}, {11, 1379, 13}, {11, 1378,-13}, {12, 2755, 14},
+ {12, 2754,-14}, {13, 5507, 15}, {13, 5506,-15}, {13, 5505, 16},
+ {13, 5504,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_33[] =
{
- { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 11, 2},
- { 4, 10, -2}, { 4, 8, 3}, { 4, 7, -3}, { 4, 4, 4},
- { 4, 1, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 19, 6},
- { 5, 18, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 1, 8},
- { 5, 0, -8}, { 6, 50, 9}, { 6, 49, -9}, { 6, 26, 10},
- { 6, 21, -10}, { 7, 103, 11}, { 7, 102, -11}, { 7, 96, 12},
- { 7, 55, -12}, { 7, 41, 13}, { 7, 40, -13}, { 8, 194, 14},
- { 8, 109, -14}, { 8, 108, 15}, { 9, 391, -15}, {10, 781, 16},
- {10, 780, -16}, { 0, 0, 0}
+ { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 11, 2},
+ { 4, 10, -2}, { 4, 8, 3}, { 4, 7, -3}, { 4, 4, 4},
+ { 4, 1, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 19, 6},
+ { 5, 18, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 1, 8},
+ { 5, 0, -8}, { 6, 50, 9}, { 6, 49, -9}, { 6, 26, 10},
+ { 6, 21,-10}, { 7, 103, 11}, { 7, 102,-11}, { 7, 96, 12},
+ { 7, 55,-12}, { 7, 41, 13}, { 7, 40,-13}, { 8, 194, 14},
+ { 8, 109,-14}, { 8, 108, 15}, { 9, 391,-15}, {10, 781, 16},
+ {10, 780,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_33[] =
{
- { 4, 13, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2},
- { 4, 7, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 2, 4},
- { 4, 1, -4}, { 5, 30, 5}, { 5, 29, -5}, { 5, 25, 6},
- { 5, 24, -6}, { 5, 19, 7}, { 5, 18, -7}, { 5, 11, 8},
- { 5, 10, -8}, { 5, 0, 9}, { 6, 63, -9}, { 6, 62, 10},
- { 6, 57, -10}, { 6, 27, 11}, { 6, 26, -11}, { 6, 24, 12},
- { 6, 3, -12}, { 7, 113, 13}, { 7, 112, -13}, { 7, 50, 14},
- { 7, 5, -14}, { 7, 4, 15}, { 8, 103, -15}, { 9, 205, 16},
- { 9, 204, -16}, { 0, 0, 0}
+ { 4, 13, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2},
+ { 4, 7, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 2, 4},
+ { 4, 1, -4}, { 5, 30, 5}, { 5, 29, -5}, { 5, 25, 6},
+ { 5, 24, -6}, { 5, 19, 7}, { 5, 18, -7}, { 5, 11, 8},
+ { 5, 10, -8}, { 5, 0, 9}, { 6, 63, -9}, { 6, 62, 10},
+ { 6, 57,-10}, { 6, 27, 11}, { 6, 26,-11}, { 6, 24, 12},
+ { 6, 3,-12}, { 7, 113, 13}, { 7, 112,-13}, { 7, 50, 14},
+ { 7, 5,-14}, { 7, 4, 15}, { 8, 103,-15}, { 9, 205, 16},
+ { 9, 204,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_d_33[] =
{
- { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
- { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
- { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
- { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8},
- { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 469, 10},
- { 9, 468, -10}, {10, 941, 11}, {10, 940, -11}, {11, 1885, 12},
- {11, 1884, -12}, {12, 3773, 13}, {12, 3772, -13}, {13, 7551, 14},
- {13, 7550, -14}, {14, 15099, 15}, {14, 15098, -15}, {14, 15097, 16},
- {14, 15096, -16}, { 0, 0, 0}
+ { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
+ { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
+ { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8},
+ { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 469, 10},
+ { 9, 468,-10}, {10, 941, 11}, {10, 940,-11}, {11, 1885, 12},
+ {11, 1884,-12}, {12, 3773, 13}, {12, 3772,-13}, {13, 7551, 14},
+ {13, 7550,-14}, {14, 15099, 15}, {14, 15098,-15}, {14, 15097, 16},
+ {14, 15096,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_e_33[] =
{
- { 2, 2, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 12, 2},
- { 4, 7, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 27, 4},
- { 5, 26, -4}, { 5, 3, 5}, { 5, 2, -5}, { 6, 59, 6},
- { 6, 58, -6}, { 6, 27, 7}, { 6, 26, -7}, { 7, 123, 8},
- { 7, 122, -8}, { 7, 120, 9}, { 7, 115, -9}, { 7, 112, 10},
- { 7, 51, -10}, { 7, 49, 11}, { 7, 48, -11}, { 8, 242, 12},
- { 8, 229, -12}, { 8, 227, 13}, { 8, 226, -13}, { 8, 101, 14},
- { 8, 100, -14}, { 9, 487, 15}, { 9, 486, -15}, { 9, 457, 16},
- { 9, 456, -16}, { 0, 0, 0}
+ { 2, 2, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 12, 2},
+ { 4, 7, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 27, 4},
+ { 5, 26, -4}, { 5, 3, 5}, { 5, 2, -5}, { 6, 59, 6},
+ { 6, 58, -6}, { 6, 27, 7}, { 6, 26, -7}, { 7, 123, 8},
+ { 7, 122, -8}, { 7, 120, 9}, { 7, 115, -9}, { 7, 112, 10},
+ { 7, 51,-10}, { 7, 49, 11}, { 7, 48,-11}, { 8, 242, 12},
+ { 8, 229,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 101, 14},
+ { 8, 100,-14}, { 9, 487, 15}, { 9, 486,-15}, { 9, 457, 16},
+ { 9, 456,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_f_33[] =
{
- { 4, 13, 0}, { 4, 12, 1}, { 4, 11, -1}, { 4, 9, 2},
- { 4, 8, -2}, { 4, 7, 3}, { 4, 6, -3}, { 4, 4, 4},
- { 4, 3, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 30, 6},
- { 5, 29, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 10, 8},
- { 5, 5, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10},
- { 6, 23, -10}, { 6, 9, 11}, { 6, 8, -11}, { 7, 45, 12},
- { 7, 44, -12}, { 8, 230, 13}, { 8, 229, -13}, { 9, 463, 14},
- { 9, 462, -14}, { 9, 456, 15}, {10, 915, -15}, {11, 1829, 16},
- {11, 1828, -16}, { 0, 0, 0}
+ { 4, 13, 0}, { 4, 12, 1}, { 4, 11, -1}, { 4, 9, 2},
+ { 4, 8, -2}, { 4, 7, 3}, { 4, 6, -3}, { 4, 4, 4},
+ { 4, 3, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 30, 6},
+ { 5, 29, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 10, 8},
+ { 5, 5, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10},
+ { 6, 23,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 45, 12},
+ { 7, 44,-12}, { 8, 230, 13}, { 8, 229,-13}, { 9, 463, 14},
+ { 9, 462,-14}, { 9, 456, 15}, {10, 915,-15}, {11, 1829, 16},
+ {11, 1828,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_g_33[] =
{
- { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2},
- { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4},
- { 4, 0, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 6, 6},
- { 5, 5, -6}, { 6, 46, 7}, { 6, 41, -7}, { 6, 14, 8},
- { 6, 9, -8}, { 7, 94, 9}, { 7, 81, -9}, { 7, 30, 10},
- { 7, 17, -10}, { 8, 191, 11}, { 8, 190, -11}, { 8, 63, 12},
- { 8, 62, -12}, { 8, 32, 13}, { 9, 323, -13}, { 9, 321, 14},
- { 9, 320, -14}, { 9, 67, 15}, { 9, 66, -15}, {10, 645, 16},
- {10, 644, -16}, { 0, 0, 0}
+ { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4},
+ { 4, 0, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 6, 6},
+ { 5, 5, -6}, { 6, 46, 7}, { 6, 41, -7}, { 6, 14, 8},
+ { 6, 9, -8}, { 7, 94, 9}, { 7, 81, -9}, { 7, 30, 10},
+ { 7, 17,-10}, { 8, 191, 11}, { 8, 190,-11}, { 8, 63, 12},
+ { 8, 62,-12}, { 8, 32, 13}, { 9, 323,-13}, { 9, 321, 14},
+ { 9, 320,-14}, { 9, 67, 15}, { 9, 66,-15}, {10, 645, 16},
+ {10, 644,-16}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_65[] =
{
- { 4, 6, 0}, { 4, 5, 1}, { 4, 4, -1}, { 4, 2, 2},
- { 4, 1, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 29, 4},
- { 5, 28, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 24, 6},
- { 5, 23, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 18, 8},
- { 5, 17, -8}, { 5, 14, 9}, { 5, 7, -9}, { 5, 6, 10},
- { 6, 61, -10}, { 6, 50, 11}, { 6, 45, -11}, { 6, 38, 12},
- { 6, 33, -12}, { 6, 31, 13}, { 6, 30, -13}, { 7, 120, 14},
- { 7, 103, -14}, { 7, 89, 15}, { 7, 88, -15}, { 7, 65, 16},
- { 7, 64, -16}, { 8, 205, 17}, { 8, 204, -17}, { 8, 157, 18},
- { 8, 156, -18}, { 9, 486, 19}, { 9, 485, -19}, { 9, 318, 20},
- { 9, 317, -20}, {10, 975, 21}, {10, 974, -21}, {10, 639, 22},
- {10, 638, -22}, {11, 1939, 23}, {11, 1938, -23}, {11, 1936, 24},
- {11, 1267, -24}, {11, 1264, 25}, {12, 3875, -25}, {12, 2532, 26},
- {12, 2531, -26}, {13, 7749, 27}, {13, 7748, -27}, {13, 5061, 28},
- {13, 5060, -28}, {14, 10133, 29}, {14, 10132, -29}, {15, 20269, 30},
- {15, 20268, -30}, {16, 40543, 31}, {16, 40542, -31}, {16, 40541, 32},
- {16, 40540, -32}, { 0, 0, 0}
+ { 4, 6, 0}, { 4, 5, 1}, { 4, 4, -1}, { 4, 2, 2},
+ { 4, 1, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 29, 4},
+ { 5, 28, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 24, 6},
+ { 5, 23, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 18, 8},
+ { 5, 17, -8}, { 5, 14, 9}, { 5, 7, -9}, { 5, 6, 10},
+ { 6, 61,-10}, { 6, 50, 11}, { 6, 45,-11}, { 6, 38, 12},
+ { 6, 33,-12}, { 6, 31, 13}, { 6, 30,-13}, { 7, 120, 14},
+ { 7, 103,-14}, { 7, 89, 15}, { 7, 88,-15}, { 7, 65, 16},
+ { 7, 64,-16}, { 8, 205, 17}, { 8, 204,-17}, { 8, 157, 18},
+ { 8, 156,-18}, { 9, 486, 19}, { 9, 485,-19}, { 9, 318, 20},
+ { 9, 317,-20}, {10, 975, 21}, {10, 974,-21}, {10, 639, 22},
+ {10, 638,-22}, {11, 1939, 23}, {11, 1938,-23}, {11, 1936, 24},
+ {11, 1267,-24}, {11, 1264, 25}, {12, 3875,-25}, {12, 2532, 26},
+ {12, 2531,-26}, {13, 7749, 27}, {13, 7748,-27}, {13, 5061, 28},
+ {13, 5060,-28}, {14, 10133, 29}, {14, 10132,-29}, {15, 20269, 30},
+ {15, 20268,-30}, {16, 40543, 31}, {16, 40542,-31}, {16, 40541, 32},
+ {16, 40540,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_65[] =
{
- { 4, 4, 0}, { 4, 2, 1}, { 4, 1, -1}, { 5, 30, 2},
- { 5, 29, -2}, { 5, 26, 3}, { 5, 25, -3}, { 5, 23, 4},
- { 5, 22, -4}, { 5, 19, 5}, { 5, 18, -5}, { 5, 16, 6},
- { 5, 15, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 7, 8},
- { 5, 6, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10},
- { 6, 55, -10}, { 6, 49, 11}, { 6, 48, -11}, { 6, 41, 12},
- { 6, 40, -12}, { 6, 34, 13}, { 6, 29, -13}, { 6, 26, 14},
- { 6, 21, -14}, { 6, 20, 15}, { 6, 3, -15}, { 6, 0, 16},
- { 7, 115, -16}, { 7, 109, 17}, { 7, 108, -17}, { 7, 86, 18},
- { 7, 85, -18}, { 7, 70, 19}, { 7, 57, -19}, { 7, 56, 20},
- { 7, 55, -20}, { 7, 4, 21}, { 7, 3, -21}, { 8, 229, 22},
- { 8, 228, -22}, { 8, 175, 23}, { 8, 174, -23}, { 8, 143, 24},
- { 8, 142, -24}, { 8, 108, 25}, { 8, 11, -25}, { 8, 10, 26},
- { 8, 5, -26}, { 9, 339, 27}, { 9, 338, -27}, { 9, 336, 28},
- { 9, 219, -28}, { 9, 9, 29}, { 9, 8, -29}, {10, 674, 30},
- {10, 437, -30}, {10, 436, 31}, {11, 1351, -31}, {12, 2701, 32},
- {12, 2700, -32}, { 0, 0, 0}
+ { 4, 4, 0}, { 4, 2, 1}, { 4, 1, -1}, { 5, 30, 2},
+ { 5, 29, -2}, { 5, 26, 3}, { 5, 25, -3}, { 5, 23, 4},
+ { 5, 22, -4}, { 5, 19, 5}, { 5, 18, -5}, { 5, 16, 6},
+ { 5, 15, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 7, 8},
+ { 5, 6, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10},
+ { 6, 55,-10}, { 6, 49, 11}, { 6, 48,-11}, { 6, 41, 12},
+ { 6, 40,-12}, { 6, 34, 13}, { 6, 29,-13}, { 6, 26, 14},
+ { 6, 21,-14}, { 6, 20, 15}, { 6, 3,-15}, { 6, 0, 16},
+ { 7, 115,-16}, { 7, 109, 17}, { 7, 108,-17}, { 7, 86, 18},
+ { 7, 85,-18}, { 7, 70, 19}, { 7, 57,-19}, { 7, 56, 20},
+ { 7, 55,-20}, { 7, 4, 21}, { 7, 3,-21}, { 8, 229, 22},
+ { 8, 228,-22}, { 8, 175, 23}, { 8, 174,-23}, { 8, 143, 24},
+ { 8, 142,-24}, { 8, 108, 25}, { 8, 11,-25}, { 8, 10, 26},
+ { 8, 5,-26}, { 9, 339, 27}, { 9, 338,-27}, { 9, 336, 28},
+ { 9, 219,-28}, { 9, 9, 29}, { 9, 8,-29}, {10, 674, 30},
+ {10, 437,-30}, {10, 436, 31}, {11, 1351,-31}, {12, 2701, 32},
+ {12, 2700,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_65[] =
{
- { 5, 28, 0}, { 5, 25, 1}, { 5, 24, -1}, { 5, 23, 2},
- { 5, 22, -2}, { 5, 19, 3}, { 5, 18, -3}, { 5, 16, 4},
- { 5, 15, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 10, 6},
- { 5, 9, -6}, { 5, 7, 7}, { 5, 6, -7}, { 5, 4, 8},
- { 5, 3, -8}, { 5, 1, 9}, { 5, 0, -9}, { 6, 62, 10},
- { 6, 61, -10}, { 6, 59, 11}, { 6, 58, -11}, { 6, 54, 12},
- { 6, 53, -12}, { 6, 43, 13}, { 6, 42, -13}, { 6, 40, 14},
- { 6, 35, -14}, { 6, 29, 15}, { 6, 28, -15}, { 6, 17, 16},
- { 6, 16, -16}, { 6, 11, 17}, { 6, 10, -17}, { 6, 4, 18},
- { 7, 127, -18}, { 7, 121, 19}, { 7, 120, -19}, { 7, 110, 20},
- { 7, 105, -20}, { 7, 83, 21}, { 7, 82, -21}, { 7, 68, 22},
- { 7, 47, -22}, { 7, 46, 23}, { 7, 45, -23}, { 7, 11, 24},
- { 7, 10, -24}, { 8, 252, 25}, { 8, 223, -25}, { 8, 209, 26},
- { 8, 208, -26}, { 8, 138, 27}, { 8, 89, -27}, { 8, 88, 28},
- { 9, 507, -28}, { 9, 445, 29}, { 9, 444, -29}, { 9, 278, 30},
- {10, 1013, -30}, {10, 1012, 31}, {10, 559, -31}, {11, 1117, 32},
- {11, 1116, -32}, { 0, 0, 0}
+ { 5, 28, 0}, { 5, 25, 1}, { 5, 24, -1}, { 5, 23, 2},
+ { 5, 22, -2}, { 5, 19, 3}, { 5, 18, -3}, { 5, 16, 4},
+ { 5, 15, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 10, 6},
+ { 5, 9, -6}, { 5, 7, 7}, { 5, 6, -7}, { 5, 4, 8},
+ { 5, 3, -8}, { 5, 1, 9}, { 5, 0, -9}, { 6, 62, 10},
+ { 6, 61,-10}, { 6, 59, 11}, { 6, 58,-11}, { 6, 54, 12},
+ { 6, 53,-12}, { 6, 43, 13}, { 6, 42,-13}, { 6, 40, 14},
+ { 6, 35,-14}, { 6, 29, 15}, { 6, 28,-15}, { 6, 17, 16},
+ { 6, 16,-16}, { 6, 11, 17}, { 6, 10,-17}, { 6, 4, 18},
+ { 7, 127,-18}, { 7, 121, 19}, { 7, 120,-19}, { 7, 110, 20},
+ { 7, 105,-20}, { 7, 83, 21}, { 7, 82,-21}, { 7, 68, 22},
+ { 7, 47,-22}, { 7, 46, 23}, { 7, 45,-23}, { 7, 11, 24},
+ { 7, 10,-24}, { 8, 252, 25}, { 8, 223,-25}, { 8, 209, 26},
+ { 8, 208,-26}, { 8, 138, 27}, { 8, 89,-27}, { 8, 88, 28},
+ { 9, 507,-28}, { 9, 445, 29}, { 9, 444,-29}, { 9, 278, 30},
+ {10, 1013,-30}, {10, 1012, 31}, {10, 559,-31}, {11, 1117, 32},
+ {11, 1116,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_d_65[] =
{
- { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2},
- { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4},
- { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6},
- { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8},
- { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10},
- { 7, 114, -10}, { 7, 83, 11}, { 7, 82, -11}, { 7, 35, 12},
- { 7, 34, -12}, { 8, 227, 13}, { 8, 226, -13}, { 8, 163, 14},
- { 8, 162, -14}, { 8, 160, 15}, { 8, 67, -15}, { 8, 64, 16},
- { 9, 451, -16}, { 9, 448, 17}, { 9, 323, -17}, { 9, 132, 18},
- { 9, 131, -18}, {10, 900, 19}, {10, 899, -19}, {10, 644, 20},
- {10, 267, -20}, {10, 261, 21}, {10, 260, -21}, {11, 1797, 22},
- {11, 1796, -22}, {11, 533, 23}, {11, 532, -23}, {12, 3605, 24},
- {12, 3604, -24}, {12, 2582, 25}, {12, 2581, -25}, {13, 7215, 26},
- {13, 7214, -26}, {13, 5167, 27}, {13, 5166, -27}, {13, 5160, 28},
- {14, 14427, -28}, {14, 10323, 29}, {14, 10322, -29}, {15, 28853, 30},
- {15, 28852, -30}, {15, 28851, 31}, {15, 28850, -31}, {15, 28849, 32},
- {15, 28848, -32}, { 0, 0, 0}
+ { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2},
+ { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4},
+ { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6},
+ { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8},
+ { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10},
+ { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12},
+ { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 163, 14},
+ { 8, 162,-14}, { 8, 160, 15}, { 8, 67,-15}, { 8, 64, 16},
+ { 9, 451,-16}, { 9, 448, 17}, { 9, 323,-17}, { 9, 132, 18},
+ { 9, 131,-18}, {10, 900, 19}, {10, 899,-19}, {10, 644, 20},
+ {10, 267,-20}, {10, 261, 21}, {10, 260,-21}, {11, 1797, 22},
+ {11, 1796,-22}, {11, 533, 23}, {11, 532,-23}, {12, 3605, 24},
+ {12, 3604,-24}, {12, 2582, 25}, {12, 2581,-25}, {13, 7215, 26},
+ {13, 7214,-26}, {13, 5167, 27}, {13, 5166,-27}, {13, 5160, 28},
+ {14, 14427,-28}, {14, 10323, 29}, {14, 10322,-29}, {15, 28853, 30},
+ {15, 28852,-30}, {15, 28851, 31}, {15, 28850,-31}, {15, 28849, 32},
+ {15, 28848,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_e_65[] =
{
- { 3, 4, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 7, 2},
- { 4, 6, -2}, { 5, 29, 3}, { 5, 28, -3}, { 5, 23, 4},
- { 5, 22, -4}, { 5, 10, 5}, { 5, 9, -5}, { 5, 6, 6},
- { 5, 5, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 48, 8},
- { 6, 43, -8}, { 6, 40, 9}, { 6, 23, -9}, { 6, 16, 10},
- { 6, 15, -10}, { 6, 9, 11}, { 6, 8, -11}, { 7, 105, 12},
- { 7, 104, -12}, { 7, 100, 13}, { 7, 99, -13}, { 7, 84, 14},
- { 7, 83, -14}, { 7, 45, 15}, { 7, 44, -15}, { 7, 29, 16},
- { 7, 28, -16}, { 8, 221, 17}, { 8, 220, -17}, { 8, 206, 18},
- { 8, 205, -18}, { 8, 202, 19}, { 8, 197, -19}, { 8, 171, 20},
- { 8, 170, -20}, { 8, 164, 21}, { 8, 71, -21}, { 8, 69, 22},
- { 8, 68, -22}, { 9, 446, 23}, { 9, 445, -23}, { 9, 415, 24},
- { 9, 414, -24}, { 9, 408, 25}, { 9, 407, -25}, { 9, 393, 26},
- { 9, 392, -26}, { 9, 331, 27}, { 9, 330, -27}, { 9, 141, 28},
- { 9, 140, -28}, {10, 895, 29}, {10, 894, -29}, {10, 889, 30},
- {10, 888, -30}, {10, 819, 31}, {10, 818, -31}, {10, 813, 32},
- {10, 812, -32}, { 0, 0, 0}
+ { 3, 4, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 7, 2},
+ { 4, 6, -2}, { 5, 29, 3}, { 5, 28, -3}, { 5, 23, 4},
+ { 5, 22, -4}, { 5, 10, 5}, { 5, 9, -5}, { 5, 6, 6},
+ { 5, 5, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 48, 8},
+ { 6, 43, -8}, { 6, 40, 9}, { 6, 23, -9}, { 6, 16, 10},
+ { 6, 15,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 105, 12},
+ { 7, 104,-12}, { 7, 100, 13}, { 7, 99,-13}, { 7, 84, 14},
+ { 7, 83,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 29, 16},
+ { 7, 28,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 206, 18},
+ { 8, 205,-18}, { 8, 202, 19}, { 8, 197,-19}, { 8, 171, 20},
+ { 8, 170,-20}, { 8, 164, 21}, { 8, 71,-21}, { 8, 69, 22},
+ { 8, 68,-22}, { 9, 446, 23}, { 9, 445,-23}, { 9, 415, 24},
+ { 9, 414,-24}, { 9, 408, 25}, { 9, 407,-25}, { 9, 393, 26},
+ { 9, 392,-26}, { 9, 331, 27}, { 9, 330,-27}, { 9, 141, 28},
+ { 9, 140,-28}, {10, 895, 29}, {10, 894,-29}, {10, 889, 30},
+ {10, 888,-30}, {10, 819, 31}, {10, 818,-31}, {10, 813, 32},
+ {10, 812,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_f_65[] =
{
- { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2},
- { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4},
- { 4, 0, -4}, { 5, 21, 5}, { 5, 20, -5}, { 5, 5, 6},
- { 5, 4, -6}, { 6, 45, 7}, { 6, 44, -7}, { 6, 13, 8},
- { 6, 12, -8}, { 7, 93, 9}, { 7, 92, -9}, { 7, 29, 10},
- { 7, 28, -10}, { 8, 189, 11}, { 8, 188, -11}, { 8, 61, 12},
- { 8, 60, -12}, { 9, 381, 13}, { 9, 380, -13}, { 9, 125, 14},
- { 9, 124, -14}, {10, 765, 15}, {10, 764, -15}, {10, 252, 16},
- {11, 1535, -16}, {11, 1532, 17}, {11, 511, -17}, {11, 506, 18},
- {12, 3069, -18}, {12, 3067, 19}, {12, 3066, -19}, {12, 1015, 20},
- {12, 1014, -20}, {13, 6136, 21}, {13, 2043, -21}, {13, 2035, 22},
- {13, 2034, -22}, {14, 12275, 23}, {14, 12274, -23}, {14, 4085, 24},
- {14, 4084, -24}, {14, 4083, 25}, {14, 4082, -25}, {14, 4081, 26},
- {14, 4080, -26}, {14, 4079, 27}, {14, 4078, -27}, {14, 4077, 28},
- {14, 4076, -28}, {14, 4075, 29}, {14, 4074, -29}, {14, 4073, 30},
- {14, 4072, -30}, {14, 4067, 31}, {14, 4066, -31}, {14, 4065, 32},
- {14, 4064, -32}, { 0, 0, 0}
+ { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4},
+ { 4, 0, -4}, { 5, 21, 5}, { 5, 20, -5}, { 5, 5, 6},
+ { 5, 4, -6}, { 6, 45, 7}, { 6, 44, -7}, { 6, 13, 8},
+ { 6, 12, -8}, { 7, 93, 9}, { 7, 92, -9}, { 7, 29, 10},
+ { 7, 28,-10}, { 8, 189, 11}, { 8, 188,-11}, { 8, 61, 12},
+ { 8, 60,-12}, { 9, 381, 13}, { 9, 380,-13}, { 9, 125, 14},
+ { 9, 124,-14}, {10, 765, 15}, {10, 764,-15}, {10, 252, 16},
+ {11, 1535,-16}, {11, 1532, 17}, {11, 511,-17}, {11, 506, 18},
+ {12, 3069,-18}, {12, 3067, 19}, {12, 3066,-19}, {12, 1015, 20},
+ {12, 1014,-20}, {13, 6136, 21}, {13, 2043,-21}, {13, 2035, 22},
+ {13, 2034,-22}, {14, 12275, 23}, {14, 12274,-23}, {14, 4085, 24},
+ {14, 4084,-24}, {14, 4083, 25}, {14, 4082,-25}, {14, 4081, 26},
+ {14, 4080,-26}, {14, 4079, 27}, {14, 4078,-27}, {14, 4077, 28},
+ {14, 4076,-28}, {14, 4075, 29}, {14, 4074,-29}, {14, 4073, 30},
+ {14, 4072,-30}, {14, 4067, 31}, {14, 4066,-31}, {14, 4065, 32},
+ {14, 4064,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_g_65[] =
{
- { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2},
- { 4, 6, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 0, 4},
- { 5, 31, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 18, 6},
- { 5, 15, -6}, { 5, 10, 7}, { 5, 5, -7}, { 5, 2, 8},
- { 6, 61, -8}, { 6, 54, 9}, { 6, 49, -9}, { 6, 38, 10},
- { 6, 29, -10}, { 6, 22, 11}, { 6, 9, -11}, { 6, 6, 12},
- { 7, 121, -12}, { 7, 110, 13}, { 7, 97, -13}, { 7, 78, 14},
- { 7, 57, -14}, { 7, 46, 15}, { 7, 17, -15}, { 7, 14, 16},
- { 8, 241, -16}, { 8, 223, 17}, { 8, 222, -17}, { 8, 159, 18},
- { 8, 158, -18}, { 8, 95, 19}, { 8, 94, -19}, { 8, 31, 20},
- { 8, 30, -20}, { 9, 480, 21}, { 9, 387, -21}, { 9, 384, 22},
- { 9, 227, -22}, { 9, 225, 23}, { 9, 224, -23}, { 9, 65, 24},
- { 9, 64, -24}, {10, 962, 25}, {10, 773, -25}, {10, 771, 26},
- {10, 770, -26}, {10, 452, 27}, {10, 135, -27}, {10, 133, 28},
- {10, 132, -28}, {11, 1927, 29}, {11, 1926, -29}, {11, 1545, 30},
- {11, 1544, -30}, {11, 907, 31}, {11, 906, -31}, {11, 269, 32},
- {11, 268, -32}, { 0, 0, 0}
+ { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2},
+ { 4, 6, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 0, 4},
+ { 5, 31, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 18, 6},
+ { 5, 15, -6}, { 5, 10, 7}, { 5, 5, -7}, { 5, 2, 8},
+ { 6, 61, -8}, { 6, 54, 9}, { 6, 49, -9}, { 6, 38, 10},
+ { 6, 29,-10}, { 6, 22, 11}, { 6, 9,-11}, { 6, 6, 12},
+ { 7, 121,-12}, { 7, 110, 13}, { 7, 97,-13}, { 7, 78, 14},
+ { 7, 57,-14}, { 7, 46, 15}, { 7, 17,-15}, { 7, 14, 16},
+ { 8, 241,-16}, { 8, 223, 17}, { 8, 222,-17}, { 8, 159, 18},
+ { 8, 158,-18}, { 8, 95, 19}, { 8, 94,-19}, { 8, 31, 20},
+ { 8, 30,-20}, { 9, 480, 21}, { 9, 387,-21}, { 9, 384, 22},
+ { 9, 227,-22}, { 9, 225, 23}, { 9, 224,-23}, { 9, 65, 24},
+ { 9, 64,-24}, {10, 962, 25}, {10, 773,-25}, {10, 771, 26},
+ {10, 770,-26}, {10, 452, 27}, {10, 135,-27}, {10, 133, 28},
+ {10, 132,-28}, {11, 1927, 29}, {11, 1926,-29}, {11, 1545, 30},
+ {11, 1544,-30}, {11, 907, 31}, {11, 906,-31}, {11, 269, 32},
+ {11, 268,-32}, { 0, 0, 0}
};
huff_entry_t bitalloc_a_129[] =
{
- { 4, 8, 0}, { 4, 10, 1}, { 4, 9, -1}, { 4, 0, 2},
- { 5, 31, -2}, { 5, 24, 3}, { 5, 23, -3}, { 5, 12, 4},
- { 5, 11, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 60, 6},
- { 6, 58, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 45, 8},
- { 6, 44, -8}, { 6, 28, 9}, { 6, 27, -9}, { 6, 19, 10},
- { 6, 18, -10}, { 6, 14, 11}, { 6, 13, -11}, { 6, 6, 12},
- { 6, 5, -12}, { 7, 122, 13}, { 7, 119, -13}, { 7, 113, 14},
- { 7, 112, -14}, { 7, 104, 15}, { 7, 103, -15}, { 7, 100, 16},
- { 7, 63, -16}, { 7, 60, 17}, { 7, 59, -17}, { 7, 52, 18},
- { 7, 43, -18}, { 7, 40, 19}, { 7, 35, -19}, { 7, 32, 20},
- { 7, 31, -20}, { 7, 15, 21}, { 7, 14, -21}, { 8, 247, 22},
- { 8, 246, -22}, { 8, 231, 23}, { 8, 230, -23}, { 8, 223, 24},
- { 8, 222, -24}, { 8, 211, 25}, { 8, 210, -25}, { 8, 203, 26},
- { 8, 202, -26}, { 8, 123, 27}, { 8, 122, -27}, { 8, 116, 28},
- { 8, 107, -28}, { 8, 84, 29}, { 8, 83, -29}, { 8, 68, 30},
- { 8, 67, -30}, { 8, 60, 31}, { 8, 51, -31}, { 8, 49, 32},
- { 8, 48, -32}, { 8, 17, 33}, { 8, 16, -33}, { 9, 474, 34},
- { 9, 473, -34}, { 9, 458, 35}, { 9, 457, -35}, { 9, 442, 36},
- { 9, 441, -36}, { 9, 411, 37}, { 9, 410, -37}, { 9, 251, 38},
- { 9, 250, -38}, { 9, 248, 39}, { 9, 235, -39}, { 9, 213, 40},
- { 9, 212, -40}, { 9, 170, 41}, { 9, 165, -41}, { 9, 139, 42},
- { 9, 138, -42}, { 9, 132, 43}, { 9, 123, -43}, { 9, 101, 44},
- { 9, 100, -44}, { 9, 37, 45}, { 9, 36, -45}, {10, 950, 46},
- {10, 945, -46}, {10, 919, 47}, {10, 918, -47}, {10, 912, 48},
- {10, 887, -48}, {10, 881, 49}, {10, 880, -49}, {10, 818, 50},
- {10, 817, -50}, {10, 499, 51}, {10, 498, -51}, {10, 469, 52},
- {10, 468, -52}, {10, 343, 53}, {10, 342, -53}, {10, 329, 54},
- {10, 328, -54}, {10, 267, 55}, {10, 266, -55}, {10, 245, 56},
- {10, 244, -56}, {10, 79, 57}, {10, 78, -57}, {10, 77, 58},
- {10, 76, -58}, {11, 1903, 59}, {11, 1902, -59}, {11, 1889, 60},
- {11, 1888, -60}, {11, 1827, 61}, {11, 1826, -61}, {11, 1773, 62},
- {11, 1772, -62}, {11, 1639, 63}, {11, 1638, -63}, {11, 1633, 64},
- {11, 1632, -64}, { 0, 0, 0}
+ { 4, 8, 0}, { 4, 10, 1}, { 4, 9, -1}, { 4, 0, 2},
+ { 5, 31, -2}, { 5, 24, 3}, { 5, 23, -3}, { 5, 12, 4},
+ { 5, 11, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 60, 6},
+ { 6, 58, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 45, 8},
+ { 6, 44, -8}, { 6, 28, 9}, { 6, 27, -9}, { 6, 19, 10},
+ { 6, 18,-10}, { 6, 14, 11}, { 6, 13,-11}, { 6, 6, 12},
+ { 6, 5,-12}, { 7, 122, 13}, { 7, 119,-13}, { 7, 113, 14},
+ { 7, 112,-14}, { 7, 104, 15}, { 7, 103,-15}, { 7, 100, 16},
+ { 7, 63,-16}, { 7, 60, 17}, { 7, 59,-17}, { 7, 52, 18},
+ { 7, 43,-18}, { 7, 40, 19}, { 7, 35,-19}, { 7, 32, 20},
+ { 7, 31,-20}, { 7, 15, 21}, { 7, 14,-21}, { 8, 247, 22},
+ { 8, 246,-22}, { 8, 231, 23}, { 8, 230,-23}, { 8, 223, 24},
+ { 8, 222,-24}, { 8, 211, 25}, { 8, 210,-25}, { 8, 203, 26},
+ { 8, 202,-26}, { 8, 123, 27}, { 8, 122,-27}, { 8, 116, 28},
+ { 8, 107,-28}, { 8, 84, 29}, { 8, 83,-29}, { 8, 68, 30},
+ { 8, 67,-30}, { 8, 60, 31}, { 8, 51,-31}, { 8, 49, 32},
+ { 8, 48,-32}, { 8, 17, 33}, { 8, 16,-33}, { 9, 474, 34},
+ { 9, 473,-34}, { 9, 458, 35}, { 9, 457,-35}, { 9, 442, 36},
+ { 9, 441,-36}, { 9, 411, 37}, { 9, 410,-37}, { 9, 251, 38},
+ { 9, 250,-38}, { 9, 248, 39}, { 9, 235,-39}, { 9, 213, 40},
+ { 9, 212,-40}, { 9, 170, 41}, { 9, 165,-41}, { 9, 139, 42},
+ { 9, 138,-42}, { 9, 132, 43}, { 9, 123,-43}, { 9, 101, 44},
+ { 9, 100,-44}, { 9, 37, 45}, { 9, 36,-45}, {10, 950, 46},
+ {10, 945,-46}, {10, 919, 47}, {10, 918,-47}, {10, 912, 48},
+ {10, 887,-48}, {10, 881, 49}, {10, 880,-49}, {10, 818, 50},
+ {10, 817,-50}, {10, 499, 51}, {10, 498,-51}, {10, 469, 52},
+ {10, 468,-52}, {10, 343, 53}, {10, 342,-53}, {10, 329, 54},
+ {10, 328,-54}, {10, 267, 55}, {10, 266,-55}, {10, 245, 56},
+ {10, 244,-56}, {10, 79, 57}, {10, 78,-57}, {10, 77, 58},
+ {10, 76,-58}, {11, 1903, 59}, {11, 1902,-59}, {11, 1889, 60},
+ {11, 1888,-60}, {11, 1827, 61}, {11, 1826,-61}, {11, 1773, 62},
+ {11, 1772,-62}, {11, 1639, 63}, {11, 1638,-63}, {11, 1633, 64},
+ {11, 1632,-64}, { 0, 0, 0}
};
huff_entry_t bitalloc_b_129[] =
{
- { 5, 10, 0}, { 5, 7, 1}, { 5, 6, -1}, { 5, 4, 2},
- { 5, 3, -2}, { 5, 0, 3}, { 6, 63, -3}, { 6, 60, 4},
- { 6, 59, -4}, { 6, 57, 5}, { 6, 56, -5}, { 6, 53, 6},
- { 6, 52, -6}, { 6, 50, 7}, { 6, 49, -7}, { 6, 46, 8},
- { 6, 45, -8}, { 6, 43, 9}, { 6, 42, -9}, { 6, 39, 10},
- { 6, 38, -10}, { 6, 35, 11}, { 6, 34, -11}, { 6, 32, 12},
- { 6, 31, -12}, { 6, 28, 13}, { 6, 27, -13}, { 6, 25, 14},
- { 6, 24, -14}, { 6, 22, 15}, { 6, 19, -15}, { 6, 16, 16},
- { 6, 11, -16}, { 6, 5, 17}, { 6, 4, -17}, { 7, 125, 18},
- { 7, 124, -18}, { 7, 122, 19}, { 7, 117, -19}, { 7, 110, 20},
- { 7, 109, -20}, { 7, 103, 21}, { 7, 102, -21}, { 7, 96, 22},
- { 7, 95, -22}, { 7, 89, 23}, { 7, 88, -23}, { 7, 81, 24},
- { 7, 80, -24}, { 7, 74, 25}, { 7, 73, -25}, { 7, 66, 26},
- { 7, 61, -26}, { 7, 59, 27}, { 7, 58, -27}, { 7, 52, 28},
- { 7, 47, -28}, { 7, 37, 29}, { 7, 36, -29}, { 7, 21, 30},
- { 7, 20, -30}, { 7, 6, 31}, { 7, 5, -31}, { 8, 247, 32},
- { 8, 246, -32}, { 8, 223, 33}, { 8, 222, -33}, { 8, 217, 34},
- { 8, 216, -34}, { 8, 189, 35}, { 8, 188, -35}, { 8, 166, 36},
- { 8, 165, -36}, { 8, 151, 37}, { 8, 150, -37}, { 8, 144, 38},
- { 8, 135, -38}, { 8, 121, 39}, { 8, 120, -39}, { 8, 106, 40},
- { 8, 93, -40}, { 8, 71, 41}, { 8, 70, -41}, { 8, 68, 42},
- { 8, 15, -42}, { 8, 9, 43}, { 8, 8, -43}, { 9, 466, 44},
- { 9, 465, -44}, { 9, 391, 45}, { 9, 390, -45}, { 9, 388, 46},
- { 9, 335, -46}, { 9, 329, 47}, { 9, 328, -47}, { 9, 269, 48},
- { 9, 268, -48}, { 9, 215, 49}, { 9, 214, -49}, { 9, 184, 50},
- { 9, 139, -50}, { 9, 29, 51}, { 9, 28, -51}, {10, 934, 52},
- {10, 929, -52}, {10, 779, 53}, {10, 778, -53}, {10, 668, 54},
- {10, 583, -54}, {10, 582, 55}, {10, 581, -55}, {10, 371, 56},
- {10, 370, -56}, {10, 276, 57}, {11, 1871, -57}, {11, 1857, 58},
- {11, 1856, -58}, {11, 1338, 59}, {11, 1161, -59}, {11, 1160, 60},
- {11, 555, -60}, {12, 3741, 61}, {12, 3740, -61}, {12, 2678, 62},
- {12, 1109, -62}, {12, 1108, 63}, {13, 5359, -63}, {14, 10717, 64},
- {14, 10716, -64}, { 0, 0, 0}
+ { 5, 10, 0}, { 5, 7, 1}, { 5, 6, -1}, { 5, 4, 2},
+ { 5, 3, -2}, { 5, 0, 3}, { 6, 63, -3}, { 6, 60, 4},
+ { 6, 59, -4}, { 6, 57, 5}, { 6, 56, -5}, { 6, 53, 6},
+ { 6, 52, -6}, { 6, 50, 7}, { 6, 49, -7}, { 6, 46, 8},
+ { 6, 45, -8}, { 6, 43, 9}, { 6, 42, -9}, { 6, 39, 10},
+ { 6, 38,-10}, { 6, 35, 11}, { 6, 34,-11}, { 6, 32, 12},
+ { 6, 31,-12}, { 6, 28, 13}, { 6, 27,-13}, { 6, 25, 14},
+ { 6, 24,-14}, { 6, 22, 15}, { 6, 19,-15}, { 6, 16, 16},
+ { 6, 11,-16}, { 6, 5, 17}, { 6, 4,-17}, { 7, 125, 18},
+ { 7, 124,-18}, { 7, 122, 19}, { 7, 117,-19}, { 7, 110, 20},
+ { 7, 109,-20}, { 7, 103, 21}, { 7, 102,-21}, { 7, 96, 22},
+ { 7, 95,-22}, { 7, 89, 23}, { 7, 88,-23}, { 7, 81, 24},
+ { 7, 80,-24}, { 7, 74, 25}, { 7, 73,-25}, { 7, 66, 26},
+ { 7, 61,-26}, { 7, 59, 27}, { 7, 58,-27}, { 7, 52, 28},
+ { 7, 47,-28}, { 7, 37, 29}, { 7, 36,-29}, { 7, 21, 30},
+ { 7, 20,-30}, { 7, 6, 31}, { 7, 5,-31}, { 8, 247, 32},
+ { 8, 246,-32}, { 8, 223, 33}, { 8, 222,-33}, { 8, 217, 34},
+ { 8, 216,-34}, { 8, 189, 35}, { 8, 188,-35}, { 8, 166, 36},
+ { 8, 165,-36}, { 8, 151, 37}, { 8, 150,-37}, { 8, 144, 38},
+ { 8, 135,-38}, { 8, 121, 39}, { 8, 120,-39}, { 8, 106, 40},
+ { 8, 93,-40}, { 8, 71, 41}, { 8, 70,-41}, { 8, 68, 42},
+ { 8, 15,-42}, { 8, 9, 43}, { 8, 8,-43}, { 9, 466, 44},
+ { 9, 465,-44}, { 9, 391, 45}, { 9, 390,-45}, { 9, 388, 46},
+ { 9, 335,-46}, { 9, 329, 47}, { 9, 328,-47}, { 9, 269, 48},
+ { 9, 268,-48}, { 9, 215, 49}, { 9, 214,-49}, { 9, 184, 50},
+ { 9, 139,-50}, { 9, 29, 51}, { 9, 28,-51}, {10, 934, 52},
+ {10, 929,-52}, {10, 779, 53}, {10, 778,-53}, {10, 668, 54},
+ {10, 583,-54}, {10, 582, 55}, {10, 581,-55}, {10, 371, 56},
+ {10, 370,-56}, {10, 276, 57}, {11, 1871,-57}, {11, 1857, 58},
+ {11, 1856,-58}, {11, 1338, 59}, {11, 1161,-59}, {11, 1160, 60},
+ {11, 555,-60}, {12, 3741, 61}, {12, 3740,-61}, {12, 2678, 62},
+ {12, 1109,-62}, {12, 1108, 63}, {13, 5359,-63}, {14, 10717, 64},
+ {14, 10716,-64}, { 0, 0, 0}
};
huff_entry_t bitalloc_c_129[] =
{
- { 6, 58, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2},
- { 6, 51, -2}, { 6, 49, 3}, { 6, 48, -3}, { 6, 46, 4},
- { 6, 45, -4}, { 6, 43, 5}, { 6, 42, -5}, { 6, 40, 6},
- { 6, 39, -6}, { 6, 37, 7}, { 6, 36, -7}, { 6, 34, 8},
- { 6, 33, -8}, { 6, 30, 9}, { 6, 29, -9}, { 6, 27, 10},
- { 6, 26, -10}, { 6, 24, 11}, { 6, 23, -11}, { 6, 21, 12},
- { 6, 20, -12}, { 6, 18, 13}, { 6, 17, -13}, { 6, 14, 14},
- { 6, 13, -14}, { 6, 12, 15}, { 6, 11, -15}, { 6, 8, 16},
- { 6, 7, -16}, { 6, 6, 17}, { 6, 5, -17}, { 6, 3, 18},
- { 6, 2, -18}, { 7, 127, 19}, { 7, 126, -19}, { 7, 124, 20},
- { 7, 123, -20}, { 7, 121, 21}, { 7, 120, -21}, { 7, 118, 22},
- { 7, 115, -22}, { 7, 113, 23}, { 7, 112, -23}, { 7, 106, 24},
- { 7, 101, -24}, { 7, 95, 25}, { 7, 94, -25}, { 7, 88, 26},
- { 7, 83, -26}, { 7, 77, 27}, { 7, 76, -27}, { 7, 70, 28},
- { 7, 65, -28}, { 7, 64, 29}, { 7, 63, -29}, { 7, 56, 30},
- { 7, 51, -30}, { 7, 45, 31}, { 7, 44, -31}, { 7, 39, 32},
- { 7, 38, -32}, { 7, 31, 33}, { 7, 30, -33}, { 7, 20, 34},
- { 7, 19, -34}, { 7, 18, 35}, { 7, 9, -35}, { 7, 3, 36},
- { 7, 2, -36}, { 7, 0, 37}, { 8, 251, -37}, { 8, 245, 38},
- { 8, 244, -38}, { 8, 238, 39}, { 8, 229, -39}, { 8, 215, 40},
- { 8, 214, -40}, { 8, 200, 41}, { 8, 179, -41}, { 8, 165, 42},
- { 8, 164, -42}, { 8, 143, 43}, { 8, 142, -43}, { 8, 124, 44},
- { 8, 115, -44}, { 8, 101, 45}, { 8, 100, -45}, { 8, 66, 46},
- { 8, 65, -46}, { 8, 43, 47}, { 8, 42, -47}, { 8, 17, 48},
- { 8, 16, -48}, { 8, 2, 49}, { 9, 501, -49}, { 9, 479, 50},
- { 9, 478, -50}, { 9, 456, 51}, { 9, 403, -51}, { 9, 357, 52},
- { 9, 356, -52}, { 9, 251, 53}, { 9, 250, -53}, { 9, 228, 54},
- { 9, 135, -54}, { 9, 129, 55}, { 9, 128, -55}, { 9, 6, 56},
- {10, 1001, -56}, {10, 1000, 57}, {10, 915, -57}, {10, 805, 58},
- {10, 804, -58}, {10, 458, 59}, {10, 269, -59}, {10, 268, 60},
- {10, 15, -60}, {11, 1829, 61}, {11, 1828, -61}, {11, 918, 62},
- {11, 29, -62}, {11, 28, 63}, {12, 1839, -63}, {13, 3677, 64},
- {13, 3676, -64}, { 0, 0, 0}
+ { 6, 58, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2},
+ { 6, 51, -2}, { 6, 49, 3}, { 6, 48, -3}, { 6, 46, 4},
+ { 6, 45, -4}, { 6, 43, 5}, { 6, 42, -5}, { 6, 40, 6},
+ { 6, 39, -6}, { 6, 37, 7}, { 6, 36, -7}, { 6, 34, 8},
+ { 6, 33, -8}, { 6, 30, 9}, { 6, 29, -9}, { 6, 27, 10},
+ { 6, 26,-10}, { 6, 24, 11}, { 6, 23,-11}, { 6, 21, 12},
+ { 6, 20,-12}, { 6, 18, 13}, { 6, 17,-13}, { 6, 14, 14},
+ { 6, 13,-14}, { 6, 12, 15}, { 6, 11,-15}, { 6, 8, 16},
+ { 6, 7,-16}, { 6, 6, 17}, { 6, 5,-17}, { 6, 3, 18},
+ { 6, 2,-18}, { 7, 127, 19}, { 7, 126,-19}, { 7, 124, 20},
+ { 7, 123,-20}, { 7, 121, 21}, { 7, 120,-21}, { 7, 118, 22},
+ { 7, 115,-22}, { 7, 113, 23}, { 7, 112,-23}, { 7, 106, 24},
+ { 7, 101,-24}, { 7, 95, 25}, { 7, 94,-25}, { 7, 88, 26},
+ { 7, 83,-26}, { 7, 77, 27}, { 7, 76,-27}, { 7, 70, 28},
+ { 7, 65,-28}, { 7, 64, 29}, { 7, 63,-29}, { 7, 56, 30},
+ { 7, 51,-30}, { 7, 45, 31}, { 7, 44,-31}, { 7, 39, 32},
+ { 7, 38,-32}, { 7, 31, 33}, { 7, 30,-33}, { 7, 20, 34},
+ { 7, 19,-34}, { 7, 18, 35}, { 7, 9,-35}, { 7, 3, 36},
+ { 7, 2,-36}, { 7, 0, 37}, { 8, 251,-37}, { 8, 245, 38},
+ { 8, 244,-38}, { 8, 238, 39}, { 8, 229,-39}, { 8, 215, 40},
+ { 8, 214,-40}, { 8, 200, 41}, { 8, 179,-41}, { 8, 165, 42},
+ { 8, 164,-42}, { 8, 143, 43}, { 8, 142,-43}, { 8, 124, 44},
+ { 8, 115,-44}, { 8, 101, 45}, { 8, 100,-45}, { 8, 66, 46},
+ { 8, 65,-46}, { 8, 43, 47}, { 8, 42,-47}, { 8, 17, 48},
+ { 8, 16,-48}, { 8, 2, 49}, { 9, 501,-49}, { 9, 479, 50},
+ { 9, 478,-50}, { 9, 456, 51}, { 9, 403,-51}, { 9, 357, 52},
+ { 9, 356,-52}, { 9, 251, 53}, { 9, 250,-53}, { 9, 228, 54},
+ { 9, 135,-54}, { 9, 129, 55}, { 9, 128,-55}, { 9, 6, 56},
+ {10, 1001,-56}, {10, 1000, 57}, {10, 915,-57}, {10, 805, 58},
+ {10, 804,-58}, {10, 458, 59}, {10, 269,-59}, {10, 268, 60},
+ {10, 15,-60}, {11, 1829, 61}, {11, 1828,-61}, {11, 918, 62},
+ {11, 29,-62}, {11, 28, 63}, {12, 1839,-63}, {13, 3677, 64},
+ {13, 3676,-64}, { 0, 0, 0}
};
huff_entry_t bitalloc_d_129[] =
{
- { 4, 9, 0}, { 4, 6, 1}, { 4, 5, -1}, { 4, 2, 2},
- { 4, 1, -2}, { 5, 30, 3}, { 5, 29, -3}, { 5, 26, 4},
- { 5, 25, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 16, 6},
- { 5, 15, -6}, { 5, 8, 7}, { 5, 7, -7}, { 5, 0, 8},
- { 6, 63, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 48, 10},
- { 6, 47, -10}, { 6, 40, 11}, { 6, 35, -11}, { 6, 28, 12},
- { 6, 19, -12}, { 6, 12, 13}, { 6, 3, -13}, { 7, 124, 14},
- { 7, 115, -14}, { 7, 108, 15}, { 7, 99, -15}, { 7, 92, 16},
- { 7, 83, -16}, { 7, 68, 17}, { 7, 59, -17}, { 7, 36, 18},
- { 7, 27, -18}, { 7, 4, 19}, { 8, 251, -19}, { 8, 228, 20},
- { 8, 219, -20}, { 8, 196, 21}, { 8, 187, -21}, { 8, 164, 22},
- { 8, 139, -22}, { 8, 116, 23}, { 8, 75, -23}, { 8, 52, 24},
- { 8, 11, -24}, { 9, 501, 25}, { 9, 500, -25}, { 9, 437, 26},
- { 9, 436, -26}, { 9, 373, 27}, { 9, 372, -27}, { 9, 277, 28},
- { 9, 276, -28}, { 9, 149, 29}, { 9, 148, -29}, { 9, 21, 30},
- { 9, 20, -30}, {10, 917, 31}, {10, 916, -31}, {10, 789, 32},
- {10, 788, -32}, {10, 661, 33}, {10, 660, -33}, {10, 469, 34},
- {10, 468, -34}, {10, 214, 35}, {10, 213, -35}, {11, 1838, 36},
- {11, 1837, -36}, {11, 1582, 37}, {11, 1581, -37}, {11, 1326, 38},
- {11, 1325, -38}, {11, 942, 39}, {11, 941, -39}, {11, 431, 40},
- {11, 430, -40}, {12, 3679, 41}, {12, 3678, -41}, {12, 3167, 42},
- {12, 3166, -42}, {12, 3160, 43}, {12, 2655, -43}, {12, 2648, 44},
- {12, 1887, -44}, {12, 1880, 45}, {12, 851, -45}, {12, 849, 46},
- {12, 848, -46}, {13, 7346, 47}, {13, 7345, -47}, {13, 6322, 48},
- {13, 5309, -48}, {13, 3773, 49}, {13, 3772, -49}, {13, 3762, 50},
- {13, 1701, -50}, {14, 14695, 51}, {14, 14694, -51}, {14, 14688, 52},
- {14, 12647, -52}, {14, 10617, 53}, {14, 10616, -53}, {14, 10596, 54},
- {14, 7527, -54}, {14, 3401, 55}, {14, 3400, -55}, {15, 29378, 56},
- {15, 25293, -56}, {15, 21195, 57}, {15, 21194, -57}, {15, 15053, 58},
- {15, 15052, -58}, {16, 58759, 59}, {16, 58758, -59}, {16, 50585, 60},
- {16, 50584, -60}, {16, 42399, 61}, {16, 42398, -61}, {16, 42397, 62},
- {16, 42396, -62}, {16, 42395, 63}, {16, 42394, -63}, {16, 42393, 64},
- {16, 42392, -64}, { 0, 0, 0}
+ { 4, 9, 0}, { 4, 6, 1}, { 4, 5, -1}, { 4, 2, 2},
+ { 4, 1, -2}, { 5, 30, 3}, { 5, 29, -3}, { 5, 26, 4},
+ { 5, 25, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 16, 6},
+ { 5, 15, -6}, { 5, 8, 7}, { 5, 7, -7}, { 5, 0, 8},
+ { 6, 63, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 48, 10},
+ { 6, 47,-10}, { 6, 40, 11}, { 6, 35,-11}, { 6, 28, 12},
+ { 6, 19,-12}, { 6, 12, 13}, { 6, 3,-13}, { 7, 124, 14},
+ { 7, 115,-14}, { 7, 108, 15}, { 7, 99,-15}, { 7, 92, 16},
+ { 7, 83,-16}, { 7, 68, 17}, { 7, 59,-17}, { 7, 36, 18},
+ { 7, 27,-18}, { 7, 4, 19}, { 8, 251,-19}, { 8, 228, 20},
+ { 8, 219,-20}, { 8, 196, 21}, { 8, 187,-21}, { 8, 164, 22},
+ { 8, 139,-22}, { 8, 116, 23}, { 8, 75,-23}, { 8, 52, 24},
+ { 8, 11,-24}, { 9, 501, 25}, { 9, 500,-25}, { 9, 437, 26},
+ { 9, 436,-26}, { 9, 373, 27}, { 9, 372,-27}, { 9, 277, 28},
+ { 9, 276,-28}, { 9, 149, 29}, { 9, 148,-29}, { 9, 21, 30},
+ { 9, 20,-30}, {10, 917, 31}, {10, 916,-31}, {10, 789, 32},
+ {10, 788,-32}, {10, 661, 33}, {10, 660,-33}, {10, 469, 34},
+ {10, 468,-34}, {10, 214, 35}, {10, 213,-35}, {11, 1838, 36},
+ {11, 1837,-36}, {11, 1582, 37}, {11, 1581,-37}, {11, 1326, 38},
+ {11, 1325,-38}, {11, 942, 39}, {11, 941,-39}, {11, 431, 40},
+ {11, 430,-40}, {12, 3679, 41}, {12, 3678,-41}, {12, 3167, 42},
+ {12, 3166,-42}, {12, 3160, 43}, {12, 2655,-43}, {12, 2648, 44},
+ {12, 1887,-44}, {12, 1880, 45}, {12, 851,-45}, {12, 849, 46},
+ {12, 848,-46}, {13, 7346, 47}, {13, 7345,-47}, {13, 6322, 48},
+ {13, 5309,-48}, {13, 3773, 49}, {13, 3772,-49}, {13, 3762, 50},
+ {13, 1701,-50}, {14, 14695, 51}, {14, 14694,-51}, {14, 14688, 52},
+ {14, 12647,-52}, {14, 10617, 53}, {14, 10616,-53}, {14, 10596, 54},
+ {14, 7527,-54}, {14, 3401, 55}, {14, 3400,-55}, {15, 29378, 56},
+ {15, 25293,-56}, {15, 21195, 57}, {15, 21194,-57}, {15, 15053, 58},
+ {15, 15052,-58}, {16, 58759, 59}, {16, 58758,-59}, {16, 50585, 60},
+ {16, 50584,-60}, {16, 42399, 61}, {16, 42398,-61}, {16, 42397, 62},
+ {16, 42396,-62}, {16, 42395, 63}, {16, 42394,-63}, {16, 42393, 64},
+ {16, 42392,-64}, { 0, 0, 0}
};
huff_entry_t bitalloc_e_129[] =
{
- { 5, 12, 0}, { 5, 11, 1}, { 5, 10, -1}, { 5, 9, 2},
- { 5, 8, -2}, { 5, 7, 3}, { 5, 6, -3}, { 5, 4, 4},
- { 5, 3, -4}, { 5, 2, 5}, { 5, 1, -5}, { 5, 0, 6},
- { 6, 63, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 59, 8},
- { 6, 58, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 53, 10},
- { 6, 52, -10}, { 6, 51, 11}, { 6, 50, -11}, { 6, 47, 12},
- { 6, 46, -12}, { 6, 45, 13}, { 6, 44, -13}, { 6, 42, 14},
- { 6, 41, -14}, { 6, 38, 15}, { 6, 37, -15}, { 6, 36, 16},
- { 6, 35, -16}, { 6, 32, 17}, { 6, 31, -17}, { 6, 29, 18},
- { 6, 28, -18}, { 6, 26, 19}, { 6, 11, -19}, { 7, 125, 20},
- { 7, 124, -20}, { 7, 109, 21}, { 7, 108, -21}, { 7, 98, 22},
- { 7, 97, -22}, { 7, 87, 23}, { 7, 86, -23}, { 7, 79, 24},
- { 7, 78, -24}, { 7, 68, 25}, { 7, 67, -25}, { 7, 60, 26},
- { 7, 55, -26}, { 7, 21, 27}, { 7, 20, -27}, { 8, 230, 28},
- { 8, 229, -28}, { 8, 198, 29}, { 8, 193, -29}, { 8, 163, 30},
- { 8, 162, -30}, { 8, 139, 31}, { 8, 138, -31}, { 8, 123, 32},
- { 8, 122, -32}, { 8, 108, 33}, { 9, 463, -33}, { 9, 457, 34},
- { 9, 456, -34}, { 9, 385, 35}, { 9, 384, -35}, { 9, 321, 36},
- { 9, 320, -36}, { 9, 266, 37}, { 9, 265, -37}, { 9, 218, 38},
- {10, 925, -38}, {10, 798, 39}, {10, 797, -39}, {10, 646, 40},
- {10, 645, -40}, {10, 535, 41}, {10, 534, -41}, {10, 528, 42},
- {10, 439, -42}, {11, 1848, 43}, {11, 1599, -43}, {11, 1592, 44},
- {11, 1295, -44}, {11, 1288, 45}, {11, 1059, -45}, {11, 877, 46},
- {11, 876, -46}, {12, 3197, 47}, {12, 3196, -47}, {12, 2589, 48},
- {12, 2588, -48}, {12, 2117, 49}, {12, 2116, -49}, {13, 7398, 50},
- {13, 7397, -50}, {13, 6374, 51}, {13, 6373, -51}, {13, 5158, 52},
- {13, 5157, -52}, {14, 14799, 53}, {14, 14798, -53}, {14, 12751, 54},
- {14, 12750, -54}, {14, 10318, 55}, {14, 10313, -55}, {15, 29587, 56},
- {15, 29586, -56}, {15, 29584, 57}, {15, 25491, -57}, {15, 20625, 58},
- {15, 20624, -58}, {16, 59171, 59}, {16, 59170, -59}, {16, 50980, 60},
- {16, 41277, -60}, {16, 50981, 61}, {16, 41278, -61}, {16, 50978, 62},
- {16, 41279, -62}, {16, 50979, 63}, {16, 50976, -63}, {16, 50977, 64},
- {16, 41276, -64}, { 0, 0, 0}
+ { 5, 12, 0}, { 5, 11, 1}, { 5, 10, -1}, { 5, 9, 2},
+ { 5, 8, -2}, { 5, 7, 3}, { 5, 6, -3}, { 5, 4, 4},
+ { 5, 3, -4}, { 5, 2, 5}, { 5, 1, -5}, { 5, 0, 6},
+ { 6, 63, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 59, 8},
+ { 6, 58, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 53, 10},
+ { 6, 52,-10}, { 6, 51, 11}, { 6, 50,-11}, { 6, 47, 12},
+ { 6, 46,-12}, { 6, 45, 13}, { 6, 44,-13}, { 6, 42, 14},
+ { 6, 41,-14}, { 6, 38, 15}, { 6, 37,-15}, { 6, 36, 16},
+ { 6, 35,-16}, { 6, 32, 17}, { 6, 31,-17}, { 6, 29, 18},
+ { 6, 28,-18}, { 6, 26, 19}, { 6, 11,-19}, { 7, 125, 20},
+ { 7, 124,-20}, { 7, 109, 21}, { 7, 108,-21}, { 7, 98, 22},
+ { 7, 97,-22}, { 7, 87, 23}, { 7, 86,-23}, { 7, 79, 24},
+ { 7, 78,-24}, { 7, 68, 25}, { 7, 67,-25}, { 7, 60, 26},
+ { 7, 55,-26}, { 7, 21, 27}, { 7, 20,-27}, { 8, 230, 28},
+ { 8, 229,-28}, { 8, 198, 29}, { 8, 193,-29}, { 8, 163, 30},
+ { 8, 162,-30}, { 8, 139, 31}, { 8, 138,-31}, { 8, 123, 32},
+ { 8, 122,-32}, { 8, 108, 33}, { 9, 463,-33}, { 9, 457, 34},
+ { 9, 456,-34}, { 9, 385, 35}, { 9, 384,-35}, { 9, 321, 36},
+ { 9, 320,-36}, { 9, 266, 37}, { 9, 265,-37}, { 9, 218, 38},
+ {10, 925,-38}, {10, 798, 39}, {10, 797,-39}, {10, 646, 40},
+ {10, 645,-40}, {10, 535, 41}, {10, 534,-41}, {10, 528, 42},
+ {10, 439,-42}, {11, 1848, 43}, {11, 1599,-43}, {11, 1592, 44},
+ {11, 1295,-44}, {11, 1288, 45}, {11, 1059,-45}, {11, 877, 46},
+ {11, 876,-46}, {12, 3197, 47}, {12, 3196,-47}, {12, 2589, 48},
+ {12, 2588,-48}, {12, 2117, 49}, {12, 2116,-49}, {13, 7398, 50},
+ {13, 7397,-50}, {13, 6374, 51}, {13, 6373,-51}, {13, 5158, 52},
+ {13, 5157,-52}, {14, 14799, 53}, {14, 14798,-53}, {14, 12751, 54},
+ {14, 12750,-54}, {14, 10318, 55}, {14, 10313,-55}, {15, 29587, 56},
+ {15, 29586,-56}, {15, 29584, 57}, {15, 25491,-57}, {15, 20625, 58},
+ {15, 20624,-58}, {16, 59171, 59}, {16, 59170,-59}, {16, 50980, 60},
+ {16, 41277,-60}, {16, 50981, 61}, {16, 41278,-61}, {16, 50978, 62},
+ {16, 41279,-62}, {16, 50979, 63}, {16, 50976,-63}, {16, 50977, 64},
+ {16, 41276,-64}, { 0, 0, 0}
};
huff_entry_t bitalloc_f_129[] =
{
- { 6, 56, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2},
- { 6, 51, -2}, { 6, 50, 3}, { 6, 49, -3}, { 6, 48, 4},
- { 6, 47, -4}, { 6, 46, 5}, { 6, 45, -5}, { 6, 44, 6},
- { 6, 43, -6}, { 6, 41, 7}, { 6, 40, -7}, { 6, 39, 8},
- { 6, 38, -8}, { 6, 36, 9}, { 6, 35, -9}, { 6, 34, 10},
- { 6, 33, -10}, { 6, 31, 11}, { 6, 30, -11}, { 6, 29, 12},
- { 6, 28, -12}, { 6, 26, 13}, { 6, 25, -13}, { 6, 23, 14},
- { 6, 22, -14}, { 6, 21, 15}, { 6, 20, -15}, { 6, 18, 16},
- { 6, 17, -16}, { 6, 15, 17}, { 6, 14, -17}, { 6, 12, 18},
- { 6, 11, -18}, { 6, 9, 19}, { 6, 8, -19}, { 6, 7, 20},
- { 6, 6, -20}, { 6, 3, 21}, { 6, 2, -21}, { 6, 1, 22},
- { 6, 0, -22}, { 7, 125, 23}, { 7, 124, -23}, { 7, 123, 24},
- { 7, 122, -24}, { 7, 120, 25}, { 7, 119, -25}, { 7, 116, 26},
- { 7, 115, -26}, { 7, 114, 27}, { 7, 107, -27}, { 7, 84, 28},
- { 7, 75, -28}, { 7, 65, 29}, { 7, 64, -29}, { 7, 54, 30},
- { 7, 49, -30}, { 7, 39, 31}, { 7, 38, -31}, { 7, 27, 32},
- { 7, 26, -32}, { 7, 20, 33}, { 7, 11, -33}, { 7, 10, 34},
- { 7, 9, -34}, { 8, 254, 35}, { 8, 253, -35}, { 8, 243, 36},
- { 8, 242, -36}, { 8, 235, 37}, { 8, 234, -37}, { 8, 213, 38},
- { 8, 212, -38}, { 8, 149, 39}, { 8, 148, -39}, { 8, 110, 40},
- { 8, 97, -40}, { 8, 66, 41}, { 8, 65, -41}, { 8, 43, 42},
- { 8, 42, -42}, { 8, 16, 43}, { 9, 511, -43}, { 9, 505, 44},
- { 9, 504, -44}, { 9, 474, 45}, { 9, 473, -45}, { 9, 343, 46},
- { 9, 342, -46}, { 9, 340, 47}, { 9, 223, -47}, { 9, 192, 48},
- { 9, 135, -48}, { 9, 129, 49}, { 9, 128, -49}, { 9, 34, 50},
- {10, 1021, -50}, {10, 951, 51}, {10, 950, -51}, {10, 944, 52},
- {10, 683, -52}, {10, 445, 53}, {10, 444, -53}, {10, 269, 54},
- {10, 268, -54}, {10, 71, 55}, {10, 70, -55}, {11, 2040, 56},
- {11, 1891, -56}, {11, 1364, 57}, {11, 775, -57}, {11, 774, 58},
- {11, 773, -58}, {12, 4083, 59}, {12, 4082, -59}, {12, 3780, 60},
- {12, 2731, -60}, {12, 1545, 61}, {12, 1544, -61}, {13, 7562, 62},
- {13, 5461, -62}, {13, 5460, 63}, {14, 15127, -63}, {15, 30253, 64},
- {15, 30252, -64}, { 0, 0, 0}
+ { 6, 56, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2},
+ { 6, 51, -2}, { 6, 50, 3}, { 6, 49, -3}, { 6, 48, 4},
+ { 6, 47, -4}, { 6, 46, 5}, { 6, 45, -5}, { 6, 44, 6},
+ { 6, 43, -6}, { 6, 41, 7}, { 6, 40, -7}, { 6, 39, 8},
+ { 6, 38, -8}, { 6, 36, 9}, { 6, 35, -9}, { 6, 34, 10},
+ { 6, 33,-10}, { 6, 31, 11}, { 6, 30,-11}, { 6, 29, 12},
+ { 6, 28,-12}, { 6, 26, 13}, { 6, 25,-13}, { 6, 23, 14},
+ { 6, 22,-14}, { 6, 21, 15}, { 6, 20,-15}, { 6, 18, 16},
+ { 6, 17,-16}, { 6, 15, 17}, { 6, 14,-17}, { 6, 12, 18},
+ { 6, 11,-18}, { 6, 9, 19}, { 6, 8,-19}, { 6, 7, 20},
+ { 6, 6,-20}, { 6, 3, 21}, { 6, 2,-21}, { 6, 1, 22},
+ { 6, 0,-22}, { 7, 125, 23}, { 7, 124,-23}, { 7, 123, 24},
+ { 7, 122,-24}, { 7, 120, 25}, { 7, 119,-25}, { 7, 116, 26},
+ { 7, 115,-26}, { 7, 114, 27}, { 7, 107,-27}, { 7, 84, 28},
+ { 7, 75,-28}, { 7, 65, 29}, { 7, 64,-29}, { 7, 54, 30},
+ { 7, 49,-30}, { 7, 39, 31}, { 7, 38,-31}, { 7, 27, 32},
+ { 7, 26,-32}, { 7, 20, 33}, { 7, 11,-33}, { 7, 10, 34},
+ { 7, 9,-34}, { 8, 254, 35}, { 8, 253,-35}, { 8, 243, 36},
+ { 8, 242,-36}, { 8, 235, 37}, { 8, 234,-37}, { 8, 213, 38},
+ { 8, 212,-38}, { 8, 149, 39}, { 8, 148,-39}, { 8, 110, 40},
+ { 8, 97,-40}, { 8, 66, 41}, { 8, 65,-41}, { 8, 43, 42},
+ { 8, 42,-42}, { 8, 16, 43}, { 9, 511,-43}, { 9, 505, 44},
+ { 9, 504,-44}, { 9, 474, 45}, { 9, 473,-45}, { 9, 343, 46},
+ { 9, 342,-46}, { 9, 340, 47}, { 9, 223,-47}, { 9, 192, 48},
+ { 9, 135,-48}, { 9, 129, 49}, { 9, 128,-49}, { 9, 34, 50},
+ {10, 1021,-50}, {10, 951, 51}, {10, 950,-51}, {10, 944, 52},
+ {10, 683,-52}, {10, 445, 53}, {10, 444,-53}, {10, 269, 54},
+ {10, 268,-54}, {10, 71, 55}, {10, 70,-55}, {11, 2040, 56},
+ {11, 1891,-56}, {11, 1364, 57}, {11, 775,-57}, {11, 774, 58},
+ {11, 773,-58}, {12, 4083, 59}, {12, 4082,-59}, {12, 3780, 60},
+ {12, 2731,-60}, {12, 1545, 61}, {12, 1544,-61}, {13, 7562, 62},
+ {13, 5461,-62}, {13, 5460, 63}, {14, 15127,-63}, {15, 30253, 64},
+ {15, 30252,-64}, { 0, 0, 0}
};
huff_entry_t bitalloc_g_129[] =
{
- { 4, 0, 0}, { 5, 29, 1}, { 5, 28, -1}, { 5, 25, 2},
- { 5, 24, -2}, { 5, 21, 3}, { 5, 20, -3}, { 5, 17, 4},
- { 5, 16, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 9, 6},
- { 5, 8, -6}, { 5, 5, 7}, { 5, 4, -7}, { 6, 63, 8},
- { 6, 62, -8}, { 6, 55, 9}, { 6, 54, -9}, { 6, 47, 10},
- { 6, 46, -10}, { 6, 39, 11}, { 6, 38, -11}, { 6, 31, 12},
- { 6, 30, -12}, { 6, 23, 13}, { 6, 22, -13}, { 6, 15, 14},
- { 6, 14, -14}, { 6, 7, 15}, { 6, 6, -15}, { 7, 123, 16},
- { 7, 122, -16}, { 7, 107, 17}, { 7, 106, -17}, { 7, 91, 18},
- { 7, 90, -18}, { 7, 75, 19}, { 7, 74, -19}, { 7, 59, 20},
- { 7, 58, -20}, { 7, 43, 21}, { 7, 42, -21}, { 7, 27, 22},
- { 7, 26, -22}, { 7, 11, 23}, { 7, 10, -23}, { 7, 8, 24},
- { 8, 243, -24}, { 8, 240, 25}, { 8, 211, -25}, { 8, 208, 26},
- { 8, 179, -26}, { 8, 176, 27}, { 8, 147, -27}, { 8, 144, 28},
- { 8, 115, -28}, { 8, 112, 29}, { 8, 83, -29}, { 8, 80, 30},
- { 8, 51, -30}, { 8, 48, 31}, { 8, 19, -31}, { 9, 484, 32},
- { 9, 483, -32}, { 9, 421, 33}, { 9, 420, -33}, { 9, 357, 34},
- { 9, 356, -34}, { 9, 293, 35}, { 9, 292, -35}, { 9, 229, 36},
- { 9, 228, -36}, { 9, 226, 37}, { 9, 165, -37}, { 9, 162, 38},
- { 9, 101, -38}, { 9, 98, 39}, { 9, 37, -39}, {10, 970, 40},
- {10, 965, -40}, {10, 839, 41}, {10, 838, -41}, {10, 711, 42},
- {10, 710, -42}, {10, 708, 43}, {10, 583, -43}, {10, 580, 44},
- {10, 455, -44}, {10, 329, 45}, {10, 328, -45}, {10, 201, 46},
- {10, 200, -46}, {10, 198, 47}, {10, 73, -47}, {11, 1942, 48},
- {11, 1929, -48}, {11, 1675, 49}, {11, 1674, -49}, {11, 1672, 50},
- {11, 1419, -50}, {11, 1165, 51}, {11, 1164, -51}, {11, 1162, 52},
- {11, 909, -52}, {11, 655, 53}, {11, 654, -53}, {11, 652, 54},
- {11, 399, -54}, {11, 145, 55}, {11, 144, -55}, {12, 3886, 56},
- {12, 3857, -56}, {12, 3347, 57}, {12, 3346, -57}, {12, 2837, 58},
- {12, 2836, -58}, {12, 2327, 59}, {12, 2326, -59}, {12, 1817, 60},
- {12, 1816, -60}, {12, 1307, 61}, {12, 1306, -61}, {12, 797, 62},
- {12, 796, -62}, {13, 7775, 63}, {13, 7774, -63}, {13, 7713, 64},
- {13, 7712, -64}, { 0, 0, 0}
+ { 4, 0, 0}, { 5, 29, 1}, { 5, 28, -1}, { 5, 25, 2},
+ { 5, 24, -2}, { 5, 21, 3}, { 5, 20, -3}, { 5, 17, 4},
+ { 5, 16, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 9, 6},
+ { 5, 8, -6}, { 5, 5, 7}, { 5, 4, -7}, { 6, 63, 8},
+ { 6, 62, -8}, { 6, 55, 9}, { 6, 54, -9}, { 6, 47, 10},
+ { 6, 46,-10}, { 6, 39, 11}, { 6, 38,-11}, { 6, 31, 12},
+ { 6, 30,-12}, { 6, 23, 13}, { 6, 22,-13}, { 6, 15, 14},
+ { 6, 14,-14}, { 6, 7, 15}, { 6, 6,-15}, { 7, 123, 16},
+ { 7, 122,-16}, { 7, 107, 17}, { 7, 106,-17}, { 7, 91, 18},
+ { 7, 90,-18}, { 7, 75, 19}, { 7, 74,-19}, { 7, 59, 20},
+ { 7, 58,-20}, { 7, 43, 21}, { 7, 42,-21}, { 7, 27, 22},
+ { 7, 26,-22}, { 7, 11, 23}, { 7, 10,-23}, { 7, 8, 24},
+ { 8, 243,-24}, { 8, 240, 25}, { 8, 211,-25}, { 8, 208, 26},
+ { 8, 179,-26}, { 8, 176, 27}, { 8, 147,-27}, { 8, 144, 28},
+ { 8, 115,-28}, { 8, 112, 29}, { 8, 83,-29}, { 8, 80, 30},
+ { 8, 51,-30}, { 8, 48, 31}, { 8, 19,-31}, { 9, 484, 32},
+ { 9, 483,-32}, { 9, 421, 33}, { 9, 420,-33}, { 9, 357, 34},
+ { 9, 356,-34}, { 9, 293, 35}, { 9, 292,-35}, { 9, 229, 36},
+ { 9, 228,-36}, { 9, 226, 37}, { 9, 165,-37}, { 9, 162, 38},
+ { 9, 101,-38}, { 9, 98, 39}, { 9, 37,-39}, {10, 970, 40},
+ {10, 965,-40}, {10, 839, 41}, {10, 838,-41}, {10, 711, 42},
+ {10, 710,-42}, {10, 708, 43}, {10, 583,-43}, {10, 580, 44},
+ {10, 455,-44}, {10, 329, 45}, {10, 328,-45}, {10, 201, 46},
+ {10, 200,-46}, {10, 198, 47}, {10, 73,-47}, {11, 1942, 48},
+ {11, 1929,-48}, {11, 1675, 49}, {11, 1674,-49}, {11, 1672, 50},
+ {11, 1419,-50}, {11, 1165, 51}, {11, 1164,-51}, {11, 1162, 52},
+ {11, 909,-52}, {11, 655, 53}, {11, 654,-53}, {11, 652, 54},
+ {11, 399,-54}, {11, 145, 55}, {11, 144,-55}, {12, 3886, 56},
+ {12, 3857,-56}, {12, 3347, 57}, {12, 3346,-57}, {12, 2837, 58},
+ {12, 2836,-58}, {12, 2327, 59}, {12, 2326,-59}, {12, 1817, 60},
+ {12, 1816,-60}, {12, 1307, 61}, {12, 1306,-61}, {12, 797, 62},
+ {12, 796,-62}, {13, 7775, 63}, {13, 7774,-63}, {13, 7713, 64},
+ {13, 7712,-64}, { 0, 0, 0}
};
huff_entry_t *bitalloc_select[11][8] =
{
- { 0 },
- { bitalloc_a_3, 0 },
- { bitalloc_a_5, bitalloc_b_5, bitalloc_c_5, 0 },
- { bitalloc_a_7, bitalloc_b_7, bitalloc_c_7, 0 },
- { bitalloc_a_9, bitalloc_b_9, bitalloc_c_9, 0 },
- { bitalloc_a_13, bitalloc_b_13, bitalloc_c_13, 0 },
- {
- bitalloc_a_17, bitalloc_b_17, bitalloc_c_17, bitalloc_d_17,
- bitalloc_e_17, bitalloc_f_17, bitalloc_g_17, 0
- },
- {
- bitalloc_a_25, bitalloc_b_25, bitalloc_c_25, bitalloc_d_25,
- bitalloc_e_25, bitalloc_f_25, bitalloc_g_25, 0
- },
- {
- bitalloc_a_33, bitalloc_b_33, bitalloc_c_33, bitalloc_d_33,
- bitalloc_e_33, bitalloc_f_33, bitalloc_g_33, 0
- },
- {
- bitalloc_a_65, bitalloc_b_65, bitalloc_c_65, bitalloc_d_65,
- bitalloc_e_65, bitalloc_f_65, bitalloc_g_65, 0
- },
- {
- bitalloc_a_129, bitalloc_b_129, bitalloc_c_129, bitalloc_d_129,
- bitalloc_e_129, bitalloc_f_129, bitalloc_g_129, 0
- },
-};
-
-static int InverseQ(dca_state_t * state, huff_entry_t * huff)
+ { 0 },
+ { bitalloc_a_3, 0 },
+ { bitalloc_a_5, bitalloc_b_5, bitalloc_c_5, 0 },
+ { bitalloc_a_7, bitalloc_b_7, bitalloc_c_7, 0 },
+ { bitalloc_a_9, bitalloc_b_9, bitalloc_c_9, 0 },
+ { bitalloc_a_13, bitalloc_b_13, bitalloc_c_13, 0 },
+ { bitalloc_a_17, bitalloc_b_17, bitalloc_c_17, bitalloc_d_17,
+ bitalloc_e_17, bitalloc_f_17, bitalloc_g_17, 0 },
+ { bitalloc_a_25, bitalloc_b_25, bitalloc_c_25, bitalloc_d_25,
+ bitalloc_e_25, bitalloc_f_25, bitalloc_g_25, 0 },
+ { bitalloc_a_33, bitalloc_b_33, bitalloc_c_33, bitalloc_d_33,
+ bitalloc_e_33, bitalloc_f_33, bitalloc_g_33, 0 },
+ { bitalloc_a_65, bitalloc_b_65, bitalloc_c_65, bitalloc_d_65,
+ bitalloc_e_65, bitalloc_f_65, bitalloc_g_65, 0 },
+ { bitalloc_a_129, bitalloc_b_129, bitalloc_c_129, bitalloc_d_129,
+ bitalloc_e_129, bitalloc_f_129, bitalloc_g_129, 0 },
+};
+
+static int InverseQ( dca_state_t * state, huff_entry_t * huff )
{
int value = 0;
int length = 0, j;
- while(1)
+ while( 1 )
{
length++;
value <<= 1;
- value |= bitstream_get(state, 1);
+ value |= bitstream_get (state, 1);
- for(j = 0; huff[j].length != 0 && huff[j].length < length; j++);
+ for( j = 0; huff[j].length != 0 && huff[j].length < length; j++ );
- if(huff[j].length == 0) break;
+ if( huff[j].length == 0 ) break;
- for(; huff[j].length == length; j++)
- {
- if(huff[j].code == value) return huff[j].value;
- }
+ for( ; huff[j].length == length; j++ )
+ {
+ if( huff[j].code == value ) return huff[j].value;
+ }
}
return 0;
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_quantization.h b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_quantization.h
index 9581dbcdb..4dc3cd0fe 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_quantization.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_quantization.h
@@ -23,60 +23,60 @@
int scale_factor_quant6[] =
{
- 1, 2, 2, 3, 3, 4, 6, 7,
- 10, 12, 16, 20, 26, 34, 44, 56,
- 72, 93, 120, 155, 200, 257, 331, 427,
- 550, 708, 912, 1175, 1514, 1950, 2512, 3236,
- 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547,
- 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209,
- 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538,
- 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0
+ 1, 2, 2, 3, 3, 4, 6, 7,
+ 10, 12, 16, 20, 26, 34, 44, 56,
+ 72, 93, 120, 155, 200, 257, 331, 427,
+ 550, 708, 912, 1175, 1514, 1950, 2512, 3236,
+ 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547,
+ 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209,
+ 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538,
+ 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0
};
int scale_factor_quant7[] =
{
- 1, 1, 2, 2, 2, 2, 3, 3,
- 3, 4, 4, 5, 6, 7, 7, 8,
- 10, 11, 12, 14, 16, 18, 20, 23,
- 26, 30, 34, 38, 44, 50, 56, 64,
- 72, 82, 93, 106, 120, 136, 155, 176,
- 200, 226, 257, 292, 331, 376, 427, 484,
- 550, 624, 708, 804, 912, 1035, 1175, 1334,
- 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673,
- 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116,
- 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861,
- 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736,
- 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349,
- 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103,
- 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245,
- 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704,
- 5011872, 5688529, 6456542, 7328245, 8317638, 0, 0, 0
+ 1, 1, 2, 2, 2, 2, 3, 3,
+ 3, 4, 4, 5, 6, 7, 7, 8,
+ 10, 11, 12, 14, 16, 18, 20, 23,
+ 26, 30, 34, 38, 44, 50, 56, 64,
+ 72, 82, 93, 106, 120, 136, 155, 176,
+ 200, 226, 257, 292, 331, 376, 427, 484,
+ 550, 624, 708, 804, 912, 1035, 1175, 1334,
+ 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673,
+ 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116,
+ 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861,
+ 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736,
+ 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349,
+ 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103,
+ 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245,
+ 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704,
+ 5011872, 5688529, 6456542, 7328245, 8317638, 0, 0, 0
};
/* 20bits unsigned fractional binary codes */
int lossy_quant[] =
{
- 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063,
- 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777,
- 10486, 5872, 3355, 1887, 1258, 713, 336, 168,
- 84, 42, 21, 0, 0, 0, 0, 0
+ 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063,
+ 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777,
+ 10486, 5872, 3355, 1887, 1258, 713, 336, 168,
+ 84, 42, 21, 0, 0, 0, 0, 0
};
double lossy_quant_d[] =
{
- 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34,
- 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040,
- 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004,
+ 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34,
+ 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040,
+ 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004,
0.00002, 0.00001, 0.000005, 0, 0, 0, 0, 0
};
/* 20bits unsigned fractional binary codes */
int lossless_quant[] =
{
- 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127,
- 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049,
- 1024, 512, 256, 128, 64, 32, 16, 8,
- 4, 2, 1, 0, 0, 0, 0, 0
+ 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127,
+ 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049,
+ 1024, 512, 256, 128, 64, 32, 16, 8,
+ 4, 2, 1, 0, 0, 0, 0, 0
};
double lossless_quant_d[] =
@@ -85,5 +85,5 @@ double lossless_quant_d[] =
0.083, 0.0625, 0.03125, 0.0156, 7.874E-3, 3.922E-3, 1.957E-3,
9.775E-4, 4.885E-4, 2.442E-4, 1.221E-4, 6.104E-5, 3.052E-5, 1.526E-5,
7.629E-6, 3.815E-6, 1.907E-6, 9.537E-7, 4.768E-7, 2.384E-7, 0,
- 0, 0, 0, 0
+ 0, 0, 0, 0
};
diff --git a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_vq.h b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_vq.h
index a85a6f0ba..2aafd762c 100644
--- a/src/filters/transform/MpaDecFilter/libdca/libdca/tables_vq.h
+++ b/src/filters/transform/MpaDecFilter/libdca/libdca/tables_vq.h
@@ -25,4100 +25,2052 @@
static int8_t high_freq_vq[1024][32] =
{
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22,
- 2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9
- },
- {
- -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9,
- -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15
- },
- {
- -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0,
- 8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4
- },
- {
- 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6,
- -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14
- },
- {
- 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1,
- 3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8
- },
- {
- 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14,
- -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2
- },
- {
- 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3,
- -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20
- },
- {
- 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1,
- -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2
- },
- {
- 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24,
- 18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4
- },
- {
- 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15,
- -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5
- },
- {
- -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13,
- -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14
- },
- {
- -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4,
- -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2
- },
- {
- -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27,
- 18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3
- },
- {
- 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7,
- -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3
- },
- {
- 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2,
- -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2
- },
- {
- 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6,
- -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4
- },
- {
- 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15,
- -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2
- },
- {
- -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11,
- 29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2
- },
- {
- 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1,
- -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3
- },
- {
- -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10,
- -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2
- },
- {
- 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4,
- 24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0
- },
- {
- 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0,
- 0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1
- },
- {
- 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3,
- -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1
- },
- {
- -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0,
- -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6
- },
- {
- -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3,
- 13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0
- },
- {
- 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3,
- -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0
- },
- {
- 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1,
- 0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7
- },
- {
- -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5,
- 1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4
- },
- {
- -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2,
- 45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1
- },
- {
- -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4,
- 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7
- },
- {
- 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38,
- 15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1
- },
- {
- 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1,
- 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33
- },
- {
- -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6,
- -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19
- },
- {
- 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10,
- 2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6
- },
- {
- 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10,
- -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14
- },
- {
- -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0,
- 8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9
- },
- {
- -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0,
- 8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10
- },
- {
- -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8,
- -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10
- },
- {
- -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4,
- -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8
- },
- {
- 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2,
- -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15
- },
- {
- -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1,
- 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23
- },
- {
- -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1,
- 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16
- },
- {
- 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10,
- -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4
- },
- {
- -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7,
- -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10
- },
- {
- -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10,
- -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4
- },
- {
- 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6,
- -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1
- },
- {
- -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9,
- -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7
- },
- {
- -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3,
- -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14
- },
- {
- 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1,
- -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2
- },
- {
- 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2,
- -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1
- },
- {
- -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1,
- -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4
- },
- {
- 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21,
- 4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3
- },
- {
- 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4,
- 0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18
- },
- {
- -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1,
- 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4
- },
- {
- -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2,
- 5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0
- },
- {
- -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1,
- 3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10
- },
- {
- -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7,
- -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15
- },
- {
- -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6,
- -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1
- },
- {
- 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5,
- -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21
- },
- {
- -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0,
- -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10
- },
- {
- -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6,
- 13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16
- },
- {
- -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5,
- -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3
- },
- {
- -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1,
- -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5
- },
- {
- 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7,
- -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1
- },
- {
- 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5,
- -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1
- },
- {
- -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8,
- -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5
- },
- {
- -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3,
- 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3
- },
- {
- -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9,
- -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9
- },
- {
- -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10,
- -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2
- },
- {
- -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5,
- -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4
- },
- {
- -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2,
- -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6
- },
- {
- -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2,
- 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0
- },
- {
- -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5,
- 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7
- },
- {
- -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22,
- 2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11
- },
- {
- 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2,
- 6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1
- },
- {
- -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4,
- 1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18
- },
- {
- -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15,
- -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1
- },
- {
- 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4,
- 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8
- },
- {
- -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1,
- 2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5
- },
- {
- -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7,
- 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4
- },
- {
- -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8,
- -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5
- },
- {
- -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10,
- -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5
- },
- {
- 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4,
- 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0
- },
- {
- -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3,
- 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5
- },
- {
- -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8,
- 0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7
- },
- {
- -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14,
- 13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5
- },
- {
- -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4,
- -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2
- },
- {
- -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2,
- -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1
- },
- {
- -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1,
- 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4
- },
- {
- -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1,
- 6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1
- },
- {
- -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5,
- -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17
- },
- {
- -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4,
- -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2
- },
- {
- -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4,
- 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5
- },
- {
- -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5,
- -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3
- },
- {
- -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5,
- -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6
- },
- {
- 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1,
- -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19
- },
- {
- -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22,
- 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11
- },
- {
- -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3,
- -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16
- },
- {
- 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2,
- 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2
- },
- {
- -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4,
- 12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5
- },
- {
- 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1,
- 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9
- },
- {
- -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3,
- 7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13
- },
- {
- 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1,
- 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7
- },
- {
- -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4,
- 3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3
- },
- {
- 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1,
- 11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2
- },
- {
- 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11,
- 3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2
- },
- {
- 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2,
- 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27
- },
- {
- -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5,
- 3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4
- },
- {
- 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8,
- -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10
- },
- {
- -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2,
- 1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8
- },
- {
- -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2,
- -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8
- },
- {
- -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6,
- -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12
- },
- {
- -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7,
- 18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9
- },
- {
- -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5,
- -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1
- },
- {
- -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7,
- 6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6
- },
- {
- -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0,
- -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1
- },
- {
- -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3,
- -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11
- },
- {
- -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4,
- -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2
- },
- {
- 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2,
- 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1
- },
- {
- 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3,
- -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8
- },
- {
- 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8,
- 7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6
- },
- {
- -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6,
- 3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4
- },
- {
- -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3,
- 9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12
- },
- {
- 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1,
- 0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7
- },
- {
- 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2,
- 4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5
- },
- {
- -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1,
- 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18
- },
- {
- -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4,
- 1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12
- },
- {
- -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5,
- 8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10
- },
- {
- -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11,
- 2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9
- },
- {
- -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9,
- 22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8
- },
- {
- 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18,
- -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1
- },
- {
- 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6,
- -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6
- },
- {
- 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17,
- 37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3
- },
- {
- 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6,
- 2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3
- },
- {
- 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9,
- -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5
- },
- {
- 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7,
- -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1,
- -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4,
- -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1,
- 15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0
- },
- {
- 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33,
- 10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2
- },
- {
- -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1,
- 11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
- 2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0
- },
- {
- 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10,
- -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3
- },
- {
- 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1,
- -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1
- },
- {
- -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18,
- -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4
- },
- {
- 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5,
- 2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1
- },
- {
- -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5,
- 8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28
- },
- {
- -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18,
- 4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5
- },
- {
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0,
- -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1
- },
- {
- -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9,
- -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8
- },
- {
- 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9,
- -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9
- },
- {
- 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9,
- 0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8
- },
- {
- 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12,
- 12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5
- },
- {
- 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3,
- 27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12
- },
- {
- -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28,
- 2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8
- },
- {
- -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27,
- 14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
- 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1,
- 4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1,
- 6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6
- },
- {
- -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1,
- 10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4
- },
- {
- -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0,
- 11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3
- },
- {
- -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3,
- -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6
- },
- {
- -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14,
- 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8
- },
- {
- -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9,
- -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1
- },
- {
- -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17,
- 16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1
- },
- {
- -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10,
- -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8
- },
- {
- -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7,
- 6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4
- },
- {
- -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3,
- 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2
- },
- {
- -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3,
- -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10
- },
- {
- -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11,
- -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3
- },
- {
- -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7,
- 4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2
- },
- {
- -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1,
- -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5
- },
- {
- -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4,
- -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1
- },
- {
- -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4,
- -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0
- },
- {
- -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4,
- -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6
- },
- {
- -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15,
- -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3
- },
- {
- 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4,
- 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1
- },
- {
- -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7,
- -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1
- },
- {
- -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3,
- 6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2
- },
- {
- -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6,
- -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2
- },
- {
- -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4,
- -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1
- },
- {
- -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7,
- -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2
- },
- {
- -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3,
- 6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4
- },
- {
- -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15,
- -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0
- },
- {
- -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7,
- 7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1
- },
- {
- -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1,
- -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4
- },
- {
- -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13,
- -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0
- },
- {
- -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10,
- -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7
- },
- {
- -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15,
- 4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7
- },
- {
- -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15,
- -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5
- },
- {
- -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7,
- -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1
- },
- {
- -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9,
- -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5
- },
- {
- -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4,
- 10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4
- },
- {
- -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19,
- 0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3
- },
- {
- -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12,
- -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2
- },
- {
- -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3,
- 6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0
- },
- {
- -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9,
- 1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9
- },
- {
- -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1,
- 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0
- },
- {
- -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7,
- 5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1
- },
- {
- -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7,
- 1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1
- },
- {
- 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5,
- 4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3
- },
- {
- -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11,
- 16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1
- },
- {
- -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4,
- -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8
- },
- {
- 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0,
- 4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1
- },
- {
- -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5,
- 7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16
- },
- {
- 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7,
- 9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4
- },
- {
- -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8,
- 1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2
- },
- {
- -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0,
- 2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10
- },
- {
- -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4,
- 13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8
- },
- {
- -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21,
- 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8
- },
- {
- -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1,
- 27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3
- },
- {
- -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4,
- 5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10
- },
- {
- -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0,
- 1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2
- },
- {
- -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8,
- 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3
- },
- {
- -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8,
- -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14
- },
- {
- -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2,
- 2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7
- },
- {
- 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2,
- -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1
- },
- {
- 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6,
- -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4
- },
- {
- -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11,
- 5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3
- },
- {
- -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4,
- 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1
- },
- {
- -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3,
- 3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2
- },
- {
- -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2,
- -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0
- },
- {
- -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6,
- 1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1
- },
- {
- 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5,
- -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0
- },
- {
- 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3,
- -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0
- },
- {
- 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0,
- 3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2
- },
- {
- 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10,
- -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4
- },
- {
- 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6,
- 11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2
- },
- {
- 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18,
- 1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7
- },
- {
- 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2,
- 4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9
- },
- {
- 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9,
- 2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2
- },
- {
- 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11,
- 9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4
- },
- {
- 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8,
- 3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3
- },
- {
- 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1,
- -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3
- },
- {
- 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4,
- 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4
- },
- {
- 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4,
- -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5
- },
- {
- 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0,
- -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0
- },
- {
- 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2,
- -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10
- },
- {
- 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2,
- -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7
- },
- {
- 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6,
- 10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10
- },
- {
- 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2,
- 2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1
- },
- {
- 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9,
- -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2
- },
- {
- 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12,
- 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3
- },
- {
- 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17,
- 11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3
- },
- {
- 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5,
- 12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1
- },
- {
- 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4,
- -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4
- },
- {
- 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4,
- -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1
- },
- {
- 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16,
- 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6
- },
- {
- 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4,
- -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2
- },
- {
- 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6,
- 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0
- },
- {
- 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6,
- -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1
- },
- {
- 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14,
- 2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3
- },
- {
- 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7,
- 5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7
- },
- {
- 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4,
- -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3
- },
- {
- 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10,
- 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8
- },
- {
- -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3,
- 14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1
- },
- {
- -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18,
- 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9
- },
- {
- -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2,
- 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8
- },
- {
- -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7,
- 7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6
- },
- {
- -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11,
- 9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4
- },
- {
- -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11,
- -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2
- },
- {
- 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4,
- 13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1
- },
- {
- -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18,
- 16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12
- },
- {
- 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20,
- 14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11
- },
- {
- -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10,
- 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4
- },
- {
- 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17,
- 7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12
- },
- {
- -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9,
- 2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4
- },
- {
- 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3,
- 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9
- },
- {
- -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25,
- 3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0
- },
- {
- -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0,
- 11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4
- },
- {
- -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10,
- 3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11
- },
- {
- -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21,
- 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0
- },
- {
- -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10,
- -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16
- },
- {
- -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13,
- 5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4
- },
- {
- -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7,
- -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8
- },
- {
- -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4,
- 1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4
- },
- {
- 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18,
- -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4
- },
- {
- -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4,
- -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5
- },
- {
- -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11,
- 4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6
- },
- {
- -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10,
- 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5
- },
- {
- -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21,
- 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7
- },
- {
- 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17,
- 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13
- },
- {
- 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16,
- 23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15
- },
- {
- -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26,
- 5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13
- },
- {
- 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4,
- 32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7
- },
- {
- 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51,
- 4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2
- },
- {
- 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8,
- 11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4
- },
- {
- 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6,
- -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9
- },
- {
- 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9,
- -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4
- },
- {
- 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25,
- 7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5
- },
- {
- 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15,
- 5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6
- },
- {
- 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8,
- -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1
- },
- {
- 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15,
- -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7
- },
- {
- 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18,
- 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0
- },
- {
- 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4,
- -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16
- },
- {
- 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7,
- 6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3
- },
- {
- 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7,
- 0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9
- },
- {
- 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3,
- -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18
- },
- {
- 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1,
- 4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1
- },
- {
- 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7,
- -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11
- },
- {
- 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19,
- -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5
- },
- {
- 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1,
- 15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1
- },
- {
- 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4,
- -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4
- },
- {
- 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3,
- -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7
- },
- {
- 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1,
- 4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2
- },
- {
- 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4,
- 8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5
- },
- {
- 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4,
- 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1
- },
- {
- 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1,
- -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7
- },
- {
- 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10,
- -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4
- },
- {
- 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7,
- -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5
- },
- {
- 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10,
- -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18
- },
- {
- 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4,
- 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4
- },
- {
- 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3,
- -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0
- },
- {
- 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8,
- 0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6
- },
- {
- 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5,
- 32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7
- },
- {
- 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6,
- -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7
- },
- {
- 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10,
- -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9
- },
- {
- 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5,
- -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4
- },
- {
- 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12,
- -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3
- },
- {
- 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2,
- 11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5
- },
- {
- 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1,
- 1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1
- },
- {
- -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2,
- -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8
- },
- {
- 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3,
- -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1,
- 0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1
- },
- {
- -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18,
- 15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0,
- -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
- -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1
- },
- {
- 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1,
- -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0
- },
- {
- 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4,
- -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0
- },
- {
- 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0,
- 3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2
- },
- {
- 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3,
- 56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0
- },
- {
- 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8,
- 2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9
- },
- {
- 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16,
- -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5
- },
- {
- 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25,
- -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4
- },
- {
- -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1,
- -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2
- },
- {
- 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11,
- 10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28
- },
- {
- 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0,
- -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3
- },
- {
- 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1,
- 1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2
- },
- {
- -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2,
- -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2
- },
- {
- 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11,
- -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12
- },
- {
- -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7,
- -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
- -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
- -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
- 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
- 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
- -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
- -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
- 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
- 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4
- },
- {
- -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13,
- -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7
- },
- {
- 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8,
- -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17
- },
- {
- -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7,
- 36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11
- },
- {
- 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11,
- 8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6
- },
- {
- -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8,
- 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2
- },
- {
- -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5,
- -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5
- },
- {
- 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15,
- 24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0
- },
- {
- 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0,
- 24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1
- },
- {
- 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4,
- 10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7
- },
- {
- 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1,
- -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1
- },
- {
- 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1,
- 10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1
- },
- {
- 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19,
- 3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17
- },
- {
- 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2,
- 8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5
- },
- {
- 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
- -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5
- },
- {
- 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
- -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1
- },
- {
- 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
- -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11
- },
- {
- 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
- 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16
- },
- {
- 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
- 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2
- },
- {
- 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
- -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
- 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11
- },
- {
- 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
- -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5
- },
- {
- 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
- -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1
- },
- {
- 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
- -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11
- },
- {
- 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
- 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16
- },
- {
- 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
- 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2
- },
- {
- 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
- -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
- 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11
- },
- {
- 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4,
- 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1
- },
- {
- 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7,
- 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2
- },
- {
- 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4,
- 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2
- },
- {
- 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17,
- -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1
- },
- {
- 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8,
- -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7
- },
- {
- 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4,
- 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8
- },
- {
- 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1,
- 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4
- },
- {
- 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1,
- 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0
- },
- {
- 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2,
- 8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0
- },
- {
- 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0,
- -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5
- },
- {
- 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5,
- 3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0
- },
- {
- 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17,
- 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9
- },
- {
- 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6,
- -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2
- },
- {
- 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16,
- 3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1
- },
- {
- 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15,
- 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6
- },
- {
- 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4,
- 2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1
- },
- {
- 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9,
- 24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4
- },
- {
- 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19,
- 2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9
- },
- {
- 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14,
- 7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10
- },
- {
- 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9,
- 8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3
- },
- {
- 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5,
- 10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2
- },
- {
- 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4,
- 8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11
- },
- {
- 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8,
- 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9
- },
- {
- 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9,
- 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4
- },
- {
- 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12,
- 7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1
- },
- {
- 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4,
- -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3
- },
- {
- 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0,
- 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2
- },
- {
- 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12,
- 7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4
- },
- {
- 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2,
- 16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14
- },
- {
- 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11,
- -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11
- },
- {
- 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8,
- -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13
- },
- {
- 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2,
- -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5
- },
- {
- -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5,
- -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2
- },
- {
- -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5,
- -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12
- },
- {
- -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4,
- -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10
- },
- {
- -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2,
- -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3
- },
- {
- -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3,
- 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10
- },
- {
- -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12,
- -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3
- },
- {
- -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9,
- -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0
- },
- {
- -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30,
- 2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1
- },
- {
- -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16,
- 0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10
- },
- {
- -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5,
- -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5
- },
- {
- -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3,
- 4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6
- },
- {
- -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13,
- 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6
- },
- {
- -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1,
- -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1
- },
- {
- -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1,
- -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4
- },
- {
- -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3,
- -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4
- },
- {
- -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1,
- -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3
- },
- {
- -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11,
- -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5
- },
- {
- -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6,
- -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4
- },
- {
- -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4,
- 5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6
- },
- {
- -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6,
- -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4
- },
- {
- -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7,
- 6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1
- },
- {
- -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3,
- -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1
- },
- {
- -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15,
- -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3
- },
- {
- -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4,
- 7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2
- },
- {
- -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9,
- -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4
- },
- {
- -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14,
- -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2
- },
- {
- -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1,
- -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0
- },
- {
- -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4,
- -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1
- },
- {
- -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9,
- 0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6
- },
- {
- -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4,
- 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8
- },
- {
- -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16,
- 0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6
- },
- {
- -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13,
- 13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3
- },
- {
- -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4,
- -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5
- },
- {
- -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17,
- 3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2
- },
- {
- -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5,
- -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1
- },
- {
- -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7,
- -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3
- },
- {
- -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7,
- -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6
- },
- {
- -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1,
- -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2
- },
- {
- -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4,
- -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7
- },
- {
- -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7,
- 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6
- },
- {
- -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1,
- 10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12
- },
- {
- -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6,
- 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11
- },
- {
- -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4,
- -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8
- },
- {
- -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0,
- -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3
- },
- {
- -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6,
- 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1
- },
- {
- -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1,
- 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7
- },
- {
- -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2,
- 0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12
- },
- {
- -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15,
- 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2
- },
- {
- -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2,
- -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6
- },
- {
- -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11,
- 11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7
- },
- {
- -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8,
- 7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6
- },
- {
- -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3,
- -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16
- },
- {
- -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12,
- -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13
- },
- {
- -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0,
- 5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0
- },
- {
- -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14,
- 9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6
- },
- {
- -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2,
- 17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7
- },
- {
- -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6,
- -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6
- },
- {
- -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6,
- -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1
- },
- {
- -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2,
- 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1
- },
- {
- -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16,
- -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1
- },
- {
- -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19,
- 6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4
- },
- {
- 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11,
- -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4
- },
- {
- 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13,
- 9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5
- },
- {
- -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2,
- -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6
- },
- {
- 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11,
- 5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3
- },
- {
- 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7,
- 21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2
- },
- {
- -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8,
- 23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,
- 35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0,
- 41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0
- },
- {
- -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7,
- 10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7
- },
- {
- 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7,
- 23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5,
- -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3
- },
- {
- 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40,
- 10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1
- },
- {
- 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0,
- 4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1
- },
- {
- 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
- 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0
- },
- {
- 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
- -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2
- },
- {
- 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
- -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12
- },
- {
- -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
- 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14
- },
- {
- 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
- -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
- 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8
- },
- {
- 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
- 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2
- },
- {
- 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
- -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14
- },
- {
- 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
- 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
- -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
- -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
- 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0
- },
- {
- 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
- -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2
- },
- {
- 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
- -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12
- },
- {
- -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
- 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14
- },
- {
- 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
- -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
- 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8
- },
- {
- 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
- 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2
- },
- {
- 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
- -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14
- },
- {
- 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
- 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
- -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
- -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5,
- 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1
- },
- {
- 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7,
- -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11
- },
- {
- 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5,
- 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3
- },
- {
- 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12,
- -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6
- },
- {
- 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2,
- -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0
- },
- {
- 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1,
- -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15
- },
- {
- 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7,
- -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5
- },
- {
- 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9,
- 8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1
- },
- {
- 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4,
- -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2
- },
- {
- 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12,
- -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0
- },
- {
- 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17,
- -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4
- },
- {
- 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2,
- 0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11
- },
- {
- 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7,
- 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4
- },
- {
- 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5,
- -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12
- },
- {
- 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9,
- 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9
- },
- {
- 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2,
- 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2
- },
- {
- 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5,
- 5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4
- },
- {
- 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14,
- -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7
- },
- {
- 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7,
- -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2
- },
- {
- 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0,
- -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2
- },
- {
- 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8,
- 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4
- },
- {
- 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1,
- 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2
- },
- {
- 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1,
- 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2
- },
- {
- 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1,
- 8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16
- },
- {
- 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8,
- -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15
- },
- {
- 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16,
- 0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1
- },
- {
- 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8,
- -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2
- },
- {
- 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4,
- 10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1
- },
- {
- 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6,
- 8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6
- },
- {
- 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1,
- 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1
- },
- {
- 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3,
- 3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7
- },
- {
- 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4,
- 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7
- },
- {
- 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2,
- -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1
- },
- {
- 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6,
- -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4
- },
- {
- -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2,
- 13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1
- },
- {
- 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2,
- 8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4
- },
- {
- -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3,
- 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2
- },
- {
- 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4,
- 7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9
- },
- {
- 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4,
- -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14
- },
- {
- -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4,
- -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1
- },
- {
- -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3,
- 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0
- },
- {
- 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7,
- -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1
- },
- {
- -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0,
- -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11
- },
- {
- 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12,
- -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5
- },
- {
- 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2,
- 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5
- },
- {
- -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13,
- -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10
- },
- {
- 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3,
- 17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2
- },
- {
- -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0,
- -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13
- },
- {
- 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5,
- 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3
- },
- {
- 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10,
- 1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2
- },
- {
- -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21,
- 3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2
- },
- {
- 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5,
- 12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0
- },
- {
- 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5,
- -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6
- },
- {
- 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3,
- -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4
- },
- {
- 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2,
- -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13
- },
- {
- 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10,
- -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1
- },
- {
- -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4,
- 1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5
- },
- {
- 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13,
- 8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5
- },
- {
- 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19,
- 3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4
- },
- {
- -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2,
- -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3
- },
- {
- 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8,
- 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2
- },
- {
- 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7,
- -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3
- },
- {
- -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6,
- -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8
- },
- {
- -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11,
- -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8
- },
- {
- -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8,
- -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3
- },
- {
- -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6,
- 7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4
- },
- {
- -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1,
- 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4
- },
- {
- -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1,
- 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1
- },
- {
- -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7,
- 5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6
- },
- {
- -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1,
- 2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2
- },
- {
- -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3,
- -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6
- },
- {
- -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12,
- -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4
- },
- {
- -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14,
- -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10
- },
- {
- -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2,
- 4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3
- },
- {
- -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11,
- 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4
- },
- {
- -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12,
- -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7
- },
- {
- -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2,
- 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12
- },
- {
- -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4,
- 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5
- },
- {
- -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2,
- -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0
- },
- {
- -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5,
- -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5
- },
- {
- -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9,
- 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4
- },
- {
- -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5,
- -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0
- },
- {
- -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1,
- 4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7
- },
- {
- -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2,
- 1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11
- },
- {
- -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0,
- 5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9
- },
- {
- -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8,
- -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6
- },
- {
- -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4,
- 6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9
- },
- {
- -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4,
- -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7
- },
- {
- -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11,
- 0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12
- },
- {
- -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8,
- -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2
- },
- {
- -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6,
- -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7
- },
- {
- -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8,
- 3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12
- },
- {
- -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6,
- -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2
- },
- {
- -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2,
- 9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6
- },
- {
- -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3,
- 1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8
- },
- {
- -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1,
- -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5
- },
- {
- 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2,
- -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5
- },
- {
- -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7,
- 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16
- },
- {
- -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5,
- -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4
- },
- {
- 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10,
- -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3
- },
- {
- -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3,
- 1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8
- },
- {
- -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5,
- 2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4
- },
- {
- -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14,
- 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7
- },
- {
- -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3,
- 1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1
- },
- {
- -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2,
- 6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6
- },
- {
- -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11,
- 0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5
- },
- {
- 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25,
- 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2
- },
- {
- -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16,
- 12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4
- },
- {
- -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0,
- 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0
- },
- {
- -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14,
- -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12
- },
- {
- -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2,
- 0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6
- },
- {
- 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5,
- 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3
- },
- {
- -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12,
- 1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4
- },
- {
- -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0,
- 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0
- },
- {
- -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0,
- 6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6
- },
- {
- -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4,
- 5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1
- },
- {
- -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13,
- 16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14
- },
- {
- -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7,
- 26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16
- },
- {
- -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17,
- 7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4
- },
- {
- -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1,
- 9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3
- },
- {
- -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7,
- 10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3
- },
- {
- -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0,
- 7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10
- },
- {
- -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1,
- 1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3
- },
- {
- -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9,
- -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3
- },
- {
- -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9,
- -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4
- },
- {
- -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8,
- 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17
- },
- {
- -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3,
- 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2
- },
- {
- -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7,
- 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1
- },
- {
- -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5,
- -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1
- },
- {
- -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20,
- 7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4
- },
- {
- -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2,
- -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3
- },
- {
- -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7,
- -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7
- },
- {
- -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7,
- 4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4
- },
- {
- -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7,
- -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3
- },
- {
- -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2,
- -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5
- },
- {
- -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2,
- 3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6
- },
- {
- -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2,
- 6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4
- },
- {
- -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6,
- -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5
- },
- {
- -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5,
- 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4
- },
- {
- -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1,
- 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1
- },
- {
- -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10,
- -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4
- },
- {
- -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4,
- -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3
- },
- {
- -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6,
- 11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1
- },
- {
- -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7,
- -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1
- },
- {
- -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13,
- -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8
- },
- {
- -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5,
- -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1
- },
- {
- -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6,
- 22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8
- },
- {
- -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4,
- -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4
- },
- {
- -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4,
- 6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4
- },
- {
- -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7,
- -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11
- },
- {
- -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15,
- -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6
- },
- {
- -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1,
- -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1
- },
- {
- -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7,
- -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6
- },
- {
- -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3,
- -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9
- },
- {
- -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1,
- -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4
- },
- {
- -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1,
- 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3
- },
- {
- -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7,
- 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3
- },
- {
- -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3,
- -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4
- },
- {
- -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1,
- -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7
- },
- {
- -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5,
- 5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3
- },
- {
- 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26,
- -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4
- },
- {
- 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3,
- -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2
- },
- {
- 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5,
- 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5
- },
- {
- 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18,
- 3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5
- },
- {
- 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2,
- 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7
- },
- {
- -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2,
- 4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0
- },
- {
- 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3,
- -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10
- },
- {
- 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5,
- -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1
- },
- {
- 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2,
- -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1
- },
- {
- 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3,
- -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4
- },
- {
- 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12,
- 9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3
- },
- {
- 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4,
- 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1
- },
- {
- 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6,
- -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0
- },
- {
- 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9,
- 8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8
- },
- {
- 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7,
- 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5
- },
- {
- 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4,
- -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1
- },
- {
- 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3,
- -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6
- },
- {
- 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2,
- 1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10
- },
- {
- 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2,
- -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1
- },
- {
- 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10,
- -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4
- },
- {
- 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8,
- -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15
- },
- {
- -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8,
- 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1
- },
- {
- 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3,
- -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5
- },
- {
- 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5,
- 5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1
- },
- {
- 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15,
- 2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7
- },
- {
- 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9,
- 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3
- },
- {
- 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7,
- -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2
- },
- {
- 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4,
- 4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5
- },
- {
- 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1,
- 2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2
- },
- {
- 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9,
- 9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2
- },
- {
- 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6,
- 5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3
- },
- {
- 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15,
- -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12
- },
- {
- 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0,
- 1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5
- },
- {
- 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4,
- -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12
- },
- {
- 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3,
- -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7
- },
- {
- 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18,
- 8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6
- },
- {
- 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9,
- 14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9
- },
- {
- -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2,
- 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14
- },
- {
- -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6,
- -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1
- },
- {
- -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7,
- 8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4
- },
- {
- 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7,
- 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5
- },
- {
- 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5,
- -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13
- },
- {
- 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10,
- 1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0
- },
- {
- -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0,
- 5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28
- },
- {
- 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3,
- 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1
- },
- {
- -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19,
- 1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10
- },
- {
- -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2,
- 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16
- },
- {
- -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6,
- 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11
- },
- {
- 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2,
- -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0
- },
- {
- 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1,
- 10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3
- },
- {
- 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4,
- 8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11
- },
- {
- -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6,
- 16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6
- },
- {
- 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1,
- 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4
- },
- {
- -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3,
- 29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5
- },
- {
- -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5,
- 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1
- },
- {
- 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10,
- 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12
- },
- {
- -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2,
- 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24
- },
- {
- -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8,
- 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6
- },
- {
- -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4,
- 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3
- },
- {
- 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8,
- -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17
- },
- {
- -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1,
- 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15
- },
- {
- 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2,
- -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3
- },
- {
- 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4,
- 4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5
- },
- {
- -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0,
- 8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6
- },
- {
- 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10,
- 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4
- },
- {
- -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6,
- -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3
- },
- {
- 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4,
- -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0
- },
- {
- 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3,
- 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4
- },
- {
- 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1,
- -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6
- },
- {
- 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10,
- 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1
- },
- {
- 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5,
- 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6
- },
- {
- 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3,
- -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1
- },
- {
- 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8,
- -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7
- },
- {
- 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17,
- -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7
- },
- {
- 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5,
- 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6
- },
- {
- 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10,
- -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6
- },
- {
- 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18,
- 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2
- },
- {
- -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6,
- -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4
- },
- {
- 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10,
- -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7
- },
- {
- 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2,
- -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5
- },
- {
- 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6,
- -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8
- },
- {
- 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1,
- 6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1
- },
- {
- 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1,
- 12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1
- },
- {
- 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10,
- 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0
- },
- {
- 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0,
- 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7
- },
- {
- 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2,
- 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11
- },
- {
- 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12,
- 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5
- },
- {
- 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6,
- -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1
- },
- {
- 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5,
- -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5
- },
- {
- 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22,
- 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3
- },
- {
- 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7,
- 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13
- },
- {
- 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7,
- -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5
- },
- {
- 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3,
- -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2
- },
- {
- 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6,
- -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14
- },
- {
- 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11,
- -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3
- },
- {
- 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1,
- -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4
- },
- {
- 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0,
- -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50
- },
- {
- -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9,
- -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26
- },
- {
- 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1,
- -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27
- },
- {
- -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5,
- 0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26
- },
- {
- 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11,
- 9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29
- },
- {
- -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1,
- 2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27
- },
- {
- -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6,
- -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29
- },
- {
- -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4,
- 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31
- },
- {
- 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27,
- -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21
- },
- {
- -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1,
- -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17
- },
- {
- -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2,
- -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36
- },
- {
- 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1,
- -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28
- },
- {
- 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2,
- 16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20
- },
- {
- 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4,
- 3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32
- },
- {
- -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9,
- -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24
- },
- {
- 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8,
- 0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33
- },
- {
- -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13,
- -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30
- },
- {
- -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5,
- -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40
- },
- {
- -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5,
- 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24
- },
- {
- -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2,
- 11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29
- },
- {
- -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2,
- 3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35
- },
- {
- -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18,
- 9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26
- },
- {
- 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4,
- 1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38
- },
- {
- 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1,
- -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28
- },
- {
- 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18,
- -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30
- },
- {
- 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3,
- -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26
- },
- {
- -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5,
- 0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25
- },
- {
- -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8,
- 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23
- },
- {
- -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6,
- 8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43
- },
- {
- -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10,
- -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30
- },
- {
- -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9,
- 0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28
- },
- {
- -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1,
- -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70
- },
- {
- 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15,
- -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1
- },
- {
- 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10,
- 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13
- },
- {
- -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0,
- 9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15
- },
- {
- 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1,
- -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9
- },
- {
- 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5,
- 2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6
- },
- {
- 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4,
- -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3
- },
- {
- -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7,
- -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14
- },
- {
- -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1,
- -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2
- },
- {
- -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1,
- -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0
- },
- {
- -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6,
- 5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3
- },
- {
- 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5,
- -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6
- },
- {
- -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1,
- -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5
- },
- {
- -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2,
- 1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12
- },
- {
- 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1,
- -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2
- },
- {
- 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3,
- 8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1
- },
- {
- 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1,
- 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2
- },
- {
- 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2,
- -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4
- },
- {
- 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2,
- 9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1
- },
- {
- 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0,
- -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5
- },
- {
- -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12,
- -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5
- },
- {
- -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2,
- 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4
- },
- {
- 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2,
- 9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6
- },
- {
- 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6,
- -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4
- },
- {
- 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6,
- 2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4
- },
- {
- 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1,
- -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6
- },
- {
- -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11,
- -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4
- },
- {
- 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11,
- 3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1
- },
- {
- 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7,
- 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11
- },
- {
- 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4,
- -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4
- },
- {
- 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4,
- -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5
- },
- {
- -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31,
- 2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2
- },
- {
- 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13,
- -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4
- },
- {
- 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9,
- -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1
- },
- {
- -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15,
- -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11
- },
- {
- 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21,
- -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15
- },
- {
- -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8,
- -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12
- },
- {
- 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17,
- 3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4
- },
- {
- 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15,
- -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12
- },
- {
- 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3,
- -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7
- },
- {
- -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4,
- 8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7
- },
- {
- 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16,
- -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12
- },
- {
- -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2,
- -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5
- },
- {
- 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10,
- -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15
- },
- {
- 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18,
- -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10
- },
- {
- 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1,
- 2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1
- },
- {
- 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1,
- -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5
- },
- {
- 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20,
- 5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1
- },
- {
- 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5,
- -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11
- },
- {
- 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16,
- -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3
- },
- {
- -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3,
- -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3
- },
- {
- 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7,
- 3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7
- },
- {
- 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0,
- -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12
- },
- {
- 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1,
- -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9
- },
- {
- 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25,
- 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1
- },
- {
- 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12,
- -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2
- },
- {
- 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3,
- -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3
- },
- {
- 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21,
- 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2
- },
- {
- -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23,
- -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3
- },
- {
- 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5,
- 5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7
- },
- {
- 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13,
- -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2
- },
- {
- 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15,
- -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4
- },
- {
- 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45,
- -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3
- },
- {
- 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6,
- 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0
- },
- {
- -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17,
- -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6
- },
- {
- 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5,
- -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1
- },
- {
- 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1,
- -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4
- },
- {
- -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4,
- -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3
- },
- {
- 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6,
- -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7
- },
- {
- -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5,
- -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1
- },
- {
- 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0,
- -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11
- },
- {
- 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5,
- -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10
- },
- {
- 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5,
- -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2
- },
- {
- 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11,
- -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11
- },
- {
- -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13,
- -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1
- },
- {
- 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0,
- -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8
- },
- {
- 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6,
- -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10
- },
- {
- -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3,
- 1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7
- },
- {
- 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6,
- -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2
- },
- {
- -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4,
- -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7
- },
- {
- 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6,
- -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9
- },
- {
- -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27,
- -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5
- },
- {
- -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7,
- -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13
- },
- {
- -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0,
- -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1
- },
- {
- -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2,
- -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4
- },
- {
- 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26,
- -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10
- },
- {
- 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3,
- -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7
- },
- {
- 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20,
- -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10
- },
- {
- -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7,
- -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0
- },
- {
- 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14,
- -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13
- },
- {
- -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8,
- -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9
- },
- {
- 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13,
- -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13
- },
- {
- 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17,
- -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1
- },
- {
- -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9,
- -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1
- },
- {
- 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8,
- -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4
- },
- {
- 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7,
- -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2
- },
- {
- -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4,
- -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2
- },
- {
- 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19,
- -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3
- },
- {
- 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8,
- -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2
- },
- {
- -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1,
- -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2
- },
- {
- 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9,
- -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1
- },
- {
- 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2,
- -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1
- },
- {
- 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6,
- -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11
- },
- {
- 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9,
- 7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2
- },
- {
- 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4,
- -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5
- },
- {
- 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0,
- 11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2
- },
- {
- 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12,
- -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3
- },
- {
- 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1,
- 3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15
- },
- {
- 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21,
- -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6
- },
- {
- -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9,
- -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3
- },
- {
- 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9,
- -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11
- },
- {
- 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6,
- -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10
- },
- {
- 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1,
- 18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6
- },
- {
- -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7,
- 6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7
- },
- {
- 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10,
- 16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1
- },
- {
- 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17,
- -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9
- },
- {
- 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5,
- -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3
- },
- {
- 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15,
- 6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10
- },
- {
- -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2,
- -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1
- },
- {
- 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28,
- 2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1
- },
- {
- -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5,
- -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7
- },
- {
- 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0,
- -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3
- },
- {
- 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3,
- 1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2
- },
- {
- 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8,
- -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2
- },
- {
- 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4,
- -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4
- },
- {
- -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2,
- 14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3
- },
- {
- 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28,
- -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3
- },
- {
- 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3,
- -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3
- },
- {
- -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28,
- 0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6
- },
- {
- -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6,
- -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34
- },
- {
- 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1,
- 0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26
- },
- {
- -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3,
- 7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24
- },
- {
- -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8,
- 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23
- },
- {
- -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14,
- 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30
- },
- {
- 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14,
- 7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29
- },
- {
- -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1,
- 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55
- },
- {
- 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5,
- 0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31
- },
- {
- 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1,
- 5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31
- },
- {
- -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2,
- -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30
- },
- {
- -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3,
- 5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24
- },
- {
- -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13,
- 8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25
- },
- {
- -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4,
- 4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24
- },
- {
- -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1,
- 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69
- },
- {
- 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0,
- 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41
- },
- {
- -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3,
- -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27
- },
- {
- -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12,
- -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28
- },
- {
- -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9,
- 22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23
- },
- {
- 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1,
- 13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23
- },
- {
- -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6,
- 15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29
- },
- {
- 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7,
- -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37
- },
- {
- 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5,
- -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33
- },
- {
- 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4,
- 3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40
- },
- {
- -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9,
- 18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26
- },
- {
- -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4,
- 1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28
- },
- {
- -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2,
- 2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32
- },
- {
- -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1,
- 2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30
- },
- {
- -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3,
- 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27
- },
- {
- -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3,
- 4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32
- },
- {
- -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2,
- -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21
- },
- {
- -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2,
- 0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29
- },
- {
- 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2,
- -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19
- },
- {
- -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1,
- 2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13
- },
- {
- 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6,
- -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19
- },
- {
- 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12,
- 17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9
- },
- {
- 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0,
- 1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27
- },
- {
- 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2,
- -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15
- },
- {
- -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7,
- -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5
- },
- {
- 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6,
- -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8
- },
- {
- -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11,
- 2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16
- },
- {
- 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0,
- 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1
- },
- {
- 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4,
- 12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16
- },
- {
- -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2,
- 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21
- },
- {
- 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3,
- -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2
- },
- {
- -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13,
- 17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11
- },
- {
- -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6,
- 7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3
- },
- {
- -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10,
- 10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14
- },
- {
- 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1,
- 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14
- },
- {
- 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5,
- 1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11
- },
- {
- 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1,
- -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2
- },
- {
- 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4,
- -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4
- },
- {
- -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10,
- -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12
- },
- {
- -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9,
- 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15
- },
- {
- -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1,
- -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8
- },
- {
- 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4,
- -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2
- },
- {
- -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6,
- 20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3
- },
- {
- 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7,
- 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2
- },
- {
- 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9,
- -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2
- },
- {
- 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5,
- -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12
- },
- {
- 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9,
- 5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9
- },
- {
- 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2,
- -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6
- },
- {
- 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4,
- 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12
- },
- {
- 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3,
- 2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4
- },
- {
- 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15,
- -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2
- },
- {
- -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4,
- 1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16
- },
- {
- 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7,
- 1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17
- },
- {
- 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7,
- 0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26
- },
- {
- 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2,
- -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12
- },
- {
- 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0,
- 3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11
- },
- {
- 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4,
- -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17
- },
- {
- 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2,
- -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11
- },
- {
- -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7,
- 4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7
- },
- {
- 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2,
- 6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23
- },
- {
- 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2,
- -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9
- },
- {
- 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11,
- -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6
- },
- {
- 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4,
- 4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14
- },
- {
- 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4,
- -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22
- },
- {
- -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6,
- -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11
- },
- {
- 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7,
- -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12
- },
- {
- 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6,
- -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17
- },
- {
- -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11,
- 7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12
- },
- {
- 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3,
- -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5
- },
- {
- 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3,
- 7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6
- },
- {
- 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6,
- 9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5
- },
- {
- 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10,
- -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11
- },
- {
- 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7,
- 8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13
- },
- {
- -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14,
- 6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13
- },
- {
- 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11,
- 1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9
- },
- {
- -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6,
- 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7
- },
- {
- 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10,
- 15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16
- },
- {
- 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4,
- 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16
- },
- {
- 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0,
- 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10
- },
- {
- -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2,
- 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46
- },
- {
- 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10,
- 13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1
- },
- {
- 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2,
- 7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8
- },
- {
- 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5,
- 4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5
- }
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22,
+ 2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 },
+ { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9,
+ -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 },
+ { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0,
+ 8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 },
+ { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6,
+ -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 },
+ { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1,
+ 3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 },
+ { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14,
+ -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 },
+ { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3,
+ -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 },
+ { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1,
+ -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 },
+ { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24,
+ 18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 },
+ { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15,
+ -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 },
+ { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13,
+ -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 },
+ { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4,
+ -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 },
+ { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27,
+ 18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 },
+ { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7,
+ -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 },
+ { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2,
+ -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 },
+ { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6,
+ -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 },
+ { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15,
+ -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 },
+ { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11,
+ 29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 },
+ { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1,
+ -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 },
+ { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10,
+ -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 },
+ { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4,
+ 24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 },
+ { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0,
+ 0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 },
+ { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3,
+ -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 },
+ { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0,
+ -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 },
+ { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3,
+ 13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 },
+ { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3,
+ -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 },
+ { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1,
+ 0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 },
+ { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5,
+ 1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 },
+ { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2,
+ 45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 },
+ { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4,
+ 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 },
+ { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38,
+ 15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 },
+ { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1,
+ 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 },
+ { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6,
+ -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 },
+ { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10,
+ 2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 },
+ { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10,
+ -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 },
+ { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0,
+ 8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 },
+ { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0,
+ 8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 },
+ { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8,
+ -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 },
+ { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4,
+ -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 },
+ { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2,
+ -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 },
+ { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1,
+ 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 },
+ { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1,
+ 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 },
+ { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10,
+ -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 },
+ { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7,
+ -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 },
+ { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10,
+ -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 },
+ { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6,
+ -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 },
+ { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9,
+ -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 },
+ { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3,
+ -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 },
+ { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1,
+ -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 },
+ { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2,
+ -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 },
+ { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1,
+ -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 },
+ { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21,
+ 4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 },
+ { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4,
+ 0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 },
+ { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1,
+ 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 },
+ { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2,
+ 5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 },
+ { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1,
+ 3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 },
+ { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7,
+ -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 },
+ { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6,
+ -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 },
+ { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5,
+ -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 },
+ { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0,
+ -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 },
+ { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6,
+ 13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 },
+ { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5,
+ -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 },
+ { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1,
+ -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 },
+ { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7,
+ -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 },
+ { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5,
+ -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 },
+ { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8,
+ -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 },
+ { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3,
+ 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 },
+ { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9,
+ -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 },
+ { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10,
+ -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 },
+ { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5,
+ -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 },
+ { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2,
+ -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 },
+ { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2,
+ 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 },
+ { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5,
+ 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 },
+ { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22,
+ 2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 },
+ { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2,
+ 6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 },
+ { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4,
+ 1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 },
+ { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15,
+ -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 },
+ { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4,
+ 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 },
+ { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1,
+ 2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 },
+ { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7,
+ 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 },
+ { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8,
+ -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 },
+ { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10,
+ -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 },
+ { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4,
+ 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 },
+ { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3,
+ 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 },
+ { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8,
+ 0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 },
+ { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14,
+ 13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 },
+ { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4,
+ -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 },
+ { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2,
+ -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 },
+ { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1,
+ 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 },
+ { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1,
+ 6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 },
+ { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5,
+ -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 },
+ { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4,
+ -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 },
+ { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4,
+ 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 },
+ { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5,
+ -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 },
+ { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5,
+ -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 },
+ { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1,
+ -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 },
+ { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22,
+ 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 },
+ { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3,
+ -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 },
+ { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2,
+ 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 },
+ { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4,
+ 12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 },
+ { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1,
+ 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 },
+ { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3,
+ 7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 },
+ { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1,
+ 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 },
+ { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4,
+ 3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 },
+ { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1,
+ 11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 },
+ { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11,
+ 3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 },
+ { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2,
+ 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 },
+ { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5,
+ 3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 },
+ { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8,
+ -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 },
+ { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2,
+ 1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 },
+ { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2,
+ -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 },
+ { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6,
+ -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 },
+ { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7,
+ 18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 },
+ { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5,
+ -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 },
+ { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7,
+ 6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 },
+ { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0,
+ -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 },
+ { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3,
+ -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 },
+ { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4,
+ -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 },
+ { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2,
+ 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 },
+ { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3,
+ -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 },
+ { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8,
+ 7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 },
+ { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6,
+ 3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 },
+ { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3,
+ 9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 },
+ { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1,
+ 0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 },
+ { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2,
+ 4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 },
+ { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1,
+ 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 },
+ { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4,
+ 1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 },
+ { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5,
+ 8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 },
+ { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11,
+ 2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 },
+ { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9,
+ 22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 },
+ { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18,
+ -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 },
+ { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6,
+ -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 },
+ { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17,
+ 37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 },
+ { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6,
+ 2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 },
+ { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9,
+ -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 },
+ { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7,
+ -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1,
+ -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4,
+ -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1,
+ 15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 },
+ { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33,
+ 10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 },
+ { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1,
+ 11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 },
+ { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10,
+ -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 },
+ { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1,
+ -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 },
+ { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18,
+ -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 },
+ { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5,
+ 2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 },
+ { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5,
+ 8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 },
+ { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18,
+ 4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 },
+ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0,
+ -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 },
+ { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9,
+ -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 },
+ { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9,
+ -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 },
+ { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9,
+ 0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 },
+ { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12,
+ 12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 },
+ { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3,
+ 27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 },
+ { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28,
+ 2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 },
+ { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27,
+ 14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1,
+ 4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1,
+ 6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 },
+ { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1,
+ 10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 },
+ { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0,
+ 11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 },
+ { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3,
+ -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 },
+ { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14,
+ 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 },
+ { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9,
+ -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 },
+ { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17,
+ 16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 },
+ { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10,
+ -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 },
+ { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7,
+ 6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 },
+ { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3,
+ 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 },
+ { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3,
+ -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 },
+ { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11,
+ -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 },
+ { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7,
+ 4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 },
+ { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1,
+ -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 },
+ { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4,
+ -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 },
+ { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4,
+ -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 },
+ { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4,
+ -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 },
+ { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15,
+ -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 },
+ { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4,
+ 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 },
+ { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7,
+ -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 },
+ { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3,
+ 6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 },
+ { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6,
+ -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 },
+ { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4,
+ -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 },
+ { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7,
+ -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 },
+ { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3,
+ 6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 },
+ { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15,
+ -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 },
+ { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7,
+ 7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 },
+ { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1,
+ -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 },
+ { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13,
+ -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 },
+ { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10,
+ -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 },
+ { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15,
+ 4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 },
+ { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15,
+ -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 },
+ { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7,
+ -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 },
+ { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9,
+ -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 },
+ { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4,
+ 10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 },
+ { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19,
+ 0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 },
+ { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12,
+ -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 },
+ { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3,
+ 6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 },
+ { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9,
+ 1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 },
+ { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1,
+ 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 },
+ { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7,
+ 5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 },
+ { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7,
+ 1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 },
+ { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5,
+ 4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 },
+ { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11,
+ 16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 },
+ { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4,
+ -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 },
+ { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0,
+ 4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 },
+ { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5,
+ 7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 },
+ { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7,
+ 9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 },
+ { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8,
+ 1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 },
+ { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0,
+ 2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 },
+ { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4,
+ 13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 },
+ { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21,
+ 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 },
+ { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1,
+ 27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 },
+ { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4,
+ 5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 },
+ { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0,
+ 1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 },
+ { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8,
+ 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 },
+ { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8,
+ -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 },
+ { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2,
+ 2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 },
+ { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2,
+ -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 },
+ { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6,
+ -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 },
+ { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11,
+ 5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 },
+ { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4,
+ 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 },
+ { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3,
+ 3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 },
+ { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2,
+ -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 },
+ { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6,
+ 1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 },
+ { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5,
+ -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 },
+ { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3,
+ -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 },
+ { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0,
+ 3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 },
+ { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10,
+ -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 },
+ { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6,
+ 11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 },
+ { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18,
+ 1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 },
+ { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2,
+ 4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 },
+ { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9,
+ 2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 },
+ { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11,
+ 9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 },
+ { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8,
+ 3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 },
+ { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1,
+ -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 },
+ { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4,
+ 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 },
+ { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4,
+ -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 },
+ { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0,
+ -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 },
+ { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2,
+ -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 },
+ { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2,
+ -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 },
+ { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6,
+ 10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 },
+ { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2,
+ 2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 },
+ { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9,
+ -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 },
+ { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12,
+ 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 },
+ { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17,
+ 11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 },
+ { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5,
+ 12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 },
+ { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4,
+ -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 },
+ { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4,
+ -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 },
+ { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16,
+ 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 },
+ { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4,
+ -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 },
+ { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6,
+ 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 },
+ { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6,
+ -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 },
+ { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14,
+ 2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 },
+ { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7,
+ 5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 },
+ { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4,
+ -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 },
+ { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10,
+ 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 },
+ { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3,
+ 14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 },
+ { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18,
+ 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 },
+ { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2,
+ 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 },
+ { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7,
+ 7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 },
+ { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11,
+ 9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 },
+ { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11,
+ -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 },
+ { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4,
+ 13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 },
+ { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18,
+ 16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 },
+ { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20,
+ 14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 },
+ { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10,
+ 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 },
+ { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17,
+ 7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 },
+ { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9,
+ 2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 },
+ { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3,
+ 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 },
+ { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25,
+ 3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 },
+ { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0,
+ 11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 },
+ { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10,
+ 3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 },
+ { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21,
+ 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 },
+ { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10,
+ -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 },
+ { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13,
+ 5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 },
+ { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7,
+ -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 },
+ { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4,
+ 1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 },
+ { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18,
+ -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 },
+ { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4,
+ -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 },
+ { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11,
+ 4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 },
+ { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10,
+ 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 },
+ { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21,
+ 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 },
+ { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17,
+ 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 },
+ { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16,
+ 23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 },
+ { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26,
+ 5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 },
+ { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4,
+ 32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 },
+ { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51,
+ 4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 },
+ { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8,
+ 11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 },
+ { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6,
+ -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 },
+ { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9,
+ -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 },
+ { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25,
+ 7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 },
+ { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15,
+ 5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 },
+ { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8,
+ -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 },
+ { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15,
+ -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 },
+ { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18,
+ 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 },
+ { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4,
+ -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 },
+ { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7,
+ 6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 },
+ { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7,
+ 0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 },
+ { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3,
+ -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 },
+ { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1,
+ 4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 },
+ { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7,
+ -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 },
+ { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19,
+ -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 },
+ { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1,
+ 15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 },
+ { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4,
+ -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 },
+ { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3,
+ -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 },
+ { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1,
+ 4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 },
+ { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4,
+ 8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 },
+ { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4,
+ 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 },
+ { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1,
+ -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 },
+ { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10,
+ -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 },
+ { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7,
+ -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 },
+ { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10,
+ -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 },
+ { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4,
+ 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 },
+ { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3,
+ -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 },
+ { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8,
+ 0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 },
+ { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5,
+ 32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 },
+ { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6,
+ -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 },
+ { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10,
+ -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 },
+ { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5,
+ -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 },
+ { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12,
+ -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 },
+ { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2,
+ 11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 },
+ { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1,
+ 1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 },
+ { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2,
+ -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 },
+ { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3,
+ -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1,
+ 0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 },
+ { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18,
+ 15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0,
+ -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 },
+ { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1,
+ -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 },
+ { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4,
+ -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 },
+ { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0,
+ 3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 },
+ { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3,
+ 56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 },
+ { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8,
+ 2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 },
+ { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16,
+ -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 },
+ { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25,
+ -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 },
+ { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1,
+ -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 },
+ { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11,
+ 10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 },
+ { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0,
+ -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 },
+ { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1,
+ 1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 },
+ { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2,
+ -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 },
+ { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11,
+ -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 },
+ { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7,
+ -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
+ 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
+ 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
+ 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
+ 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
+ { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13,
+ -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 },
+ { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8,
+ -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 },
+ { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7,
+ 36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 },
+ { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11,
+ 8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 },
+ { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8,
+ 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 },
+ { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5,
+ -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 },
+ { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15,
+ 24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 },
+ { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0,
+ 24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 },
+ { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4,
+ 10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 },
+ { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1,
+ -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 },
+ { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1,
+ 10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 },
+ { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19,
+ 3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 },
+ { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2,
+ 8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 },
+ { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
+ -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
+ { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
+ -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
+ { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
+ -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
+ { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
+ 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
+ { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
+ 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
+ { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
+ -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
+ 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
+ { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
+ -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
+ { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
+ -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
+ { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
+ -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
+ { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
+ 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
+ { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
+ 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
+ { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
+ -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
+ 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
+ { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4,
+ 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 },
+ { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7,
+ 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 },
+ { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4,
+ 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 },
+ { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17,
+ -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 },
+ { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8,
+ -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 },
+ { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4,
+ 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 },
+ { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1,
+ 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 },
+ { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1,
+ 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 },
+ { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2,
+ 8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 },
+ { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0,
+ -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 },
+ { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5,
+ 3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 },
+ { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17,
+ 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 },
+ { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6,
+ -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 },
+ { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16,
+ 3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 },
+ { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15,
+ 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 },
+ { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4,
+ 2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 },
+ { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9,
+ 24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 },
+ { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19,
+ 2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 },
+ { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14,
+ 7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 },
+ { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9,
+ 8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 },
+ { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5,
+ 10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 },
+ { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4,
+ 8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 },
+ { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8,
+ 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 },
+ { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9,
+ 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 },
+ { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12,
+ 7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 },
+ { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4,
+ -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 },
+ { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0,
+ 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 },
+ { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12,
+ 7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 },
+ { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2,
+ 16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 },
+ { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11,
+ -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 },
+ { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8,
+ -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 },
+ { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2,
+ -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 },
+ { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5,
+ -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 },
+ { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5,
+ -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 },
+ { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4,
+ -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 },
+ { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2,
+ -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 },
+ { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3,
+ 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 },
+ { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12,
+ -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 },
+ { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9,
+ -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 },
+ { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30,
+ 2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 },
+ { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16,
+ 0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 },
+ { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5,
+ -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 },
+ { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3,
+ 4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 },
+ { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13,
+ 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 },
+ { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1,
+ -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 },
+ { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1,
+ -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 },
+ { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3,
+ -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 },
+ { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1,
+ -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 },
+ { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11,
+ -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 },
+ { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6,
+ -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 },
+ { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4,
+ 5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 },
+ { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6,
+ -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 },
+ { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7,
+ 6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 },
+ { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3,
+ -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 },
+ { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15,
+ -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 },
+ { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4,
+ 7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 },
+ { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9,
+ -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 },
+ { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14,
+ -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 },
+ { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1,
+ -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 },
+ { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4,
+ -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 },
+ { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9,
+ 0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 },
+ { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4,
+ 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 },
+ { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16,
+ 0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 },
+ { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13,
+ 13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 },
+ { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4,
+ -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 },
+ { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17,
+ 3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 },
+ { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5,
+ -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 },
+ { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7,
+ -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 },
+ { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7,
+ -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 },
+ { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1,
+ -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 },
+ { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4,
+ -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 },
+ { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7,
+ 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 },
+ { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1,
+ 10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 },
+ { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6,
+ 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 },
+ { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4,
+ -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 },
+ { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0,
+ -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 },
+ { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6,
+ 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 },
+ { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1,
+ 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 },
+ { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2,
+ 0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 },
+ { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15,
+ 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 },
+ { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2,
+ -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 },
+ { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11,
+ 11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 },
+ { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8,
+ 7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 },
+ { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3,
+ -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 },
+ { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12,
+ -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 },
+ { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0,
+ 5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 },
+ { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14,
+ 9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 },
+ { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2,
+ 17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 },
+ { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6,
+ -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 },
+ { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6,
+ -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 },
+ { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2,
+ 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 },
+ { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16,
+ -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 },
+ { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19,
+ 6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 },
+ { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11,
+ -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 },
+ { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13,
+ 9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 },
+ { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2,
+ -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 },
+ { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11,
+ 5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 },
+ { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7,
+ 21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 },
+ { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8,
+ 23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,
+ 35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0,
+ 41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 },
+ { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7,
+ 10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 },
+ { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7,
+ 23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5,
+ -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 },
+ { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40,
+ 10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 },
+ { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0,
+ 4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 },
+ { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
+ 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
+ { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
+ -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
+ { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
+ -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
+ { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
+ 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
+ { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
+ -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
+ 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
+ { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
+ 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
+ { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
+ -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
+ { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
+ 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
+ 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
+ { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
+ -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
+ { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
+ -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
+ { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
+ 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
+ { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
+ -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
+ 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
+ { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
+ 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
+ { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
+ -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
+ { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
+ 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5,
+ 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 },
+ { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7,
+ -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 },
+ { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5,
+ 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 },
+ { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12,
+ -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 },
+ { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2,
+ -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 },
+ { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1,
+ -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 },
+ { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7,
+ -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 },
+ { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9,
+ 8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 },
+ { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4,
+ -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 },
+ { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12,
+ -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 },
+ { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17,
+ -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 },
+ { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2,
+ 0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 },
+ { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7,
+ 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 },
+ { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5,
+ -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 },
+ { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9,
+ 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 },
+ { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2,
+ 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 },
+ { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5,
+ 5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 },
+ { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14,
+ -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 },
+ { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7,
+ -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 },
+ { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0,
+ -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 },
+ { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8,
+ 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 },
+ { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1,
+ 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 },
+ { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1,
+ 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 },
+ { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1,
+ 8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 },
+ { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8,
+ -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 },
+ { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16,
+ 0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 },
+ { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8,
+ -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 },
+ { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4,
+ 10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 },
+ { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6,
+ 8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 },
+ { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1,
+ 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 },
+ { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3,
+ 3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 },
+ { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4,
+ 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 },
+ { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2,
+ -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 },
+ { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6,
+ -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 },
+ { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2,
+ 13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 },
+ { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2,
+ 8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 },
+ { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3,
+ 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 },
+ { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4,
+ 7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 },
+ { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4,
+ -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 },
+ { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4,
+ -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 },
+ { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3,
+ 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 },
+ { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7,
+ -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 },
+ { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0,
+ -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 },
+ { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12,
+ -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 },
+ { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2,
+ 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 },
+ { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13,
+ -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 },
+ { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3,
+ 17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 },
+ { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0,
+ -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 },
+ { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5,
+ 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 },
+ { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10,
+ 1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 },
+ { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21,
+ 3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 },
+ { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5,
+ 12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 },
+ { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5,
+ -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 },
+ { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3,
+ -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 },
+ { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2,
+ -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 },
+ { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10,
+ -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 },
+ { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4,
+ 1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 },
+ { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13,
+ 8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 },
+ { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19,
+ 3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 },
+ { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2,
+ -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 },
+ { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8,
+ 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 },
+ { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7,
+ -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 },
+ { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6,
+ -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 },
+ { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11,
+ -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 },
+ { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8,
+ -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 },
+ { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6,
+ 7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 },
+ { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1,
+ 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 },
+ { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1,
+ 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 },
+ { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7,
+ 5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 },
+ { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1,
+ 2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 },
+ { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3,
+ -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 },
+ { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12,
+ -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 },
+ { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14,
+ -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 },
+ { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2,
+ 4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 },
+ { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11,
+ 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 },
+ { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12,
+ -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 },
+ { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2,
+ 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 },
+ { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4,
+ 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 },
+ { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2,
+ -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 },
+ { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5,
+ -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 },
+ { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9,
+ 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 },
+ { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5,
+ -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 },
+ { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1,
+ 4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 },
+ { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2,
+ 1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 },
+ { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0,
+ 5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 },
+ { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8,
+ -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 },
+ { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4,
+ 6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 },
+ { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4,
+ -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 },
+ { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11,
+ 0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 },
+ { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8,
+ -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 },
+ { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6,
+ -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 },
+ { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8,
+ 3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 },
+ { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6,
+ -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 },
+ { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2,
+ 9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 },
+ { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3,
+ 1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 },
+ { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1,
+ -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 },
+ { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2,
+ -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 },
+ { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7,
+ 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 },
+ { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5,
+ -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 },
+ { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10,
+ -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 },
+ { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3,
+ 1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 },
+ { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5,
+ 2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 },
+ { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14,
+ 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 },
+ { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3,
+ 1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 },
+ { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2,
+ 6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 },
+ { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11,
+ 0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 },
+ { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25,
+ 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 },
+ { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16,
+ 12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 },
+ { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0,
+ 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 },
+ { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14,
+ -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 },
+ { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2,
+ 0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 },
+ { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5,
+ 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 },
+ { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12,
+ 1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 },
+ { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0,
+ 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 },
+ { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0,
+ 6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 },
+ { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4,
+ 5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 },
+ { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13,
+ 16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 },
+ { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7,
+ 26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 },
+ { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17,
+ 7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 },
+ { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1,
+ 9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 },
+ { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7,
+ 10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 },
+ { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0,
+ 7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 },
+ { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1,
+ 1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 },
+ { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9,
+ -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 },
+ { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9,
+ -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 },
+ { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8,
+ 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 },
+ { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3,
+ 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 },
+ { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7,
+ 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 },
+ { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5,
+ -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 },
+ { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20,
+ 7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 },
+ { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2,
+ -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 },
+ { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7,
+ -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 },
+ { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7,
+ 4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 },
+ { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7,
+ -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 },
+ { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2,
+ -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 },
+ { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2,
+ 3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 },
+ { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2,
+ 6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 },
+ { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6,
+ -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 },
+ { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5,
+ 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 },
+ { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1,
+ 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 },
+ { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10,
+ -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 },
+ { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4,
+ -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 },
+ { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6,
+ 11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 },
+ { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7,
+ -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 },
+ { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13,
+ -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 },
+ { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5,
+ -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 },
+ { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6,
+ 22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 },
+ { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4,
+ -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 },
+ { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4,
+ 6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 },
+ { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7,
+ -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 },
+ { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15,
+ -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 },
+ { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1,
+ -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 },
+ { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7,
+ -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 },
+ { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3,
+ -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 },
+ { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1,
+ -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 },
+ { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1,
+ 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 },
+ { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7,
+ 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 },
+ { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3,
+ -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 },
+ { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1,
+ -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 },
+ { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5,
+ 5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 },
+ { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26,
+ -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 },
+ { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3,
+ -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 },
+ { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5,
+ 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 },
+ { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18,
+ 3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 },
+ { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2,
+ 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 },
+ { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2,
+ 4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 },
+ { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3,
+ -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 },
+ { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5,
+ -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 },
+ { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2,
+ -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 },
+ { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3,
+ -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 },
+ { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12,
+ 9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 },
+ { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4,
+ 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 },
+ { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6,
+ -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 },
+ { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9,
+ 8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 },
+ { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7,
+ 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 },
+ { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4,
+ -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 },
+ { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3,
+ -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 },
+ { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2,
+ 1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 },
+ { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2,
+ -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 },
+ { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10,
+ -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 },
+ { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8,
+ -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 },
+ { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8,
+ 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 },
+ { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3,
+ -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 },
+ { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5,
+ 5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 },
+ { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15,
+ 2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 },
+ { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9,
+ 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 },
+ { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7,
+ -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 },
+ { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4,
+ 4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 },
+ { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1,
+ 2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 },
+ { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9,
+ 9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 },
+ { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6,
+ 5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 },
+ { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15,
+ -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 },
+ { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0,
+ 1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 },
+ { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4,
+ -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 },
+ { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3,
+ -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 },
+ { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18,
+ 8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 },
+ { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9,
+ 14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 },
+ { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2,
+ 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 },
+ { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6,
+ -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 },
+ { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7,
+ 8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 },
+ { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7,
+ 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 },
+ { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5,
+ -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 },
+ { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10,
+ 1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 },
+ { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0,
+ 5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 },
+ { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3,
+ 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 },
+ { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19,
+ 1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 },
+ { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2,
+ 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 },
+ { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6,
+ 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 },
+ { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2,
+ -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 },
+ { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1,
+ 10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 },
+ { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4,
+ 8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 },
+ { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6,
+ 16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 },
+ { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1,
+ 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 },
+ { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3,
+ 29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 },
+ { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5,
+ 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 },
+ { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10,
+ 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 },
+ { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2,
+ 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 },
+ { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8,
+ 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 },
+ { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4,
+ 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 },
+ { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8,
+ -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 },
+ { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1,
+ 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 },
+ { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2,
+ -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 },
+ { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4,
+ 4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 },
+ { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0,
+ 8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 },
+ { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10,
+ 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 },
+ { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6,
+ -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 },
+ { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4,
+ -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 },
+ { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3,
+ 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 },
+ { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1,
+ -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 },
+ { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10,
+ 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 },
+ { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5,
+ 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 },
+ { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3,
+ -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 },
+ { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8,
+ -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 },
+ { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17,
+ -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 },
+ { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5,
+ 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 },
+ { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10,
+ -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 },
+ { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18,
+ 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 },
+ { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6,
+ -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 },
+ { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10,
+ -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 },
+ { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2,
+ -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 },
+ { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6,
+ -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 },
+ { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1,
+ 6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 },
+ { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1,
+ 12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 },
+ { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10,
+ 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 },
+ { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0,
+ 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 },
+ { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2,
+ 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 },
+ { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12,
+ 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 },
+ { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6,
+ -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 },
+ { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5,
+ -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 },
+ { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22,
+ 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 },
+ { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7,
+ 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 },
+ { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7,
+ -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 },
+ { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3,
+ -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 },
+ { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6,
+ -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 },
+ { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11,
+ -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 },
+ { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1,
+ -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 },
+ { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0,
+ -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 },
+ { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9,
+ -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 },
+ { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1,
+ -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 },
+ { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5,
+ 0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 },
+ { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11,
+ 9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 },
+ { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1,
+ 2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 },
+ { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6,
+ -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 },
+ { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4,
+ 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 },
+ { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27,
+ -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 },
+ { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1,
+ -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 },
+ { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2,
+ -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 },
+ { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1,
+ -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 },
+ { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2,
+ 16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 },
+ { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4,
+ 3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 },
+ { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9,
+ -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 },
+ { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8,
+ 0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 },
+ { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13,
+ -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 },
+ { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5,
+ -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 },
+ { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5,
+ 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 },
+ { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2,
+ 11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 },
+ { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2,
+ 3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 },
+ { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18,
+ 9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 },
+ { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4,
+ 1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 },
+ { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1,
+ -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 },
+ { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18,
+ -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 },
+ { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3,
+ -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 },
+ { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5,
+ 0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 },
+ { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8,
+ 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 },
+ { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6,
+ 8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 },
+ { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10,
+ -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 },
+ { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9,
+ 0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 },
+ { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1,
+ -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 },
+ { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15,
+ -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 },
+ { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10,
+ 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 },
+ { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0,
+ 9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 },
+ { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1,
+ -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 },
+ { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5,
+ 2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 },
+ { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4,
+ -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 },
+ { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7,
+ -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 },
+ { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1,
+ -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 },
+ { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1,
+ -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 },
+ { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6,
+ 5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 },
+ { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5,
+ -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 },
+ { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1,
+ -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 },
+ { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2,
+ 1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 },
+ { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1,
+ -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 },
+ { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3,
+ 8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 },
+ { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1,
+ 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 },
+ { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2,
+ -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 },
+ { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2,
+ 9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 },
+ { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0,
+ -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 },
+ { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12,
+ -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 },
+ { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2,
+ 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 },
+ { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2,
+ 9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 },
+ { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6,
+ -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 },
+ { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6,
+ 2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 },
+ { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1,
+ -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 },
+ { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11,
+ -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 },
+ { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11,
+ 3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 },
+ { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7,
+ 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 },
+ { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4,
+ -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 },
+ { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4,
+ -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 },
+ { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31,
+ 2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 },
+ { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13,
+ -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 },
+ { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9,
+ -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 },
+ { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15,
+ -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 },
+ { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21,
+ -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 },
+ { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8,
+ -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 },
+ { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17,
+ 3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 },
+ { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15,
+ -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 },
+ { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3,
+ -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 },
+ { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4,
+ 8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 },
+ { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16,
+ -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 },
+ { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2,
+ -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 },
+ { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10,
+ -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 },
+ { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18,
+ -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 },
+ { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1,
+ 2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 },
+ { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1,
+ -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 },
+ { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20,
+ 5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 },
+ { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5,
+ -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 },
+ { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16,
+ -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 },
+ { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3,
+ -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 },
+ { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7,
+ 3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 },
+ { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0,
+ -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 },
+ { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1,
+ -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 },
+ { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25,
+ 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 },
+ { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12,
+ -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 },
+ { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3,
+ -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 },
+ { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21,
+ 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 },
+ { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23,
+ -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 },
+ { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5,
+ 5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 },
+ { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13,
+ -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 },
+ { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15,
+ -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 },
+ { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45,
+ -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 },
+ { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6,
+ 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 },
+ { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17,
+ -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 },
+ { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5,
+ -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 },
+ { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1,
+ -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 },
+ { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4,
+ -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 },
+ { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6,
+ -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 },
+ { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5,
+ -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 },
+ { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0,
+ -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 },
+ { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5,
+ -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 },
+ { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5,
+ -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 },
+ { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11,
+ -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 },
+ { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13,
+ -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 },
+ { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0,
+ -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 },
+ { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6,
+ -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 },
+ { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3,
+ 1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 },
+ { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6,
+ -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 },
+ { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4,
+ -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 },
+ { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6,
+ -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 },
+ { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27,
+ -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 },
+ { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7,
+ -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 },
+ { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0,
+ -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 },
+ { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2,
+ -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 },
+ { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26,
+ -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 },
+ { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3,
+ -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 },
+ { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20,
+ -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 },
+ { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7,
+ -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 },
+ { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14,
+ -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 },
+ { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8,
+ -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 },
+ { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13,
+ -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 },
+ { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17,
+ -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 },
+ { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9,
+ -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 },
+ { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8,
+ -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 },
+ { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7,
+ -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 },
+ { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4,
+ -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 },
+ { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19,
+ -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 },
+ { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8,
+ -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 },
+ { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1,
+ -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 },
+ { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9,
+ -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 },
+ { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2,
+ -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 },
+ { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6,
+ -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 },
+ { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9,
+ 7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 },
+ { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4,
+ -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 },
+ { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0,
+ 11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 },
+ { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12,
+ -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 },
+ { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1,
+ 3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 },
+ { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21,
+ -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 },
+ { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9,
+ -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 },
+ { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9,
+ -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 },
+ { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6,
+ -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 },
+ { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1,
+ 18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 },
+ { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7,
+ 6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 },
+ { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10,
+ 16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 },
+ { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17,
+ -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 },
+ { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5,
+ -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 },
+ { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15,
+ 6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 },
+ { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2,
+ -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 },
+ { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28,
+ 2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 },
+ { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5,
+ -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 },
+ { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0,
+ -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 },
+ { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3,
+ 1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 },
+ { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8,
+ -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 },
+ { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4,
+ -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 },
+ { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2,
+ 14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 },
+ { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28,
+ -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 },
+ { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3,
+ -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 },
+ { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28,
+ 0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 },
+ { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6,
+ -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 },
+ { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1,
+ 0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 },
+ { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3,
+ 7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 },
+ { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8,
+ 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 },
+ { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14,
+ 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 },
+ { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14,
+ 7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 },
+ { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1,
+ 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 },
+ { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5,
+ 0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 },
+ { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1,
+ 5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 },
+ { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2,
+ -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 },
+ { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3,
+ 5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 },
+ { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13,
+ 8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 },
+ { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4,
+ 4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 },
+ { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1,
+ 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 },
+ { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0,
+ 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 },
+ { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3,
+ -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 },
+ { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12,
+ -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 },
+ { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9,
+ 22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 },
+ { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1,
+ 13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 },
+ { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6,
+ 15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 },
+ { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7,
+ -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 },
+ { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5,
+ -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 },
+ { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4,
+ 3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 },
+ { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9,
+ 18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 },
+ { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4,
+ 1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 },
+ { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2,
+ 2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 },
+ { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1,
+ 2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 },
+ { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3,
+ 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 },
+ { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3,
+ 4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 },
+ { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2,
+ -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 },
+ { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2,
+ 0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 },
+ { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2,
+ -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 },
+ { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1,
+ 2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 },
+ { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6,
+ -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 },
+ { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12,
+ 17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 },
+ { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0,
+ 1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 },
+ { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2,
+ -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 },
+ { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7,
+ -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 },
+ { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6,
+ -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 },
+ { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11,
+ 2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 },
+ { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0,
+ 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 },
+ { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4,
+ 12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 },
+ { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2,
+ 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 },
+ { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3,
+ -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 },
+ { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13,
+ 17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 },
+ { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6,
+ 7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 },
+ { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10,
+ 10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 },
+ { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1,
+ 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 },
+ { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5,
+ 1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 },
+ { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1,
+ -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 },
+ { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4,
+ -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 },
+ { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10,
+ -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 },
+ { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9,
+ 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 },
+ { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1,
+ -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 },
+ { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4,
+ -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 },
+ { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6,
+ 20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 },
+ { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7,
+ 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 },
+ { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9,
+ -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 },
+ { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5,
+ -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 },
+ { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9,
+ 5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 },
+ { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2,
+ -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 },
+ { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4,
+ 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 },
+ { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3,
+ 2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 },
+ { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15,
+ -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 },
+ { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4,
+ 1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 },
+ { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7,
+ 1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 },
+ { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7,
+ 0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 },
+ { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2,
+ -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 },
+ { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0,
+ 3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 },
+ { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4,
+ -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 },
+ { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2,
+ -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 },
+ { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7,
+ 4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 },
+ { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2,
+ 6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 },
+ { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2,
+ -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 },
+ { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11,
+ -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 },
+ { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4,
+ 4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 },
+ { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4,
+ -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 },
+ { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6,
+ -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 },
+ { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7,
+ -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 },
+ { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6,
+ -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 },
+ { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11,
+ 7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 },
+ { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3,
+ -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 },
+ { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3,
+ 7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 },
+ { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6,
+ 9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 },
+ { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10,
+ -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 },
+ { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7,
+ 8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 },
+ { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14,
+ 6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 },
+ { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11,
+ 1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 },
+ { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6,
+ 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 },
+ { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10,
+ 15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 },
+ { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4,
+ 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 },
+ { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0,
+ 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 },
+ { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2,
+ 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 },
+ { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10,
+ 13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 },
+ { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2,
+ 7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 },
+ { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5,
+ 4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 }
};
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/callback.h b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/callback.h
index 2f96f1c02..3def56dab 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/callback.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/callback.h
@@ -82,101 +82,100 @@
extern "C" {
#endif
- /** This is the opaque handle type used by the callbacks. Typically
- * this is a \c FILE* or address of a file descriptor.
- */
- typedef void* FLAC__IOHandle;
-
- /** Signature for the read callback.
- * The signature and semantics match POSIX fread() implementations
- * and can generally be used interchangeably.
- *
- * \param ptr The address of the read buffer.
- * \param size The size of the records to be read.
- * \param nmemb The number of records to be read.
- * \param handle The handle to the data source.
- * \retval size_t
- * The number of records read.
- */
- typedef size_t (*FLAC__IOCallback_Read)(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
-
- /** Signature for the write callback.
- * The signature and semantics match POSIX fwrite() implementations
- * and can generally be used interchangeably.
- *
- * \param ptr The address of the write buffer.
- * \param size The size of the records to be written.
- * \param nmemb The number of records to be written.
- * \param handle The handle to the data source.
- * \retval size_t
- * The number of records written.
- */
- typedef size_t (*FLAC__IOCallback_Write)(const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
-
- /** Signature for the seek callback.
- * The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
- * EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
- * and 32-bits wide.
- *
- * \param handle The handle to the data source.
- * \param offset The new position, relative to \a whence
- * \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
- * \retval int
- * \c 0 on success, \c -1 on error.
- */
- typedef int (*FLAC__IOCallback_Seek)(FLAC__IOHandle handle, FLAC__int64 offset, int whence);
-
- /** Signature for the tell callback.
- * The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
- * EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
- * and 32-bits wide.
- *
- * \param handle The handle to the data source.
- * \retval FLAC__int64
- * The current position on success, \c -1 on error.
- */
- typedef FLAC__int64(*FLAC__IOCallback_Tell)(FLAC__IOHandle handle);
-
- /** Signature for the EOF callback.
- * The signature and semantics mostly match POSIX feof() but WATCHOUT:
- * on many systems, feof() is a macro, so in this case a wrapper function
- * must be provided instead.
- *
- * \param handle The handle to the data source.
- * \retval int
- * \c 0 if not at end of file, nonzero if at end of file.
- */
- typedef int (*FLAC__IOCallback_Eof)(FLAC__IOHandle handle);
-
- /** Signature for the close callback.
- * The signature and semantics match POSIX fclose() implementations
- * and can generally be used interchangeably.
- *
- * \param handle The handle to the data source.
- * \retval int
- * \c 0 on success, \c EOF on error.
- */
- typedef int (*FLAC__IOCallback_Close)(FLAC__IOHandle handle);
-
- /** A structure for holding a set of callbacks.
- * Each FLAC interface that requires a FLAC__IOCallbacks structure will
- * describe which of the callbacks are required. The ones that are not
- * required may be set to NULL.
- *
- * If the seek requirement for an interface is optional, you can signify that
- * a data sorce is not seekable by setting the \a seek field to \c NULL.
- */
- typedef struct
- {
- FLAC__IOCallback_Read read;
- FLAC__IOCallback_Write write;
- FLAC__IOCallback_Seek seek;
- FLAC__IOCallback_Tell tell;
- FLAC__IOCallback_Eof eof;
- FLAC__IOCallback_Close close;
- } FLAC__IOCallbacks;
-
- /* \} */
+/** This is the opaque handle type used by the callbacks. Typically
+ * this is a \c FILE* or address of a file descriptor.
+ */
+typedef void* FLAC__IOHandle;
+
+/** Signature for the read callback.
+ * The signature and semantics match POSIX fread() implementations
+ * and can generally be used interchangeably.
+ *
+ * \param ptr The address of the read buffer.
+ * \param size The size of the records to be read.
+ * \param nmemb The number of records to be read.
+ * \param handle The handle to the data source.
+ * \retval size_t
+ * The number of records read.
+ */
+typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
+
+/** Signature for the write callback.
+ * The signature and semantics match POSIX fwrite() implementations
+ * and can generally be used interchangeably.
+ *
+ * \param ptr The address of the write buffer.
+ * \param size The size of the records to be written.
+ * \param nmemb The number of records to be written.
+ * \param handle The handle to the data source.
+ * \retval size_t
+ * The number of records written.
+ */
+typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
+
+/** Signature for the seek callback.
+ * The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
+ * EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
+ * and 32-bits wide.
+ *
+ * \param handle The handle to the data source.
+ * \param offset The new position, relative to \a whence
+ * \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
+ * \retval int
+ * \c 0 on success, \c -1 on error.
+ */
+typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
+
+/** Signature for the tell callback.
+ * The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
+ * EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
+ * and 32-bits wide.
+ *
+ * \param handle The handle to the data source.
+ * \retval FLAC__int64
+ * The current position on success, \c -1 on error.
+ */
+typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
+
+/** Signature for the EOF callback.
+ * The signature and semantics mostly match POSIX feof() but WATCHOUT:
+ * on many systems, feof() is a macro, so in this case a wrapper function
+ * must be provided instead.
+ *
+ * \param handle The handle to the data source.
+ * \retval int
+ * \c 0 if not at end of file, nonzero if at end of file.
+ */
+typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
+
+/** Signature for the close callback.
+ * The signature and semantics match POSIX fclose() implementations
+ * and can generally be used interchangeably.
+ *
+ * \param handle The handle to the data source.
+ * \retval int
+ * \c 0 on success, \c EOF on error.
+ */
+typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
+
+/** A structure for holding a set of callbacks.
+ * Each FLAC interface that requires a FLAC__IOCallbacks structure will
+ * describe which of the callbacks are required. The ones that are not
+ * required may be set to NULL.
+ *
+ * If the seek requirement for an interface is optional, you can signify that
+ * a data sorce is not seekable by setting the \a seek field to \c NULL.
+ */
+typedef struct {
+ FLAC__IOCallback_Read read;
+ FLAC__IOCallback_Write write;
+ FLAC__IOCallback_Seek seek;
+ FLAC__IOCallback_Tell tell;
+ FLAC__IOCallback_Eof eof;
+ FLAC__IOCallback_Close close;
+} FLAC__IOCallbacks;
+
+/* \} */
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/export.h b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/export.h
index 22570ef22..9bf6d6387 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/export.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/export.h
@@ -79,8 +79,8 @@
extern "C" {
#endif
- /** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
- extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
+/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
+extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/format.h b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/format.h
index 90d217394..27dc36521 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/format.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/format.h
@@ -39,1015 +39,981 @@
extern "C" {
#endif
- /** \file include/FLAC/format.h
- *
- * \brief
- * This module contains structure definitions for the representation
- * of FLAC format components in memory. These are the basic
- * structures used by the rest of the interfaces.
- *
- * See the detailed documentation in the
- * \link flac_format format \endlink module.
- */
-
- /** \defgroup flac_format FLAC/format.h: format components
- * \ingroup flac
- *
- * \brief
- * This module contains structure definitions for the representation
- * of FLAC format components in memory. These are the basic
- * structures used by the rest of the interfaces.
- *
- * First, you should be familiar with the
- * <A HREF="../format.html">FLAC format</A>. Many of the values here
- * follow directly from the specification. As a user of libFLAC, the
- * interesting parts really are the structures that describe the frame
- * header and metadata blocks.
- *
- * The format structures here are very primitive, designed to store
- * information in an efficient way. Reading information from the
- * structures is easy but creating or modifying them directly is
- * more complex. For the most part, as a user of a library, editing
- * is not necessary; however, for metadata blocks it is, so there are
- * convenience functions provided in the \link flac_metadata metadata
- * module \endlink to simplify the manipulation of metadata blocks.
- *
- * \note
- * It's not the best convention, but symbols ending in _LEN are in bits
- * and _LENGTH are in bytes. _LENGTH symbols are \#defines instead of
- * global variables because they are usually used when declaring byte
- * arrays and some compilers require compile-time knowledge of array
- * sizes when declared on the stack.
- *
- * \{
- */
-
-
- /*
- Most of the values described in this file are defined by the FLAC
- format specification. There is nothing to tune here.
- */
-
- /** The largest legal metadata type code. */
+/** \file include/FLAC/format.h
+ *
+ * \brief
+ * This module contains structure definitions for the representation
+ * of FLAC format components in memory. These are the basic
+ * structures used by the rest of the interfaces.
+ *
+ * See the detailed documentation in the
+ * \link flac_format format \endlink module.
+ */
+
+/** \defgroup flac_format FLAC/format.h: format components
+ * \ingroup flac
+ *
+ * \brief
+ * This module contains structure definitions for the representation
+ * of FLAC format components in memory. These are the basic
+ * structures used by the rest of the interfaces.
+ *
+ * First, you should be familiar with the
+ * <A HREF="../format.html">FLAC format</A>. Many of the values here
+ * follow directly from the specification. As a user of libFLAC, the
+ * interesting parts really are the structures that describe the frame
+ * header and metadata blocks.
+ *
+ * The format structures here are very primitive, designed to store
+ * information in an efficient way. Reading information from the
+ * structures is easy but creating or modifying them directly is
+ * more complex. For the most part, as a user of a library, editing
+ * is not necessary; however, for metadata blocks it is, so there are
+ * convenience functions provided in the \link flac_metadata metadata
+ * module \endlink to simplify the manipulation of metadata blocks.
+ *
+ * \note
+ * It's not the best convention, but symbols ending in _LEN are in bits
+ * and _LENGTH are in bytes. _LENGTH symbols are \#defines instead of
+ * global variables because they are usually used when declaring byte
+ * arrays and some compilers require compile-time knowledge of array
+ * sizes when declared on the stack.
+ *
+ * \{
+ */
+
+
+/*
+ Most of the values described in this file are defined by the FLAC
+ format specification. There is nothing to tune here.
+*/
+
+/** The largest legal metadata type code. */
#define FLAC__MAX_METADATA_TYPE_CODE (126u)
- /** The minimum block size, in samples, permitted by the format. */
+/** The minimum block size, in samples, permitted by the format. */
#define FLAC__MIN_BLOCK_SIZE (16u)
- /** The maximum block size, in samples, permitted by the format. */
+/** The maximum block size, in samples, permitted by the format. */
#define FLAC__MAX_BLOCK_SIZE (65535u)
- /** The maximum block size, in samples, permitted by the FLAC subset for
- * sample rates up to 48kHz. */
+/** The maximum block size, in samples, permitted by the FLAC subset for
+ * sample rates up to 48kHz. */
#define FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ (4608u)
- /** The maximum number of channels permitted by the format. */
+/** The maximum number of channels permitted by the format. */
#define FLAC__MAX_CHANNELS (8u)
- /** The minimum sample resolution permitted by the format. */
+/** The minimum sample resolution permitted by the format. */
#define FLAC__MIN_BITS_PER_SAMPLE (4u)
- /** The maximum sample resolution permitted by the format. */
+/** The maximum sample resolution permitted by the format. */
#define FLAC__MAX_BITS_PER_SAMPLE (32u)
- /** The maximum sample resolution permitted by libFLAC.
- *
- * \warning
- * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However,
- * the reference encoder/decoder is currently limited to 24 bits because
- * of prevalent 32-bit math, so make sure and use this value when
- * appropriate.
- */
+/** The maximum sample resolution permitted by libFLAC.
+ *
+ * \warning
+ * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However,
+ * the reference encoder/decoder is currently limited to 24 bits because
+ * of prevalent 32-bit math, so make sure and use this value when
+ * appropriate.
+ */
#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)
- /** The maximum sample rate permitted by the format. The value is
- * ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A>
- * as to why.
- */
+/** The maximum sample rate permitted by the format. The value is
+ * ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A>
+ * as to why.
+ */
#define FLAC__MAX_SAMPLE_RATE (655350u)
- /** The maximum LPC order permitted by the format. */
+/** The maximum LPC order permitted by the format. */
#define FLAC__MAX_LPC_ORDER (32u)
- /** The maximum LPC order permitted by the FLAC subset for sample rates
- * up to 48kHz. */
+/** The maximum LPC order permitted by the FLAC subset for sample rates
+ * up to 48kHz. */
#define FLAC__SUBSET_MAX_LPC_ORDER_48000HZ (12u)
- /** The minimum quantized linear predictor coefficient precision
- * permitted by the format.
- */
+/** The minimum quantized linear predictor coefficient precision
+ * permitted by the format.
+ */
#define FLAC__MIN_QLP_COEFF_PRECISION (5u)
- /** The maximum quantized linear predictor coefficient precision
- * permitted by the format.
- */
+/** The maximum quantized linear predictor coefficient precision
+ * permitted by the format.
+ */
#define FLAC__MAX_QLP_COEFF_PRECISION (15u)
- /** The maximum order of the fixed predictors permitted by the format. */
+/** The maximum order of the fixed predictors permitted by the format. */
#define FLAC__MAX_FIXED_ORDER (4u)
- /** The maximum Rice partition order permitted by the format. */
+/** The maximum Rice partition order permitted by the format. */
#define FLAC__MAX_RICE_PARTITION_ORDER (15u)
- /** The maximum Rice partition order permitted by the FLAC Subset. */
+/** The maximum Rice partition order permitted by the FLAC Subset. */
#define FLAC__SUBSET_MAX_RICE_PARTITION_ORDER (8u)
- /** The version string of the release, stamped onto the libraries and binaries.
- *
- * \note
- * This does not correspond to the shared library version number, which
- * is used to determine binary compatibility.
- */
- extern FLAC_API const char *FLAC__VERSION_STRING;
+/** The version string of the release, stamped onto the libraries and binaries.
+ *
+ * \note
+ * This does not correspond to the shared library version number, which
+ * is used to determine binary compatibility.
+ */
+extern FLAC_API const char *FLAC__VERSION_STRING;
- /** The vendor string inserted by the encoder into the VORBIS_COMMENT block.
- * This is a NUL-terminated ASCII string; when inserted into the
- * VORBIS_COMMENT the trailing null is stripped.
- */
- extern FLAC_API const char *FLAC__VENDOR_STRING;
+/** The vendor string inserted by the encoder into the VORBIS_COMMENT block.
+ * This is a NUL-terminated ASCII string; when inserted into the
+ * VORBIS_COMMENT the trailing null is stripped.
+ */
+extern FLAC_API const char *FLAC__VENDOR_STRING;
- /** The byte string representation of the beginning of a FLAC stream. */
- extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */
+/** The byte string representation of the beginning of a FLAC stream. */
+extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */
- /** The 32-bit integer big-endian representation of the beginning of
- * a FLAC stream.
- */
- extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */
+/** The 32-bit integer big-endian representation of the beginning of
+ * a FLAC stream.
+ */
+extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */
- /** The length of the FLAC signature in bits. */
- extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */
+/** The length of the FLAC signature in bits. */
+extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */
- /** The length of the FLAC signature in bytes. */
+/** The length of the FLAC signature in bytes. */
#define FLAC__STREAM_SYNC_LENGTH (4u)
- /*****************************************************************************
- *
- * Subframe structures
- *
- *****************************************************************************/
-
- /*****************************************************************************/
-
- /** An enumeration of the available entropy coding methods. */
- typedef enum
- {
- FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0,
- /**< Residual is coded by partitioning into contexts, each with it's own
- * 4-bit Rice parameter. */
-
- FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 = 1
- /**< Residual is coded by partitioning into contexts, each with it's own
- * 5-bit Rice parameter. */
- } FLAC__EntropyCodingMethodType;
-
- /** Maps a FLAC__EntropyCodingMethodType to a C string.
- *
- * Using a FLAC__EntropyCodingMethodType as the index to this array will
- * give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[];
-
-
- /** Contents of a Rice partitioned residual
- */
- typedef struct
- {
-
- unsigned *parameters;
- /**< The Rice parameters for each context. */
-
- unsigned *raw_bits;
- /**< Widths for escape-coded partitions. Will be non-zero for escaped
- * partitions and zero for unescaped partitions.
- */
-
- unsigned capacity_by_order;
- /**< The capacity of the \a parameters and \a raw_bits arrays
- * specified as an order, i.e. the number of array elements
- * allocated is 2 ^ \a capacity_by_order.
- */
- } FLAC__EntropyCodingMethod_PartitionedRiceContents;
-
- /** Header for a Rice partitioned residual. (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>)
- */
- typedef struct
- {
-
- unsigned order;
- /**< The partition order, i.e. # of contexts = 2 ^ \a order. */
-
- const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents;
- /**< The context's Rice parameters and/or raw bits. */
-
- } FLAC__EntropyCodingMethod_PartitionedRice;
-
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN; /**< == 5 (bits) */
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */
-
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
- /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER;
- /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
-
- /** Header for the entropy coding method. (c.f. <A HREF="../format.html#residual">format specification</A>)
- */
- typedef struct
- {
- FLAC__EntropyCodingMethodType type;
- union
- {
- FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice;
- } data;
- } FLAC__EntropyCodingMethod;
-
- extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */
-
- /*****************************************************************************/
-
- /** An enumeration of the available subframe types. */
- typedef enum
- {
- FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */
- FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */
- FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */
- FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */
- } FLAC__SubframeType;
-
- /** Maps a FLAC__SubframeType to a C string.
- *
- * Using a FLAC__SubframeType as the index to this array will
- * give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__SubframeTypeString[];
-
-
- /** CONSTANT subframe. (c.f. <A HREF="../format.html#subframe_constant">format specification</A>)
- */
- typedef struct
- {
- FLAC__int32 value; /**< The constant signal value. */
- } FLAC__Subframe_Constant;
-
-
- /** VERBATIM subframe. (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
- */
- typedef struct
- {
- const FLAC__int32 *data; /**< A pointer to verbatim signal. */
- } FLAC__Subframe_Verbatim;
-
-
- /** FIXED subframe. (c.f. <A HREF="../format.html#subframe_fixed">format specification</A>)
- */
- typedef struct
- {
- FLAC__EntropyCodingMethod entropy_coding_method;
- /**< The residual coding method. */
-
- unsigned order;
- /**< The polynomial order. */
-
- FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER];
- /**< Warmup samples to prime the predictor, length == order. */
-
- const FLAC__int32 *residual;
- /**< The residual signal, length == (blocksize minus order) samples. */
- } FLAC__Subframe_Fixed;
-
-
- /** LPC subframe. (c.f. <A HREF="../format.html#subframe_lpc">format specification</A>)
- */
- typedef struct
- {
- FLAC__EntropyCodingMethod entropy_coding_method;
- /**< The residual coding method. */
-
- unsigned order;
- /**< The FIR order. */
-
- unsigned qlp_coeff_precision;
- /**< Quantized FIR filter coefficient precision in bits. */
-
- int quantization_level;
- /**< The qlp coeff shift needed. */
-
- FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
- /**< FIR filter coefficients. */
-
- FLAC__int32 warmup[FLAC__MAX_LPC_ORDER];
- /**< Warmup samples to prime the predictor, length == order. */
-
- const FLAC__int32 *residual;
- /**< The residual signal, length == (blocksize minus order) samples. */
- } FLAC__Subframe_LPC;
-
- extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */
- extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */
-
-
- /** FLAC subframe structure. (c.f. <A HREF="../format.html#subframe">format specification</A>)
- */
- typedef struct
- {
- FLAC__SubframeType type;
- union
- {
- FLAC__Subframe_Constant constant;
- FLAC__Subframe_Fixed fixed;
- FLAC__Subframe_LPC lpc;
- FLAC__Subframe_Verbatim verbatim;
- } data;
- unsigned wasted_bits;
- } FLAC__Subframe;
-
- /** == 1 (bit)
- *
- * This used to be a zero-padding bit (hence the name
- * FLAC__SUBFRAME_ZERO_PAD_LEN) but is now a reserved bit. It still has a
- * mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1
- * to mean something else.
- */
- extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN;
- extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */
- extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */
-
- extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */
- extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */
- extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */
- extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */
-
- /*****************************************************************************/
-
-
- /*****************************************************************************
- *
- * Frame structures
- *
- *****************************************************************************/
-
- /** An enumeration of the available channel assignments. */
- typedef enum
- {
- FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */
- FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */
- FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */
- FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */
- } FLAC__ChannelAssignment;
-
- /** Maps a FLAC__ChannelAssignment to a C string.
- *
- * Using a FLAC__ChannelAssignment as the index to this array will
- * give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__ChannelAssignmentString[];
-
- /** An enumeration of the possible frame numbering methods. */
- typedef enum
- {
- FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */
- FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */
- } FLAC__FrameNumberType;
-
- /** Maps a FLAC__FrameNumberType to a C string.
- *
- * Using a FLAC__FrameNumberType as the index to this array will
- * give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__FrameNumberTypeString[];
-
-
- /** FLAC frame header structure. (c.f. <A HREF="../format.html#frame_header">format specification</A>)
- */
- typedef struct
- {
- unsigned blocksize;
- /**< The number of samples per subframe. */
-
- unsigned sample_rate;
- /**< The sample rate in Hz. */
-
- unsigned channels;
- /**< The number of channels (== number of subframes). */
-
- FLAC__ChannelAssignment channel_assignment;
- /**< The channel assignment for the frame. */
-
- unsigned bits_per_sample;
- /**< The sample resolution. */
-
- FLAC__FrameNumberType number_type;
- /**< The numbering scheme used for the frame. As a convenience, the
- * decoder will always convert a frame number to a sample number because
- * the rules are complex. */
-
- union
- {
- FLAC__uint32 frame_number;
- FLAC__uint64 sample_number;
- } number;
- /**< The frame number or sample number of first sample in frame;
- * use the \a number_type value to determine which to use. */
-
- FLAC__uint8 crc;
- /**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0)
- * of the raw frame header bytes, meaning everything before the CRC byte
- * including the sync code.
- */
- } FLAC__FrameHeader;
-
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 1 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */
- extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */
-
-
- /** FLAC frame footer structure. (c.f. <A HREF="../format.html#frame_footer">format specification</A>)
- */
- typedef struct
- {
- FLAC__uint16 crc;
- /**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with
- * 0) of the bytes before the crc, back to and including the frame header
- * sync code.
- */
- } FLAC__FrameFooter;
-
- extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */
-
-
- /** FLAC frame structure. (c.f. <A HREF="../format.html#frame">format specification</A>)
- */
- typedef struct
- {
- FLAC__FrameHeader header;
- FLAC__Subframe subframes[FLAC__MAX_CHANNELS];
- FLAC__FrameFooter footer;
- } FLAC__Frame;
-
- /*****************************************************************************/
-
-
- /*****************************************************************************
- *
- * Meta-data structures
- *
- *****************************************************************************/
-
- /** An enumeration of the available metadata block types. */
- typedef enum
- {
-
- FLAC__METADATA_TYPE_STREAMINFO = 0,
- /**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */
-
- FLAC__METADATA_TYPE_PADDING = 1,
- /**< <A HREF="../format.html#metadata_block_padding">PADDING</A> block */
-
- FLAC__METADATA_TYPE_APPLICATION = 2,
- /**< <A HREF="../format.html#metadata_block_application">APPLICATION</A> block */
-
- FLAC__METADATA_TYPE_SEEKTABLE = 3,
- /**< <A HREF="../format.html#metadata_block_seektable">SEEKTABLE</A> block */
-
- FLAC__METADATA_TYPE_VORBIS_COMMENT = 4,
- /**< <A HREF="../format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */
-
- FLAC__METADATA_TYPE_CUESHEET = 5,
- /**< <A HREF="../format.html#metadata_block_cuesheet">CUESHEET</A> block */
-
- FLAC__METADATA_TYPE_PICTURE = 6,
- /**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */
-
- FLAC__METADATA_TYPE_UNDEFINED = 7
- /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
-
- } FLAC__MetadataType;
-
- /** Maps a FLAC__MetadataType to a C string.
- *
- * Using a FLAC__MetadataType as the index to this array will
- * give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__MetadataTypeString[];
-
-
- /** FLAC STREAMINFO structure. (c.f. <A HREF="../format.html#metadata_block_streaminfo">format specification</A>)
- */
- typedef struct
- {
- unsigned min_blocksize, max_blocksize;
- unsigned min_framesize, max_framesize;
- unsigned sample_rate;
- unsigned channels;
- unsigned bits_per_sample;
- FLAC__uint64 total_samples;
- FLAC__byte md5sum[16];
- } FLAC__StreamMetadata_StreamInfo;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */
-
- /** The total stream length of the STREAMINFO block in bytes. */
+/*****************************************************************************
+ *
+ * Subframe structures
+ *
+ *****************************************************************************/
+
+/*****************************************************************************/
+
+/** An enumeration of the available entropy coding methods. */
+typedef enum {
+ FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0,
+ /**< Residual is coded by partitioning into contexts, each with it's own
+ * 4-bit Rice parameter. */
+
+ FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 = 1
+ /**< Residual is coded by partitioning into contexts, each with it's own
+ * 5-bit Rice parameter. */
+} FLAC__EntropyCodingMethodType;
+
+/** Maps a FLAC__EntropyCodingMethodType to a C string.
+ *
+ * Using a FLAC__EntropyCodingMethodType as the index to this array will
+ * give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[];
+
+
+/** Contents of a Rice partitioned residual
+ */
+typedef struct {
+
+ unsigned *parameters;
+ /**< The Rice parameters for each context. */
+
+ unsigned *raw_bits;
+ /**< Widths for escape-coded partitions. Will be non-zero for escaped
+ * partitions and zero for unescaped partitions.
+ */
+
+ unsigned capacity_by_order;
+ /**< The capacity of the \a parameters and \a raw_bits arrays
+ * specified as an order, i.e. the number of array elements
+ * allocated is 2 ^ \a capacity_by_order.
+ */
+} FLAC__EntropyCodingMethod_PartitionedRiceContents;
+
+/** Header for a Rice partitioned residual. (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>)
+ */
+typedef struct {
+
+ unsigned order;
+ /**< The partition order, i.e. # of contexts = 2 ^ \a order. */
+
+ const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents;
+ /**< The context's Rice parameters and/or raw bits. */
+
+} FLAC__EntropyCodingMethod_PartitionedRice;
+
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN; /**< == 5 (bits) */
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */
+
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+/**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER;
+/**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
+
+/** Header for the entropy coding method. (c.f. <A HREF="../format.html#residual">format specification</A>)
+ */
+typedef struct {
+ FLAC__EntropyCodingMethodType type;
+ union {
+ FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice;
+ } data;
+} FLAC__EntropyCodingMethod;
+
+extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */
+
+/*****************************************************************************/
+
+/** An enumeration of the available subframe types. */
+typedef enum {
+ FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */
+ FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */
+ FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */
+ FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */
+} FLAC__SubframeType;
+
+/** Maps a FLAC__SubframeType to a C string.
+ *
+ * Using a FLAC__SubframeType as the index to this array will
+ * give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__SubframeTypeString[];
+
+
+/** CONSTANT subframe. (c.f. <A HREF="../format.html#subframe_constant">format specification</A>)
+ */
+typedef struct {
+ FLAC__int32 value; /**< The constant signal value. */
+} FLAC__Subframe_Constant;
+
+
+/** VERBATIM subframe. (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
+ */
+typedef struct {
+ const FLAC__int32 *data; /**< A pointer to verbatim signal. */
+} FLAC__Subframe_Verbatim;
+
+
+/** FIXED subframe. (c.f. <A HREF="../format.html#subframe_fixed">format specification</A>)
+ */
+typedef struct {
+ FLAC__EntropyCodingMethod entropy_coding_method;
+ /**< The residual coding method. */
+
+ unsigned order;
+ /**< The polynomial order. */
+
+ FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER];
+ /**< Warmup samples to prime the predictor, length == order. */
+
+ const FLAC__int32 *residual;
+ /**< The residual signal, length == (blocksize minus order) samples. */
+} FLAC__Subframe_Fixed;
+
+
+/** LPC subframe. (c.f. <A HREF="../format.html#subframe_lpc">format specification</A>)
+ */
+typedef struct {
+ FLAC__EntropyCodingMethod entropy_coding_method;
+ /**< The residual coding method. */
+
+ unsigned order;
+ /**< The FIR order. */
+
+ unsigned qlp_coeff_precision;
+ /**< Quantized FIR filter coefficient precision in bits. */
+
+ int quantization_level;
+ /**< The qlp coeff shift needed. */
+
+ FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
+ /**< FIR filter coefficients. */
+
+ FLAC__int32 warmup[FLAC__MAX_LPC_ORDER];
+ /**< Warmup samples to prime the predictor, length == order. */
+
+ const FLAC__int32 *residual;
+ /**< The residual signal, length == (blocksize minus order) samples. */
+} FLAC__Subframe_LPC;
+
+extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */
+extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */
+
+
+/** FLAC subframe structure. (c.f. <A HREF="../format.html#subframe">format specification</A>)
+ */
+typedef struct {
+ FLAC__SubframeType type;
+ union {
+ FLAC__Subframe_Constant constant;
+ FLAC__Subframe_Fixed fixed;
+ FLAC__Subframe_LPC lpc;
+ FLAC__Subframe_Verbatim verbatim;
+ } data;
+ unsigned wasted_bits;
+} FLAC__Subframe;
+
+/** == 1 (bit)
+ *
+ * This used to be a zero-padding bit (hence the name
+ * FLAC__SUBFRAME_ZERO_PAD_LEN) but is now a reserved bit. It still has a
+ * mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1
+ * to mean something else.
+ */
+extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN;
+extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */
+extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */
+
+extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */
+extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */
+extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */
+extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */
+
+/*****************************************************************************/
+
+
+/*****************************************************************************
+ *
+ * Frame structures
+ *
+ *****************************************************************************/
+
+/** An enumeration of the available channel assignments. */
+typedef enum {
+ FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */
+ FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */
+ FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */
+ FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */
+} FLAC__ChannelAssignment;
+
+/** Maps a FLAC__ChannelAssignment to a C string.
+ *
+ * Using a FLAC__ChannelAssignment as the index to this array will
+ * give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__ChannelAssignmentString[];
+
+/** An enumeration of the possible frame numbering methods. */
+typedef enum {
+ FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */
+ FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */
+} FLAC__FrameNumberType;
+
+/** Maps a FLAC__FrameNumberType to a C string.
+ *
+ * Using a FLAC__FrameNumberType as the index to this array will
+ * give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__FrameNumberTypeString[];
+
+
+/** FLAC frame header structure. (c.f. <A HREF="../format.html#frame_header">format specification</A>)
+ */
+typedef struct {
+ unsigned blocksize;
+ /**< The number of samples per subframe. */
+
+ unsigned sample_rate;
+ /**< The sample rate in Hz. */
+
+ unsigned channels;
+ /**< The number of channels (== number of subframes). */
+
+ FLAC__ChannelAssignment channel_assignment;
+ /**< The channel assignment for the frame. */
+
+ unsigned bits_per_sample;
+ /**< The sample resolution. */
+
+ FLAC__FrameNumberType number_type;
+ /**< The numbering scheme used for the frame. As a convenience, the
+ * decoder will always convert a frame number to a sample number because
+ * the rules are complex. */
+
+ union {
+ FLAC__uint32 frame_number;
+ FLAC__uint64 sample_number;
+ } number;
+ /**< The frame number or sample number of first sample in frame;
+ * use the \a number_type value to determine which to use. */
+
+ FLAC__uint8 crc;
+ /**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0)
+ * of the raw frame header bytes, meaning everything before the CRC byte
+ * including the sync code.
+ */
+} FLAC__FrameHeader;
+
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 1 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */
+extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */
+
+
+/** FLAC frame footer structure. (c.f. <A HREF="../format.html#frame_footer">format specification</A>)
+ */
+typedef struct {
+ FLAC__uint16 crc;
+ /**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with
+ * 0) of the bytes before the crc, back to and including the frame header
+ * sync code.
+ */
+} FLAC__FrameFooter;
+
+extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */
+
+
+/** FLAC frame structure. (c.f. <A HREF="../format.html#frame">format specification</A>)
+ */
+typedef struct {
+ FLAC__FrameHeader header;
+ FLAC__Subframe subframes[FLAC__MAX_CHANNELS];
+ FLAC__FrameFooter footer;
+} FLAC__Frame;
+
+/*****************************************************************************/
+
+
+/*****************************************************************************
+ *
+ * Meta-data structures
+ *
+ *****************************************************************************/
+
+/** An enumeration of the available metadata block types. */
+typedef enum {
+
+ FLAC__METADATA_TYPE_STREAMINFO = 0,
+ /**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */
+
+ FLAC__METADATA_TYPE_PADDING = 1,
+ /**< <A HREF="../format.html#metadata_block_padding">PADDING</A> block */
+
+ FLAC__METADATA_TYPE_APPLICATION = 2,
+ /**< <A HREF="../format.html#metadata_block_application">APPLICATION</A> block */
+
+ FLAC__METADATA_TYPE_SEEKTABLE = 3,
+ /**< <A HREF="../format.html#metadata_block_seektable">SEEKTABLE</A> block */
+
+ FLAC__METADATA_TYPE_VORBIS_COMMENT = 4,
+ /**< <A HREF="../format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */
+
+ FLAC__METADATA_TYPE_CUESHEET = 5,
+ /**< <A HREF="../format.html#metadata_block_cuesheet">CUESHEET</A> block */
+
+ FLAC__METADATA_TYPE_PICTURE = 6,
+ /**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */
+
+ FLAC__METADATA_TYPE_UNDEFINED = 7
+ /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
+
+} FLAC__MetadataType;
+
+/** Maps a FLAC__MetadataType to a C string.
+ *
+ * Using a FLAC__MetadataType as the index to this array will
+ * give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__MetadataTypeString[];
+
+
+/** FLAC STREAMINFO structure. (c.f. <A HREF="../format.html#metadata_block_streaminfo">format specification</A>)
+ */
+typedef struct {
+ unsigned min_blocksize, max_blocksize;
+ unsigned min_framesize, max_framesize;
+ unsigned sample_rate;
+ unsigned channels;
+ unsigned bits_per_sample;
+ FLAC__uint64 total_samples;
+ FLAC__byte md5sum[16];
+} FLAC__StreamMetadata_StreamInfo;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */
+
+/** The total stream length of the STREAMINFO block in bytes. */
#define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)
- /** FLAC PADDING structure. (c.f. <A HREF="../format.html#metadata_block_padding">format specification</A>)
- */
- typedef struct
- {
- int dummy;
- /**< Conceptually this is an empty struct since we don't store the
- * padding bytes. Empty structs are not allowed by some C compilers,
- * hence the dummy.
- */
- } FLAC__StreamMetadata_Padding;
-
-
- /** FLAC APPLICATION structure. (c.f. <A HREF="../format.html#metadata_block_application">format specification</A>)
- */
- typedef struct
- {
- FLAC__byte id[4];
- FLAC__byte *data;
- } FLAC__StreamMetadata_Application;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */
-
- /** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="../format.html#seekpoint">format specification</A>)
- */
- typedef struct
- {
- FLAC__uint64 sample_number;
- /**< The sample number of the target frame. */
-
- FLAC__uint64 stream_offset;
- /**< The offset, in bytes, of the target frame with respect to
- * beginning of the first frame. */
-
- unsigned frame_samples;
- /**< The number of samples in the target frame. */
- } FLAC__StreamMetadata_SeekPoint;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */
-
- /** The total stream length of a seek point in bytes. */
+/** FLAC PADDING structure. (c.f. <A HREF="../format.html#metadata_block_padding">format specification</A>)
+ */
+typedef struct {
+ int dummy;
+ /**< Conceptually this is an empty struct since we don't store the
+ * padding bytes. Empty structs are not allowed by some C compilers,
+ * hence the dummy.
+ */
+} FLAC__StreamMetadata_Padding;
+
+
+/** FLAC APPLICATION structure. (c.f. <A HREF="../format.html#metadata_block_application">format specification</A>)
+ */
+typedef struct {
+ FLAC__byte id[4];
+ FLAC__byte *data;
+} FLAC__StreamMetadata_Application;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */
+
+/** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="../format.html#seekpoint">format specification</A>)
+ */
+typedef struct {
+ FLAC__uint64 sample_number;
+ /**< The sample number of the target frame. */
+
+ FLAC__uint64 stream_offset;
+ /**< The offset, in bytes, of the target frame with respect to
+ * beginning of the first frame. */
+
+ unsigned frame_samples;
+ /**< The number of samples in the target frame. */
+} FLAC__StreamMetadata_SeekPoint;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */
+
+/** The total stream length of a seek point in bytes. */
#define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)
- /** The value used in the \a sample_number field of
- * FLAC__StreamMetadataSeekPoint used to indicate a placeholder
- * point (== 0xffffffffffffffff).
- */
- extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
-
-
- /** FLAC SEEKTABLE structure. (c.f. <A HREF="../format.html#metadata_block_seektable">format specification</A>)
- *
- * \note From the format specification:
- * - The seek points must be sorted by ascending sample number.
- * - Each seek point's sample number must be the first sample of the
- * target frame.
- * - Each seek point's sample number must be unique within the table.
- * - Existence of a SEEKTABLE block implies a correct setting of
- * total_samples in the stream_info block.
- * - Behavior is undefined when more than one SEEKTABLE block is
- * present in a stream.
- */
- typedef struct
- {
- unsigned num_points;
- FLAC__StreamMetadata_SeekPoint *points;
- } FLAC__StreamMetadata_SeekTable;
-
-
- /** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
- *
- * For convenience, the APIs maintain a trailing NUL character at the end of
- * \a entry which is not counted toward \a length, i.e.
- * \code strlen(entry) == length \endcode
- */
- typedef struct
- {
- FLAC__uint32 length;
- FLAC__byte *entry;
- } FLAC__StreamMetadata_VorbisComment_Entry;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */
-
-
- /** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
- */
- typedef struct
- {
- FLAC__StreamMetadata_VorbisComment_Entry vendor_string;
- FLAC__uint32 num_comments;
- FLAC__StreamMetadata_VorbisComment_Entry *comments;
- } FLAC__StreamMetadata_VorbisComment;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */
-
-
- /** FLAC CUESHEET track index structure. (See the
- * <A HREF="../format.html#cuesheet_track_index">format specification</A> for
- * the full description of each field.)
- */
- typedef struct
- {
- FLAC__uint64 offset;
- /**< Offset in samples, relative to the track offset, of the index
- * point.
- */
-
- FLAC__byte number;
- /**< The index point number. */
- } FLAC__StreamMetadata_CueSheet_Index;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */
-
-
- /** FLAC CUESHEET track structure. (See the
- * <A HREF="../format.html#cuesheet_track">format specification</A> for
- * the full description of each field.)
- */
- typedef struct
- {
- FLAC__uint64 offset;
- /**< Track offset in samples, relative to the beginning of the FLAC audio stream. */
-
- FLAC__byte number;
- /**< The track number. */
-
- char isrc[13];
- /**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing \c NUL byte */
-
- unsigned type: 1;
- /**< The track type: 0 for audio, 1 for non-audio. */
-
- unsigned pre_emphasis: 1;
- /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */
-
- FLAC__byte num_indices;
- /**< The number of track index points. */
-
- FLAC__StreamMetadata_CueSheet_Index *indices;
- /**< NULL if num_indices == 0, else pointer to array of index points. */
-
- } FLAC__StreamMetadata_CueSheet_Track;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */
-
-
- /** FLAC CUESHEET structure. (See the
- * <A HREF="../format.html#metadata_block_cuesheet">format specification</A>
- * for the full description of each field.)
- */
- typedef struct
- {
- char media_catalog_number[129];
- /**< Media catalog number, in ASCII printable characters 0x20-0x7e. In
- * general, the media catalog number may be 0 to 128 bytes long; any
- * unused characters should be right-padded with NUL characters.
- */
-
- FLAC__uint64 lead_in;
- /**< The number of lead-in samples. */
-
- FLAC__bool is_cd;
- /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */
-
- unsigned num_tracks;
- /**< The number of tracks. */
-
- FLAC__StreamMetadata_CueSheet_Track *tracks;
- /**< NULL if num_tracks == 0, else pointer to array of tracks. */
-
- } FLAC__StreamMetadata_CueSheet;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */
-
-
- /** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */
- typedef enum
- {
- FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */
- FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */
- FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */
- FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */
- FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */
- FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */
- FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */
- FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */
- FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */
- FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */
- FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */
- FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */
- FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */
- FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */
- FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */
- FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */
- FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */
- FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */
- FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */
- FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */
- FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */
- FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED
- } FLAC__StreamMetadata_Picture_Type;
-
- /** Maps a FLAC__StreamMetadata_Picture_Type to a C string.
- *
- * Using a FLAC__StreamMetadata_Picture_Type as the index to this array
- * will give the string equivalent. The contents should not be
- * modified.
- */
- extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[];
-
- /** FLAC PICTURE structure. (See the
- * <A HREF="../format.html#metadata_block_picture">format specification</A>
- * for the full description of each field.)
- */
- typedef struct
- {
- FLAC__StreamMetadata_Picture_Type type;
- /**< The kind of picture stored. */
-
- char *mime_type;
- /**< Picture data's MIME type, in ASCII printable characters
- * 0x20-0x7e, NUL terminated. For best compatibility with players,
- * use picture data of MIME type \c image/jpeg or \c image/png. A
- * MIME type of '-->' is also allowed, in which case the picture
- * data should be a complete URL. In file storage, the MIME type is
- * stored as a 32-bit length followed by the ASCII string with no NUL
- * terminator, but is converted to a plain C string in this structure
- * for convenience.
- */
-
- FLAC__byte *description;
- /**< Picture's description in UTF-8, NUL terminated. In file storage,
- * the description is stored as a 32-bit length followed by the UTF-8
- * string with no NUL terminator, but is converted to a plain C string
- * in this structure for convenience.
- */
-
- FLAC__uint32 width;
- /**< Picture's width in pixels. */
-
- FLAC__uint32 height;
- /**< Picture's height in pixels. */
-
- FLAC__uint32 depth;
- /**< Picture's color depth in bits-per-pixel. */
-
- FLAC__uint32 colors;
- /**< For indexed palettes (like GIF), picture's number of colors (the
- * number of palette entries), or \c 0 for non-indexed (i.e. 2^depth).
- */
-
- FLAC__uint32 data_length;
- /**< Length of binary picture data in bytes. */
-
- FLAC__byte *data;
- /**< Binary picture data. */
-
- } FLAC__StreamMetadata_Picture;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */
-
-
- /** Structure that is used when a metadata block of unknown type is loaded.
- * The contents are opaque. The structure is used only internally to
- * correctly handle unknown metadata.
- */
- typedef struct
- {
- FLAC__byte *data;
- } FLAC__StreamMetadata_Unknown;
-
-
- /** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>)
- */
- typedef struct
- {
- FLAC__MetadataType type;
- /**< The type of the metadata block; used determine which member of the
- * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED
- * then \a data.unknown must be used. */
-
- FLAC__bool is_last;
- /**< \c true if this metadata block is the last, else \a false */
-
- unsigned length;
- /**< Length, in bytes, of the block data as it appears in the stream. */
-
- union
- {
- FLAC__StreamMetadata_StreamInfo stream_info;
- FLAC__StreamMetadata_Padding padding;
- FLAC__StreamMetadata_Application application;
- FLAC__StreamMetadata_SeekTable seek_table;
- FLAC__StreamMetadata_VorbisComment vorbis_comment;
- FLAC__StreamMetadata_CueSheet cue_sheet;
- FLAC__StreamMetadata_Picture picture;
- FLAC__StreamMetadata_Unknown unknown;
- } data;
- /**< Polymorphic block data; use the \a type value to determine which
- * to use. */
- } FLAC__StreamMetadata;
-
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */
- extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */
-
- /** The total stream length of a metadata block header in bytes. */
+/** The value used in the \a sample_number field of
+ * FLAC__StreamMetadataSeekPoint used to indicate a placeholder
+ * point (== 0xffffffffffffffff).
+ */
+extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
+
+
+/** FLAC SEEKTABLE structure. (c.f. <A HREF="../format.html#metadata_block_seektable">format specification</A>)
+ *
+ * \note From the format specification:
+ * - The seek points must be sorted by ascending sample number.
+ * - Each seek point's sample number must be the first sample of the
+ * target frame.
+ * - Each seek point's sample number must be unique within the table.
+ * - Existence of a SEEKTABLE block implies a correct setting of
+ * total_samples in the stream_info block.
+ * - Behavior is undefined when more than one SEEKTABLE block is
+ * present in a stream.
+ */
+typedef struct {
+ unsigned num_points;
+ FLAC__StreamMetadata_SeekPoint *points;
+} FLAC__StreamMetadata_SeekTable;
+
+
+/** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
+ *
+ * For convenience, the APIs maintain a trailing NUL character at the end of
+ * \a entry which is not counted toward \a length, i.e.
+ * \code strlen(entry) == length \endcode
+ */
+typedef struct {
+ FLAC__uint32 length;
+ FLAC__byte *entry;
+} FLAC__StreamMetadata_VorbisComment_Entry;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */
+
+
+/** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
+ */
+typedef struct {
+ FLAC__StreamMetadata_VorbisComment_Entry vendor_string;
+ FLAC__uint32 num_comments;
+ FLAC__StreamMetadata_VorbisComment_Entry *comments;
+} FLAC__StreamMetadata_VorbisComment;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */
+
+
+/** FLAC CUESHEET track index structure. (See the
+ * <A HREF="../format.html#cuesheet_track_index">format specification</A> for
+ * the full description of each field.)
+ */
+typedef struct {
+ FLAC__uint64 offset;
+ /**< Offset in samples, relative to the track offset, of the index
+ * point.
+ */
+
+ FLAC__byte number;
+ /**< The index point number. */
+} FLAC__StreamMetadata_CueSheet_Index;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */
+
+
+/** FLAC CUESHEET track structure. (See the
+ * <A HREF="../format.html#cuesheet_track">format specification</A> for
+ * the full description of each field.)
+ */
+typedef struct {
+ FLAC__uint64 offset;
+ /**< Track offset in samples, relative to the beginning of the FLAC audio stream. */
+
+ FLAC__byte number;
+ /**< The track number. */
+
+ char isrc[13];
+ /**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing \c NUL byte */
+
+ unsigned type:1;
+ /**< The track type: 0 for audio, 1 for non-audio. */
+
+ unsigned pre_emphasis:1;
+ /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */
+
+ FLAC__byte num_indices;
+ /**< The number of track index points. */
+
+ FLAC__StreamMetadata_CueSheet_Index *indices;
+ /**< NULL if num_indices == 0, else pointer to array of index points. */
+
+} FLAC__StreamMetadata_CueSheet_Track;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */
+
+
+/** FLAC CUESHEET structure. (See the
+ * <A HREF="../format.html#metadata_block_cuesheet">format specification</A>
+ * for the full description of each field.)
+ */
+typedef struct {
+ char media_catalog_number[129];
+ /**< Media catalog number, in ASCII printable characters 0x20-0x7e. In
+ * general, the media catalog number may be 0 to 128 bytes long; any
+ * unused characters should be right-padded with NUL characters.
+ */
+
+ FLAC__uint64 lead_in;
+ /**< The number of lead-in samples. */
+
+ FLAC__bool is_cd;
+ /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */
+
+ unsigned num_tracks;
+ /**< The number of tracks. */
+
+ FLAC__StreamMetadata_CueSheet_Track *tracks;
+ /**< NULL if num_tracks == 0, else pointer to array of tracks. */
+
+} FLAC__StreamMetadata_CueSheet;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */
+
+
+/** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */
+typedef enum {
+ FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED
+} FLAC__StreamMetadata_Picture_Type;
+
+/** Maps a FLAC__StreamMetadata_Picture_Type to a C string.
+ *
+ * Using a FLAC__StreamMetadata_Picture_Type as the index to this array
+ * will give the string equivalent. The contents should not be
+ * modified.
+ */
+extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[];
+
+/** FLAC PICTURE structure. (See the
+ * <A HREF="../format.html#metadata_block_picture">format specification</A>
+ * for the full description of each field.)
+ */
+typedef struct {
+ FLAC__StreamMetadata_Picture_Type type;
+ /**< The kind of picture stored. */
+
+ char *mime_type;
+ /**< Picture data's MIME type, in ASCII printable characters
+ * 0x20-0x7e, NUL terminated. For best compatibility with players,
+ * use picture data of MIME type \c image/jpeg or \c image/png. A
+ * MIME type of '-->' is also allowed, in which case the picture
+ * data should be a complete URL. In file storage, the MIME type is
+ * stored as a 32-bit length followed by the ASCII string with no NUL
+ * terminator, but is converted to a plain C string in this structure
+ * for convenience.
+ */
+
+ FLAC__byte *description;
+ /**< Picture's description in UTF-8, NUL terminated. In file storage,
+ * the description is stored as a 32-bit length followed by the UTF-8
+ * string with no NUL terminator, but is converted to a plain C string
+ * in this structure for convenience.
+ */
+
+ FLAC__uint32 width;
+ /**< Picture's width in pixels. */
+
+ FLAC__uint32 height;
+ /**< Picture's height in pixels. */
+
+ FLAC__uint32 depth;
+ /**< Picture's color depth in bits-per-pixel. */
+
+ FLAC__uint32 colors;
+ /**< For indexed palettes (like GIF), picture's number of colors (the
+ * number of palette entries), or \c 0 for non-indexed (i.e. 2^depth).
+ */
+
+ FLAC__uint32 data_length;
+ /**< Length of binary picture data in bytes. */
+
+ FLAC__byte *data;
+ /**< Binary picture data. */
+
+} FLAC__StreamMetadata_Picture;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */
+
+
+/** Structure that is used when a metadata block of unknown type is loaded.
+ * The contents are opaque. The structure is used only internally to
+ * correctly handle unknown metadata.
+ */
+typedef struct {
+ FLAC__byte *data;
+} FLAC__StreamMetadata_Unknown;
+
+
+/** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>)
+ */
+typedef struct {
+ FLAC__MetadataType type;
+ /**< The type of the metadata block; used determine which member of the
+ * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED
+ * then \a data.unknown must be used. */
+
+ FLAC__bool is_last;
+ /**< \c true if this metadata block is the last, else \a false */
+
+ unsigned length;
+ /**< Length, in bytes, of the block data as it appears in the stream. */
+
+ union {
+ FLAC__StreamMetadata_StreamInfo stream_info;
+ FLAC__StreamMetadata_Padding padding;
+ FLAC__StreamMetadata_Application application;
+ FLAC__StreamMetadata_SeekTable seek_table;
+ FLAC__StreamMetadata_VorbisComment vorbis_comment;
+ FLAC__StreamMetadata_CueSheet cue_sheet;
+ FLAC__StreamMetadata_Picture picture;
+ FLAC__StreamMetadata_Unknown unknown;
+ } data;
+ /**< Polymorphic block data; use the \a type value to determine which
+ * to use. */
+} FLAC__StreamMetadata;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */
+
+/** The total stream length of a metadata block header in bytes. */
#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)
- /*****************************************************************************/
-
-
- /*****************************************************************************
- *
- * Utility functions
- *
- *****************************************************************************/
-
- /** Tests that a sample rate is valid for FLAC.
- *
- * \param sample_rate The sample rate to test for compliance.
- * \retval FLAC__bool
- * \c true if the given sample rate conforms to the specification, else
- * \c false.
- */
- FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
-
- /** Tests that a blocksize at the given sample rate is valid for the FLAC
- * subset.
- *
- * \param blocksize The blocksize to test for compliance.
- * \param sample_rate The sample rate is needed, since the valid subset
- * blocksize depends on the sample rate.
- * \retval FLAC__bool
- * \c true if the given blocksize conforms to the specification for the
- * subset at the given sample rate, else \c false.
- */
- FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate);
-
- /** Tests that a sample rate is valid for the FLAC subset. The subset rules
- * for valid sample rates are slightly more complex since the rate has to
- * be expressible completely in the frame header.
- *
- * \param sample_rate The sample rate to test for compliance.
- * \retval FLAC__bool
- * \c true if the given sample rate conforms to the specification for the
- * subset, else \c false.
- */
- FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate);
-
- /** Check a Vorbis comment entry name to see if it conforms to the Vorbis
- * comment specification.
- *
- * Vorbis comment names must be composed only of characters from
- * [0x20-0x3C,0x3E-0x7D].
- *
- * \param name A NUL-terminated string to be checked.
- * \assert
- * \code name != NULL \endcode
- * \retval FLAC__bool
- * \c false if entry name is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name);
-
- /** Check a Vorbis comment entry value to see if it conforms to the Vorbis
- * comment specification.
- *
- * Vorbis comment values must be valid UTF-8 sequences.
- *
- * \param value A string to be checked.
- * \param length A the length of \a value in bytes. May be
- * \c (unsigned)(-1) to indicate that \a value is a plain
- * UTF-8 NUL-terminated string.
- * \assert
- * \code value != NULL \endcode
- * \retval FLAC__bool
- * \c false if entry name is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length);
-
- /** Check a Vorbis comment entry to see if it conforms to the Vorbis
- * comment specification.
- *
- * Vorbis comment entries must be of the form 'name=value', and 'name' and
- * 'value' must be legal according to
- * FLAC__format_vorbiscomment_entry_name_is_legal() and
- * FLAC__format_vorbiscomment_entry_value_is_legal() respectively.
- *
- * \param entry An entry to be checked.
- * \param length The length of \a entry in bytes.
- * \assert
- * \code value != NULL \endcode
- * \retval FLAC__bool
- * \c false if entry name is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length);
-
- /** Check a seek table to see if it conforms to the FLAC specification.
- * See the format specification for limits on the contents of the
- * seek table.
- *
- * \param seek_table A pointer to a seek table to be checked.
- * \assert
- * \code seek_table != NULL \endcode
- * \retval FLAC__bool
- * \c false if seek table is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table);
-
- /** Sort a seek table's seek points according to the format specification.
- * This includes a "unique-ification" step to remove duplicates, i.e.
- * seek points with identical \a sample_number values. Duplicate seek
- * points are converted into placeholder points and sorted to the end of
- * the table.
- *
- * \param seek_table A pointer to a seek table to be sorted.
- * \assert
- * \code seek_table != NULL \endcode
- * \retval unsigned
- * The number of duplicate seek points converted into placeholders.
- */
- FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);
-
- /** Check a cue sheet to see if it conforms to the FLAC specification.
- * See the format specification for limits on the contents of the
- * cue sheet.
- *
- * \param cue_sheet A pointer to an existing cue sheet to be checked.
- * \param check_cd_da_subset If \c true, check CUESHEET against more
- * stringent requirements for a CD-DA (audio) disc.
- * \param violation Address of a pointer to a string. If there is a
- * violation, a pointer to a string explanation of the
- * violation will be returned here. \a violation may be
- * \c NULL if you don't need the returned string. Do not
- * free the returned string; it will always point to static
- * data.
- * \assert
- * \code cue_sheet != NULL \endcode
- * \retval FLAC__bool
- * \c false if cue sheet is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation);
-
- /** Check picture data to see if it conforms to the FLAC specification.
- * See the format specification for limits on the contents of the
- * PICTURE block.
- *
- * \param picture A pointer to existing picture data to be checked.
- * \param violation Address of a pointer to a string. If there is a
- * violation, a pointer to a string explanation of the
- * violation will be returned here. \a violation may be
- * \c NULL if you don't need the returned string. Do not
- * free the returned string; it will always point to static
- * data.
- * \assert
- * \code picture != NULL \endcode
- * \retval FLAC__bool
- * \c false if picture data is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation);
-
- /* \} */
+/*****************************************************************************/
+
+
+/*****************************************************************************
+ *
+ * Utility functions
+ *
+ *****************************************************************************/
+
+/** Tests that a sample rate is valid for FLAC.
+ *
+ * \param sample_rate The sample rate to test for compliance.
+ * \retval FLAC__bool
+ * \c true if the given sample rate conforms to the specification, else
+ * \c false.
+ */
+FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
+
+/** Tests that a blocksize at the given sample rate is valid for the FLAC
+ * subset.
+ *
+ * \param blocksize The blocksize to test for compliance.
+ * \param sample_rate The sample rate is needed, since the valid subset
+ * blocksize depends on the sample rate.
+ * \retval FLAC__bool
+ * \c true if the given blocksize conforms to the specification for the
+ * subset at the given sample rate, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate);
+
+/** Tests that a sample rate is valid for the FLAC subset. The subset rules
+ * for valid sample rates are slightly more complex since the rate has to
+ * be expressible completely in the frame header.
+ *
+ * \param sample_rate The sample rate to test for compliance.
+ * \retval FLAC__bool
+ * \c true if the given sample rate conforms to the specification for the
+ * subset, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate);
+
+/** Check a Vorbis comment entry name to see if it conforms to the Vorbis
+ * comment specification.
+ *
+ * Vorbis comment names must be composed only of characters from
+ * [0x20-0x3C,0x3E-0x7D].
+ *
+ * \param name A NUL-terminated string to be checked.
+ * \assert
+ * \code name != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if entry name is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name);
+
+/** Check a Vorbis comment entry value to see if it conforms to the Vorbis
+ * comment specification.
+ *
+ * Vorbis comment values must be valid UTF-8 sequences.
+ *
+ * \param value A string to be checked.
+ * \param length A the length of \a value in bytes. May be
+ * \c (unsigned)(-1) to indicate that \a value is a plain
+ * UTF-8 NUL-terminated string.
+ * \assert
+ * \code value != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if entry name is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length);
+
+/** Check a Vorbis comment entry to see if it conforms to the Vorbis
+ * comment specification.
+ *
+ * Vorbis comment entries must be of the form 'name=value', and 'name' and
+ * 'value' must be legal according to
+ * FLAC__format_vorbiscomment_entry_name_is_legal() and
+ * FLAC__format_vorbiscomment_entry_value_is_legal() respectively.
+ *
+ * \param entry An entry to be checked.
+ * \param length The length of \a entry in bytes.
+ * \assert
+ * \code value != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if entry name is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length);
+
+/** Check a seek table to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * seek table.
+ *
+ * \param seek_table A pointer to a seek table to be checked.
+ * \assert
+ * \code seek_table != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if seek table is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table);
+
+/** Sort a seek table's seek points according to the format specification.
+ * This includes a "unique-ification" step to remove duplicates, i.e.
+ * seek points with identical \a sample_number values. Duplicate seek
+ * points are converted into placeholder points and sorted to the end of
+ * the table.
+ *
+ * \param seek_table A pointer to a seek table to be sorted.
+ * \assert
+ * \code seek_table != NULL \endcode
+ * \retval unsigned
+ * The number of duplicate seek points converted into placeholders.
+ */
+FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);
+
+/** Check a cue sheet to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * cue sheet.
+ *
+ * \param cue_sheet A pointer to an existing cue sheet to be checked.
+ * \param check_cd_da_subset If \c true, check CUESHEET against more
+ * stringent requirements for a CD-DA (audio) disc.
+ * \param violation Address of a pointer to a string. If there is a
+ * violation, a pointer to a string explanation of the
+ * violation will be returned here. \a violation may be
+ * \c NULL if you don't need the returned string. Do not
+ * free the returned string; it will always point to static
+ * data.
+ * \assert
+ * \code cue_sheet != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if cue sheet is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation);
+
+/** Check picture data to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * PICTURE block.
+ *
+ * \param picture A pointer to existing picture data to be checked.
+ * \param violation Address of a pointer to a string. If there is a
+ * violation, a pointer to a string explanation of the
+ * violation will be returned here. \a violation may be
+ * \c NULL if you don't need the returned string. Do not
+ * free the returned string; it will always point to static
+ * data.
+ * \assert
+ * \code picture != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if picture data is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation);
+
+/* \} */
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/metadata.h b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/metadata.h
index c7a0471d5..3452e8fb1 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/metadata.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/metadata.h
@@ -125,2056 +125,2054 @@ extern "C" {
#endif
- /** \defgroup flac_metadata_level0 FLAC/metadata.h: metadata level 0 interface
- * \ingroup flac_metadata
- *
- * \brief
- * The level 0 interface consists of individual routines to read the
- * STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring
- * only a filename.
- *
- * They try to skip any ID3v2 tag at the head of the file.
- *
- * \{
- */
-
- /** Read the STREAMINFO metadata block of the given FLAC file. This function
- * will try to skip any ID3v2 tag at the head of the file.
- *
- * \param filename The path to the FLAC file to read.
- * \param streaminfo A pointer to space for the STREAMINFO block. Since
- * FLAC__StreamMetadata is a simple structure with no
- * memory allocation involved, you pass the address of
- * an existing structure. It need not be initialized.
- * \assert
- * \code filename != NULL \endcode
- * \code streaminfo != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid STREAMINFO block was read from \a filename. Returns
- * \c false if there was a memory allocation error, a file decoder error,
- * or the file contained no STREAMINFO block. (A memory allocation error
- * is possible because this function must set up a file decoder.)
- */
- FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo);
-
- /** Read the VORBIS_COMMENT metadata block of the given FLAC file. This
- * function will try to skip any ID3v2 tag at the head of the file.
- *
- * \param filename The path to the FLAC file to read.
- * \param tags The address where the returned pointer will be
- * stored. The \a tags object must be deleted by
- * the caller using FLAC__metadata_object_delete().
- * \assert
- * \code filename != NULL \endcode
- * \code tags != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid VORBIS_COMMENT block was read from \a filename,
- * and \a *tags will be set to the address of the metadata structure.
- * Returns \c false if there was a memory allocation error, a file
- * decoder error, or the file contained no VORBIS_COMMENT block, and
- * \a *tags will be set to \c NULL.
- */
- FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags);
-
- /** Read the CUESHEET metadata block of the given FLAC file. This
- * function will try to skip any ID3v2 tag at the head of the file.
- *
- * \param filename The path to the FLAC file to read.
- * \param cuesheet The address where the returned pointer will be
- * stored. The \a cuesheet object must be deleted by
- * the caller using FLAC__metadata_object_delete().
- * \assert
- * \code filename != NULL \endcode
- * \code cuesheet != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid CUESHEET block was read from \a filename,
- * and \a *cuesheet will be set to the address of the metadata
- * structure. Returns \c false if there was a memory allocation
- * error, a file decoder error, or the file contained no CUESHEET
- * block, and \a *cuesheet will be set to \c NULL.
- */
- FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__StreamMetadata **cuesheet);
-
- /** Read a PICTURE metadata block of the given FLAC file. This
- * function will try to skip any ID3v2 tag at the head of the file.
- * Since there can be more than one PICTURE block in a file, this
- * function takes a number of parameters that act as constraints to
- * the search. The PICTURE block with the largest area matching all
- * the constraints will be returned, or \a *picture will be set to
- * \c NULL if there was no such block.
- *
- * \param filename The path to the FLAC file to read.
- * \param picture The address where the returned pointer will be
- * stored. The \a picture object must be deleted by
- * the caller using FLAC__metadata_object_delete().
- * \param type The desired picture type. Use \c -1 to mean
- * "any type".
- * \param mime_type The desired MIME type, e.g. "image/jpeg". The
- * string will be matched exactly. Use \c NULL to
- * mean "any MIME type".
- * \param description The desired description. The string will be
- * matched exactly. Use \c NULL to mean "any
- * description".
- * \param max_width The maximum width in pixels desired. Use
- * \c (unsigned)(-1) to mean "any width".
- * \param max_height The maximum height in pixels desired. Use
- * \c (unsigned)(-1) to mean "any height".
- * \param max_depth The maximum color depth in bits-per-pixel desired.
- * Use \c (unsigned)(-1) to mean "any depth".
- * \param max_colors The maximum number of colors desired. Use
- * \c (unsigned)(-1) to mean "any number of colors".
- * \assert
- * \code filename != NULL \endcode
- * \code picture != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid PICTURE block was read from \a filename,
- * and \a *picture will be set to the address of the metadata
- * structure. Returns \c false if there was a memory allocation
- * error, a file decoder error, or the file contained no PICTURE
- * block, and \a *picture will be set to \c NULL.
- */
- FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors);
-
- /* \} */
-
-
- /** \defgroup flac_metadata_level1 FLAC/metadata.h: metadata level 1 interface
- * \ingroup flac_metadata
- *
- * \brief
- * The level 1 interface provides read-write access to FLAC file metadata and
- * operates directly on the FLAC file.
- *
- * The general usage of this interface is:
- *
- * - Create an iterator using FLAC__metadata_simple_iterator_new()
- * - Attach it to a file using FLAC__metadata_simple_iterator_init() and check
- * the exit code. Call FLAC__metadata_simple_iterator_is_writable() to
- * see if the file is writable, or only read access is allowed.
- * - Use FLAC__metadata_simple_iterator_next() and
- * FLAC__metadata_simple_iterator_prev() to traverse the blocks.
- * This is does not read the actual blocks themselves.
- * FLAC__metadata_simple_iterator_next() is relatively fast.
- * FLAC__metadata_simple_iterator_prev() is slower since it needs to search
- * forward from the front of the file.
- * - Use FLAC__metadata_simple_iterator_get_block_type() or
- * FLAC__metadata_simple_iterator_get_block() to access the actual data at
- * the current iterator position. The returned object is yours to modify
- * and free.
- * - Use FLAC__metadata_simple_iterator_set_block() to write a modified block
- * back. You must have write permission to the original file. Make sure to
- * read the whole comment to FLAC__metadata_simple_iterator_set_block()
- * below.
- * - Use FLAC__metadata_simple_iterator_insert_block_after() to add new blocks.
- * Use the object creation functions from
- * \link flac_metadata_object here \endlink to generate new objects.
- * - Use FLAC__metadata_simple_iterator_delete_block() to remove the block
- * currently referred to by the iterator, or replace it with padding.
- * - Destroy the iterator with FLAC__metadata_simple_iterator_delete() when
- * finished.
- *
- * \note
- * The FLAC file remains open the whole time between
- * FLAC__metadata_simple_iterator_init() and
- * FLAC__metadata_simple_iterator_delete(), so make sure you are not altering
- * the file during this time.
- *
- * \note
- * Do not modify the \a is_last, \a length, or \a type fields of returned
- * FLAC__StreamMetadata objects. These are managed automatically.
- *
- * \note
- * If any of the modification functions
- * (FLAC__metadata_simple_iterator_set_block(),
- * FLAC__metadata_simple_iterator_delete_block(),
- * FLAC__metadata_simple_iterator_insert_block_after(), etc.) return \c false,
- * you should delete the iterator as it may no longer be valid.
- *
- * \{
- */
-
- struct FLAC__Metadata_SimpleIterator;
- /** The opaque structure definition for the level 1 iterator type.
- * See the
- * \link flac_metadata_level1 metadata level 1 module \endlink
- * for a detailed description.
- */
- typedef struct FLAC__Metadata_SimpleIterator FLAC__Metadata_SimpleIterator;
-
- /** Status type for FLAC__Metadata_SimpleIterator.
- *
- * The iterator's current status can be obtained by calling FLAC__metadata_simple_iterator_status().
- */
- typedef enum
- {
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK = 0,
- /**< The iterator is in the normal OK state */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT,
- /**< The data passed into a function violated the function's usage criteria */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE,
- /**< The iterator could not open the target file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE,
- /**< The iterator could not find the FLAC signature at the start of the file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE,
- /**< The iterator tried to write to a file that was not writable */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA,
- /**< The iterator encountered input that does not conform to the FLAC metadata specification */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR,
- /**< The iterator encountered an error while reading the FLAC file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR,
- /**< The iterator encountered an error while seeking in the FLAC file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR,
- /**< The iterator encountered an error while writing the FLAC file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR,
- /**< The iterator encountered an error renaming the FLAC file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR,
- /**< The iterator encountered an error removing the temporary file */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR,
- /**< Memory allocation failed */
-
- FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR
- /**< The caller violated an assertion or an unexpected error occurred */
-
- } FLAC__Metadata_SimpleIteratorStatus;
-
- /** Maps a FLAC__Metadata_SimpleIteratorStatus to a C string.
- *
- * Using a FLAC__Metadata_SimpleIteratorStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[];
-
-
- /** Create a new iterator instance.
- *
- * \retval FLAC__Metadata_SimpleIterator*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(void);
-
- /** Free an iterator instance. Deletes the object pointed to by \a iterator.
- *
- * \param iterator A pointer to an existing iterator.
- * \assert
- * \code iterator != NULL \endcode
- */
- FLAC_API void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator);
-
- /** Get the current status of the iterator. Call this after a function
- * returns \c false to get the reason for the error. Also resets the status
- * to FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK.
- *
- * \param iterator A pointer to an existing iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \retval FLAC__Metadata_SimpleIteratorStatus
- * The current status of the iterator.
- */
- FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator);
-
- /** Initialize the iterator to point to the first metadata block in the
- * given FLAC file.
- *
- * \param iterator A pointer to an existing iterator.
- * \param filename The path to the FLAC file.
- * \param read_only If \c true, the FLAC file will be opened
- * in read-only mode; if \c false, the FLAC
- * file will be opened for edit even if no
- * edits are performed.
- * \param preserve_file_stats If \c true, the owner and modification
- * time will be preserved even if the FLAC
- * file is written to.
- * \assert
- * \code iterator != NULL \endcode
- * \code filename != NULL \endcode
- * \retval FLAC__bool
- * \c false if a memory allocation error occurs, the file can't be
- * opened, or another error occurs, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats);
-
- /** Returns \c true if the FLAC file is writable. If \c false, calls to
- * FLAC__metadata_simple_iterator_set_block() and
- * FLAC__metadata_simple_iterator_insert_block_after() will fail.
- *
- * \param iterator A pointer to an existing iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \retval FLAC__bool
- * See above.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator);
-
- /** Moves the iterator forward one metadata block, returning \c false if
- * already at the end.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__bool
- * \c false if already at the last metadata block of the chain, else
- * \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator);
-
- /** Moves the iterator backward one metadata block, returning \c false if
- * already at the beginning.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__bool
- * \c false if already at the first metadata block of the chain, else
- * \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator);
-
- /** Returns a flag telling if the current metadata block is the last.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__bool
- * \c true if the current metadata block is the last in the file,
- * else \c false.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator);
-
- /** Get the offset of the metadata block at the current position. This
- * avoids reading the actual block data which can save time for large
- * blocks.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval off_t
- * The offset of the metadata block at the current iterator position.
- * This is the byte offset relative to the beginning of the file of
- * the current metadata block's header.
- */
- FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator);
-
- /** Get the type of the metadata block at the current position. This
- * avoids reading the actual block data which can save time for large
- * blocks.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__MetadataType
- * The type of the metadata block at the current iterator position.
- */
- FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator);
-
- /** Get the length of the metadata block at the current position. This
- * avoids reading the actual block data which can save time for large
- * blocks.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval unsigned
- * The length of the metadata block at the current iterator position.
- * The is same length as that in the
- * <a href="http://flac.sourceforge.net/format.html#metadata_block_header">metadata block header</a>,
- * i.e. the length of the metadata body that follows the header.
- */
- FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator);
-
- /** Get the application ID of the \c APPLICATION block at the current
- * position. This avoids reading the actual block data which can save
- * time for large blocks.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param id A pointer to a buffer of at least \c 4 bytes where
- * the ID will be stored.
- * \assert
- * \code iterator != NULL \endcode
- * \code id != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__bool
- * \c true if the ID was successfully read, else \c false, in which
- * case you should check FLAC__metadata_simple_iterator_status() to
- * find out why. If the status is
- * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT, then the
- * current metadata block is not an \c APPLICATION block. Otherwise
- * if the status is
- * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR or
- * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR, an I/O error
- * occurred and the iterator can no longer be used.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id);
-
- /** Get the metadata block at the current position. You can modify the
- * block but must use FLAC__metadata_simple_iterator_set_block() to
- * write it back to the FLAC file.
- *
- * You must call FLAC__metadata_object_delete() on the returned object
- * when you are finished with it.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__StreamMetadata*
- * The current metadata block, or \c NULL if there was a memory
- * allocation error.
- */
- FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator);
-
- /** Write a block back to the FLAC file. This function tries to be
- * as efficient as possible; how the block is actually written is
- * shown by the following:
- *
- * Existing block is a STREAMINFO block and the new block is a
- * STREAMINFO block: the new block is written in place. Make sure
- * you know what you're doing when changing the values of a
- * STREAMINFO block.
- *
- * Existing block is a STREAMINFO block and the new block is a
- * not a STREAMINFO block: this is an error since the first block
- * must be a STREAMINFO block. Returns \c false without altering the
- * file.
- *
- * Existing block is not a STREAMINFO block and the new block is a
- * STREAMINFO block: this is an error since there may be only one
- * STREAMINFO block. Returns \c false without altering the file.
- *
- * Existing block and new block are the same length: the existing
- * block will be replaced by the new block, written in place.
- *
- * Existing block is longer than new block: if use_padding is \c true,
- * the existing block will be overwritten in place with the new
- * block followed by a PADDING block, if possible, to make the total
- * size the same as the existing block. Remember that a padding
- * block requires at least four bytes so if the difference in size
- * between the new block and existing block is less than that, the
- * entire file will have to be rewritten, using the new block's
- * exact size. If use_padding is \c false, the entire file will be
- * rewritten, replacing the existing block by the new block.
- *
- * Existing block is shorter than new block: if use_padding is \c true,
- * the function will try and expand the new block into the following
- * PADDING block, if it exists and doing so won't shrink the PADDING
- * block to less than 4 bytes. If there is no following PADDING
- * block, or it will shrink to less than 4 bytes, or use_padding is
- * \c false, the entire file is rewritten, replacing the existing block
- * with the new block. Note that in this case any following PADDING
- * block is preserved as is.
- *
- * After writing the block, the iterator will remain in the same
- * place, i.e. pointing to the new block.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param block The block to set.
- * \param use_padding See above.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \code block != NULL \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding);
-
- /** This is similar to FLAC__metadata_simple_iterator_set_block()
- * except that instead of writing over an existing block, it appends
- * a block after the existing block. \a use_padding is again used to
- * tell the function to try an expand into following padding in an
- * attempt to avoid rewriting the entire file.
- *
- * This function will fail and return \c false if given a STREAMINFO
- * block.
- *
- * After writing the block, the iterator will be pointing to the
- * new block.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param block The block to set.
- * \param use_padding See above.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \code block != NULL \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding);
-
- /** Deletes the block at the current position. This will cause the
- * entire FLAC file to be rewritten, unless \a use_padding is \c true,
- * in which case the block will be replaced by an equal-sized PADDING
- * block. The iterator will be left pointing to the block before the
- * one just deleted.
- *
- * You may not delete the STREAMINFO block.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param use_padding See above.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_simple_iterator_init()
- * \retval FLAC__bool
- * \c true if successful, else \c false.
- */
- FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding);
-
- /* \} */
-
-
- /** \defgroup flac_metadata_level2 FLAC/metadata.h: metadata level 2 interface
- * \ingroup flac_metadata
- *
- * \brief
- * The level 2 interface provides read-write access to FLAC file metadata;
- * all metadata is read into memory, operated on in memory, and then written
- * to file, which is more efficient than level 1 when editing multiple blocks.
- *
- * Currently Ogg FLAC is supported for read only, via
- * FLAC__metadata_chain_read_ogg() but a subsequent
- * FLAC__metadata_chain_write() will fail.
- *
- * The general usage of this interface is:
- *
- * - Create a new chain using FLAC__metadata_chain_new(). A chain is a
- * linked list of FLAC metadata blocks.
- * - Read all metadata into the the chain from a FLAC file using
- * FLAC__metadata_chain_read() or FLAC__metadata_chain_read_ogg() and
- * check the status.
- * - Optionally, consolidate the padding using
- * FLAC__metadata_chain_merge_padding() or
- * FLAC__metadata_chain_sort_padding().
- * - Create a new iterator using FLAC__metadata_iterator_new()
- * - Initialize the iterator to point to the first element in the chain
- * using FLAC__metadata_iterator_init()
- * - Traverse the chain using FLAC__metadata_iterator_next and
- * FLAC__metadata_iterator_prev().
- * - Get a block for reading or modification using
- * FLAC__metadata_iterator_get_block(). The pointer to the object
- * inside the chain is returned, so the block is yours to modify.
- * Changes will be reflected in the FLAC file when you write the
- * chain. You can also add and delete blocks (see functions below).
- * - When done, write out the chain using FLAC__metadata_chain_write().
- * Make sure to read the whole comment to the function below.
- * - Delete the chain using FLAC__metadata_chain_delete().
- *
- * \note
- * Even though the FLAC file is not open while the chain is being
- * manipulated, you must not alter the file externally during
- * this time. The chain assumes the FLAC file will not change
- * between the time of FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg()
- * and FLAC__metadata_chain_write().
- *
- * \note
- * Do not modify the is_last, length, or type fields of returned
- * FLAC__StreamMetadata objects. These are managed automatically.
- *
- * \note
- * The metadata objects returned by FLAC__metadata_iterator_get_block()
- * are owned by the chain; do not FLAC__metadata_object_delete() them.
- * In the same way, blocks passed to FLAC__metadata_iterator_set_block()
- * become owned by the chain and they will be deleted when the chain is
- * deleted.
- *
- * \{
- */
-
- struct FLAC__Metadata_Chain;
- /** The opaque structure definition for the level 2 chain type.
- */
- typedef struct FLAC__Metadata_Chain FLAC__Metadata_Chain;
-
- struct FLAC__Metadata_Iterator;
- /** The opaque structure definition for the level 2 iterator type.
- */
- typedef struct FLAC__Metadata_Iterator FLAC__Metadata_Iterator;
-
- typedef enum
- {
- FLAC__METADATA_CHAIN_STATUS_OK = 0,
- /**< The chain is in the normal OK state */
-
- FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT,
- /**< The data passed into a function violated the function's usage criteria */
-
- FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE,
- /**< The chain could not open the target file */
-
- FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE,
- /**< The chain could not find the FLAC signature at the start of the file */
-
- FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE,
- /**< The chain tried to write to a file that was not writable */
-
- FLAC__METADATA_CHAIN_STATUS_BAD_METADATA,
- /**< The chain encountered input that does not conform to the FLAC metadata specification */
-
- FLAC__METADATA_CHAIN_STATUS_READ_ERROR,
- /**< The chain encountered an error while reading the FLAC file */
-
- FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR,
- /**< The chain encountered an error while seeking in the FLAC file */
-
- FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR,
- /**< The chain encountered an error while writing the FLAC file */
-
- FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR,
- /**< The chain encountered an error renaming the FLAC file */
-
- FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR,
- /**< The chain encountered an error removing the temporary file */
-
- FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR,
- /**< Memory allocation failed */
-
- FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR,
- /**< The caller violated an assertion or an unexpected error occurred */
-
- FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS,
- /**< One or more of the required callbacks was NULL */
-
- FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH,
- /**< FLAC__metadata_chain_write() was called on a chain read by
- * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(),
- * or
- * FLAC__metadata_chain_write_with_callbacks()/FLAC__metadata_chain_write_with_callbacks_and_tempfile()
- * was called on a chain read by
- * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg().
- * Matching read/write methods must always be used. */
-
- FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL
- /**< FLAC__metadata_chain_write_with_callbacks() was called when the
- * chain write requires a tempfile; use
- * FLAC__metadata_chain_write_with_callbacks_and_tempfile() instead.
- * Or, FLAC__metadata_chain_write_with_callbacks_and_tempfile() was
- * called when the chain write does not require a tempfile; use
- * FLAC__metadata_chain_write_with_callbacks() instead.
- * Always check FLAC__metadata_chain_check_if_tempfile_needed()
- * before writing via callbacks. */
-
- } FLAC__Metadata_ChainStatus;
-
- /** Maps a FLAC__Metadata_ChainStatus to a C string.
- *
- * Using a FLAC__Metadata_ChainStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__Metadata_ChainStatusString[];
-
- /*********** FLAC__Metadata_Chain ***********/
-
- /** Create a new chain instance.
- *
- * \retval FLAC__Metadata_Chain*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new(void);
-
- /** Free a chain instance. Deletes the object pointed to by \a chain.
- *
- * \param chain A pointer to an existing chain.
- * \assert
- * \code chain != NULL \endcode
- */
- FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain);
-
- /** Get the current status of the chain. Call this after a function
- * returns \c false to get the reason for the error. Also resets the
- * status to FLAC__METADATA_CHAIN_STATUS_OK.
- *
- * \param chain A pointer to an existing chain.
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__Metadata_ChainStatus
- * The current status of the chain.
- */
- FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain);
-
- /** Read all metadata from a FLAC file into the chain.
- *
- * \param chain A pointer to an existing chain.
- * \param filename The path to the FLAC file to read.
- * \assert
- * \code chain != NULL \endcode
- * \code filename != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid list of metadata blocks was read from
- * \a filename, else \c false. On failure, check the status with
- * FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename);
-
- /** Read all metadata from an Ogg FLAC file into the chain.
- *
- * \note Ogg FLAC metadata data writing is not supported yet and
- * FLAC__metadata_chain_write() will fail.
- *
- * \param chain A pointer to an existing chain.
- * \param filename The path to the Ogg FLAC file to read.
- * \assert
- * \code chain != NULL \endcode
- * \code filename != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid list of metadata blocks was read from
- * \a filename, else \c false. On failure, check the status with
- * FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg(FLAC__Metadata_Chain *chain, const char *filename);
-
- /** Read all metadata from a FLAC stream into the chain via I/O callbacks.
- *
- * The \a handle need only be open for reading, but must be seekable.
- * The equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb"
- * for Windows).
- *
- * \param chain A pointer to an existing chain.
- * \param handle The I/O handle of the FLAC stream to read. The
- * handle will NOT be closed after the metadata is read;
- * that is the duty of the caller.
- * \param callbacks
- * A set of callbacks to use for I/O. The mandatory
- * callbacks are \a read, \a seek, and \a tell.
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid list of metadata blocks was read from
- * \a handle, else \c false. On failure, check the status with
- * FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
-
- /** Read all metadata from an Ogg FLAC stream into the chain via I/O callbacks.
- *
- * The \a handle need only be open for reading, but must be seekable.
- * The equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb"
- * for Windows).
- *
- * \note Ogg FLAC metadata data writing is not supported yet and
- * FLAC__metadata_chain_write() will fail.
- *
- * \param chain A pointer to an existing chain.
- * \param handle The I/O handle of the Ogg FLAC stream to read. The
- * handle will NOT be closed after the metadata is read;
- * that is the duty of the caller.
- * \param callbacks
- * A set of callbacks to use for I/O. The mandatory
- * callbacks are \a read, \a seek, and \a tell.
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__bool
- * \c true if a valid list of metadata blocks was read from
- * \a handle, else \c false. On failure, check the status with
- * FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
-
- /** Checks if writing the given chain would require the use of a
- * temporary file, or if it could be written in place.
- *
- * Under certain conditions, padding can be utilized so that writing
- * edited metadata back to the FLAC file does not require rewriting the
- * entire file. If rewriting is required, then a temporary workfile is
- * required. When writing metadata using callbacks, you must check
- * this function to know whether to call
- * FLAC__metadata_chain_write_with_callbacks() or
- * FLAC__metadata_chain_write_with_callbacks_and_tempfile(). When
- * writing with FLAC__metadata_chain_write(), the temporary file is
- * handled internally.
- *
- * \param chain A pointer to an existing chain.
- * \param use_padding
- * Whether or not padding will be allowed to be used
- * during the write. The value of \a use_padding given
- * here must match the value later passed to
- * FLAC__metadata_chain_write_with_callbacks() or
- * FLAC__metadata_chain_write_with_callbacks_with_tempfile().
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__bool
- * \c true if writing the current chain would require a tempfile, or
- * \c false if metadata can be written in place.
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata_Chain *chain, FLAC__bool use_padding);
-
- /** Write all metadata out to the FLAC file. This function tries to be as
- * efficient as possible; how the metadata is actually written is shown by
- * the following:
- *
- * If the current chain is the same size as the existing metadata, the new
- * data is written in place.
- *
- * If the current chain is longer than the existing metadata, and
- * \a use_padding is \c true, and the last block is a PADDING block of
- * sufficient length, the function will truncate the final padding block
- * so that the overall size of the metadata is the same as the existing
- * metadata, and then just rewrite the metadata. Otherwise, if not all of
- * the above conditions are met, the entire FLAC file must be rewritten.
- * If you want to use padding this way it is a good idea to call
- * FLAC__metadata_chain_sort_padding() first so that you have the maximum
- * amount of padding to work with, unless you need to preserve ordering
- * of the PADDING blocks for some reason.
- *
- * If the current chain is shorter than the existing metadata, and
- * \a use_padding is \c true, and the final block is a PADDING block, the padding
- * is extended to make the overall size the same as the existing data. If
- * \a use_padding is \c true and the last block is not a PADDING block, a new
- * PADDING block is added to the end of the new data to make it the same
- * size as the existing data (if possible, see the note to
- * FLAC__metadata_simple_iterator_set_block() about the four byte limit)
- * and the new data is written in place. If none of the above apply or
- * \a use_padding is \c false, the entire FLAC file is rewritten.
- *
- * If \a preserve_file_stats is \c true, the owner and modification time will
- * be preserved even if the FLAC file is written.
- *
- * For this write function to be used, the chain must have been read with
- * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(), not
- * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks().
- *
- * \param chain A pointer to an existing chain.
- * \param use_padding See above.
- * \param preserve_file_stats See above.
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__bool
- * \c true if the write succeeded, else \c false. On failure,
- * check the status with FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats);
-
- /** Write all metadata out to a FLAC stream via callbacks.
- *
- * (See FLAC__metadata_chain_write() for the details on how padding is
- * used to write metadata in place if possible.)
- *
- * The \a handle must be open for updating and be seekable. The
- * equivalent minimum stdio fopen() file mode is \c "r+" (or \c "r+b"
- * for Windows).
- *
- * For this write function to be used, the chain must have been read with
- * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(),
- * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg().
- * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned
- * \c false.
- *
- * \param chain A pointer to an existing chain.
- * \param use_padding See FLAC__metadata_chain_write()
- * \param handle The I/O handle of the FLAC stream to write. The
- * handle will NOT be closed after the metadata is
- * written; that is the duty of the caller.
- * \param callbacks A set of callbacks to use for I/O. The mandatory
- * callbacks are \a write and \a seek.
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__bool
- * \c true if the write succeeded, else \c false. On failure,
- * check the status with FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
-
- /** Write all metadata out to a FLAC stream via callbacks.
- *
- * (See FLAC__metadata_chain_write() for the details on how padding is
- * used to write metadata in place if possible.)
- *
- * This version of the write-with-callbacks function must be used when
- * FLAC__metadata_chain_check_if_tempfile_needed() returns true. In
- * this function, you must supply an I/O handle corresponding to the
- * FLAC file to edit, and a temporary handle to which the new FLAC
- * file will be written. It is the caller's job to move this temporary
- * FLAC file on top of the original FLAC file to complete the metadata
- * edit.
- *
- * The \a handle must be open for reading and be seekable. The
- * equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb"
- * for Windows).
- *
- * The \a temp_handle must be open for writing. The
- * equivalent minimum stdio fopen() file mode is \c "w" (or \c "wb"
- * for Windows). It should be an empty stream, or at least positioned
- * at the start-of-file (in which case it is the caller's duty to
- * truncate it on return).
- *
- * For this write function to be used, the chain must have been read with
- * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(),
- * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg().
- * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned
- * \c true.
- *
- * \param chain A pointer to an existing chain.
- * \param use_padding See FLAC__metadata_chain_write()
- * \param handle The I/O handle of the original FLAC stream to read.
- * The handle will NOT be closed after the metadata is
- * written; that is the duty of the caller.
- * \param callbacks A set of callbacks to use for I/O on \a handle.
- * The mandatory callbacks are \a read, \a seek, and
- * \a eof.
- * \param temp_handle The I/O handle of the FLAC stream to write. The
- * handle will NOT be closed after the metadata is
- * written; that is the duty of the caller.
- * \param temp_callbacks
- * A set of callbacks to use for I/O on temp_handle.
- * The only mandatory callback is \a write.
- * \assert
- * \code chain != NULL \endcode
- * \retval FLAC__bool
- * \c true if the write succeeded, else \c false. On failure,
- * check the status with FLAC__metadata_chain_status().
- */
- FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks);
-
- /** Merge adjacent PADDING blocks into a single block.
- *
- * \note This function does not write to the FLAC file, it only
- * modifies the chain.
- *
- * \warning Any iterator on the current chain will become invalid after this
- * call. You should delete the iterator and get a new one.
- *
- * \param chain A pointer to an existing chain.
- * \assert
- * \code chain != NULL \endcode
- */
- FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain);
-
- /** This function will move all PADDING blocks to the end on the metadata,
- * then merge them into a single block.
- *
- * \note This function does not write to the FLAC file, it only
- * modifies the chain.
- *
- * \warning Any iterator on the current chain will become invalid after this
- * call. You should delete the iterator and get a new one.
- *
- * \param chain A pointer to an existing chain.
- * \assert
- * \code chain != NULL \endcode
- */
- FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain);
-
-
- /*********** FLAC__Metadata_Iterator ***********/
-
- /** Create a new iterator instance.
- *
- * \retval FLAC__Metadata_Iterator*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(void);
-
- /** Free an iterator instance. Deletes the object pointed to by \a iterator.
- *
- * \param iterator A pointer to an existing iterator.
- * \assert
- * \code iterator != NULL \endcode
- */
- FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator);
-
- /** Initialize the iterator to point to the first metadata block in the
- * given chain.
- *
- * \param iterator A pointer to an existing iterator.
- * \param chain A pointer to an existing and initialized (read) chain.
- * \assert
- * \code iterator != NULL \endcode
- * \code chain != NULL \endcode
- */
- FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain);
-
- /** Moves the iterator forward one metadata block, returning \c false if
- * already at the end.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__bool
- * \c false if already at the last metadata block of the chain, else
- * \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator);
-
- /** Moves the iterator backward one metadata block, returning \c false if
- * already at the beginning.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__bool
- * \c false if already at the first metadata block of the chain, else
- * \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator);
-
- /** Get the type of the metadata block at the current position.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__MetadataType
- * The type of the metadata block at the current iterator position.
- */
- FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator);
-
- /** Get the metadata block at the current position. You can modify
- * the block in place but must write the chain before the changes
- * are reflected to the FLAC file. You do not need to call
- * FLAC__metadata_iterator_set_block() to reflect the changes;
- * the pointer returned by FLAC__metadata_iterator_get_block()
- * points directly into the chain.
- *
- * \warning
- * Do not call FLAC__metadata_object_delete() on the returned object;
- * to delete a block use FLAC__metadata_iterator_delete_block().
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__StreamMetadata*
- * The current metadata block.
- */
- FLAC_API FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator);
-
- /** Set the metadata block at the current position, replacing the existing
- * block. The new block passed in becomes owned by the chain and it will be
- * deleted when the chain is deleted.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param block A pointer to a metadata block.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \code block != NULL \endcode
- * \retval FLAC__bool
- * \c false if the conditions in the above description are not met, or
- * a memory allocation error occurs, otherwise \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
-
- /** Removes the current block from the chain. If \a replace_with_padding is
- * \c true, the block will instead be replaced with a padding block of equal
- * size. You can not delete the STREAMINFO block. The iterator will be
- * left pointing to the block before the one just "deleted", even if
- * \a replace_with_padding is \c true.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param replace_with_padding See above.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__bool
- * \c false if the conditions in the above description are not met,
- * otherwise \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding);
-
- /** Insert a new block before the current block. You cannot insert a block
- * before the first STREAMINFO block. You cannot insert a STREAMINFO block
- * as there can be only one, the one that already exists at the head when you
- * read in a chain. The chain takes ownership of the new block and it will be
- * deleted when the chain is deleted. The iterator will be left pointing to
- * the new block.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param block A pointer to a metadata block to insert.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__bool
- * \c false if the conditions in the above description are not met, or
- * a memory allocation error occurs, otherwise \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
-
- /** Insert a new block after the current block. You cannot insert a STREAMINFO
- * block as there can be only one, the one that already exists at the head when
- * you read in a chain. The chain takes ownership of the new block and it will
- * be deleted when the chain is deleted. The iterator will be left pointing to
- * the new block.
- *
- * \param iterator A pointer to an existing initialized iterator.
- * \param block A pointer to a metadata block to insert.
- * \assert
- * \code iterator != NULL \endcode
- * \a iterator has been successfully initialized with
- * FLAC__metadata_iterator_init()
- * \retval FLAC__bool
- * \c false if the conditions in the above description are not met, or
- * a memory allocation error occurs, otherwise \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
-
- /* \} */
-
-
- /** \defgroup flac_metadata_object FLAC/metadata.h: metadata object methods
- * \ingroup flac_metadata
- *
- * \brief
- * This module contains methods for manipulating FLAC metadata objects.
- *
- * Since many are variable length we have to be careful about the memory
- * management. We decree that all pointers to data in the object are
- * owned by the object and memory-managed by the object.
- *
- * Use the FLAC__metadata_object_new() and FLAC__metadata_object_delete()
- * functions to create all instances. When using the
- * FLAC__metadata_object_set_*() functions to set pointers to data, set
- * \a copy to \c true to have the function make it's own copy of the data, or
- * to \c false to give the object ownership of your data. In the latter case
- * your pointer must be freeable by free() and will be free()d when the object
- * is FLAC__metadata_object_delete()d. It is legal to pass a null pointer as
- * the data pointer to a FLAC__metadata_object_set_*() function as long as
- * the length argument is 0 and the \a copy argument is \c false.
- *
- * The FLAC__metadata_object_new() and FLAC__metadata_object_clone() function
- * will return \c NULL in the case of a memory allocation error, otherwise a new
- * object. The FLAC__metadata_object_set_*() functions return \c false in the
- * case of a memory allocation error.
- *
- * We don't have the convenience of C++ here, so note that the library relies
- * on you to keep the types straight. In other words, if you pass, for
- * example, a FLAC__StreamMetadata* that represents a STREAMINFO block to
- * FLAC__metadata_object_application_set_data(), you will get an assertion
- * failure.
- *
- * For convenience the FLAC__metadata_object_vorbiscomment_*() functions
- * maintain a trailing NUL on each Vorbis comment entry. This is not counted
- * toward the length or stored in the stream, but it can make working with plain
- * comments (those that don't contain embedded-NULs in the value) easier.
- * Entries passed into these functions have trailing NULs added if missing, and
- * returned entries are guaranteed to have a trailing NUL.
- *
- * The FLAC__metadata_object_vorbiscomment_*() functions that take a Vorbis
- * comment entry/name/value will first validate that it complies with the Vorbis
- * comment specification and return false if it does not.
- *
- * There is no need to recalculate the length field on metadata blocks you
- * have modified. They will be calculated automatically before they are
- * written back to a file.
- *
- * \{
- */
-
-
- /** Create a new metadata object instance of the given type.
- *
- * The object will be "empty"; i.e. values and data pointers will be \c 0,
- * with the exception of FLAC__METADATA_TYPE_VORBIS_COMMENT, which will have
- * the vendor string set (but zero comments).
- *
- * Do not pass in a value greater than or equal to
- * \a FLAC__METADATA_TYPE_UNDEFINED unless you really know what you're
- * doing.
- *
- * \param type Type of object to create
- * \retval FLAC__StreamMetadata*
- * \c NULL if there was an error allocating memory or the type code is
- * greater than FLAC__MAX_METADATA_TYPE_CODE, else the new instance.
- */
- FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type);
-
- /** Create a copy of an existing metadata object.
- *
- * The copy is a "deep" copy, i.e. dynamically allocated data within the
- * object is also copied. The caller takes ownership of the new block and
- * is responsible for freeing it with FLAC__metadata_object_delete().
- *
- * \param object Pointer to object to copy.
- * \assert
- * \code object != NULL \endcode
- * \retval FLAC__StreamMetadata*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object);
-
- /** Free a metadata object. Deletes the object pointed to by \a object.
- *
- * The delete is a "deep" delete, i.e. dynamically allocated data within the
- * object is also deleted.
- *
- * \param object A pointer to an existing object.
- * \assert
- * \code object != NULL \endcode
- */
- FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object);
-
- /** Compares two metadata objects.
- *
- * The compare is "deep", i.e. dynamically allocated data within the
- * object is also compared.
- *
- * \param block1 A pointer to an existing object.
- * \param block2 A pointer to an existing object.
- * \assert
- * \code block1 != NULL \endcode
- * \code block2 != NULL \endcode
- * \retval FLAC__bool
- * \c true if objects are identical, else \c false.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2);
-
- /** Sets the application data of an APPLICATION block.
- *
- * If \a copy is \c true, a copy of the data is stored; otherwise, the object
- * takes ownership of the pointer. The existing data will be freed if this
- * function is successful, otherwise the original data will remain if \a copy
- * is \c true and malloc() fails.
- *
- * \note It is safe to pass a const pointer to \a data if \a copy is \c true.
- *
- * \param object A pointer to an existing APPLICATION object.
- * \param data A pointer to the data to set.
- * \param length The length of \a data in bytes.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_APPLICATION \endcode
- * \code (data != NULL && length > 0) ||
- * (data == NULL && length == 0 && copy == false) \endcode
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy);
-
- /** Resize the seekpoint array.
- *
- * If the size shrinks, elements will truncated; if it grows, new placeholder
- * points will be added to the end.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param new_num_points The desired length of the array; may be \c 0.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \code (object->data.seek_table.points == NULL && object->data.seek_table.num_points == 0) ||
- * (object->data.seek_table.points != NULL && object->data.seek_table.num_points > 0) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation error, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points);
-
- /** Set a seekpoint in a seektable.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param point_num Index into seekpoint array to set.
- * \param point The point to set.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \code object->data.seek_table.num_points > point_num \endcode
- */
- FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
-
- /** Insert a seekpoint into a seektable.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param point_num Index into seekpoint array to set.
- * \param point The point to set.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \code object->data.seek_table.num_points >= point_num \endcode
- * \retval FLAC__bool
- * \c false if memory allocation error, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
-
- /** Delete a seekpoint from a seektable.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param point_num Index into seekpoint array to set.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \code object->data.seek_table.num_points > point_num \endcode
- * \retval FLAC__bool
- * \c false if memory allocation error, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num);
-
- /** Check a seektable to see if it conforms to the FLAC specification.
- * See the format specification for limits on the contents of the
- * seektable.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \retval FLAC__bool
- * \c false if seek table is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object);
-
- /** Append a number of placeholder points to the end of a seek table.
- *
- * \note
- * As with the other ..._seektable_template_... functions, you should
- * call FLAC__metadata_object_seektable_template_sort() when finished
- * to make the seek table legal.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param num The number of placeholder points to append.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num);
-
- /** Append a specific seek point template to the end of a seek table.
- *
- * \note
- * As with the other ..._seektable_template_... functions, you should
- * call FLAC__metadata_object_seektable_template_sort() when finished
- * to make the seek table legal.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param sample_number The sample number of the seek point template.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__StreamMetadata *object, FLAC__uint64 sample_number);
-
- /** Append specific seek point templates to the end of a seek table.
- *
- * \note
- * As with the other ..._seektable_template_... functions, you should
- * call FLAC__metadata_object_seektable_template_sort() when finished
- * to make the seek table legal.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param sample_numbers An array of sample numbers for the seek points.
- * \param num The number of seek point templates to append.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num);
-
- /** Append a set of evenly-spaced seek point templates to the end of a
- * seek table.
- *
- * \note
- * As with the other ..._seektable_template_... functions, you should
- * call FLAC__metadata_object_seektable_template_sort() when finished
- * to make the seek table legal.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param num The number of placeholder points to append.
- * \param total_samples The total number of samples to be encoded;
- * the seekpoints will be spaced approximately
- * \a total_samples / \a num samples apart.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \code total_samples > 0 \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples);
-
- /** Append a set of evenly-spaced seek point templates to the end of a
- * seek table.
- *
- * \note
- * As with the other ..._seektable_template_... functions, you should
- * call FLAC__metadata_object_seektable_template_sort() when finished
- * to make the seek table legal.
- *
- * \param object A pointer to an existing SEEKTABLE object.
- * \param samples The number of samples apart to space the placeholder
- * points. The first point will be at sample \c 0, the
- * second at sample \a samples, then 2*\a samples, and
- * so on. As long as \a samples and \a total_samples
- * are greater than \c 0, there will always be at least
- * one seekpoint at sample \c 0.
- * \param total_samples The total number of samples to be encoded;
- * the seekpoints will be spaced
- * \a samples samples apart.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \code samples > 0 \endcode
- * \code total_samples > 0 \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples);
-
- /** Sort a seek table's seek points according to the format specification,
- * removing duplicates.
- *
- * \param object A pointer to a seek table to be sorted.
- * \param compact If \c false, behaves like FLAC__format_seektable_sort().
- * If \c true, duplicates are deleted and the seek table is
- * shrunk appropriately; the number of placeholder points
- * present in the seek table will be the same after the call
- * as before.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
- * \retval FLAC__bool
- * \c false if realloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact);
-
- /** Sets the vendor string in a VORBIS_COMMENT block.
- *
- * For convenience, a trailing NUL is added to the entry if it doesn't have
- * one already.
- *
- * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
- * takes ownership of the \c entry.entry pointer.
- *
- * \note If this function returns \c false, the caller still owns the
- * pointer.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param entry The entry to set the vendor string to.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code (entry.entry != NULL && entry.length > 0) ||
- * (entry.entry == NULL && entry.length == 0) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails or \a entry does not comply with the
- * Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
-
- /** Resize the comment array.
- *
- * If the size shrinks, elements will truncated; if it grows, new empty
- * fields will be added to the end.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param new_num_comments The desired length of the array; may be \c 0.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code (object->data.vorbis_comment.comments == NULL && object->data.vorbis_comment.num_comments == 0) ||
- * (object->data.vorbis_comment.comments != NULL && object->data.vorbis_comment.num_comments > 0) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments);
-
- /** Sets a comment in a VORBIS_COMMENT block.
- *
- * For convenience, a trailing NUL is added to the entry if it doesn't have
- * one already.
- *
- * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
- * takes ownership of the \c entry.entry pointer.
- *
- * \note If this function returns \c false, the caller still owns the
- * pointer.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param comment_num Index into comment array to set.
- * \param entry The entry to set the comment to.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code comment_num < object->data.vorbis_comment.num_comments \endcode
- * \code (entry.entry != NULL && entry.length > 0) ||
- * (entry.entry == NULL && entry.length == 0) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails or \a entry does not comply with the
- * Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
-
- /** Insert a comment in a VORBIS_COMMENT block at the given index.
- *
- * For convenience, a trailing NUL is added to the entry if it doesn't have
- * one already.
- *
- * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
- * takes ownership of the \c entry.entry pointer.
- *
- * \note If this function returns \c false, the caller still owns the
- * pointer.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param comment_num The index at which to insert the comment. The comments
- * at and after \a comment_num move right one position.
- * To append a comment to the end, set \a comment_num to
- * \c object->data.vorbis_comment.num_comments .
- * \param entry The comment to insert.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code object->data.vorbis_comment.num_comments >= comment_num \endcode
- * \code (entry.entry != NULL && entry.length > 0) ||
- * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails or \a entry does not comply with the
- * Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
-
- /** Appends a comment to a VORBIS_COMMENT block.
- *
- * For convenience, a trailing NUL is added to the entry if it doesn't have
- * one already.
- *
- * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
- * takes ownership of the \c entry.entry pointer.
- *
- * \note If this function returns \c false, the caller still owns the
- * pointer.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param entry The comment to insert.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code (entry.entry != NULL && entry.length > 0) ||
- * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails or \a entry does not comply with the
- * Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
-
- /** Replaces comments in a VORBIS_COMMENT block with a new one.
- *
- * For convenience, a trailing NUL is added to the entry if it doesn't have
- * one already.
- *
- * Depending on the the value of \a all, either all or just the first comment
- * whose field name(s) match the given entry's name will be replaced by the
- * given entry. If no comments match, \a entry will simply be appended.
- *
- * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
- * takes ownership of the \c entry.entry pointer.
- *
- * \note If this function returns \c false, the caller still owns the
- * pointer.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param entry The comment to insert.
- * \param all If \c true, all comments whose field name matches
- * \a entry's field name will be removed, and \a entry will
- * be inserted at the position of the first matching
- * comment. If \c false, only the first comment whose
- * field name matches \a entry's field name will be
- * replaced with \a entry.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code (entry.entry != NULL && entry.length > 0) ||
- * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails or \a entry does not comply with the
- * Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy);
-
- /** Delete a comment in a VORBIS_COMMENT block at the given index.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param comment_num The index of the comment to delete.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code object->data.vorbis_comment.num_comments > comment_num \endcode
- * \retval FLAC__bool
- * \c false if realloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num);
-
- /** Creates a Vorbis comment entry from NUL-terminated name and value strings.
- *
- * On return, the filled-in \a entry->entry pointer will point to malloc()ed
- * memory and shall be owned by the caller. For convenience the entry will
- * have a terminating NUL.
- *
- * \param entry A pointer to a Vorbis comment entry. The entry's
- * \c entry pointer should not point to allocated
- * memory as it will be overwritten.
- * \param field_name The field name in ASCII, \c NUL terminated.
- * \param field_value The field value in UTF-8, \c NUL terminated.
- * \assert
- * \code entry != NULL \endcode
- * \code field_name != NULL \endcode
- * \code field_value != NULL \endcode
- * \retval FLAC__bool
- * \c false if malloc() fails, or if \a field_name or \a field_value does
- * not comply with the Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value);
-
- /** Splits a Vorbis comment entry into NUL-terminated name and value strings.
- *
- * The returned pointers to name and value will be allocated by malloc()
- * and shall be owned by the caller.
- *
- * \param entry An existing Vorbis comment entry.
- * \param field_name The address of where the returned pointer to the
- * field name will be stored.
- * \param field_value The address of where the returned pointer to the
- * field value will be stored.
- * \assert
- * \code (entry.entry != NULL && entry.length > 0) \endcode
- * \code memchr(entry.entry, '=', entry.length) != NULL \endcode
- * \code field_name != NULL \endcode
- * \code field_value != NULL \endcode
- * \retval FLAC__bool
- * \c false if memory allocation fails or \a entry does not comply with the
- * Vorbis comment specification, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value);
-
- /** Check if the given Vorbis comment entry's field name matches the given
- * field name.
- *
- * \param entry An existing Vorbis comment entry.
- * \param field_name The field name to check.
- * \param field_name_length The length of \a field_name, not including the
- * terminating \c NUL.
- * \assert
- * \code (entry.entry != NULL && entry.length > 0) \endcode
- * \retval FLAC__bool
- * \c true if the field names match, else \c false
- */
- FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length);
-
- /** Find a Vorbis comment with the given field name.
- *
- * The search begins at entry number \a offset; use an offset of 0 to
- * search from the beginning of the comment array.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param offset The offset into the comment array from where to start
- * the search.
- * \param field_name The field name of the comment to find.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \code field_name != NULL \endcode
- * \retval int
- * The offset in the comment array of the first comment whose field
- * name matches \a field_name, or \c -1 if no match was found.
- */
- FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name);
-
- /** Remove first Vorbis comment matching the given field name.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param field_name The field name of comment to delete.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \retval int
- * \c -1 for memory allocation error, \c 0 for no matching entries,
- * \c 1 for one matching entry deleted.
- */
- FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name);
-
- /** Remove all Vorbis comments matching the given field name.
- *
- * \param object A pointer to an existing VORBIS_COMMENT object.
- * \param field_name The field name of comments to delete.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
- * \retval int
- * \c -1 for memory allocation error, \c 0 for no matching entries,
- * else the number of matching entries deleted.
- */
- FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name);
-
- /** Create a new CUESHEET track instance.
- *
- * The object will be "empty"; i.e. values and data pointers will be \c 0.
- *
- * \retval FLAC__StreamMetadata_CueSheet_Track*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new(void);
-
- /** Create a copy of an existing CUESHEET track object.
- *
- * The copy is a "deep" copy, i.e. dynamically allocated data within the
- * object is also copied. The caller takes ownership of the new object and
- * is responsible for freeing it with
- * FLAC__metadata_object_cuesheet_track_delete().
- *
- * \param object Pointer to object to copy.
- * \assert
- * \code object != NULL \endcode
- * \retval FLAC__StreamMetadata_CueSheet_Track*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object);
-
- /** Delete a CUESHEET track object
- *
- * \param object A pointer to an existing CUESHEET track object.
- * \assert
- * \code object != NULL \endcode
- */
- FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_CueSheet_Track *object);
-
- /** Resize a track's index point array.
- *
- * If the size shrinks, elements will truncated; if it grows, new blank
- * indices will be added to the end.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index of the track to modify. NOTE: this is not
- * necessarily the same as the track's \a number field.
- * \param new_num_indices The desired length of the array; may be \c 0.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks > track_num \endcode
- * \code (object->data.cue_sheet.tracks[track_num].indices == NULL && object->data.cue_sheet.tracks[track_num].num_indices == 0) ||
- * (object->data.cue_sheet.tracks[track_num].indices != NULL && object->data.cue_sheet.tracks[track_num].num_indices > 0) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation error, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices);
-
- /** Insert an index point in a CUESHEET track at the given index.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index of the track to modify. NOTE: this is not
- * necessarily the same as the track's \a number field.
- * \param index_num The index into the track's index array at which to
- * insert the index point. NOTE: this is not necessarily
- * the same as the index point's \a number field. The
- * indices at and after \a index_num move right one
- * position. To append an index point to the end, set
- * \a index_num to
- * \c object->data.cue_sheet.tracks[track_num].num_indices .
- * \param index The index point to insert.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks > track_num \endcode
- * \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode
- * \retval FLAC__bool
- * \c false if realloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index);
-
- /** Insert a blank index point in a CUESHEET track at the given index.
- *
- * A blank index point is one in which all field values are zero.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index of the track to modify. NOTE: this is not
- * necessarily the same as the track's \a number field.
- * \param index_num The index into the track's index array at which to
- * insert the index point. NOTE: this is not necessarily
- * the same as the index point's \a number field. The
- * indices at and after \a index_num move right one
- * position. To append an index point to the end, set
- * \a index_num to
- * \c object->data.cue_sheet.tracks[track_num].num_indices .
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks > track_num \endcode
- * \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode
- * \retval FLAC__bool
- * \c false if realloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num);
-
- /** Delete an index point in a CUESHEET track at the given index.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index into the track array of the track to
- * modify. NOTE: this is not necessarily the same
- * as the track's \a number field.
- * \param index_num The index into the track's index array of the index
- * to delete. NOTE: this is not necessarily the same
- * as the index's \a number field.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks > track_num \endcode
- * \code object->data.cue_sheet.tracks[track_num].num_indices > index_num \endcode
- * \retval FLAC__bool
- * \c false if realloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num);
-
- /** Resize the track array.
- *
- * If the size shrinks, elements will truncated; if it grows, new blank
- * tracks will be added to the end.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param new_num_tracks The desired length of the array; may be \c 0.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code (object->data.cue_sheet.tracks == NULL && object->data.cue_sheet.num_tracks == 0) ||
- * (object->data.cue_sheet.tracks != NULL && object->data.cue_sheet.num_tracks > 0) \endcode
- * \retval FLAC__bool
- * \c false if memory allocation error, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks);
-
- /** Sets a track in a CUESHEET block.
- *
- * If \a copy is \c true, a copy of the track is stored; otherwise, the object
- * takes ownership of the \a track pointer.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num Index into track array to set. NOTE: this is not
- * necessarily the same as the track's \a number field.
- * \param track The track to set the track to. You may safely pass in
- * a const pointer if \a copy is \c true.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code track_num < object->data.cue_sheet.num_tracks \endcode
- * \code (track->indices != NULL && track->num_indices > 0) ||
- * (track->indices == NULL && track->num_indices == 0)
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
-
- /** Insert a track in a CUESHEET block at the given index.
- *
- * If \a copy is \c true, a copy of the track is stored; otherwise, the object
- * takes ownership of the \a track pointer.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index at which to insert the track. NOTE: this
- * is not necessarily the same as the track's \a number
- * field. The tracks at and after \a track_num move right
- * one position. To append a track to the end, set
- * \a track_num to \c object->data.cue_sheet.num_tracks .
- * \param track The track to insert. You may safely pass in a const
- * pointer if \a copy is \c true.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks >= track_num \endcode
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
-
- /** Insert a blank track in a CUESHEET block at the given index.
- *
- * A blank track is one in which all field values are zero.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index at which to insert the track. NOTE: this
- * is not necessarily the same as the track's \a number
- * field. The tracks at and after \a track_num move right
- * one position. To append a track to the end, set
- * \a track_num to \c object->data.cue_sheet.num_tracks .
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks >= track_num \endcode
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num);
-
- /** Delete a track in a CUESHEET block at the given index.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param track_num The index into the track array of the track to
- * delete. NOTE: this is not necessarily the same
- * as the track's \a number field.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \code object->data.cue_sheet.num_tracks > track_num \endcode
- * \retval FLAC__bool
- * \c false if realloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num);
-
- /** Check a cue sheet to see if it conforms to the FLAC specification.
- * See the format specification for limits on the contents of the
- * cue sheet.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \param check_cd_da_subset If \c true, check CUESHEET against more
- * stringent requirements for a CD-DA (audio) disc.
- * \param violation Address of a pointer to a string. If there is a
- * violation, a pointer to a string explanation of the
- * violation will be returned here. \a violation may be
- * \c NULL if you don't need the returned string. Do not
- * free the returned string; it will always point to static
- * data.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \retval FLAC__bool
- * \c false if cue sheet is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation);
-
- /** Calculate and return the CDDB/freedb ID for a cue sheet. The function
- * assumes the cue sheet corresponds to a CD; the result is undefined
- * if the cuesheet's is_cd bit is not set.
- *
- * \param object A pointer to an existing CUESHEET object.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
- * \retval FLAC__uint32
- * The unsigned integer representation of the CDDB/freedb ID
- */
- FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLAC__StreamMetadata *object);
-
- /** Sets the MIME type of a PICTURE block.
- *
- * If \a copy is \c true, a copy of the string is stored; otherwise, the object
- * takes ownership of the pointer. The existing string will be freed if this
- * function is successful, otherwise the original string will remain if \a copy
- * is \c true and malloc() fails.
- *
- * \note It is safe to pass a const pointer to \a mime_type if \a copy is \c true.
- *
- * \param object A pointer to an existing PICTURE object.
- * \param mime_type A pointer to the MIME type string. The string must be
- * ASCII characters 0x20-0x7e, NUL-terminated. No validation
- * is done.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
- * \code (mime_type != NULL) \endcode
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type(FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy);
-
- /** Sets the description of a PICTURE block.
- *
- * If \a copy is \c true, a copy of the string is stored; otherwise, the object
- * takes ownership of the pointer. The existing string will be freed if this
- * function is successful, otherwise the original string will remain if \a copy
- * is \c true and malloc() fails.
- *
- * \note It is safe to pass a const pointer to \a description if \a copy is \c true.
- *
- * \param object A pointer to an existing PICTURE object.
- * \param description A pointer to the description string. The string must be
- * valid UTF-8, NUL-terminated. No validation is done.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
- * \code (description != NULL) \endcode
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description(FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy);
-
- /** Sets the picture data of a PICTURE block.
- *
- * If \a copy is \c true, a copy of the data is stored; otherwise, the object
- * takes ownership of the pointer. Also sets the \a data_length field of the
- * metadata object to what is passed in as the \a length parameter. The
- * existing data will be freed if this function is successful, otherwise the
- * original data and data_length will remain if \a copy is \c true and
- * malloc() fails.
- *
- * \note It is safe to pass a const pointer to \a data if \a copy is \c true.
- *
- * \param object A pointer to an existing PICTURE object.
- * \param data A pointer to the data to set.
- * \param length The length of \a data in bytes.
- * \param copy See above.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
- * \code (data != NULL && length > 0) ||
- * (data == NULL && length == 0 && copy == false) \endcode
- * \retval FLAC__bool
- * \c false if \a copy is \c true and malloc() fails, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy);
-
- /** Check a PICTURE block to see if it conforms to the FLAC specification.
- * See the format specification for limits on the contents of the
- * PICTURE block.
- *
- * \param object A pointer to existing PICTURE block to be checked.
- * \param violation Address of a pointer to a string. If there is a
- * violation, a pointer to a string explanation of the
- * violation will be returned here. \a violation may be
- * \c NULL if you don't need the returned string. Do not
- * free the returned string; it will always point to static
- * data.
- * \assert
- * \code object != NULL \endcode
- * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
- * \retval FLAC__bool
- * \c false if PICTURE block is illegal, else \c true.
- */
- FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation);
-
- /* \} */
+/** \defgroup flac_metadata_level0 FLAC/metadata.h: metadata level 0 interface
+ * \ingroup flac_metadata
+ *
+ * \brief
+ * The level 0 interface consists of individual routines to read the
+ * STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring
+ * only a filename.
+ *
+ * They try to skip any ID3v2 tag at the head of the file.
+ *
+ * \{
+ */
+
+/** Read the STREAMINFO metadata block of the given FLAC file. This function
+ * will try to skip any ID3v2 tag at the head of the file.
+ *
+ * \param filename The path to the FLAC file to read.
+ * \param streaminfo A pointer to space for the STREAMINFO block. Since
+ * FLAC__StreamMetadata is a simple structure with no
+ * memory allocation involved, you pass the address of
+ * an existing structure. It need not be initialized.
+ * \assert
+ * \code filename != NULL \endcode
+ * \code streaminfo != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid STREAMINFO block was read from \a filename. Returns
+ * \c false if there was a memory allocation error, a file decoder error,
+ * or the file contained no STREAMINFO block. (A memory allocation error
+ * is possible because this function must set up a file decoder.)
+ */
+FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo);
+
+/** Read the VORBIS_COMMENT metadata block of the given FLAC file. This
+ * function will try to skip any ID3v2 tag at the head of the file.
+ *
+ * \param filename The path to the FLAC file to read.
+ * \param tags The address where the returned pointer will be
+ * stored. The \a tags object must be deleted by
+ * the caller using FLAC__metadata_object_delete().
+ * \assert
+ * \code filename != NULL \endcode
+ * \code tags != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid VORBIS_COMMENT block was read from \a filename,
+ * and \a *tags will be set to the address of the metadata structure.
+ * Returns \c false if there was a memory allocation error, a file
+ * decoder error, or the file contained no VORBIS_COMMENT block, and
+ * \a *tags will be set to \c NULL.
+ */
+FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags);
+
+/** Read the CUESHEET metadata block of the given FLAC file. This
+ * function will try to skip any ID3v2 tag at the head of the file.
+ *
+ * \param filename The path to the FLAC file to read.
+ * \param cuesheet The address where the returned pointer will be
+ * stored. The \a cuesheet object must be deleted by
+ * the caller using FLAC__metadata_object_delete().
+ * \assert
+ * \code filename != NULL \endcode
+ * \code cuesheet != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid CUESHEET block was read from \a filename,
+ * and \a *cuesheet will be set to the address of the metadata
+ * structure. Returns \c false if there was a memory allocation
+ * error, a file decoder error, or the file contained no CUESHEET
+ * block, and \a *cuesheet will be set to \c NULL.
+ */
+FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__StreamMetadata **cuesheet);
+
+/** Read a PICTURE metadata block of the given FLAC file. This
+ * function will try to skip any ID3v2 tag at the head of the file.
+ * Since there can be more than one PICTURE block in a file, this
+ * function takes a number of parameters that act as constraints to
+ * the search. The PICTURE block with the largest area matching all
+ * the constraints will be returned, or \a *picture will be set to
+ * \c NULL if there was no such block.
+ *
+ * \param filename The path to the FLAC file to read.
+ * \param picture The address where the returned pointer will be
+ * stored. The \a picture object must be deleted by
+ * the caller using FLAC__metadata_object_delete().
+ * \param type The desired picture type. Use \c -1 to mean
+ * "any type".
+ * \param mime_type The desired MIME type, e.g. "image/jpeg". The
+ * string will be matched exactly. Use \c NULL to
+ * mean "any MIME type".
+ * \param description The desired description. The string will be
+ * matched exactly. Use \c NULL to mean "any
+ * description".
+ * \param max_width The maximum width in pixels desired. Use
+ * \c (unsigned)(-1) to mean "any width".
+ * \param max_height The maximum height in pixels desired. Use
+ * \c (unsigned)(-1) to mean "any height".
+ * \param max_depth The maximum color depth in bits-per-pixel desired.
+ * Use \c (unsigned)(-1) to mean "any depth".
+ * \param max_colors The maximum number of colors desired. Use
+ * \c (unsigned)(-1) to mean "any number of colors".
+ * \assert
+ * \code filename != NULL \endcode
+ * \code picture != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid PICTURE block was read from \a filename,
+ * and \a *picture will be set to the address of the metadata
+ * structure. Returns \c false if there was a memory allocation
+ * error, a file decoder error, or the file contained no PICTURE
+ * block, and \a *picture will be set to \c NULL.
+ */
+FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors);
+
+/* \} */
+
+
+/** \defgroup flac_metadata_level1 FLAC/metadata.h: metadata level 1 interface
+ * \ingroup flac_metadata
+ *
+ * \brief
+ * The level 1 interface provides read-write access to FLAC file metadata and
+ * operates directly on the FLAC file.
+ *
+ * The general usage of this interface is:
+ *
+ * - Create an iterator using FLAC__metadata_simple_iterator_new()
+ * - Attach it to a file using FLAC__metadata_simple_iterator_init() and check
+ * the exit code. Call FLAC__metadata_simple_iterator_is_writable() to
+ * see if the file is writable, or only read access is allowed.
+ * - Use FLAC__metadata_simple_iterator_next() and
+ * FLAC__metadata_simple_iterator_prev() to traverse the blocks.
+ * This is does not read the actual blocks themselves.
+ * FLAC__metadata_simple_iterator_next() is relatively fast.
+ * FLAC__metadata_simple_iterator_prev() is slower since it needs to search
+ * forward from the front of the file.
+ * - Use FLAC__metadata_simple_iterator_get_block_type() or
+ * FLAC__metadata_simple_iterator_get_block() to access the actual data at
+ * the current iterator position. The returned object is yours to modify
+ * and free.
+ * - Use FLAC__metadata_simple_iterator_set_block() to write a modified block
+ * back. You must have write permission to the original file. Make sure to
+ * read the whole comment to FLAC__metadata_simple_iterator_set_block()
+ * below.
+ * - Use FLAC__metadata_simple_iterator_insert_block_after() to add new blocks.
+ * Use the object creation functions from
+ * \link flac_metadata_object here \endlink to generate new objects.
+ * - Use FLAC__metadata_simple_iterator_delete_block() to remove the block
+ * currently referred to by the iterator, or replace it with padding.
+ * - Destroy the iterator with FLAC__metadata_simple_iterator_delete() when
+ * finished.
+ *
+ * \note
+ * The FLAC file remains open the whole time between
+ * FLAC__metadata_simple_iterator_init() and
+ * FLAC__metadata_simple_iterator_delete(), so make sure you are not altering
+ * the file during this time.
+ *
+ * \note
+ * Do not modify the \a is_last, \a length, or \a type fields of returned
+ * FLAC__StreamMetadata objects. These are managed automatically.
+ *
+ * \note
+ * If any of the modification functions
+ * (FLAC__metadata_simple_iterator_set_block(),
+ * FLAC__metadata_simple_iterator_delete_block(),
+ * FLAC__metadata_simple_iterator_insert_block_after(), etc.) return \c false,
+ * you should delete the iterator as it may no longer be valid.
+ *
+ * \{
+ */
+
+struct FLAC__Metadata_SimpleIterator;
+/** The opaque structure definition for the level 1 iterator type.
+ * See the
+ * \link flac_metadata_level1 metadata level 1 module \endlink
+ * for a detailed description.
+ */
+typedef struct FLAC__Metadata_SimpleIterator FLAC__Metadata_SimpleIterator;
+
+/** Status type for FLAC__Metadata_SimpleIterator.
+ *
+ * The iterator's current status can be obtained by calling FLAC__metadata_simple_iterator_status().
+ */
+typedef enum {
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK = 0,
+ /**< The iterator is in the normal OK state */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT,
+ /**< The data passed into a function violated the function's usage criteria */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE,
+ /**< The iterator could not open the target file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE,
+ /**< The iterator could not find the FLAC signature at the start of the file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE,
+ /**< The iterator tried to write to a file that was not writable */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA,
+ /**< The iterator encountered input that does not conform to the FLAC metadata specification */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR,
+ /**< The iterator encountered an error while reading the FLAC file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR,
+ /**< The iterator encountered an error while seeking in the FLAC file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR,
+ /**< The iterator encountered an error while writing the FLAC file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR,
+ /**< The iterator encountered an error renaming the FLAC file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR,
+ /**< The iterator encountered an error removing the temporary file */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR,
+ /**< Memory allocation failed */
+
+ FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR
+ /**< The caller violated an assertion or an unexpected error occurred */
+
+} FLAC__Metadata_SimpleIteratorStatus;
+
+/** Maps a FLAC__Metadata_SimpleIteratorStatus to a C string.
+ *
+ * Using a FLAC__Metadata_SimpleIteratorStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[];
+
+
+/** Create a new iterator instance.
+ *
+ * \retval FLAC__Metadata_SimpleIterator*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(void);
+
+/** Free an iterator instance. Deletes the object pointed to by \a iterator.
+ *
+ * \param iterator A pointer to an existing iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator);
+
+/** Get the current status of the iterator. Call this after a function
+ * returns \c false to get the reason for the error. Also resets the status
+ * to FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK.
+ *
+ * \param iterator A pointer to an existing iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \retval FLAC__Metadata_SimpleIteratorStatus
+ * The current status of the iterator.
+ */
+FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator);
+
+/** Initialize the iterator to point to the first metadata block in the
+ * given FLAC file.
+ *
+ * \param iterator A pointer to an existing iterator.
+ * \param filename The path to the FLAC file.
+ * \param read_only If \c true, the FLAC file will be opened
+ * in read-only mode; if \c false, the FLAC
+ * file will be opened for edit even if no
+ * edits are performed.
+ * \param preserve_file_stats If \c true, the owner and modification
+ * time will be preserved even if the FLAC
+ * file is written to.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \code filename != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if a memory allocation error occurs, the file can't be
+ * opened, or another error occurs, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats);
+
+/** Returns \c true if the FLAC file is writable. If \c false, calls to
+ * FLAC__metadata_simple_iterator_set_block() and
+ * FLAC__metadata_simple_iterator_insert_block_after() will fail.
+ *
+ * \param iterator A pointer to an existing iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \retval FLAC__bool
+ * See above.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator);
+
+/** Moves the iterator forward one metadata block, returning \c false if
+ * already at the end.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__bool
+ * \c false if already at the last metadata block of the chain, else
+ * \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator);
+
+/** Moves the iterator backward one metadata block, returning \c false if
+ * already at the beginning.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__bool
+ * \c false if already at the first metadata block of the chain, else
+ * \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator);
+
+/** Returns a flag telling if the current metadata block is the last.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__bool
+ * \c true if the current metadata block is the last in the file,
+ * else \c false.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator);
+
+/** Get the offset of the metadata block at the current position. This
+ * avoids reading the actual block data which can save time for large
+ * blocks.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval off_t
+ * The offset of the metadata block at the current iterator position.
+ * This is the byte offset relative to the beginning of the file of
+ * the current metadata block's header.
+ */
+FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator);
+
+/** Get the type of the metadata block at the current position. This
+ * avoids reading the actual block data which can save time for large
+ * blocks.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__MetadataType
+ * The type of the metadata block at the current iterator position.
+ */
+FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator);
+
+/** Get the length of the metadata block at the current position. This
+ * avoids reading the actual block data which can save time for large
+ * blocks.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval unsigned
+ * The length of the metadata block at the current iterator position.
+ * The is same length as that in the
+ * <a href="http://flac.sourceforge.net/format.html#metadata_block_header">metadata block header</a>,
+ * i.e. the length of the metadata body that follows the header.
+ */
+FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator);
+
+/** Get the application ID of the \c APPLICATION block at the current
+ * position. This avoids reading the actual block data which can save
+ * time for large blocks.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param id A pointer to a buffer of at least \c 4 bytes where
+ * the ID will be stored.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \code id != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__bool
+ * \c true if the ID was successfully read, else \c false, in which
+ * case you should check FLAC__metadata_simple_iterator_status() to
+ * find out why. If the status is
+ * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT, then the
+ * current metadata block is not an \c APPLICATION block. Otherwise
+ * if the status is
+ * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR or
+ * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR, an I/O error
+ * occurred and the iterator can no longer be used.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id);
+
+/** Get the metadata block at the current position. You can modify the
+ * block but must use FLAC__metadata_simple_iterator_set_block() to
+ * write it back to the FLAC file.
+ *
+ * You must call FLAC__metadata_object_delete() on the returned object
+ * when you are finished with it.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__StreamMetadata*
+ * The current metadata block, or \c NULL if there was a memory
+ * allocation error.
+ */
+FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator);
+
+/** Write a block back to the FLAC file. This function tries to be
+ * as efficient as possible; how the block is actually written is
+ * shown by the following:
+ *
+ * Existing block is a STREAMINFO block and the new block is a
+ * STREAMINFO block: the new block is written in place. Make sure
+ * you know what you're doing when changing the values of a
+ * STREAMINFO block.
+ *
+ * Existing block is a STREAMINFO block and the new block is a
+ * not a STREAMINFO block: this is an error since the first block
+ * must be a STREAMINFO block. Returns \c false without altering the
+ * file.
+ *
+ * Existing block is not a STREAMINFO block and the new block is a
+ * STREAMINFO block: this is an error since there may be only one
+ * STREAMINFO block. Returns \c false without altering the file.
+ *
+ * Existing block and new block are the same length: the existing
+ * block will be replaced by the new block, written in place.
+ *
+ * Existing block is longer than new block: if use_padding is \c true,
+ * the existing block will be overwritten in place with the new
+ * block followed by a PADDING block, if possible, to make the total
+ * size the same as the existing block. Remember that a padding
+ * block requires at least four bytes so if the difference in size
+ * between the new block and existing block is less than that, the
+ * entire file will have to be rewritten, using the new block's
+ * exact size. If use_padding is \c false, the entire file will be
+ * rewritten, replacing the existing block by the new block.
+ *
+ * Existing block is shorter than new block: if use_padding is \c true,
+ * the function will try and expand the new block into the following
+ * PADDING block, if it exists and doing so won't shrink the PADDING
+ * block to less than 4 bytes. If there is no following PADDING
+ * block, or it will shrink to less than 4 bytes, or use_padding is
+ * \c false, the entire file is rewritten, replacing the existing block
+ * with the new block. Note that in this case any following PADDING
+ * block is preserved as is.
+ *
+ * After writing the block, the iterator will remain in the same
+ * place, i.e. pointing to the new block.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param block The block to set.
+ * \param use_padding See above.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \code block != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding);
+
+/** This is similar to FLAC__metadata_simple_iterator_set_block()
+ * except that instead of writing over an existing block, it appends
+ * a block after the existing block. \a use_padding is again used to
+ * tell the function to try an expand into following padding in an
+ * attempt to avoid rewriting the entire file.
+ *
+ * This function will fail and return \c false if given a STREAMINFO
+ * block.
+ *
+ * After writing the block, the iterator will be pointing to the
+ * new block.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param block The block to set.
+ * \param use_padding See above.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \code block != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding);
+
+/** Deletes the block at the current position. This will cause the
+ * entire FLAC file to be rewritten, unless \a use_padding is \c true,
+ * in which case the block will be replaced by an equal-sized PADDING
+ * block. The iterator will be left pointing to the block before the
+ * one just deleted.
+ *
+ * You may not delete the STREAMINFO block.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param use_padding See above.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_simple_iterator_init()
+ * \retval FLAC__bool
+ * \c true if successful, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding);
+
+/* \} */
+
+
+/** \defgroup flac_metadata_level2 FLAC/metadata.h: metadata level 2 interface
+ * \ingroup flac_metadata
+ *
+ * \brief
+ * The level 2 interface provides read-write access to FLAC file metadata;
+ * all metadata is read into memory, operated on in memory, and then written
+ * to file, which is more efficient than level 1 when editing multiple blocks.
+ *
+ * Currently Ogg FLAC is supported for read only, via
+ * FLAC__metadata_chain_read_ogg() but a subsequent
+ * FLAC__metadata_chain_write() will fail.
+ *
+ * The general usage of this interface is:
+ *
+ * - Create a new chain using FLAC__metadata_chain_new(). A chain is a
+ * linked list of FLAC metadata blocks.
+ * - Read all metadata into the the chain from a FLAC file using
+ * FLAC__metadata_chain_read() or FLAC__metadata_chain_read_ogg() and
+ * check the status.
+ * - Optionally, consolidate the padding using
+ * FLAC__metadata_chain_merge_padding() or
+ * FLAC__metadata_chain_sort_padding().
+ * - Create a new iterator using FLAC__metadata_iterator_new()
+ * - Initialize the iterator to point to the first element in the chain
+ * using FLAC__metadata_iterator_init()
+ * - Traverse the chain using FLAC__metadata_iterator_next and
+ * FLAC__metadata_iterator_prev().
+ * - Get a block for reading or modification using
+ * FLAC__metadata_iterator_get_block(). The pointer to the object
+ * inside the chain is returned, so the block is yours to modify.
+ * Changes will be reflected in the FLAC file when you write the
+ * chain. You can also add and delete blocks (see functions below).
+ * - When done, write out the chain using FLAC__metadata_chain_write().
+ * Make sure to read the whole comment to the function below.
+ * - Delete the chain using FLAC__metadata_chain_delete().
+ *
+ * \note
+ * Even though the FLAC file is not open while the chain is being
+ * manipulated, you must not alter the file externally during
+ * this time. The chain assumes the FLAC file will not change
+ * between the time of FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg()
+ * and FLAC__metadata_chain_write().
+ *
+ * \note
+ * Do not modify the is_last, length, or type fields of returned
+ * FLAC__StreamMetadata objects. These are managed automatically.
+ *
+ * \note
+ * The metadata objects returned by FLAC__metadata_iterator_get_block()
+ * are owned by the chain; do not FLAC__metadata_object_delete() them.
+ * In the same way, blocks passed to FLAC__metadata_iterator_set_block()
+ * become owned by the chain and they will be deleted when the chain is
+ * deleted.
+ *
+ * \{
+ */
+
+struct FLAC__Metadata_Chain;
+/** The opaque structure definition for the level 2 chain type.
+ */
+typedef struct FLAC__Metadata_Chain FLAC__Metadata_Chain;
+
+struct FLAC__Metadata_Iterator;
+/** The opaque structure definition for the level 2 iterator type.
+ */
+typedef struct FLAC__Metadata_Iterator FLAC__Metadata_Iterator;
+
+typedef enum {
+ FLAC__METADATA_CHAIN_STATUS_OK = 0,
+ /**< The chain is in the normal OK state */
+
+ FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT,
+ /**< The data passed into a function violated the function's usage criteria */
+
+ FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE,
+ /**< The chain could not open the target file */
+
+ FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE,
+ /**< The chain could not find the FLAC signature at the start of the file */
+
+ FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE,
+ /**< The chain tried to write to a file that was not writable */
+
+ FLAC__METADATA_CHAIN_STATUS_BAD_METADATA,
+ /**< The chain encountered input that does not conform to the FLAC metadata specification */
+
+ FLAC__METADATA_CHAIN_STATUS_READ_ERROR,
+ /**< The chain encountered an error while reading the FLAC file */
+
+ FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR,
+ /**< The chain encountered an error while seeking in the FLAC file */
+
+ FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR,
+ /**< The chain encountered an error while writing the FLAC file */
+
+ FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR,
+ /**< The chain encountered an error renaming the FLAC file */
+
+ FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR,
+ /**< The chain encountered an error removing the temporary file */
+
+ FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR,
+ /**< Memory allocation failed */
+
+ FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR,
+ /**< The caller violated an assertion or an unexpected error occurred */
+
+ FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS,
+ /**< One or more of the required callbacks was NULL */
+
+ FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH,
+ /**< FLAC__metadata_chain_write() was called on a chain read by
+ * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(),
+ * or
+ * FLAC__metadata_chain_write_with_callbacks()/FLAC__metadata_chain_write_with_callbacks_and_tempfile()
+ * was called on a chain read by
+ * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg().
+ * Matching read/write methods must always be used. */
+
+ FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL
+ /**< FLAC__metadata_chain_write_with_callbacks() was called when the
+ * chain write requires a tempfile; use
+ * FLAC__metadata_chain_write_with_callbacks_and_tempfile() instead.
+ * Or, FLAC__metadata_chain_write_with_callbacks_and_tempfile() was
+ * called when the chain write does not require a tempfile; use
+ * FLAC__metadata_chain_write_with_callbacks() instead.
+ * Always check FLAC__metadata_chain_check_if_tempfile_needed()
+ * before writing via callbacks. */
+
+} FLAC__Metadata_ChainStatus;
+
+/** Maps a FLAC__Metadata_ChainStatus to a C string.
+ *
+ * Using a FLAC__Metadata_ChainStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__Metadata_ChainStatusString[];
+
+/*********** FLAC__Metadata_Chain ***********/
+
+/** Create a new chain instance.
+ *
+ * \retval FLAC__Metadata_Chain*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new(void);
+
+/** Free a chain instance. Deletes the object pointed to by \a chain.
+ *
+ * \param chain A pointer to an existing chain.
+ * \assert
+ * \code chain != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain);
+
+/** Get the current status of the chain. Call this after a function
+ * returns \c false to get the reason for the error. Also resets the
+ * status to FLAC__METADATA_CHAIN_STATUS_OK.
+ *
+ * \param chain A pointer to an existing chain.
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__Metadata_ChainStatus
+ * The current status of the chain.
+ */
+FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain);
+
+/** Read all metadata from a FLAC file into the chain.
+ *
+ * \param chain A pointer to an existing chain.
+ * \param filename The path to the FLAC file to read.
+ * \assert
+ * \code chain != NULL \endcode
+ * \code filename != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid list of metadata blocks was read from
+ * \a filename, else \c false. On failure, check the status with
+ * FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename);
+
+/** Read all metadata from an Ogg FLAC file into the chain.
+ *
+ * \note Ogg FLAC metadata data writing is not supported yet and
+ * FLAC__metadata_chain_write() will fail.
+ *
+ * \param chain A pointer to an existing chain.
+ * \param filename The path to the Ogg FLAC file to read.
+ * \assert
+ * \code chain != NULL \endcode
+ * \code filename != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid list of metadata blocks was read from
+ * \a filename, else \c false. On failure, check the status with
+ * FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg(FLAC__Metadata_Chain *chain, const char *filename);
+
+/** Read all metadata from a FLAC stream into the chain via I/O callbacks.
+ *
+ * The \a handle need only be open for reading, but must be seekable.
+ * The equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb"
+ * for Windows).
+ *
+ * \param chain A pointer to an existing chain.
+ * \param handle The I/O handle of the FLAC stream to read. The
+ * handle will NOT be closed after the metadata is read;
+ * that is the duty of the caller.
+ * \param callbacks
+ * A set of callbacks to use for I/O. The mandatory
+ * callbacks are \a read, \a seek, and \a tell.
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid list of metadata blocks was read from
+ * \a handle, else \c false. On failure, check the status with
+ * FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
+
+/** Read all metadata from an Ogg FLAC stream into the chain via I/O callbacks.
+ *
+ * The \a handle need only be open for reading, but must be seekable.
+ * The equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb"
+ * for Windows).
+ *
+ * \note Ogg FLAC metadata data writing is not supported yet and
+ * FLAC__metadata_chain_write() will fail.
+ *
+ * \param chain A pointer to an existing chain.
+ * \param handle The I/O handle of the Ogg FLAC stream to read. The
+ * handle will NOT be closed after the metadata is read;
+ * that is the duty of the caller.
+ * \param callbacks
+ * A set of callbacks to use for I/O. The mandatory
+ * callbacks are \a read, \a seek, and \a tell.
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid list of metadata blocks was read from
+ * \a handle, else \c false. On failure, check the status with
+ * FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
+
+/** Checks if writing the given chain would require the use of a
+ * temporary file, or if it could be written in place.
+ *
+ * Under certain conditions, padding can be utilized so that writing
+ * edited metadata back to the FLAC file does not require rewriting the
+ * entire file. If rewriting is required, then a temporary workfile is
+ * required. When writing metadata using callbacks, you must check
+ * this function to know whether to call
+ * FLAC__metadata_chain_write_with_callbacks() or
+ * FLAC__metadata_chain_write_with_callbacks_and_tempfile(). When
+ * writing with FLAC__metadata_chain_write(), the temporary file is
+ * handled internally.
+ *
+ * \param chain A pointer to an existing chain.
+ * \param use_padding
+ * Whether or not padding will be allowed to be used
+ * during the write. The value of \a use_padding given
+ * here must match the value later passed to
+ * FLAC__metadata_chain_write_with_callbacks() or
+ * FLAC__metadata_chain_write_with_callbacks_with_tempfile().
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if writing the current chain would require a tempfile, or
+ * \c false if metadata can be written in place.
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata_Chain *chain, FLAC__bool use_padding);
+
+/** Write all metadata out to the FLAC file. This function tries to be as
+ * efficient as possible; how the metadata is actually written is shown by
+ * the following:
+ *
+ * If the current chain is the same size as the existing metadata, the new
+ * data is written in place.
+ *
+ * If the current chain is longer than the existing metadata, and
+ * \a use_padding is \c true, and the last block is a PADDING block of
+ * sufficient length, the function will truncate the final padding block
+ * so that the overall size of the metadata is the same as the existing
+ * metadata, and then just rewrite the metadata. Otherwise, if not all of
+ * the above conditions are met, the entire FLAC file must be rewritten.
+ * If you want to use padding this way it is a good idea to call
+ * FLAC__metadata_chain_sort_padding() first so that you have the maximum
+ * amount of padding to work with, unless you need to preserve ordering
+ * of the PADDING blocks for some reason.
+ *
+ * If the current chain is shorter than the existing metadata, and
+ * \a use_padding is \c true, and the final block is a PADDING block, the padding
+ * is extended to make the overall size the same as the existing data. If
+ * \a use_padding is \c true and the last block is not a PADDING block, a new
+ * PADDING block is added to the end of the new data to make it the same
+ * size as the existing data (if possible, see the note to
+ * FLAC__metadata_simple_iterator_set_block() about the four byte limit)
+ * and the new data is written in place. If none of the above apply or
+ * \a use_padding is \c false, the entire FLAC file is rewritten.
+ *
+ * If \a preserve_file_stats is \c true, the owner and modification time will
+ * be preserved even if the FLAC file is written.
+ *
+ * For this write function to be used, the chain must have been read with
+ * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(), not
+ * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks().
+ *
+ * \param chain A pointer to an existing chain.
+ * \param use_padding See above.
+ * \param preserve_file_stats See above.
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if the write succeeded, else \c false. On failure,
+ * check the status with FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats);
+
+/** Write all metadata out to a FLAC stream via callbacks.
+ *
+ * (See FLAC__metadata_chain_write() for the details on how padding is
+ * used to write metadata in place if possible.)
+ *
+ * The \a handle must be open for updating and be seekable. The
+ * equivalent minimum stdio fopen() file mode is \c "r+" (or \c "r+b"
+ * for Windows).
+ *
+ * For this write function to be used, the chain must have been read with
+ * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(),
+ * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg().
+ * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned
+ * \c false.
+ *
+ * \param chain A pointer to an existing chain.
+ * \param use_padding See FLAC__metadata_chain_write()
+ * \param handle The I/O handle of the FLAC stream to write. The
+ * handle will NOT be closed after the metadata is
+ * written; that is the duty of the caller.
+ * \param callbacks A set of callbacks to use for I/O. The mandatory
+ * callbacks are \a write and \a seek.
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if the write succeeded, else \c false. On failure,
+ * check the status with FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
+
+/** Write all metadata out to a FLAC stream via callbacks.
+ *
+ * (See FLAC__metadata_chain_write() for the details on how padding is
+ * used to write metadata in place if possible.)
+ *
+ * This version of the write-with-callbacks function must be used when
+ * FLAC__metadata_chain_check_if_tempfile_needed() returns true. In
+ * this function, you must supply an I/O handle corresponding to the
+ * FLAC file to edit, and a temporary handle to which the new FLAC
+ * file will be written. It is the caller's job to move this temporary
+ * FLAC file on top of the original FLAC file to complete the metadata
+ * edit.
+ *
+ * The \a handle must be open for reading and be seekable. The
+ * equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb"
+ * for Windows).
+ *
+ * The \a temp_handle must be open for writing. The
+ * equivalent minimum stdio fopen() file mode is \c "w" (or \c "wb"
+ * for Windows). It should be an empty stream, or at least positioned
+ * at the start-of-file (in which case it is the caller's duty to
+ * truncate it on return).
+ *
+ * For this write function to be used, the chain must have been read with
+ * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(),
+ * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg().
+ * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned
+ * \c true.
+ *
+ * \param chain A pointer to an existing chain.
+ * \param use_padding See FLAC__metadata_chain_write()
+ * \param handle The I/O handle of the original FLAC stream to read.
+ * The handle will NOT be closed after the metadata is
+ * written; that is the duty of the caller.
+ * \param callbacks A set of callbacks to use for I/O on \a handle.
+ * The mandatory callbacks are \a read, \a seek, and
+ * \a eof.
+ * \param temp_handle The I/O handle of the FLAC stream to write. The
+ * handle will NOT be closed after the metadata is
+ * written; that is the duty of the caller.
+ * \param temp_callbacks
+ * A set of callbacks to use for I/O on temp_handle.
+ * The only mandatory callback is \a write.
+ * \assert
+ * \code chain != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if the write succeeded, else \c false. On failure,
+ * check the status with FLAC__metadata_chain_status().
+ */
+FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks);
+
+/** Merge adjacent PADDING blocks into a single block.
+ *
+ * \note This function does not write to the FLAC file, it only
+ * modifies the chain.
+ *
+ * \warning Any iterator on the current chain will become invalid after this
+ * call. You should delete the iterator and get a new one.
+ *
+ * \param chain A pointer to an existing chain.
+ * \assert
+ * \code chain != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain);
+
+/** This function will move all PADDING blocks to the end on the metadata,
+ * then merge them into a single block.
+ *
+ * \note This function does not write to the FLAC file, it only
+ * modifies the chain.
+ *
+ * \warning Any iterator on the current chain will become invalid after this
+ * call. You should delete the iterator and get a new one.
+ *
+ * \param chain A pointer to an existing chain.
+ * \assert
+ * \code chain != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain);
+
+
+/*********** FLAC__Metadata_Iterator ***********/
+
+/** Create a new iterator instance.
+ *
+ * \retval FLAC__Metadata_Iterator*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(void);
+
+/** Free an iterator instance. Deletes the object pointed to by \a iterator.
+ *
+ * \param iterator A pointer to an existing iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator);
+
+/** Initialize the iterator to point to the first metadata block in the
+ * given chain.
+ *
+ * \param iterator A pointer to an existing iterator.
+ * \param chain A pointer to an existing and initialized (read) chain.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \code chain != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain);
+
+/** Moves the iterator forward one metadata block, returning \c false if
+ * already at the end.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__bool
+ * \c false if already at the last metadata block of the chain, else
+ * \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator);
+
+/** Moves the iterator backward one metadata block, returning \c false if
+ * already at the beginning.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__bool
+ * \c false if already at the first metadata block of the chain, else
+ * \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator);
+
+/** Get the type of the metadata block at the current position.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__MetadataType
+ * The type of the metadata block at the current iterator position.
+ */
+FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator);
+
+/** Get the metadata block at the current position. You can modify
+ * the block in place but must write the chain before the changes
+ * are reflected to the FLAC file. You do not need to call
+ * FLAC__metadata_iterator_set_block() to reflect the changes;
+ * the pointer returned by FLAC__metadata_iterator_get_block()
+ * points directly into the chain.
+ *
+ * \warning
+ * Do not call FLAC__metadata_object_delete() on the returned object;
+ * to delete a block use FLAC__metadata_iterator_delete_block().
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__StreamMetadata*
+ * The current metadata block.
+ */
+FLAC_API FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator);
+
+/** Set the metadata block at the current position, replacing the existing
+ * block. The new block passed in becomes owned by the chain and it will be
+ * deleted when the chain is deleted.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param block A pointer to a metadata block.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \code block != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the conditions in the above description are not met, or
+ * a memory allocation error occurs, otherwise \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
+
+/** Removes the current block from the chain. If \a replace_with_padding is
+ * \c true, the block will instead be replaced with a padding block of equal
+ * size. You can not delete the STREAMINFO block. The iterator will be
+ * left pointing to the block before the one just "deleted", even if
+ * \a replace_with_padding is \c true.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param replace_with_padding See above.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__bool
+ * \c false if the conditions in the above description are not met,
+ * otherwise \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding);
+
+/** Insert a new block before the current block. You cannot insert a block
+ * before the first STREAMINFO block. You cannot insert a STREAMINFO block
+ * as there can be only one, the one that already exists at the head when you
+ * read in a chain. The chain takes ownership of the new block and it will be
+ * deleted when the chain is deleted. The iterator will be left pointing to
+ * the new block.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param block A pointer to a metadata block to insert.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__bool
+ * \c false if the conditions in the above description are not met, or
+ * a memory allocation error occurs, otherwise \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
+
+/** Insert a new block after the current block. You cannot insert a STREAMINFO
+ * block as there can be only one, the one that already exists at the head when
+ * you read in a chain. The chain takes ownership of the new block and it will
+ * be deleted when the chain is deleted. The iterator will be left pointing to
+ * the new block.
+ *
+ * \param iterator A pointer to an existing initialized iterator.
+ * \param block A pointer to a metadata block to insert.
+ * \assert
+ * \code iterator != NULL \endcode
+ * \a iterator has been successfully initialized with
+ * FLAC__metadata_iterator_init()
+ * \retval FLAC__bool
+ * \c false if the conditions in the above description are not met, or
+ * a memory allocation error occurs, otherwise \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);
+
+/* \} */
+
+
+/** \defgroup flac_metadata_object FLAC/metadata.h: metadata object methods
+ * \ingroup flac_metadata
+ *
+ * \brief
+ * This module contains methods for manipulating FLAC metadata objects.
+ *
+ * Since many are variable length we have to be careful about the memory
+ * management. We decree that all pointers to data in the object are
+ * owned by the object and memory-managed by the object.
+ *
+ * Use the FLAC__metadata_object_new() and FLAC__metadata_object_delete()
+ * functions to create all instances. When using the
+ * FLAC__metadata_object_set_*() functions to set pointers to data, set
+ * \a copy to \c true to have the function make it's own copy of the data, or
+ * to \c false to give the object ownership of your data. In the latter case
+ * your pointer must be freeable by free() and will be free()d when the object
+ * is FLAC__metadata_object_delete()d. It is legal to pass a null pointer as
+ * the data pointer to a FLAC__metadata_object_set_*() function as long as
+ * the length argument is 0 and the \a copy argument is \c false.
+ *
+ * The FLAC__metadata_object_new() and FLAC__metadata_object_clone() function
+ * will return \c NULL in the case of a memory allocation error, otherwise a new
+ * object. The FLAC__metadata_object_set_*() functions return \c false in the
+ * case of a memory allocation error.
+ *
+ * We don't have the convenience of C++ here, so note that the library relies
+ * on you to keep the types straight. In other words, if you pass, for
+ * example, a FLAC__StreamMetadata* that represents a STREAMINFO block to
+ * FLAC__metadata_object_application_set_data(), you will get an assertion
+ * failure.
+ *
+ * For convenience the FLAC__metadata_object_vorbiscomment_*() functions
+ * maintain a trailing NUL on each Vorbis comment entry. This is not counted
+ * toward the length or stored in the stream, but it can make working with plain
+ * comments (those that don't contain embedded-NULs in the value) easier.
+ * Entries passed into these functions have trailing NULs added if missing, and
+ * returned entries are guaranteed to have a trailing NUL.
+ *
+ * The FLAC__metadata_object_vorbiscomment_*() functions that take a Vorbis
+ * comment entry/name/value will first validate that it complies with the Vorbis
+ * comment specification and return false if it does not.
+ *
+ * There is no need to recalculate the length field on metadata blocks you
+ * have modified. They will be calculated automatically before they are
+ * written back to a file.
+ *
+ * \{
+ */
+
+
+/** Create a new metadata object instance of the given type.
+ *
+ * The object will be "empty"; i.e. values and data pointers will be \c 0,
+ * with the exception of FLAC__METADATA_TYPE_VORBIS_COMMENT, which will have
+ * the vendor string set (but zero comments).
+ *
+ * Do not pass in a value greater than or equal to
+ * \a FLAC__METADATA_TYPE_UNDEFINED unless you really know what you're
+ * doing.
+ *
+ * \param type Type of object to create
+ * \retval FLAC__StreamMetadata*
+ * \c NULL if there was an error allocating memory or the type code is
+ * greater than FLAC__MAX_METADATA_TYPE_CODE, else the new instance.
+ */
+FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type);
+
+/** Create a copy of an existing metadata object.
+ *
+ * The copy is a "deep" copy, i.e. dynamically allocated data within the
+ * object is also copied. The caller takes ownership of the new block and
+ * is responsible for freeing it with FLAC__metadata_object_delete().
+ *
+ * \param object Pointer to object to copy.
+ * \assert
+ * \code object != NULL \endcode
+ * \retval FLAC__StreamMetadata*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object);
+
+/** Free a metadata object. Deletes the object pointed to by \a object.
+ *
+ * The delete is a "deep" delete, i.e. dynamically allocated data within the
+ * object is also deleted.
+ *
+ * \param object A pointer to an existing object.
+ * \assert
+ * \code object != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object);
+
+/** Compares two metadata objects.
+ *
+ * The compare is "deep", i.e. dynamically allocated data within the
+ * object is also compared.
+ *
+ * \param block1 A pointer to an existing object.
+ * \param block2 A pointer to an existing object.
+ * \assert
+ * \code block1 != NULL \endcode
+ * \code block2 != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if objects are identical, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2);
+
+/** Sets the application data of an APPLICATION block.
+ *
+ * If \a copy is \c true, a copy of the data is stored; otherwise, the object
+ * takes ownership of the pointer. The existing data will be freed if this
+ * function is successful, otherwise the original data will remain if \a copy
+ * is \c true and malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a data if \a copy is \c true.
+ *
+ * \param object A pointer to an existing APPLICATION object.
+ * \param data A pointer to the data to set.
+ * \param length The length of \a data in bytes.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_APPLICATION \endcode
+ * \code (data != NULL && length > 0) ||
+ * (data == NULL && length == 0 && copy == false) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy);
+
+/** Resize the seekpoint array.
+ *
+ * If the size shrinks, elements will truncated; if it grows, new placeholder
+ * points will be added to the end.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param new_num_points The desired length of the array; may be \c 0.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \code (object->data.seek_table.points == NULL && object->data.seek_table.num_points == 0) ||
+ * (object->data.seek_table.points != NULL && object->data.seek_table.num_points > 0) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation error, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points);
+
+/** Set a seekpoint in a seektable.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param point_num Index into seekpoint array to set.
+ * \param point The point to set.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \code object->data.seek_table.num_points > point_num \endcode
+ */
+FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
+
+/** Insert a seekpoint into a seektable.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param point_num Index into seekpoint array to set.
+ * \param point The point to set.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \code object->data.seek_table.num_points >= point_num \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation error, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
+
+/** Delete a seekpoint from a seektable.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param point_num Index into seekpoint array to set.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \code object->data.seek_table.num_points > point_num \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation error, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num);
+
+/** Check a seektable to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * seektable.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \retval FLAC__bool
+ * \c false if seek table is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object);
+
+/** Append a number of placeholder points to the end of a seek table.
+ *
+ * \note
+ * As with the other ..._seektable_template_... functions, you should
+ * call FLAC__metadata_object_seektable_template_sort() when finished
+ * to make the seek table legal.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param num The number of placeholder points to append.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num);
+
+/** Append a specific seek point template to the end of a seek table.
+ *
+ * \note
+ * As with the other ..._seektable_template_... functions, you should
+ * call FLAC__metadata_object_seektable_template_sort() when finished
+ * to make the seek table legal.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param sample_number The sample number of the seek point template.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__StreamMetadata *object, FLAC__uint64 sample_number);
+
+/** Append specific seek point templates to the end of a seek table.
+ *
+ * \note
+ * As with the other ..._seektable_template_... functions, you should
+ * call FLAC__metadata_object_seektable_template_sort() when finished
+ * to make the seek table legal.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param sample_numbers An array of sample numbers for the seek points.
+ * \param num The number of seek point templates to append.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num);
+
+/** Append a set of evenly-spaced seek point templates to the end of a
+ * seek table.
+ *
+ * \note
+ * As with the other ..._seektable_template_... functions, you should
+ * call FLAC__metadata_object_seektable_template_sort() when finished
+ * to make the seek table legal.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param num The number of placeholder points to append.
+ * \param total_samples The total number of samples to be encoded;
+ * the seekpoints will be spaced approximately
+ * \a total_samples / \a num samples apart.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \code total_samples > 0 \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples);
+
+/** Append a set of evenly-spaced seek point templates to the end of a
+ * seek table.
+ *
+ * \note
+ * As with the other ..._seektable_template_... functions, you should
+ * call FLAC__metadata_object_seektable_template_sort() when finished
+ * to make the seek table legal.
+ *
+ * \param object A pointer to an existing SEEKTABLE object.
+ * \param samples The number of samples apart to space the placeholder
+ * points. The first point will be at sample \c 0, the
+ * second at sample \a samples, then 2*\a samples, and
+ * so on. As long as \a samples and \a total_samples
+ * are greater than \c 0, there will always be at least
+ * one seekpoint at sample \c 0.
+ * \param total_samples The total number of samples to be encoded;
+ * the seekpoints will be spaced
+ * \a samples samples apart.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \code samples > 0 \endcode
+ * \code total_samples > 0 \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples);
+
+/** Sort a seek table's seek points according to the format specification,
+ * removing duplicates.
+ *
+ * \param object A pointer to a seek table to be sorted.
+ * \param compact If \c false, behaves like FLAC__format_seektable_sort().
+ * If \c true, duplicates are deleted and the seek table is
+ * shrunk appropriately; the number of placeholder points
+ * present in the seek table will be the same after the call
+ * as before.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
+ * \retval FLAC__bool
+ * \c false if realloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact);
+
+/** Sets the vendor string in a VORBIS_COMMENT block.
+ *
+ * For convenience, a trailing NUL is added to the entry if it doesn't have
+ * one already.
+ *
+ * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
+ * takes ownership of the \c entry.entry pointer.
+ *
+ * \note If this function returns \c false, the caller still owns the
+ * pointer.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param entry The entry to set the vendor string to.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code (entry.entry != NULL && entry.length > 0) ||
+ * (entry.entry == NULL && entry.length == 0) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails or \a entry does not comply with the
+ * Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
+
+/** Resize the comment array.
+ *
+ * If the size shrinks, elements will truncated; if it grows, new empty
+ * fields will be added to the end.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param new_num_comments The desired length of the array; may be \c 0.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code (object->data.vorbis_comment.comments == NULL && object->data.vorbis_comment.num_comments == 0) ||
+ * (object->data.vorbis_comment.comments != NULL && object->data.vorbis_comment.num_comments > 0) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments);
+
+/** Sets a comment in a VORBIS_COMMENT block.
+ *
+ * For convenience, a trailing NUL is added to the entry if it doesn't have
+ * one already.
+ *
+ * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
+ * takes ownership of the \c entry.entry pointer.
+ *
+ * \note If this function returns \c false, the caller still owns the
+ * pointer.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param comment_num Index into comment array to set.
+ * \param entry The entry to set the comment to.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code comment_num < object->data.vorbis_comment.num_comments \endcode
+ * \code (entry.entry != NULL && entry.length > 0) ||
+ * (entry.entry == NULL && entry.length == 0) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails or \a entry does not comply with the
+ * Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
+
+/** Insert a comment in a VORBIS_COMMENT block at the given index.
+ *
+ * For convenience, a trailing NUL is added to the entry if it doesn't have
+ * one already.
+ *
+ * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
+ * takes ownership of the \c entry.entry pointer.
+ *
+ * \note If this function returns \c false, the caller still owns the
+ * pointer.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param comment_num The index at which to insert the comment. The comments
+ * at and after \a comment_num move right one position.
+ * To append a comment to the end, set \a comment_num to
+ * \c object->data.vorbis_comment.num_comments .
+ * \param entry The comment to insert.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code object->data.vorbis_comment.num_comments >= comment_num \endcode
+ * \code (entry.entry != NULL && entry.length > 0) ||
+ * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails or \a entry does not comply with the
+ * Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
+
+/** Appends a comment to a VORBIS_COMMENT block.
+ *
+ * For convenience, a trailing NUL is added to the entry if it doesn't have
+ * one already.
+ *
+ * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
+ * takes ownership of the \c entry.entry pointer.
+ *
+ * \note If this function returns \c false, the caller still owns the
+ * pointer.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param entry The comment to insert.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code (entry.entry != NULL && entry.length > 0) ||
+ * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails or \a entry does not comply with the
+ * Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
+
+/** Replaces comments in a VORBIS_COMMENT block with a new one.
+ *
+ * For convenience, a trailing NUL is added to the entry if it doesn't have
+ * one already.
+ *
+ * Depending on the the value of \a all, either all or just the first comment
+ * whose field name(s) match the given entry's name will be replaced by the
+ * given entry. If no comments match, \a entry will simply be appended.
+ *
+ * If \a copy is \c true, a copy of the entry is stored; otherwise, the object
+ * takes ownership of the \c entry.entry pointer.
+ *
+ * \note If this function returns \c false, the caller still owns the
+ * pointer.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param entry The comment to insert.
+ * \param all If \c true, all comments whose field name matches
+ * \a entry's field name will be removed, and \a entry will
+ * be inserted at the position of the first matching
+ * comment. If \c false, only the first comment whose
+ * field name matches \a entry's field name will be
+ * replaced with \a entry.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code (entry.entry != NULL && entry.length > 0) ||
+ * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails or \a entry does not comply with the
+ * Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy);
+
+/** Delete a comment in a VORBIS_COMMENT block at the given index.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param comment_num The index of the comment to delete.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code object->data.vorbis_comment.num_comments > comment_num \endcode
+ * \retval FLAC__bool
+ * \c false if realloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num);
+
+/** Creates a Vorbis comment entry from NUL-terminated name and value strings.
+ *
+ * On return, the filled-in \a entry->entry pointer will point to malloc()ed
+ * memory and shall be owned by the caller. For convenience the entry will
+ * have a terminating NUL.
+ *
+ * \param entry A pointer to a Vorbis comment entry. The entry's
+ * \c entry pointer should not point to allocated
+ * memory as it will be overwritten.
+ * \param field_name The field name in ASCII, \c NUL terminated.
+ * \param field_value The field value in UTF-8, \c NUL terminated.
+ * \assert
+ * \code entry != NULL \endcode
+ * \code field_name != NULL \endcode
+ * \code field_value != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if malloc() fails, or if \a field_name or \a field_value does
+ * not comply with the Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value);
+
+/** Splits a Vorbis comment entry into NUL-terminated name and value strings.
+ *
+ * The returned pointers to name and value will be allocated by malloc()
+ * and shall be owned by the caller.
+ *
+ * \param entry An existing Vorbis comment entry.
+ * \param field_name The address of where the returned pointer to the
+ * field name will be stored.
+ * \param field_value The address of where the returned pointer to the
+ * field value will be stored.
+ * \assert
+ * \code (entry.entry != NULL && entry.length > 0) \endcode
+ * \code memchr(entry.entry, '=', entry.length) != NULL \endcode
+ * \code field_name != NULL \endcode
+ * \code field_value != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation fails or \a entry does not comply with the
+ * Vorbis comment specification, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value);
+
+/** Check if the given Vorbis comment entry's field name matches the given
+ * field name.
+ *
+ * \param entry An existing Vorbis comment entry.
+ * \param field_name The field name to check.
+ * \param field_name_length The length of \a field_name, not including the
+ * terminating \c NUL.
+ * \assert
+ * \code (entry.entry != NULL && entry.length > 0) \endcode
+ * \retval FLAC__bool
+ * \c true if the field names match, else \c false
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length);
+
+/** Find a Vorbis comment with the given field name.
+ *
+ * The search begins at entry number \a offset; use an offset of 0 to
+ * search from the beginning of the comment array.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param offset The offset into the comment array from where to start
+ * the search.
+ * \param field_name The field name of the comment to find.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \code field_name != NULL \endcode
+ * \retval int
+ * The offset in the comment array of the first comment whose field
+ * name matches \a field_name, or \c -1 if no match was found.
+ */
+FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name);
+
+/** Remove first Vorbis comment matching the given field name.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param field_name The field name of comment to delete.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \retval int
+ * \c -1 for memory allocation error, \c 0 for no matching entries,
+ * \c 1 for one matching entry deleted.
+ */
+FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name);
+
+/** Remove all Vorbis comments matching the given field name.
+ *
+ * \param object A pointer to an existing VORBIS_COMMENT object.
+ * \param field_name The field name of comments to delete.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode
+ * \retval int
+ * \c -1 for memory allocation error, \c 0 for no matching entries,
+ * else the number of matching entries deleted.
+ */
+FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name);
+
+/** Create a new CUESHEET track instance.
+ *
+ * The object will be "empty"; i.e. values and data pointers will be \c 0.
+ *
+ * \retval FLAC__StreamMetadata_CueSheet_Track*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new(void);
+
+/** Create a copy of an existing CUESHEET track object.
+ *
+ * The copy is a "deep" copy, i.e. dynamically allocated data within the
+ * object is also copied. The caller takes ownership of the new object and
+ * is responsible for freeing it with
+ * FLAC__metadata_object_cuesheet_track_delete().
+ *
+ * \param object Pointer to object to copy.
+ * \assert
+ * \code object != NULL \endcode
+ * \retval FLAC__StreamMetadata_CueSheet_Track*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object);
+
+/** Delete a CUESHEET track object
+ *
+ * \param object A pointer to an existing CUESHEET track object.
+ * \assert
+ * \code object != NULL \endcode
+ */
+FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_CueSheet_Track *object);
+
+/** Resize a track's index point array.
+ *
+ * If the size shrinks, elements will truncated; if it grows, new blank
+ * indices will be added to the end.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index of the track to modify. NOTE: this is not
+ * necessarily the same as the track's \a number field.
+ * \param new_num_indices The desired length of the array; may be \c 0.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks > track_num \endcode
+ * \code (object->data.cue_sheet.tracks[track_num].indices == NULL && object->data.cue_sheet.tracks[track_num].num_indices == 0) ||
+ * (object->data.cue_sheet.tracks[track_num].indices != NULL && object->data.cue_sheet.tracks[track_num].num_indices > 0) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation error, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices);
+
+/** Insert an index point in a CUESHEET track at the given index.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index of the track to modify. NOTE: this is not
+ * necessarily the same as the track's \a number field.
+ * \param index_num The index into the track's index array at which to
+ * insert the index point. NOTE: this is not necessarily
+ * the same as the index point's \a number field. The
+ * indices at and after \a index_num move right one
+ * position. To append an index point to the end, set
+ * \a index_num to
+ * \c object->data.cue_sheet.tracks[track_num].num_indices .
+ * \param index The index point to insert.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks > track_num \endcode
+ * \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode
+ * \retval FLAC__bool
+ * \c false if realloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index);
+
+/** Insert a blank index point in a CUESHEET track at the given index.
+ *
+ * A blank index point is one in which all field values are zero.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index of the track to modify. NOTE: this is not
+ * necessarily the same as the track's \a number field.
+ * \param index_num The index into the track's index array at which to
+ * insert the index point. NOTE: this is not necessarily
+ * the same as the index point's \a number field. The
+ * indices at and after \a index_num move right one
+ * position. To append an index point to the end, set
+ * \a index_num to
+ * \c object->data.cue_sheet.tracks[track_num].num_indices .
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks > track_num \endcode
+ * \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode
+ * \retval FLAC__bool
+ * \c false if realloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num);
+
+/** Delete an index point in a CUESHEET track at the given index.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index into the track array of the track to
+ * modify. NOTE: this is not necessarily the same
+ * as the track's \a number field.
+ * \param index_num The index into the track's index array of the index
+ * to delete. NOTE: this is not necessarily the same
+ * as the index's \a number field.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks > track_num \endcode
+ * \code object->data.cue_sheet.tracks[track_num].num_indices > index_num \endcode
+ * \retval FLAC__bool
+ * \c false if realloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num);
+
+/** Resize the track array.
+ *
+ * If the size shrinks, elements will truncated; if it grows, new blank
+ * tracks will be added to the end.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param new_num_tracks The desired length of the array; may be \c 0.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code (object->data.cue_sheet.tracks == NULL && object->data.cue_sheet.num_tracks == 0) ||
+ * (object->data.cue_sheet.tracks != NULL && object->data.cue_sheet.num_tracks > 0) \endcode
+ * \retval FLAC__bool
+ * \c false if memory allocation error, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks);
+
+/** Sets a track in a CUESHEET block.
+ *
+ * If \a copy is \c true, a copy of the track is stored; otherwise, the object
+ * takes ownership of the \a track pointer.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num Index into track array to set. NOTE: this is not
+ * necessarily the same as the track's \a number field.
+ * \param track The track to set the track to. You may safely pass in
+ * a const pointer if \a copy is \c true.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code track_num < object->data.cue_sheet.num_tracks \endcode
+ * \code (track->indices != NULL && track->num_indices > 0) ||
+ * (track->indices == NULL && track->num_indices == 0)
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
+
+/** Insert a track in a CUESHEET block at the given index.
+ *
+ * If \a copy is \c true, a copy of the track is stored; otherwise, the object
+ * takes ownership of the \a track pointer.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index at which to insert the track. NOTE: this
+ * is not necessarily the same as the track's \a number
+ * field. The tracks at and after \a track_num move right
+ * one position. To append a track to the end, set
+ * \a track_num to \c object->data.cue_sheet.num_tracks .
+ * \param track The track to insert. You may safely pass in a const
+ * pointer if \a copy is \c true.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks >= track_num \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
+
+/** Insert a blank track in a CUESHEET block at the given index.
+ *
+ * A blank track is one in which all field values are zero.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index at which to insert the track. NOTE: this
+ * is not necessarily the same as the track's \a number
+ * field. The tracks at and after \a track_num move right
+ * one position. To append a track to the end, set
+ * \a track_num to \c object->data.cue_sheet.num_tracks .
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks >= track_num \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num);
+
+/** Delete a track in a CUESHEET block at the given index.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param track_num The index into the track array of the track to
+ * delete. NOTE: this is not necessarily the same
+ * as the track's \a number field.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \code object->data.cue_sheet.num_tracks > track_num \endcode
+ * \retval FLAC__bool
+ * \c false if realloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num);
+
+/** Check a cue sheet to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * cue sheet.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \param check_cd_da_subset If \c true, check CUESHEET against more
+ * stringent requirements for a CD-DA (audio) disc.
+ * \param violation Address of a pointer to a string. If there is a
+ * violation, a pointer to a string explanation of the
+ * violation will be returned here. \a violation may be
+ * \c NULL if you don't need the returned string. Do not
+ * free the returned string; it will always point to static
+ * data.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \retval FLAC__bool
+ * \c false if cue sheet is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation);
+
+/** Calculate and return the CDDB/freedb ID for a cue sheet. The function
+ * assumes the cue sheet corresponds to a CD; the result is undefined
+ * if the cuesheet's is_cd bit is not set.
+ *
+ * \param object A pointer to an existing CUESHEET object.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode
+ * \retval FLAC__uint32
+ * The unsigned integer representation of the CDDB/freedb ID
+ */
+FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLAC__StreamMetadata *object);
+
+/** Sets the MIME type of a PICTURE block.
+ *
+ * If \a copy is \c true, a copy of the string is stored; otherwise, the object
+ * takes ownership of the pointer. The existing string will be freed if this
+ * function is successful, otherwise the original string will remain if \a copy
+ * is \c true and malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a mime_type if \a copy is \c true.
+ *
+ * \param object A pointer to an existing PICTURE object.
+ * \param mime_type A pointer to the MIME type string. The string must be
+ * ASCII characters 0x20-0x7e, NUL-terminated. No validation
+ * is done.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \code (mime_type != NULL) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type(FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy);
+
+/** Sets the description of a PICTURE block.
+ *
+ * If \a copy is \c true, a copy of the string is stored; otherwise, the object
+ * takes ownership of the pointer. The existing string will be freed if this
+ * function is successful, otherwise the original string will remain if \a copy
+ * is \c true and malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a description if \a copy is \c true.
+ *
+ * \param object A pointer to an existing PICTURE object.
+ * \param description A pointer to the description string. The string must be
+ * valid UTF-8, NUL-terminated. No validation is done.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \code (description != NULL) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description(FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy);
+
+/** Sets the picture data of a PICTURE block.
+ *
+ * If \a copy is \c true, a copy of the data is stored; otherwise, the object
+ * takes ownership of the pointer. Also sets the \a data_length field of the
+ * metadata object to what is passed in as the \a length parameter. The
+ * existing data will be freed if this function is successful, otherwise the
+ * original data and data_length will remain if \a copy is \c true and
+ * malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a data if \a copy is \c true.
+ *
+ * \param object A pointer to an existing PICTURE object.
+ * \param data A pointer to the data to set.
+ * \param length The length of \a data in bytes.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \code (data != NULL && length > 0) ||
+ * (data == NULL && length == 0 && copy == false) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy);
+
+/** Check a PICTURE block to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * PICTURE block.
+ *
+ * \param object A pointer to existing PICTURE block to be checked.
+ * \param violation Address of a pointer to a string. If there is a
+ * violation, a pointer to a string explanation of the
+ * violation will be returned here. \a violation may be
+ * \c NULL if you don't need the returned string. Do not
+ * free the returned string; it will always point to static
+ * data.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \retval FLAC__bool
+ * \c false if PICTURE block is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation);
+
+/* \} */
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_decoder.h b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_decoder.h
index 9e774c24d..9bbca4d7a 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_decoder.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_decoder.h
@@ -41,1525 +41,1516 @@ extern "C" {
#endif
- /** \file include/FLAC/stream_decoder.h
- *
- * \brief
- * This module contains the functions which implement the stream
- * decoder.
- *
- * See the detailed documentation in the
- * \link flac_stream_decoder stream decoder \endlink module.
- */
-
- /** \defgroup flac_decoder FLAC/ \*_decoder.h: decoder interfaces
- * \ingroup flac
- *
- * \brief
- * This module describes the decoder layers provided by libFLAC.
- *
- * The stream decoder can be used to decode complete streams either from
- * the client via callbacks, or directly from a file, depending on how
- * it is initialized. When decoding via callbacks, the client provides
- * callbacks for reading FLAC data and writing decoded samples, and
- * handling metadata and errors. If the client also supplies seek-related
- * callback, the decoder function for sample-accurate seeking within the
- * FLAC input is also available. When decoding from a file, the client
- * needs only supply a filename or open \c FILE* and write/metadata/error
- * callbacks; the rest of the callbacks are supplied internally. For more
- * info see the \link flac_stream_decoder stream decoder \endlink module.
- */
-
- /** \defgroup flac_stream_decoder FLAC/stream_decoder.h: stream decoder interface
- * \ingroup flac_decoder
- *
- * \brief
- * This module contains the functions which implement the stream
- * decoder.
- *
- * The stream decoder can decode native FLAC, and optionally Ogg FLAC
- * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
- *
- * The basic usage of this decoder is as follows:
- * - The program creates an instance of a decoder using
- * FLAC__stream_decoder_new().
- * - The program overrides the default settings using
- * FLAC__stream_decoder_set_*() functions.
- * - The program initializes the instance to validate the settings and
- * prepare for decoding using
- * - FLAC__stream_decoder_init_stream() or FLAC__stream_decoder_init_FILE()
- * or FLAC__stream_decoder_init_file() for native FLAC,
- * - FLAC__stream_decoder_init_ogg_stream() or FLAC__stream_decoder_init_ogg_FILE()
- * or FLAC__stream_decoder_init_ogg_file() for Ogg FLAC
- * - The program calls the FLAC__stream_decoder_process_*() functions
- * to decode data, which subsequently calls the callbacks.
- * - The program finishes the decoding with FLAC__stream_decoder_finish(),
- * which flushes the input and output and resets the decoder to the
- * uninitialized state.
- * - The instance may be used again or deleted with
- * FLAC__stream_decoder_delete().
- *
- * In more detail, the program will create a new instance by calling
- * FLAC__stream_decoder_new(), then call FLAC__stream_decoder_set_*()
- * functions to override the default decoder options, and call
- * one of the FLAC__stream_decoder_init_*() functions.
- *
- * There are three initialization functions for native FLAC, one for
- * setting up the decoder to decode FLAC data from the client via
- * callbacks, and two for decoding directly from a FLAC file.
- *
- * For decoding via callbacks, use FLAC__stream_decoder_init_stream().
- * You must also supply several callbacks for handling I/O. Some (like
- * seeking) are optional, depending on the capabilities of the input.
- *
- * For decoding directly from a file, use FLAC__stream_decoder_init_FILE()
- * or FLAC__stream_decoder_init_file(). Then you must only supply an open
- * \c FILE* or filename and fewer callbacks; the decoder will handle
- * the other callbacks internally.
- *
- * There are three similarly-named init functions for decoding from Ogg
- * FLAC streams. Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
- * library has been built with Ogg support.
- *
- * Once the decoder is initialized, your program will call one of several
- * functions to start the decoding process:
- *
- * - FLAC__stream_decoder_process_single() - Tells the decoder to process at
- * most one metadata block or audio frame and return, calling either the
- * metadata callback or write callback, respectively, once. If the decoder
- * loses sync it will return with only the error callback being called.
- * - FLAC__stream_decoder_process_until_end_of_metadata() - Tells the decoder
- * to process the stream from the current location and stop upon reaching
- * the first audio frame. The client will get one metadata, write, or error
- * callback per metadata block, audio frame, or sync error, respectively.
- * - FLAC__stream_decoder_process_until_end_of_stream() - Tells the decoder
- * to process the stream from the current location until the read callback
- * returns FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or
- * FLAC__STREAM_DECODER_READ_STATUS_ABORT. The client will get one metadata,
- * write, or error callback per metadata block, audio frame, or sync error,
- * respectively.
- *
- * When the decoder has finished decoding (normally or through an abort),
- * the instance is finished by calling FLAC__stream_decoder_finish(), which
- * ensures the decoder is in the correct state and frees memory. Then the
- * instance may be deleted with FLAC__stream_decoder_delete() or initialized
- * again to decode another stream.
- *
- * Seeking is exposed through the FLAC__stream_decoder_seek_absolute() method.
- * At any point after the stream decoder has been initialized, the client can
- * call this function to seek to an exact sample within the stream.
- * Subsequently, the first time the write callback is called it will be
- * passed a (possibly partial) block starting at that sample.
- *
- * If the client cannot seek via the callback interface provided, but still
- * has another way of seeking, it can flush the decoder using
- * FLAC__stream_decoder_flush() and start feeding data from the new position
- * through the read callback.
- *
- * The stream decoder also provides MD5 signature checking. If this is
- * turned on before initialization, FLAC__stream_decoder_finish() will
- * report when the decoded MD5 signature does not match the one stored
- * in the STREAMINFO block. MD5 checking is automatically turned off
- * (until the next FLAC__stream_decoder_reset()) if there is no signature
- * in the STREAMINFO block or when a seek is attempted.
- *
- * The FLAC__stream_decoder_set_metadata_*() functions deserve special
- * attention. By default, the decoder only calls the metadata_callback for
- * the STREAMINFO block. These functions allow you to tell the decoder
- * explicitly which blocks to parse and return via the metadata_callback
- * and/or which to skip. Use a FLAC__stream_decoder_set_metadata_respond_all(),
- * FLAC__stream_decoder_set_metadata_ignore() ... or FLAC__stream_decoder_set_metadata_ignore_all(),
- * FLAC__stream_decoder_set_metadata_respond() ... sequence to exactly specify
- * which blocks to return. Remember that metadata blocks can potentially
- * be big (for example, cover art) so filtering out the ones you don't
- * use can reduce the memory requirements of the decoder. Also note the
- * special forms FLAC__stream_decoder_set_metadata_respond_application(id)
- * and FLAC__stream_decoder_set_metadata_ignore_application(id) for
- * filtering APPLICATION blocks based on the application ID.
- *
- * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but
- * they still can legally be filtered from the metadata_callback.
- *
- * \note
- * The "set" functions may only be called when the decoder is in the
- * state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after
- * FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but
- * before FLAC__stream_decoder_init_*(). If this is the case they will
- * return \c true, otherwise \c false.
- *
- * \note
- * FLAC__stream_decoder_finish() resets all settings to the constructor
- * defaults, including the callbacks.
- *
- * \{
- */
-
-
- /** State values for a FLAC__StreamDecoder
- *
- * The decoder's state can be obtained by calling FLAC__stream_decoder_get_state().
- */
- typedef enum {
-
- FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
- /**< The decoder is ready to search for metadata. */
-
- FLAC__STREAM_DECODER_READ_METADATA,
- /**< The decoder is ready to or is in the process of reading metadata. */
-
- FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
- /**< The decoder is ready to or is in the process of searching for the
- * frame sync code.
- */
-
- FLAC__STREAM_DECODER_READ_FRAME,
- /**< The decoder is ready to or is in the process of reading a frame. */
-
- FLAC__STREAM_DECODER_END_OF_STREAM,
- /**< The decoder has reached the end of the stream. */
-
- FLAC__STREAM_DECODER_OGG_ERROR,
- /**< An error occurred in the underlying Ogg layer. */
-
- FLAC__STREAM_DECODER_SEEK_ERROR,
- /**< An error occurred while seeking. The decoder must be flushed
- * with FLAC__stream_decoder_flush() or reset with
- * FLAC__stream_decoder_reset() before decoding can continue.
- */
-
- FLAC__STREAM_DECODER_ABORTED,
- /**< The decoder was aborted by the read callback. */
-
- FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
- /**< An error occurred allocating memory. The decoder is in an invalid
- * state and can no longer be used.
- */
-
- FLAC__STREAM_DECODER_UNINITIALIZED
- /**< The decoder is in the uninitialized state; one of the
- * FLAC__stream_decoder_init_*() functions must be called before samples
- * can be processed.
- */
-
- }
- FLAC__StreamDecoderState;
-
- /** Maps a FLAC__StreamDecoderState to a C string.
- *
- * Using a FLAC__StreamDecoderState as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
-
-
- /** Possible return values for the FLAC__stream_decoder_init_*() functions.
- */
- typedef enum
- {
-
- FLAC__STREAM_DECODER_INIT_STATUS_OK = 0,
- /**< Initialization was successful. */
-
- FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
- /**< The library was not compiled with support for the given container
- * format.
- */
-
- FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS,
- /**< A required callback was not supplied. */
-
- FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR,
- /**< An error occurred allocating memory. */
-
- FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE,
- /**< fopen() failed in FLAC__stream_decoder_init_file() or
- * FLAC__stream_decoder_init_ogg_file(). */
-
- FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED
- /**< FLAC__stream_decoder_init_*() was called when the decoder was
- * already initialized, usually because
- * FLAC__stream_decoder_finish() was not called.
- */
-
- } FLAC__StreamDecoderInitStatus;
+/** \file include/FLAC/stream_decoder.h
+ *
+ * \brief
+ * This module contains the functions which implement the stream
+ * decoder.
+ *
+ * See the detailed documentation in the
+ * \link flac_stream_decoder stream decoder \endlink module.
+ */
+
+/** \defgroup flac_decoder FLAC/ \*_decoder.h: decoder interfaces
+ * \ingroup flac
+ *
+ * \brief
+ * This module describes the decoder layers provided by libFLAC.
+ *
+ * The stream decoder can be used to decode complete streams either from
+ * the client via callbacks, or directly from a file, depending on how
+ * it is initialized. When decoding via callbacks, the client provides
+ * callbacks for reading FLAC data and writing decoded samples, and
+ * handling metadata and errors. If the client also supplies seek-related
+ * callback, the decoder function for sample-accurate seeking within the
+ * FLAC input is also available. When decoding from a file, the client
+ * needs only supply a filename or open \c FILE* and write/metadata/error
+ * callbacks; the rest of the callbacks are supplied internally. For more
+ * info see the \link flac_stream_decoder stream decoder \endlink module.
+ */
+
+/** \defgroup flac_stream_decoder FLAC/stream_decoder.h: stream decoder interface
+ * \ingroup flac_decoder
+ *
+ * \brief
+ * This module contains the functions which implement the stream
+ * decoder.
+ *
+ * The stream decoder can decode native FLAC, and optionally Ogg FLAC
+ * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
+ *
+ * The basic usage of this decoder is as follows:
+ * - The program creates an instance of a decoder using
+ * FLAC__stream_decoder_new().
+ * - The program overrides the default settings using
+ * FLAC__stream_decoder_set_*() functions.
+ * - The program initializes the instance to validate the settings and
+ * prepare for decoding using
+ * - FLAC__stream_decoder_init_stream() or FLAC__stream_decoder_init_FILE()
+ * or FLAC__stream_decoder_init_file() for native FLAC,
+ * - FLAC__stream_decoder_init_ogg_stream() or FLAC__stream_decoder_init_ogg_FILE()
+ * or FLAC__stream_decoder_init_ogg_file() for Ogg FLAC
+ * - The program calls the FLAC__stream_decoder_process_*() functions
+ * to decode data, which subsequently calls the callbacks.
+ * - The program finishes the decoding with FLAC__stream_decoder_finish(),
+ * which flushes the input and output and resets the decoder to the
+ * uninitialized state.
+ * - The instance may be used again or deleted with
+ * FLAC__stream_decoder_delete().
+ *
+ * In more detail, the program will create a new instance by calling
+ * FLAC__stream_decoder_new(), then call FLAC__stream_decoder_set_*()
+ * functions to override the default decoder options, and call
+ * one of the FLAC__stream_decoder_init_*() functions.
+ *
+ * There are three initialization functions for native FLAC, one for
+ * setting up the decoder to decode FLAC data from the client via
+ * callbacks, and two for decoding directly from a FLAC file.
+ *
+ * For decoding via callbacks, use FLAC__stream_decoder_init_stream().
+ * You must also supply several callbacks for handling I/O. Some (like
+ * seeking) are optional, depending on the capabilities of the input.
+ *
+ * For decoding directly from a file, use FLAC__stream_decoder_init_FILE()
+ * or FLAC__stream_decoder_init_file(). Then you must only supply an open
+ * \c FILE* or filename and fewer callbacks; the decoder will handle
+ * the other callbacks internally.
+ *
+ * There are three similarly-named init functions for decoding from Ogg
+ * FLAC streams. Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
+ * library has been built with Ogg support.
+ *
+ * Once the decoder is initialized, your program will call one of several
+ * functions to start the decoding process:
+ *
+ * - FLAC__stream_decoder_process_single() - Tells the decoder to process at
+ * most one metadata block or audio frame and return, calling either the
+ * metadata callback or write callback, respectively, once. If the decoder
+ * loses sync it will return with only the error callback being called.
+ * - FLAC__stream_decoder_process_until_end_of_metadata() - Tells the decoder
+ * to process the stream from the current location and stop upon reaching
+ * the first audio frame. The client will get one metadata, write, or error
+ * callback per metadata block, audio frame, or sync error, respectively.
+ * - FLAC__stream_decoder_process_until_end_of_stream() - Tells the decoder
+ * to process the stream from the current location until the read callback
+ * returns FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or
+ * FLAC__STREAM_DECODER_READ_STATUS_ABORT. The client will get one metadata,
+ * write, or error callback per metadata block, audio frame, or sync error,
+ * respectively.
+ *
+ * When the decoder has finished decoding (normally or through an abort),
+ * the instance is finished by calling FLAC__stream_decoder_finish(), which
+ * ensures the decoder is in the correct state and frees memory. Then the
+ * instance may be deleted with FLAC__stream_decoder_delete() or initialized
+ * again to decode another stream.
+ *
+ * Seeking is exposed through the FLAC__stream_decoder_seek_absolute() method.
+ * At any point after the stream decoder has been initialized, the client can
+ * call this function to seek to an exact sample within the stream.
+ * Subsequently, the first time the write callback is called it will be
+ * passed a (possibly partial) block starting at that sample.
+ *
+ * If the client cannot seek via the callback interface provided, but still
+ * has another way of seeking, it can flush the decoder using
+ * FLAC__stream_decoder_flush() and start feeding data from the new position
+ * through the read callback.
+ *
+ * The stream decoder also provides MD5 signature checking. If this is
+ * turned on before initialization, FLAC__stream_decoder_finish() will
+ * report when the decoded MD5 signature does not match the one stored
+ * in the STREAMINFO block. MD5 checking is automatically turned off
+ * (until the next FLAC__stream_decoder_reset()) if there is no signature
+ * in the STREAMINFO block or when a seek is attempted.
+ *
+ * The FLAC__stream_decoder_set_metadata_*() functions deserve special
+ * attention. By default, the decoder only calls the metadata_callback for
+ * the STREAMINFO block. These functions allow you to tell the decoder
+ * explicitly which blocks to parse and return via the metadata_callback
+ * and/or which to skip. Use a FLAC__stream_decoder_set_metadata_respond_all(),
+ * FLAC__stream_decoder_set_metadata_ignore() ... or FLAC__stream_decoder_set_metadata_ignore_all(),
+ * FLAC__stream_decoder_set_metadata_respond() ... sequence to exactly specify
+ * which blocks to return. Remember that metadata blocks can potentially
+ * be big (for example, cover art) so filtering out the ones you don't
+ * use can reduce the memory requirements of the decoder. Also note the
+ * special forms FLAC__stream_decoder_set_metadata_respond_application(id)
+ * and FLAC__stream_decoder_set_metadata_ignore_application(id) for
+ * filtering APPLICATION blocks based on the application ID.
+ *
+ * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but
+ * they still can legally be filtered from the metadata_callback.
+ *
+ * \note
+ * The "set" functions may only be called when the decoder is in the
+ * state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after
+ * FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but
+ * before FLAC__stream_decoder_init_*(). If this is the case they will
+ * return \c true, otherwise \c false.
+ *
+ * \note
+ * FLAC__stream_decoder_finish() resets all settings to the constructor
+ * defaults, including the callbacks.
+ *
+ * \{
+ */
- /** Maps a FLAC__StreamDecoderInitStatus to a C string.
- *
- * Using a FLAC__StreamDecoderInitStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[];
+/** State values for a FLAC__StreamDecoder
+ *
+ * The decoder's state can be obtained by calling FLAC__stream_decoder_get_state().
+ */
+typedef enum {
- /** Return values for the FLAC__StreamDecoder read callback.
- */
- typedef enum
- {
+ FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
+ /**< The decoder is ready to search for metadata. */
- FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
- /**< The read was OK and decoding can continue. */
+ FLAC__STREAM_DECODER_READ_METADATA,
+ /**< The decoder is ready to or is in the process of reading metadata. */
- FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
- /**< The read was attempted while at the end of the stream. Note that
- * the client must only return this value when the read callback was
- * called when already at the end of the stream. Otherwise, if the read
- * itself moves to the end of the stream, the client should still return
- * the data and \c FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, and then on
- * the next read callback it should return
- * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM with a byte count
- * of \c 0.
- */
+ FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
+ /**< The decoder is ready to or is in the process of searching for the
+ * frame sync code.
+ */
- FLAC__STREAM_DECODER_READ_STATUS_ABORT
- /**< An unrecoverable error occurred. The decoder will return from the process call. */
+ FLAC__STREAM_DECODER_READ_FRAME,
+ /**< The decoder is ready to or is in the process of reading a frame. */
- } FLAC__StreamDecoderReadStatus;
+ FLAC__STREAM_DECODER_END_OF_STREAM,
+ /**< The decoder has reached the end of the stream. */
- /** Maps a FLAC__StreamDecoderReadStatus to a C string.
- *
- * Using a FLAC__StreamDecoderReadStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
+ FLAC__STREAM_DECODER_OGG_ERROR,
+ /**< An error occurred in the underlying Ogg layer. */
+ FLAC__STREAM_DECODER_SEEK_ERROR,
+ /**< An error occurred while seeking. The decoder must be flushed
+ * with FLAC__stream_decoder_flush() or reset with
+ * FLAC__stream_decoder_reset() before decoding can continue.
+ */
- /** Return values for the FLAC__StreamDecoder seek callback.
- */
- typedef enum
- {
+ FLAC__STREAM_DECODER_ABORTED,
+ /**< The decoder was aborted by the read callback. */
- FLAC__STREAM_DECODER_SEEK_STATUS_OK,
- /**< The seek was OK and decoding can continue. */
-
- FLAC__STREAM_DECODER_SEEK_STATUS_ERROR,
- /**< An unrecoverable error occurred. The decoder will return from the process call. */
+ FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
+ /**< An error occurred allocating memory. The decoder is in an invalid
+ * state and can no longer be used.
+ */
- FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
- /**< Client does not support seeking. */
+ FLAC__STREAM_DECODER_UNINITIALIZED
+ /**< The decoder is in the uninitialized state; one of the
+ * FLAC__stream_decoder_init_*() functions must be called before samples
+ * can be processed.
+ */
- } FLAC__StreamDecoderSeekStatus;
+} FLAC__StreamDecoderState;
+
+/** Maps a FLAC__StreamDecoderState to a C string.
+ *
+ * Using a FLAC__StreamDecoderState as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
+
+
+/** Possible return values for the FLAC__stream_decoder_init_*() functions.
+ */
+typedef enum {
- /** Maps a FLAC__StreamDecoderSeekStatus to a C string.
- *
- * Using a FLAC__StreamDecoderSeekStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[];
+ FLAC__STREAM_DECODER_INIT_STATUS_OK = 0,
+ /**< Initialization was successful. */
+ FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
+ /**< The library was not compiled with support for the given container
+ * format.
+ */
- /** Return values for the FLAC__StreamDecoder tell callback.
- */
- typedef enum
- {
+ FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS,
+ /**< A required callback was not supplied. */
- FLAC__STREAM_DECODER_TELL_STATUS_OK,
- /**< The tell was OK and decoding can continue. */
+ FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR,
+ /**< An error occurred allocating memory. */
- FLAC__STREAM_DECODER_TELL_STATUS_ERROR,
- /**< An unrecoverable error occurred. The decoder will return from the process call. */
+ FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE,
+ /**< fopen() failed in FLAC__stream_decoder_init_file() or
+ * FLAC__stream_decoder_init_ogg_file(). */
+
+ FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED
+ /**< FLAC__stream_decoder_init_*() was called when the decoder was
+ * already initialized, usually because
+ * FLAC__stream_decoder_finish() was not called.
+ */
+
+} FLAC__StreamDecoderInitStatus;
+
+/** Maps a FLAC__StreamDecoderInitStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderInitStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[];
+
+
+/** Return values for the FLAC__StreamDecoder read callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
+ /**< The read was OK and decoding can continue. */
+
+ FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
+ /**< The read was attempted while at the end of the stream. Note that
+ * the client must only return this value when the read callback was
+ * called when already at the end of the stream. Otherwise, if the read
+ * itself moves to the end of the stream, the client should still return
+ * the data and \c FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, and then on
+ * the next read callback it should return
+ * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM with a byte count
+ * of \c 0.
+ */
+
+ FLAC__STREAM_DECODER_READ_STATUS_ABORT
+ /**< An unrecoverable error occurred. The decoder will return from the process call. */
+
+} FLAC__StreamDecoderReadStatus;
+
+/** Maps a FLAC__StreamDecoderReadStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderReadStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
+
+
+/** Return values for the FLAC__StreamDecoder seek callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_DECODER_SEEK_STATUS_OK,
+ /**< The seek was OK and decoding can continue. */
+
+ FLAC__STREAM_DECODER_SEEK_STATUS_ERROR,
+ /**< An unrecoverable error occurred. The decoder will return from the process call. */
+
+ FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
+ /**< Client does not support seeking. */
+
+} FLAC__StreamDecoderSeekStatus;
+
+/** Maps a FLAC__StreamDecoderSeekStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderSeekStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[];
+
+
+/** Return values for the FLAC__StreamDecoder tell callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_DECODER_TELL_STATUS_OK,
+ /**< The tell was OK and decoding can continue. */
+
+ FLAC__STREAM_DECODER_TELL_STATUS_ERROR,
+ /**< An unrecoverable error occurred. The decoder will return from the process call. */
+
+ FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
+ /**< Client does not support telling the position. */
+
+} FLAC__StreamDecoderTellStatus;
+
+/** Maps a FLAC__StreamDecoderTellStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderTellStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[];
- FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
- /**< Client does not support telling the position. */
- } FLAC__StreamDecoderTellStatus;
+/** Return values for the FLAC__StreamDecoder length callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_DECODER_LENGTH_STATUS_OK,
+ /**< The length call was OK and decoding can continue. */
+
+ FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR,
+ /**< An unrecoverable error occurred. The decoder will return from the process call. */
+
+ FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
+ /**< Client does not support reporting the length. */
+
+} FLAC__StreamDecoderLengthStatus;
+
+/** Maps a FLAC__StreamDecoderLengthStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderLengthStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[];
+
+
+/** Return values for the FLAC__StreamDecoder write callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
+ /**< The write was OK and decoding can continue. */
+
+ FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
+ /**< An unrecoverable error occurred. The decoder will return from the process call. */
+
+} FLAC__StreamDecoderWriteStatus;
+
+/** Maps a FLAC__StreamDecoderWriteStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderWriteStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
+
+
+/** Possible values passed back to the FLAC__StreamDecoder error callback.
+ * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC is the generic catch-
+ * all. The rest could be caused by bad sync (false synchronization on
+ * data that is not the start of a frame) or corrupted data. The error
+ * itself is the decoder's best guess at what happened assuming a correct
+ * sync. For example \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
+ * could be caused by a correct sync on the start of a frame, but some
+ * data in the frame header was corrupted. Or it could be the result of
+ * syncing on a point the stream that looked like the starting of a frame
+ * but was not. \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
+ * could be because the decoder encountered a valid frame made by a future
+ * version of the encoder which it cannot parse, or because of a false
+ * sync making it appear as though an encountered frame was generated by
+ * a future encoder.
+ */
+typedef enum {
+
+ FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
+ /**< An error in the stream caused the decoder to lose synchronization. */
+
+ FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
+ /**< The decoder encountered a corrupted frame header. */
+
+ FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
+ /**< The frame's data did not match the CRC in the footer. */
+
+ FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
+ /**< The decoder encountered reserved fields in use in the stream. */
+
+} FLAC__StreamDecoderErrorStatus;
+
+/** Maps a FLAC__StreamDecoderErrorStatus to a C string.
+ *
+ * Using a FLAC__StreamDecoderErrorStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
+
+
+/***********************************************************************
+ *
+ * class FLAC__StreamDecoder
+ *
+ ***********************************************************************/
+
+struct FLAC__StreamDecoderProtected;
+struct FLAC__StreamDecoderPrivate;
+/** The opaque structure definition for the stream decoder type.
+ * See the \link flac_stream_decoder stream decoder module \endlink
+ * for a detailed description.
+ */
+typedef struct {
+ struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
+ struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
+} FLAC__StreamDecoder;
+
+/** Signature for the read callback.
+ *
+ * A function pointer matching this signature must be passed to
+ * FLAC__stream_decoder_init*_stream(). The supplied function will be
+ * called when the decoder needs more input data. The address of the
+ * buffer to be filled is supplied, along with the number of bytes the
+ * buffer can hold. The callback may choose to supply less data and
+ * modify the byte count but must be careful not to overflow the buffer.
+ * The callback then returns a status code chosen from
+ * FLAC__StreamDecoderReadStatus.
+ *
+ * Here is an example of a read callback for stdio streams:
+ * \code
+ * FLAC__StreamDecoderReadStatus read_cb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * if(*bytes > 0) {
+ * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
+ * if(ferror(file))
+ * return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ * else if(*bytes == 0)
+ * return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ * else
+ * return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ * }
+ * else
+ * return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param buffer A pointer to a location for the callee to store
+ * data to be decoded.
+ * \param bytes A pointer to the size of the buffer. On entry
+ * to the callback, it contains the maximum number
+ * of bytes that may be stored in \a buffer. The
+ * callee must set it to the actual number of bytes
+ * stored (0 in case of error or end-of-stream) before
+ * returning.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ * \retval FLAC__StreamDecoderReadStatus
+ * The callee's return status. Note that the callback should return
+ * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM if and only if
+ * zero bytes were read and there is no more data to be read.
+ */
+typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
+
+/** Signature for the seek callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_decoder_init*_stream(). The supplied function will be
+ * called when the decoder needs to seek the input stream. The decoder
+ * will pass the absolute byte offset to seek to, 0 meaning the
+ * beginning of the stream.
+ *
+ * Here is an example of a seek callback for stdio streams:
+ * \code
+ * FLAC__StreamDecoderSeekStatus seek_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * if(file == stdin)
+ * return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
+ * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
+ * return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
+ * else
+ * return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param absolute_byte_offset The offset from the beginning of the stream
+ * to seek to.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ * \retval FLAC__StreamDecoderSeekStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamDecoderSeekStatus (*FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
+
+/** Signature for the tell callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_decoder_init*_stream(). The supplied function will be
+ * called when the decoder wants to know the current position of the
+ * stream. The callback should return the byte offset from the
+ * beginning of the stream.
+ *
+ * Here is an example of a tell callback for stdio streams:
+ * \code
+ * FLAC__StreamDecoderTellStatus tell_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * off_t pos;
+ * if(file == stdin)
+ * return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
+ * else if((pos = ftello(file)) < 0)
+ * return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
+ * else {
+ * *absolute_byte_offset = (FLAC__uint64)pos;
+ * return FLAC__STREAM_DECODER_TELL_STATUS_OK;
+ * }
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param absolute_byte_offset A pointer to storage for the current offset
+ * from the beginning of the stream.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ * \retval FLAC__StreamDecoderTellStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamDecoderTellStatus (*FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
+
+/** Signature for the length callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_decoder_init*_stream(). The supplied function will be
+ * called when the decoder wants to know the total length of the stream
+ * in bytes.
+ *
+ * Here is an example of a length callback for stdio streams:
+ * \code
+ * FLAC__StreamDecoderLengthStatus length_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * struct stat filestats;
+ *
+ * if(file == stdin)
+ * return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
+ * else if(fstat(fileno(file), &filestats) != 0)
+ * return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
+ * else {
+ * *stream_length = (FLAC__uint64)filestats.st_size;
+ * return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
+ * }
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param stream_length A pointer to storage for the length of the stream
+ * in bytes.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ * \retval FLAC__StreamDecoderLengthStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamDecoderLengthStatus (*FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
+
+/** Signature for the EOF callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_decoder_init*_stream(). The supplied function will be
+ * called when the decoder needs to know if the end of the stream has
+ * been reached.
+ *
+ * Here is an example of a EOF callback for stdio streams:
+ * FLAC__bool eof_cb(const FLAC__StreamDecoder *decoder, void *client_data)
+ * \code
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * return feof(file)? true : false;
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ * \retval FLAC__bool
+ * \c true if the currently at the end of the stream, else \c false.
+ */
+typedef FLAC__bool (*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data);
+
+/** Signature for the write callback.
+ *
+ * A function pointer matching this signature must be passed to one of
+ * the FLAC__stream_decoder_init_*() functions.
+ * The supplied function will be called when the decoder has decoded a
+ * single audio frame. The decoder will pass the frame metadata as well
+ * as an array of pointers (one for each channel) pointing to the
+ * decoded audio.
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param frame The description of the decoded frame. See
+ * FLAC__Frame.
+ * \param buffer An array of pointers to decoded channels of data.
+ * Each pointer will point to an array of signed
+ * samples of length \a frame->header.blocksize.
+ * Channels will be ordered according to the FLAC
+ * specification; see the documentation for the
+ * <A HREF="../format.html#frame_header">frame header</A>.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ * \retval FLAC__StreamDecoderWriteStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
+
+/** Signature for the metadata callback.
+ *
+ * A function pointer matching this signature must be passed to one of
+ * the FLAC__stream_decoder_init_*() functions.
+ * The supplied function will be called when the decoder has decoded a
+ * metadata block. In a valid FLAC file there will always be one
+ * \c STREAMINFO block, followed by zero or more other metadata blocks.
+ * These will be supplied by the decoder in the same order as they
+ * appear in the stream and always before the first audio frame (i.e.
+ * write callback). The metadata block that is passed in must not be
+ * modified, and it doesn't live beyond the callback, so you should make
+ * a copy of it with FLAC__metadata_object_clone() if you will need it
+ * elsewhere. Since metadata blocks can potentially be large, by
+ * default the decoder only calls the metadata callback for the
+ * \c STREAMINFO block; you can instruct the decoder to pass or filter
+ * other blocks with FLAC__stream_decoder_set_metadata_*() calls.
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param metadata The decoded metadata block.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ */
+typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
+
+/** Signature for the error callback.
+ *
+ * A function pointer matching this signature must be passed to one of
+ * the FLAC__stream_decoder_init_*() functions.
+ * The supplied function will be called whenever an error occurs during
+ * decoding.
+ *
+ * \note In general, FLAC__StreamDecoder functions which change the
+ * state should not be called on the \a decoder while in the callback.
+ *
+ * \param decoder The decoder instance calling the callback.
+ * \param status The error encountered by the decoder.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_decoder_init_*().
+ */
+typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
+
+
+/***********************************************************************
+ *
+ * Class constructor/destructor
+ *
+ ***********************************************************************/
+
+/** Create a new stream decoder instance. The instance is created with
+ * default settings; see the individual FLAC__stream_decoder_set_*()
+ * functions for each setting's default.
+ *
+ * \retval FLAC__StreamDecoder*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void);
+
+/** Free a decoder instance. Deletes the object pointed to by \a decoder.
+ *
+ * \param decoder A pointer to an existing decoder.
+ * \assert
+ * \code decoder != NULL \endcode
+ */
+FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
+
+
+/***********************************************************************
+ *
+ * Public class method prototypes
+ *
+ ***********************************************************************/
+
+/** Set the serial number for the FLAC stream within the Ogg container.
+ * The default behavior is to use the serial number of the first Ogg
+ * page. Setting a serial number here will explicitly specify which
+ * stream is to be decoded.
+ *
+ * \note
+ * This does not need to be set for native FLAC decoding.
+ *
+ * \default \c use serial number of first page
+ * \param decoder A decoder instance to set.
+ * \param serial_number See above.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number);
+
+/** Set the "MD5 signature checking" flag. If \c true, the decoder will
+ * compute the MD5 signature of the unencoded audio data while decoding
+ * and compare it to the signature from the STREAMINFO block, if it
+ * exists, during FLAC__stream_decoder_finish().
+ *
+ * MD5 signature checking will be turned off (until the next
+ * FLAC__stream_decoder_reset()) if there is no signature in the
+ * STREAMINFO block or when a seek is attempted.
+ *
+ * Clients that do not use the MD5 check should leave this off to speed
+ * up decoding.
+ *
+ * \default \c false
+ * \param decoder A decoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value);
+
+/** Direct the decoder to pass on all metadata blocks of type \a type.
+ *
+ * \default By default, only the \c STREAMINFO block is returned via the
+ * metadata callback.
+ * \param decoder A decoder instance to set.
+ * \param type See above.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \a type is valid
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
+
+/** Direct the decoder to pass on all APPLICATION metadata blocks of the
+ * given \a id.
+ *
+ * \default By default, only the \c STREAMINFO block is returned via the
+ * metadata callback.
+ * \param decoder A decoder instance to set.
+ * \param id See above.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \code id != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
+
+/** Direct the decoder to pass on all metadata blocks of any type.
+ *
+ * \default By default, only the \c STREAMINFO block is returned via the
+ * metadata callback.
+ * \param decoder A decoder instance to set.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
+
+/** Direct the decoder to filter out all metadata blocks of type \a type.
+ *
+ * \default By default, only the \c STREAMINFO block is returned via the
+ * metadata callback.
+ * \param decoder A decoder instance to set.
+ * \param type See above.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \a type is valid
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
+
+/** Direct the decoder to filter out all APPLICATION metadata blocks of
+ * the given \a id.
+ *
+ * \default By default, only the \c STREAMINFO block is returned via the
+ * metadata callback.
+ * \param decoder A decoder instance to set.
+ * \param id See above.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \code id != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
+
+/** Direct the decoder to filter out all metadata blocks of any type.
+ *
+ * \default By default, only the \c STREAMINFO block is returned via the
+ * metadata callback.
+ * \param decoder A decoder instance to set.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the decoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
+
+/** Get the current decoder state.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__StreamDecoderState
+ * The current decoder state.
+ */
+FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
+
+/** Get the current decoder state as a C string.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval const char *
+ * The decoder state as a C string. Do not modify the contents.
+ */
+FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
+
+/** Get the "MD5 signature checking" flag.
+ * This is the value of the setting, not whether or not the decoder is
+ * currently checking the MD5 (remember, it can be turned off automatically
+ * by a seek). When the decoder is reset the flag will be restored to the
+ * value returned by this function.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * See above.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder);
+
+/** Get the total number of samples in the stream being decoded.
+ * Will only be valid after decoding has started and will contain the
+ * value from the \c STREAMINFO block. A value of \c 0 means "unknown".
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval unsigned
+ * See above.
+ */
+FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder);
+
+/** Get the current number of channels in the stream being decoded.
+ * Will only be valid after decoding has started and will contain the
+ * value from the most recently decoded frame header.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval unsigned
+ * See above.
+ */
+FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
+
+/** Get the current channel assignment in the stream being decoded.
+ * Will only be valid after decoding has started and will contain the
+ * value from the most recently decoded frame header.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__ChannelAssignment
+ * See above.
+ */
+FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
+
+/** Get the current sample resolution in the stream being decoded.
+ * Will only be valid after decoding has started and will contain the
+ * value from the most recently decoded frame header.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval unsigned
+ * See above.
+ */
+FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
+
+/** Get the current sample rate in Hz of the stream being decoded.
+ * Will only be valid after decoding has started and will contain the
+ * value from the most recently decoded frame header.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval unsigned
+ * See above.
+ */
+FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
+
+/** Get the current blocksize of the stream being decoded.
+ * Will only be valid after decoding has started and will contain the
+ * value from the most recently decoded frame header.
+ *
+ * \param decoder A decoder instance to query.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval unsigned
+ * See above.
+ */
+FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
+
+/** Returns the decoder's current read position within the stream.
+ * The position is the byte offset from the start of the stream.
+ * Bytes before this position have been fully decoded. Note that
+ * there may still be undecoded bytes in the decoder's read FIFO.
+ * The returned position is correct even after a seek.
+ *
+ * \warning This function currently only works for native FLAC,
+ * not Ogg FLAC streams.
+ *
+ * \param decoder A decoder instance to query.
+ * \param position Address at which to return the desired position.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \code position != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if successful, \c false if the stream is not native FLAC,
+ * or there was an error from the 'tell' callback or it returned
+ * \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
+
+/** Initialize the decoder instance to decode native FLAC streams.
+ *
+ * This flavor of initialization sets up the decoder to decode from a
+ * native FLAC stream. I/O is performed via callbacks to the client.
+ * For decoding from a plain file via filename or open FILE*,
+ * FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE()
+ * provide a simpler interface.
+ *
+ * This function should be called after FLAC__stream_decoder_new() and
+ * FLAC__stream_decoder_set_*() but before any of the
+ * FLAC__stream_decoder_process_*() functions. Will set and return the
+ * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+ * if initialization succeeded.
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \param read_callback See FLAC__StreamDecoderReadCallback. This
+ * pointer must not be \c NULL.
+ * \param seek_callback See FLAC__StreamDecoderSeekCallback. This
+ * pointer may be \c NULL if seeking is not
+ * supported. If \a seek_callback is not \c NULL then a
+ * \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
+ * Alternatively, a dummy seek callback that just
+ * returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param tell_callback See FLAC__StreamDecoderTellCallback. This
+ * pointer may be \c NULL if not supported by the client. If
+ * \a seek_callback is not \c NULL then a
+ * \a tell_callback must also be supplied.
+ * Alternatively, a dummy tell callback that just
+ * returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param length_callback See FLAC__StreamDecoderLengthCallback. This
+ * pointer may be \c NULL if not supported by the client. If
+ * \a seek_callback is not \c NULL then a
+ * \a length_callback must also be supplied.
+ * Alternatively, a dummy length callback that just
+ * returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param eof_callback See FLAC__StreamDecoderEofCallback. This
+ * pointer may be \c NULL if not supported by the client. If
+ * \a seek_callback is not \c NULL then a
+ * \a eof_callback must also be supplied.
+ * Alternatively, a dummy length callback that just
+ * returns \c false
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param write_callback See FLAC__StreamDecoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param error_callback See FLAC__StreamDecoderErrorCallback. This
+ * pointer must not be \c NULL.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__StreamDecoderInitStatus
+ * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
+ FLAC__StreamDecoder *decoder,
+ FLAC__StreamDecoderReadCallback read_callback,
+ FLAC__StreamDecoderSeekCallback seek_callback,
+ FLAC__StreamDecoderTellCallback tell_callback,
+ FLAC__StreamDecoderLengthCallback length_callback,
+ FLAC__StreamDecoderEofCallback eof_callback,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
+);
+
+/** Initialize the decoder instance to decode Ogg FLAC streams.
+ *
+ * This flavor of initialization sets up the decoder to decode from a
+ * FLAC stream in an Ogg container. I/O is performed via callbacks to the
+ * client. For decoding from a plain file via filename or open FILE*,
+ * FLAC__stream_decoder_init_ogg_file() and FLAC__stream_decoder_init_ogg_FILE()
+ * provide a simpler interface.
+ *
+ * This function should be called after FLAC__stream_decoder_new() and
+ * FLAC__stream_decoder_set_*() but before any of the
+ * FLAC__stream_decoder_process_*() functions. Will set and return the
+ * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+ * if initialization succeeded.
+ *
+ * \note Support for Ogg FLAC in the library is optional. If this
+ * library has been built without support for Ogg FLAC, this function
+ * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \param read_callback See FLAC__StreamDecoderReadCallback. This
+ * pointer must not be \c NULL.
+ * \param seek_callback See FLAC__StreamDecoderSeekCallback. This
+ * pointer may be \c NULL if seeking is not
+ * supported. If \a seek_callback is not \c NULL then a
+ * \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
+ * Alternatively, a dummy seek callback that just
+ * returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param tell_callback See FLAC__StreamDecoderTellCallback. This
+ * pointer may be \c NULL if not supported by the client. If
+ * \a seek_callback is not \c NULL then a
+ * \a tell_callback must also be supplied.
+ * Alternatively, a dummy tell callback that just
+ * returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param length_callback See FLAC__StreamDecoderLengthCallback. This
+ * pointer may be \c NULL if not supported by the client. If
+ * \a seek_callback is not \c NULL then a
+ * \a length_callback must also be supplied.
+ * Alternatively, a dummy length callback that just
+ * returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param eof_callback See FLAC__StreamDecoderEofCallback. This
+ * pointer may be \c NULL if not supported by the client. If
+ * \a seek_callback is not \c NULL then a
+ * \a eof_callback must also be supplied.
+ * Alternatively, a dummy length callback that just
+ * returns \c false
+ * may also be supplied, all though this is slightly
+ * less efficient for the decoder.
+ * \param write_callback See FLAC__StreamDecoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param error_callback See FLAC__StreamDecoderErrorCallback. This
+ * pointer must not be \c NULL.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__StreamDecoderInitStatus
+ * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
+ FLAC__StreamDecoder *decoder,
+ FLAC__StreamDecoderReadCallback read_callback,
+ FLAC__StreamDecoderSeekCallback seek_callback,
+ FLAC__StreamDecoderTellCallback tell_callback,
+ FLAC__StreamDecoderLengthCallback length_callback,
+ FLAC__StreamDecoderEofCallback eof_callback,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
+);
+
+/** Initialize the decoder instance to decode native FLAC files.
+ *
+ * This flavor of initialization sets up the decoder to decode from a
+ * plain native FLAC file. For non-stdio streams, you must use
+ * FLAC__stream_decoder_init_stream() and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_decoder_new() and
+ * FLAC__stream_decoder_set_*() but before any of the
+ * FLAC__stream_decoder_process_*() functions. Will set and return the
+ * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+ * if initialization succeeded.
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \param file An open FLAC file. The file should have been
+ * opened with mode \c "rb" and rewound. The file
+ * becomes owned by the decoder and should not be
+ * manipulated by the client while decoding.
+ * Unless \a file is \c stdin, it will be closed
+ * when FLAC__stream_decoder_finish() is called.
+ * Note however that seeking will not work when
+ * decoding from \c stdout since it is not seekable.
+ * \param write_callback See FLAC__StreamDecoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param error_callback See FLAC__StreamDecoderErrorCallback. This
+ * pointer must not be \c NULL.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \code file != NULL \endcode
+ * \retval FLAC__StreamDecoderInitStatus
+ * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
+ FLAC__StreamDecoder *decoder,
+ FILE *file,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
+);
+
+/** Initialize the decoder instance to decode Ogg FLAC files.
+ *
+ * This flavor of initialization sets up the decoder to decode from a
+ * plain Ogg FLAC file. For non-stdio streams, you must use
+ * FLAC__stream_decoder_init_ogg_stream() and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_decoder_new() and
+ * FLAC__stream_decoder_set_*() but before any of the
+ * FLAC__stream_decoder_process_*() functions. Will set and return the
+ * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+ * if initialization succeeded.
+ *
+ * \note Support for Ogg FLAC in the library is optional. If this
+ * library has been built without support for Ogg FLAC, this function
+ * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \param file An open FLAC file. The file should have been
+ * opened with mode \c "rb" and rewound. The file
+ * becomes owned by the decoder and should not be
+ * manipulated by the client while decoding.
+ * Unless \a file is \c stdin, it will be closed
+ * when FLAC__stream_decoder_finish() is called.
+ * Note however that seeking will not work when
+ * decoding from \c stdout since it is not seekable.
+ * \param write_callback See FLAC__StreamDecoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param error_callback See FLAC__StreamDecoderErrorCallback. This
+ * pointer must not be \c NULL.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \code file != NULL \endcode
+ * \retval FLAC__StreamDecoderInitStatus
+ * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
+ FLAC__StreamDecoder *decoder,
+ FILE *file,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
+);
+
+/** Initialize the decoder instance to decode native FLAC files.
+ *
+ * This flavor of initialization sets up the decoder to decode from a plain
+ * native FLAC file. If POSIX fopen() semantics are not sufficient, (for
+ * example, with Unicode filenames on Windows), you must use
+ * FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
+ * and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_decoder_new() and
+ * FLAC__stream_decoder_set_*() but before any of the
+ * FLAC__stream_decoder_process_*() functions. Will set and return the
+ * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+ * if initialization succeeded.
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \param filename The name of the file to decode from. The file will
+ * be opened with fopen(). Use \c NULL to decode from
+ * \c stdin. Note that \c stdin is not seekable.
+ * \param write_callback See FLAC__StreamDecoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param error_callback See FLAC__StreamDecoderErrorCallback. This
+ * pointer must not be \c NULL.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__StreamDecoderInitStatus
+ * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
+ FLAC__StreamDecoder *decoder,
+ const char *filename,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
+);
+
+/** Initialize the decoder instance to decode Ogg FLAC files.
+ *
+ * This flavor of initialization sets up the decoder to decode from a plain
+ * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for
+ * example, with Unicode filenames on Windows), you must use
+ * FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
+ * and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_decoder_new() and
+ * FLAC__stream_decoder_set_*() but before any of the
+ * FLAC__stream_decoder_process_*() functions. Will set and return the
+ * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+ * if initialization succeeded.
+ *
+ * \note Support for Ogg FLAC in the library is optional. If this
+ * library has been built without support for Ogg FLAC, this function
+ * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \param filename The name of the file to decode from. The file will
+ * be opened with fopen(). Use \c NULL to decode from
+ * \c stdin. Note that \c stdin is not seekable.
+ * \param write_callback See FLAC__StreamDecoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param error_callback See FLAC__StreamDecoderErrorCallback. This
+ * pointer must not be \c NULL.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__StreamDecoderInitStatus
+ * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
+ FLAC__StreamDecoder *decoder,
+ const char *filename,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
+);
+
+/** Finish the decoding process.
+ * Flushes the decoding buffer, releases resources, resets the decoder
+ * settings to their defaults, and returns the decoder state to
+ * FLAC__STREAM_DECODER_UNINITIALIZED.
+ *
+ * In the event of a prematurely-terminated decode, it is not strictly
+ * necessary to call this immediately before FLAC__stream_decoder_delete()
+ * but it is good practice to match every FLAC__stream_decoder_init_*()
+ * with a FLAC__stream_decoder_finish().
+ *
+ * \param decoder An uninitialized decoder instance.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if MD5 checking is on AND a STREAMINFO block was available
+ * AND the MD5 signature in the STREAMINFO block was non-zero AND the
+ * signature does not match the one computed by the decoder; else
+ * \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
+
+/** Flush the stream input.
+ * The decoder's input buffer will be cleared and the state set to
+ * \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC. This will also turn
+ * off MD5 checking.
+ *
+ * \param decoder A decoder instance.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false if a memory allocation
+ * error occurs (in which case the state will be set to
+ * \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR).
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
+
+/** Reset the decoding process.
+ * The decoder's input buffer will be cleared and the state set to
+ * \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. This is similar to
+ * FLAC__stream_decoder_finish() except that the settings are
+ * preserved; there is no need to call FLAC__stream_decoder_init_*()
+ * before decoding again. MD5 checking will be restored to its original
+ * setting.
+ *
+ * If the decoder is seekable, or was initialized with
+ * FLAC__stream_decoder_init*_FILE() or FLAC__stream_decoder_init*_file(),
+ * the decoder will also attempt to seek to the beginning of the file.
+ * If this rewind fails, this function will return \c false. It follows
+ * that FLAC__stream_decoder_reset() cannot be used when decoding from
+ * \c stdin.
+ *
+ * If the decoder was initialized with FLAC__stream_encoder_init*_stream()
+ * and is not seekable (i.e. no seek callback was provided or the seek
+ * callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it
+ * is the duty of the client to start feeding data from the beginning of
+ * the stream on the next FLAC__stream_decoder_process() or
+ * FLAC__stream_decoder_process_interleaved() call.
+ *
+ * \param decoder A decoder instance.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false if a memory allocation occurs
+ * (in which case the state will be set to
+ * \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) or a seek error
+ * occurs (the state will be unchanged).
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
+
+/** Decode one metadata block or audio frame.
+ * This version instructs the decoder to decode a either a single metadata
+ * block or a single frame and stop, unless the callbacks return a fatal
+ * error or the read callback returns
+ * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
+ *
+ * As the decoder needs more input it will call the read callback.
+ * Depending on what was decoded, the metadata or write callback will be
+ * called with the decoded metadata block or audio frame.
+ *
+ * Unless there is a fatal read error or end of stream, this function
+ * will return once one whole frame is decoded. In other words, if the
+ * stream is not synchronized or points to a corrupt frame header, the
+ * decoder will continue to try and resync until it gets to a valid
+ * frame, then decode one frame, then return. If the decoder points to
+ * a frame whose frame CRC in the frame footer does not match the
+ * computed frame CRC, this function will issue a
+ * FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH error to the
+ * error callback, and return, having decoded one complete, although
+ * corrupt, frame. (Such corrupted frames are sent as silence of the
+ * correct length to the write callback.)
+ *
+ * \param decoder An initialized decoder instance.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if any fatal read, write, or memory allocation error
+ * occurred (meaning decoding must stop), else \c true; for more
+ * information about the decoder, check the decoder state with
+ * FLAC__stream_decoder_get_state().
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
+
+/** Decode until the end of the metadata.
+ * This version instructs the decoder to decode from the current position
+ * and continue until all the metadata has been read, or until the
+ * callbacks return a fatal error or the read callback returns
+ * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
+ *
+ * As the decoder needs more input it will call the read callback.
+ * As each metadata block is decoded, the metadata callback will be called
+ * with the decoded metadata.
+ *
+ * \param decoder An initialized decoder instance.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if any fatal read, write, or memory allocation error
+ * occurred (meaning decoding must stop), else \c true; for more
+ * information about the decoder, check the decoder state with
+ * FLAC__stream_decoder_get_state().
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
+
+/** Decode until the end of the stream.
+ * This version instructs the decoder to decode from the current position
+ * and continue until the end of stream (the read callback returns
+ * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the
+ * callbacks return a fatal error.
+ *
+ * As the decoder needs more input it will call the read callback.
+ * As each metadata block and frame is decoded, the metadata or write
+ * callback will be called with the decoded metadata or frame.
+ *
+ * \param decoder An initialized decoder instance.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if any fatal read, write, or memory allocation error
+ * occurred (meaning decoding must stop), else \c true; for more
+ * information about the decoder, check the decoder state with
+ * FLAC__stream_decoder_get_state().
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
+
+/** Skip one audio frame.
+ * This version instructs the decoder to 'skip' a single frame and stop,
+ * unless the callbacks return a fatal error or the read callback returns
+ * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
+ *
+ * The decoding flow is the same as what occurs when
+ * FLAC__stream_decoder_process_single() is called to process an audio
+ * frame, except that this function does not decode the parsed data into
+ * PCM or call the write callback. The integrity of the frame is still
+ * checked the same way as in the other process functions.
+ *
+ * This function will return once one whole frame is skipped, in the
+ * same way that FLAC__stream_decoder_process_single() will return once
+ * one whole frame is decoded.
+ *
+ * This function can be used in more quickly determining FLAC frame
+ * boundaries when decoding of the actual data is not needed, for
+ * example when an application is separating a FLAC stream into frames
+ * for editing or storing in a container. To do this, the application
+ * can use FLAC__stream_decoder_skip_single_frame() to quickly advance
+ * to the next frame, then use
+ * FLAC__stream_decoder_get_decode_position() to find the new frame
+ * boundary.
+ *
+ * This function should only be called when the stream has advanced
+ * past all the metadata, otherwise it will return \c false.
+ *
+ * \param decoder An initialized decoder instance not in a metadata
+ * state.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if any fatal read, write, or memory allocation error
+ * occurred (meaning decoding must stop), or if the decoder
+ * is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or
+ * FLAC__STREAM_DECODER_READ_METADATA state, else \c true; for more
+ * information about the decoder, check the decoder state with
+ * FLAC__stream_decoder_get_state().
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder);
+
+/** Flush the input and seek to an absolute sample.
+ * Decoding will resume at the given sample. Note that because of
+ * this, the next write callback may contain a partial block. The
+ * client must support seeking the input or this function will fail
+ * and return \c false. Furthermore, if the decoder state is
+ * \c FLAC__STREAM_DECODER_SEEK_ERROR, then the decoder must be flushed
+ * with FLAC__stream_decoder_flush() or reset with
+ * FLAC__stream_decoder_reset() before decoding can continue.
+ *
+ * \param decoder A decoder instance.
+ * \param sample The target sample number to seek to.
+ * \assert
+ * \code decoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false.
+ */
+FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample);
- /** Maps a FLAC__StreamDecoderTellStatus to a C string.
- *
- * Using a FLAC__StreamDecoderTellStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[];
-
-
- /** Return values for the FLAC__StreamDecoder length callback.
- */
- typedef enum
- {
-
- FLAC__STREAM_DECODER_LENGTH_STATUS_OK,
- /**< The length call was OK and decoding can continue. */
-
- FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR,
- /**< An unrecoverable error occurred. The decoder will return from the process call. */
-
- FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
- /**< Client does not support reporting the length. */
-
- } FLAC__StreamDecoderLengthStatus;
-
- /** Maps a FLAC__StreamDecoderLengthStatus to a C string.
- *
- * Using a FLAC__StreamDecoderLengthStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[];
-
-
- /** Return values for the FLAC__StreamDecoder write callback.
- */
- typedef enum
- {
-
- FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
- /**< The write was OK and decoding can continue. */
-
- FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
- /**< An unrecoverable error occurred. The decoder will return from the process call. */
-
- } FLAC__StreamDecoderWriteStatus;
-
- /** Maps a FLAC__StreamDecoderWriteStatus to a C string.
- *
- * Using a FLAC__StreamDecoderWriteStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
-
-
- /** Possible values passed back to the FLAC__StreamDecoder error callback.
- * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC is the generic catch-
- * all. The rest could be caused by bad sync (false synchronization on
- * data that is not the start of a frame) or corrupted data. The error
- * itself is the decoder's best guess at what happened assuming a correct
- * sync. For example \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
- * could be caused by a correct sync on the start of a frame, but some
- * data in the frame header was corrupted. Or it could be the result of
- * syncing on a point the stream that looked like the starting of a frame
- * but was not. \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
- * could be because the decoder encountered a valid frame made by a future
- * version of the encoder which it cannot parse, or because of a false
- * sync making it appear as though an encountered frame was generated by
- * a future encoder.
- */
- typedef enum
- {
-
- FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
- /**< An error in the stream caused the decoder to lose synchronization. */
-
- FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
- /**< The decoder encountered a corrupted frame header. */
-
- FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
- /**< The frame's data did not match the CRC in the footer. */
-
- FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
- /**< The decoder encountered reserved fields in use in the stream. */
-
- } FLAC__StreamDecoderErrorStatus;
-
- /** Maps a FLAC__StreamDecoderErrorStatus to a C string.
- *
- * Using a FLAC__StreamDecoderErrorStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
-
-
- /***********************************************************************
- *
- * class FLAC__StreamDecoder
- *
- ***********************************************************************/
-
- struct FLAC__StreamDecoderProtected;
- struct FLAC__StreamDecoderPrivate;
- /** The opaque structure definition for the stream decoder type.
- * See the \link flac_stream_decoder stream decoder module \endlink
- * for a detailed description.
- */
- typedef struct
- {
- struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
- struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
- } FLAC__StreamDecoder;
-
- /** Signature for the read callback.
- *
- * A function pointer matching this signature must be passed to
- * FLAC__stream_decoder_init*_stream(). The supplied function will be
- * called when the decoder needs more input data. The address of the
- * buffer to be filled is supplied, along with the number of bytes the
- * buffer can hold. The callback may choose to supply less data and
- * modify the byte count but must be careful not to overflow the buffer.
- * The callback then returns a status code chosen from
- * FLAC__StreamDecoderReadStatus.
- *
- * Here is an example of a read callback for stdio streams:
- * \code
- * FLAC__StreamDecoderReadStatus read_cb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * if(*bytes > 0) {
- * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
- * if(ferror(file))
- * return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
- * else if(*bytes == 0)
- * return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
- * else
- * return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
- * }
- * else
- * return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param buffer A pointer to a location for the callee to store
- * data to be decoded.
- * \param bytes A pointer to the size of the buffer. On entry
- * to the callback, it contains the maximum number
- * of bytes that may be stored in \a buffer. The
- * callee must set it to the actual number of bytes
- * stored (0 in case of error or end-of-stream) before
- * returning.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- * \retval FLAC__StreamDecoderReadStatus
- * The callee's return status. Note that the callback should return
- * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM if and only if
- * zero bytes were read and there is no more data to be read.
- */
- typedef FLAC__StreamDecoderReadStatus(*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
-
- /** Signature for the seek callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_decoder_init*_stream(). The supplied function will be
- * called when the decoder needs to seek the input stream. The decoder
- * will pass the absolute byte offset to seek to, 0 meaning the
- * beginning of the stream.
- *
- * Here is an example of a seek callback for stdio streams:
- * \code
- * FLAC__StreamDecoderSeekStatus seek_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * if(file == stdin)
- * return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
- * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
- * return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
- * else
- * return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param absolute_byte_offset The offset from the beginning of the stream
- * to seek to.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- * \retval FLAC__StreamDecoderSeekStatus
- * The callee's return status.
- */
- typedef FLAC__StreamDecoderSeekStatus(*FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
-
- /** Signature for the tell callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_decoder_init*_stream(). The supplied function will be
- * called when the decoder wants to know the current position of the
- * stream. The callback should return the byte offset from the
- * beginning of the stream.
- *
- * Here is an example of a tell callback for stdio streams:
- * \code
- * FLAC__StreamDecoderTellStatus tell_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * off_t pos;
- * if(file == stdin)
- * return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
- * else if((pos = ftello(file)) < 0)
- * return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
- * else {
- * *absolute_byte_offset = (FLAC__uint64)pos;
- * return FLAC__STREAM_DECODER_TELL_STATUS_OK;
- * }
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param absolute_byte_offset A pointer to storage for the current offset
- * from the beginning of the stream.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- * \retval FLAC__StreamDecoderTellStatus
- * The callee's return status.
- */
- typedef FLAC__StreamDecoderTellStatus(*FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
-
- /** Signature for the length callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_decoder_init*_stream(). The supplied function will be
- * called when the decoder wants to know the total length of the stream
- * in bytes.
- *
- * Here is an example of a length callback for stdio streams:
- * \code
- * FLAC__StreamDecoderLengthStatus length_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * struct stat filestats;
- *
- * if(file == stdin)
- * return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
- * else if(fstat(fileno(file), &filestats) != 0)
- * return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
- * else {
- * *stream_length = (FLAC__uint64)filestats.st_size;
- * return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
- * }
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param stream_length A pointer to storage for the length of the stream
- * in bytes.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- * \retval FLAC__StreamDecoderLengthStatus
- * The callee's return status.
- */
- typedef FLAC__StreamDecoderLengthStatus(*FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
-
- /** Signature for the EOF callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_decoder_init*_stream(). The supplied function will be
- * called when the decoder needs to know if the end of the stream has
- * been reached.
- *
- * Here is an example of a EOF callback for stdio streams:
- * FLAC__bool eof_cb(const FLAC__StreamDecoder *decoder, void *client_data)
- * \code
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * return feof(file)? true : false;
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- * \retval FLAC__bool
- * \c true if the currently at the end of the stream, else \c false.
- */
- typedef FLAC__bool(*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data);
-
- /** Signature for the write callback.
- *
- * A function pointer matching this signature must be passed to one of
- * the FLAC__stream_decoder_init_*() functions.
- * The supplied function will be called when the decoder has decoded a
- * single audio frame. The decoder will pass the frame metadata as well
- * as an array of pointers (one for each channel) pointing to the
- * decoded audio.
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param frame The description of the decoded frame. See
- * FLAC__Frame.
- * \param buffer An array of pointers to decoded channels of data.
- * Each pointer will point to an array of signed
- * samples of length \a frame->header.blocksize.
- * Channels will be ordered according to the FLAC
- * specification; see the documentation for the
- * <A HREF="../format.html#frame_header">frame header</A>.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- * \retval FLAC__StreamDecoderWriteStatus
- * The callee's return status.
- */
- typedef FLAC__StreamDecoderWriteStatus(*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
-
- /** Signature for the metadata callback.
- *
- * A function pointer matching this signature must be passed to one of
- * the FLAC__stream_decoder_init_*() functions.
- * The supplied function will be called when the decoder has decoded a
- * metadata block. In a valid FLAC file there will always be one
- * \c STREAMINFO block, followed by zero or more other metadata blocks.
- * These will be supplied by the decoder in the same order as they
- * appear in the stream and always before the first audio frame (i.e.
- * write callback). The metadata block that is passed in must not be
- * modified, and it doesn't live beyond the callback, so you should make
- * a copy of it with FLAC__metadata_object_clone() if you will need it
- * elsewhere. Since metadata blocks can potentially be large, by
- * default the decoder only calls the metadata callback for the
- * \c STREAMINFO block; you can instruct the decoder to pass or filter
- * other blocks with FLAC__stream_decoder_set_metadata_*() calls.
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param metadata The decoded metadata block.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- */
- typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
-
- /** Signature for the error callback.
- *
- * A function pointer matching this signature must be passed to one of
- * the FLAC__stream_decoder_init_*() functions.
- * The supplied function will be called whenever an error occurs during
- * decoding.
- *
- * \note In general, FLAC__StreamDecoder functions which change the
- * state should not be called on the \a decoder while in the callback.
- *
- * \param decoder The decoder instance calling the callback.
- * \param status The error encountered by the decoder.
- * \param client_data The callee's client data set through
- * FLAC__stream_decoder_init_*().
- */
- typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
-
-
- /***********************************************************************
- *
- * Class constructor/destructor
- *
- ***********************************************************************/
-
- /** Create a new stream decoder instance. The instance is created with
- * default settings; see the individual FLAC__stream_decoder_set_*()
- * functions for each setting's default.
- *
- * \retval FLAC__StreamDecoder*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void);
-
- /** Free a decoder instance. Deletes the object pointed to by \a decoder.
- *
- * \param decoder A pointer to an existing decoder.
- * \assert
- * \code decoder != NULL \endcode
- */
- FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
-
-
- /***********************************************************************
- *
- * Public class method prototypes
- *
- ***********************************************************************/
-
- /** Set the serial number for the FLAC stream within the Ogg container.
- * The default behavior is to use the serial number of the first Ogg
- * page. Setting a serial number here will explicitly specify which
- * stream is to be decoded.
- *
- * \note
- * This does not need to be set for native FLAC decoding.
- *
- * \default \c use serial number of first page
- * \param decoder A decoder instance to set.
- * \param serial_number See above.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number);
-
- /** Set the "MD5 signature checking" flag. If \c true, the decoder will
- * compute the MD5 signature of the unencoded audio data while decoding
- * and compare it to the signature from the STREAMINFO block, if it
- * exists, during FLAC__stream_decoder_finish().
- *
- * MD5 signature checking will be turned off (until the next
- * FLAC__stream_decoder_reset()) if there is no signature in the
- * STREAMINFO block or when a seek is attempted.
- *
- * Clients that do not use the MD5 check should leave this off to speed
- * up decoding.
- *
- * \default \c false
- * \param decoder A decoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value);
-
- /** Direct the decoder to pass on all metadata blocks of type \a type.
- *
- * \default By default, only the \c STREAMINFO block is returned via the
- * metadata callback.
- * \param decoder A decoder instance to set.
- * \param type See above.
- * \assert
- * \code decoder != NULL \endcode
- * \a type is valid
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
-
- /** Direct the decoder to pass on all APPLICATION metadata blocks of the
- * given \a id.
- *
- * \default By default, only the \c STREAMINFO block is returned via the
- * metadata callback.
- * \param decoder A decoder instance to set.
- * \param id See above.
- * \assert
- * \code decoder != NULL \endcode
- * \code id != NULL \endcode
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
-
- /** Direct the decoder to pass on all metadata blocks of any type.
- *
- * \default By default, only the \c STREAMINFO block is returned via the
- * metadata callback.
- * \param decoder A decoder instance to set.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
-
- /** Direct the decoder to filter out all metadata blocks of type \a type.
- *
- * \default By default, only the \c STREAMINFO block is returned via the
- * metadata callback.
- * \param decoder A decoder instance to set.
- * \param type See above.
- * \assert
- * \code decoder != NULL \endcode
- * \a type is valid
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
-
- /** Direct the decoder to filter out all APPLICATION metadata blocks of
- * the given \a id.
- *
- * \default By default, only the \c STREAMINFO block is returned via the
- * metadata callback.
- * \param decoder A decoder instance to set.
- * \param id See above.
- * \assert
- * \code decoder != NULL \endcode
- * \code id != NULL \endcode
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
-
- /** Direct the decoder to filter out all metadata blocks of any type.
- *
- * \default By default, only the \c STREAMINFO block is returned via the
- * metadata callback.
- * \param decoder A decoder instance to set.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the decoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
-
- /** Get the current decoder state.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__StreamDecoderState
- * The current decoder state.
- */
- FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
-
- /** Get the current decoder state as a C string.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval const char *
- * The decoder state as a C string. Do not modify the contents.
- */
- FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
-
- /** Get the "MD5 signature checking" flag.
- * This is the value of the setting, not whether or not the decoder is
- * currently checking the MD5 (remember, it can be turned off automatically
- * by a seek). When the decoder is reset the flag will be restored to the
- * value returned by this function.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * See above.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder);
-
- /** Get the total number of samples in the stream being decoded.
- * Will only be valid after decoding has started and will contain the
- * value from the \c STREAMINFO block. A value of \c 0 means "unknown".
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval unsigned
- * See above.
- */
- FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder);
-
- /** Get the current number of channels in the stream being decoded.
- * Will only be valid after decoding has started and will contain the
- * value from the most recently decoded frame header.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval unsigned
- * See above.
- */
- FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
-
- /** Get the current channel assignment in the stream being decoded.
- * Will only be valid after decoding has started and will contain the
- * value from the most recently decoded frame header.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__ChannelAssignment
- * See above.
- */
- FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
-
- /** Get the current sample resolution in the stream being decoded.
- * Will only be valid after decoding has started and will contain the
- * value from the most recently decoded frame header.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval unsigned
- * See above.
- */
- FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
-
- /** Get the current sample rate in Hz of the stream being decoded.
- * Will only be valid after decoding has started and will contain the
- * value from the most recently decoded frame header.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval unsigned
- * See above.
- */
- FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
-
- /** Get the current blocksize of the stream being decoded.
- * Will only be valid after decoding has started and will contain the
- * value from the most recently decoded frame header.
- *
- * \param decoder A decoder instance to query.
- * \assert
- * \code decoder != NULL \endcode
- * \retval unsigned
- * See above.
- */
- FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
-
- /** Returns the decoder's current read position within the stream.
- * The position is the byte offset from the start of the stream.
- * Bytes before this position have been fully decoded. Note that
- * there may still be undecoded bytes in the decoder's read FIFO.
- * The returned position is correct even after a seek.
- *
- * \warning This function currently only works for native FLAC,
- * not Ogg FLAC streams.
- *
- * \param decoder A decoder instance to query.
- * \param position Address at which to return the desired position.
- * \assert
- * \code decoder != NULL \endcode
- * \code position != NULL \endcode
- * \retval FLAC__bool
- * \c true if successful, \c false if the stream is not native FLAC,
- * or there was an error from the 'tell' callback or it returned
- * \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
-
- /** Initialize the decoder instance to decode native FLAC streams.
- *
- * This flavor of initialization sets up the decoder to decode from a
- * native FLAC stream. I/O is performed via callbacks to the client.
- * For decoding from a plain file via filename or open FILE*,
- * FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE()
- * provide a simpler interface.
- *
- * This function should be called after FLAC__stream_decoder_new() and
- * FLAC__stream_decoder_set_*() but before any of the
- * FLAC__stream_decoder_process_*() functions. Will set and return the
- * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
- * if initialization succeeded.
- *
- * \param decoder An uninitialized decoder instance.
- * \param read_callback See FLAC__StreamDecoderReadCallback. This
- * pointer must not be \c NULL.
- * \param seek_callback See FLAC__StreamDecoderSeekCallback. This
- * pointer may be \c NULL if seeking is not
- * supported. If \a seek_callback is not \c NULL then a
- * \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
- * Alternatively, a dummy seek callback that just
- * returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param tell_callback See FLAC__StreamDecoderTellCallback. This
- * pointer may be \c NULL if not supported by the client. If
- * \a seek_callback is not \c NULL then a
- * \a tell_callback must also be supplied.
- * Alternatively, a dummy tell callback that just
- * returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param length_callback See FLAC__StreamDecoderLengthCallback. This
- * pointer may be \c NULL if not supported by the client. If
- * \a seek_callback is not \c NULL then a
- * \a length_callback must also be supplied.
- * Alternatively, a dummy length callback that just
- * returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param eof_callback See FLAC__StreamDecoderEofCallback. This
- * pointer may be \c NULL if not supported by the client. If
- * \a seek_callback is not \c NULL then a
- * \a eof_callback must also be supplied.
- * Alternatively, a dummy length callback that just
- * returns \c false
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param write_callback See FLAC__StreamDecoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param error_callback See FLAC__StreamDecoderErrorCallback. This
- * pointer must not be \c NULL.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__StreamDecoderInitStatus
- * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
- FLAC__StreamDecoder *decoder,
- FLAC__StreamDecoderReadCallback read_callback,
- FLAC__StreamDecoderSeekCallback seek_callback,
- FLAC__StreamDecoderTellCallback tell_callback,
- FLAC__StreamDecoderLengthCallback length_callback,
- FLAC__StreamDecoderEofCallback eof_callback,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
- );
-
- /** Initialize the decoder instance to decode Ogg FLAC streams.
- *
- * This flavor of initialization sets up the decoder to decode from a
- * FLAC stream in an Ogg container. I/O is performed via callbacks to the
- * client. For decoding from a plain file via filename or open FILE*,
- * FLAC__stream_decoder_init_ogg_file() and FLAC__stream_decoder_init_ogg_FILE()
- * provide a simpler interface.
- *
- * This function should be called after FLAC__stream_decoder_new() and
- * FLAC__stream_decoder_set_*() but before any of the
- * FLAC__stream_decoder_process_*() functions. Will set and return the
- * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
- * if initialization succeeded.
- *
- * \note Support for Ogg FLAC in the library is optional. If this
- * library has been built without support for Ogg FLAC, this function
- * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
- *
- * \param decoder An uninitialized decoder instance.
- * \param read_callback See FLAC__StreamDecoderReadCallback. This
- * pointer must not be \c NULL.
- * \param seek_callback See FLAC__StreamDecoderSeekCallback. This
- * pointer may be \c NULL if seeking is not
- * supported. If \a seek_callback is not \c NULL then a
- * \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
- * Alternatively, a dummy seek callback that just
- * returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param tell_callback See FLAC__StreamDecoderTellCallback. This
- * pointer may be \c NULL if not supported by the client. If
- * \a seek_callback is not \c NULL then a
- * \a tell_callback must also be supplied.
- * Alternatively, a dummy tell callback that just
- * returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param length_callback See FLAC__StreamDecoderLengthCallback. This
- * pointer may be \c NULL if not supported by the client. If
- * \a seek_callback is not \c NULL then a
- * \a length_callback must also be supplied.
- * Alternatively, a dummy length callback that just
- * returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param eof_callback See FLAC__StreamDecoderEofCallback. This
- * pointer may be \c NULL if not supported by the client. If
- * \a seek_callback is not \c NULL then a
- * \a eof_callback must also be supplied.
- * Alternatively, a dummy length callback that just
- * returns \c false
- * may also be supplied, all though this is slightly
- * less efficient for the decoder.
- * \param write_callback See FLAC__StreamDecoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param error_callback See FLAC__StreamDecoderErrorCallback. This
- * pointer must not be \c NULL.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__StreamDecoderInitStatus
- * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
- FLAC__StreamDecoder *decoder,
- FLAC__StreamDecoderReadCallback read_callback,
- FLAC__StreamDecoderSeekCallback seek_callback,
- FLAC__StreamDecoderTellCallback tell_callback,
- FLAC__StreamDecoderLengthCallback length_callback,
- FLAC__StreamDecoderEofCallback eof_callback,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
- );
-
- /** Initialize the decoder instance to decode native FLAC files.
- *
- * This flavor of initialization sets up the decoder to decode from a
- * plain native FLAC file. For non-stdio streams, you must use
- * FLAC__stream_decoder_init_stream() and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_decoder_new() and
- * FLAC__stream_decoder_set_*() but before any of the
- * FLAC__stream_decoder_process_*() functions. Will set and return the
- * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
- * if initialization succeeded.
- *
- * \param decoder An uninitialized decoder instance.
- * \param file An open FLAC file. The file should have been
- * opened with mode \c "rb" and rewound. The file
- * becomes owned by the decoder and should not be
- * manipulated by the client while decoding.
- * Unless \a file is \c stdin, it will be closed
- * when FLAC__stream_decoder_finish() is called.
- * Note however that seeking will not work when
- * decoding from \c stdout since it is not seekable.
- * \param write_callback See FLAC__StreamDecoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param error_callback See FLAC__StreamDecoderErrorCallback. This
- * pointer must not be \c NULL.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code decoder != NULL \endcode
- * \code file != NULL \endcode
- * \retval FLAC__StreamDecoderInitStatus
- * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
- FLAC__StreamDecoder *decoder,
- FILE *file,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
- );
-
- /** Initialize the decoder instance to decode Ogg FLAC files.
- *
- * This flavor of initialization sets up the decoder to decode from a
- * plain Ogg FLAC file. For non-stdio streams, you must use
- * FLAC__stream_decoder_init_ogg_stream() and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_decoder_new() and
- * FLAC__stream_decoder_set_*() but before any of the
- * FLAC__stream_decoder_process_*() functions. Will set and return the
- * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
- * if initialization succeeded.
- *
- * \note Support for Ogg FLAC in the library is optional. If this
- * library has been built without support for Ogg FLAC, this function
- * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
- *
- * \param decoder An uninitialized decoder instance.
- * \param file An open FLAC file. The file should have been
- * opened with mode \c "rb" and rewound. The file
- * becomes owned by the decoder and should not be
- * manipulated by the client while decoding.
- * Unless \a file is \c stdin, it will be closed
- * when FLAC__stream_decoder_finish() is called.
- * Note however that seeking will not work when
- * decoding from \c stdout since it is not seekable.
- * \param write_callback See FLAC__StreamDecoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param error_callback See FLAC__StreamDecoderErrorCallback. This
- * pointer must not be \c NULL.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code decoder != NULL \endcode
- * \code file != NULL \endcode
- * \retval FLAC__StreamDecoderInitStatus
- * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
- FLAC__StreamDecoder *decoder,
- FILE *file,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
- );
-
- /** Initialize the decoder instance to decode native FLAC files.
- *
- * This flavor of initialization sets up the decoder to decode from a plain
- * native FLAC file. If POSIX fopen() semantics are not sufficient, (for
- * example, with Unicode filenames on Windows), you must use
- * FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
- * and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_decoder_new() and
- * FLAC__stream_decoder_set_*() but before any of the
- * FLAC__stream_decoder_process_*() functions. Will set and return the
- * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
- * if initialization succeeded.
- *
- * \param decoder An uninitialized decoder instance.
- * \param filename The name of the file to decode from. The file will
- * be opened with fopen(). Use \c NULL to decode from
- * \c stdin. Note that \c stdin is not seekable.
- * \param write_callback See FLAC__StreamDecoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param error_callback See FLAC__StreamDecoderErrorCallback. This
- * pointer must not be \c NULL.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__StreamDecoderInitStatus
- * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
- FLAC__StreamDecoder *decoder,
- const char *filename,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
- );
-
- /** Initialize the decoder instance to decode Ogg FLAC files.
- *
- * This flavor of initialization sets up the decoder to decode from a plain
- * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for
- * example, with Unicode filenames on Windows), you must use
- * FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
- * and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_decoder_new() and
- * FLAC__stream_decoder_set_*() but before any of the
- * FLAC__stream_decoder_process_*() functions. Will set and return the
- * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
- * if initialization succeeded.
- *
- * \note Support for Ogg FLAC in the library is optional. If this
- * library has been built without support for Ogg FLAC, this function
- * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
- *
- * \param decoder An uninitialized decoder instance.
- * \param filename The name of the file to decode from. The file will
- * be opened with fopen(). Use \c NULL to decode from
- * \c stdin. Note that \c stdin is not seekable.
- * \param write_callback See FLAC__StreamDecoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param error_callback See FLAC__StreamDecoderErrorCallback. This
- * pointer must not be \c NULL.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__StreamDecoderInitStatus
- * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamDecoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
- FLAC__StreamDecoder *decoder,
- const char *filename,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
- );
-
- /** Finish the decoding process.
- * Flushes the decoding buffer, releases resources, resets the decoder
- * settings to their defaults, and returns the decoder state to
- * FLAC__STREAM_DECODER_UNINITIALIZED.
- *
- * In the event of a prematurely-terminated decode, it is not strictly
- * necessary to call this immediately before FLAC__stream_decoder_delete()
- * but it is good practice to match every FLAC__stream_decoder_init_*()
- * with a FLAC__stream_decoder_finish().
- *
- * \param decoder An uninitialized decoder instance.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if MD5 checking is on AND a STREAMINFO block was available
- * AND the MD5 signature in the STREAMINFO block was non-zero AND the
- * signature does not match the one computed by the decoder; else
- * \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
-
- /** Flush the stream input.
- * The decoder's input buffer will be cleared and the state set to
- * \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC. This will also turn
- * off MD5 checking.
- *
- * \param decoder A decoder instance.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false if a memory allocation
- * error occurs (in which case the state will be set to
- * \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR).
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
-
- /** Reset the decoding process.
- * The decoder's input buffer will be cleared and the state set to
- * \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. This is similar to
- * FLAC__stream_decoder_finish() except that the settings are
- * preserved; there is no need to call FLAC__stream_decoder_init_*()
- * before decoding again. MD5 checking will be restored to its original
- * setting.
- *
- * If the decoder is seekable, or was initialized with
- * FLAC__stream_decoder_init*_FILE() or FLAC__stream_decoder_init*_file(),
- * the decoder will also attempt to seek to the beginning of the file.
- * If this rewind fails, this function will return \c false. It follows
- * that FLAC__stream_decoder_reset() cannot be used when decoding from
- * \c stdin.
- *
- * If the decoder was initialized with FLAC__stream_encoder_init*_stream()
- * and is not seekable (i.e. no seek callback was provided or the seek
- * callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it
- * is the duty of the client to start feeding data from the beginning of
- * the stream on the next FLAC__stream_decoder_process() or
- * FLAC__stream_decoder_process_interleaved() call.
- *
- * \param decoder A decoder instance.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false if a memory allocation occurs
- * (in which case the state will be set to
- * \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) or a seek error
- * occurs (the state will be unchanged).
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
-
- /** Decode one metadata block or audio frame.
- * This version instructs the decoder to decode a either a single metadata
- * block or a single frame and stop, unless the callbacks return a fatal
- * error or the read callback returns
- * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
- *
- * As the decoder needs more input it will call the read callback.
- * Depending on what was decoded, the metadata or write callback will be
- * called with the decoded metadata block or audio frame.
- *
- * Unless there is a fatal read error or end of stream, this function
- * will return once one whole frame is decoded. In other words, if the
- * stream is not synchronized or points to a corrupt frame header, the
- * decoder will continue to try and resync until it gets to a valid
- * frame, then decode one frame, then return. If the decoder points to
- * a frame whose frame CRC in the frame footer does not match the
- * computed frame CRC, this function will issue a
- * FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH error to the
- * error callback, and return, having decoded one complete, although
- * corrupt, frame. (Such corrupted frames are sent as silence of the
- * correct length to the write callback.)
- *
- * \param decoder An initialized decoder instance.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if any fatal read, write, or memory allocation error
- * occurred (meaning decoding must stop), else \c true; for more
- * information about the decoder, check the decoder state with
- * FLAC__stream_decoder_get_state().
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
-
- /** Decode until the end of the metadata.
- * This version instructs the decoder to decode from the current position
- * and continue until all the metadata has been read, or until the
- * callbacks return a fatal error or the read callback returns
- * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
- *
- * As the decoder needs more input it will call the read callback.
- * As each metadata block is decoded, the metadata callback will be called
- * with the decoded metadata.
- *
- * \param decoder An initialized decoder instance.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if any fatal read, write, or memory allocation error
- * occurred (meaning decoding must stop), else \c true; for more
- * information about the decoder, check the decoder state with
- * FLAC__stream_decoder_get_state().
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
-
- /** Decode until the end of the stream.
- * This version instructs the decoder to decode from the current position
- * and continue until the end of stream (the read callback returns
- * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the
- * callbacks return a fatal error.
- *
- * As the decoder needs more input it will call the read callback.
- * As each metadata block and frame is decoded, the metadata or write
- * callback will be called with the decoded metadata or frame.
- *
- * \param decoder An initialized decoder instance.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if any fatal read, write, or memory allocation error
- * occurred (meaning decoding must stop), else \c true; for more
- * information about the decoder, check the decoder state with
- * FLAC__stream_decoder_get_state().
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
-
- /** Skip one audio frame.
- * This version instructs the decoder to 'skip' a single frame and stop,
- * unless the callbacks return a fatal error or the read callback returns
- * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
- *
- * The decoding flow is the same as what occurs when
- * FLAC__stream_decoder_process_single() is called to process an audio
- * frame, except that this function does not decode the parsed data into
- * PCM or call the write callback. The integrity of the frame is still
- * checked the same way as in the other process functions.
- *
- * This function will return once one whole frame is skipped, in the
- * same way that FLAC__stream_decoder_process_single() will return once
- * one whole frame is decoded.
- *
- * This function can be used in more quickly determining FLAC frame
- * boundaries when decoding of the actual data is not needed, for
- * example when an application is separating a FLAC stream into frames
- * for editing or storing in a container. To do this, the application
- * can use FLAC__stream_decoder_skip_single_frame() to quickly advance
- * to the next frame, then use
- * FLAC__stream_decoder_get_decode_position() to find the new frame
- * boundary.
- *
- * This function should only be called when the stream has advanced
- * past all the metadata, otherwise it will return \c false.
- *
- * \param decoder An initialized decoder instance not in a metadata
- * state.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if any fatal read, write, or memory allocation error
- * occurred (meaning decoding must stop), or if the decoder
- * is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or
- * FLAC__STREAM_DECODER_READ_METADATA state, else \c true; for more
- * information about the decoder, check the decoder state with
- * FLAC__stream_decoder_get_state().
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder);
-
- /** Flush the input and seek to an absolute sample.
- * Decoding will resume at the given sample. Note that because of
- * this, the next write callback may contain a partial block. The
- * client must support seeking the input or this function will fail
- * and return \c false. Furthermore, if the decoder state is
- * \c FLAC__STREAM_DECODER_SEEK_ERROR, then the decoder must be flushed
- * with FLAC__stream_decoder_flush() or reset with
- * FLAC__stream_decoder_reset() before decoding can continue.
- *
- * \param decoder A decoder instance.
- * \param sample The target sample number to seek to.
- * \assert
- * \code decoder != NULL \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false.
- */
- FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample);
-
- /* \} */
+/* \} */
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_encoder.h b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_encoder.h
index e00ae6c56..f5bad11bf 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_encoder.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/FLAC/stream_encoder.h
@@ -42,1731 +42,1724 @@ extern "C" {
#endif
- /** \file include/FLAC/stream_encoder.h
- *
- * \brief
- * This module contains the functions which implement the stream
- * encoder.
- *
- * See the detailed documentation in the
- * \link flac_stream_encoder stream encoder \endlink module.
- */
-
- /** \defgroup flac_encoder FLAC/ \*_encoder.h: encoder interfaces
- * \ingroup flac
- *
- * \brief
- * This module describes the encoder layers provided by libFLAC.
- *
- * The stream encoder can be used to encode complete streams either to the
- * client via callbacks, or directly to a file, depending on how it is
- * initialized. When encoding via callbacks, the client provides a write
- * callback which will be called whenever FLAC data is ready to be written.
- * If the client also supplies a seek callback, the encoder will also
- * automatically handle the writing back of metadata discovered while
- * encoding, like stream info, seek points offsets, etc. When encoding to
- * a file, the client needs only supply a filename or open \c FILE* and an
- * optional progress callback for periodic notification of progress; the
- * write and seek callbacks are supplied internally. For more info see the
- * \link flac_stream_encoder stream encoder \endlink module.
- */
-
- /** \defgroup flac_stream_encoder FLAC/stream_encoder.h: stream encoder interface
- * \ingroup flac_encoder
- *
- * \brief
- * This module contains the functions which implement the stream
- * encoder.
- *
- * The stream encoder can encode to native FLAC, and optionally Ogg FLAC
- * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
- *
- * The basic usage of this encoder is as follows:
- * - The program creates an instance of an encoder using
- * FLAC__stream_encoder_new().
- * - The program overrides the default settings using
- * FLAC__stream_encoder_set_*() functions. At a minimum, the following
- * functions should be called:
- * - FLAC__stream_encoder_set_channels()
- * - FLAC__stream_encoder_set_bits_per_sample()
- * - FLAC__stream_encoder_set_sample_rate()
- * - FLAC__stream_encoder_set_ogg_serial_number() (if encoding to Ogg FLAC)
- * - FLAC__stream_encoder_set_total_samples_estimate() (if known)
- * - If the application wants to control the compression level or set its own
- * metadata, then the following should also be called:
- * - FLAC__stream_encoder_set_compression_level()
- * - FLAC__stream_encoder_set_verify()
- * - FLAC__stream_encoder_set_metadata()
- * - The rest of the set functions should only be called if the client needs
- * exact control over how the audio is compressed; thorough understanding
- * of the FLAC format is necessary to achieve good results.
- * - The program initializes the instance to validate the settings and
- * prepare for encoding using
- * - FLAC__stream_encoder_init_stream() or FLAC__stream_encoder_init_FILE()
- * or FLAC__stream_encoder_init_file() for native FLAC
- * - FLAC__stream_encoder_init_ogg_stream() or FLAC__stream_encoder_init_ogg_FILE()
- * or FLAC__stream_encoder_init_ogg_file() for Ogg FLAC
- * - The program calls FLAC__stream_encoder_process() or
- * FLAC__stream_encoder_process_interleaved() to encode data, which
- * subsequently calls the callbacks when there is encoder data ready
- * to be written.
- * - The program finishes the encoding with FLAC__stream_encoder_finish(),
- * which causes the encoder to encode any data still in its input pipe,
- * update the metadata with the final encoding statistics if output
- * seeking is possible, and finally reset the encoder to the
- * uninitialized state.
- * - The instance may be used again or deleted with
- * FLAC__stream_encoder_delete().
- *
- * In more detail, the stream encoder functions similarly to the
- * \link flac_stream_decoder stream decoder \endlink, but has fewer
- * callbacks and more options. Typically the client will create a new
- * instance by calling FLAC__stream_encoder_new(), then set the necessary
- * parameters with FLAC__stream_encoder_set_*(), and initialize it by
- * calling one of the FLAC__stream_encoder_init_*() functions.
- *
- * Unlike the decoders, the stream encoder has many options that can
- * affect the speed and compression ratio. When setting these parameters
- * you should have some basic knowledge of the format (see the
- * <A HREF="../documentation.html#format">user-level documentation</A>
- * or the <A HREF="../format.html">formal description</A>). The
- * FLAC__stream_encoder_set_*() functions themselves do not validate the
- * values as many are interdependent. The FLAC__stream_encoder_init_*()
- * functions will do this, so make sure to pay attention to the state
- * returned by FLAC__stream_encoder_init_*() to make sure that it is
- * FLAC__STREAM_ENCODER_INIT_STATUS_OK. Any parameters that are not set
- * before FLAC__stream_encoder_init_*() will take on the defaults from
- * the constructor.
- *
- * There are three initialization functions for native FLAC, one for
- * setting up the encoder to encode FLAC data to the client via
- * callbacks, and two for encoding directly to a file.
- *
- * For encoding via callbacks, use FLAC__stream_encoder_init_stream().
- * You must also supply a write callback which will be called anytime
- * there is raw encoded data to write. If the client can seek the output
- * it is best to also supply seek and tell callbacks, as this allows the
- * encoder to go back after encoding is finished to write back
- * information that was collected while encoding, like seek point offsets,
- * frame sizes, etc.
- *
- * For encoding directly to a file, use FLAC__stream_encoder_init_FILE()
- * or FLAC__stream_encoder_init_file(). Then you must only supply a
- * filename or open \c FILE*; the encoder will handle all the callbacks
- * internally. You may also supply a progress callback for periodic
- * notification of the encoding progress.
- *
- * There are three similarly-named init functions for encoding to Ogg
- * FLAC streams. Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
- * library has been built with Ogg support.
- *
- * The call to FLAC__stream_encoder_init_*() currently will also immediately
- * call the write callback several times, once with the \c fLaC signature,
- * and once for each encoded metadata block. Note that for Ogg FLAC
- * encoding you will usually get at least twice the number of callbacks than
- * with native FLAC, one for the Ogg page header and one for the page body.
- *
- * After initializing the instance, the client may feed audio data to the
- * encoder in one of two ways:
- *
- * - Channel separate, through FLAC__stream_encoder_process() - The client
- * will pass an array of pointers to buffers, one for each channel, to
- * the encoder, each of the same length. The samples need not be
- * block-aligned, but each channel should have the same number of samples.
- * - Channel interleaved, through
- * FLAC__stream_encoder_process_interleaved() - The client will pass a single
- * pointer to data that is channel-interleaved (i.e. channel0_sample0,
- * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
- * Again, the samples need not be block-aligned but they must be
- * sample-aligned, i.e. the first value should be channel0_sample0 and
- * the last value channelN_sampleM.
- *
- * Note that for either process call, each sample in the buffers should be a
- * signed integer, right-justified to the resolution set by
- * FLAC__stream_encoder_set_bits_per_sample(). For example, if the resolution
- * is 16 bits per sample, the samples should all be in the range [-32768,32767].
- *
- * When the client is finished encoding data, it calls
- * FLAC__stream_encoder_finish(), which causes the encoder to encode any
- * data still in its input pipe, and call the metadata callback with the
- * final encoding statistics. Then the instance may be deleted with
- * FLAC__stream_encoder_delete() or initialized again to encode another
- * stream.
- *
- * For programs that write their own metadata, but that do not know the
- * actual metadata until after encoding, it is advantageous to instruct
- * the encoder to write a PADDING block of the correct size, so that
- * instead of rewriting the whole stream after encoding, the program can
- * just overwrite the PADDING block. If only the maximum size of the
- * metadata is known, the program can write a slightly larger padding
- * block, then split it after encoding.
- *
- * Make sure you understand how lengths are calculated. All FLAC metadata
- * blocks have a 4 byte header which contains the type and length. This
- * length does not include the 4 bytes of the header. See the format page
- * for the specification of metadata blocks and their lengths.
- *
- * \note
- * If you are writing the FLAC data to a file via callbacks, make sure it
- * is open for update (e.g. mode "w+" for stdio streams). This is because
- * after the first encoding pass, the encoder will try to seek back to the
- * beginning of the stream, to the STREAMINFO block, to write some data
- * there. (If using FLAC__stream_encoder_init*_file() or
- * FLAC__stream_encoder_init*_FILE(), the file is managed internally.)
- *
- * \note
- * The "set" functions may only be called when the encoder is in the
- * state FLAC__STREAM_ENCODER_UNINITIALIZED, i.e. after
- * FLAC__stream_encoder_new() or FLAC__stream_encoder_finish(), but
- * before FLAC__stream_encoder_init_*(). If this is the case they will
- * return \c true, otherwise \c false.
- *
- * \note
- * FLAC__stream_encoder_finish() resets all settings to the constructor
- * defaults.
- *
- * \{
- */
-
-
- /** State values for a FLAC__StreamEncoder.
- *
- * The encoder's state can be obtained by calling FLAC__stream_encoder_get_state().
- *
- * If the encoder gets into any other state besides \c FLAC__STREAM_ENCODER_OK
- * or \c FLAC__STREAM_ENCODER_UNINITIALIZED, it becomes invalid for encoding and
- * must be deleted with FLAC__stream_encoder_delete().
- */
- typedef enum {
-
- FLAC__STREAM_ENCODER_OK = 0,
- /**< The encoder is in the normal OK state and samples can be processed. */
-
- FLAC__STREAM_ENCODER_UNINITIALIZED,
- /**< The encoder is in the uninitialized state; one of the
- * FLAC__stream_encoder_init_*() functions must be called before samples
- * can be processed.
- */
-
- FLAC__STREAM_ENCODER_OGG_ERROR,
- /**< An error occurred in the underlying Ogg layer. */
-
- FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
- /**< An error occurred in the underlying verify stream decoder;
- * check FLAC__stream_encoder_get_verify_decoder_state().
- */
-
- FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
- /**< The verify decoder detected a mismatch between the original
- * audio signal and the decoded audio signal.
- */
-
- FLAC__STREAM_ENCODER_CLIENT_ERROR,
- /**< One of the callbacks returned a fatal error. */
-
- FLAC__STREAM_ENCODER_IO_ERROR,
- /**< An I/O error occurred while opening/reading/writing a file.
- * Check \c errno.
- */
-
- FLAC__STREAM_ENCODER_FRAMING_ERROR,
- /**< An error occurred while writing the stream; usually, the
- * write_callback returned an error.
- */
-
- FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR
- /**< Memory allocation failed. */
-
- }
- FLAC__StreamEncoderState;
-
- /** Maps a FLAC__StreamEncoderState to a C string.
- *
- * Using a FLAC__StreamEncoderState as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
-
-
- /** Possible return values for the FLAC__stream_encoder_init_*() functions.
- */
- typedef enum
- {
-
- FLAC__STREAM_ENCODER_INIT_STATUS_OK = 0,
- /**< Initialization was successful. */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR,
- /**< General failure to set up encoder; call FLAC__stream_encoder_get_state() for cause. */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
- /**< The library was not compiled with support for the given container
- * format.
- */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS,
- /**< A required callback was not supplied. */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS,
- /**< The encoder has an invalid setting for number of channels. */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE,
- /**< The encoder has an invalid setting for bits-per-sample.
- * FLAC supports 4-32 bps but the reference encoder currently supports
- * only up to 24 bps.
- */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE,
- /**< The encoder has an invalid setting for the input sample rate. */
+/** \file include/FLAC/stream_encoder.h
+ *
+ * \brief
+ * This module contains the functions which implement the stream
+ * encoder.
+ *
+ * See the detailed documentation in the
+ * \link flac_stream_encoder stream encoder \endlink module.
+ */
+
+/** \defgroup flac_encoder FLAC/ \*_encoder.h: encoder interfaces
+ * \ingroup flac
+ *
+ * \brief
+ * This module describes the encoder layers provided by libFLAC.
+ *
+ * The stream encoder can be used to encode complete streams either to the
+ * client via callbacks, or directly to a file, depending on how it is
+ * initialized. When encoding via callbacks, the client provides a write
+ * callback which will be called whenever FLAC data is ready to be written.
+ * If the client also supplies a seek callback, the encoder will also
+ * automatically handle the writing back of metadata discovered while
+ * encoding, like stream info, seek points offsets, etc. When encoding to
+ * a file, the client needs only supply a filename or open \c FILE* and an
+ * optional progress callback for periodic notification of progress; the
+ * write and seek callbacks are supplied internally. For more info see the
+ * \link flac_stream_encoder stream encoder \endlink module.
+ */
+
+/** \defgroup flac_stream_encoder FLAC/stream_encoder.h: stream encoder interface
+ * \ingroup flac_encoder
+ *
+ * \brief
+ * This module contains the functions which implement the stream
+ * encoder.
+ *
+ * The stream encoder can encode to native FLAC, and optionally Ogg FLAC
+ * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
+ *
+ * The basic usage of this encoder is as follows:
+ * - The program creates an instance of an encoder using
+ * FLAC__stream_encoder_new().
+ * - The program overrides the default settings using
+ * FLAC__stream_encoder_set_*() functions. At a minimum, the following
+ * functions should be called:
+ * - FLAC__stream_encoder_set_channels()
+ * - FLAC__stream_encoder_set_bits_per_sample()
+ * - FLAC__stream_encoder_set_sample_rate()
+ * - FLAC__stream_encoder_set_ogg_serial_number() (if encoding to Ogg FLAC)
+ * - FLAC__stream_encoder_set_total_samples_estimate() (if known)
+ * - If the application wants to control the compression level or set its own
+ * metadata, then the following should also be called:
+ * - FLAC__stream_encoder_set_compression_level()
+ * - FLAC__stream_encoder_set_verify()
+ * - FLAC__stream_encoder_set_metadata()
+ * - The rest of the set functions should only be called if the client needs
+ * exact control over how the audio is compressed; thorough understanding
+ * of the FLAC format is necessary to achieve good results.
+ * - The program initializes the instance to validate the settings and
+ * prepare for encoding using
+ * - FLAC__stream_encoder_init_stream() or FLAC__stream_encoder_init_FILE()
+ * or FLAC__stream_encoder_init_file() for native FLAC
+ * - FLAC__stream_encoder_init_ogg_stream() or FLAC__stream_encoder_init_ogg_FILE()
+ * or FLAC__stream_encoder_init_ogg_file() for Ogg FLAC
+ * - The program calls FLAC__stream_encoder_process() or
+ * FLAC__stream_encoder_process_interleaved() to encode data, which
+ * subsequently calls the callbacks when there is encoder data ready
+ * to be written.
+ * - The program finishes the encoding with FLAC__stream_encoder_finish(),
+ * which causes the encoder to encode any data still in its input pipe,
+ * update the metadata with the final encoding statistics if output
+ * seeking is possible, and finally reset the encoder to the
+ * uninitialized state.
+ * - The instance may be used again or deleted with
+ * FLAC__stream_encoder_delete().
+ *
+ * In more detail, the stream encoder functions similarly to the
+ * \link flac_stream_decoder stream decoder \endlink, but has fewer
+ * callbacks and more options. Typically the client will create a new
+ * instance by calling FLAC__stream_encoder_new(), then set the necessary
+ * parameters with FLAC__stream_encoder_set_*(), and initialize it by
+ * calling one of the FLAC__stream_encoder_init_*() functions.
+ *
+ * Unlike the decoders, the stream encoder has many options that can
+ * affect the speed and compression ratio. When setting these parameters
+ * you should have some basic knowledge of the format (see the
+ * <A HREF="../documentation.html#format">user-level documentation</A>
+ * or the <A HREF="../format.html">formal description</A>). The
+ * FLAC__stream_encoder_set_*() functions themselves do not validate the
+ * values as many are interdependent. The FLAC__stream_encoder_init_*()
+ * functions will do this, so make sure to pay attention to the state
+ * returned by FLAC__stream_encoder_init_*() to make sure that it is
+ * FLAC__STREAM_ENCODER_INIT_STATUS_OK. Any parameters that are not set
+ * before FLAC__stream_encoder_init_*() will take on the defaults from
+ * the constructor.
+ *
+ * There are three initialization functions for native FLAC, one for
+ * setting up the encoder to encode FLAC data to the client via
+ * callbacks, and two for encoding directly to a file.
+ *
+ * For encoding via callbacks, use FLAC__stream_encoder_init_stream().
+ * You must also supply a write callback which will be called anytime
+ * there is raw encoded data to write. If the client can seek the output
+ * it is best to also supply seek and tell callbacks, as this allows the
+ * encoder to go back after encoding is finished to write back
+ * information that was collected while encoding, like seek point offsets,
+ * frame sizes, etc.
+ *
+ * For encoding directly to a file, use FLAC__stream_encoder_init_FILE()
+ * or FLAC__stream_encoder_init_file(). Then you must only supply a
+ * filename or open \c FILE*; the encoder will handle all the callbacks
+ * internally. You may also supply a progress callback for periodic
+ * notification of the encoding progress.
+ *
+ * There are three similarly-named init functions for encoding to Ogg
+ * FLAC streams. Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
+ * library has been built with Ogg support.
+ *
+ * The call to FLAC__stream_encoder_init_*() currently will also immediately
+ * call the write callback several times, once with the \c fLaC signature,
+ * and once for each encoded metadata block. Note that for Ogg FLAC
+ * encoding you will usually get at least twice the number of callbacks than
+ * with native FLAC, one for the Ogg page header and one for the page body.
+ *
+ * After initializing the instance, the client may feed audio data to the
+ * encoder in one of two ways:
+ *
+ * - Channel separate, through FLAC__stream_encoder_process() - The client
+ * will pass an array of pointers to buffers, one for each channel, to
+ * the encoder, each of the same length. The samples need not be
+ * block-aligned, but each channel should have the same number of samples.
+ * - Channel interleaved, through
+ * FLAC__stream_encoder_process_interleaved() - The client will pass a single
+ * pointer to data that is channel-interleaved (i.e. channel0_sample0,
+ * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
+ * Again, the samples need not be block-aligned but they must be
+ * sample-aligned, i.e. the first value should be channel0_sample0 and
+ * the last value channelN_sampleM.
+ *
+ * Note that for either process call, each sample in the buffers should be a
+ * signed integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the resolution
+ * is 16 bits per sample, the samples should all be in the range [-32768,32767].
+ *
+ * When the client is finished encoding data, it calls
+ * FLAC__stream_encoder_finish(), which causes the encoder to encode any
+ * data still in its input pipe, and call the metadata callback with the
+ * final encoding statistics. Then the instance may be deleted with
+ * FLAC__stream_encoder_delete() or initialized again to encode another
+ * stream.
+ *
+ * For programs that write their own metadata, but that do not know the
+ * actual metadata until after encoding, it is advantageous to instruct
+ * the encoder to write a PADDING block of the correct size, so that
+ * instead of rewriting the whole stream after encoding, the program can
+ * just overwrite the PADDING block. If only the maximum size of the
+ * metadata is known, the program can write a slightly larger padding
+ * block, then split it after encoding.
+ *
+ * Make sure you understand how lengths are calculated. All FLAC metadata
+ * blocks have a 4 byte header which contains the type and length. This
+ * length does not include the 4 bytes of the header. See the format page
+ * for the specification of metadata blocks and their lengths.
+ *
+ * \note
+ * If you are writing the FLAC data to a file via callbacks, make sure it
+ * is open for update (e.g. mode "w+" for stdio streams). This is because
+ * after the first encoding pass, the encoder will try to seek back to the
+ * beginning of the stream, to the STREAMINFO block, to write some data
+ * there. (If using FLAC__stream_encoder_init*_file() or
+ * FLAC__stream_encoder_init*_FILE(), the file is managed internally.)
+ *
+ * \note
+ * The "set" functions may only be called when the encoder is in the
+ * state FLAC__STREAM_ENCODER_UNINITIALIZED, i.e. after
+ * FLAC__stream_encoder_new() or FLAC__stream_encoder_finish(), but
+ * before FLAC__stream_encoder_init_*(). If this is the case they will
+ * return \c true, otherwise \c false.
+ *
+ * \note
+ * FLAC__stream_encoder_finish() resets all settings to the constructor
+ * defaults.
+ *
+ * \{
+ */
+
+
+/** State values for a FLAC__StreamEncoder.
+ *
+ * The encoder's state can be obtained by calling FLAC__stream_encoder_get_state().
+ *
+ * If the encoder gets into any other state besides \c FLAC__STREAM_ENCODER_OK
+ * or \c FLAC__STREAM_ENCODER_UNINITIALIZED, it becomes invalid for encoding and
+ * must be deleted with FLAC__stream_encoder_delete().
+ */
+typedef enum {
+
+ FLAC__STREAM_ENCODER_OK = 0,
+ /**< The encoder is in the normal OK state and samples can be processed. */
+
+ FLAC__STREAM_ENCODER_UNINITIALIZED,
+ /**< The encoder is in the uninitialized state; one of the
+ * FLAC__stream_encoder_init_*() functions must be called before samples
+ * can be processed.
+ */
+
+ FLAC__STREAM_ENCODER_OGG_ERROR,
+ /**< An error occurred in the underlying Ogg layer. */
+
+ FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
+ /**< An error occurred in the underlying verify stream decoder;
+ * check FLAC__stream_encoder_get_verify_decoder_state().
+ */
+
+ FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
+ /**< The verify decoder detected a mismatch between the original
+ * audio signal and the decoded audio signal.
+ */
+
+ FLAC__STREAM_ENCODER_CLIENT_ERROR,
+ /**< One of the callbacks returned a fatal error. */
+
+ FLAC__STREAM_ENCODER_IO_ERROR,
+ /**< An I/O error occurred while opening/reading/writing a file.
+ * Check \c errno.
+ */
+
+ FLAC__STREAM_ENCODER_FRAMING_ERROR,
+ /**< An error occurred while writing the stream; usually, the
+ * write_callback returned an error.
+ */
+
+ FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR
+ /**< Memory allocation failed. */
+
+} FLAC__StreamEncoderState;
+
+/** Maps a FLAC__StreamEncoderState to a C string.
+ *
+ * Using a FLAC__StreamEncoderState as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
+
+
+/** Possible return values for the FLAC__stream_encoder_init_*() functions.
+ */
+typedef enum {
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_OK = 0,
+ /**< Initialization was successful. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR,
+ /**< General failure to set up encoder; call FLAC__stream_encoder_get_state() for cause. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
+ /**< The library was not compiled with support for the given container
+ * format.
+ */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS,
+ /**< A required callback was not supplied. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS,
+ /**< The encoder has an invalid setting for number of channels. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE,
+ /**< The encoder has an invalid setting for bits-per-sample.
+ * FLAC supports 4-32 bps but the reference encoder currently supports
+ * only up to 24 bps.
+ */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE,
+ /**< The encoder has an invalid setting for the input sample rate. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE,
+ /**< The encoder has an invalid setting for the block size. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER,
+ /**< The encoder has an invalid setting for the maximum LPC order. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION,
+ /**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
+ /**< The specified block size is less than the maximum LPC order. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE,
+ /**< The encoder is bound to the <A HREF="../format.html#subset">Subset</A> but other settings violate it. */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA,
+ /**< The metadata input to the encoder is invalid, in one of the following ways:
+ * - FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0
+ * - One of the metadata blocks contains an undefined type
+ * - It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal()
+ * - It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal()
+ * - It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block
+ */
+
+ FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED
+ /**< FLAC__stream_encoder_init_*() was called when the encoder was
+ * already initialized, usually because
+ * FLAC__stream_encoder_finish() was not called.
+ */
+
+} FLAC__StreamEncoderInitStatus;
+
+/** Maps a FLAC__StreamEncoderInitStatus to a C string.
+ *
+ * Using a FLAC__StreamEncoderInitStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[];
+
+
+/** Return values for the FLAC__StreamEncoder read callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE,
+ /**< The read was OK and decoding can continue. */
+
+ FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM,
+ /**< The read was attempted at the end of the stream. */
+
+ FLAC__STREAM_ENCODER_READ_STATUS_ABORT,
+ /**< An unrecoverable error occurred. */
+
+ FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED
+ /**< Client does not support reading back from the output. */
+
+} FLAC__StreamEncoderReadStatus;
+
+/** Maps a FLAC__StreamEncoderReadStatus to a C string.
+ *
+ * Using a FLAC__StreamEncoderReadStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[];
+
+
+/** Return values for the FLAC__StreamEncoder write callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
+ /**< The write was OK and encoding can continue. */
+
+ FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
+ /**< An unrecoverable error occurred. The encoder will return from the process call. */
+
+} FLAC__StreamEncoderWriteStatus;
+
+/** Maps a FLAC__StreamEncoderWriteStatus to a C string.
+ *
+ * Using a FLAC__StreamEncoderWriteStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
+
+
+/** Return values for the FLAC__StreamEncoder seek callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_ENCODER_SEEK_STATUS_OK,
+ /**< The seek was OK and encoding can continue. */
+
+ FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR,
+ /**< An unrecoverable error occurred. */
+
+ FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
+ /**< Client does not support seeking. */
+
+} FLAC__StreamEncoderSeekStatus;
+
+/** Maps a FLAC__StreamEncoderSeekStatus to a C string.
+ *
+ * Using a FLAC__StreamEncoderSeekStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[];
+
+
+/** Return values for the FLAC__StreamEncoder tell callback.
+ */
+typedef enum {
+
+ FLAC__STREAM_ENCODER_TELL_STATUS_OK,
+ /**< The tell was OK and encoding can continue. */
+
+ FLAC__STREAM_ENCODER_TELL_STATUS_ERROR,
+ /**< An unrecoverable error occurred. */
+
+ FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
+ /**< Client does not support seeking. */
+
+} FLAC__StreamEncoderTellStatus;
+
+/** Maps a FLAC__StreamEncoderTellStatus to a C string.
+ *
+ * Using a FLAC__StreamEncoderTellStatus as the index to this array
+ * will give the string equivalent. The contents should not be modified.
+ */
+extern FLAC_API const char * const FLAC__StreamEncoderTellStatusString[];
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE,
- /**< The encoder has an invalid setting for the block size. */
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER,
- /**< The encoder has an invalid setting for the maximum LPC order. */
+/***********************************************************************
+ *
+ * class FLAC__StreamEncoder
+ *
+ ***********************************************************************/
+
+struct FLAC__StreamEncoderProtected;
+struct FLAC__StreamEncoderPrivate;
+/** The opaque structure definition for the stream encoder type.
+ * See the \link flac_stream_encoder stream encoder module \endlink
+ * for a detailed description.
+ */
+typedef struct {
+ struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
+ struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
+} FLAC__StreamEncoder;
+
+/** Signature for the read callback.
+ *
+ * A function pointer matching this signature must be passed to
+ * FLAC__stream_encoder_init_ogg_stream() if seeking is supported.
+ * The supplied function will be called when the encoder needs to read back
+ * encoded data. This happens during the metadata callback, when the encoder
+ * has to read, modify, and rewrite the metadata (e.g. seekpoints) gathered
+ * while encoding. The address of the buffer to be filled is supplied, along
+ * with the number of bytes the buffer can hold. The callback may choose to
+ * supply less data and modify the byte count but must be careful not to
+ * overflow the buffer. The callback then returns a status code chosen from
+ * FLAC__StreamEncoderReadStatus.
+ *
+ * Here is an example of a read callback for stdio streams:
+ * \code
+ * FLAC__StreamEncoderReadStatus read_cb(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * if(*bytes > 0) {
+ * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
+ * if(ferror(file))
+ * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
+ * else if(*bytes == 0)
+ * return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM;
+ * else
+ * return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE;
+ * }
+ * else
+ * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamEncoder functions which change the
+ * state should not be called on the \a encoder while in the callback.
+ *
+ * \param encoder The encoder instance calling the callback.
+ * \param buffer A pointer to a location for the callee to store
+ * data to be encoded.
+ * \param bytes A pointer to the size of the buffer. On entry
+ * to the callback, it contains the maximum number
+ * of bytes that may be stored in \a buffer. The
+ * callee must set it to the actual number of bytes
+ * stored (0 in case of error or end-of-stream) before
+ * returning.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_encoder_set_client_data().
+ * \retval FLAC__StreamEncoderReadStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
+
+/** Signature for the write callback.
+ *
+ * A function pointer matching this signature must be passed to
+ * FLAC__stream_encoder_init*_stream(). The supplied function will be called
+ * by the encoder anytime there is raw encoded data ready to write. It may
+ * include metadata mixed with encoded audio frames and the data is not
+ * guaranteed to be aligned on frame or metadata block boundaries.
+ *
+ * The only duty of the callback is to write out the \a bytes worth of data
+ * in \a buffer to the current position in the output stream. The arguments
+ * \a samples and \a current_frame are purely informational. If \a samples
+ * is greater than \c 0, then \a current_frame will hold the current frame
+ * number that is being written; otherwise it indicates that the write
+ * callback is being called to write metadata.
+ *
+ * \note
+ * Unlike when writing to native FLAC, when writing to Ogg FLAC the
+ * write callback will be called twice when writing each audio
+ * frame; once for the page header, and once for the page body.
+ * When writing the page header, the \a samples argument to the
+ * write callback will be \c 0.
+ *
+ * \note In general, FLAC__StreamEncoder functions which change the
+ * state should not be called on the \a encoder while in the callback.
+ *
+ * \param encoder The encoder instance calling the callback.
+ * \param buffer An array of encoded data of length \a bytes.
+ * \param bytes The byte length of \a buffer.
+ * \param samples The number of samples encoded by \a buffer.
+ * \c 0 has a special meaning; see above.
+ * \param current_frame The number of the current frame being encoded.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_encoder_init_*().
+ * \retval FLAC__StreamEncoderWriteStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
+
+/** Signature for the seek callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_encoder_init*_stream(). The supplied function will be called
+ * when the encoder needs to seek the output stream. The encoder will pass
+ * the absolute byte offset to seek to, 0 meaning the beginning of the stream.
+ *
+ * Here is an example of a seek callback for stdio streams:
+ * \code
+ * FLAC__StreamEncoderSeekStatus seek_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * if(file == stdin)
+ * return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
+ * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
+ * return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
+ * else
+ * return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamEncoder functions which change the
+ * state should not be called on the \a encoder while in the callback.
+ *
+ * \param encoder The encoder instance calling the callback.
+ * \param absolute_byte_offset The offset from the beginning of the stream
+ * to seek to.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_encoder_init_*().
+ * \retval FLAC__StreamEncoderSeekStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamEncoderSeekStatus (*FLAC__StreamEncoderSeekCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION,
- /**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */
+/** Signature for the tell callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_encoder_init*_stream(). The supplied function will be called
+ * when the encoder needs to know the current position of the output stream.
+ *
+ * \warning
+ * The callback must return the true current byte offset of the output to
+ * which the encoder is writing. If you are buffering the output, make
+ * sure and take this into account. If you are writing directly to a
+ * FILE* from your write callback, ftell() is sufficient. If you are
+ * writing directly to a file descriptor from your write callback, you
+ * can use lseek(fd, SEEK_CUR, 0). The encoder may later seek back to
+ * these points to rewrite metadata after encoding.
+ *
+ * Here is an example of a tell callback for stdio streams:
+ * \code
+ * FLAC__StreamEncoderTellStatus tell_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * off_t pos;
+ * if(file == stdin)
+ * return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
+ * else if((pos = ftello(file)) < 0)
+ * return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
+ * else {
+ * *absolute_byte_offset = (FLAC__uint64)pos;
+ * return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
+ * }
+ * }
+ * \endcode
+ *
+ * \note In general, FLAC__StreamEncoder functions which change the
+ * state should not be called on the \a encoder while in the callback.
+ *
+ * \param encoder The encoder instance calling the callback.
+ * \param absolute_byte_offset The address at which to store the current
+ * position of the output.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_encoder_init_*().
+ * \retval FLAC__StreamEncoderTellStatus
+ * The callee's return status.
+ */
+typedef FLAC__StreamEncoderTellStatus (*FLAC__StreamEncoderTellCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
- FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
- /**< The specified block size is less than the maximum LPC order. */
+/** Signature for the metadata callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_encoder_init*_stream(). The supplied function will be called
+ * once at the end of encoding with the populated STREAMINFO structure. This
+ * is so the client can seek back to the beginning of the file and write the
+ * STREAMINFO block with the correct statistics after encoding (like
+ * minimum/maximum frame size and total samples).
+ *
+ * \note In general, FLAC__StreamEncoder functions which change the
+ * state should not be called on the \a encoder while in the callback.
+ *
+ * \param encoder The encoder instance calling the callback.
+ * \param metadata The final populated STREAMINFO block.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_encoder_init_*().
+ */
+typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
- FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE,
- /**< The encoder is bound to the <A HREF="../format.html#subset">Subset</A> but other settings violate it. */
+/** Signature for the progress callback.
+ *
+ * A function pointer matching this signature may be passed to
+ * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE().
+ * The supplied function will be called when the encoder has finished
+ * writing a frame. The \c total_frames_estimate argument to the
+ * callback will be based on the value from
+ * FLAC__stream_encoder_set_total_samples_estimate().
+ *
+ * \note In general, FLAC__StreamEncoder functions which change the
+ * state should not be called on the \a encoder while in the callback.
+ *
+ * \param encoder The encoder instance calling the callback.
+ * \param bytes_written Bytes written so far.
+ * \param samples_written Samples written so far.
+ * \param frames_written Frames written so far.
+ * \param total_frames_estimate The estimate of the total number of
+ * frames to be written.
+ * \param client_data The callee's client data set through
+ * FLAC__stream_encoder_init_*().
+ */
+typedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
- FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA,
- /**< The metadata input to the encoder is invalid, in one of the following ways:
- * - FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0
- * - One of the metadata blocks contains an undefined type
- * - It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal()
- * - It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal()
- * - It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block
- */
- FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED
- /**< FLAC__stream_encoder_init_*() was called when the encoder was
- * already initialized, usually because
- * FLAC__stream_encoder_finish() was not called.
- */
+/***********************************************************************
+ *
+ * Class constructor/destructor
+ *
+ ***********************************************************************/
- } FLAC__StreamEncoderInitStatus;
+/** Create a new stream encoder instance. The instance is created with
+ * default settings; see the individual FLAC__stream_encoder_set_*()
+ * functions for each setting's default.
+ *
+ * \retval FLAC__StreamEncoder*
+ * \c NULL if there was an error allocating memory, else the new instance.
+ */
+FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void);
- /** Maps a FLAC__StreamEncoderInitStatus to a C string.
- *
- * Using a FLAC__StreamEncoderInitStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[];
+/** Free an encoder instance. Deletes the object pointed to by \a encoder.
+ *
+ * \param encoder A pointer to an existing encoder.
+ * \assert
+ * \code encoder != NULL \endcode
+ */
+FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
- /** Return values for the FLAC__StreamEncoder read callback.
- */
- typedef enum
- {
+/***********************************************************************
+ *
+ * Public class method prototypes
+ *
+ ***********************************************************************/
- FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE,
- /**< The read was OK and decoding can continue. */
+/** Set the serial number for the FLAC stream to use in the Ogg container.
+ *
+ * \note
+ * This does not need to be set for native FLAC encoding.
+ *
+ * \note
+ * It is recommended to set a serial number explicitly as the default of '0'
+ * may collide with other streams.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param serial_number See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long serial_number);
- FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM,
- /**< The read was attempted at the end of the stream. */
+/** Set the "verify" flag. If \c true, the encoder will verify it's own
+ * encoded output by feeding it through an internal decoder and comparing
+ * the original signal against the decoded signal. If a mismatch occurs,
+ * the process call will return \c false. Note that this will slow the
+ * encoding process by the extra time required for decoding and comparison.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
- FLAC__STREAM_ENCODER_READ_STATUS_ABORT,
- /**< An unrecoverable error occurred. */
+/** Set the <A HREF="../format.html#subset">Subset</A> flag. If \c true,
+ * the encoder will comply with the Subset and will check the
+ * settings during FLAC__stream_encoder_init_*() to see if all settings
+ * comply. If \c false, the settings may take advantage of the full
+ * range that the format allows.
+ *
+ * Make sure you know what it entails before setting this to \c false.
+ *
+ * \default \c true
+ * \param encoder An encoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
- FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED
- /**< Client does not support reading back from the output. */
+/** Set the number of channels to be encoded.
+ *
+ * \default \c 2
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
- } FLAC__StreamEncoderReadStatus;
+/** Set the sample resolution of the input to be encoded.
+ *
+ * \warning
+ * Do not feed the encoder data that is wider than the value you
+ * set here or you will generate an invalid stream.
+ *
+ * \default \c 16
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
- /** Maps a FLAC__StreamEncoderReadStatus to a C string.
- *
- * Using a FLAC__StreamEncoderReadStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[];
+/** Set the sample rate (in Hz) of the input to be encoded.
+ *
+ * \default \c 44100
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
+/** Set the compression level
+ *
+ * The compression level is roughly proportional to the amount of effort
+ * the encoder expends to compress the file. A higher level usually
+ * means more computation but higher compression. The default level is
+ * suitable for most applications.
+ *
+ * Currently the levels range from \c 0 (fastest, least compression) to
+ * \c 8 (slowest, most compression). A value larger than \c 8 will be
+ * treated as \c 8.
+ *
+ * This function automatically calls the following other \c _set_
+ * functions with appropriate values, so the client does not need to
+ * unless it specifically wants to override them:
+ * - FLAC__stream_encoder_set_do_mid_side_stereo()
+ * - FLAC__stream_encoder_set_loose_mid_side_stereo()
+ * - FLAC__stream_encoder_set_apodization()
+ * - FLAC__stream_encoder_set_max_lpc_order()
+ * - FLAC__stream_encoder_set_qlp_coeff_precision()
+ * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
+ * - FLAC__stream_encoder_set_do_escape_coding()
+ * - FLAC__stream_encoder_set_do_exhaustive_model_search()
+ * - FLAC__stream_encoder_set_min_residual_partition_order()
+ * - FLAC__stream_encoder_set_max_residual_partition_order()
+ * - FLAC__stream_encoder_set_rice_parameter_search_dist()
+ *
+ * The actual values set for each level are:
+ * <table>
+ * <tr>
+ * <td><b>level</b><td>
+ * <td>do mid-side stereo<td>
+ * <td>loose mid-side stereo<td>
+ * <td>apodization<td>
+ * <td>max lpc order<td>
+ * <td>qlp coeff precision<td>
+ * <td>qlp coeff prec search<td>
+ * <td>escape coding<td>
+ * <td>exhaustive model search<td>
+ * <td>min residual partition order<td>
+ * <td>max residual partition order<td>
+ * <td>rice parameter search dist<td>
+ * </tr>
+ * <tr> <td><b>0</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
+ * <tr> <td><b>1</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
+ * <tr> <td><b>2</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
+ * <tr> <td><b>3</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>6<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr>
+ * <tr> <td><b>4</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr>
+ * <tr> <td><b>5</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>5<td> <td>0<td> </tr>
+ * <tr> <td><b>6</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>6<td> <td>0<td> </tr>
+ * <tr> <td><b>7</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr>
+ * <tr> <td><b>8</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>12<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr>
+ * </table>
+ *
+ * \default \c 5
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Set the blocksize to use while encoding.
+ *
+ * The number of samples to use per frame. Use \c 0 to let the encoder
+ * estimate a blocksize; this is usually best.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Set to \c true to enable mid-side encoding on stereo input. The
+ * number of channels must be 2 for this to have any effect. Set to
+ * \c false to use only independent channel coding.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
+/** Set to \c true to enable adaptive switching between mid-side and
+ * left-right encoding on stereo input. Set to \c false to use
+ * exhaustive searching. Setting this to \c true requires
+ * FLAC__stream_encoder_set_do_mid_side_stereo() to also be set to
+ * \c true in order to have any effect.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
+/** Sets the apodization function(s) the encoder will use when windowing
+ * audio data for LPC analysis.
+ *
+ * The \a specification is a plain ASCII string which specifies exactly
+ * which functions to use. There may be more than one (up to 32),
+ * separated by \c ';' characters. Some functions take one or more
+ * comma-separated arguments in parentheses.
+ *
+ * The available functions are \c bartlett, \c bartlett_hann,
+ * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop,
+ * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall,
+ * \c rectangle, \c triangle, \c tukey(P), \c welch.
+ *
+ * For \c gauss(STDDEV), STDDEV specifies the standard deviation
+ * (0<STDDEV<=0.5).
+ *
+ * For \c tukey(P), P specifies the fraction of the window that is
+ * tapered (0<=P<=1). P=0 corresponds to \c rectangle and P=1
+ * corresponds to \c hann.
+ *
+ * Example specifications are \c "blackman" or
+ * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)"
+ *
+ * Any function that is specified erroneously is silently dropped. Up
+ * to 32 functions are kept, the rest are dropped. If the specification
+ * is empty the encoder defaults to \c "tukey(0.5)".
+ *
+ * When more than one function is specified, then for every subframe the
+ * encoder will try each of them separately and choose the window that
+ * results in the smallest compressed subframe.
+ *
+ * Note that each function specified causes the encoder to occupy a
+ * floating point array in which to store the window.
+ *
+ * \default \c "tukey(0.5)"
+ * \param encoder An encoder instance to set.
+ * \param specification See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \code specification != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification);
+
+/** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Set the precision, in bits, of the quantized linear predictor
+ * coefficients, or \c 0 to let the encoder select it based on the
+ * blocksize.
+ *
+ * \note
+ * In the current implementation, qlp_coeff_precision + bits_per_sample must
+ * be less than 32.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Set to \c false to use only the specified quantized linear predictor
+ * coefficient precision, or \c true to search neighboring precision
+ * values and use the best one.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
+/** Deprecated. Setting this value has no effect.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
+/** Set to \c false to let the encoder estimate the best model order
+ * based on the residual signal energy, or \c true to force the
+ * encoder to evaluate all order models and select the best.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
+/** Set the minimum partition order to search when coding the residual.
+ * This is used in tandem with
+ * FLAC__stream_encoder_set_max_residual_partition_order().
+ *
+ * The partition order determines the context size in the residual.
+ * The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
+ *
+ * Set both min and max values to \c 0 to force a single context,
+ * whose Rice parameter is based on the residual signal variance.
+ * Otherwise, set a min and max order, and the encoder will search
+ * all orders, using the mean of each context for its Rice parameter,
+ * and use the best.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Set the maximum partition order to search when coding the residual.
+ * This is used in tandem with
+ * FLAC__stream_encoder_set_min_residual_partition_order().
+ *
+ * The partition order determines the context size in the residual.
+ * The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
+ *
+ * Set both min and max values to \c 0 to force a single context,
+ * whose Rice parameter is based on the residual signal variance.
+ * Otherwise, set a min and max order, and the encoder will search
+ * all orders, using the mean of each context for its Rice parameter,
+ * and use the best.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Deprecated. Setting this value has no effect.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
+
+/** Set an estimate of the total samples that will be encoded.
+ * This is merely an estimate and may be set to \c 0 if unknown.
+ * This value will be written to the STREAMINFO block before encoding,
+ * and can remove the need for the caller to rewrite the value later
+ * if the value is known before encoding.
+ *
+ * \default \c 0
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
+
+/** Set the metadata blocks to be emitted to the stream before encoding.
+ * A value of \c NULL, \c 0 implies no metadata; otherwise, supply an
+ * array of pointers to metadata blocks. The array is non-const since
+ * the encoder may need to change the \a is_last flag inside them, and
+ * in some cases update seek point offsets. Otherwise, the encoder will
+ * not modify or free the blocks. It is up to the caller to free the
+ * metadata blocks after encoding finishes.
+ *
+ * \note
+ * The encoder stores only copies of the pointers in the \a metadata array;
+ * the metadata blocks themselves must survive at least until after
+ * FLAC__stream_encoder_finish() returns. Do not free the blocks until then.
+ *
+ * \note
+ * The STREAMINFO block is always written and no STREAMINFO block may
+ * occur in the supplied array.
+ *
+ * \note
+ * By default the encoder does not create a SEEKTABLE. If one is supplied
+ * in the \a metadata array, but the client has specified that it does not
+ * support seeking, then the SEEKTABLE will be written verbatim. However
+ * by itself this is not very useful as the client will not know the stream
+ * offsets for the seekpoints ahead of time. In order to get a proper
+ * seektable the client must support seeking. See next note.
+ *
+ * \note
+ * SEEKTABLE blocks are handled specially. Since you will not know
+ * the values for the seek point stream offsets, you should pass in
+ * a SEEKTABLE 'template', that is, a SEEKTABLE object with the
+ * required sample numbers (or placeholder points), with \c 0 for the
+ * \a frame_samples and \a stream_offset fields for each point. If the
+ * client has specified that it supports seeking by providing a seek
+ * callback to FLAC__stream_encoder_init_stream() or both seek AND read
+ * callback to FLAC__stream_encoder_init_ogg_stream() (or by using
+ * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE()),
+ * then while it is encoding the encoder will fill the stream offsets in
+ * for you and when encoding is finished, it will seek back and write the
+ * real values into the SEEKTABLE block in the stream. There are helper
+ * routines for manipulating seektable template blocks; see metadata.h:
+ * FLAC__metadata_object_seektable_template_*(). If the client does
+ * not support seeking, the SEEKTABLE will have inaccurate offsets which
+ * will slow down or remove the ability to seek in the FLAC stream.
+ *
+ * \note
+ * The encoder instance \b will modify the first \c SEEKTABLE block
+ * as it transforms the template to a valid seektable while encoding,
+ * but it is still up to the caller to free all metadata blocks after
+ * encoding.
+ *
+ * \note
+ * A VORBIS_COMMENT block may be supplied. The vendor string in it
+ * will be ignored. libFLAC will use it's own vendor string. libFLAC
+ * will not modify the passed-in VORBIS_COMMENT's vendor string, it
+ * will simply write it's own into the stream. If no VORBIS_COMMENT
+ * block is present in the \a metadata array, libFLAC will write an
+ * empty one, containing only the vendor string.
+ *
+ * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be
+ * the second metadata block of the stream. The encoder already supplies
+ * the STREAMINFO block automatically. If \a metadata does not contain a
+ * VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if
+ * \a metadata does contain a VORBIS_COMMENT block and it is not the
+ * first, the init function will reorder \a metadata by moving the
+ * VORBIS_COMMENT block to the front; the relative ordering of the other
+ * blocks will remain as they were.
+ *
+ * \note The Ogg FLAC mapping limits the number of metadata blocks per
+ * stream to \c 65535. If \a num_blocks exceeds this the function will
+ * return \c false.
+ *
+ * \default \c NULL, 0
+ * \param encoder An encoder instance to set.
+ * \param metadata See above.
+ * \param num_blocks See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ * \c false if the encoder is already initialized, or if
+ * \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
+
+/** Get the current encoder state.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__StreamEncoderState
+ * The current encoder state.
+ */
+FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
+
+/** Get the state of the verify stream decoder.
+ * Useful when the stream encoder state is
+ * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__StreamDecoderState
+ * The verify stream decoder state.
+ */
+FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
+
+/** Get the current encoder state as a C string.
+ * This version automatically resolves
+ * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR by getting the
+ * verify decoder's state.
+ *
+ * \param encoder A encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval const char *
+ * The encoder state as a C string. Do not modify the contents.
+ */
+FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
+
+/** Get relevant values about the nature of a verify decoder error.
+ * Useful when the stream encoder state is
+ * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. The arguments should
+ * be addresses in which the stats will be returned, or NULL if value
+ * is not desired.
+ *
+ * \param encoder An encoder instance to query.
+ * \param absolute_sample The absolute sample number of the mismatch.
+ * \param frame_number The number of the frame in which the mismatch occurred.
+ * \param channel The channel in which the mismatch occurred.
+ * \param sample The number of the sample (relative to the frame) in
+ * which the mismatch occurred.
+ * \param expected The expected value for the sample in question.
+ * \param got The actual value returned by the decoder.
+ * \assert
+ * \code encoder != NULL \endcode
+ */
+FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
+
+/** Get the "verify" flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_verify().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
+
+/** Get the <A HREF="../format.html#subset>Subset</A> flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_streamable_subset().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
+
+/** Get the number of input channels being processed.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_channels().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
+
+/** Get the input sample resolution setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_bits_per_sample().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
+
+/** Get the input sample rate setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_sample_rate().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
+
+/** Get the blocksize setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_blocksize().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
+
+/** Get the "mid/side stereo coding" flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_get_do_mid_side_stereo().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
+
+/** Get the "adaptive mid/side switching" flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_loose_mid_side_stereo().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
+
+/** Get the maximum LPC order setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_max_lpc_order().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
+
+/** Get the quantized linear predictor coefficient precision setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_qlp_coeff_precision().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
+
+/** Get the qlp coefficient precision search flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_do_qlp_coeff_prec_search().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
+
+/** Get the "escape coding" flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_do_escape_coding().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
+
+/** Get the exhaustive model search flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_do_exhaustive_model_search().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
+
+/** Get the minimum residual partition order setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_min_residual_partition_order().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
+
+/** Get maximum residual partition order setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_max_residual_partition_order().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
+
+/** Get the Rice parameter search distance setting.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval unsigned
+ * See FLAC__stream_encoder_set_rice_parameter_search_dist().
+ */
+FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
+
+/** Get the previously set estimate of the total samples to be encoded.
+ * The encoder merely mimics back the value given to
+ * FLAC__stream_encoder_set_total_samples_estimate() since it has no
+ * other way of knowing how many samples the client will encode.
+ *
+ * \param encoder An encoder instance to set.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__uint64
+ * See FLAC__stream_encoder_get_total_samples_estimate().
+ */
+FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
+
+/** Initialize the encoder instance to encode native FLAC streams.
+ *
+ * This flavor of initialization sets up the encoder to encode to a
+ * native FLAC stream. I/O is performed via callbacks to the client.
+ * For encoding to a plain file via filename or open \c FILE*,
+ * FLAC__stream_encoder_init_file() and FLAC__stream_encoder_init_FILE()
+ * provide a simpler interface.
+ *
+ * This function should be called after FLAC__stream_encoder_new() and
+ * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
+ * or FLAC__stream_encoder_process_interleaved().
+ * initialization succeeded.
+ *
+ * The call to FLAC__stream_encoder_init_stream() currently will also
+ * immediately call the write callback several times, once with the \c fLaC
+ * signature, and once for each encoded metadata block.
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \param write_callback See FLAC__StreamEncoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param seek_callback See FLAC__StreamEncoderSeekCallback. This
+ * pointer may be \c NULL if seeking is not
+ * supported. The encoder uses seeking to go back
+ * and write some some stream statistics to the
+ * STREAMINFO block; this is recommended but not
+ * necessary to create a valid FLAC stream. If
+ * \a seek_callback is not \c NULL then a
+ * \a tell_callback must also be supplied.
+ * Alternatively, a dummy seek callback that just
+ * returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the encoder.
+ * \param tell_callback See FLAC__StreamEncoderTellCallback. This
+ * pointer may be \c NULL if seeking is not
+ * supported. If \a seek_callback is \c NULL then
+ * this argument will be ignored. If
+ * \a seek_callback is not \c NULL then a
+ * \a tell_callback must also be supplied.
+ * Alternatively, a dummy tell callback that just
+ * returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the encoder.
+ * \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired. If the client provides a seek callback,
+ * this function is not necessary as the encoder
+ * will automatically seek back and update the
+ * STREAMINFO block. It may also be \c NULL if the
+ * client does not support seeking, since it will
+ * have no way of going back to update the
+ * STREAMINFO. However the client can still supply
+ * a callback if it would like to know the details
+ * from the STREAMINFO.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__StreamEncoderInitStatus
+ * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
+
+/** Initialize the encoder instance to encode Ogg FLAC streams.
+ *
+ * This flavor of initialization sets up the encoder to encode to a FLAC
+ * stream in an Ogg container. I/O is performed via callbacks to the
+ * client. For encoding to a plain file via filename or open \c FILE*,
+ * FLAC__stream_encoder_init_ogg_file() and FLAC__stream_encoder_init_ogg_FILE()
+ * provide a simpler interface.
+ *
+ * This function should be called after FLAC__stream_encoder_new() and
+ * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
+ * or FLAC__stream_encoder_process_interleaved().
+ * initialization succeeded.
+ *
+ * The call to FLAC__stream_encoder_init_ogg_stream() currently will also
+ * immediately call the write callback several times to write the metadata
+ * packets.
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \param read_callback See FLAC__StreamEncoderReadCallback. This
+ * pointer must not be \c NULL if \a seek_callback
+ * is non-NULL since they are both needed to be
+ * able to write data back to the Ogg FLAC stream
+ * in the post-encode phase.
+ * \param write_callback See FLAC__StreamEncoderWriteCallback. This
+ * pointer must not be \c NULL.
+ * \param seek_callback See FLAC__StreamEncoderSeekCallback. This
+ * pointer may be \c NULL if seeking is not
+ * supported. The encoder uses seeking to go back
+ * and write some some stream statistics to the
+ * STREAMINFO block; this is recommended but not
+ * necessary to create a valid FLAC stream. If
+ * \a seek_callback is not \c NULL then a
+ * \a tell_callback must also be supplied.
+ * Alternatively, a dummy seek callback that just
+ * returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the encoder.
+ * \param tell_callback See FLAC__StreamEncoderTellCallback. This
+ * pointer may be \c NULL if seeking is not
+ * supported. If \a seek_callback is \c NULL then
+ * this argument will be ignored. If
+ * \a seek_callback is not \c NULL then a
+ * \a tell_callback must also be supplied.
+ * Alternatively, a dummy tell callback that just
+ * returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
+ * may also be supplied, all though this is slightly
+ * less efficient for the encoder.
+ * \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired. If the client provides a seek callback,
+ * this function is not necessary as the encoder
+ * will automatically seek back and update the
+ * STREAMINFO block. It may also be \c NULL if the
+ * client does not support seeking, since it will
+ * have no way of going back to update the
+ * STREAMINFO. However the client can still supply
+ * a callback if it would like to know the details
+ * from the STREAMINFO.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__StreamEncoderInitStatus
+ * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderReadCallback read_callback, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
+
+/** Initialize the encoder instance to encode native FLAC files.
+ *
+ * This flavor of initialization sets up the encoder to encode to a
+ * plain native FLAC file. For non-stdio streams, you must use
+ * FLAC__stream_encoder_init_stream() and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_encoder_new() and
+ * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
+ * or FLAC__stream_encoder_process_interleaved().
+ * initialization succeeded.
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \param file An open file. The file should have been opened
+ * with mode \c "w+b" and rewound. The file
+ * becomes owned by the encoder and should not be
+ * manipulated by the client while encoding.
+ * Unless \a file is \c stdout, it will be closed
+ * when FLAC__stream_encoder_finish() is called.
+ * Note however that a proper SEEKTABLE cannot be
+ * created when encoding to \c stdout since it is
+ * not seekable.
+ * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \code file != NULL \endcode
+ * \retval FLAC__StreamEncoderInitStatus
+ * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
+
+/** Initialize the encoder instance to encode Ogg FLAC files.
+ *
+ * This flavor of initialization sets up the encoder to encode to a
+ * plain Ogg FLAC file. For non-stdio streams, you must use
+ * FLAC__stream_encoder_init_ogg_stream() and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_encoder_new() and
+ * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
+ * or FLAC__stream_encoder_process_interleaved().
+ * initialization succeeded.
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \param file An open file. The file should have been opened
+ * with mode \c "w+b" and rewound. The file
+ * becomes owned by the encoder and should not be
+ * manipulated by the client while encoding.
+ * Unless \a file is \c stdout, it will be closed
+ * when FLAC__stream_encoder_finish() is called.
+ * Note however that a proper SEEKTABLE cannot be
+ * created when encoding to \c stdout since it is
+ * not seekable.
+ * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \code file != NULL \endcode
+ * \retval FLAC__StreamEncoderInitStatus
+ * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
+
+/** Initialize the encoder instance to encode native FLAC files.
+ *
+ * This flavor of initialization sets up the encoder to encode to a plain
+ * FLAC file. If POSIX fopen() semantics are not sufficient (for example,
+ * with Unicode filenames on Windows), you must use
+ * FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream()
+ * and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_encoder_new() and
+ * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
+ * or FLAC__stream_encoder_process_interleaved().
+ * initialization succeeded.
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \param filename The name of the file to encode to. The file will
+ * be opened with fopen(). Use \c NULL to encode to
+ * \c stdout. Note however that a proper SEEKTABLE
+ * cannot be created when encoding to \c stdout since
+ * it is not seekable.
+ * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__StreamEncoderInitStatus
+ * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
+
+/** Initialize the encoder instance to encode Ogg FLAC files.
+ *
+ * This flavor of initialization sets up the encoder to encode to a plain
+ * Ogg FLAC file. If POSIX fopen() semantics are not sufficient (for example,
+ * with Unicode filenames on Windows), you must use
+ * FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream()
+ * and provide callbacks for the I/O.
+ *
+ * This function should be called after FLAC__stream_encoder_new() and
+ * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
+ * or FLAC__stream_encoder_process_interleaved().
+ * initialization succeeded.
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \param filename The name of the file to encode to. The file will
+ * be opened with fopen(). Use \c NULL to encode to
+ * \c stdout. Note however that a proper SEEKTABLE
+ * cannot be created when encoding to \c stdout since
+ * it is not seekable.
+ * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
+ * pointer may be \c NULL if the callback is not
+ * desired.
+ * \param client_data This value will be supplied to callbacks in their
+ * \a client_data argument.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__StreamEncoderInitStatus
+ * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
+ * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
+ */
+FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
+
+/** Finish the encoding process.
+ * Flushes the encoding buffer, releases resources, resets the encoder
+ * settings to their defaults, and returns the encoder state to
+ * FLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate
+ * one or more write callbacks before returning, and will generate
+ * a metadata callback.
+ *
+ * Note that in the course of processing the last frame, errors can
+ * occur, so the caller should be sure to check the return value to
+ * ensure the file was encoded properly.
+ *
+ * In the event of a prematurely-terminated encode, it is not strictly
+ * necessary to call this immediately before FLAC__stream_encoder_delete()
+ * but it is good practice to match every FLAC__stream_encoder_init_*()
+ * with a FLAC__stream_encoder_finish().
+ *
+ * \param encoder An uninitialized encoder instance.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if an error occurred processing the last frame; or if verify
+ * mode is set (see FLAC__stream_encoder_set_verify()), there was a
+ * verify mismatch; else \c true. If \c false, caller should check the
+ * state with FLAC__stream_encoder_get_state() for more information
+ * about the error.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
+
+/** Submit data for encoding.
+ * This version allows you to supply the input data via an array of
+ * pointers, each pointer pointing to an array of \a samples samples
+ * representing one channel. The samples need not be block-aligned,
+ * but each channel should have the same number of samples. Each sample
+ * should be a signed integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
+ * resolution is 16 bits per sample, the samples should all be in the
+ * range [-32768,32767].
+ *
+ * For applications where channel order is important, channels must
+ * follow the order as described in the
+ * <A HREF="../format.html#frame_header">frame header</A>.
+ *
+ * \param encoder An initialized encoder instance in the OK state.
+ * \param buffer An array of pointers to each channel's signal.
+ * \param samples The number of samples in one channel.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false; in this case, check the
+ * encoder state with FLAC__stream_encoder_get_state() to see what
+ * went wrong.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
+
+/** Submit data for encoding.
+ * This version allows you to supply the input data where the channels
+ * are interleaved into a single array (i.e. channel0_sample0,
+ * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
+ * The samples need not be block-aligned but they must be
+ * sample-aligned, i.e. the first value should be channel0_sample0
+ * and the last value channelN_sampleM. Each sample should be a signed
+ * integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
+ * resolution is 16 bits per sample, the samples should all be in the
+ * range [-32768,32767].
+ *
+ * For applications where channel order is important, channels must
+ * follow the order as described in the
+ * <A HREF="../format.html#frame_header">frame header</A>.
+ *
+ * \param encoder An initialized encoder instance in the OK state.
+ * \param buffer An array of channel-interleaved data (see above).
+ * \param samples The number of samples in one channel, the same as for
+ * FLAC__stream_encoder_process(). For example, if
+ * encoding two channels, \c 1000 \a samples corresponds
+ * to a \a buffer of 2000 values.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
+ * \retval FLAC__bool
+ * \c true if successful, else \c false; in this case, check the
+ * encoder state with FLAC__stream_encoder_get_state() to see what
+ * went wrong.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
- /** Return values for the FLAC__StreamEncoder write callback.
- */
- typedef enum
- {
-
- FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
- /**< The write was OK and encoding can continue. */
-
- FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
- /**< An unrecoverable error occurred. The encoder will return from the process call. */
-
- } FLAC__StreamEncoderWriteStatus;
-
- /** Maps a FLAC__StreamEncoderWriteStatus to a C string.
- *
- * Using a FLAC__StreamEncoderWriteStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
-
-
- /** Return values for the FLAC__StreamEncoder seek callback.
- */
- typedef enum
- {
-
- FLAC__STREAM_ENCODER_SEEK_STATUS_OK,
- /**< The seek was OK and encoding can continue. */
-
- FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR,
- /**< An unrecoverable error occurred. */
-
- FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
- /**< Client does not support seeking. */
-
- } FLAC__StreamEncoderSeekStatus;
-
- /** Maps a FLAC__StreamEncoderSeekStatus to a C string.
- *
- * Using a FLAC__StreamEncoderSeekStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[];
-
-
- /** Return values for the FLAC__StreamEncoder tell callback.
- */
- typedef enum
- {
-
- FLAC__STREAM_ENCODER_TELL_STATUS_OK,
- /**< The tell was OK and encoding can continue. */
-
- FLAC__STREAM_ENCODER_TELL_STATUS_ERROR,
- /**< An unrecoverable error occurred. */
-
- FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
- /**< Client does not support seeking. */
-
- } FLAC__StreamEncoderTellStatus;
-
- /** Maps a FLAC__StreamEncoderTellStatus to a C string.
- *
- * Using a FLAC__StreamEncoderTellStatus as the index to this array
- * will give the string equivalent. The contents should not be modified.
- */
- extern FLAC_API const char * const FLAC__StreamEncoderTellStatusString[];
-
-
- /***********************************************************************
- *
- * class FLAC__StreamEncoder
- *
- ***********************************************************************/
-
- struct FLAC__StreamEncoderProtected;
- struct FLAC__StreamEncoderPrivate;
- /** The opaque structure definition for the stream encoder type.
- * See the \link flac_stream_encoder stream encoder module \endlink
- * for a detailed description.
- */
- typedef struct
- {
- struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
- struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
- } FLAC__StreamEncoder;
-
- /** Signature for the read callback.
- *
- * A function pointer matching this signature must be passed to
- * FLAC__stream_encoder_init_ogg_stream() if seeking is supported.
- * The supplied function will be called when the encoder needs to read back
- * encoded data. This happens during the metadata callback, when the encoder
- * has to read, modify, and rewrite the metadata (e.g. seekpoints) gathered
- * while encoding. The address of the buffer to be filled is supplied, along
- * with the number of bytes the buffer can hold. The callback may choose to
- * supply less data and modify the byte count but must be careful not to
- * overflow the buffer. The callback then returns a status code chosen from
- * FLAC__StreamEncoderReadStatus.
- *
- * Here is an example of a read callback for stdio streams:
- * \code
- * FLAC__StreamEncoderReadStatus read_cb(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * if(*bytes > 0) {
- * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
- * if(ferror(file))
- * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
- * else if(*bytes == 0)
- * return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM;
- * else
- * return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE;
- * }
- * else
- * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamEncoder functions which change the
- * state should not be called on the \a encoder while in the callback.
- *
- * \param encoder The encoder instance calling the callback.
- * \param buffer A pointer to a location for the callee to store
- * data to be encoded.
- * \param bytes A pointer to the size of the buffer. On entry
- * to the callback, it contains the maximum number
- * of bytes that may be stored in \a buffer. The
- * callee must set it to the actual number of bytes
- * stored (0 in case of error or end-of-stream) before
- * returning.
- * \param client_data The callee's client data set through
- * FLAC__stream_encoder_set_client_data().
- * \retval FLAC__StreamEncoderReadStatus
- * The callee's return status.
- */
- typedef FLAC__StreamEncoderReadStatus(*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
-
- /** Signature for the write callback.
- *
- * A function pointer matching this signature must be passed to
- * FLAC__stream_encoder_init*_stream(). The supplied function will be called
- * by the encoder anytime there is raw encoded data ready to write. It may
- * include metadata mixed with encoded audio frames and the data is not
- * guaranteed to be aligned on frame or metadata block boundaries.
- *
- * The only duty of the callback is to write out the \a bytes worth of data
- * in \a buffer to the current position in the output stream. The arguments
- * \a samples and \a current_frame are purely informational. If \a samples
- * is greater than \c 0, then \a current_frame will hold the current frame
- * number that is being written; otherwise it indicates that the write
- * callback is being called to write metadata.
- *
- * \note
- * Unlike when writing to native FLAC, when writing to Ogg FLAC the
- * write callback will be called twice when writing each audio
- * frame; once for the page header, and once for the page body.
- * When writing the page header, the \a samples argument to the
- * write callback will be \c 0.
- *
- * \note In general, FLAC__StreamEncoder functions which change the
- * state should not be called on the \a encoder while in the callback.
- *
- * \param encoder The encoder instance calling the callback.
- * \param buffer An array of encoded data of length \a bytes.
- * \param bytes The byte length of \a buffer.
- * \param samples The number of samples encoded by \a buffer.
- * \c 0 has a special meaning; see above.
- * \param current_frame The number of the current frame being encoded.
- * \param client_data The callee's client data set through
- * FLAC__stream_encoder_init_*().
- * \retval FLAC__StreamEncoderWriteStatus
- * The callee's return status.
- */
- typedef FLAC__StreamEncoderWriteStatus(*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
-
- /** Signature for the seek callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_encoder_init*_stream(). The supplied function will be called
- * when the encoder needs to seek the output stream. The encoder will pass
- * the absolute byte offset to seek to, 0 meaning the beginning of the stream.
- *
- * Here is an example of a seek callback for stdio streams:
- * \code
- * FLAC__StreamEncoderSeekStatus seek_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * if(file == stdin)
- * return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
- * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
- * return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
- * else
- * return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamEncoder functions which change the
- * state should not be called on the \a encoder while in the callback.
- *
- * \param encoder The encoder instance calling the callback.
- * \param absolute_byte_offset The offset from the beginning of the stream
- * to seek to.
- * \param client_data The callee's client data set through
- * FLAC__stream_encoder_init_*().
- * \retval FLAC__StreamEncoderSeekStatus
- * The callee's return status.
- */
- typedef FLAC__StreamEncoderSeekStatus(*FLAC__StreamEncoderSeekCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
-
- /** Signature for the tell callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_encoder_init*_stream(). The supplied function will be called
- * when the encoder needs to know the current position of the output stream.
- *
- * \warning
- * The callback must return the true current byte offset of the output to
- * which the encoder is writing. If you are buffering the output, make
- * sure and take this into account. If you are writing directly to a
- * FILE* from your write callback, ftell() is sufficient. If you are
- * writing directly to a file descriptor from your write callback, you
- * can use lseek(fd, SEEK_CUR, 0). The encoder may later seek back to
- * these points to rewrite metadata after encoding.
- *
- * Here is an example of a tell callback for stdio streams:
- * \code
- * FLAC__StreamEncoderTellStatus tell_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
- * {
- * FILE *file = ((MyClientData*)client_data)->file;
- * off_t pos;
- * if(file == stdin)
- * return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
- * else if((pos = ftello(file)) < 0)
- * return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
- * else {
- * *absolute_byte_offset = (FLAC__uint64)pos;
- * return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
- * }
- * }
- * \endcode
- *
- * \note In general, FLAC__StreamEncoder functions which change the
- * state should not be called on the \a encoder while in the callback.
- *
- * \param encoder The encoder instance calling the callback.
- * \param absolute_byte_offset The address at which to store the current
- * position of the output.
- * \param client_data The callee's client data set through
- * FLAC__stream_encoder_init_*().
- * \retval FLAC__StreamEncoderTellStatus
- * The callee's return status.
- */
- typedef FLAC__StreamEncoderTellStatus(*FLAC__StreamEncoderTellCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
-
- /** Signature for the metadata callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_encoder_init*_stream(). The supplied function will be called
- * once at the end of encoding with the populated STREAMINFO structure. This
- * is so the client can seek back to the beginning of the file and write the
- * STREAMINFO block with the correct statistics after encoding (like
- * minimum/maximum frame size and total samples).
- *
- * \note In general, FLAC__StreamEncoder functions which change the
- * state should not be called on the \a encoder while in the callback.
- *
- * \param encoder The encoder instance calling the callback.
- * \param metadata The final populated STREAMINFO block.
- * \param client_data The callee's client data set through
- * FLAC__stream_encoder_init_*().
- */
- typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
-
- /** Signature for the progress callback.
- *
- * A function pointer matching this signature may be passed to
- * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE().
- * The supplied function will be called when the encoder has finished
- * writing a frame. The \c total_frames_estimate argument to the
- * callback will be based on the value from
- * FLAC__stream_encoder_set_total_samples_estimate().
- *
- * \note In general, FLAC__StreamEncoder functions which change the
- * state should not be called on the \a encoder while in the callback.
- *
- * \param encoder The encoder instance calling the callback.
- * \param bytes_written Bytes written so far.
- * \param samples_written Samples written so far.
- * \param frames_written Frames written so far.
- * \param total_frames_estimate The estimate of the total number of
- * frames to be written.
- * \param client_data The callee's client data set through
- * FLAC__stream_encoder_init_*().
- */
- typedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
-
-
- /***********************************************************************
- *
- * Class constructor/destructor
- *
- ***********************************************************************/
-
- /** Create a new stream encoder instance. The instance is created with
- * default settings; see the individual FLAC__stream_encoder_set_*()
- * functions for each setting's default.
- *
- * \retval FLAC__StreamEncoder*
- * \c NULL if there was an error allocating memory, else the new instance.
- */
- FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void);
-
- /** Free an encoder instance. Deletes the object pointed to by \a encoder.
- *
- * \param encoder A pointer to an existing encoder.
- * \assert
- * \code encoder != NULL \endcode
- */
- FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
-
-
- /***********************************************************************
- *
- * Public class method prototypes
- *
- ***********************************************************************/
-
- /** Set the serial number for the FLAC stream to use in the Ogg container.
- *
- * \note
- * This does not need to be set for native FLAC encoding.
- *
- * \note
- * It is recommended to set a serial number explicitly as the default of '0'
- * may collide with other streams.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param serial_number See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long serial_number);
-
- /** Set the "verify" flag. If \c true, the encoder will verify it's own
- * encoded output by feeding it through an internal decoder and comparing
- * the original signal against the decoded signal. If a mismatch occurs,
- * the process call will return \c false. Note that this will slow the
- * encoding process by the extra time required for decoding and comparison.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Set the <A HREF="../format.html#subset">Subset</A> flag. If \c true,
- * the encoder will comply with the Subset and will check the
- * settings during FLAC__stream_encoder_init_*() to see if all settings
- * comply. If \c false, the settings may take advantage of the full
- * range that the format allows.
- *
- * Make sure you know what it entails before setting this to \c false.
- *
- * \default \c true
- * \param encoder An encoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Set the number of channels to be encoded.
- *
- * \default \c 2
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set the sample resolution of the input to be encoded.
- *
- * \warning
- * Do not feed the encoder data that is wider than the value you
- * set here or you will generate an invalid stream.
- *
- * \default \c 16
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set the sample rate (in Hz) of the input to be encoded.
- *
- * \default \c 44100
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set the compression level
- *
- * The compression level is roughly proportional to the amount of effort
- * the encoder expends to compress the file. A higher level usually
- * means more computation but higher compression. The default level is
- * suitable for most applications.
- *
- * Currently the levels range from \c 0 (fastest, least compression) to
- * \c 8 (slowest, most compression). A value larger than \c 8 will be
- * treated as \c 8.
- *
- * This function automatically calls the following other \c _set_
- * functions with appropriate values, so the client does not need to
- * unless it specifically wants to override them:
- * - FLAC__stream_encoder_set_do_mid_side_stereo()
- * - FLAC__stream_encoder_set_loose_mid_side_stereo()
- * - FLAC__stream_encoder_set_apodization()
- * - FLAC__stream_encoder_set_max_lpc_order()
- * - FLAC__stream_encoder_set_qlp_coeff_precision()
- * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
- * - FLAC__stream_encoder_set_do_escape_coding()
- * - FLAC__stream_encoder_set_do_exhaustive_model_search()
- * - FLAC__stream_encoder_set_min_residual_partition_order()
- * - FLAC__stream_encoder_set_max_residual_partition_order()
- * - FLAC__stream_encoder_set_rice_parameter_search_dist()
- *
- * The actual values set for each level are:
- * <table>
- * <tr>
- * <td><b>level</b><td>
- * <td>do mid-side stereo<td>
- * <td>loose mid-side stereo<td>
- * <td>apodization<td>
- * <td>max lpc order<td>
- * <td>qlp coeff precision<td>
- * <td>qlp coeff prec search<td>
- * <td>escape coding<td>
- * <td>exhaustive model search<td>
- * <td>min residual partition order<td>
- * <td>max residual partition order<td>
- * <td>rice parameter search dist<td>
- * </tr>
- * <tr> <td><b>0</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
- * <tr> <td><b>1</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
- * <tr> <td><b>2</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
- * <tr> <td><b>3</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>6<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr>
- * <tr> <td><b>4</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr>
- * <tr> <td><b>5</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>5<td> <td>0<td> </tr>
- * <tr> <td><b>6</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>6<td> <td>0<td> </tr>
- * <tr> <td><b>7</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr>
- * <tr> <td><b>8</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>12<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr>
- * </table>
- *
- * \default \c 5
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set the blocksize to use while encoding.
- *
- * The number of samples to use per frame. Use \c 0 to let the encoder
- * estimate a blocksize; this is usually best.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set to \c true to enable mid-side encoding on stereo input. The
- * number of channels must be 2 for this to have any effect. Set to
- * \c false to use only independent channel coding.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Set to \c true to enable adaptive switching between mid-side and
- * left-right encoding on stereo input. Set to \c false to use
- * exhaustive searching. Setting this to \c true requires
- * FLAC__stream_encoder_set_do_mid_side_stereo() to also be set to
- * \c true in order to have any effect.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Sets the apodization function(s) the encoder will use when windowing
- * audio data for LPC analysis.
- *
- * The \a specification is a plain ASCII string which specifies exactly
- * which functions to use. There may be more than one (up to 32),
- * separated by \c ';' characters. Some functions take one or more
- * comma-separated arguments in parentheses.
- *
- * The available functions are \c bartlett, \c bartlett_hann,
- * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop,
- * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall,
- * \c rectangle, \c triangle, \c tukey(P), \c welch.
- *
- * For \c gauss(STDDEV), STDDEV specifies the standard deviation
- * (0<STDDEV<=0.5).
- *
- * For \c tukey(P), P specifies the fraction of the window that is
- * tapered (0<=P<=1). P=0 corresponds to \c rectangle and P=1
- * corresponds to \c hann.
- *
- * Example specifications are \c "blackman" or
- * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)"
- *
- * Any function that is specified erroneously is silently dropped. Up
- * to 32 functions are kept, the rest are dropped. If the specification
- * is empty the encoder defaults to \c "tukey(0.5)".
- *
- * When more than one function is specified, then for every subframe the
- * encoder will try each of them separately and choose the window that
- * results in the smallest compressed subframe.
- *
- * Note that each function specified causes the encoder to occupy a
- * floating point array in which to store the window.
- *
- * \default \c "tukey(0.5)"
- * \param encoder An encoder instance to set.
- * \param specification See above.
- * \assert
- * \code encoder != NULL \endcode
- * \code specification != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification);
-
- /** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set the precision, in bits, of the quantized linear predictor
- * coefficients, or \c 0 to let the encoder select it based on the
- * blocksize.
- *
- * \note
- * In the current implementation, qlp_coeff_precision + bits_per_sample must
- * be less than 32.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set to \c false to use only the specified quantized linear predictor
- * coefficient precision, or \c true to search neighboring precision
- * values and use the best one.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Deprecated. Setting this value has no effect.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Set to \c false to let the encoder estimate the best model order
- * based on the residual signal energy, or \c true to force the
- * encoder to evaluate all order models and select the best.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
- /** Set the minimum partition order to search when coding the residual.
- * This is used in tandem with
- * FLAC__stream_encoder_set_max_residual_partition_order().
- *
- * The partition order determines the context size in the residual.
- * The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
- *
- * Set both min and max values to \c 0 to force a single context,
- * whose Rice parameter is based on the residual signal variance.
- * Otherwise, set a min and max order, and the encoder will search
- * all orders, using the mean of each context for its Rice parameter,
- * and use the best.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set the maximum partition order to search when coding the residual.
- * This is used in tandem with
- * FLAC__stream_encoder_set_min_residual_partition_order().
- *
- * The partition order determines the context size in the residual.
- * The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
- *
- * Set both min and max values to \c 0 to force a single context,
- * whose Rice parameter is based on the residual signal variance.
- * Otherwise, set a min and max order, and the encoder will search
- * all orders, using the mean of each context for its Rice parameter,
- * and use the best.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Deprecated. Setting this value has no effect.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
-
- /** Set an estimate of the total samples that will be encoded.
- * This is merely an estimate and may be set to \c 0 if unknown.
- * This value will be written to the STREAMINFO block before encoding,
- * and can remove the need for the caller to rewrite the value later
- * if the value is known before encoding.
- *
- * \default \c 0
- * \param encoder An encoder instance to set.
- * \param value See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
-
- /** Set the metadata blocks to be emitted to the stream before encoding.
- * A value of \c NULL, \c 0 implies no metadata; otherwise, supply an
- * array of pointers to metadata blocks. The array is non-const since
- * the encoder may need to change the \a is_last flag inside them, and
- * in some cases update seek point offsets. Otherwise, the encoder will
- * not modify or free the blocks. It is up to the caller to free the
- * metadata blocks after encoding finishes.
- *
- * \note
- * The encoder stores only copies of the pointers in the \a metadata array;
- * the metadata blocks themselves must survive at least until after
- * FLAC__stream_encoder_finish() returns. Do not free the blocks until then.
- *
- * \note
- * The STREAMINFO block is always written and no STREAMINFO block may
- * occur in the supplied array.
- *
- * \note
- * By default the encoder does not create a SEEKTABLE. If one is supplied
- * in the \a metadata array, but the client has specified that it does not
- * support seeking, then the SEEKTABLE will be written verbatim. However
- * by itself this is not very useful as the client will not know the stream
- * offsets for the seekpoints ahead of time. In order to get a proper
- * seektable the client must support seeking. See next note.
- *
- * \note
- * SEEKTABLE blocks are handled specially. Since you will not know
- * the values for the seek point stream offsets, you should pass in
- * a SEEKTABLE 'template', that is, a SEEKTABLE object with the
- * required sample numbers (or placeholder points), with \c 0 for the
- * \a frame_samples and \a stream_offset fields for each point. If the
- * client has specified that it supports seeking by providing a seek
- * callback to FLAC__stream_encoder_init_stream() or both seek AND read
- * callback to FLAC__stream_encoder_init_ogg_stream() (or by using
- * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE()),
- * then while it is encoding the encoder will fill the stream offsets in
- * for you and when encoding is finished, it will seek back and write the
- * real values into the SEEKTABLE block in the stream. There are helper
- * routines for manipulating seektable template blocks; see metadata.h:
- * FLAC__metadata_object_seektable_template_*(). If the client does
- * not support seeking, the SEEKTABLE will have inaccurate offsets which
- * will slow down or remove the ability to seek in the FLAC stream.
- *
- * \note
- * The encoder instance \b will modify the first \c SEEKTABLE block
- * as it transforms the template to a valid seektable while encoding,
- * but it is still up to the caller to free all metadata blocks after
- * encoding.
- *
- * \note
- * A VORBIS_COMMENT block may be supplied. The vendor string in it
- * will be ignored. libFLAC will use it's own vendor string. libFLAC
- * will not modify the passed-in VORBIS_COMMENT's vendor string, it
- * will simply write it's own into the stream. If no VORBIS_COMMENT
- * block is present in the \a metadata array, libFLAC will write an
- * empty one, containing only the vendor string.
- *
- * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be
- * the second metadata block of the stream. The encoder already supplies
- * the STREAMINFO block automatically. If \a metadata does not contain a
- * VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if
- * \a metadata does contain a VORBIS_COMMENT block and it is not the
- * first, the init function will reorder \a metadata by moving the
- * VORBIS_COMMENT block to the front; the relative ordering of the other
- * blocks will remain as they were.
- *
- * \note The Ogg FLAC mapping limits the number of metadata blocks per
- * stream to \c 65535. If \a num_blocks exceeds this the function will
- * return \c false.
- *
- * \default \c NULL, 0
- * \param encoder An encoder instance to set.
- * \param metadata See above.
- * \param num_blocks See above.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- * \c false if the encoder is already initialized, or if
- * \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
-
- /** Get the current encoder state.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__StreamEncoderState
- * The current encoder state.
- */
- FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
-
- /** Get the state of the verify stream decoder.
- * Useful when the stream encoder state is
- * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__StreamDecoderState
- * The verify stream decoder state.
- */
- FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
-
- /** Get the current encoder state as a C string.
- * This version automatically resolves
- * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR by getting the
- * verify decoder's state.
- *
- * \param encoder A encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval const char *
- * The encoder state as a C string. Do not modify the contents.
- */
- FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
-
- /** Get relevant values about the nature of a verify decoder error.
- * Useful when the stream encoder state is
- * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. The arguments should
- * be addresses in which the stats will be returned, or NULL if value
- * is not desired.
- *
- * \param encoder An encoder instance to query.
- * \param absolute_sample The absolute sample number of the mismatch.
- * \param frame_number The number of the frame in which the mismatch occurred.
- * \param channel The channel in which the mismatch occurred.
- * \param sample The number of the sample (relative to the frame) in
- * which the mismatch occurred.
- * \param expected The expected value for the sample in question.
- * \param got The actual value returned by the decoder.
- * \assert
- * \code encoder != NULL \endcode
- */
- FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
-
- /** Get the "verify" flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_verify().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
-
- /** Get the <A HREF="../format.html#subset>Subset</A> flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_streamable_subset().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
-
- /** Get the number of input channels being processed.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_channels().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
-
- /** Get the input sample resolution setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_bits_per_sample().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
-
- /** Get the input sample rate setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_sample_rate().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
-
- /** Get the blocksize setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_blocksize().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
-
- /** Get the "mid/side stereo coding" flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_get_do_mid_side_stereo().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
-
- /** Get the "adaptive mid/side switching" flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_loose_mid_side_stereo().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
-
- /** Get the maximum LPC order setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_max_lpc_order().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
-
- /** Get the quantized linear predictor coefficient precision setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_qlp_coeff_precision().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
-
- /** Get the qlp coefficient precision search flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_do_qlp_coeff_prec_search().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
-
- /** Get the "escape coding" flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_do_escape_coding().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
-
- /** Get the exhaustive model search flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_do_exhaustive_model_search().
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
-
- /** Get the minimum residual partition order setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_min_residual_partition_order().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
-
- /** Get maximum residual partition order setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_max_residual_partition_order().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
-
- /** Get the Rice parameter search distance setting.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval unsigned
- * See FLAC__stream_encoder_set_rice_parameter_search_dist().
- */
- FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
-
- /** Get the previously set estimate of the total samples to be encoded.
- * The encoder merely mimics back the value given to
- * FLAC__stream_encoder_set_total_samples_estimate() since it has no
- * other way of knowing how many samples the client will encode.
- *
- * \param encoder An encoder instance to set.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__uint64
- * See FLAC__stream_encoder_get_total_samples_estimate().
- */
- FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
-
- /** Initialize the encoder instance to encode native FLAC streams.
- *
- * This flavor of initialization sets up the encoder to encode to a
- * native FLAC stream. I/O is performed via callbacks to the client.
- * For encoding to a plain file via filename or open \c FILE*,
- * FLAC__stream_encoder_init_file() and FLAC__stream_encoder_init_FILE()
- * provide a simpler interface.
- *
- * This function should be called after FLAC__stream_encoder_new() and
- * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
- * or FLAC__stream_encoder_process_interleaved().
- * initialization succeeded.
- *
- * The call to FLAC__stream_encoder_init_stream() currently will also
- * immediately call the write callback several times, once with the \c fLaC
- * signature, and once for each encoded metadata block.
- *
- * \param encoder An uninitialized encoder instance.
- * \param write_callback See FLAC__StreamEncoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param seek_callback See FLAC__StreamEncoderSeekCallback. This
- * pointer may be \c NULL if seeking is not
- * supported. The encoder uses seeking to go back
- * and write some some stream statistics to the
- * STREAMINFO block; this is recommended but not
- * necessary to create a valid FLAC stream. If
- * \a seek_callback is not \c NULL then a
- * \a tell_callback must also be supplied.
- * Alternatively, a dummy seek callback that just
- * returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the encoder.
- * \param tell_callback See FLAC__StreamEncoderTellCallback. This
- * pointer may be \c NULL if seeking is not
- * supported. If \a seek_callback is \c NULL then
- * this argument will be ignored. If
- * \a seek_callback is not \c NULL then a
- * \a tell_callback must also be supplied.
- * Alternatively, a dummy tell callback that just
- * returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the encoder.
- * \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired. If the client provides a seek callback,
- * this function is not necessary as the encoder
- * will automatically seek back and update the
- * STREAMINFO block. It may also be \c NULL if the
- * client does not support seeking, since it will
- * have no way of going back to update the
- * STREAMINFO. However the client can still supply
- * a callback if it would like to know the details
- * from the STREAMINFO.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__StreamEncoderInitStatus
- * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
-
- /** Initialize the encoder instance to encode Ogg FLAC streams.
- *
- * This flavor of initialization sets up the encoder to encode to a FLAC
- * stream in an Ogg container. I/O is performed via callbacks to the
- * client. For encoding to a plain file via filename or open \c FILE*,
- * FLAC__stream_encoder_init_ogg_file() and FLAC__stream_encoder_init_ogg_FILE()
- * provide a simpler interface.
- *
- * This function should be called after FLAC__stream_encoder_new() and
- * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
- * or FLAC__stream_encoder_process_interleaved().
- * initialization succeeded.
- *
- * The call to FLAC__stream_encoder_init_ogg_stream() currently will also
- * immediately call the write callback several times to write the metadata
- * packets.
- *
- * \param encoder An uninitialized encoder instance.
- * \param read_callback See FLAC__StreamEncoderReadCallback. This
- * pointer must not be \c NULL if \a seek_callback
- * is non-NULL since they are both needed to be
- * able to write data back to the Ogg FLAC stream
- * in the post-encode phase.
- * \param write_callback See FLAC__StreamEncoderWriteCallback. This
- * pointer must not be \c NULL.
- * \param seek_callback See FLAC__StreamEncoderSeekCallback. This
- * pointer may be \c NULL if seeking is not
- * supported. The encoder uses seeking to go back
- * and write some some stream statistics to the
- * STREAMINFO block; this is recommended but not
- * necessary to create a valid FLAC stream. If
- * \a seek_callback is not \c NULL then a
- * \a tell_callback must also be supplied.
- * Alternatively, a dummy seek callback that just
- * returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the encoder.
- * \param tell_callback See FLAC__StreamEncoderTellCallback. This
- * pointer may be \c NULL if seeking is not
- * supported. If \a seek_callback is \c NULL then
- * this argument will be ignored. If
- * \a seek_callback is not \c NULL then a
- * \a tell_callback must also be supplied.
- * Alternatively, a dummy tell callback that just
- * returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
- * may also be supplied, all though this is slightly
- * less efficient for the encoder.
- * \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
- * pointer may be \c NULL if the callback is not
- * desired. If the client provides a seek callback,
- * this function is not necessary as the encoder
- * will automatically seek back and update the
- * STREAMINFO block. It may also be \c NULL if the
- * client does not support seeking, since it will
- * have no way of going back to update the
- * STREAMINFO. However the client can still supply
- * a callback if it would like to know the details
- * from the STREAMINFO.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__StreamEncoderInitStatus
- * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderReadCallback read_callback, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
-
- /** Initialize the encoder instance to encode native FLAC files.
- *
- * This flavor of initialization sets up the encoder to encode to a
- * plain native FLAC file. For non-stdio streams, you must use
- * FLAC__stream_encoder_init_stream() and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_encoder_new() and
- * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
- * or FLAC__stream_encoder_process_interleaved().
- * initialization succeeded.
- *
- * \param encoder An uninitialized encoder instance.
- * \param file An open file. The file should have been opened
- * with mode \c "w+b" and rewound. The file
- * becomes owned by the encoder and should not be
- * manipulated by the client while encoding.
- * Unless \a file is \c stdout, it will be closed
- * when FLAC__stream_encoder_finish() is called.
- * Note however that a proper SEEKTABLE cannot be
- * created when encoding to \c stdout since it is
- * not seekable.
- * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code encoder != NULL \endcode
- * \code file != NULL \endcode
- * \retval FLAC__StreamEncoderInitStatus
- * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
-
- /** Initialize the encoder instance to encode Ogg FLAC files.
- *
- * This flavor of initialization sets up the encoder to encode to a
- * plain Ogg FLAC file. For non-stdio streams, you must use
- * FLAC__stream_encoder_init_ogg_stream() and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_encoder_new() and
- * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
- * or FLAC__stream_encoder_process_interleaved().
- * initialization succeeded.
- *
- * \param encoder An uninitialized encoder instance.
- * \param file An open file. The file should have been opened
- * with mode \c "w+b" and rewound. The file
- * becomes owned by the encoder and should not be
- * manipulated by the client while encoding.
- * Unless \a file is \c stdout, it will be closed
- * when FLAC__stream_encoder_finish() is called.
- * Note however that a proper SEEKTABLE cannot be
- * created when encoding to \c stdout since it is
- * not seekable.
- * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code encoder != NULL \endcode
- * \code file != NULL \endcode
- * \retval FLAC__StreamEncoderInitStatus
- * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
-
- /** Initialize the encoder instance to encode native FLAC files.
- *
- * This flavor of initialization sets up the encoder to encode to a plain
- * FLAC file. If POSIX fopen() semantics are not sufficient (for example,
- * with Unicode filenames on Windows), you must use
- * FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream()
- * and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_encoder_new() and
- * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
- * or FLAC__stream_encoder_process_interleaved().
- * initialization succeeded.
- *
- * \param encoder An uninitialized encoder instance.
- * \param filename The name of the file to encode to. The file will
- * be opened with fopen(). Use \c NULL to encode to
- * \c stdout. Note however that a proper SEEKTABLE
- * cannot be created when encoding to \c stdout since
- * it is not seekable.
- * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__StreamEncoderInitStatus
- * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
-
- /** Initialize the encoder instance to encode Ogg FLAC files.
- *
- * This flavor of initialization sets up the encoder to encode to a plain
- * Ogg FLAC file. If POSIX fopen() semantics are not sufficient (for example,
- * with Unicode filenames on Windows), you must use
- * FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream()
- * and provide callbacks for the I/O.
- *
- * This function should be called after FLAC__stream_encoder_new() and
- * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
- * or FLAC__stream_encoder_process_interleaved().
- * initialization succeeded.
- *
- * \param encoder An uninitialized encoder instance.
- * \param filename The name of the file to encode to. The file will
- * be opened with fopen(). Use \c NULL to encode to
- * \c stdout. Note however that a proper SEEKTABLE
- * cannot be created when encoding to \c stdout since
- * it is not seekable.
- * \param progress_callback See FLAC__StreamEncoderProgressCallback. This
- * pointer may be \c NULL if the callback is not
- * desired.
- * \param client_data This value will be supplied to callbacks in their
- * \a client_data argument.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__StreamEncoderInitStatus
- * \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
- * see FLAC__StreamEncoderInitStatus for the meanings of other return values.
- */
- FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
-
- /** Finish the encoding process.
- * Flushes the encoding buffer, releases resources, resets the encoder
- * settings to their defaults, and returns the encoder state to
- * FLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate
- * one or more write callbacks before returning, and will generate
- * a metadata callback.
- *
- * Note that in the course of processing the last frame, errors can
- * occur, so the caller should be sure to check the return value to
- * ensure the file was encoded properly.
- *
- * In the event of a prematurely-terminated encode, it is not strictly
- * necessary to call this immediately before FLAC__stream_encoder_delete()
- * but it is good practice to match every FLAC__stream_encoder_init_*()
- * with a FLAC__stream_encoder_finish().
- *
- * \param encoder An uninitialized encoder instance.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if an error occurred processing the last frame; or if verify
- * mode is set (see FLAC__stream_encoder_set_verify()), there was a
- * verify mismatch; else \c true. If \c false, caller should check the
- * state with FLAC__stream_encoder_get_state() for more information
- * about the error.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
-
- /** Submit data for encoding.
- * This version allows you to supply the input data via an array of
- * pointers, each pointer pointing to an array of \a samples samples
- * representing one channel. The samples need not be block-aligned,
- * but each channel should have the same number of samples. Each sample
- * should be a signed integer, right-justified to the resolution set by
- * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
- * resolution is 16 bits per sample, the samples should all be in the
- * range [-32768,32767].
- *
- * For applications where channel order is important, channels must
- * follow the order as described in the
- * <A HREF="../format.html#frame_header">frame header</A>.
- *
- * \param encoder An initialized encoder instance in the OK state.
- * \param buffer An array of pointers to each channel's signal.
- * \param samples The number of samples in one channel.
- * \assert
- * \code encoder != NULL \endcode
- * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false; in this case, check the
- * encoder state with FLAC__stream_encoder_get_state() to see what
- * went wrong.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
-
- /** Submit data for encoding.
- * This version allows you to supply the input data where the channels
- * are interleaved into a single array (i.e. channel0_sample0,
- * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
- * The samples need not be block-aligned but they must be
- * sample-aligned, i.e. the first value should be channel0_sample0
- * and the last value channelN_sampleM. Each sample should be a signed
- * integer, right-justified to the resolution set by
- * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
- * resolution is 16 bits per sample, the samples should all be in the
- * range [-32768,32767].
- *
- * For applications where channel order is important, channels must
- * follow the order as described in the
- * <A HREF="../format.html#frame_header">frame header</A>.
- *
- * \param encoder An initialized encoder instance in the OK state.
- * \param buffer An array of channel-interleaved data (see above).
- * \param samples The number of samples in one channel, the same as for
- * FLAC__stream_encoder_process(). For example, if
- * encoding two channels, \c 1000 \a samples corresponds
- * to a \a buffer of 2000 values.
- * \assert
- * \code encoder != NULL \endcode
- * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
- * \retval FLAC__bool
- * \c true if successful, else \c false; in this case, check the
- * encoder state with FLAC__stream_encoder_get_state() to see what
- * went wrong.
- */
- FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
-
- /* \} */
+/* \} */
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/alloc.h b/src/filters/transform/MpaDecFilter/libflac/include/share/alloc.h
index c479c92b4..efc0113ed 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/alloc.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/alloc.h
@@ -49,161 +49,160 @@
*/
static void *safe_malloc_(size_t size)
{
- /* malloc(0) is undefined; FLAC src convention is to always allocate */
- if(!size)
- size++;
- return malloc(size);
+ /* malloc(0) is undefined; FLAC src convention is to always allocate */
+ if(!size)
+ size++;
+ return malloc(size);
}
static void *safe_calloc_(size_t nmemb, size_t size)
{
- if(!nmemb || !size)
- return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
- return calloc(nmemb, size);
+ if(!nmemb || !size)
+ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
+ return calloc(nmemb, size);
}
/*@@@@ there's probably a better way to prevent overflows when allocating untrusted sums but this works for now */
static void *safe_malloc_add_2op_(size_t size1, size_t size2)
{
- size2 += size1;
- if(size2 < size1)
- return 0;
- return safe_malloc_(size2);
+ size2 += size1;
+ if(size2 < size1)
+ return 0;
+ return safe_malloc_(size2);
}
static void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
{
- size2 += size1;
- if(size2 < size1)
- return 0;
- size3 += size2;
- if(size3 < size2)
- return 0;
- return safe_malloc_(size3);
+ size2 += size1;
+ if(size2 < size1)
+ return 0;
+ size3 += size2;
+ if(size3 < size2)
+ return 0;
+ return safe_malloc_(size3);
}
static void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
{
- size2 += size1;
- if(size2 < size1)
- return 0;
- size3 += size2;
- if(size3 < size2)
- return 0;
- size4 += size3;
- if(size4 < size3)
- return 0;
- return safe_malloc_(size4);
+ size2 += size1;
+ if(size2 < size1)
+ return 0;
+ size3 += size2;
+ if(size3 < size2)
+ return 0;
+ size4 += size3;
+ if(size4 < size3)
+ return 0;
+ return safe_malloc_(size4);
}
static void *safe_malloc_mul_2op_(size_t size1, size_t size2)
#if 0
needs support for cases where sizeof(size_t) != 4
{
- /* could be faster #ifdef'ing off SIZEOF_SIZE_T */
- if(sizeof(size_t) == 4)
- {
- if((double)size1 *(double)size2 < 4294967296.0)
- return malloc(size1 * size2);
- }
- return 0;
+ /* could be faster #ifdef'ing off SIZEOF_SIZE_T */
+ if(sizeof(size_t) == 4) {
+ if ((double)size1 * (double)size2 < 4294967296.0)
+ return malloc(size1*size2);
+ }
+ return 0;
}
#else
/* better? */
{
- if(!size1 || !size2)
- return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
- if(size1 > SIZE_MAX / size2)
- return 0;
- return malloc(size1*size2);
+ if(!size1 || !size2)
+ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
+ if(size1 > SIZE_MAX / size2)
+ return 0;
+ return malloc(size1*size2);
}
#endif
static void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
{
- if(!size1 || !size2 || !size3)
- return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
- if(size1 > SIZE_MAX / size2)
- return 0;
- size1 *= size2;
- if(size1 > SIZE_MAX / size3)
- return 0;
- return malloc(size1 * size3);
+ if(!size1 || !size2 || !size3)
+ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
+ if(size1 > SIZE_MAX / size2)
+ return 0;
+ size1 *= size2;
+ if(size1 > SIZE_MAX / size3)
+ return 0;
+ return malloc(size1*size3);
}
/* size1*size2 + size3 */
static void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3)
{
- if(!size1 || !size2)
- return safe_malloc_(size3);
- if(size1 > SIZE_MAX / size2)
- return 0;
- return safe_malloc_add_2op_(size1 * size2, size3);
+ if(!size1 || !size2)
+ return safe_malloc_(size3);
+ if(size1 > SIZE_MAX / size2)
+ return 0;
+ return safe_malloc_add_2op_(size1*size2, size3);
}
/* size1 * (size2 + size3) */
static void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3)
{
- if(!size1 || (!size2 && !size3))
- return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
- size2 += size3;
- if(size2 < size3)
- return 0;
- return safe_malloc_mul_2op_(size1, size2);
+ if(!size1 || (!size2 && !size3))
+ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
+ size2 += size3;
+ if(size2 < size3)
+ return 0;
+ return safe_malloc_mul_2op_(size1, size2);
}
static void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2)
{
- size2 += size1;
- if(size2 < size1)
- return 0;
- return realloc(ptr, size2);
+ size2 += size1;
+ if(size2 < size1)
+ return 0;
+ return realloc(ptr, size2);
}
static void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
{
- size2 += size1;
- if(size2 < size1)
- return 0;
- size3 += size2;
- if(size3 < size2)
- return 0;
- return realloc(ptr, size3);
+ size2 += size1;
+ if(size2 < size1)
+ return 0;
+ size3 += size2;
+ if(size3 < size2)
+ return 0;
+ return realloc(ptr, size3);
}
static void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
{
- size2 += size1;
- if(size2 < size1)
- return 0;
- size3 += size2;
- if(size3 < size2)
- return 0;
- size4 += size3;
- if(size4 < size3)
- return 0;
- return realloc(ptr, size4);
+ size2 += size1;
+ if(size2 < size1)
+ return 0;
+ size3 += size2;
+ if(size3 < size2)
+ return 0;
+ size4 += size3;
+ if(size4 < size3)
+ return 0;
+ return realloc(ptr, size4);
}
static void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
{
- if(!size1 || !size2)
- return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
- if(size1 > SIZE_MAX / size2)
- return 0;
- return realloc(ptr, size1 * size2);
+ if(!size1 || !size2)
+ return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
+ if(size1 > SIZE_MAX / size2)
+ return 0;
+ return realloc(ptr, size1*size2);
}
/* size1 * (size2 + size3) */
static void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
{
- if(!size1 || (!size2 && !size3))
- return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
- size2 += size3;
- if(size2 < size3)
- return 0;
- return safe_realloc_mul_2op_(ptr, size1, size2);
+ if(!size1 || (!size2 && !size3))
+ return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
+ size2 += size3;
+ if(size2 < size3)
+ return 0;
+ return safe_realloc_mul_2op_(ptr, size1, size2);
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/getopt.h b/src/filters/transform/MpaDecFilter/libflac/include/share/getopt.h
index d34852e18..1b314b2e7 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/getopt.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/getopt.h
@@ -42,137 +42,137 @@
extern "C" {
#endif
- /* For communication from `share__getopt' to the caller.
- When `share__getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
+/* For communication from `share__getopt' to the caller.
+ When `share__getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
- extern char *share__optarg;
+extern char *share__optarg;
- /* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `share__getopt'.
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `share__getopt'.
- On entry to `share__getopt', zero means this is the first call; initialize.
+ On entry to `share__getopt', zero means this is the first call; initialize.
- When `share__getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
+ When `share__getopt' returns -1, this is the index of the first of the
+ non-option elements that the caller should itself scan.
- Otherwise, `share__optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
+ Otherwise, `share__optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
- extern int share__optind;
+extern int share__optind;
- /* Callers store zero here to inhibit the error message `share__getopt' prints
- for unrecognized options. */
+/* Callers store zero here to inhibit the error message `share__getopt' prints
+ for unrecognized options. */
- extern int share__opterr;
+extern int share__opterr;
- /* Set to an option character which was unrecognized. */
+/* Set to an option character which was unrecognized. */
- extern int share__optopt;
+extern int share__optopt;
- /*[JEC] was:#ifndef __need_getopt */
- /* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to share__getopt_long or share__getopt_long_only is a vector
- of `struct share__option' terminated by an element containing a name which is
- zero.
+/*[JEC] was:#ifndef __need_getopt */
+/* Describe the long-named options requested by the application.
+ The LONG_OPTIONS argument to share__getopt_long or share__getopt_long_only is a vector
+ of `struct share__option' terminated by an element containing a name which is
+ zero.
- The field `has_arg' is:
- share__no_argument (or 0) if the option does not take an argument,
- share__required_argument (or 1) if the option requires an argument,
- share__optional_argument (or 2) if the option takes an optional argument.
+ The field `has_arg' is:
+ share__no_argument (or 0) if the option does not take an argument,
+ share__required_argument (or 1) if the option requires an argument,
+ share__optional_argument (or 2) if the option takes an optional argument.
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
+ If the field `flag' is not NULL, it points to a variable that is set
+ to the value given in the field `val' when the option is found, but
+ left unchanged if the option is not found.
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `share__optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `share__getopt'
- returns the contents of the `val' field. */
+ To have a long-named option do something other than set an `int' to
+ a compiled-in constant, such as set a value from `share__optarg', set the
+ option's `flag' field to zero and its `val' field to a nonzero
+ value (the equivalent single-letter option character, if there is
+ one). For long options that have a zero `flag' field, `share__getopt'
+ returns the contents of the `val' field. */
- struct share__option
- {
+struct share__option
+{
# if defined __STDC__ && __STDC__
- const char *name;
+ const char *name;
# else
- char *name;
+ char *name;
# endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
- };
+ /* has_arg can't be an enum because some compilers complain about
+ type mismatches in all the code that assumes it is an int. */
+ int has_arg;
+ int *flag;
+ int val;
+};
- /* Names for the values of the `has_arg' field of `struct share__option'. */
+/* Names for the values of the `has_arg' field of `struct share__option'. */
# define share__no_argument 0
# define share__required_argument 1
# define share__optional_argument 2
- /*[JEC] was:#endif*/ /* need getopt */
-
-
- /* Get definitions and prototypes for functions to process the
- arguments in ARGV (ARGC of them, minus the program name) for
- options given in OPTS.
-
- Return the option character from OPTS just read. Return -1 when
- there are no more options. For unrecognized options, or options
- missing arguments, `share__optopt' is set to the option letter, and '?' is
- returned.
-
- The OPTS string is a list of characters which are recognized option
- letters, optionally followed by colons, specifying that that letter
- takes an argument, to be placed in `share__optarg'.
-
- If a letter in OPTS is followed by two colons, its argument is
- optional. This behavior is specific to the GNU `share__getopt'.
-
- The argument `--' causes premature termination of argument
- scanning, explicitly telling `share__getopt' that there are no more
- options.
-
- If OPTS begins with `--', then non-option arguments are treated as
- arguments to the option '\0'. This behavior is specific to the GNU
- `share__getopt'. */
-
- /*[JEC] was:#if defined __STDC__ && __STDC__*/
- /*[JEC] was:# ifdef __GNU_LIBRARY__*/
- /* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. To avoid compilation
- errors, only prototype getopt for the GNU C library. */
- extern int share__getopt(int argc, char *const *argv, const char *shortopts);
- /*[JEC] was:# else*/ /* not __GNU_LIBRARY__ */
- /*[JEC] was:extern int getopt ();*/
- /*[JEC] was:# endif*/ /* __GNU_LIBRARY__ */
-
- /*[JEC] was:# ifndef __need_getopt*/
- extern int share__getopt_long(int argc, char *const *argv, const char *shortopts,
- const struct share__option *longopts, int *longind);
- extern int share__getopt_long_only(int argc, char *const *argv,
- const char *shortopts,
- const struct share__option *longopts, int *longind);
-
- /* Internal only. Users should not call this directly. */
- extern int share___getopt_internal(int argc, char *const *argv,
- const char *shortopts,
- const struct share__option *longopts, int *longind,
- int long_only);
- /*[JEC] was:# endif*/
- /*[JEC] was:#else*/ /* not __STDC__ */
- /*[JEC] was:extern int getopt ();*/
- /*[JEC] was:# ifndef __need_getopt*/
- /*[JEC] was:extern int getopt_long ();*/
- /*[JEC] was:extern int getopt_long_only ();*/
-
- /*[JEC] was:extern int _getopt_internal ();*/
- /*[JEC] was:# endif*/
- /*[JEC] was:#endif*/ /* __STDC__ */
+/*[JEC] was:#endif*/ /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+ arguments in ARGV (ARGC of them, minus the program name) for
+ options given in OPTS.
+
+ Return the option character from OPTS just read. Return -1 when
+ there are no more options. For unrecognized options, or options
+ missing arguments, `share__optopt' is set to the option letter, and '?' is
+ returned.
+
+ The OPTS string is a list of characters which are recognized option
+ letters, optionally followed by colons, specifying that that letter
+ takes an argument, to be placed in `share__optarg'.
+
+ If a letter in OPTS is followed by two colons, its argument is
+ optional. This behavior is specific to the GNU `share__getopt'.
+
+ The argument `--' causes premature termination of argument
+ scanning, explicitly telling `share__getopt' that there are no more
+ options.
+
+ If OPTS begins with `--', then non-option arguments are treated as
+ arguments to the option '\0'. This behavior is specific to the GNU
+ `share__getopt'. */
+
+/*[JEC] was:#if defined __STDC__ && __STDC__*/
+/*[JEC] was:# ifdef __GNU_LIBRARY__*/
+/* Many other libraries have conflicting prototypes for getopt, with
+ differences in the consts, in stdlib.h. To avoid compilation
+ errors, only prototype getopt for the GNU C library. */
+extern int share__getopt (int argc, char *const *argv, const char *shortopts);
+/*[JEC] was:# else*/ /* not __GNU_LIBRARY__ */
+/*[JEC] was:extern int getopt ();*/
+/*[JEC] was:# endif*/ /* __GNU_LIBRARY__ */
+
+/*[JEC] was:# ifndef __need_getopt*/
+extern int share__getopt_long (int argc, char *const *argv, const char *shortopts,
+ const struct share__option *longopts, int *longind);
+extern int share__getopt_long_only (int argc, char *const *argv,
+ const char *shortopts,
+ const struct share__option *longopts, int *longind);
+
+/* Internal only. Users should not call this directly. */
+extern int share___getopt_internal (int argc, char *const *argv,
+ const char *shortopts,
+ const struct share__option *longopts, int *longind,
+ int long_only);
+/*[JEC] was:# endif*/
+/*[JEC] was:#else*/ /* not __STDC__ */
+/*[JEC] was:extern int getopt ();*/
+/*[JEC] was:# ifndef __need_getopt*/
+/*[JEC] was:extern int getopt_long ();*/
+/*[JEC] was:extern int getopt_long_only ();*/
+
+/*[JEC] was:extern int _getopt_internal ();*/
+/*[JEC] was:# endif*/
+/*[JEC] was:#endif*/ /* __STDC__ */
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/cuesheet.h b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/cuesheet.h
index 5409de586..c8e2741dc 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/cuesheet.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/cuesheet.h
@@ -28,12 +28,12 @@
extern "C" {
#endif
- unsigned grabbag__cuesheet_msf_to_frame(unsigned minutes, unsigned seconds, unsigned frames);
- void grabbag__cuesheet_frame_to_msf(unsigned frame, unsigned *minutes, unsigned *seconds, unsigned *frames);
+unsigned grabbag__cuesheet_msf_to_frame(unsigned minutes, unsigned seconds, unsigned frames);
+void grabbag__cuesheet_frame_to_msf(unsigned frame, unsigned *minutes, unsigned *seconds, unsigned *frames);
- FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, unsigned *last_line_read, unsigned sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset);
+FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, unsigned *last_line_read, unsigned sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset);
- void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference);
+void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/file.h b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/file.h
index e65e7f537..8711e1f7a 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/file.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/file.h
@@ -36,25 +36,25 @@
extern "C" {
#endif
- void grabbag__file_copy_metadata(const char *srcpath, const char *destpath);
- off_t grabbag__file_get_filesize(const char *srcpath);
- const char *grabbag__file_get_basename(const char *srcpath);
+void grabbag__file_copy_metadata(const char *srcpath, const char *destpath);
+off_t grabbag__file_get_filesize(const char *srcpath);
+const char *grabbag__file_get_basename(const char *srcpath);
- /* read_only == false means "make file writable by user"
- * read_only == true means "make file read-only for everyone"
- */
- FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only);
+/* read_only == false means "make file writable by user"
+ * read_only == true means "make file read-only for everyone"
+ */
+FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only);
- /* returns true iff stat() succeeds for both files and they have the same device and inode. */
- /* on windows, uses GetFileInformationByHandle() to compare */
- FLAC__bool grabbag__file_are_same(const char *f1, const char *f2);
+/* returns true iff stat() succeeds for both files and they have the same device and inode. */
+/* on windows, uses GetFileInformationByHandle() to compare */
+FLAC__bool grabbag__file_are_same(const char *f1, const char *f2);
- /* attempts to make writable before unlinking */
- FLAC__bool grabbag__file_remove_file(const char *filename);
+/* attempts to make writable before unlinking */
+FLAC__bool grabbag__file_remove_file(const char *filename);
- /* these will forcibly set stdin/stdout to binary mode (for OSes that require it) */
- FILE *grabbag__file_get_binary_stdin(void);
- FILE *grabbag__file_get_binary_stdout(void);
+/* these will forcibly set stdin/stdout to binary mode (for OSes that require it) */
+FILE *grabbag__file_get_binary_stdin(void);
+FILE *grabbag__file_get_binary_stdout(void);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/picture.h b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/picture.h
index ed8f11415..166b96142 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/picture.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/picture.h
@@ -27,17 +27,17 @@
extern "C" {
#endif
- /* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g.
- * "|image/jpeg|||cover.jpg"
- * "4|image/jpeg||300x300x24|backcover.jpg"
- * "|image/png|description|300x300x24/71|cover.png"
- * "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif"
- *
- * empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER
- * empty resolution spec means to get from the file (cannot get used with "-->" linked images)
- * spec and error_message must not be NULL
- */
- FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message);
+/* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g.
+ * "|image/jpeg|||cover.jpg"
+ * "4|image/jpeg||300x300x24|backcover.jpg"
+ * "|image/png|description|300x300x24/71|cover.png"
+ * "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif"
+ *
+ * empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER
+ * empty resolution spec means to get from the file (cannot get used with "-->" linked images)
+ * spec and error_message must not be NULL
+ */
+FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/replaygain.h b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/replaygain.h
index 8e34f5ceb..c70c1862e 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/replaygain.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/replaygain.h
@@ -33,37 +33,37 @@
extern "C" {
#endif
- extern const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;
+extern const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;
- extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS; /* = "REPLAYGAIN_REFERENCE_LOUDNESS" */
- extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN; /* = "REPLAYGAIN_TRACK_GAIN" */
- extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK; /* = "REPLAYGAIN_TRACK_PEAK" */
- extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN; /* = "REPLAYGAIN_ALBUM_GAIN" */
- extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK; /* = "REPLAYGAIN_ALBUM_PEAK" */
+extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS; /* = "REPLAYGAIN_REFERENCE_LOUDNESS" */
+extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN; /* = "REPLAYGAIN_TRACK_GAIN" */
+extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK; /* = "REPLAYGAIN_TRACK_PEAK" */
+extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN; /* = "REPLAYGAIN_ALBUM_GAIN" */
+extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK; /* = "REPLAYGAIN_ALBUM_PEAK" */
- FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency);
+FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency);
- FLAC__bool grabbag__replaygain_init(unsigned sample_frequency);
+FLAC__bool grabbag__replaygain_init(unsigned sample_frequency);
- /* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */
- FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, unsigned bps, unsigned samples);
+/* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */
+FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, unsigned bps, unsigned samples);
- void grabbag__replaygain_get_album(float *gain, float *peak);
- void grabbag__replaygain_get_title(float *gain, float *peak);
+void grabbag__replaygain_get_album(float *gain, float *peak);
+void grabbag__replaygain_get_title(float *gain, float *peak);
- /* These three functions return an error string on error, or NULL if successful */
- const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak);
- const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak);
- const char *grabbag__replaygain_store_to_vorbiscomment_reference(FLAC__StreamMetadata *block);
- const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak);
- const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak);
- const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime);
- const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime);
- const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime);
- const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime);
+/* These three functions return an error string on error, or NULL if successful */
+const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak);
+const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak);
+const char *grabbag__replaygain_store_to_vorbiscomment_reference(FLAC__StreamMetadata *block);
+const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak);
+const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak);
+const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime);
+const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime);
+const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime);
+const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime);
- FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, FLAC__bool strict, double *reference, double *gain, double *peak);
- double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping);
+FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, FLAC__bool strict, double *reference, double *gain, double *peak);
+double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/seektable.h b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/seektable.h
index f4d44d6ad..67c91551b 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/seektable.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/grabbag/seektable.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
- FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points);
+FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points);
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_analysis.h b/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_analysis.h
index f053afb7f..02067d21f 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_analysis.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_analysis.h
@@ -42,15 +42,15 @@
extern "C" {
#endif
- typedef float Float_t; /* Type used for filtering */
+typedef float Float_t; /* Type used for filtering */
- extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
+extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
- int InitGainAnalysis(long samplefreq);
- int AnalyzeSamples(const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels);
- int ResetSampleFrequency(long samplefreq);
- Float_t GetTitleGain(void);
- Float_t GetAlbumGain(void);
+int InitGainAnalysis ( long samplefreq );
+int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
+int ResetSampleFrequency ( long samplefreq );
+Float_t GetTitleGain ( void );
+Float_t GetAlbumGain ( void );
#ifdef __cplusplus
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_synthesis.h b/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_synthesis.h
index 7f05a4611..a1fdc5a4d 100644
--- a/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_synthesis.h
+++ b/src/filters/transform/MpaDecFilter/libflac/include/share/replaygain_synthesis.h
@@ -24,25 +24,23 @@
#define FLAC_SHARE__MAX_SUPPORTED_CHANNELS 2
-typedef enum
-{
- NOISE_SHAPING_NONE = 0,
- NOISE_SHAPING_LOW = 1,
- NOISE_SHAPING_MEDIUM = 2,
- NOISE_SHAPING_HIGH = 3
+typedef enum {
+ NOISE_SHAPING_NONE = 0,
+ NOISE_SHAPING_LOW = 1,
+ NOISE_SHAPING_MEDIUM = 2,
+ NOISE_SHAPING_HIGH = 3
} NoiseShaping;
-typedef struct
-{
- const float* FilterCoeff;
- FLAC__uint64 Mask;
- double Add;
- float Dither;
- float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
- float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
- int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
- unsigned LastHistoryIndex;
- NoiseShaping ShapingType;
+typedef struct {
+ const float* FilterCoeff;
+ FLAC__uint64 Mask;
+ double Add;
+ float Dither;
+ float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
+ float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
+ int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
+ unsigned LastHistoryIndex;
+ NoiseShaping ShapingType;
} DitherContext;
void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype);
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/bitwise.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/bitwise.c
index ad3199032..6eb58ad3d 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/bitwise.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/bitwise.c
@@ -24,546 +24,465 @@
#define BUFFER_INCREMENT 256
-static const unsigned long mask[] =
-{
- 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f,
- 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff,
- 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff,
- 0x00007fff, 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
- 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
- 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff,
- 0x3fffffff, 0x7fffffff, 0xffffffff
-};
-
-static const unsigned int mask8B[] =
-{0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
-
-void oggpack_writeinit(oggpack_buffer *b)
-{
- memset(b, 0, sizeof(*b));
- b->ptr = b->buffer = _ogg_malloc(BUFFER_INCREMENT);
- b->buffer[0] = '\0';
- b->storage = BUFFER_INCREMENT;
-}
-
-void oggpackB_writeinit(oggpack_buffer *b)
-{
- oggpack_writeinit(b);
-}
-
-int oggpack_writecheck(oggpack_buffer *b)
-{
- if(!b->ptr || !b->storage)return -1;
- return 0;
-}
-
-int oggpackB_writecheck(oggpack_buffer *b)
-{
- return oggpack_writecheck(b);
-}
-
-void oggpack_writetrunc(oggpack_buffer *b, long bits)
-{
- long bytes = bits >> 3;
- if(b->ptr)
- {
- bits -= bytes * 8;
- b->ptr = b->buffer + bytes;
- b->endbit = bits;
- b->endbyte = bytes;
- *b->ptr &= mask[bits];
- }
+static const unsigned long mask[]=
+{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
+ 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
+ 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
+ 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
+ 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
+ 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
+ 0x3fffffff,0x7fffffff,0xffffffff };
+
+static const unsigned int mask8B[]=
+{0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};
+
+void oggpack_writeinit(oggpack_buffer *b){
+ memset(b,0,sizeof(*b));
+ b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT);
+ b->buffer[0]='\0';
+ b->storage=BUFFER_INCREMENT;
}
-void oggpackB_writetrunc(oggpack_buffer *b, long bits)
-{
- long bytes = bits >> 3;
- if(b->ptr)
- {
- bits -= bytes * 8;
- b->ptr = b->buffer + bytes;
- b->endbit = bits;
- b->endbyte = bytes;
- *b->ptr &= mask8B[bits];
- }
+void oggpackB_writeinit(oggpack_buffer *b){
+ oggpack_writeinit(b);
}
-/* Takes only up to 32 bits. */
-void oggpack_write(oggpack_buffer *b, unsigned long value, int bits)
-{
- if(b->endbyte + 4 >= b->storage)
- {
- void *ret;
- if(!b->ptr)return;
- ret = _ogg_realloc(b->buffer, b->storage + BUFFER_INCREMENT);
- if(!ret)
- {
- oggpack_writeclear(b);
- return;
- }
- b->buffer = ret;
- b->storage += BUFFER_INCREMENT;
- b->ptr = b->buffer + b->endbyte;
- }
+int oggpack_writecheck(oggpack_buffer *b){
+ if(!b->ptr || !b->storage)return -1;
+ return 0;
+}
- value &= mask[bits];
- bits += b->endbit;
-
- b->ptr[0] |= value << b->endbit;
-
- if(bits >= 8)
- {
- b->ptr[1] = (unsigned char)(value >> (8 - b->endbit));
- if(bits >= 16)
- {
- b->ptr[2] = (unsigned char)(value >> (16 - b->endbit));
- if(bits >= 24)
- {
- b->ptr[3] = (unsigned char)(value >> (24 - b->endbit));
- if(bits >= 32)
- {
- if(b->endbit)
- b->ptr[4] = (unsigned char)(value >> (32 - b->endbit));
- else
- b->ptr[4] = 0;
- }
- }
- }
- }
+int oggpackB_writecheck(oggpack_buffer *b){
+ return oggpack_writecheck(b);
+}
- b->endbyte += bits / 8;
- b->ptr += bits / 8;
- b->endbit = bits & 7;
+void oggpack_writetrunc(oggpack_buffer *b,long bits){
+ long bytes=bits>>3;
+ if(b->ptr){
+ bits-=bytes*8;
+ b->ptr=b->buffer+bytes;
+ b->endbit=bits;
+ b->endbyte=bytes;
+ *b->ptr&=mask[bits];
+ }
+}
+
+void oggpackB_writetrunc(oggpack_buffer *b,long bits){
+ long bytes=bits>>3;
+ if(b->ptr){
+ bits-=bytes*8;
+ b->ptr=b->buffer+bytes;
+ b->endbit=bits;
+ b->endbyte=bytes;
+ *b->ptr&=mask8B[bits];
+ }
}
/* Takes only up to 32 bits. */
-void oggpackB_write(oggpack_buffer *b, unsigned long value, int bits)
-{
- if(b->endbyte + 4 >= b->storage)
- {
- void *ret;
- if(!b->ptr)return;
- ret = _ogg_realloc(b->buffer, b->storage + BUFFER_INCREMENT);
- if(!ret)
- {
- oggpack_writeclear(b);
- return;
+void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
+ if(b->endbyte+4>=b->storage){
+ void *ret;
+ if(!b->ptr)return;
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ if(!ret){
+ oggpack_writeclear(b);
+ return;
+ }
+ b->buffer=ret;
+ b->storage+=BUFFER_INCREMENT;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ value&=mask[bits];
+ bits+=b->endbit;
+
+ b->ptr[0]|=value<<b->endbit;
+
+ if(bits>=8){
+ b->ptr[1]=(unsigned char)(value>>(8-b->endbit));
+ if(bits>=16){
+ b->ptr[2]=(unsigned char)(value>>(16-b->endbit));
+ if(bits>=24){
+ b->ptr[3]=(unsigned char)(value>>(24-b->endbit));
+ if(bits>=32){
+ if(b->endbit)
+ b->ptr[4]=(unsigned char)(value>>(32-b->endbit));
+ else
+ b->ptr[4]=0;
}
- b->buffer = ret;
- b->storage += BUFFER_INCREMENT;
- b->ptr = b->buffer + b->endbyte;
+ }
}
+ }
- value = (value & mask[bits]) << (32 - bits);
- bits += b->endbit;
-
- b->ptr[0] |= value >> (24 + b->endbit);
-
- if(bits >= 8)
- {
- b->ptr[1] = (unsigned char)(value >> (16 + b->endbit));
- if(bits >= 16)
- {
- b->ptr[2] = (unsigned char)(value >> (8 + b->endbit));
- if(bits >= 24)
- {
- b->ptr[3] = (unsigned char)(value >> (b->endbit));
- if(bits >= 32)
- {
- if(b->endbit)
- b->ptr[4] = (unsigned char)(value << (8 - b->endbit));
- else
- b->ptr[4] = 0;
- }
- }
+ b->endbyte+=bits/8;
+ b->ptr+=bits/8;
+ b->endbit=bits&7;
+}
+
+/* Takes only up to 32 bits. */
+void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){
+ if(b->endbyte+4>=b->storage){
+ void *ret;
+ if(!b->ptr)return;
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ if(!ret){
+ oggpack_writeclear(b);
+ return;
+ }
+ b->buffer=ret;
+ b->storage+=BUFFER_INCREMENT;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ value=(value&mask[bits])<<(32-bits);
+ bits+=b->endbit;
+
+ b->ptr[0]|=value>>(24+b->endbit);
+
+ if(bits>=8){
+ b->ptr[1]=(unsigned char)(value>>(16+b->endbit));
+ if(bits>=16){
+ b->ptr[2]=(unsigned char)(value>>(8+b->endbit));
+ if(bits>=24){
+ b->ptr[3]=(unsigned char)(value>>(b->endbit));
+ if(bits>=32){
+ if(b->endbit)
+ b->ptr[4]=(unsigned char)(value<<(8-b->endbit));
+ else
+ b->ptr[4]=0;
}
+ }
}
+ }
- b->endbyte += bits / 8;
- b->ptr += bits / 8;
- b->endbit = bits & 7;
+ b->endbyte+=bits/8;
+ b->ptr+=bits/8;
+ b->endbit=bits&7;
}
-void oggpack_writealign(oggpack_buffer *b)
-{
- int bits = 8 - b->endbit;
- if(bits < 8)
- oggpack_write(b, 0, bits);
+void oggpack_writealign(oggpack_buffer *b){
+ int bits=8-b->endbit;
+ if(bits<8)
+ oggpack_write(b,0,bits);
}
-void oggpackB_writealign(oggpack_buffer *b)
-{
- int bits = 8 - b->endbit;
- if(bits < 8)
- oggpackB_write(b, 0, bits);
+void oggpackB_writealign(oggpack_buffer *b){
+ int bits=8-b->endbit;
+ if(bits<8)
+ oggpackB_write(b,0,bits);
}
static void oggpack_writecopy_helper(oggpack_buffer *b,
-void *source,
-long bits,
-void (*w)(oggpack_buffer *,
-unsigned long,
-int),
-int msb)
-{
- unsigned char *ptr = (unsigned char *)source;
-
- long bytes = bits / 8;
- bits -= bytes * 8;
-
- if(b->endbit)
- {
- int i;
- /* unaligned copy. Do it the hard way. */
- for(i = 0; i < bytes; i++)
- w(b, (unsigned long)(ptr[i]), 8);
- }
+ void *source,
+ long bits,
+ void (*w)(oggpack_buffer *,
+ unsigned long,
+ int),
+ int msb){
+ unsigned char *ptr=(unsigned char *)source;
+
+ long bytes=bits/8;
+ bits-=bytes*8;
+
+ if(b->endbit){
+ int i;
+ /* unaligned copy. Do it the hard way. */
+ for(i=0;i<bytes;i++)
+ w(b,(unsigned long)(ptr[i]),8);
+ }else{
+ /* aligned block copy */
+ if(b->endbyte+bytes+1>=b->storage){
+ void *ret;
+ if(!b->ptr)return;
+ b->storage=b->endbyte+bytes+BUFFER_INCREMENT;
+ ret=_ogg_realloc(b->buffer,b->storage);
+ if(!ret){
+ oggpack_writeclear(b);
+ return;
+ }
+ b->buffer=ret;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ memmove(b->ptr,source,bytes);
+ b->ptr+=bytes;
+ b->endbyte+=bytes;
+ *b->ptr=0;
+
+ }
+ if(bits){
+ if(msb)
+ w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);
else
- {
- /* aligned block copy */
- if(b->endbyte + bytes + 1 >= b->storage)
- {
- void *ret;
- if(!b->ptr)return;
- b->storage = b->endbyte + bytes + BUFFER_INCREMENT;
- ret = _ogg_realloc(b->buffer, b->storage);
- if(!ret)
- {
- oggpack_writeclear(b);
- return;
- }
- b->buffer = ret;
- b->ptr = b->buffer + b->endbyte;
- }
-
- memmove(b->ptr, source, bytes);
- b->ptr += bytes;
- b->endbyte += bytes;
- *b->ptr = 0;
-
- }
- if(bits)
- {
- if(msb)
- w(b, (unsigned long)(ptr[bytes] >> (8 - bits)), bits);
- else
- w(b, (unsigned long)(ptr[bytes]), bits);
- }
+ w(b,(unsigned long)(ptr[bytes]),bits);
+ }
}
-void oggpack_writecopy(oggpack_buffer *b, void *source, long bits)
-{
- oggpack_writecopy_helper(b, source, bits, oggpack_write, 0);
+void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){
+ oggpack_writecopy_helper(b,source,bits,oggpack_write,0);
}
-void oggpackB_writecopy(oggpack_buffer *b, void *source, long bits)
-{
- oggpack_writecopy_helper(b, source, bits, oggpackB_write, 1);
+void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){
+ oggpack_writecopy_helper(b,source,bits,oggpackB_write,1);
}
-void oggpack_reset(oggpack_buffer *b)
-{
- if(!b->ptr)return;
- b->ptr = b->buffer;
- b->buffer[0] = 0;
- b->endbit = b->endbyte = 0;
+void oggpack_reset(oggpack_buffer *b){
+ if(!b->ptr)return;
+ b->ptr=b->buffer;
+ b->buffer[0]=0;
+ b->endbit=b->endbyte=0;
}
-void oggpackB_reset(oggpack_buffer *b)
-{
- oggpack_reset(b);
+void oggpackB_reset(oggpack_buffer *b){
+ oggpack_reset(b);
}
-void oggpack_writeclear(oggpack_buffer *b)
-{
- if(b->buffer)_ogg_free(b->buffer);
- memset(b, 0, sizeof(*b));
+void oggpack_writeclear(oggpack_buffer *b){
+ if(b->buffer)_ogg_free(b->buffer);
+ memset(b,0,sizeof(*b));
}
-void oggpackB_writeclear(oggpack_buffer *b)
-{
- oggpack_writeclear(b);
+void oggpackB_writeclear(oggpack_buffer *b){
+ oggpack_writeclear(b);
}
-void oggpack_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
-{
- memset(b, 0, sizeof(*b));
- b->buffer = b->ptr = buf;
- b->storage = bytes;
+void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
+ memset(b,0,sizeof(*b));
+ b->buffer=b->ptr=buf;
+ b->storage=bytes;
}
-void oggpackB_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
-{
- oggpack_readinit(b, buf, bytes);
+void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
+ oggpack_readinit(b,buf,bytes);
}
/* Read in bits without advancing the bitptr; bits <= 32 */
-long oggpack_look(oggpack_buffer *b, int bits)
-{
- unsigned long ret;
- unsigned long m = mask[bits];
-
- bits += b->endbit;
-
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- if(b->endbyte * 8 + bits > b->storage * 8)return(-1);
- }
-
- ret = b->ptr[0] >> b->endbit;
- if(bits > 8)
- {
- ret |= b->ptr[1] << (8 - b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (16 - b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (24 - b->endbit);
- if(bits > 32 && b->endbit)
- ret |= b->ptr[4] << (32 - b->endbit);
- }
- }
- }
- return(m & ret);
+long oggpack_look(oggpack_buffer *b,int bits){
+ unsigned long ret;
+ unsigned long m=mask[bits];
+
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ if(b->endbyte*8+bits>b->storage*8)return(-1);
+ }
+
+ ret=b->ptr[0]>>b->endbit;
+ if(bits>8){
+ ret|=b->ptr[1]<<(8-b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(16-b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(24-b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]<<(32-b->endbit);
+ }
+ }
+ }
+ return(m&ret);
}
/* Read in bits without advancing the bitptr; bits <= 32 */
-long oggpackB_look(oggpack_buffer *b, int bits)
-{
- unsigned long ret;
- int m = 32 - bits;
+long oggpackB_look(oggpack_buffer *b,int bits){
+ unsigned long ret;
+ int m=32-bits;
- bits += b->endbit;
+ bits+=b->endbit;
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- if(b->endbyte * 8 + bits > b->storage * 8)return(-1);
- }
-
- ret = b->ptr[0] << (24 + b->endbit);
- if(bits > 8)
- {
- ret |= b->ptr[1] << (16 + b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (8 + b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (b->endbit);
- if(bits > 32 && b->endbit)
- ret |= b->ptr[4] >> (8 - b->endbit);
- }
- }
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ if(b->endbyte*8+bits>b->storage*8)return(-1);
+ }
+
+ ret=b->ptr[0]<<(24+b->endbit);
+ if(bits>8){
+ ret|=b->ptr[1]<<(16+b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(8+b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]>>(8-b->endbit);
+ }
}
- return ((ret & 0xffffffff) >> (m >> 1)) >> ((m + 1) >> 1);
+ }
+ return ((ret&0xffffffff)>>(m>>1))>>((m+1)>>1);
}
-long oggpack_look1(oggpack_buffer *b)
-{
- if(b->endbyte >= b->storage)return(-1);
- return((b->ptr[0] >> b->endbit) & 1);
+long oggpack_look1(oggpack_buffer *b){
+ if(b->endbyte>=b->storage)return(-1);
+ return((b->ptr[0]>>b->endbit)&1);
}
-long oggpackB_look1(oggpack_buffer *b)
-{
- if(b->endbyte >= b->storage)return(-1);
- return((b->ptr[0] >> (7 - b->endbit)) & 1);
+long oggpackB_look1(oggpack_buffer *b){
+ if(b->endbyte>=b->storage)return(-1);
+ return((b->ptr[0]>>(7-b->endbit))&1);
}
-void oggpack_adv(oggpack_buffer *b, int bits)
-{
- bits += b->endbit;
- b->ptr += bits / 8;
- b->endbyte += bits / 8;
- b->endbit = bits & 7;
+void oggpack_adv(oggpack_buffer *b,int bits){
+ bits+=b->endbit;
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
}
-void oggpackB_adv(oggpack_buffer *b, int bits)
-{
- oggpack_adv(b, bits);
+void oggpackB_adv(oggpack_buffer *b,int bits){
+ oggpack_adv(b,bits);
}
-void oggpack_adv1(oggpack_buffer *b)
-{
- if(++(b->endbit) > 7)
- {
- b->endbit = 0;
- b->ptr++;
- b->endbyte++;
- }
+void oggpack_adv1(oggpack_buffer *b){
+ if(++(b->endbit)>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
}
-void oggpackB_adv1(oggpack_buffer *b)
-{
- oggpack_adv1(b);
+void oggpackB_adv1(oggpack_buffer *b){
+ oggpack_adv1(b);
}
/* bits <= 32 */
-long oggpack_read(oggpack_buffer *b, int bits)
-{
- long ret;
- unsigned long m = mask[bits];
-
- bits += b->endbit;
-
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- if(b->endbyte * 8 + bits > b->storage * 8)goto overflow;
- }
-
- ret = b->ptr[0] >> b->endbit;
- if(bits > 8)
- {
- ret |= b->ptr[1] << (8 - b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (16 - b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (24 - b->endbit);
- if(bits > 32 && b->endbit)
- {
- ret |= b->ptr[4] << (32 - b->endbit);
- }
- }
+long oggpack_read(oggpack_buffer *b,int bits){
+ long ret;
+ unsigned long m=mask[bits];
+
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ if(b->endbyte*8+bits>b->storage*8)goto overflow;
+ }
+
+ ret=b->ptr[0]>>b->endbit;
+ if(bits>8){
+ ret|=b->ptr[1]<<(8-b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(16-b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(24-b->endbit);
+ if(bits>32 && b->endbit){
+ ret|=b->ptr[4]<<(32-b->endbit);
}
+ }
}
- ret &= m;
+ }
+ ret&=m;
+
+ overflow:
-overflow:
-
- b->ptr += bits / 8;
- b->endbyte += bits / 8;
- b->endbit = bits & 7;
- return(ret);
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return(ret);
}
/* bits <= 32 */
-long oggpackB_read(oggpack_buffer *b, int bits)
-{
- long ret;
- long m = 32 - bits;
-
- bits += b->endbit;
-
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- if(b->endbyte * 8 + bits > b->storage * 8)goto overflow;
- /* special case to avoid reading b->ptr[0], which might be past the end of
- the buffer; also skips some useless accounting */
- else if(!bits)return(0L);
- }
-
- ret = b->ptr[0] << (24 + b->endbit);
- if(bits > 8)
- {
- ret |= b->ptr[1] << (16 + b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (8 + b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (b->endbit);
- if(bits > 32 && b->endbit)
- ret |= b->ptr[4] >> (8 - b->endbit);
- }
- }
- }
- ret = ((ret & 0xffffffffUL) >> (m >> 1)) >> ((m + 1) >> 1);
-
-overflow:
-
- b->ptr += bits / 8;
- b->endbyte += bits / 8;
- b->endbit = bits & 7;
- return(ret);
-}
-
-long oggpack_read1(oggpack_buffer *b)
-{
- long ret;
-
- if(b->endbyte >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- goto overflow;
- }
-
- ret = (b->ptr[0] >> b->endbit) & 1;
-
-overflow:
-
- b->endbit++;
- if(b->endbit > 7)
- {
- b->endbit = 0;
- b->ptr++;
- b->endbyte++;
- }
- return(ret);
-}
-
-long oggpackB_read1(oggpack_buffer *b)
-{
- long ret;
-
- if(b->endbyte >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- goto overflow;
- }
-
- ret = (b->ptr[0] >> (7 - b->endbit)) & 1;
-
-overflow:
-
- b->endbit++;
- if(b->endbit > 7)
- {
- b->endbit = 0;
- b->ptr++;
- b->endbyte++;
- }
- return(ret);
-}
-
-long oggpack_bytes(oggpack_buffer *b)
-{
- return(b->endbyte + (b->endbit + 7) / 8);
-}
-
-long oggpack_bits(oggpack_buffer *b)
-{
- return(b->endbyte * 8 + b->endbit);
-}
-
-long oggpackB_bytes(oggpack_buffer *b)
-{
- return oggpack_bytes(b);
-}
-
-long oggpackB_bits(oggpack_buffer *b)
-{
- return oggpack_bits(b);
-}
-
-unsigned char *oggpack_get_buffer(oggpack_buffer *b)
-{
- return(b->buffer);
-}
-
-unsigned char *oggpackB_get_buffer(oggpack_buffer *b)
-{
- return oggpack_get_buffer(b);
+long oggpackB_read(oggpack_buffer *b,int bits){
+ long ret;
+ long m=32-bits;
+
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ if(b->endbyte*8+bits>b->storage*8)goto overflow;
+ /* special case to avoid reading b->ptr[0], which might be past the end of
+ the buffer; also skips some useless accounting */
+ else if(!bits)return(0L);
+ }
+
+ ret=b->ptr[0]<<(24+b->endbit);
+ if(bits>8){
+ ret|=b->ptr[1]<<(16+b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(8+b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]>>(8-b->endbit);
+ }
+ }
+ }
+ ret=((ret&0xffffffffUL)>>(m>>1))>>((m+1)>>1);
+
+ overflow:
+
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return(ret);
+}
+
+long oggpack_read1(oggpack_buffer *b){
+ long ret;
+
+ if(b->endbyte>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ goto overflow;
+ }
+
+ ret=(b->ptr[0]>>b->endbit)&1;
+
+ overflow:
+
+ b->endbit++;
+ if(b->endbit>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+ return(ret);
+}
+
+long oggpackB_read1(oggpack_buffer *b){
+ long ret;
+
+ if(b->endbyte>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ goto overflow;
+ }
+
+ ret=(b->ptr[0]>>(7-b->endbit))&1;
+
+ overflow:
+
+ b->endbit++;
+ if(b->endbit>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+ return(ret);
+}
+
+long oggpack_bytes(oggpack_buffer *b){
+ return(b->endbyte+(b->endbit+7)/8);
+}
+
+long oggpack_bits(oggpack_buffer *b){
+ return(b->endbyte*8+b->endbit);
+}
+
+long oggpackB_bytes(oggpack_buffer *b){
+ return oggpack_bytes(b);
+}
+
+long oggpackB_bits(oggpack_buffer *b){
+ return oggpack_bits(b);
+}
+
+unsigned char *oggpack_get_buffer(oggpack_buffer *b){
+ return(b->buffer);
+}
+
+unsigned char *oggpackB_get_buffer(oggpack_buffer *b){
+ return oggpack_get_buffer(b);
}
/* Self test of the bitwise routines; everything else is based on
@@ -572,382 +491,332 @@ unsigned char *oggpackB_get_buffer(oggpack_buffer *b)
#ifdef _V_SELFTEST
#include <stdio.h>
-static int ilog(unsigned int v)
-{
- int ret = 0;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-
+
oggpack_buffer o;
oggpack_buffer r;
-void report(char *in)
-{
- fprintf(stderr, "%s", in);
- exit(1);
-}
-
-void cliptest(unsigned long *b, int vals, int bits, int *comp, int compsize)
-{
- long bytes, i;
- unsigned char *buffer;
-
- oggpack_reset(&o);
- for(i = 0; i < vals; i++)
- oggpack_write(&o, b[i], bits ? bits : ilog(b[i]));
- buffer = oggpack_get_buffer(&o);
- bytes = oggpack_bytes(&o);
- if(bytes != compsize)report("wrong number of bytes!\n");
- for(i = 0; i < bytes; i++)if(buffer[i] != comp[i])
- {
- for(i = 0; i < bytes; i++)fprintf(stderr, "%x %x\n", (int)buffer[i], (int)comp[i]);
- report("wrote incorrect value!\n");
- }
- oggpack_readinit(&r, buffer, bytes);
- for(i = 0; i < vals; i++)
- {
- int tbit = bits ? bits : ilog(b[i]);
- if(oggpack_look(&r, tbit) == -1)
- report("out of data!\n");
- if(oggpack_look(&r, tbit) != (b[i]&mask[tbit]))
- report("looked at incorrect value!\n");
- if(tbit == 1)
- if(oggpack_look1(&r) != (b[i]&mask[tbit]))
- report("looked at single bit incorrect value!\n");
- if(tbit == 1)
- {
- if(oggpack_read1(&r) != (b[i]&mask[tbit]))
- report("read incorrect single bit value!\n");
- }
- else
- {
- if(oggpack_read(&r, tbit) != (b[i]&mask[tbit]))
- report("read incorrect value!\n");
- }
- }
- if(oggpack_bytes(&r) != bytes)report("leftover bytes after read!\n");
-}
-
-void cliptestB(unsigned long *b, int vals, int bits, int *comp, int compsize)
-{
- long bytes, i;
- unsigned char *buffer;
-
- oggpackB_reset(&o);
- for(i = 0; i < vals; i++)
- oggpackB_write(&o, b[i], bits ? bits : ilog(b[i]));
- buffer = oggpackB_get_buffer(&o);
- bytes = oggpackB_bytes(&o);
- if(bytes != compsize)report("wrong number of bytes!\n");
- for(i = 0; i < bytes; i++)if(buffer[i] != comp[i])
- {
- for(i = 0; i < bytes; i++)fprintf(stderr, "%x %x\n", (int)buffer[i], (int)comp[i]);
- report("wrote incorrect value!\n");
- }
- oggpackB_readinit(&r, buffer, bytes);
- for(i = 0; i < vals; i++)
- {
- int tbit = bits ? bits : ilog(b[i]);
- if(oggpackB_look(&r, tbit) == -1)
- report("out of data!\n");
- if(oggpackB_look(&r, tbit) != (b[i]&mask[tbit]))
- report("looked at incorrect value!\n");
- if(tbit == 1)
- if(oggpackB_look1(&r) != (b[i]&mask[tbit]))
- report("looked at single bit incorrect value!\n");
- if(tbit == 1)
- {
- if(oggpackB_read1(&r) != (b[i]&mask[tbit]))
- report("read incorrect single bit value!\n");
- }
- else
- {
- if(oggpackB_read(&r, tbit) != (b[i]&mask[tbit]))
- report("read incorrect value!\n");
- }
- }
- if(oggpackB_bytes(&r) != bytes)report("leftover bytes after read!\n");
-}
-
-int main(void)
-{
- unsigned char *buffer;
- long bytes, i;
- static unsigned long testbuffer1[] =
- {
- 18, 12, 103948, 4325, 543, 76, 432, 52, 3, 65, 4, 56, 32, 42, 34, 21, 1, 23, 32, 546, 456, 7,
- 567, 56, 8, 8, 55, 3, 52, 342, 341, 4, 265, 7, 67, 86, 2199, 21, 7, 1, 5, 1, 4
- };
- int test1size = 43;
-
- static unsigned long testbuffer2[] =
- {
- 216531625L, 1237861823, 56732452, 131, 3212421, 12325343, 34547562, 12313212,
- 1233432, 534, 5, 346435231, 14436467, 7869299, 76326614, 167548585,
- 85525151, 0, 12321, 1, 349528352
- };
- int test2size = 21;
-
- static unsigned long testbuffer3[] =
- {
- 1, 0, 14, 0, 1, 0, 12, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,
- 0, 1, 30, 1, 1, 1, 0, 0, 1, 0, 0, 0, 12, 0, 11, 0, 1, 0, 0, 1
- };
- int test3size = 56;
-
- static unsigned long large[] =
- {
- 2136531625L, 2137861823, 56732452, 131, 3212421, 12325343, 34547562, 12313212,
- 1233432, 534, 5, 2146435231, 14436467, 7869299, 76326614, 167548585,
- 85525151, 0, 12321, 1, 2146528352
- };
-
- int onesize = 33;
- static int one[33] = {146, 25, 44, 151, 195, 15, 153, 176, 233, 131, 196, 65, 85, 172, 47, 40,
- 34, 242, 223, 136, 35, 222, 211, 86, 171, 50, 225, 135, 214, 75, 172,
- 223, 4
- };
- static int oneB[33] = {150, 101, 131, 33, 203, 15, 204, 216, 105, 193, 156, 65, 84, 85, 222,
- 8, 139, 145, 227, 126, 34, 55, 244, 171, 85, 100, 39, 195, 173, 18,
- 245, 251, 128
- };
-
- int twosize = 6;
- static int two[6] = {61, 255, 255, 251, 231, 29};
- static int twoB[6] = {247, 63, 255, 253, 249, 120};
-
- int threesize = 54;
- static int three[54] = {169, 2, 232, 252, 91, 132, 156, 36, 89, 13, 123, 176, 144, 32, 254,
- 142, 224, 85, 59, 121, 144, 79, 124, 23, 67, 90, 90, 216, 79, 23, 83,
- 58, 135, 196, 61, 55, 129, 183, 54, 101, 100, 170, 37, 127, 126, 10,
- 100, 52, 4, 14, 18, 86, 77, 1
- };
- static int threeB[54] = {206, 128, 42, 153, 57, 8, 183, 251, 13, 89, 36, 30, 32, 144, 183,
- 130, 59, 240, 121, 59, 85, 223, 19, 228, 180, 134, 33, 107, 74, 98,
- 233, 253, 196, 135, 63, 2, 110, 114, 50, 155, 90, 127, 37, 170, 104,
- 200, 20, 254, 4, 58, 106, 176, 144, 0
- };
-
- int foursize = 38;
- static int four[38] = {18, 6, 163, 252, 97, 194, 104, 131, 32, 1, 7, 82, 137, 42, 129, 11, 72,
- 132, 60, 220, 112, 8, 196, 109, 64, 179, 86, 9, 137, 195, 208, 122, 169,
- 28, 2, 133, 0, 1
- };
- static int fourB[38] = {36, 48, 102, 83, 243, 24, 52, 7, 4, 35, 132, 10, 145, 21, 2, 93, 2, 41,
- 1, 219, 184, 16, 33, 184, 54, 149, 170, 132, 18, 30, 29, 98, 229, 67,
- 129, 10, 4, 32
- };
-
- int fivesize = 45;
- static int five[45] = {169, 2, 126, 139, 144, 172, 30, 4, 80, 72, 240, 59, 130, 218, 73, 62,
- 241, 24, 210, 44, 4, 20, 0, 248, 116, 49, 135, 100, 110, 130, 181, 169,
- 84, 75, 159, 2, 1, 0, 132, 192, 8, 0, 0, 18, 22
- };
- static int fiveB[45] = {1, 84, 145, 111, 245, 100, 128, 8, 56, 36, 40, 71, 126, 78, 213, 226,
- 124, 105, 12, 0, 133, 128, 0, 162, 233, 242, 67, 152, 77, 205, 77,
- 172, 150, 169, 129, 79, 128, 0, 6, 4, 32, 0, 27, 9, 0
- };
-
- int sixsize = 7;
- static int six[7] = {17, 177, 170, 242, 169, 19, 148};
- static int sixB[7] = {136, 141, 85, 79, 149, 200, 41};
-
- /* Test read/write together */
- /* Later we test against pregenerated bitstreams */
- oggpack_writeinit(&o);
-
- fprintf(stderr, "\nSmall preclipped packing (LSb): ");
- cliptest(testbuffer1, test1size, 0, one, onesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nNull bit call (LSb): ");
- cliptest(testbuffer3, test3size, 0, two, twosize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge preclipped packing (LSb): ");
- cliptest(testbuffer2, test2size, 0, three, threesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\n32 bit preclipped packing (LSb): ");
- oggpack_reset(&o);
- for(i = 0; i < test2size; i++)
- oggpack_write(&o, large[i], 32);
- buffer = oggpack_get_buffer(&o);
- bytes = oggpack_bytes(&o);
- oggpack_readinit(&r, buffer, bytes);
- for(i = 0; i < test2size; i++)
- {
- if(oggpack_look(&r, 32) == -1)report("out of data. failed!");
- if(oggpack_look(&r, 32) != large[i])
- {
- fprintf(stderr, "%ld != %ld (%lx!=%lx):", oggpack_look(&r, 32), large[i],
- oggpack_look(&r, 32), large[i]);
- report("read incorrect value!\n");
- }
- oggpack_adv(&r, 32);
- }
- if(oggpack_bytes(&r) != bytes)report("leftover bytes after read!\n");
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSmall unclipped packing (LSb): ");
- cliptest(testbuffer1, test1size, 7, four, foursize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge unclipped packing (LSb): ");
- cliptest(testbuffer2, test2size, 17, five, fivesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSingle bit unclipped packing (LSb): ");
- cliptest(testbuffer3, test3size, 1, six, sixsize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nTesting read past end (LSb): ");
- oggpack_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- for(i = 0; i < 64; i++)
- {
- if(oggpack_read(&r, 1) != 0)
- {
- fprintf(stderr, "failed; got -1 prematurely.\n");
- exit(1);
- }
- }
- if(oggpack_look(&r, 1) != -1 ||
- oggpack_read(&r, 1) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpack_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- if(oggpack_read(&r, 30) != 0 || oggpack_read(&r, 16) != 0)
- {
- fprintf(stderr, "failed 2; got -1 prematurely.\n");
- exit(1);
- }
-
- if(oggpack_look(&r, 18) != 0 ||
- oggpack_look(&r, 18) != 0)
- {
- fprintf(stderr, "failed 3; got -1 prematurely.\n");
- exit(1);
- }
- if(oggpack_look(&r, 19) != -1 ||
- oggpack_look(&r, 19) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- if(oggpack_look(&r, 32) != -1 ||
- oggpack_look(&r, 32) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpack_writeclear(&o);
- fprintf(stderr, "ok.\n");
-
- /********** lazy, cut-n-paste retest with MSb packing ***********/
-
- /* Test read/write together */
- /* Later we test against pregenerated bitstreams */
- oggpackB_writeinit(&o);
-
- fprintf(stderr, "\nSmall preclipped packing (MSb): ");
- cliptestB(testbuffer1, test1size, 0, oneB, onesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nNull bit call (MSb): ");
- cliptestB(testbuffer3, test3size, 0, twoB, twosize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge preclipped packing (MSb): ");
- cliptestB(testbuffer2, test2size, 0, threeB, threesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\n32 bit preclipped packing (MSb): ");
- oggpackB_reset(&o);
- for(i = 0; i < test2size; i++)
- oggpackB_write(&o, large[i], 32);
- buffer = oggpackB_get_buffer(&o);
- bytes = oggpackB_bytes(&o);
- oggpackB_readinit(&r, buffer, bytes);
- for(i = 0; i < test2size; i++)
- {
- if(oggpackB_look(&r, 32) == -1)report("out of data. failed!");
- if(oggpackB_look(&r, 32) != large[i])
- {
- fprintf(stderr, "%ld != %ld (%lx!=%lx):", oggpackB_look(&r, 32), large[i],
- oggpackB_look(&r, 32), large[i]);
- report("read incorrect value!\n");
- }
- oggpackB_adv(&r, 32);
- }
- if(oggpackB_bytes(&r) != bytes)report("leftover bytes after read!\n");
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSmall unclipped packing (MSb): ");
- cliptestB(testbuffer1, test1size, 7, fourB, foursize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge unclipped packing (MSb): ");
- cliptestB(testbuffer2, test2size, 17, fiveB, fivesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSingle bit unclipped packing (MSb): ");
- cliptestB(testbuffer3, test3size, 1, sixB, sixsize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nTesting read past end (MSb): ");
- oggpackB_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- for(i = 0; i < 64; i++)
- {
- if(oggpackB_read(&r, 1) != 0)
- {
- fprintf(stderr, "failed; got -1 prematurely.\n");
- exit(1);
- }
- }
- if(oggpackB_look(&r, 1) != -1 ||
- oggpackB_read(&r, 1) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpackB_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- if(oggpackB_read(&r, 30) != 0 || oggpackB_read(&r, 16) != 0)
- {
- fprintf(stderr, "failed 2; got -1 prematurely.\n");
- exit(1);
- }
-
- if(oggpackB_look(&r, 18) != 0 ||
- oggpackB_look(&r, 18) != 0)
- {
- fprintf(stderr, "failed 3; got -1 prematurely.\n");
- exit(1);
- }
- if(oggpackB_look(&r, 19) != -1 ||
- oggpackB_look(&r, 19) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- if(oggpackB_look(&r, 32) != -1 ||
- oggpackB_look(&r, 32) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpackB_writeclear(&o);
- fprintf(stderr, "ok.\n\n");
-
-
- return(0);
-}
+void report(char *in){
+ fprintf(stderr,"%s",in);
+ exit(1);
+}
+
+void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){
+ long bytes,i;
+ unsigned char *buffer;
+
+ oggpack_reset(&o);
+ for(i=0;i<vals;i++)
+ oggpack_write(&o,b[i],bits?bits:ilog(b[i]));
+ buffer=oggpack_get_buffer(&o);
+ bytes=oggpack_bytes(&o);
+ if(bytes!=compsize)report("wrong number of bytes!\n");
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
+ report("wrote incorrect value!\n");
+ }
+ oggpack_readinit(&r,buffer,bytes);
+ for(i=0;i<vals;i++){
+ int tbit=bits?bits:ilog(b[i]);
+ if(oggpack_look(&r,tbit)==-1)
+ report("out of data!\n");
+ if(oggpack_look(&r,tbit)!=(b[i]&mask[tbit]))
+ report("looked at incorrect value!\n");
+ if(tbit==1)
+ if(oggpack_look1(&r)!=(b[i]&mask[tbit]))
+ report("looked at single bit incorrect value!\n");
+ if(tbit==1){
+ if(oggpack_read1(&r)!=(b[i]&mask[tbit]))
+ report("read incorrect single bit value!\n");
+ }else{
+ if(oggpack_read(&r,tbit)!=(b[i]&mask[tbit]))
+ report("read incorrect value!\n");
+ }
+ }
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+}
+
+void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){
+ long bytes,i;
+ unsigned char *buffer;
+
+ oggpackB_reset(&o);
+ for(i=0;i<vals;i++)
+ oggpackB_write(&o,b[i],bits?bits:ilog(b[i]));
+ buffer=oggpackB_get_buffer(&o);
+ bytes=oggpackB_bytes(&o);
+ if(bytes!=compsize)report("wrong number of bytes!\n");
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
+ report("wrote incorrect value!\n");
+ }
+ oggpackB_readinit(&r,buffer,bytes);
+ for(i=0;i<vals;i++){
+ int tbit=bits?bits:ilog(b[i]);
+ if(oggpackB_look(&r,tbit)==-1)
+ report("out of data!\n");
+ if(oggpackB_look(&r,tbit)!=(b[i]&mask[tbit]))
+ report("looked at incorrect value!\n");
+ if(tbit==1)
+ if(oggpackB_look1(&r)!=(b[i]&mask[tbit]))
+ report("looked at single bit incorrect value!\n");
+ if(tbit==1){
+ if(oggpackB_read1(&r)!=(b[i]&mask[tbit]))
+ report("read incorrect single bit value!\n");
+ }else{
+ if(oggpackB_read(&r,tbit)!=(b[i]&mask[tbit]))
+ report("read incorrect value!\n");
+ }
+ }
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+}
+
+int main(void){
+ unsigned char *buffer;
+ long bytes,i;
+ static unsigned long testbuffer1[]=
+ {18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,
+ 567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};
+ int test1size=43;
+
+ static unsigned long testbuffer2[]=
+ {216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,
+ 1233432,534,5,346435231,14436467,7869299,76326614,167548585,
+ 85525151,0,12321,1,349528352};
+ int test2size=21;
+
+ static unsigned long testbuffer3[]=
+ {1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,
+ 0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};
+ int test3size=56;
+
+ static unsigned long large[]=
+ {2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,
+ 1233432,534,5,2146435231,14436467,7869299,76326614,167548585,
+ 85525151,0,12321,1,2146528352};
+
+ int onesize=33;
+ static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,
+ 34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,
+ 223,4};
+ static int oneB[33]={150,101,131,33,203,15,204,216,105,193,156,65,84,85,222,
+ 8,139,145,227,126,34,55,244,171,85,100,39,195,173,18,
+ 245,251,128};
+
+ int twosize=6;
+ static int two[6]={61,255,255,251,231,29};
+ static int twoB[6]={247,63,255,253,249,120};
+
+ int threesize=54;
+ static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,
+ 142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,
+ 58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,
+ 100,52,4,14,18,86,77,1};
+ static int threeB[54]={206,128,42,153,57,8,183,251,13,89,36,30,32,144,183,
+ 130,59,240,121,59,85,223,19,228,180,134,33,107,74,98,
+ 233,253,196,135,63,2,110,114,50,155,90,127,37,170,104,
+ 200,20,254,4,58,106,176,144,0};
+
+ int foursize=38;
+ static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,
+ 132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,
+ 28,2,133,0,1};
+ static int fourB[38]={36,48,102,83,243,24,52,7,4,35,132,10,145,21,2,93,2,41,
+ 1,219,184,16,33,184,54,149,170,132,18,30,29,98,229,67,
+ 129,10,4,32};
+
+ int fivesize=45;
+ static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,
+ 241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,
+ 84,75,159,2,1,0,132,192,8,0,0,18,22};
+ static int fiveB[45]={1,84,145,111,245,100,128,8,56,36,40,71,126,78,213,226,
+ 124,105,12,0,133,128,0,162,233,242,67,152,77,205,77,
+ 172,150,169,129,79,128,0,6,4,32,0,27,9,0};
+
+ int sixsize=7;
+ static int six[7]={17,177,170,242,169,19,148};
+ static int sixB[7]={136,141,85,79,149,200,41};
+
+ /* Test read/write together */
+ /* Later we test against pregenerated bitstreams */
+ oggpack_writeinit(&o);
+
+ fprintf(stderr,"\nSmall preclipped packing (LSb): ");
+ cliptest(testbuffer1,test1size,0,one,onesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nNull bit call (LSb): ");
+ cliptest(testbuffer3,test3size,0,two,twosize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge preclipped packing (LSb): ");
+ cliptest(testbuffer2,test2size,0,three,threesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\n32 bit preclipped packing (LSb): ");
+ oggpack_reset(&o);
+ for(i=0;i<test2size;i++)
+ oggpack_write(&o,large[i],32);
+ buffer=oggpack_get_buffer(&o);
+ bytes=oggpack_bytes(&o);
+ oggpack_readinit(&r,buffer,bytes);
+ for(i=0;i<test2size;i++){
+ if(oggpack_look(&r,32)==-1)report("out of data. failed!");
+ if(oggpack_look(&r,32)!=large[i]){
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r,32),large[i],
+ oggpack_look(&r,32),large[i]);
+ report("read incorrect value!\n");
+ }
+ oggpack_adv(&r,32);
+ }
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSmall unclipped packing (LSb): ");
+ cliptest(testbuffer1,test1size,7,four,foursize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge unclipped packing (LSb): ");
+ cliptest(testbuffer2,test2size,17,five,fivesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSingle bit unclipped packing (LSb): ");
+ cliptest(testbuffer3,test3size,1,six,sixsize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nTesting read past end (LSb): ");
+ oggpack_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ for(i=0;i<64;i++){
+ if(oggpack_read(&r,1)!=0){
+ fprintf(stderr,"failed; got -1 prematurely.\n");
+ exit(1);
+ }
+ }
+ if(oggpack_look(&r,1)!=-1 ||
+ oggpack_read(&r,1)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpack_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ if(oggpack_read(&r,30)!=0 || oggpack_read(&r,16)!=0){
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
+ exit(1);
+ }
+
+ if(oggpack_look(&r,18)!=0 ||
+ oggpack_look(&r,18)!=0){
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
+ exit(1);
+ }
+ if(oggpack_look(&r,19)!=-1 ||
+ oggpack_look(&r,19)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ if(oggpack_look(&r,32)!=-1 ||
+ oggpack_look(&r,32)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpack_writeclear(&o);
+ fprintf(stderr,"ok.\n");
+
+ /********** lazy, cut-n-paste retest with MSb packing ***********/
+
+ /* Test read/write together */
+ /* Later we test against pregenerated bitstreams */
+ oggpackB_writeinit(&o);
+
+ fprintf(stderr,"\nSmall preclipped packing (MSb): ");
+ cliptestB(testbuffer1,test1size,0,oneB,onesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nNull bit call (MSb): ");
+ cliptestB(testbuffer3,test3size,0,twoB,twosize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge preclipped packing (MSb): ");
+ cliptestB(testbuffer2,test2size,0,threeB,threesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\n32 bit preclipped packing (MSb): ");
+ oggpackB_reset(&o);
+ for(i=0;i<test2size;i++)
+ oggpackB_write(&o,large[i],32);
+ buffer=oggpackB_get_buffer(&o);
+ bytes=oggpackB_bytes(&o);
+ oggpackB_readinit(&r,buffer,bytes);
+ for(i=0;i<test2size;i++){
+ if(oggpackB_look(&r,32)==-1)report("out of data. failed!");
+ if(oggpackB_look(&r,32)!=large[i]){
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpackB_look(&r,32),large[i],
+ oggpackB_look(&r,32),large[i]);
+ report("read incorrect value!\n");
+ }
+ oggpackB_adv(&r,32);
+ }
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSmall unclipped packing (MSb): ");
+ cliptestB(testbuffer1,test1size,7,fourB,foursize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge unclipped packing (MSb): ");
+ cliptestB(testbuffer2,test2size,17,fiveB,fivesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSingle bit unclipped packing (MSb): ");
+ cliptestB(testbuffer3,test3size,1,sixB,sixsize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nTesting read past end (MSb): ");
+ oggpackB_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ for(i=0;i<64;i++){
+ if(oggpackB_read(&r,1)!=0){
+ fprintf(stderr,"failed; got -1 prematurely.\n");
+ exit(1);
+ }
+ }
+ if(oggpackB_look(&r,1)!=-1 ||
+ oggpackB_read(&r,1)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpackB_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ if(oggpackB_read(&r,30)!=0 || oggpackB_read(&r,16)!=0){
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
+ exit(1);
+ }
+
+ if(oggpackB_look(&r,18)!=0 ||
+ oggpackB_look(&r,18)!=0){
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
+ exit(1);
+ }
+ if(oggpackB_look(&r,19)!=-1 ||
+ oggpackB_look(&r,19)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ if(oggpackB_look(&r,32)!=-1 ||
+ oggpackB_look(&r,32)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpackB_writeclear(&o);
+ fprintf(stderr,"ok.\n\n");
+
+
+ return(0);
+}
#endif /* _V_SELFTEST */
#undef BUFFER_INCREMENT
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/framing.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/framing.c
index 94dd759e7..b8a6fb0c9 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/framing.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/Ogg/framing.c
@@ -26,54 +26,47 @@
/* A complete description of Ogg framing exists in docs/framing.html */
-int ogg_page_version(const ogg_page *og)
-{
- return((int)(og->header[4]));
+int ogg_page_version(const ogg_page *og){
+ return((int)(og->header[4]));
}
-int ogg_page_continued(const ogg_page *og)
-{
- return((int)(og->header[5] & 0x01));
+int ogg_page_continued(const ogg_page *og){
+ return((int)(og->header[5]&0x01));
}
-int ogg_page_bos(const ogg_page *og)
-{
- return((int)(og->header[5] & 0x02));
+int ogg_page_bos(const ogg_page *og){
+ return((int)(og->header[5]&0x02));
}
-int ogg_page_eos(const ogg_page *og)
-{
- return((int)(og->header[5] & 0x04));
+int ogg_page_eos(const ogg_page *og){
+ return((int)(og->header[5]&0x04));
}
-ogg_int64_t ogg_page_granulepos(const ogg_page *og)
-{
- unsigned char *page = og->header;
- ogg_int64_t granulepos = page[13] & (0xff);
- granulepos = (granulepos << 8) | (page[12] & 0xff);
- granulepos = (granulepos << 8) | (page[11] & 0xff);
- granulepos = (granulepos << 8) | (page[10] & 0xff);
- granulepos = (granulepos << 8) | (page[9] & 0xff);
- granulepos = (granulepos << 8) | (page[8] & 0xff);
- granulepos = (granulepos << 8) | (page[7] & 0xff);
- granulepos = (granulepos << 8) | (page[6] & 0xff);
- return(granulepos);
+ogg_int64_t ogg_page_granulepos(const ogg_page *og){
+ unsigned char *page=og->header;
+ ogg_int64_t granulepos=page[13]&(0xff);
+ granulepos= (granulepos<<8)|(page[12]&0xff);
+ granulepos= (granulepos<<8)|(page[11]&0xff);
+ granulepos= (granulepos<<8)|(page[10]&0xff);
+ granulepos= (granulepos<<8)|(page[9]&0xff);
+ granulepos= (granulepos<<8)|(page[8]&0xff);
+ granulepos= (granulepos<<8)|(page[7]&0xff);
+ granulepos= (granulepos<<8)|(page[6]&0xff);
+ return(granulepos);
}
-int ogg_page_serialno(const ogg_page *og)
-{
- return(og->header[14] |
- (og->header[15] << 8) |
- (og->header[16] << 16) |
- (og->header[17] << 24));
+int ogg_page_serialno(const ogg_page *og){
+ return(og->header[14] |
+ (og->header[15]<<8) |
+ (og->header[16]<<16) |
+ (og->header[17]<<24));
}
-
-long ogg_page_pageno(const ogg_page *og)
-{
- return(og->header[18] |
- (og->header[19] << 8) |
- (og->header[20] << 16) |
- (og->header[21] << 24));
+
+long ogg_page_pageno(const ogg_page *og){
+ return(og->header[18] |
+ (og->header[19]<<8) |
+ (og->header[20]<<16) |
+ (og->header[21]<<24));
}
@@ -85,22 +78,21 @@ long ogg_page_pageno(const ogg_page *og)
/* NOTE:
If a page consists of a packet begun on a previous page, and a new
packet begun (but not completed) on this page, the return will be:
- ogg_page_packets(page) ==1,
+ ogg_page_packets(page) ==1,
ogg_page_continued(page) !=0
If a page happens to be a single packet that was begun on a
previous page, and spans to the next page (in the case of a three or
-more page packet), the return will be:
- ogg_page_packets(page) ==0,
+more page packet), the return will be:
+ ogg_page_packets(page) ==0,
ogg_page_continued(page) !=0
*/
-int ogg_page_packets(const ogg_page *og)
-{
- int i, n = og->header[26], count = 0;
- for(i = 0; i < n; i++)
- if(og->header[27+i] < 255)count++;
- return(count);
+int ogg_page_packets(const ogg_page *og){
+ int i,n=og->header[26],count=0;
+ for(i=0;i<n;i++)
+ if(og->header[27+i]<255)count++;
+ return(count);
}
@@ -108,295 +100,270 @@ int ogg_page_packets(const ogg_page *og)
/* helper to initialize lookup for direct-table CRC (illustrative; we
use the static init below) */
-static ogg_uint32_t _ogg_crc_entry(unsigned long index)
-{
- int i;
- unsigned long r;
+static ogg_uint32_t _ogg_crc_entry(unsigned long index){
+ int i;
+ unsigned long r;
- r = index << 24;
- for(i = 0; i < 8; i++)
- if(r & 0x80000000UL)
- r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
+ r = index << 24;
+ for (i=0; i<8; i++)
+ if (r & 0x80000000UL)
+ r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
polynomial, although we use an
unreflected alg and an init/final
of 0, not 0xffffffff */
- else
- r <<= 1;
- return (r & 0xffffffffUL);
+ else
+ r<<=1;
+ return (r & 0xffffffffUL);
}
#endif
-static const ogg_uint32_t crc_lookup[256] =
-{
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
- 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
- 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
- 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
- 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
- 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
- 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,
- 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,
- 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
- 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
- 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,
- 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
- 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,
- 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
- 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,
- 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,
- 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
- 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
- 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
- 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
- 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,
- 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,
- 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
- 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
- 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,
- 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
- 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,
- 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
- 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,
- 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,
- 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
- 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
- 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
- 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
- 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,
- 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,
- 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
- 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
- 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,
- 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
- 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,
- 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
- 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,
- 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,
- 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
- 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
- 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
- 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
- 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,
- 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,
- 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
- 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
- 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,
- 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
- 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,
- 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
- 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,
- 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,
- 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
- 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
-};
+static const ogg_uint32_t crc_lookup[256]={
+ 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
+ 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
+ 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
+ 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
+ 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
+ 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
+ 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
+ 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
+ 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
+ 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
+ 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
+ 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
+ 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
+ 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
+ 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
+ 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
+ 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
+ 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
+ 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
+ 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
+ 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
+ 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
+ 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
+ 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
+ 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
+ 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
+ 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
+ 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
+ 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
+ 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
+ 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
+ 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
+ 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
+ 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
+ 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
+ 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
+ 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
+ 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
+ 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
+ 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
+ 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
+ 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
+ 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
+ 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
+ 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
+ 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
+ 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
+ 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
+ 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
+ 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
+ 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
+ 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
+ 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
+ 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
+ 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
+ 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
+ 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
+ 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
+ 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
+ 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
+ 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
+ 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
+ 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
+ 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
/* init the encode/decode logical stream state */
-int ogg_stream_init(ogg_stream_state *os, int serialno)
-{
- if(os)
- {
- memset(os, 0, sizeof(*os));
- os->body_storage = 16 * 1024;
- os->lacing_storage = 1024;
+int ogg_stream_init(ogg_stream_state *os,int serialno){
+ if(os){
+ memset(os,0,sizeof(*os));
+ os->body_storage=16*1024;
+ os->lacing_storage=1024;
- os->body_data = _ogg_malloc(os->body_storage * sizeof(*os->body_data));
- os->lacing_vals = _ogg_malloc(os->lacing_storage * sizeof(*os->lacing_vals));
- os->granule_vals = _ogg_malloc(os->lacing_storage * sizeof(*os->granule_vals));
+ os->body_data=_ogg_malloc(os->body_storage*sizeof(*os->body_data));
+ os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals));
+ os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals));
- if(!os->body_data || !os->lacing_vals || !os->granule_vals)
- {
- ogg_stream_clear(os);
- return -1;
- }
+ if(!os->body_data || !os->lacing_vals || !os->granule_vals){
+ ogg_stream_clear(os);
+ return -1;
+ }
- os->serialno = serialno;
+ os->serialno=serialno;
- return(0);
- }
- return(-1);
-}
+ return(0);
+ }
+ return(-1);
+}
/* async/delayed error detection for the ogg_stream_state */
-int ogg_stream_check(ogg_stream_state *os)
-{
- if(!os || !os->body_data) return -1;
- return 0;
+int ogg_stream_check(ogg_stream_state *os){
+ if(!os || !os->body_data) return -1;
+ return 0;
}
/* _clear does not free os, only the non-flat storage within */
-int ogg_stream_clear(ogg_stream_state *os)
-{
- if(os)
- {
- if(os->body_data)_ogg_free(os->body_data);
- if(os->lacing_vals)_ogg_free(os->lacing_vals);
- if(os->granule_vals)_ogg_free(os->granule_vals);
-
- memset(os, 0, sizeof(*os));
- }
- return(0);
-}
-
-int ogg_stream_destroy(ogg_stream_state *os)
-{
- if(os)
- {
- ogg_stream_clear(os);
- _ogg_free(os);
- }
- return(0);
-}
+int ogg_stream_clear(ogg_stream_state *os){
+ if(os){
+ if(os->body_data)_ogg_free(os->body_data);
+ if(os->lacing_vals)_ogg_free(os->lacing_vals);
+ if(os->granule_vals)_ogg_free(os->granule_vals);
+
+ memset(os,0,sizeof(*os));
+ }
+ return(0);
+}
+
+int ogg_stream_destroy(ogg_stream_state *os){
+ if(os){
+ ogg_stream_clear(os);
+ _ogg_free(os);
+ }
+ return(0);
+}
/* Helpers for ogg_stream_encode; this keeps the structure and
what's happening fairly clear */
-static int _os_body_expand(ogg_stream_state *os, int needed)
-{
- if(os->body_storage <= os->body_fill + needed)
- {
- void *ret;
- ret = _ogg_realloc(os->body_data, (os->body_storage + needed + 1024) *
- sizeof(*os->body_data));
- if(!ret)
- {
- ogg_stream_clear(os);
- return -1;
- }
- os->body_storage += (needed + 1024);
- os->body_data = ret;
+static int _os_body_expand(ogg_stream_state *os,int needed){
+ if(os->body_storage<=os->body_fill+needed){
+ void *ret;
+ ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)*
+ sizeof(*os->body_data));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
}
- return 0;
+ os->body_storage+=(needed+1024);
+ os->body_data=ret;
+ }
+ return 0;
}
-static int _os_lacing_expand(ogg_stream_state *os, int needed)
-{
- if(os->lacing_storage <= os->lacing_fill + needed)
- {
- void *ret;
- ret = _ogg_realloc(os->lacing_vals, (os->lacing_storage + needed + 32) *
- sizeof(*os->lacing_vals));
- if(!ret)
- {
- ogg_stream_clear(os);
- return -1;
- }
- os->lacing_vals = ret;
- ret = _ogg_realloc(os->granule_vals, (os->lacing_storage + needed + 32) *
- sizeof(*os->granule_vals));
- if(!ret)
- {
- ogg_stream_clear(os);
- return -1;
- }
- os->granule_vals = ret;
- os->lacing_storage += (needed + 32);
+static int _os_lacing_expand(ogg_stream_state *os,int needed){
+ if(os->lacing_storage<=os->lacing_fill+needed){
+ void *ret;
+ ret=_ogg_realloc(os->lacing_vals,(os->lacing_storage+needed+32)*
+ sizeof(*os->lacing_vals));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
}
- return 0;
+ os->lacing_vals=ret;
+ ret=_ogg_realloc(os->granule_vals,(os->lacing_storage+needed+32)*
+ sizeof(*os->granule_vals));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ os->granule_vals=ret;
+ os->lacing_storage+=(needed+32);
+ }
+ return 0;
}
/* checksum the page */
/* Direct table CRC; note that this will be faster in the future if we
perform the checksum silmultaneously with other copies */
-void ogg_page_checksum_set(ogg_page *og)
-{
- if(og)
- {
- ogg_uint32_t crc_reg = 0;
- int i;
-
- /* safety; needed for API behavior, but not framing code */
- og->header[22] = 0;
- og->header[23] = 0;
- og->header[24] = 0;
- og->header[25] = 0;
-
- for(i = 0; i < og->header_len; i++)
- crc_reg = (crc_reg << 8) ^ crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
- for(i = 0; i < og->body_len; i++)
- crc_reg = (crc_reg << 8) ^ crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
-
- og->header[22] = (unsigned char)(crc_reg & 0xff);
- og->header[23] = (unsigned char)((crc_reg >> 8) & 0xff);
- og->header[24] = (unsigned char)((crc_reg >> 16) & 0xff);
- og->header[25] = (unsigned char)((crc_reg >> 24) & 0xff);
- }
+void ogg_page_checksum_set(ogg_page *og){
+ if(og){
+ ogg_uint32_t crc_reg=0;
+ int i;
+
+ /* safety; needed for API behavior, but not framing code */
+ og->header[22]=0;
+ og->header[23]=0;
+ og->header[24]=0;
+ og->header[25]=0;
+
+ for(i=0;i<og->header_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
+ for(i=0;i<og->body_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
+
+ og->header[22]=(unsigned char)(crc_reg&0xff);
+ og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
+ og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
+ og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
+ }
}
/* submit data to the internal buffer of the framing engine */
int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
- long e_o_s, ogg_int64_t granulepos)
-{
-
- int bytes = 0, lacing_vals, i;
-
- if(ogg_stream_check(os)) return -1;
- if(!iov) return 0;
-
- for(i = 0; i < count; ++i) bytes += (int)iov[i].iov_len;
- lacing_vals = bytes / 255 + 1;
-
- if(os->body_returned)
- {
- /* advance packet data according to the body_returned pointer. We
- had to keep it around to return a pointer into the buffer last
- call */
-
- os->body_fill -= os->body_returned;
- if(os->body_fill)
- memmove(os->body_data, os->body_data + os->body_returned,
- os->body_fill);
- os->body_returned = 0;
- }
-
- /* make sure we have the buffer storage */
- if(_os_body_expand(os, bytes) || _os_lacing_expand(os, lacing_vals))
- return -1;
-
- /* Copy in the submitted packet. Yes, the copy is a waste; this is
- the liability of overly clean abstraction for the time being. It
- will actually be fairly easy to eliminate the extra copy in the
- future */
-
- for(i = 0; i < count; ++i)
- {
- memcpy(os->body_data + os->body_fill, iov[i].iov_base, iov[i].iov_len);
- os->body_fill += (int)iov[i].iov_len;
- }
-
- /* Store lacing vals for this packet */
- for(i = 0; i < lacing_vals - 1; i++)
- {
- os->lacing_vals[os->lacing_fill+i] = 255;
- os->granule_vals[os->lacing_fill+i] = os->granulepos;
- }
- os->lacing_vals[os->lacing_fill+i] = bytes % 255;
- os->granulepos = os->granule_vals[os->lacing_fill+i] = granulepos;
-
- /* flag the first segment as the beginning of the packet */
- os->lacing_vals[os->lacing_fill] |= 0x100;
-
- os->lacing_fill += lacing_vals;
-
- /* for the sake of completeness */
- os->packetno++;
-
- if(e_o_s)os->e_o_s = 1;
-
- return(0);
+ long e_o_s, ogg_int64_t granulepos){
+
+ int bytes = 0, lacing_vals, i;
+
+ if(ogg_stream_check(os)) return -1;
+ if(!iov) return 0;
+
+ for (i = 0; i < count; ++i) bytes += (int)iov[i].iov_len;
+ lacing_vals=bytes/255+1;
+
+ if(os->body_returned){
+ /* advance packet data according to the body_returned pointer. We
+ had to keep it around to return a pointer into the buffer last
+ call */
+
+ os->body_fill-=os->body_returned;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+os->body_returned,
+ os->body_fill);
+ os->body_returned=0;
+ }
+
+ /* make sure we have the buffer storage */
+ if(_os_body_expand(os,bytes) || _os_lacing_expand(os,lacing_vals))
+ return -1;
+
+ /* Copy in the submitted packet. Yes, the copy is a waste; this is
+ the liability of overly clean abstraction for the time being. It
+ will actually be fairly easy to eliminate the extra copy in the
+ future */
+
+ for (i = 0; i < count; ++i) {
+ memcpy(os->body_data+os->body_fill, iov[i].iov_base, iov[i].iov_len);
+ os->body_fill += (int)iov[i].iov_len;
+ }
+
+ /* Store lacing vals for this packet */
+ for(i=0;i<lacing_vals-1;i++){
+ os->lacing_vals[os->lacing_fill+i]=255;
+ os->granule_vals[os->lacing_fill+i]=os->granulepos;
+ }
+ os->lacing_vals[os->lacing_fill+i]=bytes%255;
+ os->granulepos=os->granule_vals[os->lacing_fill+i]=granulepos;
+
+ /* flag the first segment as the beginning of the packet */
+ os->lacing_vals[os->lacing_fill]|= 0x100;
+
+ os->lacing_fill+=lacing_vals;
+
+ /* for the sake of completeness */
+ os->packetno++;
+
+ if(e_o_s)os->e_o_s=1;
+
+ return(0);
}
-int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
-{
- ogg_iovec_t iov;
- iov.iov_base = op->packet;
- iov.iov_len = op->bytes;
- return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos);
+int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
+ ogg_iovec_t iov;
+ iov.iov_base = op->packet;
+ iov.iov_len = op->bytes;
+ return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos);
}
/* This will flush remaining packets into a page (returning nonzero),
@@ -410,127 +377,117 @@ int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
since ogg_stream_flush will flush the last page in a stream even if
it's undersized, you almost certainly want to use ogg_stream_pageout
- (and *not* ogg_stream_flush) unless you specifically need to flush
+ (and *not* ogg_stream_flush) unless you specifically need to flush
an page regardless of size in the middle of a stream. */
-int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
-{
- int i;
- int vals = 0;
- int maxvals = (os->lacing_fill > 255 ? 255 : os->lacing_fill);
- int bytes = 0;
- long acc = 0;
- ogg_int64_t granule_pos = -1;
-
- if(ogg_stream_check(os)) return 0;
- if(maxvals == 0)return 0;
-
- /* construct a page */
- /* decide how many segments to include */
-
- /* If this is the initial header case, the first page must only include
- the initial header packet */
- if(os->b_o_s == 0) /* 'initial header page' case */
- {
- granule_pos = 0;
- for(vals = 0; vals < maxvals; vals++)
- {
- if((os->lacing_vals[vals] & 0x0ff) < 255)
- {
- vals++;
- break;
- }
- }
- }
- else
- {
- for(vals = 0; vals < maxvals; vals++)
- {
- if(acc > 4096)break;
- acc += os->lacing_vals[vals] & 0x0ff;
- if((os->lacing_vals[vals] & 0xff) < 255)
- granule_pos = os->granule_vals[vals];
- }
+int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
+ int i;
+ int vals=0;
+ int maxvals=(os->lacing_fill>255?255:os->lacing_fill);
+ int bytes=0;
+ long acc=0;
+ ogg_int64_t granule_pos=-1;
+
+ if(ogg_stream_check(os)) return 0;
+ if(maxvals==0)return 0;
+
+ /* construct a page */
+ /* decide how many segments to include */
+
+ /* If this is the initial header case, the first page must only include
+ the initial header packet */
+ if(os->b_o_s==0){ /* 'initial header page' case */
+ granule_pos=0;
+ for(vals=0;vals<maxvals;vals++){
+ if((os->lacing_vals[vals]&0x0ff)<255){
+ vals++;
+ break;
+ }
}
-
- /* construct the header in temp storage */
- memcpy(os->header, "OggS", 4);
-
- /* stream structure version */
- os->header[4] = 0x00;
-
- /* continued packet flag? */
- os->header[5] = 0x00;
- if((os->lacing_vals[0] & 0x100) == 0)os->header[5] |= 0x01;
- /* first page flag? */
- if(os->b_o_s == 0)os->header[5] |= 0x02;
- /* last page flag? */
- if(os->e_o_s && os->lacing_fill == vals)os->header[5] |= 0x04;
- os->b_o_s = 1;
-
- /* 64 bits of PCM position */
- for(i = 6; i < 14; i++)
- {
- os->header[i] = (unsigned char)(granule_pos & 0xff);
- granule_pos >>= 8;
+ }else{
+ for(vals=0;vals<maxvals;vals++){
+ if(acc>4096)break;
+ acc+=os->lacing_vals[vals]&0x0ff;
+ if((os->lacing_vals[vals]&0xff)<255)
+ granule_pos=os->granule_vals[vals];
}
-
- /* 32 bits of stream serial number */
- {
- long serialno = os->serialno;
- for(i = 14; i < 18; i++)
- {
- os->header[i] = (unsigned char)(serialno & 0xff);
- serialno >>= 8;
- }
+ }
+
+ /* construct the header in temp storage */
+ memcpy(os->header,"OggS",4);
+
+ /* stream structure version */
+ os->header[4]=0x00;
+
+ /* continued packet flag? */
+ os->header[5]=0x00;
+ if((os->lacing_vals[0]&0x100)==0)os->header[5]|=0x01;
+ /* first page flag? */
+ if(os->b_o_s==0)os->header[5]|=0x02;
+ /* last page flag? */
+ if(os->e_o_s && os->lacing_fill==vals)os->header[5]|=0x04;
+ os->b_o_s=1;
+
+ /* 64 bits of PCM position */
+ for(i=6;i<14;i++){
+ os->header[i]=(unsigned char)(granule_pos&0xff);
+ granule_pos>>=8;
+ }
+
+ /* 32 bits of stream serial number */
+ {
+ long serialno=os->serialno;
+ for(i=14;i<18;i++){
+ os->header[i]=(unsigned char)(serialno&0xff);
+ serialno>>=8;
}
+ }
- /* 32 bits of page counter (we have both counter and page header
- because this val can roll over) */
- if(os->pageno == -1)os->pageno = 0; /* because someone called
+ /* 32 bits of page counter (we have both counter and page header
+ because this val can roll over) */
+ if(os->pageno==-1)os->pageno=0; /* because someone called
stream_reset; this would be a
strange thing to do in an
encode stream, but it has
plausible uses */
- {
- long pageno = os->pageno++;
- for(i = 18; i < 22; i++)
- {
- os->header[i] = (unsigned char)(pageno & 0xff);
- pageno >>= 8;
- }
+ {
+ long pageno=os->pageno++;
+ for(i=18;i<22;i++){
+ os->header[i]=(unsigned char)(pageno&0xff);
+ pageno>>=8;
}
-
- /* zero for computation; filled in later */
- os->header[22] = 0;
- os->header[23] = 0;
- os->header[24] = 0;
- os->header[25] = 0;
-
- /* segment table */
- os->header[26] = (unsigned char)(vals & 0xff);
- for(i = 0; i < vals; i++)
- bytes += os->header[i+27] = (unsigned char)(os->lacing_vals[i] & 0xff);
-
- /* set pointers in the ogg_page struct */
- og->header = os->header;
- og->header_len = os->header_fill = vals + 27;
- og->body = os->body_data + os->body_returned;
- og->body_len = bytes;
-
- /* advance the lacing data and set the body_returned pointer */
-
- os->lacing_fill -= vals;
- memmove(os->lacing_vals, os->lacing_vals + vals, os->lacing_fill * sizeof(*os->lacing_vals));
- memmove(os->granule_vals, os->granule_vals + vals, os->lacing_fill * sizeof(*os->granule_vals));
- os->body_returned += bytes;
-
- /* calculate the checksum */
-
- ogg_page_checksum_set(og);
-
- /* done */
- return(1);
+ }
+
+ /* zero for computation; filled in later */
+ os->header[22]=0;
+ os->header[23]=0;
+ os->header[24]=0;
+ os->header[25]=0;
+
+ /* segment table */
+ os->header[26]=(unsigned char)(vals&0xff);
+ for(i=0;i<vals;i++)
+ bytes+=os->header[i+27]=(unsigned char)(os->lacing_vals[i]&0xff);
+
+ /* set pointers in the ogg_page struct */
+ og->header=os->header;
+ og->header_len=os->header_fill=vals+27;
+ og->body=os->body_data+os->body_returned;
+ og->body_len=bytes;
+
+ /* advance the lacing data and set the body_returned pointer */
+
+ os->lacing_fill-=vals;
+ memmove(os->lacing_vals,os->lacing_vals+vals,os->lacing_fill*sizeof(*os->lacing_vals));
+ memmove(os->granule_vals,os->granule_vals+vals,os->lacing_fill*sizeof(*os->granule_vals));
+ os->body_returned+=bytes;
+
+ /* calculate the checksum */
+
+ ogg_page_checksum_set(og);
+
+ /* done */
+ return(1);
}
@@ -538,27 +495,24 @@ int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
returned are to static buffers; do not free. The returned buffers are
good only until the next call (using the same ogg_stream_state) */
-int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og)
-{
- if(ogg_stream_check(os)) return 0;
-
- if((os->e_o_s && os->lacing_fill) || /* 'were done, now flush' case */
- os->body_fill - os->body_returned > 4096 || /* 'page nominal size' case */
- os->lacing_fill >= 255 || /* 'segment table full' case */
- (os->lacing_fill && !os->b_o_s)) /* 'initial header page' case */
- {
-
- return(ogg_stream_flush(os, og));
- }
-
- /* not enough data to construct a page and not end of stream */
- return 0;
+int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){
+ if(ogg_stream_check(os)) return 0;
+
+ if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */
+ os->body_fill-os->body_returned > 4096 ||/* 'page nominal size' case */
+ os->lacing_fill>=255 || /* 'segment table full' case */
+ (os->lacing_fill&&!os->b_o_s)){ /* 'initial header page' case */
+
+ return(ogg_stream_flush(os,og));
+ }
+
+ /* not enough data to construct a page and not end of stream */
+ return 0;
}
-int ogg_stream_eos(ogg_stream_state *os)
-{
- if(ogg_stream_check(os)) return 1;
- return os->e_o_s;
+int ogg_stream_eos(ogg_stream_state *os){
+ if(ogg_stream_check(os)) return 1;
+ return os->e_o_s;
}
/* DECODING PRIMITIVES: packet streaming layer **********************/
@@ -577,85 +531,73 @@ int ogg_stream_eos(ogg_stream_state *os)
ogg_stream_state. */
/* initialize the struct to a known state */
-int ogg_sync_init(ogg_sync_state *oy)
-{
- if(oy)
- {
- oy->storage = -1; /* used as a readiness flag */
- memset(oy, 0, sizeof(*oy));
- }
- return(0);
+int ogg_sync_init(ogg_sync_state *oy){
+ if(oy){
+ oy->storage = -1; /* used as a readiness flag */
+ memset(oy,0,sizeof(*oy));
+ }
+ return(0);
}
/* clear non-flat storage within */
-int ogg_sync_clear(ogg_sync_state *oy)
-{
- if(oy)
- {
- if(oy->data)_ogg_free(oy->data);
- memset(oy, 0, sizeof(*oy));
- }
- return(0);
+int ogg_sync_clear(ogg_sync_state *oy){
+ if(oy){
+ if(oy->data)_ogg_free(oy->data);
+ memset(oy,0,sizeof(*oy));
+ }
+ return(0);
}
-int ogg_sync_destroy(ogg_sync_state *oy)
-{
- if(oy)
- {
- ogg_sync_clear(oy);
- _ogg_free(oy);
- }
- return(0);
+int ogg_sync_destroy(ogg_sync_state *oy){
+ if(oy){
+ ogg_sync_clear(oy);
+ _ogg_free(oy);
+ }
+ return(0);
}
-int ogg_sync_check(ogg_sync_state *oy)
-{
- if(oy->storage < 0) return -1;
- return 0;
+int ogg_sync_check(ogg_sync_state *oy){
+ if(oy->storage<0) return -1;
+ return 0;
}
-char *ogg_sync_buffer(ogg_sync_state *oy, long size)
-{
- if(ogg_sync_check(oy)) return NULL;
+char *ogg_sync_buffer(ogg_sync_state *oy, long size){
+ if(ogg_sync_check(oy)) return NULL;
- /* first, clear out any space that has been previously returned */
- if(oy->returned)
- {
- oy->fill -= oy->returned;
- if(oy->fill > 0)
- memmove(oy->data, oy->data + oy->returned, oy->fill);
- oy->returned = 0;
- }
+ /* first, clear out any space that has been previously returned */
+ if(oy->returned){
+ oy->fill-=oy->returned;
+ if(oy->fill>0)
+ memmove(oy->data,oy->data+oy->returned,oy->fill);
+ oy->returned=0;
+ }
- if(size > oy->storage - oy->fill)
- {
- /* We need to extend the internal buffer */
- long newsize = size + oy->fill + 4096; /* an extra page to be nice */
- void *ret;
-
- if(oy->data)
- ret = _ogg_realloc(oy->data, newsize);
- else
- ret = _ogg_malloc(newsize);
- if(!ret)
- {
- ogg_sync_clear(oy);
- return NULL;
- }
- oy->data = ret;
- oy->storage = newsize;
+ if(size>oy->storage-oy->fill){
+ /* We need to extend the internal buffer */
+ long newsize=size+oy->fill+4096; /* an extra page to be nice */
+ void *ret;
+
+ if(oy->data)
+ ret=_ogg_realloc(oy->data,newsize);
+ else
+ ret=_ogg_malloc(newsize);
+ if(!ret){
+ ogg_sync_clear(oy);
+ return NULL;
}
+ oy->data=ret;
+ oy->storage=newsize;
+ }
- /* expose a segment at least as large as requested at the fill mark */
- return((char *)oy->data + oy->fill);
+ /* expose a segment at least as large as requested at the fill mark */
+ return((char *)oy->data+oy->fill);
}
-int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
-{
- if(ogg_sync_check(oy))return -1;
- if(oy->fill + bytes > oy->storage)return -1;
- oy->fill += bytes;
- return(0);
+int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
+ if(ogg_sync_check(oy))return -1;
+ if(oy->fill+bytes>oy->storage)return -1;
+ oy->fill+=bytes;
+ return(0);
}
/* sync the stream. This is meant to be useful for finding page
@@ -665,98 +607,94 @@ int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
-n) skipped n bytes
0) page not ready; more data (no bytes skipped)
n) page synced at current location; page length n bytes
-
+
*/
-long ogg_sync_pageseek(ogg_sync_state *oy, ogg_page *og)
-{
- unsigned char *page = oy->data + oy->returned;
- unsigned char *next;
- long bytes = oy->fill - oy->returned;
-
- if(ogg_sync_check(oy))return 0;
-
- if(oy->headerbytes == 0)
- {
- int headerbytes, i;
- if(bytes < 27)return(0); /* not enough for a header */
-
- /* verify capture pattern */
- if(memcmp(page, "OggS", 4))goto sync_fail;
-
- headerbytes = page[26] + 27;
- if(bytes < headerbytes)return(0); /* not enough for header + seg table */
-
- /* count up body length in the segment table */
-
- for(i = 0; i < page[26]; i++)
- oy->bodybytes += page[27+i];
- oy->headerbytes = headerbytes;
+long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
+ unsigned char *page=oy->data+oy->returned;
+ unsigned char *next;
+ long bytes=oy->fill-oy->returned;
+
+ if(ogg_sync_check(oy))return 0;
+
+ if(oy->headerbytes==0){
+ int headerbytes,i;
+ if(bytes<27)return(0); /* not enough for a header */
+
+ /* verify capture pattern */
+ if(memcmp(page,"OggS",4))goto sync_fail;
+
+ headerbytes=page[26]+27;
+ if(bytes<headerbytes)return(0); /* not enough for header + seg table */
+
+ /* count up body length in the segment table */
+
+ for(i=0;i<page[26];i++)
+ oy->bodybytes+=page[27+i];
+ oy->headerbytes=headerbytes;
+ }
+
+ if(oy->bodybytes+oy->headerbytes>bytes)return(0);
+
+ /* The whole test page is buffered. Verify the checksum */
+ {
+ /* Grab the checksum bytes, set the header field to zero */
+ char chksum[4];
+ ogg_page log;
+
+ memcpy(chksum,page+22,4);
+ memset(page+22,0,4);
+
+ /* set up a temp page struct and recompute the checksum */
+ log.header=page;
+ log.header_len=oy->headerbytes;
+ log.body=page+oy->headerbytes;
+ log.body_len=oy->bodybytes;
+ ogg_page_checksum_set(&log);
+
+ /* Compare */
+ if(memcmp(chksum,page+22,4)){
+ /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
+ at all) */
+ /* replace the computed checksum with the one actually read in */
+ memcpy(page+22,chksum,4);
+
+ /* Bad checksum. Lose sync */
+ goto sync_fail;
}
-
- if(oy->bodybytes + oy->headerbytes > bytes)return(0);
-
- /* The whole test page is buffered. Verify the checksum */
- {
- /* Grab the checksum bytes, set the header field to zero */
- char chksum[4];
- ogg_page log;
-
- memcpy(chksum, page + 22, 4);
- memset(page + 22, 0, 4);
-
- /* set up a temp page struct and recompute the checksum */
- log.header = page;
- log.header_len = oy->headerbytes;
- log.body = page + oy->headerbytes;
- log.body_len = oy->bodybytes;
- ogg_page_checksum_set(&log);
-
- /* Compare */
- if(memcmp(chksum, page + 22, 4))
- {
- /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
- at all) */
- /* replace the computed checksum with the one actually read in */
- memcpy(page + 22, chksum, 4);
-
- /* Bad checksum. Lose sync */
- goto sync_fail;
- }
+ }
+
+ /* yes, have a whole page all ready to go */
+ {
+ unsigned char *page=oy->data+oy->returned;
+ long bytes;
+
+ if(og){
+ og->header=page;
+ og->header_len=oy->headerbytes;
+ og->body=page+oy->headerbytes;
+ og->body_len=oy->bodybytes;
}
- /* yes, have a whole page all ready to go */
- {
- unsigned char *page = oy->data + oy->returned;
- long bytes;
-
- if(og)
- {
- og->header = page;
- og->header_len = oy->headerbytes;
- og->body = page + oy->headerbytes;
- og->body_len = oy->bodybytes;
- }
-
- oy->unsynced = 0;
- oy->returned += (bytes = oy->headerbytes + oy->bodybytes);
- oy->headerbytes = 0;
- oy->bodybytes = 0;
- return(bytes);
- }
-
-sync_fail:
-
- oy->headerbytes = 0;
- oy->bodybytes = 0;
-
- /* search for possible capture */
- next = memchr(page + 1, 'O', bytes - 1);
- if(!next)
- next = oy->data + oy->fill;
-
- oy->returned = (int)(next - oy->data);
- return((long) - (next - page));
+ oy->unsynced=0;
+ oy->returned+=(bytes=oy->headerbytes+oy->bodybytes);
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(bytes);
+ }
+
+ sync_fail:
+
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+
+ /* search for possible capture */
+ next=memchr(page+1,'O',bytes-1);
+ if(!next)
+ next=oy->data+oy->fill;
+
+ oy->returned=(int)(next-oy->data);
+ return((long)-(next-page));
}
/* sync the stream and get a page. Keep trying until we find a page.
@@ -770,305 +708,274 @@ sync_fail:
Returns pointers into buffered data; invalidated by next call to
_stream, _clear, _init, or _buffer */
-int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og)
-{
-
- if(ogg_sync_check(oy))return 0;
+int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
- /* all we need to do is verify a page at the head of the stream
- buffer. If it doesn't verify, we look for the next potential
- frame */
+ if(ogg_sync_check(oy))return 0;
- for(;;)
- {
- long ret = ogg_sync_pageseek(oy, og);
- if(ret > 0)
- {
- /* have a page */
- return(1);
- }
- if(ret == 0)
- {
- /* need more data */
- return(0);
- }
+ /* all we need to do is verify a page at the head of the stream
+ buffer. If it doesn't verify, we look for the next potential
+ frame */
- /* head did not start a synced page... skipped some bytes */
- if(!oy->unsynced)
- {
- oy->unsynced = 1;
- return(-1);
- }
+ for(;;){
+ long ret=ogg_sync_pageseek(oy,og);
+ if(ret>0){
+ /* have a page */
+ return(1);
+ }
+ if(ret==0){
+ /* need more data */
+ return(0);
+ }
+
+ /* head did not start a synced page... skipped some bytes */
+ if(!oy->unsynced){
+ oy->unsynced=1;
+ return(-1);
+ }
- /* loop. keep looking */
+ /* loop. keep looking */
- }
+ }
}
/* add the incoming page to the stream state; we decompose the page
into packet segments here as well. */
-int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og)
-{
- unsigned char *header = og->header;
- unsigned char *body = og->body;
- long bodysize = og->body_len;
- int segptr = 0;
-
- int version = ogg_page_version(og);
- int continued = ogg_page_continued(og);
- int bos = ogg_page_bos(og);
- int eos = ogg_page_eos(og);
- ogg_int64_t granulepos = ogg_page_granulepos(og);
- int serialno = ogg_page_serialno(og);
- long pageno = ogg_page_pageno(og);
- int segments = header[26];
-
- if(ogg_stream_check(os)) return -1;
-
- /* clean up 'returned data' */
- {
- long lr = os->lacing_returned;
- long br = os->body_returned;
-
- /* body data */
- if(br)
- {
- os->body_fill -= br;
- if(os->body_fill)
- memmove(os->body_data, os->body_data + br, os->body_fill);
- os->body_returned = 0;
- }
+int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
+ unsigned char *header=og->header;
+ unsigned char *body=og->body;
+ long bodysize=og->body_len;
+ int segptr=0;
+
+ int version=ogg_page_version(og);
+ int continued=ogg_page_continued(og);
+ int bos=ogg_page_bos(og);
+ int eos=ogg_page_eos(og);
+ ogg_int64_t granulepos=ogg_page_granulepos(og);
+ int serialno=ogg_page_serialno(og);
+ long pageno=ogg_page_pageno(og);
+ int segments=header[26];
+
+ if(ogg_stream_check(os)) return -1;
+
+ /* clean up 'returned data' */
+ {
+ long lr=os->lacing_returned;
+ long br=os->body_returned;
+
+ /* body data */
+ if(br){
+ os->body_fill-=br;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+br,os->body_fill);
+ os->body_returned=0;
+ }
- if(lr)
- {
- /* segment table */
- if(os->lacing_fill - lr)
- {
- memmove(os->lacing_vals, os->lacing_vals + lr,
- (os->lacing_fill - lr)*sizeof(*os->lacing_vals));
- memmove(os->granule_vals, os->granule_vals + lr,
- (os->lacing_fill - lr)*sizeof(*os->granule_vals));
- }
- os->lacing_fill -= lr;
- os->lacing_packet -= lr;
- os->lacing_returned = 0;
- }
+ if(lr){
+ /* segment table */
+ if(os->lacing_fill-lr){
+ memmove(os->lacing_vals,os->lacing_vals+lr,
+ (os->lacing_fill-lr)*sizeof(*os->lacing_vals));
+ memmove(os->granule_vals,os->granule_vals+lr,
+ (os->lacing_fill-lr)*sizeof(*os->granule_vals));
+ }
+ os->lacing_fill-=lr;
+ os->lacing_packet-=lr;
+ os->lacing_returned=0;
}
+ }
- /* check the serial number */
- if(serialno != os->serialno)return(-1);
- if(version > 0)return(-1);
+ /* check the serial number */
+ if(serialno!=os->serialno)return(-1);
+ if(version>0)return(-1);
- if(_os_lacing_expand(os, segments + 1)) return -1;
+ if(_os_lacing_expand(os,segments+1)) return -1;
- /* are we in sequence? */
- if(pageno != os->pageno)
- {
- int i;
+ /* are we in sequence? */
+ if(pageno!=os->pageno){
+ int i;
- /* unroll previous partial packet (if any) */
- for(i = os->lacing_packet; i < os->lacing_fill; i++)
- os->body_fill -= os->lacing_vals[i] & 0xff;
- os->lacing_fill = os->lacing_packet;
+ /* unroll previous partial packet (if any) */
+ for(i=os->lacing_packet;i<os->lacing_fill;i++)
+ os->body_fill-=os->lacing_vals[i]&0xff;
+ os->lacing_fill=os->lacing_packet;
- /* make a note of dropped data in segment table */
- if(os->pageno != -1)
- {
- os->lacing_vals[os->lacing_fill++] = 0x400;
- os->lacing_packet++;
- }
+ /* make a note of dropped data in segment table */
+ if(os->pageno!=-1){
+ os->lacing_vals[os->lacing_fill++]=0x400;
+ os->lacing_packet++;
}
-
- /* are we a 'continued packet' page? If so, we may need to skip
- some segments */
- if(continued)
- {
- if(os->lacing_fill < 1 ||
- os->lacing_vals[os->lacing_fill-1] == 0x400)
- {
- bos = 0;
- for(; segptr < segments; segptr++)
- {
- int val = header[27+segptr];
- body += val;
- bodysize -= val;
- if(val < 255)
- {
- segptr++;
- break;
- }
- }
+ }
+
+ /* are we a 'continued packet' page? If so, we may need to skip
+ some segments */
+ if(continued){
+ if(os->lacing_fill<1 ||
+ os->lacing_vals[os->lacing_fill-1]==0x400){
+ bos=0;
+ for(;segptr<segments;segptr++){
+ int val=header[27+segptr];
+ body+=val;
+ bodysize-=val;
+ if(val<255){
+ segptr++;
+ break;
}
+ }
}
-
- if(bodysize)
- {
- if(_os_body_expand(os, bodysize)) return -1;
- memcpy(os->body_data + os->body_fill, body, bodysize);
- os->body_fill += bodysize;
+ }
+
+ if(bodysize){
+ if(_os_body_expand(os,bodysize)) return -1;
+ memcpy(os->body_data+os->body_fill,body,bodysize);
+ os->body_fill+=bodysize;
+ }
+
+ {
+ int saved=-1;
+ while(segptr<segments){
+ int val=header[27+segptr];
+ os->lacing_vals[os->lacing_fill]=val;
+ os->granule_vals[os->lacing_fill]=-1;
+
+ if(bos){
+ os->lacing_vals[os->lacing_fill]|=0x100;
+ bos=0;
+ }
+
+ if(val<255)saved=os->lacing_fill;
+
+ os->lacing_fill++;
+ segptr++;
+
+ if(val<255)os->lacing_packet=os->lacing_fill;
}
-
- {
- int saved = -1;
- while(segptr < segments)
- {
- int val = header[27+segptr];
- os->lacing_vals[os->lacing_fill] = val;
- os->granule_vals[os->lacing_fill] = -1;
-
- if(bos)
- {
- os->lacing_vals[os->lacing_fill] |= 0x100;
- bos = 0;
- }
-
- if(val < 255)saved = os->lacing_fill;
-
- os->lacing_fill++;
- segptr++;
-
- if(val < 255)os->lacing_packet = os->lacing_fill;
- }
-
- /* set the granulepos on the last granuleval of the last full packet */
- if(saved != -1)
- {
- os->granule_vals[saved] = granulepos;
- }
-
+
+ /* set the granulepos on the last granuleval of the last full packet */
+ if(saved!=-1){
+ os->granule_vals[saved]=granulepos;
}
- if(eos)
- {
- os->e_o_s = 1;
- if(os->lacing_fill > 0)
- os->lacing_vals[os->lacing_fill-1] |= 0x200;
- }
+ }
- os->pageno = pageno + 1;
+ if(eos){
+ os->e_o_s=1;
+ if(os->lacing_fill>0)
+ os->lacing_vals[os->lacing_fill-1]|=0x200;
+ }
- return(0);
+ os->pageno=pageno+1;
+
+ return(0);
}
/* clear things to an initial state. Good to call, eg, before seeking */
-int ogg_sync_reset(ogg_sync_state *oy)
-{
- if(ogg_sync_check(oy))return -1;
-
- oy->fill = 0;
- oy->returned = 0;
- oy->unsynced = 0;
- oy->headerbytes = 0;
- oy->bodybytes = 0;
- return(0);
+int ogg_sync_reset(ogg_sync_state *oy){
+ if(ogg_sync_check(oy))return -1;
+
+ oy->fill=0;
+ oy->returned=0;
+ oy->unsynced=0;
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(0);
}
-int ogg_stream_reset(ogg_stream_state *os)
-{
- if(ogg_stream_check(os)) return -1;
+int ogg_stream_reset(ogg_stream_state *os){
+ if(ogg_stream_check(os)) return -1;
- os->body_fill = 0;
- os->body_returned = 0;
+ os->body_fill=0;
+ os->body_returned=0;
- os->lacing_fill = 0;
- os->lacing_packet = 0;
- os->lacing_returned = 0;
+ os->lacing_fill=0;
+ os->lacing_packet=0;
+ os->lacing_returned=0;
- os->header_fill = 0;
+ os->header_fill=0;
- os->e_o_s = 0;
- os->b_o_s = 0;
- os->pageno = -1;
- os->packetno = 0;
- os->granulepos = 0;
+ os->e_o_s=0;
+ os->b_o_s=0;
+ os->pageno=-1;
+ os->packetno=0;
+ os->granulepos=0;
- return(0);
+ return(0);
}
-int ogg_stream_reset_serialno(ogg_stream_state *os, int serialno)
-{
- if(ogg_stream_check(os)) return -1;
- ogg_stream_reset(os);
- os->serialno = serialno;
- return(0);
+int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
+ if(ogg_stream_check(os)) return -1;
+ ogg_stream_reset(os);
+ os->serialno=serialno;
+ return(0);
}
-static int _packetout(ogg_stream_state *os, ogg_packet *op, int adv)
-{
+static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
- /* The last part of decode. We have the stream broken into packet
- segments. Now we need to group them into packets (or return the
- out of sync markers) */
+ /* The last part of decode. We have the stream broken into packet
+ segments. Now we need to group them into packets (or return the
+ out of sync markers) */
- int ptr = os->lacing_returned;
+ int ptr=os->lacing_returned;
- if(os->lacing_packet <= ptr)return(0);
+ if(os->lacing_packet<=ptr)return(0);
- if(os->lacing_vals[ptr] & 0x400)
- {
- /* we need to tell the codec there's a gap; it might need to
- handle previous packet dependencies. */
- os->lacing_returned++;
- os->packetno++;
- return(-1);
- }
+ if(os->lacing_vals[ptr]&0x400){
+ /* we need to tell the codec there's a gap; it might need to
+ handle previous packet dependencies. */
+ os->lacing_returned++;
+ os->packetno++;
+ return(-1);
+ }
- if(!op && !adv)return(1); /* just using peek as an inexpensive way
+ if(!op && !adv)return(1); /* just using peek as an inexpensive way
to ask if there's a whole packet
waiting */
- /* Gather the whole packet. We'll have no holes or a partial packet */
- {
- int size = os->lacing_vals[ptr] & 0xff;
- int bytes = size;
- int eos = os->lacing_vals[ptr] & 0x200; /* last packet of the stream? */
- int bos = os->lacing_vals[ptr] & 0x100; /* first packet of the stream? */
-
- while(size == 255)
- {
- int val = os->lacing_vals[++ptr];
- size = val & 0xff;
- if(val & 0x200)eos = 0x200;
- bytes += size;
- }
+ /* Gather the whole packet. We'll have no holes or a partial packet */
+ {
+ int size=os->lacing_vals[ptr]&0xff;
+ int bytes=size;
+ int eos=os->lacing_vals[ptr]&0x200; /* last packet of the stream? */
+ int bos=os->lacing_vals[ptr]&0x100; /* first packet of the stream? */
+
+ while(size==255){
+ int val=os->lacing_vals[++ptr];
+ size=val&0xff;
+ if(val&0x200)eos=0x200;
+ bytes+=size;
+ }
- if(op)
- {
- op->e_o_s = eos;
- op->b_o_s = bos;
- op->packet = os->body_data + os->body_returned;
- op->packetno = os->packetno;
- op->granulepos = os->granule_vals[ptr];
- op->bytes = bytes;
- }
+ if(op){
+ op->e_o_s=eos;
+ op->b_o_s=bos;
+ op->packet=os->body_data+os->body_returned;
+ op->packetno=os->packetno;
+ op->granulepos=os->granule_vals[ptr];
+ op->bytes=bytes;
+ }
- if(adv)
- {
- os->body_returned += bytes;
- os->lacing_returned = ptr + 1;
- os->packetno++;
- }
+ if(adv){
+ os->body_returned+=bytes;
+ os->lacing_returned=ptr+1;
+ os->packetno++;
}
- return(1);
+ }
+ return(1);
}
-int ogg_stream_packetout(ogg_stream_state *os, ogg_packet *op)
-{
- if(ogg_stream_check(os)) return 0;
- return _packetout(os, op, 1);
+int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
+ if(ogg_stream_check(os)) return 0;
+ return _packetout(os,op,1);
}
-int ogg_stream_packetpeek(ogg_stream_state *os, ogg_packet *op)
-{
- if(ogg_stream_check(os)) return 0;
- return _packetout(os, op, 0);
+int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
+ if(ogg_stream_check(os)) return 0;
+ return _packetout(os,op,0);
}
-void ogg_packet_clear(ogg_packet *op)
-{
- _ogg_free(op->packet);
- memset(op, 0, sizeof(*op));
+void ogg_packet_clear(ogg_packet *op) {
+ _ogg_free(op->packet);
+ memset(op, 0, sizeof(*op));
}
#ifdef _V_SELFTEST
@@ -1077,961 +984,893 @@ void ogg_packet_clear(ogg_packet *op)
ogg_stream_state os_en, os_de;
ogg_sync_state oy;
-void checkpacket(ogg_packet *op, int len, int no, int pos)
-{
- long j;
- static int sequence = 0;
- static int lastno = 0;
-
- if(op->bytes != len)
- {
- fprintf(stderr, "incorrect packet length!\n");
- exit(1);
- }
- if(op->granulepos != pos)
- {
- fprintf(stderr, "incorrect packet position!\n");
- exit(1);
- }
+void checkpacket(ogg_packet *op,int len, int no, int pos){
+ long j;
+ static int sequence=0;
+ static int lastno=0;
- /* packet number just follows sequence/gap; adjust the input number
- for that */
- if(no == 0)
- {
- sequence = 0;
- }
- else
- {
- sequence++;
- if(no > lastno + 1)
- sequence++;
- }
- lastno = no;
- if(op->packetno != sequence)
- {
- fprintf(stderr, "incorrect packet sequence %ld != %d\n",
- (long)(op->packetno), sequence);
- exit(1);
+ if(op->bytes!=len){
+ fprintf(stderr,"incorrect packet length!\n");
+ exit(1);
+ }
+ if(op->granulepos!=pos){
+ fprintf(stderr,"incorrect packet position!\n");
+ exit(1);
+ }
+
+ /* packet number just follows sequence/gap; adjust the input number
+ for that */
+ if(no==0){
+ sequence=0;
+ }else{
+ sequence++;
+ if(no>lastno+1)
+ sequence++;
+ }
+ lastno=no;
+ if(op->packetno!=sequence){
+ fprintf(stderr,"incorrect packet sequence %ld != %d\n",
+ (long)(op->packetno),sequence);
+ exit(1);
+ }
+
+ /* Test data */
+ for(j=0;j<op->bytes;j++)
+ if(op->packet[j]!=((j+no)&0xff)){
+ fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
+ j,op->packet[j],(j+no)&0xff);
+ exit(1);
}
-
- /* Test data */
- for(j = 0; j < op->bytes; j++)
- if(op->packet[j] != ((j + no) & 0xff))
- {
- fprintf(stderr, "body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
- j, op->packet[j], (j + no) & 0xff);
- exit(1);
- }
}
-void check_page(unsigned char *data, const int *header, ogg_page *og)
-{
- long j;
- /* Test data */
- for(j = 0; j < og->body_len; j++)
- if(og->body[j] != data[j])
- {
- fprintf(stderr, "body data mismatch (2) at pos %ld: %x!=%x!\n\n",
- j, data[j], og->body[j]);
- exit(1);
- }
-
- /* Test header */
- for(j = 0; j < og->header_len; j++)
- {
- if(og->header[j] != header[j])
- {
- fprintf(stderr, "header content mismatch at pos %ld:\n", j);
- for(j = 0; j < header[26] + 27; j++)
- fprintf(stderr, " (%ld)%02x:%02x", j, header[j], og->header[j]);
- fprintf(stderr, "\n");
- exit(1);
- }
+void check_page(unsigned char *data,const int *header,ogg_page *og){
+ long j;
+ /* Test data */
+ for(j=0;j<og->body_len;j++)
+ if(og->body[j]!=data[j]){
+ fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
+ j,data[j],og->body[j]);
+ exit(1);
}
- if(og->header_len != header[26] + 27)
- {
- fprintf(stderr, "header length incorrect! (%ld!=%d)\n",
- og->header_len, header[26] + 27);
- exit(1);
+
+ /* Test header */
+ for(j=0;j<og->header_len;j++){
+ if(og->header[j]!=header[j]){
+ fprintf(stderr,"header content mismatch at pos %ld:\n",j);
+ for(j=0;j<header[26]+27;j++)
+ fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
+ fprintf(stderr,"\n");
+ exit(1);
}
+ }
+ if(og->header_len!=header[26]+27){
+ fprintf(stderr,"header length incorrect! (%ld!=%d)\n",
+ og->header_len,header[26]+27);
+ exit(1);
+ }
}
-void print_header(ogg_page *og)
-{
- int j;
- fprintf(stderr, "\nHEADER:\n");
- fprintf(stderr, " capture: %c %c %c %c version: %d flags: %x\n",
- og->header[0], og->header[1], og->header[2], og->header[3],
- (int)og->header[4], (int)og->header[5]);
-
- fprintf(stderr, " granulepos: %d serialno: %d pageno: %ld\n",
- (og->header[9] << 24) | (og->header[8] << 16) |
- (og->header[7] << 8) | og->header[6],
- (og->header[17] << 24) | (og->header[16] << 16) |
- (og->header[15] << 8) | og->header[14],
- ((long)(og->header[21]) << 24) | (og->header[20] << 16) |
- (og->header[19] << 8) | og->header[18]);
-
- fprintf(stderr, " checksum: %02x:%02x:%02x:%02x\n segments: %d (",
- (int)og->header[22], (int)og->header[23],
- (int)og->header[24], (int)og->header[25],
- (int)og->header[26]);
-
- for(j = 27; j < og->header_len; j++)
- fprintf(stderr, "%d ", (int)og->header[j]);
- fprintf(stderr, ")\n\n");
+void print_header(ogg_page *og){
+ int j;
+ fprintf(stderr,"\nHEADER:\n");
+ fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n",
+ og->header[0],og->header[1],og->header[2],og->header[3],
+ (int)og->header[4],(int)og->header[5]);
+
+ fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n",
+ (og->header[9]<<24)|(og->header[8]<<16)|
+ (og->header[7]<<8)|og->header[6],
+ (og->header[17]<<24)|(og->header[16]<<16)|
+ (og->header[15]<<8)|og->header[14],
+ ((long)(og->header[21])<<24)|(og->header[20]<<16)|
+ (og->header[19]<<8)|og->header[18]);
+
+ fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (",
+ (int)og->header[22],(int)og->header[23],
+ (int)og->header[24],(int)og->header[25],
+ (int)og->header[26]);
+
+ for(j=27;j<og->header_len;j++)
+ fprintf(stderr,"%d ",(int)og->header[j]);
+ fprintf(stderr,")\n\n");
}
-void copy_page(ogg_page *og)
-{
- unsigned char *temp = _ogg_malloc(og->header_len);
- memcpy(temp, og->header, og->header_len);
- og->header = temp;
+void copy_page(ogg_page *og){
+ unsigned char *temp=_ogg_malloc(og->header_len);
+ memcpy(temp,og->header,og->header_len);
+ og->header=temp;
- temp = _ogg_malloc(og->body_len);
- memcpy(temp, og->body, og->body_len);
- og->body = temp;
+ temp=_ogg_malloc(og->body_len);
+ memcpy(temp,og->body,og->body_len);
+ og->body=temp;
}
-void free_page(ogg_page *og)
-{
- _ogg_free(og->header);
- _ogg_free(og->body);
+void free_page(ogg_page *og){
+ _ogg_free (og->header);
+ _ogg_free (og->body);
}
-void error(void)
-{
- fprintf(stderr, "error!\n");
- exit(1);
+void error(void){
+ fprintf(stderr,"error!\n");
+ exit(1);
}
/* 17 only */
-const int head1_0[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0x15, 0xed, 0xec, 0x91,
+const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x15,0xed,0xec,0x91,
1,
- 17
- };
+ 17};
/* 17, 254, 255, 256, 500, 510, 600 byte, pad */
-const int head1_1[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0x59, 0x10, 0x6c, 0x2c,
+const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x59,0x10,0x6c,0x2c,
1,
- 17
- };
-const int head2_1[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x89, 0x33, 0x85, 0xce,
+ 17};
+const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x89,0x33,0x85,0xce,
13,
- 254, 255, 0, 255, 1, 255, 245, 255, 255, 0,
- 255, 255, 90
- };
+ 254,255,0,255,1,255,245,255,255,0,
+ 255,255,90};
/* nil packets; beginning,middle,end */
-const int head1_2[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
-const int head2_2[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x5c, 0x3f, 0x66, 0xcb,
+ 0};
+const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x5c,0x3f,0x66,0xcb,
17,
- 17, 254, 255, 0, 0, 255, 1, 0, 255, 245, 255, 255, 0,
- 255, 255, 90, 0
- };
+ 17,254,255,0,0,255,1,0,255,245,255,255,0,
+ 255,255,90,0};
/* large initial packet */
-const int head1_3[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0x01, 0x27, 0x31, 0xaa,
+const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x01,0x27,0x31,0xaa,
18,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 10
- };
-
-const int head2_3[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x7f, 0x4e, 0x8a, 0xd2,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,10};
+
+const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x7f,0x4e,0x8a,0xd2,
4,
- 255, 4, 255, 0
- };
+ 255,4,255,0};
/* continuing packet test */
-const int head1_4[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_4[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x54, 0x05, 0x51, 0xc8,
+const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x54,0x05,0x51,0xc8,
17,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head3_4[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x05,
- 0x07, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0xc8, 0xc3, 0xcb, 0xed,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255};
+
+const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xc8,0xc3,0xcb,0xed,
5,
- 10, 255, 4, 255, 0
- };
+ 10,255,4,255,0};
/* page with the 255 segment limit */
-const int head1_5[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_5[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0x07, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0xed, 0x2a, 0x2e, 0xa7,
+const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0xed,0x2a,0x2e,0xa7,
255,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10
- };
-
-const int head3_5[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0x6c, 0x3b, 0x82, 0x3d,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10};
+
+const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x6c,0x3b,0x82,0x3d,
1,
- 50
- };
+ 50};
/* packet that overspans over an entire page */
-const int head1_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x3c, 0xd9, 0x4d, 0x3f,
+const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x3c,0xd9,0x4d,0x3f,
17,
- 100, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head3_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x01,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0x01, 0xd2, 0xe5, 0xe5,
+ 100,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255};
+
+const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x01,0xd2,0xe5,0xe5,
17,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head4_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x05,
- 0x07, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 3, 0, 0, 0,
- 0xef, 0xdd, 0x88, 0xde,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255};
+
+const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,3,0,0,0,
+ 0xef,0xdd,0x88,0xde,
7,
- 255, 255, 75, 255, 4, 255, 0
- };
+ 255,255,75,255,4,255,0};
/* packet that overspans over an entire page */
-const int head1_7[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_7[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x3c, 0xd9, 0x4d, 0x3f,
+const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x3c,0xd9,0x4d,0x3f,
17,
- 100, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head3_7[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x05,
- 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0xd4, 0xe0, 0x60, 0xe5,
- 1, 0
- };
-
-void test_pack(const int *pl, const int **headers, int byteskip,
- int pageskip, int packetskip)
-{
- unsigned char *data = _ogg_malloc(1024 * 1024); /* for scripted test cases only */
- long inptr = 0;
- long outptr = 0;
- long deptr = 0;
- long depacket = 0;
- long granule_pos = 7, pageno = 0;
- int i, j, packets, pageout = pageskip;
- int eosflag = 0;
- int bosflag = 0;
-
- int byteskipcount = 0;
+ 100,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255};
+
+const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xd4,0xe0,0x60,0xe5,
+ 1,0};
+
+void test_pack(const int *pl, const int **headers, int byteskip,
+ int pageskip, int packetskip){
+ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
+ long inptr=0;
+ long outptr=0;
+ long deptr=0;
+ long depacket=0;
+ long granule_pos=7,pageno=0;
+ int i,j,packets,pageout=pageskip;
+ int eosflag=0;
+ int bosflag=0;
+
+ int byteskipcount=0;
+
+ ogg_stream_reset(&os_en);
+ ogg_stream_reset(&os_de);
+ ogg_sync_reset(&oy);
+
+ for(packets=0;packets<packetskip;packets++)
+ depacket+=pl[packets];
+
+ for(packets=0;;packets++)if(pl[packets]==-1)break;
+
+ for(i=0;i<packets;i++){
+ /* construct a test packet */
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.granulepos=granule_pos;
+
+ granule_pos+=1024;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+
+ /* submit the test packet */
+ ogg_stream_packetin(&os_en,&op);
+
+ /* retrieve any finished pages */
+ {
+ ogg_page og;
+
+ while(ogg_stream_pageout(&os_en,&og)){
+ /* We have a page. Check it carefully */
- ogg_stream_reset(&os_en);
- ogg_stream_reset(&os_de);
- ogg_sync_reset(&oy);
+ fprintf(stderr,"%ld, ",pageno);
- for(packets = 0; packets < packetskip; packets++)
- depacket += pl[packets];
+ if(headers[pageno]==NULL){
+ fprintf(stderr,"coded too many pages!\n");
+ exit(1);
+ }
- for(packets = 0;; packets++)if(pl[packets] == -1)break;
+ check_page(data+outptr,headers[pageno],&og);
- for(i = 0; i < packets; i++)
- {
- /* construct a test packet */
- ogg_packet op;
- int len = pl[i];
+ outptr+=og.body_len;
+ pageno++;
+ if(pageskip){
+ bosflag=1;
+ pageskip--;
+ deptr+=og.body_len;
+ }
- op.packet = data + inptr;
- op.bytes = len;
- op.e_o_s = (pl[i+1] < 0 ? 1 : 0);
- op.granulepos = granule_pos;
+ /* have a complete page; submit it to sync/decode */
- granule_pos += 1024;
+ {
+ ogg_page og_de;
+ ogg_packet op_de,op_de2;
+ char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len);
+ char *next=buf;
+ byteskipcount+=og.header_len;
+ if(byteskipcount>byteskip){
+ memcpy(next,og.header,byteskipcount-byteskip);
+ next+=byteskipcount-byteskip;
+ byteskipcount=byteskip;
+ }
+
+ byteskipcount+=og.body_len;
+ if(byteskipcount>byteskip){
+ memcpy(next,og.body,byteskipcount-byteskip);
+ next+=byteskipcount-byteskip;
+ byteskipcount=byteskip;
+ }
+
+ ogg_sync_wrote(&oy,next-buf);
+
+ while(1){
+ int ret=ogg_sync_pageout(&oy,&og_de);
+ if(ret==0)break;
+ if(ret<0)continue;
+ /* got a page. Happy happy. Verify that it's good. */
+
+ fprintf(stderr,"(%ld), ",pageout);
+
+ check_page(data+deptr,headers[pageout],&og_de);
+ deptr+=og_de.body_len;
+ pageout++;
+
+ /* submit it to deconstitution */
+ ogg_stream_pagein(&os_de,&og_de);
+
+ /* packets out? */
+ while(ogg_stream_packetpeek(&os_de,&op_de2)>0){
+ ogg_stream_packetpeek(&os_de,NULL);
+ ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
+
+ /* verify peek and out match */
+ if(memcmp(&op_de,&op_de2,sizeof(op_de))){
+ fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
- for(j = 0; j < len; j++)data[inptr++] = i + j;
+ /* verify the packet! */
+ /* check data */
+ if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
+ fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
+ /* check bos flag */
+ if(bosflag==0 && op_de.b_o_s==0){
+ fprintf(stderr,"b_o_s flag not set on packet!\n");
+ exit(1);
+ }
+ if(bosflag && op_de.b_o_s){
+ fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
+ exit(1);
+ }
+ bosflag=1;
+ depacket+=op_de.bytes;
+
+ /* check eos flag */
+ if(eosflag){
+ fprintf(stderr,"Multiple decoded packets with eos flag!\n");
+ exit(1);
+ }
- /* submit the test packet */
- ogg_stream_packetin(&os_en, &op);
+ if(op_de.e_o_s)eosflag=1;
- /* retrieve any finished pages */
- {
- ogg_page og;
-
- while(ogg_stream_pageout(&os_en, &og))
- {
- /* We have a page. Check it carefully */
-
- fprintf(stderr, "%ld, ", pageno);
-
- if(headers[pageno] == NULL)
- {
- fprintf(stderr, "coded too many pages!\n");
- exit(1);
- }
-
- check_page(data + outptr, headers[pageno], &og);
-
- outptr += og.body_len;
- pageno++;
- if(pageskip)
- {
- bosflag = 1;
- pageskip--;
- deptr += og.body_len;
- }
-
- /* have a complete page; submit it to sync/decode */
-
- {
- ogg_page og_de;
- ogg_packet op_de, op_de2;
- char *buf = ogg_sync_buffer(&oy, og.header_len + og.body_len);
- char *next = buf;
- byteskipcount += og.header_len;
- if(byteskipcount > byteskip)
- {
- memcpy(next, og.header, byteskipcount - byteskip);
- next += byteskipcount - byteskip;
- byteskipcount = byteskip;
- }
-
- byteskipcount += og.body_len;
- if(byteskipcount > byteskip)
- {
- memcpy(next, og.body, byteskipcount - byteskip);
- next += byteskipcount - byteskip;
- byteskipcount = byteskip;
- }
-
- ogg_sync_wrote(&oy, next - buf);
-
- while(1)
- {
- int ret = ogg_sync_pageout(&oy, &og_de);
- if(ret == 0)break;
- if(ret < 0)continue;
- /* got a page. Happy happy. Verify that it's good. */
-
- fprintf(stderr, "(%ld), ", pageout);
-
- check_page(data + deptr, headers[pageout], &og_de);
- deptr += og_de.body_len;
- pageout++;
-
- /* submit it to deconstitution */
- ogg_stream_pagein(&os_de, &og_de);
-
- /* packets out? */
- while(ogg_stream_packetpeek(&os_de, &op_de2) > 0)
- {
- ogg_stream_packetpeek(&os_de, NULL);
- ogg_stream_packetout(&os_de, &op_de); /* just catching them all */
-
- /* verify peek and out match */
- if(memcmp(&op_de, &op_de2, sizeof(op_de)))
- {
- fprintf(stderr, "packetout != packetpeek! pos=%ld\n",
- depacket);
- exit(1);
- }
-
- /* verify the packet! */
- /* check data */
- if(memcmp(data + depacket, op_de.packet, op_de.bytes))
- {
- fprintf(stderr, "packet data mismatch in decode! pos=%ld\n",
- depacket);
- exit(1);
- }
- /* check bos flag */
- if(bosflag == 0 && op_de.b_o_s == 0)
- {
- fprintf(stderr, "b_o_s flag not set on packet!\n");
- exit(1);
- }
- if(bosflag && op_de.b_o_s)
- {
- fprintf(stderr, "b_o_s flag incorrectly set on packet!\n");
- exit(1);
- }
- bosflag = 1;
- depacket += op_de.bytes;
-
- /* check eos flag */
- if(eosflag)
- {
- fprintf(stderr, "Multiple decoded packets with eos flag!\n");
- exit(1);
- }
-
- if(op_de.e_o_s)eosflag = 1;
-
- /* check granulepos flag */
- if(op_de.granulepos != -1)
- {
- fprintf(stderr, " granule:%ld ", (long)op_de.granulepos);
- }
- }
- }
- }
+ /* check granulepos flag */
+ if(op_de.granulepos!=-1){
+ fprintf(stderr," granule:%ld ",(long)op_de.granulepos);
+ }
}
+ }
}
+ }
}
- _ogg_free(data);
- if(headers[pageno] != NULL)
- {
- fprintf(stderr, "did not write last page!\n");
- exit(1);
- }
- if(headers[pageout] != NULL)
- {
- fprintf(stderr, "did not decode last page!\n");
- exit(1);
- }
- if(inptr != outptr)
- {
- fprintf(stderr, "encoded page data incomplete!\n");
- exit(1);
- }
- if(inptr != deptr)
- {
- fprintf(stderr, "decoded page data incomplete!\n");
- exit(1);
- }
- if(inptr != depacket)
- {
- fprintf(stderr, "decoded packet data incomplete!\n");
- exit(1);
- }
- if(!eosflag)
- {
- fprintf(stderr, "Never got a packet with EOS set!\n");
- exit(1);
- }
- fprintf(stderr, "ok.\n");
+ }
+ _ogg_free(data);
+ if(headers[pageno]!=NULL){
+ fprintf(stderr,"did not write last page!\n");
+ exit(1);
+ }
+ if(headers[pageout]!=NULL){
+ fprintf(stderr,"did not decode last page!\n");
+ exit(1);
+ }
+ if(inptr!=outptr){
+ fprintf(stderr,"encoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=deptr){
+ fprintf(stderr,"decoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=depacket){
+ fprintf(stderr,"decoded packet data incomplete!\n");
+ exit(1);
+ }
+ if(!eosflag){
+ fprintf(stderr,"Never got a packet with EOS set!\n");
+ exit(1);
+ }
+ fprintf(stderr,"ok.\n");
}
-int main(void)
-{
-
- ogg_stream_init(&os_en, 0x04030201);
- ogg_stream_init(&os_de, 0x04030201);
- ogg_sync_init(&oy);
-
- /* Exercise each code path in the framing code. Also verify that
- the checksums are working. */
-
- {
- /* 17 only */
- const int packets[] = {17, -1};
- const int *headret[] = {head1_0, NULL};
-
- fprintf(stderr, "testing single page encoding... ");
- test_pack(packets, headret, 0, 0, 0);
- }
-
- {
- /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
- const int packets[] = {17, 254, 255, 256, 500, 510, 600, -1};
- const int *headret[] = {head1_1, head2_1, NULL};
-
- fprintf(stderr, "testing basic page encoding... ");
- test_pack(packets, headret, 0, 0, 0);
- }
-
- {
- /* nil packets; beginning,middle,end */
- const int packets[] = {0, 17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
- const int *headret[] = {head1_2, head2_2, NULL};
+int main(void){
+
+ ogg_stream_init(&os_en,0x04030201);
+ ogg_stream_init(&os_de,0x04030201);
+ ogg_sync_init(&oy);
+
+ /* Exercise each code path in the framing code. Also verify that
+ the checksums are working. */
+
+ {
+ /* 17 only */
+ const int packets[]={17, -1};
+ const int *headret[]={head1_0,NULL};
+
+ fprintf(stderr,"testing single page encoding... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
+ const int packets[]={17, 254, 255, 256, 500, 510, 600, -1};
+ const int *headret[]={head1_1,head2_1,NULL};
+
+ fprintf(stderr,"testing basic page encoding... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* nil packets; beginning,middle,end */
+ const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
+ const int *headret[]={head1_2,head2_2,NULL};
+
+ fprintf(stderr,"testing basic nil packets... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* large initial packet */
+ const int packets[]={4345,259,255,-1};
+ const int *headret[]={head1_3,head2_3,NULL};
+
+ fprintf(stderr,"testing initial-packet lacing > 4k... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* continuing packet test */
+ const int packets[]={0,4345,259,255,-1};
+ const int *headret[]={head1_4,head2_4,head3_4,NULL};
+
+ fprintf(stderr,"testing single packet page span... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ /* page with the 255 segment limit */
+ {
+
+ const int packets[]={0,10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,50,-1};
+ const int *headret[]={head1_5,head2_5,head3_5,NULL};
+
+ fprintf(stderr,"testing max packet segments... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* packet that overspans over an entire page */
+ const int packets[]={0,100,9000,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing very large packets... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* test for the libogg 1.1.1 resync in large continuation bug
+ found by Josh Coalson) */
+ const int packets[]={0,100,9000,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing continuation resync in very large packets... ");
+ test_pack(packets,headret,100,2,3);
+ }
+
+ {
+ /* term only page. why not? */
+ const int packets[]={0,100,4080,-1};
+ const int *headret[]={head1_7,head2_7,head3_7,NULL};
+
+ fprintf(stderr,"testing zero data page (1 nil packet)... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+
+
+ {
+ /* build a bunch of pages for testing */
+ unsigned char *data=_ogg_malloc(1024*1024);
+ int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1};
+ int inptr=0,i,j;
+ ogg_page og[5];
+
+ ogg_stream_reset(&os_en);
- fprintf(stderr, "testing basic nil packets... ");
- test_pack(packets, headret, 0, 0, 0);
+ for(i=0;pl[i]!=-1;i++){
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.granulepos=(i+1)*1000;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+ ogg_stream_packetin(&os_en,&op);
}
- {
- /* large initial packet */
- const int packets[] = {4345, 259, 255, -1};
- const int *headret[] = {head1_3, head2_3, NULL};
+ _ogg_free(data);
- fprintf(stderr, "testing initial-packet lacing > 4k... ");
- test_pack(packets, headret, 0, 0, 0);
+ /* retrieve finished pages */
+ for(i=0;i<5;i++){
+ if(ogg_stream_pageout(&os_en,&og[i])==0){
+ fprintf(stderr,"Too few pages output building sync tests!\n");
+ exit(1);
+ }
+ copy_page(&og[i]);
}
+ /* Test lost pages on pagein/packetout: no rollback */
{
- /* continuing packet test */
- const int packets[] = {0, 4345, 259, 255, -1};
- const int *headret[] = {head1_4, head2_4, head3_4, NULL};
-
- fprintf(stderr, "testing single packet page span... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){
+ memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+ og[i].header_len);
+ ogg_sync_wrote(&oy,og[i].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+ ogg_sync_wrote(&oy,og[i].body_len);
+ }
+
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ /* skip */
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+
+ /* do we get the expected results/packets? */
+
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,0,0,0);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,100,1,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,4079,2,3000);
+ if(ogg_stream_packetout(&os_de,&test)!=-1){
+ fprintf(stderr,"Error: loss of page did not return error\n");
+ exit(1);
+ }
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,76,5,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,34,6,-1);
+ fprintf(stderr,"ok.\n");
}
- /* page with the 255 segment limit */
+ /* Test lost pages on pagein/packetout: rollback with continuation */
{
-
- const int packets[] = {0, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 50, -1
- };
- const int *headret[] = {head1_5, head2_5, head3_5, NULL};
-
- fprintf(stderr, "testing max packet segments... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages (rollback required)... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){
+ memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+ og[i].header_len);
+ ogg_sync_wrote(&oy,og[i].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+ ogg_sync_wrote(&oy,og[i].body_len);
+ }
+
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ /* skip */
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+
+ /* do we get the expected results/packets? */
+
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,0,0,0);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,100,1,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,4079,2,3000);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,2956,3,4000);
+ if(ogg_stream_packetout(&os_de,&test)!=-1){
+ fprintf(stderr,"Error: loss of page did not return error\n");
+ exit(1);
+ }
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,300,13,14000);
+ fprintf(stderr,"ok.\n");
}
-
+
+ /* the rest only test sync */
{
- /* packet that overspans over an entire page */
- const int packets[] = {0, 100, 9000, 259, 255, -1};
- const int *headret[] = {head1_6, head2_6, head3_6, head4_6, NULL};
-
- fprintf(stderr, "testing very large packets... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page og_de;
+ /* Test fractional page inputs: incomplete capture */
+ fprintf(stderr,"Testing sync on partial inputs... ");
+ ogg_sync_reset(&oy);
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ 3);
+ ogg_sync_wrote(&oy,3);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete fixed header */
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete header */
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23,
+ 5);
+ ogg_sync_wrote(&oy,5);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete body */
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28,
+ og[1].header_len-28);
+ ogg_sync_wrote(&oy,og[1].header_len-28);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000);
+ ogg_sync_wrote(&oy,1000);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000,
+ og[1].body_len-1000);
+ ogg_sync_wrote(&oy,og[1].body_len-1000);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
}
+ /* Test fractional page inputs: page + incomplete capture */
{
- /* test for the libogg 1.1.1 resync in large continuation bug
- found by Josh Coalson) */
- const int packets[] = {0, 100, 9000, 259, 255, -1};
- const int *headret[] = {head1_6, head2_6, head3_6, head4_6, NULL};
-
- fprintf(stderr, "testing continuation resync in very large packets... ");
- test_pack(packets, headret, 100, 2, 3);
+ ogg_page og_de;
+ fprintf(stderr,"Testing sync on 1+partial inputs... ");
+ ogg_sync_reset(&oy);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20,
+ og[1].header_len-20);
+ ogg_sync_wrote(&oy,og[1].header_len-20);
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
}
-
+
+ /* Test recapture: garbage + page */
{
- /* term only page. why not? */
- const int packets[] = {0, 100, 4080, -1};
- const int *headret[] = {head1_7, head2_7, head3_7, NULL};
-
- fprintf(stderr, "testing zero data page (1 nil packet)... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page og_de;
+ fprintf(stderr,"Testing search for capture... ");
+ ogg_sync_reset(&oy);
+
+ /* 'garbage' */
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20,
+ og[2].header_len-20);
+ ogg_sync_wrote(&oy,og[2].header_len-20);
+ memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
+ og[2].body_len);
+ ogg_sync_wrote(&oy,og[2].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
}
-
-
+ /* Test recapture: page + garbage + page */
{
- /* build a bunch of pages for testing */
- unsigned char *data = _ogg_malloc(1024 * 1024);
- int pl[] = {0, 100, 4079, 2956, 2057, 76, 34, 912, 0, 234, 1000, 1000, 1000, 300, -1};
- int inptr = 0, i, j;
- ogg_page og[5];
-
- ogg_stream_reset(&os_en);
-
- for(i = 0; pl[i] != -1; i++)
- {
- ogg_packet op;
- int len = pl[i];
-
- op.packet = data + inptr;
- op.bytes = len;
- op.e_o_s = (pl[i+1] < 0 ? 1 : 0);
- op.granulepos = (i + 1) * 1000;
-
- for(j = 0; j < len; j++)data[inptr++] = i + j;
- ogg_stream_packetin(&os_en, &op);
- }
-
- _ogg_free(data);
-
- /* retrieve finished pages */
- for(i = 0; i < 5; i++)
- {
- if(ogg_stream_pageout(&os_en, &og[i]) == 0)
- {
- fprintf(stderr, "Too few pages output building sync tests!\n");
- exit(1);
- }
- copy_page(&og[i]);
- }
-
- /* Test lost pages on pagein/packetout: no rollback */
- {
- ogg_page temp;
- ogg_packet test;
-
- fprintf(stderr, "Testing loss of pages... ");
-
- ogg_sync_reset(&oy);
- ogg_stream_reset(&os_de);
- for(i = 0; i < 5; i++)
- {
- memcpy(ogg_sync_buffer(&oy, og[i].header_len), og[i].header,
- og[i].header_len);
- ogg_sync_wrote(&oy, og[i].header_len);
- memcpy(ogg_sync_buffer(&oy, og[i].body_len), og[i].body, og[i].body_len);
- ogg_sync_wrote(&oy, og[i].body_len);
- }
-
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- /* skip */
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
-
- /* do we get the expected results/packets? */
-
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 0, 0, 0);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 100, 1, -1);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 4079, 2, 3000);
- if(ogg_stream_packetout(&os_de, &test) != -1)
- {
- fprintf(stderr, "Error: loss of page did not return error\n");
- exit(1);
- }
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 76, 5, -1);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 34, 6, -1);
- fprintf(stderr, "ok.\n");
- }
-
- /* Test lost pages on pagein/packetout: rollback with continuation */
- {
- ogg_page temp;
- ogg_packet test;
-
- fprintf(stderr, "Testing loss of pages (rollback required)... ");
-
- ogg_sync_reset(&oy);
- ogg_stream_reset(&os_de);
- for(i = 0; i < 5; i++)
- {
- memcpy(ogg_sync_buffer(&oy, og[i].header_len), og[i].header,
- og[i].header_len);
- ogg_sync_wrote(&oy, og[i].header_len);
- memcpy(ogg_sync_buffer(&oy, og[i].body_len), og[i].body, og[i].body_len);
- ogg_sync_wrote(&oy, og[i].body_len);
- }
-
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- /* skip */
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
-
- /* do we get the expected results/packets? */
-
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 0, 0, 0);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 100, 1, -1);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 4079, 2, 3000);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 2956, 3, 4000);
- if(ogg_stream_packetout(&os_de, &test) != -1)
- {
- fprintf(stderr, "Error: loss of page did not return error\n");
- exit(1);
- }
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 300, 13, 14000);
- fprintf(stderr, "ok.\n");
- }
+ ogg_page og_de;
+ fprintf(stderr,"Testing recapture... ");
+ ogg_sync_reset(&oy);
- /* the rest only test sync */
- {
- ogg_page og_de;
- /* Test fractional page inputs: incomplete capture */
- fprintf(stderr, "Testing sync on partial inputs... ");
- ogg_sync_reset(&oy);
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- 3);
- ogg_sync_wrote(&oy, 3);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- /* Test fractional page inputs: incomplete fixed header */
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 3,
- 20);
- ogg_sync_wrote(&oy, 20);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- /* Test fractional page inputs: incomplete header */
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 23,
- 5);
- ogg_sync_wrote(&oy, 5);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- /* Test fractional page inputs: incomplete body */
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 28,
- og[1].header_len - 28);
- ogg_sync_wrote(&oy, og[1].header_len - 28);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body, 1000);
- ogg_sync_wrote(&oy, 1000);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body + 1000,
- og[1].body_len - 1000);
- ogg_sync_wrote(&oy, og[1].body_len - 1000);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
- /* Test fractional page inputs: page + incomplete capture */
- {
- ogg_page og_de;
- fprintf(stderr, "Testing sync on 1+partial inputs... ");
- ogg_sync_reset(&oy);
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- og[1].header_len);
- ogg_sync_wrote(&oy, og[1].header_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- 20);
- ogg_sync_wrote(&oy, 20);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 20,
- og[1].header_len - 20);
- ogg_sync_wrote(&oy, og[1].header_len - 20);
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
- /* Test recapture: garbage + page */
- {
- ogg_page og_de;
- fprintf(stderr, "Testing search for capture... ");
- ogg_sync_reset(&oy);
-
- /* 'garbage' */
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- og[1].header_len);
- ogg_sync_wrote(&oy, og[1].header_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
-
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header,
- 20);
- ogg_sync_wrote(&oy, 20);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header + 20,
- og[2].header_len - 20);
- ogg_sync_wrote(&oy, og[2].header_len - 20);
- memcpy(ogg_sync_buffer(&oy, og[2].body_len), og[2].body,
- og[2].body_len);
- ogg_sync_wrote(&oy, og[2].body_len);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
-
- /* Test recapture: page + garbage + page */
- {
- ogg_page og_de;
- fprintf(stderr, "Testing recapture... ");
- ogg_sync_reset(&oy);
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ og[2].header_len);
+ ogg_sync_wrote(&oy,og[2].header_len);
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- og[1].header_len);
- ogg_sync_wrote(&oy, og[1].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ og[2].header_len);
+ ogg_sync_wrote(&oy,og[2].header_len);
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header,
- og[2].header_len);
- ogg_sync_wrote(&oy, og[2].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
+ og[2].body_len-5);
+ ogg_sync_wrote(&oy,og[2].body_len-5);
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header,
- og[2].header_len);
- ogg_sync_wrote(&oy, og[2].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header,
+ og[3].header_len);
+ ogg_sync_wrote(&oy,og[3].header_len);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
+ memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body,
+ og[3].body_len);
+ ogg_sync_wrote(&oy,og[3].body_len);
- memcpy(ogg_sync_buffer(&oy, og[2].body_len), og[2].body,
- og[2].body_len - 5);
- ogg_sync_wrote(&oy, og[2].body_len - 5);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
- memcpy(ogg_sync_buffer(&oy, og[3].header_len), og[3].header,
- og[3].header_len);
- ogg_sync_wrote(&oy, og[3].header_len);
-
- memcpy(ogg_sync_buffer(&oy, og[3].body_len), og[3].body,
- og[3].body_len);
- ogg_sync_wrote(&oy, og[3].body_len);
-
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
+ fprintf(stderr,"ok.\n");
+ }
- /* Free page data that was previously copied */
- {
- for(i = 0; i < 5; i++)
- {
- free_page(&og[i]);
- }
- }
+ /* Free page data that was previously copied */
+ {
+ for(i=0;i<5;i++){
+ free_page(&og[i]);
+ }
}
+ }
- return(0);
+ return(0);
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitmath.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitmath.c
index 454852a83..3415b9144 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitmath.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitmath.c
@@ -60,20 +60,20 @@
*/
unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
{
- unsigned l = 0;
- FLAC__ASSERT(v > 0);
- while(v >>= 1)
- l++;
- return l;
+ unsigned l = 0;
+ FLAC__ASSERT(v > 0);
+ while(v >>= 1)
+ l++;
+ return l;
}
unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
{
- unsigned l = 0;
- FLAC__ASSERT(v > 0);
- while(v >>= 1)
- l++;
- return l;
+ unsigned l = 0;
+ FLAC__ASSERT(v > 0);
+ while(v >>= 1)
+ l++;
+ return l;
}
/* An example of what FLAC__bitmath_silog2() computes:
@@ -102,60 +102,48 @@ unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
*/
unsigned FLAC__bitmath_silog2(int v)
{
- while(1)
- {
- if(v == 0)
- {
- return 0;
- }
- else if(v > 0)
- {
- unsigned l = 0;
- while(v)
- {
- l++;
- v >>= 1;
- }
- return l + 1;
- }
- else if(v == -1)
- {
- return 2;
- }
- else
- {
- v++;
- v = -v;
- }
- }
+ while(1) {
+ if(v == 0) {
+ return 0;
+ }
+ else if(v > 0) {
+ unsigned l = 0;
+ while(v) {
+ l++;
+ v >>= 1;
+ }
+ return l+1;
+ }
+ else if(v == -1) {
+ return 2;
+ }
+ else {
+ v++;
+ v = -v;
+ }
+ }
}
unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v)
{
- while(1)
- {
- if(v == 0)
- {
- return 0;
- }
- else if(v > 0)
- {
- unsigned l = 0;
- while(v)
- {
- l++;
- v >>= 1;
- }
- return l + 1;
- }
- else if(v == -1)
- {
- return 2;
- }
- else
- {
- v++;
- v = -v;
- }
- }
+ while(1) {
+ if(v == 0) {
+ return 0;
+ }
+ else if(v > 0) {
+ unsigned l = 0;
+ while(v) {
+ l++;
+ v >>= 1;
+ }
+ return l+1;
+ }
+ else if(v == -1) {
+ return 2;
+ }
+ else {
+ v++;
+ v = -v;
+ }
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitreader.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitreader.c
index 14189f2b2..1ba74314f 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitreader.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitreader.c
@@ -96,24 +96,23 @@ typedef FLAC__uint32 brword;
*/
static const unsigned FLAC__BITREADER_DEFAULT_CAPACITY = 65536u / FLAC__BITS_PER_WORD; /* in words */
-static const unsigned char byte_to_unary_table[] =
-{
- 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
- 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,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 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
+static const unsigned char byte_to_unary_table[] = {
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 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,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 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
};
#ifdef min
@@ -137,21 +136,20 @@ static const unsigned char byte_to_unary_table[] =
#endif
/* WATCHOUT: assembly routines rely on the order in which these fields are declared */
-struct FLAC__BitReader
-{
- /* any partially-consumed word at the head will stay right-justified as bits are consumed from the left */
- /* any incomplete word at the tail will be left-justified, and bytes from the read callback are added on the right */
- brword *buffer;
- unsigned capacity; /* in words */
- unsigned words; /* # of completed words in buffer */
- unsigned bytes; /* # of bytes in incomplete word at buffer[words] */
- unsigned consumed_words; /* #words ... */
- unsigned consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */
- unsigned read_crc16; /* the running frame CRC */
- unsigned crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */
- FLAC__BitReaderReadCallback read_callback;
- void *client_data;
- FLAC__CPUInfo cpu_info;
+struct FLAC__BitReader {
+ /* any partially-consumed word at the head will stay right-justified as bits are consumed from the left */
+ /* any incomplete word at the tail will be left-justified, and bytes from the read callback are added on the right */
+ brword *buffer;
+ unsigned capacity; /* in words */
+ unsigned words; /* # of completed words in buffer */
+ unsigned bytes; /* # of bytes in incomplete word at buffer[words] */
+ unsigned consumed_words; /* #words ... */
+ unsigned consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */
+ unsigned read_crc16; /* the running frame CRC */
+ unsigned crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */
+ FLAC__BitReaderReadCallback read_callback;
+ void *client_data;
+ FLAC__CPUInfo cpu_info;
};
#ifdef _MSC_VER
@@ -159,158 +157,141 @@ struct FLAC__BitReader
/* OPT: use _byteswap_ulong intrinsic? */
static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x)
{
- x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF);
- return (x >> 16) | (x << 16);
+ x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
+ return (x>>16) | (x<<16);
}
#ifdef _WIN64
#else
static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len)
{
- __asm
- {
- mov edx, start
- mov ecx, len
- test ecx, ecx
- loop1:
- jz done1
- mov eax, [edx]
- bswap eax
- mov [edx], eax
- add edx, 4
- dec ecx
- jmp short loop1
- done1:
- }
+ __asm {
+ mov edx, start
+ mov ecx, len
+ test ecx, ecx
+loop1:
+ jz done1
+ mov eax, [edx]
+ bswap eax
+ mov [edx], eax
+ add edx, 4
+ dec ecx
+ jmp short loop1
+done1:
+ }
}
#endif
#endif
static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word)
{
- register unsigned crc = br->read_crc16;
+ register unsigned crc = br->read_crc16;
#if FLAC__BYTES_PER_WORD == 4
- switch(br->crc16_align)
- {
- case 0:
- crc = FLAC__CRC16_UPDATE((unsigned)(word >> 24), crc);
- case 8:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc);
- case 16:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc);
- case 24:
- br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc);
- }
+ switch(br->crc16_align) {
+ case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 24), crc);
+ case 8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc);
+ case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc);
+ case 24: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc);
+ }
#elif FLAC__BYTES_PER_WORD == 8
- switch(br->crc16_align)
- {
- case 0:
- crc = FLAC__CRC16_UPDATE((unsigned)(word >> 56), crc);
- case 8:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 48) & 0xff), crc);
- case 16:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 40) & 0xff), crc);
- case 24:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 32) & 0xff), crc);
- case 32:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 24) & 0xff), crc);
- case 40:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc);
- case 48:
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc);
- case 56:
- br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc);
- }
+ switch(br->crc16_align) {
+ case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 56), crc);
+ case 8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 48) & 0xff), crc);
+ case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 40) & 0xff), crc);
+ case 24: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 32) & 0xff), crc);
+ case 32: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 24) & 0xff), crc);
+ case 40: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc);
+ case 48: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc);
+ case 56: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc);
+ }
#else
- for(; br->crc16_align < FLAC__BITS_PER_WORD; br->crc16_align += 8)
- crc = FLAC__CRC16_UPDATE((unsigned)((word >> (FLAC__BITS_PER_WORD - 8 - br->crc16_align)) & 0xff), crc);
- br->read_crc16 = crc;
+ for( ; br->crc16_align < FLAC__BITS_PER_WORD; br->crc16_align += 8)
+ crc = FLAC__CRC16_UPDATE((unsigned)((word >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), crc);
+ br->read_crc16 = crc;
#endif
- br->crc16_align = 0;
+ br->crc16_align = 0;
}
/* would be static except it needs to be called by asm routines */
FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br)
{
- unsigned start, end;
- size_t bytes;
- FLAC__byte *target;
-
- /* first shift the unconsumed buffer data toward the front as much as possible */
- if(br->consumed_words > 0)
- {
- start = br->consumed_words;
- end = br->words + (br->bytes ? 1 : 0);
- memmove(br->buffer, br->buffer + start, FLAC__BYTES_PER_WORD *(end - start));
-
- br->words -= start;
- br->consumed_words = 0;
- }
-
- /*
- * set the target for reading, taking into account word alignment and endianness
- */
- bytes = (br->capacity - br->words) * FLAC__BYTES_PER_WORD - br->bytes;
- if(bytes == 0)
- return false; /* no space left, buffer is too small; see note for FLAC__BITREADER_DEFAULT_CAPACITY */
- target = ((FLAC__byte*)(br->buffer + br->words)) + br->bytes;
-
- /* before reading, if the existing reader looks like this (say brword is 32 bits wide)
- * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1 (partial tail word is left-justified)
- * buffer[BE]: 11 22 33 44 55 ?? ?? ?? (shown layed out as bytes sequentially in memory)
- * buffer[LE]: 44 33 22 11 ?? ?? ?? 55 (?? being don't-care)
- * ^^-------target, bytes=3
- * on LE machines, have to byteswap the odd tail word so nothing is
- * overwritten:
- */
+ unsigned start, end;
+ size_t bytes;
+ FLAC__byte *target;
+
+ /* first shift the unconsumed buffer data toward the front as much as possible */
+ if(br->consumed_words > 0) {
+ start = br->consumed_words;
+ end = br->words + (br->bytes? 1:0);
+ memmove(br->buffer, br->buffer+start, FLAC__BYTES_PER_WORD * (end - start));
+
+ br->words -= start;
+ br->consumed_words = 0;
+ }
+
+ /*
+ * set the target for reading, taking into account word alignment and endianness
+ */
+ bytes = (br->capacity - br->words) * FLAC__BYTES_PER_WORD - br->bytes;
+ if(bytes == 0)
+ return false; /* no space left, buffer is too small; see note for FLAC__BITREADER_DEFAULT_CAPACITY */
+ target = ((FLAC__byte*)(br->buffer+br->words)) + br->bytes;
+
+ /* before reading, if the existing reader looks like this (say brword is 32 bits wide)
+ * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1 (partial tail word is left-justified)
+ * buffer[BE]: 11 22 33 44 55 ?? ?? ?? (shown layed out as bytes sequentially in memory)
+ * buffer[LE]: 44 33 22 11 ?? ?? ?? 55 (?? being don't-care)
+ * ^^-------target, bytes=3
+ * on LE machines, have to byteswap the odd tail word so nothing is
+ * overwritten:
+ */
#if WORDS_BIGENDIAN
#else
- if(br->bytes)
- br->buffer[br->words] = SWAP_BE_WORD_TO_HOST(br->buffer[br->words]);
+ if(br->bytes)
+ br->buffer[br->words] = SWAP_BE_WORD_TO_HOST(br->buffer[br->words]);
#endif
- /* now it looks like:
- * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1
- * buffer[BE]: 11 22 33 44 55 ?? ?? ??
- * buffer[LE]: 44 33 22 11 55 ?? ?? ??
- * ^^-------target, bytes=3
- */
-
- /* read in the data; note that the callback may return a smaller number of bytes */
- if(!br->read_callback(target, &bytes, br->client_data))
- return false;
-
- /* after reading bytes 66 77 88 99 AA BB CC DD EE FF from the client:
- * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
- * buffer[BE]: 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ??
- * buffer[LE]: 44 33 22 11 55 66 77 88 99 AA BB CC DD EE FF ??
- * now have to byteswap on LE machines:
- */
+ /* now it looks like:
+ * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1
+ * buffer[BE]: 11 22 33 44 55 ?? ?? ??
+ * buffer[LE]: 44 33 22 11 55 ?? ?? ??
+ * ^^-------target, bytes=3
+ */
+
+ /* read in the data; note that the callback may return a smaller number of bytes */
+ if(!br->read_callback(target, &bytes, br->client_data))
+ return false;
+
+ /* after reading bytes 66 77 88 99 AA BB CC DD EE FF from the client:
+ * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
+ * buffer[BE]: 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ??
+ * buffer[LE]: 44 33 22 11 55 66 77 88 99 AA BB CC DD EE FF ??
+ * now have to byteswap on LE machines:
+ */
#if WORDS_BIGENDIAN
#else
- end = (br->words * FLAC__BYTES_PER_WORD + br->bytes + bytes + (FLAC__BYTES_PER_WORD - 1)) / FLAC__BYTES_PER_WORD;
+ end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD;
# if defined(_MSC_VER) && !defined(_WIN64) && (FLAC__BYTES_PER_WORD == 4)
- if(br->cpu_info.type == FLAC__CPUINFO_TYPE_IA32 && br->cpu_info.data.ia32.bswap)
- {
- start = br->words;
- local_swap32_block_(br->buffer + start, end - start);
- }
- else
+ if(br->cpu_info.type == FLAC__CPUINFO_TYPE_IA32 && br->cpu_info.data.ia32.bswap) {
+ start = br->words;
+ local_swap32_block_(br->buffer + start, end - start);
+ }
+ else
# endif
- for(start = br->words; start < end; start++)
- br->buffer[start] = SWAP_BE_WORD_TO_HOST(br->buffer[start]);
+ for(start = br->words; start < end; start++)
+ br->buffer[start] = SWAP_BE_WORD_TO_HOST(br->buffer[start]);
#endif
- /* now it looks like:
- * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
- * buffer[BE]: 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ??
- * buffer[LE]: 44 33 22 11 88 77 66 55 CC BB AA 99 ?? FF EE DD
- * finally we'll update the reader values:
- */
- end = br->words * FLAC__BYTES_PER_WORD + br->bytes + bytes;
- br->words = end / FLAC__BYTES_PER_WORD;
- br->bytes = end % FLAC__BYTES_PER_WORD;
-
- return true;
+ /* now it looks like:
+ * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
+ * buffer[BE]: 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ??
+ * buffer[LE]: 44 33 22 11 88 77 66 55 CC BB AA 99 ?? FF EE DD
+ * finally we'll update the reader values:
+ */
+ end = br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes;
+ br->words = end / FLAC__BYTES_PER_WORD;
+ br->bytes = end % FLAC__BYTES_PER_WORD;
+
+ return true;
}
/***********************************************************************
@@ -321,26 +302,26 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br)
FLAC__BitReader *FLAC__bitreader_new(void)
{
- FLAC__BitReader *br = (FLAC__BitReader*)calloc(1, sizeof(FLAC__BitReader));
-
- /* calloc() implies:
- memset(br, 0, sizeof(FLAC__BitReader));
- br->buffer = 0;
- br->capacity = 0;
- br->words = br->bytes = 0;
- br->consumed_words = br->consumed_bits = 0;
- br->read_callback = 0;
- br->client_data = 0;
- */
- return br;
+ FLAC__BitReader *br = (FLAC__BitReader*)calloc(1, sizeof(FLAC__BitReader));
+
+ /* calloc() implies:
+ memset(br, 0, sizeof(FLAC__BitReader));
+ br->buffer = 0;
+ br->capacity = 0;
+ br->words = br->bytes = 0;
+ br->consumed_words = br->consumed_bits = 0;
+ br->read_callback = 0;
+ br->client_data = 0;
+ */
+ return br;
}
void FLAC__bitreader_delete(FLAC__BitReader *br)
{
- FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br);
- FLAC__bitreader_free(br);
- free(br);
+ FLAC__bitreader_free(br);
+ free(br);
}
/***********************************************************************
@@ -351,520 +332,481 @@ void FLAC__bitreader_delete(FLAC__BitReader *br)
FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd)
{
- FLAC__ASSERT(0 != br);
-
- br->words = br->bytes = 0;
- br->consumed_words = br->consumed_bits = 0;
- br->capacity = FLAC__BITREADER_DEFAULT_CAPACITY;
- br->buffer = (brword*)malloc(sizeof(brword) * br->capacity);
- if(br->buffer == 0)
- return false;
- br->read_callback = rcb;
- br->client_data = cd;
- br->cpu_info = cpu;
-
- return true;
+ FLAC__ASSERT(0 != br);
+
+ br->words = br->bytes = 0;
+ br->consumed_words = br->consumed_bits = 0;
+ br->capacity = FLAC__BITREADER_DEFAULT_CAPACITY;
+ br->buffer = (brword*)malloc(sizeof(brword) * br->capacity);
+ if(br->buffer == 0)
+ return false;
+ br->read_callback = rcb;
+ br->client_data = cd;
+ br->cpu_info = cpu;
+
+ return true;
}
void FLAC__bitreader_free(FLAC__BitReader *br)
{
- FLAC__ASSERT(0 != br);
-
- if(0 != br->buffer)
- free(br->buffer);
- br->buffer = 0;
- br->capacity = 0;
- br->words = br->bytes = 0;
- br->consumed_words = br->consumed_bits = 0;
- br->read_callback = 0;
- br->client_data = 0;
+ FLAC__ASSERT(0 != br);
+
+ if(0 != br->buffer)
+ free(br->buffer);
+ br->buffer = 0;
+ br->capacity = 0;
+ br->words = br->bytes = 0;
+ br->consumed_words = br->consumed_bits = 0;
+ br->read_callback = 0;
+ br->client_data = 0;
}
FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br)
{
- br->words = br->bytes = 0;
- br->consumed_words = br->consumed_bits = 0;
- return true;
+ br->words = br->bytes = 0;
+ br->consumed_words = br->consumed_bits = 0;
+ return true;
}
void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out)
{
- unsigned i, j;
- if(br == 0)
- {
- fprintf(out, "bitreader is NULL\n");
- }
- else
- {
- fprintf(out, "bitreader: capacity=%u words=%u bytes=%u consumed: words=%u, bits=%u\n", br->capacity, br->words, br->bytes, br->consumed_words, br->consumed_bits);
-
- for(i = 0; i < br->words; i++)
- {
- fprintf(out, "%08X: ", i);
- for(j = 0; j < FLAC__BITS_PER_WORD; j++)
- if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits))
- fprintf(out, ".");
- else
- fprintf(out, "%01u", br->buffer[i] & (1 << (FLAC__BITS_PER_WORD - j - 1)) ? 1 : 0);
- fprintf(out, "\n");
- }
- if(br->bytes > 0)
- {
- fprintf(out, "%08X: ", i);
- for(j = 0; j < br->bytes * 8; j++)
- if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits))
- fprintf(out, ".");
- else
- fprintf(out, "%01u", br->buffer[i] & (1 << (br->bytes * 8 - j - 1)) ? 1 : 0);
- fprintf(out, "\n");
- }
- }
+ unsigned i, j;
+ if(br == 0) {
+ fprintf(out, "bitreader is NULL\n");
+ }
+ else {
+ fprintf(out, "bitreader: capacity=%u words=%u bytes=%u consumed: words=%u, bits=%u\n", br->capacity, br->words, br->bytes, br->consumed_words, br->consumed_bits);
+
+ for(i = 0; i < br->words; i++) {
+ fprintf(out, "%08X: ", i);
+ for(j = 0; j < FLAC__BITS_PER_WORD; j++)
+ if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits))
+ fprintf(out, ".");
+ else
+ fprintf(out, "%01u", br->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0);
+ fprintf(out, "\n");
+ }
+ if(br->bytes > 0) {
+ fprintf(out, "%08X: ", i);
+ for(j = 0; j < br->bytes*8; j++)
+ if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits))
+ fprintf(out, ".");
+ else
+ fprintf(out, "%01u", br->buffer[i] & (1 << (br->bytes*8-j-1)) ? 1:0);
+ fprintf(out, "\n");
+ }
+ }
}
void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed)
{
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- FLAC__ASSERT((br->consumed_bits & 7) == 0);
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ FLAC__ASSERT((br->consumed_bits & 7) == 0);
- br->read_crc16 = (unsigned)seed;
- br->crc16_align = br->consumed_bits;
+ br->read_crc16 = (unsigned)seed;
+ br->crc16_align = br->consumed_bits;
}
FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br)
{
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- FLAC__ASSERT((br->consumed_bits & 7) == 0);
- FLAC__ASSERT(br->crc16_align <= br->consumed_bits);
-
- /* CRC any tail bytes in a partially-consumed word */
- if(br->consumed_bits)
- {
- const brword tail = br->buffer[br->consumed_words];
- for(; br->crc16_align < br->consumed_bits; br->crc16_align += 8)
- br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)((tail >> (FLAC__BITS_PER_WORD - 8 - br->crc16_align)) & 0xff), br->read_crc16);
- }
- return br->read_crc16;
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ FLAC__ASSERT((br->consumed_bits & 7) == 0);
+ FLAC__ASSERT(br->crc16_align <= br->consumed_bits);
+
+ /* CRC any tail bytes in a partially-consumed word */
+ if(br->consumed_bits) {
+ const brword tail = br->buffer[br->consumed_words];
+ for( ; br->crc16_align < br->consumed_bits; br->crc16_align += 8)
+ br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)((tail >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), br->read_crc16);
+ }
+ return br->read_crc16;
}
FLaC__INLINE FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br)
{
- return ((br->consumed_bits & 7) == 0);
+ return ((br->consumed_bits & 7) == 0);
}
FLaC__INLINE unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br)
{
- return 8 - (br->consumed_bits & 7);
+ return 8 - (br->consumed_bits & 7);
}
FLaC__INLINE unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br)
{
- return (br->words - br->consumed_words) * FLAC__BITS_PER_WORD + br->bytes * 8 - br->consumed_bits;
+ return (br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits;
}
FLaC__INLINE FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits)
{
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
-
- FLAC__ASSERT(bits <= 32);
- FLAC__ASSERT((br->capacity * FLAC__BITS_PER_WORD) * 2 >= bits);
- FLAC__ASSERT(br->consumed_words <= br->words);
-
- /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
- FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
-
- if(bits == 0) /* OPT: investigate if this can ever happen, maybe change to assertion */
- {
- *val = 0;
- return true;
- }
-
- while((br->words - br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes * 8 - br->consumed_bits < bits)
- {
- if(!bitreader_read_from_client_(br))
- return false;
- }
- if(br->consumed_words < br->words) /* if we've not consumed up to a partial tail word... */
- {
- /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */
- if(br->consumed_bits)
- {
- /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
- const unsigned n = FLAC__BITS_PER_WORD - br->consumed_bits;
- const brword word = br->buffer[br->consumed_words];
- if(bits < n)
- {
- *val = (word & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (n - bits);
- br->consumed_bits += bits;
- return true;
- }
- *val = word & (FLAC__WORD_ALL_ONES >> br->consumed_bits);
- bits -= n;
- crc16_update_word_(br, word);
- br->consumed_words++;
- br->consumed_bits = 0;
- if(bits) /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
- {
- *val <<= bits;
- *val |= (br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD - bits));
- br->consumed_bits = bits;
- }
- return true;
- }
- else
- {
- const brword word = br->buffer[br->consumed_words];
- if(bits < FLAC__BITS_PER_WORD)
- {
- *val = word >> (FLAC__BITS_PER_WORD - bits);
- br->consumed_bits = bits;
- return true;
- }
- /* at this point 'bits' must be == FLAC__BITS_PER_WORD; because of previous assertions, it can't be larger */
- *val = word;
- crc16_update_word_(br, word);
- br->consumed_words++;
- return true;
- }
- }
- else
- {
- /* in this case we're starting our read at a partial tail word;
- * the reader has guaranteed that we have at least 'bits' bits
- * available to read, which makes this case simpler.
- */
- /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */
- if(br->consumed_bits)
- {
- /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
- FLAC__ASSERT(br->consumed_bits + bits <= br->bytes * 8);
- *val = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (FLAC__BITS_PER_WORD - br->consumed_bits - bits);
- br->consumed_bits += bits;
- return true;
- }
- else
- {
- *val = br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD - bits);
- br->consumed_bits += bits;
- return true;
- }
- }
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ FLAC__ASSERT(bits <= 32);
+ FLAC__ASSERT((br->capacity*FLAC__BITS_PER_WORD) * 2 >= bits);
+ FLAC__ASSERT(br->consumed_words <= br->words);
+
+ /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
+ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
+
+ if(bits == 0) { /* OPT: investigate if this can ever happen, maybe change to assertion */
+ *val = 0;
+ return true;
+ }
+
+ while((br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits < bits) {
+ if(!bitreader_read_from_client_(br))
+ return false;
+ }
+ if(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */
+ /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */
+ if(br->consumed_bits) {
+ /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
+ const unsigned n = FLAC__BITS_PER_WORD - br->consumed_bits;
+ const brword word = br->buffer[br->consumed_words];
+ if(bits < n) {
+ *val = (word & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (n-bits);
+ br->consumed_bits += bits;
+ return true;
+ }
+ *val = word & (FLAC__WORD_ALL_ONES >> br->consumed_bits);
+ bits -= n;
+ crc16_update_word_(br, word);
+ br->consumed_words++;
+ br->consumed_bits = 0;
+ if(bits) { /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
+ *val <<= bits;
+ *val |= (br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits));
+ br->consumed_bits = bits;
+ }
+ return true;
+ }
+ else {
+ const brword word = br->buffer[br->consumed_words];
+ if(bits < FLAC__BITS_PER_WORD) {
+ *val = word >> (FLAC__BITS_PER_WORD-bits);
+ br->consumed_bits = bits;
+ return true;
+ }
+ /* at this point 'bits' must be == FLAC__BITS_PER_WORD; because of previous assertions, it can't be larger */
+ *val = word;
+ crc16_update_word_(br, word);
+ br->consumed_words++;
+ return true;
+ }
+ }
+ else {
+ /* in this case we're starting our read at a partial tail word;
+ * the reader has guaranteed that we have at least 'bits' bits
+ * available to read, which makes this case simpler.
+ */
+ /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */
+ if(br->consumed_bits) {
+ /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
+ FLAC__ASSERT(br->consumed_bits + bits <= br->bytes*8);
+ *val = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (FLAC__BITS_PER_WORD-br->consumed_bits-bits);
+ br->consumed_bits += bits;
+ return true;
+ }
+ else {
+ *val = br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits);
+ br->consumed_bits += bits;
+ return true;
+ }
+ }
}
FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits)
{
- /* OPT: inline raw uint32 code here, or make into a macro if possible in the .h file */
- if(!FLAC__bitreader_read_raw_uint32(br, (FLAC__uint32*)val, bits))
- return false;
- /* sign-extend: */
- *val <<= (32 - bits);
- *val >>= (32 - bits);
- return true;
+ /* OPT: inline raw uint32 code here, or make into a macro if possible in the .h file */
+ if(!FLAC__bitreader_read_raw_uint32(br, (FLAC__uint32*)val, bits))
+ return false;
+ /* sign-extend: */
+ *val <<= (32-bits);
+ *val >>= (32-bits);
+ return true;
}
FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits)
{
- FLAC__uint32 hi, lo;
-
- if(bits > 32)
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &hi, bits - 32))
- return false;
- if(!FLAC__bitreader_read_raw_uint32(br, &lo, 32))
- return false;
- *val = hi;
- *val <<= 32;
- *val |= lo;
- }
- else
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &lo, bits))
- return false;
- *val = lo;
- }
- return true;
+ FLAC__uint32 hi, lo;
+
+ if(bits > 32) {
+ if(!FLAC__bitreader_read_raw_uint32(br, &hi, bits-32))
+ return false;
+ if(!FLAC__bitreader_read_raw_uint32(br, &lo, 32))
+ return false;
+ *val = hi;
+ *val <<= 32;
+ *val |= lo;
+ }
+ else {
+ if(!FLAC__bitreader_read_raw_uint32(br, &lo, bits))
+ return false;
+ *val = lo;
+ }
+ return true;
}
FLaC__INLINE FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val)
{
- FLAC__uint32 x8, x32 = 0;
+ FLAC__uint32 x8, x32 = 0;
- /* this doesn't need to be that fast as currently it is only used for vorbis comments */
+ /* this doesn't need to be that fast as currently it is only used for vorbis comments */
- if(!FLAC__bitreader_read_raw_uint32(br, &x32, 8))
- return false;
+ if(!FLAC__bitreader_read_raw_uint32(br, &x32, 8))
+ return false;
- if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8))
- return false;
- x32 |= (x8 << 8);
+ if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8))
+ return false;
+ x32 |= (x8 << 8);
- if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8))
- return false;
- x32 |= (x8 << 16);
+ if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8))
+ return false;
+ x32 |= (x8 << 16);
- if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8))
- return false;
- x32 |= (x8 << 24);
+ if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8))
+ return false;
+ x32 |= (x8 << 24);
- *val = x32;
- return true;
+ *val = x32;
+ return true;
}
FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits)
{
- /*
- * OPT: a faster implementation is possible but probably not that useful
- * since this is only called a couple of times in the metadata readers.
- */
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
-
- if(bits > 0)
- {
- const unsigned n = br->consumed_bits & 7;
- unsigned m;
- FLAC__uint32 x;
-
- if(n != 0)
- {
- m = min(8 - n, bits);
- if(!FLAC__bitreader_read_raw_uint32(br, &x, m))
- return false;
- bits -= m;
- }
- m = bits / 8;
- if(m > 0)
- {
- if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(br, m))
- return false;
- bits %= 8;
- }
- if(bits > 0)
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, bits))
- return false;
- }
- }
-
- return true;
+ /*
+ * OPT: a faster implementation is possible but probably not that useful
+ * since this is only called a couple of times in the metadata readers.
+ */
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ if(bits > 0) {
+ const unsigned n = br->consumed_bits & 7;
+ unsigned m;
+ FLAC__uint32 x;
+
+ if(n != 0) {
+ m = min(8-n, bits);
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, m))
+ return false;
+ bits -= m;
+ }
+ m = bits / 8;
+ if(m > 0) {
+ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(br, m))
+ return false;
+ bits %= 8;
+ }
+ if(bits > 0) {
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, bits))
+ return false;
+ }
+ }
+
+ return true;
}
FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals)
{
- FLAC__uint32 x;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br));
-
- /* step 1: skip over partial head word to get word aligned */
- while(nvals && br->consumed_bits) /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- nvals--;
- }
- if(0 == nvals)
- return true;
- /* step 2: skip whole words in chunks */
- while(nvals >= FLAC__BYTES_PER_WORD)
- {
- if(br->consumed_words < br->words)
- {
- br->consumed_words++;
- nvals -= FLAC__BYTES_PER_WORD;
- }
- else if(!bitreader_read_from_client_(br))
- return false;
- }
- /* step 3: skip any remainder from partial tail bytes */
- while(nvals)
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- nvals--;
- }
-
- return true;
+ FLAC__uint32 x;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br));
+
+ /* step 1: skip over partial head word to get word aligned */
+ while(nvals && br->consumed_bits) { /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ nvals--;
+ }
+ if(0 == nvals)
+ return true;
+ /* step 2: skip whole words in chunks */
+ while(nvals >= FLAC__BYTES_PER_WORD) {
+ if(br->consumed_words < br->words) {
+ br->consumed_words++;
+ nvals -= FLAC__BYTES_PER_WORD;
+ }
+ else if(!bitreader_read_from_client_(br))
+ return false;
+ }
+ /* step 3: skip any remainder from partial tail bytes */
+ while(nvals) {
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ nvals--;
+ }
+
+ return true;
}
FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals)
{
- FLAC__uint32 x;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br));
-
- /* step 1: read from partial head word to get word aligned */
- while(nvals && br->consumed_bits) /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- *val++ = (FLAC__byte)x;
- nvals--;
- }
- if(0 == nvals)
- return true;
- /* step 2: read whole words in chunks */
- while(nvals >= FLAC__BYTES_PER_WORD)
- {
- if(br->consumed_words < br->words)
- {
- const brword word = br->buffer[br->consumed_words++];
+ FLAC__uint32 x;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br));
+
+ /* step 1: read from partial head word to get word aligned */
+ while(nvals && br->consumed_bits) { /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ *val++ = (FLAC__byte)x;
+ nvals--;
+ }
+ if(0 == nvals)
+ return true;
+ /* step 2: read whole words in chunks */
+ while(nvals >= FLAC__BYTES_PER_WORD) {
+ if(br->consumed_words < br->words) {
+ const brword word = br->buffer[br->consumed_words++];
#if FLAC__BYTES_PER_WORD == 4
- val[0] = (FLAC__byte)(word >> 24);
- val[1] = (FLAC__byte)(word >> 16);
- val[2] = (FLAC__byte)(word >> 8);
- val[3] = (FLAC__byte)word;
+ val[0] = (FLAC__byte)(word >> 24);
+ val[1] = (FLAC__byte)(word >> 16);
+ val[2] = (FLAC__byte)(word >> 8);
+ val[3] = (FLAC__byte)word;
#elif FLAC__BYTES_PER_WORD == 8
- val[0] = (FLAC__byte)(word >> 56);
- val[1] = (FLAC__byte)(word >> 48);
- val[2] = (FLAC__byte)(word >> 40);
- val[3] = (FLAC__byte)(word >> 32);
- val[4] = (FLAC__byte)(word >> 24);
- val[5] = (FLAC__byte)(word >> 16);
- val[6] = (FLAC__byte)(word >> 8);
- val[7] = (FLAC__byte)word;
+ val[0] = (FLAC__byte)(word >> 56);
+ val[1] = (FLAC__byte)(word >> 48);
+ val[2] = (FLAC__byte)(word >> 40);
+ val[3] = (FLAC__byte)(word >> 32);
+ val[4] = (FLAC__byte)(word >> 24);
+ val[5] = (FLAC__byte)(word >> 16);
+ val[6] = (FLAC__byte)(word >> 8);
+ val[7] = (FLAC__byte)word;
#else
- for(x = 0; x < FLAC__BYTES_PER_WORD; x++)
- val[x] = (FLAC__byte)(word >> (8 * (FLAC__BYTES_PER_WORD - x - 1)));
+ for(x = 0; x < FLAC__BYTES_PER_WORD; x++)
+ val[x] = (FLAC__byte)(word >> (8*(FLAC__BYTES_PER_WORD-x-1)));
#endif
- val += FLAC__BYTES_PER_WORD;
- nvals -= FLAC__BYTES_PER_WORD;
- }
- else if(!bitreader_read_from_client_(br))
- return false;
- }
- /* step 3: read any remainder from partial tail bytes */
- while(nvals)
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- *val++ = (FLAC__byte)x;
- nvals--;
- }
-
- return true;
+ val += FLAC__BYTES_PER_WORD;
+ nvals -= FLAC__BYTES_PER_WORD;
+ }
+ else if(!bitreader_read_from_client_(br))
+ return false;
+ }
+ /* step 3: read any remainder from partial tail bytes */
+ while(nvals) {
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ *val++ = (FLAC__byte)x;
+ nvals--;
+ }
+
+ return true;
}
FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val)
#if 0 /* slow but readable version */
{
- unsigned bit;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
-
- *val = 0;
- while(1)
- {
- if(!FLAC__bitreader_read_bit(br, &bit))
- return false;
- if(bit)
- break;
- else
- *val++;
- }
- return true;
+ unsigned bit;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ *val = 0;
+ while(1) {
+ if(!FLAC__bitreader_read_bit(br, &bit))
+ return false;
+ if(bit)
+ break;
+ else
+ *val++;
+ }
+ return true;
}
#else
{
- unsigned i;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
-
- *val = 0;
- while(1)
- {
- while(br->consumed_words < br->words) /* if we've not consumed up to a partial tail word... */
- {
- brword b = br->buffer[br->consumed_words] << br->consumed_bits;
- if(b)
- {
- i = COUNT_ZERO_MSBS(b);
- *val += i;
- i++;
- br->consumed_bits += i;
- if(br->consumed_bits >= FLAC__BITS_PER_WORD) /* faster way of testing if(br->consumed_bits == FLAC__BITS_PER_WORD) */
- {
- crc16_update_word_(br, br->buffer[br->consumed_words]);
- br->consumed_words++;
- br->consumed_bits = 0;
- }
- return true;
- }
- else
- {
- *val += FLAC__BITS_PER_WORD - br->consumed_bits;
- crc16_update_word_(br, br->buffer[br->consumed_words]);
- br->consumed_words++;
- br->consumed_bits = 0;
- /* didn't find stop bit yet, have to keep going... */
- }
- }
- /* at this point we've eaten up all the whole words; have to try
- * reading through any tail bytes before calling the read callback.
- * this is a repeat of the above logic adjusted for the fact we
- * don't have a whole word. note though if the client is feeding
- * us data a byte at a time (unlikely), br->consumed_bits may not
- * be zero.
- */
- if(br->bytes * 8 > br->consumed_bits)
- {
- const unsigned end = br->bytes * 8;
- brword b = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD - end))) << br->consumed_bits;
- if(b)
- {
- i = COUNT_ZERO_MSBS(b);
- *val += i;
- i++;
- br->consumed_bits += i;
- FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD);
- return true;
- }
- else
- {
- *val += end - br->consumed_bits;
- br->consumed_bits = end;
- FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD);
- /* didn't find stop bit yet, have to keep going... */
- }
- }
- if(!bitreader_read_from_client_(br))
- return false;
- }
+ unsigned i;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ *val = 0;
+ while(1) {
+ while(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */
+ brword b = br->buffer[br->consumed_words] << br->consumed_bits;
+ if(b) {
+ i = COUNT_ZERO_MSBS(b);
+ *val += i;
+ i++;
+ br->consumed_bits += i;
+ if(br->consumed_bits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(br->consumed_bits == FLAC__BITS_PER_WORD) */
+ crc16_update_word_(br, br->buffer[br->consumed_words]);
+ br->consumed_words++;
+ br->consumed_bits = 0;
+ }
+ return true;
+ }
+ else {
+ *val += FLAC__BITS_PER_WORD - br->consumed_bits;
+ crc16_update_word_(br, br->buffer[br->consumed_words]);
+ br->consumed_words++;
+ br->consumed_bits = 0;
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ /* at this point we've eaten up all the whole words; have to try
+ * reading through any tail bytes before calling the read callback.
+ * this is a repeat of the above logic adjusted for the fact we
+ * don't have a whole word. note though if the client is feeding
+ * us data a byte at a time (unlikely), br->consumed_bits may not
+ * be zero.
+ */
+ if(br->bytes*8 > br->consumed_bits) {
+ const unsigned end = br->bytes * 8;
+ brword b = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << br->consumed_bits;
+ if(b) {
+ i = COUNT_ZERO_MSBS(b);
+ *val += i;
+ i++;
+ br->consumed_bits += i;
+ FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD);
+ return true;
+ }
+ else {
+ *val += end - br->consumed_bits;
+ br->consumed_bits = end;
+ FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD);
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ if(!bitreader_read_from_client_(br))
+ return false;
+ }
}
#endif
FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter)
{
- FLAC__uint32 lsbs = 0, msbs = 0;
- unsigned uval;
+ FLAC__uint32 lsbs = 0, msbs = 0;
+ unsigned uval;
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- FLAC__ASSERT(parameter <= 31);
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ FLAC__ASSERT(parameter <= 31);
- /* read the unary MSBs and end bit */
- if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
- return false;
+ /* read the unary MSBs and end bit */
+ if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
+ return false;
- /* read the binary LSBs */
- if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter))
- return false;
+ /* read the binary LSBs */
+ if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter))
+ return false;
- /* compose the value */
- uval = (msbs << parameter) | lsbs;
- if(uval & 1)
- *val = -((int)(uval >> 1)) - 1;
- else
- *val = (int)(uval >> 1);
+ /* compose the value */
+ uval = (msbs << parameter) | lsbs;
+ if(uval & 1)
+ *val = -((int)(uval >> 1)) - 1;
+ else
+ *val = (int)(uval >> 1);
- return true;
+ return true;
}
/* this is by far the most heavily used reader call. it ain't pretty but it's fast */
@@ -873,636 +815,569 @@ FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[
/* OPT: possibly faster version for use with MSVC */
#ifdef _MSC_VER
{
- unsigned i;
- unsigned uval = 0;
- unsigned bits; /* the # of binary LSBs left to read to finish a rice codeword */
-
- /* try and get br->consumed_words and br->consumed_bits into register;
- * must remember to flush them back to *br before calling other
- * bitwriter functions that use them, and before returning */
- register unsigned cwords;
- register unsigned cbits;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
- FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
- FLAC__ASSERT(parameter < 32);
- /* the above two asserts also guarantee that the binary part never straddles more that 2 words, so we don't have to loop to read it */
-
- if(nvals == 0)
- return true;
-
- cbits = br->consumed_bits;
- cwords = br->consumed_words;
-
- while(1)
- {
-
- /* read unary part */
- while(1)
- {
- while(cwords < br->words) /* if we've not consumed up to a partial tail word... */
- {
- brword b = br->buffer[cwords] << cbits;
- if(b)
- {
+ unsigned i;
+ unsigned uval = 0;
+ unsigned bits; /* the # of binary LSBs left to read to finish a rice codeword */
+
+ /* try and get br->consumed_words and br->consumed_bits into register;
+ * must remember to flush them back to *br before calling other
+ * bitwriter functions that use them, and before returning */
+ register unsigned cwords;
+ register unsigned cbits;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
+ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
+ FLAC__ASSERT(parameter < 32);
+ /* the above two asserts also guarantee that the binary part never straddles more that 2 words, so we don't have to loop to read it */
+
+ if(nvals == 0)
+ return true;
+
+ cbits = br->consumed_bits;
+ cwords = br->consumed_words;
+
+ while(1) {
+
+ /* read unary part */
+ while(1) {
+ while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */
+ brword b = br->buffer[cwords] << cbits;
+ if(b) {
#if 0 /* slower, probably due to bad register allocation... */ && defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && FLAC__BITS_PER_WORD == 32
- __asm
- {
- bsr eax, b
- not eax
- and eax, 31
- mov i, eax
- }
+ __asm {
+ bsr eax, b
+ not eax
+ and eax, 31
+ mov i, eax
+ }
#else
- i = COUNT_ZERO_MSBS(b);
+ i = COUNT_ZERO_MSBS(b);
#endif
- uval += i;
- bits = parameter;
- i++;
- cbits += i;
- if(cbits == FLAC__BITS_PER_WORD)
- {
- crc16_update_word_(br, br->buffer[cwords]);
- cwords++;
- cbits = 0;
- }
- goto break1;
- }
- else
- {
- uval += FLAC__BITS_PER_WORD - cbits;
- crc16_update_word_(br, br->buffer[cwords]);
- cwords++;
- cbits = 0;
- /* didn't find stop bit yet, have to keep going... */
- }
- }
- /* at this point we've eaten up all the whole words; have to try
- * reading through any tail bytes before calling the read callback.
- * this is a repeat of the above logic adjusted for the fact we
- * don't have a whole word. note though if the client is feeding
- * us data a byte at a time (unlikely), br->consumed_bits may not
- * be zero.
- */
- if(br->bytes * 8 > cbits)
- {
- const unsigned end = br->bytes * 8;
- brword b = (br->buffer[cwords] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD - end))) << cbits;
- if(b)
- {
- i = COUNT_ZERO_MSBS(b);
- uval += i;
- bits = parameter;
- i++;
- cbits += i;
- FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
- goto break1;
- }
- else
- {
- uval += end - cbits;
- cbits = end;
- FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
- /* didn't find stop bit yet, have to keep going... */
- }
- }
- /* flush registers and read; bitreader_read_from_client_() does
- * not touch br->consumed_bits at all but we still need to set
- * it in case it fails and we have to return false.
- */
- br->consumed_bits = cbits;
- br->consumed_words = cwords;
- if(!bitreader_read_from_client_(br))
- return false;
- cwords = br->consumed_words;
- }
- break1:
- /* read binary part */
- FLAC__ASSERT(cwords <= br->words);
-
- if(bits)
- {
- while((br->words - cwords)*FLAC__BITS_PER_WORD + br->bytes * 8 - cbits < bits)
- {
- /* flush registers and read; bitreader_read_from_client_() does
- * not touch br->consumed_bits at all but we still need to set
- * it in case it fails and we have to return false.
- */
- br->consumed_bits = cbits;
- br->consumed_words = cwords;
- if(!bitreader_read_from_client_(br))
- return false;
- cwords = br->consumed_words;
- }
- if(cwords < br->words) /* if we've not consumed up to a partial tail word... */
- {
- if(cbits)
- {
- /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
- const unsigned n = FLAC__BITS_PER_WORD - cbits;
- const brword word = br->buffer[cwords];
- if(bits < n)
- {
- uval <<= bits;
- uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n - bits);
- cbits += bits;
- goto break2;
- }
- uval <<= n;
- uval |= word & (FLAC__WORD_ALL_ONES >> cbits);
- bits -= n;
- crc16_update_word_(br, word);
- cwords++;
- cbits = 0;
- if(bits) /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
- {
- uval <<= bits;
- uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD - bits));
- cbits = bits;
- }
- goto break2;
- }
- else
- {
- FLAC__ASSERT(bits < FLAC__BITS_PER_WORD);
- uval <<= bits;
- uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD - bits);
- cbits = bits;
- goto break2;
- }
- }
- else
- {
- /* in this case we're starting our read at a partial tail word;
- * the reader has guaranteed that we have at least 'bits' bits
- * available to read, which makes this case simpler.
- */
- uval <<= bits;
- if(cbits)
- {
- /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
- FLAC__ASSERT(cbits + bits <= br->bytes * 8);
- uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD - cbits - bits);
- cbits += bits;
- goto break2;
- }
- else
- {
- uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD - bits);
- cbits += bits;
- goto break2;
- }
- }
- }
- break2:
- /* compose the value */
- *vals = (int)(uval >> 1 ^ -(int)(uval & 1));
-
- /* are we done? */
- --nvals;
- if(nvals == 0)
- {
- br->consumed_bits = cbits;
- br->consumed_words = cwords;
- return true;
- }
-
- uval = 0;
- ++vals;
-
- }
+ uval += i;
+ bits = parameter;
+ i++;
+ cbits += i;
+ if(cbits == FLAC__BITS_PER_WORD) {
+ crc16_update_word_(br, br->buffer[cwords]);
+ cwords++;
+ cbits = 0;
+ }
+ goto break1;
+ }
+ else {
+ uval += FLAC__BITS_PER_WORD - cbits;
+ crc16_update_word_(br, br->buffer[cwords]);
+ cwords++;
+ cbits = 0;
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ /* at this point we've eaten up all the whole words; have to try
+ * reading through any tail bytes before calling the read callback.
+ * this is a repeat of the above logic adjusted for the fact we
+ * don't have a whole word. note though if the client is feeding
+ * us data a byte at a time (unlikely), br->consumed_bits may not
+ * be zero.
+ */
+ if(br->bytes*8 > cbits) {
+ const unsigned end = br->bytes * 8;
+ brword b = (br->buffer[cwords] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << cbits;
+ if(b) {
+ i = COUNT_ZERO_MSBS(b);
+ uval += i;
+ bits = parameter;
+ i++;
+ cbits += i;
+ FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
+ goto break1;
+ }
+ else {
+ uval += end - cbits;
+ cbits = end;
+ FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ /* flush registers and read; bitreader_read_from_client_() does
+ * not touch br->consumed_bits at all but we still need to set
+ * it in case it fails and we have to return false.
+ */
+ br->consumed_bits = cbits;
+ br->consumed_words = cwords;
+ if(!bitreader_read_from_client_(br))
+ return false;
+ cwords = br->consumed_words;
+ }
+break1:
+ /* read binary part */
+ FLAC__ASSERT(cwords <= br->words);
+
+ if(bits) {
+ while((br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits < bits) {
+ /* flush registers and read; bitreader_read_from_client_() does
+ * not touch br->consumed_bits at all but we still need to set
+ * it in case it fails and we have to return false.
+ */
+ br->consumed_bits = cbits;
+ br->consumed_words = cwords;
+ if(!bitreader_read_from_client_(br))
+ return false;
+ cwords = br->consumed_words;
+ }
+ if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */
+ if(cbits) {
+ /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
+ const unsigned n = FLAC__BITS_PER_WORD - cbits;
+ const brword word = br->buffer[cwords];
+ if(bits < n) {
+ uval <<= bits;
+ uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-bits);
+ cbits += bits;
+ goto break2;
+ }
+ uval <<= n;
+ uval |= word & (FLAC__WORD_ALL_ONES >> cbits);
+ bits -= n;
+ crc16_update_word_(br, word);
+ cwords++;
+ cbits = 0;
+ if(bits) { /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
+ uval <<= bits;
+ uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits));
+ cbits = bits;
+ }
+ goto break2;
+ }
+ else {
+ FLAC__ASSERT(bits < FLAC__BITS_PER_WORD);
+ uval <<= bits;
+ uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits);
+ cbits = bits;
+ goto break2;
+ }
+ }
+ else {
+ /* in this case we're starting our read at a partial tail word;
+ * the reader has guaranteed that we have at least 'bits' bits
+ * available to read, which makes this case simpler.
+ */
+ uval <<= bits;
+ if(cbits) {
+ /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
+ FLAC__ASSERT(cbits + bits <= br->bytes*8);
+ uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-bits);
+ cbits += bits;
+ goto break2;
+ }
+ else {
+ uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits);
+ cbits += bits;
+ goto break2;
+ }
+ }
+ }
+break2:
+ /* compose the value */
+ *vals = (int)(uval >> 1 ^ -(int)(uval & 1));
+
+ /* are we done? */
+ --nvals;
+ if(nvals == 0) {
+ br->consumed_bits = cbits;
+ br->consumed_words = cwords;
+ return true;
+ }
+
+ uval = 0;
+ ++vals;
+
+ }
}
#else
{
- unsigned i;
- unsigned uval = 0;
-
- /* try and get br->consumed_words and br->consumed_bits into register;
- * must remember to flush them back to *br before calling other
- * bitwriter functions that use them, and before returning */
- register unsigned cwords;
- register unsigned cbits;
- unsigned ucbits; /* keep track of the number of unconsumed bits in the buffer */
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
- /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
- FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
- FLAC__ASSERT(parameter < 32);
- /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
-
- if(nvals == 0)
- return true;
-
- cbits = br->consumed_bits;
- cwords = br->consumed_words;
- ucbits = (br->words - cwords) * FLAC__BITS_PER_WORD + br->bytes * 8 - cbits;
-
- while(1)
- {
-
- /* read unary part */
- while(1)
- {
- while(cwords < br->words) /* if we've not consumed up to a partial tail word... */
- {
- brword b = br->buffer[cwords] << cbits;
- if(b)
- {
+ unsigned i;
+ unsigned uval = 0;
+
+ /* try and get br->consumed_words and br->consumed_bits into register;
+ * must remember to flush them back to *br before calling other
+ * bitwriter functions that use them, and before returning */
+ register unsigned cwords;
+ register unsigned cbits;
+ unsigned ucbits; /* keep track of the number of unconsumed bits in the buffer */
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
+ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
+ FLAC__ASSERT(parameter < 32);
+ /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
+
+ if(nvals == 0)
+ return true;
+
+ cbits = br->consumed_bits;
+ cwords = br->consumed_words;
+ ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits;
+
+ while(1) {
+
+ /* read unary part */
+ while(1) {
+ while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */
+ brword b = br->buffer[cwords] << cbits;
+ if(b) {
#if 0 /* is not discernably faster... */ && defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && FLAC__BITS_PER_WORD == 32 && defined __GNUC__
- asm volatile(
- "bsrl %1, %0;"
- "notl %0;"
- "andl $31, %0;"
- : "=r"(i)
- : "r"(b)
- );
+ asm volatile (
+ "bsrl %1, %0;"
+ "notl %0;"
+ "andl $31, %0;"
+ : "=r"(i)
+ : "r"(b)
+ );
#else
-i = COUNT_ZERO_MSBS(b);
+ i = COUNT_ZERO_MSBS(b);
#endif
- uval += i;
- cbits += i;
- cbits++; /* skip over stop bit */
- if(cbits >= FLAC__BITS_PER_WORD) /* faster way of testing if(cbits == FLAC__BITS_PER_WORD) */
- {
- crc16_update_word_(br, br->buffer[cwords]);
- cwords++;
- cbits = 0;
- }
- goto break1;
- }
- else
- {
- uval += FLAC__BITS_PER_WORD - cbits;
- crc16_update_word_(br, br->buffer[cwords]);
- cwords++;
- cbits = 0;
- /* didn't find stop bit yet, have to keep going... */
- }
- }
- /* at this point we've eaten up all the whole words; have to try
- * reading through any tail bytes before calling the read callback.
- * this is a repeat of the above logic adjusted for the fact we
- * don't have a whole word. note though if the client is feeding
- * us data a byte at a time (unlikely), br->consumed_bits may not
- * be zero.
- */
- if(br->bytes * 8 > cbits)
- {
- const unsigned end = br->bytes * 8;
- brword b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)) << cbits;
- if(b)
- {
- i = COUNT_ZERO_MSBS(b);
- uval += i;
- cbits += i;
- cbits++; /* skip over stop bit */
- FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
- goto break1;
- }
- else
- {
- uval += end - cbits;
- cbits = end;
- FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
- /* didn't find stop bit yet, have to keep going... */
- }
- }
- /* flush registers and read; bitreader_read_from_client_() does
- * not touch br->consumed_bits at all but we still need to set
- * it in case it fails and we have to return false.
- */
- br->consumed_bits = cbits;
- br->consumed_words = cwords;
- if(!bitreader_read_from_client_(br))
- return false;
- cwords = br->consumed_words;
- ucbits = (br->words - cwords) * FLAC__BITS_PER_WORD + br->bytes * 8 - cbits + uval;
- /* + uval to offset our count by the # of unary bits already
- * consumed before the read, because we will add these back
- * in all at once at break1
- */
- }
+ uval += i;
+ cbits += i;
+ cbits++; /* skip over stop bit */
+ if(cbits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(cbits == FLAC__BITS_PER_WORD) */
+ crc16_update_word_(br, br->buffer[cwords]);
+ cwords++;
+ cbits = 0;
+ }
+ goto break1;
+ }
+ else {
+ uval += FLAC__BITS_PER_WORD - cbits;
+ crc16_update_word_(br, br->buffer[cwords]);
+ cwords++;
+ cbits = 0;
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ /* at this point we've eaten up all the whole words; have to try
+ * reading through any tail bytes before calling the read callback.
+ * this is a repeat of the above logic adjusted for the fact we
+ * don't have a whole word. note though if the client is feeding
+ * us data a byte at a time (unlikely), br->consumed_bits may not
+ * be zero.
+ */
+ if(br->bytes*8 > cbits) {
+ const unsigned end = br->bytes * 8;
+ brword b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)) << cbits;
+ if(b) {
+ i = COUNT_ZERO_MSBS(b);
+ uval += i;
+ cbits += i;
+ cbits++; /* skip over stop bit */
+ FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
+ goto break1;
+ }
+ else {
+ uval += end - cbits;
+ cbits = end;
+ FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD);
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ /* flush registers and read; bitreader_read_from_client_() does
+ * not touch br->consumed_bits at all but we still need to set
+ * it in case it fails and we have to return false.
+ */
+ br->consumed_bits = cbits;
+ br->consumed_words = cwords;
+ if(!bitreader_read_from_client_(br))
+ return false;
+ cwords = br->consumed_words;
+ ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits + uval;
+ /* + uval to offset our count by the # of unary bits already
+ * consumed before the read, because we will add these back
+ * in all at once at break1
+ */
+ }
break1:
- ucbits -= uval;
- ucbits--; /* account for stop bit */
-
- /* read binary part */
- FLAC__ASSERT(cwords <= br->words);
-
- if(parameter)
- {
- while(ucbits < parameter)
- {
- /* flush registers and read; bitreader_read_from_client_() does
- * not touch br->consumed_bits at all but we still need to set
- * it in case it fails and we have to return false.
- */
- br->consumed_bits = cbits;
- br->consumed_words = cwords;
- if(!bitreader_read_from_client_(br))
- return false;
- cwords = br->consumed_words;
- ucbits = (br->words - cwords) * FLAC__BITS_PER_WORD + br->bytes * 8 - cbits;
- }
- if(cwords < br->words) /* if we've not consumed up to a partial tail word... */
- {
- if(cbits)
- {
- /* this also works when consumed_bits==0, it's just slower than necessary for that case */
- const unsigned n = FLAC__BITS_PER_WORD - cbits;
- const brword word = br->buffer[cwords];
- if(parameter < n)
- {
- uval <<= parameter;
- uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n - parameter);
- cbits += parameter;
- }
- else
- {
- uval <<= n;
- uval |= word & (FLAC__WORD_ALL_ONES >> cbits);
- crc16_update_word_(br, word);
- cwords++;
- cbits = parameter - n;
- if(cbits) /* parameter > n, i.e. if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
- {
- uval <<= cbits;
- uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD - cbits));
- }
- }
- }
- else
- {
- cbits = parameter;
- uval <<= parameter;
- uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD - cbits);
- }
- }
- else
- {
- /* in this case we're starting our read at a partial tail word;
- * the reader has guaranteed that we have at least 'parameter'
- * bits available to read, which makes this case simpler.
- */
- uval <<= parameter;
- if(cbits)
- {
- /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
- FLAC__ASSERT(cbits + parameter <= br->bytes * 8);
- uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD - cbits - parameter);
- cbits += parameter;
- }
- else
- {
- cbits = parameter;
- uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD - cbits);
- }
- }
- }
-
- ucbits -= parameter;
-
- /* compose the value */
- *vals = (int)(uval >> 1 ^ -(int)(uval & 1));
-
- /* are we done? */
- --nvals;
- if(nvals == 0)
- {
- br->consumed_bits = cbits;
- br->consumed_words = cwords;
- return true;
- }
-
- uval = 0;
- ++vals;
-
- }
+ ucbits -= uval;
+ ucbits--; /* account for stop bit */
+
+ /* read binary part */
+ FLAC__ASSERT(cwords <= br->words);
+
+ if(parameter) {
+ while(ucbits < parameter) {
+ /* flush registers and read; bitreader_read_from_client_() does
+ * not touch br->consumed_bits at all but we still need to set
+ * it in case it fails and we have to return false.
+ */
+ br->consumed_bits = cbits;
+ br->consumed_words = cwords;
+ if(!bitreader_read_from_client_(br))
+ return false;
+ cwords = br->consumed_words;
+ ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits;
+ }
+ if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */
+ if(cbits) {
+ /* this also works when consumed_bits==0, it's just slower than necessary for that case */
+ const unsigned n = FLAC__BITS_PER_WORD - cbits;
+ const brword word = br->buffer[cwords];
+ if(parameter < n) {
+ uval <<= parameter;
+ uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-parameter);
+ cbits += parameter;
+ }
+ else {
+ uval <<= n;
+ uval |= word & (FLAC__WORD_ALL_ONES >> cbits);
+ crc16_update_word_(br, word);
+ cwords++;
+ cbits = parameter - n;
+ if(cbits) { /* parameter > n, i.e. if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
+ uval <<= cbits;
+ uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits));
+ }
+ }
+ }
+ else {
+ cbits = parameter;
+ uval <<= parameter;
+ uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits);
+ }
+ }
+ else {
+ /* in this case we're starting our read at a partial tail word;
+ * the reader has guaranteed that we have at least 'parameter'
+ * bits available to read, which makes this case simpler.
+ */
+ uval <<= parameter;
+ if(cbits) {
+ /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
+ FLAC__ASSERT(cbits + parameter <= br->bytes*8);
+ uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-parameter);
+ cbits += parameter;
+ }
+ else {
+ cbits = parameter;
+ uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits);
+ }
+ }
+ }
+
+ ucbits -= parameter;
+
+ /* compose the value */
+ *vals = (int)(uval >> 1 ^ -(int)(uval & 1));
+
+ /* are we done? */
+ --nvals;
+ if(nvals == 0) {
+ br->consumed_bits = cbits;
+ br->consumed_words = cwords;
+ return true;
+ }
+
+ uval = 0;
+ ++vals;
+
+ }
}
#endif
#if 0 /* UNUSED */
FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter)
{
- FLAC__uint32 lsbs = 0, msbs = 0;
- unsigned bit, uval, k;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
-
- k = FLAC__bitmath_ilog2(parameter);
-
- /* read the unary MSBs and end bit */
- if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
- return false;
-
- /* read the binary LSBs */
- if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, k))
- return false;
-
- if(parameter == 1u << k)
- {
- /* compose the value */
- uval = (msbs << k) | lsbs;
- }
- else
- {
- unsigned d = (1 << (k + 1)) - parameter;
- if(lsbs >= d)
- {
- if(!FLAC__bitreader_read_bit(br, &bit))
- return false;
- lsbs <<= 1;
- lsbs |= bit;
- lsbs -= d;
- }
- /* compose the value */
- uval = msbs * parameter + lsbs;
- }
-
- /* unfold unsigned to signed */
- if(uval & 1)
- *val = -((int)(uval >> 1)) - 1;
- else
- *val = (int)(uval >> 1);
-
- return true;
+ FLAC__uint32 lsbs = 0, msbs = 0;
+ unsigned bit, uval, k;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ k = FLAC__bitmath_ilog2(parameter);
+
+ /* read the unary MSBs and end bit */
+ if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
+ return false;
+
+ /* read the binary LSBs */
+ if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, k))
+ return false;
+
+ if(parameter == 1u<<k) {
+ /* compose the value */
+ uval = (msbs << k) | lsbs;
+ }
+ else {
+ unsigned d = (1 << (k+1)) - parameter;
+ if(lsbs >= d) {
+ if(!FLAC__bitreader_read_bit(br, &bit))
+ return false;
+ lsbs <<= 1;
+ lsbs |= bit;
+ lsbs -= d;
+ }
+ /* compose the value */
+ uval = msbs * parameter + lsbs;
+ }
+
+ /* unfold unsigned to signed */
+ if(uval & 1)
+ *val = -((int)(uval >> 1)) - 1;
+ else
+ *val = (int)(uval >> 1);
+
+ return true;
}
FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter)
{
- FLAC__uint32 lsbs, msbs = 0;
- unsigned bit, k;
-
- FLAC__ASSERT(0 != br);
- FLAC__ASSERT(0 != br->buffer);
-
- k = FLAC__bitmath_ilog2(parameter);
-
- /* read the unary MSBs and end bit */
- if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
- return false;
-
- /* read the binary LSBs */
- if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, k))
- return false;
-
- if(parameter == 1u << k)
- {
- /* compose the value */
- *val = (msbs << k) | lsbs;
- }
- else
- {
- unsigned d = (1 << (k + 1)) - parameter;
- if(lsbs >= d)
- {
- if(!FLAC__bitreader_read_bit(br, &bit))
- return false;
- lsbs <<= 1;
- lsbs |= bit;
- lsbs -= d;
- }
- /* compose the value */
- *val = msbs * parameter + lsbs;
- }
-
- return true;
+ FLAC__uint32 lsbs, msbs = 0;
+ unsigned bit, k;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ k = FLAC__bitmath_ilog2(parameter);
+
+ /* read the unary MSBs and end bit */
+ if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
+ return false;
+
+ /* read the binary LSBs */
+ if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, k))
+ return false;
+
+ if(parameter == 1u<<k) {
+ /* compose the value */
+ *val = (msbs << k) | lsbs;
+ }
+ else {
+ unsigned d = (1 << (k+1)) - parameter;
+ if(lsbs >= d) {
+ if(!FLAC__bitreader_read_bit(br, &bit))
+ return false;
+ lsbs <<= 1;
+ lsbs |= bit;
+ lsbs -= d;
+ }
+ /* compose the value */
+ *val = msbs * parameter + lsbs;
+ }
+
+ return true;
}
#endif /* UNUSED */
/* on return, if *val == 0xffffffff then the utf-8 sequence was invalid, but the return value will be true */
FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen)
{
- FLAC__uint32 v = 0;
- FLAC__uint32 x;
- unsigned i;
-
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- if(raw)
- raw[(*rawlen)++] = (FLAC__byte)x;
- if(!(x & 0x80)) /* 0xxxxxxx */
- {
- v = x;
- i = 0;
- }
- else if(x & 0xC0 && !(x & 0x20)) /* 110xxxxx */
- {
- v = x & 0x1F;
- i = 1;
- }
- else if(x & 0xE0 && !(x & 0x10)) /* 1110xxxx */
- {
- v = x & 0x0F;
- i = 2;
- }
- else if(x & 0xF0 && !(x & 0x08)) /* 11110xxx */
- {
- v = x & 0x07;
- i = 3;
- }
- else if(x & 0xF8 && !(x & 0x04)) /* 111110xx */
- {
- v = x & 0x03;
- i = 4;
- }
- else if(x & 0xFC && !(x & 0x02)) /* 1111110x */
- {
- v = x & 0x01;
- i = 5;
- }
- else
- {
- *val = 0xffffffff;
- return true;
- }
- for(; i; i--)
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- if(raw)
- raw[(*rawlen)++] = (FLAC__byte)x;
- if(!(x & 0x80) || (x & 0x40)) /* 10xxxxxx */
- {
- *val = 0xffffffff;
- return true;
- }
- v <<= 6;
- v |= (x & 0x3F);
- }
- *val = v;
- return true;
+ FLAC__uint32 v = 0;
+ FLAC__uint32 x;
+ unsigned i;
+
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ if(raw)
+ raw[(*rawlen)++] = (FLAC__byte)x;
+ if(!(x & 0x80)) { /* 0xxxxxxx */
+ v = x;
+ i = 0;
+ }
+ else if(x & 0xC0 && !(x & 0x20)) { /* 110xxxxx */
+ v = x & 0x1F;
+ i = 1;
+ }
+ else if(x & 0xE0 && !(x & 0x10)) { /* 1110xxxx */
+ v = x & 0x0F;
+ i = 2;
+ }
+ else if(x & 0xF0 && !(x & 0x08)) { /* 11110xxx */
+ v = x & 0x07;
+ i = 3;
+ }
+ else if(x & 0xF8 && !(x & 0x04)) { /* 111110xx */
+ v = x & 0x03;
+ i = 4;
+ }
+ else if(x & 0xFC && !(x & 0x02)) { /* 1111110x */
+ v = x & 0x01;
+ i = 5;
+ }
+ else {
+ *val = 0xffffffff;
+ return true;
+ }
+ for( ; i; i--) {
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ if(raw)
+ raw[(*rawlen)++] = (FLAC__byte)x;
+ if(!(x & 0x80) || (x & 0x40)) { /* 10xxxxxx */
+ *val = 0xffffffff;
+ return true;
+ }
+ v <<= 6;
+ v |= (x & 0x3F);
+ }
+ *val = v;
+ return true;
}
/* on return, if *val == 0xffffffffffffffff then the utf-8 sequence was invalid, but the return value will be true */
FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen)
{
- FLAC__uint64 v = 0;
- FLAC__uint32 x;
- unsigned i;
-
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- if(raw)
- raw[(*rawlen)++] = (FLAC__byte)x;
- if(!(x & 0x80)) /* 0xxxxxxx */
- {
- v = x;
- i = 0;
- }
- else if(x & 0xC0 && !(x & 0x20)) /* 110xxxxx */
- {
- v = x & 0x1F;
- i = 1;
- }
- else if(x & 0xE0 && !(x & 0x10)) /* 1110xxxx */
- {
- v = x & 0x0F;
- i = 2;
- }
- else if(x & 0xF0 && !(x & 0x08)) /* 11110xxx */
- {
- v = x & 0x07;
- i = 3;
- }
- else if(x & 0xF8 && !(x & 0x04)) /* 111110xx */
- {
- v = x & 0x03;
- i = 4;
- }
- else if(x & 0xFC && !(x & 0x02)) /* 1111110x */
- {
- v = x & 0x01;
- i = 5;
- }
- else if(x & 0xFE && !(x & 0x01)) /* 11111110 */
- {
- v = 0;
- i = 6;
- }
- else
- {
- *val = FLAC__U64L(0xffffffffffffffff);
- return true;
- }
- for(; i; i--)
- {
- if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
- return false;
- if(raw)
- raw[(*rawlen)++] = (FLAC__byte)x;
- if(!(x & 0x80) || (x & 0x40)) /* 10xxxxxx */
- {
- *val = FLAC__U64L(0xffffffffffffffff);
- return true;
- }
- v <<= 6;
- v |= (x & 0x3F);
- }
- *val = v;
- return true;
+ FLAC__uint64 v = 0;
+ FLAC__uint32 x;
+ unsigned i;
+
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ if(raw)
+ raw[(*rawlen)++] = (FLAC__byte)x;
+ if(!(x & 0x80)) { /* 0xxxxxxx */
+ v = x;
+ i = 0;
+ }
+ else if(x & 0xC0 && !(x & 0x20)) { /* 110xxxxx */
+ v = x & 0x1F;
+ i = 1;
+ }
+ else if(x & 0xE0 && !(x & 0x10)) { /* 1110xxxx */
+ v = x & 0x0F;
+ i = 2;
+ }
+ else if(x & 0xF0 && !(x & 0x08)) { /* 11110xxx */
+ v = x & 0x07;
+ i = 3;
+ }
+ else if(x & 0xF8 && !(x & 0x04)) { /* 111110xx */
+ v = x & 0x03;
+ i = 4;
+ }
+ else if(x & 0xFC && !(x & 0x02)) { /* 1111110x */
+ v = x & 0x01;
+ i = 5;
+ }
+ else if(x & 0xFE && !(x & 0x01)) { /* 11111110 */
+ v = 0;
+ i = 6;
+ }
+ else {
+ *val = FLAC__U64L(0xffffffffffffffff);
+ return true;
+ }
+ for( ; i; i--) {
+ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
+ return false;
+ if(raw)
+ raw[(*rawlen)++] = (FLAC__byte)x;
+ if(!(x & 0x80) || (x & 0x40)) { /* 10xxxxxx */
+ *val = FLAC__U64L(0xffffffffffffffff);
+ return true;
+ }
+ v <<= 6;
+ v |= (x & 0x3F);
+ }
+ *val = v;
+ return true;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitwriter.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitwriter.c
index abd3f34e2..581a941fe 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitwriter.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/bitwriter.c
@@ -102,56 +102,55 @@ static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword)
#define FLaC__INLINE
#endif
-struct FLAC__BitWriter
-{
- bwword *buffer;
- bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */
- unsigned capacity; /* capacity of buffer in words */
- unsigned words; /* # of complete words in buffer */
- unsigned bits; /* # of used bits in accum */
+struct FLAC__BitWriter {
+ bwword *buffer;
+ bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */
+ unsigned capacity; /* capacity of buffer in words */
+ unsigned words; /* # of complete words in buffer */
+ unsigned bits; /* # of used bits in accum */
};
#ifdef _MSC_VER
/* OPT: an MSVC built-in would be better */
static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x)
{
- x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF);
- return (x >> 16) | (x << 16);
+ x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
+ return (x>>16) | (x<<16);
}
#endif
/* * WATCHOUT: The current implementation only grows the buffer. */
static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
{
- unsigned new_capacity;
- bwword *new_buffer;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
-
- /* calculate total words needed to store 'bits_to_add' additional bits */
- new_capacity = bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD);
-
- /* it's possible (due to pessimism in the growth estimation that
- * leads to this call) that we don't actually need to grow
- */
- if(bw->capacity >= new_capacity)
- return true;
-
- /* round up capacity increase to the nearest FLAC__BITWRITER_DEFAULT_INCREMENT */
- if((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT)
- new_capacity += FLAC__BITWRITER_DEFAULT_INCREMENT - ((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT);
- /* make sure we got everything right */
- FLAC__ASSERT(0 == (new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT);
- FLAC__ASSERT(new_capacity > bw->capacity);
- FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD));
-
- new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity);
- if(new_buffer == 0)
- return false;
- bw->buffer = new_buffer;
- bw->capacity = new_capacity;
- return true;
+ unsigned new_capacity;
+ bwword *new_buffer;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+
+ /* calculate total words needed to store 'bits_to_add' additional bits */
+ new_capacity = bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD);
+
+ /* it's possible (due to pessimism in the growth estimation that
+ * leads to this call) that we don't actually need to grow
+ */
+ if(bw->capacity >= new_capacity)
+ return true;
+
+ /* round up capacity increase to the nearest FLAC__BITWRITER_DEFAULT_INCREMENT */
+ if((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT)
+ new_capacity += FLAC__BITWRITER_DEFAULT_INCREMENT - ((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT);
+ /* make sure we got everything right */
+ FLAC__ASSERT(0 == (new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT);
+ FLAC__ASSERT(new_capacity > bw->capacity);
+ FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD));
+
+ new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity);
+ if(new_buffer == 0)
+ return false;
+ bw->buffer = new_buffer;
+ bw->capacity = new_capacity;
+ return true;
}
@@ -163,17 +162,17 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
FLAC__BitWriter *FLAC__bitwriter_new(void)
{
- FLAC__BitWriter *bw = (FLAC__BitWriter*)calloc(1, sizeof(FLAC__BitWriter));
- /* note that calloc() sets all members to 0 for us */
- return bw;
+ FLAC__BitWriter *bw = (FLAC__BitWriter*)calloc(1, sizeof(FLAC__BitWriter));
+ /* note that calloc() sets all members to 0 for us */
+ return bw;
}
void FLAC__bitwriter_delete(FLAC__BitWriter *bw)
{
- FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw);
- FLAC__bitwriter_free(bw);
- free(bw);
+ FLAC__bitwriter_free(bw);
+ free(bw);
}
/***********************************************************************
@@ -184,768 +183,710 @@ void FLAC__bitwriter_delete(FLAC__BitWriter *bw)
FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw)
{
- FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw);
- bw->words = bw->bits = 0;
- bw->capacity = FLAC__BITWRITER_DEFAULT_CAPACITY;
- bw->buffer = (bwword*)malloc(sizeof(bwword) * bw->capacity);
- if(bw->buffer == 0)
- return false;
+ bw->words = bw->bits = 0;
+ bw->capacity = FLAC__BITWRITER_DEFAULT_CAPACITY;
+ bw->buffer = (bwword*)malloc(sizeof(bwword) * bw->capacity);
+ if(bw->buffer == 0)
+ return false;
- return true;
+ return true;
}
void FLAC__bitwriter_free(FLAC__BitWriter *bw)
{
- FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw);
- if(0 != bw->buffer)
- free(bw->buffer);
- bw->buffer = 0;
- bw->capacity = 0;
- bw->words = bw->bits = 0;
+ if(0 != bw->buffer)
+ free(bw->buffer);
+ bw->buffer = 0;
+ bw->capacity = 0;
+ bw->words = bw->bits = 0;
}
void FLAC__bitwriter_clear(FLAC__BitWriter *bw)
{
- bw->words = bw->bits = 0;
+ bw->words = bw->bits = 0;
}
void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out)
{
- unsigned i, j;
- if(bw == 0)
- {
- fprintf(out, "bitwriter is NULL\n");
- }
- else
- {
- fprintf(out, "bitwriter: capacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, FLAC__TOTAL_BITS(bw));
-
- for(i = 0; i < bw->words; i++)
- {
- fprintf(out, "%08X: ", i);
- for(j = 0; j < FLAC__BITS_PER_WORD; j++)
- fprintf(out, "%01u", bw->buffer[i] & (1 << (FLAC__BITS_PER_WORD - j - 1)) ? 1 : 0);
- fprintf(out, "\n");
- }
- if(bw->bits > 0)
- {
- fprintf(out, "%08X: ", i);
- for(j = 0; j < bw->bits; j++)
- fprintf(out, "%01u", bw->accum & (1 << (bw->bits - j - 1)) ? 1 : 0);
- fprintf(out, "\n");
- }
- }
+ unsigned i, j;
+ if(bw == 0) {
+ fprintf(out, "bitwriter is NULL\n");
+ }
+ else {
+ fprintf(out, "bitwriter: capacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, FLAC__TOTAL_BITS(bw));
+
+ for(i = 0; i < bw->words; i++) {
+ fprintf(out, "%08X: ", i);
+ for(j = 0; j < FLAC__BITS_PER_WORD; j++)
+ fprintf(out, "%01u", bw->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0);
+ fprintf(out, "\n");
+ }
+ if(bw->bits > 0) {
+ fprintf(out, "%08X: ", i);
+ for(j = 0; j < bw->bits; j++)
+ fprintf(out, "%01u", bw->accum & (1 << (bw->bits-j-1)) ? 1:0);
+ fprintf(out, "\n");
+ }
+ }
}
FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc)
{
- const FLAC__byte *buffer;
- size_t bytes;
+ const FLAC__byte *buffer;
+ size_t bytes;
- FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */
+ FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */
- if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes))
- return false;
+ if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes))
+ return false;
- *crc = (FLAC__uint16)FLAC__crc16(buffer, bytes);
- FLAC__bitwriter_release_buffer(bw);
- return true;
+ *crc = (FLAC__uint16)FLAC__crc16(buffer, bytes);
+ FLAC__bitwriter_release_buffer(bw);
+ return true;
}
FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc)
{
- const FLAC__byte *buffer;
- size_t bytes;
+ const FLAC__byte *buffer;
+ size_t bytes;
- FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */
+ FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */
- if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes))
- return false;
+ if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes))
+ return false;
- *crc = FLAC__crc8(buffer, bytes);
- FLAC__bitwriter_release_buffer(bw);
- return true;
+ *crc = FLAC__crc8(buffer, bytes);
+ FLAC__bitwriter_release_buffer(bw);
+ return true;
}
FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw)
{
- return ((bw->bits & 7) == 0);
+ return ((bw->bits & 7) == 0);
}
unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw)
{
- return FLAC__TOTAL_BITS(bw);
+ return FLAC__TOTAL_BITS(bw);
}
FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes)
{
- FLAC__ASSERT((bw->bits & 7) == 0);
- /* double protection */
- if(bw->bits & 7)
- return false;
- /* if we have bits in the accumulator we have to flush those to the buffer first */
- if(bw->bits)
- {
- FLAC__ASSERT(bw->words <= bw->capacity);
- if(bw->words == bw->capacity && !bitwriter_grow_(bw, FLAC__BITS_PER_WORD))
- return false;
- /* append bits as complete word to buffer, but don't change bw->accum or bw->bits */
- bw->buffer[bw->words] = SWAP_BE_WORD_TO_HOST(bw->accum << (FLAC__BITS_PER_WORD - bw->bits));
- }
- /* now we can just return what we have */
- *buffer = (FLAC__byte*)bw->buffer;
- *bytes = (FLAC__BYTES_PER_WORD * bw->words) + (bw->bits >> 3);
- return true;
+ FLAC__ASSERT((bw->bits & 7) == 0);
+ /* double protection */
+ if(bw->bits & 7)
+ return false;
+ /* if we have bits in the accumulator we have to flush those to the buffer first */
+ if(bw->bits) {
+ FLAC__ASSERT(bw->words <= bw->capacity);
+ if(bw->words == bw->capacity && !bitwriter_grow_(bw, FLAC__BITS_PER_WORD))
+ return false;
+ /* append bits as complete word to buffer, but don't change bw->accum or bw->bits */
+ bw->buffer[bw->words] = SWAP_BE_WORD_TO_HOST(bw->accum << (FLAC__BITS_PER_WORD-bw->bits));
+ }
+ /* now we can just return what we have */
+ *buffer = (FLAC__byte*)bw->buffer;
+ *bytes = (FLAC__BYTES_PER_WORD * bw->words) + (bw->bits >> 3);
+ return true;
}
void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw)
{
- /* nothing to do. in the future, strict checking of a 'writer-is-in-
- * get-mode' flag could be added everywhere and then cleared here
- */
- (void)bw;
+ /* nothing to do. in the future, strict checking of a 'writer-is-in-
+ * get-mode' flag could be added everywhere and then cleared here
+ */
+ (void)bw;
}
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits)
{
- unsigned n;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
-
- if(bits == 0)
- return true;
- /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
- if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits))
- return false;
- /* first part gets to word alignment */
- if(bw->bits)
- {
- n = min(FLAC__BITS_PER_WORD - bw->bits, bits);
- bw->accum <<= n;
- bits -= n;
- bw->bits += n;
- if(bw->bits == FLAC__BITS_PER_WORD)
- {
- bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
- bw->bits = 0;
- }
- else
- return true;
- }
- /* do whole words */
- while(bits >= FLAC__BITS_PER_WORD)
- {
- bw->buffer[bw->words++] = 0;
- bits -= FLAC__BITS_PER_WORD;
- }
- /* do any leftovers */
- if(bits > 0)
- {
- bw->accum = 0;
- bw->bits = bits;
- }
- return true;
+ unsigned n;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+
+ if(bits == 0)
+ return true;
+ /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
+ if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits))
+ return false;
+ /* first part gets to word alignment */
+ if(bw->bits) {
+ n = min(FLAC__BITS_PER_WORD - bw->bits, bits);
+ bw->accum <<= n;
+ bits -= n;
+ bw->bits += n;
+ if(bw->bits == FLAC__BITS_PER_WORD) {
+ bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
+ bw->bits = 0;
+ }
+ else
+ return true;
+ }
+ /* do whole words */
+ while(bits >= FLAC__BITS_PER_WORD) {
+ bw->buffer[bw->words++] = 0;
+ bits -= FLAC__BITS_PER_WORD;
+ }
+ /* do any leftovers */
+ if(bits > 0) {
+ bw->accum = 0;
+ bw->bits = bits;
+ }
+ return true;
}
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits)
{
- register unsigned left;
-
- /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
- FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
-
- FLAC__ASSERT(bits <= 32);
- if(bits == 0)
- return true;
-
- /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
- if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits))
- return false;
-
- left = FLAC__BITS_PER_WORD - bw->bits;
- if(bits < left)
- {
- bw->accum <<= bits;
- bw->accum |= val;
- bw->bits += bits;
- }
- else if(bw->bits) /* WATCHOUT: if bw->bits == 0, left==FLAC__BITS_PER_WORD and bw->accum<<=left is a NOP instead of setting to 0 */
- {
- bw->accum <<= left;
- bw->accum |= val >> (bw->bits = bits - left);
- bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
- bw->accum = val;
- }
- else
- {
- bw->accum = val;
- bw->bits = 0;
- bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(val);
- }
-
- return true;
+ register unsigned left;
+
+ /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
+ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+
+ FLAC__ASSERT(bits <= 32);
+ if(bits == 0)
+ return true;
+
+ /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
+ if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits))
+ return false;
+
+ left = FLAC__BITS_PER_WORD - bw->bits;
+ if(bits < left) {
+ bw->accum <<= bits;
+ bw->accum |= val;
+ bw->bits += bits;
+ }
+ else if(bw->bits) { /* WATCHOUT: if bw->bits == 0, left==FLAC__BITS_PER_WORD and bw->accum<<=left is a NOP instead of setting to 0 */
+ bw->accum <<= left;
+ bw->accum |= val >> (bw->bits = bits - left);
+ bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
+ bw->accum = val;
+ }
+ else {
+ bw->accum = val;
+ bw->bits = 0;
+ bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(val);
+ }
+
+ return true;
}
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits)
{
- /* zero-out unused bits */
- if(bits < 32)
- val &= (~(0xffffffff << bits));
+ /* zero-out unused bits */
+ if(bits < 32)
+ val &= (~(0xffffffff << bits));
- return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits);
+ return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits);
}
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits)
{
- /* this could be a little faster but it's not used for much */
- if(bits > 32)
- {
- return
- FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(val >> 32), bits - 32) &&
- FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 32);
- }
- else
- return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits);
+ /* this could be a little faster but it's not used for much */
+ if(bits > 32) {
+ return
+ FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(val>>32), bits-32) &&
+ FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 32);
+ }
+ else
+ return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits);
}
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val)
{
- /* this doesn't need to be that fast as currently it is only used for vorbis comments */
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, val & 0xff, 8))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, (val >> 8) & 0xff, 8))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, (val >> 16) & 0xff, 8))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, val >> 24, 8))
- return false;
-
- return true;
+ /* this doesn't need to be that fast as currently it is only used for vorbis comments */
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, val & 0xff, 8))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>8) & 0xff, 8))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>16) & 0xff, 8))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, val>>24, 8))
+ return false;
+
+ return true;
}
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals)
{
- unsigned i;
+ unsigned i;
- /* this could be faster but currently we don't need it to be since it's only used for writing metadata */
- for(i = 0; i < nvals; i++)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(vals[i]), 8))
- return false;
- }
+ /* this could be faster but currently we don't need it to be since it's only used for writing metadata */
+ for(i = 0; i < nvals; i++) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(vals[i]), 8))
+ return false;
+ }
- return true;
+ return true;
}
FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val)
{
- if(val < 32)
- return FLAC__bitwriter_write_raw_uint32(bw, 1, ++val);
- else
- return
- FLAC__bitwriter_write_zeroes(bw, val) &&
- FLAC__bitwriter_write_raw_uint32(bw, 1, 1);
+ if(val < 32)
+ return FLAC__bitwriter_write_raw_uint32(bw, 1, ++val);
+ else
+ return
+ FLAC__bitwriter_write_zeroes(bw, val) &&
+ FLAC__bitwriter_write_raw_uint32(bw, 1, 1);
}
unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter)
{
- FLAC__uint32 uval;
+ FLAC__uint32 uval;
- FLAC__ASSERT(parameter < sizeof(unsigned) * 8);
+ FLAC__ASSERT(parameter < sizeof(unsigned)*8);
- /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
- uval = (val << 1) ^(val >> 31);
+ /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
+ uval = (val<<1) ^ (val>>31);
- return 1 + parameter + (uval >> parameter);
+ return 1 + parameter + (uval >> parameter);
}
#if 0 /* UNUSED */
unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter)
{
- unsigned bits, msbs, uval;
- unsigned k;
-
- FLAC__ASSERT(parameter > 0);
-
- /* fold signed to unsigned */
- if(val < 0)
- uval = (unsigned)(((-(++val)) << 1) + 1);
- else
- uval = (unsigned)(val << 1);
-
- k = FLAC__bitmath_ilog2(parameter);
- if(parameter == 1u << k)
- {
- FLAC__ASSERT(k <= 30);
-
- msbs = uval >> k;
- bits = 1 + k + msbs;
- }
- else
- {
- unsigned q, r, d;
-
- d = (1 << (k + 1)) - parameter;
- q = uval / parameter;
- r = uval - (q * parameter);
-
- bits = 1 + q + k;
- if(r >= d)
- bits++;
- }
- return bits;
+ unsigned bits, msbs, uval;
+ unsigned k;
+
+ FLAC__ASSERT(parameter > 0);
+
+ /* fold signed to unsigned */
+ if(val < 0)
+ uval = (unsigned)(((-(++val)) << 1) + 1);
+ else
+ uval = (unsigned)(val << 1);
+
+ k = FLAC__bitmath_ilog2(parameter);
+ if(parameter == 1u<<k) {
+ FLAC__ASSERT(k <= 30);
+
+ msbs = uval >> k;
+ bits = 1 + k + msbs;
+ }
+ else {
+ unsigned q, r, d;
+
+ d = (1 << (k+1)) - parameter;
+ q = uval / parameter;
+ r = uval - (q * parameter);
+
+ bits = 1 + q + k;
+ if(r >= d)
+ bits++;
+ }
+ return bits;
}
unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter)
{
- unsigned bits, msbs;
- unsigned k;
-
- FLAC__ASSERT(parameter > 0);
-
- k = FLAC__bitmath_ilog2(parameter);
- if(parameter == 1u << k)
- {
- FLAC__ASSERT(k <= 30);
-
- msbs = uval >> k;
- bits = 1 + k + msbs;
- }
- else
- {
- unsigned q, r, d;
-
- d = (1 << (k + 1)) - parameter;
- q = uval / parameter;
- r = uval - (q * parameter);
-
- bits = 1 + q + k;
- if(r >= d)
- bits++;
- }
- return bits;
+ unsigned bits, msbs;
+ unsigned k;
+
+ FLAC__ASSERT(parameter > 0);
+
+ k = FLAC__bitmath_ilog2(parameter);
+ if(parameter == 1u<<k) {
+ FLAC__ASSERT(k <= 30);
+
+ msbs = uval >> k;
+ bits = 1 + k + msbs;
+ }
+ else {
+ unsigned q, r, d;
+
+ d = (1 << (k+1)) - parameter;
+ q = uval / parameter;
+ r = uval - (q * parameter);
+
+ bits = 1 + q + k;
+ if(r >= d)
+ bits++;
+ }
+ return bits;
}
#endif /* UNUSED */
FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter)
{
- unsigned total_bits, interesting_bits, msbs;
- FLAC__uint32 uval, pattern;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
- FLAC__ASSERT(parameter < 8 * sizeof(uval));
-
- /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
- uval = (val << 1) ^(val >> 31);
-
- msbs = uval >> parameter;
- interesting_bits = 1 + parameter;
- total_bits = interesting_bits + msbs;
- pattern = 1 << parameter; /* the unary end bit */
- pattern |= (uval & ((1 << parameter) - 1)); /* the binary LSBs */
-
- if(total_bits <= 32)
- return FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits);
- else
- return
- FLAC__bitwriter_write_zeroes(bw, msbs) && /* write the unary MSBs */
- FLAC__bitwriter_write_raw_uint32(bw, pattern, interesting_bits); /* write the unary end bit and binary LSBs */
+ unsigned total_bits, interesting_bits, msbs;
+ FLAC__uint32 uval, pattern;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+ FLAC__ASSERT(parameter < 8*sizeof(uval));
+
+ /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
+ uval = (val<<1) ^ (val>>31);
+
+ msbs = uval >> parameter;
+ interesting_bits = 1 + parameter;
+ total_bits = interesting_bits + msbs;
+ pattern = 1 << parameter; /* the unary end bit */
+ pattern |= (uval & ((1<<parameter)-1)); /* the binary LSBs */
+
+ if(total_bits <= 32)
+ return FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits);
+ else
+ return
+ FLAC__bitwriter_write_zeroes(bw, msbs) && /* write the unary MSBs */
+ FLAC__bitwriter_write_raw_uint32(bw, pattern, interesting_bits); /* write the unary end bit and binary LSBs */
}
FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter)
{
- const FLAC__uint32 mask1 = FLAC__WORD_ALL_ONES << parameter; /* we val|=mask1 to set the stop bit above it... */
- const FLAC__uint32 mask2 = FLAC__WORD_ALL_ONES >> (31 - parameter); /* ...then mask off the bits above the stop bit with val&=mask2*/
- FLAC__uint32 uval;
- unsigned left;
- const unsigned lsbits = 1 + parameter;
- unsigned msbits;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
- FLAC__ASSERT(parameter < 8 * sizeof(bwword) - 1);
- /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
- FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
-
- while(nvals)
- {
- /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
- uval = (*vals << 1) ^(*vals >> 31);
-
- msbits = uval >> parameter;
+ const FLAC__uint32 mask1 = FLAC__WORD_ALL_ONES << parameter; /* we val|=mask1 to set the stop bit above it... */
+ const FLAC__uint32 mask2 = FLAC__WORD_ALL_ONES >> (31-parameter); /* ...then mask off the bits above the stop bit with val&=mask2*/
+ FLAC__uint32 uval;
+ unsigned left;
+ const unsigned lsbits = 1 + parameter;
+ unsigned msbits;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+ FLAC__ASSERT(parameter < 8*sizeof(bwword)-1);
+ /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
+ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
+
+ while(nvals) {
+ /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
+ uval = (*vals<<1) ^ (*vals>>31);
+
+ msbits = uval >> parameter;
#if 0 /* OPT: can remove this special case if it doesn't make up for the extra compare (doesn't make a statistically significant difference with msvc or gcc/x86) */
- if(bw->bits && bw->bits + msbits + lsbits <= FLAC__BITS_PER_WORD) /* i.e. if the whole thing fits in the current bwword */
- {
- /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */
- bw->bits = bw->bits + msbits + lsbits;
- uval |= mask1; /* set stop bit */
- uval &= mask2; /* mask off unused top bits */
- /* NOT: bw->accum <<= msbits + lsbits because msbits+lsbits could be 32, then the shift would be a NOP */
- bw->accum <<= msbits;
- bw->accum <<= lsbits;
- bw->accum |= uval;
- if(bw->bits == FLAC__BITS_PER_WORD)
- {
- bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
- bw->bits = 0;
- /* burying the capacity check down here means we have to grow the buffer a little if there are more vals to do */
- if(bw->capacity <= bw->words && nvals > 1 && !bitwriter_grow_(bw, 1))
- {
- FLAC__ASSERT(bw->capacity == bw->words);
- return false;
- }
- }
- }
- else
- {
+ if(bw->bits && bw->bits + msbits + lsbits <= FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */
+ /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */
+ bw->bits = bw->bits + msbits + lsbits;
+ uval |= mask1; /* set stop bit */
+ uval &= mask2; /* mask off unused top bits */
+ /* NOT: bw->accum <<= msbits + lsbits because msbits+lsbits could be 32, then the shift would be a NOP */
+ bw->accum <<= msbits;
+ bw->accum <<= lsbits;
+ bw->accum |= uval;
+ if(bw->bits == FLAC__BITS_PER_WORD) {
+ bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
+ bw->bits = 0;
+ /* burying the capacity check down here means we have to grow the buffer a little if there are more vals to do */
+ if(bw->capacity <= bw->words && nvals > 1 && !bitwriter_grow_(bw, 1)) {
+ FLAC__ASSERT(bw->capacity == bw->words);
+ return false;
+ }
+ }
+ }
+ else {
#elif 1 /*@@@@@@ OPT: try this version with MSVC6 to see if better, not much difference for gcc-4 */
- if(bw->bits && bw->bits + msbits + lsbits < FLAC__BITS_PER_WORD) /* i.e. if the whole thing fits in the current bwword */
- {
- /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */
- bw->bits = bw->bits + msbits + lsbits;
- uval |= mask1; /* set stop bit */
- uval &= mask2; /* mask off unused top bits */
- bw->accum <<= msbits + lsbits;
- bw->accum |= uval;
- }
- else
- {
+ if(bw->bits && bw->bits + msbits + lsbits < FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */
+ /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */
+ bw->bits = bw->bits + msbits + lsbits;
+ uval |= mask1; /* set stop bit */
+ uval &= mask2; /* mask off unused top bits */
+ bw->accum <<= msbits + lsbits;
+ bw->accum |= uval;
+ }
+ else {
#endif
- /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+msbits+lsbits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
- /* OPT: pessimism may cause flurry of false calls to grow_ which eat up all savings before it */
- if(bw->capacity <= bw->words + bw->bits + msbits + 1/*lsbits always fit in 1 bwword*/ && !bitwriter_grow_(bw, msbits + lsbits))
- return false;
-
- if(msbits)
- {
- /* first part gets to word alignment */
- if(bw->bits)
- {
- left = FLAC__BITS_PER_WORD - bw->bits;
- if(msbits < left)
- {
- bw->accum <<= msbits;
- bw->bits += msbits;
- goto break1;
- }
- else
- {
- bw->accum <<= left;
- msbits -= left;
- bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
- bw->bits = 0;
- }
- }
- /* do whole words */
- while(msbits >= FLAC__BITS_PER_WORD)
- {
- bw->buffer[bw->words++] = 0;
- msbits -= FLAC__BITS_PER_WORD;
- }
- /* do any leftovers */
- if(msbits > 0)
- {
- bw->accum = 0;
- bw->bits = msbits;
- }
- }
+ /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+msbits+lsbits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
+ /* OPT: pessimism may cause flurry of false calls to grow_ which eat up all savings before it */
+ if(bw->capacity <= bw->words + bw->bits + msbits + 1/*lsbits always fit in 1 bwword*/ && !bitwriter_grow_(bw, msbits+lsbits))
+ return false;
+
+ if(msbits) {
+ /* first part gets to word alignment */
+ if(bw->bits) {
+ left = FLAC__BITS_PER_WORD - bw->bits;
+ if(msbits < left) {
+ bw->accum <<= msbits;
+ bw->bits += msbits;
+ goto break1;
+ }
+ else {
+ bw->accum <<= left;
+ msbits -= left;
+ bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
+ bw->bits = 0;
+ }
+ }
+ /* do whole words */
+ while(msbits >= FLAC__BITS_PER_WORD) {
+ bw->buffer[bw->words++] = 0;
+ msbits -= FLAC__BITS_PER_WORD;
+ }
+ /* do any leftovers */
+ if(msbits > 0) {
+ bw->accum = 0;
+ bw->bits = msbits;
+ }
+ }
break1:
- uval |= mask1; /* set stop bit */
- uval &= mask2; /* mask off unused top bits */
-
- left = FLAC__BITS_PER_WORD - bw->bits;
- if(lsbits < left)
- {
- bw->accum <<= lsbits;
- bw->accum |= uval;
- bw->bits += lsbits;
- }
- else
- {
- /* if bw->bits == 0, left==FLAC__BITS_PER_WORD which will always
- * be > lsbits (because of previous assertions) so it would have
- * triggered the (lsbits<left) case above.
- */
- FLAC__ASSERT(bw->bits);
- FLAC__ASSERT(left < FLAC__BITS_PER_WORD);
- bw->accum <<= left;
- bw->accum |= uval >> (bw->bits = lsbits - left);
- bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
- bw->accum = uval;
- }
+ uval |= mask1; /* set stop bit */
+ uval &= mask2; /* mask off unused top bits */
+
+ left = FLAC__BITS_PER_WORD - bw->bits;
+ if(lsbits < left) {
+ bw->accum <<= lsbits;
+ bw->accum |= uval;
+ bw->bits += lsbits;
+ }
+ else {
+ /* if bw->bits == 0, left==FLAC__BITS_PER_WORD which will always
+ * be > lsbits (because of previous assertions) so it would have
+ * triggered the (lsbits<left) case above.
+ */
+ FLAC__ASSERT(bw->bits);
+ FLAC__ASSERT(left < FLAC__BITS_PER_WORD);
+ bw->accum <<= left;
+ bw->accum |= uval >> (bw->bits = lsbits - left);
+ bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
+ bw->accum = uval;
+ }
#if 1
- }
+ }
#endif
- vals++;
- nvals--;
- }
- return true;
+ vals++;
+ nvals--;
+ }
+ return true;
}
#if 0 /* UNUSED */
-FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter * bw, int val, unsigned parameter)
-{
- unsigned total_bits, msbs, uval;
- unsigned k;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
- FLAC__ASSERT(parameter > 0);
-
- /* fold signed to unsigned */
- if(val < 0)
- uval = (unsigned)(((-(++val)) << 1) + 1);
- else
- uval = (unsigned)(val << 1);
-
- k = FLAC__bitmath_ilog2(parameter);
- if(parameter == 1u << k)
- {
- unsigned pattern;
-
- FLAC__ASSERT(k <= 30);
-
- msbs = uval >> k;
- total_bits = 1 + k + msbs;
- pattern = 1 << k; /* the unary end bit */
- pattern |= (uval & ((1u << k) - 1)); /* the binary LSBs */
-
- if(total_bits <= 32)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits))
- return false;
- }
- else
- {
- /* write the unary MSBs */
- if(!FLAC__bitwriter_write_zeroes(bw, msbs))
- return false;
- /* write the unary end bit and binary LSBs */
- if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, k + 1))
- return false;
- }
- }
- else
- {
- unsigned q, r, d;
-
- d = (1 << (k + 1)) - parameter;
- q = uval / parameter;
- r = uval - (q * parameter);
- /* write the unary MSBs */
- if(!FLAC__bitwriter_write_zeroes(bw, q))
- return false;
- /* write the unary end bit */
- if(!FLAC__bitwriter_write_raw_uint32(bw, 1, 1))
- return false;
- /* write the binary LSBs */
- if(r >= d)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, r + d, k + 1))
- return false;
- }
- else
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, r, k))
- return false;
- }
- }
- return true;
+FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter)
+{
+ unsigned total_bits, msbs, uval;
+ unsigned k;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+ FLAC__ASSERT(parameter > 0);
+
+ /* fold signed to unsigned */
+ if(val < 0)
+ uval = (unsigned)(((-(++val)) << 1) + 1);
+ else
+ uval = (unsigned)(val << 1);
+
+ k = FLAC__bitmath_ilog2(parameter);
+ if(parameter == 1u<<k) {
+ unsigned pattern;
+
+ FLAC__ASSERT(k <= 30);
+
+ msbs = uval >> k;
+ total_bits = 1 + k + msbs;
+ pattern = 1 << k; /* the unary end bit */
+ pattern |= (uval & ((1u<<k)-1)); /* the binary LSBs */
+
+ if(total_bits <= 32) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits))
+ return false;
+ }
+ else {
+ /* write the unary MSBs */
+ if(!FLAC__bitwriter_write_zeroes(bw, msbs))
+ return false;
+ /* write the unary end bit and binary LSBs */
+ if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, k+1))
+ return false;
+ }
+ }
+ else {
+ unsigned q, r, d;
+
+ d = (1 << (k+1)) - parameter;
+ q = uval / parameter;
+ r = uval - (q * parameter);
+ /* write the unary MSBs */
+ if(!FLAC__bitwriter_write_zeroes(bw, q))
+ return false;
+ /* write the unary end bit */
+ if(!FLAC__bitwriter_write_raw_uint32(bw, 1, 1))
+ return false;
+ /* write the binary LSBs */
+ if(r >= d) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, r+d, k+1))
+ return false;
+ }
+ else {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, r, k))
+ return false;
+ }
+ }
+ return true;
}
-FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter * bw, unsigned uval, unsigned parameter)
-{
- unsigned total_bits, msbs;
- unsigned k;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
- FLAC__ASSERT(parameter > 0);
-
- k = FLAC__bitmath_ilog2(parameter);
- if(parameter == 1u << k)
- {
- unsigned pattern;
-
- FLAC__ASSERT(k <= 30);
-
- msbs = uval >> k;
- total_bits = 1 + k + msbs;
- pattern = 1 << k; /* the unary end bit */
- pattern |= (uval & ((1u << k) - 1)); /* the binary LSBs */
-
- if(total_bits <= 32)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits))
- return false;
- }
- else
- {
- /* write the unary MSBs */
- if(!FLAC__bitwriter_write_zeroes(bw, msbs))
- return false;
- /* write the unary end bit and binary LSBs */
- if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, k + 1))
- return false;
- }
- }
- else
- {
- unsigned q, r, d;
-
- d = (1 << (k + 1)) - parameter;
- q = uval / parameter;
- r = uval - (q * parameter);
- /* write the unary MSBs */
- if(!FLAC__bitwriter_write_zeroes(bw, q))
- return false;
- /* write the unary end bit */
- if(!FLAC__bitwriter_write_raw_uint32(bw, 1, 1))
- return false;
- /* write the binary LSBs */
- if(r >= d)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, r + d, k + 1))
- return false;
- }
- else
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, r, k))
- return false;
- }
- }
- return true;
+FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned uval, unsigned parameter)
+{
+ unsigned total_bits, msbs;
+ unsigned k;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+ FLAC__ASSERT(parameter > 0);
+
+ k = FLAC__bitmath_ilog2(parameter);
+ if(parameter == 1u<<k) {
+ unsigned pattern;
+
+ FLAC__ASSERT(k <= 30);
+
+ msbs = uval >> k;
+ total_bits = 1 + k + msbs;
+ pattern = 1 << k; /* the unary end bit */
+ pattern |= (uval & ((1u<<k)-1)); /* the binary LSBs */
+
+ if(total_bits <= 32) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits))
+ return false;
+ }
+ else {
+ /* write the unary MSBs */
+ if(!FLAC__bitwriter_write_zeroes(bw, msbs))
+ return false;
+ /* write the unary end bit and binary LSBs */
+ if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, k+1))
+ return false;
+ }
+ }
+ else {
+ unsigned q, r, d;
+
+ d = (1 << (k+1)) - parameter;
+ q = uval / parameter;
+ r = uval - (q * parameter);
+ /* write the unary MSBs */
+ if(!FLAC__bitwriter_write_zeroes(bw, q))
+ return false;
+ /* write the unary end bit */
+ if(!FLAC__bitwriter_write_raw_uint32(bw, 1, 1))
+ return false;
+ /* write the binary LSBs */
+ if(r >= d) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, r+d, k+1))
+ return false;
+ }
+ else {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, r, k))
+ return false;
+ }
+ }
+ return true;
}
#endif /* UNUSED */
-FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter * bw, FLAC__uint32 val)
-{
- FLAC__bool ok = 1;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
-
- FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */
-
- if(val < 0x80)
- {
- return FLAC__bitwriter_write_raw_uint32(bw, val, 8);
- }
- else if(val < 0x800)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (val >> 6), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val & 0x3F), 8);
- }
- else if(val < 0x10000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (val >> 12), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val & 0x3F), 8);
- }
- else if(val < 0x200000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (val >> 18), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val & 0x3F), 8);
- }
- else if(val < 0x4000000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (val >> 24), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 18) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val & 0x3F), 8);
- }
- else
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (val >> 30), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 24) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 18) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val & 0x3F), 8);
- }
-
- return ok;
+FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val)
+{
+ FLAC__bool ok = 1;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+
+ FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */
+
+ if(val < 0x80) {
+ return FLAC__bitwriter_write_raw_uint32(bw, val, 8);
+ }
+ else if(val < 0x800) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (val>>6), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
+ }
+ else if(val < 0x10000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (val>>12), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
+ }
+ else if(val < 0x200000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (val>>18), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
+ }
+ else if(val < 0x4000000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (val>>24), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
+ }
+ else {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (val>>30), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>24)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
+ }
+
+ return ok;
}
-FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter * bw, FLAC__uint64 val)
-{
- FLAC__bool ok = 1;
-
- FLAC__ASSERT(0 != bw);
- FLAC__ASSERT(0 != bw->buffer);
-
- FLAC__ASSERT(!(val & FLAC__U64L(0xFFFFFFF000000000))); /* this version only handles 36 bits */
-
- if(val < 0x80)
- {
- return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 8);
- }
- else if(val < 0x800)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (FLAC__uint32)(val >> 6), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val & 0x3F), 8);
- }
- else if(val < 0x10000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (FLAC__uint32)(val >> 12), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val & 0x3F), 8);
- }
- else if(val < 0x200000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (FLAC__uint32)(val >> 18), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val & 0x3F), 8);
- }
- else if(val < 0x4000000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (FLAC__uint32)(val >> 24), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 18) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val & 0x3F), 8);
- }
- else if(val < 0x80000000)
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (FLAC__uint32)(val >> 30), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 24) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 18) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val & 0x3F), 8);
- }
- else
- {
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFE, 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 30) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 24) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 18) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 12) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val >> 6) & 0x3F), 8);
- ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val & 0x3F), 8);
- }
-
- return ok;
+FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val)
+{
+ FLAC__bool ok = 1;
+
+ FLAC__ASSERT(0 != bw);
+ FLAC__ASSERT(0 != bw->buffer);
+
+ FLAC__ASSERT(!(val & FLAC__U64L(0xFFFFFFF000000000))); /* this version only handles 36 bits */
+
+ if(val < 0x80) {
+ return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 8);
+ }
+ else if(val < 0x800) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (FLAC__uint32)(val>>6), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
+ }
+ else if(val < 0x10000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (FLAC__uint32)(val>>12), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
+ }
+ else if(val < 0x200000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (FLAC__uint32)(val>>18), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
+ }
+ else if(val < 0x4000000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (FLAC__uint32)(val>>24), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
+ }
+ else if(val < 0x80000000) {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (FLAC__uint32)(val>>30), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
+ }
+ else {
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFE, 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>30)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
+ ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
+ }
+
+ return ok;
}
-FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter * bw)
+FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw)
{
- /* 0-pad to byte boundary */
- if(bw->bits & 7u)
- return FLAC__bitwriter_write_zeroes(bw, 8 - (bw->bits & 7u));
- else
- return true;
+ /* 0-pad to byte boundary */
+ if(bw->bits & 7u)
+ return FLAC__bitwriter_write_zeroes(bw, 8 - (bw->bits & 7u));
+ else
+ return true;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/cpu.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/cpu.c
index 0d59f27f7..6d4d70ad6 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/cpu.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/cpu.c
@@ -58,15 +58,14 @@
static sigjmp_buf jmpbuf;
static volatile sig_atomic_t canjump = 0;
-static void sigill_handler(int sig)
+static void sigill_handler (int sig)
{
- if(!canjump)
- {
- signal(sig, SIG_DFL);
- raise(sig);
- }
- canjump = 0;
- siglongjmp(jmpbuf, 1);
+ if (!canjump) {
+ signal (sig, SIG_DFL);
+ raise (sig);
+ }
+ canjump = 0;
+ siglongjmp (jmpbuf, 1);
}
# endif /* FLAC__SYS_DARWIN */
# endif /* FLAC__NO_ASM */
@@ -122,33 +121,32 @@ static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000;
*/
# undef USE_OBSOLETE_SIGCONTEXT_FLAVOR /* #define this to use the older signal handler method */
# ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR
-static void sigill_handler_sse_os(int signal, struct sigcontext sc)
-{
- (void)signal;
- sc.eip += 3 + 3 + 6;
-}
+ static void sigill_handler_sse_os(int signal, struct sigcontext sc)
+ {
+ (void)signal;
+ sc.eip += 3 + 3 + 6;
+ }
# else
# include <sys/ucontext.h>
-static void sigill_handler_sse_os(int signal, siginfo_t *si, void *uc)
-{
- (void)signal, (void)si;
- ((ucontext_t*)uc)->uc_mcontext.gregs[14/*REG_EIP*/] += 3 + 3 + 6;
-}
+ static void sigill_handler_sse_os(int signal, siginfo_t *si, void *uc)
+ {
+ (void)signal, (void)si;
+ ((ucontext_t*)uc)->uc_mcontext.gregs[14/*REG_EIP*/] += 3 + 3 + 6;
+ }
# endif
# elif defined(_MSC_VER)
# include <windows.h>
# define USE_TRY_CATCH_FLAVOR /* sigill_handler flavor resulted in several crash reports on win32 */
# ifdef USE_TRY_CATCH_FLAVOR
# else
-LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep)
-{
- if(ep->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION)
- {
- ep->ContextRecord->Eip += 3 + 3 + 6;
- return EXCEPTION_CONTINUE_EXECUTION;
- }
- return EXCEPTION_CONTINUE_SEARCH;
-}
+ LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep)
+ {
+ if(ep->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION) {
+ ep->ContextRecord->Eip += 3 + 3 + 6;
+ return EXCEPTION_CONTINUE_EXECUTION;
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
# endif
# endif
#endif
@@ -156,275 +154,265 @@ LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep)
void FLAC__cpu_info(FLAC__CPUInfo *info)
{
- /*
- * IA32-specific
- */
+/*
+ * IA32-specific
+ */
#ifdef FLAC__CPU_IA32
- info->type = FLAC__CPUINFO_TYPE_IA32;
+ info->type = FLAC__CPUINFO_TYPE_IA32;
#if !defined FLAC__NO_ASM && defined FLAC__HAS_NASM
- info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */
- info->data.ia32.cpuid = FLAC__cpu_have_cpuid_asm_ia32() ? true : false;
- info->data.ia32.bswap = info->data.ia32.cpuid; /* CPUID => BSWAP since it came after */
- info->data.ia32.cmov = false;
- info->data.ia32.mmx = false;
- info->data.ia32.fxsr = false;
- info->data.ia32.sse = false;
- info->data.ia32.sse2 = false;
- info->data.ia32.sse3 = false;
- info->data.ia32.ssse3 = false;
- info->data.ia32._3dnow = false;
- info->data.ia32.ext3dnow = false;
- info->data.ia32.extmmx = false;
- if(info->data.ia32.cpuid)
- {
- /* http://www.sandpile.org/ia32/cpuid.htm */
- FLAC__uint32 flags_edx, flags_ecx;
- FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx);
- info->data.ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV) ? true : false;
- info->data.ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX) ? true : false;
- info->data.ia32.fxsr = (flags_edx & FLAC__CPUINFO_IA32_CPUID_FXSR) ? true : false;
- info->data.ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE) ? true : false;
- info->data.ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2) ? true : false;
- info->data.ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3) ? true : false;
- info->data.ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3) ? true : false;
+ info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */
+ info->data.ia32.cpuid = FLAC__cpu_have_cpuid_asm_ia32()? true : false;
+ info->data.ia32.bswap = info->data.ia32.cpuid; /* CPUID => BSWAP since it came after */
+ info->data.ia32.cmov = false;
+ info->data.ia32.mmx = false;
+ info->data.ia32.fxsr = false;
+ info->data.ia32.sse = false;
+ info->data.ia32.sse2 = false;
+ info->data.ia32.sse3 = false;
+ info->data.ia32.ssse3 = false;
+ info->data.ia32._3dnow = false;
+ info->data.ia32.ext3dnow = false;
+ info->data.ia32.extmmx = false;
+ if(info->data.ia32.cpuid) {
+ /* http://www.sandpile.org/ia32/cpuid.htm */
+ FLAC__uint32 flags_edx, flags_ecx;
+ FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx);
+ info->data.ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV )? true : false;
+ info->data.ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX )? true : false;
+ info->data.ia32.fxsr = (flags_edx & FLAC__CPUINFO_IA32_CPUID_FXSR )? true : false;
+ info->data.ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE )? true : false;
+ info->data.ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2 )? true : false;
+ info->data.ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 )? true : false;
+ info->data.ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3)? true : false;
#ifdef FLAC__USE_3DNOW
- flags_edx = FLAC__cpu_info_extended_amd_asm_ia32();
- info->data.ia32._3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW) ? true : false;
- info->data.ia32.ext3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW) ? true : false;
- info->data.ia32.extmmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX) ? true : false;
+ flags_edx = FLAC__cpu_info_extended_amd_asm_ia32();
+ info->data.ia32._3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW )? true : false;
+ info->data.ia32.ext3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW)? true : false;
+ info->data.ia32.extmmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX )? true : false;
#else
- info->data.ia32._3dnow = info->data.ia32.ext3dnow = info->data.ia32.extmmx = false;
+ info->data.ia32._3dnow = info->data.ia32.ext3dnow = info->data.ia32.extmmx = false;
#endif
#ifdef DEBUG
- fprintf(stderr, "CPU info (IA-32):\n");
- fprintf(stderr, " CPUID ...... %c\n", info->data.ia32.cpuid ? 'Y' : 'n');
- fprintf(stderr, " BSWAP ...... %c\n", info->data.ia32.bswap ? 'Y' : 'n');
- fprintf(stderr, " CMOV ....... %c\n", info->data.ia32.cmov ? 'Y' : 'n');
- fprintf(stderr, " MMX ........ %c\n", info->data.ia32.mmx ? 'Y' : 'n');
- fprintf(stderr, " FXSR ....... %c\n", info->data.ia32.fxsr ? 'Y' : 'n');
- fprintf(stderr, " SSE ........ %c\n", info->data.ia32.sse ? 'Y' : 'n');
- fprintf(stderr, " SSE2 ....... %c\n", info->data.ia32.sse2 ? 'Y' : 'n');
- fprintf(stderr, " SSE3 ....... %c\n", info->data.ia32.sse3 ? 'Y' : 'n');
- fprintf(stderr, " SSSE3 ...... %c\n", info->data.ia32.ssse3 ? 'Y' : 'n');
- fprintf(stderr, " 3DNow! ..... %c\n", info->data.ia32._3dnow ? 'Y' : 'n');
- fprintf(stderr, " 3DNow!-ext . %c\n", info->data.ia32.ext3dnow ? 'Y' : 'n');
- fprintf(stderr, " 3DNow!-MMX . %c\n", info->data.ia32.extmmx ? 'Y' : 'n');
+ fprintf(stderr, "CPU info (IA-32):\n");
+ fprintf(stderr, " CPUID ...... %c\n", info->data.ia32.cpuid ? 'Y' : 'n');
+ fprintf(stderr, " BSWAP ...... %c\n", info->data.ia32.bswap ? 'Y' : 'n');
+ fprintf(stderr, " CMOV ....... %c\n", info->data.ia32.cmov ? 'Y' : 'n');
+ fprintf(stderr, " MMX ........ %c\n", info->data.ia32.mmx ? 'Y' : 'n');
+ fprintf(stderr, " FXSR ....... %c\n", info->data.ia32.fxsr ? 'Y' : 'n');
+ fprintf(stderr, " SSE ........ %c\n", info->data.ia32.sse ? 'Y' : 'n');
+ fprintf(stderr, " SSE2 ....... %c\n", info->data.ia32.sse2 ? 'Y' : 'n');
+ fprintf(stderr, " SSE3 ....... %c\n", info->data.ia32.sse3 ? 'Y' : 'n');
+ fprintf(stderr, " SSSE3 ...... %c\n", info->data.ia32.ssse3 ? 'Y' : 'n');
+ fprintf(stderr, " 3DNow! ..... %c\n", info->data.ia32._3dnow ? 'Y' : 'n');
+ fprintf(stderr, " 3DNow!-ext . %c\n", info->data.ia32.ext3dnow? 'Y' : 'n');
+ fprintf(stderr, " 3DNow!-MMX . %c\n", info->data.ia32.extmmx ? 'Y' : 'n');
#endif
- /*
- * now have to check for OS support of SSE/SSE2
- */
- if(info->data.ia32.fxsr || info->data.ia32.sse || info->data.ia32.sse2)
- {
+ /*
+ * now have to check for OS support of SSE/SSE2
+ */
+ if(info->data.ia32.fxsr || info->data.ia32.sse || info->data.ia32.sse2) {
#if defined FLAC__NO_SSE_OS
- /* assume user knows better than us; turn it off */
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ /* assume user knows better than us; turn it off */
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
#elif defined FLAC__SSE_OS
- /* assume user knows better than us; leave as detected above */
+ /* assume user knows better than us; leave as detected above */
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
- int sse = 0;
- size_t len;
- /* at least one of these must work: */
- len = sizeof(sse);
- sse = sse || (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) == 0 && sse);
- len = sizeof(sse);
- sse = sse || (sysctlbyname("hw.optional.sse" , &sse, &len, NULL, 0) == 0 && sse); /* __APPLE__ ? */
- if(!sse)
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ int sse = 0;
+ size_t len;
+ /* at least one of these must work: */
+ len = sizeof(sse); sse = sse || (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) == 0 && sse);
+ len = sizeof(sse); sse = sse || (sysctlbyname("hw.optional.sse" , &sse, &len, NULL, 0) == 0 && sse); /* __APPLE__ ? */
+ if(!sse)
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
#elif defined(__NetBSD__) || defined (__OpenBSD__)
# if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__)
- int val = 0, mib[2] = { CTL_MACHDEP, CPU_SSE };
- size_t len = sizeof(val);
- if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val)
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
- else /* double-check SSE2 */
- {
- mib[1] = CPU_SSE2;
- len = sizeof(val);
- if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val)
- info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
- }
+ int val = 0, mib[2] = { CTL_MACHDEP, CPU_SSE };
+ size_t len = sizeof(val);
+ if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val)
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ else { /* double-check SSE2 */
+ mib[1] = CPU_SSE2;
+ len = sizeof(val);
+ if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val)
+ info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ }
# else
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
# endif
#elif defined(__linux__)
- int sse = 0;
- struct sigaction sigill_save;
+ int sse = 0;
+ struct sigaction sigill_save;
#ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR
- if(0 == sigaction(SIGILL, NULL, &sigill_save) && signal(SIGILL, (void (*)(int))sigill_handler_sse_os) != SIG_ERR)
+ if(0 == sigaction(SIGILL, NULL, &sigill_save) && signal(SIGILL, (void (*)(int))sigill_handler_sse_os) != SIG_ERR)
#else
- struct sigaction sigill_sse;
- sigill_sse.sa_sigaction = sigill_handler_sse_os;
- __sigemptyset(&sigill_sse.sa_mask);
- sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */
- if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save))
+ struct sigaction sigill_sse;
+ sigill_sse.sa_sigaction = sigill_handler_sse_os;
+ __sigemptyset(&sigill_sse.sa_mask);
+ sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */
+ if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save))
#endif
- {
- /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */
- /* see sigill_handler_sse_os() for an explanation of the following: */
- asm volatile(
- "xorl %0,%0\n\t" /* for some reason, still need to do this to clear 'sse' var */
- "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */
- "incl %0\n\t" /* SIGILL handler will jump over this */
- /* landing zone */
- "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */
- "nop\n\t"
- "nop\n\t"
- "nop\n\t"
- "nop\n\t"
- "nop\n\t"
- "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */
- "nop\n\t"
- "nop" /* SIGILL jump lands here if "inc" is 1 byte */
- : "=r"(sse)
- : "r"(sse)
- );
+ {
+ /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */
+ /* see sigill_handler_sse_os() for an explanation of the following: */
+ asm volatile (
+ "xorl %0,%0\n\t" /* for some reason, still need to do this to clear 'sse' var */
+ "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */
+ "incl %0\n\t" /* SIGILL handler will jump over this */
+ /* landing zone */
+ "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */
+ "nop\n\t"
+ "nop" /* SIGILL jump lands here if "inc" is 1 byte */
+ : "=r"(sse)
+ : "r"(sse)
+ );
- sigaction(SIGILL, &sigill_save, NULL);
- }
+ sigaction(SIGILL, &sigill_save, NULL);
+ }
- if(!sse)
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ if(!sse)
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
#elif defined(_MSC_VER)
# ifdef USE_TRY_CATCH_FLAVOR
- _try
- {
- __asm {
+ _try {
+ __asm {
# if _MSC_VER <= 1200
- /* VC6 assembler doesn't know SSE, have to emit bytecode instead */
- _emit 0x0F
- _emit 0x57
- _emit 0xC0
+ /* VC6 assembler doesn't know SSE, have to emit bytecode instead */
+ _emit 0x0F
+ _emit 0x57
+ _emit 0xC0
# else
- xorps xmm0, xmm0
+ xorps xmm0,xmm0
# endif
- }
- }
- _except(EXCEPTION_EXECUTE_HANDLER)
- {
- if(_exception_code() == STATUS_ILLEGAL_INSTRUCTION)
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
- }
+ }
+ }
+ _except(EXCEPTION_EXECUTE_HANDLER) {
+ if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION)
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ }
# else
- int sse = 0;
- LPTOP_LEVEL_EXCEPTION_FILTER save = SetUnhandledExceptionFilter(sigill_handler_sse_os);
- /* see GCC version above for explanation */
- /* http://msdn2.microsoft.com/en-us/library/4ks26t93.aspx */
- /* http://www.codeproject.com/cpp/gccasm.asp */
- /* http://www.hick.org/~mmiller/msvc_inline_asm.html */
- __asm
- {
+ int sse = 0;
+ LPTOP_LEVEL_EXCEPTION_FILTER save = SetUnhandledExceptionFilter(sigill_handler_sse_os);
+ /* see GCC version above for explanation */
+ /* http://msdn2.microsoft.com/en-us/library/4ks26t93.aspx */
+ /* http://www.codeproject.com/cpp/gccasm.asp */
+ /* http://www.hick.org/~mmiller/msvc_inline_asm.html */
+ __asm {
# if _MSC_VER <= 1200
- /* VC6 assembler doesn't know SSE, have to emit bytecode instead */
- _emit 0x0F
- _emit 0x57
- _emit 0xC0
+ /* VC6 assembler doesn't know SSE, have to emit bytecode instead */
+ _emit 0x0F
+ _emit 0x57
+ _emit 0xC0
# else
- xorps xmm0, xmm0
+ xorps xmm0,xmm0
# endif
- inc sse
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- }
- SetUnhandledExceptionFilter(save);
- if(!sse)
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ inc sse
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ }
+ SetUnhandledExceptionFilter(save);
+ if(!sse)
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
# endif
#else
- /* no way to test, disable to be safe */
- info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
+ /* no way to test, disable to be safe */
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
#endif
#ifdef DEBUG
- fprintf(stderr, " SSE OS sup . %c\n", info->data.ia32.sse ? 'Y' : 'n');
+ fprintf(stderr, " SSE OS sup . %c\n", info->data.ia32.sse ? 'Y' : 'n');
#endif
- }
- }
+ }
+ }
#else
- info->use_asm = false;
+ info->use_asm = false;
#endif
- /*
- * PPC-specific
- */
+/*
+ * PPC-specific
+ */
#elif defined FLAC__CPU_PPC
- info->type = FLAC__CPUINFO_TYPE_PPC;
+ info->type = FLAC__CPUINFO_TYPE_PPC;
# if !defined FLAC__NO_ASM
- info->use_asm = true;
+ info->use_asm = true;
# ifdef FLAC__USE_ALTIVEC
# if defined FLAC__SYS_DARWIN
- {
- int val = 0, mib[2] = { CTL_HW, HW_VECTORUNIT };
- size_t len = sizeof(val);
- info->data.ppc.altivec = !(sysctl(mib, 2, &val, &len, NULL, 0) || !val);
- }
- {
- host_basic_info_data_t hostInfo;
- mach_msg_type_number_t infoCount;
+ {
+ int val = 0, mib[2] = { CTL_HW, HW_VECTORUNIT };
+ size_t len = sizeof(val);
+ info->data.ppc.altivec = !(sysctl(mib, 2, &val, &len, NULL, 0) || !val);
+ }
+ {
+ host_basic_info_data_t hostInfo;
+ mach_msg_type_number_t infoCount;
- infoCount = HOST_BASIC_INFO_COUNT;
- host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount);
+ infoCount = HOST_BASIC_INFO_COUNT;
+ host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount);
- info->data.ppc.ppc64 = (hostInfo.cpu_type == CPU_TYPE_POWERPC) && (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970);
- }
+ info->data.ppc.ppc64 = (hostInfo.cpu_type == CPU_TYPE_POWERPC) && (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970);
+ }
# else /* FLAC__USE_ALTIVEC && !FLAC__SYS_DARWIN */
- {
- /* no Darwin, do it the brute-force way */
- /* @@@@@@ this is not thread-safe; replace with SSE OS method above or remove */
- info->data.ppc.altivec = 0;
- info->data.ppc.ppc64 = 0;
+ {
+ /* no Darwin, do it the brute-force way */
+ /* @@@@@@ this is not thread-safe; replace with SSE OS method above or remove */
+ info->data.ppc.altivec = 0;
+ info->data.ppc.ppc64 = 0;
- signal(SIGILL, sigill_handler);
- canjump = 0;
- if(!sigsetjmp(jmpbuf, 1))
- {
- canjump = 1;
+ signal (SIGILL, sigill_handler);
+ canjump = 0;
+ if (!sigsetjmp (jmpbuf, 1)) {
+ canjump = 1;
- asm volatile(
- "mtspr 256, %0\n\t"
- "vand %%v0, %%v0, %%v0"
- :
- : "r"(-1)
- );
+ asm volatile (
+ "mtspr 256, %0\n\t"
+ "vand %%v0, %%v0, %%v0"
+ :
+ : "r" (-1)
+ );
- info->data.ppc.altivec = 1;
- }
- canjump = 0;
- if(!sigsetjmp(jmpbuf, 1))
- {
- int x = 0;
- canjump = 1;
+ info->data.ppc.altivec = 1;
+ }
+ canjump = 0;
+ if (!sigsetjmp (jmpbuf, 1)) {
+ int x = 0;
+ canjump = 1;
- /* PPC64 hardware implements the cntlzd instruction */
- asm volatile("cntlzd %0, %1" : "=r"(x) : "r"(x));
+ /* PPC64 hardware implements the cntlzd instruction */
+ asm volatile ("cntlzd %0, %1" : "=r" (x) : "r" (x) );
- info->data.ppc.ppc64 = 1;
- }
- signal(SIGILL, SIG_DFL); /*@@@@@@ should save and restore old signal */
- }
+ info->data.ppc.ppc64 = 1;
+ }
+ signal (SIGILL, SIG_DFL); /*@@@@@@ should save and restore old signal */
+ }
# endif
# else /* !FLAC__USE_ALTIVEC */
- info->data.ppc.altivec = 0;
- info->data.ppc.ppc64 = 0;
+ info->data.ppc.altivec = 0;
+ info->data.ppc.ppc64 = 0;
# endif
# else
- info->use_asm = false;
+ info->use_asm = false;
# endif
- /*
- * unknown CPI
- */
+/*
+ * unknown CPI
+ */
#else
- info->type = FLAC__CPUINFO_TYPE_UNKNOWN;
- info->use_asm = false;
+ info->type = FLAC__CPUINFO_TYPE_UNKNOWN;
+ info->use_asm = false;
#endif
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/crc.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/crc.c
index d3d3142b2..5fa44737f 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/crc.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/crc.c
@@ -37,108 +37,106 @@
/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
-FLAC__byte const FLAC__crc8_table[256] =
-{
- 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15,
- 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
- 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
- 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
- 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5,
- 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
- 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85,
- 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD,
- 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2,
- 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA,
- 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2,
- 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
- 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32,
- 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A,
- 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42,
- 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A,
- 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C,
- 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
- 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC,
- 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4,
- 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C,
- 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44,
- 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C,
- 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
- 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B,
- 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63,
- 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B,
- 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13,
- 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB,
- 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
- 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB,
- 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
+FLAC__byte const FLAC__crc8_table[256] = {
+ 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15,
+ 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
+ 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
+ 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
+ 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5,
+ 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
+ 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85,
+ 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD,
+ 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2,
+ 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA,
+ 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2,
+ 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
+ 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32,
+ 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A,
+ 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42,
+ 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A,
+ 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C,
+ 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
+ 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC,
+ 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4,
+ 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C,
+ 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44,
+ 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C,
+ 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
+ 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B,
+ 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63,
+ 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B,
+ 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13,
+ 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB,
+ 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
+ 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB,
+ 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
};
/* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */
-unsigned const FLAC__crc16_table[256] =
-{
- 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
- 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
- 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
- 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
- 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
- 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
- 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
- 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
- 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
- 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
- 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
- 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
- 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
- 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
- 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
- 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
- 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
- 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
- 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
- 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
- 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
- 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
- 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
- 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
- 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
- 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
- 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
- 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
- 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
- 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
- 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
- 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
+unsigned const FLAC__crc16_table[256] = {
+ 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
+ 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
+ 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
+ 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
+ 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
+ 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
+ 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
+ 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
+ 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
+ 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
+ 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
+ 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
+ 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
+ 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
+ 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
+ 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
+ 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
+ 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
+ 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
+ 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
+ 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
+ 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
+ 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
+ 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
+ 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
+ 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
+ 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
+ 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
+ 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
+ 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
+ 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
+ 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
};
void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc)
{
- *crc = FLAC__crc8_table[*crc ^ data];
+ *crc = FLAC__crc8_table[*crc ^ data];
}
void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc)
{
- while(len--)
- *crc = FLAC__crc8_table[*crc ^ *data++];
+ while(len--)
+ *crc = FLAC__crc8_table[*crc ^ *data++];
}
FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len)
{
- FLAC__uint8 crc = 0;
+ FLAC__uint8 crc = 0;
- while(len--)
- crc = FLAC__crc8_table[crc ^ *data++];
+ while(len--)
+ crc = FLAC__crc8_table[crc ^ *data++];
- return crc;
+ return crc;
}
unsigned FLAC__crc16(const FLAC__byte *data, unsigned len)
{
- unsigned crc = 0;
+ unsigned crc = 0;
- while(len--)
- crc = ((crc << 8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff;
+ while(len--)
+ crc = ((crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff;
- return crc;
+ return crc;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/fixed.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/fixed.c
index 09db77970..cca0a8923 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/fixed.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/fixed.c
@@ -63,164 +63,160 @@
*/
static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__uint32 n)
{
- FLAC__uint32 rbps;
- unsigned bits; /* the number of bits required to represent a number */
- int fracbits; /* the number of bits of rbps that comprise the fractional part */
-
- FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
- FLAC__ASSERT(err > 0);
- FLAC__ASSERT(n > 0);
-
- FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
- if(err <= n)
- return 0;
- /*
- * The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
- * These allow us later to know we won't lose too much precision in the
- * fixed-point division (err<<fracbits)/n.
- */
-
- fracbits = (8 * sizeof(err)) - (FLAC__bitmath_ilog2(err) + 1);
-
- err <<= fracbits;
- err /= n;
- /* err now holds err/n with fracbits fractional bits */
-
- /*
- * Whittle err down to 16 bits max. 16 significant bits is enough for
- * our purposes.
- */
- FLAC__ASSERT(err > 0);
- bits = FLAC__bitmath_ilog2(err) + 1;
- if(bits > 16)
- {
- err >>= (bits - 16);
- fracbits -= (bits - 16);
- }
- rbps = (FLAC__uint32)err;
-
- /* Multiply by fixed-point version of ln(2), with 16 fractional bits */
- rbps *= FLAC__FP_LN2;
- fracbits += 16;
- FLAC__ASSERT(fracbits >= 0);
-
- /* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
- {
- const int f = fracbits & 3;
- if(f)
- {
- rbps >>= f;
- fracbits -= f;
- }
- }
-
- rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
-
- if(rbps == 0)
- return 0;
-
- /*
- * The return value must have 16 fractional bits. Since the whole part
- * of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
- * must be >= -3, these assertion allows us to be able to shift rbps
- * left if necessary to get 16 fracbits without losing any bits of the
- * whole part of rbps.
- *
- * There is a slight chance due to accumulated error that the whole part
- * will require 6 bits, so we use 6 in the assertion. Really though as
- * long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
- */
- FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps) + 1 <= fracbits + 6);
- FLAC__ASSERT(fracbits >= -3);
-
- /* now shift the decimal point into place */
- if(fracbits < 16)
- return rbps << (16 - fracbits);
- else if(fracbits > 16)
- return rbps >> (fracbits - 16);
- else
- return rbps;
+ FLAC__uint32 rbps;
+ unsigned bits; /* the number of bits required to represent a number */
+ int fracbits; /* the number of bits of rbps that comprise the fractional part */
+
+ FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
+ FLAC__ASSERT(err > 0);
+ FLAC__ASSERT(n > 0);
+
+ FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
+ if(err <= n)
+ return 0;
+ /*
+ * The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
+ * These allow us later to know we won't lose too much precision in the
+ * fixed-point division (err<<fracbits)/n.
+ */
+
+ fracbits = (8*sizeof(err)) - (FLAC__bitmath_ilog2(err)+1);
+
+ err <<= fracbits;
+ err /= n;
+ /* err now holds err/n with fracbits fractional bits */
+
+ /*
+ * Whittle err down to 16 bits max. 16 significant bits is enough for
+ * our purposes.
+ */
+ FLAC__ASSERT(err > 0);
+ bits = FLAC__bitmath_ilog2(err)+1;
+ if(bits > 16) {
+ err >>= (bits-16);
+ fracbits -= (bits-16);
+ }
+ rbps = (FLAC__uint32)err;
+
+ /* Multiply by fixed-point version of ln(2), with 16 fractional bits */
+ rbps *= FLAC__FP_LN2;
+ fracbits += 16;
+ FLAC__ASSERT(fracbits >= 0);
+
+ /* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
+ {
+ const int f = fracbits & 3;
+ if(f) {
+ rbps >>= f;
+ fracbits -= f;
+ }
+ }
+
+ rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
+
+ if(rbps == 0)
+ return 0;
+
+ /*
+ * The return value must have 16 fractional bits. Since the whole part
+ * of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
+ * must be >= -3, these assertion allows us to be able to shift rbps
+ * left if necessary to get 16 fracbits without losing any bits of the
+ * whole part of rbps.
+ *
+ * There is a slight chance due to accumulated error that the whole part
+ * will require 6 bits, so we use 6 in the assertion. Really though as
+ * long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
+ */
+ FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6);
+ FLAC__ASSERT(fracbits >= -3);
+
+ /* now shift the decimal point into place */
+ if(fracbits < 16)
+ return rbps << (16-fracbits);
+ else if(fracbits > 16)
+ return rbps >> (fracbits-16);
+ else
+ return rbps;
}
static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, FLAC__uint32 n)
{
- FLAC__uint32 rbps;
- unsigned bits; /* the number of bits required to represent a number */
- int fracbits; /* the number of bits of rbps that comprise the fractional part */
-
- FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
- FLAC__ASSERT(err > 0);
- FLAC__ASSERT(n > 0);
-
- FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
- if(err <= n)
- return 0;
- /*
- * The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
- * These allow us later to know we won't lose too much precision in the
- * fixed-point division (err<<fracbits)/n.
- */
-
- fracbits = (8 * sizeof(err)) - (FLAC__bitmath_ilog2_wide(err) + 1);
-
- err <<= fracbits;
- err /= n;
- /* err now holds err/n with fracbits fractional bits */
-
- /*
- * Whittle err down to 16 bits max. 16 significant bits is enough for
- * our purposes.
- */
- FLAC__ASSERT(err > 0);
- bits = FLAC__bitmath_ilog2_wide(err) + 1;
- if(bits > 16)
- {
- err >>= (bits - 16);
- fracbits -= (bits - 16);
- }
- rbps = (FLAC__uint32)err;
-
- /* Multiply by fixed-point version of ln(2), with 16 fractional bits */
- rbps *= FLAC__FP_LN2;
- fracbits += 16;
- FLAC__ASSERT(fracbits >= 0);
-
- /* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
- {
- const int f = fracbits & 3;
- if(f)
- {
- rbps >>= f;
- fracbits -= f;
- }
- }
-
- rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
-
- if(rbps == 0)
- return 0;
-
- /*
- * The return value must have 16 fractional bits. Since the whole part
- * of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
- * must be >= -3, these assertion allows us to be able to shift rbps
- * left if necessary to get 16 fracbits without losing any bits of the
- * whole part of rbps.
- *
- * There is a slight chance due to accumulated error that the whole part
- * will require 6 bits, so we use 6 in the assertion. Really though as
- * long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
- */
- FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps) + 1 <= fracbits + 6);
- FLAC__ASSERT(fracbits >= -3);
-
- /* now shift the decimal point into place */
- if(fracbits < 16)
- return rbps << (16 - fracbits);
- else if(fracbits > 16)
- return rbps >> (fracbits - 16);
- else
- return rbps;
+ FLAC__uint32 rbps;
+ unsigned bits; /* the number of bits required to represent a number */
+ int fracbits; /* the number of bits of rbps that comprise the fractional part */
+
+ FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
+ FLAC__ASSERT(err > 0);
+ FLAC__ASSERT(n > 0);
+
+ FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
+ if(err <= n)
+ return 0;
+ /*
+ * The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
+ * These allow us later to know we won't lose too much precision in the
+ * fixed-point division (err<<fracbits)/n.
+ */
+
+ fracbits = (8*sizeof(err)) - (FLAC__bitmath_ilog2_wide(err)+1);
+
+ err <<= fracbits;
+ err /= n;
+ /* err now holds err/n with fracbits fractional bits */
+
+ /*
+ * Whittle err down to 16 bits max. 16 significant bits is enough for
+ * our purposes.
+ */
+ FLAC__ASSERT(err > 0);
+ bits = FLAC__bitmath_ilog2_wide(err)+1;
+ if(bits > 16) {
+ err >>= (bits-16);
+ fracbits -= (bits-16);
+ }
+ rbps = (FLAC__uint32)err;
+
+ /* Multiply by fixed-point version of ln(2), with 16 fractional bits */
+ rbps *= FLAC__FP_LN2;
+ fracbits += 16;
+ FLAC__ASSERT(fracbits >= 0);
+
+ /* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
+ {
+ const int f = fracbits & 3;
+ if(f) {
+ rbps >>= f;
+ fracbits -= f;
+ }
+ }
+
+ rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
+
+ if(rbps == 0)
+ return 0;
+
+ /*
+ * The return value must have 16 fractional bits. Since the whole part
+ * of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
+ * must be >= -3, these assertion allows us to be able to shift rbps
+ * left if necessary to get 16 fracbits without losing any bits of the
+ * whole part of rbps.
+ *
+ * There is a slight chance due to accumulated error that the whole part
+ * will require 6 bits, so we use 6 in the assertion. Really though as
+ * long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
+ */
+ FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6);
+ FLAC__ASSERT(fracbits >= -3);
+
+ /* now shift the decimal point into place */
+ if(fracbits < 16)
+ return rbps << (16-fracbits);
+ else if(fracbits > 16)
+ return rbps >> (fracbits-16);
+ else
+ return rbps;
}
#endif
@@ -230,70 +226,56 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
#endif
{
- FLAC__int32 last_error_0 = data[-1];
- FLAC__int32 last_error_1 = data[-1] - data[-2];
- FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
- FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2 * data[-3] + data[-4]);
- FLAC__int32 error, save;
- FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
- unsigned i, order;
-
- for(i = 0; i < data_len; i++)
- {
- error = data[i] ;
- total_error_0 += local_abs(error);
- save = error;
- error -= last_error_0;
- total_error_1 += local_abs(error);
- last_error_0 = save;
- save = error;
- error -= last_error_1;
- total_error_2 += local_abs(error);
- last_error_1 = save;
- save = error;
- error -= last_error_2;
- total_error_3 += local_abs(error);
- last_error_2 = save;
- save = error;
- error -= last_error_3;
- total_error_4 += local_abs(error);
- last_error_3 = save;
- }
-
- if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
- order = 0;
- else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
- order = 1;
- else if(total_error_2 < min(total_error_3, total_error_4))
- order = 2;
- else if(total_error_3 < total_error_4)
- order = 3;
- else
- order = 4;
-
- /* Estimate the expected number of bits per residual signal sample. */
- /* 'total_error*' is linearly related to the variance of the residual */
- /* signal, so we use it directly to compute E(|x|) */
- FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
+ FLAC__int32 last_error_0 = data[-1];
+ FLAC__int32 last_error_1 = data[-1] - data[-2];
+ FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
+ FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
+ FLAC__int32 error, save;
+ FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
+ unsigned i, order;
+
+ for(i = 0; i < data_len; i++) {
+ error = data[i] ; total_error_0 += local_abs(error); save = error;
+ error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
+ error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
+ error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
+ error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
+ }
+
+ if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
+ order = 0;
+ else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
+ order = 1;
+ else if(total_error_2 < min(total_error_3, total_error_4))
+ order = 2;
+ else if(total_error_3 < total_error_4)
+ order = 3;
+ else
+ order = 4;
+
+ /* Estimate the expected number of bits per residual signal sample. */
+ /* 'total_error*' is linearly related to the variance of the residual */
+ /* signal, so we use it directly to compute E(|x|) */
+ FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
#else
- residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_integerized(total_error_0, data_len) : 0;
- residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_integerized(total_error_1, data_len) : 0;
- residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_integerized(total_error_2, data_len) : 0;
- residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_integerized(total_error_3, data_len) : 0;
- residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_integerized(total_error_4, data_len) : 0;
+ residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_integerized(total_error_0, data_len) : 0;
+ residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_integerized(total_error_1, data_len) : 0;
+ residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_integerized(total_error_2, data_len) : 0;
+ residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_integerized(total_error_3, data_len) : 0;
+ residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_integerized(total_error_4, data_len) : 0;
#endif
- return order;
+ return order;
}
#ifndef FLAC__INTEGER_ONLY_LIBRARY
@@ -302,168 +284,152 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
#endif
{
- FLAC__int32 last_error_0 = data[-1];
- FLAC__int32 last_error_1 = data[-1] - data[-2];
- FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
- FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2 * data[-3] + data[-4]);
- FLAC__int32 error, save;
- /* total_error_* are 64-bits to avoid overflow when encoding
- * erratic signals when the bits-per-sample and blocksize are
- * large.
- */
- FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
- unsigned i, order;
-
- for(i = 0; i < data_len; i++)
- {
- error = data[i] ;
- total_error_0 += local_abs(error);
- save = error;
- error -= last_error_0;
- total_error_1 += local_abs(error);
- last_error_0 = save;
- save = error;
- error -= last_error_1;
- total_error_2 += local_abs(error);
- last_error_1 = save;
- save = error;
- error -= last_error_2;
- total_error_3 += local_abs(error);
- last_error_2 = save;
- save = error;
- error -= last_error_3;
- total_error_4 += local_abs(error);
- last_error_3 = save;
- }
-
- if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
- order = 0;
- else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
- order = 1;
- else if(total_error_2 < min(total_error_3, total_error_4))
- order = 2;
- else if(total_error_3 < total_error_4)
- order = 3;
- else
- order = 4;
-
- /* Estimate the expected number of bits per residual signal sample. */
- /* 'total_error*' is linearly related to the variance of the residual */
- /* signal, so we use it directly to compute E(|x|) */
- FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
- FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
+ FLAC__int32 last_error_0 = data[-1];
+ FLAC__int32 last_error_1 = data[-1] - data[-2];
+ FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
+ FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
+ FLAC__int32 error, save;
+ /* total_error_* are 64-bits to avoid overflow when encoding
+ * erratic signals when the bits-per-sample and blocksize are
+ * large.
+ */
+ FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
+ unsigned i, order;
+
+ for(i = 0; i < data_len; i++) {
+ error = data[i] ; total_error_0 += local_abs(error); save = error;
+ error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
+ error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
+ error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
+ error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
+ }
+
+ if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
+ order = 0;
+ else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
+ order = 1;
+ else if(total_error_2 < min(total_error_3, total_error_4))
+ order = 2;
+ else if(total_error_3 < total_error_4)
+ order = 3;
+ else
+ order = 4;
+
+ /* Estimate the expected number of bits per residual signal sample. */
+ /* 'total_error*' is linearly related to the variance of the residual */
+ /* signal, so we use it directly to compute E(|x|) */
+ FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
+ FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#if defined _MSC_VER || defined __MINGW32__
- /* with MSVC you have to spoon feed it the casting */
- residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ /* with MSVC you have to spoon feed it the casting */
+ residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
#else
- residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
+ residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
#endif
#else
- residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0;
- residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0;
- residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_wide_integerized(total_error_2, data_len) : 0;
- residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_wide_integerized(total_error_3, data_len) : 0;
- residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_wide_integerized(total_error_4, data_len) : 0;
+ residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0;
+ residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0;
+ residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_wide_integerized(total_error_2, data_len) : 0;
+ residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_wide_integerized(total_error_3, data_len) : 0;
+ residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_wide_integerized(total_error_4, data_len) : 0;
#endif
- return order;
+ return order;
}
void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[])
{
- const int idata_len = (int)data_len;
- int i;
-
- switch(order)
- {
- case 0:
- FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
- memcpy(residual, data, sizeof(residual[0])*data_len);
- break;
- case 1:
- for(i = 0; i < idata_len; i++)
- residual[i] = data[i] - data[i-1];
- break;
- case 2:
- for(i = 0; i < idata_len; i++)
+ const int idata_len = (int)data_len;
+ int i;
+
+ switch(order) {
+ case 0:
+ FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
+ memcpy(residual, data, sizeof(residual[0])*data_len);
+ break;
+ case 1:
+ for(i = 0; i < idata_len; i++)
+ residual[i] = data[i] - data[i-1];
+ break;
+ case 2:
+ for(i = 0; i < idata_len; i++)
#if 1 /* OPT: may be faster with some compilers on some systems */
- residual[i] = data[i] - (data[i-1] << 1) + data[i-2];
+ residual[i] = data[i] - (data[i-1] << 1) + data[i-2];
#else
- residual[i] = data[i] - 2 * data[i-1] + data[i-2];
+ residual[i] = data[i] - 2*data[i-1] + data[i-2];
#endif
- break;
- case 3:
- for(i = 0; i < idata_len; i++)
+ break;
+ case 3:
+ for(i = 0; i < idata_len; i++)
#if 1 /* OPT: may be faster with some compilers on some systems */
- residual[i] = data[i] - (((data[i-1] - data[i-2]) << 1) + (data[i-1] - data[i-2])) - data[i-3];
+ residual[i] = data[i] - (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) - data[i-3];
#else
- residual[i] = data[i] - 3 * data[i-1] + 3 * data[i-2] - data[i-3];
+ residual[i] = data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3];
#endif
- break;
- case 4:
- for(i = 0; i < idata_len; i++)
+ break;
+ case 4:
+ for(i = 0; i < idata_len; i++)
#if 1 /* OPT: may be faster with some compilers on some systems */
- residual[i] = data[i] - ((data[i-1] + data[i-3]) << 2) + ((data[i-2] << 2) + (data[i-2] << 1)) + data[i-4];
+ residual[i] = data[i] - ((data[i-1]+data[i-3])<<2) + ((data[i-2]<<2) + (data[i-2]<<1)) + data[i-4];
#else
- residual[i] = data[i] - 4 * data[i-1] + 6 * data[i-2] - 4 * data[i-3] + data[i-4];
+ residual[i] = data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4];
#endif
- break;
- default:
- FLAC__ASSERT(0);
- }
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
}
void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[])
{
- int i, idata_len = (int)data_len;
-
- switch(order)
- {
- case 0:
- FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
- memcpy(data, residual, sizeof(residual[0])*data_len);
- break;
- case 1:
- for(i = 0; i < idata_len; i++)
- data[i] = residual[i] + data[i-1];
- break;
- case 2:
- for(i = 0; i < idata_len; i++)
+ int i, idata_len = (int)data_len;
+
+ switch(order) {
+ case 0:
+ FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
+ memcpy(data, residual, sizeof(residual[0])*data_len);
+ break;
+ case 1:
+ for(i = 0; i < idata_len; i++)
+ data[i] = residual[i] + data[i-1];
+ break;
+ case 2:
+ for(i = 0; i < idata_len; i++)
#if 1 /* OPT: may be faster with some compilers on some systems */
- data[i] = residual[i] + (data[i-1] << 1) - data[i-2];
+ data[i] = residual[i] + (data[i-1]<<1) - data[i-2];
#else
- data[i] = residual[i] + 2 * data[i-1] - data[i-2];
+ data[i] = residual[i] + 2*data[i-1] - data[i-2];
#endif
- break;
- case 3:
- for(i = 0; i < idata_len; i++)
+ break;
+ case 3:
+ for(i = 0; i < idata_len; i++)
#if 1 /* OPT: may be faster with some compilers on some systems */
- data[i] = residual[i] + (((data[i-1] - data[i-2]) << 1) + (data[i-1] - data[i-2])) + data[i-3];
+ data[i] = residual[i] + (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) + data[i-3];
#else
- data[i] = residual[i] + 3 * data[i-1] - 3 * data[i-2] + data[i-3];
+ data[i] = residual[i] + 3*data[i-1] - 3*data[i-2] + data[i-3];
#endif
- break;
- case 4:
- for(i = 0; i < idata_len; i++)
+ break;
+ case 4:
+ for(i = 0; i < idata_len; i++)
#if 1 /* OPT: may be faster with some compilers on some systems */
- data[i] = residual[i] + ((data[i-1] + data[i-3]) << 2) - ((data[i-2] << 2) + (data[i-2] << 1)) - data[i-4];
+ data[i] = residual[i] + ((data[i-1]+data[i-3])<<2) - ((data[i-2]<<2) + (data[i-2]<<1)) - data[i-4];
#else
- data[i] = residual[i] + 4 * data[i-1] - 6 * data[i-2] + 4 * data[i-3] - data[i-4];
+ data[i] = residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4];
#endif
- break;
- default:
- FLAC__ASSERT(0);
- }
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/float.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/float.c
index b11e39252..139da180b 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/float.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/float.c
@@ -54,260 +54,255 @@ const FLAC__fixedpoint FLAC__FP_E = 178145;
/* Lookup tables for Knuth's logarithm algorithm */
#define LOG2_LOOKUP_PRECISION 16
-static const FLAC__uint32 log2_lookup[][LOG2_LOOKUP_PRECISION] =
-{
- {
- /*
- * 0 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x00000001,
- /* lg(4/3) = */ 0x00000000,
- /* lg(8/7) = */ 0x00000000,
- /* lg(16/15) = */ 0x00000000,
- /* lg(32/31) = */ 0x00000000,
- /* lg(64/63) = */ 0x00000000,
- /* lg(128/127) = */ 0x00000000,
- /* lg(256/255) = */ 0x00000000,
- /* lg(512/511) = */ 0x00000000,
- /* lg(1024/1023) = */ 0x00000000,
- /* lg(2048/2047) = */ 0x00000000,
- /* lg(4096/4095) = */ 0x00000000,
- /* lg(8192/8191) = */ 0x00000000,
- /* lg(16384/16383) = */ 0x00000000,
- /* lg(32768/32767) = */ 0x00000000
- },
- {
- /*
- * 4 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x00000010,
- /* lg(4/3) = */ 0x00000007,
- /* lg(8/7) = */ 0x00000003,
- /* lg(16/15) = */ 0x00000001,
- /* lg(32/31) = */ 0x00000001,
- /* lg(64/63) = */ 0x00000000,
- /* lg(128/127) = */ 0x00000000,
- /* lg(256/255) = */ 0x00000000,
- /* lg(512/511) = */ 0x00000000,
- /* lg(1024/1023) = */ 0x00000000,
- /* lg(2048/2047) = */ 0x00000000,
- /* lg(4096/4095) = */ 0x00000000,
- /* lg(8192/8191) = */ 0x00000000,
- /* lg(16384/16383) = */ 0x00000000,
- /* lg(32768/32767) = */ 0x00000000
- },
- {
- /*
- * 8 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x00000100,
- /* lg(4/3) = */ 0x0000006a,
- /* lg(8/7) = */ 0x00000031,
- /* lg(16/15) = */ 0x00000018,
- /* lg(32/31) = */ 0x0000000c,
- /* lg(64/63) = */ 0x00000006,
- /* lg(128/127) = */ 0x00000003,
- /* lg(256/255) = */ 0x00000001,
- /* lg(512/511) = */ 0x00000001,
- /* lg(1024/1023) = */ 0x00000000,
- /* lg(2048/2047) = */ 0x00000000,
- /* lg(4096/4095) = */ 0x00000000,
- /* lg(8192/8191) = */ 0x00000000,
- /* lg(16384/16383) = */ 0x00000000,
- /* lg(32768/32767) = */ 0x00000000
- },
- {
- /*
- * 12 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x00001000,
- /* lg(4/3) = */ 0x000006a4,
- /* lg(8/7) = */ 0x00000315,
- /* lg(16/15) = */ 0x0000017d,
- /* lg(32/31) = */ 0x000000bc,
- /* lg(64/63) = */ 0x0000005d,
- /* lg(128/127) = */ 0x0000002e,
- /* lg(256/255) = */ 0x00000017,
- /* lg(512/511) = */ 0x0000000c,
- /* lg(1024/1023) = */ 0x00000006,
- /* lg(2048/2047) = */ 0x00000003,
- /* lg(4096/4095) = */ 0x00000001,
- /* lg(8192/8191) = */ 0x00000001,
- /* lg(16384/16383) = */ 0x00000000,
- /* lg(32768/32767) = */ 0x00000000
- },
- {
- /*
- * 16 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x00010000,
- /* lg(4/3) = */ 0x00006a40,
- /* lg(8/7) = */ 0x00003151,
- /* lg(16/15) = */ 0x000017d6,
- /* lg(32/31) = */ 0x00000bba,
- /* lg(64/63) = */ 0x000005d1,
- /* lg(128/127) = */ 0x000002e6,
- /* lg(256/255) = */ 0x00000172,
- /* lg(512/511) = */ 0x000000b9,
- /* lg(1024/1023) = */ 0x0000005c,
- /* lg(2048/2047) = */ 0x0000002e,
- /* lg(4096/4095) = */ 0x00000017,
- /* lg(8192/8191) = */ 0x0000000c,
- /* lg(16384/16383) = */ 0x00000006,
- /* lg(32768/32767) = */ 0x00000003
- },
- {
- /*
- * 20 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x00100000,
- /* lg(4/3) = */ 0x0006a3fe,
- /* lg(8/7) = */ 0x00031513,
- /* lg(16/15) = */ 0x00017d60,
- /* lg(32/31) = */ 0x0000bb9d,
- /* lg(64/63) = */ 0x00005d10,
- /* lg(128/127) = */ 0x00002e59,
- /* lg(256/255) = */ 0x00001721,
- /* lg(512/511) = */ 0x00000b8e,
- /* lg(1024/1023) = */ 0x000005c6,
- /* lg(2048/2047) = */ 0x000002e3,
- /* lg(4096/4095) = */ 0x00000171,
- /* lg(8192/8191) = */ 0x000000b9,
- /* lg(16384/16383) = */ 0x0000005c,
- /* lg(32768/32767) = */ 0x0000002e
- },
- {
- /*
- * 24 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x01000000,
- /* lg(4/3) = */ 0x006a3fe6,
- /* lg(8/7) = */ 0x00315130,
- /* lg(16/15) = */ 0x0017d605,
- /* lg(32/31) = */ 0x000bb9ca,
- /* lg(64/63) = */ 0x0005d0fc,
- /* lg(128/127) = */ 0x0002e58f,
- /* lg(256/255) = */ 0x0001720e,
- /* lg(512/511) = */ 0x0000b8d8,
- /* lg(1024/1023) = */ 0x00005c61,
- /* lg(2048/2047) = */ 0x00002e2d,
- /* lg(4096/4095) = */ 0x00001716,
- /* lg(8192/8191) = */ 0x00000b8b,
- /* lg(16384/16383) = */ 0x000005c5,
- /* lg(32768/32767) = */ 0x000002e3
- },
- {
- /*
- * 28 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ 0x10000000,
- /* lg(4/3) = */ 0x06a3fe5c,
- /* lg(8/7) = */ 0x03151301,
- /* lg(16/15) = */ 0x017d6049,
- /* lg(32/31) = */ 0x00bb9ca6,
- /* lg(64/63) = */ 0x005d0fba,
- /* lg(128/127) = */ 0x002e58f7,
- /* lg(256/255) = */ 0x001720da,
- /* lg(512/511) = */ 0x000b8d87,
- /* lg(1024/1023) = */ 0x0005c60b,
- /* lg(2048/2047) = */ 0x0002e2d7,
- /* lg(4096/4095) = */ 0x00017160,
- /* lg(8192/8191) = */ 0x0000b8ad,
- /* lg(16384/16383) = */ 0x00005c56,
- /* lg(32768/32767) = */ 0x00002e2b
- }
+static const FLAC__uint32 log2_lookup[][LOG2_LOOKUP_PRECISION] = {
+ {
+ /*
+ * 0 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x00000001,
+ /* lg(4/3) = */ 0x00000000,
+ /* lg(8/7) = */ 0x00000000,
+ /* lg(16/15) = */ 0x00000000,
+ /* lg(32/31) = */ 0x00000000,
+ /* lg(64/63) = */ 0x00000000,
+ /* lg(128/127) = */ 0x00000000,
+ /* lg(256/255) = */ 0x00000000,
+ /* lg(512/511) = */ 0x00000000,
+ /* lg(1024/1023) = */ 0x00000000,
+ /* lg(2048/2047) = */ 0x00000000,
+ /* lg(4096/4095) = */ 0x00000000,
+ /* lg(8192/8191) = */ 0x00000000,
+ /* lg(16384/16383) = */ 0x00000000,
+ /* lg(32768/32767) = */ 0x00000000
+ },
+ {
+ /*
+ * 4 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x00000010,
+ /* lg(4/3) = */ 0x00000007,
+ /* lg(8/7) = */ 0x00000003,
+ /* lg(16/15) = */ 0x00000001,
+ /* lg(32/31) = */ 0x00000001,
+ /* lg(64/63) = */ 0x00000000,
+ /* lg(128/127) = */ 0x00000000,
+ /* lg(256/255) = */ 0x00000000,
+ /* lg(512/511) = */ 0x00000000,
+ /* lg(1024/1023) = */ 0x00000000,
+ /* lg(2048/2047) = */ 0x00000000,
+ /* lg(4096/4095) = */ 0x00000000,
+ /* lg(8192/8191) = */ 0x00000000,
+ /* lg(16384/16383) = */ 0x00000000,
+ /* lg(32768/32767) = */ 0x00000000
+ },
+ {
+ /*
+ * 8 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x00000100,
+ /* lg(4/3) = */ 0x0000006a,
+ /* lg(8/7) = */ 0x00000031,
+ /* lg(16/15) = */ 0x00000018,
+ /* lg(32/31) = */ 0x0000000c,
+ /* lg(64/63) = */ 0x00000006,
+ /* lg(128/127) = */ 0x00000003,
+ /* lg(256/255) = */ 0x00000001,
+ /* lg(512/511) = */ 0x00000001,
+ /* lg(1024/1023) = */ 0x00000000,
+ /* lg(2048/2047) = */ 0x00000000,
+ /* lg(4096/4095) = */ 0x00000000,
+ /* lg(8192/8191) = */ 0x00000000,
+ /* lg(16384/16383) = */ 0x00000000,
+ /* lg(32768/32767) = */ 0x00000000
+ },
+ {
+ /*
+ * 12 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x00001000,
+ /* lg(4/3) = */ 0x000006a4,
+ /* lg(8/7) = */ 0x00000315,
+ /* lg(16/15) = */ 0x0000017d,
+ /* lg(32/31) = */ 0x000000bc,
+ /* lg(64/63) = */ 0x0000005d,
+ /* lg(128/127) = */ 0x0000002e,
+ /* lg(256/255) = */ 0x00000017,
+ /* lg(512/511) = */ 0x0000000c,
+ /* lg(1024/1023) = */ 0x00000006,
+ /* lg(2048/2047) = */ 0x00000003,
+ /* lg(4096/4095) = */ 0x00000001,
+ /* lg(8192/8191) = */ 0x00000001,
+ /* lg(16384/16383) = */ 0x00000000,
+ /* lg(32768/32767) = */ 0x00000000
+ },
+ {
+ /*
+ * 16 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x00010000,
+ /* lg(4/3) = */ 0x00006a40,
+ /* lg(8/7) = */ 0x00003151,
+ /* lg(16/15) = */ 0x000017d6,
+ /* lg(32/31) = */ 0x00000bba,
+ /* lg(64/63) = */ 0x000005d1,
+ /* lg(128/127) = */ 0x000002e6,
+ /* lg(256/255) = */ 0x00000172,
+ /* lg(512/511) = */ 0x000000b9,
+ /* lg(1024/1023) = */ 0x0000005c,
+ /* lg(2048/2047) = */ 0x0000002e,
+ /* lg(4096/4095) = */ 0x00000017,
+ /* lg(8192/8191) = */ 0x0000000c,
+ /* lg(16384/16383) = */ 0x00000006,
+ /* lg(32768/32767) = */ 0x00000003
+ },
+ {
+ /*
+ * 20 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x00100000,
+ /* lg(4/3) = */ 0x0006a3fe,
+ /* lg(8/7) = */ 0x00031513,
+ /* lg(16/15) = */ 0x00017d60,
+ /* lg(32/31) = */ 0x0000bb9d,
+ /* lg(64/63) = */ 0x00005d10,
+ /* lg(128/127) = */ 0x00002e59,
+ /* lg(256/255) = */ 0x00001721,
+ /* lg(512/511) = */ 0x00000b8e,
+ /* lg(1024/1023) = */ 0x000005c6,
+ /* lg(2048/2047) = */ 0x000002e3,
+ /* lg(4096/4095) = */ 0x00000171,
+ /* lg(8192/8191) = */ 0x000000b9,
+ /* lg(16384/16383) = */ 0x0000005c,
+ /* lg(32768/32767) = */ 0x0000002e
+ },
+ {
+ /*
+ * 24 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x01000000,
+ /* lg(4/3) = */ 0x006a3fe6,
+ /* lg(8/7) = */ 0x00315130,
+ /* lg(16/15) = */ 0x0017d605,
+ /* lg(32/31) = */ 0x000bb9ca,
+ /* lg(64/63) = */ 0x0005d0fc,
+ /* lg(128/127) = */ 0x0002e58f,
+ /* lg(256/255) = */ 0x0001720e,
+ /* lg(512/511) = */ 0x0000b8d8,
+ /* lg(1024/1023) = */ 0x00005c61,
+ /* lg(2048/2047) = */ 0x00002e2d,
+ /* lg(4096/4095) = */ 0x00001716,
+ /* lg(8192/8191) = */ 0x00000b8b,
+ /* lg(16384/16383) = */ 0x000005c5,
+ /* lg(32768/32767) = */ 0x000002e3
+ },
+ {
+ /*
+ * 28 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ 0x10000000,
+ /* lg(4/3) = */ 0x06a3fe5c,
+ /* lg(8/7) = */ 0x03151301,
+ /* lg(16/15) = */ 0x017d6049,
+ /* lg(32/31) = */ 0x00bb9ca6,
+ /* lg(64/63) = */ 0x005d0fba,
+ /* lg(128/127) = */ 0x002e58f7,
+ /* lg(256/255) = */ 0x001720da,
+ /* lg(512/511) = */ 0x000b8d87,
+ /* lg(1024/1023) = */ 0x0005c60b,
+ /* lg(2048/2047) = */ 0x0002e2d7,
+ /* lg(4096/4095) = */ 0x00017160,
+ /* lg(8192/8191) = */ 0x0000b8ad,
+ /* lg(16384/16383) = */ 0x00005c56,
+ /* lg(32768/32767) = */ 0x00002e2b
+ }
};
#if 0
-static const FLAC__uint64 log2_lookup_wide[] =
-{
- {
- /*
- * 32 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ FLAC__U64L(0x100000000),
- /* lg(4/3) = */ FLAC__U64L(0x6a3fe5c6),
- /* lg(8/7) = */ FLAC__U64L(0x31513015),
- /* lg(16/15) = */ FLAC__U64L(0x17d60497),
- /* lg(32/31) = */ FLAC__U64L(0x0bb9ca65),
- /* lg(64/63) = */ FLAC__U64L(0x05d0fba2),
- /* lg(128/127) = */ FLAC__U64L(0x02e58f74),
- /* lg(256/255) = */ FLAC__U64L(0x01720d9c),
- /* lg(512/511) = */ FLAC__U64L(0x00b8d875),
- /* lg(1024/1023) = */ FLAC__U64L(0x005c60aa),
- /* lg(2048/2047) = */ FLAC__U64L(0x002e2d72),
- /* lg(4096/4095) = */ FLAC__U64L(0x00171600),
- /* lg(8192/8191) = */ FLAC__U64L(0x000b8ad2),
- /* lg(16384/16383) = */ FLAC__U64L(0x0005c55d),
- /* lg(32768/32767) = */ FLAC__U64L(0x0002e2ac)
- },
- {
- /*
- * 48 fraction bits
- */
- /* undefined */ 0x00000000,
- /* lg(2/1) = */ FLAC__U64L(0x1000000000000),
- /* lg(4/3) = */ FLAC__U64L(0x6a3fe5c60429),
- /* lg(8/7) = */ FLAC__U64L(0x315130157f7a),
- /* lg(16/15) = */ FLAC__U64L(0x17d60496cfbb),
- /* lg(32/31) = */ FLAC__U64L(0xbb9ca64ecac),
- /* lg(64/63) = */ FLAC__U64L(0x5d0fba187cd),
- /* lg(128/127) = */ FLAC__U64L(0x2e58f7441ee),
- /* lg(256/255) = */ FLAC__U64L(0x1720d9c06a8),
- /* lg(512/511) = */ FLAC__U64L(0xb8d8752173),
- /* lg(1024/1023) = */ FLAC__U64L(0x5c60aa252e),
- /* lg(2048/2047) = */ FLAC__U64L(0x2e2d71b0d8),
- /* lg(4096/4095) = */ FLAC__U64L(0x1716001719),
- /* lg(8192/8191) = */ FLAC__U64L(0xb8ad1de1b),
- /* lg(16384/16383) = */ FLAC__U64L(0x5c55d640d),
- /* lg(32768/32767) = */ FLAC__U64L(0x2e2abcf52)
- }
+static const FLAC__uint64 log2_lookup_wide[] = {
+ {
+ /*
+ * 32 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ FLAC__U64L(0x100000000),
+ /* lg(4/3) = */ FLAC__U64L(0x6a3fe5c6),
+ /* lg(8/7) = */ FLAC__U64L(0x31513015),
+ /* lg(16/15) = */ FLAC__U64L(0x17d60497),
+ /* lg(32/31) = */ FLAC__U64L(0x0bb9ca65),
+ /* lg(64/63) = */ FLAC__U64L(0x05d0fba2),
+ /* lg(128/127) = */ FLAC__U64L(0x02e58f74),
+ /* lg(256/255) = */ FLAC__U64L(0x01720d9c),
+ /* lg(512/511) = */ FLAC__U64L(0x00b8d875),
+ /* lg(1024/1023) = */ FLAC__U64L(0x005c60aa),
+ /* lg(2048/2047) = */ FLAC__U64L(0x002e2d72),
+ /* lg(4096/4095) = */ FLAC__U64L(0x00171600),
+ /* lg(8192/8191) = */ FLAC__U64L(0x000b8ad2),
+ /* lg(16384/16383) = */ FLAC__U64L(0x0005c55d),
+ /* lg(32768/32767) = */ FLAC__U64L(0x0002e2ac)
+ },
+ {
+ /*
+ * 48 fraction bits
+ */
+ /* undefined */ 0x00000000,
+ /* lg(2/1) = */ FLAC__U64L(0x1000000000000),
+ /* lg(4/3) = */ FLAC__U64L(0x6a3fe5c60429),
+ /* lg(8/7) = */ FLAC__U64L(0x315130157f7a),
+ /* lg(16/15) = */ FLAC__U64L(0x17d60496cfbb),
+ /* lg(32/31) = */ FLAC__U64L(0xbb9ca64ecac),
+ /* lg(64/63) = */ FLAC__U64L(0x5d0fba187cd),
+ /* lg(128/127) = */ FLAC__U64L(0x2e58f7441ee),
+ /* lg(256/255) = */ FLAC__U64L(0x1720d9c06a8),
+ /* lg(512/511) = */ FLAC__U64L(0xb8d8752173),
+ /* lg(1024/1023) = */ FLAC__U64L(0x5c60aa252e),
+ /* lg(2048/2047) = */ FLAC__U64L(0x2e2d71b0d8),
+ /* lg(4096/4095) = */ FLAC__U64L(0x1716001719),
+ /* lg(8192/8191) = */ FLAC__U64L(0xb8ad1de1b),
+ /* lg(16384/16383) = */ FLAC__U64L(0x5c55d640d),
+ /* lg(32768/32767) = */ FLAC__U64L(0x2e2abcf52)
+ }
};
#endif
FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision)
{
- const FLAC__uint32 ONE = (1u << fracbits);
- const FLAC__uint32 *table = log2_lookup[fracbits >> 2];
-
- FLAC__ASSERT(fracbits < 32);
- FLAC__ASSERT((fracbits & 0x3) == 0);
+ const FLAC__uint32 ONE = (1u << fracbits);
+ const FLAC__uint32 *table = log2_lookup[fracbits >> 2];
- if(x < ONE)
- return 0;
+ FLAC__ASSERT(fracbits < 32);
+ FLAC__ASSERT((fracbits & 0x3) == 0);
- if(precision > LOG2_LOOKUP_PRECISION)
- precision = LOG2_LOOKUP_PRECISION;
+ if(x < ONE)
+ return 0;
+
+ if(precision > LOG2_LOOKUP_PRECISION)
+ precision = LOG2_LOOKUP_PRECISION;
- /* Knuth's algorithm for computing logarithms, optimized for base-2 with lookup tables */
- {
- FLAC__uint32 y = 0;
- FLAC__uint32 z = x >> 1, k = 1;
- while(x > ONE && k < precision)
- {
- if(x - z >= ONE)
- {
- x -= z;
- z = x >> k;
- y += table[k];
- }
- else
- {
- z >>= 1;
- k++;
- }
- }
- return y;
- }
+ /* Knuth's algorithm for computing logarithms, optimized for base-2 with lookup tables */
+ {
+ FLAC__uint32 y = 0;
+ FLAC__uint32 z = x >> 1, k = 1;
+ while (x > ONE && k < precision) {
+ if (x - z >= ONE) {
+ x -= z;
+ z = x >> k;
+ y += table[k];
+ }
+ else {
+ z >>= 1;
+ k++;
+ }
+ }
+ return y;
+ }
}
#endif /* defined FLAC__INTEGER_ONLY_LIBRARY */
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/format.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/format.c
index d7b509cc2..a2db3ca8a 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/format.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/format.c
@@ -62,7 +62,7 @@ FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.2.1 20070917";
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION " 20070917";
#endif
-FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f', 'L', 'a', 'C' };
+FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' };
FLAC_API const unsigned FLAC__STREAM_SYNC = 0x664C6143;
FLAC_API const unsigned FLAC__STREAM_SYNC_LEN = 32; /* bits */
@@ -89,20 +89,20 @@ FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN =
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3 * 8; /* bits */
+FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12 * 8; /* bits */
+FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6 + 13 * 8; /* bits */
+FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128 * 8; /* bits */
+FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7 + 258 * 8; /* bits */
+FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */
@@ -140,10 +140,9 @@ FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
-FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[] =
-{
- "PARTITIONED_RICE",
- "PARTITIONED_RICE2"
+FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[] = {
+ "PARTITIONED_RICE",
+ "PARTITIONED_RICE2"
};
FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */
@@ -158,173 +157,160 @@ FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02;
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10;
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40;
-FLAC_API const char * const FLAC__SubframeTypeString[] =
-{
- "CONSTANT",
- "VERBATIM",
- "FIXED",
- "LPC"
+FLAC_API const char * const FLAC__SubframeTypeString[] = {
+ "CONSTANT",
+ "VERBATIM",
+ "FIXED",
+ "LPC"
};
-FLAC_API const char * const FLAC__ChannelAssignmentString[] =
-{
- "INDEPENDENT",
- "LEFT_SIDE",
- "RIGHT_SIDE",
- "MID_SIDE"
+FLAC_API const char * const FLAC__ChannelAssignmentString[] = {
+ "INDEPENDENT",
+ "LEFT_SIDE",
+ "RIGHT_SIDE",
+ "MID_SIDE"
};
-FLAC_API const char * const FLAC__FrameNumberTypeString[] =
-{
- "FRAME_NUMBER_TYPE_FRAME_NUMBER",
- "FRAME_NUMBER_TYPE_SAMPLE_NUMBER"
+FLAC_API const char * const FLAC__FrameNumberTypeString[] = {
+ "FRAME_NUMBER_TYPE_FRAME_NUMBER",
+ "FRAME_NUMBER_TYPE_SAMPLE_NUMBER"
};
-FLAC_API const char * const FLAC__MetadataTypeString[] =
-{
- "STREAMINFO",
- "PADDING",
- "APPLICATION",
- "SEEKTABLE",
- "VORBIS_COMMENT",
- "CUESHEET",
- "PICTURE"
+FLAC_API const char * const FLAC__MetadataTypeString[] = {
+ "STREAMINFO",
+ "PADDING",
+ "APPLICATION",
+ "SEEKTABLE",
+ "VORBIS_COMMENT",
+ "CUESHEET",
+ "PICTURE"
};
-FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[] =
-{
- "Other",
- "32x32 pixels 'file icon' (PNG only)",
- "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"
+FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[] = {
+ "Other",
+ "32x32 pixels 'file icon' (PNG only)",
+ "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"
};
FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate)
{
- if(sample_rate == 0 || sample_rate > FLAC__MAX_SAMPLE_RATE)
- {
- return false;
- }
- else
- return true;
+ if(sample_rate == 0 || sample_rate > FLAC__MAX_SAMPLE_RATE) {
+ return false;
+ }
+ else
+ return true;
}
FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate)
{
- if(blocksize > 16384)
- return false;
- else if(sample_rate <= 48000 && blocksize > 4608)
- return false;
- else
- return true;
+ if(blocksize > 16384)
+ return false;
+ else if(sample_rate <= 48000 && blocksize > 4608)
+ return false;
+ else
+ return true;
}
FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate)
{
- if(
- !FLAC__format_sample_rate_is_valid(sample_rate) ||
- (
- sample_rate >= (1u << 16) &&
- !(sample_rate % 1000 == 0 || sample_rate % 10 == 0)
- )
- )
- {
- return false;
- }
- else
- return true;
+ if(
+ !FLAC__format_sample_rate_is_valid(sample_rate) ||
+ (
+ sample_rate >= (1u << 16) &&
+ !(sample_rate % 1000 == 0 || sample_rate % 10 == 0)
+ )
+ ) {
+ return false;
+ }
+ else
+ return true;
}
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table)
{
- unsigned i;
- FLAC__uint64 prev_sample_number = 0;
- FLAC__bool got_prev = false;
-
- FLAC__ASSERT(0 != seek_table);
-
- for(i = 0; i < seek_table->num_points; i++)
- {
- if(got_prev)
- {
- if(
- seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
- seek_table->points[i].sample_number <= prev_sample_number
- )
- return false;
- }
- prev_sample_number = seek_table->points[i].sample_number;
- got_prev = true;
- }
-
- return true;
+ unsigned i;
+ FLAC__uint64 prev_sample_number = 0;
+ FLAC__bool got_prev = false;
+
+ FLAC__ASSERT(0 != seek_table);
+
+ for(i = 0; i < seek_table->num_points; i++) {
+ if(got_prev) {
+ if(
+ seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
+ seek_table->points[i].sample_number <= prev_sample_number
+ )
+ return false;
+ }
+ prev_sample_number = seek_table->points[i].sample_number;
+ got_prev = true;
+ }
+
+ return true;
}
/* used as the sort predicate for qsort() */
static int seekpoint_compare_(const FLAC__StreamMetadata_SeekPoint *l, const FLAC__StreamMetadata_SeekPoint *r)
{
- /* we don't just 'return l->sample_number - r->sample_number' since the result (FLAC__int64) might overflow an 'int' */
- if(l->sample_number == r->sample_number)
- return 0;
- else if(l->sample_number < r->sample_number)
- return -1;
- else
- return 1;
+ /* we don't just 'return l->sample_number - r->sample_number' since the result (FLAC__int64) might overflow an 'int' */
+ if(l->sample_number == r->sample_number)
+ return 0;
+ else if(l->sample_number < r->sample_number)
+ return -1;
+ else
+ return 1;
}
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
{
- unsigned i, j;
- FLAC__bool first;
-
- FLAC__ASSERT(0 != seek_table);
-
- /* sort the seekpoints */
- qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_);
-
- /* uniquify the seekpoints */
- first = true;
- for(i = j = 0; i < seek_table->num_points; i++)
- {
- if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER)
- {
- if(!first)
- {
- if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number)
- continue;
- }
- }
- first = false;
- seek_table->points[j++] = seek_table->points[i];
- }
-
- for(i = j; i < seek_table->num_points; i++)
- {
- seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
- seek_table->points[i].stream_offset = 0;
- seek_table->points[i].frame_samples = 0;
- }
-
- return j;
+ unsigned i, j;
+ FLAC__bool first;
+
+ FLAC__ASSERT(0 != seek_table);
+
+ /* sort the seekpoints */
+ qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_);
+
+ /* uniquify the seekpoints */
+ first = true;
+ for(i = j = 0; i < seek_table->num_points; i++) {
+ if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
+ if(!first) {
+ if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number)
+ continue;
+ }
+ }
+ first = false;
+ seek_table->points[j++] = seek_table->points[i];
+ }
+
+ for(i = j; i < seek_table->num_points; i++) {
+ seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
+ seek_table->points[i].stream_offset = 0;
+ seek_table->points[i].frame_samples = 0;
+ }
+
+ return j;
}
/*
@@ -335,240 +321,205 @@ FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *se
*/
static unsigned utf8len_(const FLAC__byte *utf8)
{
- FLAC__ASSERT(0 != utf8);
- if((utf8[0] & 0x80) == 0)
- {
- return 1;
- }
- else if((utf8[0] & 0xE0) == 0xC0 && (utf8[1] & 0xC0) == 0x80)
- {
- if((utf8[0] & 0xFE) == 0xC0) /* overlong sequence check */
- return 0;
- return 2;
- }
- else if((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80)
- {
- if(utf8[0] == 0xE0 && (utf8[1] & 0xE0) == 0x80) /* overlong sequence check */
- return 0;
- /* illegal surrogates check (U+D800...U+DFFF and U+FFFE...U+FFFF) */
- if(utf8[0] == 0xED && (utf8[1] & 0xE0) == 0xA0) /* D800-DFFF */
- return 0;
- if(utf8[0] == 0xEF && utf8[1] == 0xBF && (utf8[2] & 0xFE) == 0xBE) /* FFFE-FFFF */
- return 0;
- return 3;
- }
- else if((utf8[0] & 0xF8) == 0xF0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80)
- {
- if(utf8[0] == 0xF0 && (utf8[1] & 0xF0) == 0x80) /* overlong sequence check */
- return 0;
- return 4;
- }
- else if((utf8[0] & 0xFC) == 0xF8 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80)
- {
- if(utf8[0] == 0xF8 && (utf8[1] & 0xF8) == 0x80) /* overlong sequence check */
- return 0;
- return 5;
- }
- else if((utf8[0] & 0xFE) == 0xFC && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80 && (utf8[5] & 0xC0) == 0x80)
- {
- if(utf8[0] == 0xFC && (utf8[1] & 0xFC) == 0x80) /* overlong sequence check */
- return 0;
- return 6;
- }
- else
- {
- return 0;
- }
+ FLAC__ASSERT(0 != utf8);
+ if ((utf8[0] & 0x80) == 0) {
+ return 1;
+ }
+ else if ((utf8[0] & 0xE0) == 0xC0 && (utf8[1] & 0xC0) == 0x80) {
+ if ((utf8[0] & 0xFE) == 0xC0) /* overlong sequence check */
+ return 0;
+ return 2;
+ }
+ else if ((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80) {
+ if (utf8[0] == 0xE0 && (utf8[1] & 0xE0) == 0x80) /* overlong sequence check */
+ return 0;
+ /* illegal surrogates check (U+D800...U+DFFF and U+FFFE...U+FFFF) */
+ if (utf8[0] == 0xED && (utf8[1] & 0xE0) == 0xA0) /* D800-DFFF */
+ return 0;
+ if (utf8[0] == 0xEF && utf8[1] == 0xBF && (utf8[2] & 0xFE) == 0xBE) /* FFFE-FFFF */
+ return 0;
+ return 3;
+ }
+ else if ((utf8[0] & 0xF8) == 0xF0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80) {
+ if (utf8[0] == 0xF0 && (utf8[1] & 0xF0) == 0x80) /* overlong sequence check */
+ return 0;
+ return 4;
+ }
+ else if ((utf8[0] & 0xFC) == 0xF8 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80) {
+ if (utf8[0] == 0xF8 && (utf8[1] & 0xF8) == 0x80) /* overlong sequence check */
+ return 0;
+ return 5;
+ }
+ else if ((utf8[0] & 0xFE) == 0xFC && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80 && (utf8[5] & 0xC0) == 0x80) {
+ if (utf8[0] == 0xFC && (utf8[1] & 0xFC) == 0x80) /* overlong sequence check */
+ return 0;
+ return 6;
+ }
+ else {
+ return 0;
+ }
}
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name)
{
- char c;
- for(c = *name; c; c = *(++name))
- if(c < 0x20 || c == 0x3d || c > 0x7d)
- return false;
- return true;
+ char c;
+ for(c = *name; c; c = *(++name))
+ if(c < 0x20 || c == 0x3d || c > 0x7d)
+ return false;
+ return true;
}
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length)
{
- if(length == (unsigned)(-1))
- {
- while(*value)
- {
- unsigned n = utf8len_(value);
- if(n == 0)
- return false;
- value += n;
- }
- }
- else
- {
- const FLAC__byte *end = value + length;
- while(value < end)
- {
- unsigned n = utf8len_(value);
- if(n == 0)
- return false;
- value += n;
- }
- if(value != end)
- return false;
- }
- return true;
+ if(length == (unsigned)(-1)) {
+ while(*value) {
+ unsigned n = utf8len_(value);
+ if(n == 0)
+ return false;
+ value += n;
+ }
+ }
+ else {
+ const FLAC__byte *end = value + length;
+ while(value < end) {
+ unsigned n = utf8len_(value);
+ if(n == 0)
+ return false;
+ value += n;
+ }
+ if(value != end)
+ return false;
+ }
+ return true;
}
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length)
{
- const FLAC__byte *s, *end;
-
- for(s = entry, end = s + length; s < end && *s != '='; s++)
- {
- if(*s < 0x20 || *s > 0x7D)
- return false;
- }
- if(s == end)
- return false;
-
- s++; /* skip '=' */
-
- while(s < end)
- {
- unsigned n = utf8len_(s);
- if(n == 0)
- return false;
- s += n;
- }
- if(s != end)
- return false;
-
- return true;
+ const FLAC__byte *s, *end;
+
+ for(s = entry, end = s + length; s < end && *s != '='; s++) {
+ if(*s < 0x20 || *s > 0x7D)
+ return false;
+ }
+ if(s == end)
+ return false;
+
+ s++; /* skip '=' */
+
+ while(s < end) {
+ unsigned n = utf8len_(s);
+ if(n == 0)
+ return false;
+ s += n;
+ }
+ if(s != end)
+ return false;
+
+ return true;
}
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation)
{
- unsigned i, j;
-
- if(check_cd_da_subset)
- {
- if(cue_sheet->lead_in < 2 * 44100)
- {
- if(violation) *violation = "CD-DA cue sheet must have a lead-in length of at least 2 seconds";
- return false;
- }
- if(cue_sheet->lead_in % 588 != 0)
- {
- if(violation) *violation = "CD-DA cue sheet lead-in length must be evenly divisible by 588 samples";
- return false;
- }
- }
-
- if(cue_sheet->num_tracks == 0)
- {
- if(violation) *violation = "cue sheet must have at least one track (the lead-out)";
- return false;
- }
-
- if(check_cd_da_subset && cue_sheet->tracks[cue_sheet->num_tracks-1].number != 170)
- {
- if(violation) *violation = "CD-DA cue sheet must have a lead-out track number 170 (0xAA)";
- return false;
- }
-
- for(i = 0; i < cue_sheet->num_tracks; i++)
- {
- if(cue_sheet->tracks[i].number == 0)
- {
- if(violation) *violation = "cue sheet may not have a track number 0";
- return false;
- }
-
- if(check_cd_da_subset)
- {
- if(!((cue_sheet->tracks[i].number >= 1 && cue_sheet->tracks[i].number <= 99) || cue_sheet->tracks[i].number == 170))
- {
- if(violation) *violation = "CD-DA cue sheet track number must be 1-99 or 170";
- return false;
- }
- }
-
- if(check_cd_da_subset && cue_sheet->tracks[i].offset % 588 != 0)
- {
- if(violation)
- {
- if(i == cue_sheet->num_tracks - 1) /* the lead-out track... */
- *violation = "CD-DA cue sheet lead-out offset must be evenly divisible by 588 samples";
- else
- *violation = "CD-DA cue sheet track offset must be evenly divisible by 588 samples";
- }
- return false;
- }
-
- if(i < cue_sheet->num_tracks - 1)
- {
- if(cue_sheet->tracks[i].num_indices == 0)
- {
- if(violation) *violation = "cue sheet track must have at least one index point";
- return false;
- }
-
- if(cue_sheet->tracks[i].indices[0].number > 1)
- {
- if(violation) *violation = "cue sheet track's first index number must be 0 or 1";
- return false;
- }
- }
-
- for(j = 0; j < cue_sheet->tracks[i].num_indices; j++)
- {
- if(check_cd_da_subset && cue_sheet->tracks[i].indices[j].offset % 588 != 0)
- {
- if(violation) *violation = "CD-DA cue sheet track index offset must be evenly divisible by 588 samples";
- return false;
- }
-
- if(j > 0)
- {
- if(cue_sheet->tracks[i].indices[j].number != cue_sheet->tracks[i].indices[j-1].number + 1)
- {
- if(violation) *violation = "cue sheet track index numbers must increase by 1";
- return false;
- }
- }
- }
- }
-
- return true;
+ unsigned i, j;
+
+ if(check_cd_da_subset) {
+ if(cue_sheet->lead_in < 2 * 44100) {
+ if(violation) *violation = "CD-DA cue sheet must have a lead-in length of at least 2 seconds";
+ return false;
+ }
+ if(cue_sheet->lead_in % 588 != 0) {
+ if(violation) *violation = "CD-DA cue sheet lead-in length must be evenly divisible by 588 samples";
+ return false;
+ }
+ }
+
+ if(cue_sheet->num_tracks == 0) {
+ if(violation) *violation = "cue sheet must have at least one track (the lead-out)";
+ return false;
+ }
+
+ if(check_cd_da_subset && cue_sheet->tracks[cue_sheet->num_tracks-1].number != 170) {
+ if(violation) *violation = "CD-DA cue sheet must have a lead-out track number 170 (0xAA)";
+ return false;
+ }
+
+ for(i = 0; i < cue_sheet->num_tracks; i++) {
+ if(cue_sheet->tracks[i].number == 0) {
+ if(violation) *violation = "cue sheet may not have a track number 0";
+ return false;
+ }
+
+ if(check_cd_da_subset) {
+ if(!((cue_sheet->tracks[i].number >= 1 && cue_sheet->tracks[i].number <= 99) || cue_sheet->tracks[i].number == 170)) {
+ if(violation) *violation = "CD-DA cue sheet track number must be 1-99 or 170";
+ return false;
+ }
+ }
+
+ if(check_cd_da_subset && cue_sheet->tracks[i].offset % 588 != 0) {
+ if(violation) {
+ if(i == cue_sheet->num_tracks-1) /* the lead-out track... */
+ *violation = "CD-DA cue sheet lead-out offset must be evenly divisible by 588 samples";
+ else
+ *violation = "CD-DA cue sheet track offset must be evenly divisible by 588 samples";
+ }
+ return false;
+ }
+
+ if(i < cue_sheet->num_tracks - 1) {
+ if(cue_sheet->tracks[i].num_indices == 0) {
+ if(violation) *violation = "cue sheet track must have at least one index point";
+ return false;
+ }
+
+ if(cue_sheet->tracks[i].indices[0].number > 1) {
+ if(violation) *violation = "cue sheet track's first index number must be 0 or 1";
+ return false;
+ }
+ }
+
+ for(j = 0; j < cue_sheet->tracks[i].num_indices; j++) {
+ if(check_cd_da_subset && cue_sheet->tracks[i].indices[j].offset % 588 != 0) {
+ if(violation) *violation = "CD-DA cue sheet track index offset must be evenly divisible by 588 samples";
+ return false;
+ }
+
+ if(j > 0) {
+ if(cue_sheet->tracks[i].indices[j].number != cue_sheet->tracks[i].indices[j-1].number + 1) {
+ if(violation) *violation = "cue sheet track index numbers must increase by 1";
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
}
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation)
{
- char *p;
- FLAC__byte *b;
-
- for(p = picture->mime_type; *p; p++)
- {
- if(*p < 0x20 || *p > 0x7e)
- {
- if(violation) *violation = "MIME type string must contain only printable ASCII characters (0x20-0x7e)";
- return false;
- }
- }
-
- for(b = picture->description; *b;)
- {
- unsigned n = utf8len_(b);
- if(n == 0)
- {
- if(violation) *violation = "description string must be valid UTF-8";
- return false;
- }
- b += n;
- }
-
- return true;
+ char *p;
+ FLAC__byte *b;
+
+ for(p = picture->mime_type; *p; p++) {
+ if(*p < 0x20 || *p > 0x7e) {
+ if(violation) *violation = "MIME type string must contain only printable ASCII characters (0x20-0x7e)";
+ return false;
+ }
+ }
+
+ for(b = picture->description; *b; ) {
+ unsigned n = utf8len_(b);
+ if(n == 0) {
+ if(violation) *violation = "description string must be valid UTF-8";
+ return false;
+ }
+ b += n;
+ }
+
+ return true;
}
/*
@@ -576,75 +527,73 @@ FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Pic
*/
unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order)
{
- return
- FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(
- FLAC__format_get_max_rice_partition_order_from_blocksize(blocksize),
- blocksize,
- predictor_order
- );
+ return
+ FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(
+ FLAC__format_get_max_rice_partition_order_from_blocksize(blocksize),
+ blocksize,
+ predictor_order
+ );
}
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize)
{
- unsigned max_rice_partition_order = 0;
- while(!(blocksize & 1))
- {
- max_rice_partition_order++;
- blocksize >>= 1;
- }
- return min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
+ unsigned max_rice_partition_order = 0;
+ while(!(blocksize & 1)) {
+ max_rice_partition_order++;
+ blocksize >>= 1;
+ }
+ return min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
}
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order)
{
- unsigned max_rice_partition_order = limit;
+ unsigned max_rice_partition_order = limit;
- while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order)
- max_rice_partition_order--;
+ while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order)
+ max_rice_partition_order--;
- FLAC__ASSERT(
- (max_rice_partition_order == 0 && blocksize >= predictor_order) ||
- (max_rice_partition_order > 0 && blocksize >> max_rice_partition_order > predictor_order)
- );
+ FLAC__ASSERT(
+ (max_rice_partition_order == 0 && blocksize >= predictor_order) ||
+ (max_rice_partition_order > 0 && blocksize >> max_rice_partition_order > predictor_order)
+ );
- return max_rice_partition_order;
+ return max_rice_partition_order;
}
void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object)
{
- FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != object);
- object->parameters = 0;
- object->raw_bits = 0;
- object->capacity_by_order = 0;
+ object->parameters = 0;
+ object->raw_bits = 0;
+ object->capacity_by_order = 0;
}
void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object)
{
- FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != object);
- if(0 != object->parameters)
- free(object->parameters);
- if(0 != object->raw_bits)
- free(object->raw_bits);
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object);
+ if(0 != object->parameters)
+ free(object->parameters);
+ if(0 != object->raw_bits)
+ free(object->raw_bits);
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object);
}
FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order)
{
- FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits));
+ FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits));
- if(object->capacity_by_order < max_partition_order)
- {
- if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned) * (1 << max_partition_order))))
- return false;
- if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned) * (1 << max_partition_order))))
- return false;
- memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order));
- object->capacity_by_order = max_partition_order;
- }
+ if(object->capacity_by_order < max_partition_order) {
+ if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
+ return false;
+ if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
+ return false;
+ memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order));
+ object->capacity_by_order = max_partition_order;
+ }
- return true;
+ return true;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/bitreader.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/bitreader.h
index 2cdfaab4b..436ef6d63 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/bitreader.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/bitreader.h
@@ -42,7 +42,7 @@
struct FLAC__BitReader;
typedef struct FLAC__BitReader FLAC__BitReader;
-typedef FLAC__bool(*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *bytes, void *client_data);
+typedef FLAC__bool (*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *bytes, void *client_data);
/*
* construction, deletion, initialization, etc functions
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/cpu.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/cpu.h
index d96859e3c..297d18215 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/cpu.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/cpu.h
@@ -38,44 +38,39 @@
#include <config.h>
#endif
-typedef enum
-{
- FLAC__CPUINFO_TYPE_IA32,
- FLAC__CPUINFO_TYPE_PPC,
- FLAC__CPUINFO_TYPE_UNKNOWN
+typedef enum {
+ FLAC__CPUINFO_TYPE_IA32,
+ FLAC__CPUINFO_TYPE_PPC,
+ FLAC__CPUINFO_TYPE_UNKNOWN
} FLAC__CPUInfo_Type;
-typedef struct
-{
- FLAC__bool cpuid;
- FLAC__bool bswap;
- FLAC__bool cmov;
- FLAC__bool mmx;
- FLAC__bool fxsr;
- FLAC__bool sse;
- FLAC__bool sse2;
- FLAC__bool sse3;
- FLAC__bool ssse3;
- FLAC__bool _3dnow;
- FLAC__bool ext3dnow;
- FLAC__bool extmmx;
+typedef struct {
+ FLAC__bool cpuid;
+ FLAC__bool bswap;
+ FLAC__bool cmov;
+ FLAC__bool mmx;
+ FLAC__bool fxsr;
+ FLAC__bool sse;
+ FLAC__bool sse2;
+ FLAC__bool sse3;
+ FLAC__bool ssse3;
+ FLAC__bool _3dnow;
+ FLAC__bool ext3dnow;
+ FLAC__bool extmmx;
} FLAC__CPUInfo_IA32;
-typedef struct
-{
- FLAC__bool altivec;
- FLAC__bool ppc64;
+typedef struct {
+ FLAC__bool altivec;
+ FLAC__bool ppc64;
} FLAC__CPUInfo_PPC;
-typedef struct
-{
- FLAC__bool use_asm;
- FLAC__CPUInfo_Type type;
- union
- {
- FLAC__CPUInfo_IA32 ia32;
- FLAC__CPUInfo_PPC ppc;
- } data;
+typedef struct {
+ FLAC__bool use_asm;
+ FLAC__CPUInfo_Type type;
+ union {
+ FLAC__CPUInfo_IA32 ia32;
+ FLAC__CPUInfo_PPC ppc;
+ } data;
} FLAC__CPUInfo;
void FLAC__cpu_info(FLAC__CPUInfo *info);
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/md5.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/md5.h
index 1bad5a939..33c2edaff 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/md5.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/md5.h
@@ -28,13 +28,12 @@
#include "FLAC/ordinals.h"
-typedef struct
-{
- FLAC__uint32 in[16];
- FLAC__uint32 buf[4];
- FLAC__uint32 bytes[2];
- FLAC__byte *internal_buf;
- size_t capacity;
+typedef struct {
+ FLAC__uint32 in[16];
+ FLAC__uint32 buf[4];
+ FLAC__uint32 bytes[2];
+ FLAC__byte *internal_buf;
+ size_t capacity;
} FLAC__MD5Context;
void FLAC__MD5Init(FLAC__MD5Context *context);
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h
index bf740309b..61096654f 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h
@@ -37,22 +37,21 @@
#include "FLAC/ordinals.h"
#include "FLAC/stream_decoder.h" /* for FLAC__StreamDecoderReadStatus */
-typedef struct FLAC__OggDecoderAspect
-{
- /* these are storage for values that can be set through the API */
- FLAC__bool use_first_serial_number;
- long serial_number;
+typedef struct FLAC__OggDecoderAspect {
+ /* these are storage for values that can be set through the API */
+ FLAC__bool use_first_serial_number;
+ long serial_number;
- /* these are for internal state related to Ogg decoding */
- ogg_stream_state stream_state;
- ogg_sync_state sync_state;
- unsigned version_major, version_minor;
- FLAC__bool need_serial_number;
- FLAC__bool end_of_stream;
- FLAC__bool have_working_page; /* only if true will the following vars be valid */
- ogg_page working_page;
- FLAC__bool have_working_packet; /* only if true will the following vars be valid */
- ogg_packet working_packet; /* as we work through the packet we will move working_packet.packet forward and working_packet.bytes down */
+ /* these are for internal state related to Ogg decoding */
+ ogg_stream_state stream_state;
+ ogg_sync_state sync_state;
+ unsigned version_major, version_minor;
+ FLAC__bool need_serial_number;
+ FLAC__bool end_of_stream;
+ FLAC__bool have_working_page; /* only if true will the following vars be valid */
+ ogg_page working_page;
+ FLAC__bool have_working_packet; /* only if true will the following vars be valid */
+ ogg_packet working_packet; /* as we work through the packet we will move working_packet.packet forward and working_packet.bytes down */
} FLAC__OggDecoderAspect;
void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value);
@@ -62,19 +61,18 @@ void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect);
void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect);
void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect);
-typedef enum
-{
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK = 0,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR,
- FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR
+typedef enum {
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK = 0,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR,
+ FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR
} FLAC__OggDecoderAspectReadStatus;
-typedef FLAC__OggDecoderAspectReadStatus(*FLAC__OggDecoderAspectReadCallbackProxy)(const void *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
+typedef FLAC__OggDecoderAspectReadStatus (*FLAC__OggDecoderAspectReadCallbackProxy)(const void *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data);
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h
index 5a8fefab5..904091126 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h
@@ -37,18 +37,17 @@
#include "FLAC/ordinals.h"
#include "FLAC/stream_encoder.h" /* for FLAC__StreamEncoderWriteStatus */
-typedef struct FLAC__OggEncoderAspect
-{
- /* these are storage for values that can be set through the API */
- long serial_number;
- unsigned num_metadata;
-
- /* these are for internal state related to Ogg encoding */
- ogg_stream_state stream_state;
- ogg_page page;
- FLAC__bool seen_magic; /* true if we've seen the fLaC magic in the write callback yet */
- FLAC__bool is_first_packet;
- FLAC__uint64 samples_written;
+typedef struct FLAC__OggEncoderAspect {
+ /* these are storage for values that can be set through the API */
+ long serial_number;
+ unsigned num_metadata;
+
+ /* these are for internal state related to Ogg encoding */
+ ogg_stream_state stream_state;
+ ogg_page page;
+ FLAC__bool seen_magic; /* true if we've seen the fLaC magic in the write callback yet */
+ FLAC__bool is_first_packet;
+ FLAC__uint64 samples_written;
} FLAC__OggEncoderAspect;
void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value);
@@ -57,7 +56,7 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect);
FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect);
void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect);
-typedef FLAC__StreamEncoderWriteStatus(*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
+typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data);
#endif
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_decoder.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_decoder.h
index 5f80354f7..e6fe80799 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_decoder.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_decoder.h
@@ -37,17 +37,16 @@
#include "private/ogg_decoder_aspect.h"
#endif
-typedef struct FLAC__StreamDecoderProtected
-{
- FLAC__StreamDecoderState state;
- unsigned channels;
- FLAC__ChannelAssignment channel_assignment;
- unsigned bits_per_sample;
- unsigned sample_rate; /* in Hz */
- unsigned blocksize; /* in samples (per channel) */
- FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */
+typedef struct FLAC__StreamDecoderProtected {
+ FLAC__StreamDecoderState state;
+ unsigned channels;
+ FLAC__ChannelAssignment channel_assignment;
+ unsigned bits_per_sample;
+ unsigned sample_rate; /* in Hz */
+ unsigned blocksize; /* in samples (per channel) */
+ FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */
#if FLAC__HAS_OGG
- FLAC__OggDecoderAspect ogg_decoder_aspect;
+ FLAC__OggDecoderAspect ogg_decoder_aspect;
#endif
} FLAC__StreamDecoderProtected;
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_encoder.h b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_encoder.h
index 02b6ccb4c..637281372 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_encoder.h
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/include/protected/stream_encoder.h
@@ -43,73 +43,67 @@
#define FLAC__MAX_APODIZATION_FUNCTIONS 32
-typedef enum
-{
- FLAC__APODIZATION_BARTLETT,
- FLAC__APODIZATION_BARTLETT_HANN,
- FLAC__APODIZATION_BLACKMAN,
- FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE,
- FLAC__APODIZATION_CONNES,
- FLAC__APODIZATION_FLATTOP,
- FLAC__APODIZATION_GAUSS,
- FLAC__APODIZATION_HAMMING,
- FLAC__APODIZATION_HANN,
- FLAC__APODIZATION_KAISER_BESSEL,
- FLAC__APODIZATION_NUTTALL,
- FLAC__APODIZATION_RECTANGLE,
- FLAC__APODIZATION_TRIANGLE,
- FLAC__APODIZATION_TUKEY,
- FLAC__APODIZATION_WELCH
+typedef enum {
+ FLAC__APODIZATION_BARTLETT,
+ FLAC__APODIZATION_BARTLETT_HANN,
+ FLAC__APODIZATION_BLACKMAN,
+ FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE,
+ FLAC__APODIZATION_CONNES,
+ FLAC__APODIZATION_FLATTOP,
+ FLAC__APODIZATION_GAUSS,
+ FLAC__APODIZATION_HAMMING,
+ FLAC__APODIZATION_HANN,
+ FLAC__APODIZATION_KAISER_BESSEL,
+ FLAC__APODIZATION_NUTTALL,
+ FLAC__APODIZATION_RECTANGLE,
+ FLAC__APODIZATION_TRIANGLE,
+ FLAC__APODIZATION_TUKEY,
+ FLAC__APODIZATION_WELCH
} FLAC__ApodizationFunction;
-typedef struct
-{
- FLAC__ApodizationFunction type;
- union
- {
- struct
- {
- FLAC__real stddev;
- } gauss;
- struct
- {
- FLAC__real p;
- } tukey;
- } parameters;
+typedef struct {
+ FLAC__ApodizationFunction type;
+ union {
+ struct {
+ FLAC__real stddev;
+ } gauss;
+ struct {
+ FLAC__real p;
+ } tukey;
+ } parameters;
} FLAC__ApodizationSpecification;
#endif // #ifndef FLAC__INTEGER_ONLY_LIBRARY
-typedef struct FLAC__StreamEncoderProtected
-{
- FLAC__StreamEncoderState state;
- FLAC__bool verify;
- FLAC__bool streamable_subset;
- FLAC__bool do_md5;
- FLAC__bool do_mid_side_stereo;
- FLAC__bool loose_mid_side_stereo;
- unsigned channels;
- unsigned bits_per_sample;
- unsigned sample_rate;
- unsigned blocksize;
+typedef struct FLAC__StreamEncoderProtected {
+ FLAC__StreamEncoderState state;
+ FLAC__bool verify;
+ FLAC__bool streamable_subset;
+ FLAC__bool do_md5;
+ FLAC__bool do_mid_side_stereo;
+ FLAC__bool loose_mid_side_stereo;
+ unsigned channels;
+ unsigned bits_per_sample;
+ unsigned sample_rate;
+ unsigned blocksize;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- unsigned num_apodizations;
- FLAC__ApodizationSpecification apodizations[FLAC__MAX_APODIZATION_FUNCTIONS];
+ unsigned num_apodizations;
+ FLAC__ApodizationSpecification apodizations[FLAC__MAX_APODIZATION_FUNCTIONS];
#endif
- unsigned max_lpc_order;
- unsigned qlp_coeff_precision;
- FLAC__bool do_qlp_coeff_prec_search;
- FLAC__bool do_exhaustive_model_search;
- FLAC__bool do_escape_coding;
- unsigned min_residual_partition_order;
- unsigned max_residual_partition_order;
- unsigned rice_parameter_search_dist;
- FLAC__uint64 total_samples_estimate;
- FLAC__StreamMetadata **metadata;
- unsigned num_metadata_blocks;
- FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset;
+ unsigned max_lpc_order;
+ unsigned qlp_coeff_precision;
+ FLAC__bool do_qlp_coeff_prec_search;
+ FLAC__bool do_exhaustive_model_search;
+ FLAC__bool do_escape_coding;
+ unsigned min_residual_partition_order;
+ unsigned max_residual_partition_order;
+ unsigned rice_parameter_search_dist;
+ FLAC__uint64 total_samples_estimate;
+ FLAC__StreamMetadata **metadata;
+ unsigned num_metadata_blocks;
+ FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset;
#if FLAC__HAS_OGG
- FLAC__OggEncoderAspect ogg_encoder_aspect;
+ FLAC__OggEncoderAspect ogg_encoder_aspect;
#endif
} FLAC__StreamEncoderProtected;
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/lpc.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/lpc.c
index a42d7e507..4f8339e55 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/lpc.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/lpc.c
@@ -55,868 +55,738 @@
void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len)
{
- unsigned i;
- for(i = 0; i < data_len; i++)
- out[i] = in[i] * window[i];
+ unsigned i;
+ for(i = 0; i < data_len; i++)
+ out[i] = in[i] * window[i];
}
void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
{
- /* a readable, but slower, version */
+ /* a readable, but slower, version */
#if 0
- FLAC__real d;
- unsigned i;
-
- FLAC__ASSERT(lag > 0);
- FLAC__ASSERT(lag <= data_len);
-
- /*
- * Technically we should subtract the mean first like so:
- * for(i = 0; i < data_len; i++)
- * data[i] -= mean;
- * but it appears not to make enough of a difference to matter, and
- * most signals are already closely centered around zero
- */
- while(lag--)
- {
- for(i = lag, d = 0.0; i < data_len; i++)
- d += data[i] * data[i - lag];
- autoc[lag] = d;
- }
+ FLAC__real d;
+ unsigned i;
+
+ FLAC__ASSERT(lag > 0);
+ FLAC__ASSERT(lag <= data_len);
+
+ /*
+ * Technically we should subtract the mean first like so:
+ * for(i = 0; i < data_len; i++)
+ * data[i] -= mean;
+ * but it appears not to make enough of a difference to matter, and
+ * most signals are already closely centered around zero
+ */
+ while(lag--) {
+ for(i = lag, d = 0.0; i < data_len; i++)
+ d += data[i] * data[i - lag];
+ autoc[lag] = d;
+ }
#endif
- /*
- * this version tends to run faster because of better data locality
- * ('data_len' is usually much larger than 'lag')
- */
- FLAC__real d;
- unsigned sample, coeff;
- const unsigned limit = data_len - lag;
-
- FLAC__ASSERT(lag > 0);
- FLAC__ASSERT(lag <= data_len);
-
- for(coeff = 0; coeff < lag; coeff++)
- autoc[coeff] = 0.0;
- for(sample = 0; sample <= limit; sample++)
- {
- d = data[sample];
- for(coeff = 0; coeff < lag; coeff++)
- autoc[coeff] += d * data[sample+coeff];
- }
- for(; sample < data_len; sample++)
- {
- d = data[sample];
- for(coeff = 0; coeff < data_len - sample; coeff++)
- autoc[coeff] += d * data[sample+coeff];
- }
+ /*
+ * this version tends to run faster because of better data locality
+ * ('data_len' is usually much larger than 'lag')
+ */
+ FLAC__real d;
+ unsigned sample, coeff;
+ const unsigned limit = data_len - lag;
+
+ FLAC__ASSERT(lag > 0);
+ FLAC__ASSERT(lag <= data_len);
+
+ for(coeff = 0; coeff < lag; coeff++)
+ autoc[coeff] = 0.0;
+ for(sample = 0; sample <= limit; sample++) {
+ d = data[sample];
+ for(coeff = 0; coeff < lag; coeff++)
+ autoc[coeff] += d * data[sample+coeff];
+ }
+ for(; sample < data_len; sample++) {
+ d = data[sample];
+ for(coeff = 0; coeff < data_len - sample; coeff++)
+ autoc[coeff] += d * data[sample+coeff];
+ }
}
void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[])
{
- unsigned i, j;
- FLAC__double r, err, ref[FLAC__MAX_LPC_ORDER], lpc[FLAC__MAX_LPC_ORDER];
-
- FLAC__ASSERT(0 != max_order);
- FLAC__ASSERT(0 < *max_order);
- FLAC__ASSERT(*max_order <= FLAC__MAX_LPC_ORDER);
- FLAC__ASSERT(autoc[0] != 0.0);
-
- err = autoc[0];
-
- for(i = 0; i < *max_order; i++)
- {
- /* Sum up this iteration's reflection coefficient. */
- r = -autoc[i+1];
- for(j = 0; j < i; j++)
- r -= lpc[j] * autoc[i-j];
- ref[i] = (r /= err);
-
- /* Update LPC coefficients and total error. */
- lpc[i] = r;
- for(j = 0; j < (i >> 1); j++)
- {
- FLAC__double tmp = lpc[j];
- lpc[j] += r * lpc[i-1-j];
- lpc[i-1-j] += r * tmp;
- }
- if(i & 1)
- lpc[j] += lpc[j] * r;
-
- err *= (1.0 - r * r);
-
- /* save this order */
- for(j = 0; j <= i; j++)
- lp_coeff[i][j] = (FLAC__real)(-lpc[j]); /* negate FIR filter coeff to get predictor coeff */
- error[i] = err;
-
- /* see SF bug #1601812 http://sourceforge.net/tracker/index.php?func=detail&aid=1601812&group_id=13478&atid=113478 */
- if(err == 0.0)
- {
- *max_order = i + 1;
- return;
- }
- }
+ unsigned i, j;
+ FLAC__double r, err, ref[FLAC__MAX_LPC_ORDER], lpc[FLAC__MAX_LPC_ORDER];
+
+ FLAC__ASSERT(0 != max_order);
+ FLAC__ASSERT(0 < *max_order);
+ FLAC__ASSERT(*max_order <= FLAC__MAX_LPC_ORDER);
+ FLAC__ASSERT(autoc[0] != 0.0);
+
+ err = autoc[0];
+
+ for(i = 0; i < *max_order; i++) {
+ /* Sum up this iteration's reflection coefficient. */
+ r = -autoc[i+1];
+ for(j = 0; j < i; j++)
+ r -= lpc[j] * autoc[i-j];
+ ref[i] = (r/=err);
+
+ /* Update LPC coefficients and total error. */
+ lpc[i]=r;
+ for(j = 0; j < (i>>1); j++) {
+ FLAC__double tmp = lpc[j];
+ lpc[j] += r * lpc[i-1-j];
+ lpc[i-1-j] += r * tmp;
+ }
+ if(i & 1)
+ lpc[j] += lpc[j] * r;
+
+ err *= (1.0 - r * r);
+
+ /* save this order */
+ for(j = 0; j <= i; j++)
+ lp_coeff[i][j] = (FLAC__real)(-lpc[j]); /* negate FIR filter coeff to get predictor coeff */
+ error[i] = err;
+
+ /* see SF bug #1601812 http://sourceforge.net/tracker/index.php?func=detail&aid=1601812&group_id=13478&atid=113478 */
+ if(err == 0.0) {
+ *max_order = i+1;
+ return;
+ }
+ }
}
int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift)
{
- unsigned i;
- FLAC__double cmax;
- FLAC__int32 qmax, qmin;
-
- FLAC__ASSERT(precision > 0);
- FLAC__ASSERT(precision >= FLAC__MIN_QLP_COEFF_PRECISION);
-
- /* drop one bit for the sign; from here on out we consider only |lp_coeff[i]| */
- precision--;
- qmax = 1 << precision;
- qmin = -qmax;
- qmax--;
-
- /* calc cmax = max( |lp_coeff[i]| ) */
- cmax = 0.0;
- for(i = 0; i < order; i++)
- {
- const FLAC__double d = fabs(lp_coeff[i]);
- if(d > cmax)
- cmax = d;
- }
-
- if(cmax <= 0.0)
- {
- /* => coefficients are all 0, which means our constant-detect didn't work */
- return 2;
- }
- else
- {
- const int max_shiftlimit = (1 << (FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN - 1)) - 1;
- const int min_shiftlimit = -max_shiftlimit - 1;
- int log2cmax;
-
- (void)frexp(cmax, &log2cmax);
- log2cmax--;
- *shift = (int)precision - log2cmax - 1;
-
- if(*shift > max_shiftlimit)
- *shift = max_shiftlimit;
- else if(*shift < min_shiftlimit)
- return 1;
- }
-
- if(*shift >= 0)
- {
- FLAC__double error = 0.0;
- FLAC__int32 q;
- for(i = 0; i < order; i++)
- {
- error += lp_coeff[i] * (1 << *shift);
+ unsigned i;
+ FLAC__double cmax;
+ FLAC__int32 qmax, qmin;
+
+ FLAC__ASSERT(precision > 0);
+ FLAC__ASSERT(precision >= FLAC__MIN_QLP_COEFF_PRECISION);
+
+ /* drop one bit for the sign; from here on out we consider only |lp_coeff[i]| */
+ precision--;
+ qmax = 1 << precision;
+ qmin = -qmax;
+ qmax--;
+
+ /* calc cmax = max( |lp_coeff[i]| ) */
+ cmax = 0.0;
+ for(i = 0; i < order; i++) {
+ const FLAC__double d = fabs(lp_coeff[i]);
+ if(d > cmax)
+ cmax = d;
+ }
+
+ if(cmax <= 0.0) {
+ /* => coefficients are all 0, which means our constant-detect didn't work */
+ return 2;
+ }
+ else {
+ const int max_shiftlimit = (1 << (FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN-1)) - 1;
+ const int min_shiftlimit = -max_shiftlimit - 1;
+ int log2cmax;
+
+ (void)frexp(cmax, &log2cmax);
+ log2cmax--;
+ *shift = (int)precision - log2cmax - 1;
+
+ if(*shift > max_shiftlimit)
+ *shift = max_shiftlimit;
+ else if(*shift < min_shiftlimit)
+ return 1;
+ }
+
+ if(*shift >= 0) {
+ FLAC__double error = 0.0;
+ FLAC__int32 q;
+ for(i = 0; i < order; i++) {
+ error += lp_coeff[i] * (1 << *shift);
#if 1 /* unfortunately lround() is C99 */
- if(error >= 0.0)
- q = (FLAC__int32)(error + 0.5);
- else
- q = (FLAC__int32)(error - 0.5);
+ if(error >= 0.0)
+ q = (FLAC__int32)(error + 0.5);
+ else
+ q = (FLAC__int32)(error - 0.5);
#else
- q = lround(error);
+ q = lround(error);
#endif
#ifdef FLAC__OVERFLOW_DETECT
- if(q > qmax + 1) /* we expect q==qmax+1 occasionally due to rounding */
- fprintf(stderr, "FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n", q, qmax, *shift, cmax, precision + 1, i, lp_coeff[i]);
- else if(q < qmin)
- fprintf(stderr, "FLAC__lpc_quantize_coefficients: quantizer overflow: q<qmin %d<%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n", q, qmin, *shift, cmax, precision + 1, i, lp_coeff[i]);
+ if(q > qmax+1) /* we expect q==qmax+1 occasionally due to rounding */
+ fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]);
+ else if(q < qmin)
+ fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q<qmin %d<%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmin,*shift,cmax,precision+1,i,lp_coeff[i]);
#endif
- if(q > qmax)
- q = qmax;
- else if(q < qmin)
- q = qmin;
- error -= q;
- qlp_coeff[i] = q;
- }
- }
- /* negative shift is very rare but due to design flaw, negative shift is
- * a NOP in the decoder, so it must be handled specially by scaling down
- * coeffs
- */
- else
- {
- const int nshift = -(*shift);
- FLAC__double error = 0.0;
- FLAC__int32 q;
+ if(q > qmax)
+ q = qmax;
+ else if(q < qmin)
+ q = qmin;
+ error -= q;
+ qlp_coeff[i] = q;
+ }
+ }
+ /* negative shift is very rare but due to design flaw, negative shift is
+ * a NOP in the decoder, so it must be handled specially by scaling down
+ * coeffs
+ */
+ else {
+ const int nshift = -(*shift);
+ FLAC__double error = 0.0;
+ FLAC__int32 q;
#ifdef DEBUG
- fprintf(stderr, "FLAC__lpc_quantize_coefficients: negative shift=%d order=%u cmax=%f\n", *shift, order, cmax);
+ fprintf(stderr,"FLAC__lpc_quantize_coefficients: negative shift=%d order=%u cmax=%f\n", *shift, order, cmax);
#endif
- for(i = 0; i < order; i++)
- {
- error += lp_coeff[i] / (1 << nshift);
+ for(i = 0; i < order; i++) {
+ error += lp_coeff[i] / (1 << nshift);
#if 1 /* unfortunately lround() is C99 */
- if(error >= 0.0)
- q = (FLAC__int32)(error + 0.5);
- else
- q = (FLAC__int32)(error - 0.5);
+ if(error >= 0.0)
+ q = (FLAC__int32)(error + 0.5);
+ else
+ q = (FLAC__int32)(error - 0.5);
#else
- q = lround(error);
+ q = lround(error);
#endif
#ifdef FLAC__OVERFLOW_DETECT
- if(q > qmax + 1) /* we expect q==qmax+1 occasionally due to rounding */
- fprintf(stderr, "FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n", q, qmax, *shift, cmax, precision + 1, i, lp_coeff[i]);
- else if(q < qmin)
- fprintf(stderr, "FLAC__lpc_quantize_coefficients: quantizer overflow: q<qmin %d<%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n", q, qmin, *shift, cmax, precision + 1, i, lp_coeff[i]);
+ if(q > qmax+1) /* we expect q==qmax+1 occasionally due to rounding */
+ fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]);
+ else if(q < qmin)
+ fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q<qmin %d<%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmin,*shift,cmax,precision+1,i,lp_coeff[i]);
#endif
- if(q > qmax)
- q = qmax;
- else if(q < qmin)
- q = qmin;
- error -= q;
- qlp_coeff[i] = q;
- }
- *shift = 0;
- }
-
- return 0;
+ if(q > qmax)
+ q = qmax;
+ else if(q < qmin)
+ q = qmin;
+ error -= q;
+ qlp_coeff[i] = q;
+ }
+ *shift = 0;
+ }
+
+ return 0;
}
void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
{
- FLAC__int64 sumo;
- unsigned i, j;
- FLAC__int32 sum;
- const FLAC__int32 *history;
+ FLAC__int64 sumo;
+ unsigned i, j;
+ FLAC__int32 sum;
+ const FLAC__int32 *history;
#ifdef FLAC__OVERFLOW_DETECT_VERBOSE
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients: data_len=%d, order=%u, lpq=%d", data_len, order, lp_quantization);
- for(i = 0; i < order; i++)
- fprintf(stderr, ", q[%u]=%d", i, qlp_coeff[i]);
- fprintf(stderr, "\n");
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization);
+ for(i=0;i<order;i++)
+ fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]);
+ fprintf(stderr,"\n");
#endif
- FLAC__ASSERT(order > 0);
-
- for(i = 0; i < data_len; i++)
- {
- sumo = 0;
- sum = 0;
- history = data;
- for(j = 0; j < order; j++)
- {
- sum += qlp_coeff[j] * (*(--history));
- sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
+ FLAC__ASSERT(order > 0);
+
+ for(i = 0; i < data_len; i++) {
+ sumo = 0;
+ sum = 0;
+ history = data;
+ for(j = 0; j < order; j++) {
+ sum += qlp_coeff[j] * (*(--history));
+ sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
#if defined _MSC_VER
- if(sumo > 2147483647I64 || sumo < -2147483648I64)
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n", i, j, qlp_coeff[j], *history, sumo);
+ if(sumo > 2147483647I64 || sumo < -2147483648I64)
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo);
#else
- if(sumo > 2147483647ll || sumo < -2147483648ll)
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n", i, j, qlp_coeff[j], *history, (long long)sumo);
+ if(sumo > 2147483647ll || sumo < -2147483648ll)
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,(long long)sumo);
#endif
- }
- *(residual++) = *(data++) - (sum >> lp_quantization);
- }
-
- /* Here's a slower but clearer version:
- for(i = 0; i < data_len; i++) {
- sum = 0;
- for(j = 0; j < order; j++)
- sum += qlp_coeff[j] * data[i-j-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- */
+ }
+ *(residual++) = *(data++) - (sum >> lp_quantization);
+ }
+
+ /* Here's a slower but clearer version:
+ for(i = 0; i < data_len; i++) {
+ sum = 0;
+ for(j = 0; j < order; j++)
+ sum += qlp_coeff[j] * data[i-j-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ */
}
#else /* fully unrolled version for normal use */
{
- int i;
- FLAC__int32 sum;
-
- FLAC__ASSERT(order > 0);
- FLAC__ASSERT(order <= 32);
-
- /*
- * We do unique versions up to 12th order since that's the subset limit.
- * Also they are roughly ordered to match frequency of occurrence to
- * minimize branching.
- */
- if(order <= 12)
- {
- if(order > 8)
- {
- if(order > 10)
- {
- if(order == 12)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[11] * data[i-12];
- sum += qlp_coeff[10] * data[i-11];
- sum += qlp_coeff[9] * data[i-10];
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- else /* order == 11 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[10] * data[i-11];
- sum += qlp_coeff[9] * data[i-10];
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 10)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[9] * data[i-10];
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- else /* order == 9 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- }
- }
- else if(order > 4)
- {
- if(order > 6)
- {
- if(order == 8)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- else /* order == 7 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 6)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- else /* order == 5 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- }
- }
- else
- {
- if(order > 2)
- {
- if(order == 4)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- else /* order == 3 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 2)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
- else /* order == 1 */
- {
- for(i = 0; i < (int)data_len; i++)
- residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) >> lp_quantization);
- }
- }
- }
- }
- else /* order > 12 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- switch(order)
- {
- case 32:
- sum += qlp_coeff[31] * data[i-32];
- case 31:
- sum += qlp_coeff[30] * data[i-31];
- case 30:
- sum += qlp_coeff[29] * data[i-30];
- case 29:
- sum += qlp_coeff[28] * data[i-29];
- case 28:
- sum += qlp_coeff[27] * data[i-28];
- case 27:
- sum += qlp_coeff[26] * data[i-27];
- case 26:
- sum += qlp_coeff[25] * data[i-26];
- case 25:
- sum += qlp_coeff[24] * data[i-25];
- case 24:
- sum += qlp_coeff[23] * data[i-24];
- case 23:
- sum += qlp_coeff[22] * data[i-23];
- case 22:
- sum += qlp_coeff[21] * data[i-22];
- case 21:
- sum += qlp_coeff[20] * data[i-21];
- case 20:
- sum += qlp_coeff[19] * data[i-20];
- case 19:
- sum += qlp_coeff[18] * data[i-19];
- case 18:
- sum += qlp_coeff[17] * data[i-18];
- case 17:
- sum += qlp_coeff[16] * data[i-17];
- case 16:
- sum += qlp_coeff[15] * data[i-16];
- case 15:
- sum += qlp_coeff[14] * data[i-15];
- case 14:
- sum += qlp_coeff[13] * data[i-14];
- case 13:
- sum += qlp_coeff[12] * data[i-13];
- sum += qlp_coeff[11] * data[i-12];
- sum += qlp_coeff[10] * data[i-11];
- sum += qlp_coeff[ 9] * data[i-10];
- sum += qlp_coeff[ 8] * data[i- 9];
- sum += qlp_coeff[ 7] * data[i- 8];
- sum += qlp_coeff[ 6] * data[i- 7];
- sum += qlp_coeff[ 5] * data[i- 6];
- sum += qlp_coeff[ 4] * data[i- 5];
- sum += qlp_coeff[ 3] * data[i- 4];
- sum += qlp_coeff[ 2] * data[i- 3];
- sum += qlp_coeff[ 1] * data[i- 2];
- sum += qlp_coeff[ 0] * data[i- 1];
- }
- residual[i] = data[i] - (sum >> lp_quantization);
- }
- }
+ int i;
+ FLAC__int32 sum;
+
+ FLAC__ASSERT(order > 0);
+ FLAC__ASSERT(order <= 32);
+
+ /*
+ * We do unique versions up to 12th order since that's the subset limit.
+ * Also they are roughly ordered to match frequency of occurrence to
+ * minimize branching.
+ */
+ if(order <= 12) {
+ if(order > 8) {
+ if(order > 10) {
+ if(order == 12) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[11] * data[i-12];
+ sum += qlp_coeff[10] * data[i-11];
+ sum += qlp_coeff[9] * data[i-10];
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 11 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[10] * data[i-11];
+ sum += qlp_coeff[9] * data[i-10];
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 10) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[9] * data[i-10];
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 9 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else if(order > 4) {
+ if(order > 6) {
+ if(order == 8) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 7 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 6) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 5 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else {
+ if(order > 2) {
+ if(order == 4) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 3 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 2) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 1 */
+ for(i = 0; i < (int)data_len; i++)
+ residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) >> lp_quantization);
+ }
+ }
+ }
+ }
+ else { /* order > 12 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ switch(order) {
+ case 32: sum += qlp_coeff[31] * data[i-32];
+ case 31: sum += qlp_coeff[30] * data[i-31];
+ case 30: sum += qlp_coeff[29] * data[i-30];
+ case 29: sum += qlp_coeff[28] * data[i-29];
+ case 28: sum += qlp_coeff[27] * data[i-28];
+ case 27: sum += qlp_coeff[26] * data[i-27];
+ case 26: sum += qlp_coeff[25] * data[i-26];
+ case 25: sum += qlp_coeff[24] * data[i-25];
+ case 24: sum += qlp_coeff[23] * data[i-24];
+ case 23: sum += qlp_coeff[22] * data[i-23];
+ case 22: sum += qlp_coeff[21] * data[i-22];
+ case 21: sum += qlp_coeff[20] * data[i-21];
+ case 20: sum += qlp_coeff[19] * data[i-20];
+ case 19: sum += qlp_coeff[18] * data[i-19];
+ case 18: sum += qlp_coeff[17] * data[i-18];
+ case 17: sum += qlp_coeff[16] * data[i-17];
+ case 16: sum += qlp_coeff[15] * data[i-16];
+ case 15: sum += qlp_coeff[14] * data[i-15];
+ case 14: sum += qlp_coeff[13] * data[i-14];
+ case 13: sum += qlp_coeff[12] * data[i-13];
+ sum += qlp_coeff[11] * data[i-12];
+ sum += qlp_coeff[10] * data[i-11];
+ sum += qlp_coeff[ 9] * data[i-10];
+ sum += qlp_coeff[ 8] * data[i- 9];
+ sum += qlp_coeff[ 7] * data[i- 8];
+ sum += qlp_coeff[ 6] * data[i- 7];
+ sum += qlp_coeff[ 5] * data[i- 6];
+ sum += qlp_coeff[ 4] * data[i- 5];
+ sum += qlp_coeff[ 3] * data[i- 4];
+ sum += qlp_coeff[ 2] * data[i- 3];
+ sum += qlp_coeff[ 1] * data[i- 2];
+ sum += qlp_coeff[ 0] * data[i- 1];
+ }
+ residual[i] = data[i] - (sum >> lp_quantization);
+ }
+ }
}
#endif
void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
{
- unsigned i, j;
- FLAC__int64 sum;
- const FLAC__int32 *history;
+ unsigned i, j;
+ FLAC__int64 sum;
+ const FLAC__int32 *history;
#ifdef FLAC__OVERFLOW_DETECT_VERBOSE
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients_wide: data_len=%d, order=%u, lpq=%d", data_len, order, lp_quantization);
- for(i = 0; i < order; i++)
- fprintf(stderr, ", q[%u]=%d", i, qlp_coeff[i]);
- fprintf(stderr, "\n");
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization);
+ for(i=0;i<order;i++)
+ fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]);
+ fprintf(stderr,"\n");
#endif
- FLAC__ASSERT(order > 0);
-
- for(i = 0; i < data_len; i++)
- {
- sum = 0;
- history = data;
- for(j = 0; j < order; j++)
- sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
- if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32)
- {
+ FLAC__ASSERT(order > 0);
+
+ for(i = 0; i < data_len; i++) {
+ sum = 0;
+ history = data;
+ for(j = 0; j < order; j++)
+ sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
+ if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) {
#if defined _MSC_VER
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization);
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization);
#else
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization));
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization));
#endif
- break;
- }
- if(FLAC__bitmath_silog2_wide((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32)
- {
+ break;
+ }
+ if(FLAC__bitmath_silog2_wide((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) {
#if defined _MSC_VER
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%I64d, residual=%I64d\n", i, *data, sum >> lp_quantization, (FLAC__int64)(*data) - (sum >> lp_quantization));
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%I64d, residual=%I64d\n", i, *data, sum >> lp_quantization, (FLAC__int64)(*data) - (sum >> lp_quantization));
#else
- fprintf(stderr, "FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%lld, residual=%lld\n", i, *data, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*data) - (sum >> lp_quantization)));
+ fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%lld, residual=%lld\n", i, *data, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*data) - (sum >> lp_quantization)));
#endif
- break;
- }
- *(residual++) = *(data++) - (FLAC__int32)(sum >> lp_quantization);
- }
+ break;
+ }
+ *(residual++) = *(data++) - (FLAC__int32)(sum >> lp_quantization);
+ }
}
#else /* fully unrolled version for normal use */
{
- int i;
- FLAC__int64 sum;
-
- FLAC__ASSERT(order > 0);
- FLAC__ASSERT(order <= 32);
-
- /*
- * We do unique versions up to 12th order since that's the subset limit.
- * Also they are roughly ordered to match frequency of occurrence to
- * minimize branching.
- */
- if(order <= 12)
- {
- if(order > 8)
- {
- if(order > 10)
- {
- if(order == 12)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
- sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
- sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 11 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
- sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 10)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 9 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- }
- else if(order > 4)
- {
- if(order > 6)
- {
- if(order == 8)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 7 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 6)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 5 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- }
- else
- {
- if(order > 2)
- {
- if(order == 4)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 3 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 2)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 1 */
- {
- for(i = 0; i < (int)data_len; i++)
- residual[i] = data[i] - (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization);
- }
- }
- }
- }
- else /* order > 12 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- switch(order)
- {
- case 32:
- sum += qlp_coeff[31] * (FLAC__int64)data[i-32];
- case 31:
- sum += qlp_coeff[30] * (FLAC__int64)data[i-31];
- case 30:
- sum += qlp_coeff[29] * (FLAC__int64)data[i-30];
- case 29:
- sum += qlp_coeff[28] * (FLAC__int64)data[i-29];
- case 28:
- sum += qlp_coeff[27] * (FLAC__int64)data[i-28];
- case 27:
- sum += qlp_coeff[26] * (FLAC__int64)data[i-27];
- case 26:
- sum += qlp_coeff[25] * (FLAC__int64)data[i-26];
- case 25:
- sum += qlp_coeff[24] * (FLAC__int64)data[i-25];
- case 24:
- sum += qlp_coeff[23] * (FLAC__int64)data[i-24];
- case 23:
- sum += qlp_coeff[22] * (FLAC__int64)data[i-23];
- case 22:
- sum += qlp_coeff[21] * (FLAC__int64)data[i-22];
- case 21:
- sum += qlp_coeff[20] * (FLAC__int64)data[i-21];
- case 20:
- sum += qlp_coeff[19] * (FLAC__int64)data[i-20];
- case 19:
- sum += qlp_coeff[18] * (FLAC__int64)data[i-19];
- case 18:
- sum += qlp_coeff[17] * (FLAC__int64)data[i-18];
- case 17:
- sum += qlp_coeff[16] * (FLAC__int64)data[i-17];
- case 16:
- sum += qlp_coeff[15] * (FLAC__int64)data[i-16];
- case 15:
- sum += qlp_coeff[14] * (FLAC__int64)data[i-15];
- case 14:
- sum += qlp_coeff[13] * (FLAC__int64)data[i-14];
- case 13:
- sum += qlp_coeff[12] * (FLAC__int64)data[i-13];
- sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
- sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
- sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9];
- sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8];
- sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7];
- sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6];
- sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5];
- sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4];
- sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3];
- sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2];
- sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1];
- }
- residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
- }
- }
+ int i;
+ FLAC__int64 sum;
+
+ FLAC__ASSERT(order > 0);
+ FLAC__ASSERT(order <= 32);
+
+ /*
+ * We do unique versions up to 12th order since that's the subset limit.
+ * Also they are roughly ordered to match frequency of occurrence to
+ * minimize branching.
+ */
+ if(order <= 12) {
+ if(order > 8) {
+ if(order > 10) {
+ if(order == 12) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
+ sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
+ sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 11 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
+ sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 10) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 9 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else if(order > 4) {
+ if(order > 6) {
+ if(order == 8) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 7 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 6) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 5 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else {
+ if(order > 2) {
+ if(order == 4) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 3 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 2) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 1 */
+ for(i = 0; i < (int)data_len; i++)
+ residual[i] = data[i] - (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization);
+ }
+ }
+ }
+ }
+ else { /* order > 12 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ switch(order) {
+ case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32];
+ case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31];
+ case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30];
+ case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29];
+ case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28];
+ case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27];
+ case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26];
+ case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25];
+ case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24];
+ case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23];
+ case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22];
+ case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21];
+ case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20];
+ case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19];
+ case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18];
+ case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17];
+ case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16];
+ case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15];
+ case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14];
+ case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13];
+ sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
+ sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
+ sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9];
+ sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8];
+ sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7];
+ sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6];
+ sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5];
+ sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4];
+ sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3];
+ sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2];
+ sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1];
+ }
+ residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
}
#endif
@@ -925,645 +795,528 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da
void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
{
- FLAC__int64 sumo;
- unsigned i, j;
- FLAC__int32 sum;
- const FLAC__int32 *r = residual, *history;
+ FLAC__int64 sumo;
+ unsigned i, j;
+ FLAC__int32 sum;
+ const FLAC__int32 *r = residual, *history;
#ifdef FLAC__OVERFLOW_DETECT_VERBOSE
- fprintf(stderr, "FLAC__lpc_restore_signal: data_len=%d, order=%u, lpq=%d", data_len, order, lp_quantization);
- for(i = 0; i < order; i++)
- fprintf(stderr, ", q[%u]=%d", i, qlp_coeff[i]);
- fprintf(stderr, "\n");
+ fprintf(stderr,"FLAC__lpc_restore_signal: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization);
+ for(i=0;i<order;i++)
+ fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]);
+ fprintf(stderr,"\n");
#endif
- FLAC__ASSERT(order > 0);
-
- for(i = 0; i < data_len; i++)
- {
- sumo = 0;
- sum = 0;
- history = data;
- for(j = 0; j < order; j++)
- {
- sum += qlp_coeff[j] * (*(--history));
- sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
+ FLAC__ASSERT(order > 0);
+
+ for(i = 0; i < data_len; i++) {
+ sumo = 0;
+ sum = 0;
+ history = data;
+ for(j = 0; j < order; j++) {
+ sum += qlp_coeff[j] * (*(--history));
+ sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
#if defined _MSC_VER
- if(sumo > 2147483647I64 || sumo < -2147483648I64)
- fprintf(stderr, "FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n", i, j, qlp_coeff[j], *history, sumo);
+ if(sumo > 2147483647I64 || sumo < -2147483648I64)
+ fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo);
#else
- if(sumo > 2147483647ll || sumo < -2147483648ll)
- fprintf(stderr, "FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n", i, j, qlp_coeff[j], *history, (long long)sumo);
+ if(sumo > 2147483647ll || sumo < -2147483648ll)
+ fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,(long long)sumo);
#endif
- }
- *(data++) = *(r++) + (sum >> lp_quantization);
- }
-
- /* Here's a slower but clearer version:
- for(i = 0; i < data_len; i++) {
- sum = 0;
- for(j = 0; j < order; j++)
- sum += qlp_coeff[j] * data[i-j-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- */
+ }
+ *(data++) = *(r++) + (sum >> lp_quantization);
+ }
+
+ /* Here's a slower but clearer version:
+ for(i = 0; i < data_len; i++) {
+ sum = 0;
+ for(j = 0; j < order; j++)
+ sum += qlp_coeff[j] * data[i-j-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ */
}
#else /* fully unrolled version for normal use */
{
- int i;
- FLAC__int32 sum;
-
- FLAC__ASSERT(order > 0);
- FLAC__ASSERT(order <= 32);
-
- /*
- * We do unique versions up to 12th order since that's the subset limit.
- * Also they are roughly ordered to match frequency of occurrence to
- * minimize branching.
- */
- if(order <= 12)
- {
- if(order > 8)
- {
- if(order > 10)
- {
- if(order == 12)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[11] * data[i-12];
- sum += qlp_coeff[10] * data[i-11];
- sum += qlp_coeff[9] * data[i-10];
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- else /* order == 11 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[10] * data[i-11];
- sum += qlp_coeff[9] * data[i-10];
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 10)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[9] * data[i-10];
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- else /* order == 9 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[8] * data[i-9];
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- }
- }
- else if(order > 4)
- {
- if(order > 6)
- {
- if(order == 8)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[7] * data[i-8];
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- else /* order == 7 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[6] * data[i-7];
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 6)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[5] * data[i-6];
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- else /* order == 5 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[4] * data[i-5];
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- }
- }
- else
- {
- if(order > 2)
- {
- if(order == 4)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[3] * data[i-4];
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- else /* order == 3 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[2] * data[i-3];
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 2)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[1] * data[i-2];
- sum += qlp_coeff[0] * data[i-1];
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
- else /* order == 1 */
- {
- for(i = 0; i < (int)data_len; i++)
- data[i] = residual[i] + ((qlp_coeff[0] * data[i-1]) >> lp_quantization);
- }
- }
- }
- }
- else /* order > 12 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- switch(order)
- {
- case 32:
- sum += qlp_coeff[31] * data[i-32];
- case 31:
- sum += qlp_coeff[30] * data[i-31];
- case 30:
- sum += qlp_coeff[29] * data[i-30];
- case 29:
- sum += qlp_coeff[28] * data[i-29];
- case 28:
- sum += qlp_coeff[27] * data[i-28];
- case 27:
- sum += qlp_coeff[26] * data[i-27];
- case 26:
- sum += qlp_coeff[25] * data[i-26];
- case 25:
- sum += qlp_coeff[24] * data[i-25];
- case 24:
- sum += qlp_coeff[23] * data[i-24];
- case 23:
- sum += qlp_coeff[22] * data[i-23];
- case 22:
- sum += qlp_coeff[21] * data[i-22];
- case 21:
- sum += qlp_coeff[20] * data[i-21];
- case 20:
- sum += qlp_coeff[19] * data[i-20];
- case 19:
- sum += qlp_coeff[18] * data[i-19];
- case 18:
- sum += qlp_coeff[17] * data[i-18];
- case 17:
- sum += qlp_coeff[16] * data[i-17];
- case 16:
- sum += qlp_coeff[15] * data[i-16];
- case 15:
- sum += qlp_coeff[14] * data[i-15];
- case 14:
- sum += qlp_coeff[13] * data[i-14];
- case 13:
- sum += qlp_coeff[12] * data[i-13];
- sum += qlp_coeff[11] * data[i-12];
- sum += qlp_coeff[10] * data[i-11];
- sum += qlp_coeff[ 9] * data[i-10];
- sum += qlp_coeff[ 8] * data[i- 9];
- sum += qlp_coeff[ 7] * data[i- 8];
- sum += qlp_coeff[ 6] * data[i- 7];
- sum += qlp_coeff[ 5] * data[i- 6];
- sum += qlp_coeff[ 4] * data[i- 5];
- sum += qlp_coeff[ 3] * data[i- 4];
- sum += qlp_coeff[ 2] * data[i- 3];
- sum += qlp_coeff[ 1] * data[i- 2];
- sum += qlp_coeff[ 0] * data[i- 1];
- }
- data[i] = residual[i] + (sum >> lp_quantization);
- }
- }
+ int i;
+ FLAC__int32 sum;
+
+ FLAC__ASSERT(order > 0);
+ FLAC__ASSERT(order <= 32);
+
+ /*
+ * We do unique versions up to 12th order since that's the subset limit.
+ * Also they are roughly ordered to match frequency of occurrence to
+ * minimize branching.
+ */
+ if(order <= 12) {
+ if(order > 8) {
+ if(order > 10) {
+ if(order == 12) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[11] * data[i-12];
+ sum += qlp_coeff[10] * data[i-11];
+ sum += qlp_coeff[9] * data[i-10];
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 11 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[10] * data[i-11];
+ sum += qlp_coeff[9] * data[i-10];
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 10) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[9] * data[i-10];
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 9 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[8] * data[i-9];
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else if(order > 4) {
+ if(order > 6) {
+ if(order == 8) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[7] * data[i-8];
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 7 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[6] * data[i-7];
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 6) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[5] * data[i-6];
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 5 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[4] * data[i-5];
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else {
+ if(order > 2) {
+ if(order == 4) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[3] * data[i-4];
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 3 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[2] * data[i-3];
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 2) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[1] * data[i-2];
+ sum += qlp_coeff[0] * data[i-1];
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
+ else { /* order == 1 */
+ for(i = 0; i < (int)data_len; i++)
+ data[i] = residual[i] + ((qlp_coeff[0] * data[i-1]) >> lp_quantization);
+ }
+ }
+ }
+ }
+ else { /* order > 12 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ switch(order) {
+ case 32: sum += qlp_coeff[31] * data[i-32];
+ case 31: sum += qlp_coeff[30] * data[i-31];
+ case 30: sum += qlp_coeff[29] * data[i-30];
+ case 29: sum += qlp_coeff[28] * data[i-29];
+ case 28: sum += qlp_coeff[27] * data[i-28];
+ case 27: sum += qlp_coeff[26] * data[i-27];
+ case 26: sum += qlp_coeff[25] * data[i-26];
+ case 25: sum += qlp_coeff[24] * data[i-25];
+ case 24: sum += qlp_coeff[23] * data[i-24];
+ case 23: sum += qlp_coeff[22] * data[i-23];
+ case 22: sum += qlp_coeff[21] * data[i-22];
+ case 21: sum += qlp_coeff[20] * data[i-21];
+ case 20: sum += qlp_coeff[19] * data[i-20];
+ case 19: sum += qlp_coeff[18] * data[i-19];
+ case 18: sum += qlp_coeff[17] * data[i-18];
+ case 17: sum += qlp_coeff[16] * data[i-17];
+ case 16: sum += qlp_coeff[15] * data[i-16];
+ case 15: sum += qlp_coeff[14] * data[i-15];
+ case 14: sum += qlp_coeff[13] * data[i-14];
+ case 13: sum += qlp_coeff[12] * data[i-13];
+ sum += qlp_coeff[11] * data[i-12];
+ sum += qlp_coeff[10] * data[i-11];
+ sum += qlp_coeff[ 9] * data[i-10];
+ sum += qlp_coeff[ 8] * data[i- 9];
+ sum += qlp_coeff[ 7] * data[i- 8];
+ sum += qlp_coeff[ 6] * data[i- 7];
+ sum += qlp_coeff[ 5] * data[i- 6];
+ sum += qlp_coeff[ 4] * data[i- 5];
+ sum += qlp_coeff[ 3] * data[i- 4];
+ sum += qlp_coeff[ 2] * data[i- 3];
+ sum += qlp_coeff[ 1] * data[i- 2];
+ sum += qlp_coeff[ 0] * data[i- 1];
+ }
+ data[i] = residual[i] + (sum >> lp_quantization);
+ }
+ }
}
#endif
void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
{
- unsigned i, j;
- FLAC__int64 sum;
- const FLAC__int32 *r = residual, *history;
+ unsigned i, j;
+ FLAC__int64 sum;
+ const FLAC__int32 *r = residual, *history;
#ifdef FLAC__OVERFLOW_DETECT_VERBOSE
- fprintf(stderr, "FLAC__lpc_restore_signal_wide: data_len=%d, order=%u, lpq=%d", data_len, order, lp_quantization);
- for(i = 0; i < order; i++)
- fprintf(stderr, ", q[%u]=%d", i, qlp_coeff[i]);
- fprintf(stderr, "\n");
+ fprintf(stderr,"FLAC__lpc_restore_signal_wide: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization);
+ for(i=0;i<order;i++)
+ fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]);
+ fprintf(stderr,"\n");
#endif
- FLAC__ASSERT(order > 0);
-
- for(i = 0; i < data_len; i++)
- {
- sum = 0;
- history = data;
- for(j = 0; j < order; j++)
- sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
- if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32)
- {
+ FLAC__ASSERT(order > 0);
+
+ for(i = 0; i < data_len; i++) {
+ sum = 0;
+ history = data;
+ for(j = 0; j < order; j++)
+ sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
+ if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) {
#ifdef _MSC_VER
- fprintf(stderr, "FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization);
+ fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization);
#else
- fprintf(stderr, "FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization));
+ fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization));
#endif
- break;
- }
- if(FLAC__bitmath_silog2_wide((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32)
- {
+ break;
+ }
+ if(FLAC__bitmath_silog2_wide((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32) {
#ifdef _MSC_VER
- fprintf(stderr, "FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%I64d, data=%I64d\n", i, *r, sum >> lp_quantization, (FLAC__int64)(*r) + (sum >> lp_quantization));
+ fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%I64d, data=%I64d\n", i, *r, sum >> lp_quantization, (FLAC__int64)(*r) + (sum >> lp_quantization));
#else
- fprintf(stderr, "FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *r, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*r) + (sum >> lp_quantization)));
+ fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *r, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*r) + (sum >> lp_quantization)));
#endif
- break;
- }
- *(data++) = *(r++) + (FLAC__int32)(sum >> lp_quantization);
- }
+ break;
+ }
+ *(data++) = *(r++) + (FLAC__int32)(sum >> lp_quantization);
+ }
}
#else /* fully unrolled version for normal use */
{
- int i;
- FLAC__int64 sum;
-
- FLAC__ASSERT(order > 0);
- FLAC__ASSERT(order <= 32);
-
- /*
- * We do unique versions up to 12th order since that's the subset limit.
- * Also they are roughly ordered to match frequency of occurrence to
- * minimize branching.
- */
- if(order <= 12)
- {
- if(order > 8)
- {
- if(order > 10)
- {
- if(order == 12)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
- sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
- sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 11 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
- sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 10)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 9 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- }
- else if(order > 4)
- {
- if(order > 6)
- {
- if(order == 8)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 7 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 6)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 5 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- }
- else
- {
- if(order > 2)
- {
- if(order == 4)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 3 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- }
- else
- {
- if(order == 2)
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
- sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
- else /* order == 1 */
- {
- for(i = 0; i < (int)data_len; i++)
- data[i] = residual[i] + (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization);
- }
- }
- }
- }
- else /* order > 12 */
- {
- for(i = 0; i < (int)data_len; i++)
- {
- sum = 0;
- switch(order)
- {
- case 32:
- sum += qlp_coeff[31] * (FLAC__int64)data[i-32];
- case 31:
- sum += qlp_coeff[30] * (FLAC__int64)data[i-31];
- case 30:
- sum += qlp_coeff[29] * (FLAC__int64)data[i-30];
- case 29:
- sum += qlp_coeff[28] * (FLAC__int64)data[i-29];
- case 28:
- sum += qlp_coeff[27] * (FLAC__int64)data[i-28];
- case 27:
- sum += qlp_coeff[26] * (FLAC__int64)data[i-27];
- case 26:
- sum += qlp_coeff[25] * (FLAC__int64)data[i-26];
- case 25:
- sum += qlp_coeff[24] * (FLAC__int64)data[i-25];
- case 24:
- sum += qlp_coeff[23] * (FLAC__int64)data[i-24];
- case 23:
- sum += qlp_coeff[22] * (FLAC__int64)data[i-23];
- case 22:
- sum += qlp_coeff[21] * (FLAC__int64)data[i-22];
- case 21:
- sum += qlp_coeff[20] * (FLAC__int64)data[i-21];
- case 20:
- sum += qlp_coeff[19] * (FLAC__int64)data[i-20];
- case 19:
- sum += qlp_coeff[18] * (FLAC__int64)data[i-19];
- case 18:
- sum += qlp_coeff[17] * (FLAC__int64)data[i-18];
- case 17:
- sum += qlp_coeff[16] * (FLAC__int64)data[i-17];
- case 16:
- sum += qlp_coeff[15] * (FLAC__int64)data[i-16];
- case 15:
- sum += qlp_coeff[14] * (FLAC__int64)data[i-15];
- case 14:
- sum += qlp_coeff[13] * (FLAC__int64)data[i-14];
- case 13:
- sum += qlp_coeff[12] * (FLAC__int64)data[i-13];
- sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
- sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
- sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10];
- sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9];
- sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8];
- sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7];
- sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6];
- sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5];
- sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4];
- sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3];
- sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2];
- sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1];
- }
- data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
- }
- }
+ int i;
+ FLAC__int64 sum;
+
+ FLAC__ASSERT(order > 0);
+ FLAC__ASSERT(order <= 32);
+
+ /*
+ * We do unique versions up to 12th order since that's the subset limit.
+ * Also they are roughly ordered to match frequency of occurrence to
+ * minimize branching.
+ */
+ if(order <= 12) {
+ if(order > 8) {
+ if(order > 10) {
+ if(order == 12) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
+ sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
+ sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 11 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
+ sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 10) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 9 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else if(order > 4) {
+ if(order > 6) {
+ if(order == 8) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 7 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 6) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 5 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ }
+ else {
+ if(order > 2) {
+ if(order == 4) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 3 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ }
+ else {
+ if(order == 2) {
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
+ sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
+ else { /* order == 1 */
+ for(i = 0; i < (int)data_len; i++)
+ data[i] = residual[i] + (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization);
+ }
+ }
+ }
+ }
+ else { /* order > 12 */
+ for(i = 0; i < (int)data_len; i++) {
+ sum = 0;
+ switch(order) {
+ case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32];
+ case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31];
+ case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30];
+ case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29];
+ case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28];
+ case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27];
+ case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26];
+ case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25];
+ case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24];
+ case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23];
+ case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22];
+ case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21];
+ case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20];
+ case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19];
+ case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18];
+ case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17];
+ case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16];
+ case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15];
+ case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14];
+ case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13];
+ sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
+ sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
+ sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10];
+ sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9];
+ sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8];
+ sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7];
+ sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6];
+ sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5];
+ sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4];
+ sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3];
+ sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2];
+ sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1];
+ }
+ data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
+ }
+ }
}
#endif
@@ -1571,59 +1324,54 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l
FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples)
{
- FLAC__double error_scale;
+ FLAC__double error_scale;
- FLAC__ASSERT(total_samples > 0);
+ FLAC__ASSERT(total_samples > 0);
- error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples;
+ error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples;
- return FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error, error_scale);
+ return FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error, error_scale);
}
FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale)
{
- if(lpc_error > 0.0)
- {
- FLAC__double bps = (FLAC__double)0.5 * log(error_scale * lpc_error) / M_LN2;
- if(bps >= 0.0)
- return bps;
- else
- return 0.0;
- }
- else if(lpc_error < 0.0) /* error should not be negative but can happen due to inadequate floating-point resolution */
- {
- return 1e32;
- }
- else
- {
- return 0.0;
- }
+ if(lpc_error > 0.0) {
+ FLAC__double bps = (FLAC__double)0.5 * log(error_scale * lpc_error) / M_LN2;
+ if(bps >= 0.0)
+ return bps;
+ else
+ return 0.0;
+ }
+ else if(lpc_error < 0.0) { /* error should not be negative but can happen due to inadequate floating-point resolution */
+ return 1e32;
+ }
+ else {
+ return 0.0;
+ }
}
unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order)
{
- unsigned order, index, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */
- FLAC__double bits, best_bits, error_scale;
+ unsigned order, index, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */
+ FLAC__double bits, best_bits, error_scale;
- FLAC__ASSERT(max_order > 0);
- FLAC__ASSERT(total_samples > 0);
+ FLAC__ASSERT(max_order > 0);
+ FLAC__ASSERT(total_samples > 0);
- error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples;
+ error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples;
- best_index = 0;
- best_bits = (unsigned)(-1);
+ best_index = 0;
+ best_bits = (unsigned)(-1);
- for(index = 0, order = 1; index < max_order; index++, order++)
- {
- bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[index], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * overhead_bits_per_order);
- if(bits < best_bits)
- {
- best_index = index;
- best_bits = bits;
- }
- }
+ for(index = 0, order = 1; index < max_order; index++, order++) {
+ bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[index], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * overhead_bits_per_order);
+ if(bits < best_bits) {
+ best_index = index;
+ best_bits = bits;
+ }
+ }
- return best_index + 1; /* +1 since index of lpc_error[] is order-1 */
+ return best_index+1; /* +1 since index of lpc_error[] is order-1 */
}
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/md5.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/md5.c
index b06b09b06..4fe3cc0ee 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/md5.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/md5.c
@@ -52,152 +52,118 @@
*/
static void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
{
- register FLAC__uint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
+ register FLAC__uint32 a, b, c, d;
+
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
+
+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
+
+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
+
+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
}
#if WORDS_BIGENDIAN
//@@@@@@ OPT: use bswap/intrinsics
static void byteSwap(FLAC__uint32 *buf, unsigned words)
{
- register FLAC__uint32 x;
- do
- {
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- }
- while(--words);
+ register FLAC__uint32 x;
+ do {
+ x = *buf;
+ x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
+ *buf++ = (x >> 16) | (x << 16);
+ } while (--words);
}
static void byteSwapX16(FLAC__uint32 *buf)
{
- register FLAC__uint32 x;
-
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf++ = (x >> 16) | (x << 16);
- x = *buf;
- x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
- *buf = (x >> 16) | (x << 16);
+ register FLAC__uint32 x;
+
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
+ x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf = (x >> 16) | (x << 16);
}
#else
#define byteSwap(buf, words)
@@ -210,39 +176,37 @@ static void byteSwapX16(FLAC__uint32 *buf)
*/
static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, unsigned len)
{
- FLAC__uint32 t;
-
- /* Update byte count */
-
- t = ctx->bytes[0];
- if((ctx->bytes[0] = t + len) < t)
- ctx->bytes[1]++; /* Carry from low to high */
-
- t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
- if(t > len)
- {
- memcpy((FLAC__byte *)ctx->in + 64 - t, buf, len);
- return;
- }
- /* First chunk is an odd size */
- memcpy((FLAC__byte *)ctx->in + 64 - t, buf, t);
- byteSwapX16(ctx->in);
- FLAC__MD5Transform(ctx->buf, ctx->in);
- buf += t;
- len -= t;
-
- /* Process data in 64-byte chunks */
- while(len >= 64)
- {
- memcpy(ctx->in, buf, 64);
- byteSwapX16(ctx->in);
- FLAC__MD5Transform(ctx->buf, ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
- memcpy(ctx->in, buf, len);
+ FLAC__uint32 t;
+
+ /* Update byte count */
+
+ t = ctx->bytes[0];
+ if ((ctx->bytes[0] = t + len) < t)
+ ctx->bytes[1]++; /* Carry from low to high */
+
+ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
+ if (t > len) {
+ memcpy((FLAC__byte *)ctx->in + 64 - t, buf, len);
+ return;
+ }
+ /* First chunk is an odd size */
+ memcpy((FLAC__byte *)ctx->in + 64 - t, buf, t);
+ byteSwapX16(ctx->in);
+ FLAC__MD5Transform(ctx->buf, ctx->in);
+ buf += t;
+ len -= t;
+
+ /* Process data in 64-byte chunks */
+ while (len >= 64) {
+ memcpy(ctx->in, buf, 64);
+ byteSwapX16(ctx->in);
+ FLAC__MD5Transform(ctx->buf, ctx->in);
+ buf += 64;
+ len -= 64;
+ }
+
+ /* Handle any remaining bytes of data. */
+ memcpy(ctx->in, buf, len);
}
/*
@@ -251,16 +215,16 @@ static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, unsign
*/
void FLAC__MD5Init(FLAC__MD5Context *ctx)
{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
- ctx->bytes[0] = 0;
- ctx->bytes[1] = 0;
+ ctx->bytes[0] = 0;
+ ctx->bytes[1] = 0;
- ctx->internal_buf = 0;
- ctx->capacity = 0;
+ ctx->internal_buf = 0;
+ ctx->capacity = 0;
}
/*
@@ -269,40 +233,38 @@ void FLAC__MD5Init(FLAC__MD5Context *ctx)
*/
void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx)
{
- int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
- FLAC__byte *p = (FLAC__byte *)ctx->in + count;
-
- /* Set the first char of padding to 0x80. There is always room. */
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 56 bytes (-8..55) */
- count = 56 - 1 - count;
-
- if(count < 0) /* Padding forces an extra block */
- {
- memset(p, 0, count + 8);
- byteSwapX16(ctx->in);
- FLAC__MD5Transform(ctx->buf, ctx->in);
- p = (FLAC__byte *)ctx->in;
- count = 56;
- }
- memset(p, 0, count);
- byteSwap(ctx->in, 14);
-
- /* Append length in bits and transform */
- ctx->in[14] = ctx->bytes[0] << 3;
- ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
- FLAC__MD5Transform(ctx->buf, ctx->in);
-
- byteSwap(ctx->buf, 4);
- memcpy(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
- if(0 != ctx->internal_buf)
- {
- free(ctx->internal_buf);
- ctx->internal_buf = 0;
- ctx->capacity = 0;
- }
+ int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
+ FLAC__byte *p = (FLAC__byte *)ctx->in + count;
+
+ /* Set the first char of padding to 0x80. There is always room. */
+ *p++ = 0x80;
+
+ /* Bytes of padding needed to make 56 bytes (-8..55) */
+ count = 56 - 1 - count;
+
+ if (count < 0) { /* Padding forces an extra block */
+ memset(p, 0, count + 8);
+ byteSwapX16(ctx->in);
+ FLAC__MD5Transform(ctx->buf, ctx->in);
+ p = (FLAC__byte *)ctx->in;
+ count = 56;
+ }
+ memset(p, 0, count);
+ byteSwap(ctx->in, 14);
+
+ /* Append length in bits and transform */
+ ctx->in[14] = ctx->bytes[0] << 3;
+ ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
+ FLAC__MD5Transform(ctx->buf, ctx->in);
+
+ byteSwap(ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+ if(0 != ctx->internal_buf) {
+ free(ctx->internal_buf);
+ ctx->internal_buf = 0;
+ ctx->capacity = 0;
+ }
}
/*
@@ -310,164 +272,120 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx)
*/
static void format_input_(FLAC__byte *buf, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
{
- unsigned channel, sample;
- register FLAC__int32 a_word;
- register FLAC__byte *buf_ = buf;
+ unsigned channel, sample;
+ register FLAC__int32 a_word;
+ register FLAC__byte *buf_ = buf;
#if WORDS_BIGENDIAN
#else
- if(channels == 2 && bytes_per_sample == 2)
- {
- FLAC__int16 *buf1_ = ((FLAC__int16*)buf_) + 1;
- memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples);
- for(sample = 0; sample < samples; sample++, buf1_ += 2)
- * buf1_ = (FLAC__int16)signal[1][sample];
- }
- else if(channels == 1 && bytes_per_sample == 2)
- {
- FLAC__int16 *buf1_ = (FLAC__int16*)buf_;
- for(sample = 0; sample < samples; sample++)
- *buf1_++ = (FLAC__int16)signal[0][sample];
- }
- else
+ if(channels == 2 && bytes_per_sample == 2) {
+ FLAC__int16 *buf1_ = ((FLAC__int16*)buf_) + 1;
+ memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples);
+ for(sample = 0; sample < samples; sample++, buf1_+=2)
+ *buf1_ = (FLAC__int16)signal[1][sample];
+ }
+ else if(channels == 1 && bytes_per_sample == 2) {
+ FLAC__int16 *buf1_ = (FLAC__int16*)buf_;
+ for(sample = 0; sample < samples; sample++)
+ *buf1_++ = (FLAC__int16)signal[0][sample];
+ }
+ else
#endif
- if(bytes_per_sample == 2)
- {
- if(channels == 2)
- {
- for(sample = 0; sample < samples; sample++)
- {
- a_word = signal[0][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word = signal[1][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- else if(channels == 1)
- {
- for(sample = 0; sample < samples; sample++)
- {
- a_word = signal[0][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- else
- {
- for(sample = 0; sample < samples; sample++)
- {
- for(channel = 0; channel < channels; channel++)
- {
- a_word = signal[channel][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- }
- }
- else if(bytes_per_sample == 3)
- {
- if(channels == 2)
- {
- for(sample = 0; sample < samples; sample++)
- {
- a_word = signal[0][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word = signal[1][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- else if(channels == 1)
- {
- for(sample = 0; sample < samples; sample++)
- {
- a_word = signal[0][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- else
- {
- for(sample = 0; sample < samples; sample++)
- {
- for(channel = 0; channel < channels; channel++)
- {
- a_word = signal[channel][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- }
- }
- else if(bytes_per_sample == 1)
- {
- if(channels == 2)
- {
- for(sample = 0; sample < samples; sample++)
- {
- a_word = signal[0][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word = signal[1][sample];
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- else if(channels == 1)
- {
- for(sample = 0; sample < samples; sample++)
- {
- a_word = signal[0][sample];
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- else
- {
- for(sample = 0; sample < samples; sample++)
- {
- for(channel = 0; channel < channels; channel++)
- {
- a_word = signal[channel][sample];
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- }
- }
- else /* bytes_per_sample == 4, maybe optimize more later */
- {
- for(sample = 0; sample < samples; sample++)
- {
- for(channel = 0; channel < channels; channel++)
- {
- a_word = signal[channel][sample];
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- a_word >>= 8;
- *buf_++ = (FLAC__byte)a_word;
- }
- }
- }
+ if(bytes_per_sample == 2) {
+ if(channels == 2) {
+ for(sample = 0; sample < samples; sample++) {
+ a_word = signal[0][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ a_word = signal[1][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ else if(channels == 1) {
+ for(sample = 0; sample < samples; sample++) {
+ a_word = signal[0][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ else {
+ for(sample = 0; sample < samples; sample++) {
+ for(channel = 0; channel < channels; channel++) {
+ a_word = signal[channel][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ }
+ }
+ else if(bytes_per_sample == 3) {
+ if(channels == 2) {
+ for(sample = 0; sample < samples; sample++) {
+ a_word = signal[0][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ a_word = signal[1][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ else if(channels == 1) {
+ for(sample = 0; sample < samples; sample++) {
+ a_word = signal[0][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ else {
+ for(sample = 0; sample < samples; sample++) {
+ for(channel = 0; channel < channels; channel++) {
+ a_word = signal[channel][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ }
+ }
+ else if(bytes_per_sample == 1) {
+ if(channels == 2) {
+ for(sample = 0; sample < samples; sample++) {
+ a_word = signal[0][sample];
+ *buf_++ = (FLAC__byte)a_word;
+ a_word = signal[1][sample];
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ else if(channels == 1) {
+ for(sample = 0; sample < samples; sample++) {
+ a_word = signal[0][sample];
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ else {
+ for(sample = 0; sample < samples; sample++) {
+ for(channel = 0; channel < channels; channel++) {
+ a_word = signal[channel][sample];
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ }
+ }
+ else { /* bytes_per_sample == 4, maybe optimize more later */
+ for(sample = 0; sample < samples; sample++) {
+ for(channel = 0; channel < channels; channel++) {
+ a_word = signal[channel][sample];
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word; a_word >>= 8;
+ *buf_++ = (FLAC__byte)a_word;
+ }
+ }
+ }
}
/*
@@ -475,30 +393,28 @@ static void format_input_(FLAC__byte *buf, const FLAC__int32 * const signal[], u
*/
FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
{
- const size_t bytes_needed = (size_t)channels * (size_t)samples * (size_t)bytes_per_sample;
-
- /* overflow check */
- if((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample)
- return false;
- if((size_t)channels *(size_t)bytes_per_sample > SIZE_MAX / (size_t)samples)
- return false;
-
- if(ctx->capacity < bytes_needed)
- {
- FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed);
- if(0 == tmp)
- {
- free(ctx->internal_buf);
- if(0 == (ctx->internal_buf = (FLAC__byte*)safe_malloc_(bytes_needed)))
- return false;
- }
- ctx->internal_buf = tmp;
- ctx->capacity = bytes_needed;
- }
-
- format_input_(ctx->internal_buf, signal, channels, samples, bytes_per_sample);
-
- FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed);
-
- return true;
+ const size_t bytes_needed = (size_t)channels * (size_t)samples * (size_t)bytes_per_sample;
+
+ /* overflow check */
+ if((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample)
+ return false;
+ if((size_t)channels * (size_t)bytes_per_sample > SIZE_MAX / (size_t)samples)
+ return false;
+
+ if(ctx->capacity < bytes_needed) {
+ FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed);
+ if(0 == tmp) {
+ free(ctx->internal_buf);
+ if(0 == (ctx->internal_buf = (FLAC__byte*)safe_malloc_(bytes_needed)))
+ return false;
+ }
+ ctx->internal_buf = tmp;
+ ctx->capacity = bytes_needed;
+ }
+
+ format_input_(ctx->internal_buf, signal, channels, samples, bytes_per_sample);
+
+ FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed);
+
+ return true;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/memory.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/memory.c
index 064929b48..1dcba0f57 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/memory.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/memory.c
@@ -39,198 +39,183 @@
void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
{
- void *x;
+ void *x;
- FLAC__ASSERT(0 != aligned_address);
+ FLAC__ASSERT(0 != aligned_address);
#ifdef FLAC__ALIGN_MALLOC_DATA
- /* align on 32-byte (256-bit) boundary */
- x = safe_malloc_add_2op_(bytes, /*+*/31);
+ /* align on 32-byte (256-bit) boundary */
+ x = safe_malloc_add_2op_(bytes, /*+*/31);
#ifdef SIZEOF_VOIDP
#if SIZEOF_VOIDP == 4
- /* could do *aligned_address = x + ((unsigned) (32 - (((unsigned)x) & 31))) & 31; */
- *aligned_address = (void*)(((unsigned)x + 31) & -32);
+ /* could do *aligned_address = x + ((unsigned) (32 - (((unsigned)x) & 31))) & 31; */
+ *aligned_address = (void*)(((unsigned)x + 31) & -32);
#elif SIZEOF_VOIDP == 8
- *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
+ *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
#else
# error Unsupported sizeof(void*)
#endif
#else
- /* there's got to be a better way to do this right for all archs */
- if(sizeof(void*) == sizeof(unsigned))
- *aligned_address = (void*)(((unsigned)x + 31) & -32);
- else if(sizeof(void*) == sizeof(FLAC__uint64))
- *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
- else
- return 0;
+ /* there's got to be a better way to do this right for all archs */
+ if(sizeof(void*) == sizeof(unsigned))
+ *aligned_address = (void*)(((unsigned)x + 31) & -32);
+ else if(sizeof(void*) == sizeof(FLAC__uint64))
+ *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
+ else
+ return 0;
#endif
#else
- x = safe_malloc_(bytes);
- *aligned_address = x;
+ x = safe_malloc_(bytes);
+ *aligned_address = x;
#endif
- return x;
+ return x;
}
FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer)
{
- FLAC__int32 *pu; /* unaligned pointer */
- union /* union needed to comply with C99 pointer aliasing rules */
- {
- FLAC__int32 *pa; /* aligned pointer */
- void *pv; /* aligned pointer alias */
- } u;
-
- FLAC__ASSERT(elements > 0);
- FLAC__ASSERT(0 != unaligned_pointer);
- FLAC__ASSERT(0 != aligned_pointer);
- FLAC__ASSERT(unaligned_pointer != aligned_pointer);
-
- if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
- return false;
-
- pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)elements, &u.pv);
- if(0 == pu)
- {
- return false;
- }
- else
- {
- if(*unaligned_pointer != 0)
- free(*unaligned_pointer);
- *unaligned_pointer = pu;
- *aligned_pointer = u.pa;
- return true;
- }
+ FLAC__int32 *pu; /* unaligned pointer */
+ union { /* union needed to comply with C99 pointer aliasing rules */
+ FLAC__int32 *pa; /* aligned pointer */
+ void *pv; /* aligned pointer alias */
+ } u;
+
+ FLAC__ASSERT(elements > 0);
+ FLAC__ASSERT(0 != unaligned_pointer);
+ FLAC__ASSERT(0 != aligned_pointer);
+ FLAC__ASSERT(unaligned_pointer != aligned_pointer);
+
+ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
+ return false;
+
+ pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)elements, &u.pv);
+ if(0 == pu) {
+ return false;
+ }
+ else {
+ if(*unaligned_pointer != 0)
+ free(*unaligned_pointer);
+ *unaligned_pointer = pu;
+ *aligned_pointer = u.pa;
+ return true;
+ }
}
FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer)
{
- FLAC__uint32 *pu; /* unaligned pointer */
- union /* union needed to comply with C99 pointer aliasing rules */
- {
- FLAC__uint32 *pa; /* aligned pointer */
- void *pv; /* aligned pointer alias */
- } u;
-
- FLAC__ASSERT(elements > 0);
- FLAC__ASSERT(0 != unaligned_pointer);
- FLAC__ASSERT(0 != aligned_pointer);
- FLAC__ASSERT(unaligned_pointer != aligned_pointer);
-
- if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
- return false;
-
- pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
- if(0 == pu)
- {
- return false;
- }
- else
- {
- if(*unaligned_pointer != 0)
- free(*unaligned_pointer);
- *unaligned_pointer = pu;
- *aligned_pointer = u.pa;
- return true;
- }
+ FLAC__uint32 *pu; /* unaligned pointer */
+ union { /* union needed to comply with C99 pointer aliasing rules */
+ FLAC__uint32 *pa; /* aligned pointer */
+ void *pv; /* aligned pointer alias */
+ } u;
+
+ FLAC__ASSERT(elements > 0);
+ FLAC__ASSERT(0 != unaligned_pointer);
+ FLAC__ASSERT(0 != aligned_pointer);
+ FLAC__ASSERT(unaligned_pointer != aligned_pointer);
+
+ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
+ return false;
+
+ pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ if(0 == pu) {
+ return false;
+ }
+ else {
+ if(*unaligned_pointer != 0)
+ free(*unaligned_pointer);
+ *unaligned_pointer = pu;
+ *aligned_pointer = u.pa;
+ return true;
+ }
}
FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer)
{
- FLAC__uint64 *pu; /* unaligned pointer */
- union /* union needed to comply with C99 pointer aliasing rules */
- {
- FLAC__uint64 *pa; /* aligned pointer */
- void *pv; /* aligned pointer alias */
- } u;
-
- FLAC__ASSERT(elements > 0);
- FLAC__ASSERT(0 != unaligned_pointer);
- FLAC__ASSERT(0 != aligned_pointer);
- FLAC__ASSERT(unaligned_pointer != aligned_pointer);
-
- if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
- return false;
-
- pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
- if(0 == pu)
- {
- return false;
- }
- else
- {
- if(*unaligned_pointer != 0)
- free(*unaligned_pointer);
- *unaligned_pointer = pu;
- *aligned_pointer = u.pa;
- return true;
- }
+ FLAC__uint64 *pu; /* unaligned pointer */
+ union { /* union needed to comply with C99 pointer aliasing rules */
+ FLAC__uint64 *pa; /* aligned pointer */
+ void *pv; /* aligned pointer alias */
+ } u;
+
+ FLAC__ASSERT(elements > 0);
+ FLAC__ASSERT(0 != unaligned_pointer);
+ FLAC__ASSERT(0 != aligned_pointer);
+ FLAC__ASSERT(unaligned_pointer != aligned_pointer);
+
+ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
+ return false;
+
+ pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ if(0 == pu) {
+ return false;
+ }
+ else {
+ if(*unaligned_pointer != 0)
+ free(*unaligned_pointer);
+ *unaligned_pointer = pu;
+ *aligned_pointer = u.pa;
+ return true;
+ }
}
FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer)
{
- unsigned *pu; /* unaligned pointer */
- union /* union needed to comply with C99 pointer aliasing rules */
- {
- unsigned *pa; /* aligned pointer */
- void *pv; /* aligned pointer alias */
- } u;
-
- FLAC__ASSERT(elements > 0);
- FLAC__ASSERT(0 != unaligned_pointer);
- FLAC__ASSERT(0 != aligned_pointer);
- FLAC__ASSERT(unaligned_pointer != aligned_pointer);
-
- if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
- return false;
-
- pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
- if(0 == pu)
- {
- return false;
- }
- else
- {
- if(*unaligned_pointer != 0)
- free(*unaligned_pointer);
- *unaligned_pointer = pu;
- *aligned_pointer = u.pa;
- return true;
- }
+ unsigned *pu; /* unaligned pointer */
+ union { /* union needed to comply with C99 pointer aliasing rules */
+ unsigned *pa; /* aligned pointer */
+ void *pv; /* aligned pointer alias */
+ } u;
+
+ FLAC__ASSERT(elements > 0);
+ FLAC__ASSERT(0 != unaligned_pointer);
+ FLAC__ASSERT(0 != aligned_pointer);
+ FLAC__ASSERT(unaligned_pointer != aligned_pointer);
+
+ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
+ return false;
+
+ pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ if(0 == pu) {
+ return false;
+ }
+ else {
+ if(*unaligned_pointer != 0)
+ free(*unaligned_pointer);
+ *unaligned_pointer = pu;
+ *aligned_pointer = u.pa;
+ return true;
+ }
}
#ifndef FLAC__INTEGER_ONLY_LIBRARY
FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer)
{
- FLAC__real *pu; /* unaligned pointer */
- union /* union needed to comply with C99 pointer aliasing rules */
- {
- FLAC__real *pa; /* aligned pointer */
- void *pv; /* aligned pointer alias */
- } u;
-
- FLAC__ASSERT(elements > 0);
- FLAC__ASSERT(0 != unaligned_pointer);
- FLAC__ASSERT(0 != aligned_pointer);
- FLAC__ASSERT(unaligned_pointer != aligned_pointer);
-
- if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
- return false;
-
- pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
- if(0 == pu)
- {
- return false;
- }
- else
- {
- if(*unaligned_pointer != 0)
- free(*unaligned_pointer);
- *unaligned_pointer = pu;
- *aligned_pointer = u.pa;
- return true;
- }
+ FLAC__real *pu; /* unaligned pointer */
+ union { /* union needed to comply with C99 pointer aliasing rules */
+ FLAC__real *pa; /* aligned pointer */
+ void *pv; /* aligned pointer alias */
+ } u;
+
+ FLAC__ASSERT(elements > 0);
+ FLAC__ASSERT(0 != unaligned_pointer);
+ FLAC__ASSERT(0 != aligned_pointer);
+ FLAC__ASSERT(unaligned_pointer != aligned_pointer);
+
+ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
+ return false;
+
+ pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ if(0 == pu) {
+ return false;
+ }
+ else {
+ if(*unaligned_pointer != 0)
+ free(*unaligned_pointer);
+ *unaligned_pointer = pu;
+ *aligned_pointer = u.pa;
+ return true;
+ }
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_iterators.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_iterators.c
index b2ce18027..40d72d45f 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_iterators.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_iterators.c
@@ -148,10 +148,10 @@ static FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIt
#ifdef FLAC__VALGRIND_TESTING
static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
- size_t ret = fwrite(ptr, size, nmemb, stream);
- if(!ferror(stream))
- fflush(stream);
- return ret;
+ size_t ret = fwrite(ptr, size, nmemb, stream);
+ if(!ferror(stream))
+ fflush(stream);
+ return ret;
}
#else
#define local__fwrite fwrite
@@ -167,181 +167,169 @@ static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder
static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
-typedef struct
-{
- FLAC__bool got_error;
- FLAC__StreamMetadata *object;
+typedef struct {
+ FLAC__bool got_error;
+ FLAC__StreamMetadata *object;
} level0_client_data;
static FLAC__StreamMetadata *get_one_metadata_block_(const char *filename, FLAC__MetadataType type)
{
- level0_client_data cd;
- FLAC__StreamDecoder *decoder;
+ level0_client_data cd;
+ FLAC__StreamDecoder *decoder;
- FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != filename);
- cd.got_error = false;
- cd.object = 0;
+ cd.got_error = false;
+ cd.object = 0;
- decoder = FLAC__stream_decoder_new();
+ decoder = FLAC__stream_decoder_new();
- if(0 == decoder)
- return 0;
+ if(0 == decoder)
+ return 0;
- FLAC__stream_decoder_set_md5_checking(decoder, false);
- FLAC__stream_decoder_set_metadata_ignore_all(decoder);
- FLAC__stream_decoder_set_metadata_respond(decoder, type);
+ FLAC__stream_decoder_set_md5_checking(decoder, false);
+ FLAC__stream_decoder_set_metadata_ignore_all(decoder);
+ FLAC__stream_decoder_set_metadata_respond(decoder, type);
- if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &cd) != FLAC__STREAM_DECODER_INIT_STATUS_OK || cd.got_error)
- {
- (void)FLAC__stream_decoder_finish(decoder);
- FLAC__stream_decoder_delete(decoder);
- return 0;
- }
+ if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &cd) != FLAC__STREAM_DECODER_INIT_STATUS_OK || cd.got_error) {
+ (void)FLAC__stream_decoder_finish(decoder);
+ FLAC__stream_decoder_delete(decoder);
+ return 0;
+ }
- if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder) || cd.got_error)
- {
- (void)FLAC__stream_decoder_finish(decoder);
- FLAC__stream_decoder_delete(decoder);
- if(0 != cd.object)
- FLAC__metadata_object_delete(cd.object);
- return 0;
- }
+ if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder) || cd.got_error) {
+ (void)FLAC__stream_decoder_finish(decoder);
+ FLAC__stream_decoder_delete(decoder);
+ if(0 != cd.object)
+ FLAC__metadata_object_delete(cd.object);
+ return 0;
+ }
- (void)FLAC__stream_decoder_finish(decoder);
- FLAC__stream_decoder_delete(decoder);
+ (void)FLAC__stream_decoder_finish(decoder);
+ FLAC__stream_decoder_delete(decoder);
- return cd.object;
+ return cd.object;
}
FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo)
{
- FLAC__StreamMetadata *object;
+ FLAC__StreamMetadata *object;
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != streaminfo);
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != streaminfo);
- object = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_STREAMINFO);
+ object = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_STREAMINFO);
- if(object)
- {
- /* can just copy the contents since STREAMINFO has no internal structure */
- *streaminfo = *object;
- FLAC__metadata_object_delete(object);
- return true;
- }
- else
- {
- return false;
- }
+ if (object) {
+ /* can just copy the contents since STREAMINFO has no internal structure */
+ *streaminfo = *object;
+ FLAC__metadata_object_delete(object);
+ return true;
+ }
+ else {
+ return false;
+ }
}
FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags)
{
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != tags);
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != tags);
- *tags = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ *tags = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_VORBIS_COMMENT);
- return 0 != *tags;
+ return 0 != *tags;
}
FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__StreamMetadata **cuesheet)
{
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != cuesheet);
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != cuesheet);
- *cuesheet = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_CUESHEET);
+ *cuesheet = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_CUESHEET);
- return 0 != *cuesheet;
+ return 0 != *cuesheet;
}
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
- (void)decoder, (void)frame, (void)buffer, (void)client_data;
+ (void)decoder, (void)frame, (void)buffer, (void)client_data;
- return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
- level0_client_data *cd = (level0_client_data *)client_data;
- (void)decoder;
+ level0_client_data *cd = (level0_client_data *)client_data;
+ (void)decoder;
- /*
- * we assume we only get here when the one metadata block we were
- * looking for was passed to us
- */
- if(!cd->got_error && 0 == cd->object)
- {
- if(0 == (cd->object = FLAC__metadata_object_clone(metadata)))
- cd->got_error = true;
- }
+ /*
+ * we assume we only get here when the one metadata block we were
+ * looking for was passed to us
+ */
+ if(!cd->got_error && 0 == cd->object) {
+ if(0 == (cd->object = FLAC__metadata_object_clone(metadata)))
+ cd->got_error = true;
+ }
}
void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
{
- level0_client_data *cd = (level0_client_data *)client_data;
- (void)decoder;
+ level0_client_data *cd = (level0_client_data *)client_data;
+ (void)decoder;
- if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC)
- cd->got_error = true;
+ if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC)
+ cd->got_error = true;
}
FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors)
{
- FLAC__Metadata_SimpleIterator *it;
- FLAC__uint64 max_area_seen = 0;
- FLAC__uint64 max_depth_seen = 0;
-
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != picture);
-
- *picture = 0;
-
- it = FLAC__metadata_simple_iterator_new();
- if(0 == it)
- return false;
- if(!FLAC__metadata_simple_iterator_init(it, filename, /*read_only=*/true, /*preserve_file_stats=*/true))
- {
- FLAC__metadata_simple_iterator_delete(it);
- return false;
- }
- do
- {
- if(FLAC__metadata_simple_iterator_get_block_type(it) == FLAC__METADATA_TYPE_PICTURE)
- {
- FLAC__StreamMetadata *obj = FLAC__metadata_simple_iterator_get_block(it);
- FLAC__uint64 area = (FLAC__uint64)obj->data.picture.width * (FLAC__uint64)obj->data.picture.height;
- /* check constraints */
- if(
- (type == (FLAC__StreamMetadata_Picture_Type)(-1) || type == obj->data.picture.type) &&
- (mime_type == 0 || !strcmp(mime_type, obj->data.picture.mime_type)) &&
- (description == 0 || !strcmp((const char *)description, (const char *)obj->data.picture.description)) &&
- obj->data.picture.width <= max_width &&
- obj->data.picture.height <= max_height &&
- obj->data.picture.depth <= max_depth &&
- obj->data.picture.colors <= max_colors &&
- (area > max_area_seen || (area == max_area_seen && obj->data.picture.depth > max_depth_seen))
- )
- {
- if(*picture)
- FLAC__metadata_object_delete(*picture);
- *picture = obj;
- max_area_seen = area;
- max_depth_seen = obj->data.picture.depth;
- }
- else
- {
- FLAC__metadata_object_delete(obj);
- }
- }
- }
- while(FLAC__metadata_simple_iterator_next(it));
-
- FLAC__metadata_simple_iterator_delete(it);
-
- return (0 != *picture);
+ FLAC__Metadata_SimpleIterator *it;
+ FLAC__uint64 max_area_seen = 0;
+ FLAC__uint64 max_depth_seen = 0;
+
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != picture);
+
+ *picture = 0;
+
+ it = FLAC__metadata_simple_iterator_new();
+ if(0 == it)
+ return false;
+ if(!FLAC__metadata_simple_iterator_init(it, filename, /*read_only=*/true, /*preserve_file_stats=*/true)) {
+ FLAC__metadata_simple_iterator_delete(it);
+ return false;
+ }
+ do {
+ if(FLAC__metadata_simple_iterator_get_block_type(it) == FLAC__METADATA_TYPE_PICTURE) {
+ FLAC__StreamMetadata *obj = FLAC__metadata_simple_iterator_get_block(it);
+ FLAC__uint64 area = (FLAC__uint64)obj->data.picture.width * (FLAC__uint64)obj->data.picture.height;
+ /* check constraints */
+ if(
+ (type == (FLAC__StreamMetadata_Picture_Type)(-1) || type == obj->data.picture.type) &&
+ (mime_type == 0 || !strcmp(mime_type, obj->data.picture.mime_type)) &&
+ (description == 0 || !strcmp((const char *)description, (const char *)obj->data.picture.description)) &&
+ obj->data.picture.width <= max_width &&
+ obj->data.picture.height <= max_height &&
+ obj->data.picture.depth <= max_depth &&
+ obj->data.picture.colors <= max_colors &&
+ (area > max_area_seen || (area == max_area_seen && obj->data.picture.depth > max_depth_seen))
+ ) {
+ if(*picture)
+ FLAC__metadata_object_delete(*picture);
+ *picture = obj;
+ max_area_seen = area;
+ max_depth_seen = obj->data.picture.depth;
+ }
+ else {
+ FLAC__metadata_object_delete(obj);
+ }
+ }
+ } while(FLAC__metadata_simple_iterator_next(it));
+
+ FLAC__metadata_simple_iterator_delete(it);
+
+ return (0 != *picture);
}
@@ -354,150 +342,138 @@ FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__Strea
#define SIMPLE_ITERATOR_MAX_PUSH_DEPTH (1+4)
/* 1 for initial offset, +4 for our own personal use */
-struct FLAC__Metadata_SimpleIterator
-{
- FILE *file;
- char *filename, *tempfile_path_prefix;
- struct stat stats;
- FLAC__bool has_stats;
- FLAC__bool is_writable;
- FLAC__Metadata_SimpleIteratorStatus status;
- off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH];
- off_t first_offset; /* this is the offset to the STREAMINFO block */
- unsigned depth;
- /* this is the metadata block header of the current block we are pointing to: */
- FLAC__bool is_last;
- FLAC__MetadataType type;
- unsigned length;
+struct FLAC__Metadata_SimpleIterator {
+ FILE *file;
+ char *filename, *tempfile_path_prefix;
+ struct stat stats;
+ FLAC__bool has_stats;
+ FLAC__bool is_writable;
+ FLAC__Metadata_SimpleIteratorStatus status;
+ off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH];
+ off_t first_offset; /* this is the offset to the STREAMINFO block */
+ unsigned depth;
+ /* this is the metadata block header of the current block we are pointing to: */
+ FLAC__bool is_last;
+ FLAC__MetadataType type;
+ unsigned length;
};
-FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] =
-{
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR",
- "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR"
+FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = {
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR",
+ "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR"
};
FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(void)
{
- FLAC__Metadata_SimpleIterator *iterator = (FLAC__Metadata_SimpleIterator*)calloc(1, sizeof(FLAC__Metadata_SimpleIterator));
+ FLAC__Metadata_SimpleIterator *iterator = (FLAC__Metadata_SimpleIterator*)calloc(1, sizeof(FLAC__Metadata_SimpleIterator));
- if(0 != iterator)
- {
- iterator->file = 0;
- iterator->filename = 0;
- iterator->tempfile_path_prefix = 0;
- iterator->has_stats = false;
- iterator->is_writable = false;
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
- iterator->first_offset = iterator->offset[0] = -1;
- iterator->depth = 0;
- }
+ if(0 != iterator) {
+ iterator->file = 0;
+ iterator->filename = 0;
+ iterator->tempfile_path_prefix = 0;
+ iterator->has_stats = false;
+ iterator->is_writable = false;
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ iterator->first_offset = iterator->offset[0] = -1;
+ iterator->depth = 0;
+ }
- return iterator;
+ return iterator;
}
static void simple_iterator_free_guts_(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
-
- if(0 != iterator->file)
- {
- fclose(iterator->file);
- iterator->file = 0;
- if(iterator->has_stats)
- set_file_stats_(iterator->filename, &iterator->stats);
- }
- if(0 != iterator->filename)
- {
- free(iterator->filename);
- iterator->filename = 0;
- }
- if(0 != iterator->tempfile_path_prefix)
- {
- free(iterator->tempfile_path_prefix);
- iterator->tempfile_path_prefix = 0;
- }
+ FLAC__ASSERT(0 != iterator);
+
+ if(0 != iterator->file) {
+ fclose(iterator->file);
+ iterator->file = 0;
+ if(iterator->has_stats)
+ set_file_stats_(iterator->filename, &iterator->stats);
+ }
+ if(0 != iterator->filename) {
+ free(iterator->filename);
+ iterator->filename = 0;
+ }
+ if(0 != iterator->tempfile_path_prefix) {
+ free(iterator->tempfile_path_prefix);
+ iterator->tempfile_path_prefix = 0;
+ }
}
FLAC_API void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator);
- simple_iterator_free_guts_(iterator);
- free(iterator);
+ simple_iterator_free_guts_(iterator);
+ free(iterator);
}
FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__Metadata_SimpleIteratorStatus status;
+ FLAC__Metadata_SimpleIteratorStatus status;
- FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator);
- status = iterator->status;
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
- return status;
+ status = iterator->status;
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return status;
}
static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool read_only)
{
- unsigned ret;
-
- FLAC__ASSERT(0 != iterator);
-
- if(read_only || 0 == (iterator->file = fopen(iterator->filename, "r+b")))
- {
- iterator->is_writable = false;
- if(read_only || errno == EACCES)
- {
- if(0 == (iterator->file = fopen(iterator->filename, "rb")))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
- return false;
- }
- }
- else
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
- return false;
- }
- }
- else
- {
- iterator->is_writable = true;
- }
-
- ret = seek_to_first_metadata_block_(iterator->file);
- switch(ret)
- {
- case 0:
- iterator->depth = 0;
- iterator->first_offset = iterator->offset[iterator->depth] = ftello(iterator->file);
- return read_metadata_block_header_(iterator);
- case 1:
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- case 2:
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- case 3:
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE;
- return false;
- default:
- FLAC__ASSERT(0);
- return false;
- }
+ unsigned ret;
+
+ FLAC__ASSERT(0 != iterator);
+
+ if(read_only || 0 == (iterator->file = fopen(iterator->filename, "r+b"))) {
+ iterator->is_writable = false;
+ if(read_only || errno == EACCES) {
+ if(0 == (iterator->file = fopen(iterator->filename, "rb"))) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
+ return false;
+ }
+ }
+ else {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
+ return false;
+ }
+ }
+ else {
+ iterator->is_writable = true;
+ }
+
+ ret = seek_to_first_metadata_block_(iterator->file);
+ switch(ret) {
+ case 0:
+ iterator->depth = 0;
+ iterator->first_offset = iterator->offset[iterator->depth] = ftello(iterator->file);
+ return read_metadata_block_header_(iterator);
+ case 1:
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ case 2:
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ case 3:
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE;
+ return false;
+ default:
+ FLAC__ASSERT(0);
+ return false;
+ }
}
#if 0
@@ -520,440 +496,391 @@ FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *it
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats)
{
- const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'rename(...)' for what it will take to finish implementing this */
+ const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'rename(...)' for what it will take to finish implementing this */
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != filename);
- simple_iterator_free_guts_(iterator);
+ simple_iterator_free_guts_(iterator);
- if(!read_only && preserve_file_stats)
- iterator->has_stats = get_file_stats_(filename, &iterator->stats);
+ if(!read_only && preserve_file_stats)
+ iterator->has_stats = get_file_stats_(filename, &iterator->stats);
- if(0 == (iterator->filename = strdup(filename)))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(0 != tempfile_path_prefix && 0 == (iterator->tempfile_path_prefix = strdup(tempfile_path_prefix)))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
+ if(0 == (iterator->filename = strdup(filename))) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(0 != tempfile_path_prefix && 0 == (iterator->tempfile_path_prefix = strdup(tempfile_path_prefix))) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
- return simple_iterator_prime_input_(iterator, read_only);
+ return simple_iterator_prime_input_(iterator, read_only);
}
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- return iterator->is_writable;
+ return iterator->is_writable;
}
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- if(iterator->is_last)
- return false;
+ if(iterator->is_last)
+ return false;
- if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- iterator->offset[iterator->depth] = ftello(iterator->file);
+ iterator->offset[iterator->depth] = ftello(iterator->file);
- return read_metadata_block_header_(iterator);
+ return read_metadata_block_header_(iterator);
}
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator)
{
- off_t this_offset;
+ off_t this_offset;
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- if(iterator->offset[iterator->depth] == iterator->first_offset)
- return false;
+ if(iterator->offset[iterator->depth] == iterator->first_offset)
+ return false;
- if(0 != fseeko(iterator->file, iterator->first_offset, SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
- this_offset = iterator->first_offset;
- if(!read_metadata_block_header_(iterator))
- return false;
+ if(0 != fseeko(iterator->file, iterator->first_offset, SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
+ this_offset = iterator->first_offset;
+ if(!read_metadata_block_header_(iterator))
+ return false;
- /* we ignore any error from ftello() and catch it in fseeko() */
- while(ftello(iterator->file) + (off_t)iterator->length < iterator->offset[iterator->depth])
- {
- if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
- this_offset = ftello(iterator->file);
- if(!read_metadata_block_header_(iterator))
- return false;
- }
+ /* we ignore any error from ftello() and catch it in fseeko() */
+ while(ftello(iterator->file) + (off_t)iterator->length < iterator->offset[iterator->depth]) {
+ if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
+ this_offset = ftello(iterator->file);
+ if(!read_metadata_block_header_(iterator))
+ return false;
+ }
- iterator->offset[iterator->depth] = this_offset;
+ iterator->offset[iterator->depth] = this_offset;
- return true;
+ return true;
}
/*@@@@add to tests*/
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- return iterator->is_last;
+ return iterator->is_last;
}
/*@@@@add to tests*/
FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- return iterator->offset[iterator->depth];
+ return iterator->offset[iterator->depth];
}
FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- return iterator->type;
+ return iterator->type;
}
/*@@@@add to tests*/
FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- return iterator->length;
+ return iterator->length;
}
/*@@@@add to tests*/
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id)
{
- const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+ const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
- FLAC__ASSERT(0 != id);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != id);
- if(iterator->type != FLAC__METADATA_TYPE_APPLICATION)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
- return false;
- }
+ if(iterator->type != FLAC__METADATA_TYPE_APPLICATION) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
+ return false;
+ }
- if(fread(id, 1, id_bytes, iterator->file) != id_bytes)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
+ if(fread(id, 1, id_bytes, iterator->file) != id_bytes) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
- /* back up */
- if(0 != fseeko(iterator->file, -((int)id_bytes), SEEK_CUR))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ /* back up */
+ if(0 != fseeko(iterator->file, -((int)id_bytes), SEEK_CUR)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- return true;
+ return true;
}
FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__StreamMetadata *block = FLAC__metadata_object_new(iterator->type);
+ FLAC__StreamMetadata *block = FLAC__metadata_object_new(iterator->type);
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- if(0 != block)
- {
- block->is_last = iterator->is_last;
- block->length = iterator->length;
+ if(0 != block) {
+ block->is_last = iterator->is_last;
+ block->length = iterator->length;
- if(!read_metadata_block_data_(iterator, block))
- {
- FLAC__metadata_object_delete(block);
- return 0;
- }
+ if(!read_metadata_block_data_(iterator, block)) {
+ FLAC__metadata_object_delete(block);
+ return 0;
+ }
- /* back up to the beginning of the block data to stay consistent */
- if(0 != fseeko(iterator->file, iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH, SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- FLAC__metadata_object_delete(block);
- return 0;
- }
- }
- else
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ /* back up to the beginning of the block data to stay consistent */
+ if(0 != fseeko(iterator->file, iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH, SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ FLAC__metadata_object_delete(block);
+ return 0;
+ }
+ }
+ else
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- return block;
+ return block;
}
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding)
{
- FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];)
- FLAC__bool ret;
-
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
- FLAC__ASSERT(0 != block);
-
- if(!iterator->is_writable)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE;
- return false;
- }
-
- if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO || block->type == FLAC__METADATA_TYPE_STREAMINFO)
- {
- if(iterator->type != block->type)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
- return false;
- }
- }
-
- block->is_last = iterator->is_last;
-
- if(iterator->length == block->length)
- return write_metadata_block_stationary_(iterator, block);
- else if(iterator->length > block->length)
- {
- if(use_padding && iterator->length >= FLAC__STREAM_METADATA_HEADER_LENGTH + block->length)
- {
- ret = write_metadata_block_stationary_with_padding_(iterator, block, iterator->length - FLAC__STREAM_METADATA_HEADER_LENGTH - block->length, block->is_last);
- FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- else
- {
- ret = rewrite_whole_file_(iterator, block, /*append=*/false);
- FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- }
- else /* iterator->length < block->length */
- {
- unsigned padding_leftover = 0;
- FLAC__bool padding_is_last = false;
- if(use_padding)
- {
- /* first see if we can even use padding */
- if(iterator->is_last)
- {
- use_padding = false;
- }
- else
- {
- const unsigned extra_padding_bytes_required = block->length - iterator->length;
- simple_iterator_push_(iterator);
- if(!FLAC__metadata_simple_iterator_next(iterator))
- {
- (void)simple_iterator_pop_(iterator);
- return false;
- }
- if(iterator->type != FLAC__METADATA_TYPE_PADDING)
- {
- use_padding = false;
- }
- else
- {
- if(FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length == extra_padding_bytes_required)
- {
- padding_leftover = 0;
- block->is_last = iterator->is_last;
- }
- else if(iterator->length < extra_padding_bytes_required)
- use_padding = false;
- else
- {
- padding_leftover = FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length - extra_padding_bytes_required;
- padding_is_last = iterator->is_last;
- block->is_last = false;
- }
- }
- if(!simple_iterator_pop_(iterator))
- return false;
- }
- }
- if(use_padding)
- {
- if(padding_leftover == 0)
- {
- ret = write_metadata_block_stationary_(iterator, block);
- FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- else
- {
- FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH);
- ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
- FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- }
- else
- {
- ret = rewrite_whole_file_(iterator, block, /*append=*/false);
- FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- }
+ FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];)
+ FLAC__bool ret;
+
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != block);
+
+ if(!iterator->is_writable) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE;
+ return false;
+ }
+
+ if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO || block->type == FLAC__METADATA_TYPE_STREAMINFO) {
+ if(iterator->type != block->type) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
+ return false;
+ }
+ }
+
+ block->is_last = iterator->is_last;
+
+ if(iterator->length == block->length)
+ return write_metadata_block_stationary_(iterator, block);
+ else if(iterator->length > block->length) {
+ if(use_padding && iterator->length >= FLAC__STREAM_METADATA_HEADER_LENGTH + block->length) {
+ ret = write_metadata_block_stationary_with_padding_(iterator, block, iterator->length - FLAC__STREAM_METADATA_HEADER_LENGTH - block->length, block->is_last);
+ FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ else {
+ ret = rewrite_whole_file_(iterator, block, /*append=*/false);
+ FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ }
+ else /* iterator->length < block->length */ {
+ unsigned padding_leftover = 0;
+ FLAC__bool padding_is_last = false;
+ if(use_padding) {
+ /* first see if we can even use padding */
+ if(iterator->is_last) {
+ use_padding = false;
+ }
+ else {
+ const unsigned extra_padding_bytes_required = block->length - iterator->length;
+ simple_iterator_push_(iterator);
+ if(!FLAC__metadata_simple_iterator_next(iterator)) {
+ (void)simple_iterator_pop_(iterator);
+ return false;
+ }
+ if(iterator->type != FLAC__METADATA_TYPE_PADDING) {
+ use_padding = false;
+ }
+ else {
+ if(FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length == extra_padding_bytes_required) {
+ padding_leftover = 0;
+ block->is_last = iterator->is_last;
+ }
+ else if(iterator->length < extra_padding_bytes_required)
+ use_padding = false;
+ else {
+ padding_leftover = FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length - extra_padding_bytes_required;
+ padding_is_last = iterator->is_last;
+ block->is_last = false;
+ }
+ }
+ if(!simple_iterator_pop_(iterator))
+ return false;
+ }
+ }
+ if(use_padding) {
+ if(padding_leftover == 0) {
+ ret = write_metadata_block_stationary_(iterator, block);
+ FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ else {
+ FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH);
+ ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
+ FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ }
+ else {
+ ret = rewrite_whole_file_(iterator, block, /*append=*/false);
+ FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ }
}
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding)
{
- unsigned padding_leftover = 0;
- FLAC__bool padding_is_last = false;
-
- FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;)
- FLAC__bool ret;
-
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
- FLAC__ASSERT(0 != block);
-
- if(!iterator->is_writable)
- return false;
-
- if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
- return false;
- }
-
- block->is_last = iterator->is_last;
-
- if(use_padding)
- {
- /* first see if we can even use padding */
- if(iterator->is_last)
- {
- use_padding = false;
- }
- else
- {
- simple_iterator_push_(iterator);
- if(!FLAC__metadata_simple_iterator_next(iterator))
- {
- (void)simple_iterator_pop_(iterator);
- return false;
- }
- if(iterator->type != FLAC__METADATA_TYPE_PADDING)
- {
- use_padding = false;
- }
- else
- {
- if(iterator->length == block->length)
- {
- padding_leftover = 0;
- block->is_last = iterator->is_last;
- }
- else if(iterator->length < FLAC__STREAM_METADATA_HEADER_LENGTH + block->length)
- use_padding = false;
- else
- {
- padding_leftover = iterator->length - block->length;
- padding_is_last = iterator->is_last;
- block->is_last = false;
- }
- }
- if(!simple_iterator_pop_(iterator))
- return false;
- }
- }
- if(use_padding)
- {
- /* move to the next block, which is suitable padding */
- if(!FLAC__metadata_simple_iterator_next(iterator))
- return false;
- if(padding_leftover == 0)
- {
- ret = write_metadata_block_stationary_(iterator, block);
- FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- else
- {
- FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH);
- ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
- FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
- }
- else
- {
- ret = rewrite_whole_file_(iterator, block, /*append=*/true);
- FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
- FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
- return ret;
- }
+ unsigned padding_leftover = 0;
+ FLAC__bool padding_is_last = false;
+
+ FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;)
+ FLAC__bool ret;
+
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != block);
+
+ if(!iterator->is_writable)
+ return false;
+
+ if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
+ return false;
+ }
+
+ block->is_last = iterator->is_last;
+
+ if(use_padding) {
+ /* first see if we can even use padding */
+ if(iterator->is_last) {
+ use_padding = false;
+ }
+ else {
+ simple_iterator_push_(iterator);
+ if(!FLAC__metadata_simple_iterator_next(iterator)) {
+ (void)simple_iterator_pop_(iterator);
+ return false;
+ }
+ if(iterator->type != FLAC__METADATA_TYPE_PADDING) {
+ use_padding = false;
+ }
+ else {
+ if(iterator->length == block->length) {
+ padding_leftover = 0;
+ block->is_last = iterator->is_last;
+ }
+ else if(iterator->length < FLAC__STREAM_METADATA_HEADER_LENGTH + block->length)
+ use_padding = false;
+ else {
+ padding_leftover = iterator->length - block->length;
+ padding_is_last = iterator->is_last;
+ block->is_last = false;
+ }
+ }
+ if(!simple_iterator_pop_(iterator))
+ return false;
+ }
+ }
+ if(use_padding) {
+ /* move to the next block, which is suitable padding */
+ if(!FLAC__metadata_simple_iterator_next(iterator))
+ return false;
+ if(padding_leftover == 0) {
+ ret = write_metadata_block_stationary_(iterator, block);
+ FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ else {
+ FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH);
+ ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
+ FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
+ }
+ else {
+ ret = rewrite_whole_file_(iterator, block, /*append=*/true);
+ FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
+ FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
+ return ret;
+ }
}
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding)
{
- FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];)
- FLAC__bool ret;
-
- if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
- return false;
- }
-
- if(use_padding)
- {
- FLAC__StreamMetadata *padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING);
- if(0 == padding)
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- padding->length = iterator->length;
- if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false))
- {
- FLAC__metadata_object_delete(padding);
- return false;
- }
- FLAC__metadata_object_delete(padding);
- if(!FLAC__metadata_simple_iterator_prev(iterator))
- return false;
- FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset);
- FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset);
- return true;
- }
- else
- {
- ret = rewrite_whole_file_(iterator, 0, /*append=*/false);
- FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset);
- FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset);
- return ret;
- }
+ FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];)
+ FLAC__bool ret;
+
+ if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
+ return false;
+ }
+
+ if(use_padding) {
+ FLAC__StreamMetadata *padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING);
+ if(0 == padding) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ padding->length = iterator->length;
+ if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false)) {
+ FLAC__metadata_object_delete(padding);
+ return false;
+ }
+ FLAC__metadata_object_delete(padding);
+ if(!FLAC__metadata_simple_iterator_prev(iterator))
+ return false;
+ FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset);
+ FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset);
+ return true;
+ }
+ else {
+ ret = rewrite_whole_file_(iterator, 0, /*append=*/false);
+ FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset);
+ FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset);
+ return ret;
+ }
}
@@ -965,228 +892,221 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_S
***************************************************************************/
-typedef struct FLAC__Metadata_Node
-{
- FLAC__StreamMetadata *data;
- struct FLAC__Metadata_Node *prev, *next;
+typedef struct FLAC__Metadata_Node {
+ FLAC__StreamMetadata *data;
+ struct FLAC__Metadata_Node *prev, *next;
} FLAC__Metadata_Node;
-struct FLAC__Metadata_Chain
-{
- char *filename; /* will be NULL if using callbacks */
- FLAC__bool is_ogg;
- FLAC__Metadata_Node *head;
- FLAC__Metadata_Node *tail;
- unsigned nodes;
- FLAC__Metadata_ChainStatus status;
- off_t first_offset, last_offset;
- /*
- * This is the length of the chain initially read from the FLAC file.
- * it is used to compare against the current length to decide whether
- * or not the whole file has to be rewritten.
- */
- off_t initial_length;
- /* @@@ hacky, these are currently only needed by ogg reader */
- FLAC__IOHandle handle;
- FLAC__IOCallback_Read read_cb;
+struct FLAC__Metadata_Chain {
+ char *filename; /* will be NULL if using callbacks */
+ FLAC__bool is_ogg;
+ FLAC__Metadata_Node *head;
+ FLAC__Metadata_Node *tail;
+ unsigned nodes;
+ FLAC__Metadata_ChainStatus status;
+ off_t first_offset, last_offset;
+ /*
+ * This is the length of the chain initially read from the FLAC file.
+ * it is used to compare against the current length to decide whether
+ * or not the whole file has to be rewritten.
+ */
+ off_t initial_length;
+ /* @@@ hacky, these are currently only needed by ogg reader */
+ FLAC__IOHandle handle;
+ FLAC__IOCallback_Read read_cb;
};
-struct FLAC__Metadata_Iterator
-{
- FLAC__Metadata_Chain *chain;
- FLAC__Metadata_Node *current;
+struct FLAC__Metadata_Iterator {
+ FLAC__Metadata_Chain *chain;
+ FLAC__Metadata_Node *current;
};
-FLAC_API const char * const FLAC__Metadata_ChainStatusString[] =
-{
- "FLAC__METADATA_CHAIN_STATUS_OK",
- "FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT",
- "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE",
- "FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE",
- "FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE",
- "FLAC__METADATA_CHAIN_STATUS_BAD_METADATA",
- "FLAC__METADATA_CHAIN_STATUS_READ_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR",
- "FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS",
- "FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH",
- "FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL"
+FLAC_API const char * const FLAC__Metadata_ChainStatusString[] = {
+ "FLAC__METADATA_CHAIN_STATUS_OK",
+ "FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT",
+ "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE",
+ "FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE",
+ "FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE",
+ "FLAC__METADATA_CHAIN_STATUS_BAD_METADATA",
+ "FLAC__METADATA_CHAIN_STATUS_READ_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR",
+ "FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS",
+ "FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH",
+ "FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL"
};
static FLAC__Metadata_Node *node_new_(void)
{
- return (FLAC__Metadata_Node*)calloc(1, sizeof(FLAC__Metadata_Node));
+ return (FLAC__Metadata_Node*)calloc(1, sizeof(FLAC__Metadata_Node));
}
static void node_delete_(FLAC__Metadata_Node *node)
{
- FLAC__ASSERT(0 != node);
- if(0 != node->data)
- FLAC__metadata_object_delete(node->data);
- free(node);
+ FLAC__ASSERT(0 != node);
+ if(0 != node->data)
+ FLAC__metadata_object_delete(node->data);
+ free(node);
}
static void chain_init_(FLAC__Metadata_Chain *chain)
{
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- chain->filename = 0;
- chain->is_ogg = false;
- chain->head = chain->tail = 0;
- chain->nodes = 0;
- chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
- chain->initial_length = 0;
- chain->read_cb = 0;
+ chain->filename = 0;
+ chain->is_ogg = false;
+ chain->head = chain->tail = 0;
+ chain->nodes = 0;
+ chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
+ chain->initial_length = 0;
+ chain->read_cb = 0;
}
static void chain_clear_(FLAC__Metadata_Chain *chain)
{
- FLAC__Metadata_Node *node, *next;
+ FLAC__Metadata_Node *node, *next;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- for(node = chain->head; node;)
- {
- next = node->next;
- node_delete_(node);
- node = next;
- }
+ for(node = chain->head; node; ) {
+ next = node->next;
+ node_delete_(node);
+ node = next;
+ }
- if(0 != chain->filename)
- free(chain->filename);
+ if(0 != chain->filename)
+ free(chain->filename);
- chain_init_(chain);
+ chain_init_(chain);
}
static void chain_append_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node)
{
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 != node);
- FLAC__ASSERT(0 != node->data);
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != node);
+ FLAC__ASSERT(0 != node->data);
- node->next = node->prev = 0;
- node->data->is_last = true;
- if(0 != chain->tail)
- chain->tail->data->is_last = false;
+ node->next = node->prev = 0;
+ node->data->is_last = true;
+ if(0 != chain->tail)
+ chain->tail->data->is_last = false;
- if(0 == chain->head)
- chain->head = node;
- else
- {
- FLAC__ASSERT(0 != chain->tail);
- chain->tail->next = node;
- node->prev = chain->tail;
- }
- chain->tail = node;
- chain->nodes++;
+ if(0 == chain->head)
+ chain->head = node;
+ else {
+ FLAC__ASSERT(0 != chain->tail);
+ chain->tail->next = node;
+ node->prev = chain->tail;
+ }
+ chain->tail = node;
+ chain->nodes++;
}
static void chain_remove_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node)
{
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 != node);
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != node);
- if(node == chain->head)
- chain->head = node->next;
- else
- node->prev->next = node->next;
+ if(node == chain->head)
+ chain->head = node->next;
+ else
+ node->prev->next = node->next;
- if(node == chain->tail)
- chain->tail = node->prev;
- else
- node->next->prev = node->prev;
+ if(node == chain->tail)
+ chain->tail = node->prev;
+ else
+ node->next->prev = node->prev;
- if(0 != chain->tail)
- chain->tail->data->is_last = true;
+ if(0 != chain->tail)
+ chain->tail->data->is_last = true;
- chain->nodes--;
+ chain->nodes--;
}
static void chain_delete_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node)
{
- chain_remove_node_(chain, node);
- node_delete_(node);
+ chain_remove_node_(chain, node);
+ node_delete_(node);
}
static off_t chain_calculate_length_(FLAC__Metadata_Chain *chain)
{
- const FLAC__Metadata_Node *node;
- off_t length = 0;
- for(node = chain->head; node; node = node->next)
- length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
- return length;
+ const FLAC__Metadata_Node *node;
+ off_t length = 0;
+ for(node = chain->head; node; node = node->next)
+ length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
+ return length;
}
static void iterator_insert_node_(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Node *node)
{
- FLAC__ASSERT(0 != node);
- FLAC__ASSERT(0 != node->data);
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
- FLAC__ASSERT(0 != iterator->chain);
- FLAC__ASSERT(0 != iterator->chain->head);
- FLAC__ASSERT(0 != iterator->chain->tail);
+ FLAC__ASSERT(0 != node);
+ FLAC__ASSERT(0 != node->data);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != iterator->chain);
+ FLAC__ASSERT(0 != iterator->chain->head);
+ FLAC__ASSERT(0 != iterator->chain->tail);
- node->data->is_last = false;
+ node->data->is_last = false;
- node->prev = iterator->current->prev;
- node->next = iterator->current;
+ node->prev = iterator->current->prev;
+ node->next = iterator->current;
- if(0 == node->prev)
- iterator->chain->head = node;
- else
- node->prev->next = node;
+ if(0 == node->prev)
+ iterator->chain->head = node;
+ else
+ node->prev->next = node;
- iterator->current->prev = node;
+ iterator->current->prev = node;
- iterator->chain->nodes++;
+ iterator->chain->nodes++;
}
static void iterator_insert_node_after_(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Node *node)
{
- FLAC__ASSERT(0 != node);
- FLAC__ASSERT(0 != node->data);
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
- FLAC__ASSERT(0 != iterator->chain);
- FLAC__ASSERT(0 != iterator->chain->head);
- FLAC__ASSERT(0 != iterator->chain->tail);
+ FLAC__ASSERT(0 != node);
+ FLAC__ASSERT(0 != node->data);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != iterator->chain);
+ FLAC__ASSERT(0 != iterator->chain->head);
+ FLAC__ASSERT(0 != iterator->chain->tail);
- iterator->current->data->is_last = false;
+ iterator->current->data->is_last = false;
- node->prev = iterator->current;
- node->next = iterator->current->next;
+ node->prev = iterator->current;
+ node->next = iterator->current->next;
- if(0 == node->next)
- iterator->chain->tail = node;
- else
- node->next->prev = node;
+ if(0 == node->next)
+ iterator->chain->tail = node;
+ else
+ node->next->prev = node;
- node->prev->next = node;
+ node->prev->next = node;
- iterator->chain->tail->data->is_last = true;
+ iterator->chain->tail->data->is_last = true;
- iterator->chain->nodes++;
+ iterator->chain->nodes++;
}
/* return true iff node and node->next are both padding */
static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node)
{
- if(node->data->type == FLAC__METADATA_TYPE_PADDING && 0 != node->next && node->next->data->type == FLAC__METADATA_TYPE_PADDING)
- {
- const unsigned growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length;
- node->data->length += growth;
+ if(node->data->type == FLAC__METADATA_TYPE_PADDING && 0 != node->next && node->next->data->type == FLAC__METADATA_TYPE_PADDING) {
+ const unsigned growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length;
+ node->data->length += growth;
- chain_delete_node_(chain, node->next);
- return true;
- }
- else
- return false;
+ chain_delete_node_(chain, node->next);
+ return true;
+ }
+ else
+ return false;
}
/* Returns the new length of the chain, or 0 if there was an error. */
@@ -1198,935 +1118,863 @@ static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLA
*/
static off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding)
{
- off_t current_length = chain_calculate_length_(chain);
-
- if(use_padding)
- {
- /* if the metadata shrank and the last block is padding, we just extend the last padding block */
- if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING)
- {
- const off_t delta = chain->initial_length - current_length;
- chain->tail->data->length += delta;
- current_length += delta;
- FLAC__ASSERT(current_length == chain->initial_length);
- }
- /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
- else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length)
- {
- FLAC__StreamMetadata *padding;
- FLAC__Metadata_Node *node;
- if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- padding->length = chain->initial_length - (FLAC__STREAM_METADATA_HEADER_LENGTH + current_length);
- if(0 == (node = node_new_()))
- {
- FLAC__metadata_object_delete(padding);
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
- node->data = padding;
- chain_append_node_(chain, node);
- current_length = chain_calculate_length_(chain);
- FLAC__ASSERT(current_length == chain->initial_length);
- }
- /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
- else if(current_length > chain->initial_length)
- {
- const off_t delta = current_length - chain->initial_length;
- if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING)
- {
- /* if the delta is exactly the size of the last padding block, remove the padding block */
- if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta)
- {
- chain_delete_node_(chain, chain->tail);
- current_length = chain_calculate_length_(chain);
- FLAC__ASSERT(current_length == chain->initial_length);
- }
- /* if there is at least 'delta' bytes of padding, trim the padding down */
- else if((off_t)chain->tail->data->length >= delta)
- {
- chain->tail->data->length -= delta;
- current_length -= delta;
- FLAC__ASSERT(current_length == chain->initial_length);
- }
- }
- }
- }
-
- return current_length;
+ off_t current_length = chain_calculate_length_(chain);
+
+ if(use_padding) {
+ /* if the metadata shrank and the last block is padding, we just extend the last padding block */
+ if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) {
+ const off_t delta = chain->initial_length - current_length;
+ chain->tail->data->length += delta;
+ current_length += delta;
+ FLAC__ASSERT(current_length == chain->initial_length);
+ }
+ /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
+ else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) {
+ FLAC__StreamMetadata *padding;
+ FLAC__Metadata_Node *node;
+ if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ padding->length = chain->initial_length - (FLAC__STREAM_METADATA_HEADER_LENGTH + current_length);
+ if(0 == (node = node_new_())) {
+ FLAC__metadata_object_delete(padding);
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ node->data = padding;
+ chain_append_node_(chain, node);
+ current_length = chain_calculate_length_(chain);
+ FLAC__ASSERT(current_length == chain->initial_length);
+ }
+ /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
+ else if(current_length > chain->initial_length) {
+ const off_t delta = current_length - chain->initial_length;
+ if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) {
+ /* if the delta is exactly the size of the last padding block, remove the padding block */
+ if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) {
+ chain_delete_node_(chain, chain->tail);
+ current_length = chain_calculate_length_(chain);
+ FLAC__ASSERT(current_length == chain->initial_length);
+ }
+ /* if there is at least 'delta' bytes of padding, trim the padding down */
+ else if((off_t)chain->tail->data->length >= delta) {
+ chain->tail->data->length -= delta;
+ current_length -= delta;
+ FLAC__ASSERT(current_length == chain->initial_length);
+ }
+ }
+ }
+ }
+
+ return current_length;
}
static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__IOCallback_Tell tell_cb)
{
- FLAC__Metadata_Node *node;
-
- FLAC__ASSERT(0 != chain);
-
- /* we assume we're already at the beginning of the file */
-
- switch(seek_to_first_metadata_block_cb_(handle, read_cb, seek_cb))
- {
- case 0:
- break;
- case 1:
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
- return false;
- case 2:
- chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- return false;
- case 3:
- chain->status = FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE;
- return false;
- default:
- FLAC__ASSERT(0);
- return false;
- }
-
- {
- FLAC__int64 pos = tell_cb(handle);
- if(pos < 0)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
- return false;
- }
- chain->first_offset = (off_t)pos;
- }
-
- {
- FLAC__bool is_last;
- FLAC__MetadataType type;
- unsigned length;
-
- do
- {
- node = node_new_();
- if(0 == node)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- if(!read_metadata_block_header_cb_(handle, read_cb, &is_last, &type, &length))
- {
- node_delete_(node);
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
- return false;
- }
-
- node->data = FLAC__metadata_object_new(type);
- if(0 == node->data)
- {
- node_delete_(node);
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- node->data->is_last = is_last;
- node->data->length = length;
-
- chain->status = get_equivalent_status_(read_metadata_block_data_cb_(handle, read_cb, seek_cb, node->data));
- if(chain->status != FLAC__METADATA_CHAIN_STATUS_OK)
- {
- node_delete_(node);
- return false;
- }
- chain_append_node_(chain, node);
- }
- while(!is_last);
- }
-
- {
- FLAC__int64 pos = tell_cb(handle);
- if(pos < 0)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
- return false;
- }
- chain->last_offset = (off_t)pos;
- }
-
- chain->initial_length = chain_calculate_length_(chain);
-
- return true;
+ FLAC__Metadata_Node *node;
+
+ FLAC__ASSERT(0 != chain);
+
+ /* we assume we're already at the beginning of the file */
+
+ switch(seek_to_first_metadata_block_cb_(handle, read_cb, seek_cb)) {
+ case 0:
+ break;
+ case 1:
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
+ return false;
+ case 2:
+ chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ return false;
+ case 3:
+ chain->status = FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE;
+ return false;
+ default:
+ FLAC__ASSERT(0);
+ return false;
+ }
+
+ {
+ FLAC__int64 pos = tell_cb(handle);
+ if(pos < 0) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
+ return false;
+ }
+ chain->first_offset = (off_t)pos;
+ }
+
+ {
+ FLAC__bool is_last;
+ FLAC__MetadataType type;
+ unsigned length;
+
+ do {
+ node = node_new_();
+ if(0 == node) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ if(!read_metadata_block_header_cb_(handle, read_cb, &is_last, &type, &length)) {
+ node_delete_(node);
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
+ return false;
+ }
+
+ node->data = FLAC__metadata_object_new(type);
+ if(0 == node->data) {
+ node_delete_(node);
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ node->data->is_last = is_last;
+ node->data->length = length;
+
+ chain->status = get_equivalent_status_(read_metadata_block_data_cb_(handle, read_cb, seek_cb, node->data));
+ if(chain->status != FLAC__METADATA_CHAIN_STATUS_OK) {
+ node_delete_(node);
+ return false;
+ }
+ chain_append_node_(chain, node);
+ } while(!is_last);
+ }
+
+ {
+ FLAC__int64 pos = tell_cb(handle);
+ if(pos < 0) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
+ return false;
+ }
+ chain->last_offset = (off_t)pos;
+ }
+
+ chain->initial_length = chain_calculate_length_(chain);
+
+ return true;
}
static FLAC__StreamDecoderReadStatus chain_read_ogg_read_cb_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
- (void)decoder;
- if(*bytes > 0 && chain->status == FLAC__METADATA_CHAIN_STATUS_OK)
- {
- *bytes = chain->read_cb(buffer, sizeof(FLAC__byte), *bytes, chain->handle);
- if(*bytes == 0)
- return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
- else
- return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
- }
- else
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
+ (void)decoder;
+ if(*bytes > 0 && chain->status == FLAC__METADATA_CHAIN_STATUS_OK) {
+ *bytes = chain->read_cb(buffer, sizeof(FLAC__byte), *bytes, chain->handle);
+ if(*bytes == 0)
+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ else
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ }
+ else
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
}
static FLAC__StreamDecoderWriteStatus chain_read_ogg_write_cb_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
- (void)decoder, (void)frame, (void)buffer, (void)client_data;
- return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+ (void)decoder, (void)frame, (void)buffer, (void)client_data;
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
static void chain_read_ogg_metadata_cb_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
- FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
- FLAC__Metadata_Node *node;
+ FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
+ FLAC__Metadata_Node *node;
- (void)decoder;
+ (void)decoder;
- node = node_new_();
- if(0 == node)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ node = node_new_();
+ if(0 == node) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
- node->data = FLAC__metadata_object_clone(metadata);
- if(0 == node->data)
- {
- node_delete_(node);
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ node->data = FLAC__metadata_object_clone(metadata);
+ if(0 == node->data) {
+ node_delete_(node);
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
- chain_append_node_(chain, node);
+ chain_append_node_(chain, node);
}
static void chain_read_ogg_error_cb_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
{
- FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
- (void)decoder, (void)status;
- chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */
+ FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
+ (void)decoder, (void)status;
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */
}
static FLAC__bool chain_read_ogg_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb)
{
- FLAC__StreamDecoder *decoder;
+ FLAC__StreamDecoder *decoder;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- /* we assume we're already at the beginning of the file */
+ /* we assume we're already at the beginning of the file */
- chain->handle = handle;
- chain->read_cb = read_cb;
- if(0 == (decoder = FLAC__stream_decoder_new()))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- FLAC__stream_decoder_set_metadata_respond_all(decoder);
- if(FLAC__stream_decoder_init_ogg_stream(decoder, chain_read_ogg_read_cb_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, chain_read_ogg_write_cb_, chain_read_ogg_metadata_cb_, chain_read_ogg_error_cb_, chain) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
- {
- FLAC__stream_decoder_delete(decoder);
- chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */
- return false;
- }
+ chain->handle = handle;
+ chain->read_cb = read_cb;
+ if(0 == (decoder = FLAC__stream_decoder_new())) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ FLAC__stream_decoder_set_metadata_respond_all(decoder);
+ if(FLAC__stream_decoder_init_ogg_stream(decoder, chain_read_ogg_read_cb_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, chain_read_ogg_write_cb_, chain_read_ogg_metadata_cb_, chain_read_ogg_error_cb_, chain) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
+ FLAC__stream_decoder_delete(decoder);
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */
+ return false;
+ }
- chain->first_offset = 0; /*@@@ wrong; will need to be set correctly to implement metadata writing for Ogg FLAC */
+ chain->first_offset = 0; /*@@@ wrong; will need to be set correctly to implement metadata writing for Ogg FLAC */
- if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder))
- chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */
- if(chain->status != FLAC__METADATA_CHAIN_STATUS_OK)
- {
- FLAC__stream_decoder_delete(decoder);
- return false;
- }
+ if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder))
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */
+ if(chain->status != FLAC__METADATA_CHAIN_STATUS_OK) {
+ FLAC__stream_decoder_delete(decoder);
+ return false;
+ }
- FLAC__stream_decoder_delete(decoder);
+ FLAC__stream_decoder_delete(decoder);
- chain->last_offset = 0; /*@@@ wrong; will need to be set correctly to implement metadata writing for Ogg FLAC */
+ chain->last_offset = 0; /*@@@ wrong; will need to be set correctly to implement metadata writing for Ogg FLAC */
- chain->initial_length = chain_calculate_length_(chain);
+ chain->initial_length = chain_calculate_length_(chain);
- return true;
+ return true;
}
static FLAC__bool chain_rewrite_metadata_in_place_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, FLAC__IOCallback_Seek seek_cb)
{
- FLAC__Metadata_Node *node;
+ FLAC__Metadata_Node *node;
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 != chain->head);
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain->head);
- if(0 != seek_cb(handle, chain->first_offset, SEEK_SET))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- return false;
- }
+ if(0 != seek_cb(handle, chain->first_offset, SEEK_SET)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ return false;
+ }
- for(node = chain->head; node; node = node->next)
- {
- if(!write_metadata_block_header_cb_(handle, write_cb, node->data))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
- return false;
- }
- if(!write_metadata_block_data_cb_(handle, write_cb, node->data))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
- return false;
- }
- }
+ for(node = chain->head; node; node = node->next) {
+ if(!write_metadata_block_header_cb_(handle, write_cb, node->data)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
+ return false;
+ }
+ if(!write_metadata_block_data_cb_(handle, write_cb, node->data)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
+ return false;
+ }
+ }
- /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
+ /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
- chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
- return true;
+ chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
+ return true;
}
static FLAC__bool chain_rewrite_metadata_in_place_(FLAC__Metadata_Chain *chain)
{
- FILE *file;
- FLAC__bool ret;
+ FILE *file;
+ FLAC__bool ret;
- FLAC__ASSERT(0 != chain->filename);
+ FLAC__ASSERT(0 != chain->filename);
- if(0 == (file = fopen(chain->filename, "r+b")))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
- return false;
- }
+ if(0 == (file = fopen(chain->filename, "r+b"))) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
+ return false;
+ }
- /* chain_rewrite_metadata_in_place_cb_() sets chain->status for us */
- ret = chain_rewrite_metadata_in_place_cb_(chain, (FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, fseek_wrapper_);
+ /* chain_rewrite_metadata_in_place_cb_() sets chain->status for us */
+ ret = chain_rewrite_metadata_in_place_cb_(chain, (FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, fseek_wrapper_);
- fclose(file);
+ fclose(file);
- return ret;
+ return ret;
}
static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *tempfile_path_prefix)
{
- FILE *f, *tempfile;
- char *tempfilename;
- FLAC__Metadata_SimpleIteratorStatus status;
- const FLAC__Metadata_Node *node;
-
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 != chain->filename);
- FLAC__ASSERT(0 != chain->head);
-
- /* copy the file prefix (data up to first metadata block */
- if(0 == (f = fopen(chain->filename, "rb")))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
- return false;
- }
- if(!open_tempfile_(chain->filename, tempfile_path_prefix, &tempfile, &tempfilename, &status))
- {
- chain->status = get_equivalent_status_(status);
- cleanup_tempfile_(&tempfile, &tempfilename);
- return false;
- }
- if(!copy_n_bytes_from_file_(f, tempfile, chain->first_offset, &status))
- {
- chain->status = get_equivalent_status_(status);
- cleanup_tempfile_(&tempfile, &tempfilename);
- return false;
- }
-
- /* write the metadata */
- for(node = chain->head; node; node = node->next)
- {
- if(!write_metadata_block_header_(tempfile, &status, node->data))
- {
- chain->status = get_equivalent_status_(status);
- return false;
- }
- if(!write_metadata_block_data_(tempfile, &status, node->data))
- {
- chain->status = get_equivalent_status_(status);
- return false;
- }
- }
- /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
-
- /* copy the file postfix (everything after the metadata) */
- if(0 != fseeko(f, chain->last_offset, SEEK_SET))
- {
- cleanup_tempfile_(&tempfile, &tempfilename);
- chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- return false;
- }
- if(!copy_remaining_bytes_from_file_(f, tempfile, &status))
- {
- cleanup_tempfile_(&tempfile, &tempfilename);
- chain->status = get_equivalent_status_(status);
- return false;
- }
-
- /* move the tempfile on top of the original */
- (void)fclose(f);
- if(!transport_tempfile_(chain->filename, &tempfile, &tempfilename, &status))
- return false;
-
- return true;
+ FILE *f, *tempfile;
+ char *tempfilename;
+ FLAC__Metadata_SimpleIteratorStatus status;
+ const FLAC__Metadata_Node *node;
+
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain->filename);
+ FLAC__ASSERT(0 != chain->head);
+
+ /* copy the file prefix (data up to first metadata block */
+ if(0 == (f = fopen(chain->filename, "rb"))) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
+ return false;
+ }
+ if(!open_tempfile_(chain->filename, tempfile_path_prefix, &tempfile, &tempfilename, &status)) {
+ chain->status = get_equivalent_status_(status);
+ cleanup_tempfile_(&tempfile, &tempfilename);
+ return false;
+ }
+ if(!copy_n_bytes_from_file_(f, tempfile, chain->first_offset, &status)) {
+ chain->status = get_equivalent_status_(status);
+ cleanup_tempfile_(&tempfile, &tempfilename);
+ return false;
+ }
+
+ /* write the metadata */
+ for(node = chain->head; node; node = node->next) {
+ if(!write_metadata_block_header_(tempfile, &status, node->data)) {
+ chain->status = get_equivalent_status_(status);
+ return false;
+ }
+ if(!write_metadata_block_data_(tempfile, &status, node->data)) {
+ chain->status = get_equivalent_status_(status);
+ return false;
+ }
+ }
+ /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
+
+ /* copy the file postfix (everything after the metadata) */
+ if(0 != fseeko(f, chain->last_offset, SEEK_SET)) {
+ cleanup_tempfile_(&tempfile, &tempfilename);
+ chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ return false;
+ }
+ if(!copy_remaining_bytes_from_file_(f, tempfile, &status)) {
+ cleanup_tempfile_(&tempfile, &tempfilename);
+ chain->status = get_equivalent_status_(status);
+ return false;
+ }
+
+ /* move the tempfile on top of the original */
+ (void)fclose(f);
+ if(!transport_tempfile_(chain->filename, &tempfile, &tempfilename, &status))
+ return false;
+
+ return true;
}
/* assumes 'handle' is already at beginning of file */
static FLAC__bool chain_rewrite_file_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb)
{
- FLAC__Metadata_SimpleIteratorStatus status;
- const FLAC__Metadata_Node *node;
-
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 == chain->filename);
- FLAC__ASSERT(0 != chain->head);
-
- /* copy the file prefix (data up to first metadata block */
- if(!copy_n_bytes_from_file_cb_(handle, read_cb, temp_handle, temp_write_cb, chain->first_offset, &status))
- {
- chain->status = get_equivalent_status_(status);
- return false;
- }
-
- /* write the metadata */
- for(node = chain->head; node; node = node->next)
- {
- if(!write_metadata_block_header_cb_(temp_handle, temp_write_cb, node->data))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
- return false;
- }
- if(!write_metadata_block_data_cb_(temp_handle, temp_write_cb, node->data))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
- return false;
- }
- }
- /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
-
- /* copy the file postfix (everything after the metadata) */
- if(0 != seek_cb(handle, chain->last_offset, SEEK_SET))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- return false;
- }
- if(!copy_remaining_bytes_from_file_cb_(handle, read_cb, eof_cb, temp_handle, temp_write_cb, &status))
- {
- chain->status = get_equivalent_status_(status);
- return false;
- }
-
- return true;
+ FLAC__Metadata_SimpleIteratorStatus status;
+ const FLAC__Metadata_Node *node;
+
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 == chain->filename);
+ FLAC__ASSERT(0 != chain->head);
+
+ /* copy the file prefix (data up to first metadata block */
+ if(!copy_n_bytes_from_file_cb_(handle, read_cb, temp_handle, temp_write_cb, chain->first_offset, &status)) {
+ chain->status = get_equivalent_status_(status);
+ return false;
+ }
+
+ /* write the metadata */
+ for(node = chain->head; node; node = node->next) {
+ if(!write_metadata_block_header_cb_(temp_handle, temp_write_cb, node->data)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
+ return false;
+ }
+ if(!write_metadata_block_data_cb_(temp_handle, temp_write_cb, node->data)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
+ return false;
+ }
+ }
+ /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
+
+ /* copy the file postfix (everything after the metadata) */
+ if(0 != seek_cb(handle, chain->last_offset, SEEK_SET)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ return false;
+ }
+ if(!copy_remaining_bytes_from_file_cb_(handle, read_cb, eof_cb, temp_handle, temp_write_cb, &status)) {
+ chain->status = get_equivalent_status_(status);
+ return false;
+ }
+
+ return true;
}
FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new(void)
{
- FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)calloc(1, sizeof(FLAC__Metadata_Chain));
+ FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)calloc(1, sizeof(FLAC__Metadata_Chain));
- if(0 != chain)
- chain_init_(chain);
+ if(0 != chain)
+ chain_init_(chain);
- return chain;
+ return chain;
}
FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain)
{
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- chain_clear_(chain);
+ chain_clear_(chain);
- free(chain);
+ free(chain);
}
FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain)
{
- FLAC__Metadata_ChainStatus status;
+ FLAC__Metadata_ChainStatus status;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- status = chain->status;
- chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
- return status;
+ status = chain->status;
+ chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
+ return status;
}
static FLAC__bool chain_read_(FLAC__Metadata_Chain *chain, const char *filename, FLAC__bool is_ogg)
{
- FILE *file;
- FLAC__bool ret;
+ FILE *file;
+ FLAC__bool ret;
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != filename);
- chain_clear_(chain);
+ chain_clear_(chain);
- if(0 == (chain->filename = strdup(filename)))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
+ if(0 == (chain->filename = strdup(filename))) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
- chain->is_ogg = is_ogg;
+ chain->is_ogg = is_ogg;
- if(0 == (file = fopen(filename, "rb")))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
- return false;
- }
+ if(0 == (file = fopen(filename, "rb"))) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
+ return false;
+ }
- /* the function also sets chain->status for us */
- ret = is_ogg ?
- chain_read_ogg_cb_(chain, file, (FLAC__IOCallback_Read)fread) :
- chain_read_cb_(chain, file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, ftell_wrapper_)
- ;
+ /* the function also sets chain->status for us */
+ ret = is_ogg?
+ chain_read_ogg_cb_(chain, file, (FLAC__IOCallback_Read)fread) :
+ chain_read_cb_(chain, file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, ftell_wrapper_)
+ ;
- fclose(file);
+ fclose(file);
- return ret;
+ return ret;
}
FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename)
{
- return chain_read_(chain, filename, /*is_ogg=*/false);
+ return chain_read_(chain, filename, /*is_ogg=*/false);
}
/*@@@@add to tests*/
FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg(FLAC__Metadata_Chain *chain, const char *filename)
{
- return chain_read_(chain, filename, /*is_ogg=*/true);
+ return chain_read_(chain, filename, /*is_ogg=*/true);
}
static FLAC__bool chain_read_with_callbacks_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__bool is_ogg)
{
- FLAC__bool ret;
+ FLAC__bool ret;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- chain_clear_(chain);
+ chain_clear_(chain);
- if(0 == callbacks.read || 0 == callbacks.seek || 0 == callbacks.tell)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
- return false;
- }
+ if (0 == callbacks.read || 0 == callbacks.seek || 0 == callbacks.tell) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
+ return false;
+ }
- chain->is_ogg = is_ogg;
+ chain->is_ogg = is_ogg;
- /* rewind */
- if(0 != callbacks.seek(handle, 0, SEEK_SET))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- return false;
- }
+ /* rewind */
+ if(0 != callbacks.seek(handle, 0, SEEK_SET)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ return false;
+ }
- /* the function also sets chain->status for us */
- ret = is_ogg ?
- chain_read_ogg_cb_(chain, handle, callbacks.read) :
- chain_read_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.tell)
- ;
+ /* the function also sets chain->status for us */
+ ret = is_ogg?
+ chain_read_ogg_cb_(chain, handle, callbacks.read) :
+ chain_read_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.tell)
+ ;
- return ret;
+ return ret;
}
FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
{
- return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/false);
+ return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/false);
}
/*@@@@add to tests*/
FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
{
- return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/true);
+ return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/true);
}
FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata_Chain *chain, FLAC__bool use_padding)
{
- /* This does all the same checks that are in chain_prepare_for_write_()
- * but doesn't actually alter the chain. Make sure to update the logic
- * here if chain_prepare_for_write_() changes.
- */
- const off_t current_length = chain_calculate_length_(chain);
-
- FLAC__ASSERT(0 != chain);
-
- if(use_padding)
- {
- /* if the metadata shrank and the last block is padding, we just extend the last padding block */
- if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING)
- return false;
- /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
- else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length)
- return false;
- /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
- else if(current_length > chain->initial_length)
- {
- const off_t delta = current_length - chain->initial_length;
- if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING)
- {
- /* if the delta is exactly the size of the last padding block, remove the padding block */
- if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta)
- return false;
- /* if there is at least 'delta' bytes of padding, trim the padding down */
- else if((off_t)chain->tail->data->length >= delta)
- return false;
- }
- }
- }
-
- return (current_length != chain->initial_length);
+ /* This does all the same checks that are in chain_prepare_for_write_()
+ * but doesn't actually alter the chain. Make sure to update the logic
+ * here if chain_prepare_for_write_() changes.
+ */
+ const off_t current_length = chain_calculate_length_(chain);
+
+ FLAC__ASSERT(0 != chain);
+
+ if(use_padding) {
+ /* if the metadata shrank and the last block is padding, we just extend the last padding block */
+ if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING)
+ return false;
+ /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
+ else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length)
+ return false;
+ /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
+ else if(current_length > chain->initial_length) {
+ const off_t delta = current_length - chain->initial_length;
+ if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) {
+ /* if the delta is exactly the size of the last padding block, remove the padding block */
+ if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta)
+ return false;
+ /* if there is at least 'delta' bytes of padding, trim the padding down */
+ else if((off_t)chain->tail->data->length >= delta)
+ return false;
+ }
+ }
+ }
+
+ return (current_length != chain->initial_length);
}
FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats)
{
- struct stat stats;
- const char *tempfile_path_prefix = 0;
- off_t current_length;
+ struct stat stats;
+ const char *tempfile_path_prefix = 0;
+ off_t current_length;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- if(chain->is_ogg) /* cannot write back to Ogg FLAC yet */
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
- return false;
- }
+ if (chain->is_ogg) { /* cannot write back to Ogg FLAC yet */
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
+ return false;
+ }
- if(0 == chain->filename)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH;
- return false;
- }
+ if (0 == chain->filename) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH;
+ return false;
+ }
- current_length = chain_prepare_for_write_(chain, use_padding);
+ current_length = chain_prepare_for_write_(chain, use_padding);
- /* a return value of 0 means there was an error; chain->status is already set */
- if(0 == current_length)
- return false;
+ /* a return value of 0 means there was an error; chain->status is already set */
+ if (0 == current_length)
+ return false;
- if(preserve_file_stats)
- get_file_stats_(chain->filename, &stats);
+ if(preserve_file_stats)
+ get_file_stats_(chain->filename, &stats);
- if(current_length == chain->initial_length)
- {
- if(!chain_rewrite_metadata_in_place_(chain))
- return false;
- }
- else
- {
- if(!chain_rewrite_file_(chain, tempfile_path_prefix))
- return false;
+ if(current_length == chain->initial_length) {
+ if(!chain_rewrite_metadata_in_place_(chain))
+ return false;
+ }
+ else {
+ if(!chain_rewrite_file_(chain, tempfile_path_prefix))
+ return false;
- /* recompute lengths and offsets */
- {
- const FLAC__Metadata_Node *node;
- chain->initial_length = current_length;
- chain->last_offset = chain->first_offset;
- for(node = chain->head; node; node = node->next)
- chain->last_offset += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
- }
- }
+ /* recompute lengths and offsets */
+ {
+ const FLAC__Metadata_Node *node;
+ chain->initial_length = current_length;
+ chain->last_offset = chain->first_offset;
+ for(node = chain->head; node; node = node->next)
+ chain->last_offset += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
+ }
+ }
- if(preserve_file_stats)
- set_file_stats_(chain->filename, &stats);
+ if(preserve_file_stats)
+ set_file_stats_(chain->filename, &stats);
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
{
- off_t current_length;
+ off_t current_length;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- if(chain->is_ogg) /* cannot write back to Ogg FLAC yet */
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
- return false;
- }
+ if (chain->is_ogg) { /* cannot write back to Ogg FLAC yet */
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
+ return false;
+ }
- if(0 != chain->filename)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH;
- return false;
- }
+ if (0 != chain->filename) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH;
+ return false;
+ }
- if(0 == callbacks.write || 0 == callbacks.seek)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
- return false;
- }
+ if (0 == callbacks.write || 0 == callbacks.seek) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
+ return false;
+ }
- if(FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL;
- return false;
- }
+ if (FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL;
+ return false;
+ }
- current_length = chain_prepare_for_write_(chain, use_padding);
+ current_length = chain_prepare_for_write_(chain, use_padding);
- /* a return value of 0 means there was an error; chain->status is already set */
- if(0 == current_length)
- return false;
+ /* a return value of 0 means there was an error; chain->status is already set */
+ if (0 == current_length)
+ return false;
- FLAC__ASSERT(current_length == chain->initial_length);
+ FLAC__ASSERT(current_length == chain->initial_length);
- return chain_rewrite_metadata_in_place_cb_(chain, handle, callbacks.write, callbacks.seek);
+ return chain_rewrite_metadata_in_place_cb_(chain, handle, callbacks.write, callbacks.seek);
}
FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks)
{
- off_t current_length;
-
- FLAC__ASSERT(0 != chain);
-
- if(chain->is_ogg) /* cannot write back to Ogg FLAC yet */
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
- return false;
- }
-
- if(0 != chain->filename)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH;
- return false;
- }
-
- if(0 == callbacks.read || 0 == callbacks.seek || 0 == callbacks.eof)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
- return false;
- }
- if(0 == temp_callbacks.write)
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
- return false;
- }
-
- if(!FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL;
- return false;
- }
-
- current_length = chain_prepare_for_write_(chain, use_padding);
-
- /* a return value of 0 means there was an error; chain->status is already set */
- if(0 == current_length)
- return false;
-
- FLAC__ASSERT(current_length != chain->initial_length);
-
- /* rewind */
- if(0 != callbacks.seek(handle, 0, SEEK_SET))
- {
- chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- return false;
- }
-
- if(!chain_rewrite_file_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.eof, temp_handle, temp_callbacks.write))
- return false;
-
- /* recompute lengths and offsets */
- {
- const FLAC__Metadata_Node *node;
- chain->initial_length = current_length;
- chain->last_offset = chain->first_offset;
- for(node = chain->head; node; node = node->next)
- chain->last_offset += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
- }
-
- return true;
+ off_t current_length;
+
+ FLAC__ASSERT(0 != chain);
+
+ if (chain->is_ogg) { /* cannot write back to Ogg FLAC yet */
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
+ return false;
+ }
+
+ if (0 != chain->filename) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH;
+ return false;
+ }
+
+ if (0 == callbacks.read || 0 == callbacks.seek || 0 == callbacks.eof) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
+ return false;
+ }
+ if (0 == temp_callbacks.write) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS;
+ return false;
+ }
+
+ if (!FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL;
+ return false;
+ }
+
+ current_length = chain_prepare_for_write_(chain, use_padding);
+
+ /* a return value of 0 means there was an error; chain->status is already set */
+ if (0 == current_length)
+ return false;
+
+ FLAC__ASSERT(current_length != chain->initial_length);
+
+ /* rewind */
+ if(0 != callbacks.seek(handle, 0, SEEK_SET)) {
+ chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ return false;
+ }
+
+ if(!chain_rewrite_file_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.eof, temp_handle, temp_callbacks.write))
+ return false;
+
+ /* recompute lengths and offsets */
+ {
+ const FLAC__Metadata_Node *node;
+ chain->initial_length = current_length;
+ chain->last_offset = chain->first_offset;
+ for(node = chain->head; node; node = node->next)
+ chain->last_offset += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
+ }
+
+ return true;
}
FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain)
{
- FLAC__Metadata_Node *node;
+ FLAC__Metadata_Node *node;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- for(node = chain->head; node;)
- {
- if(!chain_merge_adjacent_padding_(chain, node))
- node = node->next;
- }
+ for(node = chain->head; node; ) {
+ if(!chain_merge_adjacent_padding_(chain, node))
+ node = node->next;
+ }
}
FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain)
{
- FLAC__Metadata_Node *node, *save;
- unsigned i;
+ FLAC__Metadata_Node *node, *save;
+ unsigned i;
- FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain);
- /*
- * Don't try and be too smart... this simple algo is good enough for
- * the small number of nodes that we deal with.
- */
- for(i = 0, node = chain->head; i < chain->nodes; i++)
- {
- if(node->data->type == FLAC__METADATA_TYPE_PADDING)
- {
- save = node->next;
- chain_remove_node_(chain, node);
- chain_append_node_(chain, node);
- node = save;
- }
- else
- {
- node = node->next;
- }
- }
+ /*
+ * Don't try and be too smart... this simple algo is good enough for
+ * the small number of nodes that we deal with.
+ */
+ for(i = 0, node = chain->head; i < chain->nodes; i++) {
+ if(node->data->type == FLAC__METADATA_TYPE_PADDING) {
+ save = node->next;
+ chain_remove_node_(chain, node);
+ chain_append_node_(chain, node);
+ node = save;
+ }
+ else {
+ node = node->next;
+ }
+ }
- FLAC__metadata_chain_merge_padding(chain);
+ FLAC__metadata_chain_merge_padding(chain);
}
FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(void)
{
- FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator));
+ FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator));
- /* calloc() implies:
- iterator->current = 0;
- iterator->chain = 0;
- */
+ /* calloc() implies:
+ iterator->current = 0;
+ iterator->chain = 0;
+ */
- return iterator;
+ return iterator;
}
FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator);
- free(iterator);
+ free(iterator);
}
FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != chain);
- FLAC__ASSERT(0 != chain->head);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != chain);
+ FLAC__ASSERT(0 != chain->head);
- iterator->chain = chain;
- iterator->current = chain->head;
+ iterator->chain = chain;
+ iterator->current = chain->head;
}
FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator);
- if(0 == iterator->current || 0 == iterator->current->next)
- return false;
+ if(0 == iterator->current || 0 == iterator->current->next)
+ return false;
- iterator->current = iterator->current->next;
- return true;
+ iterator->current = iterator->current->next;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator);
- if(0 == iterator->current || 0 == iterator->current->prev)
- return false;
+ if(0 == iterator->current || 0 == iterator->current->prev)
+ return false;
- iterator->current = iterator->current->prev;
- return true;
+ iterator->current = iterator->current->prev;
+ return true;
}
FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
- FLAC__ASSERT(0 != iterator->current->data);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != iterator->current->data);
- return iterator->current->data->type;
+ return iterator->current->data->type;
}
FLAC_API FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
- return iterator->current->data;
+ return iterator->current->data;
}
FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != block);
- return FLAC__metadata_iterator_delete_block(iterator, false) && FLAC__metadata_iterator_insert_block_after(iterator, block);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != block);
+ return FLAC__metadata_iterator_delete_block(iterator, false) && FLAC__metadata_iterator_insert_block_after(iterator, block);
}
FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding)
{
- FLAC__Metadata_Node *save;
+ FLAC__Metadata_Node *save;
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
- if(0 == iterator->current->prev)
- {
- FLAC__ASSERT(iterator->current->data->type == FLAC__METADATA_TYPE_STREAMINFO);
- return false;
- }
+ if(0 == iterator->current->prev) {
+ FLAC__ASSERT(iterator->current->data->type == FLAC__METADATA_TYPE_STREAMINFO);
+ return false;
+ }
- save = iterator->current->prev;
+ save = iterator->current->prev;
- if(replace_with_padding)
- {
- FLAC__metadata_object_delete_data(iterator->current->data);
- iterator->current->data->type = FLAC__METADATA_TYPE_PADDING;
- }
- else
- {
- chain_delete_node_(iterator->chain, iterator->current);
- }
+ if(replace_with_padding) {
+ FLAC__metadata_object_delete_data(iterator->current->data);
+ iterator->current->data->type = FLAC__METADATA_TYPE_PADDING;
+ }
+ else {
+ chain_delete_node_(iterator->chain, iterator->current);
+ }
- iterator->current = save;
- return true;
+ iterator->current = save;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
{
- FLAC__Metadata_Node *node;
+ FLAC__Metadata_Node *node;
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
- FLAC__ASSERT(0 != block);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != block);
- if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
- return false;
+ if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
+ return false;
- if(0 == iterator->current->prev)
- {
- FLAC__ASSERT(iterator->current->data->type == FLAC__METADATA_TYPE_STREAMINFO);
- return false;
- }
+ if(0 == iterator->current->prev) {
+ FLAC__ASSERT(iterator->current->data->type == FLAC__METADATA_TYPE_STREAMINFO);
+ return false;
+ }
- if(0 == (node = node_new_()))
- return false;
+ if(0 == (node = node_new_()))
+ return false;
- node->data = block;
- iterator_insert_node_(iterator, node);
- iterator->current = node;
- return true;
+ node->data = block;
+ iterator_insert_node_(iterator, node);
+ iterator->current = node;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
{
- FLAC__Metadata_Node *node;
+ FLAC__Metadata_Node *node;
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->current);
- FLAC__ASSERT(0 != block);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->current);
+ FLAC__ASSERT(0 != block);
- if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
- return false;
+ if(block->type == FLAC__METADATA_TYPE_STREAMINFO)
+ return false;
- if(0 == (node = node_new_()))
- return false;
+ if(0 == (node = node_new_()))
+ return false;
- node->data = block;
- iterator_insert_node_after_(iterator, node);
- iterator->current = node;
- return true;
+ node->data = block;
+ iterator_insert_node_after_(iterator, node);
+ iterator->current = node;
+ return true;
}
@@ -2138,1032 +1986,987 @@ FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_It
void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes)
{
- unsigned i;
+ unsigned i;
- b += bytes;
+ b += bytes;
- for(i = 0; i < bytes; i++)
- {
- *(--b) = (FLAC__byte)(val & 0xff);
- val >>= 8;
- }
+ for(i = 0; i < bytes; i++) {
+ *(--b) = (FLAC__byte)(val & 0xff);
+ val >>= 8;
+ }
}
void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes)
{
- unsigned i;
+ unsigned i;
- for(i = 0; i < bytes; i++)
- {
- *(b++) = (FLAC__byte)(val & 0xff);
- val >>= 8;
- }
+ for(i = 0; i < bytes; i++) {
+ *(b++) = (FLAC__byte)(val & 0xff);
+ val >>= 8;
+ }
}
void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes)
{
- unsigned i;
+ unsigned i;
- b += bytes;
+ b += bytes;
- for(i = 0; i < bytes; i++)
- {
- *(--b) = (FLAC__byte)(val & 0xff);
- val >>= 8;
- }
+ for(i = 0; i < bytes; i++) {
+ *(--b) = (FLAC__byte)(val & 0xff);
+ val >>= 8;
+ }
}
FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes)
{
- FLAC__uint32 ret = 0;
- unsigned i;
+ FLAC__uint32 ret = 0;
+ unsigned i;
- for(i = 0; i < bytes; i++)
- ret = (ret << 8) | (FLAC__uint32)(*b++);
+ for(i = 0; i < bytes; i++)
+ ret = (ret << 8) | (FLAC__uint32)(*b++);
- return ret;
+ return ret;
}
FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes)
{
- FLAC__uint32 ret = 0;
- unsigned i;
+ FLAC__uint32 ret = 0;
+ unsigned i;
- b += bytes;
+ b += bytes;
- for(i = 0; i < bytes; i++)
- ret = (ret << 8) | (FLAC__uint32)(*--b);
+ for(i = 0; i < bytes; i++)
+ ret = (ret << 8) | (FLAC__uint32)(*--b);
- return ret;
+ return ret;
}
FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes)
{
- FLAC__uint64 ret = 0;
- unsigned i;
+ FLAC__uint64 ret = 0;
+ unsigned i;
- for(i = 0; i < bytes; i++)
- ret = (ret << 8) | (FLAC__uint64)(*b++);
+ for(i = 0; i < bytes; i++)
+ ret = (ret << 8) | (FLAC__uint64)(*b++);
- return ret;
+ return ret;
}
FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- if(!read_metadata_block_header_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, &iterator->is_last, &iterator->type, &iterator->length))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
+ if(!read_metadata_block_header_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, &iterator->is_last, &iterator->type, &iterator->length)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
- return true;
+ return true;
}
FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block)
{
- FLAC__ASSERT(0 != iterator);
- FLAC__ASSERT(0 != iterator->file);
+ FLAC__ASSERT(0 != iterator);
+ FLAC__ASSERT(0 != iterator->file);
- iterator->status = read_metadata_block_data_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, block);
+ iterator->status = read_metadata_block_data_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, block);
- return (iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK);
+ return (iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK);
}
FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length)
{
- FLAC__byte raw_header[FLAC__STREAM_METADATA_HEADER_LENGTH];
+ FLAC__byte raw_header[FLAC__STREAM_METADATA_HEADER_LENGTH];
- if(read_cb(raw_header, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, handle) != FLAC__STREAM_METADATA_HEADER_LENGTH)
- return false;
+ if(read_cb(raw_header, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, handle) != FLAC__STREAM_METADATA_HEADER_LENGTH)
+ return false;
- *is_last = raw_header[0] & 0x80 ? true : false;
- *type = (FLAC__MetadataType)(raw_header[0] & 0x7f);
- *length = unpack_uint32_(raw_header + 1, 3);
+ *is_last = raw_header[0] & 0x80? true : false;
+ *type = (FLAC__MetadataType)(raw_header[0] & 0x7f);
+ *length = unpack_uint32_(raw_header + 1, 3);
- /* Note that we don't check:
- * if(iterator->type >= FLAC__METADATA_TYPE_UNDEFINED)
- * we just will read in an opaque block
- */
+ /* Note that we don't check:
+ * if(iterator->type >= FLAC__METADATA_TYPE_UNDEFINED)
+ * we just will read in an opaque block
+ */
- return true;
+ return true;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block)
{
- switch(block->type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- return read_metadata_block_data_streaminfo_cb_(handle, read_cb, &block->data.stream_info);
- case FLAC__METADATA_TYPE_PADDING:
- return read_metadata_block_data_padding_cb_(handle, seek_cb, &block->data.padding, block->length);
- case FLAC__METADATA_TYPE_APPLICATION:
- return read_metadata_block_data_application_cb_(handle, read_cb, &block->data.application, block->length);
- case FLAC__METADATA_TYPE_SEEKTABLE:
- return read_metadata_block_data_seektable_cb_(handle, read_cb, &block->data.seek_table, block->length);
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- return read_metadata_block_data_vorbis_comment_cb_(handle, read_cb, &block->data.vorbis_comment);
- case FLAC__METADATA_TYPE_CUESHEET:
- return read_metadata_block_data_cuesheet_cb_(handle, read_cb, &block->data.cue_sheet);
- case FLAC__METADATA_TYPE_PICTURE:
- return read_metadata_block_data_picture_cb_(handle, read_cb, &block->data.picture);
- default:
- return read_metadata_block_data_unknown_cb_(handle, read_cb, &block->data.unknown, block->length);
- }
+ switch(block->type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ return read_metadata_block_data_streaminfo_cb_(handle, read_cb, &block->data.stream_info);
+ case FLAC__METADATA_TYPE_PADDING:
+ return read_metadata_block_data_padding_cb_(handle, seek_cb, &block->data.padding, block->length);
+ case FLAC__METADATA_TYPE_APPLICATION:
+ return read_metadata_block_data_application_cb_(handle, read_cb, &block->data.application, block->length);
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ return read_metadata_block_data_seektable_cb_(handle, read_cb, &block->data.seek_table, block->length);
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ return read_metadata_block_data_vorbis_comment_cb_(handle, read_cb, &block->data.vorbis_comment);
+ case FLAC__METADATA_TYPE_CUESHEET:
+ return read_metadata_block_data_cuesheet_cb_(handle, read_cb, &block->data.cue_sheet);
+ case FLAC__METADATA_TYPE_PICTURE:
+ return read_metadata_block_data_picture_cb_(handle, read_cb, &block->data.picture);
+ default:
+ return read_metadata_block_data_unknown_cb_(handle, read_cb, &block->data.unknown, block->length);
+ }
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block)
{
- FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH], *b;
+ FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH], *b;
- if(read_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ if(read_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- b = buffer;
+ b = buffer;
- /* we are using hardcoded numbers for simplicity but we should
- * probably eventually write a bit-level unpacker and use the
- * _STREAMINFO_ constants.
- */
- block->min_blocksize = unpack_uint32_(b, 2);
- b += 2;
- block->max_blocksize = unpack_uint32_(b, 2);
- b += 2;
- block->min_framesize = unpack_uint32_(b, 3);
- b += 3;
- block->max_framesize = unpack_uint32_(b, 3);
- b += 3;
- block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((unsigned)(b[2] & 0xf0) >> 4);
- block->channels = (unsigned)((b[2] & 0x0e) >> 1) + 1;
- block->bits_per_sample = ((((unsigned)(b[2] & 0x01)) << 4) | (((unsigned)(b[3] & 0xf0)) >> 4)) + 1;
- block->total_samples = (((FLAC__uint64)(b[3] & 0x0f)) << 32) | unpack_uint64_(b + 4, 4);
- memcpy(block->md5sum, b + 8, 16);
+ /* we are using hardcoded numbers for simplicity but we should
+ * probably eventually write a bit-level unpacker and use the
+ * _STREAMINFO_ constants.
+ */
+ block->min_blocksize = unpack_uint32_(b, 2); b += 2;
+ block->max_blocksize = unpack_uint32_(b, 2); b += 2;
+ block->min_framesize = unpack_uint32_(b, 3); b += 3;
+ block->max_framesize = unpack_uint32_(b, 3); b += 3;
+ block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((unsigned)(b[2] & 0xf0) >> 4);
+ block->channels = (unsigned)((b[2] & 0x0e) >> 1) + 1;
+ block->bits_per_sample = ((((unsigned)(b[2] & 0x01)) << 4) | (((unsigned)(b[3] & 0xf0)) >> 4)) + 1;
+ block->total_samples = (((FLAC__uint64)(b[3] & 0x0f)) << 32) | unpack_uint64_(b+4, 4);
+ memcpy(block->md5sum, b+8, 16);
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length)
{
- (void)block; /* nothing to do; we don't care about reading the padding bytes */
+ (void)block; /* nothing to do; we don't care about reading the padding bytes */
- if(0 != seek_cb(handle, block_length, SEEK_CUR))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ if(0 != seek_cb(handle, block_length, SEEK_CUR))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length)
{
- const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+ const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
- if(read_cb(block->id, 1, id_bytes, handle) != id_bytes)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ if(read_cb(block->id, 1, id_bytes, handle) != id_bytes)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- if(block_length < id_bytes)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ if(block_length < id_bytes)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block_length -= id_bytes;
+ block_length -= id_bytes;
- if(block_length == 0)
- {
- block->data = 0;
- }
- else
- {
- if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(block_length == 0) {
+ block->data = 0;
+ }
+ else {
+ if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- if(read_cb(block->data, 1, block_length, handle) != block_length)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- }
+ if(read_cb(block->data, 1, block_length, handle) != block_length)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ }
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length)
{
- unsigned i;
- FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH];
+ unsigned i;
+ FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH];
- FLAC__ASSERT(block_length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH == 0);
+ FLAC__ASSERT(block_length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH == 0);
- block->num_points = block_length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
+ block->num_points = block_length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
- if(block->num_points == 0)
- block->points = 0;
- else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint))))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(block->num_points == 0)
+ block->points = 0;
+ else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint))))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- for(i = 0; i < block->num_points; i++)
- {
- if(read_cb(buffer, 1, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH, handle) != FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- /* some MAGIC NUMBERs here */
- block->points[i].sample_number = unpack_uint64_(buffer, 8);
- block->points[i].stream_offset = unpack_uint64_(buffer + 8, 8);
- block->points[i].frame_samples = unpack_uint32_(buffer + 16, 2);
- }
+ for(i = 0; i < block->num_points; i++) {
+ if(read_cb(buffer, 1, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH, handle) != FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ /* some MAGIC NUMBERs here */
+ block->points[i].sample_number = unpack_uint64_(buffer, 8);
+ block->points[i].stream_offset = unpack_uint64_(buffer+8, 8);
+ block->points[i].frame_samples = unpack_uint32_(buffer+16, 2);
+ }
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry)
{
- const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
- FLAC__byte buffer[4]; /* magic number is asserted below */
+ const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
+ FLAC__byte buffer[4]; /* magic number is asserted below */
- FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8 == sizeof(buffer));
+ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8 == sizeof(buffer));
- if(read_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- entry->length = unpack_uint32_little_endian_(buffer, entry_length_len);
+ if(read_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ entry->length = unpack_uint32_little_endian_(buffer, entry_length_len);
- if(0 != entry->entry)
- free(entry->entry);
+ if(0 != entry->entry)
+ free(entry->entry);
- if(entry->length == 0)
- {
- entry->entry = 0;
- }
- else
- {
- if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_2op_(entry->length, /*+*/1)))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(entry->length == 0) {
+ entry->entry = 0;
+ }
+ else {
+ if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_2op_(entry->length, /*+*/1)))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- if(read_cb(entry->entry, 1, entry->length, handle) != entry->length)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ if(read_cb(entry->entry, 1, entry->length, handle) != entry->length)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- entry->entry[entry->length] = '\0';
- }
+ entry->entry[entry->length] = '\0';
+ }
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block)
{
- unsigned i;
- FLAC__Metadata_SimpleIteratorStatus status;
- const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
- FLAC__byte buffer[4]; /* magic number is asserted below */
+ unsigned i;
+ FLAC__Metadata_SimpleIteratorStatus status;
+ const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
+ FLAC__byte buffer[4]; /* magic number is asserted below */
- FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8 == sizeof(buffer));
+ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8 == sizeof(buffer));
- if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, &(block->vendor_string))))
- return status;
+ if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, &(block->vendor_string))))
+ return status;
- if(read_cb(buffer, 1, num_comments_len, handle) != num_comments_len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->num_comments = unpack_uint32_little_endian_(buffer, num_comments_len);
+ if(read_cb(buffer, 1, num_comments_len, handle) != num_comments_len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->num_comments = unpack_uint32_little_endian_(buffer, num_comments_len);
- if(block->num_comments == 0)
- {
- block->comments = 0;
- }
- else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry))))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(block->num_comments == 0) {
+ block->comments = 0;
+ }
+ else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry))))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- for(i = 0; i < block->num_comments; i++)
- {
- if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, block->comments + i)))
- return status;
- }
+ for(i = 0; i < block->num_comments; i++) {
+ if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, block->comments + i)))
+ return status;
+ }
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track)
{
- unsigned i, len;
- FLAC__byte buffer[32]; /* asserted below that this is big enough */
-
- FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64));
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8);
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- track->offset = unpack_uint64_(buffer, len);
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- track->number = (FLAC__byte)unpack_uint32_(buffer, len);
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8;
- if(read_cb(track->isrc, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
-
- FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) % 8 == 0);
- len = (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN == 1);
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN == 1);
- track->type = buffer[0] >> 7;
- track->pre_emphasis = (buffer[0] >> 6) & 1;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- track->num_indices = (FLAC__byte)unpack_uint32_(buffer, len);
-
- if(track->num_indices == 0)
- {
- track->indices = 0;
- }
- else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index))))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
-
- for(i = 0; i < track->num_indices; i++)
- {
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- track->indices[i].offset = unpack_uint64_(buffer, len);
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- track->indices[i].number = (FLAC__byte)unpack_uint32_(buffer, len);
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- }
-
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ unsigned i, len;
+ FLAC__byte buffer[32]; /* asserted below that this is big enough */
+
+ FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64));
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8);
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ track->offset = unpack_uint64_(buffer, len);
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ track->number = (FLAC__byte)unpack_uint32_(buffer, len);
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8;
+ if(read_cb(track->isrc, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+
+ FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) % 8 == 0);
+ len = (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN == 1);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN == 1);
+ track->type = buffer[0] >> 7;
+ track->pre_emphasis = (buffer[0] >> 6) & 1;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ track->num_indices = (FLAC__byte)unpack_uint32_(buffer, len);
+
+ if(track->num_indices == 0) {
+ track->indices = 0;
+ }
+ else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index))))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+
+ for(i = 0; i < track->num_indices; i++) {
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ track->indices[i].offset = unpack_uint64_(buffer, len);
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ track->indices[i].number = (FLAC__byte)unpack_uint32_(buffer, len);
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ }
+
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block)
{
- unsigned i, len;
- FLAC__Metadata_SimpleIteratorStatus status;
- FLAC__byte buffer[1024]; /* MSVC needs a constant expression so we put a magic number and assert */
+ unsigned i, len;
+ FLAC__Metadata_SimpleIteratorStatus status;
+ FLAC__byte buffer[1024]; /* MSVC needs a constant expression so we put a magic number and assert */
- FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8 <= sizeof(buffer));
- FLAC__ASSERT(sizeof(FLAC__uint64) <= sizeof(buffer));
+ FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN)/8 <= sizeof(buffer));
+ FLAC__ASSERT(sizeof(FLAC__uint64) <= sizeof(buffer));
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8;
- if(read_cb(block->media_catalog_number, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8;
+ if(read_cb(block->media_catalog_number, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->lead_in = unpack_uint64_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->lead_in = unpack_uint64_(buffer, len);
- FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) % 8 == 0);
- len = (FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->is_cd = buffer[0] & 0x80 ? true : false;
+ FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) % 8 == 0);
+ len = (FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->is_cd = buffer[0]&0x80? true : false;
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->num_tracks = unpack_uint32_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->num_tracks = unpack_uint32_(buffer, len);
- if(block->num_tracks == 0)
- {
- block->tracks = 0;
- }
- else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track))))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(block->num_tracks == 0) {
+ block->tracks = 0;
+ }
+ else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track))))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- for(i = 0; i < block->num_tracks; i++)
- {
- if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_cuesheet_track_cb_(handle, read_cb, block->tracks + i)))
- return status;
- }
+ for(i = 0; i < block->num_tracks; i++) {
+ if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_cuesheet_track_cb_(handle, read_cb, block->tracks + i)))
+ return status;
+ }
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cstring_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__byte **data, FLAC__uint32 *length, FLAC__uint32 length_len)
{
- FLAC__byte buffer[sizeof(FLAC__uint32)];
+ FLAC__byte buffer[sizeof(FLAC__uint32)];
- FLAC__ASSERT(0 != data);
- FLAC__ASSERT(length_len % 8 == 0);
+ FLAC__ASSERT(0 != data);
+ FLAC__ASSERT(length_len%8 == 0);
- length_len /= 8; /* convert to bytes */
+ length_len /= 8; /* convert to bytes */
- FLAC__ASSERT(sizeof(buffer) >= length_len);
+ FLAC__ASSERT(sizeof(buffer) >= length_len);
- if(read_cb(buffer, 1, length_len, handle) != length_len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- *length = unpack_uint32_(buffer, length_len);
+ if(read_cb(buffer, 1, length_len, handle) != length_len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ *length = unpack_uint32_(buffer, length_len);
- if(0 != *data)
- free(*data);
+ if(0 != *data)
+ free(*data);
- if(0 == (*data = (FLAC__byte*)safe_malloc_add_2op_(*length, /*+*/1)))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(0 == (*data = (FLAC__byte*)safe_malloc_add_2op_(*length, /*+*/1)))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- if(*length > 0)
- {
- if(read_cb(*data, 1, *length, handle) != *length)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- }
+ if(*length > 0) {
+ if(read_cb(*data, 1, *length, handle) != *length)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ }
- (*data)[*length] = '\0';
+ (*data)[*length] = '\0';
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block)
{
- FLAC__Metadata_SimpleIteratorStatus status;
- FLAC__byte buffer[4]; /* asserted below that this is big enough */
- FLAC__uint32 len;
+ FLAC__Metadata_SimpleIteratorStatus status;
+ FLAC__byte buffer[4]; /* asserted below that this is big enough */
+ FLAC__uint32 len;
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8);
- FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_TYPE_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->type = (FLAC__StreamMetadata_Picture_Type)unpack_uint32_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_TYPE_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->type = (FLAC__StreamMetadata_Picture_Type)unpack_uint32_(buffer, len);
- if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, (FLAC__byte**)(&(block->mime_type)), &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
- return status;
+ if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, (FLAC__byte**)(&(block->mime_type)), &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
+ return status;
- if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->description), &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
- return status;
+ if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->description), &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
+ return status;
- FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->width = unpack_uint32_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->width = unpack_uint32_(buffer, len);
- FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->height = unpack_uint32_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->height = unpack_uint32_(buffer, len);
- FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->depth = unpack_uint32_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->depth = unpack_uint32_(buffer, len);
- FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_COLORS_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8;
- if(read_cb(buffer, 1, len, handle) != len)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- block->colors = unpack_uint32_(buffer, len);
+ FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_COLORS_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8;
+ if(read_cb(buffer, 1, len, handle) != len)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ block->colors = unpack_uint32_(buffer, len);
- /* for convenience we use read_metadata_block_data_picture_cstring_cb_() even though it adds an extra terminating NUL we don't use */
- if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->data), &(block->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
- return status;
+ /* for convenience we use read_metadata_block_data_picture_cstring_cb_() even though it adds an extra terminating NUL we don't use */
+ if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->data), &(block->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK)
+ return status;
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length)
{
- if(block_length == 0)
- {
- block->data = 0;
- }
- else
- {
- if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(block_length == 0) {
+ block->data = 0;
+ }
+ else {
+ if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- if(read_cb(block->data, 1, block_length, handle) != block_length)
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- }
+ if(read_cb(block->data, 1, block_length, handle) != block_length)
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ }
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block)
{
- FLAC__ASSERT(0 != file);
- FLAC__ASSERT(0 != status);
+ FLAC__ASSERT(0 != file);
+ FLAC__ASSERT(0 != status);
- if(!write_metadata_block_header_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
+ if(!write_metadata_block_header_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block)) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block)
{
- FLAC__ASSERT(0 != file);
- FLAC__ASSERT(0 != status);
+ FLAC__ASSERT(0 != file);
+ FLAC__ASSERT(0 != status);
- if(write_metadata_block_data_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
- return true;
- }
- else
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
+ if (write_metadata_block_data_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block)) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
+ return true;
+ }
+ else {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
}
FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block)
{
- FLAC__byte buffer[FLAC__STREAM_METADATA_HEADER_LENGTH];
+ FLAC__byte buffer[FLAC__STREAM_METADATA_HEADER_LENGTH];
- FLAC__ASSERT(block->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
+ FLAC__ASSERT(block->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
- buffer[0] = (block->is_last ? 0x80 : 0) | (FLAC__byte)block->type;
- pack_uint32_(block->length, buffer + 1, 3);
+ buffer[0] = (block->is_last? 0x80 : 0) | (FLAC__byte)block->type;
+ pack_uint32_(block->length, buffer + 1, 3);
- if(write_cb(buffer, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, handle) != FLAC__STREAM_METADATA_HEADER_LENGTH)
- return false;
+ if(write_cb(buffer, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, handle) != FLAC__STREAM_METADATA_HEADER_LENGTH)
+ return false;
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block)
{
- FLAC__ASSERT(0 != block);
-
- switch(block->type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- return write_metadata_block_data_streaminfo_cb_(handle, write_cb, &block->data.stream_info);
- case FLAC__METADATA_TYPE_PADDING:
- return write_metadata_block_data_padding_cb_(handle, write_cb, &block->data.padding, block->length);
- case FLAC__METADATA_TYPE_APPLICATION:
- return write_metadata_block_data_application_cb_(handle, write_cb, &block->data.application, block->length);
- case FLAC__METADATA_TYPE_SEEKTABLE:
- return write_metadata_block_data_seektable_cb_(handle, write_cb, &block->data.seek_table);
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- return write_metadata_block_data_vorbis_comment_cb_(handle, write_cb, &block->data.vorbis_comment);
- case FLAC__METADATA_TYPE_CUESHEET:
- return write_metadata_block_data_cuesheet_cb_(handle, write_cb, &block->data.cue_sheet);
- case FLAC__METADATA_TYPE_PICTURE:
- return write_metadata_block_data_picture_cb_(handle, write_cb, &block->data.picture);
- default:
- return write_metadata_block_data_unknown_cb_(handle, write_cb, &block->data.unknown, block->length);
- }
+ FLAC__ASSERT(0 != block);
+
+ switch(block->type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ return write_metadata_block_data_streaminfo_cb_(handle, write_cb, &block->data.stream_info);
+ case FLAC__METADATA_TYPE_PADDING:
+ return write_metadata_block_data_padding_cb_(handle, write_cb, &block->data.padding, block->length);
+ case FLAC__METADATA_TYPE_APPLICATION:
+ return write_metadata_block_data_application_cb_(handle, write_cb, &block->data.application, block->length);
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ return write_metadata_block_data_seektable_cb_(handle, write_cb, &block->data.seek_table);
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ return write_metadata_block_data_vorbis_comment_cb_(handle, write_cb, &block->data.vorbis_comment);
+ case FLAC__METADATA_TYPE_CUESHEET:
+ return write_metadata_block_data_cuesheet_cb_(handle, write_cb, &block->data.cue_sheet);
+ case FLAC__METADATA_TYPE_PICTURE:
+ return write_metadata_block_data_picture_cb_(handle, write_cb, &block->data.picture);
+ default:
+ return write_metadata_block_data_unknown_cb_(handle, write_cb, &block->data.unknown, block->length);
+ }
}
FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block)
{
- FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH];
- const unsigned channels1 = block->channels - 1;
- const unsigned bps1 = block->bits_per_sample - 1;
+ FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH];
+ const unsigned channels1 = block->channels - 1;
+ const unsigned bps1 = block->bits_per_sample - 1;
- /* we are using hardcoded numbers for simplicity but we should
- * probably eventually write a bit-level packer and use the
- * _STREAMINFO_ constants.
- */
- pack_uint32_(block->min_blocksize, buffer, 2);
- pack_uint32_(block->max_blocksize, buffer + 2, 2);
- pack_uint32_(block->min_framesize, buffer + 4, 3);
- pack_uint32_(block->max_framesize, buffer + 7, 3);
- buffer[10] = (block->sample_rate >> 12) & 0xff;
- buffer[11] = (block->sample_rate >> 4) & 0xff;
- buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4);
- buffer[13] = (FLAC__byte)(((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f));
- pack_uint32_((FLAC__uint32)block->total_samples, buffer + 14, 4);
- memcpy(buffer + 18, block->md5sum, 16);
+ /* we are using hardcoded numbers for simplicity but we should
+ * probably eventually write a bit-level packer and use the
+ * _STREAMINFO_ constants.
+ */
+ pack_uint32_(block->min_blocksize, buffer, 2);
+ pack_uint32_(block->max_blocksize, buffer+2, 2);
+ pack_uint32_(block->min_framesize, buffer+4, 3);
+ pack_uint32_(block->max_framesize, buffer+7, 3);
+ buffer[10] = (block->sample_rate >> 12) & 0xff;
+ buffer[11] = (block->sample_rate >> 4) & 0xff;
+ buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4);
+ buffer[13] = (FLAC__byte)(((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f));
+ pack_uint32_((FLAC__uint32)block->total_samples, buffer+14, 4);
+ memcpy(buffer+18, block->md5sum, 16);
- if(write_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH)
- return false;
+ if(write_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH)
+ return false;
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length)
{
- unsigned i, n = block_length;
- FLAC__byte buffer[1024];
+ unsigned i, n = block_length;
+ FLAC__byte buffer[1024];
- (void)block;
+ (void)block;
- memset(buffer, 0, 1024);
+ memset(buffer, 0, 1024);
- for(i = 0; i < n / 1024; i++)
- if(write_cb(buffer, 1, 1024, handle) != 1024)
- return false;
+ for(i = 0; i < n/1024; i++)
+ if(write_cb(buffer, 1, 1024, handle) != 1024)
+ return false;
- n %= 1024;
+ n %= 1024;
- if(write_cb(buffer, 1, n, handle) != n)
- return false;
+ if(write_cb(buffer, 1, n, handle) != n)
+ return false;
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length)
{
- const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+ const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
- if(write_cb(block->id, 1, id_bytes, handle) != id_bytes)
- return false;
+ if(write_cb(block->id, 1, id_bytes, handle) != id_bytes)
+ return false;
- block_length -= id_bytes;
+ block_length -= id_bytes;
- if(write_cb(block->data, 1, block_length, handle) != block_length)
- return false;
+ if(write_cb(block->data, 1, block_length, handle) != block_length)
+ return false;
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block)
{
- unsigned i;
- FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH];
+ unsigned i;
+ FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH];
- for(i = 0; i < block->num_points; i++)
- {
- /* some MAGIC NUMBERs here */
- pack_uint64_(block->points[i].sample_number, buffer, 8);
- pack_uint64_(block->points[i].stream_offset, buffer + 8, 8);
- pack_uint32_(block->points[i].frame_samples, buffer + 16, 2);
- if(write_cb(buffer, 1, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH, handle) != FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)
- return false;
- }
+ for(i = 0; i < block->num_points; i++) {
+ /* some MAGIC NUMBERs here */
+ pack_uint64_(block->points[i].sample_number, buffer, 8);
+ pack_uint64_(block->points[i].stream_offset, buffer+8, 8);
+ pack_uint32_(block->points[i].frame_samples, buffer+16, 2);
+ if(write_cb(buffer, 1, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH, handle) != FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)
+ return false;
+ }
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block)
{
- unsigned i;
- const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
- const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
- FLAC__byte buffer[4]; /* magic number is asserted below */
+ unsigned i;
+ const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
+ const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
+ FLAC__byte buffer[4]; /* magic number is asserted below */
- FLAC__ASSERT(max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer));
+ FLAC__ASSERT(max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer));
- pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len);
- if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
- return false;
- if(write_cb(block->vendor_string.entry, 1, block->vendor_string.length, handle) != block->vendor_string.length)
- return false;
+ pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len);
+ if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
+ return false;
+ if(write_cb(block->vendor_string.entry, 1, block->vendor_string.length, handle) != block->vendor_string.length)
+ return false;
- pack_uint32_little_endian_(block->num_comments, buffer, num_comments_len);
- if(write_cb(buffer, 1, num_comments_len, handle) != num_comments_len)
- return false;
+ pack_uint32_little_endian_(block->num_comments, buffer, num_comments_len);
+ if(write_cb(buffer, 1, num_comments_len, handle) != num_comments_len)
+ return false;
- for(i = 0; i < block->num_comments; i++)
- {
- pack_uint32_little_endian_(block->comments[i].length, buffer, entry_length_len);
- if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
- return false;
- if(write_cb(block->comments[i].entry, 1, block->comments[i].length, handle) != block->comments[i].length)
- return false;
- }
+ for(i = 0; i < block->num_comments; i++) {
+ pack_uint32_little_endian_(block->comments[i].length, buffer, entry_length_len);
+ if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
+ return false;
+ if(write_cb(block->comments[i].entry, 1, block->comments[i].length, handle) != block->comments[i].length)
+ return false;
+ }
- return true;
+ return true;
}
FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block)
{
- unsigned i, j, len;
- FLAC__byte buffer[1024]; /* asserted below that this is big enough */
-
- FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64));
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8);
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8;
- if(write_cb(block->media_catalog_number, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN / 8;
- pack_uint64_(block->lead_in, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) % 8 == 0);
- len = (FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8;
- memset(buffer, 0, len);
- if(block->is_cd)
- buffer[0] |= 0x80;
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN / 8;
- pack_uint32_(block->num_tracks, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- for(i = 0; i < block->num_tracks; i++)
- {
- FLAC__StreamMetadata_CueSheet_Track *track = block->tracks + i;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN / 8;
- pack_uint64_(track->offset, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN / 8;
- pack_uint32_(track->number, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8;
- if(write_cb(track->isrc, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) % 8 == 0);
- len = (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8;
- memset(buffer, 0, len);
- buffer[0] = (track->type << 7) | (track->pre_emphasis << 6);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN / 8;
- pack_uint32_(track->num_indices, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- for(j = 0; j < track->num_indices; j++)
- {
- FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8;
- pack_uint64_(index->offset, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8;
- pack_uint32_(index->number, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN % 8 == 0);
- len = FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8;
- memset(buffer, 0, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
- }
- }
-
- return true;
+ unsigned i, j, len;
+ FLAC__byte buffer[1024]; /* asserted below that this is big enough */
+
+ FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64));
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN)/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN/8);
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8;
+ if(write_cb(block->media_catalog_number, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN / 8;
+ pack_uint64_(block->lead_in, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) % 8 == 0);
+ len = (FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8;
+ memset(buffer, 0, len);
+ if(block->is_cd)
+ buffer[0] |= 0x80;
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN / 8;
+ pack_uint32_(block->num_tracks, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ for(i = 0; i < block->num_tracks; i++) {
+ FLAC__StreamMetadata_CueSheet_Track *track = block->tracks + i;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN / 8;
+ pack_uint64_(track->offset, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN / 8;
+ pack_uint32_(track->number, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8;
+ if(write_cb(track->isrc, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) % 8 == 0);
+ len = (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8;
+ memset(buffer, 0, len);
+ buffer[0] = (track->type << 7) | (track->pre_emphasis << 6);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN / 8;
+ pack_uint32_(track->num_indices, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ for(j = 0; j < track->num_indices; j++) {
+ FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8;
+ pack_uint64_(index->offset, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8;
+ pack_uint32_(index->number, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN % 8 == 0);
+ len = FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8;
+ memset(buffer, 0, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+ }
+ }
+
+ return true;
}
FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block)
{
- unsigned len;
- size_t slen;
- FLAC__byte buffer[4]; /* magic number is asserted below */
-
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_TYPE_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_COLORS_LEN % 8);
- FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN % 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8);
- FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN / 8);
-
- len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8;
- pack_uint32_(block->type, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN / 8;
- slen = strlen(block->mime_type);
- pack_uint32_(slen, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
- if(write_cb(block->mime_type, 1, slen, handle) != slen)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN / 8;
- slen = strlen((const char *)block->description);
- pack_uint32_(slen, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
- if(write_cb(block->description, 1, slen, handle) != slen)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8;
- pack_uint32_(block->width, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8;
- pack_uint32_(block->height, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8;
- pack_uint32_(block->depth, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8;
- pack_uint32_(block->colors, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
-
- len = FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN / 8;
- pack_uint32_(block->data_length, buffer, len);
- if(write_cb(buffer, 1, len, handle) != len)
- return false;
- if(write_cb(block->data, 1, block->data_length, handle) != block->data_length)
- return false;
-
- return true;
+ unsigned len;
+ size_t slen;
+ FLAC__byte buffer[4]; /* magic number is asserted below */
+
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_TYPE_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_COLORS_LEN%8);
+ FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN%8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8);
+ FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN/8);
+
+ len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8;
+ pack_uint32_(block->type, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN/8;
+ slen = strlen(block->mime_type);
+ pack_uint32_(slen, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+ if(write_cb(block->mime_type, 1, slen, handle) != slen)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN/8;
+ slen = strlen((const char *)block->description);
+ pack_uint32_(slen, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+ if(write_cb(block->description, 1, slen, handle) != slen)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8;
+ pack_uint32_(block->width, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8;
+ pack_uint32_(block->height, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8;
+ pack_uint32_(block->depth, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8;
+ pack_uint32_(block->colors, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+
+ len = FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN/8;
+ pack_uint32_(block->data_length, buffer, len);
+ if(write_cb(buffer, 1, len, handle) != len)
+ return false;
+ if(write_cb(block->data, 1, block->data_length, handle) != block->data_length)
+ return false;
+
+ return true;
}
FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length)
{
- if(write_cb(block->data, 1, block_length, handle) != block_length)
- return false;
+ if(write_cb(block->data, 1, block_length, handle) != block_length)
+ return false;
- return true;
+ return true;
}
FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block)
{
- if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- if(!write_metadata_block_header_(iterator->file, &iterator->status, block))
- return false;
+ if(!write_metadata_block_header_(iterator->file, &iterator->status, block))
+ return false;
- if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
- return false;
+ if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
+ return false;
- if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- return read_metadata_block_header_(iterator);
+ return read_metadata_block_header_(iterator);
}
FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last)
{
- FLAC__StreamMetadata *padding;
+ FLAC__StreamMetadata *padding;
- if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- block->is_last = false;
+ block->is_last = false;
- if(!write_metadata_block_header_(iterator->file, &iterator->status, block))
- return false;
+ if(!write_metadata_block_header_(iterator->file, &iterator->status, block))
+ return false;
- if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
- return false;
+ if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
+ return false;
- if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)))
- return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)))
+ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- padding->is_last = padding_is_last;
- padding->length = padding_length;
+ padding->is_last = padding_is_last;
+ padding->length = padding_length;
- if(!write_metadata_block_header_(iterator->file, &iterator->status, padding))
- {
- FLAC__metadata_object_delete(padding);
- return false;
- }
+ if(!write_metadata_block_header_(iterator->file, &iterator->status, padding)) {
+ FLAC__metadata_object_delete(padding);
+ return false;
+ }
- if(!write_metadata_block_data_(iterator->file, &iterator->status, padding))
- {
- FLAC__metadata_object_delete(padding);
- return false;
- }
+ if(!write_metadata_block_data_(iterator->file, &iterator->status, padding)) {
+ FLAC__metadata_object_delete(padding);
+ return false;
+ }
- FLAC__metadata_object_delete(padding);
+ FLAC__metadata_object_delete(padding);
- if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- return read_metadata_block_header_(iterator);
+ return read_metadata_block_header_(iterator);
}
FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append)
{
- FILE *tempfile;
- char *tempfilename;
- int fixup_is_last_code = 0; /* 0 => no need to change any is_last flags */
- off_t fixup_is_last_flag_offset = -1;
-
- FLAC__ASSERT(0 != block || append == false);
-
- if(iterator->is_last)
- {
- if(append)
- {
- fixup_is_last_code = 1; /* 1 => clear the is_last flag at the following offset */
- fixup_is_last_flag_offset = iterator->offset[iterator->depth];
- }
- else if(0 == block)
- {
- simple_iterator_push_(iterator);
- if(!FLAC__metadata_simple_iterator_prev(iterator))
- {
- (void)simple_iterator_pop_(iterator);
- return false;
- }
- fixup_is_last_code = -1; /* -1 => set the is_last the flag at the following offset */
- fixup_is_last_flag_offset = iterator->offset[iterator->depth];
- if(!simple_iterator_pop_(iterator))
- return false;
- }
- }
-
- if(!simple_iterator_copy_file_prefix_(iterator, &tempfile, &tempfilename, append))
- return false;
-
- if(0 != block)
- {
- if(!write_metadata_block_header_(tempfile, &iterator->status, block))
- {
- cleanup_tempfile_(&tempfile, &tempfilename);
- return false;
- }
-
- if(!write_metadata_block_data_(tempfile, &iterator->status, block))
- {
- cleanup_tempfile_(&tempfile, &tempfilename);
- return false;
- }
- }
-
- if(!simple_iterator_copy_file_postfix_(iterator, &tempfile, &tempfilename, fixup_is_last_code, fixup_is_last_flag_offset, block == 0))
- return false;
-
- if(append)
- return FLAC__metadata_simple_iterator_next(iterator);
-
- return true;
+ FILE *tempfile;
+ char *tempfilename;
+ int fixup_is_last_code = 0; /* 0 => no need to change any is_last flags */
+ off_t fixup_is_last_flag_offset = -1;
+
+ FLAC__ASSERT(0 != block || append == false);
+
+ if(iterator->is_last) {
+ if(append) {
+ fixup_is_last_code = 1; /* 1 => clear the is_last flag at the following offset */
+ fixup_is_last_flag_offset = iterator->offset[iterator->depth];
+ }
+ else if(0 == block) {
+ simple_iterator_push_(iterator);
+ if(!FLAC__metadata_simple_iterator_prev(iterator)) {
+ (void)simple_iterator_pop_(iterator);
+ return false;
+ }
+ fixup_is_last_code = -1; /* -1 => set the is_last the flag at the following offset */
+ fixup_is_last_flag_offset = iterator->offset[iterator->depth];
+ if(!simple_iterator_pop_(iterator))
+ return false;
+ }
+ }
+
+ if(!simple_iterator_copy_file_prefix_(iterator, &tempfile, &tempfilename, append))
+ return false;
+
+ if(0 != block) {
+ if(!write_metadata_block_header_(tempfile, &iterator->status, block)) {
+ cleanup_tempfile_(&tempfile, &tempfilename);
+ return false;
+ }
+
+ if(!write_metadata_block_data_(tempfile, &iterator->status, block)) {
+ cleanup_tempfile_(&tempfile, &tempfilename);
+ return false;
+ }
+ }
+
+ if(!simple_iterator_copy_file_postfix_(iterator, &tempfile, &tempfilename, fixup_is_last_code, fixup_is_last_flag_offset, block==0))
+ return false;
+
+ if(append)
+ return FLAC__metadata_simple_iterator_next(iterator);
+
+ return true;
}
void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(iterator->depth + 1 < SIMPLE_ITERATOR_MAX_PUSH_DEPTH);
- iterator->offset[iterator->depth+1] = iterator->offset[iterator->depth];
- iterator->depth++;
+ FLAC__ASSERT(iterator->depth+1 < SIMPLE_ITERATOR_MAX_PUSH_DEPTH);
+ iterator->offset[iterator->depth+1] = iterator->offset[iterator->depth];
+ iterator->depth++;
}
FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator)
{
- FLAC__ASSERT(iterator->depth > 0);
- iterator->depth--;
- if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
+ FLAC__ASSERT(iterator->depth > 0);
+ iterator->depth--;
+ if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
- return read_metadata_block_header_(iterator);
+ return read_metadata_block_header_(iterator);
}
/* return meanings:
@@ -3174,426 +2977,388 @@ FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator)
*/
unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb)
{
- FLAC__byte buffer[4];
- size_t n;
- unsigned i;
-
- FLAC__ASSERT(FLAC__STREAM_SYNC_LENGTH == sizeof(buffer));
-
- /* skip any id3v2 tag */
- errno = 0;
- n = read_cb(buffer, 1, 4, handle);
- if(errno)
- return 1;
- else if(n != 4)
- return 3;
- else if(0 == memcmp(buffer, "ID3", 3))
- {
- unsigned tag_length = 0;
-
- /* skip to the tag length */
- if(seek_cb(handle, 2, SEEK_CUR) < 0)
- return 2;
-
- /* read the length */
- for(i = 0; i < 4; i++)
- {
- if(read_cb(buffer, 1, 1, handle) < 1 || buffer[0] & 0x80)
- return 1;
- tag_length <<= 7;
- tag_length |= (buffer[0] & 0x7f);
- }
-
- /* skip the rest of the tag */
- if(seek_cb(handle, tag_length, SEEK_CUR) < 0)
- return 2;
-
- /* read the stream sync code */
- errno = 0;
- n = read_cb(buffer, 1, 4, handle);
- if(errno)
- return 1;
- else if(n != 4)
- return 3;
- }
-
- /* check for the fLaC signature */
- if(0 == memcmp(FLAC__STREAM_SYNC_STRING, buffer, FLAC__STREAM_SYNC_LENGTH))
- return 0;
- else
- return 3;
+ FLAC__byte buffer[4];
+ size_t n;
+ unsigned i;
+
+ FLAC__ASSERT(FLAC__STREAM_SYNC_LENGTH == sizeof(buffer));
+
+ /* skip any id3v2 tag */
+ errno = 0;
+ n = read_cb(buffer, 1, 4, handle);
+ if(errno)
+ return 1;
+ else if(n != 4)
+ return 3;
+ else if(0 == memcmp(buffer, "ID3", 3)) {
+ unsigned tag_length = 0;
+
+ /* skip to the tag length */
+ if(seek_cb(handle, 2, SEEK_CUR) < 0)
+ return 2;
+
+ /* read the length */
+ for(i = 0; i < 4; i++) {
+ if(read_cb(buffer, 1, 1, handle) < 1 || buffer[0] & 0x80)
+ return 1;
+ tag_length <<= 7;
+ tag_length |= (buffer[0] & 0x7f);
+ }
+
+ /* skip the rest of the tag */
+ if(seek_cb(handle, tag_length, SEEK_CUR) < 0)
+ return 2;
+
+ /* read the stream sync code */
+ errno = 0;
+ n = read_cb(buffer, 1, 4, handle);
+ if(errno)
+ return 1;
+ else if(n != 4)
+ return 3;
+ }
+
+ /* check for the fLaC signature */
+ if(0 == memcmp(FLAC__STREAM_SYNC_STRING, buffer, FLAC__STREAM_SYNC_LENGTH))
+ return 0;
+ else
+ return 3;
}
unsigned seek_to_first_metadata_block_(FILE *f)
{
- return seek_to_first_metadata_block_cb_((FLAC__IOHandle)f, (FLAC__IOCallback_Read)fread, fseek_wrapper_);
+ return seek_to_first_metadata_block_cb_((FLAC__IOHandle)f, (FLAC__IOCallback_Read)fread, fseek_wrapper_);
}
FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append)
{
- const off_t offset_end = append ? iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length : iterator->offset[iterator->depth];
+ const off_t offset_end = append? iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length : iterator->offset[iterator->depth];
- if(0 != fseeko(iterator->file, 0, SEEK_SET))
- {
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
- if(!open_tempfile_(iterator->filename, iterator->tempfile_path_prefix, tempfile, tempfilename, &iterator->status))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- return false;
- }
- if(!copy_n_bytes_from_file_(iterator->file, *tempfile, offset_end, &iterator->status))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- return false;
- }
+ if(0 != fseeko(iterator->file, 0, SEEK_SET)) {
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
+ if(!open_tempfile_(iterator->filename, iterator->tempfile_path_prefix, tempfile, tempfilename, &iterator->status)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ return false;
+ }
+ if(!copy_n_bytes_from_file_(iterator->file, *tempfile, offset_end, &iterator->status)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ return false;
+ }
- return true;
+ return true;
}
FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup)
{
- off_t save_offset = iterator->offset[iterator->depth];
- FLAC__ASSERT(0 != *tempfile);
-
- if(0 != fseeko(iterator->file, save_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length, SEEK_SET))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
- if(!copy_remaining_bytes_from_file_(iterator->file, *tempfile, &iterator->status))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- return false;
- }
-
- if(fixup_is_last_code != 0)
- {
- /*
- * if code == 1, it means a block was appended to the end so
- * we have to clear the is_last flag of the previous block
- * if code == -1, it means the last block was deleted so
- * we have to set the is_last flag of the previous block
- */
- /* MAGIC NUMBERs here; we know the is_last flag is the high bit of the byte at this location */
- FLAC__byte x;
- if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
- if(fread(&x, 1, 1, *tempfile) != 1)
- {
- cleanup_tempfile_(tempfile, tempfilename);
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
- if(fixup_is_last_code > 0)
- {
- FLAC__ASSERT(x & 0x80);
- x &= 0x7f;
- }
- else
- {
- FLAC__ASSERT(!(x & 0x80));
- x |= 0x80;
- }
- if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
- return false;
- }
- if(local__fwrite(&x, 1, 1, *tempfile) != 1)
- {
- cleanup_tempfile_(tempfile, tempfilename);
- iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
- }
-
- (void)fclose(iterator->file);
-
- if(!transport_tempfile_(iterator->filename, tempfile, tempfilename, &iterator->status))
- return false;
-
- if(iterator->has_stats)
- set_file_stats_(iterator->filename, &iterator->stats);
-
- if(!simple_iterator_prime_input_(iterator, !iterator->is_writable))
- return false;
- if(backup)
- {
- while(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length < save_offset)
- if(!FLAC__metadata_simple_iterator_next(iterator))
- return false;
- return true;
- }
- else
- {
- /* move the iterator to it's original block faster by faking a push, then doing a pop_ */
- FLAC__ASSERT(iterator->depth == 0);
- iterator->offset[0] = save_offset;
- iterator->depth++;
- return simple_iterator_pop_(iterator);
- }
+ off_t save_offset = iterator->offset[iterator->depth];
+ FLAC__ASSERT(0 != *tempfile);
+
+ if(0 != fseeko(iterator->file, save_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length, SEEK_SET)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
+ if(!copy_remaining_bytes_from_file_(iterator->file, *tempfile, &iterator->status)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ return false;
+ }
+
+ if(fixup_is_last_code != 0) {
+ /*
+ * if code == 1, it means a block was appended to the end so
+ * we have to clear the is_last flag of the previous block
+ * if code == -1, it means the last block was deleted so
+ * we have to set the is_last flag of the previous block
+ */
+ /* MAGIC NUMBERs here; we know the is_last flag is the high bit of the byte at this location */
+ FLAC__byte x;
+ if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
+ if(fread(&x, 1, 1, *tempfile) != 1) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
+ if(fixup_is_last_code > 0) {
+ FLAC__ASSERT(x & 0x80);
+ x &= 0x7f;
+ }
+ else {
+ FLAC__ASSERT(!(x & 0x80));
+ x |= 0x80;
+ }
+ if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
+ return false;
+ }
+ if(local__fwrite(&x, 1, 1, *tempfile) != 1) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
+ }
+
+ (void)fclose(iterator->file);
+
+ if(!transport_tempfile_(iterator->filename, tempfile, tempfilename, &iterator->status))
+ return false;
+
+ if(iterator->has_stats)
+ set_file_stats_(iterator->filename, &iterator->stats);
+
+ if(!simple_iterator_prime_input_(iterator, !iterator->is_writable))
+ return false;
+ if(backup) {
+ while(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length < save_offset)
+ if(!FLAC__metadata_simple_iterator_next(iterator))
+ return false;
+ return true;
+ }
+ else {
+ /* move the iterator to it's original block faster by faking a push, then doing a pop_ */
+ FLAC__ASSERT(iterator->depth == 0);
+ iterator->offset[0] = save_offset;
+ iterator->depth++;
+ return simple_iterator_pop_(iterator);
+ }
}
FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status)
{
- FLAC__byte buffer[8192];
- size_t n;
-
- FLAC__ASSERT(bytes >= 0);
- while(bytes > 0)
- {
- n = min(sizeof(buffer), (size_t)bytes);
- if(fread(buffer, 1, n, file) != n)
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
- if(local__fwrite(buffer, 1, n, tempfile) != n)
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
- bytes -= n;
- }
-
- return true;
+ FLAC__byte buffer[8192];
+ size_t n;
+
+ FLAC__ASSERT(bytes >= 0);
+ while(bytes > 0) {
+ n = min(sizeof(buffer), (size_t)bytes);
+ if(fread(buffer, 1, n, file) != n) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
+ if(local__fwrite(buffer, 1, n, tempfile) != n) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
+ bytes -= n;
+ }
+
+ return true;
}
FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status)
{
- FLAC__byte buffer[8192];
- size_t n;
-
- FLAC__ASSERT(bytes >= 0);
- while(bytes > 0)
- {
- n = min(sizeof(buffer), (size_t)bytes);
- if(read_cb(buffer, 1, n, handle) != n)
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
- if(temp_write_cb(buffer, 1, n, temp_handle) != n)
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
- bytes -= n;
- }
-
- return true;
+ FLAC__byte buffer[8192];
+ size_t n;
+
+ FLAC__ASSERT(bytes >= 0);
+ while(bytes > 0) {
+ n = min(sizeof(buffer), (size_t)bytes);
+ if(read_cb(buffer, 1, n, handle) != n) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
+ if(temp_write_cb(buffer, 1, n, temp_handle) != n) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
+ bytes -= n;
+ }
+
+ return true;
}
FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status)
{
- FLAC__byte buffer[8192];
- size_t n;
+ FLAC__byte buffer[8192];
+ size_t n;
- while(!feof(file))
- {
- n = fread(buffer, 1, sizeof(buffer), file);
- if(n == 0 && !feof(file))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
- if(n > 0 && local__fwrite(buffer, 1, n, tempfile) != n)
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
- }
+ while(!feof(file)) {
+ n = fread(buffer, 1, sizeof(buffer), file);
+ if(n == 0 && !feof(file)) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
+ if(n > 0 && local__fwrite(buffer, 1, n, tempfile) != n) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
+ }
- return true;
+ return true;
}
FLAC__bool copy_remaining_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__Metadata_SimpleIteratorStatus *status)
{
- FLAC__byte buffer[8192];
- size_t n;
+ FLAC__byte buffer[8192];
+ size_t n;
- while(!eof_cb(handle))
- {
- n = read_cb(buffer, 1, sizeof(buffer), handle);
- if(n == 0 && !eof_cb(handle))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
- return false;
- }
- if(n > 0 && temp_write_cb(buffer, 1, n, temp_handle) != n)
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
- return false;
- }
- }
+ while(!eof_cb(handle)) {
+ n = read_cb(buffer, 1, sizeof(buffer), handle);
+ if(n == 0 && !eof_cb(handle)) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
+ return false;
+ }
+ if(n > 0 && temp_write_cb(buffer, 1, n, temp_handle) != n) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR;
+ return false;
+ }
+ }
- return true;
+ return true;
}
FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status)
{
- static const char *tempfile_suffix = ".metadata_edit";
- if(0 == tempfile_path_prefix)
- {
- if(0 == (*tempfilename = (char*)safe_malloc_add_3op_(strlen(filename), /*+*/strlen(tempfile_suffix), /*+*/1)))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- strcpy(*tempfilename, filename);
- strcat(*tempfilename, tempfile_suffix);
- }
- else
- {
- const char *p = strrchr(filename, '/');
- if(0 == p)
- p = filename;
- else
- p++;
-
- if(0 == (*tempfilename = (char*)safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2)))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- strcpy(*tempfilename, tempfile_path_prefix);
- strcat(*tempfilename, "/");
- strcat(*tempfilename, p);
- strcat(*tempfilename, tempfile_suffix);
- }
-
- if(0 == (*tempfile = fopen(*tempfilename, "w+b")))
- {
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
- return false;
- }
-
- return true;
+ static const char *tempfile_suffix = ".metadata_edit";
+ if(0 == tempfile_path_prefix) {
+ if(0 == (*tempfilename = (char*)safe_malloc_add_3op_(strlen(filename), /*+*/strlen(tempfile_suffix), /*+*/1))) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ strcpy(*tempfilename, filename);
+ strcat(*tempfilename, tempfile_suffix);
+ }
+ else {
+ const char *p = strrchr(filename, '/');
+ if(0 == p)
+ p = filename;
+ else
+ p++;
+
+ if(0 == (*tempfilename = (char*)safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2))) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ strcpy(*tempfilename, tempfile_path_prefix);
+ strcat(*tempfilename, "/");
+ strcat(*tempfilename, p);
+ strcat(*tempfilename, tempfile_suffix);
+ }
+
+ if(0 == (*tempfile = fopen(*tempfilename, "w+b"))) {
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
+ return false;
+ }
+
+ return true;
}
FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status)
{
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != tempfile);
- FLAC__ASSERT(0 != *tempfile);
- FLAC__ASSERT(0 != tempfilename);
- FLAC__ASSERT(0 != *tempfilename);
- FLAC__ASSERT(0 != status);
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != tempfile);
+ FLAC__ASSERT(0 != *tempfile);
+ FLAC__ASSERT(0 != tempfilename);
+ FLAC__ASSERT(0 != *tempfilename);
+ FLAC__ASSERT(0 != status);
- (void)fclose(*tempfile);
- *tempfile = 0;
+ (void)fclose(*tempfile);
+ *tempfile = 0;
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ || defined __EMX__
- /* on some flavors of windows, rename() will fail if the destination already exists */
- if(unlink(filename) < 0)
- {
- cleanup_tempfile_(tempfile, tempfilename);
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR;
- return false;
- }
+ /* on some flavors of windows, rename() will fail if the destination already exists */
+ if(unlink(filename) < 0) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR;
+ return false;
+ }
#endif
- /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just rename(): */
- if(0 != rename(*tempfilename, filename))
- {
- cleanup_tempfile_(tempfile, tempfilename);
- *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR;
- return false;
- }
+ /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just rename(): */
+ if(0 != rename(*tempfilename, filename)) {
+ cleanup_tempfile_(tempfile, tempfilename);
+ *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR;
+ return false;
+ }
- cleanup_tempfile_(tempfile, tempfilename);
+ cleanup_tempfile_(tempfile, tempfilename);
- return true;
+ return true;
}
void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
{
- if(0 != *tempfile)
- {
- (void)fclose(*tempfile);
- *tempfile = 0;
- }
+ if(0 != *tempfile) {
+ (void)fclose(*tempfile);
+ *tempfile = 0;
+ }
- if(0 != *tempfilename)
- {
- (void)unlink(*tempfilename);
- free(*tempfilename);
- *tempfilename = 0;
- }
+ if(0 != *tempfilename) {
+ (void)unlink(*tempfilename);
+ free(*tempfilename);
+ *tempfilename = 0;
+ }
}
FLAC__bool get_file_stats_(const char *filename, struct stat *stats)
{
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != stats);
- return (0 == stat(filename, stats));
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != stats);
+ return (0 == stat(filename, stats));
}
void set_file_stats_(const char *filename, struct stat *stats)
{
- struct utimbuf srctime;
+ struct utimbuf srctime;
- FLAC__ASSERT(0 != filename);
- FLAC__ASSERT(0 != stats);
+ FLAC__ASSERT(0 != filename);
+ FLAC__ASSERT(0 != stats);
- srctime.actime = stats->st_atime;
- srctime.modtime = stats->st_mtime;
- (void)chmod(filename, stats->st_mode);
- (void)utime(filename, &srctime);
+ srctime.actime = stats->st_atime;
+ srctime.modtime = stats->st_mtime;
+ (void)chmod(filename, stats->st_mode);
+ (void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __BORLANDC__ && !defined __MINGW32__ && !defined __EMX__
- (void)chown(filename, stats->st_uid, -1);
- (void)chown(filename, -1, stats->st_gid);
+ (void)chown(filename, stats->st_uid, -1);
+ (void)chown(filename, -1, stats->st_gid);
#endif
}
int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence)
{
- return fseeko((FILE*)handle, (off_t)offset, whence);
+ return fseeko((FILE*)handle, (off_t)offset, whence);
}
FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle)
{
- return ftello((FILE*)handle);
+ return ftello((FILE*)handle);
}
FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIteratorStatus status)
{
- switch(status)
- {
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK:
- return FLAC__METADATA_CHAIN_STATUS_OK;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT:
- return FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE:
- return FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE:
- return FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE:
- return FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA:
- return FLAC__METADATA_CHAIN_STATUS_BAD_METADATA;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR:
- return FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR:
- return FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR:
- return FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR:
- return FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR:
- return FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR:
- return FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
- case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR:
- default:
- return FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
- }
+ switch(status) {
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK:
+ return FLAC__METADATA_CHAIN_STATUS_OK;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT:
+ return FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE:
+ return FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE:
+ return FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE:
+ return FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA:
+ return FLAC__METADATA_CHAIN_STATUS_BAD_METADATA;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR:
+ return FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR:
+ return FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR:
+ return FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR:
+ return FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR:
+ return FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR:
+ return FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR;
+ case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR:
+ default:
+ return FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_object.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_object.c
index 0e9b40b8b..e249e2289 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_object.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/metadata_object.c
@@ -58,39 +58,36 @@
*/
static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes)
{
- FLAC__ASSERT(0 != to);
- if(bytes > 0 && 0 != from)
- {
- FLAC__byte *x;
- if(0 == (x = (FLAC__byte*)safe_malloc_(bytes)))
- return false;
- memcpy(x, from, bytes);
- *to = x;
- }
- else
- {
- FLAC__ASSERT(0 == from);
- FLAC__ASSERT(bytes == 0);
- *to = 0;
- }
- return true;
+ FLAC__ASSERT(0 != to);
+ if(bytes > 0 && 0 != from) {
+ FLAC__byte *x;
+ if(0 == (x = (FLAC__byte*)safe_malloc_(bytes)))
+ return false;
+ memcpy(x, from, bytes);
+ *to = x;
+ }
+ else {
+ FLAC__ASSERT(0 == from);
+ FLAC__ASSERT(bytes == 0);
+ *to = 0;
+ }
+ return true;
}
#if 0 /* UNUSED */
/* like copy_bytes_(), but free()s the original '*to' if the copy succeeds and the original '*to' is non-NULL */
static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes)
{
- FLAC__byte *copy;
- FLAC__ASSERT(0 != to);
- if(copy_bytes_(&copy, from, bytes))
- {
- if(*to)
- free(*to);
- *to = copy;
- return true;
- }
- else
- return false;
+ FLAC__byte *copy;
+ FLAC__ASSERT(0 != to);
+ if(copy_bytes_(&copy, from, bytes)) {
+ if(*to)
+ free(*to);
+ *to = copy;
+ return true;
+ }
+ else
+ return false;
}
#endif
@@ -98,15 +95,14 @@ static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsi
/* realloc() failure leaves entry unchanged */
static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length)
{
- FLAC__byte *x = (FLAC__byte*)safe_realloc_add_2op_(*entry, length, /*+*/1);
- if(0 != x)
- {
- x[length] = '\0';
- *entry = x;
- return true;
- }
- else
- return false;
+ FLAC__byte *x = (FLAC__byte*)safe_realloc_add_2op_(*entry, length, /*+*/1);
+ if(0 != x) {
+ x[length] = '\0';
+ *entry = x;
+ return true;
+ }
+ else
+ return false;
}
/* copies the NUL-terminated C-string 'from' to '*to', leaving '*to'
@@ -115,340 +111,316 @@ static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length)
*/
static FLAC__bool copy_cstring_(char **to, const char *from)
{
- char *copy = strdup(from);
- FLAC__ASSERT(to);
- if(copy)
- {
- if(*to)
- free(*to);
- *to = copy;
- return true;
- }
- else
- return false;
+ char *copy = strdup(from);
+ FLAC__ASSERT(to);
+ if(copy) {
+ if(*to)
+ free(*to);
+ *to = copy;
+ return true;
+ }
+ else
+ return false;
}
static FLAC__bool copy_vcentry_(FLAC__StreamMetadata_VorbisComment_Entry *to, const FLAC__StreamMetadata_VorbisComment_Entry *from)
{
- to->length = from->length;
- if(0 == from->entry)
- {
- FLAC__ASSERT(from->length == 0);
- to->entry = 0;
- }
- else
- {
- FLAC__byte *x;
- FLAC__ASSERT(from->length > 0);
- if(0 == (x = (FLAC__byte*)safe_malloc_add_2op_(from->length, /*+*/1)))
- return false;
- memcpy(x, from->entry, from->length);
- x[from->length] = '\0';
- to->entry = x;
- }
- return true;
+ to->length = from->length;
+ if(0 == from->entry) {
+ FLAC__ASSERT(from->length == 0);
+ to->entry = 0;
+ }
+ else {
+ FLAC__byte *x;
+ FLAC__ASSERT(from->length > 0);
+ if(0 == (x = (FLAC__byte*)safe_malloc_add_2op_(from->length, /*+*/1)))
+ return false;
+ memcpy(x, from->entry, from->length);
+ x[from->length] = '\0';
+ to->entry = x;
+ }
+ return true;
}
static FLAC__bool copy_track_(FLAC__StreamMetadata_CueSheet_Track *to, const FLAC__StreamMetadata_CueSheet_Track *from)
{
- memcpy(to, from, sizeof(FLAC__StreamMetadata_CueSheet_Track));
- if(0 == from->indices)
- {
- FLAC__ASSERT(from->num_indices == 0);
- }
- else
- {
- FLAC__StreamMetadata_CueSheet_Index *x;
- FLAC__ASSERT(from->num_indices > 0);
- if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))))
- return false;
- memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
- to->indices = x;
- }
- return true;
+ memcpy(to, from, sizeof(FLAC__StreamMetadata_CueSheet_Track));
+ if(0 == from->indices) {
+ FLAC__ASSERT(from->num_indices == 0);
+ }
+ else {
+ FLAC__StreamMetadata_CueSheet_Index *x;
+ FLAC__ASSERT(from->num_indices > 0);
+ if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))))
+ return false;
+ memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
+ to->indices = x;
+ }
+ return true;
}
static void seektable_calculate_length_(FLAC__StreamMetadata *object)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- object->length = object->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
+ object->length = object->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
}
static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points)
{
- FLAC__StreamMetadata_SeekPoint *object_array;
+ FLAC__StreamMetadata_SeekPoint *object_array;
- FLAC__ASSERT(num_points > 0);
+ FLAC__ASSERT(num_points > 0);
- object_array = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
+ object_array = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
- if(0 != object_array)
- {
- unsigned i;
- for(i = 0; i < num_points; i++)
- {
- object_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
- object_array[i].stream_offset = 0;
- object_array[i].frame_samples = 0;
- }
- }
+ if(0 != object_array) {
+ unsigned i;
+ for(i = 0; i < num_points; i++) {
+ object_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
+ object_array[i].stream_offset = 0;
+ object_array[i].frame_samples = 0;
+ }
+ }
- return object_array;
+ return object_array;
}
static void vorbiscomment_calculate_length_(FLAC__StreamMetadata *object)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- object->length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN) / 8;
- object->length += object->data.vorbis_comment.vendor_string.length;
- object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8;
- for(i = 0; i < object->data.vorbis_comment.num_comments; i++)
- {
- object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8);
- object->length += object->data.vorbis_comment.comments[i].length;
- }
+ object->length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN) / 8;
+ object->length += object->data.vorbis_comment.vendor_string.length;
+ object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8;
+ for(i = 0; i < object->data.vorbis_comment.num_comments; i++) {
+ object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8);
+ object->length += object->data.vorbis_comment.comments[i].length;
+ }
}
static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(unsigned num_comments)
{
- FLAC__ASSERT(num_comments > 0);
+ FLAC__ASSERT(num_comments > 0);
- return (FLAC__StreamMetadata_VorbisComment_Entry*)safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
+ return (FLAC__StreamMetadata_VorbisComment_Entry*)safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
}
static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(0 != object_array && num_comments > 0);
+ FLAC__ASSERT(0 != object_array && num_comments > 0);
- for(i = 0; i < num_comments; i++)
- if(0 != object_array[i].entry)
- free(object_array[i].entry);
+ for(i = 0; i < num_comments; i++)
+ if(0 != object_array[i].entry)
+ free(object_array[i].entry);
- if(0 != object_array)
- free(object_array);
+ if(0 != object_array)
+ free(object_array);
}
static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments)
{
- FLAC__StreamMetadata_VorbisComment_Entry *return_array;
+ FLAC__StreamMetadata_VorbisComment_Entry *return_array;
- FLAC__ASSERT(0 != object_array);
- FLAC__ASSERT(num_comments > 0);
+ FLAC__ASSERT(0 != object_array);
+ FLAC__ASSERT(num_comments > 0);
- return_array = vorbiscomment_entry_array_new_(num_comments);
+ return_array = vorbiscomment_entry_array_new_(num_comments);
- if(0 != return_array)
- {
- unsigned i;
+ if(0 != return_array) {
+ unsigned i;
- for(i = 0; i < num_comments; i++)
- {
- if(!copy_vcentry_(return_array + i, object_array + i))
- {
- vorbiscomment_entry_array_delete_(return_array, num_comments);
- return 0;
- }
- }
- }
+ for(i = 0; i < num_comments; i++) {
+ if(!copy_vcentry_(return_array+i, object_array+i)) {
+ vorbiscomment_entry_array_delete_(return_array, num_comments);
+ return 0;
+ }
+ }
+ }
- return return_array;
+ return return_array;
}
static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry *dest, const FLAC__StreamMetadata_VorbisComment_Entry *src, FLAC__bool copy)
{
- FLAC__byte *save;
-
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(0 != dest);
- FLAC__ASSERT(0 != src);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- FLAC__ASSERT((0 != src->entry && src->length > 0) || (0 == src->entry && src->length == 0));
-
- save = dest->entry;
-
- if(0 != src->entry && src->length > 0)
- {
- if(copy)
- {
- /* do the copy first so that if we fail we leave the dest object untouched */
- if(!copy_vcentry_(dest, src))
- return false;
- }
- else
- {
- /* we have to make sure that the string we're taking over is null-terminated */
-
- /*
- * Stripping the const from src->entry is OK since we're taking
- * ownership of the pointer. This is a hack around a deficiency
- * in the API where the same function is used for 'copy' and
- * 'own', but the source entry is a const pointer. If we were
- * precise, the 'own' flavor would be a separate function with a
- * non-const source pointer. But it's not, so we hack away.
- */
- if(!ensure_null_terminated_((FLAC__byte**)(&src->entry), src->length))
- return false;
- *dest = *src;
- }
- }
- else
- {
- /* the src is null */
- *dest = *src;
- }
-
- if(0 != save)
- free(save);
-
- vorbiscomment_calculate_length_(object);
- return true;
+ FLAC__byte *save;
+
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != dest);
+ FLAC__ASSERT(0 != src);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT((0 != src->entry && src->length > 0) || (0 == src->entry && src->length == 0));
+
+ save = dest->entry;
+
+ if(0 != src->entry && src->length > 0) {
+ if(copy) {
+ /* do the copy first so that if we fail we leave the dest object untouched */
+ if(!copy_vcentry_(dest, src))
+ return false;
+ }
+ else {
+ /* we have to make sure that the string we're taking over is null-terminated */
+
+ /*
+ * Stripping the const from src->entry is OK since we're taking
+ * ownership of the pointer. This is a hack around a deficiency
+ * in the API where the same function is used for 'copy' and
+ * 'own', but the source entry is a const pointer. If we were
+ * precise, the 'own' flavor would be a separate function with a
+ * non-const source pointer. But it's not, so we hack away.
+ */
+ if(!ensure_null_terminated_((FLAC__byte**)(&src->entry), src->length))
+ return false;
+ *dest = *src;
+ }
+ }
+ else {
+ /* the src is null */
+ *dest = *src;
+ }
+
+ if(0 != save)
+ free(save);
+
+ vorbiscomment_calculate_length_(object);
+ return true;
}
static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name, unsigned field_name_length)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- FLAC__ASSERT(0 != field_name);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT(0 != field_name);
- for(i = offset; i < object->data.vorbis_comment.num_comments; i++)
- {
- if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length))
- return (int)i;
- }
+ for(i = offset; i < object->data.vorbis_comment.num_comments; i++) {
+ if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length))
+ return (int)i;
+ }
- return -1;
+ return -1;
}
static void cuesheet_calculate_length_(FLAC__StreamMetadata *object)
{
- unsigned i;
-
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
-
- object->length = (
- FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN +
- FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN +
- FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN +
- FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN +
- FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN
- ) / 8;
-
- object->length += object->data.cue_sheet.num_tracks * (
- FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN +
- FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN +
- FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN +
- FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN +
- FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN +
- FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN +
- FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN
- ) / 8;
-
- for(i = 0; i < object->data.cue_sheet.num_tracks; i++)
- {
- object->length += object->data.cue_sheet.tracks[i].num_indices * (
- FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN +
- FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN +
- FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN
- ) / 8;
- }
+ unsigned i;
+
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+
+ object->length = (
+ FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN
+ ) / 8;
+
+ object->length += object->data.cue_sheet.num_tracks * (
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN
+ ) / 8;
+
+ for(i = 0; i < object->data.cue_sheet.num_tracks; i++) {
+ object->length += object->data.cue_sheet.tracks[i].num_indices * (
+ FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN +
+ FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN
+ ) / 8;
+ }
}
static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(unsigned num_indices)
{
- FLAC__ASSERT(num_indices > 0);
+ FLAC__ASSERT(num_indices > 0);
- return (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index));
+ return (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index));
}
static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(unsigned num_tracks)
{
- FLAC__ASSERT(num_tracks > 0);
+ FLAC__ASSERT(num_tracks > 0);
- return (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
+ return (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
}
static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(0 != object_array && num_tracks > 0);
+ FLAC__ASSERT(0 != object_array && num_tracks > 0);
- for(i = 0; i < num_tracks; i++)
- {
- if(0 != object_array[i].indices)
- {
- FLAC__ASSERT(object_array[i].num_indices > 0);
- free(object_array[i].indices);
- }
- }
+ for(i = 0; i < num_tracks; i++) {
+ if(0 != object_array[i].indices) {
+ FLAC__ASSERT(object_array[i].num_indices > 0);
+ free(object_array[i].indices);
+ }
+ }
- if(0 != object_array)
- free(object_array);
+ if(0 != object_array)
+ free(object_array);
}
static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks)
{
- FLAC__StreamMetadata_CueSheet_Track *return_array;
+ FLAC__StreamMetadata_CueSheet_Track *return_array;
- FLAC__ASSERT(0 != object_array);
- FLAC__ASSERT(num_tracks > 0);
+ FLAC__ASSERT(0 != object_array);
+ FLAC__ASSERT(num_tracks > 0);
- return_array = cuesheet_track_array_new_(num_tracks);
+ return_array = cuesheet_track_array_new_(num_tracks);
- if(0 != return_array)
- {
- unsigned i;
+ if(0 != return_array) {
+ unsigned i;
- for(i = 0; i < num_tracks; i++)
- {
- if(!copy_track_(return_array + i, object_array + i))
- {
- cuesheet_track_array_delete_(return_array, num_tracks);
- return 0;
- }
- }
- }
+ for(i = 0; i < num_tracks; i++) {
+ if(!copy_track_(return_array+i, object_array+i)) {
+ cuesheet_track_array_delete_(return_array, num_tracks);
+ return 0;
+ }
+ }
+ }
- return return_array;
+ return return_array;
}
static FLAC__bool cuesheet_set_track_(FLAC__StreamMetadata *object, FLAC__StreamMetadata_CueSheet_Track *dest, const FLAC__StreamMetadata_CueSheet_Track *src, FLAC__bool copy)
{
- FLAC__StreamMetadata_CueSheet_Index *save;
+ FLAC__StreamMetadata_CueSheet_Index *save;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(0 != dest);
- FLAC__ASSERT(0 != src);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- FLAC__ASSERT((0 != src->indices && src->num_indices > 0) || (0 == src->indices && src->num_indices == 0));
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != dest);
+ FLAC__ASSERT(0 != src);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT((0 != src->indices && src->num_indices > 0) || (0 == src->indices && src->num_indices == 0));
- save = dest->indices;
+ save = dest->indices;
- /* do the copy first so that if we fail we leave the object untouched */
- if(copy)
- {
- if(!copy_track_(dest, src))
- return false;
- }
- else
- {
- *dest = *src;
- }
+ /* do the copy first so that if we fail we leave the object untouched */
+ if(copy) {
+ if(!copy_track_(dest, src))
+ return false;
+ }
+ else {
+ *dest = *src;
+ }
- if(0 != save)
- free(save);
+ if(0 != save)
+ free(save);
- cuesheet_calculate_length_(object);
- return true;
+ cuesheet_calculate_length_(object);
+ return true;
}
@@ -460,1481 +432,1393 @@ static FLAC__bool cuesheet_set_track_(FLAC__StreamMetadata *object, FLAC__Stream
FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type)
{
- FLAC__StreamMetadata *object;
-
- if(type > FLAC__MAX_METADATA_TYPE_CODE)
- return 0;
-
- object = (FLAC__StreamMetadata*)calloc(1, sizeof(FLAC__StreamMetadata));
- if(0 != object)
- {
- object->is_last = false;
- object->type = type;
- switch(type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- object->length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
- break;
- case FLAC__METADATA_TYPE_PADDING:
- /* calloc() took care of this for us:
- object->length = 0;
- */
- break;
- case FLAC__METADATA_TYPE_APPLICATION:
- object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
- /* calloc() took care of this for us:
- object->data.application.data = 0;
- */
- break;
- case FLAC__METADATA_TYPE_SEEKTABLE:
- /* calloc() took care of this for us:
- object->length = 0;
- object->data.seek_table.num_points = 0;
- object->data.seek_table.points = 0;
- */
- break;
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- object->data.vorbis_comment.vendor_string.length = (unsigned)strlen(FLAC__VENDOR_STRING);
- if(!copy_bytes_(&object->data.vorbis_comment.vendor_string.entry, (const FLAC__byte*)FLAC__VENDOR_STRING, object->data.vorbis_comment.vendor_string.length + 1))
- {
- free(object);
- return 0;
- }
- vorbiscomment_calculate_length_(object);
- break;
- case FLAC__METADATA_TYPE_CUESHEET:
- cuesheet_calculate_length_(object);
- break;
- case FLAC__METADATA_TYPE_PICTURE:
- object->length = (
- FLAC__STREAM_METADATA_PICTURE_TYPE_LEN +
- FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* empty mime_type string */
- FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* empty description string */
- FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN +
- FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN +
- FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN +
- FLAC__STREAM_METADATA_PICTURE_COLORS_LEN +
- FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN +
- 0 /* no data */
- ) / 8;
- object->data.picture.type = FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER;
- object->data.picture.mime_type = 0;
- object->data.picture.description = 0;
- /* calloc() took care of this for us:
- object->data.picture.width = 0;
- object->data.picture.height = 0;
- object->data.picture.depth = 0;
- object->data.picture.colors = 0;
- object->data.picture.data_length = 0;
- object->data.picture.data = 0;
- */
- /* now initialize mime_type and description with empty strings to make things easier on the client */
- if(!copy_cstring_(&object->data.picture.mime_type, ""))
- {
- free(object);
- return 0;
- }
- if(!copy_cstring_((char**)(&object->data.picture.description), ""))
- {
- if(object->data.picture.mime_type)
- free(object->data.picture.mime_type);
- free(object);
- return 0;
- }
- break;
- default:
- /* calloc() took care of this for us:
- object->length = 0;
- object->data.unknown.data = 0;
- */
- break;
- }
- }
-
- return object;
+ FLAC__StreamMetadata *object;
+
+ if(type > FLAC__MAX_METADATA_TYPE_CODE)
+ return 0;
+
+ object = (FLAC__StreamMetadata*)calloc(1, sizeof(FLAC__StreamMetadata));
+ if(0 != object) {
+ object->is_last = false;
+ object->type = type;
+ switch(type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ object->length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
+ break;
+ case FLAC__METADATA_TYPE_PADDING:
+ /* calloc() took care of this for us:
+ object->length = 0;
+ */
+ break;
+ case FLAC__METADATA_TYPE_APPLICATION:
+ object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+ /* calloc() took care of this for us:
+ object->data.application.data = 0;
+ */
+ break;
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ /* calloc() took care of this for us:
+ object->length = 0;
+ object->data.seek_table.num_points = 0;
+ object->data.seek_table.points = 0;
+ */
+ break;
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ object->data.vorbis_comment.vendor_string.length = (unsigned)strlen(FLAC__VENDOR_STRING);
+ if(!copy_bytes_(&object->data.vorbis_comment.vendor_string.entry, (const FLAC__byte*)FLAC__VENDOR_STRING, object->data.vorbis_comment.vendor_string.length+1)) {
+ free(object);
+ return 0;
+ }
+ vorbiscomment_calculate_length_(object);
+ break;
+ case FLAC__METADATA_TYPE_CUESHEET:
+ cuesheet_calculate_length_(object);
+ break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ object->length = (
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LEN +
+ FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* empty mime_type string */
+ FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* empty description string */
+ FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN +
+ FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN +
+ FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN +
+ FLAC__STREAM_METADATA_PICTURE_COLORS_LEN +
+ FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN +
+ 0 /* no data */
+ ) / 8;
+ object->data.picture.type = FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER;
+ object->data.picture.mime_type = 0;
+ object->data.picture.description = 0;
+ /* calloc() took care of this for us:
+ object->data.picture.width = 0;
+ object->data.picture.height = 0;
+ object->data.picture.depth = 0;
+ object->data.picture.colors = 0;
+ object->data.picture.data_length = 0;
+ object->data.picture.data = 0;
+ */
+ /* now initialize mime_type and description with empty strings to make things easier on the client */
+ if(!copy_cstring_(&object->data.picture.mime_type, "")) {
+ free(object);
+ return 0;
+ }
+ if(!copy_cstring_((char**)(&object->data.picture.description), "")) {
+ if(object->data.picture.mime_type)
+ free(object->data.picture.mime_type);
+ free(object);
+ return 0;
+ }
+ break;
+ default:
+ /* calloc() took care of this for us:
+ object->length = 0;
+ object->data.unknown.data = 0;
+ */
+ break;
+ }
+ }
+
+ return object;
}
FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object)
{
- FLAC__StreamMetadata *to;
-
- FLAC__ASSERT(0 != object);
-
- if(0 != (to = FLAC__metadata_object_new(object->type)))
- {
- to->is_last = object->is_last;
- to->type = object->type;
- to->length = object->length;
- switch(to->type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- memcpy(&to->data.stream_info, &object->data.stream_info, sizeof(FLAC__StreamMetadata_StreamInfo));
- break;
- case FLAC__METADATA_TYPE_PADDING:
- break;
- case FLAC__METADATA_TYPE_APPLICATION:
- if(to->length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) /* underflow check */
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- memcpy(&to->data.application.id, &object->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8);
- if(!copy_bytes_(&to->data.application.data, object->data.application.data, object->length - FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- break;
- case FLAC__METADATA_TYPE_SEEKTABLE:
- to->data.seek_table.num_points = object->data.seek_table.num_points;
- if(to->data.seek_table.num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) /* overflow check */
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- break;
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- if(0 != to->data.vorbis_comment.vendor_string.entry)
- {
- free(to->data.vorbis_comment.vendor_string.entry);
- to->data.vorbis_comment.vendor_string.entry = 0;
- }
- if(!copy_vcentry_(&to->data.vorbis_comment.vendor_string, &object->data.vorbis_comment.vendor_string))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- if(object->data.vorbis_comment.num_comments == 0)
- {
- FLAC__ASSERT(0 == object->data.vorbis_comment.comments);
- to->data.vorbis_comment.comments = 0;
- }
- else
- {
- FLAC__ASSERT(0 != object->data.vorbis_comment.comments);
- to->data.vorbis_comment.comments = vorbiscomment_entry_array_copy_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments);
- if(0 == to->data.vorbis_comment.comments)
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- }
- to->data.vorbis_comment.num_comments = object->data.vorbis_comment.num_comments;
- break;
- case FLAC__METADATA_TYPE_CUESHEET:
- memcpy(&to->data.cue_sheet, &object->data.cue_sheet, sizeof(FLAC__StreamMetadata_CueSheet));
- if(object->data.cue_sheet.num_tracks == 0)
- {
- FLAC__ASSERT(0 == object->data.cue_sheet.tracks);
- }
- else
- {
- FLAC__ASSERT(0 != object->data.cue_sheet.tracks);
- to->data.cue_sheet.tracks = cuesheet_track_array_copy_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks);
- if(0 == to->data.cue_sheet.tracks)
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- }
- break;
- case FLAC__METADATA_TYPE_PICTURE:
- to->data.picture.type = object->data.picture.type;
- if(!copy_cstring_(&to->data.picture.mime_type, object->data.picture.mime_type))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- if(!copy_cstring_((char**)(&to->data.picture.description), (const char*)object->data.picture.description))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- to->data.picture.width = object->data.picture.width;
- to->data.picture.height = object->data.picture.height;
- to->data.picture.depth = object->data.picture.depth;
- to->data.picture.colors = object->data.picture.colors;
- to->data.picture.data_length = object->data.picture.data_length;
- if(!copy_bytes_((&to->data.picture.data), object->data.picture.data, object->data.picture.data_length))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- break;
- default:
- if(!copy_bytes_(&to->data.unknown.data, object->data.unknown.data, object->length))
- {
- FLAC__metadata_object_delete(to);
- return 0;
- }
- break;
- }
- }
-
- return to;
+ FLAC__StreamMetadata *to;
+
+ FLAC__ASSERT(0 != object);
+
+ if(0 != (to = FLAC__metadata_object_new(object->type))) {
+ to->is_last = object->is_last;
+ to->type = object->type;
+ to->length = object->length;
+ switch(to->type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ memcpy(&to->data.stream_info, &object->data.stream_info, sizeof(FLAC__StreamMetadata_StreamInfo));
+ break;
+ case FLAC__METADATA_TYPE_PADDING:
+ break;
+ case FLAC__METADATA_TYPE_APPLICATION:
+ if(to->length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) { /* underflow check */
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ memcpy(&to->data.application.id, &object->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8);
+ if(!copy_bytes_(&to->data.application.data, object->data.application.data, object->length - FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ break;
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ to->data.seek_table.num_points = object->data.seek_table.num_points;
+ if(to->data.seek_table.num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) { /* overflow check */
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint))) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ break;
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ if(0 != to->data.vorbis_comment.vendor_string.entry) {
+ free(to->data.vorbis_comment.vendor_string.entry);
+ to->data.vorbis_comment.vendor_string.entry = 0;
+ }
+ if(!copy_vcentry_(&to->data.vorbis_comment.vendor_string, &object->data.vorbis_comment.vendor_string)) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ if(object->data.vorbis_comment.num_comments == 0) {
+ FLAC__ASSERT(0 == object->data.vorbis_comment.comments);
+ to->data.vorbis_comment.comments = 0;
+ }
+ else {
+ FLAC__ASSERT(0 != object->data.vorbis_comment.comments);
+ to->data.vorbis_comment.comments = vorbiscomment_entry_array_copy_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments);
+ if(0 == to->data.vorbis_comment.comments) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ }
+ to->data.vorbis_comment.num_comments = object->data.vorbis_comment.num_comments;
+ break;
+ case FLAC__METADATA_TYPE_CUESHEET:
+ memcpy(&to->data.cue_sheet, &object->data.cue_sheet, sizeof(FLAC__StreamMetadata_CueSheet));
+ if(object->data.cue_sheet.num_tracks == 0) {
+ FLAC__ASSERT(0 == object->data.cue_sheet.tracks);
+ }
+ else {
+ FLAC__ASSERT(0 != object->data.cue_sheet.tracks);
+ to->data.cue_sheet.tracks = cuesheet_track_array_copy_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks);
+ if(0 == to->data.cue_sheet.tracks) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ }
+ break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ to->data.picture.type = object->data.picture.type;
+ if(!copy_cstring_(&to->data.picture.mime_type, object->data.picture.mime_type)) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ if(!copy_cstring_((char**)(&to->data.picture.description), (const char*)object->data.picture.description)) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ to->data.picture.width = object->data.picture.width;
+ to->data.picture.height = object->data.picture.height;
+ to->data.picture.depth = object->data.picture.depth;
+ to->data.picture.colors = object->data.picture.colors;
+ to->data.picture.data_length = object->data.picture.data_length;
+ if(!copy_bytes_((&to->data.picture.data), object->data.picture.data, object->data.picture.data_length)) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ break;
+ default:
+ if(!copy_bytes_(&to->data.unknown.data, object->data.unknown.data, object->length)) {
+ FLAC__metadata_object_delete(to);
+ return 0;
+ }
+ break;
+ }
+ }
+
+ return to;
}
void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object)
{
- FLAC__ASSERT(0 != object);
-
- switch(object->type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- case FLAC__METADATA_TYPE_PADDING:
- break;
- case FLAC__METADATA_TYPE_APPLICATION:
- if(0 != object->data.application.data)
- {
- free(object->data.application.data);
- object->data.application.data = 0;
- }
- break;
- case FLAC__METADATA_TYPE_SEEKTABLE:
- if(0 != object->data.seek_table.points)
- {
- free(object->data.seek_table.points);
- object->data.seek_table.points = 0;
- }
- break;
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- if(0 != object->data.vorbis_comment.vendor_string.entry)
- {
- free(object->data.vorbis_comment.vendor_string.entry);
- object->data.vorbis_comment.vendor_string.entry = 0;
- }
- if(0 != object->data.vorbis_comment.comments)
- {
- FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0);
- vorbiscomment_entry_array_delete_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments);
- }
- break;
- case FLAC__METADATA_TYPE_CUESHEET:
- if(0 != object->data.cue_sheet.tracks)
- {
- FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0);
- cuesheet_track_array_delete_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks);
- }
- break;
- case FLAC__METADATA_TYPE_PICTURE:
- if(0 != object->data.picture.mime_type)
- {
- free(object->data.picture.mime_type);
- object->data.picture.mime_type = 0;
- }
- if(0 != object->data.picture.description)
- {
- free(object->data.picture.description);
- object->data.picture.description = 0;
- }
- if(0 != object->data.picture.data)
- {
- free(object->data.picture.data);
- object->data.picture.data = 0;
- }
- break;
- default:
- if(0 != object->data.unknown.data)
- {
- free(object->data.unknown.data);
- object->data.unknown.data = 0;
- }
- break;
- }
+ FLAC__ASSERT(0 != object);
+
+ switch(object->type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ case FLAC__METADATA_TYPE_PADDING:
+ break;
+ case FLAC__METADATA_TYPE_APPLICATION:
+ if(0 != object->data.application.data) {
+ free(object->data.application.data);
+ object->data.application.data = 0;
+ }
+ break;
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ if(0 != object->data.seek_table.points) {
+ free(object->data.seek_table.points);
+ object->data.seek_table.points = 0;
+ }
+ break;
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ if(0 != object->data.vorbis_comment.vendor_string.entry) {
+ free(object->data.vorbis_comment.vendor_string.entry);
+ object->data.vorbis_comment.vendor_string.entry = 0;
+ }
+ if(0 != object->data.vorbis_comment.comments) {
+ FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0);
+ vorbiscomment_entry_array_delete_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments);
+ }
+ break;
+ case FLAC__METADATA_TYPE_CUESHEET:
+ if(0 != object->data.cue_sheet.tracks) {
+ FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0);
+ cuesheet_track_array_delete_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks);
+ }
+ break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ if(0 != object->data.picture.mime_type) {
+ free(object->data.picture.mime_type);
+ object->data.picture.mime_type = 0;
+ }
+ if(0 != object->data.picture.description) {
+ free(object->data.picture.description);
+ object->data.picture.description = 0;
+ }
+ if(0 != object->data.picture.data) {
+ free(object->data.picture.data);
+ object->data.picture.data = 0;
+ }
+ break;
+ default:
+ if(0 != object->data.unknown.data) {
+ free(object->data.unknown.data);
+ object->data.unknown.data = 0;
+ }
+ break;
+ }
}
FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object)
{
- FLAC__metadata_object_delete_data(object);
- free(object);
+ FLAC__metadata_object_delete_data(object);
+ free(object);
}
static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo *block1, const FLAC__StreamMetadata_StreamInfo *block2)
{
- if(block1->min_blocksize != block2->min_blocksize)
- return false;
- if(block1->max_blocksize != block2->max_blocksize)
- return false;
- if(block1->min_framesize != block2->min_framesize)
- return false;
- if(block1->max_framesize != block2->max_framesize)
- return false;
- if(block1->sample_rate != block2->sample_rate)
- return false;
- if(block1->channels != block2->channels)
- return false;
- if(block1->bits_per_sample != block2->bits_per_sample)
- return false;
- if(block1->total_samples != block2->total_samples)
- return false;
- if(0 != memcmp(block1->md5sum, block2->md5sum, 16))
- return false;
- return true;
+ if(block1->min_blocksize != block2->min_blocksize)
+ return false;
+ if(block1->max_blocksize != block2->max_blocksize)
+ return false;
+ if(block1->min_framesize != block2->min_framesize)
+ return false;
+ if(block1->max_framesize != block2->max_framesize)
+ return false;
+ if(block1->sample_rate != block2->sample_rate)
+ return false;
+ if(block1->channels != block2->channels)
+ return false;
+ if(block1->bits_per_sample != block2->bits_per_sample)
+ return false;
+ if(block1->total_samples != block2->total_samples)
+ return false;
+ if(0 != memcmp(block1->md5sum, block2->md5sum, 16))
+ return false;
+ return true;
}
static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, unsigned block_length)
{
- FLAC__ASSERT(0 != block1);
- FLAC__ASSERT(0 != block2);
- FLAC__ASSERT(block_length >= sizeof(block1->id));
+ FLAC__ASSERT(0 != block1);
+ FLAC__ASSERT(0 != block2);
+ FLAC__ASSERT(block_length >= sizeof(block1->id));
- if(0 != memcmp(block1->id, block2->id, sizeof(block1->id)))
- return false;
- if(0 != block1->data && 0 != block2->data)
- return 0 == memcmp(block1->data, block2->data, block_length - sizeof(block1->id));
- else
- return block1->data == block2->data;
+ if(0 != memcmp(block1->id, block2->id, sizeof(block1->id)))
+ return false;
+ if(0 != block1->data && 0 != block2->data)
+ return 0 == memcmp(block1->data, block2->data, block_length - sizeof(block1->id));
+ else
+ return block1->data == block2->data;
}
static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block1, const FLAC__StreamMetadata_SeekTable *block2)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(0 != block1);
- FLAC__ASSERT(0 != block2);
+ FLAC__ASSERT(0 != block1);
+ FLAC__ASSERT(0 != block2);
- if(block1->num_points != block2->num_points)
- return false;
+ if(block1->num_points != block2->num_points)
+ return false;
- if(0 != block1->points && 0 != block2->points)
- {
- for(i = 0; i < block1->num_points; i++)
- {
- if(block1->points[i].sample_number != block2->points[i].sample_number)
- return false;
- if(block1->points[i].stream_offset != block2->points[i].stream_offset)
- return false;
- if(block1->points[i].frame_samples != block2->points[i].frame_samples)
- return false;
- }
- return true;
- }
- else
- return block1->points == block2->points;
+ if(0 != block1->points && 0 != block2->points) {
+ for(i = 0; i < block1->num_points; i++) {
+ if(block1->points[i].sample_number != block2->points[i].sample_number)
+ return false;
+ if(block1->points[i].stream_offset != block2->points[i].stream_offset)
+ return false;
+ if(block1->points[i].frame_samples != block2->points[i].frame_samples)
+ return false;
+ }
+ return true;
+ }
+ else
+ return block1->points == block2->points;
}
static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block1, const FLAC__StreamMetadata_VorbisComment *block2)
{
- unsigned i;
+ unsigned i;
- if(block1->vendor_string.length != block2->vendor_string.length)
- return false;
+ if(block1->vendor_string.length != block2->vendor_string.length)
+ return false;
- if(0 != block1->vendor_string.entry && 0 != block2->vendor_string.entry)
- {
- if(0 != memcmp(block1->vendor_string.entry, block2->vendor_string.entry, block1->vendor_string.length))
- return false;
- }
- else if(block1->vendor_string.entry != block2->vendor_string.entry)
- return false;
+ if(0 != block1->vendor_string.entry && 0 != block2->vendor_string.entry) {
+ if(0 != memcmp(block1->vendor_string.entry, block2->vendor_string.entry, block1->vendor_string.length))
+ return false;
+ }
+ else if(block1->vendor_string.entry != block2->vendor_string.entry)
+ return false;
- if(block1->num_comments != block2->num_comments)
- return false;
+ if(block1->num_comments != block2->num_comments)
+ return false;
- for(i = 0; i < block1->num_comments; i++)
- {
- if(0 != block1->comments[i].entry && 0 != block2->comments[i].entry)
- {
- if(0 != memcmp(block1->comments[i].entry, block2->comments[i].entry, block1->comments[i].length))
- return false;
- }
- else if(block1->comments[i].entry != block2->comments[i].entry)
- return false;
- }
- return true;
+ for(i = 0; i < block1->num_comments; i++) {
+ if(0 != block1->comments[i].entry && 0 != block2->comments[i].entry) {
+ if(0 != memcmp(block1->comments[i].entry, block2->comments[i].entry, block1->comments[i].length))
+ return false;
+ }
+ else if(block1->comments[i].entry != block2->comments[i].entry)
+ return false;
+ }
+ return true;
}
static FLAC__bool compare_block_data_cuesheet_(const FLAC__StreamMetadata_CueSheet *block1, const FLAC__StreamMetadata_CueSheet *block2)
{
- unsigned i, j;
-
- if(0 != strcmp(block1->media_catalog_number, block2->media_catalog_number))
- return false;
-
- if(block1->lead_in != block2->lead_in)
- return false;
-
- if(block1->is_cd != block2->is_cd)
- return false;
-
- if(block1->num_tracks != block2->num_tracks)
- return false;
-
- if(0 != block1->tracks && 0 != block2->tracks)
- {
- FLAC__ASSERT(block1->num_tracks > 0);
- for(i = 0; i < block1->num_tracks; i++)
- {
- if(block1->tracks[i].offset != block2->tracks[i].offset)
- return false;
- if(block1->tracks[i].number != block2->tracks[i].number)
- return false;
- if(0 != memcmp(block1->tracks[i].isrc, block2->tracks[i].isrc, sizeof(block1->tracks[i].isrc)))
- return false;
- if(block1->tracks[i].type != block2->tracks[i].type)
- return false;
- if(block1->tracks[i].pre_emphasis != block2->tracks[i].pre_emphasis)
- return false;
- if(block1->tracks[i].num_indices != block2->tracks[i].num_indices)
- return false;
- if(0 != block1->tracks[i].indices && 0 != block2->tracks[i].indices)
- {
- FLAC__ASSERT(block1->tracks[i].num_indices > 0);
- for(j = 0; j < block1->tracks[i].num_indices; j++)
- {
- if(block1->tracks[i].indices[j].offset != block2->tracks[i].indices[j].offset)
- return false;
- if(block1->tracks[i].indices[j].number != block2->tracks[i].indices[j].number)
- return false;
- }
- }
- else if(block1->tracks[i].indices != block2->tracks[i].indices)
- return false;
- }
- }
- else if(block1->tracks != block2->tracks)
- return false;
- return true;
+ unsigned i, j;
+
+ if(0 != strcmp(block1->media_catalog_number, block2->media_catalog_number))
+ return false;
+
+ if(block1->lead_in != block2->lead_in)
+ return false;
+
+ if(block1->is_cd != block2->is_cd)
+ return false;
+
+ if(block1->num_tracks != block2->num_tracks)
+ return false;
+
+ if(0 != block1->tracks && 0 != block2->tracks) {
+ FLAC__ASSERT(block1->num_tracks > 0);
+ for(i = 0; i < block1->num_tracks; i++) {
+ if(block1->tracks[i].offset != block2->tracks[i].offset)
+ return false;
+ if(block1->tracks[i].number != block2->tracks[i].number)
+ return false;
+ if(0 != memcmp(block1->tracks[i].isrc, block2->tracks[i].isrc, sizeof(block1->tracks[i].isrc)))
+ return false;
+ if(block1->tracks[i].type != block2->tracks[i].type)
+ return false;
+ if(block1->tracks[i].pre_emphasis != block2->tracks[i].pre_emphasis)
+ return false;
+ if(block1->tracks[i].num_indices != block2->tracks[i].num_indices)
+ return false;
+ if(0 != block1->tracks[i].indices && 0 != block2->tracks[i].indices) {
+ FLAC__ASSERT(block1->tracks[i].num_indices > 0);
+ for(j = 0; j < block1->tracks[i].num_indices; j++) {
+ if(block1->tracks[i].indices[j].offset != block2->tracks[i].indices[j].offset)
+ return false;
+ if(block1->tracks[i].indices[j].number != block2->tracks[i].indices[j].number)
+ return false;
+ }
+ }
+ else if(block1->tracks[i].indices != block2->tracks[i].indices)
+ return false;
+ }
+ }
+ else if(block1->tracks != block2->tracks)
+ return false;
+ return true;
}
static FLAC__bool compare_block_data_picture_(const FLAC__StreamMetadata_Picture *block1, const FLAC__StreamMetadata_Picture *block2)
{
- if(block1->type != block2->type)
- return false;
- if(block1->mime_type != block2->mime_type && (0 == block1->mime_type || 0 == block2->mime_type || strcmp(block1->mime_type, block2->mime_type)))
- return false;
- if(block1->description != block2->description && (0 == block1->description || 0 == block2->description || strcmp((const char *)block1->description, (const char *)block2->description)))
- return false;
- if(block1->width != block2->width)
- return false;
- if(block1->height != block2->height)
- return false;
- if(block1->depth != block2->depth)
- return false;
- if(block1->colors != block2->colors)
- return false;
- if(block1->data_length != block2->data_length)
- return false;
- if(block1->data != block2->data && (0 == block1->data || 0 == block2->data || memcmp(block1->data, block2->data, block1->data_length)))
- return false;
- return true;
+ if(block1->type != block2->type)
+ return false;
+ if(block1->mime_type != block2->mime_type && (0 == block1->mime_type || 0 == block2->mime_type || strcmp(block1->mime_type, block2->mime_type)))
+ return false;
+ if(block1->description != block2->description && (0 == block1->description || 0 == block2->description || strcmp((const char *)block1->description, (const char *)block2->description)))
+ return false;
+ if(block1->width != block2->width)
+ return false;
+ if(block1->height != block2->height)
+ return false;
+ if(block1->depth != block2->depth)
+ return false;
+ if(block1->colors != block2->colors)
+ return false;
+ if(block1->data_length != block2->data_length)
+ return false;
+ if(block1->data != block2->data && (0 == block1->data || 0 == block2->data || memcmp(block1->data, block2->data, block1->data_length)))
+ return false;
+ return true;
}
static FLAC__bool compare_block_data_unknown_(const FLAC__StreamMetadata_Unknown *block1, const FLAC__StreamMetadata_Unknown *block2, unsigned block_length)
{
- FLAC__ASSERT(0 != block1);
- FLAC__ASSERT(0 != block2);
+ FLAC__ASSERT(0 != block1);
+ FLAC__ASSERT(0 != block2);
- if(0 != block1->data && 0 != block2->data)
- return 0 == memcmp(block1->data, block2->data, block_length);
- else
- return block1->data == block2->data;
+ if(0 != block1->data && 0 != block2->data)
+ return 0 == memcmp(block1->data, block2->data, block_length);
+ else
+ return block1->data == block2->data;
}
FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2)
{
- FLAC__ASSERT(0 != block1);
- FLAC__ASSERT(0 != block2);
-
- if(block1->type != block2->type)
- {
- return false;
- }
- if(block1->is_last != block2->is_last)
- {
- return false;
- }
- if(block1->length != block2->length)
- {
- return false;
- }
- switch(block1->type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- return compare_block_data_streaminfo_(&block1->data.stream_info, &block2->data.stream_info);
- case FLAC__METADATA_TYPE_PADDING:
- return true; /* we don't compare the padding guts */
- case FLAC__METADATA_TYPE_APPLICATION:
- return compare_block_data_application_(&block1->data.application, &block2->data.application, block1->length);
- case FLAC__METADATA_TYPE_SEEKTABLE:
- return compare_block_data_seektable_(&block1->data.seek_table, &block2->data.seek_table);
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- return compare_block_data_vorbiscomment_(&block1->data.vorbis_comment, &block2->data.vorbis_comment);
- case FLAC__METADATA_TYPE_CUESHEET:
- return compare_block_data_cuesheet_(&block1->data.cue_sheet, &block2->data.cue_sheet);
- case FLAC__METADATA_TYPE_PICTURE:
- return compare_block_data_picture_(&block1->data.picture, &block2->data.picture);
- default:
- return compare_block_data_unknown_(&block1->data.unknown, &block2->data.unknown, block1->length);
- }
+ FLAC__ASSERT(0 != block1);
+ FLAC__ASSERT(0 != block2);
+
+ if(block1->type != block2->type) {
+ return false;
+ }
+ if(block1->is_last != block2->is_last) {
+ return false;
+ }
+ if(block1->length != block2->length) {
+ return false;
+ }
+ switch(block1->type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ return compare_block_data_streaminfo_(&block1->data.stream_info, &block2->data.stream_info);
+ case FLAC__METADATA_TYPE_PADDING:
+ return true; /* we don't compare the padding guts */
+ case FLAC__METADATA_TYPE_APPLICATION:
+ return compare_block_data_application_(&block1->data.application, &block2->data.application, block1->length);
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ return compare_block_data_seektable_(&block1->data.seek_table, &block2->data.seek_table);
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ return compare_block_data_vorbiscomment_(&block1->data.vorbis_comment, &block2->data.vorbis_comment);
+ case FLAC__METADATA_TYPE_CUESHEET:
+ return compare_block_data_cuesheet_(&block1->data.cue_sheet, &block2->data.cue_sheet);
+ case FLAC__METADATA_TYPE_PICTURE:
+ return compare_block_data_picture_(&block1->data.picture, &block2->data.picture);
+ default:
+ return compare_block_data_unknown_(&block1->data.unknown, &block2->data.unknown, block1->length);
+ }
}
FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy)
{
- FLAC__byte *save;
+ FLAC__byte *save;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION);
- FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false));
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION);
+ FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false));
- save = object->data.application.data;
+ save = object->data.application.data;
- /* do the copy first so that if we fail we leave the object untouched */
- if(copy)
- {
- if(!copy_bytes_(&object->data.application.data, data, length))
- return false;
- }
- else
- {
- object->data.application.data = data;
- }
+ /* do the copy first so that if we fail we leave the object untouched */
+ if(copy) {
+ if(!copy_bytes_(&object->data.application.data, data, length))
+ return false;
+ }
+ else {
+ object->data.application.data = data;
+ }
- if(0 != save)
- free(save);
+ if(0 != save)
+ free(save);
- object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8 + length;
- return true;
+ object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8 + length;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
-
- if(0 == object->data.seek_table.points)
- {
- FLAC__ASSERT(object->data.seek_table.num_points == 0);
- if(0 == new_num_points)
- return true;
- else if(0 == (object->data.seek_table.points = seekpoint_array_new_(new_num_points)))
- return false;
- }
- else
- {
- const size_t old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint);
- const size_t new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint);
-
- /* overflow check */
- if((size_t)new_num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint))
- return false;
-
- FLAC__ASSERT(object->data.seek_table.num_points > 0);
-
- if(new_size == 0)
- {
- free(object->data.seek_table.points);
- object->data.seek_table.points = 0;
- }
- else if(0 == (object->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(object->data.seek_table.points, new_size)))
- return false;
-
- /* if growing, set new elements to placeholders */
- if(new_size > old_size)
- {
- unsigned i;
- for(i = object->data.seek_table.num_points; i < new_num_points; i++)
- {
- object->data.seek_table.points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
- object->data.seek_table.points[i].stream_offset = 0;
- object->data.seek_table.points[i].frame_samples = 0;
- }
- }
- }
-
- object->data.seek_table.num_points = new_num_points;
-
- seektable_calculate_length_(object);
- return true;
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+
+ if(0 == object->data.seek_table.points) {
+ FLAC__ASSERT(object->data.seek_table.num_points == 0);
+ if(0 == new_num_points)
+ return true;
+ else if(0 == (object->data.seek_table.points = seekpoint_array_new_(new_num_points)))
+ return false;
+ }
+ else {
+ const size_t old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint);
+ const size_t new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint);
+
+ /* overflow check */
+ if((size_t)new_num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint))
+ return false;
+
+ FLAC__ASSERT(object->data.seek_table.num_points > 0);
+
+ if(new_size == 0) {
+ free(object->data.seek_table.points);
+ object->data.seek_table.points = 0;
+ }
+ else if(0 == (object->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(object->data.seek_table.points, new_size)))
+ return false;
+
+ /* if growing, set new elements to placeholders */
+ if(new_size > old_size) {
+ unsigned i;
+ for(i = object->data.seek_table.num_points; i < new_num_points; i++) {
+ object->data.seek_table.points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
+ object->data.seek_table.points[i].stream_offset = 0;
+ object->data.seek_table.points[i].frame_samples = 0;
+ }
+ }
+ }
+
+ object->data.seek_table.num_points = new_num_points;
+
+ seektable_calculate_length_(object);
+ return true;
}
FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- FLAC__ASSERT(point_num < object->data.seek_table.num_points);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(point_num < object->data.seek_table.num_points);
- object->data.seek_table.points[point_num] = point;
+ object->data.seek_table.points[point_num] = point;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point)
{
- int i;
+ int i;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- FLAC__ASSERT(point_num <= object->data.seek_table.num_points);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(point_num <= object->data.seek_table.num_points);
- if(!FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points + 1))
- return false;
+ if(!FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points+1))
+ return false;
- /* move all points >= point_num forward one space */
- for(i = (int)object->data.seek_table.num_points - 1; i > (int)point_num; i--)
- object->data.seek_table.points[i] = object->data.seek_table.points[i-1];
+ /* move all points >= point_num forward one space */
+ for(i = (int)object->data.seek_table.num_points-1; i > (int)point_num; i--)
+ object->data.seek_table.points[i] = object->data.seek_table.points[i-1];
- FLAC__metadata_object_seektable_set_point(object, point_num, point);
- seektable_calculate_length_(object);
- return true;
+ FLAC__metadata_object_seektable_set_point(object, point_num, point);
+ seektable_calculate_length_(object);
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- FLAC__ASSERT(point_num < object->data.seek_table.num_points);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(point_num < object->data.seek_table.num_points);
- /* move all points > point_num backward one space */
- for(i = point_num; i < object->data.seek_table.num_points - 1; i++)
- object->data.seek_table.points[i] = object->data.seek_table.points[i+1];
+ /* move all points > point_num backward one space */
+ for(i = point_num; i < object->data.seek_table.num_points-1; i++)
+ object->data.seek_table.points[i] = object->data.seek_table.points[i+1];
- return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points - 1);
+ return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points-1);
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- return FLAC__format_seektable_is_legal(&object->data.seek_table);
+ return FLAC__format_seektable_is_legal(&object->data.seek_table);
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- if(num > 0)
- /* WATCHOUT: we rely on the fact that growing the array adds PLACEHOLDERS at the end */
- return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points + num);
- else
- return true;
+ if(num > 0)
+ /* WATCHOUT: we rely on the fact that growing the array adds PLACEHOLDERS at the end */
+ return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points + num);
+ else
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__StreamMetadata *object, FLAC__uint64 sample_number)
{
- FLAC__StreamMetadata_SeekTable *seek_table;
+ FLAC__StreamMetadata_SeekTable *seek_table;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- seek_table = &object->data.seek_table;
+ seek_table = &object->data.seek_table;
- if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + 1))
- return false;
+ if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + 1))
+ return false;
- seek_table->points[seek_table->num_points - 1].sample_number = sample_number;
- seek_table->points[seek_table->num_points - 1].stream_offset = 0;
- seek_table->points[seek_table->num_points - 1].frame_samples = 0;
+ seek_table->points[seek_table->num_points - 1].sample_number = sample_number;
+ seek_table->points[seek_table->num_points - 1].stream_offset = 0;
+ seek_table->points[seek_table->num_points - 1].frame_samples = 0;
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- FLAC__ASSERT(0 != sample_numbers || num == 0);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(0 != sample_numbers || num == 0);
- if(num > 0)
- {
- FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
- unsigned i, j;
+ if(num > 0) {
+ FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
+ unsigned i, j;
- i = seek_table->num_points;
+ i = seek_table->num_points;
- if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num))
- return false;
+ if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num))
+ return false;
- for(j = 0; j < num; i++, j++)
- {
- seek_table->points[i].sample_number = sample_numbers[j];
- seek_table->points[i].stream_offset = 0;
- seek_table->points[i].frame_samples = 0;
- }
- }
+ for(j = 0; j < num; i++, j++) {
+ seek_table->points[i].sample_number = sample_numbers[j];
+ seek_table->points[i].stream_offset = 0;
+ seek_table->points[i].frame_samples = 0;
+ }
+ }
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- FLAC__ASSERT(total_samples > 0);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(total_samples > 0);
- if(num > 0 && total_samples > 0)
- {
- FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
- unsigned i, j;
+ if(num > 0 && total_samples > 0) {
+ FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
+ unsigned i, j;
- i = seek_table->num_points;
+ i = seek_table->num_points;
- if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num))
- return false;
+ if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num))
+ return false;
- for(j = 0; j < num; i++, j++)
- {
- seek_table->points[i].sample_number = total_samples * (FLAC__uint64)j / (FLAC__uint64)num;
- seek_table->points[i].stream_offset = 0;
- seek_table->points[i].frame_samples = 0;
- }
- }
+ for(j = 0; j < num; i++, j++) {
+ seek_table->points[i].sample_number = total_samples * (FLAC__uint64)j / (FLAC__uint64)num;
+ seek_table->points[i].stream_offset = 0;
+ seek_table->points[i].frame_samples = 0;
+ }
+ }
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- FLAC__ASSERT(samples > 0);
- FLAC__ASSERT(total_samples > 0);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(samples > 0);
+ FLAC__ASSERT(total_samples > 0);
- if(samples > 0 && total_samples > 0)
- {
- FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
- unsigned i, j;
- FLAC__uint64 num, sample;
+ if(samples > 0 && total_samples > 0) {
+ FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
+ unsigned i, j;
+ FLAC__uint64 num, sample;
- num = 1 + total_samples / samples; /* 1+ for the first sample at 0 */
- /* now account for the fact that we don't place a seekpoint at "total_samples" since samples are number from 0: */
- if(total_samples % samples == 0)
- num--;
+ num = 1 + total_samples / samples; /* 1+ for the first sample at 0 */
+ /* now account for the fact that we don't place a seekpoint at "total_samples" since samples are number from 0: */
+ if(total_samples % samples == 0)
+ num--;
- i = seek_table->num_points;
+ i = seek_table->num_points;
- if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (unsigned)num))
- return false;
+ if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (unsigned)num))
+ return false;
- sample = 0;
- for(j = 0; j < num; i++, j++, sample += samples)
- {
- seek_table->points[i].sample_number = sample;
- seek_table->points[i].stream_offset = 0;
- seek_table->points[i].frame_samples = 0;
- }
- }
+ sample = 0;
+ for(j = 0; j < num; i++, j++, sample += samples) {
+ seek_table->points[i].sample_number = sample;
+ seek_table->points[i].stream_offset = 0;
+ seek_table->points[i].frame_samples = 0;
+ }
+ }
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact)
{
- unsigned unique;
+ unsigned unique;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
- unique = FLAC__format_seektable_sort(&object->data.seek_table);
+ unique = FLAC__format_seektable_sort(&object->data.seek_table);
- return !compact || FLAC__metadata_object_seektable_resize_points(object, unique);
+ return !compact || FLAC__metadata_object_seektable_resize_points(object, unique);
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
{
- if(!FLAC__format_vorbiscomment_entry_value_is_legal(entry.entry, entry.length))
- return false;
- return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.vendor_string, &entry, copy);
+ if(!FLAC__format_vorbiscomment_entry_value_is_legal(entry.entry, entry.length))
+ return false;
+ return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.vendor_string, &entry, copy);
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
-
- if(0 == object->data.vorbis_comment.comments)
- {
- FLAC__ASSERT(object->data.vorbis_comment.num_comments == 0);
- if(0 == new_num_comments)
- return true;
- else if(0 == (object->data.vorbis_comment.comments = vorbiscomment_entry_array_new_(new_num_comments)))
- return false;
- }
- else
- {
- const size_t old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry);
- const size_t new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry);
-
- /* overflow check */
- if((size_t)new_num_comments > SIZE_MAX / sizeof(FLAC__StreamMetadata_VorbisComment_Entry))
- return false;
-
- FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0);
-
- /* if shrinking, free the truncated entries */
- if(new_num_comments < object->data.vorbis_comment.num_comments)
- {
- unsigned i;
- for(i = new_num_comments; i < object->data.vorbis_comment.num_comments; i++)
- if(0 != object->data.vorbis_comment.comments[i].entry)
- free(object->data.vorbis_comment.comments[i].entry);
- }
-
- if(new_size == 0)
- {
- free(object->data.vorbis_comment.comments);
- object->data.vorbis_comment.comments = 0;
- }
- else if(0 == (object->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(object->data.vorbis_comment.comments, new_size)))
- return false;
-
- /* if growing, zero all the length/pointers of new elements */
- if(new_size > old_size)
- memset(object->data.vorbis_comment.comments + object->data.vorbis_comment.num_comments, 0, new_size - old_size);
- }
-
- object->data.vorbis_comment.num_comments = new_num_comments;
-
- vorbiscomment_calculate_length_(object);
- return true;
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+
+ if(0 == object->data.vorbis_comment.comments) {
+ FLAC__ASSERT(object->data.vorbis_comment.num_comments == 0);
+ if(0 == new_num_comments)
+ return true;
+ else if(0 == (object->data.vorbis_comment.comments = vorbiscomment_entry_array_new_(new_num_comments)))
+ return false;
+ }
+ else {
+ const size_t old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry);
+ const size_t new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry);
+
+ /* overflow check */
+ if((size_t)new_num_comments > SIZE_MAX / sizeof(FLAC__StreamMetadata_VorbisComment_Entry))
+ return false;
+
+ FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0);
+
+ /* if shrinking, free the truncated entries */
+ if(new_num_comments < object->data.vorbis_comment.num_comments) {
+ unsigned i;
+ for(i = new_num_comments; i < object->data.vorbis_comment.num_comments; i++)
+ if(0 != object->data.vorbis_comment.comments[i].entry)
+ free(object->data.vorbis_comment.comments[i].entry);
+ }
+
+ if(new_size == 0) {
+ free(object->data.vorbis_comment.comments);
+ object->data.vorbis_comment.comments = 0;
+ }
+ else if(0 == (object->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(object->data.vorbis_comment.comments, new_size)))
+ return false;
+
+ /* if growing, zero all the length/pointers of new elements */
+ if(new_size > old_size)
+ memset(object->data.vorbis_comment.comments + object->data.vorbis_comment.num_comments, 0, new_size - old_size);
+ }
+
+ object->data.vorbis_comment.num_comments = new_num_comments;
+
+ vorbiscomment_calculate_length_(object);
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments);
- if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
- return false;
- return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.comments[comment_num], &entry, copy);
+ if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
+ return false;
+ return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.comments[comment_num], &entry, copy);
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
{
- FLAC__StreamMetadata_VorbisComment *vc;
+ FLAC__StreamMetadata_VorbisComment *vc;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- FLAC__ASSERT(comment_num <= object->data.vorbis_comment.num_comments);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT(comment_num <= object->data.vorbis_comment.num_comments);
- if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
- return false;
+ if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
+ return false;
- vc = &object->data.vorbis_comment;
+ vc = &object->data.vorbis_comment;
- if(!FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments + 1))
- return false;
+ if(!FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments+1))
+ return false;
- /* move all comments >= comment_num forward one space */
- memmove(&vc->comments[comment_num+1], &vc->comments[comment_num], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments - 1 - comment_num));
- vc->comments[comment_num].length = 0;
- vc->comments[comment_num].entry = 0;
+ /* move all comments >= comment_num forward one space */
+ memmove(&vc->comments[comment_num+1], &vc->comments[comment_num], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-1-comment_num));
+ vc->comments[comment_num].length = 0;
+ vc->comments[comment_num].entry = 0;
- return FLAC__metadata_object_vorbiscomment_set_comment(object, comment_num, entry, copy);
+ return FLAC__metadata_object_vorbiscomment_set_comment(object, comment_num, entry, copy);
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- return FLAC__metadata_object_vorbiscomment_insert_comment(object, object->data.vorbis_comment.num_comments, entry, copy);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ return FLAC__metadata_object_vorbiscomment_insert_comment(object, object->data.vorbis_comment.num_comments, entry, copy);
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy)
{
- FLAC__ASSERT(0 != entry.entry && entry.length > 0);
-
- if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
- return false;
-
- {
- int i;
- size_t field_name_length;
- const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
-
- FLAC__ASSERT(0 != eq);
-
- if(0 == eq)
- return false; /* double protection */
-
- field_name_length = eq - entry.entry;
-
- i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length);
- if(i >= 0)
- {
- unsigned index = (unsigned)i;
- if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy))
- return false;
- entry = object->data.vorbis_comment.comments[index];
- index++; /* skip over replaced comment */
- if(all && index < object->data.vorbis_comment.num_comments)
- {
- i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
- while(i >= 0)
- {
- index = (unsigned)i;
- if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, index))
- return false;
- if(index < object->data.vorbis_comment.num_comments)
- i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
- else
- i = -1;
- }
- }
- return true;
- }
- else
- return FLAC__metadata_object_vorbiscomment_append_comment(object, entry, copy);
- }
+ FLAC__ASSERT(0 != entry.entry && entry.length > 0);
+
+ if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
+ return false;
+
+ {
+ int i;
+ size_t field_name_length;
+ const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
+
+ FLAC__ASSERT(0 != eq);
+
+ if(0 == eq)
+ return false; /* double protection */
+
+ field_name_length = eq-entry.entry;
+
+ i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length);
+ if(i >= 0) {
+ unsigned index = (unsigned)i;
+ if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy))
+ return false;
+ entry = object->data.vorbis_comment.comments[index];
+ index++; /* skip over replaced comment */
+ if(all && index < object->data.vorbis_comment.num_comments) {
+ i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
+ while(i >= 0) {
+ index = (unsigned)i;
+ if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, index))
+ return false;
+ if(index < object->data.vorbis_comment.num_comments)
+ i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
+ else
+ i = -1;
+ }
+ }
+ return true;
+ }
+ else
+ return FLAC__metadata_object_vorbiscomment_append_comment(object, entry, copy);
+ }
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num)
{
- FLAC__StreamMetadata_VorbisComment *vc;
+ FLAC__StreamMetadata_VorbisComment *vc;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments);
- vc = &object->data.vorbis_comment;
+ vc = &object->data.vorbis_comment;
- /* free the comment at comment_num */
- if(0 != vc->comments[comment_num].entry)
- free(vc->comments[comment_num].entry);
+ /* free the comment at comment_num */
+ if(0 != vc->comments[comment_num].entry)
+ free(vc->comments[comment_num].entry);
- /* move all comments > comment_num backward one space */
- memmove(&vc->comments[comment_num], &vc->comments[comment_num+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments - comment_num - 1));
- vc->comments[vc->num_comments-1].length = 0;
- vc->comments[vc->num_comments-1].entry = 0;
+ /* move all comments > comment_num backward one space */
+ memmove(&vc->comments[comment_num], &vc->comments[comment_num+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-comment_num-1));
+ vc->comments[vc->num_comments-1].length = 0;
+ vc->comments[vc->num_comments-1].entry = 0;
- return FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments - 1);
+ return FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments-1);
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value)
{
- FLAC__ASSERT(0 != entry);
- FLAC__ASSERT(0 != field_name);
- FLAC__ASSERT(0 != field_value);
-
- if(!FLAC__format_vorbiscomment_entry_name_is_legal(field_name))
- return false;
- if(!FLAC__format_vorbiscomment_entry_value_is_legal((const FLAC__byte *)field_value, (unsigned)(-1)))
- return false;
-
- {
- const size_t nn = strlen(field_name);
- const size_t nv = strlen(field_value);
- entry->length = nn + 1 /*=*/ + nv;
- if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1)))
- return false;
- memcpy(entry->entry, field_name, nn);
- entry->entry[nn] = '=';
- memcpy(entry->entry + nn + 1, field_value, nv);
- entry->entry[entry->length] = '\0';
- }
-
- return true;
+ FLAC__ASSERT(0 != entry);
+ FLAC__ASSERT(0 != field_name);
+ FLAC__ASSERT(0 != field_value);
+
+ if(!FLAC__format_vorbiscomment_entry_name_is_legal(field_name))
+ return false;
+ if(!FLAC__format_vorbiscomment_entry_value_is_legal((const FLAC__byte *)field_value, (unsigned)(-1)))
+ return false;
+
+ {
+ const size_t nn = strlen(field_name);
+ const size_t nv = strlen(field_value);
+ entry->length = nn + 1 /*=*/ + nv;
+ if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1)))
+ return false;
+ memcpy(entry->entry, field_name, nn);
+ entry->entry[nn] = '=';
+ memcpy(entry->entry+nn+1, field_value, nv);
+ entry->entry[entry->length] = '\0';
+ }
+
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value)
{
- FLAC__ASSERT(0 != entry.entry && entry.length > 0);
- FLAC__ASSERT(0 != field_name);
- FLAC__ASSERT(0 != field_value);
-
- if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
- return false;
-
- {
- const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
- const size_t nn = eq - entry.entry;
- const size_t nv = entry.length - nn - 1; /* -1 for the '=' */
- FLAC__ASSERT(0 != eq);
- if(0 == eq)
- return false; /* double protection */
- if(0 == (*field_name = (char*)safe_malloc_add_2op_(nn, /*+*/1)))
- return false;
- if(0 == (*field_value = (char*)safe_malloc_add_2op_(nv, /*+*/1)))
- {
- free(*field_name);
- return false;
- }
- memcpy(*field_name, entry.entry, nn);
- memcpy(*field_value, entry.entry + nn + 1, nv);
- (*field_name)[nn] = '\0';
- (*field_value)[nv] = '\0';
- }
-
- return true;
+ FLAC__ASSERT(0 != entry.entry && entry.length > 0);
+ FLAC__ASSERT(0 != field_name);
+ FLAC__ASSERT(0 != field_value);
+
+ if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length))
+ return false;
+
+ {
+ const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
+ const size_t nn = eq-entry.entry;
+ const size_t nv = entry.length-nn-1; /* -1 for the '=' */
+ FLAC__ASSERT(0 != eq);
+ if(0 == eq)
+ return false; /* double protection */
+ if(0 == (*field_name = (char*)safe_malloc_add_2op_(nn, /*+*/1)))
+ return false;
+ if(0 == (*field_value = (char*)safe_malloc_add_2op_(nv, /*+*/1))) {
+ free(*field_name);
+ return false;
+ }
+ memcpy(*field_name, entry.entry, nn);
+ memcpy(*field_value, entry.entry+nn+1, nv);
+ (*field_name)[nn] = '\0';
+ (*field_value)[nv] = '\0';
+ }
+
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length)
{
- FLAC__ASSERT(0 != entry.entry && entry.length > 0);
- {
- const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
+ FLAC__ASSERT(0 != entry.entry && entry.length > 0);
+ {
+ const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ || defined __EMX__
#define FLAC__STRNCASECMP strnicmp
#else
#define FLAC__STRNCASECMP strncasecmp
#endif
- return (0 != eq && (unsigned)(eq - entry.entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length));
+ return (0 != eq && (unsigned)(eq-entry.entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length));
#undef FLAC__STRNCASECMP
- }
+ }
}
FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name)
{
- FLAC__ASSERT(0 != field_name);
+ FLAC__ASSERT(0 != field_name);
- return vorbiscomment_find_entry_from_(object, offset, field_name, strlen(field_name));
+ return vorbiscomment_find_entry_from_(object, offset, field_name, strlen(field_name));
}
FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name)
{
- const unsigned field_name_length = strlen(field_name);
- unsigned i;
+ const unsigned field_name_length = strlen(field_name);
+ unsigned i;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- for(i = 0; i < object->data.vorbis_comment.num_comments; i++)
- {
- if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length))
- {
- if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, i))
- return -1;
- else
- return 1;
- }
- }
+ for(i = 0; i < object->data.vorbis_comment.num_comments; i++) {
+ if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) {
+ if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, i))
+ return -1;
+ else
+ return 1;
+ }
+ }
- return 0;
+ return 0;
}
FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name)
{
- FLAC__bool ok = true;
- unsigned matching = 0;
- const unsigned field_name_length = strlen(field_name);
- int i;
+ FLAC__bool ok = true;
+ unsigned matching = 0;
+ const unsigned field_name_length = strlen(field_name);
+ int i;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
- /* must delete from end to start otherwise it will interfere with our iteration */
- for(i = (int)object->data.vorbis_comment.num_comments - 1; ok && i >= 0; i--)
- {
- if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length))
- {
- matching++;
- ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i);
- }
- }
+ /* must delete from end to start otherwise it will interfere with our iteration */
+ for(i = (int)object->data.vorbis_comment.num_comments - 1; ok && i >= 0; i--) {
+ if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) {
+ matching++;
+ ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i);
+ }
+ }
- return ok ? (int)matching : -1;
+ return ok? (int)matching : -1;
}
FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new(void)
{
- return (FLAC__StreamMetadata_CueSheet_Track*)calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track));
+ return (FLAC__StreamMetadata_CueSheet_Track*)calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track));
}
FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object)
{
- FLAC__StreamMetadata_CueSheet_Track *to;
+ FLAC__StreamMetadata_CueSheet_Track *to;
- FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != object);
- if(0 != (to = FLAC__metadata_object_cuesheet_track_new()))
- {
- if(!copy_track_(to, object))
- {
- FLAC__metadata_object_cuesheet_track_delete(to);
- return 0;
- }
- }
+ if(0 != (to = FLAC__metadata_object_cuesheet_track_new())) {
+ if(!copy_track_(to, object)) {
+ FLAC__metadata_object_cuesheet_track_delete(to);
+ return 0;
+ }
+ }
- return to;
+ return to;
}
void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object)
{
- FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(0 != object);
- if(0 != object->indices)
- {
- FLAC__ASSERT(object->num_indices > 0);
- free(object->indices);
- }
+ if(0 != object->indices) {
+ FLAC__ASSERT(object->num_indices > 0);
+ free(object->indices);
+ }
}
FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_CueSheet_Track *object)
{
- FLAC__metadata_object_cuesheet_track_delete_data(object);
- free(object);
+ FLAC__metadata_object_cuesheet_track_delete_data(object);
+ free(object);
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices)
{
- FLAC__StreamMetadata_CueSheet_Track *track;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
+ FLAC__StreamMetadata_CueSheet_Track *track;
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
- track = &object->data.cue_sheet.tracks[track_num];
+ track = &object->data.cue_sheet.tracks[track_num];
- if(0 == track->indices)
- {
- FLAC__ASSERT(track->num_indices == 0);
- if(0 == new_num_indices)
- return true;
- else if(0 == (track->indices = cuesheet_track_index_array_new_(new_num_indices)))
- return false;
- }
- else
- {
- const size_t old_size = track->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index);
- const size_t new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index);
+ if(0 == track->indices) {
+ FLAC__ASSERT(track->num_indices == 0);
+ if(0 == new_num_indices)
+ return true;
+ else if(0 == (track->indices = cuesheet_track_index_array_new_(new_num_indices)))
+ return false;
+ }
+ else {
+ const size_t old_size = track->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index);
+ const size_t new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index);
- /* overflow check */
- if((size_t)new_num_indices > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Index))
- return false;
+ /* overflow check */
+ if((size_t)new_num_indices > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Index))
+ return false;
- FLAC__ASSERT(track->num_indices > 0);
+ FLAC__ASSERT(track->num_indices > 0);
- if(new_size == 0)
- {
- free(track->indices);
- track->indices = 0;
- }
- else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(track->indices, new_size)))
- return false;
+ if(new_size == 0) {
+ free(track->indices);
+ track->indices = 0;
+ }
+ else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(track->indices, new_size)))
+ return false;
- /* if growing, zero all the lengths/pointers of new elements */
- if(new_size > old_size)
- memset(track->indices + track->num_indices, 0, new_size - old_size);
- }
+ /* if growing, zero all the lengths/pointers of new elements */
+ if(new_size > old_size)
+ memset(track->indices + track->num_indices, 0, new_size - old_size);
+ }
- track->num_indices = new_num_indices;
+ track->num_indices = new_num_indices;
- cuesheet_calculate_length_(object);
- return true;
+ cuesheet_calculate_length_(object);
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index)
{
- FLAC__StreamMetadata_CueSheet_Track *track;
+ FLAC__StreamMetadata_CueSheet_Track *track;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
- FLAC__ASSERT(index_num <= object->data.cue_sheet.tracks[track_num].num_indices);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
+ FLAC__ASSERT(index_num <= object->data.cue_sheet.tracks[track_num].num_indices);
- track = &object->data.cue_sheet.tracks[track_num];
+ track = &object->data.cue_sheet.tracks[track_num];
- if(!FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices + 1))
- return false;
+ if(!FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices+1))
+ return false;
- /* move all indices >= index_num forward one space */
- memmove(&track->indices[index_num+1], &track->indices[index_num], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices - 1 - index_num));
+ /* move all indices >= index_num forward one space */
+ memmove(&track->indices[index_num+1], &track->indices[index_num], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices-1-index_num));
- track->indices[index_num] = index;
- cuesheet_calculate_length_(object);
- return true;
+ track->indices[index_num] = index;
+ cuesheet_calculate_length_(object);
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
{
- FLAC__StreamMetadata_CueSheet_Index index;
- memset(&index, 0, sizeof(index));
- return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, index);
+ FLAC__StreamMetadata_CueSheet_Index index;
+ memset(&index, 0, sizeof(index));
+ return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, index);
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
{
- FLAC__StreamMetadata_CueSheet_Track *track;
+ FLAC__StreamMetadata_CueSheet_Track *track;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
- FLAC__ASSERT(index_num < object->data.cue_sheet.tracks[track_num].num_indices);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
+ FLAC__ASSERT(index_num < object->data.cue_sheet.tracks[track_num].num_indices);
- track = &object->data.cue_sheet.tracks[track_num];
+ track = &object->data.cue_sheet.tracks[track_num];
- /* move all indices > index_num backward one space */
- memmove(&track->indices[index_num], &track->indices[index_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices - index_num - 1));
+ /* move all indices > index_num backward one space */
+ memmove(&track->indices[index_num], &track->indices[index_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices-index_num-1));
- FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices - 1);
- cuesheet_calculate_length_(object);
- return true;
+ FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices-1);
+ cuesheet_calculate_length_(object);
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
-
- if(0 == object->data.cue_sheet.tracks)
- {
- FLAC__ASSERT(object->data.cue_sheet.num_tracks == 0);
- if(0 == new_num_tracks)
- return true;
- else if(0 == (object->data.cue_sheet.tracks = cuesheet_track_array_new_(new_num_tracks)))
- return false;
- }
- else
- {
- const size_t old_size = object->data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track);
- const size_t new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track);
-
- /* overflow check */
- if((size_t)new_num_tracks > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Track))
- return false;
-
- FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0);
-
- /* if shrinking, free the truncated entries */
- if(new_num_tracks < object->data.cue_sheet.num_tracks)
- {
- unsigned i;
- for(i = new_num_tracks; i < object->data.cue_sheet.num_tracks; i++)
- if(0 != object->data.cue_sheet.tracks[i].indices)
- free(object->data.cue_sheet.tracks[i].indices);
- }
-
- if(new_size == 0)
- {
- free(object->data.cue_sheet.tracks);
- object->data.cue_sheet.tracks = 0;
- }
- else if(0 == (object->data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(object->data.cue_sheet.tracks, new_size)))
- return false;
-
- /* if growing, zero all the lengths/pointers of new elements */
- if(new_size > old_size)
- memset(object->data.cue_sheet.tracks + object->data.cue_sheet.num_tracks, 0, new_size - old_size);
- }
-
- object->data.cue_sheet.num_tracks = new_num_tracks;
-
- cuesheet_calculate_length_(object);
- return true;
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+
+ if(0 == object->data.cue_sheet.tracks) {
+ FLAC__ASSERT(object->data.cue_sheet.num_tracks == 0);
+ if(0 == new_num_tracks)
+ return true;
+ else if(0 == (object->data.cue_sheet.tracks = cuesheet_track_array_new_(new_num_tracks)))
+ return false;
+ }
+ else {
+ const size_t old_size = object->data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track);
+ const size_t new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track);
+
+ /* overflow check */
+ if((size_t)new_num_tracks > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Track))
+ return false;
+
+ FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0);
+
+ /* if shrinking, free the truncated entries */
+ if(new_num_tracks < object->data.cue_sheet.num_tracks) {
+ unsigned i;
+ for(i = new_num_tracks; i < object->data.cue_sheet.num_tracks; i++)
+ if(0 != object->data.cue_sheet.tracks[i].indices)
+ free(object->data.cue_sheet.tracks[i].indices);
+ }
+
+ if(new_size == 0) {
+ free(object->data.cue_sheet.tracks);
+ object->data.cue_sheet.tracks = 0;
+ }
+ else if(0 == (object->data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(object->data.cue_sheet.tracks, new_size)))
+ return false;
+
+ /* if growing, zero all the lengths/pointers of new elements */
+ if(new_size > old_size)
+ memset(object->data.cue_sheet.tracks + object->data.cue_sheet.num_tracks, 0, new_size - old_size);
+ }
+
+ object->data.cue_sheet.num_tracks = new_num_tracks;
+
+ cuesheet_calculate_length_(object);
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
- return cuesheet_set_track_(object, object->data.cue_sheet.tracks + track_num, track, copy);
+ return cuesheet_set_track_(object, object->data.cue_sheet.tracks + track_num, track, copy);
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
{
- FLAC__StreamMetadata_CueSheet *cs;
+ FLAC__StreamMetadata_CueSheet *cs;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- FLAC__ASSERT(track_num <= object->data.cue_sheet.num_tracks);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(track_num <= object->data.cue_sheet.num_tracks);
- cs = &object->data.cue_sheet;
+ cs = &object->data.cue_sheet;
- if(!FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks + 1))
- return false;
+ if(!FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks+1))
+ return false;
- /* move all tracks >= track_num forward one space */
- memmove(&cs->tracks[track_num+1], &cs->tracks[track_num], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks - 1 - track_num));
- cs->tracks[track_num].num_indices = 0;
- cs->tracks[track_num].indices = 0;
+ /* move all tracks >= track_num forward one space */
+ memmove(&cs->tracks[track_num+1], &cs->tracks[track_num], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks-1-track_num));
+ cs->tracks[track_num].num_indices = 0;
+ cs->tracks[track_num].indices = 0;
- return FLAC__metadata_object_cuesheet_set_track(object, track_num, track, copy);
+ return FLAC__metadata_object_cuesheet_set_track(object, track_num, track, copy);
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num)
{
- FLAC__StreamMetadata_CueSheet_Track track;
- memset(&track, 0, sizeof(track));
- return FLAC__metadata_object_cuesheet_insert_track(object, track_num, &track, /*copy=*/false);
+ FLAC__StreamMetadata_CueSheet_Track track;
+ memset(&track, 0, sizeof(track));
+ return FLAC__metadata_object_cuesheet_insert_track(object, track_num, &track, /*copy=*/false);
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num)
{
- FLAC__StreamMetadata_CueSheet *cs;
+ FLAC__StreamMetadata_CueSheet *cs;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
- cs = &object->data.cue_sheet;
+ cs = &object->data.cue_sheet;
- /* free the track at track_num */
- if(0 != cs->tracks[track_num].indices)
- free(cs->tracks[track_num].indices);
+ /* free the track at track_num */
+ if(0 != cs->tracks[track_num].indices)
+ free(cs->tracks[track_num].indices);
- /* move all tracks > track_num backward one space */
- memmove(&cs->tracks[track_num], &cs->tracks[track_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks - track_num - 1));
- cs->tracks[cs->num_tracks-1].num_indices = 0;
- cs->tracks[cs->num_tracks-1].indices = 0;
+ /* move all tracks > track_num backward one space */
+ memmove(&cs->tracks[track_num], &cs->tracks[track_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks-track_num-1));
+ cs->tracks[cs->num_tracks-1].num_indices = 0;
+ cs->tracks[cs->num_tracks-1].indices = 0;
- return FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks - 1);
+ return FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks-1);
}
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- return FLAC__format_cuesheet_is_legal(&object->data.cue_sheet, check_cd_da_subset, violation);
+ return FLAC__format_cuesheet_is_legal(&object->data.cue_sheet, check_cd_da_subset, violation);
}
static FLAC__uint64 get_index_01_offset_(const FLAC__StreamMetadata_CueSheet *cs, unsigned track)
{
- if(track >= (cs->num_tracks - 1) || cs->tracks[track].num_indices < 1)
- return 0;
- else if(cs->tracks[track].indices[0].number == 1)
- return cs->tracks[track].indices[0].offset + cs->tracks[track].offset + cs->lead_in;
- else if(cs->tracks[track].num_indices < 2)
- return 0;
- else if(cs->tracks[track].indices[1].number == 1)
- return cs->tracks[track].indices[1].offset + cs->tracks[track].offset + cs->lead_in;
- else
- return 0;
+ if (track >= (cs->num_tracks-1) || cs->tracks[track].num_indices < 1)
+ return 0;
+ else if (cs->tracks[track].indices[0].number == 1)
+ return cs->tracks[track].indices[0].offset + cs->tracks[track].offset + cs->lead_in;
+ else if (cs->tracks[track].num_indices < 2)
+ return 0;
+ else if (cs->tracks[track].indices[1].number == 1)
+ return cs->tracks[track].indices[1].offset + cs->tracks[track].offset + cs->lead_in;
+ else
+ return 0;
}
static FLAC__uint32 cddb_add_digits_(FLAC__uint32 x)
{
- FLAC__uint32 n = 0;
- while(x)
- {
- n += (x % 10);
- x /= 10;
- }
- return n;
+ FLAC__uint32 n = 0;
+ while (x) {
+ n += (x%10);
+ x /= 10;
+ }
+ return n;
}
/*@@@@add to tests*/
FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLAC__StreamMetadata *object)
{
- const FLAC__StreamMetadata_CueSheet *cs;
+ const FLAC__StreamMetadata_CueSheet *cs;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
- cs = &object->data.cue_sheet;
+ cs = &object->data.cue_sheet;
- if(cs->num_tracks < 2) /* need at least one real track and the lead-out track */
- return 0;
+ if (cs->num_tracks < 2) /* need at least one real track and the lead-out track */
+ return 0;
- {
- FLAC__uint32 i, length, sum = 0;
- for(i = 0; i < (cs->num_tracks - 1); i++) /* -1 to avoid counting the lead-out */
- sum += cddb_add_digits_((FLAC__uint32)(get_index_01_offset_(cs, i) / 44100));
- length = (FLAC__uint32)((cs->tracks[cs->num_tracks-1].offset + cs->lead_in) / 44100) - (FLAC__uint32)(get_index_01_offset_(cs, 0) / 44100);
+ {
+ FLAC__uint32 i, length, sum = 0;
+ for (i = 0; i < (cs->num_tracks-1); i++) /* -1 to avoid counting the lead-out */
+ sum += cddb_add_digits_((FLAC__uint32)(get_index_01_offset_(cs, i) / 44100));
+ length = (FLAC__uint32)((cs->tracks[cs->num_tracks-1].offset+cs->lead_in) / 44100) - (FLAC__uint32)(get_index_01_offset_(cs, 0) / 44100);
- return (sum % 0xFF) << 24 | length << 8 | (FLAC__uint32)(cs->num_tracks - 1);
- }
+ return (sum % 0xFF) << 24 | length << 8 | (FLAC__uint32)(cs->num_tracks-1);
+ }
}
FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type(FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy)
{
- char *old;
- size_t old_length, new_length;
+ char *old;
+ size_t old_length, new_length;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
- FLAC__ASSERT(0 != mime_type);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
+ FLAC__ASSERT(0 != mime_type);
- old = object->data.picture.mime_type;
- old_length = old ? strlen(old) : 0;
- new_length = strlen(mime_type);
+ old = object->data.picture.mime_type;
+ old_length = old? strlen(old) : 0;
+ new_length = strlen(mime_type);
- /* do the copy first so that if we fail we leave the object untouched */
- if(copy)
- {
- if(new_length >= SIZE_MAX) /* overflow check */
- return false;
- if(!copy_bytes_((FLAC__byte**)(&object->data.picture.mime_type), (FLAC__byte*)mime_type, new_length + 1))
- return false;
- }
- else
- {
- object->data.picture.mime_type = mime_type;
- }
+ /* do the copy first so that if we fail we leave the object untouched */
+ if(copy) {
+ if(new_length >= SIZE_MAX) /* overflow check */
+ return false;
+ if(!copy_bytes_((FLAC__byte**)(&object->data.picture.mime_type), (FLAC__byte*)mime_type, new_length+1))
+ return false;
+ }
+ else {
+ object->data.picture.mime_type = mime_type;
+ }
- if(0 != old)
- free(old);
+ if(0 != old)
+ free(old);
- object->length -= old_length;
- object->length += new_length;
- return true;
+ object->length -= old_length;
+ object->length += new_length;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description(FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy)
{
- FLAC__byte *old;
- size_t old_length, new_length;
+ FLAC__byte *old;
+ size_t old_length, new_length;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
- FLAC__ASSERT(0 != description);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
+ FLAC__ASSERT(0 != description);
- old = object->data.picture.description;
- old_length = old ? strlen((const char *)old) : 0;
- new_length = strlen((const char *)description);
+ old = object->data.picture.description;
+ old_length = old? strlen((const char *)old) : 0;
+ new_length = strlen((const char *)description);
- /* do the copy first so that if we fail we leave the object untouched */
- if(copy)
- {
- if(new_length >= SIZE_MAX) /* overflow check */
- return false;
- if(!copy_bytes_(&object->data.picture.description, description, new_length + 1))
- return false;
- }
- else
- {
- object->data.picture.description = description;
- }
+ /* do the copy first so that if we fail we leave the object untouched */
+ if(copy) {
+ if(new_length >= SIZE_MAX) /* overflow check */
+ return false;
+ if(!copy_bytes_(&object->data.picture.description, description, new_length+1))
+ return false;
+ }
+ else {
+ object->data.picture.description = description;
+ }
- if(0 != old)
- free(old);
+ if(0 != old)
+ free(old);
- object->length -= old_length;
- object->length += new_length;
- return true;
+ object->length -= old_length;
+ object->length += new_length;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy)
{
- FLAC__byte *old;
+ FLAC__byte *old;
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
- FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false));
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
+ FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false));
- old = object->data.picture.data;
+ old = object->data.picture.data;
- /* do the copy first so that if we fail we leave the object untouched */
- if(copy)
- {
- if(!copy_bytes_(&object->data.picture.data, data, length))
- return false;
- }
- else
- {
- object->data.picture.data = data;
- }
+ /* do the copy first so that if we fail we leave the object untouched */
+ if(copy) {
+ if(!copy_bytes_(&object->data.picture.data, data, length))
+ return false;
+ }
+ else {
+ object->data.picture.data = data;
+ }
- if(0 != old)
- free(old);
+ if(0 != old)
+ free(old);
- object->length -= object->data.picture.data_length;
- object->data.picture.data_length = length;
- object->length += length;
- return true;
+ object->length -= object->data.picture.data_length;
+ object->data.picture.data_length = length;
+ object->length += length;
+ return true;
}
FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation)
{
- FLAC__ASSERT(0 != object);
- FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
+ FLAC__ASSERT(0 != object);
+ FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE);
- return FLAC__format_picture_is_legal(&object->data.picture, violation);
+ return FLAC__format_picture_is_legal(&object->data.picture, violation);
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_decoder_aspect.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_decoder_aspect.c
index 40b511962..0f71edca1 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_decoder_aspect.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_decoder_aspect.c
@@ -51,224 +51,203 @@
FLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect)
{
- /* we will determine the serial number later if necessary */
- if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
- return false;
+ /* we will determine the serial number later if necessary */
+ if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
+ return false;
- if(ogg_sync_init(&aspect->sync_state) != 0)
- return false;
+ if(ogg_sync_init(&aspect->sync_state) != 0)
+ return false;
- aspect->version_major = ~(0u);
- aspect->version_minor = ~(0u);
+ aspect->version_major = ~(0u);
+ aspect->version_minor = ~(0u);
- aspect->need_serial_number = aspect->use_first_serial_number;
+ aspect->need_serial_number = aspect->use_first_serial_number;
- aspect->end_of_stream = false;
- aspect->have_working_page = false;
+ aspect->end_of_stream = false;
+ aspect->have_working_page = false;
- return true;
+ return true;
}
void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect)
{
- (void)ogg_sync_clear(&aspect->sync_state);
- (void)ogg_stream_clear(&aspect->stream_state);
+ (void)ogg_sync_clear(&aspect->sync_state);
+ (void)ogg_stream_clear(&aspect->stream_state);
}
void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value)
{
- aspect->use_first_serial_number = false;
- aspect->serial_number = value;
+ aspect->use_first_serial_number = false;
+ aspect->serial_number = value;
}
void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect)
{
- aspect->use_first_serial_number = true;
+ aspect->use_first_serial_number = true;
}
void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect)
{
- (void)ogg_stream_reset(&aspect->stream_state);
- (void)ogg_sync_reset(&aspect->sync_state);
- aspect->end_of_stream = false;
- aspect->have_working_page = false;
+ (void)ogg_stream_reset(&aspect->stream_state);
+ (void)ogg_sync_reset(&aspect->sync_state);
+ aspect->end_of_stream = false;
+ aspect->have_working_page = false;
}
void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect)
{
- FLAC__ogg_decoder_aspect_flush(aspect);
+ FLAC__ogg_decoder_aspect_flush(aspect);
- if(aspect->use_first_serial_number)
- aspect->need_serial_number = true;
+ if(aspect->use_first_serial_number)
+ aspect->need_serial_number = true;
}
FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data)
{
- static const size_t OGG_BYTES_CHUNK = 8192;
- const size_t bytes_requested = *bytes;
-
- /*
- * The FLAC decoding API uses pull-based reads, whereas Ogg decoding
- * is push-based. In libFLAC, when you ask to decode a frame, the
- * decoder will eventually call the read callback to supply some data,
- * but how much it asks for depends on how much free space it has in
- * its internal buffer. It does not try to grow its internal buffer
- * to accomodate a whole frame because then the internal buffer size
- * could not be limited, which is necessary in embedded applications.
- *
- * Ogg however grows its internal buffer until a whole page is present;
- * only then can you get decoded data out. So we can't just ask for
- * the same number of bytes from Ogg, then pass what's decoded down to
- * libFLAC. If what libFLAC is asking for will not contain a whole
- * page, then we will get no data from ogg_sync_pageout(), and at the
- * same time cannot just read more data from the client for the purpose
- * of getting a whole decoded page because the decoded size might be
- * larger than libFLAC's internal buffer.
- *
- * Instead, whenever this read callback wrapper is called, we will
- * continually request data from the client until we have at least one
- * page, and manage pages internally so that we can send pieces of
- * pages down to libFLAC in such a way that we obey its size
- * requirement. To limit the amount of callbacks, we will always try
- * to read in enough pages to return the full number of bytes
- * requested.
- */
- *bytes = 0;
- while(*bytes < bytes_requested && !aspect->end_of_stream)
- {
- if(aspect->have_working_page)
- {
- if(aspect->have_working_packet)
- {
- size_t n = bytes_requested - *bytes;
- if((size_t)aspect->working_packet.bytes <= n)
- {
- /* the rest of the packet will fit in the buffer */
- n = aspect->working_packet.bytes;
- memcpy(buffer, aspect->working_packet.packet, n);
- *bytes += n;
- buffer += n;
- aspect->have_working_packet = false;
- }
- else
- {
- /* only n bytes of the packet will fit in the buffer */
- memcpy(buffer, aspect->working_packet.packet, n);
- *bytes += n;
- buffer += n;
- aspect->working_packet.packet += n;
- aspect->working_packet.bytes -= n;
- }
- }
- else
- {
- /* try and get another packet */
- const int ret = ogg_stream_packetout(&aspect->stream_state, &aspect->working_packet);
- if(ret > 0)
- {
- aspect->have_working_packet = true;
- /* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */
- if(aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE)
- {
- const FLAC__byte *b = aspect->working_packet.packet;
- const unsigned header_length =
- FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
- FLAC__OGG_MAPPING_MAGIC_LENGTH +
- FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
- FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
- FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH;
- if(aspect->working_packet.bytes < (long)header_length)
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
- b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH;
- if(memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH))
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
- b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
- aspect->version_major = (unsigned)(*b);
- b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
- aspect->version_minor = (unsigned)(*b);
- if(aspect->version_major != 1)
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION;
- aspect->working_packet.packet += header_length;
- aspect->working_packet.bytes -= header_length;
- }
- }
- else if(ret == 0)
- {
- aspect->have_working_page = false;
- }
- else /* ret < 0 */
- {
- /* lost sync, we'll leave the working page for the next call */
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC;
- }
- }
- }
- else
- {
- /* try and get another page */
- const int ret = ogg_sync_pageout(&aspect->sync_state, &aspect->working_page);
- if(ret > 0)
- {
- /* got a page, grab the serial number if necessary */
- if(aspect->need_serial_number)
- {
- aspect->stream_state.serialno = aspect->serial_number = ogg_page_serialno(&aspect->working_page);
- aspect->need_serial_number = false;
- }
- if(ogg_stream_pagein(&aspect->stream_state, &aspect->working_page) == 0)
- {
- aspect->have_working_page = true;
- aspect->have_working_packet = false;
- }
- /* else do nothing, could be a page from another stream */
- }
- else if(ret == 0)
- {
- /* need more data */
- const size_t ogg_bytes_to_read = max(bytes_requested - *bytes, OGG_BYTES_CHUNK);
- char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read);
-
- if(0 == oggbuf)
- {
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR;
- }
- else
- {
- size_t ogg_bytes_read = ogg_bytes_to_read;
-
- switch(read_callback(decoder, (FLAC__byte*)oggbuf, &ogg_bytes_read, client_data))
- {
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK:
- break;
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM:
- aspect->end_of_stream = true;
- break;
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT:
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
- default:
- FLAC__ASSERT(0);
- }
-
- if(ogg_sync_wrote(&aspect->sync_state, ogg_bytes_read) < 0)
- {
- /* double protection; this will happen if the read callback returns more bytes than the max requested, which would overflow Ogg's internal buffer */
- FLAC__ASSERT(0);
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR;
- }
- }
- }
- else /* ret < 0 */
- {
- /* lost sync, bail out */
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC;
- }
- }
- }
-
- if(aspect->end_of_stream && *bytes == 0)
- {
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM;
- }
-
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK;
+ static const size_t OGG_BYTES_CHUNK = 8192;
+ const size_t bytes_requested = *bytes;
+
+ /*
+ * The FLAC decoding API uses pull-based reads, whereas Ogg decoding
+ * is push-based. In libFLAC, when you ask to decode a frame, the
+ * decoder will eventually call the read callback to supply some data,
+ * but how much it asks for depends on how much free space it has in
+ * its internal buffer. It does not try to grow its internal buffer
+ * to accomodate a whole frame because then the internal buffer size
+ * could not be limited, which is necessary in embedded applications.
+ *
+ * Ogg however grows its internal buffer until a whole page is present;
+ * only then can you get decoded data out. So we can't just ask for
+ * the same number of bytes from Ogg, then pass what's decoded down to
+ * libFLAC. If what libFLAC is asking for will not contain a whole
+ * page, then we will get no data from ogg_sync_pageout(), and at the
+ * same time cannot just read more data from the client for the purpose
+ * of getting a whole decoded page because the decoded size might be
+ * larger than libFLAC's internal buffer.
+ *
+ * Instead, whenever this read callback wrapper is called, we will
+ * continually request data from the client until we have at least one
+ * page, and manage pages internally so that we can send pieces of
+ * pages down to libFLAC in such a way that we obey its size
+ * requirement. To limit the amount of callbacks, we will always try
+ * to read in enough pages to return the full number of bytes
+ * requested.
+ */
+ *bytes = 0;
+ while (*bytes < bytes_requested && !aspect->end_of_stream) {
+ if (aspect->have_working_page) {
+ if (aspect->have_working_packet) {
+ size_t n = bytes_requested - *bytes;
+ if ((size_t)aspect->working_packet.bytes <= n) {
+ /* the rest of the packet will fit in the buffer */
+ n = aspect->working_packet.bytes;
+ memcpy(buffer, aspect->working_packet.packet, n);
+ *bytes += n;
+ buffer += n;
+ aspect->have_working_packet = false;
+ }
+ else {
+ /* only n bytes of the packet will fit in the buffer */
+ memcpy(buffer, aspect->working_packet.packet, n);
+ *bytes += n;
+ buffer += n;
+ aspect->working_packet.packet += n;
+ aspect->working_packet.bytes -= n;
+ }
+ }
+ else {
+ /* try and get another packet */
+ const int ret = ogg_stream_packetout(&aspect->stream_state, &aspect->working_packet);
+ if (ret > 0) {
+ aspect->have_working_packet = true;
+ /* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */
+ if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) {
+ const FLAC__byte *b = aspect->working_packet.packet;
+ const unsigned header_length =
+ FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
+ FLAC__OGG_MAPPING_MAGIC_LENGTH +
+ FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
+ FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
+ FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH;
+ if (aspect->working_packet.bytes < (long)header_length)
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
+ b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH;
+ if (memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH))
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
+ b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
+ aspect->version_major = (unsigned)(*b);
+ b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
+ aspect->version_minor = (unsigned)(*b);
+ if (aspect->version_major != 1)
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION;
+ aspect->working_packet.packet += header_length;
+ aspect->working_packet.bytes -= header_length;
+ }
+ }
+ else if (ret == 0) {
+ aspect->have_working_page = false;
+ }
+ else { /* ret < 0 */
+ /* lost sync, we'll leave the working page for the next call */
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC;
+ }
+ }
+ }
+ else {
+ /* try and get another page */
+ const int ret = ogg_sync_pageout(&aspect->sync_state, &aspect->working_page);
+ if (ret > 0) {
+ /* got a page, grab the serial number if necessary */
+ if(aspect->need_serial_number) {
+ aspect->stream_state.serialno = aspect->serial_number = ogg_page_serialno(&aspect->working_page);
+ aspect->need_serial_number = false;
+ }
+ if(ogg_stream_pagein(&aspect->stream_state, &aspect->working_page) == 0) {
+ aspect->have_working_page = true;
+ aspect->have_working_packet = false;
+ }
+ /* else do nothing, could be a page from another stream */
+ }
+ else if (ret == 0) {
+ /* need more data */
+ const size_t ogg_bytes_to_read = max(bytes_requested - *bytes, OGG_BYTES_CHUNK);
+ char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read);
+
+ if(0 == oggbuf) {
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR;
+ }
+ else {
+ size_t ogg_bytes_read = ogg_bytes_to_read;
+
+ switch(read_callback(decoder, (FLAC__byte*)oggbuf, &ogg_bytes_read, client_data)) {
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK:
+ break;
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM:
+ aspect->end_of_stream = true;
+ break;
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT:
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ if(ogg_sync_wrote(&aspect->sync_state, ogg_bytes_read) < 0) {
+ /* double protection; this will happen if the read callback returns more bytes than the max requested, which would overflow Ogg's internal buffer */
+ FLAC__ASSERT(0);
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR;
+ }
+ }
+ }
+ else { /* ret < 0 */
+ /* lost sync, bail out */
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC;
+ }
+ }
+ }
+
+ if (aspect->end_of_stream && *bytes == 0) {
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM;
+ }
+
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_encoder_aspect.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_encoder_aspect.c
index eb0f0dfa7..e3f5ecc4e 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_encoder_aspect.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_encoder_aspect.c
@@ -49,43 +49,42 @@ static const FLAC__byte FLAC__OGG_MAPPING_VERSION_MINOR = 0;
FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect)
{
- /* we will determine the serial number later if necessary */
- if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
- return false;
+ /* we will determine the serial number later if necessary */
+ if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
+ return false;
- aspect->seen_magic = false;
- aspect->is_first_packet = true;
- aspect->samples_written = 0;
+ aspect->seen_magic = false;
+ aspect->is_first_packet = true;
+ aspect->samples_written = 0;
- return true;
+ return true;
}
void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect)
{
- (void)ogg_stream_clear(&aspect->stream_state);
- /*@@@ what about the page? */
+ (void)ogg_stream_clear(&aspect->stream_state);
+ /*@@@ what about the page? */
}
void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value)
{
- aspect->serial_number = value;
+ aspect->serial_number = value;
}
FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value)
{
- if(value < (1u << FLAC__OGG_MAPPING_NUM_HEADERS_LEN))
- {
- aspect->num_metadata = value;
- return true;
- }
- else
- return false;
+ if(value < (1u << FLAC__OGG_MAPPING_NUM_HEADERS_LEN)) {
+ aspect->num_metadata = value;
+ return true;
+ }
+ else
+ return false;
}
void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect)
{
- aspect->serial_number = 0;
- aspect->num_metadata = 0;
+ aspect->serial_number = 0;
+ aspect->num_metadata = 0;
}
/*
@@ -111,129 +110,118 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect)
*/
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data)
{
- /* WATCHOUT:
- * This depends on the behavior of FLAC__StreamEncoder that 'samples'
- * will be 0 for metadata writes.
- */
- const FLAC__bool is_metadata = (samples == 0);
-
- /*
- * Treat fLaC magic packet specially. We will note when we see it, then
- * wait until we get the STREAMINFO and prepend it in that packet
- */
- if(aspect->seen_magic)
- {
- ogg_packet packet;
- FLAC__byte synthetic_first_packet_body[
- FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
- FLAC__OGG_MAPPING_MAGIC_LENGTH +
- FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
- FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
- FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH +
- FLAC__STREAM_SYNC_LENGTH +
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- FLAC__STREAM_METADATA_STREAMINFO_LENGTH
- ];
-
- memset(&packet, 0, sizeof(packet));
- packet.granulepos = aspect->samples_written + samples;
-
- if(aspect->is_first_packet)
- {
- FLAC__byte *b = synthetic_first_packet_body;
- if(bytes != FLAC__STREAM_METADATA_HEADER_LENGTH + FLAC__STREAM_METADATA_STREAMINFO_LENGTH)
- {
- /*
- * If we get here, our assumption about the way write callbacks happen
- * (explained above) is wrong
- */
- FLAC__ASSERT(0);
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- }
- /* add first header packet type */
- *b = FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE;
- b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH;
- /* add 'FLAC' mapping magic */
- memcpy(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH);
- b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
- /* add Ogg FLAC mapping major version number */
- memcpy(b, &FLAC__OGG_MAPPING_VERSION_MAJOR, FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH);
- b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
- /* add Ogg FLAC mapping minor version number */
- memcpy(b, &FLAC__OGG_MAPPING_VERSION_MINOR, FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH);
- b += FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH;
- /* add number of header packets */
- *b = (FLAC__byte)(aspect->num_metadata >> 8);
- b++;
- *b = (FLAC__byte)(aspect->num_metadata);
- b++;
- /* add native FLAC 'fLaC' magic */
- memcpy(b, FLAC__STREAM_SYNC_STRING, FLAC__STREAM_SYNC_LENGTH);
- b += FLAC__STREAM_SYNC_LENGTH;
- /* add STREAMINFO */
- memcpy(b, buffer, bytes);
- FLAC__ASSERT(b + bytes - synthetic_first_packet_body == sizeof(synthetic_first_packet_body));
- packet.packet = (unsigned char *)synthetic_first_packet_body;
- packet.bytes = sizeof(synthetic_first_packet_body);
-
- packet.b_o_s = 1;
- aspect->is_first_packet = false;
- }
- else
- {
- packet.packet = (unsigned char *)buffer;
- packet.bytes = bytes;
- }
-
- if(is_last_block)
- {
- /* we used to check:
- * FLAC__ASSERT(total_samples_estimate == 0 || total_samples_estimate == aspect->samples_written + samples);
- * but it's really not useful since total_samples_estimate is an estimate and can be inexact
- */
- packet.e_o_s = 1;
- }
-
- if(ogg_stream_packetin(&aspect->stream_state, &packet) != 0)
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
-
- /*@@@ can't figure out a way to pass a useful number for 'samples' to the write_callback, so we'll just pass 0 */
- if(is_metadata)
- {
- while(ogg_stream_flush(&aspect->stream_state, &aspect->page) != 0)
- {
- if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- }
- }
- else
- {
- while(ogg_stream_pageout(&aspect->stream_state, &aspect->page) != 0)
- {
- if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- }
- }
- }
- else if(is_metadata && current_frame == 0 && samples == 0 && bytes == 4 && 0 == memcmp(buffer, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING)))
- {
- aspect->seen_magic = true;
- }
- else
- {
- /*
- * If we get here, our assumption about the way write callbacks happen
- * explained above is wrong
- */
- FLAC__ASSERT(0);
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- }
-
- aspect->samples_written += samples;
-
- return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
+ /* WATCHOUT:
+ * This depends on the behavior of FLAC__StreamEncoder that 'samples'
+ * will be 0 for metadata writes.
+ */
+ const FLAC__bool is_metadata = (samples == 0);
+
+ /*
+ * Treat fLaC magic packet specially. We will note when we see it, then
+ * wait until we get the STREAMINFO and prepend it in that packet
+ */
+ if(aspect->seen_magic) {
+ ogg_packet packet;
+ FLAC__byte synthetic_first_packet_body[
+ FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
+ FLAC__OGG_MAPPING_MAGIC_LENGTH +
+ FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
+ FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
+ FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH +
+ FLAC__STREAM_SYNC_LENGTH +
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ FLAC__STREAM_METADATA_STREAMINFO_LENGTH
+ ];
+
+ memset(&packet, 0, sizeof(packet));
+ packet.granulepos = aspect->samples_written + samples;
+
+ if(aspect->is_first_packet) {
+ FLAC__byte *b = synthetic_first_packet_body;
+ if(bytes != FLAC__STREAM_METADATA_HEADER_LENGTH + FLAC__STREAM_METADATA_STREAMINFO_LENGTH) {
+ /*
+ * If we get here, our assumption about the way write callbacks happen
+ * (explained above) is wrong
+ */
+ FLAC__ASSERT(0);
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ }
+ /* add first header packet type */
+ *b = FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE;
+ b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH;
+ /* add 'FLAC' mapping magic */
+ memcpy(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH);
+ b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
+ /* add Ogg FLAC mapping major version number */
+ memcpy(b, &FLAC__OGG_MAPPING_VERSION_MAJOR, FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH);
+ b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
+ /* add Ogg FLAC mapping minor version number */
+ memcpy(b, &FLAC__OGG_MAPPING_VERSION_MINOR, FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH);
+ b += FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH;
+ /* add number of header packets */
+ *b = (FLAC__byte)(aspect->num_metadata >> 8);
+ b++;
+ *b = (FLAC__byte)(aspect->num_metadata);
+ b++;
+ /* add native FLAC 'fLaC' magic */
+ memcpy(b, FLAC__STREAM_SYNC_STRING, FLAC__STREAM_SYNC_LENGTH);
+ b += FLAC__STREAM_SYNC_LENGTH;
+ /* add STREAMINFO */
+ memcpy(b, buffer, bytes);
+ FLAC__ASSERT(b + bytes - synthetic_first_packet_body == sizeof(synthetic_first_packet_body));
+ packet.packet = (unsigned char *)synthetic_first_packet_body;
+ packet.bytes = sizeof(synthetic_first_packet_body);
+
+ packet.b_o_s = 1;
+ aspect->is_first_packet = false;
+ }
+ else {
+ packet.packet = (unsigned char *)buffer;
+ packet.bytes = bytes;
+ }
+
+ if(is_last_block) {
+ /* we used to check:
+ * FLAC__ASSERT(total_samples_estimate == 0 || total_samples_estimate == aspect->samples_written + samples);
+ * but it's really not useful since total_samples_estimate is an estimate and can be inexact
+ */
+ packet.e_o_s = 1;
+ }
+
+ if(ogg_stream_packetin(&aspect->stream_state, &packet) != 0)
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+
+ /*@@@ can't figure out a way to pass a useful number for 'samples' to the write_callback, so we'll just pass 0 */
+ if(is_metadata) {
+ while(ogg_stream_flush(&aspect->stream_state, &aspect->page) != 0) {
+ if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ }
+ }
+ else {
+ while(ogg_stream_pageout(&aspect->stream_state, &aspect->page) != 0) {
+ if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ }
+ }
+ }
+ else if(is_metadata && current_frame == 0 && samples == 0 && bytes == 4 && 0 == memcmp(buffer, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING))) {
+ aspect->seen_magic = true;
+ }
+ else {
+ /*
+ * If we get here, our assumption about the way write callbacks happen
+ * explained above is wrong
+ */
+ FLAC__ASSERT(0);
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ }
+
+ aspect->samples_written += samples;
+
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_helper.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_helper.c
index 42b8d9a51..c3b091f45 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_helper.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/ogg_helper.c
@@ -43,180 +43,167 @@
static FLAC__bool full_read_(FLAC__StreamEncoder *encoder, FLAC__byte *buffer, size_t bytes, FLAC__StreamEncoderReadCallback read_callback, void *client_data)
{
- while(bytes > 0)
- {
- size_t bytes_read = bytes;
- switch(read_callback(encoder, buffer, &bytes_read, client_data))
- {
- case FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE:
- bytes -= bytes_read;
- buffer += bytes_read;
- break;
- case FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM:
- if(bytes_read == 0)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- return false;
- }
- bytes -= bytes_read;
- buffer += bytes_read;
- break;
- case FLAC__STREAM_ENCODER_READ_STATUS_ABORT:
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- case FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED:
- return false;
- default:
- /* double protection: */
- FLAC__ASSERT(0);
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- }
- }
-
- return true;
+ while(bytes > 0) {
+ size_t bytes_read = bytes;
+ switch(read_callback(encoder, buffer, &bytes_read, client_data)) {
+ case FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE:
+ bytes -= bytes_read;
+ buffer += bytes_read;
+ break;
+ case FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM:
+ if(bytes_read == 0) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ return false;
+ }
+ bytes -= bytes_read;
+ buffer += bytes_read;
+ break;
+ case FLAC__STREAM_ENCODER_READ_STATUS_ABORT:
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ case FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED:
+ return false;
+ default:
+ /* double protection: */
+ FLAC__ASSERT(0);
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ }
+ }
+
+ return true;
}
void simple_ogg_page__init(ogg_page *page)
{
- page->header = 0;
- page->header_len = 0;
- page->body = 0;
- page->body_len = 0;
+ page->header = 0;
+ page->header_len = 0;
+ page->body = 0;
+ page->body_len = 0;
}
void simple_ogg_page__clear(ogg_page *page)
{
- if(page->header)
- free(page->header);
- if(page->body)
- free(page->body);
- simple_ogg_page__init(page);
+ if(page->header)
+ free(page->header);
+ if(page->body)
+ free(page->body);
+ simple_ogg_page__init(page);
}
FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback read_callback, void *client_data)
{
- static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27;
- static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255;
- FLAC__byte crc[4];
- FLAC__StreamEncoderSeekStatus seek_status;
-
- FLAC__ASSERT(page->header == 0);
- FLAC__ASSERT(page->header_len == 0);
- FLAC__ASSERT(page->body == 0);
- FLAC__ASSERT(page->body_len == 0);
-
- /* move the stream pointer to the supposed beginning of the page */
- if(0 == seek_callback)
- return false;
- if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK)
- {
- if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- }
-
- /* allocate space for the page header */
- if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN)))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- /* read in the fixed part of the page header (up to but not including
- * the segment table */
- if(!full_read_(encoder, page->header, OGG_HEADER_FIXED_PORTION_LEN, read_callback, client_data))
- return false;
-
- page->header_len = OGG_HEADER_FIXED_PORTION_LEN + page->header[26];
-
- /* check to see if it's a correct, "simple" page (one packet only) */
- if(
- memcmp(page->header, "OggS", 4) || /* doesn't start with OggS */
- (page->header[5] & 0x01) || /* continued packet */
- memcmp(page->header + 6, "\0\0\0\0\0\0\0\0", 8) || /* granulepos is non-zero */
- page->header[26] == 0 /* packet is 0-size */
- )
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- return false;
- }
-
- /* read in the segment table */
- if(!full_read_(encoder, page->header + OGG_HEADER_FIXED_PORTION_LEN, page->header[26], read_callback, client_data))
- return false;
-
- {
- unsigned i;
-
- /* check to see that it specifies a single packet */
- for(i = 0; i < (unsigned)page->header[26] - 1; i++)
- {
- if(page->header[i + OGG_HEADER_FIXED_PORTION_LEN] != 255)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- return false;
- }
- }
-
- page->body_len = 255 * i + page->header[i + OGG_HEADER_FIXED_PORTION_LEN];
- }
-
- /* allocate space for the page body */
- if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len)))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- /* read in the page body */
- if(!full_read_(encoder, page->body, page->body_len, read_callback, client_data))
- return false;
-
- /* check the CRC */
- memcpy(crc, page->header + 22, 4);
- ogg_page_checksum_set(page);
- if(memcmp(crc, page->header + 22, 4))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- return false;
- }
-
- return true;
+ static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27;
+ static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255;
+ FLAC__byte crc[4];
+ FLAC__StreamEncoderSeekStatus seek_status;
+
+ FLAC__ASSERT(page->header == 0);
+ FLAC__ASSERT(page->header_len == 0);
+ FLAC__ASSERT(page->body == 0);
+ FLAC__ASSERT(page->body_len == 0);
+
+ /* move the stream pointer to the supposed beginning of the page */
+ if(0 == seek_callback)
+ return false;
+ if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
+ if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ }
+
+ /* allocate space for the page header */
+ if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ /* read in the fixed part of the page header (up to but not including
+ * the segment table */
+ if(!full_read_(encoder, page->header, OGG_HEADER_FIXED_PORTION_LEN, read_callback, client_data))
+ return false;
+
+ page->header_len = OGG_HEADER_FIXED_PORTION_LEN + page->header[26];
+
+ /* check to see if it's a correct, "simple" page (one packet only) */
+ if(
+ memcmp(page->header, "OggS", 4) || /* doesn't start with OggS */
+ (page->header[5] & 0x01) || /* continued packet */
+ memcmp(page->header+6, "\0\0\0\0\0\0\0\0", 8) || /* granulepos is non-zero */
+ page->header[26] == 0 /* packet is 0-size */
+ ) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ return false;
+ }
+
+ /* read in the segment table */
+ if(!full_read_(encoder, page->header + OGG_HEADER_FIXED_PORTION_LEN, page->header[26], read_callback, client_data))
+ return false;
+
+ {
+ unsigned i;
+
+ /* check to see that it specifies a single packet */
+ for(i = 0; i < (unsigned)page->header[26] - 1; i++) {
+ if(page->header[i + OGG_HEADER_FIXED_PORTION_LEN] != 255) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ return false;
+ }
+ }
+
+ page->body_len = 255 * i + page->header[i + OGG_HEADER_FIXED_PORTION_LEN];
+ }
+
+ /* allocate space for the page body */
+ if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ /* read in the page body */
+ if(!full_read_(encoder, page->body, page->body_len, read_callback, client_data))
+ return false;
+
+ /* check the CRC */
+ memcpy(crc, page->header+22, 4);
+ ogg_page_checksum_set(page);
+ if(memcmp(crc, page->header+22, 4)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ return false;
+ }
+
+ return true;
}
FLAC__bool simple_ogg_page__set_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderWriteCallback write_callback, void *client_data)
{
- FLAC__StreamEncoderSeekStatus seek_status;
-
- FLAC__ASSERT(page->header != 0);
- FLAC__ASSERT(page->header_len != 0);
- FLAC__ASSERT(page->body != 0);
- FLAC__ASSERT(page->body_len != 0);
-
- /* move the stream pointer to the supposed beginning of the page */
- if(0 == seek_callback)
- return false;
- if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK)
- {
- if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- }
-
- ogg_page_checksum_set(page);
-
- /* re-write the page */
- if(write_callback((FLAC__StreamEncoder*)encoder, page->header, page->header_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- }
- if(write_callback((FLAC__StreamEncoder*)encoder, page->body, page->body_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- }
-
- return true;
+ FLAC__StreamEncoderSeekStatus seek_status;
+
+ FLAC__ASSERT(page->header != 0);
+ FLAC__ASSERT(page->header_len != 0);
+ FLAC__ASSERT(page->body != 0);
+ FLAC__ASSERT(page->body_len != 0);
+
+ /* move the stream pointer to the supposed beginning of the page */
+ if(0 == seek_callback)
+ return false;
+ if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
+ if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ }
+
+ ogg_page_checksum_set(page);
+
+ /* re-write the page */
+ if(write_callback((FLAC__StreamEncoder*)encoder, page->header, page->header_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ }
+ if(write_callback((FLAC__StreamEncoder*)encoder, page->body, page->body_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ }
+
+ return true;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_decoder.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_decoder.c
index 8056bbc81..20d716f66 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_decoder.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_decoder.c
@@ -81,11 +81,11 @@
/* technically this should be in an "export.c" but this is convenient enough */
FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC =
#if FLAC__HAS_OGG
- 1
+ 1
#else
- 0
+ 0
#endif
- ;
+;
/***********************************************************************
@@ -147,62 +147,61 @@ static FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *c
*
***********************************************************************/
-typedef struct FLAC__StreamDecoderPrivate
-{
+typedef struct FLAC__StreamDecoderPrivate {
#if FLAC__HAS_OGG
- FLAC__bool is_ogg;
+ FLAC__bool is_ogg;
#endif
- FLAC__StreamDecoderReadCallback read_callback;
- FLAC__StreamDecoderSeekCallback seek_callback;
- FLAC__StreamDecoderTellCallback tell_callback;
- FLAC__StreamDecoderLengthCallback length_callback;
- FLAC__StreamDecoderEofCallback eof_callback;
- FLAC__StreamDecoderWriteCallback write_callback;
- FLAC__StreamDecoderMetadataCallback metadata_callback;
- FLAC__StreamDecoderErrorCallback error_callback;
- /* generic 32-bit datapath: */
- void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
- /* generic 64-bit datapath: */
- void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
- /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit): */
- void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
- /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit), AND order <= 8: */
- void (*local_lpc_restore_signal_16bit_order8)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
- FLAC__bool(*local_bitreader_read_rice_signed_block)(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
- void *client_data;
- FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */
- FLAC__BitReader *input;
- FLAC__int32 *output[FLAC__MAX_CHANNELS];
- FLAC__int32 *residual[FLAC__MAX_CHANNELS]; /* WATCHOUT: these are the aligned pointers; the real pointers that should be free()'d are residual_unaligned[] below */
- FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents[FLAC__MAX_CHANNELS];
- unsigned output_capacity, output_channels;
- FLAC__uint32 fixed_block_size, next_fixed_block_size;
- FLAC__uint64 samples_decoded;
- FLAC__bool has_stream_info, has_seek_table;
- FLAC__StreamMetadata stream_info;
- FLAC__StreamMetadata seek_table;
- FLAC__bool metadata_filter[128]; /* MAGIC number 128 == total number of metadata block types == 1 << 7 */
- FLAC__byte *metadata_filter_ids;
- size_t metadata_filter_ids_count, metadata_filter_ids_capacity; /* units for both are IDs, not bytes */
- FLAC__Frame frame;
- FLAC__bool cached; /* true if there is a byte in lookahead */
- FLAC__CPUInfo cpuinfo;
- FLAC__byte header_warmup[2]; /* contains the sync code and reserved bits */
- FLAC__byte lookahead; /* temp storage when we need to look ahead one byte in the stream */
- /* unaligned (original) pointers to allocated data */
- FLAC__int32 *residual_unaligned[FLAC__MAX_CHANNELS];
- FLAC__bool do_md5_checking; /* initially gets protected_->md5_checking but is turned off after a seek or if the metadata has a zero MD5 */
- FLAC__bool internal_reset_hack; /* used only during init() so we can call reset to set up the decoder without rewinding the input */
- FLAC__bool is_seeking;
- FLAC__MD5Context md5context;
- FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */
- /* (the rest of these are only used for seeking) */
- FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */
- FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */
- FLAC__uint64 target_sample;
- unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */
+ FLAC__StreamDecoderReadCallback read_callback;
+ FLAC__StreamDecoderSeekCallback seek_callback;
+ FLAC__StreamDecoderTellCallback tell_callback;
+ FLAC__StreamDecoderLengthCallback length_callback;
+ FLAC__StreamDecoderEofCallback eof_callback;
+ FLAC__StreamDecoderWriteCallback write_callback;
+ FLAC__StreamDecoderMetadataCallback metadata_callback;
+ FLAC__StreamDecoderErrorCallback error_callback;
+ /* generic 32-bit datapath: */
+ void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+ /* generic 64-bit datapath: */
+ void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+ /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit): */
+ void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+ /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit), AND order <= 8: */
+ void (*local_lpc_restore_signal_16bit_order8)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+ FLAC__bool (*local_bitreader_read_rice_signed_block)(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
+ void *client_data;
+ FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */
+ FLAC__BitReader *input;
+ FLAC__int32 *output[FLAC__MAX_CHANNELS];
+ FLAC__int32 *residual[FLAC__MAX_CHANNELS]; /* WATCHOUT: these are the aligned pointers; the real pointers that should be free()'d are residual_unaligned[] below */
+ FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents[FLAC__MAX_CHANNELS];
+ unsigned output_capacity, output_channels;
+ FLAC__uint32 fixed_block_size, next_fixed_block_size;
+ FLAC__uint64 samples_decoded;
+ FLAC__bool has_stream_info, has_seek_table;
+ FLAC__StreamMetadata stream_info;
+ FLAC__StreamMetadata seek_table;
+ FLAC__bool metadata_filter[128]; /* MAGIC number 128 == total number of metadata block types == 1 << 7 */
+ FLAC__byte *metadata_filter_ids;
+ size_t metadata_filter_ids_count, metadata_filter_ids_capacity; /* units for both are IDs, not bytes */
+ FLAC__Frame frame;
+ FLAC__bool cached; /* true if there is a byte in lookahead */
+ FLAC__CPUInfo cpuinfo;
+ FLAC__byte header_warmup[2]; /* contains the sync code and reserved bits */
+ FLAC__byte lookahead; /* temp storage when we need to look ahead one byte in the stream */
+ /* unaligned (original) pointers to allocated data */
+ FLAC__int32 *residual_unaligned[FLAC__MAX_CHANNELS];
+ FLAC__bool do_md5_checking; /* initially gets protected_->md5_checking but is turned off after a seek or if the metadata has a zero MD5 */
+ FLAC__bool internal_reset_hack; /* used only during init() so we can call reset to set up the decoder without rewinding the input */
+ FLAC__bool is_seeking;
+ FLAC__MD5Context md5context;
+ FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */
+ /* (the rest of these are only used for seeking) */
+ FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */
+ FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */
+ FLAC__uint64 target_sample;
+ unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */
#if FLAC__HAS_OGG
- FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */
+ FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */
#endif
} FLAC__StreamDecoderPrivate;
@@ -212,70 +211,62 @@ typedef struct FLAC__StreamDecoderPrivate
*
***********************************************************************/
-FLAC_API const char * const FLAC__StreamDecoderStateString[] =
-{
- "FLAC__STREAM_DECODER_SEARCH_FOR_METADATA",
- "FLAC__STREAM_DECODER_READ_METADATA",
- "FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC",
- "FLAC__STREAM_DECODER_READ_FRAME",
- "FLAC__STREAM_DECODER_END_OF_STREAM",
- "FLAC__STREAM_DECODER_OGG_ERROR",
- "FLAC__STREAM_DECODER_SEEK_ERROR",
- "FLAC__STREAM_DECODER_ABORTED",
- "FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR",
- "FLAC__STREAM_DECODER_UNINITIALIZED"
+FLAC_API const char * const FLAC__StreamDecoderStateString[] = {
+ "FLAC__STREAM_DECODER_SEARCH_FOR_METADATA",
+ "FLAC__STREAM_DECODER_READ_METADATA",
+ "FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC",
+ "FLAC__STREAM_DECODER_READ_FRAME",
+ "FLAC__STREAM_DECODER_END_OF_STREAM",
+ "FLAC__STREAM_DECODER_OGG_ERROR",
+ "FLAC__STREAM_DECODER_SEEK_ERROR",
+ "FLAC__STREAM_DECODER_ABORTED",
+ "FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR",
+ "FLAC__STREAM_DECODER_UNINITIALIZED"
};
-FLAC_API const char * const FLAC__StreamDecoderInitStatusString[] =
-{
- "FLAC__STREAM_DECODER_INIT_STATUS_OK",
- "FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER",
- "FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS",
- "FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR",
- "FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE",
- "FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED"
+FLAC_API const char * const FLAC__StreamDecoderInitStatusString[] = {
+ "FLAC__STREAM_DECODER_INIT_STATUS_OK",
+ "FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER",
+ "FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS",
+ "FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR",
+ "FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE",
+ "FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED"
};
-FLAC_API const char * const FLAC__StreamDecoderReadStatusString[] =
-{
- "FLAC__STREAM_DECODER_READ_STATUS_CONTINUE",
- "FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM",
- "FLAC__STREAM_DECODER_READ_STATUS_ABORT"
+FLAC_API const char * const FLAC__StreamDecoderReadStatusString[] = {
+ "FLAC__STREAM_DECODER_READ_STATUS_CONTINUE",
+ "FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM",
+ "FLAC__STREAM_DECODER_READ_STATUS_ABORT"
};
-FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[] =
-{
- "FLAC__STREAM_DECODER_SEEK_STATUS_OK",
- "FLAC__STREAM_DECODER_SEEK_STATUS_ERROR",
- "FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED"
+FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[] = {
+ "FLAC__STREAM_DECODER_SEEK_STATUS_OK",
+ "FLAC__STREAM_DECODER_SEEK_STATUS_ERROR",
+ "FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED"
};
-FLAC_API const char * const FLAC__StreamDecoderTellStatusString[] =
-{
- "FLAC__STREAM_DECODER_TELL_STATUS_OK",
- "FLAC__STREAM_DECODER_TELL_STATUS_ERROR",
- "FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED"
+FLAC_API const char * const FLAC__StreamDecoderTellStatusString[] = {
+ "FLAC__STREAM_DECODER_TELL_STATUS_OK",
+ "FLAC__STREAM_DECODER_TELL_STATUS_ERROR",
+ "FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED"
};
-FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[] =
-{
- "FLAC__STREAM_DECODER_LENGTH_STATUS_OK",
- "FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR",
- "FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED"
+FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[] = {
+ "FLAC__STREAM_DECODER_LENGTH_STATUS_OK",
+ "FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR",
+ "FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED"
};
-FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[] =
-{
- "FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE",
- "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT"
+FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[] = {
+ "FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE",
+ "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT"
};
-FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] =
-{
- "FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC",
- "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER",
- "FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH",
- "FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM"
+FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = {
+ "FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC",
+ "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER",
+ "FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH",
+ "FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM"
};
/***********************************************************************
@@ -285,95 +276,89 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] =
***********************************************************************/
FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
{
- FLAC__StreamDecoder *decoder;
- unsigned i;
-
- FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
-
- decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder));
- if(decoder == 0)
- {
- return 0;
- }
-
- decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected));
- if(decoder->protected_ == 0)
- {
- free(decoder);
- return 0;
- }
-
- decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate));
- if(decoder->private_ == 0)
- {
- free(decoder->protected_);
- free(decoder);
- return 0;
- }
-
- decoder->private_->input = FLAC__bitreader_new();
- if(decoder->private_->input == 0)
- {
- free(decoder->private_);
- free(decoder->protected_);
- free(decoder);
- return 0;
- }
-
- decoder->private_->metadata_filter_ids_capacity = 16;
- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) * decoder->private_->metadata_filter_ids_capacity)))
- {
- FLAC__bitreader_delete(decoder->private_->input);
- free(decoder->private_);
- free(decoder->protected_);
- free(decoder);
- return 0;
- }
-
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- decoder->private_->output[i] = 0;
- decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0;
- }
-
- decoder->private_->output_capacity = 0;
- decoder->private_->output_channels = 0;
- decoder->private_->has_seek_table = false;
-
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&decoder->private_->partitioned_rice_contents[i]);
-
- decoder->private_->file = 0;
-
- set_defaults_(decoder);
-
- decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
-
- return decoder;
+ FLAC__StreamDecoder *decoder;
+ unsigned i;
+
+ FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
+
+ decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder));
+ if(decoder == 0) {
+ return 0;
+ }
+
+ decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected));
+ if(decoder->protected_ == 0) {
+ free(decoder);
+ return 0;
+ }
+
+ decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate));
+ if(decoder->private_ == 0) {
+ free(decoder->protected_);
+ free(decoder);
+ return 0;
+ }
+
+ decoder->private_->input = FLAC__bitreader_new();
+ if(decoder->private_->input == 0) {
+ free(decoder->private_);
+ free(decoder->protected_);
+ free(decoder);
+ return 0;
+ }
+
+ decoder->private_->metadata_filter_ids_capacity = 16;
+ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
+ FLAC__bitreader_delete(decoder->private_->input);
+ free(decoder->private_);
+ free(decoder->protected_);
+ free(decoder);
+ return 0;
+ }
+
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ decoder->private_->output[i] = 0;
+ decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0;
+ }
+
+ decoder->private_->output_capacity = 0;
+ decoder->private_->output_channels = 0;
+ decoder->private_->has_seek_table = false;
+
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++)
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&decoder->private_->partitioned_rice_contents[i]);
+
+ decoder->private_->file = 0;
+
+ set_defaults_(decoder);
+
+ decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
+
+ return decoder;
}
FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
{
- unsigned i;
+ unsigned i;
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->private_->input);
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->private_->input);
- (void)FLAC__stream_decoder_finish(decoder);
+ (void)FLAC__stream_decoder_finish(decoder);
- if(0 != decoder->private_->metadata_filter_ids)
- free(decoder->private_->metadata_filter_ids);
+ if(0 != decoder->private_->metadata_filter_ids)
+ free(decoder->private_->metadata_filter_ids);
- FLAC__bitreader_delete(decoder->private_->input);
+ FLAC__bitreader_delete(decoder->private_->input);
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&decoder->private_->partitioned_rice_contents[i]);
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++)
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&decoder->private_->partitioned_rice_contents[i]);
- free(decoder->private_);
- free(decoder->protected_);
- free(decoder);
+ free(decoder->private_);
+ free(decoder->protected_);
+ free(decoder);
}
/***********************************************************************
@@ -383,899 +368,867 @@ FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
***********************************************************************/
static FLAC__StreamDecoderInitStatus init_stream_internal_(
- FLAC__StreamDecoder *decoder,
- FLAC__StreamDecoderReadCallback read_callback,
- FLAC__StreamDecoderSeekCallback seek_callback,
- FLAC__StreamDecoderTellCallback tell_callback,
- FLAC__StreamDecoderLengthCallback length_callback,
- FLAC__StreamDecoderEofCallback eof_callback,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data,
- FLAC__bool is_ogg
+ FLAC__StreamDecoder *decoder,
+ FLAC__StreamDecoderReadCallback read_callback,
+ FLAC__StreamDecoderSeekCallback seek_callback,
+ FLAC__StreamDecoderTellCallback tell_callback,
+ FLAC__StreamDecoderLengthCallback length_callback,
+ FLAC__StreamDecoderEofCallback eof_callback,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data,
+ FLAC__bool is_ogg
)
{
- FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
#if !FLAC__HAS_OGG
- if(is_ogg)
- return FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER;
+ if(is_ogg)
+ return FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER;
#endif
- if(
- 0 == read_callback ||
- 0 == write_callback ||
- 0 == error_callback ||
- (seek_callback && (0 == tell_callback || 0 == length_callback || 0 == eof_callback))
- )
- return FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
+ if(
+ 0 == read_callback ||
+ 0 == write_callback ||
+ 0 == error_callback ||
+ (seek_callback && (0 == tell_callback || 0 == length_callback || 0 == eof_callback))
+ )
+ return FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
#if FLAC__HAS_OGG
- decoder->private_->is_ogg = is_ogg;
- if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect))
- return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR;
+ decoder->private_->is_ogg = is_ogg;
+ if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect))
+ return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR;
#endif
- /*
- * get the CPU info and set the function pointers
- */
- FLAC__cpu_info(&decoder->private_->cpuinfo);
- /* first default to the non-asm routines */
- decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal;
- decoder->private_->local_lpc_restore_signal_64bit = FLAC__lpc_restore_signal_wide;
- decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal;
- decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal;
- decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block;
- /* now override with asm where appropriate */
+ /*
+ * get the CPU info and set the function pointers
+ */
+ FLAC__cpu_info(&decoder->private_->cpuinfo);
+ /* first default to the non-asm routines */
+ decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal;
+ decoder->private_->local_lpc_restore_signal_64bit = FLAC__lpc_restore_signal_wide;
+ decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal;
+ decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal;
+ decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block;
+ /* now override with asm where appropriate */
#ifndef FLAC__NO_ASM
- if(decoder->private_->cpuinfo.use_asm)
- {
+ if(decoder->private_->cpuinfo.use_asm) {
#ifdef FLAC__CPU_IA32
- FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
+ FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
#ifdef FLAC__HAS_NASM
#if 1 /*@@@@@@ OPT: not clearly faster, needs more testing */
- if(decoder->private_->cpuinfo.data.ia32.bswap)
- decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap;
+ if(decoder->private_->cpuinfo.data.ia32.bswap)
+ decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap;
#endif
- if(decoder->private_->cpuinfo.data.ia32.mmx)
- {
- decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32;
- decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32_mmx;
- decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32_mmx;
- }
- else
- {
- decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32;
- decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32;
- decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32;
- }
+ if(decoder->private_->cpuinfo.data.ia32.mmx) {
+ decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32;
+ decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32_mmx;
+ decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32_mmx;
+ }
+ else {
+ decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32;
+ decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32;
+ decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32;
+ }
#endif
#elif defined FLAC__CPU_PPC
- FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_PPC);
- if(decoder->private_->cpuinfo.data.ppc.altivec)
- {
- decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ppc_altivec_16;
- decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8;
- }
+ FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_PPC);
+ if(decoder->private_->cpuinfo.data.ppc.altivec) {
+ decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ppc_altivec_16;
+ decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8;
+ }
#endif
- }
+ }
#endif
- /* from here on, errors are fatal */
-
- if(!FLAC__bitreader_init(decoder->private_->input, decoder->private_->cpuinfo, read_callback_, decoder))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR;
- }
-
- decoder->private_->read_callback = read_callback;
- decoder->private_->seek_callback = seek_callback;
- decoder->private_->tell_callback = tell_callback;
- decoder->private_->length_callback = length_callback;
- decoder->private_->eof_callback = eof_callback;
- decoder->private_->write_callback = write_callback;
- decoder->private_->metadata_callback = metadata_callback;
- decoder->private_->error_callback = error_callback;
- decoder->private_->client_data = client_data;
- decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size = 0;
- decoder->private_->samples_decoded = 0;
- decoder->private_->has_stream_info = false;
- decoder->private_->cached = false;
-
- decoder->private_->do_md5_checking = decoder->protected_->md5_checking;
- decoder->private_->is_seeking = false;
-
- decoder->private_->internal_reset_hack = true; /* so the following reset does not try to rewind the input */
- if(!FLAC__stream_decoder_reset(decoder))
- {
- /* above call sets the state for us */
- return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR;
- }
-
- return FLAC__STREAM_DECODER_INIT_STATUS_OK;
+ /* from here on, errors are fatal */
+
+ if(!FLAC__bitreader_init(decoder->private_->input, decoder->private_->cpuinfo, read_callback_, decoder)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR;
+ }
+
+ decoder->private_->read_callback = read_callback;
+ decoder->private_->seek_callback = seek_callback;
+ decoder->private_->tell_callback = tell_callback;
+ decoder->private_->length_callback = length_callback;
+ decoder->private_->eof_callback = eof_callback;
+ decoder->private_->write_callback = write_callback;
+ decoder->private_->metadata_callback = metadata_callback;
+ decoder->private_->error_callback = error_callback;
+ decoder->private_->client_data = client_data;
+ decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size = 0;
+ decoder->private_->samples_decoded = 0;
+ decoder->private_->has_stream_info = false;
+ decoder->private_->cached = false;
+
+ decoder->private_->do_md5_checking = decoder->protected_->md5_checking;
+ decoder->private_->is_seeking = false;
+
+ decoder->private_->internal_reset_hack = true; /* so the following reset does not try to rewind the input */
+ if(!FLAC__stream_decoder_reset(decoder)) {
+ /* above call sets the state for us */
+ return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR;
+ }
+
+ return FLAC__STREAM_DECODER_INIT_STATUS_OK;
}
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
- FLAC__StreamDecoder *decoder,
- FLAC__StreamDecoderReadCallback read_callback,
- FLAC__StreamDecoderSeekCallback seek_callback,
- FLAC__StreamDecoderTellCallback tell_callback,
- FLAC__StreamDecoderLengthCallback length_callback,
- FLAC__StreamDecoderEofCallback eof_callback,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
+ FLAC__StreamDecoder *decoder,
+ FLAC__StreamDecoderReadCallback read_callback,
+ FLAC__StreamDecoderSeekCallback seek_callback,
+ FLAC__StreamDecoderTellCallback tell_callback,
+ FLAC__StreamDecoderLengthCallback length_callback,
+ FLAC__StreamDecoderEofCallback eof_callback,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
)
{
- return init_stream_internal_(
- decoder,
- read_callback,
- seek_callback,
- tell_callback,
- length_callback,
- eof_callback,
- write_callback,
- metadata_callback,
- error_callback,
- client_data,
- /*is_ogg=*/false
- );
+ return init_stream_internal_(
+ decoder,
+ read_callback,
+ seek_callback,
+ tell_callback,
+ length_callback,
+ eof_callback,
+ write_callback,
+ metadata_callback,
+ error_callback,
+ client_data,
+ /*is_ogg=*/false
+ );
}
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
- FLAC__StreamDecoder *decoder,
- FLAC__StreamDecoderReadCallback read_callback,
- FLAC__StreamDecoderSeekCallback seek_callback,
- FLAC__StreamDecoderTellCallback tell_callback,
- FLAC__StreamDecoderLengthCallback length_callback,
- FLAC__StreamDecoderEofCallback eof_callback,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
+ FLAC__StreamDecoder *decoder,
+ FLAC__StreamDecoderReadCallback read_callback,
+ FLAC__StreamDecoderSeekCallback seek_callback,
+ FLAC__StreamDecoderTellCallback tell_callback,
+ FLAC__StreamDecoderLengthCallback length_callback,
+ FLAC__StreamDecoderEofCallback eof_callback,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
)
{
- return init_stream_internal_(
- decoder,
- read_callback,
- seek_callback,
- tell_callback,
- length_callback,
- eof_callback,
- write_callback,
- metadata_callback,
- error_callback,
- client_data,
- /*is_ogg=*/true
- );
+ return init_stream_internal_(
+ decoder,
+ read_callback,
+ seek_callback,
+ tell_callback,
+ length_callback,
+ eof_callback,
+ write_callback,
+ metadata_callback,
+ error_callback,
+ client_data,
+ /*is_ogg=*/true
+ );
}
static FLAC__StreamDecoderInitStatus init_FILE_internal_(
- FLAC__StreamDecoder *decoder,
- FILE *file,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data,
- FLAC__bool is_ogg
+ FLAC__StreamDecoder *decoder,
+ FILE *file,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data,
+ FLAC__bool is_ogg
)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != file);
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != file);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
- if(0 == write_callback || 0 == error_callback)
- return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
+ if(0 == write_callback || 0 == error_callback)
+ return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
- /*
- * To make sure that our file does not go unclosed after an error, we
- * must assign the FILE pointer before any further error can occur in
- * this routine.
- */
- if(file == stdin)
- file = get_binary_stdin_(); /* just to be safe */
+ /*
+ * To make sure that our file does not go unclosed after an error, we
+ * must assign the FILE pointer before any further error can occur in
+ * this routine.
+ */
+ if(file == stdin)
+ file = get_binary_stdin_(); /* just to be safe */
- decoder->private_->file = file;
+ decoder->private_->file = file;
- return init_stream_internal_(
- decoder,
- file_read_callback_,
- decoder->private_->file == stdin ? 0 : file_seek_callback_,
- decoder->private_->file == stdin ? 0 : file_tell_callback_,
- decoder->private_->file == stdin ? 0 : file_length_callback_,
- file_eof_callback_,
- write_callback,
- metadata_callback,
- error_callback,
- client_data,
- is_ogg
- );
+ return init_stream_internal_(
+ decoder,
+ file_read_callback_,
+ decoder->private_->file == stdin? 0: file_seek_callback_,
+ decoder->private_->file == stdin? 0: file_tell_callback_,
+ decoder->private_->file == stdin? 0: file_length_callback_,
+ file_eof_callback_,
+ write_callback,
+ metadata_callback,
+ error_callback,
+ client_data,
+ is_ogg
+ );
}
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
- FLAC__StreamDecoder *decoder,
- FILE *file,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
+ FLAC__StreamDecoder *decoder,
+ FILE *file,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
)
{
- return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false);
+ return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false);
}
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
- FLAC__StreamDecoder *decoder,
- FILE *file,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
+ FLAC__StreamDecoder *decoder,
+ FILE *file,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
)
{
- return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/true);
+ return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/true);
}
static FLAC__StreamDecoderInitStatus init_file_internal_(
- FLAC__StreamDecoder *decoder,
- const char *filename,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data,
- FLAC__bool is_ogg
+ FLAC__StreamDecoder *decoder,
+ const char *filename,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data,
+ FLAC__bool is_ogg
)
{
- FILE *file;
+ FILE *file;
- FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder);
- /*
- * To make sure that our file does not go unclosed after an error, we
- * have to do the same entrance checks here that are later performed
- * in FLAC__stream_decoder_init_FILE() before the FILE* is assigned.
- */
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
+ /*
+ * To make sure that our file does not go unclosed after an error, we
+ * have to do the same entrance checks here that are later performed
+ * in FLAC__stream_decoder_init_FILE() before the FILE* is assigned.
+ */
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
- if(0 == write_callback || 0 == error_callback)
- return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
+ if(0 == write_callback || 0 == error_callback)
+ return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
- file = filename ? fopen(filename, "rb") : stdin;
+ file = filename? fopen(filename, "rb") : stdin;
- if(0 == file)
- return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE;
+ if(0 == file)
+ return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE;
- return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, is_ogg);
+ return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, is_ogg);
}
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
- FLAC__StreamDecoder *decoder,
- const char *filename,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
+ FLAC__StreamDecoder *decoder,
+ const char *filename,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
)
{
- return init_file_internal_(decoder, filename, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false);
+ return init_file_internal_(decoder, filename, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false);
}
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
- FLAC__StreamDecoder *decoder,
- const char *filename,
- FLAC__StreamDecoderWriteCallback write_callback,
- FLAC__StreamDecoderMetadataCallback metadata_callback,
- FLAC__StreamDecoderErrorCallback error_callback,
- void *client_data
+ FLAC__StreamDecoder *decoder,
+ const char *filename,
+ FLAC__StreamDecoderWriteCallback write_callback,
+ FLAC__StreamDecoderMetadataCallback metadata_callback,
+ FLAC__StreamDecoderErrorCallback error_callback,
+ void *client_data
)
{
- return init_file_internal_(decoder, filename, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/true);
+ return init_file_internal_(decoder, filename, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/true);
}
FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
{
- FLAC__bool md5_failed = false;
- unsigned i;
-
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
-
- if(decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED)
- return true;
-
- /* see the comment in FLAC__seekable_stream_decoder_reset() as to why we
- * always call FLAC__MD5Final()
- */
- FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context);
-
- if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points)
- {
- free(decoder->private_->seek_table.data.seek_table.points);
- decoder->private_->seek_table.data.seek_table.points = 0;
- decoder->private_->has_seek_table = false;
- }
- FLAC__bitreader_free(decoder->private_->input);
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- /* WATCHOUT:
- * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the
- * output arrays have a buffer of up to 3 zeroes in front
- * (at negative indices) for alignment purposes; we use 4
- * to keep the data well-aligned.
- */
- if(0 != decoder->private_->output[i])
- {
- free(decoder->private_->output[i] - 4);
- decoder->private_->output[i] = 0;
- }
- if(0 != decoder->private_->residual_unaligned[i])
- {
- free(decoder->private_->residual_unaligned[i]);
- decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0;
- }
- }
- decoder->private_->output_capacity = 0;
- decoder->private_->output_channels = 0;
+ FLAC__bool md5_failed = false;
+ unsigned i;
+
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+
+ if(decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED)
+ return true;
+
+ /* see the comment in FLAC__seekable_stream_decoder_reset() as to why we
+ * always call FLAC__MD5Final()
+ */
+ FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context);
+
+ if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points) {
+ free(decoder->private_->seek_table.data.seek_table.points);
+ decoder->private_->seek_table.data.seek_table.points = 0;
+ decoder->private_->has_seek_table = false;
+ }
+ FLAC__bitreader_free(decoder->private_->input);
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ /* WATCHOUT:
+ * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the
+ * output arrays have a buffer of up to 3 zeroes in front
+ * (at negative indices) for alignment purposes; we use 4
+ * to keep the data well-aligned.
+ */
+ if(0 != decoder->private_->output[i]) {
+ free(decoder->private_->output[i]-4);
+ decoder->private_->output[i] = 0;
+ }
+ if(0 != decoder->private_->residual_unaligned[i]) {
+ free(decoder->private_->residual_unaligned[i]);
+ decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0;
+ }
+ }
+ decoder->private_->output_capacity = 0;
+ decoder->private_->output_channels = 0;
#if FLAC__HAS_OGG
- if(decoder->private_->is_ogg)
- FLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect);
+ if(decoder->private_->is_ogg)
+ FLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect);
#endif
- if(0 != decoder->private_->file)
- {
- if(decoder->private_->file != stdin)
- fclose(decoder->private_->file);
- decoder->private_->file = 0;
- }
+ if(0 != decoder->private_->file) {
+ if(decoder->private_->file != stdin)
+ fclose(decoder->private_->file);
+ decoder->private_->file = 0;
+ }
- if(decoder->private_->do_md5_checking)
- {
- if(memcmp(decoder->private_->stream_info.data.stream_info.md5sum, decoder->private_->computed_md5sum, 16))
- md5_failed = true;
- }
- decoder->private_->is_seeking = false;
+ if(decoder->private_->do_md5_checking) {
+ if(memcmp(decoder->private_->stream_info.data.stream_info.md5sum, decoder->private_->computed_md5sum, 16))
+ md5_failed = true;
+ }
+ decoder->private_->is_seeking = false;
- set_defaults_(decoder);
+ set_defaults_(decoder);
- decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
+ decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
- return !md5_failed;
+ return !md5_failed;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long value)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
#if FLAC__HAS_OGG
- /* can't check decoder->private_->is_ogg since that's not set until init time */
- FLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value);
- return true;
+ /* can't check decoder->private_->is_ogg since that's not set until init time */
+ FLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value);
+ return true;
#else
- (void)value;
- return false;
+ (void)value;
+ return false;
#endif
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
- decoder->protected_->md5_checking = value;
- return true;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
+ decoder->protected_->md5_checking = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
- /* double protection */
- if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
- return false;
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
- decoder->private_->metadata_filter[type] = true;
- if(type == FLAC__METADATA_TYPE_APPLICATION)
- decoder->private_->metadata_filter_ids_count = 0;
- return true;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
+ /* double protection */
+ if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
+ return false;
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
+ decoder->private_->metadata_filter[type] = true;
+ if(type == FLAC__METADATA_TYPE_APPLICATION)
+ decoder->private_->metadata_filter_ids_count = 0;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4])
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- FLAC__ASSERT(0 != id);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT(0 != id);
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
- if(decoder->private_->metadata_filter[FLAC__METADATA_TYPE_APPLICATION])
- return true;
+ if(decoder->private_->metadata_filter[FLAC__METADATA_TYPE_APPLICATION])
+ return true;
- FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids);
+ FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids);
- if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity)
- {
- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- decoder->private_->metadata_filter_ids_capacity *= 2;
- }
+ if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) {
+ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ decoder->private_->metadata_filter_ids_capacity *= 2;
+ }
- memcpy(decoder->private_->metadata_filter_ids + decoder->private_->metadata_filter_ids_count *(FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8));
- decoder->private_->metadata_filter_ids_count++;
+ memcpy(decoder->private_->metadata_filter_ids + decoder->private_->metadata_filter_ids_count * (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8));
+ decoder->private_->metadata_filter_ids_count++;
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder)
{
- unsigned i;
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
- for(i = 0; i < sizeof(decoder->private_->metadata_filter) / sizeof(decoder->private_->metadata_filter[0]); i++)
- decoder->private_->metadata_filter[i] = true;
- decoder->private_->metadata_filter_ids_count = 0;
- return true;
+ unsigned i;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
+ for(i = 0; i < sizeof(decoder->private_->metadata_filter) / sizeof(decoder->private_->metadata_filter[0]); i++)
+ decoder->private_->metadata_filter[i] = true;
+ decoder->private_->metadata_filter_ids_count = 0;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
- /* double protection */
- if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
- return false;
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
- decoder->private_->metadata_filter[type] = false;
- if(type == FLAC__METADATA_TYPE_APPLICATION)
- decoder->private_->metadata_filter_ids_count = 0;
- return true;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
+ /* double protection */
+ if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
+ return false;
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
+ decoder->private_->metadata_filter[type] = false;
+ if(type == FLAC__METADATA_TYPE_APPLICATION)
+ decoder->private_->metadata_filter_ids_count = 0;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4])
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- FLAC__ASSERT(0 != id);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT(0 != id);
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
- if(!decoder->private_->metadata_filter[FLAC__METADATA_TYPE_APPLICATION])
- return true;
+ if(!decoder->private_->metadata_filter[FLAC__METADATA_TYPE_APPLICATION])
+ return true;
- FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids);
+ FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids);
- if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity)
- {
- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- decoder->private_->metadata_filter_ids_capacity *= 2;
- }
+ if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) {
+ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ decoder->private_->metadata_filter_ids_capacity *= 2;
+ }
- memcpy(decoder->private_->metadata_filter_ids + decoder->private_->metadata_filter_ids_count *(FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8));
- decoder->private_->metadata_filter_ids_count++;
+ memcpy(decoder->private_->metadata_filter_ids + decoder->private_->metadata_filter_ids_count * (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8));
+ decoder->private_->metadata_filter_ids_count++;
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
- if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
- return false;
- memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter));
- decoder->private_->metadata_filter_ids_count = 0;
- return true;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
+ return false;
+ memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter));
+ decoder->private_->metadata_filter_ids_count = 0;
+ return true;
}
FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->state;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->state;
}
FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder)
{
- return FLAC__StreamDecoderStateString[decoder->protected_->state];
+ return FLAC__StreamDecoderStateString[decoder->protected_->state];
}
FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->md5_checking;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->md5_checking;
}
FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->private_->has_stream_info ? decoder->private_->stream_info.data.stream_info.total_samples : 0;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->private_->has_stream_info? decoder->private_->stream_info.data.stream_info.total_samples : 0;
}
FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->channels;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->channels;
}
FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->channel_assignment;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->channel_assignment;
}
FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->bits_per_sample;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->bits_per_sample;
}
FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->sample_rate;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->sample_rate;
}
FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
- return decoder->protected_->blocksize;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+ return decoder->protected_->blocksize;
}
FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != position);
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != position);
#if FLAC__HAS_OGG
- if(decoder->private_->is_ogg)
- return false;
+ if(decoder->private_->is_ogg)
+ return false;
#endif
- if(0 == decoder->private_->tell_callback)
- return false;
- if(decoder->private_->tell_callback(decoder, position, decoder->private_->client_data) != FLAC__STREAM_DECODER_TELL_STATUS_OK)
- return false;
- /* should never happen since all FLAC frames and metadata blocks are byte aligned, but check just in case */
- if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input))
- return false;
- FLAC__ASSERT(*position >= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder));
- *position -= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder);
- return true;
+ if(0 == decoder->private_->tell_callback)
+ return false;
+ if(decoder->private_->tell_callback(decoder, position, decoder->private_->client_data) != FLAC__STREAM_DECODER_TELL_STATUS_OK)
+ return false;
+ /* should never happen since all FLAC frames and metadata blocks are byte aligned, but check just in case */
+ if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input))
+ return false;
+ FLAC__ASSERT(*position >= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder));
+ *position -= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder);
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
- decoder->private_->samples_decoded = 0;
- decoder->private_->do_md5_checking = false;
+ decoder->private_->samples_decoded = 0;
+ decoder->private_->do_md5_checking = false;
#if FLAC__HAS_OGG
- if(decoder->private_->is_ogg)
- FLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect);
+ if(decoder->private_->is_ogg)
+ FLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect);
#endif
- if(!FLAC__bitreader_clear(decoder->private_->input))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ if(!FLAC__bitreader_clear(decoder->private_->input)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
- FLAC__ASSERT(0 != decoder->protected_);
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder->protected_);
- if(!FLAC__stream_decoder_flush(decoder))
- {
- /* above call sets the state for us */
- return false;
- }
+ if(!FLAC__stream_decoder_flush(decoder)) {
+ /* above call sets the state for us */
+ return false;
+ }
#if FLAC__HAS_OGG
- /*@@@ could go in !internal_reset_hack block below */
- if(decoder->private_->is_ogg)
- FLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect);
+ /*@@@ could go in !internal_reset_hack block below */
+ if(decoder->private_->is_ogg)
+ FLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect);
#endif
- /* Rewind if necessary. If FLAC__stream_decoder_init() is calling us,
- * (internal_reset_hack) don't try to rewind since we are already at
- * the beginning of the stream and don't want to fail if the input is
- * not seekable.
- */
- if(!decoder->private_->internal_reset_hack)
- {
- if(decoder->private_->file == stdin)
- return false; /* can't rewind stdin, reset fails */
- if(decoder->private_->seek_callback && decoder->private_->seek_callback(decoder, 0, decoder->private_->client_data) == FLAC__STREAM_DECODER_SEEK_STATUS_ERROR)
- return false; /* seekable and seek fails, reset fails */
- }
- else
- decoder->private_->internal_reset_hack = false;
-
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
-
- decoder->private_->has_stream_info = false;
- if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points)
- {
- free(decoder->private_->seek_table.data.seek_table.points);
- decoder->private_->seek_table.data.seek_table.points = 0;
- decoder->private_->has_seek_table = false;
- }
- decoder->private_->do_md5_checking = decoder->protected_->md5_checking;
- /*
- * This goes in reset() and not flush() because according to the spec, a
- * fixed-blocksize stream must stay that way through the whole stream.
- */
- decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size = 0;
-
- /* We initialize the FLAC__MD5Context even though we may never use it. This
- * is because md5 checking may be turned on to start and then turned off if
- * a seek occurs. So we init the context here and finalize it in
- * FLAC__stream_decoder_finish() to make sure things are always cleaned up
- * properly.
- */
- FLAC__MD5Init(&decoder->private_->md5context);
-
- decoder->private_->first_frame_offset = 0;
- decoder->private_->unparseable_frame_count = 0;
-
- return true;
+ /* Rewind if necessary. If FLAC__stream_decoder_init() is calling us,
+ * (internal_reset_hack) don't try to rewind since we are already at
+ * the beginning of the stream and don't want to fail if the input is
+ * not seekable.
+ */
+ if(!decoder->private_->internal_reset_hack) {
+ if(decoder->private_->file == stdin)
+ return false; /* can't rewind stdin, reset fails */
+ if(decoder->private_->seek_callback && decoder->private_->seek_callback(decoder, 0, decoder->private_->client_data) == FLAC__STREAM_DECODER_SEEK_STATUS_ERROR)
+ return false; /* seekable and seek fails, reset fails */
+ }
+ else
+ decoder->private_->internal_reset_hack = false;
+
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
+
+ decoder->private_->has_stream_info = false;
+ if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points) {
+ free(decoder->private_->seek_table.data.seek_table.points);
+ decoder->private_->seek_table.data.seek_table.points = 0;
+ decoder->private_->has_seek_table = false;
+ }
+ decoder->private_->do_md5_checking = decoder->protected_->md5_checking;
+ /*
+ * This goes in reset() and not flush() because according to the spec, a
+ * fixed-blocksize stream must stay that way through the whole stream.
+ */
+ decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size = 0;
+
+ /* We initialize the FLAC__MD5Context even though we may never use it. This
+ * is because md5 checking may be turned on to start and then turned off if
+ * a seek occurs. So we init the context here and finalize it in
+ * FLAC__stream_decoder_finish() to make sure things are always cleaned up
+ * properly.
+ */
+ FLAC__MD5Init(&decoder->private_->md5context);
+
+ decoder->private_->first_frame_offset = 0;
+ decoder->private_->unparseable_frame_count = 0;
+
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder)
{
- FLAC__bool got_a_frame;
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
-
- while(1)
- {
- switch(decoder->protected_->state)
- {
- case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
- if(!find_metadata_(decoder))
- return false; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_READ_METADATA:
- if(!read_metadata_(decoder))
- return false; /* above function sets the status for us */
- else
- return true;
- case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
- if(!frame_sync_(decoder))
- return true; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_READ_FRAME:
- if(!read_frame_(decoder, &got_a_frame, /*do_full_decode=*/true))
- return false; /* above function sets the status for us */
- if(got_a_frame)
- return true; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_END_OF_STREAM:
- case FLAC__STREAM_DECODER_ABORTED:
- return true;
- default:
- FLAC__ASSERT(0);
- return false;
- }
- }
+ FLAC__bool got_a_frame;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+
+ while(1) {
+ switch(decoder->protected_->state) {
+ case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
+ if(!find_metadata_(decoder))
+ return false; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_READ_METADATA:
+ if(!read_metadata_(decoder))
+ return false; /* above function sets the status for us */
+ else
+ return true;
+ case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
+ if(!frame_sync_(decoder))
+ return true; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_READ_FRAME:
+ if(!read_frame_(decoder, &got_a_frame, /*do_full_decode=*/true))
+ return false; /* above function sets the status for us */
+ if(got_a_frame)
+ return true; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_END_OF_STREAM:
+ case FLAC__STREAM_DECODER_ABORTED:
+ return true;
+ default:
+ FLAC__ASSERT(0);
+ return false;
+ }
+ }
}
FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
-
- while(1)
- {
- switch(decoder->protected_->state)
- {
- case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
- if(!find_metadata_(decoder))
- return false; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_READ_METADATA:
- if(!read_metadata_(decoder))
- return false; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
- case FLAC__STREAM_DECODER_READ_FRAME:
- case FLAC__STREAM_DECODER_END_OF_STREAM:
- case FLAC__STREAM_DECODER_ABORTED:
- return true;
- default:
- FLAC__ASSERT(0);
- return false;
- }
- }
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+
+ while(1) {
+ switch(decoder->protected_->state) {
+ case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
+ if(!find_metadata_(decoder))
+ return false; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_READ_METADATA:
+ if(!read_metadata_(decoder))
+ return false; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
+ case FLAC__STREAM_DECODER_READ_FRAME:
+ case FLAC__STREAM_DECODER_END_OF_STREAM:
+ case FLAC__STREAM_DECODER_ABORTED:
+ return true;
+ default:
+ FLAC__ASSERT(0);
+ return false;
+ }
+ }
}
FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder)
{
- FLAC__bool dummy;
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
-
- while(1)
- {
- switch(decoder->protected_->state)
- {
- case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
- if(!find_metadata_(decoder))
- return false; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_READ_METADATA:
- if(!read_metadata_(decoder))
- return false; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
- if(!frame_sync_(decoder))
- return true; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_READ_FRAME:
- if(!read_frame_(decoder, &dummy, /*do_full_decode=*/true))
- return false; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_END_OF_STREAM:
- case FLAC__STREAM_DECODER_ABORTED:
- return true;
- default:
- FLAC__ASSERT(0);
- return false;
- }
- }
+ FLAC__bool dummy;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+
+ while(1) {
+ switch(decoder->protected_->state) {
+ case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
+ if(!find_metadata_(decoder))
+ return false; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_READ_METADATA:
+ if(!read_metadata_(decoder))
+ return false; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
+ if(!frame_sync_(decoder))
+ return true; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_READ_FRAME:
+ if(!read_frame_(decoder, &dummy, /*do_full_decode=*/true))
+ return false; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_END_OF_STREAM:
+ case FLAC__STREAM_DECODER_ABORTED:
+ return true;
+ default:
+ FLAC__ASSERT(0);
+ return false;
+ }
+ }
}
FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder)
{
- FLAC__bool got_a_frame;
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->protected_);
-
- while(1)
- {
- switch(decoder->protected_->state)
- {
- case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
- case FLAC__STREAM_DECODER_READ_METADATA:
- return false; /* above function sets the status for us */
- case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
- if(!frame_sync_(decoder))
- return true; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_READ_FRAME:
- if(!read_frame_(decoder, &got_a_frame, /*do_full_decode=*/false))
- return false; /* above function sets the status for us */
- if(got_a_frame)
- return true; /* above function sets the status for us */
- break;
- case FLAC__STREAM_DECODER_END_OF_STREAM:
- case FLAC__STREAM_DECODER_ABORTED:
- return true;
- default:
- FLAC__ASSERT(0);
- return false;
- }
- }
+ FLAC__bool got_a_frame;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->protected_);
+
+ while(1) {
+ switch(decoder->protected_->state) {
+ case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
+ case FLAC__STREAM_DECODER_READ_METADATA:
+ return false; /* above function sets the status for us */
+ case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
+ if(!frame_sync_(decoder))
+ return true; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_READ_FRAME:
+ if(!read_frame_(decoder, &got_a_frame, /*do_full_decode=*/false))
+ return false; /* above function sets the status for us */
+ if(got_a_frame)
+ return true; /* above function sets the status for us */
+ break;
+ case FLAC__STREAM_DECODER_END_OF_STREAM:
+ case FLAC__STREAM_DECODER_ABORTED:
+ return true;
+ default:
+ FLAC__ASSERT(0);
+ return false;
+ }
+ }
}
FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample)
{
- FLAC__uint64 length;
-
- FLAC__ASSERT(0 != decoder);
-
- if(
- decoder->protected_->state != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA &&
- decoder->protected_->state != FLAC__STREAM_DECODER_READ_METADATA &&
- decoder->protected_->state != FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC &&
- decoder->protected_->state != FLAC__STREAM_DECODER_READ_FRAME &&
- decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM
- )
- return false;
-
- if(0 == decoder->private_->seek_callback)
- return false;
-
- FLAC__ASSERT(decoder->private_->seek_callback);
- FLAC__ASSERT(decoder->private_->tell_callback);
- FLAC__ASSERT(decoder->private_->length_callback);
- FLAC__ASSERT(decoder->private_->eof_callback);
-
- if(FLAC__stream_decoder_get_total_samples(decoder) > 0 && sample >= FLAC__stream_decoder_get_total_samples(decoder))
- return false;
-
- decoder->private_->is_seeking = true;
-
- /* turn off md5 checking if a seek is attempted */
- decoder->private_->do_md5_checking = false;
-
- /* get the file length (currently our algorithm needs to know the length so it's also an error to get FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED) */
- if(decoder->private_->length_callback(decoder, &length, decoder->private_->client_data) != FLAC__STREAM_DECODER_LENGTH_STATUS_OK)
- {
- decoder->private_->is_seeking = false;
- return false;
- }
-
- /* if we haven't finished processing the metadata yet, do that so we have the STREAMINFO, SEEK_TABLE, and first_frame_offset */
- if(
- decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ||
- decoder->protected_->state == FLAC__STREAM_DECODER_READ_METADATA
- )
- {
- if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder))
- {
- /* above call sets the state for us */
- decoder->private_->is_seeking = false;
- return false;
- }
- /* check this again in case we didn't know total_samples the first time */
- if(FLAC__stream_decoder_get_total_samples(decoder) > 0 && sample >= FLAC__stream_decoder_get_total_samples(decoder))
- {
- decoder->private_->is_seeking = false;
- return false;
- }
- }
-
- {
- const FLAC__bool ok =
+ FLAC__uint64 length;
+
+ FLAC__ASSERT(0 != decoder);
+
+ if(
+ decoder->protected_->state != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA &&
+ decoder->protected_->state != FLAC__STREAM_DECODER_READ_METADATA &&
+ decoder->protected_->state != FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC &&
+ decoder->protected_->state != FLAC__STREAM_DECODER_READ_FRAME &&
+ decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM
+ )
+ return false;
+
+ if(0 == decoder->private_->seek_callback)
+ return false;
+
+ FLAC__ASSERT(decoder->private_->seek_callback);
+ FLAC__ASSERT(decoder->private_->tell_callback);
+ FLAC__ASSERT(decoder->private_->length_callback);
+ FLAC__ASSERT(decoder->private_->eof_callback);
+
+ if(FLAC__stream_decoder_get_total_samples(decoder) > 0 && sample >= FLAC__stream_decoder_get_total_samples(decoder))
+ return false;
+
+ decoder->private_->is_seeking = true;
+
+ /* turn off md5 checking if a seek is attempted */
+ decoder->private_->do_md5_checking = false;
+
+ /* get the file length (currently our algorithm needs to know the length so it's also an error to get FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED) */
+ if(decoder->private_->length_callback(decoder, &length, decoder->private_->client_data) != FLAC__STREAM_DECODER_LENGTH_STATUS_OK) {
+ decoder->private_->is_seeking = false;
+ return false;
+ }
+
+ /* if we haven't finished processing the metadata yet, do that so we have the STREAMINFO, SEEK_TABLE, and first_frame_offset */
+ if(
+ decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ||
+ decoder->protected_->state == FLAC__STREAM_DECODER_READ_METADATA
+ ) {
+ if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) {
+ /* above call sets the state for us */
+ decoder->private_->is_seeking = false;
+ return false;
+ }
+ /* check this again in case we didn't know total_samples the first time */
+ if(FLAC__stream_decoder_get_total_samples(decoder) > 0 && sample >= FLAC__stream_decoder_get_total_samples(decoder)) {
+ decoder->private_->is_seeking = false;
+ return false;
+ }
+ }
+
+ {
+ const FLAC__bool ok =
#if FLAC__HAS_OGG
- decoder->private_->is_ogg ?
- seek_to_absolute_sample_ogg_(decoder, length, sample) :
+ decoder->private_->is_ogg?
+ seek_to_absolute_sample_ogg_(decoder, length, sample) :
#endif
- seek_to_absolute_sample_(decoder, length, sample)
- ;
- decoder->private_->is_seeking = false;
- return ok;
- }
+ seek_to_absolute_sample_(decoder, length, sample)
+ ;
+ decoder->private_->is_seeking = false;
+ return ok;
+ }
}
/***********************************************************************
@@ -1286,10 +1239,10 @@ FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *deco
unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder)
{
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
- FLAC__ASSERT(!(FLAC__bitreader_get_input_bits_unconsumed(decoder->private_->input) & 7));
- return FLAC__bitreader_get_input_bits_unconsumed(decoder->private_->input) / 8;
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+ FLAC__ASSERT(!(FLAC__bitreader_get_input_bits_unconsumed(decoder->private_->input) & 7));
+ return FLAC__bitreader_get_input_bits_unconsumed(decoder->private_->input) / 8;
}
/***********************************************************************
@@ -1301,26 +1254,26 @@ unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecod
void set_defaults_(FLAC__StreamDecoder *decoder)
{
#if FLAC__HAS_OGG
- decoder->private_->is_ogg = false;
+ decoder->private_->is_ogg = false;
#endif
- decoder->private_->read_callback = 0;
- decoder->private_->seek_callback = 0;
- decoder->private_->tell_callback = 0;
- decoder->private_->length_callback = 0;
- decoder->private_->eof_callback = 0;
- decoder->private_->write_callback = 0;
- decoder->private_->metadata_callback = 0;
- decoder->private_->error_callback = 0;
- decoder->private_->client_data = 0;
-
- memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter));
- decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] = true;
- decoder->private_->metadata_filter_ids_count = 0;
-
- decoder->protected_->md5_checking = false;
+ decoder->private_->read_callback = 0;
+ decoder->private_->seek_callback = 0;
+ decoder->private_->tell_callback = 0;
+ decoder->private_->length_callback = 0;
+ decoder->private_->eof_callback = 0;
+ decoder->private_->write_callback = 0;
+ decoder->private_->metadata_callback = 0;
+ decoder->private_->error_callback = 0;
+ decoder->private_->client_data = 0;
+
+ memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter));
+ decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] = true;
+ decoder->private_->metadata_filter_ids_count = 0;
+
+ decoder->protected_->md5_checking = false;
#if FLAC__HAS_OGG
- FLAC__ogg_decoder_aspect_set_defaults(&decoder->protected_->ogg_decoder_aspect);
+ FLAC__ogg_decoder_aspect_set_defaults(&decoder->protected_->ogg_decoder_aspect);
#endif
}
@@ -1329,2293 +1282,2106 @@ void set_defaults_(FLAC__StreamDecoder *decoder)
*/
FILE *get_binary_stdin_(void)
{
- /* if something breaks here it is probably due to the presence or
- * absence of an underscore before the identifiers 'setmode',
- * 'fileno', and/or 'O_BINARY'; check your system header files.
- */
+ /* if something breaks here it is probably due to the presence or
+ * absence of an underscore before the identifiers 'setmode',
+ * 'fileno', and/or 'O_BINARY'; check your system header files.
+ */
#if defined _MSC_VER || defined __MINGW32__
- _setmode(_fileno(stdin), _O_BINARY);
-#elif defined __CYGWIN__
- /* almost certainly not needed for any modern Cygwin, but let's be safe... */
- setmode(_fileno(stdin), _O_BINARY);
+ _setmode(_fileno(stdin), _O_BINARY);
+#elif defined __CYGWIN__
+ /* almost certainly not needed for any modern Cygwin, but let's be safe... */
+ setmode(_fileno(stdin), _O_BINARY);
#elif defined __EMX__
- setmode(fileno(stdin), O_BINARY);
+ setmode(fileno(stdin), O_BINARY);
#endif
- return stdin;
+ return stdin;
}
FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels)
{
- unsigned i;
- FLAC__int32 *tmp;
-
- if(size <= decoder->private_->output_capacity && channels <= decoder->private_->output_channels)
- return true;
-
- /* simply using realloc() is not practical because the number of channels may change mid-stream */
-
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- if(0 != decoder->private_->output[i])
- {
- free(decoder->private_->output[i] - 4);
- decoder->private_->output[i] = 0;
- }
- if(0 != decoder->private_->residual_unaligned[i])
- {
- free(decoder->private_->residual_unaligned[i]);
- decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0;
- }
- }
-
- for(i = 0; i < channels; i++)
- {
- /* WATCHOUT:
- * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the
- * output arrays have a buffer of up to 3 zeroes in front
- * (at negative indices) for alignment purposes; we use 4
- * to keep the data well-aligned.
- */
- tmp = (FLAC__int32*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/);
- if(tmp == 0)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- memset(tmp, 0, sizeof(FLAC__int32) * 4);
- decoder->private_->output[i] = tmp + 4;
-
- /* WATCHOUT:
- * minimum of quadword alignment for PPC vector optimizations is REQUIRED:
- */
- if(!FLAC__memory_alloc_aligned_int32_array(size, &decoder->private_->residual_unaligned[i], &decoder->private_->residual[i]))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- }
-
- decoder->private_->output_capacity = size;
- decoder->private_->output_channels = channels;
-
- return true;
+ unsigned i;
+ FLAC__int32 *tmp;
+
+ if(size <= decoder->private_->output_capacity && channels <= decoder->private_->output_channels)
+ return true;
+
+ /* simply using realloc() is not practical because the number of channels may change mid-stream */
+
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ if(0 != decoder->private_->output[i]) {
+ free(decoder->private_->output[i]-4);
+ decoder->private_->output[i] = 0;
+ }
+ if(0 != decoder->private_->residual_unaligned[i]) {
+ free(decoder->private_->residual_unaligned[i]);
+ decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0;
+ }
+ }
+
+ for(i = 0; i < channels; i++) {
+ /* WATCHOUT:
+ * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the
+ * output arrays have a buffer of up to 3 zeroes in front
+ * (at negative indices) for alignment purposes; we use 4
+ * to keep the data well-aligned.
+ */
+ tmp = (FLAC__int32*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/);
+ if(tmp == 0) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ memset(tmp, 0, sizeof(FLAC__int32)*4);
+ decoder->private_->output[i] = tmp + 4;
+
+ /* WATCHOUT:
+ * minimum of quadword alignment for PPC vector optimizations is REQUIRED:
+ */
+ if(!FLAC__memory_alloc_aligned_int32_array(size, &decoder->private_->residual_unaligned[i], &decoder->private_->residual[i])) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ }
+
+ decoder->private_->output_capacity = size;
+ decoder->private_->output_channels = channels;
+
+ return true;
}
FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id)
{
- size_t i;
+ size_t i;
- FLAC__ASSERT(0 != decoder);
- FLAC__ASSERT(0 != decoder->private_);
+ FLAC__ASSERT(0 != decoder);
+ FLAC__ASSERT(0 != decoder->private_);
- for(i = 0; i < decoder->private_->metadata_filter_ids_count; i++)
- if(0 == memcmp(decoder->private_->metadata_filter_ids + i *(FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)))
- return true;
+ for(i = 0; i < decoder->private_->metadata_filter_ids_count; i++)
+ if(0 == memcmp(decoder->private_->metadata_filter_ids + i * (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)))
+ return true;
- return false;
+ return false;
}
FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder)
{
- FLAC__uint32 x;
- unsigned i, id;
- FLAC__bool first = true;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- for(i = id = 0; i < 4;)
- {
- if(decoder->private_->cached)
- {
- x = (FLAC__uint32)decoder->private_->lookahead;
- decoder->private_->cached = false;
- }
- else
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- }
- if(x == FLAC__STREAM_SYNC_STRING[i])
- {
- first = true;
- i++;
- id = 0;
- continue;
- }
- if(x == ID3V2_TAG_[id])
- {
- id++;
- i = 0;
- if(id == 3)
- {
- if(!skip_id3v2_tag_(decoder))
- return false; /* skip_id3v2_tag_ sets the state for us */
- }
- continue;
- }
- id = 0;
- if(x == 0xff) /* MAGIC NUMBER for the first 8 frame sync bits */
- {
- decoder->private_->header_warmup[0] = (FLAC__byte)x;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
-
- /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */
- /* else we have to check if the second byte is the end of a sync code */
- if(x == 0xff) /* MAGIC NUMBER for the first 8 frame sync bits */
- {
- decoder->private_->lookahead = (FLAC__byte)x;
- decoder->private_->cached = true;
- }
- else if(x >> 1 == 0x7c) /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */
- {
- decoder->private_->header_warmup[1] = (FLAC__byte)x;
- decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME;
- return true;
- }
- }
- i = 0;
- if(first)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- first = false;
- }
- }
-
- decoder->protected_->state = FLAC__STREAM_DECODER_READ_METADATA;
- return true;
+ FLAC__uint32 x;
+ unsigned i, id;
+ FLAC__bool first = true;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ for(i = id = 0; i < 4; ) {
+ if(decoder->private_->cached) {
+ x = (FLAC__uint32)decoder->private_->lookahead;
+ decoder->private_->cached = false;
+ }
+ else {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ }
+ if(x == FLAC__STREAM_SYNC_STRING[i]) {
+ first = true;
+ i++;
+ id = 0;
+ continue;
+ }
+ if(x == ID3V2_TAG_[id]) {
+ id++;
+ i = 0;
+ if(id == 3) {
+ if(!skip_id3v2_tag_(decoder))
+ return false; /* skip_id3v2_tag_ sets the state for us */
+ }
+ continue;
+ }
+ id = 0;
+ if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */
+ decoder->private_->header_warmup[0] = (FLAC__byte)x;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+
+ /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */
+ /* else we have to check if the second byte is the end of a sync code */
+ if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */
+ decoder->private_->lookahead = (FLAC__byte)x;
+ decoder->private_->cached = true;
+ }
+ else if(x >> 1 == 0x7c) { /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */
+ decoder->private_->header_warmup[1] = (FLAC__byte)x;
+ decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME;
+ return true;
+ }
+ }
+ i = 0;
+ if(first) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ first = false;
+ }
+ }
+
+ decoder->protected_->state = FLAC__STREAM_DECODER_READ_METADATA;
+ return true;
}
FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
{
- FLAC__bool is_last;
- FLAC__uint32 i, x, type, length;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_IS_LAST_LEN))
- return false; /* read_callback_ sets the state for us */
- is_last = x ? true : false;
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &type, FLAC__STREAM_METADATA_TYPE_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &length, FLAC__STREAM_METADATA_LENGTH_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(type == FLAC__METADATA_TYPE_STREAMINFO)
- {
- if(!read_metadata_streaminfo_(decoder, is_last, length))
- return false;
-
- decoder->private_->has_stream_info = true;
- if(0 == memcmp(decoder->private_->stream_info.data.stream_info.md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16))
- decoder->private_->do_md5_checking = false;
- if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] && decoder->private_->metadata_callback)
- decoder->private_->metadata_callback(decoder, &decoder->private_->stream_info, decoder->private_->client_data);
- }
- else if(type == FLAC__METADATA_TYPE_SEEKTABLE)
- {
- if(!read_metadata_seektable_(decoder, is_last, length))
- return false;
-
- decoder->private_->has_seek_table = true;
- if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback)
- decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data);
- }
- else
- {
- FLAC__bool skip_it = !decoder->private_->metadata_filter[type];
- unsigned real_length = length;
- FLAC__StreamMetadata block;
-
- block.is_last = is_last;
- block.type = (FLAC__MetadataType)type;
- block.length = length;
-
- if(type == FLAC__METADATA_TYPE_APPLICATION)
- {
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8))
- return false; /* read_callback_ sets the state for us */
-
- if(real_length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) /* underflow check */
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;/*@@@@@@ maybe wrong error? need to resync?*/
- return false;
- }
-
- real_length -= FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
-
- if(decoder->private_->metadata_filter_ids_count > 0 && has_id_filtered_(decoder, block.data.application.id))
- skip_it = !skip_it;
- }
-
- if(skip_it)
- {
- if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length))
- return false; /* read_callback_ sets the state for us */
- }
- else
- {
- switch(type)
- {
- case FLAC__METADATA_TYPE_PADDING:
- /* skip the padding bytes */
- if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length))
- return false; /* read_callback_ sets the state for us */
- break;
- case FLAC__METADATA_TYPE_APPLICATION:
- /* remember, we read the ID already */
- if(real_length > 0)
- {
- if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.data, real_length))
- return false; /* read_callback_ sets the state for us */
- }
- else
- block.data.application.data = 0;
- break;
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- if(!read_metadata_vorbiscomment_(decoder, &block.data.vorbis_comment))
- return false;
- break;
- case FLAC__METADATA_TYPE_CUESHEET:
- if(!read_metadata_cuesheet_(decoder, &block.data.cue_sheet))
- return false;
- break;
- case FLAC__METADATA_TYPE_PICTURE:
- if(!read_metadata_picture_(decoder, &block.data.picture))
- return false;
- break;
- case FLAC__METADATA_TYPE_STREAMINFO:
- case FLAC__METADATA_TYPE_SEEKTABLE:
- FLAC__ASSERT(0);
- break;
- default:
- if(real_length > 0)
- {
- if(0 == (block.data.unknown.data = (FLAC__byte*)malloc(real_length)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.unknown.data, real_length))
- return false; /* read_callback_ sets the state for us */
- }
- else
- block.data.unknown.data = 0;
- break;
- }
- if(!decoder->private_->is_seeking && decoder->private_->metadata_callback)
- decoder->private_->metadata_callback(decoder, &block, decoder->private_->client_data);
-
- /* now we have to free any malloc()ed data in the block */
- switch(type)
- {
- case FLAC__METADATA_TYPE_PADDING:
- break;
- case FLAC__METADATA_TYPE_APPLICATION:
- if(0 != block.data.application.data)
- free(block.data.application.data);
- break;
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- if(0 != block.data.vorbis_comment.vendor_string.entry)
- free(block.data.vorbis_comment.vendor_string.entry);
- if(block.data.vorbis_comment.num_comments > 0)
- for(i = 0; i < block.data.vorbis_comment.num_comments; i++)
- if(0 != block.data.vorbis_comment.comments[i].entry)
- free(block.data.vorbis_comment.comments[i].entry);
- if(0 != block.data.vorbis_comment.comments)
- free(block.data.vorbis_comment.comments);
- break;
- case FLAC__METADATA_TYPE_CUESHEET:
- if(block.data.cue_sheet.num_tracks > 0)
- for(i = 0; i < block.data.cue_sheet.num_tracks; i++)
- if(0 != block.data.cue_sheet.tracks[i].indices)
- free(block.data.cue_sheet.tracks[i].indices);
- if(0 != block.data.cue_sheet.tracks)
- free(block.data.cue_sheet.tracks);
- break;
- case FLAC__METADATA_TYPE_PICTURE:
- if(0 != block.data.picture.mime_type)
- free(block.data.picture.mime_type);
- if(0 != block.data.picture.description)
- free(block.data.picture.description);
- if(0 != block.data.picture.data)
- free(block.data.picture.data);
- break;
- case FLAC__METADATA_TYPE_STREAMINFO:
- case FLAC__METADATA_TYPE_SEEKTABLE:
- FLAC__ASSERT(0);
- default:
- if(0 != block.data.unknown.data)
- free(block.data.unknown.data);
- break;
- }
- }
- }
-
- if(is_last)
- {
- /* if this fails, it's OK, it's just a hint for the seek routine */
- if(!FLAC__stream_decoder_get_decode_position(decoder, &decoder->private_->first_frame_offset))
- decoder->private_->first_frame_offset = 0;
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- }
-
- return true;
+ FLAC__bool is_last;
+ FLAC__uint32 i, x, type, length;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_IS_LAST_LEN))
+ return false; /* read_callback_ sets the state for us */
+ is_last = x? true : false;
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &type, FLAC__STREAM_METADATA_TYPE_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &length, FLAC__STREAM_METADATA_LENGTH_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(type == FLAC__METADATA_TYPE_STREAMINFO) {
+ if(!read_metadata_streaminfo_(decoder, is_last, length))
+ return false;
+
+ decoder->private_->has_stream_info = true;
+ if(0 == memcmp(decoder->private_->stream_info.data.stream_info.md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16))
+ decoder->private_->do_md5_checking = false;
+ if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] && decoder->private_->metadata_callback)
+ decoder->private_->metadata_callback(decoder, &decoder->private_->stream_info, decoder->private_->client_data);
+ }
+ else if(type == FLAC__METADATA_TYPE_SEEKTABLE) {
+ if(!read_metadata_seektable_(decoder, is_last, length))
+ return false;
+
+ decoder->private_->has_seek_table = true;
+ if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback)
+ decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data);
+ }
+ else {
+ FLAC__bool skip_it = !decoder->private_->metadata_filter[type];
+ unsigned real_length = length;
+ FLAC__StreamMetadata block;
+
+ block.is_last = is_last;
+ block.type = (FLAC__MetadataType)type;
+ block.length = length;
+
+ if(type == FLAC__METADATA_TYPE_APPLICATION) {
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8))
+ return false; /* read_callback_ sets the state for us */
+
+ if(real_length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) { /* underflow check */
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;/*@@@@@@ maybe wrong error? need to resync?*/
+ return false;
+ }
+
+ real_length -= FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8;
+
+ if(decoder->private_->metadata_filter_ids_count > 0 && has_id_filtered_(decoder, block.data.application.id))
+ skip_it = !skip_it;
+ }
+
+ if(skip_it) {
+ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length))
+ return false; /* read_callback_ sets the state for us */
+ }
+ else {
+ switch(type) {
+ case FLAC__METADATA_TYPE_PADDING:
+ /* skip the padding bytes */
+ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length))
+ return false; /* read_callback_ sets the state for us */
+ break;
+ case FLAC__METADATA_TYPE_APPLICATION:
+ /* remember, we read the ID already */
+ if(real_length > 0) {
+ if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.data, real_length))
+ return false; /* read_callback_ sets the state for us */
+ }
+ else
+ block.data.application.data = 0;
+ break;
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ if(!read_metadata_vorbiscomment_(decoder, &block.data.vorbis_comment))
+ return false;
+ break;
+ case FLAC__METADATA_TYPE_CUESHEET:
+ if(!read_metadata_cuesheet_(decoder, &block.data.cue_sheet))
+ return false;
+ break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ if(!read_metadata_picture_(decoder, &block.data.picture))
+ return false;
+ break;
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ FLAC__ASSERT(0);
+ break;
+ default:
+ if(real_length > 0) {
+ if(0 == (block.data.unknown.data = (FLAC__byte*)malloc(real_length))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.unknown.data, real_length))
+ return false; /* read_callback_ sets the state for us */
+ }
+ else
+ block.data.unknown.data = 0;
+ break;
+ }
+ if(!decoder->private_->is_seeking && decoder->private_->metadata_callback)
+ decoder->private_->metadata_callback(decoder, &block, decoder->private_->client_data);
+
+ /* now we have to free any malloc()ed data in the block */
+ switch(type) {
+ case FLAC__METADATA_TYPE_PADDING:
+ break;
+ case FLAC__METADATA_TYPE_APPLICATION:
+ if(0 != block.data.application.data)
+ free(block.data.application.data);
+ break;
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ if(0 != block.data.vorbis_comment.vendor_string.entry)
+ free(block.data.vorbis_comment.vendor_string.entry);
+ if(block.data.vorbis_comment.num_comments > 0)
+ for(i = 0; i < block.data.vorbis_comment.num_comments; i++)
+ if(0 != block.data.vorbis_comment.comments[i].entry)
+ free(block.data.vorbis_comment.comments[i].entry);
+ if(0 != block.data.vorbis_comment.comments)
+ free(block.data.vorbis_comment.comments);
+ break;
+ case FLAC__METADATA_TYPE_CUESHEET:
+ if(block.data.cue_sheet.num_tracks > 0)
+ for(i = 0; i < block.data.cue_sheet.num_tracks; i++)
+ if(0 != block.data.cue_sheet.tracks[i].indices)
+ free(block.data.cue_sheet.tracks[i].indices);
+ if(0 != block.data.cue_sheet.tracks)
+ free(block.data.cue_sheet.tracks);
+ break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ if(0 != block.data.picture.mime_type)
+ free(block.data.picture.mime_type);
+ if(0 != block.data.picture.description)
+ free(block.data.picture.description);
+ if(0 != block.data.picture.data)
+ free(block.data.picture.data);
+ break;
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ FLAC__ASSERT(0);
+ default:
+ if(0 != block.data.unknown.data)
+ free(block.data.unknown.data);
+ break;
+ }
+ }
+ }
+
+ if(is_last) {
+ /* if this fails, it's OK, it's just a hint for the seek routine */
+ if(!FLAC__stream_decoder_get_decode_position(decoder, &decoder->private_->first_frame_offset))
+ decoder->private_->first_frame_offset = 0;
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ }
+
+ return true;
}
FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length)
{
- FLAC__uint32 x;
- unsigned bits, used_bits = 0;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- decoder->private_->stream_info.type = FLAC__METADATA_TYPE_STREAMINFO;
- decoder->private_->stream_info.is_last = is_last;
- decoder->private_->stream_info.length = length;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, bits))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.min_blocksize = x;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.max_blocksize = x;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.min_framesize = x;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.max_framesize = x;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.sample_rate = x;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.channels = x + 1;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->stream_info.data.stream_info.bits_per_sample = x + 1;
- used_bits += bits;
-
- bits = FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN;
- if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &decoder->private_->stream_info.data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN))
- return false; /* read_callback_ sets the state for us */
- used_bits += bits;
-
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, decoder->private_->stream_info.data.stream_info.md5sum, 16))
- return false; /* read_callback_ sets the state for us */
- used_bits += 16 * 8;
-
- /* skip the rest of the block */
- FLAC__ASSERT(used_bits % 8 == 0);
- length -= (used_bits / 8);
- if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length))
- return false; /* read_callback_ sets the state for us */
-
- return true;
+ FLAC__uint32 x;
+ unsigned bits, used_bits = 0;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ decoder->private_->stream_info.type = FLAC__METADATA_TYPE_STREAMINFO;
+ decoder->private_->stream_info.is_last = is_last;
+ decoder->private_->stream_info.length = length;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, bits))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.min_blocksize = x;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.max_blocksize = x;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.min_framesize = x;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.max_framesize = x;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.sample_rate = x;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.channels = x+1;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->stream_info.data.stream_info.bits_per_sample = x+1;
+ used_bits += bits;
+
+ bits = FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN;
+ if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &decoder->private_->stream_info.data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN))
+ return false; /* read_callback_ sets the state for us */
+ used_bits += bits;
+
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, decoder->private_->stream_info.data.stream_info.md5sum, 16))
+ return false; /* read_callback_ sets the state for us */
+ used_bits += 16*8;
+
+ /* skip the rest of the block */
+ FLAC__ASSERT(used_bits % 8 == 0);
+ length -= (used_bits / 8);
+ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length))
+ return false; /* read_callback_ sets the state for us */
+
+ return true;
}
FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length)
{
- FLAC__uint32 i, x;
- FLAC__uint64 xx;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- decoder->private_->seek_table.type = FLAC__METADATA_TYPE_SEEKTABLE;
- decoder->private_->seek_table.is_last = is_last;
- decoder->private_->seek_table.length = length;
-
- decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
-
- /* use realloc since we may pass through here several times (e.g. after seeking) */
- if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint))))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- for(i = 0; i < decoder->private_->seek_table.data.seek_table.num_points; i++)
- {
- if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->seek_table.data.seek_table.points[i].sample_number = xx;
-
- if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->seek_table.data.seek_table.points[i].stream_offset = xx;
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->seek_table.data.seek_table.points[i].frame_samples = x;
- }
- length -= (decoder->private_->seek_table.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH);
- /* if there is a partial point left, skip over it */
- if(length > 0)
- {
- /*@@@ do a send_error_to_client_() here? there's an argument for either way */
- if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length))
- return false; /* read_callback_ sets the state for us */
- }
-
- return true;
+ FLAC__uint32 i, x;
+ FLAC__uint64 xx;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ decoder->private_->seek_table.type = FLAC__METADATA_TYPE_SEEKTABLE;
+ decoder->private_->seek_table.is_last = is_last;
+ decoder->private_->seek_table.length = length;
+
+ decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
+
+ /* use realloc since we may pass through here several times (e.g. after seeking) */
+ if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ for(i = 0; i < decoder->private_->seek_table.data.seek_table.num_points; i++) {
+ if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->seek_table.data.seek_table.points[i].sample_number = xx;
+
+ if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->seek_table.data.seek_table.points[i].stream_offset = xx;
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->seek_table.data.seek_table.points[i].frame_samples = x;
+ }
+ length -= (decoder->private_->seek_table.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH);
+ /* if there is a partial point left, skip over it */
+ if(length > 0) {
+ /*@@@ do a send_error_to_client_() here? there's an argument for either way */
+ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length))
+ return false; /* read_callback_ sets the state for us */
+ }
+
+ return true;
}
FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj)
{
- FLAC__uint32 i;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- /* read vendor string */
- FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32);
- if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length))
- return false; /* read_callback_ sets the state for us */
- if(obj->vendor_string.length > 0)
- {
- if(0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length))
- return false; /* read_callback_ sets the state for us */
- obj->vendor_string.entry[obj->vendor_string.length] = '\0';
- }
- else
- obj->vendor_string.entry = 0;
-
- /* read num comments */
- FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN == 32);
- if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->num_comments))
- return false; /* read_callback_ sets the state for us */
-
- /* read comments */
- if(obj->num_comments > 0)
- {
- if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry))))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- for(i = 0; i < obj->num_comments; i++)
- {
- FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32);
- if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length))
- return false; /* read_callback_ sets the state for us */
- if(obj->comments[i].length > 0)
- {
- if(0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length))
- return false; /* read_callback_ sets the state for us */
- obj->comments[i].entry[obj->comments[i].length] = '\0';
- }
- else
- obj->comments[i].entry = 0;
- }
- }
- else
- {
- obj->comments = 0;
- }
-
- return true;
+ FLAC__uint32 i;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ /* read vendor string */
+ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32);
+ if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length))
+ return false; /* read_callback_ sets the state for us */
+ if(obj->vendor_string.length > 0) {
+ if(0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length))
+ return false; /* read_callback_ sets the state for us */
+ obj->vendor_string.entry[obj->vendor_string.length] = '\0';
+ }
+ else
+ obj->vendor_string.entry = 0;
+
+ /* read num comments */
+ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN == 32);
+ if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->num_comments))
+ return false; /* read_callback_ sets the state for us */
+
+ /* read comments */
+ if(obj->num_comments > 0) {
+ if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ for(i = 0; i < obj->num_comments; i++) {
+ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32);
+ if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length))
+ return false; /* read_callback_ sets the state for us */
+ if(obj->comments[i].length > 0) {
+ if(0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length))
+ return false; /* read_callback_ sets the state for us */
+ obj->comments[i].entry[obj->comments[i].length] = '\0';
+ }
+ else
+ obj->comments[i].entry = 0;
+ }
+ }
+ else {
+ obj->comments = 0;
+ }
+
+ return true;
}
FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_CueSheet *obj)
{
- FLAC__uint32 i, j, x;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- memset(obj, 0, sizeof(FLAC__StreamMetadata_CueSheet));
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &obj->lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN))
- return false; /* read_callback_ sets the state for us */
- obj->is_cd = x ? true : false;
-
- if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN))
- return false; /* read_callback_ sets the state for us */
- obj->num_tracks = x;
-
- if(obj->num_tracks > 0)
- {
- if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track))))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- for(i = 0; i < obj->num_tracks; i++)
- {
- FLAC__StreamMetadata_CueSheet_Track *track = &obj->tracks[i];
- if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN))
- return false; /* read_callback_ sets the state for us */
- track->number = (FLAC__byte)x;
-
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN))
- return false; /* read_callback_ sets the state for us */
- track->type = x;
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN))
- return false; /* read_callback_ sets the state for us */
- track->pre_emphasis = x;
-
- if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN))
- return false; /* read_callback_ sets the state for us */
- track->num_indices = (FLAC__byte)x;
-
- if(track->num_indices > 0)
- {
- if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index))))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- for(j = 0; j < track->num_indices; j++)
- {
- FLAC__StreamMetadata_CueSheet_Index *index = &track->indices[j];
- if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
- return false; /* read_callback_ sets the state for us */
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
- return false; /* read_callback_ sets the state for us */
- index->number = (FLAC__byte)x;
-
- if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN))
- return false; /* read_callback_ sets the state for us */
- }
- }
- }
- }
-
- return true;
+ FLAC__uint32 i, j, x;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ memset(obj, 0, sizeof(FLAC__StreamMetadata_CueSheet));
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN/8))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &obj->lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN))
+ return false; /* read_callback_ sets the state for us */
+ obj->is_cd = x? true : false;
+
+ if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN))
+ return false; /* read_callback_ sets the state for us */
+ obj->num_tracks = x;
+
+ if(obj->num_tracks > 0) {
+ if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ for(i = 0; i < obj->num_tracks; i++) {
+ FLAC__StreamMetadata_CueSheet_Track *track = &obj->tracks[i];
+ if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN))
+ return false; /* read_callback_ sets the state for us */
+ track->number = (FLAC__byte)x;
+
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ track->type = x;
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN))
+ return false; /* read_callback_ sets the state for us */
+ track->pre_emphasis = x;
+
+ if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN))
+ return false; /* read_callback_ sets the state for us */
+ track->num_indices = (FLAC__byte)x;
+
+ if(track->num_indices > 0) {
+ if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ for(j = 0; j < track->num_indices; j++) {
+ FLAC__StreamMetadata_CueSheet_Index *index = &track->indices[j];
+ if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
+ return false; /* read_callback_ sets the state for us */
+ index->number = (FLAC__byte)x;
+
+ if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN))
+ return false; /* read_callback_ sets the state for us */
+ }
+ }
+ }
+ }
+
+ return true;
}
FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *obj)
{
- FLAC__uint32 x;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- /* read type */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
- return false; /* read_callback_ sets the state for us */
- obj->type = x;
-
- /* read MIME type */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
- return false; /* read_callback_ sets the state for us */
- if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(x, /*+*/1)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(x > 0)
- {
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, x))
- return false; /* read_callback_ sets the state for us */
- }
- obj->mime_type[x] = '\0';
-
- /* read description */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
- return false; /* read_callback_ sets the state for us */
- if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(x, /*+*/1)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(x > 0)
- {
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, x))
- return false; /* read_callback_ sets the state for us */
- }
- obj->description[x] = '\0';
-
- /* read width */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN))
- return false; /* read_callback_ sets the state for us */
-
- /* read height */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->height, FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN))
- return false; /* read_callback_ sets the state for us */
-
- /* read depth */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->depth, FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN))
- return false; /* read_callback_ sets the state for us */
-
- /* read colors */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->colors, FLAC__STREAM_METADATA_PICTURE_COLORS_LEN))
- return false; /* read_callback_ sets the state for us */
-
- /* read data */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
- return false; /* read_callback_ sets the state for us */
- if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
- if(obj->data_length > 0)
- {
- if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->data, obj->data_length))
- return false; /* read_callback_ sets the state for us */
- }
-
- return true;
+ FLAC__uint32 x;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ /* read type */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ obj->type = x;
+
+ /* read MIME type */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
+ return false; /* read_callback_ sets the state for us */
+ if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(x, /*+*/1))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(x > 0) {
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, x))
+ return false; /* read_callback_ sets the state for us */
+ }
+ obj->mime_type[x] = '\0';
+
+ /* read description */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
+ return false; /* read_callback_ sets the state for us */
+ if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(x, /*+*/1))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(x > 0) {
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, x))
+ return false; /* read_callback_ sets the state for us */
+ }
+ obj->description[x] = '\0';
+
+ /* read width */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ /* read height */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->height, FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ /* read depth */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->depth, FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ /* read colors */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->colors, FLAC__STREAM_METADATA_PICTURE_COLORS_LEN))
+ return false; /* read_callback_ sets the state for us */
+
+ /* read data */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
+ return false; /* read_callback_ sets the state for us */
+ if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ if(obj->data_length > 0) {
+ if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->data, obj->data_length))
+ return false; /* read_callback_ sets the state for us */
+ }
+
+ return true;
}
FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder)
{
- FLAC__uint32 x;
- unsigned i, skip;
-
- /* skip the version and flags bytes */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 24))
- return false; /* read_callback_ sets the state for us */
- /* get the size (in bytes) to skip */
- skip = 0;
- for(i = 0; i < 4; i++)
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- skip <<= 7;
- skip |= (x & 0x7f);
- }
- /* skip the rest of the tag */
- if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, skip))
- return false; /* read_callback_ sets the state for us */
- return true;
+ FLAC__uint32 x;
+ unsigned i, skip;
+
+ /* skip the version and flags bytes */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 24))
+ return false; /* read_callback_ sets the state for us */
+ /* get the size (in bytes) to skip */
+ skip = 0;
+ for(i = 0; i < 4; i++) {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ skip <<= 7;
+ skip |= (x & 0x7f);
+ }
+ /* skip the rest of the tag */
+ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, skip))
+ return false; /* read_callback_ sets the state for us */
+ return true;
}
FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder)
{
- FLAC__uint32 x;
- FLAC__bool first = true;
-
- /* If we know the total number of samples in the stream, stop if we've read that many. */
- /* This will stop us, for example, from wasting time trying to sync on an ID3V1 tag. */
- if(FLAC__stream_decoder_get_total_samples(decoder) > 0)
- {
- if(decoder->private_->samples_decoded >= FLAC__stream_decoder_get_total_samples(decoder))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
- return true;
- }
- }
-
- /* make sure we're byte aligned */
- if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input))
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input)))
- return false; /* read_callback_ sets the state for us */
- }
-
- while(1)
- {
- if(decoder->private_->cached)
- {
- x = (FLAC__uint32)decoder->private_->lookahead;
- decoder->private_->cached = false;
- }
- else
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- }
- if(x == 0xff) /* MAGIC NUMBER for the first 8 frame sync bits */
- {
- decoder->private_->header_warmup[0] = (FLAC__byte)x;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
-
- /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */
- /* else we have to check if the second byte is the end of a sync code */
- if(x == 0xff) /* MAGIC NUMBER for the first 8 frame sync bits */
- {
- decoder->private_->lookahead = (FLAC__byte)x;
- decoder->private_->cached = true;
- }
- else if(x >> 1 == 0x7c) /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */
- {
- decoder->private_->header_warmup[1] = (FLAC__byte)x;
- decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME;
- return true;
- }
- }
- if(first)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- first = false;
- }
- }
-
- return true;
+ FLAC__uint32 x;
+ FLAC__bool first = true;
+
+ /* If we know the total number of samples in the stream, stop if we've read that many. */
+ /* This will stop us, for example, from wasting time trying to sync on an ID3V1 tag. */
+ if(FLAC__stream_decoder_get_total_samples(decoder) > 0) {
+ if(decoder->private_->samples_decoded >= FLAC__stream_decoder_get_total_samples(decoder)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
+ return true;
+ }
+ }
+
+ /* make sure we're byte aligned */
+ if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)) {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input)))
+ return false; /* read_callback_ sets the state for us */
+ }
+
+ while(1) {
+ if(decoder->private_->cached) {
+ x = (FLAC__uint32)decoder->private_->lookahead;
+ decoder->private_->cached = false;
+ }
+ else {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ }
+ if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */
+ decoder->private_->header_warmup[0] = (FLAC__byte)x;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+
+ /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */
+ /* else we have to check if the second byte is the end of a sync code */
+ if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */
+ decoder->private_->lookahead = (FLAC__byte)x;
+ decoder->private_->cached = true;
+ }
+ else if(x >> 1 == 0x7c) { /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */
+ decoder->private_->header_warmup[1] = (FLAC__byte)x;
+ decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME;
+ return true;
+ }
+ }
+ if(first) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ first = false;
+ }
+ }
+
+ return true;
}
FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode)
{
- unsigned channel;
- unsigned i;
- FLAC__int32 mid, side;
- unsigned frame_crc; /* the one we calculate from the input stream */
- FLAC__uint32 x;
-
- *got_a_frame = false;
-
- /* init the CRC */
- frame_crc = 0;
- frame_crc = FLAC__CRC16_UPDATE(decoder->private_->header_warmup[0], frame_crc);
- frame_crc = FLAC__CRC16_UPDATE(decoder->private_->header_warmup[1], frame_crc);
- FLAC__bitreader_reset_read_crc16(decoder->private_->input, (FLAC__uint16)frame_crc);
-
- if(!read_frame_header_(decoder))
- return false;
- if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means we didn't sync on a valid header */
- return true;
- if(!allocate_output_(decoder, decoder->private_->frame.header.blocksize, decoder->private_->frame.header.channels))
- return false;
- for(channel = 0; channel < decoder->private_->frame.header.channels; channel++)
- {
- /*
- * first figure the correct bits-per-sample of the subframe
- */
- unsigned bps = decoder->private_->frame.header.bits_per_sample;
- switch(decoder->private_->frame.header.channel_assignment)
- {
- case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
- /* no adjustment needed */
- break;
- case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
- FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
- if(channel == 1)
- bps++;
- break;
- case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
- FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
- if(channel == 0)
- bps++;
- break;
- case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
- FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
- if(channel == 1)
- bps++;
- break;
- default:
- FLAC__ASSERT(0);
- }
- /*
- * now read it
- */
- if(!read_subframe_(decoder, channel, bps, do_full_decode))
- return false;
- if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */
- return true;
- }
- if(!read_zero_padding_(decoder))
- return false;
- if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption (i.e. "zero bits" were not all zeroes) */
- return true;
-
- /*
- * Read the frame CRC-16 from the footer and check
- */
- frame_crc = FLAC__bitreader_get_read_crc16(decoder->private_->input);
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__FRAME_FOOTER_CRC_LEN))
- return false; /* read_callback_ sets the state for us */
- if(frame_crc == x)
- {
- if(do_full_decode)
- {
- /* Undo any special channel coding */
- switch(decoder->private_->frame.header.channel_assignment)
- {
- case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
- /* do nothing */
- break;
- case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
- FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
- for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
- decoder->private_->output[1][i] = decoder->private_->output[0][i] - decoder->private_->output[1][i];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
- FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
- for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
- decoder->private_->output[0][i] += decoder->private_->output[1][i];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
- FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
- for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
- {
+ unsigned channel;
+ unsigned i;
+ FLAC__int32 mid, side;
+ unsigned frame_crc; /* the one we calculate from the input stream */
+ FLAC__uint32 x;
+
+ *got_a_frame = false;
+
+ /* init the CRC */
+ frame_crc = 0;
+ frame_crc = FLAC__CRC16_UPDATE(decoder->private_->header_warmup[0], frame_crc);
+ frame_crc = FLAC__CRC16_UPDATE(decoder->private_->header_warmup[1], frame_crc);
+ FLAC__bitreader_reset_read_crc16(decoder->private_->input, (FLAC__uint16)frame_crc);
+
+ if(!read_frame_header_(decoder))
+ return false;
+ if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means we didn't sync on a valid header */
+ return true;
+ if(!allocate_output_(decoder, decoder->private_->frame.header.blocksize, decoder->private_->frame.header.channels))
+ return false;
+ for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) {
+ /*
+ * first figure the correct bits-per-sample of the subframe
+ */
+ unsigned bps = decoder->private_->frame.header.bits_per_sample;
+ switch(decoder->private_->frame.header.channel_assignment) {
+ case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
+ /* no adjustment needed */
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
+ FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
+ if(channel == 1)
+ bps++;
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
+ FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
+ if(channel == 0)
+ bps++;
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
+ FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
+ if(channel == 1)
+ bps++;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+ /*
+ * now read it
+ */
+ if(!read_subframe_(decoder, channel, bps, do_full_decode))
+ return false;
+ if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */
+ return true;
+ }
+ if(!read_zero_padding_(decoder))
+ return false;
+ if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption (i.e. "zero bits" were not all zeroes) */
+ return true;
+
+ /*
+ * Read the frame CRC-16 from the footer and check
+ */
+ frame_crc = FLAC__bitreader_get_read_crc16(decoder->private_->input);
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__FRAME_FOOTER_CRC_LEN))
+ return false; /* read_callback_ sets the state for us */
+ if(frame_crc == x) {
+ if(do_full_decode) {
+ /* Undo any special channel coding */
+ switch(decoder->private_->frame.header.channel_assignment) {
+ case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
+ /* do nothing */
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
+ FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
+ for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
+ decoder->private_->output[1][i] = decoder->private_->output[0][i] - decoder->private_->output[1][i];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
+ FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
+ for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
+ decoder->private_->output[0][i] += decoder->private_->output[1][i];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
+ FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
+ for(i = 0; i < decoder->private_->frame.header.blocksize; i++) {
#if 1
- mid = decoder->private_->output[0][i];
- side = decoder->private_->output[1][i];
- mid <<= 1;
- mid |= (side & 1); /* i.e. if 'side' is odd... */
- decoder->private_->output[0][i] = (mid + side) >> 1;
- decoder->private_->output[1][i] = (mid - side) >> 1;
+ mid = decoder->private_->output[0][i];
+ side = decoder->private_->output[1][i];
+ mid <<= 1;
+ mid |= (side & 1); /* i.e. if 'side' is odd... */
+ decoder->private_->output[0][i] = (mid + side) >> 1;
+ decoder->private_->output[1][i] = (mid - side) >> 1;
#else
- /* OPT: without 'side' temp variable */
- mid = (decoder->private_->output[0][i] << 1) | (decoder->private_->output[1][i] & 1); /* i.e. if 'side' is odd... */
- decoder->private_->output[0][i] = (mid + decoder->private_->output[1][i]) >> 1;
- decoder->private_->output[1][i] = (mid - decoder->private_->output[1][i]) >> 1;
+ /* OPT: without 'side' temp variable */
+ mid = (decoder->private_->output[0][i] << 1) | (decoder->private_->output[1][i] & 1); /* i.e. if 'side' is odd... */
+ decoder->private_->output[0][i] = (mid + decoder->private_->output[1][i]) >> 1;
+ decoder->private_->output[1][i] = (mid - decoder->private_->output[1][i]) >> 1;
#endif
- }
- break;
- default:
- FLAC__ASSERT(0);
- break;
- }
- }
- }
- else
- {
- /* Bad frame, emit error and zero the output signal */
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH);
- if(do_full_decode)
- {
- for(channel = 0; channel < decoder->private_->frame.header.channels; channel++)
- {
- memset(decoder->private_->output[channel], 0, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize);
- }
- }
- }
-
- *got_a_frame = true;
-
- /* we wait to update fixed_block_size until here, when we're sure we've got a proper frame and hence a correct blocksize */
- if(decoder->private_->next_fixed_block_size)
- decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size;
-
- /* put the latest values into the public section of the decoder instance */
- decoder->protected_->channels = decoder->private_->frame.header.channels;
- decoder->protected_->channel_assignment = decoder->private_->frame.header.channel_assignment;
- decoder->protected_->bits_per_sample = decoder->private_->frame.header.bits_per_sample;
- decoder->protected_->sample_rate = decoder->private_->frame.header.sample_rate;
- decoder->protected_->blocksize = decoder->private_->frame.header.blocksize;
-
- FLAC__ASSERT(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
- decoder->private_->samples_decoded = decoder->private_->frame.header.number.sample_number + decoder->private_->frame.header.blocksize;
-
- /* write it */
- if(do_full_decode)
- {
- if(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE)
- return false;
- }
-
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
+ }
+ break;
+ default:
+ FLAC__ASSERT(0);
+ break;
+ }
+ }
+ }
+ else {
+ /* Bad frame, emit error and zero the output signal */
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH);
+ if(do_full_decode) {
+ for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) {
+ memset(decoder->private_->output[channel], 0, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize);
+ }
+ }
+ }
+
+ *got_a_frame = true;
+
+ /* we wait to update fixed_block_size until here, when we're sure we've got a proper frame and hence a correct blocksize */
+ if(decoder->private_->next_fixed_block_size)
+ decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size;
+
+ /* put the latest values into the public section of the decoder instance */
+ decoder->protected_->channels = decoder->private_->frame.header.channels;
+ decoder->protected_->channel_assignment = decoder->private_->frame.header.channel_assignment;
+ decoder->protected_->bits_per_sample = decoder->private_->frame.header.bits_per_sample;
+ decoder->protected_->sample_rate = decoder->private_->frame.header.sample_rate;
+ decoder->protected_->blocksize = decoder->private_->frame.header.blocksize;
+
+ FLAC__ASSERT(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
+ decoder->private_->samples_decoded = decoder->private_->frame.header.number.sample_number + decoder->private_->frame.header.blocksize;
+
+ /* write it */
+ if(do_full_decode) {
+ if(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE)
+ return false;
+ }
+
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
}
FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder)
{
- FLAC__uint32 x;
- FLAC__uint64 xx;
- unsigned i, blocksize_hint = 0, sample_rate_hint = 0;
- FLAC__byte crc8, raw_header[16]; /* MAGIC NUMBER based on the maximum frame header size, including CRC */
- unsigned raw_header_len;
- FLAC__bool is_unparseable = false;
-
- FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
-
- /* init the raw header with the saved bits from synchronization */
- raw_header[0] = decoder->private_->header_warmup[0];
- raw_header[1] = decoder->private_->header_warmup[1];
- raw_header_len = 2;
-
- /* check to make sure that reserved bit is 0 */
- if(raw_header[1] & 0x02) /* MAGIC NUMBER */
- is_unparseable = true;
-
- /*
- * Note that along the way as we read the header, we look for a sync
- * code inside. If we find one it would indicate that our original
- * sync was bad since there cannot be a sync code in a valid header.
- *
- * Three kinds of things can go wrong when reading the frame header:
- * 1) We may have sync'ed incorrectly and not landed on a frame header.
- * If we don't find a sync code, it can end up looking like we read
- * a valid but unparseable header, until getting to the frame header
- * CRC. Even then we could get a false positive on the CRC.
- * 2) We may have sync'ed correctly but on an unparseable frame (from a
- * future encoder).
- * 3) We may be on a damaged frame which appears valid but unparseable.
- *
- * For all these reasons, we try and read a complete frame header as
- * long as it seems valid, even if unparseable, up until the frame
- * header CRC.
- */
-
- /*
- * read in the raw header as bytes so we can CRC it, and parse it on the way
- */
- for(i = 0; i < 2; i++)
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- if(x == 0xff) /* MAGIC NUMBER for the first 8 frame sync bits */
- {
- /* if we get here it means our original sync was erroneous since the sync code cannot appear in the header */
- decoder->private_->lookahead = (FLAC__byte)x;
- decoder->private_->cached = true;
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- raw_header[raw_header_len++] = (FLAC__byte)x;
- }
-
- switch(x = raw_header[2] >> 4)
- {
- case 0:
- is_unparseable = true;
- break;
- case 1:
- decoder->private_->frame.header.blocksize = 192;
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- decoder->private_->frame.header.blocksize = 576 << (x - 2);
- break;
- case 6:
- case 7:
- blocksize_hint = x;
- break;
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- decoder->private_->frame.header.blocksize = 256 << (x - 8);
- break;
- default:
- FLAC__ASSERT(0);
- break;
- }
-
- switch(x = raw_header[2] & 0x0f)
- {
- case 0:
- if(decoder->private_->has_stream_info)
- decoder->private_->frame.header.sample_rate = decoder->private_->stream_info.data.stream_info.sample_rate;
- else
- is_unparseable = true;
- break;
- case 1:
- decoder->private_->frame.header.sample_rate = 88200;
- break;
- case 2:
- decoder->private_->frame.header.sample_rate = 176400;
- break;
- case 3:
- decoder->private_->frame.header.sample_rate = 192000;
- break;
- case 4:
- decoder->private_->frame.header.sample_rate = 8000;
- break;
- case 5:
- decoder->private_->frame.header.sample_rate = 16000;
- break;
- case 6:
- decoder->private_->frame.header.sample_rate = 22050;
- break;
- case 7:
- decoder->private_->frame.header.sample_rate = 24000;
- break;
- case 8:
- decoder->private_->frame.header.sample_rate = 32000;
- break;
- case 9:
- decoder->private_->frame.header.sample_rate = 44100;
- break;
- case 10:
- decoder->private_->frame.header.sample_rate = 48000;
- break;
- case 11:
- decoder->private_->frame.header.sample_rate = 96000;
- break;
- case 12:
- case 13:
- case 14:
- sample_rate_hint = x;
- break;
- case 15:
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- default:
- FLAC__ASSERT(0);
- }
-
- x = (unsigned)(raw_header[3] >> 4);
- if(x & 8)
- {
- decoder->private_->frame.header.channels = 2;
- switch(x & 7)
- {
- case 0:
- decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE;
- break;
- case 1:
- decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE;
- break;
- case 2:
- decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_MID_SIDE;
- break;
- default:
- is_unparseable = true;
- break;
- }
- }
- else
- {
- decoder->private_->frame.header.channels = (unsigned)x + 1;
- decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT;
- }
-
- switch(x = (unsigned)(raw_header[3] & 0x0e) >> 1)
- {
- case 0:
- if(decoder->private_->has_stream_info)
- decoder->private_->frame.header.bits_per_sample = decoder->private_->stream_info.data.stream_info.bits_per_sample;
- else
- is_unparseable = true;
- break;
- case 1:
- decoder->private_->frame.header.bits_per_sample = 8;
- break;
- case 2:
- decoder->private_->frame.header.bits_per_sample = 12;
- break;
- case 4:
- decoder->private_->frame.header.bits_per_sample = 16;
- break;
- case 5:
- decoder->private_->frame.header.bits_per_sample = 20;
- break;
- case 6:
- decoder->private_->frame.header.bits_per_sample = 24;
- break;
- case 3:
- case 7:
- is_unparseable = true;
- break;
- default:
- FLAC__ASSERT(0);
- break;
- }
-
- /* check to make sure that reserved bit is 0 */
- if(raw_header[3] & 0x01) /* MAGIC NUMBER */
- is_unparseable = true;
-
- /* read the frame's starting sample number (or frame number as the case may be) */
- if(
- raw_header[1] & 0x01 ||
- /*@@@ this clause is a concession to the old way of doing variable blocksize; the only known implementation is flake and can probably be removed without inconveniencing anyone */
- (decoder->private_->has_stream_info && decoder->private_->stream_info.data.stream_info.min_blocksize != decoder->private_->stream_info.data.stream_info.max_blocksize)
- ) /* variable blocksize */
- {
- if(!FLAC__bitreader_read_utf8_uint64(decoder->private_->input, &xx, raw_header, &raw_header_len))
- return false; /* read_callback_ sets the state for us */
- if(xx == FLAC__U64L(0xffffffffffffffff)) /* i.e. non-UTF8 code... */
- {
- decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */
- decoder->private_->cached = true;
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER;
- decoder->private_->frame.header.number.sample_number = xx;
- }
- else /* fixed blocksize */
- {
- if(!FLAC__bitreader_read_utf8_uint32(decoder->private_->input, &x, raw_header, &raw_header_len))
- return false; /* read_callback_ sets the state for us */
- if(x == 0xffffffff) /* i.e. non-UTF8 code... */
- {
- decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */
- decoder->private_->cached = true;
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER;
- decoder->private_->frame.header.number.frame_number = x;
- }
-
- if(blocksize_hint)
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- raw_header[raw_header_len++] = (FLAC__byte)x;
- if(blocksize_hint == 7)
- {
- FLAC__uint32 _x;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &_x, 8))
- return false; /* read_callback_ sets the state for us */
- raw_header[raw_header_len++] = (FLAC__byte)_x;
- x = (x << 8) | _x;
- }
- decoder->private_->frame.header.blocksize = x + 1;
- }
-
- if(sample_rate_hint)
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- raw_header[raw_header_len++] = (FLAC__byte)x;
- if(sample_rate_hint != 12)
- {
- FLAC__uint32 _x;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &_x, 8))
- return false; /* read_callback_ sets the state for us */
- raw_header[raw_header_len++] = (FLAC__byte)_x;
- x = (x << 8) | _x;
- }
- if(sample_rate_hint == 12)
- decoder->private_->frame.header.sample_rate = x * 1000;
- else if(sample_rate_hint == 13)
- decoder->private_->frame.header.sample_rate = x;
- else
- decoder->private_->frame.header.sample_rate = x * 10;
- }
-
- /* read the CRC-8 byte */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
- return false; /* read_callback_ sets the state for us */
- crc8 = (FLAC__byte)x;
-
- if(FLAC__crc8(raw_header, raw_header_len) != crc8)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
-
- /* calculate the sample number from the frame number if needed */
- decoder->private_->next_fixed_block_size = 0;
- if(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER)
- {
- x = decoder->private_->frame.header.number.frame_number;
- decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER;
- if(decoder->private_->fixed_block_size)
- decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->fixed_block_size * (FLAC__uint64)x;
- else if(decoder->private_->has_stream_info)
- {
- if(decoder->private_->stream_info.data.stream_info.min_blocksize == decoder->private_->stream_info.data.stream_info.max_blocksize)
- {
- decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->stream_info.data.stream_info.min_blocksize * (FLAC__uint64)x;
- decoder->private_->next_fixed_block_size = decoder->private_->stream_info.data.stream_info.max_blocksize;
- }
- else
- is_unparseable = true;
- }
- else if(x == 0)
- {
- decoder->private_->frame.header.number.sample_number = 0;
- decoder->private_->next_fixed_block_size = decoder->private_->frame.header.blocksize;
- }
- else
- {
- /* can only get here if the stream has invalid frame numbering and no STREAMINFO, so assume it's not the last (possibly short) frame */
- decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->frame.header.blocksize * (FLAC__uint64)x;
- }
- }
-
- if(is_unparseable)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
-
- return true;
+ FLAC__uint32 x;
+ FLAC__uint64 xx;
+ unsigned i, blocksize_hint = 0, sample_rate_hint = 0;
+ FLAC__byte crc8, raw_header[16]; /* MAGIC NUMBER based on the maximum frame header size, including CRC */
+ unsigned raw_header_len;
+ FLAC__bool is_unparseable = false;
+
+ FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
+
+ /* init the raw header with the saved bits from synchronization */
+ raw_header[0] = decoder->private_->header_warmup[0];
+ raw_header[1] = decoder->private_->header_warmup[1];
+ raw_header_len = 2;
+
+ /* check to make sure that reserved bit is 0 */
+ if(raw_header[1] & 0x02) /* MAGIC NUMBER */
+ is_unparseable = true;
+
+ /*
+ * Note that along the way as we read the header, we look for a sync
+ * code inside. If we find one it would indicate that our original
+ * sync was bad since there cannot be a sync code in a valid header.
+ *
+ * Three kinds of things can go wrong when reading the frame header:
+ * 1) We may have sync'ed incorrectly and not landed on a frame header.
+ * If we don't find a sync code, it can end up looking like we read
+ * a valid but unparseable header, until getting to the frame header
+ * CRC. Even then we could get a false positive on the CRC.
+ * 2) We may have sync'ed correctly but on an unparseable frame (from a
+ * future encoder).
+ * 3) We may be on a damaged frame which appears valid but unparseable.
+ *
+ * For all these reasons, we try and read a complete frame header as
+ * long as it seems valid, even if unparseable, up until the frame
+ * header CRC.
+ */
+
+ /*
+ * read in the raw header as bytes so we can CRC it, and parse it on the way
+ */
+ for(i = 0; i < 2; i++) {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */
+ /* if we get here it means our original sync was erroneous since the sync code cannot appear in the header */
+ decoder->private_->lookahead = (FLAC__byte)x;
+ decoder->private_->cached = true;
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ raw_header[raw_header_len++] = (FLAC__byte)x;
+ }
+
+ switch(x = raw_header[2] >> 4) {
+ case 0:
+ is_unparseable = true;
+ break;
+ case 1:
+ decoder->private_->frame.header.blocksize = 192;
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ decoder->private_->frame.header.blocksize = 576 << (x-2);
+ break;
+ case 6:
+ case 7:
+ blocksize_hint = x;
+ break;
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ decoder->private_->frame.header.blocksize = 256 << (x-8);
+ break;
+ default:
+ FLAC__ASSERT(0);
+ break;
+ }
+
+ switch(x = raw_header[2] & 0x0f) {
+ case 0:
+ if(decoder->private_->has_stream_info)
+ decoder->private_->frame.header.sample_rate = decoder->private_->stream_info.data.stream_info.sample_rate;
+ else
+ is_unparseable = true;
+ break;
+ case 1:
+ decoder->private_->frame.header.sample_rate = 88200;
+ break;
+ case 2:
+ decoder->private_->frame.header.sample_rate = 176400;
+ break;
+ case 3:
+ decoder->private_->frame.header.sample_rate = 192000;
+ break;
+ case 4:
+ decoder->private_->frame.header.sample_rate = 8000;
+ break;
+ case 5:
+ decoder->private_->frame.header.sample_rate = 16000;
+ break;
+ case 6:
+ decoder->private_->frame.header.sample_rate = 22050;
+ break;
+ case 7:
+ decoder->private_->frame.header.sample_rate = 24000;
+ break;
+ case 8:
+ decoder->private_->frame.header.sample_rate = 32000;
+ break;
+ case 9:
+ decoder->private_->frame.header.sample_rate = 44100;
+ break;
+ case 10:
+ decoder->private_->frame.header.sample_rate = 48000;
+ break;
+ case 11:
+ decoder->private_->frame.header.sample_rate = 96000;
+ break;
+ case 12:
+ case 13:
+ case 14:
+ sample_rate_hint = x;
+ break;
+ case 15:
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ x = (unsigned)(raw_header[3] >> 4);
+ if(x & 8) {
+ decoder->private_->frame.header.channels = 2;
+ switch(x & 7) {
+ case 0:
+ decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE;
+ break;
+ case 1:
+ decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE;
+ break;
+ case 2:
+ decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_MID_SIDE;
+ break;
+ default:
+ is_unparseable = true;
+ break;
+ }
+ }
+ else {
+ decoder->private_->frame.header.channels = (unsigned)x + 1;
+ decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT;
+ }
+
+ switch(x = (unsigned)(raw_header[3] & 0x0e) >> 1) {
+ case 0:
+ if(decoder->private_->has_stream_info)
+ decoder->private_->frame.header.bits_per_sample = decoder->private_->stream_info.data.stream_info.bits_per_sample;
+ else
+ is_unparseable = true;
+ break;
+ case 1:
+ decoder->private_->frame.header.bits_per_sample = 8;
+ break;
+ case 2:
+ decoder->private_->frame.header.bits_per_sample = 12;
+ break;
+ case 4:
+ decoder->private_->frame.header.bits_per_sample = 16;
+ break;
+ case 5:
+ decoder->private_->frame.header.bits_per_sample = 20;
+ break;
+ case 6:
+ decoder->private_->frame.header.bits_per_sample = 24;
+ break;
+ case 3:
+ case 7:
+ is_unparseable = true;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ break;
+ }
+
+ /* check to make sure that reserved bit is 0 */
+ if(raw_header[3] & 0x01) /* MAGIC NUMBER */
+ is_unparseable = true;
+
+ /* read the frame's starting sample number (or frame number as the case may be) */
+ if(
+ raw_header[1] & 0x01 ||
+ /*@@@ this clause is a concession to the old way of doing variable blocksize; the only known implementation is flake and can probably be removed without inconveniencing anyone */
+ (decoder->private_->has_stream_info && decoder->private_->stream_info.data.stream_info.min_blocksize != decoder->private_->stream_info.data.stream_info.max_blocksize)
+ ) { /* variable blocksize */
+ if(!FLAC__bitreader_read_utf8_uint64(decoder->private_->input, &xx, raw_header, &raw_header_len))
+ return false; /* read_callback_ sets the state for us */
+ if(xx == FLAC__U64L(0xffffffffffffffff)) { /* i.e. non-UTF8 code... */
+ decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */
+ decoder->private_->cached = true;
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER;
+ decoder->private_->frame.header.number.sample_number = xx;
+ }
+ else { /* fixed blocksize */
+ if(!FLAC__bitreader_read_utf8_uint32(decoder->private_->input, &x, raw_header, &raw_header_len))
+ return false; /* read_callback_ sets the state for us */
+ if(x == 0xffffffff) { /* i.e. non-UTF8 code... */
+ decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */
+ decoder->private_->cached = true;
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER;
+ decoder->private_->frame.header.number.frame_number = x;
+ }
+
+ if(blocksize_hint) {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ raw_header[raw_header_len++] = (FLAC__byte)x;
+ if(blocksize_hint == 7) {
+ FLAC__uint32 _x;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &_x, 8))
+ return false; /* read_callback_ sets the state for us */
+ raw_header[raw_header_len++] = (FLAC__byte)_x;
+ x = (x << 8) | _x;
+ }
+ decoder->private_->frame.header.blocksize = x+1;
+ }
+
+ if(sample_rate_hint) {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ raw_header[raw_header_len++] = (FLAC__byte)x;
+ if(sample_rate_hint != 12) {
+ FLAC__uint32 _x;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &_x, 8))
+ return false; /* read_callback_ sets the state for us */
+ raw_header[raw_header_len++] = (FLAC__byte)_x;
+ x = (x << 8) | _x;
+ }
+ if(sample_rate_hint == 12)
+ decoder->private_->frame.header.sample_rate = x*1000;
+ else if(sample_rate_hint == 13)
+ decoder->private_->frame.header.sample_rate = x;
+ else
+ decoder->private_->frame.header.sample_rate = x*10;
+ }
+
+ /* read the CRC-8 byte */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
+ return false; /* read_callback_ sets the state for us */
+ crc8 = (FLAC__byte)x;
+
+ if(FLAC__crc8(raw_header, raw_header_len) != crc8) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+
+ /* calculate the sample number from the frame number if needed */
+ decoder->private_->next_fixed_block_size = 0;
+ if(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER) {
+ x = decoder->private_->frame.header.number.frame_number;
+ decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER;
+ if(decoder->private_->fixed_block_size)
+ decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->fixed_block_size * (FLAC__uint64)x;
+ else if(decoder->private_->has_stream_info) {
+ if(decoder->private_->stream_info.data.stream_info.min_blocksize == decoder->private_->stream_info.data.stream_info.max_blocksize) {
+ decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->stream_info.data.stream_info.min_blocksize * (FLAC__uint64)x;
+ decoder->private_->next_fixed_block_size = decoder->private_->stream_info.data.stream_info.max_blocksize;
+ }
+ else
+ is_unparseable = true;
+ }
+ else if(x == 0) {
+ decoder->private_->frame.header.number.sample_number = 0;
+ decoder->private_->next_fixed_block_size = decoder->private_->frame.header.blocksize;
+ }
+ else {
+ /* can only get here if the stream has invalid frame numbering and no STREAMINFO, so assume it's not the last (possibly short) frame */
+ decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->frame.header.blocksize * (FLAC__uint64)x;
+ }
+ }
+
+ if(is_unparseable) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+
+ return true;
}
FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode)
{
- FLAC__uint32 x;
- FLAC__bool wasted_bits;
- unsigned i;
-
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) /* MAGIC NUMBER */
- return false; /* read_callback_ sets the state for us */
-
- wasted_bits = (x & 1);
- x &= 0xfe;
-
- if(wasted_bits)
- {
- unsigned u;
- if(!FLAC__bitreader_read_unary_unsigned(decoder->private_->input, &u))
- return false; /* read_callback_ sets the state for us */
- decoder->private_->frame.subframes[channel].wasted_bits = u + 1;
- bps -= decoder->private_->frame.subframes[channel].wasted_bits;
- }
- else
- decoder->private_->frame.subframes[channel].wasted_bits = 0;
-
- /*
- * Lots of magic numbers here
- */
- if(x & 0x80)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- else if(x == 0)
- {
- if(!read_subframe_constant_(decoder, channel, bps, do_full_decode))
- return false;
- }
- else if(x == 2)
- {
- if(!read_subframe_verbatim_(decoder, channel, bps, do_full_decode))
- return false;
- }
- else if(x < 16)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- else if(x <= 24)
- {
- if(!read_subframe_fixed_(decoder, channel, bps, (x >> 1) & 7, do_full_decode))
- return false;
- if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */
- return true;
- }
- else if(x < 64)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- else
- {
- if(!read_subframe_lpc_(decoder, channel, bps, ((x >> 1) & 31) + 1, do_full_decode))
- return false;
- if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */
- return true;
- }
-
- if(wasted_bits && do_full_decode)
- {
- x = decoder->private_->frame.subframes[channel].wasted_bits;
- for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
- decoder->private_->output[channel][i] <<= x;
- }
-
- return true;
+ FLAC__uint32 x;
+ FLAC__bool wasted_bits;
+ unsigned i;
+
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) /* MAGIC NUMBER */
+ return false; /* read_callback_ sets the state for us */
+
+ wasted_bits = (x & 1);
+ x &= 0xfe;
+
+ if(wasted_bits) {
+ unsigned u;
+ if(!FLAC__bitreader_read_unary_unsigned(decoder->private_->input, &u))
+ return false; /* read_callback_ sets the state for us */
+ decoder->private_->frame.subframes[channel].wasted_bits = u+1;
+ bps -= decoder->private_->frame.subframes[channel].wasted_bits;
+ }
+ else
+ decoder->private_->frame.subframes[channel].wasted_bits = 0;
+
+ /*
+ * Lots of magic numbers here
+ */
+ if(x & 0x80) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ else if(x == 0) {
+ if(!read_subframe_constant_(decoder, channel, bps, do_full_decode))
+ return false;
+ }
+ else if(x == 2) {
+ if(!read_subframe_verbatim_(decoder, channel, bps, do_full_decode))
+ return false;
+ }
+ else if(x < 16) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ else if(x <= 24) {
+ if(!read_subframe_fixed_(decoder, channel, bps, (x>>1)&7, do_full_decode))
+ return false;
+ if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */
+ return true;
+ }
+ else if(x < 64) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ else {
+ if(!read_subframe_lpc_(decoder, channel, bps, ((x>>1)&31)+1, do_full_decode))
+ return false;
+ if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */
+ return true;
+ }
+
+ if(wasted_bits && do_full_decode) {
+ x = decoder->private_->frame.subframes[channel].wasted_bits;
+ for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
+ decoder->private_->output[channel][i] <<= x;
+ }
+
+ return true;
}
FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode)
{
- FLAC__Subframe_Constant *subframe = &decoder->private_->frame.subframes[channel].data.constant;
- FLAC__int32 x;
- unsigned i;
- FLAC__int32 *output = decoder->private_->output[channel];
+ FLAC__Subframe_Constant *subframe = &decoder->private_->frame.subframes[channel].data.constant;
+ FLAC__int32 x;
+ unsigned i;
+ FLAC__int32 *output = decoder->private_->output[channel];
- decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_CONSTANT;
+ decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_CONSTANT;
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps))
- return false; /* read_callback_ sets the state for us */
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps))
+ return false; /* read_callback_ sets the state for us */
- subframe->value = x;
+ subframe->value = x;
- /* decode the subframe */
- if(do_full_decode)
- {
- for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
- output[i] = x;
- }
+ /* decode the subframe */
+ if(do_full_decode) {
+ for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
+ output[i] = x;
+ }
- return true;
+ return true;
}
FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode)
{
- FLAC__Subframe_Fixed *subframe = &decoder->private_->frame.subframes[channel].data.fixed;
- FLAC__int32 i32;
- FLAC__uint32 u32;
- unsigned u;
-
- decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_FIXED;
-
- subframe->residual = decoder->private_->residual[channel];
- subframe->order = order;
-
- /* read warm-up samples */
- for(u = 0; u < order; u++)
- {
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, bps))
- return false; /* read_callback_ sets the state for us */
- subframe->warmup[u] = i32;
- }
-
- /* read entropy coding method info */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN))
- return false; /* read_callback_ sets the state for us */
- subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32;
- switch(subframe->entropy_coding_method.type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
- return false; /* read_callback_ sets the state for us */
- subframe->entropy_coding_method.data.partitioned_rice.order = u32;
- subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel];
- break;
- default:
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
-
- /* read residual */
- switch(subframe->entropy_coding_method.type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!read_residual_partitioned_rice_(decoder, order, subframe->entropy_coding_method.data.partitioned_rice.order, &decoder->private_->partitioned_rice_contents[channel], decoder->private_->residual[channel], /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2))
- return false;
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- /* decode the subframe */
- if(do_full_decode)
- {
- memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order);
- FLAC__fixed_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize - order, order, decoder->private_->output[channel] + order);
- }
-
- return true;
+ FLAC__Subframe_Fixed *subframe = &decoder->private_->frame.subframes[channel].data.fixed;
+ FLAC__int32 i32;
+ FLAC__uint32 u32;
+ unsigned u;
+
+ decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_FIXED;
+
+ subframe->residual = decoder->private_->residual[channel];
+ subframe->order = order;
+
+ /* read warm-up samples */
+ for(u = 0; u < order; u++) {
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, bps))
+ return false; /* read_callback_ sets the state for us */
+ subframe->warmup[u] = i32;
+ }
+
+ /* read entropy coding method info */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32;
+ switch(subframe->entropy_coding_method.type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
+ return false; /* read_callback_ sets the state for us */
+ subframe->entropy_coding_method.data.partitioned_rice.order = u32;
+ subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel];
+ break;
+ default:
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+
+ /* read residual */
+ switch(subframe->entropy_coding_method.type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!read_residual_partitioned_rice_(decoder, order, subframe->entropy_coding_method.data.partitioned_rice.order, &decoder->private_->partitioned_rice_contents[channel], decoder->private_->residual[channel], /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2))
+ return false;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ /* decode the subframe */
+ if(do_full_decode) {
+ memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order);
+ FLAC__fixed_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, order, decoder->private_->output[channel]+order);
+ }
+
+ return true;
}
FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode)
{
- FLAC__Subframe_LPC *subframe = &decoder->private_->frame.subframes[channel].data.lpc;
- FLAC__int32 i32;
- FLAC__uint32 u32;
- unsigned u;
-
- decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_LPC;
-
- subframe->residual = decoder->private_->residual[channel];
- subframe->order = order;
-
- /* read warm-up samples */
- for(u = 0; u < order; u++)
- {
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, bps))
- return false; /* read_callback_ sets the state for us */
- subframe->warmup[u] = i32;
- }
-
- /* read qlp coeff precision */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN))
- return false; /* read_callback_ sets the state for us */
- if(u32 == (1u << FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN) - 1)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- subframe->qlp_coeff_precision = u32 + 1;
-
- /* read qlp shift */
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN))
- return false; /* read_callback_ sets the state for us */
- subframe->quantization_level = i32;
-
- /* read quantized lp coefficiencts */
- for(u = 0; u < order; u++)
- {
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, subframe->qlp_coeff_precision))
- return false; /* read_callback_ sets the state for us */
- subframe->qlp_coeff[u] = i32;
- }
-
- /* read entropy coding method info */
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN))
- return false; /* read_callback_ sets the state for us */
- subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32;
- switch(subframe->entropy_coding_method.type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
- return false; /* read_callback_ sets the state for us */
- subframe->entropy_coding_method.data.partitioned_rice.order = u32;
- subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel];
- break;
- default:
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
-
- /* read residual */
- switch(subframe->entropy_coding_method.type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!read_residual_partitioned_rice_(decoder, order, subframe->entropy_coding_method.data.partitioned_rice.order, &decoder->private_->partitioned_rice_contents[channel], decoder->private_->residual[channel], /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2))
- return false;
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- /* decode the subframe */
- if(do_full_decode)
- {
- memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order);
- /*@@@@@@ technically not pessimistic enough, should be more like
- if( (FLAC__uint64)order * ((((FLAC__uint64)1)<<bps)-1) * ((1<<subframe->qlp_coeff_precision)-1) < (((FLAC__uint64)-1) << 32) )
- */
- if(bps + subframe->qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32)
- if(bps <= 16 && subframe->qlp_coeff_precision <= 16)
- {
- if(order <= 8)
- decoder->private_->local_lpc_restore_signal_16bit_order8(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize - order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel] + order);
- else
- decoder->private_->local_lpc_restore_signal_16bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize - order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel] + order);
- }
- else
- decoder->private_->local_lpc_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize - order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel] + order);
- else
- decoder->private_->local_lpc_restore_signal_64bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize - order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel] + order);
- }
-
- return true;
+ FLAC__Subframe_LPC *subframe = &decoder->private_->frame.subframes[channel].data.lpc;
+ FLAC__int32 i32;
+ FLAC__uint32 u32;
+ unsigned u;
+
+ decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_LPC;
+
+ subframe->residual = decoder->private_->residual[channel];
+ subframe->order = order;
+
+ /* read warm-up samples */
+ for(u = 0; u < order; u++) {
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, bps))
+ return false; /* read_callback_ sets the state for us */
+ subframe->warmup[u] = i32;
+ }
+
+ /* read qlp coeff precision */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN))
+ return false; /* read_callback_ sets the state for us */
+ if(u32 == (1u << FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN) - 1) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ subframe->qlp_coeff_precision = u32+1;
+
+ /* read qlp shift */
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN))
+ return false; /* read_callback_ sets the state for us */
+ subframe->quantization_level = i32;
+
+ /* read quantized lp coefficiencts */
+ for(u = 0; u < order; u++) {
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, subframe->qlp_coeff_precision))
+ return false; /* read_callback_ sets the state for us */
+ subframe->qlp_coeff[u] = i32;
+ }
+
+ /* read entropy coding method info */
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN))
+ return false; /* read_callback_ sets the state for us */
+ subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32;
+ switch(subframe->entropy_coding_method.type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
+ return false; /* read_callback_ sets the state for us */
+ subframe->entropy_coding_method.data.partitioned_rice.order = u32;
+ subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel];
+ break;
+ default:
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+
+ /* read residual */
+ switch(subframe->entropy_coding_method.type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!read_residual_partitioned_rice_(decoder, order, subframe->entropy_coding_method.data.partitioned_rice.order, &decoder->private_->partitioned_rice_contents[channel], decoder->private_->residual[channel], /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2))
+ return false;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ /* decode the subframe */
+ if(do_full_decode) {
+ memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order);
+ /*@@@@@@ technically not pessimistic enough, should be more like
+ if( (FLAC__uint64)order * ((((FLAC__uint64)1)<<bps)-1) * ((1<<subframe->qlp_coeff_precision)-1) < (((FLAC__uint64)-1) << 32) )
+ */
+ if(bps + subframe->qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32)
+ if(bps <= 16 && subframe->qlp_coeff_precision <= 16) {
+ if(order <= 8)
+ decoder->private_->local_lpc_restore_signal_16bit_order8(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order);
+ else
+ decoder->private_->local_lpc_restore_signal_16bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order);
+ }
+ else
+ decoder->private_->local_lpc_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order);
+ else
+ decoder->private_->local_lpc_restore_signal_64bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order);
+ }
+
+ return true;
}
FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode)
{
- FLAC__Subframe_Verbatim *subframe = &decoder->private_->frame.subframes[channel].data.verbatim;
- FLAC__int32 x, *residual = decoder->private_->residual[channel];
- unsigned i;
+ FLAC__Subframe_Verbatim *subframe = &decoder->private_->frame.subframes[channel].data.verbatim;
+ FLAC__int32 x, *residual = decoder->private_->residual[channel];
+ unsigned i;
- decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_VERBATIM;
+ decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_VERBATIM;
- subframe->data = residual;
+ subframe->data = residual;
- for(i = 0; i < decoder->private_->frame.header.blocksize; i++)
- {
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps))
- return false; /* read_callback_ sets the state for us */
- residual[i] = x;
- }
+ for(i = 0; i < decoder->private_->frame.header.blocksize; i++) {
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps))
+ return false; /* read_callback_ sets the state for us */
+ residual[i] = x;
+ }
- /* decode the subframe */
- if(do_full_decode)
- memcpy(decoder->private_->output[channel], subframe->data, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize);
+ /* decode the subframe */
+ if(do_full_decode)
+ memcpy(decoder->private_->output[channel], subframe->data, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize);
- return true;
+ return true;
}
FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended)
{
- FLAC__uint32 rice_parameter;
- int i;
- unsigned partition, sample, u;
- const unsigned partitions = 1u << partition_order;
- const unsigned partition_samples = partition_order > 0 ? decoder->private_->frame.header.blocksize >> partition_order : decoder->private_->frame.header.blocksize - predictor_order;
- const unsigned plen = is_extended ? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN;
- const unsigned pesc = is_extended ? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
-
- /* sanity checks */
- if(partition_order == 0)
- {
- if(decoder->private_->frame.header.blocksize < predictor_order)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- }
- else
- {
- if(partition_samples < predictor_order)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- return true;
- }
- }
-
- if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order)))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- sample = 0;
- for(partition = 0; partition < partitions; partition++)
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, plen))
- return false; /* read_callback_ sets the state for us */
- partitioned_rice_contents->parameters[partition] = rice_parameter;
- if(rice_parameter < pesc)
- {
- partitioned_rice_contents->raw_bits[partition] = 0;
- u = (partition_order == 0 || partition > 0) ? partition_samples : partition_samples - predictor_order;
- if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter))
- return false; /* read_callback_ sets the state for us */
- sample += u;
- }
- else
- {
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN))
- return false; /* read_callback_ sets the state for us */
- partitioned_rice_contents->raw_bits[partition] = rice_parameter;
- for(u = (partition_order == 0 || partition > 0) ? 0 : predictor_order; u < partition_samples; u++, sample++)
- {
- if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i, rice_parameter))
- return false; /* read_callback_ sets the state for us */
- residual[sample] = i;
- }
- }
- }
-
- return true;
+ FLAC__uint32 rice_parameter;
+ int i;
+ unsigned partition, sample, u;
+ const unsigned partitions = 1u << partition_order;
+ const unsigned partition_samples = partition_order > 0? decoder->private_->frame.header.blocksize >> partition_order : decoder->private_->frame.header.blocksize - predictor_order;
+ const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN;
+ const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+
+ /* sanity checks */
+ if(partition_order == 0) {
+ if(decoder->private_->frame.header.blocksize < predictor_order) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ }
+ else {
+ if(partition_samples < predictor_order) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ return true;
+ }
+ }
+
+ if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order))) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ sample = 0;
+ for(partition = 0; partition < partitions; partition++) {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, plen))
+ return false; /* read_callback_ sets the state for us */
+ partitioned_rice_contents->parameters[partition] = rice_parameter;
+ if(rice_parameter < pesc) {
+ partitioned_rice_contents->raw_bits[partition] = 0;
+ u = (partition_order == 0 || partition > 0)? partition_samples : partition_samples - predictor_order;
+ if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter))
+ return false; /* read_callback_ sets the state for us */
+ sample += u;
+ }
+ else {
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN))
+ return false; /* read_callback_ sets the state for us */
+ partitioned_rice_contents->raw_bits[partition] = rice_parameter;
+ for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) {
+ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i, rice_parameter))
+ return false; /* read_callback_ sets the state for us */
+ residual[sample] = i;
+ }
+ }
+ }
+
+ return true;
}
FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder)
{
- if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input))
- {
- FLAC__uint32 zero = 0;
- if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &zero, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input)))
- return false; /* read_callback_ sets the state for us */
- if(zero != 0)
- {
- send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
- decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
- }
- }
- return true;
+ if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)) {
+ FLAC__uint32 zero = 0;
+ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &zero, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input)))
+ return false; /* read_callback_ sets the state for us */
+ if(zero != 0) {
+ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
+ }
+ }
+ return true;
}
FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder *)client_data;
+ FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder *)client_data;
- if(
+ if(
#if FLAC__HAS_OGG
- /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
- !decoder->private_->is_ogg &&
+ /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
+ !decoder->private_->is_ogg &&
#endif
- decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
- )
- {
- *bytes = 0;
- decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
- return false;
- }
- else if(*bytes > 0)
- {
- /* While seeking, it is possible for our seek to land in the
- * middle of audio data that looks exactly like a frame header
- * from a future version of an encoder. When that happens, our
- * error callback will get an
- * FLAC__STREAM_DECODER_UNPARSEABLE_STREAM and increment its
- * unparseable_frame_count. But there is a remote possibility
- * that it is properly synced at such a "future-codec frame",
- * so to make sure, we wait to see many "unparseable" errors in
- * a row before bailing out.
- */
- if(decoder->private_->is_seeking && decoder->private_->unparseable_frame_count > 20)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
- return false;
- }
- else
- {
- const FLAC__StreamDecoderReadStatus status =
+ decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
+ ) {
+ *bytes = 0;
+ decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
+ return false;
+ }
+ else if(*bytes > 0) {
+ /* While seeking, it is possible for our seek to land in the
+ * middle of audio data that looks exactly like a frame header
+ * from a future version of an encoder. When that happens, our
+ * error callback will get an
+ * FLAC__STREAM_DECODER_UNPARSEABLE_STREAM and increment its
+ * unparseable_frame_count. But there is a remote possibility
+ * that it is properly synced at such a "future-codec frame",
+ * so to make sure, we wait to see many "unparseable" errors in
+ * a row before bailing out.
+ */
+ if(decoder->private_->is_seeking && decoder->private_->unparseable_frame_count > 20) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
+ return false;
+ }
+ else {
+ const FLAC__StreamDecoderReadStatus status =
#if FLAC__HAS_OGG
- decoder->private_->is_ogg ?
- read_callback_ogg_aspect_(decoder, buffer, bytes) :
+ decoder->private_->is_ogg?
+ read_callback_ogg_aspect_(decoder, buffer, bytes) :
#endif
- decoder->private_->read_callback(decoder, buffer, bytes, decoder->private_->client_data)
- ;
- if(status == FLAC__STREAM_DECODER_READ_STATUS_ABORT)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
- return false;
- }
- else if(*bytes == 0)
- {
- if(
- status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM ||
- (
+ decoder->private_->read_callback(decoder, buffer, bytes, decoder->private_->client_data)
+ ;
+ if(status == FLAC__STREAM_DECODER_READ_STATUS_ABORT) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
+ return false;
+ }
+ else if(*bytes == 0) {
+ if(
+ status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM ||
+ (
#if FLAC__HAS_OGG
- /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
- !decoder->private_->is_ogg &&
+ /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
+ !decoder->private_->is_ogg &&
#endif
- decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
- )
- )
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
- return false;
- }
- else
- return true;
- }
- else
- return true;
- }
- }
- else
- {
- /* abort to avoid a deadlock */
- decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
- return false;
- }
- /* [1] @@@ HACK NOTE: The end-of-stream checking has to be hacked around
- * for Ogg FLAC. This is because the ogg decoder aspect can lose sync
- * and at the same time hit the end of the stream (for example, seeking
- * to a point that is after the beginning of the last Ogg page). There
- * is no way to report an Ogg sync loss through the callbacks (see note
- * in read_callback_ogg_aspect_()) so it returns CONTINUE with *bytes==0.
- * So to keep the decoder from stopping at this point we gate the call
- * to the eof_callback and let the Ogg decoder aspect set the
- * end-of-stream state when it is needed.
- */
+ decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
+ )
+ ) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ return true;
+ }
+ }
+ else {
+ /* abort to avoid a deadlock */
+ decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
+ return false;
+ }
+ /* [1] @@@ HACK NOTE: The end-of-stream checking has to be hacked around
+ * for Ogg FLAC. This is because the ogg decoder aspect can lose sync
+ * and at the same time hit the end of the stream (for example, seeking
+ * to a point that is after the beginning of the last Ogg page). There
+ * is no way to report an Ogg sync loss through the callbacks (see note
+ * in read_callback_ogg_aspect_()) so it returns CONTINUE with *bytes==0.
+ * So to keep the decoder from stopping at this point we gate the call
+ * to the eof_callback and let the Ogg decoder aspect set the
+ * end-of-stream state when it is needed.
+ */
}
#if FLAC__HAS_OGG
FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes)
{
- switch(FLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data))
- {
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK:
- return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
- /* we don't really have a way to handle lost sync via read
- * callback so we'll let it pass and let the underlying
- * FLAC decoder catch the error
- */
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC:
- return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM:
- return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC:
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION:
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT:
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR:
- case FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR:
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
- default:
- FLAC__ASSERT(0);
- /* double protection */
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
- }
+ switch(FLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data)) {
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK:
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ /* we don't really have a way to handle lost sync via read
+ * callback so we'll let it pass and let the underlying
+ * FLAC decoder catch the error
+ */
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC:
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM:
+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC:
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION:
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT:
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR:
+ case FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR:
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ default:
+ FLAC__ASSERT(0);
+ /* double protection */
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ }
}
FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder*)void_decoder;
-
- switch(decoder->private_->read_callback(decoder, buffer, bytes, client_data))
- {
- case FLAC__STREAM_DECODER_READ_STATUS_CONTINUE:
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK;
- case FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM:
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM;
- case FLAC__STREAM_DECODER_READ_STATUS_ABORT:
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
- default:
- /* double protection: */
- FLAC__ASSERT(0);
- return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
- }
+ FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder*)void_decoder;
+
+ switch(decoder->private_->read_callback(decoder, buffer, bytes, client_data)) {
+ case FLAC__STREAM_DECODER_READ_STATUS_CONTINUE:
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK;
+ case FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM:
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM;
+ case FLAC__STREAM_DECODER_READ_STATUS_ABORT:
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
+ default:
+ /* double protection: */
+ FLAC__ASSERT(0);
+ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
+ }
}
#endif
FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[])
{
- if(decoder->private_->is_seeking)
- {
- FLAC__uint64 this_frame_sample = frame->header.number.sample_number;
- FLAC__uint64 next_frame_sample = this_frame_sample + (FLAC__uint64)frame->header.blocksize;
- FLAC__uint64 target_sample = decoder->private_->target_sample;
+ if(decoder->private_->is_seeking) {
+ FLAC__uint64 this_frame_sample = frame->header.number.sample_number;
+ FLAC__uint64 next_frame_sample = this_frame_sample + (FLAC__uint64)frame->header.blocksize;
+ FLAC__uint64 target_sample = decoder->private_->target_sample;
- FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
+ FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
#if FLAC__HAS_OGG
- decoder->private_->got_a_frame = true;
+ decoder->private_->got_a_frame = true;
#endif
- decoder->private_->last_frame = *frame; /* save the frame */
- if(this_frame_sample <= target_sample && target_sample < next_frame_sample) /* we hit our target frame */
- {
- unsigned delta = (unsigned)(target_sample - this_frame_sample);
- /* kick out of seek mode */
- decoder->private_->is_seeking = false;
- /* shift out the samples before target_sample */
- if(delta > 0)
- {
- unsigned channel;
- const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS];
- for(channel = 0; channel < frame->header.channels; channel++)
- newbuffer[channel] = buffer[channel] + delta;
- decoder->private_->last_frame.header.blocksize -= delta;
- decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta;
- /* write the relevant samples */
- return decoder->private_->write_callback(decoder, &decoder->private_->last_frame, newbuffer, decoder->private_->client_data);
- }
- else
- {
- /* write the relevant samples */
- return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data);
- }
- }
- else
- {
- return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
- }
- }
- else
- {
- /*
- * If we never got STREAMINFO, turn off MD5 checking to save
- * cycles since we don't have a sum to compare to anyway
- */
- if(!decoder->private_->has_stream_info)
- decoder->private_->do_md5_checking = false;
- if(decoder->private_->do_md5_checking)
- {
- if(!FLAC__MD5Accumulate(&decoder->private_->md5context, buffer, frame->header.channels, frame->header.blocksize, (frame->header.bits_per_sample + 7) / 8))
- return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
- }
- return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data);
- }
+ decoder->private_->last_frame = *frame; /* save the frame */
+ if(this_frame_sample <= target_sample && target_sample < next_frame_sample) { /* we hit our target frame */
+ unsigned delta = (unsigned)(target_sample - this_frame_sample);
+ /* kick out of seek mode */
+ decoder->private_->is_seeking = false;
+ /* shift out the samples before target_sample */
+ if(delta > 0) {
+ unsigned channel;
+ const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS];
+ for(channel = 0; channel < frame->header.channels; channel++)
+ newbuffer[channel] = buffer[channel] + delta;
+ decoder->private_->last_frame.header.blocksize -= delta;
+ decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta;
+ /* write the relevant samples */
+ return decoder->private_->write_callback(decoder, &decoder->private_->last_frame, newbuffer, decoder->private_->client_data);
+ }
+ else {
+ /* write the relevant samples */
+ return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data);
+ }
+ }
+ else {
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+ }
+ }
+ else {
+ /*
+ * If we never got STREAMINFO, turn off MD5 checking to save
+ * cycles since we don't have a sum to compare to anyway
+ */
+ if(!decoder->private_->has_stream_info)
+ decoder->private_->do_md5_checking = false;
+ if(decoder->private_->do_md5_checking) {
+ if(!FLAC__MD5Accumulate(&decoder->private_->md5context, buffer, frame->header.channels, frame->header.blocksize, (frame->header.bits_per_sample+7) / 8))
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+ }
+ return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data);
+ }
}
void send_error_to_client_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status)
{
- if(!decoder->private_->is_seeking)
- decoder->private_->error_callback(decoder, status, decoder->private_->client_data);
- else if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM)
- decoder->private_->unparseable_frame_count++;
+ if(!decoder->private_->is_seeking)
+ decoder->private_->error_callback(decoder, status, decoder->private_->client_data);
+ else if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM)
+ decoder->private_->unparseable_frame_count++;
}
FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample)
{
- FLAC__uint64 first_frame_offset = decoder->private_->first_frame_offset, lower_bound, upper_bound, lower_bound_sample, upper_bound_sample, this_frame_sample;
- FLAC__int64 pos = -1;
- int i;
- unsigned approx_bytes_per_frame;
- FLAC__bool first_seek = true;
- const FLAC__uint64 total_samples = FLAC__stream_decoder_get_total_samples(decoder);
- const unsigned min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize;
- const unsigned max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize;
- const unsigned max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize;
- const unsigned min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize;
- /* take these from the current frame in case they've changed mid-stream */
- unsigned channels = FLAC__stream_decoder_get_channels(decoder);
- unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder);
- const FLAC__StreamMetadata_SeekTable *seek_table = decoder->private_->has_seek_table ? &decoder->private_->seek_table.data.seek_table : 0;
-
- /* use values from stream info if we didn't decode a frame */
- if(channels == 0)
- channels = decoder->private_->stream_info.data.stream_info.channels;
- if(bps == 0)
- bps = decoder->private_->stream_info.data.stream_info.bits_per_sample;
-
- /* we are just guessing here */
- if(max_framesize > 0)
- approx_bytes_per_frame = (max_framesize + min_framesize) / 2 + 1;
- /*
- * Check if it's a known fixed-blocksize stream. Note that though
- * the spec doesn't allow zeroes in the STREAMINFO block, we may
- * never get a STREAMINFO block when decoding so the value of
- * min_blocksize might be zero.
- */
- else if(min_blocksize == max_blocksize && min_blocksize > 0)
- {
- /* note there are no () around 'bps/8' to keep precision up since it's an integer calulation */
- approx_bytes_per_frame = min_blocksize * channels * bps / 8 + 64;
- }
- else
- approx_bytes_per_frame = 4096 * channels * bps / 8 + 64;
-
- /*
- * First, we set an upper and lower bound on where in the
- * stream we will search. For now we assume the worst case
- * scenario, which is our best guess at the beginning of
- * the first frame and end of the stream.
- */
- lower_bound = first_frame_offset;
- lower_bound_sample = 0;
- upper_bound = stream_length;
- upper_bound_sample = total_samples > 0 ? total_samples : target_sample /*estimate it*/;
-
- /*
- * Now we refine the bounds if we have a seektable with
- * suitable points. Note that according to the spec they
- * must be ordered by ascending sample number.
- *
- * Note: to protect against invalid seek tables we will ignore points
- * that have frame_samples==0 or sample_number>=total_samples
- */
- if(seek_table)
- {
- FLAC__uint64 new_lower_bound = lower_bound;
- FLAC__uint64 new_upper_bound = upper_bound;
- FLAC__uint64 new_lower_bound_sample = lower_bound_sample;
- FLAC__uint64 new_upper_bound_sample = upper_bound_sample;
-
- /* find the closest seek point <= target_sample, if it exists */
- for(i = (int)seek_table->num_points - 1; i >= 0; i--)
- {
- if(
- seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
- seek_table->points[i].frame_samples > 0 && /* defense against bad seekpoints */
- (total_samples <= 0 || seek_table->points[i].sample_number < total_samples) && /* defense against bad seekpoints */
- seek_table->points[i].sample_number <= target_sample
- )
- break;
- }
- if(i >= 0) /* i.e. we found a suitable seek point... */
- {
- new_lower_bound = first_frame_offset + seek_table->points[i].stream_offset;
- new_lower_bound_sample = seek_table->points[i].sample_number;
- }
-
- /* find the closest seek point > target_sample, if it exists */
- for(i = 0; i < (int)seek_table->num_points; i++)
- {
- if(
- seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
- seek_table->points[i].frame_samples > 0 && /* defense against bad seekpoints */
- (total_samples <= 0 || seek_table->points[i].sample_number < total_samples) && /* defense against bad seekpoints */
- seek_table->points[i].sample_number > target_sample
- )
- break;
- }
- if(i < (int)seek_table->num_points) /* i.e. we found a suitable seek point... */
- {
- new_upper_bound = first_frame_offset + seek_table->points[i].stream_offset;
- new_upper_bound_sample = seek_table->points[i].sample_number;
- }
- /* final protection against unsorted seek tables; keep original values if bogus */
- if(new_upper_bound >= new_lower_bound)
- {
- lower_bound = new_lower_bound;
- upper_bound = new_upper_bound;
- lower_bound_sample = new_lower_bound_sample;
- upper_bound_sample = new_upper_bound_sample;
- }
- }
-
- FLAC__ASSERT(upper_bound_sample >= lower_bound_sample);
- /* there are 2 insidious ways that the following equality occurs, which
- * we need to fix:
- * 1) total_samples is 0 (unknown) and target_sample is 0
- * 2) total_samples is 0 (unknown) and target_sample happens to be
- * exactly equal to the last seek point in the seek table; this
- * means there is no seek point above it, and upper_bound_samples
- * remains equal to the estimate (of target_samples) we made above
- * in either case it does not hurt to move upper_bound_sample up by 1
- */
- if(upper_bound_sample == lower_bound_sample)
- upper_bound_sample++;
-
- decoder->private_->target_sample = target_sample;
- while(1)
- {
- /* check if the bounds are still ok */
- if(lower_bound_sample >= upper_bound_sample || lower_bound > upper_bound)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
+ FLAC__uint64 first_frame_offset = decoder->private_->first_frame_offset, lower_bound, upper_bound, lower_bound_sample, upper_bound_sample, this_frame_sample;
+ FLAC__int64 pos = -1;
+ int i;
+ unsigned approx_bytes_per_frame;
+ FLAC__bool first_seek = true;
+ const FLAC__uint64 total_samples = FLAC__stream_decoder_get_total_samples(decoder);
+ const unsigned min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize;
+ const unsigned max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize;
+ const unsigned max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize;
+ const unsigned min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize;
+ /* take these from the current frame in case they've changed mid-stream */
+ unsigned channels = FLAC__stream_decoder_get_channels(decoder);
+ unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder);
+ const FLAC__StreamMetadata_SeekTable *seek_table = decoder->private_->has_seek_table? &decoder->private_->seek_table.data.seek_table : 0;
+
+ /* use values from stream info if we didn't decode a frame */
+ if(channels == 0)
+ channels = decoder->private_->stream_info.data.stream_info.channels;
+ if(bps == 0)
+ bps = decoder->private_->stream_info.data.stream_info.bits_per_sample;
+
+ /* we are just guessing here */
+ if(max_framesize > 0)
+ approx_bytes_per_frame = (max_framesize + min_framesize) / 2 + 1;
+ /*
+ * Check if it's a known fixed-blocksize stream. Note that though
+ * the spec doesn't allow zeroes in the STREAMINFO block, we may
+ * never get a STREAMINFO block when decoding so the value of
+ * min_blocksize might be zero.
+ */
+ else if(min_blocksize == max_blocksize && min_blocksize > 0) {
+ /* note there are no () around 'bps/8' to keep precision up since it's an integer calulation */
+ approx_bytes_per_frame = min_blocksize * channels * bps/8 + 64;
+ }
+ else
+ approx_bytes_per_frame = 4096 * channels * bps/8 + 64;
+
+ /*
+ * First, we set an upper and lower bound on where in the
+ * stream we will search. For now we assume the worst case
+ * scenario, which is our best guess at the beginning of
+ * the first frame and end of the stream.
+ */
+ lower_bound = first_frame_offset;
+ lower_bound_sample = 0;
+ upper_bound = stream_length;
+ upper_bound_sample = total_samples > 0 ? total_samples : target_sample /*estimate it*/;
+
+ /*
+ * Now we refine the bounds if we have a seektable with
+ * suitable points. Note that according to the spec they
+ * must be ordered by ascending sample number.
+ *
+ * Note: to protect against invalid seek tables we will ignore points
+ * that have frame_samples==0 or sample_number>=total_samples
+ */
+ if(seek_table) {
+ FLAC__uint64 new_lower_bound = lower_bound;
+ FLAC__uint64 new_upper_bound = upper_bound;
+ FLAC__uint64 new_lower_bound_sample = lower_bound_sample;
+ FLAC__uint64 new_upper_bound_sample = upper_bound_sample;
+
+ /* find the closest seek point <= target_sample, if it exists */
+ for(i = (int)seek_table->num_points - 1; i >= 0; i--) {
+ if(
+ seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
+ seek_table->points[i].frame_samples > 0 && /* defense against bad seekpoints */
+ (total_samples <= 0 || seek_table->points[i].sample_number < total_samples) && /* defense against bad seekpoints */
+ seek_table->points[i].sample_number <= target_sample
+ )
+ break;
+ }
+ if(i >= 0) { /* i.e. we found a suitable seek point... */
+ new_lower_bound = first_frame_offset + seek_table->points[i].stream_offset;
+ new_lower_bound_sample = seek_table->points[i].sample_number;
+ }
+
+ /* find the closest seek point > target_sample, if it exists */
+ for(i = 0; i < (int)seek_table->num_points; i++) {
+ if(
+ seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
+ seek_table->points[i].frame_samples > 0 && /* defense against bad seekpoints */
+ (total_samples <= 0 || seek_table->points[i].sample_number < total_samples) && /* defense against bad seekpoints */
+ seek_table->points[i].sample_number > target_sample
+ )
+ break;
+ }
+ if(i < (int)seek_table->num_points) { /* i.e. we found a suitable seek point... */
+ new_upper_bound = first_frame_offset + seek_table->points[i].stream_offset;
+ new_upper_bound_sample = seek_table->points[i].sample_number;
+ }
+ /* final protection against unsorted seek tables; keep original values if bogus */
+ if(new_upper_bound >= new_lower_bound) {
+ lower_bound = new_lower_bound;
+ upper_bound = new_upper_bound;
+ lower_bound_sample = new_lower_bound_sample;
+ upper_bound_sample = new_upper_bound_sample;
+ }
+ }
+
+ FLAC__ASSERT(upper_bound_sample >= lower_bound_sample);
+ /* there are 2 insidious ways that the following equality occurs, which
+ * we need to fix:
+ * 1) total_samples is 0 (unknown) and target_sample is 0
+ * 2) total_samples is 0 (unknown) and target_sample happens to be
+ * exactly equal to the last seek point in the seek table; this
+ * means there is no seek point above it, and upper_bound_samples
+ * remains equal to the estimate (of target_samples) we made above
+ * in either case it does not hurt to move upper_bound_sample up by 1
+ */
+ if(upper_bound_sample == lower_bound_sample)
+ upper_bound_sample++;
+
+ decoder->private_->target_sample = target_sample;
+ while(1) {
+ /* check if the bounds are still ok */
+ if (lower_bound_sample >= upper_bound_sample || lower_bound > upper_bound) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#if defined _MSC_VER || defined __MINGW32__
- /* with VC++ you have to spoon feed it the casting */
- pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(FLAC__int64)(target_sample - lower_bound_sample) / (FLAC__double)(FLAC__int64)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(FLAC__int64)(upper_bound - lower_bound)) - approx_bytes_per_frame;
+ /* with VC++ you have to spoon feed it the casting */
+ pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(FLAC__int64)(target_sample - lower_bound_sample) / (FLAC__double)(FLAC__int64)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(FLAC__int64)(upper_bound - lower_bound)) - approx_bytes_per_frame;
#else
- pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(target_sample - lower_bound_sample) / (FLAC__double)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(upper_bound - lower_bound)) - approx_bytes_per_frame;
+ pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(target_sample - lower_bound_sample) / (FLAC__double)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(upper_bound - lower_bound)) - approx_bytes_per_frame;
#endif
#else
- /* a little less accurate: */
- if(upper_bound - lower_bound < 0xffffffff)
- pos = (FLAC__int64)lower_bound + (FLAC__int64)(((target_sample - lower_bound_sample) * (upper_bound - lower_bound)) / (upper_bound_sample - lower_bound_sample)) - approx_bytes_per_frame;
- else /* @@@ WATCHOUT, ~2TB limit */
- pos = (FLAC__int64)lower_bound + (FLAC__int64)((((target_sample - lower_bound_sample) >> 8) * ((upper_bound - lower_bound) >> 8)) / ((upper_bound_sample - lower_bound_sample) >> 16)) - approx_bytes_per_frame;
+ /* a little less accurate: */
+ if(upper_bound - lower_bound < 0xffffffff)
+ pos = (FLAC__int64)lower_bound + (FLAC__int64)(((target_sample - lower_bound_sample) * (upper_bound - lower_bound)) / (upper_bound_sample - lower_bound_sample)) - approx_bytes_per_frame;
+ else /* @@@ WATCHOUT, ~2TB limit */
+ pos = (FLAC__int64)lower_bound + (FLAC__int64)((((target_sample - lower_bound_sample)>>8) * ((upper_bound - lower_bound)>>8)) / ((upper_bound_sample - lower_bound_sample)>>16)) - approx_bytes_per_frame;
#endif
- if(pos >= (FLAC__int64)upper_bound)
- pos = (FLAC__int64)upper_bound - 1;
- if(pos < (FLAC__int64)lower_bound)
- pos = (FLAC__int64)lower_bound;
- if(decoder->private_->seek_callback(decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__STREAM_DECODER_SEEK_STATUS_OK)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- if(!FLAC__stream_decoder_flush(decoder))
- {
- /* above call sets the state for us */
- return false;
- }
- /* Now we need to get a frame. First we need to reset our
- * unparseable_frame_count; if we get too many unparseable
- * frames in a row, the read callback will return
- * FLAC__STREAM_DECODER_READ_STATUS_ABORT, causing
- * FLAC__stream_decoder_process_single() to return false.
- */
- decoder->private_->unparseable_frame_count = 0;
- if(!FLAC__stream_decoder_process_single(decoder))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- /* our write callback will change the state when it gets to the target frame */
- /* actually, we could have got_a_frame if our decoder is at FLAC__STREAM_DECODER_END_OF_STREAM so we need to check for that also */
+ if(pos >= (FLAC__int64)upper_bound)
+ pos = (FLAC__int64)upper_bound - 1;
+ if(pos < (FLAC__int64)lower_bound)
+ pos = (FLAC__int64)lower_bound;
+ if(decoder->private_->seek_callback(decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__STREAM_DECODER_SEEK_STATUS_OK) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ if(!FLAC__stream_decoder_flush(decoder)) {
+ /* above call sets the state for us */
+ return false;
+ }
+ /* Now we need to get a frame. First we need to reset our
+ * unparseable_frame_count; if we get too many unparseable
+ * frames in a row, the read callback will return
+ * FLAC__STREAM_DECODER_READ_STATUS_ABORT, causing
+ * FLAC__stream_decoder_process_single() to return false.
+ */
+ decoder->private_->unparseable_frame_count = 0;
+ if(!FLAC__stream_decoder_process_single(decoder)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ /* our write callback will change the state when it gets to the target frame */
+ /* actually, we could have got_a_frame if our decoder is at FLAC__STREAM_DECODER_END_OF_STREAM so we need to check for that also */
#if 0
- /*@@@@@@ used to be the following; not clear if the check for end of stream is needed anymore */
- if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING && decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM)
- break;
+ /*@@@@@@ used to be the following; not clear if the check for end of stream is needed anymore */
+ if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING && decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM)
+ break;
#endif
- if(!decoder->private_->is_seeking)
- break;
-
- FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
- this_frame_sample = decoder->private_->last_frame.header.number.sample_number;
-
- if(0 == decoder->private_->samples_decoded || (this_frame_sample + decoder->private_->last_frame.header.blocksize >= upper_bound_sample && !first_seek))
- {
- if(pos == (FLAC__int64)lower_bound)
- {
- /* can't move back any more than the first frame, something is fatally wrong */
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- /* our last move backwards wasn't big enough, try again */
- approx_bytes_per_frame = approx_bytes_per_frame ? approx_bytes_per_frame * 2 : 16;
- continue;
- }
- /* allow one seek over upper bound, so we can get a correct upper_bound_sample for streams with unknown total_samples */
- first_seek = false;
-
- /* make sure we are not seeking in corrupted stream */
- if(this_frame_sample < lower_bound_sample)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
-
- /* we need to narrow the search */
- if(target_sample < this_frame_sample)
- {
- upper_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize;
- /*@@@@@@ what will decode position be if at end of stream? */
- if(!FLAC__stream_decoder_get_decode_position(decoder, &upper_bound))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- approx_bytes_per_frame = (unsigned)(2 * (upper_bound - pos) / 3 + 16);
- }
- else /* target_sample >= this_frame_sample + this frame's blocksize */
- {
- lower_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize;
- if(!FLAC__stream_decoder_get_decode_position(decoder, &lower_bound))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- approx_bytes_per_frame = (unsigned)(2 * (lower_bound - pos) / 3 + 16);
- }
- }
-
- return true;
+ if(!decoder->private_->is_seeking)
+ break;
+
+ FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
+ this_frame_sample = decoder->private_->last_frame.header.number.sample_number;
+
+ if (0 == decoder->private_->samples_decoded || (this_frame_sample + decoder->private_->last_frame.header.blocksize >= upper_bound_sample && !first_seek)) {
+ if (pos == (FLAC__int64)lower_bound) {
+ /* can't move back any more than the first frame, something is fatally wrong */
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ /* our last move backwards wasn't big enough, try again */
+ approx_bytes_per_frame = approx_bytes_per_frame? approx_bytes_per_frame * 2 : 16;
+ continue;
+ }
+ /* allow one seek over upper bound, so we can get a correct upper_bound_sample for streams with unknown total_samples */
+ first_seek = false;
+
+ /* make sure we are not seeking in corrupted stream */
+ if (this_frame_sample < lower_bound_sample) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+
+ /* we need to narrow the search */
+ if(target_sample < this_frame_sample) {
+ upper_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize;
+/*@@@@@@ what will decode position be if at end of stream? */
+ if(!FLAC__stream_decoder_get_decode_position(decoder, &upper_bound)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ approx_bytes_per_frame = (unsigned)(2 * (upper_bound - pos) / 3 + 16);
+ }
+ else { /* target_sample >= this_frame_sample + this frame's blocksize */
+ lower_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize;
+ if(!FLAC__stream_decoder_get_decode_position(decoder, &lower_bound)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ approx_bytes_per_frame = (unsigned)(2 * (lower_bound - pos) / 3 + 16);
+ }
+ }
+
+ return true;
}
#if FLAC__HAS_OGG
FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample)
{
- FLAC__uint64 left_pos = 0, right_pos = stream_length;
- FLAC__uint64 left_sample = 0, right_sample = FLAC__stream_decoder_get_total_samples(decoder);
- FLAC__uint64 this_frame_sample = (FLAC__uint64)0 - 1;
- FLAC__uint64 pos = 0; /* only initialized to avoid compiler warning */
- FLAC__bool did_a_seek;
- unsigned iteration = 0;
-
- /* In the first iterations, we will calculate the target byte position
- * by the distance from the target sample to left_sample and
- * right_sample (let's call it "proportional search"). After that, we
- * will switch to binary search.
- */
- unsigned BINARY_SEARCH_AFTER_ITERATION = 2;
-
- /* We will switch to a linear search once our current sample is less
- * than this number of samples ahead of the target sample
- */
- static const FLAC__uint64 LINEAR_SEARCH_WITHIN_SAMPLES = FLAC__MAX_BLOCK_SIZE * 2;
-
- /* If the total number of samples is unknown, use a large value, and
- * force binary search immediately.
- */
- if(right_sample == 0)
- {
- right_sample = (FLAC__uint64)(-1);
- BINARY_SEARCH_AFTER_ITERATION = 0;
- }
-
- decoder->private_->target_sample = target_sample;
- for(; ; iteration++)
- {
- if(iteration == 0 || this_frame_sample > target_sample || target_sample - this_frame_sample > LINEAR_SEARCH_WITHIN_SAMPLES)
- {
- if(iteration >= BINARY_SEARCH_AFTER_ITERATION)
- {
- pos = (right_pos + left_pos) / 2;
- }
- else
- {
+ FLAC__uint64 left_pos = 0, right_pos = stream_length;
+ FLAC__uint64 left_sample = 0, right_sample = FLAC__stream_decoder_get_total_samples(decoder);
+ FLAC__uint64 this_frame_sample = (FLAC__uint64)0 - 1;
+ FLAC__uint64 pos = 0; /* only initialized to avoid compiler warning */
+ FLAC__bool did_a_seek;
+ unsigned iteration = 0;
+
+ /* In the first iterations, we will calculate the target byte position
+ * by the distance from the target sample to left_sample and
+ * right_sample (let's call it "proportional search"). After that, we
+ * will switch to binary search.
+ */
+ unsigned BINARY_SEARCH_AFTER_ITERATION = 2;
+
+ /* We will switch to a linear search once our current sample is less
+ * than this number of samples ahead of the target sample
+ */
+ static const FLAC__uint64 LINEAR_SEARCH_WITHIN_SAMPLES = FLAC__MAX_BLOCK_SIZE * 2;
+
+ /* If the total number of samples is unknown, use a large value, and
+ * force binary search immediately.
+ */
+ if(right_sample == 0) {
+ right_sample = (FLAC__uint64)(-1);
+ BINARY_SEARCH_AFTER_ITERATION = 0;
+ }
+
+ decoder->private_->target_sample = target_sample;
+ for( ; ; iteration++) {
+ if (iteration == 0 || this_frame_sample > target_sample || target_sample - this_frame_sample > LINEAR_SEARCH_WITHIN_SAMPLES) {
+ if (iteration >= BINARY_SEARCH_AFTER_ITERATION) {
+ pos = (right_pos + left_pos) / 2;
+ }
+ else {
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#if defined _MSC_VER || defined __MINGW32__
- /* with MSVC you have to spoon feed it the casting */
- pos = (FLAC__uint64)((FLAC__double)(FLAC__int64)(target_sample - left_sample) / (FLAC__double)(FLAC__int64)(right_sample - left_sample) * (FLAC__double)(FLAC__int64)(right_pos - left_pos));
+ /* with MSVC you have to spoon feed it the casting */
+ pos = (FLAC__uint64)((FLAC__double)(FLAC__int64)(target_sample - left_sample) / (FLAC__double)(FLAC__int64)(right_sample - left_sample) * (FLAC__double)(FLAC__int64)(right_pos - left_pos));
#else
- pos = (FLAC__uint64)((FLAC__double)(target_sample - left_sample) / (FLAC__double)(right_sample - left_sample) * (FLAC__double)(right_pos - left_pos));
+ pos = (FLAC__uint64)((FLAC__double)(target_sample - left_sample) / (FLAC__double)(right_sample - left_sample) * (FLAC__double)(right_pos - left_pos));
#endif
#else
- /* a little less accurate: */
- if((target_sample - left_sample <= 0xffffffff) && (right_pos - left_pos <= 0xffffffff))
- pos = (FLAC__int64)(((target_sample - left_sample) * (right_pos - left_pos)) / (right_sample - left_sample));
- else /* @@@ WATCHOUT, ~2TB limit */
- pos = (FLAC__int64)((((target_sample - left_sample) >> 8) * ((right_pos - left_pos) >> 8)) / ((right_sample - left_sample) >> 16));
+ /* a little less accurate: */
+ if ((target_sample-left_sample <= 0xffffffff) && (right_pos-left_pos <= 0xffffffff))
+ pos = (FLAC__int64)(((target_sample-left_sample) * (right_pos-left_pos)) / (right_sample-left_sample));
+ else /* @@@ WATCHOUT, ~2TB limit */
+ pos = (FLAC__int64)((((target_sample-left_sample)>>8) * ((right_pos-left_pos)>>8)) / ((right_sample-left_sample)>>16));
#endif
- /* @@@ TODO: might want to limit pos to some distance
- * before EOF, to make sure we land before the last frame,
- * thereby getting a this_frame_sample and so having a better
- * estimate.
- */
- }
-
- /* physical seek */
- if(decoder->private_->seek_callback((FLAC__StreamDecoder*)decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__STREAM_DECODER_SEEK_STATUS_OK)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- if(!FLAC__stream_decoder_flush(decoder))
- {
- /* above call sets the state for us */
- return false;
- }
- did_a_seek = true;
- }
- else
- did_a_seek = false;
-
- decoder->private_->got_a_frame = false;
- if(!FLAC__stream_decoder_process_single(decoder))
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- if(!decoder->private_->got_a_frame)
- {
- if(did_a_seek)
- {
- /* this can happen if we seek to a point after the last frame; we drop
- * to binary search right away in this case to avoid any wasted
- * iterations of proportional search.
- */
- right_pos = pos;
- BINARY_SEARCH_AFTER_ITERATION = 0;
- }
- else
- {
- /* this can probably only happen if total_samples is unknown and the
- * target_sample is past the end of the stream
- */
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- }
- /* our write callback will change the state when it gets to the target frame */
- else if(!decoder->private_->is_seeking)
- {
- break;
- }
- else
- {
- this_frame_sample = decoder->private_->last_frame.header.number.sample_number;
- FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
-
- if(did_a_seek)
- {
- if(this_frame_sample <= target_sample)
- {
- /* The 'equal' case should not happen, since
- * FLAC__stream_decoder_process_single()
- * should recognize that it has hit the
- * target sample and we would exit through
- * the 'break' above.
- */
- FLAC__ASSERT(this_frame_sample != target_sample);
-
- left_sample = this_frame_sample;
- /* sanity check to avoid infinite loop */
- if(left_pos == pos)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- left_pos = pos;
- }
- else if(this_frame_sample > target_sample)
- {
- right_sample = this_frame_sample;
- /* sanity check to avoid infinite loop */
- if(right_pos == pos)
- {
- decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
- return false;
- }
- right_pos = pos;
- }
- }
- }
- }
-
- return true;
+ /* @@@ TODO: might want to limit pos to some distance
+ * before EOF, to make sure we land before the last frame,
+ * thereby getting a this_frame_sample and so having a better
+ * estimate.
+ */
+ }
+
+ /* physical seek */
+ if(decoder->private_->seek_callback((FLAC__StreamDecoder*)decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__STREAM_DECODER_SEEK_STATUS_OK) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ if(!FLAC__stream_decoder_flush(decoder)) {
+ /* above call sets the state for us */
+ return false;
+ }
+ did_a_seek = true;
+ }
+ else
+ did_a_seek = false;
+
+ decoder->private_->got_a_frame = false;
+ if(!FLAC__stream_decoder_process_single(decoder)) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ if(!decoder->private_->got_a_frame) {
+ if(did_a_seek) {
+ /* this can happen if we seek to a point after the last frame; we drop
+ * to binary search right away in this case to avoid any wasted
+ * iterations of proportional search.
+ */
+ right_pos = pos;
+ BINARY_SEARCH_AFTER_ITERATION = 0;
+ }
+ else {
+ /* this can probably only happen if total_samples is unknown and the
+ * target_sample is past the end of the stream
+ */
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ }
+ /* our write callback will change the state when it gets to the target frame */
+ else if(!decoder->private_->is_seeking) {
+ break;
+ }
+ else {
+ this_frame_sample = decoder->private_->last_frame.header.number.sample_number;
+ FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
+
+ if (did_a_seek) {
+ if (this_frame_sample <= target_sample) {
+ /* The 'equal' case should not happen, since
+ * FLAC__stream_decoder_process_single()
+ * should recognize that it has hit the
+ * target sample and we would exit through
+ * the 'break' above.
+ */
+ FLAC__ASSERT(this_frame_sample != target_sample);
+
+ left_sample = this_frame_sample;
+ /* sanity check to avoid infinite loop */
+ if (left_pos == pos) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ left_pos = pos;
+ }
+ else if(this_frame_sample > target_sample) {
+ right_sample = this_frame_sample;
+ /* sanity check to avoid infinite loop */
+ if (right_pos == pos) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
+ return false;
+ }
+ right_pos = pos;
+ }
+ }
+ }
+ }
+
+ return true;
}
#endif
FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- (void)client_data;
+ (void)client_data;
- if(*bytes > 0)
- {
- *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, decoder->private_->file);
- if(ferror(decoder->private_->file))
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
- else if(*bytes == 0)
- return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
- else
- return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
- }
- else
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
+ if(*bytes > 0) {
+ *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, decoder->private_->file);
+ if(ferror(decoder->private_->file))
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ else if(*bytes == 0)
+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ else
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ }
+ else
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
}
FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
{
- (void)client_data;
+ (void)client_data;
- if(decoder->private_->file == stdin)
- return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
- else if(fseeko(decoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
- return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
- else
- return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
+ if(decoder->private_->file == stdin)
+ return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
+ else if(fseeko(decoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
+ return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
+ else
+ return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
}
FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
{
- off_t pos;
- (void)client_data;
+ off_t pos;
+ (void)client_data;
- if(decoder->private_->file == stdin)
- return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
- else if((pos = ftello(decoder->private_->file)) < 0)
- return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
- else
- {
- *absolute_byte_offset = (FLAC__uint64)pos;
- return FLAC__STREAM_DECODER_TELL_STATUS_OK;
- }
+ if(decoder->private_->file == stdin)
+ return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
+ else if((pos = ftello(decoder->private_->file)) < 0)
+ return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
+ else {
+ *absolute_byte_offset = (FLAC__uint64)pos;
+ return FLAC__STREAM_DECODER_TELL_STATUS_OK;
+ }
}
FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
{
- struct stat filestats;
- (void)client_data;
+ struct stat filestats;
+ (void)client_data;
- if(decoder->private_->file == stdin)
- return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
- else if(fstat(fileno(decoder->private_->file), &filestats) != 0)
- return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
- else
- {
- *stream_length = (FLAC__uint64)filestats.st_size;
- return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
- }
+ if(decoder->private_->file == stdin)
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
+ else if(fstat(fileno(decoder->private_->file), &filestats) != 0)
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
+ else {
+ *stream_length = (FLAC__uint64)filestats.st_size;
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
+ }
}
FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data)
{
- (void)client_data;
+ (void)client_data;
- return feof(decoder->private_->file) ? true : false;
+ return feof(decoder->private_->file)? true : false;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder.c
index 9816a570f..135c1b898 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder.c
@@ -96,53 +96,48 @@
* parameter estimation in this encoder is very good, almost always
* yielding compression within 0.1% of the optimal parameters.
*/
-#undef ENABLE_RICE_PARAMETER_SEARCH
+#undef ENABLE_RICE_PARAMETER_SEARCH
-typedef struct
-{
- FLAC__int32 *data[FLAC__MAX_CHANNELS];
- unsigned size; /* of each data[] in samples */
- unsigned tail;
+typedef struct {
+ FLAC__int32 *data[FLAC__MAX_CHANNELS];
+ unsigned size; /* of each data[] in samples */
+ unsigned tail;
} verify_input_fifo;
-typedef struct
-{
- const FLAC__byte *data;
- unsigned capacity;
- unsigned bytes;
+typedef struct {
+ const FLAC__byte *data;
+ unsigned capacity;
+ unsigned bytes;
} verify_output;
-typedef enum
-{
- ENCODER_IN_MAGIC = 0,
- ENCODER_IN_METADATA = 1,
- ENCODER_IN_AUDIO = 2
+typedef enum {
+ ENCODER_IN_MAGIC = 0,
+ ENCODER_IN_METADATA = 1,
+ ENCODER_IN_AUDIO = 2
} EncoderStateHint;
-static struct CompressionLevels
-{
- FLAC__bool do_mid_side_stereo;
- FLAC__bool loose_mid_side_stereo;
- unsigned max_lpc_order;
- unsigned qlp_coeff_precision;
- FLAC__bool do_qlp_coeff_prec_search;
- FLAC__bool do_escape_coding;
- FLAC__bool do_exhaustive_model_search;
- unsigned min_residual_partition_order;
- unsigned max_residual_partition_order;
- unsigned rice_parameter_search_dist;
-} compression_levels_[] =
-{
- { false, false, 0, 0, false, false, false, 0, 3, 0 },
- { true , true , 0, 0, false, false, false, 0, 3, 0 },
- { true , false, 0, 0, false, false, false, 0, 3, 0 },
- { false, false, 6, 0, false, false, false, 0, 4, 0 },
- { true , true , 8, 0, false, false, false, 0, 4, 0 },
- { true , false, 8, 0, false, false, false, 0, 5, 0 },
- { true , false, 8, 0, false, false, false, 0, 6, 0 },
- { true , false, 8, 0, false, false, true , 0, 6, 0 },
- { true , false, 12, 0, false, false, true , 0, 6, 0 }
+static struct CompressionLevels {
+ FLAC__bool do_mid_side_stereo;
+ FLAC__bool loose_mid_side_stereo;
+ unsigned max_lpc_order;
+ unsigned qlp_coeff_precision;
+ FLAC__bool do_qlp_coeff_prec_search;
+ FLAC__bool do_escape_coding;
+ FLAC__bool do_exhaustive_model_search;
+ unsigned min_residual_partition_order;
+ unsigned max_residual_partition_order;
+ unsigned rice_parameter_search_dist;
+} compression_levels_[] = {
+ { false, false, 0, 0, false, false, false, 0, 3, 0 },
+ { true , true , 0, 0, false, false, false, 0, 3, 0 },
+ { true , false, 0, 0, false, false, false, 0, 3, 0 },
+ { false, false, 6, 0, false, false, false, 0, 4, 0 },
+ { true , true , 8, 0, false, false, false, 0, 4, 0 },
+ { true , false, 8, 0, false, false, false, 0, 5, 0 },
+ { true , false, 8, 0, false, false, false, 0, 6, 0 },
+ { true , false, 8, 0, false, false, true , 0, 6, 0 },
+ { true , false, 12, 0, false, false, true , 0, 6, 0 }
};
@@ -165,155 +160,155 @@ static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fra
static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block);
static FLAC__bool process_subframe_(
- FLAC__StreamEncoder *encoder,
- unsigned min_partition_order,
- unsigned max_partition_order,
- const FLAC__FrameHeader *frame_header,
- unsigned subframe_bps,
- const FLAC__int32 integer_signal[],
- FLAC__Subframe *subframe[2],
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
- FLAC__int32 *residual[2],
- unsigned *best_subframe,
- unsigned *best_bits
+ FLAC__StreamEncoder *encoder,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ const FLAC__FrameHeader *frame_header,
+ unsigned subframe_bps,
+ const FLAC__int32 integer_signal[],
+ FLAC__Subframe *subframe[2],
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
+ FLAC__int32 *residual[2],
+ unsigned *best_subframe,
+ unsigned *best_bits
);
static FLAC__bool add_subframe_(
- FLAC__StreamEncoder *encoder,
- unsigned blocksize,
- unsigned subframe_bps,
- const FLAC__Subframe *subframe,
- FLAC__BitWriter *frame
+ FLAC__StreamEncoder *encoder,
+ unsigned blocksize,
+ unsigned subframe_bps,
+ const FLAC__Subframe *subframe,
+ FLAC__BitWriter *frame
);
static unsigned evaluate_constant_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal,
- unsigned blocksize,
- unsigned subframe_bps,
- FLAC__Subframe *subframe
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal,
+ unsigned blocksize,
+ unsigned subframe_bps,
+ FLAC__Subframe *subframe
);
static unsigned evaluate_fixed_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal[],
- FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned raw_bits_per_partition[],
- unsigned blocksize,
- unsigned subframe_bps,
- unsigned order,
- unsigned rice_parameter,
- unsigned rice_parameter_limit,
- unsigned min_partition_order,
- unsigned max_partition_order,
- FLAC__bool do_escape_coding,
- unsigned rice_parameter_search_dist,
- FLAC__Subframe *subframe,
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal[],
+ FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned raw_bits_per_partition[],
+ unsigned blocksize,
+ unsigned subframe_bps,
+ unsigned order,
+ unsigned rice_parameter,
+ unsigned rice_parameter_limit,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ FLAC__bool do_escape_coding,
+ unsigned rice_parameter_search_dist,
+ FLAC__Subframe *subframe,
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
);
#ifndef FLAC__INTEGER_ONLY_LIBRARY
static unsigned evaluate_lpc_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal[],
- FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned raw_bits_per_partition[],
- const FLAC__real lp_coeff[],
- unsigned blocksize,
- unsigned subframe_bps,
- unsigned order,
- unsigned qlp_coeff_precision,
- unsigned rice_parameter,
- unsigned rice_parameter_limit,
- unsigned min_partition_order,
- unsigned max_partition_order,
- FLAC__bool do_escape_coding,
- unsigned rice_parameter_search_dist,
- FLAC__Subframe *subframe,
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal[],
+ FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned raw_bits_per_partition[],
+ const FLAC__real lp_coeff[],
+ unsigned blocksize,
+ unsigned subframe_bps,
+ unsigned order,
+ unsigned qlp_coeff_precision,
+ unsigned rice_parameter,
+ unsigned rice_parameter_limit,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ FLAC__bool do_escape_coding,
+ unsigned rice_parameter_search_dist,
+ FLAC__Subframe *subframe,
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
);
#endif
static unsigned evaluate_verbatim_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal[],
- unsigned blocksize,
- unsigned subframe_bps,
- FLAC__Subframe *subframe
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal[],
+ unsigned blocksize,
+ unsigned subframe_bps,
+ FLAC__Subframe *subframe
);
static unsigned find_best_partition_order_(
- struct FLAC__StreamEncoderPrivate *private_,
- const FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned raw_bits_per_partition[],
- unsigned residual_samples,
- unsigned predictor_order,
- unsigned rice_parameter,
- unsigned rice_parameter_limit,
- unsigned min_partition_order,
- unsigned max_partition_order,
- unsigned bps,
- FLAC__bool do_escape_coding,
- unsigned rice_parameter_search_dist,
- FLAC__EntropyCodingMethod *best_ecm
+ struct FLAC__StreamEncoderPrivate *private_,
+ const FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned raw_bits_per_partition[],
+ unsigned residual_samples,
+ unsigned predictor_order,
+ unsigned rice_parameter,
+ unsigned rice_parameter_limit,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ unsigned bps,
+ FLAC__bool do_escape_coding,
+ unsigned rice_parameter_search_dist,
+ FLAC__EntropyCodingMethod *best_ecm
);
static void precompute_partition_info_sums_(
- const FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned residual_samples,
- unsigned predictor_order,
- unsigned min_partition_order,
- unsigned max_partition_order,
- unsigned bps
+ const FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned residual_samples,
+ unsigned predictor_order,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ unsigned bps
);
static void precompute_partition_info_escapes_(
- const FLAC__int32 residual[],
- unsigned raw_bits_per_partition[],
- unsigned residual_samples,
- unsigned predictor_order,
- unsigned min_partition_order,
- unsigned max_partition_order
+ const FLAC__int32 residual[],
+ unsigned raw_bits_per_partition[],
+ unsigned residual_samples,
+ unsigned predictor_order,
+ unsigned min_partition_order,
+ unsigned max_partition_order
);
static FLAC__bool set_partitioned_rice_(
#ifdef EXACT_RICE_BITS_CALCULATION
- const FLAC__int32 residual[],
+ const FLAC__int32 residual[],
#endif
- const FLAC__uint64 abs_residual_partition_sums[],
- const unsigned raw_bits_per_partition[],
- const unsigned residual_samples,
- const unsigned predictor_order,
- const unsigned suggested_rice_parameter,
- const unsigned rice_parameter_limit,
- const unsigned rice_parameter_search_dist,
- const unsigned partition_order,
- const FLAC__bool search_for_escapes,
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents,
- unsigned *bits
+ const FLAC__uint64 abs_residual_partition_sums[],
+ const unsigned raw_bits_per_partition[],
+ const unsigned residual_samples,
+ const unsigned predictor_order,
+ const unsigned suggested_rice_parameter,
+ const unsigned rice_parameter_limit,
+ const unsigned rice_parameter_search_dist,
+ const unsigned partition_order,
+ const FLAC__bool search_for_escapes,
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents,
+ unsigned *bits
);
static unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples);
/* verify-related routines: */
static void append_to_verify_fifo_(
- verify_input_fifo *fifo,
- const FLAC__int32 * const input[],
- unsigned input_offset,
- unsigned channels,
- unsigned wide_samples
+ verify_input_fifo *fifo,
+ const FLAC__int32 * const input[],
+ unsigned input_offset,
+ unsigned channels,
+ unsigned wide_samples
);
static void append_to_verify_fifo_interleaved_(
- verify_input_fifo *fifo,
- const FLAC__int32 input[],
- unsigned input_offset,
- unsigned channels,
- unsigned wide_samples
+ verify_input_fifo *fifo,
+ const FLAC__int32 input[],
+ unsigned input_offset,
+ unsigned channels,
+ unsigned wide_samples
);
static FLAC__StreamDecoderReadStatus verify_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
@@ -334,120 +329,117 @@ static FILE *get_binary_stdout_(void);
*
***********************************************************************/
-typedef struct FLAC__StreamEncoderPrivate
-{
- unsigned input_capacity; /* current size (in samples) of the signal and residual buffers */
- FLAC__int32 *integer_signal[FLAC__MAX_CHANNELS]; /* the integer version of the input signal */
- FLAC__int32 *integer_signal_mid_side[2]; /* the integer version of the mid-side input signal (stereo only) */
+typedef struct FLAC__StreamEncoderPrivate {
+ unsigned input_capacity; /* current size (in samples) of the signal and residual buffers */
+ FLAC__int32 *integer_signal[FLAC__MAX_CHANNELS]; /* the integer version of the input signal */
+ FLAC__int32 *integer_signal_mid_side[2]; /* the integer version of the mid-side input signal (stereo only) */
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- FLAC__real *real_signal[FLAC__MAX_CHANNELS]; /* (@@@ currently unused) the floating-point version of the input signal */
- FLAC__real *real_signal_mid_side[2]; /* (@@@ currently unused) the floating-point version of the mid-side input signal (stereo only) */
- FLAC__real *window[FLAC__MAX_APODIZATION_FUNCTIONS]; /* the pre-computed floating-point window for each apodization function */
- FLAC__real *windowed_signal; /* the integer_signal[] * current window[] */
+ FLAC__real *real_signal[FLAC__MAX_CHANNELS]; /* (@@@ currently unused) the floating-point version of the input signal */
+ FLAC__real *real_signal_mid_side[2]; /* (@@@ currently unused) the floating-point version of the mid-side input signal (stereo only) */
+ FLAC__real *window[FLAC__MAX_APODIZATION_FUNCTIONS]; /* the pre-computed floating-point window for each apodization function */
+ FLAC__real *windowed_signal; /* the integer_signal[] * current window[] */
#endif
- unsigned subframe_bps[FLAC__MAX_CHANNELS]; /* the effective bits per sample of the input signal (stream bps - wasted bits) */
- unsigned subframe_bps_mid_side[2]; /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */
- FLAC__int32 *residual_workspace[FLAC__MAX_CHANNELS][2]; /* each channel has a candidate and best workspace where the subframe residual signals will be stored */
- FLAC__int32 *residual_workspace_mid_side[2][2];
- FLAC__Subframe subframe_workspace[FLAC__MAX_CHANNELS][2];
- FLAC__Subframe subframe_workspace_mid_side[2][2];
- FLAC__Subframe *subframe_workspace_ptr[FLAC__MAX_CHANNELS][2];
- FLAC__Subframe *subframe_workspace_ptr_mid_side[2][2];
- FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace[FLAC__MAX_CHANNELS][2];
- FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace_mid_side[FLAC__MAX_CHANNELS][2];
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr[FLAC__MAX_CHANNELS][2];
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr_mid_side[FLAC__MAX_CHANNELS][2];
- unsigned best_subframe[FLAC__MAX_CHANNELS]; /* index (0 or 1) into 2nd dimension of the above workspaces */
- unsigned best_subframe_mid_side[2];
- unsigned best_subframe_bits[FLAC__MAX_CHANNELS]; /* size in bits of the best subframe for each channel */
- unsigned best_subframe_bits_mid_side[2];
- FLAC__uint64 *abs_residual_partition_sums; /* workspace where the sum of abs(candidate residual) for each partition is stored */
- unsigned *raw_bits_per_partition; /* workspace where the sum of silog2(candidate residual) for each partition is stored */
- FLAC__BitWriter *frame; /* the current frame being worked on */
- unsigned loose_mid_side_stereo_frames; /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */
- unsigned loose_mid_side_stereo_frame_count; /* number of frames using the current channel assignment */
- FLAC__ChannelAssignment last_channel_assignment;
- FLAC__StreamMetadata streaminfo; /* scratchpad for STREAMINFO as it is built */
- FLAC__StreamMetadata_SeekTable *seek_table; /* pointer into encoder->protected_->metadata_ where the seek table is */
- unsigned current_sample_number;
- unsigned current_frame_number;
- FLAC__MD5Context md5context;
- FLAC__CPUInfo cpuinfo;
+ unsigned subframe_bps[FLAC__MAX_CHANNELS]; /* the effective bits per sample of the input signal (stream bps - wasted bits) */
+ unsigned subframe_bps_mid_side[2]; /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */
+ FLAC__int32 *residual_workspace[FLAC__MAX_CHANNELS][2]; /* each channel has a candidate and best workspace where the subframe residual signals will be stored */
+ FLAC__int32 *residual_workspace_mid_side[2][2];
+ FLAC__Subframe subframe_workspace[FLAC__MAX_CHANNELS][2];
+ FLAC__Subframe subframe_workspace_mid_side[2][2];
+ FLAC__Subframe *subframe_workspace_ptr[FLAC__MAX_CHANNELS][2];
+ FLAC__Subframe *subframe_workspace_ptr_mid_side[2][2];
+ FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace[FLAC__MAX_CHANNELS][2];
+ FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace_mid_side[FLAC__MAX_CHANNELS][2];
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr[FLAC__MAX_CHANNELS][2];
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr_mid_side[FLAC__MAX_CHANNELS][2];
+ unsigned best_subframe[FLAC__MAX_CHANNELS]; /* index (0 or 1) into 2nd dimension of the above workspaces */
+ unsigned best_subframe_mid_side[2];
+ unsigned best_subframe_bits[FLAC__MAX_CHANNELS]; /* size in bits of the best subframe for each channel */
+ unsigned best_subframe_bits_mid_side[2];
+ FLAC__uint64 *abs_residual_partition_sums; /* workspace where the sum of abs(candidate residual) for each partition is stored */
+ unsigned *raw_bits_per_partition; /* workspace where the sum of silog2(candidate residual) for each partition is stored */
+ FLAC__BitWriter *frame; /* the current frame being worked on */
+ unsigned loose_mid_side_stereo_frames; /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */
+ unsigned loose_mid_side_stereo_frame_count; /* number of frames using the current channel assignment */
+ FLAC__ChannelAssignment last_channel_assignment;
+ FLAC__StreamMetadata streaminfo; /* scratchpad for STREAMINFO as it is built */
+ FLAC__StreamMetadata_SeekTable *seek_table; /* pointer into encoder->protected_->metadata_ where the seek table is */
+ unsigned current_sample_number;
+ unsigned current_frame_number;
+ FLAC__MD5Context md5context;
+ FLAC__CPUInfo cpuinfo;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- unsigned(*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+ unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
#else
- unsigned(*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+ unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
#endif
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
- void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
- void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
- void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+ void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
+ void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+ void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+ void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
#endif
- FLAC__bool use_wide_by_block; /* use slow 64-bit versions of some functions because of the block size */
- FLAC__bool use_wide_by_partition; /* use slow 64-bit versions of some functions because of the min partition order and blocksize */
- FLAC__bool use_wide_by_order; /* use slow 64-bit versions of some functions because of the lpc order */
- FLAC__bool disable_constant_subframes;
- FLAC__bool disable_fixed_subframes;
- FLAC__bool disable_verbatim_subframes;
+ FLAC__bool use_wide_by_block; /* use slow 64-bit versions of some functions because of the block size */
+ FLAC__bool use_wide_by_partition; /* use slow 64-bit versions of some functions because of the min partition order and blocksize */
+ FLAC__bool use_wide_by_order; /* use slow 64-bit versions of some functions because of the lpc order */
+ FLAC__bool disable_constant_subframes;
+ FLAC__bool disable_fixed_subframes;
+ FLAC__bool disable_verbatim_subframes;
#if FLAC__HAS_OGG
- FLAC__bool is_ogg;
+ FLAC__bool is_ogg;
#endif
- FLAC__StreamEncoderReadCallback read_callback; /* currently only needed for Ogg FLAC */
- FLAC__StreamEncoderSeekCallback seek_callback;
- FLAC__StreamEncoderTellCallback tell_callback;
- FLAC__StreamEncoderWriteCallback write_callback;
- FLAC__StreamEncoderMetadataCallback metadata_callback;
- FLAC__StreamEncoderProgressCallback progress_callback;
- void *client_data;
- unsigned first_seekpoint_to_check;
- FILE *file; /* only used when encoding to a file */
- FLAC__uint64 bytes_written;
- FLAC__uint64 samples_written;
- unsigned frames_written;
- unsigned total_frames_estimate;
- /* unaligned (original) pointers to allocated data */
- FLAC__int32 *integer_signal_unaligned[FLAC__MAX_CHANNELS];
- FLAC__int32 *integer_signal_mid_side_unaligned[2];
+ FLAC__StreamEncoderReadCallback read_callback; /* currently only needed for Ogg FLAC */
+ FLAC__StreamEncoderSeekCallback seek_callback;
+ FLAC__StreamEncoderTellCallback tell_callback;
+ FLAC__StreamEncoderWriteCallback write_callback;
+ FLAC__StreamEncoderMetadataCallback metadata_callback;
+ FLAC__StreamEncoderProgressCallback progress_callback;
+ void *client_data;
+ unsigned first_seekpoint_to_check;
+ FILE *file; /* only used when encoding to a file */
+ FLAC__uint64 bytes_written;
+ FLAC__uint64 samples_written;
+ unsigned frames_written;
+ unsigned total_frames_estimate;
+ /* unaligned (original) pointers to allocated data */
+ FLAC__int32 *integer_signal_unaligned[FLAC__MAX_CHANNELS];
+ FLAC__int32 *integer_signal_mid_side_unaligned[2];
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- FLAC__real *real_signal_unaligned[FLAC__MAX_CHANNELS]; /* (@@@ currently unused) */
- FLAC__real *real_signal_mid_side_unaligned[2]; /* (@@@ currently unused) */
- FLAC__real *window_unaligned[FLAC__MAX_APODIZATION_FUNCTIONS];
- FLAC__real *windowed_signal_unaligned;
+ FLAC__real *real_signal_unaligned[FLAC__MAX_CHANNELS]; /* (@@@ currently unused) */
+ FLAC__real *real_signal_mid_side_unaligned[2]; /* (@@@ currently unused) */
+ FLAC__real *window_unaligned[FLAC__MAX_APODIZATION_FUNCTIONS];
+ FLAC__real *windowed_signal_unaligned;
#endif
- FLAC__int32 *residual_workspace_unaligned[FLAC__MAX_CHANNELS][2];
- FLAC__int32 *residual_workspace_mid_side_unaligned[2][2];
- FLAC__uint64 *abs_residual_partition_sums_unaligned;
- unsigned *raw_bits_per_partition_unaligned;
- /*
- * These fields have been moved here from private function local
- * declarations merely to save stack space during encoding.
- */
+ FLAC__int32 *residual_workspace_unaligned[FLAC__MAX_CHANNELS][2];
+ FLAC__int32 *residual_workspace_mid_side_unaligned[2][2];
+ FLAC__uint64 *abs_residual_partition_sums_unaligned;
+ unsigned *raw_bits_per_partition_unaligned;
+ /*
+ * These fields have been moved here from private function local
+ * declarations merely to save stack space during encoding.
+ */
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- FLAC__real lp_coeff[FLAC__MAX_LPC_ORDER][FLAC__MAX_LPC_ORDER]; /* from process_subframe_() */
+ FLAC__real lp_coeff[FLAC__MAX_LPC_ORDER][FLAC__MAX_LPC_ORDER]; /* from process_subframe_() */
#endif
- FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_extra[2]; /* from find_best_partition_order_() */
- /*
- * The data for the verify section
- */
- struct
- {
- FLAC__StreamDecoder *decoder;
- EncoderStateHint state_hint;
- FLAC__bool needs_magic_hack;
- verify_input_fifo input_fifo;
- verify_output output;
- struct
- {
- FLAC__uint64 absolute_sample;
- unsigned frame_number;
- unsigned channel;
- unsigned sample;
- FLAC__int32 expected;
- FLAC__int32 got;
- } error_stats;
- } verify;
- FLAC__bool is_being_deleted; /* if true, call to ..._finish() from ..._delete() will not call the callbacks */
+ FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_extra[2]; /* from find_best_partition_order_() */
+ /*
+ * The data for the verify section
+ */
+ struct {
+ FLAC__StreamDecoder *decoder;
+ EncoderStateHint state_hint;
+ FLAC__bool needs_magic_hack;
+ verify_input_fifo input_fifo;
+ verify_output output;
+ struct {
+ FLAC__uint64 absolute_sample;
+ unsigned frame_number;
+ unsigned channel;
+ unsigned sample;
+ FLAC__int32 expected;
+ FLAC__int32 got;
+ } error_stats;
+ } verify;
+ FLAC__bool is_being_deleted; /* if true, call to ..._finish() from ..._delete() will not call the callbacks */
} FLAC__StreamEncoderPrivate;
/***********************************************************************
@@ -456,63 +448,57 @@ typedef struct FLAC__StreamEncoderPrivate
*
***********************************************************************/
-FLAC_API const char * const FLAC__StreamEncoderStateString[] =
-{
- "FLAC__STREAM_ENCODER_OK",
- "FLAC__STREAM_ENCODER_UNINITIALIZED",
- "FLAC__STREAM_ENCODER_OGG_ERROR",
- "FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR",
- "FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA",
- "FLAC__STREAM_ENCODER_CLIENT_ERROR",
- "FLAC__STREAM_ENCODER_IO_ERROR",
- "FLAC__STREAM_ENCODER_FRAMING_ERROR",
- "FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR"
+FLAC_API const char * const FLAC__StreamEncoderStateString[] = {
+ "FLAC__STREAM_ENCODER_OK",
+ "FLAC__STREAM_ENCODER_UNINITIALIZED",
+ "FLAC__STREAM_ENCODER_OGG_ERROR",
+ "FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR",
+ "FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA",
+ "FLAC__STREAM_ENCODER_CLIENT_ERROR",
+ "FLAC__STREAM_ENCODER_IO_ERROR",
+ "FLAC__STREAM_ENCODER_FRAMING_ERROR",
+ "FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR"
};
-FLAC_API const char * const FLAC__StreamEncoderInitStatusString[] =
-{
- "FLAC__STREAM_ENCODER_INIT_STATUS_OK",
- "FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR",
- "FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION",
- "FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER",
- "FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE",
- "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA",
- "FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED"
+FLAC_API const char * const FLAC__StreamEncoderInitStatusString[] = {
+ "FLAC__STREAM_ENCODER_INIT_STATUS_OK",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA",
+ "FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED"
};
-FLAC_API const char * const FLAC__treamEncoderReadStatusString[] =
-{
- "FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE",
- "FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM",
- "FLAC__STREAM_ENCODER_READ_STATUS_ABORT",
- "FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED"
+FLAC_API const char * const FLAC__treamEncoderReadStatusString[] = {
+ "FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE",
+ "FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM",
+ "FLAC__STREAM_ENCODER_READ_STATUS_ABORT",
+ "FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED"
};
-FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[] =
-{
- "FLAC__STREAM_ENCODER_WRITE_STATUS_OK",
- "FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR"
+FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[] = {
+ "FLAC__STREAM_ENCODER_WRITE_STATUS_OK",
+ "FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR"
};
-FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[] =
-{
- "FLAC__STREAM_ENCODER_SEEK_STATUS_OK",
- "FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR",
- "FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED"
+FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[] = {
+ "FLAC__STREAM_ENCODER_SEEK_STATUS_OK",
+ "FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR",
+ "FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED"
};
-FLAC_API const char * const FLAC__StreamEncoderTellStatusString[] =
-{
- "FLAC__STREAM_ENCODER_TELL_STATUS_OK",
- "FLAC__STREAM_ENCODER_TELL_STATUS_ERROR",
- "FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED"
+FLAC_API const char * const FLAC__StreamEncoderTellStatusString[] = {
+ "FLAC__STREAM_ENCODER_TELL_STATUS_OK",
+ "FLAC__STREAM_ENCODER_TELL_STATUS_ERROR",
+ "FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED"
};
/* Number of samples that will be overread to watch for end of stream. By
@@ -535,119 +521,107 @@ static const unsigned OVERREAD_ = 1;
*/
FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void)
{
- FLAC__StreamEncoder *encoder;
- unsigned i;
-
- FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
-
- encoder = (FLAC__StreamEncoder*)calloc(1, sizeof(FLAC__StreamEncoder));
- if(encoder == 0)
- {
- return 0;
- }
-
- encoder->protected_ = (FLAC__StreamEncoderProtected*)calloc(1, sizeof(FLAC__StreamEncoderProtected));
- if(encoder->protected_ == 0)
- {
- free(encoder);
- return 0;
- }
-
- encoder->private_ = (FLAC__StreamEncoderPrivate*)calloc(1, sizeof(FLAC__StreamEncoderPrivate));
- if(encoder->private_ == 0)
- {
- free(encoder->protected_);
- free(encoder);
- return 0;
- }
-
- encoder->private_->frame = FLAC__bitwriter_new();
- if(encoder->private_->frame == 0)
- {
- free(encoder->private_);
- free(encoder->protected_);
- free(encoder);
- return 0;
- }
-
- encoder->private_->file = 0;
-
- set_defaults_(encoder);
-
- encoder->private_->is_being_deleted = false;
-
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- encoder->private_->subframe_workspace_ptr[i][0] = &encoder->private_->subframe_workspace[i][0];
- encoder->private_->subframe_workspace_ptr[i][1] = &encoder->private_->subframe_workspace[i][1];
- }
- for(i = 0; i < 2; i++)
- {
- encoder->private_->subframe_workspace_ptr_mid_side[i][0] = &encoder->private_->subframe_workspace_mid_side[i][0];
- encoder->private_->subframe_workspace_ptr_mid_side[i][1] = &encoder->private_->subframe_workspace_mid_side[i][1];
- }
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- encoder->private_->partitioned_rice_contents_workspace_ptr[i][0] = &encoder->private_->partitioned_rice_contents_workspace[i][0];
- encoder->private_->partitioned_rice_contents_workspace_ptr[i][1] = &encoder->private_->partitioned_rice_contents_workspace[i][1];
- }
- for(i = 0; i < 2; i++)
- {
- encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[i][0] = &encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0];
- encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[i][1] = &encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1];
- }
-
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace[i][0]);
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace[i][1]);
- }
- for(i = 0; i < 2; i++)
- {
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]);
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]);
- }
- for(i = 0; i < 2; i++)
- FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_extra[i]);
-
- encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
-
- return encoder;
+ FLAC__StreamEncoder *encoder;
+ unsigned i;
+
+ FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
+
+ encoder = (FLAC__StreamEncoder*)calloc(1, sizeof(FLAC__StreamEncoder));
+ if(encoder == 0) {
+ return 0;
+ }
+
+ encoder->protected_ = (FLAC__StreamEncoderProtected*)calloc(1, sizeof(FLAC__StreamEncoderProtected));
+ if(encoder->protected_ == 0) {
+ free(encoder);
+ return 0;
+ }
+
+ encoder->private_ = (FLAC__StreamEncoderPrivate*)calloc(1, sizeof(FLAC__StreamEncoderPrivate));
+ if(encoder->private_ == 0) {
+ free(encoder->protected_);
+ free(encoder);
+ return 0;
+ }
+
+ encoder->private_->frame = FLAC__bitwriter_new();
+ if(encoder->private_->frame == 0) {
+ free(encoder->private_);
+ free(encoder->protected_);
+ free(encoder);
+ return 0;
+ }
+
+ encoder->private_->file = 0;
+
+ set_defaults_(encoder);
+
+ encoder->private_->is_being_deleted = false;
+
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ encoder->private_->subframe_workspace_ptr[i][0] = &encoder->private_->subframe_workspace[i][0];
+ encoder->private_->subframe_workspace_ptr[i][1] = &encoder->private_->subframe_workspace[i][1];
+ }
+ for(i = 0; i < 2; i++) {
+ encoder->private_->subframe_workspace_ptr_mid_side[i][0] = &encoder->private_->subframe_workspace_mid_side[i][0];
+ encoder->private_->subframe_workspace_ptr_mid_side[i][1] = &encoder->private_->subframe_workspace_mid_side[i][1];
+ }
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ encoder->private_->partitioned_rice_contents_workspace_ptr[i][0] = &encoder->private_->partitioned_rice_contents_workspace[i][0];
+ encoder->private_->partitioned_rice_contents_workspace_ptr[i][1] = &encoder->private_->partitioned_rice_contents_workspace[i][1];
+ }
+ for(i = 0; i < 2; i++) {
+ encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[i][0] = &encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0];
+ encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[i][1] = &encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1];
+ }
+
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace[i][0]);
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace[i][1]);
+ }
+ for(i = 0; i < 2; i++) {
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]);
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]);
+ }
+ for(i = 0; i < 2; i++)
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_extra[i]);
+
+ encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
+
+ return encoder;
}
FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder)
{
- unsigned i;
-
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->protected_);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->private_->frame);
-
- encoder->private_->is_being_deleted = true;
-
- (void)FLAC__stream_encoder_finish(encoder);
-
- if(0 != encoder->private_->verify.decoder)
- FLAC__stream_decoder_delete(encoder->private_->verify.decoder);
-
- for(i = 0; i < FLAC__MAX_CHANNELS; i++)
- {
- FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace[i][0]);
- FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace[i][1]);
- }
- for(i = 0; i < 2; i++)
- {
- FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]);
- FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]);
- }
- for(i = 0; i < 2; i++)
- FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_extra[i]);
-
- FLAC__bitwriter_delete(encoder->private_->frame);
- free(encoder->private_);
- free(encoder->protected_);
- free(encoder);
+ unsigned i;
+
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->protected_);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->private_->frame);
+
+ encoder->private_->is_being_deleted = true;
+
+ (void)FLAC__stream_encoder_finish(encoder);
+
+ if(0 != encoder->private_->verify.decoder)
+ FLAC__stream_decoder_delete(encoder->private_->verify.decoder);
+
+ for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace[i][0]);
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace[i][1]);
+ }
+ for(i = 0; i < 2; i++) {
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]);
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]);
+ }
+ for(i = 0; i < 2; i++)
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_extra[i]);
+
+ FLAC__bitwriter_delete(encoder->private_->frame);
+ free(encoder->private_);
+ free(encoder->protected_);
+ free(encoder);
}
/***********************************************************************
@@ -657,1173 +631,1106 @@ FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder)
***********************************************************************/
static FLAC__StreamEncoderInitStatus init_stream_internal_(
- FLAC__StreamEncoder *encoder,
- FLAC__StreamEncoderReadCallback read_callback,
- FLAC__StreamEncoderWriteCallback write_callback,
- FLAC__StreamEncoderSeekCallback seek_callback,
- FLAC__StreamEncoderTellCallback tell_callback,
- FLAC__StreamEncoderMetadataCallback metadata_callback,
- void *client_data,
- FLAC__bool is_ogg
+ FLAC__StreamEncoder *encoder,
+ FLAC__StreamEncoderReadCallback read_callback,
+ FLAC__StreamEncoderWriteCallback write_callback,
+ FLAC__StreamEncoderSeekCallback seek_callback,
+ FLAC__StreamEncoderTellCallback tell_callback,
+ FLAC__StreamEncoderMetadataCallback metadata_callback,
+ void *client_data,
+ FLAC__bool is_ogg
)
{
- unsigned i;
- FLAC__bool metadata_has_seektable, metadata_has_vorbis_comment, metadata_picture_has_type1, metadata_picture_has_type2;
+ unsigned i;
+ FLAC__bool metadata_has_seektable, metadata_has_vorbis_comment, metadata_picture_has_type1, metadata_picture_has_type2;
- FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
#if !FLAC__HAS_OGG
- if(is_ogg)
- return FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER;
+ if(is_ogg)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER;
#endif
- if(0 == write_callback || (seek_callback && 0 == tell_callback))
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS;
-
- if(encoder->protected_->channels == 0 || encoder->protected_->channels > FLAC__MAX_CHANNELS)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS;
-
- if(encoder->protected_->channels != 2)
- {
- encoder->protected_->do_mid_side_stereo = false;
- encoder->protected_->loose_mid_side_stereo = false;
- }
- else if(!encoder->protected_->do_mid_side_stereo)
- encoder->protected_->loose_mid_side_stereo = false;
-
- if(encoder->protected_->bits_per_sample >= 32)
- encoder->protected_->do_mid_side_stereo = false; /* since we currenty do 32-bit math, the side channel would have 33 bps and overflow */
-
- if(encoder->protected_->bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || encoder->protected_->bits_per_sample > FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE;
-
- if(!FLAC__format_sample_rate_is_valid(encoder->protected_->sample_rate))
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE;
-
- if(encoder->protected_->blocksize == 0)
- {
- if(encoder->protected_->max_lpc_order == 0)
- encoder->protected_->blocksize = 1152;
- else
- encoder->protected_->blocksize = 4096;
- }
-
- if(encoder->protected_->blocksize < FLAC__MIN_BLOCK_SIZE || encoder->protected_->blocksize > FLAC__MAX_BLOCK_SIZE)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE;
-
- if(encoder->protected_->max_lpc_order > FLAC__MAX_LPC_ORDER)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER;
-
- if(encoder->protected_->blocksize < encoder->protected_->max_lpc_order)
- return FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER;
-
- if(encoder->protected_->qlp_coeff_precision == 0)
- {
- if(encoder->protected_->bits_per_sample < 16)
- {
- /* @@@ need some data about how to set this here w.r.t. blocksize and sample rate */
- /* @@@ until then we'll make a guess */
- encoder->protected_->qlp_coeff_precision = max(FLAC__MIN_QLP_COEFF_PRECISION, 2 + encoder->protected_->bits_per_sample / 2);
- }
- else if(encoder->protected_->bits_per_sample == 16)
- {
- if(encoder->protected_->blocksize <= 192)
- encoder->protected_->qlp_coeff_precision = 7;
- else if(encoder->protected_->blocksize <= 384)
- encoder->protected_->qlp_coeff_precision = 8;
- else if(encoder->protected_->blocksize <= 576)
- encoder->protected_->qlp_coeff_precision = 9;
- else if(encoder->protected_->blocksize <= 1152)
- encoder->protected_->qlp_coeff_precision = 10;
- else if(encoder->protected_->blocksize <= 2304)
- encoder->protected_->qlp_coeff_precision = 11;
- else if(encoder->protected_->blocksize <= 4608)
- encoder->protected_->qlp_coeff_precision = 12;
- else
- encoder->protected_->qlp_coeff_precision = 13;
- }
- else
- {
- if(encoder->protected_->blocksize <= 384)
- encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION - 2;
- else if(encoder->protected_->blocksize <= 1152)
- encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION - 1;
- else
- encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION;
- }
- FLAC__ASSERT(encoder->protected_->qlp_coeff_precision <= FLAC__MAX_QLP_COEFF_PRECISION);
- }
- else if(encoder->protected_->qlp_coeff_precision < FLAC__MIN_QLP_COEFF_PRECISION || encoder->protected_->qlp_coeff_precision > FLAC__MAX_QLP_COEFF_PRECISION)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION;
-
- if(encoder->protected_->streamable_subset)
- {
- if(!FLAC__format_blocksize_is_subset(encoder->protected_->blocksize, encoder->protected_->sample_rate))
- return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
- if(!FLAC__format_sample_rate_is_subset(encoder->protected_->sample_rate))
- return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
- if(
- encoder->protected_->bits_per_sample != 8 &&
- encoder->protected_->bits_per_sample != 12 &&
- encoder->protected_->bits_per_sample != 16 &&
- encoder->protected_->bits_per_sample != 20 &&
- encoder->protected_->bits_per_sample != 24
- )
- return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
- if(encoder->protected_->max_residual_partition_order > FLAC__SUBSET_MAX_RICE_PARTITION_ORDER)
- return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
- if(
- encoder->protected_->sample_rate <= 48000 &&
- (
- encoder->protected_->blocksize > FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ ||
- encoder->protected_->max_lpc_order > FLAC__SUBSET_MAX_LPC_ORDER_48000HZ
- )
- )
- {
- return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
- }
- }
-
- if(encoder->protected_->max_residual_partition_order >= (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
- encoder->protected_->max_residual_partition_order = (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN) - 1;
- if(encoder->protected_->min_residual_partition_order >= encoder->protected_->max_residual_partition_order)
- encoder->protected_->min_residual_partition_order = encoder->protected_->max_residual_partition_order;
+ if(0 == write_callback || (seek_callback && 0 == tell_callback))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS;
+
+ if(encoder->protected_->channels == 0 || encoder->protected_->channels > FLAC__MAX_CHANNELS)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS;
+
+ if(encoder->protected_->channels != 2) {
+ encoder->protected_->do_mid_side_stereo = false;
+ encoder->protected_->loose_mid_side_stereo = false;
+ }
+ else if(!encoder->protected_->do_mid_side_stereo)
+ encoder->protected_->loose_mid_side_stereo = false;
+
+ if(encoder->protected_->bits_per_sample >= 32)
+ encoder->protected_->do_mid_side_stereo = false; /* since we currenty do 32-bit math, the side channel would have 33 bps and overflow */
+
+ if(encoder->protected_->bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || encoder->protected_->bits_per_sample > FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE;
+
+ if(!FLAC__format_sample_rate_is_valid(encoder->protected_->sample_rate))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE;
+
+ if(encoder->protected_->blocksize == 0) {
+ if(encoder->protected_->max_lpc_order == 0)
+ encoder->protected_->blocksize = 1152;
+ else
+ encoder->protected_->blocksize = 4096;
+ }
+
+ if(encoder->protected_->blocksize < FLAC__MIN_BLOCK_SIZE || encoder->protected_->blocksize > FLAC__MAX_BLOCK_SIZE)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE;
+
+ if(encoder->protected_->max_lpc_order > FLAC__MAX_LPC_ORDER)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER;
+
+ if(encoder->protected_->blocksize < encoder->protected_->max_lpc_order)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER;
+
+ if(encoder->protected_->qlp_coeff_precision == 0) {
+ if(encoder->protected_->bits_per_sample < 16) {
+ /* @@@ need some data about how to set this here w.r.t. blocksize and sample rate */
+ /* @@@ until then we'll make a guess */
+ encoder->protected_->qlp_coeff_precision = max(FLAC__MIN_QLP_COEFF_PRECISION, 2 + encoder->protected_->bits_per_sample / 2);
+ }
+ else if(encoder->protected_->bits_per_sample == 16) {
+ if(encoder->protected_->blocksize <= 192)
+ encoder->protected_->qlp_coeff_precision = 7;
+ else if(encoder->protected_->blocksize <= 384)
+ encoder->protected_->qlp_coeff_precision = 8;
+ else if(encoder->protected_->blocksize <= 576)
+ encoder->protected_->qlp_coeff_precision = 9;
+ else if(encoder->protected_->blocksize <= 1152)
+ encoder->protected_->qlp_coeff_precision = 10;
+ else if(encoder->protected_->blocksize <= 2304)
+ encoder->protected_->qlp_coeff_precision = 11;
+ else if(encoder->protected_->blocksize <= 4608)
+ encoder->protected_->qlp_coeff_precision = 12;
+ else
+ encoder->protected_->qlp_coeff_precision = 13;
+ }
+ else {
+ if(encoder->protected_->blocksize <= 384)
+ encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION-2;
+ else if(encoder->protected_->blocksize <= 1152)
+ encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION-1;
+ else
+ encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION;
+ }
+ FLAC__ASSERT(encoder->protected_->qlp_coeff_precision <= FLAC__MAX_QLP_COEFF_PRECISION);
+ }
+ else if(encoder->protected_->qlp_coeff_precision < FLAC__MIN_QLP_COEFF_PRECISION || encoder->protected_->qlp_coeff_precision > FLAC__MAX_QLP_COEFF_PRECISION)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION;
+
+ if(encoder->protected_->streamable_subset) {
+ if(!FLAC__format_blocksize_is_subset(encoder->protected_->blocksize, encoder->protected_->sample_rate))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
+ if(!FLAC__format_sample_rate_is_subset(encoder->protected_->sample_rate))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
+ if(
+ encoder->protected_->bits_per_sample != 8 &&
+ encoder->protected_->bits_per_sample != 12 &&
+ encoder->protected_->bits_per_sample != 16 &&
+ encoder->protected_->bits_per_sample != 20 &&
+ encoder->protected_->bits_per_sample != 24
+ )
+ return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
+ if(encoder->protected_->max_residual_partition_order > FLAC__SUBSET_MAX_RICE_PARTITION_ORDER)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
+ if(
+ encoder->protected_->sample_rate <= 48000 &&
+ (
+ encoder->protected_->blocksize > FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ ||
+ encoder->protected_->max_lpc_order > FLAC__SUBSET_MAX_LPC_ORDER_48000HZ
+ )
+ ) {
+ return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE;
+ }
+ }
+
+ if(encoder->protected_->max_residual_partition_order >= (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
+ encoder->protected_->max_residual_partition_order = (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN) - 1;
+ if(encoder->protected_->min_residual_partition_order >= encoder->protected_->max_residual_partition_order)
+ encoder->protected_->min_residual_partition_order = encoder->protected_->max_residual_partition_order;
#if FLAC__HAS_OGG
- /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */
- if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1)
- {
- unsigned i;
- for(i = 1; i < encoder->protected_->num_metadata_blocks; i++)
- {
- if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT)
- {
- FLAC__StreamMetadata *vc = encoder->protected_->metadata[i];
- for(; i > 0; i--)
- encoder->protected_->metadata[i] = encoder->protected_->metadata[i-1];
- encoder->protected_->metadata[0] = vc;
- break;
- }
- }
- }
+ /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */
+ if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1) {
+ unsigned i;
+ for(i = 1; i < encoder->protected_->num_metadata_blocks; i++) {
+ if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+ FLAC__StreamMetadata *vc = encoder->protected_->metadata[i];
+ for( ; i > 0; i--)
+ encoder->protected_->metadata[i] = encoder->protected_->metadata[i-1];
+ encoder->protected_->metadata[0] = vc;
+ break;
+ }
+ }
+ }
#endif
- /* keep track of any SEEKTABLE block */
- if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0)
- {
- unsigned i;
- for(i = 0; i < encoder->protected_->num_metadata_blocks; i++)
- {
- if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE)
- {
- encoder->private_->seek_table = &encoder->protected_->metadata[i]->data.seek_table;
- break; /* take only the first one */
- }
- }
- }
-
- /* validate metadata */
- if(0 == encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- metadata_has_seektable = false;
- metadata_has_vorbis_comment = false;
- metadata_picture_has_type1 = false;
- metadata_picture_has_type2 = false;
- for(i = 0; i < encoder->protected_->num_metadata_blocks; i++)
- {
- const FLAC__StreamMetadata *m = encoder->protected_->metadata[i];
- if(m->type == FLAC__METADATA_TYPE_STREAMINFO)
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- else if(m->type == FLAC__METADATA_TYPE_SEEKTABLE)
- {
- if(metadata_has_seektable) /* only one is allowed */
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- metadata_has_seektable = true;
- if(!FLAC__format_seektable_is_legal(&m->data.seek_table))
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- }
- else if(m->type == FLAC__METADATA_TYPE_VORBIS_COMMENT)
- {
- if(metadata_has_vorbis_comment) /* only one is allowed */
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- metadata_has_vorbis_comment = true;
- }
- else if(m->type == FLAC__METADATA_TYPE_CUESHEET)
- {
- if(!FLAC__format_cuesheet_is_legal(&m->data.cue_sheet, m->data.cue_sheet.is_cd, /*violation=*/0))
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- }
- else if(m->type == FLAC__METADATA_TYPE_PICTURE)
- {
- if(!FLAC__format_picture_is_legal(&m->data.picture, /*violation=*/0))
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD)
- {
- if(metadata_picture_has_type1) /* there should only be 1 per stream */
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- metadata_picture_has_type1 = true;
- /* standard icon must be 32x32 pixel PNG */
- if(
- m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD &&
- (
- (strcmp(m->data.picture.mime_type, "image/png") && strcmp(m->data.picture.mime_type, "-->")) ||
- m->data.picture.width != 32 ||
- m->data.picture.height != 32
- )
- )
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- }
- else if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON)
- {
- if(metadata_picture_has_type2) /* there should only be 1 per stream */
- return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
- metadata_picture_has_type2 = true;
- }
- }
- }
-
- encoder->private_->input_capacity = 0;
- for(i = 0; i < encoder->protected_->channels; i++)
- {
- encoder->private_->integer_signal_unaligned[i] = encoder->private_->integer_signal[i] = 0;
+ /* keep track of any SEEKTABLE block */
+ if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) {
+ unsigned i;
+ for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) {
+ if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) {
+ encoder->private_->seek_table = &encoder->protected_->metadata[i]->data.seek_table;
+ break; /* take only the first one */
+ }
+ }
+ }
+
+ /* validate metadata */
+ if(0 == encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ metadata_has_seektable = false;
+ metadata_has_vorbis_comment = false;
+ metadata_picture_has_type1 = false;
+ metadata_picture_has_type2 = false;
+ for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) {
+ const FLAC__StreamMetadata *m = encoder->protected_->metadata[i];
+ if(m->type == FLAC__METADATA_TYPE_STREAMINFO)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ else if(m->type == FLAC__METADATA_TYPE_SEEKTABLE) {
+ if(metadata_has_seektable) /* only one is allowed */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ metadata_has_seektable = true;
+ if(!FLAC__format_seektable_is_legal(&m->data.seek_table))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ }
+ else if(m->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+ if(metadata_has_vorbis_comment) /* only one is allowed */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ metadata_has_vorbis_comment = true;
+ }
+ else if(m->type == FLAC__METADATA_TYPE_CUESHEET) {
+ if(!FLAC__format_cuesheet_is_legal(&m->data.cue_sheet, m->data.cue_sheet.is_cd, /*violation=*/0))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ }
+ else if(m->type == FLAC__METADATA_TYPE_PICTURE) {
+ if(!FLAC__format_picture_is_legal(&m->data.picture, /*violation=*/0))
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD) {
+ if(metadata_picture_has_type1) /* there should only be 1 per stream */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ metadata_picture_has_type1 = true;
+ /* standard icon must be 32x32 pixel PNG */
+ if(
+ m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD &&
+ (
+ (strcmp(m->data.picture.mime_type, "image/png") && strcmp(m->data.picture.mime_type, "-->")) ||
+ m->data.picture.width != 32 ||
+ m->data.picture.height != 32
+ )
+ )
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ }
+ else if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON) {
+ if(metadata_picture_has_type2) /* there should only be 1 per stream */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA;
+ metadata_picture_has_type2 = true;
+ }
+ }
+ }
+
+ encoder->private_->input_capacity = 0;
+ for(i = 0; i < encoder->protected_->channels; i++) {
+ encoder->private_->integer_signal_unaligned[i] = encoder->private_->integer_signal[i] = 0;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- encoder->private_->real_signal_unaligned[i] = encoder->private_->real_signal[i] = 0;
+ encoder->private_->real_signal_unaligned[i] = encoder->private_->real_signal[i] = 0;
#endif
- }
- for(i = 0; i < 2; i++)
- {
- encoder->private_->integer_signal_mid_side_unaligned[i] = encoder->private_->integer_signal_mid_side[i] = 0;
+ }
+ for(i = 0; i < 2; i++) {
+ encoder->private_->integer_signal_mid_side_unaligned[i] = encoder->private_->integer_signal_mid_side[i] = 0;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- encoder->private_->real_signal_mid_side_unaligned[i] = encoder->private_->real_signal_mid_side[i] = 0;
+ encoder->private_->real_signal_mid_side_unaligned[i] = encoder->private_->real_signal_mid_side[i] = 0;
#endif
- }
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- for(i = 0; i < encoder->protected_->num_apodizations; i++)
- encoder->private_->window_unaligned[i] = encoder->private_->window[i] = 0;
- encoder->private_->windowed_signal_unaligned = encoder->private_->windowed_signal = 0;
+ for(i = 0; i < encoder->protected_->num_apodizations; i++)
+ encoder->private_->window_unaligned[i] = encoder->private_->window[i] = 0;
+ encoder->private_->windowed_signal_unaligned = encoder->private_->windowed_signal = 0;
#endif
- for(i = 0; i < encoder->protected_->channels; i++)
- {
- encoder->private_->residual_workspace_unaligned[i][0] = encoder->private_->residual_workspace[i][0] = 0;
- encoder->private_->residual_workspace_unaligned[i][1] = encoder->private_->residual_workspace[i][1] = 0;
- encoder->private_->best_subframe[i] = 0;
- }
- for(i = 0; i < 2; i++)
- {
- encoder->private_->residual_workspace_mid_side_unaligned[i][0] = encoder->private_->residual_workspace_mid_side[i][0] = 0;
- encoder->private_->residual_workspace_mid_side_unaligned[i][1] = encoder->private_->residual_workspace_mid_side[i][1] = 0;
- encoder->private_->best_subframe_mid_side[i] = 0;
- }
- encoder->private_->abs_residual_partition_sums_unaligned = encoder->private_->abs_residual_partition_sums = 0;
- encoder->private_->raw_bits_per_partition_unaligned = encoder->private_->raw_bits_per_partition = 0;
+ for(i = 0; i < encoder->protected_->channels; i++) {
+ encoder->private_->residual_workspace_unaligned[i][0] = encoder->private_->residual_workspace[i][0] = 0;
+ encoder->private_->residual_workspace_unaligned[i][1] = encoder->private_->residual_workspace[i][1] = 0;
+ encoder->private_->best_subframe[i] = 0;
+ }
+ for(i = 0; i < 2; i++) {
+ encoder->private_->residual_workspace_mid_side_unaligned[i][0] = encoder->private_->residual_workspace_mid_side[i][0] = 0;
+ encoder->private_->residual_workspace_mid_side_unaligned[i][1] = encoder->private_->residual_workspace_mid_side[i][1] = 0;
+ encoder->private_->best_subframe_mid_side[i] = 0;
+ }
+ encoder->private_->abs_residual_partition_sums_unaligned = encoder->private_->abs_residual_partition_sums = 0;
+ encoder->private_->raw_bits_per_partition_unaligned = encoder->private_->raw_bits_per_partition = 0;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- encoder->private_->loose_mid_side_stereo_frames = (unsigned)((FLAC__double)encoder->protected_->sample_rate * 0.4 / (FLAC__double)encoder->protected_->blocksize + 0.5);
+ encoder->private_->loose_mid_side_stereo_frames = (unsigned)((FLAC__double)encoder->protected_->sample_rate * 0.4 / (FLAC__double)encoder->protected_->blocksize + 0.5);
#else
- /* 26214 is the approximate fixed-point equivalent to 0.4 (0.4 * 2^16) */
- /* sample rate can be up to 655350 Hz, and thus use 20 bits, so we do the multiply&divide by hand */
- FLAC__ASSERT(FLAC__MAX_SAMPLE_RATE <= 655350);
- FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535);
- FLAC__ASSERT(encoder->protected_->sample_rate <= 655350);
- FLAC__ASSERT(encoder->protected_->blocksize <= 65535);
- encoder->private_->loose_mid_side_stereo_frames = (unsigned)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize << 16) + FLAC__FP_ONE_HALF);
+ /* 26214 is the approximate fixed-point equivalent to 0.4 (0.4 * 2^16) */
+ /* sample rate can be up to 655350 Hz, and thus use 20 bits, so we do the multiply&divide by hand */
+ FLAC__ASSERT(FLAC__MAX_SAMPLE_RATE <= 655350);
+ FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535);
+ FLAC__ASSERT(encoder->protected_->sample_rate <= 655350);
+ FLAC__ASSERT(encoder->protected_->blocksize <= 65535);
+ encoder->private_->loose_mid_side_stereo_frames = (unsigned)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF);
#endif
- if(encoder->private_->loose_mid_side_stereo_frames == 0)
- encoder->private_->loose_mid_side_stereo_frames = 1;
- encoder->private_->loose_mid_side_stereo_frame_count = 0;
- encoder->private_->current_sample_number = 0;
- encoder->private_->current_frame_number = 0;
-
- encoder->private_->use_wide_by_block = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(encoder->protected_->blocksize) + 1 > 30);
- encoder->private_->use_wide_by_order = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(max(encoder->protected_->max_lpc_order, FLAC__MAX_FIXED_ORDER)) + 1 > 30); /*@@@ need to use this? */
- encoder->private_->use_wide_by_partition = (false); /*@@@ need to set this */
-
- /*
- * get the CPU info and set the function pointers
- */
- FLAC__cpu_info(&encoder->private_->cpuinfo);
- /* first default to the non-asm routines */
+ if(encoder->private_->loose_mid_side_stereo_frames == 0)
+ encoder->private_->loose_mid_side_stereo_frames = 1;
+ encoder->private_->loose_mid_side_stereo_frame_count = 0;
+ encoder->private_->current_sample_number = 0;
+ encoder->private_->current_frame_number = 0;
+
+ encoder->private_->use_wide_by_block = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(encoder->protected_->blocksize)+1 > 30);
+ encoder->private_->use_wide_by_order = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(max(encoder->protected_->max_lpc_order, FLAC__MAX_FIXED_ORDER))+1 > 30); /*@@@ need to use this? */
+ encoder->private_->use_wide_by_partition = (false); /*@@@ need to set this */
+
+ /*
+ * get the CPU info and set the function pointers
+ */
+ FLAC__cpu_info(&encoder->private_->cpuinfo);
+ /* first default to the non-asm routines */
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation;
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation;
#endif
- encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor;
+ encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients;
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide;
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients;
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients;
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide;
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients;
#endif
- /* now override with asm where appropriate */
+ /* now override with asm where appropriate */
#ifndef FLAC__INTEGER_ONLY_LIBRARY
# ifndef FLAC__NO_ASM
- if(encoder->private_->cpuinfo.use_asm)
- {
+ if(encoder->private_->cpuinfo.use_asm) {
# ifdef FLAC__CPU_IA32
- FLAC__ASSERT(encoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
+ FLAC__ASSERT(encoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
# ifdef FLAC__HAS_NASM
- if(encoder->private_->cpuinfo.data.ia32.sse)
- {
- if(encoder->protected_->max_lpc_order < 4)
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4;
- else if(encoder->protected_->max_lpc_order < 8)
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8;
- else if(encoder->protected_->max_lpc_order < 12)
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12;
- else
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32;
- }
- else if(encoder->private_->cpuinfo.data.ia32._3dnow)
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow;
- else
- encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32;
- if(encoder->private_->cpuinfo.data.ia32.mmx)
- {
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32;
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx;
- }
- else
- {
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32;
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32;
- }
- if(encoder->private_->cpuinfo.data.ia32.mmx && encoder->private_->cpuinfo.data.ia32.cmov)
- encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov;
+ if(encoder->private_->cpuinfo.data.ia32.sse) {
+ if(encoder->protected_->max_lpc_order < 4)
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4;
+ else if(encoder->protected_->max_lpc_order < 8)
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8;
+ else if(encoder->protected_->max_lpc_order < 12)
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12;
+ else
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32;
+ }
+ else if(encoder->private_->cpuinfo.data.ia32._3dnow)
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow;
+ else
+ encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32;
+ if(encoder->private_->cpuinfo.data.ia32.mmx) {
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32;
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx;
+ }
+ else {
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32;
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32;
+ }
+ if(encoder->private_->cpuinfo.data.ia32.mmx && encoder->private_->cpuinfo.data.ia32.cmov)
+ encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov;
# endif /* FLAC__HAS_NASM */
# endif /* FLAC__CPU_IA32 */
- }
+ }
# endif /* !FLAC__NO_ASM */
#endif /* !FLAC__INTEGER_ONLY_LIBRARY */
- /* finally override based on wide-ness if necessary */
- if(encoder->private_->use_wide_by_block)
- {
- encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_wide;
- }
+ /* finally override based on wide-ness if necessary */
+ if(encoder->private_->use_wide_by_block) {
+ encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_wide;
+ }
- /* set state to OK; from here on, errors are fatal and we'll override the state then */
- encoder->protected_->state = FLAC__STREAM_ENCODER_OK;
+ /* set state to OK; from here on, errors are fatal and we'll override the state then */
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OK;
#if FLAC__HAS_OGG
- encoder->private_->is_ogg = is_ogg;
- if(is_ogg && !FLAC__ogg_encoder_aspect_init(&encoder->protected_->ogg_encoder_aspect))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
+ encoder->private_->is_ogg = is_ogg;
+ if(is_ogg && !FLAC__ogg_encoder_aspect_init(&encoder->protected_->ogg_encoder_aspect)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
#endif
- encoder->private_->read_callback = read_callback;
- encoder->private_->write_callback = write_callback;
- encoder->private_->seek_callback = seek_callback;
- encoder->private_->tell_callback = tell_callback;
- encoder->private_->metadata_callback = metadata_callback;
- encoder->private_->client_data = client_data;
-
- if(!resize_buffers_(encoder, encoder->protected_->blocksize))
- {
- /* the above function sets the state for us in case of an error */
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- if(!FLAC__bitwriter_init(encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- /*
- * Set up the verify stuff if necessary
- */
- if(encoder->protected_->verify)
- {
- /*
- * First, set up the fifo which will hold the
- * original signal to compare against
- */
- encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize + OVERREAD_;
- for(i = 0; i < encoder->protected_->channels; i++)
- {
- if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)safe_malloc_mul_2op_(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size)))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- }
- encoder->private_->verify.input_fifo.tail = 0;
-
- /*
- * Now set up a stream decoder for verification
- */
- encoder->private_->verify.decoder = FLAC__stream_decoder_new();
- if(0 == encoder->private_->verify.decoder)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- if(FLAC__stream_decoder_init_stream(encoder->private_->verify.decoder, verify_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, verify_write_callback_, verify_metadata_callback_, verify_error_callback_, /*client_data=*/encoder) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- }
- encoder->private_->verify.error_stats.absolute_sample = 0;
- encoder->private_->verify.error_stats.frame_number = 0;
- encoder->private_->verify.error_stats.channel = 0;
- encoder->private_->verify.error_stats.sample = 0;
- encoder->private_->verify.error_stats.expected = 0;
- encoder->private_->verify.error_stats.got = 0;
-
- /*
- * These must be done before we write any metadata, because that
- * calls the write_callback, which uses these values.
- */
- encoder->private_->first_seekpoint_to_check = 0;
- encoder->private_->samples_written = 0;
- encoder->protected_->streaminfo_offset = 0;
- encoder->protected_->seektable_offset = 0;
- encoder->protected_->audio_offset = 0;
-
- /*
- * write the stream header
- */
- if(encoder->protected_->verify)
- encoder->private_->verify.state_hint = ENCODER_IN_MAGIC;
- if(!FLAC__bitwriter_write_raw_uint32(encoder->private_->frame, FLAC__STREAM_SYNC, FLAC__STREAM_SYNC_LEN))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false))
- {
- /* the above function sets the state for us in case of an error */
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- /*
- * write the STREAMINFO metadata block
- */
- if(encoder->protected_->verify)
- encoder->private_->verify.state_hint = ENCODER_IN_METADATA;
- encoder->private_->streaminfo.type = FLAC__METADATA_TYPE_STREAMINFO;
- encoder->private_->streaminfo.is_last = false; /* we will have at a minimum a VORBIS_COMMENT afterwards */
- encoder->private_->streaminfo.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
- encoder->private_->streaminfo.data.stream_info.min_blocksize = encoder->protected_->blocksize; /* this encoder uses the same blocksize for the whole stream */
- encoder->private_->streaminfo.data.stream_info.max_blocksize = encoder->protected_->blocksize;
- encoder->private_->streaminfo.data.stream_info.min_framesize = 0; /* we don't know this yet; have to fill it in later */
- encoder->private_->streaminfo.data.stream_info.max_framesize = 0; /* we don't know this yet; have to fill it in later */
- encoder->private_->streaminfo.data.stream_info.sample_rate = encoder->protected_->sample_rate;
- encoder->private_->streaminfo.data.stream_info.channels = encoder->protected_->channels;
- encoder->private_->streaminfo.data.stream_info.bits_per_sample = encoder->protected_->bits_per_sample;
- encoder->private_->streaminfo.data.stream_info.total_samples = encoder->protected_->total_samples_estimate; /* we will replace this later with the real total */
- memset(encoder->private_->streaminfo.data.stream_info.md5sum, 0, 16); /* we don't know this yet; have to fill it in later */
- if(encoder->protected_->do_md5)
- FLAC__MD5Init(&encoder->private_->md5context);
- if(!FLAC__add_metadata_block(&encoder->private_->streaminfo, encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false))
- {
- /* the above function sets the state for us in case of an error */
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- /*
- * Now that the STREAMINFO block is written, we can init this to an
- * absurdly-high value...
- */
- encoder->private_->streaminfo.data.stream_info.min_framesize = (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN) - 1;
- /* ... and clear this to 0 */
- encoder->private_->streaminfo.data.stream_info.total_samples = 0;
-
- /*
- * Check to see if the supplied metadata contains a VORBIS_COMMENT;
- * if not, we will write an empty one (FLAC__add_metadata_block()
- * automatically supplies the vendor string).
- *
- * WATCHOUT: the Ogg FLAC mapping requires us to write this block after
- * the STREAMINFO. (In the case that metadata_has_vorbis_comment is
- * true it will have already insured that the metadata list is properly
- * ordered.)
- */
- if(!metadata_has_vorbis_comment)
- {
- FLAC__StreamMetadata vorbis_comment;
- vorbis_comment.type = FLAC__METADATA_TYPE_VORBIS_COMMENT;
- vorbis_comment.is_last = (encoder->protected_->num_metadata_blocks == 0);
- vorbis_comment.length = 4 + 4; /* MAGIC NUMBER */
- vorbis_comment.data.vorbis_comment.vendor_string.length = 0;
- vorbis_comment.data.vorbis_comment.vendor_string.entry = 0;
- vorbis_comment.data.vorbis_comment.num_comments = 0;
- vorbis_comment.data.vorbis_comment.comments = 0;
- if(!FLAC__add_metadata_block(&vorbis_comment, encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false))
- {
- /* the above function sets the state for us in case of an error */
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- }
-
- /*
- * write the user's metadata blocks
- */
- for(i = 0; i < encoder->protected_->num_metadata_blocks; i++)
- {
- encoder->protected_->metadata[i]->is_last = (i == encoder->protected_->num_metadata_blocks - 1);
- if(!FLAC__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false))
- {
- /* the above function sets the state for us in case of an error */
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
- }
-
- /* now that all the metadata is written, we save the stream offset */
- if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &encoder->protected_->audio_offset, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- if(encoder->protected_->verify)
- encoder->private_->verify.state_hint = ENCODER_IN_AUDIO;
-
- return FLAC__STREAM_ENCODER_INIT_STATUS_OK;
+ encoder->private_->read_callback = read_callback;
+ encoder->private_->write_callback = write_callback;
+ encoder->private_->seek_callback = seek_callback;
+ encoder->private_->tell_callback = tell_callback;
+ encoder->private_->metadata_callback = metadata_callback;
+ encoder->private_->client_data = client_data;
+
+ if(!resize_buffers_(encoder, encoder->protected_->blocksize)) {
+ /* the above function sets the state for us in case of an error */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ if(!FLAC__bitwriter_init(encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ /*
+ * Set up the verify stuff if necessary
+ */
+ if(encoder->protected_->verify) {
+ /*
+ * First, set up the fifo which will hold the
+ * original signal to compare against
+ */
+ encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize+OVERREAD_;
+ for(i = 0; i < encoder->protected_->channels; i++) {
+ if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)safe_malloc_mul_2op_(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size))) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ }
+ encoder->private_->verify.input_fifo.tail = 0;
+
+ /*
+ * Now set up a stream decoder for verification
+ */
+ encoder->private_->verify.decoder = FLAC__stream_decoder_new();
+ if(0 == encoder->private_->verify.decoder) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ if(FLAC__stream_decoder_init_stream(encoder->private_->verify.decoder, verify_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, verify_write_callback_, verify_metadata_callback_, verify_error_callback_, /*client_data=*/encoder) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ }
+ encoder->private_->verify.error_stats.absolute_sample = 0;
+ encoder->private_->verify.error_stats.frame_number = 0;
+ encoder->private_->verify.error_stats.channel = 0;
+ encoder->private_->verify.error_stats.sample = 0;
+ encoder->private_->verify.error_stats.expected = 0;
+ encoder->private_->verify.error_stats.got = 0;
+
+ /*
+ * These must be done before we write any metadata, because that
+ * calls the write_callback, which uses these values.
+ */
+ encoder->private_->first_seekpoint_to_check = 0;
+ encoder->private_->samples_written = 0;
+ encoder->protected_->streaminfo_offset = 0;
+ encoder->protected_->seektable_offset = 0;
+ encoder->protected_->audio_offset = 0;
+
+ /*
+ * write the stream header
+ */
+ if(encoder->protected_->verify)
+ encoder->private_->verify.state_hint = ENCODER_IN_MAGIC;
+ if(!FLAC__bitwriter_write_raw_uint32(encoder->private_->frame, FLAC__STREAM_SYNC, FLAC__STREAM_SYNC_LEN)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) {
+ /* the above function sets the state for us in case of an error */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ /*
+ * write the STREAMINFO metadata block
+ */
+ if(encoder->protected_->verify)
+ encoder->private_->verify.state_hint = ENCODER_IN_METADATA;
+ encoder->private_->streaminfo.type = FLAC__METADATA_TYPE_STREAMINFO;
+ encoder->private_->streaminfo.is_last = false; /* we will have at a minimum a VORBIS_COMMENT afterwards */
+ encoder->private_->streaminfo.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
+ encoder->private_->streaminfo.data.stream_info.min_blocksize = encoder->protected_->blocksize; /* this encoder uses the same blocksize for the whole stream */
+ encoder->private_->streaminfo.data.stream_info.max_blocksize = encoder->protected_->blocksize;
+ encoder->private_->streaminfo.data.stream_info.min_framesize = 0; /* we don't know this yet; have to fill it in later */
+ encoder->private_->streaminfo.data.stream_info.max_framesize = 0; /* we don't know this yet; have to fill it in later */
+ encoder->private_->streaminfo.data.stream_info.sample_rate = encoder->protected_->sample_rate;
+ encoder->private_->streaminfo.data.stream_info.channels = encoder->protected_->channels;
+ encoder->private_->streaminfo.data.stream_info.bits_per_sample = encoder->protected_->bits_per_sample;
+ encoder->private_->streaminfo.data.stream_info.total_samples = encoder->protected_->total_samples_estimate; /* we will replace this later with the real total */
+ memset(encoder->private_->streaminfo.data.stream_info.md5sum, 0, 16); /* we don't know this yet; have to fill it in later */
+ if(encoder->protected_->do_md5)
+ FLAC__MD5Init(&encoder->private_->md5context);
+ if(!FLAC__add_metadata_block(&encoder->private_->streaminfo, encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) {
+ /* the above function sets the state for us in case of an error */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ /*
+ * Now that the STREAMINFO block is written, we can init this to an
+ * absurdly-high value...
+ */
+ encoder->private_->streaminfo.data.stream_info.min_framesize = (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN) - 1;
+ /* ... and clear this to 0 */
+ encoder->private_->streaminfo.data.stream_info.total_samples = 0;
+
+ /*
+ * Check to see if the supplied metadata contains a VORBIS_COMMENT;
+ * if not, we will write an empty one (FLAC__add_metadata_block()
+ * automatically supplies the vendor string).
+ *
+ * WATCHOUT: the Ogg FLAC mapping requires us to write this block after
+ * the STREAMINFO. (In the case that metadata_has_vorbis_comment is
+ * true it will have already insured that the metadata list is properly
+ * ordered.)
+ */
+ if(!metadata_has_vorbis_comment) {
+ FLAC__StreamMetadata vorbis_comment;
+ vorbis_comment.type = FLAC__METADATA_TYPE_VORBIS_COMMENT;
+ vorbis_comment.is_last = (encoder->protected_->num_metadata_blocks == 0);
+ vorbis_comment.length = 4 + 4; /* MAGIC NUMBER */
+ vorbis_comment.data.vorbis_comment.vendor_string.length = 0;
+ vorbis_comment.data.vorbis_comment.vendor_string.entry = 0;
+ vorbis_comment.data.vorbis_comment.num_comments = 0;
+ vorbis_comment.data.vorbis_comment.comments = 0;
+ if(!FLAC__add_metadata_block(&vorbis_comment, encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) {
+ /* the above function sets the state for us in case of an error */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ }
+
+ /*
+ * write the user's metadata blocks
+ */
+ for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) {
+ encoder->protected_->metadata[i]->is_last = (i == encoder->protected_->num_metadata_blocks - 1);
+ if(!FLAC__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) {
+ /* the above function sets the state for us in case of an error */
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+ }
+
+ /* now that all the metadata is written, we save the stream offset */
+ if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &encoder->protected_->audio_offset, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) { /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ if(encoder->protected_->verify)
+ encoder->private_->verify.state_hint = ENCODER_IN_AUDIO;
+
+ return FLAC__STREAM_ENCODER_INIT_STATUS_OK;
}
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(
- FLAC__StreamEncoder *encoder,
- FLAC__StreamEncoderWriteCallback write_callback,
- FLAC__StreamEncoderSeekCallback seek_callback,
- FLAC__StreamEncoderTellCallback tell_callback,
- FLAC__StreamEncoderMetadataCallback metadata_callback,
- void *client_data
+ FLAC__StreamEncoder *encoder,
+ FLAC__StreamEncoderWriteCallback write_callback,
+ FLAC__StreamEncoderSeekCallback seek_callback,
+ FLAC__StreamEncoderTellCallback tell_callback,
+ FLAC__StreamEncoderMetadataCallback metadata_callback,
+ void *client_data
)
{
- return init_stream_internal_(
- encoder,
- /*read_callback=*/0,
- write_callback,
- seek_callback,
- tell_callback,
- metadata_callback,
- client_data,
- /*is_ogg=*/false
- );
+ return init_stream_internal_(
+ encoder,
+ /*read_callback=*/0,
+ write_callback,
+ seek_callback,
+ tell_callback,
+ metadata_callback,
+ client_data,
+ /*is_ogg=*/false
+ );
}
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream(
- FLAC__StreamEncoder *encoder,
- FLAC__StreamEncoderReadCallback read_callback,
- FLAC__StreamEncoderWriteCallback write_callback,
- FLAC__StreamEncoderSeekCallback seek_callback,
- FLAC__StreamEncoderTellCallback tell_callback,
- FLAC__StreamEncoderMetadataCallback metadata_callback,
- void *client_data
+ FLAC__StreamEncoder *encoder,
+ FLAC__StreamEncoderReadCallback read_callback,
+ FLAC__StreamEncoderWriteCallback write_callback,
+ FLAC__StreamEncoderSeekCallback seek_callback,
+ FLAC__StreamEncoderTellCallback tell_callback,
+ FLAC__StreamEncoderMetadataCallback metadata_callback,
+ void *client_data
)
{
- return init_stream_internal_(
- encoder,
- read_callback,
- write_callback,
- seek_callback,
- tell_callback,
- metadata_callback,
- client_data,
- /*is_ogg=*/true
- );
+ return init_stream_internal_(
+ encoder,
+ read_callback,
+ write_callback,
+ seek_callback,
+ tell_callback,
+ metadata_callback,
+ client_data,
+ /*is_ogg=*/true
+ );
}
-
+
static FLAC__StreamEncoderInitStatus init_FILE_internal_(
- FLAC__StreamEncoder *encoder,
- FILE *file,
- FLAC__StreamEncoderProgressCallback progress_callback,
- void *client_data,
- FLAC__bool is_ogg
+ FLAC__StreamEncoder *encoder,
+ FILE *file,
+ FLAC__StreamEncoderProgressCallback progress_callback,
+ void *client_data,
+ FLAC__bool is_ogg
)
{
- FLAC__StreamEncoderInitStatus init_status;
-
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != file);
-
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
-
- /* double protection */
- if(file == 0)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
-
- /*
- * To make sure that our file does not go unclosed after an error, we
- * must assign the FILE pointer before any further error can occur in
- * this routine.
- */
- if(file == stdout)
- file = get_binary_stdout_(); /* just to be safe */
-
- encoder->private_->file = file;
-
- encoder->private_->progress_callback = progress_callback;
- encoder->private_->bytes_written = 0;
- encoder->private_->samples_written = 0;
- encoder->private_->frames_written = 0;
-
- init_status = init_stream_internal_(
- encoder,
- encoder->private_->file == stdout ? 0 : is_ogg ? file_read_callback_ : 0,
- file_write_callback_,
- encoder->private_->file == stdout ? 0 : file_seek_callback_,
- encoder->private_->file == stdout ? 0 : file_tell_callback_,
- /*metadata_callback=*/0,
- client_data,
- is_ogg
- );
- if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
- {
- /* the above function sets the state for us in case of an error */
- return init_status;
- }
-
- {
- unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder);
-
- FLAC__ASSERT(blocksize != 0);
- encoder->private_->total_frames_estimate = (unsigned)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize);
- }
-
- return init_status;
+ FLAC__StreamEncoderInitStatus init_status;
+
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != file);
+
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
+
+ /* double protection */
+ if(file == 0) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
+
+ /*
+ * To make sure that our file does not go unclosed after an error, we
+ * must assign the FILE pointer before any further error can occur in
+ * this routine.
+ */
+ if(file == stdout)
+ file = get_binary_stdout_(); /* just to be safe */
+
+ encoder->private_->file = file;
+
+ encoder->private_->progress_callback = progress_callback;
+ encoder->private_->bytes_written = 0;
+ encoder->private_->samples_written = 0;
+ encoder->private_->frames_written = 0;
+
+ init_status = init_stream_internal_(
+ encoder,
+ encoder->private_->file == stdout? 0 : is_ogg? file_read_callback_ : 0,
+ file_write_callback_,
+ encoder->private_->file == stdout? 0 : file_seek_callback_,
+ encoder->private_->file == stdout? 0 : file_tell_callback_,
+ /*metadata_callback=*/0,
+ client_data,
+ is_ogg
+ );
+ if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) {
+ /* the above function sets the state for us in case of an error */
+ return init_status;
+ }
+
+ {
+ unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder);
+
+ FLAC__ASSERT(blocksize != 0);
+ encoder->private_->total_frames_estimate = (unsigned)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize);
+ }
+
+ return init_status;
}
-
+
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(
- FLAC__StreamEncoder *encoder,
- FILE *file,
- FLAC__StreamEncoderProgressCallback progress_callback,
- void *client_data
+ FLAC__StreamEncoder *encoder,
+ FILE *file,
+ FLAC__StreamEncoderProgressCallback progress_callback,
+ void *client_data
)
{
- return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false);
+ return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false);
}
-
+
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(
- FLAC__StreamEncoder *encoder,
- FILE *file,
- FLAC__StreamEncoderProgressCallback progress_callback,
- void *client_data
+ FLAC__StreamEncoder *encoder,
+ FILE *file,
+ FLAC__StreamEncoderProgressCallback progress_callback,
+ void *client_data
)
{
- return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/true);
+ return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/true);
}
static FLAC__StreamEncoderInitStatus init_file_internal_(
- FLAC__StreamEncoder *encoder,
- const char *filename,
- FLAC__StreamEncoderProgressCallback progress_callback,
- void *client_data,
- FLAC__bool is_ogg
+ FLAC__StreamEncoder *encoder,
+ const char *filename,
+ FLAC__StreamEncoderProgressCallback progress_callback,
+ void *client_data,
+ FLAC__bool is_ogg
)
{
- FILE *file;
+ FILE *file;
- FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder);
- /*
- * To make sure that our file does not go unclosed after an error, we
- * have to do the same entrance checks here that are later performed
- * in FLAC__stream_encoder_init_FILE() before the FILE* is assigned.
- */
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
+ /*
+ * To make sure that our file does not go unclosed after an error, we
+ * have to do the same entrance checks here that are later performed
+ * in FLAC__stream_encoder_init_FILE() before the FILE* is assigned.
+ */
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
- file = filename ? fopen(filename, "w+b") : stdout;
+ file = filename? fopen(filename, "w+b") : stdout;
- if(file == 0)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
- return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
- }
+ if(file == 0) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
+ }
- return init_FILE_internal_(encoder, file, progress_callback, client_data, is_ogg);
+ return init_FILE_internal_(encoder, file, progress_callback, client_data, is_ogg);
}
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(
- FLAC__StreamEncoder *encoder,
- const char *filename,
- FLAC__StreamEncoderProgressCallback progress_callback,
- void *client_data
+ FLAC__StreamEncoder *encoder,
+ const char *filename,
+ FLAC__StreamEncoderProgressCallback progress_callback,
+ void *client_data
)
{
- return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/false);
+ return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/false);
}
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file(
- FLAC__StreamEncoder *encoder,
- const char *filename,
- FLAC__StreamEncoderProgressCallback progress_callback,
- void *client_data
+ FLAC__StreamEncoder *encoder,
+ const char *filename,
+ FLAC__StreamEncoderProgressCallback progress_callback,
+ void *client_data
)
{
- return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/true);
+ return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/true);
}
FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder)
{
- FLAC__bool error = false;
-
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
-
- if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED)
- return true;
-
- if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted)
- {
- if(encoder->private_->current_sample_number != 0)
- {
- const FLAC__bool is_fractional_block = encoder->protected_->blocksize != encoder->private_->current_sample_number;
- encoder->protected_->blocksize = encoder->private_->current_sample_number;
- if(!process_frame_(encoder, is_fractional_block, /*is_last_block=*/true))
- error = true;
- }
- }
-
- if(encoder->protected_->do_md5)
- FLAC__MD5Final(encoder->private_->streaminfo.data.stream_info.md5sum, &encoder->private_->md5context);
-
- if(!encoder->private_->is_being_deleted)
- {
- if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK)
- {
- if(encoder->private_->seek_callback)
- {
+ FLAC__bool error = false;
+
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+
+ if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return true;
+
+ if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted) {
+ if(encoder->private_->current_sample_number != 0) {
+ const FLAC__bool is_fractional_block = encoder->protected_->blocksize != encoder->private_->current_sample_number;
+ encoder->protected_->blocksize = encoder->private_->current_sample_number;
+ if(!process_frame_(encoder, is_fractional_block, /*is_last_block=*/true))
+ error = true;
+ }
+ }
+
+ if(encoder->protected_->do_md5)
+ FLAC__MD5Final(encoder->private_->streaminfo.data.stream_info.md5sum, &encoder->private_->md5context);
+
+ if(!encoder->private_->is_being_deleted) {
+ if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK) {
+ if(encoder->private_->seek_callback) {
#if FLAC__HAS_OGG
- if(encoder->private_->is_ogg)
- update_ogg_metadata_(encoder);
- else
+ if(encoder->private_->is_ogg)
+ update_ogg_metadata_(encoder);
+ else
#endif
- update_metadata_(encoder);
-
- /* check if an error occurred while updating metadata */
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_OK)
- error = true;
- }
- if(encoder->private_->metadata_callback)
- encoder->private_->metadata_callback(encoder, &encoder->private_->streaminfo, encoder->private_->client_data);
- }
-
- if(encoder->protected_->verify && 0 != encoder->private_->verify.decoder && !FLAC__stream_decoder_finish(encoder->private_->verify.decoder))
- {
- if(!error)
- encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA;
- error = true;
- }
- }
-
- if(0 != encoder->private_->file)
- {
- if(encoder->private_->file != stdout)
- fclose(encoder->private_->file);
- encoder->private_->file = 0;
- }
+ update_metadata_(encoder);
+
+ /* check if an error occurred while updating metadata */
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_OK)
+ error = true;
+ }
+ if(encoder->private_->metadata_callback)
+ encoder->private_->metadata_callback(encoder, &encoder->private_->streaminfo, encoder->private_->client_data);
+ }
+
+ if(encoder->protected_->verify && 0 != encoder->private_->verify.decoder && !FLAC__stream_decoder_finish(encoder->private_->verify.decoder)) {
+ if(!error)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA;
+ error = true;
+ }
+ }
+
+ if(0 != encoder->private_->file) {
+ if(encoder->private_->file != stdout)
+ fclose(encoder->private_->file);
+ encoder->private_->file = 0;
+ }
#if FLAC__HAS_OGG
- if(encoder->private_->is_ogg)
- FLAC__ogg_encoder_aspect_finish(&encoder->protected_->ogg_encoder_aspect);
+ if(encoder->private_->is_ogg)
+ FLAC__ogg_encoder_aspect_finish(&encoder->protected_->ogg_encoder_aspect);
#endif
- free_(encoder);
- set_defaults_(encoder);
+ free_(encoder);
+ set_defaults_(encoder);
- if(!error)
- encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
+ if(!error)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
- return !error;
+ return !error;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
#if FLAC__HAS_OGG
- /* can't check encoder->private_->is_ogg since that's not set until init time */
- FLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value);
- return true;
+ /* can't check encoder->private_->is_ogg since that's not set until init time */
+ FLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value);
+ return true;
#else
- (void)value;
- return false;
+ (void)value;
+ return false;
#endif
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
#ifndef FLAC__MANDATORY_VERIFY_WHILE_ENCODING
- encoder->protected_->verify = value;
+ encoder->protected_->verify = value;
#endif
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->streamable_subset = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->streamable_subset = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->do_md5 = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->do_md5 = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->channels = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->channels = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->bits_per_sample = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->bits_per_sample = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->sample_rate = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->sample_rate = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__bool ok = true;
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- if(value >= sizeof(compression_levels_) / sizeof(compression_levels_[0]))
- value = sizeof(compression_levels_) / sizeof(compression_levels_[0]) - 1;
- ok &= FLAC__stream_encoder_set_do_mid_side_stereo(encoder, compression_levels_[value].do_mid_side_stereo);
- ok &= FLAC__stream_encoder_set_loose_mid_side_stereo(encoder, compression_levels_[value].loose_mid_side_stereo);
+ FLAC__bool ok = true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ if(value >= sizeof(compression_levels_)/sizeof(compression_levels_[0]))
+ value = sizeof(compression_levels_)/sizeof(compression_levels_[0]) - 1;
+ ok &= FLAC__stream_encoder_set_do_mid_side_stereo (encoder, compression_levels_[value].do_mid_side_stereo);
+ ok &= FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, compression_levels_[value].loose_mid_side_stereo);
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#if 0
- /* was: */
- ok &= FLAC__stream_encoder_set_apodization(encoder, compression_levels_[value].apodization);
- /* but it's too hard to specify the string in a locale-specific way */
+ /* was: */
+ ok &= FLAC__stream_encoder_set_apodization (encoder, compression_levels_[value].apodization);
+ /* but it's too hard to specify the string in a locale-specific way */
#else
- encoder->protected_->num_apodizations = 1;
- encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
- encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
+ encoder->protected_->num_apodizations = 1;
+ encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
+ encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
#endif
#endif
- ok &= FLAC__stream_encoder_set_max_lpc_order(encoder, compression_levels_[value].max_lpc_order);
- ok &= FLAC__stream_encoder_set_qlp_coeff_precision(encoder, compression_levels_[value].qlp_coeff_precision);
- ok &= FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder, compression_levels_[value].do_qlp_coeff_prec_search);
- ok &= FLAC__stream_encoder_set_do_escape_coding(encoder, compression_levels_[value].do_escape_coding);
- ok &= FLAC__stream_encoder_set_do_exhaustive_model_search(encoder, compression_levels_[value].do_exhaustive_model_search);
- ok &= FLAC__stream_encoder_set_min_residual_partition_order(encoder, compression_levels_[value].min_residual_partition_order);
- ok &= FLAC__stream_encoder_set_max_residual_partition_order(encoder, compression_levels_[value].max_residual_partition_order);
- ok &= FLAC__stream_encoder_set_rice_parameter_search_dist(encoder, compression_levels_[value].rice_parameter_search_dist);
- return ok;
+ ok &= FLAC__stream_encoder_set_max_lpc_order (encoder, compression_levels_[value].max_lpc_order);
+ ok &= FLAC__stream_encoder_set_qlp_coeff_precision (encoder, compression_levels_[value].qlp_coeff_precision);
+ ok &= FLAC__stream_encoder_set_do_qlp_coeff_prec_search (encoder, compression_levels_[value].do_qlp_coeff_prec_search);
+ ok &= FLAC__stream_encoder_set_do_escape_coding (encoder, compression_levels_[value].do_escape_coding);
+ ok &= FLAC__stream_encoder_set_do_exhaustive_model_search (encoder, compression_levels_[value].do_exhaustive_model_search);
+ ok &= FLAC__stream_encoder_set_min_residual_partition_order(encoder, compression_levels_[value].min_residual_partition_order);
+ ok &= FLAC__stream_encoder_set_max_residual_partition_order(encoder, compression_levels_[value].max_residual_partition_order);
+ ok &= FLAC__stream_encoder_set_rice_parameter_search_dist (encoder, compression_levels_[value].rice_parameter_search_dist);
+ return ok;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->blocksize = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->blocksize = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->do_mid_side_stereo = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->do_mid_side_stereo = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->loose_mid_side_stereo = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->loose_mid_side_stereo = value;
+ return true;
}
/*@@@@add to tests*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- FLAC__ASSERT(0 != specification);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ FLAC__ASSERT(0 != specification);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
#ifdef FLAC__INTEGER_ONLY_LIBRARY
- (void)specification; /* silently ignore since we haven't integerized; will always use a rectangular window */
+ (void)specification; /* silently ignore since we haven't integerized; will always use a rectangular window */
#else
- encoder->protected_->num_apodizations = 0;
- while(1)
- {
- const char *s = strchr(specification, ';');
- const size_t n = s ? (size_t)(s - specification) : strlen(specification);
- if(n == 8 && 0 == strncmp("bartlett" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT;
- else if(n == 13 && 0 == strncmp("bartlett_hann", specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT_HANN;
- else if(n == 8 && 0 == strncmp("blackman" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN;
- else if(n == 26 && 0 == strncmp("blackman_harris_4term_92db", specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE;
- else if(n == 6 && 0 == strncmp("connes" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_CONNES;
- else if(n == 7 && 0 == strncmp("flattop" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_FLATTOP;
- else if(n > 7 && 0 == strncmp("gauss(" , specification, 6))
- {
- FLAC__real stddev = (FLAC__real)strtod(specification + 6, 0);
- if(stddev > 0.0 && stddev <= 0.5)
- {
- encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.gauss.stddev = stddev;
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_GAUSS;
- }
- }
- else if(n == 7 && 0 == strncmp("hamming" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HAMMING;
- else if(n == 4 && 0 == strncmp("hann" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HANN;
- else if(n == 13 && 0 == strncmp("kaiser_bessel", specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_KAISER_BESSEL;
- else if(n == 7 && 0 == strncmp("nuttall" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_NUTTALL;
- else if(n == 9 && 0 == strncmp("rectangle" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_RECTANGLE;
- else if(n == 8 && 0 == strncmp("triangle" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TRIANGLE;
- else if(n > 7 && 0 == strncmp("tukey(" , specification, 6))
- {
- FLAC__real p = (FLAC__real)strtod(specification + 6, 0);
- if(p >= 0.0 && p <= 1.0)
- {
- encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.tukey.p = p;
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY;
- }
- }
- else if(n == 5 && 0 == strncmp("welch" , specification, n))
- encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_WELCH;
- if(encoder->protected_->num_apodizations == 32)
- break;
- if(s)
- specification = s + 1;
- else
- break;
- }
- if(encoder->protected_->num_apodizations == 0)
- {
- encoder->protected_->num_apodizations = 1;
- encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
- encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
- }
+ encoder->protected_->num_apodizations = 0;
+ while(1) {
+ const char *s = strchr(specification, ';');
+ const size_t n = s? (size_t)(s - specification) : strlen(specification);
+ if (n==8 && 0 == strncmp("bartlett" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT;
+ else if(n==13 && 0 == strncmp("bartlett_hann", specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT_HANN;
+ else if(n==8 && 0 == strncmp("blackman" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN;
+ else if(n==26 && 0 == strncmp("blackman_harris_4term_92db", specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE;
+ else if(n==6 && 0 == strncmp("connes" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_CONNES;
+ else if(n==7 && 0 == strncmp("flattop" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_FLATTOP;
+ else if(n>7 && 0 == strncmp("gauss(" , specification, 6)) {
+ FLAC__real stddev = (FLAC__real)strtod(specification+6, 0);
+ if (stddev > 0.0 && stddev <= 0.5) {
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.gauss.stddev = stddev;
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_GAUSS;
+ }
+ }
+ else if(n==7 && 0 == strncmp("hamming" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HAMMING;
+ else if(n==4 && 0 == strncmp("hann" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HANN;
+ else if(n==13 && 0 == strncmp("kaiser_bessel", specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_KAISER_BESSEL;
+ else if(n==7 && 0 == strncmp("nuttall" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_NUTTALL;
+ else if(n==9 && 0 == strncmp("rectangle" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_RECTANGLE;
+ else if(n==8 && 0 == strncmp("triangle" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TRIANGLE;
+ else if(n>7 && 0 == strncmp("tukey(" , specification, 6)) {
+ FLAC__real p = (FLAC__real)strtod(specification+6, 0);
+ if (p >= 0.0 && p <= 1.0) {
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.tukey.p = p;
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY;
+ }
+ }
+ else if(n==5 && 0 == strncmp("welch" , specification, n))
+ encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_WELCH;
+ if (encoder->protected_->num_apodizations == 32)
+ break;
+ if (s)
+ specification = s+1;
+ else
+ break;
+ }
+ if(encoder->protected_->num_apodizations == 0) {
+ encoder->protected_->num_apodizations = 1;
+ encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
+ encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
+ }
#endif
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->max_lpc_order = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->max_lpc_order = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->qlp_coeff_precision = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->qlp_coeff_precision = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->do_qlp_coeff_prec_search = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->do_qlp_coeff_prec_search = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
#if 0
- /*@@@ deprecated: */
- encoder->protected_->do_escape_coding = value;
+ /*@@@ deprecated: */
+ encoder->protected_->do_escape_coding = value;
#else
- (void)value;
+ (void)value;
#endif
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->do_exhaustive_model_search = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->do_exhaustive_model_search = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->min_residual_partition_order = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->min_residual_partition_order = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->max_residual_partition_order = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->max_residual_partition_order = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
#if 0
- /*@@@ deprecated: */
- encoder->protected_->rice_parameter_search_dist = value;
+ /*@@@ deprecated: */
+ encoder->protected_->rice_parameter_search_dist = value;
#else
- (void)value;
+ (void)value;
#endif
- return true;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->protected_->total_samples_estimate = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->protected_->total_samples_estimate = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- if(0 == metadata)
- num_blocks = 0;
- if(0 == num_blocks)
- metadata = 0;
- /* realloc() does not do exactly what we want so... */
- if(encoder->protected_->metadata)
- {
- free(encoder->protected_->metadata);
- encoder->protected_->metadata = 0;
- encoder->protected_->num_metadata_blocks = 0;
- }
- if(num_blocks)
- {
- FLAC__StreamMetadata **m;
- if(0 == (m = (FLAC__StreamMetadata**)safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks)))
- return false;
- memcpy(m, metadata, sizeof(m[0]) * num_blocks);
- encoder->protected_->metadata = m;
- encoder->protected_->num_metadata_blocks = num_blocks;
- }
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ if(0 == metadata)
+ num_blocks = 0;
+ if(0 == num_blocks)
+ metadata = 0;
+ /* realloc() does not do exactly what we want so... */
+ if(encoder->protected_->metadata) {
+ free(encoder->protected_->metadata);
+ encoder->protected_->metadata = 0;
+ encoder->protected_->num_metadata_blocks = 0;
+ }
+ if(num_blocks) {
+ FLAC__StreamMetadata **m;
+ if(0 == (m = (FLAC__StreamMetadata**)safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks)))
+ return false;
+ memcpy(m, metadata, sizeof(m[0]) * num_blocks);
+ encoder->protected_->metadata = m;
+ encoder->protected_->num_metadata_blocks = num_blocks;
+ }
#if FLAC__HAS_OGG
- if(!FLAC__ogg_encoder_aspect_set_num_metadata(&encoder->protected_->ogg_encoder_aspect, num_blocks))
- return false;
+ if(!FLAC__ogg_encoder_aspect_set_num_metadata(&encoder->protected_->ogg_encoder_aspect, num_blocks))
+ return false;
#endif
- return true;
+ return true;
}
/*
@@ -1832,378 +1739,362 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encod
*/
FLAC_API FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->private_->disable_constant_subframes = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->private_->disable_constant_subframes = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->private_->disable_fixed_subframes = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->private_->disable_fixed_subframes = value;
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
- return false;
- encoder->private_->disable_verbatim_subframes = value;
- return true;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
+ return false;
+ encoder->private_->disable_verbatim_subframes = value;
+ return true;
}
FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->state;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->state;
}
FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->verify)
- return FLAC__stream_decoder_get_state(encoder->private_->verify.decoder);
- else
- return FLAC__STREAM_DECODER_UNINITIALIZED;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->verify)
+ return FLAC__stream_decoder_get_state(encoder->private_->verify.decoder);
+ else
+ return FLAC__STREAM_DECODER_UNINITIALIZED;
}
FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
- return FLAC__StreamEncoderStateString[encoder->protected_->state];
- else
- return FLAC__stream_decoder_get_resolved_state_string(encoder->private_->verify.decoder);
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
+ return FLAC__StreamEncoderStateString[encoder->protected_->state];
+ else
+ return FLAC__stream_decoder_get_resolved_state_string(encoder->private_->verify.decoder);
}
FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- if(0 != absolute_sample)
- *absolute_sample = encoder->private_->verify.error_stats.absolute_sample;
- if(0 != frame_number)
- *frame_number = encoder->private_->verify.error_stats.frame_number;
- if(0 != channel)
- *channel = encoder->private_->verify.error_stats.channel;
- if(0 != sample)
- *sample = encoder->private_->verify.error_stats.sample;
- if(0 != expected)
- *expected = encoder->private_->verify.error_stats.expected;
- if(0 != got)
- *got = encoder->private_->verify.error_stats.got;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ if(0 != absolute_sample)
+ *absolute_sample = encoder->private_->verify.error_stats.absolute_sample;
+ if(0 != frame_number)
+ *frame_number = encoder->private_->verify.error_stats.frame_number;
+ if(0 != channel)
+ *channel = encoder->private_->verify.error_stats.channel;
+ if(0 != sample)
+ *sample = encoder->private_->verify.error_stats.sample;
+ if(0 != expected)
+ *expected = encoder->private_->verify.error_stats.expected;
+ if(0 != got)
+ *got = encoder->private_->verify.error_stats.got;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->verify;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->verify;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->streamable_subset;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->streamable_subset;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_do_md5(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->do_md5;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->do_md5;
}
FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->channels;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->channels;
}
FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->bits_per_sample;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->bits_per_sample;
}
FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->sample_rate;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->sample_rate;
}
FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->blocksize;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->blocksize;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->do_mid_side_stereo;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->do_mid_side_stereo;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->loose_mid_side_stereo;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->loose_mid_side_stereo;
}
FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->max_lpc_order;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->max_lpc_order;
}
FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->qlp_coeff_precision;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->qlp_coeff_precision;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->do_qlp_coeff_prec_search;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->do_qlp_coeff_prec_search;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->do_escape_coding;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->do_escape_coding;
}
FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->do_exhaustive_model_search;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->do_exhaustive_model_search;
}
FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->min_residual_partition_order;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->min_residual_partition_order;
}
FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->max_residual_partition_order;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->max_residual_partition_order;
}
FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->rice_parameter_search_dist;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->rice_parameter_search_dist;
}
FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- return encoder->protected_->total_samples_estimate;
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ return encoder->protected_->total_samples_estimate;
}
FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples)
{
- unsigned i, j = 0, channel;
- const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
-
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
-
- do
- {
- const unsigned n = min(blocksize + OVERREAD_ - encoder->private_->current_sample_number, samples - j);
-
- if(encoder->protected_->verify)
- append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, n);
-
- for(channel = 0; channel < channels; channel++)
- memcpy(&encoder->private_->integer_signal[channel][encoder->private_->current_sample_number], &buffer[channel][j], sizeof(buffer[channel][0]) * n);
-
- if(encoder->protected_->do_mid_side_stereo)
- {
- FLAC__ASSERT(channels == 2);
- /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */
- for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++)
- {
- encoder->private_->integer_signal_mid_side[1][i] = buffer[0][j] - buffer[1][j];
- encoder->private_->integer_signal_mid_side[0][i] = (buffer[0][j] + buffer[1][j]) >> 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */
- }
- }
- else
- j += n;
-
- encoder->private_->current_sample_number += n;
-
- /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */
- if(encoder->private_->current_sample_number > blocksize)
- {
- FLAC__ASSERT(encoder->private_->current_sample_number == blocksize + OVERREAD_);
- FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */
- if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false))
- return false;
- /* move unprocessed overread samples to beginnings of arrays */
- for(channel = 0; channel < channels; channel++)
- encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize];
- if(encoder->protected_->do_mid_side_stereo)
- {
- encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize];
- encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize];
- }
- encoder->private_->current_sample_number = 1;
- }
- }
- while(j < samples);
-
- return true;
+ unsigned i, j = 0, channel;
+ const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
+
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
+
+ do {
+ const unsigned n = min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j);
+
+ if(encoder->protected_->verify)
+ append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, n);
+
+ for(channel = 0; channel < channels; channel++)
+ memcpy(&encoder->private_->integer_signal[channel][encoder->private_->current_sample_number], &buffer[channel][j], sizeof(buffer[channel][0]) * n);
+
+ if(encoder->protected_->do_mid_side_stereo) {
+ FLAC__ASSERT(channels == 2);
+ /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */
+ for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) {
+ encoder->private_->integer_signal_mid_side[1][i] = buffer[0][j] - buffer[1][j];
+ encoder->private_->integer_signal_mid_side[0][i] = (buffer[0][j] + buffer[1][j]) >> 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */
+ }
+ }
+ else
+ j += n;
+
+ encoder->private_->current_sample_number += n;
+
+ /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */
+ if(encoder->private_->current_sample_number > blocksize) {
+ FLAC__ASSERT(encoder->private_->current_sample_number == blocksize+OVERREAD_);
+ FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */
+ if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false))
+ return false;
+ /* move unprocessed overread samples to beginnings of arrays */
+ for(channel = 0; channel < channels; channel++)
+ encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize];
+ if(encoder->protected_->do_mid_side_stereo) {
+ encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize];
+ encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize];
+ }
+ encoder->private_->current_sample_number = 1;
+ }
+ } while(j < samples);
+
+ return true;
}
FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples)
{
- unsigned i, j, k, channel;
- FLAC__int32 x, mid, side;
- const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
-
- FLAC__ASSERT(0 != encoder);
- FLAC__ASSERT(0 != encoder->private_);
- FLAC__ASSERT(0 != encoder->protected_);
- FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
-
- j = k = 0;
- /*
- * we have several flavors of the same basic loop, optimized for
- * different conditions:
- */
- if(encoder->protected_->do_mid_side_stereo && channels == 2)
- {
- /*
- * stereo coding: unroll channel loop
- */
- do
- {
- if(encoder->protected_->verify)
- append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize + OVERREAD_ - encoder->private_->current_sample_number, samples - j));
-
- /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */
- for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++)
- {
- encoder->private_->integer_signal[0][i] = mid = side = buffer[k++];
- x = buffer[k++];
- encoder->private_->integer_signal[1][i] = x;
- mid += x;
- side -= x;
- mid >>= 1; /* NOTE: not the same as 'mid = (left + right) / 2' ! */
- encoder->private_->integer_signal_mid_side[1][i] = side;
- encoder->private_->integer_signal_mid_side[0][i] = mid;
- }
- encoder->private_->current_sample_number = i;
- /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */
- if(i > blocksize)
- {
- if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false))
- return false;
- /* move unprocessed overread samples to beginnings of arrays */
- FLAC__ASSERT(i == blocksize + OVERREAD_);
- FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */
- encoder->private_->integer_signal[0][0] = encoder->private_->integer_signal[0][blocksize];
- encoder->private_->integer_signal[1][0] = encoder->private_->integer_signal[1][blocksize];
- encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize];
- encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize];
- encoder->private_->current_sample_number = 1;
- }
- }
- while(j < samples);
- }
- else
- {
- /*
- * independent channel coding: buffer each channel in inner loop
- */
- do
- {
- if(encoder->protected_->verify)
- append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize + OVERREAD_ - encoder->private_->current_sample_number, samples - j));
-
- /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */
- for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++)
- {
- for(channel = 0; channel < channels; channel++)
- encoder->private_->integer_signal[channel][i] = buffer[k++];
- }
- encoder->private_->current_sample_number = i;
- /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */
- if(i > blocksize)
- {
- if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false))
- return false;
- /* move unprocessed overread samples to beginnings of arrays */
- FLAC__ASSERT(i == blocksize + OVERREAD_);
- FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */
- for(channel = 0; channel < channels; channel++)
- encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize];
- encoder->private_->current_sample_number = 1;
- }
- }
- while(j < samples);
- }
-
- return true;
+ unsigned i, j, k, channel;
+ FLAC__int32 x, mid, side;
+ const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
+
+ FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder->private_);
+ FLAC__ASSERT(0 != encoder->protected_);
+ FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
+
+ j = k = 0;
+ /*
+ * we have several flavors of the same basic loop, optimized for
+ * different conditions:
+ */
+ if(encoder->protected_->do_mid_side_stereo && channels == 2) {
+ /*
+ * stereo coding: unroll channel loop
+ */
+ do {
+ if(encoder->protected_->verify)
+ append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j));
+
+ /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */
+ for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) {
+ encoder->private_->integer_signal[0][i] = mid = side = buffer[k++];
+ x = buffer[k++];
+ encoder->private_->integer_signal[1][i] = x;
+ mid += x;
+ side -= x;
+ mid >>= 1; /* NOTE: not the same as 'mid = (left + right) / 2' ! */
+ encoder->private_->integer_signal_mid_side[1][i] = side;
+ encoder->private_->integer_signal_mid_side[0][i] = mid;
+ }
+ encoder->private_->current_sample_number = i;
+ /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */
+ if(i > blocksize) {
+ if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false))
+ return false;
+ /* move unprocessed overread samples to beginnings of arrays */
+ FLAC__ASSERT(i == blocksize+OVERREAD_);
+ FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */
+ encoder->private_->integer_signal[0][0] = encoder->private_->integer_signal[0][blocksize];
+ encoder->private_->integer_signal[1][0] = encoder->private_->integer_signal[1][blocksize];
+ encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize];
+ encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize];
+ encoder->private_->current_sample_number = 1;
+ }
+ } while(j < samples);
+ }
+ else {
+ /*
+ * independent channel coding: buffer each channel in inner loop
+ */
+ do {
+ if(encoder->protected_->verify)
+ append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j));
+
+ /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */
+ for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) {
+ for(channel = 0; channel < channels; channel++)
+ encoder->private_->integer_signal[channel][i] = buffer[k++];
+ }
+ encoder->private_->current_sample_number = i;
+ /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */
+ if(i > blocksize) {
+ if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false))
+ return false;
+ /* move unprocessed overread samples to beginnings of arrays */
+ FLAC__ASSERT(i == blocksize+OVERREAD_);
+ FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */
+ for(channel = 0; channel < channels; channel++)
+ encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize];
+ encoder->private_->current_sample_number = 1;
+ }
+ } while(j < samples);
+ }
+
+ return true;
}
/***********************************************************************
@@ -2214,2411 +2105,2191 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder
void set_defaults_(FLAC__StreamEncoder *encoder)
{
- FLAC__ASSERT(0 != encoder);
+ FLAC__ASSERT(0 != encoder);
#ifdef FLAC__MANDATORY_VERIFY_WHILE_ENCODING
- encoder->protected_->verify = true;
+ encoder->protected_->verify = true;
#else
- encoder->protected_->verify = false;
+ encoder->protected_->verify = false;
#endif
- encoder->protected_->streamable_subset = true;
- encoder->protected_->do_md5 = true;
- encoder->protected_->do_mid_side_stereo = false;
- encoder->protected_->loose_mid_side_stereo = false;
- encoder->protected_->channels = 2;
- encoder->protected_->bits_per_sample = 16;
- encoder->protected_->sample_rate = 44100;
- encoder->protected_->blocksize = 0;
+ encoder->protected_->streamable_subset = true;
+ encoder->protected_->do_md5 = true;
+ encoder->protected_->do_mid_side_stereo = false;
+ encoder->protected_->loose_mid_side_stereo = false;
+ encoder->protected_->channels = 2;
+ encoder->protected_->bits_per_sample = 16;
+ encoder->protected_->sample_rate = 44100;
+ encoder->protected_->blocksize = 0;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- encoder->protected_->num_apodizations = 1;
- encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
- encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
+ encoder->protected_->num_apodizations = 1;
+ encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY;
+ encoder->protected_->apodizations[0].parameters.tukey.p = 0.5;
#endif
- encoder->protected_->max_lpc_order = 0;
- encoder->protected_->qlp_coeff_precision = 0;
- encoder->protected_->do_qlp_coeff_prec_search = false;
- encoder->protected_->do_exhaustive_model_search = false;
- encoder->protected_->do_escape_coding = false;
- encoder->protected_->min_residual_partition_order = 0;
- encoder->protected_->max_residual_partition_order = 0;
- encoder->protected_->rice_parameter_search_dist = 0;
- encoder->protected_->total_samples_estimate = 0;
- encoder->protected_->metadata = 0;
- encoder->protected_->num_metadata_blocks = 0;
-
- encoder->private_->seek_table = 0;
- encoder->private_->disable_constant_subframes = false;
- encoder->private_->disable_fixed_subframes = false;
- encoder->private_->disable_verbatim_subframes = false;
+ encoder->protected_->max_lpc_order = 0;
+ encoder->protected_->qlp_coeff_precision = 0;
+ encoder->protected_->do_qlp_coeff_prec_search = false;
+ encoder->protected_->do_exhaustive_model_search = false;
+ encoder->protected_->do_escape_coding = false;
+ encoder->protected_->min_residual_partition_order = 0;
+ encoder->protected_->max_residual_partition_order = 0;
+ encoder->protected_->rice_parameter_search_dist = 0;
+ encoder->protected_->total_samples_estimate = 0;
+ encoder->protected_->metadata = 0;
+ encoder->protected_->num_metadata_blocks = 0;
+
+ encoder->private_->seek_table = 0;
+ encoder->private_->disable_constant_subframes = false;
+ encoder->private_->disable_fixed_subframes = false;
+ encoder->private_->disable_verbatim_subframes = false;
#if FLAC__HAS_OGG
- encoder->private_->is_ogg = false;
+ encoder->private_->is_ogg = false;
#endif
- encoder->private_->read_callback = 0;
- encoder->private_->write_callback = 0;
- encoder->private_->seek_callback = 0;
- encoder->private_->tell_callback = 0;
- encoder->private_->metadata_callback = 0;
- encoder->private_->progress_callback = 0;
- encoder->private_->client_data = 0;
+ encoder->private_->read_callback = 0;
+ encoder->private_->write_callback = 0;
+ encoder->private_->seek_callback = 0;
+ encoder->private_->tell_callback = 0;
+ encoder->private_->metadata_callback = 0;
+ encoder->private_->progress_callback = 0;
+ encoder->private_->client_data = 0;
#if FLAC__HAS_OGG
- FLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect);
+ FLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect);
#endif
- FLAC__stream_encoder_set_compression_level(encoder, 5);
+ FLAC__stream_encoder_set_compression_level(encoder, 5);
}
void free_(FLAC__StreamEncoder *encoder)
{
- unsigned i, channel;
-
- FLAC__ASSERT(0 != encoder);
- if(encoder->protected_->metadata)
- {
- free(encoder->protected_->metadata);
- encoder->protected_->metadata = 0;
- encoder->protected_->num_metadata_blocks = 0;
- }
- for(i = 0; i < encoder->protected_->channels; i++)
- {
- if(0 != encoder->private_->integer_signal_unaligned[i])
- {
- free(encoder->private_->integer_signal_unaligned[i]);
- encoder->private_->integer_signal_unaligned[i] = 0;
- }
+ unsigned i, channel;
+
+ FLAC__ASSERT(0 != encoder);
+ if(encoder->protected_->metadata) {
+ free(encoder->protected_->metadata);
+ encoder->protected_->metadata = 0;
+ encoder->protected_->num_metadata_blocks = 0;
+ }
+ for(i = 0; i < encoder->protected_->channels; i++) {
+ if(0 != encoder->private_->integer_signal_unaligned[i]) {
+ free(encoder->private_->integer_signal_unaligned[i]);
+ encoder->private_->integer_signal_unaligned[i] = 0;
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- if(0 != encoder->private_->real_signal_unaligned[i])
- {
- free(encoder->private_->real_signal_unaligned[i]);
- encoder->private_->real_signal_unaligned[i] = 0;
- }
+ if(0 != encoder->private_->real_signal_unaligned[i]) {
+ free(encoder->private_->real_signal_unaligned[i]);
+ encoder->private_->real_signal_unaligned[i] = 0;
+ }
#endif
- }
- for(i = 0; i < 2; i++)
- {
- if(0 != encoder->private_->integer_signal_mid_side_unaligned[i])
- {
- free(encoder->private_->integer_signal_mid_side_unaligned[i]);
- encoder->private_->integer_signal_mid_side_unaligned[i] = 0;
- }
+ }
+ for(i = 0; i < 2; i++) {
+ if(0 != encoder->private_->integer_signal_mid_side_unaligned[i]) {
+ free(encoder->private_->integer_signal_mid_side_unaligned[i]);
+ encoder->private_->integer_signal_mid_side_unaligned[i] = 0;
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- if(0 != encoder->private_->real_signal_mid_side_unaligned[i])
- {
- free(encoder->private_->real_signal_mid_side_unaligned[i]);
- encoder->private_->real_signal_mid_side_unaligned[i] = 0;
- }
+ if(0 != encoder->private_->real_signal_mid_side_unaligned[i]) {
+ free(encoder->private_->real_signal_mid_side_unaligned[i]);
+ encoder->private_->real_signal_mid_side_unaligned[i] = 0;
+ }
#endif
- }
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- for(i = 0; i < encoder->protected_->num_apodizations; i++)
- {
- if(0 != encoder->private_->window_unaligned[i])
- {
- free(encoder->private_->window_unaligned[i]);
- encoder->private_->window_unaligned[i] = 0;
- }
- }
- if(0 != encoder->private_->windowed_signal_unaligned)
- {
- free(encoder->private_->windowed_signal_unaligned);
- encoder->private_->windowed_signal_unaligned = 0;
- }
+ for(i = 0; i < encoder->protected_->num_apodizations; i++) {
+ if(0 != encoder->private_->window_unaligned[i]) {
+ free(encoder->private_->window_unaligned[i]);
+ encoder->private_->window_unaligned[i] = 0;
+ }
+ }
+ if(0 != encoder->private_->windowed_signal_unaligned) {
+ free(encoder->private_->windowed_signal_unaligned);
+ encoder->private_->windowed_signal_unaligned = 0;
+ }
#endif
- for(channel = 0; channel < encoder->protected_->channels; channel++)
- {
- for(i = 0; i < 2; i++)
- {
- if(0 != encoder->private_->residual_workspace_unaligned[channel][i])
- {
- free(encoder->private_->residual_workspace_unaligned[channel][i]);
- encoder->private_->residual_workspace_unaligned[channel][i] = 0;
- }
- }
- }
- for(channel = 0; channel < 2; channel++)
- {
- for(i = 0; i < 2; i++)
- {
- if(0 != encoder->private_->residual_workspace_mid_side_unaligned[channel][i])
- {
- free(encoder->private_->residual_workspace_mid_side_unaligned[channel][i]);
- encoder->private_->residual_workspace_mid_side_unaligned[channel][i] = 0;
- }
- }
- }
- if(0 != encoder->private_->abs_residual_partition_sums_unaligned)
- {
- free(encoder->private_->abs_residual_partition_sums_unaligned);
- encoder->private_->abs_residual_partition_sums_unaligned = 0;
- }
- if(0 != encoder->private_->raw_bits_per_partition_unaligned)
- {
- free(encoder->private_->raw_bits_per_partition_unaligned);
- encoder->private_->raw_bits_per_partition_unaligned = 0;
- }
- if(encoder->protected_->verify)
- {
- for(i = 0; i < encoder->protected_->channels; i++)
- {
- if(0 != encoder->private_->verify.input_fifo.data[i])
- {
- free(encoder->private_->verify.input_fifo.data[i]);
- encoder->private_->verify.input_fifo.data[i] = 0;
- }
- }
- }
- FLAC__bitwriter_free(encoder->private_->frame);
+ for(channel = 0; channel < encoder->protected_->channels; channel++) {
+ for(i = 0; i < 2; i++) {
+ if(0 != encoder->private_->residual_workspace_unaligned[channel][i]) {
+ free(encoder->private_->residual_workspace_unaligned[channel][i]);
+ encoder->private_->residual_workspace_unaligned[channel][i] = 0;
+ }
+ }
+ }
+ for(channel = 0; channel < 2; channel++) {
+ for(i = 0; i < 2; i++) {
+ if(0 != encoder->private_->residual_workspace_mid_side_unaligned[channel][i]) {
+ free(encoder->private_->residual_workspace_mid_side_unaligned[channel][i]);
+ encoder->private_->residual_workspace_mid_side_unaligned[channel][i] = 0;
+ }
+ }
+ }
+ if(0 != encoder->private_->abs_residual_partition_sums_unaligned) {
+ free(encoder->private_->abs_residual_partition_sums_unaligned);
+ encoder->private_->abs_residual_partition_sums_unaligned = 0;
+ }
+ if(0 != encoder->private_->raw_bits_per_partition_unaligned) {
+ free(encoder->private_->raw_bits_per_partition_unaligned);
+ encoder->private_->raw_bits_per_partition_unaligned = 0;
+ }
+ if(encoder->protected_->verify) {
+ for(i = 0; i < encoder->protected_->channels; i++) {
+ if(0 != encoder->private_->verify.input_fifo.data[i]) {
+ free(encoder->private_->verify.input_fifo.data[i]);
+ encoder->private_->verify.input_fifo.data[i] = 0;
+ }
+ }
+ }
+ FLAC__bitwriter_free(encoder->private_->frame);
}
FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize)
{
- FLAC__bool ok;
- unsigned i, channel;
-
- FLAC__ASSERT(new_blocksize > 0);
- FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
- FLAC__ASSERT(encoder->private_->current_sample_number == 0);
-
- /* To avoid excessive malloc'ing, we only grow the buffer; no shrinking. */
- if(new_blocksize <= encoder->private_->input_capacity)
- return true;
-
- ok = true;
-
- /* WATCHOUT: FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx()
- * requires that the input arrays (in our case the integer signals)
- * have a buffer of up to 3 zeroes in front (at negative indices) for
- * alignment purposes; we use 4 in front to keep the data well-aligned.
- */
-
- for(i = 0; ok && i < encoder->protected_->channels; i++)
- {
- ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize + 4 + OVERREAD_, &encoder->private_->integer_signal_unaligned[i], &encoder->private_->integer_signal[i]);
- memset(encoder->private_->integer_signal[i], 0, sizeof(FLAC__int32) * 4);
- encoder->private_->integer_signal[i] += 4;
+ FLAC__bool ok;
+ unsigned i, channel;
+
+ FLAC__ASSERT(new_blocksize > 0);
+ FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
+ FLAC__ASSERT(encoder->private_->current_sample_number == 0);
+
+ /* To avoid excessive malloc'ing, we only grow the buffer; no shrinking. */
+ if(new_blocksize <= encoder->private_->input_capacity)
+ return true;
+
+ ok = true;
+
+ /* WATCHOUT: FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx()
+ * requires that the input arrays (in our case the integer signals)
+ * have a buffer of up to 3 zeroes in front (at negative indices) for
+ * alignment purposes; we use 4 in front to keep the data well-aligned.
+ */
+
+ for(i = 0; ok && i < encoder->protected_->channels; i++) {
+ ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_unaligned[i], &encoder->private_->integer_signal[i]);
+ memset(encoder->private_->integer_signal[i], 0, sizeof(FLAC__int32)*4);
+ encoder->private_->integer_signal[i] += 4;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#if 0 /* @@@ currently unused */
- if(encoder->protected_->max_lpc_order > 0)
- ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize + OVERREAD_, &encoder->private_->real_signal_unaligned[i], &encoder->private_->real_signal[i]);
+ if(encoder->protected_->max_lpc_order > 0)
+ ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize+OVERREAD_, &encoder->private_->real_signal_unaligned[i], &encoder->private_->real_signal[i]);
#endif
#endif
- }
- for(i = 0; ok && i < 2; i++)
- {
- ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize + 4 + OVERREAD_, &encoder->private_->integer_signal_mid_side_unaligned[i], &encoder->private_->integer_signal_mid_side[i]);
- memset(encoder->private_->integer_signal_mid_side[i], 0, sizeof(FLAC__int32) * 4);
- encoder->private_->integer_signal_mid_side[i] += 4;
+ }
+ for(i = 0; ok && i < 2; i++) {
+ ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_mid_side_unaligned[i], &encoder->private_->integer_signal_mid_side[i]);
+ memset(encoder->private_->integer_signal_mid_side[i], 0, sizeof(FLAC__int32)*4);
+ encoder->private_->integer_signal_mid_side[i] += 4;
#ifndef FLAC__INTEGER_ONLY_LIBRARY
#if 0 /* @@@ currently unused */
- if(encoder->protected_->max_lpc_order > 0)
- ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize + OVERREAD_, &encoder->private_->real_signal_mid_side_unaligned[i], &encoder->private_->real_signal_mid_side[i]);
+ if(encoder->protected_->max_lpc_order > 0)
+ ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize+OVERREAD_, &encoder->private_->real_signal_mid_side_unaligned[i], &encoder->private_->real_signal_mid_side[i]);
#endif
#endif
- }
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- if(ok && encoder->protected_->max_lpc_order > 0)
- {
- for(i = 0; ok && i < encoder->protected_->num_apodizations; i++)
- ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->window_unaligned[i], &encoder->private_->window[i]);
- ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->windowed_signal_unaligned, &encoder->private_->windowed_signal);
- }
+ if(ok && encoder->protected_->max_lpc_order > 0) {
+ for(i = 0; ok && i < encoder->protected_->num_apodizations; i++)
+ ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->window_unaligned[i], &encoder->private_->window[i]);
+ ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->windowed_signal_unaligned, &encoder->private_->windowed_signal);
+ }
#endif
- for(channel = 0; ok && channel < encoder->protected_->channels; channel++)
- {
- for(i = 0; ok && i < 2; i++)
- {
- ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_unaligned[channel][i], &encoder->private_->residual_workspace[channel][i]);
- }
- }
- for(channel = 0; ok && channel < 2; channel++)
- {
- for(i = 0; ok && i < 2; i++)
- {
- ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_mid_side_unaligned[channel][i], &encoder->private_->residual_workspace_mid_side[channel][i]);
- }
- }
- /* the *2 is an approximation to the series 1 + 1/2 + 1/4 + ... that sums tree occupies in a flat array */
- /*@@@ new_blocksize*2 is too pessimistic, but to fix, we need smarter logic because a smaller new_blocksize can actually increase the # of partitions; would require moving this out into a separate function, then checking its capacity against the need of the current blocksize&min/max_partition_order (and maybe predictor order) */
- ok = ok && FLAC__memory_alloc_aligned_uint64_array(new_blocksize * 2, &encoder->private_->abs_residual_partition_sums_unaligned, &encoder->private_->abs_residual_partition_sums);
- if(encoder->protected_->do_escape_coding)
- ok = ok && FLAC__memory_alloc_aligned_unsigned_array(new_blocksize * 2, &encoder->private_->raw_bits_per_partition_unaligned, &encoder->private_->raw_bits_per_partition);
-
- /* now adjust the windows if the blocksize has changed */
+ for(channel = 0; ok && channel < encoder->protected_->channels; channel++) {
+ for(i = 0; ok && i < 2; i++) {
+ ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_unaligned[channel][i], &encoder->private_->residual_workspace[channel][i]);
+ }
+ }
+ for(channel = 0; ok && channel < 2; channel++) {
+ for(i = 0; ok && i < 2; i++) {
+ ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_mid_side_unaligned[channel][i], &encoder->private_->residual_workspace_mid_side[channel][i]);
+ }
+ }
+ /* the *2 is an approximation to the series 1 + 1/2 + 1/4 + ... that sums tree occupies in a flat array */
+ /*@@@ new_blocksize*2 is too pessimistic, but to fix, we need smarter logic because a smaller new_blocksize can actually increase the # of partitions; would require moving this out into a separate function, then checking its capacity against the need of the current blocksize&min/max_partition_order (and maybe predictor order) */
+ ok = ok && FLAC__memory_alloc_aligned_uint64_array(new_blocksize * 2, &encoder->private_->abs_residual_partition_sums_unaligned, &encoder->private_->abs_residual_partition_sums);
+ if(encoder->protected_->do_escape_coding)
+ ok = ok && FLAC__memory_alloc_aligned_unsigned_array(new_blocksize * 2, &encoder->private_->raw_bits_per_partition_unaligned, &encoder->private_->raw_bits_per_partition);
+
+ /* now adjust the windows if the blocksize has changed */
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- if(ok && new_blocksize != encoder->private_->input_capacity && encoder->protected_->max_lpc_order > 0)
- {
- for(i = 0; ok && i < encoder->protected_->num_apodizations; i++)
- {
- switch(encoder->protected_->apodizations[i].type)
- {
- case FLAC__APODIZATION_BARTLETT:
- FLAC__window_bartlett(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_BARTLETT_HANN:
- FLAC__window_bartlett_hann(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_BLACKMAN:
- FLAC__window_blackman(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE:
- FLAC__window_blackman_harris_4term_92db_sidelobe(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_CONNES:
- FLAC__window_connes(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_FLATTOP:
- FLAC__window_flattop(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_GAUSS:
- FLAC__window_gauss(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.gauss.stddev);
- break;
- case FLAC__APODIZATION_HAMMING:
- FLAC__window_hamming(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_HANN:
- FLAC__window_hann(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_KAISER_BESSEL:
- FLAC__window_kaiser_bessel(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_NUTTALL:
- FLAC__window_nuttall(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_RECTANGLE:
- FLAC__window_rectangle(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_TRIANGLE:
- FLAC__window_triangle(encoder->private_->window[i], new_blocksize);
- break;
- case FLAC__APODIZATION_TUKEY:
- FLAC__window_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.tukey.p);
- break;
- case FLAC__APODIZATION_WELCH:
- FLAC__window_welch(encoder->private_->window[i], new_blocksize);
- break;
- default:
- FLAC__ASSERT(0);
- /* double protection */
- FLAC__window_hann(encoder->private_->window[i], new_blocksize);
- break;
- }
- }
- }
+ if(ok && new_blocksize != encoder->private_->input_capacity && encoder->protected_->max_lpc_order > 0) {
+ for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) {
+ switch(encoder->protected_->apodizations[i].type) {
+ case FLAC__APODIZATION_BARTLETT:
+ FLAC__window_bartlett(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_BARTLETT_HANN:
+ FLAC__window_bartlett_hann(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_BLACKMAN:
+ FLAC__window_blackman(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE:
+ FLAC__window_blackman_harris_4term_92db_sidelobe(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_CONNES:
+ FLAC__window_connes(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_FLATTOP:
+ FLAC__window_flattop(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_GAUSS:
+ FLAC__window_gauss(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.gauss.stddev);
+ break;
+ case FLAC__APODIZATION_HAMMING:
+ FLAC__window_hamming(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_HANN:
+ FLAC__window_hann(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_KAISER_BESSEL:
+ FLAC__window_kaiser_bessel(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_NUTTALL:
+ FLAC__window_nuttall(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_RECTANGLE:
+ FLAC__window_rectangle(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_TRIANGLE:
+ FLAC__window_triangle(encoder->private_->window[i], new_blocksize);
+ break;
+ case FLAC__APODIZATION_TUKEY:
+ FLAC__window_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.tukey.p);
+ break;
+ case FLAC__APODIZATION_WELCH:
+ FLAC__window_welch(encoder->private_->window[i], new_blocksize);
+ break;
+ default:
+ FLAC__ASSERT(0);
+ /* double protection */
+ FLAC__window_hann(encoder->private_->window[i], new_blocksize);
+ break;
+ }
+ }
+ }
#endif
- if(ok)
- encoder->private_->input_capacity = new_blocksize;
- else
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ if(ok)
+ encoder->private_->input_capacity = new_blocksize;
+ else
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return ok;
+ return ok;
}
FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block)
{
- const FLAC__byte *buffer;
- size_t bytes;
-
- FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(encoder->private_->frame));
-
- if(!FLAC__bitwriter_get_buffer(encoder->private_->frame, &buffer, &bytes))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- if(encoder->protected_->verify)
- {
- encoder->private_->verify.output.data = buffer;
- encoder->private_->verify.output.bytes = bytes;
- if(encoder->private_->verify.state_hint == ENCODER_IN_MAGIC)
- {
- encoder->private_->verify.needs_magic_hack = true;
- }
- else
- {
- if(!FLAC__stream_decoder_process_single(encoder->private_->verify.decoder))
- {
- FLAC__bitwriter_release_buffer(encoder->private_->frame);
- FLAC__bitwriter_clear(encoder->private_->frame);
- if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA)
- encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
- return false;
- }
- }
- }
-
- if(write_frame_(encoder, buffer, bytes, samples, is_last_block) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- FLAC__bitwriter_release_buffer(encoder->private_->frame);
- FLAC__bitwriter_clear(encoder->private_->frame);
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return false;
- }
-
- FLAC__bitwriter_release_buffer(encoder->private_->frame);
- FLAC__bitwriter_clear(encoder->private_->frame);
-
- if(samples > 0)
- {
- encoder->private_->streaminfo.data.stream_info.min_framesize = min(bytes, encoder->private_->streaminfo.data.stream_info.min_framesize);
- encoder->private_->streaminfo.data.stream_info.max_framesize = max(bytes, encoder->private_->streaminfo.data.stream_info.max_framesize);
- }
-
- return true;
+ const FLAC__byte *buffer;
+ size_t bytes;
+
+ FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(encoder->private_->frame));
+
+ if(!FLAC__bitwriter_get_buffer(encoder->private_->frame, &buffer, &bytes)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ if(encoder->protected_->verify) {
+ encoder->private_->verify.output.data = buffer;
+ encoder->private_->verify.output.bytes = bytes;
+ if(encoder->private_->verify.state_hint == ENCODER_IN_MAGIC) {
+ encoder->private_->verify.needs_magic_hack = true;
+ }
+ else {
+ if(!FLAC__stream_decoder_process_single(encoder->private_->verify.decoder)) {
+ FLAC__bitwriter_release_buffer(encoder->private_->frame);
+ FLAC__bitwriter_clear(encoder->private_->frame);
+ if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
+ return false;
+ }
+ }
+ }
+
+ if(write_frame_(encoder, buffer, bytes, samples, is_last_block) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ FLAC__bitwriter_release_buffer(encoder->private_->frame);
+ FLAC__bitwriter_clear(encoder->private_->frame);
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return false;
+ }
+
+ FLAC__bitwriter_release_buffer(encoder->private_->frame);
+ FLAC__bitwriter_clear(encoder->private_->frame);
+
+ if(samples > 0) {
+ encoder->private_->streaminfo.data.stream_info.min_framesize = min(bytes, encoder->private_->streaminfo.data.stream_info.min_framesize);
+ encoder->private_->streaminfo.data.stream_info.max_framesize = max(bytes, encoder->private_->streaminfo.data.stream_info.max_framesize);
+ }
+
+ return true;
}
FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block)
{
- FLAC__StreamEncoderWriteStatus status;
- FLAC__uint64 output_position = 0;
-
- /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
- if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &output_position, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
- }
-
- /*
- * Watch for the STREAMINFO block and first SEEKTABLE block to go by and store their offsets.
- */
- if(samples == 0)
- {
- FLAC__MetadataType type = (buffer[0] & 0x7f);
- if(type == FLAC__METADATA_TYPE_STREAMINFO)
- encoder->protected_->streaminfo_offset = output_position;
- else if(type == FLAC__METADATA_TYPE_SEEKTABLE && encoder->protected_->seektable_offset == 0)
- encoder->protected_->seektable_offset = output_position;
- }
-
- /*
- * Mark the current seek point if hit (if audio_offset == 0 that
- * means we're still writing metadata and haven't hit the first
- * frame yet)
- */
- if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0)
- {
- const unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder);
- const FLAC__uint64 frame_first_sample = encoder->private_->samples_written;
- const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1;
- FLAC__uint64 test_sample;
- unsigned i;
- for(i = encoder->private_->first_seekpoint_to_check; i < encoder->private_->seek_table->num_points; i++)
- {
- test_sample = encoder->private_->seek_table->points[i].sample_number;
- if(test_sample > frame_last_sample)
- {
- break;
- }
- else if(test_sample >= frame_first_sample)
- {
- encoder->private_->seek_table->points[i].sample_number = frame_first_sample;
- encoder->private_->seek_table->points[i].stream_offset = output_position - encoder->protected_->audio_offset;
- encoder->private_->seek_table->points[i].frame_samples = blocksize;
- encoder->private_->first_seekpoint_to_check++;
- /* DO NOT: "break;" and here's why:
- * The seektable template may contain more than one target
- * sample for any given frame; we will keep looping, generating
- * duplicate seekpoints for them, and we'll clean it up later,
- * just before writing the seektable back to the metadata.
- */
- }
- else
- {
- encoder->private_->first_seekpoint_to_check++;
- }
- }
- }
+ FLAC__StreamEncoderWriteStatus status;
+ FLAC__uint64 output_position = 0;
+
+ /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */
+ if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &output_position, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ }
+
+ /*
+ * Watch for the STREAMINFO block and first SEEKTABLE block to go by and store their offsets.
+ */
+ if(samples == 0) {
+ FLAC__MetadataType type = (buffer[0] & 0x7f);
+ if(type == FLAC__METADATA_TYPE_STREAMINFO)
+ encoder->protected_->streaminfo_offset = output_position;
+ else if(type == FLAC__METADATA_TYPE_SEEKTABLE && encoder->protected_->seektable_offset == 0)
+ encoder->protected_->seektable_offset = output_position;
+ }
+
+ /*
+ * Mark the current seek point if hit (if audio_offset == 0 that
+ * means we're still writing metadata and haven't hit the first
+ * frame yet)
+ */
+ if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0) {
+ const unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder);
+ const FLAC__uint64 frame_first_sample = encoder->private_->samples_written;
+ const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1;
+ FLAC__uint64 test_sample;
+ unsigned i;
+ for(i = encoder->private_->first_seekpoint_to_check; i < encoder->private_->seek_table->num_points; i++) {
+ test_sample = encoder->private_->seek_table->points[i].sample_number;
+ if(test_sample > frame_last_sample) {
+ break;
+ }
+ else if(test_sample >= frame_first_sample) {
+ encoder->private_->seek_table->points[i].sample_number = frame_first_sample;
+ encoder->private_->seek_table->points[i].stream_offset = output_position - encoder->protected_->audio_offset;
+ encoder->private_->seek_table->points[i].frame_samples = blocksize;
+ encoder->private_->first_seekpoint_to_check++;
+ /* DO NOT: "break;" and here's why:
+ * The seektable template may contain more than one target
+ * sample for any given frame; we will keep looping, generating
+ * duplicate seekpoints for them, and we'll clean it up later,
+ * just before writing the seektable back to the metadata.
+ */
+ }
+ else {
+ encoder->private_->first_seekpoint_to_check++;
+ }
+ }
+ }
#if FLAC__HAS_OGG
- if(encoder->private_->is_ogg)
- {
- status = FLAC__ogg_encoder_aspect_write_callback_wrapper(
- &encoder->protected_->ogg_encoder_aspect,
- buffer,
- bytes,
- samples,
- encoder->private_->current_frame_number,
- is_last_block,
- (FLAC__OggEncoderAspectWriteCallbackProxy)encoder->private_->write_callback,
- encoder,
- encoder->private_->client_data
- );
- }
- else
+ if(encoder->private_->is_ogg) {
+ status = FLAC__ogg_encoder_aspect_write_callback_wrapper(
+ &encoder->protected_->ogg_encoder_aspect,
+ buffer,
+ bytes,
+ samples,
+ encoder->private_->current_frame_number,
+ is_last_block,
+ (FLAC__OggEncoderAspectWriteCallbackProxy)encoder->private_->write_callback,
+ encoder,
+ encoder->private_->client_data
+ );
+ }
+ else
#endif
- status = encoder->private_->write_callback(encoder, buffer, bytes, samples, encoder->private_->current_frame_number, encoder->private_->client_data);
-
- if(status == FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->private_->bytes_written += bytes;
- encoder->private_->samples_written += samples;
- /* we keep a high watermark on the number of frames written because
- * when the encoder goes back to write metadata, 'current_frame'
- * will drop back to 0.
- */
- encoder->private_->frames_written = max(encoder->private_->frames_written, encoder->private_->current_frame_number + 1);
- }
- else
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
-
- return status;
+ status = encoder->private_->write_callback(encoder, buffer, bytes, samples, encoder->private_->current_frame_number, encoder->private_->client_data);
+
+ if(status == FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->private_->bytes_written += bytes;
+ encoder->private_->samples_written += samples;
+ /* we keep a high watermark on the number of frames written because
+ * when the encoder goes back to write metadata, 'current_frame'
+ * will drop back to 0.
+ */
+ encoder->private_->frames_written = max(encoder->private_->frames_written, encoder->private_->current_frame_number+1);
+ }
+ else
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+
+ return status;
}
/* Gets called when the encoding process has finished so that we can update the STREAMINFO and SEEKTABLE blocks. */
void update_metadata_(const FLAC__StreamEncoder *encoder)
{
- FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)];
- const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo;
- const FLAC__uint64 samples = metadata->data.stream_info.total_samples;
- const unsigned min_framesize = metadata->data.stream_info.min_framesize;
- const unsigned max_framesize = metadata->data.stream_info.max_framesize;
- const unsigned bps = metadata->data.stream_info.bits_per_sample;
- FLAC__StreamEncoderSeekStatus seek_status;
-
- FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
-
- /* All this is based on intimate knowledge of the stream header
- * layout, but a change to the header format that would break this
- * would also break all streams encoded in the previous format.
- */
-
- /*
- * Write MD5 signature
- */
- {
- const unsigned md5_offset =
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- (
- FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN
- ) / 8;
-
- if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + md5_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK)
- {
- if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- if(encoder->private_->write_callback(encoder, metadata->data.stream_info.md5sum, 16, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- }
-
- /*
- * Write total samples
- */
- {
- const unsigned total_samples_byte_offset =
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- (
- FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN
- - 4
- ) / 8;
-
- b[0] = ((FLAC__byte)(bps - 1) << 4) | (FLAC__byte)((samples >> 32) & 0x0F);
- b[1] = (FLAC__byte)((samples >> 24) & 0xFF);
- b[2] = (FLAC__byte)((samples >> 16) & 0xFF);
- b[3] = (FLAC__byte)((samples >> 8) & 0xFF);
- b[4] = (FLAC__byte)(samples & 0xFF);
- if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + total_samples_byte_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK)
- {
- if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- if(encoder->private_->write_callback(encoder, b, 5, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- }
-
- /*
- * Write min/max framesize
- */
- {
- const unsigned min_framesize_offset =
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- (
- FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN
- ) / 8;
-
- b[0] = (FLAC__byte)((min_framesize >> 16) & 0xFF);
- b[1] = (FLAC__byte)((min_framesize >> 8) & 0xFF);
- b[2] = (FLAC__byte)(min_framesize & 0xFF);
- b[3] = (FLAC__byte)((max_framesize >> 16) & 0xFF);
- b[4] = (FLAC__byte)((max_framesize >> 8) & 0xFF);
- b[5] = (FLAC__byte)(max_framesize & 0xFF);
- if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + min_framesize_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK)
- {
- if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- if(encoder->private_->write_callback(encoder, b, 6, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- }
-
- /*
- * Write seektable
- */
- if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0)
- {
- unsigned i;
-
- FLAC__format_seektable_sort(encoder->private_->seek_table);
-
- FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table));
-
- if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->seektable_offset + FLAC__STREAM_METADATA_HEADER_LENGTH, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK)
- {
- if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
-
- for(i = 0; i < encoder->private_->seek_table->num_points; i++)
- {
- FLAC__uint64 xx;
- unsigned x;
- xx = encoder->private_->seek_table->points[i].sample_number;
- b[7] = (FLAC__byte)xx;
- xx >>= 8;
- b[6] = (FLAC__byte)xx;
- xx >>= 8;
- b[5] = (FLAC__byte)xx;
- xx >>= 8;
- b[4] = (FLAC__byte)xx;
- xx >>= 8;
- b[3] = (FLAC__byte)xx;
- xx >>= 8;
- b[2] = (FLAC__byte)xx;
- xx >>= 8;
- b[1] = (FLAC__byte)xx;
- xx >>= 8;
- b[0] = (FLAC__byte)xx;
- xx >>= 8;
- xx = encoder->private_->seek_table->points[i].stream_offset;
- b[15] = (FLAC__byte)xx;
- xx >>= 8;
- b[14] = (FLAC__byte)xx;
- xx >>= 8;
- b[13] = (FLAC__byte)xx;
- xx >>= 8;
- b[12] = (FLAC__byte)xx;
- xx >>= 8;
- b[11] = (FLAC__byte)xx;
- xx >>= 8;
- b[10] = (FLAC__byte)xx;
- xx >>= 8;
- b[9] = (FLAC__byte)xx;
- xx >>= 8;
- b[8] = (FLAC__byte)xx;
- xx >>= 8;
- x = encoder->private_->seek_table->points[i].frame_samples;
- b[17] = (FLAC__byte)x;
- x >>= 8;
- b[16] = (FLAC__byte)x;
- x >>= 8;
- if(encoder->private_->write_callback(encoder, b, 18, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
- return;
- }
- }
- }
+ FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)];
+ const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo;
+ const FLAC__uint64 samples = metadata->data.stream_info.total_samples;
+ const unsigned min_framesize = metadata->data.stream_info.min_framesize;
+ const unsigned max_framesize = metadata->data.stream_info.max_framesize;
+ const unsigned bps = metadata->data.stream_info.bits_per_sample;
+ FLAC__StreamEncoderSeekStatus seek_status;
+
+ FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
+
+ /* All this is based on intimate knowledge of the stream header
+ * layout, but a change to the header format that would break this
+ * would also break all streams encoded in the previous format.
+ */
+
+ /*
+ * Write MD5 signature
+ */
+ {
+ const unsigned md5_offset =
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ (
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN
+ ) / 8;
+
+ if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + md5_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
+ if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ if(encoder->private_->write_callback(encoder, metadata->data.stream_info.md5sum, 16, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ }
+
+ /*
+ * Write total samples
+ */
+ {
+ const unsigned total_samples_byte_offset =
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ (
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN
+ - 4
+ ) / 8;
+
+ b[0] = ((FLAC__byte)(bps-1) << 4) | (FLAC__byte)((samples >> 32) & 0x0F);
+ b[1] = (FLAC__byte)((samples >> 24) & 0xFF);
+ b[2] = (FLAC__byte)((samples >> 16) & 0xFF);
+ b[3] = (FLAC__byte)((samples >> 8) & 0xFF);
+ b[4] = (FLAC__byte)(samples & 0xFF);
+ if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + total_samples_byte_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
+ if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ if(encoder->private_->write_callback(encoder, b, 5, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ }
+
+ /*
+ * Write min/max framesize
+ */
+ {
+ const unsigned min_framesize_offset =
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ (
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN
+ ) / 8;
+
+ b[0] = (FLAC__byte)((min_framesize >> 16) & 0xFF);
+ b[1] = (FLAC__byte)((min_framesize >> 8) & 0xFF);
+ b[2] = (FLAC__byte)(min_framesize & 0xFF);
+ b[3] = (FLAC__byte)((max_framesize >> 16) & 0xFF);
+ b[4] = (FLAC__byte)((max_framesize >> 8) & 0xFF);
+ b[5] = (FLAC__byte)(max_framesize & 0xFF);
+ if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + min_framesize_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
+ if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ if(encoder->private_->write_callback(encoder, b, 6, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ }
+
+ /*
+ * Write seektable
+ */
+ if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) {
+ unsigned i;
+
+ FLAC__format_seektable_sort(encoder->private_->seek_table);
+
+ FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table));
+
+ if((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->seektable_offset + FLAC__STREAM_METADATA_HEADER_LENGTH, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
+ if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+
+ for(i = 0; i < encoder->private_->seek_table->num_points; i++) {
+ FLAC__uint64 xx;
+ unsigned x;
+ xx = encoder->private_->seek_table->points[i].sample_number;
+ b[7] = (FLAC__byte)xx; xx >>= 8;
+ b[6] = (FLAC__byte)xx; xx >>= 8;
+ b[5] = (FLAC__byte)xx; xx >>= 8;
+ b[4] = (FLAC__byte)xx; xx >>= 8;
+ b[3] = (FLAC__byte)xx; xx >>= 8;
+ b[2] = (FLAC__byte)xx; xx >>= 8;
+ b[1] = (FLAC__byte)xx; xx >>= 8;
+ b[0] = (FLAC__byte)xx; xx >>= 8;
+ xx = encoder->private_->seek_table->points[i].stream_offset;
+ b[15] = (FLAC__byte)xx; xx >>= 8;
+ b[14] = (FLAC__byte)xx; xx >>= 8;
+ b[13] = (FLAC__byte)xx; xx >>= 8;
+ b[12] = (FLAC__byte)xx; xx >>= 8;
+ b[11] = (FLAC__byte)xx; xx >>= 8;
+ b[10] = (FLAC__byte)xx; xx >>= 8;
+ b[9] = (FLAC__byte)xx; xx >>= 8;
+ b[8] = (FLAC__byte)xx; xx >>= 8;
+ x = encoder->private_->seek_table->points[i].frame_samples;
+ b[17] = (FLAC__byte)x; x >>= 8;
+ b[16] = (FLAC__byte)x; x >>= 8;
+ if(encoder->private_->write_callback(encoder, b, 18, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
+ return;
+ }
+ }
+ }
}
#if FLAC__HAS_OGG
/* Gets called when the encoding process has finished so that we can update the STREAMINFO and SEEKTABLE blocks. */
void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
{
- /* the # of bytes in the 1st packet that precede the STREAMINFO */
- static const unsigned FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH =
- FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
- FLAC__OGG_MAPPING_MAGIC_LENGTH +
- FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
- FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
- FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH +
- FLAC__STREAM_SYNC_LENGTH
- ;
- FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)];
- const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo;
- const FLAC__uint64 samples = metadata->data.stream_info.total_samples;
- const unsigned min_framesize = metadata->data.stream_info.min_framesize;
- const unsigned max_framesize = metadata->data.stream_info.max_framesize;
- ogg_page page;
-
- FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
- FLAC__ASSERT(0 != encoder->private_->seek_callback);
-
- /* Pre-check that client supports seeking, since we don't want the
- * ogg_helper code to ever have to deal with this condition.
- */
- if(encoder->private_->seek_callback(encoder, 0, encoder->private_->client_data) == FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED)
- return;
-
- /* All this is based on intimate knowledge of the stream header
- * layout, but a change to the header format that would break this
- * would also break all streams encoded in the previous format.
- */
-
- /**
- ** Write STREAMINFO stats
- **/
- simple_ogg_page__init(&page);
- if(!simple_ogg_page__get_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data))
- {
- simple_ogg_page__clear(&page);
- return; /* state already set */
- }
-
- /*
- * Write MD5 signature
- */
- {
- const unsigned md5_offset =
- FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- (
- FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN
- ) / 8;
-
- if(md5_offset + 16 > (unsigned)page.body_len)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- simple_ogg_page__clear(&page);
- return;
- }
- memcpy(page.body + md5_offset, metadata->data.stream_info.md5sum, 16);
- }
-
- /*
- * Write total samples
- */
- {
- const unsigned total_samples_byte_offset =
- FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- (
- FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN
- - 4
- ) / 8;
-
- if(total_samples_byte_offset + 5 > (unsigned)page.body_len)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- simple_ogg_page__clear(&page);
- return;
- }
- b[0] = (FLAC__byte)page.body[total_samples_byte_offset] & 0xF0;
- b[0] |= (FLAC__byte)((samples >> 32) & 0x0F);
- b[1] = (FLAC__byte)((samples >> 24) & 0xFF);
- b[2] = (FLAC__byte)((samples >> 16) & 0xFF);
- b[3] = (FLAC__byte)((samples >> 8) & 0xFF);
- b[4] = (FLAC__byte)(samples & 0xFF);
- memcpy(page.body + total_samples_byte_offset, b, 5);
- }
-
- /*
- * Write min/max framesize
- */
- {
- const unsigned min_framesize_offset =
- FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
- FLAC__STREAM_METADATA_HEADER_LENGTH +
- (
- FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
- FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN
- ) / 8;
-
- if(min_framesize_offset + 6 > (unsigned)page.body_len)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- simple_ogg_page__clear(&page);
- return;
- }
- b[0] = (FLAC__byte)((min_framesize >> 16) & 0xFF);
- b[1] = (FLAC__byte)((min_framesize >> 8) & 0xFF);
- b[2] = (FLAC__byte)(min_framesize & 0xFF);
- b[3] = (FLAC__byte)((max_framesize >> 16) & 0xFF);
- b[4] = (FLAC__byte)((max_framesize >> 8) & 0xFF);
- b[5] = (FLAC__byte)(max_framesize & 0xFF);
- memcpy(page.body + min_framesize_offset, b, 6);
- }
- if(!simple_ogg_page__set_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data))
- {
- simple_ogg_page__clear(&page);
- return; /* state already set */
- }
- simple_ogg_page__clear(&page);
-
- /*
- * Write seektable
- */
- if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0)
- {
- unsigned i;
- FLAC__byte *p;
-
- FLAC__format_seektable_sort(encoder->private_->seek_table);
-
- FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table));
-
- simple_ogg_page__init(&page);
- if(!simple_ogg_page__get_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data))
- {
- simple_ogg_page__clear(&page);
- return; /* state already set */
- }
-
- if((FLAC__STREAM_METADATA_HEADER_LENGTH + 18 * encoder->private_->seek_table->num_points) != (unsigned)page.body_len)
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
- simple_ogg_page__clear(&page);
- return;
- }
-
- for(i = 0, p = page.body + FLAC__STREAM_METADATA_HEADER_LENGTH; i < encoder->private_->seek_table->num_points; i++, p += 18)
- {
- FLAC__uint64 xx;
- unsigned x;
- xx = encoder->private_->seek_table->points[i].sample_number;
- b[7] = (FLAC__byte)xx;
- xx >>= 8;
- b[6] = (FLAC__byte)xx;
- xx >>= 8;
- b[5] = (FLAC__byte)xx;
- xx >>= 8;
- b[4] = (FLAC__byte)xx;
- xx >>= 8;
- b[3] = (FLAC__byte)xx;
- xx >>= 8;
- b[2] = (FLAC__byte)xx;
- xx >>= 8;
- b[1] = (FLAC__byte)xx;
- xx >>= 8;
- b[0] = (FLAC__byte)xx;
- xx >>= 8;
- xx = encoder->private_->seek_table->points[i].stream_offset;
- b[15] = (FLAC__byte)xx;
- xx >>= 8;
- b[14] = (FLAC__byte)xx;
- xx >>= 8;
- b[13] = (FLAC__byte)xx;
- xx >>= 8;
- b[12] = (FLAC__byte)xx;
- xx >>= 8;
- b[11] = (FLAC__byte)xx;
- xx >>= 8;
- b[10] = (FLAC__byte)xx;
- xx >>= 8;
- b[9] = (FLAC__byte)xx;
- xx >>= 8;
- b[8] = (FLAC__byte)xx;
- xx >>= 8;
- x = encoder->private_->seek_table->points[i].frame_samples;
- b[17] = (FLAC__byte)x;
- x >>= 8;
- b[16] = (FLAC__byte)x;
- x >>= 8;
- memcpy(p, b, 18);
- }
-
- if(!simple_ogg_page__set_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data))
- {
- simple_ogg_page__clear(&page);
- return; /* state already set */
- }
- simple_ogg_page__clear(&page);
- }
+ /* the # of bytes in the 1st packet that precede the STREAMINFO */
+ static const unsigned FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH =
+ FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
+ FLAC__OGG_MAPPING_MAGIC_LENGTH +
+ FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
+ FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
+ FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH +
+ FLAC__STREAM_SYNC_LENGTH
+ ;
+ FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)];
+ const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo;
+ const FLAC__uint64 samples = metadata->data.stream_info.total_samples;
+ const unsigned min_framesize = metadata->data.stream_info.min_framesize;
+ const unsigned max_framesize = metadata->data.stream_info.max_framesize;
+ ogg_page page;
+
+ FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
+ FLAC__ASSERT(0 != encoder->private_->seek_callback);
+
+ /* Pre-check that client supports seeking, since we don't want the
+ * ogg_helper code to ever have to deal with this condition.
+ */
+ if(encoder->private_->seek_callback(encoder, 0, encoder->private_->client_data) == FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED)
+ return;
+
+ /* All this is based on intimate knowledge of the stream header
+ * layout, but a change to the header format that would break this
+ * would also break all streams encoded in the previous format.
+ */
+
+ /**
+ ** Write STREAMINFO stats
+ **/
+ simple_ogg_page__init(&page);
+ if(!simple_ogg_page__get_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) {
+ simple_ogg_page__clear(&page);
+ return; /* state already set */
+ }
+
+ /*
+ * Write MD5 signature
+ */
+ {
+ const unsigned md5_offset =
+ FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ (
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN
+ ) / 8;
+
+ if(md5_offset + 16 > (unsigned)page.body_len) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ simple_ogg_page__clear(&page);
+ return;
+ }
+ memcpy(page.body + md5_offset, metadata->data.stream_info.md5sum, 16);
+ }
+
+ /*
+ * Write total samples
+ */
+ {
+ const unsigned total_samples_byte_offset =
+ FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ (
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN
+ - 4
+ ) / 8;
+
+ if(total_samples_byte_offset + 5 > (unsigned)page.body_len) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ simple_ogg_page__clear(&page);
+ return;
+ }
+ b[0] = (FLAC__byte)page.body[total_samples_byte_offset] & 0xF0;
+ b[0] |= (FLAC__byte)((samples >> 32) & 0x0F);
+ b[1] = (FLAC__byte)((samples >> 24) & 0xFF);
+ b[2] = (FLAC__byte)((samples >> 16) & 0xFF);
+ b[3] = (FLAC__byte)((samples >> 8) & 0xFF);
+ b[4] = (FLAC__byte)(samples & 0xFF);
+ memcpy(page.body + total_samples_byte_offset, b, 5);
+ }
+
+ /*
+ * Write min/max framesize
+ */
+ {
+ const unsigned min_framesize_offset =
+ FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
+ FLAC__STREAM_METADATA_HEADER_LENGTH +
+ (
+ FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
+ FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN
+ ) / 8;
+
+ if(min_framesize_offset + 6 > (unsigned)page.body_len) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ simple_ogg_page__clear(&page);
+ return;
+ }
+ b[0] = (FLAC__byte)((min_framesize >> 16) & 0xFF);
+ b[1] = (FLAC__byte)((min_framesize >> 8) & 0xFF);
+ b[2] = (FLAC__byte)(min_framesize & 0xFF);
+ b[3] = (FLAC__byte)((max_framesize >> 16) & 0xFF);
+ b[4] = (FLAC__byte)((max_framesize >> 8) & 0xFF);
+ b[5] = (FLAC__byte)(max_framesize & 0xFF);
+ memcpy(page.body + min_framesize_offset, b, 6);
+ }
+ if(!simple_ogg_page__set_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) {
+ simple_ogg_page__clear(&page);
+ return; /* state already set */
+ }
+ simple_ogg_page__clear(&page);
+
+ /*
+ * Write seektable
+ */
+ if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) {
+ unsigned i;
+ FLAC__byte *p;
+
+ FLAC__format_seektable_sort(encoder->private_->seek_table);
+
+ FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table));
+
+ simple_ogg_page__init(&page);
+ if(!simple_ogg_page__get_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) {
+ simple_ogg_page__clear(&page);
+ return; /* state already set */
+ }
+
+ if((FLAC__STREAM_METADATA_HEADER_LENGTH + 18*encoder->private_->seek_table->num_points) != (unsigned)page.body_len) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
+ simple_ogg_page__clear(&page);
+ return;
+ }
+
+ for(i = 0, p = page.body + FLAC__STREAM_METADATA_HEADER_LENGTH; i < encoder->private_->seek_table->num_points; i++, p += 18) {
+ FLAC__uint64 xx;
+ unsigned x;
+ xx = encoder->private_->seek_table->points[i].sample_number;
+ b[7] = (FLAC__byte)xx; xx >>= 8;
+ b[6] = (FLAC__byte)xx; xx >>= 8;
+ b[5] = (FLAC__byte)xx; xx >>= 8;
+ b[4] = (FLAC__byte)xx; xx >>= 8;
+ b[3] = (FLAC__byte)xx; xx >>= 8;
+ b[2] = (FLAC__byte)xx; xx >>= 8;
+ b[1] = (FLAC__byte)xx; xx >>= 8;
+ b[0] = (FLAC__byte)xx; xx >>= 8;
+ xx = encoder->private_->seek_table->points[i].stream_offset;
+ b[15] = (FLAC__byte)xx; xx >>= 8;
+ b[14] = (FLAC__byte)xx; xx >>= 8;
+ b[13] = (FLAC__byte)xx; xx >>= 8;
+ b[12] = (FLAC__byte)xx; xx >>= 8;
+ b[11] = (FLAC__byte)xx; xx >>= 8;
+ b[10] = (FLAC__byte)xx; xx >>= 8;
+ b[9] = (FLAC__byte)xx; xx >>= 8;
+ b[8] = (FLAC__byte)xx; xx >>= 8;
+ x = encoder->private_->seek_table->points[i].frame_samples;
+ b[17] = (FLAC__byte)x; x >>= 8;
+ b[16] = (FLAC__byte)x; x >>= 8;
+ memcpy(p, b, 18);
+ }
+
+ if(!simple_ogg_page__set_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) {
+ simple_ogg_page__clear(&page);
+ return; /* state already set */
+ }
+ simple_ogg_page__clear(&page);
+ }
}
#endif
FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block, FLAC__bool is_last_block)
{
- FLAC__uint16 crc;
- FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
-
- /*
- * Accumulate raw signal to the MD5 signature
- */
- if(encoder->protected_->do_md5 && !FLAC__MD5Accumulate(&encoder->private_->md5context, (const FLAC__int32 * const *)encoder->private_->integer_signal, encoder->protected_->channels, encoder->protected_->blocksize, (encoder->protected_->bits_per_sample + 7) / 8))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- /*
- * Process the frame header and subframes into the frame bitbuffer
- */
- if(!process_subframes_(encoder, is_fractional_block))
- {
- /* the above function sets the state for us in case of an error */
- return false;
- }
-
- /*
- * Zero-pad the frame to a byte_boundary
- */
- if(!FLAC__bitwriter_zero_pad_to_byte_boundary(encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- /*
- * CRC-16 the whole thing
- */
- FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(encoder->private_->frame));
- if(
- !FLAC__bitwriter_get_write_crc16(encoder->private_->frame, &crc) ||
- !FLAC__bitwriter_write_raw_uint32(encoder->private_->frame, crc, FLAC__FRAME_FOOTER_CRC_LEN)
- )
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
- return false;
- }
-
- /*
- * Write it
- */
- if(!write_bitbuffer_(encoder, encoder->protected_->blocksize, is_last_block))
- {
- /* the above function sets the state for us in case of an error */
- return false;
- }
-
- /*
- * Get ready for the next frame
- */
- encoder->private_->current_sample_number = 0;
- encoder->private_->current_frame_number++;
- encoder->private_->streaminfo.data.stream_info.total_samples += (FLAC__uint64)encoder->protected_->blocksize;
-
- return true;
+ FLAC__uint16 crc;
+ FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
+
+ /*
+ * Accumulate raw signal to the MD5 signature
+ */
+ if(encoder->protected_->do_md5 && !FLAC__MD5Accumulate(&encoder->private_->md5context, (const FLAC__int32 * const *)encoder->private_->integer_signal, encoder->protected_->channels, encoder->protected_->blocksize, (encoder->protected_->bits_per_sample+7) / 8)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ /*
+ * Process the frame header and subframes into the frame bitbuffer
+ */
+ if(!process_subframes_(encoder, is_fractional_block)) {
+ /* the above function sets the state for us in case of an error */
+ return false;
+ }
+
+ /*
+ * Zero-pad the frame to a byte_boundary
+ */
+ if(!FLAC__bitwriter_zero_pad_to_byte_boundary(encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ /*
+ * CRC-16 the whole thing
+ */
+ FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(encoder->private_->frame));
+ if(
+ !FLAC__bitwriter_get_write_crc16(encoder->private_->frame, &crc) ||
+ !FLAC__bitwriter_write_raw_uint32(encoder->private_->frame, crc, FLAC__FRAME_FOOTER_CRC_LEN)
+ ) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+
+ /*
+ * Write it
+ */
+ if(!write_bitbuffer_(encoder, encoder->protected_->blocksize, is_last_block)) {
+ /* the above function sets the state for us in case of an error */
+ return false;
+ }
+
+ /*
+ * Get ready for the next frame
+ */
+ encoder->private_->current_sample_number = 0;
+ encoder->private_->current_frame_number++;
+ encoder->private_->streaminfo.data.stream_info.total_samples += (FLAC__uint64)encoder->protected_->blocksize;
+
+ return true;
}
FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block)
{
- FLAC__FrameHeader frame_header;
- unsigned channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order;
- FLAC__bool do_independent, do_mid_side;
-
- /*
- * Calculate the min,max Rice partition orders
- */
- if(is_fractional_block)
- {
- max_partition_order = 0;
- }
- else
- {
- max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize(encoder->protected_->blocksize);
- max_partition_order = min(max_partition_order, encoder->protected_->max_residual_partition_order);
- }
- min_partition_order = min(min_partition_order, max_partition_order);
-
- /*
- * Setup the frame
- */
- frame_header.blocksize = encoder->protected_->blocksize;
- frame_header.sample_rate = encoder->protected_->sample_rate;
- frame_header.channels = encoder->protected_->channels;
- frame_header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; /* the default unless the encoder determines otherwise */
- frame_header.bits_per_sample = encoder->protected_->bits_per_sample;
- frame_header.number_type = FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER;
- frame_header.number.frame_number = encoder->private_->current_frame_number;
-
- /*
- * Figure out what channel assignments to try
- */
- if(encoder->protected_->do_mid_side_stereo)
- {
- if(encoder->protected_->loose_mid_side_stereo)
- {
- if(encoder->private_->loose_mid_side_stereo_frame_count == 0)
- {
- do_independent = true;
- do_mid_side = true;
- }
- else
- {
- do_independent = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT);
- do_mid_side = !do_independent;
- }
- }
- else
- {
- do_independent = true;
- do_mid_side = true;
- }
- }
- else
- {
- do_independent = true;
- do_mid_side = false;
- }
-
- FLAC__ASSERT(do_independent || do_mid_side);
-
- /*
- * Check for wasted bits; set effective bps for each subframe
- */
- if(do_independent)
- {
- for(channel = 0; channel < encoder->protected_->channels; channel++)
- {
- const unsigned w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize);
- encoder->private_->subframe_workspace[channel][0].wasted_bits = encoder->private_->subframe_workspace[channel][1].wasted_bits = w;
- encoder->private_->subframe_bps[channel] = encoder->protected_->bits_per_sample - w;
- }
- }
- if(do_mid_side)
- {
- FLAC__ASSERT(encoder->protected_->channels == 2);
- for(channel = 0; channel < 2; channel++)
- {
- const unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize);
- encoder->private_->subframe_workspace_mid_side[channel][0].wasted_bits = encoder->private_->subframe_workspace_mid_side[channel][1].wasted_bits = w;
- encoder->private_->subframe_bps_mid_side[channel] = encoder->protected_->bits_per_sample - w + (channel == 0 ? 0 : 1);
- }
- }
-
- /*
- * First do a normal encoding pass of each independent channel
- */
- if(do_independent)
- {
- for(channel = 0; channel < encoder->protected_->channels; channel++)
- {
- if(!
- process_subframe_(
- encoder,
- min_partition_order,
- max_partition_order,
- &frame_header,
- encoder->private_->subframe_bps[channel],
- encoder->private_->integer_signal[channel],
- encoder->private_->subframe_workspace_ptr[channel],
- encoder->private_->partitioned_rice_contents_workspace_ptr[channel],
- encoder->private_->residual_workspace[channel],
- encoder->private_->best_subframe + channel,
- encoder->private_->best_subframe_bits + channel
- )
- )
- return false;
- }
- }
-
- /*
- * Now do mid and side channels if requested
- */
- if(do_mid_side)
- {
- FLAC__ASSERT(encoder->protected_->channels == 2);
-
- for(channel = 0; channel < 2; channel++)
- {
- if(!
- process_subframe_(
- encoder,
- min_partition_order,
- max_partition_order,
- &frame_header,
- encoder->private_->subframe_bps_mid_side[channel],
- encoder->private_->integer_signal_mid_side[channel],
- encoder->private_->subframe_workspace_ptr_mid_side[channel],
- encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[channel],
- encoder->private_->residual_workspace_mid_side[channel],
- encoder->private_->best_subframe_mid_side + channel,
- encoder->private_->best_subframe_bits_mid_side + channel
- )
- )
- return false;
- }
- }
-
- /*
- * Compose the frame bitbuffer
- */
- if(do_mid_side)
- {
- unsigned left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */
- FLAC__Subframe *left_subframe = 0, *right_subframe = 0; /* initialized only to prevent superfluous compiler warning */
- FLAC__ChannelAssignment channel_assignment;
-
- FLAC__ASSERT(encoder->protected_->channels == 2);
-
- if(encoder->protected_->loose_mid_side_stereo && encoder->private_->loose_mid_side_stereo_frame_count > 0)
- {
- channel_assignment = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT ? FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT : FLAC__CHANNEL_ASSIGNMENT_MID_SIDE);
- }
- else
- {
- unsigned bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */
- unsigned min_bits;
- int ca;
-
- FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT == 0);
- FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE == 1);
- FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE == 2);
- FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_MID_SIDE == 3);
- FLAC__ASSERT(do_independent && do_mid_side);
-
- /* We have to figure out which channel assignent results in the smallest frame */
- bits[FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT] = encoder->private_->best_subframe_bits [0] + encoder->private_->best_subframe_bits [1];
- bits[FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE ] = encoder->private_->best_subframe_bits [0] + encoder->private_->best_subframe_bits_mid_side[1];
- bits[FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE ] = encoder->private_->best_subframe_bits [1] + encoder->private_->best_subframe_bits_mid_side[1];
- bits[FLAC__CHANNEL_ASSIGNMENT_MID_SIDE ] = encoder->private_->best_subframe_bits_mid_side[0] + encoder->private_->best_subframe_bits_mid_side[1];
-
- channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT;
- min_bits = bits[channel_assignment];
- for(ca = 1; ca <= 3; ca++)
- {
- if(bits[ca] < min_bits)
- {
- min_bits = bits[ca];
- channel_assignment = (FLAC__ChannelAssignment)ca;
- }
- }
- }
-
- frame_header.channel_assignment = channel_assignment;
-
- if(!FLAC__frame_add_header(&frame_header, encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return false;
- }
-
- switch(channel_assignment)
- {
- case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
- left_subframe = &encoder->private_->subframe_workspace [0][encoder->private_->best_subframe [0]];
- right_subframe = &encoder->private_->subframe_workspace [1][encoder->private_->best_subframe [1]];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
- left_subframe = &encoder->private_->subframe_workspace [0][encoder->private_->best_subframe [0]];
- right_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
- left_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]];
- right_subframe = &encoder->private_->subframe_workspace [1][encoder->private_->best_subframe [1]];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
- left_subframe = &encoder->private_->subframe_workspace_mid_side[0][encoder->private_->best_subframe_mid_side[0]];
- right_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]];
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- switch(channel_assignment)
- {
- case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
- left_bps = encoder->private_->subframe_bps [0];
- right_bps = encoder->private_->subframe_bps [1];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
- left_bps = encoder->private_->subframe_bps [0];
- right_bps = encoder->private_->subframe_bps_mid_side[1];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
- left_bps = encoder->private_->subframe_bps_mid_side[1];
- right_bps = encoder->private_->subframe_bps [1];
- break;
- case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
- left_bps = encoder->private_->subframe_bps_mid_side[0];
- right_bps = encoder->private_->subframe_bps_mid_side[1];
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- /* note that encoder_add_subframe_ sets the state for us in case of an error */
- if(!add_subframe_(encoder, frame_header.blocksize, left_bps , left_subframe , encoder->private_->frame))
- return false;
- if(!add_subframe_(encoder, frame_header.blocksize, right_bps, right_subframe, encoder->private_->frame))
- return false;
- }
- else
- {
- if(!FLAC__frame_add_header(&frame_header, encoder->private_->frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return false;
- }
-
- for(channel = 0; channel < encoder->protected_->channels; channel++)
- {
- if(!add_subframe_(encoder, frame_header.blocksize, encoder->private_->subframe_bps[channel], &encoder->private_->subframe_workspace[channel][encoder->private_->best_subframe[channel]], encoder->private_->frame))
- {
- /* the above function sets the state for us in case of an error */
- return false;
- }
- }
- }
-
- if(encoder->protected_->loose_mid_side_stereo)
- {
- encoder->private_->loose_mid_side_stereo_frame_count++;
- if(encoder->private_->loose_mid_side_stereo_frame_count >= encoder->private_->loose_mid_side_stereo_frames)
- encoder->private_->loose_mid_side_stereo_frame_count = 0;
- }
-
- encoder->private_->last_channel_assignment = frame_header.channel_assignment;
-
- return true;
+ FLAC__FrameHeader frame_header;
+ unsigned channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order;
+ FLAC__bool do_independent, do_mid_side;
+
+ /*
+ * Calculate the min,max Rice partition orders
+ */
+ if(is_fractional_block) {
+ max_partition_order = 0;
+ }
+ else {
+ max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize(encoder->protected_->blocksize);
+ max_partition_order = min(max_partition_order, encoder->protected_->max_residual_partition_order);
+ }
+ min_partition_order = min(min_partition_order, max_partition_order);
+
+ /*
+ * Setup the frame
+ */
+ frame_header.blocksize = encoder->protected_->blocksize;
+ frame_header.sample_rate = encoder->protected_->sample_rate;
+ frame_header.channels = encoder->protected_->channels;
+ frame_header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; /* the default unless the encoder determines otherwise */
+ frame_header.bits_per_sample = encoder->protected_->bits_per_sample;
+ frame_header.number_type = FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER;
+ frame_header.number.frame_number = encoder->private_->current_frame_number;
+
+ /*
+ * Figure out what channel assignments to try
+ */
+ if(encoder->protected_->do_mid_side_stereo) {
+ if(encoder->protected_->loose_mid_side_stereo) {
+ if(encoder->private_->loose_mid_side_stereo_frame_count == 0) {
+ do_independent = true;
+ do_mid_side = true;
+ }
+ else {
+ do_independent = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT);
+ do_mid_side = !do_independent;
+ }
+ }
+ else {
+ do_independent = true;
+ do_mid_side = true;
+ }
+ }
+ else {
+ do_independent = true;
+ do_mid_side = false;
+ }
+
+ FLAC__ASSERT(do_independent || do_mid_side);
+
+ /*
+ * Check for wasted bits; set effective bps for each subframe
+ */
+ if(do_independent) {
+ for(channel = 0; channel < encoder->protected_->channels; channel++) {
+ const unsigned w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize);
+ encoder->private_->subframe_workspace[channel][0].wasted_bits = encoder->private_->subframe_workspace[channel][1].wasted_bits = w;
+ encoder->private_->subframe_bps[channel] = encoder->protected_->bits_per_sample - w;
+ }
+ }
+ if(do_mid_side) {
+ FLAC__ASSERT(encoder->protected_->channels == 2);
+ for(channel = 0; channel < 2; channel++) {
+ const unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize);
+ encoder->private_->subframe_workspace_mid_side[channel][0].wasted_bits = encoder->private_->subframe_workspace_mid_side[channel][1].wasted_bits = w;
+ encoder->private_->subframe_bps_mid_side[channel] = encoder->protected_->bits_per_sample - w + (channel==0? 0:1);
+ }
+ }
+
+ /*
+ * First do a normal encoding pass of each independent channel
+ */
+ if(do_independent) {
+ for(channel = 0; channel < encoder->protected_->channels; channel++) {
+ if(!
+ process_subframe_(
+ encoder,
+ min_partition_order,
+ max_partition_order,
+ &frame_header,
+ encoder->private_->subframe_bps[channel],
+ encoder->private_->integer_signal[channel],
+ encoder->private_->subframe_workspace_ptr[channel],
+ encoder->private_->partitioned_rice_contents_workspace_ptr[channel],
+ encoder->private_->residual_workspace[channel],
+ encoder->private_->best_subframe+channel,
+ encoder->private_->best_subframe_bits+channel
+ )
+ )
+ return false;
+ }
+ }
+
+ /*
+ * Now do mid and side channels if requested
+ */
+ if(do_mid_side) {
+ FLAC__ASSERT(encoder->protected_->channels == 2);
+
+ for(channel = 0; channel < 2; channel++) {
+ if(!
+ process_subframe_(
+ encoder,
+ min_partition_order,
+ max_partition_order,
+ &frame_header,
+ encoder->private_->subframe_bps_mid_side[channel],
+ encoder->private_->integer_signal_mid_side[channel],
+ encoder->private_->subframe_workspace_ptr_mid_side[channel],
+ encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[channel],
+ encoder->private_->residual_workspace_mid_side[channel],
+ encoder->private_->best_subframe_mid_side+channel,
+ encoder->private_->best_subframe_bits_mid_side+channel
+ )
+ )
+ return false;
+ }
+ }
+
+ /*
+ * Compose the frame bitbuffer
+ */
+ if(do_mid_side) {
+ unsigned left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */
+ FLAC__Subframe *left_subframe = 0, *right_subframe = 0; /* initialized only to prevent superfluous compiler warning */
+ FLAC__ChannelAssignment channel_assignment;
+
+ FLAC__ASSERT(encoder->protected_->channels == 2);
+
+ if(encoder->protected_->loose_mid_side_stereo && encoder->private_->loose_mid_side_stereo_frame_count > 0) {
+ channel_assignment = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT? FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT : FLAC__CHANNEL_ASSIGNMENT_MID_SIDE);
+ }
+ else {
+ unsigned bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */
+ unsigned min_bits;
+ int ca;
+
+ FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT == 0);
+ FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE == 1);
+ FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE == 2);
+ FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_MID_SIDE == 3);
+ FLAC__ASSERT(do_independent && do_mid_side);
+
+ /* We have to figure out which channel assignent results in the smallest frame */
+ bits[FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT] = encoder->private_->best_subframe_bits [0] + encoder->private_->best_subframe_bits [1];
+ bits[FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE ] = encoder->private_->best_subframe_bits [0] + encoder->private_->best_subframe_bits_mid_side[1];
+ bits[FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE ] = encoder->private_->best_subframe_bits [1] + encoder->private_->best_subframe_bits_mid_side[1];
+ bits[FLAC__CHANNEL_ASSIGNMENT_MID_SIDE ] = encoder->private_->best_subframe_bits_mid_side[0] + encoder->private_->best_subframe_bits_mid_side[1];
+
+ channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT;
+ min_bits = bits[channel_assignment];
+ for(ca = 1; ca <= 3; ca++) {
+ if(bits[ca] < min_bits) {
+ min_bits = bits[ca];
+ channel_assignment = (FLAC__ChannelAssignment)ca;
+ }
+ }
+ }
+
+ frame_header.channel_assignment = channel_assignment;
+
+ if(!FLAC__frame_add_header(&frame_header, encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return false;
+ }
+
+ switch(channel_assignment) {
+ case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
+ left_subframe = &encoder->private_->subframe_workspace [0][encoder->private_->best_subframe [0]];
+ right_subframe = &encoder->private_->subframe_workspace [1][encoder->private_->best_subframe [1]];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
+ left_subframe = &encoder->private_->subframe_workspace [0][encoder->private_->best_subframe [0]];
+ right_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
+ left_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]];
+ right_subframe = &encoder->private_->subframe_workspace [1][encoder->private_->best_subframe [1]];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
+ left_subframe = &encoder->private_->subframe_workspace_mid_side[0][encoder->private_->best_subframe_mid_side[0]];
+ right_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]];
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ switch(channel_assignment) {
+ case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
+ left_bps = encoder->private_->subframe_bps [0];
+ right_bps = encoder->private_->subframe_bps [1];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
+ left_bps = encoder->private_->subframe_bps [0];
+ right_bps = encoder->private_->subframe_bps_mid_side[1];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
+ left_bps = encoder->private_->subframe_bps_mid_side[1];
+ right_bps = encoder->private_->subframe_bps [1];
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
+ left_bps = encoder->private_->subframe_bps_mid_side[0];
+ right_bps = encoder->private_->subframe_bps_mid_side[1];
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ /* note that encoder_add_subframe_ sets the state for us in case of an error */
+ if(!add_subframe_(encoder, frame_header.blocksize, left_bps , left_subframe , encoder->private_->frame))
+ return false;
+ if(!add_subframe_(encoder, frame_header.blocksize, right_bps, right_subframe, encoder->private_->frame))
+ return false;
+ }
+ else {
+ if(!FLAC__frame_add_header(&frame_header, encoder->private_->frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return false;
+ }
+
+ for(channel = 0; channel < encoder->protected_->channels; channel++) {
+ if(!add_subframe_(encoder, frame_header.blocksize, encoder->private_->subframe_bps[channel], &encoder->private_->subframe_workspace[channel][encoder->private_->best_subframe[channel]], encoder->private_->frame)) {
+ /* the above function sets the state for us in case of an error */
+ return false;
+ }
+ }
+ }
+
+ if(encoder->protected_->loose_mid_side_stereo) {
+ encoder->private_->loose_mid_side_stereo_frame_count++;
+ if(encoder->private_->loose_mid_side_stereo_frame_count >= encoder->private_->loose_mid_side_stereo_frames)
+ encoder->private_->loose_mid_side_stereo_frame_count = 0;
+ }
+
+ encoder->private_->last_channel_assignment = frame_header.channel_assignment;
+
+ return true;
}
FLAC__bool process_subframe_(
- FLAC__StreamEncoder *encoder,
- unsigned min_partition_order,
- unsigned max_partition_order,
- const FLAC__FrameHeader *frame_header,
- unsigned subframe_bps,
- const FLAC__int32 integer_signal[],
- FLAC__Subframe *subframe[2],
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
- FLAC__int32 *residual[2],
- unsigned *best_subframe,
- unsigned *best_bits
+ FLAC__StreamEncoder *encoder,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ const FLAC__FrameHeader *frame_header,
+ unsigned subframe_bps,
+ const FLAC__int32 integer_signal[],
+ FLAC__Subframe *subframe[2],
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
+ FLAC__int32 *residual[2],
+ unsigned *best_subframe,
+ unsigned *best_bits
)
{
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- FLAC__float fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1];
+ FLAC__float fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1];
#else
- FLAC__fixedpoint fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1];
+ FLAC__fixedpoint fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1];
#endif
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- FLAC__double lpc_residual_bits_per_sample;
- FLAC__real autoc[FLAC__MAX_LPC_ORDER+1]; /* WATCHOUT: the size is important even though encoder->protected_->max_lpc_order might be less; some asm routines need all the space */
- FLAC__double lpc_error[FLAC__MAX_LPC_ORDER];
- unsigned min_lpc_order, max_lpc_order, lpc_order;
- unsigned min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision;
+ FLAC__double lpc_residual_bits_per_sample;
+ FLAC__real autoc[FLAC__MAX_LPC_ORDER+1]; /* WATCHOUT: the size is important even though encoder->protected_->max_lpc_order might be less; some asm routines need all the space */
+ FLAC__double lpc_error[FLAC__MAX_LPC_ORDER];
+ unsigned min_lpc_order, max_lpc_order, lpc_order;
+ unsigned min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision;
#endif
- unsigned min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order;
- unsigned rice_parameter;
- unsigned _candidate_bits, _best_bits;
- unsigned _best_subframe;
- /* only use RICE2 partitions if stream bps > 16 */
- const unsigned rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16 ? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
-
- FLAC__ASSERT(frame_header->blocksize > 0);
-
- /* verbatim subframe is the baseline against which we measure other compressed subframes */
- _best_subframe = 0;
- if(encoder->private_->disable_verbatim_subframes && frame_header->blocksize >= FLAC__MAX_FIXED_ORDER)
- _best_bits = UINT_MAX;
- else
- _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]);
-
- if(frame_header->blocksize >= FLAC__MAX_FIXED_ORDER)
- {
- unsigned signal_is_constant = false;
- guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor(integer_signal + FLAC__MAX_FIXED_ORDER, frame_header->blocksize - FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample);
- /* check for constant subframe */
- if(
- !encoder->private_->disable_constant_subframes &&
+ unsigned min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order;
+ unsigned rice_parameter;
+ unsigned _candidate_bits, _best_bits;
+ unsigned _best_subframe;
+ /* only use RICE2 partitions if stream bps > 16 */
+ const unsigned rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+
+ FLAC__ASSERT(frame_header->blocksize > 0);
+
+ /* verbatim subframe is the baseline against which we measure other compressed subframes */
+ _best_subframe = 0;
+ if(encoder->private_->disable_verbatim_subframes && frame_header->blocksize >= FLAC__MAX_FIXED_ORDER)
+ _best_bits = UINT_MAX;
+ else
+ _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]);
+
+ if(frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) {
+ unsigned signal_is_constant = false;
+ guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor(integer_signal+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample);
+ /* check for constant subframe */
+ if(
+ !encoder->private_->disable_constant_subframes &&
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- fixed_residual_bits_per_sample[1] == 0.0
+ fixed_residual_bits_per_sample[1] == 0.0
#else
- fixed_residual_bits_per_sample[1] == FLAC__FP_ZERO
+ fixed_residual_bits_per_sample[1] == FLAC__FP_ZERO
#endif
- )
- {
- /* the above means it's possible all samples are the same value; now double-check it: */
- unsigned i;
- signal_is_constant = true;
- for(i = 1; i < frame_header->blocksize; i++)
- {
- if(integer_signal[0] != integer_signal[i])
- {
- signal_is_constant = false;
- break;
- }
- }
- }
- if(signal_is_constant)
- {
- _candidate_bits = evaluate_constant_subframe_(encoder, integer_signal[0], frame_header->blocksize, subframe_bps, subframe[!_best_subframe]);
- if(_candidate_bits < _best_bits)
- {
- _best_subframe = !_best_subframe;
- _best_bits = _candidate_bits;
- }
- }
- else
- {
- if(!encoder->private_->disable_fixed_subframes || (encoder->protected_->max_lpc_order == 0 && _best_bits == UINT_MAX))
- {
- /* encode fixed */
- if(encoder->protected_->do_exhaustive_model_search)
- {
- min_fixed_order = 0;
- max_fixed_order = FLAC__MAX_FIXED_ORDER;
- }
- else
- {
- min_fixed_order = max_fixed_order = guess_fixed_order;
- }
- if(max_fixed_order >= frame_header->blocksize)
- max_fixed_order = frame_header->blocksize - 1;
- for(fixed_order = min_fixed_order; fixed_order <= max_fixed_order; fixed_order++)
- {
+ ) {
+ /* the above means it's possible all samples are the same value; now double-check it: */
+ unsigned i;
+ signal_is_constant = true;
+ for(i = 1; i < frame_header->blocksize; i++) {
+ if(integer_signal[0] != integer_signal[i]) {
+ signal_is_constant = false;
+ break;
+ }
+ }
+ }
+ if(signal_is_constant) {
+ _candidate_bits = evaluate_constant_subframe_(encoder, integer_signal[0], frame_header->blocksize, subframe_bps, subframe[!_best_subframe]);
+ if(_candidate_bits < _best_bits) {
+ _best_subframe = !_best_subframe;
+ _best_bits = _candidate_bits;
+ }
+ }
+ else {
+ if(!encoder->private_->disable_fixed_subframes || (encoder->protected_->max_lpc_order == 0 && _best_bits == UINT_MAX)) {
+ /* encode fixed */
+ if(encoder->protected_->do_exhaustive_model_search) {
+ min_fixed_order = 0;
+ max_fixed_order = FLAC__MAX_FIXED_ORDER;
+ }
+ else {
+ min_fixed_order = max_fixed_order = guess_fixed_order;
+ }
+ if(max_fixed_order >= frame_header->blocksize)
+ max_fixed_order = frame_header->blocksize - 1;
+ for(fixed_order = min_fixed_order; fixed_order <= max_fixed_order; fixed_order++) {
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- if(fixed_residual_bits_per_sample[fixed_order] >= (FLAC__float)subframe_bps)
- continue; /* don't even try */
- rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0) ? (unsigned)(fixed_residual_bits_per_sample[fixed_order] + 0.5) : 0; /* 0.5 is for rounding */
+ if(fixed_residual_bits_per_sample[fixed_order] >= (FLAC__float)subframe_bps)
+ continue; /* don't even try */
+ rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0)? (unsigned)(fixed_residual_bits_per_sample[fixed_order]+0.5) : 0; /* 0.5 is for rounding */
#else
- if(FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]) >= (int)subframe_bps)
- continue; /* don't even try */
- rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > FLAC__FP_ZERO) ? (unsigned)FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order] + FLAC__FP_ONE_HALF) : 0; /* 0.5 is for rounding */
+ if(FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]) >= (int)subframe_bps)
+ continue; /* don't even try */
+ rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > FLAC__FP_ZERO)? (unsigned)FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]+FLAC__FP_ONE_HALF) : 0; /* 0.5 is for rounding */
#endif
- rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */
- if(rice_parameter >= rice_parameter_limit)
- {
+ rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */
+ if(rice_parameter >= rice_parameter_limit) {
#ifdef DEBUG_VERBOSE
- fprintf(stderr, "clipping rice_parameter (%u -> %u) @0\n", rice_parameter, rice_parameter_limit - 1);
+ fprintf(stderr, "clipping rice_parameter (%u -> %u) @0\n", rice_parameter, rice_parameter_limit - 1);
#endif
- rice_parameter = rice_parameter_limit - 1;
- }
- _candidate_bits =
- evaluate_fixed_subframe_(
- encoder,
- integer_signal,
- residual[!_best_subframe],
- encoder->private_->abs_residual_partition_sums,
- encoder->private_->raw_bits_per_partition,
- frame_header->blocksize,
- subframe_bps,
- fixed_order,
- rice_parameter,
- rice_parameter_limit,
- min_partition_order,
- max_partition_order,
- encoder->protected_->do_escape_coding,
- encoder->protected_->rice_parameter_search_dist,
- subframe[!_best_subframe],
- partitioned_rice_contents[!_best_subframe]
- );
- if(_candidate_bits < _best_bits)
- {
- _best_subframe = !_best_subframe;
- _best_bits = _candidate_bits;
- }
- }
- }
+ rice_parameter = rice_parameter_limit - 1;
+ }
+ _candidate_bits =
+ evaluate_fixed_subframe_(
+ encoder,
+ integer_signal,
+ residual[!_best_subframe],
+ encoder->private_->abs_residual_partition_sums,
+ encoder->private_->raw_bits_per_partition,
+ frame_header->blocksize,
+ subframe_bps,
+ fixed_order,
+ rice_parameter,
+ rice_parameter_limit,
+ min_partition_order,
+ max_partition_order,
+ encoder->protected_->do_escape_coding,
+ encoder->protected_->rice_parameter_search_dist,
+ subframe[!_best_subframe],
+ partitioned_rice_contents[!_best_subframe]
+ );
+ if(_candidate_bits < _best_bits) {
+ _best_subframe = !_best_subframe;
+ _best_bits = _candidate_bits;
+ }
+ }
+ }
#ifndef FLAC__INTEGER_ONLY_LIBRARY
- /* encode lpc */
- if(encoder->protected_->max_lpc_order > 0)
- {
- if(encoder->protected_->max_lpc_order >= frame_header->blocksize)
- max_lpc_order = frame_header->blocksize - 1;
- else
- max_lpc_order = encoder->protected_->max_lpc_order;
- if(max_lpc_order > 0)
- {
- unsigned a;
- for(a = 0; a < encoder->protected_->num_apodizations; a++)
- {
- FLAC__lpc_window_data(integer_signal, encoder->private_->window[a], encoder->private_->windowed_signal, frame_header->blocksize);
- encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_signal, frame_header->blocksize, max_lpc_order + 1, autoc);
- /* if autoc[0] == 0.0, the signal is constant and we usually won't get here, but it can happen */
- if(autoc[0] != 0.0)
- {
- FLAC__lpc_compute_lp_coefficients(autoc, &max_lpc_order, encoder->private_->lp_coeff, lpc_error);
- if(encoder->protected_->do_exhaustive_model_search)
- {
- min_lpc_order = 1;
- }
- else
- {
- const unsigned guess_lpc_order =
- FLAC__lpc_compute_best_order(
- lpc_error,
- max_lpc_order,
- frame_header->blocksize,
- subframe_bps + (
- encoder->protected_->do_qlp_coeff_prec_search ?
- FLAC__MIN_QLP_COEFF_PRECISION : /* have to guess; use the min possible size to avoid accidentally favoring lower orders */
- encoder->protected_->qlp_coeff_precision
- )
- );
- min_lpc_order = max_lpc_order = guess_lpc_order;
- }
- if(max_lpc_order >= frame_header->blocksize)
- max_lpc_order = frame_header->blocksize - 1;
- for(lpc_order = min_lpc_order; lpc_order <= max_lpc_order; lpc_order++)
- {
- lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize - lpc_order);
- if(lpc_residual_bits_per_sample >= (FLAC__double)subframe_bps)
- continue; /* don't even try */
- rice_parameter = (lpc_residual_bits_per_sample > 0.0) ? (unsigned)(lpc_residual_bits_per_sample + 0.5) : 0; /* 0.5 is for rounding */
- rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */
- if(rice_parameter >= rice_parameter_limit)
- {
+ /* encode lpc */
+ if(encoder->protected_->max_lpc_order > 0) {
+ if(encoder->protected_->max_lpc_order >= frame_header->blocksize)
+ max_lpc_order = frame_header->blocksize-1;
+ else
+ max_lpc_order = encoder->protected_->max_lpc_order;
+ if(max_lpc_order > 0) {
+ unsigned a;
+ for (a = 0; a < encoder->protected_->num_apodizations; a++) {
+ FLAC__lpc_window_data(integer_signal, encoder->private_->window[a], encoder->private_->windowed_signal, frame_header->blocksize);
+ encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_signal, frame_header->blocksize, max_lpc_order+1, autoc);
+ /* if autoc[0] == 0.0, the signal is constant and we usually won't get here, but it can happen */
+ if(autoc[0] != 0.0) {
+ FLAC__lpc_compute_lp_coefficients(autoc, &max_lpc_order, encoder->private_->lp_coeff, lpc_error);
+ if(encoder->protected_->do_exhaustive_model_search) {
+ min_lpc_order = 1;
+ }
+ else {
+ const unsigned guess_lpc_order =
+ FLAC__lpc_compute_best_order(
+ lpc_error,
+ max_lpc_order,
+ frame_header->blocksize,
+ subframe_bps + (
+ encoder->protected_->do_qlp_coeff_prec_search?
+ FLAC__MIN_QLP_COEFF_PRECISION : /* have to guess; use the min possible size to avoid accidentally favoring lower orders */
+ encoder->protected_->qlp_coeff_precision
+ )
+ );
+ min_lpc_order = max_lpc_order = guess_lpc_order;
+ }
+ if(max_lpc_order >= frame_header->blocksize)
+ max_lpc_order = frame_header->blocksize - 1;
+ for(lpc_order = min_lpc_order; lpc_order <= max_lpc_order; lpc_order++) {
+ lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize-lpc_order);
+ if(lpc_residual_bits_per_sample >= (FLAC__double)subframe_bps)
+ continue; /* don't even try */
+ rice_parameter = (lpc_residual_bits_per_sample > 0.0)? (unsigned)(lpc_residual_bits_per_sample+0.5) : 0; /* 0.5 is for rounding */
+ rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */
+ if(rice_parameter >= rice_parameter_limit) {
#ifdef DEBUG_VERBOSE
- fprintf(stderr, "clipping rice_parameter (%u -> %u) @1\n", rice_parameter, rice_parameter_limit - 1);
+ fprintf(stderr, "clipping rice_parameter (%u -> %u) @1\n", rice_parameter, rice_parameter_limit - 1);
#endif
- rice_parameter = rice_parameter_limit - 1;
- }
- if(encoder->protected_->do_qlp_coeff_prec_search)
- {
- min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION;
- /* try to ensure a 32-bit datapath throughout for 16bps(+1bps for side channel) or less */
- if(subframe_bps <= 17)
- {
- max_qlp_coeff_precision = min(32 - subframe_bps - lpc_order, FLAC__MAX_QLP_COEFF_PRECISION);
- max_qlp_coeff_precision = max(max_qlp_coeff_precision, min_qlp_coeff_precision);
- }
- else
- max_qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION;
- }
- else
- {
- min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->protected_->qlp_coeff_precision;
- }
- for(qlp_coeff_precision = min_qlp_coeff_precision; qlp_coeff_precision <= max_qlp_coeff_precision; qlp_coeff_precision++)
- {
- _candidate_bits =
- evaluate_lpc_subframe_(
- encoder,
- integer_signal,
- residual[!_best_subframe],
- encoder->private_->abs_residual_partition_sums,
- encoder->private_->raw_bits_per_partition,
- encoder->private_->lp_coeff[lpc_order-1],
- frame_header->blocksize,
- subframe_bps,
- lpc_order,
- qlp_coeff_precision,
- rice_parameter,
- rice_parameter_limit,
- min_partition_order,
- max_partition_order,
- encoder->protected_->do_escape_coding,
- encoder->protected_->rice_parameter_search_dist,
- subframe[!_best_subframe],
- partitioned_rice_contents[!_best_subframe]
- );
- if(_candidate_bits > 0) /* if == 0, there was a problem quantizing the lpcoeffs */
- {
- if(_candidate_bits < _best_bits)
- {
- _best_subframe = !_best_subframe;
- _best_bits = _candidate_bits;
- }
- }
- }
- }
- }
- }
- }
- }
+ rice_parameter = rice_parameter_limit - 1;
+ }
+ if(encoder->protected_->do_qlp_coeff_prec_search) {
+ min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION;
+ /* try to ensure a 32-bit datapath throughout for 16bps(+1bps for side channel) or less */
+ if(subframe_bps <= 17) {
+ max_qlp_coeff_precision = min(32 - subframe_bps - lpc_order, FLAC__MAX_QLP_COEFF_PRECISION);
+ max_qlp_coeff_precision = max(max_qlp_coeff_precision, min_qlp_coeff_precision);
+ }
+ else
+ max_qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION;
+ }
+ else {
+ min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->protected_->qlp_coeff_precision;
+ }
+ for(qlp_coeff_precision = min_qlp_coeff_precision; qlp_coeff_precision <= max_qlp_coeff_precision; qlp_coeff_precision++) {
+ _candidate_bits =
+ evaluate_lpc_subframe_(
+ encoder,
+ integer_signal,
+ residual[!_best_subframe],
+ encoder->private_->abs_residual_partition_sums,
+ encoder->private_->raw_bits_per_partition,
+ encoder->private_->lp_coeff[lpc_order-1],
+ frame_header->blocksize,
+ subframe_bps,
+ lpc_order,
+ qlp_coeff_precision,
+ rice_parameter,
+ rice_parameter_limit,
+ min_partition_order,
+ max_partition_order,
+ encoder->protected_->do_escape_coding,
+ encoder->protected_->rice_parameter_search_dist,
+ subframe[!_best_subframe],
+ partitioned_rice_contents[!_best_subframe]
+ );
+ if(_candidate_bits > 0) { /* if == 0, there was a problem quantizing the lpcoeffs */
+ if(_candidate_bits < _best_bits) {
+ _best_subframe = !_best_subframe;
+ _best_bits = _candidate_bits;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
- }
- }
+ }
+ }
- /* under rare circumstances this can happen when all but lpc subframe types are disabled: */
- if(_best_bits == UINT_MAX)
- {
- FLAC__ASSERT(_best_subframe == 0);
- _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]);
- }
+ /* under rare circumstances this can happen when all but lpc subframe types are disabled: */
+ if(_best_bits == UINT_MAX) {
+ FLAC__ASSERT(_best_subframe == 0);
+ _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]);
+ }
- *best_subframe = _best_subframe;
- *best_bits = _best_bits;
+ *best_subframe = _best_subframe;
+ *best_bits = _best_bits;
- return true;
+ return true;
}
FLAC__bool add_subframe_(
- FLAC__StreamEncoder *encoder,
- unsigned blocksize,
- unsigned subframe_bps,
- const FLAC__Subframe *subframe,
- FLAC__BitWriter *frame
+ FLAC__StreamEncoder *encoder,
+ unsigned blocksize,
+ unsigned subframe_bps,
+ const FLAC__Subframe *subframe,
+ FLAC__BitWriter *frame
)
{
- switch(subframe->type)
- {
- case FLAC__SUBFRAME_TYPE_CONSTANT:
- if(!FLAC__subframe_add_constant(&(subframe->data.constant), subframe_bps, subframe->wasted_bits, frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return false;
- }
- break;
- case FLAC__SUBFRAME_TYPE_FIXED:
- if(!FLAC__subframe_add_fixed(&(subframe->data.fixed), blocksize - subframe->data.fixed.order, subframe_bps, subframe->wasted_bits, frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return false;
- }
- break;
- case FLAC__SUBFRAME_TYPE_LPC:
- if(!FLAC__subframe_add_lpc(&(subframe->data.lpc), blocksize - subframe->data.lpc.order, subframe_bps, subframe->wasted_bits, frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return false;
- }
- break;
- case FLAC__SUBFRAME_TYPE_VERBATIM:
- if(!FLAC__subframe_add_verbatim(&(subframe->data.verbatim), blocksize, subframe_bps, subframe->wasted_bits, frame))
- {
- encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
- return false;
- }
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- return true;
+ switch(subframe->type) {
+ case FLAC__SUBFRAME_TYPE_CONSTANT:
+ if(!FLAC__subframe_add_constant(&(subframe->data.constant), subframe_bps, subframe->wasted_bits, frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return false;
+ }
+ break;
+ case FLAC__SUBFRAME_TYPE_FIXED:
+ if(!FLAC__subframe_add_fixed(&(subframe->data.fixed), blocksize - subframe->data.fixed.order, subframe_bps, subframe->wasted_bits, frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return false;
+ }
+ break;
+ case FLAC__SUBFRAME_TYPE_LPC:
+ if(!FLAC__subframe_add_lpc(&(subframe->data.lpc), blocksize - subframe->data.lpc.order, subframe_bps, subframe->wasted_bits, frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return false;
+ }
+ break;
+ case FLAC__SUBFRAME_TYPE_VERBATIM:
+ if(!FLAC__subframe_add_verbatim(&(subframe->data.verbatim), blocksize, subframe_bps, subframe->wasted_bits, frame)) {
+ encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
+ return false;
+ }
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ return true;
}
#define SPOTCHECK_ESTIMATE 0
#if SPOTCHECK_ESTIMATE
static void spotcheck_subframe_estimate_(
- FLAC__StreamEncoder *encoder,
- unsigned blocksize,
- unsigned subframe_bps,
- const FLAC__Subframe *subframe,
- unsigned estimate
+ FLAC__StreamEncoder *encoder,
+ unsigned blocksize,
+ unsigned subframe_bps,
+ const FLAC__Subframe *subframe,
+ unsigned estimate
)
{
- FLAC__bool ret;
- FLAC__BitWriter *frame = FLAC__bitwriter_new();
- if(frame == 0)
- {
- fprintf(stderr, "EST: can't allocate frame\n");
- return;
- }
- if(!FLAC__bitwriter_init(frame))
- {
- fprintf(stderr, "EST: can't init frame\n");
- return;
- }
- ret = add_subframe_(encoder, blocksize, subframe_bps, subframe, frame);
- FLAC__ASSERT(ret);
- {
- const unsigned actual = FLAC__bitwriter_get_input_bits_unconsumed(frame);
- if(estimate != actual)
- fprintf(stderr, "EST: bad, frame#%u sub#%%d type=%8s est=%u, actual=%u, delta=%d\n", encoder->private_->current_frame_number, FLAC__SubframeTypeString[subframe->type], estimate, actual, (int)actual - (int)estimate);
- }
- FLAC__bitwriter_delete(frame);
+ FLAC__bool ret;
+ FLAC__BitWriter *frame = FLAC__bitwriter_new();
+ if(frame == 0) {
+ fprintf(stderr, "EST: can't allocate frame\n");
+ return;
+ }
+ if(!FLAC__bitwriter_init(frame)) {
+ fprintf(stderr, "EST: can't init frame\n");
+ return;
+ }
+ ret = add_subframe_(encoder, blocksize, subframe_bps, subframe, frame);
+ FLAC__ASSERT(ret);
+ {
+ const unsigned actual = FLAC__bitwriter_get_input_bits_unconsumed(frame);
+ if(estimate != actual)
+ fprintf(stderr, "EST: bad, frame#%u sub#%%d type=%8s est=%u, actual=%u, delta=%d\n", encoder->private_->current_frame_number, FLAC__SubframeTypeString[subframe->type], estimate, actual, (int)actual-(int)estimate);
+ }
+ FLAC__bitwriter_delete(frame);
}
#endif
unsigned evaluate_constant_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal,
- unsigned blocksize,
- unsigned subframe_bps,
- FLAC__Subframe *subframe
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal,
+ unsigned blocksize,
+ unsigned subframe_bps,
+ FLAC__Subframe *subframe
)
{
- unsigned estimate;
- subframe->type = FLAC__SUBFRAME_TYPE_CONSTANT;
- subframe->data.constant.value = signal;
+ unsigned estimate;
+ subframe->type = FLAC__SUBFRAME_TYPE_CONSTANT;
+ subframe->data.constant.value = signal;
- estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + subframe_bps;
+ estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + subframe_bps;
#if SPOTCHECK_ESTIMATE
- spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
+ spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
#else
- (void)encoder, (void)blocksize;
+ (void)encoder, (void)blocksize;
#endif
- return estimate;
+ return estimate;
}
unsigned evaluate_fixed_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal[],
- FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned raw_bits_per_partition[],
- unsigned blocksize,
- unsigned subframe_bps,
- unsigned order,
- unsigned rice_parameter,
- unsigned rice_parameter_limit,
- unsigned min_partition_order,
- unsigned max_partition_order,
- FLAC__bool do_escape_coding,
- unsigned rice_parameter_search_dist,
- FLAC__Subframe *subframe,
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal[],
+ FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned raw_bits_per_partition[],
+ unsigned blocksize,
+ unsigned subframe_bps,
+ unsigned order,
+ unsigned rice_parameter,
+ unsigned rice_parameter_limit,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ FLAC__bool do_escape_coding,
+ unsigned rice_parameter_search_dist,
+ FLAC__Subframe *subframe,
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
)
{
- unsigned i, residual_bits, estimate;
- const unsigned residual_samples = blocksize - order;
-
- FLAC__fixed_compute_residual(signal + order, residual_samples, order, residual);
-
- subframe->type = FLAC__SUBFRAME_TYPE_FIXED;
-
- subframe->data.fixed.entropy_coding_method.type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE;
- subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents = partitioned_rice_contents;
- subframe->data.fixed.residual = residual;
-
- residual_bits =
- find_best_partition_order_(
- encoder->private_,
- residual,
- abs_residual_partition_sums,
- raw_bits_per_partition,
- residual_samples,
- order,
- rice_parameter,
- rice_parameter_limit,
- min_partition_order,
- max_partition_order,
- subframe_bps,
- do_escape_coding,
- rice_parameter_search_dist,
- &subframe->data.fixed.entropy_coding_method
- );
-
- subframe->data.fixed.order = order;
- for(i = 0; i < order; i++)
- subframe->data.fixed.warmup[i] = signal[i];
-
- estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (order * subframe_bps) + residual_bits;
+ unsigned i, residual_bits, estimate;
+ const unsigned residual_samples = blocksize - order;
+
+ FLAC__fixed_compute_residual(signal+order, residual_samples, order, residual);
+
+ subframe->type = FLAC__SUBFRAME_TYPE_FIXED;
+
+ subframe->data.fixed.entropy_coding_method.type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE;
+ subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents = partitioned_rice_contents;
+ subframe->data.fixed.residual = residual;
+
+ residual_bits =
+ find_best_partition_order_(
+ encoder->private_,
+ residual,
+ abs_residual_partition_sums,
+ raw_bits_per_partition,
+ residual_samples,
+ order,
+ rice_parameter,
+ rice_parameter_limit,
+ min_partition_order,
+ max_partition_order,
+ subframe_bps,
+ do_escape_coding,
+ rice_parameter_search_dist,
+ &subframe->data.fixed.entropy_coding_method
+ );
+
+ subframe->data.fixed.order = order;
+ for(i = 0; i < order; i++)
+ subframe->data.fixed.warmup[i] = signal[i];
+
+ estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (order * subframe_bps) + residual_bits;
#if SPOTCHECK_ESTIMATE
- spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
+ spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
#endif
- return estimate;
+ return estimate;
}
#ifndef FLAC__INTEGER_ONLY_LIBRARY
unsigned evaluate_lpc_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal[],
- FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned raw_bits_per_partition[],
- const FLAC__real lp_coeff[],
- unsigned blocksize,
- unsigned subframe_bps,
- unsigned order,
- unsigned qlp_coeff_precision,
- unsigned rice_parameter,
- unsigned rice_parameter_limit,
- unsigned min_partition_order,
- unsigned max_partition_order,
- FLAC__bool do_escape_coding,
- unsigned rice_parameter_search_dist,
- FLAC__Subframe *subframe,
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal[],
+ FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned raw_bits_per_partition[],
+ const FLAC__real lp_coeff[],
+ unsigned blocksize,
+ unsigned subframe_bps,
+ unsigned order,
+ unsigned qlp_coeff_precision,
+ unsigned rice_parameter,
+ unsigned rice_parameter_limit,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ FLAC__bool do_escape_coding,
+ unsigned rice_parameter_search_dist,
+ FLAC__Subframe *subframe,
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
)
{
- FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
- unsigned i, residual_bits, estimate;
- int quantization, ret;
- const unsigned residual_samples = blocksize - order;
-
- /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps streams */
- if(subframe_bps <= 16)
- {
- FLAC__ASSERT(order > 0);
- FLAC__ASSERT(order <= FLAC__MAX_LPC_ORDER);
- qlp_coeff_precision = min(qlp_coeff_precision, 32 - subframe_bps - FLAC__bitmath_ilog2(order));
- }
-
- ret = FLAC__lpc_quantize_coefficients(lp_coeff, order, qlp_coeff_precision, qlp_coeff, &quantization);
- if(ret != 0)
- return 0; /* this is a hack to indicate to the caller that we can't do lp at this order on this subframe */
-
- if(subframe_bps + qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32)
- if(subframe_bps <= 16 && qlp_coeff_precision <= 16)
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal + order, residual_samples, qlp_coeff, order, quantization, residual);
- else
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal + order, residual_samples, qlp_coeff, order, quantization, residual);
- else
- encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(signal + order, residual_samples, qlp_coeff, order, quantization, residual);
-
- subframe->type = FLAC__SUBFRAME_TYPE_LPC;
-
- subframe->data.lpc.entropy_coding_method.type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE;
- subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents = partitioned_rice_contents;
- subframe->data.lpc.residual = residual;
-
- residual_bits =
- find_best_partition_order_(
- encoder->private_,
- residual,
- abs_residual_partition_sums,
- raw_bits_per_partition,
- residual_samples,
- order,
- rice_parameter,
- rice_parameter_limit,
- min_partition_order,
- max_partition_order,
- subframe_bps,
- do_escape_coding,
- rice_parameter_search_dist,
- &subframe->data.lpc.entropy_coding_method
- );
-
- subframe->data.lpc.order = order;
- subframe->data.lpc.qlp_coeff_precision = qlp_coeff_precision;
- subframe->data.lpc.quantization_level = quantization;
- memcpy(subframe->data.lpc.qlp_coeff, qlp_coeff, sizeof(FLAC__int32)*FLAC__MAX_LPC_ORDER);
- for(i = 0; i < order; i++)
- subframe->data.lpc.warmup[i] = signal[i];
-
- estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN + FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN + (order * (qlp_coeff_precision + subframe_bps)) + residual_bits;
+ FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
+ unsigned i, residual_bits, estimate;
+ int quantization, ret;
+ const unsigned residual_samples = blocksize - order;
+
+ /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps streams */
+ if(subframe_bps <= 16) {
+ FLAC__ASSERT(order > 0);
+ FLAC__ASSERT(order <= FLAC__MAX_LPC_ORDER);
+ qlp_coeff_precision = min(qlp_coeff_precision, 32 - subframe_bps - FLAC__bitmath_ilog2(order));
+ }
+
+ ret = FLAC__lpc_quantize_coefficients(lp_coeff, order, qlp_coeff_precision, qlp_coeff, &quantization);
+ if(ret != 0)
+ return 0; /* this is a hack to indicate to the caller that we can't do lp at this order on this subframe */
+
+ if(subframe_bps + qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32)
+ if(subframe_bps <= 16 && qlp_coeff_precision <= 16)
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual);
+ else
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal+order, residual_samples, qlp_coeff, order, quantization, residual);
+ else
+ encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual);
+
+ subframe->type = FLAC__SUBFRAME_TYPE_LPC;
+
+ subframe->data.lpc.entropy_coding_method.type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE;
+ subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents = partitioned_rice_contents;
+ subframe->data.lpc.residual = residual;
+
+ residual_bits =
+ find_best_partition_order_(
+ encoder->private_,
+ residual,
+ abs_residual_partition_sums,
+ raw_bits_per_partition,
+ residual_samples,
+ order,
+ rice_parameter,
+ rice_parameter_limit,
+ min_partition_order,
+ max_partition_order,
+ subframe_bps,
+ do_escape_coding,
+ rice_parameter_search_dist,
+ &subframe->data.lpc.entropy_coding_method
+ );
+
+ subframe->data.lpc.order = order;
+ subframe->data.lpc.qlp_coeff_precision = qlp_coeff_precision;
+ subframe->data.lpc.quantization_level = quantization;
+ memcpy(subframe->data.lpc.qlp_coeff, qlp_coeff, sizeof(FLAC__int32)*FLAC__MAX_LPC_ORDER);
+ for(i = 0; i < order; i++)
+ subframe->data.lpc.warmup[i] = signal[i];
+
+ estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN + FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN + (order * (qlp_coeff_precision + subframe_bps)) + residual_bits;
#if SPOTCHECK_ESTIMATE
- spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
+ spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
#endif
- return estimate;
+ return estimate;
}
#endif
unsigned evaluate_verbatim_subframe_(
- FLAC__StreamEncoder *encoder,
- const FLAC__int32 signal[],
- unsigned blocksize,
- unsigned subframe_bps,
- FLAC__Subframe *subframe
+ FLAC__StreamEncoder *encoder,
+ const FLAC__int32 signal[],
+ unsigned blocksize,
+ unsigned subframe_bps,
+ FLAC__Subframe *subframe
)
{
- unsigned estimate;
+ unsigned estimate;
- subframe->type = FLAC__SUBFRAME_TYPE_VERBATIM;
+ subframe->type = FLAC__SUBFRAME_TYPE_VERBATIM;
- subframe->data.verbatim.data = signal;
+ subframe->data.verbatim.data = signal;
- estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (blocksize * subframe_bps);
+ estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (blocksize * subframe_bps);
#if SPOTCHECK_ESTIMATE
- spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
+ spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate);
#else
- (void)encoder;
+ (void)encoder;
#endif
- return estimate;
+ return estimate;
}
unsigned find_best_partition_order_(
- FLAC__StreamEncoderPrivate *private_,
- const FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned raw_bits_per_partition[],
- unsigned residual_samples,
- unsigned predictor_order,
- unsigned rice_parameter,
- unsigned rice_parameter_limit,
- unsigned min_partition_order,
- unsigned max_partition_order,
- unsigned bps,
- FLAC__bool do_escape_coding,
- unsigned rice_parameter_search_dist,
- FLAC__EntropyCodingMethod *best_ecm
+ FLAC__StreamEncoderPrivate *private_,
+ const FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned raw_bits_per_partition[],
+ unsigned residual_samples,
+ unsigned predictor_order,
+ unsigned rice_parameter,
+ unsigned rice_parameter_limit,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ unsigned bps,
+ FLAC__bool do_escape_coding,
+ unsigned rice_parameter_search_dist,
+ FLAC__EntropyCodingMethod *best_ecm
)
{
- unsigned residual_bits, best_residual_bits = 0;
- unsigned best_parameters_index = 0;
- unsigned best_partition_order = 0;
- const unsigned blocksize = residual_samples + predictor_order;
+ unsigned residual_bits, best_residual_bits = 0;
+ unsigned best_parameters_index = 0;
+ unsigned best_partition_order = 0;
+ const unsigned blocksize = residual_samples + predictor_order;
- max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(max_partition_order, blocksize, predictor_order);
- min_partition_order = min(min_partition_order, max_partition_order);
+ max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(max_partition_order, blocksize, predictor_order);
+ min_partition_order = min(min_partition_order, max_partition_order);
- precompute_partition_info_sums_(residual, abs_residual_partition_sums, residual_samples, predictor_order, min_partition_order, max_partition_order, bps);
+ precompute_partition_info_sums_(residual, abs_residual_partition_sums, residual_samples, predictor_order, min_partition_order, max_partition_order, bps);
- if(do_escape_coding)
- precompute_partition_info_escapes_(residual, raw_bits_per_partition, residual_samples, predictor_order, min_partition_order, max_partition_order);
+ if(do_escape_coding)
+ precompute_partition_info_escapes_(residual, raw_bits_per_partition, residual_samples, predictor_order, min_partition_order, max_partition_order);
- {
- int partition_order;
- unsigned sum;
+ {
+ int partition_order;
+ unsigned sum;
- for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--)
- {
- if(!
- set_partitioned_rice_(
+ for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--) {
+ if(!
+ set_partitioned_rice_(
#ifdef EXACT_RICE_BITS_CALCULATION
- residual,
+ residual,
#endif
- abs_residual_partition_sums + sum,
- raw_bits_per_partition + sum,
- residual_samples,
- predictor_order,
- rice_parameter,
- rice_parameter_limit,
- rice_parameter_search_dist,
- (unsigned)partition_order,
- do_escape_coding,
- &private_->partitioned_rice_contents_extra[!best_parameters_index],
- &residual_bits
- )
- )
- {
- FLAC__ASSERT(best_residual_bits != 0);
- break;
- }
- sum += 1u << partition_order;
- if(best_residual_bits == 0 || residual_bits < best_residual_bits)
- {
- best_residual_bits = residual_bits;
- best_parameters_index = !best_parameters_index;
- best_partition_order = partition_order;
- }
- }
- }
-
- best_ecm->data.partitioned_rice.order = best_partition_order;
-
- {
- /*
- * We are allowed to de-const the pointer based on our special
- * knowledge; it is const to the outside world.
- */
- FLAC__EntropyCodingMethod_PartitionedRiceContents* prc = (FLAC__EntropyCodingMethod_PartitionedRiceContents*)best_ecm->data.partitioned_rice.contents;
- unsigned partition;
-
- /* save best parameters and raw_bits */
- FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(prc, max(6, best_partition_order));
- memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*(1 << (best_partition_order)));
- if(do_escape_coding)
- memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*(1 << (best_partition_order)));
- /*
- * Now need to check if the type should be changed to
- * FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 based on the
- * size of the rice parameters.
- */
- for(partition = 0; partition < (1u << best_partition_order); partition++)
- {
- if(prc->parameters[partition] >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER)
- {
- best_ecm->type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2;
- break;
- }
- }
- }
-
- return best_residual_bits;
+ abs_residual_partition_sums+sum,
+ raw_bits_per_partition+sum,
+ residual_samples,
+ predictor_order,
+ rice_parameter,
+ rice_parameter_limit,
+ rice_parameter_search_dist,
+ (unsigned)partition_order,
+ do_escape_coding,
+ &private_->partitioned_rice_contents_extra[!best_parameters_index],
+ &residual_bits
+ )
+ )
+ {
+ FLAC__ASSERT(best_residual_bits != 0);
+ break;
+ }
+ sum += 1u << partition_order;
+ if(best_residual_bits == 0 || residual_bits < best_residual_bits) {
+ best_residual_bits = residual_bits;
+ best_parameters_index = !best_parameters_index;
+ best_partition_order = partition_order;
+ }
+ }
+ }
+
+ best_ecm->data.partitioned_rice.order = best_partition_order;
+
+ {
+ /*
+ * We are allowed to de-const the pointer based on our special
+ * knowledge; it is const to the outside world.
+ */
+ FLAC__EntropyCodingMethod_PartitionedRiceContents* prc = (FLAC__EntropyCodingMethod_PartitionedRiceContents*)best_ecm->data.partitioned_rice.contents;
+ unsigned partition;
+
+ /* save best parameters and raw_bits */
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(prc, max(6, best_partition_order));
+ memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*(1<<(best_partition_order)));
+ if(do_escape_coding)
+ memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*(1<<(best_partition_order)));
+ /*
+ * Now need to check if the type should be changed to
+ * FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 based on the
+ * size of the rice parameters.
+ */
+ for(partition = 0; partition < (1u<<best_partition_order); partition++) {
+ if(prc->parameters[partition] >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) {
+ best_ecm->type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2;
+ break;
+ }
+ }
+ }
+
+ return best_residual_bits;
}
#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM
extern void precompute_partition_info_sums_32bit_asm_ia32_(
- const FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned blocksize,
- unsigned predictor_order,
- unsigned min_partition_order,
- unsigned max_partition_order
+ const FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned blocksize,
+ unsigned predictor_order,
+ unsigned min_partition_order,
+ unsigned max_partition_order
);
#endif
void precompute_partition_info_sums_(
- const FLAC__int32 residual[],
- FLAC__uint64 abs_residual_partition_sums[],
- unsigned residual_samples,
- unsigned predictor_order,
- unsigned min_partition_order,
- unsigned max_partition_order,
- unsigned bps
+ const FLAC__int32 residual[],
+ FLAC__uint64 abs_residual_partition_sums[],
+ unsigned residual_samples,
+ unsigned predictor_order,
+ unsigned min_partition_order,
+ unsigned max_partition_order,
+ unsigned bps
)
{
- const unsigned default_partition_samples = (residual_samples + predictor_order) >> max_partition_order;
- unsigned partitions = 1u << max_partition_order;
+ const unsigned default_partition_samples = (residual_samples + predictor_order) >> max_partition_order;
+ unsigned partitions = 1u << max_partition_order;
- FLAC__ASSERT(default_partition_samples > predictor_order);
+ FLAC__ASSERT(default_partition_samples > predictor_order);
#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM
- /* slightly pessimistic but still catches all common cases */
- /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
- if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32)
- {
- precompute_partition_info_sums_32bit_asm_ia32_(residual, abs_residual_partition_sums, residual_samples + predictor_order, predictor_order, min_partition_order, max_partition_order);
- return;
- }
+ /* slightly pessimistic but still catches all common cases */
+ /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
+ if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) {
+ precompute_partition_info_sums_32bit_asm_ia32_(residual, abs_residual_partition_sums, residual_samples + predictor_order, predictor_order, min_partition_order, max_partition_order);
+ return;
+ }
#endif
- /* first do max_partition_order */
- {
- unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order);
- /* slightly pessimistic but still catches all common cases */
- /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
- if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32)
- {
- FLAC__uint32 abs_residual_partition_sum;
-
- for(partition = residual_sample = 0; partition < partitions; partition++)
- {
- end += default_partition_samples;
- abs_residual_partition_sum = 0;
- for(; residual_sample < end; residual_sample++)
- abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */
- abs_residual_partition_sums[partition] = abs_residual_partition_sum;
- }
- }
- else /* have to pessimistically use 64 bits for accumulator */
- {
- FLAC__uint64 abs_residual_partition_sum;
-
- for(partition = residual_sample = 0; partition < partitions; partition++)
- {
- end += default_partition_samples;
- abs_residual_partition_sum = 0;
- for(; residual_sample < end; residual_sample++)
- abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */
- abs_residual_partition_sums[partition] = abs_residual_partition_sum;
- }
- }
- }
-
- /* now merge partitions for lower orders */
- {
- unsigned from_partition = 0, to_partition = partitions;
- int partition_order;
- for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--)
- {
- unsigned i;
- partitions >>= 1;
- for(i = 0; i < partitions; i++)
- {
- abs_residual_partition_sums[to_partition++] =
- abs_residual_partition_sums[from_partition ] +
- abs_residual_partition_sums[from_partition+1];
- from_partition += 2;
- }
- }
- }
+ /* first do max_partition_order */
+ {
+ unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order);
+ /* slightly pessimistic but still catches all common cases */
+ /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
+ if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) {
+ FLAC__uint32 abs_residual_partition_sum;
+
+ for(partition = residual_sample = 0; partition < partitions; partition++) {
+ end += default_partition_samples;
+ abs_residual_partition_sum = 0;
+ for( ; residual_sample < end; residual_sample++)
+ abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */
+ abs_residual_partition_sums[partition] = abs_residual_partition_sum;
+ }
+ }
+ else { /* have to pessimistically use 64 bits for accumulator */
+ FLAC__uint64 abs_residual_partition_sum;
+
+ for(partition = residual_sample = 0; partition < partitions; partition++) {
+ end += default_partition_samples;
+ abs_residual_partition_sum = 0;
+ for( ; residual_sample < end; residual_sample++)
+ abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */
+ abs_residual_partition_sums[partition] = abs_residual_partition_sum;
+ }
+ }
+ }
+
+ /* now merge partitions for lower orders */
+ {
+ unsigned from_partition = 0, to_partition = partitions;
+ int partition_order;
+ for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) {
+ unsigned i;
+ partitions >>= 1;
+ for(i = 0; i < partitions; i++) {
+ abs_residual_partition_sums[to_partition++] =
+ abs_residual_partition_sums[from_partition ] +
+ abs_residual_partition_sums[from_partition+1];
+ from_partition += 2;
+ }
+ }
+ }
}
void precompute_partition_info_escapes_(
- const FLAC__int32 residual[],
- unsigned raw_bits_per_partition[],
- unsigned residual_samples,
- unsigned predictor_order,
- unsigned min_partition_order,
- unsigned max_partition_order
+ const FLAC__int32 residual[],
+ unsigned raw_bits_per_partition[],
+ unsigned residual_samples,
+ unsigned predictor_order,
+ unsigned min_partition_order,
+ unsigned max_partition_order
)
{
- int partition_order;
- unsigned from_partition, to_partition = 0;
- const unsigned blocksize = residual_samples + predictor_order;
-
- /* first do max_partition_order */
- for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--)
- {
- FLAC__int32 r;
- FLAC__uint32 rmax;
- unsigned partition, partition_sample, partition_samples, residual_sample;
- const unsigned partitions = 1u << partition_order;
- const unsigned default_partition_samples = blocksize >> partition_order;
-
- FLAC__ASSERT(default_partition_samples > predictor_order);
-
- for(partition = residual_sample = 0; partition < partitions; partition++)
- {
- partition_samples = default_partition_samples;
- if(partition == 0)
- partition_samples -= predictor_order;
- rmax = 0;
- for(partition_sample = 0; partition_sample < partition_samples; partition_sample++)
- {
- r = residual[residual_sample++];
- /* OPT: maybe faster: rmax |= r ^ (r>>31) */
- if(r < 0)
- rmax |= ~r;
- else
- rmax |= r;
- }
- /* now we know all residual values are in the range [-rmax-1,rmax] */
- raw_bits_per_partition[partition] = rmax ? FLAC__bitmath_ilog2(rmax) + 2 : 1;
- }
- to_partition = partitions;
- break; /*@@@ yuck, should remove the 'for' loop instead */
- }
-
- /* now merge partitions for lower orders */
- for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--)
- {
- unsigned m;
- unsigned i;
- const unsigned partitions = 1u << partition_order;
- for(i = 0; i < partitions; i++)
- {
- m = raw_bits_per_partition[from_partition];
- from_partition++;
- raw_bits_per_partition[to_partition] = max(m, raw_bits_per_partition[from_partition]);
- from_partition++;
- to_partition++;
- }
- }
+ int partition_order;
+ unsigned from_partition, to_partition = 0;
+ const unsigned blocksize = residual_samples + predictor_order;
+
+ /* first do max_partition_order */
+ for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--) {
+ FLAC__int32 r;
+ FLAC__uint32 rmax;
+ unsigned partition, partition_sample, partition_samples, residual_sample;
+ const unsigned partitions = 1u << partition_order;
+ const unsigned default_partition_samples = blocksize >> partition_order;
+
+ FLAC__ASSERT(default_partition_samples > predictor_order);
+
+ for(partition = residual_sample = 0; partition < partitions; partition++) {
+ partition_samples = default_partition_samples;
+ if(partition == 0)
+ partition_samples -= predictor_order;
+ rmax = 0;
+ for(partition_sample = 0; partition_sample < partition_samples; partition_sample++) {
+ r = residual[residual_sample++];
+ /* OPT: maybe faster: rmax |= r ^ (r>>31) */
+ if(r < 0)
+ rmax |= ~r;
+ else
+ rmax |= r;
+ }
+ /* now we know all residual values are in the range [-rmax-1,rmax] */
+ raw_bits_per_partition[partition] = rmax? FLAC__bitmath_ilog2(rmax) + 2 : 1;
+ }
+ to_partition = partitions;
+ break; /*@@@ yuck, should remove the 'for' loop instead */
+ }
+
+ /* now merge partitions for lower orders */
+ for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--) {
+ unsigned m;
+ unsigned i;
+ const unsigned partitions = 1u << partition_order;
+ for(i = 0; i < partitions; i++) {
+ m = raw_bits_per_partition[from_partition];
+ from_partition++;
+ raw_bits_per_partition[to_partition] = max(m, raw_bits_per_partition[from_partition]);
+ from_partition++;
+ to_partition++;
+ }
+ }
}
#ifdef EXACT_RICE_BITS_CALCULATION
static FLaC__INLINE unsigned count_rice_bits_in_partition_(
- const unsigned rice_parameter,
- const unsigned partition_samples,
- const FLAC__int32 *residual
+ const unsigned rice_parameter,
+ const unsigned partition_samples,
+ const FLAC__int32 *residual
)
{
- unsigned i, partition_bits =
- FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */
- (1 + rice_parameter) * partition_samples /* 1 for unary stop bit + rice_parameter for the binary portion */
- ;
- for(i = 0; i < partition_samples; i++)
- partition_bits += ((FLAC__uint32)((residual[i] << 1) ^(residual[i] >> 31)) >> rice_parameter);
- return partition_bits;
+ unsigned i, partition_bits =
+ FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */
+ (1+rice_parameter) * partition_samples /* 1 for unary stop bit + rice_parameter for the binary portion */
+ ;
+ for(i = 0; i < partition_samples; i++)
+ partition_bits += ( (FLAC__uint32)((residual[i]<<1)^(residual[i]>>31)) >> rice_parameter );
+ return partition_bits;
}
#else
static FLaC__INLINE unsigned count_rice_bits_in_partition_(
- const unsigned rice_parameter,
- const unsigned partition_samples,
- const FLAC__uint64 abs_residual_partition_sum
+ const unsigned rice_parameter,
+ const unsigned partition_samples,
+ const FLAC__uint64 abs_residual_partition_sum
)
{
- return
- FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */
- (1 + rice_parameter) * partition_samples + /* 1 for unary stop bit + rice_parameter for the binary portion */
- (
- rice_parameter ?
- (unsigned)(abs_residual_partition_sum >> (rice_parameter - 1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */
- : (unsigned)(abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */
- )
- - (partition_samples >> 1)
- /* -(partition_samples>>1) to subtract out extra contributions to the abs_residual_partition_sum.
- * The actual number of bits used is closer to the sum(for all i in the partition) of abs(residual[i])>>(rice_parameter-1)
- * By using the abs_residual_partition sum, we also add in bits in the LSBs that would normally be shifted out.
- * So the subtraction term tries to guess how many extra bits were contributed.
- * If the LSBs are randomly distributed, this should average to 0.5 extra bits per sample.
- */
- ;
+ return
+ FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */
+ (1+rice_parameter) * partition_samples + /* 1 for unary stop bit + rice_parameter for the binary portion */
+ (
+ rice_parameter?
+ (unsigned)(abs_residual_partition_sum >> (rice_parameter-1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */
+ : (unsigned)(abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */
+ )
+ - (partition_samples >> 1)
+ /* -(partition_samples>>1) to subtract out extra contributions to the abs_residual_partition_sum.
+ * The actual number of bits used is closer to the sum(for all i in the partition) of abs(residual[i])>>(rice_parameter-1)
+ * By using the abs_residual_partition sum, we also add in bits in the LSBs that would normally be shifted out.
+ * So the subtraction term tries to guess how many extra bits were contributed.
+ * If the LSBs are randomly distributed, this should average to 0.5 extra bits per sample.
+ */
+ ;
}
#endif
FLAC__bool set_partitioned_rice_(
#ifdef EXACT_RICE_BITS_CALCULATION
- const FLAC__int32 residual[],
+ const FLAC__int32 residual[],
#endif
- const FLAC__uint64 abs_residual_partition_sums[],
- const unsigned raw_bits_per_partition[],
- const unsigned residual_samples,
- const unsigned predictor_order,
- const unsigned suggested_rice_parameter,
- const unsigned rice_parameter_limit,
- const unsigned rice_parameter_search_dist,
- const unsigned partition_order,
- const FLAC__bool search_for_escapes,
- FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents,
- unsigned *bits
+ const FLAC__uint64 abs_residual_partition_sums[],
+ const unsigned raw_bits_per_partition[],
+ const unsigned residual_samples,
+ const unsigned predictor_order,
+ const unsigned suggested_rice_parameter,
+ const unsigned rice_parameter_limit,
+ const unsigned rice_parameter_search_dist,
+ const unsigned partition_order,
+ const FLAC__bool search_for_escapes,
+ FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents,
+ unsigned *bits
)
{
- unsigned rice_parameter, partition_bits;
- unsigned best_partition_bits, best_rice_parameter = 0;
- unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN;
- unsigned *parameters, *raw_bits;
+ unsigned rice_parameter, partition_bits;
+ unsigned best_partition_bits, best_rice_parameter = 0;
+ unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN;
+ unsigned *parameters, *raw_bits;
#ifdef ENABLE_RICE_PARAMETER_SEARCH
- unsigned min_rice_parameter, max_rice_parameter;
+ unsigned min_rice_parameter, max_rice_parameter;
#else
- (void)rice_parameter_search_dist;
+ (void)rice_parameter_search_dist;
#endif
- FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER);
- FLAC__ASSERT(rice_parameter_limit <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER);
+ FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER);
+ FLAC__ASSERT(rice_parameter_limit <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER);
- FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order));
- parameters = partitioned_rice_contents->parameters;
- raw_bits = partitioned_rice_contents->raw_bits;
+ FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order));
+ parameters = partitioned_rice_contents->parameters;
+ raw_bits = partitioned_rice_contents->raw_bits;
- if(partition_order == 0)
- {
- best_partition_bits = (unsigned)(-1);
+ if(partition_order == 0) {
+ best_partition_bits = (unsigned)(-1);
#ifdef ENABLE_RICE_PARAMETER_SEARCH
- if(rice_parameter_search_dist)
- {
- if(suggested_rice_parameter < rice_parameter_search_dist)
- min_rice_parameter = 0;
- else
- min_rice_parameter = suggested_rice_parameter - rice_parameter_search_dist;
- max_rice_parameter = suggested_rice_parameter + rice_parameter_search_dist;
- if(max_rice_parameter >= rice_parameter_limit)
- {
+ if(rice_parameter_search_dist) {
+ if(suggested_rice_parameter < rice_parameter_search_dist)
+ min_rice_parameter = 0;
+ else
+ min_rice_parameter = suggested_rice_parameter - rice_parameter_search_dist;
+ max_rice_parameter = suggested_rice_parameter + rice_parameter_search_dist;
+ if(max_rice_parameter >= rice_parameter_limit) {
#ifdef DEBUG_VERBOSE
- fprintf(stderr, "clipping rice_parameter (%u -> %u) @5\n", max_rice_parameter, rice_parameter_limit - 1);
+ fprintf(stderr, "clipping rice_parameter (%u -> %u) @5\n", max_rice_parameter, rice_parameter_limit - 1);
#endif
- max_rice_parameter = rice_parameter_limit - 1;
- }
- }
- else
- min_rice_parameter = max_rice_parameter = suggested_rice_parameter;
-
- for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++)
- {
+ max_rice_parameter = rice_parameter_limit - 1;
+ }
+ }
+ else
+ min_rice_parameter = max_rice_parameter = suggested_rice_parameter;
+
+ for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) {
#else
- rice_parameter = suggested_rice_parameter;
+ rice_parameter = suggested_rice_parameter;
#endif
#ifdef EXACT_RICE_BITS_CALCULATION
- partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, residual);
+ partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, residual);
#else
- partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, abs_residual_partition_sums[0]);
+ partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, abs_residual_partition_sums[0]);
#endif
- if(partition_bits < best_partition_bits)
- {
- best_rice_parameter = rice_parameter;
- best_partition_bits = partition_bits;
- }
+ if(partition_bits < best_partition_bits) {
+ best_rice_parameter = rice_parameter;
+ best_partition_bits = partition_bits;
+ }
#ifdef ENABLE_RICE_PARAMETER_SEARCH
- }
+ }
#endif
- if(search_for_escapes)
- {
- partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[0] * residual_samples;
- if(partition_bits <= best_partition_bits)
- {
- raw_bits[0] = raw_bits_per_partition[0];
- best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */
- best_partition_bits = partition_bits;
- }
- else
- raw_bits[0] = 0;
- }
- parameters[0] = best_rice_parameter;
- bits_ += best_partition_bits;
- }
- else
- {
- unsigned partition, residual_sample;
- unsigned partition_samples;
- FLAC__uint64 mean, k;
- const unsigned partitions = 1u << partition_order;
- for(partition = residual_sample = 0; partition < partitions; partition++)
- {
- partition_samples = (residual_samples + predictor_order) >> partition_order;
- if(partition == 0)
- {
- if(partition_samples <= predictor_order)
- return false;
- else
- partition_samples -= predictor_order;
- }
- mean = abs_residual_partition_sums[partition];
- /* we are basically calculating the size in bits of the
- * average residual magnitude in the partition:
- * rice_parameter = floor(log2(mean/partition_samples))
- * 'mean' is not a good name for the variable, it is
- * actually the sum of magnitudes of all residual values
- * in the partition, so the actual mean is
- * mean/partition_samples
- */
- for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k <<= 1)
- ;
- if(rice_parameter >= rice_parameter_limit)
- {
+ if(search_for_escapes) {
+ partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[0] * residual_samples;
+ if(partition_bits <= best_partition_bits) {
+ raw_bits[0] = raw_bits_per_partition[0];
+ best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */
+ best_partition_bits = partition_bits;
+ }
+ else
+ raw_bits[0] = 0;
+ }
+ parameters[0] = best_rice_parameter;
+ bits_ += best_partition_bits;
+ }
+ else {
+ unsigned partition, residual_sample;
+ unsigned partition_samples;
+ FLAC__uint64 mean, k;
+ const unsigned partitions = 1u << partition_order;
+ for(partition = residual_sample = 0; partition < partitions; partition++) {
+ partition_samples = (residual_samples+predictor_order) >> partition_order;
+ if(partition == 0) {
+ if(partition_samples <= predictor_order)
+ return false;
+ else
+ partition_samples -= predictor_order;
+ }
+ mean = abs_residual_partition_sums[partition];
+ /* we are basically calculating the size in bits of the
+ * average residual magnitude in the partition:
+ * rice_parameter = floor(log2(mean/partition_samples))
+ * 'mean' is not a good name for the variable, it is
+ * actually the sum of magnitudes of all residual values
+ * in the partition, so the actual mean is
+ * mean/partition_samples
+ */
+ for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k <<= 1)
+ ;
+ if(rice_parameter >= rice_parameter_limit) {
#ifdef DEBUG_VERBOSE
- fprintf(stderr, "clipping rice_parameter (%u -> %u) @6\n", rice_parameter, rice_parameter_limit - 1);
+ fprintf(stderr, "clipping rice_parameter (%u -> %u) @6\n", rice_parameter, rice_parameter_limit - 1);
#endif
- rice_parameter = rice_parameter_limit - 1;
- }
+ rice_parameter = rice_parameter_limit - 1;
+ }
- best_partition_bits = (unsigned)(-1);
+ best_partition_bits = (unsigned)(-1);
#ifdef ENABLE_RICE_PARAMETER_SEARCH
- if(rice_parameter_search_dist)
- {
- if(rice_parameter < rice_parameter_search_dist)
- min_rice_parameter = 0;
- else
- min_rice_parameter = rice_parameter - rice_parameter_search_dist;
- max_rice_parameter = rice_parameter + rice_parameter_search_dist;
- if(max_rice_parameter >= rice_parameter_limit)
- {
+ if(rice_parameter_search_dist) {
+ if(rice_parameter < rice_parameter_search_dist)
+ min_rice_parameter = 0;
+ else
+ min_rice_parameter = rice_parameter - rice_parameter_search_dist;
+ max_rice_parameter = rice_parameter + rice_parameter_search_dist;
+ if(max_rice_parameter >= rice_parameter_limit) {
#ifdef DEBUG_VERBOSE
- fprintf(stderr, "clipping rice_parameter (%u -> %u) @7\n", max_rice_parameter, rice_parameter_limit - 1);
+ fprintf(stderr, "clipping rice_parameter (%u -> %u) @7\n", max_rice_parameter, rice_parameter_limit - 1);
#endif
- max_rice_parameter = rice_parameter_limit - 1;
- }
- }
- else
- min_rice_parameter = max_rice_parameter = rice_parameter;
-
- for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++)
- {
+ max_rice_parameter = rice_parameter_limit - 1;
+ }
+ }
+ else
+ min_rice_parameter = max_rice_parameter = rice_parameter;
+
+ for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) {
#endif
#ifdef EXACT_RICE_BITS_CALCULATION
- partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, residual + residual_sample);
+ partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, residual+residual_sample);
#else
- partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, abs_residual_partition_sums[partition]);
+ partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, abs_residual_partition_sums[partition]);
#endif
- if(partition_bits < best_partition_bits)
- {
- best_rice_parameter = rice_parameter;
- best_partition_bits = partition_bits;
- }
+ if(partition_bits < best_partition_bits) {
+ best_rice_parameter = rice_parameter;
+ best_partition_bits = partition_bits;
+ }
#ifdef ENABLE_RICE_PARAMETER_SEARCH
- }
+ }
#endif
- if(search_for_escapes)
- {
- partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[partition] * partition_samples;
- if(partition_bits <= best_partition_bits)
- {
- raw_bits[partition] = raw_bits_per_partition[partition];
- best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */
- best_partition_bits = partition_bits;
- }
- else
- raw_bits[partition] = 0;
- }
- parameters[partition] = best_rice_parameter;
- bits_ += best_partition_bits;
- residual_sample += partition_samples;
- }
- }
-
- *bits = bits_;
- return true;
+ if(search_for_escapes) {
+ partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[partition] * partition_samples;
+ if(partition_bits <= best_partition_bits) {
+ raw_bits[partition] = raw_bits_per_partition[partition];
+ best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */
+ best_partition_bits = partition_bits;
+ }
+ else
+ raw_bits[partition] = 0;
+ }
+ parameters[partition] = best_rice_parameter;
+ bits_ += best_partition_bits;
+ residual_sample += partition_samples;
+ }
+ }
+
+ *bits = bits_;
+ return true;
}
unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples)
{
- unsigned i, shift;
- FLAC__int32 x = 0;
-
- for(i = 0; i < samples && !(x & 1); i++)
- x |= signal[i];
-
- if(x == 0)
- {
- shift = 0;
- }
- else
- {
- for(shift = 0; !(x & 1); shift++)
- x >>= 1;
- }
-
- if(shift > 0)
- {
- for(i = 0; i < samples; i++)
- signal[i] >>= shift;
- }
-
- return shift;
+ unsigned i, shift;
+ FLAC__int32 x = 0;
+
+ for(i = 0; i < samples && !(x&1); i++)
+ x |= signal[i];
+
+ if(x == 0) {
+ shift = 0;
+ }
+ else {
+ for(shift = 0; !(x&1); shift++)
+ x >>= 1;
+ }
+
+ if(shift > 0) {
+ for(i = 0; i < samples; i++)
+ signal[i] >>= shift;
+ }
+
+ return shift;
}
void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const input[], unsigned input_offset, unsigned channels, unsigned wide_samples)
{
- unsigned channel;
+ unsigned channel;
- for(channel = 0; channel < channels; channel++)
- memcpy(&fifo->data[channel][fifo->tail], &input[channel][input_offset], sizeof(FLAC__int32) * wide_samples);
+ for(channel = 0; channel < channels; channel++)
+ memcpy(&fifo->data[channel][fifo->tail], &input[channel][input_offset], sizeof(FLAC__int32) * wide_samples);
- fifo->tail += wide_samples;
+ fifo->tail += wide_samples;
- FLAC__ASSERT(fifo->tail <= fifo->size);
+ FLAC__ASSERT(fifo->tail <= fifo->size);
}
void append_to_verify_fifo_interleaved_(verify_input_fifo *fifo, const FLAC__int32 input[], unsigned input_offset, unsigned channels, unsigned wide_samples)
{
- unsigned channel;
- unsigned sample, wide_sample;
- unsigned tail = fifo->tail;
-
- sample = input_offset * channels;
- for(wide_sample = 0; wide_sample < wide_samples; wide_sample++)
- {
- for(channel = 0; channel < channels; channel++)
- fifo->data[channel][tail] = input[sample++];
- tail++;
- }
- fifo->tail = tail;
-
- FLAC__ASSERT(fifo->tail <= fifo->size);
+ unsigned channel;
+ unsigned sample, wide_sample;
+ unsigned tail = fifo->tail;
+
+ sample = input_offset * channels;
+ for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) {
+ for(channel = 0; channel < channels; channel++)
+ fifo->data[channel][tail] = input[sample++];
+ tail++;
+ }
+ fifo->tail = tail;
+
+ FLAC__ASSERT(fifo->tail <= fifo->size);
}
FLAC__StreamDecoderReadStatus verify_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data;
- const size_t encoded_bytes = encoder->private_->verify.output.bytes;
- (void)decoder;
-
- if(encoder->private_->verify.needs_magic_hack)
- {
- FLAC__ASSERT(*bytes >= FLAC__STREAM_SYNC_LENGTH);
- *bytes = FLAC__STREAM_SYNC_LENGTH;
- memcpy(buffer, FLAC__STREAM_SYNC_STRING, *bytes);
- encoder->private_->verify.needs_magic_hack = false;
- }
- else
- {
- if(encoded_bytes == 0)
- {
- /*
- * If we get here, a FIFO underflow has occurred,
- * which means there is a bug somewhere.
- */
- FLAC__ASSERT(0);
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
- }
- else if(encoded_bytes < *bytes)
- *bytes = encoded_bytes;
- memcpy(buffer, encoder->private_->verify.output.data, *bytes);
- encoder->private_->verify.output.data += *bytes;
- encoder->private_->verify.output.bytes -= *bytes;
- }
-
- return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data;
+ const size_t encoded_bytes = encoder->private_->verify.output.bytes;
+ (void)decoder;
+
+ if(encoder->private_->verify.needs_magic_hack) {
+ FLAC__ASSERT(*bytes >= FLAC__STREAM_SYNC_LENGTH);
+ *bytes = FLAC__STREAM_SYNC_LENGTH;
+ memcpy(buffer, FLAC__STREAM_SYNC_STRING, *bytes);
+ encoder->private_->verify.needs_magic_hack = false;
+ }
+ else {
+ if(encoded_bytes == 0) {
+ /*
+ * If we get here, a FIFO underflow has occurred,
+ * which means there is a bug somewhere.
+ */
+ FLAC__ASSERT(0);
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ }
+ else if(encoded_bytes < *bytes)
+ *bytes = encoded_bytes;
+ memcpy(buffer, encoder->private_->verify.output.data, *bytes);
+ encoder->private_->verify.output.data += *bytes;
+ encoder->private_->verify.output.bytes -= *bytes;
+ }
+
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
FLAC__StreamDecoderWriteStatus verify_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
- FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder *)client_data;
- unsigned channel;
- const unsigned channels = frame->header.channels;
- const unsigned blocksize = frame->header.blocksize;
- const unsigned bytes_per_block = sizeof(FLAC__int32) * blocksize;
-
- (void)decoder;
-
- for(channel = 0; channel < channels; channel++)
- {
- if(0 != memcmp(buffer[channel], encoder->private_->verify.input_fifo.data[channel], bytes_per_block))
- {
- unsigned i, sample = 0;
- FLAC__int32 expect = 0, got = 0;
-
- for(i = 0; i < blocksize; i++)
- {
- if(buffer[channel][i] != encoder->private_->verify.input_fifo.data[channel][i])
- {
- sample = i;
- expect = (FLAC__int32)encoder->private_->verify.input_fifo.data[channel][i];
- got = (FLAC__int32)buffer[channel][i];
- break;
- }
- }
- FLAC__ASSERT(i < blocksize);
- FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
- encoder->private_->verify.error_stats.absolute_sample = frame->header.number.sample_number + sample;
- encoder->private_->verify.error_stats.frame_number = (unsigned)(frame->header.number.sample_number / blocksize);
- encoder->private_->verify.error_stats.channel = channel;
- encoder->private_->verify.error_stats.sample = sample;
- encoder->private_->verify.error_stats.expected = expect;
- encoder->private_->verify.error_stats.got = got;
- encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA;
- return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
- }
- }
- /* dequeue the frame from the fifo */
- encoder->private_->verify.input_fifo.tail -= blocksize;
- FLAC__ASSERT(encoder->private_->verify.input_fifo.tail <= OVERREAD_);
- for(channel = 0; channel < channels; channel++)
- memmove(&encoder->private_->verify.input_fifo.data[channel][0], &encoder->private_->verify.input_fifo.data[channel][blocksize], encoder->private_->verify.input_fifo.tail * sizeof(encoder->private_->verify.input_fifo.data[0][0]));
- return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+ FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder *)client_data;
+ unsigned channel;
+ const unsigned channels = frame->header.channels;
+ const unsigned blocksize = frame->header.blocksize;
+ const unsigned bytes_per_block = sizeof(FLAC__int32) * blocksize;
+
+ (void)decoder;
+
+ for(channel = 0; channel < channels; channel++) {
+ if(0 != memcmp(buffer[channel], encoder->private_->verify.input_fifo.data[channel], bytes_per_block)) {
+ unsigned i, sample = 0;
+ FLAC__int32 expect = 0, got = 0;
+
+ for(i = 0; i < blocksize; i++) {
+ if(buffer[channel][i] != encoder->private_->verify.input_fifo.data[channel][i]) {
+ sample = i;
+ expect = (FLAC__int32)encoder->private_->verify.input_fifo.data[channel][i];
+ got = (FLAC__int32)buffer[channel][i];
+ break;
+ }
+ }
+ FLAC__ASSERT(i < blocksize);
+ FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
+ encoder->private_->verify.error_stats.absolute_sample = frame->header.number.sample_number + sample;
+ encoder->private_->verify.error_stats.frame_number = (unsigned)(frame->header.number.sample_number / blocksize);
+ encoder->private_->verify.error_stats.channel = channel;
+ encoder->private_->verify.error_stats.sample = sample;
+ encoder->private_->verify.error_stats.expected = expect;
+ encoder->private_->verify.error_stats.got = got;
+ encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA;
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+ }
+ }
+ /* dequeue the frame from the fifo */
+ encoder->private_->verify.input_fifo.tail -= blocksize;
+ FLAC__ASSERT(encoder->private_->verify.input_fifo.tail <= OVERREAD_);
+ for(channel = 0; channel < channels; channel++)
+ memmove(&encoder->private_->verify.input_fifo.data[channel][0], &encoder->private_->verify.input_fifo.data[channel][blocksize], encoder->private_->verify.input_fifo.tail * sizeof(encoder->private_->verify.input_fifo.data[0][0]));
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
void verify_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
- (void)decoder, (void)metadata, (void)client_data;
+ (void)decoder, (void)metadata, (void)client_data;
}
void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
{
- FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data;
- (void)decoder, (void)status;
- encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
+ FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data;
+ (void)decoder, (void)status;
+ encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR;
}
FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
- (void)client_data;
-
- *bytes = fread(buffer, 1, *bytes, encoder->private_->file);
- if(*bytes == 0)
- {
- if(feof(encoder->private_->file))
- return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM;
- else if(ferror(encoder->private_->file))
- return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
- }
- return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE;
+ (void)client_data;
+
+ *bytes = fread(buffer, 1, *bytes, encoder->private_->file);
+ if (*bytes == 0) {
+ if (feof(encoder->private_->file))
+ return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM;
+ else if (ferror(encoder->private_->file))
+ return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
+ }
+ return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE;
}
FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
{
- (void)client_data;
+ (void)client_data;
- if(fseeko(encoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
- return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
- else
- return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
+ if(fseeko(encoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
+ return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
+ else
+ return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
}
FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
{
- off_t offset;
+ off_t offset;
- (void)client_data;
+ (void)client_data;
- offset = ftello(encoder->private_->file);
+ offset = ftello(encoder->private_->file);
- if(offset < 0)
- {
- return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
- }
- else
- {
- *absolute_byte_offset = (FLAC__uint64)offset;
- return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
- }
+ if(offset < 0) {
+ return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
+ }
+ else {
+ *absolute_byte_offset = (FLAC__uint64)offset;
+ return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
+ }
}
#ifdef FLAC__VALGRIND_TESTING
static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
- size_t ret = fwrite(ptr, size, nmemb, stream);
- if(!ferror(stream))
- fflush(stream);
- return ret;
+ size_t ret = fwrite(ptr, size, nmemb, stream);
+ if(!ferror(stream))
+ fflush(stream);
+ return ret;
}
#else
#define local__fwrite fwrite
@@ -4626,35 +4297,33 @@ static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *st
FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data)
{
- (void)client_data, (void)current_frame;
+ (void)client_data, (void)current_frame;
- if(local__fwrite(buffer, sizeof(FLAC__byte), bytes, encoder->private_->file) == bytes)
- {
- FLAC__bool call_it = 0 != encoder->private_->progress_callback && (
+ if(local__fwrite(buffer, sizeof(FLAC__byte), bytes, encoder->private_->file) == bytes) {
+ FLAC__bool call_it = 0 != encoder->private_->progress_callback && (
#if FLAC__HAS_OGG
- /* We would like to be able to use 'samples > 0' in the
- * clause here but currently because of the nature of our
- * Ogg writing implementation, 'samples' is always 0 (see
- * ogg_encoder_aspect.c). The downside is extra progress
- * callbacks.
- */
- encoder->private_->is_ogg ? true :
+ /* We would like to be able to use 'samples > 0' in the
+ * clause here but currently because of the nature of our
+ * Ogg writing implementation, 'samples' is always 0 (see
+ * ogg_encoder_aspect.c). The downside is extra progress
+ * callbacks.
+ */
+ encoder->private_->is_ogg? true :
#endif
- samples > 0
- );
- if(call_it)
- {
- /* NOTE: We have to add +bytes, +samples, and +1 to the stats
- * because at this point in the callback chain, the stats
- * have not been updated. Only after we return and control
- * gets back to write_frame_() are the stats updated
- */
- encoder->private_->progress_callback(encoder, encoder->private_->bytes_written + bytes, encoder->private_->samples_written + samples, encoder->private_->frames_written + (samples ? 1 : 0), encoder->private_->total_frames_estimate, encoder->private_->client_data);
- }
- return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
- }
- else
- return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+ samples > 0
+ );
+ if(call_it) {
+ /* NOTE: We have to add +bytes, +samples, and +1 to the stats
+ * because at this point in the callback chain, the stats
+ * have not been updated. Only after we return and control
+ * gets back to write_frame_() are the stats updated
+ */
+ encoder->private_->progress_callback(encoder, encoder->private_->bytes_written+bytes, encoder->private_->samples_written+samples, encoder->private_->frames_written+(samples?1:0), encoder->private_->total_frames_estimate, encoder->private_->client_data);
+ }
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
+ }
+ else
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
}
/*
@@ -4662,18 +4331,18 @@ FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *e
*/
FILE *get_binary_stdout_(void)
{
- /* if something breaks here it is probably due to the presence or
- * absence of an underscore before the identifiers 'setmode',
- * 'fileno', and/or 'O_BINARY'; check your system header files.
- */
+ /* if something breaks here it is probably due to the presence or
+ * absence of an underscore before the identifiers 'setmode',
+ * 'fileno', and/or 'O_BINARY'; check your system header files.
+ */
#if defined _MSC_VER || defined __MINGW32__
- _setmode(_fileno(stdout), _O_BINARY);
+ _setmode(_fileno(stdout), _O_BINARY);
#elif defined __CYGWIN__
- /* almost certainly not needed for any modern Cygwin, but let's be safe... */
- setmode(_fileno(stdout), _O_BINARY);
+ /* almost certainly not needed for any modern Cygwin, but let's be safe... */
+ setmode(_fileno(stdout), _O_BINARY);
#elif defined __EMX__
- setmode(fileno(stdout), O_BINARY);
+ setmode(fileno(stdout), O_BINARY);
#endif
- return stdout;
+ return stdout;
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder_framing.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder_framing.c
index 72c1cf293..35fe9ba9d 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder_framing.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/stream_encoder_framing.c
@@ -49,590 +49,505 @@ static FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC
FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw)
{
- unsigned i, j;
- const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING);
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->is_last, FLAC__STREAM_METADATA_IS_LAST_LEN))
- return false;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->type, FLAC__STREAM_METADATA_TYPE_LEN))
- return false;
-
- /*
- * First, for VORBIS_COMMENTs, adjust the length to reflect our vendor string
- */
- i = metadata->length;
- if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT)
- {
- FLAC__ASSERT(metadata->data.vorbis_comment.vendor_string.length == 0 || 0 != metadata->data.vorbis_comment.vendor_string.entry);
- i -= metadata->data.vorbis_comment.vendor_string.length;
- i += vendor_string_length;
- }
- FLAC__ASSERT(i < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, i, FLAC__STREAM_METADATA_LENGTH_LEN))
- return false;
-
- switch(metadata->type)
- {
- case FLAC__METADATA_TYPE_STREAMINFO:
- FLAC__ASSERT(metadata->data.stream_info.min_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.min_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN))
- return false;
- FLAC__ASSERT(metadata->data.stream_info.max_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.max_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN))
- return false;
- FLAC__ASSERT(metadata->data.stream_info.min_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.min_framesize, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN))
- return false;
- FLAC__ASSERT(metadata->data.stream_info.max_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.max_framesize, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN))
- return false;
- FLAC__ASSERT(FLAC__format_sample_rate_is_valid(metadata->data.stream_info.sample_rate));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.sample_rate, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN))
- return false;
- FLAC__ASSERT(metadata->data.stream_info.channels > 0);
- FLAC__ASSERT(metadata->data.stream_info.channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.channels - 1, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN))
- return false;
- FLAC__ASSERT(metadata->data.stream_info.bits_per_sample > 0);
- FLAC__ASSERT(metadata->data.stream_info.bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.bits_per_sample - 1, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.stream_info.md5sum, 16))
- return false;
- break;
- case FLAC__METADATA_TYPE_PADDING:
- if(!FLAC__bitwriter_write_zeroes(bw, metadata->length * 8))
- return false;
- break;
- case FLAC__METADATA_TYPE_APPLICATION:
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.application.data, metadata->length - (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)))
- return false;
- break;
- case FLAC__METADATA_TYPE_SEEKTABLE:
- for(i = 0; i < metadata->data.seek_table.num_points; i++)
- {
- if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.seek_table.points[i].sample_number, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.seek_table.points[i].stream_offset, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.seek_table.points[i].frame_samples, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN))
- return false;
- }
- break;
- case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, vendor_string_length))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)FLAC__VENDOR_STRING, vendor_string_length))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.num_comments))
- return false;
- for(i = 0; i < metadata->data.vorbis_comment.num_comments; i++)
- {
- if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.comments[i].length))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.vorbis_comment.comments[i].entry, metadata->data.vorbis_comment.comments[i].length))
- return false;
- }
- break;
- case FLAC__METADATA_TYPE_CUESHEET:
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
- if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)metadata->data.cue_sheet.media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8))
- return false;
- if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.cue_sheet.lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.cue_sheet.is_cd ? 1 : 0, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN))
- return false;
- if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.cue_sheet.num_tracks, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN))
- return false;
- for(i = 0; i < metadata->data.cue_sheet.num_tracks; i++)
- {
- const FLAC__StreamMetadata_CueSheet_Track *track = metadata->data.cue_sheet.tracks + i;
-
- if(!FLAC__bitwriter_write_raw_uint64(bw, track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, track->number, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN))
- return false;
- FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
- if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, track->type, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, track->pre_emphasis, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN))
- return false;
- if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, track->num_indices, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN))
- return false;
- for(j = 0; j < track->num_indices; j++)
- {
- const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j;
-
- if(!FLAC__bitwriter_write_raw_uint64(bw, index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, index->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
- return false;
- if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN))
- return false;
- }
- }
- break;
- case FLAC__METADATA_TYPE_PICTURE:
- {
- size_t len;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.type, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
- return false;
- len = strlen(metadata->data.picture.mime_type);
- if(!FLAC__bitwriter_write_raw_uint32(bw, len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)metadata->data.picture.mime_type, len))
- return false;
- len = strlen((const char *)metadata->data.picture.description);
- if(!FLAC__bitwriter_write_raw_uint32(bw, len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.picture.description, len))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.height, FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.depth, FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.colors, FLAC__STREAM_METADATA_PICTURE_COLORS_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.data_length, FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
- return false;
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.picture.data, metadata->data.picture.data_length))
- return false;
- }
- break;
- default:
- if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.unknown.data, metadata->length))
- return false;
- break;
- }
-
- FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw));
- return true;
+ unsigned i, j;
+ const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING);
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->is_last, FLAC__STREAM_METADATA_IS_LAST_LEN))
+ return false;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->type, FLAC__STREAM_METADATA_TYPE_LEN))
+ return false;
+
+ /*
+ * First, for VORBIS_COMMENTs, adjust the length to reflect our vendor string
+ */
+ i = metadata->length;
+ if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+ FLAC__ASSERT(metadata->data.vorbis_comment.vendor_string.length == 0 || 0 != metadata->data.vorbis_comment.vendor_string.entry);
+ i -= metadata->data.vorbis_comment.vendor_string.length;
+ i += vendor_string_length;
+ }
+ FLAC__ASSERT(i < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, i, FLAC__STREAM_METADATA_LENGTH_LEN))
+ return false;
+
+ switch(metadata->type) {
+ case FLAC__METADATA_TYPE_STREAMINFO:
+ FLAC__ASSERT(metadata->data.stream_info.min_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.min_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN))
+ return false;
+ FLAC__ASSERT(metadata->data.stream_info.max_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.max_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN))
+ return false;
+ FLAC__ASSERT(metadata->data.stream_info.min_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.min_framesize, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN))
+ return false;
+ FLAC__ASSERT(metadata->data.stream_info.max_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.max_framesize, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN))
+ return false;
+ FLAC__ASSERT(FLAC__format_sample_rate_is_valid(metadata->data.stream_info.sample_rate));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.sample_rate, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN))
+ return false;
+ FLAC__ASSERT(metadata->data.stream_info.channels > 0);
+ FLAC__ASSERT(metadata->data.stream_info.channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.channels-1, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN))
+ return false;
+ FLAC__ASSERT(metadata->data.stream_info.bits_per_sample > 0);
+ FLAC__ASSERT(metadata->data.stream_info.bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.bits_per_sample-1, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.stream_info.md5sum, 16))
+ return false;
+ break;
+ case FLAC__METADATA_TYPE_PADDING:
+ if(!FLAC__bitwriter_write_zeroes(bw, metadata->length * 8))
+ return false;
+ break;
+ case FLAC__METADATA_TYPE_APPLICATION:
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.application.data, metadata->length - (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)))
+ return false;
+ break;
+ case FLAC__METADATA_TYPE_SEEKTABLE:
+ for(i = 0; i < metadata->data.seek_table.num_points; i++) {
+ if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.seek_table.points[i].sample_number, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.seek_table.points[i].stream_offset, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.seek_table.points[i].frame_samples, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN))
+ return false;
+ }
+ break;
+ case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+ if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, vendor_string_length))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)FLAC__VENDOR_STRING, vendor_string_length))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.num_comments))
+ return false;
+ for(i = 0; i < metadata->data.vorbis_comment.num_comments; i++) {
+ if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.comments[i].length))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.vorbis_comment.comments[i].entry, metadata->data.vorbis_comment.comments[i].length))
+ return false;
+ }
+ break;
+ case FLAC__METADATA_TYPE_CUESHEET:
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0);
+ if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)metadata->data.cue_sheet.media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN/8))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.cue_sheet.lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.cue_sheet.is_cd? 1 : 0, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.cue_sheet.num_tracks, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN))
+ return false;
+ for(i = 0; i < metadata->data.cue_sheet.num_tracks; i++) {
+ const FLAC__StreamMetadata_CueSheet_Track *track = metadata->data.cue_sheet.tracks + i;
+
+ if(!FLAC__bitwriter_write_raw_uint64(bw, track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, track->number, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN))
+ return false;
+ FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
+ if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, track->type, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, track->pre_emphasis, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, track->num_indices, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN))
+ return false;
+ for(j = 0; j < track->num_indices; j++) {
+ const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j;
+
+ if(!FLAC__bitwriter_write_raw_uint64(bw, index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, index->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN))
+ return false;
+ }
+ }
+ break;
+ case FLAC__METADATA_TYPE_PICTURE:
+ {
+ size_t len;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.type, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
+ return false;
+ len = strlen(metadata->data.picture.mime_type);
+ if(!FLAC__bitwriter_write_raw_uint32(bw, len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)metadata->data.picture.mime_type, len))
+ return false;
+ len = strlen((const char *)metadata->data.picture.description);
+ if(!FLAC__bitwriter_write_raw_uint32(bw, len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.picture.description, len))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.height, FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.depth, FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.colors, FLAC__STREAM_METADATA_PICTURE_COLORS_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.data_length, FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.picture.data, metadata->data.picture.data_length))
+ return false;
+ }
+ break;
+ default:
+ if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.unknown.data, metadata->length))
+ return false;
+ break;
+ }
+
+ FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw));
+ return true;
}
FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw)
{
- unsigned u, blocksize_hint, sample_rate_hint;
- FLAC__byte crc;
-
- FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw));
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__FRAME_HEADER_SYNC, FLAC__FRAME_HEADER_SYNC_LEN))
- return false;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, 0, FLAC__FRAME_HEADER_RESERVED_LEN))
- return false;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, (header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER) ? 0 : 1, FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN))
- return false;
-
- FLAC__ASSERT(header->blocksize > 0 && header->blocksize <= FLAC__MAX_BLOCK_SIZE);
- /* when this assertion holds true, any legal blocksize can be expressed in the frame header */
- FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535u);
- blocksize_hint = 0;
- switch(header->blocksize)
- {
- case 192:
- u = 1;
- break;
- case 576:
- u = 2;
- break;
- case 1152:
- u = 3;
- break;
- case 2304:
- u = 4;
- break;
- case 4608:
- u = 5;
- break;
- case 256:
- u = 8;
- break;
- case 512:
- u = 9;
- break;
- case 1024:
- u = 10;
- break;
- case 2048:
- u = 11;
- break;
- case 4096:
- u = 12;
- break;
- case 8192:
- u = 13;
- break;
- case 16384:
- u = 14;
- break;
- case 32768:
- u = 15;
- break;
- default:
- if(header->blocksize <= 0x100)
- blocksize_hint = u = 6;
- else
- blocksize_hint = u = 7;
- break;
- }
- if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_BLOCK_SIZE_LEN))
- return false;
-
- FLAC__ASSERT(FLAC__format_sample_rate_is_valid(header->sample_rate));
- sample_rate_hint = 0;
- switch(header->sample_rate)
- {
- case 88200:
- u = 1;
- break;
- case 176400:
- u = 2;
- break;
- case 192000:
- u = 3;
- break;
- case 8000:
- u = 4;
- break;
- case 16000:
- u = 5;
- break;
- case 22050:
- u = 6;
- break;
- case 24000:
- u = 7;
- break;
- case 32000:
- u = 8;
- break;
- case 44100:
- u = 9;
- break;
- case 48000:
- u = 10;
- break;
- case 96000:
- u = 11;
- break;
- default:
- if(header->sample_rate <= 255000 && header->sample_rate % 1000 == 0)
- sample_rate_hint = u = 12;
- else if(header->sample_rate % 10 == 0)
- sample_rate_hint = u = 14;
- else if(header->sample_rate <= 0xffff)
- sample_rate_hint = u = 13;
- else
- u = 0;
- break;
- }
- if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_SAMPLE_RATE_LEN))
- return false;
-
- FLAC__ASSERT(header->channels > 0 && header->channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN) && header->channels <= FLAC__MAX_CHANNELS);
- switch(header->channel_assignment)
- {
- case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
- u = header->channels - 1;
- break;
- case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
- FLAC__ASSERT(header->channels == 2);
- u = 8;
- break;
- case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
- FLAC__ASSERT(header->channels == 2);
- u = 9;
- break;
- case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
- FLAC__ASSERT(header->channels == 2);
- u = 10;
- break;
- default:
- FLAC__ASSERT(0);
- }
- if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN))
- return false;
-
- FLAC__ASSERT(header->bits_per_sample > 0 && header->bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
- switch(header->bits_per_sample)
- {
- case 8 :
- u = 1;
- break;
- case 12:
- u = 2;
- break;
- case 16:
- u = 4;
- break;
- case 20:
- u = 5;
- break;
- case 24:
- u = 6;
- break;
- default:
- u = 0;
- break;
- }
- if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN))
- return false;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, 0, FLAC__FRAME_HEADER_ZERO_PAD_LEN))
- return false;
-
- if(header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER)
- {
- if(!FLAC__bitwriter_write_utf8_uint32(bw, header->number.frame_number))
- return false;
- }
- else
- {
- if(!FLAC__bitwriter_write_utf8_uint64(bw, header->number.sample_number))
- return false;
- }
-
- if(blocksize_hint)
- if(!FLAC__bitwriter_write_raw_uint32(bw, header->blocksize - 1, (blocksize_hint == 6) ? 8 : 16))
- return false;
-
- switch(sample_rate_hint)
- {
- case 12:
- if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate / 1000, 8))
- return false;
- break;
- case 13:
- if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate, 16))
- return false;
- break;
- case 14:
- if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate / 10, 16))
- return false;
- break;
- }
-
- /* write the CRC */
- if(!FLAC__bitwriter_get_write_crc8(bw, &crc))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, crc, FLAC__FRAME_HEADER_CRC_LEN))
- return false;
-
- return true;
+ unsigned u, blocksize_hint, sample_rate_hint;
+ FLAC__byte crc;
+
+ FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw));
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__FRAME_HEADER_SYNC, FLAC__FRAME_HEADER_SYNC_LEN))
+ return false;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, 0, FLAC__FRAME_HEADER_RESERVED_LEN))
+ return false;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, (header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER)? 0 : 1, FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN))
+ return false;
+
+ FLAC__ASSERT(header->blocksize > 0 && header->blocksize <= FLAC__MAX_BLOCK_SIZE);
+ /* when this assertion holds true, any legal blocksize can be expressed in the frame header */
+ FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535u);
+ blocksize_hint = 0;
+ switch(header->blocksize) {
+ case 192: u = 1; break;
+ case 576: u = 2; break;
+ case 1152: u = 3; break;
+ case 2304: u = 4; break;
+ case 4608: u = 5; break;
+ case 256: u = 8; break;
+ case 512: u = 9; break;
+ case 1024: u = 10; break;
+ case 2048: u = 11; break;
+ case 4096: u = 12; break;
+ case 8192: u = 13; break;
+ case 16384: u = 14; break;
+ case 32768: u = 15; break;
+ default:
+ if(header->blocksize <= 0x100)
+ blocksize_hint = u = 6;
+ else
+ blocksize_hint = u = 7;
+ break;
+ }
+ if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_BLOCK_SIZE_LEN))
+ return false;
+
+ FLAC__ASSERT(FLAC__format_sample_rate_is_valid(header->sample_rate));
+ sample_rate_hint = 0;
+ switch(header->sample_rate) {
+ case 88200: u = 1; break;
+ case 176400: u = 2; break;
+ case 192000: u = 3; break;
+ case 8000: u = 4; break;
+ case 16000: u = 5; break;
+ case 22050: u = 6; break;
+ case 24000: u = 7; break;
+ case 32000: u = 8; break;
+ case 44100: u = 9; break;
+ case 48000: u = 10; break;
+ case 96000: u = 11; break;
+ default:
+ if(header->sample_rate <= 255000 && header->sample_rate % 1000 == 0)
+ sample_rate_hint = u = 12;
+ else if(header->sample_rate % 10 == 0)
+ sample_rate_hint = u = 14;
+ else if(header->sample_rate <= 0xffff)
+ sample_rate_hint = u = 13;
+ else
+ u = 0;
+ break;
+ }
+ if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_SAMPLE_RATE_LEN))
+ return false;
+
+ FLAC__ASSERT(header->channels > 0 && header->channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN) && header->channels <= FLAC__MAX_CHANNELS);
+ switch(header->channel_assignment) {
+ case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
+ u = header->channels - 1;
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
+ FLAC__ASSERT(header->channels == 2);
+ u = 8;
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
+ FLAC__ASSERT(header->channels == 2);
+ u = 9;
+ break;
+ case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
+ FLAC__ASSERT(header->channels == 2);
+ u = 10;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+ if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN))
+ return false;
+
+ FLAC__ASSERT(header->bits_per_sample > 0 && header->bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
+ switch(header->bits_per_sample) {
+ case 8 : u = 1; break;
+ case 12: u = 2; break;
+ case 16: u = 4; break;
+ case 20: u = 5; break;
+ case 24: u = 6; break;
+ default: u = 0; break;
+ }
+ if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN))
+ return false;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, 0, FLAC__FRAME_HEADER_ZERO_PAD_LEN))
+ return false;
+
+ if(header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER) {
+ if(!FLAC__bitwriter_write_utf8_uint32(bw, header->number.frame_number))
+ return false;
+ }
+ else {
+ if(!FLAC__bitwriter_write_utf8_uint64(bw, header->number.sample_number))
+ return false;
+ }
+
+ if(blocksize_hint)
+ if(!FLAC__bitwriter_write_raw_uint32(bw, header->blocksize-1, (blocksize_hint==6)? 8:16))
+ return false;
+
+ switch(sample_rate_hint) {
+ case 12:
+ if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate / 1000, 8))
+ return false;
+ break;
+ case 13:
+ if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate, 16))
+ return false;
+ break;
+ case 14:
+ if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate / 10, 16))
+ return false;
+ break;
+ }
+
+ /* write the CRC */
+ if(!FLAC__bitwriter_get_write_crc8(bw, &crc))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, crc, FLAC__FRAME_HEADER_CRC_LEN))
+ return false;
+
+ return true;
}
FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw)
{
- FLAC__bool ok;
+ FLAC__bool ok;
- ok =
- FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK | (wasted_bits ? 1 : 0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN) &&
- (wasted_bits ? FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits - 1) : true) &&
- FLAC__bitwriter_write_raw_int32(bw, subframe->value, subframe_bps)
- ;
+ ok =
+ FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN) &&
+ (wasted_bits? FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits-1) : true) &&
+ FLAC__bitwriter_write_raw_int32(bw, subframe->value, subframe_bps)
+ ;
- return ok;
+ return ok;
}
FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw)
{
- unsigned i;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK | (subframe->order << 1) | (wasted_bits ? 1 : 0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN))
- return false;
- if(wasted_bits)
- if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits - 1))
- return false;
-
- for(i = 0; i < subframe->order; i++)
- if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps))
- return false;
-
- if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method))
- return false;
- switch(subframe->entropy_coding_method.type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!add_residual_partitioned_rice_(
- bw,
- subframe->residual,
- residual_samples,
- subframe->order,
- subframe->entropy_coding_method.data.partitioned_rice.contents->parameters,
- subframe->entropy_coding_method.data.partitioned_rice.contents->raw_bits,
- subframe->entropy_coding_method.data.partitioned_rice.order,
- /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2
- ))
- return false;
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- return true;
+ unsigned i;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK | (subframe->order<<1) | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN))
+ return false;
+ if(wasted_bits)
+ if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits-1))
+ return false;
+
+ for(i = 0; i < subframe->order; i++)
+ if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps))
+ return false;
+
+ if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method))
+ return false;
+ switch(subframe->entropy_coding_method.type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!add_residual_partitioned_rice_(
+ bw,
+ subframe->residual,
+ residual_samples,
+ subframe->order,
+ subframe->entropy_coding_method.data.partitioned_rice.contents->parameters,
+ subframe->entropy_coding_method.data.partitioned_rice.contents->raw_bits,
+ subframe->entropy_coding_method.data.partitioned_rice.order,
+ /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2
+ ))
+ return false;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ return true;
}
FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw)
{
- unsigned i;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK | ((subframe->order - 1) << 1) | (wasted_bits ? 1 : 0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN))
- return false;
- if(wasted_bits)
- if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits - 1))
- return false;
-
- for(i = 0; i < subframe->order; i++)
- if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps))
- return false;
-
- if(!FLAC__bitwriter_write_raw_uint32(bw, subframe->qlp_coeff_precision - 1, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN))
- return false;
- if(!FLAC__bitwriter_write_raw_int32(bw, subframe->quantization_level, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN))
- return false;
- for(i = 0; i < subframe->order; i++)
- if(!FLAC__bitwriter_write_raw_int32(bw, subframe->qlp_coeff[i], subframe->qlp_coeff_precision))
- return false;
-
- if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method))
- return false;
- switch(subframe->entropy_coding_method.type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!add_residual_partitioned_rice_(
- bw,
- subframe->residual,
- residual_samples,
- subframe->order,
- subframe->entropy_coding_method.data.partitioned_rice.contents->parameters,
- subframe->entropy_coding_method.data.partitioned_rice.contents->raw_bits,
- subframe->entropy_coding_method.data.partitioned_rice.order,
- /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2
- ))
- return false;
- break;
- default:
- FLAC__ASSERT(0);
- }
-
- return true;
+ unsigned i;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK | ((subframe->order-1)<<1) | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN))
+ return false;
+ if(wasted_bits)
+ if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits-1))
+ return false;
+
+ for(i = 0; i < subframe->order; i++)
+ if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps))
+ return false;
+
+ if(!FLAC__bitwriter_write_raw_uint32(bw, subframe->qlp_coeff_precision-1, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN))
+ return false;
+ if(!FLAC__bitwriter_write_raw_int32(bw, subframe->quantization_level, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN))
+ return false;
+ for(i = 0; i < subframe->order; i++)
+ if(!FLAC__bitwriter_write_raw_int32(bw, subframe->qlp_coeff[i], subframe->qlp_coeff_precision))
+ return false;
+
+ if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method))
+ return false;
+ switch(subframe->entropy_coding_method.type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!add_residual_partitioned_rice_(
+ bw,
+ subframe->residual,
+ residual_samples,
+ subframe->order,
+ subframe->entropy_coding_method.data.partitioned_rice.contents->parameters,
+ subframe->entropy_coding_method.data.partitioned_rice.contents->raw_bits,
+ subframe->entropy_coding_method.data.partitioned_rice.order,
+ /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2
+ ))
+ return false;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+
+ return true;
}
FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw)
{
- unsigned i;
- const FLAC__int32 *signal = subframe->data;
+ unsigned i;
+ const FLAC__int32 *signal = subframe->data;
- if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK | (wasted_bits ? 1 : 0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN))
- return false;
- if(wasted_bits)
- if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits - 1))
- return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN))
+ return false;
+ if(wasted_bits)
+ if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits-1))
+ return false;
- for(i = 0; i < samples; i++)
- if(!FLAC__bitwriter_write_raw_int32(bw, signal[i], subframe_bps))
- return false;
+ for(i = 0; i < samples; i++)
+ if(!FLAC__bitwriter_write_raw_int32(bw, signal[i], subframe_bps))
+ return false;
- return true;
+ return true;
}
FLAC__bool add_entropy_coding_method_(FLAC__BitWriter *bw, const FLAC__EntropyCodingMethod *method)
{
- if(!FLAC__bitwriter_write_raw_uint32(bw, method->type, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN))
- return false;
- switch(method->type)
- {
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
- case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
- if(!FLAC__bitwriter_write_raw_uint32(bw, method->data.partitioned_rice.order, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
- return false;
- break;
- default:
- FLAC__ASSERT(0);
- }
- return true;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, method->type, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN))
+ return false;
+ switch(method->type) {
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
+ case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2:
+ if(!FLAC__bitwriter_write_raw_uint32(bw, method->data.partitioned_rice.order, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN))
+ return false;
+ break;
+ default:
+ FLAC__ASSERT(0);
+ }
+ return true;
}
FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order, const FLAC__bool is_extended)
{
- const unsigned plen = is_extended ? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN;
- const unsigned pesc = is_extended ? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
-
- if(partition_order == 0)
- {
- unsigned i;
-
- if(raw_bits[0] == 0)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, rice_parameters[0], plen))
- return false;
- if(!FLAC__bitwriter_write_rice_signed_block(bw, residual, residual_samples, rice_parameters[0]))
- return false;
- }
- else
- {
- FLAC__ASSERT(rice_parameters[0] == 0);
- if(!FLAC__bitwriter_write_raw_uint32(bw, pesc, plen))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, raw_bits[0], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN))
- return false;
- for(i = 0; i < residual_samples; i++)
- {
- if(!FLAC__bitwriter_write_raw_int32(bw, residual[i], raw_bits[0]))
- return false;
- }
- }
- return true;
- }
- else
- {
- unsigned i, j, k = 0, k_last = 0;
- unsigned partition_samples;
- const unsigned default_partition_samples = (residual_samples + predictor_order) >> partition_order;
- for(i = 0; i < (1u << partition_order); i++)
- {
- partition_samples = default_partition_samples;
- if(i == 0)
- partition_samples -= predictor_order;
- k += partition_samples;
- if(raw_bits[i] == 0)
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, rice_parameters[i], plen))
- return false;
- if(!FLAC__bitwriter_write_rice_signed_block(bw, residual + k_last, k - k_last, rice_parameters[i]))
- return false;
- }
- else
- {
- if(!FLAC__bitwriter_write_raw_uint32(bw, pesc, plen))
- return false;
- if(!FLAC__bitwriter_write_raw_uint32(bw, raw_bits[i], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN))
- return false;
- for(j = k_last; j < k; j++)
- {
- if(!FLAC__bitwriter_write_raw_int32(bw, residual[j], raw_bits[i]))
- return false;
- }
- }
- k_last = k;
- }
- return true;
- }
+ const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN;
+ const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+
+ if(partition_order == 0) {
+ unsigned i;
+
+ if(raw_bits[0] == 0) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, rice_parameters[0], plen))
+ return false;
+ if(!FLAC__bitwriter_write_rice_signed_block(bw, residual, residual_samples, rice_parameters[0]))
+ return false;
+ }
+ else {
+ FLAC__ASSERT(rice_parameters[0] == 0);
+ if(!FLAC__bitwriter_write_raw_uint32(bw, pesc, plen))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, raw_bits[0], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN))
+ return false;
+ for(i = 0; i < residual_samples; i++) {
+ if(!FLAC__bitwriter_write_raw_int32(bw, residual[i], raw_bits[0]))
+ return false;
+ }
+ }
+ return true;
+ }
+ else {
+ unsigned i, j, k = 0, k_last = 0;
+ unsigned partition_samples;
+ const unsigned default_partition_samples = (residual_samples+predictor_order) >> partition_order;
+ for(i = 0; i < (1u<<partition_order); i++) {
+ partition_samples = default_partition_samples;
+ if(i == 0)
+ partition_samples -= predictor_order;
+ k += partition_samples;
+ if(raw_bits[i] == 0) {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, rice_parameters[i], plen))
+ return false;
+ if(!FLAC__bitwriter_write_rice_signed_block(bw, residual+k_last, k-k_last, rice_parameters[i]))
+ return false;
+ }
+ else {
+ if(!FLAC__bitwriter_write_raw_uint32(bw, pesc, plen))
+ return false;
+ if(!FLAC__bitwriter_write_raw_uint32(bw, raw_bits[i], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN))
+ return false;
+ for(j = k_last; j < k; j++) {
+ if(!FLAC__bitwriter_write_raw_int32(bw, residual[j], raw_bits[i]))
+ return false;
+ }
+ }
+ k_last = k;
+ }
+ return true;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/window.c b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/window.c
index f39d0bb10..56d31c6d3 100644
--- a/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/window.c
+++ b/src/filters/transform/MpaDecFilter/libflac/src/libFLAC/window.c
@@ -48,188 +48,178 @@
void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
-
- if(L & 1)
- {
- for(n = 0; n <= N / 2; n++)
- window[n] = 2.0f * n / (float)N;
- for(; n <= N; n++)
- window[n] = 2.0f - 2.0f * n / (float)N;
- }
- else
- {
- for(n = 0; n <= L / 2 - 1; n++)
- window[n] = 2.0f * n / (float)N;
- for(; n <= N; n++)
- window[n] = 2.0f - 2.0f * (N - n) / (float)N;
- }
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
+
+ if (L & 1) {
+ for (n = 0; n <= N/2; n++)
+ window[n] = 2.0f * n / (float)N;
+ for (; n <= N; n++)
+ window[n] = 2.0f - 2.0f * n / (float)N;
+ }
+ else {
+ for (n = 0; n <= L/2-1; n++)
+ window[n] = 2.0f * n / (float)N;
+ for (; n <= N; n++)
+ window[n] = 2.0f - 2.0f * (N-n) / (float)N;
+ }
}
void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n / (float)N + 0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n / (float)N + 0.5f)));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f)));
}
void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N));
}
/* 4-term -92dB side-lobe */
void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n <= N; n++)
- window[n] = (FLAC__real)(0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N));
+ for (n = 0; n <= N; n++)
+ window[n] = (FLAC__real)(0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N));
}
void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- const double N2 = (double)N / 2.;
- FLAC__int32 n;
-
- for(n = 0; n <= N; n++)
- {
- double k = ((double)n - N2) / N2;
- k = 1.0f - k * k;
- window[n] = (FLAC__real)(k * k);
- }
+ const FLAC__int32 N = L - 1;
+ const double N2 = (double)N / 2.;
+ FLAC__int32 n;
+
+ for (n = 0; n <= N; n++) {
+ double k = ((double)n - N2) / N2;
+ k = 1.0f - k * k;
+ window[n] = (FLAC__real)(k * k);
+ }
}
void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N));
}
void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev)
{
- const FLAC__int32 N = L - 1;
- const double N2 = (double)N / 2.;
- FLAC__int32 n;
-
- for(n = 0; n <= N; n++)
- {
- const double k = ((double)n - N2) / (stddev * N2);
- window[n] = (FLAC__real)exp(-0.5f * k * k);
- }
+ const FLAC__int32 N = L - 1;
+ const double N2 = (double)N / 2.;
+ FLAC__int32 n;
+
+ for (n = 0; n <= N; n++) {
+ const double k = ((double)n - N2) / (stddev * N2);
+ window[n] = (FLAC__real)exp(-0.5f * k * k);
+ }
}
void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(0.54f - 0.46f * cos(2.0f * M_PI * n / N));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(0.54f - 0.46f * cos(2.0f * M_PI * n / N));
}
void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(0.5f - 0.5f * cos(2.0f * M_PI * n / N));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(0.5f - 0.5f * cos(2.0f * M_PI * n / N));
}
void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N));
}
void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- FLAC__int32 n;
+ const FLAC__int32 N = L - 1;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = (FLAC__real)(0.3635819f - 0.4891775f * cos(2.0f * M_PI * n / N) + 0.1365995f * cos(4.0f * M_PI * n / N) - 0.0106411f * cos(6.0f * M_PI * n / N));
+ for (n = 0; n < L; n++)
+ window[n] = (FLAC__real)(0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N));
}
void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L)
{
- FLAC__int32 n;
+ FLAC__int32 n;
- for(n = 0; n < L; n++)
- window[n] = 1.0f;
+ for (n = 0; n < L; n++)
+ window[n] = 1.0f;
}
void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L)
{
- FLAC__int32 n;
-
- if(L & 1)
- {
- for(n = 1; n <= L + 1 / 2; n++)
- window[n-1] = 2.0f * n / ((float)L + 1.0f);
- for(; n <= L; n++)
- window[n-1] = - (float)(2 * (L - n + 1)) / ((float)L + 1.0f);
- }
- else
- {
- for(n = 1; n <= L / 2; n++)
- window[n-1] = 2.0f * n / (float)L;
- for(; n <= L; n++)
- window[n-1] = ((float)(2 * (L - n)) + 1.0f) / (float)L;
- }
+ FLAC__int32 n;
+
+ if (L & 1) {
+ for (n = 1; n <= L+1/2; n++)
+ window[n-1] = 2.0f * n / ((float)L + 1.0f);
+ for (; n <= L; n++)
+ window[n-1] = - (float)(2 * (L - n + 1)) / ((float)L + 1.0f);
+ }
+ else {
+ for (n = 1; n <= L/2; n++)
+ window[n-1] = 2.0f * n / (float)L;
+ for (; n <= L; n++)
+ window[n-1] = ((float)(2 * (L - n)) + 1.0f) / (float)L;
+ }
}
void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p)
{
- if(p <= 0.0)
- FLAC__window_rectangle(window, L);
- else if(p >= 1.0)
- FLAC__window_hann(window, L);
- else
- {
- const FLAC__int32 Np = (FLAC__int32)(p / 2.0f * L) - 1;
- FLAC__int32 n;
- /* start with rectangle... */
- FLAC__window_rectangle(window, L);
- /* ...replace ends with hann */
- if(Np > 0)
- {
- for(n = 0; n <= Np; n++)
- {
- window[n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * n / Np));
- window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * (n + Np) / Np));
- }
- }
- }
+ if (p <= 0.0)
+ FLAC__window_rectangle(window, L);
+ else if (p >= 1.0)
+ FLAC__window_hann(window, L);
+ else {
+ const FLAC__int32 Np = (FLAC__int32)(p / 2.0f * L) - 1;
+ FLAC__int32 n;
+ /* start with rectangle... */
+ FLAC__window_rectangle(window, L);
+ /* ...replace ends with hann */
+ if (Np > 0) {
+ for (n = 0; n <= Np; n++) {
+ window[n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * n / Np));
+ window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * (n+Np) / Np));
+ }
+ }
+ }
}
void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L)
{
- const FLAC__int32 N = L - 1;
- const double N2 = (double)N / 2.;
- FLAC__int32 n;
-
- for(n = 0; n <= N; n++)
- {
- const double k = ((double)n - N2) / N2;
- window[n] = (FLAC__real)(1.0f - k * k);
- }
+ const FLAC__int32 N = L - 1;
+ const double N2 = (double)N / 2.;
+ FLAC__int32 n;
+
+ for (n = 0; n <= N; n++) {
+ const double k = ((double)n - N2) / N2;
+ window[n] = (FLAC__real)(1.0f - k * k);
+ }
}
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
diff --git a/src/filters/transform/MpaDecFilter/libmad/bit.c b/src/filters/transform/MpaDecFilter/libmad/bit.c
index 2c28d7f9c..c75d54df1 100644
--- a/src/filters/transform/MpaDecFilter/libmad/bit.c
+++ b/src/filters/transform/MpaDecFilter/libmad/bit.c
@@ -40,43 +40,42 @@
* G(X) = X^16 + X^15 + X^2 + 1
*/
static
-unsigned short const crc_table[256] =
-{
- 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
- 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
- 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
- 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
- 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
- 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
- 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
- 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
-
- 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
- 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
- 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
- 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
- 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
- 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
- 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
- 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
-
- 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
- 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
- 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
- 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
- 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
- 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
- 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
- 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
-
- 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
- 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
- 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
- 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
- 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
- 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
- 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
- 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
+unsigned short const crc_table[256] = {
+ 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
+ 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
+ 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
+ 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
+ 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
+ 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
+ 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
+ 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
+
+ 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
+ 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
+ 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
+ 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
+ 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
+ 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
+ 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
+ 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
+
+ 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
+ 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
+ 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
+ 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
+ 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
+ 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
+ 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
+ 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
+
+ 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
+ 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
+ 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
+ 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
+ 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
+ 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
+ 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
+ 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
};
# define CRC_POLY 0x8005
@@ -87,9 +86,9 @@ unsigned short const crc_table[256] =
*/
void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte)
{
- bitptr->byte = byte;
- bitptr->cache = 0;
- bitptr->left = CHAR_BIT;
+ bitptr->byte = byte;
+ bitptr->cache = 0;
+ bitptr->left = CHAR_BIT;
}
/*
@@ -97,10 +96,10 @@ void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte)
* DESCRIPTION: return number of bits between start and end points
*/
unsigned int mad_bit_length(struct mad_bitptr const *begin,
- struct mad_bitptr const *end)
+ struct mad_bitptr const *end)
{
- return begin->left +
- CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left);
+ return begin->left +
+ CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left);
}
/*
@@ -109,7 +108,7 @@ unsigned int mad_bit_length(struct mad_bitptr const *begin,
*/
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr)
{
- return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1;
+ return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1;
}
/*
@@ -118,17 +117,16 @@ unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr)
*/
void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len)
{
- bitptr->byte += len / CHAR_BIT;
- bitptr->left -= len % CHAR_BIT;
+ bitptr->byte += len / CHAR_BIT;
+ bitptr->left -= len % CHAR_BIT;
- if(bitptr->left > CHAR_BIT)
- {
- bitptr->byte++;
- bitptr->left += CHAR_BIT;
- }
+ if (bitptr->left > CHAR_BIT) {
+ bitptr->byte++;
+ bitptr->left += CHAR_BIT;
+ }
- if(bitptr->left < CHAR_BIT)
- bitptr->cache = *bitptr->byte;
+ if (bitptr->left < CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
}
/*
@@ -137,45 +135,42 @@ void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len)
*/
unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len)
{
- register unsigned long value;
+ register unsigned long value;
- if(bitptr->left == CHAR_BIT)
- bitptr->cache = *bitptr->byte;
+ if (bitptr->left == CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
- if(len < bitptr->left)
- {
- value = (bitptr->cache & ((1 << bitptr->left) - 1)) >>
- (bitptr->left - len);
- bitptr->left -= len;
+ if (len < bitptr->left) {
+ value = (bitptr->cache & ((1 << bitptr->left) - 1)) >>
+ (bitptr->left - len);
+ bitptr->left -= len;
- return value;
- }
+ return value;
+ }
- /* remaining bits in current byte */
+ /* remaining bits in current byte */
- value = bitptr->cache & ((1 << bitptr->left) - 1);
- len -= bitptr->left;
+ value = bitptr->cache & ((1 << bitptr->left) - 1);
+ len -= bitptr->left;
- bitptr->byte++;
- bitptr->left = CHAR_BIT;
+ bitptr->byte++;
+ bitptr->left = CHAR_BIT;
- /* more bytes */
+ /* more bytes */
- while(len >= CHAR_BIT)
- {
- value = (value << CHAR_BIT) | *bitptr->byte++;
- len -= CHAR_BIT;
- }
+ while (len >= CHAR_BIT) {
+ value = (value << CHAR_BIT) | *bitptr->byte++;
+ len -= CHAR_BIT;
+ }
- if(len > 0)
- {
- bitptr->cache = *bitptr->byte;
+ if (len > 0) {
+ bitptr->cache = *bitptr->byte;
- value = (value << len) | (bitptr->cache >> (CHAR_BIT - len));
- bitptr->left -= len;
- }
+ value = (value << len) | (bitptr->cache >> (CHAR_BIT - len));
+ bitptr->left -= len;
+ }
- return value;
+ return value;
}
# if 0
@@ -184,13 +179,13 @@ unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len)
* DESCRIPTION: write an arbitrary number of bits
*/
void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len,
- unsigned long value)
+ unsigned long value)
{
- unsigned char *ptr;
+ unsigned char *ptr;
- ptr = (unsigned char *) bitptr->byte;
+ ptr = (unsigned char *) bitptr->byte;
- /* ... */
+ /* ... */
}
# endif
@@ -199,50 +194,43 @@ void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len,
* DESCRIPTION: compute CRC-check word
*/
unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len,
- unsigned short init)
+ unsigned short init)
{
- register unsigned int crc;
-
- for(crc = init; len >= 32; len -= 32)
- {
- register unsigned long data;
-
- data = mad_bit_read(&bitptr, 32);
-
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 24)) & 0xff];
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 16)) & 0xff];
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 8)) & 0xff];
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 0)) & 0xff];
- }
-
- switch(len / 8)
- {
- case 3:
- crc = (crc << 8) ^
- crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
- case 2:
- crc = (crc << 8) ^
- crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
- case 1:
- crc = (crc << 8) ^
- crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
-
- len %= 8;
-
- case 0:
- break;
- }
-
- while(len--)
- {
- register unsigned int msb;
-
- msb = mad_bit_read(&bitptr, 1) ^(crc >> 15);
-
- crc <<= 1;
- if(msb & 1)
- crc ^= CRC_POLY;
- }
-
- return crc & 0xffff;
+ register unsigned int crc;
+
+ for (crc = init; len >= 32; len -= 32) {
+ register unsigned long data;
+
+ data = mad_bit_read(&bitptr, 32);
+
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff];
+ }
+
+ switch (len / 8) {
+ case 3: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 2: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 1: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+
+ len %= 8;
+
+ case 0: break;
+ }
+
+ while (len--) {
+ register unsigned int msb;
+
+ msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15);
+
+ crc <<= 1;
+ if (msb & 1)
+ crc ^= CRC_POLY;
+ }
+
+ return crc & 0xffff;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/bit.h b/src/filters/transform/MpaDecFilter/libmad/bit.h
index 33a8eb4a5..4d61b4f70 100644
--- a/src/filters/transform/MpaDecFilter/libmad/bit.h
+++ b/src/filters/transform/MpaDecFilter/libmad/bit.h
@@ -21,11 +21,10 @@
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
-struct mad_bitptr
-{
- unsigned char const *byte;
- unsigned short cache;
- unsigned short left;
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
};
void mad_bit_init(struct mad_bitptr *, unsigned char const *);
@@ -33,7 +32,7 @@ void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
unsigned int mad_bit_length(struct mad_bitptr const *,
- struct mad_bitptr const *);
+ struct mad_bitptr const *);
# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/decoder.c b/src/filters/transform/MpaDecFilter/libmad/decoder.c
index 136457dfa..b42c861fe 100644
--- a/src/filters/transform/MpaDecFilter/libmad/decoder.c
+++ b/src/filters/transform/MpaDecFilter/libmad/decoder.c
@@ -56,504 +56,472 @@
* DESCRIPTION: initialize a decoder object with callback routines
*/
void mad_decoder_init(struct mad_decoder *decoder, void *data,
- enum mad_flow(*input_func)(void *,
- struct mad_stream *),
- enum mad_flow(*header_func)(void *,
- struct mad_header const *),
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*output_func)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*error_func)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*message_func)(void *,
- void *, unsigned int *))
+ enum mad_flow (*input_func)(void *,
+ struct mad_stream *),
+ enum mad_flow (*header_func)(void *,
+ struct mad_header const *),
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*error_func)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*message_func)(void *,
+ void *, unsigned int *))
{
- decoder->mode = -1;
+ decoder->mode = -1;
- decoder->options = 0;
+ decoder->options = 0;
- decoder->async.pid = 0;
- decoder->async.in = -1;
- decoder->async.out = -1;
+ decoder->async.pid = 0;
+ decoder->async.in = -1;
+ decoder->async.out = -1;
- decoder->sync = 0;
+ decoder->sync = 0;
- decoder->cb_data = data;
+ decoder->cb_data = data;
- decoder->input_func = input_func;
- decoder->header_func = header_func;
- decoder->filter_func = filter_func;
- decoder->output_func = output_func;
- decoder->error_func = error_func;
- decoder->message_func = message_func;
+ decoder->input_func = input_func;
+ decoder->header_func = header_func;
+ decoder->filter_func = filter_func;
+ decoder->output_func = output_func;
+ decoder->error_func = error_func;
+ decoder->message_func = message_func;
}
int mad_decoder_finish(struct mad_decoder *decoder)
{
# if defined(USE_ASYNC)
- if(decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid)
- {
- pid_t pid;
- int status;
+ if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) {
+ pid_t pid;
+ int status;
- close(decoder->async.in);
+ close(decoder->async.in);
- do
- pid = waitpid(decoder->async.pid, &status, 0);
- while(pid == -1 && errno == EINTR);
+ do
+ pid = waitpid(decoder->async.pid, &status, 0);
+ while (pid == -1 && errno == EINTR);
- decoder->mode = -1;
+ decoder->mode = -1;
- close(decoder->async.out);
+ close(decoder->async.out);
- decoder->async.pid = 0;
- decoder->async.in = -1;
- decoder->async.out = -1;
+ decoder->async.pid = 0;
+ decoder->async.in = -1;
+ decoder->async.out = -1;
- if(pid == -1)
- return -1;
+ if (pid == -1)
+ return -1;
- return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0;
- }
+ return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0;
+ }
# endif
- return 0;
+ return 0;
}
# if defined(USE_ASYNC)
static
enum mad_flow send_io(int fd, void const *data, size_t len)
{
- char const *ptr = data;
- ssize_t count;
+ char const *ptr = data;
+ ssize_t count;
- while(len)
- {
- do
- count = write(fd, ptr, len);
- while(count == -1 && errno == EINTR);
+ while (len) {
+ do
+ count = write(fd, ptr, len);
+ while (count == -1 && errno == EINTR);
- if(count == -1)
- return MAD_FLOW_BREAK;
+ if (count == -1)
+ return MAD_FLOW_BREAK;
- len -= count;
- ptr += count;
- }
+ len -= count;
+ ptr += count;
+ }
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
static
enum mad_flow receive_io(int fd, void *buffer, size_t len)
{
- char *ptr = buffer;
- ssize_t count;
-
- while(len)
- {
- do
- count = read(fd, ptr, len);
- while(count == -1 && errno == EINTR);
-
- if(count == -1)
- return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK;
- else if(count == 0)
- return MAD_FLOW_STOP;
-
- len -= count;
- ptr += count;
- }
+ char *ptr = buffer;
+ ssize_t count;
- return MAD_FLOW_CONTINUE;
+ while (len) {
+ do
+ count = read(fd, ptr, len);
+ while (count == -1 && errno == EINTR);
+
+ if (count == -1)
+ return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK;
+ else if (count == 0)
+ return MAD_FLOW_STOP;
+
+ len -= count;
+ ptr += count;
+ }
+
+ return MAD_FLOW_CONTINUE;
}
static
enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len)
{
- int flags, blocking;
- enum mad_flow result;
+ int flags, blocking;
+ enum mad_flow result;
- flags = fcntl(fd, F_GETFL);
- if(flags == -1)
- return MAD_FLOW_BREAK;
+ flags = fcntl(fd, F_GETFL);
+ if (flags == -1)
+ return MAD_FLOW_BREAK;
- blocking = flags & ~O_NONBLOCK;
+ blocking = flags & ~O_NONBLOCK;
- if(blocking != flags &&
- fcntl(fd, F_SETFL, blocking) == -1)
- return MAD_FLOW_BREAK;
+ if (blocking != flags &&
+ fcntl(fd, F_SETFL, blocking) == -1)
+ return MAD_FLOW_BREAK;
- result = receive_io(fd, buffer, len);
+ result = receive_io(fd, buffer, len);
- if(flags != blocking &&
- fcntl(fd, F_SETFL, flags) == -1)
- return MAD_FLOW_BREAK;
+ if (flags != blocking &&
+ fcntl(fd, F_SETFL, flags) == -1)
+ return MAD_FLOW_BREAK;
- return result;
+ return result;
}
static
enum mad_flow send(int fd, void const *message, unsigned int size)
{
- enum mad_flow result;
+ enum mad_flow result;
- /* send size */
+ /* send size */
- result = send_io(fd, &size, sizeof(size));
+ result = send_io(fd, &size, sizeof(size));
- /* send message */
+ /* send message */
- if(result == MAD_FLOW_CONTINUE)
- result = send_io(fd, message, size);
+ if (result == MAD_FLOW_CONTINUE)
+ result = send_io(fd, message, size);
- return result;
+ return result;
}
static
enum mad_flow receive(int fd, void **message, unsigned int *size)
{
- enum mad_flow result;
- unsigned int actual;
+ enum mad_flow result;
+ unsigned int actual;
- if(*message == 0)
- *size = 0;
+ if (*message == 0)
+ *size = 0;
- /* receive size */
+ /* receive size */
- result = receive_io(fd, &actual, sizeof(actual));
+ result = receive_io(fd, &actual, sizeof(actual));
- /* receive message */
+ /* receive message */
- if(result == MAD_FLOW_CONTINUE)
- {
- if(actual > *size)
- actual -= *size;
- else
- {
- *size = actual;
- actual = 0;
- }
+ if (result == MAD_FLOW_CONTINUE) {
+ if (actual > *size)
+ actual -= *size;
+ else {
+ *size = actual;
+ actual = 0;
+ }
- if(*size > 0)
- {
- if(*message == 0)
- {
- *message = malloc(*size);
- if(*message == 0)
- return MAD_FLOW_BREAK;
- }
+ if (*size > 0) {
+ if (*message == 0) {
+ *message = malloc(*size);
+ if (*message == 0)
+ return MAD_FLOW_BREAK;
+ }
- result = receive_io_blocking(fd, *message, *size);
- }
+ result = receive_io_blocking(fd, *message, *size);
+ }
- /* throw away remainder of message */
+ /* throw away remainder of message */
- while(actual && result == MAD_FLOW_CONTINUE)
- {
- char sink[256];
- unsigned int len;
+ while (actual && result == MAD_FLOW_CONTINUE) {
+ char sink[256];
+ unsigned int len;
- len = actual > sizeof(sink) ? sizeof(sink) : actual;
+ len = actual > sizeof(sink) ? sizeof(sink) : actual;
- result = receive_io_blocking(fd, sink, len);
+ result = receive_io_blocking(fd, sink, len);
- actual -= len;
- }
+ actual -= len;
}
+ }
- return result;
+ return result;
}
static
enum mad_flow check_message(struct mad_decoder *decoder)
{
- enum mad_flow result;
- void *message = 0;
- unsigned int size;
-
- result = receive(decoder->async.in, &message, &size);
-
- if(result == MAD_FLOW_CONTINUE)
- {
- if(decoder->message_func == 0)
- size = 0;
- else
- {
- result = decoder->message_func(decoder->cb_data, message, &size);
-
- if(result == MAD_FLOW_IGNORE ||
- result == MAD_FLOW_BREAK)
- size = 0;
- }
-
- if(send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE)
- result = MAD_FLOW_BREAK;
+ enum mad_flow result;
+ void *message = 0;
+ unsigned int size;
+
+ result = receive(decoder->async.in, &message, &size);
+
+ if (result == MAD_FLOW_CONTINUE) {
+ if (decoder->message_func == 0)
+ size = 0;
+ else {
+ result = decoder->message_func(decoder->cb_data, message, &size);
+
+ if (result == MAD_FLOW_IGNORE ||
+ result == MAD_FLOW_BREAK)
+ size = 0;
}
- if(message)
- free(message);
+ if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE)
+ result = MAD_FLOW_BREAK;
+ }
- return result;
+ if (message)
+ free(message);
+
+ return result;
}
# endif
static
enum mad_flow error_default(void *data, struct mad_stream *stream,
- struct mad_frame *frame)
+ struct mad_frame *frame)
{
- int *bad_last_frame = data;
+ int *bad_last_frame = data;
- switch(stream->error)
- {
- case MAD_ERROR_BADCRC:
- if(*bad_last_frame)
- mad_frame_mute(frame);
- else
- *bad_last_frame = 1;
+ switch (stream->error) {
+ case MAD_ERROR_BADCRC:
+ if (*bad_last_frame)
+ mad_frame_mute(frame);
+ else
+ *bad_last_frame = 1;
- return MAD_FLOW_IGNORE;
+ return MAD_FLOW_IGNORE;
- default:
- return MAD_FLOW_CONTINUE;
- }
+ default:
+ return MAD_FLOW_CONTINUE;
+ }
}
static
int run_sync(struct mad_decoder *decoder)
{
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- void *error_data;
- int bad_last_frame = 0;
- struct mad_stream *stream;
- struct mad_frame *frame;
- struct mad_synth *synth;
- int result = 0;
-
- if(decoder->input_func == 0)
- return 0;
-
- if(decoder->error_func)
- {
- error_func = decoder->error_func;
- error_data = decoder->cb_data;
- }
- else
- {
- error_func = error_default;
- error_data = &bad_last_frame;
- }
-
- stream = &decoder->sync->stream;
- frame = &decoder->sync->frame;
- synth = &decoder->sync->synth;
-
- mad_stream_init(stream);
- mad_frame_init(frame);
- mad_synth_init(synth);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ void *error_data;
+ int bad_last_frame = 0;
+ struct mad_stream *stream;
+ struct mad_frame *frame;
+ struct mad_synth *synth;
+ int result = 0;
+
+ if (decoder->input_func == 0)
+ return 0;
- mad_stream_options(stream, decoder->options);
+ if (decoder->error_func) {
+ error_func = decoder->error_func;
+ error_data = decoder->cb_data;
+ }
+ else {
+ error_func = error_default;
+ error_data = &bad_last_frame;
+ }
+
+ stream = &decoder->sync->stream;
+ frame = &decoder->sync->frame;
+ synth = &decoder->sync->synth;
+
+ mad_stream_init(stream);
+ mad_frame_init(frame);
+ mad_synth_init(synth);
+
+ mad_stream_options(stream, decoder->options);
+
+ do {
+ switch (decoder->input_func(decoder->cb_data, stream)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
- do
- {
- switch(decoder->input_func(decoder->cb_data, stream))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- continue;
- case MAD_FLOW_CONTINUE:
- break;
- }
-
- while(1)
- {
+ while (1) {
# if defined(USE_ASYNC)
- if(decoder->mode == MAD_DECODER_MODE_ASYNC)
- {
- switch(check_message(decoder))
- {
- case MAD_FLOW_IGNORE:
- case MAD_FLOW_CONTINUE:
- break;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_STOP:
- goto done;
- }
- }
+ if (decoder->mode == MAD_DECODER_MODE_ASYNC) {
+ switch (check_message(decoder)) {
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ break;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_STOP:
+ goto done;
+ }
+ }
# endif
- if(decoder->header_func)
- {
- if(mad_header_decode(&frame->header, stream) == -1)
- {
- if(!MAD_RECOVERABLE(stream->error))
- break;
-
- switch(error_func(error_data, stream, frame))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- case MAD_FLOW_CONTINUE:
- default:
- continue;
- }
- }
-
- switch(decoder->header_func(decoder->cb_data, &frame->header))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- continue;
- case MAD_FLOW_CONTINUE:
- break;
- }
- }
-
- if(mad_frame_decode(frame, stream) == -1)
- {
- if(!MAD_RECOVERABLE(stream->error))
- break;
-
- switch(error_func(error_data, stream, frame))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- break;
- case MAD_FLOW_CONTINUE:
- default:
- continue;
- }
- }
- else
- bad_last_frame = 0;
-
- if(decoder->filter_func)
- {
- switch(decoder->filter_func(decoder->cb_data, stream, frame))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- continue;
- case MAD_FLOW_CONTINUE:
- break;
- }
- }
-
- mad_synth_frame(synth, frame);
-
- if(decoder->output_func)
- {
- switch(decoder->output_func(decoder->cb_data,
- &frame->header, &synth->pcm))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- case MAD_FLOW_CONTINUE:
- break;
- }
- }
- }
+ if (decoder->header_func) {
+ if (mad_header_decode(&frame->header, stream) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ break;
+
+ switch (error_func(error_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ default:
+ continue;
+ }
+ }
+
+ switch (decoder->header_func(decoder->cb_data, &frame->header)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+
+ if (mad_frame_decode(frame, stream) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ break;
+
+ switch (error_func(error_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ break;
+ case MAD_FLOW_CONTINUE:
+ default:
+ continue;
+ }
+ }
+ else
+ bad_last_frame = 0;
+
+ if (decoder->filter_func) {
+ switch (decoder->filter_func(decoder->cb_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+
+ mad_synth_frame(synth, frame);
+
+ if (decoder->output_func) {
+ switch (decoder->output_func(decoder->cb_data,
+ &frame->header, &synth->pcm)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
}
- while(stream->error == MAD_ERROR_BUFLEN);
+ }
+ while (stream->error == MAD_ERROR_BUFLEN);
-fail:
- result = -1;
+ fail:
+ result = -1;
-done:
- mad_synth_finish(synth);
- mad_frame_finish(frame);
- mad_stream_finish(stream);
+ done:
+ mad_synth_finish(synth);
+ mad_frame_finish(frame);
+ mad_stream_finish(stream);
- return result;
+ return result;
}
# if defined(USE_ASYNC)
static
int run_async(struct mad_decoder *decoder)
{
- pid_t pid;
- int ptoc[2], ctop[2], flags;
+ pid_t pid;
+ int ptoc[2], ctop[2], flags;
- if(pipe(ptoc) == -1)
- return -1;
+ if (pipe(ptoc) == -1)
+ return -1;
- if(pipe(ctop) == -1)
- {
- close(ptoc[0]);
- close(ptoc[1]);
- return -1;
- }
+ if (pipe(ctop) == -1) {
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
- flags = fcntl(ptoc[0], F_GETFL);
- if(flags == -1 ||
- fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1)
- {
- close(ctop[0]);
- close(ctop[1]);
- close(ptoc[0]);
- close(ptoc[1]);
- return -1;
- }
+ flags = fcntl(ptoc[0], F_GETFL);
+ if (flags == -1 ||
+ fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) {
+ close(ctop[0]);
+ close(ctop[1]);
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
- pid = fork();
- if(pid == -1)
- {
- close(ctop[0]);
- close(ctop[1]);
- close(ptoc[0]);
- close(ptoc[1]);
- return -1;
- }
+ pid = fork();
+ if (pid == -1) {
+ close(ctop[0]);
+ close(ctop[1]);
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
- decoder->async.pid = pid;
+ decoder->async.pid = pid;
- if(pid)
- {
- /* parent */
+ if (pid) {
+ /* parent */
- close(ptoc[0]);
- close(ctop[1]);
+ close(ptoc[0]);
+ close(ctop[1]);
- decoder->async.in = ctop[0];
- decoder->async.out = ptoc[1];
+ decoder->async.in = ctop[0];
+ decoder->async.out = ptoc[1];
- return 0;
- }
+ return 0;
+ }
- /* child */
+ /* child */
- close(ptoc[1]);
- close(ctop[0]);
+ close(ptoc[1]);
+ close(ctop[0]);
- decoder->async.in = ptoc[0];
- decoder->async.out = ctop[1];
+ decoder->async.in = ptoc[0];
+ decoder->async.out = ctop[1];
- _exit(run_sync(decoder));
+ _exit(run_sync(decoder));
- /* not reached */
- return -1;
+ /* not reached */
+ return -1;
}
# endif
@@ -563,35 +531,34 @@ int run_async(struct mad_decoder *decoder)
*/
int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
{
- int result;
- int (*run)(struct mad_decoder *) = 0;
+ int result;
+ int (*run)(struct mad_decoder *) = 0;
- switch(decoder->mode = mode)
- {
- case MAD_DECODER_MODE_SYNC:
- run = run_sync;
- break;
+ switch (decoder->mode = mode) {
+ case MAD_DECODER_MODE_SYNC:
+ run = run_sync;
+ break;
- case MAD_DECODER_MODE_ASYNC:
+ case MAD_DECODER_MODE_ASYNC:
# if defined(USE_ASYNC)
- run = run_async;
+ run = run_async;
# endif
- break;
- }
+ break;
+ }
- if(run == 0)
- return -1;
+ if (run == 0)
+ return -1;
- decoder->sync = malloc(sizeof(*decoder->sync));
- if(decoder->sync == 0)
- return -1;
+ decoder->sync = malloc(sizeof(*decoder->sync));
+ if (decoder->sync == 0)
+ return -1;
- result = run(decoder);
+ result = run(decoder);
- free(decoder->sync);
- decoder->sync = 0;
+ free(decoder->sync);
+ decoder->sync = 0;
- return result;
+ return result;
}
/*
@@ -599,16 +566,16 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
* DESCRIPTION: send a message to and receive a reply from the decoder process
*/
int mad_decoder_message(struct mad_decoder *decoder,
- void *message, unsigned int *len)
+ void *message, unsigned int *len)
{
# if defined(USE_ASYNC)
- if(decoder->mode != MAD_DECODER_MODE_ASYNC ||
- send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE ||
- receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE)
- return -1;
+ if (decoder->mode != MAD_DECODER_MODE_ASYNC ||
+ send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE ||
+ receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE)
+ return -1;
- return 0;
+ return 0;
# else
- return -1;
+ return -1;
# endif
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/decoder.h b/src/filters/transform/MpaDecFilter/libmad/decoder.h
index 57961f099..33971567a 100644
--- a/src/filters/transform/MpaDecFilter/libmad/decoder.h
+++ b/src/filters/transform/MpaDecFilter/libmad/decoder.h
@@ -25,65 +25,60 @@
# include "frame.h"
# include "synth.h"
-enum mad_decoder_mode
-{
- MAD_DECODER_MODE_SYNC = 0,
- MAD_DECODER_MODE_ASYNC
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
};
-enum mad_flow
-{
- MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
- MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
- MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
- MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
};
-struct mad_decoder
-{
- enum mad_decoder_mode mode;
+struct mad_decoder {
+ enum mad_decoder_mode mode;
- int options;
+ int options;
- struct
- {
- long pid;
- int in;
- int out;
- } async;
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
- struct
- {
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- } *sync;
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
- void *cb_data;
+ void *cb_data;
- enum mad_flow(*input_func)(void *, struct mad_stream *);
- enum mad_flow(*header_func)(void *, struct mad_header const *);
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *, struct mad_frame *);
- enum mad_flow(*output_func)(void *,
- struct mad_header const *, struct mad_pcm *);
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- enum mad_flow(*message_func)(void *, void *, unsigned int *);
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
};
void mad_decoder_init(struct mad_decoder *, void *,
- enum mad_flow(*)(void *, struct mad_stream *),
- enum mad_flow(*)(void *, struct mad_header const *),
- enum mad_flow(*)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*)(void *, void *, unsigned int *));
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
diff --git a/src/filters/transform/MpaDecFilter/libmad/fixed.c b/src/filters/transform/MpaDecFilter/libmad/fixed.c
index 2da82ceaf..6036d66d0 100644
--- a/src/filters/transform/MpaDecFilter/libmad/fixed.c
+++ b/src/filters/transform/MpaDecFilter/libmad/fixed.c
@@ -32,7 +32,7 @@
*/
mad_fixed_t mad_f_abs(mad_fixed_t x)
{
- return x < 0 ? -x : x;
+ return x < 0 ? -x : x;
}
/*
@@ -41,43 +41,40 @@ mad_fixed_t mad_f_abs(mad_fixed_t x)
*/
mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y)
{
- mad_fixed_t q, r;
- unsigned int bits;
+ mad_fixed_t q, r;
+ unsigned int bits;
- q = mad_f_abs(x / y);
+ q = mad_f_abs(x / y);
- if(x < 0)
- {
- x = -x;
- y = -y;
- }
+ if (x < 0) {
+ x = -x;
+ y = -y;
+ }
- r = x % y;
+ r = x % y;
- if(y < 0)
- {
- x = -x;
- y = -y;
- }
+ if (y < 0) {
+ x = -x;
+ y = -y;
+ }
- if(q > mad_f_intpart(MAD_F_MAX) &&
- !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0)))
- return 0;
+ if (q > mad_f_intpart(MAD_F_MAX) &&
+ !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0)))
+ return 0;
- for(bits = MAD_F_FRACBITS; bits && r; --bits)
- {
- q <<= 1, r <<= 1;
- if(r >= y)
- r -= y, ++q;
- }
+ for (bits = MAD_F_FRACBITS; bits && r; --bits) {
+ q <<= 1, r <<= 1;
+ if (r >= y)
+ r -= y, ++q;
+ }
- /* round */
- if(2 * r >= y)
- ++q;
+ /* round */
+ if (2 * r >= y)
+ ++q;
- /* fix sign */
- if((x < 0) != (y < 0))
- q = -q;
+ /* fix sign */
+ if ((x < 0) != (y < 0))
+ q = -q;
- return q << bits;
+ return q << bits;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/fixed.h b/src/filters/transform/MpaDecFilter/libmad/fixed.h
index a4d291f88..7f88de06c 100644
--- a/src/filters/transform/MpaDecFilter/libmad/fixed.h
+++ b/src/filters/transform/MpaDecFilter/libmad/fixed.h
@@ -98,7 +98,7 @@ typedef mad_fixed_t mad_sample_t;
# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
-/* (x should be positive) */
+ /* (x should be positive) */
# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
@@ -142,35 +142,32 @@ typedef mad_fixed_t mad_sample_t;
# pragma warning(push)
# pragma warning(disable: 4035) /* no return value */
# if defined(_WIN64)
-static __forceinline
-mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
-{
- enum
- {
- fracbits = MAD_F_FRACBITS
- };
- return ((__int64)x * (__int64)y) >> fracbits; //TODO: unsigned?
-
- /* implicit return of eax */
-}
+ static __forceinline
+ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+ {
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+ return ((__int64)x*(__int64)y)>>fracbits; //TODO: unsigned?
+
+ /* implicit return of eax */
+ }
# else
-static __forceinline
-mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
-{
- enum
- {
- fracbits = MAD_F_FRACBITS
- };
-
- __asm
- {
- mov eax, x
- imul y
- shrd eax, edx, fracbits
- }
-
- /* implicit return of eax */
-}
+ static __forceinline
+ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+ {
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+
+ __asm {
+ mov eax, x
+ imul y
+ shrd eax, edx, fracbits
+ }
+
+ /* implicit return of eax */
+ }
# endif
# pragma warning(pop)
diff --git a/src/filters/transform/MpaDecFilter/libmad/frame.c b/src/filters/transform/MpaDecFilter/libmad/frame.c
index 0bd55a266..23bfa7537 100644
--- a/src/filters/transform/MpaDecFilter/libmad/frame.c
+++ b/src/filters/transform/MpaDecFilter/libmad/frame.c
@@ -34,42 +34,30 @@
# include "layer3.h"
static
-unsigned long const bitrate_table[5][15] =
-{
- /* MPEG-1 */
- {
- 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */
- 256000, 288000, 320000, 352000, 384000, 416000, 448000
- },
- {
- 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */
- 128000, 160000, 192000, 224000, 256000, 320000, 384000
- },
- {
- 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */
- 112000, 128000, 160000, 192000, 224000, 256000, 320000
- },
-
- /* MPEG-2 LSF */
- {
- 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */
- 128000, 144000, 160000, 176000, 192000, 224000, 256000
- },
- {
- 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */
- 64000, 80000, 96000, 112000, 128000, 144000, 160000
- } /* II & III */
+unsigned long const bitrate_table[5][15] = {
+ /* MPEG-1 */
+ { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */
+ 256000, 288000, 320000, 352000, 384000, 416000, 448000 },
+ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */
+ 128000, 160000, 192000, 224000, 256000, 320000, 384000 },
+ { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */
+ 112000, 128000, 160000, 192000, 224000, 256000, 320000 },
+
+ /* MPEG-2 LSF */
+ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */
+ 128000, 144000, 160000, 176000, 192000, 224000, 256000 },
+ { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */
+ 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */
};
static
unsigned int const samplerate_table[3] = { 44100, 48000, 32000 };
static
-int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) =
-{
- mad_layer_I,
- mad_layer_II,
- mad_layer_III
+int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = {
+ mad_layer_I,
+ mad_layer_II,
+ mad_layer_III
};
/*
@@ -78,21 +66,21 @@ int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) =
*/
void mad_header_init(struct mad_header *header)
{
- header->layer = 0;
- header->mode = 0;
- header->mode_extension = 0;
- header->emphasis = 0;
+ header->layer = 0;
+ header->mode = 0;
+ header->mode_extension = 0;
+ header->emphasis = 0;
- header->bitrate = 0;
- header->samplerate = 0;
+ header->bitrate = 0;
+ header->samplerate = 0;
- header->crc_check = 0;
- header->crc_target = 0;
+ header->crc_check = 0;
+ header->crc_target = 0;
- header->flags = 0;
- header->private_bits = 0;
+ header->flags = 0;
+ header->private_bits = 0;
- header->duration = mad_timer_zero;
+ header->duration = mad_timer_zero;
}
/*
@@ -101,12 +89,12 @@ void mad_header_init(struct mad_header *header)
*/
void mad_frame_init(struct mad_frame *frame)
{
- mad_header_init(&frame->header);
+ mad_header_init(&frame->header);
- frame->options = 0;
+ frame->options = 0;
- frame->overlap = 0;
- mad_frame_mute(frame);
+ frame->overlap = 0;
+ mad_frame_mute(frame);
}
/*
@@ -115,13 +103,12 @@ void mad_frame_init(struct mad_frame *frame)
*/
void mad_frame_finish(struct mad_frame *frame)
{
- mad_header_finish(&frame->header);
+ mad_header_finish(&frame->header);
- if(frame->overlap)
- {
- free(frame->overlap);
- frame->overlap = 0;
- }
+ if (frame->overlap) {
+ free(frame->overlap);
+ frame->overlap = 0;
+ }
}
/*
@@ -131,123 +118,116 @@ void mad_frame_finish(struct mad_frame *frame)
static
int decode_header(struct mad_header *header, struct mad_stream *stream)
{
- unsigned int index;
+ unsigned int index;
- header->flags = 0;
- header->private_bits = 0;
+ header->flags = 0;
+ header->private_bits = 0;
- /* header() */
+ /* header() */
- /* syncword */
- mad_bit_skip(&stream->ptr, 11);
+ /* syncword */
+ mad_bit_skip(&stream->ptr, 11);
- /* MPEG 2.5 indicator (really part of syncword) */
- if(mad_bit_read(&stream->ptr, 1) == 0)
- header->flags |= MAD_FLAG_MPEG_2_5_EXT;
+ /* MPEG 2.5 indicator (really part of syncword) */
+ if (mad_bit_read(&stream->ptr, 1) == 0)
+ header->flags |= MAD_FLAG_MPEG_2_5_EXT;
- /* ID */
- if(mad_bit_read(&stream->ptr, 1) == 0)
- header->flags |= MAD_FLAG_LSF_EXT;
- else if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- {
- stream->error = MAD_ERROR_LOSTSYNC;
- return -1;
- }
+ /* ID */
+ if (mad_bit_read(&stream->ptr, 1) == 0)
+ header->flags |= MAD_FLAG_LSF_EXT;
+ else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ return -1;
+ }
- /* layer */
- header->layer = 4 - mad_bit_read(&stream->ptr, 2);
+ /* layer */
+ header->layer = 4 - mad_bit_read(&stream->ptr, 2);
- if(header->layer == 4)
- {
- stream->error = MAD_ERROR_BADLAYER;
- return -1;
- }
+ if (header->layer == 4) {
+ stream->error = MAD_ERROR_BADLAYER;
+ return -1;
+ }
- /* protection_bit */
- if(mad_bit_read(&stream->ptr, 1) == 0)
- {
- header->flags |= MAD_FLAG_PROTECTION;
- header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff);
- }
+ /* protection_bit */
+ if (mad_bit_read(&stream->ptr, 1) == 0) {
+ header->flags |= MAD_FLAG_PROTECTION;
+ header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff);
+ }
- /* bitrate_index */
- index = mad_bit_read(&stream->ptr, 4);
+ /* bitrate_index */
+ index = mad_bit_read(&stream->ptr, 4);
- if(index == 15)
- {
- stream->error = MAD_ERROR_BADBITRATE;
- return -1;
- }
+ if (index == 15) {
+ stream->error = MAD_ERROR_BADBITRATE;
+ return -1;
+ }
- if(header->flags & MAD_FLAG_LSF_EXT)
- header->bitrate = bitrate_table[3 + (header->layer >> 1)][index];
- else
- header->bitrate = bitrate_table[header->layer - 1][index];
+ if (header->flags & MAD_FLAG_LSF_EXT)
+ header->bitrate = bitrate_table[3 + (header->layer >> 1)][index];
+ else
+ header->bitrate = bitrate_table[header->layer - 1][index];
- /* sampling_frequency */
- index = mad_bit_read(&stream->ptr, 2);
+ /* sampling_frequency */
+ index = mad_bit_read(&stream->ptr, 2);
- if(index == 3)
- {
- stream->error = MAD_ERROR_BADSAMPLERATE;
- return -1;
- }
+ if (index == 3) {
+ stream->error = MAD_ERROR_BADSAMPLERATE;
+ return -1;
+ }
- header->samplerate = samplerate_table[index];
+ header->samplerate = samplerate_table[index];
- if(header->flags & MAD_FLAG_LSF_EXT)
- {
- header->samplerate /= 2;
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ header->samplerate /= 2;
- if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- header->samplerate /= 2;
- }
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ header->samplerate /= 2;
+ }
- /* padding_bit */
- if(mad_bit_read(&stream->ptr, 1))
- header->flags |= MAD_FLAG_PADDING;
+ /* padding_bit */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_PADDING;
- /* private_bit */
- if(mad_bit_read(&stream->ptr, 1))
- header->private_bits |= MAD_PRIVATE_HEADER;
+ /* private_bit */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->private_bits |= MAD_PRIVATE_HEADER;
- /* mode */
- header->mode = 3 - mad_bit_read(&stream->ptr, 2);
+ /* mode */
+ header->mode = 3 - mad_bit_read(&stream->ptr, 2);
- /* mode_extension */
- header->mode_extension = mad_bit_read(&stream->ptr, 2);
+ /* mode_extension */
+ header->mode_extension = mad_bit_read(&stream->ptr, 2);
- /* copyright */
- if(mad_bit_read(&stream->ptr, 1))
- header->flags |= MAD_FLAG_COPYRIGHT;
+ /* copyright */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_COPYRIGHT;
- /* original/copy */
- if(mad_bit_read(&stream->ptr, 1))
- header->flags |= MAD_FLAG_ORIGINAL;
+ /* original/copy */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_ORIGINAL;
- /* emphasis */
- header->emphasis = mad_bit_read(&stream->ptr, 2);
+ /* emphasis */
+ header->emphasis = mad_bit_read(&stream->ptr, 2);
# if defined(OPT_STRICT)
- /*
- * ISO/IEC 11172-3 says this is a reserved emphasis value, but
- * streams exist which use it anyway. Since the value is not important
- * to the decoder proper, we allow it unless OPT_STRICT is defined.
- */
- if(header->emphasis == MAD_EMPHASIS_RESERVED)
- {
- stream->error = MAD_ERROR_BADEMPHASIS;
- return -1;
- }
+ /*
+ * ISO/IEC 11172-3 says this is a reserved emphasis value, but
+ * streams exist which use it anyway. Since the value is not important
+ * to the decoder proper, we allow it unless OPT_STRICT is defined.
+ */
+ if (header->emphasis == MAD_EMPHASIS_RESERVED) {
+ stream->error = MAD_ERROR_BADEMPHASIS;
+ return -1;
+ }
# endif
- /* error_check() */
+ /* error_check() */
- /* crc_check */
- if(header->flags & MAD_FLAG_PROTECTION)
- header->crc_target = mad_bit_read(&stream->ptr, 16);
+ /* crc_check */
+ if (header->flags & MAD_FLAG_PROTECTION)
+ header->crc_target = mad_bit_read(&stream->ptr, 16);
- return 0;
+ return 0;
}
/*
@@ -257,64 +237,59 @@ int decode_header(struct mad_header *header, struct mad_stream *stream)
static
int free_bitrate(struct mad_stream *stream, struct mad_header const *header)
{
- struct mad_bitptr keep_ptr;
- unsigned long rate = 0;
- unsigned int pad_slot, slots_per_frame;
- unsigned char const *ptr = 0;
+ struct mad_bitptr keep_ptr;
+ unsigned long rate = 0;
+ unsigned int pad_slot, slots_per_frame;
+ unsigned char const *ptr = 0;
- keep_ptr = stream->ptr;
+ keep_ptr = stream->ptr;
- pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
- slots_per_frame = (header->layer == MAD_LAYER_III &&
- (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
-
- while(mad_stream_sync(stream) == 0)
- {
- struct mad_stream peek_stream;
- struct mad_header peek_header;
-
- peek_stream = *stream;
- peek_header = *header;
-
- if(decode_header(&peek_header, &peek_stream) == 0 &&
- peek_header.layer == header->layer &&
- peek_header.samplerate == header->samplerate)
- {
- unsigned int N;
-
- ptr = mad_bit_nextbyte(&stream->ptr);
-
- N = ptr - stream->this_frame;
-
- if(header->layer == MAD_LAYER_I)
- {
- rate = (unsigned long) header->samplerate *
- (N - 4 * pad_slot + 4) / 48 / 1000;
- }
- else
- {
- rate = (unsigned long) header->samplerate *
- (N - pad_slot + 1) / slots_per_frame / 1000;
- }
-
- if(rate >= 8)
- break;
- }
-
- mad_bit_skip(&stream->ptr, 8);
- }
+ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
+ slots_per_frame = (header->layer == MAD_LAYER_III &&
+ (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
+
+ while (mad_stream_sync(stream) == 0) {
+ struct mad_stream peek_stream;
+ struct mad_header peek_header;
+
+ peek_stream = *stream;
+ peek_header = *header;
+
+ if (decode_header(&peek_header, &peek_stream) == 0 &&
+ peek_header.layer == header->layer &&
+ peek_header.samplerate == header->samplerate) {
+ unsigned int N;
+
+ ptr = mad_bit_nextbyte(&stream->ptr);
- stream->ptr = keep_ptr;
+ N = ptr - stream->this_frame;
- if(rate < 8 || (header->layer == MAD_LAYER_III && rate > 640))
- {
- stream->error = MAD_ERROR_LOSTSYNC;
- return -1;
+ if (header->layer == MAD_LAYER_I) {
+ rate = (unsigned long) header->samplerate *
+ (N - 4 * pad_slot + 4) / 48 / 1000;
+ }
+ else {
+ rate = (unsigned long) header->samplerate *
+ (N - pad_slot + 1) / slots_per_frame / 1000;
+ }
+
+ if (rate >= 8)
+ break;
}
- stream->freerate = rate * 1000;
+ mad_bit_skip(&stream->ptr, 8);
+ }
+
+ stream->ptr = keep_ptr;
+
+ if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ return -1;
+ }
+
+ stream->freerate = rate * 1000;
- return 0;
+ return 0;
}
/*
@@ -323,149 +298,136 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header)
*/
int mad_header_decode(struct mad_header *header, struct mad_stream *stream)
{
- register unsigned char const *ptr, *end;
- unsigned int pad_slot, N;
+ register unsigned char const *ptr, *end;
+ unsigned int pad_slot, N;
- ptr = stream->next_frame;
- end = stream->bufend;
+ ptr = stream->next_frame;
+ end = stream->bufend;
- if(ptr == 0)
- {
- stream->error = MAD_ERROR_BUFPTR;
- goto fail;
- }
+ if (ptr == 0) {
+ stream->error = MAD_ERROR_BUFPTR;
+ goto fail;
+ }
- /* stream skip */
- if(stream->skiplen)
- {
- if(!stream->sync)
- ptr = stream->this_frame;
+ /* stream skip */
+ if (stream->skiplen) {
+ if (!stream->sync)
+ ptr = stream->this_frame;
- if(end - ptr < stream->skiplen)
- {
- stream->skiplen -= end - ptr;
- stream->next_frame = end;
+ if (end - ptr < stream->skiplen) {
+ stream->skiplen -= end - ptr;
+ stream->next_frame = end;
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
- ptr += stream->skiplen;
- stream->skiplen = 0;
+ ptr += stream->skiplen;
+ stream->skiplen = 0;
- stream->sync = 1;
- }
+ stream->sync = 1;
+ }
-sync:
- /* synchronize */
- if(stream->sync)
- {
- if(end - ptr < MAD_BUFFER_GUARD)
- {
- stream->next_frame = ptr;
-
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
- else if(!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
- {
- /* mark point where frame sync word was expected */
- stream->this_frame = ptr;
- stream->next_frame = ptr + 1;
-
- stream->error = MAD_ERROR_LOSTSYNC;
- goto fail;
- }
+ sync:
+ /* synchronize */
+ if (stream->sync) {
+ if (end - ptr < MAD_BUFFER_GUARD) {
+ stream->next_frame = ptr;
+
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
}
- else
- {
- mad_bit_init(&stream->ptr, ptr);
+ else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ /* mark point where frame sync word was expected */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1;
- if(mad_stream_sync(stream) == -1)
- {
- if(end - stream->next_frame >= MAD_BUFFER_GUARD)
- stream->next_frame = end - MAD_BUFFER_GUARD;
+ stream->error = MAD_ERROR_LOSTSYNC;
+ goto fail;
+ }
+ }
+ else {
+ mad_bit_init(&stream->ptr, ptr);
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
+ if (mad_stream_sync(stream) == -1) {
+ if (end - stream->next_frame >= MAD_BUFFER_GUARD)
+ stream->next_frame = end - MAD_BUFFER_GUARD;
- ptr = mad_bit_nextbyte(&stream->ptr);
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
}
- /* begin processing */
- stream->this_frame = ptr;
- stream->next_frame = ptr + 1; /* possibly bogus sync word */
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ }
- mad_bit_init(&stream->ptr, stream->this_frame);
+ /* begin processing */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1; /* possibly bogus sync word */
- if(decode_header(header, stream) == -1)
- goto fail;
+ mad_bit_init(&stream->ptr, stream->this_frame);
- /* calculate frame duration */
- mad_timer_set(&header->duration, 0,
- 32 * MAD_NSBSAMPLES(header), header->samplerate);
+ if (decode_header(header, stream) == -1)
+ goto fail;
- /* calculate free bit rate */
- if(header->bitrate == 0)
- {
- if((stream->freerate == 0 || !stream->sync ||
- (header->layer == MAD_LAYER_III && stream->freerate > 640000)) &&
- free_bitrate(stream, header) == -1)
- goto fail;
+ /* calculate frame duration */
+ mad_timer_set(&header->duration, 0,
+ 32 * MAD_NSBSAMPLES(header), header->samplerate);
- header->bitrate = stream->freerate;
- header->flags |= MAD_FLAG_FREEFORMAT;
- }
+ /* calculate free bit rate */
+ if (header->bitrate == 0) {
+ if ((stream->freerate == 0 || !stream->sync ||
+ (header->layer == MAD_LAYER_III && stream->freerate > 640000)) &&
+ free_bitrate(stream, header) == -1)
+ goto fail;
- /* calculate beginning of next frame */
- pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
+ header->bitrate = stream->freerate;
+ header->flags |= MAD_FLAG_FREEFORMAT;
+ }
- if(header->layer == MAD_LAYER_I)
- N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4;
- else
- {
- unsigned int slots_per_frame;
+ /* calculate beginning of next frame */
+ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
- slots_per_frame = (header->layer == MAD_LAYER_III &&
- (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
+ if (header->layer == MAD_LAYER_I)
+ N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4;
+ else {
+ unsigned int slots_per_frame;
- N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot;
- }
+ slots_per_frame = (header->layer == MAD_LAYER_III &&
+ (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
- /* verify there is enough data left in buffer to decode this frame */
- if(N + MAD_BUFFER_GUARD > end - stream->this_frame)
- {
- stream->next_frame = stream->this_frame;
+ N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot;
+ }
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
+ /* verify there is enough data left in buffer to decode this frame */
+ if (N + MAD_BUFFER_GUARD > end - stream->this_frame) {
+ stream->next_frame = stream->this_frame;
- stream->next_frame = stream->this_frame + N;
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
- if(!stream->sync)
- {
- /* check that a valid frame header follows this frame */
+ stream->next_frame = stream->this_frame + N;
- ptr = stream->next_frame;
- if(!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
- {
- ptr = stream->next_frame = stream->this_frame + 1;
- goto sync;
- }
+ if (!stream->sync) {
+ /* check that a valid frame header follows this frame */
- stream->sync = 1;
+ ptr = stream->next_frame;
+ if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ ptr = stream->next_frame = stream->this_frame + 1;
+ goto sync;
}
- header->flags |= MAD_FLAG_INCOMPLETE;
+ stream->sync = 1;
+ }
- return 0;
+ header->flags |= MAD_FLAG_INCOMPLETE;
-fail:
- stream->sync = 0;
+ return 0;
- return -1;
+ fail:
+ stream->sync = 0;
+
+ return -1;
}
/*
@@ -474,46 +436,44 @@ fail:
*/
int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream)
{
- frame->options = stream->options;
+ frame->options = stream->options;
- /* header() */
- /* error_check() */
+ /* header() */
+ /* error_check() */
- if(!(frame->header.flags & MAD_FLAG_INCOMPLETE) &&
- mad_header_decode(&frame->header, stream) == -1)
- goto fail;
+ if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) &&
+ mad_header_decode(&frame->header, stream) == -1)
+ goto fail;
- /* audio_data() */
+ /* audio_data() */
- frame->header.flags &= ~MAD_FLAG_INCOMPLETE;
+ frame->header.flags &= ~MAD_FLAG_INCOMPLETE;
- if(decoder_table[frame->header.layer - 1](stream, frame) == -1)
- {
- if(!MAD_RECOVERABLE(stream->error))
- stream->next_frame = stream->this_frame;
+ if (decoder_table[frame->header.layer - 1](stream, frame) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ stream->next_frame = stream->this_frame;
- goto fail;
- }
+ goto fail;
+ }
- /* ancillary_data() */
+ /* ancillary_data() */
- if(frame->header.layer != MAD_LAYER_III)
- {
- struct mad_bitptr next_frame;
+ if (frame->header.layer != MAD_LAYER_III) {
+ struct mad_bitptr next_frame;
- mad_bit_init(&next_frame, stream->next_frame);
+ mad_bit_init(&next_frame, stream->next_frame);
- stream->anc_ptr = stream->ptr;
- stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame);
+ stream->anc_ptr = stream->ptr;
+ stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame);
- mad_bit_finish(&next_frame);
- }
+ mad_bit_finish(&next_frame);
+ }
- return 0;
+ return 0;
-fail:
- stream->anc_bitlen = 0;
- return -1;
+ fail:
+ stream->anc_bitlen = 0;
+ return -1;
}
/*
@@ -522,26 +482,21 @@ fail:
*/
void mad_frame_mute(struct mad_frame *frame)
{
- unsigned int s, sb;
-
- for(s = 0; s < 36; ++s)
- {
- for(sb = 0; sb < 32; ++sb)
- {
- frame->sbsample[0][s][sb] =
- frame->sbsample[1][s][sb] = 0;
- }
- }
+ unsigned int s, sb;
- if(frame->overlap)
- {
- for(s = 0; s < 18; ++s)
- {
- for(sb = 0; sb < 32; ++sb)
- {
- (*frame->overlap)[0][sb][s] =
- (*frame->overlap)[1][sb][s] = 0;
- }
- }
+ for (s = 0; s < 36; ++s) {
+ for (sb = 0; sb < 32; ++sb) {
+ frame->sbsample[0][s][sb] =
+ frame->sbsample[1][s][sb] = 0;
+ }
+ }
+
+ if (frame->overlap) {
+ for (s = 0; s < 18; ++s) {
+ for (sb = 0; sb < 32; ++sb) {
+ (*frame->overlap)[0][sb][s] =
+ (*frame->overlap)[1][sb][s] = 0;
+ }
}
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/frame.h b/src/filters/transform/MpaDecFilter/libmad/frame.h
index 11f3c402d..6f262b674 100644
--- a/src/filters/transform/MpaDecFilter/libmad/frame.h
+++ b/src/filters/transform/MpaDecFilter/libmad/frame.h
@@ -25,56 +25,51 @@
# include "timer.h"
# include "stream.h"
-enum mad_layer
-{
- MAD_LAYER_I = 1, /* Layer I */
- MAD_LAYER_II = 2, /* Layer II */
- MAD_LAYER_III = 3 /* Layer III */
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
};
-enum mad_mode
-{
- MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
- MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
- MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
- MAD_MODE_STEREO = 3 /* normal LR stereo */
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
};
-enum mad_emphasis
-{
- MAD_EMPHASIS_NONE = 0, /* no emphasis */
- MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
- MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
- MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
};
-struct mad_header
-{
- enum mad_layer layer; /* audio layer (1, 2, or 3) */
- enum mad_mode mode; /* channel mode (see above) */
- int mode_extension; /* additional mode info */
- enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
- unsigned long bitrate; /* stream bitrate (bps) */
- unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short crc_check; /* frame CRC accumulator */
- unsigned short crc_target; /* final target CRC checksum */
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
- int flags; /* flags (see below) */
- int private_bits; /* private bits (see below) */
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
- mad_timer_t duration; /* audio playing time of frame */
+ mad_timer_t duration; /* audio playing time of frame */
};
-struct mad_frame
-{
- struct mad_header header; /* MPEG audio header */
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
- int options; /* decoding options (from stream) */
+ int options; /* decoding options (from stream) */
- mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
- mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
@@ -83,29 +78,27 @@ struct mad_frame
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
-enum
-{
- MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
- MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
- MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
- MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
- MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
- MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
- MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
- MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
- MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
- MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
- MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
- MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
};
-enum
-{
- MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
- MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
};
void mad_header_init(struct mad_header *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/huffman.c b/src/filters/transform/MpaDecFilter/libmad/huffman.c
index f0a77bb3e..58b6fa3ae 100644
--- a/src/filters/transform/MpaDecFilter/libmad/huffman.c
+++ b/src/filters/transform/MpaDecFilter/libmad/huffman.c
@@ -49,65 +49,63 @@
# endif
static
-union huffquad const hufftabA[] =
-{
- /* 0000 */ PTR(16, 2),
- /* 0001 */ PTR(20, 2),
- /* 0010 */ PTR(24, 1),
- /* 0011 */ PTR(26, 1),
- /* 0100 */ V(0, 0, 1, 0, 4),
- /* 0101 */ V(0, 0, 0, 1, 4),
- /* 0110 */ V(0, 1, 0, 0, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 0, 0, 0, 1),
- /* 1001 */ V(0, 0, 0, 0, 1),
- /* 1010 */ V(0, 0, 0, 0, 1),
- /* 1011 */ V(0, 0, 0, 0, 1),
- /* 1100 */ V(0, 0, 0, 0, 1),
- /* 1101 */ V(0, 0, 0, 0, 1),
- /* 1110 */ V(0, 0, 0, 0, 1),
- /* 1111 */ V(0, 0, 0, 0, 1),
-
- /* 0000 ... */
- /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
- /* 01 */ V(1, 1, 1, 1, 2),
- /* 10 */ V(1, 1, 0, 1, 2),
- /* 11 */ V(1, 1, 1, 0, 2),
-
- /* 0001 ... */
- /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
- /* 01 */ V(0, 1, 0, 1, 2),
- /* 10 */ V(1, 0, 0, 1, 1),
- /* 11 */ V(1, 0, 0, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
- /* 1 */ V(0, 0, 1, 1, 1),
-
- /* 0011 ... */
- /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
- /* 1 */ V(1, 1, 0, 0, 1)
+union huffquad const hufftabA[] = {
+ /* 0000 */ PTR(16, 2),
+ /* 0001 */ PTR(20, 2),
+ /* 0010 */ PTR(24, 1),
+ /* 0011 */ PTR(26, 1),
+ /* 0100 */ V(0, 0, 1, 0, 4),
+ /* 0101 */ V(0, 0, 0, 1, 4),
+ /* 0110 */ V(0, 1, 0, 0, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 0, 0, 0, 1),
+ /* 1001 */ V(0, 0, 0, 0, 1),
+ /* 1010 */ V(0, 0, 0, 0, 1),
+ /* 1011 */ V(0, 0, 0, 0, 1),
+ /* 1100 */ V(0, 0, 0, 0, 1),
+ /* 1101 */ V(0, 0, 0, 0, 1),
+ /* 1110 */ V(0, 0, 0, 0, 1),
+ /* 1111 */ V(0, 0, 0, 0, 1),
+
+ /* 0000 ... */
+ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
+ /* 01 */ V(1, 1, 1, 1, 2),
+ /* 10 */ V(1, 1, 0, 1, 2),
+ /* 11 */ V(1, 1, 1, 0, 2),
+
+ /* 0001 ... */
+ /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
+ /* 01 */ V(0, 1, 0, 1, 2),
+ /* 10 */ V(1, 0, 0, 1, 1),
+ /* 11 */ V(1, 0, 0, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
+ /* 1 */ V(0, 0, 1, 1, 1),
+
+ /* 0011 ... */
+ /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
+ /* 1 */ V(1, 1, 0, 0, 1)
};
static
-union huffquad const hufftabB[] =
-{
- /* 0000 */ V(1, 1, 1, 1, 4),
- /* 0001 */ V(1, 1, 1, 0, 4),
- /* 0010 */ V(1, 1, 0, 1, 4),
- /* 0011 */ V(1, 1, 0, 0, 4),
- /* 0100 */ V(1, 0, 1, 1, 4),
- /* 0101 */ V(1, 0, 1, 0, 4),
- /* 0110 */ V(1, 0, 0, 1, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 1, 1, 1, 4),
- /* 1001 */ V(0, 1, 1, 0, 4),
- /* 1010 */ V(0, 1, 0, 1, 4),
- /* 1011 */ V(0, 1, 0, 0, 4),
- /* 1100 */ V(0, 0, 1, 1, 4),
- /* 1101 */ V(0, 0, 1, 0, 4),
- /* 1110 */ V(0, 0, 0, 1, 4),
- /* 1111 */ V(0, 0, 0, 0, 4)
+union huffquad const hufftabB[] = {
+ /* 0000 */ V(1, 1, 1, 1, 4),
+ /* 0001 */ V(1, 1, 1, 0, 4),
+ /* 0010 */ V(1, 1, 0, 1, 4),
+ /* 0011 */ V(1, 1, 0, 0, 4),
+ /* 0100 */ V(1, 0, 1, 1, 4),
+ /* 0101 */ V(1, 0, 1, 0, 4),
+ /* 0110 */ V(1, 0, 0, 1, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 1, 1, 1, 4),
+ /* 1001 */ V(0, 1, 1, 0, 4),
+ /* 1010 */ V(0, 1, 0, 1, 4),
+ /* 1011 */ V(0, 1, 0, 0, 4),
+ /* 1100 */ V(0, 0, 1, 1, 4),
+ /* 1101 */ V(0, 0, 1, 0, 4),
+ /* 1110 */ V(0, 0, 0, 1, 4),
+ /* 1111 */ V(0, 0, 0, 0, 4)
};
# undef V
@@ -127,2961 +125,2944 @@ union huffquad const hufftabB[] =
# endif
static
-union huffpair const hufftab0[] =
-{
- /* */ V(0, 0, 0)
+union huffpair const hufftab0[] = {
+ /* */ V(0, 0, 0)
};
static
-union huffpair const hufftab1[] =
-{
- /* 000 */ V(1, 1, 3),
- /* 001 */ V(0, 1, 3),
- /* 010 */ V(1, 0, 2),
- /* 011 */ V(1, 0, 2),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1)
+union huffpair const hufftab1[] = {
+ /* 000 */ V(1, 1, 3),
+ /* 001 */ V(0, 1, 3),
+ /* 010 */ V(1, 0, 2),
+ /* 011 */ V(1, 0, 2),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1)
};
static
-union huffpair const hufftab2[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab2[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab3[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 0, 3),
- /* 010 */ V(1, 1, 2),
- /* 011 */ V(1, 1, 2),
- /* 100 */ V(0, 1, 2),
- /* 101 */ V(0, 1, 2),
- /* 110 */ V(0, 0, 2),
- /* 111 */ V(0, 0, 2),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab3[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 0, 3),
+ /* 010 */ V(1, 1, 2),
+ /* 011 */ V(1, 1, 2),
+ /* 100 */ V(0, 1, 2),
+ /* 101 */ V(0, 1, 2),
+ /* 110 */ V(0, 0, 2),
+ /* 111 */ V(0, 0, 2),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab5[] =
-{
- /* 000 */ PTR(8, 4),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 0000 */ PTR(24, 1), /* 8 */
- /* 0001 */ V(3, 2, 4),
- /* 0010 */ V(3, 1, 3),
- /* 0011 */ V(3, 1, 3),
- /* 0100 */ V(1, 3, 4),
- /* 0101 */ V(0, 3, 4),
- /* 0110 */ V(3, 0, 4),
- /* 0111 */ V(2, 2, 4),
- /* 1000 */ V(1, 2, 3),
- /* 1001 */ V(1, 2, 3),
- /* 1010 */ V(2, 1, 3),
- /* 1011 */ V(2, 1, 3),
- /* 1100 */ V(0, 2, 3),
- /* 1101 */ V(0, 2, 3),
- /* 1110 */ V(2, 0, 3),
- /* 1111 */ V(2, 0, 3),
-
- /* 000 0000 ... */
- /* 0 */ V(3, 3, 1), /* 24 */
- /* 1 */ V(2, 3, 1)
+union huffpair const hufftab5[] = {
+ /* 000 */ PTR(8, 4),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 0000 */ PTR(24, 1), /* 8 */
+ /* 0001 */ V(3, 2, 4),
+ /* 0010 */ V(3, 1, 3),
+ /* 0011 */ V(3, 1, 3),
+ /* 0100 */ V(1, 3, 4),
+ /* 0101 */ V(0, 3, 4),
+ /* 0110 */ V(3, 0, 4),
+ /* 0111 */ V(2, 2, 4),
+ /* 1000 */ V(1, 2, 3),
+ /* 1001 */ V(1, 2, 3),
+ /* 1010 */ V(2, 1, 3),
+ /* 1011 */ V(2, 1, 3),
+ /* 1100 */ V(0, 2, 3),
+ /* 1101 */ V(0, 2, 3),
+ /* 1110 */ V(2, 0, 3),
+ /* 1111 */ V(2, 0, 3),
+
+ /* 000 0000 ... */
+ /* 0 */ V(3, 3, 1), /* 24 */
+ /* 1 */ V(2, 3, 1)
};
static
-union huffpair const hufftab6[] =
-{
- /* 0000 */ PTR(16, 3),
- /* 0001 */ PTR(24, 1),
- /* 0010 */ PTR(26, 1),
- /* 0011 */ V(1, 2, 4),
- /* 0100 */ V(2, 1, 4),
- /* 0101 */ V(2, 0, 4),
- /* 0110 */ V(0, 1, 3),
- /* 0111 */ V(0, 1, 3),
- /* 1000 */ V(1, 1, 2),
- /* 1001 */ V(1, 1, 2),
- /* 1010 */ V(1, 1, 2),
- /* 1011 */ V(1, 1, 2),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 000 */ V(3, 3, 3), /* 16 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(2, 3, 2),
- /* 011 */ V(2, 3, 2),
- /* 100 */ V(3, 2, 2),
- /* 101 */ V(3, 2, 2),
- /* 110 */ V(3, 0, 2),
- /* 111 */ V(3, 0, 2),
-
- /* 0001 ... */
- /* 0 */ V(1, 3, 1), /* 24 */
- /* 1 */ V(3, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(2, 2, 1), /* 26 */
- /* 1 */ V(0, 2, 1)
+union huffpair const hufftab6[] = {
+ /* 0000 */ PTR(16, 3),
+ /* 0001 */ PTR(24, 1),
+ /* 0010 */ PTR(26, 1),
+ /* 0011 */ V(1, 2, 4),
+ /* 0100 */ V(2, 1, 4),
+ /* 0101 */ V(2, 0, 4),
+ /* 0110 */ V(0, 1, 3),
+ /* 0111 */ V(0, 1, 3),
+ /* 1000 */ V(1, 1, 2),
+ /* 1001 */ V(1, 1, 2),
+ /* 1010 */ V(1, 1, 2),
+ /* 1011 */ V(1, 1, 2),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 000 */ V(3, 3, 3), /* 16 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(2, 3, 2),
+ /* 011 */ V(2, 3, 2),
+ /* 100 */ V(3, 2, 2),
+ /* 101 */ V(3, 2, 2),
+ /* 110 */ V(3, 0, 2),
+ /* 111 */ V(3, 0, 2),
+
+ /* 0001 ... */
+ /* 0 */ V(1, 3, 1), /* 24 */
+ /* 1 */ V(3, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(2, 2, 1), /* 26 */
+ /* 1 */ V(0, 2, 1)
};
static
-union huffpair const hufftab7[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 2), /* 16 */
- /* 0001 */ PTR(56, 1),
- /* 0010 */ PTR(58, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(60, 1),
- /* 0110 */ V(5, 0, 4),
- /* 0111 */ PTR(62, 1),
- /* 1000 */ V(2, 4, 4),
- /* 1001 */ V(4, 2, 4),
- /* 1010 */ V(1, 4, 3),
- /* 1011 */ V(1, 4, 3),
- /* 1100 */ V(4, 1, 3),
- /* 1101 */ V(4, 1, 3),
- /* 1110 */ V(4, 0, 3),
- /* 1111 */ V(4, 0, 3),
-
- /* 0001 ... */
- /* 0000 */ V(0, 4, 4), /* 32 */
- /* 0001 */ V(2, 3, 4),
- /* 0010 */ V(3, 2, 4),
- /* 0011 */ V(0, 3, 4),
- /* 0100 */ V(1, 3, 3),
- /* 0101 */ V(1, 3, 3),
- /* 0110 */ V(3, 1, 3),
- /* 0111 */ V(3, 1, 3),
- /* 1000 */ V(3, 0, 3),
- /* 1001 */ V(3, 0, 3),
- /* 1010 */ V(2, 2, 3),
- /* 1011 */ V(2, 2, 3),
- /* 1100 */ V(1, 2, 2),
- /* 1101 */ V(1, 2, 2),
- /* 1110 */ V(1, 2, 2),
- /* 1111 */ V(1, 2, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 1, 1), /* 48 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 00 */ V(5, 5, 2), /* 52 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0001 ... */
- /* 0 */ V(3, 5, 1), /* 56 */
- /* 1 */ V(4, 4, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(2, 5, 1), /* 58 */
- /* 1 */ V(5, 2, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(0, 5, 1), /* 60 */
- /* 1 */ V(3, 4, 1),
-
- /* 0000 0111 ... */
- /* 0 */ V(4, 3, 1), /* 62 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab7[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 2), /* 16 */
+ /* 0001 */ PTR(56, 1),
+ /* 0010 */ PTR(58, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(60, 1),
+ /* 0110 */ V(5, 0, 4),
+ /* 0111 */ PTR(62, 1),
+ /* 1000 */ V(2, 4, 4),
+ /* 1001 */ V(4, 2, 4),
+ /* 1010 */ V(1, 4, 3),
+ /* 1011 */ V(1, 4, 3),
+ /* 1100 */ V(4, 1, 3),
+ /* 1101 */ V(4, 1, 3),
+ /* 1110 */ V(4, 0, 3),
+ /* 1111 */ V(4, 0, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(0, 4, 4), /* 32 */
+ /* 0001 */ V(2, 3, 4),
+ /* 0010 */ V(3, 2, 4),
+ /* 0011 */ V(0, 3, 4),
+ /* 0100 */ V(1, 3, 3),
+ /* 0101 */ V(1, 3, 3),
+ /* 0110 */ V(3, 1, 3),
+ /* 0111 */ V(3, 1, 3),
+ /* 1000 */ V(3, 0, 3),
+ /* 1001 */ V(3, 0, 3),
+ /* 1010 */ V(2, 2, 3),
+ /* 1011 */ V(2, 2, 3),
+ /* 1100 */ V(1, 2, 2),
+ /* 1101 */ V(1, 2, 2),
+ /* 1110 */ V(1, 2, 2),
+ /* 1111 */ V(1, 2, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 1, 1), /* 48 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(5, 5, 2), /* 52 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(3, 5, 1), /* 56 */
+ /* 1 */ V(4, 4, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(2, 5, 1), /* 58 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(0, 5, 1), /* 60 */
+ /* 1 */ V(3, 4, 1),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(4, 3, 1), /* 62 */
+ /* 1 */ V(3, 3, 1)
};
# if 0
/* this version saves 8 entries (16 bytes) at the expense of
an extra lookup in 4 out of 36 cases */
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 2),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(36, 3), /* 16 */
- /* 0001 */ PTR(44, 2),
- /* 0010 */ PTR(48, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(50, 1),
- /* 0110 */ PTR(52, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 00 */ PTR(54, 2), /* 32 */
- /* 01 */ V(2, 2, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 36 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 44 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 48 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 50 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 52 */
- /* 1 */ V(3, 3, 1),
-
- /* 0001 00 ... */
- /* 00 */ V(1, 3, 2), /* 54 */
- /* 01 */ V(3, 1, 2),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 2),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(36, 3), /* 16 */
+ /* 0001 */ PTR(44, 2),
+ /* 0010 */ PTR(48, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(50, 1),
+ /* 0110 */ PTR(52, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 00 */ PTR(54, 2), /* 32 */
+ /* 01 */ V(2, 2, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 36 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 44 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 48 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 50 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 52 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0001 00 ... */
+ /* 00 */ V(1, 3, 2), /* 54 */
+ /* 01 */ V(3, 1, 2),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
};
# else
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(48, 3), /* 16 */
- /* 0001 */ PTR(56, 2),
- /* 0010 */ PTR(60, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(62, 1),
- /* 0110 */ PTR(64, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 0000 */ V(1, 3, 4), /* 32 */
- /* 0001 */ V(3, 1, 4),
- /* 0010 */ V(0, 3, 4),
- /* 0011 */ V(3, 0, 4),
- /* 0100 */ V(2, 2, 2),
- /* 0101 */ V(2, 2, 2),
- /* 0110 */ V(2, 2, 2),
- /* 0111 */ V(2, 2, 2),
- /* 1000 */ V(0, 2, 2),
- /* 1001 */ V(0, 2, 2),
- /* 1010 */ V(0, 2, 2),
- /* 1011 */ V(0, 2, 2),
- /* 1100 */ V(2, 0, 2),
- /* 1101 */ V(2, 0, 2),
- /* 1110 */ V(2, 0, 2),
- /* 1111 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 48 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 56 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 60 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 62 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 64 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(48, 3), /* 16 */
+ /* 0001 */ PTR(56, 2),
+ /* 0010 */ PTR(60, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(62, 1),
+ /* 0110 */ PTR(64, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(1, 3, 4), /* 32 */
+ /* 0001 */ V(3, 1, 4),
+ /* 0010 */ V(0, 3, 4),
+ /* 0011 */ V(3, 0, 4),
+ /* 0100 */ V(2, 2, 2),
+ /* 0101 */ V(2, 2, 2),
+ /* 0110 */ V(2, 2, 2),
+ /* 0111 */ V(2, 2, 2),
+ /* 1000 */ V(0, 2, 2),
+ /* 1001 */ V(0, 2, 2),
+ /* 1010 */ V(0, 2, 2),
+ /* 1011 */ V(0, 2, 2),
+ /* 1100 */ V(2, 0, 2),
+ /* 1101 */ V(2, 0, 2),
+ /* 1110 */ V(2, 0, 2),
+ /* 1111 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 48 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 56 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 60 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 62 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 64 */
+ /* 1 */ V(3, 3, 1)
};
# endif
static
-union huffpair const hufftab9[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 3),
- /* 0010 */ PTR(40, 2),
- /* 0011 */ PTR(44, 2),
- /* 0100 */ PTR(48, 1),
- /* 0101 */ V(1, 2, 4),
- /* 0110 */ V(2, 1, 4),
- /* 0111 */ V(2, 0, 4),
- /* 1000 */ V(1, 1, 3),
- /* 1001 */ V(1, 1, 3),
- /* 1010 */ V(0, 1, 3),
- /* 1011 */ V(0, 1, 3),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(50, 1), /* 16 */
- /* 0001 */ V(3, 5, 4),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ PTR(52, 1),
- /* 0100 */ V(4, 4, 4),
- /* 0101 */ V(2, 5, 4),
- /* 0110 */ V(5, 2, 4),
- /* 0111 */ V(1, 5, 4),
- /* 1000 */ V(5, 1, 3),
- /* 1001 */ V(5, 1, 3),
- /* 1010 */ V(3, 4, 3),
- /* 1011 */ V(3, 4, 3),
- /* 1100 */ V(4, 3, 3),
- /* 1101 */ V(4, 3, 3),
- /* 1110 */ V(5, 0, 4),
- /* 1111 */ V(0, 4, 4),
-
- /* 0001 ... */
- /* 000 */ V(2, 4, 3), /* 32 */
- /* 001 */ V(4, 2, 3),
- /* 010 */ V(3, 3, 3),
- /* 011 */ V(4, 0, 3),
- /* 100 */ V(1, 4, 2),
- /* 101 */ V(1, 4, 2),
- /* 110 */ V(4, 1, 2),
- /* 111 */ V(4, 1, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 3, 2), /* 40 */
- /* 01 */ V(3, 2, 2),
- /* 10 */ V(1, 3, 1),
- /* 11 */ V(1, 3, 1),
-
- /* 0011 ... */
- /* 00 */ V(3, 1, 1), /* 44 */
- /* 01 */ V(3, 1, 1),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
-
- /* 0100 ... */
- /* 0 */ V(2, 2, 1), /* 48 */
- /* 1 */ V(0, 2, 1),
-
- /* 0000 0000 ... */
- /* 0 */ V(5, 5, 1), /* 50 */
- /* 1 */ V(4, 5, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(5, 4, 1), /* 52 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab9[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 3),
+ /* 0010 */ PTR(40, 2),
+ /* 0011 */ PTR(44, 2),
+ /* 0100 */ PTR(48, 1),
+ /* 0101 */ V(1, 2, 4),
+ /* 0110 */ V(2, 1, 4),
+ /* 0111 */ V(2, 0, 4),
+ /* 1000 */ V(1, 1, 3),
+ /* 1001 */ V(1, 1, 3),
+ /* 1010 */ V(0, 1, 3),
+ /* 1011 */ V(0, 1, 3),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(50, 1), /* 16 */
+ /* 0001 */ V(3, 5, 4),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ PTR(52, 1),
+ /* 0100 */ V(4, 4, 4),
+ /* 0101 */ V(2, 5, 4),
+ /* 0110 */ V(5, 2, 4),
+ /* 0111 */ V(1, 5, 4),
+ /* 1000 */ V(5, 1, 3),
+ /* 1001 */ V(5, 1, 3),
+ /* 1010 */ V(3, 4, 3),
+ /* 1011 */ V(3, 4, 3),
+ /* 1100 */ V(4, 3, 3),
+ /* 1101 */ V(4, 3, 3),
+ /* 1110 */ V(5, 0, 4),
+ /* 1111 */ V(0, 4, 4),
+
+ /* 0001 ... */
+ /* 000 */ V(2, 4, 3), /* 32 */
+ /* 001 */ V(4, 2, 3),
+ /* 010 */ V(3, 3, 3),
+ /* 011 */ V(4, 0, 3),
+ /* 100 */ V(1, 4, 2),
+ /* 101 */ V(1, 4, 2),
+ /* 110 */ V(4, 1, 2),
+ /* 111 */ V(4, 1, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 3, 2), /* 40 */
+ /* 01 */ V(3, 2, 2),
+ /* 10 */ V(1, 3, 1),
+ /* 11 */ V(1, 3, 1),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 1, 1), /* 44 */
+ /* 01 */ V(3, 1, 1),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
+
+ /* 0100 ... */
+ /* 0 */ V(2, 2, 1), /* 48 */
+ /* 1 */ V(0, 2, 1),
+
+ /* 0000 0000 ... */
+ /* 0 */ V(5, 5, 1), /* 50 */
+ /* 1 */ V(4, 5, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(5, 4, 1), /* 52 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab10[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 3), /* 16 */
- /* 0001 */ PTR(60, 2),
- /* 0010 */ PTR(64, 3),
- /* 0011 */ PTR(72, 1),
- /* 0100 */ PTR(74, 2),
- /* 0101 */ PTR(78, 2),
- /* 0110 */ PTR(82, 2),
- /* 0111 */ V(1, 7, 4),
- /* 1000 */ V(7, 1, 4),
- /* 1001 */ PTR(86, 1),
- /* 1010 */ PTR(88, 2),
- /* 1011 */ PTR(92, 2),
- /* 1100 */ V(1, 6, 4),
- /* 1101 */ V(6, 1, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(96, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(98, 1), /* 32 */
- /* 0001 */ PTR(100, 1),
- /* 0010 */ V(1, 4, 4),
- /* 0011 */ V(4, 1, 4),
- /* 0100 */ V(4, 0, 4),
- /* 0101 */ V(2, 3, 4),
- /* 0110 */ V(3, 2, 4),
- /* 0111 */ V(0, 3, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0010 ... */
- /* 00 */ V(1, 2, 2), /* 48 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(7, 7, 3), /* 52 */
- /* 001 */ V(6, 7, 3),
- /* 010 */ V(7, 6, 3),
- /* 011 */ V(5, 7, 3),
- /* 100 */ V(7, 5, 3),
- /* 101 */ V(6, 6, 3),
- /* 110 */ V(4, 7, 2),
- /* 111 */ V(4, 7, 2),
-
- /* 0000 0001 ... */
- /* 00 */ V(7, 4, 2), /* 60 */
- /* 01 */ V(5, 6, 2),
- /* 10 */ V(6, 5, 2),
- /* 11 */ V(3, 7, 2),
-
- /* 0000 0010 ... */
- /* 000 */ V(7, 3, 2), /* 64 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(4, 6, 2),
- /* 011 */ V(4, 6, 2),
- /* 100 */ V(5, 5, 3),
- /* 101 */ V(5, 4, 3),
- /* 110 */ V(6, 3, 2),
- /* 111 */ V(6, 3, 2),
-
- /* 0000 0011 ... */
- /* 0 */ V(2, 7, 1), /* 72 */
- /* 1 */ V(7, 2, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(6, 4, 2), /* 74 */
- /* 01 */ V(0, 7, 2),
- /* 10 */ V(7, 0, 1),
- /* 11 */ V(7, 0, 1),
-
- /* 0000 0101 ... */
- /* 00 */ V(6, 2, 1), /* 78 */
- /* 01 */ V(6, 2, 1),
- /* 10 */ V(4, 5, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0000 0110 ... */
- /* 00 */ V(0, 6, 1), /* 82 */
- /* 01 */ V(0, 6, 1),
- /* 10 */ V(5, 3, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0000 1001 ... */
- /* 0 */ V(3, 6, 1), /* 86 */
- /* 1 */ V(2, 6, 1),
-
- /* 0000 1010 ... */
- /* 00 */ V(2, 5, 2), /* 88 */
- /* 01 */ V(5, 2, 2),
- /* 10 */ V(1, 5, 1),
- /* 11 */ V(1, 5, 1),
-
- /* 0000 1011 ... */
- /* 00 */ V(5, 1, 1), /* 92 */
- /* 01 */ V(5, 1, 1),
- /* 10 */ V(3, 4, 2),
- /* 11 */ V(4, 3, 2),
-
- /* 0000 1111 ... */
- /* 0 */ V(0, 5, 1), /* 96 */
- /* 1 */ V(5, 0, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(2, 4, 1), /* 98 */
- /* 1 */ V(4, 2, 1),
-
- /* 0001 0001 ... */
- /* 0 */ V(3, 3, 1), /* 100 */
- /* 1 */ V(0, 4, 1)
+union huffpair const hufftab10[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 3), /* 16 */
+ /* 0001 */ PTR(60, 2),
+ /* 0010 */ PTR(64, 3),
+ /* 0011 */ PTR(72, 1),
+ /* 0100 */ PTR(74, 2),
+ /* 0101 */ PTR(78, 2),
+ /* 0110 */ PTR(82, 2),
+ /* 0111 */ V(1, 7, 4),
+ /* 1000 */ V(7, 1, 4),
+ /* 1001 */ PTR(86, 1),
+ /* 1010 */ PTR(88, 2),
+ /* 1011 */ PTR(92, 2),
+ /* 1100 */ V(1, 6, 4),
+ /* 1101 */ V(6, 1, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(96, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(98, 1), /* 32 */
+ /* 0001 */ PTR(100, 1),
+ /* 0010 */ V(1, 4, 4),
+ /* 0011 */ V(4, 1, 4),
+ /* 0100 */ V(4, 0, 4),
+ /* 0101 */ V(2, 3, 4),
+ /* 0110 */ V(3, 2, 4),
+ /* 0111 */ V(0, 3, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0010 ... */
+ /* 00 */ V(1, 2, 2), /* 48 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(7, 7, 3), /* 52 */
+ /* 001 */ V(6, 7, 3),
+ /* 010 */ V(7, 6, 3),
+ /* 011 */ V(5, 7, 3),
+ /* 100 */ V(7, 5, 3),
+ /* 101 */ V(6, 6, 3),
+ /* 110 */ V(4, 7, 2),
+ /* 111 */ V(4, 7, 2),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(7, 4, 2), /* 60 */
+ /* 01 */ V(5, 6, 2),
+ /* 10 */ V(6, 5, 2),
+ /* 11 */ V(3, 7, 2),
+
+ /* 0000 0010 ... */
+ /* 000 */ V(7, 3, 2), /* 64 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(4, 6, 2),
+ /* 011 */ V(4, 6, 2),
+ /* 100 */ V(5, 5, 3),
+ /* 101 */ V(5, 4, 3),
+ /* 110 */ V(6, 3, 2),
+ /* 111 */ V(6, 3, 2),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(2, 7, 1), /* 72 */
+ /* 1 */ V(7, 2, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(6, 4, 2), /* 74 */
+ /* 01 */ V(0, 7, 2),
+ /* 10 */ V(7, 0, 1),
+ /* 11 */ V(7, 0, 1),
+
+ /* 0000 0101 ... */
+ /* 00 */ V(6, 2, 1), /* 78 */
+ /* 01 */ V(6, 2, 1),
+ /* 10 */ V(4, 5, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0000 0110 ... */
+ /* 00 */ V(0, 6, 1), /* 82 */
+ /* 01 */ V(0, 6, 1),
+ /* 10 */ V(5, 3, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0000 1001 ... */
+ /* 0 */ V(3, 6, 1), /* 86 */
+ /* 1 */ V(2, 6, 1),
+
+ /* 0000 1010 ... */
+ /* 00 */ V(2, 5, 2), /* 88 */
+ /* 01 */ V(5, 2, 2),
+ /* 10 */ V(1, 5, 1),
+ /* 11 */ V(1, 5, 1),
+
+ /* 0000 1011 ... */
+ /* 00 */ V(5, 1, 1), /* 92 */
+ /* 01 */ V(5, 1, 1),
+ /* 10 */ V(3, 4, 2),
+ /* 11 */ V(4, 3, 2),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(0, 5, 1), /* 96 */
+ /* 1 */ V(5, 0, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(2, 4, 1), /* 98 */
+ /* 1 */ V(4, 2, 1),
+
+ /* 0001 0001 ... */
+ /* 0 */ V(3, 3, 1), /* 100 */
+ /* 1 */ V(0, 4, 1)
};
static
-union huffpair const hufftab11[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 3),
- /* 0100 */ V(1, 2, 4),
- /* 0101 */ PTR(72, 1),
- /* 0110 */ V(1, 1, 3),
- /* 0111 */ V(1, 1, 3),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(74, 2), /* 16 */
- /* 0001 */ PTR(78, 3),
- /* 0010 */ PTR(86, 2),
- /* 0011 */ PTR(90, 1),
- /* 0100 */ PTR(92, 2),
- /* 0101 */ V(2, 7, 4),
- /* 0110 */ V(7, 2, 4),
- /* 0111 */ PTR(96, 1),
- /* 1000 */ V(7, 1, 3),
- /* 1001 */ V(7, 1, 3),
- /* 1010 */ V(1, 7, 4),
- /* 1011 */ V(7, 0, 4),
- /* 1100 */ V(3, 6, 4),
- /* 1101 */ V(6, 3, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(98, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(100, 1), /* 32 */
- /* 0001 */ V(1, 5, 4),
- /* 0010 */ V(6, 2, 3),
- /* 0011 */ V(6, 2, 3),
- /* 0100 */ V(2, 6, 4),
- /* 0101 */ V(0, 6, 4),
- /* 0110 */ V(1, 6, 3),
- /* 0111 */ V(1, 6, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(5, 1, 4),
- /* 1011 */ V(3, 4, 4),
- /* 1100 */ V(5, 0, 4),
- /* 1101 */ PTR(102, 1),
- /* 1110 */ V(2, 4, 4),
- /* 1111 */ V(4, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 4, 4), /* 48 */
- /* 0001 */ V(4, 1, 4),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 0011 ... */
- /* 000 */ V(0, 3, 3), /* 64 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(2, 1, 1),
- /* 101 */ V(2, 1, 1),
- /* 110 */ V(2, 1, 1),
- /* 111 */ V(2, 1, 1),
-
- /* 0101 ... */
- /* 0 */ V(0, 2, 1), /* 72 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 74 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 2),
- /* 11 */ V(7, 5, 2),
-
- /* 0000 0001 ... */
- /* 000 */ V(6, 6, 2), /* 78 */
- /* 001 */ V(6, 6, 2),
- /* 010 */ V(4, 7, 2),
- /* 011 */ V(4, 7, 2),
- /* 100 */ V(7, 4, 2),
- /* 101 */ V(7, 4, 2),
- /* 110 */ V(5, 7, 3),
- /* 111 */ V(5, 5, 3),
-
- /* 0000 0010 ... */
- /* 00 */ V(5, 6, 2), /* 86 */
- /* 01 */ V(6, 5, 2),
- /* 10 */ V(3, 7, 1),
- /* 11 */ V(3, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(4, 6, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(4, 5, 2), /* 92 */
- /* 01 */ V(5, 4, 2),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0111 ... */
- /* 0 */ V(6, 4, 1), /* 96 */
- /* 1 */ V(0, 7, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(4, 4, 1), /* 98 */
- /* 1 */ V(2, 5, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(5, 2, 1), /* 100 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(4, 3, 1), /* 102 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab11[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 3),
+ /* 0100 */ V(1, 2, 4),
+ /* 0101 */ PTR(72, 1),
+ /* 0110 */ V(1, 1, 3),
+ /* 0111 */ V(1, 1, 3),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(74, 2), /* 16 */
+ /* 0001 */ PTR(78, 3),
+ /* 0010 */ PTR(86, 2),
+ /* 0011 */ PTR(90, 1),
+ /* 0100 */ PTR(92, 2),
+ /* 0101 */ V(2, 7, 4),
+ /* 0110 */ V(7, 2, 4),
+ /* 0111 */ PTR(96, 1),
+ /* 1000 */ V(7, 1, 3),
+ /* 1001 */ V(7, 1, 3),
+ /* 1010 */ V(1, 7, 4),
+ /* 1011 */ V(7, 0, 4),
+ /* 1100 */ V(3, 6, 4),
+ /* 1101 */ V(6, 3, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(98, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(100, 1), /* 32 */
+ /* 0001 */ V(1, 5, 4),
+ /* 0010 */ V(6, 2, 3),
+ /* 0011 */ V(6, 2, 3),
+ /* 0100 */ V(2, 6, 4),
+ /* 0101 */ V(0, 6, 4),
+ /* 0110 */ V(1, 6, 3),
+ /* 0111 */ V(1, 6, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(5, 1, 4),
+ /* 1011 */ V(3, 4, 4),
+ /* 1100 */ V(5, 0, 4),
+ /* 1101 */ PTR(102, 1),
+ /* 1110 */ V(2, 4, 4),
+ /* 1111 */ V(4, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 4, 4), /* 48 */
+ /* 0001 */ V(4, 1, 4),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 0011 ... */
+ /* 000 */ V(0, 3, 3), /* 64 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(2, 1, 1),
+ /* 101 */ V(2, 1, 1),
+ /* 110 */ V(2, 1, 1),
+ /* 111 */ V(2, 1, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(0, 2, 1), /* 72 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 74 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 2),
+ /* 11 */ V(7, 5, 2),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(6, 6, 2), /* 78 */
+ /* 001 */ V(6, 6, 2),
+ /* 010 */ V(4, 7, 2),
+ /* 011 */ V(4, 7, 2),
+ /* 100 */ V(7, 4, 2),
+ /* 101 */ V(7, 4, 2),
+ /* 110 */ V(5, 7, 3),
+ /* 111 */ V(5, 5, 3),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(5, 6, 2), /* 86 */
+ /* 01 */ V(6, 5, 2),
+ /* 10 */ V(3, 7, 1),
+ /* 11 */ V(3, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(4, 5, 2), /* 92 */
+ /* 01 */ V(5, 4, 2),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(6, 4, 1), /* 96 */
+ /* 1 */ V(0, 7, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(4, 4, 1), /* 98 */
+ /* 1 */ V(2, 5, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(5, 2, 1), /* 100 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(4, 3, 1), /* 102 */
+ /* 1 */ V(3, 3, 1)
};
static
-union huffpair const hufftab12[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ PTR(68, 3),
- /* 0101 */ PTR(76, 1),
- /* 0110 */ V(1, 2, 4),
- /* 0111 */ V(2, 1, 4),
- /* 1000 */ PTR(78, 1),
- /* 1001 */ V(0, 0, 4),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 3),
- /* 1101 */ V(0, 1, 3),
- /* 1110 */ V(1, 0, 3),
- /* 1111 */ V(1, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(80, 2), /* 16 */
- /* 0001 */ PTR(84, 1),
- /* 0010 */ PTR(86, 1),
- /* 0011 */ PTR(88, 1),
- /* 0100 */ V(5, 6, 4),
- /* 0101 */ V(3, 7, 4),
- /* 0110 */ PTR(90, 1),
- /* 0111 */ V(2, 7, 4),
- /* 1000 */ V(7, 2, 4),
- /* 1001 */ V(4, 6, 4),
- /* 1010 */ V(6, 4, 4),
- /* 1011 */ V(1, 7, 4),
- /* 1100 */ V(7, 1, 4),
- /* 1101 */ PTR(92, 1),
- /* 1110 */ V(3, 6, 4),
- /* 1111 */ V(6, 3, 4),
-
- /* 0001 ... */
- /* 0000 */ V(4, 5, 4), /* 32 */
- /* 0001 */ V(5, 4, 4),
- /* 0010 */ V(4, 4, 4),
- /* 0011 */ PTR(94, 1),
- /* 0100 */ V(2, 6, 3),
- /* 0101 */ V(2, 6, 3),
- /* 0110 */ V(6, 2, 3),
- /* 0111 */ V(6, 2, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 0, 4),
- /* 1100 */ V(3, 5, 4),
- /* 1101 */ V(5, 3, 4),
- /* 1110 */ V(2, 5, 4),
- /* 1111 */ V(5, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 5, 3), /* 48 */
- /* 0001 */ V(1, 5, 3),
- /* 0010 */ V(5, 1, 3),
- /* 0011 */ V(5, 1, 3),
- /* 0100 */ V(3, 4, 3),
- /* 0101 */ V(3, 4, 3),
- /* 0110 */ V(4, 3, 3),
- /* 0111 */ V(4, 3, 3),
- /* 1000 */ V(5, 0, 4),
- /* 1001 */ V(0, 4, 4),
- /* 1010 */ V(2, 4, 3),
- /* 1011 */ V(2, 4, 3),
- /* 1100 */ V(4, 2, 3),
- /* 1101 */ V(4, 2, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 0011 ... */
- /* 00 */ V(3, 3, 2), /* 64 */
- /* 01 */ V(4, 1, 2),
- /* 10 */ V(2, 3, 2),
- /* 11 */ V(3, 2, 2),
-
- /* 0100 ... */
- /* 000 */ V(4, 0, 3), /* 68 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(3, 0, 2),
- /* 011 */ V(3, 0, 2),
- /* 100 */ V(1, 3, 1),
- /* 101 */ V(1, 3, 1),
- /* 110 */ V(1, 3, 1),
- /* 111 */ V(1, 3, 1),
-
- /* 0101 ... */
- /* 0 */ V(3, 1, 1), /* 76 */
- /* 1 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(0, 2, 1), /* 78 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 80 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 1),
- /* 11 */ V(7, 6, 1),
-
- /* 0000 0001 ... */
- /* 0 */ V(5, 7, 1), /* 84 */
- /* 1 */ V(7, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(6, 6, 1), /* 86 */
- /* 1 */ V(4, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 4, 1), /* 88 */
- /* 1 */ V(6, 5, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(5, 5, 1),
-
- /* 0000 1101 ... */
- /* 0 */ V(0, 7, 1), /* 92 */
- /* 1 */ V(7, 0, 1),
-
- /* 0001 0011 ... */
- /* 0 */ V(0, 6, 1), /* 94 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab12[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ PTR(68, 3),
+ /* 0101 */ PTR(76, 1),
+ /* 0110 */ V(1, 2, 4),
+ /* 0111 */ V(2, 1, 4),
+ /* 1000 */ PTR(78, 1),
+ /* 1001 */ V(0, 0, 4),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 3),
+ /* 1101 */ V(0, 1, 3),
+ /* 1110 */ V(1, 0, 3),
+ /* 1111 */ V(1, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(80, 2), /* 16 */
+ /* 0001 */ PTR(84, 1),
+ /* 0010 */ PTR(86, 1),
+ /* 0011 */ PTR(88, 1),
+ /* 0100 */ V(5, 6, 4),
+ /* 0101 */ V(3, 7, 4),
+ /* 0110 */ PTR(90, 1),
+ /* 0111 */ V(2, 7, 4),
+ /* 1000 */ V(7, 2, 4),
+ /* 1001 */ V(4, 6, 4),
+ /* 1010 */ V(6, 4, 4),
+ /* 1011 */ V(1, 7, 4),
+ /* 1100 */ V(7, 1, 4),
+ /* 1101 */ PTR(92, 1),
+ /* 1110 */ V(3, 6, 4),
+ /* 1111 */ V(6, 3, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(4, 5, 4), /* 32 */
+ /* 0001 */ V(5, 4, 4),
+ /* 0010 */ V(4, 4, 4),
+ /* 0011 */ PTR(94, 1),
+ /* 0100 */ V(2, 6, 3),
+ /* 0101 */ V(2, 6, 3),
+ /* 0110 */ V(6, 2, 3),
+ /* 0111 */ V(6, 2, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 0, 4),
+ /* 1100 */ V(3, 5, 4),
+ /* 1101 */ V(5, 3, 4),
+ /* 1110 */ V(2, 5, 4),
+ /* 1111 */ V(5, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 5, 3), /* 48 */
+ /* 0001 */ V(1, 5, 3),
+ /* 0010 */ V(5, 1, 3),
+ /* 0011 */ V(5, 1, 3),
+ /* 0100 */ V(3, 4, 3),
+ /* 0101 */ V(3, 4, 3),
+ /* 0110 */ V(4, 3, 3),
+ /* 0111 */ V(4, 3, 3),
+ /* 1000 */ V(5, 0, 4),
+ /* 1001 */ V(0, 4, 4),
+ /* 1010 */ V(2, 4, 3),
+ /* 1011 */ V(2, 4, 3),
+ /* 1100 */ V(4, 2, 3),
+ /* 1101 */ V(4, 2, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 3, 2), /* 64 */
+ /* 01 */ V(4, 1, 2),
+ /* 10 */ V(2, 3, 2),
+ /* 11 */ V(3, 2, 2),
+
+ /* 0100 ... */
+ /* 000 */ V(4, 0, 3), /* 68 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(3, 0, 2),
+ /* 011 */ V(3, 0, 2),
+ /* 100 */ V(1, 3, 1),
+ /* 101 */ V(1, 3, 1),
+ /* 110 */ V(1, 3, 1),
+ /* 111 */ V(1, 3, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(3, 1, 1), /* 76 */
+ /* 1 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(0, 2, 1), /* 78 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 80 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 1),
+ /* 11 */ V(7, 6, 1),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(5, 7, 1), /* 84 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(6, 6, 1), /* 86 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 4, 1), /* 88 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(5, 5, 1),
+
+ /* 0000 1101 ... */
+ /* 0 */ V(0, 7, 1), /* 92 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0001 0011 ... */
+ /* 0 */ V(0, 6, 1), /* 94 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab13[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 4), /* 16 */
- /* 0001 */ PTR(84, 4),
- /* 0010 */ PTR(100, 4),
- /* 0011 */ PTR(116, 4),
- /* 0100 */ PTR(132, 4),
- /* 0101 */ PTR(148, 4),
- /* 0110 */ PTR(164, 3),
- /* 0111 */ PTR(172, 3),
- /* 1000 */ PTR(180, 3),
- /* 1001 */ PTR(188, 3),
- /* 1010 */ PTR(196, 3),
- /* 1011 */ PTR(204, 3),
- /* 1100 */ PTR(212, 1),
- /* 1101 */ PTR(214, 2),
- /* 1110 */ PTR(218, 3),
- /* 1111 */ PTR(226, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(228, 2), /* 32 */
- /* 0001 */ PTR(232, 2),
- /* 0010 */ PTR(236, 2),
- /* 0011 */ PTR(240, 2),
- /* 0100 */ V(8, 1, 4),
- /* 0101 */ PTR(244, 1),
- /* 0110 */ PTR(246, 1),
- /* 0111 */ PTR(248, 1),
- /* 1000 */ PTR(250, 2),
- /* 1001 */ PTR(254, 1),
- /* 1010 */ V(1, 5, 4),
- /* 1011 */ V(5, 1, 4),
- /* 1100 */ PTR(256, 1),
- /* 1101 */ PTR(258, 1),
- /* 1110 */ PTR(260, 1),
- /* 1111 */ V(1, 4, 4),
-
- /* 0010 ... */
- /* 0000 */ V(4, 1, 3), /* 48 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 4),
- /* 0101 */ V(3, 2, 4),
- /* 0110 */ V(1, 3, 3),
- /* 0111 */ V(1, 3, 3),
- /* 1000 */ V(3, 1, 3),
- /* 1001 */ V(3, 1, 3),
- /* 1010 */ V(0, 3, 3),
- /* 1011 */ V(0, 3, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(262, 4), /* 68 */
- /* 0001 */ PTR(278, 4),
- /* 0010 */ PTR(294, 4),
- /* 0011 */ PTR(310, 3),
- /* 0100 */ PTR(318, 2),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 3),
- /* 0111 */ PTR(334, 2),
- /* 1000 */ PTR(338, 1),
- /* 1001 */ PTR(340, 2),
- /* 1010 */ PTR(344, 2),
- /* 1011 */ PTR(348, 2),
- /* 1100 */ PTR(352, 2),
- /* 1101 */ PTR(356, 2),
- /* 1110 */ V(1, 15, 4),
- /* 1111 */ V(15, 1, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 0, 4), /* 84 */
- /* 0001 */ PTR(360, 1),
- /* 0010 */ PTR(362, 1),
- /* 0011 */ PTR(364, 1),
- /* 0100 */ V(14, 2, 4),
- /* 0101 */ PTR(366, 1),
- /* 0110 */ V(1, 14, 4),
- /* 0111 */ V(14, 1, 4),
- /* 1000 */ PTR(368, 1),
- /* 1001 */ PTR(370, 1),
- /* 1010 */ PTR(372, 1),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 1),
- /* 1101 */ PTR(378, 1),
- /* 1110 */ V(12, 6, 4),
- /* 1111 */ V(3, 13, 4),
-
- /* 0000 0010 ... */
- /* 0000 */ PTR(380, 1), /* 100 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(1, 13, 4),
- /* 0100 */ V(11, 7, 4),
- /* 0101 */ PTR(382, 1),
- /* 0110 */ PTR(384, 1),
- /* 0111 */ V(12, 3, 4),
- /* 1000 */ PTR(386, 1),
- /* 1001 */ V(4, 11, 4),
- /* 1010 */ V(13, 1, 3),
- /* 1011 */ V(13, 1, 3),
- /* 1100 */ V(0, 13, 4),
- /* 1101 */ V(13, 0, 4),
- /* 1110 */ V(8, 10, 4),
- /* 1111 */ V(10, 8, 4),
-
- /* 0000 0011 ... */
- /* 0000 */ V(4, 12, 4), /* 116 */
- /* 0001 */ V(12, 4, 4),
- /* 0010 */ V(6, 11, 4),
- /* 0011 */ V(11, 6, 4),
- /* 0100 */ V(3, 12, 3),
- /* 0101 */ V(3, 12, 3),
- /* 0110 */ V(2, 12, 3),
- /* 0111 */ V(2, 12, 3),
- /* 1000 */ V(12, 2, 3),
- /* 1001 */ V(12, 2, 3),
- /* 1010 */ V(5, 11, 3),
- /* 1011 */ V(5, 11, 3),
- /* 1100 */ V(11, 5, 4),
- /* 1101 */ V(8, 9, 4),
- /* 1110 */ V(1, 12, 3),
- /* 1111 */ V(1, 12, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(12, 1, 3), /* 132 */
- /* 0001 */ V(12, 1, 3),
- /* 0010 */ V(9, 8, 4),
- /* 0011 */ V(0, 12, 4),
- /* 0100 */ V(12, 0, 3),
- /* 0101 */ V(12, 0, 3),
- /* 0110 */ V(11, 4, 4),
- /* 0111 */ V(6, 10, 4),
- /* 1000 */ V(10, 6, 4),
- /* 1001 */ V(7, 9, 4),
- /* 1010 */ V(3, 11, 3),
- /* 1011 */ V(3, 11, 3),
- /* 1100 */ V(11, 3, 3),
- /* 1101 */ V(11, 3, 3),
- /* 1110 */ V(8, 8, 4),
- /* 1111 */ V(5, 10, 4),
-
- /* 0000 0101 ... */
- /* 0000 */ V(2, 11, 3), /* 148 */
- /* 0001 */ V(2, 11, 3),
- /* 0010 */ V(10, 5, 4),
- /* 0011 */ V(6, 9, 4),
- /* 0100 */ V(10, 4, 3),
- /* 0101 */ V(10, 4, 3),
- /* 0110 */ V(7, 8, 4),
- /* 0111 */ V(8, 7, 4),
- /* 1000 */ V(9, 4, 3),
- /* 1001 */ V(9, 4, 3),
- /* 1010 */ V(7, 7, 4),
- /* 1011 */ V(7, 6, 4),
- /* 1100 */ V(11, 2, 2),
- /* 1101 */ V(11, 2, 2),
- /* 1110 */ V(11, 2, 2),
- /* 1111 */ V(11, 2, 2),
-
- /* 0000 0110 ... */
- /* 000 */ V(1, 11, 2), /* 164 */
- /* 001 */ V(1, 11, 2),
- /* 010 */ V(11, 1, 2),
- /* 011 */ V(11, 1, 2),
- /* 100 */ V(0, 11, 3),
- /* 101 */ V(11, 0, 3),
- /* 110 */ V(9, 6, 3),
- /* 111 */ V(4, 10, 3),
-
- /* 0000 0111 ... */
- /* 000 */ V(3, 10, 3), /* 172 */
- /* 001 */ V(10, 3, 3),
- /* 010 */ V(5, 9, 3),
- /* 011 */ V(9, 5, 3),
- /* 100 */ V(2, 10, 2),
- /* 101 */ V(2, 10, 2),
- /* 110 */ V(10, 2, 2),
- /* 111 */ V(10, 2, 2),
-
- /* 0000 1000 ... */
- /* 000 */ V(1, 10, 2), /* 180 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(10, 1, 2),
- /* 011 */ V(10, 1, 2),
- /* 100 */ V(0, 10, 3),
- /* 101 */ V(6, 8, 3),
- /* 110 */ V(10, 0, 2),
- /* 111 */ V(10, 0, 2),
-
- /* 0000 1001 ... */
- /* 000 */ V(8, 6, 3), /* 188 */
- /* 001 */ V(4, 9, 3),
- /* 010 */ V(9, 3, 2),
- /* 011 */ V(9, 3, 2),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(5, 8, 3),
- /* 110 */ V(8, 5, 3),
- /* 111 */ V(6, 7, 3),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 9, 2), /* 196 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(5, 7, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 2),
- /* 111 */ V(3, 8, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(8, 3, 2), /* 204 */
- /* 001 */ V(8, 3, 2),
- /* 010 */ V(6, 6, 3),
- /* 011 */ V(4, 7, 3),
- /* 100 */ V(7, 4, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(6, 5, 3),
- /* 111 */ V(7, 3, 3),
-
- /* 0000 1100 ... */
- /* 0 */ V(1, 9, 1), /* 212 */
- /* 1 */ V(9, 1, 1),
-
- /* 0000 1101 ... */
- /* 00 */ V(0, 9, 2), /* 214 */
- /* 01 */ V(9, 0, 2),
- /* 10 */ V(4, 8, 2),
- /* 11 */ V(8, 4, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 2, 2), /* 218 */
- /* 001 */ V(7, 2, 2),
- /* 010 */ V(4, 6, 3),
- /* 011 */ V(6, 4, 3),
- /* 100 */ V(2, 8, 1),
- /* 101 */ V(2, 8, 1),
- /* 110 */ V(2, 8, 1),
- /* 111 */ V(2, 8, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(8, 2, 1), /* 226 */
- /* 1 */ V(1, 8, 1),
-
- /* 0001 0000 ... */
- /* 00 */ V(3, 7, 2), /* 228 */
- /* 01 */ V(2, 7, 2),
- /* 10 */ V(1, 7, 1),
- /* 11 */ V(1, 7, 1),
-
- /* 0001 0001 ... */
- /* 00 */ V(7, 1, 1), /* 232 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(5, 5, 2),
- /* 11 */ V(0, 7, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(7, 0, 2), /* 236 */
- /* 01 */ V(3, 6, 2),
- /* 10 */ V(6, 3, 2),
- /* 11 */ V(4, 5, 2),
-
- /* 0001 0011 ... */
- /* 00 */ V(5, 4, 2), /* 240 */
- /* 01 */ V(2, 6, 2),
- /* 10 */ V(6, 2, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0001 0101 ... */
- /* 0 */ V(0, 8, 1), /* 244 */
- /* 1 */ V(8, 0, 1),
-
- /* 0001 0110 ... */
- /* 0 */ V(1, 6, 1), /* 246 */
- /* 1 */ V(6, 1, 1),
-
- /* 0001 0111 ... */
- /* 0 */ V(0, 6, 1), /* 248 */
- /* 1 */ V(6, 0, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(5, 3, 2), /* 250 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(5, 2, 1), /* 254 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(3, 4, 1), /* 256 */
- /* 1 */ V(4, 3, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(5, 0, 1), /* 258 */
- /* 1 */ V(2, 4, 1),
-
- /* 0001 1110 ... */
- /* 0 */ V(4, 2, 1), /* 260 */
- /* 1 */ V(3, 3, 1),
-
- /* 0000 0000 0000 ... */
- /* 0000 */ PTR(388, 3), /* 262 */
- /* 0001 */ V(15, 15, 4),
- /* 0010 */ V(14, 15, 4),
- /* 0011 */ V(13, 15, 4),
- /* 0100 */ V(14, 14, 4),
- /* 0101 */ V(12, 15, 4),
- /* 0110 */ V(13, 14, 4),
- /* 0111 */ V(11, 15, 4),
- /* 1000 */ V(15, 11, 4),
- /* 1001 */ V(12, 14, 4),
- /* 1010 */ V(13, 12, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 12, 3),
- /* 1101 */ V(14, 12, 3),
- /* 1110 */ V(13, 13, 3),
- /* 1111 */ V(13, 13, 3),
-
- /* 0000 0000 0001 ... */
- /* 0000 */ V(15, 10, 4), /* 278 */
- /* 0001 */ V(12, 13, 4),
- /* 0010 */ V(11, 14, 3),
- /* 0011 */ V(11, 14, 3),
- /* 0100 */ V(14, 11, 3),
- /* 0101 */ V(14, 11, 3),
- /* 0110 */ V(9, 15, 3),
- /* 0111 */ V(9, 15, 3),
- /* 1000 */ V(15, 9, 3),
- /* 1001 */ V(15, 9, 3),
- /* 1010 */ V(14, 10, 3),
- /* 1011 */ V(14, 10, 3),
- /* 1100 */ V(11, 13, 3),
- /* 1101 */ V(11, 13, 3),
- /* 1110 */ V(13, 11, 3),
- /* 1111 */ V(13, 11, 3),
-
- /* 0000 0000 0010 ... */
- /* 0000 */ V(8, 15, 3), /* 294 */
- /* 0001 */ V(8, 15, 3),
- /* 0010 */ V(15, 8, 3),
- /* 0011 */ V(15, 8, 3),
- /* 0100 */ V(12, 12, 3),
- /* 0101 */ V(12, 12, 3),
- /* 0110 */ V(10, 14, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(8, 14, 3),
- /* 1001 */ V(8, 14, 3),
- /* 1010 */ V(7, 15, 4),
- /* 1011 */ V(7, 14, 4),
- /* 1100 */ V(15, 7, 2),
- /* 1101 */ V(15, 7, 2),
- /* 1110 */ V(15, 7, 2),
- /* 1111 */ V(15, 7, 2),
-
- /* 0000 0000 0011 ... */
- /* 000 */ V(13, 10, 2), /* 310 */
- /* 001 */ V(13, 10, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(11, 12, 3),
- /* 100 */ V(12, 11, 3),
- /* 101 */ V(15, 6, 3),
- /* 110 */ V(6, 15, 2),
- /* 111 */ V(6, 15, 2),
-
- /* 0000 0000 0100 ... */
- /* 00 */ V(14, 8, 2), /* 318 */
- /* 01 */ V(5, 15, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(13, 9, 2),
-
- /* 0000 0000 0101 ... */
- /* 00 */ V(15, 5, 2), /* 322 */
- /* 01 */ V(14, 7, 2),
- /* 10 */ V(10, 12, 2),
- /* 11 */ V(11, 11, 2),
-
- /* 0000 0000 0110 ... */
- /* 000 */ V(4, 15, 2), /* 326 */
- /* 001 */ V(4, 15, 2),
- /* 010 */ V(15, 4, 2),
- /* 011 */ V(15, 4, 2),
- /* 100 */ V(12, 10, 3),
- /* 101 */ V(14, 6, 3),
- /* 110 */ V(15, 3, 2),
- /* 111 */ V(15, 3, 2),
-
- /* 0000 0000 0111 ... */
- /* 00 */ V(3, 15, 1), /* 334 */
- /* 01 */ V(3, 15, 1),
- /* 10 */ V(8, 13, 2),
- /* 11 */ V(13, 8, 2),
-
- /* 0000 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 338 */
- /* 1 */ V(15, 2, 1),
-
- /* 0000 0000 1001 ... */
- /* 00 */ V(6, 14, 2), /* 340 */
- /* 01 */ V(9, 12, 2),
- /* 10 */ V(0, 15, 1),
- /* 11 */ V(0, 15, 1),
-
- /* 0000 0000 1010 ... */
- /* 00 */ V(12, 9, 2), /* 344 */
- /* 01 */ V(5, 14, 2),
- /* 10 */ V(10, 11, 1),
- /* 11 */ V(10, 11, 1),
-
- /* 0000 0000 1011 ... */
- /* 00 */ V(7, 13, 2), /* 348 */
- /* 01 */ V(13, 7, 2),
- /* 10 */ V(4, 14, 1),
- /* 11 */ V(4, 14, 1),
-
- /* 0000 0000 1100 ... */
- /* 00 */ V(12, 8, 2), /* 352 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(3, 14, 1),
- /* 11 */ V(3, 14, 1),
-
- /* 0000 0000 1101 ... */
- /* 00 */ V(11, 9, 1), /* 356 */
- /* 01 */ V(11, 9, 1),
- /* 10 */ V(9, 11, 2),
- /* 11 */ V(10, 10, 2),
-
- /* 0000 0001 0001 ... */
- /* 0 */ V(11, 10, 1), /* 360 */
- /* 1 */ V(14, 5, 1),
-
- /* 0000 0001 0010 ... */
- /* 0 */ V(14, 4, 1), /* 362 */
- /* 1 */ V(8, 12, 1),
-
- /* 0000 0001 0011 ... */
- /* 0 */ V(6, 13, 1), /* 364 */
- /* 1 */ V(14, 3, 1),
-
- /* 0000 0001 0101 ... */
- /* 0 */ V(2, 14, 1), /* 366 */
- /* 1 */ V(0, 14, 1),
-
- /* 0000 0001 1000 ... */
- /* 0 */ V(14, 0, 1), /* 368 */
- /* 1 */ V(5, 13, 1),
-
- /* 0000 0001 1001 ... */
- /* 0 */ V(13, 5, 1), /* 370 */
- /* 1 */ V(7, 12, 1),
-
- /* 0000 0001 1010 ... */
- /* 0 */ V(12, 7, 1), /* 372 */
- /* 1 */ V(4, 13, 1),
-
- /* 0000 0001 1011 ... */
- /* 0 */ V(8, 11, 1), /* 374 */
- /* 1 */ V(11, 8, 1),
-
- /* 0000 0001 1100 ... */
- /* 0 */ V(13, 4, 1), /* 376 */
- /* 1 */ V(9, 10, 1),
-
- /* 0000 0001 1101 ... */
- /* 0 */ V(10, 9, 1), /* 378 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 0010 0000 ... */
- /* 0 */ V(13, 3, 1), /* 380 */
- /* 1 */ V(7, 11, 1),
-
- /* 0000 0010 0101 ... */
- /* 0 */ V(5, 12, 1), /* 382 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 0010 0110 ... */
- /* 0 */ V(9, 9, 1), /* 384 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 0010 1000 ... */
- /* 0 */ V(10, 7, 1), /* 386 */
- /* 1 */ V(9, 7, 1),
-
- /* 0000 0000 0000 0000 ... */
- /* 000 */ V(15, 14, 3), /* 388 */
- /* 001 */ V(15, 12, 3),
- /* 010 */ V(15, 13, 2),
- /* 011 */ V(15, 13, 2),
- /* 100 */ V(14, 13, 1),
- /* 101 */ V(14, 13, 1),
- /* 110 */ V(14, 13, 1),
- /* 111 */ V(14, 13, 1),
-
- /* 0000 0000 0000 1011 ... */
- /* 0 */ V(10, 15, 1), /* 396 */
- /* 1 */ V(14, 9, 1)
+union huffpair const hufftab13[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 4), /* 16 */
+ /* 0001 */ PTR(84, 4),
+ /* 0010 */ PTR(100, 4),
+ /* 0011 */ PTR(116, 4),
+ /* 0100 */ PTR(132, 4),
+ /* 0101 */ PTR(148, 4),
+ /* 0110 */ PTR(164, 3),
+ /* 0111 */ PTR(172, 3),
+ /* 1000 */ PTR(180, 3),
+ /* 1001 */ PTR(188, 3),
+ /* 1010 */ PTR(196, 3),
+ /* 1011 */ PTR(204, 3),
+ /* 1100 */ PTR(212, 1),
+ /* 1101 */ PTR(214, 2),
+ /* 1110 */ PTR(218, 3),
+ /* 1111 */ PTR(226, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(228, 2), /* 32 */
+ /* 0001 */ PTR(232, 2),
+ /* 0010 */ PTR(236, 2),
+ /* 0011 */ PTR(240, 2),
+ /* 0100 */ V(8, 1, 4),
+ /* 0101 */ PTR(244, 1),
+ /* 0110 */ PTR(246, 1),
+ /* 0111 */ PTR(248, 1),
+ /* 1000 */ PTR(250, 2),
+ /* 1001 */ PTR(254, 1),
+ /* 1010 */ V(1, 5, 4),
+ /* 1011 */ V(5, 1, 4),
+ /* 1100 */ PTR(256, 1),
+ /* 1101 */ PTR(258, 1),
+ /* 1110 */ PTR(260, 1),
+ /* 1111 */ V(1, 4, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(4, 1, 3), /* 48 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 4),
+ /* 0101 */ V(3, 2, 4),
+ /* 0110 */ V(1, 3, 3),
+ /* 0111 */ V(1, 3, 3),
+ /* 1000 */ V(3, 1, 3),
+ /* 1001 */ V(3, 1, 3),
+ /* 1010 */ V(0, 3, 3),
+ /* 1011 */ V(0, 3, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(262, 4), /* 68 */
+ /* 0001 */ PTR(278, 4),
+ /* 0010 */ PTR(294, 4),
+ /* 0011 */ PTR(310, 3),
+ /* 0100 */ PTR(318, 2),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 3),
+ /* 0111 */ PTR(334, 2),
+ /* 1000 */ PTR(338, 1),
+ /* 1001 */ PTR(340, 2),
+ /* 1010 */ PTR(344, 2),
+ /* 1011 */ PTR(348, 2),
+ /* 1100 */ PTR(352, 2),
+ /* 1101 */ PTR(356, 2),
+ /* 1110 */ V(1, 15, 4),
+ /* 1111 */ V(15, 1, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 0, 4), /* 84 */
+ /* 0001 */ PTR(360, 1),
+ /* 0010 */ PTR(362, 1),
+ /* 0011 */ PTR(364, 1),
+ /* 0100 */ V(14, 2, 4),
+ /* 0101 */ PTR(366, 1),
+ /* 0110 */ V(1, 14, 4),
+ /* 0111 */ V(14, 1, 4),
+ /* 1000 */ PTR(368, 1),
+ /* 1001 */ PTR(370, 1),
+ /* 1010 */ PTR(372, 1),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 1),
+ /* 1101 */ PTR(378, 1),
+ /* 1110 */ V(12, 6, 4),
+ /* 1111 */ V(3, 13, 4),
+
+ /* 0000 0010 ... */
+ /* 0000 */ PTR(380, 1), /* 100 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(1, 13, 4),
+ /* 0100 */ V(11, 7, 4),
+ /* 0101 */ PTR(382, 1),
+ /* 0110 */ PTR(384, 1),
+ /* 0111 */ V(12, 3, 4),
+ /* 1000 */ PTR(386, 1),
+ /* 1001 */ V(4, 11, 4),
+ /* 1010 */ V(13, 1, 3),
+ /* 1011 */ V(13, 1, 3),
+ /* 1100 */ V(0, 13, 4),
+ /* 1101 */ V(13, 0, 4),
+ /* 1110 */ V(8, 10, 4),
+ /* 1111 */ V(10, 8, 4),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(4, 12, 4), /* 116 */
+ /* 0001 */ V(12, 4, 4),
+ /* 0010 */ V(6, 11, 4),
+ /* 0011 */ V(11, 6, 4),
+ /* 0100 */ V(3, 12, 3),
+ /* 0101 */ V(3, 12, 3),
+ /* 0110 */ V(2, 12, 3),
+ /* 0111 */ V(2, 12, 3),
+ /* 1000 */ V(12, 2, 3),
+ /* 1001 */ V(12, 2, 3),
+ /* 1010 */ V(5, 11, 3),
+ /* 1011 */ V(5, 11, 3),
+ /* 1100 */ V(11, 5, 4),
+ /* 1101 */ V(8, 9, 4),
+ /* 1110 */ V(1, 12, 3),
+ /* 1111 */ V(1, 12, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(12, 1, 3), /* 132 */
+ /* 0001 */ V(12, 1, 3),
+ /* 0010 */ V(9, 8, 4),
+ /* 0011 */ V(0, 12, 4),
+ /* 0100 */ V(12, 0, 3),
+ /* 0101 */ V(12, 0, 3),
+ /* 0110 */ V(11, 4, 4),
+ /* 0111 */ V(6, 10, 4),
+ /* 1000 */ V(10, 6, 4),
+ /* 1001 */ V(7, 9, 4),
+ /* 1010 */ V(3, 11, 3),
+ /* 1011 */ V(3, 11, 3),
+ /* 1100 */ V(11, 3, 3),
+ /* 1101 */ V(11, 3, 3),
+ /* 1110 */ V(8, 8, 4),
+ /* 1111 */ V(5, 10, 4),
+
+ /* 0000 0101 ... */
+ /* 0000 */ V(2, 11, 3), /* 148 */
+ /* 0001 */ V(2, 11, 3),
+ /* 0010 */ V(10, 5, 4),
+ /* 0011 */ V(6, 9, 4),
+ /* 0100 */ V(10, 4, 3),
+ /* 0101 */ V(10, 4, 3),
+ /* 0110 */ V(7, 8, 4),
+ /* 0111 */ V(8, 7, 4),
+ /* 1000 */ V(9, 4, 3),
+ /* 1001 */ V(9, 4, 3),
+ /* 1010 */ V(7, 7, 4),
+ /* 1011 */ V(7, 6, 4),
+ /* 1100 */ V(11, 2, 2),
+ /* 1101 */ V(11, 2, 2),
+ /* 1110 */ V(11, 2, 2),
+ /* 1111 */ V(11, 2, 2),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(1, 11, 2), /* 164 */
+ /* 001 */ V(1, 11, 2),
+ /* 010 */ V(11, 1, 2),
+ /* 011 */ V(11, 1, 2),
+ /* 100 */ V(0, 11, 3),
+ /* 101 */ V(11, 0, 3),
+ /* 110 */ V(9, 6, 3),
+ /* 111 */ V(4, 10, 3),
+
+ /* 0000 0111 ... */
+ /* 000 */ V(3, 10, 3), /* 172 */
+ /* 001 */ V(10, 3, 3),
+ /* 010 */ V(5, 9, 3),
+ /* 011 */ V(9, 5, 3),
+ /* 100 */ V(2, 10, 2),
+ /* 101 */ V(2, 10, 2),
+ /* 110 */ V(10, 2, 2),
+ /* 111 */ V(10, 2, 2),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(1, 10, 2), /* 180 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(10, 1, 2),
+ /* 011 */ V(10, 1, 2),
+ /* 100 */ V(0, 10, 3),
+ /* 101 */ V(6, 8, 3),
+ /* 110 */ V(10, 0, 2),
+ /* 111 */ V(10, 0, 2),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(8, 6, 3), /* 188 */
+ /* 001 */ V(4, 9, 3),
+ /* 010 */ V(9, 3, 2),
+ /* 011 */ V(9, 3, 2),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(5, 8, 3),
+ /* 110 */ V(8, 5, 3),
+ /* 111 */ V(6, 7, 3),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 9, 2), /* 196 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(5, 7, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 2),
+ /* 111 */ V(3, 8, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(8, 3, 2), /* 204 */
+ /* 001 */ V(8, 3, 2),
+ /* 010 */ V(6, 6, 3),
+ /* 011 */ V(4, 7, 3),
+ /* 100 */ V(7, 4, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(6, 5, 3),
+ /* 111 */ V(7, 3, 3),
+
+ /* 0000 1100 ... */
+ /* 0 */ V(1, 9, 1), /* 212 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0000 1101 ... */
+ /* 00 */ V(0, 9, 2), /* 214 */
+ /* 01 */ V(9, 0, 2),
+ /* 10 */ V(4, 8, 2),
+ /* 11 */ V(8, 4, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 2, 2), /* 218 */
+ /* 001 */ V(7, 2, 2),
+ /* 010 */ V(4, 6, 3),
+ /* 011 */ V(6, 4, 3),
+ /* 100 */ V(2, 8, 1),
+ /* 101 */ V(2, 8, 1),
+ /* 110 */ V(2, 8, 1),
+ /* 111 */ V(2, 8, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(8, 2, 1), /* 226 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(3, 7, 2), /* 228 */
+ /* 01 */ V(2, 7, 2),
+ /* 10 */ V(1, 7, 1),
+ /* 11 */ V(1, 7, 1),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(7, 1, 1), /* 232 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(5, 5, 2),
+ /* 11 */ V(0, 7, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(7, 0, 2), /* 236 */
+ /* 01 */ V(3, 6, 2),
+ /* 10 */ V(6, 3, 2),
+ /* 11 */ V(4, 5, 2),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(5, 4, 2), /* 240 */
+ /* 01 */ V(2, 6, 2),
+ /* 10 */ V(6, 2, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0001 0101 ... */
+ /* 0 */ V(0, 8, 1), /* 244 */
+ /* 1 */ V(8, 0, 1),
+
+ /* 0001 0110 ... */
+ /* 0 */ V(1, 6, 1), /* 246 */
+ /* 1 */ V(6, 1, 1),
+
+ /* 0001 0111 ... */
+ /* 0 */ V(0, 6, 1), /* 248 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(5, 3, 2), /* 250 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(5, 2, 1), /* 254 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(3, 4, 1), /* 256 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(5, 0, 1), /* 258 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0001 1110 ... */
+ /* 0 */ V(4, 2, 1), /* 260 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0000 */ PTR(388, 3), /* 262 */
+ /* 0001 */ V(15, 15, 4),
+ /* 0010 */ V(14, 15, 4),
+ /* 0011 */ V(13, 15, 4),
+ /* 0100 */ V(14, 14, 4),
+ /* 0101 */ V(12, 15, 4),
+ /* 0110 */ V(13, 14, 4),
+ /* 0111 */ V(11, 15, 4),
+ /* 1000 */ V(15, 11, 4),
+ /* 1001 */ V(12, 14, 4),
+ /* 1010 */ V(13, 12, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 12, 3),
+ /* 1101 */ V(14, 12, 3),
+ /* 1110 */ V(13, 13, 3),
+ /* 1111 */ V(13, 13, 3),
+
+ /* 0000 0000 0001 ... */
+ /* 0000 */ V(15, 10, 4), /* 278 */
+ /* 0001 */ V(12, 13, 4),
+ /* 0010 */ V(11, 14, 3),
+ /* 0011 */ V(11, 14, 3),
+ /* 0100 */ V(14, 11, 3),
+ /* 0101 */ V(14, 11, 3),
+ /* 0110 */ V(9, 15, 3),
+ /* 0111 */ V(9, 15, 3),
+ /* 1000 */ V(15, 9, 3),
+ /* 1001 */ V(15, 9, 3),
+ /* 1010 */ V(14, 10, 3),
+ /* 1011 */ V(14, 10, 3),
+ /* 1100 */ V(11, 13, 3),
+ /* 1101 */ V(11, 13, 3),
+ /* 1110 */ V(13, 11, 3),
+ /* 1111 */ V(13, 11, 3),
+
+ /* 0000 0000 0010 ... */
+ /* 0000 */ V(8, 15, 3), /* 294 */
+ /* 0001 */ V(8, 15, 3),
+ /* 0010 */ V(15, 8, 3),
+ /* 0011 */ V(15, 8, 3),
+ /* 0100 */ V(12, 12, 3),
+ /* 0101 */ V(12, 12, 3),
+ /* 0110 */ V(10, 14, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(8, 14, 3),
+ /* 1001 */ V(8, 14, 3),
+ /* 1010 */ V(7, 15, 4),
+ /* 1011 */ V(7, 14, 4),
+ /* 1100 */ V(15, 7, 2),
+ /* 1101 */ V(15, 7, 2),
+ /* 1110 */ V(15, 7, 2),
+ /* 1111 */ V(15, 7, 2),
+
+ /* 0000 0000 0011 ... */
+ /* 000 */ V(13, 10, 2), /* 310 */
+ /* 001 */ V(13, 10, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(11, 12, 3),
+ /* 100 */ V(12, 11, 3),
+ /* 101 */ V(15, 6, 3),
+ /* 110 */ V(6, 15, 2),
+ /* 111 */ V(6, 15, 2),
+
+ /* 0000 0000 0100 ... */
+ /* 00 */ V(14, 8, 2), /* 318 */
+ /* 01 */ V(5, 15, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(13, 9, 2),
+
+ /* 0000 0000 0101 ... */
+ /* 00 */ V(15, 5, 2), /* 322 */
+ /* 01 */ V(14, 7, 2),
+ /* 10 */ V(10, 12, 2),
+ /* 11 */ V(11, 11, 2),
+
+ /* 0000 0000 0110 ... */
+ /* 000 */ V(4, 15, 2), /* 326 */
+ /* 001 */ V(4, 15, 2),
+ /* 010 */ V(15, 4, 2),
+ /* 011 */ V(15, 4, 2),
+ /* 100 */ V(12, 10, 3),
+ /* 101 */ V(14, 6, 3),
+ /* 110 */ V(15, 3, 2),
+ /* 111 */ V(15, 3, 2),
+
+ /* 0000 0000 0111 ... */
+ /* 00 */ V(3, 15, 1), /* 334 */
+ /* 01 */ V(3, 15, 1),
+ /* 10 */ V(8, 13, 2),
+ /* 11 */ V(13, 8, 2),
+
+ /* 0000 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 338 */
+ /* 1 */ V(15, 2, 1),
+
+ /* 0000 0000 1001 ... */
+ /* 00 */ V(6, 14, 2), /* 340 */
+ /* 01 */ V(9, 12, 2),
+ /* 10 */ V(0, 15, 1),
+ /* 11 */ V(0, 15, 1),
+
+ /* 0000 0000 1010 ... */
+ /* 00 */ V(12, 9, 2), /* 344 */
+ /* 01 */ V(5, 14, 2),
+ /* 10 */ V(10, 11, 1),
+ /* 11 */ V(10, 11, 1),
+
+ /* 0000 0000 1011 ... */
+ /* 00 */ V(7, 13, 2), /* 348 */
+ /* 01 */ V(13, 7, 2),
+ /* 10 */ V(4, 14, 1),
+ /* 11 */ V(4, 14, 1),
+
+ /* 0000 0000 1100 ... */
+ /* 00 */ V(12, 8, 2), /* 352 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(3, 14, 1),
+ /* 11 */ V(3, 14, 1),
+
+ /* 0000 0000 1101 ... */
+ /* 00 */ V(11, 9, 1), /* 356 */
+ /* 01 */ V(11, 9, 1),
+ /* 10 */ V(9, 11, 2),
+ /* 11 */ V(10, 10, 2),
+
+ /* 0000 0001 0001 ... */
+ /* 0 */ V(11, 10, 1), /* 360 */
+ /* 1 */ V(14, 5, 1),
+
+ /* 0000 0001 0010 ... */
+ /* 0 */ V(14, 4, 1), /* 362 */
+ /* 1 */ V(8, 12, 1),
+
+ /* 0000 0001 0011 ... */
+ /* 0 */ V(6, 13, 1), /* 364 */
+ /* 1 */ V(14, 3, 1),
+
+ /* 0000 0001 0101 ... */
+ /* 0 */ V(2, 14, 1), /* 366 */
+ /* 1 */ V(0, 14, 1),
+
+ /* 0000 0001 1000 ... */
+ /* 0 */ V(14, 0, 1), /* 368 */
+ /* 1 */ V(5, 13, 1),
+
+ /* 0000 0001 1001 ... */
+ /* 0 */ V(13, 5, 1), /* 370 */
+ /* 1 */ V(7, 12, 1),
+
+ /* 0000 0001 1010 ... */
+ /* 0 */ V(12, 7, 1), /* 372 */
+ /* 1 */ V(4, 13, 1),
+
+ /* 0000 0001 1011 ... */
+ /* 0 */ V(8, 11, 1), /* 374 */
+ /* 1 */ V(11, 8, 1),
+
+ /* 0000 0001 1100 ... */
+ /* 0 */ V(13, 4, 1), /* 376 */
+ /* 1 */ V(9, 10, 1),
+
+ /* 0000 0001 1101 ... */
+ /* 0 */ V(10, 9, 1), /* 378 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 0010 0000 ... */
+ /* 0 */ V(13, 3, 1), /* 380 */
+ /* 1 */ V(7, 11, 1),
+
+ /* 0000 0010 0101 ... */
+ /* 0 */ V(5, 12, 1), /* 382 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 0010 0110 ... */
+ /* 0 */ V(9, 9, 1), /* 384 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 0010 1000 ... */
+ /* 0 */ V(10, 7, 1), /* 386 */
+ /* 1 */ V(9, 7, 1),
+
+ /* 0000 0000 0000 0000 ... */
+ /* 000 */ V(15, 14, 3), /* 388 */
+ /* 001 */ V(15, 12, 3),
+ /* 010 */ V(15, 13, 2),
+ /* 011 */ V(15, 13, 2),
+ /* 100 */ V(14, 13, 1),
+ /* 101 */ V(14, 13, 1),
+ /* 110 */ V(14, 13, 1),
+ /* 111 */ V(14, 13, 1),
+
+ /* 0000 0000 0000 1011 ... */
+ /* 0 */ V(10, 15, 1), /* 396 */
+ /* 1 */ V(14, 9, 1)
};
static
-union huffpair const hufftab15[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 4),
- /* 0100 */ PTR(80, 4),
- /* 0101 */ PTR(96, 3),
- /* 0110 */ PTR(104, 3),
- /* 0111 */ PTR(112, 2),
- /* 1000 */ PTR(116, 1),
- /* 1001 */ PTR(118, 1),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 4),
- /* 1101 */ V(1, 0, 4),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(120, 4), /* 16 */
- /* 0001 */ PTR(136, 4),
- /* 0010 */ PTR(152, 4),
- /* 0011 */ PTR(168, 4),
- /* 0100 */ PTR(184, 4),
- /* 0101 */ PTR(200, 3),
- /* 0110 */ PTR(208, 3),
- /* 0111 */ PTR(216, 4),
- /* 1000 */ PTR(232, 3),
- /* 1001 */ PTR(240, 3),
- /* 1010 */ PTR(248, 3),
- /* 1011 */ PTR(256, 3),
- /* 1100 */ PTR(264, 2),
- /* 1101 */ PTR(268, 3),
- /* 1110 */ PTR(276, 3),
- /* 1111 */ PTR(284, 2),
-
- /* 0001 ... */
- /* 0000 */ PTR(288, 2), /* 32 */
- /* 0001 */ PTR(292, 2),
- /* 0010 */ PTR(296, 2),
- /* 0011 */ PTR(300, 2),
- /* 0100 */ PTR(304, 2),
- /* 0101 */ PTR(308, 2),
- /* 0110 */ PTR(312, 2),
- /* 0111 */ PTR(316, 2),
- /* 1000 */ PTR(320, 1),
- /* 1001 */ PTR(322, 1),
- /* 1010 */ PTR(324, 1),
- /* 1011 */ PTR(326, 2),
- /* 1100 */ PTR(330, 1),
- /* 1101 */ PTR(332, 1),
- /* 1110 */ PTR(334, 2),
- /* 1111 */ PTR(338, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(340, 1), /* 48 */
- /* 0001 */ PTR(342, 1),
- /* 0010 */ V(9, 1, 4),
- /* 0011 */ PTR(344, 1),
- /* 0100 */ PTR(346, 1),
- /* 0101 */ PTR(348, 1),
- /* 0110 */ PTR(350, 1),
- /* 0111 */ PTR(352, 1),
- /* 1000 */ V(2, 8, 4),
- /* 1001 */ V(8, 2, 4),
- /* 1010 */ V(1, 8, 4),
- /* 1011 */ V(8, 1, 4),
- /* 1100 */ PTR(354, 1),
- /* 1101 */ PTR(356, 1),
- /* 1110 */ PTR(358, 1),
- /* 1111 */ PTR(360, 1),
-
- /* 0011 ... */
- /* 0000 */ V(2, 7, 4), /* 64 */
- /* 0001 */ V(7, 2, 4),
- /* 0010 */ V(6, 4, 4),
- /* 0011 */ V(1, 7, 4),
- /* 0100 */ V(5, 5, 4),
- /* 0101 */ V(7, 1, 4),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ V(3, 6, 4),
- /* 1000 */ V(6, 3, 4),
- /* 1001 */ V(4, 5, 4),
- /* 1010 */ V(5, 4, 4),
- /* 1011 */ V(2, 6, 4),
- /* 1100 */ V(6, 2, 4),
- /* 1101 */ V(1, 6, 4),
- /* 1110 */ PTR(364, 1),
- /* 1111 */ V(3, 5, 4),
-
- /* 0100 ... */
- /* 0000 */ V(6, 1, 3), /* 80 */
- /* 0001 */ V(6, 1, 3),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ V(4, 4, 4),
- /* 0100 */ V(2, 5, 3),
- /* 0101 */ V(2, 5, 3),
- /* 0110 */ V(5, 2, 3),
- /* 0111 */ V(5, 2, 3),
- /* 1000 */ V(1, 5, 3),
- /* 1001 */ V(1, 5, 3),
- /* 1010 */ V(5, 1, 3),
- /* 1011 */ V(5, 1, 3),
- /* 1100 */ V(0, 5, 4),
- /* 1101 */ V(5, 0, 4),
- /* 1110 */ V(3, 4, 3),
- /* 1111 */ V(3, 4, 3),
-
- /* 0101 ... */
- /* 000 */ V(4, 3, 3), /* 96 */
- /* 001 */ V(2, 4, 3),
- /* 010 */ V(4, 2, 3),
- /* 011 */ V(3, 3, 3),
- /* 100 */ V(4, 1, 2),
- /* 101 */ V(4, 1, 2),
- /* 110 */ V(1, 4, 3),
- /* 111 */ V(0, 4, 3),
-
- /* 0110 ... */
- /* 000 */ V(2, 3, 2), /* 104 */
- /* 001 */ V(2, 3, 2),
- /* 010 */ V(3, 2, 2),
- /* 011 */ V(3, 2, 2),
- /* 100 */ V(4, 0, 3),
- /* 101 */ V(0, 3, 3),
- /* 110 */ V(1, 3, 2),
- /* 111 */ V(1, 3, 2),
-
- /* 0111 ... */
- /* 00 */ V(3, 1, 2), /* 112 */
- /* 01 */ V(3, 0, 2),
- /* 10 */ V(2, 2, 1),
- /* 11 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(1, 2, 1), /* 116 */
- /* 1 */ V(2, 1, 1),
-
- /* 1001 ... */
- /* 0 */ V(0, 2, 1), /* 118 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(366, 1), /* 120 */
- /* 0001 */ PTR(368, 1),
- /* 0010 */ V(14, 14, 4),
- /* 0011 */ PTR(370, 1),
- /* 0100 */ PTR(372, 1),
- /* 0101 */ PTR(374, 1),
- /* 0110 */ V(15, 11, 4),
- /* 0111 */ PTR(376, 1),
- /* 1000 */ V(13, 13, 4),
- /* 1001 */ V(10, 15, 4),
- /* 1010 */ V(15, 10, 4),
- /* 1011 */ V(11, 14, 4),
- /* 1100 */ V(14, 11, 4),
- /* 1101 */ V(12, 13, 4),
- /* 1110 */ V(13, 12, 4),
- /* 1111 */ V(9, 15, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 9, 4), /* 136 */
- /* 0001 */ V(14, 10, 4),
- /* 0010 */ V(11, 13, 4),
- /* 0011 */ V(13, 11, 4),
- /* 0100 */ V(8, 15, 4),
- /* 0101 */ V(15, 8, 4),
- /* 0110 */ V(12, 12, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(14, 9, 4),
- /* 1001 */ V(7, 15, 4),
- /* 1010 */ V(15, 7, 4),
- /* 1011 */ V(10, 13, 4),
- /* 1100 */ V(13, 10, 4),
- /* 1101 */ V(11, 12, 4),
- /* 1110 */ V(6, 15, 4),
- /* 1111 */ PTR(378, 1),
-
- /* 0000 0010 ... */
- /* 0000 */ V(12, 11, 3), /* 152 */
- /* 0001 */ V(12, 11, 3),
- /* 0010 */ V(15, 6, 3),
- /* 0011 */ V(15, 6, 3),
- /* 0100 */ V(8, 14, 4),
- /* 0101 */ V(14, 8, 4),
- /* 0110 */ V(5, 15, 4),
- /* 0111 */ V(9, 13, 4),
- /* 1000 */ V(15, 5, 3),
- /* 1001 */ V(15, 5, 3),
- /* 1010 */ V(7, 14, 3),
- /* 1011 */ V(7, 14, 3),
- /* 1100 */ V(14, 7, 3),
- /* 1101 */ V(14, 7, 3),
- /* 1110 */ V(10, 12, 3),
- /* 1111 */ V(10, 12, 3),
-
- /* 0000 0011 ... */
- /* 0000 */ V(12, 10, 3), /* 168 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(13, 9, 4),
- /* 0101 */ V(8, 13, 4),
- /* 0110 */ V(4, 15, 3),
- /* 0111 */ V(4, 15, 3),
- /* 1000 */ V(15, 4, 3),
- /* 1001 */ V(15, 4, 3),
- /* 1010 */ V(3, 15, 3),
- /* 1011 */ V(3, 15, 3),
- /* 1100 */ V(15, 3, 3),
- /* 1101 */ V(15, 3, 3),
- /* 1110 */ V(13, 8, 3),
- /* 1111 */ V(13, 8, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(14, 6, 3), /* 184 */
- /* 0001 */ V(14, 6, 3),
- /* 0010 */ V(2, 15, 3),
- /* 0011 */ V(2, 15, 3),
- /* 0100 */ V(15, 2, 3),
- /* 0101 */ V(15, 2, 3),
- /* 0110 */ V(6, 14, 4),
- /* 0111 */ V(15, 0, 4),
- /* 1000 */ V(1, 15, 3),
- /* 1001 */ V(1, 15, 3),
- /* 1010 */ V(15, 1, 3),
- /* 1011 */ V(15, 1, 3),
- /* 1100 */ V(9, 12, 3),
- /* 1101 */ V(9, 12, 3),
- /* 1110 */ V(12, 9, 3),
- /* 1111 */ V(12, 9, 3),
-
- /* 0000 0101 ... */
- /* 000 */ V(5, 14, 3), /* 200 */
- /* 001 */ V(10, 11, 3),
- /* 010 */ V(11, 10, 3),
- /* 011 */ V(14, 5, 3),
- /* 100 */ V(7, 13, 3),
- /* 101 */ V(13, 7, 3),
- /* 110 */ V(4, 14, 3),
- /* 111 */ V(14, 4, 3),
-
- /* 0000 0110 ... */
- /* 000 */ V(8, 12, 3), /* 208 */
- /* 001 */ V(12, 8, 3),
- /* 010 */ V(3, 14, 3),
- /* 011 */ V(6, 13, 3),
- /* 100 */ V(13, 6, 3),
- /* 101 */ V(14, 3, 3),
- /* 110 */ V(9, 11, 3),
- /* 111 */ V(11, 9, 3),
-
- /* 0000 0111 ... */
- /* 0000 */ V(2, 14, 3), /* 216 */
- /* 0001 */ V(2, 14, 3),
- /* 0010 */ V(10, 10, 3),
- /* 0011 */ V(10, 10, 3),
- /* 0100 */ V(14, 2, 3),
- /* 0101 */ V(14, 2, 3),
- /* 0110 */ V(1, 14, 3),
- /* 0111 */ V(1, 14, 3),
- /* 1000 */ V(14, 1, 3),
- /* 1001 */ V(14, 1, 3),
- /* 1010 */ V(0, 14, 4),
- /* 1011 */ V(14, 0, 4),
- /* 1100 */ V(5, 13, 3),
- /* 1101 */ V(5, 13, 3),
- /* 1110 */ V(13, 5, 3),
- /* 1111 */ V(13, 5, 3),
-
- /* 0000 1000 ... */
- /* 000 */ V(7, 12, 3), /* 232 */
- /* 001 */ V(12, 7, 3),
- /* 010 */ V(4, 13, 3),
- /* 011 */ V(8, 11, 3),
- /* 100 */ V(13, 4, 2),
- /* 101 */ V(13, 4, 2),
- /* 110 */ V(11, 8, 3),
- /* 111 */ V(9, 10, 3),
-
- /* 0000 1001 ... */
- /* 000 */ V(10, 9, 3), /* 240 */
- /* 001 */ V(6, 12, 3),
- /* 010 */ V(12, 6, 3),
- /* 011 */ V(3, 13, 3),
- /* 100 */ V(13, 3, 2),
- /* 101 */ V(13, 3, 2),
- /* 110 */ V(13, 2, 2),
- /* 111 */ V(13, 2, 2),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 13, 3), /* 248 */
- /* 001 */ V(0, 13, 3),
- /* 010 */ V(1, 13, 2),
- /* 011 */ V(1, 13, 2),
- /* 100 */ V(7, 11, 2),
- /* 101 */ V(7, 11, 2),
- /* 110 */ V(11, 7, 2),
- /* 111 */ V(11, 7, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(13, 1, 2), /* 256 */
- /* 001 */ V(13, 1, 2),
- /* 010 */ V(5, 12, 3),
- /* 011 */ V(13, 0, 3),
- /* 100 */ V(12, 5, 2),
- /* 101 */ V(12, 5, 2),
- /* 110 */ V(8, 10, 2),
- /* 111 */ V(8, 10, 2),
-
- /* 0000 1100 ... */
- /* 00 */ V(10, 8, 2), /* 264 */
- /* 01 */ V(4, 12, 2),
- /* 10 */ V(12, 4, 2),
- /* 11 */ V(6, 11, 2),
-
- /* 0000 1101 ... */
- /* 000 */ V(11, 6, 2), /* 268 */
- /* 001 */ V(11, 6, 2),
- /* 010 */ V(9, 9, 3),
- /* 011 */ V(0, 12, 3),
- /* 100 */ V(3, 12, 2),
- /* 101 */ V(3, 12, 2),
- /* 110 */ V(12, 3, 2),
- /* 111 */ V(12, 3, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 10, 2), /* 276 */
- /* 001 */ V(7, 10, 2),
- /* 010 */ V(10, 7, 2),
- /* 011 */ V(10, 7, 2),
- /* 100 */ V(10, 6, 2),
- /* 101 */ V(10, 6, 2),
- /* 110 */ V(12, 0, 3),
- /* 111 */ V(0, 11, 3),
-
- /* 0000 1111 ... */
- /* 00 */ V(12, 2, 1), /* 284 */
- /* 01 */ V(12, 2, 1),
- /* 10 */ V(2, 12, 2),
- /* 11 */ V(5, 11, 2),
-
- /* 0001 0000 ... */
- /* 00 */ V(11, 5, 2), /* 288 */
- /* 01 */ V(1, 12, 2),
- /* 10 */ V(8, 9, 2),
- /* 11 */ V(9, 8, 2),
-
- /* 0001 0001 ... */
- /* 00 */ V(12, 1, 2), /* 292 */
- /* 01 */ V(4, 11, 2),
- /* 10 */ V(11, 4, 2),
- /* 11 */ V(6, 10, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(3, 11, 2), /* 296 */
- /* 01 */ V(7, 9, 2),
- /* 10 */ V(11, 3, 1),
- /* 11 */ V(11, 3, 1),
-
- /* 0001 0011 ... */
- /* 00 */ V(9, 7, 2), /* 300 */
- /* 01 */ V(8, 8, 2),
- /* 10 */ V(2, 11, 2),
- /* 11 */ V(5, 10, 2),
-
- /* 0001 0100 ... */
- /* 00 */ V(11, 2, 1), /* 304 */
- /* 01 */ V(11, 2, 1),
- /* 10 */ V(10, 5, 2),
- /* 11 */ V(1, 11, 2),
-
- /* 0001 0101 ... */
- /* 00 */ V(11, 1, 1), /* 308 */
- /* 01 */ V(11, 1, 1),
- /* 10 */ V(11, 0, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0001 0110 ... */
- /* 00 */ V(9, 6, 2), /* 312 */
- /* 01 */ V(4, 10, 2),
- /* 10 */ V(10, 4, 2),
- /* 11 */ V(7, 8, 2),
-
- /* 0001 0111 ... */
- /* 00 */ V(8, 7, 2), /* 316 */
- /* 01 */ V(3, 10, 2),
- /* 10 */ V(10, 3, 1),
- /* 11 */ V(10, 3, 1),
-
- /* 0001 1000 ... */
- /* 0 */ V(5, 9, 1), /* 320 */
- /* 1 */ V(9, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(2, 10, 1), /* 322 */
- /* 1 */ V(10, 2, 1),
-
- /* 0001 1010 ... */
- /* 0 */ V(1, 10, 1), /* 324 */
- /* 1 */ V(10, 1, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(0, 10, 2), /* 326 */
- /* 01 */ V(10, 0, 2),
- /* 10 */ V(6, 8, 1),
- /* 11 */ V(6, 8, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(8, 6, 1), /* 330 */
- /* 1 */ V(4, 9, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(9, 4, 1), /* 332 */
- /* 1 */ V(3, 9, 1),
-
- /* 0001 1110 ... */
- /* 00 */ V(9, 3, 1), /* 334 */
- /* 01 */ V(9, 3, 1),
- /* 10 */ V(7, 7, 2),
- /* 11 */ V(0, 9, 2),
-
- /* 0001 1111 ... */
- /* 0 */ V(5, 8, 1), /* 338 */
- /* 1 */ V(8, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(2, 9, 1), /* 340 */
- /* 1 */ V(6, 7, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(7, 6, 1), /* 342 */
- /* 1 */ V(9, 2, 1),
-
- /* 0010 0011 ... */
- /* 0 */ V(1, 9, 1), /* 344 */
- /* 1 */ V(9, 0, 1),
-
- /* 0010 0100 ... */
- /* 0 */ V(4, 8, 1), /* 346 */
- /* 1 */ V(8, 4, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(5, 7, 1), /* 348 */
- /* 1 */ V(7, 5, 1),
-
- /* 0010 0110 ... */
- /* 0 */ V(3, 8, 1), /* 350 */
- /* 1 */ V(8, 3, 1),
-
- /* 0010 0111 ... */
- /* 0 */ V(6, 6, 1), /* 352 */
- /* 1 */ V(4, 7, 1),
-
- /* 0010 1100 ... */
- /* 0 */ V(7, 4, 1), /* 354 */
- /* 1 */ V(0, 8, 1),
-
- /* 0010 1101 ... */
- /* 0 */ V(8, 0, 1), /* 356 */
- /* 1 */ V(5, 6, 1),
-
- /* 0010 1110 ... */
- /* 0 */ V(6, 5, 1), /* 358 */
- /* 1 */ V(3, 7, 1),
-
- /* 0010 1111 ... */
- /* 0 */ V(7, 3, 1), /* 360 */
- /* 1 */ V(4, 6, 1),
-
- /* 0011 0110 ... */
- /* 0 */ V(0, 7, 1), /* 362 */
- /* 1 */ V(7, 0, 1),
-
- /* 0011 1110 ... */
- /* 0 */ V(0, 6, 1), /* 364 */
- /* 1 */ V(6, 0, 1),
-
- /* 0000 0000 0000 ... */
- /* 0 */ V(15, 15, 1), /* 366 */
- /* 1 */ V(14, 15, 1),
-
- /* 0000 0000 0001 ... */
- /* 0 */ V(15, 14, 1), /* 368 */
- /* 1 */ V(13, 15, 1),
-
- /* 0000 0000 0011 ... */
- /* 0 */ V(15, 13, 1), /* 370 */
- /* 1 */ V(12, 15, 1),
-
- /* 0000 0000 0100 ... */
- /* 0 */ V(15, 12, 1), /* 372 */
- /* 1 */ V(13, 14, 1),
-
- /* 0000 0000 0101 ... */
- /* 0 */ V(14, 13, 1), /* 374 */
- /* 1 */ V(11, 15, 1),
-
- /* 0000 0000 0111 ... */
- /* 0 */ V(12, 14, 1), /* 376 */
- /* 1 */ V(14, 12, 1),
-
- /* 0000 0001 1111 ... */
- /* 0 */ V(10, 14, 1), /* 378 */
- /* 1 */ V(0, 15, 1)
+union huffpair const hufftab15[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 4),
+ /* 0100 */ PTR(80, 4),
+ /* 0101 */ PTR(96, 3),
+ /* 0110 */ PTR(104, 3),
+ /* 0111 */ PTR(112, 2),
+ /* 1000 */ PTR(116, 1),
+ /* 1001 */ PTR(118, 1),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 4),
+ /* 1101 */ V(1, 0, 4),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(120, 4), /* 16 */
+ /* 0001 */ PTR(136, 4),
+ /* 0010 */ PTR(152, 4),
+ /* 0011 */ PTR(168, 4),
+ /* 0100 */ PTR(184, 4),
+ /* 0101 */ PTR(200, 3),
+ /* 0110 */ PTR(208, 3),
+ /* 0111 */ PTR(216, 4),
+ /* 1000 */ PTR(232, 3),
+ /* 1001 */ PTR(240, 3),
+ /* 1010 */ PTR(248, 3),
+ /* 1011 */ PTR(256, 3),
+ /* 1100 */ PTR(264, 2),
+ /* 1101 */ PTR(268, 3),
+ /* 1110 */ PTR(276, 3),
+ /* 1111 */ PTR(284, 2),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(288, 2), /* 32 */
+ /* 0001 */ PTR(292, 2),
+ /* 0010 */ PTR(296, 2),
+ /* 0011 */ PTR(300, 2),
+ /* 0100 */ PTR(304, 2),
+ /* 0101 */ PTR(308, 2),
+ /* 0110 */ PTR(312, 2),
+ /* 0111 */ PTR(316, 2),
+ /* 1000 */ PTR(320, 1),
+ /* 1001 */ PTR(322, 1),
+ /* 1010 */ PTR(324, 1),
+ /* 1011 */ PTR(326, 2),
+ /* 1100 */ PTR(330, 1),
+ /* 1101 */ PTR(332, 1),
+ /* 1110 */ PTR(334, 2),
+ /* 1111 */ PTR(338, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(340, 1), /* 48 */
+ /* 0001 */ PTR(342, 1),
+ /* 0010 */ V(9, 1, 4),
+ /* 0011 */ PTR(344, 1),
+ /* 0100 */ PTR(346, 1),
+ /* 0101 */ PTR(348, 1),
+ /* 0110 */ PTR(350, 1),
+ /* 0111 */ PTR(352, 1),
+ /* 1000 */ V(2, 8, 4),
+ /* 1001 */ V(8, 2, 4),
+ /* 1010 */ V(1, 8, 4),
+ /* 1011 */ V(8, 1, 4),
+ /* 1100 */ PTR(354, 1),
+ /* 1101 */ PTR(356, 1),
+ /* 1110 */ PTR(358, 1),
+ /* 1111 */ PTR(360, 1),
+
+ /* 0011 ... */
+ /* 0000 */ V(2, 7, 4), /* 64 */
+ /* 0001 */ V(7, 2, 4),
+ /* 0010 */ V(6, 4, 4),
+ /* 0011 */ V(1, 7, 4),
+ /* 0100 */ V(5, 5, 4),
+ /* 0101 */ V(7, 1, 4),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ V(3, 6, 4),
+ /* 1000 */ V(6, 3, 4),
+ /* 1001 */ V(4, 5, 4),
+ /* 1010 */ V(5, 4, 4),
+ /* 1011 */ V(2, 6, 4),
+ /* 1100 */ V(6, 2, 4),
+ /* 1101 */ V(1, 6, 4),
+ /* 1110 */ PTR(364, 1),
+ /* 1111 */ V(3, 5, 4),
+
+ /* 0100 ... */
+ /* 0000 */ V(6, 1, 3), /* 80 */
+ /* 0001 */ V(6, 1, 3),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ V(4, 4, 4),
+ /* 0100 */ V(2, 5, 3),
+ /* 0101 */ V(2, 5, 3),
+ /* 0110 */ V(5, 2, 3),
+ /* 0111 */ V(5, 2, 3),
+ /* 1000 */ V(1, 5, 3),
+ /* 1001 */ V(1, 5, 3),
+ /* 1010 */ V(5, 1, 3),
+ /* 1011 */ V(5, 1, 3),
+ /* 1100 */ V(0, 5, 4),
+ /* 1101 */ V(5, 0, 4),
+ /* 1110 */ V(3, 4, 3),
+ /* 1111 */ V(3, 4, 3),
+
+ /* 0101 ... */
+ /* 000 */ V(4, 3, 3), /* 96 */
+ /* 001 */ V(2, 4, 3),
+ /* 010 */ V(4, 2, 3),
+ /* 011 */ V(3, 3, 3),
+ /* 100 */ V(4, 1, 2),
+ /* 101 */ V(4, 1, 2),
+ /* 110 */ V(1, 4, 3),
+ /* 111 */ V(0, 4, 3),
+
+ /* 0110 ... */
+ /* 000 */ V(2, 3, 2), /* 104 */
+ /* 001 */ V(2, 3, 2),
+ /* 010 */ V(3, 2, 2),
+ /* 011 */ V(3, 2, 2),
+ /* 100 */ V(4, 0, 3),
+ /* 101 */ V(0, 3, 3),
+ /* 110 */ V(1, 3, 2),
+ /* 111 */ V(1, 3, 2),
+
+ /* 0111 ... */
+ /* 00 */ V(3, 1, 2), /* 112 */
+ /* 01 */ V(3, 0, 2),
+ /* 10 */ V(2, 2, 1),
+ /* 11 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(1, 2, 1), /* 116 */
+ /* 1 */ V(2, 1, 1),
+
+ /* 1001 ... */
+ /* 0 */ V(0, 2, 1), /* 118 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(366, 1), /* 120 */
+ /* 0001 */ PTR(368, 1),
+ /* 0010 */ V(14, 14, 4),
+ /* 0011 */ PTR(370, 1),
+ /* 0100 */ PTR(372, 1),
+ /* 0101 */ PTR(374, 1),
+ /* 0110 */ V(15, 11, 4),
+ /* 0111 */ PTR(376, 1),
+ /* 1000 */ V(13, 13, 4),
+ /* 1001 */ V(10, 15, 4),
+ /* 1010 */ V(15, 10, 4),
+ /* 1011 */ V(11, 14, 4),
+ /* 1100 */ V(14, 11, 4),
+ /* 1101 */ V(12, 13, 4),
+ /* 1110 */ V(13, 12, 4),
+ /* 1111 */ V(9, 15, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 9, 4), /* 136 */
+ /* 0001 */ V(14, 10, 4),
+ /* 0010 */ V(11, 13, 4),
+ /* 0011 */ V(13, 11, 4),
+ /* 0100 */ V(8, 15, 4),
+ /* 0101 */ V(15, 8, 4),
+ /* 0110 */ V(12, 12, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(14, 9, 4),
+ /* 1001 */ V(7, 15, 4),
+ /* 1010 */ V(15, 7, 4),
+ /* 1011 */ V(10, 13, 4),
+ /* 1100 */ V(13, 10, 4),
+ /* 1101 */ V(11, 12, 4),
+ /* 1110 */ V(6, 15, 4),
+ /* 1111 */ PTR(378, 1),
+
+ /* 0000 0010 ... */
+ /* 0000 */ V(12, 11, 3), /* 152 */
+ /* 0001 */ V(12, 11, 3),
+ /* 0010 */ V(15, 6, 3),
+ /* 0011 */ V(15, 6, 3),
+ /* 0100 */ V(8, 14, 4),
+ /* 0101 */ V(14, 8, 4),
+ /* 0110 */ V(5, 15, 4),
+ /* 0111 */ V(9, 13, 4),
+ /* 1000 */ V(15, 5, 3),
+ /* 1001 */ V(15, 5, 3),
+ /* 1010 */ V(7, 14, 3),
+ /* 1011 */ V(7, 14, 3),
+ /* 1100 */ V(14, 7, 3),
+ /* 1101 */ V(14, 7, 3),
+ /* 1110 */ V(10, 12, 3),
+ /* 1111 */ V(10, 12, 3),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(12, 10, 3), /* 168 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(13, 9, 4),
+ /* 0101 */ V(8, 13, 4),
+ /* 0110 */ V(4, 15, 3),
+ /* 0111 */ V(4, 15, 3),
+ /* 1000 */ V(15, 4, 3),
+ /* 1001 */ V(15, 4, 3),
+ /* 1010 */ V(3, 15, 3),
+ /* 1011 */ V(3, 15, 3),
+ /* 1100 */ V(15, 3, 3),
+ /* 1101 */ V(15, 3, 3),
+ /* 1110 */ V(13, 8, 3),
+ /* 1111 */ V(13, 8, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(14, 6, 3), /* 184 */
+ /* 0001 */ V(14, 6, 3),
+ /* 0010 */ V(2, 15, 3),
+ /* 0011 */ V(2, 15, 3),
+ /* 0100 */ V(15, 2, 3),
+ /* 0101 */ V(15, 2, 3),
+ /* 0110 */ V(6, 14, 4),
+ /* 0111 */ V(15, 0, 4),
+ /* 1000 */ V(1, 15, 3),
+ /* 1001 */ V(1, 15, 3),
+ /* 1010 */ V(15, 1, 3),
+ /* 1011 */ V(15, 1, 3),
+ /* 1100 */ V(9, 12, 3),
+ /* 1101 */ V(9, 12, 3),
+ /* 1110 */ V(12, 9, 3),
+ /* 1111 */ V(12, 9, 3),
+
+ /* 0000 0101 ... */
+ /* 000 */ V(5, 14, 3), /* 200 */
+ /* 001 */ V(10, 11, 3),
+ /* 010 */ V(11, 10, 3),
+ /* 011 */ V(14, 5, 3),
+ /* 100 */ V(7, 13, 3),
+ /* 101 */ V(13, 7, 3),
+ /* 110 */ V(4, 14, 3),
+ /* 111 */ V(14, 4, 3),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(8, 12, 3), /* 208 */
+ /* 001 */ V(12, 8, 3),
+ /* 010 */ V(3, 14, 3),
+ /* 011 */ V(6, 13, 3),
+ /* 100 */ V(13, 6, 3),
+ /* 101 */ V(14, 3, 3),
+ /* 110 */ V(9, 11, 3),
+ /* 111 */ V(11, 9, 3),
+
+ /* 0000 0111 ... */
+ /* 0000 */ V(2, 14, 3), /* 216 */
+ /* 0001 */ V(2, 14, 3),
+ /* 0010 */ V(10, 10, 3),
+ /* 0011 */ V(10, 10, 3),
+ /* 0100 */ V(14, 2, 3),
+ /* 0101 */ V(14, 2, 3),
+ /* 0110 */ V(1, 14, 3),
+ /* 0111 */ V(1, 14, 3),
+ /* 1000 */ V(14, 1, 3),
+ /* 1001 */ V(14, 1, 3),
+ /* 1010 */ V(0, 14, 4),
+ /* 1011 */ V(14, 0, 4),
+ /* 1100 */ V(5, 13, 3),
+ /* 1101 */ V(5, 13, 3),
+ /* 1110 */ V(13, 5, 3),
+ /* 1111 */ V(13, 5, 3),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(7, 12, 3), /* 232 */
+ /* 001 */ V(12, 7, 3),
+ /* 010 */ V(4, 13, 3),
+ /* 011 */ V(8, 11, 3),
+ /* 100 */ V(13, 4, 2),
+ /* 101 */ V(13, 4, 2),
+ /* 110 */ V(11, 8, 3),
+ /* 111 */ V(9, 10, 3),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(10, 9, 3), /* 240 */
+ /* 001 */ V(6, 12, 3),
+ /* 010 */ V(12, 6, 3),
+ /* 011 */ V(3, 13, 3),
+ /* 100 */ V(13, 3, 2),
+ /* 101 */ V(13, 3, 2),
+ /* 110 */ V(13, 2, 2),
+ /* 111 */ V(13, 2, 2),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 13, 3), /* 248 */
+ /* 001 */ V(0, 13, 3),
+ /* 010 */ V(1, 13, 2),
+ /* 011 */ V(1, 13, 2),
+ /* 100 */ V(7, 11, 2),
+ /* 101 */ V(7, 11, 2),
+ /* 110 */ V(11, 7, 2),
+ /* 111 */ V(11, 7, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(13, 1, 2), /* 256 */
+ /* 001 */ V(13, 1, 2),
+ /* 010 */ V(5, 12, 3),
+ /* 011 */ V(13, 0, 3),
+ /* 100 */ V(12, 5, 2),
+ /* 101 */ V(12, 5, 2),
+ /* 110 */ V(8, 10, 2),
+ /* 111 */ V(8, 10, 2),
+
+ /* 0000 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 264 */
+ /* 01 */ V(4, 12, 2),
+ /* 10 */ V(12, 4, 2),
+ /* 11 */ V(6, 11, 2),
+
+ /* 0000 1101 ... */
+ /* 000 */ V(11, 6, 2), /* 268 */
+ /* 001 */ V(11, 6, 2),
+ /* 010 */ V(9, 9, 3),
+ /* 011 */ V(0, 12, 3),
+ /* 100 */ V(3, 12, 2),
+ /* 101 */ V(3, 12, 2),
+ /* 110 */ V(12, 3, 2),
+ /* 111 */ V(12, 3, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 10, 2), /* 276 */
+ /* 001 */ V(7, 10, 2),
+ /* 010 */ V(10, 7, 2),
+ /* 011 */ V(10, 7, 2),
+ /* 100 */ V(10, 6, 2),
+ /* 101 */ V(10, 6, 2),
+ /* 110 */ V(12, 0, 3),
+ /* 111 */ V(0, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 00 */ V(12, 2, 1), /* 284 */
+ /* 01 */ V(12, 2, 1),
+ /* 10 */ V(2, 12, 2),
+ /* 11 */ V(5, 11, 2),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(11, 5, 2), /* 288 */
+ /* 01 */ V(1, 12, 2),
+ /* 10 */ V(8, 9, 2),
+ /* 11 */ V(9, 8, 2),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(12, 1, 2), /* 292 */
+ /* 01 */ V(4, 11, 2),
+ /* 10 */ V(11, 4, 2),
+ /* 11 */ V(6, 10, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(3, 11, 2), /* 296 */
+ /* 01 */ V(7, 9, 2),
+ /* 10 */ V(11, 3, 1),
+ /* 11 */ V(11, 3, 1),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(9, 7, 2), /* 300 */
+ /* 01 */ V(8, 8, 2),
+ /* 10 */ V(2, 11, 2),
+ /* 11 */ V(5, 10, 2),
+
+ /* 0001 0100 ... */
+ /* 00 */ V(11, 2, 1), /* 304 */
+ /* 01 */ V(11, 2, 1),
+ /* 10 */ V(10, 5, 2),
+ /* 11 */ V(1, 11, 2),
+
+ /* 0001 0101 ... */
+ /* 00 */ V(11, 1, 1), /* 308 */
+ /* 01 */ V(11, 1, 1),
+ /* 10 */ V(11, 0, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0001 0110 ... */
+ /* 00 */ V(9, 6, 2), /* 312 */
+ /* 01 */ V(4, 10, 2),
+ /* 10 */ V(10, 4, 2),
+ /* 11 */ V(7, 8, 2),
+
+ /* 0001 0111 ... */
+ /* 00 */ V(8, 7, 2), /* 316 */
+ /* 01 */ V(3, 10, 2),
+ /* 10 */ V(10, 3, 1),
+ /* 11 */ V(10, 3, 1),
+
+ /* 0001 1000 ... */
+ /* 0 */ V(5, 9, 1), /* 320 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(2, 10, 1), /* 322 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(1, 10, 1), /* 324 */
+ /* 1 */ V(10, 1, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(0, 10, 2), /* 326 */
+ /* 01 */ V(10, 0, 2),
+ /* 10 */ V(6, 8, 1),
+ /* 11 */ V(6, 8, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(8, 6, 1), /* 330 */
+ /* 1 */ V(4, 9, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(9, 4, 1), /* 332 */
+ /* 1 */ V(3, 9, 1),
+
+ /* 0001 1110 ... */
+ /* 00 */ V(9, 3, 1), /* 334 */
+ /* 01 */ V(9, 3, 1),
+ /* 10 */ V(7, 7, 2),
+ /* 11 */ V(0, 9, 2),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(5, 8, 1), /* 338 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(2, 9, 1), /* 340 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(7, 6, 1), /* 342 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0010 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 344 */
+ /* 1 */ V(9, 0, 1),
+
+ /* 0010 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 346 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 348 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0010 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 350 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0010 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 352 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0010 1100 ... */
+ /* 0 */ V(7, 4, 1), /* 354 */
+ /* 1 */ V(0, 8, 1),
+
+ /* 0010 1101 ... */
+ /* 0 */ V(8, 0, 1), /* 356 */
+ /* 1 */ V(5, 6, 1),
+
+ /* 0010 1110 ... */
+ /* 0 */ V(6, 5, 1), /* 358 */
+ /* 1 */ V(3, 7, 1),
+
+ /* 0010 1111 ... */
+ /* 0 */ V(7, 3, 1), /* 360 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0011 0110 ... */
+ /* 0 */ V(0, 7, 1), /* 362 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0011 1110 ... */
+ /* 0 */ V(0, 6, 1), /* 364 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0 */ V(15, 15, 1), /* 366 */
+ /* 1 */ V(14, 15, 1),
+
+ /* 0000 0000 0001 ... */
+ /* 0 */ V(15, 14, 1), /* 368 */
+ /* 1 */ V(13, 15, 1),
+
+ /* 0000 0000 0011 ... */
+ /* 0 */ V(15, 13, 1), /* 370 */
+ /* 1 */ V(12, 15, 1),
+
+ /* 0000 0000 0100 ... */
+ /* 0 */ V(15, 12, 1), /* 372 */
+ /* 1 */ V(13, 14, 1),
+
+ /* 0000 0000 0101 ... */
+ /* 0 */ V(14, 13, 1), /* 374 */
+ /* 1 */ V(11, 15, 1),
+
+ /* 0000 0000 0111 ... */
+ /* 0 */ V(12, 14, 1), /* 376 */
+ /* 1 */ V(14, 12, 1),
+
+ /* 0000 0001 1111 ... */
+ /* 0 */ V(10, 14, 1), /* 378 */
+ /* 1 */ V(0, 15, 1)
};
static
-union huffpair const hufftab16[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 3), /* 16 */
- /* 0001 */ PTR(76, 3),
- /* 0010 */ PTR(84, 2),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(88, 2),
- /* 0101 */ PTR(92, 1),
- /* 0110 */ PTR(94, 4),
- /* 0111 */ V(15, 2, 4),
- /* 1000 */ PTR(110, 1),
- /* 1001 */ V(1, 15, 4),
- /* 1010 */ V(15, 1, 4),
- /* 1011 */ PTR(112, 4),
- /* 1100 */ PTR(128, 4),
- /* 1101 */ PTR(144, 4),
- /* 1110 */ PTR(160, 4),
- /* 1111 */ PTR(176, 4),
-
- /* 0001 ... */
- /* 0000 */ PTR(192, 4), /* 32 */
- /* 0001 */ PTR(208, 3),
- /* 0010 */ PTR(216, 3),
- /* 0011 */ PTR(224, 3),
- /* 0100 */ PTR(232, 3),
- /* 0101 */ PTR(240, 3),
- /* 0110 */ PTR(248, 3),
- /* 0111 */ PTR(256, 3),
- /* 1000 */ PTR(264, 2),
- /* 1001 */ PTR(268, 2),
- /* 1010 */ PTR(272, 1),
- /* 1011 */ PTR(274, 2),
- /* 1100 */ PTR(278, 2),
- /* 1101 */ PTR(282, 1),
- /* 1110 */ V(5, 1, 4),
- /* 1111 */ PTR(284, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(286, 1), /* 48 */
- /* 0001 */ PTR(288, 1),
- /* 0010 */ PTR(290, 1),
- /* 0011 */ V(1, 4, 4),
- /* 0100 */ V(4, 1, 4),
- /* 0101 */ PTR(292, 1),
- /* 0110 */ V(2, 3, 4),
- /* 0111 */ V(3, 2, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(0, 3, 4),
- /* 1101 */ V(3, 0, 4),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(14, 15, 3), /* 68 */
- /* 001 */ V(15, 14, 3),
- /* 010 */ V(13, 15, 3),
- /* 011 */ V(15, 13, 3),
- /* 100 */ V(12, 15, 3),
- /* 101 */ V(15, 12, 3),
- /* 110 */ V(11, 15, 3),
- /* 111 */ V(15, 11, 3),
-
- /* 0000 0001 ... */
- /* 000 */ V(10, 15, 2), /* 76 */
- /* 001 */ V(10, 15, 2),
- /* 010 */ V(15, 10, 3),
- /* 011 */ V(9, 15, 3),
- /* 100 */ V(15, 9, 3),
- /* 101 */ V(15, 8, 3),
- /* 110 */ V(8, 15, 2),
- /* 111 */ V(8, 15, 2),
-
- /* 0000 0010 ... */
- /* 00 */ V(7, 15, 2), /* 84 */
- /* 01 */ V(15, 7, 2),
- /* 10 */ V(6, 15, 2),
- /* 11 */ V(15, 6, 2),
-
- /* 0000 0100 ... */
- /* 00 */ V(5, 15, 2), /* 88 */
- /* 01 */ V(15, 5, 2),
- /* 10 */ V(4, 15, 1),
- /* 11 */ V(4, 15, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(15, 4, 1), /* 92 */
- /* 1 */ V(15, 3, 1),
-
- /* 0000 0110 ... */
- /* 0000 */ V(15, 0, 1), /* 94 */
- /* 0001 */ V(15, 0, 1),
- /* 0010 */ V(15, 0, 1),
- /* 0011 */ V(15, 0, 1),
- /* 0100 */ V(15, 0, 1),
- /* 0101 */ V(15, 0, 1),
- /* 0110 */ V(15, 0, 1),
- /* 0111 */ V(15, 0, 1),
- /* 1000 */ V(3, 15, 2),
- /* 1001 */ V(3, 15, 2),
- /* 1010 */ V(3, 15, 2),
- /* 1011 */ V(3, 15, 2),
- /* 1100 */ PTR(294, 4),
- /* 1101 */ PTR(310, 3),
- /* 1110 */ PTR(318, 3),
- /* 1111 */ PTR(326, 3),
-
- /* 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 110 */
- /* 1 */ V(0, 15, 1),
-
- /* 0000 1011 ... */
- /* 0000 */ PTR(334, 2), /* 112 */
- /* 0001 */ PTR(338, 2),
- /* 0010 */ PTR(342, 2),
- /* 0011 */ PTR(346, 1),
- /* 0100 */ PTR(348, 2),
- /* 0101 */ PTR(352, 2),
- /* 0110 */ PTR(356, 1),
- /* 0111 */ PTR(358, 2),
- /* 1000 */ PTR(362, 2),
- /* 1001 */ PTR(366, 2),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ V(14, 3, 4),
- /* 1100 */ PTR(374, 1),
- /* 1101 */ PTR(376, 1),
- /* 1110 */ PTR(378, 1),
- /* 1111 */ PTR(380, 1),
-
- /* 0000 1100 ... */
- /* 0000 */ PTR(382, 1), /* 128 */
- /* 0001 */ PTR(384, 1),
- /* 0010 */ PTR(386, 1),
- /* 0011 */ V(0, 13, 4),
- /* 0100 */ PTR(388, 1),
- /* 0101 */ PTR(390, 1),
- /* 0110 */ PTR(392, 1),
- /* 0111 */ V(3, 12, 4),
- /* 1000 */ PTR(394, 1),
- /* 1001 */ V(1, 12, 4),
- /* 1010 */ V(12, 0, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 2, 3),
- /* 1101 */ V(14, 2, 3),
- /* 1110 */ V(2, 14, 4),
- /* 1111 */ V(1, 14, 4),
-
- /* 0000 1101 ... */
- /* 0000 */ V(13, 3, 4), /* 144 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(13, 1, 4),
- /* 0100 */ V(3, 11, 4),
- /* 0101 */ PTR(398, 1),
- /* 0110 */ V(1, 13, 3),
- /* 0111 */ V(1, 13, 3),
- /* 1000 */ V(12, 4, 4),
- /* 1001 */ V(6, 11, 4),
- /* 1010 */ V(12, 3, 4),
- /* 1011 */ V(10, 7, 4),
- /* 1100 */ V(2, 12, 3),
- /* 1101 */ V(2, 12, 3),
- /* 1110 */ V(12, 2, 4),
- /* 1111 */ V(11, 5, 4),
-
- /* 0000 1110 ... */
- /* 0000 */ V(12, 1, 4), /* 160 */
- /* 0001 */ V(0, 12, 4),
- /* 0010 */ V(4, 11, 4),
- /* 0011 */ V(11, 4, 4),
- /* 0100 */ V(6, 10, 4),
- /* 0101 */ V(10, 6, 4),
- /* 0110 */ V(11, 3, 3),
- /* 0111 */ V(11, 3, 3),
- /* 1000 */ V(5, 10, 4),
- /* 1001 */ V(10, 5, 4),
- /* 1010 */ V(2, 11, 3),
- /* 1011 */ V(2, 11, 3),
- /* 1100 */ V(11, 2, 3),
- /* 1101 */ V(11, 2, 3),
- /* 1110 */ V(1, 11, 3),
- /* 1111 */ V(1, 11, 3),
-
- /* 0000 1111 ... */
- /* 0000 */ V(11, 1, 3), /* 176 */
- /* 0001 */ V(11, 1, 3),
- /* 0010 */ V(0, 11, 4),
- /* 0011 */ V(11, 0, 4),
- /* 0100 */ V(6, 9, 4),
- /* 0101 */ V(9, 6, 4),
- /* 0110 */ V(4, 10, 4),
- /* 0111 */ V(10, 4, 4),
- /* 1000 */ V(7, 8, 4),
- /* 1001 */ V(8, 7, 4),
- /* 1010 */ V(10, 3, 3),
- /* 1011 */ V(10, 3, 3),
- /* 1100 */ V(3, 10, 4),
- /* 1101 */ V(5, 9, 4),
- /* 1110 */ V(2, 10, 3),
- /* 1111 */ V(2, 10, 3),
-
- /* 0001 0000 ... */
- /* 0000 */ V(9, 5, 4), /* 192 */
- /* 0001 */ V(6, 8, 4),
- /* 0010 */ V(10, 1, 3),
- /* 0011 */ V(10, 1, 3),
- /* 0100 */ V(8, 6, 4),
- /* 0101 */ V(7, 7, 4),
- /* 0110 */ V(9, 4, 3),
- /* 0111 */ V(9, 4, 3),
- /* 1000 */ V(4, 9, 4),
- /* 1001 */ V(5, 7, 4),
- /* 1010 */ V(6, 7, 3),
- /* 1011 */ V(6, 7, 3),
- /* 1100 */ V(10, 2, 2),
- /* 1101 */ V(10, 2, 2),
- /* 1110 */ V(10, 2, 2),
- /* 1111 */ V(10, 2, 2),
-
- /* 0001 0001 ... */
- /* 000 */ V(1, 10, 2), /* 208 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(0, 10, 3),
- /* 011 */ V(10, 0, 3),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(9, 3, 3),
- /* 110 */ V(5, 8, 3),
- /* 111 */ V(8, 5, 3),
-
- /* 0001 0010 ... */
- /* 000 */ V(2, 9, 2), /* 216 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(7, 6, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(1, 9, 2),
- /* 111 */ V(1, 9, 2),
-
- /* 0001 0011 ... */
- /* 000 */ V(9, 1, 2), /* 224 */
- /* 001 */ V(9, 1, 2),
- /* 010 */ V(9, 0, 3),
- /* 011 */ V(4, 8, 3),
- /* 100 */ V(8, 4, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 3),
- /* 111 */ V(8, 3, 3),
-
- /* 0001 0100 ... */
- /* 000 */ V(6, 6, 3), /* 232 */
- /* 001 */ V(2, 8, 3),
- /* 010 */ V(8, 2, 2),
- /* 011 */ V(8, 2, 2),
- /* 100 */ V(4, 7, 3),
- /* 101 */ V(7, 4, 3),
- /* 110 */ V(1, 8, 2),
- /* 111 */ V(1, 8, 2),
-
- /* 0001 0101 ... */
- /* 000 */ V(8, 1, 2), /* 240 */
- /* 001 */ V(8, 1, 2),
- /* 010 */ V(8, 0, 2),
- /* 011 */ V(8, 0, 2),
- /* 100 */ V(0, 8, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(3, 7, 2),
- /* 111 */ V(3, 7, 2),
-
- /* 0001 0110 ... */
- /* 000 */ V(7, 3, 2), /* 248 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(6, 5, 3),
- /* 011 */ V(4, 6, 3),
- /* 100 */ V(2, 7, 2),
- /* 101 */ V(2, 7, 2),
- /* 110 */ V(7, 2, 2),
- /* 111 */ V(7, 2, 2),
-
- /* 0001 0111 ... */
- /* 000 */ V(6, 4, 3), /* 256 */
- /* 001 */ V(5, 5, 3),
- /* 010 */ V(0, 7, 2),
- /* 011 */ V(0, 7, 2),
- /* 100 */ V(1, 7, 1),
- /* 101 */ V(1, 7, 1),
- /* 110 */ V(1, 7, 1),
- /* 111 */ V(1, 7, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(7, 1, 1), /* 264 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(7, 0, 2),
- /* 11 */ V(3, 6, 2),
-
- /* 0001 1001 ... */
- /* 00 */ V(6, 3, 2), /* 268 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(2, 6, 2),
-
- /* 0001 1010 ... */
- /* 0 */ V(6, 2, 1), /* 272 */
- /* 1 */ V(1, 6, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(6, 1, 1), /* 274 */
- /* 01 */ V(6, 1, 1),
- /* 10 */ V(0, 6, 2),
- /* 11 */ V(6, 0, 2),
-
- /* 0001 1100 ... */
- /* 00 */ V(5, 3, 1), /* 278 */
- /* 01 */ V(5, 3, 1),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0001 1101 ... */
- /* 0 */ V(2, 5, 1), /* 282 */
- /* 1 */ V(5, 2, 1),
-
- /* 0001 1111 ... */
- /* 0 */ V(1, 5, 1), /* 284 */
- /* 1 */ V(0, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(3, 4, 1), /* 286 */
- /* 1 */ V(4, 3, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(5, 0, 1), /* 288 */
- /* 1 */ V(2, 4, 1),
-
- /* 0010 0010 ... */
- /* 0 */ V(4, 2, 1), /* 290 */
- /* 1 */ V(3, 3, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(0, 4, 1), /* 292 */
- /* 1 */ V(4, 0, 1),
-
- /* 0000 0110 1100 ... */
- /* 0000 */ V(12, 14, 4), /* 294 */
- /* 0001 */ PTR(400, 1),
- /* 0010 */ V(13, 14, 3),
- /* 0011 */ V(13, 14, 3),
- /* 0100 */ V(14, 9, 3),
- /* 0101 */ V(14, 9, 3),
- /* 0110 */ V(14, 10, 4),
- /* 0111 */ V(13, 9, 4),
- /* 1000 */ V(14, 14, 2),
- /* 1001 */ V(14, 14, 2),
- /* 1010 */ V(14, 14, 2),
- /* 1011 */ V(14, 14, 2),
- /* 1100 */ V(14, 13, 3),
- /* 1101 */ V(14, 13, 3),
- /* 1110 */ V(14, 11, 3),
- /* 1111 */ V(14, 11, 3),
-
- /* 0000 0110 1101 ... */
- /* 000 */ V(11, 14, 2), /* 310 */
- /* 001 */ V(11, 14, 2),
- /* 010 */ V(12, 13, 2),
- /* 011 */ V(12, 13, 2),
- /* 100 */ V(13, 12, 3),
- /* 101 */ V(13, 11, 3),
- /* 110 */ V(10, 14, 2),
- /* 111 */ V(10, 14, 2),
-
- /* 0000 0110 1110 ... */
- /* 000 */ V(12, 12, 2), /* 318 */
- /* 001 */ V(12, 12, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(13, 10, 3),
- /* 100 */ V(7, 14, 3),
- /* 101 */ V(10, 12, 3),
- /* 110 */ V(12, 10, 2),
- /* 111 */ V(12, 10, 2),
-
- /* 0000 0110 1111 ... */
- /* 000 */ V(12, 9, 3), /* 326 */
- /* 001 */ V(7, 13, 3),
- /* 010 */ V(5, 14, 2),
- /* 011 */ V(5, 14, 2),
- /* 100 */ V(11, 13, 1),
- /* 101 */ V(11, 13, 1),
- /* 110 */ V(11, 13, 1),
- /* 111 */ V(11, 13, 1),
-
- /* 0000 1011 0000 ... */
- /* 00 */ V(9, 14, 1), /* 334 */
- /* 01 */ V(9, 14, 1),
- /* 10 */ V(11, 12, 2),
- /* 11 */ V(12, 11, 2),
-
- /* 0000 1011 0001 ... */
- /* 00 */ V(8, 14, 2), /* 338 */
- /* 01 */ V(14, 8, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(14, 7, 2),
-
- /* 0000 1011 0010 ... */
- /* 00 */ V(11, 11, 2), /* 342 */
- /* 01 */ V(8, 13, 2),
- /* 10 */ V(13, 8, 2),
- /* 11 */ V(6, 14, 2),
-
- /* 0000 1011 0011 ... */
- /* 0 */ V(14, 6, 1), /* 346 */
- /* 1 */ V(9, 12, 1),
-
- /* 0000 1011 0100 ... */
- /* 00 */ V(10, 11, 2), /* 348 */
- /* 01 */ V(11, 10, 2),
- /* 10 */ V(14, 5, 2),
- /* 11 */ V(13, 7, 2),
-
- /* 0000 1011 0101 ... */
- /* 00 */ V(4, 14, 1), /* 352 */
- /* 01 */ V(4, 14, 1),
- /* 10 */ V(14, 4, 2),
- /* 11 */ V(8, 12, 2),
-
- /* 0000 1011 0110 ... */
- /* 0 */ V(12, 8, 1), /* 356 */
- /* 1 */ V(3, 14, 1),
-
- /* 0000 1011 0111 ... */
- /* 00 */ V(6, 13, 1), /* 358 */
- /* 01 */ V(6, 13, 1),
- /* 10 */ V(13, 6, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0000 1011 1000 ... */
- /* 00 */ V(11, 9, 2), /* 362 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 1, 1),
- /* 11 */ V(14, 1, 1),
-
- /* 0000 1011 1001 ... */
- /* 00 */ V(13, 4, 1), /* 366 */
- /* 01 */ V(13, 4, 1),
- /* 10 */ V(11, 8, 2),
- /* 11 */ V(10, 9, 2),
-
- /* 0000 1011 1010 ... */
- /* 00 */ V(7, 11, 1), /* 370 */
- /* 01 */ V(7, 11, 1),
- /* 10 */ V(11, 7, 2),
- /* 11 */ V(13, 0, 2),
-
- /* 0000 1011 1100 ... */
- /* 0 */ V(0, 14, 1), /* 374 */
- /* 1 */ V(14, 0, 1),
-
- /* 0000 1011 1101 ... */
- /* 0 */ V(5, 13, 1), /* 376 */
- /* 1 */ V(13, 5, 1),
-
- /* 0000 1011 1110 ... */
- /* 0 */ V(7, 12, 1), /* 378 */
- /* 1 */ V(12, 7, 1),
-
- /* 0000 1011 1111 ... */
- /* 0 */ V(4, 13, 1), /* 380 */
- /* 1 */ V(8, 11, 1),
-
- /* 0000 1100 0000 ... */
- /* 0 */ V(9, 10, 1), /* 382 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 1100 0001 ... */
- /* 0 */ V(12, 6, 1), /* 384 */
- /* 1 */ V(3, 13, 1),
-
- /* 0000 1100 0010 ... */
- /* 0 */ V(5, 12, 1), /* 386 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 1100 0100 ... */
- /* 0 */ V(8, 10, 1), /* 388 */
- /* 1 */ V(10, 8, 1),
-
- /* 0000 1100 0101 ... */
- /* 0 */ V(9, 9, 1), /* 390 */
- /* 1 */ V(4, 12, 1),
-
- /* 0000 1100 0110 ... */
- /* 0 */ V(11, 6, 1), /* 392 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 1100 1000 ... */
- /* 0 */ V(5, 11, 1), /* 394 */
- /* 1 */ V(8, 9, 1),
-
- /* 0000 1100 1011 ... */
- /* 0 */ V(9, 8, 1), /* 396 */
- /* 1 */ V(7, 9, 1),
-
- /* 0000 1101 0101 ... */
- /* 0 */ V(9, 7, 1), /* 398 */
- /* 1 */ V(8, 8, 1),
-
- /* 0000 0110 1100 0001 ... */
- /* 0 */ V(14, 12, 1), /* 400 */
- /* 1 */ V(13, 13, 1)
+union huffpair const hufftab16[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 3), /* 16 */
+ /* 0001 */ PTR(76, 3),
+ /* 0010 */ PTR(84, 2),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(88, 2),
+ /* 0101 */ PTR(92, 1),
+ /* 0110 */ PTR(94, 4),
+ /* 0111 */ V(15, 2, 4),
+ /* 1000 */ PTR(110, 1),
+ /* 1001 */ V(1, 15, 4),
+ /* 1010 */ V(15, 1, 4),
+ /* 1011 */ PTR(112, 4),
+ /* 1100 */ PTR(128, 4),
+ /* 1101 */ PTR(144, 4),
+ /* 1110 */ PTR(160, 4),
+ /* 1111 */ PTR(176, 4),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(192, 4), /* 32 */
+ /* 0001 */ PTR(208, 3),
+ /* 0010 */ PTR(216, 3),
+ /* 0011 */ PTR(224, 3),
+ /* 0100 */ PTR(232, 3),
+ /* 0101 */ PTR(240, 3),
+ /* 0110 */ PTR(248, 3),
+ /* 0111 */ PTR(256, 3),
+ /* 1000 */ PTR(264, 2),
+ /* 1001 */ PTR(268, 2),
+ /* 1010 */ PTR(272, 1),
+ /* 1011 */ PTR(274, 2),
+ /* 1100 */ PTR(278, 2),
+ /* 1101 */ PTR(282, 1),
+ /* 1110 */ V(5, 1, 4),
+ /* 1111 */ PTR(284, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(286, 1), /* 48 */
+ /* 0001 */ PTR(288, 1),
+ /* 0010 */ PTR(290, 1),
+ /* 0011 */ V(1, 4, 4),
+ /* 0100 */ V(4, 1, 4),
+ /* 0101 */ PTR(292, 1),
+ /* 0110 */ V(2, 3, 4),
+ /* 0111 */ V(3, 2, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(0, 3, 4),
+ /* 1101 */ V(3, 0, 4),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(14, 15, 3), /* 68 */
+ /* 001 */ V(15, 14, 3),
+ /* 010 */ V(13, 15, 3),
+ /* 011 */ V(15, 13, 3),
+ /* 100 */ V(12, 15, 3),
+ /* 101 */ V(15, 12, 3),
+ /* 110 */ V(11, 15, 3),
+ /* 111 */ V(15, 11, 3),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(10, 15, 2), /* 76 */
+ /* 001 */ V(10, 15, 2),
+ /* 010 */ V(15, 10, 3),
+ /* 011 */ V(9, 15, 3),
+ /* 100 */ V(15, 9, 3),
+ /* 101 */ V(15, 8, 3),
+ /* 110 */ V(8, 15, 2),
+ /* 111 */ V(8, 15, 2),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(7, 15, 2), /* 84 */
+ /* 01 */ V(15, 7, 2),
+ /* 10 */ V(6, 15, 2),
+ /* 11 */ V(15, 6, 2),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(5, 15, 2), /* 88 */
+ /* 01 */ V(15, 5, 2),
+ /* 10 */ V(4, 15, 1),
+ /* 11 */ V(4, 15, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(15, 4, 1), /* 92 */
+ /* 1 */ V(15, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0000 */ V(15, 0, 1), /* 94 */
+ /* 0001 */ V(15, 0, 1),
+ /* 0010 */ V(15, 0, 1),
+ /* 0011 */ V(15, 0, 1),
+ /* 0100 */ V(15, 0, 1),
+ /* 0101 */ V(15, 0, 1),
+ /* 0110 */ V(15, 0, 1),
+ /* 0111 */ V(15, 0, 1),
+ /* 1000 */ V(3, 15, 2),
+ /* 1001 */ V(3, 15, 2),
+ /* 1010 */ V(3, 15, 2),
+ /* 1011 */ V(3, 15, 2),
+ /* 1100 */ PTR(294, 4),
+ /* 1101 */ PTR(310, 3),
+ /* 1110 */ PTR(318, 3),
+ /* 1111 */ PTR(326, 3),
+
+ /* 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 110 */
+ /* 1 */ V(0, 15, 1),
+
+ /* 0000 1011 ... */
+ /* 0000 */ PTR(334, 2), /* 112 */
+ /* 0001 */ PTR(338, 2),
+ /* 0010 */ PTR(342, 2),
+ /* 0011 */ PTR(346, 1),
+ /* 0100 */ PTR(348, 2),
+ /* 0101 */ PTR(352, 2),
+ /* 0110 */ PTR(356, 1),
+ /* 0111 */ PTR(358, 2),
+ /* 1000 */ PTR(362, 2),
+ /* 1001 */ PTR(366, 2),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ V(14, 3, 4),
+ /* 1100 */ PTR(374, 1),
+ /* 1101 */ PTR(376, 1),
+ /* 1110 */ PTR(378, 1),
+ /* 1111 */ PTR(380, 1),
+
+ /* 0000 1100 ... */
+ /* 0000 */ PTR(382, 1), /* 128 */
+ /* 0001 */ PTR(384, 1),
+ /* 0010 */ PTR(386, 1),
+ /* 0011 */ V(0, 13, 4),
+ /* 0100 */ PTR(388, 1),
+ /* 0101 */ PTR(390, 1),
+ /* 0110 */ PTR(392, 1),
+ /* 0111 */ V(3, 12, 4),
+ /* 1000 */ PTR(394, 1),
+ /* 1001 */ V(1, 12, 4),
+ /* 1010 */ V(12, 0, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 2, 3),
+ /* 1101 */ V(14, 2, 3),
+ /* 1110 */ V(2, 14, 4),
+ /* 1111 */ V(1, 14, 4),
+
+ /* 0000 1101 ... */
+ /* 0000 */ V(13, 3, 4), /* 144 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(13, 1, 4),
+ /* 0100 */ V(3, 11, 4),
+ /* 0101 */ PTR(398, 1),
+ /* 0110 */ V(1, 13, 3),
+ /* 0111 */ V(1, 13, 3),
+ /* 1000 */ V(12, 4, 4),
+ /* 1001 */ V(6, 11, 4),
+ /* 1010 */ V(12, 3, 4),
+ /* 1011 */ V(10, 7, 4),
+ /* 1100 */ V(2, 12, 3),
+ /* 1101 */ V(2, 12, 3),
+ /* 1110 */ V(12, 2, 4),
+ /* 1111 */ V(11, 5, 4),
+
+ /* 0000 1110 ... */
+ /* 0000 */ V(12, 1, 4), /* 160 */
+ /* 0001 */ V(0, 12, 4),
+ /* 0010 */ V(4, 11, 4),
+ /* 0011 */ V(11, 4, 4),
+ /* 0100 */ V(6, 10, 4),
+ /* 0101 */ V(10, 6, 4),
+ /* 0110 */ V(11, 3, 3),
+ /* 0111 */ V(11, 3, 3),
+ /* 1000 */ V(5, 10, 4),
+ /* 1001 */ V(10, 5, 4),
+ /* 1010 */ V(2, 11, 3),
+ /* 1011 */ V(2, 11, 3),
+ /* 1100 */ V(11, 2, 3),
+ /* 1101 */ V(11, 2, 3),
+ /* 1110 */ V(1, 11, 3),
+ /* 1111 */ V(1, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 0000 */ V(11, 1, 3), /* 176 */
+ /* 0001 */ V(11, 1, 3),
+ /* 0010 */ V(0, 11, 4),
+ /* 0011 */ V(11, 0, 4),
+ /* 0100 */ V(6, 9, 4),
+ /* 0101 */ V(9, 6, 4),
+ /* 0110 */ V(4, 10, 4),
+ /* 0111 */ V(10, 4, 4),
+ /* 1000 */ V(7, 8, 4),
+ /* 1001 */ V(8, 7, 4),
+ /* 1010 */ V(10, 3, 3),
+ /* 1011 */ V(10, 3, 3),
+ /* 1100 */ V(3, 10, 4),
+ /* 1101 */ V(5, 9, 4),
+ /* 1110 */ V(2, 10, 3),
+ /* 1111 */ V(2, 10, 3),
+
+ /* 0001 0000 ... */
+ /* 0000 */ V(9, 5, 4), /* 192 */
+ /* 0001 */ V(6, 8, 4),
+ /* 0010 */ V(10, 1, 3),
+ /* 0011 */ V(10, 1, 3),
+ /* 0100 */ V(8, 6, 4),
+ /* 0101 */ V(7, 7, 4),
+ /* 0110 */ V(9, 4, 3),
+ /* 0111 */ V(9, 4, 3),
+ /* 1000 */ V(4, 9, 4),
+ /* 1001 */ V(5, 7, 4),
+ /* 1010 */ V(6, 7, 3),
+ /* 1011 */ V(6, 7, 3),
+ /* 1100 */ V(10, 2, 2),
+ /* 1101 */ V(10, 2, 2),
+ /* 1110 */ V(10, 2, 2),
+ /* 1111 */ V(10, 2, 2),
+
+ /* 0001 0001 ... */
+ /* 000 */ V(1, 10, 2), /* 208 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(0, 10, 3),
+ /* 011 */ V(10, 0, 3),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(9, 3, 3),
+ /* 110 */ V(5, 8, 3),
+ /* 111 */ V(8, 5, 3),
+
+ /* 0001 0010 ... */
+ /* 000 */ V(2, 9, 2), /* 216 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(7, 6, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(1, 9, 2),
+ /* 111 */ V(1, 9, 2),
+
+ /* 0001 0011 ... */
+ /* 000 */ V(9, 1, 2), /* 224 */
+ /* 001 */ V(9, 1, 2),
+ /* 010 */ V(9, 0, 3),
+ /* 011 */ V(4, 8, 3),
+ /* 100 */ V(8, 4, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 3),
+ /* 111 */ V(8, 3, 3),
+
+ /* 0001 0100 ... */
+ /* 000 */ V(6, 6, 3), /* 232 */
+ /* 001 */ V(2, 8, 3),
+ /* 010 */ V(8, 2, 2),
+ /* 011 */ V(8, 2, 2),
+ /* 100 */ V(4, 7, 3),
+ /* 101 */ V(7, 4, 3),
+ /* 110 */ V(1, 8, 2),
+ /* 111 */ V(1, 8, 2),
+
+ /* 0001 0101 ... */
+ /* 000 */ V(8, 1, 2), /* 240 */
+ /* 001 */ V(8, 1, 2),
+ /* 010 */ V(8, 0, 2),
+ /* 011 */ V(8, 0, 2),
+ /* 100 */ V(0, 8, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(3, 7, 2),
+ /* 111 */ V(3, 7, 2),
+
+ /* 0001 0110 ... */
+ /* 000 */ V(7, 3, 2), /* 248 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(6, 5, 3),
+ /* 011 */ V(4, 6, 3),
+ /* 100 */ V(2, 7, 2),
+ /* 101 */ V(2, 7, 2),
+ /* 110 */ V(7, 2, 2),
+ /* 111 */ V(7, 2, 2),
+
+ /* 0001 0111 ... */
+ /* 000 */ V(6, 4, 3), /* 256 */
+ /* 001 */ V(5, 5, 3),
+ /* 010 */ V(0, 7, 2),
+ /* 011 */ V(0, 7, 2),
+ /* 100 */ V(1, 7, 1),
+ /* 101 */ V(1, 7, 1),
+ /* 110 */ V(1, 7, 1),
+ /* 111 */ V(1, 7, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(7, 1, 1), /* 264 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(7, 0, 2),
+ /* 11 */ V(3, 6, 2),
+
+ /* 0001 1001 ... */
+ /* 00 */ V(6, 3, 2), /* 268 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(2, 6, 2),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(6, 2, 1), /* 272 */
+ /* 1 */ V(1, 6, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(6, 1, 1), /* 274 */
+ /* 01 */ V(6, 1, 1),
+ /* 10 */ V(0, 6, 2),
+ /* 11 */ V(6, 0, 2),
+
+ /* 0001 1100 ... */
+ /* 00 */ V(5, 3, 1), /* 278 */
+ /* 01 */ V(5, 3, 1),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(2, 5, 1), /* 282 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(1, 5, 1), /* 284 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(3, 4, 1), /* 286 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(5, 0, 1), /* 288 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0010 0010 ... */
+ /* 0 */ V(4, 2, 1), /* 290 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(0, 4, 1), /* 292 */
+ /* 1 */ V(4, 0, 1),
+
+ /* 0000 0110 1100 ... */
+ /* 0000 */ V(12, 14, 4), /* 294 */
+ /* 0001 */ PTR(400, 1),
+ /* 0010 */ V(13, 14, 3),
+ /* 0011 */ V(13, 14, 3),
+ /* 0100 */ V(14, 9, 3),
+ /* 0101 */ V(14, 9, 3),
+ /* 0110 */ V(14, 10, 4),
+ /* 0111 */ V(13, 9, 4),
+ /* 1000 */ V(14, 14, 2),
+ /* 1001 */ V(14, 14, 2),
+ /* 1010 */ V(14, 14, 2),
+ /* 1011 */ V(14, 14, 2),
+ /* 1100 */ V(14, 13, 3),
+ /* 1101 */ V(14, 13, 3),
+ /* 1110 */ V(14, 11, 3),
+ /* 1111 */ V(14, 11, 3),
+
+ /* 0000 0110 1101 ... */
+ /* 000 */ V(11, 14, 2), /* 310 */
+ /* 001 */ V(11, 14, 2),
+ /* 010 */ V(12, 13, 2),
+ /* 011 */ V(12, 13, 2),
+ /* 100 */ V(13, 12, 3),
+ /* 101 */ V(13, 11, 3),
+ /* 110 */ V(10, 14, 2),
+ /* 111 */ V(10, 14, 2),
+
+ /* 0000 0110 1110 ... */
+ /* 000 */ V(12, 12, 2), /* 318 */
+ /* 001 */ V(12, 12, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(13, 10, 3),
+ /* 100 */ V(7, 14, 3),
+ /* 101 */ V(10, 12, 3),
+ /* 110 */ V(12, 10, 2),
+ /* 111 */ V(12, 10, 2),
+
+ /* 0000 0110 1111 ... */
+ /* 000 */ V(12, 9, 3), /* 326 */
+ /* 001 */ V(7, 13, 3),
+ /* 010 */ V(5, 14, 2),
+ /* 011 */ V(5, 14, 2),
+ /* 100 */ V(11, 13, 1),
+ /* 101 */ V(11, 13, 1),
+ /* 110 */ V(11, 13, 1),
+ /* 111 */ V(11, 13, 1),
+
+ /* 0000 1011 0000 ... */
+ /* 00 */ V(9, 14, 1), /* 334 */
+ /* 01 */ V(9, 14, 1),
+ /* 10 */ V(11, 12, 2),
+ /* 11 */ V(12, 11, 2),
+
+ /* 0000 1011 0001 ... */
+ /* 00 */ V(8, 14, 2), /* 338 */
+ /* 01 */ V(14, 8, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(14, 7, 2),
+
+ /* 0000 1011 0010 ... */
+ /* 00 */ V(11, 11, 2), /* 342 */
+ /* 01 */ V(8, 13, 2),
+ /* 10 */ V(13, 8, 2),
+ /* 11 */ V(6, 14, 2),
+
+ /* 0000 1011 0011 ... */
+ /* 0 */ V(14, 6, 1), /* 346 */
+ /* 1 */ V(9, 12, 1),
+
+ /* 0000 1011 0100 ... */
+ /* 00 */ V(10, 11, 2), /* 348 */
+ /* 01 */ V(11, 10, 2),
+ /* 10 */ V(14, 5, 2),
+ /* 11 */ V(13, 7, 2),
+
+ /* 0000 1011 0101 ... */
+ /* 00 */ V(4, 14, 1), /* 352 */
+ /* 01 */ V(4, 14, 1),
+ /* 10 */ V(14, 4, 2),
+ /* 11 */ V(8, 12, 2),
+
+ /* 0000 1011 0110 ... */
+ /* 0 */ V(12, 8, 1), /* 356 */
+ /* 1 */ V(3, 14, 1),
+
+ /* 0000 1011 0111 ... */
+ /* 00 */ V(6, 13, 1), /* 358 */
+ /* 01 */ V(6, 13, 1),
+ /* 10 */ V(13, 6, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0000 1011 1000 ... */
+ /* 00 */ V(11, 9, 2), /* 362 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 1, 1),
+ /* 11 */ V(14, 1, 1),
+
+ /* 0000 1011 1001 ... */
+ /* 00 */ V(13, 4, 1), /* 366 */
+ /* 01 */ V(13, 4, 1),
+ /* 10 */ V(11, 8, 2),
+ /* 11 */ V(10, 9, 2),
+
+ /* 0000 1011 1010 ... */
+ /* 00 */ V(7, 11, 1), /* 370 */
+ /* 01 */ V(7, 11, 1),
+ /* 10 */ V(11, 7, 2),
+ /* 11 */ V(13, 0, 2),
+
+ /* 0000 1011 1100 ... */
+ /* 0 */ V(0, 14, 1), /* 374 */
+ /* 1 */ V(14, 0, 1),
+
+ /* 0000 1011 1101 ... */
+ /* 0 */ V(5, 13, 1), /* 376 */
+ /* 1 */ V(13, 5, 1),
+
+ /* 0000 1011 1110 ... */
+ /* 0 */ V(7, 12, 1), /* 378 */
+ /* 1 */ V(12, 7, 1),
+
+ /* 0000 1011 1111 ... */
+ /* 0 */ V(4, 13, 1), /* 380 */
+ /* 1 */ V(8, 11, 1),
+
+ /* 0000 1100 0000 ... */
+ /* 0 */ V(9, 10, 1), /* 382 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 1100 0001 ... */
+ /* 0 */ V(12, 6, 1), /* 384 */
+ /* 1 */ V(3, 13, 1),
+
+ /* 0000 1100 0010 ... */
+ /* 0 */ V(5, 12, 1), /* 386 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 1100 0100 ... */
+ /* 0 */ V(8, 10, 1), /* 388 */
+ /* 1 */ V(10, 8, 1),
+
+ /* 0000 1100 0101 ... */
+ /* 0 */ V(9, 9, 1), /* 390 */
+ /* 1 */ V(4, 12, 1),
+
+ /* 0000 1100 0110 ... */
+ /* 0 */ V(11, 6, 1), /* 392 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 1100 1000 ... */
+ /* 0 */ V(5, 11, 1), /* 394 */
+ /* 1 */ V(8, 9, 1),
+
+ /* 0000 1100 1011 ... */
+ /* 0 */ V(9, 8, 1), /* 396 */
+ /* 1 */ V(7, 9, 1),
+
+ /* 0000 1101 0101 ... */
+ /* 0 */ V(9, 7, 1), /* 398 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0000 0110 1100 0001 ... */
+ /* 0 */ V(14, 12, 1), /* 400 */
+ /* 1 */ V(13, 13, 1)
};
static
-union huffpair const hufftab24[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(64, 4),
- /* 0101 */ PTR(80, 4),
- /* 0110 */ PTR(96, 4),
- /* 0111 */ PTR(112, 4),
- /* 1000 */ PTR(128, 4),
- /* 1001 */ PTR(144, 4),
- /* 1010 */ PTR(160, 3),
- /* 1011 */ PTR(168, 2),
- /* 1100 */ V(1, 1, 4),
- /* 1101 */ V(0, 1, 4),
- /* 1110 */ V(1, 0, 4),
- /* 1111 */ V(0, 0, 4),
-
- /* 0000 ... */
- /* 0000 */ V(14, 15, 4), /* 16 */
- /* 0001 */ V(15, 14, 4),
- /* 0010 */ V(13, 15, 4),
- /* 0011 */ V(15, 13, 4),
- /* 0100 */ V(12, 15, 4),
- /* 0101 */ V(15, 12, 4),
- /* 0110 */ V(11, 15, 4),
- /* 0111 */ V(15, 11, 4),
- /* 1000 */ V(15, 10, 3),
- /* 1001 */ V(15, 10, 3),
- /* 1010 */ V(10, 15, 4),
- /* 1011 */ V(9, 15, 4),
- /* 1100 */ V(15, 9, 3),
- /* 1101 */ V(15, 9, 3),
- /* 1110 */ V(15, 8, 3),
- /* 1111 */ V(15, 8, 3),
-
- /* 0001 ... */
- /* 0000 */ V(8, 15, 4), /* 32 */
- /* 0001 */ V(7, 15, 4),
- /* 0010 */ V(15, 7, 3),
- /* 0011 */ V(15, 7, 3),
- /* 0100 */ V(6, 15, 3),
- /* 0101 */ V(6, 15, 3),
- /* 0110 */ V(15, 6, 3),
- /* 0111 */ V(15, 6, 3),
- /* 1000 */ V(5, 15, 3),
- /* 1001 */ V(5, 15, 3),
- /* 1010 */ V(15, 5, 3),
- /* 1011 */ V(15, 5, 3),
- /* 1100 */ V(4, 15, 3),
- /* 1101 */ V(4, 15, 3),
- /* 1110 */ V(15, 4, 3),
- /* 1111 */ V(15, 4, 3),
-
- /* 0010 ... */
- /* 0000 */ V(3, 15, 3), /* 48 */
- /* 0001 */ V(3, 15, 3),
- /* 0010 */ V(15, 3, 3),
- /* 0011 */ V(15, 3, 3),
- /* 0100 */ V(2, 15, 3),
- /* 0101 */ V(2, 15, 3),
- /* 0110 */ V(15, 2, 3),
- /* 0111 */ V(15, 2, 3),
- /* 1000 */ V(15, 1, 3),
- /* 1001 */ V(15, 1, 3),
- /* 1010 */ V(1, 15, 4),
- /* 1011 */ V(15, 0, 4),
- /* 1100 */ PTR(172, 3),
- /* 1101 */ PTR(180, 3),
- /* 1110 */ PTR(188, 3),
- /* 1111 */ PTR(196, 3),
-
- /* 0100 ... */
- /* 0000 */ PTR(204, 4), /* 64 */
- /* 0001 */ PTR(220, 3),
- /* 0010 */ PTR(228, 3),
- /* 0011 */ PTR(236, 3),
- /* 0100 */ PTR(244, 2),
- /* 0101 */ PTR(248, 2),
- /* 0110 */ PTR(252, 2),
- /* 0111 */ PTR(256, 2),
- /* 1000 */ PTR(260, 2),
- /* 1001 */ PTR(264, 2),
- /* 1010 */ PTR(268, 2),
- /* 1011 */ PTR(272, 2),
- /* 1100 */ PTR(276, 2),
- /* 1101 */ PTR(280, 3),
- /* 1110 */ PTR(288, 2),
- /* 1111 */ PTR(292, 2),
-
- /* 0101 ... */
- /* 0000 */ PTR(296, 2), /* 80 */
- /* 0001 */ PTR(300, 3),
- /* 0010 */ PTR(308, 2),
- /* 0011 */ PTR(312, 3),
- /* 0100 */ PTR(320, 1),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 2),
- /* 0111 */ PTR(330, 1),
- /* 1000 */ PTR(332, 2),
- /* 1001 */ PTR(336, 1),
- /* 1010 */ PTR(338, 1),
- /* 1011 */ PTR(340, 1),
- /* 1100 */ PTR(342, 1),
- /* 1101 */ PTR(344, 1),
- /* 1110 */ PTR(346, 1),
- /* 1111 */ PTR(348, 1),
-
- /* 0110 ... */
- /* 0000 */ PTR(350, 1), /* 96 */
- /* 0001 */ PTR(352, 1),
- /* 0010 */ PTR(354, 1),
- /* 0011 */ PTR(356, 1),
- /* 0100 */ PTR(358, 1),
- /* 0101 */ PTR(360, 1),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ PTR(364, 1),
- /* 1000 */ PTR(366, 1),
- /* 1001 */ PTR(368, 1),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 2),
- /* 1101 */ V(7, 3, 4),
- /* 1110 */ PTR(380, 1),
- /* 1111 */ V(7, 2, 4),
-
- /* 0111 ... */
- /* 0000 */ V(4, 6, 4), /* 112 */
- /* 0001 */ V(6, 4, 4),
- /* 0010 */ V(5, 5, 4),
- /* 0011 */ V(7, 1, 4),
- /* 0100 */ V(3, 6, 4),
- /* 0101 */ V(6, 3, 4),
- /* 0110 */ V(4, 5, 4),
- /* 0111 */ V(5, 4, 4),
- /* 1000 */ V(2, 6, 4),
- /* 1001 */ V(6, 2, 4),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 1, 4),
- /* 1100 */ PTR(382, 1),
- /* 1101 */ V(3, 5, 4),
- /* 1110 */ V(5, 3, 4),
- /* 1111 */ V(4, 4, 4),
-
- /* 1000 ... */
- /* 0000 */ V(2, 5, 4), /* 128 */
- /* 0001 */ V(5, 2, 4),
- /* 0010 */ V(1, 5, 4),
- /* 0011 */ PTR(384, 1),
- /* 0100 */ V(5, 1, 3),
- /* 0101 */ V(5, 1, 3),
- /* 0110 */ V(3, 4, 4),
- /* 0111 */ V(4, 3, 4),
- /* 1000 */ V(2, 4, 3),
- /* 1001 */ V(2, 4, 3),
- /* 1010 */ V(4, 2, 3),
- /* 1011 */ V(4, 2, 3),
- /* 1100 */ V(3, 3, 3),
- /* 1101 */ V(3, 3, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 1001 ... */
- /* 0000 */ V(4, 1, 3), /* 144 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 1010 ... */
- /* 000 */ V(0, 3, 3), /* 160 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(1, 2, 1),
- /* 101 */ V(1, 2, 1),
- /* 110 */ V(1, 2, 1),
- /* 111 */ V(1, 2, 1),
-
- /* 1011 ... */
- /* 00 */ V(2, 1, 1), /* 168 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0010 1100 ... */
- /* 000 */ V(0, 15, 1), /* 172 */
- /* 001 */ V(0, 15, 1),
- /* 010 */ V(0, 15, 1),
- /* 011 */ V(0, 15, 1),
- /* 100 */ V(14, 14, 3),
- /* 101 */ V(13, 14, 3),
- /* 110 */ V(14, 13, 3),
- /* 111 */ V(12, 14, 3),
-
- /* 0010 1101 ... */
- /* 000 */ V(14, 12, 3), /* 180 */
- /* 001 */ V(13, 13, 3),
- /* 010 */ V(11, 14, 3),
- /* 011 */ V(14, 11, 3),
- /* 100 */ V(12, 13, 3),
- /* 101 */ V(13, 12, 3),
- /* 110 */ V(10, 14, 3),
- /* 111 */ V(14, 10, 3),
-
- /* 0010 1110 ... */
- /* 000 */ V(11, 13, 3), /* 188 */
- /* 001 */ V(13, 11, 3),
- /* 010 */ V(12, 12, 3),
- /* 011 */ V(9, 14, 3),
- /* 100 */ V(14, 9, 3),
- /* 101 */ V(10, 13, 3),
- /* 110 */ V(13, 10, 3),
- /* 111 */ V(11, 12, 3),
-
- /* 0010 1111 ... */
- /* 000 */ V(12, 11, 3), /* 196 */
- /* 001 */ V(8, 14, 3),
- /* 010 */ V(14, 8, 3),
- /* 011 */ V(9, 13, 3),
- /* 100 */ V(13, 9, 3),
- /* 101 */ V(7, 14, 3),
- /* 110 */ V(14, 7, 3),
- /* 111 */ V(10, 12, 3),
-
- /* 0100 0000 ... */
- /* 0000 */ V(12, 10, 3), /* 204 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(8, 13, 3),
- /* 0101 */ V(8, 13, 3),
- /* 0110 */ V(13, 8, 3),
- /* 0111 */ V(13, 8, 3),
- /* 1000 */ V(0, 14, 4),
- /* 1001 */ V(14, 0, 4),
- /* 1010 */ V(0, 13, 3),
- /* 1011 */ V(0, 13, 3),
- /* 1100 */ V(14, 6, 2),
- /* 1101 */ V(14, 6, 2),
- /* 1110 */ V(14, 6, 2),
- /* 1111 */ V(14, 6, 2),
-
- /* 0100 0001 ... */
- /* 000 */ V(6, 14, 3), /* 220 */
- /* 001 */ V(9, 12, 3),
- /* 010 */ V(12, 9, 2),
- /* 011 */ V(12, 9, 2),
- /* 100 */ V(5, 14, 2),
- /* 101 */ V(5, 14, 2),
- /* 110 */ V(11, 10, 2),
- /* 111 */ V(11, 10, 2),
-
- /* 0100 0010 ... */
- /* 000 */ V(14, 5, 2), /* 228 */
- /* 001 */ V(14, 5, 2),
- /* 010 */ V(10, 11, 3),
- /* 011 */ V(7, 13, 3),
- /* 100 */ V(13, 7, 2),
- /* 101 */ V(13, 7, 2),
- /* 110 */ V(14, 4, 2),
- /* 111 */ V(14, 4, 2),
-
- /* 0100 0011 ... */
- /* 000 */ V(8, 12, 2), /* 236 */
- /* 001 */ V(8, 12, 2),
- /* 010 */ V(12, 8, 2),
- /* 011 */ V(12, 8, 2),
- /* 100 */ V(4, 14, 3),
- /* 101 */ V(2, 14, 3),
- /* 110 */ V(3, 14, 2),
- /* 111 */ V(3, 14, 2),
-
- /* 0100 0100 ... */
- /* 00 */ V(6, 13, 2), /* 244 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(14, 3, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0100 0101 ... */
- /* 00 */ V(11, 9, 2), /* 248 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 2, 2),
- /* 11 */ V(1, 14, 2),
-
- /* 0100 0110 ... */
- /* 00 */ V(14, 1, 2), /* 252 */
- /* 01 */ V(5, 13, 2),
- /* 10 */ V(13, 5, 2),
- /* 11 */ V(7, 12, 2),
-
- /* 0100 0111 ... */
- /* 00 */ V(12, 7, 2), /* 256 */
- /* 01 */ V(4, 13, 2),
- /* 10 */ V(8, 11, 2),
- /* 11 */ V(11, 8, 2),
-
- /* 0100 1000 ... */
- /* 00 */ V(13, 4, 2), /* 260 */
- /* 01 */ V(9, 10, 2),
- /* 10 */ V(10, 9, 2),
- /* 11 */ V(6, 12, 2),
-
- /* 0100 1001 ... */
- /* 00 */ V(12, 6, 2), /* 264 */
- /* 01 */ V(3, 13, 2),
- /* 10 */ V(13, 3, 2),
- /* 11 */ V(2, 13, 2),
-
- /* 0100 1010 ... */
- /* 00 */ V(13, 2, 2), /* 268 */
- /* 01 */ V(1, 13, 2),
- /* 10 */ V(7, 11, 2),
- /* 11 */ V(11, 7, 2),
-
- /* 0100 1011 ... */
- /* 00 */ V(13, 1, 2), /* 272 */
- /* 01 */ V(5, 12, 2),
- /* 10 */ V(12, 5, 2),
- /* 11 */ V(8, 10, 2),
-
- /* 0100 1100 ... */
- /* 00 */ V(10, 8, 2), /* 276 */
- /* 01 */ V(9, 9, 2),
- /* 10 */ V(4, 12, 2),
- /* 11 */ V(12, 4, 2),
-
- /* 0100 1101 ... */
- /* 000 */ V(6, 11, 2), /* 280 */
- /* 001 */ V(6, 11, 2),
- /* 010 */ V(11, 6, 2),
- /* 011 */ V(11, 6, 2),
- /* 100 */ V(13, 0, 3),
- /* 101 */ V(0, 12, 3),
- /* 110 */ V(3, 12, 2),
- /* 111 */ V(3, 12, 2),
-
- /* 0100 1110 ... */
- /* 00 */ V(12, 3, 2), /* 288 */
- /* 01 */ V(7, 10, 2),
- /* 10 */ V(10, 7, 2),
- /* 11 */ V(2, 12, 2),
-
- /* 0100 1111 ... */
- /* 00 */ V(12, 2, 2), /* 292 */
- /* 01 */ V(5, 11, 2),
- /* 10 */ V(11, 5, 2),
- /* 11 */ V(1, 12, 2),
-
- /* 0101 0000 ... */
- /* 00 */ V(8, 9, 2), /* 296 */
- /* 01 */ V(9, 8, 2),
- /* 10 */ V(12, 1, 2),
- /* 11 */ V(4, 11, 2),
-
- /* 0101 0001 ... */
- /* 000 */ V(12, 0, 3), /* 300 */
- /* 001 */ V(0, 11, 3),
- /* 010 */ V(3, 11, 2),
- /* 011 */ V(3, 11, 2),
- /* 100 */ V(11, 0, 3),
- /* 101 */ V(0, 10, 3),
- /* 110 */ V(1, 10, 2),
- /* 111 */ V(1, 10, 2),
-
- /* 0101 0010 ... */
- /* 00 */ V(11, 4, 1), /* 308 */
- /* 01 */ V(11, 4, 1),
- /* 10 */ V(6, 10, 2),
- /* 11 */ V(10, 6, 2),
-
- /* 0101 0011 ... */
- /* 000 */ V(7, 9, 2), /* 312 */
- /* 001 */ V(7, 9, 2),
- /* 010 */ V(9, 7, 2),
- /* 011 */ V(9, 7, 2),
- /* 100 */ V(10, 0, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(9, 0, 2),
- /* 111 */ V(9, 0, 2),
-
- /* 0101 0100 ... */
- /* 0 */ V(11, 3, 1), /* 320 */
- /* 1 */ V(8, 8, 1),
-
- /* 0101 0101 ... */
- /* 00 */ V(2, 11, 2), /* 322 */
- /* 01 */ V(5, 10, 2),
- /* 10 */ V(11, 2, 1),
- /* 11 */ V(11, 2, 1),
-
- /* 0101 0110 ... */
- /* 00 */ V(10, 5, 2), /* 326 */
- /* 01 */ V(1, 11, 2),
- /* 10 */ V(11, 1, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0101 0111 ... */
- /* 0 */ V(9, 6, 1), /* 330 */
- /* 1 */ V(10, 4, 1),
-
- /* 0101 1000 ... */
- /* 00 */ V(4, 10, 2), /* 332 */
- /* 01 */ V(7, 8, 2),
- /* 10 */ V(8, 7, 1),
- /* 11 */ V(8, 7, 1),
-
- /* 0101 1001 ... */
- /* 0 */ V(3, 10, 1), /* 336 */
- /* 1 */ V(10, 3, 1),
-
- /* 0101 1010 ... */
- /* 0 */ V(5, 9, 1), /* 338 */
- /* 1 */ V(9, 5, 1),
-
- /* 0101 1011 ... */
- /* 0 */ V(2, 10, 1), /* 340 */
- /* 1 */ V(10, 2, 1),
-
- /* 0101 1100 ... */
- /* 0 */ V(10, 1, 1), /* 342 */
- /* 1 */ V(6, 8, 1),
-
- /* 0101 1101 ... */
- /* 0 */ V(8, 6, 1), /* 344 */
- /* 1 */ V(7, 7, 1),
-
- /* 0101 1110 ... */
- /* 0 */ V(4, 9, 1), /* 346 */
- /* 1 */ V(9, 4, 1),
-
- /* 0101 1111 ... */
- /* 0 */ V(3, 9, 1), /* 348 */
- /* 1 */ V(9, 3, 1),
-
- /* 0110 0000 ... */
- /* 0 */ V(5, 8, 1), /* 350 */
- /* 1 */ V(8, 5, 1),
-
- /* 0110 0001 ... */
- /* 0 */ V(2, 9, 1), /* 352 */
- /* 1 */ V(6, 7, 1),
-
- /* 0110 0010 ... */
- /* 0 */ V(7, 6, 1), /* 354 */
- /* 1 */ V(9, 2, 1),
-
- /* 0110 0011 ... */
- /* 0 */ V(1, 9, 1), /* 356 */
- /* 1 */ V(9, 1, 1),
-
- /* 0110 0100 ... */
- /* 0 */ V(4, 8, 1), /* 358 */
- /* 1 */ V(8, 4, 1),
-
- /* 0110 0101 ... */
- /* 0 */ V(5, 7, 1), /* 360 */
- /* 1 */ V(7, 5, 1),
-
- /* 0110 0110 ... */
- /* 0 */ V(3, 8, 1), /* 362 */
- /* 1 */ V(8, 3, 1),
-
- /* 0110 0111 ... */
- /* 0 */ V(6, 6, 1), /* 364 */
- /* 1 */ V(2, 8, 1),
-
- /* 0110 1000 ... */
- /* 0 */ V(8, 2, 1), /* 366 */
- /* 1 */ V(1, 8, 1),
-
- /* 0110 1001 ... */
- /* 0 */ V(4, 7, 1), /* 368 */
- /* 1 */ V(7, 4, 1),
-
- /* 0110 1010 ... */
- /* 00 */ V(8, 1, 1), /* 370 */
- /* 01 */ V(8, 1, 1),
- /* 10 */ V(0, 8, 2),
- /* 11 */ V(8, 0, 2),
-
- /* 0110 1011 ... */
- /* 0 */ V(5, 6, 1), /* 374 */
- /* 1 */ V(6, 5, 1),
-
- /* 0110 1100 ... */
- /* 00 */ V(1, 7, 1), /* 376 */
- /* 01 */ V(1, 7, 1),
- /* 10 */ V(0, 7, 2),
- /* 11 */ V(7, 0, 2),
-
- /* 0110 1110 ... */
- /* 0 */ V(3, 7, 1), /* 380 */
- /* 1 */ V(2, 7, 1),
-
- /* 0111 1100 ... */
- /* 0 */ V(0, 6, 1), /* 382 */
- /* 1 */ V(6, 0, 1),
-
- /* 1000 0011 ... */
- /* 0 */ V(0, 5, 1), /* 384 */
- /* 1 */ V(5, 0, 1)
+union huffpair const hufftab24[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(64, 4),
+ /* 0101 */ PTR(80, 4),
+ /* 0110 */ PTR(96, 4),
+ /* 0111 */ PTR(112, 4),
+ /* 1000 */ PTR(128, 4),
+ /* 1001 */ PTR(144, 4),
+ /* 1010 */ PTR(160, 3),
+ /* 1011 */ PTR(168, 2),
+ /* 1100 */ V(1, 1, 4),
+ /* 1101 */ V(0, 1, 4),
+ /* 1110 */ V(1, 0, 4),
+ /* 1111 */ V(0, 0, 4),
+
+ /* 0000 ... */
+ /* 0000 */ V(14, 15, 4), /* 16 */
+ /* 0001 */ V(15, 14, 4),
+ /* 0010 */ V(13, 15, 4),
+ /* 0011 */ V(15, 13, 4),
+ /* 0100 */ V(12, 15, 4),
+ /* 0101 */ V(15, 12, 4),
+ /* 0110 */ V(11, 15, 4),
+ /* 0111 */ V(15, 11, 4),
+ /* 1000 */ V(15, 10, 3),
+ /* 1001 */ V(15, 10, 3),
+ /* 1010 */ V(10, 15, 4),
+ /* 1011 */ V(9, 15, 4),
+ /* 1100 */ V(15, 9, 3),
+ /* 1101 */ V(15, 9, 3),
+ /* 1110 */ V(15, 8, 3),
+ /* 1111 */ V(15, 8, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(8, 15, 4), /* 32 */
+ /* 0001 */ V(7, 15, 4),
+ /* 0010 */ V(15, 7, 3),
+ /* 0011 */ V(15, 7, 3),
+ /* 0100 */ V(6, 15, 3),
+ /* 0101 */ V(6, 15, 3),
+ /* 0110 */ V(15, 6, 3),
+ /* 0111 */ V(15, 6, 3),
+ /* 1000 */ V(5, 15, 3),
+ /* 1001 */ V(5, 15, 3),
+ /* 1010 */ V(15, 5, 3),
+ /* 1011 */ V(15, 5, 3),
+ /* 1100 */ V(4, 15, 3),
+ /* 1101 */ V(4, 15, 3),
+ /* 1110 */ V(15, 4, 3),
+ /* 1111 */ V(15, 4, 3),
+
+ /* 0010 ... */
+ /* 0000 */ V(3, 15, 3), /* 48 */
+ /* 0001 */ V(3, 15, 3),
+ /* 0010 */ V(15, 3, 3),
+ /* 0011 */ V(15, 3, 3),
+ /* 0100 */ V(2, 15, 3),
+ /* 0101 */ V(2, 15, 3),
+ /* 0110 */ V(15, 2, 3),
+ /* 0111 */ V(15, 2, 3),
+ /* 1000 */ V(15, 1, 3),
+ /* 1001 */ V(15, 1, 3),
+ /* 1010 */ V(1, 15, 4),
+ /* 1011 */ V(15, 0, 4),
+ /* 1100 */ PTR(172, 3),
+ /* 1101 */ PTR(180, 3),
+ /* 1110 */ PTR(188, 3),
+ /* 1111 */ PTR(196, 3),
+
+ /* 0100 ... */
+ /* 0000 */ PTR(204, 4), /* 64 */
+ /* 0001 */ PTR(220, 3),
+ /* 0010 */ PTR(228, 3),
+ /* 0011 */ PTR(236, 3),
+ /* 0100 */ PTR(244, 2),
+ /* 0101 */ PTR(248, 2),
+ /* 0110 */ PTR(252, 2),
+ /* 0111 */ PTR(256, 2),
+ /* 1000 */ PTR(260, 2),
+ /* 1001 */ PTR(264, 2),
+ /* 1010 */ PTR(268, 2),
+ /* 1011 */ PTR(272, 2),
+ /* 1100 */ PTR(276, 2),
+ /* 1101 */ PTR(280, 3),
+ /* 1110 */ PTR(288, 2),
+ /* 1111 */ PTR(292, 2),
+
+ /* 0101 ... */
+ /* 0000 */ PTR(296, 2), /* 80 */
+ /* 0001 */ PTR(300, 3),
+ /* 0010 */ PTR(308, 2),
+ /* 0011 */ PTR(312, 3),
+ /* 0100 */ PTR(320, 1),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 2),
+ /* 0111 */ PTR(330, 1),
+ /* 1000 */ PTR(332, 2),
+ /* 1001 */ PTR(336, 1),
+ /* 1010 */ PTR(338, 1),
+ /* 1011 */ PTR(340, 1),
+ /* 1100 */ PTR(342, 1),
+ /* 1101 */ PTR(344, 1),
+ /* 1110 */ PTR(346, 1),
+ /* 1111 */ PTR(348, 1),
+
+ /* 0110 ... */
+ /* 0000 */ PTR(350, 1), /* 96 */
+ /* 0001 */ PTR(352, 1),
+ /* 0010 */ PTR(354, 1),
+ /* 0011 */ PTR(356, 1),
+ /* 0100 */ PTR(358, 1),
+ /* 0101 */ PTR(360, 1),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ PTR(364, 1),
+ /* 1000 */ PTR(366, 1),
+ /* 1001 */ PTR(368, 1),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 2),
+ /* 1101 */ V(7, 3, 4),
+ /* 1110 */ PTR(380, 1),
+ /* 1111 */ V(7, 2, 4),
+
+ /* 0111 ... */
+ /* 0000 */ V(4, 6, 4), /* 112 */
+ /* 0001 */ V(6, 4, 4),
+ /* 0010 */ V(5, 5, 4),
+ /* 0011 */ V(7, 1, 4),
+ /* 0100 */ V(3, 6, 4),
+ /* 0101 */ V(6, 3, 4),
+ /* 0110 */ V(4, 5, 4),
+ /* 0111 */ V(5, 4, 4),
+ /* 1000 */ V(2, 6, 4),
+ /* 1001 */ V(6, 2, 4),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 1, 4),
+ /* 1100 */ PTR(382, 1),
+ /* 1101 */ V(3, 5, 4),
+ /* 1110 */ V(5, 3, 4),
+ /* 1111 */ V(4, 4, 4),
+
+ /* 1000 ... */
+ /* 0000 */ V(2, 5, 4), /* 128 */
+ /* 0001 */ V(5, 2, 4),
+ /* 0010 */ V(1, 5, 4),
+ /* 0011 */ PTR(384, 1),
+ /* 0100 */ V(5, 1, 3),
+ /* 0101 */ V(5, 1, 3),
+ /* 0110 */ V(3, 4, 4),
+ /* 0111 */ V(4, 3, 4),
+ /* 1000 */ V(2, 4, 3),
+ /* 1001 */ V(2, 4, 3),
+ /* 1010 */ V(4, 2, 3),
+ /* 1011 */ V(4, 2, 3),
+ /* 1100 */ V(3, 3, 3),
+ /* 1101 */ V(3, 3, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 1001 ... */
+ /* 0000 */ V(4, 1, 3), /* 144 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 1010 ... */
+ /* 000 */ V(0, 3, 3), /* 160 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(1, 2, 1),
+ /* 101 */ V(1, 2, 1),
+ /* 110 */ V(1, 2, 1),
+ /* 111 */ V(1, 2, 1),
+
+ /* 1011 ... */
+ /* 00 */ V(2, 1, 1), /* 168 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0010 1100 ... */
+ /* 000 */ V(0, 15, 1), /* 172 */
+ /* 001 */ V(0, 15, 1),
+ /* 010 */ V(0, 15, 1),
+ /* 011 */ V(0, 15, 1),
+ /* 100 */ V(14, 14, 3),
+ /* 101 */ V(13, 14, 3),
+ /* 110 */ V(14, 13, 3),
+ /* 111 */ V(12, 14, 3),
+
+ /* 0010 1101 ... */
+ /* 000 */ V(14, 12, 3), /* 180 */
+ /* 001 */ V(13, 13, 3),
+ /* 010 */ V(11, 14, 3),
+ /* 011 */ V(14, 11, 3),
+ /* 100 */ V(12, 13, 3),
+ /* 101 */ V(13, 12, 3),
+ /* 110 */ V(10, 14, 3),
+ /* 111 */ V(14, 10, 3),
+
+ /* 0010 1110 ... */
+ /* 000 */ V(11, 13, 3), /* 188 */
+ /* 001 */ V(13, 11, 3),
+ /* 010 */ V(12, 12, 3),
+ /* 011 */ V(9, 14, 3),
+ /* 100 */ V(14, 9, 3),
+ /* 101 */ V(10, 13, 3),
+ /* 110 */ V(13, 10, 3),
+ /* 111 */ V(11, 12, 3),
+
+ /* 0010 1111 ... */
+ /* 000 */ V(12, 11, 3), /* 196 */
+ /* 001 */ V(8, 14, 3),
+ /* 010 */ V(14, 8, 3),
+ /* 011 */ V(9, 13, 3),
+ /* 100 */ V(13, 9, 3),
+ /* 101 */ V(7, 14, 3),
+ /* 110 */ V(14, 7, 3),
+ /* 111 */ V(10, 12, 3),
+
+ /* 0100 0000 ... */
+ /* 0000 */ V(12, 10, 3), /* 204 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(8, 13, 3),
+ /* 0101 */ V(8, 13, 3),
+ /* 0110 */ V(13, 8, 3),
+ /* 0111 */ V(13, 8, 3),
+ /* 1000 */ V(0, 14, 4),
+ /* 1001 */ V(14, 0, 4),
+ /* 1010 */ V(0, 13, 3),
+ /* 1011 */ V(0, 13, 3),
+ /* 1100 */ V(14, 6, 2),
+ /* 1101 */ V(14, 6, 2),
+ /* 1110 */ V(14, 6, 2),
+ /* 1111 */ V(14, 6, 2),
+
+ /* 0100 0001 ... */
+ /* 000 */ V(6, 14, 3), /* 220 */
+ /* 001 */ V(9, 12, 3),
+ /* 010 */ V(12, 9, 2),
+ /* 011 */ V(12, 9, 2),
+ /* 100 */ V(5, 14, 2),
+ /* 101 */ V(5, 14, 2),
+ /* 110 */ V(11, 10, 2),
+ /* 111 */ V(11, 10, 2),
+
+ /* 0100 0010 ... */
+ /* 000 */ V(14, 5, 2), /* 228 */
+ /* 001 */ V(14, 5, 2),
+ /* 010 */ V(10, 11, 3),
+ /* 011 */ V(7, 13, 3),
+ /* 100 */ V(13, 7, 2),
+ /* 101 */ V(13, 7, 2),
+ /* 110 */ V(14, 4, 2),
+ /* 111 */ V(14, 4, 2),
+
+ /* 0100 0011 ... */
+ /* 000 */ V(8, 12, 2), /* 236 */
+ /* 001 */ V(8, 12, 2),
+ /* 010 */ V(12, 8, 2),
+ /* 011 */ V(12, 8, 2),
+ /* 100 */ V(4, 14, 3),
+ /* 101 */ V(2, 14, 3),
+ /* 110 */ V(3, 14, 2),
+ /* 111 */ V(3, 14, 2),
+
+ /* 0100 0100 ... */
+ /* 00 */ V(6, 13, 2), /* 244 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(14, 3, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0100 0101 ... */
+ /* 00 */ V(11, 9, 2), /* 248 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 2, 2),
+ /* 11 */ V(1, 14, 2),
+
+ /* 0100 0110 ... */
+ /* 00 */ V(14, 1, 2), /* 252 */
+ /* 01 */ V(5, 13, 2),
+ /* 10 */ V(13, 5, 2),
+ /* 11 */ V(7, 12, 2),
+
+ /* 0100 0111 ... */
+ /* 00 */ V(12, 7, 2), /* 256 */
+ /* 01 */ V(4, 13, 2),
+ /* 10 */ V(8, 11, 2),
+ /* 11 */ V(11, 8, 2),
+
+ /* 0100 1000 ... */
+ /* 00 */ V(13, 4, 2), /* 260 */
+ /* 01 */ V(9, 10, 2),
+ /* 10 */ V(10, 9, 2),
+ /* 11 */ V(6, 12, 2),
+
+ /* 0100 1001 ... */
+ /* 00 */ V(12, 6, 2), /* 264 */
+ /* 01 */ V(3, 13, 2),
+ /* 10 */ V(13, 3, 2),
+ /* 11 */ V(2, 13, 2),
+
+ /* 0100 1010 ... */
+ /* 00 */ V(13, 2, 2), /* 268 */
+ /* 01 */ V(1, 13, 2),
+ /* 10 */ V(7, 11, 2),
+ /* 11 */ V(11, 7, 2),
+
+ /* 0100 1011 ... */
+ /* 00 */ V(13, 1, 2), /* 272 */
+ /* 01 */ V(5, 12, 2),
+ /* 10 */ V(12, 5, 2),
+ /* 11 */ V(8, 10, 2),
+
+ /* 0100 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 276 */
+ /* 01 */ V(9, 9, 2),
+ /* 10 */ V(4, 12, 2),
+ /* 11 */ V(12, 4, 2),
+
+ /* 0100 1101 ... */
+ /* 000 */ V(6, 11, 2), /* 280 */
+ /* 001 */ V(6, 11, 2),
+ /* 010 */ V(11, 6, 2),
+ /* 011 */ V(11, 6, 2),
+ /* 100 */ V(13, 0, 3),
+ /* 101 */ V(0, 12, 3),
+ /* 110 */ V(3, 12, 2),
+ /* 111 */ V(3, 12, 2),
+
+ /* 0100 1110 ... */
+ /* 00 */ V(12, 3, 2), /* 288 */
+ /* 01 */ V(7, 10, 2),
+ /* 10 */ V(10, 7, 2),
+ /* 11 */ V(2, 12, 2),
+
+ /* 0100 1111 ... */
+ /* 00 */ V(12, 2, 2), /* 292 */
+ /* 01 */ V(5, 11, 2),
+ /* 10 */ V(11, 5, 2),
+ /* 11 */ V(1, 12, 2),
+
+ /* 0101 0000 ... */
+ /* 00 */ V(8, 9, 2), /* 296 */
+ /* 01 */ V(9, 8, 2),
+ /* 10 */ V(12, 1, 2),
+ /* 11 */ V(4, 11, 2),
+
+ /* 0101 0001 ... */
+ /* 000 */ V(12, 0, 3), /* 300 */
+ /* 001 */ V(0, 11, 3),
+ /* 010 */ V(3, 11, 2),
+ /* 011 */ V(3, 11, 2),
+ /* 100 */ V(11, 0, 3),
+ /* 101 */ V(0, 10, 3),
+ /* 110 */ V(1, 10, 2),
+ /* 111 */ V(1, 10, 2),
+
+ /* 0101 0010 ... */
+ /* 00 */ V(11, 4, 1), /* 308 */
+ /* 01 */ V(11, 4, 1),
+ /* 10 */ V(6, 10, 2),
+ /* 11 */ V(10, 6, 2),
+
+ /* 0101 0011 ... */
+ /* 000 */ V(7, 9, 2), /* 312 */
+ /* 001 */ V(7, 9, 2),
+ /* 010 */ V(9, 7, 2),
+ /* 011 */ V(9, 7, 2),
+ /* 100 */ V(10, 0, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(9, 0, 2),
+ /* 111 */ V(9, 0, 2),
+
+ /* 0101 0100 ... */
+ /* 0 */ V(11, 3, 1), /* 320 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0101 0101 ... */
+ /* 00 */ V(2, 11, 2), /* 322 */
+ /* 01 */ V(5, 10, 2),
+ /* 10 */ V(11, 2, 1),
+ /* 11 */ V(11, 2, 1),
+
+ /* 0101 0110 ... */
+ /* 00 */ V(10, 5, 2), /* 326 */
+ /* 01 */ V(1, 11, 2),
+ /* 10 */ V(11, 1, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0101 0111 ... */
+ /* 0 */ V(9, 6, 1), /* 330 */
+ /* 1 */ V(10, 4, 1),
+
+ /* 0101 1000 ... */
+ /* 00 */ V(4, 10, 2), /* 332 */
+ /* 01 */ V(7, 8, 2),
+ /* 10 */ V(8, 7, 1),
+ /* 11 */ V(8, 7, 1),
+
+ /* 0101 1001 ... */
+ /* 0 */ V(3, 10, 1), /* 336 */
+ /* 1 */ V(10, 3, 1),
+
+ /* 0101 1010 ... */
+ /* 0 */ V(5, 9, 1), /* 338 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0101 1011 ... */
+ /* 0 */ V(2, 10, 1), /* 340 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0101 1100 ... */
+ /* 0 */ V(10, 1, 1), /* 342 */
+ /* 1 */ V(6, 8, 1),
+
+ /* 0101 1101 ... */
+ /* 0 */ V(8, 6, 1), /* 344 */
+ /* 1 */ V(7, 7, 1),
+
+ /* 0101 1110 ... */
+ /* 0 */ V(4, 9, 1), /* 346 */
+ /* 1 */ V(9, 4, 1),
+
+ /* 0101 1111 ... */
+ /* 0 */ V(3, 9, 1), /* 348 */
+ /* 1 */ V(9, 3, 1),
+
+ /* 0110 0000 ... */
+ /* 0 */ V(5, 8, 1), /* 350 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0110 0001 ... */
+ /* 0 */ V(2, 9, 1), /* 352 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0110 0010 ... */
+ /* 0 */ V(7, 6, 1), /* 354 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0110 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 356 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0110 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 358 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0110 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 360 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0110 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 362 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0110 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 364 */
+ /* 1 */ V(2, 8, 1),
+
+ /* 0110 1000 ... */
+ /* 0 */ V(8, 2, 1), /* 366 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0110 1001 ... */
+ /* 0 */ V(4, 7, 1), /* 368 */
+ /* 1 */ V(7, 4, 1),
+
+ /* 0110 1010 ... */
+ /* 00 */ V(8, 1, 1), /* 370 */
+ /* 01 */ V(8, 1, 1),
+ /* 10 */ V(0, 8, 2),
+ /* 11 */ V(8, 0, 2),
+
+ /* 0110 1011 ... */
+ /* 0 */ V(5, 6, 1), /* 374 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0110 1100 ... */
+ /* 00 */ V(1, 7, 1), /* 376 */
+ /* 01 */ V(1, 7, 1),
+ /* 10 */ V(0, 7, 2),
+ /* 11 */ V(7, 0, 2),
+
+ /* 0110 1110 ... */
+ /* 0 */ V(3, 7, 1), /* 380 */
+ /* 1 */ V(2, 7, 1),
+
+ /* 0111 1100 ... */
+ /* 0 */ V(0, 6, 1), /* 382 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 1000 0011 ... */
+ /* 0 */ V(0, 5, 1), /* 384 */
+ /* 1 */ V(5, 0, 1)
};
# undef V
@@ -3091,38 +3072,37 @@ union huffpair const hufftab24[] =
union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB };
-struct hufftable const mad_huff_pair_table[32] =
-{
- /* 0 */ { hufftab0, 0, 0 },
- /* 1 */ { hufftab1, 0, 3 },
- /* 2 */ { hufftab2, 0, 3 },
- /* 3 */ { hufftab3, 0, 3 },
- /* 4 */ { 0 /* not used */ },
- /* 5 */ { hufftab5, 0, 3 },
- /* 6 */ { hufftab6, 0, 4 },
- /* 7 */ { hufftab7, 0, 4 },
- /* 8 */ { hufftab8, 0, 4 },
- /* 9 */ { hufftab9, 0, 4 },
- /* 10 */ { hufftab10, 0, 4 },
- /* 11 */ { hufftab11, 0, 4 },
- /* 12 */ { hufftab12, 0, 4 },
- /* 13 */ { hufftab13, 0, 4 },
- /* 14 */ { 0 /* not used */ },
- /* 15 */ { hufftab15, 0, 4 },
- /* 16 */ { hufftab16, 1, 4 },
- /* 17 */ { hufftab16, 2, 4 },
- /* 18 */ { hufftab16, 3, 4 },
- /* 19 */ { hufftab16, 4, 4 },
- /* 20 */ { hufftab16, 6, 4 },
- /* 21 */ { hufftab16, 8, 4 },
- /* 22 */ { hufftab16, 10, 4 },
- /* 23 */ { hufftab16, 13, 4 },
- /* 24 */ { hufftab24, 4, 4 },
- /* 25 */ { hufftab24, 5, 4 },
- /* 26 */ { hufftab24, 6, 4 },
- /* 27 */ { hufftab24, 7, 4 },
- /* 28 */ { hufftab24, 8, 4 },
- /* 29 */ { hufftab24, 9, 4 },
- /* 30 */ { hufftab24, 11, 4 },
- /* 31 */ { hufftab24, 13, 4 }
+struct hufftable const mad_huff_pair_table[32] = {
+ /* 0 */ { hufftab0, 0, 0 },
+ /* 1 */ { hufftab1, 0, 3 },
+ /* 2 */ { hufftab2, 0, 3 },
+ /* 3 */ { hufftab3, 0, 3 },
+ /* 4 */ { 0 /* not used */ },
+ /* 5 */ { hufftab5, 0, 3 },
+ /* 6 */ { hufftab6, 0, 4 },
+ /* 7 */ { hufftab7, 0, 4 },
+ /* 8 */ { hufftab8, 0, 4 },
+ /* 9 */ { hufftab9, 0, 4 },
+ /* 10 */ { hufftab10, 0, 4 },
+ /* 11 */ { hufftab11, 0, 4 },
+ /* 12 */ { hufftab12, 0, 4 },
+ /* 13 */ { hufftab13, 0, 4 },
+ /* 14 */ { 0 /* not used */ },
+ /* 15 */ { hufftab15, 0, 4 },
+ /* 16 */ { hufftab16, 1, 4 },
+ /* 17 */ { hufftab16, 2, 4 },
+ /* 18 */ { hufftab16, 3, 4 },
+ /* 19 */ { hufftab16, 4, 4 },
+ /* 20 */ { hufftab16, 6, 4 },
+ /* 21 */ { hufftab16, 8, 4 },
+ /* 22 */ { hufftab16, 10, 4 },
+ /* 23 */ { hufftab16, 13, 4 },
+ /* 24 */ { hufftab24, 4, 4 },
+ /* 25 */ { hufftab24, 5, 4 },
+ /* 26 */ { hufftab24, 6, 4 },
+ /* 27 */ { hufftab24, 7, 4 },
+ /* 28 */ { hufftab24, 8, 4 },
+ /* 29 */ { hufftab24, 9, 4 },
+ /* 30 */ { hufftab24, 11, 4 },
+ /* 31 */ { hufftab24, 13, 4 }
};
diff --git a/src/filters/transform/MpaDecFilter/libmad/huffman.h b/src/filters/transform/MpaDecFilter/libmad/huffman.h
index 374642f9f..1f98420e3 100644
--- a/src/filters/transform/MpaDecFilter/libmad/huffman.h
+++ b/src/filters/transform/MpaDecFilter/libmad/huffman.h
@@ -21,49 +21,42 @@
# ifndef LIBMAD_HUFFMAN_H
# define LIBMAD_HUFFMAN_H
-union huffquad
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short v : 1;
- unsigned short w : 1;
- unsigned short x : 1;
- unsigned short y : 1;
- } value;
- unsigned short final : 1;
+union huffquad {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short v : 1;
+ unsigned short w : 1;
+ unsigned short x : 1;
+ unsigned short y : 1;
+ } value;
+ unsigned short final : 1;
};
-union huffpair
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short x : 4;
- unsigned short y : 4;
- } value;
- unsigned short final : 1;
+union huffpair {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short x : 4;
+ unsigned short y : 4;
+ } value;
+ unsigned short final : 1;
};
-struct hufftable
-{
- union huffpair const *table;
- unsigned short linbits;
- unsigned short startbits;
+struct hufftable {
+ union huffpair const *table;
+ unsigned short linbits;
+ unsigned short startbits;
};
extern union huffquad const *const mad_huff_quad_table[2];
diff --git a/src/filters/transform/MpaDecFilter/libmad/hufftab.c b/src/filters/transform/MpaDecFilter/libmad/hufftab.c
index 433f92b20..3f0f12c12 100644
--- a/src/filters/transform/MpaDecFilter/libmad/hufftab.c
+++ b/src/filters/transform/MpaDecFilter/libmad/hufftab.c
@@ -44,65 +44,63 @@
# endif
static
-union huffquad const hufftabA[] =
-{
- /* 0000 */ PTR(16, 2),
- /* 0001 */ PTR(20, 2),
- /* 0010 */ PTR(24, 1),
- /* 0011 */ PTR(26, 1),
- /* 0100 */ V(0, 0, 1, 0, 4),
- /* 0101 */ V(0, 0, 0, 1, 4),
- /* 0110 */ V(0, 1, 0, 0, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 0, 0, 0, 1),
- /* 1001 */ V(0, 0, 0, 0, 1),
- /* 1010 */ V(0, 0, 0, 0, 1),
- /* 1011 */ V(0, 0, 0, 0, 1),
- /* 1100 */ V(0, 0, 0, 0, 1),
- /* 1101 */ V(0, 0, 0, 0, 1),
- /* 1110 */ V(0, 0, 0, 0, 1),
- /* 1111 */ V(0, 0, 0, 0, 1),
-
- /* 0000 ... */
- /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
- /* 01 */ V(1, 1, 1, 1, 2),
- /* 10 */ V(1, 1, 0, 1, 2),
- /* 11 */ V(1, 1, 1, 0, 2),
-
- /* 0001 ... */
- /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
- /* 01 */ V(0, 1, 0, 1, 2),
- /* 10 */ V(1, 0, 0, 1, 1),
- /* 11 */ V(1, 0, 0, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
- /* 1 */ V(0, 0, 1, 1, 1),
-
- /* 0011 ... */
- /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
- /* 1 */ V(1, 1, 0, 0, 1)
+union huffquad const hufftabA[] = {
+ /* 0000 */ PTR(16, 2),
+ /* 0001 */ PTR(20, 2),
+ /* 0010 */ PTR(24, 1),
+ /* 0011 */ PTR(26, 1),
+ /* 0100 */ V(0, 0, 1, 0, 4),
+ /* 0101 */ V(0, 0, 0, 1, 4),
+ /* 0110 */ V(0, 1, 0, 0, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 0, 0, 0, 1),
+ /* 1001 */ V(0, 0, 0, 0, 1),
+ /* 1010 */ V(0, 0, 0, 0, 1),
+ /* 1011 */ V(0, 0, 0, 0, 1),
+ /* 1100 */ V(0, 0, 0, 0, 1),
+ /* 1101 */ V(0, 0, 0, 0, 1),
+ /* 1110 */ V(0, 0, 0, 0, 1),
+ /* 1111 */ V(0, 0, 0, 0, 1),
+
+ /* 0000 ... */
+ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
+ /* 01 */ V(1, 1, 1, 1, 2),
+ /* 10 */ V(1, 1, 0, 1, 2),
+ /* 11 */ V(1, 1, 1, 0, 2),
+
+ /* 0001 ... */
+ /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
+ /* 01 */ V(0, 1, 0, 1, 2),
+ /* 10 */ V(1, 0, 0, 1, 1),
+ /* 11 */ V(1, 0, 0, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
+ /* 1 */ V(0, 0, 1, 1, 1),
+
+ /* 0011 ... */
+ /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
+ /* 1 */ V(1, 1, 0, 0, 1)
};
static
-union huffquad const hufftabB[] =
-{
- /* 0000 */ V(1, 1, 1, 1, 4),
- /* 0001 */ V(1, 1, 1, 0, 4),
- /* 0010 */ V(1, 1, 0, 1, 4),
- /* 0011 */ V(1, 1, 0, 0, 4),
- /* 0100 */ V(1, 0, 1, 1, 4),
- /* 0101 */ V(1, 0, 1, 0, 4),
- /* 0110 */ V(1, 0, 0, 1, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 1, 1, 1, 4),
- /* 1001 */ V(0, 1, 1, 0, 4),
- /* 1010 */ V(0, 1, 0, 1, 4),
- /* 1011 */ V(0, 1, 0, 0, 4),
- /* 1100 */ V(0, 0, 1, 1, 4),
- /* 1101 */ V(0, 0, 1, 0, 4),
- /* 1110 */ V(0, 0, 0, 1, 4),
- /* 1111 */ V(0, 0, 0, 0, 4)
+union huffquad const hufftabB[] = {
+ /* 0000 */ V(1, 1, 1, 1, 4),
+ /* 0001 */ V(1, 1, 1, 0, 4),
+ /* 0010 */ V(1, 1, 0, 1, 4),
+ /* 0011 */ V(1, 1, 0, 0, 4),
+ /* 0100 */ V(1, 0, 1, 1, 4),
+ /* 0101 */ V(1, 0, 1, 0, 4),
+ /* 0110 */ V(1, 0, 0, 1, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 1, 1, 1, 4),
+ /* 1001 */ V(0, 1, 1, 0, 4),
+ /* 1010 */ V(0, 1, 0, 1, 4),
+ /* 1011 */ V(0, 1, 0, 0, 4),
+ /* 1100 */ V(0, 0, 1, 1, 4),
+ /* 1101 */ V(0, 0, 1, 0, 4),
+ /* 1110 */ V(0, 0, 0, 1, 4),
+ /* 1111 */ V(0, 0, 0, 0, 4)
};
# undef V
@@ -117,2961 +115,2944 @@ union huffquad const hufftabB[] =
# endif
static
-union huffpair const hufftab0[] =
-{
- /* */ V(0, 0, 0)
+union huffpair const hufftab0[] = {
+ /* */ V(0, 0, 0)
};
static
-union huffpair const hufftab1[] =
-{
- /* 000 */ V(1, 1, 3),
- /* 001 */ V(0, 1, 3),
- /* 010 */ V(1, 0, 2),
- /* 011 */ V(1, 0, 2),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1)
+union huffpair const hufftab1[] = {
+ /* 000 */ V(1, 1, 3),
+ /* 001 */ V(0, 1, 3),
+ /* 010 */ V(1, 0, 2),
+ /* 011 */ V(1, 0, 2),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1)
};
static
-union huffpair const hufftab2[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab2[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab3[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 0, 3),
- /* 010 */ V(1, 1, 2),
- /* 011 */ V(1, 1, 2),
- /* 100 */ V(0, 1, 2),
- /* 101 */ V(0, 1, 2),
- /* 110 */ V(0, 0, 2),
- /* 111 */ V(0, 0, 2),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab3[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 0, 3),
+ /* 010 */ V(1, 1, 2),
+ /* 011 */ V(1, 1, 2),
+ /* 100 */ V(0, 1, 2),
+ /* 101 */ V(0, 1, 2),
+ /* 110 */ V(0, 0, 2),
+ /* 111 */ V(0, 0, 2),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab5[] =
-{
- /* 000 */ PTR(8, 4),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 0000 */ PTR(24, 1), /* 8 */
- /* 0001 */ V(3, 2, 4),
- /* 0010 */ V(3, 1, 3),
- /* 0011 */ V(3, 1, 3),
- /* 0100 */ V(1, 3, 4),
- /* 0101 */ V(0, 3, 4),
- /* 0110 */ V(3, 0, 4),
- /* 0111 */ V(2, 2, 4),
- /* 1000 */ V(1, 2, 3),
- /* 1001 */ V(1, 2, 3),
- /* 1010 */ V(2, 1, 3),
- /* 1011 */ V(2, 1, 3),
- /* 1100 */ V(0, 2, 3),
- /* 1101 */ V(0, 2, 3),
- /* 1110 */ V(2, 0, 3),
- /* 1111 */ V(2, 0, 3),
-
- /* 000 0000 ... */
- /* 0 */ V(3, 3, 1), /* 24 */
- /* 1 */ V(2, 3, 1)
+union huffpair const hufftab5[] = {
+ /* 000 */ PTR(8, 4),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 0000 */ PTR(24, 1), /* 8 */
+ /* 0001 */ V(3, 2, 4),
+ /* 0010 */ V(3, 1, 3),
+ /* 0011 */ V(3, 1, 3),
+ /* 0100 */ V(1, 3, 4),
+ /* 0101 */ V(0, 3, 4),
+ /* 0110 */ V(3, 0, 4),
+ /* 0111 */ V(2, 2, 4),
+ /* 1000 */ V(1, 2, 3),
+ /* 1001 */ V(1, 2, 3),
+ /* 1010 */ V(2, 1, 3),
+ /* 1011 */ V(2, 1, 3),
+ /* 1100 */ V(0, 2, 3),
+ /* 1101 */ V(0, 2, 3),
+ /* 1110 */ V(2, 0, 3),
+ /* 1111 */ V(2, 0, 3),
+
+ /* 000 0000 ... */
+ /* 0 */ V(3, 3, 1), /* 24 */
+ /* 1 */ V(2, 3, 1)
};
static
-union huffpair const hufftab6[] =
-{
- /* 0000 */ PTR(16, 3),
- /* 0001 */ PTR(24, 1),
- /* 0010 */ PTR(26, 1),
- /* 0011 */ V(1, 2, 4),
- /* 0100 */ V(2, 1, 4),
- /* 0101 */ V(2, 0, 4),
- /* 0110 */ V(0, 1, 3),
- /* 0111 */ V(0, 1, 3),
- /* 1000 */ V(1, 1, 2),
- /* 1001 */ V(1, 1, 2),
- /* 1010 */ V(1, 1, 2),
- /* 1011 */ V(1, 1, 2),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 000 */ V(3, 3, 3), /* 16 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(2, 3, 2),
- /* 011 */ V(2, 3, 2),
- /* 100 */ V(3, 2, 2),
- /* 101 */ V(3, 2, 2),
- /* 110 */ V(3, 0, 2),
- /* 111 */ V(3, 0, 2),
-
- /* 0001 ... */
- /* 0 */ V(1, 3, 1), /* 24 */
- /* 1 */ V(3, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(2, 2, 1), /* 26 */
- /* 1 */ V(0, 2, 1)
+union huffpair const hufftab6[] = {
+ /* 0000 */ PTR(16, 3),
+ /* 0001 */ PTR(24, 1),
+ /* 0010 */ PTR(26, 1),
+ /* 0011 */ V(1, 2, 4),
+ /* 0100 */ V(2, 1, 4),
+ /* 0101 */ V(2, 0, 4),
+ /* 0110 */ V(0, 1, 3),
+ /* 0111 */ V(0, 1, 3),
+ /* 1000 */ V(1, 1, 2),
+ /* 1001 */ V(1, 1, 2),
+ /* 1010 */ V(1, 1, 2),
+ /* 1011 */ V(1, 1, 2),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 000 */ V(3, 3, 3), /* 16 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(2, 3, 2),
+ /* 011 */ V(2, 3, 2),
+ /* 100 */ V(3, 2, 2),
+ /* 101 */ V(3, 2, 2),
+ /* 110 */ V(3, 0, 2),
+ /* 111 */ V(3, 0, 2),
+
+ /* 0001 ... */
+ /* 0 */ V(1, 3, 1), /* 24 */
+ /* 1 */ V(3, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(2, 2, 1), /* 26 */
+ /* 1 */ V(0, 2, 1)
};
static
-union huffpair const hufftab7[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 2), /* 16 */
- /* 0001 */ PTR(56, 1),
- /* 0010 */ PTR(58, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(60, 1),
- /* 0110 */ V(5, 0, 4),
- /* 0111 */ PTR(62, 1),
- /* 1000 */ V(2, 4, 4),
- /* 1001 */ V(4, 2, 4),
- /* 1010 */ V(1, 4, 3),
- /* 1011 */ V(1, 4, 3),
- /* 1100 */ V(4, 1, 3),
- /* 1101 */ V(4, 1, 3),
- /* 1110 */ V(4, 0, 3),
- /* 1111 */ V(4, 0, 3),
-
- /* 0001 ... */
- /* 0000 */ V(0, 4, 4), /* 32 */
- /* 0001 */ V(2, 3, 4),
- /* 0010 */ V(3, 2, 4),
- /* 0011 */ V(0, 3, 4),
- /* 0100 */ V(1, 3, 3),
- /* 0101 */ V(1, 3, 3),
- /* 0110 */ V(3, 1, 3),
- /* 0111 */ V(3, 1, 3),
- /* 1000 */ V(3, 0, 3),
- /* 1001 */ V(3, 0, 3),
- /* 1010 */ V(2, 2, 3),
- /* 1011 */ V(2, 2, 3),
- /* 1100 */ V(1, 2, 2),
- /* 1101 */ V(1, 2, 2),
- /* 1110 */ V(1, 2, 2),
- /* 1111 */ V(1, 2, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 1, 1), /* 48 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 00 */ V(5, 5, 2), /* 52 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0001 ... */
- /* 0 */ V(3, 5, 1), /* 56 */
- /* 1 */ V(4, 4, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(2, 5, 1), /* 58 */
- /* 1 */ V(5, 2, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(0, 5, 1), /* 60 */
- /* 1 */ V(3, 4, 1),
-
- /* 0000 0111 ... */
- /* 0 */ V(4, 3, 1), /* 62 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab7[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 2), /* 16 */
+ /* 0001 */ PTR(56, 1),
+ /* 0010 */ PTR(58, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(60, 1),
+ /* 0110 */ V(5, 0, 4),
+ /* 0111 */ PTR(62, 1),
+ /* 1000 */ V(2, 4, 4),
+ /* 1001 */ V(4, 2, 4),
+ /* 1010 */ V(1, 4, 3),
+ /* 1011 */ V(1, 4, 3),
+ /* 1100 */ V(4, 1, 3),
+ /* 1101 */ V(4, 1, 3),
+ /* 1110 */ V(4, 0, 3),
+ /* 1111 */ V(4, 0, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(0, 4, 4), /* 32 */
+ /* 0001 */ V(2, 3, 4),
+ /* 0010 */ V(3, 2, 4),
+ /* 0011 */ V(0, 3, 4),
+ /* 0100 */ V(1, 3, 3),
+ /* 0101 */ V(1, 3, 3),
+ /* 0110 */ V(3, 1, 3),
+ /* 0111 */ V(3, 1, 3),
+ /* 1000 */ V(3, 0, 3),
+ /* 1001 */ V(3, 0, 3),
+ /* 1010 */ V(2, 2, 3),
+ /* 1011 */ V(2, 2, 3),
+ /* 1100 */ V(1, 2, 2),
+ /* 1101 */ V(1, 2, 2),
+ /* 1110 */ V(1, 2, 2),
+ /* 1111 */ V(1, 2, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 1, 1), /* 48 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(5, 5, 2), /* 52 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(3, 5, 1), /* 56 */
+ /* 1 */ V(4, 4, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(2, 5, 1), /* 58 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(0, 5, 1), /* 60 */
+ /* 1 */ V(3, 4, 1),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(4, 3, 1), /* 62 */
+ /* 1 */ V(3, 3, 1)
};
# if 0
/* this version saves 8 entries (16 bytes) at the expense of
an extra lookup in 4 out of 36 cases */
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 2),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(36, 3), /* 16 */
- /* 0001 */ PTR(44, 2),
- /* 0010 */ PTR(48, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(50, 1),
- /* 0110 */ PTR(52, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 00 */ PTR(54, 2), /* 32 */
- /* 01 */ V(2, 2, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 36 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 44 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 48 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 50 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 52 */
- /* 1 */ V(3, 3, 1),
-
- /* 0001 00 ... */
- /* 00 */ V(1, 3, 2), /* 54 */
- /* 01 */ V(3, 1, 2),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 2),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(36, 3), /* 16 */
+ /* 0001 */ PTR(44, 2),
+ /* 0010 */ PTR(48, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(50, 1),
+ /* 0110 */ PTR(52, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 00 */ PTR(54, 2), /* 32 */
+ /* 01 */ V(2, 2, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 36 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 44 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 48 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 50 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 52 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0001 00 ... */
+ /* 00 */ V(1, 3, 2), /* 54 */
+ /* 01 */ V(3, 1, 2),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
};
# else
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(48, 3), /* 16 */
- /* 0001 */ PTR(56, 2),
- /* 0010 */ PTR(60, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(62, 1),
- /* 0110 */ PTR(64, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 0000 */ V(1, 3, 4), /* 32 */
- /* 0001 */ V(3, 1, 4),
- /* 0010 */ V(0, 3, 4),
- /* 0011 */ V(3, 0, 4),
- /* 0100 */ V(2, 2, 2),
- /* 0101 */ V(2, 2, 2),
- /* 0110 */ V(2, 2, 2),
- /* 0111 */ V(2, 2, 2),
- /* 1000 */ V(0, 2, 2),
- /* 1001 */ V(0, 2, 2),
- /* 1010 */ V(0, 2, 2),
- /* 1011 */ V(0, 2, 2),
- /* 1100 */ V(2, 0, 2),
- /* 1101 */ V(2, 0, 2),
- /* 1110 */ V(2, 0, 2),
- /* 1111 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 48 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 56 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 60 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 62 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 64 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(48, 3), /* 16 */
+ /* 0001 */ PTR(56, 2),
+ /* 0010 */ PTR(60, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(62, 1),
+ /* 0110 */ PTR(64, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(1, 3, 4), /* 32 */
+ /* 0001 */ V(3, 1, 4),
+ /* 0010 */ V(0, 3, 4),
+ /* 0011 */ V(3, 0, 4),
+ /* 0100 */ V(2, 2, 2),
+ /* 0101 */ V(2, 2, 2),
+ /* 0110 */ V(2, 2, 2),
+ /* 0111 */ V(2, 2, 2),
+ /* 1000 */ V(0, 2, 2),
+ /* 1001 */ V(0, 2, 2),
+ /* 1010 */ V(0, 2, 2),
+ /* 1011 */ V(0, 2, 2),
+ /* 1100 */ V(2, 0, 2),
+ /* 1101 */ V(2, 0, 2),
+ /* 1110 */ V(2, 0, 2),
+ /* 1111 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 48 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 56 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 60 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 62 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 64 */
+ /* 1 */ V(3, 3, 1)
};
# endif
static
-union huffpair const hufftab9[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 3),
- /* 0010 */ PTR(40, 2),
- /* 0011 */ PTR(44, 2),
- /* 0100 */ PTR(48, 1),
- /* 0101 */ V(1, 2, 4),
- /* 0110 */ V(2, 1, 4),
- /* 0111 */ V(2, 0, 4),
- /* 1000 */ V(1, 1, 3),
- /* 1001 */ V(1, 1, 3),
- /* 1010 */ V(0, 1, 3),
- /* 1011 */ V(0, 1, 3),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(50, 1), /* 16 */
- /* 0001 */ V(3, 5, 4),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ PTR(52, 1),
- /* 0100 */ V(4, 4, 4),
- /* 0101 */ V(2, 5, 4),
- /* 0110 */ V(5, 2, 4),
- /* 0111 */ V(1, 5, 4),
- /* 1000 */ V(5, 1, 3),
- /* 1001 */ V(5, 1, 3),
- /* 1010 */ V(3, 4, 3),
- /* 1011 */ V(3, 4, 3),
- /* 1100 */ V(4, 3, 3),
- /* 1101 */ V(4, 3, 3),
- /* 1110 */ V(5, 0, 4),
- /* 1111 */ V(0, 4, 4),
-
- /* 0001 ... */
- /* 000 */ V(2, 4, 3), /* 32 */
- /* 001 */ V(4, 2, 3),
- /* 010 */ V(3, 3, 3),
- /* 011 */ V(4, 0, 3),
- /* 100 */ V(1, 4, 2),
- /* 101 */ V(1, 4, 2),
- /* 110 */ V(4, 1, 2),
- /* 111 */ V(4, 1, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 3, 2), /* 40 */
- /* 01 */ V(3, 2, 2),
- /* 10 */ V(1, 3, 1),
- /* 11 */ V(1, 3, 1),
-
- /* 0011 ... */
- /* 00 */ V(3, 1, 1), /* 44 */
- /* 01 */ V(3, 1, 1),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
-
- /* 0100 ... */
- /* 0 */ V(2, 2, 1), /* 48 */
- /* 1 */ V(0, 2, 1),
-
- /* 0000 0000 ... */
- /* 0 */ V(5, 5, 1), /* 50 */
- /* 1 */ V(4, 5, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(5, 4, 1), /* 52 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab9[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 3),
+ /* 0010 */ PTR(40, 2),
+ /* 0011 */ PTR(44, 2),
+ /* 0100 */ PTR(48, 1),
+ /* 0101 */ V(1, 2, 4),
+ /* 0110 */ V(2, 1, 4),
+ /* 0111 */ V(2, 0, 4),
+ /* 1000 */ V(1, 1, 3),
+ /* 1001 */ V(1, 1, 3),
+ /* 1010 */ V(0, 1, 3),
+ /* 1011 */ V(0, 1, 3),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(50, 1), /* 16 */
+ /* 0001 */ V(3, 5, 4),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ PTR(52, 1),
+ /* 0100 */ V(4, 4, 4),
+ /* 0101 */ V(2, 5, 4),
+ /* 0110 */ V(5, 2, 4),
+ /* 0111 */ V(1, 5, 4),
+ /* 1000 */ V(5, 1, 3),
+ /* 1001 */ V(5, 1, 3),
+ /* 1010 */ V(3, 4, 3),
+ /* 1011 */ V(3, 4, 3),
+ /* 1100 */ V(4, 3, 3),
+ /* 1101 */ V(4, 3, 3),
+ /* 1110 */ V(5, 0, 4),
+ /* 1111 */ V(0, 4, 4),
+
+ /* 0001 ... */
+ /* 000 */ V(2, 4, 3), /* 32 */
+ /* 001 */ V(4, 2, 3),
+ /* 010 */ V(3, 3, 3),
+ /* 011 */ V(4, 0, 3),
+ /* 100 */ V(1, 4, 2),
+ /* 101 */ V(1, 4, 2),
+ /* 110 */ V(4, 1, 2),
+ /* 111 */ V(4, 1, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 3, 2), /* 40 */
+ /* 01 */ V(3, 2, 2),
+ /* 10 */ V(1, 3, 1),
+ /* 11 */ V(1, 3, 1),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 1, 1), /* 44 */
+ /* 01 */ V(3, 1, 1),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
+
+ /* 0100 ... */
+ /* 0 */ V(2, 2, 1), /* 48 */
+ /* 1 */ V(0, 2, 1),
+
+ /* 0000 0000 ... */
+ /* 0 */ V(5, 5, 1), /* 50 */
+ /* 1 */ V(4, 5, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(5, 4, 1), /* 52 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab10[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 3), /* 16 */
- /* 0001 */ PTR(60, 2),
- /* 0010 */ PTR(64, 3),
- /* 0011 */ PTR(72, 1),
- /* 0100 */ PTR(74, 2),
- /* 0101 */ PTR(78, 2),
- /* 0110 */ PTR(82, 2),
- /* 0111 */ V(1, 7, 4),
- /* 1000 */ V(7, 1, 4),
- /* 1001 */ PTR(86, 1),
- /* 1010 */ PTR(88, 2),
- /* 1011 */ PTR(92, 2),
- /* 1100 */ V(1, 6, 4),
- /* 1101 */ V(6, 1, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(96, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(98, 1), /* 32 */
- /* 0001 */ PTR(100, 1),
- /* 0010 */ V(1, 4, 4),
- /* 0011 */ V(4, 1, 4),
- /* 0100 */ V(4, 0, 4),
- /* 0101 */ V(2, 3, 4),
- /* 0110 */ V(3, 2, 4),
- /* 0111 */ V(0, 3, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0010 ... */
- /* 00 */ V(1, 2, 2), /* 48 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(7, 7, 3), /* 52 */
- /* 001 */ V(6, 7, 3),
- /* 010 */ V(7, 6, 3),
- /* 011 */ V(5, 7, 3),
- /* 100 */ V(7, 5, 3),
- /* 101 */ V(6, 6, 3),
- /* 110 */ V(4, 7, 2),
- /* 111 */ V(4, 7, 2),
-
- /* 0000 0001 ... */
- /* 00 */ V(7, 4, 2), /* 60 */
- /* 01 */ V(5, 6, 2),
- /* 10 */ V(6, 5, 2),
- /* 11 */ V(3, 7, 2),
-
- /* 0000 0010 ... */
- /* 000 */ V(7, 3, 2), /* 64 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(4, 6, 2),
- /* 011 */ V(4, 6, 2),
- /* 100 */ V(5, 5, 3),
- /* 101 */ V(5, 4, 3),
- /* 110 */ V(6, 3, 2),
- /* 111 */ V(6, 3, 2),
-
- /* 0000 0011 ... */
- /* 0 */ V(2, 7, 1), /* 72 */
- /* 1 */ V(7, 2, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(6, 4, 2), /* 74 */
- /* 01 */ V(0, 7, 2),
- /* 10 */ V(7, 0, 1),
- /* 11 */ V(7, 0, 1),
-
- /* 0000 0101 ... */
- /* 00 */ V(6, 2, 1), /* 78 */
- /* 01 */ V(6, 2, 1),
- /* 10 */ V(4, 5, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0000 0110 ... */
- /* 00 */ V(0, 6, 1), /* 82 */
- /* 01 */ V(0, 6, 1),
- /* 10 */ V(5, 3, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0000 1001 ... */
- /* 0 */ V(3, 6, 1), /* 86 */
- /* 1 */ V(2, 6, 1),
-
- /* 0000 1010 ... */
- /* 00 */ V(2, 5, 2), /* 88 */
- /* 01 */ V(5, 2, 2),
- /* 10 */ V(1, 5, 1),
- /* 11 */ V(1, 5, 1),
-
- /* 0000 1011 ... */
- /* 00 */ V(5, 1, 1), /* 92 */
- /* 01 */ V(5, 1, 1),
- /* 10 */ V(3, 4, 2),
- /* 11 */ V(4, 3, 2),
-
- /* 0000 1111 ... */
- /* 0 */ V(0, 5, 1), /* 96 */
- /* 1 */ V(5, 0, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(2, 4, 1), /* 98 */
- /* 1 */ V(4, 2, 1),
-
- /* 0001 0001 ... */
- /* 0 */ V(3, 3, 1), /* 100 */
- /* 1 */ V(0, 4, 1)
+union huffpair const hufftab10[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 3), /* 16 */
+ /* 0001 */ PTR(60, 2),
+ /* 0010 */ PTR(64, 3),
+ /* 0011 */ PTR(72, 1),
+ /* 0100 */ PTR(74, 2),
+ /* 0101 */ PTR(78, 2),
+ /* 0110 */ PTR(82, 2),
+ /* 0111 */ V(1, 7, 4),
+ /* 1000 */ V(7, 1, 4),
+ /* 1001 */ PTR(86, 1),
+ /* 1010 */ PTR(88, 2),
+ /* 1011 */ PTR(92, 2),
+ /* 1100 */ V(1, 6, 4),
+ /* 1101 */ V(6, 1, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(96, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(98, 1), /* 32 */
+ /* 0001 */ PTR(100, 1),
+ /* 0010 */ V(1, 4, 4),
+ /* 0011 */ V(4, 1, 4),
+ /* 0100 */ V(4, 0, 4),
+ /* 0101 */ V(2, 3, 4),
+ /* 0110 */ V(3, 2, 4),
+ /* 0111 */ V(0, 3, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0010 ... */
+ /* 00 */ V(1, 2, 2), /* 48 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(7, 7, 3), /* 52 */
+ /* 001 */ V(6, 7, 3),
+ /* 010 */ V(7, 6, 3),
+ /* 011 */ V(5, 7, 3),
+ /* 100 */ V(7, 5, 3),
+ /* 101 */ V(6, 6, 3),
+ /* 110 */ V(4, 7, 2),
+ /* 111 */ V(4, 7, 2),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(7, 4, 2), /* 60 */
+ /* 01 */ V(5, 6, 2),
+ /* 10 */ V(6, 5, 2),
+ /* 11 */ V(3, 7, 2),
+
+ /* 0000 0010 ... */
+ /* 000 */ V(7, 3, 2), /* 64 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(4, 6, 2),
+ /* 011 */ V(4, 6, 2),
+ /* 100 */ V(5, 5, 3),
+ /* 101 */ V(5, 4, 3),
+ /* 110 */ V(6, 3, 2),
+ /* 111 */ V(6, 3, 2),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(2, 7, 1), /* 72 */
+ /* 1 */ V(7, 2, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(6, 4, 2), /* 74 */
+ /* 01 */ V(0, 7, 2),
+ /* 10 */ V(7, 0, 1),
+ /* 11 */ V(7, 0, 1),
+
+ /* 0000 0101 ... */
+ /* 00 */ V(6, 2, 1), /* 78 */
+ /* 01 */ V(6, 2, 1),
+ /* 10 */ V(4, 5, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0000 0110 ... */
+ /* 00 */ V(0, 6, 1), /* 82 */
+ /* 01 */ V(0, 6, 1),
+ /* 10 */ V(5, 3, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0000 1001 ... */
+ /* 0 */ V(3, 6, 1), /* 86 */
+ /* 1 */ V(2, 6, 1),
+
+ /* 0000 1010 ... */
+ /* 00 */ V(2, 5, 2), /* 88 */
+ /* 01 */ V(5, 2, 2),
+ /* 10 */ V(1, 5, 1),
+ /* 11 */ V(1, 5, 1),
+
+ /* 0000 1011 ... */
+ /* 00 */ V(5, 1, 1), /* 92 */
+ /* 01 */ V(5, 1, 1),
+ /* 10 */ V(3, 4, 2),
+ /* 11 */ V(4, 3, 2),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(0, 5, 1), /* 96 */
+ /* 1 */ V(5, 0, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(2, 4, 1), /* 98 */
+ /* 1 */ V(4, 2, 1),
+
+ /* 0001 0001 ... */
+ /* 0 */ V(3, 3, 1), /* 100 */
+ /* 1 */ V(0, 4, 1)
};
static
-union huffpair const hufftab11[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 3),
- /* 0100 */ V(1, 2, 4),
- /* 0101 */ PTR(72, 1),
- /* 0110 */ V(1, 1, 3),
- /* 0111 */ V(1, 1, 3),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(74, 2), /* 16 */
- /* 0001 */ PTR(78, 3),
- /* 0010 */ PTR(86, 2),
- /* 0011 */ PTR(90, 1),
- /* 0100 */ PTR(92, 2),
- /* 0101 */ V(2, 7, 4),
- /* 0110 */ V(7, 2, 4),
- /* 0111 */ PTR(96, 1),
- /* 1000 */ V(7, 1, 3),
- /* 1001 */ V(7, 1, 3),
- /* 1010 */ V(1, 7, 4),
- /* 1011 */ V(7, 0, 4),
- /* 1100 */ V(3, 6, 4),
- /* 1101 */ V(6, 3, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(98, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(100, 1), /* 32 */
- /* 0001 */ V(1, 5, 4),
- /* 0010 */ V(6, 2, 3),
- /* 0011 */ V(6, 2, 3),
- /* 0100 */ V(2, 6, 4),
- /* 0101 */ V(0, 6, 4),
- /* 0110 */ V(1, 6, 3),
- /* 0111 */ V(1, 6, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(5, 1, 4),
- /* 1011 */ V(3, 4, 4),
- /* 1100 */ V(5, 0, 4),
- /* 1101 */ PTR(102, 1),
- /* 1110 */ V(2, 4, 4),
- /* 1111 */ V(4, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 4, 4), /* 48 */
- /* 0001 */ V(4, 1, 4),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 0011 ... */
- /* 000 */ V(0, 3, 3), /* 64 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(2, 1, 1),
- /* 101 */ V(2, 1, 1),
- /* 110 */ V(2, 1, 1),
- /* 111 */ V(2, 1, 1),
-
- /* 0101 ... */
- /* 0 */ V(0, 2, 1), /* 72 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 74 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 2),
- /* 11 */ V(7, 5, 2),
-
- /* 0000 0001 ... */
- /* 000 */ V(6, 6, 2), /* 78 */
- /* 001 */ V(6, 6, 2),
- /* 010 */ V(4, 7, 2),
- /* 011 */ V(4, 7, 2),
- /* 100 */ V(7, 4, 2),
- /* 101 */ V(7, 4, 2),
- /* 110 */ V(5, 7, 3),
- /* 111 */ V(5, 5, 3),
-
- /* 0000 0010 ... */
- /* 00 */ V(5, 6, 2), /* 86 */
- /* 01 */ V(6, 5, 2),
- /* 10 */ V(3, 7, 1),
- /* 11 */ V(3, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(4, 6, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(4, 5, 2), /* 92 */
- /* 01 */ V(5, 4, 2),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0111 ... */
- /* 0 */ V(6, 4, 1), /* 96 */
- /* 1 */ V(0, 7, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(4, 4, 1), /* 98 */
- /* 1 */ V(2, 5, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(5, 2, 1), /* 100 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(4, 3, 1), /* 102 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab11[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 3),
+ /* 0100 */ V(1, 2, 4),
+ /* 0101 */ PTR(72, 1),
+ /* 0110 */ V(1, 1, 3),
+ /* 0111 */ V(1, 1, 3),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(74, 2), /* 16 */
+ /* 0001 */ PTR(78, 3),
+ /* 0010 */ PTR(86, 2),
+ /* 0011 */ PTR(90, 1),
+ /* 0100 */ PTR(92, 2),
+ /* 0101 */ V(2, 7, 4),
+ /* 0110 */ V(7, 2, 4),
+ /* 0111 */ PTR(96, 1),
+ /* 1000 */ V(7, 1, 3),
+ /* 1001 */ V(7, 1, 3),
+ /* 1010 */ V(1, 7, 4),
+ /* 1011 */ V(7, 0, 4),
+ /* 1100 */ V(3, 6, 4),
+ /* 1101 */ V(6, 3, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(98, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(100, 1), /* 32 */
+ /* 0001 */ V(1, 5, 4),
+ /* 0010 */ V(6, 2, 3),
+ /* 0011 */ V(6, 2, 3),
+ /* 0100 */ V(2, 6, 4),
+ /* 0101 */ V(0, 6, 4),
+ /* 0110 */ V(1, 6, 3),
+ /* 0111 */ V(1, 6, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(5, 1, 4),
+ /* 1011 */ V(3, 4, 4),
+ /* 1100 */ V(5, 0, 4),
+ /* 1101 */ PTR(102, 1),
+ /* 1110 */ V(2, 4, 4),
+ /* 1111 */ V(4, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 4, 4), /* 48 */
+ /* 0001 */ V(4, 1, 4),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 0011 ... */
+ /* 000 */ V(0, 3, 3), /* 64 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(2, 1, 1),
+ /* 101 */ V(2, 1, 1),
+ /* 110 */ V(2, 1, 1),
+ /* 111 */ V(2, 1, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(0, 2, 1), /* 72 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 74 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 2),
+ /* 11 */ V(7, 5, 2),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(6, 6, 2), /* 78 */
+ /* 001 */ V(6, 6, 2),
+ /* 010 */ V(4, 7, 2),
+ /* 011 */ V(4, 7, 2),
+ /* 100 */ V(7, 4, 2),
+ /* 101 */ V(7, 4, 2),
+ /* 110 */ V(5, 7, 3),
+ /* 111 */ V(5, 5, 3),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(5, 6, 2), /* 86 */
+ /* 01 */ V(6, 5, 2),
+ /* 10 */ V(3, 7, 1),
+ /* 11 */ V(3, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(4, 5, 2), /* 92 */
+ /* 01 */ V(5, 4, 2),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(6, 4, 1), /* 96 */
+ /* 1 */ V(0, 7, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(4, 4, 1), /* 98 */
+ /* 1 */ V(2, 5, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(5, 2, 1), /* 100 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(4, 3, 1), /* 102 */
+ /* 1 */ V(3, 3, 1)
};
static
-union huffpair const hufftab12[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ PTR(68, 3),
- /* 0101 */ PTR(76, 1),
- /* 0110 */ V(1, 2, 4),
- /* 0111 */ V(2, 1, 4),
- /* 1000 */ PTR(78, 1),
- /* 1001 */ V(0, 0, 4),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 3),
- /* 1101 */ V(0, 1, 3),
- /* 1110 */ V(1, 0, 3),
- /* 1111 */ V(1, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(80, 2), /* 16 */
- /* 0001 */ PTR(84, 1),
- /* 0010 */ PTR(86, 1),
- /* 0011 */ PTR(88, 1),
- /* 0100 */ V(5, 6, 4),
- /* 0101 */ V(3, 7, 4),
- /* 0110 */ PTR(90, 1),
- /* 0111 */ V(2, 7, 4),
- /* 1000 */ V(7, 2, 4),
- /* 1001 */ V(4, 6, 4),
- /* 1010 */ V(6, 4, 4),
- /* 1011 */ V(1, 7, 4),
- /* 1100 */ V(7, 1, 4),
- /* 1101 */ PTR(92, 1),
- /* 1110 */ V(3, 6, 4),
- /* 1111 */ V(6, 3, 4),
-
- /* 0001 ... */
- /* 0000 */ V(4, 5, 4), /* 32 */
- /* 0001 */ V(5, 4, 4),
- /* 0010 */ V(4, 4, 4),
- /* 0011 */ PTR(94, 1),
- /* 0100 */ V(2, 6, 3),
- /* 0101 */ V(2, 6, 3),
- /* 0110 */ V(6, 2, 3),
- /* 0111 */ V(6, 2, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 0, 4),
- /* 1100 */ V(3, 5, 4),
- /* 1101 */ V(5, 3, 4),
- /* 1110 */ V(2, 5, 4),
- /* 1111 */ V(5, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 5, 3), /* 48 */
- /* 0001 */ V(1, 5, 3),
- /* 0010 */ V(5, 1, 3),
- /* 0011 */ V(5, 1, 3),
- /* 0100 */ V(3, 4, 3),
- /* 0101 */ V(3, 4, 3),
- /* 0110 */ V(4, 3, 3),
- /* 0111 */ V(4, 3, 3),
- /* 1000 */ V(5, 0, 4),
- /* 1001 */ V(0, 4, 4),
- /* 1010 */ V(2, 4, 3),
- /* 1011 */ V(2, 4, 3),
- /* 1100 */ V(4, 2, 3),
- /* 1101 */ V(4, 2, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 0011 ... */
- /* 00 */ V(3, 3, 2), /* 64 */
- /* 01 */ V(4, 1, 2),
- /* 10 */ V(2, 3, 2),
- /* 11 */ V(3, 2, 2),
-
- /* 0100 ... */
- /* 000 */ V(4, 0, 3), /* 68 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(3, 0, 2),
- /* 011 */ V(3, 0, 2),
- /* 100 */ V(1, 3, 1),
- /* 101 */ V(1, 3, 1),
- /* 110 */ V(1, 3, 1),
- /* 111 */ V(1, 3, 1),
-
- /* 0101 ... */
- /* 0 */ V(3, 1, 1), /* 76 */
- /* 1 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(0, 2, 1), /* 78 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 80 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 1),
- /* 11 */ V(7, 6, 1),
-
- /* 0000 0001 ... */
- /* 0 */ V(5, 7, 1), /* 84 */
- /* 1 */ V(7, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(6, 6, 1), /* 86 */
- /* 1 */ V(4, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 4, 1), /* 88 */
- /* 1 */ V(6, 5, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(5, 5, 1),
-
- /* 0000 1101 ... */
- /* 0 */ V(0, 7, 1), /* 92 */
- /* 1 */ V(7, 0, 1),
-
- /* 0001 0011 ... */
- /* 0 */ V(0, 6, 1), /* 94 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab12[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ PTR(68, 3),
+ /* 0101 */ PTR(76, 1),
+ /* 0110 */ V(1, 2, 4),
+ /* 0111 */ V(2, 1, 4),
+ /* 1000 */ PTR(78, 1),
+ /* 1001 */ V(0, 0, 4),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 3),
+ /* 1101 */ V(0, 1, 3),
+ /* 1110 */ V(1, 0, 3),
+ /* 1111 */ V(1, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(80, 2), /* 16 */
+ /* 0001 */ PTR(84, 1),
+ /* 0010 */ PTR(86, 1),
+ /* 0011 */ PTR(88, 1),
+ /* 0100 */ V(5, 6, 4),
+ /* 0101 */ V(3, 7, 4),
+ /* 0110 */ PTR(90, 1),
+ /* 0111 */ V(2, 7, 4),
+ /* 1000 */ V(7, 2, 4),
+ /* 1001 */ V(4, 6, 4),
+ /* 1010 */ V(6, 4, 4),
+ /* 1011 */ V(1, 7, 4),
+ /* 1100 */ V(7, 1, 4),
+ /* 1101 */ PTR(92, 1),
+ /* 1110 */ V(3, 6, 4),
+ /* 1111 */ V(6, 3, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(4, 5, 4), /* 32 */
+ /* 0001 */ V(5, 4, 4),
+ /* 0010 */ V(4, 4, 4),
+ /* 0011 */ PTR(94, 1),
+ /* 0100 */ V(2, 6, 3),
+ /* 0101 */ V(2, 6, 3),
+ /* 0110 */ V(6, 2, 3),
+ /* 0111 */ V(6, 2, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 0, 4),
+ /* 1100 */ V(3, 5, 4),
+ /* 1101 */ V(5, 3, 4),
+ /* 1110 */ V(2, 5, 4),
+ /* 1111 */ V(5, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 5, 3), /* 48 */
+ /* 0001 */ V(1, 5, 3),
+ /* 0010 */ V(5, 1, 3),
+ /* 0011 */ V(5, 1, 3),
+ /* 0100 */ V(3, 4, 3),
+ /* 0101 */ V(3, 4, 3),
+ /* 0110 */ V(4, 3, 3),
+ /* 0111 */ V(4, 3, 3),
+ /* 1000 */ V(5, 0, 4),
+ /* 1001 */ V(0, 4, 4),
+ /* 1010 */ V(2, 4, 3),
+ /* 1011 */ V(2, 4, 3),
+ /* 1100 */ V(4, 2, 3),
+ /* 1101 */ V(4, 2, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 3, 2), /* 64 */
+ /* 01 */ V(4, 1, 2),
+ /* 10 */ V(2, 3, 2),
+ /* 11 */ V(3, 2, 2),
+
+ /* 0100 ... */
+ /* 000 */ V(4, 0, 3), /* 68 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(3, 0, 2),
+ /* 011 */ V(3, 0, 2),
+ /* 100 */ V(1, 3, 1),
+ /* 101 */ V(1, 3, 1),
+ /* 110 */ V(1, 3, 1),
+ /* 111 */ V(1, 3, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(3, 1, 1), /* 76 */
+ /* 1 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(0, 2, 1), /* 78 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 80 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 1),
+ /* 11 */ V(7, 6, 1),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(5, 7, 1), /* 84 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(6, 6, 1), /* 86 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 4, 1), /* 88 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(5, 5, 1),
+
+ /* 0000 1101 ... */
+ /* 0 */ V(0, 7, 1), /* 92 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0001 0011 ... */
+ /* 0 */ V(0, 6, 1), /* 94 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab13[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 4), /* 16 */
- /* 0001 */ PTR(84, 4),
- /* 0010 */ PTR(100, 4),
- /* 0011 */ PTR(116, 4),
- /* 0100 */ PTR(132, 4),
- /* 0101 */ PTR(148, 4),
- /* 0110 */ PTR(164, 3),
- /* 0111 */ PTR(172, 3),
- /* 1000 */ PTR(180, 3),
- /* 1001 */ PTR(188, 3),
- /* 1010 */ PTR(196, 3),
- /* 1011 */ PTR(204, 3),
- /* 1100 */ PTR(212, 1),
- /* 1101 */ PTR(214, 2),
- /* 1110 */ PTR(218, 3),
- /* 1111 */ PTR(226, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(228, 2), /* 32 */
- /* 0001 */ PTR(232, 2),
- /* 0010 */ PTR(236, 2),
- /* 0011 */ PTR(240, 2),
- /* 0100 */ V(8, 1, 4),
- /* 0101 */ PTR(244, 1),
- /* 0110 */ PTR(246, 1),
- /* 0111 */ PTR(248, 1),
- /* 1000 */ PTR(250, 2),
- /* 1001 */ PTR(254, 1),
- /* 1010 */ V(1, 5, 4),
- /* 1011 */ V(5, 1, 4),
- /* 1100 */ PTR(256, 1),
- /* 1101 */ PTR(258, 1),
- /* 1110 */ PTR(260, 1),
- /* 1111 */ V(1, 4, 4),
-
- /* 0010 ... */
- /* 0000 */ V(4, 1, 3), /* 48 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 4),
- /* 0101 */ V(3, 2, 4),
- /* 0110 */ V(1, 3, 3),
- /* 0111 */ V(1, 3, 3),
- /* 1000 */ V(3, 1, 3),
- /* 1001 */ V(3, 1, 3),
- /* 1010 */ V(0, 3, 3),
- /* 1011 */ V(0, 3, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(262, 4), /* 68 */
- /* 0001 */ PTR(278, 4),
- /* 0010 */ PTR(294, 4),
- /* 0011 */ PTR(310, 3),
- /* 0100 */ PTR(318, 2),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 3),
- /* 0111 */ PTR(334, 2),
- /* 1000 */ PTR(338, 1),
- /* 1001 */ PTR(340, 2),
- /* 1010 */ PTR(344, 2),
- /* 1011 */ PTR(348, 2),
- /* 1100 */ PTR(352, 2),
- /* 1101 */ PTR(356, 2),
- /* 1110 */ V(1, 15, 4),
- /* 1111 */ V(15, 1, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 0, 4), /* 84 */
- /* 0001 */ PTR(360, 1),
- /* 0010 */ PTR(362, 1),
- /* 0011 */ PTR(364, 1),
- /* 0100 */ V(14, 2, 4),
- /* 0101 */ PTR(366, 1),
- /* 0110 */ V(1, 14, 4),
- /* 0111 */ V(14, 1, 4),
- /* 1000 */ PTR(368, 1),
- /* 1001 */ PTR(370, 1),
- /* 1010 */ PTR(372, 1),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 1),
- /* 1101 */ PTR(378, 1),
- /* 1110 */ V(12, 6, 4),
- /* 1111 */ V(3, 13, 4),
-
- /* 0000 0010 ... */
- /* 0000 */ PTR(380, 1), /* 100 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(1, 13, 4),
- /* 0100 */ V(11, 7, 4),
- /* 0101 */ PTR(382, 1),
- /* 0110 */ PTR(384, 1),
- /* 0111 */ V(12, 3, 4),
- /* 1000 */ PTR(386, 1),
- /* 1001 */ V(4, 11, 4),
- /* 1010 */ V(13, 1, 3),
- /* 1011 */ V(13, 1, 3),
- /* 1100 */ V(0, 13, 4),
- /* 1101 */ V(13, 0, 4),
- /* 1110 */ V(8, 10, 4),
- /* 1111 */ V(10, 8, 4),
-
- /* 0000 0011 ... */
- /* 0000 */ V(4, 12, 4), /* 116 */
- /* 0001 */ V(12, 4, 4),
- /* 0010 */ V(6, 11, 4),
- /* 0011 */ V(11, 6, 4),
- /* 0100 */ V(3, 12, 3),
- /* 0101 */ V(3, 12, 3),
- /* 0110 */ V(2, 12, 3),
- /* 0111 */ V(2, 12, 3),
- /* 1000 */ V(12, 2, 3),
- /* 1001 */ V(12, 2, 3),
- /* 1010 */ V(5, 11, 3),
- /* 1011 */ V(5, 11, 3),
- /* 1100 */ V(11, 5, 4),
- /* 1101 */ V(8, 9, 4),
- /* 1110 */ V(1, 12, 3),
- /* 1111 */ V(1, 12, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(12, 1, 3), /* 132 */
- /* 0001 */ V(12, 1, 3),
- /* 0010 */ V(9, 8, 4),
- /* 0011 */ V(0, 12, 4),
- /* 0100 */ V(12, 0, 3),
- /* 0101 */ V(12, 0, 3),
- /* 0110 */ V(11, 4, 4),
- /* 0111 */ V(6, 10, 4),
- /* 1000 */ V(10, 6, 4),
- /* 1001 */ V(7, 9, 4),
- /* 1010 */ V(3, 11, 3),
- /* 1011 */ V(3, 11, 3),
- /* 1100 */ V(11, 3, 3),
- /* 1101 */ V(11, 3, 3),
- /* 1110 */ V(8, 8, 4),
- /* 1111 */ V(5, 10, 4),
-
- /* 0000 0101 ... */
- /* 0000 */ V(2, 11, 3), /* 148 */
- /* 0001 */ V(2, 11, 3),
- /* 0010 */ V(10, 5, 4),
- /* 0011 */ V(6, 9, 4),
- /* 0100 */ V(10, 4, 3),
- /* 0101 */ V(10, 4, 3),
- /* 0110 */ V(7, 8, 4),
- /* 0111 */ V(8, 7, 4),
- /* 1000 */ V(9, 4, 3),
- /* 1001 */ V(9, 4, 3),
- /* 1010 */ V(7, 7, 4),
- /* 1011 */ V(7, 6, 4),
- /* 1100 */ V(11, 2, 2),
- /* 1101 */ V(11, 2, 2),
- /* 1110 */ V(11, 2, 2),
- /* 1111 */ V(11, 2, 2),
-
- /* 0000 0110 ... */
- /* 000 */ V(1, 11, 2), /* 164 */
- /* 001 */ V(1, 11, 2),
- /* 010 */ V(11, 1, 2),
- /* 011 */ V(11, 1, 2),
- /* 100 */ V(0, 11, 3),
- /* 101 */ V(11, 0, 3),
- /* 110 */ V(9, 6, 3),
- /* 111 */ V(4, 10, 3),
-
- /* 0000 0111 ... */
- /* 000 */ V(3, 10, 3), /* 172 */
- /* 001 */ V(10, 3, 3),
- /* 010 */ V(5, 9, 3),
- /* 011 */ V(9, 5, 3),
- /* 100 */ V(2, 10, 2),
- /* 101 */ V(2, 10, 2),
- /* 110 */ V(10, 2, 2),
- /* 111 */ V(10, 2, 2),
-
- /* 0000 1000 ... */
- /* 000 */ V(1, 10, 2), /* 180 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(10, 1, 2),
- /* 011 */ V(10, 1, 2),
- /* 100 */ V(0, 10, 3),
- /* 101 */ V(6, 8, 3),
- /* 110 */ V(10, 0, 2),
- /* 111 */ V(10, 0, 2),
-
- /* 0000 1001 ... */
- /* 000 */ V(8, 6, 3), /* 188 */
- /* 001 */ V(4, 9, 3),
- /* 010 */ V(9, 3, 2),
- /* 011 */ V(9, 3, 2),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(5, 8, 3),
- /* 110 */ V(8, 5, 3),
- /* 111 */ V(6, 7, 3),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 9, 2), /* 196 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(5, 7, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 2),
- /* 111 */ V(3, 8, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(8, 3, 2), /* 204 */
- /* 001 */ V(8, 3, 2),
- /* 010 */ V(6, 6, 3),
- /* 011 */ V(4, 7, 3),
- /* 100 */ V(7, 4, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(6, 5, 3),
- /* 111 */ V(7, 3, 3),
-
- /* 0000 1100 ... */
- /* 0 */ V(1, 9, 1), /* 212 */
- /* 1 */ V(9, 1, 1),
-
- /* 0000 1101 ... */
- /* 00 */ V(0, 9, 2), /* 214 */
- /* 01 */ V(9, 0, 2),
- /* 10 */ V(4, 8, 2),
- /* 11 */ V(8, 4, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 2, 2), /* 218 */
- /* 001 */ V(7, 2, 2),
- /* 010 */ V(4, 6, 3),
- /* 011 */ V(6, 4, 3),
- /* 100 */ V(2, 8, 1),
- /* 101 */ V(2, 8, 1),
- /* 110 */ V(2, 8, 1),
- /* 111 */ V(2, 8, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(8, 2, 1), /* 226 */
- /* 1 */ V(1, 8, 1),
-
- /* 0001 0000 ... */
- /* 00 */ V(3, 7, 2), /* 228 */
- /* 01 */ V(2, 7, 2),
- /* 10 */ V(1, 7, 1),
- /* 11 */ V(1, 7, 1),
-
- /* 0001 0001 ... */
- /* 00 */ V(7, 1, 1), /* 232 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(5, 5, 2),
- /* 11 */ V(0, 7, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(7, 0, 2), /* 236 */
- /* 01 */ V(3, 6, 2),
- /* 10 */ V(6, 3, 2),
- /* 11 */ V(4, 5, 2),
-
- /* 0001 0011 ... */
- /* 00 */ V(5, 4, 2), /* 240 */
- /* 01 */ V(2, 6, 2),
- /* 10 */ V(6, 2, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0001 0101 ... */
- /* 0 */ V(0, 8, 1), /* 244 */
- /* 1 */ V(8, 0, 1),
-
- /* 0001 0110 ... */
- /* 0 */ V(1, 6, 1), /* 246 */
- /* 1 */ V(6, 1, 1),
-
- /* 0001 0111 ... */
- /* 0 */ V(0, 6, 1), /* 248 */
- /* 1 */ V(6, 0, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(5, 3, 2), /* 250 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(5, 2, 1), /* 254 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(3, 4, 1), /* 256 */
- /* 1 */ V(4, 3, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(5, 0, 1), /* 258 */
- /* 1 */ V(2, 4, 1),
-
- /* 0001 1110 ... */
- /* 0 */ V(4, 2, 1), /* 260 */
- /* 1 */ V(3, 3, 1),
-
- /* 0000 0000 0000 ... */
- /* 0000 */ PTR(388, 3), /* 262 */
- /* 0001 */ V(15, 15, 4),
- /* 0010 */ V(14, 15, 4),
- /* 0011 */ V(13, 15, 4),
- /* 0100 */ V(14, 14, 4),
- /* 0101 */ V(12, 15, 4),
- /* 0110 */ V(13, 14, 4),
- /* 0111 */ V(11, 15, 4),
- /* 1000 */ V(15, 11, 4),
- /* 1001 */ V(12, 14, 4),
- /* 1010 */ V(13, 12, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 12, 3),
- /* 1101 */ V(14, 12, 3),
- /* 1110 */ V(13, 13, 3),
- /* 1111 */ V(13, 13, 3),
-
- /* 0000 0000 0001 ... */
- /* 0000 */ V(15, 10, 4), /* 278 */
- /* 0001 */ V(12, 13, 4),
- /* 0010 */ V(11, 14, 3),
- /* 0011 */ V(11, 14, 3),
- /* 0100 */ V(14, 11, 3),
- /* 0101 */ V(14, 11, 3),
- /* 0110 */ V(9, 15, 3),
- /* 0111 */ V(9, 15, 3),
- /* 1000 */ V(15, 9, 3),
- /* 1001 */ V(15, 9, 3),
- /* 1010 */ V(14, 10, 3),
- /* 1011 */ V(14, 10, 3),
- /* 1100 */ V(11, 13, 3),
- /* 1101 */ V(11, 13, 3),
- /* 1110 */ V(13, 11, 3),
- /* 1111 */ V(13, 11, 3),
-
- /* 0000 0000 0010 ... */
- /* 0000 */ V(8, 15, 3), /* 294 */
- /* 0001 */ V(8, 15, 3),
- /* 0010 */ V(15, 8, 3),
- /* 0011 */ V(15, 8, 3),
- /* 0100 */ V(12, 12, 3),
- /* 0101 */ V(12, 12, 3),
- /* 0110 */ V(10, 14, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(8, 14, 3),
- /* 1001 */ V(8, 14, 3),
- /* 1010 */ V(7, 15, 4),
- /* 1011 */ V(7, 14, 4),
- /* 1100 */ V(15, 7, 2),
- /* 1101 */ V(15, 7, 2),
- /* 1110 */ V(15, 7, 2),
- /* 1111 */ V(15, 7, 2),
-
- /* 0000 0000 0011 ... */
- /* 000 */ V(13, 10, 2), /* 310 */
- /* 001 */ V(13, 10, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(11, 12, 3),
- /* 100 */ V(12, 11, 3),
- /* 101 */ V(15, 6, 3),
- /* 110 */ V(6, 15, 2),
- /* 111 */ V(6, 15, 2),
-
- /* 0000 0000 0100 ... */
- /* 00 */ V(14, 8, 2), /* 318 */
- /* 01 */ V(5, 15, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(13, 9, 2),
-
- /* 0000 0000 0101 ... */
- /* 00 */ V(15, 5, 2), /* 322 */
- /* 01 */ V(14, 7, 2),
- /* 10 */ V(10, 12, 2),
- /* 11 */ V(11, 11, 2),
-
- /* 0000 0000 0110 ... */
- /* 000 */ V(4, 15, 2), /* 326 */
- /* 001 */ V(4, 15, 2),
- /* 010 */ V(15, 4, 2),
- /* 011 */ V(15, 4, 2),
- /* 100 */ V(12, 10, 3),
- /* 101 */ V(14, 6, 3),
- /* 110 */ V(15, 3, 2),
- /* 111 */ V(15, 3, 2),
-
- /* 0000 0000 0111 ... */
- /* 00 */ V(3, 15, 1), /* 334 */
- /* 01 */ V(3, 15, 1),
- /* 10 */ V(8, 13, 2),
- /* 11 */ V(13, 8, 2),
-
- /* 0000 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 338 */
- /* 1 */ V(15, 2, 1),
-
- /* 0000 0000 1001 ... */
- /* 00 */ V(6, 14, 2), /* 340 */
- /* 01 */ V(9, 12, 2),
- /* 10 */ V(0, 15, 1),
- /* 11 */ V(0, 15, 1),
-
- /* 0000 0000 1010 ... */
- /* 00 */ V(12, 9, 2), /* 344 */
- /* 01 */ V(5, 14, 2),
- /* 10 */ V(10, 11, 1),
- /* 11 */ V(10, 11, 1),
-
- /* 0000 0000 1011 ... */
- /* 00 */ V(7, 13, 2), /* 348 */
- /* 01 */ V(13, 7, 2),
- /* 10 */ V(4, 14, 1),
- /* 11 */ V(4, 14, 1),
-
- /* 0000 0000 1100 ... */
- /* 00 */ V(12, 8, 2), /* 352 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(3, 14, 1),
- /* 11 */ V(3, 14, 1),
-
- /* 0000 0000 1101 ... */
- /* 00 */ V(11, 9, 1), /* 356 */
- /* 01 */ V(11, 9, 1),
- /* 10 */ V(9, 11, 2),
- /* 11 */ V(10, 10, 2),
-
- /* 0000 0001 0001 ... */
- /* 0 */ V(11, 10, 1), /* 360 */
- /* 1 */ V(14, 5, 1),
-
- /* 0000 0001 0010 ... */
- /* 0 */ V(14, 4, 1), /* 362 */
- /* 1 */ V(8, 12, 1),
-
- /* 0000 0001 0011 ... */
- /* 0 */ V(6, 13, 1), /* 364 */
- /* 1 */ V(14, 3, 1),
-
- /* 0000 0001 0101 ... */
- /* 0 */ V(2, 14, 1), /* 366 */
- /* 1 */ V(0, 14, 1),
-
- /* 0000 0001 1000 ... */
- /* 0 */ V(14, 0, 1), /* 368 */
- /* 1 */ V(5, 13, 1),
-
- /* 0000 0001 1001 ... */
- /* 0 */ V(13, 5, 1), /* 370 */
- /* 1 */ V(7, 12, 1),
-
- /* 0000 0001 1010 ... */
- /* 0 */ V(12, 7, 1), /* 372 */
- /* 1 */ V(4, 13, 1),
-
- /* 0000 0001 1011 ... */
- /* 0 */ V(8, 11, 1), /* 374 */
- /* 1 */ V(11, 8, 1),
-
- /* 0000 0001 1100 ... */
- /* 0 */ V(13, 4, 1), /* 376 */
- /* 1 */ V(9, 10, 1),
-
- /* 0000 0001 1101 ... */
- /* 0 */ V(10, 9, 1), /* 378 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 0010 0000 ... */
- /* 0 */ V(13, 3, 1), /* 380 */
- /* 1 */ V(7, 11, 1),
-
- /* 0000 0010 0101 ... */
- /* 0 */ V(5, 12, 1), /* 382 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 0010 0110 ... */
- /* 0 */ V(9, 9, 1), /* 384 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 0010 1000 ... */
- /* 0 */ V(10, 7, 1), /* 386 */
- /* 1 */ V(9, 7, 1),
-
- /* 0000 0000 0000 0000 ... */
- /* 000 */ V(15, 14, 3), /* 388 */
- /* 001 */ V(15, 12, 3),
- /* 010 */ V(15, 13, 2),
- /* 011 */ V(15, 13, 2),
- /* 100 */ V(14, 13, 1),
- /* 101 */ V(14, 13, 1),
- /* 110 */ V(14, 13, 1),
- /* 111 */ V(14, 13, 1),
-
- /* 0000 0000 0000 1011 ... */
- /* 0 */ V(10, 15, 1), /* 396 */
- /* 1 */ V(14, 9, 1)
+union huffpair const hufftab13[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 4), /* 16 */
+ /* 0001 */ PTR(84, 4),
+ /* 0010 */ PTR(100, 4),
+ /* 0011 */ PTR(116, 4),
+ /* 0100 */ PTR(132, 4),
+ /* 0101 */ PTR(148, 4),
+ /* 0110 */ PTR(164, 3),
+ /* 0111 */ PTR(172, 3),
+ /* 1000 */ PTR(180, 3),
+ /* 1001 */ PTR(188, 3),
+ /* 1010 */ PTR(196, 3),
+ /* 1011 */ PTR(204, 3),
+ /* 1100 */ PTR(212, 1),
+ /* 1101 */ PTR(214, 2),
+ /* 1110 */ PTR(218, 3),
+ /* 1111 */ PTR(226, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(228, 2), /* 32 */
+ /* 0001 */ PTR(232, 2),
+ /* 0010 */ PTR(236, 2),
+ /* 0011 */ PTR(240, 2),
+ /* 0100 */ V(8, 1, 4),
+ /* 0101 */ PTR(244, 1),
+ /* 0110 */ PTR(246, 1),
+ /* 0111 */ PTR(248, 1),
+ /* 1000 */ PTR(250, 2),
+ /* 1001 */ PTR(254, 1),
+ /* 1010 */ V(1, 5, 4),
+ /* 1011 */ V(5, 1, 4),
+ /* 1100 */ PTR(256, 1),
+ /* 1101 */ PTR(258, 1),
+ /* 1110 */ PTR(260, 1),
+ /* 1111 */ V(1, 4, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(4, 1, 3), /* 48 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 4),
+ /* 0101 */ V(3, 2, 4),
+ /* 0110 */ V(1, 3, 3),
+ /* 0111 */ V(1, 3, 3),
+ /* 1000 */ V(3, 1, 3),
+ /* 1001 */ V(3, 1, 3),
+ /* 1010 */ V(0, 3, 3),
+ /* 1011 */ V(0, 3, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(262, 4), /* 68 */
+ /* 0001 */ PTR(278, 4),
+ /* 0010 */ PTR(294, 4),
+ /* 0011 */ PTR(310, 3),
+ /* 0100 */ PTR(318, 2),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 3),
+ /* 0111 */ PTR(334, 2),
+ /* 1000 */ PTR(338, 1),
+ /* 1001 */ PTR(340, 2),
+ /* 1010 */ PTR(344, 2),
+ /* 1011 */ PTR(348, 2),
+ /* 1100 */ PTR(352, 2),
+ /* 1101 */ PTR(356, 2),
+ /* 1110 */ V(1, 15, 4),
+ /* 1111 */ V(15, 1, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 0, 4), /* 84 */
+ /* 0001 */ PTR(360, 1),
+ /* 0010 */ PTR(362, 1),
+ /* 0011 */ PTR(364, 1),
+ /* 0100 */ V(14, 2, 4),
+ /* 0101 */ PTR(366, 1),
+ /* 0110 */ V(1, 14, 4),
+ /* 0111 */ V(14, 1, 4),
+ /* 1000 */ PTR(368, 1),
+ /* 1001 */ PTR(370, 1),
+ /* 1010 */ PTR(372, 1),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 1),
+ /* 1101 */ PTR(378, 1),
+ /* 1110 */ V(12, 6, 4),
+ /* 1111 */ V(3, 13, 4),
+
+ /* 0000 0010 ... */
+ /* 0000 */ PTR(380, 1), /* 100 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(1, 13, 4),
+ /* 0100 */ V(11, 7, 4),
+ /* 0101 */ PTR(382, 1),
+ /* 0110 */ PTR(384, 1),
+ /* 0111 */ V(12, 3, 4),
+ /* 1000 */ PTR(386, 1),
+ /* 1001 */ V(4, 11, 4),
+ /* 1010 */ V(13, 1, 3),
+ /* 1011 */ V(13, 1, 3),
+ /* 1100 */ V(0, 13, 4),
+ /* 1101 */ V(13, 0, 4),
+ /* 1110 */ V(8, 10, 4),
+ /* 1111 */ V(10, 8, 4),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(4, 12, 4), /* 116 */
+ /* 0001 */ V(12, 4, 4),
+ /* 0010 */ V(6, 11, 4),
+ /* 0011 */ V(11, 6, 4),
+ /* 0100 */ V(3, 12, 3),
+ /* 0101 */ V(3, 12, 3),
+ /* 0110 */ V(2, 12, 3),
+ /* 0111 */ V(2, 12, 3),
+ /* 1000 */ V(12, 2, 3),
+ /* 1001 */ V(12, 2, 3),
+ /* 1010 */ V(5, 11, 3),
+ /* 1011 */ V(5, 11, 3),
+ /* 1100 */ V(11, 5, 4),
+ /* 1101 */ V(8, 9, 4),
+ /* 1110 */ V(1, 12, 3),
+ /* 1111 */ V(1, 12, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(12, 1, 3), /* 132 */
+ /* 0001 */ V(12, 1, 3),
+ /* 0010 */ V(9, 8, 4),
+ /* 0011 */ V(0, 12, 4),
+ /* 0100 */ V(12, 0, 3),
+ /* 0101 */ V(12, 0, 3),
+ /* 0110 */ V(11, 4, 4),
+ /* 0111 */ V(6, 10, 4),
+ /* 1000 */ V(10, 6, 4),
+ /* 1001 */ V(7, 9, 4),
+ /* 1010 */ V(3, 11, 3),
+ /* 1011 */ V(3, 11, 3),
+ /* 1100 */ V(11, 3, 3),
+ /* 1101 */ V(11, 3, 3),
+ /* 1110 */ V(8, 8, 4),
+ /* 1111 */ V(5, 10, 4),
+
+ /* 0000 0101 ... */
+ /* 0000 */ V(2, 11, 3), /* 148 */
+ /* 0001 */ V(2, 11, 3),
+ /* 0010 */ V(10, 5, 4),
+ /* 0011 */ V(6, 9, 4),
+ /* 0100 */ V(10, 4, 3),
+ /* 0101 */ V(10, 4, 3),
+ /* 0110 */ V(7, 8, 4),
+ /* 0111 */ V(8, 7, 4),
+ /* 1000 */ V(9, 4, 3),
+ /* 1001 */ V(9, 4, 3),
+ /* 1010 */ V(7, 7, 4),
+ /* 1011 */ V(7, 6, 4),
+ /* 1100 */ V(11, 2, 2),
+ /* 1101 */ V(11, 2, 2),
+ /* 1110 */ V(11, 2, 2),
+ /* 1111 */ V(11, 2, 2),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(1, 11, 2), /* 164 */
+ /* 001 */ V(1, 11, 2),
+ /* 010 */ V(11, 1, 2),
+ /* 011 */ V(11, 1, 2),
+ /* 100 */ V(0, 11, 3),
+ /* 101 */ V(11, 0, 3),
+ /* 110 */ V(9, 6, 3),
+ /* 111 */ V(4, 10, 3),
+
+ /* 0000 0111 ... */
+ /* 000 */ V(3, 10, 3), /* 172 */
+ /* 001 */ V(10, 3, 3),
+ /* 010 */ V(5, 9, 3),
+ /* 011 */ V(9, 5, 3),
+ /* 100 */ V(2, 10, 2),
+ /* 101 */ V(2, 10, 2),
+ /* 110 */ V(10, 2, 2),
+ /* 111 */ V(10, 2, 2),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(1, 10, 2), /* 180 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(10, 1, 2),
+ /* 011 */ V(10, 1, 2),
+ /* 100 */ V(0, 10, 3),
+ /* 101 */ V(6, 8, 3),
+ /* 110 */ V(10, 0, 2),
+ /* 111 */ V(10, 0, 2),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(8, 6, 3), /* 188 */
+ /* 001 */ V(4, 9, 3),
+ /* 010 */ V(9, 3, 2),
+ /* 011 */ V(9, 3, 2),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(5, 8, 3),
+ /* 110 */ V(8, 5, 3),
+ /* 111 */ V(6, 7, 3),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 9, 2), /* 196 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(5, 7, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 2),
+ /* 111 */ V(3, 8, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(8, 3, 2), /* 204 */
+ /* 001 */ V(8, 3, 2),
+ /* 010 */ V(6, 6, 3),
+ /* 011 */ V(4, 7, 3),
+ /* 100 */ V(7, 4, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(6, 5, 3),
+ /* 111 */ V(7, 3, 3),
+
+ /* 0000 1100 ... */
+ /* 0 */ V(1, 9, 1), /* 212 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0000 1101 ... */
+ /* 00 */ V(0, 9, 2), /* 214 */
+ /* 01 */ V(9, 0, 2),
+ /* 10 */ V(4, 8, 2),
+ /* 11 */ V(8, 4, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 2, 2), /* 218 */
+ /* 001 */ V(7, 2, 2),
+ /* 010 */ V(4, 6, 3),
+ /* 011 */ V(6, 4, 3),
+ /* 100 */ V(2, 8, 1),
+ /* 101 */ V(2, 8, 1),
+ /* 110 */ V(2, 8, 1),
+ /* 111 */ V(2, 8, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(8, 2, 1), /* 226 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(3, 7, 2), /* 228 */
+ /* 01 */ V(2, 7, 2),
+ /* 10 */ V(1, 7, 1),
+ /* 11 */ V(1, 7, 1),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(7, 1, 1), /* 232 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(5, 5, 2),
+ /* 11 */ V(0, 7, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(7, 0, 2), /* 236 */
+ /* 01 */ V(3, 6, 2),
+ /* 10 */ V(6, 3, 2),
+ /* 11 */ V(4, 5, 2),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(5, 4, 2), /* 240 */
+ /* 01 */ V(2, 6, 2),
+ /* 10 */ V(6, 2, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0001 0101 ... */
+ /* 0 */ V(0, 8, 1), /* 244 */
+ /* 1 */ V(8, 0, 1),
+
+ /* 0001 0110 ... */
+ /* 0 */ V(1, 6, 1), /* 246 */
+ /* 1 */ V(6, 1, 1),
+
+ /* 0001 0111 ... */
+ /* 0 */ V(0, 6, 1), /* 248 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(5, 3, 2), /* 250 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(5, 2, 1), /* 254 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(3, 4, 1), /* 256 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(5, 0, 1), /* 258 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0001 1110 ... */
+ /* 0 */ V(4, 2, 1), /* 260 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0000 */ PTR(388, 3), /* 262 */
+ /* 0001 */ V(15, 15, 4),
+ /* 0010 */ V(14, 15, 4),
+ /* 0011 */ V(13, 15, 4),
+ /* 0100 */ V(14, 14, 4),
+ /* 0101 */ V(12, 15, 4),
+ /* 0110 */ V(13, 14, 4),
+ /* 0111 */ V(11, 15, 4),
+ /* 1000 */ V(15, 11, 4),
+ /* 1001 */ V(12, 14, 4),
+ /* 1010 */ V(13, 12, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 12, 3),
+ /* 1101 */ V(14, 12, 3),
+ /* 1110 */ V(13, 13, 3),
+ /* 1111 */ V(13, 13, 3),
+
+ /* 0000 0000 0001 ... */
+ /* 0000 */ V(15, 10, 4), /* 278 */
+ /* 0001 */ V(12, 13, 4),
+ /* 0010 */ V(11, 14, 3),
+ /* 0011 */ V(11, 14, 3),
+ /* 0100 */ V(14, 11, 3),
+ /* 0101 */ V(14, 11, 3),
+ /* 0110 */ V(9, 15, 3),
+ /* 0111 */ V(9, 15, 3),
+ /* 1000 */ V(15, 9, 3),
+ /* 1001 */ V(15, 9, 3),
+ /* 1010 */ V(14, 10, 3),
+ /* 1011 */ V(14, 10, 3),
+ /* 1100 */ V(11, 13, 3),
+ /* 1101 */ V(11, 13, 3),
+ /* 1110 */ V(13, 11, 3),
+ /* 1111 */ V(13, 11, 3),
+
+ /* 0000 0000 0010 ... */
+ /* 0000 */ V(8, 15, 3), /* 294 */
+ /* 0001 */ V(8, 15, 3),
+ /* 0010 */ V(15, 8, 3),
+ /* 0011 */ V(15, 8, 3),
+ /* 0100 */ V(12, 12, 3),
+ /* 0101 */ V(12, 12, 3),
+ /* 0110 */ V(10, 14, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(8, 14, 3),
+ /* 1001 */ V(8, 14, 3),
+ /* 1010 */ V(7, 15, 4),
+ /* 1011 */ V(7, 14, 4),
+ /* 1100 */ V(15, 7, 2),
+ /* 1101 */ V(15, 7, 2),
+ /* 1110 */ V(15, 7, 2),
+ /* 1111 */ V(15, 7, 2),
+
+ /* 0000 0000 0011 ... */
+ /* 000 */ V(13, 10, 2), /* 310 */
+ /* 001 */ V(13, 10, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(11, 12, 3),
+ /* 100 */ V(12, 11, 3),
+ /* 101 */ V(15, 6, 3),
+ /* 110 */ V(6, 15, 2),
+ /* 111 */ V(6, 15, 2),
+
+ /* 0000 0000 0100 ... */
+ /* 00 */ V(14, 8, 2), /* 318 */
+ /* 01 */ V(5, 15, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(13, 9, 2),
+
+ /* 0000 0000 0101 ... */
+ /* 00 */ V(15, 5, 2), /* 322 */
+ /* 01 */ V(14, 7, 2),
+ /* 10 */ V(10, 12, 2),
+ /* 11 */ V(11, 11, 2),
+
+ /* 0000 0000 0110 ... */
+ /* 000 */ V(4, 15, 2), /* 326 */
+ /* 001 */ V(4, 15, 2),
+ /* 010 */ V(15, 4, 2),
+ /* 011 */ V(15, 4, 2),
+ /* 100 */ V(12, 10, 3),
+ /* 101 */ V(14, 6, 3),
+ /* 110 */ V(15, 3, 2),
+ /* 111 */ V(15, 3, 2),
+
+ /* 0000 0000 0111 ... */
+ /* 00 */ V(3, 15, 1), /* 334 */
+ /* 01 */ V(3, 15, 1),
+ /* 10 */ V(8, 13, 2),
+ /* 11 */ V(13, 8, 2),
+
+ /* 0000 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 338 */
+ /* 1 */ V(15, 2, 1),
+
+ /* 0000 0000 1001 ... */
+ /* 00 */ V(6, 14, 2), /* 340 */
+ /* 01 */ V(9, 12, 2),
+ /* 10 */ V(0, 15, 1),
+ /* 11 */ V(0, 15, 1),
+
+ /* 0000 0000 1010 ... */
+ /* 00 */ V(12, 9, 2), /* 344 */
+ /* 01 */ V(5, 14, 2),
+ /* 10 */ V(10, 11, 1),
+ /* 11 */ V(10, 11, 1),
+
+ /* 0000 0000 1011 ... */
+ /* 00 */ V(7, 13, 2), /* 348 */
+ /* 01 */ V(13, 7, 2),
+ /* 10 */ V(4, 14, 1),
+ /* 11 */ V(4, 14, 1),
+
+ /* 0000 0000 1100 ... */
+ /* 00 */ V(12, 8, 2), /* 352 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(3, 14, 1),
+ /* 11 */ V(3, 14, 1),
+
+ /* 0000 0000 1101 ... */
+ /* 00 */ V(11, 9, 1), /* 356 */
+ /* 01 */ V(11, 9, 1),
+ /* 10 */ V(9, 11, 2),
+ /* 11 */ V(10, 10, 2),
+
+ /* 0000 0001 0001 ... */
+ /* 0 */ V(11, 10, 1), /* 360 */
+ /* 1 */ V(14, 5, 1),
+
+ /* 0000 0001 0010 ... */
+ /* 0 */ V(14, 4, 1), /* 362 */
+ /* 1 */ V(8, 12, 1),
+
+ /* 0000 0001 0011 ... */
+ /* 0 */ V(6, 13, 1), /* 364 */
+ /* 1 */ V(14, 3, 1),
+
+ /* 0000 0001 0101 ... */
+ /* 0 */ V(2, 14, 1), /* 366 */
+ /* 1 */ V(0, 14, 1),
+
+ /* 0000 0001 1000 ... */
+ /* 0 */ V(14, 0, 1), /* 368 */
+ /* 1 */ V(5, 13, 1),
+
+ /* 0000 0001 1001 ... */
+ /* 0 */ V(13, 5, 1), /* 370 */
+ /* 1 */ V(7, 12, 1),
+
+ /* 0000 0001 1010 ... */
+ /* 0 */ V(12, 7, 1), /* 372 */
+ /* 1 */ V(4, 13, 1),
+
+ /* 0000 0001 1011 ... */
+ /* 0 */ V(8, 11, 1), /* 374 */
+ /* 1 */ V(11, 8, 1),
+
+ /* 0000 0001 1100 ... */
+ /* 0 */ V(13, 4, 1), /* 376 */
+ /* 1 */ V(9, 10, 1),
+
+ /* 0000 0001 1101 ... */
+ /* 0 */ V(10, 9, 1), /* 378 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 0010 0000 ... */
+ /* 0 */ V(13, 3, 1), /* 380 */
+ /* 1 */ V(7, 11, 1),
+
+ /* 0000 0010 0101 ... */
+ /* 0 */ V(5, 12, 1), /* 382 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 0010 0110 ... */
+ /* 0 */ V(9, 9, 1), /* 384 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 0010 1000 ... */
+ /* 0 */ V(10, 7, 1), /* 386 */
+ /* 1 */ V(9, 7, 1),
+
+ /* 0000 0000 0000 0000 ... */
+ /* 000 */ V(15, 14, 3), /* 388 */
+ /* 001 */ V(15, 12, 3),
+ /* 010 */ V(15, 13, 2),
+ /* 011 */ V(15, 13, 2),
+ /* 100 */ V(14, 13, 1),
+ /* 101 */ V(14, 13, 1),
+ /* 110 */ V(14, 13, 1),
+ /* 111 */ V(14, 13, 1),
+
+ /* 0000 0000 0000 1011 ... */
+ /* 0 */ V(10, 15, 1), /* 396 */
+ /* 1 */ V(14, 9, 1)
};
static
-union huffpair const hufftab15[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 4),
- /* 0100 */ PTR(80, 4),
- /* 0101 */ PTR(96, 3),
- /* 0110 */ PTR(104, 3),
- /* 0111 */ PTR(112, 2),
- /* 1000 */ PTR(116, 1),
- /* 1001 */ PTR(118, 1),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 4),
- /* 1101 */ V(1, 0, 4),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(120, 4), /* 16 */
- /* 0001 */ PTR(136, 4),
- /* 0010 */ PTR(152, 4),
- /* 0011 */ PTR(168, 4),
- /* 0100 */ PTR(184, 4),
- /* 0101 */ PTR(200, 3),
- /* 0110 */ PTR(208, 3),
- /* 0111 */ PTR(216, 4),
- /* 1000 */ PTR(232, 3),
- /* 1001 */ PTR(240, 3),
- /* 1010 */ PTR(248, 3),
- /* 1011 */ PTR(256, 3),
- /* 1100 */ PTR(264, 2),
- /* 1101 */ PTR(268, 3),
- /* 1110 */ PTR(276, 3),
- /* 1111 */ PTR(284, 2),
-
- /* 0001 ... */
- /* 0000 */ PTR(288, 2), /* 32 */
- /* 0001 */ PTR(292, 2),
- /* 0010 */ PTR(296, 2),
- /* 0011 */ PTR(300, 2),
- /* 0100 */ PTR(304, 2),
- /* 0101 */ PTR(308, 2),
- /* 0110 */ PTR(312, 2),
- /* 0111 */ PTR(316, 2),
- /* 1000 */ PTR(320, 1),
- /* 1001 */ PTR(322, 1),
- /* 1010 */ PTR(324, 1),
- /* 1011 */ PTR(326, 2),
- /* 1100 */ PTR(330, 1),
- /* 1101 */ PTR(332, 1),
- /* 1110 */ PTR(334, 2),
- /* 1111 */ PTR(338, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(340, 1), /* 48 */
- /* 0001 */ PTR(342, 1),
- /* 0010 */ V(9, 1, 4),
- /* 0011 */ PTR(344, 1),
- /* 0100 */ PTR(346, 1),
- /* 0101 */ PTR(348, 1),
- /* 0110 */ PTR(350, 1),
- /* 0111 */ PTR(352, 1),
- /* 1000 */ V(2, 8, 4),
- /* 1001 */ V(8, 2, 4),
- /* 1010 */ V(1, 8, 4),
- /* 1011 */ V(8, 1, 4),
- /* 1100 */ PTR(354, 1),
- /* 1101 */ PTR(356, 1),
- /* 1110 */ PTR(358, 1),
- /* 1111 */ PTR(360, 1),
-
- /* 0011 ... */
- /* 0000 */ V(2, 7, 4), /* 64 */
- /* 0001 */ V(7, 2, 4),
- /* 0010 */ V(6, 4, 4),
- /* 0011 */ V(1, 7, 4),
- /* 0100 */ V(5, 5, 4),
- /* 0101 */ V(7, 1, 4),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ V(3, 6, 4),
- /* 1000 */ V(6, 3, 4),
- /* 1001 */ V(4, 5, 4),
- /* 1010 */ V(5, 4, 4),
- /* 1011 */ V(2, 6, 4),
- /* 1100 */ V(6, 2, 4),
- /* 1101 */ V(1, 6, 4),
- /* 1110 */ PTR(364, 1),
- /* 1111 */ V(3, 5, 4),
-
- /* 0100 ... */
- /* 0000 */ V(6, 1, 3), /* 80 */
- /* 0001 */ V(6, 1, 3),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ V(4, 4, 4),
- /* 0100 */ V(2, 5, 3),
- /* 0101 */ V(2, 5, 3),
- /* 0110 */ V(5, 2, 3),
- /* 0111 */ V(5, 2, 3),
- /* 1000 */ V(1, 5, 3),
- /* 1001 */ V(1, 5, 3),
- /* 1010 */ V(5, 1, 3),
- /* 1011 */ V(5, 1, 3),
- /* 1100 */ V(0, 5, 4),
- /* 1101 */ V(5, 0, 4),
- /* 1110 */ V(3, 4, 3),
- /* 1111 */ V(3, 4, 3),
-
- /* 0101 ... */
- /* 000 */ V(4, 3, 3), /* 96 */
- /* 001 */ V(2, 4, 3),
- /* 010 */ V(4, 2, 3),
- /* 011 */ V(3, 3, 3),
- /* 100 */ V(4, 1, 2),
- /* 101 */ V(4, 1, 2),
- /* 110 */ V(1, 4, 3),
- /* 111 */ V(0, 4, 3),
-
- /* 0110 ... */
- /* 000 */ V(2, 3, 2), /* 104 */
- /* 001 */ V(2, 3, 2),
- /* 010 */ V(3, 2, 2),
- /* 011 */ V(3, 2, 2),
- /* 100 */ V(4, 0, 3),
- /* 101 */ V(0, 3, 3),
- /* 110 */ V(1, 3, 2),
- /* 111 */ V(1, 3, 2),
-
- /* 0111 ... */
- /* 00 */ V(3, 1, 2), /* 112 */
- /* 01 */ V(3, 0, 2),
- /* 10 */ V(2, 2, 1),
- /* 11 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(1, 2, 1), /* 116 */
- /* 1 */ V(2, 1, 1),
-
- /* 1001 ... */
- /* 0 */ V(0, 2, 1), /* 118 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(366, 1), /* 120 */
- /* 0001 */ PTR(368, 1),
- /* 0010 */ V(14, 14, 4),
- /* 0011 */ PTR(370, 1),
- /* 0100 */ PTR(372, 1),
- /* 0101 */ PTR(374, 1),
- /* 0110 */ V(15, 11, 4),
- /* 0111 */ PTR(376, 1),
- /* 1000 */ V(13, 13, 4),
- /* 1001 */ V(10, 15, 4),
- /* 1010 */ V(15, 10, 4),
- /* 1011 */ V(11, 14, 4),
- /* 1100 */ V(14, 11, 4),
- /* 1101 */ V(12, 13, 4),
- /* 1110 */ V(13, 12, 4),
- /* 1111 */ V(9, 15, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 9, 4), /* 136 */
- /* 0001 */ V(14, 10, 4),
- /* 0010 */ V(11, 13, 4),
- /* 0011 */ V(13, 11, 4),
- /* 0100 */ V(8, 15, 4),
- /* 0101 */ V(15, 8, 4),
- /* 0110 */ V(12, 12, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(14, 9, 4),
- /* 1001 */ V(7, 15, 4),
- /* 1010 */ V(15, 7, 4),
- /* 1011 */ V(10, 13, 4),
- /* 1100 */ V(13, 10, 4),
- /* 1101 */ V(11, 12, 4),
- /* 1110 */ V(6, 15, 4),
- /* 1111 */ PTR(378, 1),
-
- /* 0000 0010 ... */
- /* 0000 */ V(12, 11, 3), /* 152 */
- /* 0001 */ V(12, 11, 3),
- /* 0010 */ V(15, 6, 3),
- /* 0011 */ V(15, 6, 3),
- /* 0100 */ V(8, 14, 4),
- /* 0101 */ V(14, 8, 4),
- /* 0110 */ V(5, 15, 4),
- /* 0111 */ V(9, 13, 4),
- /* 1000 */ V(15, 5, 3),
- /* 1001 */ V(15, 5, 3),
- /* 1010 */ V(7, 14, 3),
- /* 1011 */ V(7, 14, 3),
- /* 1100 */ V(14, 7, 3),
- /* 1101 */ V(14, 7, 3),
- /* 1110 */ V(10, 12, 3),
- /* 1111 */ V(10, 12, 3),
-
- /* 0000 0011 ... */
- /* 0000 */ V(12, 10, 3), /* 168 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(13, 9, 4),
- /* 0101 */ V(8, 13, 4),
- /* 0110 */ V(4, 15, 3),
- /* 0111 */ V(4, 15, 3),
- /* 1000 */ V(15, 4, 3),
- /* 1001 */ V(15, 4, 3),
- /* 1010 */ V(3, 15, 3),
- /* 1011 */ V(3, 15, 3),
- /* 1100 */ V(15, 3, 3),
- /* 1101 */ V(15, 3, 3),
- /* 1110 */ V(13, 8, 3),
- /* 1111 */ V(13, 8, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(14, 6, 3), /* 184 */
- /* 0001 */ V(14, 6, 3),
- /* 0010 */ V(2, 15, 3),
- /* 0011 */ V(2, 15, 3),
- /* 0100 */ V(15, 2, 3),
- /* 0101 */ V(15, 2, 3),
- /* 0110 */ V(6, 14, 4),
- /* 0111 */ V(15, 0, 4),
- /* 1000 */ V(1, 15, 3),
- /* 1001 */ V(1, 15, 3),
- /* 1010 */ V(15, 1, 3),
- /* 1011 */ V(15, 1, 3),
- /* 1100 */ V(9, 12, 3),
- /* 1101 */ V(9, 12, 3),
- /* 1110 */ V(12, 9, 3),
- /* 1111 */ V(12, 9, 3),
-
- /* 0000 0101 ... */
- /* 000 */ V(5, 14, 3), /* 200 */
- /* 001 */ V(10, 11, 3),
- /* 010 */ V(11, 10, 3),
- /* 011 */ V(14, 5, 3),
- /* 100 */ V(7, 13, 3),
- /* 101 */ V(13, 7, 3),
- /* 110 */ V(4, 14, 3),
- /* 111 */ V(14, 4, 3),
-
- /* 0000 0110 ... */
- /* 000 */ V(8, 12, 3), /* 208 */
- /* 001 */ V(12, 8, 3),
- /* 010 */ V(3, 14, 3),
- /* 011 */ V(6, 13, 3),
- /* 100 */ V(13, 6, 3),
- /* 101 */ V(14, 3, 3),
- /* 110 */ V(9, 11, 3),
- /* 111 */ V(11, 9, 3),
-
- /* 0000 0111 ... */
- /* 0000 */ V(2, 14, 3), /* 216 */
- /* 0001 */ V(2, 14, 3),
- /* 0010 */ V(10, 10, 3),
- /* 0011 */ V(10, 10, 3),
- /* 0100 */ V(14, 2, 3),
- /* 0101 */ V(14, 2, 3),
- /* 0110 */ V(1, 14, 3),
- /* 0111 */ V(1, 14, 3),
- /* 1000 */ V(14, 1, 3),
- /* 1001 */ V(14, 1, 3),
- /* 1010 */ V(0, 14, 4),
- /* 1011 */ V(14, 0, 4),
- /* 1100 */ V(5, 13, 3),
- /* 1101 */ V(5, 13, 3),
- /* 1110 */ V(13, 5, 3),
- /* 1111 */ V(13, 5, 3),
-
- /* 0000 1000 ... */
- /* 000 */ V(7, 12, 3), /* 232 */
- /* 001 */ V(12, 7, 3),
- /* 010 */ V(4, 13, 3),
- /* 011 */ V(8, 11, 3),
- /* 100 */ V(13, 4, 2),
- /* 101 */ V(13, 4, 2),
- /* 110 */ V(11, 8, 3),
- /* 111 */ V(9, 10, 3),
-
- /* 0000 1001 ... */
- /* 000 */ V(10, 9, 3), /* 240 */
- /* 001 */ V(6, 12, 3),
- /* 010 */ V(12, 6, 3),
- /* 011 */ V(3, 13, 3),
- /* 100 */ V(13, 3, 2),
- /* 101 */ V(13, 3, 2),
- /* 110 */ V(13, 2, 2),
- /* 111 */ V(13, 2, 2),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 13, 3), /* 248 */
- /* 001 */ V(0, 13, 3),
- /* 010 */ V(1, 13, 2),
- /* 011 */ V(1, 13, 2),
- /* 100 */ V(7, 11, 2),
- /* 101 */ V(7, 11, 2),
- /* 110 */ V(11, 7, 2),
- /* 111 */ V(11, 7, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(13, 1, 2), /* 256 */
- /* 001 */ V(13, 1, 2),
- /* 010 */ V(5, 12, 3),
- /* 011 */ V(13, 0, 3),
- /* 100 */ V(12, 5, 2),
- /* 101 */ V(12, 5, 2),
- /* 110 */ V(8, 10, 2),
- /* 111 */ V(8, 10, 2),
-
- /* 0000 1100 ... */
- /* 00 */ V(10, 8, 2), /* 264 */
- /* 01 */ V(4, 12, 2),
- /* 10 */ V(12, 4, 2),
- /* 11 */ V(6, 11, 2),
-
- /* 0000 1101 ... */
- /* 000 */ V(11, 6, 2), /* 268 */
- /* 001 */ V(11, 6, 2),
- /* 010 */ V(9, 9, 3),
- /* 011 */ V(0, 12, 3),
- /* 100 */ V(3, 12, 2),
- /* 101 */ V(3, 12, 2),
- /* 110 */ V(12, 3, 2),
- /* 111 */ V(12, 3, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 10, 2), /* 276 */
- /* 001 */ V(7, 10, 2),
- /* 010 */ V(10, 7, 2),
- /* 011 */ V(10, 7, 2),
- /* 100 */ V(10, 6, 2),
- /* 101 */ V(10, 6, 2),
- /* 110 */ V(12, 0, 3),
- /* 111 */ V(0, 11, 3),
-
- /* 0000 1111 ... */
- /* 00 */ V(12, 2, 1), /* 284 */
- /* 01 */ V(12, 2, 1),
- /* 10 */ V(2, 12, 2),
- /* 11 */ V(5, 11, 2),
-
- /* 0001 0000 ... */
- /* 00 */ V(11, 5, 2), /* 288 */
- /* 01 */ V(1, 12, 2),
- /* 10 */ V(8, 9, 2),
- /* 11 */ V(9, 8, 2),
-
- /* 0001 0001 ... */
- /* 00 */ V(12, 1, 2), /* 292 */
- /* 01 */ V(4, 11, 2),
- /* 10 */ V(11, 4, 2),
- /* 11 */ V(6, 10, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(3, 11, 2), /* 296 */
- /* 01 */ V(7, 9, 2),
- /* 10 */ V(11, 3, 1),
- /* 11 */ V(11, 3, 1),
-
- /* 0001 0011 ... */
- /* 00 */ V(9, 7, 2), /* 300 */
- /* 01 */ V(8, 8, 2),
- /* 10 */ V(2, 11, 2),
- /* 11 */ V(5, 10, 2),
-
- /* 0001 0100 ... */
- /* 00 */ V(11, 2, 1), /* 304 */
- /* 01 */ V(11, 2, 1),
- /* 10 */ V(10, 5, 2),
- /* 11 */ V(1, 11, 2),
-
- /* 0001 0101 ... */
- /* 00 */ V(11, 1, 1), /* 308 */
- /* 01 */ V(11, 1, 1),
- /* 10 */ V(11, 0, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0001 0110 ... */
- /* 00 */ V(9, 6, 2), /* 312 */
- /* 01 */ V(4, 10, 2),
- /* 10 */ V(10, 4, 2),
- /* 11 */ V(7, 8, 2),
-
- /* 0001 0111 ... */
- /* 00 */ V(8, 7, 2), /* 316 */
- /* 01 */ V(3, 10, 2),
- /* 10 */ V(10, 3, 1),
- /* 11 */ V(10, 3, 1),
-
- /* 0001 1000 ... */
- /* 0 */ V(5, 9, 1), /* 320 */
- /* 1 */ V(9, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(2, 10, 1), /* 322 */
- /* 1 */ V(10, 2, 1),
-
- /* 0001 1010 ... */
- /* 0 */ V(1, 10, 1), /* 324 */
- /* 1 */ V(10, 1, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(0, 10, 2), /* 326 */
- /* 01 */ V(10, 0, 2),
- /* 10 */ V(6, 8, 1),
- /* 11 */ V(6, 8, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(8, 6, 1), /* 330 */
- /* 1 */ V(4, 9, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(9, 4, 1), /* 332 */
- /* 1 */ V(3, 9, 1),
-
- /* 0001 1110 ... */
- /* 00 */ V(9, 3, 1), /* 334 */
- /* 01 */ V(9, 3, 1),
- /* 10 */ V(7, 7, 2),
- /* 11 */ V(0, 9, 2),
-
- /* 0001 1111 ... */
- /* 0 */ V(5, 8, 1), /* 338 */
- /* 1 */ V(8, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(2, 9, 1), /* 340 */
- /* 1 */ V(6, 7, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(7, 6, 1), /* 342 */
- /* 1 */ V(9, 2, 1),
-
- /* 0010 0011 ... */
- /* 0 */ V(1, 9, 1), /* 344 */
- /* 1 */ V(9, 0, 1),
-
- /* 0010 0100 ... */
- /* 0 */ V(4, 8, 1), /* 346 */
- /* 1 */ V(8, 4, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(5, 7, 1), /* 348 */
- /* 1 */ V(7, 5, 1),
-
- /* 0010 0110 ... */
- /* 0 */ V(3, 8, 1), /* 350 */
- /* 1 */ V(8, 3, 1),
-
- /* 0010 0111 ... */
- /* 0 */ V(6, 6, 1), /* 352 */
- /* 1 */ V(4, 7, 1),
-
- /* 0010 1100 ... */
- /* 0 */ V(7, 4, 1), /* 354 */
- /* 1 */ V(0, 8, 1),
-
- /* 0010 1101 ... */
- /* 0 */ V(8, 0, 1), /* 356 */
- /* 1 */ V(5, 6, 1),
-
- /* 0010 1110 ... */
- /* 0 */ V(6, 5, 1), /* 358 */
- /* 1 */ V(3, 7, 1),
-
- /* 0010 1111 ... */
- /* 0 */ V(7, 3, 1), /* 360 */
- /* 1 */ V(4, 6, 1),
-
- /* 0011 0110 ... */
- /* 0 */ V(0, 7, 1), /* 362 */
- /* 1 */ V(7, 0, 1),
-
- /* 0011 1110 ... */
- /* 0 */ V(0, 6, 1), /* 364 */
- /* 1 */ V(6, 0, 1),
-
- /* 0000 0000 0000 ... */
- /* 0 */ V(15, 15, 1), /* 366 */
- /* 1 */ V(14, 15, 1),
-
- /* 0000 0000 0001 ... */
- /* 0 */ V(15, 14, 1), /* 368 */
- /* 1 */ V(13, 15, 1),
-
- /* 0000 0000 0011 ... */
- /* 0 */ V(15, 13, 1), /* 370 */
- /* 1 */ V(12, 15, 1),
-
- /* 0000 0000 0100 ... */
- /* 0 */ V(15, 12, 1), /* 372 */
- /* 1 */ V(13, 14, 1),
-
- /* 0000 0000 0101 ... */
- /* 0 */ V(14, 13, 1), /* 374 */
- /* 1 */ V(11, 15, 1),
-
- /* 0000 0000 0111 ... */
- /* 0 */ V(12, 14, 1), /* 376 */
- /* 1 */ V(14, 12, 1),
-
- /* 0000 0001 1111 ... */
- /* 0 */ V(10, 14, 1), /* 378 */
- /* 1 */ V(0, 15, 1)
+union huffpair const hufftab15[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 4),
+ /* 0100 */ PTR(80, 4),
+ /* 0101 */ PTR(96, 3),
+ /* 0110 */ PTR(104, 3),
+ /* 0111 */ PTR(112, 2),
+ /* 1000 */ PTR(116, 1),
+ /* 1001 */ PTR(118, 1),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 4),
+ /* 1101 */ V(1, 0, 4),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(120, 4), /* 16 */
+ /* 0001 */ PTR(136, 4),
+ /* 0010 */ PTR(152, 4),
+ /* 0011 */ PTR(168, 4),
+ /* 0100 */ PTR(184, 4),
+ /* 0101 */ PTR(200, 3),
+ /* 0110 */ PTR(208, 3),
+ /* 0111 */ PTR(216, 4),
+ /* 1000 */ PTR(232, 3),
+ /* 1001 */ PTR(240, 3),
+ /* 1010 */ PTR(248, 3),
+ /* 1011 */ PTR(256, 3),
+ /* 1100 */ PTR(264, 2),
+ /* 1101 */ PTR(268, 3),
+ /* 1110 */ PTR(276, 3),
+ /* 1111 */ PTR(284, 2),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(288, 2), /* 32 */
+ /* 0001 */ PTR(292, 2),
+ /* 0010 */ PTR(296, 2),
+ /* 0011 */ PTR(300, 2),
+ /* 0100 */ PTR(304, 2),
+ /* 0101 */ PTR(308, 2),
+ /* 0110 */ PTR(312, 2),
+ /* 0111 */ PTR(316, 2),
+ /* 1000 */ PTR(320, 1),
+ /* 1001 */ PTR(322, 1),
+ /* 1010 */ PTR(324, 1),
+ /* 1011 */ PTR(326, 2),
+ /* 1100 */ PTR(330, 1),
+ /* 1101 */ PTR(332, 1),
+ /* 1110 */ PTR(334, 2),
+ /* 1111 */ PTR(338, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(340, 1), /* 48 */
+ /* 0001 */ PTR(342, 1),
+ /* 0010 */ V(9, 1, 4),
+ /* 0011 */ PTR(344, 1),
+ /* 0100 */ PTR(346, 1),
+ /* 0101 */ PTR(348, 1),
+ /* 0110 */ PTR(350, 1),
+ /* 0111 */ PTR(352, 1),
+ /* 1000 */ V(2, 8, 4),
+ /* 1001 */ V(8, 2, 4),
+ /* 1010 */ V(1, 8, 4),
+ /* 1011 */ V(8, 1, 4),
+ /* 1100 */ PTR(354, 1),
+ /* 1101 */ PTR(356, 1),
+ /* 1110 */ PTR(358, 1),
+ /* 1111 */ PTR(360, 1),
+
+ /* 0011 ... */
+ /* 0000 */ V(2, 7, 4), /* 64 */
+ /* 0001 */ V(7, 2, 4),
+ /* 0010 */ V(6, 4, 4),
+ /* 0011 */ V(1, 7, 4),
+ /* 0100 */ V(5, 5, 4),
+ /* 0101 */ V(7, 1, 4),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ V(3, 6, 4),
+ /* 1000 */ V(6, 3, 4),
+ /* 1001 */ V(4, 5, 4),
+ /* 1010 */ V(5, 4, 4),
+ /* 1011 */ V(2, 6, 4),
+ /* 1100 */ V(6, 2, 4),
+ /* 1101 */ V(1, 6, 4),
+ /* 1110 */ PTR(364, 1),
+ /* 1111 */ V(3, 5, 4),
+
+ /* 0100 ... */
+ /* 0000 */ V(6, 1, 3), /* 80 */
+ /* 0001 */ V(6, 1, 3),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ V(4, 4, 4),
+ /* 0100 */ V(2, 5, 3),
+ /* 0101 */ V(2, 5, 3),
+ /* 0110 */ V(5, 2, 3),
+ /* 0111 */ V(5, 2, 3),
+ /* 1000 */ V(1, 5, 3),
+ /* 1001 */ V(1, 5, 3),
+ /* 1010 */ V(5, 1, 3),
+ /* 1011 */ V(5, 1, 3),
+ /* 1100 */ V(0, 5, 4),
+ /* 1101 */ V(5, 0, 4),
+ /* 1110 */ V(3, 4, 3),
+ /* 1111 */ V(3, 4, 3),
+
+ /* 0101 ... */
+ /* 000 */ V(4, 3, 3), /* 96 */
+ /* 001 */ V(2, 4, 3),
+ /* 010 */ V(4, 2, 3),
+ /* 011 */ V(3, 3, 3),
+ /* 100 */ V(4, 1, 2),
+ /* 101 */ V(4, 1, 2),
+ /* 110 */ V(1, 4, 3),
+ /* 111 */ V(0, 4, 3),
+
+ /* 0110 ... */
+ /* 000 */ V(2, 3, 2), /* 104 */
+ /* 001 */ V(2, 3, 2),
+ /* 010 */ V(3, 2, 2),
+ /* 011 */ V(3, 2, 2),
+ /* 100 */ V(4, 0, 3),
+ /* 101 */ V(0, 3, 3),
+ /* 110 */ V(1, 3, 2),
+ /* 111 */ V(1, 3, 2),
+
+ /* 0111 ... */
+ /* 00 */ V(3, 1, 2), /* 112 */
+ /* 01 */ V(3, 0, 2),
+ /* 10 */ V(2, 2, 1),
+ /* 11 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(1, 2, 1), /* 116 */
+ /* 1 */ V(2, 1, 1),
+
+ /* 1001 ... */
+ /* 0 */ V(0, 2, 1), /* 118 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(366, 1), /* 120 */
+ /* 0001 */ PTR(368, 1),
+ /* 0010 */ V(14, 14, 4),
+ /* 0011 */ PTR(370, 1),
+ /* 0100 */ PTR(372, 1),
+ /* 0101 */ PTR(374, 1),
+ /* 0110 */ V(15, 11, 4),
+ /* 0111 */ PTR(376, 1),
+ /* 1000 */ V(13, 13, 4),
+ /* 1001 */ V(10, 15, 4),
+ /* 1010 */ V(15, 10, 4),
+ /* 1011 */ V(11, 14, 4),
+ /* 1100 */ V(14, 11, 4),
+ /* 1101 */ V(12, 13, 4),
+ /* 1110 */ V(13, 12, 4),
+ /* 1111 */ V(9, 15, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 9, 4), /* 136 */
+ /* 0001 */ V(14, 10, 4),
+ /* 0010 */ V(11, 13, 4),
+ /* 0011 */ V(13, 11, 4),
+ /* 0100 */ V(8, 15, 4),
+ /* 0101 */ V(15, 8, 4),
+ /* 0110 */ V(12, 12, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(14, 9, 4),
+ /* 1001 */ V(7, 15, 4),
+ /* 1010 */ V(15, 7, 4),
+ /* 1011 */ V(10, 13, 4),
+ /* 1100 */ V(13, 10, 4),
+ /* 1101 */ V(11, 12, 4),
+ /* 1110 */ V(6, 15, 4),
+ /* 1111 */ PTR(378, 1),
+
+ /* 0000 0010 ... */
+ /* 0000 */ V(12, 11, 3), /* 152 */
+ /* 0001 */ V(12, 11, 3),
+ /* 0010 */ V(15, 6, 3),
+ /* 0011 */ V(15, 6, 3),
+ /* 0100 */ V(8, 14, 4),
+ /* 0101 */ V(14, 8, 4),
+ /* 0110 */ V(5, 15, 4),
+ /* 0111 */ V(9, 13, 4),
+ /* 1000 */ V(15, 5, 3),
+ /* 1001 */ V(15, 5, 3),
+ /* 1010 */ V(7, 14, 3),
+ /* 1011 */ V(7, 14, 3),
+ /* 1100 */ V(14, 7, 3),
+ /* 1101 */ V(14, 7, 3),
+ /* 1110 */ V(10, 12, 3),
+ /* 1111 */ V(10, 12, 3),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(12, 10, 3), /* 168 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(13, 9, 4),
+ /* 0101 */ V(8, 13, 4),
+ /* 0110 */ V(4, 15, 3),
+ /* 0111 */ V(4, 15, 3),
+ /* 1000 */ V(15, 4, 3),
+ /* 1001 */ V(15, 4, 3),
+ /* 1010 */ V(3, 15, 3),
+ /* 1011 */ V(3, 15, 3),
+ /* 1100 */ V(15, 3, 3),
+ /* 1101 */ V(15, 3, 3),
+ /* 1110 */ V(13, 8, 3),
+ /* 1111 */ V(13, 8, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(14, 6, 3), /* 184 */
+ /* 0001 */ V(14, 6, 3),
+ /* 0010 */ V(2, 15, 3),
+ /* 0011 */ V(2, 15, 3),
+ /* 0100 */ V(15, 2, 3),
+ /* 0101 */ V(15, 2, 3),
+ /* 0110 */ V(6, 14, 4),
+ /* 0111 */ V(15, 0, 4),
+ /* 1000 */ V(1, 15, 3),
+ /* 1001 */ V(1, 15, 3),
+ /* 1010 */ V(15, 1, 3),
+ /* 1011 */ V(15, 1, 3),
+ /* 1100 */ V(9, 12, 3),
+ /* 1101 */ V(9, 12, 3),
+ /* 1110 */ V(12, 9, 3),
+ /* 1111 */ V(12, 9, 3),
+
+ /* 0000 0101 ... */
+ /* 000 */ V(5, 14, 3), /* 200 */
+ /* 001 */ V(10, 11, 3),
+ /* 010 */ V(11, 10, 3),
+ /* 011 */ V(14, 5, 3),
+ /* 100 */ V(7, 13, 3),
+ /* 101 */ V(13, 7, 3),
+ /* 110 */ V(4, 14, 3),
+ /* 111 */ V(14, 4, 3),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(8, 12, 3), /* 208 */
+ /* 001 */ V(12, 8, 3),
+ /* 010 */ V(3, 14, 3),
+ /* 011 */ V(6, 13, 3),
+ /* 100 */ V(13, 6, 3),
+ /* 101 */ V(14, 3, 3),
+ /* 110 */ V(9, 11, 3),
+ /* 111 */ V(11, 9, 3),
+
+ /* 0000 0111 ... */
+ /* 0000 */ V(2, 14, 3), /* 216 */
+ /* 0001 */ V(2, 14, 3),
+ /* 0010 */ V(10, 10, 3),
+ /* 0011 */ V(10, 10, 3),
+ /* 0100 */ V(14, 2, 3),
+ /* 0101 */ V(14, 2, 3),
+ /* 0110 */ V(1, 14, 3),
+ /* 0111 */ V(1, 14, 3),
+ /* 1000 */ V(14, 1, 3),
+ /* 1001 */ V(14, 1, 3),
+ /* 1010 */ V(0, 14, 4),
+ /* 1011 */ V(14, 0, 4),
+ /* 1100 */ V(5, 13, 3),
+ /* 1101 */ V(5, 13, 3),
+ /* 1110 */ V(13, 5, 3),
+ /* 1111 */ V(13, 5, 3),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(7, 12, 3), /* 232 */
+ /* 001 */ V(12, 7, 3),
+ /* 010 */ V(4, 13, 3),
+ /* 011 */ V(8, 11, 3),
+ /* 100 */ V(13, 4, 2),
+ /* 101 */ V(13, 4, 2),
+ /* 110 */ V(11, 8, 3),
+ /* 111 */ V(9, 10, 3),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(10, 9, 3), /* 240 */
+ /* 001 */ V(6, 12, 3),
+ /* 010 */ V(12, 6, 3),
+ /* 011 */ V(3, 13, 3),
+ /* 100 */ V(13, 3, 2),
+ /* 101 */ V(13, 3, 2),
+ /* 110 */ V(13, 2, 2),
+ /* 111 */ V(13, 2, 2),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 13, 3), /* 248 */
+ /* 001 */ V(0, 13, 3),
+ /* 010 */ V(1, 13, 2),
+ /* 011 */ V(1, 13, 2),
+ /* 100 */ V(7, 11, 2),
+ /* 101 */ V(7, 11, 2),
+ /* 110 */ V(11, 7, 2),
+ /* 111 */ V(11, 7, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(13, 1, 2), /* 256 */
+ /* 001 */ V(13, 1, 2),
+ /* 010 */ V(5, 12, 3),
+ /* 011 */ V(13, 0, 3),
+ /* 100 */ V(12, 5, 2),
+ /* 101 */ V(12, 5, 2),
+ /* 110 */ V(8, 10, 2),
+ /* 111 */ V(8, 10, 2),
+
+ /* 0000 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 264 */
+ /* 01 */ V(4, 12, 2),
+ /* 10 */ V(12, 4, 2),
+ /* 11 */ V(6, 11, 2),
+
+ /* 0000 1101 ... */
+ /* 000 */ V(11, 6, 2), /* 268 */
+ /* 001 */ V(11, 6, 2),
+ /* 010 */ V(9, 9, 3),
+ /* 011 */ V(0, 12, 3),
+ /* 100 */ V(3, 12, 2),
+ /* 101 */ V(3, 12, 2),
+ /* 110 */ V(12, 3, 2),
+ /* 111 */ V(12, 3, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 10, 2), /* 276 */
+ /* 001 */ V(7, 10, 2),
+ /* 010 */ V(10, 7, 2),
+ /* 011 */ V(10, 7, 2),
+ /* 100 */ V(10, 6, 2),
+ /* 101 */ V(10, 6, 2),
+ /* 110 */ V(12, 0, 3),
+ /* 111 */ V(0, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 00 */ V(12, 2, 1), /* 284 */
+ /* 01 */ V(12, 2, 1),
+ /* 10 */ V(2, 12, 2),
+ /* 11 */ V(5, 11, 2),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(11, 5, 2), /* 288 */
+ /* 01 */ V(1, 12, 2),
+ /* 10 */ V(8, 9, 2),
+ /* 11 */ V(9, 8, 2),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(12, 1, 2), /* 292 */
+ /* 01 */ V(4, 11, 2),
+ /* 10 */ V(11, 4, 2),
+ /* 11 */ V(6, 10, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(3, 11, 2), /* 296 */
+ /* 01 */ V(7, 9, 2),
+ /* 10 */ V(11, 3, 1),
+ /* 11 */ V(11, 3, 1),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(9, 7, 2), /* 300 */
+ /* 01 */ V(8, 8, 2),
+ /* 10 */ V(2, 11, 2),
+ /* 11 */ V(5, 10, 2),
+
+ /* 0001 0100 ... */
+ /* 00 */ V(11, 2, 1), /* 304 */
+ /* 01 */ V(11, 2, 1),
+ /* 10 */ V(10, 5, 2),
+ /* 11 */ V(1, 11, 2),
+
+ /* 0001 0101 ... */
+ /* 00 */ V(11, 1, 1), /* 308 */
+ /* 01 */ V(11, 1, 1),
+ /* 10 */ V(11, 0, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0001 0110 ... */
+ /* 00 */ V(9, 6, 2), /* 312 */
+ /* 01 */ V(4, 10, 2),
+ /* 10 */ V(10, 4, 2),
+ /* 11 */ V(7, 8, 2),
+
+ /* 0001 0111 ... */
+ /* 00 */ V(8, 7, 2), /* 316 */
+ /* 01 */ V(3, 10, 2),
+ /* 10 */ V(10, 3, 1),
+ /* 11 */ V(10, 3, 1),
+
+ /* 0001 1000 ... */
+ /* 0 */ V(5, 9, 1), /* 320 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(2, 10, 1), /* 322 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(1, 10, 1), /* 324 */
+ /* 1 */ V(10, 1, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(0, 10, 2), /* 326 */
+ /* 01 */ V(10, 0, 2),
+ /* 10 */ V(6, 8, 1),
+ /* 11 */ V(6, 8, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(8, 6, 1), /* 330 */
+ /* 1 */ V(4, 9, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(9, 4, 1), /* 332 */
+ /* 1 */ V(3, 9, 1),
+
+ /* 0001 1110 ... */
+ /* 00 */ V(9, 3, 1), /* 334 */
+ /* 01 */ V(9, 3, 1),
+ /* 10 */ V(7, 7, 2),
+ /* 11 */ V(0, 9, 2),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(5, 8, 1), /* 338 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(2, 9, 1), /* 340 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(7, 6, 1), /* 342 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0010 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 344 */
+ /* 1 */ V(9, 0, 1),
+
+ /* 0010 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 346 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 348 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0010 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 350 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0010 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 352 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0010 1100 ... */
+ /* 0 */ V(7, 4, 1), /* 354 */
+ /* 1 */ V(0, 8, 1),
+
+ /* 0010 1101 ... */
+ /* 0 */ V(8, 0, 1), /* 356 */
+ /* 1 */ V(5, 6, 1),
+
+ /* 0010 1110 ... */
+ /* 0 */ V(6, 5, 1), /* 358 */
+ /* 1 */ V(3, 7, 1),
+
+ /* 0010 1111 ... */
+ /* 0 */ V(7, 3, 1), /* 360 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0011 0110 ... */
+ /* 0 */ V(0, 7, 1), /* 362 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0011 1110 ... */
+ /* 0 */ V(0, 6, 1), /* 364 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0 */ V(15, 15, 1), /* 366 */
+ /* 1 */ V(14, 15, 1),
+
+ /* 0000 0000 0001 ... */
+ /* 0 */ V(15, 14, 1), /* 368 */
+ /* 1 */ V(13, 15, 1),
+
+ /* 0000 0000 0011 ... */
+ /* 0 */ V(15, 13, 1), /* 370 */
+ /* 1 */ V(12, 15, 1),
+
+ /* 0000 0000 0100 ... */
+ /* 0 */ V(15, 12, 1), /* 372 */
+ /* 1 */ V(13, 14, 1),
+
+ /* 0000 0000 0101 ... */
+ /* 0 */ V(14, 13, 1), /* 374 */
+ /* 1 */ V(11, 15, 1),
+
+ /* 0000 0000 0111 ... */
+ /* 0 */ V(12, 14, 1), /* 376 */
+ /* 1 */ V(14, 12, 1),
+
+ /* 0000 0001 1111 ... */
+ /* 0 */ V(10, 14, 1), /* 378 */
+ /* 1 */ V(0, 15, 1)
};
static
-union huffpair const hufftab16[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 3), /* 16 */
- /* 0001 */ PTR(76, 3),
- /* 0010 */ PTR(84, 2),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(88, 2),
- /* 0101 */ PTR(92, 1),
- /* 0110 */ PTR(94, 4),
- /* 0111 */ V(15, 2, 4),
- /* 1000 */ PTR(110, 1),
- /* 1001 */ V(1, 15, 4),
- /* 1010 */ V(15, 1, 4),
- /* 1011 */ PTR(112, 4),
- /* 1100 */ PTR(128, 4),
- /* 1101 */ PTR(144, 4),
- /* 1110 */ PTR(160, 4),
- /* 1111 */ PTR(176, 4),
-
- /* 0001 ... */
- /* 0000 */ PTR(192, 4), /* 32 */
- /* 0001 */ PTR(208, 3),
- /* 0010 */ PTR(216, 3),
- /* 0011 */ PTR(224, 3),
- /* 0100 */ PTR(232, 3),
- /* 0101 */ PTR(240, 3),
- /* 0110 */ PTR(248, 3),
- /* 0111 */ PTR(256, 3),
- /* 1000 */ PTR(264, 2),
- /* 1001 */ PTR(268, 2),
- /* 1010 */ PTR(272, 1),
- /* 1011 */ PTR(274, 2),
- /* 1100 */ PTR(278, 2),
- /* 1101 */ PTR(282, 1),
- /* 1110 */ V(5, 1, 4),
- /* 1111 */ PTR(284, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(286, 1), /* 48 */
- /* 0001 */ PTR(288, 1),
- /* 0010 */ PTR(290, 1),
- /* 0011 */ V(1, 4, 4),
- /* 0100 */ V(4, 1, 4),
- /* 0101 */ PTR(292, 1),
- /* 0110 */ V(2, 3, 4),
- /* 0111 */ V(3, 2, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(0, 3, 4),
- /* 1101 */ V(3, 0, 4),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(14, 15, 3), /* 68 */
- /* 001 */ V(15, 14, 3),
- /* 010 */ V(13, 15, 3),
- /* 011 */ V(15, 13, 3),
- /* 100 */ V(12, 15, 3),
- /* 101 */ V(15, 12, 3),
- /* 110 */ V(11, 15, 3),
- /* 111 */ V(15, 11, 3),
-
- /* 0000 0001 ... */
- /* 000 */ V(10, 15, 2), /* 76 */
- /* 001 */ V(10, 15, 2),
- /* 010 */ V(15, 10, 3),
- /* 011 */ V(9, 15, 3),
- /* 100 */ V(15, 9, 3),
- /* 101 */ V(15, 8, 3),
- /* 110 */ V(8, 15, 2),
- /* 111 */ V(8, 15, 2),
-
- /* 0000 0010 ... */
- /* 00 */ V(7, 15, 2), /* 84 */
- /* 01 */ V(15, 7, 2),
- /* 10 */ V(6, 15, 2),
- /* 11 */ V(15, 6, 2),
-
- /* 0000 0100 ... */
- /* 00 */ V(5, 15, 2), /* 88 */
- /* 01 */ V(15, 5, 2),
- /* 10 */ V(4, 15, 1),
- /* 11 */ V(4, 15, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(15, 4, 1), /* 92 */
- /* 1 */ V(15, 3, 1),
-
- /* 0000 0110 ... */
- /* 0000 */ V(15, 0, 1), /* 94 */
- /* 0001 */ V(15, 0, 1),
- /* 0010 */ V(15, 0, 1),
- /* 0011 */ V(15, 0, 1),
- /* 0100 */ V(15, 0, 1),
- /* 0101 */ V(15, 0, 1),
- /* 0110 */ V(15, 0, 1),
- /* 0111 */ V(15, 0, 1),
- /* 1000 */ V(3, 15, 2),
- /* 1001 */ V(3, 15, 2),
- /* 1010 */ V(3, 15, 2),
- /* 1011 */ V(3, 15, 2),
- /* 1100 */ PTR(294, 4),
- /* 1101 */ PTR(310, 3),
- /* 1110 */ PTR(318, 3),
- /* 1111 */ PTR(326, 3),
-
- /* 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 110 */
- /* 1 */ V(0, 15, 1),
-
- /* 0000 1011 ... */
- /* 0000 */ PTR(334, 2), /* 112 */
- /* 0001 */ PTR(338, 2),
- /* 0010 */ PTR(342, 2),
- /* 0011 */ PTR(346, 1),
- /* 0100 */ PTR(348, 2),
- /* 0101 */ PTR(352, 2),
- /* 0110 */ PTR(356, 1),
- /* 0111 */ PTR(358, 2),
- /* 1000 */ PTR(362, 2),
- /* 1001 */ PTR(366, 2),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ V(14, 3, 4),
- /* 1100 */ PTR(374, 1),
- /* 1101 */ PTR(376, 1),
- /* 1110 */ PTR(378, 1),
- /* 1111 */ PTR(380, 1),
-
- /* 0000 1100 ... */
- /* 0000 */ PTR(382, 1), /* 128 */
- /* 0001 */ PTR(384, 1),
- /* 0010 */ PTR(386, 1),
- /* 0011 */ V(0, 13, 4),
- /* 0100 */ PTR(388, 1),
- /* 0101 */ PTR(390, 1),
- /* 0110 */ PTR(392, 1),
- /* 0111 */ V(3, 12, 4),
- /* 1000 */ PTR(394, 1),
- /* 1001 */ V(1, 12, 4),
- /* 1010 */ V(12, 0, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 2, 3),
- /* 1101 */ V(14, 2, 3),
- /* 1110 */ V(2, 14, 4),
- /* 1111 */ V(1, 14, 4),
-
- /* 0000 1101 ... */
- /* 0000 */ V(13, 3, 4), /* 144 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(13, 1, 4),
- /* 0100 */ V(3, 11, 4),
- /* 0101 */ PTR(398, 1),
- /* 0110 */ V(1, 13, 3),
- /* 0111 */ V(1, 13, 3),
- /* 1000 */ V(12, 4, 4),
- /* 1001 */ V(6, 11, 4),
- /* 1010 */ V(12, 3, 4),
- /* 1011 */ V(10, 7, 4),
- /* 1100 */ V(2, 12, 3),
- /* 1101 */ V(2, 12, 3),
- /* 1110 */ V(12, 2, 4),
- /* 1111 */ V(11, 5, 4),
-
- /* 0000 1110 ... */
- /* 0000 */ V(12, 1, 4), /* 160 */
- /* 0001 */ V(0, 12, 4),
- /* 0010 */ V(4, 11, 4),
- /* 0011 */ V(11, 4, 4),
- /* 0100 */ V(6, 10, 4),
- /* 0101 */ V(10, 6, 4),
- /* 0110 */ V(11, 3, 3),
- /* 0111 */ V(11, 3, 3),
- /* 1000 */ V(5, 10, 4),
- /* 1001 */ V(10, 5, 4),
- /* 1010 */ V(2, 11, 3),
- /* 1011 */ V(2, 11, 3),
- /* 1100 */ V(11, 2, 3),
- /* 1101 */ V(11, 2, 3),
- /* 1110 */ V(1, 11, 3),
- /* 1111 */ V(1, 11, 3),
-
- /* 0000 1111 ... */
- /* 0000 */ V(11, 1, 3), /* 176 */
- /* 0001 */ V(11, 1, 3),
- /* 0010 */ V(0, 11, 4),
- /* 0011 */ V(11, 0, 4),
- /* 0100 */ V(6, 9, 4),
- /* 0101 */ V(9, 6, 4),
- /* 0110 */ V(4, 10, 4),
- /* 0111 */ V(10, 4, 4),
- /* 1000 */ V(7, 8, 4),
- /* 1001 */ V(8, 7, 4),
- /* 1010 */ V(10, 3, 3),
- /* 1011 */ V(10, 3, 3),
- /* 1100 */ V(3, 10, 4),
- /* 1101 */ V(5, 9, 4),
- /* 1110 */ V(2, 10, 3),
- /* 1111 */ V(2, 10, 3),
-
- /* 0001 0000 ... */
- /* 0000 */ V(9, 5, 4), /* 192 */
- /* 0001 */ V(6, 8, 4),
- /* 0010 */ V(10, 1, 3),
- /* 0011 */ V(10, 1, 3),
- /* 0100 */ V(8, 6, 4),
- /* 0101 */ V(7, 7, 4),
- /* 0110 */ V(9, 4, 3),
- /* 0111 */ V(9, 4, 3),
- /* 1000 */ V(4, 9, 4),
- /* 1001 */ V(5, 7, 4),
- /* 1010 */ V(6, 7, 3),
- /* 1011 */ V(6, 7, 3),
- /* 1100 */ V(10, 2, 2),
- /* 1101 */ V(10, 2, 2),
- /* 1110 */ V(10, 2, 2),
- /* 1111 */ V(10, 2, 2),
-
- /* 0001 0001 ... */
- /* 000 */ V(1, 10, 2), /* 208 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(0, 10, 3),
- /* 011 */ V(10, 0, 3),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(9, 3, 3),
- /* 110 */ V(5, 8, 3),
- /* 111 */ V(8, 5, 3),
-
- /* 0001 0010 ... */
- /* 000 */ V(2, 9, 2), /* 216 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(7, 6, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(1, 9, 2),
- /* 111 */ V(1, 9, 2),
-
- /* 0001 0011 ... */
- /* 000 */ V(9, 1, 2), /* 224 */
- /* 001 */ V(9, 1, 2),
- /* 010 */ V(9, 0, 3),
- /* 011 */ V(4, 8, 3),
- /* 100 */ V(8, 4, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 3),
- /* 111 */ V(8, 3, 3),
-
- /* 0001 0100 ... */
- /* 000 */ V(6, 6, 3), /* 232 */
- /* 001 */ V(2, 8, 3),
- /* 010 */ V(8, 2, 2),
- /* 011 */ V(8, 2, 2),
- /* 100 */ V(4, 7, 3),
- /* 101 */ V(7, 4, 3),
- /* 110 */ V(1, 8, 2),
- /* 111 */ V(1, 8, 2),
-
- /* 0001 0101 ... */
- /* 000 */ V(8, 1, 2), /* 240 */
- /* 001 */ V(8, 1, 2),
- /* 010 */ V(8, 0, 2),
- /* 011 */ V(8, 0, 2),
- /* 100 */ V(0, 8, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(3, 7, 2),
- /* 111 */ V(3, 7, 2),
-
- /* 0001 0110 ... */
- /* 000 */ V(7, 3, 2), /* 248 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(6, 5, 3),
- /* 011 */ V(4, 6, 3),
- /* 100 */ V(2, 7, 2),
- /* 101 */ V(2, 7, 2),
- /* 110 */ V(7, 2, 2),
- /* 111 */ V(7, 2, 2),
-
- /* 0001 0111 ... */
- /* 000 */ V(6, 4, 3), /* 256 */
- /* 001 */ V(5, 5, 3),
- /* 010 */ V(0, 7, 2),
- /* 011 */ V(0, 7, 2),
- /* 100 */ V(1, 7, 1),
- /* 101 */ V(1, 7, 1),
- /* 110 */ V(1, 7, 1),
- /* 111 */ V(1, 7, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(7, 1, 1), /* 264 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(7, 0, 2),
- /* 11 */ V(3, 6, 2),
-
- /* 0001 1001 ... */
- /* 00 */ V(6, 3, 2), /* 268 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(2, 6, 2),
-
- /* 0001 1010 ... */
- /* 0 */ V(6, 2, 1), /* 272 */
- /* 1 */ V(1, 6, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(6, 1, 1), /* 274 */
- /* 01 */ V(6, 1, 1),
- /* 10 */ V(0, 6, 2),
- /* 11 */ V(6, 0, 2),
-
- /* 0001 1100 ... */
- /* 00 */ V(5, 3, 1), /* 278 */
- /* 01 */ V(5, 3, 1),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0001 1101 ... */
- /* 0 */ V(2, 5, 1), /* 282 */
- /* 1 */ V(5, 2, 1),
-
- /* 0001 1111 ... */
- /* 0 */ V(1, 5, 1), /* 284 */
- /* 1 */ V(0, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(3, 4, 1), /* 286 */
- /* 1 */ V(4, 3, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(5, 0, 1), /* 288 */
- /* 1 */ V(2, 4, 1),
-
- /* 0010 0010 ... */
- /* 0 */ V(4, 2, 1), /* 290 */
- /* 1 */ V(3, 3, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(0, 4, 1), /* 292 */
- /* 1 */ V(4, 0, 1),
-
- /* 0000 0110 1100 ... */
- /* 0000 */ V(12, 14, 4), /* 294 */
- /* 0001 */ PTR(400, 1),
- /* 0010 */ V(13, 14, 3),
- /* 0011 */ V(13, 14, 3),
- /* 0100 */ V(14, 9, 3),
- /* 0101 */ V(14, 9, 3),
- /* 0110 */ V(14, 10, 4),
- /* 0111 */ V(13, 9, 4),
- /* 1000 */ V(14, 14, 2),
- /* 1001 */ V(14, 14, 2),
- /* 1010 */ V(14, 14, 2),
- /* 1011 */ V(14, 14, 2),
- /* 1100 */ V(14, 13, 3),
- /* 1101 */ V(14, 13, 3),
- /* 1110 */ V(14, 11, 3),
- /* 1111 */ V(14, 11, 3),
-
- /* 0000 0110 1101 ... */
- /* 000 */ V(11, 14, 2), /* 310 */
- /* 001 */ V(11, 14, 2),
- /* 010 */ V(12, 13, 2),
- /* 011 */ V(12, 13, 2),
- /* 100 */ V(13, 12, 3),
- /* 101 */ V(13, 11, 3),
- /* 110 */ V(10, 14, 2),
- /* 111 */ V(10, 14, 2),
-
- /* 0000 0110 1110 ... */
- /* 000 */ V(12, 12, 2), /* 318 */
- /* 001 */ V(12, 12, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(13, 10, 3),
- /* 100 */ V(7, 14, 3),
- /* 101 */ V(10, 12, 3),
- /* 110 */ V(12, 10, 2),
- /* 111 */ V(12, 10, 2),
-
- /* 0000 0110 1111 ... */
- /* 000 */ V(12, 9, 3), /* 326 */
- /* 001 */ V(7, 13, 3),
- /* 010 */ V(5, 14, 2),
- /* 011 */ V(5, 14, 2),
- /* 100 */ V(11, 13, 1),
- /* 101 */ V(11, 13, 1),
- /* 110 */ V(11, 13, 1),
- /* 111 */ V(11, 13, 1),
-
- /* 0000 1011 0000 ... */
- /* 00 */ V(9, 14, 1), /* 334 */
- /* 01 */ V(9, 14, 1),
- /* 10 */ V(11, 12, 2),
- /* 11 */ V(12, 11, 2),
-
- /* 0000 1011 0001 ... */
- /* 00 */ V(8, 14, 2), /* 338 */
- /* 01 */ V(14, 8, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(14, 7, 2),
-
- /* 0000 1011 0010 ... */
- /* 00 */ V(11, 11, 2), /* 342 */
- /* 01 */ V(8, 13, 2),
- /* 10 */ V(13, 8, 2),
- /* 11 */ V(6, 14, 2),
-
- /* 0000 1011 0011 ... */
- /* 0 */ V(14, 6, 1), /* 346 */
- /* 1 */ V(9, 12, 1),
-
- /* 0000 1011 0100 ... */
- /* 00 */ V(10, 11, 2), /* 348 */
- /* 01 */ V(11, 10, 2),
- /* 10 */ V(14, 5, 2),
- /* 11 */ V(13, 7, 2),
-
- /* 0000 1011 0101 ... */
- /* 00 */ V(4, 14, 1), /* 352 */
- /* 01 */ V(4, 14, 1),
- /* 10 */ V(14, 4, 2),
- /* 11 */ V(8, 12, 2),
-
- /* 0000 1011 0110 ... */
- /* 0 */ V(12, 8, 1), /* 356 */
- /* 1 */ V(3, 14, 1),
-
- /* 0000 1011 0111 ... */
- /* 00 */ V(6, 13, 1), /* 358 */
- /* 01 */ V(6, 13, 1),
- /* 10 */ V(13, 6, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0000 1011 1000 ... */
- /* 00 */ V(11, 9, 2), /* 362 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 1, 1),
- /* 11 */ V(14, 1, 1),
-
- /* 0000 1011 1001 ... */
- /* 00 */ V(13, 4, 1), /* 366 */
- /* 01 */ V(13, 4, 1),
- /* 10 */ V(11, 8, 2),
- /* 11 */ V(10, 9, 2),
-
- /* 0000 1011 1010 ... */
- /* 00 */ V(7, 11, 1), /* 370 */
- /* 01 */ V(7, 11, 1),
- /* 10 */ V(11, 7, 2),
- /* 11 */ V(13, 0, 2),
-
- /* 0000 1011 1100 ... */
- /* 0 */ V(0, 14, 1), /* 374 */
- /* 1 */ V(14, 0, 1),
-
- /* 0000 1011 1101 ... */
- /* 0 */ V(5, 13, 1), /* 376 */
- /* 1 */ V(13, 5, 1),
-
- /* 0000 1011 1110 ... */
- /* 0 */ V(7, 12, 1), /* 378 */
- /* 1 */ V(12, 7, 1),
-
- /* 0000 1011 1111 ... */
- /* 0 */ V(4, 13, 1), /* 380 */
- /* 1 */ V(8, 11, 1),
-
- /* 0000 1100 0000 ... */
- /* 0 */ V(9, 10, 1), /* 382 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 1100 0001 ... */
- /* 0 */ V(12, 6, 1), /* 384 */
- /* 1 */ V(3, 13, 1),
-
- /* 0000 1100 0010 ... */
- /* 0 */ V(5, 12, 1), /* 386 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 1100 0100 ... */
- /* 0 */ V(8, 10, 1), /* 388 */
- /* 1 */ V(10, 8, 1),
-
- /* 0000 1100 0101 ... */
- /* 0 */ V(9, 9, 1), /* 390 */
- /* 1 */ V(4, 12, 1),
-
- /* 0000 1100 0110 ... */
- /* 0 */ V(11, 6, 1), /* 392 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 1100 1000 ... */
- /* 0 */ V(5, 11, 1), /* 394 */
- /* 1 */ V(8, 9, 1),
-
- /* 0000 1100 1011 ... */
- /* 0 */ V(9, 8, 1), /* 396 */
- /* 1 */ V(7, 9, 1),
-
- /* 0000 1101 0101 ... */
- /* 0 */ V(9, 7, 1), /* 398 */
- /* 1 */ V(8, 8, 1),
-
- /* 0000 0110 1100 0001 ... */
- /* 0 */ V(14, 12, 1), /* 400 */
- /* 1 */ V(13, 13, 1)
+union huffpair const hufftab16[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 3), /* 16 */
+ /* 0001 */ PTR(76, 3),
+ /* 0010 */ PTR(84, 2),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(88, 2),
+ /* 0101 */ PTR(92, 1),
+ /* 0110 */ PTR(94, 4),
+ /* 0111 */ V(15, 2, 4),
+ /* 1000 */ PTR(110, 1),
+ /* 1001 */ V(1, 15, 4),
+ /* 1010 */ V(15, 1, 4),
+ /* 1011 */ PTR(112, 4),
+ /* 1100 */ PTR(128, 4),
+ /* 1101 */ PTR(144, 4),
+ /* 1110 */ PTR(160, 4),
+ /* 1111 */ PTR(176, 4),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(192, 4), /* 32 */
+ /* 0001 */ PTR(208, 3),
+ /* 0010 */ PTR(216, 3),
+ /* 0011 */ PTR(224, 3),
+ /* 0100 */ PTR(232, 3),
+ /* 0101 */ PTR(240, 3),
+ /* 0110 */ PTR(248, 3),
+ /* 0111 */ PTR(256, 3),
+ /* 1000 */ PTR(264, 2),
+ /* 1001 */ PTR(268, 2),
+ /* 1010 */ PTR(272, 1),
+ /* 1011 */ PTR(274, 2),
+ /* 1100 */ PTR(278, 2),
+ /* 1101 */ PTR(282, 1),
+ /* 1110 */ V(5, 1, 4),
+ /* 1111 */ PTR(284, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(286, 1), /* 48 */
+ /* 0001 */ PTR(288, 1),
+ /* 0010 */ PTR(290, 1),
+ /* 0011 */ V(1, 4, 4),
+ /* 0100 */ V(4, 1, 4),
+ /* 0101 */ PTR(292, 1),
+ /* 0110 */ V(2, 3, 4),
+ /* 0111 */ V(3, 2, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(0, 3, 4),
+ /* 1101 */ V(3, 0, 4),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(14, 15, 3), /* 68 */
+ /* 001 */ V(15, 14, 3),
+ /* 010 */ V(13, 15, 3),
+ /* 011 */ V(15, 13, 3),
+ /* 100 */ V(12, 15, 3),
+ /* 101 */ V(15, 12, 3),
+ /* 110 */ V(11, 15, 3),
+ /* 111 */ V(15, 11, 3),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(10, 15, 2), /* 76 */
+ /* 001 */ V(10, 15, 2),
+ /* 010 */ V(15, 10, 3),
+ /* 011 */ V(9, 15, 3),
+ /* 100 */ V(15, 9, 3),
+ /* 101 */ V(15, 8, 3),
+ /* 110 */ V(8, 15, 2),
+ /* 111 */ V(8, 15, 2),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(7, 15, 2), /* 84 */
+ /* 01 */ V(15, 7, 2),
+ /* 10 */ V(6, 15, 2),
+ /* 11 */ V(15, 6, 2),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(5, 15, 2), /* 88 */
+ /* 01 */ V(15, 5, 2),
+ /* 10 */ V(4, 15, 1),
+ /* 11 */ V(4, 15, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(15, 4, 1), /* 92 */
+ /* 1 */ V(15, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0000 */ V(15, 0, 1), /* 94 */
+ /* 0001 */ V(15, 0, 1),
+ /* 0010 */ V(15, 0, 1),
+ /* 0011 */ V(15, 0, 1),
+ /* 0100 */ V(15, 0, 1),
+ /* 0101 */ V(15, 0, 1),
+ /* 0110 */ V(15, 0, 1),
+ /* 0111 */ V(15, 0, 1),
+ /* 1000 */ V(3, 15, 2),
+ /* 1001 */ V(3, 15, 2),
+ /* 1010 */ V(3, 15, 2),
+ /* 1011 */ V(3, 15, 2),
+ /* 1100 */ PTR(294, 4),
+ /* 1101 */ PTR(310, 3),
+ /* 1110 */ PTR(318, 3),
+ /* 1111 */ PTR(326, 3),
+
+ /* 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 110 */
+ /* 1 */ V(0, 15, 1),
+
+ /* 0000 1011 ... */
+ /* 0000 */ PTR(334, 2), /* 112 */
+ /* 0001 */ PTR(338, 2),
+ /* 0010 */ PTR(342, 2),
+ /* 0011 */ PTR(346, 1),
+ /* 0100 */ PTR(348, 2),
+ /* 0101 */ PTR(352, 2),
+ /* 0110 */ PTR(356, 1),
+ /* 0111 */ PTR(358, 2),
+ /* 1000 */ PTR(362, 2),
+ /* 1001 */ PTR(366, 2),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ V(14, 3, 4),
+ /* 1100 */ PTR(374, 1),
+ /* 1101 */ PTR(376, 1),
+ /* 1110 */ PTR(378, 1),
+ /* 1111 */ PTR(380, 1),
+
+ /* 0000 1100 ... */
+ /* 0000 */ PTR(382, 1), /* 128 */
+ /* 0001 */ PTR(384, 1),
+ /* 0010 */ PTR(386, 1),
+ /* 0011 */ V(0, 13, 4),
+ /* 0100 */ PTR(388, 1),
+ /* 0101 */ PTR(390, 1),
+ /* 0110 */ PTR(392, 1),
+ /* 0111 */ V(3, 12, 4),
+ /* 1000 */ PTR(394, 1),
+ /* 1001 */ V(1, 12, 4),
+ /* 1010 */ V(12, 0, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 2, 3),
+ /* 1101 */ V(14, 2, 3),
+ /* 1110 */ V(2, 14, 4),
+ /* 1111 */ V(1, 14, 4),
+
+ /* 0000 1101 ... */
+ /* 0000 */ V(13, 3, 4), /* 144 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(13, 1, 4),
+ /* 0100 */ V(3, 11, 4),
+ /* 0101 */ PTR(398, 1),
+ /* 0110 */ V(1, 13, 3),
+ /* 0111 */ V(1, 13, 3),
+ /* 1000 */ V(12, 4, 4),
+ /* 1001 */ V(6, 11, 4),
+ /* 1010 */ V(12, 3, 4),
+ /* 1011 */ V(10, 7, 4),
+ /* 1100 */ V(2, 12, 3),
+ /* 1101 */ V(2, 12, 3),
+ /* 1110 */ V(12, 2, 4),
+ /* 1111 */ V(11, 5, 4),
+
+ /* 0000 1110 ... */
+ /* 0000 */ V(12, 1, 4), /* 160 */
+ /* 0001 */ V(0, 12, 4),
+ /* 0010 */ V(4, 11, 4),
+ /* 0011 */ V(11, 4, 4),
+ /* 0100 */ V(6, 10, 4),
+ /* 0101 */ V(10, 6, 4),
+ /* 0110 */ V(11, 3, 3),
+ /* 0111 */ V(11, 3, 3),
+ /* 1000 */ V(5, 10, 4),
+ /* 1001 */ V(10, 5, 4),
+ /* 1010 */ V(2, 11, 3),
+ /* 1011 */ V(2, 11, 3),
+ /* 1100 */ V(11, 2, 3),
+ /* 1101 */ V(11, 2, 3),
+ /* 1110 */ V(1, 11, 3),
+ /* 1111 */ V(1, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 0000 */ V(11, 1, 3), /* 176 */
+ /* 0001 */ V(11, 1, 3),
+ /* 0010 */ V(0, 11, 4),
+ /* 0011 */ V(11, 0, 4),
+ /* 0100 */ V(6, 9, 4),
+ /* 0101 */ V(9, 6, 4),
+ /* 0110 */ V(4, 10, 4),
+ /* 0111 */ V(10, 4, 4),
+ /* 1000 */ V(7, 8, 4),
+ /* 1001 */ V(8, 7, 4),
+ /* 1010 */ V(10, 3, 3),
+ /* 1011 */ V(10, 3, 3),
+ /* 1100 */ V(3, 10, 4),
+ /* 1101 */ V(5, 9, 4),
+ /* 1110 */ V(2, 10, 3),
+ /* 1111 */ V(2, 10, 3),
+
+ /* 0001 0000 ... */
+ /* 0000 */ V(9, 5, 4), /* 192 */
+ /* 0001 */ V(6, 8, 4),
+ /* 0010 */ V(10, 1, 3),
+ /* 0011 */ V(10, 1, 3),
+ /* 0100 */ V(8, 6, 4),
+ /* 0101 */ V(7, 7, 4),
+ /* 0110 */ V(9, 4, 3),
+ /* 0111 */ V(9, 4, 3),
+ /* 1000 */ V(4, 9, 4),
+ /* 1001 */ V(5, 7, 4),
+ /* 1010 */ V(6, 7, 3),
+ /* 1011 */ V(6, 7, 3),
+ /* 1100 */ V(10, 2, 2),
+ /* 1101 */ V(10, 2, 2),
+ /* 1110 */ V(10, 2, 2),
+ /* 1111 */ V(10, 2, 2),
+
+ /* 0001 0001 ... */
+ /* 000 */ V(1, 10, 2), /* 208 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(0, 10, 3),
+ /* 011 */ V(10, 0, 3),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(9, 3, 3),
+ /* 110 */ V(5, 8, 3),
+ /* 111 */ V(8, 5, 3),
+
+ /* 0001 0010 ... */
+ /* 000 */ V(2, 9, 2), /* 216 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(7, 6, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(1, 9, 2),
+ /* 111 */ V(1, 9, 2),
+
+ /* 0001 0011 ... */
+ /* 000 */ V(9, 1, 2), /* 224 */
+ /* 001 */ V(9, 1, 2),
+ /* 010 */ V(9, 0, 3),
+ /* 011 */ V(4, 8, 3),
+ /* 100 */ V(8, 4, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 3),
+ /* 111 */ V(8, 3, 3),
+
+ /* 0001 0100 ... */
+ /* 000 */ V(6, 6, 3), /* 232 */
+ /* 001 */ V(2, 8, 3),
+ /* 010 */ V(8, 2, 2),
+ /* 011 */ V(8, 2, 2),
+ /* 100 */ V(4, 7, 3),
+ /* 101 */ V(7, 4, 3),
+ /* 110 */ V(1, 8, 2),
+ /* 111 */ V(1, 8, 2),
+
+ /* 0001 0101 ... */
+ /* 000 */ V(8, 1, 2), /* 240 */
+ /* 001 */ V(8, 1, 2),
+ /* 010 */ V(8, 0, 2),
+ /* 011 */ V(8, 0, 2),
+ /* 100 */ V(0, 8, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(3, 7, 2),
+ /* 111 */ V(3, 7, 2),
+
+ /* 0001 0110 ... */
+ /* 000 */ V(7, 3, 2), /* 248 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(6, 5, 3),
+ /* 011 */ V(4, 6, 3),
+ /* 100 */ V(2, 7, 2),
+ /* 101 */ V(2, 7, 2),
+ /* 110 */ V(7, 2, 2),
+ /* 111 */ V(7, 2, 2),
+
+ /* 0001 0111 ... */
+ /* 000 */ V(6, 4, 3), /* 256 */
+ /* 001 */ V(5, 5, 3),
+ /* 010 */ V(0, 7, 2),
+ /* 011 */ V(0, 7, 2),
+ /* 100 */ V(1, 7, 1),
+ /* 101 */ V(1, 7, 1),
+ /* 110 */ V(1, 7, 1),
+ /* 111 */ V(1, 7, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(7, 1, 1), /* 264 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(7, 0, 2),
+ /* 11 */ V(3, 6, 2),
+
+ /* 0001 1001 ... */
+ /* 00 */ V(6, 3, 2), /* 268 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(2, 6, 2),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(6, 2, 1), /* 272 */
+ /* 1 */ V(1, 6, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(6, 1, 1), /* 274 */
+ /* 01 */ V(6, 1, 1),
+ /* 10 */ V(0, 6, 2),
+ /* 11 */ V(6, 0, 2),
+
+ /* 0001 1100 ... */
+ /* 00 */ V(5, 3, 1), /* 278 */
+ /* 01 */ V(5, 3, 1),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(2, 5, 1), /* 282 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(1, 5, 1), /* 284 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(3, 4, 1), /* 286 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(5, 0, 1), /* 288 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0010 0010 ... */
+ /* 0 */ V(4, 2, 1), /* 290 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(0, 4, 1), /* 292 */
+ /* 1 */ V(4, 0, 1),
+
+ /* 0000 0110 1100 ... */
+ /* 0000 */ V(12, 14, 4), /* 294 */
+ /* 0001 */ PTR(400, 1),
+ /* 0010 */ V(13, 14, 3),
+ /* 0011 */ V(13, 14, 3),
+ /* 0100 */ V(14, 9, 3),
+ /* 0101 */ V(14, 9, 3),
+ /* 0110 */ V(14, 10, 4),
+ /* 0111 */ V(13, 9, 4),
+ /* 1000 */ V(14, 14, 2),
+ /* 1001 */ V(14, 14, 2),
+ /* 1010 */ V(14, 14, 2),
+ /* 1011 */ V(14, 14, 2),
+ /* 1100 */ V(14, 13, 3),
+ /* 1101 */ V(14, 13, 3),
+ /* 1110 */ V(14, 11, 3),
+ /* 1111 */ V(14, 11, 3),
+
+ /* 0000 0110 1101 ... */
+ /* 000 */ V(11, 14, 2), /* 310 */
+ /* 001 */ V(11, 14, 2),
+ /* 010 */ V(12, 13, 2),
+ /* 011 */ V(12, 13, 2),
+ /* 100 */ V(13, 12, 3),
+ /* 101 */ V(13, 11, 3),
+ /* 110 */ V(10, 14, 2),
+ /* 111 */ V(10, 14, 2),
+
+ /* 0000 0110 1110 ... */
+ /* 000 */ V(12, 12, 2), /* 318 */
+ /* 001 */ V(12, 12, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(13, 10, 3),
+ /* 100 */ V(7, 14, 3),
+ /* 101 */ V(10, 12, 3),
+ /* 110 */ V(12, 10, 2),
+ /* 111 */ V(12, 10, 2),
+
+ /* 0000 0110 1111 ... */
+ /* 000 */ V(12, 9, 3), /* 326 */
+ /* 001 */ V(7, 13, 3),
+ /* 010 */ V(5, 14, 2),
+ /* 011 */ V(5, 14, 2),
+ /* 100 */ V(11, 13, 1),
+ /* 101 */ V(11, 13, 1),
+ /* 110 */ V(11, 13, 1),
+ /* 111 */ V(11, 13, 1),
+
+ /* 0000 1011 0000 ... */
+ /* 00 */ V(9, 14, 1), /* 334 */
+ /* 01 */ V(9, 14, 1),
+ /* 10 */ V(11, 12, 2),
+ /* 11 */ V(12, 11, 2),
+
+ /* 0000 1011 0001 ... */
+ /* 00 */ V(8, 14, 2), /* 338 */
+ /* 01 */ V(14, 8, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(14, 7, 2),
+
+ /* 0000 1011 0010 ... */
+ /* 00 */ V(11, 11, 2), /* 342 */
+ /* 01 */ V(8, 13, 2),
+ /* 10 */ V(13, 8, 2),
+ /* 11 */ V(6, 14, 2),
+
+ /* 0000 1011 0011 ... */
+ /* 0 */ V(14, 6, 1), /* 346 */
+ /* 1 */ V(9, 12, 1),
+
+ /* 0000 1011 0100 ... */
+ /* 00 */ V(10, 11, 2), /* 348 */
+ /* 01 */ V(11, 10, 2),
+ /* 10 */ V(14, 5, 2),
+ /* 11 */ V(13, 7, 2),
+
+ /* 0000 1011 0101 ... */
+ /* 00 */ V(4, 14, 1), /* 352 */
+ /* 01 */ V(4, 14, 1),
+ /* 10 */ V(14, 4, 2),
+ /* 11 */ V(8, 12, 2),
+
+ /* 0000 1011 0110 ... */
+ /* 0 */ V(12, 8, 1), /* 356 */
+ /* 1 */ V(3, 14, 1),
+
+ /* 0000 1011 0111 ... */
+ /* 00 */ V(6, 13, 1), /* 358 */
+ /* 01 */ V(6, 13, 1),
+ /* 10 */ V(13, 6, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0000 1011 1000 ... */
+ /* 00 */ V(11, 9, 2), /* 362 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 1, 1),
+ /* 11 */ V(14, 1, 1),
+
+ /* 0000 1011 1001 ... */
+ /* 00 */ V(13, 4, 1), /* 366 */
+ /* 01 */ V(13, 4, 1),
+ /* 10 */ V(11, 8, 2),
+ /* 11 */ V(10, 9, 2),
+
+ /* 0000 1011 1010 ... */
+ /* 00 */ V(7, 11, 1), /* 370 */
+ /* 01 */ V(7, 11, 1),
+ /* 10 */ V(11, 7, 2),
+ /* 11 */ V(13, 0, 2),
+
+ /* 0000 1011 1100 ... */
+ /* 0 */ V(0, 14, 1), /* 374 */
+ /* 1 */ V(14, 0, 1),
+
+ /* 0000 1011 1101 ... */
+ /* 0 */ V(5, 13, 1), /* 376 */
+ /* 1 */ V(13, 5, 1),
+
+ /* 0000 1011 1110 ... */
+ /* 0 */ V(7, 12, 1), /* 378 */
+ /* 1 */ V(12, 7, 1),
+
+ /* 0000 1011 1111 ... */
+ /* 0 */ V(4, 13, 1), /* 380 */
+ /* 1 */ V(8, 11, 1),
+
+ /* 0000 1100 0000 ... */
+ /* 0 */ V(9, 10, 1), /* 382 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 1100 0001 ... */
+ /* 0 */ V(12, 6, 1), /* 384 */
+ /* 1 */ V(3, 13, 1),
+
+ /* 0000 1100 0010 ... */
+ /* 0 */ V(5, 12, 1), /* 386 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 1100 0100 ... */
+ /* 0 */ V(8, 10, 1), /* 388 */
+ /* 1 */ V(10, 8, 1),
+
+ /* 0000 1100 0101 ... */
+ /* 0 */ V(9, 9, 1), /* 390 */
+ /* 1 */ V(4, 12, 1),
+
+ /* 0000 1100 0110 ... */
+ /* 0 */ V(11, 6, 1), /* 392 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 1100 1000 ... */
+ /* 0 */ V(5, 11, 1), /* 394 */
+ /* 1 */ V(8, 9, 1),
+
+ /* 0000 1100 1011 ... */
+ /* 0 */ V(9, 8, 1), /* 396 */
+ /* 1 */ V(7, 9, 1),
+
+ /* 0000 1101 0101 ... */
+ /* 0 */ V(9, 7, 1), /* 398 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0000 0110 1100 0001 ... */
+ /* 0 */ V(14, 12, 1), /* 400 */
+ /* 1 */ V(13, 13, 1)
};
static
-union huffpair const hufftab24[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(64, 4),
- /* 0101 */ PTR(80, 4),
- /* 0110 */ PTR(96, 4),
- /* 0111 */ PTR(112, 4),
- /* 1000 */ PTR(128, 4),
- /* 1001 */ PTR(144, 4),
- /* 1010 */ PTR(160, 3),
- /* 1011 */ PTR(168, 2),
- /* 1100 */ V(1, 1, 4),
- /* 1101 */ V(0, 1, 4),
- /* 1110 */ V(1, 0, 4),
- /* 1111 */ V(0, 0, 4),
-
- /* 0000 ... */
- /* 0000 */ V(14, 15, 4), /* 16 */
- /* 0001 */ V(15, 14, 4),
- /* 0010 */ V(13, 15, 4),
- /* 0011 */ V(15, 13, 4),
- /* 0100 */ V(12, 15, 4),
- /* 0101 */ V(15, 12, 4),
- /* 0110 */ V(11, 15, 4),
- /* 0111 */ V(15, 11, 4),
- /* 1000 */ V(15, 10, 3),
- /* 1001 */ V(15, 10, 3),
- /* 1010 */ V(10, 15, 4),
- /* 1011 */ V(9, 15, 4),
- /* 1100 */ V(15, 9, 3),
- /* 1101 */ V(15, 9, 3),
- /* 1110 */ V(15, 8, 3),
- /* 1111 */ V(15, 8, 3),
-
- /* 0001 ... */
- /* 0000 */ V(8, 15, 4), /* 32 */
- /* 0001 */ V(7, 15, 4),
- /* 0010 */ V(15, 7, 3),
- /* 0011 */ V(15, 7, 3),
- /* 0100 */ V(6, 15, 3),
- /* 0101 */ V(6, 15, 3),
- /* 0110 */ V(15, 6, 3),
- /* 0111 */ V(15, 6, 3),
- /* 1000 */ V(5, 15, 3),
- /* 1001 */ V(5, 15, 3),
- /* 1010 */ V(15, 5, 3),
- /* 1011 */ V(15, 5, 3),
- /* 1100 */ V(4, 15, 3),
- /* 1101 */ V(4, 15, 3),
- /* 1110 */ V(15, 4, 3),
- /* 1111 */ V(15, 4, 3),
-
- /* 0010 ... */
- /* 0000 */ V(3, 15, 3), /* 48 */
- /* 0001 */ V(3, 15, 3),
- /* 0010 */ V(15, 3, 3),
- /* 0011 */ V(15, 3, 3),
- /* 0100 */ V(2, 15, 3),
- /* 0101 */ V(2, 15, 3),
- /* 0110 */ V(15, 2, 3),
- /* 0111 */ V(15, 2, 3),
- /* 1000 */ V(15, 1, 3),
- /* 1001 */ V(15, 1, 3),
- /* 1010 */ V(1, 15, 4),
- /* 1011 */ V(15, 0, 4),
- /* 1100 */ PTR(172, 3),
- /* 1101 */ PTR(180, 3),
- /* 1110 */ PTR(188, 3),
- /* 1111 */ PTR(196, 3),
-
- /* 0100 ... */
- /* 0000 */ PTR(204, 4), /* 64 */
- /* 0001 */ PTR(220, 3),
- /* 0010 */ PTR(228, 3),
- /* 0011 */ PTR(236, 3),
- /* 0100 */ PTR(244, 2),
- /* 0101 */ PTR(248, 2),
- /* 0110 */ PTR(252, 2),
- /* 0111 */ PTR(256, 2),
- /* 1000 */ PTR(260, 2),
- /* 1001 */ PTR(264, 2),
- /* 1010 */ PTR(268, 2),
- /* 1011 */ PTR(272, 2),
- /* 1100 */ PTR(276, 2),
- /* 1101 */ PTR(280, 3),
- /* 1110 */ PTR(288, 2),
- /* 1111 */ PTR(292, 2),
-
- /* 0101 ... */
- /* 0000 */ PTR(296, 2), /* 80 */
- /* 0001 */ PTR(300, 3),
- /* 0010 */ PTR(308, 2),
- /* 0011 */ PTR(312, 3),
- /* 0100 */ PTR(320, 1),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 2),
- /* 0111 */ PTR(330, 1),
- /* 1000 */ PTR(332, 2),
- /* 1001 */ PTR(336, 1),
- /* 1010 */ PTR(338, 1),
- /* 1011 */ PTR(340, 1),
- /* 1100 */ PTR(342, 1),
- /* 1101 */ PTR(344, 1),
- /* 1110 */ PTR(346, 1),
- /* 1111 */ PTR(348, 1),
-
- /* 0110 ... */
- /* 0000 */ PTR(350, 1), /* 96 */
- /* 0001 */ PTR(352, 1),
- /* 0010 */ PTR(354, 1),
- /* 0011 */ PTR(356, 1),
- /* 0100 */ PTR(358, 1),
- /* 0101 */ PTR(360, 1),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ PTR(364, 1),
- /* 1000 */ PTR(366, 1),
- /* 1001 */ PTR(368, 1),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 2),
- /* 1101 */ V(7, 3, 4),
- /* 1110 */ PTR(380, 1),
- /* 1111 */ V(7, 2, 4),
-
- /* 0111 ... */
- /* 0000 */ V(4, 6, 4), /* 112 */
- /* 0001 */ V(6, 4, 4),
- /* 0010 */ V(5, 5, 4),
- /* 0011 */ V(7, 1, 4),
- /* 0100 */ V(3, 6, 4),
- /* 0101 */ V(6, 3, 4),
- /* 0110 */ V(4, 5, 4),
- /* 0111 */ V(5, 4, 4),
- /* 1000 */ V(2, 6, 4),
- /* 1001 */ V(6, 2, 4),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 1, 4),
- /* 1100 */ PTR(382, 1),
- /* 1101 */ V(3, 5, 4),
- /* 1110 */ V(5, 3, 4),
- /* 1111 */ V(4, 4, 4),
-
- /* 1000 ... */
- /* 0000 */ V(2, 5, 4), /* 128 */
- /* 0001 */ V(5, 2, 4),
- /* 0010 */ V(1, 5, 4),
- /* 0011 */ PTR(384, 1),
- /* 0100 */ V(5, 1, 3),
- /* 0101 */ V(5, 1, 3),
- /* 0110 */ V(3, 4, 4),
- /* 0111 */ V(4, 3, 4),
- /* 1000 */ V(2, 4, 3),
- /* 1001 */ V(2, 4, 3),
- /* 1010 */ V(4, 2, 3),
- /* 1011 */ V(4, 2, 3),
- /* 1100 */ V(3, 3, 3),
- /* 1101 */ V(3, 3, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 1001 ... */
- /* 0000 */ V(4, 1, 3), /* 144 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 1010 ... */
- /* 000 */ V(0, 3, 3), /* 160 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(1, 2, 1),
- /* 101 */ V(1, 2, 1),
- /* 110 */ V(1, 2, 1),
- /* 111 */ V(1, 2, 1),
-
- /* 1011 ... */
- /* 00 */ V(2, 1, 1), /* 168 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0010 1100 ... */
- /* 000 */ V(0, 15, 1), /* 172 */
- /* 001 */ V(0, 15, 1),
- /* 010 */ V(0, 15, 1),
- /* 011 */ V(0, 15, 1),
- /* 100 */ V(14, 14, 3),
- /* 101 */ V(13, 14, 3),
- /* 110 */ V(14, 13, 3),
- /* 111 */ V(12, 14, 3),
-
- /* 0010 1101 ... */
- /* 000 */ V(14, 12, 3), /* 180 */
- /* 001 */ V(13, 13, 3),
- /* 010 */ V(11, 14, 3),
- /* 011 */ V(14, 11, 3),
- /* 100 */ V(12, 13, 3),
- /* 101 */ V(13, 12, 3),
- /* 110 */ V(10, 14, 3),
- /* 111 */ V(14, 10, 3),
-
- /* 0010 1110 ... */
- /* 000 */ V(11, 13, 3), /* 188 */
- /* 001 */ V(13, 11, 3),
- /* 010 */ V(12, 12, 3),
- /* 011 */ V(9, 14, 3),
- /* 100 */ V(14, 9, 3),
- /* 101 */ V(10, 13, 3),
- /* 110 */ V(13, 10, 3),
- /* 111 */ V(11, 12, 3),
-
- /* 0010 1111 ... */
- /* 000 */ V(12, 11, 3), /* 196 */
- /* 001 */ V(8, 14, 3),
- /* 010 */ V(14, 8, 3),
- /* 011 */ V(9, 13, 3),
- /* 100 */ V(13, 9, 3),
- /* 101 */ V(7, 14, 3),
- /* 110 */ V(14, 7, 3),
- /* 111 */ V(10, 12, 3),
-
- /* 0100 0000 ... */
- /* 0000 */ V(12, 10, 3), /* 204 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(8, 13, 3),
- /* 0101 */ V(8, 13, 3),
- /* 0110 */ V(13, 8, 3),
- /* 0111 */ V(13, 8, 3),
- /* 1000 */ V(0, 14, 4),
- /* 1001 */ V(14, 0, 4),
- /* 1010 */ V(0, 13, 3),
- /* 1011 */ V(0, 13, 3),
- /* 1100 */ V(14, 6, 2),
- /* 1101 */ V(14, 6, 2),
- /* 1110 */ V(14, 6, 2),
- /* 1111 */ V(14, 6, 2),
-
- /* 0100 0001 ... */
- /* 000 */ V(6, 14, 3), /* 220 */
- /* 001 */ V(9, 12, 3),
- /* 010 */ V(12, 9, 2),
- /* 011 */ V(12, 9, 2),
- /* 100 */ V(5, 14, 2),
- /* 101 */ V(5, 14, 2),
- /* 110 */ V(11, 10, 2),
- /* 111 */ V(11, 10, 2),
-
- /* 0100 0010 ... */
- /* 000 */ V(14, 5, 2), /* 228 */
- /* 001 */ V(14, 5, 2),
- /* 010 */ V(10, 11, 3),
- /* 011 */ V(7, 13, 3),
- /* 100 */ V(13, 7, 2),
- /* 101 */ V(13, 7, 2),
- /* 110 */ V(14, 4, 2),
- /* 111 */ V(14, 4, 2),
-
- /* 0100 0011 ... */
- /* 000 */ V(8, 12, 2), /* 236 */
- /* 001 */ V(8, 12, 2),
- /* 010 */ V(12, 8, 2),
- /* 011 */ V(12, 8, 2),
- /* 100 */ V(4, 14, 3),
- /* 101 */ V(2, 14, 3),
- /* 110 */ V(3, 14, 2),
- /* 111 */ V(3, 14, 2),
-
- /* 0100 0100 ... */
- /* 00 */ V(6, 13, 2), /* 244 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(14, 3, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0100 0101 ... */
- /* 00 */ V(11, 9, 2), /* 248 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 2, 2),
- /* 11 */ V(1, 14, 2),
-
- /* 0100 0110 ... */
- /* 00 */ V(14, 1, 2), /* 252 */
- /* 01 */ V(5, 13, 2),
- /* 10 */ V(13, 5, 2),
- /* 11 */ V(7, 12, 2),
-
- /* 0100 0111 ... */
- /* 00 */ V(12, 7, 2), /* 256 */
- /* 01 */ V(4, 13, 2),
- /* 10 */ V(8, 11, 2),
- /* 11 */ V(11, 8, 2),
-
- /* 0100 1000 ... */
- /* 00 */ V(13, 4, 2), /* 260 */
- /* 01 */ V(9, 10, 2),
- /* 10 */ V(10, 9, 2),
- /* 11 */ V(6, 12, 2),
-
- /* 0100 1001 ... */
- /* 00 */ V(12, 6, 2), /* 264 */
- /* 01 */ V(3, 13, 2),
- /* 10 */ V(13, 3, 2),
- /* 11 */ V(2, 13, 2),
-
- /* 0100 1010 ... */
- /* 00 */ V(13, 2, 2), /* 268 */
- /* 01 */ V(1, 13, 2),
- /* 10 */ V(7, 11, 2),
- /* 11 */ V(11, 7, 2),
-
- /* 0100 1011 ... */
- /* 00 */ V(13, 1, 2), /* 272 */
- /* 01 */ V(5, 12, 2),
- /* 10 */ V(12, 5, 2),
- /* 11 */ V(8, 10, 2),
-
- /* 0100 1100 ... */
- /* 00 */ V(10, 8, 2), /* 276 */
- /* 01 */ V(9, 9, 2),
- /* 10 */ V(4, 12, 2),
- /* 11 */ V(12, 4, 2),
-
- /* 0100 1101 ... */
- /* 000 */ V(6, 11, 2), /* 280 */
- /* 001 */ V(6, 11, 2),
- /* 010 */ V(11, 6, 2),
- /* 011 */ V(11, 6, 2),
- /* 100 */ V(13, 0, 3),
- /* 101 */ V(0, 12, 3),
- /* 110 */ V(3, 12, 2),
- /* 111 */ V(3, 12, 2),
-
- /* 0100 1110 ... */
- /* 00 */ V(12, 3, 2), /* 288 */
- /* 01 */ V(7, 10, 2),
- /* 10 */ V(10, 7, 2),
- /* 11 */ V(2, 12, 2),
-
- /* 0100 1111 ... */
- /* 00 */ V(12, 2, 2), /* 292 */
- /* 01 */ V(5, 11, 2),
- /* 10 */ V(11, 5, 2),
- /* 11 */ V(1, 12, 2),
-
- /* 0101 0000 ... */
- /* 00 */ V(8, 9, 2), /* 296 */
- /* 01 */ V(9, 8, 2),
- /* 10 */ V(12, 1, 2),
- /* 11 */ V(4, 11, 2),
-
- /* 0101 0001 ... */
- /* 000 */ V(12, 0, 3), /* 300 */
- /* 001 */ V(0, 11, 3),
- /* 010 */ V(3, 11, 2),
- /* 011 */ V(3, 11, 2),
- /* 100 */ V(11, 0, 3),
- /* 101 */ V(0, 10, 3),
- /* 110 */ V(1, 10, 2),
- /* 111 */ V(1, 10, 2),
-
- /* 0101 0010 ... */
- /* 00 */ V(11, 4, 1), /* 308 */
- /* 01 */ V(11, 4, 1),
- /* 10 */ V(6, 10, 2),
- /* 11 */ V(10, 6, 2),
-
- /* 0101 0011 ... */
- /* 000 */ V(7, 9, 2), /* 312 */
- /* 001 */ V(7, 9, 2),
- /* 010 */ V(9, 7, 2),
- /* 011 */ V(9, 7, 2),
- /* 100 */ V(10, 0, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(9, 0, 2),
- /* 111 */ V(9, 0, 2),
-
- /* 0101 0100 ... */
- /* 0 */ V(11, 3, 1), /* 320 */
- /* 1 */ V(8, 8, 1),
-
- /* 0101 0101 ... */
- /* 00 */ V(2, 11, 2), /* 322 */
- /* 01 */ V(5, 10, 2),
- /* 10 */ V(11, 2, 1),
- /* 11 */ V(11, 2, 1),
-
- /* 0101 0110 ... */
- /* 00 */ V(10, 5, 2), /* 326 */
- /* 01 */ V(1, 11, 2),
- /* 10 */ V(11, 1, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0101 0111 ... */
- /* 0 */ V(9, 6, 1), /* 330 */
- /* 1 */ V(10, 4, 1),
-
- /* 0101 1000 ... */
- /* 00 */ V(4, 10, 2), /* 332 */
- /* 01 */ V(7, 8, 2),
- /* 10 */ V(8, 7, 1),
- /* 11 */ V(8, 7, 1),
-
- /* 0101 1001 ... */
- /* 0 */ V(3, 10, 1), /* 336 */
- /* 1 */ V(10, 3, 1),
-
- /* 0101 1010 ... */
- /* 0 */ V(5, 9, 1), /* 338 */
- /* 1 */ V(9, 5, 1),
-
- /* 0101 1011 ... */
- /* 0 */ V(2, 10, 1), /* 340 */
- /* 1 */ V(10, 2, 1),
-
- /* 0101 1100 ... */
- /* 0 */ V(10, 1, 1), /* 342 */
- /* 1 */ V(6, 8, 1),
-
- /* 0101 1101 ... */
- /* 0 */ V(8, 6, 1), /* 344 */
- /* 1 */ V(7, 7, 1),
-
- /* 0101 1110 ... */
- /* 0 */ V(4, 9, 1), /* 346 */
- /* 1 */ V(9, 4, 1),
-
- /* 0101 1111 ... */
- /* 0 */ V(3, 9, 1), /* 348 */
- /* 1 */ V(9, 3, 1),
-
- /* 0110 0000 ... */
- /* 0 */ V(5, 8, 1), /* 350 */
- /* 1 */ V(8, 5, 1),
-
- /* 0110 0001 ... */
- /* 0 */ V(2, 9, 1), /* 352 */
- /* 1 */ V(6, 7, 1),
-
- /* 0110 0010 ... */
- /* 0 */ V(7, 6, 1), /* 354 */
- /* 1 */ V(9, 2, 1),
-
- /* 0110 0011 ... */
- /* 0 */ V(1, 9, 1), /* 356 */
- /* 1 */ V(9, 1, 1),
-
- /* 0110 0100 ... */
- /* 0 */ V(4, 8, 1), /* 358 */
- /* 1 */ V(8, 4, 1),
-
- /* 0110 0101 ... */
- /* 0 */ V(5, 7, 1), /* 360 */
- /* 1 */ V(7, 5, 1),
-
- /* 0110 0110 ... */
- /* 0 */ V(3, 8, 1), /* 362 */
- /* 1 */ V(8, 3, 1),
-
- /* 0110 0111 ... */
- /* 0 */ V(6, 6, 1), /* 364 */
- /* 1 */ V(2, 8, 1),
-
- /* 0110 1000 ... */
- /* 0 */ V(8, 2, 1), /* 366 */
- /* 1 */ V(1, 8, 1),
-
- /* 0110 1001 ... */
- /* 0 */ V(4, 7, 1), /* 368 */
- /* 1 */ V(7, 4, 1),
-
- /* 0110 1010 ... */
- /* 00 */ V(8, 1, 1), /* 370 */
- /* 01 */ V(8, 1, 1),
- /* 10 */ V(0, 8, 2),
- /* 11 */ V(8, 0, 2),
-
- /* 0110 1011 ... */
- /* 0 */ V(5, 6, 1), /* 374 */
- /* 1 */ V(6, 5, 1),
-
- /* 0110 1100 ... */
- /* 00 */ V(1, 7, 1), /* 376 */
- /* 01 */ V(1, 7, 1),
- /* 10 */ V(0, 7, 2),
- /* 11 */ V(7, 0, 2),
-
- /* 0110 1110 ... */
- /* 0 */ V(3, 7, 1), /* 380 */
- /* 1 */ V(2, 7, 1),
-
- /* 0111 1100 ... */
- /* 0 */ V(0, 6, 1), /* 382 */
- /* 1 */ V(6, 0, 1),
-
- /* 1000 0011 ... */
- /* 0 */ V(0, 5, 1), /* 384 */
- /* 1 */ V(5, 0, 1)
+union huffpair const hufftab24[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(64, 4),
+ /* 0101 */ PTR(80, 4),
+ /* 0110 */ PTR(96, 4),
+ /* 0111 */ PTR(112, 4),
+ /* 1000 */ PTR(128, 4),
+ /* 1001 */ PTR(144, 4),
+ /* 1010 */ PTR(160, 3),
+ /* 1011 */ PTR(168, 2),
+ /* 1100 */ V(1, 1, 4),
+ /* 1101 */ V(0, 1, 4),
+ /* 1110 */ V(1, 0, 4),
+ /* 1111 */ V(0, 0, 4),
+
+ /* 0000 ... */
+ /* 0000 */ V(14, 15, 4), /* 16 */
+ /* 0001 */ V(15, 14, 4),
+ /* 0010 */ V(13, 15, 4),
+ /* 0011 */ V(15, 13, 4),
+ /* 0100 */ V(12, 15, 4),
+ /* 0101 */ V(15, 12, 4),
+ /* 0110 */ V(11, 15, 4),
+ /* 0111 */ V(15, 11, 4),
+ /* 1000 */ V(15, 10, 3),
+ /* 1001 */ V(15, 10, 3),
+ /* 1010 */ V(10, 15, 4),
+ /* 1011 */ V(9, 15, 4),
+ /* 1100 */ V(15, 9, 3),
+ /* 1101 */ V(15, 9, 3),
+ /* 1110 */ V(15, 8, 3),
+ /* 1111 */ V(15, 8, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(8, 15, 4), /* 32 */
+ /* 0001 */ V(7, 15, 4),
+ /* 0010 */ V(15, 7, 3),
+ /* 0011 */ V(15, 7, 3),
+ /* 0100 */ V(6, 15, 3),
+ /* 0101 */ V(6, 15, 3),
+ /* 0110 */ V(15, 6, 3),
+ /* 0111 */ V(15, 6, 3),
+ /* 1000 */ V(5, 15, 3),
+ /* 1001 */ V(5, 15, 3),
+ /* 1010 */ V(15, 5, 3),
+ /* 1011 */ V(15, 5, 3),
+ /* 1100 */ V(4, 15, 3),
+ /* 1101 */ V(4, 15, 3),
+ /* 1110 */ V(15, 4, 3),
+ /* 1111 */ V(15, 4, 3),
+
+ /* 0010 ... */
+ /* 0000 */ V(3, 15, 3), /* 48 */
+ /* 0001 */ V(3, 15, 3),
+ /* 0010 */ V(15, 3, 3),
+ /* 0011 */ V(15, 3, 3),
+ /* 0100 */ V(2, 15, 3),
+ /* 0101 */ V(2, 15, 3),
+ /* 0110 */ V(15, 2, 3),
+ /* 0111 */ V(15, 2, 3),
+ /* 1000 */ V(15, 1, 3),
+ /* 1001 */ V(15, 1, 3),
+ /* 1010 */ V(1, 15, 4),
+ /* 1011 */ V(15, 0, 4),
+ /* 1100 */ PTR(172, 3),
+ /* 1101 */ PTR(180, 3),
+ /* 1110 */ PTR(188, 3),
+ /* 1111 */ PTR(196, 3),
+
+ /* 0100 ... */
+ /* 0000 */ PTR(204, 4), /* 64 */
+ /* 0001 */ PTR(220, 3),
+ /* 0010 */ PTR(228, 3),
+ /* 0011 */ PTR(236, 3),
+ /* 0100 */ PTR(244, 2),
+ /* 0101 */ PTR(248, 2),
+ /* 0110 */ PTR(252, 2),
+ /* 0111 */ PTR(256, 2),
+ /* 1000 */ PTR(260, 2),
+ /* 1001 */ PTR(264, 2),
+ /* 1010 */ PTR(268, 2),
+ /* 1011 */ PTR(272, 2),
+ /* 1100 */ PTR(276, 2),
+ /* 1101 */ PTR(280, 3),
+ /* 1110 */ PTR(288, 2),
+ /* 1111 */ PTR(292, 2),
+
+ /* 0101 ... */
+ /* 0000 */ PTR(296, 2), /* 80 */
+ /* 0001 */ PTR(300, 3),
+ /* 0010 */ PTR(308, 2),
+ /* 0011 */ PTR(312, 3),
+ /* 0100 */ PTR(320, 1),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 2),
+ /* 0111 */ PTR(330, 1),
+ /* 1000 */ PTR(332, 2),
+ /* 1001 */ PTR(336, 1),
+ /* 1010 */ PTR(338, 1),
+ /* 1011 */ PTR(340, 1),
+ /* 1100 */ PTR(342, 1),
+ /* 1101 */ PTR(344, 1),
+ /* 1110 */ PTR(346, 1),
+ /* 1111 */ PTR(348, 1),
+
+ /* 0110 ... */
+ /* 0000 */ PTR(350, 1), /* 96 */
+ /* 0001 */ PTR(352, 1),
+ /* 0010 */ PTR(354, 1),
+ /* 0011 */ PTR(356, 1),
+ /* 0100 */ PTR(358, 1),
+ /* 0101 */ PTR(360, 1),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ PTR(364, 1),
+ /* 1000 */ PTR(366, 1),
+ /* 1001 */ PTR(368, 1),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 2),
+ /* 1101 */ V(7, 3, 4),
+ /* 1110 */ PTR(380, 1),
+ /* 1111 */ V(7, 2, 4),
+
+ /* 0111 ... */
+ /* 0000 */ V(4, 6, 4), /* 112 */
+ /* 0001 */ V(6, 4, 4),
+ /* 0010 */ V(5, 5, 4),
+ /* 0011 */ V(7, 1, 4),
+ /* 0100 */ V(3, 6, 4),
+ /* 0101 */ V(6, 3, 4),
+ /* 0110 */ V(4, 5, 4),
+ /* 0111 */ V(5, 4, 4),
+ /* 1000 */ V(2, 6, 4),
+ /* 1001 */ V(6, 2, 4),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 1, 4),
+ /* 1100 */ PTR(382, 1),
+ /* 1101 */ V(3, 5, 4),
+ /* 1110 */ V(5, 3, 4),
+ /* 1111 */ V(4, 4, 4),
+
+ /* 1000 ... */
+ /* 0000 */ V(2, 5, 4), /* 128 */
+ /* 0001 */ V(5, 2, 4),
+ /* 0010 */ V(1, 5, 4),
+ /* 0011 */ PTR(384, 1),
+ /* 0100 */ V(5, 1, 3),
+ /* 0101 */ V(5, 1, 3),
+ /* 0110 */ V(3, 4, 4),
+ /* 0111 */ V(4, 3, 4),
+ /* 1000 */ V(2, 4, 3),
+ /* 1001 */ V(2, 4, 3),
+ /* 1010 */ V(4, 2, 3),
+ /* 1011 */ V(4, 2, 3),
+ /* 1100 */ V(3, 3, 3),
+ /* 1101 */ V(3, 3, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 1001 ... */
+ /* 0000 */ V(4, 1, 3), /* 144 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 1010 ... */
+ /* 000 */ V(0, 3, 3), /* 160 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(1, 2, 1),
+ /* 101 */ V(1, 2, 1),
+ /* 110 */ V(1, 2, 1),
+ /* 111 */ V(1, 2, 1),
+
+ /* 1011 ... */
+ /* 00 */ V(2, 1, 1), /* 168 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0010 1100 ... */
+ /* 000 */ V(0, 15, 1), /* 172 */
+ /* 001 */ V(0, 15, 1),
+ /* 010 */ V(0, 15, 1),
+ /* 011 */ V(0, 15, 1),
+ /* 100 */ V(14, 14, 3),
+ /* 101 */ V(13, 14, 3),
+ /* 110 */ V(14, 13, 3),
+ /* 111 */ V(12, 14, 3),
+
+ /* 0010 1101 ... */
+ /* 000 */ V(14, 12, 3), /* 180 */
+ /* 001 */ V(13, 13, 3),
+ /* 010 */ V(11, 14, 3),
+ /* 011 */ V(14, 11, 3),
+ /* 100 */ V(12, 13, 3),
+ /* 101 */ V(13, 12, 3),
+ /* 110 */ V(10, 14, 3),
+ /* 111 */ V(14, 10, 3),
+
+ /* 0010 1110 ... */
+ /* 000 */ V(11, 13, 3), /* 188 */
+ /* 001 */ V(13, 11, 3),
+ /* 010 */ V(12, 12, 3),
+ /* 011 */ V(9, 14, 3),
+ /* 100 */ V(14, 9, 3),
+ /* 101 */ V(10, 13, 3),
+ /* 110 */ V(13, 10, 3),
+ /* 111 */ V(11, 12, 3),
+
+ /* 0010 1111 ... */
+ /* 000 */ V(12, 11, 3), /* 196 */
+ /* 001 */ V(8, 14, 3),
+ /* 010 */ V(14, 8, 3),
+ /* 011 */ V(9, 13, 3),
+ /* 100 */ V(13, 9, 3),
+ /* 101 */ V(7, 14, 3),
+ /* 110 */ V(14, 7, 3),
+ /* 111 */ V(10, 12, 3),
+
+ /* 0100 0000 ... */
+ /* 0000 */ V(12, 10, 3), /* 204 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(8, 13, 3),
+ /* 0101 */ V(8, 13, 3),
+ /* 0110 */ V(13, 8, 3),
+ /* 0111 */ V(13, 8, 3),
+ /* 1000 */ V(0, 14, 4),
+ /* 1001 */ V(14, 0, 4),
+ /* 1010 */ V(0, 13, 3),
+ /* 1011 */ V(0, 13, 3),
+ /* 1100 */ V(14, 6, 2),
+ /* 1101 */ V(14, 6, 2),
+ /* 1110 */ V(14, 6, 2),
+ /* 1111 */ V(14, 6, 2),
+
+ /* 0100 0001 ... */
+ /* 000 */ V(6, 14, 3), /* 220 */
+ /* 001 */ V(9, 12, 3),
+ /* 010 */ V(12, 9, 2),
+ /* 011 */ V(12, 9, 2),
+ /* 100 */ V(5, 14, 2),
+ /* 101 */ V(5, 14, 2),
+ /* 110 */ V(11, 10, 2),
+ /* 111 */ V(11, 10, 2),
+
+ /* 0100 0010 ... */
+ /* 000 */ V(14, 5, 2), /* 228 */
+ /* 001 */ V(14, 5, 2),
+ /* 010 */ V(10, 11, 3),
+ /* 011 */ V(7, 13, 3),
+ /* 100 */ V(13, 7, 2),
+ /* 101 */ V(13, 7, 2),
+ /* 110 */ V(14, 4, 2),
+ /* 111 */ V(14, 4, 2),
+
+ /* 0100 0011 ... */
+ /* 000 */ V(8, 12, 2), /* 236 */
+ /* 001 */ V(8, 12, 2),
+ /* 010 */ V(12, 8, 2),
+ /* 011 */ V(12, 8, 2),
+ /* 100 */ V(4, 14, 3),
+ /* 101 */ V(2, 14, 3),
+ /* 110 */ V(3, 14, 2),
+ /* 111 */ V(3, 14, 2),
+
+ /* 0100 0100 ... */
+ /* 00 */ V(6, 13, 2), /* 244 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(14, 3, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0100 0101 ... */
+ /* 00 */ V(11, 9, 2), /* 248 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 2, 2),
+ /* 11 */ V(1, 14, 2),
+
+ /* 0100 0110 ... */
+ /* 00 */ V(14, 1, 2), /* 252 */
+ /* 01 */ V(5, 13, 2),
+ /* 10 */ V(13, 5, 2),
+ /* 11 */ V(7, 12, 2),
+
+ /* 0100 0111 ... */
+ /* 00 */ V(12, 7, 2), /* 256 */
+ /* 01 */ V(4, 13, 2),
+ /* 10 */ V(8, 11, 2),
+ /* 11 */ V(11, 8, 2),
+
+ /* 0100 1000 ... */
+ /* 00 */ V(13, 4, 2), /* 260 */
+ /* 01 */ V(9, 10, 2),
+ /* 10 */ V(10, 9, 2),
+ /* 11 */ V(6, 12, 2),
+
+ /* 0100 1001 ... */
+ /* 00 */ V(12, 6, 2), /* 264 */
+ /* 01 */ V(3, 13, 2),
+ /* 10 */ V(13, 3, 2),
+ /* 11 */ V(2, 13, 2),
+
+ /* 0100 1010 ... */
+ /* 00 */ V(13, 2, 2), /* 268 */
+ /* 01 */ V(1, 13, 2),
+ /* 10 */ V(7, 11, 2),
+ /* 11 */ V(11, 7, 2),
+
+ /* 0100 1011 ... */
+ /* 00 */ V(13, 1, 2), /* 272 */
+ /* 01 */ V(5, 12, 2),
+ /* 10 */ V(12, 5, 2),
+ /* 11 */ V(8, 10, 2),
+
+ /* 0100 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 276 */
+ /* 01 */ V(9, 9, 2),
+ /* 10 */ V(4, 12, 2),
+ /* 11 */ V(12, 4, 2),
+
+ /* 0100 1101 ... */
+ /* 000 */ V(6, 11, 2), /* 280 */
+ /* 001 */ V(6, 11, 2),
+ /* 010 */ V(11, 6, 2),
+ /* 011 */ V(11, 6, 2),
+ /* 100 */ V(13, 0, 3),
+ /* 101 */ V(0, 12, 3),
+ /* 110 */ V(3, 12, 2),
+ /* 111 */ V(3, 12, 2),
+
+ /* 0100 1110 ... */
+ /* 00 */ V(12, 3, 2), /* 288 */
+ /* 01 */ V(7, 10, 2),
+ /* 10 */ V(10, 7, 2),
+ /* 11 */ V(2, 12, 2),
+
+ /* 0100 1111 ... */
+ /* 00 */ V(12, 2, 2), /* 292 */
+ /* 01 */ V(5, 11, 2),
+ /* 10 */ V(11, 5, 2),
+ /* 11 */ V(1, 12, 2),
+
+ /* 0101 0000 ... */
+ /* 00 */ V(8, 9, 2), /* 296 */
+ /* 01 */ V(9, 8, 2),
+ /* 10 */ V(12, 1, 2),
+ /* 11 */ V(4, 11, 2),
+
+ /* 0101 0001 ... */
+ /* 000 */ V(12, 0, 3), /* 300 */
+ /* 001 */ V(0, 11, 3),
+ /* 010 */ V(3, 11, 2),
+ /* 011 */ V(3, 11, 2),
+ /* 100 */ V(11, 0, 3),
+ /* 101 */ V(0, 10, 3),
+ /* 110 */ V(1, 10, 2),
+ /* 111 */ V(1, 10, 2),
+
+ /* 0101 0010 ... */
+ /* 00 */ V(11, 4, 1), /* 308 */
+ /* 01 */ V(11, 4, 1),
+ /* 10 */ V(6, 10, 2),
+ /* 11 */ V(10, 6, 2),
+
+ /* 0101 0011 ... */
+ /* 000 */ V(7, 9, 2), /* 312 */
+ /* 001 */ V(7, 9, 2),
+ /* 010 */ V(9, 7, 2),
+ /* 011 */ V(9, 7, 2),
+ /* 100 */ V(10, 0, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(9, 0, 2),
+ /* 111 */ V(9, 0, 2),
+
+ /* 0101 0100 ... */
+ /* 0 */ V(11, 3, 1), /* 320 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0101 0101 ... */
+ /* 00 */ V(2, 11, 2), /* 322 */
+ /* 01 */ V(5, 10, 2),
+ /* 10 */ V(11, 2, 1),
+ /* 11 */ V(11, 2, 1),
+
+ /* 0101 0110 ... */
+ /* 00 */ V(10, 5, 2), /* 326 */
+ /* 01 */ V(1, 11, 2),
+ /* 10 */ V(11, 1, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0101 0111 ... */
+ /* 0 */ V(9, 6, 1), /* 330 */
+ /* 1 */ V(10, 4, 1),
+
+ /* 0101 1000 ... */
+ /* 00 */ V(4, 10, 2), /* 332 */
+ /* 01 */ V(7, 8, 2),
+ /* 10 */ V(8, 7, 1),
+ /* 11 */ V(8, 7, 1),
+
+ /* 0101 1001 ... */
+ /* 0 */ V(3, 10, 1), /* 336 */
+ /* 1 */ V(10, 3, 1),
+
+ /* 0101 1010 ... */
+ /* 0 */ V(5, 9, 1), /* 338 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0101 1011 ... */
+ /* 0 */ V(2, 10, 1), /* 340 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0101 1100 ... */
+ /* 0 */ V(10, 1, 1), /* 342 */
+ /* 1 */ V(6, 8, 1),
+
+ /* 0101 1101 ... */
+ /* 0 */ V(8, 6, 1), /* 344 */
+ /* 1 */ V(7, 7, 1),
+
+ /* 0101 1110 ... */
+ /* 0 */ V(4, 9, 1), /* 346 */
+ /* 1 */ V(9, 4, 1),
+
+ /* 0101 1111 ... */
+ /* 0 */ V(3, 9, 1), /* 348 */
+ /* 1 */ V(9, 3, 1),
+
+ /* 0110 0000 ... */
+ /* 0 */ V(5, 8, 1), /* 350 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0110 0001 ... */
+ /* 0 */ V(2, 9, 1), /* 352 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0110 0010 ... */
+ /* 0 */ V(7, 6, 1), /* 354 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0110 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 356 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0110 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 358 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0110 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 360 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0110 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 362 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0110 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 364 */
+ /* 1 */ V(2, 8, 1),
+
+ /* 0110 1000 ... */
+ /* 0 */ V(8, 2, 1), /* 366 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0110 1001 ... */
+ /* 0 */ V(4, 7, 1), /* 368 */
+ /* 1 */ V(7, 4, 1),
+
+ /* 0110 1010 ... */
+ /* 00 */ V(8, 1, 1), /* 370 */
+ /* 01 */ V(8, 1, 1),
+ /* 10 */ V(0, 8, 2),
+ /* 11 */ V(8, 0, 2),
+
+ /* 0110 1011 ... */
+ /* 0 */ V(5, 6, 1), /* 374 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0110 1100 ... */
+ /* 00 */ V(1, 7, 1), /* 376 */
+ /* 01 */ V(1, 7, 1),
+ /* 10 */ V(0, 7, 2),
+ /* 11 */ V(7, 0, 2),
+
+ /* 0110 1110 ... */
+ /* 0 */ V(3, 7, 1), /* 380 */
+ /* 1 */ V(2, 7, 1),
+
+ /* 0111 1100 ... */
+ /* 0 */ V(0, 6, 1), /* 382 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 1000 0011 ... */
+ /* 0 */ V(0, 5, 1), /* 384 */
+ /* 1 */ V(5, 0, 1)
};
# undef V
@@ -3081,38 +3062,37 @@ union huffpair const hufftab24[] =
union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB };
-struct hufftable const mad_huff_pair_table[32] =
-{
- /* 0 */ { hufftab0, 0, 0 },
- /* 1 */ { hufftab1, 0, 3 },
- /* 2 */ { hufftab2, 0, 3 },
- /* 3 */ { hufftab3, 0, 3 },
- /* 4 */ { 0 /* not used */ },
- /* 5 */ { hufftab5, 0, 3 },
- /* 6 */ { hufftab6, 0, 4 },
- /* 7 */ { hufftab7, 0, 4 },
- /* 8 */ { hufftab8, 0, 4 },
- /* 9 */ { hufftab9, 0, 4 },
- /* 10 */ { hufftab10, 0, 4 },
- /* 11 */ { hufftab11, 0, 4 },
- /* 12 */ { hufftab12, 0, 4 },
- /* 13 */ { hufftab13, 0, 4 },
- /* 14 */ { 0 /* not used */ },
- /* 15 */ { hufftab15, 0, 4 },
- /* 16 */ { hufftab16, 1, 4 },
- /* 17 */ { hufftab16, 2, 4 },
- /* 18 */ { hufftab16, 3, 4 },
- /* 19 */ { hufftab16, 4, 4 },
- /* 20 */ { hufftab16, 6, 4 },
- /* 21 */ { hufftab16, 8, 4 },
- /* 22 */ { hufftab16, 10, 4 },
- /* 23 */ { hufftab16, 13, 4 },
- /* 24 */ { hufftab24, 4, 4 },
- /* 25 */ { hufftab24, 5, 4 },
- /* 26 */ { hufftab24, 6, 4 },
- /* 27 */ { hufftab24, 7, 4 },
- /* 28 */ { hufftab24, 8, 4 },
- /* 29 */ { hufftab24, 9, 4 },
- /* 30 */ { hufftab24, 11, 4 },
- /* 31 */ { hufftab24, 13, 4 }
+struct hufftable const mad_huff_pair_table[32] = {
+ /* 0 */ { hufftab0, 0, 0 },
+ /* 1 */ { hufftab1, 0, 3 },
+ /* 2 */ { hufftab2, 0, 3 },
+ /* 3 */ { hufftab3, 0, 3 },
+ /* 4 */ { 0 /* not used */ },
+ /* 5 */ { hufftab5, 0, 3 },
+ /* 6 */ { hufftab6, 0, 4 },
+ /* 7 */ { hufftab7, 0, 4 },
+ /* 8 */ { hufftab8, 0, 4 },
+ /* 9 */ { hufftab9, 0, 4 },
+ /* 10 */ { hufftab10, 0, 4 },
+ /* 11 */ { hufftab11, 0, 4 },
+ /* 12 */ { hufftab12, 0, 4 },
+ /* 13 */ { hufftab13, 0, 4 },
+ /* 14 */ { 0 /* not used */ },
+ /* 15 */ { hufftab15, 0, 4 },
+ /* 16 */ { hufftab16, 1, 4 },
+ /* 17 */ { hufftab16, 2, 4 },
+ /* 18 */ { hufftab16, 3, 4 },
+ /* 19 */ { hufftab16, 4, 4 },
+ /* 20 */ { hufftab16, 6, 4 },
+ /* 21 */ { hufftab16, 8, 4 },
+ /* 22 */ { hufftab16, 10, 4 },
+ /* 23 */ { hufftab16, 13, 4 },
+ /* 24 */ { hufftab24, 4, 4 },
+ /* 25 */ { hufftab24, 5, 4 },
+ /* 26 */ { hufftab24, 6, 4 },
+ /* 27 */ { hufftab24, 7, 4 },
+ /* 28 */ { hufftab24, 8, 4 },
+ /* 29 */ { hufftab24, 9, 4 },
+ /* 30 */ { hufftab24, 11, 4 },
+ /* 31 */ { hufftab24, 13, 4 }
};
diff --git a/src/filters/transform/MpaDecFilter/libmad/hufftab.h b/src/filters/transform/MpaDecFilter/libmad/hufftab.h
index 32af86a61..4848f1c27 100644
--- a/src/filters/transform/MpaDecFilter/libmad/hufftab.h
+++ b/src/filters/transform/MpaDecFilter/libmad/hufftab.h
@@ -22,49 +22,42 @@
# ifndef LIBMAD_HUFFMAN_H
# define LIBMAD_HUFFMAN_H
-union huffquad
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short v : 1;
- unsigned short w : 1;
- unsigned short x : 1;
- unsigned short y : 1;
- } value;
- unsigned short final : 1;
+union huffquad {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short v : 1;
+ unsigned short w : 1;
+ unsigned short x : 1;
+ unsigned short y : 1;
+ } value;
+ unsigned short final : 1;
};
-union huffpair
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short x : 4;
- unsigned short y : 4;
- } value;
- unsigned short final : 1;
+union huffpair {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short x : 4;
+ unsigned short y : 4;
+ } value;
+ unsigned short final : 1;
};
-struct hufftable
-{
- union huffpair const *table;
- unsigned short linbits;
- unsigned short startbits;
+struct hufftable {
+ union huffpair const *table;
+ unsigned short linbits;
+ unsigned short startbits;
};
extern union huffquad const *const mad_huff_quad_table[2];
diff --git a/src/filters/transform/MpaDecFilter/libmad/layer12.c b/src/filters/transform/MpaDecFilter/libmad/layer12.c
index ba26ecefb..8b315c7fe 100644
--- a/src/filters/transform/MpaDecFilter/libmad/layer12.c
+++ b/src/filters/transform/MpaDecFilter/libmad/layer12.c
@@ -41,8 +41,7 @@
* used in both Layer I and Layer II decoding
*/
static
-mad_fixed_t const sf_table[64] =
-{
+mad_fixed_t const sf_table[64] = {
# include "sf_table.dat"
};
@@ -50,22 +49,21 @@ mad_fixed_t const sf_table[64] =
/* linear scaling table */
static
-mad_fixed_t const linear_table[14] =
-{
- MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */
- MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */
- MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */
- MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */
- MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */
- MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */
- MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */
- MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */
- MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */
- MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */
- MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */
- MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */
- MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */
- MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */
+mad_fixed_t const linear_table[14] = {
+ MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */
+ MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */
+ MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */
+ MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */
+ MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */
+ MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */
+ MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */
+ MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */
+ MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */
+ MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */
+ MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */
+ MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */
+ MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */
+ MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */
};
/*
@@ -75,27 +73,27 @@ mad_fixed_t const linear_table[14] =
static
mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
{
- mad_fixed_t sample;
+ mad_fixed_t sample;
- sample = mad_bit_read(ptr, nb);
+ sample = mad_bit_read(ptr, nb);
- /* invert most significant bit, extend sign, then scale to fixed format */
+ /* invert most significant bit, extend sign, then scale to fixed format */
- sample ^= 1 << (nb - 1);
- sample |= -(sample & (1 << (nb - 1)));
+ sample ^= 1 << (nb - 1);
+ sample |= -(sample & (1 << (nb - 1)));
- sample <<= MAD_F_FRACBITS - (nb - 1);
+ sample <<= MAD_F_FRACBITS - (nb - 1);
- /* requantize the sample */
+ /* requantize the sample */
- /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */
+ /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */
- sample += MAD_F_ONE >> (nb - 1);
+ sample += MAD_F_ONE >> (nb - 1);
- return mad_f_mul(sample, linear_table[nb - 2]);
+ return mad_f_mul(sample, linear_table[nb - 2]);
- /* s' = factor * s'' */
- /* (to be performed by caller) */
+ /* s' = factor * s'' */
+ /* (to be performed by caller) */
}
/*
@@ -104,211 +102,173 @@ mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
*/
int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame)
{
- struct mad_header *header = &frame->header;
- unsigned int nch, bound, ch, s, sb, nb;
- unsigned char allocation[2][32], scalefactor[2][32];
+ struct mad_header *header = &frame->header;
+ unsigned int nch, bound, ch, s, sb, nb;
+ unsigned char allocation[2][32], scalefactor[2][32];
- nch = MAD_NCHANNELS(header);
+ nch = MAD_NCHANNELS(header);
- bound = 32;
- if(header->mode == MAD_MODE_JOINT_STEREO)
- {
- header->flags |= MAD_FLAG_I_STEREO;
- bound = 4 + header->mode_extension * 4;
- }
+ bound = 32;
+ if (header->mode == MAD_MODE_JOINT_STEREO) {
+ header->flags |= MAD_FLAG_I_STEREO;
+ bound = 4 + header->mode_extension * 4;
+ }
- /* check CRC word */
+ /* check CRC word */
- if(header->flags & MAD_FLAG_PROTECTION)
- {
- header->crc_check =
- mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
- header->crc_check);
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
+ header->crc_check);
- if(header->crc_check != header->crc_target &&
- !(frame->options & MAD_OPTION_IGNORECRC))
- {
- stream->error = MAD_ERROR_BADCRC;
- return -1;
- }
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ return -1;
}
+ }
- /* decode bit allocations */
+ /* decode bit allocations */
- for(sb = 0; sb < bound; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- nb = mad_bit_read(&stream->ptr, 4);
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ nb = mad_bit_read(&stream->ptr, 4);
- if(nb == 15)
- {
- stream->error = MAD_ERROR_BADBITALLOC;
- return -1;
- }
+ if (nb == 15) {
+ stream->error = MAD_ERROR_BADBITALLOC;
+ return -1;
+ }
- allocation[ch][sb] = nb ? nb + 1 : 0;
- }
+ allocation[ch][sb] = nb ? nb + 1 : 0;
}
+ }
- for(sb = bound; sb < 32; ++sb)
- {
- nb = mad_bit_read(&stream->ptr, 4);
+ for (sb = bound; sb < 32; ++sb) {
+ nb = mad_bit_read(&stream->ptr, 4);
- if(nb == 15)
- {
- stream->error = MAD_ERROR_BADBITALLOC;
- return -1;
- }
-
- allocation[0][sb] =
- allocation[1][sb] = nb ? nb + 1 : 0;
+ if (nb == 15) {
+ stream->error = MAD_ERROR_BADBITALLOC;
+ return -1;
}
- /* decode scalefactors */
+ allocation[0][sb] =
+ allocation[1][sb] = nb ? nb + 1 : 0;
+ }
+
+ /* decode scalefactors */
- for(sb = 0; sb < 32; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if(allocation[ch][sb])
- {
- scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
+ for (sb = 0; sb < 32; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
+ scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
# if defined(OPT_STRICT)
- /*
- * Scalefactor index 63 does not appear in Table B.1 of
- * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
- * so we only reject it if OPT_STRICT is defined.
- */
- if(scalefactor[ch][sb] == 63)
- {
- stream->error = MAD_ERROR_BADSCALEFACTOR;
- return -1;
- }
+ /*
+ * Scalefactor index 63 does not appear in Table B.1 of
+ * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
+ * so we only reject it if OPT_STRICT is defined.
+ */
+ if (scalefactor[ch][sb] == 63) {
+ stream->error = MAD_ERROR_BADSCALEFACTOR;
+ return -1;
+ }
# endif
- }
- }
+ }
+ }
+ }
+
+ /* decode samples */
+
+ for (s = 0; s < 12; ++s) {
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ nb = allocation[ch][sb];
+ frame->sbsample[ch][s][sb] = nb ?
+ mad_f_mul(I_sample(&stream->ptr, nb),
+ sf_table[scalefactor[ch][sb]]) : 0;
+ }
}
- /* decode samples */
-
- for(s = 0; s < 12; ++s)
- {
- for(sb = 0; sb < bound; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- nb = allocation[ch][sb];
- frame->sbsample[ch][s][sb] = nb ?
- mad_f_mul(I_sample(&stream->ptr, nb),
- sf_table[scalefactor[ch][sb]]) : 0;
- }
- }
-
- for(sb = bound; sb < 32; ++sb)
- {
- if((nb = allocation[0][sb]))
- {
- mad_fixed_t sample;
-
- sample = I_sample(&stream->ptr, nb);
-
- for(ch = 0; ch < nch; ++ch)
- {
- frame->sbsample[ch][s][sb] =
- mad_f_mul(sample, sf_table[scalefactor[ch][sb]]);
- }
- }
- else
- {
- for(ch = 0; ch < nch; ++ch)
- frame->sbsample[ch][s][sb] = 0;
- }
- }
+ for (sb = bound; sb < 32; ++sb) {
+ if ((nb = allocation[0][sb])) {
+ mad_fixed_t sample;
+
+ sample = I_sample(&stream->ptr, nb);
+
+ for (ch = 0; ch < nch; ++ch) {
+ frame->sbsample[ch][s][sb] =
+ mad_f_mul(sample, sf_table[scalefactor[ch][sb]]);
+ }
+ }
+ else {
+ for (ch = 0; ch < nch; ++ch)
+ frame->sbsample[ch][s][sb] = 0;
+ }
}
+ }
- return 0;
+ return 0;
}
/* --- Layer II ------------------------------------------------------------ */
/* possible quantization per subband table */
static
-struct
-{
- unsigned int sblimit;
- unsigned char const offsets[30];
-} const sbquant_table[5] =
-{
- /* ISO/IEC 11172-3 Table B.2a */
- {
- 27, {
- 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */
- 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0
- }
- },
- /* ISO/IEC 11172-3 Table B.2b */
- {
- 30, {
- 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */
- 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0
- }
- },
- /* ISO/IEC 11172-3 Table B.2c */
- { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */
- /* ISO/IEC 11172-3 Table B.2d */
- { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */
- /* ISO/IEC 13818-3 Table B.1 */
- {
- 30, {
- 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- }
- }
+struct {
+ unsigned int sblimit;
+ unsigned char const offsets[30];
+} const sbquant_table[5] = {
+ /* ISO/IEC 11172-3 Table B.2a */
+ { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */
+ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } },
+ /* ISO/IEC 11172-3 Table B.2b */
+ { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */
+ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } },
+ /* ISO/IEC 11172-3 Table B.2c */
+ { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */
+ /* ISO/IEC 11172-3 Table B.2d */
+ { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */
+ /* ISO/IEC 13818-3 Table B.1 */
+ { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }
};
/* bit allocation table */
static
-struct
-{
- unsigned short nbal;
- unsigned short offset;
-} const bitalloc_table[8] =
-{
- { 2, 0 }, /* 0 */
- { 2, 3 }, /* 1 */
- { 3, 3 }, /* 2 */
- { 3, 1 }, /* 3 */
- { 4, 2 }, /* 4 */
- { 4, 3 }, /* 5 */
- { 4, 4 }, /* 6 */
- { 4, 5 } /* 7 */
+struct {
+ unsigned short nbal;
+ unsigned short offset;
+} const bitalloc_table[8] = {
+ { 2, 0 }, /* 0 */
+ { 2, 3 }, /* 1 */
+ { 3, 3 }, /* 2 */
+ { 3, 1 }, /* 3 */
+ { 4, 2 }, /* 4 */
+ { 4, 3 }, /* 5 */
+ { 4, 4 }, /* 6 */
+ { 4, 5 } /* 7 */
};
/* offsets into quantization class table */
static
-unsigned char const offset_table[6][15] =
-{
- { 0, 1, 16 }, /* 0 */
- { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */
- { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */
- { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */
+unsigned char const offset_table[6][15] = {
+ { 0, 1, 16 }, /* 0 */
+ { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */
+ { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */
+ { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */
};
/* quantization class table */
static
-struct quantclass
-{
- unsigned short nlevels;
- unsigned char group;
- unsigned char bits;
- mad_fixed_t C;
- mad_fixed_t D;
-} const qc_table[17] =
-{
+struct quantclass {
+ unsigned short nlevels;
+ unsigned char group;
+ unsigned char bits;
+ mad_fixed_t C;
+ mad_fixed_t D;
+} const qc_table[17] = {
# include "qc_table.dat"
};
@@ -318,53 +278,49 @@ struct quantclass
*/
static
void II_samples(struct mad_bitptr *ptr,
- struct quantclass const *quantclass,
- mad_fixed_t output[3])
+ struct quantclass const *quantclass,
+ mad_fixed_t output[3])
{
- unsigned int nb, s, sample[3];
+ unsigned int nb, s, sample[3];
- if((nb = quantclass->group))
- {
- unsigned int c, nlevels;
+ if ((nb = quantclass->group)) {
+ unsigned int c, nlevels;
- /* degrouping */
- c = mad_bit_read(ptr, quantclass->bits);
- nlevels = quantclass->nlevels;
+ /* degrouping */
+ c = mad_bit_read(ptr, quantclass->bits);
+ nlevels = quantclass->nlevels;
- for(s = 0; s < 3; ++s)
- {
- sample[s] = c % nlevels;
- c /= nlevels;
- }
+ for (s = 0; s < 3; ++s) {
+ sample[s] = c % nlevels;
+ c /= nlevels;
}
- else
- {
- nb = quantclass->bits;
+ }
+ else {
+ nb = quantclass->bits;
- for(s = 0; s < 3; ++s)
- sample[s] = mad_bit_read(ptr, nb);
- }
+ for (s = 0; s < 3; ++s)
+ sample[s] = mad_bit_read(ptr, nb);
+ }
- for(s = 0; s < 3; ++s)
- {
- mad_fixed_t requantized;
+ for (s = 0; s < 3; ++s) {
+ mad_fixed_t requantized;
- /* invert most significant bit, extend sign, then scale to fixed format */
+ /* invert most significant bit, extend sign, then scale to fixed format */
- requantized = sample[s] ^(1 << (nb - 1));
- requantized |= -(requantized & (1 << (nb - 1)));
+ requantized = sample[s] ^ (1 << (nb - 1));
+ requantized |= -(requantized & (1 << (nb - 1)));
- requantized <<= MAD_F_FRACBITS - (nb - 1);
+ requantized <<= MAD_F_FRACBITS - (nb - 1);
- /* requantize the sample */
+ /* requantize the sample */
- /* s'' = C * (s''' + D) */
+ /* s'' = C * (s''' + D) */
- output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C);
+ output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C);
- /* s' = factor * s'' */
- /* (to be performed by caller) */
- }
+ /* s' = factor * s'' */
+ /* (to be performed by caller) */
+ }
}
/*
@@ -373,237 +329,205 @@ void II_samples(struct mad_bitptr *ptr,
*/
int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame)
{
- struct mad_header *header = &frame->header;
- struct mad_bitptr start;
- unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb;
- unsigned char const *offsets;
- unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
- mad_fixed_t samples[3];
-
- nch = MAD_NCHANNELS(header);
-
- if(header->flags & MAD_FLAG_LSF_EXT)
- index = 4;
- else if(header->flags & MAD_FLAG_FREEFORMAT)
- goto freeformat;
- else
- {
- unsigned long bitrate_per_channel;
-
- bitrate_per_channel = header->bitrate;
- if(nch == 2)
- {
- bitrate_per_channel /= 2;
+ struct mad_header *header = &frame->header;
+ struct mad_bitptr start;
+ unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb;
+ unsigned char const *offsets;
+ unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
+ mad_fixed_t samples[3];
+
+ nch = MAD_NCHANNELS(header);
+
+ if (header->flags & MAD_FLAG_LSF_EXT)
+ index = 4;
+ else if (header->flags & MAD_FLAG_FREEFORMAT)
+ goto freeformat;
+ else {
+ unsigned long bitrate_per_channel;
+
+ bitrate_per_channel = header->bitrate;
+ if (nch == 2) {
+ bitrate_per_channel /= 2;
# if defined(OPT_STRICT)
- /*
- * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and
- * 80 kbps bitrates in Layer II, but some encoders ignore this
- * restriction. We enforce it if OPT_STRICT is defined.
- */
- if(bitrate_per_channel <= 28000 || bitrate_per_channel == 40000)
- {
- stream->error = MAD_ERROR_BADMODE;
- return -1;
- }
+ /*
+ * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and
+ * 80 kbps bitrates in Layer II, but some encoders ignore this
+ * restriction. We enforce it if OPT_STRICT is defined.
+ */
+ if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) {
+ stream->error = MAD_ERROR_BADMODE;
+ return -1;
+ }
# endif
- }
- else /* nch == 1 */
- {
- if(bitrate_per_channel > 192000)
- {
- /*
- * ISO/IEC 11172-3 does not allow single channel mode for 224, 256,
- * 320, or 384 kbps bitrates in Layer II.
- */
- stream->error = MAD_ERROR_BADMODE;
- return -1;
- }
- }
-
- if(bitrate_per_channel <= 48000)
- index = (header->samplerate == 32000) ? 3 : 2;
- else if(bitrate_per_channel <= 80000)
- index = 0;
- else
- {
-freeformat:
- index = (header->samplerate == 48000) ? 0 : 1;
- }
+ }
+ else { /* nch == 1 */
+ if (bitrate_per_channel > 192000) {
+ /*
+ * ISO/IEC 11172-3 does not allow single channel mode for 224, 256,
+ * 320, or 384 kbps bitrates in Layer II.
+ */
+ stream->error = MAD_ERROR_BADMODE;
+ return -1;
+ }
}
- sblimit = sbquant_table[index].sblimit;
- offsets = sbquant_table[index].offsets;
-
- bound = 32;
- if(header->mode == MAD_MODE_JOINT_STEREO)
- {
- header->flags |= MAD_FLAG_I_STEREO;
- bound = 4 + header->mode_extension * 4;
+ if (bitrate_per_channel <= 48000)
+ index = (header->samplerate == 32000) ? 3 : 2;
+ else if (bitrate_per_channel <= 80000)
+ index = 0;
+ else {
+ freeformat:
+ index = (header->samplerate == 48000) ? 0 : 1;
}
+ }
- if(bound > sblimit)
- bound = sblimit;
+ sblimit = sbquant_table[index].sblimit;
+ offsets = sbquant_table[index].offsets;
- start = stream->ptr;
+ bound = 32;
+ if (header->mode == MAD_MODE_JOINT_STEREO) {
+ header->flags |= MAD_FLAG_I_STEREO;
+ bound = 4 + header->mode_extension * 4;
+ }
- /* decode bit allocations */
+ if (bound > sblimit)
+ bound = sblimit;
- for(sb = 0; sb < bound; ++sb)
- {
- nbal = bitalloc_table[offsets[sb]].nbal;
+ start = stream->ptr;
- for(ch = 0; ch < nch; ++ch)
- allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
- }
+ /* decode bit allocations */
- for(sb = bound; sb < sblimit; ++sb)
- {
- nbal = bitalloc_table[offsets[sb]].nbal;
+ for (sb = 0; sb < bound; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
- allocation[0][sb] =
- allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
- }
+ for (ch = 0; ch < nch; ++ch)
+ allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
- /* decode scalefactor selection info */
+ allocation[0][sb] =
+ allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
- for(sb = 0; sb < sblimit; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if(allocation[ch][sb])
- scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
- }
+ /* decode scalefactor selection info */
+
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb])
+ scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
}
+ }
- /* check CRC word */
+ /* check CRC word */
- if(header->flags & MAD_FLAG_PROTECTION)
- {
- header->crc_check =
- mad_bit_crc(start, mad_bit_length(&start, &stream->ptr),
- header->crc_check);
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(start, mad_bit_length(&start, &stream->ptr),
+ header->crc_check);
- if(header->crc_check != header->crc_target &&
- !(frame->options & MAD_OPTION_IGNORECRC))
- {
- stream->error = MAD_ERROR_BADCRC;
- return -1;
- }
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ return -1;
}
+ }
- /* decode scalefactors */
+ /* decode scalefactors */
- for(sb = 0; sb < sblimit; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if(allocation[ch][sb])
- {
- scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
+ scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
- switch(scfsi[ch][sb])
- {
- case 2:
- scalefactor[ch][sb][2] =
- scalefactor[ch][sb][1] =
- scalefactor[ch][sb][0];
- break;
+ switch (scfsi[ch][sb]) {
+ case 2:
+ scalefactor[ch][sb][2] =
+ scalefactor[ch][sb][1] =
+ scalefactor[ch][sb][0];
+ break;
- case 0:
- scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
- /* fall through */
+ case 0:
+ scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
+ /* fall through */
- case 1:
- case 3:
- scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
- }
+ case 1:
+ case 3:
+ scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
+ }
- if(scfsi[ch][sb] & 1)
- scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1];
+ if (scfsi[ch][sb] & 1)
+ scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1];
# if defined(OPT_STRICT)
- /*
- * Scalefactor index 63 does not appear in Table B.1 of
- * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
- * so we only reject it if OPT_STRICT is defined.
- */
- if(scalefactor[ch][sb][0] == 63 ||
- scalefactor[ch][sb][1] == 63 ||
- scalefactor[ch][sb][2] == 63)
- {
- stream->error = MAD_ERROR_BADSCALEFACTOR;
- return -1;
- }
+ /*
+ * Scalefactor index 63 does not appear in Table B.1 of
+ * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
+ * so we only reject it if OPT_STRICT is defined.
+ */
+ if (scalefactor[ch][sb][0] == 63 ||
+ scalefactor[ch][sb][1] == 63 ||
+ scalefactor[ch][sb][2] == 63) {
+ stream->error = MAD_ERROR_BADSCALEFACTOR;
+ return -1;
+ }
# endif
- }
- }
+ }
+ }
+ }
+
+ /* decode samples */
+
+ for (gr = 0; gr < 12; ++gr) {
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if ((index = allocation[ch][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+ II_samples(&stream->ptr, &qc_table[index], samples);
+
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+ mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
+ }
+ }
+ else {
+ for (s = 0; s < 3; ++s)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ if ((index = allocation[0][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+ II_samples(&stream->ptr, &qc_table[index], samples);
+
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+ mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
+ }
+ }
+ }
+ else {
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
}
- /* decode samples */
-
- for(gr = 0; gr < 12; ++gr)
- {
- for(sb = 0; sb < bound; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if((index = allocation[ch][sb]))
- {
- index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
-
- II_samples(&stream->ptr, &qc_table[index], samples);
-
- for(s = 0; s < 3; ++s)
- {
- frame->sbsample[ch][3 * gr + s][sb] =
- mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
- }
- }
- else
- {
- for(s = 0; s < 3; ++s)
- frame->sbsample[ch][3 * gr + s][sb] = 0;
- }
- }
- }
-
- for(sb = bound; sb < sblimit; ++sb)
- {
- if((index = allocation[0][sb]))
- {
- index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
-
- II_samples(&stream->ptr, &qc_table[index], samples);
-
- for(ch = 0; ch < nch; ++ch)
- {
- for(s = 0; s < 3; ++s)
- {
- frame->sbsample[ch][3 * gr + s][sb] =
- mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
- }
- }
- }
- else
- {
- for(ch = 0; ch < nch; ++ch)
- {
- for(s = 0; s < 3; ++s)
- frame->sbsample[ch][3 * gr + s][sb] = 0;
- }
- }
- }
-
- for(ch = 0; ch < nch; ++ch)
- {
- for(s = 0; s < 3; ++s)
- {
- for(sb = sblimit; sb < 32; ++sb)
- frame->sbsample[ch][3 * gr + s][sb] = 0;
- }
- }
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+ for (sb = sblimit; sb < 32; ++sb)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
}
+ }
- return 0;
+ return 0;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/layer3.c b/src/filters/transform/MpaDecFilter/libmad/layer3.c
index 70cd405fb..30caef7c0 100644
--- a/src/filters/transform/MpaDecFilter/libmad/layer3.c
+++ b/src/filters/transform/MpaDecFilter/libmad/layer3.c
@@ -46,48 +46,43 @@
/* --- Layer III ----------------------------------------------------------- */
-enum
-{
- count1table_select = 0x01,
- scalefac_scale = 0x02,
- preflag = 0x04,
- mixed_block_flag = 0x08
+enum {
+ count1table_select = 0x01,
+ scalefac_scale = 0x02,
+ preflag = 0x04,
+ mixed_block_flag = 0x08
};
-enum
-{
- I_STEREO = 0x1,
- MS_STEREO = 0x2
+enum {
+ I_STEREO = 0x1,
+ MS_STEREO = 0x2
};
-struct sideinfo
-{
- unsigned int main_data_begin;
- unsigned int private_bits;
-
- unsigned char scfsi[2];
-
- struct granule
- {
- struct channel
- {
- /* from side info */
- unsigned short part2_3_length;
- unsigned short big_values;
- unsigned short global_gain;
- unsigned short scalefac_compress;
-
- unsigned char flags;
- unsigned char block_type;
- unsigned char table_select[3];
- unsigned char subblock_gain[3];
- unsigned char region0_count;
- unsigned char region1_count;
-
- /* from main_data */
- unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */
- } ch[2];
- } gr[2];
+struct sideinfo {
+ unsigned int main_data_begin;
+ unsigned int private_bits;
+
+ unsigned char scfsi[2];
+
+ struct granule {
+ struct channel {
+ /* from side info */
+ unsigned short part2_3_length;
+ unsigned short big_values;
+ unsigned short global_gain;
+ unsigned short scalefac_compress;
+
+ unsigned char flags;
+ unsigned char block_type;
+ unsigned char table_select[3];
+ unsigned char subblock_gain[3];
+ unsigned char region0_count;
+ unsigned char region1_count;
+
+ /* from main_data */
+ unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */
+ } ch[2];
+ } gr[2];
};
/*
@@ -95,16 +90,14 @@ struct sideinfo
* derived from section 2.4.2.7 of ISO/IEC 11172-3
*/
static
-struct
-{
- unsigned char slen1;
- unsigned char slen2;
-} const sflen_table[16] =
-{
- { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
- { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 },
- { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 },
- { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 }
+struct {
+ unsigned char slen1;
+ unsigned char slen2;
+} const sflen_table[16] = {
+ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
+ { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 },
+ { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 },
+ { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 }
};
/*
@@ -112,37 +105,30 @@ struct
* derived from section 2.4.3.2 of ISO/IEC 13818-3
*/
static
-unsigned char const nsfb_table[6][3][4] =
-{
- { { 6, 5, 5, 5 },
- { 9, 9, 9, 9 },
- { 6, 9, 9, 9 }
- },
-
- { { 6, 5, 7, 3 },
- { 9, 9, 12, 6 },
- { 6, 9, 12, 6 }
- },
-
- { { 11, 10, 0, 0 },
- { 18, 18, 0, 0 },
- { 15, 18, 0, 0 }
- },
-
- { { 7, 7, 7, 0 },
- { 12, 12, 12, 0 },
- { 6, 15, 12, 0 }
- },
-
- { { 6, 6, 6, 3 },
- { 12, 9, 9, 6 },
- { 6, 12, 9, 6 }
- },
-
- { { 8, 8, 5, 0 },
- { 15, 12, 9, 0 },
- { 6, 18, 9, 0 }
- }
+unsigned char const nsfb_table[6][3][4] = {
+ { { 6, 5, 5, 5 },
+ { 9, 9, 9, 9 },
+ { 6, 9, 9, 9 } },
+
+ { { 6, 5, 7, 3 },
+ { 9, 9, 12, 6 },
+ { 6, 9, 12, 6 } },
+
+ { { 11, 10, 0, 0 },
+ { 18, 18, 0, 0 },
+ { 15, 18, 0, 0 } },
+
+ { { 7, 7, 7, 0 },
+ { 12, 12, 12, 0 },
+ { 6, 15, 12, 0 } },
+
+ { { 6, 6, 6, 3 },
+ { 12, 9, 9, 6 },
+ { 6, 12, 9, 6 } },
+
+ { { 8, 8, 5, 0 },
+ { 15, 12, 9, 0 },
+ { 6, 18, 9, 0 } }
};
/*
@@ -150,75 +136,66 @@ unsigned char const nsfb_table[6][3][4] =
* derived from Table B.8 of ISO/IEC 11172-3
*/
static
-unsigned char const sfb_48000_long[] =
-{
- 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
- 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192
+unsigned char const sfb_48000_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
+ 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192
};
static
-unsigned char const sfb_44100_long[] =
-{
- 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
- 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158
+unsigned char const sfb_44100_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
+ 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158
};
static
-unsigned char const sfb_32000_long[] =
-{
- 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12,
- 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26
+unsigned char const sfb_32000_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12,
+ 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26
};
static
-unsigned char const sfb_48000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
- 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14,
- 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
+unsigned char const sfb_48000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14,
+ 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
};
static
-unsigned char const sfb_44100_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
- 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14,
- 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
+unsigned char const sfb_44100_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14,
+ 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
};
static
-unsigned char const sfb_32000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
- 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20,
- 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
+unsigned char const sfb_32000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20,
+ 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
};
static
-unsigned char const sfb_48000_mixed[] =
-{
- /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
- /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10,
- 10, 10, 12, 12, 12, 14, 14, 14, 16, 16,
- 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
+unsigned char const sfb_48000_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10,
+ 10, 10, 12, 12, 12, 14, 14, 14, 16, 16,
+ 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
};
static
-unsigned char const sfb_44100_mixed[] =
-{
- /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
- /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10,
- 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
- 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
+unsigned char const sfb_44100_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10,
+ 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
};
static
-unsigned char const sfb_32000_mixed[] =
-{
- /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
- /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12,
- 12, 12, 16, 16, 16, 20, 20, 20, 26, 26,
- 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
+unsigned char const sfb_32000_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12,
+ 12, 12, 16, 16, 16, 20, 20, 20, 26, 26,
+ 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
};
/*
@@ -226,70 +203,62 @@ unsigned char const sfb_32000_mixed[] =
* derived from Table B.2 of ISO/IEC 13818-3
*/
static
-unsigned char const sfb_24000_long[] =
-{
- 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
- 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36
+unsigned char const sfb_24000_long[] = {
+ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
+ 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36
};
static
-unsigned char const sfb_22050_long[] =
-{
- 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
- 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54
+unsigned char const sfb_22050_long[] = {
+ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
+ 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54
};
# define sfb_16000_long sfb_22050_long
static
-unsigned char const sfb_24000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
- 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
- 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
+unsigned char const sfb_24000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
+ 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
};
static
-unsigned char const sfb_22050_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6,
- 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18,
- 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
+unsigned char const sfb_22050_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6,
+ 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18,
+ 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
};
static
-unsigned char const sfb_16000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
- 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
- 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
+unsigned char const sfb_16000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
+ 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
};
static
-unsigned char const sfb_24000_mixed[] =
-{
- /* long */ 6, 6, 6, 6, 6, 6,
- /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
- 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
- 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
+unsigned char const sfb_24000_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
+ 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
+ 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
};
static
-unsigned char const sfb_22050_mixed[] =
-{
- /* long */ 6, 6, 6, 6, 6, 6,
- /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10,
- 10, 10, 14, 14, 14, 18, 18, 18, 26, 26,
- 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
+unsigned char const sfb_22050_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10,
+ 10, 10, 14, 14, 14, 18, 18, 18, 26, 26,
+ 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
};
static
-unsigned char const sfb_16000_mixed[] =
-{
- /* long */ 6, 6, 6, 6, 6, 6,
- /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
- 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
- 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
+unsigned char const sfb_16000_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
+ 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
+ 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
};
/*
@@ -300,21 +269,19 @@ unsigned char const sfb_16000_mixed[] =
# define sfb_11025_long sfb_12000_long
static
-unsigned char const sfb_8000_long[] =
-{
- 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32,
- 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2
+unsigned char const sfb_8000_long[] = {
+ 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32,
+ 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2
};
# define sfb_12000_short sfb_16000_short
# define sfb_11025_short sfb_12000_short
static
-unsigned char const sfb_8000_short[] =
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16,
- 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36,
- 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
+unsigned char const sfb_8000_short[] = {
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16,
+ 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36,
+ 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
};
# define sfb_12000_mixed sfb_16000_mixed
@@ -323,31 +290,28 @@ unsigned char const sfb_8000_short[] =
/* the 8000 Hz short block scalefactor bands do not break after
the first 36 frequency lines, so this is probably wrong */
static
-unsigned char const sfb_8000_mixed[] =
-{
- /* long */ 12, 12, 12,
- /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16,
- 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
+unsigned char const sfb_8000_mixed[] = {
+ /* long */ 12, 12, 12,
+ /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16,
+ 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
};
static
-struct
-{
- unsigned char const *l;
- unsigned char const *s;
- unsigned char const *m;
-} const sfbwidth_table[9] =
-{
- { sfb_48000_long, sfb_48000_short, sfb_48000_mixed },
- { sfb_44100_long, sfb_44100_short, sfb_44100_mixed },
- { sfb_32000_long, sfb_32000_short, sfb_32000_mixed },
- { sfb_24000_long, sfb_24000_short, sfb_24000_mixed },
- { sfb_22050_long, sfb_22050_short, sfb_22050_mixed },
- { sfb_16000_long, sfb_16000_short, sfb_16000_mixed },
- { sfb_12000_long, sfb_12000_short, sfb_12000_mixed },
- { sfb_11025_long, sfb_11025_short, sfb_11025_mixed },
- { sfb_8000_long, sfb_8000_short, sfb_8000_mixed }
+struct {
+ unsigned char const *l;
+ unsigned char const *s;
+ unsigned char const *m;
+} const sfbwidth_table[9] = {
+ { sfb_48000_long, sfb_48000_short, sfb_48000_mixed },
+ { sfb_44100_long, sfb_44100_short, sfb_44100_mixed },
+ { sfb_32000_long, sfb_32000_short, sfb_32000_mixed },
+ { sfb_24000_long, sfb_24000_short, sfb_24000_mixed },
+ { sfb_22050_long, sfb_22050_short, sfb_22050_mixed },
+ { sfb_16000_long, sfb_16000_short, sfb_16000_mixed },
+ { sfb_12000_long, sfb_12000_short, sfb_12000_mixed },
+ { sfb_11025_long, sfb_11025_short, sfb_11025_mixed },
+ { sfb_8000_long, sfb_8000_short, sfb_8000_mixed }
};
/*
@@ -355,9 +319,8 @@ struct
* derived from Table B.6 of ISO/IEC 11172-3
*/
static
-unsigned char const pretab[22] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
+unsigned char const pretab[22] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
};
/*
@@ -366,12 +329,10 @@ unsigned char const pretab[22] =
* rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3)
*/
static
-struct fixedfloat
-{
- unsigned long mantissa : 27;
- unsigned short exponent : 5;
-} const rq_table[8207] =
-{
+struct fixedfloat {
+ unsigned long mantissa : 27;
+ unsigned short exponent : 5;
+} const rq_table[8207] = {
# include "rq_table.dat"
};
@@ -382,15 +343,14 @@ struct fixedfloat
* root_table[3 + x] = 2^(x/4)
*/
static
-mad_fixed_t const root_table[7] =
-{
- MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
- MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
- MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
- MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
- MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
- MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
- MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
+mad_fixed_t const root_table[7] = {
+ MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
+ MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
+ MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
+ MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
+ MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
+ MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
+ MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
};
/*
@@ -402,21 +362,19 @@ mad_fixed_t const root_table[7] =
* ca[i] = c[i] / sqrt(1 + c[i]^2)
*/
static
-mad_fixed_t const cs[8] =
-{
- +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
- +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
- +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
- +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
+mad_fixed_t const cs[8] = {
+ +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
+ +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
+ +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
+ +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
};
static
-mad_fixed_t const ca[8] =
-{
- -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
- -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
- -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
- -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
+mad_fixed_t const ca[8] = {
+ -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
+ -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
+ -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
+ -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
};
/*
@@ -427,8 +385,7 @@ mad_fixed_t const ca[8] =
* imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1))
*/
static
-mad_fixed_t const imdct_s[6][6] =
-{
+mad_fixed_t const imdct_s[6][6] = {
# include "imdct_s.dat"
};
@@ -440,28 +397,27 @@ mad_fixed_t const imdct_s[6][6] =
* window_l[i] = sin((PI / 36) * (i + 1/2))
*/
static
-mad_fixed_t const window_l[36] =
-{
- MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
- MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
- MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
- MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
- MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
- MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
-
- MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
- MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
- MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
- MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
- MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
- MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
-
- MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
- MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
- MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
- MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
- MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
- MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
+mad_fixed_t const window_l[36] = {
+ MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
+ MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
+ MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
+ MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
+
+ MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
+ MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
+
+ MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
+ MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
+ MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
+ MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
};
# endif /* ASO_IMDCT */
@@ -472,14 +428,13 @@ mad_fixed_t const window_l[36] =
* window_s[i] = sin((PI / 12) * (i + 1/2))
*/
static
-mad_fixed_t const window_s[12] =
-{
- MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
- MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
- MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
- MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
- MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
- MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
+mad_fixed_t const window_s[12] = {
+ MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
};
/*
@@ -490,15 +445,14 @@ mad_fixed_t const window_s[12] =
* is_table[i] = is_ratio[i] / (1 + is_ratio[i])
*/
static
-mad_fixed_t const is_table[7] =
-{
- MAD_F(0x00000000) /* 0.000000000 */,
- MAD_F(0x0361962f) /* 0.211324865 */,
- MAD_F(0x05db3d74) /* 0.366025404 */,
- MAD_F(0x08000000) /* 0.500000000 */,
- MAD_F(0x0a24c28c) /* 0.633974596 */,
- MAD_F(0x0c9e69d1) /* 0.788675135 */,
- MAD_F(0x10000000) /* 1.000000000 */
+mad_fixed_t const is_table[7] = {
+ MAD_F(0x00000000) /* 0.000000000 */,
+ MAD_F(0x0361962f) /* 0.211324865 */,
+ MAD_F(0x05db3d74) /* 0.366025404 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x0a24c28c) /* 0.633974596 */,
+ MAD_F(0x0c9e69d1) /* 0.788675135 */,
+ MAD_F(0x10000000) /* 1.000000000 */
};
/*
@@ -509,41 +463,40 @@ mad_fixed_t const is_table[7] =
* is_lsf_table[1][i] = (1 / sqrt(2))^(i + 1)
*/
static
-mad_fixed_t const is_lsf_table[2][15] =
-{
- {
- MAD_F(0x0d744fcd) /* 0.840896415 */,
- MAD_F(0x0b504f33) /* 0.707106781 */,
- MAD_F(0x09837f05) /* 0.594603558 */,
- MAD_F(0x08000000) /* 0.500000000 */,
- MAD_F(0x06ba27e6) /* 0.420448208 */,
- MAD_F(0x05a8279a) /* 0.353553391 */,
- MAD_F(0x04c1bf83) /* 0.297301779 */,
- MAD_F(0x04000000) /* 0.250000000 */,
- MAD_F(0x035d13f3) /* 0.210224104 */,
- MAD_F(0x02d413cd) /* 0.176776695 */,
- MAD_F(0x0260dfc1) /* 0.148650889 */,
- MAD_F(0x02000000) /* 0.125000000 */,
- MAD_F(0x01ae89fa) /* 0.105112052 */,
- MAD_F(0x016a09e6) /* 0.088388348 */,
- MAD_F(0x01306fe1) /* 0.074325445 */
- }, {
- MAD_F(0x0b504f33) /* 0.707106781 */,
- MAD_F(0x08000000) /* 0.500000000 */,
- MAD_F(0x05a8279a) /* 0.353553391 */,
- MAD_F(0x04000000) /* 0.250000000 */,
- MAD_F(0x02d413cd) /* 0.176776695 */,
- MAD_F(0x02000000) /* 0.125000000 */,
- MAD_F(0x016a09e6) /* 0.088388348 */,
- MAD_F(0x01000000) /* 0.062500000 */,
- MAD_F(0x00b504f3) /* 0.044194174 */,
- MAD_F(0x00800000) /* 0.031250000 */,
- MAD_F(0x005a827a) /* 0.022097087 */,
- MAD_F(0x00400000) /* 0.015625000 */,
- MAD_F(0x002d413d) /* 0.011048543 */,
- MAD_F(0x00200000) /* 0.007812500 */,
- MAD_F(0x0016a09e) /* 0.005524272 */
- }
+mad_fixed_t const is_lsf_table[2][15] = {
+ {
+ MAD_F(0x0d744fcd) /* 0.840896415 */,
+ MAD_F(0x0b504f33) /* 0.707106781 */,
+ MAD_F(0x09837f05) /* 0.594603558 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x06ba27e6) /* 0.420448208 */,
+ MAD_F(0x05a8279a) /* 0.353553391 */,
+ MAD_F(0x04c1bf83) /* 0.297301779 */,
+ MAD_F(0x04000000) /* 0.250000000 */,
+ MAD_F(0x035d13f3) /* 0.210224104 */,
+ MAD_F(0x02d413cd) /* 0.176776695 */,
+ MAD_F(0x0260dfc1) /* 0.148650889 */,
+ MAD_F(0x02000000) /* 0.125000000 */,
+ MAD_F(0x01ae89fa) /* 0.105112052 */,
+ MAD_F(0x016a09e6) /* 0.088388348 */,
+ MAD_F(0x01306fe1) /* 0.074325445 */
+ }, {
+ MAD_F(0x0b504f33) /* 0.707106781 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x05a8279a) /* 0.353553391 */,
+ MAD_F(0x04000000) /* 0.250000000 */,
+ MAD_F(0x02d413cd) /* 0.176776695 */,
+ MAD_F(0x02000000) /* 0.125000000 */,
+ MAD_F(0x016a09e6) /* 0.088388348 */,
+ MAD_F(0x01000000) /* 0.062500000 */,
+ MAD_F(0x00b504f3) /* 0.044194174 */,
+ MAD_F(0x00800000) /* 0.031250000 */,
+ MAD_F(0x005a827a) /* 0.022097087 */,
+ MAD_F(0x00400000) /* 0.015625000 */,
+ MAD_F(0x002d413d) /* 0.011048543 */,
+ MAD_F(0x00200000) /* 0.007812500 */,
+ MAD_F(0x0016a09e) /* 0.005524272 */
+ }
};
/*
@@ -552,94 +505,89 @@ mad_fixed_t const is_lsf_table[2][15] =
*/
static
enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch,
- int lsf, struct sideinfo *si,
- unsigned int *data_bitlen,
- unsigned int *priv_bitlen)
+ int lsf, struct sideinfo *si,
+ unsigned int *data_bitlen,
+ unsigned int *priv_bitlen)
{
- unsigned int ngr, gr, ch, i;
- enum mad_error result = MAD_ERROR_NONE;
+ unsigned int ngr, gr, ch, i;
+ enum mad_error result = MAD_ERROR_NONE;
- *data_bitlen = 0;
- *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3);
+ *data_bitlen = 0;
+ *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3);
- si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9);
- si->private_bits = mad_bit_read(ptr, *priv_bitlen);
+ si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9);
+ si->private_bits = mad_bit_read(ptr, *priv_bitlen);
- ngr = 1;
- if(!lsf)
- {
- ngr = 2;
+ ngr = 1;
+ if (!lsf) {
+ ngr = 2;
- for(ch = 0; ch < nch; ++ch)
- si->scfsi[ch] = mad_bit_read(ptr, 4);
- }
+ for (ch = 0; ch < nch; ++ch)
+ si->scfsi[ch] = mad_bit_read(ptr, 4);
+ }
- for(gr = 0; gr < ngr; ++gr)
- {
- struct granule *granule = &si->gr[gr];
+ for (gr = 0; gr < ngr; ++gr) {
+ struct granule *granule = &si->gr[gr];
- for(ch = 0; ch < nch; ++ch)
- {
- struct channel *channel = &granule->ch[ch];
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
- channel->part2_3_length = mad_bit_read(ptr, 12);
- channel->big_values = mad_bit_read(ptr, 9);
- channel->global_gain = mad_bit_read(ptr, 8);
- channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4);
+ channel->part2_3_length = mad_bit_read(ptr, 12);
+ channel->big_values = mad_bit_read(ptr, 9);
+ channel->global_gain = mad_bit_read(ptr, 8);
+ channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4);
- *data_bitlen += channel->part2_3_length;
+ *data_bitlen += channel->part2_3_length;
- if(channel->big_values > 288 && result == 0)
- result = MAD_ERROR_BADBIGVALUES;
+ if (channel->big_values > 288 && result == 0)
+ result = MAD_ERROR_BADBIGVALUES;
- channel->flags = 0;
+ channel->flags = 0;
- /* window_switching_flag */
- if(mad_bit_read(ptr, 1))
- {
- channel->block_type = mad_bit_read(ptr, 2);
+ /* window_switching_flag */
+ if (mad_bit_read(ptr, 1)) {
+ channel->block_type = mad_bit_read(ptr, 2);
- if(channel->block_type == 0 && result == 0)
- result = MAD_ERROR_BADBLOCKTYPE;
+ if (channel->block_type == 0 && result == 0)
+ result = MAD_ERROR_BADBLOCKTYPE;
- if(!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0)
- result = MAD_ERROR_BADSCFSI;
+ if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0)
+ result = MAD_ERROR_BADSCFSI;
- channel->region0_count = 7;
- channel->region1_count = 36;
+ channel->region0_count = 7;
+ channel->region1_count = 36;
- if(mad_bit_read(ptr, 1))
- channel->flags |= mixed_block_flag;
- else if(channel->block_type == 2)
- channel->region0_count = 8;
+ if (mad_bit_read(ptr, 1))
+ channel->flags |= mixed_block_flag;
+ else if (channel->block_type == 2)
+ channel->region0_count = 8;
- for(i = 0; i < 2; ++i)
- channel->table_select[i] = mad_bit_read(ptr, 5);
+ for (i = 0; i < 2; ++i)
+ channel->table_select[i] = mad_bit_read(ptr, 5);
# if defined(DEBUG)
- channel->table_select[2] = 4; /* not used */
+ channel->table_select[2] = 4; /* not used */
# endif
- for(i = 0; i < 3; ++i)
- channel->subblock_gain[i] = mad_bit_read(ptr, 3);
- }
- else
- {
- channel->block_type = 0;
+ for (i = 0; i < 3; ++i)
+ channel->subblock_gain[i] = mad_bit_read(ptr, 3);
+ }
+ else {
+ channel->block_type = 0;
- for(i = 0; i < 3; ++i)
- channel->table_select[i] = mad_bit_read(ptr, 5);
+ for (i = 0; i < 3; ++i)
+ channel->table_select[i] = mad_bit_read(ptr, 5);
- channel->region0_count = mad_bit_read(ptr, 4);
- channel->region1_count = mad_bit_read(ptr, 3);
- }
+ channel->region0_count = mad_bit_read(ptr, 4);
+ channel->region1_count = mad_bit_read(ptr, 3);
+ }
- /* [preflag,] scalefac_scale, count1table_select */
- channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3);
- }
+ /* [preflag,] scalefac_scale, count1table_select */
+ channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3);
}
+ }
- return result;
+ return result;
}
/*
@@ -648,125 +596,113 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch,
*/
static
unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
- struct channel *channel,
- struct channel *gr1ch, int mode_extension)
+ struct channel *channel,
+ struct channel *gr1ch, int mode_extension)
{
- struct mad_bitptr start;
- unsigned int scalefac_compress, index, slen[4], part, n, i;
- unsigned char const *nsfb;
+ struct mad_bitptr start;
+ unsigned int scalefac_compress, index, slen[4], part, n, i;
+ unsigned char const *nsfb;
- start = *ptr;
+ start = *ptr;
- scalefac_compress = channel->scalefac_compress;
- index = (channel->block_type == 2) ?
- ((channel->flags & mixed_block_flag) ? 2 : 1) : 0;
+ scalefac_compress = channel->scalefac_compress;
+ index = (channel->block_type == 2) ?
+ ((channel->flags & mixed_block_flag) ? 2 : 1) : 0;
- if(!((mode_extension & I_STEREO) && gr1ch))
- {
- if(scalefac_compress < 400)
- {
- slen[0] = (scalefac_compress >> 4) / 5;
- slen[1] = (scalefac_compress >> 4) % 5;
- slen[2] = (scalefac_compress % 16) >> 2;
- slen[3] = scalefac_compress % 4;
-
- nsfb = nsfb_table[0][index];
- }
- else if(scalefac_compress < 500)
- {
- scalefac_compress -= 400;
-
- slen[0] = (scalefac_compress >> 2) / 5;
- slen[1] = (scalefac_compress >> 2) % 5;
- slen[2] = scalefac_compress % 4;
- slen[3] = 0;
-
- nsfb = nsfb_table[1][index];
- }
- else
- {
- scalefac_compress -= 500;
-
- slen[0] = scalefac_compress / 3;
- slen[1] = scalefac_compress % 3;
- slen[2] = 0;
- slen[3] = 0;
-
- channel->flags |= preflag;
-
- nsfb = nsfb_table[2][index];
- }
-
- n = 0;
- for(part = 0; part < 4; ++part)
- {
- for(i = 0; i < nsfb[part]; ++i)
- channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
- }
-
- while(n < 39)
- channel->scalefac[n++] = 0;
+ if (!((mode_extension & I_STEREO) && gr1ch)) {
+ if (scalefac_compress < 400) {
+ slen[0] = (scalefac_compress >> 4) / 5;
+ slen[1] = (scalefac_compress >> 4) % 5;
+ slen[2] = (scalefac_compress % 16) >> 2;
+ slen[3] = scalefac_compress % 4;
+
+ nsfb = nsfb_table[0][index];
}
- else /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */
- {
- scalefac_compress >>= 1;
-
- if(scalefac_compress < 180)
- {
- slen[0] = scalefac_compress / 36;
- slen[1] = (scalefac_compress % 36) / 6;
- slen[2] = (scalefac_compress % 36) % 6;
- slen[3] = 0;
-
- nsfb = nsfb_table[3][index];
- }
- else if(scalefac_compress < 244)
- {
- scalefac_compress -= 180;
-
- slen[0] = (scalefac_compress % 64) >> 4;
- slen[1] = (scalefac_compress % 16) >> 2;
- slen[2] = scalefac_compress % 4;
- slen[3] = 0;
-
- nsfb = nsfb_table[4][index];
- }
- else
- {
- scalefac_compress -= 244;
-
- slen[0] = scalefac_compress / 3;
- slen[1] = scalefac_compress % 3;
- slen[2] = 0;
- slen[3] = 0;
-
- nsfb = nsfb_table[5][index];
- }
-
- n = 0;
- for(part = 0; part < 4; ++part)
- {
- unsigned int max, is_pos;
-
- max = (1 << slen[part]) - 1;
-
- for(i = 0; i < nsfb[part]; ++i)
- {
- is_pos = mad_bit_read(ptr, slen[part]);
-
- channel->scalefac[n] = is_pos;
- gr1ch->scalefac[n++] = (is_pos == max);
- }
- }
-
- while(n < 39)
- {
- channel->scalefac[n] = 0;
- gr1ch->scalefac[n++] = 0; /* apparently not illegal */
- }
+ else if (scalefac_compress < 500) {
+ scalefac_compress -= 400;
+
+ slen[0] = (scalefac_compress >> 2) / 5;
+ slen[1] = (scalefac_compress >> 2) % 5;
+ slen[2] = scalefac_compress % 4;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[1][index];
}
+ else {
+ scalefac_compress -= 500;
+
+ slen[0] = scalefac_compress / 3;
+ slen[1] = scalefac_compress % 3;
+ slen[2] = 0;
+ slen[3] = 0;
+
+ channel->flags |= preflag;
+
+ nsfb = nsfb_table[2][index];
+ }
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+ for (i = 0; i < nsfb[part]; ++i)
+ channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
+ }
+
+ while (n < 39)
+ channel->scalefac[n++] = 0;
+ }
+ else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */
+ scalefac_compress >>= 1;
- return mad_bit_length(&start, ptr);
+ if (scalefac_compress < 180) {
+ slen[0] = scalefac_compress / 36;
+ slen[1] = (scalefac_compress % 36) / 6;
+ slen[2] = (scalefac_compress % 36) % 6;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[3][index];
+ }
+ else if (scalefac_compress < 244) {
+ scalefac_compress -= 180;
+
+ slen[0] = (scalefac_compress % 64) >> 4;
+ slen[1] = (scalefac_compress % 16) >> 2;
+ slen[2] = scalefac_compress % 4;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[4][index];
+ }
+ else {
+ scalefac_compress -= 244;
+
+ slen[0] = scalefac_compress / 3;
+ slen[1] = scalefac_compress % 3;
+ slen[2] = 0;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[5][index];
+ }
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+ unsigned int max, is_pos;
+
+ max = (1 << slen[part]) - 1;
+
+ for (i = 0; i < nsfb[part]; ++i) {
+ is_pos = mad_bit_read(ptr, slen[part]);
+
+ channel->scalefac[n] = is_pos;
+ gr1ch->scalefac[n++] = (is_pos == max);
+ }
+ }
+
+ while (n < 39) {
+ channel->scalefac[n] = 0;
+ gr1ch->scalefac[n++] = 0; /* apparently not illegal */
+ }
+ }
+
+ return mad_bit_length(&start, ptr);
}
/*
@@ -775,84 +711,74 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
*/
static
unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
- struct channel const *gr0ch, unsigned int scfsi)
+ struct channel const *gr0ch, unsigned int scfsi)
{
- struct mad_bitptr start;
- unsigned int slen1, slen2, sfbi;
+ struct mad_bitptr start;
+ unsigned int slen1, slen2, sfbi;
- start = *ptr;
+ start = *ptr;
- slen1 = sflen_table[channel->scalefac_compress].slen1;
- slen2 = sflen_table[channel->scalefac_compress].slen2;
+ slen1 = sflen_table[channel->scalefac_compress].slen1;
+ slen2 = sflen_table[channel->scalefac_compress].slen2;
- if(channel->block_type == 2)
- {
- unsigned int nsfb;
+ if (channel->block_type == 2) {
+ unsigned int nsfb;
- sfbi = 0;
+ sfbi = 0;
- nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
- while(nsfb--)
- channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
+ nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
- nsfb = 6 * 3;
- while(nsfb--)
- channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
+ nsfb = 6 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
- nsfb = 1 * 3;
- while(nsfb--)
- channel->scalefac[sfbi++] = 0;
+ nsfb = 1 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = 0;
+ }
+ else { /* channel->block_type != 2 */
+ if (scfsi & 0x8) {
+ for (sfbi = 0; sfbi < 6; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
}
- else /* channel->block_type != 2 */
- {
- if(scfsi & 0x8)
- {
- for(sfbi = 0; sfbi < 6; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 0; sfbi < 6; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
- }
-
- if(scfsi & 0x4)
- {
- for(sfbi = 6; sfbi < 11; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 6; sfbi < 11; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
- }
-
- if(scfsi & 0x2)
- {
- for(sfbi = 11; sfbi < 16; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 11; sfbi < 16; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
- }
-
- if(scfsi & 0x1)
- {
- for(sfbi = 16; sfbi < 21; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 16; sfbi < 21; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
- }
-
- channel->scalefac[21] = 0;
+ else {
+ for (sfbi = 0; sfbi < 6; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
}
- return mad_bit_length(&start, ptr);
+ if (scfsi & 0x4) {
+ for (sfbi = 6; sfbi < 11; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 6; sfbi < 11; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
+ }
+
+ if (scfsi & 0x2) {
+ for (sfbi = 11; sfbi < 16; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 11; sfbi < 16; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
+ }
+
+ if (scfsi & 0x1) {
+ for (sfbi = 16; sfbi < 21; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 16; sfbi < 21; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
+ }
+
+ channel->scalefac[21] = 0;
+ }
+
+ return mad_bit_length(&start, ptr);
}
/*
@@ -883,78 +809,69 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
*/
static
void III_exponents(struct channel const *channel,
- unsigned char const *sfbwidth, signed int exponents[39])
+ unsigned char const *sfbwidth, signed int exponents[39])
{
- signed int gain;
- unsigned int scalefac_multiplier, sfbi;
+ signed int gain;
+ unsigned int scalefac_multiplier, sfbi;
- gain = (signed int) channel->global_gain - 210;
- scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1;
+ gain = (signed int) channel->global_gain - 210;
+ scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1;
- if(channel->block_type == 2)
- {
- unsigned int l;
- signed int gain0, gain1, gain2;
+ if (channel->block_type == 2) {
+ unsigned int l;
+ signed int gain0, gain1, gain2;
- sfbi = l = 0;
+ sfbi = l = 0;
- if(channel->flags & mixed_block_flag)
- {
- unsigned int premask;
+ if (channel->flags & mixed_block_flag) {
+ unsigned int premask;
- premask = (channel->flags & preflag) ? ~0 : 0;
+ premask = (channel->flags & preflag) ? ~0 : 0;
- /* long block subbands 0-1 */
+ /* long block subbands 0-1 */
- while(l < 36)
- {
- exponents[sfbi] = gain -
- (signed int)((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) <<
- scalefac_multiplier);
+ while (l < 36) {
+ exponents[sfbi] = gain -
+ (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) <<
+ scalefac_multiplier);
- l += sfbwidth[sfbi++];
- }
- }
+ l += sfbwidth[sfbi++];
+ }
+ }
- /* this is probably wrong for 8000 Hz short/mixed blocks */
+ /* this is probably wrong for 8000 Hz short/mixed blocks */
- gain0 = gain - 8 * (signed int) channel->subblock_gain[0];
- gain1 = gain - 8 * (signed int) channel->subblock_gain[1];
- gain2 = gain - 8 * (signed int) channel->subblock_gain[2];
+ gain0 = gain - 8 * (signed int) channel->subblock_gain[0];
+ gain1 = gain - 8 * (signed int) channel->subblock_gain[1];
+ gain2 = gain - 8 * (signed int) channel->subblock_gain[2];
- while(l < 576)
- {
- exponents[sfbi + 0] = gain0 -
- (signed int)(channel->scalefac[sfbi + 0] << scalefac_multiplier);
- exponents[sfbi + 1] = gain1 -
- (signed int)(channel->scalefac[sfbi + 1] << scalefac_multiplier);
- exponents[sfbi + 2] = gain2 -
- (signed int)(channel->scalefac[sfbi + 2] << scalefac_multiplier);
+ while (l < 576) {
+ exponents[sfbi + 0] = gain0 -
+ (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier);
+ exponents[sfbi + 1] = gain1 -
+ (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier);
+ exponents[sfbi + 2] = gain2 -
+ (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier);
- l += 3 * sfbwidth[sfbi];
- sfbi += 3;
- }
+ l += 3 * sfbwidth[sfbi];
+ sfbi += 3;
}
- else /* channel->block_type != 2 */
- {
- if(channel->flags & preflag)
- {
- for(sfbi = 0; sfbi < 22; ++sfbi)
- {
- exponents[sfbi] = gain -
- (signed int)((channel->scalefac[sfbi] + pretab[sfbi]) <<
- scalefac_multiplier);
- }
- }
- else
- {
- for(sfbi = 0; sfbi < 22; ++sfbi)
- {
- exponents[sfbi] = gain -
- (signed int)(channel->scalefac[sfbi] << scalefac_multiplier);
- }
- }
+ }
+ else { /* channel->block_type != 2 */
+ if (channel->flags & preflag) {
+ for (sfbi = 0; sfbi < 22; ++sfbi) {
+ exponents[sfbi] = gain -
+ (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) <<
+ scalefac_multiplier);
+ }
}
+ else {
+ for (sfbi = 0; sfbi < 22; ++sfbi) {
+ exponents[sfbi] = gain -
+ (signed int) (channel->scalefac[sfbi] << scalefac_multiplier);
+ }
+ }
+ }
}
/*
@@ -964,46 +881,41 @@ void III_exponents(struct channel const *channel,
static
mad_fixed_t III_requantize(unsigned int value, signed int exp)
{
- mad_fixed_t requantized;
- signed int frac;
- struct fixedfloat const *power;
+ mad_fixed_t requantized;
+ signed int frac;
+ struct fixedfloat const *power;
- frac = exp % 4; /* assumes sign(frac) == sign(exp) */
- exp /= 4;
+ frac = exp % 4; /* assumes sign(frac) == sign(exp) */
+ exp /= 4;
- power = &rq_table[value];
- requantized = power->mantissa;
- exp += power->exponent;
+ power = &rq_table[value];
+ requantized = power->mantissa;
+ exp += power->exponent;
- if(exp < 0)
- {
- if(-exp >= sizeof(mad_fixed_t) * CHAR_BIT)
- {
- /* underflow */
- requantized = 0;
- }
- else
- {
- requantized += 1L << (-exp - 1);
- requantized >>= -exp;
- }
+ if (exp < 0) {
+ if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) {
+ /* underflow */
+ requantized = 0;
}
- else
- {
- if(exp >= 5)
- {
- /* overflow */
+ else {
+ requantized += 1L << (-exp - 1);
+ requantized >>= -exp;
+ }
+ }
+ else {
+ if (exp >= 5) {
+ /* overflow */
# if defined(DEBUG)
- fprintf(stderr, "requantize overflow (%f * 2^%d)\n",
- mad_f_todouble(requantized), exp);
+ fprintf(stderr, "requantize overflow (%f * 2^%d)\n",
+ mad_f_todouble(requantized), exp);
# endif
- requantized = MAD_F_MAX;
- }
- else
- requantized <<= exp;
+ requantized = MAD_F_MAX;
}
+ else
+ requantized <<= exp;
+ }
- return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized;
+ return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized;
}
/* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */
@@ -1018,370 +930,343 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp)
*/
static
enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576],
- struct channel *channel,
- unsigned char const *sfbwidth,
- unsigned int part2_length)
+ struct channel *channel,
+ unsigned char const *sfbwidth,
+ unsigned int part2_length)
{
- signed int exponents[39], exp;
- signed int const *expptr;
- struct mad_bitptr peek;
- signed int bits_left, cachesz;
- register mad_fixed_t *xrptr;
- mad_fixed_t const *sfbound;
- register unsigned long bitcache;
+ signed int exponents[39], exp;
+ signed int const *expptr;
+ struct mad_bitptr peek;
+ signed int bits_left, cachesz;
+ register mad_fixed_t *xrptr;
+ mad_fixed_t const *sfbound;
+ register unsigned long bitcache;
- bits_left = (signed) channel->part2_3_length - (signed) part2_length;
- if(bits_left < 0)
- return MAD_ERROR_BADPART3LEN;
+ bits_left = (signed) channel->part2_3_length - (signed) part2_length;
+ if (bits_left < 0)
+ return MAD_ERROR_BADPART3LEN;
- III_exponents(channel, sfbwidth, exponents);
+ III_exponents(channel, sfbwidth, exponents);
- peek = *ptr;
- mad_bit_skip(ptr, bits_left);
+ peek = *ptr;
+ mad_bit_skip(ptr, bits_left);
- /* align bit reads to byte boundaries */
- cachesz = mad_bit_bitsleft(&peek);
- cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
+ /* align bit reads to byte boundaries */
+ cachesz = mad_bit_bitsleft(&peek);
+ cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
- bitcache = mad_bit_read(&peek, cachesz);
- bits_left -= cachesz;
+ bitcache = mad_bit_read(&peek, cachesz);
+ bits_left -= cachesz;
- xrptr = &xr[0];
+ xrptr = &xr[0];
- /* big_values */
- {
- unsigned int region, rcount;
- struct hufftable const *entry;
- union huffpair const *table;
- unsigned int linbits, startbits, big_values, reqhits;
- mad_fixed_t reqcache[16];
-
- sfbound = xrptr + *sfbwidth++;
- rcount = channel->region0_count + 1;
-
- entry = &mad_huff_pair_table[channel->table_select[region = 0]];
- table = entry->table;
- linbits = entry->linbits;
- startbits = entry->startbits;
-
- if(table == 0)
- return MAD_ERROR_BADHUFFTABLE;
-
- expptr = &exponents[0];
- exp = *expptr++;
- reqhits = 0;
-
- big_values = channel->big_values;
-
- while(big_values-- && cachesz + bits_left > 0)
- {
- union huffpair const *pair;
- unsigned int clumpsz, value;
- register mad_fixed_t requantized;
-
- if(xrptr == sfbound)
- {
- sfbound += *sfbwidth++;
-
- /* change table if region boundary */
-
- if(--rcount == 0)
- {
- if(region == 0)
- rcount = channel->region1_count + 1;
- else
- rcount = 0; /* all remaining */
-
- entry = &mad_huff_pair_table[channel->table_select[++region]];
- table = entry->table;
- linbits = entry->linbits;
- startbits = entry->startbits;
-
- if(table == 0)
- return MAD_ERROR_BADHUFFTABLE;
- }
-
- if(exp != *expptr)
- {
- exp = *expptr;
- reqhits = 0;
- }
-
- ++expptr;
- }
-
- if(cachesz < 21)
- {
- unsigned int bits;
-
- bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
- bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
- cachesz += bits;
- bits_left -= bits;
- }
-
- /* hcod (0..19) */
-
- clumpsz = startbits;
- pair = &table[MASK(bitcache, cachesz, clumpsz)];
-
- while(!pair->final)
- {
- cachesz -= clumpsz;
-
- clumpsz = pair->ptr.bits;
- pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)];
- }
-
- cachesz -= pair->value.hlen;
-
- if(linbits)
- {
- /* x (0..14) */
-
- value = pair->value.x;
-
- switch(value)
- {
- case 0:
- xrptr[0] = 0;
- break;
-
- case 15:
- if(cachesz < linbits + 2)
- {
- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
- cachesz += 16;
- bits_left -= 16;
- }
-
- value += MASK(bitcache, cachesz, linbits);
- cachesz -= linbits;
-
- requantized = III_requantize(value, exp);
- goto x_final;
-
- default:
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
-x_final:
- xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
-
- /* y (0..14) */
-
- value = pair->value.y;
-
- switch(value)
- {
- case 0:
- xrptr[1] = 0;
- break;
-
- case 15:
- if(cachesz < linbits + 1)
- {
- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
- cachesz += 16;
- bits_left -= 16;
- }
-
- value += MASK(bitcache, cachesz, linbits);
- cachesz -= linbits;
-
- requantized = III_requantize(value, exp);
- goto y_final;
-
- default:
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
-y_final:
- xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
- }
- else
- {
- /* x (0..1) */
-
- value = pair->value.x;
-
- if(value == 0)
- xrptr[0] = 0;
- else
- {
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
- xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
-
- /* y (0..1) */
-
- value = pair->value.y;
-
- if(value == 0)
- xrptr[1] = 0;
- else
- {
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
- xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
- }
-
- xrptr += 2;
- }
+ /* big_values */
+ {
+ unsigned int region, rcount;
+ struct hufftable const *entry;
+ union huffpair const *table;
+ unsigned int linbits, startbits, big_values, reqhits;
+ mad_fixed_t reqcache[16];
+
+ sfbound = xrptr + *sfbwidth++;
+ rcount = channel->region0_count + 1;
+
+ entry = &mad_huff_pair_table[channel->table_select[region = 0]];
+ table = entry->table;
+ linbits = entry->linbits;
+ startbits = entry->startbits;
+
+ if (table == 0)
+ return MAD_ERROR_BADHUFFTABLE;
+
+ expptr = &exponents[0];
+ exp = *expptr++;
+ reqhits = 0;
+
+ big_values = channel->big_values;
+
+ while (big_values-- && cachesz + bits_left > 0) {
+ union huffpair const *pair;
+ unsigned int clumpsz, value;
+ register mad_fixed_t requantized;
+
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
+
+ /* change table if region boundary */
+
+ if (--rcount == 0) {
+ if (region == 0)
+ rcount = channel->region1_count + 1;
+ else
+ rcount = 0; /* all remaining */
+
+ entry = &mad_huff_pair_table[channel->table_select[++region]];
+ table = entry->table;
+ linbits = entry->linbits;
+ startbits = entry->startbits;
+
+ if (table == 0)
+ return MAD_ERROR_BADHUFFTABLE;
+ }
+
+ if (exp != *expptr) {
+ exp = *expptr;
+ reqhits = 0;
+ }
+
+ ++expptr;
+ }
+
+ if (cachesz < 21) {
+ unsigned int bits;
+
+ bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
+ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
+ cachesz += bits;
+ bits_left -= bits;
+ }
+
+ /* hcod (0..19) */
+
+ clumpsz = startbits;
+ pair = &table[MASK(bitcache, cachesz, clumpsz)];
+
+ while (!pair->final) {
+ cachesz -= clumpsz;
+
+ clumpsz = pair->ptr.bits;
+ pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)];
+ }
+
+ cachesz -= pair->value.hlen;
+
+ if (linbits) {
+ /* x (0..14) */
+
+ value = pair->value.x;
+
+ switch (value) {
+ case 0:
+ xrptr[0] = 0;
+ break;
+
+ case 15:
+ if (cachesz < linbits + 2) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+
+ requantized = III_requantize(value, exp);
+ goto x_final;
+
+ default:
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ x_final:
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+
+ /* y (0..14) */
+
+ value = pair->value.y;
+
+ switch (value) {
+ case 0:
+ xrptr[1] = 0;
+ break;
+
+ case 15:
+ if (cachesz < linbits + 1) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+
+ requantized = III_requantize(value, exp);
+ goto y_final;
+
+ default:
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ y_final:
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+ }
+ else {
+ /* x (0..1) */
+
+ value = pair->value.x;
+
+ if (value == 0)
+ xrptr[0] = 0;
+ else {
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+
+ /* y (0..1) */
+
+ value = pair->value.y;
+
+ if (value == 0)
+ xrptr[1] = 0;
+ else {
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+ }
+
+ xrptr += 2;
}
+ }
- if(cachesz + bits_left < 0)
- return MAD_ERROR_BADHUFFDATA; /* big_values overrun */
+ if (cachesz + bits_left < 0)
+ return MAD_ERROR_BADHUFFDATA; /* big_values overrun */
- /* count1 */
- {
- union huffquad const *table;
- register mad_fixed_t requantized;
+ /* count1 */
+ {
+ union huffquad const *table;
+ register mad_fixed_t requantized;
- table = mad_huff_quad_table[channel->flags & count1table_select];
+ table = mad_huff_quad_table[channel->flags & count1table_select];
- requantized = III_requantize(1, exp);
+ requantized = III_requantize(1, exp);
- while(cachesz + bits_left > 0 && xrptr <= &xr[572])
- {
- union huffquad const *quad;
+ while (cachesz + bits_left > 0 && xrptr <= &xr[572]) {
+ union huffquad const *quad;
- /* hcod (1..6) */
+ /* hcod (1..6) */
- if(cachesz < 10)
- {
- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
- cachesz += 16;
- bits_left -= 16;
- }
+ if (cachesz < 10) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
- quad = &table[MASK(bitcache, cachesz, 4)];
+ quad = &table[MASK(bitcache, cachesz, 4)];
- /* quad tables guaranteed to have at most one extra lookup */
- if(!quad->final)
- {
- cachesz -= 4;
+ /* quad tables guaranteed to have at most one extra lookup */
+ if (!quad->final) {
+ cachesz -= 4;
- quad = &table[quad->ptr.offset +
- MASK(bitcache, cachesz, quad->ptr.bits)];
- }
+ quad = &table[quad->ptr.offset +
+ MASK(bitcache, cachesz, quad->ptr.bits)];
+ }
- cachesz -= quad->value.hlen;
+ cachesz -= quad->value.hlen;
- if(xrptr == sfbound)
- {
- sfbound += *sfbwidth++;
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
- if(exp != *expptr)
- {
- exp = *expptr;
- requantized = III_requantize(1, exp);
- }
+ if (exp != *expptr) {
+ exp = *expptr;
+ requantized = III_requantize(1, exp);
+ }
- ++expptr;
- }
+ ++expptr;
+ }
- /* v (0..1) */
+ /* v (0..1) */
- xrptr[0] = quad->value.v ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[0] = quad->value.v ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- /* w (0..1) */
+ /* w (0..1) */
- xrptr[1] = quad->value.w ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[1] = quad->value.w ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- xrptr += 2;
+ xrptr += 2;
- if(xrptr == sfbound)
- {
- sfbound += *sfbwidth++;
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
- if(exp != *expptr)
- {
- exp = *expptr;
- requantized = III_requantize(1, exp);
- }
+ if (exp != *expptr) {
+ exp = *expptr;
+ requantized = III_requantize(1, exp);
+ }
- ++expptr;
- }
+ ++expptr;
+ }
- /* x (0..1) */
+ /* x (0..1) */
- xrptr[0] = quad->value.x ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[0] = quad->value.x ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- /* y (0..1) */
+ /* y (0..1) */
- xrptr[1] = quad->value.y ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[1] = quad->value.y ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- xrptr += 2;
- }
+ xrptr += 2;
+ }
- if(cachesz + bits_left < 0)
- {
+ if (cachesz + bits_left < 0) {
# if 0 && defined(DEBUG)
- fprintf(stderr, "huffman count1 overrun (%d bits)\n",
- -(cachesz + bits_left));
+ fprintf(stderr, "huffman count1 overrun (%d bits)\n",
+ -(cachesz + bits_left));
# endif
- /* technically the bitstream is misformatted, but apparently
- some encoders are just a bit sloppy with stuffing bits */
+ /* technically the bitstream is misformatted, but apparently
+ some encoders are just a bit sloppy with stuffing bits */
- xrptr -= 4;
- }
+ xrptr -= 4;
}
+ }
- assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
+ assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
# if 0 && defined(DEBUG)
- if(bits_left < 0)
- fprintf(stderr, "read %d bits too many\n", -bits_left);
- else if(cachesz + bits_left > 0)
- fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left);
+ if (bits_left < 0)
+ fprintf(stderr, "read %d bits too many\n", -bits_left);
+ else if (cachesz + bits_left > 0)
+ fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left);
# endif
- /* rzero */
- while(xrptr < &xr[576])
- {
- xrptr[0] = 0;
- xrptr[1] = 0;
+ /* rzero */
+ while (xrptr < &xr[576]) {
+ xrptr[0] = 0;
+ xrptr[1] = 0;
- xrptr += 2;
- }
+ xrptr += 2;
+ }
- return MAD_ERROR_NONE;
+ return MAD_ERROR_NONE;
}
# undef MASK
@@ -1393,50 +1278,45 @@ y_final:
*/
static
void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
- unsigned char const sfbwidth[39])
+ unsigned char const sfbwidth[39])
{
- mad_fixed_t tmp[32][3][6];
- unsigned int sb, l, f, w, sbw[3], sw[3];
+ mad_fixed_t tmp[32][3][6];
+ unsigned int sb, l, f, w, sbw[3], sw[3];
- /* this is probably wrong for 8000 Hz mixed blocks */
+ /* this is probably wrong for 8000 Hz mixed blocks */
- sb = 0;
- if(channel->flags & mixed_block_flag)
- {
- sb = 2;
+ sb = 0;
+ if (channel->flags & mixed_block_flag) {
+ sb = 2;
- l = 0;
- while(l < 36)
- l += *sfbwidth++;
- }
+ l = 0;
+ while (l < 36)
+ l += *sfbwidth++;
+ }
- for(w = 0; w < 3; ++w)
- {
- sbw[w] = sb;
- sw[w] = 0;
+ for (w = 0; w < 3; ++w) {
+ sbw[w] = sb;
+ sw[w] = 0;
+ }
+
+ f = *sfbwidth++;
+ w = 0;
+
+ for (l = 18 * sb; l < 576; ++l) {
+ if (f-- == 0) {
+ f = *sfbwidth++ - 1;
+ w = (w + 1) % 3;
}
- f = *sfbwidth++;
- w = 0;
+ tmp[sbw[w]][w][sw[w]++] = xr[l];
- for(l = 18 * sb; l < 576; ++l)
- {
- if(f-- == 0)
- {
- f = *sfbwidth++ - 1;
- w = (w + 1) % 3;
- }
-
- tmp[sbw[w]][w][sw[w]++] = xr[l];
-
- if(sw[w] == 6)
- {
- sw[w] = 0;
- ++sbw[w];
- }
+ if (sw[w] == 6) {
+ sw[w] = 0;
+ ++sbw[w];
}
+ }
- memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t));
+ memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t));
}
/*
@@ -1445,238 +1325,211 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
*/
static
enum mad_error III_stereo(mad_fixed_t xr[2][576],
- struct granule const *granule,
- struct mad_header *header,
- unsigned char const *sfbwidth)
+ struct granule const *granule,
+ struct mad_header *header,
+ unsigned char const *sfbwidth)
{
- short modes[39];
- unsigned int sfbi, l, n, i;
+ short modes[39];
+ unsigned int sfbi, l, n, i;
- if(granule->ch[0].block_type !=
- granule->ch[1].block_type ||
- (granule->ch[0].flags & mixed_block_flag) !=
- (granule->ch[1].flags & mixed_block_flag))
- return MAD_ERROR_BADSTEREO;
+ if (granule->ch[0].block_type !=
+ granule->ch[1].block_type ||
+ (granule->ch[0].flags & mixed_block_flag) !=
+ (granule->ch[1].flags & mixed_block_flag))
+ return MAD_ERROR_BADSTEREO;
- for(i = 0; i < 39; ++i)
- modes[i] = header->mode_extension;
+ for (i = 0; i < 39; ++i)
+ modes[i] = header->mode_extension;
- /* intensity stereo */
+ /* intensity stereo */
- if(header->mode_extension & I_STEREO)
- {
- struct channel const *right_ch = &granule->ch[1];
- mad_fixed_t const *right_xr = xr[1];
- unsigned int is_pos;
-
- header->flags |= MAD_FLAG_I_STEREO;
-
- /* first determine which scalefactor bands are to be processed */
-
- if(right_ch->block_type == 2)
- {
- unsigned int lower, start, max, bound[3], w;
-
- lower = start = max = bound[0] = bound[1] = bound[2] = 0;
-
- sfbi = l = 0;
-
- if(right_ch->flags & mixed_block_flag)
- {
- while(l < 36)
- {
- n = sfbwidth[sfbi++];
-
- for(i = 0; i < n; ++i)
- {
- if(right_xr[i])
- {
- lower = sfbi;
- break;
- }
- }
-
- right_xr += n;
- l += n;
- }
-
- start = sfbi;
- }
-
- w = 0;
- while(l < 576)
- {
- n = sfbwidth[sfbi++];
-
- for(i = 0; i < n; ++i)
- {
- if(right_xr[i])
- {
- max = bound[w] = sfbi;
- break;
- }
- }
-
- right_xr += n;
- l += n;
- w = (w + 1) % 3;
- }
-
- if(max)
- lower = start;
-
- /* long blocks */
-
- for(i = 0; i < lower; ++i)
- modes[i] = header->mode_extension & ~I_STEREO;
-
- /* short blocks */
-
- w = 0;
- for(i = start; i < max; ++i)
- {
- if(i < bound[w])
- modes[i] = header->mode_extension & ~I_STEREO;
-
- w = (w + 1) % 3;
- }
- }
- else /* right_ch->block_type != 2 */
- {
- unsigned int bound;
-
- bound = 0;
- for(sfbi = l = 0; l < 576; l += n)
- {
- n = sfbwidth[sfbi++];
-
- for(i = 0; i < n; ++i)
- {
- if(right_xr[i])
- {
- bound = sfbi;
- break;
- }
- }
-
- right_xr += n;
- }
-
- for(i = 0; i < bound; ++i)
- modes[i] = header->mode_extension & ~I_STEREO;
- }
-
- /* now do the actual processing */
-
- if(header->flags & MAD_FLAG_LSF_EXT)
- {
- unsigned char const *illegal_pos = granule[1].ch[1].scalefac;
- mad_fixed_t const *lsf_scale;
-
- /* intensity_scale */
- lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1];
-
- for(sfbi = l = 0; l < 576; ++sfbi, l += n)
- {
- n = sfbwidth[sfbi];
-
- if(!(modes[sfbi] & I_STEREO))
- continue;
-
- if(illegal_pos[sfbi])
- {
- modes[sfbi] &= ~I_STEREO;
- continue;
- }
-
- is_pos = right_ch->scalefac[sfbi];
-
- for(i = 0; i < n; ++i)
- {
- register mad_fixed_t left;
-
- left = xr[0][l + i];
-
- if(is_pos == 0)
- xr[1][l + i] = left;
- else
- {
- register mad_fixed_t opposite;
-
- opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]);
-
- if(is_pos & 1)
- {
- xr[0][l + i] = opposite;
- xr[1][l + i] = left;
- }
- else
- xr[1][l + i] = opposite;
- }
- }
- }
- }
- else /* !(header->flags & MAD_FLAG_LSF_EXT) */
- {
- for(sfbi = l = 0; l < 576; ++sfbi, l += n)
- {
- n = sfbwidth[sfbi];
-
- if(!(modes[sfbi] & I_STEREO))
- continue;
-
- is_pos = right_ch->scalefac[sfbi];
-
- if(is_pos >= 7) /* illegal intensity position */
- {
- modes[sfbi] &= ~I_STEREO;
- continue;
- }
-
- for(i = 0; i < n; ++i)
- {
- register mad_fixed_t left;
-
- left = xr[0][l + i];
-
- xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]);
- xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]);
- }
- }
- }
+ if (header->mode_extension & I_STEREO) {
+ struct channel const *right_ch = &granule->ch[1];
+ mad_fixed_t const *right_xr = xr[1];
+ unsigned int is_pos;
+
+ header->flags |= MAD_FLAG_I_STEREO;
+
+ /* first determine which scalefactor bands are to be processed */
+
+ if (right_ch->block_type == 2) {
+ unsigned int lower, start, max, bound[3], w;
+
+ lower = start = max = bound[0] = bound[1] = bound[2] = 0;
+
+ sfbi = l = 0;
+
+ if (right_ch->flags & mixed_block_flag) {
+ while (l < 36) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ lower = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ l += n;
+ }
+
+ start = sfbi;
+ }
+
+ w = 0;
+ while (l < 576) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ max = bound[w] = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ l += n;
+ w = (w + 1) % 3;
+ }
+
+ if (max)
+ lower = start;
+
+ /* long blocks */
+
+ for (i = 0; i < lower; ++i)
+ modes[i] = header->mode_extension & ~I_STEREO;
+
+ /* short blocks */
+
+ w = 0;
+ for (i = start; i < max; ++i) {
+ if (i < bound[w])
+ modes[i] = header->mode_extension & ~I_STEREO;
+
+ w = (w + 1) % 3;
+ }
}
+ else { /* right_ch->block_type != 2 */
+ unsigned int bound;
- /* middle/side stereo */
+ bound = 0;
+ for (sfbi = l = 0; l < 576; l += n) {
+ n = sfbwidth[sfbi++];
- if(header->mode_extension & MS_STEREO)
- {
- register mad_fixed_t invsqrt2;
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ bound = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ }
+
+ for (i = 0; i < bound; ++i)
+ modes[i] = header->mode_extension & ~I_STEREO;
+ }
+
+ /* now do the actual processing */
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ unsigned char const *illegal_pos = granule[1].ch[1].scalefac;
+ mad_fixed_t const *lsf_scale;
+
+ /* intensity_scale */
+ lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1];
+
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (!(modes[sfbi] & I_STEREO))
+ continue;
- header->flags |= MAD_FLAG_MS_STEREO;
+ if (illegal_pos[sfbi]) {
+ modes[sfbi] &= ~I_STEREO;
+ continue;
+ }
- invsqrt2 = root_table[3 + -2];
+ is_pos = right_ch->scalefac[sfbi];
- for(sfbi = l = 0; l < 576; ++sfbi, l += n)
- {
- n = sfbwidth[sfbi];
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t left;
- if(modes[sfbi] != MS_STEREO)
- continue;
+ left = xr[0][l + i];
- for(i = 0; i < n; ++i)
- {
- register mad_fixed_t m, s;
+ if (is_pos == 0)
+ xr[1][l + i] = left;
+ else {
+ register mad_fixed_t opposite;
- m = xr[0][l + i];
- s = xr[1][l + i];
+ opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]);
- xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */
- xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */
- }
- }
+ if (is_pos & 1) {
+ xr[0][l + i] = opposite;
+ xr[1][l + i] = left;
+ }
+ else
+ xr[1][l + i] = opposite;
+ }
+ }
+ }
}
+ else { /* !(header->flags & MAD_FLAG_LSF_EXT) */
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (!(modes[sfbi] & I_STEREO))
+ continue;
+
+ is_pos = right_ch->scalefac[sfbi];
+
+ if (is_pos >= 7) { /* illegal intensity position */
+ modes[sfbi] &= ~I_STEREO;
+ continue;
+ }
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t left;
+
+ left = xr[0][l + i];
+
+ xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]);
+ xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]);
+ }
+ }
+ }
+ }
+
+ /* middle/side stereo */
+
+ if (header->mode_extension & MS_STEREO) {
+ register mad_fixed_t invsqrt2;
- return MAD_ERROR_NONE;
+ header->flags |= MAD_FLAG_MS_STEREO;
+
+ invsqrt2 = root_table[3 + -2];
+
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (modes[sfbi] != MS_STEREO)
+ continue;
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t m, s;
+
+ m = xr[0][l + i];
+ s = xr[1][l + i];
+
+ xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */
+ xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */
+ }
+ }
+ }
+
+ return MAD_ERROR_NONE;
}
/*
@@ -1686,39 +1539,36 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
static
void III_aliasreduce(mad_fixed_t xr[576], int lines)
{
- mad_fixed_t const *bound;
- int i;
+ mad_fixed_t const *bound;
+ int i;
- bound = &xr[lines];
- for(xr += 18; xr < bound; xr += 18)
- {
- for(i = 0; i < 8; ++i)
- {
- register mad_fixed_t a, b;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
+ bound = &xr[lines];
+ for (xr += 18; xr < bound; xr += 18) {
+ for (i = 0; i < 8; ++i) {
+ register mad_fixed_t a, b;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
- a = xr[-1 - i];
- b = xr[ i];
+ a = xr[-1 - i];
+ b = xr[ i];
# if defined(ASO_ZEROCHECK)
- if(a | b)
- {
+ if (a | b) {
# endif
- MAD_F_ML0(hi, lo, a, cs[i]);
- MAD_F_MLA(hi, lo, -b, ca[i]);
+ MAD_F_ML0(hi, lo, a, cs[i]);
+ MAD_F_MLA(hi, lo, -b, ca[i]);
- xr[-1 - i] = MAD_F_MLZ(hi, lo);
+ xr[-1 - i] = MAD_F_MLZ(hi, lo);
- MAD_F_ML0(hi, lo, b, cs[i]);
- MAD_F_MLA(hi, lo, a, ca[i]);
+ MAD_F_ML0(hi, lo, b, cs[i]);
+ MAD_F_MLA(hi, lo, a, ca[i]);
- xr[ i] = MAD_F_MLZ(hi, lo);
+ xr[ i] = MAD_F_MLZ(hi, lo);
# if defined(ASO_ZEROCHECK)
- }
+ }
# endif
- }
}
+ }
}
# if defined(ASO_IMDCT)
@@ -1728,162 +1578,154 @@ void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int);
static
void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[18])
{
- mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
- mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25;
- mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7;
-
- enum
- {
- c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */
- c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */
- c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */
- c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */
- c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */
- c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */
- c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */
- };
-
- a0 = x[3] + x[5];
- a1 = x[3] - x[5];
- a2 = x[6] + x[2];
- a3 = x[6] - x[2];
- a4 = x[1] + x[7];
- a5 = x[1] - x[7];
- a6 = x[8] + x[0];
- a7 = x[8] - x[0];
-
- a8 = a0 + a2;
- a9 = a0 - a2;
- a10 = a0 - a6;
- a11 = a2 - a6;
- a12 = a8 + a6;
- a13 = a1 - a3;
- a14 = a13 + a7;
- a15 = a3 + a7;
- a16 = a1 - a7;
- a17 = a1 + a3;
-
- m0 = mad_f_mul(a17, -c3);
- m1 = mad_f_mul(a16, -c0);
- m2 = mad_f_mul(a15, -c4);
- m3 = mad_f_mul(a14, -c1);
- m4 = mad_f_mul(a5, -c1);
- m5 = mad_f_mul(a11, -c6);
- m6 = mad_f_mul(a10, -c5);
- m7 = mad_f_mul(a9, -c2);
-
- a18 = x[4] + a4;
- a19 = 2 * x[4] - a4;
- a20 = a19 + m5;
- a21 = a19 - m5;
- a22 = a19 + m6;
- a23 = m4 + m2;
- a24 = m4 - m2;
- a25 = m4 + m1;
-
- /* output to every other slot for convenience */
-
- y[ 0] = a18 + a12;
- y[ 2] = m0 - a25;
- y[ 4] = m7 - a20;
- y[ 6] = m3;
- y[ 8] = a21 - m6;
- y[10] = a24 - m1;
- y[12] = a12 - 2 * a18;
- y[14] = a23 + m0;
- y[16] = a22 + m7;
+ mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
+ mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25;
+ mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7;
+
+ enum {
+ c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */
+ c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */
+ c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */
+ c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */
+ c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */
+ c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */
+ c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */
+ };
+
+ a0 = x[3] + x[5];
+ a1 = x[3] - x[5];
+ a2 = x[6] + x[2];
+ a3 = x[6] - x[2];
+ a4 = x[1] + x[7];
+ a5 = x[1] - x[7];
+ a6 = x[8] + x[0];
+ a7 = x[8] - x[0];
+
+ a8 = a0 + a2;
+ a9 = a0 - a2;
+ a10 = a0 - a6;
+ a11 = a2 - a6;
+ a12 = a8 + a6;
+ a13 = a1 - a3;
+ a14 = a13 + a7;
+ a15 = a3 + a7;
+ a16 = a1 - a7;
+ a17 = a1 + a3;
+
+ m0 = mad_f_mul(a17, -c3);
+ m1 = mad_f_mul(a16, -c0);
+ m2 = mad_f_mul(a15, -c4);
+ m3 = mad_f_mul(a14, -c1);
+ m4 = mad_f_mul(a5, -c1);
+ m5 = mad_f_mul(a11, -c6);
+ m6 = mad_f_mul(a10, -c5);
+ m7 = mad_f_mul(a9, -c2);
+
+ a18 = x[4] + a4;
+ a19 = 2 * x[4] - a4;
+ a20 = a19 + m5;
+ a21 = a19 - m5;
+ a22 = a19 + m6;
+ a23 = m4 + m2;
+ a24 = m4 - m2;
+ a25 = m4 + m1;
+
+ /* output to every other slot for convenience */
+
+ y[ 0] = a18 + a12;
+ y[ 2] = m0 - a25;
+ y[ 4] = m7 - a20;
+ y[ 6] = m3;
+ y[ 8] = a21 - m6;
+ y[10] = a24 - m1;
+ y[12] = a12 - 2 * a18;
+ y[14] = a23 + m0;
+ y[16] = a22 + m7;
}
static inline
void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18])
{
- mad_fixed_t tmp[9];
- int i;
+ mad_fixed_t tmp[9];
+ int i;
- /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */
- static mad_fixed_t const scale[9] =
- {
- MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930),
- MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8),
- MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7)
- };
+ /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */
+ static mad_fixed_t const scale[9] = {
+ MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930),
+ MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8),
+ MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7)
+ };
- /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */
+ /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */
- /* even input butterfly */
+ /* even input butterfly */
- for(i = 0; i < 9; i += 3)
- {
- tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1];
- tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1];
- tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1];
- }
+ for (i = 0; i < 9; i += 3) {
+ tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1];
+ tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1];
+ tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1];
+ }
- fastsdct(tmp, &X[0]);
+ fastsdct(tmp, &X[0]);
- /* odd input butterfly and scaling */
+ /* odd input butterfly and scaling */
- for(i = 0; i < 9; i += 3)
- {
- tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]);
- tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]);
- tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]);
- }
+ for (i = 0; i < 9; i += 3) {
+ tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]);
+ tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]);
+ tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]);
+ }
- fastsdct(tmp, &X[1]);
+ fastsdct(tmp, &X[1]);
- /* output accumulation */
+ /* output accumulation */
- for(i = 3; i < 18; i += 8)
- {
- X[i + 0] -= X[(i + 0) - 2];
- X[i + 2] -= X[(i + 2) - 2];
- X[i + 4] -= X[(i + 4) - 2];
- X[i + 6] -= X[(i + 6) - 2];
- }
+ for (i = 3; i < 18; i += 8) {
+ X[i + 0] -= X[(i + 0) - 2];
+ X[i + 2] -= X[(i + 2) - 2];
+ X[i + 4] -= X[(i + 4) - 2];
+ X[i + 6] -= X[(i + 6) - 2];
+ }
}
static inline
void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18])
{
- mad_fixed_t tmp[18];
- int i;
-
- /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */
- static mad_fixed_t const scale[18] =
- {
- MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120),
- MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b),
- MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4),
- MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3),
- MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5),
- MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c)
- };
-
- /* scaling */
-
- for(i = 0; i < 18; i += 3)
- {
- tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]);
- tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]);
- tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]);
- }
-
- /* SDCT-II */
-
- sdctII(tmp, X);
-
- /* scale reduction and output accumulation */
-
- X[0] /= 2;
- for(i = 1; i < 17; i += 4)
- {
- X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1];
- X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1];
- X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1];
- X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1];
- }
- X[17] = X[17] / 2 - X[16];
+ mad_fixed_t tmp[18];
+ int i;
+
+ /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */
+ static mad_fixed_t const scale[18] = {
+ MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120),
+ MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b),
+ MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4),
+ MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3),
+ MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5),
+ MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c)
+ };
+
+ /* scaling */
+
+ for (i = 0; i < 18; i += 3) {
+ tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]);
+ tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]);
+ tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]);
+ }
+
+ /* SDCT-II */
+
+ sdctII(tmp, X);
+
+ /* scale reduction and output accumulation */
+
+ X[0] /= 2;
+ for (i = 1; i < 17; i += 4) {
+ X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1];
+ X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1];
+ X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1];
+ X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1];
+ }
+ X[17] = X[17] / 2 - X[16];
}
/*
@@ -1893,33 +1735,30 @@ void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18])
static inline
void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36])
{
- mad_fixed_t tmp[18];
- int i;
-
- /* DCT-IV */
-
- dctIV(x, tmp);
-
- /* convert 18-point DCT-IV to 36-point IMDCT */
-
- for(i = 0; i < 9; i += 3)
- {
- y[i + 0] = tmp[9 + (i + 0)];
- y[i + 1] = tmp[9 + (i + 1)];
- y[i + 2] = tmp[9 + (i + 2)];
- }
- for(i = 9; i < 27; i += 3)
- {
- y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1];
- y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1];
- y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1];
- }
- for(i = 27; i < 36; i += 3)
- {
- y[i + 0] = -tmp[(i + 0) - 27];
- y[i + 1] = -tmp[(i + 1) - 27];
- y[i + 2] = -tmp[(i + 2) - 27];
- }
+ mad_fixed_t tmp[18];
+ int i;
+
+ /* DCT-IV */
+
+ dctIV(x, tmp);
+
+ /* convert 18-point DCT-IV to 36-point IMDCT */
+
+ for (i = 0; i < 9; i += 3) {
+ y[i + 0] = tmp[9 + (i + 0)];
+ y[i + 1] = tmp[9 + (i + 1)];
+ y[i + 2] = tmp[9 + (i + 2)];
+ }
+ for (i = 9; i < 27; i += 3) {
+ y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1];
+ y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1];
+ y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1];
+ }
+ for (i = 27; i < 36; i += 3) {
+ y[i + 0] = -tmp[(i + 0) - 27];
+ y[i + 1] = -tmp[(i + 1) - 27];
+ y[i + 2] = -tmp[(i + 2) - 27];
+ }
}
# else
/*
@@ -1929,288 +1768,288 @@ void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36])
static inline
void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36])
{
- mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
- mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8));
- MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa));
-
- t6 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa));
- MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8));
-
- t0 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549));
-
- x[7] = MAD_F_MLZ(hi, lo);
- x[10] = -x[7];
-
- MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0));
-
- x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0;
-
- t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15];
- t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17];
-
- MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8));
- MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa));
-
- x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0;
-
- MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346));
-
- t1 = MAD_F_MLZ(hi, lo) + t6;
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890));
-
- x[6] = MAD_F_MLZ(hi, lo) + t1;
- x[11] = -x[6];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2));
-
- x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1;
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad));
-
- x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1;
-
- MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa));
- MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8));
-
- t7 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0));
-
- t2 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5));
-
- x[5] = MAD_F_MLZ(hi, lo);
- x[12] = -x[5];
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352));
-
- x[0] = MAD_F_MLZ(hi, lo) + t2;
- x[17] = -x[0];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962));
-
- x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2;
-
- MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549));
-
- t3 = MAD_F_MLZ(hi, lo) + t7;
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd));
-
- x[8] = MAD_F_MLZ(hi, lo) + t3;
- x[9] = -x[8];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284));
-
- x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3;
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779));
-
- x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3;
-
- MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8));
- MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa));
-
- t4 = MAD_F_MLZ(hi, lo) - t7;
-
- MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa));
- MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8));
-
- x[4] = MAD_F_MLZ(hi, lo) + t4;
- x[13] = -x[4];
-
- MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346));
-
- x[1] = MAD_F_MLZ(hi, lo) + t4;
- x[16] = -x[1];
-
- MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2));
-
- x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4;
-
- MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2));
-
- t5 = MAD_F_MLZ(hi, lo) - t6;
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807));
-
- x[2] = MAD_F_MLZ(hi, lo) + t5;
- x[15] = -x[2];
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245));
-
- x[3] = MAD_F_MLZ(hi, lo) + t5;
- x[14] = -x[3];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e));
-
- x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5;
+ mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
+ mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa));
+
+ t6 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8));
+
+ t0 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549));
+
+ x[7] = MAD_F_MLZ(hi, lo);
+ x[10] = -x[7];
+
+ MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0));
+
+ x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0;
+
+ t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15];
+ t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17];
+
+ MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa));
+
+ x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346));
+
+ t1 = MAD_F_MLZ(hi, lo) + t6;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890));
+
+ x[6] = MAD_F_MLZ(hi, lo) + t1;
+ x[11] = -x[6];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2));
+
+ x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1;
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad));
+
+ x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1;
+
+ MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8));
+
+ t7 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0));
+
+ t2 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5));
+
+ x[5] = MAD_F_MLZ(hi, lo);
+ x[12] = -x[5];
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352));
+
+ x[0] = MAD_F_MLZ(hi, lo) + t2;
+ x[17] = -x[0];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962));
+
+ x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549));
+
+ t3 = MAD_F_MLZ(hi, lo) + t7;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd));
+
+ x[8] = MAD_F_MLZ(hi, lo) + t3;
+ x[9] = -x[8];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284));
+
+ x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3;
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779));
+
+ x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3;
+
+ MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa));
+
+ t4 = MAD_F_MLZ(hi, lo) - t7;
+
+ MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8));
+
+ x[4] = MAD_F_MLZ(hi, lo) + t4;
+ x[13] = -x[4];
+
+ MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346));
+
+ x[1] = MAD_F_MLZ(hi, lo) + t4;
+ x[16] = -x[1];
+
+ MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2));
+
+ x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2));
+
+ t5 = MAD_F_MLZ(hi, lo) - t6;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807));
+
+ x[2] = MAD_F_MLZ(hi, lo) + t5;
+ x[15] = -x[2];
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245));
+
+ x[3] = MAD_F_MLZ(hi, lo) + t5;
+ x[14] = -x[3];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e));
+
+ x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5;
}
# endif
@@ -2220,90 +2059,84 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36])
*/
static
void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36],
- unsigned int block_type)
+ unsigned int block_type)
{
- unsigned int i;
+ unsigned int i;
- /* IMDCT */
+ /* IMDCT */
- imdct36(X, z);
+ imdct36(X, z);
- /* windowing */
+ /* windowing */
- switch(block_type)
- {
- case 0: /* normal window */
+ switch (block_type) {
+ case 0: /* normal window */
# if defined(ASO_INTERLEAVE1)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = window_l[0];
- tmp2 = window_l[1];
-
- for(i = 0; i < 34; i += 2)
- {
- z[i + 0] = mad_f_mul(z[i + 0], tmp1);
- tmp1 = window_l[i + 2];
- z[i + 1] = mad_f_mul(z[i + 1], tmp2);
- tmp2 = window_l[i + 3];
- }
-
- z[34] = mad_f_mul(z[34], tmp1);
- z[35] = mad_f_mul(z[35], tmp2);
- }
-# elif defined(ASO_INTERLEAVE2)
-{
- register mad_fixed_t tmp1, tmp2;
+ {
+ register mad_fixed_t tmp1, tmp2;
- tmp1 = z[0];
- tmp2 = window_l[0];
+ tmp1 = window_l[0];
+ tmp2 = window_l[1];
- for(i = 0; i < 35; ++i)
- {
- z[i] = mad_f_mul(tmp1, tmp2);
- tmp1 = z[i + 1];
- tmp2 = window_l[i + 1];
+ for (i = 0; i < 34; i += 2) {
+ z[i + 0] = mad_f_mul(z[i + 0], tmp1);
+ tmp1 = window_l[i + 2];
+ z[i + 1] = mad_f_mul(z[i + 1], tmp2);
+ tmp2 = window_l[i + 3];
+ }
+
+ z[34] = mad_f_mul(z[34], tmp1);
+ z[35] = mad_f_mul(z[35], tmp2);
}
+# elif defined(ASO_INTERLEAVE2)
+ {
+ register mad_fixed_t tmp1, tmp2;
- z[35] = mad_f_mul(tmp1, tmp2);
-}
+ tmp1 = z[0];
+ tmp2 = window_l[0];
+
+ for (i = 0; i < 35; ++i) {
+ z[i] = mad_f_mul(tmp1, tmp2);
+ tmp1 = z[i + 1];
+ tmp2 = window_l[i + 1];
+ }
+
+ z[35] = mad_f_mul(tmp1, tmp2);
+ }
# elif 1
-for(i = 0; i < 36; i += 4)
-{
- z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
- z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
- z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
- z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]);
-}
+ for (i = 0; i < 36; i += 4) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
+ z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]);
+ }
# else
-for(i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
+ for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
# endif
- break;
-
- case 1: /* start block */
- for(i = 0; i < 18; i += 3)
- {
- z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
- z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
- z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
- }
- /* (i = 18; i < 24; ++i) z[i] unchanged */
- for(i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]);
- for(i = 30; i < 36; ++i) z[i] = 0;
- break;
-
- case 3: /* stop block */
- for(i = 0; i < 6; ++i) z[i] = 0;
- for(i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]);
- /* (i = 12; i < 18; ++i) z[i] unchanged */
- for(i = 18; i < 36; i += 3)
- {
- z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
- z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
- z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
- }
- break;
+ break;
+
+ case 1: /* start block */
+ for (i = 0; i < 18; i += 3) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
}
+ /* (i = 18; i < 24; ++i) z[i] unchanged */
+ for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]);
+ for (i = 30; i < 36; ++i) z[i] = 0;
+ break;
+
+ case 3: /* stop block */
+ for (i = 0; i < 6; ++i) z[i] = 0;
+ for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]);
+ /* (i = 12; i < 18; ++i) z[i] unchanged */
+ for (i = 18; i < 36; i += 3) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
+ }
+ break;
+ }
}
# endif /* ASO_IMDCT */
@@ -2314,79 +2147,76 @@ for(i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
static
void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36])
{
- mad_fixed_t y[36], *yptr;
- mad_fixed_t const *wptr;
- int w, i;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- /* IMDCT */
+ mad_fixed_t y[36], *yptr;
+ mad_fixed_t const *wptr;
+ int w, i;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
- yptr = &y[0];
+ /* IMDCT */
- for(w = 0; w < 3; ++w)
- {
- register mad_fixed_t const(*s)[6];
+ yptr = &y[0];
- s = imdct_s;
+ for (w = 0; w < 3; ++w) {
+ register mad_fixed_t const (*s)[6];
- for(i = 0; i < 3; ++i)
- {
- MAD_F_ML0(hi, lo, X[0], (*s)[0]);
- MAD_F_MLA(hi, lo, X[1], (*s)[1]);
- MAD_F_MLA(hi, lo, X[2], (*s)[2]);
- MAD_F_MLA(hi, lo, X[3], (*s)[3]);
- MAD_F_MLA(hi, lo, X[4], (*s)[4]);
- MAD_F_MLA(hi, lo, X[5], (*s)[5]);
+ s = imdct_s;
- yptr[i + 0] = MAD_F_MLZ(hi, lo);
- yptr[5 - i] = -yptr[i + 0];
+ for (i = 0; i < 3; ++i) {
+ MAD_F_ML0(hi, lo, X[0], (*s)[0]);
+ MAD_F_MLA(hi, lo, X[1], (*s)[1]);
+ MAD_F_MLA(hi, lo, X[2], (*s)[2]);
+ MAD_F_MLA(hi, lo, X[3], (*s)[3]);
+ MAD_F_MLA(hi, lo, X[4], (*s)[4]);
+ MAD_F_MLA(hi, lo, X[5], (*s)[5]);
- ++s;
+ yptr[i + 0] = MAD_F_MLZ(hi, lo);
+ yptr[5 - i] = -yptr[i + 0];
- MAD_F_ML0(hi, lo, X[0], (*s)[0]);
- MAD_F_MLA(hi, lo, X[1], (*s)[1]);
- MAD_F_MLA(hi, lo, X[2], (*s)[2]);
- MAD_F_MLA(hi, lo, X[3], (*s)[3]);
- MAD_F_MLA(hi, lo, X[4], (*s)[4]);
- MAD_F_MLA(hi, lo, X[5], (*s)[5]);
+ ++s;
- yptr[ i + 6] = MAD_F_MLZ(hi, lo);
- yptr[11 - i] = yptr[i + 6];
+ MAD_F_ML0(hi, lo, X[0], (*s)[0]);
+ MAD_F_MLA(hi, lo, X[1], (*s)[1]);
+ MAD_F_MLA(hi, lo, X[2], (*s)[2]);
+ MAD_F_MLA(hi, lo, X[3], (*s)[3]);
+ MAD_F_MLA(hi, lo, X[4], (*s)[4]);
+ MAD_F_MLA(hi, lo, X[5], (*s)[5]);
- ++s;
- }
+ yptr[ i + 6] = MAD_F_MLZ(hi, lo);
+ yptr[11 - i] = yptr[i + 6];
- yptr += 12;
- X += 6;
+ ++s;
}
- /* windowing, overlapping and concatenation */
+ yptr += 12;
+ X += 6;
+ }
- yptr = &y[0];
- wptr = &window_s[0];
+ /* windowing, overlapping and concatenation */
- for(i = 0; i < 6; ++i)
- {
- z[i + 0] = 0;
- z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]);
+ yptr = &y[0];
+ wptr = &window_s[0];
- MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]);
- MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]);
+ for (i = 0; i < 6; ++i) {
+ z[i + 0] = 0;
+ z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]);
- z[i + 12] = MAD_F_MLZ(hi, lo);
+ MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]);
+ MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]);
- MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]);
- MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]);
+ z[i + 12] = MAD_F_MLZ(hi, lo);
- z[i + 18] = MAD_F_MLZ(hi, lo);
+ MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]);
+ MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]);
- z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]);
- z[i + 30] = 0;
+ z[i + 18] = MAD_F_MLZ(hi, lo);
- ++yptr;
- ++wptr;
- }
+ z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]);
+ z[i + 30] = 0;
+
+ ++yptr;
+ ++wptr;
+ }
}
/*
@@ -2395,48 +2225,45 @@ void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36])
*/
static
void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18],
- mad_fixed_t sample[18][32], unsigned int sb)
+ mad_fixed_t sample[18][32], unsigned int sb)
{
- unsigned int i;
+ unsigned int i;
# if defined(ASO_INTERLEAVE2)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = overlap[0];
- tmp2 = overlap[1];
-
- for(i = 0; i < 16; i += 2)
- {
- sample[i + 0][sb] = output[i + 0 + 0] + tmp1;
- overlap[i + 0] = output[i + 0 + 18];
- tmp1 = overlap[i + 2];
-
- sample[i + 1][sb] = output[i + 1 + 0] + tmp2;
- overlap[i + 1] = output[i + 1 + 18];
- tmp2 = overlap[i + 3];
- }
-
- sample[16][sb] = output[16 + 0] + tmp1;
- overlap[16] = output[16 + 18];
- sample[17][sb] = output[17 + 0] + tmp2;
- overlap[17] = output[17 + 18];
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = overlap[0];
+ tmp2 = overlap[1];
+
+ for (i = 0; i < 16; i += 2) {
+ sample[i + 0][sb] = output[i + 0 + 0] + tmp1;
+ overlap[i + 0] = output[i + 0 + 18];
+ tmp1 = overlap[i + 2];
+
+ sample[i + 1][sb] = output[i + 1 + 0] + tmp2;
+ overlap[i + 1] = output[i + 1 + 18];
+ tmp2 = overlap[i + 3];
}
+
+ sample[16][sb] = output[16 + 0] + tmp1;
+ overlap[16] = output[16 + 18];
+ sample[17][sb] = output[17 + 0] + tmp2;
+ overlap[17] = output[17 + 18];
+ }
# elif 0
- for(i = 0; i < 18; i += 2)
- {
- sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0];
- overlap[i + 0] = output[i + 0 + 18];
+ for (i = 0; i < 18; i += 2) {
+ sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0];
+ overlap[i + 0] = output[i + 0 + 18];
- sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1];
- overlap[i + 1] = output[i + 1 + 18];
- }
+ sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1];
+ overlap[i + 1] = output[i + 1 + 18];
+ }
# else
- for(i = 0; i < 18; ++i)
- {
- sample[i][sb] = output[i + 0] + overlap[i];
- overlap[i] = output[i + 18];
- }
+ for (i = 0; i < 18; ++i) {
+ sample[i][sb] = output[i + 0] + overlap[i];
+ overlap[i] = output[i + 18];
+ }
# endif
}
@@ -2446,39 +2273,37 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18],
*/
static inline
void III_overlap_z(mad_fixed_t overlap[18],
- mad_fixed_t sample[18][32], unsigned int sb)
+ mad_fixed_t sample[18][32], unsigned int sb)
{
- unsigned int i;
+ unsigned int i;
# if defined(ASO_INTERLEAVE2)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = overlap[0];
- tmp2 = overlap[1];
-
- for(i = 0; i < 16; i += 2)
- {
- sample[i + 0][sb] = tmp1;
- overlap[i + 0] = 0;
- tmp1 = overlap[i + 2];
-
- sample[i + 1][sb] = tmp2;
- overlap[i + 1] = 0;
- tmp2 = overlap[i + 3];
- }
-
- sample[16][sb] = tmp1;
- overlap[16] = 0;
- sample[17][sb] = tmp2;
- overlap[17] = 0;
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = overlap[0];
+ tmp2 = overlap[1];
+
+ for (i = 0; i < 16; i += 2) {
+ sample[i + 0][sb] = tmp1;
+ overlap[i + 0] = 0;
+ tmp1 = overlap[i + 2];
+
+ sample[i + 1][sb] = tmp2;
+ overlap[i + 1] = 0;
+ tmp2 = overlap[i + 3];
}
+
+ sample[16][sb] = tmp1;
+ overlap[16] = 0;
+ sample[17][sb] = tmp2;
+ overlap[17] = 0;
+ }
# else
- for(i = 0; i < 18; ++i)
- {
- sample[i][sb] = overlap[i];
- overlap[i] = 0;
- }
+ for (i = 0; i < 18; ++i) {
+ sample[i][sb] = overlap[i];
+ overlap[i] = 0;
+ }
# endif
}
@@ -2489,31 +2314,30 @@ void III_overlap_z(mad_fixed_t overlap[18],
static
void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb)
{
- unsigned int i;
+ unsigned int i;
# if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = sample[1][sb];
- tmp2 = sample[3][sb];
-
- for(i = 1; i < 13; i += 4)
- {
- sample[i + 0][sb] = -tmp1;
- tmp1 = sample[i + 4][sb];
- sample[i + 2][sb] = -tmp2;
- tmp2 = sample[i + 6][sb];
- }
-
- sample[13][sb] = -tmp1;
- tmp1 = sample[17][sb];
- sample[15][sb] = -tmp2;
- sample[17][sb] = -tmp1;
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = sample[1][sb];
+ tmp2 = sample[3][sb];
+
+ for (i = 1; i < 13; i += 4) {
+ sample[i + 0][sb] = -tmp1;
+ tmp1 = sample[i + 4][sb];
+ sample[i + 2][sb] = -tmp2;
+ tmp2 = sample[i + 6][sb];
}
+
+ sample[13][sb] = -tmp1;
+ tmp1 = sample[17][sb];
+ sample[15][sb] = -tmp2;
+ sample[17][sb] = -tmp1;
+ }
# else
- for(i = 1; i < 18; i += 2)
- sample[i][sb] = -sample[i][sb];
+ for (i = 1; i < 18; i += 2)
+ sample[i][sb] = -sample[i][sb];
# endif
}
@@ -2523,182 +2347,165 @@ void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb)
*/
static
enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
- struct sideinfo *si, unsigned int nch)
+ struct sideinfo *si, unsigned int nch)
{
- struct mad_header *header = &frame->header;
- unsigned int sfreqi, ngr, gr;
+ struct mad_header *header = &frame->header;
+ unsigned int sfreqi, ngr, gr;
- {
- unsigned int sfreq;
+ {
+ unsigned int sfreq;
- sfreq = header->samplerate;
- if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- sfreq *= 2;
+ sfreq = header->samplerate;
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ sfreq *= 2;
- /* 48000 => 0, 44100 => 1, 32000 => 2,
- 24000 => 3, 22050 => 4, 16000 => 5 */
- sfreqi = ((sfreq >> 7) & 0x000f) +
- ((sfreq >> 15) & 0x0001) - 8;
+ /* 48000 => 0, 44100 => 1, 32000 => 2,
+ 24000 => 3, 22050 => 4, 16000 => 5 */
+ sfreqi = ((sfreq >> 7) & 0x000f) +
+ ((sfreq >> 15) & 0x0001) - 8;
- if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- sfreqi += 3;
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ sfreqi += 3;
+ }
+
+ /* scalefactors, Huffman decoding, requantization */
+
+ ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2;
+
+ for (gr = 0; gr < ngr; ++gr) {
+ struct granule *granule = &si->gr[gr];
+ unsigned char const *sfbwidth[2];
+ mad_fixed_t xr[2][576];
+ unsigned int ch;
+ enum mad_error error;
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
+ unsigned int part2_length;
+
+ sfbwidth[ch] = sfbwidth_table[sfreqi].l;
+ if (channel->block_type == 2) {
+ sfbwidth[ch] = (channel->flags & mixed_block_flag) ?
+ sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s;
+ }
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ part2_length = III_scalefactors_lsf(ptr, channel,
+ ch == 0 ? 0 : &si->gr[1].ch[1],
+ header->mode_extension);
+ }
+ else {
+ part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
+ gr == 0 ? 0 : si->scfsi[ch]);
+ }
+
+ error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
+ if (error)
+ return error;
}
- /* scalefactors, Huffman decoding, requantization */
+ /* joint stereo processing */
- ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2;
+ if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) {
+ error = III_stereo(xr, granule, header, sfbwidth[0]);
+ if (error)
+ return error;
+ }
- for(gr = 0; gr < ngr; ++gr)
- {
- struct granule *granule = &si->gr[gr];
- unsigned char const *sfbwidth[2];
- mad_fixed_t xr[2][576];
- unsigned int ch;
- enum mad_error error;
-
- for(ch = 0; ch < nch; ++ch)
- {
- struct channel *channel = &granule->ch[ch];
- unsigned int part2_length;
-
- sfbwidth[ch] = sfbwidth_table[sfreqi].l;
- if(channel->block_type == 2)
- {
- sfbwidth[ch] = (channel->flags & mixed_block_flag) ?
- sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s;
- }
-
- if(header->flags & MAD_FLAG_LSF_EXT)
- {
- part2_length = III_scalefactors_lsf(ptr, channel,
- ch == 0 ? 0 : &si->gr[1].ch[1],
- header->mode_extension);
- }
- else
- {
- part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
- gr == 0 ? 0 : si->scfsi[ch]);
- }
-
- error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
- if(error)
- return error;
- }
-
- /* joint stereo processing */
-
- if(header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension)
- {
- error = III_stereo(xr, granule, header, sfbwidth[0]);
- if(error)
- return error;
- }
-
- /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */
-
- for(ch = 0; ch < nch; ++ch)
- {
- struct channel const *channel = &granule->ch[ch];
- mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr];
- unsigned int sb, l, i, sblimit;
- mad_fixed_t output[36];
-
- if(channel->block_type == 2)
- {
- III_reorder(xr[ch], channel, sfbwidth[ch]);
+ /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel const *channel = &granule->ch[ch];
+ mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr];
+ unsigned int sb, l, i, sblimit;
+ mad_fixed_t output[36];
+
+ if (channel->block_type == 2) {
+ III_reorder(xr[ch], channel, sfbwidth[ch]);
# if !defined(OPT_STRICT)
- /*
- * According to ISO/IEC 11172-3, "Alias reduction is not applied for
- * granules with block_type == 2 (short block)." However, other
- * sources suggest alias reduction should indeed be performed on the
- * lower two subbands of mixed blocks. Most other implementations do
- * this, so by default we will too.
- */
- if(channel->flags & mixed_block_flag)
- III_aliasreduce(xr[ch], 36);
+ /*
+ * According to ISO/IEC 11172-3, "Alias reduction is not applied for
+ * granules with block_type == 2 (short block)." However, other
+ * sources suggest alias reduction should indeed be performed on the
+ * lower two subbands of mixed blocks. Most other implementations do
+ * this, so by default we will too.
+ */
+ if (channel->flags & mixed_block_flag)
+ III_aliasreduce(xr[ch], 36);
# endif
- }
- else
- III_aliasreduce(xr[ch], 576);
-
- l = 0;
-
- /* subbands 0-1 */
-
- if(channel->block_type != 2 || (channel->flags & mixed_block_flag))
- {
- unsigned int block_type;
-
- block_type = channel->block_type;
- if(channel->flags & mixed_block_flag)
- block_type = 0;
-
- /* long blocks */
- for(sb = 0; sb < 2; ++sb, l += 18)
- {
- III_imdct_l(&xr[ch][l], output, block_type);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
- }
- }
- else
- {
- /* short blocks */
- for(sb = 0; sb < 2; ++sb, l += 18)
- {
- III_imdct_s(&xr[ch][l], output);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
- }
- }
-
- III_freqinver(sample, 1);
-
- /* (nonzero) subbands 2-31 */
-
- i = 576;
- while(i > 36 && xr[ch][i - 1] == 0)
- --i;
-
- sblimit = 32 - (576 - i) / 18;
-
- if(channel->block_type != 2)
- {
- /* long blocks */
- for(sb = 2; sb < sblimit; ++sb, l += 18)
- {
- III_imdct_l(&xr[ch][l], output, channel->block_type);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
-
- if(sb & 1)
- III_freqinver(sample, sb);
- }
- }
- else
- {
- /* short blocks */
- for(sb = 2; sb < sblimit; ++sb, l += 18)
- {
- III_imdct_s(&xr[ch][l], output);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
-
- if(sb & 1)
- III_freqinver(sample, sb);
- }
- }
-
- /* remaining (zero) subbands */
-
- for(sb = sblimit; sb < 32; ++sb)
- {
- III_overlap_z((*frame->overlap)[ch][sb], sample, sb);
-
- if(sb & 1)
- III_freqinver(sample, sb);
- }
- }
+ }
+ else
+ III_aliasreduce(xr[ch], 576);
+
+ l = 0;
+
+ /* subbands 0-1 */
+
+ if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) {
+ unsigned int block_type;
+
+ block_type = channel->block_type;
+ if (channel->flags & mixed_block_flag)
+ block_type = 0;
+
+ /* long blocks */
+ for (sb = 0; sb < 2; ++sb, l += 18) {
+ III_imdct_l(&xr[ch][l], output, block_type);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+ }
+ }
+ else {
+ /* short blocks */
+ for (sb = 0; sb < 2; ++sb, l += 18) {
+ III_imdct_s(&xr[ch][l], output);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+ }
+ }
+
+ III_freqinver(sample, 1);
+
+ /* (nonzero) subbands 2-31 */
+
+ i = 576;
+ while (i > 36 && xr[ch][i - 1] == 0)
+ --i;
+
+ sblimit = 32 - (576 - i) / 18;
+
+ if (channel->block_type != 2) {
+ /* long blocks */
+ for (sb = 2; sb < sblimit; ++sb, l += 18) {
+ III_imdct_l(&xr[ch][l], output, channel->block_type);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+ else {
+ /* short blocks */
+ for (sb = 2; sb < sblimit; ++sb, l += 18) {
+ III_imdct_s(&xr[ch][l], output);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+
+ /* remaining (zero) subbands */
+
+ for (sb = sblimit; sb < 32; ++sb) {
+ III_overlap_z((*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
}
+ }
- return MAD_ERROR_NONE;
+ return MAD_ERROR_NONE;
}
/*
@@ -2707,205 +2514,184 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
*/
int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame)
{
- struct mad_header *header = &frame->header;
- unsigned int nch, priv_bitlen, next_md_begin = 0;
- unsigned int si_len, data_bitlen, md_len;
- unsigned int frame_space, frame_used, frame_free;
- struct mad_bitptr ptr;
- struct sideinfo si;
- enum mad_error error;
- int result = 0;
-
- /* allocate Layer III dynamic structures */
-
- if(stream->main_data == 0)
- {
- stream->main_data = malloc(MAD_BUFFER_MDLEN);
- if(stream->main_data == 0)
- {
- stream->error = MAD_ERROR_NOMEM;
- return -1;
- }
+ struct mad_header *header = &frame->header;
+ unsigned int nch, priv_bitlen, next_md_begin = 0;
+ unsigned int si_len, data_bitlen, md_len;
+ unsigned int frame_space, frame_used, frame_free;
+ struct mad_bitptr ptr;
+ struct sideinfo si;
+ enum mad_error error;
+ int result = 0;
+
+ /* allocate Layer III dynamic structures */
+
+ if (stream->main_data == 0) {
+ stream->main_data = malloc(MAD_BUFFER_MDLEN);
+ if (stream->main_data == 0) {
+ stream->error = MAD_ERROR_NOMEM;
+ return -1;
}
+ }
- if(frame->overlap == 0)
- {
- frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t));
- if(frame->overlap == 0)
- {
- stream->error = MAD_ERROR_NOMEM;
- return -1;
- }
+ if (frame->overlap == 0) {
+ frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t));
+ if (frame->overlap == 0) {
+ stream->error = MAD_ERROR_NOMEM;
+ return -1;
}
+ }
- nch = MAD_NCHANNELS(header);
- si_len = (header->flags & MAD_FLAG_LSF_EXT) ?
- (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32);
+ nch = MAD_NCHANNELS(header);
+ si_len = (header->flags & MAD_FLAG_LSF_EXT) ?
+ (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32);
- /* check frame sanity */
+ /* check frame sanity */
- if(stream->next_frame - mad_bit_nextbyte(&stream->ptr) <
- (signed int) si_len)
- {
- stream->error = MAD_ERROR_BADFRAMELEN;
- stream->md_len = 0;
- return -1;
- }
+ if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) <
+ (signed int) si_len) {
+ stream->error = MAD_ERROR_BADFRAMELEN;
+ stream->md_len = 0;
+ return -1;
+ }
- /* check CRC word */
+ /* check CRC word */
- if(header->flags & MAD_FLAG_PROTECTION)
- {
- header->crc_check =
- mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check);
-
- if(header->crc_check != header->crc_target &&
- !(frame->options & MAD_OPTION_IGNORECRC))
- {
- stream->error = MAD_ERROR_BADCRC;
- result = -1;
- }
- }
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check);
- /* decode frame side information */
-
- error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT,
- &si, &data_bitlen, &priv_bitlen);
- if(error && result == 0)
- {
- stream->error = error;
- result = -1;
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ result = -1;
}
+ }
- header->flags |= priv_bitlen;
- header->private_bits |= si.private_bits;
+ /* decode frame side information */
- /* find main_data of next frame */
+ error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT,
+ &si, &data_bitlen, &priv_bitlen);
+ if (error && result == 0) {
+ stream->error = error;
+ result = -1;
+ }
- {
- struct mad_bitptr peek;
- unsigned long header;
+ header->flags |= priv_bitlen;
+ header->private_bits |= si.private_bits;
- mad_bit_init(&peek, stream->next_frame);
+ /* find main_data of next frame */
+
+ {
+ struct mad_bitptr peek;
+ unsigned long header;
- header = mad_bit_read(&peek, 32);
- if((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L)
- {
- if(!(header & 0x00010000L)) /* protection_bit */
- mad_bit_skip(&peek, 16); /* crc_check */
+ mad_bit_init(&peek, stream->next_frame);
- next_md_begin =
- mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
- }
+ header = mad_bit_read(&peek, 32);
+ if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
+ if (!(header & 0x00010000L)) /* protection_bit */
+ mad_bit_skip(&peek, 16); /* crc_check */
- mad_bit_finish(&peek);
+ next_md_begin =
+ mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
}
- /* find main_data of this frame */
+ mad_bit_finish(&peek);
+ }
- frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr);
+ /* find main_data of this frame */
- if(next_md_begin > si.main_data_begin + frame_space)
- next_md_begin = 0;
+ frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr);
- md_len = si.main_data_begin + frame_space - next_md_begin;
+ if (next_md_begin > si.main_data_begin + frame_space)
+ next_md_begin = 0;
- frame_used = 0;
+ md_len = si.main_data_begin + frame_space - next_md_begin;
- if(si.main_data_begin == 0)
- {
- ptr = stream->ptr;
- stream->md_len = 0;
+ frame_used = 0;
+
+ if (si.main_data_begin == 0) {
+ ptr = stream->ptr;
+ stream->md_len = 0;
- frame_used = md_len;
+ frame_used = md_len;
+ }
+ else {
+ if (si.main_data_begin > stream->md_len) {
+ if (result == 0) {
+ stream->error = MAD_ERROR_BADDATAPTR;
+ result = -1;
+ }
}
- else
- {
- if(si.main_data_begin > stream->md_len)
- {
- if(result == 0)
- {
- stream->error = MAD_ERROR_BADDATAPTR;
- result = -1;
- }
- }
- else
- {
- mad_bit_init(&ptr,
- *stream->main_data + stream->md_len - si.main_data_begin);
-
- if(md_len > si.main_data_begin)
- {
- assert(stream->md_len + md_len -
- si.main_data_begin <= MAD_BUFFER_MDLEN);
-
- memcpy(*stream->main_data + stream->md_len,
- mad_bit_nextbyte(&stream->ptr),
- frame_used = md_len - si.main_data_begin);
- stream->md_len += frame_used;
- }
- }
+ else {
+ mad_bit_init(&ptr,
+ *stream->main_data + stream->md_len - si.main_data_begin);
+
+ if (md_len > si.main_data_begin) {
+ assert(stream->md_len + md_len -
+ si.main_data_begin <= MAD_BUFFER_MDLEN);
+
+ memcpy(*stream->main_data + stream->md_len,
+ mad_bit_nextbyte(&stream->ptr),
+ frame_used = md_len - si.main_data_begin);
+ stream->md_len += frame_used;
+ }
}
+ }
- frame_free = frame_space - frame_used;
+ frame_free = frame_space - frame_used;
- /* decode main_data */
+ /* decode main_data */
- if(result == 0)
- {
- error = III_decode(&ptr, frame, &si, nch);
- if(error)
- {
- stream->error = error;
- result = -1;
- }
+ if (result == 0) {
+ error = III_decode(&ptr, frame, &si, nch);
+ if (error) {
+ stream->error = error;
+ result = -1;
+ }
- /* designate ancillary bits */
+ /* designate ancillary bits */
- stream->anc_ptr = ptr;
- stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen;
- }
+ stream->anc_ptr = ptr;
+ stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen;
+ }
# if 0 && defined(DEBUG)
- fprintf(stderr,
- "main_data_begin:%u, md_len:%u, frame_free:%u, "
- "data_bitlen:%u, anc_bitlen: %u\n",
- si.main_data_begin, md_len, frame_free,
- data_bitlen, stream->anc_bitlen);
+ fprintf(stderr,
+ "main_data_begin:%u, md_len:%u, frame_free:%u, "
+ "data_bitlen:%u, anc_bitlen: %u\n",
+ si.main_data_begin, md_len, frame_free,
+ data_bitlen, stream->anc_bitlen);
# endif
- /* preload main_data buffer with up to 511 bytes for next frame(s) */
-
- if(frame_free >= next_md_begin)
- {
- memcpy(*stream->main_data,
- stream->next_frame - next_md_begin, next_md_begin);
- stream->md_len = next_md_begin;
+ /* preload main_data buffer with up to 511 bytes for next frame(s) */
+
+ if (frame_free >= next_md_begin) {
+ memcpy(*stream->main_data,
+ stream->next_frame - next_md_begin, next_md_begin);
+ stream->md_len = next_md_begin;
+ }
+ else {
+ if (md_len < si.main_data_begin) {
+ unsigned int extra;
+
+ extra = si.main_data_begin - md_len;
+ if (extra + frame_free > next_md_begin)
+ extra = next_md_begin - frame_free;
+
+ if (extra < stream->md_len) {
+ memmove(*stream->main_data,
+ *stream->main_data + stream->md_len - extra, extra);
+ stream->md_len = extra;
+ }
}
else
- {
- if(md_len < si.main_data_begin)
- {
- unsigned int extra;
-
- extra = si.main_data_begin - md_len;
- if(extra + frame_free > next_md_begin)
- extra = next_md_begin - frame_free;
-
- if(extra < stream->md_len)
- {
- memmove(*stream->main_data,
- *stream->main_data + stream->md_len - extra, extra);
- stream->md_len = extra;
- }
- }
- else
- stream->md_len = 0;
-
- memcpy(*stream->main_data + stream->md_len,
- stream->next_frame - frame_free, frame_free);
- stream->md_len += frame_free;
- }
+ stream->md_len = 0;
+
+ memcpy(*stream->main_data + stream->md_len,
+ stream->next_frame - frame_free, frame_free);
+ stream->md_len += frame_free;
+ }
- return result;
+ return result;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/mad.h b/src/filters/transform/MpaDecFilter/libmad/mad.h
index 381e0b01a..f52f3a692 100644
--- a/src/filters/transform/MpaDecFilter/libmad/mad.h
+++ b/src/filters/transform/MpaDecFilter/libmad/mad.h
@@ -33,7 +33,7 @@ extern "C" {
# define SIZEOF_LONG_LONG 8
- /* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
+/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
# ifndef LIBMAD_VERSION_H
# define LIBMAD_VERSION_H
@@ -55,28 +55,28 @@ extern "C" {
# define MAD_AUTHOR "Underbit Technologies, Inc."
# define MAD_EMAIL "info@underbit.com"
- extern char const mad_version[];
- extern char const mad_copyright[];
- extern char const mad_author[];
- extern char const mad_build[];
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
# endif
- /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
+/* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
# ifndef LIBMAD_FIXED_H
# define LIBMAD_FIXED_H
# if SIZEOF_INT >= 4
- typedef signed int mad_fixed_t;
+typedef signed int mad_fixed_t;
- typedef signed int mad_fixed64hi_t;
- typedef unsigned int mad_fixed64lo_t;
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
# else
- typedef signed long mad_fixed_t;
+typedef signed long mad_fixed_t;
- typedef signed long mad_fixed64hi_t;
- typedef unsigned long mad_fixed64lo_t;
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
# endif
# if defined(_MSC_VER)
@@ -86,33 +86,33 @@ extern "C" {
# endif
# if defined(FPM_FLOAT)
- typedef double mad_sample_t;
+typedef double mad_sample_t;
# else
- typedef mad_fixed_t mad_sample_t;
+typedef mad_fixed_t mad_sample_t;
# endif
- /*
- * Fixed-point format: 0xABBBBBBB
- * A == whole part (sign + 3 bits)
- * B == fractional part (28 bits)
- *
- * Values are signed two's complement, so the effective range is:
- * 0x80000000 to 0x7fffffff
- * -8.0 to +7.9999999962747097015380859375
- *
- * The smallest representable value is:
- * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
- *
- * 28 bits of fractional accuracy represent about
- * 8.6 digits of decimal accuracy.
- *
- * Fixed-point numbers can be added or subtracted as normal
- * integers, but multiplication requires shifting the 64-bit result
- * from 56 fractional bits back to 28 (and rounding.)
- *
- * Changing the definition of MAD_F_FRACBITS is only partially
- * supported, and must be done with care.
- */
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
# define MAD_F_FRACBITS 28
@@ -144,7 +144,7 @@ extern "C" {
# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
- /* (x should be positive) */
+ /* (x should be positive) */
# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
@@ -164,10 +164,10 @@ extern "C" {
# elif defined(FPM_64BIT)
- /*
- * This version should be the most accurate if 64-bit types are supported by
- * the compiler, although it may not be the most efficient.
- */
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
# if defined(OPT_ACCURACY)
# define mad_f_mul(x, y) \
((mad_fixed_t) \
@@ -180,7 +180,7 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Intel --------------------------------------------------------------- */
+/* --- Intel --------------------------------------------------------------- */
# elif defined(FPM_INTEL)
@@ -192,10 +192,10 @@ extern "C" {
# define mad_f_mul mad_f_mul_inline
# define mad_f_scale64
# else
- /*
- * This Intel version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("imull %3" \
: "=a" (lo), "=d" (hi) \
@@ -203,9 +203,9 @@ extern "C" {
: "cc")
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -219,9 +219,9 @@ extern "C" {
# endif /* OPT_ACCURACY */
# if defined(OPT_ACCURACY)
- /*
- * Surprisingly, this is faster than SHRD followed by ADC.
- */
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed64hi_t __hi_; \
mad_fixed64lo_t __lo_; \
@@ -239,9 +239,9 @@ extern "C" {
__result; \
})
# elif defined(OPT_INTEL)
- /*
- * Alternate Intel scaling that may or may not perform better.
- */
+/*
+ * Alternate Intel scaling that may or may not perform better.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result; \
asm ("shrl %3,%1\n\t" \
@@ -267,19 +267,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- ARM ----------------------------------------------------------------- */
+/* --- ARM ----------------------------------------------------------------- */
# elif defined(FPM_ARM)
- /*
- * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
- * least significant bit is properly rounded at no CPU cycle cost!
- */
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
# if 1
- /*
- * This is faster than the default implementation via MAD_F_MLX() and
- * mad_f_scale64().
- */
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
# define mad_f_mul(x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -325,14 +325,14 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- MIPS ---------------------------------------------------------------- */
+/* --- MIPS ---------------------------------------------------------------- */
# elif defined(FPM_MIPS)
- /*
- * This MIPS version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -344,10 +344,10 @@ extern "C" {
: "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y))
# elif defined(HAVE_MADD16_ASM)
- /*
- * This loses significant accuracy due to the 16-bit integer limit in the
- * multiply/accumulate instruction.
- */
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
# define MAD_F_ML0(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -365,28 +365,28 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- SPARC --------------------------------------------------------------- */
+/* --- SPARC --------------------------------------------------------------- */
# elif defined(FPM_SPARC)
- /*
- * This SPARC V8 version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("smul %2, %3, %0\n\t" \
"rd %%y, %1" \
: "=r" (lo), "=r" (hi) \
: "%r" (x), "rI" (y))
- /* --- PowerPC ------------------------------------------------------------- */
+/* --- PowerPC ------------------------------------------------------------- */
# elif defined(FPM_PPC)
- /*
- * This PowerPC version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
do { \
asm ("mullw %0,%1,%2" \
@@ -399,9 +399,9 @@ extern "C" {
while (0)
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -416,9 +416,9 @@ extern "C" {
# endif
# if defined(OPT_ACCURACY)
- /*
- * This is slower than the truncating version below it.
- */
+/*
+ * This is slower than the truncating version below it.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result, __round; \
asm ("rotrwi %0,%1,%2" \
@@ -450,19 +450,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Default ------------------------------------------------------------- */
+/* --- Default ------------------------------------------------------------- */
# elif defined(FPM_DEFAULT)
- /*
- * This version is the most portable but it loses significant accuracy.
- * Furthermore, accuracy is biased against the second argument, so care
- * should be taken when ordering operands.
- *
- * The scale factors are constant as this is not used with SSO.
- *
- * Pre-rounding is required to stay within the limits of compliance.
- */
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
# if defined(OPT_SPEED)
# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
# else
@@ -470,13 +470,13 @@ extern "C" {
(((y) + (1L << 15)) >> 16))
# endif
- /* ------------------------------------------------------------------------- */
+/* ------------------------------------------------------------------------- */
# else
# error "no FPM selected"
# endif
- /* default implementations */
+/* default implementations */
# if !defined(mad_f_mul)
# define mad_f_mul(x, y) \
@@ -521,128 +521,125 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* C routines */
+/* C routines */
- mad_fixed_t mad_f_abs(mad_fixed_t);
- mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
# endif
- /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
+/* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
- struct mad_bitptr
- {
- unsigned char const *byte;
- unsigned short cache;
- unsigned short left;
- };
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
- void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
- unsigned int mad_bit_length(struct mad_bitptr const *,
- struct mad_bitptr const *);
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
- unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
- void mad_bit_skip(struct mad_bitptr *, unsigned int);
- unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
- void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
- unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
# endif
- /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
+/* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
- typedef struct
- {
- signed long seconds; /* whole seconds */
- unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
- } mad_timer_t;
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
- extern mad_timer_t const mad_timer_zero;
+extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
- enum mad_units
- {
- MAD_UNITS_HOURS = -2,
- MAD_UNITS_MINUTES = -1,
- MAD_UNITS_SECONDS = 0,
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
- /* metric units */
+ /* metric units */
- MAD_UNITS_DECISECONDS = 10,
- MAD_UNITS_CENTISECONDS = 100,
- MAD_UNITS_MILLISECONDS = 1000,
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
- /* audio sample units */
+ /* audio sample units */
- MAD_UNITS_8000_HZ = 8000,
- MAD_UNITS_11025_HZ = 11025,
- MAD_UNITS_12000_HZ = 12000,
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
- MAD_UNITS_16000_HZ = 16000,
- MAD_UNITS_22050_HZ = 22050,
- MAD_UNITS_24000_HZ = 24000,
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
- MAD_UNITS_32000_HZ = 32000,
- MAD_UNITS_44100_HZ = 44100,
- MAD_UNITS_48000_HZ = 48000,
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
- /* video frame/field units */
+ /* video frame/field units */
- MAD_UNITS_24_FPS = 24,
- MAD_UNITS_25_FPS = 25,
- MAD_UNITS_30_FPS = 30,
- MAD_UNITS_48_FPS = 48,
- MAD_UNITS_50_FPS = 50,
- MAD_UNITS_60_FPS = 60,
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
- /* CD audio frames */
+ /* CD audio frames */
- MAD_UNITS_75_FPS = 75,
+ MAD_UNITS_75_FPS = 75,
- /* video drop-frame units */
+ /* video drop-frame units */
- MAD_UNITS_23_976_FPS = -24,
- MAD_UNITS_24_975_FPS = -25,
- MAD_UNITS_29_97_FPS = -30,
- MAD_UNITS_47_952_FPS = -48,
- MAD_UNITS_49_95_FPS = -50,
- MAD_UNITS_59_94_FPS = -60
- };
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
- int mad_timer_compare(mad_timer_t, mad_timer_t);
+int mad_timer_compare(mad_timer_t, mad_timer_t);
# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
- void mad_timer_negate(mad_timer_t *);
- mad_timer_t mad_timer_abs(mad_timer_t);
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
- void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
- void mad_timer_add(mad_timer_t *, mad_timer_t);
- void mad_timer_multiply(mad_timer_t *, signed long);
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
- signed long mad_timer_count(mad_timer_t, enum mad_units);
- unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
- void mad_timer_string(mad_timer_t, char *, char const *,
- enum mad_units, enum mad_units, unsigned long);
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
# endif
- /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
+/* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
# ifndef LIBMAD_STREAM_H
# define LIBMAD_STREAM_H
@@ -651,146 +648,138 @@ extern "C" {
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
- enum mad_error
- {
- MAD_ERROR_NONE = 0x0000, /* no error */
-
- MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
- MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
-
- MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
-
- MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
- MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
- MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
- MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
- MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
-
- MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
- MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
- MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
- MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
- MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
- MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
- MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
- MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
- MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
- MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
- MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
- MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
- MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
- };
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
- struct mad_stream
- {
- unsigned char const *buffer; /* input bitstream buffer */
- unsigned char const *bufend; /* end of buffer */
- unsigned long skiplen; /* bytes to skip before next frame */
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
- int sync; /* stream sync found */
- unsigned long freerate; /* free bitrate (fixed) */
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
- unsigned char const *this_frame; /* start of current frame */
- unsigned char const *next_frame; /* start of next frame */
- struct mad_bitptr ptr; /* current processing bit pointer */
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
- struct mad_bitptr anc_ptr; /* ancillary bits pointer */
- unsigned int anc_bitlen; /* number of ancillary bits */
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
- unsigned char(*main_data)[MAD_BUFFER_MDLEN];
- /* Layer III main_data() */
- unsigned int md_len; /* bytes in main_data */
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
- int options; /* decoding options (see below) */
- enum mad_error error; /* error code (see above) */
- };
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
- enum
- {
- MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
- MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
- MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
- };
+};
- void mad_stream_init(struct mad_stream *);
- void mad_stream_finish(struct mad_stream *);
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
# define mad_stream_options(stream, opts) \
((void) ((stream)->options = (opts)))
- void mad_stream_buffer(struct mad_stream *,
- unsigned char const *, unsigned long);
- void mad_stream_skip(struct mad_stream *, unsigned long);
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
- int mad_stream_sync(struct mad_stream *);
+int mad_stream_sync(struct mad_stream *);
- char const *mad_stream_errorstr(struct mad_stream const *);
+char const *mad_stream_errorstr(struct mad_stream const *);
# endif
- /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
+/* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_FRAME_H
# define LIBMAD_FRAME_H
- enum mad_layer
- {
- MAD_LAYER_I = 1, /* Layer I */
- MAD_LAYER_II = 2, /* Layer II */
- MAD_LAYER_III = 3 /* Layer III */
- };
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
- enum mad_mode
- {
- MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
- MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
- MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
- MAD_MODE_STEREO = 3 /* normal LR stereo */
- };
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
- enum mad_emphasis
- {
- MAD_EMPHASIS_NONE = 0, /* no emphasis */
- MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
- MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
- MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
- };
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
- struct mad_header
- {
- enum mad_layer layer; /* audio layer (1, 2, or 3) */
- enum mad_mode mode; /* channel mode (see above) */
- int mode_extension; /* additional mode info */
- enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
- unsigned long bitrate; /* stream bitrate (bps) */
- unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short crc_check; /* frame CRC accumulator */
- unsigned short crc_target; /* final target CRC checksum */
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
- int flags; /* flags (see below) */
- int private_bits; /* private bits (see below) */
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
- mad_timer_t duration; /* audio playing time of frame */
- };
+ mad_timer_t duration; /* audio playing time of frame */
+};
- struct mad_frame
- {
- struct mad_header header; /* MPEG audio header */
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
- int options; /* decoding options (from stream) */
+ int options; /* decoding options (from stream) */
- mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
- mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
- };
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
# define MAD_NSBSAMPLES(header) \
@@ -798,172 +787,160 @@ extern "C" {
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
- enum
- {
- MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
- MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
- MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
- MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
- MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
- MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
- MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
- MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
- MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
- MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
- MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
- MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
- };
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
- enum
- {
- MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
- MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
- };
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
- void mad_header_init(struct mad_header *);
+void mad_header_init(struct mad_header *);
# define mad_header_finish(header) /* nothing */
- int mad_header_decode(struct mad_header *, struct mad_stream *);
+int mad_header_decode(struct mad_header *, struct mad_stream *);
- void mad_frame_init(struct mad_frame *);
- void mad_frame_finish(struct mad_frame *);
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
- int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
- void mad_frame_mute(struct mad_frame *);
+void mad_frame_mute(struct mad_frame *);
# endif
- /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
+/* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_SYNTH_H
# define LIBMAD_SYNTH_H
- struct mad_pcm
- {
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
- };
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
- struct mad_synth
- {
- mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
- /* [ch][eo][peo][s][v] */
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
- unsigned int phase; /* current processing phase */
+ unsigned int phase; /* current processing phase */
- struct mad_pcm pcm; /* PCM output */
- };
+ struct mad_pcm pcm; /* PCM output */
+};
- /* single channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_SINGLE = 0
- };
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
- /* dual channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_DUAL_1 = 0,
- MAD_PCM_CHANNEL_DUAL_2 = 1
- };
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
- /* stereo PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_STEREO_LEFT = 0,
- MAD_PCM_CHANNEL_STEREO_RIGHT = 1
- };
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
- void mad_synth_init(struct mad_synth *);
+void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */
- void mad_synth_mute(struct mad_synth *);
+void mad_synth_mute(struct mad_synth *);
- void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif
- /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
+/* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_DECODER_H
# define LIBMAD_DECODER_H
- enum mad_decoder_mode
- {
- MAD_DECODER_MODE_SYNC = 0,
- MAD_DECODER_MODE_ASYNC
- };
-
- enum mad_flow
- {
- MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
- MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
- MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
- MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
- };
-
- struct mad_decoder
- {
- enum mad_decoder_mode mode;
-
- int options;
-
- struct
- {
- long pid;
- int in;
- int out;
- } async;
-
- struct
- {
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- } *sync;
-
- void *cb_data;
-
- enum mad_flow(*input_func)(void *, struct mad_stream *);
- enum mad_flow(*header_func)(void *, struct mad_header const *);
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *, struct mad_frame *);
- enum mad_flow(*output_func)(void *,
- struct mad_header const *, struct mad_pcm *);
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- enum mad_flow(*message_func)(void *, void *, unsigned int *);
- };
-
- void mad_decoder_init(struct mad_decoder *, void *,
- enum mad_flow(*)(void *, struct mad_stream *),
- enum mad_flow(*)(void *, struct mad_header const *),
- enum mad_flow(*)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*)(void *, void *, unsigned int *));
- int mad_decoder_finish(struct mad_decoder *);
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
((void) ((decoder)->options = (opts)))
- int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
- int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
# endif
diff --git a/src/filters/transform/MpaDecFilter/libmad/minimad.c b/src/filters/transform/MpaDecFilter/libmad/minimad.c
index 3909a520f..79ca1ad4f 100644
--- a/src/filters/transform/MpaDecFilter/libmad/minimad.c
+++ b/src/filters/transform/MpaDecFilter/libmad/minimad.c
@@ -39,26 +39,26 @@ static int decode(unsigned char const *, unsigned long);
int main(int argc, char *argv[])
{
- struct stat stat;
- void *fdm;
+ struct stat stat;
+ void *fdm;
- if(argc != 1)
- return 1;
+ if (argc != 1)
+ return 1;
- if(fstat(STDIN_FILENO, &stat) == -1 ||
- stat.st_size == 0)
- return 2;
+ if (fstat(STDIN_FILENO, &stat) == -1 ||
+ stat.st_size == 0)
+ return 2;
- fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, STDIN_FILENO, 0);
- if(fdm == MAP_FAILED)
- return 3;
+ fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, STDIN_FILENO, 0);
+ if (fdm == MAP_FAILED)
+ return 3;
- decode(fdm, stat.st_size);
+ decode(fdm, stat.st_size);
- if(munmap(fdm, stat.st_size) == -1)
- return 4;
+ if (munmap(fdm, stat.st_size) == -1)
+ return 4;
- return 0;
+ return 0;
}
/*
@@ -67,10 +67,9 @@ int main(int argc, char *argv[])
* to access from within the callbacks.
*/
-struct buffer
-{
- unsigned char const *start;
- unsigned long length;
+struct buffer {
+ unsigned char const *start;
+ unsigned long length;
};
/*
@@ -83,18 +82,18 @@ struct buffer
static
enum mad_flow input(void *data,
- struct mad_stream *stream)
+ struct mad_stream *stream)
{
- struct buffer *buffer = data;
+ struct buffer *buffer = data;
- if(!buffer->length)
- return MAD_FLOW_STOP;
+ if (!buffer->length)
+ return MAD_FLOW_STOP;
- mad_stream_buffer(stream, buffer->start, buffer->length);
+ mad_stream_buffer(stream, buffer->start, buffer->length);
- buffer->length = 0;
+ buffer->length = 0;
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
/*
@@ -108,17 +107,17 @@ enum mad_flow input(void *data,
static inline
signed int scale(mad_fixed_t sample)
{
- /* round */
- sample += (1L << (MAD_F_FRACBITS - 16));
+ /* round */
+ sample += (1L << (MAD_F_FRACBITS - 16));
- /* clip */
- if(sample >= MAD_F_ONE)
- sample = MAD_F_ONE - 1;
- else if(sample < -MAD_F_ONE)
- sample = -MAD_F_ONE;
+ /* clip */
+ if (sample >= MAD_F_ONE)
+ sample = MAD_F_ONE - 1;
+ else if (sample < -MAD_F_ONE)
+ sample = -MAD_F_ONE;
- /* quantize */
- return sample >> (MAD_F_FRACBITS + 1 - 16);
+ /* quantize */
+ return sample >> (MAD_F_FRACBITS + 1 - 16);
}
/*
@@ -129,38 +128,36 @@ signed int scale(mad_fixed_t sample)
static
enum mad_flow output(void *data,
- struct mad_header const *header,
- struct mad_pcm *pcm)
+ struct mad_header const *header,
+ struct mad_pcm *pcm)
{
- unsigned int nchannels, nsamples;
- mad_fixed_t const *left_ch, *right_ch;
+ unsigned int nchannels, nsamples;
+ mad_fixed_t const *left_ch, *right_ch;
- /* pcm->samplerate contains the sampling frequency */
+ /* pcm->samplerate contains the sampling frequency */
- nchannels = pcm->channels;
- nsamples = pcm->length;
- left_ch = pcm->samples[0];
- right_ch = pcm->samples[1];
+ nchannels = pcm->channels;
+ nsamples = pcm->length;
+ left_ch = pcm->samples[0];
+ right_ch = pcm->samples[1];
- while(nsamples--)
- {
- signed int sample;
+ while (nsamples--) {
+ signed int sample;
- /* output sample(s) in 16-bit signed little-endian PCM */
+ /* output sample(s) in 16-bit signed little-endian PCM */
- sample = scale(*left_ch++);
- putchar((sample >> 0) & 0xff);
- putchar((sample >> 8) & 0xff);
+ sample = scale(*left_ch++);
+ putchar((sample >> 0) & 0xff);
+ putchar((sample >> 8) & 0xff);
- if(nchannels == 2)
- {
- sample = scale(*right_ch++);
- putchar((sample >> 0) & 0xff);
- putchar((sample >> 8) & 0xff);
- }
+ if (nchannels == 2) {
+ sample = scale(*right_ch++);
+ putchar((sample >> 0) & 0xff);
+ putchar((sample >> 8) & 0xff);
}
+ }
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
/*
@@ -172,18 +169,18 @@ enum mad_flow output(void *data,
static
enum mad_flow error(void *data,
- struct mad_stream *stream,
- struct mad_frame *frame)
+ struct mad_stream *stream,
+ struct mad_frame *frame)
{
- struct buffer *buffer = data;
+ struct buffer *buffer = data;
- fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n",
- stream->error, mad_stream_errorstr(stream),
- stream->this_frame - buffer->start);
+ fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n",
+ stream->error, mad_stream_errorstr(stream),
+ stream->this_frame - buffer->start);
- /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */
+ /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
/*
@@ -198,28 +195,28 @@ enum mad_flow error(void *data,
static
int decode(unsigned char const *start, unsigned long length)
{
- struct buffer buffer;
- struct mad_decoder decoder;
- int result;
+ struct buffer buffer;
+ struct mad_decoder decoder;
+ int result;
- /* initialize our private message structure */
+ /* initialize our private message structure */
- buffer.start = start;
- buffer.length = length;
+ buffer.start = start;
+ buffer.length = length;
- /* configure input, output, and error functions */
+ /* configure input, output, and error functions */
- mad_decoder_init(&decoder, &buffer,
- input, 0 /* header */, 0 /* filter */, output,
- error, 0 /* message */);
+ mad_decoder_init(&decoder, &buffer,
+ input, 0 /* header */, 0 /* filter */, output,
+ error, 0 /* message */);
- /* start decoding */
+ /* start decoding */
- result = mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC);
+ result = mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC);
- /* release the decoder */
+ /* release the decoder */
- mad_decoder_finish(&decoder);
+ mad_decoder_finish(&decoder);
- return result;
+ return result;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h b/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h
index 381e0b01a..f52f3a692 100644
--- a/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h
+++ b/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h
@@ -33,7 +33,7 @@ extern "C" {
# define SIZEOF_LONG_LONG 8
- /* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
+/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
# ifndef LIBMAD_VERSION_H
# define LIBMAD_VERSION_H
@@ -55,28 +55,28 @@ extern "C" {
# define MAD_AUTHOR "Underbit Technologies, Inc."
# define MAD_EMAIL "info@underbit.com"
- extern char const mad_version[];
- extern char const mad_copyright[];
- extern char const mad_author[];
- extern char const mad_build[];
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
# endif
- /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
+/* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
# ifndef LIBMAD_FIXED_H
# define LIBMAD_FIXED_H
# if SIZEOF_INT >= 4
- typedef signed int mad_fixed_t;
+typedef signed int mad_fixed_t;
- typedef signed int mad_fixed64hi_t;
- typedef unsigned int mad_fixed64lo_t;
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
# else
- typedef signed long mad_fixed_t;
+typedef signed long mad_fixed_t;
- typedef signed long mad_fixed64hi_t;
- typedef unsigned long mad_fixed64lo_t;
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
# endif
# if defined(_MSC_VER)
@@ -86,33 +86,33 @@ extern "C" {
# endif
# if defined(FPM_FLOAT)
- typedef double mad_sample_t;
+typedef double mad_sample_t;
# else
- typedef mad_fixed_t mad_sample_t;
+typedef mad_fixed_t mad_sample_t;
# endif
- /*
- * Fixed-point format: 0xABBBBBBB
- * A == whole part (sign + 3 bits)
- * B == fractional part (28 bits)
- *
- * Values are signed two's complement, so the effective range is:
- * 0x80000000 to 0x7fffffff
- * -8.0 to +7.9999999962747097015380859375
- *
- * The smallest representable value is:
- * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
- *
- * 28 bits of fractional accuracy represent about
- * 8.6 digits of decimal accuracy.
- *
- * Fixed-point numbers can be added or subtracted as normal
- * integers, but multiplication requires shifting the 64-bit result
- * from 56 fractional bits back to 28 (and rounding.)
- *
- * Changing the definition of MAD_F_FRACBITS is only partially
- * supported, and must be done with care.
- */
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
# define MAD_F_FRACBITS 28
@@ -144,7 +144,7 @@ extern "C" {
# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
- /* (x should be positive) */
+ /* (x should be positive) */
# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
@@ -164,10 +164,10 @@ extern "C" {
# elif defined(FPM_64BIT)
- /*
- * This version should be the most accurate if 64-bit types are supported by
- * the compiler, although it may not be the most efficient.
- */
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
# if defined(OPT_ACCURACY)
# define mad_f_mul(x, y) \
((mad_fixed_t) \
@@ -180,7 +180,7 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Intel --------------------------------------------------------------- */
+/* --- Intel --------------------------------------------------------------- */
# elif defined(FPM_INTEL)
@@ -192,10 +192,10 @@ extern "C" {
# define mad_f_mul mad_f_mul_inline
# define mad_f_scale64
# else
- /*
- * This Intel version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("imull %3" \
: "=a" (lo), "=d" (hi) \
@@ -203,9 +203,9 @@ extern "C" {
: "cc")
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -219,9 +219,9 @@ extern "C" {
# endif /* OPT_ACCURACY */
# if defined(OPT_ACCURACY)
- /*
- * Surprisingly, this is faster than SHRD followed by ADC.
- */
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed64hi_t __hi_; \
mad_fixed64lo_t __lo_; \
@@ -239,9 +239,9 @@ extern "C" {
__result; \
})
# elif defined(OPT_INTEL)
- /*
- * Alternate Intel scaling that may or may not perform better.
- */
+/*
+ * Alternate Intel scaling that may or may not perform better.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result; \
asm ("shrl %3,%1\n\t" \
@@ -267,19 +267,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- ARM ----------------------------------------------------------------- */
+/* --- ARM ----------------------------------------------------------------- */
# elif defined(FPM_ARM)
- /*
- * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
- * least significant bit is properly rounded at no CPU cycle cost!
- */
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
# if 1
- /*
- * This is faster than the default implementation via MAD_F_MLX() and
- * mad_f_scale64().
- */
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
# define mad_f_mul(x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -325,14 +325,14 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- MIPS ---------------------------------------------------------------- */
+/* --- MIPS ---------------------------------------------------------------- */
# elif defined(FPM_MIPS)
- /*
- * This MIPS version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -344,10 +344,10 @@ extern "C" {
: "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y))
# elif defined(HAVE_MADD16_ASM)
- /*
- * This loses significant accuracy due to the 16-bit integer limit in the
- * multiply/accumulate instruction.
- */
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
# define MAD_F_ML0(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -365,28 +365,28 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- SPARC --------------------------------------------------------------- */
+/* --- SPARC --------------------------------------------------------------- */
# elif defined(FPM_SPARC)
- /*
- * This SPARC V8 version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("smul %2, %3, %0\n\t" \
"rd %%y, %1" \
: "=r" (lo), "=r" (hi) \
: "%r" (x), "rI" (y))
- /* --- PowerPC ------------------------------------------------------------- */
+/* --- PowerPC ------------------------------------------------------------- */
# elif defined(FPM_PPC)
- /*
- * This PowerPC version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
do { \
asm ("mullw %0,%1,%2" \
@@ -399,9 +399,9 @@ extern "C" {
while (0)
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -416,9 +416,9 @@ extern "C" {
# endif
# if defined(OPT_ACCURACY)
- /*
- * This is slower than the truncating version below it.
- */
+/*
+ * This is slower than the truncating version below it.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result, __round; \
asm ("rotrwi %0,%1,%2" \
@@ -450,19 +450,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Default ------------------------------------------------------------- */
+/* --- Default ------------------------------------------------------------- */
# elif defined(FPM_DEFAULT)
- /*
- * This version is the most portable but it loses significant accuracy.
- * Furthermore, accuracy is biased against the second argument, so care
- * should be taken when ordering operands.
- *
- * The scale factors are constant as this is not used with SSO.
- *
- * Pre-rounding is required to stay within the limits of compliance.
- */
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
# if defined(OPT_SPEED)
# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
# else
@@ -470,13 +470,13 @@ extern "C" {
(((y) + (1L << 15)) >> 16))
# endif
- /* ------------------------------------------------------------------------- */
+/* ------------------------------------------------------------------------- */
# else
# error "no FPM selected"
# endif
- /* default implementations */
+/* default implementations */
# if !defined(mad_f_mul)
# define mad_f_mul(x, y) \
@@ -521,128 +521,125 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* C routines */
+/* C routines */
- mad_fixed_t mad_f_abs(mad_fixed_t);
- mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
# endif
- /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
+/* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
- struct mad_bitptr
- {
- unsigned char const *byte;
- unsigned short cache;
- unsigned short left;
- };
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
- void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
- unsigned int mad_bit_length(struct mad_bitptr const *,
- struct mad_bitptr const *);
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
- unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
- void mad_bit_skip(struct mad_bitptr *, unsigned int);
- unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
- void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
- unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
# endif
- /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
+/* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
- typedef struct
- {
- signed long seconds; /* whole seconds */
- unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
- } mad_timer_t;
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
- extern mad_timer_t const mad_timer_zero;
+extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
- enum mad_units
- {
- MAD_UNITS_HOURS = -2,
- MAD_UNITS_MINUTES = -1,
- MAD_UNITS_SECONDS = 0,
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
- /* metric units */
+ /* metric units */
- MAD_UNITS_DECISECONDS = 10,
- MAD_UNITS_CENTISECONDS = 100,
- MAD_UNITS_MILLISECONDS = 1000,
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
- /* audio sample units */
+ /* audio sample units */
- MAD_UNITS_8000_HZ = 8000,
- MAD_UNITS_11025_HZ = 11025,
- MAD_UNITS_12000_HZ = 12000,
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
- MAD_UNITS_16000_HZ = 16000,
- MAD_UNITS_22050_HZ = 22050,
- MAD_UNITS_24000_HZ = 24000,
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
- MAD_UNITS_32000_HZ = 32000,
- MAD_UNITS_44100_HZ = 44100,
- MAD_UNITS_48000_HZ = 48000,
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
- /* video frame/field units */
+ /* video frame/field units */
- MAD_UNITS_24_FPS = 24,
- MAD_UNITS_25_FPS = 25,
- MAD_UNITS_30_FPS = 30,
- MAD_UNITS_48_FPS = 48,
- MAD_UNITS_50_FPS = 50,
- MAD_UNITS_60_FPS = 60,
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
- /* CD audio frames */
+ /* CD audio frames */
- MAD_UNITS_75_FPS = 75,
+ MAD_UNITS_75_FPS = 75,
- /* video drop-frame units */
+ /* video drop-frame units */
- MAD_UNITS_23_976_FPS = -24,
- MAD_UNITS_24_975_FPS = -25,
- MAD_UNITS_29_97_FPS = -30,
- MAD_UNITS_47_952_FPS = -48,
- MAD_UNITS_49_95_FPS = -50,
- MAD_UNITS_59_94_FPS = -60
- };
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
- int mad_timer_compare(mad_timer_t, mad_timer_t);
+int mad_timer_compare(mad_timer_t, mad_timer_t);
# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
- void mad_timer_negate(mad_timer_t *);
- mad_timer_t mad_timer_abs(mad_timer_t);
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
- void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
- void mad_timer_add(mad_timer_t *, mad_timer_t);
- void mad_timer_multiply(mad_timer_t *, signed long);
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
- signed long mad_timer_count(mad_timer_t, enum mad_units);
- unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
- void mad_timer_string(mad_timer_t, char *, char const *,
- enum mad_units, enum mad_units, unsigned long);
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
# endif
- /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
+/* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
# ifndef LIBMAD_STREAM_H
# define LIBMAD_STREAM_H
@@ -651,146 +648,138 @@ extern "C" {
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
- enum mad_error
- {
- MAD_ERROR_NONE = 0x0000, /* no error */
-
- MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
- MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
-
- MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
-
- MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
- MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
- MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
- MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
- MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
-
- MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
- MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
- MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
- MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
- MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
- MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
- MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
- MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
- MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
- MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
- MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
- MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
- MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
- };
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
- struct mad_stream
- {
- unsigned char const *buffer; /* input bitstream buffer */
- unsigned char const *bufend; /* end of buffer */
- unsigned long skiplen; /* bytes to skip before next frame */
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
- int sync; /* stream sync found */
- unsigned long freerate; /* free bitrate (fixed) */
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
- unsigned char const *this_frame; /* start of current frame */
- unsigned char const *next_frame; /* start of next frame */
- struct mad_bitptr ptr; /* current processing bit pointer */
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
- struct mad_bitptr anc_ptr; /* ancillary bits pointer */
- unsigned int anc_bitlen; /* number of ancillary bits */
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
- unsigned char(*main_data)[MAD_BUFFER_MDLEN];
- /* Layer III main_data() */
- unsigned int md_len; /* bytes in main_data */
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
- int options; /* decoding options (see below) */
- enum mad_error error; /* error code (see above) */
- };
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
- enum
- {
- MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
- MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
- MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
- };
+};
- void mad_stream_init(struct mad_stream *);
- void mad_stream_finish(struct mad_stream *);
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
# define mad_stream_options(stream, opts) \
((void) ((stream)->options = (opts)))
- void mad_stream_buffer(struct mad_stream *,
- unsigned char const *, unsigned long);
- void mad_stream_skip(struct mad_stream *, unsigned long);
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
- int mad_stream_sync(struct mad_stream *);
+int mad_stream_sync(struct mad_stream *);
- char const *mad_stream_errorstr(struct mad_stream const *);
+char const *mad_stream_errorstr(struct mad_stream const *);
# endif
- /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
+/* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_FRAME_H
# define LIBMAD_FRAME_H
- enum mad_layer
- {
- MAD_LAYER_I = 1, /* Layer I */
- MAD_LAYER_II = 2, /* Layer II */
- MAD_LAYER_III = 3 /* Layer III */
- };
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
- enum mad_mode
- {
- MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
- MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
- MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
- MAD_MODE_STEREO = 3 /* normal LR stereo */
- };
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
- enum mad_emphasis
- {
- MAD_EMPHASIS_NONE = 0, /* no emphasis */
- MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
- MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
- MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
- };
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
- struct mad_header
- {
- enum mad_layer layer; /* audio layer (1, 2, or 3) */
- enum mad_mode mode; /* channel mode (see above) */
- int mode_extension; /* additional mode info */
- enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
- unsigned long bitrate; /* stream bitrate (bps) */
- unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short crc_check; /* frame CRC accumulator */
- unsigned short crc_target; /* final target CRC checksum */
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
- int flags; /* flags (see below) */
- int private_bits; /* private bits (see below) */
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
- mad_timer_t duration; /* audio playing time of frame */
- };
+ mad_timer_t duration; /* audio playing time of frame */
+};
- struct mad_frame
- {
- struct mad_header header; /* MPEG audio header */
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
- int options; /* decoding options (from stream) */
+ int options; /* decoding options (from stream) */
- mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
- mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
- };
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
# define MAD_NSBSAMPLES(header) \
@@ -798,172 +787,160 @@ extern "C" {
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
- enum
- {
- MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
- MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
- MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
- MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
- MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
- MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
- MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
- MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
- MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
- MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
- MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
- MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
- };
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
- enum
- {
- MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
- MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
- };
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
- void mad_header_init(struct mad_header *);
+void mad_header_init(struct mad_header *);
# define mad_header_finish(header) /* nothing */
- int mad_header_decode(struct mad_header *, struct mad_stream *);
+int mad_header_decode(struct mad_header *, struct mad_stream *);
- void mad_frame_init(struct mad_frame *);
- void mad_frame_finish(struct mad_frame *);
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
- int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
- void mad_frame_mute(struct mad_frame *);
+void mad_frame_mute(struct mad_frame *);
# endif
- /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
+/* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_SYNTH_H
# define LIBMAD_SYNTH_H
- struct mad_pcm
- {
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
- };
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
- struct mad_synth
- {
- mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
- /* [ch][eo][peo][s][v] */
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
- unsigned int phase; /* current processing phase */
+ unsigned int phase; /* current processing phase */
- struct mad_pcm pcm; /* PCM output */
- };
+ struct mad_pcm pcm; /* PCM output */
+};
- /* single channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_SINGLE = 0
- };
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
- /* dual channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_DUAL_1 = 0,
- MAD_PCM_CHANNEL_DUAL_2 = 1
- };
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
- /* stereo PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_STEREO_LEFT = 0,
- MAD_PCM_CHANNEL_STEREO_RIGHT = 1
- };
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
- void mad_synth_init(struct mad_synth *);
+void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */
- void mad_synth_mute(struct mad_synth *);
+void mad_synth_mute(struct mad_synth *);
- void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif
- /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
+/* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_DECODER_H
# define LIBMAD_DECODER_H
- enum mad_decoder_mode
- {
- MAD_DECODER_MODE_SYNC = 0,
- MAD_DECODER_MODE_ASYNC
- };
-
- enum mad_flow
- {
- MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
- MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
- MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
- MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
- };
-
- struct mad_decoder
- {
- enum mad_decoder_mode mode;
-
- int options;
-
- struct
- {
- long pid;
- int in;
- int out;
- } async;
-
- struct
- {
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- } *sync;
-
- void *cb_data;
-
- enum mad_flow(*input_func)(void *, struct mad_stream *);
- enum mad_flow(*header_func)(void *, struct mad_header const *);
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *, struct mad_frame *);
- enum mad_flow(*output_func)(void *,
- struct mad_header const *, struct mad_pcm *);
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- enum mad_flow(*message_func)(void *, void *, unsigned int *);
- };
-
- void mad_decoder_init(struct mad_decoder *, void *,
- enum mad_flow(*)(void *, struct mad_stream *),
- enum mad_flow(*)(void *, struct mad_header const *),
- enum mad_flow(*)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*)(void *, void *, unsigned int *));
- int mad_decoder_finish(struct mad_decoder *);
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
((void) ((decoder)->options = (opts)))
- int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
- int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
# endif
diff --git a/src/filters/transform/MpaDecFilter/libmad/stream.c b/src/filters/transform/MpaDecFilter/libmad/stream.c
index 605f5210b..b14b6de4d 100644
--- a/src/filters/transform/MpaDecFilter/libmad/stream.c
+++ b/src/filters/transform/MpaDecFilter/libmad/stream.c
@@ -35,25 +35,25 @@
*/
void mad_stream_init(struct mad_stream *stream)
{
- stream->buffer = 0;
- stream->bufend = 0;
- stream->skiplen = 0;
+ stream->buffer = 0;
+ stream->bufend = 0;
+ stream->skiplen = 0;
- stream->sync = 0;
- stream->freerate = 0;
+ stream->sync = 0;
+ stream->freerate = 0;
- stream->this_frame = 0;
- stream->next_frame = 0;
- mad_bit_init(&stream->ptr, 0);
+ stream->this_frame = 0;
+ stream->next_frame = 0;
+ mad_bit_init(&stream->ptr, 0);
- mad_bit_init(&stream->anc_ptr, 0);
- stream->anc_bitlen = 0;
+ mad_bit_init(&stream->anc_ptr, 0);
+ stream->anc_bitlen = 0;
- stream->main_data = 0;
- stream->md_len = 0;
+ stream->main_data = 0;
+ stream->md_len = 0;
- stream->options = 0;
- stream->error = MAD_ERROR_NONE;
+ stream->options = 0;
+ stream->error = MAD_ERROR_NONE;
}
/*
@@ -62,14 +62,13 @@ void mad_stream_init(struct mad_stream *stream)
*/
void mad_stream_finish(struct mad_stream *stream)
{
- if(stream->main_data)
- {
- free(stream->main_data);
- stream->main_data = 0;
- }
-
- mad_bit_finish(&stream->anc_ptr);
- mad_bit_finish(&stream->ptr);
+ if (stream->main_data) {
+ free(stream->main_data);
+ stream->main_data = 0;
+ }
+
+ mad_bit_finish(&stream->anc_ptr);
+ mad_bit_finish(&stream->ptr);
}
/*
@@ -77,17 +76,17 @@ void mad_stream_finish(struct mad_stream *stream)
* DESCRIPTION: set stream buffer pointers
*/
void mad_stream_buffer(struct mad_stream *stream,
- unsigned char const *buffer, unsigned long length)
+ unsigned char const *buffer, unsigned long length)
{
- stream->buffer = buffer;
- stream->bufend = buffer + length;
+ stream->buffer = buffer;
+ stream->bufend = buffer + length;
- stream->this_frame = buffer;
- stream->next_frame = buffer;
+ stream->this_frame = buffer;
+ stream->next_frame = buffer;
- stream->sync = 1;
+ stream->sync = 1;
- mad_bit_init(&stream->ptr, buffer);
+ mad_bit_init(&stream->ptr, buffer);
}
/*
@@ -96,7 +95,7 @@ void mad_stream_buffer(struct mad_stream *stream,
*/
void mad_stream_skip(struct mad_stream *stream, unsigned long length)
{
- stream->skiplen += length;
+ stream->skiplen += length;
}
/*
@@ -105,21 +104,21 @@ void mad_stream_skip(struct mad_stream *stream, unsigned long length)
*/
int mad_stream_sync(struct mad_stream *stream)
{
- register unsigned char const *ptr, *end;
+ register unsigned char const *ptr, *end;
- ptr = mad_bit_nextbyte(&stream->ptr);
- end = stream->bufend;
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ end = stream->bufend;
- while(ptr < end - 1 &&
- !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
- ++ptr;
+ while (ptr < end - 1 &&
+ !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
+ ++ptr;
- if(end - ptr < MAD_BUFFER_GUARD)
- return -1;
+ if (end - ptr < MAD_BUFFER_GUARD)
+ return -1;
- mad_bit_init(&stream->ptr, ptr);
+ mad_bit_init(&stream->ptr, ptr);
- return 0;
+ return 0;
}
/*
@@ -128,57 +127,34 @@ int mad_stream_sync(struct mad_stream *stream)
*/
char const *mad_stream_errorstr(struct mad_stream const *stream)
{
- switch(stream->error)
- {
- case MAD_ERROR_NONE:
- return "no error";
-
- case MAD_ERROR_BUFLEN:
- return "input buffer too small (or EOF)";
- case MAD_ERROR_BUFPTR:
- return "invalid (null) buffer pointer";
-
- case MAD_ERROR_NOMEM:
- return "not enough memory";
-
- case MAD_ERROR_LOSTSYNC:
- return "lost synchronization";
- case MAD_ERROR_BADLAYER:
- return "reserved header layer value";
- case MAD_ERROR_BADBITRATE:
- return "forbidden bitrate value";
- case MAD_ERROR_BADSAMPLERATE:
- return "reserved sample frequency value";
- case MAD_ERROR_BADEMPHASIS:
- return "reserved emphasis value";
-
- case MAD_ERROR_BADCRC:
- return "CRC check failed";
- case MAD_ERROR_BADBITALLOC:
- return "forbidden bit allocation value";
- case MAD_ERROR_BADSCALEFACTOR:
- return "bad scalefactor index";
- case MAD_ERROR_BADMODE:
- return "bad bitrate/mode combination";
- case MAD_ERROR_BADFRAMELEN:
- return "bad frame length";
- case MAD_ERROR_BADBIGVALUES:
- return "bad big_values count";
- case MAD_ERROR_BADBLOCKTYPE:
- return "reserved block_type";
- case MAD_ERROR_BADSCFSI:
- return "bad scalefactor selection info";
- case MAD_ERROR_BADDATAPTR:
- return "bad main_data_begin pointer";
- case MAD_ERROR_BADPART3LEN:
- return "bad audio data length";
- case MAD_ERROR_BADHUFFTABLE:
- return "bad Huffman table select";
- case MAD_ERROR_BADHUFFDATA:
- return "Huffman data overrun";
- case MAD_ERROR_BADSTEREO:
- return "incompatible block_type for JS";
- }
-
- return 0;
+ switch (stream->error) {
+ case MAD_ERROR_NONE: return "no error";
+
+ case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)";
+ case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer";
+
+ case MAD_ERROR_NOMEM: return "not enough memory";
+
+ case MAD_ERROR_LOSTSYNC: return "lost synchronization";
+ case MAD_ERROR_BADLAYER: return "reserved header layer value";
+ case MAD_ERROR_BADBITRATE: return "forbidden bitrate value";
+ case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value";
+ case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value";
+
+ case MAD_ERROR_BADCRC: return "CRC check failed";
+ case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value";
+ case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index";
+ case MAD_ERROR_BADMODE: return "bad bitrate/mode combination";
+ case MAD_ERROR_BADFRAMELEN: return "bad frame length";
+ case MAD_ERROR_BADBIGVALUES: return "bad big_values count";
+ case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type";
+ case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info";
+ case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer";
+ case MAD_ERROR_BADPART3LEN: return "bad audio data length";
+ case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select";
+ case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun";
+ case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS";
+ }
+
+ return 0;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/stream.h b/src/filters/transform/MpaDecFilter/libmad/stream.h
index df59ee3f4..364a337b6 100644
--- a/src/filters/transform/MpaDecFilter/libmad/stream.h
+++ b/src/filters/transform/MpaDecFilter/libmad/stream.h
@@ -26,70 +26,67 @@
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
-enum mad_error
-{
- MAD_ERROR_NONE = 0x0000, /* no error */
-
- MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
- MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
-
- MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
-
- MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
- MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
- MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
- MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
- MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
-
- MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
- MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
- MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
- MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
- MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
- MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
- MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
- MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
- MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
- MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
- MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
- MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
- MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
-struct mad_stream
-{
- unsigned char const *buffer; /* input bitstream buffer */
- unsigned char const *bufend; /* end of buffer */
- unsigned long skiplen; /* bytes to skip before next frame */
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
- int sync; /* stream sync found */
- unsigned long freerate; /* free bitrate (fixed) */
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
- unsigned char const *this_frame; /* start of current frame */
- unsigned char const *next_frame; /* start of next frame */
- struct mad_bitptr ptr; /* current processing bit pointer */
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
- struct mad_bitptr anc_ptr; /* ancillary bits pointer */
- unsigned int anc_bitlen; /* number of ancillary bits */
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
- unsigned char(*main_data)[MAD_BUFFER_MDLEN];
- /* Layer III main_data() */
- unsigned int md_len; /* bytes in main_data */
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
- int options; /* decoding options (see below) */
- enum mad_error error; /* error code (see above) */
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
};
-enum
-{
- MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
- MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
- MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
};
@@ -100,7 +97,7 @@ void mad_stream_finish(struct mad_stream *);
((void) ((stream)->options = (opts)))
void mad_stream_buffer(struct mad_stream *,
- unsigned char const *, unsigned long);
+ unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long);
int mad_stream_sync(struct mad_stream *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/synth.c b/src/filters/transform/MpaDecFilter/libmad/synth.c
index 32a7de2dc..61dec1ba4 100644
--- a/src/filters/transform/MpaDecFilter/libmad/synth.c
+++ b/src/filters/transform/MpaDecFilter/libmad/synth.c
@@ -34,13 +34,13 @@
*/
void mad_synth_init(struct mad_synth *synth)
{
- mad_synth_mute(synth);
+ mad_synth_mute(synth);
- synth->phase = 0;
+ synth->phase = 0;
- synth->pcm.samplerate = 0;
- synth->pcm.channels = 0;
- synth->pcm.length = 0;
+ synth->pcm.samplerate = 0;
+ synth->pcm.channels = 0;
+ synth->pcm.length = 0;
}
/*
@@ -49,19 +49,16 @@ void mad_synth_init(struct mad_synth *synth)
*/
void mad_synth_mute(struct mad_synth *synth)
{
- unsigned int ch, s, v;
-
- for(ch = 0; ch < 2; ++ch)
- {
- for(s = 0; s < 16; ++s)
- {
- for(v = 0; v < 8; ++v)
- {
- synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] =
- synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0;
- }
- }
+ unsigned int ch, s, v;
+
+ for (ch = 0; ch < 2; ++ch) {
+ for (s = 0; s < 16; ++s) {
+ for (v = 0; v < 8; ++v) {
+ synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] =
+ synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0;
+ }
}
+ }
}
/*
@@ -123,33 +120,33 @@ void mad_synth_mute(struct mad_synth *synth)
*/
static
void dct32(mad_fixed_t const in[32], unsigned int slot,
- mad_fixed_t lo[16][8], mad_fixed_t hi[16][8])
+ mad_fixed_t lo[16][8], mad_fixed_t hi[16][8])
{
- mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
- mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
- mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23;
- mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31;
- mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39;
- mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47;
- mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55;
- mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63;
- mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71;
- mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79;
- mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87;
- mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95;
- mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103;
- mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111;
- mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119;
- mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127;
- mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135;
- mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143;
- mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151;
- mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159;
- mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167;
- mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175;
- mad_fixed_t t176;
-
- /* costab[i] = cos(PI / (2 * 32) * i) */
+ mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
+ mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
+ mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23;
+ mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31;
+ mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39;
+ mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47;
+ mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55;
+ mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63;
+ mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71;
+ mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79;
+ mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87;
+ mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95;
+ mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103;
+ mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111;
+ mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119;
+ mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127;
+ mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135;
+ mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143;
+ mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151;
+ mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159;
+ mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167;
+ mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175;
+ mad_fixed_t t176;
+
+ /* costab[i] = cos(PI / (2 * 32) * i) */
# if defined(OPT_DCTO)
# define costab1 MAD_F(0x7fd8878e)
@@ -217,364 +214,300 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */
# endif
- t0 = in[0] + in[31];
- t16 = MUL(in[0] - in[31], costab1);
- t1 = in[15] + in[16];
- t17 = MUL(in[15] - in[16], costab31);
-
- t41 = t16 + t17;
- t59 = MUL(t16 - t17, costab2);
- t33 = t0 + t1;
- t50 = MUL(t0 - t1, costab2);
-
- t2 = in[7] + in[24];
- t18 = MUL(in[7] - in[24], costab15);
- t3 = in[8] + in[23];
- t19 = MUL(in[8] - in[23], costab17);
-
- t42 = t18 + t19;
- t60 = MUL(t18 - t19, costab30);
- t34 = t2 + t3;
- t51 = MUL(t2 - t3, costab30);
-
- t4 = in[3] + in[28];
- t20 = MUL(in[3] - in[28], costab7);
- t5 = in[12] + in[19];
- t21 = MUL(in[12] - in[19], costab25);
-
- t43 = t20 + t21;
- t61 = MUL(t20 - t21, costab14);
- t35 = t4 + t5;
- t52 = MUL(t4 - t5, costab14);
-
- t6 = in[4] + in[27];
- t22 = MUL(in[4] - in[27], costab9);
- t7 = in[11] + in[20];
- t23 = MUL(in[11] - in[20], costab23);
-
- t44 = t22 + t23;
- t62 = MUL(t22 - t23, costab18);
- t36 = t6 + t7;
- t53 = MUL(t6 - t7, costab18);
-
- t8 = in[1] + in[30];
- t24 = MUL(in[1] - in[30], costab3);
- t9 = in[14] + in[17];
- t25 = MUL(in[14] - in[17], costab29);
-
- t45 = t24 + t25;
- t63 = MUL(t24 - t25, costab6);
- t37 = t8 + t9;
- t54 = MUL(t8 - t9, costab6);
-
- t10 = in[6] + in[25];
- t26 = MUL(in[6] - in[25], costab13);
- t11 = in[9] + in[22];
- t27 = MUL(in[9] - in[22], costab19);
-
- t46 = t26 + t27;
- t64 = MUL(t26 - t27, costab26);
- t38 = t10 + t11;
- t55 = MUL(t10 - t11, costab26);
-
- t12 = in[2] + in[29];
- t28 = MUL(in[2] - in[29], costab5);
- t13 = in[13] + in[18];
- t29 = MUL(in[13] - in[18], costab27);
-
- t47 = t28 + t29;
- t65 = MUL(t28 - t29, costab10);
- t39 = t12 + t13;
- t56 = MUL(t12 - t13, costab10);
-
- t14 = in[5] + in[26];
- t30 = MUL(in[5] - in[26], costab11);
- t15 = in[10] + in[21];
- t31 = MUL(in[10] - in[21], costab21);
-
- t48 = t30 + t31;
- t66 = MUL(t30 - t31, costab22);
- t40 = t14 + t15;
- t57 = MUL(t14 - t15, costab22);
-
- t69 = t33 + t34;
- t89 = MUL(t33 - t34, costab4);
- t70 = t35 + t36;
- t90 = MUL(t35 - t36, costab28);
- t71 = t37 + t38;
- t91 = MUL(t37 - t38, costab12);
- t72 = t39 + t40;
- t92 = MUL(t39 - t40, costab20);
- t73 = t41 + t42;
- t94 = MUL(t41 - t42, costab4);
- t74 = t43 + t44;
- t95 = MUL(t43 - t44, costab28);
- t75 = t45 + t46;
- t96 = MUL(t45 - t46, costab12);
- t76 = t47 + t48;
- t97 = MUL(t47 - t48, costab20);
+ t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1);
+ t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31);
- t78 = t50 + t51;
- t100 = MUL(t50 - t51, costab4);
- t79 = t52 + t53;
- t101 = MUL(t52 - t53, costab28);
- t80 = t54 + t55;
- t102 = MUL(t54 - t55, costab12);
- t81 = t56 + t57;
- t103 = MUL(t56 - t57, costab20);
+ t41 = t16 + t17;
+ t59 = MUL(t16 - t17, costab2);
+ t33 = t0 + t1;
+ t50 = MUL(t0 - t1, costab2);
- t83 = t59 + t60;
- t106 = MUL(t59 - t60, costab4);
- t84 = t61 + t62;
- t107 = MUL(t61 - t62, costab28);
- t85 = t63 + t64;
- t108 = MUL(t63 - t64, costab12);
- t86 = t65 + t66;
- t109 = MUL(t65 - t66, costab20);
+ t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15);
+ t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17);
- t113 = t69 + t70;
- t114 = t71 + t72;
+ t42 = t18 + t19;
+ t60 = MUL(t18 - t19, costab30);
+ t34 = t2 + t3;
+ t51 = MUL(t2 - t3, costab30);
- /* 0 */
- hi[15][slot] = SHIFT(t113 + t114);
- /* 16 */
- lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16));
+ t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7);
+ t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25);
- t115 = t73 + t74;
- t116 = t75 + t76;
+ t43 = t20 + t21;
+ t61 = MUL(t20 - t21, costab14);
+ t35 = t4 + t5;
+ t52 = MUL(t4 - t5, costab14);
- t32 = t115 + t116;
+ t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9);
+ t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23);
- /* 1 */
- hi[14][slot] = SHIFT(t32);
+ t44 = t22 + t23;
+ t62 = MUL(t22 - t23, costab18);
+ t36 = t6 + t7;
+ t53 = MUL(t6 - t7, costab18);
- t118 = t78 + t79;
- t119 = t80 + t81;
+ t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3);
+ t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29);
- t58 = t118 + t119;
+ t45 = t24 + t25;
+ t63 = MUL(t24 - t25, costab6);
+ t37 = t8 + t9;
+ t54 = MUL(t8 - t9, costab6);
- /* 2 */
- hi[13][slot] = SHIFT(t58);
+ t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13);
+ t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19);
- t121 = t83 + t84;
- t122 = t85 + t86;
+ t46 = t26 + t27;
+ t64 = MUL(t26 - t27, costab26);
+ t38 = t10 + t11;
+ t55 = MUL(t10 - t11, costab26);
- t67 = t121 + t122;
+ t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5);
+ t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27);
- t49 = (t67 * 2) - t32;
+ t47 = t28 + t29;
+ t65 = MUL(t28 - t29, costab10);
+ t39 = t12 + t13;
+ t56 = MUL(t12 - t13, costab10);
- /* 3 */
- hi[12][slot] = SHIFT(t49);
+ t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11);
+ t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21);
- t125 = t89 + t90;
- t126 = t91 + t92;
+ t48 = t30 + t31;
+ t66 = MUL(t30 - t31, costab22);
+ t40 = t14 + t15;
+ t57 = MUL(t14 - t15, costab22);
- t93 = t125 + t126;
+ t69 = t33 + t34; t89 = MUL(t33 - t34, costab4);
+ t70 = t35 + t36; t90 = MUL(t35 - t36, costab28);
+ t71 = t37 + t38; t91 = MUL(t37 - t38, costab12);
+ t72 = t39 + t40; t92 = MUL(t39 - t40, costab20);
+ t73 = t41 + t42; t94 = MUL(t41 - t42, costab4);
+ t74 = t43 + t44; t95 = MUL(t43 - t44, costab28);
+ t75 = t45 + t46; t96 = MUL(t45 - t46, costab12);
+ t76 = t47 + t48; t97 = MUL(t47 - t48, costab20);
- /* 4 */
- hi[11][slot] = SHIFT(t93);
+ t78 = t50 + t51; t100 = MUL(t50 - t51, costab4);
+ t79 = t52 + t53; t101 = MUL(t52 - t53, costab28);
+ t80 = t54 + t55; t102 = MUL(t54 - t55, costab12);
+ t81 = t56 + t57; t103 = MUL(t56 - t57, costab20);
- t128 = t94 + t95;
- t129 = t96 + t97;
+ t83 = t59 + t60; t106 = MUL(t59 - t60, costab4);
+ t84 = t61 + t62; t107 = MUL(t61 - t62, costab28);
+ t85 = t63 + t64; t108 = MUL(t63 - t64, costab12);
+ t86 = t65 + t66; t109 = MUL(t65 - t66, costab20);
- t98 = t128 + t129;
+ t113 = t69 + t70;
+ t114 = t71 + t72;
- t68 = (t98 * 2) - t49;
+ /* 0 */ hi[15][slot] = SHIFT(t113 + t114);
+ /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16));
- /* 5 */
- hi[10][slot] = SHIFT(t68);
+ t115 = t73 + t74;
+ t116 = t75 + t76;
- t132 = t100 + t101;
- t133 = t102 + t103;
+ t32 = t115 + t116;
- t104 = t132 + t133;
+ /* 1 */ hi[14][slot] = SHIFT(t32);
- t82 = (t104 * 2) - t58;
+ t118 = t78 + t79;
+ t119 = t80 + t81;
- /* 6 */
- hi[ 9][slot] = SHIFT(t82);
+ t58 = t118 + t119;
- t136 = t106 + t107;
- t137 = t108 + t109;
+ /* 2 */ hi[13][slot] = SHIFT(t58);
- t110 = t136 + t137;
+ t121 = t83 + t84;
+ t122 = t85 + t86;
- t87 = (t110 * 2) - t67;
+ t67 = t121 + t122;
- t77 = (t87 * 2) - t68;
+ t49 = (t67 * 2) - t32;
- /* 7 */
- hi[ 8][slot] = SHIFT(t77);
+ /* 3 */ hi[12][slot] = SHIFT(t49);
- t141 = MUL(t69 - t70, costab8);
- t142 = MUL(t71 - t72, costab24);
- t143 = t141 + t142;
+ t125 = t89 + t90;
+ t126 = t91 + t92;
- /* 8 */
- hi[ 7][slot] = SHIFT(t143);
- /* 24 */
- lo[ 8][slot] =
- SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
+ t93 = t125 + t126;
- t144 = MUL(t73 - t74, costab8);
- t145 = MUL(t75 - t76, costab24);
- t146 = t144 + t145;
+ /* 4 */ hi[11][slot] = SHIFT(t93);
- t88 = (t146 * 2) - t77;
+ t128 = t94 + t95;
+ t129 = t96 + t97;
- /* 9 */
- hi[ 6][slot] = SHIFT(t88);
+ t98 = t128 + t129;
- t148 = MUL(t78 - t79, costab8);
- t149 = MUL(t80 - t81, costab24);
- t150 = t148 + t149;
+ t68 = (t98 * 2) - t49;
- t105 = (t150 * 2) - t82;
+ /* 5 */ hi[10][slot] = SHIFT(t68);
- /* 10 */
- hi[ 5][slot] = SHIFT(t105);
+ t132 = t100 + t101;
+ t133 = t102 + t103;
- t152 = MUL(t83 - t84, costab8);
- t153 = MUL(t85 - t86, costab24);
- t154 = t152 + t153;
+ t104 = t132 + t133;
- t111 = (t154 * 2) - t87;
+ t82 = (t104 * 2) - t58;
- t99 = (t111 * 2) - t88;
+ /* 6 */ hi[ 9][slot] = SHIFT(t82);
- /* 11 */
- hi[ 4][slot] = SHIFT(t99);
+ t136 = t106 + t107;
+ t137 = t108 + t109;
- t157 = MUL(t89 - t90, costab8);
- t158 = MUL(t91 - t92, costab24);
- t159 = t157 + t158;
+ t110 = t136 + t137;
- t127 = (t159 * 2) - t93;
+ t87 = (t110 * 2) - t67;
- /* 12 */
- hi[ 3][slot] = SHIFT(t127);
+ t77 = (t87 * 2) - t68;
- t160 = (MUL(t125 - t126, costab16) * 2) - t127;
+ /* 7 */ hi[ 8][slot] = SHIFT(t77);
- /* 20 */
- lo[ 4][slot] = SHIFT(t160);
- /* 28 */
- lo[12][slot] =
- SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
+ t141 = MUL(t69 - t70, costab8);
+ t142 = MUL(t71 - t72, costab24);
+ t143 = t141 + t142;
- t161 = MUL(t94 - t95, costab8);
- t162 = MUL(t96 - t97, costab24);
- t163 = t161 + t162;
+ /* 8 */ hi[ 7][slot] = SHIFT(t143);
+ /* 24 */ lo[ 8][slot] =
+ SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
- t130 = (t163 * 2) - t98;
+ t144 = MUL(t73 - t74, costab8);
+ t145 = MUL(t75 - t76, costab24);
+ t146 = t144 + t145;
- t112 = (t130 * 2) - t99;
+ t88 = (t146 * 2) - t77;
- /* 13 */
- hi[ 2][slot] = SHIFT(t112);
+ /* 9 */ hi[ 6][slot] = SHIFT(t88);
- t164 = (MUL(t128 - t129, costab16) * 2) - t130;
+ t148 = MUL(t78 - t79, costab8);
+ t149 = MUL(t80 - t81, costab24);
+ t150 = t148 + t149;
- t166 = MUL(t100 - t101, costab8);
- t167 = MUL(t102 - t103, costab24);
- t168 = t166 + t167;
+ t105 = (t150 * 2) - t82;
- t134 = (t168 * 2) - t104;
+ /* 10 */ hi[ 5][slot] = SHIFT(t105);
- t120 = (t134 * 2) - t105;
+ t152 = MUL(t83 - t84, costab8);
+ t153 = MUL(t85 - t86, costab24);
+ t154 = t152 + t153;
- /* 14 */
- hi[ 1][slot] = SHIFT(t120);
+ t111 = (t154 * 2) - t87;
- t135 = (MUL(t118 - t119, costab16) * 2) - t120;
+ t99 = (t111 * 2) - t88;
- /* 18 */
- lo[ 2][slot] = SHIFT(t135);
+ /* 11 */ hi[ 4][slot] = SHIFT(t99);
- t169 = (MUL(t132 - t133, costab16) * 2) - t134;
+ t157 = MUL(t89 - t90, costab8);
+ t158 = MUL(t91 - t92, costab24);
+ t159 = t157 + t158;
- t151 = (t169 * 2) - t135;
+ t127 = (t159 * 2) - t93;
- /* 22 */
- lo[ 6][slot] = SHIFT(t151);
+ /* 12 */ hi[ 3][slot] = SHIFT(t127);
- t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
+ t160 = (MUL(t125 - t126, costab16) * 2) - t127;
- /* 26 */
- lo[10][slot] = SHIFT(t170);
- /* 30 */
- lo[14][slot] =
- SHIFT((((((MUL(t166 - t167, costab16) * 2) -
- t168) * 2) - t169) * 2) - t170);
+ /* 20 */ lo[ 4][slot] = SHIFT(t160);
+ /* 28 */ lo[12][slot] =
+ SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
- t171 = MUL(t106 - t107, costab8);
- t172 = MUL(t108 - t109, costab24);
- t173 = t171 + t172;
+ t161 = MUL(t94 - t95, costab8);
+ t162 = MUL(t96 - t97, costab24);
+ t163 = t161 + t162;
- t138 = (t173 * 2) - t110;
+ t130 = (t163 * 2) - t98;
- t123 = (t138 * 2) - t111;
+ t112 = (t130 * 2) - t99;
- t139 = (MUL(t121 - t122, costab16) * 2) - t123;
+ /* 13 */ hi[ 2][slot] = SHIFT(t112);
- t117 = (t123 * 2) - t112;
+ t164 = (MUL(t128 - t129, costab16) * 2) - t130;
- /* 15 */
- hi[ 0][slot] = SHIFT(t117);
+ t166 = MUL(t100 - t101, costab8);
+ t167 = MUL(t102 - t103, costab24);
+ t168 = t166 + t167;
- t124 = (MUL(t115 - t116, costab16) * 2) - t117;
+ t134 = (t168 * 2) - t104;
- /* 17 */
- lo[ 1][slot] = SHIFT(t124);
+ t120 = (t134 * 2) - t105;
- t131 = (t139 * 2) - t124;
+ /* 14 */ hi[ 1][slot] = SHIFT(t120);
- /* 19 */
- lo[ 3][slot] = SHIFT(t131);
+ t135 = (MUL(t118 - t119, costab16) * 2) - t120;
- t140 = (t164 * 2) - t131;
+ /* 18 */ lo[ 2][slot] = SHIFT(t135);
- /* 21 */
- lo[ 5][slot] = SHIFT(t140);
+ t169 = (MUL(t132 - t133, costab16) * 2) - t134;
- t174 = (MUL(t136 - t137, costab16) * 2) - t138;
+ t151 = (t169 * 2) - t135;
- t155 = (t174 * 2) - t139;
+ /* 22 */ lo[ 6][slot] = SHIFT(t151);
- t147 = (t155 * 2) - t140;
+ t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
- /* 23 */
- lo[ 7][slot] = SHIFT(t147);
+ /* 26 */ lo[10][slot] = SHIFT(t170);
+ /* 30 */ lo[14][slot] =
+ SHIFT((((((MUL(t166 - t167, costab16) * 2) -
+ t168) * 2) - t169) * 2) - t170);
- t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
+ t171 = MUL(t106 - t107, costab8);
+ t172 = MUL(t108 - t109, costab24);
+ t173 = t171 + t172;
- /* 25 */
- lo[ 9][slot] = SHIFT(t156);
+ t138 = (t173 * 2) - t110;
- t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
+ t123 = (t138 * 2) - t111;
- t165 = (t175 * 2) - t156;
+ t139 = (MUL(t121 - t122, costab16) * 2) - t123;
- /* 27 */
- lo[11][slot] = SHIFT(t165);
+ t117 = (t123 * 2) - t112;
- t176 = (((((MUL(t161 - t162, costab16) * 2) -
- t163) * 2) - t164) * 2) - t165;
+ /* 15 */ hi[ 0][slot] = SHIFT(t117);
- /* 29 */
- lo[13][slot] = SHIFT(t176);
- /* 31 */
- lo[15][slot] =
- SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
- t173) * 2) - t174) * 2) - t175) * 2) - t176);
+ t124 = (MUL(t115 - t116, costab16) * 2) - t117;
- /*
- * Totals:
- * 80 multiplies
- * 80 additions
- * 119 subtractions
- * 49 shifts (not counting SSO)
- */
+ /* 17 */ lo[ 1][slot] = SHIFT(t124);
+
+ t131 = (t139 * 2) - t124;
+
+ /* 19 */ lo[ 3][slot] = SHIFT(t131);
+
+ t140 = (t164 * 2) - t131;
+
+ /* 21 */ lo[ 5][slot] = SHIFT(t140);
+
+ t174 = (MUL(t136 - t137, costab16) * 2) - t138;
+
+ t155 = (t174 * 2) - t139;
+
+ t147 = (t155 * 2) - t140;
+
+ /* 23 */ lo[ 7][slot] = SHIFT(t147);
+
+ t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
+
+ /* 25 */ lo[ 9][slot] = SHIFT(t156);
+
+ t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
+
+ t165 = (t175 * 2) - t156;
+
+ /* 27 */ lo[11][slot] = SHIFT(t165);
+
+ t176 = (((((MUL(t161 - t162, costab16) * 2) -
+ t163) * 2) - t164) * 2) - t165;
+
+ /* 29 */ lo[13][slot] = SHIFT(t176);
+ /* 31 */ lo[15][slot] =
+ SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
+ t173) * 2) - t174) * 2) - t175) * 2) - t176);
+
+ /*
+ * Totals:
+ * 80 multiplies
+ * 80 additions
+ * 119 subtractions
+ * 49 shifts (not counting SSO)
+ */
}
# undef MUL
@@ -608,14 +541,13 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# endif
static
-mad_fixed_t const D[17][32] =
-{
+mad_fixed_t const D[17][32] = {
# include "D.dat"
};
# if defined(ASO_SYNTH)
void synth_full(struct mad_synth *, struct mad_frame const *,
- unsigned int, unsigned int);
+ unsigned int, unsigned int);
# else
/*
* NAME: synth->full()
@@ -623,137 +555,134 @@ void synth_full(struct mad_synth *, struct mad_frame const *,
*/
static
void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
- unsigned int nch, unsigned int ns)
+ unsigned int nch, unsigned int ns)
{
- unsigned int phase, ch, s, sb, pe, po;
- mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
- mad_fixed_t const(*sbsample)[36][32];
- register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
- register mad_fixed_t const(*Dptr)[32], *ptr;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- for(ch = 0; ch < nch; ++ch)
- {
- sbsample = &frame->sbsample[ch];
- filter = &synth->filter[ch];
- phase = synth->phase;
- pcm1 = synth->pcm.samples[ch];
-
- for(s = 0; s < ns; ++s)
- {
- dct32((*sbsample)[s], phase >> 1,
- (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
-
- pe = phase & ~1;
- po = ((phase - 1) & 0xf) | 1;
-
- /* calculate 32 samples */
-
- fe = &(*filter)[0][ phase & 1][0];
- fx = &(*filter)[0][~phase & 1][0];
- fo = &(*filter)[1][~phase & 1][0];
-
- Dptr = &D[0];
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fx)[0], ptr[ 0]);
- MLA(hi, lo, (*fx)[1], ptr[14]);
- MLA(hi, lo, (*fx)[2], ptr[12]);
- MLA(hi, lo, (*fx)[3], ptr[10]);
- MLA(hi, lo, (*fx)[4], ptr[ 8]);
- MLA(hi, lo, (*fx)[5], ptr[ 6]);
- MLA(hi, lo, (*fx)[6], ptr[ 4]);
- MLA(hi, lo, (*fx)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- pcm2 = pcm1 + 30;
-
- for(sb = 1; sb < 16; ++sb)
- {
- ++fe;
- ++Dptr;
-
- /* D[32 - sb][i] == -D[sb][31 - i] */
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- ptr = *Dptr - pe;
- ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
- MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
-
- ptr = *Dptr - po;
- MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
- MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
-
- *pcm2-- = SHIFT(MLZ(hi, lo));
-
- ++fo;
- }
-
- ++Dptr;
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
-
- *pcm1 = SHIFT(-MLZ(hi, lo));
- pcm1 += 16;
-
- phase = (phase + 1) % 16;
- }
+ unsigned int phase, ch, s, sb, pe, po;
+ mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
+ mad_fixed_t const (*sbsample)[36][32];
+ register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
+ register mad_fixed_t const (*Dptr)[32], *ptr;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ for (ch = 0; ch < nch; ++ch) {
+ sbsample = &frame->sbsample[ch];
+ filter = &synth->filter[ch];
+ phase = synth->phase;
+ pcm1 = synth->pcm.samples[ch];
+
+ for (s = 0; s < ns; ++s) {
+ dct32((*sbsample)[s], phase >> 1,
+ (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
+
+ pe = phase & ~1;
+ po = ((phase - 1) & 0xf) | 1;
+
+ /* calculate 32 samples */
+
+ fe = &(*filter)[0][ phase & 1][0];
+ fx = &(*filter)[0][~phase & 1][0];
+ fo = &(*filter)[1][~phase & 1][0];
+
+ Dptr = &D[0];
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ pcm2 = pcm1 + 30;
+
+ for (sb = 1; sb < 16; ++sb) {
+ ++fe;
+ ++Dptr;
+
+ /* D[32 - sb][i] == -D[sb][31 - i] */
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ ptr = *Dptr - pe;
+ ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
+ MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
+
+ ptr = *Dptr - po;
+ MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
+ *pcm2-- = SHIFT(MLZ(hi, lo));
+
+ ++fo;
+ }
+
+ ++Dptr;
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+
+ *pcm1 = SHIFT(-MLZ(hi, lo));
+ pcm1 += 16;
+
+ phase = (phase + 1) % 16;
}
+ }
}
# endif
@@ -763,140 +692,136 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
*/
static
void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
- unsigned int nch, unsigned int ns)
+ unsigned int nch, unsigned int ns)
{
- unsigned int phase, ch, s, sb, pe, po;
- mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
- mad_fixed_t const(*sbsample)[36][32];
- register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
- register mad_fixed_t const(*Dptr)[32], *ptr;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- for(ch = 0; ch < nch; ++ch)
- {
- sbsample = &frame->sbsample[ch];
- filter = &synth->filter[ch];
- phase = synth->phase;
- pcm1 = synth->pcm.samples[ch];
-
- for(s = 0; s < ns; ++s)
- {
- dct32((*sbsample)[s], phase >> 1,
- (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
-
- pe = phase & ~1;
- po = ((phase - 1) & 0xf) | 1;
-
- /* calculate 16 samples */
-
- fe = &(*filter)[0][ phase & 1][0];
- fx = &(*filter)[0][~phase & 1][0];
- fo = &(*filter)[1][~phase & 1][0];
-
- Dptr = &D[0];
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fx)[0], ptr[ 0]);
- MLA(hi, lo, (*fx)[1], ptr[14]);
- MLA(hi, lo, (*fx)[2], ptr[12]);
- MLA(hi, lo, (*fx)[3], ptr[10]);
- MLA(hi, lo, (*fx)[4], ptr[ 8]);
- MLA(hi, lo, (*fx)[5], ptr[ 6]);
- MLA(hi, lo, (*fx)[6], ptr[ 4]);
- MLA(hi, lo, (*fx)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- pcm2 = pcm1 + 14;
-
- for(sb = 1; sb < 16; ++sb)
- {
- ++fe;
- ++Dptr;
-
- /* D[32 - sb][i] == -D[sb][31 - i] */
-
- if(!(sb & 1))
- {
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- ptr = *Dptr - po;
- ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
- MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
-
- ptr = *Dptr - pe;
- MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
- MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
-
- *pcm2-- = SHIFT(MLZ(hi, lo));
- }
-
- ++fo;
- }
-
- ++Dptr;
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
-
- *pcm1 = SHIFT(-MLZ(hi, lo));
- pcm1 += 8;
-
- phase = (phase + 1) % 16;
- }
+ unsigned int phase, ch, s, sb, pe, po;
+ mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
+ mad_fixed_t const (*sbsample)[36][32];
+ register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
+ register mad_fixed_t const (*Dptr)[32], *ptr;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ for (ch = 0; ch < nch; ++ch) {
+ sbsample = &frame->sbsample[ch];
+ filter = &synth->filter[ch];
+ phase = synth->phase;
+ pcm1 = synth->pcm.samples[ch];
+
+ for (s = 0; s < ns; ++s) {
+ dct32((*sbsample)[s], phase >> 1,
+ (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
+
+ pe = phase & ~1;
+ po = ((phase - 1) & 0xf) | 1;
+
+ /* calculate 16 samples */
+
+ fe = &(*filter)[0][ phase & 1][0];
+ fx = &(*filter)[0][~phase & 1][0];
+ fo = &(*filter)[1][~phase & 1][0];
+
+ Dptr = &D[0];
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ pcm2 = pcm1 + 14;
+
+ for (sb = 1; sb < 16; ++sb) {
+ ++fe;
+ ++Dptr;
+
+ /* D[32 - sb][i] == -D[sb][31 - i] */
+
+ if (!(sb & 1)) {
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ ptr = *Dptr - po;
+ ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
+ ptr = *Dptr - pe;
+ MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
+ MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
+
+ *pcm2-- = SHIFT(MLZ(hi, lo));
+ }
+
+ ++fo;
+ }
+
+ ++Dptr;
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+
+ *pcm1 = SHIFT(-MLZ(hi, lo));
+ pcm1 += 8;
+
+ phase = (phase + 1) % 16;
}
+ }
}
/*
@@ -905,28 +830,27 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
*/
void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame)
{
- unsigned int nch, ns;
- void (*synth_frame)(struct mad_synth *, struct mad_frame const *,
- unsigned int, unsigned int);
+ unsigned int nch, ns;
+ void (*synth_frame)(struct mad_synth *, struct mad_frame const *,
+ unsigned int, unsigned int);
- nch = MAD_NCHANNELS(&frame->header);
- ns = MAD_NSBSAMPLES(&frame->header);
+ nch = MAD_NCHANNELS(&frame->header);
+ ns = MAD_NSBSAMPLES(&frame->header);
- synth->pcm.samplerate = frame->header.samplerate;
- synth->pcm.channels = nch;
- synth->pcm.length = 32 * ns;
+ synth->pcm.samplerate = frame->header.samplerate;
+ synth->pcm.channels = nch;
+ synth->pcm.length = 32 * ns;
- synth_frame = synth_full;
+ synth_frame = synth_full;
- if(frame->options & MAD_OPTION_HALFSAMPLERATE)
- {
- synth->pcm.samplerate /= 2;
- synth->pcm.length /= 2;
+ if (frame->options & MAD_OPTION_HALFSAMPLERATE) {
+ synth->pcm.samplerate /= 2;
+ synth->pcm.length /= 2;
- synth_frame = synth_half;
- }
+ synth_frame = synth_half;
+ }
- synth_frame(synth, frame, nch, ns);
+ synth_frame(synth, frame, nch, ns);
- synth->phase = (synth->phase + ns) % 16;
+ synth->phase = (synth->phase + ns) % 16;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/synth.h b/src/filters/transform/MpaDecFilter/libmad/synth.h
index 375faa406..50532638c 100644
--- a/src/filters/transform/MpaDecFilter/libmad/synth.h
+++ b/src/filters/transform/MpaDecFilter/libmad/synth.h
@@ -24,42 +24,37 @@
# include "fixed.h"
# include "frame.h"
-struct mad_pcm
-{
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
};
-struct mad_synth
-{
- mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
- /* [ch][eo][peo][s][v] */
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
- unsigned int phase; /* current processing phase */
+ unsigned int phase; /* current processing phase */
- struct mad_pcm pcm; /* PCM output */
+ struct mad_pcm pcm; /* PCM output */
};
/* single channel PCM selector */
-enum
-{
- MAD_PCM_CHANNEL_SINGLE = 0
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
};
/* dual channel PCM selector */
-enum
-{
- MAD_PCM_CHANNEL_DUAL_1 = 0,
- MAD_PCM_CHANNEL_DUAL_2 = 1
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
};
/* stereo PCM selector */
-enum
-{
- MAD_PCM_CHANNEL_STEREO_LEFT = 0,
- MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
};
void mad_synth_init(struct mad_synth *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/timer.c b/src/filters/transform/MpaDecFilter/libmad/timer.c
index a5f5d8c95..7ce9f7998 100644
--- a/src/filters/transform/MpaDecFilter/libmad/timer.c
+++ b/src/filters/transform/MpaDecFilter/libmad/timer.c
@@ -40,21 +40,21 @@ mad_timer_t const mad_timer_zero = { 0, 0 };
*/
int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2)
{
- signed long diff;
+ signed long diff;
- diff = timer1.seconds - timer2.seconds;
- if(diff < 0)
- return -1;
- else if(diff > 0)
- return +1;
+ diff = timer1.seconds - timer2.seconds;
+ if (diff < 0)
+ return -1;
+ else if (diff > 0)
+ return +1;
- diff = timer1.fraction - timer2.fraction;
- if(diff < 0)
- return -1;
- else if(diff > 0)
- return +1;
+ diff = timer1.fraction - timer2.fraction;
+ if (diff < 0)
+ return -1;
+ else if (diff > 0)
+ return +1;
- return 0;
+ return 0;
}
/*
@@ -63,13 +63,12 @@ int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2)
*/
void mad_timer_negate(mad_timer_t *timer)
{
- timer->seconds = -timer->seconds;
+ timer->seconds = -timer->seconds;
- if(timer->fraction)
- {
- timer->seconds -= 1;
- timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction;
- }
+ if (timer->fraction) {
+ timer->seconds -= 1;
+ timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction;
+ }
}
/*
@@ -78,10 +77,10 @@ void mad_timer_negate(mad_timer_t *timer)
*/
mad_timer_t mad_timer_abs(mad_timer_t timer)
{
- if(timer.seconds < 0)
- mad_timer_negate(&timer);
+ if (timer.seconds < 0)
+ mad_timer_negate(&timer);
- return timer;
+ return timer;
}
/*
@@ -91,8 +90,8 @@ mad_timer_t mad_timer_abs(mad_timer_t timer)
static
void reduce_timer(mad_timer_t *timer)
{
- timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION;
- timer->fraction %= MAD_TIMER_RESOLUTION;
+ timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION;
+ timer->fraction %= MAD_TIMER_RESOLUTION;
}
/*
@@ -102,16 +101,15 @@ void reduce_timer(mad_timer_t *timer)
static
unsigned long gcd(unsigned long num1, unsigned long num2)
{
- unsigned long tmp;
+ unsigned long tmp;
- while(num2)
- {
- tmp = num2;
- num2 = num1 % num2;
- num1 = tmp;
- }
+ while (num2) {
+ tmp = num2;
+ num2 = num1 % num2;
+ num1 = tmp;
+ }
- return num1;
+ return num1;
}
/*
@@ -121,14 +119,14 @@ unsigned long gcd(unsigned long num1, unsigned long num2)
static
void reduce_rational(unsigned long *numer, unsigned long *denom)
{
- unsigned long factor;
+ unsigned long factor;
- factor = gcd(*numer, *denom);
+ factor = gcd(*numer, *denom);
- assert(factor != 0);
+ assert(factor != 0);
- *numer /= factor;
- *denom /= factor;
+ *numer /= factor;
+ *denom /= factor;
}
/*
@@ -137,19 +135,19 @@ void reduce_rational(unsigned long *numer, unsigned long *denom)
*/
static
unsigned long scale_rational(unsigned long numer, unsigned long denom,
- unsigned long scale)
+ unsigned long scale)
{
- reduce_rational(&numer, &denom);
- reduce_rational(&scale, &denom);
+ reduce_rational(&numer, &denom);
+ reduce_rational(&scale, &denom);
- assert(denom != 0);
+ assert(denom != 0);
- if(denom < scale)
- return numer * (scale / denom) + numer * (scale % denom) / denom;
- if(denom < numer)
- return scale * (numer / denom) + scale * (numer % denom) / denom;
+ if (denom < scale)
+ return numer * (scale / denom) + numer * (scale % denom) / denom;
+ if (denom < numer)
+ return scale * (numer / denom) + scale * (numer % denom) / denom;
- return numer * scale / denom;
+ return numer * scale / denom;
}
/*
@@ -157,73 +155,71 @@ unsigned long scale_rational(unsigned long numer, unsigned long denom,
* DESCRIPTION: set timer to specific (positive) value
*/
void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
- unsigned long numer, unsigned long denom)
+ unsigned long numer, unsigned long denom)
{
- timer->seconds = seconds;
- if(numer >= denom && denom > 0)
- {
- timer->seconds += numer / denom;
- numer %= denom;
- }
+ timer->seconds = seconds;
+ if (numer >= denom && denom > 0) {
+ timer->seconds += numer / denom;
+ numer %= denom;
+ }
+
+ switch (denom) {
+ case 0:
+ case 1:
+ timer->fraction = 0;
+ break;
- switch(denom)
- {
- case 0:
- case 1:
- timer->fraction = 0;
- break;
-
- case MAD_TIMER_RESOLUTION:
- timer->fraction = numer;
- break;
-
- case 1000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000);
- break;
-
- case 8000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000);
- break;
-
- case 11025:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025);
- break;
-
- case 12000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000);
- break;
-
- case 16000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000);
- break;
-
- case 22050:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050);
- break;
-
- case 24000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000);
- break;
-
- case 32000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000);
- break;
-
- case 44100:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100);
- break;
-
- case 48000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000);
- break;
-
- default:
- timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION);
- break;
- }
+ case MAD_TIMER_RESOLUTION:
+ timer->fraction = numer;
+ break;
+
+ case 1000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000);
+ break;
+
+ case 8000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000);
+ break;
+
+ case 11025:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025);
+ break;
+
+ case 12000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000);
+ break;
+
+ case 16000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000);
+ break;
+
+ case 22050:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050);
+ break;
+
+ case 24000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000);
+ break;
+
+ case 32000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000);
+ break;
+
+ case 44100:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100);
+ break;
+
+ case 48000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000);
+ break;
- if(timer->fraction >= MAD_TIMER_RESOLUTION)
- reduce_timer(timer);
+ default:
+ timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION);
+ break;
+ }
+
+ if (timer->fraction >= MAD_TIMER_RESOLUTION)
+ reduce_timer(timer);
}
/*
@@ -232,11 +228,11 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
*/
void mad_timer_add(mad_timer_t *timer, mad_timer_t incr)
{
- timer->seconds += incr.seconds;
- timer->fraction += incr.fraction;
+ timer->seconds += incr.seconds;
+ timer->fraction += incr.fraction;
- if(timer->fraction >= MAD_TIMER_RESOLUTION)
- reduce_timer(timer);
+ if (timer->fraction >= MAD_TIMER_RESOLUTION)
+ reduce_timer(timer);
}
/*
@@ -245,27 +241,25 @@ void mad_timer_add(mad_timer_t *timer, mad_timer_t incr)
*/
void mad_timer_multiply(mad_timer_t *timer, signed long scalar)
{
- mad_timer_t addend;
- unsigned long factor;
+ mad_timer_t addend;
+ unsigned long factor;
- factor = scalar;
- if(scalar < 0)
- {
- factor = -scalar;
- mad_timer_negate(timer);
- }
+ factor = scalar;
+ if (scalar < 0) {
+ factor = -scalar;
+ mad_timer_negate(timer);
+ }
- addend = *timer;
- *timer = mad_timer_zero;
+ addend = *timer;
+ *timer = mad_timer_zero;
- while(factor)
- {
- if(factor & 1)
- mad_timer_add(timer, addend);
+ while (factor) {
+ if (factor & 1)
+ mad_timer_add(timer, addend);
- mad_timer_add(&addend, addend);
- factor >>= 1;
- }
+ mad_timer_add(&addend, addend);
+ factor >>= 1;
+ }
}
/*
@@ -274,53 +268,52 @@ void mad_timer_multiply(mad_timer_t *timer, signed long scalar)
*/
signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
{
- switch(units)
- {
- case MAD_UNITS_HOURS:
- return timer.seconds / 60 / 60;
-
- case MAD_UNITS_MINUTES:
- return timer.seconds / 60;
-
- case MAD_UNITS_SECONDS:
- return timer.seconds;
-
- case MAD_UNITS_DECISECONDS:
- case MAD_UNITS_CENTISECONDS:
- case MAD_UNITS_MILLISECONDS:
-
- case MAD_UNITS_8000_HZ:
- case MAD_UNITS_11025_HZ:
- case MAD_UNITS_12000_HZ:
- case MAD_UNITS_16000_HZ:
- case MAD_UNITS_22050_HZ:
- case MAD_UNITS_24000_HZ:
- case MAD_UNITS_32000_HZ:
- case MAD_UNITS_44100_HZ:
- case MAD_UNITS_48000_HZ:
-
- case MAD_UNITS_24_FPS:
- case MAD_UNITS_25_FPS:
- case MAD_UNITS_30_FPS:
- case MAD_UNITS_48_FPS:
- case MAD_UNITS_50_FPS:
- case MAD_UNITS_60_FPS:
- case MAD_UNITS_75_FPS:
- return timer.seconds * (signed long) units +
- (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION,
- units);
-
- case MAD_UNITS_23_976_FPS:
- case MAD_UNITS_24_975_FPS:
- case MAD_UNITS_29_97_FPS:
- case MAD_UNITS_47_952_FPS:
- case MAD_UNITS_49_95_FPS:
- case MAD_UNITS_59_94_FPS:
- return (mad_timer_count(timer, -units) + 1) * 1000 / 1001;
- }
-
- /* unsupported units */
- return 0;
+ switch (units) {
+ case MAD_UNITS_HOURS:
+ return timer.seconds / 60 / 60;
+
+ case MAD_UNITS_MINUTES:
+ return timer.seconds / 60;
+
+ case MAD_UNITS_SECONDS:
+ return timer.seconds;
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ return timer.seconds * (signed long) units +
+ (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION,
+ units);
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ return (mad_timer_count(timer, -units) + 1) * 1000 / 1001;
+ }
+
+ /* unsupported units */
+ return 0;
}
/*
@@ -329,20 +322,19 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
*/
unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
{
- timer = mad_timer_abs(timer);
+ timer = mad_timer_abs(timer);
- switch(denom)
- {
- case 0:
- return timer.fraction ?
- MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1;
+ switch (denom) {
+ case 0:
+ return timer.fraction ?
+ MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1;
- case MAD_TIMER_RESOLUTION:
- return timer.fraction;
+ case MAD_TIMER_RESOLUTION:
+ return timer.fraction;
- default:
- return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
- }
+ default:
+ return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
+ }
}
/*
@@ -350,146 +342,143 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
* DESCRIPTION: write a string representation of a timer using a template
*/
void mad_timer_string(mad_timer_t timer,
- char *dest, char const *format, enum mad_units units,
- enum mad_units fracunits, unsigned long subparts)
+ char *dest, char const *format, enum mad_units units,
+ enum mad_units fracunits, unsigned long subparts)
{
- unsigned long hours, minutes, seconds, sub;
- unsigned int frac;
+ unsigned long hours, minutes, seconds, sub;
+ unsigned int frac;
- timer = mad_timer_abs(timer);
+ timer = mad_timer_abs(timer);
- seconds = timer.seconds;
- frac = sub = 0;
+ seconds = timer.seconds;
+ frac = sub = 0;
- switch(fracunits)
- {
- case MAD_UNITS_HOURS:
- case MAD_UNITS_MINUTES:
- case MAD_UNITS_SECONDS:
- break;
-
- case MAD_UNITS_DECISECONDS:
- case MAD_UNITS_CENTISECONDS:
- case MAD_UNITS_MILLISECONDS:
-
- case MAD_UNITS_8000_HZ:
- case MAD_UNITS_11025_HZ:
- case MAD_UNITS_12000_HZ:
- case MAD_UNITS_16000_HZ:
- case MAD_UNITS_22050_HZ:
- case MAD_UNITS_24000_HZ:
- case MAD_UNITS_32000_HZ:
- case MAD_UNITS_44100_HZ:
- case MAD_UNITS_48000_HZ:
-
- case MAD_UNITS_24_FPS:
- case MAD_UNITS_25_FPS:
- case MAD_UNITS_30_FPS:
- case MAD_UNITS_48_FPS:
- case MAD_UNITS_50_FPS:
- case MAD_UNITS_60_FPS:
- case MAD_UNITS_75_FPS:
+ switch (fracunits) {
+ case MAD_UNITS_HOURS:
+ case MAD_UNITS_MINUTES:
+ case MAD_UNITS_SECONDS:
+ break;
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
{
- unsigned long denom;
+ unsigned long denom;
- denom = MAD_TIMER_RESOLUTION / fracunits;
+ denom = MAD_TIMER_RESOLUTION / fracunits;
- frac = timer.fraction / denom;
- sub = scale_rational(timer.fraction % denom, denom, subparts);
+ frac = timer.fraction / denom;
+ sub = scale_rational(timer.fraction % denom, denom, subparts);
}
break;
- case MAD_UNITS_23_976_FPS:
- case MAD_UNITS_24_975_FPS:
- case MAD_UNITS_29_97_FPS:
- case MAD_UNITS_47_952_FPS:
- case MAD_UNITS_49_95_FPS:
- case MAD_UNITS_59_94_FPS:
- /* drop-frame encoding */
- /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ /* drop-frame encoding */
+ /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */
{
- unsigned long frame, cycle, d, m;
+ unsigned long frame, cycle, d, m;
- frame = mad_timer_count(timer, fracunits);
+ frame = mad_timer_count(timer, fracunits);
- cycle = -fracunits * 60 * 10 - (10 - 1) * 2;
+ cycle = -fracunits * 60 * 10 - (10 - 1) * 2;
- d = frame / cycle;
- m = frame % cycle;
- frame += (10 - 1) * 2 * d;
- if(m > 2)
- frame += 2 * ((m - 2) / (cycle / 10));
+ d = frame / cycle;
+ m = frame % cycle;
+ frame += (10 - 1) * 2 * d;
+ if (m > 2)
+ frame += 2 * ((m - 2) / (cycle / 10));
- frac = frame % -fracunits;
- seconds = frame / -fracunits;
+ frac = frame % -fracunits;
+ seconds = frame / -fracunits;
}
break;
- }
+ }
+
+ switch (units) {
+ case MAD_UNITS_HOURS:
+ minutes = seconds / 60;
+ hours = minutes / 60;
+
+ sprintf(dest, format,
+ hours,
+ (unsigned int) (minutes % 60),
+ (unsigned int) (seconds % 60),
+ frac, sub);
+ break;
- switch(units)
- {
- case MAD_UNITS_HOURS:
- minutes = seconds / 60;
- hours = minutes / 60;
-
- sprintf(dest, format,
- hours,
- (unsigned int)(minutes % 60),
- (unsigned int)(seconds % 60),
- frac, sub);
- break;
-
- case MAD_UNITS_MINUTES:
- minutes = seconds / 60;
-
- sprintf(dest, format,
- minutes,
- (unsigned int)(seconds % 60),
- frac, sub);
- break;
-
- case MAD_UNITS_SECONDS:
- sprintf(dest, format,
- seconds,
- frac, sub);
- break;
-
- case MAD_UNITS_23_976_FPS:
- case MAD_UNITS_24_975_FPS:
- case MAD_UNITS_29_97_FPS:
- case MAD_UNITS_47_952_FPS:
- case MAD_UNITS_49_95_FPS:
- case MAD_UNITS_59_94_FPS:
- if(fracunits < 0)
- {
- /* not yet implemented */
- sub = 0;
- }
-
- /* fall through */
-
- case MAD_UNITS_DECISECONDS:
- case MAD_UNITS_CENTISECONDS:
- case MAD_UNITS_MILLISECONDS:
-
- case MAD_UNITS_8000_HZ:
- case MAD_UNITS_11025_HZ:
- case MAD_UNITS_12000_HZ:
- case MAD_UNITS_16000_HZ:
- case MAD_UNITS_22050_HZ:
- case MAD_UNITS_24000_HZ:
- case MAD_UNITS_32000_HZ:
- case MAD_UNITS_44100_HZ:
- case MAD_UNITS_48000_HZ:
-
- case MAD_UNITS_24_FPS:
- case MAD_UNITS_25_FPS:
- case MAD_UNITS_30_FPS:
- case MAD_UNITS_48_FPS:
- case MAD_UNITS_50_FPS:
- case MAD_UNITS_60_FPS:
- case MAD_UNITS_75_FPS:
- sprintf(dest, format, mad_timer_count(timer, units), sub);
- break;
+ case MAD_UNITS_MINUTES:
+ minutes = seconds / 60;
+
+ sprintf(dest, format,
+ minutes,
+ (unsigned int) (seconds % 60),
+ frac, sub);
+ break;
+
+ case MAD_UNITS_SECONDS:
+ sprintf(dest, format,
+ seconds,
+ frac, sub);
+ break;
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ if (fracunits < 0) {
+ /* not yet implemented */
+ sub = 0;
}
+
+ /* fall through */
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ sprintf(dest, format, mad_timer_count(timer, units), sub);
+ break;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/timer.h b/src/filters/transform/MpaDecFilter/libmad/timer.h
index b07ea8a90..9b0cdd19c 100644
--- a/src/filters/transform/MpaDecFilter/libmad/timer.h
+++ b/src/filters/transform/MpaDecFilter/libmad/timer.h
@@ -21,63 +21,61 @@
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
-typedef struct
-{
- signed long seconds; /* whole seconds */
- unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
} mad_timer_t;
extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
-enum mad_units
-{
- MAD_UNITS_HOURS = -2,
- MAD_UNITS_MINUTES = -1,
- MAD_UNITS_SECONDS = 0,
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
- /* metric units */
+ /* metric units */
- MAD_UNITS_DECISECONDS = 10,
- MAD_UNITS_CENTISECONDS = 100,
- MAD_UNITS_MILLISECONDS = 1000,
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
- /* audio sample units */
+ /* audio sample units */
- MAD_UNITS_8000_HZ = 8000,
- MAD_UNITS_11025_HZ = 11025,
- MAD_UNITS_12000_HZ = 12000,
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
- MAD_UNITS_16000_HZ = 16000,
- MAD_UNITS_22050_HZ = 22050,
- MAD_UNITS_24000_HZ = 24000,
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
- MAD_UNITS_32000_HZ = 32000,
- MAD_UNITS_44100_HZ = 44100,
- MAD_UNITS_48000_HZ = 48000,
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
- /* video frame/field units */
+ /* video frame/field units */
- MAD_UNITS_24_FPS = 24,
- MAD_UNITS_25_FPS = 25,
- MAD_UNITS_30_FPS = 30,
- MAD_UNITS_48_FPS = 48,
- MAD_UNITS_50_FPS = 50,
- MAD_UNITS_60_FPS = 60,
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
- /* CD audio frames */
+ /* CD audio frames */
- MAD_UNITS_75_FPS = 75,
+ MAD_UNITS_75_FPS = 75,
- /* video drop-frame units */
+ /* video drop-frame units */
- MAD_UNITS_23_976_FPS = -24,
- MAD_UNITS_24_975_FPS = -25,
- MAD_UNITS_29_97_FPS = -30,
- MAD_UNITS_47_952_FPS = -48,
- MAD_UNITS_49_95_FPS = -50,
- MAD_UNITS_59_94_FPS = -60
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
@@ -96,6 +94,6 @@ void mad_timer_multiply(mad_timer_t *, signed long);
signed long mad_timer_count(mad_timer_t, enum mad_units);
unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
void mad_timer_string(mad_timer_t, char *, char const *,
- enum mad_units, enum mad_units, unsigned long);
+ enum mad_units, enum mad_units, unsigned long);
# endif
diff --git a/src/filters/transform/MpaDecFilter/libmad/version.c b/src/filters/transform/MpaDecFilter/libmad/version.c
index eb44c4e62..b421d8753 100644
--- a/src/filters/transform/MpaDecFilter/libmad/version.c
+++ b/src/filters/transform/MpaDecFilter/libmad/version.c
@@ -31,60 +31,60 @@ char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">";
char const mad_build[] = ""
# if defined(DEBUG)
- "DEBUG "
+ "DEBUG "
# elif defined(NDEBUG)
- "NDEBUG "
+ "NDEBUG "
# endif
# if defined(EXPERIMENTAL)
- "EXPERIMENTAL "
+ "EXPERIMENTAL "
# endif
# if defined(FPM_64BIT)
- "FPM_64BIT "
+ "FPM_64BIT "
# elif defined(FPM_INTEL)
- "FPM_INTEL "
+ "FPM_INTEL "
# elif defined(FPM_ARM)
- "FPM_ARM "
+ "FPM_ARM "
# elif defined(FPM_MIPS)
- "FPM_MIPS "
+ "FPM_MIPS "
# elif defined(FPM_SPARC)
- "FPM_SPARC "
+ "FPM_SPARC "
# elif defined(FPM_PPC)
- "FPM_PPC "
+ "FPM_PPC "
# elif defined(FPM_DEFAULT)
- "FPM_DEFAULT "
+ "FPM_DEFAULT "
# endif
# if defined(ASO_IMDCT)
- "ASO_IMDCT "
+ "ASO_IMDCT "
# endif
# if defined(ASO_INTERLEAVE1)
- "ASO_INTERLEAVE1 "
+ "ASO_INTERLEAVE1 "
# endif
# if defined(ASO_INTERLEAVE2)
- "ASO_INTERLEAVE2 "
+ "ASO_INTERLEAVE2 "
# endif
# if defined(ASO_ZEROCHECK)
- "ASO_ZEROCHECK "
+ "ASO_ZEROCHECK "
# endif
# if defined(OPT_SPEED)
- "OPT_SPEED "
+ "OPT_SPEED "
# elif defined(OPT_ACCURACY)
- "OPT_ACCURACY "
+ "OPT_ACCURACY "
# endif
# if defined(OPT_SSO)
- "OPT_SSO "
+ "OPT_SSO "
# endif
# if defined(OPT_DCTO) /* never defined here */
- "OPT_DCTO "
+ "OPT_DCTO "
# endif
# if defined(OPT_STRICT)
- "OPT_STRICT "
+ "OPT_STRICT "
# endif
- ;
+;
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/backends.h b/src/filters/transform/MpaDecFilter/libvorbisidec/backends.h
index aa94712dd..2437d6c76 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/backends.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/backends.h
@@ -27,32 +27,30 @@
/* this would all be simpler/shorter with templates, but.... */
/* Floor backend generic *****************************************/
-typedef struct
-{
- void (*pack)(vorbis_info_floor *, oggpack_buffer *);
- vorbis_info_floor *(*unpack)(vorbis_info *, oggpack_buffer *);
- vorbis_look_floor *(*look)(vorbis_dsp_state *, vorbis_info_floor *);
- void (*free_info)(vorbis_info_floor *);
- void (*free_look)(vorbis_look_floor *);
- void *(*inverse1)(struct vorbis_block *, vorbis_look_floor *);
- int (*inverse2)(struct vorbis_block *, vorbis_look_floor *,
- void *buffer, float *);
+typedef struct{
+ void (*pack) (vorbis_info_floor *,oggpack_buffer *);
+ vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
+ vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_floor *);
+ void (*free_info) (vorbis_info_floor *);
+ void (*free_look) (vorbis_look_floor *);
+ void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
+ int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
+ void *buffer,float *);
} vorbis_func_floor;
-typedef struct
-{
- int order;
- long rate;
- long barkmap;
+typedef struct{
+ int order;
+ long rate;
+ long barkmap;
- int ampbits;
- int ampdB;
+ int ampbits;
+ int ampdB;
- int numbooks; /* <= 16 */
- int books[16];
+ int numbooks; /* <= 16 */
+ int books[16];
- float lessthan; /* encode-only config setting hacks for libvorbis */
- float greaterthan; /* encode-only config setting hacks for libvorbis */
+ float lessthan; /* encode-only config setting hacks for libvorbis */
+ float greaterthan; /* encode-only config setting hacks for libvorbis */
} vorbis_info_floor0;
@@ -60,91 +58,86 @@ typedef struct
#define VIF_POSIT 63
#define VIF_CLASS 16
#define VIF_PARTS 31
-typedef struct
-{
- int partitions; /* 0 to 31 */
- int partitionclass[VIF_PARTS]; /* 0 to 15 */
+typedef struct{
+ int partitions; /* 0 to 31 */
+ int partitionclass[VIF_PARTS]; /* 0 to 15 */
- int class_dim[VIF_CLASS]; /* 1 to 8 */
- int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
- int class_book[VIF_CLASS]; /* subs ^ dim entries */
- int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
+ int class_dim[VIF_CLASS]; /* 1 to 8 */
+ int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
+ int class_book[VIF_CLASS]; /* subs ^ dim entries */
+ int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
- int mult; /* 1 2 3 or 4 */
- int postlist[VIF_POSIT+2]; /* first two implicit */
+ int mult; /* 1 2 3 or 4 */
+ int postlist[VIF_POSIT+2]; /* first two implicit */
- /* encode side analysis parameters */
- float maxover;
- float maxunder;
- float maxerr;
+ /* encode side analysis parameters */
+ float maxover;
+ float maxunder;
+ float maxerr;
- float twofitweight;
- float twofitatten;
+ float twofitweight;
+ float twofitatten;
- int n;
+ int n;
} vorbis_info_floor1;
/* Residue backend generic *****************************************/
-typedef struct
-{
- void (*pack)(vorbis_info_residue *, oggpack_buffer *);
- vorbis_info_residue *(*unpack)(vorbis_info *, oggpack_buffer *);
- vorbis_look_residue *(*look)(vorbis_dsp_state *,
+typedef struct{
+ void (*pack) (vorbis_info_residue *,oggpack_buffer *);
+ vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
+ vorbis_look_residue *(*look) (vorbis_dsp_state *,
vorbis_info_residue *);
- void (*free_info)(vorbis_info_residue *);
- void (*free_look)(vorbis_look_residue *);
- long **(*class)(struct vorbis_block *, vorbis_look_residue *,
- float **, int *, int);
- int (*forward)(oggpack_buffer *, struct vorbis_block *,
- vorbis_look_residue *,
- float **, float **, int *, int, long **);
- int (*inverse)(struct vorbis_block *, vorbis_look_residue *,
- float **, int *, int);
+ void (*free_info) (vorbis_info_residue *);
+ void (*free_look) (vorbis_look_residue *);
+ long **(*class) (struct vorbis_block *,vorbis_look_residue *,
+ float **,int *,int);
+ int (*forward) (oggpack_buffer *,struct vorbis_block *,
+ vorbis_look_residue *,
+ float **,float **,int *,int,long **);
+ int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
+ float **,int *,int);
} vorbis_func_residue;
-typedef struct vorbis_info_residue0
-{
- /* block-partitioned VQ coded straight residue */
- long begin;
- long end;
-
- /* first stage (lossless partitioning) */
- int grouping; /* group n vectors per partition */
- int partitions; /* possible codebooks for a partition */
- int partvals; /* partitions ^ groupbook dim */
- int groupbook; /* huffbook for partitioning */
- int secondstages[64]; /* expanded out to pointers in lookup */
- int booklist[512]; /* list of second stage books */
-
- const float classmetric1[64];
- const float classmetric2[64];
+typedef struct vorbis_info_residue0{
+/* block-partitioned VQ coded straight residue */
+ long begin;
+ long end;
+
+ /* first stage (lossless partitioning) */
+ int grouping; /* group n vectors per partition */
+ int partitions; /* possible codebooks for a partition */
+ int partvals; /* partitions ^ groupbook dim */
+ int groupbook; /* huffbook for partitioning */
+ int secondstages[64]; /* expanded out to pointers in lookup */
+ int booklist[512]; /* list of second stage books */
+
+ const float classmetric1[64];
+ const float classmetric2[64];
} vorbis_info_residue0;
/* Mapping backend generic *****************************************/
-typedef struct
-{
- void (*pack)(vorbis_info *, vorbis_info_mapping *,
- oggpack_buffer *);
- vorbis_info_mapping *(*unpack)(vorbis_info *, oggpack_buffer *);
- void (*free_info)(vorbis_info_mapping *);
- int (*forward)(struct vorbis_block *vb);
- int (*inverse)(struct vorbis_block *vb, vorbis_info_mapping *);
+typedef struct{
+ void (*pack) (vorbis_info *,vorbis_info_mapping *,
+ oggpack_buffer *);
+ vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
+ void (*free_info) (vorbis_info_mapping *);
+ int (*forward) (struct vorbis_block *vb);
+ int (*inverse) (struct vorbis_block *vb,vorbis_info_mapping *);
} vorbis_func_mapping;
-typedef struct vorbis_info_mapping0
-{
- int submaps; /* <= 16 */
- int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
+typedef struct vorbis_info_mapping0{
+ int submaps; /* <= 16 */
+ int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
- int floorsubmap[16]; /* [mux] submap to floors */
- int residuesubmap[16]; /* [mux] submap to residue */
+ int floorsubmap[16]; /* [mux] submap to floors */
+ int residuesubmap[16]; /* [mux] submap to residue */
- int coupling_steps;
- int coupling_mag[256];
- int coupling_ang[256];
+ int coupling_steps;
+ int coupling_mag[256];
+ int coupling_ang[256];
} vorbis_info_mapping0;
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.c b/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.c
index 281d189d7..3a71b1dc2 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.c
@@ -26,268 +26,228 @@
#include "bitrate.h"
/* compute bitrate tracking setup */
-void vorbis_bitrate_init(vorbis_info *vi, bitrate_manager_state *bm)
-{
- codec_setup_info *ci = vi->codec_setup;
- bitrate_manager_info *bi = &ci->bi;
+void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
+ codec_setup_info *ci=vi->codec_setup;
+ bitrate_manager_info *bi=&ci->bi;
- memset(bm, 0, sizeof(*bm));
+ memset(bm,0,sizeof(*bm));
- if(bi && (bi->reservoir_bits > 0))
- {
- long ratesamples = vi->rate;
- int halfsamples = ci->blocksizes[0] >> 1;
-
- bm->short_per_long = ci->blocksizes[1] / ci->blocksizes[0];
- bm->managed = 1;
+ if(bi && (bi->reservoir_bits>0)){
+ long ratesamples=vi->rate;
+ int halfsamples=ci->blocksizes[0]>>1;
- bm->avg_bitsper = rint(1.*bi->avg_rate * halfsamples / ratesamples);
- bm->min_bitsper = rint(1.*bi->min_rate * halfsamples / ratesamples);
- bm->max_bitsper = rint(1.*bi->max_rate * halfsamples / ratesamples);
+ bm->short_per_long=ci->blocksizes[1]/ci->blocksizes[0];
+ bm->managed=1;
- bm->avgfloat = PACKETBLOBS / 2;
+ bm->avg_bitsper= rint(1.*bi->avg_rate*halfsamples/ratesamples);
+ bm->min_bitsper= rint(1.*bi->min_rate*halfsamples/ratesamples);
+ bm->max_bitsper= rint(1.*bi->max_rate*halfsamples/ratesamples);
- /* not a necessary fix, but one that leads to a more balanced
- typical initialization */
- {
- long desired_fill = bi->reservoir_bits * bi->reservoir_bias;
- bm->minmax_reservoir = desired_fill;
- bm->avg_reservoir = desired_fill;
- }
+ bm->avgfloat=PACKETBLOBS/2;
+ /* not a necessary fix, but one that leads to a more balanced
+ typical initialization */
+ {
+ long desired_fill=bi->reservoir_bits*bi->reservoir_bias;
+ bm->minmax_reservoir=desired_fill;
+ bm->avg_reservoir=desired_fill;
}
+
+ }
}
-void vorbis_bitrate_clear(bitrate_manager_state *bm)
-{
- memset(bm, 0, sizeof(*bm));
- return;
+void vorbis_bitrate_clear(bitrate_manager_state *bm){
+ memset(bm,0,sizeof(*bm));
+ return;
}
-int vorbis_bitrate_managed(vorbis_block *vb)
-{
- vorbis_dsp_state *vd = vb->vd;
- private_state *b = vd->backend_state;
- bitrate_manager_state *bm = &b->bms;
+int vorbis_bitrate_managed(vorbis_block *vb){
+ vorbis_dsp_state *vd=vb->vd;
+ private_state *b=vd->backend_state;
+ bitrate_manager_state *bm=&b->bms;
- if(bm && bm->managed)return(1);
- return(0);
+ if(bm && bm->managed)return(1);
+ return(0);
}
/* finish taking in the block we just processed */
-int vorbis_bitrate_addblock(vorbis_block *vb)
-{
- vorbis_block_internal *vbi = vb->internal;
- vorbis_dsp_state *vd = vb->vd;
- private_state *b = vd->backend_state;
- bitrate_manager_state *bm = &b->bms;
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- bitrate_manager_info *bi = &ci->bi;
-
- int choice = rint(bm->avgfloat);
- long this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- long min_target_bits = (vb->W ? bm->min_bitsper * bm->short_per_long : bm->min_bitsper);
- long max_target_bits = (vb->W ? bm->max_bitsper * bm->short_per_long : bm->max_bitsper);
- int samples = ci->blocksizes[vb->W] >> 1;
- long desired_fill = bi->reservoir_bits * bi->reservoir_bias;
- if(!bm->managed)
- {
- /* not a bitrate managed stream, but for API simplicity, we'll
- buffer the packet to keep the code path clean */
-
- if(bm->vb)return(-1); /* one has been submitted without
+int vorbis_bitrate_addblock(vorbis_block *vb){
+ vorbis_block_internal *vbi=vb->internal;
+ vorbis_dsp_state *vd=vb->vd;
+ private_state *b=vd->backend_state;
+ bitrate_manager_state *bm=&b->bms;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ bitrate_manager_info *bi=&ci->bi;
+
+ int choice=rint(bm->avgfloat);
+ long this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+ long min_target_bits=(vb->W?bm->min_bitsper*bm->short_per_long:bm->min_bitsper);
+ long max_target_bits=(vb->W?bm->max_bitsper*bm->short_per_long:bm->max_bitsper);
+ int samples=ci->blocksizes[vb->W]>>1;
+ long desired_fill=bi->reservoir_bits*bi->reservoir_bias;
+ if(!bm->managed){
+ /* not a bitrate managed stream, but for API simplicity, we'll
+ buffer the packet to keep the code path clean */
+
+ if(bm->vb)return(-1); /* one has been submitted without
being claimed */
- bm->vb = vb;
- return(0);
+ bm->vb=vb;
+ return(0);
+ }
+
+ bm->vb=vb;
+
+ /* look ahead for avg floater */
+ if(bm->avg_bitsper>0){
+ double slew=0.;
+ long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper);
+ double slewlimit= 15./bi->slew_damp;
+
+ /* choosing a new floater:
+ if we're over target, we slew down
+ if we're under target, we slew up
+
+ choose slew as follows: look through packetblobs of this frame
+ and set slew as the first in the appropriate direction that
+ gives us the slew we want. This may mean no slew if delta is
+ already favorable.
+
+ Then limit slew to slew max */
+
+ if(bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
+ while(choice>0 && this_bits>avg_target_bits &&
+ bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
+ choice--;
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+ }
+ }else if(bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
+ while(choice+1<PACKETBLOBS && this_bits<avg_target_bits &&
+ bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
+ choice++;
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+ }
}
- bm->vb = vb;
-
- /* look ahead for avg floater */
- if(bm->avg_bitsper > 0)
- {
- double slew = 0.;
- long avg_target_bits = (vb->W ? bm->avg_bitsper * bm->short_per_long : bm->avg_bitsper);
- double slewlimit = 15. / bi->slew_damp;
-
- /* choosing a new floater:
- if we're over target, we slew down
- if we're under target, we slew up
-
- choose slew as follows: look through packetblobs of this frame
- and set slew as the first in the appropriate direction that
- gives us the slew we want. This may mean no slew if delta is
- already favorable.
-
- Then limit slew to slew max */
-
- if(bm->avg_reservoir + (this_bits - avg_target_bits) > desired_fill)
- {
- while(choice > 0 && this_bits > avg_target_bits &&
- bm->avg_reservoir + (this_bits - avg_target_bits) > desired_fill)
- {
- choice--;
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- }
- }
- else if(bm->avg_reservoir + (this_bits - avg_target_bits) < desired_fill)
- {
- while(choice + 1 < PACKETBLOBS && this_bits < avg_target_bits &&
- bm->avg_reservoir + (this_bits - avg_target_bits) < desired_fill)
- {
- choice++;
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- }
- }
-
- slew = rint(choice - bm->avgfloat) / samples * vi->rate;
- if(slew < -slewlimit)slew = -slewlimit;
- if(slew > slewlimit)slew = slewlimit;
- choice = rint(bm->avgfloat += slew / vi->rate * samples);
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- }
+ slew=rint(choice-bm->avgfloat)/samples*vi->rate;
+ if(slew<-slewlimit)slew=-slewlimit;
+ if(slew>slewlimit)slew=slewlimit;
+ choice=rint(bm->avgfloat+= slew/vi->rate*samples);
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+ }
- /* enforce min(if used) on the current floater (if used) */
- if(bm->min_bitsper > 0)
- {
- /* do we need to force the bitrate up? */
- if(this_bits < min_target_bits)
- {
- while(bm->minmax_reservoir - (min_target_bits - this_bits) < 0)
- {
- choice++;
- if(choice >= PACKETBLOBS)break;
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- }
- }
+ /* enforce min(if used) on the current floater (if used) */
+ if(bm->min_bitsper>0){
+ /* do we need to force the bitrate up? */
+ if(this_bits<min_target_bits){
+ while(bm->minmax_reservoir-(min_target_bits-this_bits)<0){
+ choice++;
+ if(choice>=PACKETBLOBS)break;
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+ }
}
-
- /* enforce max (if used) on the current floater (if used) */
- if(bm->max_bitsper > 0)
- {
- /* do we need to force the bitrate down? */
- if(this_bits > max_target_bits)
- {
- while(bm->minmax_reservoir + (this_bits - max_target_bits) > bi->reservoir_bits)
- {
- choice--;
- if(choice < 0)break;
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- }
- }
+ }
+
+ /* enforce max (if used) on the current floater (if used) */
+ if(bm->max_bitsper>0){
+ /* do we need to force the bitrate down? */
+ if(this_bits>max_target_bits){
+ while(bm->minmax_reservoir+(this_bits-max_target_bits)>bi->reservoir_bits){
+ choice--;
+ if(choice<0)break;
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+ }
}
+ }
- /* Choice of packetblobs now made based on floater, and min/max
- requirements. Now boundary check extreme choices */
+ /* Choice of packetblobs now made based on floater, and min/max
+ requirements. Now boundary check extreme choices */
- if(choice < 0)
- {
- /* choosing a smaller packetblob is insufficient to trim bitrate.
- frame will need to be truncated */
- long maxsize = (max_target_bits + (bi->reservoir_bits - bm->minmax_reservoir)) / 8;
- bm->choice = choice = 0;
-
- if(oggpack_bytes(vbi->packetblob[choice]) > maxsize)
- {
-
- oggpack_writetrunc(vbi->packetblob[choice], maxsize * 8);
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
- }
- }
- else
- {
- long minsize = (min_target_bits - bm->minmax_reservoir + 7) / 8;
- if(choice >= PACKETBLOBS)
- choice = PACKETBLOBS - 1;
-
- bm->choice = choice;
+ if(choice<0){
+ /* choosing a smaller packetblob is insufficient to trim bitrate.
+ frame will need to be truncated */
+ long maxsize=(max_target_bits+(bi->reservoir_bits-bm->minmax_reservoir))/8;
+ bm->choice=choice=0;
- /* prop up bitrate according to demand. pad this frame out with zeroes */
- minsize -= oggpack_bytes(vbi->packetblob[choice]);
- while(minsize-- > 0)oggpack_write(vbi->packetblob[choice], 0, 8);
- this_bits = oggpack_bytes(vbi->packetblob[choice]) * 8;
+ if(oggpack_bytes(vbi->packetblob[choice])>maxsize){
+ oggpack_writetrunc(vbi->packetblob[choice],maxsize*8);
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
}
-
- /* now we have the final packet and the final packet size. Update statistics */
- /* min and max reservoir */
- if(bm->min_bitsper > 0 || bm->max_bitsper > 0)
- {
-
- if(max_target_bits > 0 && this_bits > max_target_bits)
- {
- bm->minmax_reservoir += (this_bits - max_target_bits);
+ }else{
+ long minsize=(min_target_bits-bm->minmax_reservoir+7)/8;
+ if(choice>=PACKETBLOBS)
+ choice=PACKETBLOBS-1;
+
+ bm->choice=choice;
+
+ /* prop up bitrate according to demand. pad this frame out with zeroes */
+ minsize-=oggpack_bytes(vbi->packetblob[choice]);
+ while(minsize-->0)oggpack_write(vbi->packetblob[choice],0,8);
+ this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+
+ }
+
+ /* now we have the final packet and the final packet size. Update statistics */
+ /* min and max reservoir */
+ if(bm->min_bitsper>0 || bm->max_bitsper>0){
+
+ if(max_target_bits>0 && this_bits>max_target_bits){
+ bm->minmax_reservoir+=(this_bits-max_target_bits);
+ }else if(min_target_bits>0 && this_bits<min_target_bits){
+ bm->minmax_reservoir+=(this_bits-min_target_bits);
+ }else{
+ /* inbetween; we want to take reservoir toward but not past desired_fill */
+ if(bm->minmax_reservoir>desired_fill){
+ if(max_target_bits>0){ /* logical bulletproofing against initialization state */
+ bm->minmax_reservoir+=(this_bits-max_target_bits);
+ if(bm->minmax_reservoir<desired_fill)bm->minmax_reservoir=desired_fill;
+ }else{
+ bm->minmax_reservoir=desired_fill;
}
- else if(min_target_bits > 0 && this_bits < min_target_bits)
- {
- bm->minmax_reservoir += (this_bits - min_target_bits);
- }
- else
- {
- /* inbetween; we want to take reservoir toward but not past desired_fill */
- if(bm->minmax_reservoir > desired_fill)
- {
- if(max_target_bits > 0) /* logical bulletproofing against initialization state */
- {
- bm->minmax_reservoir += (this_bits - max_target_bits);
- if(bm->minmax_reservoir < desired_fill)bm->minmax_reservoir = desired_fill;
- }
- else
- {
- bm->minmax_reservoir = desired_fill;
- }
- }
- else
- {
- if(min_target_bits > 0) /* logical bulletproofing against initialization state */
- {
- bm->minmax_reservoir += (this_bits - min_target_bits);
- if(bm->minmax_reservoir > desired_fill)bm->minmax_reservoir = desired_fill;
- }
- else
- {
- bm->minmax_reservoir = desired_fill;
- }
- }
+ }else{
+ if(min_target_bits>0){ /* logical bulletproofing against initialization state */
+ bm->minmax_reservoir+=(this_bits-min_target_bits);
+ if(bm->minmax_reservoir>desired_fill)bm->minmax_reservoir=desired_fill;
+ }else{
+ bm->minmax_reservoir=desired_fill;
}
+ }
}
+ }
- /* avg reservoir */
- if(bm->avg_bitsper > 0)
- {
- long avg_target_bits = (vb->W ? bm->avg_bitsper * bm->short_per_long : bm->avg_bitsper);
- bm->avg_reservoir += this_bits - avg_target_bits;
- }
+ /* avg reservoir */
+ if(bm->avg_bitsper>0){
+ long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper);
+ bm->avg_reservoir+=this_bits-avg_target_bits;
+ }
- return(0);
+ return(0);
}
-int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op)
-{
- private_state *b = vd->backend_state;
- bitrate_manager_state *bm = &b->bms;
- vorbis_block *vb = bm->vb;
- int choice = PACKETBLOBS / 2;
- if(!vb)return 0;
-
- if(op)
- {
- vorbis_block_internal *vbi = vb->internal;
-
- if(vorbis_bitrate_managed(vb))
- choice = bm->choice;
-
- op->packet = oggpack_get_buffer(vbi->packetblob[choice]);
- op->bytes = oggpack_bytes(vbi->packetblob[choice]);
- op->b_o_s = 0;
- op->e_o_s = vb->eofflag;
- op->granulepos = vb->granulepos;
- op->packetno = vb->sequence; /* for sake of completeness */
- }
-
- bm->vb = 0;
- return(1);
+int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){
+ private_state *b=vd->backend_state;
+ bitrate_manager_state *bm=&b->bms;
+ vorbis_block *vb=bm->vb;
+ int choice=PACKETBLOBS/2;
+ if(!vb)return 0;
+
+ if(op){
+ vorbis_block_internal *vbi=vb->internal;
+
+ if(vorbis_bitrate_managed(vb))
+ choice=bm->choice;
+
+ op->packet=oggpack_get_buffer(vbi->packetblob[choice]);
+ op->bytes=oggpack_bytes(vbi->packetblob[choice]);
+ op->b_o_s=0;
+ op->e_o_s=vb->eofflag;
+ op->granulepos=vb->granulepos;
+ op->packetno=vb->sequence; /* for sake of completeness */
+ }
+
+ bm->vb=0;
+ return(1);
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.h b/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.h
index 5ac1e733d..db48fcb64 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/bitrate.h
@@ -23,36 +23,34 @@
#include "os.h"
/* encode side bitrate tracking */
-typedef struct bitrate_manager_state
-{
- int managed;
+typedef struct bitrate_manager_state {
+ int managed;
- long avg_reservoir;
- long minmax_reservoir;
- long avg_bitsper;
- long min_bitsper;
- long max_bitsper;
+ long avg_reservoir;
+ long minmax_reservoir;
+ long avg_bitsper;
+ long min_bitsper;
+ long max_bitsper;
- long short_per_long;
- double avgfloat;
+ long short_per_long;
+ double avgfloat;
- vorbis_block *vb;
- int choice;
+ vorbis_block *vb;
+ int choice;
} bitrate_manager_state;
-typedef struct bitrate_manager_info
-{
- long avg_rate;
- long min_rate;
- long max_rate;
- long reservoir_bits;
- double reservoir_bias;
+typedef struct bitrate_manager_info{
+ long avg_rate;
+ long min_rate;
+ long max_rate;
+ long reservoir_bits;
+ double reservoir_bias;
- double slew_damp;
+ double slew_damp;
} bitrate_manager_info;
-extern void vorbis_bitrate_init(vorbis_info *vi, bitrate_manager_state *bs);
+extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs);
extern void vorbis_bitrate_clear(bitrate_manager_state *bs);
extern int vorbis_bitrate_managed(vorbis_block *vb);
extern int vorbis_bitrate_addblock(vorbis_block *vb);
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/bitwise.c b/src/filters/transform/MpaDecFilter/libvorbisidec/bitwise.c
index ad3199032..6eb58ad3d 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/bitwise.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/bitwise.c
@@ -24,546 +24,465 @@
#define BUFFER_INCREMENT 256
-static const unsigned long mask[] =
-{
- 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f,
- 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff,
- 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff,
- 0x00007fff, 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
- 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
- 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff,
- 0x3fffffff, 0x7fffffff, 0xffffffff
-};
-
-static const unsigned int mask8B[] =
-{0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
-
-void oggpack_writeinit(oggpack_buffer *b)
-{
- memset(b, 0, sizeof(*b));
- b->ptr = b->buffer = _ogg_malloc(BUFFER_INCREMENT);
- b->buffer[0] = '\0';
- b->storage = BUFFER_INCREMENT;
-}
-
-void oggpackB_writeinit(oggpack_buffer *b)
-{
- oggpack_writeinit(b);
-}
-
-int oggpack_writecheck(oggpack_buffer *b)
-{
- if(!b->ptr || !b->storage)return -1;
- return 0;
-}
-
-int oggpackB_writecheck(oggpack_buffer *b)
-{
- return oggpack_writecheck(b);
-}
-
-void oggpack_writetrunc(oggpack_buffer *b, long bits)
-{
- long bytes = bits >> 3;
- if(b->ptr)
- {
- bits -= bytes * 8;
- b->ptr = b->buffer + bytes;
- b->endbit = bits;
- b->endbyte = bytes;
- *b->ptr &= mask[bits];
- }
+static const unsigned long mask[]=
+{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
+ 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
+ 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
+ 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
+ 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
+ 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
+ 0x3fffffff,0x7fffffff,0xffffffff };
+
+static const unsigned int mask8B[]=
+{0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};
+
+void oggpack_writeinit(oggpack_buffer *b){
+ memset(b,0,sizeof(*b));
+ b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT);
+ b->buffer[0]='\0';
+ b->storage=BUFFER_INCREMENT;
}
-void oggpackB_writetrunc(oggpack_buffer *b, long bits)
-{
- long bytes = bits >> 3;
- if(b->ptr)
- {
- bits -= bytes * 8;
- b->ptr = b->buffer + bytes;
- b->endbit = bits;
- b->endbyte = bytes;
- *b->ptr &= mask8B[bits];
- }
+void oggpackB_writeinit(oggpack_buffer *b){
+ oggpack_writeinit(b);
}
-/* Takes only up to 32 bits. */
-void oggpack_write(oggpack_buffer *b, unsigned long value, int bits)
-{
- if(b->endbyte + 4 >= b->storage)
- {
- void *ret;
- if(!b->ptr)return;
- ret = _ogg_realloc(b->buffer, b->storage + BUFFER_INCREMENT);
- if(!ret)
- {
- oggpack_writeclear(b);
- return;
- }
- b->buffer = ret;
- b->storage += BUFFER_INCREMENT;
- b->ptr = b->buffer + b->endbyte;
- }
+int oggpack_writecheck(oggpack_buffer *b){
+ if(!b->ptr || !b->storage)return -1;
+ return 0;
+}
- value &= mask[bits];
- bits += b->endbit;
-
- b->ptr[0] |= value << b->endbit;
-
- if(bits >= 8)
- {
- b->ptr[1] = (unsigned char)(value >> (8 - b->endbit));
- if(bits >= 16)
- {
- b->ptr[2] = (unsigned char)(value >> (16 - b->endbit));
- if(bits >= 24)
- {
- b->ptr[3] = (unsigned char)(value >> (24 - b->endbit));
- if(bits >= 32)
- {
- if(b->endbit)
- b->ptr[4] = (unsigned char)(value >> (32 - b->endbit));
- else
- b->ptr[4] = 0;
- }
- }
- }
- }
+int oggpackB_writecheck(oggpack_buffer *b){
+ return oggpack_writecheck(b);
+}
- b->endbyte += bits / 8;
- b->ptr += bits / 8;
- b->endbit = bits & 7;
+void oggpack_writetrunc(oggpack_buffer *b,long bits){
+ long bytes=bits>>3;
+ if(b->ptr){
+ bits-=bytes*8;
+ b->ptr=b->buffer+bytes;
+ b->endbit=bits;
+ b->endbyte=bytes;
+ *b->ptr&=mask[bits];
+ }
+}
+
+void oggpackB_writetrunc(oggpack_buffer *b,long bits){
+ long bytes=bits>>3;
+ if(b->ptr){
+ bits-=bytes*8;
+ b->ptr=b->buffer+bytes;
+ b->endbit=bits;
+ b->endbyte=bytes;
+ *b->ptr&=mask8B[bits];
+ }
}
/* Takes only up to 32 bits. */
-void oggpackB_write(oggpack_buffer *b, unsigned long value, int bits)
-{
- if(b->endbyte + 4 >= b->storage)
- {
- void *ret;
- if(!b->ptr)return;
- ret = _ogg_realloc(b->buffer, b->storage + BUFFER_INCREMENT);
- if(!ret)
- {
- oggpack_writeclear(b);
- return;
+void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
+ if(b->endbyte+4>=b->storage){
+ void *ret;
+ if(!b->ptr)return;
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ if(!ret){
+ oggpack_writeclear(b);
+ return;
+ }
+ b->buffer=ret;
+ b->storage+=BUFFER_INCREMENT;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ value&=mask[bits];
+ bits+=b->endbit;
+
+ b->ptr[0]|=value<<b->endbit;
+
+ if(bits>=8){
+ b->ptr[1]=(unsigned char)(value>>(8-b->endbit));
+ if(bits>=16){
+ b->ptr[2]=(unsigned char)(value>>(16-b->endbit));
+ if(bits>=24){
+ b->ptr[3]=(unsigned char)(value>>(24-b->endbit));
+ if(bits>=32){
+ if(b->endbit)
+ b->ptr[4]=(unsigned char)(value>>(32-b->endbit));
+ else
+ b->ptr[4]=0;
}
- b->buffer = ret;
- b->storage += BUFFER_INCREMENT;
- b->ptr = b->buffer + b->endbyte;
+ }
}
+ }
- value = (value & mask[bits]) << (32 - bits);
- bits += b->endbit;
-
- b->ptr[0] |= value >> (24 + b->endbit);
-
- if(bits >= 8)
- {
- b->ptr[1] = (unsigned char)(value >> (16 + b->endbit));
- if(bits >= 16)
- {
- b->ptr[2] = (unsigned char)(value >> (8 + b->endbit));
- if(bits >= 24)
- {
- b->ptr[3] = (unsigned char)(value >> (b->endbit));
- if(bits >= 32)
- {
- if(b->endbit)
- b->ptr[4] = (unsigned char)(value << (8 - b->endbit));
- else
- b->ptr[4] = 0;
- }
- }
+ b->endbyte+=bits/8;
+ b->ptr+=bits/8;
+ b->endbit=bits&7;
+}
+
+/* Takes only up to 32 bits. */
+void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){
+ if(b->endbyte+4>=b->storage){
+ void *ret;
+ if(!b->ptr)return;
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ if(!ret){
+ oggpack_writeclear(b);
+ return;
+ }
+ b->buffer=ret;
+ b->storage+=BUFFER_INCREMENT;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ value=(value&mask[bits])<<(32-bits);
+ bits+=b->endbit;
+
+ b->ptr[0]|=value>>(24+b->endbit);
+
+ if(bits>=8){
+ b->ptr[1]=(unsigned char)(value>>(16+b->endbit));
+ if(bits>=16){
+ b->ptr[2]=(unsigned char)(value>>(8+b->endbit));
+ if(bits>=24){
+ b->ptr[3]=(unsigned char)(value>>(b->endbit));
+ if(bits>=32){
+ if(b->endbit)
+ b->ptr[4]=(unsigned char)(value<<(8-b->endbit));
+ else
+ b->ptr[4]=0;
}
+ }
}
+ }
- b->endbyte += bits / 8;
- b->ptr += bits / 8;
- b->endbit = bits & 7;
+ b->endbyte+=bits/8;
+ b->ptr+=bits/8;
+ b->endbit=bits&7;
}
-void oggpack_writealign(oggpack_buffer *b)
-{
- int bits = 8 - b->endbit;
- if(bits < 8)
- oggpack_write(b, 0, bits);
+void oggpack_writealign(oggpack_buffer *b){
+ int bits=8-b->endbit;
+ if(bits<8)
+ oggpack_write(b,0,bits);
}
-void oggpackB_writealign(oggpack_buffer *b)
-{
- int bits = 8 - b->endbit;
- if(bits < 8)
- oggpackB_write(b, 0, bits);
+void oggpackB_writealign(oggpack_buffer *b){
+ int bits=8-b->endbit;
+ if(bits<8)
+ oggpackB_write(b,0,bits);
}
static void oggpack_writecopy_helper(oggpack_buffer *b,
-void *source,
-long bits,
-void (*w)(oggpack_buffer *,
-unsigned long,
-int),
-int msb)
-{
- unsigned char *ptr = (unsigned char *)source;
-
- long bytes = bits / 8;
- bits -= bytes * 8;
-
- if(b->endbit)
- {
- int i;
- /* unaligned copy. Do it the hard way. */
- for(i = 0; i < bytes; i++)
- w(b, (unsigned long)(ptr[i]), 8);
- }
+ void *source,
+ long bits,
+ void (*w)(oggpack_buffer *,
+ unsigned long,
+ int),
+ int msb){
+ unsigned char *ptr=(unsigned char *)source;
+
+ long bytes=bits/8;
+ bits-=bytes*8;
+
+ if(b->endbit){
+ int i;
+ /* unaligned copy. Do it the hard way. */
+ for(i=0;i<bytes;i++)
+ w(b,(unsigned long)(ptr[i]),8);
+ }else{
+ /* aligned block copy */
+ if(b->endbyte+bytes+1>=b->storage){
+ void *ret;
+ if(!b->ptr)return;
+ b->storage=b->endbyte+bytes+BUFFER_INCREMENT;
+ ret=_ogg_realloc(b->buffer,b->storage);
+ if(!ret){
+ oggpack_writeclear(b);
+ return;
+ }
+ b->buffer=ret;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ memmove(b->ptr,source,bytes);
+ b->ptr+=bytes;
+ b->endbyte+=bytes;
+ *b->ptr=0;
+
+ }
+ if(bits){
+ if(msb)
+ w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);
else
- {
- /* aligned block copy */
- if(b->endbyte + bytes + 1 >= b->storage)
- {
- void *ret;
- if(!b->ptr)return;
- b->storage = b->endbyte + bytes + BUFFER_INCREMENT;
- ret = _ogg_realloc(b->buffer, b->storage);
- if(!ret)
- {
- oggpack_writeclear(b);
- return;
- }
- b->buffer = ret;
- b->ptr = b->buffer + b->endbyte;
- }
-
- memmove(b->ptr, source, bytes);
- b->ptr += bytes;
- b->endbyte += bytes;
- *b->ptr = 0;
-
- }
- if(bits)
- {
- if(msb)
- w(b, (unsigned long)(ptr[bytes] >> (8 - bits)), bits);
- else
- w(b, (unsigned long)(ptr[bytes]), bits);
- }
+ w(b,(unsigned long)(ptr[bytes]),bits);
+ }
}
-void oggpack_writecopy(oggpack_buffer *b, void *source, long bits)
-{
- oggpack_writecopy_helper(b, source, bits, oggpack_write, 0);
+void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){
+ oggpack_writecopy_helper(b,source,bits,oggpack_write,0);
}
-void oggpackB_writecopy(oggpack_buffer *b, void *source, long bits)
-{
- oggpack_writecopy_helper(b, source, bits, oggpackB_write, 1);
+void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){
+ oggpack_writecopy_helper(b,source,bits,oggpackB_write,1);
}
-void oggpack_reset(oggpack_buffer *b)
-{
- if(!b->ptr)return;
- b->ptr = b->buffer;
- b->buffer[0] = 0;
- b->endbit = b->endbyte = 0;
+void oggpack_reset(oggpack_buffer *b){
+ if(!b->ptr)return;
+ b->ptr=b->buffer;
+ b->buffer[0]=0;
+ b->endbit=b->endbyte=0;
}
-void oggpackB_reset(oggpack_buffer *b)
-{
- oggpack_reset(b);
+void oggpackB_reset(oggpack_buffer *b){
+ oggpack_reset(b);
}
-void oggpack_writeclear(oggpack_buffer *b)
-{
- if(b->buffer)_ogg_free(b->buffer);
- memset(b, 0, sizeof(*b));
+void oggpack_writeclear(oggpack_buffer *b){
+ if(b->buffer)_ogg_free(b->buffer);
+ memset(b,0,sizeof(*b));
}
-void oggpackB_writeclear(oggpack_buffer *b)
-{
- oggpack_writeclear(b);
+void oggpackB_writeclear(oggpack_buffer *b){
+ oggpack_writeclear(b);
}
-void oggpack_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
-{
- memset(b, 0, sizeof(*b));
- b->buffer = b->ptr = buf;
- b->storage = bytes;
+void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
+ memset(b,0,sizeof(*b));
+ b->buffer=b->ptr=buf;
+ b->storage=bytes;
}
-void oggpackB_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
-{
- oggpack_readinit(b, buf, bytes);
+void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
+ oggpack_readinit(b,buf,bytes);
}
/* Read in bits without advancing the bitptr; bits <= 32 */
-long oggpack_look(oggpack_buffer *b, int bits)
-{
- unsigned long ret;
- unsigned long m = mask[bits];
-
- bits += b->endbit;
-
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- if(b->endbyte * 8 + bits > b->storage * 8)return(-1);
- }
-
- ret = b->ptr[0] >> b->endbit;
- if(bits > 8)
- {
- ret |= b->ptr[1] << (8 - b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (16 - b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (24 - b->endbit);
- if(bits > 32 && b->endbit)
- ret |= b->ptr[4] << (32 - b->endbit);
- }
- }
- }
- return(m & ret);
+long oggpack_look(oggpack_buffer *b,int bits){
+ unsigned long ret;
+ unsigned long m=mask[bits];
+
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ if(b->endbyte*8+bits>b->storage*8)return(-1);
+ }
+
+ ret=b->ptr[0]>>b->endbit;
+ if(bits>8){
+ ret|=b->ptr[1]<<(8-b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(16-b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(24-b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]<<(32-b->endbit);
+ }
+ }
+ }
+ return(m&ret);
}
/* Read in bits without advancing the bitptr; bits <= 32 */
-long oggpackB_look(oggpack_buffer *b, int bits)
-{
- unsigned long ret;
- int m = 32 - bits;
+long oggpackB_look(oggpack_buffer *b,int bits){
+ unsigned long ret;
+ int m=32-bits;
- bits += b->endbit;
+ bits+=b->endbit;
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- if(b->endbyte * 8 + bits > b->storage * 8)return(-1);
- }
-
- ret = b->ptr[0] << (24 + b->endbit);
- if(bits > 8)
- {
- ret |= b->ptr[1] << (16 + b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (8 + b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (b->endbit);
- if(bits > 32 && b->endbit)
- ret |= b->ptr[4] >> (8 - b->endbit);
- }
- }
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ if(b->endbyte*8+bits>b->storage*8)return(-1);
+ }
+
+ ret=b->ptr[0]<<(24+b->endbit);
+ if(bits>8){
+ ret|=b->ptr[1]<<(16+b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(8+b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]>>(8-b->endbit);
+ }
}
- return ((ret & 0xffffffff) >> (m >> 1)) >> ((m + 1) >> 1);
+ }
+ return ((ret&0xffffffff)>>(m>>1))>>((m+1)>>1);
}
-long oggpack_look1(oggpack_buffer *b)
-{
- if(b->endbyte >= b->storage)return(-1);
- return((b->ptr[0] >> b->endbit) & 1);
+long oggpack_look1(oggpack_buffer *b){
+ if(b->endbyte>=b->storage)return(-1);
+ return((b->ptr[0]>>b->endbit)&1);
}
-long oggpackB_look1(oggpack_buffer *b)
-{
- if(b->endbyte >= b->storage)return(-1);
- return((b->ptr[0] >> (7 - b->endbit)) & 1);
+long oggpackB_look1(oggpack_buffer *b){
+ if(b->endbyte>=b->storage)return(-1);
+ return((b->ptr[0]>>(7-b->endbit))&1);
}
-void oggpack_adv(oggpack_buffer *b, int bits)
-{
- bits += b->endbit;
- b->ptr += bits / 8;
- b->endbyte += bits / 8;
- b->endbit = bits & 7;
+void oggpack_adv(oggpack_buffer *b,int bits){
+ bits+=b->endbit;
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
}
-void oggpackB_adv(oggpack_buffer *b, int bits)
-{
- oggpack_adv(b, bits);
+void oggpackB_adv(oggpack_buffer *b,int bits){
+ oggpack_adv(b,bits);
}
-void oggpack_adv1(oggpack_buffer *b)
-{
- if(++(b->endbit) > 7)
- {
- b->endbit = 0;
- b->ptr++;
- b->endbyte++;
- }
+void oggpack_adv1(oggpack_buffer *b){
+ if(++(b->endbit)>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
}
-void oggpackB_adv1(oggpack_buffer *b)
-{
- oggpack_adv1(b);
+void oggpackB_adv1(oggpack_buffer *b){
+ oggpack_adv1(b);
}
/* bits <= 32 */
-long oggpack_read(oggpack_buffer *b, int bits)
-{
- long ret;
- unsigned long m = mask[bits];
-
- bits += b->endbit;
-
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- if(b->endbyte * 8 + bits > b->storage * 8)goto overflow;
- }
-
- ret = b->ptr[0] >> b->endbit;
- if(bits > 8)
- {
- ret |= b->ptr[1] << (8 - b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (16 - b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (24 - b->endbit);
- if(bits > 32 && b->endbit)
- {
- ret |= b->ptr[4] << (32 - b->endbit);
- }
- }
+long oggpack_read(oggpack_buffer *b,int bits){
+ long ret;
+ unsigned long m=mask[bits];
+
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ if(b->endbyte*8+bits>b->storage*8)goto overflow;
+ }
+
+ ret=b->ptr[0]>>b->endbit;
+ if(bits>8){
+ ret|=b->ptr[1]<<(8-b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(16-b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(24-b->endbit);
+ if(bits>32 && b->endbit){
+ ret|=b->ptr[4]<<(32-b->endbit);
}
+ }
}
- ret &= m;
+ }
+ ret&=m;
+
+ overflow:
-overflow:
-
- b->ptr += bits / 8;
- b->endbyte += bits / 8;
- b->endbit = bits & 7;
- return(ret);
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return(ret);
}
/* bits <= 32 */
-long oggpackB_read(oggpack_buffer *b, int bits)
-{
- long ret;
- long m = 32 - bits;
-
- bits += b->endbit;
-
- if(b->endbyte + 4 >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- if(b->endbyte * 8 + bits > b->storage * 8)goto overflow;
- /* special case to avoid reading b->ptr[0], which might be past the end of
- the buffer; also skips some useless accounting */
- else if(!bits)return(0L);
- }
-
- ret = b->ptr[0] << (24 + b->endbit);
- if(bits > 8)
- {
- ret |= b->ptr[1] << (16 + b->endbit);
- if(bits > 16)
- {
- ret |= b->ptr[2] << (8 + b->endbit);
- if(bits > 24)
- {
- ret |= b->ptr[3] << (b->endbit);
- if(bits > 32 && b->endbit)
- ret |= b->ptr[4] >> (8 - b->endbit);
- }
- }
- }
- ret = ((ret & 0xffffffffUL) >> (m >> 1)) >> ((m + 1) >> 1);
-
-overflow:
-
- b->ptr += bits / 8;
- b->endbyte += bits / 8;
- b->endbit = bits & 7;
- return(ret);
-}
-
-long oggpack_read1(oggpack_buffer *b)
-{
- long ret;
-
- if(b->endbyte >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- goto overflow;
- }
-
- ret = (b->ptr[0] >> b->endbit) & 1;
-
-overflow:
-
- b->endbit++;
- if(b->endbit > 7)
- {
- b->endbit = 0;
- b->ptr++;
- b->endbyte++;
- }
- return(ret);
-}
-
-long oggpackB_read1(oggpack_buffer *b)
-{
- long ret;
-
- if(b->endbyte >= b->storage)
- {
- /* not the main path */
- ret = -1L;
- goto overflow;
- }
-
- ret = (b->ptr[0] >> (7 - b->endbit)) & 1;
-
-overflow:
-
- b->endbit++;
- if(b->endbit > 7)
- {
- b->endbit = 0;
- b->ptr++;
- b->endbyte++;
- }
- return(ret);
-}
-
-long oggpack_bytes(oggpack_buffer *b)
-{
- return(b->endbyte + (b->endbit + 7) / 8);
-}
-
-long oggpack_bits(oggpack_buffer *b)
-{
- return(b->endbyte * 8 + b->endbit);
-}
-
-long oggpackB_bytes(oggpack_buffer *b)
-{
- return oggpack_bytes(b);
-}
-
-long oggpackB_bits(oggpack_buffer *b)
-{
- return oggpack_bits(b);
-}
-
-unsigned char *oggpack_get_buffer(oggpack_buffer *b)
-{
- return(b->buffer);
-}
-
-unsigned char *oggpackB_get_buffer(oggpack_buffer *b)
-{
- return oggpack_get_buffer(b);
+long oggpackB_read(oggpack_buffer *b,int bits){
+ long ret;
+ long m=32-bits;
+
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ if(b->endbyte*8+bits>b->storage*8)goto overflow;
+ /* special case to avoid reading b->ptr[0], which might be past the end of
+ the buffer; also skips some useless accounting */
+ else if(!bits)return(0L);
+ }
+
+ ret=b->ptr[0]<<(24+b->endbit);
+ if(bits>8){
+ ret|=b->ptr[1]<<(16+b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(8+b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]>>(8-b->endbit);
+ }
+ }
+ }
+ ret=((ret&0xffffffffUL)>>(m>>1))>>((m+1)>>1);
+
+ overflow:
+
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return(ret);
+}
+
+long oggpack_read1(oggpack_buffer *b){
+ long ret;
+
+ if(b->endbyte>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ goto overflow;
+ }
+
+ ret=(b->ptr[0]>>b->endbit)&1;
+
+ overflow:
+
+ b->endbit++;
+ if(b->endbit>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+ return(ret);
+}
+
+long oggpackB_read1(oggpack_buffer *b){
+ long ret;
+
+ if(b->endbyte>=b->storage){
+ /* not the main path */
+ ret=-1L;
+ goto overflow;
+ }
+
+ ret=(b->ptr[0]>>(7-b->endbit))&1;
+
+ overflow:
+
+ b->endbit++;
+ if(b->endbit>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+ return(ret);
+}
+
+long oggpack_bytes(oggpack_buffer *b){
+ return(b->endbyte+(b->endbit+7)/8);
+}
+
+long oggpack_bits(oggpack_buffer *b){
+ return(b->endbyte*8+b->endbit);
+}
+
+long oggpackB_bytes(oggpack_buffer *b){
+ return oggpack_bytes(b);
+}
+
+long oggpackB_bits(oggpack_buffer *b){
+ return oggpack_bits(b);
+}
+
+unsigned char *oggpack_get_buffer(oggpack_buffer *b){
+ return(b->buffer);
+}
+
+unsigned char *oggpackB_get_buffer(oggpack_buffer *b){
+ return oggpack_get_buffer(b);
}
/* Self test of the bitwise routines; everything else is based on
@@ -572,382 +491,332 @@ unsigned char *oggpackB_get_buffer(oggpack_buffer *b)
#ifdef _V_SELFTEST
#include <stdio.h>
-static int ilog(unsigned int v)
-{
- int ret = 0;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-
+
oggpack_buffer o;
oggpack_buffer r;
-void report(char *in)
-{
- fprintf(stderr, "%s", in);
- exit(1);
-}
-
-void cliptest(unsigned long *b, int vals, int bits, int *comp, int compsize)
-{
- long bytes, i;
- unsigned char *buffer;
-
- oggpack_reset(&o);
- for(i = 0; i < vals; i++)
- oggpack_write(&o, b[i], bits ? bits : ilog(b[i]));
- buffer = oggpack_get_buffer(&o);
- bytes = oggpack_bytes(&o);
- if(bytes != compsize)report("wrong number of bytes!\n");
- for(i = 0; i < bytes; i++)if(buffer[i] != comp[i])
- {
- for(i = 0; i < bytes; i++)fprintf(stderr, "%x %x\n", (int)buffer[i], (int)comp[i]);
- report("wrote incorrect value!\n");
- }
- oggpack_readinit(&r, buffer, bytes);
- for(i = 0; i < vals; i++)
- {
- int tbit = bits ? bits : ilog(b[i]);
- if(oggpack_look(&r, tbit) == -1)
- report("out of data!\n");
- if(oggpack_look(&r, tbit) != (b[i]&mask[tbit]))
- report("looked at incorrect value!\n");
- if(tbit == 1)
- if(oggpack_look1(&r) != (b[i]&mask[tbit]))
- report("looked at single bit incorrect value!\n");
- if(tbit == 1)
- {
- if(oggpack_read1(&r) != (b[i]&mask[tbit]))
- report("read incorrect single bit value!\n");
- }
- else
- {
- if(oggpack_read(&r, tbit) != (b[i]&mask[tbit]))
- report("read incorrect value!\n");
- }
- }
- if(oggpack_bytes(&r) != bytes)report("leftover bytes after read!\n");
-}
-
-void cliptestB(unsigned long *b, int vals, int bits, int *comp, int compsize)
-{
- long bytes, i;
- unsigned char *buffer;
-
- oggpackB_reset(&o);
- for(i = 0; i < vals; i++)
- oggpackB_write(&o, b[i], bits ? bits : ilog(b[i]));
- buffer = oggpackB_get_buffer(&o);
- bytes = oggpackB_bytes(&o);
- if(bytes != compsize)report("wrong number of bytes!\n");
- for(i = 0; i < bytes; i++)if(buffer[i] != comp[i])
- {
- for(i = 0; i < bytes; i++)fprintf(stderr, "%x %x\n", (int)buffer[i], (int)comp[i]);
- report("wrote incorrect value!\n");
- }
- oggpackB_readinit(&r, buffer, bytes);
- for(i = 0; i < vals; i++)
- {
- int tbit = bits ? bits : ilog(b[i]);
- if(oggpackB_look(&r, tbit) == -1)
- report("out of data!\n");
- if(oggpackB_look(&r, tbit) != (b[i]&mask[tbit]))
- report("looked at incorrect value!\n");
- if(tbit == 1)
- if(oggpackB_look1(&r) != (b[i]&mask[tbit]))
- report("looked at single bit incorrect value!\n");
- if(tbit == 1)
- {
- if(oggpackB_read1(&r) != (b[i]&mask[tbit]))
- report("read incorrect single bit value!\n");
- }
- else
- {
- if(oggpackB_read(&r, tbit) != (b[i]&mask[tbit]))
- report("read incorrect value!\n");
- }
- }
- if(oggpackB_bytes(&r) != bytes)report("leftover bytes after read!\n");
-}
-
-int main(void)
-{
- unsigned char *buffer;
- long bytes, i;
- static unsigned long testbuffer1[] =
- {
- 18, 12, 103948, 4325, 543, 76, 432, 52, 3, 65, 4, 56, 32, 42, 34, 21, 1, 23, 32, 546, 456, 7,
- 567, 56, 8, 8, 55, 3, 52, 342, 341, 4, 265, 7, 67, 86, 2199, 21, 7, 1, 5, 1, 4
- };
- int test1size = 43;
-
- static unsigned long testbuffer2[] =
- {
- 216531625L, 1237861823, 56732452, 131, 3212421, 12325343, 34547562, 12313212,
- 1233432, 534, 5, 346435231, 14436467, 7869299, 76326614, 167548585,
- 85525151, 0, 12321, 1, 349528352
- };
- int test2size = 21;
-
- static unsigned long testbuffer3[] =
- {
- 1, 0, 14, 0, 1, 0, 12, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,
- 0, 1, 30, 1, 1, 1, 0, 0, 1, 0, 0, 0, 12, 0, 11, 0, 1, 0, 0, 1
- };
- int test3size = 56;
-
- static unsigned long large[] =
- {
- 2136531625L, 2137861823, 56732452, 131, 3212421, 12325343, 34547562, 12313212,
- 1233432, 534, 5, 2146435231, 14436467, 7869299, 76326614, 167548585,
- 85525151, 0, 12321, 1, 2146528352
- };
-
- int onesize = 33;
- static int one[33] = {146, 25, 44, 151, 195, 15, 153, 176, 233, 131, 196, 65, 85, 172, 47, 40,
- 34, 242, 223, 136, 35, 222, 211, 86, 171, 50, 225, 135, 214, 75, 172,
- 223, 4
- };
- static int oneB[33] = {150, 101, 131, 33, 203, 15, 204, 216, 105, 193, 156, 65, 84, 85, 222,
- 8, 139, 145, 227, 126, 34, 55, 244, 171, 85, 100, 39, 195, 173, 18,
- 245, 251, 128
- };
-
- int twosize = 6;
- static int two[6] = {61, 255, 255, 251, 231, 29};
- static int twoB[6] = {247, 63, 255, 253, 249, 120};
-
- int threesize = 54;
- static int three[54] = {169, 2, 232, 252, 91, 132, 156, 36, 89, 13, 123, 176, 144, 32, 254,
- 142, 224, 85, 59, 121, 144, 79, 124, 23, 67, 90, 90, 216, 79, 23, 83,
- 58, 135, 196, 61, 55, 129, 183, 54, 101, 100, 170, 37, 127, 126, 10,
- 100, 52, 4, 14, 18, 86, 77, 1
- };
- static int threeB[54] = {206, 128, 42, 153, 57, 8, 183, 251, 13, 89, 36, 30, 32, 144, 183,
- 130, 59, 240, 121, 59, 85, 223, 19, 228, 180, 134, 33, 107, 74, 98,
- 233, 253, 196, 135, 63, 2, 110, 114, 50, 155, 90, 127, 37, 170, 104,
- 200, 20, 254, 4, 58, 106, 176, 144, 0
- };
-
- int foursize = 38;
- static int four[38] = {18, 6, 163, 252, 97, 194, 104, 131, 32, 1, 7, 82, 137, 42, 129, 11, 72,
- 132, 60, 220, 112, 8, 196, 109, 64, 179, 86, 9, 137, 195, 208, 122, 169,
- 28, 2, 133, 0, 1
- };
- static int fourB[38] = {36, 48, 102, 83, 243, 24, 52, 7, 4, 35, 132, 10, 145, 21, 2, 93, 2, 41,
- 1, 219, 184, 16, 33, 184, 54, 149, 170, 132, 18, 30, 29, 98, 229, 67,
- 129, 10, 4, 32
- };
-
- int fivesize = 45;
- static int five[45] = {169, 2, 126, 139, 144, 172, 30, 4, 80, 72, 240, 59, 130, 218, 73, 62,
- 241, 24, 210, 44, 4, 20, 0, 248, 116, 49, 135, 100, 110, 130, 181, 169,
- 84, 75, 159, 2, 1, 0, 132, 192, 8, 0, 0, 18, 22
- };
- static int fiveB[45] = {1, 84, 145, 111, 245, 100, 128, 8, 56, 36, 40, 71, 126, 78, 213, 226,
- 124, 105, 12, 0, 133, 128, 0, 162, 233, 242, 67, 152, 77, 205, 77,
- 172, 150, 169, 129, 79, 128, 0, 6, 4, 32, 0, 27, 9, 0
- };
-
- int sixsize = 7;
- static int six[7] = {17, 177, 170, 242, 169, 19, 148};
- static int sixB[7] = {136, 141, 85, 79, 149, 200, 41};
-
- /* Test read/write together */
- /* Later we test against pregenerated bitstreams */
- oggpack_writeinit(&o);
-
- fprintf(stderr, "\nSmall preclipped packing (LSb): ");
- cliptest(testbuffer1, test1size, 0, one, onesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nNull bit call (LSb): ");
- cliptest(testbuffer3, test3size, 0, two, twosize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge preclipped packing (LSb): ");
- cliptest(testbuffer2, test2size, 0, three, threesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\n32 bit preclipped packing (LSb): ");
- oggpack_reset(&o);
- for(i = 0; i < test2size; i++)
- oggpack_write(&o, large[i], 32);
- buffer = oggpack_get_buffer(&o);
- bytes = oggpack_bytes(&o);
- oggpack_readinit(&r, buffer, bytes);
- for(i = 0; i < test2size; i++)
- {
- if(oggpack_look(&r, 32) == -1)report("out of data. failed!");
- if(oggpack_look(&r, 32) != large[i])
- {
- fprintf(stderr, "%ld != %ld (%lx!=%lx):", oggpack_look(&r, 32), large[i],
- oggpack_look(&r, 32), large[i]);
- report("read incorrect value!\n");
- }
- oggpack_adv(&r, 32);
- }
- if(oggpack_bytes(&r) != bytes)report("leftover bytes after read!\n");
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSmall unclipped packing (LSb): ");
- cliptest(testbuffer1, test1size, 7, four, foursize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge unclipped packing (LSb): ");
- cliptest(testbuffer2, test2size, 17, five, fivesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSingle bit unclipped packing (LSb): ");
- cliptest(testbuffer3, test3size, 1, six, sixsize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nTesting read past end (LSb): ");
- oggpack_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- for(i = 0; i < 64; i++)
- {
- if(oggpack_read(&r, 1) != 0)
- {
- fprintf(stderr, "failed; got -1 prematurely.\n");
- exit(1);
- }
- }
- if(oggpack_look(&r, 1) != -1 ||
- oggpack_read(&r, 1) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpack_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- if(oggpack_read(&r, 30) != 0 || oggpack_read(&r, 16) != 0)
- {
- fprintf(stderr, "failed 2; got -1 prematurely.\n");
- exit(1);
- }
-
- if(oggpack_look(&r, 18) != 0 ||
- oggpack_look(&r, 18) != 0)
- {
- fprintf(stderr, "failed 3; got -1 prematurely.\n");
- exit(1);
- }
- if(oggpack_look(&r, 19) != -1 ||
- oggpack_look(&r, 19) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- if(oggpack_look(&r, 32) != -1 ||
- oggpack_look(&r, 32) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpack_writeclear(&o);
- fprintf(stderr, "ok.\n");
-
- /********** lazy, cut-n-paste retest with MSb packing ***********/
-
- /* Test read/write together */
- /* Later we test against pregenerated bitstreams */
- oggpackB_writeinit(&o);
-
- fprintf(stderr, "\nSmall preclipped packing (MSb): ");
- cliptestB(testbuffer1, test1size, 0, oneB, onesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nNull bit call (MSb): ");
- cliptestB(testbuffer3, test3size, 0, twoB, twosize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge preclipped packing (MSb): ");
- cliptestB(testbuffer2, test2size, 0, threeB, threesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\n32 bit preclipped packing (MSb): ");
- oggpackB_reset(&o);
- for(i = 0; i < test2size; i++)
- oggpackB_write(&o, large[i], 32);
- buffer = oggpackB_get_buffer(&o);
- bytes = oggpackB_bytes(&o);
- oggpackB_readinit(&r, buffer, bytes);
- for(i = 0; i < test2size; i++)
- {
- if(oggpackB_look(&r, 32) == -1)report("out of data. failed!");
- if(oggpackB_look(&r, 32) != large[i])
- {
- fprintf(stderr, "%ld != %ld (%lx!=%lx):", oggpackB_look(&r, 32), large[i],
- oggpackB_look(&r, 32), large[i]);
- report("read incorrect value!\n");
- }
- oggpackB_adv(&r, 32);
- }
- if(oggpackB_bytes(&r) != bytes)report("leftover bytes after read!\n");
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSmall unclipped packing (MSb): ");
- cliptestB(testbuffer1, test1size, 7, fourB, foursize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nLarge unclipped packing (MSb): ");
- cliptestB(testbuffer2, test2size, 17, fiveB, fivesize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nSingle bit unclipped packing (MSb): ");
- cliptestB(testbuffer3, test3size, 1, sixB, sixsize);
- fprintf(stderr, "ok.");
-
- fprintf(stderr, "\nTesting read past end (MSb): ");
- oggpackB_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- for(i = 0; i < 64; i++)
- {
- if(oggpackB_read(&r, 1) != 0)
- {
- fprintf(stderr, "failed; got -1 prematurely.\n");
- exit(1);
- }
- }
- if(oggpackB_look(&r, 1) != -1 ||
- oggpackB_read(&r, 1) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpackB_readinit(&r, "\0\0\0\0\0\0\0\0", 8);
- if(oggpackB_read(&r, 30) != 0 || oggpackB_read(&r, 16) != 0)
- {
- fprintf(stderr, "failed 2; got -1 prematurely.\n");
- exit(1);
- }
-
- if(oggpackB_look(&r, 18) != 0 ||
- oggpackB_look(&r, 18) != 0)
- {
- fprintf(stderr, "failed 3; got -1 prematurely.\n");
- exit(1);
- }
- if(oggpackB_look(&r, 19) != -1 ||
- oggpackB_look(&r, 19) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- if(oggpackB_look(&r, 32) != -1 ||
- oggpackB_look(&r, 32) != -1)
- {
- fprintf(stderr, "failed; read past end without -1.\n");
- exit(1);
- }
- oggpackB_writeclear(&o);
- fprintf(stderr, "ok.\n\n");
-
-
- return(0);
-}
+void report(char *in){
+ fprintf(stderr,"%s",in);
+ exit(1);
+}
+
+void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){
+ long bytes,i;
+ unsigned char *buffer;
+
+ oggpack_reset(&o);
+ for(i=0;i<vals;i++)
+ oggpack_write(&o,b[i],bits?bits:ilog(b[i]));
+ buffer=oggpack_get_buffer(&o);
+ bytes=oggpack_bytes(&o);
+ if(bytes!=compsize)report("wrong number of bytes!\n");
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
+ report("wrote incorrect value!\n");
+ }
+ oggpack_readinit(&r,buffer,bytes);
+ for(i=0;i<vals;i++){
+ int tbit=bits?bits:ilog(b[i]);
+ if(oggpack_look(&r,tbit)==-1)
+ report("out of data!\n");
+ if(oggpack_look(&r,tbit)!=(b[i]&mask[tbit]))
+ report("looked at incorrect value!\n");
+ if(tbit==1)
+ if(oggpack_look1(&r)!=(b[i]&mask[tbit]))
+ report("looked at single bit incorrect value!\n");
+ if(tbit==1){
+ if(oggpack_read1(&r)!=(b[i]&mask[tbit]))
+ report("read incorrect single bit value!\n");
+ }else{
+ if(oggpack_read(&r,tbit)!=(b[i]&mask[tbit]))
+ report("read incorrect value!\n");
+ }
+ }
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+}
+
+void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){
+ long bytes,i;
+ unsigned char *buffer;
+
+ oggpackB_reset(&o);
+ for(i=0;i<vals;i++)
+ oggpackB_write(&o,b[i],bits?bits:ilog(b[i]));
+ buffer=oggpackB_get_buffer(&o);
+ bytes=oggpackB_bytes(&o);
+ if(bytes!=compsize)report("wrong number of bytes!\n");
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
+ report("wrote incorrect value!\n");
+ }
+ oggpackB_readinit(&r,buffer,bytes);
+ for(i=0;i<vals;i++){
+ int tbit=bits?bits:ilog(b[i]);
+ if(oggpackB_look(&r,tbit)==-1)
+ report("out of data!\n");
+ if(oggpackB_look(&r,tbit)!=(b[i]&mask[tbit]))
+ report("looked at incorrect value!\n");
+ if(tbit==1)
+ if(oggpackB_look1(&r)!=(b[i]&mask[tbit]))
+ report("looked at single bit incorrect value!\n");
+ if(tbit==1){
+ if(oggpackB_read1(&r)!=(b[i]&mask[tbit]))
+ report("read incorrect single bit value!\n");
+ }else{
+ if(oggpackB_read(&r,tbit)!=(b[i]&mask[tbit]))
+ report("read incorrect value!\n");
+ }
+ }
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+}
+
+int main(void){
+ unsigned char *buffer;
+ long bytes,i;
+ static unsigned long testbuffer1[]=
+ {18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,
+ 567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};
+ int test1size=43;
+
+ static unsigned long testbuffer2[]=
+ {216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,
+ 1233432,534,5,346435231,14436467,7869299,76326614,167548585,
+ 85525151,0,12321,1,349528352};
+ int test2size=21;
+
+ static unsigned long testbuffer3[]=
+ {1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,
+ 0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};
+ int test3size=56;
+
+ static unsigned long large[]=
+ {2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,
+ 1233432,534,5,2146435231,14436467,7869299,76326614,167548585,
+ 85525151,0,12321,1,2146528352};
+
+ int onesize=33;
+ static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,
+ 34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,
+ 223,4};
+ static int oneB[33]={150,101,131,33,203,15,204,216,105,193,156,65,84,85,222,
+ 8,139,145,227,126,34,55,244,171,85,100,39,195,173,18,
+ 245,251,128};
+
+ int twosize=6;
+ static int two[6]={61,255,255,251,231,29};
+ static int twoB[6]={247,63,255,253,249,120};
+
+ int threesize=54;
+ static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,
+ 142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,
+ 58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,
+ 100,52,4,14,18,86,77,1};
+ static int threeB[54]={206,128,42,153,57,8,183,251,13,89,36,30,32,144,183,
+ 130,59,240,121,59,85,223,19,228,180,134,33,107,74,98,
+ 233,253,196,135,63,2,110,114,50,155,90,127,37,170,104,
+ 200,20,254,4,58,106,176,144,0};
+
+ int foursize=38;
+ static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,
+ 132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,
+ 28,2,133,0,1};
+ static int fourB[38]={36,48,102,83,243,24,52,7,4,35,132,10,145,21,2,93,2,41,
+ 1,219,184,16,33,184,54,149,170,132,18,30,29,98,229,67,
+ 129,10,4,32};
+
+ int fivesize=45;
+ static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,
+ 241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,
+ 84,75,159,2,1,0,132,192,8,0,0,18,22};
+ static int fiveB[45]={1,84,145,111,245,100,128,8,56,36,40,71,126,78,213,226,
+ 124,105,12,0,133,128,0,162,233,242,67,152,77,205,77,
+ 172,150,169,129,79,128,0,6,4,32,0,27,9,0};
+
+ int sixsize=7;
+ static int six[7]={17,177,170,242,169,19,148};
+ static int sixB[7]={136,141,85,79,149,200,41};
+
+ /* Test read/write together */
+ /* Later we test against pregenerated bitstreams */
+ oggpack_writeinit(&o);
+
+ fprintf(stderr,"\nSmall preclipped packing (LSb): ");
+ cliptest(testbuffer1,test1size,0,one,onesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nNull bit call (LSb): ");
+ cliptest(testbuffer3,test3size,0,two,twosize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge preclipped packing (LSb): ");
+ cliptest(testbuffer2,test2size,0,three,threesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\n32 bit preclipped packing (LSb): ");
+ oggpack_reset(&o);
+ for(i=0;i<test2size;i++)
+ oggpack_write(&o,large[i],32);
+ buffer=oggpack_get_buffer(&o);
+ bytes=oggpack_bytes(&o);
+ oggpack_readinit(&r,buffer,bytes);
+ for(i=0;i<test2size;i++){
+ if(oggpack_look(&r,32)==-1)report("out of data. failed!");
+ if(oggpack_look(&r,32)!=large[i]){
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r,32),large[i],
+ oggpack_look(&r,32),large[i]);
+ report("read incorrect value!\n");
+ }
+ oggpack_adv(&r,32);
+ }
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSmall unclipped packing (LSb): ");
+ cliptest(testbuffer1,test1size,7,four,foursize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge unclipped packing (LSb): ");
+ cliptest(testbuffer2,test2size,17,five,fivesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSingle bit unclipped packing (LSb): ");
+ cliptest(testbuffer3,test3size,1,six,sixsize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nTesting read past end (LSb): ");
+ oggpack_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ for(i=0;i<64;i++){
+ if(oggpack_read(&r,1)!=0){
+ fprintf(stderr,"failed; got -1 prematurely.\n");
+ exit(1);
+ }
+ }
+ if(oggpack_look(&r,1)!=-1 ||
+ oggpack_read(&r,1)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpack_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ if(oggpack_read(&r,30)!=0 || oggpack_read(&r,16)!=0){
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
+ exit(1);
+ }
+
+ if(oggpack_look(&r,18)!=0 ||
+ oggpack_look(&r,18)!=0){
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
+ exit(1);
+ }
+ if(oggpack_look(&r,19)!=-1 ||
+ oggpack_look(&r,19)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ if(oggpack_look(&r,32)!=-1 ||
+ oggpack_look(&r,32)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpack_writeclear(&o);
+ fprintf(stderr,"ok.\n");
+
+ /********** lazy, cut-n-paste retest with MSb packing ***********/
+
+ /* Test read/write together */
+ /* Later we test against pregenerated bitstreams */
+ oggpackB_writeinit(&o);
+
+ fprintf(stderr,"\nSmall preclipped packing (MSb): ");
+ cliptestB(testbuffer1,test1size,0,oneB,onesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nNull bit call (MSb): ");
+ cliptestB(testbuffer3,test3size,0,twoB,twosize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge preclipped packing (MSb): ");
+ cliptestB(testbuffer2,test2size,0,threeB,threesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\n32 bit preclipped packing (MSb): ");
+ oggpackB_reset(&o);
+ for(i=0;i<test2size;i++)
+ oggpackB_write(&o,large[i],32);
+ buffer=oggpackB_get_buffer(&o);
+ bytes=oggpackB_bytes(&o);
+ oggpackB_readinit(&r,buffer,bytes);
+ for(i=0;i<test2size;i++){
+ if(oggpackB_look(&r,32)==-1)report("out of data. failed!");
+ if(oggpackB_look(&r,32)!=large[i]){
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpackB_look(&r,32),large[i],
+ oggpackB_look(&r,32),large[i]);
+ report("read incorrect value!\n");
+ }
+ oggpackB_adv(&r,32);
+ }
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSmall unclipped packing (MSb): ");
+ cliptestB(testbuffer1,test1size,7,fourB,foursize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge unclipped packing (MSb): ");
+ cliptestB(testbuffer2,test2size,17,fiveB,fivesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSingle bit unclipped packing (MSb): ");
+ cliptestB(testbuffer3,test3size,1,sixB,sixsize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nTesting read past end (MSb): ");
+ oggpackB_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ for(i=0;i<64;i++){
+ if(oggpackB_read(&r,1)!=0){
+ fprintf(stderr,"failed; got -1 prematurely.\n");
+ exit(1);
+ }
+ }
+ if(oggpackB_look(&r,1)!=-1 ||
+ oggpackB_read(&r,1)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpackB_readinit(&r,"\0\0\0\0\0\0\0\0",8);
+ if(oggpackB_read(&r,30)!=0 || oggpackB_read(&r,16)!=0){
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
+ exit(1);
+ }
+
+ if(oggpackB_look(&r,18)!=0 ||
+ oggpackB_look(&r,18)!=0){
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
+ exit(1);
+ }
+ if(oggpackB_look(&r,19)!=-1 ||
+ oggpackB_look(&r,19)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ if(oggpackB_look(&r,32)!=-1 ||
+ oggpackB_look(&r,32)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpackB_writeclear(&o);
+ fprintf(stderr,"ok.\n\n");
+
+
+ return(0);
+}
#endif /* _V_SELFTEST */
#undef BUFFER_INCREMENT
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/block.c b/src/filters/transform/MpaDecFilter/libvorbisidec/block.c
index f93a50bf4..58f7fc7ef 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/block.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/block.c
@@ -31,16 +31,14 @@
#include "registry.h"
#include "misc.h"
-static int ilog2(unsigned int v)
-{
- int ret = 0;
- if(v)--v;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog2(unsigned int v){
+ int ret=0;
+ if(v)--v;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
/* pcm accumulator examples (not exhaustive):
@@ -87,546 +85,486 @@ static int ilog2(unsigned int v)
#define WORD_ALIGN 8
#endif
-int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb)
-{
- int i;
- memset(vb, 0, sizeof(*vb));
- vb->vd = v;
- vb->localalloc = 0;
- vb->localstore = NULL;
- if(v->analysisp)
- {
- vorbis_block_internal *vbi =
- vb->internal = _ogg_calloc(1, sizeof(vorbis_block_internal));
- vbi->ampmax = -9999;
-
- for(i = 0; i < PACKETBLOBS; i++)
- {
- if(i == PACKETBLOBS / 2)
- {
- vbi->packetblob[i] = &vb->opb;
- }
- else
- {
- vbi->packetblob[i] =
- _ogg_calloc(1, sizeof(oggpack_buffer));
- }
- oggpack_writeinit(vbi->packetblob[i]);
- }
- }
-
- return(0);
+int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
+ int i;
+ memset(vb,0,sizeof(*vb));
+ vb->vd=v;
+ vb->localalloc=0;
+ vb->localstore=NULL;
+ if(v->analysisp){
+ vorbis_block_internal *vbi=
+ vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal));
+ vbi->ampmax=-9999;
+
+ for(i=0;i<PACKETBLOBS;i++){
+ if(i==PACKETBLOBS/2){
+ vbi->packetblob[i]=&vb->opb;
+ }else{
+ vbi->packetblob[i]=
+ _ogg_calloc(1,sizeof(oggpack_buffer));
+ }
+ oggpack_writeinit(vbi->packetblob[i]);
+ }
+ }
+
+ return(0);
}
-void *_vorbis_block_alloc(vorbis_block *vb, long bytes)
-{
- bytes = (bytes + (WORD_ALIGN - 1)) & ~(WORD_ALIGN - 1);
- if(bytes + vb->localtop > vb->localalloc)
- {
- /* can't just _ogg_realloc... there are outstanding pointers */
- if(vb->localstore)
- {
- struct alloc_chain *link = _ogg_malloc(sizeof(*link));
- vb->totaluse += vb->localtop;
- link->next = vb->reap;
- link->ptr = vb->localstore;
- vb->reap = link;
- }
- /* highly conservative */
- vb->localalloc = bytes;
- vb->localstore = _ogg_malloc(vb->localalloc);
- vb->localtop = 0;
- }
- {
- void *ret = (void *)(((char *)vb->localstore) + vb->localtop);
- vb->localtop += bytes;
- return ret;
- }
+void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
+ bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
+ if(bytes+vb->localtop>vb->localalloc){
+ /* can't just _ogg_realloc... there are outstanding pointers */
+ if(vb->localstore){
+ struct alloc_chain *link=_ogg_malloc(sizeof(*link));
+ vb->totaluse+=vb->localtop;
+ link->next=vb->reap;
+ link->ptr=vb->localstore;
+ vb->reap=link;
+ }
+ /* highly conservative */
+ vb->localalloc=bytes;
+ vb->localstore=_ogg_malloc(vb->localalloc);
+ vb->localtop=0;
+ }
+ {
+ void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
+ vb->localtop+=bytes;
+ return ret;
+ }
}
/* reap the chain, pull the ripcord */
-void _vorbis_block_ripcord(vorbis_block *vb)
-{
- /* reap the chain */
- struct alloc_chain *reap = vb->reap;
- while(reap)
- {
- struct alloc_chain *next = reap->next;
- _ogg_free(reap->ptr);
- memset(reap, 0, sizeof(*reap));
- _ogg_free(reap);
- reap = next;
- }
- /* consolidate storage */
- if(vb->totaluse)
- {
- vb->localstore = _ogg_realloc(vb->localstore, vb->totaluse + vb->localalloc);
- vb->localalloc += vb->totaluse;
- vb->totaluse = 0;
- }
-
- /* pull the ripcord */
- vb->localtop = 0;
- vb->reap = NULL;
+void _vorbis_block_ripcord(vorbis_block *vb){
+ /* reap the chain */
+ struct alloc_chain *reap=vb->reap;
+ while(reap){
+ struct alloc_chain *next=reap->next;
+ _ogg_free(reap->ptr);
+ memset(reap,0,sizeof(*reap));
+ _ogg_free(reap);
+ reap=next;
+ }
+ /* consolidate storage */
+ if(vb->totaluse){
+ vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
+ vb->localalloc+=vb->totaluse;
+ vb->totaluse=0;
+ }
+
+ /* pull the ripcord */
+ vb->localtop=0;
+ vb->reap=NULL;
}
-int vorbis_block_clear(vorbis_block *vb)
-{
- int i;
- vorbis_block_internal *vbi = vb->internal;
+int vorbis_block_clear(vorbis_block *vb){
+ int i;
+ vorbis_block_internal *vbi=vb->internal;
- _vorbis_block_ripcord(vb);
- if(vb->localstore)_ogg_free(vb->localstore);
+ _vorbis_block_ripcord(vb);
+ if(vb->localstore)_ogg_free(vb->localstore);
- if(vbi)
- {
- for(i = 0; i < PACKETBLOBS; i++)
- {
- oggpack_writeclear(vbi->packetblob[i]);
- if(i != PACKETBLOBS / 2)_ogg_free(vbi->packetblob[i]);
- }
- _ogg_free(vbi);
+ if(vbi){
+ for(i=0;i<PACKETBLOBS;i++){
+ oggpack_writeclear(vbi->packetblob[i]);
+ if(i!=PACKETBLOBS/2)_ogg_free(vbi->packetblob[i]);
}
- memset(vb, 0, sizeof(*vb));
- return(0);
+ _ogg_free(vbi);
+ }
+ memset(vb,0,sizeof(*vb));
+ return(0);
}
/* Analysis side code, but directly related to blocking. Thus it's
here and not in analysis.c (which is for analysis transforms only).
The init is here because some of it is shared */
-static int _vds_shared_init(vorbis_dsp_state *v, vorbis_info *vi, int encp)
-{
+static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
+ int i;
+ codec_setup_info *ci=vi->codec_setup;
+ private_state *b=NULL;
+ int hs;
+
+ if(ci==NULL) return 1;
+ hs=ci->halfrate_flag;
+
+ memset(v,0,sizeof(*v));
+ b=v->backend_state=_ogg_calloc(1,sizeof(*b));
+
+ v->vi=vi;
+ b->modebits=ilog2(ci->modes);
+
+ b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0]));
+ b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1]));
+
+ /* MDCT is tranform 0 */
+
+ b->transform[0][0]=_ogg_calloc(1,sizeof(mdct_lookup));
+ b->transform[1][0]=_ogg_calloc(1,sizeof(mdct_lookup));
+ mdct_init(b->transform[0][0],ci->blocksizes[0]>>hs);
+ mdct_init(b->transform[1][0],ci->blocksizes[1]>>hs);
+
+ /* Vorbis I uses only window type 0 */
+ b->window[0]=ilog2(ci->blocksizes[0])-6;
+ b->window[1]=ilog2(ci->blocksizes[1])-6;
+
+ if(encp){ /* encode/decode differ here */
+
+ /* analysis always needs an fft */
+ drft_init(&b->fft_look[0],ci->blocksizes[0]);
+ drft_init(&b->fft_look[1],ci->blocksizes[1]);
+
+ /* finish the codebooks */
+ if(!ci->fullbooks){
+ ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
+ for(i=0;i<ci->books;i++)
+ vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]);
+ }
+
+ b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy));
+ for(i=0;i<ci->psys;i++){
+ _vp_psy_init(b->psy+i,
+ ci->psy_param[i],
+ &ci->psy_g_param,
+ ci->blocksizes[ci->psy_param[i]->blockflag]/2,
+ vi->rate);
+ }
+
+ v->analysisp=1;
+ }else{
+ /* finish the codebooks */
+ if(!ci->fullbooks)
+ ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
+ for(i=0;i<ci->books;i++){
+ if(ci->book_param[i]==NULL)
+ goto abort_books;
+ if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
+ goto abort_books;
+ /* decode codebooks are now standalone after init */
+ vorbis_staticbook_destroy(ci->book_param[i]);
+ ci->book_param[i]=NULL;
+ }
+ }
+
+ /* initialize the storage vectors. blocksize[1] is small for encode,
+ but the correct size for decode */
+ v->pcm_storage=ci->blocksizes[1];
+ v->pcm=_ogg_malloc(vi->channels*sizeof(*v->pcm));
+ v->pcmret=_ogg_malloc(vi->channels*sizeof(*v->pcmret));
+ {
int i;
- codec_setup_info *ci = vi->codec_setup;
- private_state *b = NULL;
- int hs;
-
- if(ci == NULL) return 1;
- hs = ci->halfrate_flag;
-
- memset(v, 0, sizeof(*v));
- b = v->backend_state = _ogg_calloc(1, sizeof(*b));
-
- v->vi = vi;
- b->modebits = ilog2(ci->modes);
-
- b->transform[0] = _ogg_calloc(VI_TRANSFORMB, sizeof(*b->transform[0]));
- b->transform[1] = _ogg_calloc(VI_TRANSFORMB, sizeof(*b->transform[1]));
-
- /* MDCT is tranform 0 */
-
- b->transform[0][0] = _ogg_calloc(1, sizeof(mdct_lookup));
- b->transform[1][0] = _ogg_calloc(1, sizeof(mdct_lookup));
- mdct_init(b->transform[0][0], ci->blocksizes[0] >> hs);
- mdct_init(b->transform[1][0], ci->blocksizes[1] >> hs);
-
- /* Vorbis I uses only window type 0 */
- b->window[0] = ilog2(ci->blocksizes[0]) - 6;
- b->window[1] = ilog2(ci->blocksizes[1]) - 6;
-
- if(encp) /* encode/decode differ here */
- {
-
- /* analysis always needs an fft */
- drft_init(&b->fft_look[0], ci->blocksizes[0]);
- drft_init(&b->fft_look[1], ci->blocksizes[1]);
-
- /* finish the codebooks */
- if(!ci->fullbooks)
- {
- ci->fullbooks = _ogg_calloc(ci->books, sizeof(*ci->fullbooks));
- for(i = 0; i < ci->books; i++)
- vorbis_book_init_encode(ci->fullbooks + i, ci->book_param[i]);
- }
-
- b->psy = _ogg_calloc(ci->psys, sizeof(*b->psy));
- for(i = 0; i < ci->psys; i++)
- {
- _vp_psy_init(b->psy + i,
- ci->psy_param[i],
- &ci->psy_g_param,
- ci->blocksizes[ci->psy_param[i]->blockflag] / 2,
- vi->rate);
- }
-
- v->analysisp = 1;
- }
- else
- {
- /* finish the codebooks */
- if(!ci->fullbooks)
- ci->fullbooks = _ogg_calloc(ci->books, sizeof(*ci->fullbooks));
- for(i = 0; i < ci->books; i++)
- {
- if(ci->book_param[i] == NULL)
- goto abort_books;
- if(vorbis_book_init_decode(ci->fullbooks + i, ci->book_param[i]))
- goto abort_books;
- /* decode codebooks are now standalone after init */
- vorbis_staticbook_destroy(ci->book_param[i]);
- ci->book_param[i] = NULL;
- }
- }
-
- /* initialize the storage vectors. blocksize[1] is small for encode,
- but the correct size for decode */
- v->pcm_storage = ci->blocksizes[1];
- v->pcm = _ogg_malloc(vi->channels * sizeof(*v->pcm));
- v->pcmret = _ogg_malloc(vi->channels * sizeof(*v->pcmret));
- {
- int i;
- for(i = 0; i < vi->channels; i++)
- v->pcm[i] = _ogg_calloc(v->pcm_storage, sizeof(*v->pcm[i]));
- }
-
- /* all 1 (large block) or 0 (small block) */
- /* explicitly set for the sake of clarity */
- v->lW = 0; /* previous window size */
- v->W = 0; /* current window size */
-
- /* all vector indexes */
- v->centerW = ci->blocksizes[1] / 2;
-
- v->pcm_current = v->centerW;
-
- /* initialize all the backend lookups */
- b->flr = _ogg_calloc(ci->floors, sizeof(*b->flr));
- b->residue = _ogg_calloc(ci->residues, sizeof(*b->residue));
-
- for(i = 0; i < ci->floors; i++)
- b->flr[i] = _floor_P[ci->floor_type[i]]->
- look(v, ci->floor_param[i]);
-
- for(i = 0; i < ci->residues; i++)
- b->residue[i] = _residue_P[ci->residue_type[i]]->
- look(v, ci->residue_param[i]);
-
- return 0;
-abort_books:
- for(i = 0; i < ci->books; i++)
- {
- if(ci->book_param[i] != NULL)
- {
- vorbis_staticbook_destroy(ci->book_param[i]);
- ci->book_param[i] = NULL;
- }
- }
- vorbis_dsp_clear(v);
- return -1;
+ for(i=0;i<vi->channels;i++)
+ v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
+ }
+
+ /* all 1 (large block) or 0 (small block) */
+ /* explicitly set for the sake of clarity */
+ v->lW=0; /* previous window size */
+ v->W=0; /* current window size */
+
+ /* all vector indexes */
+ v->centerW=ci->blocksizes[1]/2;
+
+ v->pcm_current=v->centerW;
+
+ /* initialize all the backend lookups */
+ b->flr=_ogg_calloc(ci->floors,sizeof(*b->flr));
+ b->residue=_ogg_calloc(ci->residues,sizeof(*b->residue));
+
+ for(i=0;i<ci->floors;i++)
+ b->flr[i]=_floor_P[ci->floor_type[i]]->
+ look(v,ci->floor_param[i]);
+
+ for(i=0;i<ci->residues;i++)
+ b->residue[i]=_residue_P[ci->residue_type[i]]->
+ look(v,ci->residue_param[i]);
+
+ return 0;
+ abort_books:
+ for(i=0;i<ci->books;i++){
+ if(ci->book_param[i]!=NULL){
+ vorbis_staticbook_destroy(ci->book_param[i]);
+ ci->book_param[i]=NULL;
+ }
+ }
+ vorbis_dsp_clear(v);
+ return -1;
}
/* arbitrary settings and spec-mandated numbers get filled in here */
-int vorbis_analysis_init(vorbis_dsp_state *v, vorbis_info *vi)
-{
- private_state *b = NULL;
+int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){
+ private_state *b=NULL;
- if(_vds_shared_init(v, vi, 1))return 1;
- b = v->backend_state;
- b->psy_g_look = _vp_global_look(vi);
+ if(_vds_shared_init(v,vi,1))return 1;
+ b=v->backend_state;
+ b->psy_g_look=_vp_global_look(vi);
- /* Initialize the envelope state storage */
- b->ve = _ogg_calloc(1, sizeof(*b->ve));
- _ve_envelope_init(b->ve, vi);
+ /* Initialize the envelope state storage */
+ b->ve=_ogg_calloc(1,sizeof(*b->ve));
+ _ve_envelope_init(b->ve,vi);
- vorbis_bitrate_init(vi, &b->bms);
+ vorbis_bitrate_init(vi,&b->bms);
- /* compressed audio packets start after the headers
- with sequence number 3 */
- v->sequence = 3;
+ /* compressed audio packets start after the headers
+ with sequence number 3 */
+ v->sequence=3;
- return(0);
+ return(0);
}
-void vorbis_dsp_clear(vorbis_dsp_state *v)
-{
- int i;
- if(v)
- {
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = (vi ? vi->codec_setup : NULL);
- private_state *b = v->backend_state;
-
- if(b)
- {
-
- if(b->ve)
- {
- _ve_envelope_clear(b->ve);
- _ogg_free(b->ve);
- }
-
- if(b->transform[0])
- {
- mdct_clear(b->transform[0][0]);
- _ogg_free(b->transform[0][0]);
- _ogg_free(b->transform[0]);
- }
- if(b->transform[1])
- {
- mdct_clear(b->transform[1][0]);
- _ogg_free(b->transform[1][0]);
- _ogg_free(b->transform[1]);
- }
-
- if(b->flr)
- {
- if(ci)
- for(i = 0; i < ci->floors; i++)
- _floor_P[ci->floor_type[i]]->
- free_look(b->flr[i]);
- _ogg_free(b->flr);
- }
- if(b->residue)
- {
- if(ci)
- for(i = 0; i < ci->residues; i++)
- _residue_P[ci->residue_type[i]]->
- free_look(b->residue[i]);
- _ogg_free(b->residue);
- }
- if(b->psy)
- {
- if(ci)
- for(i = 0; i < ci->psys; i++)
- _vp_psy_clear(b->psy + i);
- _ogg_free(b->psy);
- }
-
- if(b->psy_g_look)_vp_global_free(b->psy_g_look);
- vorbis_bitrate_clear(&b->bms);
-
- drft_clear(&b->fft_look[0]);
- drft_clear(&b->fft_look[1]);
+void vorbis_dsp_clear(vorbis_dsp_state *v){
+ int i;
+ if(v){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=(vi?vi->codec_setup:NULL);
+ private_state *b=v->backend_state;
+
+ if(b){
+
+ if(b->ve){
+ _ve_envelope_clear(b->ve);
+ _ogg_free(b->ve);
+ }
+
+ if(b->transform[0]){
+ mdct_clear(b->transform[0][0]);
+ _ogg_free(b->transform[0][0]);
+ _ogg_free(b->transform[0]);
+ }
+ if(b->transform[1]){
+ mdct_clear(b->transform[1][0]);
+ _ogg_free(b->transform[1][0]);
+ _ogg_free(b->transform[1]);
+ }
+
+ if(b->flr){
+ if(ci)
+ for(i=0;i<ci->floors;i++)
+ _floor_P[ci->floor_type[i]]->
+ free_look(b->flr[i]);
+ _ogg_free(b->flr);
+ }
+ if(b->residue){
+ if(ci)
+ for(i=0;i<ci->residues;i++)
+ _residue_P[ci->residue_type[i]]->
+ free_look(b->residue[i]);
+ _ogg_free(b->residue);
+ }
+ if(b->psy){
+ if(ci)
+ for(i=0;i<ci->psys;i++)
+ _vp_psy_clear(b->psy+i);
+ _ogg_free(b->psy);
+ }
+
+ if(b->psy_g_look)_vp_global_free(b->psy_g_look);
+ vorbis_bitrate_clear(&b->bms);
+
+ drft_clear(&b->fft_look[0]);
+ drft_clear(&b->fft_look[1]);
+
+ }
+
+ if(v->pcm){
+ if(vi)
+ for(i=0;i<vi->channels;i++)
+ if(v->pcm[i])_ogg_free(v->pcm[i]);
+ _ogg_free(v->pcm);
+ if(v->pcmret)_ogg_free(v->pcmret);
+ }
+
+ if(b){
+ /* free header, header1, header2 */
+ if(b->header)_ogg_free(b->header);
+ if(b->header1)_ogg_free(b->header1);
+ if(b->header2)_ogg_free(b->header2);
+ _ogg_free(b);
+ }
+
+ memset(v,0,sizeof(*v));
+ }
+}
- }
+float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
+ int i;
+ vorbis_info *vi=v->vi;
+ private_state *b=v->backend_state;
- if(v->pcm)
- {
- if(vi)
- for(i = 0; i < vi->channels; i++)
- if(v->pcm[i])_ogg_free(v->pcm[i]);
- _ogg_free(v->pcm);
- if(v->pcmret)_ogg_free(v->pcmret);
- }
+ /* free header, header1, header2 */
+ if(b->header)_ogg_free(b->header);b->header=NULL;
+ if(b->header1)_ogg_free(b->header1);b->header1=NULL;
+ if(b->header2)_ogg_free(b->header2);b->header2=NULL;
- if(b)
- {
- /* free header, header1, header2 */
- if(b->header)_ogg_free(b->header);
- if(b->header1)_ogg_free(b->header1);
- if(b->header2)_ogg_free(b->header2);
- _ogg_free(b);
- }
+ /* Do we have enough storage space for the requested buffer? If not,
+ expand the PCM (and envelope) storage */
- memset(v, 0, sizeof(*v));
- }
-}
+ if(v->pcm_current+vals>=v->pcm_storage){
+ v->pcm_storage=v->pcm_current+vals*2;
-float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals)
-{
- int i;
- vorbis_info *vi = v->vi;
- private_state *b = v->backend_state;
-
- /* free header, header1, header2 */
- if(b->header)_ogg_free(b->header);
- b->header = NULL;
- if(b->header1)_ogg_free(b->header1);
- b->header1 = NULL;
- if(b->header2)_ogg_free(b->header2);
- b->header2 = NULL;
-
- /* Do we have enough storage space for the requested buffer? If not,
- expand the PCM (and envelope) storage */
-
- if(v->pcm_current + vals >= v->pcm_storage)
- {
- v->pcm_storage = v->pcm_current + vals * 2;
-
- for(i = 0; i < vi->channels; i++)
- {
- v->pcm[i] = _ogg_realloc(v->pcm[i], v->pcm_storage * sizeof(*v->pcm[i]));
- }
+ for(i=0;i<vi->channels;i++){
+ v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i]));
}
+ }
- for(i = 0; i < vi->channels; i++)
- v->pcmret[i] = v->pcm[i] + v->pcm_current;
+ for(i=0;i<vi->channels;i++)
+ v->pcmret[i]=v->pcm[i]+v->pcm_current;
- return(v->pcmret);
+ return(v->pcmret);
}
-static void _preextrapolate_helper(vorbis_dsp_state *v)
-{
- int i;
- int order = 16;
- float *lpc = alloca(order * sizeof(*lpc));
- float *work = alloca(v->pcm_current * sizeof(*work));
- long j;
- v->preextrapolate = 1;
-
- if(v->pcm_current - v->centerW > order * 2) /* safety */
- {
- for(i = 0; i < v->vi->channels; i++)
- {
- /* need to run the extrapolation in reverse! */
- for(j = 0; j < v->pcm_current; j++)
- work[j] = v->pcm[i][v->pcm_current-j-1];
-
- /* prime as above */
- vorbis_lpc_from_data(work, lpc, v->pcm_current - v->centerW, order);
+static void _preextrapolate_helper(vorbis_dsp_state *v){
+ int i;
+ int order=16;
+ float *lpc=alloca(order*sizeof(*lpc));
+ float *work=alloca(v->pcm_current*sizeof(*work));
+ long j;
+ v->preextrapolate=1;
+
+ if(v->pcm_current-v->centerW>order*2){ /* safety */
+ for(i=0;i<v->vi->channels;i++){
+ /* need to run the extrapolation in reverse! */
+ for(j=0;j<v->pcm_current;j++)
+ work[j]=v->pcm[i][v->pcm_current-j-1];
+
+ /* prime as above */
+ vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
#if 0
- if(v->vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("predataL", 0, work, v->pcm_current - v->centerW, 0, 0, 0);
- else
- _analysis_output("predataR", 0, work, v->pcm_current - v->centerW, 0, 0, 0);
- }
- else
- {
- _analysis_output("predata", 0, work, v->pcm_current - v->centerW, 0, 0, 0);
- }
+ if(v->vi->channels==2){
+ if(i==0)
+ _analysis_output("predataL",0,work,v->pcm_current-v->centerW,0,0,0);
+ else
+ _analysis_output("predataR",0,work,v->pcm_current-v->centerW,0,0,0);
+ }else{
+ _analysis_output("predata",0,work,v->pcm_current-v->centerW,0,0,0);
+ }
#endif
- /* run the predictor filter */
- vorbis_lpc_predict(lpc, work + v->pcm_current - v->centerW - order,
- order,
- work + v->pcm_current - v->centerW,
- v->centerW);
+ /* run the predictor filter */
+ vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
+ order,
+ work+v->pcm_current-v->centerW,
+ v->centerW);
- for(j = 0; j < v->pcm_current; j++)
- v->pcm[i][v->pcm_current-j-1] = work[j];
+ for(j=0;j<v->pcm_current;j++)
+ v->pcm[i][v->pcm_current-j-1]=work[j];
- }
}
+ }
}
/* call with val<=0 to set eof */
-int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals)
-{
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
-
- if(vals <= 0)
- {
- int order = 32;
- int i;
- float *lpc = alloca(order * sizeof(*lpc));
-
- /* if it wasn't done earlier (very short sample) */
- if(!v->preextrapolate)
- _preextrapolate_helper(v);
-
- /* We're encoding the end of the stream. Just make sure we have
- [at least] a few full blocks of zeroes at the end. */
- /* actually, we don't want zeroes; that could drop a large
- amplitude off a cliff, creating spread spectrum noise that will
- suck to encode. Extrapolate for the sake of cleanliness. */
-
- vorbis_analysis_buffer(v, ci->blocksizes[1] * 3);
- v->eofflag = v->pcm_current;
- v->pcm_current += ci->blocksizes[1] * 3;
-
- for(i = 0; i < vi->channels; i++)
- {
- if(v->eofflag > order * 2)
- {
- /* extrapolate with LPC to fill in */
- long n;
-
- /* make a predictor filter */
- n = v->eofflag;
- if(n > ci->blocksizes[1])n = ci->blocksizes[1];
- vorbis_lpc_from_data(v->pcm[i] + v->eofflag - n, lpc, n, order);
-
- /* run the predictor filter */
- vorbis_lpc_predict(lpc, v->pcm[i] + v->eofflag - order, order,
- v->pcm[i] + v->eofflag, v->pcm_current - v->eofflag);
- }
- else
- {
- /* not enough data to extrapolate (unlikely to happen due to
- guarding the overlap, but bulletproof in case that
- assumtion goes away). zeroes will do. */
- memset(v->pcm[i] + v->eofflag, 0,
- (v->pcm_current - v->eofflag)*sizeof(*v->pcm[i]));
-
- }
- }
- }
- else
- {
-
- if(v->pcm_current + vals > v->pcm_storage)
- return(OV_EINVAL);
+int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
- v->pcm_current += vals;
-
- /* we may want to reverse extrapolate the beginning of a stream
- too... in case we're beginning on a cliff! */
- /* clumsy, but simple. It only runs once, so simple is good. */
- if(!v->preextrapolate && v->pcm_current - v->centerW > ci->blocksizes[1])
- _preextrapolate_helper(v);
-
- }
- return(0);
+ if(vals<=0){
+ int order=32;
+ int i;
+ float *lpc=alloca(order*sizeof(*lpc));
+
+ /* if it wasn't done earlier (very short sample) */
+ if(!v->preextrapolate)
+ _preextrapolate_helper(v);
+
+ /* We're encoding the end of the stream. Just make sure we have
+ [at least] a few full blocks of zeroes at the end. */
+ /* actually, we don't want zeroes; that could drop a large
+ amplitude off a cliff, creating spread spectrum noise that will
+ suck to encode. Extrapolate for the sake of cleanliness. */
+
+ vorbis_analysis_buffer(v,ci->blocksizes[1]*3);
+ v->eofflag=v->pcm_current;
+ v->pcm_current+=ci->blocksizes[1]*3;
+
+ for(i=0;i<vi->channels;i++){
+ if(v->eofflag>order*2){
+ /* extrapolate with LPC to fill in */
+ long n;
+
+ /* make a predictor filter */
+ n=v->eofflag;
+ if(n>ci->blocksizes[1])n=ci->blocksizes[1];
+ vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
+
+ /* run the predictor filter */
+ vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order,
+ v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag);
+ }else{
+ /* not enough data to extrapolate (unlikely to happen due to
+ guarding the overlap, but bulletproof in case that
+ assumtion goes away). zeroes will do. */
+ memset(v->pcm[i]+v->eofflag,0,
+ (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i]));
+
+ }
+ }
+ }else{
+
+ if(v->pcm_current+vals>v->pcm_storage)
+ return(OV_EINVAL);
+
+ v->pcm_current+=vals;
+
+ /* we may want to reverse extrapolate the beginning of a stream
+ too... in case we're beginning on a cliff! */
+ /* clumsy, but simple. It only runs once, so simple is good. */
+ if(!v->preextrapolate && v->pcm_current-v->centerW>ci->blocksizes[1])
+ _preextrapolate_helper(v);
+
+ }
+ return(0);
}
/* do the deltas, envelope shaping, pre-echo and determine the size of
the next block on which to continue analysis */
-int vorbis_analysis_blockout(vorbis_dsp_state *v, vorbis_block *vb)
-{
- int i;
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
- private_state *b = v->backend_state;
- vorbis_look_psy_global *g = b->psy_g_look;
- long beginW = v->centerW - ci->blocksizes[v->W] / 2, centerNext;
- vorbis_block_internal *vbi = (vorbis_block_internal *)vb->internal;
-
- /* check to see if we're started... */
- if(!v->preextrapolate)return(0);
-
- /* check to see if we're done... */
- if(v->eofflag == -1)return(0);
-
- /* By our invariant, we have lW, W and centerW set. Search for
- the next boundary so we can determine nW (the next window size)
- which lets us compute the shape of the current block's window */
-
- /* we do an envelope search even on a single blocksize; we may still
- be throwing more bits at impulses, and envelope search handles
- marking impulses too. */
- {
- long bp = _ve_envelope_search(v);
- if(bp == -1)
- {
-
- if(v->eofflag == 0)return(0); /* not enough data currently to search for a
+int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
+ int i;
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ private_state *b=v->backend_state;
+ vorbis_look_psy_global *g=b->psy_g_look;
+ long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext;
+ vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
+
+ /* check to see if we're started... */
+ if(!v->preextrapolate)return(0);
+
+ /* check to see if we're done... */
+ if(v->eofflag==-1)return(0);
+
+ /* By our invariant, we have lW, W and centerW set. Search for
+ the next boundary so we can determine nW (the next window size)
+ which lets us compute the shape of the current block's window */
+
+ /* we do an envelope search even on a single blocksize; we may still
+ be throwing more bits at impulses, and envelope search handles
+ marking impulses too. */
+ {
+ long bp=_ve_envelope_search(v);
+ if(bp==-1){
+
+ if(v->eofflag==0)return(0); /* not enough data currently to search for a
full long block */
- v->nW = 0;
- }
- else
- {
+ v->nW=0;
+ }else{
- if(ci->blocksizes[0] == ci->blocksizes[1])
- v->nW = 0;
- else
- v->nW = bp;
- }
+ if(ci->blocksizes[0]==ci->blocksizes[1])
+ v->nW=0;
+ else
+ v->nW=bp;
}
+ }
- centerNext = v->centerW + ci->blocksizes[v->W] / 4 + ci->blocksizes[v->nW] / 4;
+ centerNext=v->centerW+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4;
- {
- /* center of next block + next block maximum right side. */
+ {
+ /* center of next block + next block maximum right side. */
- long blockbound = centerNext + ci->blocksizes[v->nW] / 2;
- if(v->pcm_current < blockbound)return(0); /* not enough data yet;
+ long blockbound=centerNext+ci->blocksizes[v->nW]/2;
+ if(v->pcm_current<blockbound)return(0); /* not enough data yet;
although this check is
less strict that the
_ve_envelope_search,
@@ -635,416 +573,356 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v, vorbis_block *vb)
block size */
- }
-
- /* fill in the block. Note that for a short window, lW and nW are *short*
- regardless of actual settings in the stream */
+ }
- _vorbis_block_ripcord(vb);
- vb->lW = v->lW;
- vb->W = v->W;
- vb->nW = v->nW;
-
- if(v->W)
- {
- if(!v->lW || !v->nW)
- {
- vbi->blocktype = BLOCKTYPE_TRANSITION;
- /*fprintf(stderr,"-");*/
- }
- else
- {
- vbi->blocktype = BLOCKTYPE_LONG;
- /*fprintf(stderr,"_");*/
- }
- }
- else
- {
- if(_ve_envelope_mark(v))
- {
- vbi->blocktype = BLOCKTYPE_IMPULSE;
- /*fprintf(stderr,"|");*/
+ /* fill in the block. Note that for a short window, lW and nW are *short*
+ regardless of actual settings in the stream */
- }
- else
- {
- vbi->blocktype = BLOCKTYPE_PADDING;
- /*fprintf(stderr,".");*/
+ _vorbis_block_ripcord(vb);
+ vb->lW=v->lW;
+ vb->W=v->W;
+ vb->nW=v->nW;
- }
+ if(v->W){
+ if(!v->lW || !v->nW){
+ vbi->blocktype=BLOCKTYPE_TRANSITION;
+ /*fprintf(stderr,"-");*/
+ }else{
+ vbi->blocktype=BLOCKTYPE_LONG;
+ /*fprintf(stderr,"_");*/
}
+ }else{
+ if(_ve_envelope_mark(v)){
+ vbi->blocktype=BLOCKTYPE_IMPULSE;
+ /*fprintf(stderr,"|");*/
- vb->vd = v;
- vb->sequence = v->sequence++;
- vb->granulepos = v->granulepos;
- vb->pcmend = ci->blocksizes[v->W];
-
- /* copy the vectors; this uses the local storage in vb */
-
- /* this tracks 'strongest peak' for later psychoacoustics */
- /* moved to the global psy state; clean this mess up */
- if(vbi->ampmax > g->ampmax)g->ampmax = vbi->ampmax;
- g->ampmax = _vp_ampmax_decay(g->ampmax, v);
- vbi->ampmax = g->ampmax;
-
- vb->pcm = _vorbis_block_alloc(vb, sizeof(*vb->pcm) * vi->channels);
- vbi->pcmdelay = _vorbis_block_alloc(vb, sizeof(*vbi->pcmdelay) * vi->channels);
- for(i = 0; i < vi->channels; i++)
- {
- vbi->pcmdelay[i] =
- _vorbis_block_alloc(vb, (vb->pcmend + beginW) * sizeof(*vbi->pcmdelay[i]));
- memcpy(vbi->pcmdelay[i], v->pcm[i], (vb->pcmend + beginW)*sizeof(*vbi->pcmdelay[i]));
- vb->pcm[i] = vbi->pcmdelay[i] + beginW;
-
- /* before we added the delay
- vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
- memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i]));
- */
-
- }
+ }else{
+ vbi->blocktype=BLOCKTYPE_PADDING;
+ /*fprintf(stderr,".");*/
- /* handle eof detection: eof==0 means that we've not yet received EOF
- eof>0 marks the last 'real' sample in pcm[]
- eof<0 'no more to do'; doesn't get here */
-
- if(v->eofflag)
- {
- if(v->centerW >= v->eofflag)
- {
- v->eofflag = -1;
- vb->eofflag = 1;
- return(1);
- }
}
+ }
- /* advance storage vectors and clean up */
- {
- int new_centerNext = ci->blocksizes[1] / 2;
- int movementW = centerNext - new_centerNext;
-
- if(movementW > 0)
- {
-
- _ve_envelope_shift(b->ve, movementW);
- v->pcm_current -= movementW;
-
- for(i = 0; i < vi->channels; i++)
- memmove(v->pcm[i], v->pcm[i] + movementW,
- v->pcm_current * sizeof(*v->pcm[i]));
-
-
- v->lW = v->W;
- v->W = v->nW;
- v->centerW = new_centerNext;
-
- if(v->eofflag)
- {
- v->eofflag -= movementW;
- if(v->eofflag <= 0)v->eofflag = -1;
- /* do not add padding to end of stream! */
- if(v->centerW >= v->eofflag)
- {
- v->granulepos += movementW - (v->centerW - v->eofflag);
- }
- else
- {
- v->granulepos += movementW;
- }
- }
- else
- {
- v->granulepos += movementW;
- }
- }
- }
+ vb->vd=v;
+ vb->sequence=v->sequence++;
+ vb->granulepos=v->granulepos;
+ vb->pcmend=ci->blocksizes[v->W];
- /* done */
- return(1);
-}
+ /* copy the vectors; this uses the local storage in vb */
-int vorbis_synthesis_restart(vorbis_dsp_state *v)
-{
- vorbis_info *vi = v->vi;
- codec_setup_info *ci;
- int hs;
+ /* this tracks 'strongest peak' for later psychoacoustics */
+ /* moved to the global psy state; clean this mess up */
+ if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax;
+ g->ampmax=_vp_ampmax_decay(g->ampmax,v);
+ vbi->ampmax=g->ampmax;
- if(!v->backend_state)return -1;
- if(!vi)return -1;
- ci = vi->codec_setup;
- if(!ci)return -1;
- hs = ci->halfrate_flag;
+ vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
+ vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels);
+ for(i=0;i<vi->channels;i++){
+ vbi->pcmdelay[i]=
+ _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
+ memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
+ vb->pcm[i]=vbi->pcmdelay[i]+beginW;
- v->centerW = ci->blocksizes[1] >> (hs + 1);
- v->pcm_current = v->centerW >> hs;
+ /* before we added the delay
+ vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
+ memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i]));
+ */
- v->pcm_returned = -1;
- v->granulepos = -1;
- v->sequence = -1;
- v->eofflag = 0;
- ((private_state *)(v->backend_state))->sample_count = -1;
+ }
- return(0);
-}
+ /* handle eof detection: eof==0 means that we've not yet received EOF
+ eof>0 marks the last 'real' sample in pcm[]
+ eof<0 'no more to do'; doesn't get here */
-int vorbis_synthesis_init(vorbis_dsp_state *v, vorbis_info *vi)
-{
- if(_vds_shared_init(v, vi, 0))
- {
- vorbis_dsp_clear(v);
- return 1;
+ if(v->eofflag){
+ if(v->centerW>=v->eofflag){
+ v->eofflag=-1;
+ vb->eofflag=1;
+ return(1);
}
- vorbis_synthesis_restart(v);
- return 0;
-}
-
-/* Unlike in analysis, the window is only partially applied for each
- block. The time domain envelope is not yet handled at the point of
- calling (as it relies on the previous block). */
+ }
-int vorbis_synthesis_blockin(vorbis_dsp_state *v, vorbis_block *vb)
-{
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
- private_state *b = v->backend_state;
- int hs = ci->halfrate_flag;
- int i, j;
-
- if(!vb)return(OV_EINVAL);
- if(v->pcm_current > v->pcm_returned && v->pcm_returned != -1)return(OV_EINVAL);
-
- v->lW = v->W;
- v->W = vb->W;
- v->nW = -1;
-
- if((v->sequence == -1) ||
- (v->sequence + 1 != vb->sequence))
- {
- v->granulepos = -1; /* out of sequence; lose count */
- b->sample_count = -1;
- }
+ /* advance storage vectors and clean up */
+ {
+ int new_centerNext=ci->blocksizes[1]/2;
+ int movementW=centerNext-new_centerNext;
- v->sequence = vb->sequence;
+ if(movementW>0){
- if(vb->pcm)
- {
- /* no pcm to process if vorbis_synthesis_trackonly
- was called on block */
- int n = ci->blocksizes[v->W] >> (hs + 1);
- int n0 = ci->blocksizes[0] >> (hs + 1);
- int n1 = ci->blocksizes[1] >> (hs + 1);
+ _ve_envelope_shift(b->ve,movementW);
+ v->pcm_current-=movementW;
- int thisCenter;
- int prevCenter;
+ for(i=0;i<vi->channels;i++)
+ memmove(v->pcm[i],v->pcm[i]+movementW,
+ v->pcm_current*sizeof(*v->pcm[i]));
- v->glue_bits += vb->glue_bits;
- v->time_bits += vb->time_bits;
- v->floor_bits += vb->floor_bits;
- v->res_bits += vb->res_bits;
- if(v->centerW)
- {
- thisCenter = n1;
- prevCenter = 0;
- }
- else
- {
- thisCenter = 0;
- prevCenter = n1;
- }
+ v->lW=v->W;
+ v->W=v->nW;
+ v->centerW=new_centerNext;
- /* v->pcm is now used like a two-stage double buffer. We don't want
- to have to constantly shift *or* adjust memory usage. Don't
- accept a new block until the old is shifted out */
-
- for(j = 0; j < vi->channels; j++)
- {
- /* the overlap/add section */
- if(v->lW)
- {
- if(v->W)
- {
- /* large/large */
- float *w = _vorbis_window_get(b->window[1] - hs);
- float *pcm = v->pcm[j] + prevCenter;
- float *p = vb->pcm[j];
- for(i = 0; i < n1; i++)
- pcm[i] = pcm[i] * w[n1-i-1] + p[i] * w[i];
- }
- else
- {
- /* large/small */
- float *w = _vorbis_window_get(b->window[0] - hs);
- float *pcm = v->pcm[j] + prevCenter + n1 / 2 - n0 / 2;
- float *p = vb->pcm[j];
- for(i = 0; i < n0; i++)
- pcm[i] = pcm[i] * w[n0-i-1] + p[i] * w[i];
- }
- }
- else
- {
- if(v->W)
- {
- /* small/large */
- float *w = _vorbis_window_get(b->window[0] - hs);
- float *pcm = v->pcm[j] + prevCenter;
- float *p = vb->pcm[j] + n1 / 2 - n0 / 2;
- for(i = 0; i < n0; i++)
- pcm[i] = pcm[i] * w[n0-i-1] + p[i] * w[i];
- for(; i < n1 / 2 + n0 / 2; i++)
- pcm[i] = p[i];
- }
- else
- {
- /* small/small */
- float *w = _vorbis_window_get(b->window[0] - hs);
- float *pcm = v->pcm[j] + prevCenter;
- float *p = vb->pcm[j];
- for(i = 0; i < n0; i++)
- pcm[i] = pcm[i] * w[n0-i-1] + p[i] * w[i];
- }
- }
-
- /* the copy section */
- {
- float *pcm = v->pcm[j] + thisCenter;
- float *p = vb->pcm[j] + n;
- for(i = 0; i < n; i++)
- pcm[i] = p[i];
- }
+ if(v->eofflag){
+ v->eofflag-=movementW;
+ if(v->eofflag<=0)v->eofflag=-1;
+ /* do not add padding to end of stream! */
+ if(v->centerW>=v->eofflag){
+ v->granulepos+=movementW-(v->centerW-v->eofflag);
+ }else{
+ v->granulepos+=movementW;
}
+ }else{
+ v->granulepos+=movementW;
+ }
+ }
+ }
- if(v->centerW)
- v->centerW = 0;
- else
- v->centerW = n1;
+ /* done */
+ return(1);
+}
- /* deal with initial packet state; we do this using the explicit
- pcm_returned==-1 flag otherwise we're sensitive to first block
- being short or long */
+int vorbis_synthesis_restart(vorbis_dsp_state *v){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci;
+ int hs;
- if(v->pcm_returned == -1)
- {
- v->pcm_returned = thisCenter;
- v->pcm_current = thisCenter;
- }
- else
- {
- v->pcm_returned = prevCenter;
- v->pcm_current = prevCenter +
- ((ci->blocksizes[v->lW] / 4 +
- ci->blocksizes[v->W] / 4) >> hs);
- }
+ if(!v->backend_state)return -1;
+ if(!vi)return -1;
+ ci=vi->codec_setup;
+ if(!ci)return -1;
+ hs=ci->halfrate_flag;
- }
+ v->centerW=ci->blocksizes[1]>>(hs+1);
+ v->pcm_current=v->centerW>>hs;
- /* track the frame number... This is for convenience, but also
- making sure our last packet doesn't end with added padding. If
- the last packet is partial, the number of samples we'll have to
- return will be past the vb->granulepos.
+ v->pcm_returned=-1;
+ v->granulepos=-1;
+ v->sequence=-1;
+ v->eofflag=0;
+ ((private_state *)(v->backend_state))->sample_count=-1;
- This is not foolproof! It will be confused if we begin
- decoding at the last page after a seek or hole. In that case,
- we don't have a starting point to judge where the last frame
- is. For this reason, vorbisfile will always try to make sure
- it reads the last two marked pages in proper sequence */
+ return(0);
+}
- if(b->sample_count == -1)
- {
- b->sample_count = 0;
- }
- else
- {
- b->sample_count += ci->blocksizes[v->lW] / 4 + ci->blocksizes[v->W] / 4;
- }
+int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
+ if(_vds_shared_init(v,vi,0)){
+ vorbis_dsp_clear(v);
+ return 1;
+ }
+ vorbis_synthesis_restart(v);
+ return 0;
+}
- if(v->granulepos == -1)
- {
- if(vb->granulepos != -1) /* only set if we have a position to set to */
- {
-
- v->granulepos = vb->granulepos;
-
- /* is this a short page? */
- if(b->sample_count > v->granulepos)
- {
- /* corner case; if this is both the first and last audio page,
- then spec says the end is cut, not beginning */
- if(vb->eofflag)
- {
- /* trim the end */
- /* no preceeding granulepos; assume we started at zero (we'd
- have to in a short single-page stream) */
- /* granulepos could be -1 due to a seek, but that would result
- in a long count, not short count */
-
- v->pcm_current -= (b->sample_count - v->granulepos) >> hs;
- }
- else
- {
- /* trim the beginning */
- v->pcm_returned += (b->sample_count - v->granulepos) >> hs;
- if(v->pcm_returned > v->pcm_current)
- v->pcm_returned = v->pcm_current;
- }
-
- }
+/* Unlike in analysis, the window is only partially applied for each
+ block. The time domain envelope is not yet handled at the point of
+ calling (as it relies on the previous block). */
- }
- }
+int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ private_state *b=v->backend_state;
+ int hs=ci->halfrate_flag;
+ int i,j;
+
+ if(!vb)return(OV_EINVAL);
+ if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL);
+
+ v->lW=v->W;
+ v->W=vb->W;
+ v->nW=-1;
+
+ if((v->sequence==-1)||
+ (v->sequence+1 != vb->sequence)){
+ v->granulepos=-1; /* out of sequence; lose count */
+ b->sample_count=-1;
+ }
+
+ v->sequence=vb->sequence;
+
+ if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
+ was called on block */
+ int n=ci->blocksizes[v->W]>>(hs+1);
+ int n0=ci->blocksizes[0]>>(hs+1);
+ int n1=ci->blocksizes[1]>>(hs+1);
+
+ int thisCenter;
+ int prevCenter;
+
+ v->glue_bits+=vb->glue_bits;
+ v->time_bits+=vb->time_bits;
+ v->floor_bits+=vb->floor_bits;
+ v->res_bits+=vb->res_bits;
+
+ if(v->centerW){
+ thisCenter=n1;
+ prevCenter=0;
+ }else{
+ thisCenter=0;
+ prevCenter=n1;
+ }
+
+ /* v->pcm is now used like a two-stage double buffer. We don't want
+ to have to constantly shift *or* adjust memory usage. Don't
+ accept a new block until the old is shifted out */
+
+ for(j=0;j<vi->channels;j++){
+ /* the overlap/add section */
+ if(v->lW){
+ if(v->W){
+ /* large/large */
+ float *w=_vorbis_window_get(b->window[1]-hs);
+ float *pcm=v->pcm[j]+prevCenter;
+ float *p=vb->pcm[j];
+ for(i=0;i<n1;i++)
+ pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i];
+ }else{
+ /* large/small */
+ float *w=_vorbis_window_get(b->window[0]-hs);
+ float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
+ float *p=vb->pcm[j];
+ for(i=0;i<n0;i++)
+ pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+ }
+ }else{
+ if(v->W){
+ /* small/large */
+ float *w=_vorbis_window_get(b->window[0]-hs);
+ float *pcm=v->pcm[j]+prevCenter;
+ float *p=vb->pcm[j]+n1/2-n0/2;
+ for(i=0;i<n0;i++)
+ pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+ for(;i<n1/2+n0/2;i++)
+ pcm[i]=p[i];
+ }else{
+ /* small/small */
+ float *w=_vorbis_window_get(b->window[0]-hs);
+ float *pcm=v->pcm[j]+prevCenter;
+ float *p=vb->pcm[j];
+ for(i=0;i<n0;i++)
+ pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+ }
+ }
+
+ /* the copy section */
+ {
+ float *pcm=v->pcm[j]+thisCenter;
+ float *p=vb->pcm[j]+n;
+ for(i=0;i<n;i++)
+ pcm[i]=p[i];
+ }
+ }
+
+ if(v->centerW)
+ v->centerW=0;
else
- {
- v->granulepos += ci->blocksizes[v->lW] / 4 + ci->blocksizes[v->W] / 4;
- if(vb->granulepos != -1 && v->granulepos != vb->granulepos)
- {
-
- if(v->granulepos > vb->granulepos)
- {
- long extra = v->granulepos - vb->granulepos;
-
- if(extra)
- if(vb->eofflag)
- {
- /* partial last frame. Strip the extra samples off */
- v->pcm_current -= extra >> hs;
- } /* else {Shouldn't happen *unless* the bitstream is out of
+ v->centerW=n1;
+
+ /* deal with initial packet state; we do this using the explicit
+ pcm_returned==-1 flag otherwise we're sensitive to first block
+ being short or long */
+
+ if(v->pcm_returned==-1){
+ v->pcm_returned=thisCenter;
+ v->pcm_current=thisCenter;
+ }else{
+ v->pcm_returned=prevCenter;
+ v->pcm_current=prevCenter+
+ ((ci->blocksizes[v->lW]/4+
+ ci->blocksizes[v->W]/4)>>hs);
+ }
+
+ }
+
+ /* track the frame number... This is for convenience, but also
+ making sure our last packet doesn't end with added padding. If
+ the last packet is partial, the number of samples we'll have to
+ return will be past the vb->granulepos.
+
+ This is not foolproof! It will be confused if we begin
+ decoding at the last page after a seek or hole. In that case,
+ we don't have a starting point to judge where the last frame
+ is. For this reason, vorbisfile will always try to make sure
+ it reads the last two marked pages in proper sequence */
+
+ if(b->sample_count==-1){
+ b->sample_count=0;
+ }else{
+ b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
+ }
+
+ if(v->granulepos==-1){
+ if(vb->granulepos!=-1){ /* only set if we have a position to set to */
+
+ v->granulepos=vb->granulepos;
+
+ /* is this a short page? */
+ if(b->sample_count>v->granulepos){
+ /* corner case; if this is both the first and last audio page,
+ then spec says the end is cut, not beginning */
+ if(vb->eofflag){
+ /* trim the end */
+ /* no preceeding granulepos; assume we started at zero (we'd
+ have to in a short single-page stream) */
+ /* granulepos could be -1 due to a seek, but that would result
+ in a long count, not short count */
+
+ v->pcm_current-=(b->sample_count-v->granulepos)>>hs;
+ }else{
+ /* trim the beginning */
+ v->pcm_returned+=(b->sample_count-v->granulepos)>>hs;
+ if(v->pcm_returned>v->pcm_current)
+ v->pcm_returned=v->pcm_current;
+ }
+
+ }
+
+ }
+ }else{
+ v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
+ if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
+
+ if(v->granulepos>vb->granulepos){
+ long extra=v->granulepos-vb->granulepos;
+
+ if(extra)
+ if(vb->eofflag){
+ /* partial last frame. Strip the extra samples off */
+ v->pcm_current-=extra>>hs;
+ } /* else {Shouldn't happen *unless* the bitstream is out of
spec. Either way, believe the bitstream } */
- } /* else {Shouldn't happen *unless* the bitstream is out of
+ } /* else {Shouldn't happen *unless* the bitstream is out of
spec. Either way, believe the bitstream } */
- v->granulepos = vb->granulepos;
- }
+ v->granulepos=vb->granulepos;
}
+ }
- /* Update, cleanup */
+ /* Update, cleanup */
- if(vb->eofflag)v->eofflag = 1;
- return(0);
+ if(vb->eofflag)v->eofflag=1;
+ return(0);
}
/* pcm==NULL indicates we just want the pending samples, no more */
-int vorbis_synthesis_pcmout(vorbis_dsp_state *v, float ***pcm)
-{
- vorbis_info *vi = v->vi;
-
- if(v->pcm_returned > -1 && v->pcm_returned < v->pcm_current)
- {
- if(pcm)
- {
- int i;
- for(i = 0; i < vi->channels; i++)
- v->pcmret[i] = v->pcm[i] + v->pcm_returned;
- *pcm = v->pcmret;
- }
- return(v->pcm_current - v->pcm_returned);
- }
- return(0);
+int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){
+ vorbis_info *vi=v->vi;
+
+ if(v->pcm_returned>-1 && v->pcm_returned<v->pcm_current){
+ if(pcm){
+ int i;
+ for(i=0;i<vi->channels;i++)
+ v->pcmret[i]=v->pcm[i]+v->pcm_returned;
+ *pcm=v->pcmret;
+ }
+ return(v->pcm_current-v->pcm_returned);
+ }
+ return(0);
}
-int vorbis_synthesis_read(vorbis_dsp_state *v, int n)
-{
- if(n && v->pcm_returned + n > v->pcm_current)return(OV_EINVAL);
- v->pcm_returned += n;
- return(0);
+int vorbis_synthesis_read(vorbis_dsp_state *v,int n){
+ if(n && v->pcm_returned+n>v->pcm_current)return(OV_EINVAL);
+ v->pcm_returned+=n;
+ return(0);
}
/* intended for use with a specific vorbisfile feature; we want access
@@ -1052,99 +930,87 @@ int vorbis_synthesis_read(vorbis_dsp_state *v, int n)
the end of a decode cycle, specifically, a half-short-block worth.
This funtion works like pcmout above, except it will also expose
this implicit buffer data not normally decoded. */
-int vorbis_synthesis_lapout(vorbis_dsp_state *v, float ***pcm)
-{
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
- int hs = ci->halfrate_flag;
-
- int n = ci->blocksizes[v->W] >> (hs + 1);
- int n0 = ci->blocksizes[0] >> (hs + 1);
- int n1 = ci->blocksizes[1] >> (hs + 1);
- int i, j;
-
- if(v->pcm_returned < 0)return 0;
-
- /* our returned data ends at pcm_returned; because the synthesis pcm
- buffer is a two-fragment ring, that means our data block may be
- fragmented by buffering, wrapping or a short block not filling
- out a buffer. To simplify things, we unfragment if it's at all
- possibly needed. Otherwise, we'd need to call lapout more than
- once as well as hold additional dsp state. Opt for
- simplicity. */
-
- /* centerW was advanced by blockin; it would be the center of the
- *next* block */
- if(v->centerW == n1)
- {
- /* the data buffer wraps; swap the halves */
- /* slow, sure, small */
- for(j = 0; j < vi->channels; j++)
- {
- float *p = v->pcm[j];
- for(i = 0; i < n1; i++)
- {
- float temp = p[i];
- p[i] = p[i+n1];
- p[i+n1] = temp;
- }
- }
-
- v->pcm_current -= n1;
- v->pcm_returned -= n1;
- v->centerW = 0;
- }
-
- /* solidify buffer into contiguous space */
- if((v->lW ^ v->W) == 1)
- {
- /* long/short or short/long */
- for(j = 0; j < vi->channels; j++)
- {
- float *s = v->pcm[j];
- float *d = v->pcm[j] + (n1 - n0) / 2;
- for(i = (n1 + n0) / 2 - 1; i >= 0; --i)
- d[i] = s[i];
- }
- v->pcm_returned += (n1 - n0) / 2;
- v->pcm_current += (n1 - n0) / 2;
- }
- else
- {
- if(v->lW == 0)
- {
- /* short/short */
- for(j = 0; j < vi->channels; j++)
- {
- float *s = v->pcm[j];
- float *d = v->pcm[j] + n1 - n0;
- for(i = n0 - 1; i >= 0; --i)
- d[i] = s[i];
- }
- v->pcm_returned += n1 - n0;
- v->pcm_current += n1 - n0;
- }
- }
-
- if(pcm)
- {
- int i;
- for(i = 0; i < vi->channels; i++)
- v->pcmret[i] = v->pcm[i] + v->pcm_returned;
- *pcm = v->pcmret;
- }
+int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ int hs=ci->halfrate_flag;
+
+ int n=ci->blocksizes[v->W]>>(hs+1);
+ int n0=ci->blocksizes[0]>>(hs+1);
+ int n1=ci->blocksizes[1]>>(hs+1);
+ int i,j;
+
+ if(v->pcm_returned<0)return 0;
+
+ /* our returned data ends at pcm_returned; because the synthesis pcm
+ buffer is a two-fragment ring, that means our data block may be
+ fragmented by buffering, wrapping or a short block not filling
+ out a buffer. To simplify things, we unfragment if it's at all
+ possibly needed. Otherwise, we'd need to call lapout more than
+ once as well as hold additional dsp state. Opt for
+ simplicity. */
+
+ /* centerW was advanced by blockin; it would be the center of the
+ *next* block */
+ if(v->centerW==n1){
+ /* the data buffer wraps; swap the halves */
+ /* slow, sure, small */
+ for(j=0;j<vi->channels;j++){
+ float *p=v->pcm[j];
+ for(i=0;i<n1;i++){
+ float temp=p[i];
+ p[i]=p[i+n1];
+ p[i+n1]=temp;
+ }
+ }
+
+ v->pcm_current-=n1;
+ v->pcm_returned-=n1;
+ v->centerW=0;
+ }
+
+ /* solidify buffer into contiguous space */
+ if((v->lW^v->W)==1){
+ /* long/short or short/long */
+ for(j=0;j<vi->channels;j++){
+ float *s=v->pcm[j];
+ float *d=v->pcm[j]+(n1-n0)/2;
+ for(i=(n1+n0)/2-1;i>=0;--i)
+ d[i]=s[i];
+ }
+ v->pcm_returned+=(n1-n0)/2;
+ v->pcm_current+=(n1-n0)/2;
+ }else{
+ if(v->lW==0){
+ /* short/short */
+ for(j=0;j<vi->channels;j++){
+ float *s=v->pcm[j];
+ float *d=v->pcm[j]+n1-n0;
+ for(i=n0-1;i>=0;--i)
+ d[i]=s[i];
+ }
+ v->pcm_returned+=n1-n0;
+ v->pcm_current+=n1-n0;
+ }
+ }
+
+ if(pcm){
+ int i;
+ for(i=0;i<vi->channels;i++)
+ v->pcmret[i]=v->pcm[i]+v->pcm_returned;
+ *pcm=v->pcmret;
+ }
- return(n1 + n - v->pcm_returned);
+ return(n1+n-v->pcm_returned);
}
-float *vorbis_window(vorbis_dsp_state *v, int W)
-{
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
- int hs = ci->halfrate_flag;
- private_state *b = v->backend_state;
+float *vorbis_window(vorbis_dsp_state *v,int W){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ int hs=ci->halfrate_flag;
+ private_state *b=v->backend_state;
- if(b->window[W] - 1 < 0)return NULL;
- return _vorbis_window_get(b->window[W] - hs);
+ if(b->window[W]-1<0)return NULL;
+ return _vorbis_window_get(b->window[W]-hs);
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.c b/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.c
index 28696dc3e..156ca1204 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.c
@@ -27,273 +27,241 @@
/* packs the given codebook into the bitstream **************************/
-int vorbis_staticbook_pack(const static_codebook *c, oggpack_buffer *opb)
-{
- long i, j;
- int ordered = 0;
-
- /* first the basic parameters */
- oggpack_write(opb, 0x564342, 24);
- oggpack_write(opb, c->dim, 16);
- oggpack_write(opb, c->entries, 24);
-
- /* pack the codewords. There are two packings; length ordered and
- length random. Decide between the two now. */
-
- for(i = 1; i < c->entries; i++)
- if(c->lengthlist[i-1] == 0 || c->lengthlist[i] < c->lengthlist[i-1])break;
- if(i == c->entries)ordered = 1;
-
- if(ordered)
- {
- /* length ordered. We only need to say how many codewords of
- each length. The actual codewords are generated
- deterministically */
-
- long count = 0;
- oggpack_write(opb, 1, 1); /* ordered */
- oggpack_write(opb, c->lengthlist[0] - 1, 5); /* 1 to 32 */
-
- for(i = 1; i < c->entries; i++)
- {
- long this = c->lengthlist[i];
- long last = c->lengthlist[i-1];
- if(this > last)
- {
- for(j = last; j < this; j++)
- {
- oggpack_write(opb, i - count, _ilog(c->entries - count));
- count = i;
- }
- }
+int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
+ long i,j;
+ int ordered=0;
+
+ /* first the basic parameters */
+ oggpack_write(opb,0x564342,24);
+ oggpack_write(opb,c->dim,16);
+ oggpack_write(opb,c->entries,24);
+
+ /* pack the codewords. There are two packings; length ordered and
+ length random. Decide between the two now. */
+
+ for(i=1;i<c->entries;i++)
+ if(c->lengthlist[i-1]==0 || c->lengthlist[i]<c->lengthlist[i-1])break;
+ if(i==c->entries)ordered=1;
+
+ if(ordered){
+ /* length ordered. We only need to say how many codewords of
+ each length. The actual codewords are generated
+ deterministically */
+
+ long count=0;
+ oggpack_write(opb,1,1); /* ordered */
+ oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */
+
+ for(i=1;i<c->entries;i++){
+ long this=c->lengthlist[i];
+ long last=c->lengthlist[i-1];
+ if(this>last){
+ for(j=last;j<this;j++){
+ oggpack_write(opb,i-count,_ilog(c->entries-count));
+ count=i;
}
- oggpack_write(opb, i - count, _ilog(c->entries - count));
-
+ }
}
- else
- {
- /* length random. Again, we don't code the codeword itself, just
- the length. This time, though, we have to encode each length */
- oggpack_write(opb, 0, 1); /* unordered */
-
- /* algortihmic mapping has use for 'unused entries', which we tag
- here. The algorithmic mapping happens as usual, but the unused
- entry has no codeword. */
- for(i = 0; i < c->entries; i++)
- if(c->lengthlist[i] == 0)break;
-
- if(i == c->entries)
- {
- oggpack_write(opb, 0, 1); /* no unused entries */
- for(i = 0; i < c->entries; i++)
- oggpack_write(opb, c->lengthlist[i] - 1, 5);
- }
- else
- {
- oggpack_write(opb, 1, 1); /* we have unused entries; thus we tag */
- for(i = 0; i < c->entries; i++)
- {
- if(c->lengthlist[i] == 0)
- {
- oggpack_write(opb, 0, 1);
- }
- else
- {
- oggpack_write(opb, 1, 1);
- oggpack_write(opb, c->lengthlist[i] - 1, 5);
- }
- }
+ oggpack_write(opb,i-count,_ilog(c->entries-count));
+
+ }else{
+ /* length random. Again, we don't code the codeword itself, just
+ the length. This time, though, we have to encode each length */
+ oggpack_write(opb,0,1); /* unordered */
+
+ /* algortihmic mapping has use for 'unused entries', which we tag
+ here. The algorithmic mapping happens as usual, but the unused
+ entry has no codeword. */
+ for(i=0;i<c->entries;i++)
+ if(c->lengthlist[i]==0)break;
+
+ if(i==c->entries){
+ oggpack_write(opb,0,1); /* no unused entries */
+ for(i=0;i<c->entries;i++)
+ oggpack_write(opb,c->lengthlist[i]-1,5);
+ }else{
+ oggpack_write(opb,1,1); /* we have unused entries; thus we tag */
+ for(i=0;i<c->entries;i++){
+ if(c->lengthlist[i]==0){
+ oggpack_write(opb,0,1);
+ }else{
+ oggpack_write(opb,1,1);
+ oggpack_write(opb,c->lengthlist[i]-1,5);
}
+ }
+ }
+ }
+
+ /* is the entry number the desired return value, or do we have a
+ mapping? If we have a mapping, what type? */
+ oggpack_write(opb,c->maptype,4);
+ switch(c->maptype){
+ case 0:
+ /* no mapping */
+ break;
+ case 1:case 2:
+ /* implicitly populated value mapping */
+ /* explicitly populated value mapping */
+
+ if(!c->quantlist){
+ /* no quantlist? error */
+ return(-1);
}
- /* is the entry number the desired return value, or do we have a
- mapping? If we have a mapping, what type? */
- oggpack_write(opb, c->maptype, 4);
- switch(c->maptype)
+ /* values that define the dequantization */
+ oggpack_write(opb,c->q_min,32);
+ oggpack_write(opb,c->q_delta,32);
+ oggpack_write(opb,c->q_quant-1,4);
+ oggpack_write(opb,c->q_sequencep,1);
+
{
- case 0:
- /* no mapping */
+ int quantvals;
+ switch(c->maptype){
+ case 1:
+ /* a single column of (c->entries/c->dim) quantized values for
+ building a full value list algorithmically (square lattice) */
+ quantvals=_book_maptype1_quantvals(c);
break;
- case 1:
- case 2:
- /* implicitly populated value mapping */
- /* explicitly populated value mapping */
-
- if(!c->quantlist)
- {
- /* no quantlist? error */
- return(-1);
- }
+ case 2:
+ /* every value (c->entries*c->dim total) specified explicitly */
+ quantvals=c->entries*c->dim;
+ break;
+ default: /* NOT_REACHABLE */
+ quantvals=-1;
+ }
- /* values that define the dequantization */
- oggpack_write(opb, c->q_min, 32);
- oggpack_write(opb, c->q_delta, 32);
- oggpack_write(opb, c->q_quant - 1, 4);
- oggpack_write(opb, c->q_sequencep, 1);
-
- {
- int quantvals;
- switch(c->maptype)
- {
- case 1:
- /* a single column of (c->entries/c->dim) quantized values for
- building a full value list algorithmically (square lattice) */
- quantvals = _book_maptype1_quantvals(c);
- break;
- case 2:
- /* every value (c->entries*c->dim total) specified explicitly */
- quantvals = c->entries * c->dim;
- break;
- default: /* NOT_REACHABLE */
- quantvals = -1;
- }
-
- /* quantized values */
- for(i = 0; i < quantvals; i++)
- oggpack_write(opb, labs(c->quantlist[i]), c->q_quant);
+ /* quantized values */
+ for(i=0;i<quantvals;i++)
+ oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
- }
- break;
- default:
- /* error case; we don't have any other map types now */
- return(-1);
}
+ break;
+ default:
+ /* error case; we don't have any other map types now */
+ return(-1);
+ }
- return(0);
+ return(0);
}
/* unpacks a codebook from the packet buffer into the codebook struct,
readies the codebook auxiliary structures for decode *************/
-int vorbis_staticbook_unpack(oggpack_buffer *opb, static_codebook *s)
-{
- long i, j;
- memset(s, 0, sizeof(*s));
- s->allocedp = 1;
-
- /* make sure alignment is correct */
- if(oggpack_read(opb, 24) != 0x564342)goto _eofout;
-
- /* first the basic parameters */
- s->dim = oggpack_read(opb, 16);
- s->entries = oggpack_read(opb, 24);
- if(s->entries == -1)goto _eofout;
-
- if(_ilog(s->dim) + _ilog(s->entries) > 24)goto _eofout;
-
- /* codeword ordering.... length ordered or unordered? */
- switch((int)oggpack_read(opb, 1))
- {
- case 0:
- /* unordered */
- s->lengthlist = _ogg_malloc(sizeof(*s->lengthlist) * s->entries);
-
- /* allocated but unused entries? */
- if(oggpack_read(opb, 1))
- {
- /* yes, unused entries */
-
- for(i = 0; i < s->entries; i++)
- {
- if(oggpack_read(opb, 1))
- {
- long num = oggpack_read(opb, 5);
- if(num == -1)goto _eofout;
- s->lengthlist[i] = num + 1;
- }
- else
- s->lengthlist[i] = 0;
- }
- }
- else
- {
- /* all entries used; no tagging */
- for(i = 0; i < s->entries; i++)
- {
- long num = oggpack_read(opb, 5);
- if(num == -1)goto _eofout;
- s->lengthlist[i] = num + 1;
- }
- }
+int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
+ long i,j;
+ memset(s,0,sizeof(*s));
+ s->allocedp=1;
+
+ /* make sure alignment is correct */
+ if(oggpack_read(opb,24)!=0x564342)goto _eofout;
+
+ /* first the basic parameters */
+ s->dim=oggpack_read(opb,16);
+ s->entries=oggpack_read(opb,24);
+ if(s->entries==-1)goto _eofout;
+
+ if(_ilog(s->dim)+_ilog(s->entries)>24)goto _eofout;
+
+ /* codeword ordering.... length ordered or unordered? */
+ switch((int)oggpack_read(opb,1)){
+ case 0:
+ /* unordered */
+ s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
+
+ /* allocated but unused entries? */
+ if(oggpack_read(opb,1)){
+ /* yes, unused entries */
+
+ for(i=0;i<s->entries;i++){
+ if(oggpack_read(opb,1)){
+ long num=oggpack_read(opb,5);
+ if(num==-1)goto _eofout;
+ s->lengthlist[i]=num+1;
+ }else
+ s->lengthlist[i]=0;
+ }
+ }else{
+ /* all entries used; no tagging */
+ for(i=0;i<s->entries;i++){
+ long num=oggpack_read(opb,5);
+ if(num==-1)goto _eofout;
+ s->lengthlist[i]=num+1;
+ }
+ }
- break;
- case 1:
- /* ordered */
+ break;
+ case 1:
+ /* ordered */
{
- long length = oggpack_read(opb, 5) + 1;
- s->lengthlist = _ogg_malloc(sizeof(*s->lengthlist) * s->entries);
-
- for(i = 0; i < s->entries;)
- {
- long num = oggpack_read(opb, _ilog(s->entries - i));
- if(num == -1)goto _eofout;
- if(length > 32)goto _errout;
- for(j = 0; j < num && i < s->entries; j++, i++)
- s->lengthlist[i] = length;
- length++;
- }
+ long length=oggpack_read(opb,5)+1;
+ s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
+
+ for(i=0;i<s->entries;){
+ long num=oggpack_read(opb,_ilog(s->entries-i));
+ if(num==-1)goto _eofout;
+ if(length>32)goto _errout;
+ for(j=0;j<num && i<s->entries;j++,i++)
+ s->lengthlist[i]=length;
+ length++;
+ }
}
break;
- default:
- /* EOF */
- return(-1);
- }
+ default:
+ /* EOF */
+ return(-1);
+ }
+
+ /* Do we have a mapping to unpack? */
+ switch((s->maptype=oggpack_read(opb,4))){
+ case 0:
+ /* no mapping */
+ break;
+ case 1: case 2:
+ /* implicitly populated value mapping */
+ /* explicitly populated value mapping */
+
+ s->q_min=oggpack_read(opb,32);
+ s->q_delta=oggpack_read(opb,32);
+ s->q_quant=oggpack_read(opb,4)+1;
+ s->q_sequencep=oggpack_read(opb,1);
+ if(s->q_sequencep==-1)goto _eofout;
- /* Do we have a mapping to unpack? */
- switch((s->maptype = oggpack_read(opb, 4)))
{
- case 0:
- /* no mapping */
+ int quantvals=0;
+ switch(s->maptype){
+ case 1:
+ quantvals=(s->dim==0?0:_book_maptype1_quantvals(s));
break;
- case 1:
- case 2:
- /* implicitly populated value mapping */
- /* explicitly populated value mapping */
-
- s->q_min = oggpack_read(opb, 32);
- s->q_delta = oggpack_read(opb, 32);
- s->q_quant = oggpack_read(opb, 4) + 1;
- s->q_sequencep = oggpack_read(opb, 1);
- if(s->q_sequencep == -1)goto _eofout;
-
- {
- int quantvals = 0;
- switch(s->maptype)
- {
- case 1:
- quantvals = (s->dim == 0 ? 0 : _book_maptype1_quantvals(s));
- break;
- case 2:
- quantvals = s->entries * s->dim;
- break;
- }
-
- /* quantized values */
- s->quantlist = _ogg_malloc(sizeof(*s->quantlist) * quantvals);
- for(i = 0; i < quantvals; i++)
- s->quantlist[i] = oggpack_read(opb, s->q_quant);
-
- if(quantvals && s->quantlist[quantvals-1] == -1)goto _eofout;
- }
+ case 2:
+ quantvals=s->entries*s->dim;
break;
- default:
- goto _errout;
+ }
+
+ /* quantized values */
+ s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
+ for(i=0;i<quantvals;i++)
+ s->quantlist[i]=oggpack_read(opb,s->q_quant);
+
+ if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
}
+ break;
+ default:
+ goto _errout;
+ }
- /* all set */
- return(0);
+ /* all set */
+ return(0);
-_errout:
-_eofout:
- vorbis_staticbook_clear(s);
- return(-1);
+ _errout:
+ _eofout:
+ vorbis_staticbook_clear(s);
+ return(-1);
}
/* returns the number of bits ************************************************/
-int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b)
-{
- if(a < 0 || a >= book->c->entries)return(0);
- oggpack_write(b, book->codelist[a], book->c->lengthlist[a]);
- return(book->c->lengthlist[a]);
+int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){
+ if(a<0 || a>=book->c->entries)return(0);
+ oggpack_write(b,book->codelist[a],book->c->lengthlist[a]);
+ return(book->c->lengthlist[a]);
}
/* One the encode side, our vector writers are each designed for a
@@ -311,22 +279,20 @@ infrastructure on the encode side (decode side is specced and simpler) */
/* floor0 LSP (single stage, non interleaved, nearest match) */
/* returns entry number and *modifies a* to the quantization value *****/
-int vorbis_book_errorv(codebook *book, float *a)
-{
- int dim = book->dim, k;
- int best = _best(book, a, 1);
- for(k = 0; k < dim; k++)
- a[k] = (book->valuelist + best * dim)[k];
- return(best);
+int vorbis_book_errorv(codebook *book,float *a){
+ int dim=book->dim,k;
+ int best=_best(book,a,1);
+ for(k=0;k<dim;k++)
+ a[k]=(book->valuelist+best*dim)[k];
+ return(best);
}
/* returns the number of bits and *modifies a* to the quantization value *****/
-int vorbis_book_encodev(codebook *book, int best, float *a, oggpack_buffer *b)
-{
- int k, dim = book->dim;
- for(k = 0; k < dim; k++)
- a[k] = (book->valuelist + best * dim)[k];
- return(vorbis_book_encode(book, best, b));
+int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){
+ int k,dim=book->dim;
+ for(k=0;k<dim;k++)
+ a[k]=(book->valuelist+best*dim)[k];
+ return(vorbis_book_encode(book,best,b));
}
/* the 'eliminate the decode tree' optimization actually requires the
@@ -337,69 +303,59 @@ int vorbis_book_encodev(codebook *book, int best, float *a, oggpack_buffer *b)
be. The first-stage decode table catches most words so that
bitreverse is not in the main execution path. */
-static ogg_uint32_t bitreverse(ogg_uint32_t x)
-{
- x = ((x >> 16) & 0x0000ffff) | ((x << 16) & 0xffff0000);
- x = ((x >> 8) & 0x00ff00ff) | ((x << 8) & 0xff00ff00);
- x = ((x >> 4) & 0x0f0f0f0f) | ((x << 4) & 0xf0f0f0f0);
- x = ((x >> 2) & 0x33333333) | ((x << 2) & 0xcccccccc);
- return((x >> 1) & 0x55555555) | ((x << 1) & 0xaaaaaaaa);
+static ogg_uint32_t bitreverse(ogg_uint32_t x){
+ x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000);
+ x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00);
+ x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0);
+ x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc);
+ return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa);
}
-STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b)
-{
- int read = book->dec_maxlength;
- long lo, hi;
- long lok = oggpack_look(b, book->dec_firsttablen);
-
- if(lok >= 0)
- {
- long entry = book->dec_firsttable[lok];
- if(entry & 0x80000000UL)
- {
- lo = (entry >> 15) & 0x7fff;
- hi = book->used_entries - (entry & 0x7fff);
- }
- else
- {
- oggpack_adv(b, book->dec_codelengths[entry-1]);
- return(entry - 1);
- }
- }
- else
- {
- lo = 0;
- hi = book->used_entries;
+STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
+ int read=book->dec_maxlength;
+ long lo,hi;
+ long lok = oggpack_look(b,book->dec_firsttablen);
+
+ if (lok >= 0) {
+ long entry = book->dec_firsttable[lok];
+ if(entry&0x80000000UL){
+ lo=(entry>>15)&0x7fff;
+ hi=book->used_entries-(entry&0x7fff);
+ }else{
+ oggpack_adv(b, book->dec_codelengths[entry-1]);
+ return(entry-1);
}
-
- lok = oggpack_look(b, read);
-
- while(lok < 0 && read > 1)
- lok = oggpack_look(b, --read);
- if(lok < 0)return -1;
-
- /* bisect search for the codeword in the ordered list */
- {
- ogg_uint32_t testword = bitreverse((ogg_uint32_t)lok);
-
- while(hi - lo > 1)
- {
- long p = (hi - lo) >> 1;
- long test = book->codelist[lo+p] > testword;
- lo += p & (test - 1);
- hi -= p & (-test);
- }
-
- if(book->dec_codelengths[lo] <= read)
- {
- oggpack_adv(b, book->dec_codelengths[lo]);
- return(lo);
- }
+ }else{
+ lo=0;
+ hi=book->used_entries;
+ }
+
+ lok = oggpack_look(b, read);
+
+ while(lok<0 && read>1)
+ lok = oggpack_look(b, --read);
+ if(lok<0)return -1;
+
+ /* bisect search for the codeword in the ordered list */
+ {
+ ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
+
+ while(hi-lo>1){
+ long p=(hi-lo)>>1;
+ long test=book->codelist[lo+p]>testword;
+ lo+=p&(test-1);
+ hi-=p&(-test);
+ }
+
+ if(book->dec_codelengths[lo]<=read){
+ oggpack_adv(b, book->dec_codelengths[lo]);
+ return(lo);
}
+ }
- oggpack_adv(b, read);
+ oggpack_adv(b, read);
- return(-1);
+ return(-1);
}
/* Decode side is specced and easier, because we don't need to find
@@ -417,151 +373,127 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b)
addmul==2 -> multiplicitive */
/* returns the [original, not compacted] entry number or -1 on eof *********/
-long vorbis_book_decode(codebook *book, oggpack_buffer *b)
-{
- if(book->used_entries > 0)
- {
- long packed_entry = decode_packed_entry_number(book, b);
- if(packed_entry >= 0)
- return(book->dec_index[packed_entry]);
- }
-
- /* if there's no dec_index, the codebook unpacking isn't collapsed */
- return(-1);
+long vorbis_book_decode(codebook *book, oggpack_buffer *b){
+ if(book->used_entries>0){
+ long packed_entry=decode_packed_entry_number(book,b);
+ if(packed_entry>=0)
+ return(book->dec_index[packed_entry]);
+ }
+
+ /* if there's no dec_index, the codebook unpacking isn't collapsed */
+ return(-1);
}
/* returns 0 on OK or -1 on eof *************************************/
-long vorbis_book_decodevs_add(codebook *book, float *a, oggpack_buffer *b, int n)
-{
- if(book->used_entries > 0)
- {
- int step = n / book->dim;
- long *entry = alloca(sizeof(*entry) * step);
- float **t = alloca(sizeof(*t) * step);
- int i, j, o;
-
- for(i = 0; i < step; i++)
- {
- entry[i] = decode_packed_entry_number(book, b);
- if(entry[i] == -1)return(-1);
- t[i] = book->valuelist + entry[i] * book->dim;
- }
- for(i = 0, o = 0; i < book->dim; i++, o += step)
- for(j = 0; j < step; j++)
- a[o+j] += t[j][i];
+long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
+ if(book->used_entries>0){
+ int step=n/book->dim;
+ long *entry = alloca(sizeof(*entry)*step);
+ float **t = alloca(sizeof(*t)*step);
+ int i,j,o;
+
+ for (i = 0; i < step; i++) {
+ entry[i]=decode_packed_entry_number(book,b);
+ if(entry[i]==-1)return(-1);
+ t[i] = book->valuelist+entry[i]*book->dim;
}
- return(0);
+ for(i=0,o=0;i<book->dim;i++,o+=step)
+ for (j=0;j<step;j++)
+ a[o+j]+=t[j][i];
+ }
+ return(0);
}
-long vorbis_book_decodev_add(codebook *book, float *a, oggpack_buffer *b, int n)
-{
- if(book->used_entries > 0)
- {
- int i, j, entry;
- float *t;
-
- if(book->dim > 8)
- {
- for(i = 0; i < n;)
- {
- entry = decode_packed_entry_number(book, b);
- if(entry == -1)return(-1);
- t = book->valuelist + entry * book->dim;
- for(j = 0; j < book->dim;)
- a[i++] += t[j++];
- }
- }
- else
- {
- for(i = 0; i < n;)
- {
- entry = decode_packed_entry_number(book, b);
- if(entry == -1)return(-1);
- t = book->valuelist + entry * book->dim;
- j = 0;
- switch((int)book->dim)
- {
- case 8:
- a[i++] += t[j++];
- case 7:
- a[i++] += t[j++];
- case 6:
- a[i++] += t[j++];
- case 5:
- a[i++] += t[j++];
- case 4:
- a[i++] += t[j++];
- case 3:
- a[i++] += t[j++];
- case 2:
- a[i++] += t[j++];
- case 1:
- a[i++] += t[j++];
- case 0:
- break;
- }
- }
+long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
+ if(book->used_entries>0){
+ int i,j,entry;
+ float *t;
+
+ if(book->dim>8){
+ for(i=0;i<n;){
+ entry = decode_packed_entry_number(book,b);
+ if(entry==-1)return(-1);
+ t = book->valuelist+entry*book->dim;
+ for (j=0;j<book->dim;)
+ a[i++]+=t[j++];
+ }
+ }else{
+ for(i=0;i<n;){
+ entry = decode_packed_entry_number(book,b);
+ if(entry==-1)return(-1);
+ t = book->valuelist+entry*book->dim;
+ j=0;
+ switch((int)book->dim){
+ case 8:
+ a[i++]+=t[j++];
+ case 7:
+ a[i++]+=t[j++];
+ case 6:
+ a[i++]+=t[j++];
+ case 5:
+ a[i++]+=t[j++];
+ case 4:
+ a[i++]+=t[j++];
+ case 3:
+ a[i++]+=t[j++];
+ case 2:
+ a[i++]+=t[j++];
+ case 1:
+ a[i++]+=t[j++];
+ case 0:
+ break;
}
+ }
}
- return(0);
+ }
+ return(0);
}
-long vorbis_book_decodev_set(codebook *book, float *a, oggpack_buffer *b, int n)
-{
- if(book->used_entries > 0)
- {
- int i, j, entry;
- float *t;
-
- for(i = 0; i < n;)
- {
- entry = decode_packed_entry_number(book, b);
- if(entry == -1)return(-1);
- t = book->valuelist + entry * book->dim;
- for(j = 0; j < book->dim;)
- a[i++] = t[j++];
- }
+long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
+ if(book->used_entries>0){
+ int i,j,entry;
+ float *t;
+
+ for(i=0;i<n;){
+ entry = decode_packed_entry_number(book,b);
+ if(entry==-1)return(-1);
+ t = book->valuelist+entry*book->dim;
+ for (j=0;j<book->dim;)
+ a[i++]=t[j++];
}
- else
- {
- int i, j;
+ }else{
+ int i,j;
- for(i = 0; i < n;)
- {
- for(j = 0; j < book->dim;)
- a[i++] = 0.f;
- }
+ for(i=0;i<n;){
+ for (j=0;j<book->dim;)
+ a[i++]=0.f;
}
- return(0);
+ }
+ return(0);
}
-long vorbis_book_decodevv_add(codebook *book, float **a, long offset, int ch,
- oggpack_buffer *b, int n)
-{
-
- long i, j, entry;
- int chptr = 0;
- if(book->used_entries > 0)
- {
- for(i = offset / ch; i < (offset + n) / ch;)
- {
- entry = decode_packed_entry_number(book, b);
- if(entry == -1)return(-1);
- {
- const float *t = book->valuelist + entry * book->dim;
- for(j = 0; j < book->dim; j++)
- {
- a[chptr++][i] += t[j];
- if(chptr == ch)
- {
- chptr = 0;
- i++;
- }
- }
- }
+long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
+ oggpack_buffer *b,int n){
+
+ long i,j,entry;
+ int chptr=0;
+ if(book->used_entries>0){
+ for(i=offset/ch;i<(offset+n)/ch;){
+ entry = decode_packed_entry_number(book,b);
+ if(entry==-1)return(-1);
+ {
+ const float *t = book->valuelist+entry*book->dim;
+ for (j=0;j<book->dim;j++){
+ a[chptr++][i]+=t[j];
+ if(chptr==ch){
+ chptr=0;
+ i++;
+ }
}
+ }
}
- return(0);
+ }
+ return(0);
}
#ifdef _V_SELFTEST
@@ -576,142 +508,131 @@ long vorbis_book_decodevv_add(codebook *book, float **a, long offset, int ch,
#include "vorbis/book/res0a_13.vqh"
#define TESTSIZE 40
-float test1[TESTSIZE] =
-{
- 0.105939f,
- 0.215373f,
- 0.429117f,
- 0.587974f,
-
- 0.181173f,
- 0.296583f,
- 0.515707f,
- 0.715261f,
-
- 0.162327f,
- 0.263834f,
- 0.342876f,
- 0.406025f,
-
- 0.103571f,
- 0.223561f,
- 0.368513f,
- 0.540313f,
-
- 0.136672f,
- 0.395882f,
- 0.587183f,
- 0.652476f,
-
- 0.114338f,
- 0.417300f,
- 0.525486f,
- 0.698679f,
-
- 0.147492f,
- 0.324481f,
- 0.643089f,
- 0.757582f,
-
- 0.139556f,
- 0.215795f,
- 0.324559f,
- 0.399387f,
-
- 0.120236f,
- 0.267420f,
- 0.446940f,
- 0.608760f,
-
- 0.115587f,
- 0.287234f,
- 0.571081f,
- 0.708603f,
+float test1[TESTSIZE]={
+ 0.105939f,
+ 0.215373f,
+ 0.429117f,
+ 0.587974f,
+
+ 0.181173f,
+ 0.296583f,
+ 0.515707f,
+ 0.715261f,
+
+ 0.162327f,
+ 0.263834f,
+ 0.342876f,
+ 0.406025f,
+
+ 0.103571f,
+ 0.223561f,
+ 0.368513f,
+ 0.540313f,
+
+ 0.136672f,
+ 0.395882f,
+ 0.587183f,
+ 0.652476f,
+
+ 0.114338f,
+ 0.417300f,
+ 0.525486f,
+ 0.698679f,
+
+ 0.147492f,
+ 0.324481f,
+ 0.643089f,
+ 0.757582f,
+
+ 0.139556f,
+ 0.215795f,
+ 0.324559f,
+ 0.399387f,
+
+ 0.120236f,
+ 0.267420f,
+ 0.446940f,
+ 0.608760f,
+
+ 0.115587f,
+ 0.287234f,
+ 0.571081f,
+ 0.708603f,
};
-float test3[TESTSIZE] =
-{
- 0, 1, -2, 3, 4, -5, 6, 7, 8, 9,
- 8, -2, 7, -1, 4, 6, 8, 3, 1, -9,
- 10, 11, 12, 13, 14, 15, 26, 17, 18, 19,
- 30, -25, -30, -1, -5, -32, 4, 3, -2, 0
-};
-
-static_codebook *testlist[] = {&_vq_book_lsp20_0,
- &_vq_book_res0a_13, NULL
- };
-float *testvec[] = {test1, test3};
-
-int main()
-{
- oggpack_buffer write;
- oggpack_buffer read;
- long ptr = 0, i;
- oggpack_writeinit(&write);
-
- fprintf(stderr, "Testing codebook abstraction...:\n");
-
- while(testlist[ptr])
- {
- codebook c;
- static_codebook s;
- float *qv = alloca(sizeof(*qv) * TESTSIZE);
- float *iv = alloca(sizeof(*iv) * TESTSIZE);
- memcpy(qv, testvec[ptr], sizeof(*qv)*TESTSIZE);
- memset(iv, 0, sizeof(*iv)*TESTSIZE);
-
- fprintf(stderr, "\tpacking/coding %ld... ", ptr);
-
- /* pack the codebook, write the testvector */
- oggpack_reset(&write);
- vorbis_book_init_encode(&c, testlist[ptr]); /* get it into memory
+float test3[TESTSIZE]={
+ 0,1,-2,3,4,-5,6,7,8,9,
+ 8,-2,7,-1,4,6,8,3,1,-9,
+ 10,11,12,13,14,15,26,17,18,19,
+ 30,-25,-30,-1,-5,-32,4,3,-2,0};
+
+static_codebook *testlist[]={&_vq_book_lsp20_0,
+ &_vq_book_res0a_13,NULL};
+float *testvec[]={test1,test3};
+
+int main(){
+ oggpack_buffer write;
+ oggpack_buffer read;
+ long ptr=0,i;
+ oggpack_writeinit(&write);
+
+ fprintf(stderr,"Testing codebook abstraction...:\n");
+
+ while(testlist[ptr]){
+ codebook c;
+ static_codebook s;
+ float *qv=alloca(sizeof(*qv)*TESTSIZE);
+ float *iv=alloca(sizeof(*iv)*TESTSIZE);
+ memcpy(qv,testvec[ptr],sizeof(*qv)*TESTSIZE);
+ memset(iv,0,sizeof(*iv)*TESTSIZE);
+
+ fprintf(stderr,"\tpacking/coding %ld... ",ptr);
+
+ /* pack the codebook, write the testvector */
+ oggpack_reset(&write);
+ vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory
we can write */
- vorbis_staticbook_pack(testlist[ptr], &write);
- fprintf(stderr, "Codebook size %ld bytes... ", oggpack_bytes(&write));
- for(i = 0; i < TESTSIZE; i += c.dim)
- {
- int best = _best(&c, qv + i, 1);
- vorbis_book_encodev(&c, best, qv + i, &write);
- }
- vorbis_book_clear(&c);
-
- fprintf(stderr, "OK.\n");
- fprintf(stderr, "\tunpacking/decoding %ld... ", ptr);
+ vorbis_staticbook_pack(testlist[ptr],&write);
+ fprintf(stderr,"Codebook size %ld bytes... ",oggpack_bytes(&write));
+ for(i=0;i<TESTSIZE;i+=c.dim){
+ int best=_best(&c,qv+i,1);
+ vorbis_book_encodev(&c,best,qv+i,&write);
+ }
+ vorbis_book_clear(&c);
- /* transfer the write data to a read buffer and unpack/read */
- oggpack_readinit(&read, oggpack_get_buffer(&write), oggpack_bytes(&write));
- if(vorbis_staticbook_unpack(&read, &s))
- {
- fprintf(stderr, "Error unpacking codebook.\n");
- exit(1);
- }
- if(vorbis_book_init_decode(&c, &s))
- {
- fprintf(stderr, "Error initializing codebook.\n");
- exit(1);
- }
+ fprintf(stderr,"OK.\n");
+ fprintf(stderr,"\tunpacking/decoding %ld... ",ptr);
- for(i = 0; i < TESTSIZE; i += c.dim)
- if(vorbis_book_decodev_set(&c, iv + i, &read, c.dim) == -1)
- {
- fprintf(stderr, "Error reading codebook test data (EOP).\n");
- exit(1);
- }
- for(i = 0; i < TESTSIZE; i++)
- if(fabs(qv[i] - iv[i]) > .000001)
- {
- fprintf(stderr, "read (%g) != written (%g) at position (%ld)\n",
- iv[i], qv[i], i);
- exit(1);
- }
-
- fprintf(stderr, "OK\n");
- ptr++;
+ /* transfer the write data to a read buffer and unpack/read */
+ oggpack_readinit(&read,oggpack_get_buffer(&write),oggpack_bytes(&write));
+ if(vorbis_staticbook_unpack(&read,&s)){
+ fprintf(stderr,"Error unpacking codebook.\n");
+ exit(1);
+ }
+ if(vorbis_book_init_decode(&c,&s)){
+ fprintf(stderr,"Error initializing codebook.\n");
+ exit(1);
}
- /* The above is the trivial stuff; now try unquantizing a log scale codebook */
-
- exit(0);
+ for(i=0;i<TESTSIZE;i+=c.dim)
+ if(vorbis_book_decodev_set(&c,iv+i,&read,c.dim)==-1){
+ fprintf(stderr,"Error reading codebook test data (EOP).\n");
+ exit(1);
+ }
+ for(i=0;i<TESTSIZE;i++)
+ if(fabs(qv[i]-iv[i])>.000001){
+ fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n",
+ iv[i],qv[i],i);
+ exit(1);
+ }
+
+ fprintf(stderr,"OK\n");
+ ptr++;
+ }
+
+ /* The above is the trivial stuff; now try unquantizing a log scale codebook */
+
+ exit(0);
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.h b/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.h
index 57e5118c9..9174de136 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/codebook.h
@@ -33,132 +33,127 @@
*/
-typedef struct static_codebook
-{
- long dim; /* codebook dimensions (elements per vector) */
- long entries; /* codebook entries */
- long *lengthlist; /* codeword lengths in bits */
-
- /* mapping ***************************************************************/
- int maptype; /* 0=none
+typedef struct static_codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ long *lengthlist; /* codeword lengths in bits */
+
+ /* mapping ***************************************************************/
+ int maptype; /* 0=none
1=implicitly populated values from map column
2=listed arbitrary values */
- /* The below does a linear, single monotonic sequence mapping. */
- long q_min; /* packed 32 bit float; quant value 0 maps to minval */
- long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
- int q_quant; /* bits: 0 < quant <= 16 */
- int q_sequencep; /* bitflag */
+ /* The below does a linear, single monotonic sequence mapping. */
+ long q_min; /* packed 32 bit float; quant value 0 maps to minval */
+ long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
+ int q_quant; /* bits: 0 < quant <= 16 */
+ int q_sequencep; /* bitflag */
- long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
+ long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
map == 2: list of dim*entries quantized entry vals
*/
- /* encode helpers ********************************************************/
- struct encode_aux_nearestmatch *nearest_tree;
- struct encode_aux_threshmatch *thresh_tree;
- struct encode_aux_pigeonhole *pigeon_tree;
+ /* encode helpers ********************************************************/
+ struct encode_aux_nearestmatch *nearest_tree;
+ struct encode_aux_threshmatch *thresh_tree;
+ struct encode_aux_pigeonhole *pigeon_tree;
- int allocedp;
+ int allocedp;
} static_codebook;
/* this structures an arbitrary trained book to quickly find the
nearest cell match */
-typedef struct encode_aux_nearestmatch
-{
- /* pre-calculated partitioning tree */
- long *ptr0;
- long *ptr1;
-
- long *p; /* decision points (each is an entry) */
- long *q; /* decision points (each is an entry) */
- long aux; /* number of tree entries */
- long alloc;
+typedef struct encode_aux_nearestmatch{
+ /* pre-calculated partitioning tree */
+ long *ptr0;
+ long *ptr1;
+
+ long *p; /* decision points (each is an entry) */
+ long *q; /* decision points (each is an entry) */
+ long aux; /* number of tree entries */
+ long alloc;
} encode_aux_nearestmatch;
/* assumes a maptype of 1; encode side only, so that's OK */
-typedef struct encode_aux_threshmatch
-{
- float *quantthresh;
- long *quantmap;
- int quantvals;
- int threshvals;
+typedef struct encode_aux_threshmatch{
+ float *quantthresh;
+ long *quantmap;
+ int quantvals;
+ int threshvals;
} encode_aux_threshmatch;
-typedef struct encode_aux_pigeonhole
-{
- float min;
- float del;
+typedef struct encode_aux_pigeonhole{
+ float min;
+ float del;
- int mapentries;
- int quantvals;
- long *pigeonmap;
+ int mapentries;
+ int quantvals;
+ long *pigeonmap;
- long fittotal;
- long *fitlist;
- long *fitmap;
- long *fitlength;
+ long fittotal;
+ long *fitlist;
+ long *fitmap;
+ long *fitlength;
} encode_aux_pigeonhole;
-typedef struct codebook
-{
- long dim; /* codebook dimensions (elements per vector) */
- long entries; /* codebook entries */
- long used_entries; /* populated codebook entries */
- const static_codebook *c;
-
- /* for encode, the below are entry-ordered, fully populated */
- /* for decode, the below are ordered by bitreversed codeword and only
- used entries are populated */
- float *valuelist; /* list of dim*entries actual entry values */
- ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
-
- int *dec_index; /* only used if sparseness collapsed */
- char *dec_codelengths;
- ogg_uint32_t *dec_firsttable;
- int dec_firsttablen;
- int dec_maxlength;
+typedef struct codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ long used_entries; /* populated codebook entries */
+ const static_codebook *c;
+
+ /* for encode, the below are entry-ordered, fully populated */
+ /* for decode, the below are ordered by bitreversed codeword and only
+ used entries are populated */
+ float *valuelist; /* list of dim*entries actual entry values */
+ ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
+
+ int *dec_index; /* only used if sparseness collapsed */
+ char *dec_codelengths;
+ ogg_uint32_t *dec_firsttable;
+ int dec_firsttablen;
+ int dec_maxlength;
} codebook;
extern void vorbis_staticbook_clear(static_codebook *b);
extern void vorbis_staticbook_destroy(static_codebook *b);
-extern int vorbis_book_init_encode(codebook *dest, const static_codebook *source);
-extern int vorbis_book_init_decode(codebook *dest, const static_codebook *source);
+extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
+extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
extern void vorbis_book_clear(codebook *b);
-extern float *_book_unquantize(const static_codebook *b, int n, int *map);
-extern float *_book_logdist(const static_codebook *b, float *vals);
+extern float *_book_unquantize(const static_codebook *b,int n,int *map);
+extern float *_book_logdist(const static_codebook *b,float *vals);
extern float _float32_unpack(long val);
extern long _float32_pack(float val);
extern int _best(codebook *book, float *a, int step);
extern int _ilog(unsigned int v);
extern long _book_maptype1_quantvals(const static_codebook *b);
-extern int vorbis_book_besterror(codebook *book, float *a, int step, int addmul);
-extern long vorbis_book_codeword(codebook *book, int entry);
-extern long vorbis_book_codelen(codebook *book, int entry);
+extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
+extern long vorbis_book_codeword(codebook *book,int entry);
+extern long vorbis_book_codelen(codebook *book,int entry);
-extern int vorbis_staticbook_pack(const static_codebook *c, oggpack_buffer *b);
-extern int vorbis_staticbook_unpack(oggpack_buffer *b, static_codebook *c);
+extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
+extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
extern int vorbis_book_errorv(codebook *book, float *a);
-extern int vorbis_book_encodev(codebook *book, int best, float *a,
+extern int vorbis_book_encodev(codebook *book, int best,float *a,
oggpack_buffer *b);
extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
extern long vorbis_book_decodevs_add(codebook *book, float *a,
- oggpack_buffer *b, int n);
+ oggpack_buffer *b,int n);
extern long vorbis_book_decodev_set(codebook *book, float *a,
- oggpack_buffer *b, int n);
+ oggpack_buffer *b,int n);
extern long vorbis_book_decodev_add(codebook *book, float *a,
- oggpack_buffer *b, int n);
+ oggpack_buffer *b,int n);
extern long vorbis_book_decodevv_add(codebook *book, float **a,
- long off, int ch,
- oggpack_buffer *b, int n);
+ long off,int ch,
+ oggpack_buffer *b,int n);
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/codec_internal.h b/src/filters/transform/MpaDecFilter/libvorbisidec/codec_internal.h
index 7abf2a82f..de1bccaed 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/codec_internal.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/codec_internal.h
@@ -28,13 +28,12 @@
#define PACKETBLOBS 15
-typedef struct vorbis_block_internal
-{
- float **pcmdelay; /* this is a pointer into local storage */
- float ampmax;
- int blocktype;
+typedef struct vorbis_block_internal{
+ float **pcmdelay; /* this is a pointer into local storage */
+ float ampmax;
+ int blocktype;
- oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
+ oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
blob [PACKETBLOBS/2] points to
the oggpack_buffer in the
main vorbis_block */
@@ -45,12 +44,11 @@ typedef void vorbis_look_residue;
typedef void vorbis_look_transform;
/* mode ************************************************************/
-typedef struct
-{
- int blockflag;
- int windowtype;
- int transformtype;
- int mapping;
+typedef struct {
+ int blockflag;
+ int windowtype;
+ int transformtype;
+ int mapping;
} vorbis_info_mode;
typedef void vorbis_info_floor;
@@ -60,31 +58,30 @@ typedef void vorbis_info_mapping;
#include "psy.h"
#include "bitrate.h"
-typedef struct private_state
-{
- /* local lookup storage */
- envelope_lookup *ve; /* envelope lookup */
- int window[2];
- vorbis_look_transform **transform[2]; /* block, type */
- drft_lookup fft_look[2];
-
- int modebits;
- vorbis_look_floor **flr;
- vorbis_look_residue **residue;
- vorbis_look_psy *psy;
- vorbis_look_psy_global *psy_g_look;
-
- /* local storage, only used on the encoding side. This way the
- application does not need to worry about freeing some packets'
- memory and not others'; packet storage is always tracked.
- Cleared next call to a _dsp_ function */
- unsigned char *header;
- unsigned char *header1;
- unsigned char *header2;
-
- bitrate_manager_state bms;
-
- ogg_int64_t sample_count;
+typedef struct private_state {
+ /* local lookup storage */
+ envelope_lookup *ve; /* envelope lookup */
+ int window[2];
+ vorbis_look_transform **transform[2]; /* block, type */
+ drft_lookup fft_look[2];
+
+ int modebits;
+ vorbis_look_floor **flr;
+ vorbis_look_residue **residue;
+ vorbis_look_psy *psy;
+ vorbis_look_psy_global *psy_g_look;
+
+ /* local storage, only used on the encoding side. This way the
+ application does not need to worry about freeing some packets'
+ memory and not others'; packet storage is always tracked.
+ Cleared next call to a _dsp_ function */
+ unsigned char *header;
+ unsigned char *header1;
+ unsigned char *header2;
+
+ bitrate_manager_state bms;
+
+ ogg_int64_t sample_count;
} private_state;
/* codec_setup_info contains all the setup information specific to the
@@ -94,44 +91,43 @@ typedef struct private_state
*********************************************************************/
#include "highlevel.h"
-typedef struct codec_setup_info
-{
-
- /* Vorbis supports only short and long blocks, but allows the
- encoder to choose the sizes */
-
- long blocksizes[2];
-
- /* modes are the primary means of supporting on-the-fly different
- blocksizes, different channel mappings (LR or M/A),
- different residue backends, etc. Each mode consists of a
- blocksize flag and a mapping (along with the mapping setup */
-
- int modes;
- int maps;
- int floors;
- int residues;
- int books;
- int psys; /* encode only */
-
- vorbis_info_mode *mode_param[64];
- int map_type[64];
- vorbis_info_mapping *map_param[64];
- int floor_type[64];
- vorbis_info_floor *floor_param[64];
- int residue_type[64];
- vorbis_info_residue *residue_param[64];
- static_codebook *book_param[256];
- codebook *fullbooks;
-
- vorbis_info_psy *psy_param[4]; /* encode only */
- vorbis_info_psy_global psy_g_param;
-
- bitrate_manager_info bi;
- highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
+typedef struct codec_setup_info {
+
+ /* Vorbis supports only short and long blocks, but allows the
+ encoder to choose the sizes */
+
+ long blocksizes[2];
+
+ /* modes are the primary means of supporting on-the-fly different
+ blocksizes, different channel mappings (LR or M/A),
+ different residue backends, etc. Each mode consists of a
+ blocksize flag and a mapping (along with the mapping setup */
+
+ int modes;
+ int maps;
+ int floors;
+ int residues;
+ int books;
+ int psys; /* encode only */
+
+ vorbis_info_mode *mode_param[64];
+ int map_type[64];
+ vorbis_info_mapping *map_param[64];
+ int floor_type[64];
+ vorbis_info_floor *floor_param[64];
+ int residue_type[64];
+ vorbis_info_residue *residue_param[64];
+ static_codebook *book_param[256];
+ codebook *fullbooks;
+
+ vorbis_info_psy *psy_param[4]; /* encode only */
+ vorbis_info_psy_global psy_g_param;
+
+ bitrate_manager_info bi;
+ highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
highly redundant structure, but
improves clarity of program flow. */
- int halfrate_flag; /* painless downsample for decode */
+ int halfrate_flag; /* painless downsample for decode */
} codec_setup_info;
extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
@@ -139,34 +135,33 @@ extern void _vp_global_free(vorbis_look_psy_global *look);
-typedef struct
-{
- int sorted_index[VIF_POSIT+2];
- int forward_index[VIF_POSIT+2];
- int reverse_index[VIF_POSIT+2];
+typedef struct {
+ int sorted_index[VIF_POSIT+2];
+ int forward_index[VIF_POSIT+2];
+ int reverse_index[VIF_POSIT+2];
- int hineighbor[VIF_POSIT];
- int loneighbor[VIF_POSIT];
- int posts;
+ int hineighbor[VIF_POSIT];
+ int loneighbor[VIF_POSIT];
+ int posts;
- int n;
- int quant_q;
- vorbis_info_floor1 *vi;
+ int n;
+ int quant_q;
+ vorbis_info_floor1 *vi;
- long phrasebits;
- long postbits;
- long frames;
+ long phrasebits;
+ long postbits;
+ long frames;
} vorbis_look_floor1;
-extern int *floor1_fit(vorbis_block *vb, vorbis_look_floor1 *look,
- const float *logmdct, /* in */
- const float *logmask);
-extern int *floor1_interpolate_fit(vorbis_block *vb, vorbis_look_floor1 *look,
- int *A, int *B,
- int del);
-extern int floor1_encode(oggpack_buffer *opb, vorbis_block *vb,
- vorbis_look_floor1 *look,
- int *post, int *ilogmask);
+extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+ const float *logmdct, /* in */
+ const float *logmask);
+extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+ int *A,int *B,
+ int del);
+extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
+ vorbis_look_floor1 *look,
+ int *post,int *ilogmask);
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.c b/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.c
index 680f91c6a..010c66e2d 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.c
@@ -29,71 +29,59 @@
#include "mdct.h"
#include "misc.h"
-void _ve_envelope_init(envelope_lookup *e, vorbis_info *vi)
-{
- codec_setup_info *ci = vi->codec_setup;
- vorbis_info_psy_global *gi = &ci->psy_g_param;
- int ch = vi->channels;
- int i, j;
- int n = e->winlength = 128;
- e->searchstep = 64; /* not random */
-
- e->minenergy = gi->preecho_minenergy;
- e->ch = ch;
- e->storage = 128;
- e->cursor = ci->blocksizes[1] / 2;
- e->mdct_win = _ogg_calloc(n, sizeof(*e->mdct_win));
- mdct_init(&e->mdct, n);
-
- for(i = 0; i < n; i++)
- {
- e->mdct_win[i] = sin(i / (n - 1.) * M_PI);
- e->mdct_win[i] *= e->mdct_win[i];
- }
-
- /* magic follows */
- e->band[0].begin = 2;
- e->band[0].end = 4;
- e->band[1].begin = 4;
- e->band[1].end = 5;
- e->band[2].begin = 6;
- e->band[2].end = 6;
- e->band[3].begin = 9;
- e->band[3].end = 8;
- e->band[4].begin = 13;
- e->band[4].end = 8;
- e->band[5].begin = 17;
- e->band[5].end = 8;
- e->band[6].begin = 22;
- e->band[6].end = 8;
-
- for(j = 0; j < VE_BANDS; j++)
- {
- n = e->band[j].end;
- e->band[j].window = _ogg_malloc(n * sizeof(*e->band[0].window));
- for(i = 0; i < n; i++)
- {
- e->band[j].window[i] = sin((i + .5) / n * M_PI);
- e->band[j].total += e->band[j].window[i];
- }
- e->band[j].total = 1. / e->band[j].total;
+void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
+ codec_setup_info *ci=vi->codec_setup;
+ vorbis_info_psy_global *gi=&ci->psy_g_param;
+ int ch=vi->channels;
+ int i,j;
+ int n=e->winlength=128;
+ e->searchstep=64; /* not random */
+
+ e->minenergy=gi->preecho_minenergy;
+ e->ch=ch;
+ e->storage=128;
+ e->cursor=ci->blocksizes[1]/2;
+ e->mdct_win=_ogg_calloc(n,sizeof(*e->mdct_win));
+ mdct_init(&e->mdct,n);
+
+ for(i=0;i<n;i++){
+ e->mdct_win[i]=sin(i/(n-1.)*M_PI);
+ e->mdct_win[i]*=e->mdct_win[i];
+ }
+
+ /* magic follows */
+ e->band[0].begin=2; e->band[0].end=4;
+ e->band[1].begin=4; e->band[1].end=5;
+ e->band[2].begin=6; e->band[2].end=6;
+ e->band[3].begin=9; e->band[3].end=8;
+ e->band[4].begin=13; e->band[4].end=8;
+ e->band[5].begin=17; e->band[5].end=8;
+ e->band[6].begin=22; e->band[6].end=8;
+
+ for(j=0;j<VE_BANDS;j++){
+ n=e->band[j].end;
+ e->band[j].window=_ogg_malloc(n*sizeof(*e->band[0].window));
+ for(i=0;i<n;i++){
+ e->band[j].window[i]=sin((i+.5)/n*M_PI);
+ e->band[j].total+=e->band[j].window[i];
}
+ e->band[j].total=1./e->band[j].total;
+ }
- e->filter = _ogg_calloc(VE_BANDS * ch, sizeof(*e->filter));
- e->mark = _ogg_calloc(e->storage, sizeof(*e->mark));
+ e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter));
+ e->mark=_ogg_calloc(e->storage,sizeof(*e->mark));
}
-void _ve_envelope_clear(envelope_lookup *e)
-{
- int i;
- mdct_clear(&e->mdct);
- for(i = 0; i < VE_BANDS; i++)
- _ogg_free(e->band[i].window);
- _ogg_free(e->mdct_win);
- _ogg_free(e->filter);
- _ogg_free(e->mark);
- memset(e, 0, sizeof(*e));
+void _ve_envelope_clear(envelope_lookup *e){
+ int i;
+ mdct_clear(&e->mdct);
+ for(i=0;i<VE_BANDS;i++)
+ _ogg_free(e->band[i].window);
+ _ogg_free(e->mdct_win);
+ _ogg_free(e->filter);
+ _ogg_free(e->mark);
+ memset(e,0,sizeof(*e));
}
/* fairly straight threshhold-by-band based until we find something
@@ -103,311 +91,285 @@ static int _ve_amp(envelope_lookup *ve,
vorbis_info_psy_global *gi,
float *data,
envelope_band *bands,
- envelope_filter_state *filters)
-{
- long n = ve->winlength;
- int ret = 0;
- long i, j;
- float decay;
-
- /* we want to have a 'minimum bar' for energy, else we're just
- basing blocks on quantization noise that outweighs the signal
- itself (for low power signals) */
-
- float minV = ve->minenergy;
- float *vec = alloca(n * sizeof(*vec));
-
- /* stretch is used to gradually lengthen the number of windows
- considered prevoius-to-potential-trigger */
- int stretch = max(VE_MINSTRETCH, ve->stretch / 2);
- float penalty = gi->stretch_penalty - (ve->stretch / 2 - VE_MINSTRETCH);
- if(penalty < 0.f)penalty = 0.f;
- if(penalty > gi->stretch_penalty)penalty = gi->stretch_penalty;
-
- /*_analysis_output_always("lpcm",seq2,data,n,0,0,
- totalshift+pos*ve->searchstep);*/
-
- /* window and transform */
- for(i = 0; i < n; i++)
- vec[i] = data[i] * ve->mdct_win[i];
- mdct_forward(&ve->mdct, vec, vec);
-
- /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
-
- /* near-DC spreading function; this has nothing to do with
- psychoacoustics, just sidelobe leakage and window size */
- {
- float temp = vec[0] * vec[0] + .7 * vec[1] * vec[1] + .2 * vec[2] * vec[2];
- int ptr = filters->nearptr;
-
- /* the accumulation is regularly refreshed from scratch to avoid
- floating point creep */
- if(ptr == 0)
- {
- decay = filters->nearDC_acc = filters->nearDC_partialacc + temp;
- filters->nearDC_partialacc = temp;
- }
- else
- {
- decay = filters->nearDC_acc += temp;
- filters->nearDC_partialacc += temp;
- }
- filters->nearDC_acc -= filters->nearDC[ptr];
- filters->nearDC[ptr] = temp;
-
- decay *= (1. / (VE_NEARDC + 1));
- filters->nearptr++;
- if(filters->nearptr >= VE_NEARDC)filters->nearptr = 0;
- decay = todB(&decay) * .5 - 15.f;
+ envelope_filter_state *filters){
+ long n=ve->winlength;
+ int ret=0;
+ long i,j;
+ float decay;
+
+ /* we want to have a 'minimum bar' for energy, else we're just
+ basing blocks on quantization noise that outweighs the signal
+ itself (for low power signals) */
+
+ float minV=ve->minenergy;
+ float *vec=alloca(n*sizeof(*vec));
+
+ /* stretch is used to gradually lengthen the number of windows
+ considered prevoius-to-potential-trigger */
+ int stretch=max(VE_MINSTRETCH,ve->stretch/2);
+ float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH);
+ if(penalty<0.f)penalty=0.f;
+ if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty;
+
+ /*_analysis_output_always("lpcm",seq2,data,n,0,0,
+ totalshift+pos*ve->searchstep);*/
+
+ /* window and transform */
+ for(i=0;i<n;i++)
+ vec[i]=data[i]*ve->mdct_win[i];
+ mdct_forward(&ve->mdct,vec,vec);
+
+ /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
+
+ /* near-DC spreading function; this has nothing to do with
+ psychoacoustics, just sidelobe leakage and window size */
+ {
+ float temp=vec[0]*vec[0]+.7*vec[1]*vec[1]+.2*vec[2]*vec[2];
+ int ptr=filters->nearptr;
+
+ /* the accumulation is regularly refreshed from scratch to avoid
+ floating point creep */
+ if(ptr==0){
+ decay=filters->nearDC_acc=filters->nearDC_partialacc+temp;
+ filters->nearDC_partialacc=temp;
+ }else{
+ decay=filters->nearDC_acc+=temp;
+ filters->nearDC_partialacc+=temp;
}
-
- /* perform spreading and limiting, also smooth the spectrum. yes,
- the MDCT results in all real coefficients, but it still *behaves*
- like real/imaginary pairs */
- for(i = 0; i < n / 2; i += 2)
+ filters->nearDC_acc-=filters->nearDC[ptr];
+ filters->nearDC[ptr]=temp;
+
+ decay*=(1./(VE_NEARDC+1));
+ filters->nearptr++;
+ if(filters->nearptr>=VE_NEARDC)filters->nearptr=0;
+ decay=todB(&decay)*.5-15.f;
+ }
+
+ /* perform spreading and limiting, also smooth the spectrum. yes,
+ the MDCT results in all real coefficients, but it still *behaves*
+ like real/imaginary pairs */
+ for(i=0;i<n/2;i+=2){
+ float val=vec[i]*vec[i]+vec[i+1]*vec[i+1];
+ val=todB(&val)*.5f;
+ if(val<decay)val=decay;
+ if(val<minV)val=minV;
+ vec[i>>1]=val;
+ decay-=8.;
+ }
+
+ /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
+
+ /* perform preecho/postecho triggering by band */
+ for(j=0;j<VE_BANDS;j++){
+ float acc=0.;
+ float valmax,valmin;
+
+ /* accumulate amplitude */
+ for(i=0;i<bands[j].end;i++)
+ acc+=vec[i+bands[j].begin]*bands[j].window[i];
+
+ acc*=bands[j].total;
+
+ /* convert amplitude to delta */
{
- float val = vec[i] * vec[i] + vec[i+1] * vec[i+1];
- val = todB(&val) * .5f;
- if(val < decay)val = decay;
- if(val < minV)val = minV;
- vec[i>>1] = val;
- decay -= 8.;
+ int p,this=filters[j].ampptr;
+ float postmax,postmin,premax=-99999.f,premin=99999.f;
+
+ p=this;
+ p--;
+ if(p<0)p+=VE_AMP;
+ postmax=max(acc,filters[j].ampbuf[p]);
+ postmin=min(acc,filters[j].ampbuf[p]);
+
+ for(i=0;i<stretch;i++){
+ p--;
+ if(p<0)p+=VE_AMP;
+ premax=max(premax,filters[j].ampbuf[p]);
+ premin=min(premin,filters[j].ampbuf[p]);
+ }
+
+ valmin=postmin-premin;
+ valmax=postmax-premax;
+
+ /*filters[j].markers[pos]=valmax;*/
+ filters[j].ampbuf[this]=acc;
+ filters[j].ampptr++;
+ if(filters[j].ampptr>=VE_AMP)filters[j].ampptr=0;
}
- /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
-
- /* perform preecho/postecho triggering by band */
- for(j = 0; j < VE_BANDS; j++)
- {
- float acc = 0.;
- float valmax, valmin;
-
- /* accumulate amplitude */
- for(i = 0; i < bands[j].end; i++)
- acc += vec[i+bands[j].begin] * bands[j].window[i];
-
- acc *= bands[j].total;
-
- /* convert amplitude to delta */
- {
- int p, this = filters[j].ampptr;
- float postmax, postmin, premax = -99999.f, premin = 99999.f;
-
- p = this;
- p--;
- if(p < 0)p += VE_AMP;
- postmax = max(acc, filters[j].ampbuf[p]);
- postmin = min(acc, filters[j].ampbuf[p]);
-
- for(i = 0; i < stretch; i++)
- {
- p--;
- if(p < 0)p += VE_AMP;
- premax = max(premax, filters[j].ampbuf[p]);
- premin = min(premin, filters[j].ampbuf[p]);
- }
-
- valmin = postmin - premin;
- valmax = postmax - premax;
-
- /*filters[j].markers[pos]=valmax;*/
- filters[j].ampbuf[this] = acc;
- filters[j].ampptr++;
- if(filters[j].ampptr >= VE_AMP)filters[j].ampptr = 0;
- }
-
- /* look at min/max, decide trigger */
- if(valmax > gi->preecho_thresh[j] + penalty)
- {
- ret |= 1;
- ret |= 4;
- }
- if(valmin < gi->postecho_thresh[j] - penalty)ret |= 2;
+ /* look at min/max, decide trigger */
+ if(valmax>gi->preecho_thresh[j]+penalty){
+ ret|=1;
+ ret|=4;
}
+ if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
+ }
- return(ret);
+ return(ret);
}
#if 0
-static int seq = 0;
-static ogg_int64_t totalshift = -1024;
+static int seq=0;
+static ogg_int64_t totalshift=-1024;
#endif
-long _ve_envelope_search(vorbis_dsp_state *v)
-{
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
- vorbis_info_psy_global *gi = &ci->psy_g_param;
- envelope_lookup *ve = ((private_state *)(v->backend_state))->ve;
- long i, j;
+long _ve_envelope_search(vorbis_dsp_state *v){
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ vorbis_info_psy_global *gi=&ci->psy_g_param;
+ envelope_lookup *ve=((private_state *)(v->backend_state))->ve;
+ long i,j;
+
+ int first=ve->current/ve->searchstep;
+ int last=v->pcm_current/ve->searchstep-VE_WIN;
+ if(first<0)first=0;
+
+ /* make sure we have enough storage to match the PCM */
+ if(last+VE_WIN+VE_POST>ve->storage){
+ ve->storage=last+VE_WIN+VE_POST; /* be sure */
+ ve->mark=_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark));
+ }
+
+ for(j=first;j<last;j++){
+ int ret=0;
+
+ ve->stretch++;
+ if(ve->stretch>VE_MAXSTRETCH*2)
+ ve->stretch=VE_MAXSTRETCH*2;
+
+ for(i=0;i<ve->ch;i++){
+ float *pcm=v->pcm[i]+ve->searchstep*(j);
+ ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS);
+ }
- int first = ve->current / ve->searchstep;
- int last = v->pcm_current / ve->searchstep - VE_WIN;
- if(first < 0)first = 0;
+ ve->mark[j+VE_POST]=0;
+ if(ret&1){
+ ve->mark[j]=1;
+ ve->mark[j+1]=1;
+ }
- /* make sure we have enough storage to match the PCM */
- if(last + VE_WIN + VE_POST > ve->storage)
- {
- ve->storage = last + VE_WIN + VE_POST; /* be sure */
- ve->mark = _ogg_realloc(ve->mark, ve->storage * sizeof(*ve->mark));
+ if(ret&2){
+ ve->mark[j]=1;
+ if(j>0)ve->mark[j-1]=1;
}
- for(j = first; j < last; j++)
- {
- int ret = 0;
+ if(ret&4)ve->stretch=-1;
+ }
- ve->stretch++;
- if(ve->stretch > VE_MAXSTRETCH * 2)
- ve->stretch = VE_MAXSTRETCH * 2;
+ ve->current=last*ve->searchstep;
- for(i = 0; i < ve->ch; i++)
- {
- float *pcm = v->pcm[i] + ve->searchstep * (j);
- ret |= _ve_amp(ve, gi, pcm, ve->band, ve->filter + i * VE_BANDS);
- }
+ {
+ long centerW=v->centerW;
+ long testW=
+ centerW+
+ ci->blocksizes[v->W]/4+
+ ci->blocksizes[1]/2+
+ ci->blocksizes[0]/4;
- ve->mark[j+VE_POST] = 0;
- if(ret & 1)
- {
- ve->mark[j] = 1;
- ve->mark[j+1] = 1;
- }
+ j=ve->cursor;
- if(ret & 2)
- {
- ve->mark[j] = 1;
- if(j > 0)ve->mark[j-1] = 1;
- }
+ while(j<ve->current-(ve->searchstep)){/* account for postecho
+ working back one window */
+ if(j>=testW)return(1);
- if(ret & 4)ve->stretch = -1;
- }
+ ve->cursor=j;
- ve->current = last * ve->searchstep;
+ if(ve->mark[j/ve->searchstep]){
+ if(j>centerW){
- {
- long centerW = v->centerW;
- long testW =
- centerW +
- ci->blocksizes[v->W] / 4 +
- ci->blocksizes[1] / 2 +
- ci->blocksizes[0] / 4;
+#if 0
+ if(j>ve->curmark){
+ float *marker=alloca(v->pcm_current*sizeof(*marker));
+ int l,m;
+ memset(marker,0,sizeof(*marker)*v->pcm_current);
+ fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n",
+ seq,
+ (totalshift+ve->cursor)/44100.,
+ (totalshift+j)/44100.);
+ _analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift);
+ _analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift);
+
+ _analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
+ _analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
+
+ for(m=0;m<VE_BANDS;m++){
+ char buf[80];
+ sprintf(buf,"delL%d",m);
+ for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1;
+ _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
+ }
- j = ve->cursor;
+ for(m=0;m<VE_BANDS;m++){
+ char buf[80];
+ sprintf(buf,"delR%d",m);
+ for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1;
+ _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
+ }
- while(j < ve->current - (ve->searchstep))
- {
- /* account for postecho
- working back one window */
- if(j >= testW)return(1);
+ for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->mark[l]*.4;
+ _analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift);
- ve->cursor = j;
- if(ve->mark[j/ve->searchstep])
- {
- if(j > centerW)
- {
+ seq++;
-#if 0
- if(j > ve->curmark)
- {
- float *marker = alloca(v->pcm_current * sizeof(*marker));
- int l, m;
- memset(marker, 0, sizeof(*marker)*v->pcm_current);
- fprintf(stderr, "mark! seq=%d, cursor:%fs time:%fs\n",
- seq,
- (totalshift + ve->cursor) / 44100.,
- (totalshift + j) / 44100.);
- _analysis_output_always("pcmL", seq, v->pcm[0], v->pcm_current, 0, 0, totalshift);
- _analysis_output_always("pcmR", seq, v->pcm[1], v->pcm_current, 0, 0, totalshift);
-
- _analysis_output_always("markL", seq, v->pcm[0], j, 0, 0, totalshift);
- _analysis_output_always("markR", seq, v->pcm[1], j, 0, 0, totalshift);
-
- for(m = 0; m < VE_BANDS; m++)
- {
- char buf[80];
- sprintf(buf, "delL%d", m);
- for(l = 0; l < last; l++)marker[l*ve->searchstep] = ve->filter[m].markers[l] * .1;
- _analysis_output_always(buf, seq, marker, v->pcm_current, 0, 0, totalshift);
- }
-
- for(m = 0; m < VE_BANDS; m++)
- {
- char buf[80];
- sprintf(buf, "delR%d", m);
- for(l = 0; l < last; l++)marker[l*ve->searchstep] = ve->filter[m+VE_BANDS].markers[l] * .1;
- _analysis_output_always(buf, seq, marker, v->pcm_current, 0, 0, totalshift);
- }
-
- for(l = 0; l < last; l++)marker[l*ve->searchstep] = ve->mark[l] * .4;
- _analysis_output_always("mark", seq, marker, v->pcm_current, 0, 0, totalshift);
-
-
- seq++;
-
- }
+ }
#endif
- ve->curmark = j;
- if(j >= testW)return(1);
- return(0);
- }
- }
- j += ve->searchstep;
+ ve->curmark=j;
+ if(j>=testW)return(1);
+ return(0);
}
+ }
+ j+=ve->searchstep;
}
+ }
- return(-1);
+ return(-1);
}
-int _ve_envelope_mark(vorbis_dsp_state *v)
-{
- envelope_lookup *ve = ((private_state *)(v->backend_state))->ve;
- vorbis_info *vi = v->vi;
- codec_setup_info *ci = vi->codec_setup;
- long centerW = v->centerW;
- long beginW = centerW - ci->blocksizes[v->W] / 4;
- long endW = centerW + ci->blocksizes[v->W] / 4;
- if(v->W)
- {
- beginW -= ci->blocksizes[v->lW] / 4;
- endW += ci->blocksizes[v->nW] / 4;
- }
- else
- {
- beginW -= ci->blocksizes[0] / 4;
- endW += ci->blocksizes[0] / 4;
- }
-
- if(ve->curmark >= beginW && ve->curmark < endW)return(1);
- {
- long first = beginW / ve->searchstep;
- long last = endW / ve->searchstep;
- long i;
- for(i = first; i < last; i++)
- if(ve->mark[i])return(1);
- }
- return(0);
+int _ve_envelope_mark(vorbis_dsp_state *v){
+ envelope_lookup *ve=((private_state *)(v->backend_state))->ve;
+ vorbis_info *vi=v->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ long centerW=v->centerW;
+ long beginW=centerW-ci->blocksizes[v->W]/4;
+ long endW=centerW+ci->blocksizes[v->W]/4;
+ if(v->W){
+ beginW-=ci->blocksizes[v->lW]/4;
+ endW+=ci->blocksizes[v->nW]/4;
+ }else{
+ beginW-=ci->blocksizes[0]/4;
+ endW+=ci->blocksizes[0]/4;
+ }
+
+ if(ve->curmark>=beginW && ve->curmark<endW)return(1);
+ {
+ long first=beginW/ve->searchstep;
+ long last=endW/ve->searchstep;
+ long i;
+ for(i=first;i<last;i++)
+ if(ve->mark[i])return(1);
+ }
+ return(0);
}
-void _ve_envelope_shift(envelope_lookup *e, long shift)
-{
- int smallsize = e->current / e->searchstep + VE_POST; /* adjust for placing marks
+void _ve_envelope_shift(envelope_lookup *e,long shift){
+ int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks
ahead of ve->current */
- int smallshift = shift / e->searchstep;
+ int smallshift=shift/e->searchstep;
- memmove(e->mark, e->mark + smallshift, (smallsize - smallshift)*sizeof(*e->mark));
+ memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
#if 0
- for(i = 0; i < VE_BANDS * e->ch; i++)
- memmove(e->filter[i].markers,
- e->filter[i].markers + smallshift,
- (1024 - smallshift)*sizeof(*(*e->filter).markers));
- totalshift += shift;
+ for(i=0;i<VE_BANDS*e->ch;i++)
+ memmove(e->filter[i].markers,
+ e->filter[i].markers+smallshift,
+ (1024-smallshift)*sizeof(*(*e->filter).markers));
+ totalshift+=shift;
#endif
- e->current -= shift;
- if(e->curmark >= 0)
- e->curmark -= shift;
- e->cursor -= shift;
+ e->current-=shift;
+ if(e->curmark>=0)
+ e->curmark-=shift;
+ e->cursor-=shift;
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.h b/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.h
index 8423f41ab..fd15fb32a 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/envelope.h
@@ -31,52 +31,49 @@
#define VE_MINSTRETCH 2 /* a bit less than short block */
#define VE_MAXSTRETCH 12 /* one-third full block */
-typedef struct
-{
- float ampbuf[VE_AMP];
- int ampptr;
+typedef struct {
+ float ampbuf[VE_AMP];
+ int ampptr;
- float nearDC[VE_NEARDC];
- float nearDC_acc;
- float nearDC_partialacc;
- int nearptr;
+ float nearDC[VE_NEARDC];
+ float nearDC_acc;
+ float nearDC_partialacc;
+ int nearptr;
} envelope_filter_state;
-typedef struct
-{
- int begin;
- int end;
- float *window;
- float total;
+typedef struct {
+ int begin;
+ int end;
+ float *window;
+ float total;
} envelope_band;
-typedef struct
-{
- int ch;
- int winlength;
- int searchstep;
- float minenergy;
+typedef struct {
+ int ch;
+ int winlength;
+ int searchstep;
+ float minenergy;
- mdct_lookup mdct;
- float *mdct_win;
+ mdct_lookup mdct;
+ float *mdct_win;
- envelope_band band[VE_BANDS];
- envelope_filter_state *filter;
- int stretch;
+ envelope_band band[VE_BANDS];
+ envelope_filter_state *filter;
+ int stretch;
- int *mark;
+ int *mark;
- long storage;
- long current;
- long curmark;
- long cursor;
+ long storage;
+ long current;
+ long curmark;
+ long cursor;
} envelope_lookup;
-extern void _ve_envelope_init(envelope_lookup *e, vorbis_info *vi);
+extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi);
extern void _ve_envelope_clear(envelope_lookup *e);
extern long _ve_envelope_search(vorbis_dsp_state *v);
-extern void _ve_envelope_shift(envelope_lookup *e, long shift);
+extern void _ve_envelope_shift(envelope_lookup *e,long shift);
extern int _ve_envelope_mark(vorbis_dsp_state *v);
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/floor0.c b/src/filters/transform/MpaDecFilter/libvorbisidec/floor0.c
index 536c754d8..1e8bd30ab 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/floor0.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/floor0.c
@@ -32,79 +32,71 @@
#include "misc.h"
#include <stdio.h>
-typedef struct
-{
- int ln;
- int m;
- int **linearmap;
- int n[2];
+typedef struct {
+ int ln;
+ int m;
+ int **linearmap;
+ int n[2];
- vorbis_info_floor0 *vi;
+ vorbis_info_floor0 *vi;
- long bits;
- long frames;
+ long bits;
+ long frames;
} vorbis_look_floor0;
/***********************************************/
-static void floor0_free_info(vorbis_info_floor *i)
-{
- vorbis_info_floor0 *info = (vorbis_info_floor0 *)i;
- if(info)
- {
- memset(info, 0, sizeof(*info));
- _ogg_free(info);
- }
+static void floor0_free_info(vorbis_info_floor *i){
+ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+ if(info){
+ memset(info,0,sizeof(*info));
+ _ogg_free(info);
+ }
}
-static void floor0_free_look(vorbis_look_floor *i)
-{
- vorbis_look_floor0 *look = (vorbis_look_floor0 *)i;
- if(look)
- {
+static void floor0_free_look(vorbis_look_floor *i){
+ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+ if(look){
- if(look->linearmap)
- {
+ if(look->linearmap){
- if(look->linearmap[0])_ogg_free(look->linearmap[0]);
- if(look->linearmap[1])_ogg_free(look->linearmap[1]);
+ if(look->linearmap[0])_ogg_free(look->linearmap[0]);
+ if(look->linearmap[1])_ogg_free(look->linearmap[1]);
- _ogg_free(look->linearmap);
- }
- memset(look, 0, sizeof(*look));
- _ogg_free(look);
+ _ogg_free(look->linearmap);
}
+ memset(look,0,sizeof(*look));
+ _ogg_free(look);
+ }
}
-static vorbis_info_floor *floor0_unpack(vorbis_info *vi, oggpack_buffer *opb)
-{
- codec_setup_info *ci = vi->codec_setup;
- int j;
-
- vorbis_info_floor0 *info = _ogg_malloc(sizeof(*info));
- info->order = oggpack_read(opb, 8);
- info->rate = oggpack_read(opb, 16);
- info->barkmap = oggpack_read(opb, 16);
- info->ampbits = oggpack_read(opb, 6);
- info->ampdB = oggpack_read(opb, 8);
- info->numbooks = oggpack_read(opb, 4) + 1;
-
- if(info->order < 1)goto err_out;
- if(info->rate < 1)goto err_out;
- if(info->barkmap < 1)goto err_out;
- if(info->numbooks < 1)goto err_out;
-
- for(j = 0; j < info->numbooks; j++)
- {
- info->books[j] = oggpack_read(opb, 8);
- if(info->books[j] < 0 || info->books[j] >= ci->books)goto err_out;
- }
- return(info);
-
-err_out:
- floor0_free_info(info);
- return(NULL);
+static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
+ codec_setup_info *ci=vi->codec_setup;
+ int j;
+
+ vorbis_info_floor0 *info=_ogg_malloc(sizeof(*info));
+ info->order=oggpack_read(opb,8);
+ info->rate=oggpack_read(opb,16);
+ info->barkmap=oggpack_read(opb,16);
+ info->ampbits=oggpack_read(opb,6);
+ info->ampdB=oggpack_read(opb,8);
+ info->numbooks=oggpack_read(opb,4)+1;
+
+ if(info->order<1)goto err_out;
+ if(info->rate<1)goto err_out;
+ if(info->barkmap<1)goto err_out;
+ if(info->numbooks<1)goto err_out;
+
+ for(j=0;j<info->numbooks;j++){
+ info->books[j]=oggpack_read(opb,8);
+ if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
+ }
+ return(info);
+
+ err_out:
+ floor0_free_info(info);
+ return(NULL);
}
/* initialize Bark scale and normalization lookups. We could do this
@@ -117,123 +109,112 @@ err_out:
static void floor0_map_lazy_init(vorbis_block *vb,
vorbis_info_floor *infoX,
- vorbis_look_floor0 *look)
-{
- if(!look->linearmap[vb->W])
- {
- vorbis_dsp_state *vd = vb->vd;
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- vorbis_info_floor0 *info = (vorbis_info_floor0 *)infoX;
- int W = vb->W;
- int n = ci->blocksizes[W] / 2, j;
-
- /* we choose a scaling constant so that:
- floor(bark(rate/2-1)*C)=mapped-1
- floor(bark(rate/2)*C)=mapped */
- float scale = look->ln / toBARK(info->rate / 2.f);
-
- /* the mapping from a linear scale to a smaller bark scale is
- straightforward. We do *not* make sure that the linear mapping
- does not skip bark-scale bins; the decoder simply skips them and
- the encoder may do what it wishes in filling them. They're
- necessary in some mapping combinations to keep the scale spacing
- accurate */
- look->linearmap[W] = _ogg_malloc((n + 1) * sizeof(**look->linearmap));
- for(j = 0; j < n; j++)
- {
- int val = floor(toBARK((info->rate / 2.f) / n * j)
- * scale); /* bark numbers represent band edges */
- if(val >= look->ln)val = look->ln - 1; /* guard against the approximation */
- look->linearmap[W][j] = val;
- }
- look->linearmap[W][j] = -1;
- look->n[W] = n;
+ vorbis_look_floor0 *look){
+ if(!look->linearmap[vb->W]){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ vorbis_info_floor0 *info=(vorbis_info_floor0 *)infoX;
+ int W=vb->W;
+ int n=ci->blocksizes[W]/2,j;
+
+ /* we choose a scaling constant so that:
+ floor(bark(rate/2-1)*C)=mapped-1
+ floor(bark(rate/2)*C)=mapped */
+ float scale=look->ln/toBARK(info->rate/2.f);
+
+ /* the mapping from a linear scale to a smaller bark scale is
+ straightforward. We do *not* make sure that the linear mapping
+ does not skip bark-scale bins; the decoder simply skips them and
+ the encoder may do what it wishes in filling them. They're
+ necessary in some mapping combinations to keep the scale spacing
+ accurate */
+ look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
+ for(j=0;j<n;j++){
+ int val=floor( toBARK((info->rate/2.f)/n*j)
+ *scale); /* bark numbers represent band edges */
+ if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
+ look->linearmap[W][j]=val;
}
+ look->linearmap[W][j]=-1;
+ look->n[W]=n;
+ }
}
static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
- vorbis_info_floor *i)
-{
- vorbis_info_floor0 *info = (vorbis_info_floor0 *)i;
- vorbis_look_floor0 *look = _ogg_calloc(1, sizeof(*look));
- look->m = info->order;
- look->ln = info->barkmap;
- look->vi = info;
+ vorbis_info_floor *i){
+ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+ vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
+ look->m=info->order;
+ look->ln=info->barkmap;
+ look->vi=info;
- look->linearmap = _ogg_calloc(2, sizeof(*look->linearmap));
+ look->linearmap=_ogg_calloc(2,sizeof(*look->linearmap));
- return look;
+ return look;
}
-static void *floor0_inverse1(vorbis_block *vb, vorbis_look_floor *i)
-{
- vorbis_look_floor0 *look = (vorbis_look_floor0 *)i;
- vorbis_info_floor0 *info = look->vi;
- int j, k;
-
- int ampraw = oggpack_read(&vb->opb, info->ampbits);
- if(ampraw > 0) /* also handles the -1 out of data case */
- {
- long maxval = (1 << info->ampbits) - 1;
- float amp = (float)ampraw / maxval * info->ampdB;
- int booknum = oggpack_read(&vb->opb, _ilog(info->numbooks));
-
- if(booknum != -1 && booknum < info->numbooks) /* be paranoid */
- {
- codec_setup_info *ci = vb->vd->vi->codec_setup;
- codebook *b = ci->fullbooks + info->books[booknum];
- float last = 0.f;
-
- /* the additional b->dim is a guard against any possible stack
- smash; b->dim is provably more than we can overflow the
- vector */
- float *lsp = _vorbis_block_alloc(vb, sizeof(*lsp) * (look->m + b->dim + 1));
-
- for(j = 0; j < look->m; j += b->dim)
- if(vorbis_book_decodev_set(b, lsp + j, &vb->opb, b->dim) == -1)goto eop;
- for(j = 0; j < look->m;)
- {
- for(k = 0; k < b->dim; k++, j++)lsp[j] += last;
- last = lsp[j-1];
- }
-
- lsp[look->m] = amp;
- return(lsp);
- }
+static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
+ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+ vorbis_info_floor0 *info=look->vi;
+ int j,k;
+
+ int ampraw=oggpack_read(&vb->opb,info->ampbits);
+ if(ampraw>0){ /* also handles the -1 out of data case */
+ long maxval=(1<<info->ampbits)-1;
+ float amp=(float)ampraw/maxval*info->ampdB;
+ int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
+
+ if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
+ codec_setup_info *ci=vb->vd->vi->codec_setup;
+ codebook *b=ci->fullbooks+info->books[booknum];
+ float last=0.f;
+
+ /* the additional b->dim is a guard against any possible stack
+ smash; b->dim is provably more than we can overflow the
+ vector */
+ float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
+
+ for(j=0;j<look->m;j+=b->dim)
+ if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop;
+ for(j=0;j<look->m;){
+ for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
+ last=lsp[j-1];
+ }
+
+ lsp[look->m]=amp;
+ return(lsp);
}
-eop:
- return(NULL);
+ }
+ eop:
+ return(NULL);
}
-static int floor0_inverse2(vorbis_block *vb, vorbis_look_floor *i,
- void *memo, float *out)
-{
- vorbis_look_floor0 *look = (vorbis_look_floor0 *)i;
- vorbis_info_floor0 *info = look->vi;
-
- floor0_map_lazy_init(vb, info, look);
-
- if(memo)
- {
- float *lsp = (float *)memo;
- float amp = lsp[look->m];
-
- /* take the coefficients back to a spectral envelope curve */
- vorbis_lsp_to_curve(out,
- look->linearmap[vb->W],
- look->n[vb->W],
- look->ln,
- lsp, look->m, amp, (float)info->ampdB);
- return(1);
- }
- memset(out, 0, sizeof(*out)*look->n[vb->W]);
- return(0);
+static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
+ void *memo,float *out){
+ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+ vorbis_info_floor0 *info=look->vi;
+
+ floor0_map_lazy_init(vb,info,look);
+
+ if(memo){
+ float *lsp=(float *)memo;
+ float amp=lsp[look->m];
+
+ /* take the coefficients back to a spectral envelope curve */
+ vorbis_lsp_to_curve(out,
+ look->linearmap[vb->W],
+ look->n[vb->W],
+ look->ln,
+ lsp,look->m,amp,(float)info->ampdB);
+ return(1);
+ }
+ memset(out,0,sizeof(*out)*look->n[vb->W]);
+ return(0);
}
/* export hooks */
-const vorbis_func_floor floor0_exportbundle =
-{
- NULL, &floor0_unpack, &floor0_look, &floor0_free_info,
- &floor0_free_look, &floor0_inverse1, &floor0_inverse2
+const vorbis_func_floor floor0_exportbundle={
+ NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
+ &floor0_free_look,&floor0_inverse1,&floor0_inverse2
};
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/floor1.c b/src/filters/transform/MpaDecFilter/libvorbisidec/floor1.c
index 7baa19157..c031a2362 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/floor1.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/floor1.c
@@ -30,550 +30,498 @@
#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
-typedef struct lsfit_acc
-{
- long x0;
- long x1;
-
- long xa;
- long ya;
- long x2a;
- long y2a;
- long xya;
- long an;
+typedef struct lsfit_acc{
+ long x0;
+ long x1;
+
+ long xa;
+ long ya;
+ long x2a;
+ long y2a;
+ long xya;
+ long an;
} lsfit_acc;
/***********************************************/
-static void floor1_free_info(vorbis_info_floor *i)
-{
- vorbis_info_floor1 *info = (vorbis_info_floor1 *)i;
- if(info)
- {
- memset(info, 0, sizeof(*info));
- _ogg_free(info);
- }
+static void floor1_free_info(vorbis_info_floor *i){
+ vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
+ if(info){
+ memset(info,0,sizeof(*info));
+ _ogg_free(info);
+ }
}
-static void floor1_free_look(vorbis_look_floor *i)
-{
- vorbis_look_floor1 *look = (vorbis_look_floor1 *)i;
- if(look)
- {
- /*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n",
- (float)look->phrasebits/look->frames,
- (float)look->postbits/look->frames,
- (float)(look->postbits+look->phrasebits)/look->frames);*/
-
- memset(look, 0, sizeof(*look));
- _ogg_free(look);
- }
+static void floor1_free_look(vorbis_look_floor *i){
+ vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
+ if(look){
+ /*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n",
+ (float)look->phrasebits/look->frames,
+ (float)look->postbits/look->frames,
+ (float)(look->postbits+look->phrasebits)/look->frames);*/
+
+ memset(look,0,sizeof(*look));
+ _ogg_free(look);
+ }
}
-static int ilog(unsigned int v)
-{
- int ret = 0;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-static int ilog2(unsigned int v)
-{
- int ret = 0;
- if(v)--v;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog2(unsigned int v){
+ int ret=0;
+ if(v)--v;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-static void floor1_pack(vorbis_info_floor *i, oggpack_buffer *opb)
-{
- vorbis_info_floor1 *info = (vorbis_info_floor1 *)i;
- int j, k;
- int count = 0;
- int rangebits;
- int maxposit = info->postlist[1];
- int maxclass = -1;
-
- /* save out partitions */
- oggpack_write(opb, info->partitions, 5); /* only 0 to 31 legal */
- for(j = 0; j < info->partitions; j++)
- {
- oggpack_write(opb, info->partitionclass[j], 4); /* only 0 to 15 legal */
- if(maxclass < info->partitionclass[j])maxclass = info->partitionclass[j];
- }
-
- /* save out partition classes */
- for(j = 0; j < maxclass + 1; j++)
- {
- oggpack_write(opb, info->class_dim[j] - 1, 3); /* 1 to 8 */
- oggpack_write(opb, info->class_subs[j], 2); /* 0 to 3 */
- if(info->class_subs[j])oggpack_write(opb, info->class_book[j], 8);
- for(k = 0; k < (1 << info->class_subs[j]); k++)
- oggpack_write(opb, info->class_subbook[j][k] + 1, 8);
- }
-
- /* save out the post list */
- oggpack_write(opb, info->mult - 1, 2); /* only 1,2,3,4 legal now */
- oggpack_write(opb, ilog2(maxposit), 4);
- rangebits = ilog2(maxposit);
-
- for(j = 0, k = 0; j < info->partitions; j++)
- {
- count += info->class_dim[info->partitionclass[j]];
- for(; k < count; k++)
- oggpack_write(opb, info->postlist[k+2], rangebits);
- }
+static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){
+ vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
+ int j,k;
+ int count=0;
+ int rangebits;
+ int maxposit=info->postlist[1];
+ int maxclass=-1;
+
+ /* save out partitions */
+ oggpack_write(opb,info->partitions,5); /* only 0 to 31 legal */
+ for(j=0;j<info->partitions;j++){
+ oggpack_write(opb,info->partitionclass[j],4); /* only 0 to 15 legal */
+ if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
+ }
+
+ /* save out partition classes */
+ for(j=0;j<maxclass+1;j++){
+ oggpack_write(opb,info->class_dim[j]-1,3); /* 1 to 8 */
+ oggpack_write(opb,info->class_subs[j],2); /* 0 to 3 */
+ if(info->class_subs[j])oggpack_write(opb,info->class_book[j],8);
+ for(k=0;k<(1<<info->class_subs[j]);k++)
+ oggpack_write(opb,info->class_subbook[j][k]+1,8);
+ }
+
+ /* save out the post list */
+ oggpack_write(opb,info->mult-1,2); /* only 1,2,3,4 legal now */
+ oggpack_write(opb,ilog2(maxposit),4);
+ rangebits=ilog2(maxposit);
+
+ for(j=0,k=0;j<info->partitions;j++){
+ count+=info->class_dim[info->partitionclass[j]];
+ for(;k<count;k++)
+ oggpack_write(opb,info->postlist[k+2],rangebits);
+ }
}
-static int icomp(const void *a, const void *b)
-{
- return(**(int **)a - **(int **)b);
+static int icomp(const void *a,const void *b){
+ return(**(int **)a-**(int **)b);
}
-static vorbis_info_floor *floor1_unpack(vorbis_info *vi, oggpack_buffer *opb)
-{
- codec_setup_info *ci = vi->codec_setup;
- int j, k, count = 0, maxclass = -1, rangebits;
-
- vorbis_info_floor1 *info = _ogg_calloc(1, sizeof(*info));
- /* read partitions */
- info->partitions = oggpack_read(opb, 5); /* only 0 to 31 legal */
- for(j = 0; j < info->partitions; j++)
- {
- info->partitionclass[j] = oggpack_read(opb, 4); /* only 0 to 15 legal */
- if(info->partitionclass[j] < 0)goto err_out;
- if(maxclass < info->partitionclass[j])maxclass = info->partitionclass[j];
- }
-
- /* read partition classes */
- for(j = 0; j < maxclass + 1; j++)
- {
- info->class_dim[j] = oggpack_read(opb, 3) + 1; /* 1 to 8 */
- info->class_subs[j] = oggpack_read(opb, 2); /* 0,1,2,3 bits */
- if(info->class_subs[j] < 0)
- goto err_out;
- if(info->class_subs[j])info->class_book[j] = oggpack_read(opb, 8);
- if(info->class_book[j] < 0 || info->class_book[j] >= ci->books)
- goto err_out;
- for(k = 0; k < (1 << info->class_subs[j]); k++)
- {
- info->class_subbook[j][k] = oggpack_read(opb, 8) - 1;
- if(info->class_subbook[j][k] < -1 || info->class_subbook[j][k] >= ci->books)
- goto err_out;
- }
+static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
+ codec_setup_info *ci=vi->codec_setup;
+ int j,k,count=0,maxclass=-1,rangebits;
+
+ vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(*info));
+ /* read partitions */
+ info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
+ for(j=0;j<info->partitions;j++){
+ info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
+ if(info->partitionclass[j]<0)goto err_out;
+ if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
+ }
+
+ /* read partition classes */
+ for(j=0;j<maxclass+1;j++){
+ info->class_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */
+ info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */
+ if(info->class_subs[j]<0)
+ goto err_out;
+ if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8);
+ if(info->class_book[j]<0 || info->class_book[j]>=ci->books)
+ goto err_out;
+ for(k=0;k<(1<<info->class_subs[j]);k++){
+ info->class_subbook[j][k]=oggpack_read(opb,8)-1;
+ if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
+ goto err_out;
}
-
- /* read the post list */
- info->mult = oggpack_read(opb, 2) + 1; /* only 1,2,3,4 legal now */
- rangebits = oggpack_read(opb, 4);
- if(rangebits < 0)goto err_out;
-
- for(j = 0, k = 0; j < info->partitions; j++)
- {
- count += info->class_dim[info->partitionclass[j]];
- for(; k < count; k++)
- {
- int t = info->postlist[k+2] = oggpack_read(opb, rangebits);
- if(t < 0 || t >= (1 << rangebits))
- goto err_out;
- }
+ }
+
+ /* read the post list */
+ info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */
+ rangebits=oggpack_read(opb,4);
+ if(rangebits<0)goto err_out;
+
+ for(j=0,k=0;j<info->partitions;j++){
+ count+=info->class_dim[info->partitionclass[j]];
+ for(;k<count;k++){
+ int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
+ if(t<0 || t>=(1<<rangebits))
+ goto err_out;
}
- info->postlist[0] = 0;
- info->postlist[1] = 1 << rangebits;
+ }
+ info->postlist[0]=0;
+ info->postlist[1]=1<<rangebits;
- /* don't allow repeated values in post list as they'd result in
- zero-length segments */
- {
- int *sortpointer[VIF_POSIT+2];
- for(j = 0; j < count + 2; j++)sortpointer[j] = info->postlist + j;
- qsort(sortpointer, count + 2, sizeof(*sortpointer), icomp);
+ /* don't allow repeated values in post list as they'd result in
+ zero-length segments */
+ {
+ int *sortpointer[VIF_POSIT+2];
+ for(j=0;j<count+2;j++)sortpointer[j]=info->postlist+j;
+ qsort(sortpointer,count+2,sizeof(*sortpointer),icomp);
- for(j = 1; j < count + 2; j++)
- if(*sortpointer[j-1] == *sortpointer[j])goto err_out;
- }
+ for(j=1;j<count+2;j++)
+ if(*sortpointer[j-1]==*sortpointer[j])goto err_out;
+ }
- return(info);
+ return(info);
-err_out:
- floor1_free_info(info);
- return(NULL);
+ err_out:
+ floor1_free_info(info);
+ return(NULL);
}
static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
- vorbis_info_floor *in)
-{
-
- int *sortpointer[VIF_POSIT+2];
- vorbis_info_floor1 *info = (vorbis_info_floor1 *)in;
- vorbis_look_floor1 *look = _ogg_calloc(1, sizeof(*look));
- int i, j, n = 0;
-
- look->vi = info;
- look->n = info->postlist[1];
-
- /* we drop each position value in-between already decoded values,
- and use linear interpolation to predict each new value past the
- edges. The positions are read in the order of the position
- list... we precompute the bounding positions in the lookup. Of
- course, the neighbors can change (if a position is declined), but
- this is an initial mapping */
-
- for(i = 0; i < info->partitions; i++)n += info->class_dim[info->partitionclass[i]];
- n += 2;
- look->posts = n;
-
- /* also store a sorted position index */
- for(i = 0; i < n; i++)sortpointer[i] = info->postlist + i;
- qsort(sortpointer, n, sizeof(*sortpointer), icomp);
-
- /* points from sort order back to range number */
- for(i = 0; i < n; i++)look->forward_index[i] = sortpointer[i] - info->postlist;
- /* points from range order to sorted position */
- for(i = 0; i < n; i++)look->reverse_index[look->forward_index[i]] = i;
- /* we actually need the post values too */
- for(i = 0; i < n; i++)look->sorted_index[i] = info->postlist[look->forward_index[i]];
-
- /* quantize values to multiplier spec */
- switch(info->mult)
- {
- case 1: /* 1024 -> 256 */
- look->quant_q = 256;
- break;
- case 2: /* 1024 -> 128 */
- look->quant_q = 128;
- break;
- case 3: /* 1024 -> 86 */
- look->quant_q = 86;
- break;
- case 4: /* 1024 -> 64 */
- look->quant_q = 64;
- break;
- }
-
- /* discover our neighbors for decode where we don't use fit flags
- (that would push the neighbors outward) */
- for(i = 0; i < n - 2; i++)
- {
- int lo = 0;
- int hi = 1;
- int lx = 0;
- int hx = look->n;
- int currentx = info->postlist[i+2];
- for(j = 0; j < i + 2; j++)
- {
- int x = info->postlist[j];
- if(x > lx && x < currentx)
- {
- lo = j;
- lx = x;
- }
- if(x < hx && x > currentx)
- {
- hi = j;
- hx = x;
- }
- }
- look->loneighbor[i] = lo;
- look->hineighbor[i] = hi;
+ vorbis_info_floor *in){
+
+ int *sortpointer[VIF_POSIT+2];
+ vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
+ vorbis_look_floor1 *look=_ogg_calloc(1,sizeof(*look));
+ int i,j,n=0;
+
+ look->vi=info;
+ look->n=info->postlist[1];
+
+ /* we drop each position value in-between already decoded values,
+ and use linear interpolation to predict each new value past the
+ edges. The positions are read in the order of the position
+ list... we precompute the bounding positions in the lookup. Of
+ course, the neighbors can change (if a position is declined), but
+ this is an initial mapping */
+
+ for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]];
+ n+=2;
+ look->posts=n;
+
+ /* also store a sorted position index */
+ for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
+ qsort(sortpointer,n,sizeof(*sortpointer),icomp);
+
+ /* points from sort order back to range number */
+ for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
+ /* points from range order to sorted position */
+ for(i=0;i<n;i++)look->reverse_index[look->forward_index[i]]=i;
+ /* we actually need the post values too */
+ for(i=0;i<n;i++)look->sorted_index[i]=info->postlist[look->forward_index[i]];
+
+ /* quantize values to multiplier spec */
+ switch(info->mult){
+ case 1: /* 1024 -> 256 */
+ look->quant_q=256;
+ break;
+ case 2: /* 1024 -> 128 */
+ look->quant_q=128;
+ break;
+ case 3: /* 1024 -> 86 */
+ look->quant_q=86;
+ break;
+ case 4: /* 1024 -> 64 */
+ look->quant_q=64;
+ break;
+ }
+
+ /* discover our neighbors for decode where we don't use fit flags
+ (that would push the neighbors outward) */
+ for(i=0;i<n-2;i++){
+ int lo=0;
+ int hi=1;
+ int lx=0;
+ int hx=look->n;
+ int currentx=info->postlist[i+2];
+ for(j=0;j<i+2;j++){
+ int x=info->postlist[j];
+ if(x>lx && x<currentx){
+ lo=j;
+ lx=x;
+ }
+ if(x<hx && x>currentx){
+ hi=j;
+ hx=x;
+ }
}
+ look->loneighbor[i]=lo;
+ look->hineighbor[i]=hi;
+ }
- return(look);
+ return(look);
}
-static int render_point(int x0, int x1, int y0, int y1, int x)
-{
- y0 &= 0x7fff; /* mask off flag */
- y1 &= 0x7fff;
+static int render_point(int x0,int x1,int y0,int y1,int x){
+ y0&=0x7fff; /* mask off flag */
+ y1&=0x7fff;
- {
- int dy = y1 - y0;
- int adx = x1 - x0;
- int ady = abs(dy);
- int err = ady * (x - x0);
-
- int off = err / adx;
- if(dy < 0)return(y0 - off);
- return(y0 + off);
- }
+ {
+ int dy=y1-y0;
+ int adx=x1-x0;
+ int ady=abs(dy);
+ int err=ady*(x-x0);
+
+ int off=err/adx;
+ if(dy<0)return(y0-off);
+ return(y0+off);
+ }
}
-static int vorbis_dBquant(const float *x)
-{
- int i = *x * 7.3142857f + 1023.5f;
- if(i > 1023)return(1023);
- if(i < 0)return(0);
- return i;
+static int vorbis_dBquant(const float *x){
+ int i= *x*7.3142857f+1023.5f;
+ if(i>1023)return(1023);
+ if(i<0)return(0);
+ return i;
}
-static const float FLOOR1_fromdB_LOOKUP[256] =
-{
- 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
- 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
- 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
- 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
- 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
- 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
- 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
- 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
- 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
- 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
- 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
- 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
- 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
- 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
- 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
- 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
- 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
- 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
- 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
- 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
- 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
- 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
- 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
- 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
- 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
- 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
- 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
- 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
- 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
- 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
- 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
- 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
- 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
- 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
- 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
- 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
- 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
- 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
- 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
- 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
- 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
- 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
- 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
- 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
- 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
- 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
- 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
- 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
- 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
- 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
- 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
- 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
- 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
- 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
- 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
- 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
- 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
- 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
- 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
- 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
- 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
- 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
- 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
- 0.82788260F, 0.88168307F, 0.9389798F, 1.F,
+static const float FLOOR1_fromdB_LOOKUP[256]={
+ 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
+ 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
+ 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
+ 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
+ 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
+ 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
+ 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
+ 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
+ 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
+ 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
+ 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
+ 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
+ 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
+ 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
+ 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
+ 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
+ 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
+ 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
+ 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
+ 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
+ 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
+ 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
+ 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
+ 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
+ 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
+ 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
+ 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
+ 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
+ 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
+ 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
+ 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
+ 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
+ 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
+ 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
+ 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
+ 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
+ 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
+ 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
+ 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
+ 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
+ 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
+ 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
+ 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
+ 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
+ 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
+ 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
+ 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
+ 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
+ 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
+ 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
+ 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
+ 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
+ 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
+ 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
+ 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
+ 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
+ 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
+ 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
+ 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
+ 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
+ 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
+ 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
+ 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
+ 0.82788260F, 0.88168307F, 0.9389798F, 1.F,
};
-static void render_line(int n, int x0, int x1, int y0, int y1, float *d)
-{
- int dy = y1 - y0;
- int adx = x1 - x0;
- int ady = abs(dy);
- int base = dy / adx;
- int sy = (dy < 0 ? base - 1 : base + 1);
- int x = x0;
- int y = y0;
- int err = 0;
-
- ady -= abs(base * adx);
-
- if(n > x1)n = x1;
-
- if(x < n)
- d[x] *= FLOOR1_fromdB_LOOKUP[y];
-
- while(++x < n)
- {
- err = err + ady;
- if(err >= adx)
- {
- err -= adx;
- y += sy;
- }
- else
- {
- y += base;
- }
- d[x] *= FLOOR1_fromdB_LOOKUP[y];
+static void render_line(int n, int x0,int x1,int y0,int y1,float *d){
+ int dy=y1-y0;
+ int adx=x1-x0;
+ int ady=abs(dy);
+ int base=dy/adx;
+ int sy=(dy<0?base-1:base+1);
+ int x=x0;
+ int y=y0;
+ int err=0;
+
+ ady-=abs(base*adx);
+
+ if(n>x1)n=x1;
+
+ if(x<n)
+ d[x]*=FLOOR1_fromdB_LOOKUP[y];
+
+ while(++x<n){
+ err=err+ady;
+ if(err>=adx){
+ err-=adx;
+ y+=sy;
+ }else{
+ y+=base;
}
+ d[x]*=FLOOR1_fromdB_LOOKUP[y];
+ }
}
-static void render_line0(int x0, int x1, int y0, int y1, int *d)
-{
- int dy = y1 - y0;
- int adx = x1 - x0;
- int ady = abs(dy);
- int base = dy / adx;
- int sy = (dy < 0 ? base - 1 : base + 1);
- int x = x0;
- int y = y0;
- int err = 0;
-
- ady -= abs(base * adx);
-
- d[x] = y;
- while(++x < x1)
- {
- err = err + ady;
- if(err >= adx)
- {
- err -= adx;
- y += sy;
- }
- else
- {
- y += base;
- }
- d[x] = y;
+static void render_line0(int x0,int x1,int y0,int y1,int *d){
+ int dy=y1-y0;
+ int adx=x1-x0;
+ int ady=abs(dy);
+ int base=dy/adx;
+ int sy=(dy<0?base-1:base+1);
+ int x=x0;
+ int y=y0;
+ int err=0;
+
+ ady-=abs(base*adx);
+
+ d[x]=y;
+ while(++x<x1){
+ err=err+ady;
+ if(err>=adx){
+ err-=adx;
+ y+=sy;
+ }else{
+ y+=base;
}
+ d[x]=y;
+ }
}
/* the floor has already been filtered to only include relevant sections */
-static int accumulate_fit(const float *flr, const float *mdct,
- int x0, int x1, lsfit_acc *a,
- int n, vorbis_info_floor1 *info)
-{
- long i;
-
- long xa = 0, ya = 0, x2a = 0, y2a = 0, xya = 0, na = 0, xb = 0, yb = 0, x2b = 0, y2b = 0, xyb = 0, nb = 0;
-
- memset(a, 0, sizeof(*a));
- a->x0 = x0;
- a->x1 = x1;
- if(x1 >= n)x1 = n - 1;
-
- for(i = x0; i <= x1; i++)
- {
- int quantized = vorbis_dBquant(flr + i);
- if(quantized)
- {
- if(mdct[i] + info->twofitatten >= flr[i])
- {
- xa += i;
- ya += quantized;
- x2a += i * i;
- y2a += quantized * quantized;
- xya += i * quantized;
- na++;
- }
- else
- {
- xb += i;
- yb += quantized;
- x2b += i * i;
- y2b += quantized * quantized;
- xyb += i * quantized;
- nb++;
- }
- }
- }
-
- xb += xa;
- yb += ya;
- x2b += x2a;
- y2b += y2a;
- xyb += xya;
- nb += na;
-
- /* weight toward the actually used frequencies if we meet the threshhold */
- {
- int weight = nb * info->twofitweight / (na + 1);
-
- a->xa = xa * weight + xb;
- a->ya = ya * weight + yb;
- a->x2a = x2a * weight + x2b;
- a->y2a = y2a * weight + y2b;
- a->xya = xya * weight + xyb;
- a->an = na * weight + nb;
+static int accumulate_fit(const float *flr,const float *mdct,
+ int x0, int x1,lsfit_acc *a,
+ int n,vorbis_info_floor1 *info){
+ long i;
+
+ long xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0;
+
+ memset(a,0,sizeof(*a));
+ a->x0=x0;
+ a->x1=x1;
+ if(x1>=n)x1=n-1;
+
+ for(i=x0;i<=x1;i++){
+ int quantized=vorbis_dBquant(flr+i);
+ if(quantized){
+ if(mdct[i]+info->twofitatten>=flr[i]){
+ xa += i;
+ ya += quantized;
+ x2a += i*i;
+ y2a += quantized*quantized;
+ xya += i*quantized;
+ na++;
+ }else{
+ xb += i;
+ yb += quantized;
+ x2b += i*i;
+ y2b += quantized*quantized;
+ xyb += i*quantized;
+ nb++;
+ }
}
-
- return(na);
+ }
+
+ xb+=xa;
+ yb+=ya;
+ x2b+=x2a;
+ y2b+=y2a;
+ xyb+=xya;
+ nb+=na;
+
+ /* weight toward the actually used frequencies if we meet the threshhold */
+ {
+ int weight=nb*info->twofitweight/(na+1);
+
+ a->xa=xa*weight+xb;
+ a->ya=ya*weight+yb;
+ a->x2a=x2a*weight+x2b;
+ a->y2a=y2a*weight+y2b;
+ a->xya=xya*weight+xyb;
+ a->an=na*weight+nb;
+ }
+
+ return(na);
}
-static int fit_line(lsfit_acc *a, int fits, int *y0, int *y1)
-{
- long x = 0, y = 0, x2 = 0, y2 = 0, xy = 0, an = 0, i;
- long x0 = a[0].x0;
- long x1 = a[fits-1].x1;
-
- for(i = 0; i < fits; i++)
- {
- x += a[i].xa;
- y += a[i].ya;
- x2 += a[i].x2a;
- y2 += a[i].y2a;
- xy += a[i].xya;
- an += a[i].an;
- }
+static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1){
+ long x=0,y=0,x2=0,y2=0,xy=0,an=0,i;
+ long x0=a[0].x0;
+ long x1=a[fits-1].x1;
- if(*y0 >= 0)
- {
- x += x0;
- y += *y0;
- x2 += x0 * x0;
- y2 += *y0 * *y0;
- xy += *y0 * x0;
- an++;
- }
-
- if(*y1 >= 0)
- {
- x += x1;
- y += *y1;
- x2 += x1 * x1;
- y2 += *y1 * *y1;
- xy += *y1 * x1;
- an++;
- }
-
- {
- /* need 64 bit multiplies, which C doesn't give portably as int */
- double fx = x;
- double fx2 = x2;
- double denom = (an * fx2 - fx * fx);
-
- if(denom > 0.)
- {
- double fy = y;
- double fxy = xy;
-
- double a = (fy * fx2 - fxy * fx) / denom;
- double b = (an * fxy - fx * fy) / denom;
- *y0 = rint(a + b * x0);
- *y1 = rint(a + b * x1);
-
- /* limit to our range! */
- if(*y0 > 1023)*y0 = 1023;
- if(*y1 > 1023)*y1 = 1023;
- if(*y0 < 0)*y0 = 0;
- if(*y1 < 0)*y1 = 0;
-
- return 0;
- }
- else
- {
- *y0 = 0;
- *y1 = 0;
- return 1;
- }
+ for(i=0;i<fits;i++){
+ x+=a[i].xa;
+ y+=a[i].ya;
+ x2+=a[i].x2a;
+ y2+=a[i].y2a;
+ xy+=a[i].xya;
+ an+=a[i].an;
+ }
+
+ if(*y0>=0){
+ x+= x0;
+ y+= *y0;
+ x2+= x0 * x0;
+ y2+= *y0 * *y0;
+ xy+= *y0 * x0;
+ an++;
+ }
+
+ if(*y1>=0){
+ x+= x1;
+ y+= *y1;
+ x2+= x1 * x1;
+ y2+= *y1 * *y1;
+ xy+= *y1 * x1;
+ an++;
+ }
+
+ {
+ /* need 64 bit multiplies, which C doesn't give portably as int */
+ double fx=x;
+ double fx2=x2;
+ double denom=(an*fx2-fx*fx);
+
+ if(denom>0.){
+ double fy=y;
+ double fxy=xy;
+
+ double a=(fy*fx2-fxy*fx)/denom;
+ double b=(an*fxy-fx*fy)/denom;
+ *y0=rint(a+b*x0);
+ *y1=rint(a+b*x1);
+
+ /* limit to our range! */
+ if(*y0>1023)*y0=1023;
+ if(*y1>1023)*y1=1023;
+ if(*y0<0)*y0=0;
+ if(*y1<0)*y1=0;
+
+ return 0;
+ }else{
+ *y0=0;
+ *y1=0;
+ return 1;
}
+ }
}
/*static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){
@@ -586,646 +534,565 @@ static int fit_line(lsfit_acc *a, int fits, int *y0, int *y1)
*y0=*y1=y;
}*/
-static int inspect_error(int x0, int x1, int y0, int y1, const float *mask,
+static int inspect_error(int x0,int x1,int y0,int y1,const float *mask,
const float *mdct,
- vorbis_info_floor1 *info)
-{
- int dy = y1 - y0;
- int adx = x1 - x0;
- int ady = abs(dy);
- int base = dy / adx;
- int sy = (dy < 0 ? base - 1 : base + 1);
- int x = x0;
- int y = y0;
- int err = 0;
- int val = vorbis_dBquant(mask + x);
- int mse = 0;
- int n = 0;
-
- ady -= abs(base * adx);
-
- mse = (y - val);
- mse *= mse;
- n++;
- if(mdct[x] + info->twofitatten >= mask[x])
- {
- if(y + info->maxover < val)return(1);
- if(y - info->maxunder > val)return(1);
+ vorbis_info_floor1 *info){
+ int dy=y1-y0;
+ int adx=x1-x0;
+ int ady=abs(dy);
+ int base=dy/adx;
+ int sy=(dy<0?base-1:base+1);
+ int x=x0;
+ int y=y0;
+ int err=0;
+ int val=vorbis_dBquant(mask+x);
+ int mse=0;
+ int n=0;
+
+ ady-=abs(base*adx);
+
+ mse=(y-val);
+ mse*=mse;
+ n++;
+ if(mdct[x]+info->twofitatten>=mask[x]){
+ if(y+info->maxover<val)return(1);
+ if(y-info->maxunder>val)return(1);
+ }
+
+ while(++x<x1){
+ err=err+ady;
+ if(err>=adx){
+ err-=adx;
+ y+=sy;
+ }else{
+ y+=base;
}
- while(++x < x1)
- {
- err = err + ady;
- if(err >= adx)
- {
- err -= adx;
- y += sy;
- }
- else
- {
- y += base;
- }
-
- val = vorbis_dBquant(mask + x);
- mse += ((y - val) * (y - val));
- n++;
- if(mdct[x] + info->twofitatten >= mask[x])
- {
- if(val)
- {
- if(y + info->maxover < val)return(1);
- if(y - info->maxunder > val)return(1);
- }
- }
+ val=vorbis_dBquant(mask+x);
+ mse+=((y-val)*(y-val));
+ n++;
+ if(mdct[x]+info->twofitatten>=mask[x]){
+ if(val){
+ if(y+info->maxover<val)return(1);
+ if(y-info->maxunder>val)return(1);
+ }
}
+ }
- if(info->maxover * info->maxover / n > info->maxerr)return(0);
- if(info->maxunder * info->maxunder / n > info->maxerr)return(0);
- if(mse / n > info->maxerr)return(1);
- return(0);
+ if(info->maxover*info->maxover/n>info->maxerr)return(0);
+ if(info->maxunder*info->maxunder/n>info->maxerr)return(0);
+ if(mse/n>info->maxerr)return(1);
+ return(0);
}
-static int post_Y(int *A, int *B, int pos)
-{
- if(A[pos] < 0)
- return B[pos];
- if(B[pos] < 0)
- return A[pos];
+static int post_Y(int *A,int *B,int pos){
+ if(A[pos]<0)
+ return B[pos];
+ if(B[pos]<0)
+ return A[pos];
- return (A[pos] + B[pos]) >> 1;
+ return (A[pos]+B[pos])>>1;
}
-int *floor1_fit(vorbis_block *vb, vorbis_look_floor1 *look,
- const float *logmdct, /* in */
- const float *logmask)
-{
- long i, j;
- vorbis_info_floor1 *info = look->vi;
- long n = look->n;
- long posts = look->posts;
- long nonzero = 0;
- lsfit_acc fits[VIF_POSIT+1];
- int fit_valueA[VIF_POSIT+2]; /* index by range list position */
- int fit_valueB[VIF_POSIT+2]; /* index by range list position */
-
- int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */
- int hineighbor[VIF_POSIT+2];
- int *output = NULL;
- int memo[VIF_POSIT+2];
-
- for(i = 0; i < posts; i++)fit_valueA[i] = -200; /* mark all unused */
- for(i = 0; i < posts; i++)fit_valueB[i] = -200; /* mark all unused */
- for(i = 0; i < posts; i++)loneighbor[i] = 0; /* 0 for the implicit 0 post */
- for(i = 0; i < posts; i++)hineighbor[i] = 1; /* 1 for the implicit post at n */
- for(i = 0; i < posts; i++)memo[i] = -1; /* no neighbor yet */
-
- /* quantize the relevant floor points and collect them into line fit
- structures (one per minimal division) at the same time */
- if(posts == 0)
- {
- nonzero += accumulate_fit(logmask, logmdct, 0, n, fits, n, info);
- }
- else
- {
- for(i = 0; i < posts - 1; i++)
- nonzero += accumulate_fit(logmask, logmdct, look->sorted_index[i],
- look->sorted_index[i+1], fits + i,
- n, info);
- }
+int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+ const float *logmdct, /* in */
+ const float *logmask){
+ long i,j;
+ vorbis_info_floor1 *info=look->vi;
+ long n=look->n;
+ long posts=look->posts;
+ long nonzero=0;
+ lsfit_acc fits[VIF_POSIT+1];
+ int fit_valueA[VIF_POSIT+2]; /* index by range list position */
+ int fit_valueB[VIF_POSIT+2]; /* index by range list position */
+
+ int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */
+ int hineighbor[VIF_POSIT+2];
+ int *output=NULL;
+ int memo[VIF_POSIT+2];
+
+ for(i=0;i<posts;i++)fit_valueA[i]=-200; /* mark all unused */
+ for(i=0;i<posts;i++)fit_valueB[i]=-200; /* mark all unused */
+ for(i=0;i<posts;i++)loneighbor[i]=0; /* 0 for the implicit 0 post */
+ for(i=0;i<posts;i++)hineighbor[i]=1; /* 1 for the implicit post at n */
+ for(i=0;i<posts;i++)memo[i]=-1; /* no neighbor yet */
+
+ /* quantize the relevant floor points and collect them into line fit
+ structures (one per minimal division) at the same time */
+ if(posts==0){
+ nonzero+=accumulate_fit(logmask,logmdct,0,n,fits,n,info);
+ }else{
+ for(i=0;i<posts-1;i++)
+ nonzero+=accumulate_fit(logmask,logmdct,look->sorted_index[i],
+ look->sorted_index[i+1],fits+i,
+ n,info);
+ }
+
+ if(nonzero){
+ /* start by fitting the implicit base case.... */
+ int y0=-200;
+ int y1=-200;
+ fit_line(fits,posts-1,&y0,&y1);
+
+ fit_valueA[0]=y0;
+ fit_valueB[0]=y0;
+ fit_valueB[1]=y1;
+ fit_valueA[1]=y1;
+
+ /* Non degenerate case */
+ /* start progressive splitting. This is a greedy, non-optimal
+ algorithm, but simple and close enough to the best
+ answer. */
+ for(i=2;i<posts;i++){
+ int sortpos=look->reverse_index[i];
+ int ln=loneighbor[sortpos];
+ int hn=hineighbor[sortpos];
+
+ /* eliminate repeat searches of a particular range with a memo */
+ if(memo[ln]!=hn){
+ /* haven't performed this error search yet */
+ int lsortpos=look->reverse_index[ln];
+ int hsortpos=look->reverse_index[hn];
+ memo[ln]=hn;
- if(nonzero)
- {
- /* start by fitting the implicit base case.... */
- int y0 = -200;
- int y1 = -200;
- fit_line(fits, posts - 1, &y0, &y1);
-
- fit_valueA[0] = y0;
- fit_valueB[0] = y0;
- fit_valueB[1] = y1;
- fit_valueA[1] = y1;
-
- /* Non degenerate case */
- /* start progressive splitting. This is a greedy, non-optimal
- algorithm, but simple and close enough to the best
- answer. */
- for(i = 2; i < posts; i++)
{
- int sortpos = look->reverse_index[i];
- int ln = loneighbor[sortpos];
- int hn = hineighbor[sortpos];
-
- /* eliminate repeat searches of a particular range with a memo */
- if(memo[ln] != hn)
- {
- /* haven't performed this error search yet */
- int lsortpos = look->reverse_index[ln];
- int hsortpos = look->reverse_index[hn];
- memo[ln] = hn;
-
- {
- /* A note: we want to bound/minimize *local*, not global, error */
- int lx = info->postlist[ln];
- int hx = info->postlist[hn];
- int ly = post_Y(fit_valueA, fit_valueB, ln);
- int hy = post_Y(fit_valueA, fit_valueB, hn);
-
- if(ly == -1 || hy == -1)
- {
- exit(1);
- }
-
- if(inspect_error(lx, hx, ly, hy, logmask, logmdct, info))
- {
- /* outside error bounds/begin search area. Split it. */
- int ly0 = -200;
- int ly1 = -200;
- int hy0 = -200;
- int hy1 = -200;
- int ret0 = fit_line(fits + lsortpos, sortpos - lsortpos, &ly0, &ly1);
- int ret1 = fit_line(fits + sortpos, hsortpos - sortpos, &hy0, &hy1);
-
- if(ret0)
- {
- ly0 = ly;
- ly1 = hy0;
- }
- if(ret1)
- {
- hy0 = ly1;
- hy1 = hy;
- }
-
- if(ret0 && ret1)
- {
- fit_valueA[i] = -200;
- fit_valueB[i] = -200;
- }
- else
- {
- /* store new edge values */
- fit_valueB[ln] = ly0;
- if(ln == 0)fit_valueA[ln] = ly0;
- fit_valueA[i] = ly1;
- fit_valueB[i] = hy0;
- fit_valueA[hn] = hy1;
- if(hn == 1)fit_valueB[hn] = hy1;
-
- if(ly1 >= 0 || hy0 >= 0)
- {
- /* store new neighbor values */
- for(j = sortpos - 1; j >= 0; j--)
- if(hineighbor[j] == hn)
- hineighbor[j] = i;
- else
- break;
- for(j = sortpos + 1; j < posts; j++)
- if(loneighbor[j] == ln)
- loneighbor[j] = i;
- else
- break;
- }
- }
- }
- else
- {
- fit_valueA[i] = -200;
- fit_valueB[i] = -200;
- }
- }
+ /* A note: we want to bound/minimize *local*, not global, error */
+ int lx=info->postlist[ln];
+ int hx=info->postlist[hn];
+ int ly=post_Y(fit_valueA,fit_valueB,ln);
+ int hy=post_Y(fit_valueA,fit_valueB,hn);
+
+ if(ly==-1 || hy==-1){
+ exit(1);
+ }
+
+ if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){
+ /* outside error bounds/begin search area. Split it. */
+ int ly0=-200;
+ int ly1=-200;
+ int hy0=-200;
+ int hy1=-200;
+ int ret0=fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1);
+ int ret1=fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1);
+
+ if(ret0){
+ ly0=ly;
+ ly1=hy0;
}
- }
-
- output = _vorbis_block_alloc(vb, sizeof(*output) * posts);
-
- output[0] = post_Y(fit_valueA, fit_valueB, 0);
- output[1] = post_Y(fit_valueA, fit_valueB, 1);
-
- /* fill in posts marked as not using a fit; we will zero
- back out to 'unused' when encoding them so long as curve
- interpolation doesn't force them into use */
- for(i = 2; i < posts; i++)
- {
- int ln = look->loneighbor[i-2];
- int hn = look->hineighbor[i-2];
- int x0 = info->postlist[ln];
- int x1 = info->postlist[hn];
- int y0 = output[ln];
- int y1 = output[hn];
-
- int predicted = render_point(x0, x1, y0, y1, info->postlist[i]);
- int vx = post_Y(fit_valueA, fit_valueB, i);
-
- if(vx >= 0 && predicted != vx)
- {
- output[i] = vx;
+ if(ret1){
+ hy0=ly1;
+ hy1=hy;
}
- else
- {
- output[i] = predicted | 0x8000;
+
+ if(ret0 && ret1){
+ fit_valueA[i]=-200;
+ fit_valueB[i]=-200;
+ }else{
+ /* store new edge values */
+ fit_valueB[ln]=ly0;
+ if(ln==0)fit_valueA[ln]=ly0;
+ fit_valueA[i]=ly1;
+ fit_valueB[i]=hy0;
+ fit_valueA[hn]=hy1;
+ if(hn==1)fit_valueB[hn]=hy1;
+
+ if(ly1>=0 || hy0>=0){
+ /* store new neighbor values */
+ for(j=sortpos-1;j>=0;j--)
+ if(hineighbor[j]==hn)
+ hineighbor[j]=i;
+ else
+ break;
+ for(j=sortpos+1;j<posts;j++)
+ if(loneighbor[j]==ln)
+ loneighbor[j]=i;
+ else
+ break;
+ }
}
+ }else{
+ fit_valueA[i]=-200;
+ fit_valueB[i]=-200;
+ }
}
+ }
+ }
+
+ output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
+
+ output[0]=post_Y(fit_valueA,fit_valueB,0);
+ output[1]=post_Y(fit_valueA,fit_valueB,1);
+
+ /* fill in posts marked as not using a fit; we will zero
+ back out to 'unused' when encoding them so long as curve
+ interpolation doesn't force them into use */
+ for(i=2;i<posts;i++){
+ int ln=look->loneighbor[i-2];
+ int hn=look->hineighbor[i-2];
+ int x0=info->postlist[ln];
+ int x1=info->postlist[hn];
+ int y0=output[ln];
+ int y1=output[hn];
+
+ int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
+ int vx=post_Y(fit_valueA,fit_valueB,i);
+
+ if(vx>=0 && predicted!=vx){
+ output[i]=vx;
+ }else{
+ output[i]= predicted|0x8000;
+ }
}
+ }
- return(output);
+ return(output);
}
-int *floor1_interpolate_fit(vorbis_block *vb, vorbis_look_floor1 *look,
- int *A, int *B,
- int del)
-{
+int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+ int *A,int *B,
+ int del){
- long i;
- long posts = look->posts;
- int *output = NULL;
+ long i;
+ long posts=look->posts;
+ int *output=NULL;
- if(A && B)
- {
- output = _vorbis_block_alloc(vb, sizeof(*output) * posts);
+ if(A && B){
+ output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
- /* overly simpleminded--- look again post 1.2 */
- for(i = 0; i < posts; i++)
- {
- output[i] = ((65536 - del) * (A[i] & 0x7fff) + del * (B[i] & 0x7fff) + 32768) >> 16;
- if(A[i] & 0x8000 && B[i] & 0x8000)output[i] |= 0x8000;
- }
+ /* overly simpleminded--- look again post 1.2 */
+ for(i=0;i<posts;i++){
+ output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>16;
+ if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000;
}
+ }
- return(output);
+ return(output);
}
-int floor1_encode(oggpack_buffer *opb, vorbis_block *vb,
+int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
vorbis_look_floor1 *look,
- int *post, int *ilogmask)
-{
-
- long i, j;
- vorbis_info_floor1 *info = look->vi;
- long posts = look->posts;
- codec_setup_info *ci = vb->vd->vi->codec_setup;
- int out[VIF_POSIT+2];
- static_codebook **sbooks = ci->book_param;
- codebook *books = ci->fullbooks;
-
- /* quantize values to multiplier spec */
- if(post)
- {
- for(i = 0; i < posts; i++)
- {
- int val = post[i] & 0x7fff;
- switch(info->mult)
- {
- case 1: /* 1024 -> 256 */
- val >>= 2;
- break;
- case 2: /* 1024 -> 128 */
- val >>= 3;
- break;
- case 3: /* 1024 -> 86 */
- val /= 12;
- break;
- case 4: /* 1024 -> 64 */
- val >>= 4;
- break;
- }
- post[i] = val | (post[i] & 0x8000);
- }
-
- out[0] = post[0];
- out[1] = post[1];
+ int *post,int *ilogmask){
+
+ long i,j;
+ vorbis_info_floor1 *info=look->vi;
+ long posts=look->posts;
+ codec_setup_info *ci=vb->vd->vi->codec_setup;
+ int out[VIF_POSIT+2];
+ static_codebook **sbooks=ci->book_param;
+ codebook *books=ci->fullbooks;
+
+ /* quantize values to multiplier spec */
+ if(post){
+ for(i=0;i<posts;i++){
+ int val=post[i]&0x7fff;
+ switch(info->mult){
+ case 1: /* 1024 -> 256 */
+ val>>=2;
+ break;
+ case 2: /* 1024 -> 128 */
+ val>>=3;
+ break;
+ case 3: /* 1024 -> 86 */
+ val/=12;
+ break;
+ case 4: /* 1024 -> 64 */
+ val>>=4;
+ break;
+ }
+ post[i]=val | (post[i]&0x8000);
+ }
- /* find prediction values for each post and subtract them */
- for(i = 2; i < posts; i++)
- {
- int ln = look->loneighbor[i-2];
- int hn = look->hineighbor[i-2];
- int x0 = info->postlist[ln];
- int x1 = info->postlist[hn];
- int y0 = post[ln];
- int y1 = post[hn];
-
- int predicted = render_point(x0, x1, y0, y1, info->postlist[i]);
-
- if((post[i] & 0x8000) || (predicted == post[i]))
- {
- post[i] = predicted | 0x8000; /* in case there was roundoff jitter
- in interpolation */
- out[i] = 0;
- }
- else
- {
- int headroom = (look->quant_q - predicted < predicted ?
- look->quant_q - predicted : predicted);
-
- int val = post[i] - predicted;
-
- /* at this point the 'deviation' value is in the range +/- max
- range, but the real, unique range can always be mapped to
- only [0-maxrange). So we want to wrap the deviation into
- this limited range, but do it in the way that least screws
- an essentially gaussian probability distribution. */
-
- if(val < 0)
- if(val < -headroom)
- val = headroom - val - 1;
- else
- val = -1 - (val << 1);
- else if(val >= headroom)
- val = val + headroom;
- else
- val <<= 1;
-
- out[i] = val;
- post[ln] &= 0x7fff;
- post[hn] &= 0x7fff;
- }
- }
+ out[0]=post[0];
+ out[1]=post[1];
- /* we have everything we need. pack it out */
- /* mark nontrivial floor */
- oggpack_write(opb, 1, 1);
+ /* find prediction values for each post and subtract them */
+ for(i=2;i<posts;i++){
+ int ln=look->loneighbor[i-2];
+ int hn=look->hineighbor[i-2];
+ int x0=info->postlist[ln];
+ int x1=info->postlist[hn];
+ int y0=post[ln];
+ int y1=post[hn];
- /* beginning/end post */
- look->frames++;
- look->postbits += ilog(look->quant_q - 1) * 2;
- oggpack_write(opb, out[0], ilog(look->quant_q - 1));
- oggpack_write(opb, out[1], ilog(look->quant_q - 1));
+ int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
+ if((post[i]&0x8000) || (predicted==post[i])){
+ post[i]=predicted|0x8000; /* in case there was roundoff jitter
+ in interpolation */
+ out[i]=0;
+ }else{
+ int headroom=(look->quant_q-predicted<predicted?
+ look->quant_q-predicted:predicted);
+
+ int val=post[i]-predicted;
+
+ /* at this point the 'deviation' value is in the range +/- max
+ range, but the real, unique range can always be mapped to
+ only [0-maxrange). So we want to wrap the deviation into
+ this limited range, but do it in the way that least screws
+ an essentially gaussian probability distribution. */
+
+ if(val<0)
+ if(val<-headroom)
+ val=headroom-val-1;
+ else
+ val=-1-(val<<1);
+ else
+ if(val>=headroom)
+ val= val+headroom;
+ else
+ val<<=1;
+
+ out[i]=val;
+ post[ln]&=0x7fff;
+ post[hn]&=0x7fff;
+ }
+ }
- /* partition by partition */
- for(i = 0, j = 2; i < info->partitions; i++)
- {
- int class = info->partitionclass[i];
- int cdim = info->class_dim[class];
- int csubbits = info->class_subs[class];
- int csub = 1 << csubbits;
- int bookas[8] = {0, 0, 0, 0, 0, 0, 0, 0};
- int cval = 0;
- int cshift = 0;
- int k, l;
-
- /* generate the partition's first stage cascade value */
- if(csubbits)
- {
- int maxval[8];
- for(k = 0; k < csub; k++)
- {
- int booknum = info->class_subbook[class][k];
- if(booknum < 0)
- {
- maxval[k] = 1;
- }
- else
- {
- maxval[k] = sbooks[info->class_subbook[class][k]]->entries;
- }
- }
- for(k = 0; k < cdim; k++)
- {
- for(l = 0; l < csub; l++)
- {
- int val = out[j+k];
- if(val < maxval[l])
- {
- bookas[k] = l;
- break;
- }
- }
- cval |= bookas[k] << cshift;
- cshift += csubbits;
- }
- /* write it */
- look->phrasebits +=
- vorbis_book_encode(books + info->class_book[class], cval, opb);
+ /* we have everything we need. pack it out */
+ /* mark nontrivial floor */
+ oggpack_write(opb,1,1);
+
+ /* beginning/end post */
+ look->frames++;
+ look->postbits+=ilog(look->quant_q-1)*2;
+ oggpack_write(opb,out[0],ilog(look->quant_q-1));
+ oggpack_write(opb,out[1],ilog(look->quant_q-1));
+
+
+ /* partition by partition */
+ for(i=0,j=2;i<info->partitions;i++){
+ int class=info->partitionclass[i];
+ int cdim=info->class_dim[class];
+ int csubbits=info->class_subs[class];
+ int csub=1<<csubbits;
+ int bookas[8]={0,0,0,0,0,0,0,0};
+ int cval=0;
+ int cshift=0;
+ int k,l;
+
+ /* generate the partition's first stage cascade value */
+ if(csubbits){
+ int maxval[8];
+ for(k=0;k<csub;k++){
+ int booknum=info->class_subbook[class][k];
+ if(booknum<0){
+ maxval[k]=1;
+ }else{
+ maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
+ }
+ }
+ for(k=0;k<cdim;k++){
+ for(l=0;l<csub;l++){
+ int val=out[j+k];
+ if(val<maxval[l]){
+ bookas[k]=l;
+ break;
+ }
+ }
+ cval|= bookas[k]<<cshift;
+ cshift+=csubbits;
+ }
+ /* write it */
+ look->phrasebits+=
+ vorbis_book_encode(books+info->class_book[class],cval,opb);
#ifdef TRAIN_FLOOR1
- {
- FILE *of;
- char buffer[80];
- sprintf(buffer, "line_%dx%ld_class%d.vqd",
- vb->pcmend / 2, posts - 2, class);
- of = fopen(buffer, "a");
- fprintf(of, "%d\n", cval);
- fclose(of);
- }
+ {
+ FILE *of;
+ char buffer[80];
+ sprintf(buffer,"line_%dx%ld_class%d.vqd",
+ vb->pcmend/2,posts-2,class);
+ of=fopen(buffer,"a");
+ fprintf(of,"%d\n",cval);
+ fclose(of);
+ }
#endif
- }
-
- /* write post values */
- for(k = 0; k < cdim; k++)
- {
- int book = info->class_subbook[class][bookas[k]];
- if(book >= 0)
- {
- /* hack to allow training with 'bad' books */
- if(out[j+k] < (books + book)->entries)
- look->postbits += vorbis_book_encode(books + book,
- out[j+k], opb);
- /*else
- fprintf(stderr,"+!");*/
+ }
+
+ /* write post values */
+ for(k=0;k<cdim;k++){
+ int book=info->class_subbook[class][bookas[k]];
+ if(book>=0){
+ /* hack to allow training with 'bad' books */
+ if(out[j+k]<(books+book)->entries)
+ look->postbits+=vorbis_book_encode(books+book,
+ out[j+k],opb);
+ /*else
+ fprintf(stderr,"+!");*/
#ifdef TRAIN_FLOOR1
- {
- FILE *of;
- char buffer[80];
- sprintf(buffer, "line_%dx%ld_%dsub%d.vqd",
- vb->pcmend / 2, posts - 2, class, bookas[k]);
- of = fopen(buffer, "a");
- fprintf(of, "%d\n", out[j+k]);
- fclose(of);
- }
+ {
+ FILE *of;
+ char buffer[80];
+ sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
+ vb->pcmend/2,posts-2,class,bookas[k]);
+ of=fopen(buffer,"a");
+ fprintf(of,"%d\n",out[j+k]);
+ fclose(of);
+ }
#endif
- }
- }
- j += cdim;
- }
-
- {
- /* generate quantized floor equivalent to what we'd unpack in decode */
- /* render the lines */
- int hx = 0;
- int lx = 0;
- int ly = post[0] * info->mult;
- for(j = 1; j < look->posts; j++)
- {
- int current = look->forward_index[j];
- int hy = post[current] & 0x7fff;
- if(hy == post[current])
- {
-
- hy *= info->mult;
- hx = info->postlist[current];
-
- render_line0(lx, hx, ly, hy, ilogmask);
-
- lx = hx;
- ly = hy;
- }
- }
- for(j = hx; j < vb->pcmend / 2; j++)ilogmask[j] = ly; /* be certain */
- return(1);
}
+ }
+ j+=cdim;
}
- else
- {
- oggpack_write(opb, 0, 1);
- memset(ilogmask, 0, vb->pcmend / 2 * sizeof(*ilogmask));
- return(0);
- }
-}
-static void *floor1_inverse1(vorbis_block *vb, vorbis_look_floor *in)
-{
- vorbis_look_floor1 *look = (vorbis_look_floor1 *)in;
- vorbis_info_floor1 *info = look->vi;
- codec_setup_info *ci = vb->vd->vi->codec_setup;
-
- int i, j, k;
- codebook *books = ci->fullbooks;
-
- /* unpack wrapped/predicted values from stream */
- if(oggpack_read(&vb->opb, 1) == 1)
{
- int *fit_value = _vorbis_block_alloc(vb, (look->posts) * sizeof(*fit_value));
-
- fit_value[0] = oggpack_read(&vb->opb, ilog(look->quant_q - 1));
- fit_value[1] = oggpack_read(&vb->opb, ilog(look->quant_q - 1));
-
- /* partition by partition */
- for(i = 0, j = 2; i < info->partitions; i++)
- {
- int class = info->partitionclass[i];
- int cdim = info->class_dim[class];
- int csubbits = info->class_subs[class];
- int csub = 1 << csubbits;
- int cval = 0;
-
- /* decode the partition's first stage cascade value */
- if(csubbits)
- {
- cval = vorbis_book_decode(books + info->class_book[class], &vb->opb);
-
- if(cval == -1)goto eop;
- }
-
- for(k = 0; k < cdim; k++)
- {
- int book = info->class_subbook[class][cval&(csub-1)];
- cval >>= csubbits;
- if(book >= 0)
- {
- if((fit_value[j+k] = vorbis_book_decode(books + book, &vb->opb)) == -1)
- goto eop;
- }
- else
- {
- fit_value[j+k] = 0;
- }
- }
- j += cdim;
+ /* generate quantized floor equivalent to what we'd unpack in decode */
+ /* render the lines */
+ int hx=0;
+ int lx=0;
+ int ly=post[0]*info->mult;
+ for(j=1;j<look->posts;j++){
+ int current=look->forward_index[j];
+ int hy=post[current]&0x7fff;
+ if(hy==post[current]){
+
+ hy*=info->mult;
+ hx=info->postlist[current];
+
+ render_line0(lx,hx,ly,hy,ilogmask);
+
+ lx=hx;
+ ly=hy;
}
+ }
+ for(j=hx;j<vb->pcmend/2;j++)ilogmask[j]=ly; /* be certain */
+ return(1);
+ }
+ }else{
+ oggpack_write(opb,0,1);
+ memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask));
+ return(0);
+ }
+}
- /* unwrap positive values and reconsitute via linear interpolation */
- for(i = 2; i < look->posts; i++)
- {
- int predicted = render_point(info->postlist[look->loneighbor[i-2]],
- info->postlist[look->hineighbor[i-2]],
- fit_value[look->loneighbor[i-2]],
- fit_value[look->hineighbor[i-2]],
- info->postlist[i]);
- int hiroom = look->quant_q - predicted;
- int loroom = predicted;
- int room = (hiroom < loroom ? hiroom : loroom) << 1;
- int val = fit_value[i];
-
- if(val)
- {
- if(val >= room)
- {
- if(hiroom > loroom)
- {
- val = val - loroom;
- }
- else
- {
- val = -1 - (val - hiroom);
- }
- }
- else
- {
- if(val & 1)
- {
- val = -((val + 1) >> 1);
- }
- else
- {
- val >>= 1;
- }
- }
-
- fit_value[i] = val + predicted;
- fit_value[look->loneighbor[i-2]] &= 0x7fff;
- fit_value[look->hineighbor[i-2]] &= 0x7fff;
-
- }
- else
- {
- fit_value[i] = predicted | 0x8000;
- }
-
+static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
+ vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
+ vorbis_info_floor1 *info=look->vi;
+ codec_setup_info *ci=vb->vd->vi->codec_setup;
+
+ int i,j,k;
+ codebook *books=ci->fullbooks;
+
+ /* unpack wrapped/predicted values from stream */
+ if(oggpack_read(&vb->opb,1)==1){
+ int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
+
+ fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
+ fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
+
+ /* partition by partition */
+ for(i=0,j=2;i<info->partitions;i++){
+ int class=info->partitionclass[i];
+ int cdim=info->class_dim[class];
+ int csubbits=info->class_subs[class];
+ int csub=1<<csubbits;
+ int cval=0;
+
+ /* decode the partition's first stage cascade value */
+ if(csubbits){
+ cval=vorbis_book_decode(books+info->class_book[class],&vb->opb);
+
+ if(cval==-1)goto eop;
+ }
+
+ for(k=0;k<cdim;k++){
+ int book=info->class_subbook[class][cval&(csub-1)];
+ cval>>=csubbits;
+ if(book>=0){
+ if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
+ goto eop;
+ }else{
+ fit_value[j+k]=0;
}
-
- return(fit_value);
+ }
+ j+=cdim;
}
-eop:
- return(NULL);
-}
-static int floor1_inverse2(vorbis_block *vb, vorbis_look_floor *in, void *memo,
- float *out)
-{
- vorbis_look_floor1 *look = (vorbis_look_floor1 *)in;
- vorbis_info_floor1 *info = look->vi;
+ /* unwrap positive values and reconsitute via linear interpolation */
+ for(i=2;i<look->posts;i++){
+ int predicted=render_point(info->postlist[look->loneighbor[i-2]],
+ info->postlist[look->hineighbor[i-2]],
+ fit_value[look->loneighbor[i-2]],
+ fit_value[look->hineighbor[i-2]],
+ info->postlist[i]);
+ int hiroom=look->quant_q-predicted;
+ int loroom=predicted;
+ int room=(hiroom<loroom?hiroom:loroom)<<1;
+ int val=fit_value[i];
+
+ if(val){
+ if(val>=room){
+ if(hiroom>loroom){
+ val = val-loroom;
+ }else{
+ val = -1-(val-hiroom);
+ }
+ }else{
+ if(val&1){
+ val= -((val+1)>>1);
+ }else{
+ val>>=1;
+ }
+ }
- codec_setup_info *ci = vb->vd->vi->codec_setup;
- int n = ci->blocksizes[vb->W] / 2;
- int j;
+ fit_value[i]=val+predicted;
+ fit_value[look->loneighbor[i-2]]&=0x7fff;
+ fit_value[look->hineighbor[i-2]]&=0x7fff;
- if(memo)
- {
- /* render the lines */
- int *fit_value = (int *)memo;
- int hx = 0;
- int lx = 0;
- int ly = fit_value[0] * info->mult;
- for(j = 1; j < look->posts; j++)
- {
- int current = look->forward_index[j];
- int hy = fit_value[current] & 0x7fff;
- if(hy == fit_value[current])
- {
+ }else{
+ fit_value[i]=predicted|0x8000;
+ }
- hy *= info->mult;
- hx = info->postlist[current];
+ }
- render_line(n, lx, hx, ly, hy, out);
+ return(fit_value);
+ }
+ eop:
+ return(NULL);
+}
- lx = hx;
- ly = hy;
- }
- }
- for(j = hx; j < n; j++)out[j] *= FLOOR1_fromdB_LOOKUP[ly]; /* be certain */
- return(1);
+static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
+ float *out){
+ vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
+ vorbis_info_floor1 *info=look->vi;
+
+ codec_setup_info *ci=vb->vd->vi->codec_setup;
+ int n=ci->blocksizes[vb->W]/2;
+ int j;
+
+ if(memo){
+ /* render the lines */
+ int *fit_value=(int *)memo;
+ int hx=0;
+ int lx=0;
+ int ly=fit_value[0]*info->mult;
+ for(j=1;j<look->posts;j++){
+ int current=look->forward_index[j];
+ int hy=fit_value[current]&0x7fff;
+ if(hy==fit_value[current]){
+
+ hy*=info->mult;
+ hx=info->postlist[current];
+
+ render_line(n,lx,hx,ly,hy,out);
+
+ lx=hx;
+ ly=hy;
+ }
}
- memset(out, 0, sizeof(*out)*n);
- return(0);
+ for(j=hx;j<n;j++)out[j]*=FLOOR1_fromdB_LOOKUP[ly]; /* be certain */
+ return(1);
+ }
+ memset(out,0,sizeof(*out)*n);
+ return(0);
}
/* export hooks */
-const vorbis_func_floor floor1_exportbundle =
-{
- &floor1_pack, &floor1_unpack, &floor1_look, &floor1_free_info,
- &floor1_free_look, &floor1_inverse1, &floor1_inverse2
+const vorbis_func_floor floor1_exportbundle={
+ &floor1_pack,&floor1_unpack,&floor1_look,&floor1_free_info,
+ &floor1_free_look,&floor1_inverse1,&floor1_inverse2
};
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/framing.c b/src/filters/transform/MpaDecFilter/libvorbisidec/framing.c
index 94dd759e7..b8a6fb0c9 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/framing.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/framing.c
@@ -26,54 +26,47 @@
/* A complete description of Ogg framing exists in docs/framing.html */
-int ogg_page_version(const ogg_page *og)
-{
- return((int)(og->header[4]));
+int ogg_page_version(const ogg_page *og){
+ return((int)(og->header[4]));
}
-int ogg_page_continued(const ogg_page *og)
-{
- return((int)(og->header[5] & 0x01));
+int ogg_page_continued(const ogg_page *og){
+ return((int)(og->header[5]&0x01));
}
-int ogg_page_bos(const ogg_page *og)
-{
- return((int)(og->header[5] & 0x02));
+int ogg_page_bos(const ogg_page *og){
+ return((int)(og->header[5]&0x02));
}
-int ogg_page_eos(const ogg_page *og)
-{
- return((int)(og->header[5] & 0x04));
+int ogg_page_eos(const ogg_page *og){
+ return((int)(og->header[5]&0x04));
}
-ogg_int64_t ogg_page_granulepos(const ogg_page *og)
-{
- unsigned char *page = og->header;
- ogg_int64_t granulepos = page[13] & (0xff);
- granulepos = (granulepos << 8) | (page[12] & 0xff);
- granulepos = (granulepos << 8) | (page[11] & 0xff);
- granulepos = (granulepos << 8) | (page[10] & 0xff);
- granulepos = (granulepos << 8) | (page[9] & 0xff);
- granulepos = (granulepos << 8) | (page[8] & 0xff);
- granulepos = (granulepos << 8) | (page[7] & 0xff);
- granulepos = (granulepos << 8) | (page[6] & 0xff);
- return(granulepos);
+ogg_int64_t ogg_page_granulepos(const ogg_page *og){
+ unsigned char *page=og->header;
+ ogg_int64_t granulepos=page[13]&(0xff);
+ granulepos= (granulepos<<8)|(page[12]&0xff);
+ granulepos= (granulepos<<8)|(page[11]&0xff);
+ granulepos= (granulepos<<8)|(page[10]&0xff);
+ granulepos= (granulepos<<8)|(page[9]&0xff);
+ granulepos= (granulepos<<8)|(page[8]&0xff);
+ granulepos= (granulepos<<8)|(page[7]&0xff);
+ granulepos= (granulepos<<8)|(page[6]&0xff);
+ return(granulepos);
}
-int ogg_page_serialno(const ogg_page *og)
-{
- return(og->header[14] |
- (og->header[15] << 8) |
- (og->header[16] << 16) |
- (og->header[17] << 24));
+int ogg_page_serialno(const ogg_page *og){
+ return(og->header[14] |
+ (og->header[15]<<8) |
+ (og->header[16]<<16) |
+ (og->header[17]<<24));
}
-
-long ogg_page_pageno(const ogg_page *og)
-{
- return(og->header[18] |
- (og->header[19] << 8) |
- (og->header[20] << 16) |
- (og->header[21] << 24));
+
+long ogg_page_pageno(const ogg_page *og){
+ return(og->header[18] |
+ (og->header[19]<<8) |
+ (og->header[20]<<16) |
+ (og->header[21]<<24));
}
@@ -85,22 +78,21 @@ long ogg_page_pageno(const ogg_page *og)
/* NOTE:
If a page consists of a packet begun on a previous page, and a new
packet begun (but not completed) on this page, the return will be:
- ogg_page_packets(page) ==1,
+ ogg_page_packets(page) ==1,
ogg_page_continued(page) !=0
If a page happens to be a single packet that was begun on a
previous page, and spans to the next page (in the case of a three or
-more page packet), the return will be:
- ogg_page_packets(page) ==0,
+more page packet), the return will be:
+ ogg_page_packets(page) ==0,
ogg_page_continued(page) !=0
*/
-int ogg_page_packets(const ogg_page *og)
-{
- int i, n = og->header[26], count = 0;
- for(i = 0; i < n; i++)
- if(og->header[27+i] < 255)count++;
- return(count);
+int ogg_page_packets(const ogg_page *og){
+ int i,n=og->header[26],count=0;
+ for(i=0;i<n;i++)
+ if(og->header[27+i]<255)count++;
+ return(count);
}
@@ -108,295 +100,270 @@ int ogg_page_packets(const ogg_page *og)
/* helper to initialize lookup for direct-table CRC (illustrative; we
use the static init below) */
-static ogg_uint32_t _ogg_crc_entry(unsigned long index)
-{
- int i;
- unsigned long r;
+static ogg_uint32_t _ogg_crc_entry(unsigned long index){
+ int i;
+ unsigned long r;
- r = index << 24;
- for(i = 0; i < 8; i++)
- if(r & 0x80000000UL)
- r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
+ r = index << 24;
+ for (i=0; i<8; i++)
+ if (r & 0x80000000UL)
+ r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
polynomial, although we use an
unreflected alg and an init/final
of 0, not 0xffffffff */
- else
- r <<= 1;
- return (r & 0xffffffffUL);
+ else
+ r<<=1;
+ return (r & 0xffffffffUL);
}
#endif
-static const ogg_uint32_t crc_lookup[256] =
-{
- 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
- 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
- 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
- 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
- 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
- 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
- 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,
- 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,
- 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
- 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
- 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,
- 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
- 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,
- 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
- 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
- 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,
- 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,
- 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
- 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
- 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
- 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
- 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,
- 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,
- 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
- 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
- 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,
- 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
- 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,
- 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
- 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
- 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,
- 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,
- 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
- 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
- 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
- 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
- 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,
- 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,
- 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
- 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
- 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,
- 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
- 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,
- 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
- 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
- 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,
- 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,
- 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
- 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
- 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
- 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
- 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,
- 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,
- 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
- 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
- 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,
- 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
- 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,
- 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
- 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
- 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,
- 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,
- 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
- 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
-};
+static const ogg_uint32_t crc_lookup[256]={
+ 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
+ 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
+ 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
+ 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
+ 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
+ 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
+ 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
+ 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
+ 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
+ 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
+ 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
+ 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
+ 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
+ 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
+ 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
+ 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
+ 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
+ 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
+ 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
+ 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
+ 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
+ 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
+ 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
+ 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
+ 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
+ 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
+ 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
+ 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
+ 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
+ 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
+ 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
+ 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
+ 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
+ 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
+ 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
+ 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
+ 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
+ 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
+ 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
+ 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
+ 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
+ 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
+ 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
+ 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
+ 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
+ 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
+ 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
+ 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
+ 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
+ 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
+ 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
+ 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
+ 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
+ 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
+ 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
+ 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
+ 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
+ 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
+ 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
+ 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
+ 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
+ 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
+ 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
+ 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
/* init the encode/decode logical stream state */
-int ogg_stream_init(ogg_stream_state *os, int serialno)
-{
- if(os)
- {
- memset(os, 0, sizeof(*os));
- os->body_storage = 16 * 1024;
- os->lacing_storage = 1024;
+int ogg_stream_init(ogg_stream_state *os,int serialno){
+ if(os){
+ memset(os,0,sizeof(*os));
+ os->body_storage=16*1024;
+ os->lacing_storage=1024;
- os->body_data = _ogg_malloc(os->body_storage * sizeof(*os->body_data));
- os->lacing_vals = _ogg_malloc(os->lacing_storage * sizeof(*os->lacing_vals));
- os->granule_vals = _ogg_malloc(os->lacing_storage * sizeof(*os->granule_vals));
+ os->body_data=_ogg_malloc(os->body_storage*sizeof(*os->body_data));
+ os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals));
+ os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals));
- if(!os->body_data || !os->lacing_vals || !os->granule_vals)
- {
- ogg_stream_clear(os);
- return -1;
- }
+ if(!os->body_data || !os->lacing_vals || !os->granule_vals){
+ ogg_stream_clear(os);
+ return -1;
+ }
- os->serialno = serialno;
+ os->serialno=serialno;
- return(0);
- }
- return(-1);
-}
+ return(0);
+ }
+ return(-1);
+}
/* async/delayed error detection for the ogg_stream_state */
-int ogg_stream_check(ogg_stream_state *os)
-{
- if(!os || !os->body_data) return -1;
- return 0;
+int ogg_stream_check(ogg_stream_state *os){
+ if(!os || !os->body_data) return -1;
+ return 0;
}
/* _clear does not free os, only the non-flat storage within */
-int ogg_stream_clear(ogg_stream_state *os)
-{
- if(os)
- {
- if(os->body_data)_ogg_free(os->body_data);
- if(os->lacing_vals)_ogg_free(os->lacing_vals);
- if(os->granule_vals)_ogg_free(os->granule_vals);
-
- memset(os, 0, sizeof(*os));
- }
- return(0);
-}
-
-int ogg_stream_destroy(ogg_stream_state *os)
-{
- if(os)
- {
- ogg_stream_clear(os);
- _ogg_free(os);
- }
- return(0);
-}
+int ogg_stream_clear(ogg_stream_state *os){
+ if(os){
+ if(os->body_data)_ogg_free(os->body_data);
+ if(os->lacing_vals)_ogg_free(os->lacing_vals);
+ if(os->granule_vals)_ogg_free(os->granule_vals);
+
+ memset(os,0,sizeof(*os));
+ }
+ return(0);
+}
+
+int ogg_stream_destroy(ogg_stream_state *os){
+ if(os){
+ ogg_stream_clear(os);
+ _ogg_free(os);
+ }
+ return(0);
+}
/* Helpers for ogg_stream_encode; this keeps the structure and
what's happening fairly clear */
-static int _os_body_expand(ogg_stream_state *os, int needed)
-{
- if(os->body_storage <= os->body_fill + needed)
- {
- void *ret;
- ret = _ogg_realloc(os->body_data, (os->body_storage + needed + 1024) *
- sizeof(*os->body_data));
- if(!ret)
- {
- ogg_stream_clear(os);
- return -1;
- }
- os->body_storage += (needed + 1024);
- os->body_data = ret;
+static int _os_body_expand(ogg_stream_state *os,int needed){
+ if(os->body_storage<=os->body_fill+needed){
+ void *ret;
+ ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)*
+ sizeof(*os->body_data));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
}
- return 0;
+ os->body_storage+=(needed+1024);
+ os->body_data=ret;
+ }
+ return 0;
}
-static int _os_lacing_expand(ogg_stream_state *os, int needed)
-{
- if(os->lacing_storage <= os->lacing_fill + needed)
- {
- void *ret;
- ret = _ogg_realloc(os->lacing_vals, (os->lacing_storage + needed + 32) *
- sizeof(*os->lacing_vals));
- if(!ret)
- {
- ogg_stream_clear(os);
- return -1;
- }
- os->lacing_vals = ret;
- ret = _ogg_realloc(os->granule_vals, (os->lacing_storage + needed + 32) *
- sizeof(*os->granule_vals));
- if(!ret)
- {
- ogg_stream_clear(os);
- return -1;
- }
- os->granule_vals = ret;
- os->lacing_storage += (needed + 32);
+static int _os_lacing_expand(ogg_stream_state *os,int needed){
+ if(os->lacing_storage<=os->lacing_fill+needed){
+ void *ret;
+ ret=_ogg_realloc(os->lacing_vals,(os->lacing_storage+needed+32)*
+ sizeof(*os->lacing_vals));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
}
- return 0;
+ os->lacing_vals=ret;
+ ret=_ogg_realloc(os->granule_vals,(os->lacing_storage+needed+32)*
+ sizeof(*os->granule_vals));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ os->granule_vals=ret;
+ os->lacing_storage+=(needed+32);
+ }
+ return 0;
}
/* checksum the page */
/* Direct table CRC; note that this will be faster in the future if we
perform the checksum silmultaneously with other copies */
-void ogg_page_checksum_set(ogg_page *og)
-{
- if(og)
- {
- ogg_uint32_t crc_reg = 0;
- int i;
-
- /* safety; needed for API behavior, but not framing code */
- og->header[22] = 0;
- og->header[23] = 0;
- og->header[24] = 0;
- og->header[25] = 0;
-
- for(i = 0; i < og->header_len; i++)
- crc_reg = (crc_reg << 8) ^ crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
- for(i = 0; i < og->body_len; i++)
- crc_reg = (crc_reg << 8) ^ crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
-
- og->header[22] = (unsigned char)(crc_reg & 0xff);
- og->header[23] = (unsigned char)((crc_reg >> 8) & 0xff);
- og->header[24] = (unsigned char)((crc_reg >> 16) & 0xff);
- og->header[25] = (unsigned char)((crc_reg >> 24) & 0xff);
- }
+void ogg_page_checksum_set(ogg_page *og){
+ if(og){
+ ogg_uint32_t crc_reg=0;
+ int i;
+
+ /* safety; needed for API behavior, but not framing code */
+ og->header[22]=0;
+ og->header[23]=0;
+ og->header[24]=0;
+ og->header[25]=0;
+
+ for(i=0;i<og->header_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
+ for(i=0;i<og->body_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
+
+ og->header[22]=(unsigned char)(crc_reg&0xff);
+ og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
+ og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
+ og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
+ }
}
/* submit data to the internal buffer of the framing engine */
int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
- long e_o_s, ogg_int64_t granulepos)
-{
-
- int bytes = 0, lacing_vals, i;
-
- if(ogg_stream_check(os)) return -1;
- if(!iov) return 0;
-
- for(i = 0; i < count; ++i) bytes += (int)iov[i].iov_len;
- lacing_vals = bytes / 255 + 1;
-
- if(os->body_returned)
- {
- /* advance packet data according to the body_returned pointer. We
- had to keep it around to return a pointer into the buffer last
- call */
-
- os->body_fill -= os->body_returned;
- if(os->body_fill)
- memmove(os->body_data, os->body_data + os->body_returned,
- os->body_fill);
- os->body_returned = 0;
- }
-
- /* make sure we have the buffer storage */
- if(_os_body_expand(os, bytes) || _os_lacing_expand(os, lacing_vals))
- return -1;
-
- /* Copy in the submitted packet. Yes, the copy is a waste; this is
- the liability of overly clean abstraction for the time being. It
- will actually be fairly easy to eliminate the extra copy in the
- future */
-
- for(i = 0; i < count; ++i)
- {
- memcpy(os->body_data + os->body_fill, iov[i].iov_base, iov[i].iov_len);
- os->body_fill += (int)iov[i].iov_len;
- }
-
- /* Store lacing vals for this packet */
- for(i = 0; i < lacing_vals - 1; i++)
- {
- os->lacing_vals[os->lacing_fill+i] = 255;
- os->granule_vals[os->lacing_fill+i] = os->granulepos;
- }
- os->lacing_vals[os->lacing_fill+i] = bytes % 255;
- os->granulepos = os->granule_vals[os->lacing_fill+i] = granulepos;
-
- /* flag the first segment as the beginning of the packet */
- os->lacing_vals[os->lacing_fill] |= 0x100;
-
- os->lacing_fill += lacing_vals;
-
- /* for the sake of completeness */
- os->packetno++;
-
- if(e_o_s)os->e_o_s = 1;
-
- return(0);
+ long e_o_s, ogg_int64_t granulepos){
+
+ int bytes = 0, lacing_vals, i;
+
+ if(ogg_stream_check(os)) return -1;
+ if(!iov) return 0;
+
+ for (i = 0; i < count; ++i) bytes += (int)iov[i].iov_len;
+ lacing_vals=bytes/255+1;
+
+ if(os->body_returned){
+ /* advance packet data according to the body_returned pointer. We
+ had to keep it around to return a pointer into the buffer last
+ call */
+
+ os->body_fill-=os->body_returned;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+os->body_returned,
+ os->body_fill);
+ os->body_returned=0;
+ }
+
+ /* make sure we have the buffer storage */
+ if(_os_body_expand(os,bytes) || _os_lacing_expand(os,lacing_vals))
+ return -1;
+
+ /* Copy in the submitted packet. Yes, the copy is a waste; this is
+ the liability of overly clean abstraction for the time being. It
+ will actually be fairly easy to eliminate the extra copy in the
+ future */
+
+ for (i = 0; i < count; ++i) {
+ memcpy(os->body_data+os->body_fill, iov[i].iov_base, iov[i].iov_len);
+ os->body_fill += (int)iov[i].iov_len;
+ }
+
+ /* Store lacing vals for this packet */
+ for(i=0;i<lacing_vals-1;i++){
+ os->lacing_vals[os->lacing_fill+i]=255;
+ os->granule_vals[os->lacing_fill+i]=os->granulepos;
+ }
+ os->lacing_vals[os->lacing_fill+i]=bytes%255;
+ os->granulepos=os->granule_vals[os->lacing_fill+i]=granulepos;
+
+ /* flag the first segment as the beginning of the packet */
+ os->lacing_vals[os->lacing_fill]|= 0x100;
+
+ os->lacing_fill+=lacing_vals;
+
+ /* for the sake of completeness */
+ os->packetno++;
+
+ if(e_o_s)os->e_o_s=1;
+
+ return(0);
}
-int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
-{
- ogg_iovec_t iov;
- iov.iov_base = op->packet;
- iov.iov_len = op->bytes;
- return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos);
+int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
+ ogg_iovec_t iov;
+ iov.iov_base = op->packet;
+ iov.iov_len = op->bytes;
+ return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos);
}
/* This will flush remaining packets into a page (returning nonzero),
@@ -410,127 +377,117 @@ int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
since ogg_stream_flush will flush the last page in a stream even if
it's undersized, you almost certainly want to use ogg_stream_pageout
- (and *not* ogg_stream_flush) unless you specifically need to flush
+ (and *not* ogg_stream_flush) unless you specifically need to flush
an page regardless of size in the middle of a stream. */
-int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
-{
- int i;
- int vals = 0;
- int maxvals = (os->lacing_fill > 255 ? 255 : os->lacing_fill);
- int bytes = 0;
- long acc = 0;
- ogg_int64_t granule_pos = -1;
-
- if(ogg_stream_check(os)) return 0;
- if(maxvals == 0)return 0;
-
- /* construct a page */
- /* decide how many segments to include */
-
- /* If this is the initial header case, the first page must only include
- the initial header packet */
- if(os->b_o_s == 0) /* 'initial header page' case */
- {
- granule_pos = 0;
- for(vals = 0; vals < maxvals; vals++)
- {
- if((os->lacing_vals[vals] & 0x0ff) < 255)
- {
- vals++;
- break;
- }
- }
- }
- else
- {
- for(vals = 0; vals < maxvals; vals++)
- {
- if(acc > 4096)break;
- acc += os->lacing_vals[vals] & 0x0ff;
- if((os->lacing_vals[vals] & 0xff) < 255)
- granule_pos = os->granule_vals[vals];
- }
+int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
+ int i;
+ int vals=0;
+ int maxvals=(os->lacing_fill>255?255:os->lacing_fill);
+ int bytes=0;
+ long acc=0;
+ ogg_int64_t granule_pos=-1;
+
+ if(ogg_stream_check(os)) return 0;
+ if(maxvals==0)return 0;
+
+ /* construct a page */
+ /* decide how many segments to include */
+
+ /* If this is the initial header case, the first page must only include
+ the initial header packet */
+ if(os->b_o_s==0){ /* 'initial header page' case */
+ granule_pos=0;
+ for(vals=0;vals<maxvals;vals++){
+ if((os->lacing_vals[vals]&0x0ff)<255){
+ vals++;
+ break;
+ }
}
-
- /* construct the header in temp storage */
- memcpy(os->header, "OggS", 4);
-
- /* stream structure version */
- os->header[4] = 0x00;
-
- /* continued packet flag? */
- os->header[5] = 0x00;
- if((os->lacing_vals[0] & 0x100) == 0)os->header[5] |= 0x01;
- /* first page flag? */
- if(os->b_o_s == 0)os->header[5] |= 0x02;
- /* last page flag? */
- if(os->e_o_s && os->lacing_fill == vals)os->header[5] |= 0x04;
- os->b_o_s = 1;
-
- /* 64 bits of PCM position */
- for(i = 6; i < 14; i++)
- {
- os->header[i] = (unsigned char)(granule_pos & 0xff);
- granule_pos >>= 8;
+ }else{
+ for(vals=0;vals<maxvals;vals++){
+ if(acc>4096)break;
+ acc+=os->lacing_vals[vals]&0x0ff;
+ if((os->lacing_vals[vals]&0xff)<255)
+ granule_pos=os->granule_vals[vals];
}
-
- /* 32 bits of stream serial number */
- {
- long serialno = os->serialno;
- for(i = 14; i < 18; i++)
- {
- os->header[i] = (unsigned char)(serialno & 0xff);
- serialno >>= 8;
- }
+ }
+
+ /* construct the header in temp storage */
+ memcpy(os->header,"OggS",4);
+
+ /* stream structure version */
+ os->header[4]=0x00;
+
+ /* continued packet flag? */
+ os->header[5]=0x00;
+ if((os->lacing_vals[0]&0x100)==0)os->header[5]|=0x01;
+ /* first page flag? */
+ if(os->b_o_s==0)os->header[5]|=0x02;
+ /* last page flag? */
+ if(os->e_o_s && os->lacing_fill==vals)os->header[5]|=0x04;
+ os->b_o_s=1;
+
+ /* 64 bits of PCM position */
+ for(i=6;i<14;i++){
+ os->header[i]=(unsigned char)(granule_pos&0xff);
+ granule_pos>>=8;
+ }
+
+ /* 32 bits of stream serial number */
+ {
+ long serialno=os->serialno;
+ for(i=14;i<18;i++){
+ os->header[i]=(unsigned char)(serialno&0xff);
+ serialno>>=8;
}
+ }
- /* 32 bits of page counter (we have both counter and page header
- because this val can roll over) */
- if(os->pageno == -1)os->pageno = 0; /* because someone called
+ /* 32 bits of page counter (we have both counter and page header
+ because this val can roll over) */
+ if(os->pageno==-1)os->pageno=0; /* because someone called
stream_reset; this would be a
strange thing to do in an
encode stream, but it has
plausible uses */
- {
- long pageno = os->pageno++;
- for(i = 18; i < 22; i++)
- {
- os->header[i] = (unsigned char)(pageno & 0xff);
- pageno >>= 8;
- }
+ {
+ long pageno=os->pageno++;
+ for(i=18;i<22;i++){
+ os->header[i]=(unsigned char)(pageno&0xff);
+ pageno>>=8;
}
-
- /* zero for computation; filled in later */
- os->header[22] = 0;
- os->header[23] = 0;
- os->header[24] = 0;
- os->header[25] = 0;
-
- /* segment table */
- os->header[26] = (unsigned char)(vals & 0xff);
- for(i = 0; i < vals; i++)
- bytes += os->header[i+27] = (unsigned char)(os->lacing_vals[i] & 0xff);
-
- /* set pointers in the ogg_page struct */
- og->header = os->header;
- og->header_len = os->header_fill = vals + 27;
- og->body = os->body_data + os->body_returned;
- og->body_len = bytes;
-
- /* advance the lacing data and set the body_returned pointer */
-
- os->lacing_fill -= vals;
- memmove(os->lacing_vals, os->lacing_vals + vals, os->lacing_fill * sizeof(*os->lacing_vals));
- memmove(os->granule_vals, os->granule_vals + vals, os->lacing_fill * sizeof(*os->granule_vals));
- os->body_returned += bytes;
-
- /* calculate the checksum */
-
- ogg_page_checksum_set(og);
-
- /* done */
- return(1);
+ }
+
+ /* zero for computation; filled in later */
+ os->header[22]=0;
+ os->header[23]=0;
+ os->header[24]=0;
+ os->header[25]=0;
+
+ /* segment table */
+ os->header[26]=(unsigned char)(vals&0xff);
+ for(i=0;i<vals;i++)
+ bytes+=os->header[i+27]=(unsigned char)(os->lacing_vals[i]&0xff);
+
+ /* set pointers in the ogg_page struct */
+ og->header=os->header;
+ og->header_len=os->header_fill=vals+27;
+ og->body=os->body_data+os->body_returned;
+ og->body_len=bytes;
+
+ /* advance the lacing data and set the body_returned pointer */
+
+ os->lacing_fill-=vals;
+ memmove(os->lacing_vals,os->lacing_vals+vals,os->lacing_fill*sizeof(*os->lacing_vals));
+ memmove(os->granule_vals,os->granule_vals+vals,os->lacing_fill*sizeof(*os->granule_vals));
+ os->body_returned+=bytes;
+
+ /* calculate the checksum */
+
+ ogg_page_checksum_set(og);
+
+ /* done */
+ return(1);
}
@@ -538,27 +495,24 @@ int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
returned are to static buffers; do not free. The returned buffers are
good only until the next call (using the same ogg_stream_state) */
-int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og)
-{
- if(ogg_stream_check(os)) return 0;
-
- if((os->e_o_s && os->lacing_fill) || /* 'were done, now flush' case */
- os->body_fill - os->body_returned > 4096 || /* 'page nominal size' case */
- os->lacing_fill >= 255 || /* 'segment table full' case */
- (os->lacing_fill && !os->b_o_s)) /* 'initial header page' case */
- {
-
- return(ogg_stream_flush(os, og));
- }
-
- /* not enough data to construct a page and not end of stream */
- return 0;
+int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){
+ if(ogg_stream_check(os)) return 0;
+
+ if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */
+ os->body_fill-os->body_returned > 4096 ||/* 'page nominal size' case */
+ os->lacing_fill>=255 || /* 'segment table full' case */
+ (os->lacing_fill&&!os->b_o_s)){ /* 'initial header page' case */
+
+ return(ogg_stream_flush(os,og));
+ }
+
+ /* not enough data to construct a page and not end of stream */
+ return 0;
}
-int ogg_stream_eos(ogg_stream_state *os)
-{
- if(ogg_stream_check(os)) return 1;
- return os->e_o_s;
+int ogg_stream_eos(ogg_stream_state *os){
+ if(ogg_stream_check(os)) return 1;
+ return os->e_o_s;
}
/* DECODING PRIMITIVES: packet streaming layer **********************/
@@ -577,85 +531,73 @@ int ogg_stream_eos(ogg_stream_state *os)
ogg_stream_state. */
/* initialize the struct to a known state */
-int ogg_sync_init(ogg_sync_state *oy)
-{
- if(oy)
- {
- oy->storage = -1; /* used as a readiness flag */
- memset(oy, 0, sizeof(*oy));
- }
- return(0);
+int ogg_sync_init(ogg_sync_state *oy){
+ if(oy){
+ oy->storage = -1; /* used as a readiness flag */
+ memset(oy,0,sizeof(*oy));
+ }
+ return(0);
}
/* clear non-flat storage within */
-int ogg_sync_clear(ogg_sync_state *oy)
-{
- if(oy)
- {
- if(oy->data)_ogg_free(oy->data);
- memset(oy, 0, sizeof(*oy));
- }
- return(0);
+int ogg_sync_clear(ogg_sync_state *oy){
+ if(oy){
+ if(oy->data)_ogg_free(oy->data);
+ memset(oy,0,sizeof(*oy));
+ }
+ return(0);
}
-int ogg_sync_destroy(ogg_sync_state *oy)
-{
- if(oy)
- {
- ogg_sync_clear(oy);
- _ogg_free(oy);
- }
- return(0);
+int ogg_sync_destroy(ogg_sync_state *oy){
+ if(oy){
+ ogg_sync_clear(oy);
+ _ogg_free(oy);
+ }
+ return(0);
}
-int ogg_sync_check(ogg_sync_state *oy)
-{
- if(oy->storage < 0) return -1;
- return 0;
+int ogg_sync_check(ogg_sync_state *oy){
+ if(oy->storage<0) return -1;
+ return 0;
}
-char *ogg_sync_buffer(ogg_sync_state *oy, long size)
-{
- if(ogg_sync_check(oy)) return NULL;
+char *ogg_sync_buffer(ogg_sync_state *oy, long size){
+ if(ogg_sync_check(oy)) return NULL;
- /* first, clear out any space that has been previously returned */
- if(oy->returned)
- {
- oy->fill -= oy->returned;
- if(oy->fill > 0)
- memmove(oy->data, oy->data + oy->returned, oy->fill);
- oy->returned = 0;
- }
+ /* first, clear out any space that has been previously returned */
+ if(oy->returned){
+ oy->fill-=oy->returned;
+ if(oy->fill>0)
+ memmove(oy->data,oy->data+oy->returned,oy->fill);
+ oy->returned=0;
+ }
- if(size > oy->storage - oy->fill)
- {
- /* We need to extend the internal buffer */
- long newsize = size + oy->fill + 4096; /* an extra page to be nice */
- void *ret;
-
- if(oy->data)
- ret = _ogg_realloc(oy->data, newsize);
- else
- ret = _ogg_malloc(newsize);
- if(!ret)
- {
- ogg_sync_clear(oy);
- return NULL;
- }
- oy->data = ret;
- oy->storage = newsize;
+ if(size>oy->storage-oy->fill){
+ /* We need to extend the internal buffer */
+ long newsize=size+oy->fill+4096; /* an extra page to be nice */
+ void *ret;
+
+ if(oy->data)
+ ret=_ogg_realloc(oy->data,newsize);
+ else
+ ret=_ogg_malloc(newsize);
+ if(!ret){
+ ogg_sync_clear(oy);
+ return NULL;
}
+ oy->data=ret;
+ oy->storage=newsize;
+ }
- /* expose a segment at least as large as requested at the fill mark */
- return((char *)oy->data + oy->fill);
+ /* expose a segment at least as large as requested at the fill mark */
+ return((char *)oy->data+oy->fill);
}
-int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
-{
- if(ogg_sync_check(oy))return -1;
- if(oy->fill + bytes > oy->storage)return -1;
- oy->fill += bytes;
- return(0);
+int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
+ if(ogg_sync_check(oy))return -1;
+ if(oy->fill+bytes>oy->storage)return -1;
+ oy->fill+=bytes;
+ return(0);
}
/* sync the stream. This is meant to be useful for finding page
@@ -665,98 +607,94 @@ int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
-n) skipped n bytes
0) page not ready; more data (no bytes skipped)
n) page synced at current location; page length n bytes
-
+
*/
-long ogg_sync_pageseek(ogg_sync_state *oy, ogg_page *og)
-{
- unsigned char *page = oy->data + oy->returned;
- unsigned char *next;
- long bytes = oy->fill - oy->returned;
-
- if(ogg_sync_check(oy))return 0;
-
- if(oy->headerbytes == 0)
- {
- int headerbytes, i;
- if(bytes < 27)return(0); /* not enough for a header */
-
- /* verify capture pattern */
- if(memcmp(page, "OggS", 4))goto sync_fail;
-
- headerbytes = page[26] + 27;
- if(bytes < headerbytes)return(0); /* not enough for header + seg table */
-
- /* count up body length in the segment table */
-
- for(i = 0; i < page[26]; i++)
- oy->bodybytes += page[27+i];
- oy->headerbytes = headerbytes;
+long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
+ unsigned char *page=oy->data+oy->returned;
+ unsigned char *next;
+ long bytes=oy->fill-oy->returned;
+
+ if(ogg_sync_check(oy))return 0;
+
+ if(oy->headerbytes==0){
+ int headerbytes,i;
+ if(bytes<27)return(0); /* not enough for a header */
+
+ /* verify capture pattern */
+ if(memcmp(page,"OggS",4))goto sync_fail;
+
+ headerbytes=page[26]+27;
+ if(bytes<headerbytes)return(0); /* not enough for header + seg table */
+
+ /* count up body length in the segment table */
+
+ for(i=0;i<page[26];i++)
+ oy->bodybytes+=page[27+i];
+ oy->headerbytes=headerbytes;
+ }
+
+ if(oy->bodybytes+oy->headerbytes>bytes)return(0);
+
+ /* The whole test page is buffered. Verify the checksum */
+ {
+ /* Grab the checksum bytes, set the header field to zero */
+ char chksum[4];
+ ogg_page log;
+
+ memcpy(chksum,page+22,4);
+ memset(page+22,0,4);
+
+ /* set up a temp page struct and recompute the checksum */
+ log.header=page;
+ log.header_len=oy->headerbytes;
+ log.body=page+oy->headerbytes;
+ log.body_len=oy->bodybytes;
+ ogg_page_checksum_set(&log);
+
+ /* Compare */
+ if(memcmp(chksum,page+22,4)){
+ /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
+ at all) */
+ /* replace the computed checksum with the one actually read in */
+ memcpy(page+22,chksum,4);
+
+ /* Bad checksum. Lose sync */
+ goto sync_fail;
}
-
- if(oy->bodybytes + oy->headerbytes > bytes)return(0);
-
- /* The whole test page is buffered. Verify the checksum */
- {
- /* Grab the checksum bytes, set the header field to zero */
- char chksum[4];
- ogg_page log;
-
- memcpy(chksum, page + 22, 4);
- memset(page + 22, 0, 4);
-
- /* set up a temp page struct and recompute the checksum */
- log.header = page;
- log.header_len = oy->headerbytes;
- log.body = page + oy->headerbytes;
- log.body_len = oy->bodybytes;
- ogg_page_checksum_set(&log);
-
- /* Compare */
- if(memcmp(chksum, page + 22, 4))
- {
- /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
- at all) */
- /* replace the computed checksum with the one actually read in */
- memcpy(page + 22, chksum, 4);
-
- /* Bad checksum. Lose sync */
- goto sync_fail;
- }
+ }
+
+ /* yes, have a whole page all ready to go */
+ {
+ unsigned char *page=oy->data+oy->returned;
+ long bytes;
+
+ if(og){
+ og->header=page;
+ og->header_len=oy->headerbytes;
+ og->body=page+oy->headerbytes;
+ og->body_len=oy->bodybytes;
}
- /* yes, have a whole page all ready to go */
- {
- unsigned char *page = oy->data + oy->returned;
- long bytes;
-
- if(og)
- {
- og->header = page;
- og->header_len = oy->headerbytes;
- og->body = page + oy->headerbytes;
- og->body_len = oy->bodybytes;
- }
-
- oy->unsynced = 0;
- oy->returned += (bytes = oy->headerbytes + oy->bodybytes);
- oy->headerbytes = 0;
- oy->bodybytes = 0;
- return(bytes);
- }
-
-sync_fail:
-
- oy->headerbytes = 0;
- oy->bodybytes = 0;
-
- /* search for possible capture */
- next = memchr(page + 1, 'O', bytes - 1);
- if(!next)
- next = oy->data + oy->fill;
-
- oy->returned = (int)(next - oy->data);
- return((long) - (next - page));
+ oy->unsynced=0;
+ oy->returned+=(bytes=oy->headerbytes+oy->bodybytes);
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(bytes);
+ }
+
+ sync_fail:
+
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+
+ /* search for possible capture */
+ next=memchr(page+1,'O',bytes-1);
+ if(!next)
+ next=oy->data+oy->fill;
+
+ oy->returned=(int)(next-oy->data);
+ return((long)-(next-page));
}
/* sync the stream and get a page. Keep trying until we find a page.
@@ -770,305 +708,274 @@ sync_fail:
Returns pointers into buffered data; invalidated by next call to
_stream, _clear, _init, or _buffer */
-int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og)
-{
-
- if(ogg_sync_check(oy))return 0;
+int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
- /* all we need to do is verify a page at the head of the stream
- buffer. If it doesn't verify, we look for the next potential
- frame */
+ if(ogg_sync_check(oy))return 0;
- for(;;)
- {
- long ret = ogg_sync_pageseek(oy, og);
- if(ret > 0)
- {
- /* have a page */
- return(1);
- }
- if(ret == 0)
- {
- /* need more data */
- return(0);
- }
+ /* all we need to do is verify a page at the head of the stream
+ buffer. If it doesn't verify, we look for the next potential
+ frame */
- /* head did not start a synced page... skipped some bytes */
- if(!oy->unsynced)
- {
- oy->unsynced = 1;
- return(-1);
- }
+ for(;;){
+ long ret=ogg_sync_pageseek(oy,og);
+ if(ret>0){
+ /* have a page */
+ return(1);
+ }
+ if(ret==0){
+ /* need more data */
+ return(0);
+ }
+
+ /* head did not start a synced page... skipped some bytes */
+ if(!oy->unsynced){
+ oy->unsynced=1;
+ return(-1);
+ }
- /* loop. keep looking */
+ /* loop. keep looking */
- }
+ }
}
/* add the incoming page to the stream state; we decompose the page
into packet segments here as well. */
-int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og)
-{
- unsigned char *header = og->header;
- unsigned char *body = og->body;
- long bodysize = og->body_len;
- int segptr = 0;
-
- int version = ogg_page_version(og);
- int continued = ogg_page_continued(og);
- int bos = ogg_page_bos(og);
- int eos = ogg_page_eos(og);
- ogg_int64_t granulepos = ogg_page_granulepos(og);
- int serialno = ogg_page_serialno(og);
- long pageno = ogg_page_pageno(og);
- int segments = header[26];
-
- if(ogg_stream_check(os)) return -1;
-
- /* clean up 'returned data' */
- {
- long lr = os->lacing_returned;
- long br = os->body_returned;
-
- /* body data */
- if(br)
- {
- os->body_fill -= br;
- if(os->body_fill)
- memmove(os->body_data, os->body_data + br, os->body_fill);
- os->body_returned = 0;
- }
+int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
+ unsigned char *header=og->header;
+ unsigned char *body=og->body;
+ long bodysize=og->body_len;
+ int segptr=0;
+
+ int version=ogg_page_version(og);
+ int continued=ogg_page_continued(og);
+ int bos=ogg_page_bos(og);
+ int eos=ogg_page_eos(og);
+ ogg_int64_t granulepos=ogg_page_granulepos(og);
+ int serialno=ogg_page_serialno(og);
+ long pageno=ogg_page_pageno(og);
+ int segments=header[26];
+
+ if(ogg_stream_check(os)) return -1;
+
+ /* clean up 'returned data' */
+ {
+ long lr=os->lacing_returned;
+ long br=os->body_returned;
+
+ /* body data */
+ if(br){
+ os->body_fill-=br;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+br,os->body_fill);
+ os->body_returned=0;
+ }
- if(lr)
- {
- /* segment table */
- if(os->lacing_fill - lr)
- {
- memmove(os->lacing_vals, os->lacing_vals + lr,
- (os->lacing_fill - lr)*sizeof(*os->lacing_vals));
- memmove(os->granule_vals, os->granule_vals + lr,
- (os->lacing_fill - lr)*sizeof(*os->granule_vals));
- }
- os->lacing_fill -= lr;
- os->lacing_packet -= lr;
- os->lacing_returned = 0;
- }
+ if(lr){
+ /* segment table */
+ if(os->lacing_fill-lr){
+ memmove(os->lacing_vals,os->lacing_vals+lr,
+ (os->lacing_fill-lr)*sizeof(*os->lacing_vals));
+ memmove(os->granule_vals,os->granule_vals+lr,
+ (os->lacing_fill-lr)*sizeof(*os->granule_vals));
+ }
+ os->lacing_fill-=lr;
+ os->lacing_packet-=lr;
+ os->lacing_returned=0;
}
+ }
- /* check the serial number */
- if(serialno != os->serialno)return(-1);
- if(version > 0)return(-1);
+ /* check the serial number */
+ if(serialno!=os->serialno)return(-1);
+ if(version>0)return(-1);
- if(_os_lacing_expand(os, segments + 1)) return -1;
+ if(_os_lacing_expand(os,segments+1)) return -1;
- /* are we in sequence? */
- if(pageno != os->pageno)
- {
- int i;
+ /* are we in sequence? */
+ if(pageno!=os->pageno){
+ int i;
- /* unroll previous partial packet (if any) */
- for(i = os->lacing_packet; i < os->lacing_fill; i++)
- os->body_fill -= os->lacing_vals[i] & 0xff;
- os->lacing_fill = os->lacing_packet;
+ /* unroll previous partial packet (if any) */
+ for(i=os->lacing_packet;i<os->lacing_fill;i++)
+ os->body_fill-=os->lacing_vals[i]&0xff;
+ os->lacing_fill=os->lacing_packet;
- /* make a note of dropped data in segment table */
- if(os->pageno != -1)
- {
- os->lacing_vals[os->lacing_fill++] = 0x400;
- os->lacing_packet++;
- }
+ /* make a note of dropped data in segment table */
+ if(os->pageno!=-1){
+ os->lacing_vals[os->lacing_fill++]=0x400;
+ os->lacing_packet++;
}
-
- /* are we a 'continued packet' page? If so, we may need to skip
- some segments */
- if(continued)
- {
- if(os->lacing_fill < 1 ||
- os->lacing_vals[os->lacing_fill-1] == 0x400)
- {
- bos = 0;
- for(; segptr < segments; segptr++)
- {
- int val = header[27+segptr];
- body += val;
- bodysize -= val;
- if(val < 255)
- {
- segptr++;
- break;
- }
- }
+ }
+
+ /* are we a 'continued packet' page? If so, we may need to skip
+ some segments */
+ if(continued){
+ if(os->lacing_fill<1 ||
+ os->lacing_vals[os->lacing_fill-1]==0x400){
+ bos=0;
+ for(;segptr<segments;segptr++){
+ int val=header[27+segptr];
+ body+=val;
+ bodysize-=val;
+ if(val<255){
+ segptr++;
+ break;
}
+ }
}
-
- if(bodysize)
- {
- if(_os_body_expand(os, bodysize)) return -1;
- memcpy(os->body_data + os->body_fill, body, bodysize);
- os->body_fill += bodysize;
+ }
+
+ if(bodysize){
+ if(_os_body_expand(os,bodysize)) return -1;
+ memcpy(os->body_data+os->body_fill,body,bodysize);
+ os->body_fill+=bodysize;
+ }
+
+ {
+ int saved=-1;
+ while(segptr<segments){
+ int val=header[27+segptr];
+ os->lacing_vals[os->lacing_fill]=val;
+ os->granule_vals[os->lacing_fill]=-1;
+
+ if(bos){
+ os->lacing_vals[os->lacing_fill]|=0x100;
+ bos=0;
+ }
+
+ if(val<255)saved=os->lacing_fill;
+
+ os->lacing_fill++;
+ segptr++;
+
+ if(val<255)os->lacing_packet=os->lacing_fill;
}
-
- {
- int saved = -1;
- while(segptr < segments)
- {
- int val = header[27+segptr];
- os->lacing_vals[os->lacing_fill] = val;
- os->granule_vals[os->lacing_fill] = -1;
-
- if(bos)
- {
- os->lacing_vals[os->lacing_fill] |= 0x100;
- bos = 0;
- }
-
- if(val < 255)saved = os->lacing_fill;
-
- os->lacing_fill++;
- segptr++;
-
- if(val < 255)os->lacing_packet = os->lacing_fill;
- }
-
- /* set the granulepos on the last granuleval of the last full packet */
- if(saved != -1)
- {
- os->granule_vals[saved] = granulepos;
- }
-
+
+ /* set the granulepos on the last granuleval of the last full packet */
+ if(saved!=-1){
+ os->granule_vals[saved]=granulepos;
}
- if(eos)
- {
- os->e_o_s = 1;
- if(os->lacing_fill > 0)
- os->lacing_vals[os->lacing_fill-1] |= 0x200;
- }
+ }
- os->pageno = pageno + 1;
+ if(eos){
+ os->e_o_s=1;
+ if(os->lacing_fill>0)
+ os->lacing_vals[os->lacing_fill-1]|=0x200;
+ }
- return(0);
+ os->pageno=pageno+1;
+
+ return(0);
}
/* clear things to an initial state. Good to call, eg, before seeking */
-int ogg_sync_reset(ogg_sync_state *oy)
-{
- if(ogg_sync_check(oy))return -1;
-
- oy->fill = 0;
- oy->returned = 0;
- oy->unsynced = 0;
- oy->headerbytes = 0;
- oy->bodybytes = 0;
- return(0);
+int ogg_sync_reset(ogg_sync_state *oy){
+ if(ogg_sync_check(oy))return -1;
+
+ oy->fill=0;
+ oy->returned=0;
+ oy->unsynced=0;
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(0);
}
-int ogg_stream_reset(ogg_stream_state *os)
-{
- if(ogg_stream_check(os)) return -1;
+int ogg_stream_reset(ogg_stream_state *os){
+ if(ogg_stream_check(os)) return -1;
- os->body_fill = 0;
- os->body_returned = 0;
+ os->body_fill=0;
+ os->body_returned=0;
- os->lacing_fill = 0;
- os->lacing_packet = 0;
- os->lacing_returned = 0;
+ os->lacing_fill=0;
+ os->lacing_packet=0;
+ os->lacing_returned=0;
- os->header_fill = 0;
+ os->header_fill=0;
- os->e_o_s = 0;
- os->b_o_s = 0;
- os->pageno = -1;
- os->packetno = 0;
- os->granulepos = 0;
+ os->e_o_s=0;
+ os->b_o_s=0;
+ os->pageno=-1;
+ os->packetno=0;
+ os->granulepos=0;
- return(0);
+ return(0);
}
-int ogg_stream_reset_serialno(ogg_stream_state *os, int serialno)
-{
- if(ogg_stream_check(os)) return -1;
- ogg_stream_reset(os);
- os->serialno = serialno;
- return(0);
+int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
+ if(ogg_stream_check(os)) return -1;
+ ogg_stream_reset(os);
+ os->serialno=serialno;
+ return(0);
}
-static int _packetout(ogg_stream_state *os, ogg_packet *op, int adv)
-{
+static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
- /* The last part of decode. We have the stream broken into packet
- segments. Now we need to group them into packets (or return the
- out of sync markers) */
+ /* The last part of decode. We have the stream broken into packet
+ segments. Now we need to group them into packets (or return the
+ out of sync markers) */
- int ptr = os->lacing_returned;
+ int ptr=os->lacing_returned;
- if(os->lacing_packet <= ptr)return(0);
+ if(os->lacing_packet<=ptr)return(0);
- if(os->lacing_vals[ptr] & 0x400)
- {
- /* we need to tell the codec there's a gap; it might need to
- handle previous packet dependencies. */
- os->lacing_returned++;
- os->packetno++;
- return(-1);
- }
+ if(os->lacing_vals[ptr]&0x400){
+ /* we need to tell the codec there's a gap; it might need to
+ handle previous packet dependencies. */
+ os->lacing_returned++;
+ os->packetno++;
+ return(-1);
+ }
- if(!op && !adv)return(1); /* just using peek as an inexpensive way
+ if(!op && !adv)return(1); /* just using peek as an inexpensive way
to ask if there's a whole packet
waiting */
- /* Gather the whole packet. We'll have no holes or a partial packet */
- {
- int size = os->lacing_vals[ptr] & 0xff;
- int bytes = size;
- int eos = os->lacing_vals[ptr] & 0x200; /* last packet of the stream? */
- int bos = os->lacing_vals[ptr] & 0x100; /* first packet of the stream? */
-
- while(size == 255)
- {
- int val = os->lacing_vals[++ptr];
- size = val & 0xff;
- if(val & 0x200)eos = 0x200;
- bytes += size;
- }
+ /* Gather the whole packet. We'll have no holes or a partial packet */
+ {
+ int size=os->lacing_vals[ptr]&0xff;
+ int bytes=size;
+ int eos=os->lacing_vals[ptr]&0x200; /* last packet of the stream? */
+ int bos=os->lacing_vals[ptr]&0x100; /* first packet of the stream? */
+
+ while(size==255){
+ int val=os->lacing_vals[++ptr];
+ size=val&0xff;
+ if(val&0x200)eos=0x200;
+ bytes+=size;
+ }
- if(op)
- {
- op->e_o_s = eos;
- op->b_o_s = bos;
- op->packet = os->body_data + os->body_returned;
- op->packetno = os->packetno;
- op->granulepos = os->granule_vals[ptr];
- op->bytes = bytes;
- }
+ if(op){
+ op->e_o_s=eos;
+ op->b_o_s=bos;
+ op->packet=os->body_data+os->body_returned;
+ op->packetno=os->packetno;
+ op->granulepos=os->granule_vals[ptr];
+ op->bytes=bytes;
+ }
- if(adv)
- {
- os->body_returned += bytes;
- os->lacing_returned = ptr + 1;
- os->packetno++;
- }
+ if(adv){
+ os->body_returned+=bytes;
+ os->lacing_returned=ptr+1;
+ os->packetno++;
}
- return(1);
+ }
+ return(1);
}
-int ogg_stream_packetout(ogg_stream_state *os, ogg_packet *op)
-{
- if(ogg_stream_check(os)) return 0;
- return _packetout(os, op, 1);
+int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
+ if(ogg_stream_check(os)) return 0;
+ return _packetout(os,op,1);
}
-int ogg_stream_packetpeek(ogg_stream_state *os, ogg_packet *op)
-{
- if(ogg_stream_check(os)) return 0;
- return _packetout(os, op, 0);
+int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
+ if(ogg_stream_check(os)) return 0;
+ return _packetout(os,op,0);
}
-void ogg_packet_clear(ogg_packet *op)
-{
- _ogg_free(op->packet);
- memset(op, 0, sizeof(*op));
+void ogg_packet_clear(ogg_packet *op) {
+ _ogg_free(op->packet);
+ memset(op, 0, sizeof(*op));
}
#ifdef _V_SELFTEST
@@ -1077,961 +984,893 @@ void ogg_packet_clear(ogg_packet *op)
ogg_stream_state os_en, os_de;
ogg_sync_state oy;
-void checkpacket(ogg_packet *op, int len, int no, int pos)
-{
- long j;
- static int sequence = 0;
- static int lastno = 0;
-
- if(op->bytes != len)
- {
- fprintf(stderr, "incorrect packet length!\n");
- exit(1);
- }
- if(op->granulepos != pos)
- {
- fprintf(stderr, "incorrect packet position!\n");
- exit(1);
- }
+void checkpacket(ogg_packet *op,int len, int no, int pos){
+ long j;
+ static int sequence=0;
+ static int lastno=0;
- /* packet number just follows sequence/gap; adjust the input number
- for that */
- if(no == 0)
- {
- sequence = 0;
- }
- else
- {
- sequence++;
- if(no > lastno + 1)
- sequence++;
- }
- lastno = no;
- if(op->packetno != sequence)
- {
- fprintf(stderr, "incorrect packet sequence %ld != %d\n",
- (long)(op->packetno), sequence);
- exit(1);
+ if(op->bytes!=len){
+ fprintf(stderr,"incorrect packet length!\n");
+ exit(1);
+ }
+ if(op->granulepos!=pos){
+ fprintf(stderr,"incorrect packet position!\n");
+ exit(1);
+ }
+
+ /* packet number just follows sequence/gap; adjust the input number
+ for that */
+ if(no==0){
+ sequence=0;
+ }else{
+ sequence++;
+ if(no>lastno+1)
+ sequence++;
+ }
+ lastno=no;
+ if(op->packetno!=sequence){
+ fprintf(stderr,"incorrect packet sequence %ld != %d\n",
+ (long)(op->packetno),sequence);
+ exit(1);
+ }
+
+ /* Test data */
+ for(j=0;j<op->bytes;j++)
+ if(op->packet[j]!=((j+no)&0xff)){
+ fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
+ j,op->packet[j],(j+no)&0xff);
+ exit(1);
}
-
- /* Test data */
- for(j = 0; j < op->bytes; j++)
- if(op->packet[j] != ((j + no) & 0xff))
- {
- fprintf(stderr, "body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
- j, op->packet[j], (j + no) & 0xff);
- exit(1);
- }
}
-void check_page(unsigned char *data, const int *header, ogg_page *og)
-{
- long j;
- /* Test data */
- for(j = 0; j < og->body_len; j++)
- if(og->body[j] != data[j])
- {
- fprintf(stderr, "body data mismatch (2) at pos %ld: %x!=%x!\n\n",
- j, data[j], og->body[j]);
- exit(1);
- }
-
- /* Test header */
- for(j = 0; j < og->header_len; j++)
- {
- if(og->header[j] != header[j])
- {
- fprintf(stderr, "header content mismatch at pos %ld:\n", j);
- for(j = 0; j < header[26] + 27; j++)
- fprintf(stderr, " (%ld)%02x:%02x", j, header[j], og->header[j]);
- fprintf(stderr, "\n");
- exit(1);
- }
+void check_page(unsigned char *data,const int *header,ogg_page *og){
+ long j;
+ /* Test data */
+ for(j=0;j<og->body_len;j++)
+ if(og->body[j]!=data[j]){
+ fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
+ j,data[j],og->body[j]);
+ exit(1);
}
- if(og->header_len != header[26] + 27)
- {
- fprintf(stderr, "header length incorrect! (%ld!=%d)\n",
- og->header_len, header[26] + 27);
- exit(1);
+
+ /* Test header */
+ for(j=0;j<og->header_len;j++){
+ if(og->header[j]!=header[j]){
+ fprintf(stderr,"header content mismatch at pos %ld:\n",j);
+ for(j=0;j<header[26]+27;j++)
+ fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
+ fprintf(stderr,"\n");
+ exit(1);
}
+ }
+ if(og->header_len!=header[26]+27){
+ fprintf(stderr,"header length incorrect! (%ld!=%d)\n",
+ og->header_len,header[26]+27);
+ exit(1);
+ }
}
-void print_header(ogg_page *og)
-{
- int j;
- fprintf(stderr, "\nHEADER:\n");
- fprintf(stderr, " capture: %c %c %c %c version: %d flags: %x\n",
- og->header[0], og->header[1], og->header[2], og->header[3],
- (int)og->header[4], (int)og->header[5]);
-
- fprintf(stderr, " granulepos: %d serialno: %d pageno: %ld\n",
- (og->header[9] << 24) | (og->header[8] << 16) |
- (og->header[7] << 8) | og->header[6],
- (og->header[17] << 24) | (og->header[16] << 16) |
- (og->header[15] << 8) | og->header[14],
- ((long)(og->header[21]) << 24) | (og->header[20] << 16) |
- (og->header[19] << 8) | og->header[18]);
-
- fprintf(stderr, " checksum: %02x:%02x:%02x:%02x\n segments: %d (",
- (int)og->header[22], (int)og->header[23],
- (int)og->header[24], (int)og->header[25],
- (int)og->header[26]);
-
- for(j = 27; j < og->header_len; j++)
- fprintf(stderr, "%d ", (int)og->header[j]);
- fprintf(stderr, ")\n\n");
+void print_header(ogg_page *og){
+ int j;
+ fprintf(stderr,"\nHEADER:\n");
+ fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n",
+ og->header[0],og->header[1],og->header[2],og->header[3],
+ (int)og->header[4],(int)og->header[5]);
+
+ fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n",
+ (og->header[9]<<24)|(og->header[8]<<16)|
+ (og->header[7]<<8)|og->header[6],
+ (og->header[17]<<24)|(og->header[16]<<16)|
+ (og->header[15]<<8)|og->header[14],
+ ((long)(og->header[21])<<24)|(og->header[20]<<16)|
+ (og->header[19]<<8)|og->header[18]);
+
+ fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (",
+ (int)og->header[22],(int)og->header[23],
+ (int)og->header[24],(int)og->header[25],
+ (int)og->header[26]);
+
+ for(j=27;j<og->header_len;j++)
+ fprintf(stderr,"%d ",(int)og->header[j]);
+ fprintf(stderr,")\n\n");
}
-void copy_page(ogg_page *og)
-{
- unsigned char *temp = _ogg_malloc(og->header_len);
- memcpy(temp, og->header, og->header_len);
- og->header = temp;
+void copy_page(ogg_page *og){
+ unsigned char *temp=_ogg_malloc(og->header_len);
+ memcpy(temp,og->header,og->header_len);
+ og->header=temp;
- temp = _ogg_malloc(og->body_len);
- memcpy(temp, og->body, og->body_len);
- og->body = temp;
+ temp=_ogg_malloc(og->body_len);
+ memcpy(temp,og->body,og->body_len);
+ og->body=temp;
}
-void free_page(ogg_page *og)
-{
- _ogg_free(og->header);
- _ogg_free(og->body);
+void free_page(ogg_page *og){
+ _ogg_free (og->header);
+ _ogg_free (og->body);
}
-void error(void)
-{
- fprintf(stderr, "error!\n");
- exit(1);
+void error(void){
+ fprintf(stderr,"error!\n");
+ exit(1);
}
/* 17 only */
-const int head1_0[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0x15, 0xed, 0xec, 0x91,
+const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x15,0xed,0xec,0x91,
1,
- 17
- };
+ 17};
/* 17, 254, 255, 256, 500, 510, 600 byte, pad */
-const int head1_1[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0x59, 0x10, 0x6c, 0x2c,
+const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x59,0x10,0x6c,0x2c,
1,
- 17
- };
-const int head2_1[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x89, 0x33, 0x85, 0xce,
+ 17};
+const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x89,0x33,0x85,0xce,
13,
- 254, 255, 0, 255, 1, 255, 245, 255, 255, 0,
- 255, 255, 90
- };
+ 254,255,0,255,1,255,245,255,255,0,
+ 255,255,90};
/* nil packets; beginning,middle,end */
-const int head1_2[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
-const int head2_2[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x5c, 0x3f, 0x66, 0xcb,
+ 0};
+const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x5c,0x3f,0x66,0xcb,
17,
- 17, 254, 255, 0, 0, 255, 1, 0, 255, 245, 255, 255, 0,
- 255, 255, 90, 0
- };
+ 17,254,255,0,0,255,1,0,255,245,255,255,0,
+ 255,255,90,0};
/* large initial packet */
-const int head1_3[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0x01, 0x27, 0x31, 0xaa,
+const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x01,0x27,0x31,0xaa,
18,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 10
- };
-
-const int head2_3[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x7f, 0x4e, 0x8a, 0xd2,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,10};
+
+const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x7f,0x4e,0x8a,0xd2,
4,
- 255, 4, 255, 0
- };
+ 255,4,255,0};
/* continuing packet test */
-const int head1_4[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_4[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x54, 0x05, 0x51, 0xc8,
+const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x54,0x05,0x51,0xc8,
17,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head3_4[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x05,
- 0x07, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0xc8, 0xc3, 0xcb, 0xed,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255};
+
+const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xc8,0xc3,0xcb,0xed,
5,
- 10, 255, 4, 255, 0
- };
+ 10,255,4,255,0};
/* page with the 255 segment limit */
-const int head1_5[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_5[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0x07, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0xed, 0x2a, 0x2e, 0xa7,
+const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0xed,0x2a,0x2e,0xa7,
255,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10
- };
-
-const int head3_5[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x04,
- 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0x6c, 0x3b, 0x82, 0x3d,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10};
+
+const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x6c,0x3b,0x82,0x3d,
1,
- 50
- };
+ 50};
/* packet that overspans over an entire page */
-const int head1_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x3c, 0xd9, 0x4d, 0x3f,
+const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x3c,0xd9,0x4d,0x3f,
17,
- 100, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head3_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x01,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0x01, 0xd2, 0xe5, 0xe5,
+ 100,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255};
+
+const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x01,0xd2,0xe5,0xe5,
17,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head4_6[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x05,
- 0x07, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 3, 0, 0, 0,
- 0xef, 0xdd, 0x88, 0xde,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255};
+
+const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,3,0,0,0,
+ 0xef,0xdd,0x88,0xde,
7,
- 255, 255, 75, 255, 4, 255, 0
- };
+ 255,255,75,255,4,255,0};
/* packet that overspans over an entire page */
-const int head1_7[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0,
- 0xff, 0x7b, 0x23, 0x17,
+const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
1,
- 0
- };
+ 0};
-const int head2_7[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x00,
- 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 1, 0, 0, 0,
- 0x3c, 0xd9, 0x4d, 0x3f,
+const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x3c,0xd9,0x4d,0x3f,
17,
- 100, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255
- };
-
-const int head3_7[] = {0x4f, 0x67, 0x67, 0x53, 0, 0x05,
- 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 2, 0, 0, 0,
- 0xd4, 0xe0, 0x60, 0xe5,
- 1, 0
- };
-
-void test_pack(const int *pl, const int **headers, int byteskip,
- int pageskip, int packetskip)
-{
- unsigned char *data = _ogg_malloc(1024 * 1024); /* for scripted test cases only */
- long inptr = 0;
- long outptr = 0;
- long deptr = 0;
- long depacket = 0;
- long granule_pos = 7, pageno = 0;
- int i, j, packets, pageout = pageskip;
- int eosflag = 0;
- int bosflag = 0;
-
- int byteskipcount = 0;
+ 100,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255};
+
+const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xd4,0xe0,0x60,0xe5,
+ 1,0};
+
+void test_pack(const int *pl, const int **headers, int byteskip,
+ int pageskip, int packetskip){
+ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
+ long inptr=0;
+ long outptr=0;
+ long deptr=0;
+ long depacket=0;
+ long granule_pos=7,pageno=0;
+ int i,j,packets,pageout=pageskip;
+ int eosflag=0;
+ int bosflag=0;
+
+ int byteskipcount=0;
+
+ ogg_stream_reset(&os_en);
+ ogg_stream_reset(&os_de);
+ ogg_sync_reset(&oy);
+
+ for(packets=0;packets<packetskip;packets++)
+ depacket+=pl[packets];
+
+ for(packets=0;;packets++)if(pl[packets]==-1)break;
+
+ for(i=0;i<packets;i++){
+ /* construct a test packet */
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.granulepos=granule_pos;
+
+ granule_pos+=1024;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+
+ /* submit the test packet */
+ ogg_stream_packetin(&os_en,&op);
+
+ /* retrieve any finished pages */
+ {
+ ogg_page og;
+
+ while(ogg_stream_pageout(&os_en,&og)){
+ /* We have a page. Check it carefully */
- ogg_stream_reset(&os_en);
- ogg_stream_reset(&os_de);
- ogg_sync_reset(&oy);
+ fprintf(stderr,"%ld, ",pageno);
- for(packets = 0; packets < packetskip; packets++)
- depacket += pl[packets];
+ if(headers[pageno]==NULL){
+ fprintf(stderr,"coded too many pages!\n");
+ exit(1);
+ }
- for(packets = 0;; packets++)if(pl[packets] == -1)break;
+ check_page(data+outptr,headers[pageno],&og);
- for(i = 0; i < packets; i++)
- {
- /* construct a test packet */
- ogg_packet op;
- int len = pl[i];
+ outptr+=og.body_len;
+ pageno++;
+ if(pageskip){
+ bosflag=1;
+ pageskip--;
+ deptr+=og.body_len;
+ }
- op.packet = data + inptr;
- op.bytes = len;
- op.e_o_s = (pl[i+1] < 0 ? 1 : 0);
- op.granulepos = granule_pos;
+ /* have a complete page; submit it to sync/decode */
- granule_pos += 1024;
+ {
+ ogg_page og_de;
+ ogg_packet op_de,op_de2;
+ char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len);
+ char *next=buf;
+ byteskipcount+=og.header_len;
+ if(byteskipcount>byteskip){
+ memcpy(next,og.header,byteskipcount-byteskip);
+ next+=byteskipcount-byteskip;
+ byteskipcount=byteskip;
+ }
+
+ byteskipcount+=og.body_len;
+ if(byteskipcount>byteskip){
+ memcpy(next,og.body,byteskipcount-byteskip);
+ next+=byteskipcount-byteskip;
+ byteskipcount=byteskip;
+ }
+
+ ogg_sync_wrote(&oy,next-buf);
+
+ while(1){
+ int ret=ogg_sync_pageout(&oy,&og_de);
+ if(ret==0)break;
+ if(ret<0)continue;
+ /* got a page. Happy happy. Verify that it's good. */
+
+ fprintf(stderr,"(%ld), ",pageout);
+
+ check_page(data+deptr,headers[pageout],&og_de);
+ deptr+=og_de.body_len;
+ pageout++;
+
+ /* submit it to deconstitution */
+ ogg_stream_pagein(&os_de,&og_de);
+
+ /* packets out? */
+ while(ogg_stream_packetpeek(&os_de,&op_de2)>0){
+ ogg_stream_packetpeek(&os_de,NULL);
+ ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
+
+ /* verify peek and out match */
+ if(memcmp(&op_de,&op_de2,sizeof(op_de))){
+ fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
- for(j = 0; j < len; j++)data[inptr++] = i + j;
+ /* verify the packet! */
+ /* check data */
+ if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
+ fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
+ /* check bos flag */
+ if(bosflag==0 && op_de.b_o_s==0){
+ fprintf(stderr,"b_o_s flag not set on packet!\n");
+ exit(1);
+ }
+ if(bosflag && op_de.b_o_s){
+ fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
+ exit(1);
+ }
+ bosflag=1;
+ depacket+=op_de.bytes;
+
+ /* check eos flag */
+ if(eosflag){
+ fprintf(stderr,"Multiple decoded packets with eos flag!\n");
+ exit(1);
+ }
- /* submit the test packet */
- ogg_stream_packetin(&os_en, &op);
+ if(op_de.e_o_s)eosflag=1;
- /* retrieve any finished pages */
- {
- ogg_page og;
-
- while(ogg_stream_pageout(&os_en, &og))
- {
- /* We have a page. Check it carefully */
-
- fprintf(stderr, "%ld, ", pageno);
-
- if(headers[pageno] == NULL)
- {
- fprintf(stderr, "coded too many pages!\n");
- exit(1);
- }
-
- check_page(data + outptr, headers[pageno], &og);
-
- outptr += og.body_len;
- pageno++;
- if(pageskip)
- {
- bosflag = 1;
- pageskip--;
- deptr += og.body_len;
- }
-
- /* have a complete page; submit it to sync/decode */
-
- {
- ogg_page og_de;
- ogg_packet op_de, op_de2;
- char *buf = ogg_sync_buffer(&oy, og.header_len + og.body_len);
- char *next = buf;
- byteskipcount += og.header_len;
- if(byteskipcount > byteskip)
- {
- memcpy(next, og.header, byteskipcount - byteskip);
- next += byteskipcount - byteskip;
- byteskipcount = byteskip;
- }
-
- byteskipcount += og.body_len;
- if(byteskipcount > byteskip)
- {
- memcpy(next, og.body, byteskipcount - byteskip);
- next += byteskipcount - byteskip;
- byteskipcount = byteskip;
- }
-
- ogg_sync_wrote(&oy, next - buf);
-
- while(1)
- {
- int ret = ogg_sync_pageout(&oy, &og_de);
- if(ret == 0)break;
- if(ret < 0)continue;
- /* got a page. Happy happy. Verify that it's good. */
-
- fprintf(stderr, "(%ld), ", pageout);
-
- check_page(data + deptr, headers[pageout], &og_de);
- deptr += og_de.body_len;
- pageout++;
-
- /* submit it to deconstitution */
- ogg_stream_pagein(&os_de, &og_de);
-
- /* packets out? */
- while(ogg_stream_packetpeek(&os_de, &op_de2) > 0)
- {
- ogg_stream_packetpeek(&os_de, NULL);
- ogg_stream_packetout(&os_de, &op_de); /* just catching them all */
-
- /* verify peek and out match */
- if(memcmp(&op_de, &op_de2, sizeof(op_de)))
- {
- fprintf(stderr, "packetout != packetpeek! pos=%ld\n",
- depacket);
- exit(1);
- }
-
- /* verify the packet! */
- /* check data */
- if(memcmp(data + depacket, op_de.packet, op_de.bytes))
- {
- fprintf(stderr, "packet data mismatch in decode! pos=%ld\n",
- depacket);
- exit(1);
- }
- /* check bos flag */
- if(bosflag == 0 && op_de.b_o_s == 0)
- {
- fprintf(stderr, "b_o_s flag not set on packet!\n");
- exit(1);
- }
- if(bosflag && op_de.b_o_s)
- {
- fprintf(stderr, "b_o_s flag incorrectly set on packet!\n");
- exit(1);
- }
- bosflag = 1;
- depacket += op_de.bytes;
-
- /* check eos flag */
- if(eosflag)
- {
- fprintf(stderr, "Multiple decoded packets with eos flag!\n");
- exit(1);
- }
-
- if(op_de.e_o_s)eosflag = 1;
-
- /* check granulepos flag */
- if(op_de.granulepos != -1)
- {
- fprintf(stderr, " granule:%ld ", (long)op_de.granulepos);
- }
- }
- }
- }
+ /* check granulepos flag */
+ if(op_de.granulepos!=-1){
+ fprintf(stderr," granule:%ld ",(long)op_de.granulepos);
+ }
}
+ }
}
+ }
}
- _ogg_free(data);
- if(headers[pageno] != NULL)
- {
- fprintf(stderr, "did not write last page!\n");
- exit(1);
- }
- if(headers[pageout] != NULL)
- {
- fprintf(stderr, "did not decode last page!\n");
- exit(1);
- }
- if(inptr != outptr)
- {
- fprintf(stderr, "encoded page data incomplete!\n");
- exit(1);
- }
- if(inptr != deptr)
- {
- fprintf(stderr, "decoded page data incomplete!\n");
- exit(1);
- }
- if(inptr != depacket)
- {
- fprintf(stderr, "decoded packet data incomplete!\n");
- exit(1);
- }
- if(!eosflag)
- {
- fprintf(stderr, "Never got a packet with EOS set!\n");
- exit(1);
- }
- fprintf(stderr, "ok.\n");
+ }
+ _ogg_free(data);
+ if(headers[pageno]!=NULL){
+ fprintf(stderr,"did not write last page!\n");
+ exit(1);
+ }
+ if(headers[pageout]!=NULL){
+ fprintf(stderr,"did not decode last page!\n");
+ exit(1);
+ }
+ if(inptr!=outptr){
+ fprintf(stderr,"encoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=deptr){
+ fprintf(stderr,"decoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=depacket){
+ fprintf(stderr,"decoded packet data incomplete!\n");
+ exit(1);
+ }
+ if(!eosflag){
+ fprintf(stderr,"Never got a packet with EOS set!\n");
+ exit(1);
+ }
+ fprintf(stderr,"ok.\n");
}
-int main(void)
-{
-
- ogg_stream_init(&os_en, 0x04030201);
- ogg_stream_init(&os_de, 0x04030201);
- ogg_sync_init(&oy);
-
- /* Exercise each code path in the framing code. Also verify that
- the checksums are working. */
-
- {
- /* 17 only */
- const int packets[] = {17, -1};
- const int *headret[] = {head1_0, NULL};
-
- fprintf(stderr, "testing single page encoding... ");
- test_pack(packets, headret, 0, 0, 0);
- }
-
- {
- /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
- const int packets[] = {17, 254, 255, 256, 500, 510, 600, -1};
- const int *headret[] = {head1_1, head2_1, NULL};
-
- fprintf(stderr, "testing basic page encoding... ");
- test_pack(packets, headret, 0, 0, 0);
- }
-
- {
- /* nil packets; beginning,middle,end */
- const int packets[] = {0, 17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
- const int *headret[] = {head1_2, head2_2, NULL};
+int main(void){
+
+ ogg_stream_init(&os_en,0x04030201);
+ ogg_stream_init(&os_de,0x04030201);
+ ogg_sync_init(&oy);
+
+ /* Exercise each code path in the framing code. Also verify that
+ the checksums are working. */
+
+ {
+ /* 17 only */
+ const int packets[]={17, -1};
+ const int *headret[]={head1_0,NULL};
+
+ fprintf(stderr,"testing single page encoding... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
+ const int packets[]={17, 254, 255, 256, 500, 510, 600, -1};
+ const int *headret[]={head1_1,head2_1,NULL};
+
+ fprintf(stderr,"testing basic page encoding... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* nil packets; beginning,middle,end */
+ const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
+ const int *headret[]={head1_2,head2_2,NULL};
+
+ fprintf(stderr,"testing basic nil packets... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* large initial packet */
+ const int packets[]={4345,259,255,-1};
+ const int *headret[]={head1_3,head2_3,NULL};
+
+ fprintf(stderr,"testing initial-packet lacing > 4k... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* continuing packet test */
+ const int packets[]={0,4345,259,255,-1};
+ const int *headret[]={head1_4,head2_4,head3_4,NULL};
+
+ fprintf(stderr,"testing single packet page span... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ /* page with the 255 segment limit */
+ {
+
+ const int packets[]={0,10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,50,-1};
+ const int *headret[]={head1_5,head2_5,head3_5,NULL};
+
+ fprintf(stderr,"testing max packet segments... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* packet that overspans over an entire page */
+ const int packets[]={0,100,9000,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing very large packets... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* test for the libogg 1.1.1 resync in large continuation bug
+ found by Josh Coalson) */
+ const int packets[]={0,100,9000,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing continuation resync in very large packets... ");
+ test_pack(packets,headret,100,2,3);
+ }
+
+ {
+ /* term only page. why not? */
+ const int packets[]={0,100,4080,-1};
+ const int *headret[]={head1_7,head2_7,head3_7,NULL};
+
+ fprintf(stderr,"testing zero data page (1 nil packet)... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+
+
+ {
+ /* build a bunch of pages for testing */
+ unsigned char *data=_ogg_malloc(1024*1024);
+ int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1};
+ int inptr=0,i,j;
+ ogg_page og[5];
+
+ ogg_stream_reset(&os_en);
- fprintf(stderr, "testing basic nil packets... ");
- test_pack(packets, headret, 0, 0, 0);
+ for(i=0;pl[i]!=-1;i++){
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.granulepos=(i+1)*1000;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+ ogg_stream_packetin(&os_en,&op);
}
- {
- /* large initial packet */
- const int packets[] = {4345, 259, 255, -1};
- const int *headret[] = {head1_3, head2_3, NULL};
+ _ogg_free(data);
- fprintf(stderr, "testing initial-packet lacing > 4k... ");
- test_pack(packets, headret, 0, 0, 0);
+ /* retrieve finished pages */
+ for(i=0;i<5;i++){
+ if(ogg_stream_pageout(&os_en,&og[i])==0){
+ fprintf(stderr,"Too few pages output building sync tests!\n");
+ exit(1);
+ }
+ copy_page(&og[i]);
}
+ /* Test lost pages on pagein/packetout: no rollback */
{
- /* continuing packet test */
- const int packets[] = {0, 4345, 259, 255, -1};
- const int *headret[] = {head1_4, head2_4, head3_4, NULL};
-
- fprintf(stderr, "testing single packet page span... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){
+ memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+ og[i].header_len);
+ ogg_sync_wrote(&oy,og[i].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+ ogg_sync_wrote(&oy,og[i].body_len);
+ }
+
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ /* skip */
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+
+ /* do we get the expected results/packets? */
+
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,0,0,0);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,100,1,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,4079,2,3000);
+ if(ogg_stream_packetout(&os_de,&test)!=-1){
+ fprintf(stderr,"Error: loss of page did not return error\n");
+ exit(1);
+ }
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,76,5,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,34,6,-1);
+ fprintf(stderr,"ok.\n");
}
- /* page with the 255 segment limit */
+ /* Test lost pages on pagein/packetout: rollback with continuation */
{
-
- const int packets[] = {0, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 50, -1
- };
- const int *headret[] = {head1_5, head2_5, head3_5, NULL};
-
- fprintf(stderr, "testing max packet segments... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages (rollback required)... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){
+ memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+ og[i].header_len);
+ ogg_sync_wrote(&oy,og[i].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+ ogg_sync_wrote(&oy,og[i].body_len);
+ }
+
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ /* skip */
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+
+ /* do we get the expected results/packets? */
+
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,0,0,0);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,100,1,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,4079,2,3000);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,2956,3,4000);
+ if(ogg_stream_packetout(&os_de,&test)!=-1){
+ fprintf(stderr,"Error: loss of page did not return error\n");
+ exit(1);
+ }
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,300,13,14000);
+ fprintf(stderr,"ok.\n");
}
-
+
+ /* the rest only test sync */
{
- /* packet that overspans over an entire page */
- const int packets[] = {0, 100, 9000, 259, 255, -1};
- const int *headret[] = {head1_6, head2_6, head3_6, head4_6, NULL};
-
- fprintf(stderr, "testing very large packets... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page og_de;
+ /* Test fractional page inputs: incomplete capture */
+ fprintf(stderr,"Testing sync on partial inputs... ");
+ ogg_sync_reset(&oy);
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ 3);
+ ogg_sync_wrote(&oy,3);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete fixed header */
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete header */
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23,
+ 5);
+ ogg_sync_wrote(&oy,5);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete body */
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28,
+ og[1].header_len-28);
+ ogg_sync_wrote(&oy,og[1].header_len-28);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000);
+ ogg_sync_wrote(&oy,1000);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000,
+ og[1].body_len-1000);
+ ogg_sync_wrote(&oy,og[1].body_len-1000);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
}
+ /* Test fractional page inputs: page + incomplete capture */
{
- /* test for the libogg 1.1.1 resync in large continuation bug
- found by Josh Coalson) */
- const int packets[] = {0, 100, 9000, 259, 255, -1};
- const int *headret[] = {head1_6, head2_6, head3_6, head4_6, NULL};
-
- fprintf(stderr, "testing continuation resync in very large packets... ");
- test_pack(packets, headret, 100, 2, 3);
+ ogg_page og_de;
+ fprintf(stderr,"Testing sync on 1+partial inputs... ");
+ ogg_sync_reset(&oy);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20,
+ og[1].header_len-20);
+ ogg_sync_wrote(&oy,og[1].header_len-20);
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
}
-
+
+ /* Test recapture: garbage + page */
{
- /* term only page. why not? */
- const int packets[] = {0, 100, 4080, -1};
- const int *headret[] = {head1_7, head2_7, head3_7, NULL};
-
- fprintf(stderr, "testing zero data page (1 nil packet)... ");
- test_pack(packets, headret, 0, 0, 0);
+ ogg_page og_de;
+ fprintf(stderr,"Testing search for capture... ");
+ ogg_sync_reset(&oy);
+
+ /* 'garbage' */
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20,
+ og[2].header_len-20);
+ ogg_sync_wrote(&oy,og[2].header_len-20);
+ memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
+ og[2].body_len);
+ ogg_sync_wrote(&oy,og[2].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
}
-
-
+ /* Test recapture: page + garbage + page */
{
- /* build a bunch of pages for testing */
- unsigned char *data = _ogg_malloc(1024 * 1024);
- int pl[] = {0, 100, 4079, 2956, 2057, 76, 34, 912, 0, 234, 1000, 1000, 1000, 300, -1};
- int inptr = 0, i, j;
- ogg_page og[5];
-
- ogg_stream_reset(&os_en);
-
- for(i = 0; pl[i] != -1; i++)
- {
- ogg_packet op;
- int len = pl[i];
-
- op.packet = data + inptr;
- op.bytes = len;
- op.e_o_s = (pl[i+1] < 0 ? 1 : 0);
- op.granulepos = (i + 1) * 1000;
-
- for(j = 0; j < len; j++)data[inptr++] = i + j;
- ogg_stream_packetin(&os_en, &op);
- }
-
- _ogg_free(data);
-
- /* retrieve finished pages */
- for(i = 0; i < 5; i++)
- {
- if(ogg_stream_pageout(&os_en, &og[i]) == 0)
- {
- fprintf(stderr, "Too few pages output building sync tests!\n");
- exit(1);
- }
- copy_page(&og[i]);
- }
-
- /* Test lost pages on pagein/packetout: no rollback */
- {
- ogg_page temp;
- ogg_packet test;
-
- fprintf(stderr, "Testing loss of pages... ");
-
- ogg_sync_reset(&oy);
- ogg_stream_reset(&os_de);
- for(i = 0; i < 5; i++)
- {
- memcpy(ogg_sync_buffer(&oy, og[i].header_len), og[i].header,
- og[i].header_len);
- ogg_sync_wrote(&oy, og[i].header_len);
- memcpy(ogg_sync_buffer(&oy, og[i].body_len), og[i].body, og[i].body_len);
- ogg_sync_wrote(&oy, og[i].body_len);
- }
-
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- /* skip */
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
-
- /* do we get the expected results/packets? */
-
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 0, 0, 0);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 100, 1, -1);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 4079, 2, 3000);
- if(ogg_stream_packetout(&os_de, &test) != -1)
- {
- fprintf(stderr, "Error: loss of page did not return error\n");
- exit(1);
- }
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 76, 5, -1);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 34, 6, -1);
- fprintf(stderr, "ok.\n");
- }
-
- /* Test lost pages on pagein/packetout: rollback with continuation */
- {
- ogg_page temp;
- ogg_packet test;
-
- fprintf(stderr, "Testing loss of pages (rollback required)... ");
-
- ogg_sync_reset(&oy);
- ogg_stream_reset(&os_de);
- for(i = 0; i < 5; i++)
- {
- memcpy(ogg_sync_buffer(&oy, og[i].header_len), og[i].header,
- og[i].header_len);
- ogg_sync_wrote(&oy, og[i].header_len);
- memcpy(ogg_sync_buffer(&oy, og[i].body_len), og[i].body, og[i].body_len);
- ogg_sync_wrote(&oy, og[i].body_len);
- }
-
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
- ogg_sync_pageout(&oy, &temp);
- /* skip */
- ogg_sync_pageout(&oy, &temp);
- ogg_stream_pagein(&os_de, &temp);
-
- /* do we get the expected results/packets? */
-
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 0, 0, 0);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 100, 1, -1);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 4079, 2, 3000);
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 2956, 3, 4000);
- if(ogg_stream_packetout(&os_de, &test) != -1)
- {
- fprintf(stderr, "Error: loss of page did not return error\n");
- exit(1);
- }
- if(ogg_stream_packetout(&os_de, &test) != 1)error();
- checkpacket(&test, 300, 13, 14000);
- fprintf(stderr, "ok.\n");
- }
+ ogg_page og_de;
+ fprintf(stderr,"Testing recapture... ");
+ ogg_sync_reset(&oy);
- /* the rest only test sync */
- {
- ogg_page og_de;
- /* Test fractional page inputs: incomplete capture */
- fprintf(stderr, "Testing sync on partial inputs... ");
- ogg_sync_reset(&oy);
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- 3);
- ogg_sync_wrote(&oy, 3);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- /* Test fractional page inputs: incomplete fixed header */
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 3,
- 20);
- ogg_sync_wrote(&oy, 20);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- /* Test fractional page inputs: incomplete header */
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 23,
- 5);
- ogg_sync_wrote(&oy, 5);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- /* Test fractional page inputs: incomplete body */
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 28,
- og[1].header_len - 28);
- ogg_sync_wrote(&oy, og[1].header_len - 28);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body, 1000);
- ogg_sync_wrote(&oy, 1000);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body + 1000,
- og[1].body_len - 1000);
- ogg_sync_wrote(&oy, og[1].body_len - 1000);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
- /* Test fractional page inputs: page + incomplete capture */
- {
- ogg_page og_de;
- fprintf(stderr, "Testing sync on 1+partial inputs... ");
- ogg_sync_reset(&oy);
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- og[1].header_len);
- ogg_sync_wrote(&oy, og[1].header_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- 20);
- ogg_sync_wrote(&oy, 20);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header + 20,
- og[1].header_len - 20);
- ogg_sync_wrote(&oy, og[1].header_len - 20);
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
- /* Test recapture: garbage + page */
- {
- ogg_page og_de;
- fprintf(stderr, "Testing search for capture... ");
- ogg_sync_reset(&oy);
-
- /* 'garbage' */
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- og[1].header_len);
- ogg_sync_wrote(&oy, og[1].header_len);
-
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
-
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header,
- 20);
- ogg_sync_wrote(&oy, 20);
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
-
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header + 20,
- og[2].header_len - 20);
- ogg_sync_wrote(&oy, og[2].header_len - 20);
- memcpy(ogg_sync_buffer(&oy, og[2].body_len), og[2].body,
- og[2].body_len);
- ogg_sync_wrote(&oy, og[2].body_len);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
-
- /* Test recapture: page + garbage + page */
- {
- ogg_page og_de;
- fprintf(stderr, "Testing recapture... ");
- ogg_sync_reset(&oy);
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ og[2].header_len);
+ ogg_sync_wrote(&oy,og[2].header_len);
- memcpy(ogg_sync_buffer(&oy, og[1].header_len), og[1].header,
- og[1].header_len);
- ogg_sync_wrote(&oy, og[1].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ og[2].header_len);
+ ogg_sync_wrote(&oy,og[2].header_len);
- memcpy(ogg_sync_buffer(&oy, og[1].body_len), og[1].body,
- og[1].body_len);
- ogg_sync_wrote(&oy, og[1].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header,
- og[2].header_len);
- ogg_sync_wrote(&oy, og[2].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
+ og[2].body_len-5);
+ ogg_sync_wrote(&oy,og[2].body_len-5);
- memcpy(ogg_sync_buffer(&oy, og[2].header_len), og[2].header,
- og[2].header_len);
- ogg_sync_wrote(&oy, og[2].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header,
+ og[3].header_len);
+ ogg_sync_wrote(&oy,og[3].header_len);
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
+ memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body,
+ og[3].body_len);
+ ogg_sync_wrote(&oy,og[3].body_len);
- memcpy(ogg_sync_buffer(&oy, og[2].body_len), og[2].body,
- og[2].body_len - 5);
- ogg_sync_wrote(&oy, og[2].body_len - 5);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
- memcpy(ogg_sync_buffer(&oy, og[3].header_len), og[3].header,
- og[3].header_len);
- ogg_sync_wrote(&oy, og[3].header_len);
-
- memcpy(ogg_sync_buffer(&oy, og[3].body_len), og[3].body,
- og[3].body_len);
- ogg_sync_wrote(&oy, og[3].body_len);
-
- if(ogg_sync_pageout(&oy, &og_de) > 0)error();
- if(ogg_sync_pageout(&oy, &og_de) <= 0)error();
-
- fprintf(stderr, "ok.\n");
- }
+ fprintf(stderr,"ok.\n");
+ }
- /* Free page data that was previously copied */
- {
- for(i = 0; i < 5; i++)
- {
- free_page(&og[i]);
- }
- }
+ /* Free page data that was previously copied */
+ {
+ for(i=0;i<5;i++){
+ free_page(&og[i]);
+ }
}
+ }
- return(0);
+ return(0);
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/highlevel.h b/src/filters/transform/MpaDecFilter/libvorbisidec/highlevel.h
index bbd0b4fc5..2a856df25 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/highlevel.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/highlevel.h
@@ -15,44 +15,42 @@
********************************************************************/
-typedef struct highlevel_byblocktype
-{
- double tone_mask_setting;
- double tone_peaklimit_setting;
- double noise_bias_setting;
- double noise_compand_setting;
+typedef struct highlevel_byblocktype {
+ double tone_mask_setting;
+ double tone_peaklimit_setting;
+ double noise_bias_setting;
+ double noise_compand_setting;
} highlevel_byblocktype;
-typedef struct highlevel_encode_setup
-{
- const void *setup;
- int set_in_stone;
+typedef struct highlevel_encode_setup {
+ const void *setup;
+ int set_in_stone;
- double base_setting;
- double long_setting;
- double short_setting;
- double impulse_noisetune;
+ double base_setting;
+ double long_setting;
+ double short_setting;
+ double impulse_noisetune;
- int managed;
- long bitrate_min;
- long bitrate_av;
- double bitrate_av_damp;
- long bitrate_max;
- long bitrate_reservoir;
- double bitrate_reservoir_bias;
+ int managed;
+ long bitrate_min;
+ long bitrate_av;
+ double bitrate_av_damp;
+ long bitrate_max;
+ long bitrate_reservoir;
+ double bitrate_reservoir_bias;
- int impulse_block_p;
- int noise_normalize_p;
+ int impulse_block_p;
+ int noise_normalize_p;
- double stereo_point_setting;
- double lowpass_kHz;
+ double stereo_point_setting;
+ double lowpass_kHz;
- double ath_floating_dB;
- double ath_absolute_dB;
+ double ath_floating_dB;
+ double ath_absolute_dB;
- double amplitude_track_dBpersec;
- double trigger_setting;
+ double amplitude_track_dBpersec;
+ double trigger_setting;
- highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
+ highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
} highlevel_encode_setup;
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/info.c b/src/filters/transform/MpaDecFilter/libvorbisidec/info.c
index db86033f8..30088d8f0 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/info.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/info.c
@@ -35,377 +35,340 @@
#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20090709"
/* helpers */
-static int ilog2(unsigned int v)
-{
- int ret = 0;
- if(v)--v;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog2(unsigned int v){
+ int ret=0;
+ if(v)--v;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-static void _v_writestring(oggpack_buffer *o, const char *s, int bytes)
-{
+static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){
- while(bytes--)
- {
- oggpack_write(o, *s++, 8);
- }
+ while(bytes--){
+ oggpack_write(o,*s++,8);
+ }
}
-static void _v_readstring(oggpack_buffer *o, char *buf, int bytes)
-{
- while(bytes--)
- {
- *buf++ = oggpack_read(o, 8);
- }
+static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
+ while(bytes--){
+ *buf++=oggpack_read(o,8);
+ }
}
-void vorbis_comment_init(vorbis_comment *vc)
-{
- memset(vc, 0, sizeof(*vc));
+void vorbis_comment_init(vorbis_comment *vc){
+ memset(vc,0,sizeof(*vc));
}
-void vorbis_comment_add(vorbis_comment *vc, const char *comment)
-{
- vc->user_comments = _ogg_realloc(vc->user_comments,
- (vc->comments + 2) * sizeof(*vc->user_comments));
- vc->comment_lengths = _ogg_realloc(vc->comment_lengths,
- (vc->comments + 2) * sizeof(*vc->comment_lengths));
- vc->comment_lengths[vc->comments] = strlen(comment);
- vc->user_comments[vc->comments] = _ogg_malloc(vc->comment_lengths[vc->comments] + 1);
- strcpy(vc->user_comments[vc->comments], comment);
- vc->comments++;
- vc->user_comments[vc->comments] = NULL;
+void vorbis_comment_add(vorbis_comment *vc,const char *comment){
+ vc->user_comments=_ogg_realloc(vc->user_comments,
+ (vc->comments+2)*sizeof(*vc->user_comments));
+ vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
+ (vc->comments+2)*sizeof(*vc->comment_lengths));
+ vc->comment_lengths[vc->comments]=strlen(comment);
+ vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1);
+ strcpy(vc->user_comments[vc->comments], comment);
+ vc->comments++;
+ vc->user_comments[vc->comments]=NULL;
}
-void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents)
-{
- char *comment = alloca(strlen(tag) + strlen(contents) + 2); /* +2 for = and \0 */
- strcpy(comment, tag);
- strcat(comment, "=");
- strcat(comment, contents);
- vorbis_comment_add(vc, comment);
+void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){
+ char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
+ strcpy(comment, tag);
+ strcat(comment, "=");
+ strcat(comment, contents);
+ vorbis_comment_add(vc, comment);
}
/* This is more or less the same as strncasecmp - but that doesn't exist
* everywhere, and this is a fairly trivial function, so we include it */
-static int tagcompare(const char *s1, const char *s2, int n)
-{
- int c = 0;
- while(c < n)
- {
- if(toupper(s1[c]) != toupper(s2[c]))
- return !0;
- c++;
- }
- return 0;
+static int tagcompare(const char *s1, const char *s2, int n){
+ int c=0;
+ while(c < n){
+ if(toupper(s1[c]) != toupper(s2[c]))
+ return !0;
+ c++;
+ }
+ return 0;
}
-char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count)
-{
- long i;
- int found = 0;
- int taglen = strlen(tag) + 1; /* +1 for the = we append */
- char *fulltag = alloca(taglen + 1);
-
- strcpy(fulltag, tag);
- strcat(fulltag, "=");
-
- for(i = 0; i < vc->comments; i++)
- {
- if(!tagcompare(vc->user_comments[i], fulltag, taglen))
- {
- if(count == found)
- /* We return a pointer to the data, not a copy */
- return vc->user_comments[i] + taglen;
- else
- found++;
- }
+char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
+ long i;
+ int found = 0;
+ int taglen = strlen(tag)+1; /* +1 for the = we append */
+ char *fulltag = alloca(taglen+ 1);
+
+ strcpy(fulltag, tag);
+ strcat(fulltag, "=");
+
+ for(i=0;i<vc->comments;i++){
+ if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
+ if(count == found)
+ /* We return a pointer to the data, not a copy */
+ return vc->user_comments[i] + taglen;
+ else
+ found++;
}
- return NULL; /* didn't find anything */
+ }
+ return NULL; /* didn't find anything */
}
-int vorbis_comment_query_count(vorbis_comment *vc, const char *tag)
-{
- int i, count = 0;
- int taglen = strlen(tag) + 1; /* +1 for the = we append */
- char *fulltag = alloca(taglen + 1);
- strcpy(fulltag, tag);
- strcat(fulltag, "=");
+int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
+ int i,count=0;
+ int taglen = strlen(tag)+1; /* +1 for the = we append */
+ char *fulltag = alloca(taglen+1);
+ strcpy(fulltag,tag);
+ strcat(fulltag, "=");
- for(i = 0; i < vc->comments; i++)
- {
- if(!tagcompare(vc->user_comments[i], fulltag, taglen))
- count++;
- }
+ for(i=0;i<vc->comments;i++){
+ if(!tagcompare(vc->user_comments[i], fulltag, taglen))
+ count++;
+ }
- return count;
+ return count;
}
-void vorbis_comment_clear(vorbis_comment *vc)
-{
- if(vc)
- {
- long i;
- if(vc->user_comments)
- {
- for(i = 0; i < vc->comments; i++)
- if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
- _ogg_free(vc->user_comments);
- }
- if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
- if(vc->vendor)_ogg_free(vc->vendor);
- memset(vc, 0, sizeof(*vc));
+void vorbis_comment_clear(vorbis_comment *vc){
+ if(vc){
+ long i;
+ if(vc->user_comments){
+ for(i=0;i<vc->comments;i++)
+ if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
+ _ogg_free(vc->user_comments);
}
+ if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
+ if(vc->vendor)_ogg_free(vc->vendor);
+ memset(vc,0,sizeof(*vc));
+ }
}
/* blocksize 0 is guaranteed to be short, 1 is guaranteed to be long.
They may be equal, but short will never ge greater than long */
-int vorbis_info_blocksize(vorbis_info *vi, int zo)
-{
- codec_setup_info *ci = vi->codec_setup;
- return ci ? ci->blocksizes[zo] : -1;
+int vorbis_info_blocksize(vorbis_info *vi,int zo){
+ codec_setup_info *ci = vi->codec_setup;
+ return ci ? ci->blocksizes[zo] : -1;
}
/* used by synthesis, which has a full, alloced vi */
-void vorbis_info_init(vorbis_info *vi)
-{
- memset(vi, 0, sizeof(*vi));
- vi->codec_setup = _ogg_calloc(1, sizeof(codec_setup_info));
+void vorbis_info_init(vorbis_info *vi){
+ memset(vi,0,sizeof(*vi));
+ vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info));
}
-void vorbis_info_clear(vorbis_info *vi)
-{
- codec_setup_info *ci = vi->codec_setup;
- int i;
+void vorbis_info_clear(vorbis_info *vi){
+ codec_setup_info *ci=vi->codec_setup;
+ int i;
- if(ci)
- {
+ if(ci){
- for(i = 0; i < ci->modes; i++)
- if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
+ for(i=0;i<ci->modes;i++)
+ if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
- for(i = 0; i < ci->maps; i++) /* unpack does the range checking */
- if(ci->map_param[i]) /* this may be cleaning up an aborted
+ for(i=0;i<ci->maps;i++) /* unpack does the range checking */
+ if(ci->map_param[i]) /* this may be cleaning up an aborted
unpack, in which case the below type
cannot be trusted */
- _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
+ _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
- for(i = 0; i < ci->floors; i++) /* unpack does the range checking */
- if(ci->floor_param[i]) /* this may be cleaning up an aborted
+ for(i=0;i<ci->floors;i++) /* unpack does the range checking */
+ if(ci->floor_param[i]) /* this may be cleaning up an aborted
unpack, in which case the below type
cannot be trusted */
- _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
+ _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
- for(i = 0; i < ci->residues; i++) /* unpack does the range checking */
- if(ci->residue_param[i]) /* this may be cleaning up an aborted
+ for(i=0;i<ci->residues;i++) /* unpack does the range checking */
+ if(ci->residue_param[i]) /* this may be cleaning up an aborted
unpack, in which case the below type
cannot be trusted */
- _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
-
- for(i = 0; i < ci->books; i++)
- {
- if(ci->book_param[i])
- {
- /* knows if the book was not alloced */
- vorbis_staticbook_destroy(ci->book_param[i]);
- }
- if(ci->fullbooks)
- vorbis_book_clear(ci->fullbooks + i);
- }
- if(ci->fullbooks)
- _ogg_free(ci->fullbooks);
+ _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
+
+ for(i=0;i<ci->books;i++){
+ if(ci->book_param[i]){
+ /* knows if the book was not alloced */
+ vorbis_staticbook_destroy(ci->book_param[i]);
+ }
+ if(ci->fullbooks)
+ vorbis_book_clear(ci->fullbooks+i);
+ }
+ if(ci->fullbooks)
+ _ogg_free(ci->fullbooks);
- for(i = 0; i < ci->psys; i++)
- _vi_psy_free(ci->psy_param[i]);
+ for(i=0;i<ci->psys;i++)
+ _vi_psy_free(ci->psy_param[i]);
- _ogg_free(ci);
- }
+ _ogg_free(ci);
+ }
- memset(vi, 0, sizeof(*vi));
+ memset(vi,0,sizeof(*vi));
}
/* Header packing/unpacking ********************************************/
-static int _vorbis_unpack_info(vorbis_info *vi, oggpack_buffer *opb)
-{
- codec_setup_info *ci = vi->codec_setup;
- if(!ci)return(OV_EFAULT);
+static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
+ codec_setup_info *ci=vi->codec_setup;
+ if(!ci)return(OV_EFAULT);
- vi->version = oggpack_read(opb, 32);
- if(vi->version != 0)return(OV_EVERSION);
+ vi->version=oggpack_read(opb,32);
+ if(vi->version!=0)return(OV_EVERSION);
- vi->channels = oggpack_read(opb, 8);
- vi->rate = oggpack_read(opb, 32);
+ vi->channels=oggpack_read(opb,8);
+ vi->rate=oggpack_read(opb,32);
- vi->bitrate_upper = oggpack_read(opb, 32);
- vi->bitrate_nominal = oggpack_read(opb, 32);
- vi->bitrate_lower = oggpack_read(opb, 32);
+ vi->bitrate_upper=oggpack_read(opb,32);
+ vi->bitrate_nominal=oggpack_read(opb,32);
+ vi->bitrate_lower=oggpack_read(opb,32);
- ci->blocksizes[0] = 1 << oggpack_read(opb, 4);
- ci->blocksizes[1] = 1 << oggpack_read(opb, 4);
+ ci->blocksizes[0]=1<<oggpack_read(opb,4);
+ ci->blocksizes[1]=1<<oggpack_read(opb,4);
- if(vi->rate < 1)goto err_out;
- if(vi->channels < 1)goto err_out;
- if(ci->blocksizes[0] < 64)goto err_out;
- if(ci->blocksizes[1] < ci->blocksizes[0])goto err_out;
- if(ci->blocksizes[1] > 8192)goto err_out;
+ if(vi->rate<1)goto err_out;
+ if(vi->channels<1)goto err_out;
+ if(ci->blocksizes[0]<64)goto err_out;
+ if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
+ if(ci->blocksizes[1]>8192)goto err_out;
- if(oggpack_read(opb, 1) != 1)goto err_out; /* EOP check */
+ if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
- return(0);
-err_out:
- vorbis_info_clear(vi);
- return(OV_EBADHEADER);
+ return(0);
+ err_out:
+ vorbis_info_clear(vi);
+ return(OV_EBADHEADER);
}
-static int _vorbis_unpack_comment(vorbis_comment *vc, oggpack_buffer *opb)
-{
- int i;
- int vendorlen = oggpack_read(opb, 32);
- if(vendorlen < 0)goto err_out;
- if(vendorlen > opb->storage - 8)goto err_out;
- vc->vendor = _ogg_calloc(vendorlen + 1, 1);
- _v_readstring(opb, vc->vendor, vendorlen);
- i = oggpack_read(opb, 32);
- if(i < 0)goto err_out;
- if(i > ((opb->storage - oggpack_bytes(opb)) >> 2))goto err_out;
- vc->comments = i;
- vc->user_comments = _ogg_calloc(vc->comments + 1, sizeof(*vc->user_comments));
- vc->comment_lengths = _ogg_calloc(vc->comments + 1, sizeof(*vc->comment_lengths));
-
- for(i = 0; i < vc->comments; i++)
- {
- int len = oggpack_read(opb, 32);
- if(len < 0)goto err_out;
- if(len > opb->storage - oggpack_bytes(opb))goto err_out;
- vc->comment_lengths[i] = len;
- vc->user_comments[i] = _ogg_calloc(len + 1, 1);
- _v_readstring(opb, vc->user_comments[i], len);
- }
- if(oggpack_read(opb, 1) != 1)goto err_out; /* EOP check */
-
- return(0);
-err_out:
- vorbis_comment_clear(vc);
- return(OV_EBADHEADER);
+static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
+ int i;
+ int vendorlen=oggpack_read(opb,32);
+ if(vendorlen<0)goto err_out;
+ if(vendorlen>opb->storage-8)goto err_out;
+ vc->vendor=_ogg_calloc(vendorlen+1,1);
+ _v_readstring(opb,vc->vendor,vendorlen);
+ i=oggpack_read(opb,32);
+ if(i<0)goto err_out;
+ if(i>((opb->storage-oggpack_bytes(opb))>>2))goto err_out;
+ vc->comments=i;
+ vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
+ vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
+
+ for(i=0;i<vc->comments;i++){
+ int len=oggpack_read(opb,32);
+ if(len<0)goto err_out;
+ if(len>opb->storage-oggpack_bytes(opb))goto err_out;
+ vc->comment_lengths[i]=len;
+ vc->user_comments[i]=_ogg_calloc(len+1,1);
+ _v_readstring(opb,vc->user_comments[i],len);
+ }
+ if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
+
+ return(0);
+ err_out:
+ vorbis_comment_clear(vc);
+ return(OV_EBADHEADER);
}
/* all of the real encoding details are here. The modes, books,
everything */
-static int _vorbis_unpack_books(vorbis_info *vi, oggpack_buffer *opb)
-{
- codec_setup_info *ci = vi->codec_setup;
- int i;
- if(!ci)return(OV_EFAULT);
-
- /* codebooks */
- ci->books = oggpack_read(opb, 8) + 1;
- if(ci->books <= 0)goto err_out;
- for(i = 0; i < ci->books; i++)
- {
- ci->book_param[i] = _ogg_calloc(1, sizeof(*ci->book_param[i]));
- if(vorbis_staticbook_unpack(opb, ci->book_param[i]))goto err_out;
- }
-
- /* time backend settings; hooks are unused */
- {
- int times = oggpack_read(opb, 6) + 1;
- if(times <= 0)goto err_out;
- for(i = 0; i < times; i++)
- {
- int test = oggpack_read(opb, 16);
- if(test < 0 || test >= VI_TIMEB)goto err_out;
- }
- }
-
- /* floor backend settings */
- ci->floors = oggpack_read(opb, 6) + 1;
- if(ci->floors <= 0)goto err_out;
- for(i = 0; i < ci->floors; i++)
- {
- ci->floor_type[i] = oggpack_read(opb, 16);
- if(ci->floor_type[i] < 0 || ci->floor_type[i] >= VI_FLOORB)goto err_out;
- ci->floor_param[i] = _floor_P[ci->floor_type[i]]->unpack(vi, opb);
- if(!ci->floor_param[i])goto err_out;
- }
-
- /* residue backend settings */
- ci->residues = oggpack_read(opb, 6) + 1;
- if(ci->residues <= 0)goto err_out;
- for(i = 0; i < ci->residues; i++)
- {
- ci->residue_type[i] = oggpack_read(opb, 16);
- if(ci->residue_type[i] < 0 || ci->residue_type[i] >= VI_RESB)goto err_out;
- ci->residue_param[i] = _residue_P[ci->residue_type[i]]->unpack(vi, opb);
- if(!ci->residue_param[i])goto err_out;
- }
-
- /* map backend settings */
- ci->maps = oggpack_read(opb, 6) + 1;
- if(ci->maps <= 0)goto err_out;
- for(i = 0; i < ci->maps; i++)
- {
- ci->map_type[i] = oggpack_read(opb, 16);
- if(ci->map_type[i] < 0 || ci->map_type[i] >= VI_MAPB)goto err_out;
- ci->map_param[i] = _mapping_P[ci->map_type[i]]->unpack(vi, opb);
- if(!ci->map_param[i])goto err_out;
- }
-
- /* mode settings */
- ci->modes = oggpack_read(opb, 6) + 1;
- if(ci->modes <= 0)goto err_out;
- for(i = 0; i < ci->modes; i++)
- {
- ci->mode_param[i] = _ogg_calloc(1, sizeof(*ci->mode_param[i]));
- ci->mode_param[i]->blockflag = oggpack_read(opb, 1);
- ci->mode_param[i]->windowtype = oggpack_read(opb, 16);
- ci->mode_param[i]->transformtype = oggpack_read(opb, 16);
- ci->mode_param[i]->mapping = oggpack_read(opb, 8);
-
- if(ci->mode_param[i]->windowtype >= VI_WINDOWB)goto err_out;
- if(ci->mode_param[i]->transformtype >= VI_WINDOWB)goto err_out;
- if(ci->mode_param[i]->mapping >= ci->maps)goto err_out;
- if(ci->mode_param[i]->mapping < 0)goto err_out;
+static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
+ codec_setup_info *ci=vi->codec_setup;
+ int i;
+ if(!ci)return(OV_EFAULT);
+
+ /* codebooks */
+ ci->books=oggpack_read(opb,8)+1;
+ if(ci->books<=0)goto err_out;
+ for(i=0;i<ci->books;i++){
+ ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i]));
+ if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
+ }
+
+ /* time backend settings; hooks are unused */
+ {
+ int times=oggpack_read(opb,6)+1;
+ if(times<=0)goto err_out;
+ for(i=0;i<times;i++){
+ int test=oggpack_read(opb,16);
+ if(test<0 || test>=VI_TIMEB)goto err_out;
}
-
- if(oggpack_read(opb, 1) != 1)goto err_out; /* top level EOP check */
-
- return(0);
-err_out:
- vorbis_info_clear(vi);
- return(OV_EBADHEADER);
+ }
+
+ /* floor backend settings */
+ ci->floors=oggpack_read(opb,6)+1;
+ if(ci->floors<=0)goto err_out;
+ for(i=0;i<ci->floors;i++){
+ ci->floor_type[i]=oggpack_read(opb,16);
+ if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
+ ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
+ if(!ci->floor_param[i])goto err_out;
+ }
+
+ /* residue backend settings */
+ ci->residues=oggpack_read(opb,6)+1;
+ if(ci->residues<=0)goto err_out;
+ for(i=0;i<ci->residues;i++){
+ ci->residue_type[i]=oggpack_read(opb,16);
+ if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
+ ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
+ if(!ci->residue_param[i])goto err_out;
+ }
+
+ /* map backend settings */
+ ci->maps=oggpack_read(opb,6)+1;
+ if(ci->maps<=0)goto err_out;
+ for(i=0;i<ci->maps;i++){
+ ci->map_type[i]=oggpack_read(opb,16);
+ if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
+ ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
+ if(!ci->map_param[i])goto err_out;
+ }
+
+ /* mode settings */
+ ci->modes=oggpack_read(opb,6)+1;
+ if(ci->modes<=0)goto err_out;
+ for(i=0;i<ci->modes;i++){
+ ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
+ ci->mode_param[i]->blockflag=oggpack_read(opb,1);
+ ci->mode_param[i]->windowtype=oggpack_read(opb,16);
+ ci->mode_param[i]->transformtype=oggpack_read(opb,16);
+ ci->mode_param[i]->mapping=oggpack_read(opb,8);
+
+ if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
+ if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
+ if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
+ if(ci->mode_param[i]->mapping<0)goto err_out;
+ }
+
+ if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
+
+ return(0);
+ err_out:
+ vorbis_info_clear(vi);
+ return(OV_EBADHEADER);
}
/* Is this packet a vorbis ID header? */
-int vorbis_synthesis_idheader(ogg_packet *op)
-{
- oggpack_buffer opb;
- char buffer[6];
+int vorbis_synthesis_idheader(ogg_packet *op){
+ oggpack_buffer opb;
+ char buffer[6];
- if(op)
- {
- oggpack_readinit(&opb, op->packet, op->bytes);
+ if(op){
+ oggpack_readinit(&opb,op->packet,op->bytes);
- if(!op->b_o_s)
- return(0); /* Not the initial packet */
+ if(!op->b_o_s)
+ return(0); /* Not the initial packet */
- if(oggpack_read(&opb, 8) != 1)
- return 0; /* not an ID header */
+ if(oggpack_read(&opb,8) != 1)
+ return 0; /* not an ID header */
- memset(buffer, 0, 6);
- _v_readstring(&opb, buffer, 6);
- if(memcmp(buffer, "vorbis", 6))
- return 0; /* not vorbis */
+ memset(buffer,0,6);
+ _v_readstring(&opb,buffer,6);
+ if(memcmp(buffer,"vorbis",6))
+ return 0; /* not vorbis */
- return 1;
- }
+ return 1;
+ }
- return 0;
+ return 0;
}
/* The Vorbis header is in three packets; the initial small packet in
@@ -413,306 +376,280 @@ int vorbis_synthesis_idheader(ogg_packet *op)
with bitstream comments and a third packet that holds the
codebook. */
-int vorbis_synthesis_headerin(vorbis_info *vi, vorbis_comment *vc, ogg_packet *op)
-{
- oggpack_buffer opb;
+int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
+ oggpack_buffer opb;
- if(op)
+ if(op){
+ oggpack_readinit(&opb,op->packet,op->bytes);
+
+ /* Which of the three types of header is this? */
+ /* Also verify header-ness, vorbis */
{
- oggpack_readinit(&opb, op->packet, op->bytes);
-
- /* Which of the three types of header is this? */
- /* Also verify header-ness, vorbis */
- {
- char buffer[6];
- int packtype = oggpack_read(&opb, 8);
- memset(buffer, 0, 6);
- _v_readstring(&opb, buffer, 6);
- if(memcmp(buffer, "vorbis", 6))
- {
- /* not a vorbis header */
- return(OV_ENOTVORBIS);
- }
- switch(packtype)
- {
- case 0x01: /* least significant *bit* is read first */
- if(!op->b_o_s)
- {
- /* Not the initial packet */
- return(OV_EBADHEADER);
- }
- if(vi->rate != 0)
- {
- /* previously initialized info header */
- return(OV_EBADHEADER);
- }
-
- return(_vorbis_unpack_info(vi, &opb));
-
- case 0x03: /* least significant *bit* is read first */
- if(vi->rate == 0)
- {
- /* um... we didn't get the initial header */
- return(OV_EBADHEADER);
- }
-
- return(_vorbis_unpack_comment(vc, &opb));
-
- case 0x05: /* least significant *bit* is read first */
- if(vi->rate == 0 || vc->vendor == NULL)
- {
- /* um... we didn;t get the initial header or comments yet */
- return(OV_EBADHEADER);
- }
-
- return(_vorbis_unpack_books(vi, &opb));
-
- default:
- /* Not a valid vorbis header type */
- return(OV_EBADHEADER);
- break;
- }
+ char buffer[6];
+ int packtype=oggpack_read(&opb,8);
+ memset(buffer,0,6);
+ _v_readstring(&opb,buffer,6);
+ if(memcmp(buffer,"vorbis",6)){
+ /* not a vorbis header */
+ return(OV_ENOTVORBIS);
+ }
+ switch(packtype){
+ case 0x01: /* least significant *bit* is read first */
+ if(!op->b_o_s){
+ /* Not the initial packet */
+ return(OV_EBADHEADER);
+ }
+ if(vi->rate!=0){
+ /* previously initialized info header */
+ return(OV_EBADHEADER);
}
- }
- return(OV_EBADHEADER);
-}
-
-/* pack side **********************************************************/
-static int _vorbis_pack_info(oggpack_buffer *opb, vorbis_info *vi)
-{
- codec_setup_info *ci = vi->codec_setup;
- if(!ci)return(OV_EFAULT);
+ return(_vorbis_unpack_info(vi,&opb));
- /* preamble */
- oggpack_write(opb, 0x01, 8);
- _v_writestring(opb, "vorbis", 6);
+ case 0x03: /* least significant *bit* is read first */
+ if(vi->rate==0){
+ /* um... we didn't get the initial header */
+ return(OV_EBADHEADER);
+ }
- /* basic information about the stream */
- oggpack_write(opb, 0x00, 32);
- oggpack_write(opb, vi->channels, 8);
- oggpack_write(opb, vi->rate, 32);
+ return(_vorbis_unpack_comment(vc,&opb));
- oggpack_write(opb, vi->bitrate_upper, 32);
- oggpack_write(opb, vi->bitrate_nominal, 32);
- oggpack_write(opb, vi->bitrate_lower, 32);
+ case 0x05: /* least significant *bit* is read first */
+ if(vi->rate==0 || vc->vendor==NULL){
+ /* um... we didn;t get the initial header or comments yet */
+ return(OV_EBADHEADER);
+ }
- oggpack_write(opb, ilog2(ci->blocksizes[0]), 4);
- oggpack_write(opb, ilog2(ci->blocksizes[1]), 4);
- oggpack_write(opb, 1, 1);
+ return(_vorbis_unpack_books(vi,&opb));
- return(0);
+ default:
+ /* Not a valid vorbis header type */
+ return(OV_EBADHEADER);
+ break;
+ }
+ }
+ }
+ return(OV_EBADHEADER);
}
-static int _vorbis_pack_comment(oggpack_buffer *opb, vorbis_comment *vc)
-{
- int bytes = strlen(ENCODE_VENDOR_STRING);
+/* pack side **********************************************************/
- /* preamble */
- oggpack_write(opb, 0x03, 8);
- _v_writestring(opb, "vorbis", 6);
+static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
+ codec_setup_info *ci=vi->codec_setup;
+ if(!ci)return(OV_EFAULT);
- /* vendor */
- oggpack_write(opb, bytes, 32);
- _v_writestring(opb, ENCODE_VENDOR_STRING, bytes);
+ /* preamble */
+ oggpack_write(opb,0x01,8);
+ _v_writestring(opb,"vorbis", 6);
- /* comments */
+ /* basic information about the stream */
+ oggpack_write(opb,0x00,32);
+ oggpack_write(opb,vi->channels,8);
+ oggpack_write(opb,vi->rate,32);
- oggpack_write(opb, vc->comments, 32);
- if(vc->comments)
- {
- int i;
- for(i = 0; i < vc->comments; i++)
- {
- if(vc->user_comments[i])
- {
- oggpack_write(opb, vc->comment_lengths[i], 32);
- _v_writestring(opb, vc->user_comments[i], vc->comment_lengths[i]);
- }
- else
- {
- oggpack_write(opb, 0, 32);
- }
- }
- }
- oggpack_write(opb, 1, 1);
+ oggpack_write(opb,vi->bitrate_upper,32);
+ oggpack_write(opb,vi->bitrate_nominal,32);
+ oggpack_write(opb,vi->bitrate_lower,32);
- return(0);
-}
+ oggpack_write(opb,ilog2(ci->blocksizes[0]),4);
+ oggpack_write(opb,ilog2(ci->blocksizes[1]),4);
+ oggpack_write(opb,1,1);
-static int _vorbis_pack_books(oggpack_buffer *opb, vorbis_info *vi)
-{
- codec_setup_info *ci = vi->codec_setup;
- int i;
- if(!ci)return(OV_EFAULT);
+ return(0);
+}
- oggpack_write(opb, 0x05, 8);
- _v_writestring(opb, "vorbis", 6);
+static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
+ int bytes = strlen(ENCODE_VENDOR_STRING);
- /* books */
- oggpack_write(opb, ci->books - 1, 8);
- for(i = 0; i < ci->books; i++)
- if(vorbis_staticbook_pack(ci->book_param[i], opb))goto err_out;
+ /* preamble */
+ oggpack_write(opb,0x03,8);
+ _v_writestring(opb,"vorbis", 6);
- /* times; hook placeholders */
- oggpack_write(opb, 0, 6);
- oggpack_write(opb, 0, 16);
+ /* vendor */
+ oggpack_write(opb,bytes,32);
+ _v_writestring(opb,ENCODE_VENDOR_STRING, bytes);
- /* floors */
- oggpack_write(opb, ci->floors - 1, 6);
- for(i = 0; i < ci->floors; i++)
- {
- oggpack_write(opb, ci->floor_type[i], 16);
- if(_floor_P[ci->floor_type[i]]->pack)
- _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i], opb);
- else
- goto err_out;
- }
+ /* comments */
- /* residues */
- oggpack_write(opb, ci->residues - 1, 6);
- for(i = 0; i < ci->residues; i++)
- {
- oggpack_write(opb, ci->residue_type[i], 16);
- _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i], opb);
- }
-
- /* maps */
- oggpack_write(opb, ci->maps - 1, 6);
- for(i = 0; i < ci->maps; i++)
- {
- oggpack_write(opb, ci->map_type[i], 16);
- _mapping_P[ci->map_type[i]]->pack(vi, ci->map_param[i], opb);
+ oggpack_write(opb,vc->comments,32);
+ if(vc->comments){
+ int i;
+ for(i=0;i<vc->comments;i++){
+ if(vc->user_comments[i]){
+ oggpack_write(opb,vc->comment_lengths[i],32);
+ _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
+ }else{
+ oggpack_write(opb,0,32);
+ }
}
+ }
+ oggpack_write(opb,1,1);
- /* modes */
- oggpack_write(opb, ci->modes - 1, 6);
- for(i = 0; i < ci->modes; i++)
- {
- oggpack_write(opb, ci->mode_param[i]->blockflag, 1);
- oggpack_write(opb, ci->mode_param[i]->windowtype, 16);
- oggpack_write(opb, ci->mode_param[i]->transformtype, 16);
- oggpack_write(opb, ci->mode_param[i]->mapping, 8);
- }
- oggpack_write(opb, 1, 1);
+ return(0);
+}
- return(0);
+static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
+ codec_setup_info *ci=vi->codec_setup;
+ int i;
+ if(!ci)return(OV_EFAULT);
+
+ oggpack_write(opb,0x05,8);
+ _v_writestring(opb,"vorbis", 6);
+
+ /* books */
+ oggpack_write(opb,ci->books-1,8);
+ for(i=0;i<ci->books;i++)
+ if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out;
+
+ /* times; hook placeholders */
+ oggpack_write(opb,0,6);
+ oggpack_write(opb,0,16);
+
+ /* floors */
+ oggpack_write(opb,ci->floors-1,6);
+ for(i=0;i<ci->floors;i++){
+ oggpack_write(opb,ci->floor_type[i],16);
+ if(_floor_P[ci->floor_type[i]]->pack)
+ _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb);
+ else
+ goto err_out;
+ }
+
+ /* residues */
+ oggpack_write(opb,ci->residues-1,6);
+ for(i=0;i<ci->residues;i++){
+ oggpack_write(opb,ci->residue_type[i],16);
+ _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb);
+ }
+
+ /* maps */
+ oggpack_write(opb,ci->maps-1,6);
+ for(i=0;i<ci->maps;i++){
+ oggpack_write(opb,ci->map_type[i],16);
+ _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb);
+ }
+
+ /* modes */
+ oggpack_write(opb,ci->modes-1,6);
+ for(i=0;i<ci->modes;i++){
+ oggpack_write(opb,ci->mode_param[i]->blockflag,1);
+ oggpack_write(opb,ci->mode_param[i]->windowtype,16);
+ oggpack_write(opb,ci->mode_param[i]->transformtype,16);
+ oggpack_write(opb,ci->mode_param[i]->mapping,8);
+ }
+ oggpack_write(opb,1,1);
+
+ return(0);
err_out:
- return(-1);
+ return(-1);
}
int vorbis_commentheader_out(vorbis_comment *vc,
- ogg_packet *op)
-{
+ ogg_packet *op){
- oggpack_buffer opb;
+ oggpack_buffer opb;
- oggpack_writeinit(&opb);
- if(_vorbis_pack_comment(&opb, vc)) return OV_EIMPL;
+ oggpack_writeinit(&opb);
+ if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL;
- op->packet = _ogg_malloc(oggpack_bytes(&opb));
- memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
+ op->packet = _ogg_malloc(oggpack_bytes(&opb));
+ memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
- op->bytes = oggpack_bytes(&opb);
- op->b_o_s = 0;
- op->e_o_s = 0;
- op->granulepos = 0;
- op->packetno = 1;
+ op->bytes=oggpack_bytes(&opb);
+ op->b_o_s=0;
+ op->e_o_s=0;
+ op->granulepos=0;
+ op->packetno=1;
- return 0;
+ return 0;
}
int vorbis_analysis_headerout(vorbis_dsp_state *v,
vorbis_comment *vc,
ogg_packet *op,
ogg_packet *op_comm,
- ogg_packet *op_code)
-{
- int ret = OV_EIMPL;
- vorbis_info *vi = v->vi;
- oggpack_buffer opb;
- private_state *b = v->backend_state;
-
- if(!b)
- {
- ret = OV_EFAULT;
- goto err_out;
- }
-
- /* first header packet **********************************************/
-
- oggpack_writeinit(&opb);
- if(_vorbis_pack_info(&opb, vi))goto err_out;
-
- /* build the packet */
+ ogg_packet *op_code){
+ int ret=OV_EIMPL;
+ vorbis_info *vi=v->vi;
+ oggpack_buffer opb;
+ private_state *b=v->backend_state;
+
+ if(!b){
+ ret=OV_EFAULT;
+ goto err_out;
+ }
+
+ /* first header packet **********************************************/
+
+ oggpack_writeinit(&opb);
+ if(_vorbis_pack_info(&opb,vi))goto err_out;
+
+ /* build the packet */
+ if(b->header)_ogg_free(b->header);
+ b->header=_ogg_malloc(oggpack_bytes(&opb));
+ memcpy(b->header,opb.buffer,oggpack_bytes(&opb));
+ op->packet=b->header;
+ op->bytes=oggpack_bytes(&opb);
+ op->b_o_s=1;
+ op->e_o_s=0;
+ op->granulepos=0;
+ op->packetno=0;
+
+ /* second header packet (comments) **********************************/
+
+ oggpack_reset(&opb);
+ if(_vorbis_pack_comment(&opb,vc))goto err_out;
+
+ if(b->header1)_ogg_free(b->header1);
+ b->header1=_ogg_malloc(oggpack_bytes(&opb));
+ memcpy(b->header1,opb.buffer,oggpack_bytes(&opb));
+ op_comm->packet=b->header1;
+ op_comm->bytes=oggpack_bytes(&opb);
+ op_comm->b_o_s=0;
+ op_comm->e_o_s=0;
+ op_comm->granulepos=0;
+ op_comm->packetno=1;
+
+ /* third header packet (modes/codebooks) ****************************/
+
+ oggpack_reset(&opb);
+ if(_vorbis_pack_books(&opb,vi))goto err_out;
+
+ if(b->header2)_ogg_free(b->header2);
+ b->header2=_ogg_malloc(oggpack_bytes(&opb));
+ memcpy(b->header2,opb.buffer,oggpack_bytes(&opb));
+ op_code->packet=b->header2;
+ op_code->bytes=oggpack_bytes(&opb);
+ op_code->b_o_s=0;
+ op_code->e_o_s=0;
+ op_code->granulepos=0;
+ op_code->packetno=2;
+
+ oggpack_writeclear(&opb);
+ return(0);
+ err_out:
+ oggpack_writeclear(&opb);
+ memset(op,0,sizeof(*op));
+ memset(op_comm,0,sizeof(*op_comm));
+ memset(op_code,0,sizeof(*op_code));
+
+ if(b){
if(b->header)_ogg_free(b->header);
- b->header = _ogg_malloc(oggpack_bytes(&opb));
- memcpy(b->header, opb.buffer, oggpack_bytes(&opb));
- op->packet = b->header;
- op->bytes = oggpack_bytes(&opb);
- op->b_o_s = 1;
- op->e_o_s = 0;
- op->granulepos = 0;
- op->packetno = 0;
-
- /* second header packet (comments) **********************************/
-
- oggpack_reset(&opb);
- if(_vorbis_pack_comment(&opb, vc))goto err_out;
-
if(b->header1)_ogg_free(b->header1);
- b->header1 = _ogg_malloc(oggpack_bytes(&opb));
- memcpy(b->header1, opb.buffer, oggpack_bytes(&opb));
- op_comm->packet = b->header1;
- op_comm->bytes = oggpack_bytes(&opb);
- op_comm->b_o_s = 0;
- op_comm->e_o_s = 0;
- op_comm->granulepos = 0;
- op_comm->packetno = 1;
-
- /* third header packet (modes/codebooks) ****************************/
-
- oggpack_reset(&opb);
- if(_vorbis_pack_books(&opb, vi))goto err_out;
-
if(b->header2)_ogg_free(b->header2);
- b->header2 = _ogg_malloc(oggpack_bytes(&opb));
- memcpy(b->header2, opb.buffer, oggpack_bytes(&opb));
- op_code->packet = b->header2;
- op_code->bytes = oggpack_bytes(&opb);
- op_code->b_o_s = 0;
- op_code->e_o_s = 0;
- op_code->granulepos = 0;
- op_code->packetno = 2;
-
- oggpack_writeclear(&opb);
- return(0);
-err_out:
- oggpack_writeclear(&opb);
- memset(op, 0, sizeof(*op));
- memset(op_comm, 0, sizeof(*op_comm));
- memset(op_code, 0, sizeof(*op_code));
-
- if(b)
- {
- if(b->header)_ogg_free(b->header);
- if(b->header1)_ogg_free(b->header1);
- if(b->header2)_ogg_free(b->header2);
- b->header = NULL;
- b->header1 = NULL;
- b->header2 = NULL;
- }
- return(ret);
+ b->header=NULL;
+ b->header1=NULL;
+ b->header2=NULL;
+ }
+ return(ret);
}
-double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos)
-{
- if(granulepos >= 0)
- return((double)granulepos / v->vi->rate);
- return(-1);
+double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){
+ if(granulepos>=0)
+ return((double)granulepos/v->vi->rate);
+ return(-1);
}
-const char *vorbis_version_string(void)
-{
- return GENERAL_VENDOR_STRING;
+const char *vorbis_version_string(void){
+ return GENERAL_VENDOR_STRING;
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.c b/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.c
index 65ed9bfb9..3321ed3db 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.c
@@ -24,36 +24,32 @@
#ifdef FLOAT_LOOKUP
/* interpolated lookup based cos function, domain 0 to PI only */
-float vorbis_coslook(float a)
-{
- double d = a * (.31830989 * (float)COS_LOOKUP_SZ);
- int i = vorbis_ftoi(d - .5);
+float vorbis_coslook(float a){
+ double d=a*(.31830989*(float)COS_LOOKUP_SZ);
+ int i=vorbis_ftoi(d-.5);
- return COS_LOOKUP[i] + (d - i) * (COS_LOOKUP[i+1] - COS_LOOKUP[i]);
+ return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]);
}
/* interpolated 1./sqrt(p) where .5 <= p < 1. */
-float vorbis_invsqlook(float a)
-{
- double d = a * (2.f * (float)INVSQ_LOOKUP_SZ) - (float)INVSQ_LOOKUP_SZ;
- int i = vorbis_ftoi(d - .5f);
- return INVSQ_LOOKUP[i] + (d - i) * (INVSQ_LOOKUP[i+1] - INVSQ_LOOKUP[i]);
+float vorbis_invsqlook(float a){
+ double d=a*(2.f*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ;
+ int i=vorbis_ftoi(d-.5f);
+ return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]);
}
/* interpolated 1./sqrt(p) where .5 <= p < 1. */
-float vorbis_invsq2explook(int a)
-{
- return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN];
+float vorbis_invsq2explook(int a){
+ return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN];
}
#include <stdio.h>
/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
-float vorbis_fromdBlook(float a)
-{
- int i = vorbis_ftoi(a * ((float)(-(1 << FROMdB2_SHIFT))) - .5f);
- return (i < 0) ? 1.f :
- ((i >= (FROMdB_LOOKUP_SZ << FROMdB_SHIFT)) ? 0.f :
- FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK]);
+float vorbis_fromdBlook(float a){
+ int i=vorbis_ftoi(a*((float)(-(1<<FROMdB2_SHIFT)))-.5f);
+ return (i<0)?1.f:
+ ((i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))?0.f:
+ FROMdB_LOOKUP[i>>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
}
#endif
@@ -63,39 +59,36 @@ float vorbis_fromdBlook(float a)
16.16 format
returns in m.8 format */
-long vorbis_invsqlook_i(long a, long e)
-{
- long i = (a & 0x7fff) >> (INVSQ_LOOKUP_I_SHIFT - 1);
- long d = (a & INVSQ_LOOKUP_I_MASK) << (16 - INVSQ_LOOKUP_I_SHIFT); /* 0.16 */
- long val = INVSQ_LOOKUP_I[i] - /* 1.16 */
- (((INVSQ_LOOKUP_I[i] - INVSQ_LOOKUP_I[i+1])* /* 0.16 */
- d) >> 16); /* result 1.16 */
-
- e += 32;
- if(e & 1)val = (val * 5792) >> 13; /* multiply val by 1/sqrt(2) */
- e = (e >> 1) - 8;
-
- return(val >> e);
+long vorbis_invsqlook_i(long a,long e){
+ long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
+ long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */
+ long val=INVSQ_LOOKUP_I[i]- /* 1.16 */
+ (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */
+ d)>>16); /* result 1.16 */
+
+ e+=32;
+ if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */
+ e=(e>>1)-8;
+
+ return(val>>e);
}
/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
/* a is in n.12 format */
-float vorbis_fromdBlook_i(long a)
-{
- int i = (-a) >> (12 - FROMdB2_SHIFT);
- return (i < 0) ? 1.f :
- ((i >= (FROMdB_LOOKUP_SZ << FROMdB_SHIFT)) ? 0.f :
- FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK]);
+float vorbis_fromdBlook_i(long a){
+ int i=(-a)>>(12-FROMdB2_SHIFT);
+ return (i<0)?1.f:
+ ((i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))?0.f:
+ FROMdB_LOOKUP[i>>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
}
/* interpolated lookup based cos function, domain 0 to PI only */
/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
-long vorbis_coslook_i(long a)
-{
- int i = a >> COS_LOOKUP_I_SHIFT;
- int d = a & COS_LOOKUP_I_MASK;
- return COS_LOOKUP_I[i] - ((d * (COS_LOOKUP_I[i] - COS_LOOKUP_I[i+1])) >>
- COS_LOOKUP_I_SHIFT);
+long vorbis_coslook_i(long a){
+ int i=a>>COS_LOOKUP_I_SHIFT;
+ int d=a&COS_LOOKUP_I_MASK;
+ return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
+ COS_LOOKUP_I_SHIFT);
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.h b/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.h
index 7b8563045..f8b5b8273 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lookup.h
@@ -24,7 +24,7 @@ extern float vorbis_invsq2explook(int a);
extern float vorbis_fromdBlook(float a);
#endif
#ifdef INT_LOOKUP
-extern long vorbis_invsqlook_i(long a, long e);
+extern long vorbis_invsqlook_i(long a,long e);
extern long vorbis_coslook_i(long a);
extern float vorbis_fromdBlook_i(long a);
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lookup_data.h b/src/filters/transform/MpaDecFilter/libvorbisidec/lookup_data.h
index 4716a8c28..2424a1b38 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lookup_data.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lookup_data.h
@@ -19,79 +19,76 @@
#ifdef FLOAT_LOOKUP
#define COS_LOOKUP_SZ 128
-static const float COS_LOOKUP[COS_LOOKUP_SZ+1] =
-{
- +1.0000000000000f, +0.9996988186962f, +0.9987954562052f, +0.9972904566787f,
- +0.9951847266722f, +0.9924795345987f, +0.9891765099648f, +0.9852776423889f,
- +0.9807852804032f, +0.9757021300385f, +0.9700312531945f, +0.9637760657954f,
- +0.9569403357322f, +0.9495281805930f, +0.9415440651830f, +0.9329927988347f,
- +0.9238795325113f, +0.9142097557035f, +0.9039892931234f, +0.8932243011955f,
- +0.8819212643484f, +0.8700869911087f, +0.8577286100003f, +0.8448535652497f,
- +0.8314696123025f, +0.8175848131516f, +0.8032075314806f, +0.7883464276266f,
- +0.7730104533627f, +0.7572088465065f, +0.7409511253550f, +0.7242470829515f,
- +0.7071067811865f, +0.6895405447371f, +0.6715589548470f, +0.6531728429538f,
- +0.6343932841636f, +0.6152315905806f, +0.5956993044924f, +0.5758081914178f,
- +0.5555702330196f, +0.5349976198871f, +0.5141027441932f, +0.4928981922298f,
- +0.4713967368260f, +0.4496113296546f, +0.4275550934303f, +0.4052413140050f,
- +0.3826834323651f, +0.3598950365350f, +0.3368898533922f, +0.3136817403989f,
- +0.2902846772545f, +0.2667127574749f, +0.2429801799033f, +0.2191012401569f,
- +0.1950903220161f, +0.1709618887603f, +0.1467304744554f, +0.1224106751992f,
- +0.0980171403296f, +0.0735645635997f, +0.0490676743274f, +0.0245412285229f,
- +0.0000000000000f, -0.0245412285229f, -0.0490676743274f, -0.0735645635997f,
- -0.0980171403296f, -0.1224106751992f, -0.1467304744554f, -0.1709618887603f,
- -0.1950903220161f, -0.2191012401569f, -0.2429801799033f, -0.2667127574749f,
- -0.2902846772545f, -0.3136817403989f, -0.3368898533922f, -0.3598950365350f,
- -0.3826834323651f, -0.4052413140050f, -0.4275550934303f, -0.4496113296546f,
- -0.4713967368260f, -0.4928981922298f, -0.5141027441932f, -0.5349976198871f,
- -0.5555702330196f, -0.5758081914178f, -0.5956993044924f, -0.6152315905806f,
- -0.6343932841636f, -0.6531728429538f, -0.6715589548470f, -0.6895405447371f,
- -0.7071067811865f, -0.7242470829515f, -0.7409511253550f, -0.7572088465065f,
- -0.7730104533627f, -0.7883464276266f, -0.8032075314806f, -0.8175848131516f,
- -0.8314696123025f, -0.8448535652497f, -0.8577286100003f, -0.8700869911087f,
- -0.8819212643484f, -0.8932243011955f, -0.9039892931234f, -0.9142097557035f,
- -0.9238795325113f, -0.9329927988347f, -0.9415440651830f, -0.9495281805930f,
- -0.9569403357322f, -0.9637760657954f, -0.9700312531945f, -0.9757021300385f,
- -0.9807852804032f, -0.9852776423889f, -0.9891765099648f, -0.9924795345987f,
- -0.9951847266722f, -0.9972904566787f, -0.9987954562052f, -0.9996988186962f,
- -1.0000000000000f,
+static const float COS_LOOKUP[COS_LOOKUP_SZ+1]={
+ +1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f,
+ +0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f,
+ +0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f,
+ +0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f,
+ +0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f,
+ +0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f,
+ +0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f,
+ +0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f,
+ +0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f,
+ +0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f,
+ +0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f,
+ +0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f,
+ +0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f,
+ +0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f,
+ +0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f,
+ +0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f,
+ +0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f,
+ -0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f,
+ -0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f,
+ -0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f,
+ -0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f,
+ -0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f,
+ -0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f,
+ -0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f,
+ -0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f,
+ -0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f,
+ -0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f,
+ -0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f,
+ -0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f,
+ -0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f,
+ -0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f,
+ -0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f,
+ -1.0000000000000f,
};
#define INVSQ_LOOKUP_SZ 32
-static const float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1] =
-{
- 1.414213562373f, 1.392621247646f, 1.371988681140f, 1.352246807566f,
- 1.333333333333f, 1.315191898443f, 1.297771369046f, 1.281025230441f,
- 1.264911064067f, 1.249390095109f, 1.234426799697f, 1.219988562661f,
- 1.206045378311f, 1.192569588000f, 1.179535649239f, 1.166919931983f,
- 1.154700538379f, 1.142857142857f, 1.131370849898f, 1.120224067222f,
- 1.109400392450f, 1.098884511590f, 1.088662107904f, 1.078719779941f,
- 1.069044967650f, 1.059625885652f, 1.050451462878f, 1.041511287847f,
- 1.032795558989f, 1.024295039463f, 1.016001016002f, 1.007905261358f,
- 1.000000000000f,
+static const float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={
+ 1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f,
+ 1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f,
+ 1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f,
+ 1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f,
+ 1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f,
+ 1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f,
+ 1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f,
+ 1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f,
+ 1.000000000000f,
};
#define INVSQ2EXP_LOOKUP_MIN (-32)
#define INVSQ2EXP_LOOKUP_MAX 32
static const float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
- INVSQ2EXP_LOOKUP_MIN+1] =
-{
- 65536.f, 46340.95001f, 32768.f, 23170.47501f,
- 16384.f, 11585.2375f, 8192.f, 5792.618751f,
- 4096.f, 2896.309376f, 2048.f, 1448.154688f,
- 1024.f, 724.0773439f, 512.f, 362.038672f,
- 256.f, 181.019336f, 128.f, 90.50966799f,
- 64.f, 45.254834f, 32.f, 22.627417f,
- 16.f, 11.3137085f, 8.f, 5.656854249f,
- 4.f, 2.828427125f, 2.f, 1.414213562f,
- 1.f, 0.7071067812f, 0.5f, 0.3535533906f,
- 0.25f, 0.1767766953f, 0.125f, 0.08838834765f,
- 0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f,
- 0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f,
- 0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f,
- 0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f,
- 0.000244140625f, 0.0001726334915f, 0.0001220703125f, 8.631674575e-05f,
- 6.103515625e-05f, 4.315837288e-05f, 3.051757812e-05f, 2.157918644e-05f,
- 1.525878906e-05f,
+ INVSQ2EXP_LOOKUP_MIN+1]={
+ 65536.f, 46340.95001f, 32768.f, 23170.47501f,
+ 16384.f, 11585.2375f, 8192.f, 5792.618751f,
+ 4096.f, 2896.309376f, 2048.f, 1448.154688f,
+ 1024.f, 724.0773439f, 512.f, 362.038672f,
+ 256.f, 181.019336f, 128.f, 90.50966799f,
+ 64.f, 45.254834f, 32.f, 22.627417f,
+ 16.f, 11.3137085f, 8.f, 5.656854249f,
+ 4.f, 2.828427125f, 2.f, 1.414213562f,
+ 1.f, 0.7071067812f, 0.5f, 0.3535533906f,
+ 0.25f, 0.1767766953f, 0.125f, 0.08838834765f,
+ 0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f,
+ 0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f,
+ 0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f,
+ 0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f,
+ 0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f,
+ 6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f,
+ 1.525878906e-05f,
};
#endif
@@ -103,29 +100,27 @@ static const float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
#define FROMdB2_MASK 31
#ifdef FLOAT_LOOKUP
-static const float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ] =
-{
- 1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f,
- 0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f,
- 0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f,
- 0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f,
- 0.0006309573445f, 0.0003981071706f, 0.0002511886432f, 0.0001584893192f,
- 0.0001f, 6.309573445e-05f, 3.981071706e-05f, 2.511886432e-05f,
- 1.584893192e-05f, 1e-05f, 6.309573445e-06f, 3.981071706e-06f,
- 2.511886432e-06f, 1.584893192e-06f, 1e-06f, 6.309573445e-07f,
- 3.981071706e-07f, 2.511886432e-07f, 1.584893192e-07f,
+static const float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
+ 1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f,
+ 0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f,
+ 0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f,
+ 0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f,
+ 0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f,
+ 0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f,
+ 1.584893192e-05f, 1e-05f,6.309573445e-06f,3.981071706e-06f,
+ 2.511886432e-06f,1.584893192e-06f, 1e-06f,6.309573445e-07f,
+ 3.981071706e-07f,2.511886432e-07f,1.584893192e-07f,
};
-static const float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ] =
-{
- 0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f,
- 0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f,
- 0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f,
- 0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f,
- 0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f,
- 0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f,
- 0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f,
- 0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f,
+static const float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
+ 0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f,
+ 0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f,
+ 0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f,
+ 0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f,
+ 0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f,
+ 0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f,
+ 0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f,
+ 0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f,
};
#endif
@@ -133,65 +128,63 @@ static const float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ] =
#define INVSQ_LOOKUP_I_SHIFT 10
#define INVSQ_LOOKUP_I_MASK 1023
-static const long INVSQ_LOOKUP_I[64+1] =
-{
- 92682l, 91966l, 91267l, 90583l,
- 89915l, 89261l, 88621l, 87995l,
- 87381l, 86781l, 86192l, 85616l,
- 85051l, 84497l, 83953l, 83420l,
- 82897l, 82384l, 81880l, 81385l,
- 80899l, 80422l, 79953l, 79492l,
- 79039l, 78594l, 78156l, 77726l,
- 77302l, 76885l, 76475l, 76072l,
- 75674l, 75283l, 74898l, 74519l,
- 74146l, 73778l, 73415l, 73058l,
- 72706l, 72359l, 72016l, 71679l,
- 71347l, 71019l, 70695l, 70376l,
- 70061l, 69750l, 69444l, 69141l,
- 68842l, 68548l, 68256l, 67969l,
- 67685l, 67405l, 67128l, 66855l,
- 66585l, 66318l, 66054l, 65794l,
- 65536l,
+static const long INVSQ_LOOKUP_I[64+1]={
+ 92682l, 91966l, 91267l, 90583l,
+ 89915l, 89261l, 88621l, 87995l,
+ 87381l, 86781l, 86192l, 85616l,
+ 85051l, 84497l, 83953l, 83420l,
+ 82897l, 82384l, 81880l, 81385l,
+ 80899l, 80422l, 79953l, 79492l,
+ 79039l, 78594l, 78156l, 77726l,
+ 77302l, 76885l, 76475l, 76072l,
+ 75674l, 75283l, 74898l, 74519l,
+ 74146l, 73778l, 73415l, 73058l,
+ 72706l, 72359l, 72016l, 71679l,
+ 71347l, 71019l, 70695l, 70376l,
+ 70061l, 69750l, 69444l, 69141l,
+ 68842l, 68548l, 68256l, 67969l,
+ 67685l, 67405l, 67128l, 66855l,
+ 66585l, 66318l, 66054l, 65794l,
+ 65536l,
};
#define COS_LOOKUP_I_SHIFT 9
#define COS_LOOKUP_I_MASK 511
#define COS_LOOKUP_I_SZ 128
-static const long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1] =
-{
- 16384l, 16379l, 16364l, 16340l,
- 16305l, 16261l, 16207l, 16143l,
- 16069l, 15986l, 15893l, 15791l,
- 15679l, 15557l, 15426l, 15286l,
- 15137l, 14978l, 14811l, 14635l,
- 14449l, 14256l, 14053l, 13842l,
- 13623l, 13395l, 13160l, 12916l,
- 12665l, 12406l, 12140l, 11866l,
- 11585l, 11297l, 11003l, 10702l,
- 10394l, 10080l, 9760l, 9434l,
- 9102l, 8765l, 8423l, 8076l,
- 7723l, 7366l, 7005l, 6639l,
- 6270l, 5897l, 5520l, 5139l,
- 4756l, 4370l, 3981l, 3590l,
- 3196l, 2801l, 2404l, 2006l,
- 1606l, 1205l, 804l, 402l,
- 0l, -401l, -803l, -1204l,
- -1605l, -2005l, -2403l, -2800l,
- -3195l, -3589l, -3980l, -4369l,
- -4755l, -5138l, -5519l, -5896l,
- -6269l, -6638l, -7004l, -7365l,
- -7722l, -8075l, -8422l, -8764l,
- -9101l, -9433l, -9759l, -10079l,
- -10393l, -10701l, -11002l, -11296l,
- -11584l, -11865l, -12139l, -12405l,
- -12664l, -12915l, -13159l, -13394l,
- -13622l, -13841l, -14052l, -14255l,
- -14448l, -14634l, -14810l, -14977l,
- -15136l, -15285l, -15425l, -15556l,
- -15678l, -15790l, -15892l, -15985l,
- -16068l, -16142l, -16206l, -16260l,
- -16304l, -16339l, -16363l, -16378l,
- -16383l,
+static const long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
+ 16384l, 16379l, 16364l, 16340l,
+ 16305l, 16261l, 16207l, 16143l,
+ 16069l, 15986l, 15893l, 15791l,
+ 15679l, 15557l, 15426l, 15286l,
+ 15137l, 14978l, 14811l, 14635l,
+ 14449l, 14256l, 14053l, 13842l,
+ 13623l, 13395l, 13160l, 12916l,
+ 12665l, 12406l, 12140l, 11866l,
+ 11585l, 11297l, 11003l, 10702l,
+ 10394l, 10080l, 9760l, 9434l,
+ 9102l, 8765l, 8423l, 8076l,
+ 7723l, 7366l, 7005l, 6639l,
+ 6270l, 5897l, 5520l, 5139l,
+ 4756l, 4370l, 3981l, 3590l,
+ 3196l, 2801l, 2404l, 2006l,
+ 1606l, 1205l, 804l, 402l,
+ 0l, -401l, -803l, -1204l,
+ -1605l, -2005l, -2403l, -2800l,
+ -3195l, -3589l, -3980l, -4369l,
+ -4755l, -5138l, -5519l, -5896l,
+ -6269l, -6638l, -7004l, -7365l,
+ -7722l, -8075l, -8422l, -8764l,
+ -9101l, -9433l, -9759l, -10079l,
+ -10393l, -10701l, -11002l, -11296l,
+ -11584l, -11865l, -12139l, -12405l,
+ -12664l, -12915l, -13159l, -13394l,
+ -13622l, -13841l, -14052l, -14255l,
+ -14448l, -14634l, -14810l, -14977l,
+ -15136l, -15285l, -15425l, -15556l,
+ -15678l, -15790l, -15892l, -15985l,
+ -16068l, -16142l, -16206l, -16260l,
+ -16304l, -16339l, -16363l, -16378l,
+ -16383l,
};
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.c b/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.c
index 363f31791..f5199ec23 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.c
@@ -58,111 +58,103 @@ Carsten Bormann
/* Input : n elements of time doamin data
Output: m lpc coefficients, excitation energy */
-float vorbis_lpc_from_data(float *data, float *lpci, int n, int m)
-{
- double *aut = alloca(sizeof(*aut) * (m + 1));
- double *lpc = alloca(sizeof(*lpc) * (m));
- double error;
- double epsilon;
- int i, j;
-
- /* autocorrelation, p+1 lag coefficients */
- j = m + 1;
- while(j--)
- {
- double d = 0; /* double needed for accumulator depth */
- for(i = j; i < n; i++)d += (double)data[i] * data[i-j];
- aut[j] = d;
+float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
+ double *aut=alloca(sizeof(*aut)*(m+1));
+ double *lpc=alloca(sizeof(*lpc)*(m));
+ double error;
+ double epsilon;
+ int i,j;
+
+ /* autocorrelation, p+1 lag coefficients */
+ j=m+1;
+ while(j--){
+ double d=0; /* double needed for accumulator depth */
+ for(i=j;i<n;i++)d+=(double)data[i]*data[i-j];
+ aut[j]=d;
+ }
+
+ /* Generate lpc coefficients from autocorr values */
+
+ /* set our noise floor to about -100dB */
+ error=aut[0] * (1. + 1e-10);
+ epsilon=1e-9*aut[0]+1e-10;
+
+ for(i=0;i<m;i++){
+ double r= -aut[i+1];
+
+ if(error<epsilon){
+ memset(lpc+i,0,(m-i)*sizeof(*lpc));
+ goto done;
}
- /* Generate lpc coefficients from autocorr values */
+ /* Sum up this iteration's reflection coefficient; note that in
+ Vorbis we don't save it. If anyone wants to recycle this code
+ and needs reflection coefficients, save the results of 'r' from
+ each iteration. */
- /* set our noise floor to about -100dB */
- error = aut[0] * (1. + 1e-10);
- epsilon = 1e-9 * aut[0] + 1e-10;
+ for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
+ r/=error;
- for(i = 0; i < m; i++)
- {
- double r = -aut[i+1];
+ /* Update LPC coefficients and total error */
- if(error < epsilon)
- {
- memset(lpc + i, 0, (m - i)*sizeof(*lpc));
- goto done;
- }
+ lpc[i]=r;
+ for(j=0;j<i/2;j++){
+ double tmp=lpc[j];
- /* Sum up this iteration's reflection coefficient; note that in
- Vorbis we don't save it. If anyone wants to recycle this code
- and needs reflection coefficients, save the results of 'r' from
- each iteration. */
-
- for(j = 0; j < i; j++)r -= lpc[j] * aut[i-j];
- r /= error;
-
- /* Update LPC coefficients and total error */
-
- lpc[i] = r;
- for(j = 0; j < i / 2; j++)
- {
- double tmp = lpc[j];
+ lpc[j]+=r*lpc[i-1-j];
+ lpc[i-1-j]+=r*tmp;
+ }
+ if(i&1)lpc[j]+=lpc[j]*r;
- lpc[j] += r * lpc[i-1-j];
- lpc[i-1-j] += r * tmp;
- }
- if(i & 1)lpc[j] += lpc[j] * r;
+ error*=1.-r*r;
- error *= 1. - r * r;
+ }
- }
+ done:
-done:
-
- /* slightly damp the filter */
- {
- double g = .99;
- double damp = g;
- for(j = 0; j < m; j++)
- {
- lpc[j] *= damp;
- damp *= g;
- }
+ /* slightly damp the filter */
+ {
+ double g = .99;
+ double damp = g;
+ for(j=0;j<m;j++){
+ lpc[j]*=damp;
+ damp*=g;
}
+ }
- for(j = 0; j < m; j++)lpci[j] = (float)lpc[j];
+ for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
- /* we need the error value to know how big an impulse to hit the
- filter with later */
+ /* we need the error value to know how big an impulse to hit the
+ filter with later */
- return error;
+ return error;
}
-void vorbis_lpc_predict(float *coeff, float *prime, int m,
- float *data, long n)
-{
-
- /* in: coeff[0...m-1] LPC coefficients
- prime[0...m-1] initial values (allocated size of n+m-1)
- out: data[0...n-1] data samples */
-
- long i, j, o, p;
- float y;
- float *work = alloca(sizeof(*work) * (m + n));
-
- if(!prime)
- for(i = 0; i < m; i++)
- work[i] = 0.f;
- else
- for(i = 0; i < m; i++)
- work[i] = prime[i];
-
- for(i = 0; i < n; i++)
- {
- y = 0;
- o = i;
- p = m;
- for(j = 0; j < m; j++)
- y -= work[o++] * coeff[--p];
-
- data[i] = work[o] = y;
- }
+void vorbis_lpc_predict(float *coeff,float *prime,int m,
+ float *data,long n){
+
+ /* in: coeff[0...m-1] LPC coefficients
+ prime[0...m-1] initial values (allocated size of n+m-1)
+ out: data[0...n-1] data samples */
+
+ long i,j,o,p;
+ float y;
+ float *work=alloca(sizeof(*work)*(m+n));
+
+ if(!prime)
+ for(i=0;i<m;i++)
+ work[i]=0.f;
+ else
+ for(i=0;i<m;i++)
+ work[i]=prime[i];
+
+ for(i=0;i<n;i++){
+ y=0;
+ o=i;
+ p=m;
+ for(j=0;j<m;j++)
+ y-=work[o++]*coeff[--p];
+
+ data[i]=work[o]=y;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.h b/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.h
index 3dc40ab09..39d237601 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lpc.h
@@ -21,9 +21,9 @@
#include "vorbis/codec.h"
/* simple linear scale LPC code */
-extern float vorbis_lpc_from_data(float *data, float *lpc, int n, int m);
+extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m);
-extern void vorbis_lpc_predict(float *coeff, float *prime, int m,
- float *data, long n);
+extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
+ float *data,long n);
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.c b/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.c
index ee2155b2e..caf000324 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.c
@@ -58,446 +58,399 @@
#ifdef FLOAT_LOOKUP
#include "lookup.c" /* catch this in the build system; we #include for
-compilers (like gcc) that can't inline across
-modules */
+ compilers (like gcc) that can't inline across
+ modules */
/* side effect: changes *lsp to cosines of lsp */
-void vorbis_lsp_to_curve(float *curve, int *map, int n, int ln, float *lsp, int m,
-float amp, float ampoffset)
-{
-int i;
-float wdel = M_PI / ln;
-vorbis_fpu_control fpu;
-
-vorbis_fpu_setround(&fpu);
-for(i = 0; i < m; i++)lsp[i] = vorbis_coslook(lsp[i]);
-
-i = 0;
-while(i < n)
-{
-int k = map[i];
-int qexp;
-float p = .7071067812f;
-float q = .7071067812f;
-float w = vorbis_coslook(wdel * k);
-float *ftmp = lsp;
-int c = m >> 1;
-
-do
-{
-q *= ftmp[0] - w;
-p *= ftmp[1] - w;
-ftmp += 2;
-}
-while(--c);
-
-if(m & 1)
-{
-/* odd order filter; slightly assymetric */
-/* the last coefficient */
-q *= ftmp[0] - w;
-q *= q;
-p *= p * (1.f - w * w);
-}
-else
-{
-/* even order filter; still symmetric */
-q *= q * (1.f + w);
-p *= p * (1.f - w);
-}
-
-q = frexp(p + q, &qexp);
-q = vorbis_fromdBlook(amp *
-vorbis_invsqlook(q) *
-vorbis_invsq2explook(qexp + m) -
-ampoffset);
+void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
+ float amp,float ampoffset){
+ int i;
+ float wdel=M_PI/ln;
+ vorbis_fpu_control fpu;
+
+ vorbis_fpu_setround(&fpu);
+ for(i=0;i<m;i++)lsp[i]=vorbis_coslook(lsp[i]);
+
+ i=0;
+ while(i<n){
+ int k=map[i];
+ int qexp;
+ float p=.7071067812f;
+ float q=.7071067812f;
+ float w=vorbis_coslook(wdel*k);
+ float *ftmp=lsp;
+ int c=m>>1;
+
+ do{
+ q*=ftmp[0]-w;
+ p*=ftmp[1]-w;
+ ftmp+=2;
+ }while(--c);
+
+ if(m&1){
+ /* odd order filter; slightly assymetric */
+ /* the last coefficient */
+ q*=ftmp[0]-w;
+ q*=q;
+ p*=p*(1.f-w*w);
+ }else{
+ /* even order filter; still symmetric */
+ q*=q*(1.f+w);
+ p*=p*(1.f-w);
+ }
-do
-{
-curve[i++] *= q;
-}
-while(map[i] == k);
-}
-vorbis_fpu_restore(fpu);
+ q=frexp(p+q,&qexp);
+ q=vorbis_fromdBlook(amp*
+ vorbis_invsqlook(q)*
+ vorbis_invsq2explook(qexp+m)-
+ ampoffset);
+
+ do{
+ curve[i++]*=q;
+ }while(map[i]==k);
+ }
+ vorbis_fpu_restore(fpu);
}
#else
#ifdef INT_LOOKUP
#include "lookup.c" /* catch this in the build system; we #include for
-compilers (like gcc) that can't inline across
-modules */
-
-static const int MLOOP_1[64] =
-{
-0, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ compilers (like gcc) that can't inline across
+ modules */
+
+static const int MLOOP_1[64]={
+ 0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
+ 14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
+ 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+ 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
};
-static const int MLOOP_2[64] =
-{
-0, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
-8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
-9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+static const int MLOOP_2[64]={
+ 0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
+ 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
+ 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
+ 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
};
-static const int MLOOP_3[8] = {0, 1, 2, 2, 3, 3, 3, 3};
+static const int MLOOP_3[8]={0,1,2,2,3,3,3,3};
/* side effect: changes *lsp to cosines of lsp */
-void vorbis_lsp_to_curve(float *curve, int *map, int n, int ln, float *lsp, int m,
-float amp, float ampoffset)
-{
-
-/* 0 <= m < 256 */
-
-/* set up for using all int later */
-int i;
-int ampoffseti = rint(ampoffset * 4096.f);
-int ampi = rint(amp * 16.f);
-long *ilsp = alloca(m * sizeof(*ilsp));
-for(i = 0; i < m; i++)ilsp[i] = vorbis_coslook_i(lsp[i] / M_PI * 65536.f + .5f);
-
-i = 0;
-while(i < n)
-{
-int j, k = map[i];
-unsigned long pi = 46341; /* 2**-.5 in 0.16 */
-unsigned long qi = 46341;
-int qexp = 0, shift;
-long wi = vorbis_coslook_i(k * 65536 / ln);
-
-qi *= labs(ilsp[0] - wi);
-pi *= labs(ilsp[1] - wi);
-
-for(j = 3; j < m; j += 2)
-{
-if(!(shift = MLOOP_1[(pi|qi)>>25]))
-if(!(shift = MLOOP_2[(pi|qi)>>19]))
-shift = MLOOP_3[(pi|qi)>>16];
-qi = (qi >> shift) * labs(ilsp[j-1] - wi);
-pi = (pi >> shift) * labs(ilsp[j] - wi);
-qexp += shift;
-}
-if(!(shift = MLOOP_1[(pi|qi)>>25]))
-if(!(shift = MLOOP_2[(pi|qi)>>19]))
-shift = MLOOP_3[(pi|qi)>>16];
+void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
+ float amp,float ampoffset){
+
+ /* 0 <= m < 256 */
+
+ /* set up for using all int later */
+ int i;
+ int ampoffseti=rint(ampoffset*4096.f);
+ int ampi=rint(amp*16.f);
+ long *ilsp=alloca(m*sizeof(*ilsp));
+ for(i=0;i<m;i++)ilsp[i]=vorbis_coslook_i(lsp[i]/M_PI*65536.f+.5f);
+
+ i=0;
+ while(i<n){
+ int j,k=map[i];
+ unsigned long pi=46341; /* 2**-.5 in 0.16 */
+ unsigned long qi=46341;
+ int qexp=0,shift;
+ long wi=vorbis_coslook_i(k*65536/ln);
+
+ qi*=labs(ilsp[0]-wi);
+ pi*=labs(ilsp[1]-wi);
+
+ for(j=3;j<m;j+=2){
+ if(!(shift=MLOOP_1[(pi|qi)>>25]))
+ if(!(shift=MLOOP_2[(pi|qi)>>19]))
+ shift=MLOOP_3[(pi|qi)>>16];
+ qi=(qi>>shift)*labs(ilsp[j-1]-wi);
+ pi=(pi>>shift)*labs(ilsp[j]-wi);
+ qexp+=shift;
+ }
+ if(!(shift=MLOOP_1[(pi|qi)>>25]))
+ if(!(shift=MLOOP_2[(pi|qi)>>19]))
+ shift=MLOOP_3[(pi|qi)>>16];
-/* pi,qi normalized collectively, both tracked using qexp */
+ /* pi,qi normalized collectively, both tracked using qexp */
-if(m & 1)
-{
-/* odd order filter; slightly assymetric */
-/* the last coefficient */
-qi = (qi >> shift) * labs(ilsp[j-1] - wi);
-pi = (pi >> shift) << 14;
-qexp += shift;
+ if(m&1){
+ /* odd order filter; slightly assymetric */
+ /* the last coefficient */
+ qi=(qi>>shift)*labs(ilsp[j-1]-wi);
+ pi=(pi>>shift)<<14;
+ qexp+=shift;
-if(!(shift = MLOOP_1[(pi|qi)>>25]))
-if(!(shift = MLOOP_2[(pi|qi)>>19]))
-shift = MLOOP_3[(pi|qi)>>16];
+ if(!(shift=MLOOP_1[(pi|qi)>>25]))
+ if(!(shift=MLOOP_2[(pi|qi)>>19]))
+ shift=MLOOP_3[(pi|qi)>>16];
-pi >>= shift;
-qi >>= shift;
-qexp += shift - 14 * ((m + 1) >> 1);
+ pi>>=shift;
+ qi>>=shift;
+ qexp+=shift-14*((m+1)>>1);
-pi = ((pi * pi) >> 16);
-qi = ((qi * qi) >> 16);
-qexp = qexp * 2 + m;
+ pi=((pi*pi)>>16);
+ qi=((qi*qi)>>16);
+ qexp=qexp*2+m;
-pi *= (1 << 14) - ((wi * wi) >> 14);
-qi += pi >> 14;
+ pi*=(1<<14)-((wi*wi)>>14);
+ qi+=pi>>14;
-}
-else
-{
-/* even order filter; still symmetric */
+ }else{
+ /* even order filter; still symmetric */
-/* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
-worth tracking step by step */
+ /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
+ worth tracking step by step */
-pi >>= shift;
-qi >>= shift;
-qexp += shift - 7 * m;
+ pi>>=shift;
+ qi>>=shift;
+ qexp+=shift-7*m;
-pi = ((pi * pi) >> 16);
-qi = ((qi * qi) >> 16);
-qexp = qexp * 2 + m;
+ pi=((pi*pi)>>16);
+ qi=((qi*qi)>>16);
+ qexp=qexp*2+m;
-pi *= (1 << 14) - wi;
-qi *= (1 << 14) + wi;
-qi = (qi + pi) >> 14;
+ pi*=(1<<14)-wi;
+ qi*=(1<<14)+wi;
+ qi=(qi+pi)>>14;
-}
+ }
-/* we've let the normalization drift because it wasn't important;
- however, for the lookup, things must be normalized again. We
- need at most one right shift or a number of left shifts */
+ /* we've let the normalization drift because it wasn't important;
+ however, for the lookup, things must be normalized again. We
+ need at most one right shift or a number of left shifts */
-if(qi & 0xffff0000) /* checks for 1.xxxxxxxxxxxxxxxx */
-{
- qi >>= 1;
- qexp++;
-}
-else
- while(qi && !(qi & 0x8000)) /* checks for 0.0xxxxxxxxxxxxxxx or less*/
- {
- qi <<= 1;
- qexp--;
- }
+ if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
+ qi>>=1; qexp++;
+ }else
+ while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
+ qi<<=1; qexp--;
+ }
-amp = vorbis_fromdBlook_i(ampi* /* n.4 */
- vorbis_invsqlook_i(qi, qexp) -
- /* m.8, m+n<=8 */
- ampoffseti); /* 8.12[0] */
+ amp=vorbis_fromdBlook_i(ampi* /* n.4 */
+ vorbis_invsqlook_i(qi,qexp)-
+ /* m.8, m+n<=8 */
+ ampoffseti); /* 8.12[0] */
- curve[i] *= amp;
- while(map[++i] == k)curve[i] *= amp;
- }
- }
+ curve[i]*=amp;
+ while(map[++i]==k)curve[i]*=amp;
+ }
+}
#else
/* old, nonoptimized but simple version for any poor sap who needs to
-figure out what the hell this code does, or wants the other
-fraction of a dB precision */
+ figure out what the hell this code does, or wants the other
+ fraction of a dB precision */
/* side effect: changes *lsp to cosines of lsp */
-void vorbis_lsp_to_curve(float *curve, int *map, int n, int ln, float *lsp, int m,
-float amp, float ampoffset)
-{
-int i;
-float wdel = M_PI / ln;
-for(i = 0; i < m; i++)lsp[i] = 2.f * cos(lsp[i]);
-
-i = 0;
-while(i < n)
-{
-int j, k = map[i];
-float p = .5f;
-float q = .5f;
-float w = 2.f * cos(wdel * k);
-for(j = 1; j < m; j += 2)
-{
-q *= w - lsp[j-1];
-p *= w - lsp[j];
-}
-if(j == m)
-{
-/* odd order filter; slightly assymetric */
-/* the last coefficient */
-q *= w - lsp[j-1];
-p *= p * (4.f - w * w);
-q *= q;
-}
-else
-{
-/* even order filter; still symmetric */
-p *= p * (2.f - w);
-q *= q * (2.f + w);
-}
+void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
+ float amp,float ampoffset){
+ int i;
+ float wdel=M_PI/ln;
+ for(i=0;i<m;i++)lsp[i]=2.f*cos(lsp[i]);
+
+ i=0;
+ while(i<n){
+ int j,k=map[i];
+ float p=.5f;
+ float q=.5f;
+ float w=2.f*cos(wdel*k);
+ for(j=1;j<m;j+=2){
+ q *= w-lsp[j-1];
+ p *= w-lsp[j];
+ }
+ if(j==m){
+ /* odd order filter; slightly assymetric */
+ /* the last coefficient */
+ q*=w-lsp[j-1];
+ p*=p*(4.f-w*w);
+ q*=q;
+ }else{
+ /* even order filter; still symmetric */
+ p*=p*(2.f-w);
+ q*=q*(2.f+w);
+ }
-q = fromdB(amp / sqrt(p + q) - ampoffset);
+ q=fromdB(amp/sqrt(p+q)-ampoffset);
-curve[i] *= q;
-while(map[++i] == k)curve[i] *= q;
-}
+ curve[i]*=q;
+ while(map[++i]==k)curve[i]*=q;
+ }
}
#endif
#endif
-static void cheby(float *g, int ord)
-{
-int i, j;
-
-g[0] *= .5f;
-for(i = 2; i <= ord; i++)
-{
-for(j = ord; j >= i; j--)
-{
-g[j-2] -= g[j];
-g[j] += g[j];
-}
-}
+static void cheby(float *g, int ord) {
+ int i, j;
+
+ g[0] *= .5f;
+ for(i=2; i<= ord; i++) {
+ for(j=ord; j >= i; j--) {
+ g[j-2] -= g[j];
+ g[j] += g[j];
+ }
+ }
}
-static int comp(const void *a, const void *b)
-{
-return (*(float *)a < *(float *)b) - (*(float *)a > *(float *)b);
+static int comp(const void *a,const void *b){
+ return (*(float *)a<*(float *)b)-(*(float *)a>*(float *)b);
}
/* Newton-Raphson-Maehly actually functioned as a decent root finder,
-but there are root sets for which it gets into limit cycles
-(exacerbated by zero suppression) and fails. We can't afford to
-fail, even if the failure is 1 in 100,000,000, so we now use
-Laguerre and later polish with Newton-Raphson (which can then
- afford to fail) */
+ but there are root sets for which it gets into limit cycles
+ (exacerbated by zero suppression) and fails. We can't afford to
+ fail, even if the failure is 1 in 100,000,000, so we now use
+ Laguerre and later polish with Newton-Raphson (which can then
+ afford to fail) */
#define EPSILON 10e-7
- static int Laguerre_With_Deflation(float *a, int ord, float *r)
-{
- int i, m;
- double lastdelta = 0.f;
- double *defl = alloca(sizeof(*defl) * (ord + 1));
- for(i = 0; i <= ord; i++)defl[i] = a[i];
-
- for(m = ord; m > 0; m--)
- {
- double new = 0.f, delta;
-
- /* iterate a root */
- while(1)
- {
- double p = defl[m], pp = 0.f, ppp = 0.f, denom;
-
- /* eval the polynomial and its first two derivatives */
- for(i = m; i > 0; i--)
- {
- ppp = new*ppp + pp;
- pp = new*pp + p;
- p = new*p + defl[i-1];
- }
-
- /* Laguerre's method */
- denom = (m - 1) * ((m - 1) * pp * pp - m * p * ppp);
- if(denom < 0)
- return(-1); /* complex root! The LPC generator handed us a bad filter */
-
- if(pp > 0)
- {
- denom = pp + sqrt(denom);
- if(denom < EPSILON)denom = EPSILON;
- }
- else
- {
- denom = pp - sqrt(denom);
- if(denom > -(EPSILON))denom = -(EPSILON);
- }
-
- delta = m * p / denom;
- new -= delta;
-
- if(delta < 0.f)delta *= -1;
-
- if(fabs(delta / new) < 10e-12)break;
- lastdelta = delta;
- }
-
- r[m-1] = new;
-
- /* forward deflation */
-
- for(i = m; i > 0; i--)
- defl[i-1] += new*defl[i];
- defl++;
-
+static int Laguerre_With_Deflation(float *a,int ord,float *r){
+ int i,m;
+ double lastdelta=0.f;
+ double *defl=alloca(sizeof(*defl)*(ord+1));
+ for(i=0;i<=ord;i++)defl[i]=a[i];
+
+ for(m=ord;m>0;m--){
+ double new=0.f,delta;
+
+ /* iterate a root */
+ while(1){
+ double p=defl[m],pp=0.f,ppp=0.f,denom;
+
+ /* eval the polynomial and its first two derivatives */
+ for(i=m;i>0;i--){
+ ppp = new*ppp + pp;
+ pp = new*pp + p;
+ p = new*p + defl[i-1];
+ }
+
+ /* Laguerre's method */
+ denom=(m-1) * ((m-1)*pp*pp - m*p*ppp);
+ if(denom<0)
+ return(-1); /* complex root! The LPC generator handed us a bad filter */
+
+ if(pp>0){
+ denom = pp + sqrt(denom);
+ if(denom<EPSILON)denom=EPSILON;
+ }else{
+ denom = pp - sqrt(denom);
+ if(denom>-(EPSILON))denom=-(EPSILON);
+ }
+
+ delta = m*p/denom;
+ new -= delta;
+
+ if(delta<0.f)delta*=-1;
+
+ if(fabs(delta/new)<10e-12)break;
+ lastdelta=delta;
}
- return(0);
+
+ r[m-1]=new;
+
+ /* forward deflation */
+
+ for(i=m;i>0;i--)
+ defl[i-1]+=new*defl[i];
+ defl++;
+
+ }
+ return(0);
}
/* for spit-and-polish only */
-static int Newton_Raphson(float *a, int ord, float *r)
-{
- int i, k, count = 0;
- double error = 1.f;
- double *root = alloca(ord * sizeof(*root));
-
- for(i = 0; i < ord; i++) root[i] = r[i];
-
- while(error > 1e-20)
- {
- error = 0;
-
- for(i = 0; i < ord; i++) /* Update each point. */
- {
- double pp = 0., delta;
- double rooti = root[i];
- double p = a[ord];
- for(k = ord - 1; k >= 0; k--)
- {
-
- pp = pp * rooti + p;
- p = p * rooti + a[k];
- }
-
- delta = p / pp;
- root[i] -= delta;
- error += delta * delta;
- }
-
- if(count > 40)return(-1);
-
- count++;
- }
+static int Newton_Raphson(float *a,int ord,float *r){
+ int i, k, count=0;
+ double error=1.f;
+ double *root=alloca(ord*sizeof(*root));
- /* Replaced the original bubble sort with a real sort. With your
- help, we can eliminate the bubble sort in our lifetime. --Monty */
+ for(i=0; i<ord;i++) root[i] = r[i];
- for(i = 0; i < ord; i++) r[i] = root[i];
- return(0);
-}
+ while(error>1e-20){
+ error=0;
+ for(i=0; i<ord; i++) { /* Update each point. */
+ double pp=0.,delta;
+ double rooti=root[i];
+ double p=a[ord];
+ for(k=ord-1; k>= 0; k--) {
-/* Convert lpc coefficients to lsp coefficients */
-int vorbis_lpc_to_lsp(float *lpc, float *lsp, int m)
-{
- int order2 = (m + 1) >> 1;
- int g1_order, g2_order;
- float *g1 = alloca(sizeof(*g1) * (order2 + 1));
- float *g2 = alloca(sizeof(*g2) * (order2 + 1));
- float *g1r = alloca(sizeof(*g1r) * (order2 + 1));
- float *g2r = alloca(sizeof(*g2r) * (order2 + 1));
- int i;
-
- /* even and odd are slightly different base cases */
- g1_order = (m + 1) >> 1;
- g2_order = (m) >> 1;
-
- /* Compute the lengths of the x polynomials. */
- /* Compute the first half of K & R F1 & F2 polynomials. */
- /* Compute half of the symmetric and antisymmetric polynomials. */
- /* Remove the roots at +1 and -1. */
-
- g1[g1_order] = 1.f;
- for(i = 1; i <= g1_order; i++) g1[g1_order-i] = lpc[i-1] + lpc[m-i];
- g2[g2_order] = 1.f;
- for(i = 1; i <= g2_order; i++) g2[g2_order-i] = lpc[i-1] - lpc[m-i];
-
- if(g1_order > g2_order)
- {
- for(i = 2; i <= g2_order; i++) g2[g2_order-i] += g2[g2_order-i+2];
- }
- else
- {
- for(i = 1; i <= g1_order; i++) g1[g1_order-i] -= g1[g1_order-i+1];
- for(i = 1; i <= g2_order; i++) g2[g2_order-i] += g2[g2_order-i+1];
+ pp= pp* rooti + p;
+ p = p * rooti + a[k];
+ }
+
+ delta = p/pp;
+ root[i] -= delta;
+ error+= delta*delta;
}
- /* Convert into polynomials in cos(alpha) */
- cheby(g1, g1_order);
- cheby(g2, g2_order);
+ if(count>40)return(-1);
- /* Find the roots of the 2 even polynomials.*/
- if(Laguerre_With_Deflation(g1, g1_order, g1r) ||
- Laguerre_With_Deflation(g2, g2_order, g2r))
- return(-1);
+ count++;
+ }
- Newton_Raphson(g1, g1_order, g1r); /* if it fails, it leaves g1r alone */
- Newton_Raphson(g2, g2_order, g2r); /* if it fails, it leaves g2r alone */
+ /* Replaced the original bubble sort with a real sort. With your
+ help, we can eliminate the bubble sort in our lifetime. --Monty */
- qsort(g1r, g1_order, sizeof(*g1r), comp);
- qsort(g2r, g2_order, sizeof(*g2r), comp);
+ for(i=0; i<ord;i++) r[i] = root[i];
+ return(0);
+}
- for(i = 0; i < g1_order; i++)
- lsp[i*2] = acos(g1r[i]);
- for(i = 0; i < g2_order; i++)
- lsp[i*2+1] = acos(g2r[i]);
- return(0);
+/* Convert lpc coefficients to lsp coefficients */
+int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){
+ int order2=(m+1)>>1;
+ int g1_order,g2_order;
+ float *g1=alloca(sizeof(*g1)*(order2+1));
+ float *g2=alloca(sizeof(*g2)*(order2+1));
+ float *g1r=alloca(sizeof(*g1r)*(order2+1));
+ float *g2r=alloca(sizeof(*g2r)*(order2+1));
+ int i;
+
+ /* even and odd are slightly different base cases */
+ g1_order=(m+1)>>1;
+ g2_order=(m) >>1;
+
+ /* Compute the lengths of the x polynomials. */
+ /* Compute the first half of K & R F1 & F2 polynomials. */
+ /* Compute half of the symmetric and antisymmetric polynomials. */
+ /* Remove the roots at +1 and -1. */
+
+ g1[g1_order] = 1.f;
+ for(i=1;i<=g1_order;i++) g1[g1_order-i] = lpc[i-1]+lpc[m-i];
+ g2[g2_order] = 1.f;
+ for(i=1;i<=g2_order;i++) g2[g2_order-i] = lpc[i-1]-lpc[m-i];
+
+ if(g1_order>g2_order){
+ for(i=2; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+2];
+ }else{
+ for(i=1; i<=g1_order;i++) g1[g1_order-i] -= g1[g1_order-i+1];
+ for(i=1; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+1];
+ }
+
+ /* Convert into polynomials in cos(alpha) */
+ cheby(g1,g1_order);
+ cheby(g2,g2_order);
+
+ /* Find the roots of the 2 even polynomials.*/
+ if(Laguerre_With_Deflation(g1,g1_order,g1r) ||
+ Laguerre_With_Deflation(g2,g2_order,g2r))
+ return(-1);
+
+ Newton_Raphson(g1,g1_order,g1r); /* if it fails, it leaves g1r alone */
+ Newton_Raphson(g2,g2_order,g2r); /* if it fails, it leaves g2r alone */
+
+ qsort(g1r,g1_order,sizeof(*g1r),comp);
+ qsort(g2r,g2_order,sizeof(*g2r),comp);
+
+ for(i=0;i<g1_order;i++)
+ lsp[i*2] = acos(g1r[i]);
+
+ for(i=0;i<g2_order;i++)
+ lsp[i*2+1] = acos(g2r[i]);
+ return(0);
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.h b/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.h
index a3fdf88a2..bacfb0971 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/lsp.h
@@ -19,10 +19,10 @@
#ifndef _V_LSP_H_
#define _V_LSP_H_
-extern int vorbis_lpc_to_lsp(float *lpc, float *lsp, int m);
+extern int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m);
-extern void vorbis_lsp_to_curve(float *curve, int *map, int n, int ln,
- float *lsp, int m,
- float amp, float ampoffset);
+extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,
+ float *lsp,int m,
+ float amp,float ampoffset);
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/mapping0.c b/src/filters/transform/MpaDecFilter/libvorbisidec/mapping0.c
index affd4f614..716fa4cd8 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/mapping0.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/mapping0.c
@@ -37,141 +37,121 @@
blocksize is set by the mode, and low backend lookups may require
parameters from other areas of the mode/mapping */
-static void mapping0_free_info(vorbis_info_mapping *i)
-{
- vorbis_info_mapping0 *info = (vorbis_info_mapping0 *)i;
- if(info)
- {
- memset(info, 0, sizeof(*info));
- _ogg_free(info);
- }
+static void mapping0_free_info(vorbis_info_mapping *i){
+ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
+ if(info){
+ memset(info,0,sizeof(*info));
+ _ogg_free(info);
+ }
}
-static int ilog(unsigned int v)
-{
- int ret = 0;
- if(v)--v;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog(unsigned int v){
+ int ret=0;
+ if(v)--v;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-static void mapping0_pack(vorbis_info *vi, vorbis_info_mapping *vm,
- oggpack_buffer *opb)
-{
- int i;
- vorbis_info_mapping0 *info = (vorbis_info_mapping0 *)vm;
-
- /* another 'we meant to do it this way' hack... up to beta 4, we
- packed 4 binary zeros here to signify one submapping in use. We
- now redefine that to mean four bitflags that indicate use of
- deeper features; bit0:submappings, bit1:coupling,
- bit2,3:reserved. This is backward compatable with all actual uses
- of the beta code. */
-
- if(info->submaps > 1)
- {
- oggpack_write(opb, 1, 1);
- oggpack_write(opb, info->submaps - 1, 4);
- }
- else
- oggpack_write(opb, 0, 1);
-
- if(info->coupling_steps > 0)
- {
- oggpack_write(opb, 1, 1);
- oggpack_write(opb, info->coupling_steps - 1, 8);
-
- for(i = 0; i < info->coupling_steps; i++)
- {
- oggpack_write(opb, info->coupling_mag[i], ilog(vi->channels));
- oggpack_write(opb, info->coupling_ang[i], ilog(vi->channels));
- }
- }
- else
- oggpack_write(opb, 0, 1);
-
- oggpack_write(opb, 0, 2); /* 2,3:reserved */
-
- /* we don't write the channel submappings if we only have one... */
- if(info->submaps > 1)
- {
- for(i = 0; i < vi->channels; i++)
- oggpack_write(opb, info->chmuxlist[i], 4);
- }
- for(i = 0; i < info->submaps; i++)
- {
- oggpack_write(opb, 0, 8); /* time submap unused */
- oggpack_write(opb, info->floorsubmap[i], 8);
- oggpack_write(opb, info->residuesubmap[i], 8);
+static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
+ oggpack_buffer *opb){
+ int i;
+ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
+
+ /* another 'we meant to do it this way' hack... up to beta 4, we
+ packed 4 binary zeros here to signify one submapping in use. We
+ now redefine that to mean four bitflags that indicate use of
+ deeper features; bit0:submappings, bit1:coupling,
+ bit2,3:reserved. This is backward compatable with all actual uses
+ of the beta code. */
+
+ if(info->submaps>1){
+ oggpack_write(opb,1,1);
+ oggpack_write(opb,info->submaps-1,4);
+ }else
+ oggpack_write(opb,0,1);
+
+ if(info->coupling_steps>0){
+ oggpack_write(opb,1,1);
+ oggpack_write(opb,info->coupling_steps-1,8);
+
+ for(i=0;i<info->coupling_steps;i++){
+ oggpack_write(opb,info->coupling_mag[i],ilog(vi->channels));
+ oggpack_write(opb,info->coupling_ang[i],ilog(vi->channels));
}
+ }else
+ oggpack_write(opb,0,1);
+
+ oggpack_write(opb,0,2); /* 2,3:reserved */
+
+ /* we don't write the channel submappings if we only have one... */
+ if(info->submaps>1){
+ for(i=0;i<vi->channels;i++)
+ oggpack_write(opb,info->chmuxlist[i],4);
+ }
+ for(i=0;i<info->submaps;i++){
+ oggpack_write(opb,0,8); /* time submap unused */
+ oggpack_write(opb,info->floorsubmap[i],8);
+ oggpack_write(opb,info->residuesubmap[i],8);
+ }
}
/* also responsible for range checking */
-static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi, oggpack_buffer *opb)
-{
- int i, b;
- vorbis_info_mapping0 *info = _ogg_calloc(1, sizeof(*info));
- codec_setup_info *ci = vi->codec_setup;
- memset(info, 0, sizeof(*info));
-
- b = oggpack_read(opb, 1);
- if(b < 0)goto err_out;
- if(b)
- {
- info->submaps = oggpack_read(opb, 4) + 1;
- if(info->submaps <= 0)goto err_out;
+static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
+ int i,b;
+ vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));
+ codec_setup_info *ci=vi->codec_setup;
+ memset(info,0,sizeof(*info));
+
+ b=oggpack_read(opb,1);
+ if(b<0)goto err_out;
+ if(b){
+ info->submaps=oggpack_read(opb,4)+1;
+ if(info->submaps<=0)goto err_out;
+ }else
+ info->submaps=1;
+
+ b=oggpack_read(opb,1);
+ if(b<0)goto err_out;
+ if(b){
+ info->coupling_steps=oggpack_read(opb,8)+1;
+ if(info->coupling_steps<=0)goto err_out;
+ for(i=0;i<info->coupling_steps;i++){
+ int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
+ int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
+
+ if(testM<0 ||
+ testA<0 ||
+ testM==testA ||
+ testM>=vi->channels ||
+ testA>=vi->channels) goto err_out;
}
- else
- info->submaps = 1;
-
- b = oggpack_read(opb, 1);
- if(b < 0)goto err_out;
- if(b)
- {
- info->coupling_steps = oggpack_read(opb, 8) + 1;
- if(info->coupling_steps <= 0)goto err_out;
- for(i = 0; i < info->coupling_steps; i++)
- {
- int testM = info->coupling_mag[i] = oggpack_read(opb, ilog(vi->channels));
- int testA = info->coupling_ang[i] = oggpack_read(opb, ilog(vi->channels));
-
- if(testM < 0 ||
- testA < 0 ||
- testM == testA ||
- testM >= vi->channels ||
- testA >= vi->channels) goto err_out;
- }
- }
+ }
- if(oggpack_read(opb, 2) != 0)goto err_out; /* 2,3:reserved */
+ if(oggpack_read(opb,2)!=0)goto err_out; /* 2,3:reserved */
- if(info->submaps > 1)
- {
- for(i = 0; i < vi->channels; i++)
- {
- info->chmuxlist[i] = oggpack_read(opb, 4);
- if(info->chmuxlist[i] >= info->submaps || info->chmuxlist[i] < 0)goto err_out;
- }
- }
- for(i = 0; i < info->submaps; i++)
- {
- oggpack_read(opb, 8); /* time submap unused */
- info->floorsubmap[i] = oggpack_read(opb, 8);
- if(info->floorsubmap[i] >= ci->floors || info->floorsubmap[i] < 0)goto err_out;
- info->residuesubmap[i] = oggpack_read(opb, 8);
- if(info->residuesubmap[i] >= ci->residues || info->residuesubmap[i] < 0)goto err_out;
+ if(info->submaps>1){
+ for(i=0;i<vi->channels;i++){
+ info->chmuxlist[i]=oggpack_read(opb,4);
+ if(info->chmuxlist[i]>=info->submaps || info->chmuxlist[i]<0)goto err_out;
}
-
- return info;
-
-err_out:
- mapping0_free_info(info);
- return(NULL);
+ }
+ for(i=0;i<info->submaps;i++){
+ oggpack_read(opb,8); /* time submap unused */
+ info->floorsubmap[i]=oggpack_read(opb,8);
+ if(info->floorsubmap[i]>=ci->floors || info->floorsubmap[i]<0)goto err_out;
+ info->residuesubmap[i]=oggpack_read(opb,8);
+ if(info->residuesubmap[i]>=ci->residues || info->residuesubmap[i]<0)goto err_out;
+ }
+
+ return info;
+
+ err_out:
+ mapping0_free_info(info);
+ return(NULL);
}
#include "os.h"
@@ -183,116 +163,113 @@ err_out:
#include "scales.h"
#if 0
-static long seq = 0;
-static ogg_int64_t total = 0;
-static float FLOOR1_fromdB_LOOKUP[256] =
-{
- 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
- 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
- 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
- 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
- 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
- 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
- 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
- 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
- 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
- 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
- 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
- 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
- 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
- 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
- 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
- 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
- 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
- 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
- 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
- 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
- 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
- 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
- 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
- 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
- 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
- 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
- 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
- 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
- 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
- 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
- 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
- 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
- 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
- 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
- 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
- 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
- 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
- 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
- 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
- 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
- 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
- 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
- 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
- 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
- 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
- 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
- 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
- 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
- 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
- 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
- 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
- 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
- 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
- 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
- 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
- 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
- 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
- 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
- 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
- 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
- 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
- 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
- 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
- 0.82788260F, 0.88168307F, 0.9389798F, 1.F,
+static long seq=0;
+static ogg_int64_t total=0;
+static float FLOOR1_fromdB_LOOKUP[256]={
+ 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
+ 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
+ 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
+ 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
+ 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
+ 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
+ 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
+ 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
+ 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
+ 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
+ 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
+ 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
+ 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
+ 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
+ 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
+ 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
+ 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
+ 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
+ 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
+ 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
+ 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
+ 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
+ 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
+ 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
+ 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
+ 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
+ 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
+ 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
+ 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
+ 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
+ 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
+ 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
+ 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
+ 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
+ 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
+ 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
+ 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
+ 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
+ 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
+ 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
+ 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
+ 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
+ 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
+ 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
+ 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
+ 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
+ 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
+ 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
+ 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
+ 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
+ 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
+ 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
+ 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
+ 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
+ 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
+ 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
+ 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
+ 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
+ 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
+ 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
+ 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
+ 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
+ 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
+ 0.82788260F, 0.88168307F, 0.9389798F, 1.F,
};
#endif
-static int mapping0_forward(vorbis_block *vb)
-{
- vorbis_dsp_state *vd = vb->vd;
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- private_state *b = vb->vd->backend_state;
- vorbis_block_internal *vbi = (vorbis_block_internal *)vb->internal;
- int n = vb->pcmend;
- int i, j, k;
+static int mapping0_forward(vorbis_block *vb){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ private_state *b=vb->vd->backend_state;
+ vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
+ int n=vb->pcmend;
+ int i,j,k;
- int *nonzero = alloca(sizeof(*nonzero) * vi->channels);
- float **gmdct = _vorbis_block_alloc(vb, vi->channels * sizeof(*gmdct));
- int **ilogmaskch = _vorbis_block_alloc(vb, vi->channels * sizeof(*ilogmaskch));
- int ***floor_posts = _vorbis_block_alloc(vb, vi->channels * sizeof(*floor_posts));
+ int *nonzero = alloca(sizeof(*nonzero)*vi->channels);
+ float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
+ int **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch));
+ int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
- float global_ampmax = vbi->ampmax;
- float *local_ampmax = alloca(sizeof(*local_ampmax) * vi->channels);
- int blocktype = vbi->blocktype;
+ float global_ampmax=vbi->ampmax;
+ float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels);
+ int blocktype=vbi->blocktype;
- int modenumber = vb->W;
- vorbis_info_mapping0 *info = ci->map_param[modenumber];
- vorbis_look_psy *psy_look =
- b->psy + blocktype + (vb->W ? 2 : 0);
+ int modenumber=vb->W;
+ vorbis_info_mapping0 *info=ci->map_param[modenumber];
+ vorbis_look_psy *psy_look=
+ b->psy+blocktype+(vb->W?2:0);
- vb->mode = modenumber;
+ vb->mode=modenumber;
- for(i = 0; i < vi->channels; i++)
- {
- float scale = 4.f / n;
- float scale_dB;
+ for(i=0;i<vi->channels;i++){
+ float scale=4.f/n;
+ float scale_dB;
- float *pcm = vb->pcm[i];
- float *logfft = pcm;
+ float *pcm =vb->pcm[i];
+ float *logfft =pcm;
- gmdct[i] = _vorbis_block_alloc(vb, n / 2 * sizeof(**gmdct));
+ gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
- scale_dB = todB(&scale) + .345; /* + .345 is a hack; the original
+ scale_dB=todB(&scale) + .345; /* + .345 is a hack; the original
todB estimation used on IEEE 754
compliant machines had a bug that
returned dB values about a third
@@ -308,43 +285,37 @@ static int mapping0_forward(vorbis_block *vb)
next major model upgrade. */
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("pcmL", seq, pcm, n, 0, 0, total - n / 2);
- else
- _analysis_output("pcmR", seq, pcm, n, 0, 0, total - n / 2);
- }
- else
- {
- _analysis_output("pcm", seq, pcm, n, 0, 0, total - n / 2);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
+ else
+ _analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
+ }else{
+ _analysis_output("pcm",seq,pcm,n,0,0,total-n/2);
+ }
#endif
- /* window the PCM data */
- _vorbis_apply_window(pcm, b->window, ci->blocksizes, vb->lW, vb->W, vb->nW);
+ /* window the PCM data */
+ _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("windowedL", seq, pcm, n, 0, 0, total - n / 2);
- else
- _analysis_output("windowedR", seq, pcm, n, 0, 0, total - n / 2);
- }
- else
- {
- _analysis_output("windowed", seq, pcm, n, 0, 0, total - n / 2);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
+ else
+ _analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
+ }else{
+ _analysis_output("windowed",seq,pcm,n,0,0,total-n/2);
+ }
#endif
- /* transform the PCM data */
- /* only MDCT right now.... */
- mdct_forward(b->transform[vb->W][0], pcm, gmdct[i]);
+ /* transform the PCM data */
+ /* only MDCT right now.... */
+ mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]);
- /* FFT yields more accurate tonal estimation (not phase sensitive) */
- drft_forward(&b->fft_look[vb->W], pcm);
- logfft[0] = scale_dB + todB(pcm) + .345; /* + .345 is a hack; the
+ /* FFT yields more accurate tonal estimation (not phase sensitive) */
+ drft_forward(&b->fft_look[vb->W],pcm);
+ logfft[0]=scale_dB+todB(pcm) + .345; /* + .345 is a hack; the
original todB estimation used on
IEEE 754 compliant machines had a
bug that returned dB values about
@@ -358,11 +329,10 @@ static int mapping0_forward(vorbis_block *vb)
things back up here, and
recalibrate the tunings in the
next major model upgrade. */
- local_ampmax[i] = logfft[0];
- for(j = 1; j < n - 1; j += 2)
- {
- float temp = pcm[j] * pcm[j] + pcm[j+1] * pcm[j+1];
- temp = logfft[(j+1)>>1] = scale_dB + .5f * todB(&temp) + .345; /* +
+ local_ampmax[i]=logfft[0];
+ for(j=1;j<n-1;j+=2){
+ float temp=pcm[j]*pcm[j]+pcm[j+1]*pcm[j+1];
+ temp=logfft[(j+1)>>1]=scale_dB+.5f*todB(&temp) + .345; /* +
.345 is a hack; the original todB
estimation used on IEEE 754
compliant machines had a bug that
@@ -377,57 +347,50 @@ static int mapping0_forward(vorbis_block *vb)
things back up here, and
recalibrate the tunings in the
next major model upgrade. */
- if(temp > local_ampmax[i])local_ampmax[i] = temp;
- }
+ if(temp>local_ampmax[i])local_ampmax[i]=temp;
+ }
- if(local_ampmax[i] > 0.f)local_ampmax[i] = 0.f;
- if(local_ampmax[i] > global_ampmax)global_ampmax = local_ampmax[i];
+ if(local_ampmax[i]>0.f)local_ampmax[i]=0.f;
+ if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i];
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- {
- _analysis_output("fftL", seq, logfft, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("fftR", seq, logfft, n / 2, 1, 0, 0);
- }
- }
- else
- {
- _analysis_output("fft", seq, logfft, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0){
+ _analysis_output("fftL",seq,logfft,n/2,1,0,0);
+ }else{
+ _analysis_output("fftR",seq,logfft,n/2,1,0,0);
+ }
+ }else{
+ _analysis_output("fft",seq,logfft,n/2,1,0,0);
+ }
#endif
- }
+ }
- {
- float *noise = _vorbis_block_alloc(vb, n / 2 * sizeof(*noise));
- float *tone = _vorbis_block_alloc(vb, n / 2 * sizeof(*tone));
+ {
+ float *noise = _vorbis_block_alloc(vb,n/2*sizeof(*noise));
+ float *tone = _vorbis_block_alloc(vb,n/2*sizeof(*tone));
- for(i = 0; i < vi->channels; i++)
- {
- /* the encoder setup assumes that all the modes used by any
- specific bitrate tweaking use the same floor */
+ for(i=0;i<vi->channels;i++){
+ /* the encoder setup assumes that all the modes used by any
+ specific bitrate tweaking use the same floor */
- int submap = info->chmuxlist[i];
+ int submap=info->chmuxlist[i];
- /* the following makes things clearer to *me* anyway */
- float *mdct = gmdct[i];
- float *logfft = vb->pcm[i];
+ /* the following makes things clearer to *me* anyway */
+ float *mdct =gmdct[i];
+ float *logfft =vb->pcm[i];
- float *logmdct = logfft + n / 2;
- float *logmask = logfft;
+ float *logmdct =logfft+n/2;
+ float *logmask =logfft;
- vb->mode = modenumber;
+ vb->mode=modenumber;
- floor_posts[i] = _vorbis_block_alloc(vb, PACKETBLOBS * sizeof(**floor_posts));
- memset(floor_posts[i], 0, sizeof(**floor_posts)*PACKETBLOBS);
+ floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts));
+ memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
- for(j = 0; j < n / 2; j++)
- logmdct[j] = todB(mdct + j) + .345; /* + .345 is a hack; the original
+ for(j=0;j<n/2;j++)
+ logmdct[j]=todB(mdct+j) + .345; /* + .345 is a hack; the original
todB estimation used on IEEE 754
compliant machines had a bug that
returned dB values about a third
@@ -443,510 +406,461 @@ static int mapping0_forward(vorbis_block *vb)
next major model upgrade. */
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("mdctL", seq, logmdct, n / 2, 1, 0, 0);
- else
- _analysis_output("mdctR", seq, logmdct, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("mdct", seq, logmdct, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
+ else
+ _analysis_output("mdctR",seq,logmdct,n/2,1,0,0);
+ }else{
+ _analysis_output("mdct",seq,logmdct,n/2,1,0,0);
+ }
#endif
- /* first step; noise masking. Not only does 'noise masking'
- give us curves from which we can decide how much resolution
- to give noise parts of the spectrum, it also implicitly hands
- us a tonality estimate (the larger the value in the
- 'noise_depth' vector, the more tonal that area is) */
+ /* first step; noise masking. Not only does 'noise masking'
+ give us curves from which we can decide how much resolution
+ to give noise parts of the spectrum, it also implicitly hands
+ us a tonality estimate (the larger the value in the
+ 'noise_depth' vector, the more tonal that area is) */
- _vp_noisemask(psy_look,
- logmdct,
- noise); /* noise does not have by-frequency offset
+ _vp_noisemask(psy_look,
+ logmdct,
+ noise); /* noise does not have by-frequency offset
bias applied yet */
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("noiseL", seq, noise, n / 2, 1, 0, 0);
- else
- _analysis_output("noiseR", seq, noise, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("noise", seq, noise, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("noiseL",seq,noise,n/2,1,0,0);
+ else
+ _analysis_output("noiseR",seq,noise,n/2,1,0,0);
+ }else{
+ _analysis_output("noise",seq,noise,n/2,1,0,0);
+ }
#endif
- /* second step: 'all the other crap'; all the stuff that isn't
- computed/fit for bitrate management goes in the second psy
- vector. This includes tone masking, peak limiting and ATH */
+ /* second step: 'all the other crap'; all the stuff that isn't
+ computed/fit for bitrate management goes in the second psy
+ vector. This includes tone masking, peak limiting and ATH */
- _vp_tonemask(psy_look,
- logfft,
- tone,
- global_ampmax,
- local_ampmax[i]);
+ _vp_tonemask(psy_look,
+ logfft,
+ tone,
+ global_ampmax,
+ local_ampmax[i]);
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("toneL", seq, tone, n / 2, 1, 0, 0);
- else
- _analysis_output("toneR", seq, tone, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("tone", seq, tone, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("toneL",seq,tone,n/2,1,0,0);
+ else
+ _analysis_output("toneR",seq,tone,n/2,1,0,0);
+ }else{
+ _analysis_output("tone",seq,tone,n/2,1,0,0);
+ }
#endif
- /* third step; we offset the noise vectors, overlay tone
- masking. We then do a floor1-specific line fit. If we're
- performing bitrate management, the line fit is performed
- multiple times for up/down tweakage on demand. */
+ /* third step; we offset the noise vectors, overlay tone
+ masking. We then do a floor1-specific line fit. If we're
+ performing bitrate management, the line fit is performed
+ multiple times for up/down tweakage on demand. */
#if 0
- {
- float aotuv[psy_look->n];
+ {
+ float aotuv[psy_look->n];
#endif
- _vp_offset_and_mix(psy_look,
- noise,
- tone,
- 1,
- logmask,
- mdct,
- logmdct);
+ _vp_offset_and_mix(psy_look,
+ noise,
+ tone,
+ 1,
+ logmask,
+ mdct,
+ logmdct);
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("aotuvM1_L", seq, aotuv, psy_look->n, 1, 1, 0);
- else
- _analysis_output("aotuvM1_R", seq, aotuv, psy_look->n, 1, 1, 0);
- }
- else
- {
- _analysis_output("aotuvM1", seq, aotuv, psy_look->n, 1, 1, 0);
- }
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0);
+ else
+ _analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0);
+ }else{
+ _analysis_output("aotuvM1",seq,aotuv,psy_look->n,1,1,0);
+ }
+ }
#endif
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("mask1L", seq, logmask, n / 2, 1, 0, 0);
- else
- _analysis_output("mask1R", seq, logmask, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("mask1", seq, logmask, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("mask1L",seq,logmask,n/2,1,0,0);
+ else
+ _analysis_output("mask1R",seq,logmask,n/2,1,0,0);
+ }else{
+ _analysis_output("mask1",seq,logmask,n/2,1,0,0);
+ }
#endif
- /* this algorithm is hardwired to floor 1 for now; abort out if
- we're *not* floor1. This won't happen unless someone has
- broken the encode setup lib. Guard it anyway. */
- if(ci->floor_type[info->floorsubmap[submap]] != 1)return(-1);
-
- floor_posts[i][PACKETBLOBS/2] =
- floor1_fit(vb, b->flr[info->floorsubmap[submap]],
- logmdct,
- logmask);
-
- /* are we managing bitrate? If so, perform two more fits for
- later rate tweaking (fits represent hi/lo) */
- if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2])
- {
- /* higher rate by way of lower noise curve */
-
- _vp_offset_and_mix(psy_look,
- noise,
- tone,
- 2,
- logmask,
- mdct,
- logmdct);
+ /* this algorithm is hardwired to floor 1 for now; abort out if
+ we're *not* floor1. This won't happen unless someone has
+ broken the encode setup lib. Guard it anyway. */
+ if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1);
+
+ floor_posts[i][PACKETBLOBS/2]=
+ floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+ logmdct,
+ logmask);
+
+ /* are we managing bitrate? If so, perform two more fits for
+ later rate tweaking (fits represent hi/lo) */
+ if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
+ /* higher rate by way of lower noise curve */
+
+ _vp_offset_and_mix(psy_look,
+ noise,
+ tone,
+ 2,
+ logmask,
+ mdct,
+ logmdct);
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("mask2L", seq, logmask, n / 2, 1, 0, 0);
- else
- _analysis_output("mask2R", seq, logmask, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("mask2", seq, logmask, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("mask2L",seq,logmask,n/2,1,0,0);
+ else
+ _analysis_output("mask2R",seq,logmask,n/2,1,0,0);
+ }else{
+ _analysis_output("mask2",seq,logmask,n/2,1,0,0);
+ }
#endif
- floor_posts[i][PACKETBLOBS-1] =
- floor1_fit(vb, b->flr[info->floorsubmap[submap]],
- logmdct,
- logmask);
+ floor_posts[i][PACKETBLOBS-1]=
+ floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+ logmdct,
+ logmask);
- /* lower rate by way of higher noise curve */
- _vp_offset_and_mix(psy_look,
- noise,
- tone,
- 0,
- logmask,
- mdct,
- logmdct);
+ /* lower rate by way of higher noise curve */
+ _vp_offset_and_mix(psy_look,
+ noise,
+ tone,
+ 0,
+ logmask,
+ mdct,
+ logmdct);
#if 0
- if(vi->channels == 2)
- {
- if(i == 0)
- _analysis_output("mask0L", seq, logmask, n / 2, 1, 0, 0);
- else
- _analysis_output("mask0R", seq, logmask, n / 2, 1, 0, 0);
- }
- else
- {
- _analysis_output("mask0", seq, logmask, n / 2, 1, 0, 0);
- }
+ if(vi->channels==2){
+ if(i==0)
+ _analysis_output("mask0L",seq,logmask,n/2,1,0,0);
+ else
+ _analysis_output("mask0R",seq,logmask,n/2,1,0,0);
+ }else{
+ _analysis_output("mask0",seq,logmask,n/2,1,0,0);
+ }
#endif
- floor_posts[i][0] =
- floor1_fit(vb, b->flr[info->floorsubmap[submap]],
- logmdct,
- logmask);
-
- /* we also interpolate a range of intermediate curves for
- intermediate rates */
- for(k = 1; k < PACKETBLOBS / 2; k++)
- floor_posts[i][k] =
- floor1_interpolate_fit(vb, b->flr[info->floorsubmap[submap]],
- floor_posts[i][0],
- floor_posts[i][PACKETBLOBS/2],
- k * 65536 / (PACKETBLOBS / 2));
- for(k = PACKETBLOBS / 2 + 1; k < PACKETBLOBS - 1; k++)
- floor_posts[i][k] =
- floor1_interpolate_fit(vb, b->flr[info->floorsubmap[submap]],
- floor_posts[i][PACKETBLOBS/2],
- floor_posts[i][PACKETBLOBS-1],
- (k - PACKETBLOBS / 2) * 65536 / (PACKETBLOBS / 2));
- }
- }
+ floor_posts[i][0]=
+ floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+ logmdct,
+ logmask);
+
+ /* we also interpolate a range of intermediate curves for
+ intermediate rates */
+ for(k=1;k<PACKETBLOBS/2;k++)
+ floor_posts[i][k]=
+ floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
+ floor_posts[i][0],
+ floor_posts[i][PACKETBLOBS/2],
+ k*65536/(PACKETBLOBS/2));
+ for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
+ floor_posts[i][k]=
+ floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
+ floor_posts[i][PACKETBLOBS/2],
+ floor_posts[i][PACKETBLOBS-1],
+ (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
+ }
+ }
+ }
+ vbi->ampmax=global_ampmax;
+
+ /*
+ the next phases are performed once for vbr-only and PACKETBLOB
+ times for bitrate managed modes.
+
+ 1) encode actual mode being used
+ 2) encode the floor for each channel, compute coded mask curve/res
+ 3) normalize and couple.
+ 4) encode residue
+ 5) save packet bytes to the packetblob vector
+
+ */
+
+ /* iterate over the many masking curve fits we've created */
+
+ {
+ float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels);
+ float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
+ int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
+ int **sortindex=alloca(sizeof(*sortindex)*vi->channels);
+ float **mag_memo=NULL;
+ int **mag_sort=NULL;
+
+ if(info->coupling_steps){
+ mag_memo=_vp_quantize_couple_memo(vb,
+ &ci->psy_g_param,
+ psy_look,
+ info,
+ gmdct);
+
+ mag_sort=_vp_quantize_couple_sort(vb,
+ psy_look,
+ info,
+ mag_memo);
+
+ hf_reduction(&ci->psy_g_param,
+ psy_look,
+ info,
+ mag_memo);
}
- vbi->ampmax = global_ampmax;
-
- /*
- the next phases are performed once for vbr-only and PACKETBLOB
- times for bitrate managed modes.
- 1) encode actual mode being used
- 2) encode the floor for each channel, compute coded mask curve/res
- 3) normalize and couple.
- 4) encode residue
- 5) save packet bytes to the packetblob vector
+ memset(sortindex,0,sizeof(*sortindex)*vi->channels);
+ if(psy_look->vi->normal_channel_p){
+ for(i=0;i<vi->channels;i++){
+ float *mdct =gmdct[i];
+ sortindex[i]=alloca(sizeof(**sortindex)*n/2);
+ _vp_noise_normalize_sort(psy_look,mdct,sortindex[i]);
+ }
+ }
- */
+ for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
+ k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
+ k++){
+ oggpack_buffer *opb=vbi->packetblob[k];
+
+ /* start out our new packet blob with packet type and mode */
+ /* Encode the packet type */
+ oggpack_write(opb,0,1);
+ /* Encode the modenumber */
+ /* Encode frame mode, pre,post windowsize, then dispatch */
+ oggpack_write(opb,modenumber,b->modebits);
+ if(vb->W){
+ oggpack_write(opb,vb->lW,1);
+ oggpack_write(opb,vb->nW,1);
+ }
+
+ /* encode floor, compute masking curve, sep out residue */
+ for(i=0;i<vi->channels;i++){
+ int submap=info->chmuxlist[i];
+ float *mdct =gmdct[i];
+ float *res =vb->pcm[i];
+ int *ilogmask=ilogmaskch[i]=
+ _vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
+
+ nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]],
+ floor_posts[i][k],
+ ilogmask);
+#if 0
+ {
+ char buf[80];
+ sprintf(buf,"maskI%c%d",i?'R':'L',k);
+ float work[n/2];
+ for(j=0;j<n/2;j++)
+ work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]];
+ _analysis_output(buf,seq,work,n/2,1,1,0);
+ }
+#endif
+ _vp_remove_floor(psy_look,
+ mdct,
+ ilogmask,
+ res,
+ ci->psy_g_param.sliding_lowpass[vb->W][k]);
- /* iterate over the many masking curve fits we've created */
+ _vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
- {
- float **res_bundle = alloca(sizeof(*res_bundle) * vi->channels);
- float **couple_bundle = alloca(sizeof(*couple_bundle) * vi->channels);
- int *zerobundle = alloca(sizeof(*zerobundle) * vi->channels);
- int **sortindex = alloca(sizeof(*sortindex) * vi->channels);
- float **mag_memo = NULL;
- int **mag_sort = NULL;
- if(info->coupling_steps)
+#if 0
{
- mag_memo = _vp_quantize_couple_memo(vb,
- &ci->psy_g_param,
- psy_look,
- info,
- gmdct);
-
- mag_sort = _vp_quantize_couple_sort(vb,
- psy_look,
- info,
- mag_memo);
-
- hf_reduction(&ci->psy_g_param,
- psy_look,
- info,
- mag_memo);
- }
+ char buf[80];
+ float work[n/2];
+ for(j=0;j<n/2;j++)
+ work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]]*(res+n/2)[j];
+ sprintf(buf,"resI%c%d",i?'R':'L',k);
+ _analysis_output(buf,seq,work,n/2,1,1,0);
- memset(sortindex, 0, sizeof(*sortindex)*vi->channels);
- if(psy_look->vi->normal_channel_p)
- {
- for(i = 0; i < vi->channels; i++)
- {
- float *mdct = gmdct[i];
- sortindex[i] = alloca(sizeof(**sortindex) * n / 2);
- _vp_noise_normalize_sort(psy_look, mdct, sortindex[i]);
- }
}
-
- for(k = (vorbis_bitrate_managed(vb) ? 0 : PACKETBLOBS / 2);
- k <= (vorbis_bitrate_managed(vb) ? PACKETBLOBS - 1 : PACKETBLOBS / 2);
- k++)
- {
- oggpack_buffer *opb = vbi->packetblob[k];
-
- /* start out our new packet blob with packet type and mode */
- /* Encode the packet type */
- oggpack_write(opb, 0, 1);
- /* Encode the modenumber */
- /* Encode frame mode, pre,post windowsize, then dispatch */
- oggpack_write(opb, modenumber, b->modebits);
- if(vb->W)
- {
- oggpack_write(opb, vb->lW, 1);
- oggpack_write(opb, vb->nW, 1);
- }
-
- /* encode floor, compute masking curve, sep out residue */
- for(i = 0; i < vi->channels; i++)
- {
- int submap = info->chmuxlist[i];
- float *mdct = gmdct[i];
- float *res = vb->pcm[i];
- int *ilogmask = ilogmaskch[i] =
- _vorbis_block_alloc(vb, n / 2 * sizeof(**gmdct));
-
- nonzero[i] = floor1_encode(opb, vb, b->flr[info->floorsubmap[submap]],
- floor_posts[i][k],
- ilogmask);
-#if 0
- {
- char buf[80];
- sprintf(buf, "maskI%c%d", i ? 'R' : 'L', k);
- float work[n/2];
- for(j = 0; j < n / 2; j++)
- work[j] = FLOOR1_fromdB_LOOKUP[ilogmask[j]];
- _analysis_output(buf, seq, work, n / 2, 1, 1, 0);
- }
#endif
- _vp_remove_floor(psy_look,
- mdct,
- ilogmask,
- res,
- ci->psy_g_param.sliding_lowpass[vb->W][k]);
+ }
+
+ /* our iteration is now based on masking curve, not prequant and
+ coupling. Only one prequant/coupling step */
+
+ /* quantize/couple */
+ /* incomplete implementation that assumes the tree is all depth
+ one, or no tree at all */
+ if(info->coupling_steps){
+ _vp_couple(k,
+ &ci->psy_g_param,
+ psy_look,
+ info,
+ vb->pcm,
+ mag_memo,
+ mag_sort,
+ ilogmaskch,
+ nonzero,
+ ci->psy_g_param.sliding_lowpass[vb->W][k]);
+ }
+
+ /* classify and encode by submap */
+ for(i=0;i<info->submaps;i++){
+ int ch_in_bundle=0;
+ long **classifications;
+ int resnum=info->residuesubmap[i];
+
+ for(j=0;j<vi->channels;j++){
+ if(info->chmuxlist[j]==i){
+ zerobundle[ch_in_bundle]=0;
+ if(nonzero[j])zerobundle[ch_in_bundle]=1;
+ res_bundle[ch_in_bundle]=vb->pcm[j];
+ couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
+ }
+ }
- _vp_noise_normalize(psy_look, res, res + n / 2, sortindex[i]);
+ classifications=_residue_P[ci->residue_type[resnum]]->
+ class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
+ /* couple_bundle is destructively overwritten by
+ the class function if some but not all of the channels are
+ marked as silence; build a fresh copy */
+ ch_in_bundle=0;
+ for(j=0;j<vi->channels;j++)
+ if(info->chmuxlist[j]==i)
+ couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
-#if 0
- {
- char buf[80];
- float work[n/2];
- for(j = 0; j < n / 2; j++)
- work[j] = FLOOR1_fromdB_LOOKUP[ilogmask[j]] * (res + n / 2)[j];
- sprintf(buf, "resI%c%d", i ? 'R' : 'L', k);
- _analysis_output(buf, seq, work, n / 2, 1, 1, 0);
-
- }
-#endif
- }
-
- /* our iteration is now based on masking curve, not prequant and
- coupling. Only one prequant/coupling step */
-
- /* quantize/couple */
- /* incomplete implementation that assumes the tree is all depth
- one, or no tree at all */
- if(info->coupling_steps)
- {
- _vp_couple(k,
- &ci->psy_g_param,
- psy_look,
- info,
- vb->pcm,
- mag_memo,
- mag_sort,
- ilogmaskch,
- nonzero,
- ci->psy_g_param.sliding_lowpass[vb->W][k]);
- }
-
- /* classify and encode by submap */
- for(i = 0; i < info->submaps; i++)
- {
- int ch_in_bundle = 0;
- long **classifications;
- int resnum = info->residuesubmap[i];
-
- for(j = 0; j < vi->channels; j++)
- {
- if(info->chmuxlist[j] == i)
- {
- zerobundle[ch_in_bundle] = 0;
- if(nonzero[j])zerobundle[ch_in_bundle] = 1;
- res_bundle[ch_in_bundle] = vb->pcm[j];
- couple_bundle[ch_in_bundle++] = vb->pcm[j] + n / 2;
- }
- }
-
- classifications = _residue_P[ci->residue_type[resnum]]->
- class(vb, b->residue[resnum], couple_bundle, zerobundle, ch_in_bundle);
-
- /* couple_bundle is destructively overwritten by
- the class function if some but not all of the channels are
- marked as silence; build a fresh copy */
- ch_in_bundle = 0;
- for(j = 0; j < vi->channels; j++)
- if(info->chmuxlist[j] == i)
- couple_bundle[ch_in_bundle++] = vb->pcm[j] + n / 2;
-
- _residue_P[ci->residue_type[resnum]]->
- forward(opb, vb, b->residue[resnum],
- couple_bundle, NULL, zerobundle, ch_in_bundle, classifications);
- }
-
- /* ok, done encoding. Next protopacket. */
- }
+ _residue_P[ci->residue_type[resnum]]->
+ forward(opb,vb,b->residue[resnum],
+ couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
+ }
+ /* ok, done encoding. Next protopacket. */
}
+ }
+
#if 0
- seq++;
- total += ci->blocksizes[vb->W] / 4 + ci->blocksizes[vb->nW] / 4;
+ seq++;
+ total+=ci->blocksizes[vb->W]/4+ci->blocksizes[vb->nW]/4;
#endif
- return(0);
+ return(0);
}
-static int mapping0_inverse(vorbis_block *vb, vorbis_info_mapping *l)
-{
- vorbis_dsp_state *vd = vb->vd;
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- private_state *b = vd->backend_state;
- vorbis_info_mapping0 *info = (vorbis_info_mapping0 *)l;
-
- int i, j;
- long n = vb->pcmend = ci->blocksizes[vb->W];
-
- float **pcmbundle = alloca(sizeof(*pcmbundle) * vi->channels);
- int *zerobundle = alloca(sizeof(*zerobundle) * vi->channels);
-
- int *nonzero = alloca(sizeof(*nonzero) * vi->channels);
- void **floormemo = alloca(sizeof(*floormemo) * vi->channels);
-
- /* recover the spectral envelope; store it in the PCM vector for now */
- for(i = 0; i < vi->channels; i++)
- {
- int submap = info->chmuxlist[i];
- floormemo[i] = _floor_P[ci->floor_type[info->floorsubmap[submap]]]->
- inverse1(vb, b->flr[info->floorsubmap[submap]]);
- if(floormemo[i])
- nonzero[i] = 1;
- else
- nonzero[i] = 0;
- memset(vb->pcm[i], 0, sizeof(*vb->pcm[i])*n / 2);
+static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ private_state *b=vd->backend_state;
+ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l;
+
+ int i,j;
+ long n=vb->pcmend=ci->blocksizes[vb->W];
+
+ float **pcmbundle=alloca(sizeof(*pcmbundle)*vi->channels);
+ int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
+
+ int *nonzero =alloca(sizeof(*nonzero)*vi->channels);
+ void **floormemo=alloca(sizeof(*floormemo)*vi->channels);
+
+ /* recover the spectral envelope; store it in the PCM vector for now */
+ for(i=0;i<vi->channels;i++){
+ int submap=info->chmuxlist[i];
+ floormemo[i]=_floor_P[ci->floor_type[info->floorsubmap[submap]]]->
+ inverse1(vb,b->flr[info->floorsubmap[submap]]);
+ if(floormemo[i])
+ nonzero[i]=1;
+ else
+ nonzero[i]=0;
+ memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
+ }
+
+ /* channel coupling can 'dirty' the nonzero listing */
+ for(i=0;i<info->coupling_steps;i++){
+ if(nonzero[info->coupling_mag[i]] ||
+ nonzero[info->coupling_ang[i]]){
+ nonzero[info->coupling_mag[i]]=1;
+ nonzero[info->coupling_ang[i]]=1;
}
-
- /* channel coupling can 'dirty' the nonzero listing */
- for(i = 0; i < info->coupling_steps; i++)
- {
- if(nonzero[info->coupling_mag[i]] ||
- nonzero[info->coupling_ang[i]])
- {
- nonzero[info->coupling_mag[i]] = 1;
- nonzero[info->coupling_ang[i]] = 1;
- }
+ }
+
+ /* recover the residue into our working vectors */
+ for(i=0;i<info->submaps;i++){
+ int ch_in_bundle=0;
+ for(j=0;j<vi->channels;j++){
+ if(info->chmuxlist[j]==i){
+ if(nonzero[j])
+ zerobundle[ch_in_bundle]=1;
+ else
+ zerobundle[ch_in_bundle]=0;
+ pcmbundle[ch_in_bundle++]=vb->pcm[j];
+ }
}
- /* recover the residue into our working vectors */
- for(i = 0; i < info->submaps; i++)
- {
- int ch_in_bundle = 0;
- for(j = 0; j < vi->channels; j++)
- {
- if(info->chmuxlist[j] == i)
- {
- if(nonzero[j])
- zerobundle[ch_in_bundle] = 1;
- else
- zerobundle[ch_in_bundle] = 0;
- pcmbundle[ch_in_bundle++] = vb->pcm[j];
- }
+ _residue_P[ci->residue_type[info->residuesubmap[i]]]->
+ inverse(vb,b->residue[info->residuesubmap[i]],
+ pcmbundle,zerobundle,ch_in_bundle);
+ }
+
+ /* channel coupling */
+ for(i=info->coupling_steps-1;i>=0;i--){
+ float *pcmM=vb->pcm[info->coupling_mag[i]];
+ float *pcmA=vb->pcm[info->coupling_ang[i]];
+
+ for(j=0;j<n/2;j++){
+ float mag=pcmM[j];
+ float ang=pcmA[j];
+
+ if(mag>0)
+ if(ang>0){
+ pcmM[j]=mag;
+ pcmA[j]=mag-ang;
+ }else{
+ pcmA[j]=mag;
+ pcmM[j]=mag+ang;
}
-
- _residue_P[ci->residue_type[info->residuesubmap[i]]]->
- inverse(vb, b->residue[info->residuesubmap[i]],
- pcmbundle, zerobundle, ch_in_bundle);
- }
-
- /* channel coupling */
- for(i = info->coupling_steps - 1; i >= 0; i--)
- {
- float *pcmM = vb->pcm[info->coupling_mag[i]];
- float *pcmA = vb->pcm[info->coupling_ang[i]];
-
- for(j = 0; j < n / 2; j++)
- {
- float mag = pcmM[j];
- float ang = pcmA[j];
-
- if(mag > 0)
- if(ang > 0)
- {
- pcmM[j] = mag;
- pcmA[j] = mag - ang;
- }
- else
- {
- pcmA[j] = mag;
- pcmM[j] = mag + ang;
- }
- else if(ang > 0)
- {
- pcmM[j] = mag;
- pcmA[j] = mag + ang;
- }
- else
- {
- pcmA[j] = mag;
- pcmM[j] = mag - ang;
- }
+ else
+ if(ang>0){
+ pcmM[j]=mag;
+ pcmA[j]=mag+ang;
+ }else{
+ pcmA[j]=mag;
+ pcmM[j]=mag-ang;
}
}
-
- /* compute and apply spectral envelope */
- for(i = 0; i < vi->channels; i++)
- {
- float *pcm = vb->pcm[i];
- int submap = info->chmuxlist[i];
- _floor_P[ci->floor_type[info->floorsubmap[submap]]]->
- inverse2(vb, b->flr[info->floorsubmap[submap]],
- floormemo[i], pcm);
- }
-
- /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
- /* only MDCT right now.... */
- for(i = 0; i < vi->channels; i++)
- {
- float *pcm = vb->pcm[i];
- mdct_backward(b->transform[vb->W][0], pcm, pcm);
- }
-
- /* all done! */
- return(0);
+ }
+
+ /* compute and apply spectral envelope */
+ for(i=0;i<vi->channels;i++){
+ float *pcm=vb->pcm[i];
+ int submap=info->chmuxlist[i];
+ _floor_P[ci->floor_type[info->floorsubmap[submap]]]->
+ inverse2(vb,b->flr[info->floorsubmap[submap]],
+ floormemo[i],pcm);
+ }
+
+ /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
+ /* only MDCT right now.... */
+ for(i=0;i<vi->channels;i++){
+ float *pcm=vb->pcm[i];
+ mdct_backward(b->transform[vb->W][0],pcm,pcm);
+ }
+
+ /* all done! */
+ return(0);
}
/* export hooks */
-const vorbis_func_mapping mapping0_exportbundle =
-{
- &mapping0_pack,
- &mapping0_unpack,
- &mapping0_free_info,
- &mapping0_forward,
- &mapping0_inverse
+const vorbis_func_mapping mapping0_exportbundle={
+ &mapping0_pack,
+ &mapping0_unpack,
+ &mapping0_free_info,
+ &mapping0_forward,
+ &mapping0_inverse
};
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/masking.h b/src/filters/transform/MpaDecFilter/libvorbisidec/masking.h
index 0962deffe..3576ab788 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/masking.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/masking.h
@@ -22,19 +22,18 @@
overly for only a bin or two of savings. */
#define MAX_ATH 88
-static const float ATH[] =
-{
- /*15*/ -51, -52, -53, -54, -55, -56, -57, -58,
- /*31*/ -59, -60, -61, -62, -63, -64, -65, -66,
- /*63*/ -67, -68, -69, -70, -71, -72, -73, -74,
- /*125*/ -75, -76, -77, -78, -80, -81, -82, -83,
- /*250*/ -84, -85, -86, -87, -88, -88, -89, -89,
- /*500*/ -90, -91, -91, -92, -93, -94, -95, -96,
- /*1k*/ -96, -97, -98, -98, -99, -99, -100, -100,
- /*2k*/ -101, -102, -103, -104, -106, -107, -107, -107,
- /*4k*/ -107, -105, -103, -102, -101, -99, -98, -96,
- /*8k*/ -95, -95, -96, -97, -96, -95, -93, -90,
- /*16k*/ -80, -70, -50, -40, -30, -30, -30, -30
+static const float ATH[]={
+ /*15*/ -51, -52, -53, -54, -55, -56, -57, -58,
+ /*31*/ -59, -60, -61, -62, -63, -64, -65, -66,
+ /*63*/ -67, -68, -69, -70, -71, -72, -73, -74,
+ /*125*/ -75, -76, -77, -78, -80, -81, -82, -83,
+ /*250*/ -84, -85, -86, -87, -88, -88, -89, -89,
+ /*500*/ -90, -91, -91, -92, -93, -94, -95, -96,
+ /*1k*/ -96, -97, -98, -98, -99, -99,-100,-100,
+ /*2k*/ -101,-102,-103,-104,-106,-107,-107,-107,
+ /*4k*/ -107,-105,-103,-102,-101, -99, -98, -96,
+ /*8k*/ -95, -95, -96, -97, -96, -95, -93, -90,
+ /*16k*/ -80, -70, -50, -40, -30, -30, -30, -30
};
/* The tone masking curves from Ehmer's and Fielder's papers have been
@@ -49,960 +48,738 @@ static const float ATH[] =
/* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL
for collection of these curves) */
-static const float tonemasks[P_BANDS][6][EHMER_MAX] =
-{
- /* 62.5 Hz */
- { {
- -60, -60, -60, -60, -60, -60, -60, -60,
- -60, -60, -60, -60, -62, -62, -65, -73,
- -69, -68, -68, -67, -70, -70, -72, -74,
- -75, -79, -79, -80, -83, -88, -93, -100,
- -110, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -48, -48, -48, -48, -48, -48, -48, -48,
- -48, -48, -48, -48, -48, -53, -61, -66,
- -66, -68, -67, -70, -76, -76, -72, -73,
- -75, -76, -78, -79, -83, -88, -93, -100,
- -110, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -37, -37, -37, -37, -37, -37, -37, -37,
- -38, -40, -42, -46, -48, -53, -55, -62,
- -65, -58, -56, -56, -61, -60, -65, -67,
- -69, -71, -77, -77, -78, -80, -82, -84,
- -88, -93, -98, -106, -112, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -26, -27, -29, -32, -38, -48, -52,
- -52, -50, -48, -48, -51, -52, -54, -60,
- -67, -67, -66, -68, -69, -73, -73, -76,
- -80, -81, -81, -85, -85, -86, -88, -93,
- -100, -110, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -16, -16, -16, -16, -16, -16, -16, -16,
- -17, -19, -20, -22, -26, -28, -31, -40,
- -47, -39, -39, -40, -42, -43, -47, -51,
- -57, -52, -55, -55, -60, -58, -62, -63,
- -70, -67, -69, -72, -73, -77, -80, -82,
- -83, -87, -90, -94, -98, -104, -115, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -8, -8, -8, -8, -8, -8, -8, -8,
- -8, -8, -10, -11, -15, -19, -25, -30,
- -34, -31, -30, -31, -29, -32, -35, -42,
- -48, -42, -44, -46, -50, -50, -51, -52,
- -59, -54, -55, -55, -58, -62, -63, -66,
- -72, -73, -76, -75, -78, -80, -80, -81,
- -84, -88, -90, -94, -98, -101, -106, -110
- }
- },
- /* 88Hz */
- { {
- -66, -66, -66, -66, -66, -66, -66, -66,
- -66, -66, -66, -66, -66, -67, -67, -67,
- -76, -72, -71, -74, -76, -76, -75, -78,
- -79, -79, -81, -83, -86, -89, -93, -97,
- -100, -105, -110, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -47, -47, -47, -47, -47, -47, -47, -47,
- -47, -47, -47, -48, -51, -55, -59, -66,
- -66, -66, -67, -66, -68, -69, -70, -74,
- -79, -77, -77, -78, -80, -81, -82, -84,
- -86, -88, -91, -95, -100, -108, -116, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -36, -36, -36, -36, -36, -36, -36, -36,
- -36, -37, -37, -41, -44, -48, -51, -58,
- -62, -60, -57, -59, -59, -60, -63, -65,
- -72, -71, -70, -72, -74, -77, -76, -78,
- -81, -81, -80, -83, -86, -91, -96, -100,
- -105, -110, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -28, -28, -28, -28, -28, -28, -28, -28,
- -28, -30, -32, -32, -33, -35, -41, -49,
- -50, -49, -47, -48, -48, -52, -51, -57,
- -65, -61, -59, -61, -64, -69, -70, -74,
- -77, -77, -78, -81, -84, -85, -87, -90,
- -92, -96, -100, -107, -112, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -19, -19, -19, -19, -19, -19, -19, -19,
- -20, -21, -23, -27, -30, -35, -36, -41,
- -46, -44, -42, -40, -41, -41, -43, -48,
- -55, -53, -52, -53, -56, -59, -58, -60,
- -67, -66, -69, -71, -72, -75, -79, -81,
- -84, -87, -90, -93, -97, -101, -107, -114,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -9, -9, -9, -9, -9, -9, -9, -9,
- -11, -12, -12, -15, -16, -20, -23, -30,
- -37, -34, -33, -34, -31, -32, -32, -38,
- -47, -44, -41, -40, -47, -49, -46, -46,
- -58, -50, -50, -54, -58, -62, -64, -67,
- -67, -70, -72, -76, -79, -83, -87, -91,
- -96, -100, -104, -110, -999, -999, -999, -999
- }
- },
- /* 125 Hz */
- { {
- -62, -62, -62, -62, -62, -62, -62, -62,
- -62, -62, -63, -64, -66, -67, -66, -68,
- -75, -72, -76, -75, -76, -78, -79, -82,
- -84, -85, -90, -94, -101, -110, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -59, -59, -59, -59, -59, -59, -59, -59,
- -59, -59, -59, -60, -60, -61, -63, -66,
- -71, -68, -70, -70, -71, -72, -72, -75,
- -81, -78, -79, -82, -83, -86, -90, -97,
- -103, -113, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -53, -53, -53, -53, -53, -53, -53, -53,
- -53, -54, -55, -57, -56, -57, -55, -61,
- -65, -60, -60, -62, -63, -63, -66, -68,
- -74, -73, -75, -75, -78, -80, -80, -82,
- -85, -90, -96, -101, -108, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -46, -46, -46, -46, -46, -46, -46, -46,
- -46, -46, -47, -47, -47, -47, -48, -51,
- -57, -51, -49, -50, -51, -53, -54, -59,
- -66, -60, -62, -67, -67, -70, -72, -75,
- -76, -78, -81, -85, -88, -94, -97, -104,
- -112, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -36, -36, -36, -36, -36, -36, -36, -36,
- -39, -41, -42, -42, -39, -38, -41, -43,
- -52, -44, -40, -39, -37, -37, -40, -47,
- -54, -50, -48, -50, -55, -61, -59, -62,
- -66, -66, -66, -69, -69, -73, -74, -74,
- -75, -77, -79, -82, -87, -91, -95, -100,
- -108, -115, -999, -999, -999, -999, -999, -999
- },
- {
- -28, -26, -24, -22, -20, -20, -23, -29,
- -30, -31, -28, -27, -28, -28, -28, -35,
- -40, -33, -32, -29, -30, -30, -30, -37,
- -45, -41, -37, -38, -45, -47, -47, -48,
- -53, -49, -48, -50, -49, -49, -51, -52,
- -58, -56, -57, -56, -60, -61, -62, -70,
- -72, -74, -78, -83, -88, -93, -100, -106
- }
- },
- /* 177 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -110, -105, -100, -95, -91, -87, -83,
- -80, -78, -76, -78, -78, -81, -83, -85,
- -86, -85, -86, -87, -90, -97, -107, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -110, -105, -100, -95, -90,
- -85, -81, -77, -73, -70, -67, -67, -68,
- -75, -73, -70, -69, -70, -72, -75, -79,
- -84, -83, -84, -86, -88, -89, -89, -93,
- -98, -105, -112, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -105, -100, -95, -90, -85, -80, -76, -71,
- -68, -68, -65, -63, -63, -62, -62, -64,
- -65, -64, -61, -62, -63, -64, -66, -68,
- -73, -73, -74, -75, -76, -81, -83, -85,
- -88, -89, -92, -95, -100, -108, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -80, -75, -71, -68, -65, -63, -62, -61,
- -61, -61, -61, -59, -56, -57, -53, -50,
- -58, -52, -50, -50, -52, -53, -54, -58,
- -67, -63, -67, -68, -72, -75, -78, -80,
- -81, -81, -82, -85, -89, -90, -93, -97,
- -101, -107, -114, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -65, -61, -59, -57, -56, -55, -55, -56,
- -56, -57, -55, -53, -52, -47, -44, -44,
- -50, -44, -41, -39, -39, -42, -40, -46,
- -51, -49, -50, -53, -54, -63, -60, -61,
- -62, -66, -66, -66, -70, -73, -74, -75,
- -76, -75, -79, -85, -89, -91, -96, -102,
- -110, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -52, -50, -49, -49, -48, -48, -48, -49,
- -50, -50, -49, -46, -43, -39, -35, -33,
- -38, -36, -32, -29, -32, -32, -32, -35,
- -44, -39, -38, -38, -46, -50, -45, -46,
- -53, -50, -50, -50, -54, -54, -53, -53,
- -56, -57, -59, -66, -70, -72, -74, -79,
- -83, -85, -90, -97, -114, -999, -999, -999
- }
- },
- /* 250 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -110, -105,
- -100, -95, -90, -86, -80, -75, -75, -79,
- -80, -79, -80, -81, -82, -88, -95, -103,
- -110, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -108, -103, -98, -93,
- -88, -83, -79, -78, -75, -71, -67, -68,
- -73, -73, -72, -73, -75, -77, -80, -82,
- -88, -93, -100, -107, -114, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -110, -105, -101, -96, -90,
- -86, -81, -77, -73, -69, -66, -61, -62,
- -66, -64, -62, -65, -66, -70, -72, -76,
- -81, -80, -84, -90, -95, -102, -110, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -107, -103, -97, -92, -88,
- -83, -79, -74, -70, -66, -59, -53, -58,
- -62, -55, -54, -54, -54, -58, -61, -62,
- -72, -70, -72, -75, -78, -80, -81, -80,
- -83, -83, -88, -93, -100, -107, -115, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -105, -100, -95, -90, -85,
- -80, -75, -70, -66, -62, -56, -48, -44,
- -48, -46, -46, -43, -46, -48, -48, -51,
- -58, -58, -59, -60, -62, -62, -61, -61,
- -65, -64, -65, -68, -70, -74, -75, -78,
- -81, -86, -95, -110, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -105, -100, -95, -90, -85, -80,
- -75, -70, -65, -61, -55, -49, -39, -33,
- -40, -35, -32, -38, -40, -33, -35, -37,
- -46, -41, -45, -44, -46, -42, -45, -46,
- -52, -50, -50, -50, -54, -54, -55, -57,
- -62, -64, -66, -68, -70, -76, -81, -90,
- -100, -110, -999, -999, -999, -999, -999, -999
- }
- },
- /* 354 hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -105, -98, -90, -85, -82, -83, -80, -78,
- -84, -79, -80, -83, -87, -89, -91, -93,
- -99, -106, -117, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -105, -98, -90, -85, -80, -75, -70, -68,
- -74, -72, -74, -77, -80, -82, -85, -87,
- -92, -89, -91, -95, -100, -106, -112, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -105, -98, -90, -83, -75, -71, -63, -64,
- -67, -62, -64, -67, -70, -73, -77, -81,
- -84, -83, -85, -89, -90, -93, -98, -104,
- -109, -114, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -103, -96, -88, -81, -75, -68, -58, -54,
- -56, -54, -56, -56, -58, -60, -63, -66,
- -74, -69, -72, -72, -75, -74, -77, -81,
- -81, -82, -84, -87, -93, -96, -99, -104,
- -110, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -108, -102, -96,
- -91, -85, -80, -74, -68, -60, -51, -46,
- -48, -46, -43, -45, -47, -47, -49, -48,
- -56, -53, -55, -58, -57, -63, -58, -60,
- -66, -64, -67, -70, -70, -74, -77, -84,
- -86, -89, -91, -93, -94, -101, -109, -118,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -108, -103, -98, -93, -88,
- -83, -78, -73, -68, -60, -53, -44, -35,
- -38, -38, -34, -34, -36, -40, -41, -44,
- -51, -45, -46, -47, -46, -54, -50, -49,
- -50, -50, -50, -51, -54, -57, -58, -60,
- -66, -66, -66, -64, -65, -68, -77, -82,
- -87, -95, -110, -999, -999, -999, -999, -999
- }
- },
- /* 500 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -107, -102, -97, -92, -87, -83, -78, -75,
- -82, -79, -83, -85, -89, -92, -95, -98,
- -101, -105, -109, -113, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -106,
- -100, -95, -90, -86, -81, -78, -74, -69,
- -74, -74, -76, -79, -83, -84, -86, -89,
- -92, -97, -93, -100, -103, -107, -110, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -106, -100,
- -95, -90, -87, -83, -80, -75, -69, -60,
- -66, -66, -68, -70, -74, -78, -79, -81,
- -81, -83, -84, -87, -93, -96, -99, -103,
- -107, -110, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -108, -103, -98,
- -93, -89, -85, -82, -78, -71, -62, -55,
- -58, -58, -54, -54, -55, -59, -61, -62,
- -70, -66, -66, -67, -70, -72, -75, -78,
- -84, -84, -84, -88, -91, -90, -95, -98,
- -102, -103, -106, -110, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -108, -103, -98, -94,
- -90, -87, -82, -79, -73, -67, -58, -47,
- -50, -45, -41, -45, -48, -44, -44, -49,
- -54, -51, -48, -47, -49, -50, -51, -57,
- -58, -60, -63, -69, -70, -69, -71, -74,
- -78, -82, -90, -95, -101, -105, -110, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -105, -101, -97, -93, -90,
- -85, -80, -77, -72, -65, -56, -48, -37,
- -40, -36, -34, -40, -50, -47, -38, -41,
- -47, -38, -35, -39, -38, -43, -40, -45,
- -50, -45, -44, -47, -50, -55, -48, -48,
- -52, -66, -70, -76, -82, -90, -97, -105,
- -110, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 707 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -108, -103, -98, -93, -86, -79, -76,
- -83, -81, -85, -87, -89, -93, -98, -102,
- -107, -112, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -108, -103, -98, -93, -86, -79, -71,
- -77, -74, -77, -79, -81, -84, -85, -90,
- -92, -93, -92, -98, -101, -108, -112, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -108, -103, -98, -93, -87, -78, -68, -65,
- -66, -62, -65, -67, -70, -73, -75, -78,
- -82, -82, -83, -84, -91, -93, -98, -102,
- -106, -110, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -105, -100, -95, -90, -82, -74, -62, -57,
- -58, -56, -51, -52, -52, -54, -54, -58,
- -66, -59, -60, -63, -66, -69, -73, -79,
- -83, -84, -80, -81, -81, -82, -88, -92,
- -98, -105, -113, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -107,
- -102, -97, -92, -84, -79, -69, -57, -47,
- -52, -47, -44, -45, -50, -52, -42, -42,
- -53, -43, -43, -48, -51, -56, -55, -52,
- -57, -59, -61, -62, -67, -71, -78, -83,
- -86, -94, -98, -103, -110, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -105, -100,
- -95, -90, -84, -78, -70, -61, -51, -41,
- -40, -38, -40, -46, -52, -51, -41, -40,
- -46, -40, -38, -38, -41, -46, -41, -46,
- -47, -43, -43, -45, -41, -45, -56, -67,
- -68, -83, -87, -90, -95, -102, -107, -113,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 1000 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -109, -105, -101, -96, -91, -84, -77,
- -82, -82, -85, -89, -94, -100, -106, -110,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -106, -103, -98, -92, -85, -80, -71,
- -75, -72, -76, -80, -84, -86, -89, -93,
- -100, -107, -113, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -107,
- -104, -101, -97, -92, -88, -84, -80, -64,
- -66, -63, -64, -66, -69, -73, -77, -83,
- -83, -86, -91, -98, -104, -111, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -107,
- -104, -101, -97, -92, -90, -84, -74, -57,
- -58, -52, -55, -54, -50, -52, -50, -52,
- -63, -62, -69, -76, -77, -78, -78, -79,
- -82, -88, -94, -100, -106, -111, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -106, -102,
- -98, -95, -90, -85, -83, -78, -70, -50,
- -50, -41, -44, -49, -47, -50, -50, -44,
- -55, -46, -47, -48, -48, -54, -49, -49,
- -58, -62, -71, -81, -87, -92, -97, -102,
- -108, -114, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -106, -102,
- -98, -95, -90, -85, -83, -78, -70, -45,
- -43, -41, -47, -50, -51, -50, -49, -45,
- -47, -41, -44, -41, -39, -43, -38, -37,
- -40, -41, -44, -50, -58, -65, -73, -79,
- -85, -92, -97, -101, -105, -109, -113, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 1414 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -107, -100, -95, -87, -81,
- -85, -83, -88, -93, -100, -107, -114, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -107, -101, -95, -88, -83, -76,
- -73, -72, -79, -84, -90, -95, -100, -105,
- -110, -115, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -104, -98, -92, -87, -81, -70,
- -65, -62, -67, -71, -74, -80, -85, -91,
- -95, -99, -103, -108, -111, -114, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -103, -97, -90, -85, -76, -60,
- -56, -54, -60, -62, -61, -56, -63, -65,
- -73, -74, -77, -75, -78, -81, -86, -87,
- -88, -91, -94, -98, -103, -110, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -105,
- -100, -97, -92, -86, -81, -79, -70, -57,
- -51, -47, -51, -58, -60, -56, -53, -50,
- -58, -52, -50, -50, -53, -55, -64, -69,
- -71, -85, -82, -78, -81, -85, -95, -102,
- -112, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -105,
- -100, -97, -92, -85, -83, -79, -72, -49,
- -40, -43, -43, -54, -56, -51, -50, -40,
- -43, -38, -36, -35, -37, -38, -37, -44,
- -54, -60, -57, -60, -70, -75, -84, -92,
- -103, -112, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 2000 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -102, -95, -89, -82,
- -83, -84, -90, -92, -99, -107, -113, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -107, -101, -95, -89, -83, -72,
- -74, -78, -85, -88, -88, -90, -92, -98,
- -105, -111, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -109, -103, -97, -93, -87, -81, -70,
- -70, -67, -75, -73, -76, -79, -81, -83,
- -88, -89, -97, -103, -110, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -107, -100, -94, -88, -83, -75, -63,
- -59, -59, -63, -66, -60, -62, -67, -67,
- -77, -76, -81, -88, -86, -92, -96, -102,
- -109, -116, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -105, -98, -92, -86, -81, -73, -56,
- -52, -47, -55, -60, -58, -52, -51, -45,
- -49, -50, -53, -54, -61, -71, -70, -69,
- -78, -79, -87, -90, -96, -104, -112, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -103, -96, -90, -86, -78, -70, -51,
- -42, -47, -48, -55, -54, -54, -53, -42,
- -35, -28, -33, -38, -37, -44, -47, -49,
- -54, -63, -68, -78, -82, -89, -94, -99,
- -104, -109, -114, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 2828 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -110, -100, -90, -79,
- -85, -81, -82, -82, -89, -94, -99, -103,
- -109, -115, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -105, -97, -85, -72,
- -74, -70, -70, -70, -76, -85, -91, -93,
- -97, -103, -109, -115, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -112, -93, -81, -68,
- -62, -60, -60, -57, -63, -70, -77, -82,
- -90, -93, -98, -104, -109, -113, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -113, -100, -93, -84, -63,
- -58, -48, -53, -54, -52, -52, -57, -64,
- -66, -76, -83, -81, -85, -85, -90, -95,
- -98, -101, -103, -106, -108, -111, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -105, -95, -86, -74, -53,
- -50, -38, -43, -49, -43, -42, -39, -39,
- -46, -52, -57, -56, -72, -69, -74, -81,
- -87, -92, -94, -97, -99, -102, -105, -108,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -108, -99, -90, -76, -66, -45,
- -43, -41, -44, -47, -43, -47, -40, -30,
- -31, -31, -39, -33, -40, -41, -43, -53,
- -59, -70, -73, -77, -79, -82, -84, -87,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 4000 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -110, -91, -76,
- -75, -85, -93, -98, -104, -110, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -110, -91, -70,
- -70, -75, -86, -89, -94, -98, -101, -106,
- -110, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -110, -95, -80, -60,
- -65, -64, -74, -83, -88, -91, -95, -99,
- -103, -107, -110, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -110, -95, -80, -58,
- -55, -49, -66, -68, -71, -78, -78, -80,
- -88, -85, -89, -97, -100, -105, -110, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -110, -95, -80, -53,
- -52, -41, -59, -59, -49, -58, -56, -63,
- -86, -79, -90, -93, -98, -103, -107, -112,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -97, -91, -73, -45,
- -40, -33, -53, -61, -49, -54, -50, -50,
- -60, -52, -67, -74, -81, -92, -96, -100,
- -105, -110, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 5657 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -113, -106, -99, -92, -77,
- -80, -88, -97, -106, -115, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -116, -109, -102, -95, -89, -74,
- -72, -88, -87, -95, -102, -109, -116, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -116, -109, -102, -95, -89, -75,
- -66, -74, -77, -78, -86, -87, -90, -96,
- -105, -115, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -115, -108, -101, -94, -88, -66,
- -56, -61, -70, -65, -78, -72, -83, -84,
- -93, -98, -105, -110, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -110, -105, -95, -89, -82, -57,
- -52, -52, -59, -56, -59, -58, -69, -67,
- -88, -82, -82, -89, -94, -100, -108, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -110, -101, -96, -90, -83, -77, -54,
- -43, -38, -50, -48, -52, -48, -42, -42,
- -51, -52, -53, -59, -65, -71, -78, -85,
- -95, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 8000 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -120, -105, -86, -68,
- -78, -79, -90, -100, -110, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -120, -105, -86, -66,
- -73, -77, -88, -96, -105, -115, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -120, -105, -92, -80, -61,
- -64, -68, -80, -87, -92, -100, -110, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -120, -104, -91, -79, -52,
- -60, -54, -64, -69, -77, -80, -82, -84,
- -85, -87, -88, -90, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -118, -100, -87, -77, -49,
- -50, -44, -58, -61, -61, -67, -65, -62,
- -62, -62, -65, -68, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -115, -98, -84, -62, -49,
- -44, -38, -46, -49, -49, -46, -39, -37,
- -39, -40, -42, -43, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 11314 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -110, -88, -74,
- -77, -82, -82, -85, -90, -94, -99, -104,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -110, -88, -66,
- -70, -81, -80, -81, -84, -88, -91, -93,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -110, -88, -61,
- -63, -70, -71, -74, -77, -80, -83, -85,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -110, -86, -62,
- -63, -62, -62, -58, -52, -50, -50, -52,
- -54, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -118, -108, -84, -53,
- -50, -50, -50, -55, -47, -45, -40, -40,
- -40, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -118, -100, -73, -43,
- -37, -42, -43, -53, -38, -37, -35, -35,
- -38, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- },
- /* 16000 Hz */
- { {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -100, -91, -84, -74,
- -80, -80, -80, -80, -80, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -100, -91, -84, -74,
- -68, -68, -68, -68, -68, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -100, -86, -78, -70,
- -60, -45, -30, -21, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -100, -87, -78, -67,
- -48, -38, -29, -21, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -100, -86, -69, -56,
- -45, -35, -33, -29, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- },
- {
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -110, -100, -83, -71, -48,
- -27, -38, -37, -34, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999,
- -999, -999, -999, -999, -999, -999, -999, -999
- }
- }
+static const float tonemasks[P_BANDS][6][EHMER_MAX]={
+ /* 62.5 Hz */
+ {{ -60, -60, -60, -60, -60, -60, -60, -60,
+ -60, -60, -60, -60, -62, -62, -65, -73,
+ -69, -68, -68, -67, -70, -70, -72, -74,
+ -75, -79, -79, -80, -83, -88, -93, -100,
+ -110, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -48, -48, -48, -48, -48, -48, -48, -48,
+ -48, -48, -48, -48, -48, -53, -61, -66,
+ -66, -68, -67, -70, -76, -76, -72, -73,
+ -75, -76, -78, -79, -83, -88, -93, -100,
+ -110, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -37, -37, -37, -37, -37, -37, -37, -37,
+ -38, -40, -42, -46, -48, -53, -55, -62,
+ -65, -58, -56, -56, -61, -60, -65, -67,
+ -69, -71, -77, -77, -78, -80, -82, -84,
+ -88, -93, -98, -106, -112, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -26, -27, -29, -32, -38, -48, -52,
+ -52, -50, -48, -48, -51, -52, -54, -60,
+ -67, -67, -66, -68, -69, -73, -73, -76,
+ -80, -81, -81, -85, -85, -86, -88, -93,
+ -100, -110, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -16, -16, -16, -16, -16, -16, -16, -16,
+ -17, -19, -20, -22, -26, -28, -31, -40,
+ -47, -39, -39, -40, -42, -43, -47, -51,
+ -57, -52, -55, -55, -60, -58, -62, -63,
+ -70, -67, -69, -72, -73, -77, -80, -82,
+ -83, -87, -90, -94, -98, -104, -115, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -8, -8, -8, -8, -8, -8, -8, -8,
+ -8, -8, -10, -11, -15, -19, -25, -30,
+ -34, -31, -30, -31, -29, -32, -35, -42,
+ -48, -42, -44, -46, -50, -50, -51, -52,
+ -59, -54, -55, -55, -58, -62, -63, -66,
+ -72, -73, -76, -75, -78, -80, -80, -81,
+ -84, -88, -90, -94, -98, -101, -106, -110}},
+ /* 88Hz */
+ {{ -66, -66, -66, -66, -66, -66, -66, -66,
+ -66, -66, -66, -66, -66, -67, -67, -67,
+ -76, -72, -71, -74, -76, -76, -75, -78,
+ -79, -79, -81, -83, -86, -89, -93, -97,
+ -100, -105, -110, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -47, -47, -47, -47, -47, -47, -47, -47,
+ -47, -47, -47, -48, -51, -55, -59, -66,
+ -66, -66, -67, -66, -68, -69, -70, -74,
+ -79, -77, -77, -78, -80, -81, -82, -84,
+ -86, -88, -91, -95, -100, -108, -116, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -36, -36, -36, -36, -36, -36, -36, -36,
+ -36, -37, -37, -41, -44, -48, -51, -58,
+ -62, -60, -57, -59, -59, -60, -63, -65,
+ -72, -71, -70, -72, -74, -77, -76, -78,
+ -81, -81, -80, -83, -86, -91, -96, -100,
+ -105, -110, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -28, -28, -28, -28, -28, -28, -28, -28,
+ -28, -30, -32, -32, -33, -35, -41, -49,
+ -50, -49, -47, -48, -48, -52, -51, -57,
+ -65, -61, -59, -61, -64, -69, -70, -74,
+ -77, -77, -78, -81, -84, -85, -87, -90,
+ -92, -96, -100, -107, -112, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -19, -19, -19, -19, -19, -19, -19, -19,
+ -20, -21, -23, -27, -30, -35, -36, -41,
+ -46, -44, -42, -40, -41, -41, -43, -48,
+ -55, -53, -52, -53, -56, -59, -58, -60,
+ -67, -66, -69, -71, -72, -75, -79, -81,
+ -84, -87, -90, -93, -97, -101, -107, -114,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -9, -9, -9, -9, -9, -9, -9, -9,
+ -11, -12, -12, -15, -16, -20, -23, -30,
+ -37, -34, -33, -34, -31, -32, -32, -38,
+ -47, -44, -41, -40, -47, -49, -46, -46,
+ -58, -50, -50, -54, -58, -62, -64, -67,
+ -67, -70, -72, -76, -79, -83, -87, -91,
+ -96, -100, -104, -110, -999, -999, -999, -999}},
+ /* 125 Hz */
+ {{ -62, -62, -62, -62, -62, -62, -62, -62,
+ -62, -62, -63, -64, -66, -67, -66, -68,
+ -75, -72, -76, -75, -76, -78, -79, -82,
+ -84, -85, -90, -94, -101, -110, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -59, -59, -59, -59, -59, -59, -59, -59,
+ -59, -59, -59, -60, -60, -61, -63, -66,
+ -71, -68, -70, -70, -71, -72, -72, -75,
+ -81, -78, -79, -82, -83, -86, -90, -97,
+ -103, -113, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -53, -53, -53, -53, -53, -53, -53, -53,
+ -53, -54, -55, -57, -56, -57, -55, -61,
+ -65, -60, -60, -62, -63, -63, -66, -68,
+ -74, -73, -75, -75, -78, -80, -80, -82,
+ -85, -90, -96, -101, -108, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -46, -46, -46, -46, -46, -46, -46, -46,
+ -46, -46, -47, -47, -47, -47, -48, -51,
+ -57, -51, -49, -50, -51, -53, -54, -59,
+ -66, -60, -62, -67, -67, -70, -72, -75,
+ -76, -78, -81, -85, -88, -94, -97, -104,
+ -112, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -36, -36, -36, -36, -36, -36, -36, -36,
+ -39, -41, -42, -42, -39, -38, -41, -43,
+ -52, -44, -40, -39, -37, -37, -40, -47,
+ -54, -50, -48, -50, -55, -61, -59, -62,
+ -66, -66, -66, -69, -69, -73, -74, -74,
+ -75, -77, -79, -82, -87, -91, -95, -100,
+ -108, -115, -999, -999, -999, -999, -999, -999},
+ { -28, -26, -24, -22, -20, -20, -23, -29,
+ -30, -31, -28, -27, -28, -28, -28, -35,
+ -40, -33, -32, -29, -30, -30, -30, -37,
+ -45, -41, -37, -38, -45, -47, -47, -48,
+ -53, -49, -48, -50, -49, -49, -51, -52,
+ -58, -56, -57, -56, -60, -61, -62, -70,
+ -72, -74, -78, -83, -88, -93, -100, -106}},
+ /* 177 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -110, -105, -100, -95, -91, -87, -83,
+ -80, -78, -76, -78, -78, -81, -83, -85,
+ -86, -85, -86, -87, -90, -97, -107, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -110, -105, -100, -95, -90,
+ -85, -81, -77, -73, -70, -67, -67, -68,
+ -75, -73, -70, -69, -70, -72, -75, -79,
+ -84, -83, -84, -86, -88, -89, -89, -93,
+ -98, -105, -112, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-105, -100, -95, -90, -85, -80, -76, -71,
+ -68, -68, -65, -63, -63, -62, -62, -64,
+ -65, -64, -61, -62, -63, -64, -66, -68,
+ -73, -73, -74, -75, -76, -81, -83, -85,
+ -88, -89, -92, -95, -100, -108, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -80, -75, -71, -68, -65, -63, -62, -61,
+ -61, -61, -61, -59, -56, -57, -53, -50,
+ -58, -52, -50, -50, -52, -53, -54, -58,
+ -67, -63, -67, -68, -72, -75, -78, -80,
+ -81, -81, -82, -85, -89, -90, -93, -97,
+ -101, -107, -114, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ { -65, -61, -59, -57, -56, -55, -55, -56,
+ -56, -57, -55, -53, -52, -47, -44, -44,
+ -50, -44, -41, -39, -39, -42, -40, -46,
+ -51, -49, -50, -53, -54, -63, -60, -61,
+ -62, -66, -66, -66, -70, -73, -74, -75,
+ -76, -75, -79, -85, -89, -91, -96, -102,
+ -110, -999, -999, -999, -999, -999, -999, -999},
+ { -52, -50, -49, -49, -48, -48, -48, -49,
+ -50, -50, -49, -46, -43, -39, -35, -33,
+ -38, -36, -32, -29, -32, -32, -32, -35,
+ -44, -39, -38, -38, -46, -50, -45, -46,
+ -53, -50, -50, -50, -54, -54, -53, -53,
+ -56, -57, -59, -66, -70, -72, -74, -79,
+ -83, -85, -90, -97, -114, -999, -999, -999}},
+ /* 250 Hz */
+ {{-999, -999, -999, -999, -999, -999, -110, -105,
+ -100, -95, -90, -86, -80, -75, -75, -79,
+ -80, -79, -80, -81, -82, -88, -95, -103,
+ -110, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -108, -103, -98, -93,
+ -88, -83, -79, -78, -75, -71, -67, -68,
+ -73, -73, -72, -73, -75, -77, -80, -82,
+ -88, -93, -100, -107, -114, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -110, -105, -101, -96, -90,
+ -86, -81, -77, -73, -69, -66, -61, -62,
+ -66, -64, -62, -65, -66, -70, -72, -76,
+ -81, -80, -84, -90, -95, -102, -110, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -107, -103, -97, -92, -88,
+ -83, -79, -74, -70, -66, -59, -53, -58,
+ -62, -55, -54, -54, -54, -58, -61, -62,
+ -72, -70, -72, -75, -78, -80, -81, -80,
+ -83, -83, -88, -93, -100, -107, -115, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -105, -100, -95, -90, -85,
+ -80, -75, -70, -66, -62, -56, -48, -44,
+ -48, -46, -46, -43, -46, -48, -48, -51,
+ -58, -58, -59, -60, -62, -62, -61, -61,
+ -65, -64, -65, -68, -70, -74, -75, -78,
+ -81, -86, -95, -110, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -105, -100, -95, -90, -85, -80,
+ -75, -70, -65, -61, -55, -49, -39, -33,
+ -40, -35, -32, -38, -40, -33, -35, -37,
+ -46, -41, -45, -44, -46, -42, -45, -46,
+ -52, -50, -50, -50, -54, -54, -55, -57,
+ -62, -64, -66, -68, -70, -76, -81, -90,
+ -100, -110, -999, -999, -999, -999, -999, -999}},
+ /* 354 hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -105, -98, -90, -85, -82, -83, -80, -78,
+ -84, -79, -80, -83, -87, -89, -91, -93,
+ -99, -106, -117, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -105, -98, -90, -85, -80, -75, -70, -68,
+ -74, -72, -74, -77, -80, -82, -85, -87,
+ -92, -89, -91, -95, -100, -106, -112, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -105, -98, -90, -83, -75, -71, -63, -64,
+ -67, -62, -64, -67, -70, -73, -77, -81,
+ -84, -83, -85, -89, -90, -93, -98, -104,
+ -109, -114, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -103, -96, -88, -81, -75, -68, -58, -54,
+ -56, -54, -56, -56, -58, -60, -63, -66,
+ -74, -69, -72, -72, -75, -74, -77, -81,
+ -81, -82, -84, -87, -93, -96, -99, -104,
+ -110, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -108, -102, -96,
+ -91, -85, -80, -74, -68, -60, -51, -46,
+ -48, -46, -43, -45, -47, -47, -49, -48,
+ -56, -53, -55, -58, -57, -63, -58, -60,
+ -66, -64, -67, -70, -70, -74, -77, -84,
+ -86, -89, -91, -93, -94, -101, -109, -118,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -108, -103, -98, -93, -88,
+ -83, -78, -73, -68, -60, -53, -44, -35,
+ -38, -38, -34, -34, -36, -40, -41, -44,
+ -51, -45, -46, -47, -46, -54, -50, -49,
+ -50, -50, -50, -51, -54, -57, -58, -60,
+ -66, -66, -66, -64, -65, -68, -77, -82,
+ -87, -95, -110, -999, -999, -999, -999, -999}},
+ /* 500 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -107, -102, -97, -92, -87, -83, -78, -75,
+ -82, -79, -83, -85, -89, -92, -95, -98,
+ -101, -105, -109, -113, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -106,
+ -100, -95, -90, -86, -81, -78, -74, -69,
+ -74, -74, -76, -79, -83, -84, -86, -89,
+ -92, -97, -93, -100, -103, -107, -110, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -106, -100,
+ -95, -90, -87, -83, -80, -75, -69, -60,
+ -66, -66, -68, -70, -74, -78, -79, -81,
+ -81, -83, -84, -87, -93, -96, -99, -103,
+ -107, -110, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -108, -103, -98,
+ -93, -89, -85, -82, -78, -71, -62, -55,
+ -58, -58, -54, -54, -55, -59, -61, -62,
+ -70, -66, -66, -67, -70, -72, -75, -78,
+ -84, -84, -84, -88, -91, -90, -95, -98,
+ -102, -103, -106, -110, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -108, -103, -98, -94,
+ -90, -87, -82, -79, -73, -67, -58, -47,
+ -50, -45, -41, -45, -48, -44, -44, -49,
+ -54, -51, -48, -47, -49, -50, -51, -57,
+ -58, -60, -63, -69, -70, -69, -71, -74,
+ -78, -82, -90, -95, -101, -105, -110, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -105, -101, -97, -93, -90,
+ -85, -80, -77, -72, -65, -56, -48, -37,
+ -40, -36, -34, -40, -50, -47, -38, -41,
+ -47, -38, -35, -39, -38, -43, -40, -45,
+ -50, -45, -44, -47, -50, -55, -48, -48,
+ -52, -66, -70, -76, -82, -90, -97, -105,
+ -110, -999, -999, -999, -999, -999, -999, -999}},
+ /* 707 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -108, -103, -98, -93, -86, -79, -76,
+ -83, -81, -85, -87, -89, -93, -98, -102,
+ -107, -112, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -108, -103, -98, -93, -86, -79, -71,
+ -77, -74, -77, -79, -81, -84, -85, -90,
+ -92, -93, -92, -98, -101, -108, -112, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -108, -103, -98, -93, -87, -78, -68, -65,
+ -66, -62, -65, -67, -70, -73, -75, -78,
+ -82, -82, -83, -84, -91, -93, -98, -102,
+ -106, -110, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -105, -100, -95, -90, -82, -74, -62, -57,
+ -58, -56, -51, -52, -52, -54, -54, -58,
+ -66, -59, -60, -63, -66, -69, -73, -79,
+ -83, -84, -80, -81, -81, -82, -88, -92,
+ -98, -105, -113, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -107,
+ -102, -97, -92, -84, -79, -69, -57, -47,
+ -52, -47, -44, -45, -50, -52, -42, -42,
+ -53, -43, -43, -48, -51, -56, -55, -52,
+ -57, -59, -61, -62, -67, -71, -78, -83,
+ -86, -94, -98, -103, -110, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -105, -100,
+ -95, -90, -84, -78, -70, -61, -51, -41,
+ -40, -38, -40, -46, -52, -51, -41, -40,
+ -46, -40, -38, -38, -41, -46, -41, -46,
+ -47, -43, -43, -45, -41, -45, -56, -67,
+ -68, -83, -87, -90, -95, -102, -107, -113,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 1000 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -109, -105, -101, -96, -91, -84, -77,
+ -82, -82, -85, -89, -94, -100, -106, -110,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -106, -103, -98, -92, -85, -80, -71,
+ -75, -72, -76, -80, -84, -86, -89, -93,
+ -100, -107, -113, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -107,
+ -104, -101, -97, -92, -88, -84, -80, -64,
+ -66, -63, -64, -66, -69, -73, -77, -83,
+ -83, -86, -91, -98, -104, -111, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -107,
+ -104, -101, -97, -92, -90, -84, -74, -57,
+ -58, -52, -55, -54, -50, -52, -50, -52,
+ -63, -62, -69, -76, -77, -78, -78, -79,
+ -82, -88, -94, -100, -106, -111, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -106, -102,
+ -98, -95, -90, -85, -83, -78, -70, -50,
+ -50, -41, -44, -49, -47, -50, -50, -44,
+ -55, -46, -47, -48, -48, -54, -49, -49,
+ -58, -62, -71, -81, -87, -92, -97, -102,
+ -108, -114, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -106, -102,
+ -98, -95, -90, -85, -83, -78, -70, -45,
+ -43, -41, -47, -50, -51, -50, -49, -45,
+ -47, -41, -44, -41, -39, -43, -38, -37,
+ -40, -41, -44, -50, -58, -65, -73, -79,
+ -85, -92, -97, -101, -105, -109, -113, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 1414 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -107, -100, -95, -87, -81,
+ -85, -83, -88, -93, -100, -107, -114, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -107, -101, -95, -88, -83, -76,
+ -73, -72, -79, -84, -90, -95, -100, -105,
+ -110, -115, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -104, -98, -92, -87, -81, -70,
+ -65, -62, -67, -71, -74, -80, -85, -91,
+ -95, -99, -103, -108, -111, -114, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -103, -97, -90, -85, -76, -60,
+ -56, -54, -60, -62, -61, -56, -63, -65,
+ -73, -74, -77, -75, -78, -81, -86, -87,
+ -88, -91, -94, -98, -103, -110, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -105,
+ -100, -97, -92, -86, -81, -79, -70, -57,
+ -51, -47, -51, -58, -60, -56, -53, -50,
+ -58, -52, -50, -50, -53, -55, -64, -69,
+ -71, -85, -82, -78, -81, -85, -95, -102,
+ -112, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -105,
+ -100, -97, -92, -85, -83, -79, -72, -49,
+ -40, -43, -43, -54, -56, -51, -50, -40,
+ -43, -38, -36, -35, -37, -38, -37, -44,
+ -54, -60, -57, -60, -70, -75, -84, -92,
+ -103, -112, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 2000 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -102, -95, -89, -82,
+ -83, -84, -90, -92, -99, -107, -113, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -107, -101, -95, -89, -83, -72,
+ -74, -78, -85, -88, -88, -90, -92, -98,
+ -105, -111, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -109, -103, -97, -93, -87, -81, -70,
+ -70, -67, -75, -73, -76, -79, -81, -83,
+ -88, -89, -97, -103, -110, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -107, -100, -94, -88, -83, -75, -63,
+ -59, -59, -63, -66, -60, -62, -67, -67,
+ -77, -76, -81, -88, -86, -92, -96, -102,
+ -109, -116, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -105, -98, -92, -86, -81, -73, -56,
+ -52, -47, -55, -60, -58, -52, -51, -45,
+ -49, -50, -53, -54, -61, -71, -70, -69,
+ -78, -79, -87, -90, -96, -104, -112, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -103, -96, -90, -86, -78, -70, -51,
+ -42, -47, -48, -55, -54, -54, -53, -42,
+ -35, -28, -33, -38, -37, -44, -47, -49,
+ -54, -63, -68, -78, -82, -89, -94, -99,
+ -104, -109, -114, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 2828 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -110, -100, -90, -79,
+ -85, -81, -82, -82, -89, -94, -99, -103,
+ -109, -115, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -105, -97, -85, -72,
+ -74, -70, -70, -70, -76, -85, -91, -93,
+ -97, -103, -109, -115, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -112, -93, -81, -68,
+ -62, -60, -60, -57, -63, -70, -77, -82,
+ -90, -93, -98, -104, -109, -113, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -113, -100, -93, -84, -63,
+ -58, -48, -53, -54, -52, -52, -57, -64,
+ -66, -76, -83, -81, -85, -85, -90, -95,
+ -98, -101, -103, -106, -108, -111, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -105, -95, -86, -74, -53,
+ -50, -38, -43, -49, -43, -42, -39, -39,
+ -46, -52, -57, -56, -72, -69, -74, -81,
+ -87, -92, -94, -97, -99, -102, -105, -108,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -108, -99, -90, -76, -66, -45,
+ -43, -41, -44, -47, -43, -47, -40, -30,
+ -31, -31, -39, -33, -40, -41, -43, -53,
+ -59, -70, -73, -77, -79, -82, -84, -87,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 4000 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -110, -91, -76,
+ -75, -85, -93, -98, -104, -110, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -110, -91, -70,
+ -70, -75, -86, -89, -94, -98, -101, -106,
+ -110, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -110, -95, -80, -60,
+ -65, -64, -74, -83, -88, -91, -95, -99,
+ -103, -107, -110, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -110, -95, -80, -58,
+ -55, -49, -66, -68, -71, -78, -78, -80,
+ -88, -85, -89, -97, -100, -105, -110, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -110, -95, -80, -53,
+ -52, -41, -59, -59, -49, -58, -56, -63,
+ -86, -79, -90, -93, -98, -103, -107, -112,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -97, -91, -73, -45,
+ -40, -33, -53, -61, -49, -54, -50, -50,
+ -60, -52, -67, -74, -81, -92, -96, -100,
+ -105, -110, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 5657 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -113, -106, -99, -92, -77,
+ -80, -88, -97, -106, -115, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -116, -109, -102, -95, -89, -74,
+ -72, -88, -87, -95, -102, -109, -116, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -116, -109, -102, -95, -89, -75,
+ -66, -74, -77, -78, -86, -87, -90, -96,
+ -105, -115, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -115, -108, -101, -94, -88, -66,
+ -56, -61, -70, -65, -78, -72, -83, -84,
+ -93, -98, -105, -110, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -110, -105, -95, -89, -82, -57,
+ -52, -52, -59, -56, -59, -58, -69, -67,
+ -88, -82, -82, -89, -94, -100, -108, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -110, -101, -96, -90, -83, -77, -54,
+ -43, -38, -50, -48, -52, -48, -42, -42,
+ -51, -52, -53, -59, -65, -71, -78, -85,
+ -95, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 8000 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -120, -105, -86, -68,
+ -78, -79, -90, -100, -110, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -120, -105, -86, -66,
+ -73, -77, -88, -96, -105, -115, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -120, -105, -92, -80, -61,
+ -64, -68, -80, -87, -92, -100, -110, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -120, -104, -91, -79, -52,
+ -60, -54, -64, -69, -77, -80, -82, -84,
+ -85, -87, -88, -90, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -118, -100, -87, -77, -49,
+ -50, -44, -58, -61, -61, -67, -65, -62,
+ -62, -62, -65, -68, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -115, -98, -84, -62, -49,
+ -44, -38, -46, -49, -49, -46, -39, -37,
+ -39, -40, -42, -43, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 11314 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -110, -88, -74,
+ -77, -82, -82, -85, -90, -94, -99, -104,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -110, -88, -66,
+ -70, -81, -80, -81, -84, -88, -91, -93,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -110, -88, -61,
+ -63, -70, -71, -74, -77, -80, -83, -85,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -110, -86, -62,
+ -63, -62, -62, -58, -52, -50, -50, -52,
+ -54, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -118, -108, -84, -53,
+ -50, -50, -50, -55, -47, -45, -40, -40,
+ -40, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -118, -100, -73, -43,
+ -37, -42, -43, -53, -38, -37, -35, -35,
+ -38, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}},
+ /* 16000 Hz */
+ {{-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -100, -91, -84, -74,
+ -80, -80, -80, -80, -80, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -100, -91, -84, -74,
+ -68, -68, -68, -68, -68, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -100, -86, -78, -70,
+ -60, -45, -30, -21, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -100, -87, -78, -67,
+ -48, -38, -29, -21, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -100, -86, -69, -56,
+ -45, -35, -33, -29, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999},
+ {-999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -110, -100, -83, -71, -48,
+ -27, -38, -37, -34, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999,
+ -999, -999, -999, -999, -999, -999, -999, -999}}
};
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.c b/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.c
index 7e43c205d..081633180 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.c
@@ -49,552 +49,515 @@
/* build lookups for trig functions; also pre-figure scaling and
some window function algebra. */
-void mdct_init(mdct_lookup *lookup, int n)
-{
- int *bitrev = _ogg_malloc(sizeof(*bitrev) * (n / 4));
- DATA_TYPE *T = _ogg_malloc(sizeof(*T) * (n + n / 4));
-
- int i;
- int n2 = n >> 1;
- int log2n = lookup->log2n = rint(log((float)n) / log(2.f));
- lookup->n = n;
- lookup->trig = T;
- lookup->bitrev = bitrev;
-
- /* trig lookups... */
-
- for(i = 0; i < n / 4; i++)
- {
- T[i*2] = FLOAT_CONV(cos((M_PI / n) * (4 * i)));
- T[i*2+1] = FLOAT_CONV(-sin((M_PI / n) * (4 * i)));
- T[n2+i*2] = FLOAT_CONV(cos((M_PI / (2 * n)) * (2 * i + 1)));
- T[n2+i*2+1] = FLOAT_CONV(sin((M_PI / (2 * n)) * (2 * i + 1)));
- }
- for(i = 0; i < n / 8; i++)
- {
- T[n+i*2] = FLOAT_CONV(cos((M_PI / n) * (4 * i + 2)) * .5);
- T[n+i*2+1] = FLOAT_CONV(-sin((M_PI / n) * (4 * i + 2)) * .5);
- }
-
- /* bitreverse lookup... */
-
- {
- int mask = (1 << (log2n - 1)) - 1, i, j;
- int msb = 1 << (log2n - 2);
- for(i = 0; i < n / 8; i++)
- {
- int acc = 0;
- for(j = 0; msb >> j; j++)
- if((msb >> j)&i)acc |= 1 << j;
- bitrev[i*2] = ((~acc)&mask) - 1;
- bitrev[i*2+1] = acc;
+void mdct_init(mdct_lookup *lookup,int n){
+ int *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4));
+ DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4));
+
+ int i;
+ int n2=n>>1;
+ int log2n=lookup->log2n=rint(log((float)n)/log(2.f));
+ lookup->n=n;
+ lookup->trig=T;
+ lookup->bitrev=bitrev;
+
+/* trig lookups... */
+
+ for(i=0;i<n/4;i++){
+ T[i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i)));
+ T[i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i)));
+ T[n2+i*2]=FLOAT_CONV(cos((M_PI/(2*n))*(2*i+1)));
+ T[n2+i*2+1]=FLOAT_CONV(sin((M_PI/(2*n))*(2*i+1)));
+ }
+ for(i=0;i<n/8;i++){
+ T[n+i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i+2))*.5);
+ T[n+i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i+2))*.5);
+ }
+
+ /* bitreverse lookup... */
+
+ {
+ int mask=(1<<(log2n-1))-1,i,j;
+ int msb=1<<(log2n-2);
+ for(i=0;i<n/8;i++){
+ int acc=0;
+ for(j=0;msb>>j;j++)
+ if((msb>>j)&i)acc|=1<<j;
+ bitrev[i*2]=((~acc)&mask)-1;
+ bitrev[i*2+1]=acc;
- }
}
- lookup->scale = FLOAT_CONV(4.f / n);
+ }
+ lookup->scale=FLOAT_CONV(4.f/n);
}
/* 8 point butterfly (in place, 4 register) */
-STIN void mdct_butterfly_8(DATA_TYPE *x)
-{
- REG_TYPE r0 = x[6] + x[2];
- REG_TYPE r1 = x[6] - x[2];
- REG_TYPE r2 = x[4] + x[0];
- REG_TYPE r3 = x[4] - x[0];
-
- x[6] = r0 + r2;
- x[4] = r0 - r2;
-
- r0 = x[5] - x[1];
- r2 = x[7] - x[3];
- x[0] = r1 + r0;
- x[2] = r1 - r0;
-
- r0 = x[5] + x[1];
- r1 = x[7] + x[3];
- x[3] = r2 + r3;
- x[1] = r2 - r3;
- x[7] = r1 + r0;
- x[5] = r1 - r0;
+STIN void mdct_butterfly_8(DATA_TYPE *x){
+ REG_TYPE r0 = x[6] + x[2];
+ REG_TYPE r1 = x[6] - x[2];
+ REG_TYPE r2 = x[4] + x[0];
+ REG_TYPE r3 = x[4] - x[0];
+
+ x[6] = r0 + r2;
+ x[4] = r0 - r2;
+
+ r0 = x[5] - x[1];
+ r2 = x[7] - x[3];
+ x[0] = r1 + r0;
+ x[2] = r1 - r0;
+
+ r0 = x[5] + x[1];
+ r1 = x[7] + x[3];
+ x[3] = r2 + r3;
+ x[1] = r2 - r3;
+ x[7] = r1 + r0;
+ x[5] = r1 - r0;
}
/* 16 point butterfly (in place, 4 register) */
-STIN void mdct_butterfly_16(DATA_TYPE *x)
-{
- REG_TYPE r0 = x[1] - x[9];
- REG_TYPE r1 = x[0] - x[8];
-
- x[8] += x[0];
- x[9] += x[1];
- x[0] = MULT_NORM((r0 + r1) * cPI2_8);
- x[1] = MULT_NORM((r0 - r1) * cPI2_8);
-
- r0 = x[3] - x[11];
- r1 = x[10] - x[2];
- x[10] += x[2];
- x[11] += x[3];
- x[2] = r0;
- x[3] = r1;
-
- r0 = x[12] - x[4];
- r1 = x[13] - x[5];
- x[12] += x[4];
- x[13] += x[5];
- x[4] = MULT_NORM((r0 - r1) * cPI2_8);
- x[5] = MULT_NORM((r0 + r1) * cPI2_8);
-
- r0 = x[14] - x[6];
- r1 = x[15] - x[7];
- x[14] += x[6];
- x[15] += x[7];
- x[6] = r0;
- x[7] = r1;
-
- mdct_butterfly_8(x);
- mdct_butterfly_8(x + 8);
+STIN void mdct_butterfly_16(DATA_TYPE *x){
+ REG_TYPE r0 = x[1] - x[9];
+ REG_TYPE r1 = x[0] - x[8];
+
+ x[8] += x[0];
+ x[9] += x[1];
+ x[0] = MULT_NORM((r0 + r1) * cPI2_8);
+ x[1] = MULT_NORM((r0 - r1) * cPI2_8);
+
+ r0 = x[3] - x[11];
+ r1 = x[10] - x[2];
+ x[10] += x[2];
+ x[11] += x[3];
+ x[2] = r0;
+ x[3] = r1;
+
+ r0 = x[12] - x[4];
+ r1 = x[13] - x[5];
+ x[12] += x[4];
+ x[13] += x[5];
+ x[4] = MULT_NORM((r0 - r1) * cPI2_8);
+ x[5] = MULT_NORM((r0 + r1) * cPI2_8);
+
+ r0 = x[14] - x[6];
+ r1 = x[15] - x[7];
+ x[14] += x[6];
+ x[15] += x[7];
+ x[6] = r0;
+ x[7] = r1;
+
+ mdct_butterfly_8(x);
+ mdct_butterfly_8(x+8);
}
/* 32 point butterfly (in place, 4 register) */
-STIN void mdct_butterfly_32(DATA_TYPE *x)
-{
- REG_TYPE r0 = x[30] - x[14];
- REG_TYPE r1 = x[31] - x[15];
-
- x[30] += x[14];
- x[31] += x[15];
- x[14] = r0;
- x[15] = r1;
-
- r0 = x[28] - x[12];
- r1 = x[29] - x[13];
- x[28] += x[12];
- x[29] += x[13];
- x[12] = MULT_NORM(r0 * cPI1_8 - r1 * cPI3_8);
- x[13] = MULT_NORM(r0 * cPI3_8 + r1 * cPI1_8);
-
- r0 = x[26] - x[10];
- r1 = x[27] - x[11];
- x[26] += x[10];
- x[27] += x[11];
- x[10] = MULT_NORM((r0 - r1) * cPI2_8);
- x[11] = MULT_NORM((r0 + r1) * cPI2_8);
-
- r0 = x[24] - x[8];
- r1 = x[25] - x[9];
- x[24] += x[8];
- x[25] += x[9];
- x[8] = MULT_NORM(r0 * cPI3_8 - r1 * cPI1_8);
- x[9] = MULT_NORM(r1 * cPI3_8 + r0 * cPI1_8);
-
- r0 = x[22] - x[6];
- r1 = x[7] - x[23];
- x[22] += x[6];
- x[23] += x[7];
- x[6] = r1;
- x[7] = r0;
-
- r0 = x[4] - x[20];
- r1 = x[5] - x[21];
- x[20] += x[4];
- x[21] += x[5];
- x[4] = MULT_NORM(r1 * cPI1_8 + r0 * cPI3_8);
- x[5] = MULT_NORM(r1 * cPI3_8 - r0 * cPI1_8);
-
- r0 = x[2] - x[18];
- r1 = x[3] - x[19];
- x[18] += x[2];
- x[19] += x[3];
- x[2] = MULT_NORM((r1 + r0) * cPI2_8);
- x[3] = MULT_NORM((r1 - r0) * cPI2_8);
-
- r0 = x[0] - x[16];
- r1 = x[1] - x[17];
- x[16] += x[0];
- x[17] += x[1];
- x[0] = MULT_NORM(r1 * cPI3_8 + r0 * cPI1_8);
- x[1] = MULT_NORM(r1 * cPI1_8 - r0 * cPI3_8);
-
- mdct_butterfly_16(x);
- mdct_butterfly_16(x + 16);
+STIN void mdct_butterfly_32(DATA_TYPE *x){
+ REG_TYPE r0 = x[30] - x[14];
+ REG_TYPE r1 = x[31] - x[15];
+
+ x[30] += x[14];
+ x[31] += x[15];
+ x[14] = r0;
+ x[15] = r1;
+
+ r0 = x[28] - x[12];
+ r1 = x[29] - x[13];
+ x[28] += x[12];
+ x[29] += x[13];
+ x[12] = MULT_NORM( r0 * cPI1_8 - r1 * cPI3_8 );
+ x[13] = MULT_NORM( r0 * cPI3_8 + r1 * cPI1_8 );
+
+ r0 = x[26] - x[10];
+ r1 = x[27] - x[11];
+ x[26] += x[10];
+ x[27] += x[11];
+ x[10] = MULT_NORM(( r0 - r1 ) * cPI2_8);
+ x[11] = MULT_NORM(( r0 + r1 ) * cPI2_8);
+
+ r0 = x[24] - x[8];
+ r1 = x[25] - x[9];
+ x[24] += x[8];
+ x[25] += x[9];
+ x[8] = MULT_NORM( r0 * cPI3_8 - r1 * cPI1_8 );
+ x[9] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 );
+
+ r0 = x[22] - x[6];
+ r1 = x[7] - x[23];
+ x[22] += x[6];
+ x[23] += x[7];
+ x[6] = r1;
+ x[7] = r0;
+
+ r0 = x[4] - x[20];
+ r1 = x[5] - x[21];
+ x[20] += x[4];
+ x[21] += x[5];
+ x[4] = MULT_NORM( r1 * cPI1_8 + r0 * cPI3_8 );
+ x[5] = MULT_NORM( r1 * cPI3_8 - r0 * cPI1_8 );
+
+ r0 = x[2] - x[18];
+ r1 = x[3] - x[19];
+ x[18] += x[2];
+ x[19] += x[3];
+ x[2] = MULT_NORM(( r1 + r0 ) * cPI2_8);
+ x[3] = MULT_NORM(( r1 - r0 ) * cPI2_8);
+
+ r0 = x[0] - x[16];
+ r1 = x[1] - x[17];
+ x[16] += x[0];
+ x[17] += x[1];
+ x[0] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 );
+ x[1] = MULT_NORM( r1 * cPI1_8 - r0 * cPI3_8 );
+
+ mdct_butterfly_16(x);
+ mdct_butterfly_16(x+16);
}
/* N point first stage butterfly (in place, 2 register) */
STIN void mdct_butterfly_first(DATA_TYPE *T,
- DATA_TYPE *x,
- int points)
-{
-
- DATA_TYPE *x1 = x + points - 8;
- DATA_TYPE *x2 = x + (points >> 1) - 8;
- REG_TYPE r0;
- REG_TYPE r1;
-
- do
- {
-
- r0 = x1[6] - x2[6];
- r1 = x1[7] - x2[7];
- x1[6] += x2[6];
- x1[7] += x2[7];
- x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
-
- r0 = x1[4] - x2[4];
- r1 = x1[5] - x2[5];
- x1[4] += x2[4];
- x1[5] += x2[5];
- x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]);
- x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]);
-
- r0 = x1[2] - x2[2];
- r1 = x1[3] - x2[3];
- x1[2] += x2[2];
- x1[3] += x2[3];
- x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]);
- x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]);
-
- r0 = x1[0] - x2[0];
- r1 = x1[1] - x2[1];
- x1[0] += x2[0];
- x1[1] += x2[1];
- x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]);
- x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]);
-
- x1 -= 8;
- x2 -= 8;
- T += 16;
-
- }
- while(x2 >= x);
+ DATA_TYPE *x,
+ int points){
+
+ DATA_TYPE *x1 = x + points - 8;
+ DATA_TYPE *x2 = x + (points>>1) - 8;
+ REG_TYPE r0;
+ REG_TYPE r1;
+
+ do{
+
+ r0 = x1[6] - x2[6];
+ r1 = x1[7] - x2[7];
+ x1[6] += x2[6];
+ x1[7] += x2[7];
+ x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
+ x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
+
+ r0 = x1[4] - x2[4];
+ r1 = x1[5] - x2[5];
+ x1[4] += x2[4];
+ x1[5] += x2[5];
+ x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]);
+ x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]);
+
+ r0 = x1[2] - x2[2];
+ r1 = x1[3] - x2[3];
+ x1[2] += x2[2];
+ x1[3] += x2[3];
+ x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]);
+ x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]);
+
+ r0 = x1[0] - x2[0];
+ r1 = x1[1] - x2[1];
+ x1[0] += x2[0];
+ x1[1] += x2[1];
+ x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]);
+ x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]);
+
+ x1-=8;
+ x2-=8;
+ T+=16;
+
+ }while(x2>=x);
}
/* N/stage point generic N stage butterfly (in place, 2 register) */
STIN void mdct_butterfly_generic(DATA_TYPE *T,
- DATA_TYPE *x,
- int points,
- int trigint)
-{
-
- DATA_TYPE *x1 = x + points - 8;
- DATA_TYPE *x2 = x + (points >> 1) - 8;
- REG_TYPE r0;
- REG_TYPE r1;
-
- do
- {
-
- r0 = x1[6] - x2[6];
- r1 = x1[7] - x2[7];
- x1[6] += x2[6];
- x1[7] += x2[7];
- x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
-
- T += trigint;
-
- r0 = x1[4] - x2[4];
- r1 = x1[5] - x2[5];
- x1[4] += x2[4];
- x1[5] += x2[5];
- x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]);
-
- T += trigint;
-
- r0 = x1[2] - x2[2];
- r1 = x1[3] - x2[3];
- x1[2] += x2[2];
- x1[3] += x2[3];
- x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]);
-
- T += trigint;
-
- r0 = x1[0] - x2[0];
- r1 = x1[1] - x2[1];
- x1[0] += x2[0];
- x1[1] += x2[1];
- x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
-
- T += trigint;
- x1 -= 8;
- x2 -= 8;
-
- }
- while(x2 >= x);
+ DATA_TYPE *x,
+ int points,
+ int trigint){
+
+ DATA_TYPE *x1 = x + points - 8;
+ DATA_TYPE *x2 = x + (points>>1) - 8;
+ REG_TYPE r0;
+ REG_TYPE r1;
+
+ do{
+
+ r0 = x1[6] - x2[6];
+ r1 = x1[7] - x2[7];
+ x1[6] += x2[6];
+ x1[7] += x2[7];
+ x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
+ x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
+
+ T+=trigint;
+
+ r0 = x1[4] - x2[4];
+ r1 = x1[5] - x2[5];
+ x1[4] += x2[4];
+ x1[5] += x2[5];
+ x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]);
+ x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]);
+
+ T+=trigint;
+
+ r0 = x1[2] - x2[2];
+ r1 = x1[3] - x2[3];
+ x1[2] += x2[2];
+ x1[3] += x2[3];
+ x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]);
+ x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]);
+
+ T+=trigint;
+
+ r0 = x1[0] - x2[0];
+ r1 = x1[1] - x2[1];
+ x1[0] += x2[0];
+ x1[1] += x2[1];
+ x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]);
+ x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
+
+ T+=trigint;
+ x1-=8;
+ x2-=8;
+
+ }while(x2>=x);
}
STIN void mdct_butterflies(mdct_lookup *init,
- DATA_TYPE *x,
- int points)
-{
+ DATA_TYPE *x,
+ int points){
- DATA_TYPE *T = init->trig;
- int stages = init->log2n - 5;
- int i, j;
+ DATA_TYPE *T=init->trig;
+ int stages=init->log2n-5;
+ int i,j;
- if(--stages > 0)
- {
- mdct_butterfly_first(T, x, points);
- }
+ if(--stages>0){
+ mdct_butterfly_first(T,x,points);
+ }
- for(i = 1; --stages > 0; i++)
- {
- for(j = 0; j < (1 << i); j++)
- mdct_butterfly_generic(T, x + (points >> i)*j, points >> i, 4 << i);
- }
+ for(i=1;--stages>0;i++){
+ for(j=0;j<(1<<i);j++)
+ mdct_butterfly_generic(T,x+(points>>i)*j,points>>i,4<<i);
+ }
- for(j = 0; j < points; j += 32)
- mdct_butterfly_32(x + j);
+ for(j=0;j<points;j+=32)
+ mdct_butterfly_32(x+j);
}
-void mdct_clear(mdct_lookup *l)
-{
- if(l)
- {
- if(l->trig)_ogg_free(l->trig);
- if(l->bitrev)_ogg_free(l->bitrev);
- memset(l, 0, sizeof(*l));
- }
+void mdct_clear(mdct_lookup *l){
+ if(l){
+ if(l->trig)_ogg_free(l->trig);
+ if(l->bitrev)_ogg_free(l->bitrev);
+ memset(l,0,sizeof(*l));
+ }
}
STIN void mdct_bitreverse(mdct_lookup *init,
- DATA_TYPE *x)
-{
- int n = init->n;
- int *bit = init->bitrev;
- DATA_TYPE *w0 = x;
- DATA_TYPE *w1 = x = w0 + (n >> 1);
- DATA_TYPE *T = init->trig + n;
-
- do
- {
- DATA_TYPE *x0 = x + bit[0];
- DATA_TYPE *x1 = x + bit[1];
-
- REG_TYPE r0 = x0[1] - x1[1];
- REG_TYPE r1 = x0[0] + x1[0];
- REG_TYPE r2 = MULT_NORM(r1 * T[0] + r0 * T[1]);
- REG_TYPE r3 = MULT_NORM(r1 * T[1] - r0 * T[0]);
-
- w1 -= 4;
-
- r0 = HALVE(x0[1] + x1[1]);
- r1 = HALVE(x0[0] - x1[0]);
-
- w0[0] = r0 + r2;
- w1[2] = r0 - r2;
- w0[1] = r1 + r3;
- w1[3] = r3 - r1;
-
- x0 = x + bit[2];
- x1 = x + bit[3];
-
- r0 = x0[1] - x1[1];
- r1 = x0[0] + x1[0];
- r2 = MULT_NORM(r1 * T[2] + r0 * T[3]);
- r3 = MULT_NORM(r1 * T[3] - r0 * T[2]);
-
- r0 = HALVE(x0[1] + x1[1]);
- r1 = HALVE(x0[0] - x1[0]);
-
- w0[2] = r0 + r2;
- w1[0] = r0 - r2;
- w0[3] = r1 + r3;
- w1[1] = r3 - r1;
-
- T += 4;
- bit += 4;
- w0 += 4;
+ DATA_TYPE *x){
+ int n = init->n;
+ int *bit = init->bitrev;
+ DATA_TYPE *w0 = x;
+ DATA_TYPE *w1 = x = w0+(n>>1);
+ DATA_TYPE *T = init->trig+n;
- }
- while(w0 < w1);
-}
+ do{
+ DATA_TYPE *x0 = x+bit[0];
+ DATA_TYPE *x1 = x+bit[1];
-void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out)
-{
- int n = init->n;
- int n2 = n >> 1;
- int n4 = n >> 2;
-
- /* rotate */
-
- DATA_TYPE *iX = in + n2 - 7;
- DATA_TYPE *oX = out + n2 + n4;
- DATA_TYPE *T = init->trig + n4;
-
- do
- {
- oX -= 4;
- oX[0] = MULT_NORM(-iX[2] * T[3] - iX[0] * T[2]);
- oX[1] = MULT_NORM(iX[0] * T[3] - iX[2] * T[2]);
- oX[2] = MULT_NORM(-iX[6] * T[1] - iX[4] * T[0]);
- oX[3] = MULT_NORM(iX[4] * T[1] - iX[6] * T[0]);
- iX -= 8;
- T += 4;
- }
- while(iX >= in);
-
- iX = in + n2 - 8;
- oX = out + n2 + n4;
- T = init->trig + n4;
-
- do
- {
- T -= 4;
- oX[0] = MULT_NORM(iX[4] * T[3] + iX[6] * T[2]);
- oX[1] = MULT_NORM(iX[4] * T[2] - iX[6] * T[3]);
- oX[2] = MULT_NORM(iX[0] * T[1] + iX[2] * T[0]);
- oX[3] = MULT_NORM(iX[0] * T[0] - iX[2] * T[1]);
- iX -= 8;
- oX += 4;
- }
- while(iX >= in);
-
- mdct_butterflies(init, out + n2, n2);
- mdct_bitreverse(init, out);
-
- /* roatate + window */
-
- {
- DATA_TYPE *oX1 = out + n2 + n4;
- DATA_TYPE *oX2 = out + n2 + n4;
- DATA_TYPE *iX = out;
- T = init->trig + n2;
-
- do
- {
- oX1 -= 4;
-
- oX1[3] = MULT_NORM(iX[0] * T[1] - iX[1] * T[0]);
- oX2[0] = -MULT_NORM(iX[0] * T[0] + iX[1] * T[1]);
-
- oX1[2] = MULT_NORM(iX[2] * T[3] - iX[3] * T[2]);
- oX2[1] = -MULT_NORM(iX[2] * T[2] + iX[3] * T[3]);
-
- oX1[1] = MULT_NORM(iX[4] * T[5] - iX[5] * T[4]);
- oX2[2] = -MULT_NORM(iX[4] * T[4] + iX[5] * T[5]);
-
- oX1[0] = MULT_NORM(iX[6] * T[7] - iX[7] * T[6]);
- oX2[3] = -MULT_NORM(iX[6] * T[6] + iX[7] * T[7]);
-
- oX2 += 4;
- iX += 8;
- T += 8;
- }
- while(iX < oX1);
-
- iX = out + n2 + n4;
- oX1 = out + n4;
- oX2 = oX1;
-
- do
- {
- oX1 -= 4;
- iX -= 4;
-
- oX2[0] = -(oX1[3] = iX[3]);
- oX2[1] = -(oX1[2] = iX[2]);
- oX2[2] = -(oX1[1] = iX[1]);
- oX2[3] = -(oX1[0] = iX[0]);
-
- oX2 += 4;
- }
- while(oX2 < iX);
-
- iX = out + n2 + n4;
- oX1 = out + n2 + n4;
- oX2 = out + n2;
- do
- {
- oX1 -= 4;
- oX1[0] = iX[3];
- oX1[1] = iX[2];
- oX1[2] = iX[1];
- oX1[3] = iX[0];
- iX += 4;
- }
- while(oX1 > oX2);
- }
-}
+ REG_TYPE r0 = x0[1] - x1[1];
+ REG_TYPE r1 = x0[0] + x1[0];
+ REG_TYPE r2 = MULT_NORM(r1 * T[0] + r0 * T[1]);
+ REG_TYPE r3 = MULT_NORM(r1 * T[1] - r0 * T[0]);
-void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out)
-{
- int n = init->n;
- int n2 = n >> 1;
- int n4 = n >> 2;
- int n8 = n >> 3;
- DATA_TYPE *w = alloca(n * sizeof(*w)); /* forward needs working space */
- DATA_TYPE *w2 = w + n2;
-
- /* rotate */
-
- /* window + rotate + step 1 */
-
- REG_TYPE r0;
- REG_TYPE r1;
- DATA_TYPE *x0 = in + n2 + n4;
- DATA_TYPE *x1 = x0 + 1;
- DATA_TYPE *T = init->trig + n2;
-
- int i = 0;
-
- for(i = 0; i < n8; i += 2)
- {
- x0 -= 4;
- T -= 2;
- r0 = x0[2] + x1[0];
- r1 = x0[0] + x1[2];
- w2[i] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- w2[i+1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
- x1 += 4;
- }
+ w1 -= 4;
- x1 = in + 1;
-
- for(; i < n2 - n8; i += 2)
- {
- T -= 2;
- x0 -= 4;
- r0 = x0[2] - x1[0];
- r1 = x0[0] - x1[2];
- w2[i] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- w2[i+1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
- x1 += 4;
- }
+ r0 = HALVE(x0[1] + x1[1]);
+ r1 = HALVE(x0[0] - x1[0]);
- x0 = in + n;
-
- for(; i < n2; i += 2)
- {
- T -= 2;
- x0 -= 4;
- r0 = -x0[2] - x1[0];
- r1 = -x0[0] - x1[2];
- w2[i] = MULT_NORM(r1 * T[1] + r0 * T[0]);
- w2[i+1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
- x1 += 4;
- }
+ w0[0] = r0 + r2;
+ w1[2] = r0 - r2;
+ w0[1] = r1 + r3;
+ w1[3] = r3 - r1;
+ x0 = x+bit[2];
+ x1 = x+bit[3];
- mdct_butterflies(init, w + n2, n2);
- mdct_bitreverse(init, w);
+ r0 = x0[1] - x1[1];
+ r1 = x0[0] + x1[0];
+ r2 = MULT_NORM(r1 * T[2] + r0 * T[3]);
+ r3 = MULT_NORM(r1 * T[3] - r0 * T[2]);
- /* roatate + window */
+ r0 = HALVE(x0[1] + x1[1]);
+ r1 = HALVE(x0[0] - x1[0]);
- T = init->trig + n2;
- x0 = out + n2;
+ w0[2] = r0 + r2;
+ w1[0] = r0 - r2;
+ w0[3] = r1 + r3;
+ w1[1] = r3 - r1;
- for(i = 0; i < n4; i++)
- {
- x0--;
- out[i] = MULT_NORM((w[0] * T[0] + w[1] * T[1]) * init->scale);
- x0[0] = MULT_NORM((w[0] * T[1] - w[1] * T[0]) * init->scale);
- w += 2;
- T += 2;
- }
+ T += 4;
+ bit += 4;
+ w0 += 4;
+
+ }while(w0<w1);
+}
+
+void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
+ int n=init->n;
+ int n2=n>>1;
+ int n4=n>>2;
+
+ /* rotate */
+
+ DATA_TYPE *iX = in+n2-7;
+ DATA_TYPE *oX = out+n2+n4;
+ DATA_TYPE *T = init->trig+n4;
+
+ do{
+ oX -= 4;
+ oX[0] = MULT_NORM(-iX[2] * T[3] - iX[0] * T[2]);
+ oX[1] = MULT_NORM (iX[0] * T[3] - iX[2] * T[2]);
+ oX[2] = MULT_NORM(-iX[6] * T[1] - iX[4] * T[0]);
+ oX[3] = MULT_NORM (iX[4] * T[1] - iX[6] * T[0]);
+ iX -= 8;
+ T += 4;
+ }while(iX>=in);
+
+ iX = in+n2-8;
+ oX = out+n2+n4;
+ T = init->trig+n4;
+
+ do{
+ T -= 4;
+ oX[0] = MULT_NORM (iX[4] * T[3] + iX[6] * T[2]);
+ oX[1] = MULT_NORM (iX[4] * T[2] - iX[6] * T[3]);
+ oX[2] = MULT_NORM (iX[0] * T[1] + iX[2] * T[0]);
+ oX[3] = MULT_NORM (iX[0] * T[0] - iX[2] * T[1]);
+ iX -= 8;
+ oX += 4;
+ }while(iX>=in);
+
+ mdct_butterflies(init,out+n2,n2);
+ mdct_bitreverse(init,out);
+
+ /* roatate + window */
+
+ {
+ DATA_TYPE *oX1=out+n2+n4;
+ DATA_TYPE *oX2=out+n2+n4;
+ DATA_TYPE *iX =out;
+ T =init->trig+n2;
+
+ do{
+ oX1-=4;
+
+ oX1[3] = MULT_NORM (iX[0] * T[1] - iX[1] * T[0]);
+ oX2[0] = -MULT_NORM (iX[0] * T[0] + iX[1] * T[1]);
+
+ oX1[2] = MULT_NORM (iX[2] * T[3] - iX[3] * T[2]);
+ oX2[1] = -MULT_NORM (iX[2] * T[2] + iX[3] * T[3]);
+
+ oX1[1] = MULT_NORM (iX[4] * T[5] - iX[5] * T[4]);
+ oX2[2] = -MULT_NORM (iX[4] * T[4] + iX[5] * T[5]);
+
+ oX1[0] = MULT_NORM (iX[6] * T[7] - iX[7] * T[6]);
+ oX2[3] = -MULT_NORM (iX[6] * T[6] + iX[7] * T[7]);
+
+ oX2+=4;
+ iX += 8;
+ T += 8;
+ }while(iX<oX1);
+
+ iX=out+n2+n4;
+ oX1=out+n4;
+ oX2=oX1;
+
+ do{
+ oX1-=4;
+ iX-=4;
+
+ oX2[0] = -(oX1[3] = iX[3]);
+ oX2[1] = -(oX1[2] = iX[2]);
+ oX2[2] = -(oX1[1] = iX[1]);
+ oX2[3] = -(oX1[0] = iX[0]);
+
+ oX2+=4;
+ }while(oX2<iX);
+
+ iX=out+n2+n4;
+ oX1=out+n2+n4;
+ oX2=out+n2;
+ do{
+ oX1-=4;
+ oX1[0]= iX[3];
+ oX1[1]= iX[2];
+ oX1[2]= iX[1];
+ oX1[3]= iX[0];
+ iX+=4;
+ }while(oX1>oX2);
+ }
+}
+
+void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
+ int n=init->n;
+ int n2=n>>1;
+ int n4=n>>2;
+ int n8=n>>3;
+ DATA_TYPE *w=alloca(n*sizeof(*w)); /* forward needs working space */
+ DATA_TYPE *w2=w+n2;
+
+ /* rotate */
+
+ /* window + rotate + step 1 */
+
+ REG_TYPE r0;
+ REG_TYPE r1;
+ DATA_TYPE *x0=in+n2+n4;
+ DATA_TYPE *x1=x0+1;
+ DATA_TYPE *T=init->trig+n2;
+
+ int i=0;
+
+ for(i=0;i<n8;i+=2){
+ x0 -=4;
+ T-=2;
+ r0= x0[2] + x1[0];
+ r1= x0[0] + x1[2];
+ w2[i]= MULT_NORM(r1*T[1] + r0*T[0]);
+ w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
+ x1 +=4;
+ }
+
+ x1=in+1;
+
+ for(;i<n2-n8;i+=2){
+ T-=2;
+ x0 -=4;
+ r0= x0[2] - x1[0];
+ r1= x0[0] - x1[2];
+ w2[i]= MULT_NORM(r1*T[1] + r0*T[0]);
+ w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
+ x1 +=4;
+ }
+
+ x0=in+n;
+
+ for(;i<n2;i+=2){
+ T-=2;
+ x0 -=4;
+ r0= -x0[2] - x1[0];
+ r1= -x0[0] - x1[2];
+ w2[i]= MULT_NORM(r1*T[1] + r0*T[0]);
+ w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
+ x1 +=4;
+ }
+
+
+ mdct_butterflies(init,w+n2,n2);
+ mdct_bitreverse(init,w);
+
+ /* roatate + window */
+
+ T=init->trig+n2;
+ x0=out+n2;
+
+ for(i=0;i<n4;i++){
+ x0--;
+ out[i] =MULT_NORM((w[0]*T[0]+w[1]*T[1])*init->scale);
+ x0[0] =MULT_NORM((w[0]*T[1]-w[1]*T[0])*init->scale);
+ w+=2;
+ T+=2;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.h b/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.h
index 50c0c837e..3ed94333c 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/mdct.h
@@ -53,18 +53,17 @@
#endif
-typedef struct
-{
- int n;
- int log2n;
+typedef struct {
+ int n;
+ int log2n;
- DATA_TYPE *trig;
- int *bitrev;
+ DATA_TYPE *trig;
+ int *bitrev;
- DATA_TYPE scale;
+ DATA_TYPE scale;
} mdct_lookup;
-extern void mdct_init(mdct_lookup *lookup, int n);
+extern void mdct_init(mdct_lookup *lookup,int n);
extern void mdct_clear(mdct_lookup *l);
extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/misc.h b/src/filters/transform/MpaDecFilter/libvorbisidec/misc.h
index 28e39c01b..85fe3074a 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/misc.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/misc.h
@@ -19,23 +19,23 @@
#define _V_RANDOM_H_
#include "vorbis/codec.h"
-extern void *_vorbis_block_alloc(vorbis_block *vb, long bytes);
+extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
extern void _vorbis_block_ripcord(vorbis_block *vb);
#ifdef ANALYSIS
extern int analysis_noisy;
-extern void _analysis_output(char *base, int i, float *v, int n, int bark, int dB,
+extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
+ ogg_int64_t off);
+extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,
ogg_int64_t off);
-extern void _analysis_output_always(char *base, int i, float *v, int n, int bark, int dB,
- ogg_int64_t off);
#endif
#ifdef DEBUG_MALLOC
#define _VDBG_GRAPHFILE "malloc.m"
#undef _VDBG_GRAPHFILE
-extern void *_VDBG_malloc(void *ptr, long bytes, char *file, long line);
-extern void _VDBG_free(void *ptr, char *file, long line);
+extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
+extern void _VDBG_free(void *ptr,char *file,long line);
#ifndef MISC_C
#undef _ogg_malloc
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/os.h b/src/filters/transform/MpaDecFilter/libvorbisidec/os.h
index 66994a5ec..276b4decc 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/os.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/os.h
@@ -92,32 +92,28 @@ void *_alloca(size_t size);
typedef ogg_int16_t vorbis_fpu_control;
-static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu)
-{
- ogg_int16_t ret;
- ogg_int16_t temp;
- __asm__ __volatile__("fnstcw %0\n\t"
- "movw %0,%%dx\n\t"
- "andw $62463,%%dx\n\t"
- "movw %%dx,%1\n\t"
- "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
- *fpu = ret;
+static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
+ ogg_int16_t ret;
+ ogg_int16_t temp;
+ __asm__ __volatile__("fnstcw %0\n\t"
+ "movw %0,%%dx\n\t"
+ "andw $62463,%%dx\n\t"
+ "movw %%dx,%1\n\t"
+ "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
+ *fpu=ret;
}
-static inline void vorbis_fpu_restore(vorbis_fpu_control fpu)
-{
- __asm__ __volatile__("fldcw %0":: "m"(fpu));
+static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
+ __asm__ __volatile__("fldcw %0":: "m"(fpu));
}
/* assumes the FPU is in round mode! */
-static inline int vorbis_ftoi(double f)
-{
- /* yes, double! Otherwise,
- we get extra fst/fld to
- truncate precision */
- int i;
- __asm__("fistl %0": "=m"(i) : "t"(f));
- return(i);
+static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise,
+ we get extra fst/fld to
+ truncate precision */
+ int i;
+ __asm__("fistl %0": "=m"(i) : "t"(f));
+ return(i);
}
#endif /* Special i386 GCC implementation */
@@ -129,23 +125,19 @@ static inline int vorbis_ftoi(double f)
typedef ogg_int16_t vorbis_fpu_control;
-static __inline int vorbis_ftoi(double f)
-{
- int i;
- __asm
- {
- fld f
- fistp i
- }
- return i;
+static __inline int vorbis_ftoi(double f){
+ int i;
+ __asm{
+ fld f
+ fistp i
+ }
+ return i;
}
-static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu)
-{
+static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
}
-static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu)
-{
+static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
}
#endif /* Special MSVC 32 bit implementation */
@@ -159,17 +151,14 @@ static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu)
typedef ogg_int16_t vorbis_fpu_control;
#include <emmintrin.h>
-static __inline int vorbis_ftoi(double f)
-{
- return _mm_cvtsd_si32(_mm_load_sd(&f));
+static __inline int vorbis_ftoi(double f){
+ return _mm_cvtsd_si32(_mm_load_sd(&f));
}
-static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu)
-{
+static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
}
-static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu)
-{
+static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
}
#endif /* Special MSVC x64 implementation */
@@ -181,12 +170,11 @@ static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu)
typedef int vorbis_fpu_control;
-static int vorbis_ftoi(double f)
-{
- /* Note: MSVC and GCC (at least on some systems) round towards zero, thus,
- the floor() call is required to ensure correct roudning of
- negative numbers */
- return (int)floor(f + .5);
+static int vorbis_ftoi(double f){
+ /* Note: MSVC and GCC (at least on some systems) round towards zero, thus,
+ the floor() call is required to ensure correct roudning of
+ negative numbers */
+ return (int)floor(f+.5);
}
/* We don't have special code for this compiler/arch, so do it the slow way */
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/psy.c b/src/filters/transform/MpaDecFilter/libvorbisidec/psy.c
index 7684d2978..3ba6c4454 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/psy.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/psy.c
@@ -30,404 +30,357 @@
#include "misc.h"
#define NEGINF -9999.f
-static const double stereo_threshholds[] = {0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
-static const double stereo_threshholds_limited[] = {0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
+static const double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
+static const double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
-vorbis_look_psy_global *_vp_global_look(vorbis_info *vi)
-{
- codec_setup_info *ci = vi->codec_setup;
- vorbis_info_psy_global *gi = &ci->psy_g_param;
- vorbis_look_psy_global *look = _ogg_calloc(1, sizeof(*look));
+vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
+ codec_setup_info *ci=vi->codec_setup;
+ vorbis_info_psy_global *gi=&ci->psy_g_param;
+ vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look));
- look->channels = vi->channels;
+ look->channels=vi->channels;
- look->ampmax = -9999.;
- look->gi = gi;
- return(look);
+ look->ampmax=-9999.;
+ look->gi=gi;
+ return(look);
}
-void _vp_global_free(vorbis_look_psy_global *look)
-{
- if(look)
- {
- memset(look, 0, sizeof(*look));
- _ogg_free(look);
- }
+void _vp_global_free(vorbis_look_psy_global *look){
+ if(look){
+ memset(look,0,sizeof(*look));
+ _ogg_free(look);
+ }
}
-void _vi_gpsy_free(vorbis_info_psy_global *i)
-{
- if(i)
- {
- memset(i, 0, sizeof(*i));
- _ogg_free(i);
- }
+void _vi_gpsy_free(vorbis_info_psy_global *i){
+ if(i){
+ memset(i,0,sizeof(*i));
+ _ogg_free(i);
+ }
}
-void _vi_psy_free(vorbis_info_psy *i)
-{
- if(i)
- {
- memset(i, 0, sizeof(*i));
- _ogg_free(i);
- }
+void _vi_psy_free(vorbis_info_psy *i){
+ if(i){
+ memset(i,0,sizeof(*i));
+ _ogg_free(i);
+ }
}
static void min_curve(float *c,
- float *c2)
-{
- int i;
- for(i = 0; i < EHMER_MAX; i++)if(c2[i] < c[i])c[i] = c2[i];
+ float *c2){
+ int i;
+ for(i=0;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i];
}
static void max_curve(float *c,
- float *c2)
-{
- int i;
- for(i = 0; i < EHMER_MAX; i++)if(c2[i] > c[i])c[i] = c2[i];
+ float *c2){
+ int i;
+ for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i];
}
-static void attenuate_curve(float *c, float att)
-{
- int i;
- for(i = 0; i < EHMER_MAX; i++)
- c[i] += att;
+static void attenuate_curve(float *c,float att){
+ int i;
+ for(i=0;i<EHMER_MAX;i++)
+ c[i]+=att;
}
-static float ***setup_tone_curves(float curveatt_dB[P_BANDS], float binHz, int n,
- float center_boost, float center_decay_rate)
-{
- int i, j, k, m;
- float ath[EHMER_MAX];
- float workc[P_BANDS][P_LEVELS][EHMER_MAX];
- float athc[P_LEVELS][EHMER_MAX];
- float *brute_buffer = alloca(n * sizeof(*brute_buffer));
-
- float ***ret = _ogg_malloc(sizeof(*ret) * P_BANDS);
-
- memset(workc, 0, sizeof(workc));
-
- for(i = 0; i < P_BANDS; i++)
- {
- /* we add back in the ATH to avoid low level curves falling off to
- -infinity and unnecessarily cutting off high level curves in the
- curve limiting (last step). */
-
- /* A half-band's settings must be valid over the whole band, and
- it's better to mask too little than too much */
- int ath_offset = i * 4;
- for(j = 0; j < EHMER_MAX; j++)
- {
- float min = 999.;
- for(k = 0; k < 4; k++)
- if(j + k + ath_offset < MAX_ATH)
- {
- if(min > ATH[j+k+ath_offset])min = ATH[j+k+ath_offset];
- }
- else
- {
- if(min > ATH[MAX_ATH-1])min = ATH[MAX_ATH-1];
- }
- ath[j] = min;
+static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
+ float center_boost, float center_decay_rate){
+ int i,j,k,m;
+ float ath[EHMER_MAX];
+ float workc[P_BANDS][P_LEVELS][EHMER_MAX];
+ float athc[P_LEVELS][EHMER_MAX];
+ float *brute_buffer=alloca(n*sizeof(*brute_buffer));
+
+ float ***ret=_ogg_malloc(sizeof(*ret)*P_BANDS);
+
+ memset(workc,0,sizeof(workc));
+
+ for(i=0;i<P_BANDS;i++){
+ /* we add back in the ATH to avoid low level curves falling off to
+ -infinity and unnecessarily cutting off high level curves in the
+ curve limiting (last step). */
+
+ /* A half-band's settings must be valid over the whole band, and
+ it's better to mask too little than too much */
+ int ath_offset=i*4;
+ for(j=0;j<EHMER_MAX;j++){
+ float min=999.;
+ for(k=0;k<4;k++)
+ if(j+k+ath_offset<MAX_ATH){
+ if(min>ATH[j+k+ath_offset])min=ATH[j+k+ath_offset];
+ }else{
+ if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1];
}
+ ath[j]=min;
+ }
- /* copy curves into working space, replicate the 50dB curve to 30
- and 40, replicate the 100dB curve to 110 */
- for(j = 0; j < 6; j++)
- memcpy(workc[i][j+2], tonemasks[i][j], EHMER_MAX * sizeof(*tonemasks[i][j]));
- memcpy(workc[i][0], tonemasks[i][0], EHMER_MAX * sizeof(*tonemasks[i][0]));
- memcpy(workc[i][1], tonemasks[i][0], EHMER_MAX * sizeof(*tonemasks[i][0]));
-
- /* apply centered curve boost/decay */
- for(j = 0; j < P_LEVELS; j++)
- {
- for(k = 0; k < EHMER_MAX; k++)
- {
- float adj = center_boost + abs(EHMER_OFFSET - k) * center_decay_rate;
- if(adj < 0. && center_boost > 0)adj = 0.;
- if(adj > 0. && center_boost < 0)adj = 0.;
- workc[i][j][k] += adj;
- }
- }
+ /* copy curves into working space, replicate the 50dB curve to 30
+ and 40, replicate the 100dB curve to 110 */
+ for(j=0;j<6;j++)
+ memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j]));
+ memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
+ memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
+
+ /* apply centered curve boost/decay */
+ for(j=0;j<P_LEVELS;j++){
+ for(k=0;k<EHMER_MAX;k++){
+ float adj=center_boost+abs(EHMER_OFFSET-k)*center_decay_rate;
+ if(adj<0. && center_boost>0)adj=0.;
+ if(adj>0. && center_boost<0)adj=0.;
+ workc[i][j][k]+=adj;
+ }
+ }
- /* normalize curves so the driving amplitude is 0dB */
- /* make temp curves with the ATH overlayed */
- for(j = 0; j < P_LEVELS; j++)
- {
- attenuate_curve(workc[i][j], curveatt_dB[i] + 100. - (j < 2 ? 2 : j) * 10. - P_LEVEL_0);
- memcpy(athc[j], ath, EHMER_MAX * sizeof(**athc));
- attenuate_curve(athc[j], +100. - j * 10.f - P_LEVEL_0);
- max_curve(athc[j], workc[i][j]);
- }
+ /* normalize curves so the driving amplitude is 0dB */
+ /* make temp curves with the ATH overlayed */
+ for(j=0;j<P_LEVELS;j++){
+ attenuate_curve(workc[i][j],curveatt_dB[i]+100.-(j<2?2:j)*10.-P_LEVEL_0);
+ memcpy(athc[j],ath,EHMER_MAX*sizeof(**athc));
+ attenuate_curve(athc[j],+100.-j*10.f-P_LEVEL_0);
+ max_curve(athc[j],workc[i][j]);
+ }
- /* Now limit the louder curves.
+ /* Now limit the louder curves.
- the idea is this: We don't know what the playback attenuation
- will be; 0dB SL moves every time the user twiddles the volume
- knob. So that means we have to use a single 'most pessimal' curve
- for all masking amplitudes, right? Wrong. The *loudest* sound
- can be in (we assume) a range of ...+100dB] SL. However, sounds
- 20dB down will be in a range ...+80], 40dB down is from ...+60],
- etc... */
+ the idea is this: We don't know what the playback attenuation
+ will be; 0dB SL moves every time the user twiddles the volume
+ knob. So that means we have to use a single 'most pessimal' curve
+ for all masking amplitudes, right? Wrong. The *loudest* sound
+ can be in (we assume) a range of ...+100dB] SL. However, sounds
+ 20dB down will be in a range ...+80], 40dB down is from ...+60],
+ etc... */
- for(j = 1; j < P_LEVELS; j++)
- {
- min_curve(athc[j], athc[j-1]);
- min_curve(workc[i][j], athc[j]);
- }
+ for(j=1;j<P_LEVELS;j++){
+ min_curve(athc[j],athc[j-1]);
+ min_curve(workc[i][j],athc[j]);
}
+ }
+
+ for(i=0;i<P_BANDS;i++){
+ int hi_curve,lo_curve,bin;
+ ret[i]=_ogg_malloc(sizeof(**ret)*P_LEVELS);
+
+ /* low frequency curves are measured with greater resolution than
+ the MDCT/FFT will actually give us; we want the curve applied
+ to the tone data to be pessimistic and thus apply the minimum
+ masking possible for a given bin. That means that a single bin
+ could span more than one octave and that the curve will be a
+ composite of multiple octaves. It also may mean that a single
+ bin may span > an eighth of an octave and that the eighth
+ octave values may also be composited. */
+
+ /* which octave curves will we be compositing? */
+ bin=floor(fromOC(i*.5)/binHz);
+ lo_curve= ceil(toOC(bin*binHz+1)*2);
+ hi_curve= floor(toOC((bin+1)*binHz)*2);
+ if(lo_curve>i)lo_curve=i;
+ if(lo_curve<0)lo_curve=0;
+ if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1;
+
+ for(m=0;m<P_LEVELS;m++){
+ ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2));
+
+ for(j=0;j<n;j++)brute_buffer[j]=999.;
+
+ /* render the curve into bins, then pull values back into curve.
+ The point is that any inherent subsampling aliasing results in
+ a safe minimum */
+ for(k=lo_curve;k<=hi_curve;k++){
+ int l=0;
+
+ for(j=0;j<EHMER_MAX;j++){
+ int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz;
+ int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1;
+
+ if(lo_bin<0)lo_bin=0;
+ if(lo_bin>n)lo_bin=n;
+ if(lo_bin<l)l=lo_bin;
+ if(hi_bin<0)hi_bin=0;
+ if(hi_bin>n)hi_bin=n;
+
+ for(;l<hi_bin && l<n;l++)
+ if(brute_buffer[l]>workc[k][m][j])
+ brute_buffer[l]=workc[k][m][j];
+ }
- for(i = 0; i < P_BANDS; i++)
- {
- int hi_curve, lo_curve, bin;
- ret[i] = _ogg_malloc(sizeof(**ret) * P_LEVELS);
-
- /* low frequency curves are measured with greater resolution than
- the MDCT/FFT will actually give us; we want the curve applied
- to the tone data to be pessimistic and thus apply the minimum
- masking possible for a given bin. That means that a single bin
- could span more than one octave and that the curve will be a
- composite of multiple octaves. It also may mean that a single
- bin may span > an eighth of an octave and that the eighth
- octave values may also be composited. */
-
- /* which octave curves will we be compositing? */
- bin = floor(fromOC(i * .5) / binHz);
- lo_curve = ceil(toOC(bin * binHz + 1) * 2);
- hi_curve = floor(toOC((bin + 1) * binHz) * 2);
- if(lo_curve > i)lo_curve = i;
- if(lo_curve < 0)lo_curve = 0;
- if(hi_curve >= P_BANDS)hi_curve = P_BANDS - 1;
-
- for(m = 0; m < P_LEVELS; m++)
- {
- ret[i][m] = _ogg_malloc(sizeof(***ret) * (EHMER_MAX + 2));
-
- for(j = 0; j < n; j++)brute_buffer[j] = 999.;
-
- /* render the curve into bins, then pull values back into curve.
- The point is that any inherent subsampling aliasing results in
- a safe minimum */
- for(k = lo_curve; k <= hi_curve; k++)
- {
- int l = 0;
-
- for(j = 0; j < EHMER_MAX; j++)
- {
- int lo_bin = fromOC(j * .125 + k * .5 - 2.0625) / binHz;
- int hi_bin = fromOC(j * .125 + k * .5 - 1.9375) / binHz + 1;
-
- if(lo_bin < 0)lo_bin = 0;
- if(lo_bin > n)lo_bin = n;
- if(lo_bin < l)l = lo_bin;
- if(hi_bin < 0)hi_bin = 0;
- if(hi_bin > n)hi_bin = n;
-
- for(; l < hi_bin && l < n; l++)
- if(brute_buffer[l] > workc[k][m][j])
- brute_buffer[l] = workc[k][m][j];
- }
-
- for(; l < n; l++)
- if(brute_buffer[l] > workc[k][m][EHMER_MAX-1])
- brute_buffer[l] = workc[k][m][EHMER_MAX-1];
-
- }
+ for(;l<n;l++)
+ if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
+ brute_buffer[l]=workc[k][m][EHMER_MAX-1];
+
+ }
+
+ /* be equally paranoid about being valid up to next half ocatve */
+ if(i+1<P_BANDS){
+ int l=0;
+ k=i+1;
+ for(j=0;j<EHMER_MAX;j++){
+ int lo_bin= fromOC(j*.125+i*.5-2.0625)/binHz;
+ int hi_bin= fromOC(j*.125+i*.5-1.9375)/binHz+1;
+
+ if(lo_bin<0)lo_bin=0;
+ if(lo_bin>n)lo_bin=n;
+ if(lo_bin<l)l=lo_bin;
+ if(hi_bin<0)hi_bin=0;
+ if(hi_bin>n)hi_bin=n;
+
+ for(;l<hi_bin && l<n;l++)
+ if(brute_buffer[l]>workc[k][m][j])
+ brute_buffer[l]=workc[k][m][j];
+ }
- /* be equally paranoid about being valid up to next half ocatve */
- if(i + 1 < P_BANDS)
- {
- int l = 0;
- k = i + 1;
- for(j = 0; j < EHMER_MAX; j++)
- {
- int lo_bin = fromOC(j * .125 + i * .5 - 2.0625) / binHz;
- int hi_bin = fromOC(j * .125 + i * .5 - 1.9375) / binHz + 1;
-
- if(lo_bin < 0)lo_bin = 0;
- if(lo_bin > n)lo_bin = n;
- if(lo_bin < l)l = lo_bin;
- if(hi_bin < 0)hi_bin = 0;
- if(hi_bin > n)hi_bin = n;
-
- for(; l < hi_bin && l < n; l++)
- if(brute_buffer[l] > workc[k][m][j])
- brute_buffer[l] = workc[k][m][j];
- }
-
- for(; l < n; l++)
- if(brute_buffer[l] > workc[k][m][EHMER_MAX-1])
- brute_buffer[l] = workc[k][m][EHMER_MAX-1];
+ for(;l<n;l++)
+ if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
+ brute_buffer[l]=workc[k][m][EHMER_MAX-1];
- }
+ }
- for(j = 0; j < EHMER_MAX; j++)
- {
- int bin = fromOC(j * .125 + i * .5 - 2.) / binHz;
- if(bin < 0)
- {
- ret[i][m][j+2] = -999.;
- }
- else
- {
- if(bin >= n)
- {
- ret[i][m][j+2] = -999.;
- }
- else
- {
- ret[i][m][j+2] = brute_buffer[bin];
- }
- }
- }
+ for(j=0;j<EHMER_MAX;j++){
+ int bin=fromOC(j*.125+i*.5-2.)/binHz;
+ if(bin<0){
+ ret[i][m][j+2]=-999.;
+ }else{
+ if(bin>=n){
+ ret[i][m][j+2]=-999.;
+ }else{
+ ret[i][m][j+2]=brute_buffer[bin];
+ }
+ }
+ }
- /* add fenceposts */
- for(j = 0; j < EHMER_OFFSET; j++)
- if(ret[i][m][j+2] > -200.f)break;
- ret[i][m][0] = j;
+ /* add fenceposts */
+ for(j=0;j<EHMER_OFFSET;j++)
+ if(ret[i][m][j+2]>-200.f)break;
+ ret[i][m][0]=j;
- for(j = EHMER_MAX - 1; j > EHMER_OFFSET + 1; j--)
- if(ret[i][m][j+2] > -200.f)
- break;
- ret[i][m][1] = j;
+ for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--)
+ if(ret[i][m][j+2]>-200.f)
+ break;
+ ret[i][m][1]=j;
- }
}
+ }
- return(ret);
+ return(ret);
}
-void _vp_psy_init(vorbis_look_psy *p, vorbis_info_psy *vi,
- vorbis_info_psy_global *gi, int n, long rate)
-{
- long i, j, lo = -99, hi = 1;
- long maxoc;
- memset(p, 0, sizeof(*p));
-
- p->eighth_octave_lines = gi->eighth_octave_lines;
- p->shiftoc = rint(log(gi->eighth_octave_lines * 8.f) / log(2.f)) - 1;
-
- p->firstoc = toOC(.25f * rate * .5 / n) * (1 << (p->shiftoc + 1)) - gi->eighth_octave_lines;
- maxoc = toOC((n + .25f) * rate * .5 / n) * (1 << (p->shiftoc + 1)) + .5f;
- p->total_octave_lines = maxoc - p->firstoc + 1;
- p->ath = _ogg_malloc(n * sizeof(*p->ath));
-
- p->octave = _ogg_malloc(n * sizeof(*p->octave));
- p->bark = _ogg_malloc(n * sizeof(*p->bark));
- p->vi = vi;
- p->n = n;
- p->rate = rate;
-
- /* AoTuV HF weighting */
- p->m_val = 1.;
- if(rate < 26000) p->m_val = 0;
- else if(rate < 38000) p->m_val = .94; /* 32kHz */
- else if(rate > 46000) p->m_val = 1.275; /* 48kHz */
-
- /* set up the lookups for a given blocksize and sample rate */
-
- for(i = 0, j = 0; i < MAX_ATH - 1; i++)
- {
- int endpos = rint(fromOC((i + 1) * .125 - 2.) * 2 * n / rate);
- float base = ATH[i];
- if(j < endpos)
- {
- float delta = (ATH[i+1] - base) / (endpos - j);
- for(; j < endpos && j < n; j++)
- {
- p->ath[j] = base + 100.;
- base += delta;
- }
- }
+void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
+ vorbis_info_psy_global *gi,int n,long rate){
+ long i,j,lo=-99,hi=1;
+ long maxoc;
+ memset(p,0,sizeof(*p));
+
+ p->eighth_octave_lines=gi->eighth_octave_lines;
+ p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1;
+
+ p->firstoc=toOC(.25f*rate*.5/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines;
+ maxoc=toOC((n+.25f)*rate*.5/n)*(1<<(p->shiftoc+1))+.5f;
+ p->total_octave_lines=maxoc-p->firstoc+1;
+ p->ath=_ogg_malloc(n*sizeof(*p->ath));
+
+ p->octave=_ogg_malloc(n*sizeof(*p->octave));
+ p->bark=_ogg_malloc(n*sizeof(*p->bark));
+ p->vi=vi;
+ p->n=n;
+ p->rate=rate;
+
+ /* AoTuV HF weighting */
+ p->m_val = 1.;
+ if(rate < 26000) p->m_val = 0;
+ else if(rate < 38000) p->m_val = .94; /* 32kHz */
+ else if(rate > 46000) p->m_val = 1.275; /* 48kHz */
+
+ /* set up the lookups for a given blocksize and sample rate */
+
+ for(i=0,j=0;i<MAX_ATH-1;i++){
+ int endpos=rint(fromOC((i+1)*.125-2.)*2*n/rate);
+ float base=ATH[i];
+ if(j<endpos){
+ float delta=(ATH[i+1]-base)/(endpos-j);
+ for(;j<endpos && j<n;j++){
+ p->ath[j]=base+100.;
+ base+=delta;
+ }
}
+ }
- for(; j < n; j++)
- {
- p->ath[j] = p->ath[j-1];
- }
+ for(;j<n;j++){
+ p->ath[j]=p->ath[j-1];
+ }
- for(i = 0; i < n; i++)
- {
- float bark = toBARK(rate / (2 * n) * i);
+ for(i=0;i<n;i++){
+ float bark=toBARK(rate/(2*n)*i);
- for(; lo + vi->noisewindowlomin < i &&
- toBARK(rate / (2 * n)*lo) < (bark - vi->noisewindowlo); lo++);
+ for(;lo+vi->noisewindowlomin<i &&
+ toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++);
- for(; hi <= n && (hi < i + vi->noisewindowhimin ||
- toBARK(rate / (2 * n)*hi) < (bark + vi->noisewindowhi)); hi++);
+ for(;hi<=n && (hi<i+vi->noisewindowhimin ||
+ toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++);
- p->bark[i] = ((lo - 1) << 16) + (hi - 1);
+ p->bark[i]=((lo-1)<<16)+(hi-1);
- }
+ }
- for(i = 0; i < n; i++)
- p->octave[i] = toOC((i + .25f) * .5 * rate / n) * (1 << (p->shiftoc + 1)) + .5f;
+ for(i=0;i<n;i++)
+ p->octave[i]=toOC((i+.25f)*.5*rate/n)*(1<<(p->shiftoc+1))+.5f;
- p->tonecurves = setup_tone_curves(vi->toneatt, rate * .5 / n, n,
- vi->tone_centerboost, vi->tone_decay);
+ p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n,
+ vi->tone_centerboost,vi->tone_decay);
- /* set up rolling noise median */
- p->noiseoffset = _ogg_malloc(P_NOISECURVES * sizeof(*p->noiseoffset));
- for(i = 0; i < P_NOISECURVES; i++)
- p->noiseoffset[i] = _ogg_malloc(n * sizeof(**p->noiseoffset));
+ /* set up rolling noise median */
+ p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset));
+ for(i=0;i<P_NOISECURVES;i++)
+ p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset));
- for(i = 0; i < n; i++)
- {
- float halfoc = toOC((i + .5) * rate / (2.*n)) * 2.;
- int inthalfoc;
- float del;
+ for(i=0;i<n;i++){
+ float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
+ int inthalfoc;
+ float del;
- if(halfoc < 0)halfoc = 0;
- if(halfoc >= P_BANDS - 1)halfoc = P_BANDS - 1;
- inthalfoc = (int)halfoc;
- del = halfoc - inthalfoc;
+ if(halfoc<0)halfoc=0;
+ if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
+ inthalfoc=(int)halfoc;
+ del=halfoc-inthalfoc;
- for(j = 0; j < P_NOISECURVES; j++)
- p->noiseoffset[j][i] =
- p->vi->noiseoff[j][inthalfoc] * (1. - del) +
- p->vi->noiseoff[j][inthalfoc+1] * del;
+ for(j=0;j<P_NOISECURVES;j++)
+ p->noiseoffset[j][i]=
+ p->vi->noiseoff[j][inthalfoc]*(1.-del) +
+ p->vi->noiseoff[j][inthalfoc+1]*del;
- }
+ }
#if 0
- {
- static int ls = 0;
- _analysis_output_always("noiseoff0", ls, p->noiseoffset[0], n, 1, 0, 0);
- _analysis_output_always("noiseoff1", ls, p->noiseoffset[1], n, 1, 0, 0);
- _analysis_output_always("noiseoff2", ls++, p->noiseoffset[2], n, 1, 0, 0);
- }
+ {
+ static int ls=0;
+ _analysis_output_always("noiseoff0",ls,p->noiseoffset[0],n,1,0,0);
+ _analysis_output_always("noiseoff1",ls,p->noiseoffset[1],n,1,0,0);
+ _analysis_output_always("noiseoff2",ls++,p->noiseoffset[2],n,1,0,0);
+ }
#endif
}
-void _vp_psy_clear(vorbis_look_psy *p)
-{
- int i, j;
- if(p)
- {
- if(p->ath)_ogg_free(p->ath);
- if(p->octave)_ogg_free(p->octave);
- if(p->bark)_ogg_free(p->bark);
- if(p->tonecurves)
- {
- for(i = 0; i < P_BANDS; i++)
- {
- for(j = 0; j < P_LEVELS; j++)
- {
- _ogg_free(p->tonecurves[i][j]);
- }
- _ogg_free(p->tonecurves[i]);
- }
- _ogg_free(p->tonecurves);
- }
- if(p->noiseoffset)
- {
- for(i = 0; i < P_NOISECURVES; i++)
- {
- _ogg_free(p->noiseoffset[i]);
- }
- _ogg_free(p->noiseoffset);
+void _vp_psy_clear(vorbis_look_psy *p){
+ int i,j;
+ if(p){
+ if(p->ath)_ogg_free(p->ath);
+ if(p->octave)_ogg_free(p->octave);
+ if(p->bark)_ogg_free(p->bark);
+ if(p->tonecurves){
+ for(i=0;i<P_BANDS;i++){
+ for(j=0;j<P_LEVELS;j++){
+ _ogg_free(p->tonecurves[i][j]);
}
- memset(p, 0, sizeof(*p));
+ _ogg_free(p->tonecurves[i]);
+ }
+ _ogg_free(p->tonecurves);
+ }
+ if(p->noiseoffset){
+ for(i=0;i<P_NOISECURVES;i++){
+ _ogg_free(p->noiseoffset[i]);
+ }
+ _ogg_free(p->noiseoffset);
}
+ memset(p,0,sizeof(*p));
+ }
}
/* octave/(8*eighth_octave_lines) x scale and dB y scale */
@@ -435,30 +388,27 @@ static void seed_curve(float *seed,
const float **curves,
float amp,
int oc, int n,
- int linesper, float dBoffset)
-{
- int i, post1;
- int seedptr;
- const float *posts, *curve;
-
- int choice = (int)((amp + dBoffset - P_LEVEL_0) * .1f);
- choice = max(choice, 0);
- choice = min(choice, P_LEVELS - 1);
- posts = curves[choice];
- curve = posts + 2;
- post1 = (int)posts[1];
- seedptr = oc + (posts[0] - EHMER_OFFSET) * linesper - (linesper >> 1);
-
- for(i = posts[0]; i < post1; i++)
- {
- if(seedptr > 0)
- {
- float lin = amp + curve[i];
- if(seed[seedptr] < lin)seed[seedptr] = lin;
- }
- seedptr += linesper;
- if(seedptr >= n)break;
+ int linesper,float dBoffset){
+ int i,post1;
+ int seedptr;
+ const float *posts,*curve;
+
+ int choice=(int)((amp+dBoffset-P_LEVEL_0)*.1f);
+ choice=max(choice,0);
+ choice=min(choice,P_LEVELS-1);
+ posts=curves[choice];
+ curve=posts+2;
+ post1=(int)posts[1];
+ seedptr=oc+(posts[0]-EHMER_OFFSET)*linesper-(linesper>>1);
+
+ for(i=posts[0];i<post1;i++){
+ if(seedptr>0){
+ float lin=amp+curve[i];
+ if(seed[seedptr]<lin)seed[seedptr]=lin;
}
+ seedptr+=linesper;
+ if(seedptr>=n)break;
+ }
}
static void seed_loop(vorbis_look_psy *p,
@@ -466,110 +416,91 @@ static void seed_loop(vorbis_look_psy *p,
const float *f,
const float *flr,
float *seed,
- float specmax)
-{
- vorbis_info_psy *vi = p->vi;
- long n = p->n, i;
- float dBoffset = vi->max_curve_dB - specmax;
-
- /* prime the working vector with peak values */
-
- for(i = 0; i < n; i++)
- {
- float max = f[i];
- long oc = p->octave[i];
- while(i + 1 < n && p->octave[i+1] == oc)
- {
- i++;
- if(f[i] > max)max = f[i];
- }
+ float specmax){
+ vorbis_info_psy *vi=p->vi;
+ long n=p->n,i;
+ float dBoffset=vi->max_curve_dB-specmax;
+
+ /* prime the working vector with peak values */
+
+ for(i=0;i<n;i++){
+ float max=f[i];
+ long oc=p->octave[i];
+ while(i+1<n && p->octave[i+1]==oc){
+ i++;
+ if(f[i]>max)max=f[i];
+ }
- if(max + 6.f > flr[i])
- {
- oc = oc >> p->shiftoc;
+ if(max+6.f>flr[i]){
+ oc=oc>>p->shiftoc;
- if(oc >= P_BANDS)oc = P_BANDS - 1;
- if(oc < 0)oc = 0;
+ if(oc>=P_BANDS)oc=P_BANDS-1;
+ if(oc<0)oc=0;
- seed_curve(seed,
- curves[oc],
- max,
- p->octave[i] - p->firstoc,
- p->total_octave_lines,
- p->eighth_octave_lines,
- dBoffset);
- }
+ seed_curve(seed,
+ curves[oc],
+ max,
+ p->octave[i]-p->firstoc,
+ p->total_octave_lines,
+ p->eighth_octave_lines,
+ dBoffset);
}
+ }
}
-static void seed_chase(float *seeds, int linesper, long n)
-{
- long *posstack = alloca(n * sizeof(*posstack));
- float *ampstack = alloca(n * sizeof(*ampstack));
- long stack = 0;
- long pos = 0;
- long i;
-
- for(i = 0; i < n; i++)
- {
- if(stack < 2)
- {
- posstack[stack] = i;
- ampstack[stack++] = seeds[i];
- }
- else
- {
- while(1)
- {
- if(seeds[i] < ampstack[stack-1])
- {
- posstack[stack] = i;
- ampstack[stack++] = seeds[i];
- break;
- }
- else
- {
- if(i < posstack[stack-1] + linesper)
- {
- if(stack > 1 && ampstack[stack-1] <= ampstack[stack-2] &&
- i < posstack[stack-2] + linesper)
- {
- /* we completely overlap, making stack-1 irrelevant. pop it */
- stack--;
- continue;
- }
- }
- posstack[stack] = i;
- ampstack[stack++] = seeds[i];
- break;
-
- }
+static void seed_chase(float *seeds, int linesper, long n){
+ long *posstack=alloca(n*sizeof(*posstack));
+ float *ampstack=alloca(n*sizeof(*ampstack));
+ long stack=0;
+ long pos=0;
+ long i;
+
+ for(i=0;i<n;i++){
+ if(stack<2){
+ posstack[stack]=i;
+ ampstack[stack++]=seeds[i];
+ }else{
+ while(1){
+ if(seeds[i]<ampstack[stack-1]){
+ posstack[stack]=i;
+ ampstack[stack++]=seeds[i];
+ break;
+ }else{
+ if(i<posstack[stack-1]+linesper){
+ if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] &&
+ i<posstack[stack-2]+linesper){
+ /* we completely overlap, making stack-1 irrelevant. pop it */
+ stack--;
+ continue;
}
+ }
+ posstack[stack]=i;
+ ampstack[stack++]=seeds[i];
+ break;
+
}
+ }
}
+ }
- /* the stack now contains only the positions that are relevant. Scan
- 'em straight through */
+ /* the stack now contains only the positions that are relevant. Scan
+ 'em straight through */
- for(i = 0; i < stack; i++)
- {
- long endpos;
- if(i < stack - 1 && ampstack[i+1] > ampstack[i])
- {
- endpos = posstack[i+1];
- }
- else
- {
- endpos = posstack[i] + linesper + 1; /* +1 is important, else bin 0 is
+ for(i=0;i<stack;i++){
+ long endpos;
+ if(i<stack-1 && ampstack[i+1]>ampstack[i]){
+ endpos=posstack[i+1];
+ }else{
+ endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is
discarded in short frames */
- }
- if(endpos > n)endpos = n;
- for(; pos < endpos; pos++)
- seeds[pos] = ampstack[i];
}
+ if(endpos>n)endpos=n;
+ for(;pos<endpos;pos++)
+ seeds[pos]=ampstack[i];
+ }
- /* there. Linear time. I now remember this was on a problem set I
- had in Grad Skool... I didn't solve it at the time ;-) */
+ /* there. Linear time. I now remember this was on a problem set I
+ had in Grad Skool... I didn't solve it at the time ;-) */
}
@@ -577,342 +508,325 @@ static void seed_chase(float *seeds, int linesper, long n)
#include<stdio.h>
static void max_seeds(vorbis_look_psy *p,
float *seed,
- float *flr)
-{
- long n = p->total_octave_lines;
- int linesper = p->eighth_octave_lines;
- long linpos = 0;
- long pos;
-
- seed_chase(seed, linesper, n); /* for masking */
-
- pos = p->octave[0] - p->firstoc - (linesper >> 1);
-
- while(linpos + 1 < p->n)
- {
- float minV = seed[pos];
- long end = ((p->octave[linpos] + p->octave[linpos+1]) >> 1) - p->firstoc;
- if(minV > p->vi->tone_abs_limit)minV = p->vi->tone_abs_limit;
- while(pos + 1 <= end)
- {
- pos++;
- if((seed[pos] > NEGINF && seed[pos] < minV) || minV == NEGINF)
- minV = seed[pos];
- }
-
- end = pos + p->firstoc;
- for(; linpos < p->n && p->octave[linpos] <= end; linpos++)
- if(flr[linpos] < minV)flr[linpos] = minV;
+ float *flr){
+ long n=p->total_octave_lines;
+ int linesper=p->eighth_octave_lines;
+ long linpos=0;
+ long pos;
+
+ seed_chase(seed,linesper,n); /* for masking */
+
+ pos=p->octave[0]-p->firstoc-(linesper>>1);
+
+ while(linpos+1<p->n){
+ float minV=seed[pos];
+ long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc;
+ if(minV>p->vi->tone_abs_limit)minV=p->vi->tone_abs_limit;
+ while(pos+1<=end){
+ pos++;
+ if((seed[pos]>NEGINF && seed[pos]<minV) || minV==NEGINF)
+ minV=seed[pos];
}
- {
- float minV = seed[p->total_octave_lines-1];
- for(; linpos < p->n; linpos++)
- if(flr[linpos] < minV)flr[linpos] = minV;
- }
+ end=pos+p->firstoc;
+ for(;linpos<p->n && p->octave[linpos]<=end;linpos++)
+ if(flr[linpos]<minV)flr[linpos]=minV;
+ }
+
+ {
+ float minV=seed[p->total_octave_lines-1];
+ for(;linpos<p->n;linpos++)
+ if(flr[linpos]<minV)flr[linpos]=minV;
+ }
}
-static void bark_noise_hybridmp(int n, const long *b,
+static void bark_noise_hybridmp(int n,const long *b,
const float *f,
float *noise,
const float offset,
- const int fixed)
-{
-
- float *N = alloca(n * sizeof(*N));
- float *X = alloca(n * sizeof(*N));
- float *XX = alloca(n * sizeof(*N));
- float *Y = alloca(n * sizeof(*N));
- float *XY = alloca(n * sizeof(*N));
-
- float tN, tX, tXX, tY, tXY;
- int i;
-
- int lo, hi;
- float R = 0.f;
- float A = 0.f;
- float B = 0.f;
- float D = 1.f;
- float w, x, y;
-
- tN = tX = tXX = tY = tXY = 0.f;
-
- y = f[0] + offset;
- if(y < 1.f) y = 1.f;
-
- w = y * y * .5;
-
- tN += w;
- tX += w;
- tY += w * y;
-
- N[0] = tN;
- X[0] = tX;
- XX[0] = tXX;
- Y[0] = tY;
- XY[0] = tXY;
-
- for(i = 1, x = 1.f; i < n; i++, x += 1.f)
- {
-
- y = f[i] + offset;
- if(y < 1.f) y = 1.f;
-
- w = y * y;
-
- tN += w;
- tX += w * x;
- tXX += w * x * x;
- tY += w * y;
- tXY += w * x * y;
-
- N[i] = tN;
- X[i] = tX;
- XX[i] = tXX;
- Y[i] = tY;
- XY[i] = tXY;
- }
-
- for(i = 0, x = 0.f;; i++, x += 1.f)
- {
-
- lo = b[i] >> 16;
- if(lo >= 0) break;
- hi = b[i] & 0xffff;
-
- tN = N[hi] + N[-lo];
- tX = X[hi] - X[-lo];
- tXX = XX[hi] + XX[-lo];
- tY = Y[hi] + Y[-lo];
- tXY = XY[hi] - XY[-lo];
-
- A = tY * tXX - tX * tXY;
- B = tN * tXY - tX * tY;
- D = tN * tXX - tX * tX;
- R = (A + x * B) / D;
- if(R < 0.f)
- R = 0.f;
-
- noise[i] = R - offset;
- }
+ const int fixed){
- for(;; i++, x += 1.f)
- {
+ float *N=alloca(n*sizeof(*N));
+ float *X=alloca(n*sizeof(*N));
+ float *XX=alloca(n*sizeof(*N));
+ float *Y=alloca(n*sizeof(*N));
+ float *XY=alloca(n*sizeof(*N));
- lo = b[i] >> 16;
- hi = b[i] & 0xffff;
- if(hi >= n)break;
+ float tN, tX, tXX, tY, tXY;
+ int i;
- tN = N[hi] - N[lo];
- tX = X[hi] - X[lo];
- tXX = XX[hi] - XX[lo];
- tY = Y[hi] - Y[lo];
- tXY = XY[hi] - XY[lo];
+ int lo, hi;
+ float R=0.f;
+ float A=0.f;
+ float B=0.f;
+ float D=1.f;
+ float w, x, y;
- A = tY * tXX - tX * tXY;
- B = tN * tXY - tX * tY;
- D = tN * tXX - tX * tX;
- R = (A + x * B) / D;
- if(R < 0.f) R = 0.f;
+ tN = tX = tXX = tY = tXY = 0.f;
- noise[i] = R - offset;
- }
- for(; i < n; i++, x += 1.f)
- {
-
- R = (A + x * B) / D;
- if(R < 0.f) R = 0.f;
-
- noise[i] = R - offset;
- }
+ y = f[0] + offset;
+ if (y < 1.f) y = 1.f;
- if(fixed <= 0) return;
+ w = y * y * .5;
- for(i = 0, x = 0.f;; i++, x += 1.f)
- {
- hi = i + fixed / 2;
- lo = hi - fixed;
- if(lo >= 0)break;
+ tN += w;
+ tX += w;
+ tY += w * y;
- tN = N[hi] + N[-lo];
- tX = X[hi] - X[-lo];
- tXX = XX[hi] + XX[-lo];
- tY = Y[hi] + Y[-lo];
- tXY = XY[hi] - XY[-lo];
-
-
- A = tY * tXX - tX * tXY;
- B = tN * tXY - tX * tY;
- D = tN * tXX - tX * tX;
- R = (A + x * B) / D;
-
- if(R - offset < noise[i]) noise[i] = R - offset;
- }
- for(;; i++, x += 1.f)
- {
+ N[0] = tN;
+ X[0] = tX;
+ XX[0] = tXX;
+ Y[0] = tY;
+ XY[0] = tXY;
- hi = i + fixed / 2;
- lo = hi - fixed;
- if(hi >= n)break;
+ for (i = 1, x = 1.f; i < n; i++, x += 1.f) {
- tN = N[hi] - N[lo];
- tX = X[hi] - X[lo];
- tXX = XX[hi] - XX[lo];
- tY = Y[hi] - Y[lo];
- tXY = XY[hi] - XY[lo];
+ y = f[i] + offset;
+ if (y < 1.f) y = 1.f;
- A = tY * tXX - tX * tXY;
- B = tN * tXY - tX * tY;
- D = tN * tXX - tX * tX;
- R = (A + x * B) / D;
+ w = y * y;
- if(R - offset < noise[i]) noise[i] = R - offset;
- }
- for(; i < n; i++, x += 1.f)
- {
- R = (A + x * B) / D;
- if(R - offset < noise[i]) noise[i] = R - offset;
- }
+ tN += w;
+ tX += w * x;
+ tXX += w * x * x;
+ tY += w * y;
+ tXY += w * x * y;
+
+ N[i] = tN;
+ X[i] = tX;
+ XX[i] = tXX;
+ Y[i] = tY;
+ XY[i] = tXY;
+ }
+
+ for (i = 0, x = 0.f;; i++, x += 1.f) {
+
+ lo = b[i] >> 16;
+ if( lo>=0 ) break;
+ hi = b[i] & 0xffff;
+
+ tN = N[hi] + N[-lo];
+ tX = X[hi] - X[-lo];
+ tXX = XX[hi] + XX[-lo];
+ tY = Y[hi] + Y[-lo];
+ tXY = XY[hi] - XY[-lo];
+
+ A = tY * tXX - tX * tXY;
+ B = tN * tXY - tX * tY;
+ D = tN * tXX - tX * tX;
+ R = (A + x * B) / D;
+ if (R < 0.f)
+ R = 0.f;
+
+ noise[i] = R - offset;
+ }
+
+ for ( ;; i++, x += 1.f) {
+
+ lo = b[i] >> 16;
+ hi = b[i] & 0xffff;
+ if(hi>=n)break;
+
+ tN = N[hi] - N[lo];
+ tX = X[hi] - X[lo];
+ tXX = XX[hi] - XX[lo];
+ tY = Y[hi] - Y[lo];
+ tXY = XY[hi] - XY[lo];
+
+ A = tY * tXX - tX * tXY;
+ B = tN * tXY - tX * tY;
+ D = tN * tXX - tX * tX;
+ R = (A + x * B) / D;
+ if (R < 0.f) R = 0.f;
+
+ noise[i] = R - offset;
+ }
+ for ( ; i < n; i++, x += 1.f) {
+
+ R = (A + x * B) / D;
+ if (R < 0.f) R = 0.f;
+
+ noise[i] = R - offset;
+ }
+
+ if (fixed <= 0) return;
+
+ for (i = 0, x = 0.f;; i++, x += 1.f) {
+ hi = i + fixed / 2;
+ lo = hi - fixed;
+ if(lo>=0)break;
+
+ tN = N[hi] + N[-lo];
+ tX = X[hi] - X[-lo];
+ tXX = XX[hi] + XX[-lo];
+ tY = Y[hi] + Y[-lo];
+ tXY = XY[hi] - XY[-lo];
+
+
+ A = tY * tXX - tX * tXY;
+ B = tN * tXY - tX * tY;
+ D = tN * tXX - tX * tX;
+ R = (A + x * B) / D;
+
+ if (R - offset < noise[i]) noise[i] = R - offset;
+ }
+ for ( ;; i++, x += 1.f) {
+
+ hi = i + fixed / 2;
+ lo = hi - fixed;
+ if(hi>=n)break;
+
+ tN = N[hi] - N[lo];
+ tX = X[hi] - X[lo];
+ tXX = XX[hi] - XX[lo];
+ tY = Y[hi] - Y[lo];
+ tXY = XY[hi] - XY[lo];
+
+ A = tY * tXX - tX * tXY;
+ B = tN * tXY - tX * tY;
+ D = tN * tXX - tX * tX;
+ R = (A + x * B) / D;
+
+ if (R - offset < noise[i]) noise[i] = R - offset;
+ }
+ for ( ; i < n; i++, x += 1.f) {
+ R = (A + x * B) / D;
+ if (R - offset < noise[i]) noise[i] = R - offset;
+ }
}
-static const float FLOOR1_fromdB_INV_LOOKUP[256] =
-{
- 0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F,
- 7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F,
- 5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F,
- 4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F,
- 3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F,
- 2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F,
- 2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F,
- 1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F,
- 1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F,
- 973377.F, 913981.F, 858210.F, 805842.F,
- 756669.F, 710497.F, 667142.F, 626433.F,
- 588208.F, 552316.F, 518613.F, 486967.F,
- 457252.F, 429351.F, 403152.F, 378551.F,
- 355452.F, 333762.F, 313396.F, 294273.F,
- 276316.F, 259455.F, 243623.F, 228757.F,
- 214798.F, 201691.F, 189384.F, 177828.F,
- 166977.F, 156788.F, 147221.F, 138237.F,
- 129802.F, 121881.F, 114444.F, 107461.F,
- 100903.F, 94746.3F, 88964.9F, 83536.2F,
- 78438.8F, 73652.5F, 69158.2F, 64938.1F,
- 60975.6F, 57254.9F, 53761.2F, 50480.6F,
- 47400.3F, 44507.9F, 41792.0F, 39241.9F,
- 36847.3F, 34598.9F, 32487.7F, 30505.3F,
- 28643.8F, 26896.0F, 25254.8F, 23713.7F,
- 22266.7F, 20908.0F, 19632.2F, 18434.2F,
- 17309.4F, 16253.1F, 15261.4F, 14330.1F,
- 13455.7F, 12634.6F, 11863.7F, 11139.7F,
- 10460.0F, 9821.72F, 9222.39F, 8659.64F,
- 8131.23F, 7635.06F, 7169.17F, 6731.70F,
- 6320.93F, 5935.23F, 5573.06F, 5232.99F,
- 4913.67F, 4613.84F, 4332.30F, 4067.94F,
- 3819.72F, 3586.64F, 3367.78F, 3162.28F,
- 2969.31F, 2788.13F, 2617.99F, 2458.24F,
- 2308.24F, 2167.39F, 2035.14F, 1910.95F,
- 1794.35F, 1684.85F, 1582.04F, 1485.51F,
- 1394.86F, 1309.75F, 1229.83F, 1154.78F,
- 1084.32F, 1018.15F, 956.024F, 897.687F,
- 842.910F, 791.475F, 743.179F, 697.830F,
- 655.249F, 615.265F, 577.722F, 542.469F,
- 509.367F, 478.286F, 449.101F, 421.696F,
- 395.964F, 371.803F, 349.115F, 327.812F,
- 307.809F, 289.026F, 271.390F, 254.830F,
- 239.280F, 224.679F, 210.969F, 198.096F,
- 186.008F, 174.658F, 164.000F, 153.993F,
- 144.596F, 135.773F, 127.488F, 119.708F,
- 112.404F, 105.545F, 99.1046F, 93.0572F,
- 87.3788F, 82.0469F, 77.0404F, 72.3394F,
- 67.9252F, 63.7804F, 59.8885F, 56.2341F,
- 52.8027F, 49.5807F, 46.5553F, 43.7144F,
- 41.0470F, 38.5423F, 36.1904F, 33.9821F,
- 31.9085F, 29.9614F, 28.1332F, 26.4165F,
- 24.8045F, 23.2910F, 21.8697F, 20.5352F,
- 19.2822F, 18.1056F, 17.0008F, 15.9634F,
- 14.9893F, 14.0746F, 13.2158F, 12.4094F,
- 11.6522F, 10.9411F, 10.2735F, 9.64662F,
- 9.05798F, 8.50526F, 7.98626F, 7.49894F,
- 7.04135F, 6.61169F, 6.20824F, 5.82941F,
- 5.47370F, 5.13970F, 4.82607F, 4.53158F,
- 4.25507F, 3.99542F, 3.75162F, 3.52269F,
- 3.30774F, 3.10590F, 2.91638F, 2.73842F,
- 2.57132F, 2.41442F, 2.26709F, 2.12875F,
- 1.99885F, 1.87688F, 1.76236F, 1.65482F,
- 1.55384F, 1.45902F, 1.36999F, 1.28640F,
- 1.20790F, 1.13419F, 1.06499F, 1.F
+static const float FLOOR1_fromdB_INV_LOOKUP[256]={
+ 0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F,
+ 7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F,
+ 5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F,
+ 4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F,
+ 3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F,
+ 2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F,
+ 2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F,
+ 1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F,
+ 1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F,
+ 973377.F, 913981.F, 858210.F, 805842.F,
+ 756669.F, 710497.F, 667142.F, 626433.F,
+ 588208.F, 552316.F, 518613.F, 486967.F,
+ 457252.F, 429351.F, 403152.F, 378551.F,
+ 355452.F, 333762.F, 313396.F, 294273.F,
+ 276316.F, 259455.F, 243623.F, 228757.F,
+ 214798.F, 201691.F, 189384.F, 177828.F,
+ 166977.F, 156788.F, 147221.F, 138237.F,
+ 129802.F, 121881.F, 114444.F, 107461.F,
+ 100903.F, 94746.3F, 88964.9F, 83536.2F,
+ 78438.8F, 73652.5F, 69158.2F, 64938.1F,
+ 60975.6F, 57254.9F, 53761.2F, 50480.6F,
+ 47400.3F, 44507.9F, 41792.0F, 39241.9F,
+ 36847.3F, 34598.9F, 32487.7F, 30505.3F,
+ 28643.8F, 26896.0F, 25254.8F, 23713.7F,
+ 22266.7F, 20908.0F, 19632.2F, 18434.2F,
+ 17309.4F, 16253.1F, 15261.4F, 14330.1F,
+ 13455.7F, 12634.6F, 11863.7F, 11139.7F,
+ 10460.0F, 9821.72F, 9222.39F, 8659.64F,
+ 8131.23F, 7635.06F, 7169.17F, 6731.70F,
+ 6320.93F, 5935.23F, 5573.06F, 5232.99F,
+ 4913.67F, 4613.84F, 4332.30F, 4067.94F,
+ 3819.72F, 3586.64F, 3367.78F, 3162.28F,
+ 2969.31F, 2788.13F, 2617.99F, 2458.24F,
+ 2308.24F, 2167.39F, 2035.14F, 1910.95F,
+ 1794.35F, 1684.85F, 1582.04F, 1485.51F,
+ 1394.86F, 1309.75F, 1229.83F, 1154.78F,
+ 1084.32F, 1018.15F, 956.024F, 897.687F,
+ 842.910F, 791.475F, 743.179F, 697.830F,
+ 655.249F, 615.265F, 577.722F, 542.469F,
+ 509.367F, 478.286F, 449.101F, 421.696F,
+ 395.964F, 371.803F, 349.115F, 327.812F,
+ 307.809F, 289.026F, 271.390F, 254.830F,
+ 239.280F, 224.679F, 210.969F, 198.096F,
+ 186.008F, 174.658F, 164.000F, 153.993F,
+ 144.596F, 135.773F, 127.488F, 119.708F,
+ 112.404F, 105.545F, 99.1046F, 93.0572F,
+ 87.3788F, 82.0469F, 77.0404F, 72.3394F,
+ 67.9252F, 63.7804F, 59.8885F, 56.2341F,
+ 52.8027F, 49.5807F, 46.5553F, 43.7144F,
+ 41.0470F, 38.5423F, 36.1904F, 33.9821F,
+ 31.9085F, 29.9614F, 28.1332F, 26.4165F,
+ 24.8045F, 23.2910F, 21.8697F, 20.5352F,
+ 19.2822F, 18.1056F, 17.0008F, 15.9634F,
+ 14.9893F, 14.0746F, 13.2158F, 12.4094F,
+ 11.6522F, 10.9411F, 10.2735F, 9.64662F,
+ 9.05798F, 8.50526F, 7.98626F, 7.49894F,
+ 7.04135F, 6.61169F, 6.20824F, 5.82941F,
+ 5.47370F, 5.13970F, 4.82607F, 4.53158F,
+ 4.25507F, 3.99542F, 3.75162F, 3.52269F,
+ 3.30774F, 3.10590F, 2.91638F, 2.73842F,
+ 2.57132F, 2.41442F, 2.26709F, 2.12875F,
+ 1.99885F, 1.87688F, 1.76236F, 1.65482F,
+ 1.55384F, 1.45902F, 1.36999F, 1.28640F,
+ 1.20790F, 1.13419F, 1.06499F, 1.F
};
void _vp_remove_floor(vorbis_look_psy *p,
float *mdct,
int *codedflr,
float *residue,
- int sliding_lowpass)
-{
+ int sliding_lowpass){
- int i, n = p->n;
+ int i,n=p->n;
- if(sliding_lowpass > n)sliding_lowpass = n;
+ if(sliding_lowpass>n)sliding_lowpass=n;
- for(i = 0; i < sliding_lowpass; i++)
- {
- residue[i] =
- mdct[i] * FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
- }
+ for(i=0;i<sliding_lowpass;i++){
+ residue[i]=
+ mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
+ }
- for(; i < n; i++)
- residue[i] = 0.;
+ for(;i<n;i++)
+ residue[i]=0.;
}
void _vp_noisemask(vorbis_look_psy *p,
float *logmdct,
- float *logmask)
-{
+ float *logmask){
- int i, n = p->n;
- float *work = alloca(n * sizeof(*work));
+ int i,n=p->n;
+ float *work=alloca(n*sizeof(*work));
- bark_noise_hybridmp(n, p->bark, logmdct, logmask,
- 140., -1);
+ bark_noise_hybridmp(n,p->bark,logmdct,logmask,
+ 140.,-1);
- for(i = 0; i < n; i++)work[i] = logmdct[i] - logmask[i];
+ for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
- bark_noise_hybridmp(n, p->bark, work, logmask, 0.,
- p->vi->noisewindowfixed);
+ bark_noise_hybridmp(n,p->bark,work,logmask,0.,
+ p->vi->noisewindowfixed);
- for(i = 0; i < n; i++)work[i] = logmdct[i] - work[i];
+ for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
#if 0
- {
- static int seq = 0;
+ {
+ static int seq=0;
- float work2[n];
- for(i = 0; i < n; i++)
- {
- work2[i] = logmask[i] + work[i];
- }
+ float work2[n];
+ for(i=0;i<n;i++){
+ work2[i]=logmask[i]+work[i];
+ }
- if(seq & 1)
- _analysis_output("median2R", seq / 2, work, n, 1, 0, 0);
- else
- _analysis_output("median2L", seq / 2, work, n, 1, 0, 0);
+ if(seq&1)
+ _analysis_output("median2R",seq/2,work,n,1,0,0);
+ else
+ _analysis_output("median2L",seq/2,work,n,1,0,0);
- if(seq & 1)
- _analysis_output("envelope2R", seq / 2, work2, n, 1, 0, 0);
- else
- _analysis_output("envelope2L", seq / 2, work2, n, 1, 0, 0);
- seq++;
- }
+ if(seq&1)
+ _analysis_output("envelope2R",seq/2,work2,n,1,0,0);
+ else
+ _analysis_output("envelope2L",seq/2,work2,n,1,0,0);
+ seq++;
+ }
#endif
- for(i = 0; i < n; i++)
- {
- int dB = logmask[i] + .5;
- if(dB >= NOISE_COMPAND_LEVELS)dB = NOISE_COMPAND_LEVELS - 1;
- if(dB < 0)dB = 0;
- logmask[i] = work[i] + p->vi->noisecompand[dB];
- }
+ for(i=0;i<n;i++){
+ int dB=logmask[i]+.5;
+ if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1;
+ if(dB<0)dB=0;
+ logmask[i]= work[i]+p->vi->noisecompand[dB];
+ }
}
@@ -920,25 +834,24 @@ void _vp_tonemask(vorbis_look_psy *p,
float *logfft,
float *logmask,
float global_specmax,
- float local_specmax)
-{
+ float local_specmax){
- int i, n = p->n;
+ int i,n=p->n;
- float *seed = alloca(sizeof(*seed) * p->total_octave_lines);
- float att = local_specmax + p->vi->ath_adjatt;
- for(i = 0; i < p->total_octave_lines; i++)seed[i] = NEGINF;
+ float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
+ float att=local_specmax+p->vi->ath_adjatt;
+ for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
- /* set the ATH (floating below localmax, not global max by a
- specified att) */
- if(att < p->vi->ath_maxatt)att = p->vi->ath_maxatt;
+ /* set the ATH (floating below localmax, not global max by a
+ specified att) */
+ if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
- for(i = 0; i < n; i++)
- logmask[i] = p->ath[i] + att;
+ for(i=0;i<n;i++)
+ logmask[i]=p->ath[i]+att;
- /* tone masking */
- seed_loop(p, (const float ***)p->tonecurves, logfft, logmask, seed, global_specmax);
- max_seeds(p, seed, logmask);
+ /* tone masking */
+ seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax);
+ max_seeds(p,seed,logmask);
}
@@ -948,127 +861,113 @@ void _vp_offset_and_mix(vorbis_look_psy *p,
int offset_select,
float *logmask,
float *mdct,
- float *logmdct)
-{
- int i, n = p->n;
- float de, coeffi, cx;/* AoTuV */
- float toneatt = p->vi->tone_masteratt[offset_select];
-
- cx = p->m_val;
-
- for(i = 0; i < n; i++)
- {
- float val = noise[i] + p->noiseoffset[offset_select][i];
- if(val > p->vi->noisemaxsupp)val = p->vi->noisemaxsupp;
- logmask[i] = max(val, tone[i] + toneatt);
-
-
- /* AoTuV */
- /** @ M1 **
- The following codes improve a noise problem.
- A fundamental idea uses the value of masking and carries out
- the relative compensation of the MDCT.
- However, this code is not perfect and all noise problems cannot be solved.
- by Aoyumi @ 2004/04/18
- */
-
- if(offset_select == 1)
- {
- coeffi = -17.2; /* coeffi is a -17.2dB threshold */
- val = val - logmdct[i]; /* val == mdct line value relative to floor in dB */
-
- if(val > coeffi)
- {
- /* mdct value is > -17.2 dB below floor */
-
- de = 1.0 - ((val - coeffi) * 0.005 * cx);
- /* pro-rated attenuation:
- -0.00 dB boost if mdct value is -17.2dB (relative to floor)
- -0.77 dB boost if mdct value is 0dB (relative to floor)
- -1.64 dB boost if mdct value is +17.2dB (relative to floor)
- etc... */
-
- if(de < 0) de = 0.0001;
- }
- else
- /* mdct value is <= -17.2 dB below floor */
+ float *logmdct){
+ int i,n=p->n;
+ float de, coeffi, cx;/* AoTuV */
+ float toneatt=p->vi->tone_masteratt[offset_select];
+
+ cx = p->m_val;
+
+ for(i=0;i<n;i++){
+ float val= noise[i]+p->noiseoffset[offset_select][i];
+ if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp;
+ logmask[i]=max(val,tone[i]+toneatt);
+
+
+ /* AoTuV */
+ /** @ M1 **
+ The following codes improve a noise problem.
+ A fundamental idea uses the value of masking and carries out
+ the relative compensation of the MDCT.
+ However, this code is not perfect and all noise problems cannot be solved.
+ by Aoyumi @ 2004/04/18
+ */
+
+ if(offset_select == 1) {
+ coeffi = -17.2; /* coeffi is a -17.2dB threshold */
+ val = val - logmdct[i]; /* val == mdct line value relative to floor in dB */
+
+ if(val > coeffi){
+ /* mdct value is > -17.2 dB below floor */
+
+ de = 1.0-((val-coeffi)*0.005*cx);
+ /* pro-rated attenuation:
+ -0.00 dB boost if mdct value is -17.2dB (relative to floor)
+ -0.77 dB boost if mdct value is 0dB (relative to floor)
+ -1.64 dB boost if mdct value is +17.2dB (relative to floor)
+ etc... */
- de = 1.0 - ((val - coeffi) * 0.0003 * cx);
- /* pro-rated attenuation:
- +0.00 dB atten if mdct value is -17.2dB (relative to floor)
- +0.45 dB atten if mdct value is -34.4dB (relative to floor)
- etc... */
+ if(de < 0) de = 0.0001;
+ }else
+ /* mdct value is <= -17.2 dB below floor */
- mdct[i] *= de;
+ de = 1.0-((val-coeffi)*0.0003*cx);
+ /* pro-rated attenuation:
+ +0.00 dB atten if mdct value is -17.2dB (relative to floor)
+ +0.45 dB atten if mdct value is -34.4dB (relative to floor)
+ etc... */
+
+ mdct[i] *= de;
- }
}
+ }
}
-float _vp_ampmax_decay(float amp, vorbis_dsp_state *vd)
-{
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- vorbis_info_psy_global *gi = &ci->psy_g_param;
+float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ vorbis_info_psy_global *gi=&ci->psy_g_param;
- int n = ci->blocksizes[vd->W] / 2;
- float secs = (float)n / vi->rate;
+ int n=ci->blocksizes[vd->W]/2;
+ float secs=(float)n/vi->rate;
- amp += secs * gi->ampmax_att_per_sec;
- if(amp < -9999)amp = -9999;
- return(amp);
+ amp+=secs*gi->ampmax_att_per_sec;
+ if(amp<-9999)amp=-9999;
+ return(amp);
}
static void couple_lossless(float A, float B,
- float *qA, float *qB)
-{
- int test1 = fabs(*qA) > fabs(*qB);
- test1 -= fabs(*qA) < fabs(*qB);
-
- if(!test1)test1 = ((fabs(A) > fabs(B)) << 1) - 1;
- if(test1 == 1)
- {
- *qB = (*qA > 0.f ? *qA - *qB : *qB - *qA);
- }
- else
- {
- float temp = *qB;
- *qB = (*qB > 0.f ? *qA - *qB : *qB - *qA);
- *qA = temp;
- }
-
- if(*qB > fabs(*qA) * 1.9999f)
- {
- *qB = -fabs(*qA) * 2.f;
- *qA = -*qA;
- }
+ float *qA, float *qB){
+ int test1=fabs(*qA)>fabs(*qB);
+ test1-= fabs(*qA)<fabs(*qB);
+
+ if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
+ if(test1==1){
+ *qB=(*qA>0.f?*qA-*qB:*qB-*qA);
+ }else{
+ float temp=*qB;
+ *qB=(*qB>0.f?*qA-*qB:*qB-*qA);
+ *qA=temp;
+ }
+
+ if(*qB>fabs(*qA)*1.9999f){
+ *qB= -fabs(*qA)*2.f;
+ *qA= -*qA;
+ }
}
-static const float hypot_lookup[32] =
-{
- -0.009935, -0.011245, -0.012726, -0.014397,
- -0.016282, -0.018407, -0.020800, -0.023494,
- -0.026522, -0.029923, -0.033737, -0.038010,
- -0.042787, -0.048121, -0.054064, -0.060671,
- -0.068000, -0.076109, -0.085054, -0.094892,
- -0.105675, -0.117451, -0.130260, -0.144134,
- -0.159093, -0.175146, -0.192286, -0.210490,
- -0.229718, -0.249913, -0.271001, -0.292893
-};
+static const float hypot_lookup[32]={
+ -0.009935, -0.011245, -0.012726, -0.014397,
+ -0.016282, -0.018407, -0.020800, -0.023494,
+ -0.026522, -0.029923, -0.033737, -0.038010,
+ -0.042787, -0.048121, -0.054064, -0.060671,
+ -0.068000, -0.076109, -0.085054, -0.094892,
+ -0.105675, -0.117451, -0.130260, -0.144134,
+ -0.159093, -0.175146, -0.192286, -0.210490,
+ -0.229718, -0.249913, -0.271001, -0.292893};
static void precomputed_couple_point(float premag,
- int floorA, int floorB,
- float *mag, float *ang)
-{
+ int floorA,int floorB,
+ float *mag, float *ang){
- int test = (floorA > floorB) - 1;
- int offset = 31 - abs(floorA - floorB);
- float floormag = hypot_lookup[((offset<0)-1)&offset] + 1.f;
+ int test=(floorA>floorB)-1;
+ int offset=31-abs(floorA-floorB);
+ float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
- floormag *= FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
+ floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
- *mag = premag * floormag;
- *ang = 0.f;
+ *mag=premag*floormag;
+ *ang=0.f;
}
/* just like below, this is currently set up to only do
@@ -1077,29 +976,25 @@ static void precomputed_couple_point(float premag,
/* doing the real circular magnitude calculation is audibly superior
to (A+B)/sqrt(2) */
-static float dipole_hypot(float a, float b)
-{
- if(a > 0.)
- {
- if(b > 0.)return sqrt(a * a + b * b);
- if(a > -b)return sqrt(a * a - b * b);
- return -sqrt(b * b - a * a);
- }
- if(b < 0.)return -sqrt(a * a + b * b);
- if(-a > b)return -sqrt(a * a - b * b);
- return sqrt(b * b - a * a);
+static float dipole_hypot(float a, float b){
+ if(a>0.){
+ if(b>0.)return sqrt(a*a+b*b);
+ if(a>-b)return sqrt(a*a-b*b);
+ return -sqrt(b*b-a*a);
+ }
+ if(b<0.)return -sqrt(a*a+b*b);
+ if(-a>b)return -sqrt(a*a-b*b);
+ return sqrt(b*b-a*a);
}
-static float round_hypot(float a, float b)
-{
- if(a > 0.)
- {
- if(b > 0.)return sqrt(a * a + b * b);
- if(a > -b)return sqrt(a * a + b * b);
- return -sqrt(b * b + a * a);
- }
- if(b < 0.)return -sqrt(a * a + b * b);
- if(-a > b)return -sqrt(a * a + b * b);
- return sqrt(b * b + a * a);
+static float round_hypot(float a, float b){
+ if(a>0.){
+ if(b>0.)return sqrt(a*a+b*b);
+ if(a>-b)return sqrt(a*a+b*b);
+ return -sqrt(b*b+a*a);
+ }
+ if(b<0.)return -sqrt(a*a+b*b);
+ if(-a>b)return -sqrt(a*a+b*b);
+ return sqrt(b*b+a*a);
}
/* revert to round hypot for now */
@@ -1107,137 +1002,119 @@ float **_vp_quantize_couple_memo(vorbis_block *vb,
vorbis_info_psy_global *g,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
- float **mdct)
-{
-
- int i, j, n = p->n;
- float **ret = _vorbis_block_alloc(vb, vi->coupling_steps * sizeof(*ret));
- int limit = g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
-
- for(i = 0; i < vi->coupling_steps; i++)
- {
- float *mdctM = mdct[vi->coupling_mag[i]];
- float *mdctA = mdct[vi->coupling_ang[i]];
- ret[i] = _vorbis_block_alloc(vb, n * sizeof(**ret));
- for(j = 0; j < limit; j++)
- ret[i][j] = dipole_hypot(mdctM[j], mdctA[j]);
- for(; j < n; j++)
- ret[i][j] = round_hypot(mdctM[j], mdctA[j]);
- }
-
- return(ret);
+ float **mdct){
+
+ int i,j,n=p->n;
+ float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+ int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
+
+ for(i=0;i<vi->coupling_steps;i++){
+ float *mdctM=mdct[vi->coupling_mag[i]];
+ float *mdctA=mdct[vi->coupling_ang[i]];
+ ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
+ for(j=0;j<limit;j++)
+ ret[i][j]=dipole_hypot(mdctM[j],mdctA[j]);
+ for(;j<n;j++)
+ ret[i][j]=round_hypot(mdctM[j],mdctA[j]);
+ }
+
+ return(ret);
}
/* this is for per-channel noise normalization */
-static int apsort(const void *a, const void *b)
-{
- float f1 = fabs(**(float**)a);
- float f2 = fabs(**(float**)b);
- return (f1 < f2) - (f1 > f2);
+static int apsort(const void *a, const void *b){
+ float f1=fabs(**(float**)a);
+ float f2=fabs(**(float**)b);
+ return (f1<f2)-(f1>f2);
}
int **_vp_quantize_couple_sort(vorbis_block *vb,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
- float **mags)
-{
-
-
- if(p->vi->normal_point_p)
- {
- int i, j, k, n = p->n;
- int **ret = _vorbis_block_alloc(vb, vi->coupling_steps * sizeof(*ret));
- int partition = p->vi->normal_partition;
- float **work = alloca(sizeof(*work) * partition);
-
- for(i = 0; i < vi->coupling_steps; i++)
- {
- ret[i] = _vorbis_block_alloc(vb, n * sizeof(**ret));
-
- for(j = 0; j < n; j += partition)
- {
- for(k = 0; k < partition; k++)work[k] = mags[i] + k + j;
- qsort(work, partition, sizeof(*work), apsort);
- for(k = 0; k < partition; k++)ret[i][k+j] = work[k] - mags[i];
- }
- }
- return(ret);
+ float **mags){
+
+
+ if(p->vi->normal_point_p){
+ int i,j,k,n=p->n;
+ int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+ int partition=p->vi->normal_partition;
+ float **work=alloca(sizeof(*work)*partition);
+
+ for(i=0;i<vi->coupling_steps;i++){
+ ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
+
+ for(j=0;j<n;j+=partition){
+ for(k=0;k<partition;k++)work[k]=mags[i]+k+j;
+ qsort(work,partition,sizeof(*work),apsort);
+ for(k=0;k<partition;k++)ret[i][k+j]=work[k]-mags[i];
+ }
}
- return(NULL);
+ return(ret);
+ }
+ return(NULL);
}
void _vp_noise_normalize_sort(vorbis_look_psy *p,
- float *magnitudes, int *sortedindex)
-{
- int i, j, n = p->n;
- vorbis_info_psy *vi = p->vi;
- int partition = vi->normal_partition;
- float **work = alloca(sizeof(*work) * partition);
- int start = vi->normal_start;
-
- for(j = start; j < n; j += partition)
- {
- if(j + partition > n)partition = n - j;
- for(i = 0; i < partition; i++)work[i] = magnitudes + i + j;
- qsort(work, partition, sizeof(*work), apsort);
- for(i = 0; i < partition; i++)
- {
- sortedindex[i+j-start] = work[i] - magnitudes;
- }
+ float *magnitudes,int *sortedindex){
+ int i,j,n=p->n;
+ vorbis_info_psy *vi=p->vi;
+ int partition=vi->normal_partition;
+ float **work=alloca(sizeof(*work)*partition);
+ int start=vi->normal_start;
+
+ for(j=start;j<n;j+=partition){
+ if(j+partition>n)partition=n-j;
+ for(i=0;i<partition;i++)work[i]=magnitudes+i+j;
+ qsort(work,partition,sizeof(*work),apsort);
+ for(i=0;i<partition;i++){
+ sortedindex[i+j-start]=work[i]-magnitudes;
}
+ }
}
void _vp_noise_normalize(vorbis_look_psy *p,
- float *in, float *out, int *sortedindex)
-{
- int flag = 0, i, j = 0, n = p->n;
- vorbis_info_psy *vi = p->vi;
- int partition = vi->normal_partition;
- int start = vi->normal_start;
-
- if(start > n)start = n;
-
- if(vi->normal_channel_p)
- {
- for(; j < start; j++)
- out[j] = rint(in[j]);
-
- for(; j + partition <= n; j += partition)
- {
- float acc = 0.;
- int k;
-
- for(i = j; i < j + partition; i++)
- acc += in[i] * in[i];
-
- for(i = 0; i < partition; i++)
- {
- k = sortedindex[i+j-start];
-
- if(in[k]*in[k] >= .25f)
- {
- out[k] = rint(in[k]);
- acc -= in[k] * in[k];
- flag = 1;
- }
- else
- {
- if(acc < vi->normal_thresh)break;
- out[k] = unitnorm(in[k]);
- acc -= 1.;
- }
- }
-
- for(; i < partition; i++)
- {
- k = sortedindex[i+j-start];
- out[k] = 0.;
- }
+ float *in,float *out,int *sortedindex){
+ int flag=0,i,j=0,n=p->n;
+ vorbis_info_psy *vi=p->vi;
+ int partition=vi->normal_partition;
+ int start=vi->normal_start;
+
+ if(start>n)start=n;
+
+ if(vi->normal_channel_p){
+ for(;j<start;j++)
+ out[j]=rint(in[j]);
+
+ for(;j+partition<=n;j+=partition){
+ float acc=0.;
+ int k;
+
+ for(i=j;i<j+partition;i++)
+ acc+=in[i]*in[i];
+
+ for(i=0;i<partition;i++){
+ k=sortedindex[i+j-start];
+
+ if(in[k]*in[k]>=.25f){
+ out[k]=rint(in[k]);
+ acc-=in[k]*in[k];
+ flag=1;
+ }else{
+ if(acc<vi->normal_thresh)break;
+ out[k]=unitnorm(in[k]);
+ acc-=1.;
}
+ }
+
+ for(;i<partition;i++){
+ k=sortedindex[i+j-start];
+ out[k]=0.;
+ }
}
+ }
- for(; j < n; j++)
- out[j] = rint(in[j]);
+ for(;j<n;j++)
+ out[j]=rint(in[j]);
}
@@ -1250,98 +1127,84 @@ void _vp_couple(int blobno,
int **mag_sort,
int **ifloor,
int *nonzero,
- int sliding_lowpass)
-{
-
- int i, j, k, n = p->n;
-
- /* perform any requested channel coupling */
- /* point stereo can only be used in a first stage (in this encoder)
- because of the dependency on floor lookups */
- for(i = 0; i < vi->coupling_steps; i++)
- {
-
- /* once we're doing multistage coupling in which a channel goes
- through more than one coupling step, the floor vector
- magnitudes will also have to be recalculated an propogated
- along with PCM. Right now, we're not (that will wait until 5.1
- most likely), so the code isn't here yet. The memory management
- here is all assuming single depth couplings anyway. */
-
- /* make sure coupling a zero and a nonzero channel results in two
- nonzero channels. */
- if(nonzero[vi->coupling_mag[i]] ||
- nonzero[vi->coupling_ang[i]])
- {
-
-
- float *rM = res[vi->coupling_mag[i]];
- float *rA = res[vi->coupling_ang[i]];
- float *qM = rM + n;
- float *qA = rA + n;
- int *floorM = ifloor[vi->coupling_mag[i]];
- int *floorA = ifloor[vi->coupling_ang[i]];
- float prepoint = stereo_threshholds[g->coupling_prepointamp[blobno]];
- float postpoint = stereo_threshholds[g->coupling_postpointamp[blobno]];
- int partition = (p->vi->normal_point_p ? p->vi->normal_partition : p->n);
- int limit = g->coupling_pointlimit[p->vi->blockflag][blobno];
- int pointlimit = limit;
-
- nonzero[vi->coupling_mag[i]] = 1;
- nonzero[vi->coupling_ang[i]] = 1;
-
- /* The threshold of a stereo is changed with the size of n */
- if(n > 1000)
- postpoint = stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
-
- for(j = 0; j < p->n; j += partition)
- {
- float acc = 0.f;
-
- for(k = 0; k < partition; k++)
- {
- int l = k + j;
-
- if(l < sliding_lowpass)
- {
- if((l >= limit && fabs(rM[l]) < postpoint && fabs(rA[l]) < postpoint) ||
- (fabs(rM[l]) < prepoint && fabs(rA[l]) < prepoint))
- {
-
-
- precomputed_couple_point(mag_memo[i][l],
- floorM[l], floorA[l],
- qM + l, qA + l);
-
- if(rint(qM[l]) == 0.f)acc += qM[l] * qM[l];
- }
- else
- {
- couple_lossless(rM[l], rA[l], qM + l, qA + l);
- }
- }
- else
- {
- qM[l] = 0.;
- qA[l] = 0.;
- }
- }
-
- if(p->vi->normal_point_p)
- {
- for(k = 0; k < partition && acc >= p->vi->normal_thresh; k++)
- {
- int l = mag_sort[i][j+k];
- if(l < sliding_lowpass && l >= pointlimit && rint(qM[l]) == 0.f)
- {
- qM[l] = unitnorm(qM[l]);
- acc -= 1.f;
- }
- }
- }
+ int sliding_lowpass){
+
+ int i,j,k,n=p->n;
+
+ /* perform any requested channel coupling */
+ /* point stereo can only be used in a first stage (in this encoder)
+ because of the dependency on floor lookups */
+ for(i=0;i<vi->coupling_steps;i++){
+
+ /* once we're doing multistage coupling in which a channel goes
+ through more than one coupling step, the floor vector
+ magnitudes will also have to be recalculated an propogated
+ along with PCM. Right now, we're not (that will wait until 5.1
+ most likely), so the code isn't here yet. The memory management
+ here is all assuming single depth couplings anyway. */
+
+ /* make sure coupling a zero and a nonzero channel results in two
+ nonzero channels. */
+ if(nonzero[vi->coupling_mag[i]] ||
+ nonzero[vi->coupling_ang[i]]){
+
+
+ float *rM=res[vi->coupling_mag[i]];
+ float *rA=res[vi->coupling_ang[i]];
+ float *qM=rM+n;
+ float *qA=rA+n;
+ int *floorM=ifloor[vi->coupling_mag[i]];
+ int *floorA=ifloor[vi->coupling_ang[i]];
+ float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
+ float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
+ int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
+ int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
+ int pointlimit=limit;
+
+ nonzero[vi->coupling_mag[i]]=1;
+ nonzero[vi->coupling_ang[i]]=1;
+
+ /* The threshold of a stereo is changed with the size of n */
+ if(n > 1000)
+ postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
+
+ for(j=0;j<p->n;j+=partition){
+ float acc=0.f;
+
+ for(k=0;k<partition;k++){
+ int l=k+j;
+
+ if(l<sliding_lowpass){
+ if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
+ (fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
+
+
+ precomputed_couple_point(mag_memo[i][l],
+ floorM[l],floorA[l],
+ qM+l,qA+l);
+
+ if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
+ }else{
+ couple_lossless(rM[l],rA[l],qM+l,qA+l);
}
+ }else{
+ qM[l]=0.;
+ qA[l]=0.;
+ }
}
+
+ if(p->vi->normal_point_p){
+ for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
+ int l=mag_sort[i][j+k];
+ if(l<sliding_lowpass && l>=pointlimit && rint(qM[l])==0.f){
+ qM[l]=unitnorm(qM[l]);
+ acc-=1.f;
+ }
+ }
+ }
+ }
}
+ }
}
/* AoTuV */
@@ -1352,18 +1215,16 @@ void _vp_couple(int blobno,
*/
void hf_reduction(vorbis_info_psy_global *g,
- vorbis_look_psy *p,
- vorbis_info_mapping0 *vi,
- float **mdct)
-{
-
- int i, j, n = p->n, de = 0.3 * p->m_val;
- int limit = g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
-
- for(i = 0; i < vi->coupling_steps; i++)
- {
- /* for(j=start; j<limit; j++){} // ???*/
- for(j = limit; j < n; j++)
- mdct[i][j] *= (1.0 - de * ((float)(j - limit) / (float)(n - limit)));
- }
+ vorbis_look_psy *p,
+ vorbis_info_mapping0 *vi,
+ float **mdct){
+
+ int i,j,n=p->n, de=0.3*p->m_val;
+ int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
+
+ for(i=0; i<vi->coupling_steps; i++){
+ /* for(j=start; j<limit; j++){} // ???*/
+ for(j=limit; j<n; j++)
+ mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/psy.h b/src/filters/transform/MpaDecFilter/libvorbisidec/psy.h
index b098c3321..e5e8886a0 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/psy.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/psy.h
@@ -33,93 +33,89 @@
#define P_NOISECURVES 3
#define NOISE_COMPAND_LEVELS 40
-typedef struct vorbis_info_psy
-{
- int blockflag;
-
- float ath_adjatt;
- float ath_maxatt;
-
- float tone_masteratt[P_NOISECURVES];
- float tone_centerboost;
- float tone_decay;
- float tone_abs_limit;
- float toneatt[P_BANDS];
-
- int noisemaskp;
- float noisemaxsupp;
- float noisewindowlo;
- float noisewindowhi;
- int noisewindowlomin;
- int noisewindowhimin;
- int noisewindowfixed;
- float noiseoff[P_NOISECURVES][P_BANDS];
- float noisecompand[NOISE_COMPAND_LEVELS];
-
- float max_curve_dB;
-
- int normal_channel_p;
- int normal_point_p;
- int normal_start;
- int normal_partition;
- double normal_thresh;
+typedef struct vorbis_info_psy{
+ int blockflag;
+
+ float ath_adjatt;
+ float ath_maxatt;
+
+ float tone_masteratt[P_NOISECURVES];
+ float tone_centerboost;
+ float tone_decay;
+ float tone_abs_limit;
+ float toneatt[P_BANDS];
+
+ int noisemaskp;
+ float noisemaxsupp;
+ float noisewindowlo;
+ float noisewindowhi;
+ int noisewindowlomin;
+ int noisewindowhimin;
+ int noisewindowfixed;
+ float noiseoff[P_NOISECURVES][P_BANDS];
+ float noisecompand[NOISE_COMPAND_LEVELS];
+
+ float max_curve_dB;
+
+ int normal_channel_p;
+ int normal_point_p;
+ int normal_start;
+ int normal_partition;
+ double normal_thresh;
} vorbis_info_psy;
-typedef struct
-{
- int eighth_octave_lines;
+typedef struct{
+ int eighth_octave_lines;
- /* for block long/short tuning; encode only */
- float preecho_thresh[VE_BANDS];
- float postecho_thresh[VE_BANDS];
- float stretch_penalty;
- float preecho_minenergy;
+ /* for block long/short tuning; encode only */
+ float preecho_thresh[VE_BANDS];
+ float postecho_thresh[VE_BANDS];
+ float stretch_penalty;
+ float preecho_minenergy;
- float ampmax_att_per_sec;
+ float ampmax_att_per_sec;
- /* channel coupling config */
- int coupling_pkHz[PACKETBLOBS];
- int coupling_pointlimit[2][PACKETBLOBS];
- int coupling_prepointamp[PACKETBLOBS];
- int coupling_postpointamp[PACKETBLOBS];
- int sliding_lowpass[2][PACKETBLOBS];
+ /* channel coupling config */
+ int coupling_pkHz[PACKETBLOBS];
+ int coupling_pointlimit[2][PACKETBLOBS];
+ int coupling_prepointamp[PACKETBLOBS];
+ int coupling_postpointamp[PACKETBLOBS];
+ int sliding_lowpass[2][PACKETBLOBS];
} vorbis_info_psy_global;
-typedef struct
-{
- float ampmax;
- int channels;
+typedef struct {
+ float ampmax;
+ int channels;
- vorbis_info_psy_global *gi;
- int coupling_pointlimit[2][P_NOISECURVES];
+ vorbis_info_psy_global *gi;
+ int coupling_pointlimit[2][P_NOISECURVES];
} vorbis_look_psy_global;
-typedef struct
-{
- int n;
- struct vorbis_info_psy *vi;
+typedef struct {
+ int n;
+ struct vorbis_info_psy *vi;
- float ***tonecurves;
- float **noiseoffset;
+ float ***tonecurves;
+ float **noiseoffset;
- float *ath;
- long *octave; /* in n.ocshift format */
- long *bark;
+ float *ath;
+ long *octave; /* in n.ocshift format */
+ long *bark;
- long firstoc;
- long shiftoc;
- int eighth_octave_lines; /* power of two, please */
- int total_octave_lines;
- long rate; /* cache it */
+ long firstoc;
+ long shiftoc;
+ int eighth_octave_lines; /* power of two, please */
+ int total_octave_lines;
+ long rate; /* cache it */
- float m_val; /* Masking compensation value */
+ float m_val; /* Masking compensation value */
} vorbis_look_psy;
-extern void _vp_psy_init(vorbis_look_psy *p, vorbis_info_psy *vi,
- vorbis_info_psy_global *gi, int n, long rate);
+extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
+ vorbis_info_psy_global *gi,int n,long rate);
extern void _vp_psy_clear(vorbis_look_psy *p);
extern void *_vi_psy_dup(void *source);
@@ -150,7 +146,7 @@ extern void _vp_offset_and_mix(vorbis_look_psy *p,
float *mdct,
float *logmdct);
-extern float _vp_ampmax_decay(float amp, vorbis_dsp_state *vd);
+extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
extern float **_vp_quantize_couple_memo(vorbis_block *vb,
vorbis_info_psy_global *g,
@@ -170,10 +166,10 @@ extern void _vp_couple(int blobno,
int sliding_lowpass);
extern void _vp_noise_normalize(vorbis_look_psy *p,
- float *in, float *out, int *sortedindex);
+ float *in,float *out,int *sortedindex);
extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
- float *magnitudes, int *sortedindex);
+ float *magnitudes,int *sortedindex);
extern int **_vp_quantize_couple_sort(vorbis_block *vb,
vorbis_look_psy *p,
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/registry.c b/src/filters/transform/MpaDecFilter/libvorbisidec/registry.c
index 72df3dd0f..3961ed140 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/registry.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/registry.c
@@ -29,20 +29,17 @@ extern const vorbis_func_residue residue1_exportbundle;
extern const vorbis_func_residue residue2_exportbundle;
extern const vorbis_func_mapping mapping0_exportbundle;
-const vorbis_func_floor *const _floor_P[] =
-{
- &floor0_exportbundle,
- &floor1_exportbundle,
+const vorbis_func_floor *const _floor_P[]={
+ &floor0_exportbundle,
+ &floor1_exportbundle,
};
-const vorbis_func_residue *const _residue_P[] =
-{
- &residue0_exportbundle,
- &residue1_exportbundle,
- &residue2_exportbundle,
+const vorbis_func_residue *const _residue_P[]={
+ &residue0_exportbundle,
+ &residue1_exportbundle,
+ &residue2_exportbundle,
};
-const vorbis_func_mapping *const _mapping_P[] =
-{
- &mapping0_exportbundle,
+const vorbis_func_mapping *const _mapping_P[]={
+ &mapping0_exportbundle,
};
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/res0.c b/src/filters/transform/MpaDecFilter/libvorbisidec/res0.c
index e0b76d2da..7a4b64ae8 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/res0.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/res0.c
@@ -35,1021 +35,914 @@
#include <stdio.h>
#endif
-typedef struct
-{
- vorbis_info_residue0 *info;
+typedef struct {
+ vorbis_info_residue0 *info;
- int parts;
- int stages;
- codebook *fullbooks;
- codebook *phrasebook;
- codebook ***partbooks;
+ int parts;
+ int stages;
+ codebook *fullbooks;
+ codebook *phrasebook;
+ codebook ***partbooks;
- int partvals;
- int **decodemap;
+ int partvals;
+ int **decodemap;
- long postbits;
- long phrasebits;
- long frames;
+ long postbits;
+ long phrasebits;
+ long frames;
#if defined(TRAIN_RES) || defined(TRAIN_RESAUX)
- int train_seq;
- long *training_data[8][64];
- float training_max[8][64];
- float training_min[8][64];
- float tmin;
- float tmax;
+ int train_seq;
+ long *training_data[8][64];
+ float training_max[8][64];
+ float training_min[8][64];
+ float tmin;
+ float tmax;
#endif
} vorbis_look_residue0;
-void res0_free_info(vorbis_info_residue *i)
-{
- vorbis_info_residue0 *info = (vorbis_info_residue0 *)i;
- if(info)
- {
- memset(info, 0, sizeof(*info));
- _ogg_free(info);
- }
+void res0_free_info(vorbis_info_residue *i){
+ vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
+ if(info){
+ memset(info,0,sizeof(*info));
+ _ogg_free(info);
+ }
}
-void res0_free_look(vorbis_look_residue *i)
-{
- int j;
- if(i)
- {
+void res0_free_look(vorbis_look_residue *i){
+ int j;
+ if(i){
- vorbis_look_residue0 *look = (vorbis_look_residue0 *)i;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
#ifdef TRAIN_RES
- {
- int j, k, l;
- for(j = 0; j < look->parts; j++)
- {
- /*fprintf(stderr,"partition %d: ",j);*/
- for(k = 0; k < 8; k++)
- if(look->training_data[k][j])
- {
- char buffer[80];
- FILE *of;
- codebook *statebook = look->partbooks[j][k];
-
- /* long and short into the same bucket by current convention */
- sprintf(buffer, "res_part%d_pass%d.vqd", j, k);
- of = fopen(buffer, "a");
-
- for(l = 0; l < statebook->entries; l++)
- fprintf(of, "%d:%ld\n", l, look->training_data[k][j][l]);
-
- fclose(of);
-
- /*fprintf(stderr,"%d(%.2f|%.2f) ",k,
- look->training_min[k][j],look->training_max[k][j]);*/
-
- _ogg_free(look->training_data[k][j]);
- look->training_data[k][j] = NULL;
- }
- /*fprintf(stderr,"\n");*/
- }
- }
- fprintf(stderr, "min/max residue: %g::%g\n", look->tmin, look->tmax);
+ {
+ int j,k,l;
+ for(j=0;j<look->parts;j++){
+ /*fprintf(stderr,"partition %d: ",j);*/
+ for(k=0;k<8;k++)
+ if(look->training_data[k][j]){
+ char buffer[80];
+ FILE *of;
+ codebook *statebook=look->partbooks[j][k];
+
+ /* long and short into the same bucket by current convention */
+ sprintf(buffer,"res_part%d_pass%d.vqd",j,k);
+ of=fopen(buffer,"a");
+
+ for(l=0;l<statebook->entries;l++)
+ fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]);
- /*fprintf(stderr,"residue bit usage %f:%f (%f total)\n",
- (float)look->phrasebits/look->frames,
- (float)look->postbits/look->frames,
- (float)(look->postbits+look->phrasebits)/look->frames);*/
-#endif
+ fclose(of);
+ /*fprintf(stderr,"%d(%.2f|%.2f) ",k,
+ look->training_min[k][j],look->training_max[k][j]);*/
- /*vorbis_info_residue0 *info=look->info;
+ _ogg_free(look->training_data[k][j]);
+ look->training_data[k][j]=NULL;
+ }
+ /*fprintf(stderr,"\n");*/
+ }
+ }
+ fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax);
- fprintf(stderr,
- "%ld frames encoded in %ld phrasebits and %ld residue bits "
- "(%g/frame) \n",look->frames,look->phrasebits,
- look->resbitsflat,
- (look->phrasebits+look->resbitsflat)/(float)look->frames);
+ /*fprintf(stderr,"residue bit usage %f:%f (%f total)\n",
+ (float)look->phrasebits/look->frames,
+ (float)look->postbits/look->frames,
+ (float)(look->postbits+look->phrasebits)/look->frames);*/
+#endif
- for(j=0;j<look->parts;j++){
- long acc=0;
- fprintf(stderr,"\t[%d] == ",j);
- for(k=0;k<look->stages;k++)
- if((info->secondstages[j]>>k)&1){
- fprintf(stderr,"%ld,",look->resbits[j][k]);
- acc+=look->resbits[j][k];
- }
- fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j],
- acc?(float)acc/(look->resvals[j]*info->grouping):0);
- }
- fprintf(stderr,"\n");*/
+ /*vorbis_info_residue0 *info=look->info;
- for(j = 0; j < look->parts; j++)
- if(look->partbooks[j])_ogg_free(look->partbooks[j]);
- _ogg_free(look->partbooks);
- for(j = 0; j < look->partvals; j++)
- _ogg_free(look->decodemap[j]);
- _ogg_free(look->decodemap);
+ fprintf(stderr,
+ "%ld frames encoded in %ld phrasebits and %ld residue bits "
+ "(%g/frame) \n",look->frames,look->phrasebits,
+ look->resbitsflat,
+ (look->phrasebits+look->resbitsflat)/(float)look->frames);
+
+ for(j=0;j<look->parts;j++){
+ long acc=0;
+ fprintf(stderr,"\t[%d] == ",j);
+ for(k=0;k<look->stages;k++)
+ if((info->secondstages[j]>>k)&1){
+ fprintf(stderr,"%ld,",look->resbits[j][k]);
+ acc+=look->resbits[j][k];
+ }
- memset(look, 0, sizeof(*look));
- _ogg_free(look);
+ fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j],
+ acc?(float)acc/(look->resvals[j]*info->grouping):0);
}
+ fprintf(stderr,"\n");*/
+
+ for(j=0;j<look->parts;j++)
+ if(look->partbooks[j])_ogg_free(look->partbooks[j]);
+ _ogg_free(look->partbooks);
+ for(j=0;j<look->partvals;j++)
+ _ogg_free(look->decodemap[j]);
+ _ogg_free(look->decodemap);
+
+ memset(look,0,sizeof(*look));
+ _ogg_free(look);
+ }
}
-static int ilog(unsigned int v)
-{
- int ret = 0;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
-static int icount(unsigned int v)
-{
- int ret = 0;
- while(v)
- {
- ret += v & 1;
- v >>= 1;
- }
- return(ret);
+static int icount(unsigned int v){
+ int ret=0;
+ while(v){
+ ret+=v&1;
+ v>>=1;
+ }
+ return(ret);
}
-void res0_pack(vorbis_info_residue *vr, oggpack_buffer *opb)
-{
- vorbis_info_residue0 *info = (vorbis_info_residue0 *)vr;
- int j, acc = 0;
- oggpack_write(opb, info->begin, 24);
- oggpack_write(opb, info->end, 24);
+void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){
+ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
+ int j,acc=0;
+ oggpack_write(opb,info->begin,24);
+ oggpack_write(opb,info->end,24);
- oggpack_write(opb, info->grouping - 1, 24); /* residue vectors to group and
+ oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and
code with a partitioned book */
- oggpack_write(opb, info->partitions - 1, 6); /* possible partition choices */
- oggpack_write(opb, info->groupbook, 8); /* group huffman book */
-
- /* secondstages is a bitmask; as encoding progresses pass by pass, a
- bitmask of one indicates this partition class has bits to write
- this pass */
- for(j = 0; j < info->partitions; j++)
- {
- if(ilog(info->secondstages[j]) > 3)
- {
- /* yes, this is a minor hack due to not thinking ahead */
- oggpack_write(opb, info->secondstages[j], 3);
- oggpack_write(opb, 1, 1);
- oggpack_write(opb, info->secondstages[j] >> 3, 5);
- }
- else
- oggpack_write(opb, info->secondstages[j], 4); /* trailing zero */
- acc += icount(info->secondstages[j]);
- }
- for(j = 0; j < acc; j++)
- oggpack_write(opb, info->booklist[j], 8);
+ oggpack_write(opb,info->partitions-1,6); /* possible partition choices */
+ oggpack_write(opb,info->groupbook,8); /* group huffman book */
+
+ /* secondstages is a bitmask; as encoding progresses pass by pass, a
+ bitmask of one indicates this partition class has bits to write
+ this pass */
+ for(j=0;j<info->partitions;j++){
+ if(ilog(info->secondstages[j])>3){
+ /* yes, this is a minor hack due to not thinking ahead */
+ oggpack_write(opb,info->secondstages[j],3);
+ oggpack_write(opb,1,1);
+ oggpack_write(opb,info->secondstages[j]>>3,5);
+ }else
+ oggpack_write(opb,info->secondstages[j],4); /* trailing zero */
+ acc+=icount(info->secondstages[j]);
+ }
+ for(j=0;j<acc;j++)
+ oggpack_write(opb,info->booklist[j],8);
}
/* vorbis_info is for range checking */
-vorbis_info_residue *res0_unpack(vorbis_info *vi, oggpack_buffer *opb)
-{
- int j, acc = 0;
- vorbis_info_residue0 *info = _ogg_calloc(1, sizeof(*info));
- codec_setup_info *ci = vi->codec_setup;
-
- info->begin = oggpack_read(opb, 24);
- info->end = oggpack_read(opb, 24);
- info->grouping = oggpack_read(opb, 24) + 1;
- info->partitions = oggpack_read(opb, 6) + 1;
- info->groupbook = oggpack_read(opb, 8);
-
- /* check for premature EOP */
- if(info->groupbook < 0)goto errout;
-
- for(j = 0; j < info->partitions; j++)
- {
- int cascade = oggpack_read(opb, 3);
- int cflag = oggpack_read(opb, 1);
- if(cflag < 0) goto errout;
- if(cflag)
- {
- int c = oggpack_read(opb, 5);
- if(c < 0) goto errout;
- cascade |= (c << 3);
- }
- info->secondstages[j] = cascade;
-
- acc += icount(cascade);
+vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
+ int j,acc=0;
+ vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(*info));
+ codec_setup_info *ci=vi->codec_setup;
+
+ info->begin=oggpack_read(opb,24);
+ info->end=oggpack_read(opb,24);
+ info->grouping=oggpack_read(opb,24)+1;
+ info->partitions=oggpack_read(opb,6)+1;
+ info->groupbook=oggpack_read(opb,8);
+
+ /* check for premature EOP */
+ if(info->groupbook<0)goto errout;
+
+ for(j=0;j<info->partitions;j++){
+ int cascade=oggpack_read(opb,3);
+ int cflag=oggpack_read(opb,1);
+ if(cflag<0) goto errout;
+ if(cflag){
+ int c=oggpack_read(opb,5);
+ if(c<0) goto errout;
+ cascade|=(c<<3);
}
- for(j = 0; j < acc; j++)
- {
- int book = oggpack_read(opb, 8);
- if(book < 0) goto errout;
- info->booklist[j] = book;
+ info->secondstages[j]=cascade;
+
+ acc+=icount(cascade);
+ }
+ for(j=0;j<acc;j++){
+ int book=oggpack_read(opb,8);
+ if(book<0) goto errout;
+ info->booklist[j]=book;
+ }
+
+ if(info->groupbook>=ci->books)goto errout;
+ for(j=0;j<acc;j++){
+ if(info->booklist[j]>=ci->books)goto errout;
+ if(ci->book_param[info->booklist[j]]->maptype==0)goto errout;
+ }
+
+ /* verify the phrasebook is not specifying an impossible or
+ inconsistent partitioning scheme. */
+ /* modify the phrasebook ranging check from r16327; an early beta
+ encoder had a bug where it used an oversized phrasebook by
+ accident. These files should continue to be playable, but don't
+ allow an exploit */
+ {
+ int entries = ci->book_param[info->groupbook]->entries;
+ int dim = ci->book_param[info->groupbook]->dim;
+ int partvals = 1;
+ while(dim>0){
+ partvals *= info->partitions;
+ if(partvals > entries) goto errout;
+ dim--;
}
+ info->partvals = partvals;
+ }
- if(info->groupbook >= ci->books)goto errout;
- for(j = 0; j < acc; j++)
- {
- if(info->booklist[j] >= ci->books)goto errout;
- if(ci->book_param[info->booklist[j]]->maptype == 0)goto errout;
- }
-
- /* verify the phrasebook is not specifying an impossible or
- inconsistent partitioning scheme. */
- /* modify the phrasebook ranging check from r16327; an early beta
- encoder had a bug where it used an oversized phrasebook by
- accident. These files should continue to be playable, but don't
- allow an exploit */
- {
- int entries = ci->book_param[info->groupbook]->entries;
- int dim = ci->book_param[info->groupbook]->dim;
- int partvals = 1;
- while(dim > 0)
- {
- partvals *= info->partitions;
- if(partvals > entries) goto errout;
- dim--;
- }
- info->partvals = partvals;
- }
-
- return(info);
-errout:
- res0_free_info(info);
- return(NULL);
+ return(info);
+ errout:
+ res0_free_info(info);
+ return(NULL);
}
vorbis_look_residue *res0_look(vorbis_dsp_state *vd,
- vorbis_info_residue *vr)
-{
- vorbis_info_residue0 *info = (vorbis_info_residue0 *)vr;
- vorbis_look_residue0 *look = _ogg_calloc(1, sizeof(*look));
- codec_setup_info *ci = vd->vi->codec_setup;
-
- int j, k, acc = 0;
- int dim;
- int maxstage = 0;
- look->info = info;
-
- look->parts = info->partitions;
- look->fullbooks = ci->fullbooks;
- look->phrasebook = ci->fullbooks + info->groupbook;
- dim = look->phrasebook->dim;
-
- look->partbooks = _ogg_calloc(look->parts, sizeof(*look->partbooks));
-
- for(j = 0; j < look->parts; j++)
- {
- int stages = ilog(info->secondstages[j]);
- if(stages)
- {
- if(stages > maxstage)maxstage = stages;
- look->partbooks[j] = _ogg_calloc(stages, sizeof(*look->partbooks[j]));
- for(k = 0; k < stages; k++)
- if(info->secondstages[j]&(1 << k))
- {
- look->partbooks[j][k] = ci->fullbooks + info->booklist[acc++];
+ vorbis_info_residue *vr){
+ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
+ vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look));
+ codec_setup_info *ci=vd->vi->codec_setup;
+
+ int j,k,acc=0;
+ int dim;
+ int maxstage=0;
+ look->info=info;
+
+ look->parts=info->partitions;
+ look->fullbooks=ci->fullbooks;
+ look->phrasebook=ci->fullbooks+info->groupbook;
+ dim=look->phrasebook->dim;
+
+ look->partbooks=_ogg_calloc(look->parts,sizeof(*look->partbooks));
+
+ for(j=0;j<look->parts;j++){
+ int stages=ilog(info->secondstages[j]);
+ if(stages){
+ if(stages>maxstage)maxstage=stages;
+ look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j]));
+ for(k=0;k<stages;k++)
+ if(info->secondstages[j]&(1<<k)){
+ look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
#ifdef TRAIN_RES
- look->training_data[k][j] = _ogg_calloc(look->partbooks[j][k]->entries,
- sizeof(***look->training_data));
+ look->training_data[k][j]=_ogg_calloc(look->partbooks[j][k]->entries,
+ sizeof(***look->training_data));
#endif
- }
}
}
-
- look->partvals = 1;
- for(j = 0; j < dim; j++)
- look->partvals *= look->parts;
-
- look->stages = maxstage;
- look->decodemap = _ogg_malloc(look->partvals * sizeof(*look->decodemap));
- for(j = 0; j < look->partvals; j++)
- {
- long val = j;
- long mult = look->partvals / look->parts;
- look->decodemap[j] = _ogg_malloc(dim * sizeof(*look->decodemap[j]));
- for(k = 0; k < dim; k++)
- {
- long deco = val / mult;
- val -= deco * mult;
- mult /= look->parts;
- look->decodemap[j][k] = deco;
- }
+ }
+
+ look->partvals=1;
+ for(j=0;j<dim;j++)
+ look->partvals*=look->parts;
+
+ look->stages=maxstage;
+ look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap));
+ for(j=0;j<look->partvals;j++){
+ long val=j;
+ long mult=look->partvals/look->parts;
+ look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j]));
+ for(k=0;k<dim;k++){
+ long deco=val/mult;
+ val-=deco*mult;
+ mult/=look->parts;
+ look->decodemap[j][k]=deco;
}
+ }
#if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
- {
- static int train_seq = 0;
- look->train_seq = train_seq++;
- }
+ {
+ static int train_seq=0;
+ look->train_seq=train_seq++;
+ }
#endif
- return(look);
+ return(look);
}
/* break an abstraction and copy some code for performance purposes */
-static int local_book_besterror(codebook *book, float *a)
-{
- int dim = book->dim, i, k, o;
- int best = 0;
- encode_aux_threshmatch *tt = book->c->thresh_tree;
-
- /* find the quant val of each scalar */
- for(k = 0, o = dim; k < dim; ++k)
- {
- float val = a[--o];
- i = tt->threshvals >> 1;
-
- if(val < tt->quantthresh[i])
- {
- if(val < tt->quantthresh[i-1])
- {
- for(--i; i > 0; --i)
- if(val >= tt->quantthresh[i-1])
- break;
- }
- }
- else
- {
+static int local_book_besterror(codebook *book,float *a){
+ int dim=book->dim,i,k,o;
+ int best=0;
+ encode_aux_threshmatch *tt=book->c->thresh_tree;
+
+ /* find the quant val of each scalar */
+ for(k=0,o=dim;k<dim;++k){
+ float val=a[--o];
+ i=tt->threshvals>>1;
+
+ if(val<tt->quantthresh[i]){
+ if(val<tt->quantthresh[i-1]){
+ for(--i;i>0;--i)
+ if(val>=tt->quantthresh[i-1])
+ break;
+ }
+ }else{
- for(++i; i < tt->threshvals - 1; ++i)
- if(val < tt->quantthresh[i])break;
+ for(++i;i<tt->threshvals-1;++i)
+ if(val<tt->quantthresh[i])break;
- }
-
- best = (best * tt->quantvals) + tt->quantmap[i];
}
- /* regular lattices are easy :-) */
- if(book->c->lengthlist[best] <= 0)
- {
- const static_codebook *c = book->c;
- int i, j;
- float bestf = 0.f;
- float *e = book->valuelist;
- best = -1;
- for(i = 0; i < book->entries; i++)
- {
- if(c->lengthlist[i] > 0)
- {
- float this = 0.f;
- for(j = 0; j < dim; j++)
- {
- float val = (e[j] - a[j]);
- this += val * val;
- }
- if(best == -1 || this < bestf)
- {
- bestf = this;
- best = i;
- }
- }
- e += dim;
+ best=(best*tt->quantvals)+tt->quantmap[i];
+ }
+ /* regular lattices are easy :-) */
+
+ if(book->c->lengthlist[best]<=0){
+ const static_codebook *c=book->c;
+ int i,j;
+ float bestf=0.f;
+ float *e=book->valuelist;
+ best=-1;
+ for(i=0;i<book->entries;i++){
+ if(c->lengthlist[i]>0){
+ float this=0.f;
+ for(j=0;j<dim;j++){
+ float val=(e[j]-a[j]);
+ this+=val*val;
+ }
+ if(best==-1 || this<bestf){
+ bestf=this;
+ best=i;
}
+ }
+ e+=dim;
}
+ }
- if(best > -1)
- {
- float *ptr = book->valuelist + best * dim;
- for(i = 0; i < dim; i++)
- *a++ -= *ptr++;
- }
+ if(best>-1){
+ float *ptr=book->valuelist+best*dim;
+ for(i=0;i<dim;i++)
+ *a++ -= *ptr++;
+ }
- return(best);
+ return(best);
}
-static int _encodepart(oggpack_buffer *opb, float *vec, int n,
- codebook *book, long *acc)
-{
- int i, bits = 0;
- int dim = book->dim;
- int step = n / dim;
+static int _encodepart(oggpack_buffer *opb,float *vec, int n,
+ codebook *book,long *acc){
+ int i,bits=0;
+ int dim=book->dim;
+ int step=n/dim;
- for(i = 0; i < step; i++)
- {
- int entry = local_book_besterror(book, vec + i * dim);
+ for(i=0;i<step;i++){
+ int entry=local_book_besterror(book,vec+i*dim);
#ifdef TRAIN_RES
- if(entry > 0)
- acc[entry]++;
+ if(entry>0)
+ acc[entry]++;
#endif
- bits += vorbis_book_encode(book, entry, opb);
+ bits+=vorbis_book_encode(book,entry,opb);
- }
+ }
- return(bits);
+ return(bits);
}
-static long **_01class(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int ch)
-{
- long i, j, k;
- vorbis_look_residue0 *look = (vorbis_look_residue0 *)vl;
- vorbis_info_residue0 *info = look->info;
-
- /* move all this setup out later */
- int samples_per_partition = info->grouping;
- int possible_partitions = info->partitions;
- int n = info->end - info->begin;
-
- int partvals = n / samples_per_partition;
- long **partword = _vorbis_block_alloc(vb, ch * sizeof(*partword));
- float scale = 100. / samples_per_partition;
-
- /* we find the partition type for each partition of each
- channel. We'll go back and do the interleaved encoding in a
- bit. For now, clarity */
-
- for(i = 0; i < ch; i++)
- {
- partword[i] = _vorbis_block_alloc(vb, n / samples_per_partition * sizeof(*partword[i]));
- memset(partword[i], 0, n / samples_per_partition * sizeof(*partword[i]));
- }
-
- for(i = 0; i < partvals; i++)
- {
- int offset = i * samples_per_partition + info->begin;
- for(j = 0; j < ch; j++)
- {
- float max = 0.;
- float ent = 0.;
- for(k = 0; k < samples_per_partition; k++)
- {
- if(fabs(in[j][offset+k]) > max)max = fabs(in[j][offset+k]);
- ent += fabs(rint(in[j][offset+k]));
- }
- ent *= scale;
+static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int ch){
+ long i,j,k;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
+
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int possible_partitions=info->partitions;
+ int n=info->end-info->begin;
+
+ int partvals=n/samples_per_partition;
+ long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword));
+ float scale=100./samples_per_partition;
+
+ /* we find the partition type for each partition of each
+ channel. We'll go back and do the interleaved encoding in a
+ bit. For now, clarity */
+
+ for(i=0;i<ch;i++){
+ partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i]));
+ memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i]));
+ }
+
+ for(i=0;i<partvals;i++){
+ int offset=i*samples_per_partition+info->begin;
+ for(j=0;j<ch;j++){
+ float max=0.;
+ float ent=0.;
+ for(k=0;k<samples_per_partition;k++){
+ if(fabs(in[j][offset+k])>max)max=fabs(in[j][offset+k]);
+ ent+=fabs(rint(in[j][offset+k]));
+ }
+ ent*=scale;
- for(k = 0; k < possible_partitions - 1; k++)
- if(max <= info->classmetric1[k] &&
- (info->classmetric2[k] < 0 || (int)ent < info->classmetric2[k]))
- break;
+ for(k=0;k<possible_partitions-1;k++)
+ if(max<=info->classmetric1[k] &&
+ (info->classmetric2[k]<0 || (int)ent<info->classmetric2[k]))
+ break;
- partword[j][i] = k;
- }
+ partword[j][i]=k;
}
+ }
#ifdef TRAIN_RESAUX
- {
- FILE *of;
- char buffer[80];
-
- for(i = 0; i < ch; i++)
- {
- sprintf(buffer, "resaux_%d.vqd", look->train_seq);
- of = fopen(buffer, "a");
- for(j = 0; j < partvals; j++)
- fprintf(of, "%ld, ", partword[i][j]);
- fprintf(of, "\n");
- fclose(of);
- }
+ {
+ FILE *of;
+ char buffer[80];
+
+ for(i=0;i<ch;i++){
+ sprintf(buffer,"resaux_%d.vqd",look->train_seq);
+ of=fopen(buffer,"a");
+ for(j=0;j<partvals;j++)
+ fprintf(of,"%ld, ",partword[i][j]);
+ fprintf(of,"\n");
+ fclose(of);
}
+ }
#endif
- look->frames++;
+ look->frames++;
- return(partword);
+ return(partword);
}
/* designed for stereo or other modes where the partition size is an
integer multiple of the number of channels encoded in the current
submap */
-static long **_2class(vorbis_block *vb, vorbis_look_residue *vl, float **in,
- int ch)
-{
- long i, j, k, l;
- vorbis_look_residue0 *look = (vorbis_look_residue0 *)vl;
- vorbis_info_residue0 *info = look->info;
+static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
+ int ch){
+ long i,j,k,l;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
- /* move all this setup out later */
- int samples_per_partition = info->grouping;
- int possible_partitions = info->partitions;
- int n = info->end - info->begin;
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int possible_partitions=info->partitions;
+ int n=info->end-info->begin;
- int partvals = n / samples_per_partition;
- long **partword = _vorbis_block_alloc(vb, sizeof(*partword));
+ int partvals=n/samples_per_partition;
+ long **partword=_vorbis_block_alloc(vb,sizeof(*partword));
#if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
- FILE *of;
- char buffer[80];
+ FILE *of;
+ char buffer[80];
#endif
- partword[0] = _vorbis_block_alloc(vb, n * ch / samples_per_partition * sizeof(*partword[0]));
- memset(partword[0], 0, n * ch / samples_per_partition * sizeof(*partword[0]));
-
- for(i = 0, l = info->begin / ch; i < partvals; i++)
- {
- float magmax = 0.f;
- float angmax = 0.f;
- for(j = 0; j < samples_per_partition; j += ch)
- {
- if(fabs(in[0][l]) > magmax)magmax = fabs(in[0][l]);
- for(k = 1; k < ch; k++)
- if(fabs(in[k][l]) > angmax)angmax = fabs(in[k][l]);
- l++;
- }
+ partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0]));
+ memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0]));
+
+ for(i=0,l=info->begin/ch;i<partvals;i++){
+ float magmax=0.f;
+ float angmax=0.f;
+ for(j=0;j<samples_per_partition;j+=ch){
+ if(fabs(in[0][l])>magmax)magmax=fabs(in[0][l]);
+ for(k=1;k<ch;k++)
+ if(fabs(in[k][l])>angmax)angmax=fabs(in[k][l]);
+ l++;
+ }
- for(j = 0; j < possible_partitions - 1; j++)
- if(magmax <= info->classmetric1[j] &&
- angmax <= info->classmetric2[j])
- break;
+ for(j=0;j<possible_partitions-1;j++)
+ if(magmax<=info->classmetric1[j] &&
+ angmax<=info->classmetric2[j])
+ break;
- partword[0][i] = j;
+ partword[0][i]=j;
- }
+ }
#ifdef TRAIN_RESAUX
- sprintf(buffer, "resaux_%d.vqd", look->train_seq);
- of = fopen(buffer, "a");
- for(i = 0; i < partvals; i++)
- fprintf(of, "%ld, ", partword[0][i]);
- fprintf(of, "\n");
- fclose(of);
+ sprintf(buffer,"resaux_%d.vqd",look->train_seq);
+ of=fopen(buffer,"a");
+ for(i=0;i<partvals;i++)
+ fprintf(of,"%ld, ",partword[0][i]);
+ fprintf(of,"\n");
+ fclose(of);
#endif
- look->frames++;
+ look->frames++;
- return(partword);
+ return(partword);
}
static int _01forward(oggpack_buffer *opb,
- vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int ch,
+ vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int ch,
long **partword,
- int (*encode)(oggpack_buffer *, float *, int,
- codebook *, long *))
-{
- long i, j, k, s;
- vorbis_look_residue0 *look = (vorbis_look_residue0 *)vl;
- vorbis_info_residue0 *info = look->info;
-
- /* move all this setup out later */
- int samples_per_partition = info->grouping;
- int possible_partitions = info->partitions;
- int partitions_per_word = look->phrasebook->dim;
- int n = info->end - info->begin;
-
- int partvals = n / samples_per_partition;
- long resbits[128];
- long resvals[128];
+ int (*encode)(oggpack_buffer *,float *,int,
+ codebook *,long *)){
+ long i,j,k,s;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
+
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int possible_partitions=info->partitions;
+ int partitions_per_word=look->phrasebook->dim;
+ int n=info->end-info->begin;
+
+ int partvals=n/samples_per_partition;
+ long resbits[128];
+ long resvals[128];
#ifdef TRAIN_RES
- for(i = 0; i < ch; i++)
- for(j = info->begin; j < end; j++)
- {
- if(in[i][j] > look->tmax)look->tmax = in[i][j];
- if(in[i][j] < look->tmin)look->tmin = in[i][j];
- }
+ for(i=0;i<ch;i++)
+ for(j=info->begin;j<end;j++){
+ if(in[i][j]>look->tmax)look->tmax=in[i][j];
+ if(in[i][j]<look->tmin)look->tmin=in[i][j];
+ }
#endif
- memset(resbits, 0, sizeof(resbits));
- memset(resvals, 0, sizeof(resvals));
+ memset(resbits,0,sizeof(resbits));
+ memset(resvals,0,sizeof(resvals));
- /* we code the partition words for each channel, then the residual
- words for a partition per channel until we've written all the
- residual words for that partition word. Then write the next
- partition channel words... */
+ /* we code the partition words for each channel, then the residual
+ words for a partition per channel until we've written all the
+ residual words for that partition word. Then write the next
+ partition channel words... */
- for(s = 0; s < look->stages; s++)
- {
+ for(s=0;s<look->stages;s++){
+
+ for(i=0;i<partvals;){
- for(i = 0; i < partvals;)
- {
-
- /* first we encode a partition codeword for each channel */
- if(s == 0)
- {
- for(j = 0; j < ch; j++)
- {
- long val = partword[j][i];
- for(k = 1; k < partitions_per_word; k++)
- {
- val *= possible_partitions;
- if(i + k < partvals)
- val += partword[j][i+k];
- }
-
- /* training hack */
- if(val < look->phrasebook->entries)
- look->phrasebits += vorbis_book_encode(look->phrasebook, val, opb);
+ /* first we encode a partition codeword for each channel */
+ if(s==0){
+ for(j=0;j<ch;j++){
+ long val=partword[j][i];
+ for(k=1;k<partitions_per_word;k++){
+ val*=possible_partitions;
+ if(i+k<partvals)
+ val+=partword[j][i+k];
+ }
+
+ /* training hack */
+ if(val<look->phrasebook->entries)
+ look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb);
#if 0 /*def TRAIN_RES*/
- else
- fprintf(stderr, "!");
+ else
+ fprintf(stderr,"!");
#endif
- }
- }
+ }
+ }
- /* now we encode interleaved residual values for the partitions */
- for(k = 0; k < partitions_per_word && i < partvals; k++, i++)
- {
- long offset = i * samples_per_partition + info->begin;
-
- for(j = 0; j < ch; j++)
- {
- if(s == 0)resvals[partword[j][i]] += samples_per_partition;
- if(info->secondstages[partword[j][i]]&(1 << s))
- {
- codebook *statebook = look->partbooks[partword[j][i]][s];
- if(statebook)
- {
- int ret;
- long *accumulator = NULL;
+ /* now we encode interleaved residual values for the partitions */
+ for(k=0;k<partitions_per_word && i<partvals;k++,i++){
+ long offset=i*samples_per_partition+info->begin;
+
+ for(j=0;j<ch;j++){
+ if(s==0)resvals[partword[j][i]]+=samples_per_partition;
+ if(info->secondstages[partword[j][i]]&(1<<s)){
+ codebook *statebook=look->partbooks[partword[j][i]][s];
+ if(statebook){
+ int ret;
+ long *accumulator=NULL;
#ifdef TRAIN_RES
- accumulator = look->training_data[s][partword[j][i]];
- {
- int l;
- float *samples = in[j] + offset;
- for(l = 0; l < samples_per_partition; l++)
- {
- if(samples[l] < look->training_min[s][partword[j][i]])
- look->training_min[s][partword[j][i]] = samples[l];
- if(samples[l] > look->training_max[s][partword[j][i]])
- look->training_max[s][partword[j][i]] = samples[l];
- }
- }
+ accumulator=look->training_data[s][partword[j][i]];
+ {
+ int l;
+ float *samples=in[j]+offset;
+ for(l=0;l<samples_per_partition;l++){
+ if(samples[l]<look->training_min[s][partword[j][i]])
+ look->training_min[s][partword[j][i]]=samples[l];
+ if(samples[l]>look->training_max[s][partword[j][i]])
+ look->training_max[s][partword[j][i]]=samples[l];
+ }
+ }
#endif
- ret = encode(opb, in[j] + offset, samples_per_partition,
- statebook, accumulator);
+ ret=encode(opb,in[j]+offset,samples_per_partition,
+ statebook,accumulator);
- look->postbits += ret;
- resbits[partword[j][i]] += ret;
- }
- }
- }
+ look->postbits+=ret;
+ resbits[partword[j][i]]+=ret;
}
+ }
}
- }
-
- /*{
- long total=0;
- long totalbits=0;
- fprintf(stderr,"%d :: ",vb->mode);
- for(k=0;k<possible_partitions;k++){
- fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]);
- total+=resvals[k];
- totalbits+=resbits[k];
}
+ }
+ }
+
+ /*{
+ long total=0;
+ long totalbits=0;
+ fprintf(stderr,"%d :: ",vb->mode);
+ for(k=0;k<possible_partitions;k++){
+ fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]);
+ total+=resvals[k];
+ totalbits+=resbits[k];
+ }
- fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total);
- }*/
+ fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total);
+ }*/
- return(0);
+ return(0);
}
/* a truncated packet here just means 'stop working'; it's not an error */
-static int _01inverse(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int ch,
- long(*decodepart)(codebook *, float *,
- oggpack_buffer *, int))
-{
-
- long i, j, k, l, s;
- vorbis_look_residue0 *look = (vorbis_look_residue0 *)vl;
- vorbis_info_residue0 *info = look->info;
-
- /* move all this setup out later */
- int samples_per_partition = info->grouping;
- int partitions_per_word = look->phrasebook->dim;
- int max = vb->pcmend >> 1;
- int end = (info->end < max ? info->end : max);
- int n = end - info->begin;
-
- if(n > 0)
- {
- int partvals = n / samples_per_partition;
- int partwords = (partvals + partitions_per_word - 1) / partitions_per_word;
- int ***partword = alloca(ch * sizeof(*partword));
-
- for(j = 0; j < ch; j++)
- partword[j] = _vorbis_block_alloc(vb, partwords * sizeof(*partword[j]));
-
- for(s = 0; s < look->stages; s++)
- {
-
- /* each loop decodes on partition codeword containing
- partitions_per_word partitions */
- for(i = 0, l = 0; i < partvals; l++)
- {
- if(s == 0)
- {
- /* fetch the partition word for each channel */
- for(j = 0; j < ch; j++)
- {
- int temp = vorbis_book_decode(look->phrasebook, &vb->opb);
-
- if(temp == -1 || temp >= info->partvals)goto eopbreak;
- partword[j][l] = look->decodemap[temp];
- if(partword[j][l] == NULL)goto errout;
- }
- }
+static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int ch,
+ long (*decodepart)(codebook *, float *,
+ oggpack_buffer *,int)){
+
+ long i,j,k,l,s;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
+
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int partitions_per_word=look->phrasebook->dim;
+ int max=vb->pcmend>>1;
+ int end=(info->end<max?info->end:max);
+ int n=end-info->begin;
+
+ if(n>0){
+ int partvals=n/samples_per_partition;
+ int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+ int ***partword=alloca(ch*sizeof(*partword));
+
+ for(j=0;j<ch;j++)
+ partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
+
+ for(s=0;s<look->stages;s++){
+
+ /* each loop decodes on partition codeword containing
+ partitions_per_word partitions */
+ for(i=0,l=0;i<partvals;l++){
+ if(s==0){
+ /* fetch the partition word for each channel */
+ for(j=0;j<ch;j++){
+ int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+
+ if(temp==-1 || temp>=info->partvals)goto eopbreak;
+ partword[j][l]=look->decodemap[temp];
+ if(partword[j][l]==NULL)goto errout;
+ }
+ }
- /* now we decode residual values for the partitions */
- for(k = 0; k < partitions_per_word && i < partvals; k++, i++)
- for(j = 0; j < ch; j++)
- {
- long offset = info->begin + i * samples_per_partition;
- if(info->secondstages[partword[j][l][k]]&(1 << s))
- {
- codebook *stagebook = look->partbooks[partword[j][l][k]][s];
- if(stagebook)
- {
- if(decodepart(stagebook, in[j] + offset, &vb->opb,
- samples_per_partition) == -1)goto eopbreak;
- }
- }
- }
+ /* now we decode residual values for the partitions */
+ for(k=0;k<partitions_per_word && i<partvals;k++,i++)
+ for(j=0;j<ch;j++){
+ long offset=info->begin+i*samples_per_partition;
+ if(info->secondstages[partword[j][l][k]]&(1<<s)){
+ codebook *stagebook=look->partbooks[partword[j][l][k]][s];
+ if(stagebook){
+ if(decodepart(stagebook,in[j]+offset,&vb->opb,
+ samples_per_partition)==-1)goto eopbreak;
+ }
}
- }
+ }
+ }
}
-errout:
-eopbreak:
- return(0);
+ }
+ errout:
+ eopbreak:
+ return(0);
}
#if 0
/* residue 0 and 1 are just slight variants of one another. 0 is
interleaved, 1 is not */
-long **res0_class(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int *nonzero, int ch)
-{
- /* we encode only the nonzero parts of a bundle */
- int i, used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- in[used++] = in[i];
- if(used)
- /*return(_01class(vb,vl,in,used,_interleaved_testhack));*/
- return(_01class(vb, vl, in, used));
- else
- return(0);
+long **res0_class(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int *nonzero,int ch){
+ /* we encode only the nonzero parts of a bundle */
+ int i,used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i])
+ in[used++]=in[i];
+ if(used)
+ /*return(_01class(vb,vl,in,used,_interleaved_testhack));*/
+ return(_01class(vb,vl,in,used));
+ else
+ return(0);
}
-int res0_forward(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, float **out, int *nonzero, int ch,
- long **partword)
-{
- /* we encode only the nonzero parts of a bundle */
- int i, j, used = 0, n = vb->pcmend / 2;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- {
- if(out)
- for(j = 0; j < n; j++)
- out[i][j] += in[i][j];
- in[used++] = in[i];
- }
- if(used)
- {
- int ret = _01forward(vb, vl, in, used, partword,
- _interleaved_encodepart);
- if(out)
- {
- used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- {
- for(j = 0; j < n; j++)
- out[i][j] -= in[used][j];
- used++;
- }
- }
- return(ret);
+int res0_forward(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,float **out,int *nonzero,int ch,
+ long **partword){
+ /* we encode only the nonzero parts of a bundle */
+ int i,j,used=0,n=vb->pcmend/2;
+ for(i=0;i<ch;i++)
+ if(nonzero[i]){
+ if(out)
+ for(j=0;j<n;j++)
+ out[i][j]+=in[i][j];
+ in[used++]=in[i];
}
- else
- {
- return(0);
+ if(used){
+ int ret=_01forward(vb,vl,in,used,partword,
+ _interleaved_encodepart);
+ if(out){
+ used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i]){
+ for(j=0;j<n;j++)
+ out[i][j]-=in[used][j];
+ used++;
+ }
}
+ return(ret);
+ }else{
+ return(0);
+ }
}
#endif
-int res0_inverse(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int *nonzero, int ch)
-{
- int i, used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- in[used++] = in[i];
- if(used)
- return(_01inverse(vb, vl, in, used, vorbis_book_decodevs_add));
- else
- return(0);
+int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int *nonzero,int ch){
+ int i,used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i])
+ in[used++]=in[i];
+ if(used)
+ return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
+ else
+ return(0);
}
-int res1_forward(oggpack_buffer *opb, vorbis_block *vb, vorbis_look_residue *vl,
- float **in, float **out, int *nonzero, int ch,
- long **partword)
-{
- int i, j, used = 0, n = vb->pcmend / 2;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- {
- if(out)
- for(j = 0; j < n; j++)
- out[i][j] += in[i][j];
- in[used++] = in[i];
- }
+int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,float **out,int *nonzero,int ch,
+ long **partword){
+ int i,j,used=0,n=vb->pcmend/2;
+ for(i=0;i<ch;i++)
+ if(nonzero[i]){
+ if(out)
+ for(j=0;j<n;j++)
+ out[i][j]+=in[i][j];
+ in[used++]=in[i];
+ }
- if(used)
- {
- int ret = _01forward(opb, vb, vl, in, used, partword, _encodepart);
- if(out)
- {
- used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- {
- for(j = 0; j < n; j++)
- out[i][j] -= in[used][j];
- used++;
- }
+ if(used){
+ int ret=_01forward(opb,vb,vl,in,used,partword,_encodepart);
+ if(out){
+ used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i]){
+ for(j=0;j<n;j++)
+ out[i][j]-=in[used][j];
+ used++;
}
- return(ret);
- }
- else
- {
- return(0);
}
+ return(ret);
+ }else{
+ return(0);
+ }
}
-long **res1_class(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int *nonzero, int ch)
-{
- int i, used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- in[used++] = in[i];
- if(used)
- return(_01class(vb, vl, in, used));
- else
- return(0);
+long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int *nonzero,int ch){
+ int i,used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i])
+ in[used++]=in[i];
+ if(used)
+ return(_01class(vb,vl,in,used));
+ else
+ return(0);
}
-int res1_inverse(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int *nonzero, int ch)
-{
- int i, used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])
- in[used++] = in[i];
- if(used)
- return(_01inverse(vb, vl, in, used, vorbis_book_decodev_add));
- else
- return(0);
+int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int *nonzero,int ch){
+ int i,used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i])
+ in[used++]=in[i];
+ if(used)
+ return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
+ else
+ return(0);
}
-long **res2_class(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int *nonzero, int ch)
-{
- int i, used = 0;
- for(i = 0; i < ch; i++)
- if(nonzero[i])used++;
- if(used)
- return(_2class(vb, vl, in, ch));
- else
- return(0);
+long **res2_class(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int *nonzero,int ch){
+ int i,used=0;
+ for(i=0;i<ch;i++)
+ if(nonzero[i])used++;
+ if(used)
+ return(_2class(vb,vl,in,ch));
+ else
+ return(0);
}
/* res2 is slightly more different; all the channels are interleaved
into a single vector and encoded. */
int res2_forward(oggpack_buffer *opb,
- vorbis_block *vb, vorbis_look_residue *vl,
- float **in, float **out, int *nonzero, int ch,
- long **partword)
-{
- long i, j, k, n = vb->pcmend / 2, used = 0;
-
- /* don't duplicate the code; use a working vector hack for now and
- reshape ourselves into a single channel res1 */
- /* ugly; reallocs for each coupling pass :-( */
- float *work = _vorbis_block_alloc(vb, ch * n * sizeof(*work));
- for(i = 0; i < ch; i++)
- {
- float *pcm = in[i];
- if(nonzero[i])used++;
- for(j = 0, k = i; j < n; j++, k += ch)
- work[k] = pcm[j];
- }
+ vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,float **out,int *nonzero,int ch,
+ long **partword){
+ long i,j,k,n=vb->pcmend/2,used=0;
+
+ /* don't duplicate the code; use a working vector hack for now and
+ reshape ourselves into a single channel res1 */
+ /* ugly; reallocs for each coupling pass :-( */
+ float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work));
+ for(i=0;i<ch;i++){
+ float *pcm=in[i];
+ if(nonzero[i])used++;
+ for(j=0,k=i;j<n;j++,k+=ch)
+ work[k]=pcm[j];
+ }
+
+ if(used){
+ int ret=_01forward(opb,vb,vl,&work,1,partword,_encodepart);
+ /* update the sofar vector */
+ if(out){
+ for(i=0;i<ch;i++){
+ float *pcm=in[i];
+ float *sofar=out[i];
+ for(j=0,k=i;j<n;j++,k+=ch)
+ sofar[j]+=pcm[j]-work[k];
- if(used)
- {
- int ret = _01forward(opb, vb, vl, &work, 1, partword, _encodepart);
- /* update the sofar vector */
- if(out)
- {
- for(i = 0; i < ch; i++)
- {
- float *pcm = in[i];
- float *sofar = out[i];
- for(j = 0, k = i; j < n; j++, k += ch)
- sofar[j] += pcm[j] - work[k];
-
- }
- }
- return(ret);
- }
- else
- {
- return(0);
+ }
}
+ return(ret);
+ }else{
+ return(0);
+ }
}
/* duplicate code here as speed is somewhat more important */
-int res2_inverse(vorbis_block *vb, vorbis_look_residue *vl,
- float **in, int *nonzero, int ch)
-{
- long i, k, l, s;
- vorbis_look_residue0 *look = (vorbis_look_residue0 *)vl;
- vorbis_info_residue0 *info = look->info;
-
- /* move all this setup out later */
- int samples_per_partition = info->grouping;
- int partitions_per_word = look->phrasebook->dim;
- int max = (vb->pcmend * ch) >> 1;
- int end = (info->end < max ? info->end : max);
- int n = end - info->begin;
-
- if(n > 0)
- {
- int partvals = n / samples_per_partition;
- int partwords = (partvals + partitions_per_word - 1) / partitions_per_word;
- int **partword = _vorbis_block_alloc(vb, partwords * sizeof(*partword));
-
- for(i = 0; i < ch; i++)if(nonzero[i])break;
- if(i == ch)return(0); /* no nonzero vectors */
-
- for(s = 0; s < look->stages; s++)
- {
- for(i = 0, l = 0; i < partvals; l++)
- {
-
- if(s == 0)
- {
- /* fetch the partition word */
- int temp = vorbis_book_decode(look->phrasebook, &vb->opb);
- if(temp == -1 || temp > info->partvals)goto eopbreak;
- partword[l] = look->decodemap[temp];
- if(partword[l] == NULL)goto errout;
- }
+int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
+ float **in,int *nonzero,int ch){
+ long i,k,l,s;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
+
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int partitions_per_word=look->phrasebook->dim;
+ int max=(vb->pcmend*ch)>>1;
+ int end=(info->end<max?info->end:max);
+ int n=end-info->begin;
+
+ if(n>0){
+ int partvals=n/samples_per_partition;
+ int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+ int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword));
+
+ for(i=0;i<ch;i++)if(nonzero[i])break;
+ if(i==ch)return(0); /* no nonzero vectors */
+
+ for(s=0;s<look->stages;s++){
+ for(i=0,l=0;i<partvals;l++){
+
+ if(s==0){
+ /* fetch the partition word */
+ int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+ if(temp==-1 || temp>info->partvals)goto eopbreak;
+ partword[l]=look->decodemap[temp];
+ if(partword[l]==NULL)goto errout;
+ }
- /* now we decode residual values for the partitions */
- for(k = 0; k < partitions_per_word && i < partvals; k++, i++)
- if(info->secondstages[partword[l][k]]&(1 << s))
- {
- codebook *stagebook = look->partbooks[partword[l][k]][s];
-
- if(stagebook)
- {
- if(vorbis_book_decodevv_add(stagebook, in,
- i * samples_per_partition + info->begin, ch,
- &vb->opb, samples_per_partition) == -1)
- goto eopbreak;
- }
- }
+ /* now we decode residual values for the partitions */
+ for(k=0;k<partitions_per_word && i<partvals;k++,i++)
+ if(info->secondstages[partword[l][k]]&(1<<s)){
+ codebook *stagebook=look->partbooks[partword[l][k]][s];
+
+ if(stagebook){
+ if(vorbis_book_decodevv_add(stagebook,in,
+ i*samples_per_partition+info->begin,ch,
+ &vb->opb,samples_per_partition)==-1)
+ goto eopbreak;
}
- }
+ }
+ }
}
-errout:
-eopbreak:
- return(0);
+ }
+ errout:
+ eopbreak:
+ return(0);
}
-const vorbis_func_residue residue0_exportbundle =
-{
- NULL,
- &res0_unpack,
- &res0_look,
- &res0_free_info,
- &res0_free_look,
- NULL,
- NULL,
- &res0_inverse
+const vorbis_func_residue residue0_exportbundle={
+ NULL,
+ &res0_unpack,
+ &res0_look,
+ &res0_free_info,
+ &res0_free_look,
+ NULL,
+ NULL,
+ &res0_inverse
};
-const vorbis_func_residue residue1_exportbundle =
-{
- &res0_pack,
- &res0_unpack,
- &res0_look,
- &res0_free_info,
- &res0_free_look,
- &res1_class,
- &res1_forward,
- &res1_inverse
+const vorbis_func_residue residue1_exportbundle={
+ &res0_pack,
+ &res0_unpack,
+ &res0_look,
+ &res0_free_info,
+ &res0_free_look,
+ &res1_class,
+ &res1_forward,
+ &res1_inverse
};
-const vorbis_func_residue residue2_exportbundle =
-{
- &res0_pack,
- &res0_unpack,
- &res0_look,
- &res0_free_info,
- &res0_free_look,
- &res2_class,
- &res2_forward,
- &res2_inverse
+const vorbis_func_residue residue2_exportbundle={
+ &res0_pack,
+ &res0_unpack,
+ &res0_look,
+ &res0_free_info,
+ &res0_free_look,
+ &res2_class,
+ &res2_forward,
+ &res2_inverse
};
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/scales.h b/src/filters/transform/MpaDecFilter/libvorbisidec/scales.h
index ad888a1cd..613f796e7 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/scales.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/scales.h
@@ -30,39 +30,34 @@
#define VORBIS_IEEE_FLOAT32 1
#ifdef VORBIS_IEEE_FLOAT32
-static inline float unitnorm(float x)
-{
- union
- {
- ogg_uint32_t i;
- float f;
- } ix;
- ix.f = x;
- ix.i = (ix.i & 0x80000000U) | (0x3f800000U);
- return ix.f;
+static inline float unitnorm(float x){
+ union {
+ ogg_uint32_t i;
+ float f;
+ } ix;
+ ix.f = x;
+ ix.i = (ix.i & 0x80000000U) | (0x3f800000U);
+ return ix.f;
}
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */
-static inline float todB(const float *x)
-{
- union
- {
- ogg_uint32_t i;
- float f;
- } ix;
- ix.f = *x;
- ix.i = ix.i & 0x7fffffff;
- return (float)(ix.i * 7.17711438e-7f - 764.6161886f);
+static inline float todB(const float *x){
+ union {
+ ogg_uint32_t i;
+ float f;
+ } ix;
+ ix.f = *x;
+ ix.i = ix.i&0x7fffffff;
+ return (float)(ix.i * 7.17711438e-7f -764.6161886f);
}
#define todB_nn(x) todB(x)
#else
-static float unitnorm(float x)
-{
- if(x < 0)return(-1.f);
- return(1.f);
+static float unitnorm(float x){
+ if(x<0)return(-1.f);
+ return(1.f);
}
#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/sharedbook.c b/src/filters/transform/MpaDecFilter/libvorbisidec/sharedbook.c
index 64fd96b93..35dde586b 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/sharedbook.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/sharedbook.c
@@ -26,15 +26,13 @@
#include "scales.h"
/**** pack/unpack helpers ******************************************/
-int _ilog(unsigned int v)
-{
- int ret = 0;
- while(v)
- {
- ret++;
- v >>= 1;
- }
- return(ret);
+int _ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
}
/* 32 bit float (not IEEE; nonnormalized mantissa +
@@ -46,174 +44,148 @@ int _ilog(unsigned int v)
#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
/* doesn't currently guard under/overflow */
-long _float32_pack(float val)
-{
- int sign = 0;
- long exp;
- long mant;
- if(val < 0)
- {
- sign = 0x80000000;
- val = -val;
- }
- exp = floor(log(val) / log(2.f));
- mant = rint(ldexp(val, (VQ_FMAN - 1) - exp));
- exp = (exp + VQ_FEXP_BIAS) << VQ_FMAN;
-
- return(sign | exp | mant);
+long _float32_pack(float val){
+ int sign=0;
+ long exp;
+ long mant;
+ if(val<0){
+ sign=0x80000000;
+ val= -val;
+ }
+ exp= floor(log(val)/log(2.f));
+ mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
+ exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
+
+ return(sign|exp|mant);
}
-float _float32_unpack(long val)
-{
- double mant = val & 0x1fffff;
- int sign = val & 0x80000000;
- long exp = (val & 0x7fe00000L) >> VQ_FMAN;
- if(sign)mant = -mant;
- return(ldexp(mant, exp - (VQ_FMAN - 1) - VQ_FEXP_BIAS));
+float _float32_unpack(long val){
+ double mant=val&0x1fffff;
+ int sign=val&0x80000000;
+ long exp =(val&0x7fe00000L)>>VQ_FMAN;
+ if(sign)mant= -mant;
+ return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS));
}
/* given a list of word lengths, generate a list of codewords. Works
for length ordered or unordered, always assigns the lowest valued
codewords first. Extended to handle unused entries (length 0) */
-ogg_uint32_t *_make_words(long *l, long n, long sparsecount)
-{
- long i, j, count = 0;
- ogg_uint32_t marker[33];
- ogg_uint32_t *r = _ogg_malloc((sparsecount ? sparsecount : n) * sizeof(*r));
- memset(marker, 0, sizeof(marker));
-
- for(i = 0; i < n; i++)
- {
- long length = l[i];
- if(length > 0)
- {
- ogg_uint32_t entry = marker[length];
-
- /* when we claim a node for an entry, we also claim the nodes
- below it (pruning off the imagined tree that may have dangled
- from it) as well as blocking the use of any nodes directly
- above for leaves */
-
- /* update ourself */
- if(length < 32 && (entry >> length))
- {
- /* error condition; the lengths must specify an overpopulated tree */
- _ogg_free(r);
- return(NULL);
- }
- r[count++] = entry;
-
- /* Look to see if the next shorter marker points to the node
- above. if so, update it and repeat. */
- {
- for(j = length; j > 0; j--)
- {
-
- if(marker[j] & 1)
- {
- /* have to jump branches */
- if(j == 1)
- marker[1]++;
- else
- marker[j] = marker[j-1] << 1;
- break; /* invariant says next upper marker would already
+ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
+ long i,j,count=0;
+ ogg_uint32_t marker[33];
+ ogg_uint32_t *r=_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
+ memset(marker,0,sizeof(marker));
+
+ for(i=0;i<n;i++){
+ long length=l[i];
+ if(length>0){
+ ogg_uint32_t entry=marker[length];
+
+ /* when we claim a node for an entry, we also claim the nodes
+ below it (pruning off the imagined tree that may have dangled
+ from it) as well as blocking the use of any nodes directly
+ above for leaves */
+
+ /* update ourself */
+ if(length<32 && (entry>>length)){
+ /* error condition; the lengths must specify an overpopulated tree */
+ _ogg_free(r);
+ return(NULL);
+ }
+ r[count++]=entry;
+
+ /* Look to see if the next shorter marker points to the node
+ above. if so, update it and repeat. */
+ {
+ for(j=length;j>0;j--){
+
+ if(marker[j]&1){
+ /* have to jump branches */
+ if(j==1)
+ marker[1]++;
+ else
+ marker[j]=marker[j-1]<<1;
+ break; /* invariant says next upper marker would already
have been moved if it was on the same path */
- }
- marker[j]++;
- }
- }
-
- /* prune the tree; the implicit invariant says all the longer
- markers were dangling from our just-taken node. Dangle them
- from our *new* node. */
- for(j = length + 1; j < 33; j++)
- if((marker[j] >> 1) == entry)
- {
- entry = marker[j];
- marker[j] = marker[j-1] << 1;
- }
- else
- break;
+ }
+ marker[j]++;
}
- else if(sparsecount == 0)count++;
- }
-
- /* sanity check the huffman tree; an underpopulated tree must be
- rejected. The only exception is the one-node pseudo-nil tree,
- which appears to be underpopulated because the tree doesn't
- really exist; there's only one possible 'codeword' or zero bits,
- but the above tree-gen code doesn't mark that. */
- if(sparsecount != 1)
- {
- for(i = 1; i < 33; i++)
- if(marker[i] & (0xffffffffUL >> (32 - i)))
- {
- _ogg_free(r);
- return(NULL);
- }
+ }
+
+ /* prune the tree; the implicit invariant says all the longer
+ markers were dangling from our just-taken node. Dangle them
+ from our *new* node. */
+ for(j=length+1;j<33;j++)
+ if((marker[j]>>1) == entry){
+ entry=marker[j];
+ marker[j]=marker[j-1]<<1;
+ }else
+ break;
+ }else
+ if(sparsecount==0)count++;
+ }
+
+ /* sanity check the huffman tree; an underpopulated tree must be
+ rejected. The only exception is the one-node pseudo-nil tree,
+ which appears to be underpopulated because the tree doesn't
+ really exist; there's only one possible 'codeword' or zero bits,
+ but the above tree-gen code doesn't mark that. */
+ if(sparsecount != 1){
+ for(i=1;i<33;i++)
+ if(marker[i] & (0xffffffffUL>>(32-i))){
+ _ogg_free(r);
+ return(NULL);
+ }
+ }
+
+ /* bitreverse the words because our bitwise packer/unpacker is LSb
+ endian */
+ for(i=0,count=0;i<n;i++){
+ ogg_uint32_t temp=0;
+ for(j=0;j<l[i];j++){
+ temp<<=1;
+ temp|=(r[count]>>j)&1;
}
- /* bitreverse the words because our bitwise packer/unpacker is LSb
- endian */
- for(i = 0, count = 0; i < n; i++)
- {
- ogg_uint32_t temp = 0;
- for(j = 0; j < l[i]; j++)
- {
- temp <<= 1;
- temp |= (r[count] >> j) & 1;
- }
+ if(sparsecount){
+ if(l[i])
+ r[count++]=temp;
+ }else
+ r[count++]=temp;
+ }
- if(sparsecount)
- {
- if(l[i])
- r[count++] = temp;
- }
- else
- r[count++] = temp;
- }
-
- return(r);
+ return(r);
}
/* there might be a straightforward one-line way to do the below
that's portable and totally safe against roundoff, but I haven't
thought of it. Therefore, we opt on the side of caution */
-long _book_maptype1_quantvals(const static_codebook *b)
-{
- long vals = floor(pow((float)b->entries, 1.f / b->dim));
-
- /* the above *should* be reliable, but we'll not assume that FP is
- ever reliable when bitstream sync is at stake; verify via integer
- means that vals really is the greatest value of dim for which
- vals^b->bim <= b->entries */
- /* treat the above as an initial guess */
- while(1)
- {
- long acc = 1;
- long acc1 = 1;
- int i;
- for(i = 0; i < b->dim; i++)
- {
- acc *= vals;
- acc1 *= vals + 1;
- }
- if(acc <= b->entries && acc1 > b->entries)
- {
- return(vals);
- }
- else
- {
- if(acc > b->entries)
- {
- vals--;
- }
- else
- {
- vals++;
- }
- }
+long _book_maptype1_quantvals(const static_codebook *b){
+ long vals=floor(pow((float)b->entries,1.f/b->dim));
+
+ /* the above *should* be reliable, but we'll not assume that FP is
+ ever reliable when bitstream sync is at stake; verify via integer
+ means that vals really is the greatest value of dim for which
+ vals^b->bim <= b->entries */
+ /* treat the above as an initial guess */
+ while(1){
+ long acc=1;
+ long acc1=1;
+ int i;
+ for(i=0;i<b->dim;i++){
+ acc*=vals;
+ acc1*=vals+1;
+ }
+ if(acc<=b->entries && acc1>b->entries){
+ return(vals);
+ }else{
+ if(acc>b->entries){
+ vals--;
+ }else{
+ vals++;
+ }
}
+ }
}
/* unpack the quantized list of values for encode/decode ***********/
@@ -221,472 +193,421 @@ long _book_maptype1_quantvals(const static_codebook *b)
generated algorithmically (each column of the vector counts through
the values in the quant vector). in map type 2, all the values came
in in an explicit list. Both value lists must be unpacked */
-float *_book_unquantize(const static_codebook *b, int n, int *sparsemap)
-{
- long j, k, count = 0;
- if(b->maptype == 1 || b->maptype == 2)
- {
- int quantvals;
- float mindel = _float32_unpack(b->q_min);
- float delta = _float32_unpack(b->q_delta);
- float *r = _ogg_calloc(n * b->dim, sizeof(*r));
-
- /* maptype 1 and 2 both use a quantized value vector, but
- different sizes */
- switch(b->maptype)
- {
- case 1:
- /* most of the time, entries%dimensions == 0, but we need to be
- well defined. We define that the possible vales at each
- scalar is values == entries/dim. If entries%dim != 0, we'll
- have 'too few' values (values*dim<entries), which means that
- we'll have 'left over' entries; left over entries use zeroed
- values (and are wasted). So don't generate codebooks like
- that */
- quantvals = _book_maptype1_quantvals(b);
- for(j = 0; j < b->entries; j++)
- {
- if((sparsemap && b->lengthlist[j]) || !sparsemap)
- {
- float last = 0.f;
- int indexdiv = 1;
- for(k = 0; k < b->dim; k++)
- {
- int index = (j / indexdiv) % quantvals;
- float val = b->quantlist[index];
- val = fabs(val) * delta + mindel + last;
- if(b->q_sequencep)last = val;
- if(sparsemap)
- r[sparsemap[count]*b->dim + k] = val;
- else
- r[count*b->dim+k] = val;
- indexdiv *= quantvals;
- }
- count++;
- }
-
- }
- break;
- case 2:
- for(j = 0; j < b->entries; j++)
- {
- if((sparsemap && b->lengthlist[j]) || !sparsemap)
- {
- float last = 0.f;
-
- for(k = 0; k < b->dim; k++)
- {
- float val = b->quantlist[j*b->dim+k];
- val = fabs(val) * delta + mindel + last;
- if(b->q_sequencep)last = val;
- if(sparsemap)
- r[sparsemap[count]*b->dim + k] = val;
- else
- r[count*b->dim+k] = val;
- }
- count++;
- }
- }
- break;
+float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
+ long j,k,count=0;
+ if(b->maptype==1 || b->maptype==2){
+ int quantvals;
+ float mindel=_float32_unpack(b->q_min);
+ float delta=_float32_unpack(b->q_delta);
+ float *r=_ogg_calloc(n*b->dim,sizeof(*r));
+
+ /* maptype 1 and 2 both use a quantized value vector, but
+ different sizes */
+ switch(b->maptype){
+ case 1:
+ /* most of the time, entries%dimensions == 0, but we need to be
+ well defined. We define that the possible vales at each
+ scalar is values == entries/dim. If entries%dim != 0, we'll
+ have 'too few' values (values*dim<entries), which means that
+ we'll have 'left over' entries; left over entries use zeroed
+ values (and are wasted). So don't generate codebooks like
+ that */
+ quantvals=_book_maptype1_quantvals(b);
+ for(j=0;j<b->entries;j++){
+ if((sparsemap && b->lengthlist[j]) || !sparsemap){
+ float last=0.f;
+ int indexdiv=1;
+ for(k=0;k<b->dim;k++){
+ int index= (j/indexdiv)%quantvals;
+ float val=b->quantlist[index];
+ val=fabs(val)*delta+mindel+last;
+ if(b->q_sequencep)last=val;
+ if(sparsemap)
+ r[sparsemap[count]*b->dim+k]=val;
+ else
+ r[count*b->dim+k]=val;
+ indexdiv*=quantvals;
+ }
+ count++;
}
- return(r);
+ }
+ break;
+ case 2:
+ for(j=0;j<b->entries;j++){
+ if((sparsemap && b->lengthlist[j]) || !sparsemap){
+ float last=0.f;
+
+ for(k=0;k<b->dim;k++){
+ float val=b->quantlist[j*b->dim+k];
+ val=fabs(val)*delta+mindel+last;
+ if(b->q_sequencep)last=val;
+ if(sparsemap)
+ r[sparsemap[count]*b->dim+k]=val;
+ else
+ r[count*b->dim+k]=val;
+ }
+ count++;
+ }
+ }
+ break;
}
- return(NULL);
-}
-void vorbis_staticbook_clear(static_codebook *b)
-{
- if(b->allocedp)
- {
- if(b->quantlist)_ogg_free(b->quantlist);
- if(b->lengthlist)_ogg_free(b->lengthlist);
- if(b->nearest_tree)
- {
- _ogg_free(b->nearest_tree->ptr0);
- _ogg_free(b->nearest_tree->ptr1);
- _ogg_free(b->nearest_tree->p);
- _ogg_free(b->nearest_tree->q);
- memset(b->nearest_tree, 0, sizeof(*b->nearest_tree));
- _ogg_free(b->nearest_tree);
- }
- if(b->thresh_tree)
- {
- _ogg_free(b->thresh_tree->quantthresh);
- _ogg_free(b->thresh_tree->quantmap);
- memset(b->thresh_tree, 0, sizeof(*b->thresh_tree));
- _ogg_free(b->thresh_tree);
- }
+ return(r);
+ }
+ return(NULL);
+}
- memset(b, 0, sizeof(*b));
+void vorbis_staticbook_clear(static_codebook *b){
+ if(b->allocedp){
+ if(b->quantlist)_ogg_free(b->quantlist);
+ if(b->lengthlist)_ogg_free(b->lengthlist);
+ if(b->nearest_tree){
+ _ogg_free(b->nearest_tree->ptr0);
+ _ogg_free(b->nearest_tree->ptr1);
+ _ogg_free(b->nearest_tree->p);
+ _ogg_free(b->nearest_tree->q);
+ memset(b->nearest_tree,0,sizeof(*b->nearest_tree));
+ _ogg_free(b->nearest_tree);
+ }
+ if(b->thresh_tree){
+ _ogg_free(b->thresh_tree->quantthresh);
+ _ogg_free(b->thresh_tree->quantmap);
+ memset(b->thresh_tree,0,sizeof(*b->thresh_tree));
+ _ogg_free(b->thresh_tree);
}
+
+ memset(b,0,sizeof(*b));
+ }
}
-void vorbis_staticbook_destroy(static_codebook *b)
-{
- if(b->allocedp)
- {
- vorbis_staticbook_clear(b);
- _ogg_free(b);
- }
+void vorbis_staticbook_destroy(static_codebook *b){
+ if(b->allocedp){
+ vorbis_staticbook_clear(b);
+ _ogg_free(b);
+ }
}
-void vorbis_book_clear(codebook *b)
-{
- /* static book is not cleared; we're likely called on the lookup and
- the static codebook belongs to the info struct */
- if(b->valuelist)_ogg_free(b->valuelist);
- if(b->codelist)_ogg_free(b->codelist);
+void vorbis_book_clear(codebook *b){
+ /* static book is not cleared; we're likely called on the lookup and
+ the static codebook belongs to the info struct */
+ if(b->valuelist)_ogg_free(b->valuelist);
+ if(b->codelist)_ogg_free(b->codelist);
- if(b->dec_index)_ogg_free(b->dec_index);
- if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
- if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
+ if(b->dec_index)_ogg_free(b->dec_index);
+ if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
+ if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
- memset(b, 0, sizeof(*b));
+ memset(b,0,sizeof(*b));
}
-int vorbis_book_init_encode(codebook *c, const static_codebook *s)
-{
+int vorbis_book_init_encode(codebook *c,const static_codebook *s){
- memset(c, 0, sizeof(*c));
- c->c = s;
- c->entries = s->entries;
- c->used_entries = s->entries;
- c->dim = s->dim;
- c->codelist = _make_words(s->lengthlist, s->entries, 0);
- c->valuelist = _book_unquantize(s, s->entries, NULL);
+ memset(c,0,sizeof(*c));
+ c->c=s;
+ c->entries=s->entries;
+ c->used_entries=s->entries;
+ c->dim=s->dim;
+ c->codelist=_make_words(s->lengthlist,s->entries,0);
+ c->valuelist=_book_unquantize(s,s->entries,NULL);
- return(0);
+ return(0);
}
-static ogg_uint32_t bitreverse(ogg_uint32_t x)
-{
- x = ((x >> 16) & 0x0000ffffUL) | ((x << 16) & 0xffff0000UL);
- x = ((x >> 8) & 0x00ff00ffUL) | ((x << 8) & 0xff00ff00UL);
- x = ((x >> 4) & 0x0f0f0f0fUL) | ((x << 4) & 0xf0f0f0f0UL);
- x = ((x >> 2) & 0x33333333UL) | ((x << 2) & 0xccccccccUL);
- return((x >> 1) & 0x55555555UL) | ((x << 1) & 0xaaaaaaaaUL);
+static ogg_uint32_t bitreverse(ogg_uint32_t x){
+ x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
+ x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
+ x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
+ x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
+ return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
}
-static int sort32a(const void *a, const void *b)
-{
- return (**(ogg_uint32_t **)a > **(ogg_uint32_t **)b) -
- (**(ogg_uint32_t **)a < **(ogg_uint32_t **)b);
+static int sort32a(const void *a,const void *b){
+ return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
+ ( **(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
}
/* decode codebook arrangement is more heavily optimized than encode */
-int vorbis_book_init_decode(codebook *c, const static_codebook *s)
-{
- int i, j, n = 0, tabn;
- int *sortindex;
- memset(c, 0, sizeof(*c));
-
- /* count actually used entries */
- for(i = 0; i < s->entries; i++)
- if(s->lengthlist[i] > 0)
- n++;
-
- c->entries = s->entries;
- c->used_entries = n;
- c->dim = s->dim;
-
- if(n > 0)
- {
+int vorbis_book_init_decode(codebook *c,const static_codebook *s){
+ int i,j,n=0,tabn;
+ int *sortindex;
+ memset(c,0,sizeof(*c));
- /* two different remappings go on here.
+ /* count actually used entries */
+ for(i=0;i<s->entries;i++)
+ if(s->lengthlist[i]>0)
+ n++;
- First, we collapse the likely sparse codebook down only to
- actually represented values/words. This collapsing needs to be
- indexed as map-valueless books are used to encode original entry
- positions as integers.
+ c->entries=s->entries;
+ c->used_entries=n;
+ c->dim=s->dim;
- Second, we reorder all vectors, including the entry index above,
- by sorted bitreversed codeword to allow treeless decode. */
+ if(n>0){
- /* perform sort */
- ogg_uint32_t *codes = _make_words(s->lengthlist, s->entries, c->used_entries);
- ogg_uint32_t **codep = alloca(sizeof(*codep) * n);
+ /* two different remappings go on here.
- if(codes == NULL)goto err_out;
+ First, we collapse the likely sparse codebook down only to
+ actually represented values/words. This collapsing needs to be
+ indexed as map-valueless books are used to encode original entry
+ positions as integers.
- for(i = 0; i < n; i++)
- {
- codes[i] = bitreverse(codes[i]);
- codep[i] = codes + i;
- }
+ Second, we reorder all vectors, including the entry index above,
+ by sorted bitreversed codeword to allow treeless decode. */
- qsort(codep, n, sizeof(*codep), sort32a);
+ /* perform sort */
+ ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
+ ogg_uint32_t **codep=alloca(sizeof(*codep)*n);
- sortindex = alloca(n * sizeof(*sortindex));
- c->codelist = _ogg_malloc(n * sizeof(*c->codelist));
- /* the index is a reverse index */
- for(i = 0; i < n; i++)
- {
- int position = codep[i] - codes;
- sortindex[position] = i;
- }
+ if(codes==NULL)goto err_out;
- for(i = 0; i < n; i++)
- c->codelist[sortindex[i]] = codes[i];
- _ogg_free(codes);
-
-
- c->valuelist = _book_unquantize(s, n, sortindex);
- c->dec_index = _ogg_malloc(n * sizeof(*c->dec_index));
-
- for(n = 0, i = 0; i < s->entries; i++)
- if(s->lengthlist[i] > 0)
- c->dec_index[sortindex[n++]] = i;
-
- c->dec_codelengths = _ogg_malloc(n * sizeof(*c->dec_codelengths));
- for(n = 0, i = 0; i < s->entries; i++)
- if(s->lengthlist[i] > 0)
- c->dec_codelengths[sortindex[n++]] = s->lengthlist[i];
-
- c->dec_firsttablen = _ilog(c->used_entries) - 4; /* this is magic */
- if(c->dec_firsttablen < 5)c->dec_firsttablen = 5;
- if(c->dec_firsttablen > 8)c->dec_firsttablen = 8;
-
- tabn = 1 << c->dec_firsttablen;
- c->dec_firsttable = _ogg_calloc(tabn, sizeof(*c->dec_firsttable));
- c->dec_maxlength = 0;
-
- for(i = 0; i < n; i++)
- {
- if(c->dec_maxlength < c->dec_codelengths[i])
- c->dec_maxlength = c->dec_codelengths[i];
- if(c->dec_codelengths[i] <= c->dec_firsttablen)
- {
- ogg_uint32_t orig = bitreverse(c->codelist[i]);
- for(j = 0; j < (1 << (c->dec_firsttablen - c->dec_codelengths[i])); j++)
- c->dec_firsttable[orig|(j<<c->dec_codelengths[i])] = i + 1;
- }
- }
+ for(i=0;i<n;i++){
+ codes[i]=bitreverse(codes[i]);
+ codep[i]=codes+i;
+ }
- /* now fill in 'unused' entries in the firsttable with hi/lo search
- hints for the non-direct-hits */
- {
- ogg_uint32_t mask = 0xfffffffeUL << (31 - c->dec_firsttablen);
- long lo = 0, hi = 0;
-
- for(i = 0; i < tabn; i++)
- {
- ogg_uint32_t word = i << (32 - c->dec_firsttablen);
- if(c->dec_firsttable[bitreverse(word)] == 0)
- {
- while((lo + 1) < n && c->codelist[lo+1] <= word)lo++;
- while(hi < n && word >= (c->codelist[hi]&mask))hi++;
-
- /* we only actually have 15 bits per hint to play with here.
- In order to overflow gracefully (nothing breaks, efficiency
- just drops), encode as the difference from the extremes. */
- {
- unsigned long loval = lo;
- unsigned long hival = n - hi;
-
- if(loval > 0x7fff)loval = 0x7fff;
- if(hival > 0x7fff)hival = 0x7fff;
- c->dec_firsttable[bitreverse(word)] =
- 0x80000000UL | (loval << 15) | hival;
- }
- }
- }
- }
+ qsort(codep,n,sizeof(*codep),sort32a);
+
+ sortindex=alloca(n*sizeof(*sortindex));
+ c->codelist=_ogg_malloc(n*sizeof(*c->codelist));
+ /* the index is a reverse index */
+ for(i=0;i<n;i++){
+ int position=codep[i]-codes;
+ sortindex[position]=i;
}
- return(0);
-err_out:
- vorbis_book_clear(c);
- return(-1);
-}
+ for(i=0;i<n;i++)
+ c->codelist[sortindex[i]]=codes[i];
+ _ogg_free(codes);
-static float _dist(int el, float *ref, float *b, int step)
-{
- int i;
- float acc = 0.f;
- for(i = 0; i < el; i++)
+
+ c->valuelist=_book_unquantize(s,n,sortindex);
+ c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index));
+
+ for(n=0,i=0;i<s->entries;i++)
+ if(s->lengthlist[i]>0)
+ c->dec_index[sortindex[n++]]=i;
+
+ c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
+ for(n=0,i=0;i<s->entries;i++)
+ if(s->lengthlist[i]>0)
+ c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
+
+ c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
+ if(c->dec_firsttablen<5)c->dec_firsttablen=5;
+ if(c->dec_firsttablen>8)c->dec_firsttablen=8;
+
+ tabn=1<<c->dec_firsttablen;
+ c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
+ c->dec_maxlength=0;
+
+ for(i=0;i<n;i++){
+ if(c->dec_maxlength<c->dec_codelengths[i])
+ c->dec_maxlength=c->dec_codelengths[i];
+ if(c->dec_codelengths[i]<=c->dec_firsttablen){
+ ogg_uint32_t orig=bitreverse(c->codelist[i]);
+ for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
+ c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
+ }
+ }
+
+ /* now fill in 'unused' entries in the firsttable with hi/lo search
+ hints for the non-direct-hits */
{
- float val = (ref[i] - b[i*step]);
- acc += val * val;
+ ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
+ long lo=0,hi=0;
+
+ for(i=0;i<tabn;i++){
+ ogg_uint32_t word=i<<(32-c->dec_firsttablen);
+ if(c->dec_firsttable[bitreverse(word)]==0){
+ while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
+ while( hi<n && word>=(c->codelist[hi]&mask))hi++;
+
+ /* we only actually have 15 bits per hint to play with here.
+ In order to overflow gracefully (nothing breaks, efficiency
+ just drops), encode as the difference from the extremes. */
+ {
+ unsigned long loval=lo;
+ unsigned long hival=n-hi;
+
+ if(loval>0x7fff)loval=0x7fff;
+ if(hival>0x7fff)hival=0x7fff;
+ c->dec_firsttable[bitreverse(word)]=
+ 0x80000000UL | (loval<<15) | hival;
+ }
+ }
+ }
}
- return(acc);
+ }
+
+ return(0);
+ err_out:
+ vorbis_book_clear(c);
+ return(-1);
+}
+
+static float _dist(int el,float *ref, float *b,int step){
+ int i;
+ float acc=0.f;
+ for(i=0;i<el;i++){
+ float val=(ref[i]-b[i*step]);
+ acc+=val*val;
+ }
+ return(acc);
}
-int _best(codebook *book, float *a, int step)
-{
- encode_aux_threshmatch *tt = book->c->thresh_tree;
+int _best(codebook *book, float *a, int step){
+ encode_aux_threshmatch *tt=book->c->thresh_tree;
#if 0
- encode_aux_nearestmatch *nt = book->c->nearest_tree;
- encode_aux_pigeonhole *pt = book->c->pigeon_tree;
+ encode_aux_nearestmatch *nt=book->c->nearest_tree;
+ encode_aux_pigeonhole *pt=book->c->pigeon_tree;
#endif
- int dim = book->dim;
- int k, o;
- /*int savebest=-1;
- float saverr;*/
-
- /* do we have a threshhold encode hint? */
- if(tt)
- {
- int index = 0, i;
- /* find the quant val of each scalar */
- for(k = 0, o = step * (dim - 1); k < dim; k++, o -= step)
- {
-
- i = tt->threshvals >> 1;
- if(a[o] < tt->quantthresh[i])
- {
+ int dim=book->dim;
+ int k,o;
+ /*int savebest=-1;
+ float saverr;*/
+
+ /* do we have a threshhold encode hint? */
+ if(tt){
+ int index=0,i;
+ /* find the quant val of each scalar */
+ for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
+
+ i=tt->threshvals>>1;
+ if(a[o]<tt->quantthresh[i]){
+
+ for(;i>0;i--)
+ if(a[o]>=tt->quantthresh[i-1])
+ break;
- for(; i > 0; i--)
- if(a[o] >= tt->quantthresh[i-1])
- break;
+ }else{
- }
- else
- {
+ for(i++;i<tt->threshvals-1;i++)
+ if(a[o]<tt->quantthresh[i])break;
- for(i++; i < tt->threshvals - 1; i++)
- if(a[o] < tt->quantthresh[i])break;
+ }
- }
-
- index = (index * tt->quantvals) + tt->quantmap[i];
- }
- /* regular lattices are easy :-) */
- if(book->c->lengthlist[index] > 0) /* is this unused? If so, we'll
+ index=(index*tt->quantvals)+tt->quantmap[i];
+ }
+ /* regular lattices are easy :-) */
+ if(book->c->lengthlist[index]>0) /* is this unused? If so, we'll
use a decision tree after all
and fall through*/
- return(index);
- }
+ return(index);
+ }
#if 0
- /* do we have a pigeonhole encode hint? */
- if(pt)
- {
- const static_codebook *c = book->c;
- int i, besti = -1;
- float best = 0.f;
- int entry = 0;
-
- /* dealing with sequentialness is a pain in the ass */
- if(c->q_sequencep)
- {
- int pv;
- long mul = 1;
- float qlast = 0;
- for(k = 0, o = 0; k < dim; k++, o += step)
- {
- pv = (int)((a[o] - qlast - pt->min) / pt->del);
- if(pv < 0 || pv >= pt->mapentries)break;
- entry += pt->pigeonmap[pv] * mul;
- mul *= pt->quantvals;
- qlast += pv * pt->del + pt->min;
- }
- }
- else
- {
- for(k = 0, o = step * (dim - 1); k < dim; k++, o -= step)
- {
- int pv = (int)((a[o] - pt->min) / pt->del);
- if(pv < 0 || pv >= pt->mapentries)break;
- entry = entry * pt->quantvals + pt->pigeonmap[pv];
- }
- }
-
- /* must be within the pigeonholable range; if we quant outside (or
- in an entry that we define no list for), brute force it */
- if(k == dim && pt->fitlength[entry])
- {
- /* search the abbreviated list */
- long *list = pt->fitlist + pt->fitmap[entry];
- for(i = 0; i < pt->fitlength[entry]; i++)
- {
- float this = _dist(dim, book->valuelist + list[i] * dim, a, step);
- if(besti == -1 || this < best)
- {
- best = this;
- besti = list[i];
- }
- }
-
- return(besti);
- }
+ /* do we have a pigeonhole encode hint? */
+ if(pt){
+ const static_codebook *c=book->c;
+ int i,besti=-1;
+ float best=0.f;
+ int entry=0;
+
+ /* dealing with sequentialness is a pain in the ass */
+ if(c->q_sequencep){
+ int pv;
+ long mul=1;
+ float qlast=0;
+ for(k=0,o=0;k<dim;k++,o+=step){
+ pv=(int)((a[o]-qlast-pt->min)/pt->del);
+ if(pv<0 || pv>=pt->mapentries)break;
+ entry+=pt->pigeonmap[pv]*mul;
+ mul*=pt->quantvals;
+ qlast+=pv*pt->del+pt->min;
+ }
+ }else{
+ for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
+ int pv=(int)((a[o]-pt->min)/pt->del);
+ if(pv<0 || pv>=pt->mapentries)break;
+ entry=entry*pt->quantvals+pt->pigeonmap[pv];
+ }
}
- if(nt)
- {
- /* optimized using the decision tree */
- while(1)
- {
- float c = 0.f;
- float *p = book->valuelist + nt->p[ptr];
- float *q = book->valuelist + nt->q[ptr];
-
- for(k = 0, o = 0; k < dim; k++, o += step)
- c += (p[k] - q[k]) * (a[o] - (p[k] + q[k]) * .5);
-
- if(c > 0.f) /* in A */
- ptr = -nt->ptr0[ptr];
- else /* in B */
- ptr = -nt->ptr1[ptr];
- if(ptr <= 0)break;
+ /* must be within the pigeonholable range; if we quant outside (or
+ in an entry that we define no list for), brute force it */
+ if(k==dim && pt->fitlength[entry]){
+ /* search the abbreviated list */
+ long *list=pt->fitlist+pt->fitmap[entry];
+ for(i=0;i<pt->fitlength[entry];i++){
+ float this=_dist(dim,book->valuelist+list[i]*dim,a,step);
+ if(besti==-1 || this<best){
+ best=this;
+ besti=list[i];
}
- return(-ptr);
+ }
+
+ return(besti);
}
+ }
+
+ if(nt){
+ /* optimized using the decision tree */
+ while(1){
+ float c=0.f;
+ float *p=book->valuelist+nt->p[ptr];
+ float *q=book->valuelist+nt->q[ptr];
+
+ for(k=0,o=0;k<dim;k++,o+=step)
+ c+=(p[k]-q[k])*(a[o]-(p[k]+q[k])*.5);
+
+ if(c>0.f) /* in A */
+ ptr= -nt->ptr0[ptr];
+ else /* in B */
+ ptr= -nt->ptr1[ptr];
+ if(ptr<=0)break;
+ }
+ return(-ptr);
+ }
#endif
- /* brute force it! */
- {
- const static_codebook *c = book->c;
- int i, besti = -1;
- float best = 0.f;
- float *e = book->valuelist;
- for(i = 0; i < book->entries; i++)
- {
- if(c->lengthlist[i] > 0)
- {
- float this = _dist(dim, e, a, step);
- if(besti == -1 || this < best)
- {
- best = this;
- besti = i;
- }
- }
- e += dim;
+ /* brute force it! */
+ {
+ const static_codebook *c=book->c;
+ int i,besti=-1;
+ float best=0.f;
+ float *e=book->valuelist;
+ for(i=0;i<book->entries;i++){
+ if(c->lengthlist[i]>0){
+ float this=_dist(dim,e,a,step);
+ if(besti==-1 || this<best){
+ best=this;
+ besti=i;
}
-
- /*if(savebest!=-1 && savebest!=besti){
- fprintf(stderr,"brute force/pigeonhole disagreement:\n"
- "original:");
- for(i=0;i<dim*step;i+=step)fprintf(stderr,"%g,",a[i]);
- fprintf(stderr,"\n"
- "pigeonhole (entry %d, err %g):",savebest,saverr);
- for(i=0;i<dim;i++)fprintf(stderr,"%g,",
- (book->valuelist+savebest*dim)[i]);
- fprintf(stderr,"\n"
- "bruteforce (entry %d, err %g):",besti,best);
- for(i=0;i<dim;i++)fprintf(stderr,"%g,",
- (book->valuelist+besti*dim)[i]);
- fprintf(stderr,"\n");
- }*/
- return(besti);
+ }
+ e+=dim;
}
+
+ /*if(savebest!=-1 && savebest!=besti){
+ fprintf(stderr,"brute force/pigeonhole disagreement:\n"
+ "original:");
+ for(i=0;i<dim*step;i+=step)fprintf(stderr,"%g,",a[i]);
+ fprintf(stderr,"\n"
+ "pigeonhole (entry %d, err %g):",savebest,saverr);
+ for(i=0;i<dim;i++)fprintf(stderr,"%g,",
+ (book->valuelist+savebest*dim)[i]);
+ fprintf(stderr,"\n"
+ "bruteforce (entry %d, err %g):",besti,best);
+ for(i=0;i<dim;i++)fprintf(stderr,"%g,",
+ (book->valuelist+besti*dim)[i]);
+ fprintf(stderr,"\n");
+ }*/
+ return(besti);
+ }
}
-long vorbis_book_codeword(codebook *book, int entry)
-{
- if(book->c) /* only use with encode; decode optimizations are
+long vorbis_book_codeword(codebook *book,int entry){
+ if(book->c) /* only use with encode; decode optimizations are
allowed to break this */
- return book->codelist[entry];
- return -1;
+ return book->codelist[entry];
+ return -1;
}
-long vorbis_book_codelen(codebook *book, int entry)
-{
- if(book->c) /* only use with encode; decode optimizations are
+long vorbis_book_codelen(codebook *book,int entry){
+ if(book->c) /* only use with encode; decode optimizations are
allowed to break this */
- return book->c->lengthlist[entry];
- return -1;
+ return book->c->lengthlist[entry];
+ return -1;
}
#ifdef _V_SELFTEST
@@ -707,141 +628,126 @@ long vorbis_book_codelen(codebook *book, int entry)
sequential
*/
-static long full_quantlist1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 3, 6, 1};
-static long partial_quantlist1[] = {0, 7, 2};
+static long full_quantlist1[]={0,1,2,3, 4,5,6,7, 8,3,6,1};
+static long partial_quantlist1[]={0,7,2};
/* no mapping */
-static_codebook test1 =
-{
- 4, 16,
- NULL,
- 0,
- 0, 0, 0, 0,
- NULL,
- NULL, NULL, NULL,
- 0
+static_codebook test1={
+ 4,16,
+ NULL,
+ 0,
+ 0,0,0,0,
+ NULL,
+ NULL,NULL,NULL,
+ 0
};
-static float *test1_result = NULL;
+static float *test1_result=NULL;
/* linear, full mapping, nonsequential */
-static_codebook test2 =
-{
- 4, 3,
- NULL,
- 2,
- -533200896, 1611661312, 4, 0,
- full_quantlist1,
- NULL, NULL, NULL,
- 0
+static_codebook test2={
+ 4,3,
+ NULL,
+ 2,
+ -533200896,1611661312,4,0,
+ full_quantlist1,
+ NULL,NULL,NULL,
+ 0
};
-static float test2_result[] = { -3, -2, -1, 0, 1, 2, 3, 4, 5, 0, 3, -2};
+static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
/* linear, full mapping, sequential */
-static_codebook test3 =
-{
- 4, 3,
- NULL,
- 2,
- -533200896, 1611661312, 4, 1,
- full_quantlist1,
- NULL, NULL, NULL,
- 0
+static_codebook test3={
+ 4,3,
+ NULL,
+ 2,
+ -533200896,1611661312,4,1,
+ full_quantlist1,
+ NULL,NULL,NULL,
+ 0
};
-static float test3_result[] = { -3, -5, -6, -6, 1, 3, 6, 10, 5, 5, 8, 6};
+static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
/* linear, algorithmic mapping, nonsequential */
-static_codebook test4 =
-{
- 3, 27,
- NULL,
- 1,
- -533200896, 1611661312, 4, 0,
- partial_quantlist1,
- NULL, NULL, NULL,
- 0
+static_codebook test4={
+ 3,27,
+ NULL,
+ 1,
+ -533200896,1611661312,4,0,
+ partial_quantlist1,
+ NULL,NULL,NULL,
+ 0
};
-static float test4_result[] = { -3, -3, -3, 4, -3, -3, -1, -3, -3,
- -3, 4, -3, 4, 4, -3, -1, 4, -3,
- -3, -1, -3, 4, -1, -3, -1, -1, -3,
- -3, -3, 4, 4, -3, 4, -1, -3, 4,
- -3, 4, 4, 4, 4, 4, -1, 4, 4,
- -3, -1, 4, 4, -1, 4, -1, -1, 4,
- -3, -3, -1, 4, -3, -1, -1, -3, -1,
- -3, 4, -1, 4, 4, -1, -1, 4, -1,
- -3, -1, -1, 4, -1, -1, -1, -1, -1
- };
+static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
+ -3, 4,-3, 4, 4,-3, -1, 4,-3,
+ -3,-1,-3, 4,-1,-3, -1,-1,-3,
+ -3,-3, 4, 4,-3, 4, -1,-3, 4,
+ -3, 4, 4, 4, 4, 4, -1, 4, 4,
+ -3,-1, 4, 4,-1, 4, -1,-1, 4,
+ -3,-3,-1, 4,-3,-1, -1,-3,-1,
+ -3, 4,-1, 4, 4,-1, -1, 4,-1,
+ -3,-1,-1, 4,-1,-1, -1,-1,-1};
/* linear, algorithmic mapping, sequential */
-static_codebook test5 =
-{
- 3, 27,
- NULL,
- 1,
- -533200896, 1611661312, 4, 1,
- partial_quantlist1,
- NULL, NULL, NULL,
- 0
+static_codebook test5={
+ 3,27,
+ NULL,
+ 1,
+ -533200896,1611661312,4,1,
+ partial_quantlist1,
+ NULL,NULL,NULL,
+ 0
};
-static float test5_result[] = { -3, -6, -9, 4, 1, -2, -1, -4, -7,
- -3, 1, -2, 4, 8, 5, -1, 3, 0,
- -3, -4, -7, 4, 3, 0, -1, -2, -5,
- -3, -6, -2, 4, 1, 5, -1, -4, 0,
- -3, 1, 5, 4, 8, 12, -1, 3, 7,
- -3, -4, 0, 4, 3, 7, -1, -2, 2,
- -3, -6, -7, 4, 1, 0, -1, -4, -5,
- -3, 1, 0, 4, 8, 7, -1, 3, 2,
- -3, -4, -5, 4, 3, 2, -1, -2, -3
- };
-
-void run_test(static_codebook *b, float *comp)
-{
- float *out = _book_unquantize(b, b->entries, NULL);
- int i;
-
- if(comp)
- {
- if(!out)
- {
- fprintf(stderr, "_book_unquantize incorrectly returned NULL\n");
- exit(1);
- }
-
- for(i = 0; i < b->entries * b->dim; i++)
- if(fabs(out[i] - comp[i]) > .0001)
- {
- fprintf(stderr, "disagreement in unquantized and reference data:\n"
- "position %d, %g != %g\n", i, out[i], comp[i]);
- exit(1);
- }
-
+static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
+ -3, 1,-2, 4, 8, 5, -1, 3, 0,
+ -3,-4,-7, 4, 3, 0, -1,-2,-5,
+ -3,-6,-2, 4, 1, 5, -1,-4, 0,
+ -3, 1, 5, 4, 8,12, -1, 3, 7,
+ -3,-4, 0, 4, 3, 7, -1,-2, 2,
+ -3,-6,-7, 4, 1, 0, -1,-4,-5,
+ -3, 1, 0, 4, 8, 7, -1, 3, 2,
+ -3,-4,-5, 4, 3, 2, -1,-2,-3};
+
+void run_test(static_codebook *b,float *comp){
+ float *out=_book_unquantize(b,b->entries,NULL);
+ int i;
+
+ if(comp){
+ if(!out){
+ fprintf(stderr,"_book_unquantize incorrectly returned NULL\n");
+ exit(1);
}
- else
- {
- if(out)
- {
- fprintf(stderr, "_book_unquantize returned a value array: \n"
- " correct result should have been NULL\n");
- exit(1);
- }
+
+ for(i=0;i<b->entries*b->dim;i++)
+ if(fabs(out[i]-comp[i])>.0001){
+ fprintf(stderr,"disagreement in unquantized and reference data:\n"
+ "position %d, %g != %g\n",i,out[i],comp[i]);
+ exit(1);
+ }
+
+ }else{
+ if(out){
+ fprintf(stderr,"_book_unquantize returned a value array: \n"
+ " correct result should have been NULL\n");
+ exit(1);
}
+ }
}
-int main()
-{
- /* run the nine dequant tests, and compare to the hand-rolled results */
- fprintf(stderr, "Dequant test 1... ");
- run_test(&test1, test1_result);
- fprintf(stderr, "OK\nDequant test 2... ");
- run_test(&test2, test2_result);
- fprintf(stderr, "OK\nDequant test 3... ");
- run_test(&test3, test3_result);
- fprintf(stderr, "OK\nDequant test 4... ");
- run_test(&test4, test4_result);
- fprintf(stderr, "OK\nDequant test 5... ");
- run_test(&test5, test5_result);
- fprintf(stderr, "OK\n\n");
-
- return(0);
+int main(){
+ /* run the nine dequant tests, and compare to the hand-rolled results */
+ fprintf(stderr,"Dequant test 1... ");
+ run_test(&test1,test1_result);
+ fprintf(stderr,"OK\nDequant test 2... ");
+ run_test(&test2,test2_result);
+ fprintf(stderr,"OK\nDequant test 3... ");
+ run_test(&test3,test3_result);
+ fprintf(stderr,"OK\nDequant test 4... ");
+ run_test(&test4,test4_result);
+ fprintf(stderr,"OK\nDequant test 5... ");
+ run_test(&test5,test5_result);
+ fprintf(stderr,"OK\n\n");
+
+ return(0);
}
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.c b/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.c
index 294f75e9f..ae2bc41b6 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.c
@@ -35,1333 +35,1221 @@
#include "os.h"
#include "misc.h"
-static void drfti1(int n, float *wa, int *ifac)
-{
- static int ntryh[4] = { 4, 2, 3, 5 };
- static float tpi = 6.28318530717958648f;
- float arg, argh, argld, fi;
- int ntry = 0, i, j = -1;
- int k1, l1, l2, ib;
- int ld, ii, ip, is, nq, nr;
- int ido, ipm, nfm1;
- int nl = n;
- int nf = 0;
-
-L101:
- j++;
- if(j < 4)
- ntry = ntryh[j];
- else
- ntry += 2;
-
-L104:
- nq = nl / ntry;
- nr = nl - ntry * nq;
- if(nr != 0) goto L101;
-
- nf++;
- ifac[nf+1] = ntry;
- nl = nq;
- if(ntry != 2)goto L107;
- if(nf == 1)goto L107;
-
- for(i = 1; i < nf; i++)
- {
- ib = nf - i + 1;
- ifac[ib+1] = ifac[ib];
- }
- ifac[2] = 2;
-
-L107:
- if(nl != 1)goto L104;
- ifac[0] = n;
- ifac[1] = nf;
- argh = tpi / n;
- is = 0;
- nfm1 = nf - 1;
- l1 = 1;
-
- if(nfm1 == 0)return;
-
- for(k1 = 0; k1 < nfm1; k1++)
- {
- ip = ifac[k1+2];
- ld = 0;
- l2 = l1 * ip;
- ido = n / l2;
- ipm = ip - 1;
-
- for(j = 0; j < ipm; j++)
- {
- ld += l1;
- i = is;
- argld = (float)ld * argh;
- fi = 0.f;
- for(ii = 2; ii < ido; ii += 2)
- {
- fi += 1.f;
- arg = fi * argld;
- wa[i++] = cos(arg);
- wa[i++] = sin(arg);
- }
- is += ido;
- }
- l1 = l2;
+static void drfti1(int n, float *wa, int *ifac){
+ static int ntryh[4] = { 4,2,3,5 };
+ static float tpi = 6.28318530717958648f;
+ float arg,argh,argld,fi;
+ int ntry=0,i,j=-1;
+ int k1, l1, l2, ib;
+ int ld, ii, ip, is, nq, nr;
+ int ido, ipm, nfm1;
+ int nl=n;
+ int nf=0;
+
+ L101:
+ j++;
+ if (j < 4)
+ ntry=ntryh[j];
+ else
+ ntry+=2;
+
+ L104:
+ nq=nl/ntry;
+ nr=nl-ntry*nq;
+ if (nr!=0) goto L101;
+
+ nf++;
+ ifac[nf+1]=ntry;
+ nl=nq;
+ if(ntry!=2)goto L107;
+ if(nf==1)goto L107;
+
+ for (i=1;i<nf;i++){
+ ib=nf-i+1;
+ ifac[ib+1]=ifac[ib];
+ }
+ ifac[2] = 2;
+
+ L107:
+ if(nl!=1)goto L104;
+ ifac[0]=n;
+ ifac[1]=nf;
+ argh=tpi/n;
+ is=0;
+ nfm1=nf-1;
+ l1=1;
+
+ if(nfm1==0)return;
+
+ for (k1=0;k1<nfm1;k1++){
+ ip=ifac[k1+2];
+ ld=0;
+ l2=l1*ip;
+ ido=n/l2;
+ ipm=ip-1;
+
+ for (j=0;j<ipm;j++){
+ ld+=l1;
+ i=is;
+ argld=(float)ld*argh;
+ fi=0.f;
+ for (ii=2;ii<ido;ii+=2){
+ fi+=1.f;
+ arg=fi*argld;
+ wa[i++]=cos(arg);
+ wa[i++]=sin(arg);
+ }
+ is+=ido;
}
+ l1=l2;
+ }
}
-static void fdrffti(int n, float *wsave, int *ifac)
-{
+static void fdrffti(int n, float *wsave, int *ifac){
- if(n == 1) return;
- drfti1(n, wsave + n, ifac);
+ if (n == 1) return;
+ drfti1(n, wsave+n, ifac);
}
-static void dradf2(int ido, int l1, float *cc, float *ch, float *wa1)
-{
- int i, k;
- float ti2, tr2;
- int t0, t1, t2, t3, t4, t5, t6;
-
- t1 = 0;
- t0 = (t2 = l1 * ido);
- t3 = ido << 1;
- for(k = 0; k < l1; k++)
- {
- ch[t1<<1] = cc[t1] + cc[t2];
- ch[(t1<<1)+t3-1] = cc[t1] - cc[t2];
- t1 += ido;
- t2 += ido;
- }
-
- if(ido < 2)return;
- if(ido == 2)goto L105;
-
- t1 = 0;
- t2 = t0;
- for(k = 0; k < l1; k++)
- {
- t3 = t2;
- t4 = (t1 << 1) + (ido << 1);
- t5 = t1;
- t6 = t1 + t1;
- for(i = 2; i < ido; i += 2)
- {
- t3 += 2;
- t4 -= 2;
- t5 += 2;
- t6 += 2;
- tr2 = wa1[i-2] * cc[t3-1] + wa1[i-1] * cc[t3];
- ti2 = wa1[i-2] * cc[t3] - wa1[i-1] * cc[t3-1];
- ch[t6] = cc[t5] + ti2;
- ch[t4] = ti2 - cc[t5];
- ch[t6-1] = cc[t5-1] + tr2;
- ch[t4-1] = cc[t5-1] - tr2;
- }
- t1 += ido;
- t2 += ido;
- }
-
- if(ido % 2 == 1)return;
-
-L105:
- t3 = (t2 = (t1 = ido) - 1);
- t2 += t0;
- for(k = 0; k < l1; k++)
- {
- ch[t1] = -cc[t2];
- ch[t1-1] = cc[t3];
- t1 += ido << 1;
- t2 += ido;
- t3 += ido;
+static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
+ int i,k;
+ float ti2,tr2;
+ int t0,t1,t2,t3,t4,t5,t6;
+
+ t1=0;
+ t0=(t2=l1*ido);
+ t3=ido<<1;
+ for(k=0;k<l1;k++){
+ ch[t1<<1]=cc[t1]+cc[t2];
+ ch[(t1<<1)+t3-1]=cc[t1]-cc[t2];
+ t1+=ido;
+ t2+=ido;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+ t1=0;
+ t2=t0;
+ for(k=0;k<l1;k++){
+ t3=t2;
+ t4=(t1<<1)+(ido<<1);
+ t5=t1;
+ t6=t1+t1;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4-=2;
+ t5+=2;
+ t6+=2;
+ tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
+ ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
+ ch[t6]=cc[t5]+ti2;
+ ch[t4]=ti2-cc[t5];
+ ch[t6-1]=cc[t5-1]+tr2;
+ ch[t4-1]=cc[t5-1]-tr2;
}
+ t1+=ido;
+ t2+=ido;
+ }
+
+ if(ido%2==1)return;
+
+ L105:
+ t3=(t2=(t1=ido)-1);
+ t2+=t0;
+ for(k=0;k<l1;k++){
+ ch[t1]=-cc[t2];
+ ch[t1-1]=cc[t3];
+ t1+=ido<<1;
+ t2+=ido;
+ t3+=ido;
+ }
}
-static void dradf4(int ido, int l1, float *cc, float *ch, float *wa1,
- float *wa2, float *wa3)
-{
- static float hsqt2 = .70710678118654752f;
- int i, k, t0, t1, t2, t3, t4, t5, t6;
- float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
- t0 = l1 * ido;
-
- t1 = t0;
- t4 = t1 << 1;
- t2 = t1 + (t1 << 1);
- t3 = 0;
-
- for(k = 0; k < l1; k++)
- {
- tr1 = cc[t1] + cc[t2];
- tr2 = cc[t3] + cc[t4];
-
- ch[t5=t3<<2] = tr1 + tr2;
- ch[(ido<<2)+t5-1] = tr2 - tr1;
- ch[(t5+=(ido<<1))-1] = cc[t3] - cc[t4];
- ch[t5] = cc[t2] - cc[t1];
-
- t1 += ido;
- t2 += ido;
- t3 += ido;
- t4 += ido;
+static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
+ float *wa2,float *wa3){
+ static float hsqt2 = .70710678118654752f;
+ int i,k,t0,t1,t2,t3,t4,t5,t6;
+ float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
+ t0=l1*ido;
+
+ t1=t0;
+ t4=t1<<1;
+ t2=t1+(t1<<1);
+ t3=0;
+
+ for(k=0;k<l1;k++){
+ tr1=cc[t1]+cc[t2];
+ tr2=cc[t3]+cc[t4];
+
+ ch[t5=t3<<2]=tr1+tr2;
+ ch[(ido<<2)+t5-1]=tr2-tr1;
+ ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4];
+ ch[t5]=cc[t2]-cc[t1];
+
+ t1+=ido;
+ t2+=ido;
+ t3+=ido;
+ t4+=ido;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+
+ t1=0;
+ for(k=0;k<l1;k++){
+ t2=t1;
+ t4=t1<<2;
+ t5=(t6=ido<<1)+t4;
+ for(i=2;i<ido;i+=2){
+ t3=(t2+=2);
+ t4+=2;
+ t5-=2;
+
+ t3+=t0;
+ cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
+ ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
+ t3+=t0;
+ cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3];
+ ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1];
+ t3+=t0;
+ cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3];
+ ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1];
+
+ tr1=cr2+cr4;
+ tr4=cr4-cr2;
+ ti1=ci2+ci4;
+ ti4=ci2-ci4;
+
+ ti2=cc[t2]+ci3;
+ ti3=cc[t2]-ci3;
+ tr2=cc[t2-1]+cr3;
+ tr3=cc[t2-1]-cr3;
+
+ ch[t4-1]=tr1+tr2;
+ ch[t4]=ti1+ti2;
+
+ ch[t5-1]=tr3-ti4;
+ ch[t5]=tr4-ti3;
+
+ ch[t4+t6-1]=ti4+tr3;
+ ch[t4+t6]=tr4+ti3;
+
+ ch[t5+t6-1]=tr2-tr1;
+ ch[t5+t6]=ti1-ti2;
}
+ t1+=ido;
+ }
+ if(ido&1)return;
- if(ido < 2)return;
- if(ido == 2)goto L105;
-
-
- t1 = 0;
- for(k = 0; k < l1; k++)
- {
- t2 = t1;
- t4 = t1 << 2;
- t5 = (t6 = ido << 1) + t4;
- for(i = 2; i < ido; i += 2)
- {
- t3 = (t2 += 2);
- t4 += 2;
- t5 -= 2;
-
- t3 += t0;
- cr2 = wa1[i-2] * cc[t3-1] + wa1[i-1] * cc[t3];
- ci2 = wa1[i-2] * cc[t3] - wa1[i-1] * cc[t3-1];
- t3 += t0;
- cr3 = wa2[i-2] * cc[t3-1] + wa2[i-1] * cc[t3];
- ci3 = wa2[i-2] * cc[t3] - wa2[i-1] * cc[t3-1];
- t3 += t0;
- cr4 = wa3[i-2] * cc[t3-1] + wa3[i-1] * cc[t3];
- ci4 = wa3[i-2] * cc[t3] - wa3[i-1] * cc[t3-1];
-
- tr1 = cr2 + cr4;
- tr4 = cr4 - cr2;
- ti1 = ci2 + ci4;
- ti4 = ci2 - ci4;
-
- ti2 = cc[t2] + ci3;
- ti3 = cc[t2] - ci3;
- tr2 = cc[t2-1] + cr3;
- tr3 = cc[t2-1] - cr3;
-
- ch[t4-1] = tr1 + tr2;
- ch[t4] = ti1 + ti2;
-
- ch[t5-1] = tr3 - ti4;
- ch[t5] = tr4 - ti3;
-
- ch[t4+t6-1] = ti4 + tr3;
- ch[t4+t6] = tr4 + ti3;
-
- ch[t5+t6-1] = tr2 - tr1;
- ch[t5+t6] = ti1 - ti2;
- }
- t1 += ido;
- }
- if(ido & 1)return;
+ L105:
-L105:
-
- t2 = (t1 = t0 + ido - 1) + (t0 << 1);
- t3 = ido << 2;
- t4 = ido;
- t5 = ido << 1;
- t6 = ido;
+ t2=(t1=t0+ido-1)+(t0<<1);
+ t3=ido<<2;
+ t4=ido;
+ t5=ido<<1;
+ t6=ido;
- for(k = 0; k < l1; k++)
- {
- ti1 = -hsqt2 * (cc[t1] + cc[t2]);
- tr1 = hsqt2 * (cc[t1] - cc[t2]);
+ for(k=0;k<l1;k++){
+ ti1=-hsqt2*(cc[t1]+cc[t2]);
+ tr1=hsqt2*(cc[t1]-cc[t2]);
- ch[t4-1] = tr1 + cc[t6-1];
- ch[t4+t5-1] = cc[t6-1] - tr1;
+ ch[t4-1]=tr1+cc[t6-1];
+ ch[t4+t5-1]=cc[t6-1]-tr1;
- ch[t4] = ti1 - cc[t1+t0];
- ch[t4+t5] = ti1 + cc[t1+t0];
+ ch[t4]=ti1-cc[t1+t0];
+ ch[t4+t5]=ti1+cc[t1+t0];
- t1 += ido;
- t2 += ido;
- t4 += t3;
- t6 += ido;
- }
+ t1+=ido;
+ t2+=ido;
+ t4+=t3;
+ t6+=ido;
+ }
}
-static void dradfg(int ido, int ip, int l1, int idl1, float *cc, float *c1,
- float *c2, float *ch, float *ch2, float *wa)
-{
-
- static float tpi = 6.283185307179586f;
- int idij, ipph, i, j, k, l, ic, ik, is;
- int t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
- float dc2, ai1, ai2, ar1, ar2, ds2;
- int nbd;
- float dcp, arg, dsp, ar1h, ar2h;
- int idp2, ipp2;
-
- arg = tpi / (float)ip;
- dcp = cos(arg);
- dsp = sin(arg);
- ipph = (ip + 1) >> 1;
- ipp2 = ip;
- idp2 = ido;
- nbd = (ido - 1) >> 1;
- t0 = l1 * ido;
- t10 = ip * ido;
-
- if(ido == 1)goto L119;
- for(ik = 0; ik < idl1; ik++)ch2[ik] = c2[ik];
-
- t1 = 0;
- for(j = 1; j < ip; j++)
- {
- t1 += t0;
- t2 = t1;
- for(k = 0; k < l1; k++)
- {
- ch[t2] = c1[t2];
- t2 += ido;
- }
+static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
+ float *c2,float *ch,float *ch2,float *wa){
+
+ static float tpi=6.283185307179586f;
+ int idij,ipph,i,j,k,l,ic,ik,is;
+ int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+ float dc2,ai1,ai2,ar1,ar2,ds2;
+ int nbd;
+ float dcp,arg,dsp,ar1h,ar2h;
+ int idp2,ipp2;
+
+ arg=tpi/(float)ip;
+ dcp=cos(arg);
+ dsp=sin(arg);
+ ipph=(ip+1)>>1;
+ ipp2=ip;
+ idp2=ido;
+ nbd=(ido-1)>>1;
+ t0=l1*ido;
+ t10=ip*ido;
+
+ if(ido==1)goto L119;
+ for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik];
+
+ t1=0;
+ for(j=1;j<ip;j++){
+ t1+=t0;
+ t2=t1;
+ for(k=0;k<l1;k++){
+ ch[t2]=c1[t2];
+ t2+=ido;
}
-
- is = -ido;
- t1 = 0;
- if(nbd > l1)
- {
- for(j = 1; j < ip; j++)
- {
- t1 += t0;
- is += ido;
- t2 = -ido + t1;
- for(k = 0; k < l1; k++)
- {
- idij = is - 1;
- t2 += ido;
- t3 = t2;
- for(i = 2; i < ido; i += 2)
- {
- idij += 2;
- t3 += 2;
- ch[t3-1] = wa[idij-1] * c1[t3-1] + wa[idij] * c1[t3];
- ch[t3] = wa[idij-1] * c1[t3] - wa[idij] * c1[t3-1];
- }
- }
+ }
+
+ is=-ido;
+ t1=0;
+ if(nbd>l1){
+ for(j=1;j<ip;j++){
+ t1+=t0;
+ is+=ido;
+ t2= -ido+t1;
+ for(k=0;k<l1;k++){
+ idij=is-1;
+ t2+=ido;
+ t3=t2;
+ for(i=2;i<ido;i+=2){
+ idij+=2;
+ t3+=2;
+ ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
+ ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
}
+ }
}
- else
- {
-
- for(j = 1; j < ip; j++)
- {
- is += ido;
- idij = is - 1;
- t1 += t0;
- t2 = t1;
- for(i = 2; i < ido; i += 2)
- {
- idij += 2;
- t2 += 2;
- t3 = t2;
- for(k = 0; k < l1; k++)
- {
- ch[t3-1] = wa[idij-1] * c1[t3-1] + wa[idij] * c1[t3];
- ch[t3] = wa[idij-1] * c1[t3] - wa[idij] * c1[t3-1];
- t3 += ido;
- }
- }
+ }else{
+
+ for(j=1;j<ip;j++){
+ is+=ido;
+ idij=is-1;
+ t1+=t0;
+ t2=t1;
+ for(i=2;i<ido;i+=2){
+ idij+=2;
+ t2+=2;
+ t3=t2;
+ for(k=0;k<l1;k++){
+ ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
+ ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
+ t3+=ido;
}
+ }
}
-
- t1 = 0;
- t2 = ipp2 * t0;
- if(nbd < l1)
- {
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- for(i = 2; i < ido; i += 2)
- {
- t3 += 2;
- t4 += 2;
- t5 = t3 - ido;
- t6 = t4 - ido;
- for(k = 0; k < l1; k++)
- {
- t5 += ido;
- t6 += ido;
- c1[t5-1] = ch[t5-1] + ch[t6-1];
- c1[t6-1] = ch[t5] - ch[t6];
- c1[t5] = ch[t5] + ch[t6];
- c1[t6] = ch[t6-1] - ch[t5-1];
- }
- }
+ }
+
+ t1=0;
+ t2=ipp2*t0;
+ if(nbd<l1){
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t5=t3-ido;
+ t6=t4-ido;
+ for(k=0;k<l1;k++){
+ t5+=ido;
+ t6+=ido;
+ c1[t5-1]=ch[t5-1]+ch[t6-1];
+ c1[t6-1]=ch[t5]-ch[t6];
+ c1[t5]=ch[t5]+ch[t6];
+ c1[t6]=ch[t6-1]-ch[t5-1];
}
+ }
}
- else
- {
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- for(k = 0; k < l1; k++)
- {
- t5 = t3;
- t6 = t4;
- for(i = 2; i < ido; i += 2)
- {
- t5 += 2;
- t6 += 2;
- c1[t5-1] = ch[t5-1] + ch[t6-1];
- c1[t6-1] = ch[t5] - ch[t6];
- c1[t5] = ch[t5] + ch[t6];
- c1[t6] = ch[t6-1] - ch[t5-1];
- }
- t3 += ido;
- t4 += ido;
- }
+ }else{
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(k=0;k<l1;k++){
+ t5=t3;
+ t6=t4;
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6+=2;
+ c1[t5-1]=ch[t5-1]+ch[t6-1];
+ c1[t6-1]=ch[t5]-ch[t6];
+ c1[t5]=ch[t5]+ch[t6];
+ c1[t6]=ch[t6-1]-ch[t5-1];
}
+ t3+=ido;
+ t4+=ido;
+ }
}
+ }
L119:
- for(ik = 0; ik < idl1; ik++)c2[ik] = ch2[ik];
-
- t1 = 0;
- t2 = ipp2 * idl1;
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1 - ido;
- t4 = t2 - ido;
- for(k = 0; k < l1; k++)
- {
- t3 += ido;
- t4 += ido;
- c1[t3] = ch[t3] + ch[t4];
- c1[t4] = ch[t4] - ch[t3];
- }
+ for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+
+ t1=0;
+ t2=ipp2*idl1;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1-ido;
+ t4=t2-ido;
+ for(k=0;k<l1;k++){
+ t3+=ido;
+ t4+=ido;
+ c1[t3]=ch[t3]+ch[t4];
+ c1[t4]=ch[t4]-ch[t3];
}
-
- ar1 = 1.f;
- ai1 = 0.f;
- t1 = 0;
- t2 = ipp2 * idl1;
- t3 = (ip - 1) * idl1;
- for(l = 1; l < ipph; l++)
- {
- t1 += idl1;
- t2 -= idl1;
- ar1h = dcp * ar1 - dsp * ai1;
- ai1 = dcp * ai1 + dsp * ar1;
- ar1 = ar1h;
- t4 = t1;
- t5 = t2;
- t6 = t3;
- t7 = idl1;
-
- for(ik = 0; ik < idl1; ik++)
- {
- ch2[t4++] = c2[ik] + ar1 * c2[t7++];
- ch2[t5++] = ai1 * c2[t6++];
- }
-
- dc2 = ar1;
- ds2 = ai1;
- ar2 = ar1;
- ai2 = ai1;
-
- t4 = idl1;
- t5 = (ipp2 - 1) * idl1;
- for(j = 2; j < ipph; j++)
- {
- t4 += idl1;
- t5 -= idl1;
-
- ar2h = dc2 * ar2 - ds2 * ai2;
- ai2 = dc2 * ai2 + ds2 * ar2;
- ar2 = ar2h;
-
- t6 = t1;
- t7 = t2;
- t8 = t4;
- t9 = t5;
- for(ik = 0; ik < idl1; ik++)
- {
- ch2[t6++] += ar2 * c2[t8++];
- ch2[t7++] += ai2 * c2[t9++];
- }
- }
+ }
+
+ ar1=1.f;
+ ai1=0.f;
+ t1=0;
+ t2=ipp2*idl1;
+ t3=(ip-1)*idl1;
+ for(l=1;l<ipph;l++){
+ t1+=idl1;
+ t2-=idl1;
+ ar1h=dcp*ar1-dsp*ai1;
+ ai1=dcp*ai1+dsp*ar1;
+ ar1=ar1h;
+ t4=t1;
+ t5=t2;
+ t6=t3;
+ t7=idl1;
+
+ for(ik=0;ik<idl1;ik++){
+ ch2[t4++]=c2[ik]+ar1*c2[t7++];
+ ch2[t5++]=ai1*c2[t6++];
}
- t1 = 0;
- for(j = 1; j < ipph; j++)
- {
- t1 += idl1;
- t2 = t1;
- for(ik = 0; ik < idl1; ik++)ch2[ik] += c2[t2++];
+ dc2=ar1;
+ ds2=ai1;
+ ar2=ar1;
+ ai2=ai1;
+
+ t4=idl1;
+ t5=(ipp2-1)*idl1;
+ for(j=2;j<ipph;j++){
+ t4+=idl1;
+ t5-=idl1;
+
+ ar2h=dc2*ar2-ds2*ai2;
+ ai2=dc2*ai2+ds2*ar2;
+ ar2=ar2h;
+
+ t6=t1;
+ t7=t2;
+ t8=t4;
+ t9=t5;
+ for(ik=0;ik<idl1;ik++){
+ ch2[t6++]+=ar2*c2[t8++];
+ ch2[t7++]+=ai2*c2[t9++];
+ }
}
-
- if(ido < l1)goto L132;
-
- t1 = 0;
- t2 = 0;
- for(k = 0; k < l1; k++)
- {
- t3 = t1;
- t4 = t2;
- for(i = 0; i < ido; i++)cc[t4++] = ch[t3++];
- t1 += ido;
- t2 += t10;
+ }
+
+ t1=0;
+ for(j=1;j<ipph;j++){
+ t1+=idl1;
+ t2=t1;
+ for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++];
+ }
+
+ if(ido<l1)goto L132;
+
+ t1=0;
+ t2=0;
+ for(k=0;k<l1;k++){
+ t3=t1;
+ t4=t2;
+ for(i=0;i<ido;i++)cc[t4++]=ch[t3++];
+ t1+=ido;
+ t2+=t10;
+ }
+
+ goto L135;
+
+ L132:
+ for(i=0;i<ido;i++){
+ t1=i;
+ t2=i;
+ for(k=0;k<l1;k++){
+ cc[t2]=ch[t1];
+ t1+=ido;
+ t2+=t10;
}
-
- goto L135;
-
-L132:
- for(i = 0; i < ido; i++)
- {
- t1 = i;
- t2 = i;
- for(k = 0; k < l1; k++)
- {
- cc[t2] = ch[t1];
- t1 += ido;
- t2 += t10;
- }
+ }
+
+ L135:
+ t1=0;
+ t2=ido<<1;
+ t3=0;
+ t4=ipp2*t0;
+ for(j=1;j<ipph;j++){
+
+ t1+=t2;
+ t3+=t0;
+ t4-=t0;
+
+ t5=t1;
+ t6=t3;
+ t7=t4;
+
+ for(k=0;k<l1;k++){
+ cc[t5-1]=ch[t6];
+ cc[t5]=ch[t7];
+ t5+=t10;
+ t6+=ido;
+ t7+=ido;
}
-
-L135:
- t1 = 0;
- t2 = ido << 1;
- t3 = 0;
- t4 = ipp2 * t0;
- for(j = 1; j < ipph; j++)
- {
-
- t1 += t2;
- t3 += t0;
- t4 -= t0;
-
- t5 = t1;
- t6 = t3;
- t7 = t4;
-
- for(k = 0; k < l1; k++)
- {
- cc[t5-1] = ch[t6];
- cc[t5] = ch[t7];
- t5 += t10;
- t6 += ido;
- t7 += ido;
- }
- }
-
- if(ido == 1)return;
- if(nbd < l1)goto L141;
-
- t1 = -ido;
- t3 = 0;
- t4 = 0;
- t5 = ipp2 * t0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t2;
- t3 += t2;
- t4 += t0;
- t5 -= t0;
- t6 = t1;
- t7 = t3;
- t8 = t4;
- t9 = t5;
- for(k = 0; k < l1; k++)
- {
- for(i = 2; i < ido; i += 2)
- {
- ic = idp2 - i;
- cc[i+t7-1] = ch[i+t8-1] + ch[i+t9-1];
- cc[ic+t6-1] = ch[i+t8-1] - ch[i+t9-1];
- cc[i+t7] = ch[i+t8] + ch[i+t9];
- cc[ic+t6] = ch[i+t9] - ch[i+t8];
- }
- t6 += t10;
- t7 += t10;
- t8 += ido;
- t9 += ido;
- }
+ }
+
+ if(ido==1)return;
+ if(nbd<l1)goto L141;
+
+ t1=-ido;
+ t3=0;
+ t4=0;
+ t5=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t2;
+ t3+=t2;
+ t4+=t0;
+ t5-=t0;
+ t6=t1;
+ t7=t3;
+ t8=t4;
+ t9=t5;
+ for(k=0;k<l1;k++){
+ for(i=2;i<ido;i+=2){
+ ic=idp2-i;
+ cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1];
+ cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1];
+ cc[i+t7]=ch[i+t8]+ch[i+t9];
+ cc[ic+t6]=ch[i+t9]-ch[i+t8];
+ }
+ t6+=t10;
+ t7+=t10;
+ t8+=ido;
+ t9+=ido;
}
- return;
-
-L141:
-
- t1 = -ido;
- t3 = 0;
- t4 = 0;
- t5 = ipp2 * t0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t2;
- t3 += t2;
- t4 += t0;
- t5 -= t0;
- for(i = 2; i < ido; i += 2)
- {
- t6 = idp2 + t1 - i;
- t7 = i + t3;
- t8 = i + t4;
- t9 = i + t5;
- for(k = 0; k < l1; k++)
- {
- cc[t7-1] = ch[t8-1] + ch[t9-1];
- cc[t6-1] = ch[t8-1] - ch[t9-1];
- cc[t7] = ch[t8] + ch[t9];
- cc[t6] = ch[t9] - ch[t8];
- t6 += t10;
- t7 += t10;
- t8 += ido;
- t9 += ido;
- }
- }
+ }
+ return;
+
+ L141:
+
+ t1=-ido;
+ t3=0;
+ t4=0;
+ t5=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t2;
+ t3+=t2;
+ t4+=t0;
+ t5-=t0;
+ for(i=2;i<ido;i+=2){
+ t6=idp2+t1-i;
+ t7=i+t3;
+ t8=i+t4;
+ t9=i+t5;
+ for(k=0;k<l1;k++){
+ cc[t7-1]=ch[t8-1]+ch[t9-1];
+ cc[t6-1]=ch[t8-1]-ch[t9-1];
+ cc[t7]=ch[t8]+ch[t9];
+ cc[t6]=ch[t9]-ch[t8];
+ t6+=t10;
+ t7+=t10;
+ t8+=ido;
+ t9+=ido;
+ }
}
+ }
}
-static void drftf1(int n, float *c, float *ch, float *wa, int *ifac)
-{
- int i, k1, l1, l2;
- int na, kh, nf;
- int ip, iw, ido, idl1, ix2, ix3;
-
- nf = ifac[1];
- na = 1;
- l2 = n;
- iw = n;
-
- for(k1 = 0; k1 < nf; k1++)
- {
- kh = nf - k1;
- ip = ifac[kh+1];
- l1 = l2 / ip;
- ido = n / l2;
- idl1 = ido * l1;
- iw -= (ip - 1) * ido;
- na = 1 - na;
-
- if(ip != 4)goto L102;
-
- ix2 = iw + ido;
- ix3 = ix2 + ido;
- if(na != 0)
- dradf4(ido, l1, ch, c, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
- else
- dradf4(ido, l1, c, ch, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
- goto L110;
-
-L102:
- if(ip != 2)goto L104;
- if(na != 0)goto L103;
-
- dradf2(ido, l1, c, ch, wa + iw - 1);
- goto L110;
-
-L103:
- dradf2(ido, l1, ch, c, wa + iw - 1);
- goto L110;
-
-L104:
- if(ido == 1)na = 1 - na;
- if(na != 0)goto L109;
-
- dradfg(ido, ip, l1, idl1, c, c, c, ch, ch, wa + iw - 1);
- na = 1;
- goto L110;
-
-L109:
- dradfg(ido, ip, l1, idl1, ch, ch, ch, c, c, wa + iw - 1);
- na = 0;
-
-L110:
- l2 = l1;
- }
+static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){
+ int i,k1,l1,l2;
+ int na,kh,nf;
+ int ip,iw,ido,idl1,ix2,ix3;
+
+ nf=ifac[1];
+ na=1;
+ l2=n;
+ iw=n;
+
+ for(k1=0;k1<nf;k1++){
+ kh=nf-k1;
+ ip=ifac[kh+1];
+ l1=l2/ip;
+ ido=n/l2;
+ idl1=ido*l1;
+ iw-=(ip-1)*ido;
+ na=1-na;
+
+ if(ip!=4)goto L102;
+
+ ix2=iw+ido;
+ ix3=ix2+ido;
+ if(na!=0)
+ dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ else
+ dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ goto L110;
- if(na == 1)return;
+ L102:
+ if(ip!=2)goto L104;
+ if(na!=0)goto L103;
- for(i = 0; i < n; i++)c[i] = ch[i];
-}
+ dradf2(ido,l1,c,ch,wa+iw-1);
+ goto L110;
-static void dradb2(int ido, int l1, float *cc, float *ch, float *wa1)
-{
- int i, k, t0, t1, t2, t3, t4, t5, t6;
- float ti2, tr2;
-
- t0 = l1 * ido;
-
- t1 = 0;
- t2 = 0;
- t3 = (ido << 1) - 1;
- for(k = 0; k < l1; k++)
- {
- ch[t1] = cc[t2] + cc[t3+t2];
- ch[t1+t0] = cc[t2] - cc[t3+t2];
- t2 = (t1 += ido) << 1;
- }
+ L103:
+ dradf2(ido,l1,ch,c,wa+iw-1);
+ goto L110;
- if(ido < 2)return;
- if(ido == 2)goto L105;
-
- t1 = 0;
- t2 = 0;
- for(k = 0; k < l1; k++)
- {
- t3 = t1;
- t5 = (t4 = t2) + (ido << 1);
- t6 = t0 + t1;
- for(i = 2; i < ido; i += 2)
- {
- t3 += 2;
- t4 += 2;
- t5 -= 2;
- t6 += 2;
- ch[t3-1] = cc[t4-1] + cc[t5-1];
- tr2 = cc[t4-1] - cc[t5-1];
- ch[t3] = cc[t4] - cc[t5];
- ti2 = cc[t4] + cc[t5];
- ch[t6-1] = wa1[i-2] * tr2 - wa1[i-1] * ti2;
- ch[t6] = wa1[i-2] * ti2 + wa1[i-1] * tr2;
- }
- t2 = (t1 += ido) << 1;
- }
+ L104:
+ if(ido==1)na=1-na;
+ if(na!=0)goto L109;
- if(ido % 2 == 1)return;
+ dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
+ na=1;
+ goto L110;
-L105:
- t1 = ido - 1;
- t2 = ido - 1;
- for(k = 0; k < l1; k++)
- {
- ch[t1] = cc[t2] + cc[t2];
- ch[t1+t0] = -(cc[t2+1] + cc[t2+1]);
- t1 += ido;
- t2 += ido << 1;
- }
-}
+ L109:
+ dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
+ na=0;
-static void dradb3(int ido, int l1, float *cc, float *ch, float *wa1,
- float *wa2)
-{
- static float taur = -.5f;
- static float taui = .8660254037844386f;
- int i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
- float ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2;
- t0 = l1 * ido;
-
- t1 = 0;
- t2 = t0 << 1;
- t3 = ido << 1;
- t4 = ido + (ido << 1);
- t5 = 0;
- for(k = 0; k < l1; k++)
- {
- tr2 = cc[t3-1] + cc[t3-1];
- cr2 = cc[t5] + (taur * tr2);
- ch[t1] = cc[t5] + tr2;
- ci3 = taui * (cc[t3] + cc[t3]);
- ch[t1+t0] = cr2 - ci3;
- ch[t1+t2] = cr2 + ci3;
- t1 += ido;
- t3 += t4;
- t5 += t4;
- }
+ L110:
+ l2=l1;
+ }
- if(ido == 1)return;
-
- t1 = 0;
- t3 = ido << 1;
- for(k = 0; k < l1; k++)
- {
- t7 = t1 + (t1 << 1);
- t6 = (t5 = t7 + t3);
- t8 = t1;
- t10 = (t9 = t1 + t0) + t0;
-
- for(i = 2; i < ido; i += 2)
- {
- t5 += 2;
- t6 -= 2;
- t7 += 2;
- t8 += 2;
- t9 += 2;
- t10 += 2;
- tr2 = cc[t5-1] + cc[t6-1];
- cr2 = cc[t7-1] + (taur * tr2);
- ch[t8-1] = cc[t7-1] + tr2;
- ti2 = cc[t5] - cc[t6];
- ci2 = cc[t7] + (taur * ti2);
- ch[t8] = cc[t7] + ti2;
- cr3 = taui * (cc[t5-1] - cc[t6-1]);
- ci3 = taui * (cc[t5] + cc[t6]);
- dr2 = cr2 - ci3;
- dr3 = cr2 + ci3;
- di2 = ci2 + cr3;
- di3 = ci2 - cr3;
- ch[t9-1] = wa1[i-2] * dr2 - wa1[i-1] * di2;
- ch[t9] = wa1[i-2] * di2 + wa1[i-1] * dr2;
- ch[t10-1] = wa2[i-2] * dr3 - wa2[i-1] * di3;
- ch[t10] = wa2[i-2] * di3 + wa2[i-1] * dr3;
- }
- t1 += ido;
- }
-}
+ if(na==1)return;
-static void dradb4(int ido, int l1, float *cc, float *ch, float *wa1,
- float *wa2, float *wa3)
-{
- static float sqrt2 = 1.414213562373095f;
- int i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8;
- float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
- t0 = l1 * ido;
-
- t1 = 0;
- t2 = ido << 2;
- t3 = 0;
- t6 = ido << 1;
- for(k = 0; k < l1; k++)
- {
- t4 = t3 + t6;
- t5 = t1;
- tr3 = cc[t4-1] + cc[t4-1];
- tr4 = cc[t4] + cc[t4];
- tr1 = cc[t3] - cc[(t4+=t6)-1];
- tr2 = cc[t3] + cc[t4-1];
- ch[t5] = tr2 + tr3;
- ch[t5+=t0] = tr1 - tr4;
- ch[t5+=t0] = tr2 - tr3;
- ch[t5+=t0] = tr1 + tr4;
- t1 += ido;
- t3 += t2;
- }
+ for(i=0;i<n;i++)c[i]=ch[i];
+}
- if(ido < 2)return;
- if(ido == 2)goto L105;
-
- t1 = 0;
- for(k = 0; k < l1; k++)
- {
- t5 = (t4 = (t3 = (t2 = t1 << 2) + t6)) + t6;
- t7 = t1;
- for(i = 2; i < ido; i += 2)
- {
- t2 += 2;
- t3 += 2;
- t4 -= 2;
- t5 -= 2;
- t7 += 2;
- ti1 = cc[t2] + cc[t5];
- ti2 = cc[t2] - cc[t5];
- ti3 = cc[t3] - cc[t4];
- tr4 = cc[t3] + cc[t4];
- tr1 = cc[t2-1] - cc[t5-1];
- tr2 = cc[t2-1] + cc[t5-1];
- ti4 = cc[t3-1] - cc[t4-1];
- tr3 = cc[t3-1] + cc[t4-1];
- ch[t7-1] = tr2 + tr3;
- cr3 = tr2 - tr3;
- ch[t7] = ti2 + ti3;
- ci3 = ti2 - ti3;
- cr2 = tr1 - tr4;
- cr4 = tr1 + tr4;
- ci2 = ti1 + ti4;
- ci4 = ti1 - ti4;
-
- ch[(t8=t7+t0)-1] = wa1[i-2] * cr2 - wa1[i-1] * ci2;
- ch[t8] = wa1[i-2] * ci2 + wa1[i-1] * cr2;
- ch[(t8+=t0)-1] = wa2[i-2] * cr3 - wa2[i-1] * ci3;
- ch[t8] = wa2[i-2] * ci3 + wa2[i-1] * cr3;
- ch[(t8+=t0)-1] = wa3[i-2] * cr4 - wa3[i-1] * ci4;
- ch[t8] = wa3[i-2] * ci4 + wa3[i-1] * cr4;
- }
- t1 += ido;
+static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
+ int i,k,t0,t1,t2,t3,t4,t5,t6;
+ float ti2,tr2;
+
+ t0=l1*ido;
+
+ t1=0;
+ t2=0;
+ t3=(ido<<1)-1;
+ for(k=0;k<l1;k++){
+ ch[t1]=cc[t2]+cc[t3+t2];
+ ch[t1+t0]=cc[t2]-cc[t3+t2];
+ t2=(t1+=ido)<<1;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+ t1=0;
+ t2=0;
+ for(k=0;k<l1;k++){
+ t3=t1;
+ t5=(t4=t2)+(ido<<1);
+ t6=t0+t1;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t5-=2;
+ t6+=2;
+ ch[t3-1]=cc[t4-1]+cc[t5-1];
+ tr2=cc[t4-1]-cc[t5-1];
+ ch[t3]=cc[t4]-cc[t5];
+ ti2=cc[t4]+cc[t5];
+ ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2;
+ ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2;
}
+ t2=(t1+=ido)<<1;
+ }
- if(ido % 2 == 1)return;
+ if(ido%2==1)return;
L105:
+ t1=ido-1;
+ t2=ido-1;
+ for(k=0;k<l1;k++){
+ ch[t1]=cc[t2]+cc[t2];
+ ch[t1+t0]=-(cc[t2+1]+cc[t2+1]);
+ t1+=ido;
+ t2+=ido<<1;
+ }
+}
- t1 = ido;
- t2 = ido << 2;
- t3 = ido - 1;
- t4 = ido + (ido << 1);
- for(k = 0; k < l1; k++)
- {
- t5 = t3;
- ti1 = cc[t1] + cc[t4];
- ti2 = cc[t4] - cc[t1];
- tr1 = cc[t1-1] - cc[t4-1];
- tr2 = cc[t1-1] + cc[t4-1];
- ch[t5] = tr2 + tr2;
- ch[t5+=t0] = sqrt2 * (tr1 - ti1);
- ch[t5+=t0] = ti2 + ti2;
- ch[t5+=t0] = -sqrt2 * (tr1 + ti1);
-
- t3 += ido;
- t1 += t2;
- t4 += t2;
+static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
+ float *wa2){
+ static float taur = -.5f;
+ static float taui = .8660254037844386f;
+ int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+ float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2;
+ t0=l1*ido;
+
+ t1=0;
+ t2=t0<<1;
+ t3=ido<<1;
+ t4=ido+(ido<<1);
+ t5=0;
+ for(k=0;k<l1;k++){
+ tr2=cc[t3-1]+cc[t3-1];
+ cr2=cc[t5]+(taur*tr2);
+ ch[t1]=cc[t5]+tr2;
+ ci3=taui*(cc[t3]+cc[t3]);
+ ch[t1+t0]=cr2-ci3;
+ ch[t1+t2]=cr2+ci3;
+ t1+=ido;
+ t3+=t4;
+ t5+=t4;
+ }
+
+ if(ido==1)return;
+
+ t1=0;
+ t3=ido<<1;
+ for(k=0;k<l1;k++){
+ t7=t1+(t1<<1);
+ t6=(t5=t7+t3);
+ t8=t1;
+ t10=(t9=t1+t0)+t0;
+
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6-=2;
+ t7+=2;
+ t8+=2;
+ t9+=2;
+ t10+=2;
+ tr2=cc[t5-1]+cc[t6-1];
+ cr2=cc[t7-1]+(taur*tr2);
+ ch[t8-1]=cc[t7-1]+tr2;
+ ti2=cc[t5]-cc[t6];
+ ci2=cc[t7]+(taur*ti2);
+ ch[t8]=cc[t7]+ti2;
+ cr3=taui*(cc[t5-1]-cc[t6-1]);
+ ci3=taui*(cc[t5]+cc[t6]);
+ dr2=cr2-ci3;
+ dr3=cr2+ci3;
+ di2=ci2+cr3;
+ di3=ci2-cr3;
+ ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2;
+ ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2;
+ ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3;
+ ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3;
}
+ t1+=ido;
+ }
}
-static void dradbg(int ido, int ip, int l1, int idl1, float *cc, float *c1,
- float *c2, float *ch, float *ch2, float *wa)
-{
- static float tpi = 6.283185307179586f;
- int idij, ipph, i, j, k, l, ik, is, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10,
- t11, t12;
- float dc2, ai1, ai2, ar1, ar2, ds2;
- int nbd;
- float dcp, arg, dsp, ar1h, ar2h;
- int ipp2;
-
- t10 = ip * ido;
- t0 = l1 * ido;
- arg = tpi / (float)ip;
- dcp = cos(arg);
- dsp = sin(arg);
- nbd = (ido - 1) >> 1;
- ipp2 = ip;
- ipph = (ip + 1) >> 1;
- if(ido < l1)goto L103;
-
- t1 = 0;
- t2 = 0;
- for(k = 0; k < l1; k++)
- {
- t3 = t1;
- t4 = t2;
- for(i = 0; i < ido; i++)
- {
- ch[t3] = cc[t4];
- t3++;
- t4++;
- }
- t1 += ido;
- t2 += t10;
- }
- goto L106;
-
-L103:
- t1 = 0;
- for(i = 0; i < ido; i++)
- {
- t2 = t1;
- t3 = t1;
- for(k = 0; k < l1; k++)
- {
- ch[t2] = cc[t3];
- t2 += ido;
- t3 += t10;
- }
- t1++;
+static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
+ float *wa2,float *wa3){
+ static float sqrt2=1.414213562373095f;
+ int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
+ float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
+ t0=l1*ido;
+
+ t1=0;
+ t2=ido<<2;
+ t3=0;
+ t6=ido<<1;
+ for(k=0;k<l1;k++){
+ t4=t3+t6;
+ t5=t1;
+ tr3=cc[t4-1]+cc[t4-1];
+ tr4=cc[t4]+cc[t4];
+ tr1=cc[t3]-cc[(t4+=t6)-1];
+ tr2=cc[t3]+cc[t4-1];
+ ch[t5]=tr2+tr3;
+ ch[t5+=t0]=tr1-tr4;
+ ch[t5+=t0]=tr2-tr3;
+ ch[t5+=t0]=tr1+tr4;
+ t1+=ido;
+ t3+=t2;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+ t1=0;
+ for(k=0;k<l1;k++){
+ t5=(t4=(t3=(t2=t1<<2)+t6))+t6;
+ t7=t1;
+ for(i=2;i<ido;i+=2){
+ t2+=2;
+ t3+=2;
+ t4-=2;
+ t5-=2;
+ t7+=2;
+ ti1=cc[t2]+cc[t5];
+ ti2=cc[t2]-cc[t5];
+ ti3=cc[t3]-cc[t4];
+ tr4=cc[t3]+cc[t4];
+ tr1=cc[t2-1]-cc[t5-1];
+ tr2=cc[t2-1]+cc[t5-1];
+ ti4=cc[t3-1]-cc[t4-1];
+ tr3=cc[t3-1]+cc[t4-1];
+ ch[t7-1]=tr2+tr3;
+ cr3=tr2-tr3;
+ ch[t7]=ti2+ti3;
+ ci3=ti2-ti3;
+ cr2=tr1-tr4;
+ cr4=tr1+tr4;
+ ci2=ti1+ti4;
+ ci4=ti1-ti4;
+
+ ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2;
+ ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2;
+ ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3;
+ ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3;
+ ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4;
+ ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4;
}
+ t1+=ido;
+ }
+
+ if(ido%2 == 1)return;
+
+ L105:
+
+ t1=ido;
+ t2=ido<<2;
+ t3=ido-1;
+ t4=ido+(ido<<1);
+ for(k=0;k<l1;k++){
+ t5=t3;
+ ti1=cc[t1]+cc[t4];
+ ti2=cc[t4]-cc[t1];
+ tr1=cc[t1-1]-cc[t4-1];
+ tr2=cc[t1-1]+cc[t4-1];
+ ch[t5]=tr2+tr2;
+ ch[t5+=t0]=sqrt2*(tr1-ti1);
+ ch[t5+=t0]=ti2+ti2;
+ ch[t5+=t0]=-sqrt2*(tr1+ti1);
+
+ t3+=ido;
+ t1+=t2;
+ t4+=t2;
+ }
+}
-L106:
- t1 = 0;
- t2 = ipp2 * t0;
- t7 = (t5 = ido << 1);
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- t6 = t5;
- for(k = 0; k < l1; k++)
- {
- ch[t3] = cc[t6-1] + cc[t6-1];
- ch[t4] = cc[t6] + cc[t6];
- t3 += ido;
- t4 += ido;
- t6 += t10;
- }
- t5 += t7;
+static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
+ float *c2,float *ch,float *ch2,float *wa){
+ static float tpi=6.283185307179586f;
+ int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,
+ t11,t12;
+ float dc2,ai1,ai2,ar1,ar2,ds2;
+ int nbd;
+ float dcp,arg,dsp,ar1h,ar2h;
+ int ipp2;
+
+ t10=ip*ido;
+ t0=l1*ido;
+ arg=tpi/(float)ip;
+ dcp=cos(arg);
+ dsp=sin(arg);
+ nbd=(ido-1)>>1;
+ ipp2=ip;
+ ipph=(ip+1)>>1;
+ if(ido<l1)goto L103;
+
+ t1=0;
+ t2=0;
+ for(k=0;k<l1;k++){
+ t3=t1;
+ t4=t2;
+ for(i=0;i<ido;i++){
+ ch[t3]=cc[t4];
+ t3++;
+ t4++;
}
-
- if(ido == 1)goto L116;
- if(nbd < l1)goto L112;
-
- t1 = 0;
- t2 = ipp2 * t0;
- t7 = 0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
-
- t7 += (ido << 1);
- t8 = t7;
- for(k = 0; k < l1; k++)
- {
- t5 = t3;
- t6 = t4;
- t9 = t8;
- t11 = t8;
- for(i = 2; i < ido; i += 2)
- {
- t5 += 2;
- t6 += 2;
- t9 += 2;
- t11 -= 2;
- ch[t5-1] = cc[t9-1] + cc[t11-1];
- ch[t6-1] = cc[t9-1] - cc[t11-1];
- ch[t5] = cc[t9] - cc[t11];
- ch[t6] = cc[t9] + cc[t11];
- }
- t3 += ido;
- t4 += ido;
- t8 += t10;
- }
+ t1+=ido;
+ t2+=t10;
+ }
+ goto L106;
+
+ L103:
+ t1=0;
+ for(i=0;i<ido;i++){
+ t2=t1;
+ t3=t1;
+ for(k=0;k<l1;k++){
+ ch[t2]=cc[t3];
+ t2+=ido;
+ t3+=t10;
}
- goto L116;
-
-L112:
- t1 = 0;
- t2 = ipp2 * t0;
- t7 = 0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- t7 += (ido << 1);
- t8 = t7;
- t9 = t7;
- for(i = 2; i < ido; i += 2)
- {
- t3 += 2;
- t4 += 2;
- t8 += 2;
- t9 -= 2;
- t5 = t3;
- t6 = t4;
- t11 = t8;
- t12 = t9;
- for(k = 0; k < l1; k++)
- {
- ch[t5-1] = cc[t11-1] + cc[t12-1];
- ch[t6-1] = cc[t11-1] - cc[t12-1];
- ch[t5] = cc[t11] - cc[t12];
- ch[t6] = cc[t11] + cc[t12];
- t5 += ido;
- t6 += ido;
- t11 += t10;
- t12 += t10;
- }
- }
+ t1++;
+ }
+
+ L106:
+ t1=0;
+ t2=ipp2*t0;
+ t7=(t5=ido<<1);
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ t6=t5;
+ for(k=0;k<l1;k++){
+ ch[t3]=cc[t6-1]+cc[t6-1];
+ ch[t4]=cc[t6]+cc[t6];
+ t3+=ido;
+ t4+=ido;
+ t6+=t10;
+ }
+ t5+=t7;
+ }
+
+ if (ido == 1)goto L116;
+ if(nbd<l1)goto L112;
+
+ t1=0;
+ t2=ipp2*t0;
+ t7=0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+
+ t7+=(ido<<1);
+ t8=t7;
+ for(k=0;k<l1;k++){
+ t5=t3;
+ t6=t4;
+ t9=t8;
+ t11=t8;
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6+=2;
+ t9+=2;
+ t11-=2;
+ ch[t5-1]=cc[t9-1]+cc[t11-1];
+ ch[t6-1]=cc[t9-1]-cc[t11-1];
+ ch[t5]=cc[t9]-cc[t11];
+ ch[t6]=cc[t9]+cc[t11];
+ }
+ t3+=ido;
+ t4+=ido;
+ t8+=t10;
+ }
+ }
+ goto L116;
+
+ L112:
+ t1=0;
+ t2=ipp2*t0;
+ t7=0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ t7+=(ido<<1);
+ t8=t7;
+ t9=t7;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t8+=2;
+ t9-=2;
+ t5=t3;
+ t6=t4;
+ t11=t8;
+ t12=t9;
+ for(k=0;k<l1;k++){
+ ch[t5-1]=cc[t11-1]+cc[t12-1];
+ ch[t6-1]=cc[t11-1]-cc[t12-1];
+ ch[t5]=cc[t11]-cc[t12];
+ ch[t6]=cc[t11]+cc[t12];
+ t5+=ido;
+ t6+=ido;
+ t11+=t10;
+ t12+=t10;
+ }
}
+ }
L116:
- ar1 = 1.f;
- ai1 = 0.f;
- t1 = 0;
- t9 = (t2 = ipp2 * idl1);
- t3 = (ip - 1) * idl1;
- for(l = 1; l < ipph; l++)
- {
- t1 += idl1;
- t2 -= idl1;
-
- ar1h = dcp * ar1 - dsp * ai1;
- ai1 = dcp * ai1 + dsp * ar1;
- ar1 = ar1h;
- t4 = t1;
- t5 = t2;
- t6 = 0;
- t7 = idl1;
- t8 = t3;
- for(ik = 0; ik < idl1; ik++)
- {
- c2[t4++] = ch2[t6++] + ar1 * ch2[t7++];
- c2[t5++] = ai1 * ch2[t8++];
- }
- dc2 = ar1;
- ds2 = ai1;
- ar2 = ar1;
- ai2 = ai1;
-
- t6 = idl1;
- t7 = t9 - idl1;
- for(j = 2; j < ipph; j++)
- {
- t6 += idl1;
- t7 -= idl1;
- ar2h = dc2 * ar2 - ds2 * ai2;
- ai2 = dc2 * ai2 + ds2 * ar2;
- ar2 = ar2h;
- t4 = t1;
- t5 = t2;
- t11 = t6;
- t12 = t7;
- for(ik = 0; ik < idl1; ik++)
- {
- c2[t4++] += ar2 * ch2[t11++];
- c2[t5++] += ai2 * ch2[t12++];
- }
- }
+ ar1=1.f;
+ ai1=0.f;
+ t1=0;
+ t9=(t2=ipp2*idl1);
+ t3=(ip-1)*idl1;
+ for(l=1;l<ipph;l++){
+ t1+=idl1;
+ t2-=idl1;
+
+ ar1h=dcp*ar1-dsp*ai1;
+ ai1=dcp*ai1+dsp*ar1;
+ ar1=ar1h;
+ t4=t1;
+ t5=t2;
+ t6=0;
+ t7=idl1;
+ t8=t3;
+ for(ik=0;ik<idl1;ik++){
+ c2[t4++]=ch2[t6++]+ar1*ch2[t7++];
+ c2[t5++]=ai1*ch2[t8++];
}
-
- t1 = 0;
- for(j = 1; j < ipph; j++)
- {
- t1 += idl1;
- t2 = t1;
- for(ik = 0; ik < idl1; ik++)ch2[ik] += ch2[t2++];
+ dc2=ar1;
+ ds2=ai1;
+ ar2=ar1;
+ ai2=ai1;
+
+ t6=idl1;
+ t7=t9-idl1;
+ for(j=2;j<ipph;j++){
+ t6+=idl1;
+ t7-=idl1;
+ ar2h=dc2*ar2-ds2*ai2;
+ ai2=dc2*ai2+ds2*ar2;
+ ar2=ar2h;
+ t4=t1;
+ t5=t2;
+ t11=t6;
+ t12=t7;
+ for(ik=0;ik<idl1;ik++){
+ c2[t4++]+=ar2*ch2[t11++];
+ c2[t5++]+=ai2*ch2[t12++];
+ }
}
-
- t1 = 0;
- t2 = ipp2 * t0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- for(k = 0; k < l1; k++)
- {
- ch[t3] = c1[t3] - c1[t4];
- ch[t4] = c1[t3] + c1[t4];
- t3 += ido;
- t4 += ido;
- }
+ }
+
+ t1=0;
+ for(j=1;j<ipph;j++){
+ t1+=idl1;
+ t2=t1;
+ for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++];
+ }
+
+ t1=0;
+ t2=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(k=0;k<l1;k++){
+ ch[t3]=c1[t3]-c1[t4];
+ ch[t4]=c1[t3]+c1[t4];
+ t3+=ido;
+ t4+=ido;
}
-
- if(ido == 1)goto L132;
- if(nbd < l1)goto L128;
-
- t1 = 0;
- t2 = ipp2 * t0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- for(k = 0; k < l1; k++)
- {
- t5 = t3;
- t6 = t4;
- for(i = 2; i < ido; i += 2)
- {
- t5 += 2;
- t6 += 2;
- ch[t5-1] = c1[t5-1] - c1[t6];
- ch[t6-1] = c1[t5-1] + c1[t6];
- ch[t5] = c1[t5] + c1[t6-1];
- ch[t6] = c1[t5] - c1[t6-1];
- }
- t3 += ido;
- t4 += ido;
- }
+ }
+
+ if(ido==1)goto L132;
+ if(nbd<l1)goto L128;
+
+ t1=0;
+ t2=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(k=0;k<l1;k++){
+ t5=t3;
+ t6=t4;
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6+=2;
+ ch[t5-1]=c1[t5-1]-c1[t6];
+ ch[t6-1]=c1[t5-1]+c1[t6];
+ ch[t5]=c1[t5]+c1[t6-1];
+ ch[t6]=c1[t5]-c1[t6-1];
+ }
+ t3+=ido;
+ t4+=ido;
}
- goto L132;
-
-L128:
- t1 = 0;
- t2 = ipp2 * t0;
- for(j = 1; j < ipph; j++)
- {
- t1 += t0;
- t2 -= t0;
- t3 = t1;
- t4 = t2;
- for(i = 2; i < ido; i += 2)
- {
- t3 += 2;
- t4 += 2;
- t5 = t3;
- t6 = t4;
- for(k = 0; k < l1; k++)
- {
- ch[t5-1] = c1[t5-1] - c1[t6];
- ch[t6-1] = c1[t5-1] + c1[t6];
- ch[t5] = c1[t5] + c1[t6-1];
- ch[t6] = c1[t5] - c1[t6-1];
- t5 += ido;
- t6 += ido;
- }
- }
+ }
+ goto L132;
+
+ L128:
+ t1=0;
+ t2=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t5=t3;
+ t6=t4;
+ for(k=0;k<l1;k++){
+ ch[t5-1]=c1[t5-1]-c1[t6];
+ ch[t6-1]=c1[t5-1]+c1[t6];
+ ch[t5]=c1[t5]+c1[t6-1];
+ ch[t6]=c1[t5]-c1[t6-1];
+ t5+=ido;
+ t6+=ido;
+ }
}
+ }
L132:
- if(ido == 1)return;
-
- for(ik = 0; ik < idl1; ik++)c2[ik] = ch2[ik];
-
- t1 = 0;
- for(j = 1; j < ip; j++)
- {
- t2 = (t1 += t0);
- for(k = 0; k < l1; k++)
- {
- c1[t2] = ch[t2];
- t2 += ido;
- }
- }
+ if(ido==1)return;
- if(nbd > l1)goto L139;
-
- is = -ido - 1;
- t1 = 0;
- for(j = 1; j < ip; j++)
- {
- is += ido;
- t1 += t0;
- idij = is;
- t2 = t1;
- for(i = 2; i < ido; i += 2)
- {
- t2 += 2;
- idij += 2;
- t3 = t2;
- for(k = 0; k < l1; k++)
- {
- c1[t3-1] = wa[idij-1] * ch[t3-1] - wa[idij] * ch[t3];
- c1[t3] = wa[idij-1] * ch[t3] + wa[idij] * ch[t3-1];
- t3 += ido;
- }
- }
+ for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+
+ t1=0;
+ for(j=1;j<ip;j++){
+ t2=(t1+=t0);
+ for(k=0;k<l1;k++){
+ c1[t2]=ch[t2];
+ t2+=ido;
}
- return;
-
-L139:
- is = -ido - 1;
- t1 = 0;
- for(j = 1; j < ip; j++)
- {
- is += ido;
- t1 += t0;
- t2 = t1;
- for(k = 0; k < l1; k++)
- {
- idij = is;
- t3 = t2;
- for(i = 2; i < ido; i += 2)
- {
- idij += 2;
- t3 += 2;
- c1[t3-1] = wa[idij-1] * ch[t3-1] - wa[idij] * ch[t3];
- c1[t3] = wa[idij-1] * ch[t3] + wa[idij] * ch[t3-1];
- }
- t2 += ido;
- }
+ }
+
+ if(nbd>l1)goto L139;
+
+ is= -ido-1;
+ t1=0;
+ for(j=1;j<ip;j++){
+ is+=ido;
+ t1+=t0;
+ idij=is;
+ t2=t1;
+ for(i=2;i<ido;i+=2){
+ t2+=2;
+ idij+=2;
+ t3=t2;
+ for(k=0;k<l1;k++){
+ c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
+ c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
+ t3+=ido;
+ }
+ }
+ }
+ return;
+
+ L139:
+ is= -ido-1;
+ t1=0;
+ for(j=1;j<ip;j++){
+ is+=ido;
+ t1+=t0;
+ t2=t1;
+ for(k=0;k<l1;k++){
+ idij=is;
+ t3=t2;
+ for(i=2;i<ido;i+=2){
+ idij+=2;
+ t3+=2;
+ c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
+ c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
+ }
+ t2+=ido;
}
+ }
}
-static void drftb1(int n, float *c, float *ch, float *wa, int *ifac)
-{
- int i, k1, l1, l2;
- int na;
- int nf, ip, iw, ix2, ix3, ido, idl1;
-
- nf = ifac[1];
- na = 0;
- l1 = 1;
- iw = 1;
-
- for(k1 = 0; k1 < nf; k1++)
- {
- ip = ifac[k1 + 2];
- l2 = ip * l1;
- ido = n / l2;
- idl1 = ido * l1;
- if(ip != 4)goto L103;
- ix2 = iw + ido;
- ix3 = ix2 + ido;
-
- if(na != 0)
- dradb4(ido, l1, ch, c, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
- else
- dradb4(ido, l1, c, ch, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
- na = 1 - na;
- goto L115;
-
-L103:
- if(ip != 2)goto L106;
-
- if(na != 0)
- dradb2(ido, l1, ch, c, wa + iw - 1);
- else
- dradb2(ido, l1, c, ch, wa + iw - 1);
- na = 1 - na;
- goto L115;
-
-L106:
- if(ip != 3)goto L109;
-
- ix2 = iw + ido;
- if(na != 0)
- dradb3(ido, l1, ch, c, wa + iw - 1, wa + ix2 - 1);
- else
- dradb3(ido, l1, c, ch, wa + iw - 1, wa + ix2 - 1);
- na = 1 - na;
- goto L115;
-
-L109:
- /* The radix five case can be translated later..... */
- /* if(ip!=5)goto L112;
-
- ix2=iw+ido;
- ix3=ix2+ido;
- ix4=ix3+ido;
- if(na!=0)
- dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
- else
- dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
- na=1-na;
- goto L115;
-
- L112:*/
- if(na != 0)
- dradbg(ido, ip, l1, idl1, ch, ch, ch, c, c, wa + iw - 1);
- else
- dradbg(ido, ip, l1, idl1, c, c, c, ch, ch, wa + iw - 1);
- if(ido == 1)na = 1 - na;
-
-L115:
- l1 = l2;
- iw += (ip - 1) * ido;
- }
+static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){
+ int i,k1,l1,l2;
+ int na;
+ int nf,ip,iw,ix2,ix3,ido,idl1;
+
+ nf=ifac[1];
+ na=0;
+ l1=1;
+ iw=1;
+
+ for(k1=0;k1<nf;k1++){
+ ip=ifac[k1 + 2];
+ l2=ip*l1;
+ ido=n/l2;
+ idl1=ido*l1;
+ if(ip!=4)goto L103;
+ ix2=iw+ido;
+ ix3=ix2+ido;
+
+ if(na!=0)
+ dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ else
+ dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ na=1-na;
+ goto L115;
- if(na == 0)return;
+ L103:
+ if(ip!=2)goto L106;
- for(i = 0; i < n; i++)c[i] = ch[i];
+ if(na!=0)
+ dradb2(ido,l1,ch,c,wa+iw-1);
+ else
+ dradb2(ido,l1,c,ch,wa+iw-1);
+ na=1-na;
+ goto L115;
+
+ L106:
+ if(ip!=3)goto L109;
+
+ ix2=iw+ido;
+ if(na!=0)
+ dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1);
+ else
+ dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1);
+ na=1-na;
+ goto L115;
+
+ L109:
+/* The radix five case can be translated later..... */
+/* if(ip!=5)goto L112;
+
+ ix2=iw+ido;
+ ix3=ix2+ido;
+ ix4=ix3+ido;
+ if(na!=0)
+ dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
+ else
+ dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
+ na=1-na;
+ goto L115;
+
+ L112:*/
+ if(na!=0)
+ dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
+ else
+ dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
+ if(ido==1)na=1-na;
+
+ L115:
+ l1=l2;
+ iw+=(ip-1)*ido;
+ }
+
+ if(na==0)return;
+
+ for(i=0;i<n;i++)c[i]=ch[i];
}
-void drft_forward(drft_lookup *l, float *data)
-{
- if(l->n == 1)return;
- drftf1(l->n, data, l->trigcache, l->trigcache + l->n, l->splitcache);
+void drft_forward(drft_lookup *l,float *data){
+ if(l->n==1)return;
+ drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
}
-void drft_backward(drft_lookup *l, float *data)
-{
- if(l->n == 1)return;
- drftb1(l->n, data, l->trigcache, l->trigcache + l->n, l->splitcache);
+void drft_backward(drft_lookup *l,float *data){
+ if (l->n==1)return;
+ drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
}
-void drft_init(drft_lookup *l, int n)
-{
- l->n = n;
- l->trigcache = _ogg_calloc(3 * n, sizeof(*l->trigcache));
- l->splitcache = _ogg_calloc(32, sizeof(*l->splitcache));
- fdrffti(n, l->trigcache, l->splitcache);
+void drft_init(drft_lookup *l,int n){
+ l->n=n;
+ l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache));
+ l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache));
+ fdrffti(n, l->trigcache, l->splitcache);
}
-void drft_clear(drft_lookup *l)
-{
- if(l)
- {
- if(l->trigcache)_ogg_free(l->trigcache);
- if(l->splitcache)_ogg_free(l->splitcache);
- memset(l, 0, sizeof(*l));
- }
+void drft_clear(drft_lookup *l){
+ if(l){
+ if(l->trigcache)_ogg_free(l->trigcache);
+ if(l->splitcache)_ogg_free(l->splitcache);
+ memset(l,0,sizeof(*l));
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.h b/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.h
index d200ad9de..456497326 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/smallft.h
@@ -20,16 +20,15 @@
#include "vorbis/codec.h"
-typedef struct
-{
- int n;
- float *trigcache;
- int *splitcache;
+typedef struct {
+ int n;
+ float *trigcache;
+ int *splitcache;
} drft_lookup;
-extern void drft_forward(drft_lookup *l, float *data);
-extern void drft_backward(drft_lookup *l, float *data);
-extern void drft_init(drft_lookup *l, int n);
+extern void drft_forward(drft_lookup *l,float *data);
+extern void drft_backward(drft_lookup *l,float *data);
+extern void drft_init(drft_lookup *l,int n);
extern void drft_clear(drft_lookup *l);
#endif
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/synthesis.c b/src/filters/transform/MpaDecFilter/libvorbisidec/synthesis.c
index b8ae74eee..7a0c74804 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/synthesis.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/synthesis.c
@@ -23,161 +23,146 @@
#include "misc.h"
#include "os.h"
-int vorbis_synthesis(vorbis_block *vb, ogg_packet *op)
-{
- vorbis_dsp_state *vd = vb->vd;
- private_state *b = vd->backend_state;
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- oggpack_buffer *opb = &vb->opb;
- int type, mode, i;
-
- /* first things first. Make sure decode is ready */
- _vorbis_block_ripcord(vb);
- oggpack_readinit(opb, op->packet, op->bytes);
-
- /* Check the packet type */
- if(oggpack_read(opb, 1) != 0)
- {
- /* Oops. This is not an audio data packet */
- return(OV_ENOTAUDIO);
- }
-
- /* read our mode and pre/post windowsize */
- mode = oggpack_read(opb, b->modebits);
- if(mode == -1)return(OV_EBADPACKET);
-
- vb->mode = mode;
- vb->W = ci->mode_param[mode]->blockflag;
- if(vb->W)
- {
-
- /* this doesn;t get mapped through mode selection as it's used
- only for window selection */
- vb->lW = oggpack_read(opb, 1);
- vb->nW = oggpack_read(opb, 1);
- if(vb->nW == -1) return(OV_EBADPACKET);
- }
- else
- {
- vb->lW = 0;
- vb->nW = 0;
- }
-
- /* more setup */
- vb->granulepos = op->granulepos;
- vb->sequence = op->packetno;
- vb->eofflag = op->e_o_s;
-
- /* alloc pcm passback storage */
- vb->pcmend = ci->blocksizes[vb->W];
- vb->pcm = _vorbis_block_alloc(vb, sizeof(*vb->pcm) * vi->channels);
- for(i = 0; i < vi->channels; i++)
- vb->pcm[i] = _vorbis_block_alloc(vb, vb->pcmend * sizeof(*vb->pcm[i]));
-
- /* unpack_header enforces range checking */
- type = ci->map_type[ci->mode_param[mode]->mapping];
-
- return(_mapping_P[type]->inverse(vb, ci->map_param[ci->mode_param[mode]->
- mapping]));
+int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
+ vorbis_dsp_state *vd=vb->vd;
+ private_state *b=vd->backend_state;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ oggpack_buffer *opb=&vb->opb;
+ int type,mode,i;
+
+ /* first things first. Make sure decode is ready */
+ _vorbis_block_ripcord(vb);
+ oggpack_readinit(opb,op->packet,op->bytes);
+
+ /* Check the packet type */
+ if(oggpack_read(opb,1)!=0){
+ /* Oops. This is not an audio data packet */
+ return(OV_ENOTAUDIO);
+ }
+
+ /* read our mode and pre/post windowsize */
+ mode=oggpack_read(opb,b->modebits);
+ if(mode==-1)return(OV_EBADPACKET);
+
+ vb->mode=mode;
+ vb->W=ci->mode_param[mode]->blockflag;
+ if(vb->W){
+
+ /* this doesn;t get mapped through mode selection as it's used
+ only for window selection */
+ vb->lW=oggpack_read(opb,1);
+ vb->nW=oggpack_read(opb,1);
+ if(vb->nW==-1) return(OV_EBADPACKET);
+ }else{
+ vb->lW=0;
+ vb->nW=0;
+ }
+
+ /* more setup */
+ vb->granulepos=op->granulepos;
+ vb->sequence=op->packetno;
+ vb->eofflag=op->e_o_s;
+
+ /* alloc pcm passback storage */
+ vb->pcmend=ci->blocksizes[vb->W];
+ vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
+ for(i=0;i<vi->channels;i++)
+ vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
+
+ /* unpack_header enforces range checking */
+ type=ci->map_type[ci->mode_param[mode]->mapping];
+
+ return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]->
+ mapping]));
}
/* used to track pcm position without actually performing decode.
Useful for sequential 'fast forward' */
-int vorbis_synthesis_trackonly(vorbis_block *vb, ogg_packet *op)
-{
- vorbis_dsp_state *vd = vb->vd;
- private_state *b = vd->backend_state;
- vorbis_info *vi = vd->vi;
- codec_setup_info *ci = vi->codec_setup;
- oggpack_buffer *opb = &vb->opb;
- int mode;
-
- /* first things first. Make sure decode is ready */
- _vorbis_block_ripcord(vb);
- oggpack_readinit(opb, op->packet, op->bytes);
-
- /* Check the packet type */
- if(oggpack_read(opb, 1) != 0)
- {
- /* Oops. This is not an audio data packet */
- return(OV_ENOTAUDIO);
- }
-
- /* read our mode and pre/post windowsize */
- mode = oggpack_read(opb, b->modebits);
- if(mode == -1)return(OV_EBADPACKET);
-
- vb->mode = mode;
- vb->W = ci->mode_param[mode]->blockflag;
- if(vb->W)
- {
- vb->lW = oggpack_read(opb, 1);
- vb->nW = oggpack_read(opb, 1);
- if(vb->nW == -1) return(OV_EBADPACKET);
- }
- else
- {
- vb->lW = 0;
- vb->nW = 0;
- }
-
- /* more setup */
- vb->granulepos = op->granulepos;
- vb->sequence = op->packetno;
- vb->eofflag = op->e_o_s;
-
- /* no pcm */
- vb->pcmend = 0;
- vb->pcm = NULL;
-
- return(0);
+int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
+ vorbis_dsp_state *vd=vb->vd;
+ private_state *b=vd->backend_state;
+ vorbis_info *vi=vd->vi;
+ codec_setup_info *ci=vi->codec_setup;
+ oggpack_buffer *opb=&vb->opb;
+ int mode;
+
+ /* first things first. Make sure decode is ready */
+ _vorbis_block_ripcord(vb);
+ oggpack_readinit(opb,op->packet,op->bytes);
+
+ /* Check the packet type */
+ if(oggpack_read(opb,1)!=0){
+ /* Oops. This is not an audio data packet */
+ return(OV_ENOTAUDIO);
+ }
+
+ /* read our mode and pre/post windowsize */
+ mode=oggpack_read(opb,b->modebits);
+ if(mode==-1)return(OV_EBADPACKET);
+
+ vb->mode=mode;
+ vb->W=ci->mode_param[mode]->blockflag;
+ if(vb->W){
+ vb->lW=oggpack_read(opb,1);
+ vb->nW=oggpack_read(opb,1);
+ if(vb->nW==-1) return(OV_EBADPACKET);
+ }else{
+ vb->lW=0;
+ vb->nW=0;
+ }
+
+ /* more setup */
+ vb->granulepos=op->granulepos;
+ vb->sequence=op->packetno;
+ vb->eofflag=op->e_o_s;
+
+ /* no pcm */
+ vb->pcmend=0;
+ vb->pcm=NULL;
+
+ return(0);
}
-long vorbis_packet_blocksize(vorbis_info *vi, ogg_packet *op)
-{
- codec_setup_info *ci = vi->codec_setup;
- oggpack_buffer opb;
- int mode;
-
- oggpack_readinit(&opb, op->packet, op->bytes);
-
- /* Check the packet type */
- if(oggpack_read(&opb, 1) != 0)
- {
- /* Oops. This is not an audio data packet */
- return(OV_ENOTAUDIO);
+long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
+ codec_setup_info *ci=vi->codec_setup;
+ oggpack_buffer opb;
+ int mode;
+
+ oggpack_readinit(&opb,op->packet,op->bytes);
+
+ /* Check the packet type */
+ if(oggpack_read(&opb,1)!=0){
+ /* Oops. This is not an audio data packet */
+ return(OV_ENOTAUDIO);
+ }
+
+ {
+ int modebits=0;
+ int v=ci->modes;
+ while(v>1){
+ modebits++;
+ v>>=1;
}
- {
- int modebits = 0;
- int v = ci->modes;
- while(v > 1)
- {
- modebits++;
- v >>= 1;
- }
-
- /* read our mode and pre/post windowsize */
- mode = oggpack_read(&opb, modebits);
- }
- if(mode == -1)return(OV_EBADPACKET);
- return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
+ /* read our mode and pre/post windowsize */
+ mode=oggpack_read(&opb,modebits);
+ }
+ if(mode==-1)return(OV_EBADPACKET);
+ return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
}
-int vorbis_synthesis_halfrate(vorbis_info *vi, int flag)
-{
- /* set / clear half-sample-rate mode */
- codec_setup_info *ci = vi->codec_setup;
+int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){
+ /* set / clear half-sample-rate mode */
+ codec_setup_info *ci=vi->codec_setup;
- /* right now, our MDCT can't handle < 64 sample windows. */
- if(ci->blocksizes[0] <= 64 && flag)return -1;
- ci->halfrate_flag = (flag ? 1 : 0);
- return 0;
+ /* right now, our MDCT can't handle < 64 sample windows. */
+ if(ci->blocksizes[0]<=64 && flag)return -1;
+ ci->halfrate_flag=(flag?1:0);
+ return 0;
}
-int vorbis_synthesis_halfrate_p(vorbis_info *vi)
-{
- codec_setup_info *ci = vi->codec_setup;
- return ci->halfrate_flag;
+int vorbis_synthesis_halfrate_p(vorbis_info *vi){
+ codec_setup_info *ci=vi->codec_setup;
+ return ci->halfrate_flag;
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/vorbis/codec.h b/src/filters/transform/MpaDecFilter/libvorbisidec/vorbis/codec.h
index d2558f428..259798c61 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/vorbis/codec.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/vorbis/codec.h
@@ -25,204 +25,199 @@ extern "C"
#include <ogg/ogg.h>
- typedef struct vorbis_info
- {
- int version;
- int channels;
- long rate;
-
- /* The below bitrate declarations are *hints*.
- Combinations of the three values carry the following implications:
-
- all three set to the same value:
- implies a fixed rate bitstream
- only nominal set:
- implies a VBR stream that averages the nominal bitrate. No hard
- upper/lower limit
- upper and or lower set:
- implies a VBR bitstream that obeys the bitrate limits. nominal
- may also be set to give a nominal rate.
- none set:
- the coder does not care to speculate.
- */
-
- long bitrate_upper;
- long bitrate_nominal;
- long bitrate_lower;
- long bitrate_window;
-
- void *codec_setup;
- } vorbis_info;
-
- /* vorbis_dsp_state buffers the current vorbis audio
- analysis/synthesis state. The DSP state belongs to a specific
- logical bitstream ****************************************************/
- typedef struct vorbis_dsp_state
- {
- int analysisp;
- vorbis_info *vi;
-
- float **pcm;
- float **pcmret;
- int pcm_storage;
- int pcm_current;
- int pcm_returned;
-
- int preextrapolate;
- int eofflag;
-
- long lW;
- long W;
- long nW;
- long centerW;
-
- ogg_int64_t granulepos;
- ogg_int64_t sequence;
-
- ogg_int64_t glue_bits;
- ogg_int64_t time_bits;
- ogg_int64_t floor_bits;
- ogg_int64_t res_bits;
-
- void *backend_state;
- } vorbis_dsp_state;
-
- typedef struct vorbis_block
- {
- /* necessary stream state for linking to the framing abstraction */
- float **pcm; /* this is a pointer into local storage */
- oggpack_buffer opb;
-
- long lW;
- long W;
- long nW;
- int pcmend;
- int mode;
-
- int eofflag;
- ogg_int64_t granulepos;
- ogg_int64_t sequence;
- vorbis_dsp_state *vd; /* For read-only access of configuration */
-
- /* local storage to avoid remallocing; it's up to the mapping to
- structure it */
- void *localstore;
- long localtop;
- long localalloc;
- long totaluse;
- struct alloc_chain *reap;
-
- /* bitmetrics for the frame */
- long glue_bits;
- long time_bits;
- long floor_bits;
- long res_bits;
-
- void *internal;
-
- } vorbis_block;
-
- /* vorbis_block is a single block of data to be processed as part of
- the analysis/synthesis stream; it belongs to a specific logical
- bitstream, but is independant from other vorbis_blocks belonging to
- that logical bitstream. *************************************************/
-
- struct alloc_chain
- {
- void *ptr;
- struct alloc_chain *next;
- };
-
- /* vorbis_info contains all the setup information specific to the
- specific compression/decompression mode in progress (eg,
- psychoacoustic settings, channel setup, options, codebook
- etc). vorbis_info and substructures are in backends.h.
- *********************************************************************/
-
- /* the comments are not part of vorbis_info so that vorbis_info can be
- static storage */
- typedef struct vorbis_comment
- {
- /* unlimited user comment fields. libvorbis writes 'libvorbis'
- whatever vendor is set to in encode */
- char **user_comments;
- int *comment_lengths;
- int comments;
- char *vendor;
-
- } vorbis_comment;
-
-
- /* libvorbis encodes in two abstraction layers; first we perform DSP
- and produce a packet (see docs/analysis.txt). The packet is then
- coded into a framed OggSquish bitstream by the second layer (see
- docs/framing.txt). Decode is the reverse process; we sync/frame
- the bitstream and extract individual packets, then decode the
- packet back into PCM audio.
-
- The extra framing/packetizing is used in streaming formats, such as
- files. Over the net (such as with UDP), the framing and
- packetization aren't necessary as they're provided by the transport
- and the streaming layer is not used */
-
- /* Vorbis PRIMITIVES: general ***************************************/
-
- extern void vorbis_info_init(vorbis_info *vi);
- extern void vorbis_info_clear(vorbis_info *vi);
- extern int vorbis_info_blocksize(vorbis_info *vi, int zo);
- extern void vorbis_comment_init(vorbis_comment *vc);
- extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
- extern void vorbis_comment_add_tag(vorbis_comment *vc,
- const char *tag, const char *contents);
- extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
- extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
- extern void vorbis_comment_clear(vorbis_comment *vc);
-
- extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
- extern int vorbis_block_clear(vorbis_block *vb);
- extern void vorbis_dsp_clear(vorbis_dsp_state *v);
- extern double vorbis_granule_time(vorbis_dsp_state *v,
- ogg_int64_t granulepos);
-
- extern const char *vorbis_version_string(void);
-
- /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
-
- extern int vorbis_analysis_init(vorbis_dsp_state *v, vorbis_info *vi);
- extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
- extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
- vorbis_comment *vc,
- ogg_packet *op,
- ogg_packet *op_comm,
- ogg_packet *op_code);
- extern float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals);
- extern int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals);
- extern int vorbis_analysis_blockout(vorbis_dsp_state *v, vorbis_block *vb);
- extern int vorbis_analysis(vorbis_block *vb, ogg_packet *op);
-
- extern int vorbis_bitrate_addblock(vorbis_block *vb);
- extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
- ogg_packet *op);
-
- /* Vorbis PRIMITIVES: synthesis layer *******************************/
- extern int vorbis_synthesis_idheader(ogg_packet *op);
- extern int vorbis_synthesis_headerin(vorbis_info *vi, vorbis_comment *vc,
- ogg_packet *op);
-
- extern int vorbis_synthesis_init(vorbis_dsp_state *v, vorbis_info *vi);
- extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
- extern int vorbis_synthesis(vorbis_block *vb, ogg_packet *op);
- extern int vorbis_synthesis_trackonly(vorbis_block *vb, ogg_packet *op);
- extern int vorbis_synthesis_blockin(vorbis_dsp_state *v, vorbis_block *vb);
- extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v, float ***pcm);
- extern int vorbis_synthesis_lapout(vorbis_dsp_state *v, float ***pcm);
- extern int vorbis_synthesis_read(vorbis_dsp_state *v, int samples);
- extern long vorbis_packet_blocksize(vorbis_info *vi, ogg_packet *op);
-
- extern int vorbis_synthesis_halfrate(vorbis_info *v, int flag);
- extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
-
- /* Vorbis ERRORS and return codes ***********************************/
+typedef struct vorbis_info{
+ int version;
+ int channels;
+ long rate;
+
+ /* The below bitrate declarations are *hints*.
+ Combinations of the three values carry the following implications:
+
+ all three set to the same value:
+ implies a fixed rate bitstream
+ only nominal set:
+ implies a VBR stream that averages the nominal bitrate. No hard
+ upper/lower limit
+ upper and or lower set:
+ implies a VBR bitstream that obeys the bitrate limits. nominal
+ may also be set to give a nominal rate.
+ none set:
+ the coder does not care to speculate.
+ */
+
+ long bitrate_upper;
+ long bitrate_nominal;
+ long bitrate_lower;
+ long bitrate_window;
+
+ void *codec_setup;
+} vorbis_info;
+
+/* vorbis_dsp_state buffers the current vorbis audio
+ analysis/synthesis state. The DSP state belongs to a specific
+ logical bitstream ****************************************************/
+typedef struct vorbis_dsp_state{
+ int analysisp;
+ vorbis_info *vi;
+
+ float **pcm;
+ float **pcmret;
+ int pcm_storage;
+ int pcm_current;
+ int pcm_returned;
+
+ int preextrapolate;
+ int eofflag;
+
+ long lW;
+ long W;
+ long nW;
+ long centerW;
+
+ ogg_int64_t granulepos;
+ ogg_int64_t sequence;
+
+ ogg_int64_t glue_bits;
+ ogg_int64_t time_bits;
+ ogg_int64_t floor_bits;
+ ogg_int64_t res_bits;
+
+ void *backend_state;
+} vorbis_dsp_state;
+
+typedef struct vorbis_block{
+ /* necessary stream state for linking to the framing abstraction */
+ float **pcm; /* this is a pointer into local storage */
+ oggpack_buffer opb;
+
+ long lW;
+ long W;
+ long nW;
+ int pcmend;
+ int mode;
+
+ int eofflag;
+ ogg_int64_t granulepos;
+ ogg_int64_t sequence;
+ vorbis_dsp_state *vd; /* For read-only access of configuration */
+
+ /* local storage to avoid remallocing; it's up to the mapping to
+ structure it */
+ void *localstore;
+ long localtop;
+ long localalloc;
+ long totaluse;
+ struct alloc_chain *reap;
+
+ /* bitmetrics for the frame */
+ long glue_bits;
+ long time_bits;
+ long floor_bits;
+ long res_bits;
+
+ void *internal;
+
+} vorbis_block;
+
+/* vorbis_block is a single block of data to be processed as part of
+the analysis/synthesis stream; it belongs to a specific logical
+bitstream, but is independant from other vorbis_blocks belonging to
+that logical bitstream. *************************************************/
+
+struct alloc_chain{
+ void *ptr;
+ struct alloc_chain *next;
+};
+
+/* vorbis_info contains all the setup information specific to the
+ specific compression/decompression mode in progress (eg,
+ psychoacoustic settings, channel setup, options, codebook
+ etc). vorbis_info and substructures are in backends.h.
+*********************************************************************/
+
+/* the comments are not part of vorbis_info so that vorbis_info can be
+ static storage */
+typedef struct vorbis_comment{
+ /* unlimited user comment fields. libvorbis writes 'libvorbis'
+ whatever vendor is set to in encode */
+ char **user_comments;
+ int *comment_lengths;
+ int comments;
+ char *vendor;
+
+} vorbis_comment;
+
+
+/* libvorbis encodes in two abstraction layers; first we perform DSP
+ and produce a packet (see docs/analysis.txt). The packet is then
+ coded into a framed OggSquish bitstream by the second layer (see
+ docs/framing.txt). Decode is the reverse process; we sync/frame
+ the bitstream and extract individual packets, then decode the
+ packet back into PCM audio.
+
+ The extra framing/packetizing is used in streaming formats, such as
+ files. Over the net (such as with UDP), the framing and
+ packetization aren't necessary as they're provided by the transport
+ and the streaming layer is not used */
+
+/* Vorbis PRIMITIVES: general ***************************************/
+
+extern void vorbis_info_init(vorbis_info *vi);
+extern void vorbis_info_clear(vorbis_info *vi);
+extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
+extern void vorbis_comment_init(vorbis_comment *vc);
+extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
+extern void vorbis_comment_add_tag(vorbis_comment *vc,
+ const char *tag, const char *contents);
+extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
+extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
+extern void vorbis_comment_clear(vorbis_comment *vc);
+
+extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
+extern int vorbis_block_clear(vorbis_block *vb);
+extern void vorbis_dsp_clear(vorbis_dsp_state *v);
+extern double vorbis_granule_time(vorbis_dsp_state *v,
+ ogg_int64_t granulepos);
+
+extern const char *vorbis_version_string(void);
+
+/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
+
+extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
+extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
+extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
+ vorbis_comment *vc,
+ ogg_packet *op,
+ ogg_packet *op_comm,
+ ogg_packet *op_code);
+extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
+extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
+extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
+extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
+
+extern int vorbis_bitrate_addblock(vorbis_block *vb);
+extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
+ ogg_packet *op);
+
+/* Vorbis PRIMITIVES: synthesis layer *******************************/
+extern int vorbis_synthesis_idheader(ogg_packet *op);
+extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
+ ogg_packet *op);
+
+extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
+extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
+extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
+extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
+extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
+extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
+extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
+extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
+extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
+
+extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
+extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
+
+/* Vorbis ERRORS and return codes ***********************************/
#define OV_FALSE -1
#define OV_EOF -2
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/window.c b/src/filters/transform/MpaDecFilter/libvorbisidec/window.c
index cc016eb6e..efebbfa8a 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/window.c
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/window.c
@@ -20,2127 +20,2116 @@
#include "os.h"
#include "misc.h"
-static const float vwin64[32] =
-{
- 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F,
- 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F,
- 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F,
- 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F,
- 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F,
- 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F,
- 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F,
- 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F,
+static const float vwin64[32] = {
+ 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F,
+ 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F,
+ 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F,
+ 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F,
+ 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F,
+ 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F,
+ 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F,
+ 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F,
};
-static const float vwin128[64] =
-{
- 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F,
- 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F,
- 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F,
- 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F,
- 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F,
- 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F,
- 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F,
- 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F,
- 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F,
- 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F,
- 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F,
- 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F,
- 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F,
- 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F,
- 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F,
- 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F,
+static const float vwin128[64] = {
+ 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F,
+ 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F,
+ 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F,
+ 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F,
+ 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F,
+ 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F,
+ 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F,
+ 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F,
+ 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F,
+ 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F,
+ 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F,
+ 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F,
+ 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F,
+ 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F,
+ 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F,
+ 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F,
};
-static const float vwin256[128] =
-{
- 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F,
- 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F,
- 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F,
- 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F,
- 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F,
- 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F,
- 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F,
- 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F,
- 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F,
- 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F,
- 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F,
- 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F,
- 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F,
- 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F,
- 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F,
- 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F,
- 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F,
- 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F,
- 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F,
- 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F,
- 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F,
- 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F,
- 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F,
- 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F,
- 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F,
- 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F,
- 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F,
- 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F,
- 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F,
- 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F,
- 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F,
- 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F,
+static const float vwin256[128] = {
+ 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F,
+ 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F,
+ 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F,
+ 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F,
+ 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F,
+ 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F,
+ 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F,
+ 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F,
+ 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F,
+ 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F,
+ 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F,
+ 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F,
+ 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F,
+ 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F,
+ 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F,
+ 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F,
+ 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F,
+ 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F,
+ 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F,
+ 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F,
+ 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F,
+ 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F,
+ 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F,
+ 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F,
+ 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F,
+ 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F,
+ 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F,
+ 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F,
+ 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F,
+ 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F,
+ 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F,
+ 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F,
};
-static const float vwin512[256] =
-{
- 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F,
- 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F,
- 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F,
- 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F,
- 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F,
- 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F,
- 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F,
- 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F,
- 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F,
- 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F,
- 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F,
- 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F,
- 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F,
- 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F,
- 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F,
- 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F,
- 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F,
- 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F,
- 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F,
- 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F,
- 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F,
- 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F,
- 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F,
- 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F,
- 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F,
- 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F,
- 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F,
- 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F,
- 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F,
- 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F,
- 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F,
- 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F,
- 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F,
- 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F,
- 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F,
- 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F,
- 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F,
- 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F,
- 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F,
- 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F,
- 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F,
- 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F,
- 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F,
- 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F,
- 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F,
- 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F,
- 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F,
- 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F,
- 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F,
- 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F,
- 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F,
- 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F,
- 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F,
- 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F,
- 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F,
- 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F,
- 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F,
- 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F,
- 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F,
- 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F,
- 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F,
- 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F,
- 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F,
- 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F,
+static const float vwin512[256] = {
+ 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F,
+ 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F,
+ 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F,
+ 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F,
+ 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F,
+ 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F,
+ 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F,
+ 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F,
+ 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F,
+ 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F,
+ 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F,
+ 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F,
+ 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F,
+ 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F,
+ 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F,
+ 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F,
+ 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F,
+ 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F,
+ 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F,
+ 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F,
+ 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F,
+ 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F,
+ 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F,
+ 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F,
+ 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F,
+ 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F,
+ 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F,
+ 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F,
+ 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F,
+ 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F,
+ 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F,
+ 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F,
+ 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F,
+ 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F,
+ 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F,
+ 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F,
+ 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F,
+ 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F,
+ 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F,
+ 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F,
+ 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F,
+ 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F,
+ 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F,
+ 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F,
+ 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F,
+ 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F,
+ 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F,
+ 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F,
+ 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F,
+ 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F,
+ 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F,
+ 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F,
+ 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F,
+ 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F,
+ 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F,
+ 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F,
+ 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F,
+ 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F,
+ 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F,
+ 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F,
+ 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F,
+ 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F,
+ 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F,
+ 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F,
};
-static const float vwin1024[512] =
-{
- 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F,
- 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F,
- 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F,
- 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F,
- 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F,
- 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F,
- 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F,
- 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F,
- 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F,
- 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F,
- 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F,
- 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F,
- 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F,
- 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F,
- 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F,
- 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F,
- 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F,
- 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F,
- 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F,
- 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F,
- 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F,
- 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F,
- 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F,
- 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F,
- 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F,
- 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F,
- 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F,
- 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F,
- 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F,
- 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F,
- 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F,
- 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F,
- 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F,
- 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F,
- 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F,
- 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F,
- 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F,
- 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F,
- 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F,
- 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F,
- 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F,
- 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F,
- 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F,
- 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F,
- 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F,
- 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F,
- 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F,
- 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F,
- 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F,
- 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F,
- 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F,
- 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F,
- 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F,
- 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F,
- 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F,
- 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F,
- 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F,
- 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F,
- 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F,
- 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F,
- 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F,
- 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F,
- 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F,
- 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F,
- 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F,
- 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F,
- 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F,
- 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F,
- 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F,
- 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F,
- 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F,
- 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F,
- 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F,
- 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F,
- 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F,
- 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F,
- 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F,
- 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F,
- 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F,
- 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F,
- 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F,
- 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F,
- 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F,
- 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F,
- 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F,
- 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F,
- 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F,
- 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F,
- 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F,
- 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F,
- 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F,
- 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F,
- 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F,
- 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F,
- 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F,
- 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F,
- 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F,
- 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F,
- 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F,
- 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F,
- 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F,
- 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F,
- 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F,
- 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F,
- 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F,
- 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F,
- 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F,
- 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F,
- 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F,
- 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F,
- 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F,
- 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F,
- 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F,
- 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F,
- 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F,
- 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F,
- 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F,
- 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F,
- 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F,
- 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F,
- 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F,
- 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F,
- 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F,
- 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F,
- 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F,
- 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F,
- 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F,
- 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F,
+static const float vwin1024[512] = {
+ 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F,
+ 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F,
+ 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F,
+ 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F,
+ 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F,
+ 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F,
+ 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F,
+ 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F,
+ 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F,
+ 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F,
+ 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F,
+ 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F,
+ 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F,
+ 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F,
+ 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F,
+ 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F,
+ 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F,
+ 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F,
+ 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F,
+ 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F,
+ 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F,
+ 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F,
+ 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F,
+ 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F,
+ 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F,
+ 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F,
+ 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F,
+ 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F,
+ 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F,
+ 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F,
+ 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F,
+ 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F,
+ 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F,
+ 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F,
+ 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F,
+ 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F,
+ 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F,
+ 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F,
+ 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F,
+ 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F,
+ 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F,
+ 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F,
+ 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F,
+ 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F,
+ 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F,
+ 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F,
+ 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F,
+ 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F,
+ 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F,
+ 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F,
+ 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F,
+ 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F,
+ 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F,
+ 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F,
+ 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F,
+ 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F,
+ 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F,
+ 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F,
+ 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F,
+ 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F,
+ 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F,
+ 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F,
+ 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F,
+ 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F,
+ 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F,
+ 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F,
+ 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F,
+ 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F,
+ 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F,
+ 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F,
+ 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F,
+ 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F,
+ 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F,
+ 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F,
+ 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F,
+ 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F,
+ 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F,
+ 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F,
+ 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F,
+ 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F,
+ 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F,
+ 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F,
+ 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F,
+ 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F,
+ 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F,
+ 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F,
+ 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F,
+ 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F,
+ 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F,
+ 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F,
+ 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F,
+ 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F,
+ 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F,
+ 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F,
+ 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F,
+ 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F,
+ 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F,
+ 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F,
+ 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F,
+ 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F,
+ 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F,
+ 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F,
+ 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F,
+ 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F,
+ 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F,
+ 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F,
+ 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F,
+ 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F,
+ 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F,
+ 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F,
+ 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F,
+ 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F,
+ 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F,
+ 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F,
+ 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F,
+ 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F,
+ 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F,
+ 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F,
+ 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F,
+ 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F,
+ 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F,
+ 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F,
+ 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F,
+ 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F,
+ 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F,
+ 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F,
+ 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F,
+ 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F,
};
-static const float vwin2048[1024] =
-{
- 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F,
- 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F,
- 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F,
- 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F,
- 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F,
- 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F,
- 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F,
- 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F,
- 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F,
- 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F,
- 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F,
- 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F,
- 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F,
- 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F,
- 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F,
- 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F,
- 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F,
- 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F,
- 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F,
- 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F,
- 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F,
- 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F,
- 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F,
- 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F,
- 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F,
- 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F,
- 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F,
- 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F,
- 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F,
- 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F,
- 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F,
- 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F,
- 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F,
- 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F,
- 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F,
- 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F,
- 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F,
- 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F,
- 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F,
- 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F,
- 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F,
- 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F,
- 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F,
- 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F,
- 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F,
- 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F,
- 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F,
- 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F,
- 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F,
- 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F,
- 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F,
- 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F,
- 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F,
- 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F,
- 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F,
- 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F,
- 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F,
- 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F,
- 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F,
- 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F,
- 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F,
- 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F,
- 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F,
- 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F,
- 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F,
- 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F,
- 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F,
- 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F,
- 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F,
- 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F,
- 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F,
- 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F,
- 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F,
- 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F,
- 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F,
- 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F,
- 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F,
- 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F,
- 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F,
- 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F,
- 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F,
- 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F,
- 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F,
- 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F,
- 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F,
- 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F,
- 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F,
- 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F,
- 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F,
- 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F,
- 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F,
- 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F,
- 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F,
- 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F,
- 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F,
- 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F,
- 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F,
- 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F,
- 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F,
- 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F,
- 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F,
- 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F,
- 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F,
- 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F,
- 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F,
- 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F,
- 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F,
- 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F,
- 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F,
- 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F,
- 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F,
- 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F,
- 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F,
- 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F,
- 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F,
- 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F,
- 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F,
- 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F,
- 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F,
- 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F,
- 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F,
- 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F,
- 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F,
- 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F,
- 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F,
- 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F,
- 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F,
- 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F,
- 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F,
- 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F,
- 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F,
- 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F,
- 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F,
- 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F,
- 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F,
- 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F,
- 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F,
- 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F,
- 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F,
- 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F,
- 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F,
- 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F,
- 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F,
- 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F,
- 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F,
- 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F,
- 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F,
- 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F,
- 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F,
- 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F,
- 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F,
- 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F,
- 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F,
- 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F,
- 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F,
- 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F,
- 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F,
- 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F,
- 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F,
- 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F,
- 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F,
- 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F,
- 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F,
- 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F,
- 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F,
- 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F,
- 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F,
- 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F,
- 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F,
- 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F,
- 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F,
- 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F,
- 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F,
- 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F,
- 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F,
- 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F,
- 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F,
- 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F,
- 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F,
- 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F,
- 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F,
- 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F,
- 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F,
- 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F,
- 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F,
- 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F,
- 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F,
- 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F,
- 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F,
- 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F,
- 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F,
- 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F,
- 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F,
- 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F,
- 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F,
- 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F,
- 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F,
- 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F,
- 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F,
- 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F,
- 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F,
- 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F,
- 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F,
- 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F,
- 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F,
- 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F,
- 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F,
- 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F,
- 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F,
- 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F,
- 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F,
- 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F,
- 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F,
- 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F,
- 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F,
- 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F,
- 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F,
- 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F,
- 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F,
- 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F,
- 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F,
- 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F,
- 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F,
- 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F,
- 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F,
- 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F,
- 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F,
- 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F,
- 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F,
- 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F,
- 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F,
- 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F,
- 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F,
- 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F,
- 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F,
- 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F,
- 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F,
- 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F,
- 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F,
- 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F,
- 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F,
- 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F,
- 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F,
- 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F,
- 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F,
- 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F,
- 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F,
- 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F,
- 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F,
- 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F,
- 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F,
- 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F,
- 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F,
- 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F,
- 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F,
- 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F,
+static const float vwin2048[1024] = {
+ 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F,
+ 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F,
+ 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F,
+ 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F,
+ 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F,
+ 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F,
+ 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F,
+ 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F,
+ 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F,
+ 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F,
+ 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F,
+ 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F,
+ 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F,
+ 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F,
+ 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F,
+ 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F,
+ 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F,
+ 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F,
+ 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F,
+ 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F,
+ 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F,
+ 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F,
+ 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F,
+ 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F,
+ 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F,
+ 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F,
+ 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F,
+ 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F,
+ 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F,
+ 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F,
+ 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F,
+ 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F,
+ 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F,
+ 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F,
+ 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F,
+ 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F,
+ 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F,
+ 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F,
+ 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F,
+ 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F,
+ 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F,
+ 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F,
+ 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F,
+ 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F,
+ 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F,
+ 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F,
+ 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F,
+ 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F,
+ 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F,
+ 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F,
+ 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F,
+ 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F,
+ 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F,
+ 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F,
+ 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F,
+ 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F,
+ 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F,
+ 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F,
+ 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F,
+ 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F,
+ 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F,
+ 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F,
+ 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F,
+ 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F,
+ 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F,
+ 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F,
+ 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F,
+ 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F,
+ 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F,
+ 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F,
+ 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F,
+ 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F,
+ 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F,
+ 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F,
+ 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F,
+ 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F,
+ 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F,
+ 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F,
+ 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F,
+ 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F,
+ 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F,
+ 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F,
+ 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F,
+ 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F,
+ 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F,
+ 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F,
+ 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F,
+ 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F,
+ 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F,
+ 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F,
+ 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F,
+ 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F,
+ 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F,
+ 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F,
+ 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F,
+ 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F,
+ 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F,
+ 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F,
+ 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F,
+ 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F,
+ 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F,
+ 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F,
+ 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F,
+ 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F,
+ 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F,
+ 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F,
+ 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F,
+ 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F,
+ 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F,
+ 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F,
+ 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F,
+ 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F,
+ 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F,
+ 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F,
+ 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F,
+ 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F,
+ 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F,
+ 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F,
+ 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F,
+ 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F,
+ 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F,
+ 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F,
+ 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F,
+ 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F,
+ 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F,
+ 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F,
+ 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F,
+ 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F,
+ 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F,
+ 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F,
+ 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F,
+ 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F,
+ 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F,
+ 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F,
+ 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F,
+ 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F,
+ 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F,
+ 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F,
+ 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F,
+ 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F,
+ 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F,
+ 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F,
+ 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F,
+ 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F,
+ 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F,
+ 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F,
+ 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F,
+ 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F,
+ 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F,
+ 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F,
+ 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F,
+ 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F,
+ 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F,
+ 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F,
+ 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F,
+ 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F,
+ 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F,
+ 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F,
+ 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F,
+ 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F,
+ 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F,
+ 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F,
+ 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F,
+ 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F,
+ 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F,
+ 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F,
+ 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F,
+ 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F,
+ 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F,
+ 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F,
+ 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F,
+ 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F,
+ 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F,
+ 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F,
+ 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F,
+ 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F,
+ 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F,
+ 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F,
+ 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F,
+ 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F,
+ 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F,
+ 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F,
+ 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F,
+ 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F,
+ 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F,
+ 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F,
+ 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F,
+ 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F,
+ 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F,
+ 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F,
+ 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F,
+ 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F,
+ 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F,
+ 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F,
+ 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F,
+ 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F,
+ 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F,
+ 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F,
+ 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F,
+ 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F,
+ 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F,
+ 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F,
+ 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F,
+ 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F,
+ 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F,
+ 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F,
+ 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F,
+ 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F,
+ 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F,
+ 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F,
+ 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F,
+ 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F,
+ 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F,
+ 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F,
+ 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F,
+ 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F,
+ 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F,
+ 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F,
+ 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F,
+ 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F,
+ 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F,
+ 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F,
+ 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F,
+ 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F,
+ 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F,
+ 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F,
+ 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F,
+ 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F,
+ 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F,
+ 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F,
+ 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F,
+ 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F,
+ 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F,
+ 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F,
+ 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F,
+ 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F,
+ 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F,
+ 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F,
+ 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F,
+ 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F,
+ 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F,
+ 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F,
+ 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F,
+ 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F,
+ 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F,
+ 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F,
+ 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F,
+ 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F,
+ 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F,
+ 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F,
+ 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F,
+ 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F,
+ 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F,
+ 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F,
+ 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F,
+ 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F,
};
-static const float vwin4096[2048] =
-{
- 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F,
- 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F,
- 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F,
- 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F,
- 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F,
- 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F,
- 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F,
- 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F,
- 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F,
- 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F,
- 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F,
- 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F,
- 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F,
- 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F,
- 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F,
- 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F,
- 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F,
- 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F,
- 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F,
- 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F,
- 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F,
- 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F,
- 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F,
- 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F,
- 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F,
- 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F,
- 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F,
- 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F,
- 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F,
- 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F,
- 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F,
- 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F,
- 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F,
- 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F,
- 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F,
- 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F,
- 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F,
- 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F,
- 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F,
- 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F,
- 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F,
- 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F,
- 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F,
- 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F,
- 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F,
- 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F,
- 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F,
- 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F,
- 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F,
- 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F,
- 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F,
- 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F,
- 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F,
- 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F,
- 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F,
- 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F,
- 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F,
- 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F,
- 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F,
- 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F,
- 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F,
- 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F,
- 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F,
- 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F,
- 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F,
- 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F,
- 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F,
- 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F,
- 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F,
- 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F,
- 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F,
- 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F,
- 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F,
- 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F,
- 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F,
- 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F,
- 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F,
- 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F,
- 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F,
- 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F,
- 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F,
- 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F,
- 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F,
- 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F,
- 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F,
- 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F,
- 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F,
- 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F,
- 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F,
- 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F,
- 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F,
- 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F,
- 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F,
- 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F,
- 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F,
- 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F,
- 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F,
- 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F,
- 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F,
- 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F,
- 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F,
- 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F,
- 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F,
- 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F,
- 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F,
- 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F,
- 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F,
- 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F,
- 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F,
- 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F,
- 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F,
- 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F,
- 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F,
- 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F,
- 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F,
- 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F,
- 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F,
- 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F,
- 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F,
- 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F,
- 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F,
- 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F,
- 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F,
- 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F,
- 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F,
- 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F,
- 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F,
- 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F,
- 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F,
- 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F,
- 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F,
- 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F,
- 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F,
- 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F,
- 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F,
- 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F,
- 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F,
- 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F,
- 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F,
- 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F,
- 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F,
- 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F,
- 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F,
- 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F,
- 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F,
- 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F,
- 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F,
- 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F,
- 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F,
- 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F,
- 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F,
- 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F,
- 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F,
- 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F,
- 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F,
- 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F,
- 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F,
- 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F,
- 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F,
- 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F,
- 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F,
- 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F,
- 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F,
- 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F,
- 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F,
- 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F,
- 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F,
- 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F,
- 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F,
- 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F,
- 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F,
- 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F,
- 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F,
- 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F,
- 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F,
- 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F,
- 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F,
- 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F,
- 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F,
- 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F,
- 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F,
- 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F,
- 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F,
- 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F,
- 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F,
- 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F,
- 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F,
- 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F,
- 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F,
- 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F,
- 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F,
- 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F,
- 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F,
- 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F,
- 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F,
- 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F,
- 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F,
- 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F,
- 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F,
- 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F,
- 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F,
- 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F,
- 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F,
- 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F,
- 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F,
- 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F,
- 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F,
- 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F,
- 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F,
- 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F,
- 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F,
- 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F,
- 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F,
- 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F,
- 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F,
- 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F,
- 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F,
- 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F,
- 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F,
- 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F,
- 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F,
- 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F,
- 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F,
- 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F,
- 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F,
- 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F,
- 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F,
- 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F,
- 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F,
- 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F,
- 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F,
- 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F,
- 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F,
- 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F,
- 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F,
- 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F,
- 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F,
- 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F,
- 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F,
- 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F,
- 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F,
- 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F,
- 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F,
- 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F,
- 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F,
- 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F,
- 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F,
- 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F,
- 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F,
- 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F,
- 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F,
- 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F,
- 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F,
- 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F,
- 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F,
- 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F,
- 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F,
- 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F,
- 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F,
- 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F,
- 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F,
- 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F,
- 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F,
- 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F,
- 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F,
- 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F,
- 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F,
- 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F,
- 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F,
- 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F,
- 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F,
- 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F,
- 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F,
- 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F,
- 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F,
- 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F,
- 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F,
- 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F,
- 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F,
- 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F,
- 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F,
- 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F,
- 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F,
- 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F,
- 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F,
- 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F,
- 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F,
- 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F,
- 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F,
- 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F,
- 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F,
- 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F,
- 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F,
- 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F,
- 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F,
- 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F,
- 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F,
- 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F,
- 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F,
- 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F,
- 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F,
- 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F,
- 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F,
- 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F,
- 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F,
- 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F,
- 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F,
- 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F,
- 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F,
- 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F,
- 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F,
- 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F,
- 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F,
- 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F,
- 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F,
- 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F,
- 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F,
- 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F,
- 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F,
- 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F,
- 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F,
- 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F,
- 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F,
- 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F,
- 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F,
- 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F,
- 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F,
- 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F,
- 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F,
- 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F,
- 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F,
- 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F,
- 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F,
- 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F,
- 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F,
- 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F,
- 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F,
- 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F,
- 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F,
- 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F,
- 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F,
- 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F,
- 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F,
- 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F,
- 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F,
- 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F,
- 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F,
- 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F,
- 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F,
- 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F,
- 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F,
- 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F,
- 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F,
- 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F,
- 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F,
- 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F,
- 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F,
- 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F,
- 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F,
- 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F,
- 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F,
- 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F,
- 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F,
- 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F,
- 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F,
- 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F,
- 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F,
- 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F,
- 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F,
- 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F,
- 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F,
- 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F,
- 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F,
- 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F,
- 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F,
- 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F,
- 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F,
- 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F,
- 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F,
- 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F,
- 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F,
- 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F,
- 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F,
- 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F,
- 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F,
- 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F,
- 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F,
- 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F,
- 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F,
- 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F,
- 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F,
- 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F,
- 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F,
- 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F,
- 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F,
- 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F,
- 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F,
- 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F,
- 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F,
- 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F,
- 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F,
- 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F,
- 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F,
- 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F,
- 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F,
- 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F,
- 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F,
- 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F,
- 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F,
- 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F,
- 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F,
- 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F,
- 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F,
- 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F,
- 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F,
- 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F,
- 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F,
- 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F,
- 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F,
- 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F,
- 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F,
- 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F,
- 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F,
- 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F,
- 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F,
- 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F,
- 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F,
- 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F,
- 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F,
- 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F,
- 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F,
- 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F,
- 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F,
- 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F,
- 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F,
- 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F,
- 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F,
- 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F,
- 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F,
- 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F,
- 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F,
- 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F,
- 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F,
- 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F,
- 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F,
- 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F,
- 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F,
- 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F,
- 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F,
- 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F,
- 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F,
- 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F,
- 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F,
- 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F,
- 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F,
- 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F,
- 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F,
- 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F,
- 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F,
- 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F,
- 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F,
- 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F,
- 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F,
- 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F,
- 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F,
- 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F,
- 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F,
- 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F,
- 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F,
- 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F,
- 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F,
- 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F,
- 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F,
- 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F,
- 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F,
- 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F,
- 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F,
- 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F,
- 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F,
- 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F,
- 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F,
- 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F,
- 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F,
- 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F,
- 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F,
- 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F,
- 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F,
- 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F,
- 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F,
- 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F,
- 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F,
- 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F,
- 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F,
- 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F,
- 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F,
- 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F,
- 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F,
- 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F,
- 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F,
- 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F,
- 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F,
- 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F,
- 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F,
- 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F,
- 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F,
- 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F,
- 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F,
- 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F,
- 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F,
- 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F,
- 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F,
- 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
+static const float vwin4096[2048] = {
+ 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F,
+ 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F,
+ 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F,
+ 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F,
+ 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F,
+ 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F,
+ 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F,
+ 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F,
+ 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F,
+ 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F,
+ 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F,
+ 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F,
+ 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F,
+ 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F,
+ 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F,
+ 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F,
+ 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F,
+ 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F,
+ 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F,
+ 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F,
+ 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F,
+ 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F,
+ 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F,
+ 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F,
+ 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F,
+ 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F,
+ 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F,
+ 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F,
+ 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F,
+ 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F,
+ 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F,
+ 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F,
+ 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F,
+ 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F,
+ 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F,
+ 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F,
+ 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F,
+ 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F,
+ 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F,
+ 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F,
+ 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F,
+ 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F,
+ 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F,
+ 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F,
+ 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F,
+ 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F,
+ 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F,
+ 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F,
+ 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F,
+ 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F,
+ 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F,
+ 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F,
+ 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F,
+ 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F,
+ 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F,
+ 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F,
+ 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F,
+ 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F,
+ 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F,
+ 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F,
+ 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F,
+ 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F,
+ 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F,
+ 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F,
+ 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F,
+ 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F,
+ 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F,
+ 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F,
+ 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F,
+ 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F,
+ 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F,
+ 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F,
+ 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F,
+ 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F,
+ 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F,
+ 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F,
+ 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F,
+ 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F,
+ 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F,
+ 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F,
+ 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F,
+ 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F,
+ 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F,
+ 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F,
+ 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F,
+ 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F,
+ 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F,
+ 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F,
+ 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F,
+ 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F,
+ 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F,
+ 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F,
+ 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F,
+ 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F,
+ 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F,
+ 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F,
+ 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F,
+ 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F,
+ 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F,
+ 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F,
+ 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F,
+ 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F,
+ 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F,
+ 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F,
+ 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F,
+ 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F,
+ 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F,
+ 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F,
+ 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F,
+ 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F,
+ 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F,
+ 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F,
+ 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F,
+ 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F,
+ 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F,
+ 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F,
+ 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F,
+ 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F,
+ 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F,
+ 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F,
+ 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F,
+ 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F,
+ 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F,
+ 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F,
+ 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F,
+ 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F,
+ 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F,
+ 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F,
+ 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F,
+ 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F,
+ 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F,
+ 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F,
+ 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F,
+ 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F,
+ 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F,
+ 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F,
+ 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F,
+ 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F,
+ 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F,
+ 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F,
+ 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F,
+ 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F,
+ 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F,
+ 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F,
+ 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F,
+ 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F,
+ 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F,
+ 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F,
+ 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F,
+ 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F,
+ 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F,
+ 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F,
+ 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F,
+ 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F,
+ 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F,
+ 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F,
+ 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F,
+ 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F,
+ 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F,
+ 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F,
+ 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F,
+ 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F,
+ 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F,
+ 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F,
+ 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F,
+ 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F,
+ 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F,
+ 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F,
+ 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F,
+ 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F,
+ 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F,
+ 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F,
+ 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F,
+ 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F,
+ 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F,
+ 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F,
+ 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F,
+ 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F,
+ 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F,
+ 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F,
+ 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F,
+ 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F,
+ 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F,
+ 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F,
+ 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F,
+ 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F,
+ 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F,
+ 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F,
+ 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F,
+ 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F,
+ 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F,
+ 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F,
+ 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F,
+ 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F,
+ 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F,
+ 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F,
+ 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F,
+ 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F,
+ 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F,
+ 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F,
+ 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F,
+ 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F,
+ 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F,
+ 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F,
+ 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F,
+ 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F,
+ 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F,
+ 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F,
+ 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F,
+ 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F,
+ 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F,
+ 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F,
+ 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F,
+ 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F,
+ 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F,
+ 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F,
+ 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F,
+ 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F,
+ 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F,
+ 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F,
+ 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F,
+ 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F,
+ 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F,
+ 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F,
+ 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F,
+ 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F,
+ 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F,
+ 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F,
+ 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F,
+ 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F,
+ 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F,
+ 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F,
+ 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F,
+ 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F,
+ 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F,
+ 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F,
+ 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F,
+ 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F,
+ 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F,
+ 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F,
+ 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F,
+ 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F,
+ 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F,
+ 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F,
+ 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F,
+ 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F,
+ 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F,
+ 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F,
+ 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F,
+ 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F,
+ 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F,
+ 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F,
+ 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F,
+ 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F,
+ 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F,
+ 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F,
+ 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F,
+ 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F,
+ 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F,
+ 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F,
+ 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F,
+ 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F,
+ 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F,
+ 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F,
+ 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F,
+ 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F,
+ 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F,
+ 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F,
+ 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F,
+ 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F,
+ 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F,
+ 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F,
+ 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F,
+ 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F,
+ 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F,
+ 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F,
+ 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F,
+ 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F,
+ 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F,
+ 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F,
+ 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F,
+ 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F,
+ 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F,
+ 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F,
+ 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F,
+ 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F,
+ 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F,
+ 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F,
+ 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F,
+ 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F,
+ 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F,
+ 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F,
+ 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F,
+ 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F,
+ 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F,
+ 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F,
+ 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F,
+ 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F,
+ 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F,
+ 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F,
+ 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F,
+ 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F,
+ 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F,
+ 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F,
+ 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F,
+ 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F,
+ 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F,
+ 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F,
+ 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F,
+ 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F,
+ 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F,
+ 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F,
+ 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F,
+ 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F,
+ 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F,
+ 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F,
+ 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F,
+ 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F,
+ 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F,
+ 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F,
+ 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F,
+ 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F,
+ 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F,
+ 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F,
+ 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F,
+ 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F,
+ 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F,
+ 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F,
+ 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F,
+ 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F,
+ 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F,
+ 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F,
+ 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F,
+ 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F,
+ 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F,
+ 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F,
+ 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F,
+ 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F,
+ 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F,
+ 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F,
+ 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F,
+ 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F,
+ 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F,
+ 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F,
+ 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F,
+ 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F,
+ 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F,
+ 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F,
+ 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F,
+ 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F,
+ 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F,
+ 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F,
+ 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F,
+ 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F,
+ 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F,
+ 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F,
+ 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F,
+ 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F,
+ 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F,
+ 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F,
+ 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F,
+ 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F,
+ 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F,
+ 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F,
+ 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F,
+ 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F,
+ 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F,
+ 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F,
+ 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F,
+ 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F,
+ 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F,
+ 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F,
+ 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F,
+ 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F,
+ 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F,
+ 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F,
+ 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F,
+ 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F,
+ 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F,
+ 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F,
+ 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F,
+ 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F,
+ 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F,
+ 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F,
+ 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F,
+ 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F,
+ 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F,
+ 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F,
+ 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F,
+ 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F,
+ 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F,
+ 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F,
+ 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F,
+ 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F,
+ 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F,
+ 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F,
+ 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F,
+ 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F,
+ 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F,
+ 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F,
+ 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F,
+ 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F,
+ 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F,
+ 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F,
+ 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F,
+ 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F,
+ 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F,
+ 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F,
+ 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F,
+ 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F,
+ 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F,
+ 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F,
+ 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F,
+ 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F,
+ 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F,
+ 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F,
+ 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F,
+ 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F,
+ 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F,
+ 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F,
+ 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F,
+ 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F,
+ 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F,
+ 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F,
+ 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F,
+ 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F,
+ 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F,
+ 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F,
+ 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F,
+ 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F,
+ 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F,
+ 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F,
+ 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F,
+ 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F,
+ 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F,
+ 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F,
+ 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F,
+ 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F,
+ 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F,
+ 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F,
+ 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F,
+ 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F,
+ 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F,
+ 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F,
+ 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F,
+ 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F,
+ 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F,
+ 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F,
+ 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F,
+ 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F,
+ 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F,
+ 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F,
+ 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F,
+ 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F,
+ 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F,
+ 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F,
+ 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F,
+ 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F,
+ 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F,
+ 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F,
+ 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F,
+ 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F,
+ 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F,
+ 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F,
+ 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F,
+ 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F,
+ 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F,
+ 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F,
+ 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F,
+ 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F,
+ 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F,
+ 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F,
+ 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F,
+ 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F,
+ 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F,
+ 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F,
+ 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F,
+ 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F,
+ 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F,
+ 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F,
+ 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F,
+ 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F,
+ 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F,
+ 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F,
+ 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F,
+ 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F,
+ 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F,
+ 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F,
+ 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F,
+ 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F,
+ 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F,
+ 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F,
+ 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F,
+ 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F,
+ 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F,
+ 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F,
+ 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F,
+ 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F,
+ 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F,
+ 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F,
+ 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F,
+ 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F,
+ 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F,
+ 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F,
+ 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F,
+ 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F,
+ 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F,
+ 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F,
+ 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F,
+ 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F,
+ 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F,
+ 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
};
-static const float vwin8192[4096] =
-{
- 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F,
- 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F,
- 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F,
- 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F,
- 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F,
- 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F,
- 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F,
- 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F,
- 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F,
- 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F,
- 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F,
- 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F,
- 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F,
- 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F,
- 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F,
- 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F,
- 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F,
- 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F,
- 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F,
- 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F,
- 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F,
- 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F,
- 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F,
- 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F,
- 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F,
- 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F,
- 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F,
- 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F,
- 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F,
- 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F,
- 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F,
- 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F,
- 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F,
- 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F,
- 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F,
- 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F,
- 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F,
- 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F,
- 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F,
- 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F,
- 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F,
- 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F,
- 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F,
- 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F,
- 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F,
- 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F,
- 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F,
- 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F,
- 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F,
- 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F,
- 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F,
- 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F,
- 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F,
- 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F,
- 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F,
- 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F,
- 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F,
- 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F,
- 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F,
- 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F,
- 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F,
- 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F,
- 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F,
- 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F,
- 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F,
- 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F,
- 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F,
- 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F,
- 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F,
- 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F,
- 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F,
- 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F,
- 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F,
- 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F,
- 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F,
- 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F,
- 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F,
- 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F,
- 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F,
- 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F,
- 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F,
- 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F,
- 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F,
- 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F,
- 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F,
- 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F,
- 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F,
- 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F,
- 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F,
- 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F,
- 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F,
- 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F,
- 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F,
- 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F,
- 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F,
- 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F,
- 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F,
- 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F,
- 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F,
- 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F,
- 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F,
- 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F,
- 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F,
- 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F,
- 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F,
- 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F,
- 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F,
- 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F,
- 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F,
- 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F,
- 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F,
- 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F,
- 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F,
- 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F,
- 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F,
- 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F,
- 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F,
- 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F,
- 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F,
- 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F,
- 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F,
- 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F,
- 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F,
- 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F,
- 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F,
- 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F,
- 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F,
- 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F,
- 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F,
- 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F,
- 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F,
- 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F,
- 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F,
- 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F,
- 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F,
- 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F,
- 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F,
- 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F,
- 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F,
- 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F,
- 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F,
- 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F,
- 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F,
- 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F,
- 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F,
- 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F,
- 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F,
- 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F,
- 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F,
- 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F,
- 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F,
- 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F,
- 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F,
- 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F,
- 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F,
- 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F,
- 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F,
- 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F,
- 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F,
- 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F,
- 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F,
- 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F,
- 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F,
- 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F,
- 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F,
- 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F,
- 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F,
- 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F,
- 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F,
- 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F,
- 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F,
- 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F,
- 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F,
- 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F,
- 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F,
- 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F,
- 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F,
- 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F,
- 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F,
- 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F,
- 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F,
- 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F,
- 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F,
- 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F,
- 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F,
- 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F,
- 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F,
- 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F,
- 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F,
- 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F,
- 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F,
- 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F,
- 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F,
- 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F,
- 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F,
- 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F,
- 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F,
- 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F,
- 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F,
- 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F,
- 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F,
- 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F,
- 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F,
- 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F,
- 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F,
- 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F,
- 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F,
- 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F,
- 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F,
- 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F,
- 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F,
- 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F,
- 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F,
- 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F,
- 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F,
- 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F,
- 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F,
- 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F,
- 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F,
- 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F,
- 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F,
- 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F,
- 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F,
- 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F,
- 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F,
- 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F,
- 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F,
- 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F,
- 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F,
- 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F,
- 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F,
- 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F,
- 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F,
- 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F,
- 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F,
- 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F,
- 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F,
- 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F,
- 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F,
- 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F,
- 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F,
- 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F,
- 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F,
- 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F,
- 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F,
- 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F,
- 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F,
- 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F,
- 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F,
- 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F,
- 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F,
- 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F,
- 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F,
- 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F,
- 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F,
- 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F,
- 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F,
- 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F,
- 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F,
- 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F,
- 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F,
- 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F,
- 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F,
- 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F,
- 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F,
- 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F,
- 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F,
- 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F,
- 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F,
- 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F,
- 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F,
- 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F,
- 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F,
- 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F,
- 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F,
- 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F,
- 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F,
- 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F,
- 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F,
- 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F,
- 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F,
- 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F,
- 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F,
- 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F,
- 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F,
- 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F,
- 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F,
- 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F,
- 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F,
- 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F,
- 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F,
- 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F,
- 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F,
- 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F,
- 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F,
- 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F,
- 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F,
- 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F,
- 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F,
- 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F,
- 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F,
- 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F,
- 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F,
- 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F,
- 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F,
- 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F,
- 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F,
- 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F,
- 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F,
- 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F,
- 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F,
- 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F,
- 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F,
- 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F,
- 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F,
- 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F,
- 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F,
- 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F,
- 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F,
- 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F,
- 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F,
- 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F,
- 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F,
- 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F,
- 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F,
- 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F,
- 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F,
- 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F,
- 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F,
- 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F,
- 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F,
- 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F,
- 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F,
- 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F,
- 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F,
- 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F,
- 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F,
- 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F,
- 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F,
- 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F,
- 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F,
- 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F,
- 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F,
- 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F,
- 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F,
- 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F,
- 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F,
- 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F,
- 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F,
- 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F,
- 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F,
- 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F,
- 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F,
- 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F,
- 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F,
- 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F,
- 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F,
- 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F,
- 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F,
- 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F,
- 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F,
- 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F,
- 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F,
- 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F,
- 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F,
- 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F,
- 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F,
- 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F,
- 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F,
- 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F,
- 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F,
- 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F,
- 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F,
- 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F,
- 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F,
- 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F,
- 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F,
- 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F,
- 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F,
- 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F,
- 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F,
- 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F,
- 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F,
- 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F,
- 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F,
- 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F,
- 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F,
- 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F,
- 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F,
- 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F,
- 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F,
- 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F,
- 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F,
- 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F,
- 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F,
- 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F,
- 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F,
- 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F,
- 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F,
- 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F,
- 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F,
- 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F,
- 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F,
- 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F,
- 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F,
- 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F,
- 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F,
- 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F,
- 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F,
- 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F,
- 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F,
- 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F,
- 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F,
- 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F,
- 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F,
- 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F,
- 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F,
- 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F,
- 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F,
- 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F,
- 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F,
- 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F,
- 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F,
- 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F,
- 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F,
- 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F,
- 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F,
- 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F,
- 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F,
- 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F,
- 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F,
- 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F,
- 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F,
- 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F,
- 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F,
- 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F,
- 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F,
- 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F,
- 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F,
- 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F,
- 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F,
- 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F,
- 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F,
- 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F,
- 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F,
- 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F,
- 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F,
- 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F,
- 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F,
- 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F,
- 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F,
- 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F,
- 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F,
- 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F,
- 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F,
- 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F,
- 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F,
- 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F,
- 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F,
- 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F,
- 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F,
- 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F,
- 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F,
- 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F,
- 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F,
- 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F,
- 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F,
- 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F,
- 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F,
- 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F,
- 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F,
- 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F,
- 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F,
- 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F,
- 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F,
- 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F,
- 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F,
- 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F,
- 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F,
- 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F,
- 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F,
- 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F,
- 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F,
- 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F,
- 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F,
- 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F,
- 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F,
- 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F,
- 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F,
- 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F,
- 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F,
- 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F,
- 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F,
- 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F,
- 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F,
- 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F,
- 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F,
- 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F,
- 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F,
- 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F,
- 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F,
- 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F,
- 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F,
- 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F,
- 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F,
- 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F,
- 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F,
- 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F,
- 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F,
- 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F,
- 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F,
- 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F,
- 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F,
- 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F,
- 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F,
- 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F,
- 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F,
- 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F,
- 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F,
- 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F,
- 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F,
- 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F,
- 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F,
- 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F,
- 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F,
- 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F,
- 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F,
- 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F,
- 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F,
- 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F,
- 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F,
- 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F,
- 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F,
- 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F,
- 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F,
- 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F,
- 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F,
- 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F,
- 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F,
- 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F,
- 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F,
- 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F,
- 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F,
- 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F,
- 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F,
- 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F,
- 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F,
- 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F,
- 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F,
- 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F,
- 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F,
- 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F,
- 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F,
- 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F,
- 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F,
- 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F,
- 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F,
- 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F,
- 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F,
- 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F,
- 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F,
- 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F,
- 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F,
- 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F,
- 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F,
- 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F,
- 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F,
- 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F,
- 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F,
- 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F,
- 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F,
- 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F,
- 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F,
- 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F,
- 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F,
- 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F,
- 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F,
- 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F,
- 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F,
- 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F,
- 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F,
- 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F,
- 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F,
- 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F,
- 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F,
- 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F,
- 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F,
- 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F,
- 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F,
- 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F,
- 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F,
- 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F,
- 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F,
- 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F,
- 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F,
- 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F,
- 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F,
- 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F,
- 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F,
- 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F,
- 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F,
- 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F,
- 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F,
- 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F,
- 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F,
- 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F,
- 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F,
- 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F,
- 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F,
- 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F,
- 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F,
- 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F,
- 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F,
- 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F,
- 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F,
- 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F,
- 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F,
- 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F,
- 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F,
- 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F,
- 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F,
- 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F,
- 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F,
- 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F,
- 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F,
- 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F,
- 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F,
- 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F,
- 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F,
- 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F,
- 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F,
- 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F,
- 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F,
- 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F,
- 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F,
- 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F,
- 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F,
- 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F,
- 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F,
- 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F,
- 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F,
- 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F,
- 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F,
- 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F,
- 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F,
- 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F,
- 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F,
- 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F,
- 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F,
- 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F,
- 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F,
- 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F,
- 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F,
- 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F,
- 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F,
- 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F,
- 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F,
- 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F,
- 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F,
- 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F,
- 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F,
- 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F,
- 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F,
- 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F,
- 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F,
- 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F,
- 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F,
- 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F,
- 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F,
- 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F,
- 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F,
- 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F,
- 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F,
- 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F,
- 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F,
- 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F,
- 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F,
- 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F,
- 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F,
- 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F,
- 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F,
- 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F,
- 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F,
- 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F,
- 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F,
- 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F,
- 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F,
- 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F,
- 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F,
- 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F,
- 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F,
- 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F,
- 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F,
- 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F,
- 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F,
- 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F,
- 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F,
- 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F,
- 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F,
- 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F,
- 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F,
- 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F,
- 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F,
- 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F,
- 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F,
- 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F,
- 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F,
- 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F,
- 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F,
- 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F,
- 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F,
- 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F,
- 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F,
- 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F,
- 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F,
- 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F,
- 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F,
- 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F,
- 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F,
- 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F,
- 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F,
- 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F,
- 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F,
- 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F,
- 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F,
- 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F,
- 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F,
- 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F,
- 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F,
- 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F,
- 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F,
- 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F,
- 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F,
- 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F,
- 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F,
- 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F,
- 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F,
- 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F,
- 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F,
- 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F,
- 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F,
- 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F,
- 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F,
- 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F,
- 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F,
- 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F,
- 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F,
- 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F,
- 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F,
- 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F,
- 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F,
- 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F,
- 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F,
- 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F,
- 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F,
- 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F,
- 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F,
- 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F,
- 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F,
- 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F,
- 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F,
- 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F,
- 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F,
- 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F,
- 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F,
- 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F,
- 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F,
- 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F,
- 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F,
- 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F,
- 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F,
- 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F,
- 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F,
- 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F,
- 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F,
- 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F,
- 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F,
- 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F,
- 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F,
- 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F,
- 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F,
- 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F,
- 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F,
- 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F,
- 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F,
- 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F,
- 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F,
- 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F,
- 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F,
- 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F,
- 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F,
- 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F,
- 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F,
- 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F,
- 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F,
- 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F,
- 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F,
- 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F,
- 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F,
- 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F,
- 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F,
- 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F,
- 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F,
- 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F,
- 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F,
- 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F,
- 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F,
- 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F,
- 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F,
- 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F,
- 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F,
- 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F,
- 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F,
- 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F,
- 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F,
- 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F,
- 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F,
- 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F,
- 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F,
- 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F,
- 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F,
- 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F,
- 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F,
- 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F,
- 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F,
- 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F,
- 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F,
- 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F,
- 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F,
- 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F,
- 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F,
- 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F,
- 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F,
- 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F,
- 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F,
- 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F,
- 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F,
- 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F,
- 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F,
- 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F,
- 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F,
- 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F,
- 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F,
- 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F,
- 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F,
- 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F,
- 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F,
- 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F,
- 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F,
- 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F,
- 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F,
- 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F,
- 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F,
- 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F,
- 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F,
- 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F,
- 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F,
- 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F,
- 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F,
- 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F,
- 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F,
- 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F,
- 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F,
- 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F,
- 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F,
- 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F,
- 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F,
- 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F,
- 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F,
- 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F,
- 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F,
- 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F,
- 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F,
- 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F,
- 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F,
- 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F,
- 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F,
- 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F,
- 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F,
- 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F,
- 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F,
- 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F,
- 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F,
- 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F,
- 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F,
- 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F,
- 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F,
- 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F,
- 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F,
- 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F,
- 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F,
- 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F,
- 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F,
- 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F,
- 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F,
- 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F,
- 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F,
- 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F,
- 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F,
- 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F,
- 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F,
- 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F,
- 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F,
- 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F,
- 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F,
- 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F,
- 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F,
- 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F,
- 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F,
- 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F,
- 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F,
- 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F,
- 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F,
- 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F,
- 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F,
- 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F,
- 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F,
- 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F,
- 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F,
- 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F,
- 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F,
- 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F,
- 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F,
- 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F,
- 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F,
- 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F,
- 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F,
- 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F,
- 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F,
- 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F,
- 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F,
- 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F,
- 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F,
- 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F,
- 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F,
- 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F,
- 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F,
- 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F,
- 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F,
- 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F,
- 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F,
- 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F,
- 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F,
- 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F,
- 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F,
- 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F,
- 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F,
- 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F,
- 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F,
- 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F,
- 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F,
- 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F,
- 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F,
- 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F,
- 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F,
- 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F,
- 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F,
- 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F,
- 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F,
- 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F,
- 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F,
- 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F,
- 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F,
- 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F,
- 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F,
- 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F,
- 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F,
- 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F,
- 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F,
- 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F,
- 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F,
- 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F,
- 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F,
- 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F,
- 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F,
- 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F,
- 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F,
- 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F,
- 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F,
- 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F,
- 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F,
- 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F,
- 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F,
- 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F,
- 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F,
- 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F,
- 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F,
- 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F,
- 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F,
- 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F,
- 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F,
- 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F,
- 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F,
- 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F,
- 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F,
- 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F,
- 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F,
- 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F,
- 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F,
- 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F,
- 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F,
- 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F,
- 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F,
- 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F,
- 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F,
- 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F,
- 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F,
- 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F,
- 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F,
- 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F,
- 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F,
- 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F,
- 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F,
- 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F,
- 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F,
- 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F,
- 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F,
- 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F,
- 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F,
- 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F,
- 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F,
- 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F,
- 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
- 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
+static const float vwin8192[4096] = {
+ 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F,
+ 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F,
+ 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F,
+ 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F,
+ 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F,
+ 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F,
+ 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F,
+ 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F,
+ 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F,
+ 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F,
+ 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F,
+ 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F,
+ 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F,
+ 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F,
+ 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F,
+ 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F,
+ 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F,
+ 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F,
+ 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F,
+ 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F,
+ 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F,
+ 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F,
+ 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F,
+ 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F,
+ 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F,
+ 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F,
+ 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F,
+ 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F,
+ 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F,
+ 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F,
+ 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F,
+ 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F,
+ 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F,
+ 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F,
+ 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F,
+ 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F,
+ 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F,
+ 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F,
+ 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F,
+ 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F,
+ 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F,
+ 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F,
+ 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F,
+ 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F,
+ 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F,
+ 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F,
+ 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F,
+ 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F,
+ 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F,
+ 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F,
+ 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F,
+ 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F,
+ 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F,
+ 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F,
+ 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F,
+ 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F,
+ 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F,
+ 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F,
+ 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F,
+ 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F,
+ 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F,
+ 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F,
+ 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F,
+ 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F,
+ 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F,
+ 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F,
+ 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F,
+ 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F,
+ 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F,
+ 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F,
+ 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F,
+ 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F,
+ 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F,
+ 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F,
+ 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F,
+ 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F,
+ 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F,
+ 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F,
+ 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F,
+ 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F,
+ 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F,
+ 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F,
+ 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F,
+ 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F,
+ 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F,
+ 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F,
+ 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F,
+ 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F,
+ 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F,
+ 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F,
+ 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F,
+ 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F,
+ 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F,
+ 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F,
+ 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F,
+ 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F,
+ 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F,
+ 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F,
+ 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F,
+ 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F,
+ 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F,
+ 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F,
+ 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F,
+ 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F,
+ 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F,
+ 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F,
+ 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F,
+ 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F,
+ 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F,
+ 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F,
+ 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F,
+ 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F,
+ 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F,
+ 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F,
+ 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F,
+ 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F,
+ 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F,
+ 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F,
+ 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F,
+ 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F,
+ 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F,
+ 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F,
+ 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F,
+ 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F,
+ 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F,
+ 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F,
+ 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F,
+ 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F,
+ 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F,
+ 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F,
+ 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F,
+ 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F,
+ 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F,
+ 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F,
+ 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F,
+ 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F,
+ 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F,
+ 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F,
+ 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F,
+ 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F,
+ 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F,
+ 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F,
+ 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F,
+ 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F,
+ 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F,
+ 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F,
+ 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F,
+ 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F,
+ 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F,
+ 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F,
+ 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F,
+ 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F,
+ 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F,
+ 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F,
+ 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F,
+ 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F,
+ 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F,
+ 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F,
+ 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F,
+ 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F,
+ 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F,
+ 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F,
+ 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F,
+ 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F,
+ 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F,
+ 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F,
+ 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F,
+ 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F,
+ 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F,
+ 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F,
+ 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F,
+ 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F,
+ 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F,
+ 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F,
+ 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F,
+ 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F,
+ 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F,
+ 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F,
+ 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F,
+ 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F,
+ 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F,
+ 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F,
+ 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F,
+ 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F,
+ 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F,
+ 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F,
+ 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F,
+ 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F,
+ 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F,
+ 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F,
+ 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F,
+ 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F,
+ 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F,
+ 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F,
+ 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F,
+ 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F,
+ 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F,
+ 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F,
+ 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F,
+ 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F,
+ 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F,
+ 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F,
+ 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F,
+ 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F,
+ 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F,
+ 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F,
+ 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F,
+ 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F,
+ 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F,
+ 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F,
+ 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F,
+ 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F,
+ 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F,
+ 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F,
+ 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F,
+ 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F,
+ 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F,
+ 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F,
+ 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F,
+ 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F,
+ 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F,
+ 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F,
+ 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F,
+ 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F,
+ 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F,
+ 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F,
+ 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F,
+ 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F,
+ 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F,
+ 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F,
+ 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F,
+ 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F,
+ 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F,
+ 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F,
+ 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F,
+ 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F,
+ 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F,
+ 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F,
+ 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F,
+ 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F,
+ 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F,
+ 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F,
+ 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F,
+ 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F,
+ 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F,
+ 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F,
+ 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F,
+ 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F,
+ 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F,
+ 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F,
+ 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F,
+ 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F,
+ 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F,
+ 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F,
+ 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F,
+ 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F,
+ 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F,
+ 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F,
+ 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F,
+ 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F,
+ 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F,
+ 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F,
+ 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F,
+ 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F,
+ 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F,
+ 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F,
+ 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F,
+ 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F,
+ 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F,
+ 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F,
+ 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F,
+ 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F,
+ 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F,
+ 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F,
+ 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F,
+ 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F,
+ 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F,
+ 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F,
+ 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F,
+ 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F,
+ 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F,
+ 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F,
+ 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F,
+ 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F,
+ 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F,
+ 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F,
+ 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F,
+ 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F,
+ 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F,
+ 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F,
+ 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F,
+ 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F,
+ 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F,
+ 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F,
+ 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F,
+ 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F,
+ 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F,
+ 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F,
+ 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F,
+ 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F,
+ 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F,
+ 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F,
+ 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F,
+ 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F,
+ 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F,
+ 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F,
+ 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F,
+ 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F,
+ 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F,
+ 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F,
+ 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F,
+ 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F,
+ 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F,
+ 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F,
+ 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F,
+ 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F,
+ 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F,
+ 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F,
+ 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F,
+ 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F,
+ 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F,
+ 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F,
+ 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F,
+ 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F,
+ 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F,
+ 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F,
+ 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F,
+ 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F,
+ 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F,
+ 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F,
+ 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F,
+ 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F,
+ 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F,
+ 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F,
+ 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F,
+ 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F,
+ 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F,
+ 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F,
+ 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F,
+ 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F,
+ 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F,
+ 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F,
+ 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F,
+ 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F,
+ 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F,
+ 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F,
+ 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F,
+ 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F,
+ 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F,
+ 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F,
+ 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F,
+ 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F,
+ 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F,
+ 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F,
+ 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F,
+ 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F,
+ 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F,
+ 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F,
+ 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F,
+ 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F,
+ 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F,
+ 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F,
+ 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F,
+ 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F,
+ 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F,
+ 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F,
+ 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F,
+ 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F,
+ 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F,
+ 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F,
+ 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F,
+ 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F,
+ 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F,
+ 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F,
+ 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F,
+ 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F,
+ 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F,
+ 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F,
+ 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F,
+ 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F,
+ 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F,
+ 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F,
+ 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F,
+ 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F,
+ 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F,
+ 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F,
+ 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F,
+ 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F,
+ 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F,
+ 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F,
+ 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F,
+ 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F,
+ 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F,
+ 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F,
+ 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F,
+ 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F,
+ 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F,
+ 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F,
+ 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F,
+ 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F,
+ 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F,
+ 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F,
+ 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F,
+ 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F,
+ 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F,
+ 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F,
+ 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F,
+ 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F,
+ 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F,
+ 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F,
+ 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F,
+ 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F,
+ 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F,
+ 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F,
+ 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F,
+ 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F,
+ 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F,
+ 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F,
+ 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F,
+ 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F,
+ 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F,
+ 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F,
+ 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F,
+ 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F,
+ 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F,
+ 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F,
+ 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F,
+ 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F,
+ 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F,
+ 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F,
+ 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F,
+ 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F,
+ 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F,
+ 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F,
+ 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F,
+ 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F,
+ 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F,
+ 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F,
+ 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F,
+ 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F,
+ 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F,
+ 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F,
+ 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F,
+ 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F,
+ 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F,
+ 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F,
+ 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F,
+ 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F,
+ 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F,
+ 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F,
+ 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F,
+ 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F,
+ 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F,
+ 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F,
+ 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F,
+ 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F,
+ 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F,
+ 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F,
+ 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F,
+ 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F,
+ 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F,
+ 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F,
+ 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F,
+ 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F,
+ 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F,
+ 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F,
+ 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F,
+ 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F,
+ 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F,
+ 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F,
+ 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F,
+ 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F,
+ 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F,
+ 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F,
+ 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F,
+ 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F,
+ 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F,
+ 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F,
+ 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F,
+ 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F,
+ 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F,
+ 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F,
+ 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F,
+ 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F,
+ 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F,
+ 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F,
+ 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F,
+ 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F,
+ 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F,
+ 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F,
+ 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F,
+ 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F,
+ 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F,
+ 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F,
+ 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F,
+ 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F,
+ 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F,
+ 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F,
+ 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F,
+ 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F,
+ 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F,
+ 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F,
+ 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F,
+ 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F,
+ 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F,
+ 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F,
+ 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F,
+ 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F,
+ 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F,
+ 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F,
+ 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F,
+ 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F,
+ 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F,
+ 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F,
+ 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F,
+ 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F,
+ 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F,
+ 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F,
+ 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F,
+ 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F,
+ 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F,
+ 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F,
+ 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F,
+ 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F,
+ 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F,
+ 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F,
+ 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F,
+ 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F,
+ 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F,
+ 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F,
+ 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F,
+ 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F,
+ 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F,
+ 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F,
+ 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F,
+ 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F,
+ 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F,
+ 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F,
+ 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F,
+ 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F,
+ 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F,
+ 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F,
+ 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F,
+ 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F,
+ 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F,
+ 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F,
+ 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F,
+ 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F,
+ 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F,
+ 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F,
+ 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F,
+ 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F,
+ 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F,
+ 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F,
+ 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F,
+ 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F,
+ 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F,
+ 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F,
+ 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F,
+ 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F,
+ 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F,
+ 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F,
+ 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F,
+ 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F,
+ 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F,
+ 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F,
+ 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F,
+ 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F,
+ 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F,
+ 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F,
+ 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F,
+ 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F,
+ 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F,
+ 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F,
+ 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F,
+ 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F,
+ 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F,
+ 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F,
+ 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F,
+ 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F,
+ 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F,
+ 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F,
+ 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F,
+ 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F,
+ 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F,
+ 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F,
+ 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F,
+ 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F,
+ 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F,
+ 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F,
+ 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F,
+ 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F,
+ 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F,
+ 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F,
+ 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F,
+ 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F,
+ 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F,
+ 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F,
+ 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F,
+ 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F,
+ 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F,
+ 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F,
+ 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F,
+ 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F,
+ 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F,
+ 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F,
+ 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F,
+ 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F,
+ 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F,
+ 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F,
+ 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F,
+ 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F,
+ 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F,
+ 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F,
+ 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F,
+ 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F,
+ 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F,
+ 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F,
+ 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F,
+ 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F,
+ 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F,
+ 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F,
+ 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F,
+ 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F,
+ 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F,
+ 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F,
+ 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F,
+ 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F,
+ 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F,
+ 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F,
+ 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F,
+ 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F,
+ 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F,
+ 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F,
+ 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F,
+ 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F,
+ 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F,
+ 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F,
+ 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F,
+ 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F,
+ 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F,
+ 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F,
+ 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F,
+ 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F,
+ 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F,
+ 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F,
+ 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F,
+ 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F,
+ 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F,
+ 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F,
+ 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F,
+ 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F,
+ 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F,
+ 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F,
+ 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F,
+ 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F,
+ 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F,
+ 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F,
+ 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F,
+ 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F,
+ 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F,
+ 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F,
+ 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F,
+ 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F,
+ 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F,
+ 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F,
+ 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F,
+ 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F,
+ 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F,
+ 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F,
+ 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F,
+ 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F,
+ 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F,
+ 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F,
+ 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F,
+ 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F,
+ 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F,
+ 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F,
+ 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F,
+ 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F,
+ 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F,
+ 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F,
+ 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F,
+ 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F,
+ 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F,
+ 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F,
+ 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F,
+ 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F,
+ 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F,
+ 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F,
+ 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F,
+ 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F,
+ 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F,
+ 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F,
+ 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F,
+ 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F,
+ 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F,
+ 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F,
+ 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F,
+ 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F,
+ 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F,
+ 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F,
+ 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F,
+ 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F,
+ 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F,
+ 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F,
+ 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F,
+ 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F,
+ 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F,
+ 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F,
+ 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F,
+ 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F,
+ 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F,
+ 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F,
+ 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F,
+ 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F,
+ 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F,
+ 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F,
+ 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F,
+ 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F,
+ 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F,
+ 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F,
+ 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F,
+ 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F,
+ 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F,
+ 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F,
+ 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F,
+ 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F,
+ 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F,
+ 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F,
+ 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F,
+ 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F,
+ 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F,
+ 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F,
+ 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F,
+ 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F,
+ 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F,
+ 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F,
+ 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F,
+ 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F,
+ 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F,
+ 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F,
+ 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F,
+ 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F,
+ 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F,
+ 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F,
+ 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F,
+ 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F,
+ 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F,
+ 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F,
+ 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F,
+ 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F,
+ 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F,
+ 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F,
+ 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F,
+ 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F,
+ 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F,
+ 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F,
+ 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F,
+ 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F,
+ 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F,
+ 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F,
+ 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F,
+ 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F,
+ 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F,
+ 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F,
+ 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F,
+ 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F,
+ 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F,
+ 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F,
+ 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F,
+ 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F,
+ 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F,
+ 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F,
+ 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F,
+ 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F,
+ 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F,
+ 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F,
+ 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F,
+ 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F,
+ 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F,
+ 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F,
+ 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F,
+ 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F,
+ 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F,
+ 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F,
+ 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F,
+ 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F,
+ 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F,
+ 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F,
+ 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F,
+ 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F,
+ 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F,
+ 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F,
+ 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F,
+ 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F,
+ 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F,
+ 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F,
+ 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F,
+ 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F,
+ 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F,
+ 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F,
+ 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F,
+ 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F,
+ 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F,
+ 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F,
+ 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F,
+ 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F,
+ 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F,
+ 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F,
+ 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F,
+ 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F,
+ 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F,
+ 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F,
+ 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F,
+ 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F,
+ 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F,
+ 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F,
+ 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F,
+ 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F,
+ 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F,
+ 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F,
+ 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F,
+ 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F,
+ 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F,
+ 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F,
+ 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F,
+ 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F,
+ 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F,
+ 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F,
+ 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F,
+ 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F,
+ 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F,
+ 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F,
+ 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F,
+ 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F,
+ 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F,
+ 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F,
+ 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F,
+ 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F,
+ 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F,
+ 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F,
+ 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F,
+ 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F,
+ 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F,
+ 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F,
+ 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F,
+ 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F,
+ 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F,
+ 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F,
+ 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F,
+ 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F,
+ 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F,
+ 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F,
+ 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F,
+ 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F,
+ 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F,
+ 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F,
+ 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F,
+ 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F,
+ 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F,
+ 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F,
+ 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F,
+ 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F,
+ 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F,
+ 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F,
+ 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F,
+ 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F,
+ 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F,
+ 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F,
+ 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F,
+ 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F,
+ 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F,
+ 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F,
+ 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F,
+ 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F,
+ 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F,
+ 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F,
+ 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F,
+ 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F,
+ 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F,
+ 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F,
+ 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F,
+ 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F,
+ 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F,
+ 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F,
+ 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F,
+ 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F,
+ 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F,
+ 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F,
+ 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F,
+ 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F,
+ 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F,
+ 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F,
+ 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F,
+ 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F,
+ 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F,
+ 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F,
+ 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F,
+ 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F,
+ 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F,
+ 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F,
+ 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F,
+ 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F,
+ 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F,
+ 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F,
+ 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F,
+ 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F,
+ 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F,
+ 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F,
+ 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F,
+ 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F,
+ 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F,
+ 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F,
+ 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F,
+ 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F,
+ 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F,
+ 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F,
+ 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F,
+ 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F,
+ 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F,
+ 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F,
+ 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F,
+ 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F,
+ 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F,
+ 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F,
+ 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F,
+ 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F,
+ 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F,
+ 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F,
+ 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F,
+ 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F,
+ 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F,
+ 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F,
+ 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F,
+ 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F,
+ 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F,
+ 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F,
+ 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F,
+ 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F,
+ 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F,
+ 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F,
+ 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F,
+ 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F,
+ 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F,
+ 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F,
+ 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F,
+ 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F,
+ 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F,
+ 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F,
+ 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F,
+ 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F,
+ 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F,
+ 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F,
+ 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F,
+ 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F,
+ 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F,
+ 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F,
+ 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F,
+ 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F,
+ 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F,
+ 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F,
+ 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F,
+ 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F,
+ 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F,
+ 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F,
+ 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F,
+ 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F,
+ 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F,
+ 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F,
+ 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F,
+ 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F,
+ 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F,
+ 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F,
+ 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F,
+ 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F,
+ 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F,
+ 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F,
+ 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F,
+ 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F,
+ 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F,
+ 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F,
+ 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F,
+ 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F,
+ 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F,
+ 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F,
+ 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F,
+ 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F,
+ 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F,
+ 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F,
+ 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F,
+ 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F,
+ 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F,
+ 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F,
+ 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F,
+ 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F,
+ 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F,
+ 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F,
+ 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F,
+ 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F,
+ 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F,
+ 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F,
+ 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F,
+ 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F,
+ 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F,
+ 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F,
+ 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F,
+ 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F,
+ 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F,
+ 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F,
+ 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F,
+ 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F,
+ 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F,
+ 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F,
+ 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F,
+ 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F,
+ 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F,
+ 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F,
+ 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F,
+ 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F,
+ 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F,
+ 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F,
+ 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
+ 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
};
-static const float *const vwin[8] =
-{
- vwin64,
- vwin128,
- vwin256,
- vwin512,
- vwin1024,
- vwin2048,
- vwin4096,
- vwin8192,
+static const float *const vwin[8] = {
+ vwin64,
+ vwin128,
+ vwin256,
+ vwin512,
+ vwin1024,
+ vwin2048,
+ vwin4096,
+ vwin8192,
};
-const float *_vorbis_window_get(int n)
-{
- return vwin[n];
+const float *_vorbis_window_get(int n){
+ return vwin[n];
}
-void _vorbis_apply_window(float *d, int *winno, long *blocksizes,
- int lW, int W, int nW)
-{
- lW = (W ? lW : 0);
- nW = (W ? nW : 0);
+void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
+ int lW,int W,int nW){
+ lW=(W?lW:0);
+ nW=(W?nW:0);
- {
- const float *windowLW = vwin[winno[lW]];
- const float *windowNW = vwin[winno[nW]];
+ {
+ const float *windowLW=vwin[winno[lW]];
+ const float *windowNW=vwin[winno[nW]];
- long n = blocksizes[W];
- long ln = blocksizes[lW];
- long rn = blocksizes[nW];
+ long n=blocksizes[W];
+ long ln=blocksizes[lW];
+ long rn=blocksizes[nW];
- long leftbegin = n / 4 - ln / 4;
- long leftend = leftbegin + ln / 2;
+ long leftbegin=n/4-ln/4;
+ long leftend=leftbegin+ln/2;
- long rightbegin = n / 2 + n / 4 - rn / 4;
- long rightend = rightbegin + rn / 2;
+ long rightbegin=n/2+n/4-rn/4;
+ long rightend=rightbegin+rn/2;
- int i, p;
+ int i,p;
- for(i = 0; i < leftbegin; i++)
- d[i] = 0.f;
+ for(i=0;i<leftbegin;i++)
+ d[i]=0.f;
- for(p = 0; i < leftend; i++, p++)
- d[i] *= windowLW[p];
+ for(p=0;i<leftend;i++,p++)
+ d[i]*=windowLW[p];
- for(i = rightbegin, p = rn / 2 - 1; i < rightend; i++, p--)
- d[i] *= windowNW[p];
+ for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
+ d[i]*=windowNW[p];
- for(; i < n; i++)
- d[i] = 0.f;
- }
+ for(;i<n;i++)
+ d[i]=0.f;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/window.h b/src/filters/transform/MpaDecFilter/libvorbisidec/window.h
index bbbce8252..192bd9cfe 100644
--- a/src/filters/transform/MpaDecFilter/libvorbisidec/window.h
+++ b/src/filters/transform/MpaDecFilter/libvorbisidec/window.h
@@ -19,8 +19,8 @@
#define _V_WINDOW_
extern float *_vorbis_window_get(int n);
-extern void _vorbis_apply_window(float *d, int *winno, long *blocksizes,
- int lW, int W, int nW);
+extern void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
+ int lW,int W,int nW);
#endif
diff --git a/src/filters/transform/MpaDecFilter/resource.h b/src/filters/transform/MpaDecFilter/resource.h
index cd4fe2e4f..d72cb6874 100644
--- a/src/filters/transform/MpaDecFilter/resource.h
+++ b/src/filters/transform/MpaDecFilter/resource.h
@@ -19,7 +19,7 @@
#define IDS_MPA_DYNRANGE 33156
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
diff --git a/src/filters/transform/MpaDecFilter/stdafx.cpp b/src/filters/transform/MpaDecFilter/stdafx.cpp
index b9dad0dea..bdacb59f9 100644
--- a/src/filters/transform/MpaDecFilter/stdafx.cpp
+++ b/src/filters/transform/MpaDecFilter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/MpaDecFilter/stdafx.h b/src/filters/transform/MpaDecFilter/stdafx.h
index a9f666228..c35359c38 100644
--- a/src/filters/transform/MpaDecFilter/stdafx.h
+++ b/src/filters/transform/MpaDecFilter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h b/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h
index a2b62a8e6..c4112dcc1 100644
--- a/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h
+++ b/src/filters/transform/Mpeg2DecFilter/IMpeg2DecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -24,33 +24,32 @@
typedef enum {DIAuto, DIWeave, DIBlend, DIBob, DIFieldShift} ditype;
[uuid("0ABEAA65-0317-47B9-AE1D-D9EA905AFD25")]
-interface IMpeg2DecFilter :
-public IUnknown
+interface IMpeg2DecFilter : public IUnknown
{
- STDMETHOD(SetDeinterlaceMethod(ditype di)) = 0;
- STDMETHOD_(ditype, GetDeinterlaceMethod()) = 0;
-
- // Brightness: -255.0 to 255.0, default 0.0
- // Contrast: 0.0 to 10.0, default 1.0
- // Hue: -180.0 to +180.0, default 0.0
- // Saturation: 0.0 to 10.0, default 1.0
-
- STDMETHOD(SetBrightness(float brightness)) = 0;
- STDMETHOD(SetContrast(float contrast)) = 0;
- STDMETHOD(SetHue(float hue)) = 0;
- STDMETHOD(SetSaturation(float saturation)) = 0;
- STDMETHOD_(float, GetBrightness()) = 0;
- STDMETHOD_(float, GetContrast()) = 0;
- STDMETHOD_(float, GetHue()) = 0;
- STDMETHOD_(float, GetSaturation()) = 0;
-
- STDMETHOD(EnableForcedSubtitles(bool fEnable)) = 0;
- STDMETHOD_(bool, IsForcedSubtitlesEnabled()) = 0;
-
- STDMETHOD(EnablePlanarYUV(bool fEnable)) = 0;
- STDMETHOD_(bool, IsPlanarYUVEnabled()) = 0;
-
- STDMETHOD(EnableInterlaced(bool fEnable)) = 0;
- STDMETHOD_(bool, IsInterlacedEnabled()) = 0;
+ STDMETHOD(SetDeinterlaceMethod(ditype di)) = 0;
+ STDMETHOD_(ditype, GetDeinterlaceMethod()) = 0;
+
+ // Brightness: -255.0 to 255.0, default 0.0
+ // Contrast: 0.0 to 10.0, default 1.0
+ // Hue: -180.0 to +180.0, default 0.0
+ // Saturation: 0.0 to 10.0, default 1.0
+
+ STDMETHOD(SetBrightness(float brightness)) = 0;
+ STDMETHOD(SetContrast(float contrast)) = 0;
+ STDMETHOD(SetHue(float hue)) = 0;
+ STDMETHOD(SetSaturation(float saturation)) = 0;
+ STDMETHOD_(float, GetBrightness()) = 0;
+ STDMETHOD_(float, GetContrast()) = 0;
+ STDMETHOD_(float, GetHue()) = 0;
+ STDMETHOD_(float, GetSaturation()) = 0;
+
+ STDMETHOD(EnableForcedSubtitles(bool fEnable)) = 0;
+ STDMETHOD_(bool, IsForcedSubtitlesEnabled()) = 0;
+
+ STDMETHOD(EnablePlanarYUV(bool fEnable)) = 0;
+ STDMETHOD_(bool, IsPlanarYUVEnabled()) = 0;
+
+ STDMETHOD(EnableInterlaced(bool fEnable)) = 0;
+ STDMETHOD_(bool, IsInterlacedEnabled()) = 0;
};
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
index d50bf0804..7eb4f94b5 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -42,19 +42,19 @@
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MPEG2_VIDEO},
- {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MPEG2_VIDEO},
- {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MPEG2_VIDEO},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG2_VIDEO},
#ifndef MPEG2ONLY
- {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload},
#endif
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -65,29 +65,29 @@ const AMOVIESETUP_PIN sudpPins[] =
const AMOVIESETUP_FILTER sudFilter[] =
{
-#ifdef MPEG2ONLY
- {&__uuidof(CMpeg2DecFilter), L"MPC - MPEG-2 Video Decoder (Gabest)", 0x00600001, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
-#else
- {&__uuidof(CMpeg2DecFilter), L"MPC - MPEG Video Decoder (Gabest)", 0x00600001, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
-#endif
+ #ifdef MPEG2ONLY
+ {&__uuidof(CMpeg2DecFilter), L"MPC - MPEG-2 Video Decoder (Gabest)", 0x00600001, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ #else
+ {&__uuidof(CMpeg2DecFilter), L"MPC - MPEG Video Decoder (Gabest)", 0x00600001, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ #endif
};
CFactoryTemplate g_Templates[] =
{
{sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpeg2DecFilter>, NULL, &sudFilter[0]},
- {L"CMpeg2DecPropertyPage", &__uuidof(CMpeg2DecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpeg2DecSettingsWnd> >},
+ {L"CMpeg2DecPropertyPage", &__uuidof(CMpeg2DecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpeg2DecSettingsWnd> >},
};
int g_cTemplates = countof(g_Templates);
STDAPI DllRegisterServer()
{
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
//
@@ -95,63 +95,63 @@ STDAPI DllUnregisterServer()
#include <detours/detours.h>
BOOL (__stdcall * Real_IsDebuggerPresent)(void)
-= IsDebuggerPresent;
+ = IsDebuggerPresent;
-LONG(__stdcall * Real_ChangeDisplaySettingsExA)(LPCSTR a0,
- LPDEVMODEA a1,
- HWND a2,
- DWORD a3,
- LPVOID a4)
-= ChangeDisplaySettingsExA;
+LONG (__stdcall * Real_ChangeDisplaySettingsExA)(LPCSTR a0,
+ LPDEVMODEA a1,
+ HWND a2,
+ DWORD a3,
+ LPVOID a4)
+ = ChangeDisplaySettingsExA;
-LONG(__stdcall * Real_ChangeDisplaySettingsExW)(LPCWSTR a0,
- LPDEVMODEW a1,
- HWND a2,
- DWORD a3,
- LPVOID a4)
-= ChangeDisplaySettingsExW;
+LONG (__stdcall * Real_ChangeDisplaySettingsExW)(LPCWSTR a0,
+ LPDEVMODEW a1,
+ HWND a2,
+ DWORD a3,
+ LPVOID a4)
+ = ChangeDisplaySettingsExW;
BOOL WINAPI Mine_IsDebuggerPresent()
{
- TRACE(_T("Oops, somebody was trying to be naughty! (called IsDebuggerPresent)\n"));
- return FALSE;
+ TRACE(_T("Oops, somebody was trying to be naughty! (called IsDebuggerPresent)\n"));
+ return FALSE;
}
LONG WINAPI Mine_ChangeDisplaySettingsEx(LONG ret, DWORD dwFlags, LPVOID lParam)
{
- if(dwFlags & CDS_VIDEOPARAMETERS)
- {
- VIDEOPARAMETERS* vp = (VIDEOPARAMETERS*)lParam;
-
- if(vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
- && (vp->dwFlags & VP_FLAGS_COPYPROTECT))
- {
- if(vp->dwCommand == VP_COMMAND_GET)
- {
- if((vp->dwTVStandard & VP_TV_STANDARD_WIN_VGA) && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA)
- {
- TRACE(_T("Ooops, tv-out enabled? macrovision checks suck..."));
- vp->dwTVStandard = VP_TV_STANDARD_WIN_VGA;
- }
- }
- else if(vp->dwCommand == VP_COMMAND_SET)
- {
- TRACE(_T("Ooops, as I already told ya, no need for any macrovision bs here"));
- return 0;
- }
- }
- }
-
- return ret;
+ if(dwFlags&CDS_VIDEOPARAMETERS)
+ {
+ VIDEOPARAMETERS* vp = (VIDEOPARAMETERS*)lParam;
+
+ if(vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
+ && (vp->dwFlags&VP_FLAGS_COPYPROTECT))
+ {
+ if(vp->dwCommand == VP_COMMAND_GET)
+ {
+ if((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA) && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA)
+ {
+ TRACE(_T("Ooops, tv-out enabled? macrovision checks suck..."));
+ vp->dwTVStandard = VP_TV_STANDARD_WIN_VGA;
+ }
+ }
+ else if(vp->dwCommand == VP_COMMAND_SET)
+ {
+ TRACE(_T("Ooops, as I already told ya, no need for any macrovision bs here"));
+ return 0;
+ }
+ }
+ }
+
+ return ret;
}
LONG WINAPI Mine_ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam)
{
- return Mine_ChangeDisplaySettingsEx(Real_ChangeDisplaySettingsExA(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam), dwFlags, lParam);
+ return Mine_ChangeDisplaySettingsEx(Real_ChangeDisplaySettingsExA(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam), dwFlags, lParam);
}
LONG WINAPI Mine_ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam)
{
- return Mine_ChangeDisplaySettingsEx(Real_ChangeDisplaySettingsExW(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam), dwFlags, lParam);
+ return Mine_ChangeDisplaySettingsEx(Real_ChangeDisplaySettingsExW(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam), dwFlags, lParam);
}
//
@@ -161,25 +161,25 @@ LONG WINAPI Mine_ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpD
class CMpeg2DecFilterApp : public CFilterApp
{
public:
- BOOL InitInstance()
- {
- long lError;
+ BOOL InitInstance()
+ {
+ long lError;
- if(!__super::InitInstance()) return FALSE;
+ if(!__super::InitInstance()) return FALSE;
- DetourRestoreAfterWith();
- DetourTransactionBegin();
- DetourUpdateThread(GetCurrentThread());
+ DetourRestoreAfterWith();
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
- DetourAttach(&(PVOID&)Real_IsDebuggerPresent, (PVOID)Mine_IsDebuggerPresent);
- DetourAttach(&(PVOID&)Real_ChangeDisplaySettingsExA, (PVOID)Mine_ChangeDisplaySettingsExA);
- DetourAttach(&(PVOID&)Real_ChangeDisplaySettingsExW, (PVOID)Mine_ChangeDisplaySettingsExW);
+ DetourAttach(&(PVOID&)Real_IsDebuggerPresent, (PVOID)Mine_IsDebuggerPresent);
+ DetourAttach(&(PVOID&)Real_ChangeDisplaySettingsExA, (PVOID)Mine_ChangeDisplaySettingsExA);
+ DetourAttach(&(PVOID&)Real_ChangeDisplaySettingsExW, (PVOID)Mine_ChangeDisplaySettingsExW);
- lError = DetourTransactionCommit();
- ASSERT(lError == NOERROR);
+ lError = DetourTransactionCommit();
+ ASSERT (lError == NOERROR);
- return TRUE;
- }
+ return TRUE;
+ }
};
CMpeg2DecFilterApp theApp;
@@ -190,989 +190,975 @@ CMpeg2DecFilterApp theApp;
// CMpeg2DecFilter
//
-CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
- : CBaseVideoFilter(NAME("CMpeg2DecFilter"), lpunk, phr, __uuidof(this), 1)
- , m_fWaitForKeyFrame(true)
+CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CBaseVideoFilter(NAME("CMpeg2DecFilter"), lpunk, phr, __uuidof(this), 1)
+ , m_fWaitForKeyFrame(true)
{
- delete m_pInput;
+ delete m_pInput;
// delete m_pOutput;
- if(FAILED(*phr)) return;
+ if(FAILED(*phr)) return;
- if(!(m_pInput = DNew CMpeg2DecInputPin(this, phr, L"Video"))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
+ if(!(m_pInput = DNew CMpeg2DecInputPin(this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
// if(!(m_pOutput = DNew CMpeg2DecOutputPin(this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
// if(FAILED(*phr)) return;
- if(!(m_pSubpicInput = DNew CSubpicInputPin(this, phr))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
-
- if(!(m_pClosedCaptionOutput = DNew CClosedCaptionOutputPin(this, m_pLock, phr))) * phr = E_OUTOFMEMORY;
- if(FAILED(*phr)) return;
-
- SetDeinterlaceMethod(DIAuto);
- SetBrightness(0.0f);
- SetContrast(1.0f);
- SetHue(0.0f);
- SetSaturation(1.0f);
- EnableForcedSubtitles(true);
- EnablePlanarYUV(true);
- EnableInterlaced(false);
-
- CRegKey key;
- if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"), KEY_READ))
- {
- DWORD dw;
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DeinterlaceMethod"), dw)) SetDeinterlaceMethod((ditype)dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Brightness"), dw)) SetBrightness(*(float*)&dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Contrast"), dw)) SetContrast(*(float*)&dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Hue"), dw)) SetHue(*(float*)&dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Saturation"), dw)) SetSaturation(*(float*)&dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSubtitles"), dw)) EnableForcedSubtitles(!!dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("PlanarYUV"), dw)) EnablePlanarYUV(!!dw);
- if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Interlaced"), dw)) EnableInterlaced(!!dw);
- }
-
- m_rate.Rate = 10000;
- m_rate.StartTime = 0;
+ if(!(m_pSubpicInput = DNew CSubpicInputPin(this, phr))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ if(!(m_pClosedCaptionOutput = DNew CClosedCaptionOutputPin(this, m_pLock, phr))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ SetDeinterlaceMethod(DIAuto);
+ SetBrightness(0.0f);
+ SetContrast(1.0f);
+ SetHue(0.0f);
+ SetSaturation(1.0f);
+ EnableForcedSubtitles(true);
+ EnablePlanarYUV(true);
+ EnableInterlaced(false);
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"), KEY_READ))
+ {
+ DWORD dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DeinterlaceMethod"), dw)) SetDeinterlaceMethod((ditype)dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Brightness"), dw)) SetBrightness(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Contrast"), dw)) SetContrast(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Hue"), dw)) SetHue(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Saturation"), dw)) SetSaturation(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSubtitles"), dw)) EnableForcedSubtitles(!!dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("PlanarYUV"), dw)) EnablePlanarYUV(!!dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Interlaced"), dw)) EnableInterlaced(!!dw);
+ }
+
+ m_rate.Rate = 10000;
+ m_rate.StartTime = 0;
}
CMpeg2DecFilter::~CMpeg2DecFilter()
{
- CRegKey key;
- if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder")))
- {
- key.SetDWORDValue(_T("DeinterlaceMethod"), m_ditype);
- key.SetDWORDValue(_T("Brightness"), *(DWORD*)&m_bright);
- key.SetDWORDValue(_T("Contrast"), *(DWORD*)&m_cont);
- key.SetDWORDValue(_T("Hue"), *(DWORD*)&m_hue);
- key.SetDWORDValue(_T("Saturation"), *(DWORD*)&m_sat);
- key.SetDWORDValue(_T("ForcedSubtitles"), m_fForcedSubs);
- key.SetDWORDValue(_T("PlanarYUV"), m_fPlanarYUV);
- key.SetDWORDValue(_T("Interlaced"), m_fInterlaced);
- }
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder")))
+ {
+ key.SetDWORDValue(_T("DeinterlaceMethod"), m_ditype);
+ key.SetDWORDValue(_T("Brightness"), *(DWORD*)&m_bright);
+ key.SetDWORDValue(_T("Contrast"), *(DWORD*)&m_cont);
+ key.SetDWORDValue(_T("Hue"), *(DWORD*)&m_hue);
+ key.SetDWORDValue(_T("Saturation"), *(DWORD*)&m_sat);
+ key.SetDWORDValue(_T("ForcedSubtitles"), m_fForcedSubs);
+ key.SetDWORDValue(_T("PlanarYUV"), m_fPlanarYUV);
+ key.SetDWORDValue(_T("Interlaced"), m_fInterlaced);
+ }
- delete m_pSubpicInput;
- delete m_pClosedCaptionOutput;
+ delete m_pSubpicInput;
+ delete m_pClosedCaptionOutput;
}
STDMETHODIMP CMpeg2DecFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- return
- QI(IMpeg2DecFilter)
- QI(ISpecifyPropertyPages)
- QI(ISpecifyPropertyPages2)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IMpeg2DecFilter)
+ QI(ISpecifyPropertyPages)
+ QI(ISpecifyPropertyPages2)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
int CMpeg2DecFilter::GetPinCount()
{
- return 4;
+ return 4;
}
CBasePin* CMpeg2DecFilter::GetPin(int n)
{
- switch(n)
- {
- case 0:
- return m_pInput;
- case 1:
- return m_pOutput;
- case 2:
- return m_pSubpicInput;
- case 3:
- return m_pClosedCaptionOutput;
- }
- return NULL;
+ switch(n)
+ {
+ case 0: return m_pInput;
+ case 1: return m_pOutput;
+ case 2: return m_pSubpicInput;
+ case 3: return m_pClosedCaptionOutput;
+ }
+ return NULL;
}
HRESULT CMpeg2DecFilter::EndOfStream()
{
- CAutoLock cAutoLock(&m_csReceive);
- m_pClosedCaptionOutput->EndOfStream();
- return __super::EndOfStream();
+ CAutoLock cAutoLock(&m_csReceive);
+ m_pClosedCaptionOutput->EndOfStream();
+ return __super::EndOfStream();
}
HRESULT CMpeg2DecFilter::BeginFlush()
{
- m_pClosedCaptionOutput->DeliverBeginFlush();
- return __super::BeginFlush();
+ m_pClosedCaptionOutput->DeliverBeginFlush();
+ return __super::BeginFlush();
}
HRESULT CMpeg2DecFilter::EndFlush()
{
- m_pClosedCaptionOutput->DeliverEndFlush();
- return __super::EndFlush();
+ m_pClosedCaptionOutput->DeliverEndFlush();
+ return __super::EndFlush();
}
HRESULT CMpeg2DecFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CAutoLock cAutoLock(&m_csReceive);
- m_pClosedCaptionOutput->DeliverNewSegment(tStart, tStop, dRate);
- m_fDropFrames = false;
- return __super::NewSegment(tStart, tStop, dRate);
+ CAutoLock cAutoLock(&m_csReceive);
+ m_pClosedCaptionOutput->DeliverNewSegment(tStart, tStop, dRate);
+ m_fDropFrames = false;
+ return __super::NewSegment(tStart, tStop, dRate);
}
void CMpeg2DecFilter::InputTypeChanged()
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
+
+ TRACE(_T("ResetMpeg2Decoder()\n"));
- TRACE(_T("ResetMpeg2Decoder()\n"));
+ for(int i = 0; i < countof(m_dec->m_pictures); i++)
+ {
+ m_dec->m_pictures[i].rtStart = m_dec->m_pictures[i].rtStop = _I64_MIN+1;
+ m_dec->m_pictures[i].fDelivered = false;
+ m_dec->m_pictures[i].flags &= ~PIC_MASK_CODING_TYPE;
+ }
- for(int i = 0; i < countof(m_dec->m_pictures); i++)
- {
- m_dec->m_pictures[i].rtStart = m_dec->m_pictures[i].rtStop = _I64_MIN + 1;
- m_dec->m_pictures[i].fDelivered = false;
- m_dec->m_pictures[i].flags &= ~PIC_MASK_CODING_TYPE;
- }
-
- const CMediaType& mt = m_pInput->CurrentMediaType();
+ const CMediaType& mt = m_pInput->CurrentMediaType();
- BYTE* pSequenceHeader = NULL;
- DWORD cbSequenceHeader = 0;
+ BYTE* pSequenceHeader = NULL;
+ DWORD cbSequenceHeader = 0;
- if(mt.formattype == FORMAT_MPEGVideo)
- {
- pSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->bSequenceHeader;
- cbSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->cbSequenceHeader;
- }
- else if(mt.formattype == FORMAT_MPEG2_VIDEO)
- {
- pSequenceHeader = (BYTE*)((MPEG2VIDEOINFO*)mt.Format())->dwSequenceHeader;
- cbSequenceHeader = ((MPEG2VIDEOINFO*)mt.Format())->cbSequenceHeader;
- }
+ if(mt.formattype == FORMAT_MPEGVideo)
+ {
+ pSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->bSequenceHeader;
+ cbSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->cbSequenceHeader;
+ }
+ else if(mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ pSequenceHeader = (BYTE*)((MPEG2VIDEOINFO*)mt.Format())->dwSequenceHeader;
+ cbSequenceHeader = ((MPEG2VIDEOINFO*)mt.Format())->cbSequenceHeader;
+ }
- m_dec->mpeg2_close();
- m_dec->mpeg2_init();
+ m_dec->mpeg2_close();
+ m_dec->mpeg2_init();
- m_dec->mpeg2_buffer(pSequenceHeader, pSequenceHeader + cbSequenceHeader);
+ m_dec->mpeg2_buffer(pSequenceHeader, pSequenceHeader + cbSequenceHeader);
- m_fWaitForKeyFrame = true;
+ m_fWaitForKeyFrame = true;
- m_fFilm = false;
- m_fb.flags = 0;
+ m_fFilm = false;
+ m_fb.flags = 0;
}
void CMpeg2DecFilter::SetDeinterlaceMethod()
{
- ASSERT(m_dec->m_info.m_sequence);
- ASSERT(m_dec->m_info.m_display_picture);
-
- DWORD seqflags = m_dec->m_info.m_sequence->flags;
- DWORD oldflags = m_fb.flags;
- DWORD newflags = m_dec->m_info.m_display_picture->flags;
-
- if(!(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
- && !(oldflags & PIC_FLAG_REPEAT_FIRST_FIELD)
- && (newflags & PIC_FLAG_PROGRESSIVE_FRAME))
- {
- if(!m_fFilm && (newflags & PIC_FLAG_REPEAT_FIRST_FIELD))
- {
- TRACE(_T("m_fFilm = true\n"));
- m_fFilm = true;
- }
- else if(m_fFilm && !(newflags & PIC_FLAG_REPEAT_FIRST_FIELD))
- {
- TRACE(_T("m_fFilm = false\n"));
- m_fFilm = false;
- }
- }
-
- const CMediaType& mt = m_pOutput->CurrentMediaType();
-
- if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced))
- {
- m_fb.di = DIWeave;
- }
- else
- {
- m_fb.di = GetDeinterlaceMethod();
-
- if(m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift)
- {
- if(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
- m_fb.di = DIWeave; // hurray!
- else if(m_fFilm)
- m_fb.di = DIWeave; // we are lucky
- else if(!(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME))
- m_fb.di = DIBlend; // ok, clear thing
- else
- // big trouble here, the progressive_frame bit is not reliable :'(
- // frames without temporal field diffs can be only detected when ntsc
- // uses the repeat field flag (signaled with m_fFilm), if it's not set
- // or we have pal then we might end up blending the fields unnecessarily...
- m_fb.di = DIBlend;
- }
- }
-
- m_fb.flags = newflags;
+ ASSERT(m_dec->m_info.m_sequence);
+ ASSERT(m_dec->m_info.m_display_picture);
+
+ DWORD seqflags = m_dec->m_info.m_sequence->flags;
+ DWORD oldflags = m_fb.flags;
+ DWORD newflags = m_dec->m_info.m_display_picture->flags;
+
+ if(!(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ && !(oldflags & PIC_FLAG_REPEAT_FIRST_FIELD)
+ && (newflags & PIC_FLAG_PROGRESSIVE_FRAME))
+ {
+ if(!m_fFilm && (newflags & PIC_FLAG_REPEAT_FIRST_FIELD))
+ {
+ TRACE(_T("m_fFilm = true\n"));
+ m_fFilm = true;
+ }
+ else if(m_fFilm && !(newflags & PIC_FLAG_REPEAT_FIRST_FIELD))
+ {
+ TRACE(_T("m_fFilm = false\n"));
+ m_fFilm = false;
+ }
+ }
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+
+ if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced))
+ {
+ m_fb.di = DIWeave;
+ }
+ else
+ {
+ m_fb.di = GetDeinterlaceMethod();
+
+ if(m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift)
+ {
+ if(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ m_fb.di = DIWeave; // hurray!
+ else if(m_fFilm)
+ m_fb.di = DIWeave; // we are lucky
+ else if(!(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME))
+ m_fb.di = DIBlend; // ok, clear thing
+ else
+ // big trouble here, the progressive_frame bit is not reliable :'(
+ // frames without temporal field diffs can be only detected when ntsc
+ // uses the repeat field flag (signaled with m_fFilm), if it's not set
+ // or we have pal then we might end up blending the fields unnecessarily...
+ m_fb.di = DIBlend;
+ }
+ }
+
+ m_fb.flags = newflags;
}
void CMpeg2DecFilter::SetTypeSpecificFlags(IMediaSample* pMS)
{
- if(CComQIPtr<IMediaSample2> pMS2 = pMS)
- {
- AM_SAMPLE2_PROPERTIES props;
- if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
- {
- props.dwTypeSpecificFlags &= ~0x7f;
-
- const CMediaType& mt = m_pOutput->CurrentMediaType();
- if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced))
- {
- // props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
-
- if(m_dec->m_info.m_sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
-
- if(m_fb.flags & PIC_FLAG_TOP_FIELD_FIRST)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
- if(m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_REPEAT_FIELD;
-
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B)
- props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
- }
-
- pMS2->SetProperties(sizeof(props), (BYTE*)&props);
- }
- }
+ if(CComQIPtr<IMediaSample2> pMS2 = pMS)
+ {
+ AM_SAMPLE2_PROPERTIES props;
+ if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
+ {
+ props.dwTypeSpecificFlags &= ~0x7f;
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+ if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced))
+ {
+ // props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
+
+ if(m_dec->m_info.m_sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
+
+ if(m_fb.flags & PIC_FLAG_TOP_FIELD_FIRST)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
+ if(m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_REPEAT_FIELD;
+
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
+ }
+
+ pMS2->SetProperties(sizeof(props), (BYTE*)&props);
+ }
+ }
}
HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
{
- HRESULT hr;
+ HRESULT hr;
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pIn->GetPointer(&pDataIn)))
- return hr;
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
- long len = pIn->GetActualDataLength();
+ long len = pIn->GetActualDataLength();
- (static_cast<CDeCSSInputPin*>(m_pInput))->StripPacket(pDataIn, len);
+ (static_cast<CDeCSSInputPin*>(m_pInput))->StripPacket(pDataIn, len);
- if(pIn->IsDiscontinuity() == S_OK)
- {
- InputTypeChanged();
- }
+ if(pIn->IsDiscontinuity() == S_OK)
+ {
+ InputTypeChanged();
+ }
- REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
- hr = pIn->GetTime(&rtStart, &rtStop);
- if(FAILED(hr)) rtStart = rtStop = _I64_MIN;
+ REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
+ hr = pIn->GetTime(&rtStart, &rtStop);
+ if(FAILED(hr)) rtStart = rtStop = _I64_MIN;
- while(len >= 0)
- {
- mpeg2_state_t state = m_dec->mpeg2_parse();
+ while(len >= 0)
+ {
+ mpeg2_state_t state = m_dec->mpeg2_parse();
#ifndef _WIN64
- __asm emms; // this one is missing somewhere in the precompiled mmx obj files
+ __asm emms; // this one is missing somewhere in the precompiled mmx obj files
#endif
- switch(state)
- {
- case STATE_BUFFER:
- if(len > 0)
- {
- m_dec->mpeg2_buffer(pDataIn, pDataIn + len);
- len = 0;
- }
- else len = -1;
- break;
- case STATE_INVALID:
- TRACE(_T("*** STATE_INVALID\n"));
- break;
- case STATE_GOP:
- m_pClosedCaptionOutput->Deliver(m_dec->m_info.m_user_data, m_dec->m_info.m_user_data_len);
- break;
- case STATE_SEQUENCE:
- m_AvgTimePerFrame = m_dec->m_info.m_sequence->frame_period
- ? 10i64 * m_dec->m_info.m_sequence->frame_period / 27
- : ((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().Format())->AvgTimePerFrame;
- break;
- case STATE_PICTURE:
- m_dec->m_picture->rtStart = rtStart;
- rtStart = _I64_MIN;
- m_dec->m_picture->fDelivered = false;
- m_dec->mpeg2_skip(m_fDropFrames && (m_dec->m_picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B);
- break;
- case STATE_SLICE:
- case STATE_END:
- {
- mpeg2_picture_t* picture = m_dec->m_info.m_display_picture;
- mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
-
- if(picture && !(picture->flags & PIC_FLAG_SKIP) && fbuf)
- {
- ASSERT(!picture->fDelivered);
-
- picture->fDelivered = true;
-
- // frame buffer
-
- int w = m_dec->m_info.m_sequence->picture_width;
- int h = m_dec->m_info.m_sequence->picture_height;
- int pitch = (m_dec->m_info.m_sequence->width + 31) & ~31;
-
- if(m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch)
- m_fb.Alloc(w, h, pitch);
-
- // start - end
-
- m_fb.rtStart = picture->rtStart;
- if(m_fb.rtStart == _I64_MIN) m_fb.rtStart = m_fb.rtStop;
- m_fb.rtStop = m_fb.rtStart + m_AvgTimePerFrame * picture->nb_fields / (m_dec->m_info.m_display_picture_2nd ? 1 : 2);
-
- REFERENCE_TIME rtStart = m_fb.rtStart;
- REFERENCE_TIME rtStop = m_fb.rtStop;
-
- //
-
- SetDeinterlaceMethod();
-
- if(S_OK != (hr = DeliverFast())
- && S_OK != (hr = DeliverNormal()))
- return hr;
- }
- }
- break;
- default:
- break;
- }
- }
-
- return S_OK;
+ switch(state)
+ {
+ case STATE_BUFFER:
+ if(len > 0) {m_dec->mpeg2_buffer(pDataIn, pDataIn + len); len = 0;}
+ else len = -1;
+ break;
+ case STATE_INVALID:
+ TRACE(_T("*** STATE_INVALID\n"));
+ break;
+ case STATE_GOP:
+ m_pClosedCaptionOutput->Deliver(m_dec->m_info.m_user_data, m_dec->m_info.m_user_data_len);
+ break;
+ case STATE_SEQUENCE:
+ m_AvgTimePerFrame = m_dec->m_info.m_sequence->frame_period
+ ? 10i64 * m_dec->m_info.m_sequence->frame_period / 27
+ : ((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().Format())->AvgTimePerFrame;
+ break;
+ case STATE_PICTURE:
+ m_dec->m_picture->rtStart = rtStart; rtStart = _I64_MIN;
+ m_dec->m_picture->fDelivered = false;
+ m_dec->mpeg2_skip(m_fDropFrames && (m_dec->m_picture->flags&PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B);
+ break;
+ case STATE_SLICE:
+ case STATE_END:
+ {
+ mpeg2_picture_t* picture = m_dec->m_info.m_display_picture;
+ mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
+
+ if(picture && !(picture->flags&PIC_FLAG_SKIP) && fbuf)
+ {
+ ASSERT(!picture->fDelivered);
+
+ picture->fDelivered = true;
+
+ // frame buffer
+
+ int w = m_dec->m_info.m_sequence->picture_width;
+ int h = m_dec->m_info.m_sequence->picture_height;
+ int pitch = (m_dec->m_info.m_sequence->width + 31) & ~31;
+
+ if(m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch)
+ m_fb.Alloc(w, h, pitch);
+
+ // start - end
+
+ m_fb.rtStart = picture->rtStart;
+ if(m_fb.rtStart == _I64_MIN) m_fb.rtStart = m_fb.rtStop;
+ m_fb.rtStop = m_fb.rtStart + m_AvgTimePerFrame * picture->nb_fields / (m_dec->m_info.m_display_picture_2nd ? 1 : 2);
+
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
+
+ //
+
+ SetDeinterlaceMethod();
+
+ if(S_OK != (hr = DeliverFast())
+ && S_OK != (hr = DeliverNormal()))
+ return hr;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ return S_OK;
}
bool CMpeg2DecFilter::IsVideoInterlaced()
{
- return IsInterlacedEnabled();
+ return IsInterlacedEnabled();
}
HRESULT CMpeg2DecFilter::DeliverFast()
{
- HRESULT hr;
+ HRESULT hr;
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
- if(!fbuf) return S_FALSE;
+ mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
+ if(!fbuf) return S_FALSE;
- {
+ {
- CAutoLock cAutoLock2(&m_csProps);
+ CAutoLock cAutoLock2(&m_csProps);
- if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator
- || m_pSubpicInput->HasAnythingToRender(m_fb.rtStart)
- || fabs(m_bright) > EPSILON || fabs(m_cont - 1.0) > EPSILON
- || fabs(m_hue) > EPSILON || fabs(m_sat - 1.0) > EPSILON)
- return S_FALSE;
- }
-
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
- m_fWaitForKeyFrame = false;
+ if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator
+ || m_pSubpicInput->HasAnythingToRender(m_fb.rtStart)
+ || fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON
+ || fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON)
+ return S_FALSE;
+ }
- if(m_fb.rtStart < 0 || m_fWaitForKeyFrame)
- return S_OK;
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
+ m_fWaitForKeyFrame = false;
- const CMediaType& mt = m_pOutput->CurrentMediaType();
+ if(m_fb.rtStart < 0 || m_fWaitForKeyFrame)
+ return S_OK;
- if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12)
- return S_FALSE;
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+
+ if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12)
+ return S_FALSE;
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
- || FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
- if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12)
- return S_FALSE;
+ if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12)
+ return S_FALSE;
- BITMAPINFOHEADER bihOut;
- ExtractBIH(&mt, &bihOut);
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&mt, &bihOut);
- int w = bihOut.biWidth;
- int h = abs(bihOut.biHeight);
- int srcpitch = m_dec->m_info.m_sequence->width; // TODO (..+7)&~7; ?
- int dstpitch = bihOut.biWidth;
+ int w = bihOut.biWidth;
+ int h = abs(bihOut.biHeight);
+ int srcpitch = m_dec->m_info.m_sequence->width; // TODO (..+7)&~7; ?
+ int dstpitch = bihOut.biWidth;
- BYTE* y = pDataOut;
- BYTE* u = y + dstpitch * h;
- BYTE* v = y + dstpitch * h * 5 / 4;
+ BYTE* y = pDataOut;
+ BYTE* u = y + dstpitch*h;
+ BYTE* v = y + dstpitch*h*5/4;
- if(bihOut.biCompression == '21VY')
- {
- BYTE* tmp = u;
- u = v;
- v = tmp;
- }
+ if(bihOut.biCompression == '21VY') {BYTE* tmp = u; u = v; v = tmp;}
- if(m_fb.di == DIWeave)
- {
- BitBltFromI420ToI420(w, h, y, u, v, dstpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], srcpitch);
- }
- else if(m_fb.di == DIBlend)
- {
- DeinterlaceBlend(y, fbuf->buf[0], w, h, dstpitch, srcpitch);
- DeinterlaceBlend(u, fbuf->buf[1], w / 2, h / 2, dstpitch / 2, srcpitch / 2);
- DeinterlaceBlend(v, fbuf->buf[2], w / 2, h / 2, dstpitch / 2, srcpitch / 2);
- }
- else // TODO
- {
- return S_FALSE;
- }
+ if(m_fb.di == DIWeave)
+ {
+ BitBltFromI420ToI420(w, h, y, u, v, dstpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], srcpitch);
+ }
+ else if(m_fb.di == DIBlend)
+ {
+ DeinterlaceBlend(y, fbuf->buf[0], w, h, dstpitch, srcpitch);
+ DeinterlaceBlend(u, fbuf->buf[1], w/2, h/2, dstpitch/2, srcpitch/2);
+ DeinterlaceBlend(v, fbuf->buf[2], w/2, h/2, dstpitch/2, srcpitch/2);
+ }
+ else // TODO
+ {
+ return S_FALSE;
+ }
- if(h == 1088)
- {
- memset(y + dstpitch*(h - 8), 0xff, dstpitch * 8);
- memset(u + dstpitch*(h - 8) / 4, 0x80, dstpitch * 8 / 4);
- memset(v + dstpitch*(h - 8) / 4, 0x80, dstpitch * 8 / 4);
- }
+ if(h == 1088)
+ {
+ memset(y + dstpitch*(h-8), 0xff, dstpitch*8);
+ memset(u + dstpitch*(h-8)/4, 0x80, dstpitch*8/4);
+ memset(v + dstpitch*(h-8)/4, 0x80, dstpitch*8/4);
+ }
- if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput))
- {
- CAutoLock cAutoLock(&pPin->m_csRateLock);
+ if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput))
+ {
+ CAutoLock cAutoLock(&pPin->m_csRateLock);
- if(m_rate.Rate != pPin->m_ratechange.Rate)
- {
- m_rate.Rate = pPin->m_ratechange.Rate;
- m_rate.StartTime = m_fb.rtStart;
- }
- }
+ if(m_rate.Rate != pPin->m_ratechange.Rate)
+ {
+ m_rate.Rate = pPin->m_ratechange.Rate;
+ m_rate.StartTime = m_fb.rtStart;
+ }
+ }
- REFERENCE_TIME rtStart = m_fb.rtStart;
- REFERENCE_TIME rtStop = m_fb.rtStop;
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
- rtStart = m_rate.StartTime + (rtStart - m_rate.StartTime) * m_rate.Rate / 10000;
- rtStop = m_rate.StartTime + (rtStop - m_rate.StartTime) * m_rate.Rate / 10000;
+ rtStart = m_rate.StartTime + (rtStart - m_rate.StartTime) * m_rate.Rate / 10000;
+ rtStop = m_rate.StartTime + (rtStop - m_rate.StartTime) * m_rate.Rate / 10000;
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
- //
+ //
- SetTypeSpecificFlags(pOut);
+ SetTypeSpecificFlags(pOut);
- //
+ //
- return m_pOutput->Deliver(pOut);
+ return m_pOutput->Deliver(pOut);
}
HRESULT CMpeg2DecFilter::DeliverNormal()
{
- HRESULT hr;
+ HRESULT hr;
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
- if(!fbuf) return S_FALSE;
+ mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
+ if(!fbuf) return S_FALSE;
- int w = m_fb.w;
- int h = m_fb.h;
- int spitch = m_dec->m_info.m_sequence->width; // TODO (..+7)&~7; ?
- int dpitch = m_fb.pitch;
+ int w = m_fb.w;
+ int h = m_fb.h;
+ int spitch = m_dec->m_info.m_sequence->width; // TODO (..+7)&~7; ?
+ int dpitch = m_fb.pitch;
- REFERENCE_TIME rtStart = m_fb.rtStart;
- REFERENCE_TIME rtStop = m_fb.rtStop;
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
- bool tff = !!(m_fb.flags & PIC_FLAG_TOP_FIELD_FIRST);
+ bool tff = !!(m_fb.flags&PIC_FLAG_TOP_FIELD_FIRST);
- // deinterlace
+ // deinterlace
- if(m_fb.di == DIWeave)
- {
- BitBltFromI420ToI420(w, h, m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], dpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], spitch);
- }
- else if(m_fb.di == DIBlend)
- {
- DeinterlaceBlend(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch);
- DeinterlaceBlend(m_fb.buf[1], fbuf->buf[1], w / 2, h / 2, dpitch / 2, spitch / 2);
- DeinterlaceBlend(m_fb.buf[2], fbuf->buf[2], w / 2, h / 2, dpitch / 2, spitch / 2);
- }
- else if(m_fb.di == DIBob)
- {
- DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, tff);
- DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w / 2, h / 2, dpitch / 2, spitch / 2, tff);
- DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w / 2, h / 2, dpitch / 2, spitch / 2, tff);
-
- m_fb.rtStart = rtStart;
- m_fb.rtStop = (rtStart + rtStop) / 2;
- }
- else if(m_fb.di == DIFieldShift)
- {
- int soffset = tff ? 0 : spitch;
- int doffset = tff ? 0 : dpitch;
- BitBltFromRGBToRGB(w, h / 2, m_fb.buf[0] + doffset, dpitch * 2, 8, fbuf->buf[0] + soffset, spitch * 2, 8);
- BitBltFromRGBToRGB(w / 2, h / 4, m_fb.buf[1] + doffset / 2, dpitch, 8, fbuf->buf[1] + soffset / 2, spitch, 8);
- BitBltFromRGBToRGB(w / 2, h / 4, m_fb.buf[2] + doffset / 2, dpitch, 8, fbuf->buf[2] + soffset / 2, spitch, 8);
- }
+ if(m_fb.di == DIWeave)
+ {
+ BitBltFromI420ToI420(w, h, m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], dpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], spitch);
+ }
+ else if(m_fb.di == DIBlend)
+ {
+ DeinterlaceBlend(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch);
+ DeinterlaceBlend(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2);
+ DeinterlaceBlend(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2);
+ }
+ else if(m_fb.di == DIBob)
+ {
+ DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, tff);
+ DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, tff);
+ DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, tff);
- // postproc
+ m_fb.rtStart = rtStart;
+ m_fb.rtStop = (rtStart + rtStop) / 2;
+ }
+ else if(m_fb.di == DIFieldShift)
+ {
+ int soffset = tff ? 0 : spitch;
+ int doffset = tff ? 0 : dpitch;
+ BitBltFromRGBToRGB(w, h/2, m_fb.buf[0] + doffset, dpitch*2, 8, fbuf->buf[0] + soffset, spitch*2, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
+ }
- ApplyBrContHueSat(m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], w, h, dpitch);
+ // postproc
- // deliver
+ ApplyBrContHueSat(m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], w, h, dpitch);
- if(FAILED(hr = Deliver(false)))
- return hr;
+ // deliver
- if(m_fb.di == DIBob)
- {
- DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, !tff);
- DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w / 2, h / 2, dpitch / 2, spitch / 2, !tff);
- DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w / 2, h / 2, dpitch / 2, spitch / 2, !tff);
+ if(FAILED(hr = Deliver(false)))
+ return hr;
- m_fb.rtStart = (rtStart + rtStop) / 2;
- m_fb.rtStop = rtStop;
+ if(m_fb.di == DIBob)
+ {
+ DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, !tff);
+ DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, !tff);
+ DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, !tff);
- // postproc
+ m_fb.rtStart = (rtStart + rtStop) / 2;
+ m_fb.rtStop = rtStop;
- ApplyBrContHueSat(m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], w, h, dpitch);
+ // postproc
- // deliver
+ ApplyBrContHueSat(m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], w, h, dpitch);
- if(FAILED(hr = Deliver(false)))
- return hr;
- }
- else if(m_fb.di == DIFieldShift)
- {
- int soffset = !tff ? 0 : spitch;
- int doffset = !tff ? 0 : dpitch;
- BitBltFromRGBToRGB(w, h / 2, m_fb.buf[0] + doffset, dpitch * 2, 8, fbuf->buf[0] + soffset, spitch * 2, 8);
- BitBltFromRGBToRGB(w / 2, h / 4, m_fb.buf[1] + doffset / 2, dpitch, 8, fbuf->buf[1] + soffset / 2, spitch, 8);
- BitBltFromRGBToRGB(w / 2, h / 4, m_fb.buf[2] + doffset / 2, dpitch, 8, fbuf->buf[2] + soffset / 2, spitch, 8);
- }
+ // deliver
- return S_OK;
+ if(FAILED(hr = Deliver(false)))
+ return hr;
+ }
+ else if(m_fb.di == DIFieldShift)
+ {
+ int soffset = !tff ? 0 : spitch;
+ int doffset = !tff ? 0 : dpitch;
+ BitBltFromRGBToRGB(w, h/2, m_fb.buf[0] + doffset, dpitch*2, 8, fbuf->buf[0] + soffset, spitch*2, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
+ }
+
+ return S_OK;
}
HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
- m_fWaitForKeyFrame = false;
+ if((m_fb.flags&PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
+ m_fWaitForKeyFrame = false;
- if(m_fb.rtStart < 0 || m_fWaitForKeyFrame)
- return S_OK;
+ if(m_fb.rtStart < 0 || m_fWaitForKeyFrame)
+ return S_OK;
- HRESULT hr;
+ HRESULT hr;
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
- || FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
- if(m_fb.h == 1088)
- {
- memset(m_fb.buf[0] + m_fb.w*(m_fb.h - 8), 0xff, m_fb.pitch * 8);
- memset(m_fb.buf[1] + m_fb.w*(m_fb.h - 8) / 4, 0x80, m_fb.pitch * 8 / 4);
- memset(m_fb.buf[2] + m_fb.w*(m_fb.h - 8) / 4, 0x80, m_fb.pitch * 8 / 4);
- }
+ if(m_fb.h == 1088)
+ {
+ memset(m_fb.buf[0] + m_fb.w*(m_fb.h-8), 0xff, m_fb.pitch*8);
+ memset(m_fb.buf[1] + m_fb.w*(m_fb.h-8)/4, 0x80, m_fb.pitch*8/4);
+ memset(m_fb.buf[2] + m_fb.w*(m_fb.h-8)/4, 0x80, m_fb.pitch*8/4);
+ }
- BYTE** buf = &m_fb.buf[0];
+ BYTE** buf = &m_fb.buf[0];
- if(m_pSubpicInput->HasAnythingToRender(m_fb.rtStart))
- {
- BitBltFromI420ToI420(m_fb.w, m_fb.h,
- m_fb.buf[3], m_fb.buf[4], m_fb.buf[5], m_fb.pitch,
- m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], m_fb.pitch);
+ if(m_pSubpicInput->HasAnythingToRender(m_fb.rtStart))
+ {
+ BitBltFromI420ToI420(m_fb.w, m_fb.h,
+ m_fb.buf[3], m_fb.buf[4], m_fb.buf[5], m_fb.pitch,
+ m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], m_fb.pitch);
- buf = &m_fb.buf[3];
+ buf = &m_fb.buf[3];
- m_pSubpicInput->RenderSubpics(m_fb.rtStart, buf, m_fb.pitch, m_fb.h);
- }
+ m_pSubpicInput->RenderSubpics(m_fb.rtStart, buf, m_fb.pitch, m_fb.h);
+ }
- CopyBuffer(pDataOut, buf, (m_fb.w + 7)&~7, m_fb.h, m_fb.pitch, MEDIASUBTYPE_I420, !(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME));
+ CopyBuffer(pDataOut, buf, (m_fb.w+7)&~7, m_fb.h, m_fb.pitch, MEDIASUBTYPE_I420, !(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME));
- //
+ //
- if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput))
- {
- CAutoLock cAutoLock(&pPin->m_csRateLock);
+ if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput))
+ {
+ CAutoLock cAutoLock(&pPin->m_csRateLock);
- if(m_rate.Rate != pPin->m_ratechange.Rate)
- {
- m_rate.Rate = pPin->m_ratechange.Rate;
- m_rate.StartTime = m_fb.rtStart;
- }
- }
+ if(m_rate.Rate != pPin->m_ratechange.Rate)
+ {
+ m_rate.Rate = pPin->m_ratechange.Rate;
+ m_rate.StartTime = m_fb.rtStart;
+ }
+ }
- REFERENCE_TIME rtStart = m_fb.rtStart;
- REFERENCE_TIME rtStop = m_fb.rtStop;
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
- rtStart = m_rate.StartTime + (rtStart - m_rate.StartTime) * m_rate.Rate / 10000;
- rtStop = m_rate.StartTime + (rtStop - m_rate.StartTime) * m_rate.Rate / 10000;
+ rtStart = m_rate.StartTime + (rtStart - m_rate.StartTime) * m_rate.Rate / 10000;
+ rtStop = m_rate.StartTime + (rtStop - m_rate.StartTime) * m_rate.Rate / 10000;
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
- //
+ //
- SetTypeSpecificFlags(pOut);
+ SetTypeSpecificFlags(pOut);
- //
+ //
- hr = m_pOutput->Deliver(pOut);
+ hr = m_pOutput->Deliver(pOut);
- return hr;
+ return hr;
}
#include <IFilterVersion.h>
HRESULT CMpeg2DecFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
{
- if(dir == PINDIR_OUTPUT)
- {
- if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator)
- {
- // one of these needed for dynamic format changes
-
- CLSID clsid = GetCLSID(pPin);
-
- DWORD ver = 0;
- if(CComQIPtr<IFilterVersion> pFV = GetFilterFromPin(pPin))
- ver = pFV->GetFilterVersion();
-
- if(clsid != CLSID_OverlayMixer
- /*&& clsid != CLSID_OverlayMixer2*/
- && clsid != CLSID_VideoMixingRenderer
- && clsid != CLSID_VideoMixingRenderer9
- && clsid != GUIDFromCString(_T("{FA10746C-9B63-4b6c-BC49-FC300EA5F256}")) // EVR
- && clsid != GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}")) // ffdshow
- && (clsid != GUIDFromCString(_T("{93A22E7A-5091-45ef-BA61-6DA26156A5D0}")) || ver < 0x0234) // dvobsub
- && (clsid != GUIDFromCString(_T("{9852A670-F845-491b-9BE6-EBD841B8A613}")) || ver < 0x0234) // dvobsub auto
- && clsid != CLSID_madVR
- && clsid != CLSID_DXR) // Haali's video renderer
- return E_FAIL;
- }
- }
+ if(dir == PINDIR_OUTPUT)
+ {
+ if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator)
+ {
+ // one of these needed for dynamic format changes
+
+ CLSID clsid = GetCLSID(pPin);
- return __super::CheckConnect(dir, pPin);
+ DWORD ver = 0;
+ if(CComQIPtr<IFilterVersion> pFV = GetFilterFromPin(pPin))
+ ver = pFV->GetFilterVersion();
+
+ if(clsid != CLSID_OverlayMixer
+ /*&& clsid != CLSID_OverlayMixer2*/
+ && clsid != CLSID_VideoMixingRenderer
+ && clsid != CLSID_VideoMixingRenderer9
+ && clsid != GUIDFromCString(_T("{FA10746C-9B63-4b6c-BC49-FC300EA5F256}")) // EVR
+ && clsid != GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}")) // ffdshow
+ && (clsid != GUIDFromCString(_T("{93A22E7A-5091-45ef-BA61-6DA26156A5D0}")) || ver < 0x0234) // dvobsub
+ && (clsid != GUIDFromCString(_T("{9852A670-F845-491b-9BE6-EBD841B8A613}")) || ver < 0x0234) // dvobsub auto
+ && clsid != CLSID_madVR
+ && clsid != CLSID_DXR) // Haali's video renderer
+ return E_FAIL;
+ }
+ }
+
+ return __super::CheckConnect(dir, pPin);
}
HRESULT CMpeg2DecFilter::CheckInputType(const CMediaType* mtIn)
{
- if(mtIn->formattype == FORMAT_MPEG2_VIDEO && mtIn->pbFormat)
- {
- MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mtIn->pbFormat;
- if(vih->cbSequenceHeader > 0 && (vih->dwSequenceHeader[0] & 0x00ffffff) != 0x00010000)
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
+ if(mtIn->formattype == FORMAT_MPEG2_VIDEO && mtIn->pbFormat)
+ {
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mtIn->pbFormat;
+ if(vih->cbSequenceHeader > 0 && (vih->dwSequenceHeader[0] & 0x00ffffff) != 0x00010000)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
- return (mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
- || mtIn->majortype == MEDIATYPE_MPEG2_PACK && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
- || mtIn->majortype == MEDIATYPE_MPEG2_PES && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
- || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
- || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG1Packet
- || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG1Payload)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return (mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_MPEG2_PACK && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_MPEG2_PES && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG1Packet
+ || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG1Payload)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CMpeg2DecFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
{
- bool fPlanarYUV = mtOut->subtype == MEDIASUBTYPE_YV12
- || mtOut->subtype == MEDIASUBTYPE_I420
- || mtOut->subtype == MEDIASUBTYPE_IYUV;
+ bool fPlanarYUV = mtOut->subtype == MEDIASUBTYPE_YV12
+ || mtOut->subtype == MEDIASUBTYPE_I420
+ || mtOut->subtype == MEDIASUBTYPE_IYUV;
- return SUCCEEDED(__super::CheckTransform(mtIn, mtOut))
- && (!fPlanarYUV || IsPlanarYUVEnabled())
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return SUCCEEDED(__super::CheckTransform(mtIn, mtOut))
+ && (!fPlanarYUV || IsPlanarYUVEnabled())
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
DWORD g_clock;
HRESULT CMpeg2DecFilter::StartStreaming()
{
- HRESULT hr = __super::StartStreaming();
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::StartStreaming();
+ if(FAILED(hr)) return hr;
- m_dec.Attach(DNew CMpeg2Dec());
- if(!m_dec) return E_OUTOFMEMORY;
+ m_dec.Attach(DNew CMpeg2Dec());
+ if(!m_dec) return E_OUTOFMEMORY;
- InputTypeChanged();
+ InputTypeChanged();
// g_clock = clock();
- return S_OK;
+ return S_OK;
}
HRESULT CMpeg2DecFilter::StopStreaming()
{
- /*
- CString str;
- str.Format(_T("%d"), clock()-g_clock);
- AfxMessageBox(str);
- */
- m_dec.Free();
+/*
+ CString str;
+ str.Format(_T("%d"), clock()-g_clock);
+ AfxMessageBox(str);
+*/
+ m_dec.Free();
- return __super::StopStreaming();
+ return __super::StopStreaming();
}
HRESULT CMpeg2DecFilter::AlterQuality(Quality q)
{
- if(q.Late > 100 * 10000i64) m_fDropFrames = true;
- else if(q.Late <= 0) m_fDropFrames = false;
+ if(q.Late > 100*10000i64) m_fDropFrames = true;
+ else if(q.Late <= 0) m_fDropFrames = false;
// TRACE(_T("CMpeg2DecFilter::AlterQuality: Type=%d, Proportion=%d, Late=%I64d, TimeStamp=%I64d\n"), q.Type, q.Proportion, q.Late, q.TimeStamp);
- return S_OK;
+ return S_OK;
}
// ISpecifyPropertyPages2
STDMETHODIMP CMpeg2DecFilter::GetPages(CAUUID* pPages)
{
- CheckPointer(pPages, E_POINTER);
+ CheckPointer(pPages, E_POINTER);
- pPages->cElems = 1;
- pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
- pPages->pElems[0] = __uuidof(CMpeg2DecSettingsWnd);
+ pPages->cElems = 1;
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
+ pPages->pElems[0] = __uuidof(CMpeg2DecSettingsWnd);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CMpeg2DecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
{
- CheckPointer(ppPage, E_POINTER);
+ CheckPointer(ppPage, E_POINTER);
- if(*ppPage != NULL) return E_INVALIDARG;
+ if(*ppPage != NULL) return E_INVALIDARG;
- HRESULT hr;
+ HRESULT hr;
- if(guid == __uuidof(CMpeg2DecSettingsWnd))
- {
- (*ppPage = DNew CInternalPropertyPageTempl<CMpeg2DecSettingsWnd>(NULL, &hr))->AddRef();
- }
+ if(guid == __uuidof(CMpeg2DecSettingsWnd))
+ {
+ (*ppPage = DNew CInternalPropertyPageTempl<CMpeg2DecSettingsWnd>(NULL, &hr))->AddRef();
+ }
- return *ppPage ? S_OK : E_FAIL;
+ return *ppPage ? S_OK : E_FAIL;
}
// IMpeg2DecFilter
STDMETHODIMP CMpeg2DecFilter::SetDeinterlaceMethod(ditype di)
{
- CAutoLock cAutoLock(&m_csProps);
- m_ditype = di;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_ditype = di;
+ return S_OK;
}
STDMETHODIMP_(ditype) CMpeg2DecFilter::GetDeinterlaceMethod()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_ditype;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_ditype;
}
void CMpeg2DecFilter::CalcBrCont(BYTE* YTbl, float bright, float cont)
{
- int Cont = (int)(cont * 512);
- int Bright = (int)bright;
+ int Cont = (int)(cont * 512);
+ int Bright = (int)bright;
- for(int i = 0; i < 256; i++)
- {
- int y = ((Cont * (i - 16)) >> 9) + Bright + 16;
- YTbl[i] = min(max(y, 0), 255);
+ for(int i = 0; i < 256; i++)
+ {
+ int y = ((Cont * (i - 16)) >> 9) + Bright + 16;
+ YTbl[i] = min(max(y, 0), 255);
// YTbl[i] = min(max(y, 16), 235);
- }
+ }
}
void CMpeg2DecFilter::CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat)
{
- int Sat = (int)(sat * 512);
- double Hue = (hue * 3.1415926) / 180.0;
- int Sin = (int)(sin(Hue) * 4096);
- int Cos = (int)(cos(Hue) * 4096);
-
- for(int y = 0; y < 256; y++)
- {
- for(int x = 0; x < 256; x++)
- {
- int u = x - 128;
- int v = y - 128;
- int ux = (u * Cos + v * Sin) >> 12;
- v = (v * Cos - u * Sin) >> 12;
- u = ((ux * Sat) >> 9) + 128;
- v = ((v * Sat) >> 9) + 128;
- u = min(max(u, 16), 235);
- v = min(max(v, 16), 235);
- UTbl[(y << 8) | x] = u;
- VTbl[(y << 8) | x] = v;
- }
- }
+ int Sat = (int)(sat * 512);
+ double Hue = (hue * 3.1415926) / 180.0;
+ int Sin = (int)(sin(Hue) * 4096);
+ int Cos = (int)(cos(Hue) * 4096);
+
+ for(int y = 0; y < 256; y++)
+ {
+ for(int x = 0; x < 256; x++)
+ {
+ int u = x - 128;
+ int v = y - 128;
+ int ux = (u * Cos + v * Sin) >> 12;
+ v = (v * Cos - u * Sin) >> 12;
+ u = ((ux * Sat) >> 9) + 128;
+ v = ((v * Sat) >> 9) + 128;
+ u = min(max(u, 16), 235);
+ v = min(max(v, 16), 235);
+ UTbl[(y << 8) | x] = u;
+ VTbl[(y << 8) | x] = v;
+ }
+ }
}
void CMpeg2DecFilter::ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int w, int h, int pitch)
{
- CAutoLock cAutoLock(&m_csProps);
+ CAutoLock cAutoLock(&m_csProps);
- if(fabs(m_bright) > EPSILON || fabs(m_cont - 1.0) > EPSILON)
- {
- int size = pitch * h;
+ if(fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON)
+ {
+ int size = pitch*h;
- if((g_cpuid.m_flags & CCpuID::sse2) && ((DWORD_PTR)srcy & 15) == 0)
- {
- short Cont = (short)(min(max(m_cont, 0) * 512, (1 << 16) - 1));
- short Bright = (short)(m_bright + 16);
+ if((g_cpuid.m_flags&CCpuID::sse2) && ((DWORD_PTR)srcy & 15) == 0)
+ {
+ short Cont = (short)(min(max(m_cont, 0) * 512, (1<<16)-1));
+ short Bright = (short)(m_bright + 16);
- __m128i bc = _mm_set_epi16(Bright, Cont, Bright, Cont, Bright, Cont, Bright, Cont);
+ __m128i bc = _mm_set_epi16(Bright, Cont, Bright, Cont, Bright, Cont, Bright, Cont);
- __m128i zero = _mm_setzero_si128();
- __m128i _16 = _mm_set1_epi16(16);
- __m128i _512 = _mm_set1_epi16(512);
+ __m128i zero = _mm_setzero_si128();
+ __m128i _16 = _mm_set1_epi16(16);
+ __m128i _512 = _mm_set1_epi16(512);
- for(int i = 0, j = size >> 4; i < j; i++)
- {
- __m128i r = _mm_load_si128((__m128i*)&srcy[i*16]);
+ for(int i = 0, j = size>>4; i < j; i++)
+ {
+ __m128i r = _mm_load_si128((__m128i*)&srcy[i*16]);
- __m128i rl = _mm_unpacklo_epi8(r, zero);
- __m128i rh = _mm_unpackhi_epi8(r, zero);
+ __m128i rl = _mm_unpacklo_epi8(r, zero);
+ __m128i rh = _mm_unpackhi_epi8(r, zero);
- rl = _mm_subs_epi16(rl, _16);
- rh = _mm_subs_epi16(rh, _16);
+ rl = _mm_subs_epi16(rl, _16);
+ rh = _mm_subs_epi16(rh, _16);
- __m128i rll = _mm_unpacklo_epi16(rl, _512);
- __m128i rlh = _mm_unpackhi_epi16(rl, _512);
- __m128i rhl = _mm_unpacklo_epi16(rh, _512);
- __m128i rhh = _mm_unpackhi_epi16(rh, _512);
+ __m128i rll = _mm_unpacklo_epi16(rl, _512);
+ __m128i rlh = _mm_unpackhi_epi16(rl, _512);
+ __m128i rhl = _mm_unpacklo_epi16(rh, _512);
+ __m128i rhh = _mm_unpackhi_epi16(rh, _512);
- rll = _mm_madd_epi16(rll, bc);
- rlh = _mm_madd_epi16(rlh, bc);
- rhl = _mm_madd_epi16(rhl, bc);
- rhh = _mm_madd_epi16(rhh, bc);
+ rll = _mm_madd_epi16(rll, bc);
+ rlh = _mm_madd_epi16(rlh, bc);
+ rhl = _mm_madd_epi16(rhl, bc);
+ rhh = _mm_madd_epi16(rhh, bc);
- rll = _mm_srai_epi32(rll, 9);
- rlh = _mm_srai_epi32(rlh, 9);
- rhl = _mm_srai_epi32(rhl, 9);
- rhh = _mm_srai_epi32(rhh, 9);
+ rll = _mm_srai_epi32(rll, 9);
+ rlh = _mm_srai_epi32(rlh, 9);
+ rhl = _mm_srai_epi32(rhl, 9);
+ rhh = _mm_srai_epi32(rhh, 9);
- rl = _mm_packs_epi32(rll, rlh);
- rh = _mm_packs_epi32(rhl, rhh);
+ rl = _mm_packs_epi32(rll, rlh);
+ rh = _mm_packs_epi32(rhl, rhh);
- r = _mm_packus_epi16(rl, rh);
+ r = _mm_packus_epi16(rl, rh);
- _mm_store_si128((__m128i*)&srcy[i*16], r);
- }
+ _mm_store_si128((__m128i*)&srcy[i*16], r);
+ }
- srcy += size >> 4;
- size &= 15;
- }
+ srcy += size>>4;
+ size &= 15;
+ }
- for(; size > 0; size--)
- {
- *srcy++ = m_YTbl[*srcy];
- }
- }
+ for(; size > 0; size--)
+ {
+ *srcy++ = m_YTbl[*srcy];
+ }
+ }
- pitch /= 2;
- w /= 2;
- h /= 2;
-
- if(fabs(m_hue) > EPSILON || fabs(m_sat - 1.0) > EPSILON)
- {
- for(int size = pitch * h; size > 0; size--)
- {
- WORD uv = (*srcv << 8) | *srcu;
- *srcu++ = m_UTbl[uv];
- *srcv++ = m_VTbl[uv];
- }
- }
+ pitch /= 2;
+ w /= 2;
+ h /= 2;
+
+ if(fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON)
+ {
+ for(int size = pitch*h; size > 0; size--)
+ {
+ WORD uv = (*srcv<<8)|*srcu;
+ *srcu++ = m_UTbl[uv];
+ *srcv++ = m_VTbl[uv];
+ }
+ }
}
STDMETHODIMP CMpeg2DecFilter::SetBrightness(float bright)
{
- CAutoLock cAutoLock(&m_csProps);
- CalcBrCont(m_YTbl, m_bright = bright, m_cont);
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ CalcBrCont(m_YTbl, m_bright = bright, m_cont);
+ return S_OK;
}
STDMETHODIMP CMpeg2DecFilter::SetContrast(float cont)
{
- CAutoLock cAutoLock(&m_csProps);
- CalcBrCont(m_YTbl, m_bright, m_cont = cont);
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ CalcBrCont(m_YTbl, m_bright, m_cont = cont);
+ return S_OK;
}
STDMETHODIMP CMpeg2DecFilter::SetHue(float hue)
{
- CAutoLock cAutoLock(&m_csProps);
- CalcHueSat(m_UTbl, m_VTbl, m_hue = hue, m_sat);
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ CalcHueSat(m_UTbl, m_VTbl, m_hue = hue, m_sat);
+ return S_OK;
}
STDMETHODIMP CMpeg2DecFilter::SetSaturation(float sat)
{
- CAutoLock cAutoLock(&m_csProps);
- CalcHueSat(m_UTbl, m_VTbl, m_hue, m_sat = sat);
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ CalcHueSat(m_UTbl, m_VTbl, m_hue, m_sat = sat);
+ return S_OK;
}
STDMETHODIMP_(float) CMpeg2DecFilter::GetBrightness()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_bright;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_bright;
}
STDMETHODIMP_(float) CMpeg2DecFilter::GetContrast()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_cont;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_cont;
}
STDMETHODIMP_(float) CMpeg2DecFilter::GetHue()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_hue;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_hue;
}
STDMETHODIMP_(float) CMpeg2DecFilter::GetSaturation()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_sat;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_sat;
}
STDMETHODIMP CMpeg2DecFilter::EnableForcedSubtitles(bool fEnable)
{
- CAutoLock cAutoLock(&m_csProps);
- m_fForcedSubs = fEnable;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_fForcedSubs = fEnable;
+ return S_OK;
}
STDMETHODIMP_(bool) CMpeg2DecFilter::IsForcedSubtitlesEnabled()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_fForcedSubs;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fForcedSubs;
}
STDMETHODIMP CMpeg2DecFilter::EnablePlanarYUV(bool fEnable)
{
- CAutoLock cAutoLock(&m_csProps);
- m_fPlanarYUV = fEnable;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_fPlanarYUV = fEnable;
+ return S_OK;
}
STDMETHODIMP_(bool) CMpeg2DecFilter::IsPlanarYUVEnabled()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_fPlanarYUV;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fPlanarYUV;
}
STDMETHODIMP CMpeg2DecFilter::EnableInterlaced(bool fEnable)
{
- CAutoLock cAutoLock(&m_csProps);
- m_fInterlaced = fEnable;
- return S_OK;
+ CAutoLock cAutoLock(&m_csProps);
+ m_fInterlaced = fEnable;
+ return S_OK;
}
STDMETHODIMP_(bool) CMpeg2DecFilter::IsInterlacedEnabled()
{
- CAutoLock cAutoLock(&m_csProps);
- return m_fInterlaced;
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fInterlaced;
}
//
@@ -1180,185 +1166,185 @@ STDMETHODIMP_(bool) CMpeg2DecFilter::IsInterlacedEnabled()
//
CMpeg2DecInputPin::CMpeg2DecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
- : CDeCSSInputPin(NAME("CMpeg2DecInputPin"), pFilter, phr, pName)
+ : CDeCSSInputPin(NAME("CMpeg2DecInputPin"), pFilter, phr, pName)
{
- m_CorrectTS = 0;
- m_ratechange.Rate = 10000;
- m_ratechange.StartTime = _I64_MAX;
+ m_CorrectTS = 0;
+ m_ratechange.Rate = 10000;
+ m_ratechange.StartTime = _I64_MAX;
}
// IKsPropertySet
STDMETHODIMP CMpeg2DecInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
- if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
- return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
-
- if(PropSet == AM_KSPROPSETID_TSRateChange)
- switch(Id)
- {
- case AM_RATE_SimpleRateChange:
- {
- AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
- if(!m_CorrectTS) return E_PROP_ID_UNSUPPORTED;
- CAutoLock cAutoLock(&m_csRateLock);
- m_ratechange = *p;
- DbgLog((LOG_TRACE, 0, _T("StartTime=%I64d, Rate=%d"), p->StartTime, p->Rate));
- }
- break;
- case AM_RATE_UseRateVersion:
- {
- WORD* p = (WORD*)pPropertyData;
- if(*p > 0x0101) return E_PROP_ID_UNSUPPORTED;
- }
- break;
- case AM_RATE_CorrectTS:
- {
- LONG* p = (LONG*)pPropertyData;
- m_CorrectTS = *p;
- }
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
- /*
- if(PropSet == AM_KSPROPSETID_DVD_RateChange)
- switch(Id)
- {
- case AM_RATE_ChangeRate:
- {
- AM_DVD_ChangeRate* p = (AM_DVD_ChangeRate*)pPropertyData;
- }
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
- */
- return S_OK;
+ if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
+ return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
+
+ if(PropSet == AM_KSPROPSETID_TSRateChange)
+ switch(Id)
+ {
+ case AM_RATE_SimpleRateChange:
+ {
+ AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
+ if(!m_CorrectTS) return E_PROP_ID_UNSUPPORTED;
+ CAutoLock cAutoLock(&m_csRateLock);
+ m_ratechange = *p;
+ DbgLog((LOG_TRACE, 0, _T("StartTime=%I64d, Rate=%d"), p->StartTime, p->Rate));
+ }
+ break;
+ case AM_RATE_UseRateVersion:
+ {
+ WORD* p = (WORD*)pPropertyData;
+ if(*p > 0x0101) return E_PROP_ID_UNSUPPORTED;
+ }
+ break;
+ case AM_RATE_CorrectTS:
+ {
+ LONG* p = (LONG*)pPropertyData;
+ m_CorrectTS = *p;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+/*
+ if(PropSet == AM_KSPROPSETID_DVD_RateChange)
+ switch(Id)
+ {
+ case AM_RATE_ChangeRate:
+ {
+ AM_DVD_ChangeRate* p = (AM_DVD_ChangeRate*)pPropertyData;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+*/
+ return S_OK;
}
STDMETHODIMP CMpeg2DecInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
{
- if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
- return __super::Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
-
- if(PropSet == AM_KSPROPSETID_TSRateChange)
- switch(Id)
- {
- case AM_RATE_SimpleRateChange:
- {
- AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
- return E_PROP_ID_UNSUPPORTED;
- }
- break;
- case AM_RATE_MaxFullDataRate:
- {
- AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
- *p = 8 * 10000;
- *pBytesReturned = sizeof(AM_MaxFullDataRate);
- }
- break;
- case AM_RATE_QueryFullFrameRate:
- {
- AM_QueryRate* p = (AM_QueryRate*)pPropertyData;
- p->lMaxForwardFullFrame = 8 * 10000;
- p->lMaxReverseFullFrame = 8 * 10000;
- *pBytesReturned = sizeof(AM_QueryRate);
- }
- break;
- case AM_RATE_QueryLastRateSegPTS:
- {
- REFERENCE_TIME* p = (REFERENCE_TIME*)pPropertyData;
- return E_PROP_ID_UNSUPPORTED;
- }
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
- /*
- if(PropSet == AM_KSPROPSETID_DVD_RateChange)
- switch(Id)
- {
- case AM_RATE_FullDataRateMax:
- {
- AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
- }
- break;
- case AM_RATE_ReverseDecode:
- {
- LONG* p = (LONG*)pPropertyData;
- }
- break;
- case AM_RATE_DecoderPosition:
- {
- AM_DVD_DecoderPosition* p = (AM_DVD_DecoderPosition*)pPropertyData;
- }
- break;
- case AM_RATE_DecoderVersion:
- {
- LONG* p = (LONG*)pPropertyData;
- }
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
- */
- return S_OK;
+ if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
+ return __super::Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
+
+ if(PropSet == AM_KSPROPSETID_TSRateChange)
+ switch(Id)
+ {
+ case AM_RATE_SimpleRateChange:
+ {
+ AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
+ return E_PROP_ID_UNSUPPORTED;
+ }
+ break;
+ case AM_RATE_MaxFullDataRate:
+ {
+ AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
+ *p = 8*10000;
+ *pBytesReturned = sizeof(AM_MaxFullDataRate);
+ }
+ break;
+ case AM_RATE_QueryFullFrameRate:
+ {
+ AM_QueryRate* p = (AM_QueryRate*)pPropertyData;
+ p->lMaxForwardFullFrame = 8*10000;
+ p->lMaxReverseFullFrame = 8*10000;
+ *pBytesReturned = sizeof(AM_QueryRate);
+ }
+ break;
+ case AM_RATE_QueryLastRateSegPTS:
+ {
+ REFERENCE_TIME* p = (REFERENCE_TIME*)pPropertyData;
+ return E_PROP_ID_UNSUPPORTED;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+/*
+ if(PropSet == AM_KSPROPSETID_DVD_RateChange)
+ switch(Id)
+ {
+ case AM_RATE_FullDataRateMax:
+ {
+ AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
+ }
+ break;
+ case AM_RATE_ReverseDecode:
+ {
+ LONG* p = (LONG*)pPropertyData;
+ }
+ break;
+ case AM_RATE_DecoderPosition:
+ {
+ AM_DVD_DecoderPosition* p = (AM_DVD_DecoderPosition*)pPropertyData;
+ }
+ break;
+ case AM_RATE_DecoderVersion:
+ {
+ LONG* p = (LONG*)pPropertyData;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+*/
+ return S_OK;
}
STDMETHODIMP CMpeg2DecInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
- if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
- return __super::QuerySupported(PropSet, Id, pTypeSupport);
-
- if(PropSet == AM_KSPROPSETID_TSRateChange)
- switch(Id)
- {
- case AM_RATE_SimpleRateChange:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
- break;
- case AM_RATE_MaxFullDataRate:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- case AM_RATE_UseRateVersion:
- *pTypeSupport = KSPROPERTY_SUPPORT_SET;
- break;
- case AM_RATE_QueryFullFrameRate:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- case AM_RATE_QueryLastRateSegPTS:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- case AM_RATE_CorrectTS:
- *pTypeSupport = KSPROPERTY_SUPPORT_SET;
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
- /*
- if(PropSet == AM_KSPROPSETID_DVD_RateChange)
- switch(Id)
- {
- case AM_RATE_ChangeRate:
- *pTypeSupport = KSPROPERTY_SUPPORT_SET;
- break;
- case AM_RATE_FullDataRateMax:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- case AM_RATE_ReverseDecode:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- case AM_RATE_DecoderPosition:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- case AM_RATE_DecoderVersion:
- *pTypeSupport = KSPROPERTY_SUPPORT_GET;
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
- */
- return S_OK;
+ if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
+ return __super::QuerySupported(PropSet, Id, pTypeSupport);
+
+ if(PropSet == AM_KSPROPSETID_TSRateChange)
+ switch(Id)
+ {
+ case AM_RATE_SimpleRateChange:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_RATE_MaxFullDataRate:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_UseRateVersion:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_RATE_QueryFullFrameRate:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_QueryLastRateSegPTS:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_CorrectTS:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+/*
+ if(PropSet == AM_KSPROPSETID_DVD_RateChange)
+ switch(Id)
+ {
+ case AM_RATE_ChangeRate:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_RATE_FullDataRateMax:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_ReverseDecode:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_DecoderPosition:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_DecoderVersion:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+*/
+ return S_OK;
}
//
@@ -1366,70 +1352,70 @@ STDMETHODIMP CMpeg2DecInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG*
//
CMpeg2DecOutputPin::CMpeg2DecOutputPin(CBaseVideoFilter* pFilter, HRESULT* phr, LPWSTR pName)
- : CBaseVideoOutputPin(NAME("CMpeg2DecOutputPin"), pFilter, phr, pName)
+ : CBaseVideoOutputPin(NAME("CMpeg2DecOutputPin"), pFilter, phr, pName)
{
}
HRESULT CMpeg2DecOutputPin::Active()
{
- CAutoLock cAutoLock(m_pLock);
+ CAutoLock cAutoLock(m_pLock);
- // TODO
+ // TODO
- if(m_Connected && !m_pOutputQueue)
- {
- HRESULT hr = NOERROR;
+ if(m_Connected && !m_pOutputQueue)
+ {
+ HRESULT hr = NOERROR;
- m_pOutputQueue.Attach(DNew COutputQueue(m_Connected, &hr));
- if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
+ m_pOutputQueue.Attach(DNew COutputQueue(m_Connected, &hr));
+ if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
- if(FAILED(hr))
- {
- m_pOutputQueue.Free();
- return hr;
- }
- }
+ if(FAILED(hr))
+ {
+ m_pOutputQueue.Free();
+ return hr;
+ }
+ }
- return __super::Active();
+ return __super::Active();
}
HRESULT CMpeg2DecOutputPin::Inactive()
{
- CAutoLock cAutoLock(m_pLock);
- m_pOutputQueue.Free();
- return __super::Inactive();
+ CAutoLock cAutoLock(m_pLock);
+ m_pOutputQueue.Free();
+ return __super::Inactive();
}
HRESULT CMpeg2DecOutputPin::Deliver(IMediaSample* pMediaSample)
{
- if(!m_pOutputQueue) return NOERROR;
- pMediaSample->AddRef();
- return m_pOutputQueue->Receive(pMediaSample);
+ if(!m_pOutputQueue) return NOERROR;
+ pMediaSample->AddRef();
+ return m_pOutputQueue->Receive(pMediaSample);
}
#define CallQueue(call) \
if(!m_pOutputQueue) return NOERROR; \
m_pOutputQueue->##call; \
return NOERROR; \
-
+
HRESULT CMpeg2DecOutputPin::DeliverEndOfStream()
{
- CallQueue(EOS());
+ CallQueue(EOS());
}
HRESULT CMpeg2DecOutputPin::DeliverBeginFlush()
{
- CallQueue(BeginFlush());
+ CallQueue(BeginFlush());
}
HRESULT CMpeg2DecOutputPin::DeliverEndFlush()
{
- CallQueue(EndFlush());
+ CallQueue(EndFlush());
}
HRESULT CMpeg2DecOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- CallQueue(NewSegment(tStart, tStop, dRate));
+ CallQueue(NewSegment(tStart, tStop, dRate));
}
@@ -1439,771 +1425,733 @@ HRESULT CMpeg2DecOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_T
#define PTS2RT(pts) (10000i64*pts/90)
-CSubpicInputPin::CSubpicInputPin(CTransformFilter* pFilter, HRESULT* phr)
- : CMpeg2DecInputPin(pFilter, phr, L"SubPicture")
- , m_spon(TRUE)
- , m_fsppal(false)
+CSubpicInputPin::CSubpicInputPin(CTransformFilter* pFilter, HRESULT* phr)
+ : CMpeg2DecInputPin(pFilter, phr, L"SubPicture")
+ , m_spon(TRUE)
+ , m_fsppal(false)
{
- m_sppal[0].Y = 0x00;
- m_sppal[0].U = m_sppal[0].V = 0x80;
- m_sppal[1].Y = 0xe0;
- m_sppal[1].U = m_sppal[1].V = 0x80;
- m_sppal[2].Y = 0x80;
- m_sppal[2].U = m_sppal[2].V = 0x80;
- m_sppal[3].Y = 0x20;
- m_sppal[3].U = m_sppal[3].V = 0x80;
+ m_sppal[0].Y = 0x00;
+ m_sppal[0].U = m_sppal[0].V = 0x80;
+ m_sppal[1].Y = 0xe0;
+ m_sppal[1].U = m_sppal[1].V = 0x80;
+ m_sppal[2].Y = 0x80;
+ m_sppal[2].U = m_sppal[2].V = 0x80;
+ m_sppal[3].Y = 0x20;
+ m_sppal[3].U = m_sppal[3].V = 0x80;
}
HRESULT CSubpicInputPin::CheckMediaType(const CMediaType* mtIn)
{
- return (mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
- || mtIn->majortype == MEDIATYPE_MPEG2_PACK
- || mtIn->majortype == MEDIATYPE_MPEG2_PES
- || mtIn->majortype == MEDIATYPE_Video)
- && (mtIn->subtype == MEDIASUBTYPE_DVD_SUBPICTURE
- || mtIn->subtype == MEDIASUBTYPE_CVD_SUBPICTURE
- || mtIn->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return (mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ || mtIn->majortype == MEDIATYPE_MPEG2_PACK
+ || mtIn->majortype == MEDIATYPE_MPEG2_PES
+ || mtIn->majortype == MEDIATYPE_Video)
+ && (mtIn->subtype == MEDIASUBTYPE_DVD_SUBPICTURE
+ || mtIn->subtype == MEDIASUBTYPE_CVD_SUBPICTURE
+ || mtIn->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CSubpicInputPin::SetMediaType(const CMediaType* mtIn)
{
- return CBasePin::SetMediaType(mtIn);
+ return CBasePin::SetMediaType(mtIn);
}
bool CSubpicInputPin::HasAnythingToRender(REFERENCE_TIME rt)
{
- if(!IsConnected()) return(false);
+ if(!IsConnected()) return(false);
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- POSITION pos = m_sps.GetHeadPosition();
- while(pos)
- {
- spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStart <= rt && rt < sp->m_rtStop && (/*sp->m_psphli ||*/ sp->m_fForced || m_spon))
- return(true);
- }
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStart <= rt && rt < sp->m_rtStop && (/*sp->m_psphli ||*/ sp->m_fForced || m_spon))
+ return(true);
+ }
- return(false);
+ return(false);
}
void CSubpicInputPin::RenderSubpics(REFERENCE_TIME rt, BYTE** yuv, int w, int h)
{
- CAutoLock cAutoLock(&m_csReceive);
+ CAutoLock cAutoLock(&m_csReceive);
- POSITION pos;
+ POSITION pos;
- // remove no longer needed things first
- pos = m_sps.GetHeadPosition();
- while(pos)
- {
- POSITION cur = pos;
- spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStop <= rt) m_sps.RemoveAt(cur);
- }
+ // remove no longer needed things first
+ pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStop <= rt) m_sps.RemoveAt(cur);
+ }
- pos = m_sps.GetHeadPosition();
- while(pos)
- {
- spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStart <= rt && rt < sp->m_rtStop
- && (m_spon || sp->m_fForced && ((static_cast<CMpeg2DecFilter*>(m_pFilter))->IsForcedSubtitlesEnabled() || sp->m_psphli)))
- sp->Render(rt, yuv, w, h, m_sppal, m_fsppal);
- }
+ pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStart <= rt && rt < sp->m_rtStop
+ && (m_spon || sp->m_fForced && ((static_cast<CMpeg2DecFilter*>(m_pFilter))->IsForcedSubtitlesEnabled() || sp->m_psphli)))
+ sp->Render(rt, yuv, w, h, m_sppal, m_fsppal);
+ }
}
HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
{
- HRESULT hr;
-
- AM_MEDIA_TYPE* pmt;
- if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
- {
- CMediaType mt(*pmt);
- SetMediaType(&mt);
- DeleteMediaType(pmt);
- }
-
- BYTE* pDataIn = NULL;
- if(FAILED(hr = pSample->GetPointer(&pDataIn))) return hr;
-
- long len = pSample->GetActualDataLength();
-
- StripPacket(pDataIn, len);
-
- if(len <= 0) return S_FALSE;
-
- if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
- {
- pDataIn += 4;
- len -= 4;
- }
-
- if(len <= 0) return S_FALSE;
-
- CAutoLock cAutoLock(&m_csReceive);
-
- REFERENCE_TIME rtStart = 0, rtStop = 0;
- hr = pSample->GetTime(&rtStart, &rtStop);
-
- bool fRefresh = false;
-
- if(FAILED(hr))
- {
- if(!m_sps.IsEmpty())
- {
- spu* sp = m_sps.GetTail();
- sp->SetCount(sp->GetCount() + len);
- memcpy(sp->GetData() + sp->GetCount() - len, pDataIn, len);
- }
- }
- else
- {
- POSITION pos = m_sps.GetTailPosition();
- while(pos)
- {
- POSITION cur = pos;
- spu* sp = m_sps.GetPrev(pos);
- if(sp->m_rtStop == _I64_MAX)
- {
- sp->m_rtStop = rtStart;
- break;
- }
- }
-
- CAutoPtr<spu> p;
-
- if(m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) p.Attach(DNew dvdspu());
- else if(m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) p.Attach(DNew cvdspu());
- else if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) p.Attach(DNew svcdspu());
- else return E_FAIL;
-
- p->m_rtStart = rtStart;
- p->m_rtStop = _I64_MAX;
-
- p->SetCount(len);
- memcpy(p->GetData(), pDataIn, len);
-
- if(m_sphli && p->m_rtStart == PTS2RT(m_sphli->StartPTM))
- {
- p->m_psphli = m_sphli;
- fRefresh = true;
- }
-
- m_sps.AddTail(p);
- }
-
- if(!m_sps.IsEmpty())
- {
- m_sps.GetTail()->Parse();
- }
-
- if(fRefresh)
- {
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pDataIn))) return hr;
+
+ long len = pSample->GetActualDataLength();
+
+ StripPacket(pDataIn, len);
+
+ if(len <= 0) return S_FALSE;
+
+ if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
+ {
+ pDataIn += 4;
+ len -= 4;
+ }
+
+ if(len <= 0) return S_FALSE;
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ REFERENCE_TIME rtStart = 0, rtStop = 0;
+ hr = pSample->GetTime(&rtStart, &rtStop);
+
+ bool fRefresh = false;
+
+ if(FAILED(hr))
+ {
+ if(!m_sps.IsEmpty())
+ {
+ spu* sp = m_sps.GetTail();
+ sp->SetCount(sp->GetCount() + len);
+ memcpy(sp->GetData() + sp->GetCount() - len, pDataIn, len);
+ }
+ }
+ else
+ {
+ POSITION pos = m_sps.GetTailPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ spu* sp = m_sps.GetPrev(pos);
+ if(sp->m_rtStop == _I64_MAX)
+ {
+ sp->m_rtStop = rtStart;
+ break;
+ }
+ }
+
+ CAutoPtr<spu> p;
+
+ if(m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) p.Attach(DNew dvdspu());
+ else if(m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) p.Attach(DNew cvdspu());
+ else if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) p.Attach(DNew svcdspu());
+ else return E_FAIL;
+
+ p->m_rtStart = rtStart;
+ p->m_rtStop = _I64_MAX;
+
+ p->SetCount(len);
+ memcpy(p->GetData(), pDataIn, len);
+
+ if(m_sphli && p->m_rtStart == PTS2RT(m_sphli->StartPTM))
+ {
+ p->m_psphli = m_sphli;
+ fRefresh = true;
+ }
+
+ m_sps.AddTail(p);
+ }
+
+ if(!m_sps.IsEmpty())
+ {
+ m_sps.GetTail()->Parse();
+ }
+
+ if(fRefresh)
+ {
// ((CMpeg2DecFilter*)m_pFilter)->Deliver(true);
- }
+ }
- return S_FALSE;
+ return S_FALSE;
}
STDMETHODIMP CSubpicInputPin::EndFlush()
{
- CAutoLock cAutoLock(&m_csReceive);
- m_sps.RemoveAll();
- return S_OK;
+ CAutoLock cAutoLock(&m_csReceive);
+ m_sps.RemoveAll();
+ return S_OK;
}
// IKsPropertySet
STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
- if(PropSet != AM_KSPROPSETID_DvdSubPic)
- return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
-
- bool fRefresh = false;
-
- switch(Id)
- {
- case AM_PROPERTY_DVDSUBPIC_PALETTE:
- {
- CAutoLock cAutoLock(&m_csReceive);
-
- AM_PROPERTY_SPPAL* pSPPAL = (AM_PROPERTY_SPPAL*)pPropertyData;
- memcpy(m_sppal, pSPPAL->sppal, sizeof(AM_PROPERTY_SPPAL));
- m_fsppal = true;
-
- DbgLog((LOG_TRACE, 0, _T("new palette")));
- }
- break;
- case AM_PROPERTY_DVDSUBPIC_HLI:
- {
- CAutoLock cAutoLock(&m_csReceive);
-
- AM_PROPERTY_SPHLI* pSPHLI = (AM_PROPERTY_SPHLI*)pPropertyData;
-
- m_sphli.Free();
-
- if(pSPHLI->HLISS)
- {
- POSITION pos = m_sps.GetHeadPosition();
- while(pos)
- {
- spu* sp = m_sps.GetNext(pos);
- if(sp->m_rtStart <= PTS2RT(pSPHLI->StartPTM) && PTS2RT(pSPHLI->StartPTM) < sp->m_rtStop)
- {
- fRefresh = true;
- sp->m_psphli.Free();
- sp->m_psphli.Attach(DNew AM_PROPERTY_SPHLI);
- memcpy((AM_PROPERTY_SPHLI*)sp->m_psphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
- }
- }
-
- if(!fRefresh) // save it for later, a subpic might be late for this hli
- {
- m_sphli.Attach(DNew AM_PROPERTY_SPHLI);
- memcpy((AM_PROPERTY_SPHLI*)m_sphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
- }
- }
- else
- {
- POSITION pos = m_sps.GetHeadPosition();
- while(pos)
- {
- spu* sp = m_sps.GetNext(pos);
- fRefresh |= !!sp->m_psphli;
- sp->m_psphli.Free();
- }
- }
-
- if(pSPHLI->HLISS)
- DbgLog((LOG_TRACE, 0, _T("hli: %I64d - %I64d, (%d,%d) - (%d,%d)"),
- PTS2RT(pSPHLI->StartPTM) / 10000, PTS2RT(pSPHLI->EndPTM) / 10000,
- pSPHLI->StartX, pSPHLI->StartY, pSPHLI->StopX, pSPHLI->StopY));
- }
- break;
- case AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON:
- {
- CAutoLock cAutoLock(&m_csReceive);
-
- AM_PROPERTY_COMPOSIT_ON* pCompositOn = (AM_PROPERTY_COMPOSIT_ON*)pPropertyData;
- m_spon = *pCompositOn;
- }
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
-
- if(fRefresh)
- {
- (static_cast<CMpeg2DecFilter*>(m_pFilter))->Deliver(true);
- }
-
- return S_OK;
+ if(PropSet != AM_KSPROPSETID_DvdSubPic)
+ return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
+
+ bool fRefresh = false;
+
+ switch(Id)
+ {
+ case AM_PROPERTY_DVDSUBPIC_PALETTE:
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ AM_PROPERTY_SPPAL* pSPPAL = (AM_PROPERTY_SPPAL*)pPropertyData;
+ memcpy(m_sppal, pSPPAL->sppal, sizeof(AM_PROPERTY_SPPAL));
+ m_fsppal = true;
+
+ DbgLog((LOG_TRACE, 0, _T("new palette")));
+ }
+ break;
+ case AM_PROPERTY_DVDSUBPIC_HLI:
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ AM_PROPERTY_SPHLI* pSPHLI = (AM_PROPERTY_SPHLI*)pPropertyData;
+
+ m_sphli.Free();
+
+ if(pSPHLI->HLISS)
+ {
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStart <= PTS2RT(pSPHLI->StartPTM) && PTS2RT(pSPHLI->StartPTM) < sp->m_rtStop)
+ {
+ fRefresh = true;
+ sp->m_psphli.Free();
+ sp->m_psphli.Attach(DNew AM_PROPERTY_SPHLI);
+ memcpy((AM_PROPERTY_SPHLI*)sp->m_psphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
+ }
+ }
+
+ if(!fRefresh) // save it for later, a subpic might be late for this hli
+ {
+ m_sphli.Attach(DNew AM_PROPERTY_SPHLI);
+ memcpy((AM_PROPERTY_SPHLI*)m_sphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
+ }
+ }
+ else
+ {
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ fRefresh |= !!sp->m_psphli;
+ sp->m_psphli.Free();
+ }
+ }
+
+ if(pSPHLI->HLISS)
+ DbgLog((LOG_TRACE, 0, _T("hli: %I64d - %I64d, (%d,%d) - (%d,%d)"),
+ PTS2RT(pSPHLI->StartPTM)/10000, PTS2RT(pSPHLI->EndPTM)/10000,
+ pSPHLI->StartX, pSPHLI->StartY, pSPHLI->StopX, pSPHLI->StopY));
+ }
+ break;
+ case AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON:
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ AM_PROPERTY_COMPOSIT_ON* pCompositOn = (AM_PROPERTY_COMPOSIT_ON*)pPropertyData;
+ m_spon = *pCompositOn;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ if(fRefresh)
+ {
+ (static_cast<CMpeg2DecFilter*>(m_pFilter))->Deliver(true);
+ }
+
+ return S_OK;
}
STDMETHODIMP CSubpicInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
- if(PropSet != AM_KSPROPSETID_DvdSubPic)
- return __super::QuerySupported(PropSet, Id, pTypeSupport);
-
- switch(Id)
- {
- case AM_PROPERTY_DVDSUBPIC_PALETTE:
- *pTypeSupport = KSPROPERTY_SUPPORT_SET;
- break;
- case AM_PROPERTY_DVDSUBPIC_HLI:
- *pTypeSupport = KSPROPERTY_SUPPORT_SET;
- break;
- case AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON:
- *pTypeSupport = KSPROPERTY_SUPPORT_SET;
- break;
- default:
- return E_PROP_ID_UNSUPPORTED;
- }
-
- return S_OK;
+ if(PropSet != AM_KSPROPSETID_DvdSubPic)
+ return __super::QuerySupported(PropSet, Id, pTypeSupport);
+
+ switch(Id)
+ {
+ case AM_PROPERTY_DVDSUBPIC_PALETTE:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDSUBPIC_HLI:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
}
// CSubpicInputPin::spu
static __inline BYTE GetNibble(BYTE* p, DWORD* offset, int& nField, int& fAligned)
{
- BYTE ret = (p[offset[nField]] >> (fAligned << 2)) & 0x0f;
- offset[nField] += 1 - fAligned;
- fAligned = !fAligned;
+ BYTE ret = (p[offset[nField]] >> (fAligned << 2)) & 0x0f;
+ offset[nField] += 1-fAligned;
+ fAligned = !fAligned;
return ret;
}
static __inline BYTE GetHalfNibble(BYTE* p, DWORD* offset, int& nField, int& n)
{
- BYTE ret = (p[offset[nField]] >> (n << 1)) & 0x03;
- if(!n) offset[nField]++;
- n = (n - 1 + 4) & 3;
+ BYTE ret = (p[offset[nField]] >> (n << 1)) & 0x03;
+ if(!n) offset[nField]++;
+ n = (n-1+4)&3;
return ret;
}
static __inline void DrawPixel(BYTE** yuv, CPoint pt, int pitch, AM_DVD_YUV& c)
{
- if(c.Reserved == 0) return;
+ if(c.Reserved == 0) return;
- BYTE* p = &yuv[0][pt.y*pitch + pt.x];
+ BYTE* p = &yuv[0][pt.y*pitch + pt.x];
// *p = (*p*(15-contrast) + sppal[color].Y*contrast)>>4;
- *p -= (*p - c.Y) * c.Reserved >> 4;
+ *p -= (*p - c.Y) * c.Reserved >> 4;
- if(pt.y & 1) return; // since U/V is half res there is no need to overwrite the same line again
+ if(pt.y&1) return; // since U/V is half res there is no need to overwrite the same line again
- pt.x = (pt.x + 1) / 2;
- pt.y = (pt.y /*+ 1*/) / 2; // only paint the upper field always, don't round it
- pitch /= 2;
+ pt.x = (pt.x + 1) / 2;
+ pt.y = (pt.y /*+ 1*/) / 2; // only paint the upper field always, don't round it
+ pitch /= 2;
- // U/V is exchanged? wierd but looks true when comparing the outputted colors from other decoders
+ // U/V is exchanged? wierd but looks true when comparing the outputted colors from other decoders
- p = &yuv[1][pt.y*pitch + pt.x];
+ p = &yuv[1][pt.y*pitch + pt.x];
// *p = (BYTE)(((((int)*p-0x80)*(15-contrast) + ((int)sppal[color].V-0x80)*contrast) >> 4) + 0x80);
- *p -= (*p - c.V) * c.Reserved >> 4;
+ *p -= (*p - c.V) * c.Reserved >> 4;
- p = &yuv[2][pt.y*pitch + pt.x];
+ p = &yuv[2][pt.y*pitch + pt.x];
// *p = (BYTE)(((((int)*p-0x80)*(15-contrast) + ((int)sppal[color].U-0x80)*contrast) >> 4) + 0x80);
- *p -= (*p - c.U) * c.Reserved >> 4;
+ *p -= (*p - c.U) * c.Reserved >> 4;
- // Neighter of the blending formulas are accurate (">>4" should be "/15").
- // Even though the second one is a bit worse, since we are scaling the difference only,
- // the error is still not noticable.
+ // Neighter of the blending formulas are accurate (">>4" should be "/15").
+ // Even though the second one is a bit worse, since we are scaling the difference only,
+ // the error is still not noticable.
}
static __inline void DrawPixels(BYTE** yuv, int pitch, CPoint pt, int len, AM_DVD_YUV& c, CRect& rc)
{
if(pt.y < rc.top || pt.y >= rc.bottom) return;
- if(pt.x < rc.left)
- {
- len -= rc.left - pt.x;
- pt.x = rc.left;
- }
- if(pt.x + len > rc.right) len = rc.right - pt.x;
- if(len <= 0 || pt.x >= rc.right) return;
+ if(pt.x < rc.left) {len -= rc.left - pt.x; pt.x = rc.left;}
+ if(pt.x + len > rc.right) len = rc.right - pt.x;
+ if(len <= 0 || pt.x >= rc.right) return;
- if(c.Reserved == 0)
- {
- if(rc.IsRectEmpty())
- return;
+ if(c.Reserved == 0)
+ {
+ if(rc.IsRectEmpty())
+ return;
- if(pt.y < rc.top || pt.y >= rc.bottom
- || pt.x + len < rc.left || pt.x >= rc.right)
- return;
- }
+ if(pt.y < rc.top || pt.y >= rc.bottom
+ || pt.x+len < rc.left || pt.x >= rc.right)
+ return;
+ }
- while(len-- > 0)
- {
- DrawPixel(yuv, pt, pitch, c);
- pt.x++;
- }
+ while(len-- > 0)
+ {
+ DrawPixel(yuv, pt, pitch, c);
+ pt.x++;
+ }
}
// CSubpicInputPin::dvdspu
bool CSubpicInputPin::dvdspu::Parse()
{
- m_offsets.RemoveAll();
+ m_offsets.RemoveAll();
- BYTE* p = GetData();
+ BYTE* p = GetData();
- WORD packetsize = (p[0] << 8) | p[1];
- WORD datasize = (p[2] << 8) | p[3];
+ WORD packetsize = (p[0]<<8)|p[1];
+ WORD datasize = (p[2]<<8)|p[3];
if(packetsize > GetCount() || datasize > packetsize)
- return(false);
-
- int i, next = datasize;
-
-#define GetWORD (p[i]<<8)|p[i+1]; i += 2
-
- do
- {
- i = next;
-
- int pts = GetWORD;
- next = GetWORD;
-
- if(next > packetsize || next < datasize)
- return(false);
-
- REFERENCE_TIME rt = m_rtStart + 1024 * PTS2RT(pts);
-
- for(bool fBreak = false; !fBreak;)
- {
- int len = 0;
-
- switch(p[i])
- {
- case 0x00:
- len = 0;
- break;
- case 0x01:
- len = 0;
- break;
- case 0x02:
- len = 0;
- break;
- case 0x03:
- len = 2;
- break;
- case 0x04:
- len = 2;
- break;
- case 0x05:
- len = 6;
- break;
- case 0x06:
- len = 4;
- break;
- case 0x07:
- len = 0;
- break; // TODO
- default:
- len = 0;
- break;
- }
-
- if(i + len >= packetsize)
- {
- TRACE(_T("Warning: Wrong subpicture parameter block ending\n"));
- break;
- }
-
- switch(p[i++])
- {
- case 0x00: // forced start displaying
- m_fForced = true;
- break;
- case 0x01: // normal start displaying
- m_fForced = false;
- break;
- case 0x02: // stop displaying
- m_rtStop = rt;
- break;
- case 0x03:
- m_sphli.ColCon.emph2col = p[i] >> 4;
- m_sphli.ColCon.emph1col = p[i] & 0xf;
- m_sphli.ColCon.patcol = p[i+1] >> 4;
- m_sphli.ColCon.backcol = p[i+1] & 0xf;
- i += 2;
- break;
- case 0x04:
- m_sphli.ColCon.emph2con = p[i] >> 4;
- m_sphli.ColCon.emph1con = p[i] & 0xf;
- m_sphli.ColCon.patcon = p[i+1] >> 4;
- m_sphli.ColCon.backcon = p[i+1] & 0xf;
- i += 2;
- break;
- case 0x05:
- m_sphli.StartX = (p[i] << 4) + (p[i+1] >> 4);
- m_sphli.StopX = ((p[i+1] & 0x0f) << 8) + p[i+2] + 1;
- m_sphli.StartY = (p[i+3] << 4) + (p[i+4] >> 4);
- m_sphli.StopY = ((p[i+4] & 0x0f) << 8) + p[i+5] + 1;
- i += 6;
- break;
- case 0x06:
- m_offset[0] = GetWORD;
- m_offset[1] = GetWORD;
- break;
- case 0x07:
- // TODO
- break;
- case 0xff: // end of ctrlblk
- fBreak = true;
- continue;
- default: // skip this ctrlblk
- fBreak = true;
- break;
- }
- }
-
- offset_t o = {rt, m_sphli};
- m_offsets.AddTail(o); // is it always going to be sorted?
- }
- while(i <= next && i < packetsize);
-
- return(true);
+ return(false);
+
+ int i, next = datasize;
+
+ #define GetWORD (p[i]<<8)|p[i+1]; i += 2
+
+ do
+ {
+ i = next;
+
+ int pts = GetWORD;
+ next = GetWORD;
+
+ if(next > packetsize || next < datasize)
+ return(false);
+
+ REFERENCE_TIME rt = m_rtStart + 1024*PTS2RT(pts);
+
+ for(bool fBreak = false; !fBreak; )
+ {
+ int len = 0;
+
+ switch(p[i])
+ {
+ case 0x00: len = 0; break;
+ case 0x01: len = 0; break;
+ case 0x02: len = 0; break;
+ case 0x03: len = 2; break;
+ case 0x04: len = 2; break;
+ case 0x05: len = 6; break;
+ case 0x06: len = 4; break;
+ case 0x07: len = 0; break; // TODO
+ default: len = 0; break;
+ }
+
+ if(i+len >= packetsize)
+ {
+ TRACE(_T("Warning: Wrong subpicture parameter block ending\n"));
+ break;
+ }
+
+ switch(p[i++])
+ {
+ case 0x00: // forced start displaying
+ m_fForced = true;
+ break;
+ case 0x01: // normal start displaying
+ m_fForced = false;
+ break;
+ case 0x02: // stop displaying
+ m_rtStop = rt;
+ break;
+ case 0x03:
+ m_sphli.ColCon.emph2col = p[i]>>4;
+ m_sphli.ColCon.emph1col = p[i]&0xf;
+ m_sphli.ColCon.patcol = p[i+1]>>4;
+ m_sphli.ColCon.backcol = p[i+1]&0xf;
+ i += 2;
+ break;
+ case 0x04:
+ m_sphli.ColCon.emph2con = p[i]>>4;
+ m_sphli.ColCon.emph1con = p[i]&0xf;
+ m_sphli.ColCon.patcon = p[i+1]>>4;
+ m_sphli.ColCon.backcon = p[i+1]&0xf;
+ i += 2;
+ break;
+ case 0x05:
+ m_sphli.StartX = (p[i]<<4) + (p[i+1]>>4);
+ m_sphli.StopX = ((p[i+1]&0x0f)<<8) + p[i+2]+1;
+ m_sphli.StartY = (p[i+3]<<4) + (p[i+4]>>4);
+ m_sphli.StopY = ((p[i+4]&0x0f)<<8) + p[i+5]+1;
+ i += 6;
+ break;
+ case 0x06:
+ m_offset[0] = GetWORD;
+ m_offset[1] = GetWORD;
+ break;
+ case 0x07:
+ // TODO
+ break;
+ case 0xff: // end of ctrlblk
+ fBreak = true;
+ continue;
+ default: // skip this ctrlblk
+ fBreak = true;
+ break;
+ }
+ }
+
+ offset_t o = {rt, m_sphli};
+ m_offsets.AddTail(o); // is it always going to be sorted?
+ }
+ while(i <= next && i < packetsize);
+
+ return(true);
}
void CSubpicInputPin::dvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h, AM_DVD_YUV* sppal, bool fsppal)
{
- BYTE* p = GetData();
- DWORD offset[2] = {m_offset[0], m_offset[1]};
-
- AM_PROPERTY_SPHLI sphli = m_sphli;
- CPoint pt(sphli.StartX, sphli.StartY);
- CRect rc(pt, CPoint(sphli.StopX, sphli.StopY));
-
- CRect rcclip(0, 0, w, h);
- rcclip &= rc;
-
- if(m_psphli)
- {
- rcclip &= CRect(m_psphli->StartX, m_psphli->StartY, m_psphli->StopX, m_psphli->StopY);
- sphli = *m_psphli;
- }
- else if(m_offsets.GetCount() > 1)
- {
- POSITION pos = m_offsets.GetTailPosition();
- while(pos)
- {
- const offset_t& o = m_offsets.GetPrev(pos);
- if(rt >= o.rt)
- {
- sphli = o.sphli;
- break;
- }
- }
- }
-
- AM_DVD_YUV pal[4];
- pal[0] = sppal[fsppal ? sphli.ColCon.backcol : 0];
- pal[0].Reserved = sphli.ColCon.backcon;
- pal[1] = sppal[fsppal ? sphli.ColCon.patcol : 1];
- pal[1].Reserved = sphli.ColCon.patcon;
- pal[2] = sppal[fsppal ? sphli.ColCon.emph1col : 2];
- pal[2].Reserved = sphli.ColCon.emph1con;
- pal[3] = sppal[fsppal ? sphli.ColCon.emph2col : 3];
- pal[3].Reserved = sphli.ColCon.emph2con;
-
- int nField = 0;
- int fAligned = 1;
-
- DWORD end[2] = {offset[1], (p[2] << 8) | p[3]};
-
- while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
- {
- DWORD code;
-
- if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4
- || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x10
- || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x40
- || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x100)
- {
- DrawPixels(yuv, w, pt, code >> 2, pal[code&3], rcclip);
- if((pt.x += code >> 2) < rc.right) continue;
- }
-
- DrawPixels(yuv, w, pt, rc.right - pt.x, pal[code&3], rcclip);
-
- if(!fAligned) GetNibble(p, offset, nField, fAligned); // align to byte
-
- pt.x = rc.left;
- pt.y++;
- nField = 1 - nField;
- }
+ BYTE* p = GetData();
+ DWORD offset[2] = {m_offset[0], m_offset[1]};
+
+ AM_PROPERTY_SPHLI sphli = m_sphli;
+ CPoint pt(sphli.StartX, sphli.StartY);
+ CRect rc(pt, CPoint(sphli.StopX, sphli.StopY));
+
+ CRect rcclip(0, 0, w, h);
+ rcclip &= rc;
+
+ if(m_psphli)
+ {
+ rcclip &= CRect(m_psphli->StartX, m_psphli->StartY, m_psphli->StopX, m_psphli->StopY);
+ sphli = *m_psphli;
+ }
+ else if(m_offsets.GetCount() > 1)
+ {
+ POSITION pos = m_offsets.GetTailPosition();
+ while(pos)
+ {
+ const offset_t& o = m_offsets.GetPrev(pos);
+ if(rt >= o.rt) {sphli = o.sphli; break;}
+ }
+ }
+
+ AM_DVD_YUV pal[4];
+ pal[0] = sppal[fsppal ? sphli.ColCon.backcol : 0];
+ pal[0].Reserved = sphli.ColCon.backcon;
+ pal[1] = sppal[fsppal ? sphli.ColCon.patcol : 1];
+ pal[1].Reserved = sphli.ColCon.patcon;
+ pal[2] = sppal[fsppal ? sphli.ColCon.emph1col : 2];
+ pal[2].Reserved = sphli.ColCon.emph1con;
+ pal[3] = sppal[fsppal ? sphli.ColCon.emph2col : 3];
+ pal[3].Reserved = sphli.ColCon.emph2con;
+
+ int nField = 0;
+ int fAligned = 1;
+
+ DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
+
+ while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
+ {
+ DWORD code;
+
+ if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4
+ || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x10
+ || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x40
+ || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x100)
+ {
+ DrawPixels(yuv, w, pt, code >> 2, pal[code&3], rcclip);
+ if((pt.x += code >> 2) < rc.right) continue;
+ }
+
+ DrawPixels(yuv, w, pt, rc.right - pt.x, pal[code&3], rcclip);
+
+ if(!fAligned) GetNibble(p, offset, nField, fAligned); // align to byte
+
+ pt.x = rc.left;
+ pt.y++;
+ nField = 1 - nField;
+ }
}
// CSubpicInputPin::cvdspu
bool CSubpicInputPin::cvdspu::Parse()
{
- BYTE* p = GetData();
+ BYTE* p = GetData();
- WORD packetsize = (p[0] << 8) | p[1];
- WORD datasize = (p[2] << 8) | p[3];
+ WORD packetsize = (p[0]<<8)|p[1];
+ WORD datasize = (p[2]<<8)|p[3];
if(packetsize > GetCount() || datasize > packetsize)
- return(false);
-
- p = GetData() + datasize;
-
- for(int i = datasize, j = packetsize - 4; i <= j; i += 4, p += 4)
- {
- switch(p[0])
- {
- case 0x0c:
- break;
- case 0x04:
- m_rtStop = m_rtStart + 10000i64 * ((p[1] << 16) | (p[2] << 8) | p[3]) / 90;
- break;
- case 0x17:
- m_sphli.StartX = ((p[1] & 0x0f) << 6) + (p[2] >> 2);
- m_sphli.StartY = ((p[2] & 0x03) << 8) + p[3];
- break;
- case 0x1f:
- m_sphli.StopX = ((p[1] & 0x0f) << 6) + (p[2] >> 2);
- m_sphli.StopY = ((p[2] & 0x03) << 8) + p[3];
- break;
- case 0x24:
- case 0x25:
- case 0x26:
- case 0x27:
- m_sppal[0][p[0] - 0x24].Y = p[1];
- m_sppal[0][p[0] - 0x24].U = p[2];
- m_sppal[0][p[0] - 0x24].V = p[3];
- break;
- case 0x2c:
- case 0x2d:
- case 0x2e:
- case 0x2f:
- m_sppal[1][p[0] - 0x2c].Y = p[1];
- m_sppal[1][p[0] - 0x2c].U = p[2];
- m_sppal[1][p[0] - 0x2c].V = p[3];
- break;
- case 0x37:
- m_sppal[0][3].Reserved = p[2] >> 4;
- m_sppal[0][2].Reserved = p[2] & 0xf;
- m_sppal[0][1].Reserved = p[3] >> 4;
- m_sppal[0][0].Reserved = p[3] & 0xf;
- break;
- case 0x3f:
- m_sppal[1][3].Reserved = p[2] >> 4;
- m_sppal[1][2].Reserved = p[2] & 0xf;
- m_sppal[1][1].Reserved = p[3] >> 4;
- m_sppal[1][0].Reserved = p[3] & 0xf;
- break;
- case 0x47:
- m_offset[0] = (p[2] << 8) | p[3];
- break;
- case 0x4f:
- m_offset[1] = (p[2] << 8) | p[3];
- break;
- default:
- break;
- }
- }
-
- return(true);
+ return(false);
+
+ p = GetData() + datasize;
+
+ for(int i = datasize, j = packetsize-4; i <= j; i+=4, p+=4)
+ {
+ switch(p[0])
+ {
+ case 0x0c:
+ break;
+ case 0x04:
+ m_rtStop = m_rtStart + 10000i64*((p[1]<<16)|(p[2]<<8)|p[3])/90;
+ break;
+ case 0x17:
+ m_sphli.StartX = ((p[1]&0x0f)<<6) + (p[2]>>2);
+ m_sphli.StartY = ((p[2]&0x03)<<8) + p[3];
+ break;
+ case 0x1f:
+ m_sphli.StopX = ((p[1]&0x0f)<<6) + (p[2]>>2);
+ m_sphli.StopY = ((p[2]&0x03)<<8) + p[3];
+ break;
+ case 0x24: case 0x25: case 0x26: case 0x27:
+ m_sppal[0][p[0]-0x24].Y = p[1];
+ m_sppal[0][p[0]-0x24].U = p[2];
+ m_sppal[0][p[0]-0x24].V = p[3];
+ break;
+ case 0x2c: case 0x2d: case 0x2e: case 0x2f:
+ m_sppal[1][p[0]-0x2c].Y = p[1];
+ m_sppal[1][p[0]-0x2c].U = p[2];
+ m_sppal[1][p[0]-0x2c].V = p[3];
+ break;
+ case 0x37:
+ m_sppal[0][3].Reserved = p[2]>>4;
+ m_sppal[0][2].Reserved = p[2]&0xf;
+ m_sppal[0][1].Reserved = p[3]>>4;
+ m_sppal[0][0].Reserved = p[3]&0xf;
+ break;
+ case 0x3f:
+ m_sppal[1][3].Reserved = p[2]>>4;
+ m_sppal[1][2].Reserved = p[2]&0xf;
+ m_sppal[1][1].Reserved = p[3]>>4;
+ m_sppal[1][0].Reserved = p[3]&0xf;
+ break;
+ case 0x47:
+ m_offset[0] = (p[2]<<8)|p[3];
+ break;
+ case 0x4f:
+ m_offset[1] = (p[2]<<8)|p[3];
+ break;
+ default:
+ break;
+ }
+ }
+
+ return(true);
}
void CSubpicInputPin::cvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h, AM_DVD_YUV* sppal, bool fsppal)
{
- BYTE* p = GetData();
- DWORD offset[2] = {m_offset[0], m_offset[1]};
+ BYTE* p = GetData();
+ DWORD offset[2] = {m_offset[0], m_offset[1]};
- CRect rcclip(0, 0, w, h);
+ CRect rcclip(0, 0, w, h);
- /* FIXME: startx/y looks to be wrong in the sample I tested
- CPoint pt(m_sphli.StartX, m_sphli.StartY);
- CRect rc(pt, CPoint(m_sphli.StopX, m_sphli.StopY));
- */
+ /* FIXME: startx/y looks to be wrong in the sample I tested
+ CPoint pt(m_sphli.StartX, m_sphli.StartY);
+ CRect rc(pt, CPoint(m_sphli.StopX, m_sphli.StopY));
+ */
- CSize size(m_sphli.StopX - m_sphli.StartX, m_sphli.StopY - m_sphli.StartY);
- CPoint pt((rcclip.Width() - size.cx) / 2, (rcclip.Height() * 3 - size.cy * 1) / 4);
- CRect rc(pt, size);
+ CSize size(m_sphli.StopX - m_sphli.StartX, m_sphli.StopY - m_sphli.StartY);
+ CPoint pt((rcclip.Width() - size.cx) / 2, (rcclip.Height()*3 - size.cy*1) / 4);
+ CRect rc(pt, size);
- int nField = 0;
- int fAligned = 1;
+ int nField = 0;
+ int fAligned = 1;
- DWORD end[2] = {offset[1], (p[2] << 8) | p[3]};
+ DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
- while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
- {
- BYTE code;
+ while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
+ {
+ BYTE code;
- if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4)
- {
- DrawPixels(yuv, w, pt, code >> 2, m_sppal[0][code&3], rcclip);
- pt.x += code >> 2;
- continue;
- }
+ if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4)
+ {
+ DrawPixels(yuv, w, pt, code >> 2, m_sppal[0][code&3], rcclip);
+ pt.x += code >> 2;
+ continue;
+ }
- code = GetNibble(p, offset, nField, fAligned);
- DrawPixels(yuv, w, pt, rc.right - pt.x, m_sppal[0][code&3], rcclip);
+ code = GetNibble(p, offset, nField, fAligned);
+ DrawPixels(yuv, w, pt, rc.right - pt.x, m_sppal[0][code&3], rcclip);
- if(!fAligned) GetNibble(p, offset, nField, fAligned); // align to byte
+ if(!fAligned) GetNibble(p, offset, nField, fAligned); // align to byte
- pt.x = rc.left;
- pt.y++;
- nField = 1 - nField;
- }
+ pt.x = rc.left;
+ pt.y++;
+ nField = 1 - nField;
+ }
}
// CSubpicInputPin::svcdspu
bool CSubpicInputPin::svcdspu::Parse()
{
- BYTE* p = GetData();
- BYTE* p0 = p;
+ BYTE* p = GetData();
+ BYTE* p0 = p;
- if(GetCount() < 2)
- return(false);
+ if(GetCount() < 2)
+ return(false);
- WORD packetsize = (p[0] << 8) | p[1];
- p += 2;
+ WORD packetsize = (p[0]<<8)|p[1]; p += 2;
if(packetsize > GetCount())
- return(false);
+ return(false);
- bool duration = !!(*p++ & 0x04);
+ bool duration = !!(*p++&0x04);
- *p++; // unknown
+ *p++; // unknown
- if(duration)
- {
- m_rtStop = m_rtStart + 10000i64 * ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]) / 90;
- p += 4;
- }
+ if(duration)
+ {
+ m_rtStop = m_rtStart + 10000i64*((p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3])/90;
+ p += 4;
+ }
- m_sphli.StartX = m_sphli.StopX = (p[0] << 8) | p[1];
- p += 2;
- m_sphli.StartY = m_sphli.StopY = (p[0] << 8) | p[1];
- p += 2;
- m_sphli.StopX += (p[0] << 8) | p[1];
- p += 2;
- m_sphli.StopY += (p[0] << 8) | p[1];
- p += 2;
-
- for(int i = 0; i < 4; i++)
- {
- m_sppal[i].Y = *p++;
- m_sppal[i].U = *p++;
- m_sppal[i].V = *p++;
- m_sppal[i].Reserved = *p++ >> 4;
- }
+ m_sphli.StartX = m_sphli.StopX = (p[0]<<8)|p[1]; p += 2;
+ m_sphli.StartY = m_sphli.StopY = (p[0]<<8)|p[1]; p += 2;
+ m_sphli.StopX += (p[0]<<8)|p[1]; p += 2;
+ m_sphli.StopY += (p[0]<<8)|p[1]; p += 2;
+
+ for(int i = 0; i < 4; i++)
+ {
+ m_sppal[i].Y = *p++;
+ m_sppal[i].U = *p++;
+ m_sppal[i].V = *p++;
+ m_sppal[i].Reserved = *p++ >> 4;
+ }
- if(*p++ & 0xc0)
- p += 4; // duration of the shift operation should be here, but it is untested
+ if(*p++&0xc0)
+ p += 4; // duration of the shift operation should be here, but it is untested
- m_offset[1] = (p[0] << 8) | p[1];
- p += 2;
+ m_offset[1] = (p[0]<<8)|p[1]; p += 2;
- m_offset[0] = p - p0;
- m_offset[1] += m_offset[0];
+ m_offset[0] = p - p0;
+ m_offset[1] += m_offset[0];
- return(true);
+ return(true);
}
void CSubpicInputPin::svcdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h, AM_DVD_YUV* sppal, bool fsppal)
{
- BYTE* p = GetData();
- DWORD offset[2] = {m_offset[0], m_offset[1]};
+ BYTE* p = GetData();
+ DWORD offset[2] = {m_offset[0], m_offset[1]};
- CRect rcclip(0, 0, w, h);
+ CRect rcclip(0, 0, w, h);
- /* FIXME: startx/y looks to be wrong in the sample I tested (yes, this one too!)
- CPoint pt(m_sphli.StartX, m_sphli.StartY);
- CRect rc(pt, CPoint(m_sphli.StopX, m_sphli.StopY));
- */
+ /* FIXME: startx/y looks to be wrong in the sample I tested (yes, this one too!)
+ CPoint pt(m_sphli.StartX, m_sphli.StartY);
+ CRect rc(pt, CPoint(m_sphli.StopX, m_sphli.StopY));
+ */
- CSize size(m_sphli.StopX - m_sphli.StartX, m_sphli.StopY - m_sphli.StartY);
- CPoint pt((rcclip.Width() - size.cx) / 2, (rcclip.Height() * 3 - size.cy * 1) / 4);
- CRect rc(pt, size);
+ CSize size(m_sphli.StopX - m_sphli.StartX, m_sphli.StopY - m_sphli.StartY);
+ CPoint pt((rcclip.Width() - size.cx) / 2, (rcclip.Height()*3 - size.cy*1) / 4);
+ CRect rc(pt, size);
- int nField = 0;
- int n = 3;
+ int nField = 0;
+ int n = 3;
- DWORD end[2] = {offset[1], (p[2] << 8) | p[3]};
+ DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
- while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
- {
- BYTE code = GetHalfNibble(p, offset, nField, n);
- BYTE repeat = 1 + (code == 0 ? GetHalfNibble(p, offset, nField, n) : 0);
+ while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
+ {
+ BYTE code = GetHalfNibble(p, offset, nField, n);
+ BYTE repeat = 1 + (code == 0 ? GetHalfNibble(p, offset, nField, n) : 0);
- DrawPixels(yuv, w, pt, repeat, m_sppal[code&3], rcclip);
- if((pt.x += repeat) < rc.right) continue;
+ DrawPixels(yuv, w, pt, repeat, m_sppal[code&3], rcclip);
+ if((pt.x += repeat) < rc.right) continue;
- while(n != 3)
- GetHalfNibble(p, offset, nField, n); // align to byte
+ while(n != 3)
+ GetHalfNibble(p, offset, nField, n); // align to byte
- pt.x = rc.left;
- pt.y++;
- nField = 1 - nField;
- }
+ pt.x = rc.left;
+ pt.y++;
+ nField = 1 - nField;
+ }
}
//
@@ -2211,62 +2159,62 @@ void CSubpicInputPin::svcdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int
//
CClosedCaptionOutputPin::CClosedCaptionOutputPin(CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseOutputPin(NAME("CClosedCaptionOutputPin"), pFilter, pLock, phr, L"~CC")
+ : CBaseOutputPin(NAME("CClosedCaptionOutputPin"), pFilter, pLock, phr, L"~CC")
{
}
HRESULT CClosedCaptionOutputPin::CheckMediaType(const CMediaType* mtOut)
{
- return mtOut->majortype == MEDIATYPE_AUXLine21Data && mtOut->subtype == MEDIASUBTYPE_Line21_GOPPacket
- ? S_OK
- : VFW_E_TYPE_NOT_ACCEPTED;
+ return mtOut->majortype == MEDIATYPE_AUXLine21Data && mtOut->subtype == MEDIASUBTYPE_Line21_GOPPacket
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT CClosedCaptionOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
{
- if(iPosition < 0) return E_INVALIDARG;
- if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- pmt->InitMediaType();
- pmt->majortype = MEDIATYPE_AUXLine21Data;
- pmt->subtype = MEDIASUBTYPE_Line21_GOPPacket;
- pmt->formattype = FORMAT_None;
+ pmt->InitMediaType();
+ pmt->majortype = MEDIATYPE_AUXLine21Data;
+ pmt->subtype = MEDIASUBTYPE_Line21_GOPPacket;
+ pmt->formattype = FORMAT_None;
- return S_OK;
+ return S_OK;
}
HRESULT CClosedCaptionOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
{
- pProperties->cBuffers = 1;
- pProperties->cbBuffer = 2048;
- pProperties->cbAlign = 1;
- pProperties->cbPrefix = 0;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 2048;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
- HRESULT hr;
- ALLOCATOR_PROPERTIES Actual;
- if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
- return hr;
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
- ? E_FAIL
- : NOERROR;
+ ? E_FAIL
+ : NOERROR;
}
HRESULT CClosedCaptionOutputPin::Deliver(const void* ptr, int len)
{
- HRESULT hr = S_FALSE;
-
- if(len > 4 && ptr && *(DWORD*)ptr == 0xf8014343 && IsConnected())
- {
- CComPtr<IMediaSample> pSample;
- GetDeliveryBuffer(&pSample, NULL, NULL, 0);
- BYTE* pData = NULL;
- pSample->GetPointer(&pData);
- *(DWORD*)pData = 0xb2010000;
- memcpy(pData + 4, ptr, len);
- pSample->SetActualDataLength(len + 4);
- hr = __super::Deliver(pSample);
- }
-
- return hr;
+ HRESULT hr = S_FALSE;
+
+ if(len > 4 && ptr && *(DWORD*)ptr == 0xf8014343 && IsConnected())
+ {
+ CComPtr<IMediaSample> pSample;
+ GetDeliveryBuffer(&pSample, NULL, NULL, 0);
+ BYTE* pData = NULL;
+ pSample->GetPointer(&pData);
+ *(DWORD*)pData = 0xb2010000;
+ memcpy(pData + 4, ptr, len);
+ pSample->SetActualDataLength(len + 4);
+ hr = __super::Deliver(pSample);
+ }
+
+ return hr;
}
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h
index e0e8c6a6f..66a0acdd6 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,164 +33,153 @@ class CClosedCaptionOutputPin;
class CMpeg2Dec;
[uuid("39F498AF-1A09-4275-B193-673B0BA3D478")]
-class CMpeg2DecFilter
- : public CBaseVideoFilter
- , public IMpeg2DecFilter
- , public ISpecifyPropertyPages2
+class CMpeg2DecFilter
+ : public CBaseVideoFilter
+ , public IMpeg2DecFilter
+ , public ISpecifyPropertyPages2
{
- CSubpicInputPin* m_pSubpicInput;
- CClosedCaptionOutputPin* m_pClosedCaptionOutput;
-
- CAutoPtr<CMpeg2Dec> m_dec;
-
- REFERENCE_TIME m_AvgTimePerFrame;
- bool m_fWaitForKeyFrame;
-
- struct framebuf
- {
- int w, h, pitch;
- BYTE* buf_base;
- BYTE* buf[6];
- REFERENCE_TIME rtStart, rtStop;
- DWORD flags;
- ditype di;
+ CSubpicInputPin* m_pSubpicInput;
+ CClosedCaptionOutputPin* m_pClosedCaptionOutput;
+
+ CAutoPtr<CMpeg2Dec> m_dec;
+
+ REFERENCE_TIME m_AvgTimePerFrame;
+ bool m_fWaitForKeyFrame;
+
+ struct framebuf
+ {
+ int w, h, pitch;
+ BYTE* buf_base;
+ BYTE* buf[6];
+ REFERENCE_TIME rtStart, rtStop;
+ DWORD flags;
+ ditype di;
framebuf()
- {
- w = h = pitch = 0;
- buf_base = NULL;
- memset(&buf, 0, sizeof(buf));
- rtStart = rtStop = 0;
- flags = 0;
- }
- ~framebuf()
- {
- Free();
- }
- void Alloc(int w, int h, int pitch)
- {
- this->w = w;
- this->h = h;
- this->pitch = pitch;
- int size = pitch * h;
- buf_base = (BYTE*)_aligned_malloc(size * 3 + 6 * 32, 32);
- BYTE* p = buf_base;
- buf[0] = p;
- p += (size + 31) & ~31;
- buf[3] = p;
- p += (size + 31) & ~31;
- buf[1] = p;
- p += (size / 4 + 31) & ~31;
- buf[4] = p;
- p += (size / 4 + 31) & ~31;
- buf[2] = p;
- p += (size / 4 + 31) & ~31;
- buf[5] = p;
- p += (size / 4 + 31) & ~31;
- }
- void Free()
- {
- if(buf_base) _aligned_free(buf_base);
- buf_base = NULL;
- }
- } m_fb;
-
- bool m_fFilm;
- void SetDeinterlaceMethod();
- void SetTypeSpecificFlags(IMediaSample* pMS);
-
- AM_SimpleRateChange m_rate;
+ {
+ w = h = pitch = 0;
+ buf_base = NULL;
+ memset(&buf, 0, sizeof(buf));
+ rtStart = rtStop = 0;
+ flags = 0;
+ }
+ ~framebuf() {Free();}
+ void Alloc(int w, int h, int pitch)
+ {
+ this->w = w; this->h = h; this->pitch = pitch;
+ int size = pitch*h;
+ buf_base = (BYTE*)_aligned_malloc(size*3+6*32, 32);
+ BYTE* p = buf_base;
+ buf[0] = p; p += (size + 31) & ~31;
+ buf[3] = p; p += (size + 31) & ~31;
+ buf[1] = p; p += (size/4 + 31) & ~31;
+ buf[4] = p; p += (size/4 + 31) & ~31;
+ buf[2] = p; p += (size/4 + 31) & ~31;
+ buf[5] = p; p += (size/4 + 31) & ~31;
+ }
+ void Free()
+ {
+ if(buf_base) _aligned_free(buf_base);
+ buf_base = NULL;
+ }
+ } m_fb;
+
+ bool m_fFilm;
+ void SetDeinterlaceMethod();
+ void SetTypeSpecificFlags(IMediaSample* pMS);
+
+ AM_SimpleRateChange m_rate;
protected:
- void InputTypeChanged();
- HRESULT Transform(IMediaSample* pIn);
- bool IsVideoInterlaced();
+ void InputTypeChanged();
+ HRESULT Transform(IMediaSample* pIn);
+ bool IsVideoInterlaced();
public:
- CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CMpeg2DecFilter();
+ CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CMpeg2DecFilter();
- DECLARE_IUNKNOWN
+ DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
- HRESULT DeliverFast();
- HRESULT DeliverNormal();
- HRESULT Deliver(bool fRepeatLast);
+ HRESULT DeliverFast();
+ HRESULT DeliverNormal();
+ HRESULT Deliver(bool fRepeatLast);
- int GetPinCount();
- CBasePin* GetPin(int n);
+ int GetPinCount();
+ CBasePin* GetPin(int n);
HRESULT EndOfStream();
- HRESULT BeginFlush();
- HRESULT EndFlush();
+ HRESULT BeginFlush();
+ HRESULT EndFlush();
HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
- HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
+ HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
- HRESULT StartStreaming();
- HRESULT StopStreaming();
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
- bool m_fDropFrames;
- HRESULT AlterQuality(Quality q);
+ bool m_fDropFrames;
+ HRESULT AlterQuality(Quality q);
protected:
- CCritSec m_csProps;
- ditype m_ditype;
- float m_bright, m_cont, m_hue, m_sat;
- BYTE m_YTbl[256], m_UTbl[256*256], m_VTbl[256*256];
- bool m_fForcedSubs;
- bool m_fPlanarYUV;
- bool m_fInterlaced;
-
- static void CalcBrCont(BYTE* YTbl, float bright, float cont);
- static void CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat);
- void ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int w, int h, int pitch);
-
+ CCritSec m_csProps;
+ ditype m_ditype;
+ float m_bright, m_cont, m_hue, m_sat;
+ BYTE m_YTbl[256], m_UTbl[256*256], m_VTbl[256*256];
+ bool m_fForcedSubs;
+ bool m_fPlanarYUV;
+ bool m_fInterlaced;
+
+ static void CalcBrCont(BYTE* YTbl, float bright, float cont);
+ static void CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat);
+ void ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int w, int h, int pitch);
+
public:
- // ISpecifyPropertyPages2
+ // ISpecifyPropertyPages2
- STDMETHODIMP GetPages(CAUUID* pPages);
- STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
+ STDMETHODIMP GetPages(CAUUID* pPages);
+ STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
- // IMpeg2DecFilter
+ // IMpeg2DecFilter
- STDMETHODIMP SetDeinterlaceMethod(ditype di);
- STDMETHODIMP_(ditype) GetDeinterlaceMethod();
+ STDMETHODIMP SetDeinterlaceMethod(ditype di);
+ STDMETHODIMP_(ditype) GetDeinterlaceMethod();
- STDMETHODIMP SetBrightness(float bright);
- STDMETHODIMP SetContrast(float cont);
- STDMETHODIMP SetHue(float hue);
- STDMETHODIMP SetSaturation(float sat);
- STDMETHODIMP_(float) GetBrightness();
- STDMETHODIMP_(float) GetContrast();
- STDMETHODIMP_(float) GetHue();
- STDMETHODIMP_(float) GetSaturation();
+ STDMETHODIMP SetBrightness(float bright);
+ STDMETHODIMP SetContrast(float cont);
+ STDMETHODIMP SetHue(float hue);
+ STDMETHODIMP SetSaturation(float sat);
+ STDMETHODIMP_(float) GetBrightness();
+ STDMETHODIMP_(float) GetContrast();
+ STDMETHODIMP_(float) GetHue();
+ STDMETHODIMP_(float) GetSaturation();
- STDMETHODIMP EnableForcedSubtitles(bool fEnable);
- STDMETHODIMP_(bool) IsForcedSubtitlesEnabled();
+ STDMETHODIMP EnableForcedSubtitles(bool fEnable);
+ STDMETHODIMP_(bool) IsForcedSubtitlesEnabled();
- STDMETHODIMP EnablePlanarYUV(bool fEnable);
- STDMETHODIMP_(bool) IsPlanarYUVEnabled();
+ STDMETHODIMP EnablePlanarYUV(bool fEnable);
+ STDMETHODIMP_(bool) IsPlanarYUVEnabled();
- // IMpeg2DecFilter2
+ // IMpeg2DecFilter2
- STDMETHODIMP EnableInterlaced(bool fEnable);
- STDMETHODIMP_(bool) IsInterlacedEnabled();
+ STDMETHODIMP EnableInterlaced(bool fEnable);
+ STDMETHODIMP_(bool) IsInterlacedEnabled();
};
class CMpeg2DecInputPin : public CDeCSSInputPin
{
- LONG m_CorrectTS;
+ LONG m_CorrectTS;
public:
CMpeg2DecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName);
- CCritSec m_csRateLock;
- AM_SimpleRateChange m_ratechange;
+ CCritSec m_csRateLock;
+ AM_SimpleRateChange m_ratechange;
- // IKsPropertySet
+ // IKsPropertySet
STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength);
STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength, ULONG* pBytesReturned);
STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport);
@@ -199,115 +188,91 @@ public:
class CMpeg2DecOutputPin : public CBaseVideoOutputPin
{
public:
- CMpeg2DecOutputPin(CBaseVideoFilter* pFilter, HRESULT* phr, LPWSTR pName);
+ CMpeg2DecOutputPin(CBaseVideoFilter* pFilter, HRESULT* phr, LPWSTR pName);
- CAutoPtr<COutputQueue> m_pOutputQueue;
+ CAutoPtr<COutputQueue> m_pOutputQueue;
- HRESULT Active();
+ HRESULT Active();
HRESULT Inactive();
- HRESULT Deliver(IMediaSample* pMediaSample);
+ HRESULT Deliver(IMediaSample* pMediaSample);
HRESULT DeliverEndOfStream();
HRESULT DeliverBeginFlush();
- HRESULT DeliverEndFlush();
+ HRESULT DeliverEndFlush();
HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
};
class CSubpicInputPin : public CMpeg2DecInputPin
{
- CCritSec m_csReceive;
-
- AM_PROPERTY_COMPOSIT_ON m_spon;
- AM_DVD_YUV m_sppal[16];
- bool m_fsppal;
- CAutoPtr<AM_PROPERTY_SPHLI> m_sphli; // temp
-
- class spu : public CAtlArray<BYTE>
- {
- public:
- bool m_fForced;
- REFERENCE_TIME m_rtStart, m_rtStop;
- DWORD m_offset[2];
- AM_PROPERTY_SPHLI m_sphli; // parsed
- CAutoPtr<AM_PROPERTY_SPHLI> m_psphli; // for the menu (optional)
- spu()
- {
- memset(&m_sphli, 0, sizeof(m_sphli));
- m_fForced = false;
- m_rtStart = m_rtStop = 0;
- }
- virtual ~spu() {}
- virtual bool Parse() = 0;
- virtual void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal) = 0;
- };
-
- class dvdspu : public spu
- {
- public:
- struct offset_t
- {
- REFERENCE_TIME rt;
- AM_PROPERTY_SPHLI sphli;
- };
- CAtlList<offset_t> m_offsets;
- bool Parse();
- void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
- };
-
- class cvdspu : public spu
- {
- public:
- AM_DVD_YUV m_sppal[2][4];
- cvdspu()
- {
- memset(m_sppal, 0, sizeof(m_sppal));
- }
- bool Parse();
- void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
- };
-
- class svcdspu : public spu
- {
- public:
- AM_DVD_YUV m_sppal[4];
- svcdspu()
- {
- memset(m_sppal, 0, sizeof(m_sppal));
- }
- bool Parse();
- void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
- };
-
- CAutoPtrList<spu> m_sps;
+ CCritSec m_csReceive;
+
+ AM_PROPERTY_COMPOSIT_ON m_spon;
+ AM_DVD_YUV m_sppal[16];
+ bool m_fsppal;
+ CAutoPtr<AM_PROPERTY_SPHLI> m_sphli; // temp
+
+ class spu : public CAtlArray<BYTE>
+ {
+ public:
+ bool m_fForced;
+ REFERENCE_TIME m_rtStart, m_rtStop;
+ DWORD m_offset[2];
+ AM_PROPERTY_SPHLI m_sphli; // parsed
+ CAutoPtr<AM_PROPERTY_SPHLI> m_psphli; // for the menu (optional)
+ spu() {memset(&m_sphli, 0, sizeof(m_sphli)); m_fForced = false; m_rtStart = m_rtStop = 0;}
+ virtual ~spu() {}
+ virtual bool Parse() = 0;
+ virtual void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal) = 0;
+ };
+
+ class dvdspu : public spu
+ {
+ public:
+ struct offset_t {REFERENCE_TIME rt; AM_PROPERTY_SPHLI sphli;};
+ CAtlList<offset_t> m_offsets;
+ bool Parse();
+ void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
+ };
+
+ class cvdspu : public spu
+ {
+ public:
+ AM_DVD_YUV m_sppal[2][4];
+ cvdspu() {memset(m_sppal, 0, sizeof(m_sppal));}
+ bool Parse();
+ void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
+ };
+
+ class svcdspu : public spu
+ {
+ public:
+ AM_DVD_YUV m_sppal[4];
+ svcdspu() {memset(m_sppal, 0, sizeof(m_sppal));}
+ bool Parse();
+ void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
+ };
+
+ CAutoPtrList<spu> m_sps;
protected:
- HRESULT Transform(IMediaSample* pSample);
+ HRESULT Transform(IMediaSample* pSample);
public:
- CSubpicInputPin(CTransformFilter* pFilter, HRESULT* phr);
+ CSubpicInputPin(CTransformFilter* pFilter, HRESULT* phr);
- bool HasAnythingToRender(REFERENCE_TIME rt);
- void RenderSubpics(REFERENCE_TIME rt, BYTE** p, int w, int h);
+ bool HasAnythingToRender(REFERENCE_TIME rt);
+ void RenderSubpics(REFERENCE_TIME rt, BYTE** p, int w, int h);
HRESULT CheckMediaType(const CMediaType* mtIn);
- HRESULT SetMediaType(const CMediaType* mtIn);
-
- // we shouldn't pass these to the filter from this pin
- STDMETHODIMP EndOfStream()
- {
- return S_OK;
- }
- STDMETHODIMP BeginFlush()
- {
- return S_OK;
- }
+ HRESULT SetMediaType(const CMediaType* mtIn);
+
+ // we shouldn't pass these to the filter from this pin
+ STDMETHODIMP EndOfStream() {return S_OK;}
+ STDMETHODIMP BeginFlush() {return S_OK;}
STDMETHODIMP EndFlush();
- STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
- {
- return S_OK;
- }
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) {return S_OK;}
- // IKsPropertySet
+ // IKsPropertySet
STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength);
STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport);
};
@@ -315,16 +280,13 @@ public:
class CClosedCaptionOutputPin : public CBaseOutputPin
{
public:
- CClosedCaptionOutputPin(CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ CClosedCaptionOutputPin(CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
HRESULT CheckMediaType(const CMediaType* mtOut);
- HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
- CMediaType& CurrentMediaType()
- {
- return m_mt;
- }
+ CMediaType& CurrentMediaType() {return m_mt;}
- HRESULT Deliver(const void* ptr, int len);
+ HRESULT Deliver(const void* ptr, int len);
};
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp
index 046a006f8..101e126d3 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -38,193 +38,193 @@ static TCHAR m_strSaturation[100];
CMpeg2DecSettingsWnd::CMpeg2DecSettingsWnd()
{
- wcscpy(m_strBrightness, ResStr(IDS_MPEG2_BRIGHTNESS));
- wcscpy(m_strContrast, ResStr(IDS_MPEG2_CONTRAST));
- wcscpy(m_strHue, ResStr(IDS_MPEG2_HUE));
- wcscpy(m_strSaturation, ResStr(IDS_MPEG2_SATURATION));
+ wcscpy (m_strBrightness, ResStr(IDS_MPEG2_BRIGHTNESS));
+ wcscpy (m_strContrast, ResStr(IDS_MPEG2_CONTRAST));
+ wcscpy (m_strHue, ResStr(IDS_MPEG2_HUE));
+ wcscpy (m_strSaturation, ResStr(IDS_MPEG2_SATURATION));
}
bool CMpeg2DecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
{
- ASSERT(!m_pM2DF);
-
- m_pM2DF.Release();
+ ASSERT(!m_pM2DF);
- POSITION pos = pUnks.GetHeadPosition();
- while(pos && !(m_pM2DF = pUnks.GetNext(pos)));
+ m_pM2DF.Release();
- if(!m_pM2DF) return false;
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pM2DF = pUnks.GetNext(pos)));
+
+ if(!m_pM2DF) return false;
- m_ditype = m_pM2DF->GetDeinterlaceMethod();
- m_procamp[0] = m_pM2DF->GetBrightness();
- m_procamp[1] = m_pM2DF->GetContrast();
- m_procamp[2] = m_pM2DF->GetHue();
- m_procamp[3] = m_pM2DF->GetSaturation();
- m_forcedsubs = m_pM2DF->IsForcedSubtitlesEnabled();
- m_planaryuv = m_pM2DF->IsPlanarYUVEnabled();
- m_interlaced = m_pM2DF->IsInterlacedEnabled();
+ m_ditype = m_pM2DF->GetDeinterlaceMethod();
+ m_procamp[0] = m_pM2DF->GetBrightness();
+ m_procamp[1] = m_pM2DF->GetContrast();
+ m_procamp[2] = m_pM2DF->GetHue();
+ m_procamp[3] = m_pM2DF->GetSaturation();
+ m_forcedsubs = m_pM2DF->IsForcedSubtitlesEnabled();
+ m_planaryuv = m_pM2DF->IsPlanarYUVEnabled();
+ m_interlaced = m_pM2DF->IsInterlacedEnabled();
- return true;
+ return true;
}
void CMpeg2DecSettingsWnd::OnDisconnect()
{
- m_pM2DF.Release();
+ m_pM2DF.Release();
}
bool CMpeg2DecSettingsWnd::OnActivate()
{
- DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
-
- CPoint p(10, 10);
-
- m_planaryuv_check.Create(ResStr(IDS_MPEG2DECSETTINGSWND_0), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK1);
- m_planaryuv_check.SetCheck(m_planaryuv ? BST_CHECKED : BST_UNCHECKED);
- p.y += m_fontheight + 5;
-
- m_interlaced_check.Create(ResStr(IDS_MPEG2DECSETTINGSWND_1), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK2);
- m_interlaced_check.SetCheck(m_interlaced ? BST_CHECKED : BST_UNCHECKED);
- p.y += m_fontheight + 5;
-
- m_forcedsubs_check.Create(ResStr(IDS_MPEG2DECSETTINGSWND_2), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK3);
- m_forcedsubs_check.SetCheck(m_forcedsubs ? BST_CHECKED : BST_UNCHECKED);
- p.y += m_fontheight + 5;
-
- p.y += 10;
-
- m_ditype_static.Create(ResStr(IDS_MPEG2_DEINTERLACING), dwStyle, CRect(p, CSize(70, m_fontheight)), this);
- m_ditype_combo.Create(dwStyle | CBS_DROPDOWNLIST, CRect(p + CSize(85, -3), CSize(100, 200)), this, IDC_PP_COMBO1);
- m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Auto")), (DWORD)DIAuto);
- m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Weave")), (DWORD)DIWeave);
- m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Blend")), (DWORD)DIBlend);
- m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Bob")), (DWORD)DIBob);
- m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Field Shift")), (DWORD)DIFieldShift);
- m_ditype_combo.SetCurSel(0);
- for(int i = 0; i < m_ditype_combo.GetCount(); i++)
- if((int)m_ditype_combo.GetItemData(i) == m_ditype)
- m_ditype_combo.SetCurSel(i);
-
- p.y += m_fontheight + 20;
-
- for(int i = 0, h = max(20, m_fontheight) + 1; i < countof(m_procamp_slider); i++, p.y += h)
- {
- static const TCHAR* labels[] = {m_strBrightness, m_strContrast, m_strHue, m_strSaturation};
- m_procamp_static[i].Create(labels[i], dwStyle, CRect(p, CSize(70, h)), this);
- m_procamp_slider[i].Create(dwStyle, CRect(p + CPoint(80, 0), CSize(200, h)), this, IDC_PP_SLIDER1 + i);
- m_procamp_value[i].Create(_T(""), dwStyle, CRect(p + CPoint(280, 0), CSize(40, h)), this);
- }
-
- m_procamp_slider[0].SetRange(0, 2 * 128);
- m_procamp_slider[0].SetTic(128);
- m_procamp_slider[0].SetPos((int)(m_procamp[0] + (m_procamp[0] >= 0 ? 0.5f : -0.5f)) + 128);
- m_procamp_slider[1].SetRange(0, 200);
- m_procamp_slider[1].SetTic(100);
- m_procamp_slider[1].SetPos((int)(100 * m_procamp[1] + 0.5f));
- m_procamp_slider[2].SetRange(0, 2 * 180);
- m_procamp_slider[2].SetTic(180);
- m_procamp_slider[2].SetPos((int)(m_procamp[2] + (m_procamp[2] >= 0 ? 0.5f : -0.5f)) + 180);
- m_procamp_slider[3].SetRange(0, 200);
- m_procamp_slider[3].SetTic(100);
- m_procamp_slider[3].SetPos((int)(100 * m_procamp[3] + 0.5f));
-
- p.y += 5;
-
- m_procamp_tv2pc.Create(_T("TV->PC"), dwStyle, CRect(p + CPoint(50 + 200 / 2 - 55, 0), CSize(80, 20)), this, IDC_PP_BUTTON1);
- m_procamp_reset.Create(ResStr(IDS_MPEG2_RESET), dwStyle, CRect(p + CPoint(80 + 200 / 2 + 5, 0), CSize(80, 20)), this, IDC_PP_BUTTON2);
-
- p.y += 30;
-
- UpdateProcampValues();
-
- m_note_static.Create(
- ResStr(IDS_MPEG2DECSETTINGSWND_7) +
- ResStr(IDS_MPEG2DECSETTINGSWND_8),
- dwStyle, CRect(p, CSize(320, m_fontheight * 4)), this);
-
- for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
- pWnd->SetFont(&m_font, FALSE);
-
- return true;
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
+
+ CPoint p(10, 10);
+
+ m_planaryuv_check.Create(ResStr(IDS_MPEG2DECSETTINGSWND_0), dwStyle|BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK1);
+ m_planaryuv_check.SetCheck(m_planaryuv ? BST_CHECKED : BST_UNCHECKED);
+ p.y += m_fontheight + 5;
+
+ m_interlaced_check.Create(ResStr(IDS_MPEG2DECSETTINGSWND_1), dwStyle|BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK2);
+ m_interlaced_check.SetCheck(m_interlaced ? BST_CHECKED : BST_UNCHECKED);
+ p.y += m_fontheight + 5;
+
+ m_forcedsubs_check.Create(ResStr(IDS_MPEG2DECSETTINGSWND_2), dwStyle|BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK3);
+ m_forcedsubs_check.SetCheck(m_forcedsubs ? BST_CHECKED : BST_UNCHECKED);
+ p.y += m_fontheight + 5;
+
+ p.y += 10;
+
+ m_ditype_static.Create(ResStr(IDS_MPEG2_DEINTERLACING), dwStyle, CRect(p, CSize(70, m_fontheight)), this);
+ m_ditype_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(85, -3), CSize(100, 200)), this, IDC_PP_COMBO1);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Auto")), (DWORD)DIAuto);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Weave")), (DWORD)DIWeave);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Blend")), (DWORD)DIBlend);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Bob")), (DWORD)DIBob);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Field Shift")), (DWORD)DIFieldShift);
+ m_ditype_combo.SetCurSel(0);
+ for(int i = 0; i < m_ditype_combo.GetCount(); i++)
+ if((int)m_ditype_combo.GetItemData(i) == m_ditype)
+ m_ditype_combo.SetCurSel(i);
+
+ p.y += m_fontheight + 20;
+
+ for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_procamp_slider); i++, p.y += h)
+ {
+ static const TCHAR* labels[] = {m_strBrightness, m_strContrast, m_strHue, m_strSaturation};
+ m_procamp_static[i].Create(labels[i], dwStyle, CRect(p, CSize(70, h)), this);
+ m_procamp_slider[i].Create(dwStyle, CRect(p + CPoint(80, 0), CSize(200, h)), this, IDC_PP_SLIDER1+i);
+ m_procamp_value[i].Create(_T(""), dwStyle, CRect(p + CPoint(280, 0), CSize(40, h)), this);
+ }
+
+ m_procamp_slider[0].SetRange(0, 2*128);
+ m_procamp_slider[0].SetTic(128);
+ m_procamp_slider[0].SetPos((int)(m_procamp[0] + (m_procamp[0] >= 0 ? 0.5f : -0.5f)) + 128);
+ m_procamp_slider[1].SetRange(0, 200);
+ m_procamp_slider[1].SetTic(100);
+ m_procamp_slider[1].SetPos((int)(100*m_procamp[1] + 0.5f));
+ m_procamp_slider[2].SetRange(0, 2*180);
+ m_procamp_slider[2].SetTic(180);
+ m_procamp_slider[2].SetPos((int)(m_procamp[2] + (m_procamp[2] >= 0 ? 0.5f : -0.5f)) + 180);
+ m_procamp_slider[3].SetRange(0, 200);
+ m_procamp_slider[3].SetTic(100);
+ m_procamp_slider[3].SetPos((int)(100*m_procamp[3] + 0.5f));
+
+ p.y += 5;
+
+ m_procamp_tv2pc.Create(_T("TV->PC"), dwStyle, CRect(p + CPoint(50 + 200/2 - 55, 0), CSize(80, 20)), this, IDC_PP_BUTTON1);
+ m_procamp_reset.Create(ResStr(IDS_MPEG2_RESET), dwStyle, CRect(p + CPoint(80 + 200/2 + 5, 0), CSize(80, 20)), this, IDC_PP_BUTTON2);
+
+ p.y += 30;
+
+ UpdateProcampValues();
+
+ m_note_static.Create(
+ ResStr(IDS_MPEG2DECSETTINGSWND_7) +
+ ResStr(IDS_MPEG2DECSETTINGSWND_8),
+ dwStyle, CRect(p, CSize(320, m_fontheight * 4)), this);
+
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
+
+ return true;
}
void CMpeg2DecSettingsWnd::OnDeactivate()
{
- m_ditype = (ditype)m_ditype_combo.GetItemData(m_ditype_combo.GetCurSel());
- m_procamp[0] = (float)m_procamp_slider[0].GetPos() - 128;
- m_procamp[1] = (float)m_procamp_slider[1].GetPos() / 100;
- m_procamp[2] = (float)m_procamp_slider[2].GetPos() - 180;
- m_procamp[3] = (float)m_procamp_slider[3].GetPos() / 100;
- m_planaryuv = !!IsDlgButtonChecked(m_planaryuv_check.GetDlgCtrlID());
- m_interlaced = !!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID());
- m_forcedsubs = !!IsDlgButtonChecked(m_forcedsubs_check.GetDlgCtrlID());
+ m_ditype = (ditype)m_ditype_combo.GetItemData(m_ditype_combo.GetCurSel());
+ m_procamp[0] = (float)m_procamp_slider[0].GetPos() - 128;
+ m_procamp[1] = (float)m_procamp_slider[1].GetPos() / 100;
+ m_procamp[2] = (float)m_procamp_slider[2].GetPos() - 180;
+ m_procamp[3] = (float)m_procamp_slider[3].GetPos() / 100;
+ m_planaryuv = !!IsDlgButtonChecked(m_planaryuv_check.GetDlgCtrlID());
+ m_interlaced = !!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID());
+ m_forcedsubs = !!IsDlgButtonChecked(m_forcedsubs_check.GetDlgCtrlID());
}
bool CMpeg2DecSettingsWnd::OnApply()
{
- OnDeactivate();
-
- if(m_pM2DF)
- {
- m_pM2DF->SetDeinterlaceMethod(m_ditype);
- m_pM2DF->SetBrightness(m_procamp[0]);
- m_pM2DF->SetContrast(m_procamp[1]);
- m_pM2DF->SetHue(m_procamp[2]);
- m_pM2DF->SetSaturation(m_procamp[3]);
- m_pM2DF->EnableForcedSubtitles(m_forcedsubs);
- m_pM2DF->EnablePlanarYUV(m_planaryuv);
- m_pM2DF->EnableInterlaced(m_interlaced);
- }
-
- return true;
+ OnDeactivate();
+
+ if(m_pM2DF)
+ {
+ m_pM2DF->SetDeinterlaceMethod(m_ditype);
+ m_pM2DF->SetBrightness(m_procamp[0]);
+ m_pM2DF->SetContrast(m_procamp[1]);
+ m_pM2DF->SetHue(m_procamp[2]);
+ m_pM2DF->SetSaturation(m_procamp[3]);
+ m_pM2DF->EnableForcedSubtitles(m_forcedsubs);
+ m_pM2DF->EnablePlanarYUV(m_planaryuv);
+ m_pM2DF->EnableInterlaced(m_interlaced);
+ }
+
+ return true;
}
void CMpeg2DecSettingsWnd::UpdateProcampValues()
{
- CString str;
-
- str.Format(_T("%d"), m_procamp_slider[0].GetPos() - 128);
- m_procamp_value[0].SetWindowText(str);
- str.Format(_T("%d%%"), m_procamp_slider[1].GetPos());
- m_procamp_value[1].SetWindowText(str);
- str.Format(_T("%d"), m_procamp_slider[2].GetPos() - 180);
- m_procamp_value[2].SetWindowText(str);
- str.Format(_T("%d%%"), m_procamp_slider[3].GetPos());
- m_procamp_value[3].SetWindowText(str);
+ CString str;
+
+ str.Format(_T("%d"), m_procamp_slider[0].GetPos() - 128);
+ m_procamp_value[0].SetWindowText(str);
+ str.Format(_T("%d%%"), m_procamp_slider[1].GetPos());
+ m_procamp_value[1].SetWindowText(str);
+ str.Format(_T("%d"), m_procamp_slider[2].GetPos() - 180);
+ m_procamp_value[2].SetWindowText(str);
+ str.Format(_T("%d%%"), m_procamp_slider[3].GetPos());
+ m_procamp_value[3].SetWindowText(str);
}
BEGIN_MESSAGE_MAP(CMpeg2DecSettingsWnd, CInternalPropertyPageWnd)
- ON_BN_CLICKED(IDC_PP_BUTTON1, OnButtonProcampPc2Tv)
- ON_BN_CLICKED(IDC_PP_BUTTON2, OnButtonProcampReset)
- ON_BN_CLICKED(IDC_PP_CHECK2, OnButtonInterlaced)
- ON_WM_HSCROLL()
+ ON_BN_CLICKED(IDC_PP_BUTTON1, OnButtonProcampPc2Tv)
+ ON_BN_CLICKED(IDC_PP_BUTTON2, OnButtonProcampReset)
+ ON_BN_CLICKED(IDC_PP_CHECK2, OnButtonInterlaced)
+ ON_WM_HSCROLL()
END_MESSAGE_MAP()
void CMpeg2DecSettingsWnd::OnButtonProcampPc2Tv()
{
- m_procamp_slider[0].SetPos(128 - 16);
- m_procamp_slider[1].SetPos(100 * 255 / (235 - 16));
+ m_procamp_slider[0].SetPos(128 - 16);
+ m_procamp_slider[1].SetPos(100 * 255/(235-16));
- UpdateProcampValues();
+ UpdateProcampValues();
}
void CMpeg2DecSettingsWnd::OnButtonProcampReset()
{
- m_procamp_slider[0].SetPos(128);
- m_procamp_slider[1].SetPos(100);
- m_procamp_slider[2].SetPos(180);
- m_procamp_slider[3].SetPos(100);
+ m_procamp_slider[0].SetPos(128);
+ m_procamp_slider[1].SetPos(100);
+ m_procamp_slider[2].SetPos(180);
+ m_procamp_slider[3].SetPos(100);
- UpdateProcampValues();
+ UpdateProcampValues();
}
void CMpeg2DecSettingsWnd::OnButtonInterlaced()
{
- m_ditype_combo.EnableWindow(!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID()));
+ m_ditype_combo.EnableWindow(!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID()));
}
void CMpeg2DecSettingsWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- UpdateProcampValues();
+ UpdateProcampValues();
- __super::OnHScroll(nSBCode, nPos, pScrollBar);
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
}
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.h b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.h
index 89202ebdb..4f694d8cb 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.h
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecSettingsWnd.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,64 +28,58 @@
[uuid("E5FB6957-65E6-491B-BB37-B25C9FE3BEA7")]
class CMpeg2DecSettingsWnd : public CInternalPropertyPageWnd
{
- CComQIPtr<IMpeg2DecFilter> m_pM2DF;
+ CComQIPtr<IMpeg2DecFilter> m_pM2DF;
- ditype m_ditype;
- float m_procamp[4];
- bool m_planaryuv;
- bool m_interlaced;
- bool m_forcedsubs;
+ ditype m_ditype;
+ float m_procamp[4];
+ bool m_planaryuv;
+ bool m_interlaced;
+ bool m_forcedsubs;
- enum
- {
- IDC_PP_COMBO1 = 10000,
- IDC_PP_SLIDER1,
- IDC_PP_SLIDER2,
- IDC_PP_SLIDER3,
- IDC_PP_SLIDER4,
- IDC_PP_CHECK1,
- IDC_PP_CHECK2,
- IDC_PP_CHECK3,
- IDC_PP_BUTTON1,
- IDC_PP_BUTTON2,
- };
+ enum
+ {
+ IDC_PP_COMBO1 = 10000,
+ IDC_PP_SLIDER1,
+ IDC_PP_SLIDER2,
+ IDC_PP_SLIDER3,
+ IDC_PP_SLIDER4,
+ IDC_PP_CHECK1,
+ IDC_PP_CHECK2,
+ IDC_PP_CHECK3,
+ IDC_PP_BUTTON1,
+ IDC_PP_BUTTON2,
+ };
- CStatic m_ditype_static;
- CComboBox m_ditype_combo;
- CStatic m_procamp_static[4];
- CSliderCtrl m_procamp_slider[4];
- CStatic m_procamp_value[4];
- CButton m_procamp_tv2pc;
- CButton m_procamp_reset;
- CButton m_planaryuv_check;
- CButton m_interlaced_check;
- CButton m_forcedsubs_check;
- CStatic m_note_static;
+ CStatic m_ditype_static;
+ CComboBox m_ditype_combo;
+ CStatic m_procamp_static[4];
+ CSliderCtrl m_procamp_slider[4];
+ CStatic m_procamp_value[4];
+ CButton m_procamp_tv2pc;
+ CButton m_procamp_reset;
+ CButton m_planaryuv_check;
+ CButton m_interlaced_check;
+ CButton m_forcedsubs_check;
+ CStatic m_note_static;
- void UpdateProcampValues();
+ void UpdateProcampValues();
public:
- CMpeg2DecSettingsWnd();
-
- bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
- void OnDisconnect();
- bool OnActivate();
- void OnDeactivate();
- bool OnApply();
+ CMpeg2DecSettingsWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
- static LPCTSTR GetWindowTitle()
- {
- return _T("Settings");
- }
- static CSize GetWindowSize()
- {
- return CSize(320, 240);
- }
+ static LPCTSTR GetWindowTitle() {return _T("Settings");}
+ static CSize GetWindowSize() {return CSize(320, 240);}
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
- afx_msg void OnButtonProcampPc2Tv();
- afx_msg void OnButtonProcampReset();
- afx_msg void OnButtonInterlaced();
- afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ afx_msg void OnButtonProcampPc2Tv();
+ afx_msg void OnButtonProcampReset();
+ afx_msg void OnButtonInterlaced();
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
}; \ No newline at end of file
diff --git a/src/filters/transform/Mpeg2DecFilter/attributes.h b/src/filters/transform/Mpeg2DecFilter/attributes.h
index dd504dabe..e587e158f 100644
--- a/src/filters/transform/Mpeg2DecFilter/attributes.h
+++ b/src/filters/transform/Mpeg2DecFilter/attributes.h
@@ -26,11 +26,11 @@
/* use gcc attribs to align critical data structures */
#ifdef __GNUC__
-#define __align8(t,v) t v __attribute__ ((aligned (8)))
-#define __align16(t,v) t v __attribute__ ((aligned (16)))
+ #define __align8(t,v) t v __attribute__ ((aligned (8)))
+ #define __align16(t,v) t v __attribute__ ((aligned (16)))
#else
-#define __align8(t,v) __declspec(align(8)) t v
-#define __align16(t,v) __declspec(align(16)) t v
+ #define __align8(t,v) __declspec(align(8)) t v
+ #define __align16(t,v) __declspec(align(16)) t v
#endif
#ifdef HAVE_BUILTIN_EXPECT
diff --git a/src/filters/transform/Mpeg2DecFilter/idct_sse2.cpp b/src/filters/transform/Mpeg2DecFilter/idct_sse2.cpp
index bc9816a40..134707c76 100644
--- a/src/filters/transform/Mpeg2DecFilter/idct_sse2.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/idct_sse2.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -31,202 +31,202 @@
// AP-945
// http://cache-www.intel.com/cd/00/00/01/76/17680_w_idct.pdf
-static const int BITS_INV_ACC = 4;
-static const int SHIFT_INV_ROW = 16 - BITS_INV_ACC;
-static const int SHIFT_INV_COL = 1 + BITS_INV_ACC;
-static const int RND_INV_ROW = 1024 * (6 - BITS_INV_ACC);
-static const int RND_INV_COL = 16 * (BITS_INV_ACC - 3);
-static const int RND_INV_CORR = RND_INV_COL - 1;
+static const int BITS_INV_ACC=4;
+static const int SHIFT_INV_ROW=16-BITS_INV_ACC;
+static const int SHIFT_INV_COL=1+BITS_INV_ACC;
+static const int RND_INV_ROW =1024*(6-BITS_INV_ACC);
+static const int RND_INV_COL =16*(BITS_INV_ACC-3);
+static const int RND_INV_CORR =RND_INV_COL-1;
-static __align16(const short, M128_round_inv_row[8]) = {RND_INV_ROW, 0, RND_INV_ROW, 0, RND_INV_ROW, 0, RND_INV_ROW, 0};
-static __align16(const short, M128_one_corr[8]) = {1, 1, 1, 1, 1, 1, 1, 1};
-static __align16(const short, M128_round_inv_col[8]) = {RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL};
-static __align16(const short, M128_round_inv_corr[8]) = {RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR};
-static __align16(const short, M128_tg_1_16[8]) = {13036, 13036, 13036, 13036, 13036, 13036, 13036, 13036}; // tg * (2<<16) + 0.5
-static __align16(const short, M128_tg_2_16[8]) = {27146, 27146, 27146, 27146, 27146, 27146, 27146, 27146}; // tg * (2<<16) + 0.5
-static __align16(const short, M128_tg_3_16[8]) = { -21746, -21746, -21746, -21746, -21746, -21746, -21746, -21746}; // tg * (2<<16) + 0.5
-static __align16(const short, M128_cos_4_16[8]) = { -19195, -19195, -19195, -19195, -19195, -19195, -19195, -19195}; // cos * (2<<16) + 0.5
+static __align16(const short,M128_round_inv_row[8]) = {RND_INV_ROW, 0, RND_INV_ROW, 0, RND_INV_ROW, 0, RND_INV_ROW, 0};
+static __align16(const short,M128_one_corr[8]) = {1,1,1,1,1,1,1,1};
+static __align16(const short,M128_round_inv_col[8]) = {RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL};
+static __align16(const short,M128_round_inv_corr[8])= {RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR};
+static __align16(const short,M128_tg_1_16[8]) = {13036, 13036, 13036, 13036, 13036, 13036, 13036, 13036}; // tg * (2<<16) + 0.5
+static __align16(const short,M128_tg_2_16[8]) = {27146, 27146, 27146, 27146, 27146, 27146, 27146, 27146}; // tg * (2<<16) + 0.5
+static __align16(const short,M128_tg_3_16[8]) = {-21746, -21746, -21746, -21746, -21746, -21746, -21746, -21746}; // tg * (2<<16) + 0.5
+static __align16(const short,M128_cos_4_16[8]) = {-19195, -19195, -19195, -19195, -19195, -19195, -19195, -19195};// cos * (2<<16) + 0.5
-static __align16(const int16_t, M128_tab_i_04[]) = {16384, 21407, 16384, 8867, 16384, -8867, 16384, -21407, 16384, 8867, -16384, -21407, -16384, 21407, 16384, -8867, 22725, 19266, 19266, -4520, 12873, -22725, 4520, -12873, 12873, 4520, -22725, -12873, 4520, 19266, 19266, -22725};
-static __align16(const int16_t, M128_tab_i_17[]) = {22725, 29692, 22725, 12299, 22725, -12299, 22725, -29692, 22725, 12299, -22725, -29692, -22725, 29692, 22725, -12299, 31521, 26722, 26722, -6270, 17855, -31521, 6270, -17855, 17855, 6270, -31521, -17855, 6270, 26722, 26722, -31521};
-static __align16(const int16_t, M128_tab_i_26[]) = {21407, 27969, 21407, 11585, 21407, -11585, 21407, -27969, 21407, 11585, -21407, -27969, -21407, 27969, 21407, -11585, 29692, 25172, 25172, -5906, 16819, -29692, 5906, -16819, 16819, 5906, -29692, -16819, 5906, 25172, 25172, -29692};
-static __align16(const int16_t, M128_tab_i_35[]) = {19266, 25172, 19266, 10426, 19266, -10426, 19266, -25172, 19266, 10426, -19266, -25172, -19266, 25172, 19266, -10426, 26722, 22654, 22654, -5315, 15137, -26722, 5315, -15137, 15137, 5315, -26722, -15137, 5315, 22654, 22654, -26722};
+static __align16(const int16_t,M128_tab_i_04[])={16384, 21407, 16384, 8867, 16384, -8867, 16384, -21407, 16384, 8867, -16384, -21407, -16384, 21407, 16384, -8867, 22725, 19266, 19266, -4520, 12873, -22725, 4520, -12873, 12873, 4520, -22725, -12873, 4520, 19266, 19266, -22725};
+static __align16(const int16_t,M128_tab_i_17[])={22725, 29692, 22725, 12299, 22725, -12299, 22725, -29692, 22725, 12299, -22725, -29692, -22725, 29692, 22725, -12299, 31521, 26722, 26722, -6270, 17855, -31521, 6270, -17855, 17855, 6270, -31521, -17855, 6270, 26722, 26722, -31521};
+static __align16(const int16_t,M128_tab_i_26[])={21407, 27969, 21407, 11585, 21407, -11585, 21407, -27969, 21407, 11585, -21407, -27969, -21407, 27969, 21407, -11585, 29692, 25172, 25172, -5906, 16819, -29692, 5906, -16819, 16819, 5906, -29692, -16819, 5906, 25172, 25172, -29692};
+static __align16(const int16_t,M128_tab_i_35[])={19266, 25172, 19266, 10426, 19266, -10426, 19266, -25172, 19266, 10426, -19266, -25172, -19266, 25172, 19266, -10426, 26722, 22654, 22654, -5315, 15137, -26722, 5315, -15137, 15137, 5315, -26722, -15137, 5315, 22654, 22654, -26722};
-static __forceinline void DCT_8_INV_ROW(const uint8_t * const ecx, const uint8_t * const esi, __m128i &xmm0, __m128i &xmm1, __m128i &xmm2, __m128i &xmm3, __m128i &xmm4, __m128i &xmm5, __m128i &xmm6, __m128i &xmm7)
+static __forceinline void DCT_8_INV_ROW(const uint8_t * const ecx,const uint8_t * const esi,__m128i &xmm0,__m128i &xmm1,__m128i &xmm2,__m128i &xmm3,__m128i &xmm4,__m128i &xmm5,__m128i &xmm6,__m128i &xmm7)
{
- xmm0 = _mm_shufflelo_epi16(xmm0, 0xD8);
- xmm1 = _mm_shuffle_epi32(xmm0, 0);
- pmaddwd(xmm1, esi);
- xmm3 = _mm_shuffle_epi32(xmm0, 0x55);
- xmm0 = _mm_shufflehi_epi16(xmm0, 0xD8);
- pmaddwd(xmm3, esi + 32);
- xmm2 = _mm_shuffle_epi32(xmm0, 0xAA);
- xmm0 = _mm_shuffle_epi32(xmm0, 0xFF);
- pmaddwd(xmm2, esi + 16);
- xmm4 = _mm_shufflehi_epi16(xmm4, 0xD8);
- paddd(xmm1, M128_round_inv_row);
- xmm4 = _mm_shufflelo_epi16(xmm4, 0xD8);
- pmaddwd(xmm0, esi + 48);
- xmm5 = _mm_shuffle_epi32(xmm4, 0);
- xmm6 = _mm_shuffle_epi32(xmm4, 0xAA);
- pmaddwd(xmm5, ecx);
- paddd(xmm1, xmm2);
- movdqa(xmm2, xmm1);
- xmm7 = _mm_shuffle_epi32(xmm4, 0x55);
- pmaddwd(xmm6, ecx + 16);
- paddd(xmm0, xmm3);
- xmm4 = _mm_shuffle_epi32(xmm4, 0xFF);
- psubd(xmm2, xmm0);
- pmaddwd(xmm7, ecx + 32);
- paddd(xmm0, xmm1);
- psrad(xmm2, 12);
- paddd(xmm5, M128_round_inv_row);
- pmaddwd(xmm4, ecx + 48);
- paddd(xmm5, xmm6);
- movdqa(xmm6, xmm5);
- psrad(xmm0, 12);
- xmm2 = _mm_shuffle_epi32(xmm2, 0x1B);
- packssdw(xmm0, xmm2);
- paddd(xmm4, xmm7);
- psubd(xmm6, xmm4);
- paddd(xmm4, xmm5);
- psrad(xmm6, 12);
- psrad(xmm4, 12);
- xmm6 = _mm_shuffle_epi32(xmm6, 0x1B);
- packssdw(xmm4, xmm6);
+ xmm0=_mm_shufflelo_epi16(xmm0, 0xD8 );
+ xmm1=_mm_shuffle_epi32( xmm0, 0 );
+ pmaddwd (xmm1, esi);
+ xmm3=_mm_shuffle_epi32( xmm0, 0x55);
+ xmm0=_mm_shufflehi_epi16( xmm0, 0xD8 );
+ pmaddwd( xmm3, esi+32 );
+ xmm2=_mm_shuffle_epi32( xmm0, 0xAA );
+ xmm0=_mm_shuffle_epi32( xmm0, 0xFF );
+ pmaddwd( xmm2, esi+16 );
+ xmm4=_mm_shufflehi_epi16( xmm4, 0xD8 );
+ paddd (xmm1, M128_round_inv_row);
+ xmm4=_mm_shufflelo_epi16 (xmm4, 0xD8 );
+ pmaddwd (xmm0, esi+48 );
+ xmm5=_mm_shuffle_epi32( xmm4, 0 );
+ xmm6=_mm_shuffle_epi32( xmm4, 0xAA );
+ pmaddwd (xmm5, ecx );
+ paddd (xmm1, xmm2 );
+ movdqa (xmm2, xmm1 );
+ xmm7=_mm_shuffle_epi32( xmm4, 0x55 );
+ pmaddwd (xmm6, ecx+16 );
+ paddd (xmm0, xmm3 );
+ xmm4=_mm_shuffle_epi32( xmm4, 0xFF );
+ psubd (xmm2, xmm0 );
+ pmaddwd (xmm7, ecx+32 );
+ paddd (xmm0, xmm1 );
+ psrad (xmm2, 12 );
+ paddd (xmm5, M128_round_inv_row);
+ pmaddwd (xmm4, ecx+48 );
+ paddd (xmm5, xmm6 );
+ movdqa (xmm6, xmm5 );
+ psrad (xmm0, 12 );
+ xmm2=_mm_shuffle_epi32( xmm2, 0x1B );
+ packssdw (xmm0, xmm2 );
+ paddd (xmm4, xmm7 );
+ psubd (xmm6, xmm4 );
+ paddd (xmm4, xmm5 );
+ psrad (xmm6, 12 );
+ psrad (xmm4, 12 );
+ xmm6=_mm_shuffle_epi32( xmm6, 0x1B );
+ packssdw (xmm4, xmm6 );
}
-static __forceinline void DCT_8_INV_COL_8(__m128i &src0, __m128i &src1, __m128i &src2, __m128i &src3, __m128i &src4, __m128i &src5, __m128i &src6, __m128i &src7,
- __m128i &xmm0, __m128i &xmm1, __m128i &xmm2, __m128i &xmm3, __m128i &xmm4, __m128i &xmm5, __m128i &xmm6, __m128i &xmm7)
+static __forceinline void DCT_8_INV_COL_8(__m128i &src0,__m128i &src1,__m128i &src2,__m128i &src3,__m128i &src4,__m128i &src5,__m128i &src6,__m128i &src7,
+ __m128i &xmm0,__m128i &xmm1,__m128i &xmm2,__m128i &xmm3,__m128i &xmm4,__m128i &xmm5,__m128i &xmm6,__m128i &xmm7)
{
- movdqa(xmm1, M128_tg_3_16);
- movdqa(xmm2, xmm0);
- movdqa(xmm3, src3);
- pmulhw(xmm0, xmm1);
- pmulhw(xmm1, xmm3);
- movdqa(xmm5, M128_tg_1_16);
- movdqa(xmm6, xmm4);
- pmulhw(xmm4, xmm5);
- paddsw(xmm0, xmm2);
- pmulhw(xmm5, src1);
- paddsw(xmm1, xmm3);
- movdqa(xmm7, src6);
- paddsw(xmm0, xmm3);
- movdqa(xmm3, M128_tg_2_16);
- psubsw(xmm2, xmm1);
- pmulhw(xmm7, xmm3);
- movdqa(xmm1, xmm0);
- pmulhw(xmm3, src2);
- psubsw(xmm5, xmm6);
- paddsw(xmm4, src1);
- paddsw(xmm0, xmm4);
- paddsw(xmm0, M128_one_corr);
- psubsw(xmm4, xmm1);
- movdqa(xmm6, xmm5);
- psubsw(xmm5, xmm2);
- paddsw(xmm5, M128_one_corr);
- paddsw(xmm6, xmm2);
- movdqa(src7, xmm0);
- movdqa(xmm1, xmm4);
- movdqa(xmm0, M128_cos_4_16);
- paddsw(xmm4, xmm5);
- movdqa(xmm2, M128_cos_4_16);
- pmulhw(xmm2, xmm4);
- movdqa(src3, xmm6);
- psubsw(xmm1, xmm5);
- paddsw(xmm7, src2);
- psubsw(xmm3, src6);
- movdqa(xmm6, src0);
- pmulhw(xmm0, xmm1);
- movdqa(xmm5, src4);
- paddsw(xmm5, xmm6);
- psubsw(xmm6, src4);
- paddsw(xmm4, xmm2);
- por(xmm4, M128_one_corr);
- paddsw(xmm0, xmm1);
- por(xmm0, M128_one_corr);
- movdqa(xmm2, xmm5);
- paddsw(xmm5, xmm7);
- movdqa(xmm1, xmm6);
- paddsw(xmm5, M128_round_inv_col);
- psubsw(xmm2, xmm7);
- movdqa(xmm7, src7);
- paddsw(xmm6, xmm3);
- paddsw(xmm6, M128_round_inv_col);
- paddsw(xmm7, xmm5);
- psraw(xmm7, SHIFT_INV_COL);
- psubsw(xmm1, xmm3);
- paddsw(xmm1, M128_round_inv_corr);
- movdqa(xmm3, xmm6);
- paddsw(xmm2, M128_round_inv_corr);
- paddsw(xmm6, xmm4);
- movdqa(src0, xmm7);
- psraw(xmm6, SHIFT_INV_COL);
- movdqa(xmm7, xmm1);
- paddsw(xmm1, xmm0);
- movdqa(src1, xmm6);
- psraw(xmm1, SHIFT_INV_COL);
- movdqa(xmm6, src3);
- psubsw(xmm7, xmm0);
- psraw(xmm7, SHIFT_INV_COL);
- movdqa(src2, xmm1);
- psubsw(xmm5, src7);
- psraw(xmm5, SHIFT_INV_COL);
- movdqa(src7, xmm5);
- psubsw(xmm3, xmm4);
- paddsw(xmm6, xmm2);
- psubsw(xmm2, src3);
- psraw(xmm6, SHIFT_INV_COL);
- psraw(xmm2, SHIFT_INV_COL);
- movdqa(src3, xmm6);
- psraw(xmm3, SHIFT_INV_COL);
- movdqa(src4, xmm2);
- movdqa(src5, xmm7);
- movdqa(src6, xmm3);
+ movdqa( xmm1, M128_tg_3_16 );
+ movdqa( xmm2, xmm0 );
+ movdqa( xmm3, src3 );
+ pmulhw( xmm0, xmm1 );
+ pmulhw( xmm1, xmm3 );
+ movdqa( xmm5, M128_tg_1_16 );
+ movdqa( xmm6, xmm4 );
+ pmulhw( xmm4, xmm5 );
+ paddsw( xmm0, xmm2 );
+ pmulhw( xmm5, src1 );
+ paddsw( xmm1, xmm3 );
+ movdqa( xmm7, src6 );
+ paddsw( xmm0, xmm3 );
+ movdqa( xmm3, M128_tg_2_16 );
+ psubsw( xmm2, xmm1 );
+ pmulhw( xmm7, xmm3 );
+ movdqa( xmm1, xmm0 );
+ pmulhw( xmm3, src2 );
+ psubsw( xmm5, xmm6 );
+ paddsw( xmm4, src1 );
+ paddsw( xmm0, xmm4 );
+ paddsw( xmm0, M128_one_corr );
+ psubsw( xmm4, xmm1 );
+ movdqa( xmm6, xmm5 );
+ psubsw( xmm5, xmm2 );
+ paddsw( xmm5, M128_one_corr );
+ paddsw( xmm6, xmm2 );
+ movdqa( src7, xmm0 );
+ movdqa( xmm1, xmm4 );
+ movdqa( xmm0, M128_cos_4_16 );
+ paddsw( xmm4, xmm5 );
+ movdqa( xmm2, M128_cos_4_16 );
+ pmulhw( xmm2, xmm4 );
+ movdqa( src3, xmm6 );
+ psubsw( xmm1, xmm5 );
+ paddsw( xmm7, src2 );
+ psubsw( xmm3, src6 );
+ movdqa( xmm6, src0 );
+ pmulhw( xmm0, xmm1 );
+ movdqa( xmm5, src4 );
+ paddsw( xmm5, xmm6 );
+ psubsw( xmm6, src4 );
+ paddsw( xmm4, xmm2 );
+ por ( xmm4, M128_one_corr );
+ paddsw( xmm0, xmm1 );
+ por ( xmm0, M128_one_corr );
+ movdqa( xmm2, xmm5 );
+ paddsw( xmm5, xmm7 );
+ movdqa( xmm1, xmm6 );
+ paddsw( xmm5, M128_round_inv_col );
+ psubsw( xmm2, xmm7 );
+ movdqa( xmm7, src7 );
+ paddsw( xmm6, xmm3 );
+ paddsw( xmm6, M128_round_inv_col );
+ paddsw( xmm7, xmm5 );
+ psraw ( xmm7, SHIFT_INV_COL );
+ psubsw( xmm1, xmm3 );
+ paddsw( xmm1, M128_round_inv_corr );
+ movdqa( xmm3, xmm6 );
+ paddsw( xmm2, M128_round_inv_corr );
+ paddsw( xmm6, xmm4 );
+ movdqa( src0,xmm7 );
+ psraw (xmm6, SHIFT_INV_COL );
+ movdqa( xmm7, xmm1 );
+ paddsw( xmm1, xmm0 );
+ movdqa( src1, xmm6 );
+ psraw (xmm1, SHIFT_INV_COL );
+ movdqa( xmm6, src3 );
+ psubsw( xmm7, xmm0 );
+ psraw (xmm7, SHIFT_INV_COL );
+ movdqa( src2, xmm1 );
+ psubsw( xmm5, src7 );
+ psraw (xmm5, SHIFT_INV_COL );
+ movdqa( src7, xmm5 );
+ psubsw( xmm3, xmm4 );
+ paddsw( xmm6, xmm2 );
+ psubsw( xmm2, src3 );
+ psraw (xmm6, SHIFT_INV_COL );
+ psraw (xmm2, SHIFT_INV_COL );
+ movdqa( src3, xmm6 );
+ psraw (xmm3, SHIFT_INV_COL );
+ movdqa( src4, xmm2 );
+ movdqa( src5, xmm7 );
+ movdqa( src6, xmm3 );
}
-static __forceinline void idct_M128ASM(__m128i &src0, __m128i &src1, __m128i &src2, __m128i &src3, __m128i &src4, __m128i &src5, __m128i &src6, __m128i &src7)
+static __forceinline void idct_M128ASM(__m128i &src0,__m128i &src1,__m128i &src2,__m128i &src3,__m128i &src4,__m128i &src5,__m128i &src6,__m128i &src7)
{
- __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
- movdqa(xmm0, src0);
- uint8_t *esi = (uint8_t*)M128_tab_i_04;
- movdqa(xmm4, src2);
- uint8_t *ecx = (uint8_t*)M128_tab_i_26;
- DCT_8_INV_ROW(ecx, esi, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
- movdqa(src0, xmm0);
- movdqa(src2, xmm4);
+__m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7;
+ movdqa (xmm0, src0);
+ uint8_t *esi=(uint8_t*)M128_tab_i_04;
+ movdqa (xmm4, src2);
+ uint8_t *ecx=(uint8_t*)M128_tab_i_26;
+ DCT_8_INV_ROW(ecx,esi,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7);
+ movdqa (src0, xmm0);
+ movdqa (src2, xmm4);
- movdqa(xmm0, src4);
- movdqa(xmm4, src6);
- DCT_8_INV_ROW(ecx, esi, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
- movdqa(src4, xmm0);
- movdqa(src6, xmm4);
+ movdqa (xmm0, src4);
+ movdqa (xmm4, src6);
+ DCT_8_INV_ROW(ecx,esi,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7);
+ movdqa (src4, xmm0);
+ movdqa (src6, xmm4);
- movdqa(xmm0, src3);
- esi = (uint8_t*)M128_tab_i_35;
- movdqa(xmm4, src1);
- ecx = (uint8_t*)M128_tab_i_17;
- DCT_8_INV_ROW(ecx, esi, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
- movdqa(src3, xmm0);
- movdqa(src1, xmm4);
+ movdqa (xmm0, src3);
+ esi=(uint8_t*)M128_tab_i_35;
+ movdqa (xmm4, src1);
+ ecx=(uint8_t*)M128_tab_i_17;
+ DCT_8_INV_ROW(ecx,esi,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7);
+ movdqa (src3, xmm0);
+ movdqa (src1, xmm4);
- movdqa(xmm0, src5);
- movdqa(xmm4, src7);
- DCT_8_INV_ROW(ecx, esi, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
- DCT_8_INV_COL_8(src0, src1, src2, src3, src4, src5, src6, src7,
- xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
+ movdqa (xmm0, src5);
+ movdqa (xmm4, src7);
+ DCT_8_INV_ROW(ecx,esi,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7);
+ DCT_8_INV_COL_8(src0,src1,src2,src3,src4,src5,src6,src7,
+ xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7);
}
void mpeg2_idct_copy_sse2(int16_t* block, uint8_t* dest, const int stride)
{
- __m128i &src0 = *(__m128i*)(block + 0 * 16 / 2);
- __m128i &src1 = *(__m128i*)(block + 1 * 16 / 2);
- __m128i &src2 = *(__m128i*)(block + 2 * 16 / 2);
- __m128i &src3 = *(__m128i*)(block + 3 * 16 / 2);
- __m128i &src4 = *(__m128i*)(block + 4 * 16 / 2);
- __m128i &src5 = *(__m128i*)(block + 5 * 16 / 2);
- __m128i &src6 = *(__m128i*)(block + 6 * 16 / 2);
- __m128i &src7 = *(__m128i*)(block + 7 * 16 / 2);
- idct_M128ASM(src0, src1, src2, src3, src4, src5, src6, src7);
+ __m128i &src0=*(__m128i*)(block+0*16/2);
+ __m128i &src1=*(__m128i*)(block+1*16/2);
+ __m128i &src2=*(__m128i*)(block+2*16/2);
+ __m128i &src3=*(__m128i*)(block+3*16/2);
+ __m128i &src4=*(__m128i*)(block+4*16/2);
+ __m128i &src5=*(__m128i*)(block+5*16/2);
+ __m128i &src6=*(__m128i*)(block+6*16/2);
+ __m128i &src7=*(__m128i*)(block+7*16/2);
+ idct_M128ASM (src0,src1,src2,src3,src4,src5,src6,src7);
__m128i zero = _mm_setzero_si128();
@@ -254,17 +254,17 @@ void mpeg2_idct_copy_sse2(int16_t* block, uint8_t* dest, const int stride)
_mm_store_si128(&src7, zero);
}
-void mpeg2_idct_add_sse2(int, int16_t* block, uint8_t* dest, const int stride)
+void mpeg2_idct_add_sse2(int,int16_t* block, uint8_t* dest, const int stride)
{
- __m128i &src0 = *(__m128i*)(block + 0 * 16 / 2);
- __m128i &src1 = *(__m128i*)(block + 1 * 16 / 2);
- __m128i &src2 = *(__m128i*)(block + 2 * 16 / 2);
- __m128i &src3 = *(__m128i*)(block + 3 * 16 / 2);
- __m128i &src4 = *(__m128i*)(block + 4 * 16 / 2);
- __m128i &src5 = *(__m128i*)(block + 5 * 16 / 2);
- __m128i &src6 = *(__m128i*)(block + 6 * 16 / 2);
- __m128i &src7 = *(__m128i*)(block + 7 * 16 / 2);
- idct_M128ASM(src0, src1, src2, src3, src4, src5, src6, src7);
+ __m128i &src0=*(__m128i*)(block+0*16/2);
+ __m128i &src1=*(__m128i*)(block+1*16/2);
+ __m128i &src2=*(__m128i*)(block+2*16/2);
+ __m128i &src3=*(__m128i*)(block+3*16/2);
+ __m128i &src4=*(__m128i*)(block+4*16/2);
+ __m128i &src5=*(__m128i*)(block+5*16/2);
+ __m128i &src6=*(__m128i*)(block+6*16/2);
+ __m128i &src7=*(__m128i*)(block+7*16/2);
+ idct_M128ASM (src0,src1,src2,src3,src4,src5,src6,src7);
__m128i zero = _mm_setzero_si128();
diff --git a/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp b/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp
index 1947095c1..bb3aceb00 100644
--- a/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/libmpeg2.cpp
@@ -37,8 +37,7 @@
#define PIC_CODING_EXT 0x100
/* default intra quant matrix, in zig-zag order */
-static const uint8_t default_intra_quantizer_matrix[64] =
-{
+static const uint8_t default_intra_quantizer_matrix[64] = {
8,
16, 16,
19, 16, 19,
@@ -56,19 +55,17 @@ static const uint8_t default_intra_quantizer_matrix[64] =
83
};
-static uint8_t mpeg2_scan_norm_2[64] =
-{
+static uint8_t mpeg2_scan_norm_2[64] = {
/* Zig-Zag scan pattern */
- 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
+ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
};
-static uint8_t mpeg2_scan_alt_2[64] =
-{
+static uint8_t mpeg2_scan_alt_2[64] = {
/* Alternate scan pattern */
- 0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
+ 0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
41, 33, 26, 18, 3, 11, 4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
51, 59, 20, 28, 5, 13, 6, 14, 21, 29, 36, 44, 52, 60, 37, 45,
53, 61, 22, 30, 7, 15, 23, 31, 38, 46, 54, 62, 39, 47, 55, 63
@@ -113,14 +110,14 @@ static void __inline idct_row(int16_t* block)
/* shortcut */
if(!(block[1] | ((int32_t *)block)[1] | ((int32_t *)block)[2] | ((int32_t *)block)[3]))
- {
- uint32_t tmp = (uint16_t)(block[0] << 3);
- tmp |= tmp << 16;
- ((int32_t *)block)[0] = tmp;
- ((int32_t *)block)[1] = tmp;
- ((int32_t *)block)[2] = tmp;
- ((int32_t *)block)[3] = tmp;
- return;
+ {
+ uint32_t tmp = (uint16_t) (block[0] << 3);
+ tmp |= tmp << 16;
+ ((int32_t *)block)[0] = tmp;
+ ((int32_t *)block)[1] = tmp;
+ ((int32_t *)block)[2] = tmp;
+ ((int32_t *)block)[3] = tmp;
+ return;
}
d0 = (block[0] << 11) + 128;
@@ -201,96 +198,84 @@ static void __inline idct_col(int16_t* block)
static void mpeg2_idct_copy_c(int16_t* block, uint8_t* dest, const int stride)
{
- for(int i = 0; i < 8; i++) idct_row(block + 8 * i);
- for(int i = 0; i < 8; i++) idct_col(block + i);
+ for(int i = 0; i < 8; i++) idct_row(block + 8 * i);
+ for(int i = 0; i < 8; i++) idct_col(block + i);
for(int i = 0; i < 8; i++)
- {
- dest[0] = CLIP(block[0]);
- dest[1] = CLIP(block[1]);
- dest[2] = CLIP(block[2]);
- dest[3] = CLIP(block[3]);
- dest[4] = CLIP(block[4]);
- dest[5] = CLIP(block[5]);
- dest[6] = CLIP(block[6]);
- dest[7] = CLIP(block[7]);
-
- block[0] = 0;
- block[1] = 0;
- block[2] = 0;
- block[3] = 0;
- block[4] = 0;
- block[5] = 0;
- block[6] = 0;
- block[7] = 0;
-
- dest += stride;
- block += 8;
+ {
+ dest[0] = CLIP(block[0]);
+ dest[1] = CLIP(block[1]);
+ dest[2] = CLIP(block[2]);
+ dest[3] = CLIP(block[3]);
+ dest[4] = CLIP(block[4]);
+ dest[5] = CLIP(block[5]);
+ dest[6] = CLIP(block[6]);
+ dest[7] = CLIP(block[7]);
+
+ block[0] = 0; block[1] = 0; block[2] = 0; block[3] = 0;
+ block[4] = 0; block[5] = 0; block[6] = 0; block[7] = 0;
+
+ dest += stride;
+ block += 8;
}
}
static void mpeg2_idct_add_c(const int last, int16_t* block, uint8_t* dest, const int stride)
{
if(last != 129 || (block[0] & 7) == 4)
- {
- for(int i = 0; i < 8; i++) idct_row(block + 8 * i);
- for(int i = 0; i < 8; i++) idct_col(block + i);
- for(int i = 0; i < 8; i++)
- {
- dest[0] = CLIP(block[0] + dest[0]);
- dest[1] = CLIP(block[1] + dest[1]);
- dest[2] = CLIP(block[2] + dest[2]);
- dest[3] = CLIP(block[3] + dest[3]);
- dest[4] = CLIP(block[4] + dest[4]);
- dest[5] = CLIP(block[5] + dest[5]);
- dest[6] = CLIP(block[6] + dest[6]);
- dest[7] = CLIP(block[7] + dest[7]);
-
- block[0] = 0;
- block[1] = 0;
- block[2] = 0;
- block[3] = 0;
- block[4] = 0;
- block[5] = 0;
- block[6] = 0;
- block[7] = 0;
-
- dest += stride;
- block += 8;
- }
- }
- else
- {
- int DC = (block[0] + 4) >> 3;
- block[0] = block[63] = 0;
- for(int i = 0; i < 8; i++)
- {
- dest[0] = CLIP(DC + dest[0]);
- dest[1] = CLIP(DC + dest[1]);
- dest[2] = CLIP(DC + dest[2]);
- dest[3] = CLIP(DC + dest[3]);
- dest[4] = CLIP(DC + dest[4]);
- dest[5] = CLIP(DC + dest[5]);
- dest[6] = CLIP(DC + dest[6]);
- dest[7] = CLIP(DC + dest[7]);
- dest += stride;
- }
+ {
+ for(int i = 0; i < 8; i++) idct_row(block + 8 * i);
+ for(int i = 0; i < 8; i++) idct_col(block + i);
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(block[0] + dest[0]);
+ dest[1] = CLIP(block[1] + dest[1]);
+ dest[2] = CLIP(block[2] + dest[2]);
+ dest[3] = CLIP(block[3] + dest[3]);
+ dest[4] = CLIP(block[4] + dest[4]);
+ dest[5] = CLIP(block[5] + dest[5]);
+ dest[6] = CLIP(block[6] + dest[6]);
+ dest[7] = CLIP(block[7] + dest[7]);
+
+ block[0] = 0; block[1] = 0; block[2] = 0; block[3] = 0;
+ block[4] = 0; block[5] = 0; block[6] = 0; block[7] = 0;
+
+ dest += stride;
+ block += 8;
+ }
+ }
+ else
+ {
+ int DC = (block[0] + 4) >> 3;
+ block[0] = block[63] = 0;
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(DC + dest[0]);
+ dest[1] = CLIP(DC + dest[1]);
+ dest[2] = CLIP(DC + dest[2]);
+ dest[3] = CLIP(DC + dest[3]);
+ dest[4] = CLIP(DC + dest[4]);
+ dest[5] = CLIP(DC + dest[5]);
+ dest[6] = CLIP(DC + dest[6]);
+ dest[7] = CLIP(DC + dest[7]);
+ dest += stride;
+ }
}
}
static void mpeg2_idct_init_c()
{
- for(int i = -3840; i < 3840 + 256; i++)
- {
- CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
- }
+ for(int i = -3840; i < 3840 + 256; i++)
+ {
+ CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
+ }
- // only needed with idct_c
+ // only needed with idct_c
- for(int i = 0; i < 64; i++)
- {
- mpeg2_scan_norm_2[i] = ((mpeg2_scan_norm_2[i] & 0x36) >> 1) | ((mpeg2_scan_norm_2[i] & 0x09) << 2);
- mpeg2_scan_alt_2[i] = ((mpeg2_scan_alt_2[i] & 0x36) >> 1) | ((mpeg2_scan_alt_2[i] & 0x09) << 2);
- }
+ for(int i = 0; i < 64; i++)
+ {
+ mpeg2_scan_norm_2[i] = ((mpeg2_scan_norm_2[i] & 0x36) >> 1) | ((mpeg2_scan_norm_2[i] & 0x09) << 2);
+ mpeg2_scan_alt_2[i] = ((mpeg2_scan_alt_2[i] & 0x36) >> 1) | ((mpeg2_scan_alt_2[i] & 0x09) << 2);
+ }
}
// mc (c)
@@ -350,14 +335,14 @@ static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, const int
/* definitions of the actual mc functions */
-MC_FUNC(put, o)
-MC_FUNC(avg, o)
-MC_FUNC(put, x)
-MC_FUNC(avg, x)
-MC_FUNC(put, y)
-MC_FUNC(avg, y)
-MC_FUNC(put, xy)
-MC_FUNC(avg, xy)
+MC_FUNC(put,o)
+MC_FUNC(avg,o)
+MC_FUNC(put,x)
+MC_FUNC(avg,x)
+MC_FUNC(put,y)
+MC_FUNC(avg,y)
+MC_FUNC(put,xy)
+MC_FUNC(avg,xy)
#define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \
{MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \
@@ -376,9 +361,9 @@ extern "C" void mpeg2_idct_add_mmx(const int last, int16_t* block, uint8_t* dest
static void mpeg2_idct_init_mmx()
{
for(int i = 0; i < 64; i++)
- {
- mpeg2_scan_norm_2[i] = (mpeg2_scan_norm_2[i] & 0x38) | ((mpeg2_scan_norm_2[i] & 6) >> 1) | ((mpeg2_scan_norm_2[i] & 1) << 2);
- mpeg2_scan_alt_2[i] = (mpeg2_scan_alt_2[i] & 0x38) | ((mpeg2_scan_alt_2[i] & 6) >> 1) | ((mpeg2_scan_alt_2[i] & 1) << 2);
+ {
+ mpeg2_scan_norm_2[i] = (mpeg2_scan_norm_2[i] & 0x38) | ((mpeg2_scan_norm_2[i] & 6) >> 1) | ((mpeg2_scan_norm_2[i] & 1) << 2);
+ mpeg2_scan_alt_2[i] = (mpeg2_scan_alt_2[i] & 0x38) | ((mpeg2_scan_alt_2[i] & 6) >> 1) | ((mpeg2_scan_alt_2[i] & 1) << 2);
}
}
@@ -402,7 +387,7 @@ static void mpeg2_idct_init_c();
static void mpeg2_idct_copy_c(int16_t* block, uint8_t* dest, const int stride);
static void mpeg2_idct_add_c(const int last, int16_t* block, uint8_t* dest, const int stride);
-// mc (c)
+ // mc (c)
static void MC_c(uint8_t* dest, const uint8_t* ref, const int stride, int height);
@@ -414,11 +399,11 @@ CMpeg2Dec::CMpeg2Dec()
{
m_shift = 0;
m_is_display_initialized = 0;
- m_action = NULL;
+ m_action = NULL;
m_state = STATE_BUFFER;
m_ext_state = 0;
- m_chunk_buffer = m_chunk_start = m_chunk_ptr = NULL;
+ m_chunk_buffer = m_chunk_start = m_chunk_ptr = NULL;
m_code = 0;
m_pts_current = m_pts_previous = 0;
@@ -432,7 +417,7 @@ CMpeg2Dec::CMpeg2Dec()
memset(&m_sequence, 0, sizeof(m_sequence));
memset(&m_gop, 0, sizeof(m_gop));
memset(&m_pictures, 0, sizeof(m_pictures));
- m_picture = NULL;
+ m_picture = NULL;
memset(&m_fbuf, 0, sizeof(m_fbuf));
memset(&m_fbuf_alloc, 0, sizeof(m_fbuf_alloc));
@@ -444,288 +429,288 @@ CMpeg2Dec::CMpeg2Dec()
memset(&m_intra_quantizer_matrix, 0, sizeof(m_intra_quantizer_matrix));
memset(&m_non_intra_quantizer_matrix, 0, sizeof(m_non_intra_quantizer_matrix));
- //
+ //
- mpeg2_init();
+ mpeg2_init();
}
CMpeg2Dec::~CMpeg2Dec()
{
- mpeg2_close();
+ mpeg2_close();
}
void CMpeg2Dec::mpeg2_init()
{
- m_chunk_buffer = (uint8_t*)_aligned_malloc(BUFFER_SIZE + 4, 16);
- m_shift = 0xffffff00;
- m_code = 0xb4;
- m_action = &CMpeg2Dec::mpeg2_seek_sequence;
- m_sequence.width = (unsigned) - 1;
+ m_chunk_buffer = (uint8_t*)_aligned_malloc(BUFFER_SIZE + 4, 16);
+ m_shift = 0xffffff00;
+ m_code = 0xb4;
+ m_action = &CMpeg2Dec::mpeg2_seek_sequence;
+ m_sequence.width = (unsigned)-1;
}
void CMpeg2Dec::mpeg2_close()
{
- /* static uint8_t finalizer[] = {0,0,1,0xb4}; */
- /* mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4); */
+ /* static uint8_t finalizer[] = {0,0,1,0xb4}; */
+ /* mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4); */
- mpeg2_header_state_init();
- _aligned_free(m_chunk_buffer);
+ mpeg2_header_state_init();
+ _aligned_free(m_chunk_buffer);
}
//
int CMpeg2Dec::skip_chunk(int bytes)
{
- if(!bytes)
- return 0;
+ if(!bytes)
+ return 0;
- int len = 0;
+ int len = 0;
- uint8_t* current = m_buf_start;
- uint8_t* limit = current + bytes;
+ uint8_t* current = m_buf_start;
+ uint8_t* limit = current + bytes;
- while(current < limit)
- {
- if(m_shift == 0x00000100)
- {
- m_shift = 0xffffff00;
- len = ++current - m_buf_start;
- break;
- }
+ while(current < limit)
+ {
+ if(m_shift == 0x00000100)
+ {
+ m_shift = 0xffffff00;
+ len = ++current - m_buf_start;
+ break;
+ }
- m_shift = (m_shift | *current++) << 8;
- }
+ m_shift = (m_shift | *current++) << 8;
+ }
- m_buf_start = current;
+ m_buf_start = current;
- return len;
+ return len;
}
int CMpeg2Dec::copy_chunk(int bytes)
{
- if(!bytes)
- return 0;
+ if(!bytes)
+ return 0;
- int len = 0;
+ int len = 0;
- // this assembly gives us a nice speed up
- // 36 sec down to 32 sec decoding the ts.stream.tpr test file
- // (idtc, mc was set to null)
+ // this assembly gives us a nice speed up
+ // 36 sec down to 32 sec decoding the ts.stream.tpr test file
+ // (idtc, mc was set to null)
#ifndef _WIN64
- __asm
- {
- mov ebx, this
- mov esi, [ebx].m_buf_start
- mov edi, [ebx].m_chunk_ptr
- mov ecx, bytes
- mov edx, [ebx].m_shift
-
- copy_chunk_loop:
-
- cmp edx, 0x00000100
- jne copy_chunk_continue
- mov edx, 0xffffff00
-
- inc edi
- mov [ebx].m_chunk_ptr, edi
-
- inc esi
- mov eax, esi
- sub eax, [ebx].m_buf_start
- mov len, eax
-
- jmp copy_chunk_end
-
- copy_chunk_continue:
-
- movzx eax, byte ptr [esi]
- or edx, eax
- shl edx, 8
- mov byte ptr [edi], al
- inc esi
- inc edi
- dec ecx
- jnz copy_chunk_loop
-
- copy_chunk_end:
-
- mov [ebx].m_buf_start, esi
- mov [ebx].m_shift, edx
- }
+ __asm
+ {
+ mov ebx, this
+ mov esi, [ebx].m_buf_start
+ mov edi, [ebx].m_chunk_ptr
+ mov ecx, bytes
+ mov edx, [ebx].m_shift
+
+ copy_chunk_loop:
+
+ cmp edx, 0x00000100
+ jne copy_chunk_continue
+ mov edx, 0xffffff00
+
+ inc edi
+ mov [ebx].m_chunk_ptr, edi
+
+ inc esi
+ mov eax, esi
+ sub eax, [ebx].m_buf_start
+ mov len, eax
+
+ jmp copy_chunk_end
+
+ copy_chunk_continue:
+
+ movzx eax, byte ptr [esi]
+ or edx, eax
+ shl edx, 8
+ mov byte ptr [edi], al
+ inc esi
+ inc edi
+ dec ecx
+ jnz copy_chunk_loop
+
+ copy_chunk_end:
+
+ mov [ebx].m_buf_start, esi
+ mov [ebx].m_shift, edx
+ }
#else
- uint8_t* chunk_ptr = m_chunk_ptr;
- uint8_t* current = m_buf_start;
- uint8_t* limit = current + bytes;
-
- while(current < limit)
- {
- if(m_shift == 0x00000100)
- {
- m_shift = 0xffffff00;
- len = ++current - m_buf_start;
- m_chunk_ptr = ++chunk_ptr;
- break;
- }
-
- m_shift = (m_shift | (*chunk_ptr++ = *current++)) << 8;
- }
-
- m_buf_start = current;
+ uint8_t* chunk_ptr = m_chunk_ptr;
+ uint8_t* current = m_buf_start;
+ uint8_t* limit = current + bytes;
+
+ while(current < limit)
+ {
+ if(m_shift == 0x00000100)
+ {
+ m_shift = 0xffffff00;
+ len = ++current - m_buf_start;
+ m_chunk_ptr = ++chunk_ptr;
+ break;
+ }
+
+ m_shift = (m_shift | (*chunk_ptr++ = *current++)) << 8;
+ }
+
+ m_buf_start = current;
#endif
- return len;
+ return len;
}
mpeg2_state_t CMpeg2Dec::seek_chunk()
{
- int size = m_buf_end - m_buf_start;
+ int size = m_buf_end - m_buf_start;
- if(int skipped = skip_chunk(size))
- {
- m_bytes_since_pts += skipped;
- m_code = m_buf_start[-1];
- return (mpeg2_state_t) - 1;
- }
+ if(int skipped = skip_chunk(size))
+ {
+ m_bytes_since_pts += skipped;
+ m_code = m_buf_start[-1];
+ return (mpeg2_state_t)-1;
+ }
- m_bytes_since_pts += size;
- return STATE_BUFFER;
+ m_bytes_since_pts += size;
+ return STATE_BUFFER;
}
mpeg2_state_t CMpeg2Dec::seek_header()
{
- while(m_code != 0xb3 && (m_code != 0xb7 && m_code != 0xb8 && m_code || m_sequence.width == (unsigned) - 1))
- {
- if(seek_chunk() == STATE_BUFFER)
- return STATE_BUFFER;
- }
+ while(m_code != 0xb3 && (m_code != 0xb7 && m_code != 0xb8 && m_code || m_sequence.width == (unsigned)-1))
+ {
+ if(seek_chunk() == STATE_BUFFER)
+ return STATE_BUFFER;
+ }
- m_chunk_start = m_chunk_ptr = m_chunk_buffer;
+ m_chunk_start = m_chunk_ptr = m_chunk_buffer;
- return m_code
- ? mpeg2_parse_header()
- : mpeg2_header_picture_start();
+ return m_code
+ ? mpeg2_parse_header()
+ : mpeg2_header_picture_start();
}
mpeg2_state_t CMpeg2Dec::seek_sequence()
{
- mpeg2_header_state_init();
- m_action = &CMpeg2Dec::seek_header;
- return seek_header();
+ mpeg2_header_state_init();
+ m_action = &CMpeg2Dec::seek_header;
+ return seek_header();
}
//
void CMpeg2Dec::mpeg2_buffer(uint8_t* start, uint8_t* end)
{
- m_buf_start = start;
- m_buf_end = end;
+ m_buf_start = start;
+ m_buf_end = end;
}
int CMpeg2Dec::mpeg2_getpos()
{
- return m_buf_end - m_buf_start;
+ return m_buf_end - m_buf_start;
}
//
mpeg2_state_t CMpeg2Dec::mpeg2_parse()
{
- if(m_action)
- {
- mpeg2_state_t state = (this->*m_action)();
- if((int)state >= 0)
- return state;
- }
-
- while(1)
- {
- while((unsigned)(m_code - m_first_decode_slice) < m_nb_decode_slices)
- {
- int size_buffer = m_buf_end - m_buf_start;
- int size_chunk = (m_chunk_buffer + BUFFER_SIZE - m_chunk_ptr);
- int copied;
-
- if(size_buffer <= size_chunk)
- {
- copied = copy_chunk(size_buffer);
- if(!copied)
- {
- m_bytes_since_pts += size_buffer;
- m_chunk_ptr += size_buffer;
- return STATE_BUFFER;
- }
- }
- else
- {
- copied = copy_chunk(size_chunk);
- if(!copied)
- {
- /* filled the chunk buffer without finding a start code */
- m_bytes_since_pts += size_chunk;
- m_action = &CMpeg2Dec::seek_chunk;
- return STATE_INVALID;
- }
- }
-
- m_bytes_since_pts += copied;
-
- m_decoder.mpeg2_slice(m_code, m_chunk_start);
- m_code = m_buf_start[-1];
- m_chunk_ptr = m_chunk_start;
- }
-
- if((unsigned)(m_code - 1) >= 0xb0 - 1)
- break;
- if(seek_chunk() == STATE_BUFFER)
- return STATE_BUFFER;
- }
-
- switch(m_code)
- {
- case 0x00:
- m_action = &CMpeg2Dec::mpeg2_header_picture_start;
- return m_state;
- case 0xb7:
- m_action = &CMpeg2Dec::mpeg2_header_end;
- break;
- case 0xb3:
- case 0xb8:
- m_action = &CMpeg2Dec::mpeg2_parse_header;
- break;
- case 0xbe:
- m_action = &CMpeg2Dec::seek_chunk;
- return STATE_PADDING;
- default:
- m_action = &CMpeg2Dec::seek_chunk;
- return STATE_INVALID;
- }
-
- if(m_state != STATE_SLICE)
- m_state = STATE_INVALID;
-
- return m_state;
+ if(m_action)
+ {
+ mpeg2_state_t state = (this->*m_action)();
+ if((int)state >= 0)
+ return state;
+ }
+
+ while(1)
+ {
+ while((unsigned)(m_code - m_first_decode_slice) < m_nb_decode_slices)
+ {
+ int size_buffer = m_buf_end - m_buf_start;
+ int size_chunk = (m_chunk_buffer + BUFFER_SIZE - m_chunk_ptr);
+ int copied;
+
+ if(size_buffer <= size_chunk)
+ {
+ copied = copy_chunk(size_buffer);
+ if(!copied)
+ {
+ m_bytes_since_pts += size_buffer;
+ m_chunk_ptr += size_buffer;
+ return STATE_BUFFER;
+ }
+ }
+ else
+ {
+ copied = copy_chunk(size_chunk);
+ if(!copied)
+ {
+ /* filled the chunk buffer without finding a start code */
+ m_bytes_since_pts += size_chunk;
+ m_action = &CMpeg2Dec::seek_chunk;
+ return STATE_INVALID;
+ }
+ }
+
+ m_bytes_since_pts += copied;
+
+ m_decoder.mpeg2_slice(m_code, m_chunk_start);
+ m_code = m_buf_start[-1];
+ m_chunk_ptr = m_chunk_start;
+ }
+
+ if((unsigned)(m_code - 1) >= 0xb0 - 1)
+ break;
+ if(seek_chunk() == STATE_BUFFER)
+ return STATE_BUFFER;
+ }
+
+ switch(m_code)
+ {
+ case 0x00:
+ m_action = &CMpeg2Dec::mpeg2_header_picture_start;
+ return m_state;
+ case 0xb7:
+ m_action = &CMpeg2Dec::mpeg2_header_end;
+ break;
+ case 0xb3:
+ case 0xb8:
+ m_action = &CMpeg2Dec::mpeg2_parse_header;
+ break;
+ case 0xbe:
+ m_action = &CMpeg2Dec::seek_chunk;
+ return STATE_PADDING;
+ default:
+ m_action = &CMpeg2Dec::seek_chunk;
+ return STATE_INVALID;
+ }
+
+ if(m_state != STATE_SLICE)
+ m_state = STATE_INVALID;
+
+ return m_state;
}
void CMpeg2Dec::mpeg2_skip(int skip)
{
- m_first_decode_slice = 1;
- m_nb_decode_slices = skip ? 0 : (0xb0 - 1);
+ m_first_decode_slice = 1;
+ m_nb_decode_slices = skip ? 0 : (0xb0 - 1);
}
void CMpeg2Dec::mpeg2_slice_region(int start, int end)
{
- start = (start < 1) ? 1 : (start > 0xb0) ? 0xb0 : start;
- end = (end < start) ? start : (end > 0xb0) ? 0xb0 : end;
- m_first_decode_slice = start;
- m_nb_decode_slices = end - start;
+ start = (start < 1) ? 1 : (start > 0xb0) ? 0xb0 : start;
+ end = (end < start) ? start : (end > 0xb0) ? 0xb0 : end;
+ m_first_decode_slice = start;
+ m_nb_decode_slices = end - start;
}
void CMpeg2Dec::mpeg2_pts(uint32_t pts)
{
- m_pts_previous = m_pts_current;
- m_pts_current = pts;
- m_num_pts++;
- m_bytes_since_pts = 0;
+ m_pts_previous = m_pts_current;
+ m_pts_current = pts;
+ m_num_pts++;
+ m_bytes_since_pts = 0;
}
//
@@ -736,123 +721,123 @@ void CMpeg2Dec::mpeg2_pts(uint32_t pts)
mpeg2_state_t CMpeg2Dec::mpeg2_seek_sequence()
{
- mpeg2_header_state_init();
- m_action = &CMpeg2Dec::seek_header;
- return seek_header();
+ mpeg2_header_state_init();
+ m_action = &CMpeg2Dec::seek_header;
+ return seek_header();
}
mpeg2_state_t CMpeg2Dec::mpeg2_parse_header()
{
- static int (CMpeg2Dec::* process_header[])() =
- {
- &CMpeg2Dec::mpeg2_header_picture,
- &CMpeg2Dec::mpeg2_header_extension,
- &CMpeg2Dec::mpeg2_header_user_data,
- &CMpeg2Dec::mpeg2_header_sequence,
- NULL, NULL, NULL, NULL,
- &CMpeg2Dec::mpeg2_header_gop
- };
-
- m_action = &CMpeg2Dec::mpeg2_parse_header;
-
- while(1)
- {
- int size_buffer = m_buf_end - m_buf_start;
- int size_chunk = (m_chunk_buffer + BUFFER_SIZE - m_chunk_ptr);
- int copied;
- if(size_buffer <= size_chunk)
- {
- copied = copy_chunk(size_buffer);
- if(!copied)
- {
- m_bytes_since_pts += size_buffer;
- m_chunk_ptr += size_buffer;
- return STATE_BUFFER;
- }
- }
- else
- {
- copied = copy_chunk(size_chunk);
- if(!copied)
- {
- /* filled the chunk buffer without finding a start code */
- m_bytes_since_pts += size_chunk;
- m_code = 0xb4;
- m_action = &CMpeg2Dec::seek_header;
- return STATE_INVALID;
- }
- }
- m_bytes_since_pts += copied;
-
- if((this->*(process_header[m_code & 0x0b]))())
- {
- m_code = m_buf_start[-1];
- m_action = &CMpeg2Dec::seek_header;
- return STATE_INVALID;
- }
-
- m_code = m_buf_start[-1];
-
- switch(RECEIVED(m_code, m_state))
- {
- /* state transition after a sequence header */
- case RECEIVED(0x00, STATE_SEQUENCE):
- m_action = &CMpeg2Dec::mpeg2_header_picture_start;
- case RECEIVED(0xb8, STATE_SEQUENCE):
- mpeg2_header_sequence_finalize();
- break;
-
- /* other legal state transitions */
- case RECEIVED(0x00, STATE_GOP):
- m_action = &CMpeg2Dec::mpeg2_header_picture_start;
- break;
- case RECEIVED(0x01, STATE_PICTURE):
- case RECEIVED(0x01, STATE_PICTURE_2ND):
- mpeg2_header_matrix_finalize();
- m_action = &CMpeg2Dec::mpeg2_header_slice_start;
- break;
-
- /* legal headers within a given state */
- case RECEIVED(0xb2, STATE_SEQUENCE):
- case RECEIVED(0xb2, STATE_GOP):
- case RECEIVED(0xb2, STATE_PICTURE):
- case RECEIVED(0xb2, STATE_PICTURE_2ND):
- case RECEIVED(0xb5, STATE_SEQUENCE):
- case RECEIVED(0xb5, STATE_PICTURE):
- case RECEIVED(0xb5, STATE_PICTURE_2ND):
- m_chunk_ptr = m_chunk_start;
- continue;
-
- default:
- m_action = &CMpeg2Dec::seek_header;
- return STATE_INVALID;
- }
-
- m_chunk_start = m_chunk_ptr = m_chunk_buffer;
- return m_state;
- }
+ static int (CMpeg2Dec::* process_header[]) () =
+ {
+ &CMpeg2Dec::mpeg2_header_picture,
+ &CMpeg2Dec::mpeg2_header_extension,
+ &CMpeg2Dec::mpeg2_header_user_data,
+ &CMpeg2Dec::mpeg2_header_sequence,
+ NULL, NULL, NULL, NULL,
+ &CMpeg2Dec::mpeg2_header_gop
+ };
+
+ m_action = &CMpeg2Dec::mpeg2_parse_header;
+
+ while(1)
+ {
+ int size_buffer = m_buf_end - m_buf_start;
+ int size_chunk = (m_chunk_buffer + BUFFER_SIZE - m_chunk_ptr);
+ int copied;
+ if(size_buffer <= size_chunk)
+ {
+ copied = copy_chunk(size_buffer);
+ if(!copied)
+ {
+ m_bytes_since_pts += size_buffer;
+ m_chunk_ptr += size_buffer;
+ return STATE_BUFFER;
+ }
+ }
+ else
+ {
+ copied = copy_chunk(size_chunk);
+ if(!copied)
+ {
+ /* filled the chunk buffer without finding a start code */
+ m_bytes_since_pts += size_chunk;
+ m_code = 0xb4;
+ m_action = &CMpeg2Dec::seek_header;
+ return STATE_INVALID;
+ }
+ }
+ m_bytes_since_pts += copied;
+
+ if((this->*(process_header[m_code & 0x0b]))())
+ {
+ m_code = m_buf_start[-1];
+ m_action = &CMpeg2Dec::seek_header;
+ return STATE_INVALID;
+ }
+
+ m_code = m_buf_start[-1];
+
+ switch(RECEIVED(m_code, m_state))
+ {
+ /* state transition after a sequence header */
+ case RECEIVED(0x00, STATE_SEQUENCE):
+ m_action = &CMpeg2Dec::mpeg2_header_picture_start;
+ case RECEIVED(0xb8, STATE_SEQUENCE):
+ mpeg2_header_sequence_finalize();
+ break;
+
+ /* other legal state transitions */
+ case RECEIVED (0x00, STATE_GOP):
+ m_action = &CMpeg2Dec::mpeg2_header_picture_start;
+ break;
+ case RECEIVED (0x01, STATE_PICTURE):
+ case RECEIVED (0x01, STATE_PICTURE_2ND):
+ mpeg2_header_matrix_finalize();
+ m_action = &CMpeg2Dec::mpeg2_header_slice_start;
+ break;
+
+ /* legal headers within a given state */
+ case RECEIVED (0xb2, STATE_SEQUENCE):
+ case RECEIVED (0xb2, STATE_GOP):
+ case RECEIVED (0xb2, STATE_PICTURE):
+ case RECEIVED (0xb2, STATE_PICTURE_2ND):
+ case RECEIVED (0xb5, STATE_SEQUENCE):
+ case RECEIVED (0xb5, STATE_PICTURE):
+ case RECEIVED (0xb5, STATE_PICTURE_2ND):
+ m_chunk_ptr = m_chunk_start;
+ continue;
+
+ default:
+ m_action = &CMpeg2Dec::seek_header;
+ return STATE_INVALID;
+ }
+
+ m_chunk_start = m_chunk_ptr = m_chunk_buffer;
+ return m_state;
+ }
}
/* header.c */
void CMpeg2Dec::mpeg2_header_state_init()
{
- if(m_sequence.width != (unsigned) - 1)
- {
- m_sequence.width = (unsigned) - 1;
- for(int i = 0; i < m_alloc_index; i++)
- _aligned_free(m_fbuf_alloc[i].buf[0]);
+ if(m_sequence.width != (unsigned)-1)
+ {
+ m_sequence.width = (unsigned)-1;
+ for(int i = 0; i < m_alloc_index; i++)
+ _aligned_free(m_fbuf_alloc[i].buf[0]);
}
- m_decoder.m_scan = mpeg2_scan_norm_2;
- m_picture = m_pictures;
- m_fbuf[0] = &m_fbuf_alloc[0];
- m_fbuf[1] = &m_fbuf_alloc[1];
- m_fbuf[2] = &m_fbuf_alloc[2];
- m_first = true;
- m_alloc_index = 0;
- m_first_decode_slice = 1;
- m_nb_decode_slices = 0xb0 - 1;
+ m_decoder.m_scan = mpeg2_scan_norm_2;
+ m_picture = m_pictures;
+ m_fbuf[0] = &m_fbuf_alloc[0];
+ m_fbuf[1] = &m_fbuf_alloc[1];
+ m_fbuf[2] = &m_fbuf_alloc[2];
+ m_first = true;
+ m_alloc_index = 0;
+ m_first_decode_slice = 1;
+ m_nb_decode_slices = 0xb0 - 1;
}
int CMpeg2Dec::mpeg2_header_sequence()
@@ -862,13 +847,13 @@ int CMpeg2Dec::mpeg2_header_sequence()
static unsigned int frame_period[9] = {0, 1126125, 1125000, 1080000, 900900, 900000, 540000, 450450, 450000};
if((buffer[6] & 0x20) != 0x20) /* missing marker_bit */
- return 1;
+ return 1;
int i = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
if(!(sequence->display_width = sequence->picture_width = i >> 12))
- return 1;
+ return 1;
if(!(sequence->display_height = sequence->picture_height = i & 0xfff))
- return 1;
+ return 1;
sequence->width = (sequence->picture_width + 15) & ~15;
sequence->height = (sequence->picture_height + 15) & ~15;
@@ -878,33 +863,33 @@ int CMpeg2Dec::mpeg2_header_sequence()
sequence->pixel_width = buffer[3] >> 4; /* aspect ratio */
sequence->frame_period = 0;
if((buffer[3] & 15) < 9) sequence->frame_period = frame_period[buffer[3] & 15];
- sequence->byte_rate = (buffer[4] << 10) | (buffer[5] << 2) | (buffer[6] >> 6);
- sequence->vbv_buffer_size = ((buffer[6] << 16) | (buffer[7] << 8)) & 0x1ff800;
+ sequence->byte_rate = (buffer[4]<<10) | (buffer[5]<<2) | (buffer[6]>>6);
+ sequence->vbv_buffer_size = ((buffer[6]<<16)|(buffer[7]<<8))&0x1ff800;
if(buffer[7] & 4) sequence->flags |= SEQ_FLAG_CONSTRAINED_PARAMETERS;
m_copy_matrix = 3;
if(buffer[7] & 2)
- {
- for(i = 0; i < 64; i++)
- m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i+7] << 7) | (buffer[i+8] >> 1);
- buffer += 64;
- }
- else
- {
- for(i = 0; i < 64; i++)
- m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = default_intra_quantizer_matrix[i];
+ {
+ for(i = 0; i < 64; i++)
+ m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i+7] << 7) | (buffer[i+8] >> 1);
+ buffer += 64;
}
+ else
+ {
+ for (i = 0; i < 64; i++)
+ m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = default_intra_quantizer_matrix[i];
+ }
if(buffer[7] & 1)
- {
- for(i = 0; i < 64; i++)
+ {
+ for(i = 0; i < 64; i++)
m_non_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = buffer[i+8];
- }
+ }
else
- {
- for(i = 0; i < 64; i++)
- m_non_intra_quantizer_matrix[i] = 16;
- }
+ {
+ for(i = 0; i < 64; i++)
+ m_non_intra_quantizer_matrix[i] = 16;
+ }
sequence->profile_level_id = 0x80;
sequence->colour_primaries = 0;
@@ -924,9 +909,9 @@ int CMpeg2Dec::mpeg2_header_sequence()
int CMpeg2Dec::mpeg2_header_gop()
{
uint8_t* buffer = m_chunk_start;
- m_info.Reset();
- if(!(buffer[1] & 8))
- return 1;
+ m_info.Reset();
+ if(!(buffer[1] & 8))
+ return 1;
m_info.m_gop = &m_gop;
m_gop.hours = (buffer[0] >> 2) & 31;
m_gop.minutes = ((buffer[0] << 4) | (buffer[1] >> 4)) & 63;
@@ -939,169 +924,167 @@ int CMpeg2Dec::mpeg2_header_gop()
mpeg2_state_t CMpeg2Dec::mpeg2_header_picture_start()
{
- {
- mpeg2_picture_t* picture;
-
- if(m_state != STATE_SLICE_1ST)
- {
- m_state = STATE_PICTURE;
- picture = m_pictures;
- if((m_decoder.m_coding_type != PIC_FLAG_CODING_TYPE_B) ^(m_picture >= m_pictures + 2))
- picture += 2;
- }
- else
- {
- m_state = STATE_PICTURE_2ND;
- picture = m_picture + 1; /* second field picture */
- }
-
- m_picture = picture;
- }
+ {
+ mpeg2_picture_t* picture;
+
+ if(m_state != STATE_SLICE_1ST)
+ {
+ m_state = STATE_PICTURE;
+ picture = m_pictures;
+ if((m_decoder.m_coding_type != PIC_FLAG_CODING_TYPE_B) ^ (m_picture >= m_pictures + 2))
+ picture += 2;
+ }
+ else
+ {
+ m_state = STATE_PICTURE_2ND;
+ picture = m_picture + 1; /* second field picture */
+ }
+
+ m_picture = picture;
+ }
m_picture->flags = 0;
if(m_num_pts)
- {
- if(m_bytes_since_pts >= 4)
- {
- m_num_pts = 0;
- m_picture->pts = m_pts_current;
- m_picture->flags = PIC_FLAG_PTS;
- }
- else if(m_num_pts > 1)
- {
- m_num_pts = 1;
- m_picture->pts = m_pts_previous;
- m_picture->flags = PIC_FLAG_PTS;
- }
- }
-
- m_picture->display_offset[0].x =
- m_picture->display_offset[1].x =
- m_picture->display_offset[2].x = m_display_offset_x;
- m_picture->display_offset[0].y =
- m_picture->display_offset[1].y =
- m_picture->display_offset[2].y = m_display_offset_y;
+ {
+ if(m_bytes_since_pts >= 4)
+ {
+ m_num_pts = 0;
+ m_picture->pts = m_pts_current;
+ m_picture->flags = PIC_FLAG_PTS;
+ }
+ else if(m_num_pts > 1)
+ {
+ m_num_pts = 1;
+ m_picture->pts = m_pts_previous;
+ m_picture->flags = PIC_FLAG_PTS;
+ }
+ }
+
+ m_picture->display_offset[0].x =
+ m_picture->display_offset[1].x =
+ m_picture->display_offset[2].x = m_display_offset_x;
+ m_picture->display_offset[0].y =
+ m_picture->display_offset[1].y =
+ m_picture->display_offset[2].y = m_display_offset_y;
return mpeg2_parse_header();
}
int CMpeg2Dec::mpeg2_header_picture()
{
- uint8_t* buffer = m_chunk_start;
- mpeg2_picture_t* picture = m_picture;
- int type;
- int low_delay;
-
- type = (buffer [1] >> 3) & 7;
- low_delay = m_sequence.flags & SEQ_FLAG_LOW_DELAY;
-
- if(m_state == STATE_PICTURE)
- {
- mpeg2_picture_t* other;
-
- m_decoder.m_second_field = 0;
- other = m_pictures;
- if(other == picture)
- other += 2;
- if(m_decoder.m_coding_type != PIC_FLAG_CODING_TYPE_B)
- {
- m_fbuf[2] = m_fbuf[1];
- m_fbuf[1] = m_fbuf[0];
- }
- m_fbuf[0] = NULL;
- m_info.Reset();
- m_info.m_current_picture = picture;
- m_info.m_display_picture = picture;
- if(type != PIC_FLAG_CODING_TYPE_B)
- {
- if(!low_delay)
- {
- if(m_first)
- {
- m_info.m_display_picture = NULL;
- m_first = false;
- }
- else
- {
- m_info.m_display_picture = other;
- if(other->nb_fields == 1)
- m_info.m_display_picture_2nd = other + 1;
- m_info.m_display_fbuf = m_fbuf[1];
- }
- }
-
- if(!low_delay + !NULL/*m_convert_start*/)
- m_info.m_discard_fbuf = m_fbuf[!low_delay + !NULL/*m_convert_start*/];
- }
-
- while(m_alloc_index < 3)
- {
- mpeg2_fbuf_t* fbuf = &m_fbuf_alloc[m_alloc_index++];
- fbuf->id = NULL;
-
- int size = m_decoder.m_width * m_decoder.m_height;
- fbuf->buf[0] = (uint8_t*)_aligned_malloc(6 * size >> 2, 16);
- fbuf->buf[1] = fbuf->buf[0] + size;
- fbuf->buf[2] = fbuf->buf[1] + (size >> 2);
- memset(fbuf->buf[0], 0x10, size);
- memset(fbuf->buf[1], 0x80, size >> 2);
- memset(fbuf->buf[2], 0x80, size >> 2);
- }
- mpeg2_set_fbuf(type);
- }
- else
- {
- m_decoder.m_second_field = 1;
- m_info.m_current_picture_2nd = picture;
- m_info.m_user_data = NULL;
- m_info.m_user_data_len = 0;
- if(low_delay || type == PIC_FLAG_CODING_TYPE_B)
- m_info.m_display_picture_2nd = picture;
- }
- m_ext_state = PIC_CODING_EXT;
-
- picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
-
- m_decoder.m_coding_type = type;
- picture->flags |= type;
-
- if(type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B)
- {
- /* forward_f_code and backward_f_code - used in mpeg1 only */
- m_decoder.m_f_motion.f_code[1] = (buffer[3] >> 2) & 1;
- m_decoder.m_f_motion.f_code[0] = (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;
- m_decoder.m_b_motion.f_code[1] = (buffer[4] >> 6) & 1;
- m_decoder.m_b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
- }
-
- /* XXXXXX decode extra_information_picture as well */
-
- picture->nb_fields = 2;
-
- m_decoder.m_intra_dc_precision = 0;
- m_decoder.m_frame_pred_frame_dct = 1;
- m_decoder.m_q_scale_type = 0;
- m_decoder.m_concealment_motion_vectors = 0;
- m_decoder.m_scan = mpeg2_scan_norm_2;
- m_decoder.m_picture_structure = FRAME_PICTURE;
- m_copy_matrix = 0;
-
- return 0;
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_picture_t* picture = m_picture;
+ int type;
+ int low_delay;
+
+ type = (buffer [1] >> 3) & 7;
+ low_delay = m_sequence.flags & SEQ_FLAG_LOW_DELAY;
+
+ if(m_state == STATE_PICTURE)
+ {
+ mpeg2_picture_t* other;
+
+ m_decoder.m_second_field = 0;
+ other = m_pictures;
+ if(other == picture)
+ other += 2;
+ if(m_decoder.m_coding_type != PIC_FLAG_CODING_TYPE_B)
+ {
+ m_fbuf[2] = m_fbuf[1];
+ m_fbuf[1] = m_fbuf[0];
+ }
+ m_fbuf[0] = NULL;
+ m_info.Reset();
+ m_info.m_current_picture = picture;
+ m_info.m_display_picture = picture;
+ if(type != PIC_FLAG_CODING_TYPE_B)
+ {
+ if(!low_delay)
+ {
+ if(m_first) {
+ m_info.m_display_picture = NULL;
+ m_first = false;
+ }
+ else
+ {
+ m_info.m_display_picture = other;
+ if(other->nb_fields == 1)
+ m_info.m_display_picture_2nd = other + 1;
+ m_info.m_display_fbuf = m_fbuf[1];
+ }
+ }
+
+ if(!low_delay + !NULL/*m_convert_start*/)
+ m_info.m_discard_fbuf = m_fbuf[!low_delay + !NULL/*m_convert_start*/];
+ }
+
+ while(m_alloc_index < 3)
+ {
+ mpeg2_fbuf_t* fbuf = &m_fbuf_alloc[m_alloc_index++];
+ fbuf->id = NULL;
+
+ int size = m_decoder.m_width * m_decoder.m_height;
+ fbuf->buf[0] = (uint8_t*)_aligned_malloc(6 * size >> 2, 16);
+ fbuf->buf[1] = fbuf->buf[0] + size;
+ fbuf->buf[2] = fbuf->buf[1] + (size >> 2);
+ memset(fbuf->buf[0], 0x10, size);
+ memset(fbuf->buf[1], 0x80, size >> 2);
+ memset(fbuf->buf[2], 0x80, size >> 2);
+ }
+ mpeg2_set_fbuf(type);
+ }
+ else
+ {
+ m_decoder.m_second_field = 1;
+ m_info.m_current_picture_2nd = picture;
+ m_info.m_user_data = NULL; m_info.m_user_data_len = 0;
+ if(low_delay || type == PIC_FLAG_CODING_TYPE_B)
+ m_info.m_display_picture_2nd = picture;
+ }
+ m_ext_state = PIC_CODING_EXT;
+
+ picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
+
+ m_decoder.m_coding_type = type;
+ picture->flags |= type;
+
+ if(type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B)
+ {
+ /* forward_f_code and backward_f_code - used in mpeg1 only */
+ m_decoder.m_f_motion.f_code[1] = (buffer[3] >> 2) & 1;
+ m_decoder.m_f_motion.f_code[0] = (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;
+ m_decoder.m_b_motion.f_code[1] = (buffer[4] >> 6) & 1;
+ m_decoder.m_b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
+ }
+
+ /* XXXXXX decode extra_information_picture as well */
+
+ picture->nb_fields = 2;
+
+ m_decoder.m_intra_dc_precision = 0;
+ m_decoder.m_frame_pred_frame_dct = 1;
+ m_decoder.m_q_scale_type = 0;
+ m_decoder.m_concealment_motion_vectors = 0;
+ m_decoder.m_scan = mpeg2_scan_norm_2;
+ m_decoder.m_picture_structure = FRAME_PICTURE;
+ m_copy_matrix = 0;
+
+ return 0;
}
int CMpeg2Dec::mpeg2_header_extension()
{
- static int (CMpeg2Dec::* parser[])() =
- {
- NULL,
- &CMpeg2Dec::sequence_ext,
- &CMpeg2Dec::sequence_display_ext,
- &CMpeg2Dec::quant_matrix_ext,
- &CMpeg2Dec::copyright_ext,
- NULL, NULL,
- &CMpeg2Dec::picture_display_ext,
- &CMpeg2Dec::picture_coding_ext
+ static int (CMpeg2Dec::* parser[]) () =
+ {
+ NULL,
+ &CMpeg2Dec::sequence_ext,
+ &CMpeg2Dec::sequence_display_ext,
+ &CMpeg2Dec::quant_matrix_ext,
+ &CMpeg2Dec::copyright_ext,
+ NULL, NULL,
+ &CMpeg2Dec::picture_display_ext,
+ &CMpeg2Dec::picture_coding_ext
};
int ext, ext_bit;
@@ -1110,7 +1093,7 @@ int CMpeg2Dec::mpeg2_header_extension()
ext_bit = 1 << ext;
if(!(m_ext_state & ext_bit)) /* ignore illegal extensions */
- return 0;
+ return 0;
m_ext_state &= ~ext_bit;
return (this->*parser[ext])();
}
@@ -1120,7 +1103,7 @@ int CMpeg2Dec::mpeg2_header_user_data()
if(!m_info.m_user_data_len) m_info.m_user_data = m_chunk_start;
else m_info.m_user_data_len += 3;
- m_info.m_user_data_len += (m_chunk_ptr - 4 - m_chunk_start);
+ m_info.m_user_data_len += (m_chunk_ptr - 4 - m_chunk_start);
m_chunk_start = m_chunk_ptr - 1;
return 0;
@@ -1129,10 +1112,10 @@ int CMpeg2Dec::mpeg2_header_user_data()
void CMpeg2Dec::mpeg2_header_matrix_finalize()
{
if(m_copy_matrix & 1)
- memcpy(m_decoder.m_intra_quantizer_matrix, m_intra_quantizer_matrix, 64);
+ memcpy(m_decoder.m_intra_quantizer_matrix, m_intra_quantizer_matrix, 64);
if(m_copy_matrix & 2)
- memcpy(m_decoder.m_non_intra_quantizer_matrix, m_non_intra_quantizer_matrix, 64);
+ memcpy(m_decoder.m_non_intra_quantizer_matrix, m_non_intra_quantizer_matrix, 64);
}
void mpeg2_sequence_t::finalize()
@@ -1142,76 +1125,54 @@ void mpeg2_sequence_t::finalize()
byte_rate *= 50;
if(flags & SEQ_FLAG_MPEG2)
- {
- switch(pixel_width)
- {
- case 1: /* square pixels */
- pixel_width = pixel_height = 1;
- return;
- case 2: /* 4:3 aspect ratio */
- w = 4;
- h = 3;
- break;
- case 3: /* 16:9 aspect ratio */
- w = 16;
- h = 9;
- break;
- case 4: /* 2.21:1 aspect ratio */
- w = 221;
- h = 100;
- break;
- default: /* illegal */
- pixel_width = pixel_height = 0;
- return;
- }
-
- w *= display_height;
- h *= display_width;
- }
- else
- {
- if(byte_rate == 50 * 0x3ffff)
- byte_rate = 0; /* mpeg-1 VBR */
-
- switch(pixel_width)
- {
- case 0:
- case 15: /* illegal */
- pixel_width = pixel_height = 0;
- return;
- case 1: /* square pixels */
- pixel_width = pixel_height = 1;
- return;
- case 3: /* 720x576 16:9 */
- pixel_width = 64;
- pixel_height = 45;
- return;
- case 6: /* 720x480 16:9 */
- pixel_width = 32;
- pixel_height = 27;
- return;
- case 12: /* 720*480 4:3 */
- pixel_width = 8;
- pixel_height = 9;
- return;
- default:
- h = 88 * pixel_width + 1171;
- w = 2000;
- }
+ {
+ switch(pixel_width)
+ {
+ case 1: /* square pixels */
+ pixel_width = pixel_height = 1; return;
+ case 2: /* 4:3 aspect ratio */
+ w = 4; h = 3; break;
+ case 3: /* 16:9 aspect ratio */
+ w = 16; h = 9; break;
+ case 4: /* 2.21:1 aspect ratio */
+ w = 221; h = 100; break;
+ default: /* illegal */
+ pixel_width = pixel_height = 0; return;
+ }
+
+ w *= display_height;
+ h *= display_width;
+ }
+ else
+ {
+ if(byte_rate == 50 * 0x3ffff)
+ byte_rate = 0; /* mpeg-1 VBR */
+
+ switch(pixel_width)
+ {
+ case 0: case 15: /* illegal */
+ pixel_width = pixel_height = 0; return;
+ case 1: /* square pixels */
+ pixel_width = pixel_height = 1; return;
+ case 3: /* 720x576 16:9 */
+ pixel_width = 64; pixel_height = 45; return;
+ case 6: /* 720x480 16:9 */
+ pixel_width = 32; pixel_height = 27; return;
+ case 12: /* 720*480 4:3 */
+ pixel_width = 8; pixel_height = 9; return;
+ default:
+ h = 88 * pixel_width + 1171;
+ w = 2000;
+ }
}
pixel_width = w;
pixel_height = h;
- /* find greatest common divisor */
- while(w)
- {
- int tmp = w;
- w = h % tmp;
- h = tmp;
- }
+ /* find greatest common divisor */
+ while(w) {int tmp = w; w = h % tmp; h = tmp;}
- pixel_width /= h;
+ pixel_width /= h;
pixel_height /= h;
}
@@ -1236,21 +1197,21 @@ void CMpeg2Dec::mpeg2_header_sequence_finalize()
* repeat sequence headers.
*/
- // EDIT: some dvds will work if we allow the last three fields to vary (which aren't needed anyway)
- // EDIT2: vbv_buffer_size can be ignored as well, not used by libmpeg2
+ // EDIT: some dvds will work if we allow the last three fields to vary (which aren't needed anyway)
+ // EDIT2: vbv_buffer_size can be ignored as well, not used by libmpeg2
- m_sequence.byte_rate = sequence->byte_rate;
- m_sequence.vbv_buffer_size = sequence->vbv_buffer_size;
+ m_sequence.byte_rate = sequence->byte_rate;
+ m_sequence.vbv_buffer_size = sequence->vbv_buffer_size;
- if(!memcmp(&m_sequence, sequence, FIELD_OFFSET(mpeg2_sequence_t, colour_primaries) /*sizeof(mpeg2_sequence_t)*/))
- {
- m_state = STATE_SEQUENCE_REPEATED;
- }
- else if(m_sequence.width != (unsigned) - 1)
- {
- m_action = &CMpeg2Dec::mpeg2_seek_sequence;
- m_state = STATE_INVALID; /* XXXX STATE_INVALID_END ? */
- return;
+ if(!memcmp(&m_sequence, sequence, FIELD_OFFSET(mpeg2_sequence_t, colour_primaries) /*sizeof(mpeg2_sequence_t)*/))
+ {
+ m_state = STATE_SEQUENCE_REPEATED;
+ }
+ else if(m_sequence.width != (unsigned)-1)
+ {
+ m_action = &CMpeg2Dec::mpeg2_seek_sequence;
+ m_state = STATE_INVALID; /* XXXX STATE_INVALID_END ? */
+ return;
}
m_sequence = *sequence;
@@ -1259,131 +1220,131 @@ void CMpeg2Dec::mpeg2_header_sequence_finalize()
mpeg2_state_t CMpeg2Dec::mpeg2_header_slice_start()
{
- m_info.m_user_data = NULL;
- m_info.m_user_data_len = 0;
- m_state = (m_picture->nb_fields > 1 || m_state == STATE_PICTURE_2ND) ? STATE_SLICE : STATE_SLICE_1ST;
+ m_info.m_user_data = NULL;
+ m_info.m_user_data_len = 0;
+ m_state = (m_picture->nb_fields > 1 || m_state == STATE_PICTURE_2ND) ? STATE_SLICE : STATE_SLICE_1ST;
- if(!m_nb_decode_slices)
- {
- m_picture->flags |= PIC_FLAG_SKIP;
- }
- else
- {
- int b_type = m_decoder.m_coding_type == B_TYPE;
- m_decoder.mpeg2_init_fbuf(m_fbuf[0]->buf, m_fbuf[b_type + 1]->buf, m_fbuf[b_type]->buf);
- }
+ if(!m_nb_decode_slices)
+ {
+ m_picture->flags |= PIC_FLAG_SKIP;
+ }
+ else
+ {
+ int b_type = m_decoder.m_coding_type == B_TYPE;
+ m_decoder.mpeg2_init_fbuf(m_fbuf[0]->buf, m_fbuf[b_type + 1]->buf, m_fbuf[b_type]->buf);
+ }
- m_action = NULL;
+ m_action = NULL;
- return (mpeg2_state_t) - 1;
+ return (mpeg2_state_t)-1;
}
mpeg2_state_t CMpeg2Dec::mpeg2_header_end()
{
- mpeg2_picture_t* picture = m_pictures;
-
- int b_type = m_decoder.m_coding_type == B_TYPE;
+ mpeg2_picture_t* picture = m_pictures;
- if((m_picture >= picture + 2) ^ b_type)
- picture = m_pictures + 2;
+ int b_type = m_decoder.m_coding_type == B_TYPE;
- m_state = STATE_END;
- m_info.Reset();
+ if((m_picture >= picture + 2) ^ b_type)
+ picture = m_pictures + 2;
- if(!(m_sequence.flags & SEQ_FLAG_LOW_DELAY))
- {
- m_info.m_display_picture = picture;
- if(picture->nb_fields == 1)
- m_info.m_display_picture_2nd = picture + 1;
- m_info.m_display_fbuf = m_fbuf[b_type];
- m_info.m_discard_fbuf = m_fbuf[b_type + 1];
- }
- else
- {
- m_info.m_discard_fbuf = m_fbuf[b_type];
- }
+ m_state = STATE_END;
+ m_info.Reset();
+
+ if(!(m_sequence.flags & SEQ_FLAG_LOW_DELAY))
+ {
+ m_info.m_display_picture = picture;
+ if(picture->nb_fields == 1)
+ m_info.m_display_picture_2nd = picture + 1;
+ m_info.m_display_fbuf = m_fbuf[b_type];
+ m_info.m_discard_fbuf = m_fbuf[b_type + 1];
+ }
+ else
+ {
+ m_info.m_discard_fbuf = m_fbuf[b_type];
+ }
- m_action = &CMpeg2Dec::mpeg2_seek_sequence;
- m_first = true;
+ m_action = &CMpeg2Dec::mpeg2_seek_sequence;
+ m_first = true;
- return STATE_END;
+ return STATE_END;
}
void CMpeg2Dec::mpeg2_set_fbuf(int coding_type)
{
for(int i = 0; i < 3; i++)
- {
- if(m_fbuf[1] != &m_fbuf_alloc[i] && m_fbuf[2] != &m_fbuf_alloc[i])
- {
- m_fbuf[0] = &m_fbuf_alloc[i];
- m_info.m_current_fbuf = m_fbuf[0];
- if(coding_type == B_TYPE || (m_sequence.flags & SEQ_FLAG_LOW_DELAY))
- {
- if(coding_type == B_TYPE)
- m_info.m_discard_fbuf = m_fbuf[0];
- m_info.m_display_fbuf = m_fbuf[0];
- }
- break;
- }
- }
+ {
+ if(m_fbuf[1] != &m_fbuf_alloc[i] && m_fbuf[2] != &m_fbuf_alloc[i])
+ {
+ m_fbuf[0] = &m_fbuf_alloc[i];
+ m_info.m_current_fbuf = m_fbuf[0];
+ if(coding_type == B_TYPE || (m_sequence.flags & SEQ_FLAG_LOW_DELAY))
+ {
+ if(coding_type == B_TYPE)
+ m_info.m_discard_fbuf = m_fbuf[0];
+ m_info.m_display_fbuf = m_fbuf[0];
+ }
+ break;
+ }
+ }
}
//
int CMpeg2Dec::sequence_ext()
{
- uint8_t* buffer = m_chunk_start;
- mpeg2_sequence_t* sequence = &m_new_sequence;
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_sequence_t* sequence = &m_new_sequence;
- if(!(buffer[3] & 1))
- return 1;
+ if(!(buffer[3]&1))
+ return 1;
- sequence->profile_level_id = (buffer[0] << 4) | (buffer[1] >> 4);
+ sequence->profile_level_id = (buffer[0] << 4) | (buffer[1] >> 4);
- sequence->display_width =
- sequence->picture_width += ((buffer[1] << 13) | (buffer[2] << 5)) & 0x3000;
- sequence->display_height =
- sequence->picture_height += (buffer[2] << 7) & 0x3000;
+ sequence->display_width =
+ sequence->picture_width += ((buffer[1] << 13) | (buffer[2] << 5)) & 0x3000;
+ sequence->display_height =
+ sequence->picture_height += (buffer[2] << 7) & 0x3000;
- sequence->width = (sequence->picture_width + 15) & ~15;
- sequence->height = (sequence->picture_height + 15) & ~15;
+ sequence->width = (sequence->picture_width + 15) & ~15;
+ sequence->height = (sequence->picture_height + 15) & ~15;
- sequence->flags |= SEQ_FLAG_MPEG2;
+ sequence->flags |= SEQ_FLAG_MPEG2;
- if(!(buffer[1] & 8))
- {
- sequence->flags &= ~SEQ_FLAG_PROGRESSIVE_SEQUENCE;
- sequence->height = (sequence->height + 31) & ~31;
- }
+ if(!(buffer[1] & 8))
+ {
+ sequence->flags &= ~SEQ_FLAG_PROGRESSIVE_SEQUENCE;
+ sequence->height = (sequence->height + 31) & ~31;
+ }
- if(buffer[5] & 0x80)
- {
- sequence->flags |= SEQ_FLAG_LOW_DELAY;
- }
+ if(buffer[5] & 0x80)
+ {
+ sequence->flags |= SEQ_FLAG_LOW_DELAY;
+ }
- sequence->chroma_width = sequence->width;
- sequence->chroma_height = sequence->height;
-
- switch(buffer[1] & 6)
- {
- case 0: /* invalid */
- return 1;
- case 2: /* 4:2:0 */
- sequence->chroma_height >>= 1;
- case 4: /* 4:2:2 */
- sequence->chroma_width >>= 1;
- }
+ sequence->chroma_width = sequence->width;
+ sequence->chroma_height = sequence->height;
- sequence->byte_rate += ((buffer[2] << 25) | (buffer[3] << 17)) & 0x3ffc0000;
+ switch(buffer[1] & 6)
+ {
+ case 0: /* invalid */
+ return 1;
+ case 2: /* 4:2:0 */
+ sequence->chroma_height >>= 1;
+ case 4: /* 4:2:2 */
+ sequence->chroma_width >>= 1;
+ }
- sequence->vbv_buffer_size |= buffer[4] << 21;
+ sequence->byte_rate += ((buffer[2]<<25) | (buffer[3]<<17)) & 0x3ffc0000;
- sequence->frame_period =
- sequence->frame_period * ((buffer[5] & 31) + 1) / (((buffer[5] >> 2) & 3) + 1);
+ sequence->vbv_buffer_size |= buffer[4] << 21;
- m_ext_state = SEQ_DISPLAY_EXT;
+ sequence->frame_period =
+ sequence->frame_period * ((buffer[5]&31)+1) / (((buffer[5]>>2)&3)+1);
- return 0;
+ m_ext_state = SEQ_DISPLAY_EXT;
+
+ return 0;
}
int CMpeg2Dec::sequence_display_ext()
@@ -1391,24 +1352,24 @@ int CMpeg2Dec::sequence_display_ext()
uint8_t* buffer = m_chunk_start;
mpeg2_sequence_t* sequence = &m_new_sequence;
- uint32_t flags = (sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | ((buffer[0] << 4) & SEQ_MASK_VIDEO_FORMAT);
+ uint32_t flags = (sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | ((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT);
if(buffer[0] & 1)
- {
- flags |= SEQ_FLAG_COLOUR_DESCRIPTION;
- sequence->colour_primaries = buffer[1];
- sequence->transfer_characteristics = buffer[2];
- sequence->matrix_coefficients = buffer[3];
- buffer += 3;
+ {
+ flags |= SEQ_FLAG_COLOUR_DESCRIPTION;
+ sequence->colour_primaries = buffer[1];
+ sequence->transfer_characteristics = buffer[2];
+ sequence->matrix_coefficients = buffer[3];
+ buffer += 3;
}
if(!(buffer[2] & 2)) /* missing marker_bit */
- return 1;
+ return 1;
- // ???
+ // ???
// sequence->flags = flags;
- sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2);
- sequence->display_height = ((buffer[2] & 1) << 13) | (buffer[3] << 5) | (buffer[4] >> 3);
+ sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2);
+ sequence->display_height = ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3);
return 0;
}
@@ -1418,18 +1379,18 @@ int CMpeg2Dec::quant_matrix_ext()
uint8_t* buffer = m_chunk_start;
if(buffer[0] & 8)
- {
- for(int i = 0; i < 64; i++)
- m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i] << 5) | (buffer[i+1] >> 3);
- m_copy_matrix |= 1;
- buffer += 64;
+ {
+ for(int i = 0; i < 64; i++)
+ m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i] << 5) | (buffer[i+1] >> 3);
+ m_copy_matrix |= 1;
+ buffer += 64;
}
if(buffer[0] & 4)
- {
- for(int i = 0; i < 64; i++)
- m_non_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i] << 6) | (buffer[i+1] >> 2);
- m_copy_matrix |= 2;
+ {
+ for(int i = 0; i < 64; i++)
+ m_non_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i] << 6) | (buffer[i+1] >> 2);
+ m_copy_matrix |= 2;
}
return 0;
@@ -1447,27 +1408,27 @@ int CMpeg2Dec::picture_display_ext()
int nb_pos = picture->nb_fields;
if(m_sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
- nb_pos >>= 1;
+ nb_pos >>= 1;
- int i = 0;
+ int i = 0;
for(; i < nb_pos; i++)
- {
- int x = ((buffer[4*i] << 24) | (buffer[4*i+1] << 16) |
- (buffer[4*i+2] << 8) | buffer[4*i+3]) >> (11 - 2 * i);
- int y = ((buffer[4*i+2] << 24) | (buffer[4*i+3] << 16) |
- (buffer[4*i+4] << 8) | buffer[4*i+5]) >> (10 - 2 * i);
- if(!(x & y & 1))
- return 1;
-
- picture->display_offset[i].x = m_display_offset_x = x >> 1;
- picture->display_offset[i].y = m_display_offset_y = y >> 1;
- }
+ {
+ int x = ((buffer[4*i] << 24) | (buffer[4*i+1] << 16) |
+ (buffer[4*i+2] << 8) | buffer[4*i+3]) >> (11-2*i);
+ int y = ((buffer[4*i+2] << 24) | (buffer[4*i+3] << 16) |
+ (buffer[4*i+4] << 8) | buffer[4*i+5]) >> (10-2*i);
+ if(!(x&y&1))
+ return 1;
+
+ picture->display_offset[i].x = m_display_offset_x = x >> 1;
+ picture->display_offset[i].y = m_display_offset_y = y >> 1;
+ }
for(; i < 3; i++)
- {
- picture->display_offset[i].x = m_display_offset_x;
- picture->display_offset[i].y = m_display_offset_y;
+ {
+ picture->display_offset[i].x = m_display_offset_x;
+ picture->display_offset[i].y = m_display_offset_y;
}
return 0;
@@ -1487,25 +1448,25 @@ int CMpeg2Dec::picture_coding_ext()
m_decoder.m_intra_dc_precision = (buffer[2] >> 2) & 3;
m_decoder.m_picture_structure = buffer[2] & 3;
switch(m_decoder.m_picture_structure)
- {
+ {
case TOP_FIELD:
- picture->flags |= PIC_FLAG_TOP_FIELD_FIRST;
+ picture->flags |= PIC_FLAG_TOP_FIELD_FIRST;
case BOTTOM_FIELD:
- picture->nb_fields = 1;
- break;
+ picture->nb_fields = 1;
+ break;
case FRAME_PICTURE:
- if(!(m_sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE))
- {
- picture->nb_fields = (buffer[3] & 2) ? 3 : 2;
- picture->flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0;
- }
- else
- {
- picture->nb_fields = (buffer[3] & 2) ? ((buffer[3] & 128) ? 6 : 4) : 2;
- }
- break;
+ if(!(m_sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE))
+ {
+ picture->nb_fields = (buffer[3] & 2) ? 3 : 2;
+ picture->flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0;
+ }
+ else
+ {
+ picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2;
+ }
+ break;
default:
- return 1;
+ return 1;
}
m_decoder.m_top_field_first = buffer[3] >> 7;
@@ -1515,12 +1476,12 @@ int CMpeg2Dec::picture_coding_ext()
m_decoder.m_intra_vlc_format = (buffer[3] >> 3) & 1;
m_decoder.m_scan = (buffer[3] & 4) ? mpeg2_scan_alt_2 : mpeg2_scan_norm_2;
- if(buffer[3] & 2)
- picture->flags |= PIC_FLAG_REPEAT_FIRST_FIELD;
+ if(buffer[3] & 2)
+ picture->flags |= PIC_FLAG_REPEAT_FIRST_FIELD;
picture->flags |= (buffer[4] & 0x80) ? PIC_FLAG_PROGRESSIVE_FRAME : 0;
if(buffer[4] & 0x40)
- picture->flags |= (((buffer[4] << 26) | (buffer[5] << 18) | (buffer[6] << 10)) & PIC_MASK_COMPOSITE_DISPLAY) | PIC_FLAG_COMPOSITE_DISPLAY;
+ picture->flags |= (((buffer[4]<<26) | (buffer[5]<<18) | (buffer[6]<<10)) & PIC_MASK_COMPOSITE_DISPLAY) | PIC_FLAG_COMPOSITE_DISPLAY;
m_ext_state = PIC_DISPLAY_EXT | COPYRIGHT_EXT | QUANT_MATRIX_EXT;
@@ -1568,45 +1529,38 @@ do { \
/* take num bits from the high part of bit_buf and sign extend them */
#define SBITS(bit_buf,num) (((int32_t)(bit_buf)) >> (32 - (num)))
-typedef struct
-{
+typedef struct {
uint8_t modes;
uint8_t len;
} MBtab;
-typedef struct
-{
+typedef struct {
uint8_t delta;
uint8_t len;
} MVtab;
-typedef struct
-{
+typedef struct {
int8_t dmv;
uint8_t len;
} DMVtab;
-typedef struct
-{
+typedef struct {
uint8_t cbp;
uint8_t len;
} CBPtab;
-typedef struct
-{
+typedef struct {
uint8_t size;
uint8_t len;
} DCtab;
-typedef struct
-{
+typedef struct {
uint8_t run;
uint8_t level;
uint8_t len;
} DCTtab;
-typedef struct
-{
+typedef struct {
uint8_t mba;
uint8_t len;
} MBAtab;
@@ -1615,50 +1569,47 @@ typedef struct
#define INTRA MACROBLOCK_INTRA
#define QUANT MACROBLOCK_QUANT
-static const MBtab MB_I [] =
-{
- {INTRA | QUANT, 2}, {INTRA, 1}
+static const MBtab MB_I [] = {
+ {INTRA|QUANT, 2}, {INTRA, 1}
};
#define MC MACROBLOCK_MOTION_FORWARD
#define CODED MACROBLOCK_PATTERN
-static const MBtab MB_P [] =
-{
- {INTRA | QUANT, 6}, {CODED | QUANT, 5}, {MC | CODED | QUANT, 5}, {INTRA, 5},
+static const MBtab MB_P [] = {
+ {INTRA|QUANT, 6}, {CODED|QUANT, 5}, {MC|CODED|QUANT, 5}, {INTRA, 5},
{MC, 3}, {MC, 3}, {MC, 3}, {MC, 3},
{CODED, 2}, {CODED, 2}, {CODED, 2}, {CODED, 2},
{CODED, 2}, {CODED, 2}, {CODED, 2}, {CODED, 2},
- {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1},
- {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1},
- {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1},
- {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1}, {MC | CODED, 1}
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}
};
#define FWD MACROBLOCK_MOTION_FORWARD
#define BWD MACROBLOCK_MOTION_BACKWARD
#define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD
-static const MBtab MB_B [] =
-{
- {0, 0}, {INTRA | QUANT, 6},
- {BWD | CODED | QUANT, 6}, {FWD | CODED | QUANT, 6},
- {INTER | CODED | QUANT, 5}, {INTER | CODED | QUANT, 5},
- {INTRA, 5}, {INTRA, 5},
+static const MBtab MB_B [] = {
+ {0, 0}, {INTRA|QUANT, 6},
+ {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6},
+ {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5},
+ {INTRA, 5}, {INTRA, 5},
{FWD, 4}, {FWD, 4}, {FWD, 4}, {FWD, 4},
- {FWD | CODED, 4}, {FWD | CODED, 4}, {FWD | CODED, 4}, {FWD | CODED, 4},
+ {FWD|CODED, 4}, {FWD|CODED, 4}, {FWD|CODED, 4}, {FWD|CODED, 4},
{BWD, 3}, {BWD, 3}, {BWD, 3}, {BWD, 3},
{BWD, 3}, {BWD, 3}, {BWD, 3}, {BWD, 3},
- {BWD | CODED, 3}, {BWD | CODED, 3}, {BWD | CODED, 3}, {BWD | CODED, 3},
- {BWD | CODED, 3}, {BWD | CODED, 3}, {BWD | CODED, 3}, {BWD | CODED, 3},
+ {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3},
+ {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3},
{INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
{INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
{INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
{INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
- {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2},
- {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2},
- {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2},
- {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2}, {INTER | CODED, 2}
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}
};
#undef INTRA
@@ -1670,30 +1621,26 @@ static const MBtab MB_B [] =
#undef INTER
-static const MVtab MV_4 [] =
-{
+static const MVtab MV_4 [] = {
{ 3, 6}, { 2, 4}, { 1, 3}, { 1, 3}, { 0, 2}, { 0, 2}, { 0, 2}, { 0, 2}
};
-static const MVtab MV_10 [] =
-{
- { 0, 10}, { 0, 10}, { 0, 10}, { 0, 10}, { 0, 10}, { 0, 10}, { 0, 10}, { 0, 10},
- { 0, 10}, { 0, 10}, { 0, 10}, { 0, 10}, {15, 10}, {14, 10}, {13, 10}, {12, 10},
- {11, 10}, {10, 10}, { 9, 9}, { 9, 9}, { 8, 9}, { 8, 9}, { 7, 9}, { 7, 9},
+static const MVtab MV_10 [] = {
+ { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10},
+ { 0,10}, { 0,10}, { 0,10}, { 0,10}, {15,10}, {14,10}, {13,10}, {12,10},
+ {11,10}, {10,10}, { 9, 9}, { 9, 9}, { 8, 9}, { 8, 9}, { 7, 9}, { 7, 9},
{ 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7},
{ 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7},
{ 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}
};
-static const DMVtab DMV_2 [] =
-{
- { 0, 1}, { 0, 1}, { 1, 2}, { -1, 2}
+static const DMVtab DMV_2 [] = {
+ { 0, 1}, { 0, 1}, { 1, 2}, {-1, 2}
};
-static const CBPtab CBP_7 [] =
-{
+static const CBPtab CBP_7 [] = {
{0x22, 7}, {0x12, 7}, {0x0a, 7}, {0x06, 7},
{0x21, 7}, {0x11, 7}, {0x09, 7}, {0x05, 7},
{0x3f, 6}, {0x3f, 6}, {0x03, 6}, {0x03, 6},
@@ -1724,8 +1671,7 @@ static const CBPtab CBP_7 [] =
{0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3}
};
-static const CBPtab CBP_9 [] =
-{
+static const CBPtab CBP_9 [] = {
{0, 0}, {0x00, 9}, {0x27, 9}, {0x1b, 9},
{0x3b, 9}, {0x37, 9}, {0x2f, 9}, {0x1f, 9},
{0x3a, 8}, {0x3a, 8}, {0x36, 8}, {0x36, 8},
@@ -1745,24 +1691,21 @@ static const CBPtab CBP_9 [] =
};
-static const DCtab DC_lum_5 [] =
-{
+static const DCtab DC_lum_5 [] = {
{1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
{0, 3}, {0, 3}, {0, 3}, {0, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
{4, 3}, {4, 3}, {4, 3}, {4, 3}, {5, 4}, {5, 4}, {6, 5}
};
-static const DCtab DC_chrom_5 [] =
-{
+static const DCtab DC_chrom_5 [] = {
{0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
{1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
{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}, {5, 5}
};
-static const DCtab DC_long [] =
-{
+static const DCtab DC_long [] = {
{6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, { 6, 5}, { 6, 5},
{6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, { 6, 5}, { 6, 5},
{7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, { 7, 6}, { 7, 6},
@@ -1770,58 +1713,53 @@ static const DCtab DC_long [] =
};
-static const DCTtab DCT_16 [] =
-{
+static const DCTtab DCT_16 [] = {
{129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
{129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
{129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
{129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
- { 2, 18, 0}, { 2, 17, 0}, { 2, 16, 0}, { 2, 15, 0},
+ { 2,18, 0}, { 2,17, 0}, { 2,16, 0}, { 2,15, 0},
{ 7, 3, 0}, { 17, 2, 0}, { 16, 2, 0}, { 15, 2, 0},
{ 14, 2, 0}, { 13, 2, 0}, { 12, 2, 0}, { 32, 1, 0},
{ 31, 1, 0}, { 30, 1, 0}, { 29, 1, 0}, { 28, 1, 0}
};
-static const DCTtab DCT_15 [] =
-{
- { 1, 40, 15}, { 1, 39, 15}, { 1, 38, 15}, { 1, 37, 15},
- { 1, 36, 15}, { 1, 35, 15}, { 1, 34, 15}, { 1, 33, 15},
- { 1, 32, 15}, { 2, 14, 15}, { 2, 13, 15}, { 2, 12, 15},
- { 2, 11, 15}, { 2, 10, 15}, { 2, 9, 15}, { 2, 8, 15},
- { 1, 31, 14}, { 1, 31, 14}, { 1, 30, 14}, { 1, 30, 14},
- { 1, 29, 14}, { 1, 29, 14}, { 1, 28, 14}, { 1, 28, 14},
- { 1, 27, 14}, { 1, 27, 14}, { 1, 26, 14}, { 1, 26, 14},
- { 1, 25, 14}, { 1, 25, 14}, { 1, 24, 14}, { 1, 24, 14},
- { 1, 23, 14}, { 1, 23, 14}, { 1, 22, 14}, { 1, 22, 14},
- { 1, 21, 14}, { 1, 21, 14}, { 1, 20, 14}, { 1, 20, 14},
- { 1, 19, 14}, { 1, 19, 14}, { 1, 18, 14}, { 1, 18, 14},
- { 1, 17, 14}, { 1, 17, 14}, { 1, 16, 14}, { 1, 16, 14}
+static const DCTtab DCT_15 [] = {
+ { 1,40,15}, { 1,39,15}, { 1,38,15}, { 1,37,15},
+ { 1,36,15}, { 1,35,15}, { 1,34,15}, { 1,33,15},
+ { 1,32,15}, { 2,14,15}, { 2,13,15}, { 2,12,15},
+ { 2,11,15}, { 2,10,15}, { 2, 9,15}, { 2, 8,15},
+ { 1,31,14}, { 1,31,14}, { 1,30,14}, { 1,30,14},
+ { 1,29,14}, { 1,29,14}, { 1,28,14}, { 1,28,14},
+ { 1,27,14}, { 1,27,14}, { 1,26,14}, { 1,26,14},
+ { 1,25,14}, { 1,25,14}, { 1,24,14}, { 1,24,14},
+ { 1,23,14}, { 1,23,14}, { 1,22,14}, { 1,22,14},
+ { 1,21,14}, { 1,21,14}, { 1,20,14}, { 1,20,14},
+ { 1,19,14}, { 1,19,14}, { 1,18,14}, { 1,18,14},
+ { 1,17,14}, { 1,17,14}, { 1,16,14}, { 1,16,14}
};
-static const DCTtab DCT_13 [] =
-{
- { 11, 2, 13}, { 10, 2, 13}, { 6, 3, 13}, { 4, 4, 13},
- { 3, 5, 13}, { 2, 7, 13}, { 2, 6, 13}, { 1, 15, 13},
- { 1, 14, 13}, { 1, 13, 13}, { 1, 12, 13}, { 27, 1, 13},
- { 26, 1, 13}, { 25, 1, 13}, { 24, 1, 13}, { 23, 1, 13},
- { 1, 11, 12}, { 1, 11, 12}, { 9, 2, 12}, { 9, 2, 12},
- { 5, 3, 12}, { 5, 3, 12}, { 1, 10, 12}, { 1, 10, 12},
- { 3, 4, 12}, { 3, 4, 12}, { 8, 2, 12}, { 8, 2, 12},
- { 22, 1, 12}, { 22, 1, 12}, { 21, 1, 12}, { 21, 1, 12},
- { 1, 9, 12}, { 1, 9, 12}, { 20, 1, 12}, { 20, 1, 12},
- { 19, 1, 12}, { 19, 1, 12}, { 2, 5, 12}, { 2, 5, 12},
- { 4, 3, 12}, { 4, 3, 12}, { 1, 8, 12}, { 1, 8, 12},
- { 7, 2, 12}, { 7, 2, 12}, { 18, 1, 12}, { 18, 1, 12}
+static const DCTtab DCT_13 [] = {
+ { 11, 2,13}, { 10, 2,13}, { 6, 3,13}, { 4, 4,13},
+ { 3, 5,13}, { 2, 7,13}, { 2, 6,13}, { 1,15,13},
+ { 1,14,13}, { 1,13,13}, { 1,12,13}, { 27, 1,13},
+ { 26, 1,13}, { 25, 1,13}, { 24, 1,13}, { 23, 1,13},
+ { 1,11,12}, { 1,11,12}, { 9, 2,12}, { 9, 2,12},
+ { 5, 3,12}, { 5, 3,12}, { 1,10,12}, { 1,10,12},
+ { 3, 4,12}, { 3, 4,12}, { 8, 2,12}, { 8, 2,12},
+ { 22, 1,12}, { 22, 1,12}, { 21, 1,12}, { 21, 1,12},
+ { 1, 9,12}, { 1, 9,12}, { 20, 1,12}, { 20, 1,12},
+ { 19, 1,12}, { 19, 1,12}, { 2, 5,12}, { 2, 5,12},
+ { 4, 3,12}, { 4, 3,12}, { 1, 8,12}, { 1, 8,12},
+ { 7, 2,12}, { 7, 2,12}, { 18, 1,12}, { 18, 1,12}
};
-static const DCTtab DCT_B14_10 [] =
-{
- { 17, 1, 10}, { 6, 2, 10}, { 1, 7, 10}, { 3, 3, 10},
- { 2, 4, 10}, { 16, 1, 10}, { 15, 1, 10}, { 5, 2, 10}
+static const DCTtab DCT_B14_10 [] = {
+ { 17, 1,10}, { 6, 2,10}, { 1, 7,10}, { 3, 3,10},
+ { 2, 4,10}, { 16, 1,10}, { 15, 1,10}, { 5, 2,10}
};
-static const DCTtab DCT_B14_8 [] =
-{
+static const DCTtab DCT_B14_8 [] = {
{ 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
{ 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7},
{ 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7},
@@ -1833,9 +1771,8 @@ static const DCTtab DCT_B14_8 [] =
{ 4, 2, 8}, { 2, 3, 8}, { 1, 5, 8}, { 11, 1, 8}
};
-static const DCTtab DCT_B14AC_5 [] =
-{
- { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
+static const DCTtab DCT_B14AC_5 [] = {
+ { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
{ 1, 2, 4}, { 1, 2, 4}, { 3, 1, 4}, { 3, 1, 4},
{ 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
{129, 0, 2}, {129, 0, 2}, {129, 0, 2}, {129, 0, 2},
@@ -1844,9 +1781,8 @@ static const DCTtab DCT_B14AC_5 [] =
{ 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}
};
-static const DCTtab DCT_B14DC_5 [] =
-{
- { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
+static const DCTtab DCT_B14DC_5 [] = {
+ { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
{ 1, 2, 4}, { 1, 2, 4}, { 3, 1, 4}, { 3, 1, 4},
{ 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
{ 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
@@ -1855,14 +1791,12 @@ static const DCTtab DCT_B14DC_5 [] =
{ 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}
};
-static const DCTtab DCT_B15_10 [] =
-{
+static const DCTtab DCT_B15_10 [] = {
{ 6, 2, 9}, { 6, 2, 9}, { 15, 1, 9}, { 15, 1, 9},
- { 3, 4, 10}, { 17, 1, 10}, { 16, 1, 9}, { 16, 1, 9}
+ { 3, 4,10}, { 17, 1,10}, { 16, 1, 9}, { 16, 1, 9}
};
-static const DCTtab DCT_B15_8 [] =
-{
+static const DCTtab DCT_B15_8 [] = {
{ 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
{ 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7},
{ 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7},
@@ -1870,7 +1804,7 @@ static const DCTtab DCT_B15_8 [] =
{ 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6},
{ 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6},
{ 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
- { 2, 5, 8}, { 12, 1, 8}, { 1, 11, 8}, { 1, 10, 8},
+ { 2, 5, 8}, { 12, 1, 8}, { 1,11, 8}, { 1,10, 8},
{ 14, 1, 8}, { 13, 1, 8}, { 4, 2, 8}, { 2, 4, 8},
{ 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
{ 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
@@ -1924,21 +1858,19 @@ static const DCTtab DCT_B15_8 [] =
{ 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
{ 10, 1, 7}, { 10, 1, 7}, { 2, 3, 7}, { 2, 3, 7},
{ 11, 1, 7}, { 11, 1, 7}, { 1, 8, 7}, { 1, 8, 7},
- { 1, 9, 7}, { 1, 9, 7}, { 1, 12, 8}, { 1, 13, 8},
- { 3, 3, 8}, { 5, 2, 8}, { 1, 14, 8}, { 1, 15, 8}
+ { 1, 9, 7}, { 1, 9, 7}, { 1,12, 8}, { 1,13, 8},
+ { 3, 3, 8}, { 5, 2, 8}, { 1,14, 8}, { 1,15, 8}
};
-static const MBAtab MBA_5 [] =
-{
- {6, 5}, {5, 5}, {4, 4}, {4, 4}, {3, 4}, {3, 4},
+static const MBAtab MBA_5 [] = {
+ {6, 5}, {5, 5}, {4, 4}, {4, 4}, {3, 4}, {3, 4},
{2, 3}, {2, 3}, {2, 3}, {2, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1},
{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}
};
-static const MBAtab MBA_11 [] =
-{
+static const MBAtab MBA_11 [] = {
{32, 11}, {31, 11}, {30, 11}, {29, 11},
{28, 11}, {27, 11}, {26, 11}, {25, 11},
{24, 11}, {23, 11}, {22, 11}, {21, 11},
@@ -1970,10 +1902,9 @@ static const MBAtab MBA_11 [] =
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
-static int non_linear_quantizer_scale [] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 10, 12, 14, 16, 18, 20, 22,
+static int non_linear_quantizer_scale [] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 10, 12, 14, 16, 18, 20, 22,
24, 28, 32, 36, 40, 44, 48, 52,
56, 64, 72, 80, 88, 96, 104, 112
};
@@ -1982,29 +1913,29 @@ bool CMpeg2Decoder::m_idct_initialized = false;
CMpeg2Decoder::CMpeg2Decoder()
{
- memset(&m_b_motion, 0, sizeof(m_b_motion));
- memset(&m_f_motion, 0, sizeof(m_f_motion));
+ memset(&m_b_motion, 0, sizeof(m_b_motion));
+ memset(&m_f_motion, 0, sizeof(m_f_motion));
- m_DCTblock = (int16_t*)_aligned_malloc(64 * sizeof(int16_t), 16);
- memset(m_DCTblock, 0, 64 * sizeof(int16_t));
+ m_DCTblock = (int16_t*)_aligned_malloc(64*sizeof(int16_t), 16);
+ memset(m_DCTblock, 0, 64*sizeof(int16_t));
m_bitstream_buf = 0;
m_bitstream_bits = 0;
m_bitstream_ptr = NULL;
-
- memset(&m_dest, 0, sizeof(m_dest));
- memset(&m_picture_dest, 0, sizeof(m_picture_dest));
+
+ memset(&m_dest, 0, sizeof(m_dest));
+ memset(&m_picture_dest, 0, sizeof(m_picture_dest));
m_offset = m_stride = m_uv_stride = 0;
m_limit_x = m_limit_y_16 = m_limit_y_8 = m_limit_y = 0;
- memset(&m_dc_dct_pred, 0, sizeof(m_dc_dct_pred));
+ memset(&m_dc_dct_pred, 0, sizeof(m_dc_dct_pred));
m_quantizer_scale = m_dmv_offset = 0;
m_v_offset = 0;
- memset(&m_intra_quantizer_matrix, 0, sizeof(m_intra_quantizer_matrix));
- memset(&m_non_intra_quantizer_matrix, 0, sizeof(m_non_intra_quantizer_matrix));
+ memset(&m_intra_quantizer_matrix, 0, sizeof(m_intra_quantizer_matrix));
+ memset(&m_non_intra_quantizer_matrix, 0, sizeof(m_non_intra_quantizer_matrix));
m_width = m_height = 0;
m_vertical_position_extension = 0;
@@ -2013,171 +1944,171 @@ CMpeg2Decoder::CMpeg2Decoder()
m_intra_dc_precision = 0;
m_picture_structure = 0;
- m_frame_pred_frame_dct = 0;
+ m_frame_pred_frame_dct = 0;
m_concealment_motion_vectors = 0;
m_q_scale_type = 0;
m_intra_vlc_format = 0;
m_top_field_first = 0;
- m_scan = NULL;
+ m_scan = NULL;
m_second_field = 0;
- m_mpeg1 = 0;
+ m_mpeg1 = 0;
- if(g_cpuid.m_flags & CCpuID::sse2)
- {
- m_idct_init = mpeg2_idct_init_sse2;
- m_idct_copy = mpeg2_idct_copy_sse2;
- m_idct_add = mpeg2_idct_add_sse2;
- m_mc = &mpeg2_mc_sse2;
- }
+ if(g_cpuid.m_flags&CCpuID::sse2)
+ {
+ m_idct_init = mpeg2_idct_init_sse2;
+ m_idct_copy = mpeg2_idct_copy_sse2;
+ m_idct_add = mpeg2_idct_add_sse2;
+ m_mc = &mpeg2_mc_sse2;
+ }
#ifndef _WIN64
- else if(g_cpuid.m_flags & CCpuID::mmx)
- {
- m_idct_init = mpeg2_idct_init_mmx;
- m_idct_copy = mpeg2_idct_copy_mmx;
- m_idct_add = mpeg2_idct_add_mmx;
- m_mc = &mpeg2_mc_mmx;
- }
- else
+ else if(g_cpuid.m_flags&CCpuID::mmx)
+ {
+ m_idct_init = mpeg2_idct_init_mmx;
+ m_idct_copy = mpeg2_idct_copy_mmx;
+ m_idct_add = mpeg2_idct_add_mmx;
+ m_mc = &mpeg2_mc_mmx;
+ }
+ else
#endif
- {
- m_idct_init = mpeg2_idct_init_c;
- m_idct_copy = mpeg2_idct_copy_c;
- m_idct_add = mpeg2_idct_add_c;
- m_mc = &mpeg2_mc_c;
- }
- if(!m_idct_initialized)
- {
- m_idct_init();
- m_idct_initialized = true;
- }
+ {
+ m_idct_init = mpeg2_idct_init_c;
+ m_idct_copy = mpeg2_idct_copy_c;
+ m_idct_add = mpeg2_idct_add_c;
+ m_mc = &mpeg2_mc_c;
+ }
+ if(!m_idct_initialized)
+ {
+ m_idct_init();
+ m_idct_initialized = true;
+ }
}
CMpeg2Decoder::~CMpeg2Decoder()
{
- if(m_DCTblock) _aligned_free(m_DCTblock);
+ if(m_DCTblock) _aligned_free(m_DCTblock);
}
#define bit_buf (m_bitstream_buf)
#define bits (m_bitstream_bits)
#define bit_ptr (m_bitstream_ptr)
-
+
int CMpeg2Decoder::get_macroblock_modes()
{
- int macroblock_modes;
+ int macroblock_modes;
const MBtab* tab;
switch(m_coding_type)
- {
- case P_TYPE:
- tab = MB_P + UBITS(bit_buf, 5);
- DUMPBITS(tab->len);
- macroblock_modes = tab->modes;
-
- if(m_picture_structure != FRAME_PICTURE)
- {
- if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
- {
- macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
- DUMPBITS(2);
- }
-
- return macroblock_modes;
- }
- else if(m_frame_pred_frame_dct)
- {
- if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
- macroblock_modes |= MC_FRAME;
-
- return macroblock_modes;
- }
-
- if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
- {
- macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
- DUMPBITS(2);
- }
-
- if(macroblock_modes & (MACROBLOCK_INTRA | MACROBLOCK_PATTERN))
- {
- macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
- DUMPBITS(1);
- }
-
- return macroblock_modes;
-
- case B_TYPE:
- tab = MB_B + UBITS(bit_buf, 6);
- DUMPBITS(tab->len);
- macroblock_modes = tab->modes;
-
- if(m_picture_structure != FRAME_PICTURE)
- {
- if(!(macroblock_modes & MACROBLOCK_INTRA))
- {
- macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
- DUMPBITS(2);
- }
-
- return macroblock_modes;
- }
- else if(m_frame_pred_frame_dct)
- {
- // if(!(macroblock_modes & MACROBLOCK_INTRA))
- macroblock_modes |= MC_FRAME;
-
- return macroblock_modes;
- }
- /*
- if(macroblock_modes & MACROBLOCK_INTRA)
- goto intra;
-
- macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
- DUMPBITS(2);
-
- if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
- {
- intra:
- macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
- DUMPBITS(1);
- }
- */
- if(!(macroblock_modes & MACROBLOCK_INTRA))
- {
- macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
- DUMPBITS(2);
- }
-
- if(macroblock_modes & (MACROBLOCK_INTRA | MACROBLOCK_PATTERN))
- {
- macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
- DUMPBITS(1);
- }
-
- return macroblock_modes;
+ {
+ case P_TYPE:
+ tab = MB_P + UBITS(bit_buf, 5);
+ DUMPBITS(tab->len);
+ macroblock_modes = tab->modes;
+
+ if(m_picture_structure != FRAME_PICTURE)
+ {
+ if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ return macroblock_modes;
+ }
+ else if(m_frame_pred_frame_dct)
+ {
+ if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
+ macroblock_modes |= MC_FRAME;
+
+ return macroblock_modes;
+ }
+
+ if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
+ {
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
+
+ return macroblock_modes;
+
+ case B_TYPE:
+ tab = MB_B + UBITS(bit_buf, 6);
+ DUMPBITS(tab->len);
+ macroblock_modes = tab->modes;
+
+ if(m_picture_structure != FRAME_PICTURE)
+ {
+ if(!(macroblock_modes & MACROBLOCK_INTRA))
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ return macroblock_modes;
+ }
+ else if(m_frame_pred_frame_dct)
+ {
+ // if(!(macroblock_modes & MACROBLOCK_INTRA))
+ macroblock_modes |= MC_FRAME;
+
+ return macroblock_modes;
+ }
+/*
+ if(macroblock_modes & MACROBLOCK_INTRA)
+ goto intra;
+
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+
+ if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
+ {
+intra:
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
+*/
+ if(!(macroblock_modes & MACROBLOCK_INTRA))
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
- case I_TYPE:
- tab = MB_I + UBITS(bit_buf, 1);
- DUMPBITS(tab->len);
- macroblock_modes = tab->modes;
+ if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
+ {
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
- if(!m_frame_pred_frame_dct && m_picture_structure == FRAME_PICTURE)
- {
- macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
- DUMPBITS(1);
- }
+ return macroblock_modes;
- return macroblock_modes;
+ case I_TYPE:
+ tab = MB_I + UBITS(bit_buf, 1);
+ DUMPBITS(tab->len);
+ macroblock_modes = tab->modes;
- case D_TYPE:
+ if(!m_frame_pred_frame_dct && m_picture_structure == FRAME_PICTURE)
+ {
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
- DUMPBITS(1);
- return MACROBLOCK_INTRA;
- }
+ return macroblock_modes;
- return 0;
+ case D_TYPE:
+
+ DUMPBITS(1);
+ return MACROBLOCK_INTRA;
+ }
+
+ return 0;
}
int CMpeg2Decoder::get_quantizer_scale()
@@ -2185,9 +2116,9 @@ int CMpeg2Decoder::get_quantizer_scale()
int quantizer_scale_code = UBITS(bit_buf, 5);
DUMPBITS(5);
- return m_q_scale_type
- ? non_linear_quantizer_scale[quantizer_scale_code]
- : (quantizer_scale_code << 1);
+ return m_q_scale_type
+ ? non_linear_quantizer_scale[quantizer_scale_code]
+ : (quantizer_scale_code << 1);
}
int CMpeg2Decoder::get_motion_delta(const int f_code)
@@ -2197,47 +2128,47 @@ int CMpeg2Decoder::get_motion_delta(const int f_code)
const MVtab* tab;
if(bit_buf & 0x80000000)
- {
- DUMPBITS(1);
- return 0;
+ {
+ DUMPBITS(1);
+ return 0;
}
- else if(bit_buf >= 0x0c000000)
- {
- tab = MV_4 + UBITS(bit_buf, 4);
- delta = (tab->delta << f_code) + 1;
- bits += tab->len + f_code + 1;
- bit_buf <<= tab->len;
+ else if(bit_buf >= 0x0c000000)
+ {
+ tab = MV_4 + UBITS(bit_buf, 4);
+ delta = (tab->delta << f_code) + 1;
+ bits += tab->len + f_code + 1;
+ bit_buf <<= tab->len;
- sign = SBITS(bit_buf, 1);
- bit_buf <<= 1;
+ sign = SBITS(bit_buf, 1);
+ bit_buf <<= 1;
- if(f_code)
- {
- delta += UBITS(bit_buf, f_code);
- }
+ if(f_code)
+ {
+ delta += UBITS(bit_buf, f_code);
+ }
- bit_buf <<= f_code;
+ bit_buf <<= f_code;
- return (delta ^ sign) - sign;
+ return (delta ^ sign) - sign;
}
- else
- {
- tab = MV_10 + UBITS(bit_buf, 10);
- delta = (tab->delta << f_code) + 1;
- bits += tab->len + 1;
- bit_buf <<= tab->len;
-
- sign = SBITS(bit_buf, 1);
- bit_buf <<= 1;
-
- if(f_code)
- {
- NEEDBITS;
- delta += UBITS(bit_buf, f_code);
- DUMPBITS(f_code);
- }
-
- return (delta ^ sign) - sign;
+ else
+ {
+ tab = MV_10 + UBITS(bit_buf, 10);
+ delta = (tab->delta << f_code) + 1;
+ bits += tab->len + 1;
+ bit_buf <<= tab->len;
+
+ sign = SBITS(bit_buf, 1);
+ bit_buf <<= 1;
+
+ if(f_code)
+ {
+ NEEDBITS;
+ delta += UBITS(bit_buf, f_code);
+ DUMPBITS(f_code);
+ }
+
+ return (delta ^ sign) - sign;
}
}
@@ -2260,16 +2191,16 @@ int CMpeg2Decoder::get_coded_block_pattern()
NEEDBITS;
if(bit_buf >= 0x20000000)
- {
- tab = CBP_7 + (UBITS(bit_buf, 7) - 16);
- DUMPBITS(tab->len);
- return tab->cbp;
+ {
+ tab = CBP_7 + (UBITS(bit_buf, 7) - 16);
+ DUMPBITS(tab->len);
+ return tab->cbp;
}
- else
- {
- tab = CBP_9 + UBITS(bit_buf, 9);
- DUMPBITS(tab->len);
- return tab->cbp;
+ else
+ {
+ tab = CBP_9 + UBITS(bit_buf, 9);
+ DUMPBITS(tab->len);
+ return tab->cbp;
}
}
@@ -2280,33 +2211,33 @@ int CMpeg2Decoder::get_luma_dc_dct_diff()
int dc_diff;
if(bit_buf < 0xf8000000)
- {
- tab = DC_lum_5 + UBITS(bit_buf, 5);
- size = tab->size;
- if(size)
- {
- bits += tab->len + size;
- bit_buf <<= tab->len;
- dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
- bit_buf <<= size;
- return dc_diff;
- }
- else
- {
- DUMPBITS(3);
- return 0;
- }
- }
- else
- {
- tab = DC_long + (UBITS(bit_buf, 9) - 0x1e0);
- size = tab->size;
- DUMPBITS(tab->len);
- NEEDBITS;
- dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
- DUMPBITS(size);
- return dc_diff;
- }
+ {
+ tab = DC_lum_5 + UBITS(bit_buf, 5);
+ size = tab->size;
+ if(size)
+ {
+ bits += tab->len + size;
+ bit_buf <<= tab->len;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ bit_buf <<= size;
+ return dc_diff;
+ }
+ else
+ {
+ DUMPBITS(3);
+ return 0;
+ }
+ }
+ else
+ {
+ tab = DC_long + (UBITS(bit_buf, 9) - 0x1e0);
+ size = tab->size;
+ DUMPBITS(tab->len);
+ NEEDBITS;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ DUMPBITS(size);
+ return dc_diff;
+ }
}
int CMpeg2Decoder::get_chroma_dc_dct_diff()
@@ -2316,34 +2247,34 @@ int CMpeg2Decoder::get_chroma_dc_dct_diff()
int dc_diff;
if(bit_buf < 0xf8000000)
- {
- tab = DC_chrom_5 + UBITS(bit_buf, 5);
- size = tab->size;
-
- if(size)
- {
- bits += tab->len + size;
- bit_buf <<= tab->len;
- dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
- bit_buf <<= size;
- return dc_diff;
- }
- else
- {
- DUMPBITS(2);
- return 0;
- }
- }
- else
- {
- tab = DC_long + (UBITS(bit_buf, 10) - 0x3e0);
- size = tab->size;
- DUMPBITS(tab->len + 1);
- NEEDBITS;
- dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
- DUMPBITS(size);
- return dc_diff;
- }
+ {
+ tab = DC_chrom_5 + UBITS(bit_buf, 5);
+ size = tab->size;
+
+ if(size)
+ {
+ bits += tab->len + size;
+ bit_buf <<= tab->len;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ bit_buf <<= size;
+ return dc_diff;
+ }
+ else
+ {
+ DUMPBITS(2);
+ return 0;
+ }
+ }
+ else
+ {
+ tab = DC_long + (UBITS(bit_buf, 10) - 0x3e0);
+ size = tab->size;
+ DUMPBITS(tab->len + 1);
+ NEEDBITS;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ DUMPBITS(size);
+ return dc_diff;
+ }
}
#undef bit_buf
@@ -2381,101 +2312,101 @@ void CMpeg2Decoder::get_intra_block_B14()
NEEDBITS;
while(1)
- {
- if(bit_buf >= 0x28000000)
- {
- tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
-
- i += tab->run;
- if(i >= 64)
- break; /* end of block */
-
- normal_code:
- j = scan[i];
- bit_buf <<= tab->len;
- bits += tab->len + 1;
- val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
-
- // if(bitstream_get (1)) val = -val;
- val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
-
- SATURATE(val);
- dest[j] = val;
- mismatch ^= val;
-
- bit_buf <<= 1;
- NEEDBITS;
-
- continue;
- }
- else if(bit_buf >= 0x04000000)
- {
- tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
-
- i += tab->run;
- if(i < 64)
- goto normal_code;
-
- /* escape code */
-
- i += UBITS(bit_buf << 6, 6) - 64;
- if(i >= 64)
- break; /* illegal, check needed to avoid buffer overflow */
-
- j = scan[i];
-
- DUMPBITS(12);
- NEEDBITS;
- val = (SBITS(bit_buf, 12) * quantizer_scale * quant_matrix[j]) / 16;
-
- SATURATE(val);
- dest[j] = val;
- mismatch ^= val;
-
- DUMPBITS(12);
- NEEDBITS;
-
- continue;
- }
- else if(bit_buf >= 0x02000000)
- {
- tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00800000)
- {
- tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00200000)
- {
- tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else
- {
- tab = DCT_16 + UBITS(bit_buf, 16);
- bit_buf <<= 16;
- GETWORD(bit_buf, bits + 16, bit_ptr);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
-
- break; /* illegal, check needed to avoid buffer overflow */
- }
-
- dest[63] ^= mismatch & 1;
- DUMPBITS(2); /* dump end of block code */
- m_bitstream_buf = bit_buf;
- m_bitstream_bits = bits;
- m_bitstream_ptr = bit_ptr;
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+
+ // if(bitstream_get (1)) val = -val;
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = (SBITS(bit_buf, 12) * quantizer_scale * quant_matrix[j]) / 16;
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ DUMPBITS(12);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD (bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ dest[63] ^= mismatch & 1;
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
}
void CMpeg2Decoder::get_intra_block_B15()
@@ -2502,102 +2433,102 @@ void CMpeg2Decoder::get_intra_block_B15()
NEEDBITS;
- while(1)
- {
- if(bit_buf >= 0x04000000)
- {
- tab = DCT_B15_8 + (UBITS(bit_buf, 8) - 4);
-
- i += tab->run;
- if(i < 64)
- {
- normal_code:
- j = scan[i];
- bit_buf <<= tab->len;
- bits += tab->len + 1;
- val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
-
- // if(bitstream_get (1)) val = -val;
- val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
-
- SATURATE(val);
- dest[j] = val;
- mismatch ^= val;
-
- bit_buf <<= 1;
- NEEDBITS;
-
- continue;
- }
- else
- {
- /* end of block. I commented out this code because if we */
- /* dont exit here we will still exit at the later test :) */
-
- /* if(i >= 128) break; */ /* end of block */
-
- /* escape code */
-
- i += UBITS(bit_buf << 6, 6) - 64;
- if(i >= 64)
- break; /* illegal, check against buffer overflow */
-
- j = scan[i];
-
- DUMPBITS(12);
- NEEDBITS;
- val = (SBITS(bit_buf, 12) *
- quantizer_scale * quant_matrix[j]) / 16;
-
- SATURATE(val);
- dest[j] = val;
- mismatch ^= val;
-
- DUMPBITS(12);
- NEEDBITS;
-
- continue;
- }
- }
- else if(bit_buf >= 0x02000000)
- {
- tab = DCT_B15_10 + (UBITS(bit_buf, 10) - 8);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00800000)
- {
- tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00200000)
- {
- tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else
- {
- tab = DCT_16 + UBITS(bit_buf, 16);
- bit_buf <<= 16;
- GETWORD(bit_buf, bits + 16, bit_ptr);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
-
- break; /* illegal, check needed to avoid buffer overflow */
- }
-
- dest[63] ^= mismatch & 1;
- DUMPBITS(4); /* dump end of block code */
- m_bitstream_buf = bit_buf;
- m_bitstream_bits = bits;
- m_bitstream_ptr = bit_ptr;
+ while(1)
+ {
+ if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B15_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ {
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+
+ // if(bitstream_get (1)) val = -val;
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+ else
+ {
+ /* end of block. I commented out this code because if we */
+ /* dont exit here we will still exit at the later test :) */
+
+ /* if(i >= 128) break; */ /* end of block */
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check against buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = (SBITS(bit_buf, 12) *
+ quantizer_scale * quant_matrix[j]) / 16;
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ DUMPBITS(12);
+ NEEDBITS;
+
+ continue;
+ }
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B15_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD(bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ dest[63] ^= mismatch & 1;
+ DUMPBITS(4); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
}
int CMpeg2Decoder::get_non_intra_block()
@@ -2624,115 +2555,115 @@ int CMpeg2Decoder::get_non_intra_block()
NEEDBITS;
if(bit_buf >= 0x28000000)
- {
- tab = DCT_B14DC_5 + (UBITS(bit_buf, 5) - 5);
- goto entry_1;
- }
- else
- {
- goto entry_2;
+ {
+ tab = DCT_B14DC_5 + (UBITS(bit_buf, 5) - 5);
+ goto entry_1;
}
+ else
+ {
+ goto entry_2;
+ }
while(1)
- {
- if(bit_buf >= 0x28000000)
- {
- tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
- entry_1:
- i += tab->run;
- if(i >= 64)
- break; /* end of block */
- normal_code:
- j = scan[i];
- bit_buf <<= tab->len;
- bits += tab->len + 1;
- val = ((2 * tab->level + 1) * quantizer_scale * quant_matrix[j]) >> 5;
-
- /* if(bitstream_get (1)) val = -val; */
- val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
-
- SATURATE(val);
- dest[j] = val;
- mismatch ^= val;
-
- bit_buf <<= 1;
- NEEDBITS;
-
- continue;
- }
-
- entry_2:
- if(bit_buf >= 0x04000000)
- {
- tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
-
- i += tab->run;
- if(i < 64)
- goto normal_code;
-
- /* escape code */
-
- i += UBITS(bit_buf << 6, 6) - 64;
- if(i >= 64)
- break; /* illegal, check needed to avoid buffer overflow */
-
- j = scan[i];
-
- DUMPBITS(12);
- NEEDBITS;
- val = 2 * (SBITS(bit_buf, 12) + SBITS(bit_buf, 1)) + 1;
- val = (val * quantizer_scale * quant_matrix[j]) / 32;
-
- SATURATE(val);
- dest[j] = val;
- mismatch ^= val;
-
- DUMPBITS(12);
- NEEDBITS;
-
- continue;
- }
- else if(bit_buf >= 0x02000000)
- {
- tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00800000)
- {
- tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00200000)
- {
- tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else
- {
- tab = DCT_16 + UBITS(bit_buf, 16);
- bit_buf <<= 16;
- GETWORD(bit_buf, bits + 16, bit_ptr);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
-
- break; /* illegal, check needed to avoid buffer overflow */
- }
-
- dest[63] ^= mismatch & 1;
- DUMPBITS(2); /* dump end of block code */
- m_bitstream_buf = bit_buf;
- m_bitstream_bits = bits;
- m_bitstream_ptr = bit_ptr;
-
- return i;
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+entry_1:
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = ((2*tab->level+1) * quantizer_scale * quant_matrix[j]) >> 5;
+
+ /* if(bitstream_get (1)) val = -val; */
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+
+entry_2:
+ if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = 2 * (SBITS(bit_buf, 12) + SBITS(bit_buf, 1)) + 1;
+ val = (val * quantizer_scale * quant_matrix[j]) / 32;
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ DUMPBITS(12);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD (bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ dest[63] ^= mismatch & 1;
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+
+ return i;
}
void CMpeg2Decoder::get_mpeg1_intra_block()
@@ -2758,109 +2689,109 @@ void CMpeg2Decoder::get_mpeg1_intra_block()
NEEDBITS;
while(1)
- {
- if(bit_buf >= 0x28000000)
- {
- tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
-
- i += tab->run;
- if(i >= 64)
- break; /* end of block */
- normal_code:
- j = scan[i];
- bit_buf <<= tab->len;
- bits += tab->len + 1;
- val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
-
- /* oddification */
- val = (val - 1) | 1;
-
- /* if(bitstream_get (1)) val = -val; */
- val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
-
- SATURATE(val);
- dest[j] = val;
-
- bit_buf <<= 1;
- NEEDBITS;
-
- continue;
- }
- else if(bit_buf >= 0x04000000)
- {
- tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
-
- i += tab->run;
- if(i < 64)
- goto normal_code;
-
- /* escape code */
-
- i += UBITS(bit_buf << 6, 6) - 64;
- if(i >= 64)
- break; /* illegal, check needed to avoid buffer overflow */
-
- j = scan[i];
-
- DUMPBITS(12);
- NEEDBITS;
- val = SBITS(bit_buf, 8);
- if(!(val & 0x7f))
- {
- DUMPBITS(8);
- val = UBITS(bit_buf, 8) + 2 * val;
- }
- val = (val * quantizer_scale * quant_matrix[j]) / 16;
-
- /* oddification */
- val = (val + ~SBITS(val, 1)) | 1;
-
- SATURATE(val);
- dest[j] = val;
-
- DUMPBITS(8);
- NEEDBITS;
-
- continue;
- }
- else if(bit_buf >= 0x02000000)
- {
- tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00800000)
- {
- tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00200000)
- {
- tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else
- {
- tab = DCT_16 + UBITS(bit_buf, 16);
- bit_buf <<= 16;
- GETWORD(bit_buf, bits + 16, bit_ptr);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
-
- break; /* illegal, check needed to avoid buffer overflow */
- }
-
- DUMPBITS(2); /* dump end of block code */
- m_bitstream_buf = bit_buf;
- m_bitstream_bits = bits;
- m_bitstream_ptr = bit_ptr;
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+
+ /* oddification */
+ val = (val - 1) | 1;
+
+ /* if(bitstream_get (1)) val = -val; */
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = SBITS(bit_buf, 8);
+ if(!(val & 0x7f))
+ {
+ DUMPBITS(8);
+ val = UBITS(bit_buf, 8) + 2 * val;
+ }
+ val = (val * quantizer_scale * quant_matrix[j]) / 16;
+
+ /* oddification */
+ val = (val + ~SBITS(val, 1)) | 1;
+
+ SATURATE(val);
+ dest[j] = val;
+
+ DUMPBITS(8);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD(bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
}
int CMpeg2Decoder::get_mpeg1_non_intra_block()
@@ -2885,124 +2816,124 @@ int CMpeg2Decoder::get_mpeg1_non_intra_block()
NEEDBITS;
if(bit_buf >= 0x28000000)
- {
- tab = DCT_B14DC_5 + (UBITS(bit_buf, 5) - 5);
- goto entry_1;
- }
- else
- {
- goto entry_2;
- }
-
- while(1)
- {
- if(bit_buf >= 0x28000000)
- {
- tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
- entry_1:
- i += tab->run;
- if(i >= 64)
- break; /* end of block */
- normal_code:
- j = scan[i];
- bit_buf <<= tab->len;
- bits += tab->len + 1;
- val = ((2 * tab->level + 1) * quantizer_scale * quant_matrix[j]) >> 5;
-
- /* oddification */
- val = (val - 1) | 1;
-
- /* if(bitstream_get (1)) val = -val; */
- val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
-
- SATURATE(val);
- dest[j] = val;
-
- bit_buf <<= 1;
- NEEDBITS;
-
- continue;
- }
-
- entry_2:
- if(bit_buf >= 0x04000000)
- {
- tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
-
- i += tab->run;
- if(i < 64)
- goto normal_code;
-
- /* escape code */
-
- i += UBITS(bit_buf << 6, 6) - 64;
- if(i >= 64)
- break; /* illegal, check needed to avoid buffer overflow */
-
- j = scan[i];
-
- DUMPBITS(12);
- NEEDBITS;
- val = SBITS(bit_buf, 8);
- if(!(val & 0x7f))
- {
- DUMPBITS(8);
- val = UBITS(bit_buf, 8) + 2 * val;
- }
- val = 2 * (val + SBITS(val, 1)) + 1;
- val = (val * quantizer_scale * quant_matrix[j]) / 32;
-
- /* oddification */
- val = (val + ~SBITS(val, 1)) | 1;
-
- SATURATE(val);
- dest[j] = val;
-
- DUMPBITS(8);
- NEEDBITS;
-
- continue;
- }
- else if(bit_buf >= 0x02000000)
- {
- tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00800000)
- {
- tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else if(bit_buf >= 0x00200000)
- {
- tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
- else
- {
- tab = DCT_16 + UBITS(bit_buf, 16);
- bit_buf <<= 16;
- GETWORD(bit_buf, bits + 16, bit_ptr);
- i += tab->run;
- if(i < 64)
- goto normal_code;
- }
-
- break; /* illegal, check needed to avoid buffer overflow */
- }
-
- DUMPBITS(2); /* dump end of block code */
- m_bitstream_buf = bit_buf;
- m_bitstream_bits = bits;
- m_bitstream_ptr = bit_ptr;
-
- return i;
+ {
+ tab = DCT_B14DC_5 + (UBITS(bit_buf, 5) - 5);
+ goto entry_1;
+ }
+ else
+ {
+ goto entry_2;
+ }
+
+ while(1)
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+entry_1:
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = ((2*tab->level+1) * quantizer_scale * quant_matrix[j]) >> 5;
+
+ /* oddification */
+ val = (val - 1) | 1;
+
+ /* if(bitstream_get (1)) val = -val; */
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+
+entry_2:
+ if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = SBITS(bit_buf, 8);
+ if(!(val & 0x7f))
+ {
+ DUMPBITS(8);
+ val = UBITS(bit_buf, 8) + 2 * val;
+ }
+ val = 2 * (val + SBITS(val, 1)) + 1;
+ val = (val * quantizer_scale * quant_matrix[j]) / 32;
+
+ /* oddification */
+ val = (val + ~SBITS(val, 1)) | 1;
+
+ SATURATE(val);
+ dest[j] = val;
+
+ DUMPBITS(8);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD (bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+
+ return i;
}
#define bit_buf (m_bitstream_buf)
@@ -3014,108 +2945,106 @@ void CMpeg2Decoder::slice_intra_DCT(const int cc, uint8_t* dest, int stride)
NEEDBITS;
/* Get the intra DC coefficient and inverse quantize it */
- m_dc_dct_pred[cc] += (cc == 0)
- ? get_luma_dc_dct_diff()
- : get_chroma_dc_dct_diff();
-
- m_DCTblock[0] = m_dc_dct_pred[cc] << (3 - m_intra_dc_precision);
+ m_dc_dct_pred[cc] += (cc == 0)
+ ? get_luma_dc_dct_diff()
+ : get_chroma_dc_dct_diff();
+
+ m_DCTblock[0] = m_dc_dct_pred[cc] << (3 - m_intra_dc_precision);
if(m_mpeg1)
- {
- if(m_coding_type != D_TYPE)
- get_mpeg1_intra_block();
- }
- else if(m_intra_vlc_format)
- {
- get_intra_block_B15();
- }
+ {
+ if(m_coding_type != D_TYPE)
+ get_mpeg1_intra_block();
+ }
+ else if(m_intra_vlc_format)
+ {
+ get_intra_block_B15();
+ }
else
- {
- get_intra_block_B14();
- }
+ {
+ get_intra_block_B14();
+ }
m_idct_copy(m_DCTblock, dest, stride);
}
void CMpeg2Decoder::slice_non_intra_DCT(uint8_t* dest, int stride)
{
- int last = m_mpeg1
- ? get_mpeg1_non_intra_block()
- : get_non_intra_block();
-
- m_idct_add(last, m_DCTblock, dest, stride);
+ int last = m_mpeg1
+ ? get_mpeg1_non_intra_block()
+ : get_non_intra_block ();
+
+ m_idct_add(last, m_DCTblock, dest, stride);
}
void CMpeg2Decoder::MOTION(
- mpeg2_mc_fct * const * const table, uint8_t** ref,
- int motion_x, int motion_y,
- unsigned int size, unsigned int y, unsigned int limit_y)
+ mpeg2_mc_fct * const * const table, uint8_t** ref,
+ int motion_x, int motion_y,
+ unsigned int size, unsigned int y, unsigned int limit_y)
{
- unsigned int pos_x, pos_y, xy_half, offset, dest_offset;
+ unsigned int pos_x, pos_y, xy_half, offset, dest_offset;
- pos_x = 2 * m_offset + motion_x;
- pos_y = 2 * m_v_offset + motion_y + 2 * y;
+ pos_x = 2 * m_offset + motion_x;
+ pos_y = 2 * m_v_offset + motion_y + 2 * y;
- if(pos_x > m_limit_x)
- {
- pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
- motion_x = pos_x - 2 * m_offset;
- }
+ if(pos_x > m_limit_x)
+ {
+ pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
+ motion_x = pos_x - 2 * m_offset;
+ }
- if(pos_y > limit_y)
- {
- pos_y = ((int)pos_y < 0) ? 0 : limit_y;
- motion_y = pos_y - 2 * m_v_offset - 2 * y;
- }
+ if(pos_y > limit_y)
+ {
+ pos_y = ((int)pos_y < 0) ? 0 : limit_y;
+ motion_y = pos_y - 2 * m_v_offset - 2 * y;
+ }
- xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
- offset = (pos_x >> 1) + (pos_y >> 1) * m_stride;
- table[xy_half](m_dest[0] + y * m_stride + m_offset, ref[0] + offset, m_stride, size);
+ xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
+ offset = (pos_x >> 1) + (pos_y >> 1) * m_stride;
+ table[xy_half] (m_dest[0] + y * m_stride + m_offset, ref[0] + offset, m_stride, size);
- motion_x /= 2;
- motion_y /= 2;
+ motion_x /= 2; motion_y /= 2;
- xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
- offset = ((m_offset + motion_x) >> 1) + ((((m_v_offset + motion_y) >> 1) + y / 2) * m_uv_stride);
- dest_offset = y / 2 * m_uv_stride + (m_offset >> 1);
- table[4+xy_half](m_dest[1] + dest_offset, ref[1] + offset, m_uv_stride, size / 2);
- table[4+xy_half](m_dest[2] + dest_offset, ref[2] + offset, m_uv_stride, size / 2);
+ xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
+ offset = ((m_offset + motion_x) >> 1) + ((((m_v_offset + motion_y) >> 1) + y/2) * m_uv_stride);
+ dest_offset = y/2 * m_uv_stride + (m_offset >> 1);
+ table[4+xy_half] (m_dest[1] + dest_offset, ref[1] + offset, m_uv_stride, size/2);
+ table[4+xy_half] (m_dest[2] + dest_offset, ref[2] + offset, m_uv_stride, size/2);
}
void CMpeg2Decoder::MOTION_FIELD(
- mpeg2_mc_fct * const * const table, uint8_t** ref,
- int motion_x, int motion_y,
- int dest_field, int src_field, unsigned int op)
+ mpeg2_mc_fct * const * const table, uint8_t** ref,
+ int motion_x, int motion_y,
+ int dest_field, int src_field, unsigned int op)
{
unsigned int pos_x, pos_y, xy_half, offset, dest_offset;
- pos_x = 2 * m_offset + motion_x;
- pos_y = m_v_offset + motion_y;
-
- if(pos_x > m_limit_x)
- {
- pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
- motion_x = pos_x - 2 * m_offset;
- }
+ pos_x = 2 * m_offset + motion_x;
+ pos_y = m_v_offset + motion_y;
- if(pos_y > m_limit_y)
- {
- pos_y = ((int)pos_y < 0) ? 0 : m_limit_y;
- motion_y = pos_y - m_v_offset;
- }
+ if(pos_x > m_limit_x)
+ {
+ pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
+ motion_x = pos_x - 2 * m_offset;
+ }
- xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
- offset = (pos_x >> 1) + ((op ? (pos_y | 1) : (pos_y & ~1)) + src_field) * m_stride;
- table[xy_half](m_dest[0] + dest_field * m_stride + m_offset, ref[0] + offset, 2 * m_stride, 8);
+ if(pos_y > m_limit_y)
+ {
+ pos_y = ((int)pos_y < 0) ? 0 : m_limit_y;
+ motion_y = pos_y - m_v_offset;
+ }
- motion_x /= 2;
- motion_y /= 2;
+ xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
+ offset = (pos_x >> 1) + ((op ? (pos_y | 1) : (pos_y & ~1)) + src_field) * m_stride;
+ table[xy_half] (m_dest[0] + dest_field * m_stride + m_offset, ref[0] + offset, 2 * m_stride, 8);
+
+ motion_x /= 2; motion_y /= 2;
- xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
- offset = ((m_offset + motion_x) >> 1) + (((m_v_offset >> 1) + (op ? (motion_y | 1) : (motion_y & ~1)) + src_field) * m_uv_stride);
- dest_offset = dest_field * m_uv_stride + (m_offset >> 1);
- table[4+xy_half](m_dest[1] + dest_offset, ref[1] + offset, 2 * m_uv_stride, 4);
- table[4+xy_half](m_dest[2] + dest_offset, ref[2] + offset, 2 * m_uv_stride, 4);
+ xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
+ offset = ((m_offset + motion_x) >> 1) + (((m_v_offset >> 1) + (op ? (motion_y | 1) :(motion_y & ~1)) + src_field) * m_uv_stride);
+ dest_offset = dest_field * m_uv_stride + (m_offset >> 1);
+ table[4+xy_half] (m_dest[1] + dest_offset, ref[1] + offset, 2 * m_uv_stride, 4);
+ table[4+xy_half] (m_dest[2] + dest_offset, ref[2] + offset, 2 * m_uv_stride, 4);
}
void CMpeg2Decoder::motion_mp1(motion_t* motion, mpeg2_mc_fct * const * const table)
@@ -3146,7 +3075,7 @@ void CMpeg2Decoder::motion_fr_frame(motion_t* motion, mpeg2_mc_fct * const * con
NEEDBITS;
motion_y = motion->pmv[0][1] + get_motion_delta(motion->f_code[1]);
- motion_y = bound_motion_vector(motion_y, motion->f_code[1]);
+ motion_y = bound_motion_vector (motion_y, motion->f_code[1]);
motion->pmv[1][1] = motion->pmv[0][1] = motion_y;
MOTION(table, motion->ref[0], motion_x, motion_y, 16, 0, m_limit_y_16);
@@ -3218,22 +3147,22 @@ void CMpeg2Decoder::motion_fr_dmv(motion_t* motion, mpeg2_mc_fct * const * const
pos_x = 2 * m_offset + motion_x;
pos_y = m_v_offset + motion_y;
if(pos_x > m_limit_x)
- {
- pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
- motion_x = pos_x - 2 * m_offset;
+ {
+ pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
+ motion_x = pos_x - 2 * m_offset;
}
if(pos_y > m_limit_y)
- {
- pos_y = ((int)pos_y < 0) ? 0 : m_limit_y;
- motion_y = pos_y - m_v_offset;
+ {
+ pos_y = ((int)pos_y < 0) ? 0 : m_limit_y;
+ motion_y = pos_y - m_v_offset;
}
xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
offset = (pos_x >> 1) + (pos_y & ~1) * m_stride;
m_mc->avg[xy_half](m_dest[0] + m_offset, motion->ref[0][0] + offset, 2 * m_stride, 8);
m_mc->avg[xy_half](m_dest[0] + m_stride + m_offset, motion->ref[0][0] + m_stride + offset, 2 * m_stride, 8);
- motion_x /= 2;
- motion_y /= 2;
+ motion_x /= 2;
+ motion_y /= 2;
xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
offset = ((m_offset + motion_x) >> 1) + ((m_v_offset >> 1) + (motion_y & ~1)) * m_uv_stride;
m_mc->avg[4+xy_half](m_dest[1] + (m_offset >> 1), motion->ref[0][1] + offset, 2 * m_uv_stride, 4);
@@ -3290,7 +3219,7 @@ void CMpeg2Decoder::motion_fi_field(motion_t * motion, mpeg2_mc_fct * const * co
DUMPBITS(1);
motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
- motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion_x = bound_motion_vector (motion_x, motion->f_code[0]);
motion->pmv[1][0] = motion->pmv[0][0] = motion_x;
NEEDBITS;
@@ -3326,7 +3255,7 @@ void CMpeg2Decoder::motion_fi_16x8(motion_t* motion, mpeg2_mc_fct * const * cons
DUMPBITS(1);
motion_x = motion->pmv[1][0] + get_motion_delta(motion->f_code[0]);
- motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion_x = bound_motion_vector (motion_x, motion->f_code[0]);
motion->pmv[1][0] = motion_x;
NEEDBITS;
@@ -3351,7 +3280,7 @@ void CMpeg2Decoder::motion_fi_dmv(motion_t* motion, mpeg2_mc_fct * const * const
motion_y = motion->pmv[0][1] + get_motion_delta(motion->f_code[1]);
motion_y = bound_motion_vector(motion_y, motion->f_code[1]);
motion->pmv[1][1] = motion->pmv[0][1] = motion_y;
- other_y = ((motion_y + (motion_y > 0)) >> 1) + get_dmv() + m_dmv_offset;
+ other_y = ((motion_y + (motion_y > 0)) >> 1) + get_dmv () + m_dmv_offset;
MOTION(m_mc->put, motion->ref[0], motion_x, motion_y, 16, 0, m_limit_y_16);
MOTION(m_mc->avg, motion->ref[1], other_x, other_y, 16, 0, m_limit_y_16);
@@ -3364,7 +3293,7 @@ void CMpeg2Decoder::motion_fi_conceal()
NEEDBITS;
DUMPBITS(1); /* remove field_select */
- tmp = m_f_motion.pmv[0][0] + get_motion_delta(m_f_motion.f_code[0]);
+ tmp = m_f_motion.pmv[0][0] + get_motion_delta (m_f_motion.f_code[0]);
tmp = bound_motion_vector(tmp, m_f_motion.f_code[0]);
m_f_motion.pmv[1][0] = m_f_motion.pmv[0][0] = tmp;
@@ -3420,35 +3349,35 @@ void CMpeg2Decoder::mpeg2_init_fbuf(uint8_t* current_fbuf[3], uint8_t* forward_f
m_b_motion.ref[0][2] = backward_fbuf[2] + (offset >> 1);
if(m_picture_structure != FRAME_PICTURE)
- {
- m_dmv_offset = bottom_field ? 1 : -1;
- m_f_motion.ref2[0] = m_f_motion.ref[bottom_field];
- m_f_motion.ref2[1] = m_f_motion.ref[!bottom_field];
- m_b_motion.ref2[0] = m_b_motion.ref[bottom_field];
- m_b_motion.ref2[1] = m_b_motion.ref[!bottom_field];
- offset = stride - offset;
-
- if(m_second_field && (m_coding_type != B_TYPE))
- forward_fbuf = current_fbuf;
-
- m_f_motion.ref[1][0] = forward_fbuf[0] + offset;
- m_f_motion.ref[1][1] = forward_fbuf[1] + (offset >> 1);
- m_f_motion.ref[1][2] = forward_fbuf[2] + (offset >> 1);
-
- m_b_motion.ref[1][0] = backward_fbuf[0] + offset;
- m_b_motion.ref[1][1] = backward_fbuf[1] + (offset >> 1);
- m_b_motion.ref[1][2] = backward_fbuf[2] + (offset >> 1);
-
- stride <<= 1;
- height >>= 1;
- }
+ {
+ m_dmv_offset = bottom_field ? 1 : -1;
+ m_f_motion.ref2[0] = m_f_motion.ref[bottom_field];
+ m_f_motion.ref2[1] = m_f_motion.ref[!bottom_field];
+ m_b_motion.ref2[0] = m_b_motion.ref[bottom_field];
+ m_b_motion.ref2[1] = m_b_motion.ref[!bottom_field];
+ offset = stride - offset;
+
+ if(m_second_field && (m_coding_type != B_TYPE))
+ forward_fbuf = current_fbuf;
+
+ m_f_motion.ref[1][0] = forward_fbuf[0] + offset;
+ m_f_motion.ref[1][1] = forward_fbuf[1] + (offset >> 1);
+ m_f_motion.ref[1][2] = forward_fbuf[2] + (offset >> 1);
- m_stride = stride;
- m_uv_stride = stride >> 1;
- m_limit_x = 2 * m_width - 32;
- m_limit_y_16 = 2 * height - 32;
- m_limit_y_8 = 2 * height - 16;
- m_limit_y = height - 16;
+ m_b_motion.ref[1][0] = backward_fbuf[0] + offset;
+ m_b_motion.ref[1][1] = backward_fbuf[1] + (offset >> 1);
+ m_b_motion.ref[1][2] = backward_fbuf[2] + (offset >> 1);
+
+ stride <<= 1;
+ height >>= 1;
+ }
+
+ m_stride = stride;
+ m_uv_stride = stride >> 1;
+ m_limit_x = 2 * m_width - 32;
+ m_limit_y_16 = 2 * height - 32;
+ m_limit_y_8 = 2 * height - 16;
+ m_limit_y = height - 16;
}
int CMpeg2Decoder::slice_init(int code)
@@ -3457,7 +3386,7 @@ int CMpeg2Decoder::slice_init(int code)
const MBAtab* mba;
m_dc_dct_pred[0] = m_dc_dct_pred[1] =
- m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
+ m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
@@ -3465,9 +3394,9 @@ int CMpeg2Decoder::slice_init(int code)
m_b_motion.pmv[1][0] = m_b_motion.pmv[1][1] = 0;
if(m_vertical_position_extension)
- {
- code += UBITS(bit_buf, 3) << 7;
- DUMPBITS(3);
+ {
+ code += UBITS(bit_buf, 3) << 7;
+ DUMPBITS(3);
}
m_v_offset = (code - 1) * 16;
@@ -3481,61 +3410,61 @@ int CMpeg2Decoder::slice_init(int code)
/* ignore intra_slice and all the extra data */
while(bit_buf & 0x80000000)
- {
- DUMPBITS(9);
- NEEDBITS;
+ {
+ DUMPBITS(9);
+ NEEDBITS;
}
/* decode initial macroblock address increment */
offset = 0;
while(1)
- {
- if(bit_buf >= 0x08000000)
- {
- mba = MBA_5 + (UBITS(bit_buf, 6) - 2);
- break;
- }
- else if(bit_buf >= 0x01800000)
- {
- mba = MBA_11 + (UBITS(bit_buf, 12) - 24);
- break;
- }
- else
- {
- switch(UBITS(bit_buf, 12))
- {
- case 8: /* macroblock_escape */
- offset += 33;
- DUMPBITS(11);
- NEEDBITS;
- continue;
- case 15: /* macroblock_stuffing (MPEG1 only) */
- bit_buf &= 0xfffff;
- DUMPBITS(11);
- NEEDBITS;
- continue;
- default: /* error */
- return 1;
- }
- }
- }
-
- DUMPBITS(mba->len + 1);
- m_offset = (offset + mba->mba) << 4;
-
- while(m_offset - m_width >= 0)
- {
- m_offset -= m_width;
- m_dest[0] += 16 * m_stride;
- m_dest[1] += 4 * m_stride;
- m_dest[2] += 4 * m_stride;
- m_v_offset += 16;
- }
-
- if(m_v_offset > m_limit_y)
- return 1;
-
- return 0;
+ {
+ if(bit_buf >= 0x08000000)
+ {
+ mba = MBA_5 + (UBITS(bit_buf, 6) - 2);
+ break;
+ }
+ else if(bit_buf >= 0x01800000)
+ {
+ mba = MBA_11 + (UBITS(bit_buf, 12) - 24);
+ break;
+ }
+ else
+ {
+ switch(UBITS(bit_buf, 12))
+ {
+ case 8: /* macroblock_escape */
+ offset += 33;
+ DUMPBITS(11);
+ NEEDBITS;
+ continue;
+ case 15: /* macroblock_stuffing (MPEG1 only) */
+ bit_buf &= 0xfffff;
+ DUMPBITS(11);
+ NEEDBITS;
+ continue;
+ default: /* error */
+ return 1;
+ }
+ }
+ }
+
+ DUMPBITS(mba->len + 1);
+ m_offset = (offset + mba->mba) << 4;
+
+ while(m_offset - m_width >= 0)
+ {
+ m_offset -= m_width;
+ m_dest[0] += 16 * m_stride;
+ m_dest[1] += 4 * m_stride;
+ m_dest[2] += 4 * m_stride;
+ m_v_offset += 16;
+ }
+
+ if(m_v_offset > m_limit_y)
+ return 1;
+
+ return 0;
}
void CMpeg2Decoder::mpeg2_slice(int code, const uint8_t* buffer)
@@ -3545,237 +3474,233 @@ void CMpeg2Decoder::mpeg2_slice(int code, const uint8_t* buffer)
m_bitstream_bits = -16;
if(slice_init(code))
- return;
-
- while(1)
- {
- int macroblock_modes;
- int mba_inc;
- const MBAtab * mba;
-
- NEEDBITS;
-
- macroblock_modes = get_macroblock_modes();
-
- /* maybe integrate MACROBLOCK_QUANT test into get_macroblock_modes ? */
- if(macroblock_modes & MACROBLOCK_QUANT)
- m_quantizer_scale = get_quantizer_scale();
-
- if(macroblock_modes & MACROBLOCK_INTRA)
- {
- int DCT_offset, DCT_stride;
- int offset;
- uint8_t* dest_y;
-
- if(m_concealment_motion_vectors)
- {
- if(m_picture_structure == FRAME_PICTURE) motion_fr_conceal();
- else motion_fi_conceal();
- }
- else
- {
- m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
- m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
- m_b_motion.pmv[0][0] = m_b_motion.pmv[0][1] = 0;
- m_b_motion.pmv[1][0] = m_b_motion.pmv[1][1] = 0;
- }
-
- if(macroblock_modes & DCT_TYPE_INTERLACED)
- {
- DCT_offset = m_stride;
- DCT_stride = m_stride * 2;
- }
- else
- {
- DCT_offset = m_stride * 8;
- DCT_stride = m_stride;
- }
-
- offset = m_offset;
- dest_y = m_dest[0] + offset;
- slice_intra_DCT(0, dest_y, DCT_stride);
- slice_intra_DCT(0, dest_y + 8, DCT_stride);
- slice_intra_DCT(0, dest_y + DCT_offset, DCT_stride);
- slice_intra_DCT(0, dest_y + DCT_offset + 8, DCT_stride);
- slice_intra_DCT(1, m_dest[1] + (offset >> 1), m_uv_stride);
- slice_intra_DCT(2, m_dest[2] + (offset >> 1), m_uv_stride);
-
- if(m_coding_type == D_TYPE)
- {
- NEEDBITS;
- DUMPBITS(1);
- }
- }
- else
- {
- if(m_picture_structure == FRAME_PICTURE)
- {
- switch((macroblock_modes >> 6) & 3) // macroblock_modes & MOTION_TYPE_MASK
- {
- case 0:
- // non-intra mb without forward mv in a P picture //
- m_f_motion.pmv[0][0] = 0;
- m_f_motion.pmv[0][1] = 0;
- m_f_motion.pmv[1][0] = 0;
- m_f_motion.pmv[1][1] = 0;
- MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
- break;
-
- case 1: // MC_FIELD:
- MOTION_CALL(motion_fr_field, macroblock_modes);
- break;
-
- case 2: // MC_FRAME:
-
- if(m_mpeg1) MOTION_CALL(motion_mp1, macroblock_modes);
- else MOTION_CALL(motion_fr_frame, macroblock_modes);
- break;
-
- case 3: // MC_DMV:
- MOTION_CALL(motion_fr_dmv, MACROBLOCK_MOTION_FORWARD);
- break;
-
- default:
- __assume(0);
- }
- }
- else
- {
- switch((macroblock_modes >> 6) & 3) // macroblock_modes & MOTION_TYPE_MASK
- {
- case 0:
- /* non-intra mb without forward mv in a P picture */
- m_f_motion.pmv[0][0] = 0;
- m_f_motion.pmv[0][1] = 0;
- m_f_motion.pmv[1][0] = 0;
- m_f_motion.pmv[1][1] = 0;
- MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
- break;
-
- case 1: // MC_FIELD
- MOTION_CALL(motion_fi_field, macroblock_modes);
- break;
-
- case 2: // MC_16X8
- MOTION_CALL(motion_fi_16x8, macroblock_modes);
- break;
-
- case 3: // MC_DMV
- MOTION_CALL(motion_fi_dmv, MACROBLOCK_MOTION_FORWARD);
- break;
-
- default:
- __assume(0);
- }
- }
-
- if(macroblock_modes & MACROBLOCK_PATTERN)
- {
- int coded_block_pattern;
- int DCT_offset, DCT_stride;
- int offset;
- uint8_t* dest_y;
-
- if(macroblock_modes & DCT_TYPE_INTERLACED)
- {
- DCT_offset = m_stride;
- DCT_stride = m_stride * 2;
- }
- else
- {
- DCT_offset = m_stride * 8;
- DCT_stride = m_stride;
- }
-
- coded_block_pattern = get_coded_block_pattern();
-
- offset = m_offset;
- dest_y = m_dest[0] + offset;
-
- if(coded_block_pattern & 0x20)
- slice_non_intra_DCT(dest_y, DCT_stride);
- if(coded_block_pattern & 0x10)
- slice_non_intra_DCT(dest_y + 8, DCT_stride);
- if(coded_block_pattern & 0x08)
- slice_non_intra_DCT(dest_y + DCT_offset, DCT_stride);
- if(coded_block_pattern & 0x04)
- slice_non_intra_DCT(dest_y + DCT_offset + 8, DCT_stride);
- if(coded_block_pattern & 0x2)
- slice_non_intra_DCT(m_dest[1] + (offset >> 1), m_uv_stride);
- if(coded_block_pattern & 0x1)
- slice_non_intra_DCT(m_dest[2] + (offset >> 1), m_uv_stride);
- }
-
- m_dc_dct_pred[0] =
- m_dc_dct_pred[1] =
- m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
- }
-
- NEXT_MACROBLOCK;
-
- NEEDBITS;
- mba_inc = 0;
- while(1)
- {
- if(bit_buf >= 0x10000000)
- {
- mba = MBA_5 + (UBITS(bit_buf, 5) - 2);
- break;
- }
- else if(bit_buf >= 0x03000000)
- {
- mba = MBA_11 + (UBITS(bit_buf, 11) - 24);
- break;
- }
- else
- {
- switch(UBITS(bit_buf, 11))
- {
- case 8: /* macroblock_escape */
- mba_inc += 33;
- /* pass through */
- case 15: /* macroblock_stuffing (MPEG1 only) */
- DUMPBITS(11);
- NEEDBITS;
- continue;
- default: /* end of slice, or error */
- return;
- }
- }
- }
-
- DUMPBITS(mba->len);
- mba_inc += mba->mba;
-
- if(mba_inc)
- {
- m_dc_dct_pred[0] =
- m_dc_dct_pred[1] =
- m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
-
- if(m_coding_type == P_TYPE)
- {
- m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
- m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
-
- do
- {
- MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
- NEXT_MACROBLOCK;
- }
- while(--mba_inc);
- }
- else
- {
- do
- {
- MOTION_CALL(motion_reuse, macroblock_modes);
- NEXT_MACROBLOCK;
- }
- while(--mba_inc);
- }
- }
- }
+ return;
+
+ while(1)
+ {
+ int macroblock_modes;
+ int mba_inc;
+ const MBAtab * mba;
+
+ NEEDBITS;
+
+ macroblock_modes = get_macroblock_modes();
+
+ /* maybe integrate MACROBLOCK_QUANT test into get_macroblock_modes ? */
+ if(macroblock_modes & MACROBLOCK_QUANT)
+ m_quantizer_scale = get_quantizer_scale();
+
+ if(macroblock_modes & MACROBLOCK_INTRA)
+ {
+ int DCT_offset, DCT_stride;
+ int offset;
+ uint8_t* dest_y;
+
+ if(m_concealment_motion_vectors)
+ {
+ if(m_picture_structure == FRAME_PICTURE) motion_fr_conceal();
+ else motion_fi_conceal();
+ }
+ else
+ {
+ m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
+ m_b_motion.pmv[0][0] = m_b_motion.pmv[0][1] = 0;
+ m_b_motion.pmv[1][0] = m_b_motion.pmv[1][1] = 0;
+ }
+
+ if(macroblock_modes & DCT_TYPE_INTERLACED)
+ {
+ DCT_offset = m_stride;
+ DCT_stride = m_stride * 2;
+ }
+ else
+ {
+ DCT_offset = m_stride * 8;
+ DCT_stride = m_stride;
+ }
+
+ offset = m_offset;
+ dest_y = m_dest[0] + offset;
+ slice_intra_DCT(0, dest_y, DCT_stride);
+ slice_intra_DCT(0, dest_y + 8, DCT_stride);
+ slice_intra_DCT(0, dest_y + DCT_offset, DCT_stride);
+ slice_intra_DCT(0, dest_y + DCT_offset + 8, DCT_stride);
+ slice_intra_DCT(1, m_dest[1] + (offset >> 1), m_uv_stride);
+ slice_intra_DCT (2, m_dest[2] + (offset >> 1), m_uv_stride);
+
+ if(m_coding_type == D_TYPE)
+ {
+ NEEDBITS;
+ DUMPBITS(1);
+ }
+ }
+ else
+ {
+ if(m_picture_structure == FRAME_PICTURE)
+ {
+ switch((macroblock_modes >> 6) & 3) // macroblock_modes & MOTION_TYPE_MASK
+ {
+ case 0:
+ // non-intra mb without forward mv in a P picture //
+ m_f_motion.pmv[0][0] = 0;
+ m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = 0;
+ m_f_motion.pmv[1][1] = 0;
+ MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ case 1: // MC_FIELD:
+ MOTION_CALL(motion_fr_field, macroblock_modes);
+ break;
+
+ case 2: // MC_FRAME:
+
+ if(m_mpeg1) MOTION_CALL(motion_mp1, macroblock_modes);
+ else MOTION_CALL (motion_fr_frame, macroblock_modes);
+ break;
+
+ case 3: // MC_DMV:
+ MOTION_CALL(motion_fr_dmv, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ default:
+ __assume(0);
+ }
+ }
+ else
+ {
+ switch((macroblock_modes >> 6) & 3) // macroblock_modes & MOTION_TYPE_MASK
+ {
+ case 0:
+ /* non-intra mb without forward mv in a P picture */
+ m_f_motion.pmv[0][0] = 0;
+ m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = 0;
+ m_f_motion.pmv[1][1] = 0;
+ MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ case 1: // MC_FIELD
+ MOTION_CALL(motion_fi_field, macroblock_modes);
+ break;
+
+ case 2: // MC_16X8
+ MOTION_CALL(motion_fi_16x8, macroblock_modes);
+ break;
+
+ case 3: // MC_DMV
+ MOTION_CALL(motion_fi_dmv, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ default:
+ __assume(0);
+ }
+ }
+
+ if(macroblock_modes & MACROBLOCK_PATTERN)
+ {
+ int coded_block_pattern;
+ int DCT_offset, DCT_stride;
+ int offset;
+ uint8_t* dest_y;
+
+ if(macroblock_modes & DCT_TYPE_INTERLACED)
+ {
+ DCT_offset = m_stride;
+ DCT_stride = m_stride * 2;
+ }
+ else
+ {
+ DCT_offset = m_stride * 8;
+ DCT_stride = m_stride;
+ }
+
+ coded_block_pattern = get_coded_block_pattern();
+
+ offset = m_offset;
+ dest_y = m_dest[0] + offset;
+
+ if(coded_block_pattern & 0x20)
+ slice_non_intra_DCT(dest_y, DCT_stride);
+ if(coded_block_pattern & 0x10)
+ slice_non_intra_DCT(dest_y + 8, DCT_stride);
+ if(coded_block_pattern & 0x08)
+ slice_non_intra_DCT(dest_y + DCT_offset, DCT_stride);
+ if(coded_block_pattern & 0x04)
+ slice_non_intra_DCT(dest_y + DCT_offset + 8, DCT_stride);
+ if(coded_block_pattern & 0x2)
+ slice_non_intra_DCT(m_dest[1] + (offset >> 1), m_uv_stride);
+ if(coded_block_pattern & 0x1)
+ slice_non_intra_DCT(m_dest[2] + (offset >> 1), m_uv_stride);
+ }
+
+ m_dc_dct_pred[0] =
+ m_dc_dct_pred[1] =
+ m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
+ }
+
+ NEXT_MACROBLOCK;
+
+ NEEDBITS;
+ mba_inc = 0;
+ while(1)
+ {
+ if(bit_buf >= 0x10000000)
+ {
+ mba = MBA_5 + (UBITS(bit_buf, 5) - 2);
+ break;
+ }
+ else if(bit_buf >= 0x03000000)
+ {
+ mba = MBA_11 + (UBITS(bit_buf, 11) - 24);
+ break;
+ }
+ else
+ {
+ switch(UBITS(bit_buf, 11))
+ {
+ case 8: /* macroblock_escape */
+ mba_inc += 33;
+ /* pass through */
+ case 15: /* macroblock_stuffing (MPEG1 only) */
+ DUMPBITS(11);
+ NEEDBITS;
+ continue;
+ default: /* end of slice, or error */
+ return;
+ }
+ }
+ }
+
+ DUMPBITS(mba->len);
+ mba_inc += mba->mba;
+
+ if(mba_inc)
+ {
+ m_dc_dct_pred[0] =
+ m_dc_dct_pred[1] =
+ m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
+
+ if(m_coding_type == P_TYPE)
+ {
+ m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
+
+ do {
+ MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
+ NEXT_MACROBLOCK;
+ } while(--mba_inc);
+ }
+ else
+ {
+ do {
+ MOTION_CALL (motion_reuse, macroblock_modes);
+ NEXT_MACROBLOCK;
+ } while(--mba_inc);
+ }
+ }
+ }
}
#undef bit_buf
@@ -3787,9 +3712,9 @@ void CMpeg2Decoder::mpeg2_slice(int code, const uint8_t* buffer)
CMpeg2Info::CMpeg2Info()
{
- m_sequence = NULL;
+ m_sequence = NULL;
m_gop = NULL;
- Reset();
+ Reset();
}
CMpeg2Info::~CMpeg2Info()
@@ -3802,6 +3727,6 @@ void CMpeg2Info::Reset()
m_display_picture = m_display_picture_2nd = NULL;
m_current_fbuf = m_display_fbuf = m_discard_fbuf = NULL;
m_user_data = NULL;
- m_user_data_len = 0;
+ m_user_data_len = 0;
}
diff --git a/src/filters/transform/Mpeg2DecFilter/libmpeg2.h b/src/filters/transform/Mpeg2DecFilter/libmpeg2.h
index ca97d23c8..ee64ca0c4 100644
--- a/src/filters/transform/Mpeg2DecFilter/libmpeg2.h
+++ b/src/filters/transform/Mpeg2DecFilter/libmpeg2.h
@@ -41,8 +41,7 @@
#define SEQ_VIDEO_FORMAT_MAC 0x80
#define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0
-typedef struct
-{
+typedef struct {
unsigned int width, height;
unsigned int chroma_width, chroma_height;
unsigned int byte_rate;
@@ -59,15 +58,14 @@ typedef struct
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
- void finalize();
+ void finalize();
} mpeg2_sequence_t;
#define GOP_FLAG_DROP_FRAME 1
#define GOP_FLAG_BROKEN_LINK 2
#define GOP_FLAG_CLOSED_GOP 4
-typedef struct
-{
+typedef struct {
uint8_t hours;
uint8_t minutes;
uint8_t seconds;
@@ -89,28 +87,24 @@ typedef struct
#define PIC_FLAG_REPEAT_FIRST_FIELD 256
#define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
-typedef struct
-{
+typedef struct {
unsigned int temporal_reference;
unsigned int nb_fields;
uint32_t pts;
uint32_t flags;
- struct
- {
- int x, y;
+ struct {
+ int x, y;
} display_offset[3];
- __int64 rtStart, rtStop;
- bool fDiscontinuity, fDelivered;
+ __int64 rtStart, rtStop;
+ bool fDiscontinuity, fDelivered;
} mpeg2_picture_t;
-typedef struct
-{
+typedef struct {
uint8_t* buf[3];
void* id;
} mpeg2_fbuf_t;
-typedef enum
-{
+typedef enum {
STATE_BUFFER = 0,
STATE_SEQUENCE = 1,
STATE_SEQUENCE_REPEATED = 2,
@@ -157,11 +151,7 @@ typedef enum
////////////////////////////////////////////////////////////////////////////////////////////////
typedef void mpeg2_mc_fct(uint8_t*, const uint8_t*, int, int);
-typedef struct
-{
- mpeg2_mc_fct* put[8];
- mpeg2_mc_fct* avg[8];
-} mpeg2_mc_t;
+typedef struct {mpeg2_mc_fct* put[8]; mpeg2_mc_fct* avg[8];} mpeg2_mc_t;
class CMpeg2Decoder
{
@@ -170,63 +160,62 @@ public:
/* The f_ and b_ correspond to the forward and backward motion */
/* predictors */
- struct motion_t
- {
- uint8_t* ref[2][3];
- uint8_t** ref2[2];
- int pmv[2][2];
- int f_code[2];
- } m_b_motion, m_f_motion;
+ struct motion_t {
+ uint8_t* ref[2][3];
+ uint8_t** ref2[2];
+ int pmv[2][2];
+ int f_code[2];
+ } m_b_motion, m_f_motion;
private:
- int get_macroblock_modes();
- int get_quantizer_scale();
- int get_motion_delta(const int f_code);
- int bound_motion_vector(const int vector, const int f_code);
- int get_dmv();
- int get_coded_block_pattern();
- int get_luma_dc_dct_diff();
- int get_chroma_dc_dct_diff();
-
- void get_intra_block_B14();
- void get_intra_block_B15();
- int get_non_intra_block();
- void get_mpeg1_intra_block();
- int get_mpeg1_non_intra_block();
- void slice_intra_DCT(const int cc, uint8_t* dest, int stride);
- void slice_non_intra_DCT(uint8_t* dest, int stride);
-
- void MOTION(mpeg2_mc_fct * const * const table, uint8_t** ref, int motion_x, int motion_y, unsigned int size, unsigned int y, unsigned int limit_y);
- void MOTION_FIELD(mpeg2_mc_fct * const * const table, uint8_t** ref, int motion_x, int motion_y, int dest_field, int src_field, unsigned int op);
-
- void motion_mp1(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_fr_frame(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_fr_field(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_fr_dmv(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_reuse(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_zero(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_fr_conceal();
- void motion_fi_field(motion_t * motion, mpeg2_mc_fct * const * const table);
- void motion_fi_16x8(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_fi_dmv(motion_t* motion, mpeg2_mc_fct * const * const table);
- void motion_fi_conceal();
-
- int slice_init(int code);
-
- static bool m_idct_initialized;
- void (*m_idct_init)();
- void (*m_idct_copy)(int16_t* block, uint8_t* dest, const int stride);
- void (*m_idct_add)(const int last, int16_t* block, uint8_t* dest, const int stride);
- mpeg2_mc_t* m_mc;
+ int get_macroblock_modes();
+ int get_quantizer_scale();
+ int get_motion_delta(const int f_code);
+ int bound_motion_vector(const int vector, const int f_code);
+ int get_dmv();
+ int get_coded_block_pattern();
+ int get_luma_dc_dct_diff();
+ int get_chroma_dc_dct_diff();
+
+ void get_intra_block_B14();
+ void get_intra_block_B15();
+ int get_non_intra_block();
+ void get_mpeg1_intra_block();
+ int get_mpeg1_non_intra_block();
+ void slice_intra_DCT(const int cc, uint8_t* dest, int stride);
+ void slice_non_intra_DCT(uint8_t* dest, int stride);
+
+ void MOTION(mpeg2_mc_fct * const * const table, uint8_t** ref, int motion_x, int motion_y, unsigned int size, unsigned int y, unsigned int limit_y);
+ void MOTION_FIELD(mpeg2_mc_fct * const * const table, uint8_t** ref, int motion_x, int motion_y, int dest_field, int src_field, unsigned int op);
+
+ void motion_mp1(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_frame(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_field(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_dmv(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_reuse(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_zero(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_conceal();
+ void motion_fi_field(motion_t * motion, mpeg2_mc_fct * const * const table);
+ void motion_fi_16x8(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fi_dmv(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fi_conceal();
+
+ int slice_init(int code);
+
+ static bool m_idct_initialized;
+ void (*m_idct_init)();
+ void (*m_idct_copy)(int16_t* block, uint8_t* dest, const int stride);
+ void (*m_idct_add)(const int last, int16_t* block, uint8_t* dest, const int stride);
+ mpeg2_mc_t* m_mc;
public:
- CMpeg2Decoder();
- virtual ~CMpeg2Decoder();
+ CMpeg2Decoder();
+ virtual ~CMpeg2Decoder();
- void mpeg2_init_fbuf(uint8_t* current_fbuf[3], uint8_t* forward_fbuf[3], uint8_t* backward_fbuf[3]);
- void mpeg2_slice(int code, const uint8_t* buffer);
+ void mpeg2_init_fbuf(uint8_t* current_fbuf[3], uint8_t* forward_fbuf[3], uint8_t* backward_fbuf[3]);
+ void mpeg2_slice(int code, const uint8_t* buffer);
- int16_t* m_DCTblock;
+ int16_t* m_DCTblock;
/* bit parsing stuff */
uint32_t m_bitstream_buf; /* current 32 bit working set */
@@ -292,12 +281,12 @@ public:
class CMpeg2Info
{
public:
- CMpeg2Info();
- virtual ~CMpeg2Info();
+ CMpeg2Info();
+ virtual ~CMpeg2Info();
- void Reset();
+ void Reset();
- mpeg2_sequence_t* m_sequence;
+ mpeg2_sequence_t* m_sequence;
mpeg2_gop_t* m_gop;
mpeg2_picture_t* m_current_picture;
mpeg2_picture_t* m_current_picture_2nd;
@@ -312,60 +301,60 @@ public:
class CMpeg2Dec
{
- int skip_chunk(int bytes);
- int copy_chunk(int bytes);
- mpeg2_state_t seek_chunk(), seek_header(), seek_sequence();
+ int skip_chunk(int bytes);
+ int copy_chunk(int bytes);
+ mpeg2_state_t seek_chunk(), seek_header(), seek_sequence();
- int sequence_ext();
- int sequence_display_ext();
- int quant_matrix_ext();
- int copyright_ext();
- int picture_display_ext();
- int picture_coding_ext();
+ int sequence_ext();
+ int sequence_display_ext();
+ int quant_matrix_ext();
+ int copyright_ext();
+ int picture_display_ext();
+ int picture_coding_ext();
public:
- CMpeg2Dec();
- virtual ~CMpeg2Dec();
+ CMpeg2Dec();
+ virtual ~CMpeg2Dec();
- void mpeg2_init();
- void mpeg2_close();
+ void mpeg2_init();
+ void mpeg2_close();
- void mpeg2_buffer(uint8_t* start, uint8_t* end);
- int mpeg2_getpos();
- mpeg2_state_t mpeg2_parse();
+ void mpeg2_buffer(uint8_t* start, uint8_t* end);
+ int mpeg2_getpos();
+ mpeg2_state_t mpeg2_parse();
- void mpeg2_skip(int skip);
- void mpeg2_slice_region(int start, int end);
+ void mpeg2_skip(int skip);
+ void mpeg2_slice_region(int start, int end);
- void mpeg2_pts(uint32_t pts);
+ void mpeg2_pts(uint32_t pts);
- /* decode.c */
- mpeg2_state_t mpeg2_seek_sequence();
- mpeg2_state_t mpeg2_parse_header();
+ /* decode.c */
+ mpeg2_state_t mpeg2_seek_sequence();
+ mpeg2_state_t mpeg2_parse_header();
- /* header.c */
- void mpeg2_header_state_init();
- int mpeg2_header_sequence();
- int mpeg2_header_gop();
- mpeg2_state_t mpeg2_header_picture_start();
- int mpeg2_header_picture();
- int mpeg2_header_extension();
- int mpeg2_header_user_data();
- void mpeg2_header_matrix_finalize();
- void mpeg2_header_sequence_finalize();
- mpeg2_state_t mpeg2_header_slice_start();
- mpeg2_state_t mpeg2_header_end();
- void mpeg2_set_fbuf(int coding_type);
+ /* header.c */
+ void mpeg2_header_state_init();
+ int mpeg2_header_sequence();
+ int mpeg2_header_gop();
+ mpeg2_state_t mpeg2_header_picture_start();
+ int mpeg2_header_picture();
+ int mpeg2_header_extension();
+ int mpeg2_header_user_data();
+ void mpeg2_header_matrix_finalize();
+ void mpeg2_header_sequence_finalize();
+ mpeg2_state_t mpeg2_header_slice_start();
+ mpeg2_state_t mpeg2_header_end();
+ void mpeg2_set_fbuf(int coding_type);
- enum {BUFFER_SIZE = 1194 * 1024};
+ enum {BUFFER_SIZE = 1194 * 1024};
- CMpeg2Decoder m_decoder;
+ CMpeg2Decoder m_decoder;
CMpeg2Info m_info;
uint32_t m_shift;
int m_is_display_initialized;
- mpeg2_state_t (CMpeg2Dec::* m_action)();
+ mpeg2_state_t (CMpeg2Dec::* m_action)();
mpeg2_state_t m_state;
uint32_t m_ext_state;
@@ -393,10 +382,9 @@ public:
mpeg2_gop_t m_gop;
mpeg2_picture_t m_pictures[4];
mpeg2_picture_t* m_picture;
- /*const*/
- mpeg2_fbuf_t* m_fbuf[3]; /* 0: current fbuf, 1-2: prediction fbufs */
+ /*const*/ mpeg2_fbuf_t* m_fbuf[3]; /* 0: current fbuf, 1-2: prediction fbufs */
- mpeg2_fbuf_t m_fbuf_alloc[3];
+ mpeg2_fbuf_t m_fbuf_alloc[3];
uint8_t* m_buf_start;
uint8_t* m_buf_end;
diff --git a/src/filters/transform/Mpeg2DecFilter/mc_sse2.cpp b/src/filters/transform/Mpeg2DecFilter/mc_sse2.cpp
index f01d2f9dd..3d5061bd0 100644
--- a/src/filters/transform/Mpeg2DecFilter/mc_sse2.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/mc_sse2.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -27,473 +27,463 @@
#include "attributes.h"
#include "../../../DSUtil/simd.h"
-static const __m128i const_1_16_bytes = _mm_set1_epi16(1);
+static const __m128i const_1_16_bytes=_mm_set1_epi16(1);
static void MC_put_o_16_sse2(uint8_t* ecx, const uint8_t* edx, const int eax, int esi)
{
- const int edi = eax + eax;
- const int ebx = edi + eax;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- __m128i xmm0, xmm1, xmm2, xmm3;
- movdqu(xmm0, edx);
- movdqu(xmm1, edx + eax);
- movdqu(xmm2, edx + edi);
- movdqu(xmm3, edx + ebx);
- movdqa(ecx, xmm0);
- movdqa(ecx + eax, xmm1);
- movdqa(ecx + edi, xmm2);
- movdqa(ecx + ebx, xmm3);
- }
+ const int edi= eax+eax;
+ const int ebx= edi+eax;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4){
+ __m128i xmm0,xmm1,xmm2,xmm3;
+ movdqu (xmm0, edx );
+ movdqu (xmm1, edx+eax);
+ movdqu (xmm2, edx+edi);
+ movdqu (xmm3, edx+ebx);
+ movdqa (ecx, xmm0 );
+ movdqa (ecx+eax, xmm1 );
+ movdqa (ecx+edi, xmm2 );
+ movdqa (ecx+ebx, xmm3 );
+ }
}
static void MC_put_o_8_sse2(uint8_t* ecx, const uint8_t* edx, const int eax, int esi)
{
- const int edi = eax + eax;
- const int ebx = edi + eax;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- __m128d xmm0, xmm1, xmm2, xmm3;
- movlpd(xmm0, edx);
- movlpd(xmm1, edx + eax);
- movlpd(xmm2, edx + edi);
- movlpd(xmm3, edx + ebx);
- movlpd(ecx, xmm0);
- movlpd(ecx + eax, xmm1);
- movlpd(ecx + edi, xmm2);
- movlpd(ecx + ebx, xmm3);
- }
+ const int edi= eax+eax;
+ const int ebx= edi+eax;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4){
+ __m128d xmm0,xmm1,xmm2,xmm3;
+ movlpd (xmm0, edx);
+ movlpd (xmm1, edx+eax);
+ movlpd (xmm2, edx+edi);
+ movlpd (xmm3, edx+ebx);
+ movlpd (ecx, xmm0);
+ movlpd (ecx+eax, xmm1 );
+ movlpd (ecx+edi, xmm2);
+ movlpd (ecx+ebx, xmm3 );
+ }
}
static void MC_put_x_16_sse2(uint8_t* ecx, const uint8_t* edx, const int eax, int esi)
{
- const int edi = eax + eax;
- const int ebx = edi + eax;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
- movdqu(xmm0, edx);
- movdqu(xmm1, edx + 1);
- movdqu(xmm2, edx + eax);
- movdqu(xmm3, edx + eax + 1);
- movdqu(xmm4, edx + edi);
- movdqu(xmm5, edx + edi + 1);
- movdqu(xmm6, edx + ebx);
- movdqu(xmm7, edx + ebx + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- pavgb(xmm4, xmm5);
- pavgb(xmm6, xmm7);
- movdqa(ecx, xmm0);
- movdqa(ecx + eax, xmm2);
- movdqa(ecx + edi, xmm4);
- movdqa(ecx + ebx, xmm6);
- }
+ const int edi= eax+eax;
+ const int ebx= edi+eax;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4){
+ __m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7;
+ movdqu (xmm0, edx);
+ movdqu (xmm1, edx+1);
+ movdqu (xmm2, edx+eax);
+ movdqu (xmm3, edx+eax+1);
+ movdqu (xmm4, edx+edi);
+ movdqu( xmm5, edx+edi+1);
+ movdqu( xmm6, edx+ebx );
+ movdqu( xmm7, edx+ebx+1 );
+ pavgb (xmm0, xmm1);
+ pavgb (xmm2, xmm3);
+ pavgb (xmm4, xmm5);
+ pavgb (xmm6, xmm7);
+ movdqa (ecx, xmm0);
+ movdqa (ecx+eax, xmm2);
+ movdqa (ecx+edi, xmm4);
+ movdqa (ecx+ebx, xmm6);
+ }
}
static void MC_put_x_8_sse2(uint8_t* ecx, const uint8_t* edx, const int eax, int esi)
{
- const int edi = eax + eax;
- const int ebx = edi + eax;
- __m128i xmm0, xmm1, xmm2, xmm3;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- movlpd(xmm0, edx);
- movlpd(xmm1, edx + 1);
- movhpd(xmm0, edx + eax);
- movhpd(xmm1, edx + eax + 1);
- movlpd(xmm2, edx + edi);
- movlpd(xmm3, edx + edi + 1);
- movhpd(xmm2, edx + ebx);
- movhpd(xmm3, edx + ebx + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- movlpd(ecx, xmm0);
- movhpd(ecx + eax, xmm0);
- movlpd(ecx + edi, xmm2);
- movhpd(ecx + ebx, xmm2);
- }
+ const int edi= eax+eax;
+ const int ebx= edi+eax;
+ __m128i xmm0,xmm1,xmm2,xmm3;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4){
+ movlpd (xmm0, edx);
+ movlpd (xmm1, edx+1);
+ movhpd (xmm0, edx+eax);
+ movhpd (xmm1, edx+eax+1);
+ movlpd (xmm2, edx+edi);
+ movlpd (xmm3, edx+edi+1);
+ movhpd (xmm2, edx+ebx);
+ movhpd (xmm3, edx+ebx+1);
+ pavgb (xmm0, xmm1);
+ pavgb (xmm2, xmm3);
+ movlpd (ecx, xmm0);
+ movhpd (ecx+eax, xmm0);
+ movlpd (ecx+edi, xmm2);
+ movhpd (ecx+ebx, xmm2);
+ }
}
static void MC_put_y_16_sse2(uint8_t* ecx, const uint8_t* edx, const int eax, int esi)
{
- const int edi = eax + eax;
- const int ebx = edi + eax;
- __m128i xmm0;
- movdqu(xmm0, edx);
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- __m128i xmm1, xmm2, xmm3, xmm4;
- movdqu(xmm1, edx + eax);
- movdqu(xmm2, edx + edi);
- movdqu(xmm3, edx + ebx);
- movdqu(xmm4, edx + edi * 2);
- pavgb(xmm0, xmm1);
- pavgb(xmm1, xmm2);
- pavgb(xmm2, xmm3);
- pavgb(xmm3, xmm4);
- movdqa(ecx, xmm0);
- movdqa(ecx + eax, xmm1);
- movdqa(ecx + edi, xmm2);
- movdqa(ecx + ebx, xmm3);
- movdqa(xmm0, xmm4);
- }
+ const int edi= eax+eax;
+ const int ebx= edi+eax;
+ __m128i xmm0;
+ movdqu (xmm0, edx);
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4){
+ __m128i xmm1,xmm2,xmm3,xmm4;
+ movdqu (xmm1, edx+eax);
+ movdqu (xmm2, edx+edi );
+ movdqu (xmm3, edx+ebx );
+ movdqu (xmm4, edx+edi*2 );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm1, xmm2 );
+ pavgb (xmm2, xmm3 );
+ pavgb (xmm3, xmm4 );
+ movdqa (ecx, xmm0 );
+ movdqa (ecx+eax, xmm1 );
+ movdqa (ecx+edi, xmm2 );
+ movdqa (ecx+ebx, xmm3 );
+ movdqa (xmm0, xmm4 );
+ }
}
static void MC_put_y_8_sse2(uint8_t* ecx, const uint8_t* edx, const int eax, int esi)
{
- const int edi = eax + eax;
- const int ebx = edi + eax;
- __m128i xmm0;
- movlpd(xmm0, edx);
+ const int edi= eax+eax;
+ const int ebx= edi+eax;
+ __m128i xmm0;
+ movlpd (xmm0, edx);
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- __m128i xmm1, xmm2, xmm3, xmm4;
- movlpd(xmm1, edx + eax);
- movlpd(xmm2, edx + edi);
- movlpd(xmm3, edx + ebx);
- movlpd(xmm4, edx + edi * 2);
- pavgb(xmm0, xmm1);
- pavgb(xmm1, xmm2);
- pavgb(xmm2, xmm3);
- pavgb(xmm3, xmm4);
- movlpd(ecx, xmm0);
- movlpd(ecx + eax, xmm1);
- movlpd(ecx + edi, xmm2);
- movlpd(ecx + ebx, xmm3);
- movdqa(xmm0, xmm4);
- }
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4){
+ __m128i xmm1,xmm2,xmm3,xmm4;
+ movlpd (xmm1, edx+eax );
+ movlpd (xmm2, edx+edi );
+ movlpd (xmm3, edx+ebx );
+ movlpd (xmm4, edx+edi*2 );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm1, xmm2);
+ pavgb (xmm2, xmm3 );
+ pavgb (xmm3, xmm4 );
+ movlpd (ecx, xmm0 );
+ movlpd (ecx+eax, xmm1 );
+ movlpd (ecx+edi, xmm2 );
+ movlpd (ecx+ebx, xmm3 );
+ movdqa (xmm0, xmm4 );
+ }
}
static void MC_put_xy_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref ;
- uint8_t *ecx = dest;
- int eax = stride;
- int esi = height;
- int edi = eax + eax;
- __m128i xmm7, xmm0, xmm1, xmm4, xmm5, xmm2, xmm3;
- movdqa(xmm7, const_1_16_bytes);
- movdqu(xmm0, edx);
- movdqu(xmm1, edx + 1);
- for(; esi; edx += edi, ecx += edi, esi -= 2)
- {
- movdqu(xmm2, edx + eax);
- movdqu(xmm3, edx + eax + 1);
- movdqu(xmm4, edx + edi);
- movdqu(xmm5, edx + edi + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- movdqa(xmm1, xmm5);
- pavgb(xmm5, xmm4);
- psubusb(xmm2, xmm7);
- pavgb(xmm0, xmm2);
- pavgb(xmm2, xmm5);
- movdqa(ecx, xmm0);
- movdqa(xmm0, xmm4);
- movdqa(ecx + eax, xmm2);
- }
+ const uint8_t *edx= ref ;
+ uint8_t *ecx= dest;
+ int eax= stride;
+ int esi= height;
+ int edi= eax+eax;
+ __m128i xmm7,xmm0,xmm1,xmm4,xmm5,xmm2,xmm3;
+ movdqa (xmm7, const_1_16_bytes );
+ movdqu (xmm0, edx );
+ movdqu (xmm1, edx+1 );
+ for (;esi;edx+= edi,ecx+= edi,esi-= 2)
+ {
+ movdqu (xmm2, edx+eax );
+ movdqu (xmm3, edx+eax+1 );
+ movdqu (xmm4, edx+edi );
+ movdqu (xmm5, edx+edi+1 );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm2, xmm3 );
+ movdqa( xmm1, xmm5 );
+ pavgb (xmm5, xmm4 );
+ psubusb( xmm2, xmm7 );
+ pavgb (xmm0, xmm2 );
+ pavgb (xmm2, xmm5);
+ movdqa (ecx, xmm0);
+ movdqa (xmm0, xmm4);
+ movdqa (ecx+eax, xmm2);
+ }
}
static void MC_put_xy_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int eax = stride;
- int esi = height;
- int edi = eax + eax;
- __m128i xmm7, xmm0, xmm2, xmm1, xmm3, xmm4, xmm5;
- movdqa(xmm7, const_1_16_bytes);
- movlpd(xmm0, edx);
- movlpd(xmm1, edx + 1);
- for(; esi; edx += edi, ecx += edi, esi -= 2)
- {
- movlpd(xmm2, edx + eax);
- movlpd(xmm3, edx + eax + 1);
- movlpd(xmm4, edx + edi);
- movlpd(xmm5, edx + edi + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- movdqa(xmm1, xmm5);
- pavgb(xmm5, xmm4);
- psubusb(xmm2, xmm7);
- pavgb(xmm0, xmm2);
- pavgb(xmm2, xmm5);
- movlpd(ecx, xmm0);
- movdqa(xmm0, xmm4);
- movlpd(ecx + eax, xmm2);
- }
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int eax= stride;
+ int esi= height;
+ int edi= eax+eax;
+ __m128i xmm7,xmm0,xmm2,xmm1,xmm3,xmm4,xmm5;
+ movdqa (xmm7, const_1_16_bytes);
+ movlpd (xmm0, edx);
+ movlpd (xmm1, edx+1);
+ for (;esi;edx+= edi,ecx+= edi,esi-= 2)
+ {
+ movlpd (xmm2, edx+eax);
+ movlpd (xmm3, edx+eax+1);
+ movlpd (xmm4, edx+edi);
+ movlpd (xmm5, edx+edi+1);
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm2, xmm3 );
+ movdqa( xmm1, xmm5 );
+ pavgb (xmm5, xmm4 );
+ psubusb( xmm2, xmm7 );
+ pavgb (xmm0, xmm2 );
+ pavgb (xmm2, xmm5);
+ movlpd (ecx, xmm0);
+ movdqa (xmm0, xmm4);
+ movlpd (ecx+eax, xmm2);
+ }
}
static void MC_avg_o_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- int ebx = edi + eax;
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ int ebx= edi+eax;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- __m128i xmm0, xmm1, xmm2, xmm3;
- movdqu(xmm0, edx);
- movdqu(xmm1, edx + eax);
- movdqu(xmm2, edx + edi);
- movdqu(xmm3, edx + ebx);
- pavgb(xmm0, ecx);
- pavgb(xmm1, ecx + eax);
- pavgb(xmm2, ecx + edi);
- pavgb(xmm3, ecx + ebx);
- movdqa(ecx, xmm0);
- movdqa(ecx + eax, xmm1);
- movdqa(ecx + edi, xmm2);
- movdqa(ecx + ebx, xmm3);
- }
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4)
+ {
+ __m128i xmm0,xmm1,xmm2,xmm3;
+ movdqu (xmm0, edx);
+ movdqu (xmm1, edx+eax );
+ movdqu (xmm2, edx+edi);
+ movdqu (xmm3, edx+ebx );
+ pavgb (xmm0, ecx);
+ pavgb (xmm1, ecx+eax);
+ pavgb (xmm2, ecx+edi);
+ pavgb (xmm3, ecx+ebx);
+ movdqa (ecx, xmm0);
+ movdqa (ecx+eax, xmm1 );
+ movdqa (ecx+edi, xmm2);
+ movdqa (ecx+ebx, xmm3 );
+ }
}
static void MC_avg_o_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- int ebx = edi + eax;
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ int ebx= edi+eax;
- __m128i xmm0, xmm1, xmm2, xmm3;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- movlpd(xmm0, edx);
- movhpd(xmm0, edx + eax);
- movlpd(xmm2, edx + edi);
- movhpd(xmm2, edx + ebx);
- movlpd(xmm1, ecx);
- movhpd(xmm1, ecx + eax);
- movlpd(xmm3, ecx + edi);
- movhpd(xmm3, ecx + ebx);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- movlpd(ecx, xmm0);
- movhpd(ecx + eax, xmm0);
- movlpd(ecx + edi, xmm2);
- movhpd(ecx + ebx, xmm2);
- }
+ __m128i xmm0,xmm1,xmm2,xmm3;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4)
+ {
+ movlpd (xmm0, edx);
+ movhpd (xmm0, edx+eax );
+ movlpd (xmm2, edx+edi);
+ movhpd (xmm2, edx+ebx );
+ movlpd (xmm1, ecx);
+ movhpd (xmm1, ecx+eax);
+ movlpd (xmm3, ecx+edi);
+ movhpd (xmm3, ecx+ebx);
+ pavgb (xmm0, xmm1);
+ pavgb (xmm2, xmm3);
+ movlpd (ecx, xmm0);
+ movhpd (ecx+eax, xmm0);
+ movlpd (ecx+edi, xmm2);
+ movhpd (ecx+ebx, xmm2);
+ }
}
static void MC_avg_x_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- int ebx = edi + eax;
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ int ebx= edi+eax;
- __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- movdqu(xmm0, edx);
- movdqu(xmm1, edx + 1);
- movdqu(xmm2, edx + eax);
- movdqu(xmm3, edx + eax + 1);
- movdqu(xmm4, edx + edi);
- movdqu(xmm5, edx + edi + 1);
- movdqu(xmm6, edx + ebx);
- movdqu(xmm7, edx + ebx + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- pavgb(xmm4, xmm5);
- pavgb(xmm6, xmm7);
- pavgb(xmm0, ecx);
- pavgb(xmm2, ecx + eax);
- pavgb(xmm4, ecx + edi);
- pavgb(xmm6, ecx + ebx);
- movdqa(ecx, xmm0);
- movdqa(ecx + eax, xmm2);
- movdqa(ecx + edi, xmm4);
- movdqa(ecx + ebx, xmm6);
- }
+ __m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4)
+ {
+ movdqu (xmm0, edx);
+ movdqu (xmm1, edx+1);
+ movdqu (xmm2, edx+eax);
+ movdqu (xmm3, edx+eax+1);
+ movdqu (xmm4, edx+edi);
+ movdqu (xmm5, edx+edi+1);
+ movdqu (xmm6, edx+ebx);
+ movdqu (xmm7, edx+ebx+1);
+ pavgb (xmm0, xmm1);
+ pavgb (xmm2, xmm3);
+ pavgb (xmm4, xmm5);
+ pavgb (xmm6, xmm7);
+ pavgb (xmm0, ecx);
+ pavgb (xmm2, ecx+eax);
+ pavgb (xmm4, ecx+edi);
+ pavgb (xmm6, ecx+ebx);
+ movdqa (ecx, xmm0);
+ movdqa (ecx+eax, xmm2);
+ movdqa (ecx+edi, xmm4);
+ movdqa (ecx+ebx, xmm6);
+ }
}
static void MC_avg_x_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- int ebx = edi + eax;
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ int ebx= edi+eax;
- __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5;
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- movlpd(xmm0, edx);
- movlpd(xmm1, edx + 1);
- movhpd(xmm0, edx + eax);
- movhpd(xmm1, edx + eax + 1);
- movlpd(xmm2, edx + edi);
- movlpd(xmm3, edx + edi + 1);
- movhpd(xmm2, edx + ebx);
- movhpd(xmm3, edx + ebx + 1);
- movlpd(xmm4, ecx);
- movhpd(xmm4, ecx + eax);
- movlpd(xmm5, ecx + edi);
- movhpd(xmm5, ecx + ebx);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- pavgb(xmm0, xmm4);
- pavgb(xmm2, xmm5);
- movlpd(ecx, xmm0);
- movhpd(ecx + eax, xmm0);
- movlpd(ecx + edi, xmm2);
- movhpd(ecx + ebx, xmm2);
- }
+ __m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5;
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4)
+ {
+ movlpd (xmm0, edx);
+ movlpd (xmm1, edx+1);
+ movhpd (xmm0, edx+eax);
+ movhpd (xmm1, edx+eax+1);
+ movlpd (xmm2, edx+edi);
+ movlpd (xmm3, edx+edi+1);
+ movhpd (xmm2, edx+ebx);
+ movhpd (xmm3, edx+ebx+1);
+ movlpd (xmm4, ecx);
+ movhpd (xmm4, ecx+eax);
+ movlpd (xmm5, ecx+edi);
+ movhpd (xmm5, ecx+ebx);
+ pavgb (xmm0, xmm1);
+ pavgb (xmm2, xmm3);
+ pavgb (xmm0, xmm4);
+ pavgb (xmm2, xmm5);
+ movlpd (ecx, xmm0);
+ movhpd (ecx+eax, xmm0);
+ movlpd (ecx+edi, xmm2);
+ movhpd (ecx+ebx, xmm2);
+ }
}
static void MC_avg_y_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- int ebx = edi + eax;
- __m128i xmm0, xmm1, xmm2, xmm3, xmm4;
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ int ebx= edi+eax;
+ __m128i xmm0,xmm1,xmm2,xmm3,xmm4;
- movdqu(xmm0, edx);
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- movdqu(xmm1, edx + eax);
- movdqu(xmm2, edx + edi);
- movdqu(xmm3, edx + ebx);
- movdqu(xmm4, edx + edi * 2);
- pavgb(xmm0, xmm1);
- pavgb(xmm1, xmm2);
- pavgb(xmm2, xmm3);
- pavgb(xmm3, xmm4);
- pavgb(xmm0, ecx);
- pavgb(xmm1, ecx + eax);
- pavgb(xmm2, ecx + edi);
- pavgb(xmm3, ecx + ebx);
- movdqa(ecx, xmm0);
- movdqa(ecx + eax, xmm1);
- movdqa(ecx + edi, xmm2);
- movdqa(ecx + ebx, xmm3);
- movdqa(xmm0, xmm4);
- }
+ movdqu (xmm0,edx);
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4)
+ {
+ movdqu (xmm1, edx+eax );
+ movdqu (xmm2, edx+edi );
+ movdqu (xmm3, edx+ebx );
+ movdqu (xmm4, edx+edi*2 );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm1, xmm2 );
+ pavgb (xmm2, xmm3 );
+ pavgb (xmm3, xmm4 );
+ pavgb (xmm0, ecx);
+ pavgb (xmm1, ecx+eax );
+ pavgb (xmm2, ecx+edi);
+ pavgb (xmm3, ecx+ebx );
+ movdqa (ecx, xmm0 );
+ movdqa (ecx+eax, xmm1 );
+ movdqa (ecx+edi, xmm2 );
+ movdqa (ecx+ebx, xmm3 );
+ movdqa (xmm0, xmm4 );
+ }
}
static void MC_avg_y_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- int ebx = edi + eax;
- __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5;
- movhpd(xmm0, edx);
- movlpd(xmm0, edx + eax);
- for(; esi; edx += edi * 2, ecx += edi * 2, esi -= 4)
- {
- movlhps(xmm1, xmm0);
- movlpd(xmm1, edx + edi);
- movlhps(xmm2, xmm1);
- movlpd(xmm2, edx + ebx);
- movlhps(xmm3, xmm2);
- movlpd(xmm3, edx + edi * 2);
- movhpd(xmm4, ecx);
- movlpd(xmm4, ecx + eax);
- movhpd(xmm5, ecx + edi);
- movlpd(xmm5, ecx + ebx);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- pavgb(xmm0, xmm4);
- pavgb(xmm2, xmm5);
- movhpd(ecx, xmm0);
- movlpd(ecx + eax, xmm0);
- movhpd(ecx + edi, xmm2);
- movlpd(ecx + ebx, xmm2);
- movdqa(xmm0, xmm3);
- }
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ int ebx= edi+eax;
+ __m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5;
+ movhpd (xmm0, edx );
+ movlpd (xmm0, edx+eax );
+ for (;esi;edx+=edi*2,ecx+=edi*2,esi-=4)
+ {
+ movlhps (xmm1, xmm0);
+ movlpd (xmm1, edx+edi );
+ movlhps (xmm2, xmm1);
+ movlpd (xmm2, edx+ebx );
+ movlhps (xmm3, xmm2);
+ movlpd (xmm3, edx+edi*2 );
+ movhpd (xmm4, ecx );
+ movlpd (xmm4, ecx+eax );
+ movhpd (xmm5, ecx+edi );
+ movlpd (xmm5, ecx+ebx );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm2, xmm3);
+ pavgb (xmm0, xmm4);
+ pavgb (xmm2, xmm5);
+ movhpd (ecx, xmm0 );
+ movlpd (ecx+eax, xmm0 );
+ movhpd (ecx+edi, xmm2 );
+ movlpd (ecx+ebx, xmm2);
+ movdqa (xmm0, xmm3 );
+ }
}
static void MC_avg_xy_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- __m128i xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5;
- movdqa(xmm7, const_1_16_bytes);
- movdqu(xmm0, edx);
- movdqu(xmm1, edx + 1);
- for(; esi; edx += edi, ecx += edi, esi -= 2)
- {
- movdqu(xmm2, edx + eax);
- movdqu(xmm3, edx + eax + 1);
- movdqu(xmm4, edx + edi);
- movdqu(xmm5, edx + edi + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- movdqa(xmm1, xmm5);
- pavgb(xmm5, xmm4);
- psubusb(xmm2, xmm7);
- pavgb(xmm0, xmm2);
- pavgb(xmm2, xmm5);
- pavgb(xmm0, ecx);
- pavgb(xmm2, ecx + eax);
- movdqa(ecx, xmm0);
- movdqa(xmm0, xmm4);
- movdqa(ecx + eax, xmm2);
- }
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ __m128i xmm7,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5;
+ movdqa (xmm7, const_1_16_bytes );
+ movdqu (xmm0, edx );
+ movdqu (xmm1, edx+1 );
+ for (;esi;edx+=edi,ecx+=edi,esi-=2)
+ {
+ movdqu (xmm2, edx+eax );
+ movdqu (xmm3, edx+eax+1 );
+ movdqu (xmm4, edx+edi );
+ movdqu (xmm5, edx+edi+1 );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm2, xmm3 );
+ movdqa (xmm1, xmm5 );
+ pavgb (xmm5, xmm4 );
+ psubusb (xmm2, xmm7 );
+ pavgb (xmm0, xmm2 );
+ pavgb (xmm2, xmm5);
+ pavgb (xmm0, ecx );
+ pavgb (xmm2, ecx+eax);
+ movdqa (ecx, xmm0);
+ movdqa (xmm0, xmm4);
+ movdqa (ecx+eax, xmm2);
+ }
}
static void MC_avg_xy_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
{
- const uint8_t *edx = ref;
- uint8_t *ecx = dest;
- int esi = height;
- int eax = stride;
- int edi = eax + eax;
- __m128i xmm7, xmm0, xmm2, xmm1, xmm3, xmm4;
- movdqa(xmm7, const_1_16_bytes);
- movhpd(xmm0, edx);
- movlpd(xmm0, edx + eax);
- movhpd(xmm2, edx + 1);
- movlpd(xmm2, edx + eax + 1);
- for(; esi; edx += edi, ecx += edi, esi -= 2)
- {
+ const uint8_t *edx= ref;
+ uint8_t *ecx= dest;
+ int esi= height;
+ int eax= stride;
+ int edi= eax+eax;
+ __m128i xmm7,xmm0,xmm2,xmm1,xmm3,xmm4;
+ movdqa (xmm7, const_1_16_bytes );
+ movhpd (xmm0, edx );
+ movlpd (xmm0, edx+eax );
+ movhpd (xmm2, edx+1 );
+ movlpd (xmm2, edx+eax+1 );
+ for (;esi;edx+=edi,ecx+=edi,esi-=2)
+ {
- movhpd(xmm1, edx + eax);
- movlpd(xmm1, edx + edi);
- movhpd(xmm3, edx + eax + 1);
- movlpd(xmm3, edx + edi + 1);
- pavgb(xmm0, xmm1);
- pavgb(xmm2, xmm3);
- psubusb(xmm0, xmm7);
- pavgb(xmm0, xmm2);
- movhpd(xmm4, ecx);
- movlpd(xmm4, ecx + eax);
- pavgb(xmm0, xmm4);
- movhpd(ecx, xmm0);
- movlpd(ecx + eax, xmm0);
- movdqa(xmm0, xmm1);
- movdqa(xmm2, xmm3);
- }
+ movhpd (xmm1, edx+eax );
+ movlpd (xmm1, edx+edi );
+ movhpd (xmm3, edx+eax+1 );
+ movlpd (xmm3, edx+edi+1 );
+ pavgb (xmm0, xmm1 );
+ pavgb (xmm2, xmm3 );
+ psubusb( xmm0, xmm7 );
+ pavgb (xmm0, xmm2 );
+ movhpd( xmm4, ecx);
+ movlpd( xmm4, ecx+eax);
+ pavgb (xmm0, xmm4 );
+ movhpd (ecx, xmm0 );
+ movlpd (ecx+eax, xmm0 );
+ movdqa (xmm0, xmm1 );
+ movdqa (xmm2, xmm3 );
+ }
}
mpeg2_mc_t mpeg2_mc_sse2 =
{
- {
- MC_put_o_16_sse2, MC_put_x_16_sse2, MC_put_y_16_sse2, MC_put_xy_16_sse2,
- MC_put_o_8_sse2, MC_put_x_8_sse2, MC_put_y_8_sse2, MC_put_xy_8_sse2
- },
- {
- MC_avg_o_16_sse2, MC_avg_x_16_sse2, MC_avg_y_16_sse2, MC_avg_xy_16_sse2,
- MC_avg_o_8_sse2, MC_avg_x_8_sse2, MC_avg_y_8_sse2, MC_avg_xy_8_sse2
- }
+ {MC_put_o_16_sse2, MC_put_x_16_sse2, MC_put_y_16_sse2, MC_put_xy_16_sse2,
+ MC_put_o_8_sse2, MC_put_x_8_sse2, MC_put_y_8_sse2, MC_put_xy_8_sse2},
+ {MC_avg_o_16_sse2, MC_avg_x_16_sse2, MC_avg_y_16_sse2, MC_avg_xy_16_sse2,
+ MC_avg_o_8_sse2, MC_avg_x_8_sse2, MC_avg_y_8_sse2, MC_avg_xy_8_sse2}
};
diff --git a/src/filters/transform/Mpeg2DecFilter/resource.h b/src/filters/transform/Mpeg2DecFilter/resource.h
index e6056a041..5050ae86a 100644
--- a/src/filters/transform/Mpeg2DecFilter/resource.h
+++ b/src/filters/transform/Mpeg2DecFilter/resource.h
@@ -15,7 +15,7 @@
#define IDS_MPEG2DECSETTINGSWND_8 33160
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
diff --git a/src/filters/transform/Mpeg2DecFilter/stdafx.cpp b/src/filters/transform/Mpeg2DecFilter/stdafx.cpp
index 5899c1666..4b29d63b8 100644
--- a/src/filters/transform/Mpeg2DecFilter/stdafx.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/Mpeg2DecFilter/stdafx.h b/src/filters/transform/Mpeg2DecFilter/stdafx.h
index c202d2a46..d4cb512b1 100644
--- a/src/filters/transform/Mpeg2DecFilter/stdafx.h
+++ b/src/filters/transform/Mpeg2DecFilter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/vsfilter/Copy.cpp b/src/filters/transform/vsfilter/Copy.cpp
index 7dd769bf0..27153a3bf 100644
--- a/src/filters/transform/vsfilter/Copy.cpp
+++ b/src/filters/transform/vsfilter/Copy.cpp
@@ -32,84 +32,84 @@ extern void ColorConvInit();
void BltLineRGB32(DWORD* d, BYTE* sub, int w, const GUID& subtype)
{
- if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
- {
- BYTE* db = (BYTE*)d;
- BYTE* dbtend = db + w;
-
- for(; db < dbtend; sub += 4, db++)
- {
- if(sub[3] < 0xff)
- {
- int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
- *db = y; // w/o colors
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_YUY2)
- {
- WORD* ds = (WORD*)d;
- WORD* dstend = ds + w;
-
- for(; ds < dstend; sub += 4, ds++)
- {
- if(sub[3] < 0xff)
- {
- int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
- *ds = 0x8000 | y; // w/o colors
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_RGB555)
- {
- WORD* ds = (WORD*)d;
- WORD* dstend = ds + w;
-
- for(; ds < dstend; sub += 4, ds++)
- {
- if(sub[3] < 0xff)
- {
- *ds = ((*((DWORD*)sub) >> 9) & 0x7c00) | ((*((DWORD*)sub) >> 6) & 0x03e0) | ((*((DWORD*)sub) >> 3) & 0x001f);
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_RGB565)
- {
- WORD* ds = (WORD*)d;
- WORD* dstend = ds + w;
-
- for(; ds < dstend; sub += 4, ds++)
- {
- if(sub[3] < 0xff)
- {
- *ds = ((*((DWORD*)sub) >> 8) & 0xf800) | ((*((DWORD*)sub) >> 5) & 0x07e0) | ((*((DWORD*)sub) >> 3) & 0x001f);
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_RGB24)
- {
- BYTE* dt = (BYTE*)d;
- BYTE* dstend = dt + w * 3;
-
- for(; dt < dstend; sub += 4, dt += 3)
- {
- if(sub[3] < 0xff)
- {
- dt[0] = sub[0];
- dt[1] = sub[1];
- dt[2] = sub[2];
- }
- }
- }
- else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32)
- {
- DWORD* dstend = d + w;
-
- for(; d < dstend; sub += 4, d++)
- {
- if(sub[3] < 0xff) *d = *((DWORD*)sub) & 0xffffff;
- }
- }
+ if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
+ {
+ BYTE* db = (BYTE*)d;
+ BYTE* dbtend = db + w;
+
+ for(; db < dbtend; sub+=4, db++)
+ {
+ if(sub[3] < 0xff)
+ {
+ int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
+ *db = y; // w/o colors
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_YUY2)
+ {
+ WORD* ds = (WORD*)d;
+ WORD* dstend = ds + w;
+
+ for(; ds < dstend; sub+=4, ds++)
+ {
+ if(sub[3] < 0xff)
+ {
+ int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
+ *ds = 0x8000|y; // w/o colors
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB555)
+ {
+ WORD* ds = (WORD*)d;
+ WORD* dstend = ds + w;
+
+ for(; ds < dstend; sub+=4, ds++)
+ {
+ if(sub[3] < 0xff)
+ {
+ *ds = ((*((DWORD*)sub)>>9)&0x7c00)|((*((DWORD*)sub)>>6)&0x03e0)|((*((DWORD*)sub)>>3)&0x001f);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB565)
+ {
+ WORD* ds = (WORD*)d;
+ WORD* dstend = ds + w;
+
+ for(; ds < dstend; sub+=4, ds++)
+ {
+ if(sub[3] < 0xff)
+ {
+ *ds = ((*((DWORD*)sub)>>8)&0xf800)|((*((DWORD*)sub)>>5)&0x07e0)|((*((DWORD*)sub)>>3)&0x001f);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB24)
+ {
+ BYTE* dt = (BYTE*)d;
+ BYTE* dstend = dt + w*3;
+
+ for(; dt < dstend; sub+=4, dt+=3)
+ {
+ if(sub[3] < 0xff)
+ {
+ dt[0] = sub[0];
+ dt[1] = sub[1];
+ dt[2] = sub[2];
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32)
+ {
+ DWORD* dstend = d + w;
+
+ for(; d < dstend; sub+=4, d++)
+ {
+ if(sub[3] < 0xff) *d = *((DWORD*)sub)&0xffffff;
+ }
+ }
}
#ifdef WIN64
@@ -121,536 +121,536 @@ void BltLineRGB32(DWORD* d, BYTE* sub, int w, const GUID& subtype)
void Scale2x(const GUID& subtype, BYTE* d, int dpitch, BYTE* s, int spitch, int w, int h)
{
#ifdef WIN64
- // CPUID from VDub
- bool fSSE2 = !!(g_cpuid.m_flags & CCpuID::sse2);
+ // CPUID from VDub
+ bool fSSE2 = !!(g_cpuid.m_flags & CCpuID::sse2);
#endif
- if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
- {
- BYTE* s1;
- BYTE* s2;
- BYTE* d1;
-
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
- {
- BYTE* stmp = s1 + spitch;
- BYTE* dtmp = d1 + dpitch;
-
- for(BYTE* s3 = s1 + (w - 1); s1 < s3; s1 += 1, d1 += 2)
- {
- d1[0] = s1[0];
- d1[1] = (s1[0] + s1[1]) >> 1;
- }
-
- d1[0] = d1[1] = s1[0];
-
- s1 += 1;
- d1 += 2;
-
- s1 = stmp;
- d1 = dtmp;
- }
-
- AvgLines8(d, h * 2, dpitch);
- }
- else if(subtype == MEDIASUBTYPE_YUY2)
- {
- unsigned __int64 __0xffffffff00000000 = 0xffffffff00000000;
- unsigned __int64 __0x00000000ffffffff = 0x00000000ffffffff;
- unsigned __int64 __0x00ff00ff00ff00ff = 0x00ff00ff00ff00ff;
-
- BYTE* s1;
- BYTE* s2;
- BYTE* d1;
-
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch)
- {
- BYTE* stmp = s1 + spitch;
- BYTE* dtmp = d1 + dpitch;
-
- // row0, 4 pixels: y1|u1|y2|v1|y3|u2|y4|v2
- // ->
- // row0, 8 pixels: y1|u1|(y1+y2)/2|v1|y2|(u1+u2)/2|(y2+y3)/2|(v1+v2)/2
+ if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1); s1 < s3; s1 += 1, d1 += 2)
+ {
+ d1[0] = s1[0];
+ d1[1] = (s1[0]+s1[1])>>1;
+ }
+
+ d1[0] = d1[1] = s1[0];
+
+ s1 += 1;
+ d1 += 2;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_YUY2)
+ {
+ unsigned __int64 __0xffffffff00000000 = 0xffffffff00000000;
+ unsigned __int64 __0x00000000ffffffff = 0x00000000ffffffff;
+ unsigned __int64 __0x00ff00ff00ff00ff = 0x00ff00ff00ff00ff;
+
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch)
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ // row0, 4 pixels: y1|u1|y2|v1|y3|u2|y4|v2
+ // ->
+ // row0, 8 pixels: y1|u1|(y1+y2)/2|v1|y2|(u1+u2)/2|(y2+y3)/2|(v1+v2)/2
#ifdef WIN64
- if(fSSE2)
- {
- __m128i mm4 = _mm_cvtsi64_si128(__0x00ff00ff00ff00ff);
- __m128i mm5 = _mm_cvtsi64_si128(__0x00000000ffffffff);
- __m128i mm6 = _mm_cvtsi64_si128(__0xffffffff00000000);
- for(BYTE* s3 = s1 + ((w >> 1) - 1) * 4; s1 < s3; s1 += 4, d1 += 8)
- {
- __m128i mm0 = _mm_cvtsi64_si128(*(size_t*)s1); //movq mm0, [esi]
- __m128i mm2 = _mm_move_epi64(mm0); //movq mm2, mm0
- mm0 = _mm_and_si128(mm0, mm4); //pand mm0, mm4 // mm0 = 00y400y300y200y1
- mm2 = _mm_srli_epi16(mm2, 8); //psrlw mm2, 8 // mm2 = 00u200v200u100v1
- __m128i mm1 = _mm_move_epi64(mm0); //movq mm1, mm0
- mm0 = _mm_and_si128(mm0, mm5); //pand mm0, mm5 // mm0 = 0000000000y200y1
- mm1 = _mm_slli_epi64(mm1, 16); //psllq mm1, 16
- mm1 = _mm_and_si128(mm1, mm6); //pand mm1, mm6 // mm1 = 00y300y200000000
- mm1 = _mm_or_si128(mm1, mm0); //por mm1, mm0 // mm1 = 00y300y200y200y1
- mm0 = _mm_unpacklo_epi8(mm0, mm0); //punpcklwd mm0, mm0 // mm0 = 00y200y200y100y1
- mm0 = _mm_adds_epi16(mm0, mm1); //paddw mm0, mm1
- mm0 = _mm_srli_epi16(mm0, 1); //psrlw mm0, 1 // mm0 = (mm0 + mm1) / 2
- mm1 = _mm_move_epi64(mm2); //movq mm1, mm2
- mm1 = _mm_unpacklo_epi32(mm1, mm1); //punpckldq mm1, mm1 // mm1 = 00u100v100u100v1
- mm1 = _mm_adds_epi16(mm1, mm2); //paddw mm1, mm2
- mm1 = _mm_srli_epi16(mm1, 1); //psrlw mm1, 1 // mm1 = (mm1 + mm2) / 2
- mm1 = _mm_slli_epi64(mm1, 8); //psllw mm1, 8
- mm1 = _mm_or_si128(mm0, mm1); //por mm0, mm1 // mm0 = (v1+v2)/2|(y2+y3)/2|(u1+u2)/2|y2|v1|(y1+y2)/2|u1|y1
- *(size_t*)d1 = (size_t)_mm_cvtsi128_si64(mm0); //movq [edi], mm0
- }
- }
- else
- {
- for(BYTE* s3 = s1 + ((w >> 1) - 1) * 4; s1 < s3; s1 += 4, d1 += 8)
- {
- d1[0] = s1[0];
- d1[1] = s1[1];
- d1[2] = (s1[0] + s1[2]) >> 1;
- d1[3] = s1[3];
-
- d1[4] = s1[2];
- d1[5] = (s1[1] + s1[5]) >> 1;
- d1[6] = (s1[2] + s1[4]) >> 1;
- d1[7] = (s1[3] + s1[7]) >> 1;
- }
- }
+ if(fSSE2)
+ {
+ __m128i mm4 = _mm_cvtsi64_si128(__0x00ff00ff00ff00ff);
+ __m128i mm5 = _mm_cvtsi64_si128(__0x00000000ffffffff);
+ __m128i mm6 = _mm_cvtsi64_si128(__0xffffffff00000000);
+ for(BYTE* s3 = s1 + ((w>>1)-1)*4; s1 < s3; s1 += 4, d1 += 8)
+ {
+ __m128i mm0 = _mm_cvtsi64_si128(*(size_t*)s1); //movq mm0, [esi]
+ __m128i mm2 = _mm_move_epi64(mm0); //movq mm2, mm0
+ mm0 = _mm_and_si128(mm0, mm4); //pand mm0, mm4 // mm0 = 00y400y300y200y1
+ mm2 = _mm_srli_epi16(mm2, 8); //psrlw mm2, 8 // mm2 = 00u200v200u100v1
+ __m128i mm1 = _mm_move_epi64(mm0); //movq mm1, mm0
+ mm0 = _mm_and_si128(mm0, mm5); //pand mm0, mm5 // mm0 = 0000000000y200y1
+ mm1 = _mm_slli_epi64(mm1, 16); //psllq mm1, 16
+ mm1 = _mm_and_si128(mm1, mm6); //pand mm1, mm6 // mm1 = 00y300y200000000
+ mm1 = _mm_or_si128(mm1, mm0); //por mm1, mm0 // mm1 = 00y300y200y200y1
+ mm0 = _mm_unpacklo_epi8(mm0, mm0); //punpcklwd mm0, mm0 // mm0 = 00y200y200y100y1
+ mm0 = _mm_adds_epi16(mm0,mm1); //paddw mm0, mm1
+ mm0 = _mm_srli_epi16(mm0, 1); //psrlw mm0, 1 // mm0 = (mm0 + mm1) / 2
+ mm1 = _mm_move_epi64(mm2); //movq mm1, mm2
+ mm1 = _mm_unpacklo_epi32(mm1, mm1); //punpckldq mm1, mm1 // mm1 = 00u100v100u100v1
+ mm1 = _mm_adds_epi16(mm1,mm2); //paddw mm1, mm2
+ mm1 = _mm_srli_epi16(mm1, 1); //psrlw mm1, 1 // mm1 = (mm1 + mm2) / 2
+ mm1 = _mm_slli_epi64(mm1, 8); //psllw mm1, 8
+ mm1 = _mm_or_si128(mm0, mm1); //por mm0, mm1 // mm0 = (v1+v2)/2|(y2+y3)/2|(u1+u2)/2|y2|v1|(y1+y2)/2|u1|y1
+ *(size_t*)d1 = (size_t)_mm_cvtsi128_si64(mm0); //movq [edi], mm0
+ }
+ }
+ else
+ {
+ for(BYTE* s3 = s1 + ((w>>1)-1)*4; s1 < s3; s1 += 4, d1 += 8)
+ {
+ d1[0] = s1[0];
+ d1[1] = s1[1];
+ d1[2] = (s1[0]+s1[2])>>1;
+ d1[3] = s1[3];
+
+ d1[4] = s1[2];
+ d1[5] = (s1[1]+s1[5])>>1;
+ d1[6] = (s1[2]+s1[4])>>1;
+ d1[7] = (s1[3]+s1[7])>>1;
+ }
+ }
#else
- __asm
- {
- mov esi, s1
- mov edi, d1
+ __asm
+ {
+ mov esi, s1
+ mov edi, d1
- mov ecx, w
- shr ecx, 1
- dec ecx
+ mov ecx, w
+ shr ecx, 1
+ dec ecx
- movq mm4, __0x00ff00ff00ff00ff
- movq mm5, __0x00000000ffffffff
- movq mm6, __0xffffffff00000000
- row_loop1:
- movq mm0, [esi]
- movq mm2, mm0
+ movq mm4, __0x00ff00ff00ff00ff
+ movq mm5, __0x00000000ffffffff
+ movq mm6, __0xffffffff00000000
+row_loop1:
+ movq mm0, [esi]
+ movq mm2, mm0
- pand mm0, mm4 // mm0 = 00y400y300y200y1
- psrlw mm2, 8 // mm2 = 00u200v200u100v1
+ pand mm0, mm4 // mm0 = 00y400y300y200y1
+ psrlw mm2, 8 // mm2 = 00u200v200u100v1
- movq mm1, mm0
+ movq mm1, mm0
- pand mm0, mm5 // mm0 = 0000000000y200y1
+ pand mm0, mm5 // mm0 = 0000000000y200y1
- psllq mm1, 16
- pand mm1, mm6 // mm1 = 00y300y200000000
+ psllq mm1, 16
+ pand mm1, mm6 // mm1 = 00y300y200000000
- por mm1, mm0 // mm1 = 00y300y200y200y1
+ por mm1, mm0 // mm1 = 00y300y200y200y1
- punpcklwd mm0, mm0 // mm0 = 00y200y200y100y1
+ punpcklwd mm0, mm0 // mm0 = 00y200y200y100y1
- paddw mm0, mm1
- psrlw mm0, 1 // mm0 = (mm0 + mm1) / 2
+ paddw mm0, mm1
+ psrlw mm0, 1 // mm0 = (mm0 + mm1) / 2
- movq mm1, mm2
- punpckldq mm1, mm1 // mm1 = 00u100v100u100v1
+ movq mm1, mm2
+ punpckldq mm1, mm1 // mm1 = 00u100v100u100v1
- paddw mm1, mm2
- psrlw mm1, 1 // mm1 = (mm1 + mm2) / 2
+ paddw mm1, mm2
+ psrlw mm1, 1 // mm1 = (mm1 + mm2) / 2
- psllw mm1, 8
- por mm0, mm1 // mm0 = (v1+v2)/2|(y2+y3)/2|(u1+u2)/2|y2|v1|(y1+y2)/2|u1|y1
+ psllw mm1, 8
+ por mm0, mm1 // mm0 = (v1+v2)/2|(y2+y3)/2|(u1+u2)/2|y2|v1|(y1+y2)/2|u1|y1
- movq [edi], mm0
+ movq [edi], mm0
- lea esi, [esi+4]
- lea edi, [edi+8]
+ lea esi, [esi+4]
+ lea edi, [edi+8]
- dec ecx
- jnz row_loop1
+ dec ecx
+ jnz row_loop1
- mov s1, esi
- mov d1, edi
- };
+ mov s1, esi
+ mov d1, edi
+ };
#endif
- *d1++ = s1[0];
- *d1++ = s1[1];
- *d1++ = (s1[0] + s1[2]) >> 1;
- *d1++ = s1[3];
-
- *d1++ = s1[2];
- *d1++ = s1[1];
- *d1++ = s1[2];
- *d1++ = s1[3];
-
- s1 += 4;
-
- s1 = stmp;
- d1 = dtmp;
- }
-
- AvgLines8(d, h * 2, dpitch);
- }
- else if(subtype == MEDIASUBTYPE_RGB555)
- {
- BYTE* s1;
- BYTE* s2;
- BYTE* d1;
-
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
- {
- BYTE* stmp = s1 + spitch;
- BYTE* dtmp = d1 + dpitch;
-
- for(BYTE* s3 = s1 + (w - 1) * 2; s1 < s3; s1 += 2, d1 += 4)
- {
- *((WORD*)d1) = *((WORD*)s1);
- *((WORD*)d1 + 1) =
- ((((*((WORD*)s1) & 0x7c00) + (*((WORD*)s1 + 1) & 0x7c00)) >> 1) & 0x7c00) |
- ((((*((WORD*)s1) & 0x03e0) + (*((WORD*)s1 + 1) & 0x03e0)) >> 1) & 0x03e0) |
- ((((*((WORD*)s1) & 0x001f) + (*((WORD*)s1 + 1) & 0x001f)) >> 1) & 0x001f);
- }
-
- *((WORD*)d1) = *((WORD*)s1);
- *((WORD*)d1 + 1) = *((WORD*)s1);
-
- s1 += 2;
- d1 += 4;
-
- s1 = stmp;
- d1 = dtmp;
- }
-
- AvgLines555(d, h * 2, dpitch);
- }
- else if(subtype == MEDIASUBTYPE_RGB565)
- {
- BYTE* s1;
- BYTE* s2;
- BYTE* d1;
-
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
- {
- BYTE* stmp = s1 + spitch;
- BYTE* dtmp = d1 + dpitch;
-
- for(BYTE* s3 = s1 + (w - 1) * 2; s1 < s3; s1 += 2, d1 += 4)
- {
- *((WORD*)d1) = *((WORD*)s1);
- *((WORD*)d1 + 1) =
- ((((*((WORD*)s1) & 0xf800) + (*((WORD*)s1 + 1) & 0xf800)) >> 1) & 0xf800) |
- ((((*((WORD*)s1) & 0x07e0) + (*((WORD*)s1 + 1) & 0x07e0)) >> 1) & 0x07e0) |
- ((((*((WORD*)s1) & 0x001f) + (*((WORD*)s1 + 1) & 0x001f)) >> 1) & 0x001f);
- }
-
- *((WORD*)d1) = *((WORD*)s1);
- *((WORD*)d1 + 1) = *((WORD*)s1);
-
- s1 += 2;
- d1 += 4;
-
- s1 = stmp;
- d1 = dtmp;
- }
-
- AvgLines565(d, h * 2, dpitch);
- }
- else if(subtype == MEDIASUBTYPE_RGB24)
- {
- BYTE* s1;
- BYTE* s2;
- BYTE* d1;
-
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
- {
- BYTE* stmp = s1 + spitch;
- BYTE* dtmp = d1 + dpitch;
-
- for(BYTE* s3 = s1 + (w - 1) * 3; s1 < s3; s1 += 3, d1 += 6)
- {
- d1[0] = s1[0];
- d1[1] = s1[1];
- d1[2] = s1[2];
- d1[3] = (s1[0] + s1[3]) >> 1;
- d1[4] = (s1[1] + s1[4]) >> 1;
- d1[5] = (s1[2] + s1[5]) >> 1;
- }
-
- d1[0] = d1[3] = s1[0];
- d1[1] = d1[4] = s1[1];
- d1[2] = d1[5] = s1[2];
-
- s1 += 3;
- d1 += 6;
-
- s1 = stmp;
- d1 = dtmp;
- }
-
- AvgLines8(d, h * 2, dpitch);
- }
- else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32)
- {
- BYTE* s1;
- BYTE* s2;
- BYTE* d1;
-
- for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch)
- {
- BYTE* stmp = s1 + spitch;
- BYTE* dtmp = d1 + dpitch;
+ *d1++ = s1[0];
+ *d1++ = s1[1];
+ *d1++ =(s1[0]+s1[2])>>1;
+ *d1++ = s1[3];
+
+ *d1++ = s1[2];
+ *d1++ = s1[1];
+ *d1++ = s1[2];
+ *d1++ = s1[3];
+
+ s1 += 4;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB555)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4)
+ {
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) =
+ ((((*((WORD*)s1)&0x7c00) + (*((WORD*)s1+1)&0x7c00)) >> 1)&0x7c00)|
+ ((((*((WORD*)s1)&0x03e0) + (*((WORD*)s1+1)&0x03e0)) >> 1)&0x03e0)|
+ ((((*((WORD*)s1)&0x001f) + (*((WORD*)s1+1)&0x001f)) >> 1)&0x001f);
+ }
+
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) = *((WORD*)s1);
+
+ s1 += 2;
+ d1 += 4;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines555(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB565)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4)
+ {
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) =
+ ((((*((WORD*)s1)&0xf800) + (*((WORD*)s1+1)&0xf800)) >> 1)&0xf800)|
+ ((((*((WORD*)s1)&0x07e0) + (*((WORD*)s1+1)&0x07e0)) >> 1)&0x07e0)|
+ ((((*((WORD*)s1)&0x001f) + (*((WORD*)s1+1)&0x001f)) >> 1)&0x001f);
+ }
+
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) = *((WORD*)s1);
+
+ s1 += 2;
+ d1 += 4;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines565(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB24)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1)*3; s1 < s3; s1 += 3, d1 += 6)
+ {
+ d1[0] = s1[0];
+ d1[1] = s1[1];
+ d1[2] = s1[2];
+ d1[3] = (s1[0]+s1[3])>>1;
+ d1[4] = (s1[1]+s1[4])>>1;
+ d1[5] = (s1[2]+s1[5])>>1;
+ }
+
+ d1[0] = d1[3] = s1[0];
+ d1[1] = d1[4] = s1[1];
+ d1[2] = d1[5] = s1[2];
+
+ s1 += 3;
+ d1 += 6;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch)
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
#ifdef WIN64
- if(fSSE2) // SSE2 code
- {
- __m128i mm_zero = _mm_setzero_si128();//pxor mm0, mm0
- for(BYTE* s3 = s1 + (w - 1) * 4; s1 < s3; s1 += 4, d1 += 8)
- {
-
- __m128i mm1 = _mm_cvtsi64_si128(*(size_t*)s1); //movq mm1, [esi]
- __m128i mm2 = _mm_move_epi64(mm1); //movq mm2, mm1
-
- mm1 = _mm_unpacklo_epi8(mm1, mm_zero); //punpcklbw mm1, mm0 // mm1 = 00xx00r100g100b1
- mm2 = _mm_unpacklo_epi8(mm2, mm_zero); //punpckhbw mm2, mm0 // mm2 = 00xx00r200g200b2
-
- mm2 = _mm_adds_epi16(mm2, mm1); //paddw mm2, mm1
- mm2 = _mm_srli_epi16(mm2, 1); //psrlw mm2, 1 // mm2 = (mm1 + mm2) / 2
-
- mm1 = _mm_packus_epi16(mm1, mm2); //packuswb mm1, mm2
-
- *(size_t*)d1 = (size_t)_mm_cvtsi128_si64(mm1); //movq [edi], mm1
- }
- }
- else
- {
- for(BYTE* s3 = s1 + (w - 1) * 4; s1 < s3; s1 += 3, d1 += 6)
- {
- d1[0] = s1[0];
- d1[1] = s1[1];
- d1[2] = s1[2];
- d1[3] = s1[3];
-
- d1[4] = (s1[0] + s1[4]) >> 1;
- d1[5] = (s1[1] + s1[5]) >> 1;
- d1[6] = (s1[2] + s1[6]) >> 1;
- d1[7] = (s1[4] + s1[7]) >> 1;
- }
- }
+ if(fSSE2) // SSE2 code
+ {
+ __m128i mm_zero = _mm_setzero_si128();//pxor mm0, mm0
+ for(BYTE* s3 = s1 + (w-1)*4; s1 < s3; s1 += 4, d1 += 8)
+ {
+
+ __m128i mm1 = _mm_cvtsi64_si128(*(size_t*)s1); //movq mm1, [esi]
+ __m128i mm2 = _mm_move_epi64(mm1); //movq mm2, mm1
+
+ mm1 = _mm_unpacklo_epi8(mm1,mm_zero);//punpcklbw mm1, mm0 // mm1 = 00xx00r100g100b1
+ mm2 = _mm_unpacklo_epi8(mm2,mm_zero);//punpckhbw mm2, mm0 // mm2 = 00xx00r200g200b2
+
+ mm2 = _mm_adds_epi16(mm2,mm1); //paddw mm2, mm1
+ mm2 = _mm_srli_epi16(mm2, 1); //psrlw mm2, 1 // mm2 = (mm1 + mm2) / 2
+
+ mm1 = _mm_packus_epi16(mm1,mm2); //packuswb mm1, mm2
+
+ *(size_t*)d1=(size_t)_mm_cvtsi128_si64(mm1);//movq [edi], mm1
+ }
+ }
+ else
+ {
+ for(BYTE* s3 = s1 + (w-1)*4; s1 < s3; s1 += 3, d1 += 6)
+ {
+ d1[0] = s1[0];
+ d1[1] = s1[1];
+ d1[2] = s1[2];
+ d1[3] = s1[3];
+
+ d1[4] = (s1[0]+s1[4])>>1;
+ d1[5] = (s1[1]+s1[5])>>1;
+ d1[6] = (s1[2]+s1[6])>>1;
+ d1[7] = (s1[4]+s1[7])>>1;
+ }
+ }
#else
- __asm
- {
- mov esi, s1
- mov edi, d1
+ __asm
+ {
+ mov esi, s1
+ mov edi, d1
- mov ecx, w
- dec ecx
+ mov ecx, w
+ dec ecx
- pxor mm0, mm0
- row_loop3:
- movq mm1, [esi]
- movq mm2, mm1
+ pxor mm0, mm0
+row_loop3:
+ movq mm1, [esi]
+ movq mm2, mm1
- punpcklbw mm1, mm0 // mm1 = 00xx00r100g100b1
- punpckhbw mm2, mm0 // mm2 = 00xx00r200g200b2
+ punpcklbw mm1, mm0 // mm1 = 00xx00r100g100b1
+ punpckhbw mm2, mm0 // mm2 = 00xx00r200g200b2
- paddw mm2, mm1
- psrlw mm2, 1 // mm2 = (mm1 + mm2) / 2
+ paddw mm2, mm1
+ psrlw mm2, 1 // mm2 = (mm1 + mm2) / 2
- packuswb mm1, mm2
+ packuswb mm1, mm2
- movq [edi], mm1
+ movq [edi], mm1
- lea esi, [esi+4]
- lea edi, [edi+8]
+ lea esi, [esi+4]
+ lea edi, [edi+8]
- dec ecx
- jnz row_loop3
+ dec ecx
+ jnz row_loop3
- mov s1, esi
- mov d1, edi
- };
+ mov s1, esi
+ mov d1, edi
+ };
#endif
- *((DWORD*)d1) = *((DWORD*)s1);
- *((DWORD*)d1 + 1) = *((DWORD*)s1);
+ *((DWORD*)d1) = *((DWORD*)s1);
+ *((DWORD*)d1+1) = *((DWORD*)s1);
- s1 += 4;
- d1 += 8;
+ s1 += 4;
+ d1 += 8;
- s1 = stmp;
- d1 = dtmp;
- }
+ s1 = stmp;
+ d1 = dtmp;
+ }
- AvgLines8(d, h * 2, dpitch);
- }
+ AvgLines8(d, h*2, dpitch);
+ }
#ifndef WIN64
- __asm emms;
+ __asm emms;
#endif
}
HRESULT CDirectVobSubFilter::Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, int bpp, const GUID& subtype, DWORD black)
{
- int wIn = in.cx, hIn = in.cy, pitchIn = wIn * bpp >> 3;
- int wSub = sub.cx, hSub = sub.cy, pitchSub = wSub * bpp >> 3;
- bool fScale2x = wIn * 2 <= wSub;
-
- if(fScale2x) wIn <<= 1, hIn <<= 1;
-
- int left = ((wSub - wIn) >> 1)&~1;
- int mid = wIn;
- int right = left + ((wSub - wIn) & 1);
-
- int dpLeft = left * bpp >> 3;
- int dpMid = mid * bpp >> 3;
- int dpRight = right * bpp >> 3;
-
- ASSERT(wSub >= wIn);
-
- {
- int i = 0, j = 0;
-
- j += (hSub - hIn) >> 1;
-
- for(; i < j; i++, pSub += pitchSub)
- {
- memsetd(pSub, black, dpLeft + dpMid + dpRight);
- }
-
- j += hIn;
-
- if(hIn > hSub)
- pIn += pitchIn * ((hIn - hSub) >> (fScale2x ? 2 : 1));
-
- if(fScale2x)
- {
- Scale2x(subtype,
- pSub + dpLeft, pitchSub, pIn, pitchIn,
- in.cx, (min(j, hSub) - i) >> 1);
-
- for(ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub)
- {
- memsetd(pSub, black, dpLeft);
- memsetd(pSub + dpLeft + dpMid, black, dpRight);
- }
- }
- else
- {
- for(ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub)
- {
- memsetd(pSub, black, dpLeft);
- memcpy(pSub + dpLeft, pIn, dpMid);
- memsetd(pSub + dpLeft + dpMid, black, dpRight);
- }
- }
-
- j = hSub;
-
- for(; i < j; i++, pSub += pitchSub)
- {
- memsetd(pSub, black, dpLeft + dpMid + dpRight);
- }
- }
-
- return NOERROR;
+ int wIn = in.cx, hIn = in.cy, pitchIn = wIn*bpp>>3;
+ int wSub = sub.cx, hSub = sub.cy, pitchSub = wSub*bpp>>3;
+ bool fScale2x = wIn*2 <= wSub;
+
+ if(fScale2x) wIn <<= 1, hIn <<= 1;
+
+ int left = ((wSub - wIn)>>1)&~1;
+ int mid = wIn;
+ int right = left + ((wSub - wIn)&1);
+
+ int dpLeft = left*bpp>>3;
+ int dpMid = mid*bpp>>3;
+ int dpRight = right*bpp>>3;
+
+ ASSERT(wSub >= wIn);
+
+ {
+ int i = 0, j = 0;
+
+ j += (hSub - hIn) >> 1;
+
+ for(; i < j; i++, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft+dpMid+dpRight);
+ }
+
+ j += hIn;
+
+ if(hIn > hSub)
+ pIn += pitchIn * ((hIn - hSub) >> (fScale2x?2:1));
+
+ if(fScale2x)
+ {
+ Scale2x(subtype,
+ pSub + dpLeft, pitchSub, pIn, pitchIn,
+ in.cx, (min(j, hSub) - i) >> 1);
+
+ for(ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft);
+ memsetd(pSub + dpLeft+dpMid, black, dpRight);
+ }
+ }
+ else
+ {
+ for(ptrdiff_t k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft);
+ memcpy(pSub + dpLeft, pIn, dpMid);
+ memsetd(pSub + dpLeft+dpMid, black, dpRight);
+ }
+ }
+
+ j = hSub;
+
+ for(; i < j; i++, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft+dpMid+dpRight);
+ }
+ }
+
+ return NOERROR;
}
void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
{
- if(!m_hdc || !m_hbm)
- return;
+ if(!m_hdc || !m_hbm)
+ return;
- ColorConvInit();
+ ColorConvInit();
- const GUID& subtype = m_pOutput->CurrentMediaType().subtype;
+ const GUID& subtype = m_pOutput->CurrentMediaType().subtype;
- BITMAPINFOHEADER bihOut;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
- CString msg, tmp;
+ CString msg, tmp;
- if(m_fOSD)
- {
- tmp.Format(_T("in: %dx%d %s\nout: %dx%d %s\n"),
- m_w, m_h,
- Subtype2String(m_pInput->CurrentMediaType().subtype),
- bihOut.biWidth, bihOut.biHeight,
- Subtype2String(m_pOutput->CurrentMediaType().subtype));
- msg += tmp;
+ if(m_fOSD)
+ {
+ tmp.Format(_T("in: %dx%d %s\nout: %dx%d %s\n"),
+ m_w, m_h,
+ Subtype2String(m_pInput->CurrentMediaType().subtype),
+ bihOut.biWidth, bihOut.biHeight,
+ Subtype2String(m_pOutput->CurrentMediaType().subtype));
+ msg += tmp;
- tmp.Format(_T("real fps: %.3f, current fps: %.3f\nmedia time: %d, subtitle time: %d [ms]\nframe number: %d (calculated)\nrate: %.4f\n"),
- m_fps, m_fMediaFPSEnabled ? m_MediaFPS : fabs(m_fps),
- (int)m_tPrev.Millisecs(), (int)(CalcCurrentTime() / 10000),
- (int)(m_tPrev.m_time * m_fps / 10000000),
- m_pInput->CurrentRate());
- msg += tmp;
+ tmp.Format(_T("real fps: %.3f, current fps: %.3f\nmedia time: %d, subtitle time: %d [ms]\nframe number: %d (calculated)\nrate: %.4f\n"),
+ m_fps, m_fMediaFPSEnabled?m_MediaFPS:fabs(m_fps),
+ (int)m_tPrev.Millisecs(), (int)(CalcCurrentTime()/10000),
+ (int)(m_tPrev.m_time * m_fps / 10000000),
+ m_pInput->CurrentRate());
+ msg += tmp;
- CAutoLock cAutoLock(&m_csQueueLock);
+ CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue)
- {
- int nSubPics = -1;
- REFERENCE_TIME rtNow = -1, rtStart = -1, rtStop = -1;
- m_pSubPicQueue->GetStats(nSubPics, rtNow, rtStart, rtStop);
- tmp.Format(_T("queue stats: %I64d - %I64d [ms]\n"), rtStart / 10000, rtStop / 10000);
- msg += tmp;
+ if(m_pSubPicQueue)
+ {
+ int nSubPics = -1;
+ REFERENCE_TIME rtNow = -1, rtStart = -1, rtStop = -1;
+ m_pSubPicQueue->GetStats(nSubPics, rtNow, rtStart, rtStop);
+ tmp.Format(_T("queue stats: %I64d - %I64d [ms]\n"), rtStart/10000, rtStop/10000);
+ msg += tmp;
- for(ptrdiff_t i = 0; i < nSubPics; i++)
- {
- m_pSubPicQueue->GetStats(i, rtStart, rtStop);
- tmp.Format(_T("%d: %I64d - %I64d [ms]\n"), i, rtStart / 10000, rtStop / 10000);
- msg += tmp;
- }
+ for(ptrdiff_t i = 0; i < nSubPics; i++)
+ {
+ m_pSubPicQueue->GetStats(i, rtStart, rtStop);
+ tmp.Format(_T("%d: %I64d - %I64d [ms]\n"), i, rtStart/10000, rtStop/10000);
+ msg += tmp;
+ }
- }
- }
+ }
+ }
- if(msg.IsEmpty()) return;
+ if(msg.IsEmpty()) return;
- HANDLE hOldBitmap = SelectObject(m_hdc, m_hbm);
- HANDLE hOldFont = SelectObject(m_hdc, m_hfont);
+ HANDLE hOldBitmap = SelectObject(m_hdc, m_hbm);
+ HANDLE hOldFont = SelectObject(m_hdc, m_hfont);
- SetTextColor(m_hdc, 0xffffff);
- SetBkMode(m_hdc, TRANSPARENT);
- SetMapMode(m_hdc, MM_TEXT);
+ SetTextColor(m_hdc, 0xffffff);
+ SetBkMode(m_hdc, TRANSPARENT);
+ SetMapMode(m_hdc, MM_TEXT);
- BITMAP bm;
- GetObject(m_hbm, sizeof(BITMAP), &bm);
+ BITMAP bm;
+ GetObject(m_hbm, sizeof(BITMAP), &bm);
- CRect r(0, 0, bm.bmWidth, bm.bmHeight);
- DrawText(m_hdc, msg, _tcslen(msg), &r, DT_CALCRECT | DT_EXTERNALLEADING | DT_NOPREFIX | DT_WORDBREAK);
+ CRect r(0, 0, bm.bmWidth, bm.bmHeight);
+ DrawText(m_hdc, msg, _tcslen(msg), &r, DT_CALCRECT|DT_EXTERNALLEADING|DT_NOPREFIX|DT_WORDBREAK);
- r += CPoint(10, 10);
- r &= CRect(0, 0, bm.bmWidth, bm.bmHeight);
+ r += CPoint(10, 10);
+ r &= CRect(0, 0, bm.bmWidth, bm.bmHeight);
- DrawText(m_hdc, msg, _tcslen(msg), &r, DT_LEFT | DT_TOP | DT_NOPREFIX | DT_WORDBREAK);
+ DrawText(m_hdc, msg, _tcslen(msg), &r, DT_LEFT|DT_TOP|DT_NOPREFIX|DT_WORDBREAK);
- BYTE* pIn = (BYTE*)bm.bmBits;
- int pitchIn = bm.bmWidthBytes;
- int pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
+ BYTE* pIn = (BYTE*)bm.bmBits;
+ int pitchIn = bm.bmWidthBytes;
+ int pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
- if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
- pitchOut = bihOut.biWidth;
+ if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
+ pitchOut = bihOut.biWidth;
- pitchIn = (pitchIn + 3)&~3;
- pitchOut = (pitchOut + 3)&~3;
+ pitchIn = (pitchIn+3)&~3;
+ pitchOut = (pitchOut+3)&~3;
- if(bihOut.biHeight > 0 && bihOut.biCompression <= 3) // flip if the dst bitmap is flipped rgb (m_hbm is a top-down bitmap, not like the subpictures)
- {
- pOut += pitchOut * (abs(bihOut.biHeight) - 1);
- pitchOut = -pitchOut;
- }
+ if(bihOut.biHeight > 0 && bihOut.biCompression <= 3) // flip if the dst bitmap is flipped rgb (m_hbm is a top-down bitmap, not like the subpictures)
+ {
+ pOut += pitchOut * (abs(bihOut.biHeight)-1);
+ pitchOut = -pitchOut;
+ }
- pIn += pitchIn * r.top;
- pOut += pitchOut * r.top;
+ pIn += pitchIn * r.top;
+ pOut += pitchOut * r.top;
- for(ptrdiff_t w = min(r.right, m_w), h = r.Height(); h--; pIn += pitchIn, pOut += pitchOut)
- {
- BltLineRGB32((DWORD*)pOut, pIn, w, subtype);
- memsetd(pIn, 0xff000000, r.right * 4);
- }
+ for(ptrdiff_t w = min(r.right, m_w), h = r.Height(); h--; pIn += pitchIn, pOut += pitchOut)
+ {
+ BltLineRGB32((DWORD*)pOut, pIn, w, subtype);
+ memsetd(pIn, 0xff000000, r.right*4);
+ }
- SelectObject(m_hdc, hOldBitmap);
- SelectObject(m_hdc, hOldFont);
+ SelectObject(m_hdc, hOldBitmap);
+ SelectObject(m_hdc, hOldFont);
}
diff --git a/src/filters/transform/vsfilter/DirectVobSub.cpp b/src/filters/transform/vsfilter/DirectVobSub.cpp
index de48f06dc..5bac29616 100644
--- a/src/filters/transform/vsfilter/DirectVobSub.cpp
+++ b/src/filters/transform/vsfilter/DirectVobSub.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,59 +25,59 @@
CDirectVobSub::CDirectVobSub()
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- BYTE* pData;
- UINT nSize;
-
- m_iSelectedLanguage = 0;
- m_fHideSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), 0);
- m_fDoPreBuffering = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), 0);
- m_fOverridePlacement = !!theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), 0);
- m_PlacementXperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), 50);
- m_PlacementYperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), 90);
- m_fBufferVobSub = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), 1);
- m_fOnlyShowForcedVobSubs = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), 0);
- m_fPolygonize = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), 0);
- m_defStyle <<= theApp.GetProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), _T(""));
- m_fFlipPicture = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), 0);
- m_fFlipSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), 0);
- m_fOSD = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), 0);
- m_fSaveFullPath = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), 0);
- m_nReloaderDisableCount = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0) ? 1 : 0;
- m_SubtitleDelay = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), 0);
- m_SubtitleSpeedMul = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), 1000);
- m_SubtitleSpeedDiv = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), 1000);
- m_fMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
- m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), 0));
- pData = NULL;
- if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData)
- {
- if(nSize != sizeof(m_MediaFPS)) m_MediaFPS = 25.0;
- else memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
- delete [] pData;
- }
- m_ZoomRect.left = m_ZoomRect.top = 0;
- m_ZoomRect.right = m_ZoomRect.bottom = 1;
-
- m_fForced = false;
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ BYTE* pData;
+ UINT nSize;
+
+ m_iSelectedLanguage = 0;
+ m_fHideSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), 0);
+ m_fDoPreBuffering = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), 0);
+ m_fOverridePlacement = !!theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), 0);
+ m_PlacementXperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), 50);
+ m_PlacementYperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), 90);
+ m_fBufferVobSub = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), 1);
+ m_fOnlyShowForcedVobSubs = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), 0);
+ m_fPolygonize = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), 0);
+ m_defStyle <<= theApp.GetProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), _T(""));
+ m_fFlipPicture = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), 0);
+ m_fFlipSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), 0);
+ m_fOSD = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), 0);
+ m_fSaveFullPath = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), 0);
+ m_nReloaderDisableCount = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0) ? 1 : 0;
+ m_SubtitleDelay = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), 0);
+ m_SubtitleSpeedMul = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), 1000);
+ m_SubtitleSpeedDiv = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), 1000);
+ m_fMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
+ m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), 0));
+ pData = NULL;
+ if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData)
+ {
+ if(nSize != sizeof(m_MediaFPS)) m_MediaFPS = 25.0;
+ else memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
+ delete [] pData;
+ }
+ m_ZoomRect.left = m_ZoomRect.top = 0;
+ m_ZoomRect.right = m_ZoomRect.bottom = 1;
+
+ m_fForced = false;
}
CDirectVobSub::~CDirectVobSub()
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
}
STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(!fn) return E_POINTER;
+ if(!fn) return E_POINTER;
#ifdef UNICODE
- wcscpy(fn, m_FileName);
+ wcscpy(fn, m_FileName);
#else
- mbstowcs(fn, m_FileName, m_FileName.GetLength() + 1);
+ mbstowcs(fn, m_FileName, m_FileName.GetLength()+1);
#endif
return S_OK;
@@ -85,565 +85,565 @@ STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
STDMETHODIMP CDirectVobSub::put_FileName(WCHAR* fn)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(!fn) return E_POINTER;
+ if(!fn) return E_POINTER;
- CString tmp = fn;
- if(!m_FileName.Left(m_FileName.ReverseFind('.') + 1).CompareNoCase(tmp.Left(tmp.ReverseFind('.') + 1))) return S_FALSE;
+ CString tmp = fn;
+ if(!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) return S_FALSE;
#ifdef UNICODE
- m_FileName = fn;
+ m_FileName = fn;
#else
- CHARSETINFO cs = {0};
- ::TranslateCharsetInfo((DWORD *)DEFAULT_CHARSET, &cs, TCI_SRCCHARSET);
- CHAR* buff = m_FileName.GetBuffer(MAX_PATH * 2);
- int len = WideCharToMultiByte(cs.ciACP/*CP_OEMCP*/, NULL, fn, -1, buff, MAX_PATH * 2, NULL, NULL);
- m_FileName.ReleaseBuffer(len + 1);
+ CHARSETINFO cs={0};
+ ::TranslateCharsetInfo((DWORD *)DEFAULT_CHARSET, &cs, TCI_SRCCHARSET);
+ CHAR* buff = m_FileName.GetBuffer(MAX_PATH*2);
+ int len = WideCharToMultiByte(cs.ciACP/*CP_OEMCP*/, NULL, fn, -1, buff, MAX_PATH*2, NULL, NULL);
+ m_FileName.ReleaseBuffer(len+1);
#endif
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_LanguageCount(int* nLangs)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- return nLangs ? *nLangs = 0, S_OK : E_POINTER;
+ return nLangs ? *nLangs = 0, S_OK : E_POINTER;
}
STDMETHODIMP CDirectVobSub::get_LanguageName(int iLanguage, WCHAR** ppName)
{
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_SelectedLanguage(int* iSelected)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- return iSelected ? *iSelected = m_iSelectedLanguage, S_OK : E_POINTER;
+ return iSelected ? *iSelected = m_iSelectedLanguage, S_OK : E_POINTER;
}
STDMETHODIMP CDirectVobSub::put_SelectedLanguage(int iSelected)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_iSelectedLanguage == iSelected) return S_FALSE;
+ if(m_iSelectedLanguage == iSelected) return S_FALSE;
- int nCount;
- if(FAILED(get_LanguageCount(&nCount))
- || iSelected < 0
- || iSelected >= nCount)
- return E_FAIL;
+ int nCount;
+ if(FAILED(get_LanguageCount(&nCount))
+ || iSelected < 0
+ || iSelected >= nCount)
+ return E_FAIL;
- m_iSelectedLanguage = iSelected;
+ m_iSelectedLanguage = iSelected;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_HideSubtitles(bool* fHideSubtitles)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- return fHideSubtitles ? *fHideSubtitles = m_fHideSubtitles, S_OK : E_POINTER;
+ return fHideSubtitles ? *fHideSubtitles = m_fHideSubtitles, S_OK : E_POINTER;
}
STDMETHODIMP CDirectVobSub::put_HideSubtitles(bool fHideSubtitles)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fHideSubtitles == fHideSubtitles) return S_FALSE;
+ if(m_fHideSubtitles == fHideSubtitles) return S_FALSE;
- m_fHideSubtitles = fHideSubtitles;
+ m_fHideSubtitles = fHideSubtitles;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_PreBuffering(bool* fDoPreBuffering)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
+ return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
}
STDMETHODIMP CDirectVobSub::put_PreBuffering(bool fDoPreBuffering)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
+ if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
- m_fDoPreBuffering = fDoPreBuffering;
+ m_fDoPreBuffering = fDoPreBuffering;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_Placement(bool* fOverridePlacement, int* xperc, int* yperc)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(fOverridePlacement) *fOverridePlacement = m_fOverridePlacement;
- if(xperc) *xperc = m_PlacementXperc;
- if(yperc) *yperc = m_PlacementYperc;
+ if(fOverridePlacement) *fOverridePlacement = m_fOverridePlacement;
+ if(xperc) *xperc = m_PlacementXperc;
+ if(yperc) *yperc = m_PlacementYperc;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_Placement(bool fOverridePlacement, int xperc, int yperc)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) return S_FALSE;
+ if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) return S_FALSE;
- m_fOverridePlacement = fOverridePlacement;
- m_PlacementXperc = xperc;
- m_PlacementYperc = yperc;
+ m_fOverridePlacement = fOverridePlacement;
+ m_PlacementXperc = xperc;
+ m_PlacementYperc = yperc;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_VobSubSettings(bool* fBuffer, bool* fOnlyShowForcedSubs, bool* fPolygonize)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(fBuffer) *fBuffer = m_fBufferVobSub;
- if(fOnlyShowForcedSubs) *fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
- if(fPolygonize) *fPolygonize = m_fPolygonize;
+ if(fBuffer) *fBuffer = m_fBufferVobSub;
+ if(fOnlyShowForcedSubs) *fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
+ if(fPolygonize) *fPolygonize = m_fPolygonize;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) return S_FALSE;
+ if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) return S_FALSE;
- m_fBufferVobSub = fBuffer;
- m_fOnlyShowForcedVobSubs = fOnlyShowForcedSubs;
- m_fPolygonize = fPolygonize;
+ m_fBufferVobSub = fBuffer;
+ m_fOnlyShowForcedVobSubs = fOnlyShowForcedSubs;
+ m_fPolygonize = fPolygonize;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* color, bool* fShadow, bool* fOutline, bool* fAdvancedRenderer)
{
- CAutoLock cAutoLock(&m_propsLock);
-
- if(lf)
- {
- if(lflen == sizeof(LOGFONTA))
- strncpy_s(((LOGFONTA*)lf)->lfFaceName, LF_FACESIZE, CStringA(m_defStyle.fontName), _TRUNCATE);
- else if(lflen == sizeof(LOGFONTW))
- wcsncpy_s(((LOGFONTW*)lf)->lfFaceName, LF_FACESIZE, CStringW(m_defStyle.fontName), _TRUNCATE);
- else
- return E_INVALIDARG;
-
- ((LOGFONT*)lf)->lfCharSet = m_defStyle.charSet;
- ((LOGFONT*)lf)->lfItalic = m_defStyle.fItalic;
- ((LOGFONT*)lf)->lfHeight = m_defStyle.fontSize;
- ((LOGFONT*)lf)->lfWeight = m_defStyle.fontWeight;
- ((LOGFONT*)lf)->lfStrikeOut = m_defStyle.fStrikeOut;
- ((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
- }
-
- if(color) *color = m_defStyle.colors[0];
- if(fShadow) *fShadow = (m_defStyle.shadowDepthX != 0) || (m_defStyle.shadowDepthY != 0);
- if(fOutline) *fOutline = (m_defStyle.outlineWidthX + m_defStyle.outlineWidthY) > 0;
- if(fAdvancedRenderer) *fAdvancedRenderer = m_fAdvancedRenderer;
+ CAutoLock cAutoLock(&m_propsLock);
- return S_OK;
+ if(lf)
+ {
+ if(lflen == sizeof(LOGFONTA))
+ strncpy_s(((LOGFONTA*)lf)->lfFaceName, LF_FACESIZE, CStringA(m_defStyle.fontName), _TRUNCATE);
+ else if(lflen == sizeof(LOGFONTW))
+ wcsncpy_s(((LOGFONTW*)lf)->lfFaceName, LF_FACESIZE, CStringW(m_defStyle.fontName), _TRUNCATE);
+ else
+ return E_INVALIDARG;
+
+ ((LOGFONT*)lf)->lfCharSet = m_defStyle.charSet;
+ ((LOGFONT*)lf)->lfItalic = m_defStyle.fItalic;
+ ((LOGFONT*)lf)->lfHeight = m_defStyle.fontSize;
+ ((LOGFONT*)lf)->lfWeight = m_defStyle.fontWeight;
+ ((LOGFONT*)lf)->lfStrikeOut = m_defStyle.fStrikeOut;
+ ((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
+ }
+
+ if(color) *color = m_defStyle.colors[0];
+ if(fShadow) *fShadow = (m_defStyle.shadowDepthX!=0) || (m_defStyle.shadowDepthY!=0);
+ if(fOutline) *fOutline = (m_defStyle.outlineWidthX+m_defStyle.outlineWidthY)>0;
+ if(fAdvancedRenderer) *fAdvancedRenderer = m_fAdvancedRenderer;
+
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
{
- CAutoLock cAutoLock(&m_propsLock);
-
- if(lf)
- {
- if(lflen == sizeof(LOGFONTA))
- m_defStyle.fontName = ((LOGFONTA*)lf)->lfFaceName;
- else if(lflen == sizeof(LOGFONTW))
- m_defStyle.fontName = ((LOGFONTW*)lf)->lfFaceName;
- else
- return E_INVALIDARG;
-
- m_defStyle.charSet = ((LOGFONT*)lf)->lfCharSet;
- m_defStyle.fItalic = !!((LOGFONT*)lf)->lfItalic;
- m_defStyle.fontSize = ((LOGFONT*)lf)->lfHeight;
- m_defStyle.fontWeight = ((LOGFONT*)lf)->lfWeight;
- m_defStyle.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
- m_defStyle.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
-
- if(m_defStyle.fontSize < 0)
- {
- HDC hdc = ::GetDC(0);
- m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
- ::ReleaseDC(0, hdc);
- }
-
- }
-
- m_defStyle.colors[0] = color;
- m_defStyle.shadowDepthX = m_defStyle.shadowDepthY = fShadow ? 2 : 0;
- m_defStyle.outlineWidthX = m_defStyle.outlineWidthY = fOutline ? 2 : 0;
+ CAutoLock cAutoLock(&m_propsLock);
- return S_OK;
+ if(lf)
+ {
+ if(lflen == sizeof(LOGFONTA))
+ m_defStyle.fontName = ((LOGFONTA*)lf)->lfFaceName;
+ else if(lflen == sizeof(LOGFONTW))
+ m_defStyle.fontName = ((LOGFONTW*)lf)->lfFaceName;
+ else
+ return E_INVALIDARG;
+
+ m_defStyle.charSet = ((LOGFONT*)lf)->lfCharSet;
+ m_defStyle.fItalic = !!((LOGFONT*)lf)->lfItalic;
+ m_defStyle.fontSize = ((LOGFONT*)lf)->lfHeight;
+ m_defStyle.fontWeight = ((LOGFONT*)lf)->lfWeight;
+ m_defStyle.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
+ m_defStyle.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
+
+ if(m_defStyle.fontSize < 0)
+ {
+ HDC hdc = ::GetDC(0);
+ m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
+ ::ReleaseDC(0, hdc);
+ }
+
+ }
+
+ m_defStyle.colors[0] = color;
+ m_defStyle.shadowDepthX = m_defStyle.shadowDepthY = fShadow?2:0;
+ m_defStyle.outlineWidthX = m_defStyle.outlineWidthY = fOutline?2:0;
+
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_Flip(bool* fPicture, bool* fSubtitles)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(fPicture) *fPicture = m_fFlipPicture;
- if(fSubtitles) *fSubtitles = m_fFlipSubtitles;
+ if(fPicture) *fPicture = m_fFlipPicture;
+ if(fSubtitles) *fSubtitles = m_fFlipSubtitles;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_Flip(bool fPicture, bool fSubtitles)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) return S_FALSE;
+ if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) return S_FALSE;
- m_fFlipPicture = fPicture;
- m_fFlipSubtitles = fSubtitles;
+ m_fFlipPicture = fPicture;
+ m_fFlipSubtitles = fSubtitles;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_OSD(bool* fOSD)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- return fOSD ? *fOSD = m_fOSD, S_OK : E_POINTER;
+ return fOSD ? *fOSD = m_fOSD, S_OK : E_POINTER;
}
STDMETHODIMP CDirectVobSub::put_OSD(bool fOSD)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fOSD == fOSD) return S_FALSE;
+ if(m_fOSD == fOSD) return S_FALSE;
- m_fOSD = fOSD;
+ m_fOSD = fOSD;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_SaveFullPath(bool* fSaveFullPath)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- return fSaveFullPath ? *fSaveFullPath = m_fSaveFullPath, S_OK : E_POINTER;
+ return fSaveFullPath ? *fSaveFullPath = m_fSaveFullPath, S_OK : E_POINTER;
}
STDMETHODIMP CDirectVobSub::put_SaveFullPath(bool fSaveFullPath)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fSaveFullPath == fSaveFullPath) return S_FALSE;
+ if(m_fSaveFullPath == fSaveFullPath) return S_FALSE;
- m_fSaveFullPath = fSaveFullPath;
+ m_fSaveFullPath = fSaveFullPath;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(delay) *delay = m_SubtitleDelay;
- if(speedmul) *speedmul = m_SubtitleSpeedMul;
- if(speeddiv) *speeddiv = m_SubtitleSpeedDiv;
+ if(delay) *delay = m_SubtitleDelay;
+ if(speedmul) *speedmul = m_SubtitleSpeedMul;
+ if(speeddiv) *speeddiv = m_SubtitleSpeedDiv;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) return S_FALSE;
+ if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) return S_FALSE;
- m_SubtitleDelay = delay;
- m_SubtitleSpeedMul = speedmul;
- if(speeddiv > 0) m_SubtitleSpeedDiv = speeddiv;
+ m_SubtitleDelay = delay;
+ m_SubtitleSpeedMul = speedmul;
+ if(speeddiv > 0) m_SubtitleSpeedDiv = speeddiv;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_MediaFPS(bool* fEnabled, double* fps)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(fEnabled) *fEnabled = m_fMediaFPSEnabled;
- if(fps) *fps = m_MediaFPS;
+ if(fEnabled) *fEnabled = m_fMediaFPSEnabled;
+ if(fps) *fps = m_MediaFPS;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_MediaFPS(bool fEnabled, double fps)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) return S_FALSE;
+ if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) return S_FALSE;
- m_fMediaFPSEnabled = fEnabled;
- if(fps > 0) m_MediaFPS = fps;
+ m_fMediaFPSEnabled = fEnabled;
+ if(fps > 0) m_MediaFPS = fps;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_ZoomRect(NORMALIZEDRECT* rect)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(!rect) return E_POINTER;
+ if(!rect) return E_POINTER;
- *rect = m_ZoomRect;
+ *rect = m_ZoomRect;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_ZoomRect(NORMALIZEDRECT* rect)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(!rect) return E_POINTER;
+ if(!rect) return E_POINTER;
- if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) return S_FALSE;
+ if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) return S_FALSE;
- m_ZoomRect = *rect;
+ m_ZoomRect = *rect;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::UpdateRegistry()
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CAutoLock cAutoLock(&m_propsLock);
-
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_fHideSubtitles);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), m_fDoPreBuffering);
- theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_fOverridePlacement);
- theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
- theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
- theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_fBufferVobSub);
- theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_fOnlyShowForcedVobSubs);
- theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_fPolygonize);
- CString style;
- theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_fFlipPicture);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_fFlipSubtitles);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_fOSD);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_fSaveFullPath);
- theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
- theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
- theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
- theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_fMediaFPSEnabled);
- theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
- theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), m_ePARCompensationType);
-
- return S_OK;
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_fHideSubtitles);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), m_fDoPreBuffering);
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_fOverridePlacement);
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
+ theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_fBufferVobSub);
+ theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_fOnlyShowForcedVobSubs);
+ theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_fPolygonize);
+ CString style;
+ theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_fFlipPicture);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_fFlipSubtitles);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_fOSD);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_fSaveFullPath);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_fMediaFPSEnabled);
+ theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), m_ePARCompensationType);
+
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::HasConfigDialog(int iSelected)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
STDMETHODIMP CDirectVobSub::ShowConfigDialog(int iSelected, HWND hWndParent)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
STDMETHODIMP CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(!fLocked) return E_POINTER;
+ if(!fLocked) return E_POINTER;
- bool fDisabled;
- get_SubtitleReloader(&fDisabled);
+ bool fDisabled;
+ get_SubtitleReloader(&fDisabled);
- *fLocked = fDisabled || m_nReloaderDisableCount > 0;
+ *fLocked = fDisabled || m_nReloaderDisableCount > 0;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::LockSubtitleReloader(bool fLock)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(fLock) m_nReloaderDisableCount++;
- else m_nReloaderDisableCount--;
+ if(fLock) m_nReloaderDisableCount++;
+ else m_nReloaderDisableCount--;
- ASSERT(m_nReloaderDisableCount >= 0);
- if(m_nReloaderDisableCount < 0) m_nReloaderDisableCount = 0;
+ ASSERT(m_nReloaderDisableCount >= 0);
+ if(m_nReloaderDisableCount < 0) m_nReloaderDisableCount = 0;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_SubtitleReloader(bool* fDisabled)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(fDisabled) *fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
+ if(fDisabled) *fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_SubtitleReloader(bool fDisable)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- bool b;
- get_SubtitleReloader(&b);
- if(b == fDisable) return S_FALSE;
+ bool b;
+ get_SubtitleReloader(&b);
+ if(b == fDisable) return S_FALSE;
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), fDisable);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), fDisable);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(horizontal) *horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
- if(vertical) *vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 0);
- if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
- if(resx2minw) *resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
- if(resx2minh) *resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
+ if(horizontal) *horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
+ if(vertical) *vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 0);
+ if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
+ if(resx2minw) *resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
+ if(resx2minh) *resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- int i[5];
- get_ExtendPicture(i, i + 1, i + 2, i + 3, i + 4);
- if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) return S_FALSE;
+ int i[5];
+ get_ExtendPicture(i, i+1, i+2, i+3, i+4);
+ if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) return S_FALSE;
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), horizontal & 1);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), vertical);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), resx2 & 3);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), resx2minw);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), resx2minh);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), horizontal & 1);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), vertical);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), resx2 & 3);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), resx2minw);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), resx2minh);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(level) *level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
- if(fExternalLoad) *fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
- if(fWebLoad) *fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
- if(fEmbeddedLoad) *fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
+ if(level) *level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
+ if(fExternalLoad) *fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
+ if(fWebLoad) *fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
+ if(fEmbeddedLoad) *fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- int i;
- bool b[3];
- get_LoadSettings(&i, b, b + 1, b + 2);
- if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) return S_FALSE;
+ int i;
+ bool b[3];
+ get_LoadSettings(&i, b, b+1, b+2);
+ if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) return S_FALSE;
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), level & 3);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), fExternalLoad);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), fWebLoad);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), fEmbeddedLoad);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), level & 3);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), fExternalLoad);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), fWebLoad);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), fEmbeddedLoad);
- return S_OK;
+ return S_OK;
}
// IDirectVobSub2
STDMETHODIMP CDirectVobSub::AdviseSubClock(ISubClock* pSubClock)
{
- m_pSubClock = pSubClock;
- return S_OK;
+ m_pSubClock = pSubClock;
+ return S_OK;
}
STDMETHODIMP_(bool) CDirectVobSub::get_Forced()
{
- return m_fForced;
+ return m_fForced;
}
STDMETHODIMP CDirectVobSub::put_Forced(bool fForced)
{
- m_fForced = fForced;
- return S_OK;
+ m_fForced = fForced;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_TextSettings(STSStyle* pDefStyle)
{
- CheckPointer(pDefStyle, E_POINTER);
+ CheckPointer(pDefStyle, E_POINTER);
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- *pDefStyle = m_defStyle;
+ *pDefStyle = m_defStyle;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle)
{
- CheckPointer(pDefStyle, E_POINTER);
+ CheckPointer(pDefStyle, E_POINTER);
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle)))
- return S_FALSE;
+ if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle)))
+ return S_FALSE;
- m_defStyle = *pDefStyle;
+ m_defStyle = *pDefStyle;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- *ePARCompensationType = m_ePARCompensationType;
+ *ePARCompensationType = m_ePARCompensationType;
- return S_OK;
+ return S_OK;
}
STDMETHODIMP CDirectVobSub::put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
{
- CAutoLock cAutoLock(&m_propsLock);
+ CAutoLock cAutoLock(&m_propsLock);
- m_ePARCompensationType = *ePARCompensationType;
+ m_ePARCompensationType = *ePARCompensationType;
- return S_OK;
+ return S_OK;
}
// IFilterVersion
STDMETHODIMP_(DWORD) CDirectVobSub::GetFilterVersion()
{
- return 0x0234;
+ return 0x0234;
}
diff --git a/src/filters/transform/vsfilter/DirectVobSub.h b/src/filters/transform/vsfilter/DirectVobSub.h
index 825b12df5..1d043e2eb 100644
--- a/src/filters/transform/vsfilter/DirectVobSub.h
+++ b/src/filters/transform/vsfilter/DirectVobSub.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,47 +27,47 @@
class CDirectVobSub : public IDirectVobSub2, public IFilterVersion
{
protected:
- CDirectVobSub();
- virtual ~CDirectVobSub();
+ CDirectVobSub();
+ virtual ~CDirectVobSub();
protected:
CCritSec m_propsLock;
- CString m_FileName;
- int m_iSelectedLanguage;
- bool m_fHideSubtitles;
- bool m_fDoPreBuffering;
- bool m_fOverridePlacement;
- int m_PlacementXperc, m_PlacementYperc;
- bool m_fBufferVobSub, m_fOnlyShowForcedVobSubs, m_fPolygonize;
- CSimpleTextSubtitle::EPARCompensationType m_ePARCompensationType;
-
- STSStyle m_defStyle;
-
- bool m_fAdvancedRenderer;
- bool m_fFlipPicture, m_fFlipSubtitles;
- bool m_fOSD;
- int m_nReloaderDisableCount;
- int m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv;
- bool m_fMediaFPSEnabled;
- double m_MediaFPS;
- bool m_fSaveFullPath;
- NORMALIZEDRECT m_ZoomRect;
-
- CComPtr<ISubClock> m_pSubClock;
- bool m_fForced;
+ CString m_FileName;
+ int m_iSelectedLanguage;
+ bool m_fHideSubtitles;
+ bool m_fDoPreBuffering;
+ bool m_fOverridePlacement;
+ int m_PlacementXperc, m_PlacementYperc;
+ bool m_fBufferVobSub, m_fOnlyShowForcedVobSubs, m_fPolygonize;
+ CSimpleTextSubtitle::EPARCompensationType m_ePARCompensationType;
+
+ STSStyle m_defStyle;
+
+ bool m_fAdvancedRenderer;
+ bool m_fFlipPicture, m_fFlipSubtitles;
+ bool m_fOSD;
+ int m_nReloaderDisableCount;
+ int m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv;
+ bool m_fMediaFPSEnabled;
+ double m_MediaFPS;
+ bool m_fSaveFullPath;
+ NORMALIZEDRECT m_ZoomRect;
+
+ CComPtr<ISubClock> m_pSubClock;
+ bool m_fForced;
public:
- // IDirectVobSub
+ // IDirectVobSub
STDMETHODIMP get_FileName(WCHAR* fn);
STDMETHODIMP put_FileName(WCHAR* fn);
- STDMETHODIMP get_LanguageCount(int* nLangs);
- STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
- STDMETHODIMP get_SelectedLanguage(int* iSelected);
- STDMETHODIMP put_SelectedLanguage(int iSelected);
- STDMETHODIMP get_HideSubtitles(bool* fHideSubtitles);
+ STDMETHODIMP get_LanguageCount(int* nLangs);
+ STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
+ STDMETHODIMP get_SelectedLanguage(int* iSelected);
+ STDMETHODIMP put_SelectedLanguage(int iSelected);
+ STDMETHODIMP get_HideSubtitles(bool* fHideSubtitles);
STDMETHODIMP put_HideSubtitles(bool fHideSubtitles);
STDMETHODIMP get_PreBuffering(bool* fDoPreBuffering);
STDMETHODIMP put_PreBuffering(bool fDoPreBuffering);
@@ -81,53 +81,47 @@ public:
STDMETHODIMP put_Flip(bool fPicture, bool fSubtitles);
STDMETHODIMP get_OSD(bool* fShowOSD);
STDMETHODIMP put_OSD(bool fShowOSD);
- STDMETHODIMP get_SaveFullPath(bool* fSaveFullPath);
- STDMETHODIMP put_SaveFullPath(bool fSaveFullPath);
+ STDMETHODIMP get_SaveFullPath(bool* fSaveFullPath);
+ STDMETHODIMP put_SaveFullPath(bool fSaveFullPath);
STDMETHODIMP get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv);
STDMETHODIMP put_SubtitleTiming(int delay, int speedmul, int speeddiv);
STDMETHODIMP get_MediaFPS(bool* fEnabled, double* fps);
STDMETHODIMP put_MediaFPS(bool fEnabled, double fps);
- STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect);
+ STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect);
STDMETHODIMP put_ZoomRect(NORMALIZEDRECT* rect);
- STDMETHODIMP get_ColorFormat(int* iPosition)
- {
- return E_NOTIMPL;
- }
- STDMETHODIMP put_ColorFormat(int iPosition)
- {
- return E_NOTIMPL;
- }
+ STDMETHODIMP get_ColorFormat(int* iPosition) {return E_NOTIMPL;}
+ STDMETHODIMP put_ColorFormat(int iPosition) {return E_NOTIMPL;}
- STDMETHODIMP UpdateRegistry();
+ STDMETHODIMP UpdateRegistry();
- STDMETHODIMP HasConfigDialog(int iSelected);
- STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
+ STDMETHODIMP HasConfigDialog(int iSelected);
+ STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
- // settings for the rest are stored in the registry
+ // settings for the rest are stored in the registry
- STDMETHODIMP IsSubtitleReloaderLocked(bool* fLocked);
+ STDMETHODIMP IsSubtitleReloaderLocked(bool* fLocked);
STDMETHODIMP LockSubtitleReloader(bool fLock);
- STDMETHODIMP get_SubtitleReloader(bool* fDisabled);
+ STDMETHODIMP get_SubtitleReloader(bool* fDisabled);
STDMETHODIMP put_SubtitleReloader(bool fDisable);
- // the followings need a partial or full reloading of the filter
+ // the followings need a partial or full reloading of the filter
- STDMETHODIMP get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh);
- STDMETHODIMP put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh);
- STDMETHODIMP get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad);
- STDMETHODIMP put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad);
+ STDMETHODIMP get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh);
+ STDMETHODIMP put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh);
+ STDMETHODIMP get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad);
+ STDMETHODIMP put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad);
- // IDirectVobSub2
+ // IDirectVobSub2
- STDMETHODIMP AdviseSubClock(ISubClock* pSubClock);
- STDMETHODIMP_(bool) get_Forced();
- STDMETHODIMP put_Forced(bool fForced);
+ STDMETHODIMP AdviseSubClock(ISubClock* pSubClock);
+ STDMETHODIMP_(bool) get_Forced();
+ STDMETHODIMP put_Forced(bool fForced);
STDMETHODIMP get_TextSettings(STSStyle* pDefStyle);
STDMETHODIMP put_TextSettings(STSStyle* pDefStyle);
- STDMETHODIMP get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType);
- STDMETHODIMP put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType);
-
- // IFilterVersion
+ STDMETHODIMP get_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType);
+ STDMETHODIMP put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType);
- STDMETHODIMP_(DWORD) GetFilterVersion();
+ // IFilterVersion
+
+ STDMETHODIMP_(DWORD) GetFilterVersion();
};
diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp
index 5ce868196..2a8ead2f7 100644
--- a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp
+++ b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -45,321 +45,306 @@ bool g_RegOK = true;//false; // doesn't work with the dvd graph builder
//
CDirectVobSubFilter::CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid)
- : CBaseVideoFilter(NAME("CDirectVobSubFilter"), punk, phr, clsid)
- , m_nSubtitleId(-1)
- , m_fMSMpeg4Fix(false)
- , m_fps(25)
+ : CBaseVideoFilter(NAME("CDirectVobSubFilter"), punk, phr, clsid)
+ , m_nSubtitleId(-1)
+ , m_fMSMpeg4Fix(false)
+ , m_fps(25)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- m_hdc = 0;
- m_hbm = 0;
- m_hfont = 0;
-
- {
- LOGFONT lf;
- memset(&lf, 0, sizeof(lf));
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfOutPrecision = OUT_CHARACTER_PRECIS;
- lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf.lfQuality = ANTIALIASED_QUALITY;
- HDC hdc = GetDC(NULL);
- lf.lfHeight = -MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- ReleaseDC(NULL, hdc);
- lf.lfWeight = FW_BOLD;
- _tcscpy(lf.lfFaceName, _T("Arial"));
- m_hfont = CreateFontIndirect(&lf);
- }
-
- theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Hint"), _T("The first three are fixed, but you can add more up to ten entries."));
- theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path0"), _T("."));
- theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path1"), _T("c:\\subtitles"));
- theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path2"), _T(".\\subtitles"));
-
- m_fLoading = true;
-
- m_hSystrayThread = 0;
- m_tbid.hSystrayWnd = NULL;
- m_tbid.graph = NULL;
- m_tbid.fRunOnce = false;
- m_tbid.fShowIcon = (theApp.m_AppName.Find(_T("zplayer"), 0) < 0 || !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0));
-
- HRESULT hr = S_OK;
- m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
- ASSERT(SUCCEEDED(hr));
-
- CAMThread::Create();
- m_frd.EndThreadEvent.Create(0, FALSE, FALSE, 0);
- m_frd.RefreshEvent.Create(0, FALSE, FALSE, 0);
-
- memset(&m_CurrentVIH2, 0, sizeof(VIDEOINFOHEADER2));
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ m_hdc = 0;
+ m_hbm = 0;
+ m_hfont = 0;
+
+ {
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(lf));
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfOutPrecision = OUT_CHARACTER_PRECIS;
+ lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lf.lfQuality = ANTIALIASED_QUALITY;
+ HDC hdc = GetDC(NULL);
+ lf.lfHeight = -MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+ ReleaseDC(NULL, hdc);
+ lf.lfWeight = FW_BOLD;
+ _tcscpy(lf.lfFaceName, _T("Arial"));
+ m_hfont = CreateFontIndirect(&lf);
+ }
+
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Hint"), _T("The first three are fixed, but you can add more up to ten entries."));
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path0"), _T("."));
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path1"), _T("c:\\subtitles"));
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path2"), _T(".\\subtitles"));
+
+ m_fLoading = true;
+
+ m_hSystrayThread = 0;
+ m_tbid.hSystrayWnd = NULL;
+ m_tbid.graph = NULL;
+ m_tbid.fRunOnce = false;
+ m_tbid.fShowIcon = (theApp.m_AppName.Find(_T("zplayer"), 0) < 0 || !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0));
+
+ HRESULT hr = S_OK;
+ m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
+ ASSERT(SUCCEEDED(hr));
+
+ CAMThread::Create();
+ m_frd.EndThreadEvent.Create(0, FALSE, FALSE, 0);
+ m_frd.RefreshEvent.Create(0, FALSE, FALSE, 0);
+
+ memset(&m_CurrentVIH2, 0, sizeof(VIDEOINFOHEADER2));
}
CDirectVobSubFilter::~CDirectVobSubFilter()
{
- CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue) m_pSubPicQueue->Invalidate();
- m_pSubPicQueue = NULL;
-
- if(m_hfont)
- {
- DeleteObject(m_hfont);
- m_hfont = 0;
- }
- if(m_hbm)
- {
- DeleteObject(m_hbm);
- m_hbm = 0;
- }
- if(m_hdc)
- {
- DeleteObject(m_hdc);
- m_hdc = 0;
- }
-
- for(ptrdiff_t i = 0; i < m_pTextInput.GetCount(); i++)
- delete m_pTextInput[i];
-
- m_frd.EndThreadEvent.Set();
- CAMThread::Close();
+ CAutoLock cAutoLock(&m_csQueueLock);
+ if(m_pSubPicQueue) m_pSubPicQueue->Invalidate();
+ m_pSubPicQueue = NULL;
+
+ if(m_hfont) {DeleteObject(m_hfont); m_hfont = 0;}
+ if(m_hbm) {DeleteObject(m_hbm); m_hbm = 0;}
+ if(m_hdc) {DeleteObject(m_hdc); m_hdc = 0;}
+
+ for(ptrdiff_t i = 0; i < m_pTextInput.GetCount(); i++)
+ delete m_pTextInput[i];
+
+ m_frd.EndThreadEvent.Set();
+ CAMThread::Close();
}
STDMETHODIMP CDirectVobSubFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
CheckPointer(ppv, E_POINTER);
- return
- QI(IDirectVobSub)
- QI(IDirectVobSub2)
- QI(IFilterVersion)
- QI(ISpecifyPropertyPages)
- QI(IAMStreamSelect)
- __super::NonDelegatingQueryInterface(riid, ppv);
+ return
+ QI(IDirectVobSub)
+ QI(IDirectVobSub2)
+ QI(IFilterVersion)
+ QI(ISpecifyPropertyPages)
+ QI(IAMStreamSelect)
+ __super::NonDelegatingQueryInterface(riid, ppv);
}
// CBaseVideoFilter
void CDirectVobSubFilter::GetOutputSize(int& w, int& h, int& arx, int& ary)
{
- CSize s(w, h), os = s;
- AdjustFrameSize(s);
- w = s.cx;
- h = s.cy;
-
- if(w != os.cx)
- {
- while(arx < 100) arx *= 10, ary *= 10;
- arx = arx * w / os.cx;
- }
-
- if(h != os.cy)
- {
- while(ary < 100) arx *= 10, ary *= 10;
- ary = ary * h / os.cy;
- }
+ CSize s(w, h), os = s;
+ AdjustFrameSize(s);
+ w = s.cx;
+ h = s.cy;
+
+ if(w != os.cx)
+ {
+ while(arx < 100) arx *= 10, ary *= 10;
+ arx = arx * w / os.cx;
+ }
+
+ if(h != os.cy)
+ {
+ while(ary < 100) arx *= 10, ary *= 10;
+ ary = ary * h / os.cy;
+ }
}
HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
{
- HRESULT hr;
-
+ HRESULT hr;
- REFERENCE_TIME rtStart, rtStop;
- if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
- {
- double dRate = m_pInput->CurrentRate();
- m_tPrev = m_pInput->CurrentStartTime() + dRate * rtStart;
+ REFERENCE_TIME rtStart, rtStop;
+ if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
+ {
+ double dRate = m_pInput->CurrentRate();
+
+ m_tPrev = m_pInput->CurrentStartTime() + dRate*rtStart;
- REFERENCE_TIME rtAvgTimePerFrame = rtStop - rtStart;
- if(CComQIPtr<ISubClock2> pSC2 = m_pSubClock)
- {
- REFERENCE_TIME rt;
- if(S_OK == pSC2->GetAvgTimePerFrame(&rt))
- rtAvgTimePerFrame = rt;
- }
+ REFERENCE_TIME rtAvgTimePerFrame = rtStop - rtStart;
+ if(CComQIPtr<ISubClock2> pSC2 = m_pSubClock)
+ {
+ REFERENCE_TIME rt;
+ if(S_OK == pSC2->GetAvgTimePerFrame(&rt))
+ rtAvgTimePerFrame = rt;
+ }
- m_fps = 10000000.0 / rtAvgTimePerFrame / dRate;
- }
+ m_fps = 10000000.0/rtAvgTimePerFrame / dRate;
+ }
- //
+ //
- {
- CAutoLock cAutoLock(&m_csQueueLock);
+ {
+ CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue)
- {
- m_pSubPicQueue->SetTime(CalcCurrentTime());
- m_pSubPicQueue->SetFPS(m_fps);
- }
- }
+ if(m_pSubPicQueue)
+ {
+ m_pSubPicQueue->SetTime(CalcCurrentTime());
+ m_pSubPicQueue->SetFPS(m_fps);
+ }
+ }
- //
+ //
- BYTE* pDataIn = NULL;
- if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn)
- return S_FALSE;
+ BYTE* pDataIn = NULL;
+ if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn)
+ return S_FALSE;
- const CMediaType& mt = m_pInput->CurrentMediaType();
+ const CMediaType& mt = m_pInput->CurrentMediaType();
- BITMAPINFOHEADER bihIn;
- ExtractBIH(&mt, &bihIn);
+ BITMAPINFOHEADER bihIn;
+ ExtractBIH(&mt, &bihIn);
- bool fYV12 = (mt.subtype == MEDIASUBTYPE_YV12 || mt.subtype == MEDIASUBTYPE_I420 || mt.subtype == MEDIASUBTYPE_IYUV);
- int bpp = fYV12 ? 8 : bihIn.biBitCount;
- DWORD black = fYV12 ? 0x10101010 : (bihIn.biCompression == '2YUY') ? 0x80108010 : 0;
+ bool fYV12 = (mt.subtype == MEDIASUBTYPE_YV12 || mt.subtype == MEDIASUBTYPE_I420 || mt.subtype == MEDIASUBTYPE_IYUV);
+ int bpp = fYV12 ? 8 : bihIn.biBitCount;
+ DWORD black = fYV12 ? 0x10101010 : (bihIn.biCompression == '2YUY') ? 0x80108010 : 0;
- CSize sub(m_w, m_h);
- CSize in(bihIn.biWidth, bihIn.biHeight);
+ CSize sub(m_w, m_h);
+ CSize in(bihIn.biWidth, bihIn.biHeight);
- if(FAILED(Copy((BYTE*)m_pTempPicBuff, pDataIn, sub, in, bpp, mt.subtype, black)))
- return E_FAIL;
+ if(FAILED(Copy((BYTE*)m_pTempPicBuff, pDataIn, sub, in, bpp, mt.subtype, black)))
+ return E_FAIL;
- if(fYV12)
- {
- BYTE* pSubV = (BYTE*)m_pTempPicBuff + (sub.cx * bpp >> 3) * sub.cy;
- BYTE* pInV = pDataIn + (in.cx * bpp >> 3) * in.cy;
- sub.cx >>= 1;
- sub.cy >>= 1;
- in.cx >>= 1;
- in.cy >>= 1;
- BYTE* pSubU = pSubV + (sub.cx * bpp >> 3) * sub.cy;
- BYTE* pInU = pInV + (in.cx * bpp >> 3) * in.cy;
- if(FAILED(Copy(pSubV, pInV, sub, in, bpp, mt.subtype, 0x80808080)))
- return E_FAIL;
- if(FAILED(Copy(pSubU, pInU, sub, in, bpp, mt.subtype, 0x80808080)))
- return E_FAIL;
- }
+ if(fYV12)
+ {
+ BYTE* pSubV = (BYTE*)m_pTempPicBuff + (sub.cx*bpp>>3)*sub.cy;
+ BYTE* pInV = pDataIn + (in.cx*bpp>>3)*in.cy;
+ sub.cx >>= 1; sub.cy >>= 1; in.cx >>= 1; in.cy >>= 1;
+ BYTE* pSubU = pSubV + (sub.cx*bpp>>3)*sub.cy;
+ BYTE* pInU = pInV + (in.cx*bpp>>3)*in.cy;
+ if(FAILED(Copy(pSubV, pInV, sub, in, bpp, mt.subtype, 0x80808080)))
+ return E_FAIL;
+ if(FAILED(Copy(pSubU, pInU, sub, in, bpp, mt.subtype, 0x80808080)))
+ return E_FAIL;
+ }
- //
+ //
- SubPicDesc spd = m_spd;
+ SubPicDesc spd = m_spd;
- CComPtr<IMediaSample> pOut;
- BYTE* pDataOut = NULL;
- if(FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
- || FAILED(hr = pOut->GetPointer(&pDataOut)))
- return hr;
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
- pOut->SetTime(&rtStart, &rtStop);
- pOut->SetMediaTime(NULL, NULL);
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
- pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
- pOut->SetSyncPoint(pIn->IsSyncPoint() == S_OK);
- pOut->SetPreroll(pIn->IsPreroll() == S_OK);
+ pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
+ pOut->SetSyncPoint(pIn->IsSyncPoint() == S_OK);
+ pOut->SetPreroll(pIn->IsPreroll() == S_OK);
- //
+ //
- BITMAPINFOHEADER bihOut;
- ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
- bool fInputFlipped = bihIn.biHeight >= 0 && bihIn.biCompression <= 3;
- bool fOutputFlipped = bihOut.biHeight >= 0 && bihOut.biCompression <= 3;
+ bool fInputFlipped = bihIn.biHeight >= 0 && bihIn.biCompression <= 3;
+ bool fOutputFlipped = bihOut.biHeight >= 0 && bihOut.biCompression <= 3;
- bool fFlip = fInputFlipped != fOutputFlipped;
- if(m_fFlipPicture) fFlip = !fFlip;
- if(m_fMSMpeg4Fix) fFlip = !fFlip;
+ bool fFlip = fInputFlipped != fOutputFlipped;
+ if(m_fFlipPicture) fFlip = !fFlip;
+ if(m_fMSMpeg4Fix) fFlip = !fFlip;
- bool fFlipSub = fOutputFlipped;
- if(m_fFlipSubtitles) fFlipSub = !fFlipSub;
+ bool fFlipSub = fOutputFlipped;
+ if(m_fFlipSubtitles) fFlipSub = !fFlipSub;
- //
+ //
- {
- CAutoLock cAutoLock(&m_csQueueLock);
+ {
+ CAutoLock cAutoLock(&m_csQueueLock);
- if(m_pSubPicQueue)
- {
- CComPtr<ISubPic> pSubPic;
- if(SUCCEEDED(m_pSubPicQueue->LookupSubPic(CalcCurrentTime(), pSubPic)) && pSubPic)
- {
- CRect r;
- pSubPic->GetDirtyRect(r);
+ if(m_pSubPicQueue)
+ {
+ CComPtr<ISubPic> pSubPic;
+ if(SUCCEEDED(m_pSubPicQueue->LookupSubPic(CalcCurrentTime(), pSubPic)) && pSubPic)
+ {
+ CRect r;
+ pSubPic->GetDirtyRect(r);
- if(fFlip ^ fFlipSub)
- spd.h = -spd.h;
+ if(fFlip ^ fFlipSub)
+ spd.h = -spd.h;
- pSubPic->AlphaBlt(r, r, &spd);
- }
- }
- }
+ pSubPic->AlphaBlt(r, r, &spd);
+ }
+ }
+ }
- CopyBuffer(pDataOut, (BYTE*)spd.bits, spd.w, abs(spd.h)*(fFlip ? -1 : 1), spd.pitch, mt.subtype);
+ CopyBuffer(pDataOut, (BYTE*)spd.bits, spd.w, abs(spd.h)*(fFlip?-1:1), spd.pitch, mt.subtype);
- PrintMessages(pDataOut);
+ PrintMessages(pDataOut);
- return m_pOutput->Deliver(pOut);
+ return m_pOutput->Deliver(pOut);
}
// CBaseFilter
CBasePin* CDirectVobSubFilter::GetPin(int n)
{
- if(n < __super::GetPinCount())
- return __super::GetPin(n);
+ if(n < __super::GetPinCount())
+ return __super::GetPin(n);
- n -= __super::GetPinCount();
+ n -= __super::GetPinCount();
- if(n >= 0 && n < m_pTextInput.GetCount())
- return m_pTextInput[n];
+ if(n >= 0 && n < m_pTextInput.GetCount())
+ return m_pTextInput[n];
- n -= m_pTextInput.GetCount();
+ n -= m_pTextInput.GetCount();
- return NULL;
+ return NULL;
}
int CDirectVobSubFilter::GetPinCount()
{
- return __super::GetPinCount() + m_pTextInput.GetCount();
+ return __super::GetPinCount() + m_pTextInput.GetCount();
}
HRESULT CDirectVobSubFilter::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName)
{
- if(pGraph)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- if(!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0))
- {
- unsigned __int64 ver = GetFileVersion(_T("divx_c32.ax"));
- if(((ver >> 48) & 0xffff) == 4 && ((ver >> 32) & 0xffff) == 2)
- {
- DWORD dwVersion = GetVersion();
- DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-
- if(dwVersion < 0x80000000 && dwWindowsMajorVersion >= 5)
- {
- AfxMessageBox(IDS_DIVX_WARNING);
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 1);
- }
- }
- }
-
- /*removeme*/
- if(!g_RegOK)
- {
- DllRegisterServer();
- g_RegOK = true;
- }
- }
- else
- {
- if(m_hSystrayThread)
- {
- SendMessage(m_tbid.hSystrayWnd, WM_CLOSE, 0, 0);
-
- if(WaitForSingleObject(m_hSystrayThread, 10000) != WAIT_OBJECT_0)
- {
- DbgLog((LOG_TRACE, 0, _T("CALL THE AMBULANCE!!!")));
- TerminateThread(m_hSystrayThread, (DWORD) - 1);
- }
-
- m_hSystrayThread = 0;
- }
- }
-
- return __super::JoinFilterGraph(pGraph, pName);
+ if(pGraph)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0))
+ {
+ unsigned __int64 ver = GetFileVersion(_T("divx_c32.ax"));
+ if(((ver >> 48)&0xffff) == 4 && ((ver >> 32)&0xffff) == 2)
+ {
+ DWORD dwVersion = GetVersion();
+ DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
+ DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
+
+ if(dwVersion < 0x80000000 && dwWindowsMajorVersion >= 5)
+ {
+ AfxMessageBox(IDS_DIVX_WARNING);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 1);
+ }
+ }
+ }
+
+ /*removeme*/
+ if(!g_RegOK)
+ {
+ DllRegisterServer();
+ g_RegOK = true;
+ }
+ }
+ else
+ {
+ if(m_hSystrayThread)
+ {
+ SendMessage(m_tbid.hSystrayWnd, WM_CLOSE, 0, 0);
+
+ if(WaitForSingleObject(m_hSystrayThread, 10000) != WAIT_OBJECT_0)
+ {
+ DbgLog((LOG_TRACE, 0, _T("CALL THE AMBULANCE!!!")));
+ TerminateThread(m_hSystrayThread, (DWORD)-1);
+ }
+
+ m_hSystrayThread = 0;
+ }
+ }
+
+ return __super::JoinFilterGraph(pGraph, pName);
}
STDMETHODIMP CDirectVobSubFilter::QueryFilterInfo(FILTER_INFO* pInfo)
@@ -367,140 +352,140 @@ STDMETHODIMP CDirectVobSubFilter::QueryFilterInfo(FILTER_INFO* pInfo)
CheckPointer(pInfo, E_POINTER);
ValidateReadWritePtr(pInfo, sizeof(FILTER_INFO));
- if(!get_Forced())
- return __super::QueryFilterInfo(pInfo);
-
- wcscpy(pInfo->achName, L"DirectVobSub (forced auto-loading version)");
- if(pInfo->pGraph = m_pGraph) m_pGraph->AddRef();
+ if(!get_Forced())
+ return __super::QueryFilterInfo(pInfo);
- return S_OK;
+ wcscpy(pInfo->achName, L"DirectVobSub (forced auto-loading version)");
+ if(pInfo->pGraph = m_pGraph) m_pGraph->AddRef();
+
+ return S_OK;
}
// CTransformFilter
HRESULT CDirectVobSubFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
{
- HRESULT hr = __super::SetMediaType(dir, pmt);
- if(FAILED(hr)) return hr;
+ HRESULT hr = __super::SetMediaType(dir, pmt);
+ if(FAILED(hr)) return hr;
- if(dir == PINDIR_INPUT)
- {
- CAutoLock cAutoLock(&m_csReceive);
+ if(dir == PINDIR_INPUT)
+ {
+ CAutoLock cAutoLock(&m_csReceive);
- REFERENCE_TIME atpf =
- pmt->formattype == FORMAT_VideoInfo ? ((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame :
- pmt->formattype == FORMAT_VideoInfo2 ? ((VIDEOINFOHEADER2*)pmt->Format())->AvgTimePerFrame :
- 0;
+ REFERENCE_TIME atpf =
+ pmt->formattype == FORMAT_VideoInfo ? ((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame :
+ pmt->formattype == FORMAT_VideoInfo2 ? ((VIDEOINFOHEADER2*)pmt->Format())->AvgTimePerFrame :
+ 0;
- m_fps = atpf ? 10000000.0 / atpf : 25;
+ m_fps = atpf ? 10000000.0 / atpf : 25;
- if(pmt->formattype == FORMAT_VideoInfo2)
- m_CurrentVIH2 = *(VIDEOINFOHEADER2*)pmt->Format();
+ if (pmt->formattype == FORMAT_VideoInfo2)
+ m_CurrentVIH2 = *(VIDEOINFOHEADER2*)pmt->Format();
InitSubPicQueue();
- }
- else if(dir == PINDIR_OUTPUT)
- {
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
- }
+ }
- return hr;
+ return hr;
}
HRESULT CDirectVobSubFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
{
- if(dir == PINDIR_INPUT)
- {
- }
- else if(dir == PINDIR_OUTPUT)
- {
- /*removeme*/
- if(HmGyanusVagyTeNekem(pPin)) return(E_FAIL);
- }
-
- return __super::CheckConnect(dir, pPin);
+ if(dir == PINDIR_INPUT)
+ {
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ /*removeme*/
+ if(HmGyanusVagyTeNekem(pPin)) return(E_FAIL);
+ }
+
+ return __super::CheckConnect(dir, pPin);
}
HRESULT CDirectVobSubFilter::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin)
{
- if(dir == PINDIR_INPUT)
- {
- CComPtr<IBaseFilter> pFilter;
-
- // needed when we have a decoder with a version number of 3.x
- if(SUCCEEDED(m_pGraph->FindFilterByName(L"DivX MPEG-4 DVD Video Decompressor ", &pFilter))
- && (GetFileVersion(_T("divx_c32.ax")) >> 48) <= 4
- || SUCCEEDED(m_pGraph->FindFilterByName(L"Microcrap MPEG-4 Video Decompressor", &pFilter))
- || SUCCEEDED(m_pGraph->FindFilterByName(L"Microsoft MPEG-4 Video Decompressor", &pFilter))
- && (GetFileVersion(_T("mpg4ds32.ax")) >> 48) <= 3)
- {
- m_fMSMpeg4Fix = true;
- }
- }
- else if(dir == PINDIR_OUTPUT)
- {
- if(!m_hSystrayThread)
- {
- m_tbid.graph = m_pGraph;
- m_tbid.dvs = static_cast<IDirectVobSub*>(this);
-
- DWORD tid;
- m_hSystrayThread = CreateThread(0, 0, SystrayThreadProc, &m_tbid, 0, &tid);
- }
-
- // HACK: triggers CBaseVideoFilter::SetMediaType to adjust m_w/m_h/.. and InitSubPicQueue() to realloc buffers
- m_pInput->SetMediaType(&m_pInput->CurrentMediaType());
- }
-
- return __super::CompleteConnect(dir, pReceivePin);
+ if(dir == PINDIR_INPUT)
+ {
+ CComPtr<IBaseFilter> pFilter;
+
+ // needed when we have a decoder with a version number of 3.x
+ if(SUCCEEDED(m_pGraph->FindFilterByName(L"DivX MPEG-4 DVD Video Decompressor ", &pFilter))
+ && (GetFileVersion(_T("divx_c32.ax")) >> 48) <= 4
+ || SUCCEEDED(m_pGraph->FindFilterByName(L"Microcrap MPEG-4 Video Decompressor", &pFilter))
+ || SUCCEEDED(m_pGraph->FindFilterByName(L"Microsoft MPEG-4 Video Decompressor", &pFilter))
+ && (GetFileVersion(_T("mpg4ds32.ax")) >> 48) <= 3)
+ {
+ m_fMSMpeg4Fix = true;
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ if(!m_hSystrayThread)
+ {
+ m_tbid.graph = m_pGraph;
+ m_tbid.dvs = static_cast<IDirectVobSub*>(this);
+
+ DWORD tid;
+ m_hSystrayThread = CreateThread(0, 0, SystrayThreadProc, &m_tbid, 0, &tid);
+ }
+
+ // HACK: triggers CBaseVideoFilter::SetMediaType to adjust m_w/m_h/.. and InitSubPicQueue() to realloc buffers
+ m_pInput->SetMediaType(&m_pInput->CurrentMediaType());
+ }
+
+ return __super::CompleteConnect(dir, pReceivePin);
}
HRESULT CDirectVobSubFilter::BreakConnect(PIN_DIRECTION dir)
{
- if(dir == PINDIR_INPUT)
- {
- if(m_pOutput->IsConnected())
- {
- m_pOutput->GetConnected()->Disconnect();
- m_pOutput->Disconnect();
- }
- }
- else if(dir == PINDIR_OUTPUT)
- {
- // not really needed, but may free up a little memory
- CAutoLock cAutoLock(&m_csQueueLock);
- m_pSubPicQueue = NULL;
- }
-
- return __super::BreakConnect(dir);
+ if(dir == PINDIR_INPUT)
+ {
+ if(m_pOutput->IsConnected())
+ {
+ m_pOutput->GetConnected()->Disconnect();
+ m_pOutput->Disconnect();
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ // not really needed, but may free up a little memory
+ CAutoLock cAutoLock(&m_csQueueLock);
+ m_pSubPicQueue = NULL;
+ }
+
+ return __super::BreakConnect(dir);
}
HRESULT CDirectVobSubFilter::StartStreaming()
{
- // WARNING : calls to m_pGraph member functions from here will generate deadlock with Haali Renderer
- // within MPC-HC (reason is CAutoLock's variables in IFilterGraph functions overriden by CFGManager class)
+ // WARNING : calls to m_pGraph member functions from here will generate deadlock with Haali Renderer
+ // within MPC-HC (reason is CAutoLock's variables in IFilterGraph functions overriden by CFGManager class)
- m_fLoading = false;
+ m_fLoading = false;
- InitSubPicQueue();
+ InitSubPicQueue();
- m_tbid.fRunOnce = true;
+ m_tbid.fRunOnce = true;
- put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
+ put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
- return __super::StartStreaming();
+ return __super::StartStreaming();
}
HRESULT CDirectVobSubFilter::StopStreaming()
{
- InvalidateSubtitle();
+ InvalidateSubtitle();
- return __super::StopStreaming();
+ return __super::StopStreaming();
}
HRESULT CDirectVobSubFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- m_tPrev = tStart;
+ m_tPrev = tStart;
return __super::NewSegment(tStart, tStop, dRate);
}
@@ -508,351 +493,327 @@ HRESULT CDirectVobSubFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tS
REFERENCE_TIME CDirectVobSubFilter::CalcCurrentTime()
{
- REFERENCE_TIME rt = m_pSubClock ? m_pSubClock->GetTime() : m_tPrev;
- return (rt - 10000i64 * m_SubtitleDelay) * m_SubtitleSpeedMul / m_SubtitleSpeedDiv; // no, it won't overflow if we use normal parameters (__int64 is enough for about 2000 hours if we multiply it by the max: 65536 as m_SubtitleSpeedMul)
+ REFERENCE_TIME rt = m_pSubClock ? m_pSubClock->GetTime() : m_tPrev;
+ return (rt - 10000i64*m_SubtitleDelay) * m_SubtitleSpeedMul / m_SubtitleSpeedDiv; // no, it won't overflow if we use normal parameters (__int64 is enough for about 2000 hours if we multiply it by the max: 65536 as m_SubtitleSpeedMul)
}
void CDirectVobSubFilter::InitSubPicQueue()
{
- CAutoLock cAutoLock(&m_csQueueLock);
-
- m_pSubPicQueue = NULL;
-
- m_pTempPicBuff.Free();
- m_pTempPicBuff.Allocate(4 * m_w * m_h);
-
- const GUID& subtype = m_pInput->CurrentMediaType().subtype;
-
- BITMAPINFOHEADER bihIn;
- ExtractBIH(&m_pInput->CurrentMediaType(), &bihIn);
-
- m_spd.type = -1;
- if(subtype == MEDIASUBTYPE_YV12) m_spd.type = MSP_YV12;
- else if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) m_spd.type = MSP_IYUV;
- else if(subtype == MEDIASUBTYPE_YUY2) m_spd.type = MSP_YUY2;
- else if(subtype == MEDIASUBTYPE_RGB32) m_spd.type = MSP_RGB32;
- else if(subtype == MEDIASUBTYPE_RGB24) m_spd.type = MSP_RGB24;
- else if(subtype == MEDIASUBTYPE_RGB565) m_spd.type = MSP_RGB16;
- else if(subtype == MEDIASUBTYPE_RGB555) m_spd.type = MSP_RGB15;
- m_spd.w = m_w;
- m_spd.h = m_h;
- m_spd.bpp = (m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV) ? 8 : bihIn.biBitCount;
- m_spd.pitch = m_spd.w * m_spd.bpp >> 3;
- m_spd.bits = (void*)m_pTempPicBuff;
-
- CComPtr<ISubPicAllocator> pSubPicAllocator = new CMemSubPicAllocator(m_spd.type, CSize(m_w, m_h));
-
- CSize video(bihIn.biWidth, bihIn.biHeight), window = video;
- if(AdjustFrameSize(window)) video += video;
- ASSERT(window == CSize(m_w, m_h));
-
- pSubPicAllocator->SetCurSize(window);
- pSubPicAllocator->SetCurVidRect(CRect(CPoint((window.cx - video.cx) / 2, (window.cy - video.cy) / 2), video));
-
- HRESULT hr = S_OK;
- m_pSubPicQueue = m_fDoPreBuffering
- ? (ISubPicQueue*)new CSubPicQueue(10, false, pSubPicAllocator, &hr)
- : (ISubPicQueue*)new CSubPicQueueNoThread(pSubPicAllocator, &hr);
-
- if(FAILED(hr)) m_pSubPicQueue = NULL;
-
- UpdateSubtitle(false);
-
- if(m_hbm)
- {
- DeleteObject(m_hbm);
- m_hbm = NULL;
- }
- if(m_hdc)
- {
- DeleteDC(m_hdc);
- m_hdc = NULL;
- }
-
- struct
- {
- BITMAPINFOHEADER bih;
- DWORD mask[3];
- } b = {{sizeof(BITMAPINFOHEADER), m_w, -(int)m_h, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0}, 0xFF0000, 0x00FF00, 0x0000FF};
- m_hdc = CreateCompatibleDC(NULL);
- m_hbm = CreateDIBSection(m_hdc, (BITMAPINFO*)&b, DIB_RGB_COLORS, NULL, NULL, 0);
-
- BITMAP bm;
- GetObject(m_hbm, sizeof(bm), &bm);
- memsetd(bm.bmBits, 0xFF000000, bm.bmHeight * bm.bmWidthBytes);
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ m_pSubPicQueue = NULL;
+
+ m_pTempPicBuff.Free();
+ m_pTempPicBuff.Allocate(4*m_w*m_h);
+
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ BITMAPINFOHEADER bihIn;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bihIn);
+
+ m_spd.type = -1;
+ if(subtype == MEDIASUBTYPE_YV12) m_spd.type = MSP_YV12;
+ else if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) m_spd.type = MSP_IYUV;
+ else if(subtype == MEDIASUBTYPE_YUY2) m_spd.type = MSP_YUY2;
+ else if(subtype == MEDIASUBTYPE_RGB32) m_spd.type = MSP_RGB32;
+ else if(subtype == MEDIASUBTYPE_RGB24) m_spd.type = MSP_RGB24;
+ else if(subtype == MEDIASUBTYPE_RGB565) m_spd.type = MSP_RGB16;
+ else if(subtype == MEDIASUBTYPE_RGB555) m_spd.type = MSP_RGB15;
+ m_spd.w = m_w;
+ m_spd.h = m_h;
+ m_spd.bpp = (m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV) ? 8 : bihIn.biBitCount;
+ m_spd.pitch = m_spd.w*m_spd.bpp>>3;
+ m_spd.bits = (void*)m_pTempPicBuff;
+
+ CComPtr<ISubPicAllocator> pSubPicAllocator = new CMemSubPicAllocator(m_spd.type, CSize(m_w, m_h));
+
+ CSize video(bihIn.biWidth, bihIn.biHeight), window = video;
+ if(AdjustFrameSize(window)) video += video;
+ ASSERT(window == CSize(m_w, m_h));
+
+ pSubPicAllocator->SetCurSize(window);
+ pSubPicAllocator->SetCurVidRect(CRect(CPoint((window.cx - video.cx)/2, (window.cy - video.cy)/2), video));
+
+ HRESULT hr = S_OK;
+ m_pSubPicQueue = m_fDoPreBuffering
+ ? (ISubPicQueue*)new CSubPicQueue(10, false, pSubPicAllocator, &hr)
+ : (ISubPicQueue*)new CSubPicQueueNoThread(pSubPicAllocator, &hr);
+
+ if(FAILED(hr)) m_pSubPicQueue = NULL;
+
+ UpdateSubtitle(false);
+
+ if(m_hbm) {DeleteObject(m_hbm); m_hbm = NULL;}
+ if(m_hdc) {DeleteDC(m_hdc); m_hdc = NULL;}
+
+ struct {BITMAPINFOHEADER bih; DWORD mask[3];} b = {{sizeof(BITMAPINFOHEADER), m_w, -(int)m_h, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0}, 0xFF0000, 0x00FF00, 0x0000FF};
+ m_hdc = CreateCompatibleDC(NULL);
+ m_hbm = CreateDIBSection(m_hdc, (BITMAPINFO*)&b, DIB_RGB_COLORS, NULL, NULL, 0);
+
+ BITMAP bm;
+ GetObject(m_hbm, sizeof(bm), &bm);
+ memsetd(bm.bmBits, 0xFF000000, bm.bmHeight*bm.bmWidthBytes);
}
bool CDirectVobSubFilter::AdjustFrameSize(CSize& s)
{
- int horizontal, vertical, resx2, resx2minw, resx2minh;
- get_ExtendPicture(&horizontal, &vertical, &resx2, &resx2minw, &resx2minh);
-
- bool fRet = (resx2 == 1) || (resx2 == 2 && s.cx*s.cy <= resx2minw * resx2minh);
-
- if(fRet)
- {
- s.cx <<= 1;
- s.cy <<= 1;
- }
-
- int h;
- switch(vertical & 0x7f)
- {
- case 1:
- h = s.cx * 9 / 16;
- if(s.cy < h || !!(vertical & 0x80)) s.cy = (h + 3) & ~3;
- break;
- case 2:
- h = s.cx * 3 / 4;
- if(s.cy < h || !!(vertical & 0x80)) s.cy = (h + 3) & ~3;
- break;
- case 3:
- h = 480;
- if(s.cy < h || !!(vertical & 0x80)) s.cy = (h + 3) & ~3;
- break;
- case 4:
- h = 576;
- if(s.cy < h || !!(vertical & 0x80)) s.cy = (h + 3) & ~3;
- break;
- }
-
- if(horizontal == 1)
- {
- s.cx = (s.cx + 31) & ~31;
- s.cy = (s.cy + 1) & ~1;
- }
-
- return(fRet);
+ int horizontal, vertical, resx2, resx2minw, resx2minh;
+ get_ExtendPicture(&horizontal, &vertical, &resx2, &resx2minw, &resx2minh);
+
+ bool fRet = (resx2 == 1) || (resx2 == 2 && s.cx*s.cy <= resx2minw*resx2minh);
+
+ if(fRet)
+ {
+ s.cx <<= 1;
+ s.cy <<= 1;
+ }
+
+ int h;
+ switch(vertical&0x7f)
+ {
+ case 1:
+ h = s.cx * 9 / 16;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ case 2:
+ h = s.cx * 3 / 4;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ case 3:
+ h = 480;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ case 4:
+ h = 576;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ }
+
+ if(horizontal == 1)
+ {
+ s.cx = (s.cx + 31) & ~31;
+ s.cy = (s.cy + 1) & ~1;
+ }
+
+ return(fRet);
}
STDMETHODIMP CDirectVobSubFilter::Count(DWORD* pcStreams)
{
- if(!pcStreams) return E_POINTER;
+ if(!pcStreams) return E_POINTER;
- *pcStreams = 0;
+ *pcStreams = 0;
- int nLangs = 0;
- if(SUCCEEDED(get_LanguageCount(&nLangs)))
- (*pcStreams) += nLangs;
+ int nLangs = 0;
+ if(SUCCEEDED(get_LanguageCount(&nLangs)))
+ (*pcStreams) += nLangs;
- (*pcStreams) += 2; // enable ... disable
+ (*pcStreams) += 2; // enable ... disable
- (*pcStreams) += 2; // normal flipped
+ (*pcStreams) += 2; // normal flipped
- return S_OK;
+ return S_OK;
}
#define MAXPREFLANGS 5
int CDirectVobSubFilter::FindPreferedLanguage(bool fHideToo)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- int nLangs;
- get_LanguageCount(&nLangs);
-
- if(nLangs <= 0) return(0);
-
- for(ptrdiff_t i = 0; i < MAXPREFLANGS; i++)
- {
- CString tmp;
- tmp.Format(IDS_RL_LANG, i);
-
- CString lang = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
-
- if(!lang.IsEmpty())
- {
- for(ptrdiff_t ret = 0; ret < nLangs; ret++)
- {
- CString l;
- WCHAR* pName = NULL;
- get_LanguageName(ret, &pName);
- l = pName;
- CoTaskMemFree(pName);
-
- if(!l.CompareNoCase(lang)) return(ret);
- }
- }
- }
-
- return(0);
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ int nLangs;
+ get_LanguageCount(&nLangs);
+
+ if(nLangs <= 0) return(0);
+
+ for(ptrdiff_t i = 0; i < MAXPREFLANGS; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RL_LANG, i);
+
+ CString lang = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
+
+ if(!lang.IsEmpty())
+ {
+ for(ptrdiff_t ret = 0; ret < nLangs; ret++)
+ {
+ CString l;
+ WCHAR* pName = NULL;
+ get_LanguageName(ret, &pName);
+ l = pName;
+ CoTaskMemFree(pName);
+
+ if(!l.CompareNoCase(lang)) return(ret);
+ }
+ }
+ }
+
+ return(0);
}
void CDirectVobSubFilter::UpdatePreferedLanguages(CString l)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CString langs[MAXPREFLANGS+1];
-
- int i = 0, j = 0, k = -1;
- for(; i < MAXPREFLANGS; i++)
- {
- CString tmp;
- tmp.Format(IDS_RL_LANG, i);
-
- langs[j] = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
-
- if(!langs[j].IsEmpty())
- {
- if(!langs[j].CompareNoCase(l)) k = j;
- j++;
- }
- }
-
- if(k == -1)
- {
- langs[k = j] = l;
- j++;
- }
-
- // move the selected to the top of the list
-
- while(k > 0)
- {
- CString tmp = langs[k];
- langs[k] = langs[k-1];
- langs[k-1] = tmp;
- k--;
- }
-
- // move "Hide subtitles" to the last position if it wasn't our selection
-
- CString hidesubs;
- hidesubs.LoadString(IDS_M_HIDESUBTITLES);
-
- for(k = 1; k < j; k++)
- {
- if(!langs[k].CompareNoCase(hidesubs)) break;
- }
-
- while(k < j - 1)
- {
- CString tmp = langs[k];
- langs[k] = langs[k+1];
- langs[k+1] = tmp;
- k++;
- }
-
- for(i = 0; i < j; i++)
- {
- CString tmp;
- tmp.Format(IDS_RL_LANG, i);
-
- theApp.WriteProfileString(ResStr(IDS_R_PREFLANGS), tmp, langs[i]);
- }
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CString langs[MAXPREFLANGS+1];
+
+ int i = 0, j = 0, k = -1;
+ for(; i < MAXPREFLANGS; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RL_LANG, i);
+
+ langs[j] = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
+
+ if(!langs[j].IsEmpty())
+ {
+ if(!langs[j].CompareNoCase(l)) k = j;
+ j++;
+ }
+ }
+
+ if(k == -1)
+ {
+ langs[k = j] = l;
+ j++;
+ }
+
+ // move the selected to the top of the list
+
+ while(k > 0)
+ {
+ CString tmp = langs[k]; langs[k] = langs[k-1]; langs[k-1] = tmp;
+ k--;
+ }
+
+ // move "Hide subtitles" to the last position if it wasn't our selection
+
+ CString hidesubs;
+ hidesubs.LoadString(IDS_M_HIDESUBTITLES);
+
+ for(k = 1; k < j; k++)
+ {
+ if(!langs[k].CompareNoCase(hidesubs)) break;
+ }
+
+ while(k < j-1)
+ {
+ CString tmp = langs[k]; langs[k] = langs[k+1]; langs[k+1] = tmp;
+ k++;
+ }
+
+ for(i = 0; i < j; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RL_LANG, i);
+
+ theApp.WriteProfileString(ResStr(IDS_R_PREFLANGS), tmp, langs[i]);
+ }
}
STDMETHODIMP CDirectVobSubFilter::Enable(long lIndex, DWORD dwFlags)
{
- if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE))
- return E_NOTIMPL;
-
- int nLangs = 0;
- get_LanguageCount(&nLangs);
-
- if(!(lIndex >= 0 && lIndex < nLangs + 2 + 2))
- return E_INVALIDARG;
-
- int i = lIndex - 1;
-
- if(i == -1 && !m_fLoading) // we need this because when loading something stupid media player pushes the first stream it founds, which is "enable" in our case
- {
- put_HideSubtitles(false);
- }
- else if(i >= 0 && i < nLangs)
- {
- put_HideSubtitles(false);
- put_SelectedLanguage(i);
-
- WCHAR* pName = NULL;
- if(SUCCEEDED(get_LanguageName(i, &pName)))
- {
- UpdatePreferedLanguages(CString(pName));
- if(pName) CoTaskMemFree(pName);
- }
- }
- else if(i == nLangs && !m_fLoading)
- {
- put_HideSubtitles(true);
- }
- else if((i == nLangs + 1 || i == nLangs + 2) && !m_fLoading)
- {
- put_Flip(i == nLangs + 2, m_fFlipSubtitles);
- }
-
- return S_OK;
+ if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE))
+ return E_NOTIMPL;
+
+ int nLangs = 0;
+ get_LanguageCount(&nLangs);
+
+ if(!(lIndex >= 0 && lIndex < nLangs+2+2))
+ return E_INVALIDARG;
+
+ int i = lIndex-1;
+
+ if(i == -1 && !m_fLoading) // we need this because when loading something stupid media player pushes the first stream it founds, which is "enable" in our case
+ {
+ put_HideSubtitles(false);
+ }
+ else if(i >= 0 && i < nLangs)
+ {
+ put_HideSubtitles(false);
+ put_SelectedLanguage(i);
+
+ WCHAR* pName = NULL;
+ if(SUCCEEDED(get_LanguageName(i, &pName)))
+ {
+ UpdatePreferedLanguages(CString(pName));
+ if(pName) CoTaskMemFree(pName);
+ }
+ }
+ else if(i == nLangs && !m_fLoading)
+ {
+ put_HideSubtitles(true);
+ }
+ else if((i == nLangs+1 || i == nLangs+2) && !m_fLoading)
+ {
+ put_Flip(i == nLangs+2, m_fFlipSubtitles);
+ }
+
+ return S_OK;
}
STDMETHODIMP CDirectVobSubFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- int nLangs = 0;
- get_LanguageCount(&nLangs);
-
- if(!(lIndex >= 0 && lIndex < nLangs + 2 + 2))
- return E_INVALIDARG;
-
- int i = lIndex - 1;
-
- if(ppmt) *ppmt = CreateMediaType(&m_pInput->CurrentMediaType());
-
- if(pdwFlags)
- {
- *pdwFlags = 0;
-
- if(i == -1 && !m_fHideSubtitles
- || i >= 0 && i < nLangs && i == m_iSelectedLanguage
- || i == nLangs && m_fHideSubtitles
- || i == nLangs + 1 && !m_fFlipPicture
- || i == nLangs + 2 && m_fFlipPicture)
- {
- *pdwFlags |= AMSTREAMSELECTINFO_ENABLED;
- }
- }
-
- if(plcid) *plcid = 0;
-
- if(pdwGroup) *pdwGroup = 0x648E51;
-
- if(ppszName)
- {
- *ppszName = NULL;
-
- CStringW str;
- if(i == -1) str = ResStr(IDS_M_SHOWSUBTITLES);
- else if(i >= 0 && i < nLangs) get_LanguageName(i, ppszName);
- else if(i == nLangs) str = ResStr(IDS_M_HIDESUBTITLES);
- else if(i == nLangs + 1)
- {
- str = ResStr(IDS_M_ORIGINALPICTURE);
- if(pdwGroup)(*pdwGroup)++;
- }
- else if(i == nLangs + 2)
- {
- str = ResStr(IDS_M_FLIPPEDPICTURE);
- if(pdwGroup)(*pdwGroup)++;
- }
-
- if(!str.IsEmpty())
- {
- *ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength() + 1) * sizeof(WCHAR));
- if(*ppszName == NULL) return S_FALSE;
- wcscpy(*ppszName, str);
- }
- }
-
- if(ppObject) *ppObject = NULL;
-
- if(ppUnk) *ppUnk = NULL;
-
- return S_OK;
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ int nLangs = 0;
+ get_LanguageCount(&nLangs);
+
+ if(!(lIndex >= 0 && lIndex < nLangs+2+2))
+ return E_INVALIDARG;
+
+ int i = lIndex-1;
+
+ if(ppmt) *ppmt = CreateMediaType(&m_pInput->CurrentMediaType());
+
+ if(pdwFlags)
+ {
+ *pdwFlags = 0;
+
+ if(i == -1 && !m_fHideSubtitles
+ || i >= 0 && i < nLangs && i == m_iSelectedLanguage
+ || i == nLangs && m_fHideSubtitles
+ || i == nLangs+1 && !m_fFlipPicture
+ || i == nLangs+2 && m_fFlipPicture)
+ {
+ *pdwFlags |= AMSTREAMSELECTINFO_ENABLED;
+ }
+ }
+
+ if(plcid) *plcid = 0;
+
+ if(pdwGroup) *pdwGroup = 0x648E51;
+
+ if(ppszName)
+ {
+ *ppszName = NULL;
+
+ CStringW str;
+ if(i == -1) str = ResStr(IDS_M_SHOWSUBTITLES);
+ else if(i >= 0 && i < nLangs) get_LanguageName(i, ppszName);
+ else if(i == nLangs) str = ResStr(IDS_M_HIDESUBTITLES);
+ else if(i == nLangs+1) {str = ResStr(IDS_M_ORIGINALPICTURE); if(pdwGroup) (*pdwGroup)++;}
+ else if(i == nLangs+2) {str = ResStr(IDS_M_FLIPPEDPICTURE); if(pdwGroup) (*pdwGroup)++;}
+
+ if(!str.IsEmpty())
+ {
+ *ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
+ if(*ppszName == NULL) return S_FALSE;
+ wcscpy(*ppszName, str);
+ }
+ }
+
+ if(ppObject) *ppObject = NULL;
+
+ if(ppUnk) *ppUnk = NULL;
+
+ return S_OK;
}
STDMETHODIMP CDirectVobSubFilter::GetClassID(CLSID* pClsid)
{
if(pClsid == NULL) return E_POINTER;
- *pClsid = m_clsid;
+ *pClsid = m_clsid;
return NOERROR;
}
@@ -860,12 +821,12 @@ STDMETHODIMP CDirectVobSubFilter::GetPages(CAUUID* pPages)
{
CheckPointer(pPages, E_POINTER);
- pPages->cElems = 7;
- pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
+ pPages->cElems = 7;
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID)*pPages->cElems);
- if(pPages->pElems == NULL) return E_OUTOFMEMORY;
+ if(pPages->pElems == NULL) return E_OUTOFMEMORY;
- int i = 0;
+ int i = 0;
pPages->pElems[i++] = __uuidof(CDVSMainPPage);
pPages->pElems[i++] = __uuidof(CDVSGeneralPPage);
pPages->pElems[i++] = __uuidof(CDVSMiscPPage);
@@ -881,765 +842,765 @@ STDMETHODIMP CDirectVobSubFilter::GetPages(CAUUID* pPages)
STDMETHODIMP CDirectVobSubFilter::put_FileName(WCHAR* fn)
{
- HRESULT hr = CDirectVobSub::put_FileName(fn);
+ HRESULT hr = CDirectVobSub::put_FileName(fn);
- if(hr == S_OK && !Open())
- {
- m_FileName.Empty();
- hr = E_FAIL;
- }
+ if(hr == S_OK && !Open())
+ {
+ m_FileName.Empty();
+ hr = E_FAIL;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::get_LanguageCount(int* nLangs)
{
- HRESULT hr = CDirectVobSub::get_LanguageCount(nLangs);
+ HRESULT hr = CDirectVobSub::get_LanguageCount(nLangs);
- if(hr == NOERROR && nLangs)
- {
+ if(hr == NOERROR && nLangs)
+ {
CAutoLock cAutolock(&m_csQueueLock);
- *nLangs = 0;
- POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos)(*nLangs) += m_pSubStreams.GetNext(pos)->GetStreamCount();
- }
+ *nLangs = 0;
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos) (*nLangs) += m_pSubStreams.GetNext(pos)->GetStreamCount();
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::get_LanguageName(int iLanguage, WCHAR** ppName)
{
- HRESULT hr = CDirectVobSub::get_LanguageName(iLanguage, ppName);
+ HRESULT hr = CDirectVobSub::get_LanguageName(iLanguage, ppName);
- if(!ppName) return E_POINTER;
+ if(!ppName) return E_POINTER;
- if(hr == NOERROR)
- {
+ if(hr == NOERROR)
+ {
CAutoLock cAutolock(&m_csQueueLock);
- hr = E_INVALIDARG;
+ hr = E_INVALIDARG;
- int i = iLanguage;
+ int i = iLanguage;
- POSITION pos = m_pSubStreams.GetHeadPosition();
- while(i >= 0 && pos)
- {
- CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(i >= 0 && pos)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount())
- {
- pSubStream->GetStreamInfo(i, ppName, NULL);
- hr = NOERROR;
- break;
- }
+ if(i < pSubStream->GetStreamCount())
+ {
+ pSubStream->GetStreamInfo(i, ppName, NULL);
+ hr = NOERROR;
+ break;
+ }
- i -= pSubStream->GetStreamCount();
- }
- }
+ i -= pSubStream->GetStreamCount();
+ }
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_SelectedLanguage(int iSelected)
{
- HRESULT hr = CDirectVobSub::put_SelectedLanguage(iSelected);
+ HRESULT hr = CDirectVobSub::put_SelectedLanguage(iSelected);
- if(hr == NOERROR)
- {
- UpdateSubtitle(false);
- }
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(false);
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_HideSubtitles(bool fHideSubtitles)
{
- HRESULT hr = CDirectVobSub::put_HideSubtitles(fHideSubtitles);
+ HRESULT hr = CDirectVobSub::put_HideSubtitles(fHideSubtitles);
- if(hr == NOERROR)
- {
- UpdateSubtitle(false);
- }
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(false);
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_PreBuffering(bool fDoPreBuffering)
{
- HRESULT hr = CDirectVobSub::put_PreBuffering(fDoPreBuffering);
+ HRESULT hr = CDirectVobSub::put_PreBuffering(fDoPreBuffering);
- if(hr == NOERROR)
- {
- InitSubPicQueue();
- }
+ if(hr == NOERROR)
+ {
+ InitSubPicQueue();
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_Placement(bool fOverridePlacement, int xperc, int yperc)
{
- HRESULT hr = CDirectVobSub::put_Placement(fOverridePlacement, xperc, yperc);
+ HRESULT hr = CDirectVobSub::put_Placement(fOverridePlacement, xperc, yperc);
- if(hr == NOERROR)
- {
- UpdateSubtitle(true);
- }
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(true);
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fReserved)
{
- HRESULT hr = CDirectVobSub::put_VobSubSettings(fBuffer, fOnlyShowForcedSubs, fReserved);
+ HRESULT hr = CDirectVobSub::put_VobSubSettings(fBuffer, fOnlyShowForcedSubs, fReserved);
- if(hr == NOERROR)
- {
+ if(hr == NOERROR)
+ {
// UpdateSubtitle(false);
- InvalidateSubtitle();
- }
+ InvalidateSubtitle();
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
{
- HRESULT hr = CDirectVobSub::put_TextSettings(lf, lflen, color, fShadow, fOutline, fAdvancedRenderer);
-
- if(hr == NOERROR)
- {
+ HRESULT hr = CDirectVobSub::put_TextSettings(lf, lflen, color, fShadow, fOutline, fAdvancedRenderer);
+
+ if(hr == NOERROR)
+ {
// UpdateSubtitle(true);
- InvalidateSubtitle();
- }
+ InvalidateSubtitle();
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
{
- HRESULT hr = CDirectVobSub::put_SubtitleTiming(delay, speedmul, speeddiv);
+ HRESULT hr = CDirectVobSub::put_SubtitleTiming(delay, speedmul, speeddiv);
- if(hr == NOERROR)
- {
- InvalidateSubtitle();
- }
+ if(hr == NOERROR)
+ {
+ InvalidateSubtitle();
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::get_MediaFPS(bool* fEnabled, double* fps)
{
- HRESULT hr = CDirectVobSub::get_MediaFPS(fEnabled, fps);
+ HRESULT hr = CDirectVobSub::get_MediaFPS(fEnabled, fps);
- CComQIPtr<IMediaSeeking> pMS = m_pGraph;
- double rate;
- if(pMS && SUCCEEDED(pMS->GetRate(&rate)))
- {
- m_MediaFPS = rate * m_fps;
- if(fps) *fps = m_MediaFPS;
- }
+ CComQIPtr<IMediaSeeking> pMS = m_pGraph;
+ double rate;
+ if(pMS && SUCCEEDED(pMS->GetRate(&rate)))
+ {
+ m_MediaFPS = rate * m_fps;
+ if(fps) *fps = m_MediaFPS;
+ }
- return hr;
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_MediaFPS(bool fEnabled, double fps)
{
- HRESULT hr = CDirectVobSub::put_MediaFPS(fEnabled, fps);
-
- CComQIPtr<IMediaSeeking> pMS = m_pGraph;
- if(pMS)
- {
- if(hr == NOERROR)
- {
- hr = pMS->SetRate(m_fMediaFPSEnabled ? m_MediaFPS / m_fps : 1.0);
- }
-
- double dRate;
- if(SUCCEEDED(pMS->GetRate(&dRate)))
- m_MediaFPS = dRate * m_fps;
- }
-
- return hr;
+ HRESULT hr = CDirectVobSub::put_MediaFPS(fEnabled, fps);
+
+ CComQIPtr<IMediaSeeking> pMS = m_pGraph;
+ if(pMS)
+ {
+ if(hr == NOERROR)
+ {
+ hr = pMS->SetRate(m_fMediaFPSEnabled ? m_MediaFPS / m_fps : 1.0);
+ }
+
+ double dRate;
+ if(SUCCEEDED(pMS->GetRate(&dRate)))
+ m_MediaFPS = dRate * m_fps;
+ }
+
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::get_ZoomRect(NORMALIZEDRECT* rect)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
STDMETHODIMP CDirectVobSubFilter::put_ZoomRect(NORMALIZEDRECT* rect)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
// IDirectVobSub2
STDMETHODIMP CDirectVobSubFilter::put_TextSettings(STSStyle* pDefStyle)
{
- HRESULT hr = CDirectVobSub::put_TextSettings(pDefStyle);
-
- if(hr == NOERROR)
- {
- UpdateSubtitle(true);
- }
-
- return hr;
+ HRESULT hr = CDirectVobSub::put_TextSettings(pDefStyle);
+
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(true);
+ }
+
+ return hr;
}
STDMETHODIMP CDirectVobSubFilter::put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType)
{
- HRESULT hr = CDirectVobSub::put_AspectRatioSettings(ePARCompensationType);
+ HRESULT hr = CDirectVobSub::put_AspectRatioSettings(ePARCompensationType);
- if(hr == NOERROR)
- {
- UpdateSubtitle(true);
- }
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(true);
+ }
- return hr;
+ return hr;
}
// IDirectVobSubFilterColor
STDMETHODIMP CDirectVobSubFilter::HasConfigDialog(int iSelected)
{
- int nLangs;
- if(FAILED(get_LanguageCount(&nLangs))) return E_FAIL;
- return E_FAIL;
- // TODO: temporally disabled since we don't have a new textsub/vobsub editor dlg for dvs yet
+ int nLangs;
+ if(FAILED(get_LanguageCount(&nLangs))) return E_FAIL;
+ return E_FAIL;
+ // TODO: temporally disabled since we don't have a new textsub/vobsub editor dlg for dvs yet
// return(nLangs >= 0 && iSelected < nLangs ? S_OK : E_FAIL);
}
STDMETHODIMP CDirectVobSubFilter::ShowConfigDialog(int iSelected, HWND hWndParent)
{
- // TODO: temporally disabled since we don't have a new textsub/vobsub editor dlg for dvs yet
- return(E_FAIL);
+ // TODO: temporally disabled since we don't have a new textsub/vobsub editor dlg for dvs yet
+ return(E_FAIL);
}
///////////////////////////////////////////////////////////////////////////
CDirectVobSubFilter2::CDirectVobSubFilter2(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid) :
- CDirectVobSubFilter(punk, phr, clsid)
+ CDirectVobSubFilter(punk, phr, clsid)
{
}
HRESULT CDirectVobSubFilter2::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
{
- CPinInfo pi;
- if(FAILED(pPin->QueryPinInfo(&pi))) return E_FAIL;
-
- if(CComQIPtr<IDirectVobSub>(pi.pFilter)) return E_FAIL;
-
- if(dir == PINDIR_INPUT)
- {
- CFilterInfo fi;
- if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
- && !wcsnicmp(fi.achName, L"Overlay Mixer", 13))
- return(E_FAIL);
- }
- else
- {
- }
-
- return __super::CheckConnect(dir, pPin);
+ CPinInfo pi;
+ if(FAILED(pPin->QueryPinInfo(&pi))) return E_FAIL;
+
+ if(CComQIPtr<IDirectVobSub>(pi.pFilter)) return E_FAIL;
+
+ if(dir == PINDIR_INPUT)
+ {
+ CFilterInfo fi;
+ if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
+ && !wcsnicmp(fi.achName, L"Overlay Mixer", 13))
+ return(E_FAIL);
+ }
+ else
+ {
+ }
+
+ return __super::CheckConnect(dir, pPin);
}
HRESULT CDirectVobSubFilter2::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName)
{
- if(pGraph)
- {
- BeginEnumFilters(pGraph, pEF, pBF)
- {
- if(pBF != (IBaseFilter*)this && CComQIPtr<IDirectVobSub>(pBF))
- return E_FAIL;
- }
- EndEnumFilters
-
- // don't look... we will do some serious graph hacking again...
- //
- // we will add dvs2 to the filter graph cache
- // - if the main app has already added some kind of renderer or overlay mixer (anything which accepts video on its input)
- // and
- // - if we have a reason to auto-load (we don't want to make any trouble when there is no need :)
- //
- // This whole workaround is needed because the video stream will always be connected
- // to the pre-added filters first, no matter how high merit we have.
-
- if(!get_Forced())
- {
- BeginEnumFilters(pGraph, pEF, pBF)
- {
- if(CComQIPtr<IDirectVobSub>(pBF))
- continue;
-
- CComPtr<IPin> pInPin = GetFirstPin(pBF, PINDIR_INPUT);
- CComPtr<IPin> pOutPin = GetFirstPin(pBF, PINDIR_OUTPUT);
-
- if(!pInPin)
- continue;
-
- CComPtr<IPin> pPin;
- if(pInPin && SUCCEEDED(pInPin->ConnectedTo(&pPin))
- || pOutPin && SUCCEEDED(pOutPin->ConnectedTo(&pPin)))
- continue;
-
- if(pOutPin && GetFilterName(pBF) == _T("Overlay Mixer"))
- continue;
-
- bool fVideoInputPin = false;
-
- do
- {
- BITMAPINFOHEADER bih = {sizeof(BITMAPINFOHEADER), 384, 288, 1, 16, '2YUY', 384 * 288 * 2, 0, 0, 0, 0};
-
- CMediaType cmt;
- cmt.majortype = MEDIATYPE_Video;
- cmt.subtype = MEDIASUBTYPE_YUY2;
- cmt.formattype = FORMAT_VideoInfo;
- cmt.pUnk = NULL;
- cmt.bFixedSizeSamples = TRUE;
- cmt.bTemporalCompression = TRUE;
- cmt.lSampleSize = 384 * 288 * 2;
- VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)cmt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
- memset(vih, 0, sizeof(VIDEOINFOHEADER));
- memcpy(&vih->bmiHeader, &bih, sizeof(bih));
- vih->AvgTimePerFrame = 400000;
-
- if(SUCCEEDED(pInPin->QueryAccept(&cmt)))
- {
- fVideoInputPin = true;
- break;
- }
-
- VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)cmt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
- memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
- memcpy(&vih2->bmiHeader, &bih, sizeof(bih));
- vih2->AvgTimePerFrame = 400000;
- vih2->dwPictAspectRatioX = 384;
- vih2->dwPictAspectRatioY = 288;
-
- if(SUCCEEDED(pInPin->QueryAccept(&cmt)))
- {
- fVideoInputPin = true;
- break;
- }
- }
- while(false);
-
- if(fVideoInputPin)
- {
- CComPtr<IBaseFilter> pDVS;
- if(ShouldWeAutoload(pGraph) && SUCCEEDED(pDVS.CoCreateInstance(__uuidof(CDirectVobSubFilter2))))
- {
- CComQIPtr<IDirectVobSub2>(pDVS)->put_Forced(true);
- CComQIPtr<IGraphConfig>(pGraph)->AddFilterToCache(pDVS);
- }
-
- break;
- }
- }
- EndEnumFilters
- }
- }
- else
- {
- }
-
- return __super::JoinFilterGraph(pGraph, pName);
+ if(pGraph)
+ {
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ if(pBF != (IBaseFilter*)this && CComQIPtr<IDirectVobSub>(pBF))
+ return E_FAIL;
+ }
+ EndEnumFilters
+
+ // don't look... we will do some serious graph hacking again...
+ //
+ // we will add dvs2 to the filter graph cache
+ // - if the main app has already added some kind of renderer or overlay mixer (anything which accepts video on its input)
+ // and
+ // - if we have a reason to auto-load (we don't want to make any trouble when there is no need :)
+ //
+ // This whole workaround is needed because the video stream will always be connected
+ // to the pre-added filters first, no matter how high merit we have.
+
+ if(!get_Forced())
+ {
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ if(CComQIPtr<IDirectVobSub>(pBF))
+ continue;
+
+ CComPtr<IPin> pInPin = GetFirstPin(pBF, PINDIR_INPUT);
+ CComPtr<IPin> pOutPin = GetFirstPin(pBF, PINDIR_OUTPUT);
+
+ if(!pInPin)
+ continue;
+
+ CComPtr<IPin> pPin;
+ if(pInPin && SUCCEEDED(pInPin->ConnectedTo(&pPin))
+ || pOutPin && SUCCEEDED(pOutPin->ConnectedTo(&pPin)))
+ continue;
+
+ if(pOutPin && GetFilterName(pBF) == _T("Overlay Mixer"))
+ continue;
+
+ bool fVideoInputPin = false;
+
+ do
+ {
+ BITMAPINFOHEADER bih = {sizeof(BITMAPINFOHEADER), 384, 288, 1, 16, '2YUY', 384*288*2, 0, 0, 0, 0};
+
+ CMediaType cmt;
+ cmt.majortype = MEDIATYPE_Video;
+ cmt.subtype = MEDIASUBTYPE_YUY2;
+ cmt.formattype = FORMAT_VideoInfo;
+ cmt.pUnk = NULL;
+ cmt.bFixedSizeSamples = TRUE;
+ cmt.bTemporalCompression = TRUE;
+ cmt.lSampleSize = 384*288*2;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)cmt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ memcpy(&vih->bmiHeader, &bih, sizeof(bih));
+ vih->AvgTimePerFrame = 400000;
+
+ if(SUCCEEDED(pInPin->QueryAccept(&cmt)))
+ {
+ fVideoInputPin = true;
+ break;
+ }
+
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)cmt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
+ memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
+ memcpy(&vih2->bmiHeader, &bih, sizeof(bih));
+ vih2->AvgTimePerFrame = 400000;
+ vih2->dwPictAspectRatioX = 384;
+ vih2->dwPictAspectRatioY = 288;
+
+ if(SUCCEEDED(pInPin->QueryAccept(&cmt)))
+ {
+ fVideoInputPin = true;
+ break;
+ }
+ }
+ while(false);
+
+ if(fVideoInputPin)
+ {
+ CComPtr<IBaseFilter> pDVS;
+ if(ShouldWeAutoload(pGraph) && SUCCEEDED(pDVS.CoCreateInstance(__uuidof(CDirectVobSubFilter2))))
+ {
+ CComQIPtr<IDirectVobSub2>(pDVS)->put_Forced(true);
+ CComQIPtr<IGraphConfig>(pGraph)->AddFilterToCache(pDVS);
+ }
+
+ break;
+ }
+ }
+ EndEnumFilters
+ }
+ }
+ else
+ {
+ }
+
+ return __super::JoinFilterGraph(pGraph, pName);
}
HRESULT CDirectVobSubFilter2::CheckInputType(const CMediaType* mtIn)
{
HRESULT hr = __super::CheckInputType(mtIn);
- if(FAILED(hr) || m_pInput->IsConnected()) return hr;
+ if(FAILED(hr) || m_pInput->IsConnected()) return hr;
- if(!ShouldWeAutoload(m_pGraph)) return VFW_E_TYPE_NOT_ACCEPTED;
+ if(!ShouldWeAutoload(m_pGraph)) return VFW_E_TYPE_NOT_ACCEPTED;
- GetRidOfInternalScriptRenderer();
+ GetRidOfInternalScriptRenderer();
- return NOERROR;
+ return NOERROR;
}
bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
{
- TCHAR blacklistedapps[][32] =
- {
- _T("WM8EUTIL."), // wmp8 encoder's dummy renderer releases the outputted media sample after calling Receive on its input pin (yes, even when dvobsub isn't registered at all)
- _T("explorer."), // as some users reported thumbnail preview loads dvobsub, I've never experienced this yet...
- _T("producer."), // this is real's producer
- _T("GoogleDesktopIndex."), // Google Desktop
- _T("GoogleDesktopDisplay."), // Google Desktop
- _T("GoogleDesktopCrawl."), // Google Desktop
- };
-
- for(ptrdiff_t i = 0; i < countof(blacklistedapps); i++)
- {
- if(theApp.m_AppName.Find(blacklistedapps[i]) >= 0)
- return(false);
- }
-
- int level;
- bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
- get_LoadSettings(&level, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
-
- if(level < 0 || level >= 2) return(false);
-
- bool fRet = false;
-
- if(level == 1)
- fRet = m_fExternalLoad = m_fWebLoad = m_fEmbeddedLoad = true;
-
- // find text stream on known splitters
-
- if(!fRet && m_fEmbeddedLoad)
- {
- CComPtr<IBaseFilter> pBF;
- if((pBF = FindFilter(CLSID_OggSplitter, pGraph)) || (pBF = FindFilter(CLSID_AviSplitter, pGraph))
- || (pBF = FindFilter(L"{34293064-02F2-41D5-9D75-CC5967ACA1AB}", pGraph)) // matroska demux
- || (pBF = FindFilter(L"{0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4}", pGraph)) // matroska source
- || (pBF = FindFilter(L"{149D2E01-C32E-4939-80F6-C07B81015A7A}", pGraph)) // matroska splitter
- || (pBF = FindFilter(L"{9AB95E90-1F37-427e-9B3D-257FB0CB25F7}", pGraph)) // Haali's matroska splitter (?)
- || (pBF = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGraph)) // Haali's matroska splitter
- || (pBF = FindFilter(L"{52B63861-DC93-11CE-A099-00AA00479A58}", pGraph)) // 3ivx splitter
- || (pBF = FindFilter(L"{6D3688CE-3E9D-42F4-92CA-8A11119D25CD}", pGraph)) // our ogg source
- || (pBF = FindFilter(L"{9FF48807-E133-40AA-826F-9B2959E5232D}", pGraph)) // our ogg splitter
- || (pBF = FindFilter(L"{803E8280-F3CE-4201-982C-8CD8FB512004}", pGraph)) // dsm source
- || (pBF = FindFilter(L"{0912B4DD-A30A-4568-B590-7179EBB420EC}", pGraph)) // dsm splitter
- || (pBF = FindFilter(L"{3CCC052E-BDEE-408a-BEA7-90914EF2964B}", pGraph)) // mp4 source
- || (pBF = FindFilter(L"{61F47056-E400-43d3-AF1E-AB7DFFD4C4AD}", pGraph))) // mp4 splitter
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
- BeginEnumMediaTypes(pPin, pEM, pmt)
- {
- if(pmt->majortype == MEDIATYPE_Text || pmt->majortype == MEDIATYPE_Subtitle)
- {
- fRet = true;
- break;
- }
- }
- EndEnumMediaTypes(pmt)
- if(fRet) break;
- }
- EndEnumFilters
- }
- }
-
- // find file name
-
- CStringW fn;
-
- BeginEnumFilters(pGraph, pEF, pBF)
- {
- if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
- {
- LPOLESTR fnw = NULL;
- if(!pFSF || FAILED(pFSF->GetCurFile(&fnw, NULL)) || !fnw)
- continue;
- fn = CString(fnw);
- CoTaskMemFree(fnw);
- break;
- }
- }
- EndEnumFilters
-
- if((m_fExternalLoad || m_fWebLoad) && (m_fWebLoad || !(wcsstr(fn, L"http://") || wcsstr(fn, L"mms://"))))
- {
- bool fTemp = m_fHideSubtitles;
- fRet = !fn.IsEmpty() && SUCCEEDED(put_FileName((LPWSTR)(LPCWSTR)fn))
- || SUCCEEDED(put_FileName(L"c:\\tmp.srt"))
- || fRet;
- if(fTemp) m_fHideSubtitles = true;
- }
-
- return(fRet);
+ TCHAR blacklistedapps[][32] =
+ {
+ _T("WM8EUTIL."), // wmp8 encoder's dummy renderer releases the outputted media sample after calling Receive on its input pin (yes, even when dvobsub isn't registered at all)
+ _T("explorer."), // as some users reported thumbnail preview loads dvobsub, I've never experienced this yet...
+ _T("producer."), // this is real's producer
+ _T("GoogleDesktopIndex."), // Google Desktop
+ _T("GoogleDesktopDisplay."), // Google Desktop
+ _T("GoogleDesktopCrawl."), // Google Desktop
+ };
+
+ for(ptrdiff_t i = 0; i < countof(blacklistedapps); i++)
+ {
+ if(theApp.m_AppName.Find(blacklistedapps[i]) >= 0)
+ return(false);
+ }
+
+ int level;
+ bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
+ get_LoadSettings(&level, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
+
+ if(level < 0 || level >= 2) return(false);
+
+ bool fRet = false;
+
+ if(level == 1)
+ fRet = m_fExternalLoad = m_fWebLoad = m_fEmbeddedLoad = true;
+
+ // find text stream on known splitters
+
+ if(!fRet && m_fEmbeddedLoad)
+ {
+ CComPtr<IBaseFilter> pBF;
+ if((pBF = FindFilter(CLSID_OggSplitter, pGraph)) || (pBF = FindFilter(CLSID_AviSplitter, pGraph))
+ || (pBF = FindFilter(L"{34293064-02F2-41D5-9D75-CC5967ACA1AB}", pGraph)) // matroska demux
+ || (pBF = FindFilter(L"{0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4}", pGraph)) // matroska source
+ || (pBF = FindFilter(L"{149D2E01-C32E-4939-80F6-C07B81015A7A}", pGraph)) // matroska splitter
+ || (pBF = FindFilter(L"{9AB95E90-1F37-427e-9B3D-257FB0CB25F7}", pGraph)) // Haali's matroska splitter (?)
+ || (pBF = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGraph)) // Haali's matroska splitter
+ || (pBF = FindFilter(L"{52B63861-DC93-11CE-A099-00AA00479A58}", pGraph)) // 3ivx splitter
+ || (pBF = FindFilter(L"{6D3688CE-3E9D-42F4-92CA-8A11119D25CD}", pGraph)) // our ogg source
+ || (pBF = FindFilter(L"{9FF48807-E133-40AA-826F-9B2959E5232D}", pGraph)) // our ogg splitter
+ || (pBF = FindFilter(L"{803E8280-F3CE-4201-982C-8CD8FB512004}", pGraph)) // dsm source
+ || (pBF = FindFilter(L"{0912B4DD-A30A-4568-B590-7179EBB420EC}", pGraph)) // dsm splitter
+ || (pBF = FindFilter(L"{3CCC052E-BDEE-408a-BEA7-90914EF2964B}", pGraph)) // mp4 source
+ || (pBF = FindFilter(L"{61F47056-E400-43d3-AF1E-AB7DFFD4C4AD}", pGraph))) // mp4 splitter
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ BeginEnumMediaTypes(pPin, pEM, pmt)
+ {
+ if(pmt->majortype == MEDIATYPE_Text || pmt->majortype == MEDIATYPE_Subtitle)
+ {
+ fRet = true;
+ break;
+ }
+ }
+ EndEnumMediaTypes(pmt)
+ if(fRet) break;
+ }
+ EndEnumFilters
+ }
+ }
+
+ // find file name
+
+ CStringW fn;
+
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
+ {
+ LPOLESTR fnw = NULL;
+ if(!pFSF || FAILED(pFSF->GetCurFile(&fnw, NULL)) || !fnw)
+ continue;
+ fn = CString(fnw);
+ CoTaskMemFree(fnw);
+ break;
+ }
+ }
+ EndEnumFilters
+
+ if((m_fExternalLoad || m_fWebLoad) && (m_fWebLoad || !(wcsstr(fn, L"http://") || wcsstr(fn, L"mms://"))))
+ {
+ bool fTemp = m_fHideSubtitles;
+ fRet = !fn.IsEmpty() && SUCCEEDED(put_FileName((LPWSTR)(LPCWSTR)fn))
+ || SUCCEEDED(put_FileName(L"c:\\tmp.srt"))
+ || fRet;
+ if(fTemp) m_fHideSubtitles = true;
+ }
+
+ return(fRet);
}
void CDirectVobSubFilter2::GetRidOfInternalScriptRenderer()
{
- while(CComPtr<IBaseFilter> pBF = FindFilter(L"{48025243-2D39-11CE-875D-00608CB78066}", m_pGraph))
- {
- BeginEnumPins(pBF, pEP, pPin)
- {
- PIN_DIRECTION dir;
- CComPtr<IPin> pPinTo;
-
- if(SUCCEEDED(pPin->QueryDirection(&dir)) && dir == PINDIR_INPUT
- && SUCCEEDED(pPin->ConnectedTo(&pPinTo)))
- {
- m_pGraph->Disconnect(pPinTo);
- m_pGraph->Disconnect(pPin);
- m_pGraph->ConnectDirect(pPinTo, GetPin(2 + m_pTextInput.GetCount() - 1), NULL);
- }
- }
- EndEnumPins
-
- if(FAILED(m_pGraph->RemoveFilter(pBF)))
- break;
- }
+ while(CComPtr<IBaseFilter> pBF = FindFilter(L"{48025243-2D39-11CE-875D-00608CB78066}", m_pGraph))
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ PIN_DIRECTION dir;
+ CComPtr<IPin> pPinTo;
+
+ if(SUCCEEDED(pPin->QueryDirection(&dir)) && dir == PINDIR_INPUT
+ && SUCCEEDED(pPin->ConnectedTo(&pPinTo)))
+ {
+ m_pGraph->Disconnect(pPinTo);
+ m_pGraph->Disconnect(pPin);
+ m_pGraph->ConnectDirect(pPinTo, GetPin(2 + m_pTextInput.GetCount()-1), NULL);
+ }
+ }
+ EndEnumPins
+
+ if(FAILED(m_pGraph->RemoveFilter(pBF)))
+ break;
+ }
}
///////////////////////////////////////////////////////////////////////////////
bool CDirectVobSubFilter::Open()
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CAutoLock cAutolock(&m_csQueueLock);
-
- m_pSubStreams.RemoveAll();
-
- m_frd.files.RemoveAll();
-
- CAtlArray<CString> paths;
-
- for(ptrdiff_t i = 0; i < 10; i++)
- {
- CString tmp;
- tmp.Format(IDS_RP_PATH, i);
- CString path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp);
- if(!path.IsEmpty()) paths.Add(path);
- }
-
- CAtlArray<SubFile> ret;
- GetSubFileNames(m_FileName, paths, ret);
-
- for(ptrdiff_t i = 0; i < ret.GetCount(); i++)
- {
- if(m_frd.files.Find(ret[i].fn))
- continue;
-
- CComPtr<ISubStream> pSubStream;
-
- if(!pSubStream)
- {
- CAutoPtr<CVobSubFile> pVSF(new CVobSubFile(&m_csSubLock));
- if(pVSF && pVSF->Open(ret[i].fn) && pVSF->GetStreamCount() > 0)
- {
- pSubStream = pVSF.Detach();
- m_frd.files.AddTail(ret[i].fn.Left(ret[i].fn.GetLength() - 4) + _T(".sub"));
- }
- }
-
- if(!pSubStream)
- {
- CAutoPtr<ssf::CRenderer> pSSF(new ssf::CRenderer(&m_csSubLock));
- if(pSSF && pSSF->Open(ret[i].fn) && pSSF->GetStreamCount() > 0)
- {
- pSubStream = pSSF.Detach();
- }
- }
-
- if(!pSubStream)
- {
- CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
- if(pRTS && pRTS->Open(ret[i].fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0)
- {
- pSubStream = pRTS.Detach();
- m_frd.files.AddTail(ret[i].fn + _T(".style"));
- }
- }
-
- if(pSubStream)
- {
- m_pSubStreams.AddTail(pSubStream);
- m_frd.files.AddTail(ret[i].fn);
- }
- }
-
- for(ptrdiff_t i = 0; i < m_pTextInput.GetCount(); i++)
- {
- if(m_pTextInput[i]->IsConnected())
- m_pSubStreams.AddTail(m_pTextInput[i]->GetSubStream());
- }
-
- if(S_FALSE == put_SelectedLanguage(FindPreferedLanguage()))
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ m_pSubStreams.RemoveAll();
+
+ m_frd.files.RemoveAll();
+
+ CAtlArray<CString> paths;
+
+ for(ptrdiff_t i = 0; i < 10; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RP_PATH, i);
+ CString path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp);
+ if(!path.IsEmpty()) paths.Add(path);
+ }
+
+ CAtlArray<SubFile> ret;
+ GetSubFileNames(m_FileName, paths, ret);
+
+ for(ptrdiff_t i = 0; i < ret.GetCount(); i++)
+ {
+ if(m_frd.files.Find(ret[i].fn))
+ continue;
+
+ CComPtr<ISubStream> pSubStream;
+
+ if(!pSubStream)
+ {
+ CAutoPtr<CVobSubFile> pVSF(new CVobSubFile(&m_csSubLock));
+ if(pVSF && pVSF->Open(ret[i].fn) && pVSF->GetStreamCount() > 0)
+ {
+ pSubStream = pVSF.Detach();
+ m_frd.files.AddTail(ret[i].fn.Left(ret[i].fn.GetLength()-4) + _T(".sub"));
+ }
+ }
+
+ if(!pSubStream)
+ {
+ CAutoPtr<ssf::CRenderer> pSSF(new ssf::CRenderer(&m_csSubLock));
+ if(pSSF && pSSF->Open(ret[i].fn) && pSSF->GetStreamCount() > 0)
+ {
+ pSubStream = pSSF.Detach();
+ }
+ }
+
+ if(!pSubStream)
+ {
+ CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
+ if(pRTS && pRTS->Open(ret[i].fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0)
+ {
+ pSubStream = pRTS.Detach();
+ m_frd.files.AddTail(ret[i].fn + _T(".style"));
+ }
+ }
+
+ if(pSubStream)
+ {
+ m_pSubStreams.AddTail(pSubStream);
+ m_frd.files.AddTail(ret[i].fn);
+ }
+ }
+
+ for(ptrdiff_t i = 0; i < m_pTextInput.GetCount(); i++)
+ {
+ if(m_pTextInput[i]->IsConnected())
+ m_pSubStreams.AddTail(m_pTextInput[i]->GetSubStream());
+ }
+
+ if(S_FALSE == put_SelectedLanguage(FindPreferedLanguage()))
UpdateSubtitle(false); // make sure pSubPicProvider of our queue gets updated even if the stream number hasn't changed
- m_frd.RefreshEvent.Set();
+ m_frd.RefreshEvent.Set();
- return(m_pSubStreams.GetCount() > 0);
+ return(m_pSubStreams.GetCount() > 0);
}
void CDirectVobSubFilter::UpdateSubtitle(bool fApplyDefStyle)
{
- CAutoLock cAutolock(&m_csQueueLock);
+ CAutoLock cAutolock(&m_csQueueLock);
- if(!m_pSubPicQueue) return;
+ if(!m_pSubPicQueue) return;
- InvalidateSubtitle();
+ InvalidateSubtitle();
- CComPtr<ISubStream> pSubStream;
+ CComPtr<ISubStream> pSubStream;
- if(!m_fHideSubtitles)
- {
- int i = m_iSelectedLanguage;
+ if(!m_fHideSubtitles)
+ {
+ int i = m_iSelectedLanguage;
- for(POSITION pos = m_pSubStreams.GetHeadPosition(); i >= 0 && pos; pSubStream = NULL)
- {
- pSubStream = m_pSubStreams.GetNext(pos);
+ for(POSITION pos = m_pSubStreams.GetHeadPosition(); i >= 0 && pos; pSubStream = NULL)
+ {
+ pSubStream = m_pSubStreams.GetNext(pos);
- if(i < pSubStream->GetStreamCount())
- {
- CAutoLock cAutoLock(&m_csSubLock);
- pSubStream->SetStream(i);
- break;
- }
+ if(i < pSubStream->GetStreamCount())
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pSubStream->SetStream(i);
+ break;
+ }
- i -= pSubStream->GetStreamCount();
- }
- }
+ i -= pSubStream->GetStreamCount();
+ }
+ }
- SetSubtitle(pSubStream, fApplyDefStyle);
+ SetSubtitle(pSubStream, fApplyDefStyle);
}
void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle)
{
CAutoLock cAutolock(&m_csQueueLock);
- if(pSubStream)
- {
- CAutoLock cAutolock(&m_csSubLock);
-
- CLSID clsid;
- pSubStream->GetClassID(&clsid);
-
- if(clsid == __uuidof(CVobSubFile))
- {
- CVobSubSettings* pVSS = (CVobSubFile*)(ISubStream*)pSubStream;
-
- if(fApplyDefStyle)
- {
- pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
- pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
- }
- }
- else if(clsid == __uuidof(CVobSubStream))
- {
- CVobSubSettings* pVSS = (CVobSubStream*)(ISubStream*)pSubStream;
-
- if(fApplyDefStyle)
- {
- pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
- pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
- }
- }
- else if(clsid == __uuidof(CRenderedTextSubtitle))
- {
- CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
-
- if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle)
- {
- STSStyle s = m_defStyle;
-
- if(m_fOverridePlacement)
- {
- s.scrAlignment = 2;
- int w = pRTS->m_dstScreenSize.cx;
- int h = pRTS->m_dstScreenSize.cy;
- int mw = w - s.marginRect.left - s.marginRect.right;
- s.marginRect.bottom = h - MulDiv(h, m_PlacementYperc, 100);
- s.marginRect.left = MulDiv(w, m_PlacementXperc, 100) - mw / 2;
- s.marginRect.right = w - (s.marginRect.left + mw);
- }
-
- pRTS->SetDefaultStyle(s);
- }
-
- pRTS->m_ePARCompensationType = m_ePARCompensationType;
- if(m_CurrentVIH2.dwPictAspectRatioX != 0 && m_CurrentVIH2.dwPictAspectRatioY != 0 && m_CurrentVIH2.bmiHeader.biWidth != 0 && m_CurrentVIH2.bmiHeader.biHeight != 0)
- {
- pRTS->m_dPARCompensation = ((double)abs(m_CurrentVIH2.bmiHeader.biWidth) / (double)abs(m_CurrentVIH2.bmiHeader.biHeight)) /
- ((double)abs((long)m_CurrentVIH2.dwPictAspectRatioX) / (double)abs((long)m_CurrentVIH2.dwPictAspectRatioY));
-
- }
- else
- {
- pRTS->m_dPARCompensation = 1.00;
- }
-
- pRTS->Deinit();
- }
- }
-
- if(!fApplyDefStyle)
- {
- int i = 0;
-
- POSITION pos = m_pSubStreams.GetHeadPosition();
- while(pos)
- {
- CComPtr<ISubStream> pSubStream2 = m_pSubStreams.GetNext(pos);
-
- if(pSubStream == pSubStream2)
- {
- m_iSelectedLanguage = i + pSubStream2->GetStream();
- break;
- }
-
- i += pSubStream2->GetStreamCount();
- }
- }
-
- m_nSubtitleId = (DWORD_PTR)pSubStream;
-
- if(m_pSubPicQueue)
- m_pSubPicQueue->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
+ if(pSubStream)
+ {
+ CAutoLock cAutolock(&m_csSubLock);
+
+ CLSID clsid;
+ pSubStream->GetClassID(&clsid);
+
+ if(clsid == __uuidof(CVobSubFile))
+ {
+ CVobSubSettings* pVSS = (CVobSubFile*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle)
+ {
+ pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
+ pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
+ }
+ }
+ else if(clsid == __uuidof(CVobSubStream))
+ {
+ CVobSubSettings* pVSS = (CVobSubStream*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle)
+ {
+ pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
+ pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
+ }
+ }
+ else if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle)
+ {
+ STSStyle s = m_defStyle;
+
+ if(m_fOverridePlacement)
+ {
+ s.scrAlignment = 2;
+ int w = pRTS->m_dstScreenSize.cx;
+ int h = pRTS->m_dstScreenSize.cy;
+ int mw = w - s.marginRect.left - s.marginRect.right;
+ s.marginRect.bottom = h - MulDiv(h, m_PlacementYperc, 100);
+ s.marginRect.left = MulDiv(w, m_PlacementXperc, 100) - mw/2;
+ s.marginRect.right = w - (s.marginRect.left + mw);
+ }
+
+ pRTS->SetDefaultStyle(s);
+ }
+
+ pRTS->m_ePARCompensationType = m_ePARCompensationType;
+ if (m_CurrentVIH2.dwPictAspectRatioX != 0 && m_CurrentVIH2.dwPictAspectRatioY != 0&& m_CurrentVIH2.bmiHeader.biWidth != 0 && m_CurrentVIH2.bmiHeader.biHeight != 0)
+ {
+ pRTS->m_dPARCompensation = ((double)abs(m_CurrentVIH2.bmiHeader.biWidth) / (double)abs(m_CurrentVIH2.bmiHeader.biHeight)) /
+ ((double)abs((long)m_CurrentVIH2.dwPictAspectRatioX) / (double)abs((long)m_CurrentVIH2.dwPictAspectRatioY));
+
+ }
+ else
+ {
+ pRTS->m_dPARCompensation = 1.00;
+ }
+
+ pRTS->Deinit();
+ }
+ }
+
+ if(!fApplyDefStyle)
+ {
+ int i = 0;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos)
+ {
+ CComPtr<ISubStream> pSubStream2 = m_pSubStreams.GetNext(pos);
+
+ if(pSubStream == pSubStream2)
+ {
+ m_iSelectedLanguage = i + pSubStream2->GetStream();
+ break;
+ }
+
+ i += pSubStream2->GetStreamCount();
+ }
+ }
+
+ m_nSubtitleId = (DWORD_PTR)pSubStream;
+
+ if(m_pSubPicQueue)
+ m_pSubPicQueue->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
}
void CDirectVobSubFilter::InvalidateSubtitle(REFERENCE_TIME rtInvalidate, DWORD_PTR nSubtitleId)
{
CAutoLock cAutolock(&m_csQueueLock);
- if(m_pSubPicQueue)
- {
- if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId)
- m_pSubPicQueue->Invalidate(rtInvalidate);
- }
+ if(m_pSubPicQueue)
+ {
+ if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId)
+ m_pSubPicQueue->Invalidate(rtInvalidate);
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
void CDirectVobSubFilter::AddSubStream(ISubStream* pSubStream)
{
- CAutoLock cAutoLock(&m_csQueueLock);
+ CAutoLock cAutoLock(&m_csQueueLock);
- POSITION pos = m_pSubStreams.Find(pSubStream);
- if(!pos) m_pSubStreams.AddTail(pSubStream);
+ POSITION pos = m_pSubStreams.Find(pSubStream);
+ if(!pos) m_pSubStreams.AddTail(pSubStream);
- int len = m_pTextInput.GetCount();
- for(ptrdiff_t i = 0; i < m_pTextInput.GetCount(); i++)
- if(m_pTextInput[i]->IsConnected()) len--;
+ int len = m_pTextInput.GetCount();
+ for(ptrdiff_t i = 0; i < m_pTextInput.GetCount(); i++)
+ if(m_pTextInput[i]->IsConnected()) len--;
- if(len == 0)
- {
- HRESULT hr = S_OK;
- m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
- }
+ if(len == 0)
+ {
+ HRESULT hr = S_OK;
+ m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
+ }
}
void CDirectVobSubFilter::RemoveSubStream(ISubStream* pSubStream)
{
- CAutoLock cAutoLock(&m_csQueueLock);
+ CAutoLock cAutoLock(&m_csQueueLock);
- POSITION pos = m_pSubStreams.Find(pSubStream);
- if(pos) m_pSubStreams.RemoveAt(pos);
+ POSITION pos = m_pSubStreams.Find(pSubStream);
+ if(pos) m_pSubStreams.RemoveAt(pos);
}
void CDirectVobSubFilter::Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId)
{
- if(nSubtitleId != -1 && nSubtitleId != m_nSubtitleId)
- return;
+ if(nSubtitleId != -1 && nSubtitleId != m_nSubtitleId)
+ return;
- CComQIPtr<IMediaEventSink> pMES = m_pGraph;
- if(!pMES) return;
+ CComQIPtr<IMediaEventSink> pMES = m_pGraph;
+ if(!pMES) return;
- CComBSTR bstr1("Text"), bstr2(" ");
+ CComBSTR bstr1("Text"), bstr2(" ");
- str.Trim();
- if(!str.IsEmpty()) bstr2 = CStringA(str);
+ str.Trim();
+ if(!str.IsEmpty()) bstr2 = CStringA(str);
- pMES->Notify(EC_OLE_EVENT, (LONG_PTR)bstr1.Detach(), (LONG_PTR)bstr2.Detach());
+ pMES->Notify(EC_OLE_EVENT, (LONG_PTR)bstr1.Detach(), (LONG_PTR)bstr2.Detach());
}
////////////////////////////////////////////////////////////////
@@ -1648,137 +1609,137 @@ void CDirectVobSubFilter::SetupFRD(CStringArray& paths, CAtlArray<HANDLE>& handl
{
CAutoLock cAutolock(&m_csSubLock);
- for(ptrdiff_t i = 2; i < handles.GetCount(); i++)
- {
- FindCloseChangeNotification(handles[i]);
- }
+ for(ptrdiff_t i = 2; i < handles.GetCount(); i++)
+ {
+ FindCloseChangeNotification(handles[i]);
+ }
- paths.RemoveAll();
- handles.RemoveAll();
+ paths.RemoveAll();
+ handles.RemoveAll();
- handles.Add(m_frd.EndThreadEvent);
- handles.Add(m_frd.RefreshEvent);
+ handles.Add(m_frd.EndThreadEvent);
+ handles.Add(m_frd.RefreshEvent);
- m_frd.mtime.SetCount(m_frd.files.GetCount());
+ m_frd.mtime.SetCount(m_frd.files.GetCount());
- POSITION pos = m_frd.files.GetHeadPosition();
- for(ptrdiff_t i = 0; pos; i++)
- {
- CString fn = m_frd.files.GetNext(pos);
+ POSITION pos = m_frd.files.GetHeadPosition();
+ for(ptrdiff_t i = 0; pos; i++)
+ {
+ CString fn = m_frd.files.GetNext(pos);
- CFileStatus status;
- if(CFileGetStatus(fn, status))
- m_frd.mtime[i] = status.m_mtime;
+ CFileStatus status;
+ if(CFileGetStatus(fn, status))
+ m_frd.mtime[i] = status.m_mtime;
- fn.Replace('\\', '/');
- fn = fn.Left(fn.ReverseFind('/') + 1);
+ fn.Replace('\\', '/');
+ fn = fn.Left(fn.ReverseFind('/')+1);
- bool fFound = false;
+ bool fFound = false;
- for(ptrdiff_t j = 0; !fFound && j < paths.GetCount(); j++)
- {
- if(paths[j] == fn) fFound = true;
- }
+ for(ptrdiff_t j = 0; !fFound && j < paths.GetCount(); j++)
+ {
+ if(paths[j] == fn) fFound = true;
+ }
- if(!fFound)
- {
- paths.Add(fn);
+ if(!fFound)
+ {
+ paths.Add(fn);
- HANDLE h = FindFirstChangeNotification(fn, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
- if(h != INVALID_HANDLE_VALUE) handles.Add(h);
- }
- }
+ HANDLE h = FindFirstChangeNotification(fn, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
+ if(h != INVALID_HANDLE_VALUE) handles.Add(h);
+ }
+ }
}
DWORD CDirectVobSubFilter::ThreadProc()
-{
- SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST/*THREAD_PRIORITY_BELOW_NORMAL*/);
-
- CStringArray paths;
- CAtlArray<HANDLE> handles;
-
- SetupFRD(paths, handles);
-
- while(1)
- {
- DWORD idx = WaitForMultipleObjects(handles.GetCount(), handles.GetData(), FALSE, INFINITE);
-
- if(idx == (WAIT_OBJECT_0 + 0)) // m_frd.hEndThreadEvent
- {
- break;
- }
- if(idx == (WAIT_OBJECT_0 + 1)) // m_frd.hRefreshEvent
- {
- SetupFRD(paths, handles);
- }
- else if(idx >= (WAIT_OBJECT_0 + 2) && idx < (WAIT_OBJECT_0 + handles.GetCount()))
- {
- bool fLocked = true;
- IsSubtitleReloaderLocked(&fLocked);
- if(fLocked) continue;
-
- if(FindNextChangeNotification(handles[idx - WAIT_OBJECT_0]) == FALSE)
- break;
-
- int j = 0;
-
- POSITION pos = m_frd.files.GetHeadPosition();
- for(ptrdiff_t i = 0; pos && j == 0; i++)
- {
- CString fn = m_frd.files.GetNext(pos);
-
- CFileStatus status;
- if(CFileGetStatus(fn, status) && m_frd.mtime[i] != status.m_mtime)
- {
- for(j = 0; j < 10; j++)
- {
- if(FILE* f = _tfopen(fn, _T("rb+")))
- {
- fclose(f);
- j = 0;
- break;
- }
- else
- {
- Sleep(100);
- j++;
- }
- }
- }
- }
-
- if(j > 0)
- {
- SetupFRD(paths, handles);
- }
- else
- {
- Sleep(500);
-
- POSITION pos = m_frd.files.GetHeadPosition();
- for(ptrdiff_t i = 0; pos; i++)
- {
- CFileStatus status;
- if(CFileGetStatus(m_frd.files.GetNext(pos), status)
- && m_frd.mtime[i] != status.m_mtime)
- {
- Open();
- SetupFRD(paths, handles);
- break;
- }
- }
- }
- }
- else
- {
- break;
- }
- }
-
- for(ptrdiff_t i = 2; i < handles.GetCount(); i++)
- {
- FindCloseChangeNotification(handles[i]);
- }
-
- return 0;
+{
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST/*THREAD_PRIORITY_BELOW_NORMAL*/);
+
+ CStringArray paths;
+ CAtlArray<HANDLE> handles;
+
+ SetupFRD(paths, handles);
+
+ while(1)
+ {
+ DWORD idx = WaitForMultipleObjects(handles.GetCount(), handles.GetData(), FALSE, INFINITE);
+
+ if(idx == (WAIT_OBJECT_0 + 0)) // m_frd.hEndThreadEvent
+ {
+ break;
+ }
+ if(idx == (WAIT_OBJECT_0 + 1)) // m_frd.hRefreshEvent
+ {
+ SetupFRD(paths, handles);
+ }
+ else if(idx >= (WAIT_OBJECT_0 + 2) && idx < (WAIT_OBJECT_0 + handles.GetCount()))
+ {
+ bool fLocked = true;
+ IsSubtitleReloaderLocked(&fLocked);
+ if(fLocked) continue;
+
+ if(FindNextChangeNotification(handles[idx - WAIT_OBJECT_0]) == FALSE)
+ break;
+
+ int j = 0;
+
+ POSITION pos = m_frd.files.GetHeadPosition();
+ for(ptrdiff_t i = 0; pos && j == 0; i++)
+ {
+ CString fn = m_frd.files.GetNext(pos);
+
+ CFileStatus status;
+ if(CFileGetStatus(fn, status) && m_frd.mtime[i] != status.m_mtime)
+ {
+ for(j = 0; j < 10; j++)
+ {
+ if(FILE* f = _tfopen(fn, _T("rb+")))
+ {
+ fclose(f);
+ j = 0;
+ break;
+ }
+ else
+ {
+ Sleep(100);
+ j++;
+ }
+ }
+ }
+ }
+
+ if(j > 0)
+ {
+ SetupFRD(paths, handles);
+ }
+ else
+ {
+ Sleep(500);
+
+ POSITION pos = m_frd.files.GetHeadPosition();
+ for(ptrdiff_t i = 0; pos; i++)
+ {
+ CFileStatus status;
+ if(CFileGetStatus(m_frd.files.GetNext(pos), status)
+ && m_frd.mtime[i] != status.m_mtime)
+ {
+ Open();
+ SetupFRD(paths, handles);
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ for(ptrdiff_t i = 2; i < handles.GetCount(); i++)
+ {
+ FindCloseChangeNotification(handles[i]);
+ }
+
+ return 0;
}
diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.h b/src/filters/transform/vsfilter/DirectVobSubFilter.h
index e7444a0a6..56f1cb8de 100644
--- a/src/filters/transform/vsfilter/DirectVobSubFilter.h
+++ b/src/filters/transform/vsfilter/DirectVobSubFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,68 +30,68 @@
typedef struct
{
- HWND hSystrayWnd;
- IFilterGraph* graph;
- IDirectVobSub* dvs;
- bool fRunOnce, fShowIcon;
+ HWND hSystrayWnd;
+ IFilterGraph* graph;
+ IDirectVobSub* dvs;
+ bool fRunOnce, fShowIcon;
} SystrayIconData;
/* This is for graphedit */
[uuid("93A22E7A-5091-45ef-BA61-6DA26156A5D0")]
class CDirectVobSubFilter
- : public CBaseVideoFilter
- , public CDirectVobSub
- , public ISpecifyPropertyPages
- , public IAMStreamSelect
- , public CAMThread
+ : public CBaseVideoFilter
+ , public CDirectVobSub
+ , public ISpecifyPropertyPages
+ , public IAMStreamSelect
+ , public CAMThread
{
friend class CTextInputPin;
- CCritSec m_csQueueLock;
- CComPtr<ISubPicQueue> m_pSubPicQueue;
- void InitSubPicQueue();
- SubPicDesc m_spd;
+ CCritSec m_csQueueLock;
+ CComPtr<ISubPicQueue> m_pSubPicQueue;
+ void InitSubPicQueue();
+ SubPicDesc m_spd;
- bool AdjustFrameSize(CSize& s);
+ bool AdjustFrameSize(CSize& s);
protected:
- void GetOutputSize(int& w, int& h, int& arx, int& ary);
- HRESULT Transform(IMediaSample* pIn);
+ void GetOutputSize(int& w, int& h, int& arx, int& ary);
+ HRESULT Transform(IMediaSample* pIn);
public:
CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid = __uuidof(CDirectVobSubFilter));
- virtual ~CDirectVobSubFilter();
+ virtual ~CDirectVobSubFilter();
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
// CBaseFilter
- CBasePin* GetPin(int n);
- int GetPinCount();
+ CBasePin* GetPin(int n);
+ int GetPinCount();
- STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
- STDMETHODIMP QueryFilterInfo(FILTER_INFO* pInfo);
+ STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
+ STDMETHODIMP QueryFilterInfo(FILTER_INFO* pInfo);
// CTransformFilter
- HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pMediaType),
- CheckConnect(PIN_DIRECTION dir, IPin* pPin),
- CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin),
- BreakConnect(PIN_DIRECTION dir),
- StartStreaming(),
- StopStreaming(),
- NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pMediaType),
+ CheckConnect(PIN_DIRECTION dir, IPin* pPin),
+ CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin),
+ BreakConnect(PIN_DIRECTION dir),
+ StartStreaming(),
+ StopStreaming(),
+ NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
CAtlArray<CTextInputPin*> m_pTextInput;
// IDirectVobSub
STDMETHODIMP put_FileName(WCHAR* fn);
- STDMETHODIMP get_LanguageCount(int* nLangs);
- STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
- STDMETHODIMP put_SelectedLanguage(int iSelected);
+ STDMETHODIMP get_LanguageCount(int* nLangs);
+ STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
+ STDMETHODIMP put_SelectedLanguage(int iSelected);
STDMETHODIMP put_HideSubtitles(bool fHideSubtitles);
- STDMETHODIMP put_PreBuffering(bool fDoPreBuffering);
+ STDMETHODIMP put_PreBuffering(bool fDoPreBuffering);
STDMETHODIMP put_Placement(bool fOverridePlacement, int xperc, int yperc);
STDMETHODIMP put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize);
STDMETHODIMP put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer);
@@ -100,82 +100,82 @@ public:
STDMETHODIMP put_MediaFPS(bool fEnabled, double fps);
STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect);
STDMETHODIMP put_ZoomRect(NORMALIZEDRECT* rect);
- STDMETHODIMP HasConfigDialog(int iSelected);
- STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
+ STDMETHODIMP HasConfigDialog(int iSelected);
+ STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
- // IDirectVobSub2
- STDMETHODIMP put_TextSettings(STSStyle* pDefStyle);
- STDMETHODIMP put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType);
+ // IDirectVobSub2
+ STDMETHODIMP put_TextSettings(STSStyle* pDefStyle);
+ STDMETHODIMP put_AspectRatioSettings(CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType);
// ISpecifyPropertyPages
STDMETHODIMP GetPages(CAUUID* pPages);
- // IAMStreamSelect
- STDMETHODIMP Count(DWORD* pcStreams);
- STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
- STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
+ // IAMStreamSelect
+ STDMETHODIMP Count(DWORD* pcStreams);
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+ STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
// CPersistStream
- STDMETHODIMP GetClassID(CLSID* pClsid);
+ STDMETHODIMP GetClassID(CLSID* pClsid);
protected:
- HRESULT ChangeMediaType(int iPosition);
+ HRESULT ChangeMediaType(int iPosition);
- HDC m_hdc;
- HBITMAP m_hbm;
- HFONT m_hfont;
- void PrintMessages(BYTE* pOut);
+ HDC m_hdc;
+ HBITMAP m_hbm;
+ HFONT m_hfont;
+ void PrintMessages(BYTE* pOut);
- /* ResX2 */
- CAutoVectorPtr<BYTE> m_pTempPicBuff;
- HRESULT Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, int bpp, const GUID& subtype, DWORD black);
+/* ResX2 */
+ CAutoVectorPtr<BYTE> m_pTempPicBuff;
+ HRESULT Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, int bpp, const GUID& subtype, DWORD black);
- // segment start time, absolute time
- CRefTime m_tPrev;
- REFERENCE_TIME CalcCurrentTime();
+ // segment start time, absolute time
+ CRefTime m_tPrev;
+ REFERENCE_TIME CalcCurrentTime();
- double m_fps;
+ double m_fps;
- // 3.x- versions of microsoft's mpeg4 codec output flipped image
- bool m_fMSMpeg4Fix;
+ // 3.x- versions of microsoft's mpeg4 codec output flipped image
+ bool m_fMSMpeg4Fix;
- // don't set the "hide subtitles" stream until we are finished with loading
- bool m_fLoading;
+ // don't set the "hide subtitles" stream until we are finished with loading
+ bool m_fLoading;
- bool Open();
+ bool Open();
- int FindPreferedLanguage(bool fHideToo = true);
- void UpdatePreferedLanguages(CString lang);
+ int FindPreferedLanguage(bool fHideToo = true);
+ void UpdatePreferedLanguages(CString lang);
- CCritSec m_csSubLock;
- CInterfaceList<ISubStream> m_pSubStreams;
- DWORD_PTR m_nSubtitleId;
- void UpdateSubtitle(bool fApplyDefStyle = true);
- void SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle = true);
- void InvalidateSubtitle(REFERENCE_TIME rtInvalidate = -1, DWORD_PTR nSubtitleId = -1);
+ CCritSec m_csSubLock;
+ CInterfaceList<ISubStream> m_pSubStreams;
+ DWORD_PTR m_nSubtitleId;
+ void UpdateSubtitle(bool fApplyDefStyle = true);
+ void SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle = true);
+ void InvalidateSubtitle(REFERENCE_TIME rtInvalidate = -1, DWORD_PTR nSubtitleId = -1);
- // the text input pin is using these
- void AddSubStream(ISubStream* pSubStream);
- void RemoveSubStream(ISubStream* pSubStream);
- void Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId = -1);
+ // the text input pin is using these
+ void AddSubStream(ISubStream* pSubStream);
+ void RemoveSubStream(ISubStream* pSubStream);
+ void Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId = -1);
private:
- class CFileReloaderData
- {
- public:
- ATL::CEvent EndThreadEvent, RefreshEvent;
- CAtlList<CString> files;
- CAtlArray<CTime> mtime;
- } m_frd;
+ class CFileReloaderData
+ {
+ public:
+ ATL::CEvent EndThreadEvent, RefreshEvent;
+ CAtlList<CString> files;
+ CAtlArray<CTime> mtime;
+ } m_frd;
- void SetupFRD(CStringArray& paths, CAtlArray<HANDLE>& handles);
- DWORD ThreadProc();
+ void SetupFRD(CStringArray& paths, CAtlArray<HANDLE>& handles);
+ DWORD ThreadProc();
private:
- HANDLE m_hSystrayThread;
- SystrayIconData m_tbid;
+ HANDLE m_hSystrayThread;
+ SystrayIconData m_tbid;
- VIDEOINFOHEADER2 m_CurrentVIH2;
+ VIDEOINFOHEADER2 m_CurrentVIH2;
};
/* The "auto-loading" version */
@@ -183,14 +183,14 @@ private:
[uuid("9852A670-F845-491b-9BE6-EBD841B8A613")]
class CDirectVobSubFilter2 : public CDirectVobSubFilter
{
- bool ShouldWeAutoload(IFilterGraph* pGraph);
- void GetRidOfInternalScriptRenderer();
+ bool ShouldWeAutoload(IFilterGraph* pGraph);
+ void GetRidOfInternalScriptRenderer();
public:
CDirectVobSubFilter2(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid = __uuidof(CDirectVobSubFilter2));
- HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
- STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
+ HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
+ STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
HRESULT CheckInputType(const CMediaType* mtIn);
};
diff --git a/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp b/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp
index fae5289f7..5a3d9b0a6 100644
--- a/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp
+++ b/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -33,12 +33,12 @@
BOOL WINAPI MyGetDialogSize(int iResourceID, DLGPROC pDlgProc, LPARAM lParam, SIZE* pResult)
{
HWND hwnd = CreateDialogParam(AfxGetResourceHandle(),
- MAKEINTRESOURCE(iResourceID),
- GetDesktopWindow(),
- pDlgProc,
- lParam);
-
- if(hwnd == NULL) return FALSE;
+ MAKEINTRESOURCE(iResourceID),
+ GetDesktopWindow(),
+ pDlgProc,
+ lParam);
+
+ if(hwnd == NULL) return FALSE;
RECT rc;
GetWindowRect(hwnd, &rc);
@@ -52,55 +52,51 @@ BOOL WINAPI MyGetDialogSize(int iResourceID, DLGPROC pDlgProc, LPARAM lParam, SI
STDMETHODIMP CDVSBasePPage::GetPageInfo(LPPROPPAGEINFO pPageInfo)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CString str;
- if(!str.LoadString(m_TitleId)) return E_FAIL;
+ CString str;
+ if(!str.LoadString(m_TitleId)) return E_FAIL;
- WCHAR wszTitle[STR_MAX_LENGTH];
+ WCHAR wszTitle[STR_MAX_LENGTH];
#ifdef UNICODE
- wcscpy(wszTitle, str);
+ wcscpy(wszTitle, str);
#else
- mbstowcs(wszTitle, str, str.GetLength() + 1);
+ mbstowcs(wszTitle, str, str.GetLength()+1);
#endif
- CheckPointer(pPageInfo, E_POINTER);
+ CheckPointer(pPageInfo, E_POINTER);
- // Allocate dynamic memory for the property page title
+ // Allocate dynamic memory for the property page title
- LPOLESTR pszTitle;
- HRESULT hr = AMGetWideString(wszTitle, &pszTitle);
- if(FAILED(hr))
- {
- NOTE("No caption memory");
- return hr;
- }
+ LPOLESTR pszTitle;
+ HRESULT hr = AMGetWideString(wszTitle, &pszTitle);
+ if(FAILED(hr)) {NOTE("No caption memory"); return hr;}
- pPageInfo->cb = sizeof(PROPPAGEINFO);
- pPageInfo->pszTitle = pszTitle;
- pPageInfo->pszDocString = NULL;
- pPageInfo->pszHelpFile = NULL;
- pPageInfo->dwHelpContext = 0;
- // Set defaults in case GetDialogSize fails
- pPageInfo->size.cx = 340;
- pPageInfo->size.cy = 150;
+ pPageInfo->cb = sizeof(PROPPAGEINFO);
+ pPageInfo->pszTitle = pszTitle;
+ pPageInfo->pszDocString = NULL;
+ pPageInfo->pszHelpFile = NULL;
+ pPageInfo->dwHelpContext = 0;
+ // Set defaults in case GetDialogSize fails
+ pPageInfo->size.cx = 340;
+ pPageInfo->size.cy = 150;
- MyGetDialogSize(m_DialogId, DialogProc, 0L, &pPageInfo->size);
+ MyGetDialogSize(m_DialogId, DialogProc, 0L, &pPageInfo->size);
- return NOERROR;
+ return NOERROR;
}
STDMETHODIMP CDVSBasePPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CheckPointer(pRect, E_POINTER);
- /*
- // Return failure if SetObject has not been called.
- if (m_bObjectSet == FALSE) {
- return E_UNEXPECTED;
- }
- */
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CheckPointer(pRect,E_POINTER);
+/*
+ // Return failure if SetObject has not been called.
+ if (m_bObjectSet == FALSE) {
+ return E_UNEXPECTED;
+ }
+*/
if(m_hwnd) return E_UNEXPECTED;
m_hwnd = CreateDialogParam(AfxGetResourceHandle(), MAKEINTRESOURCE(m_DialogId), hwndParent, DialogProc, (LPARAM)this);
@@ -116,8 +112,8 @@ STDMETHODIMP CDVSBasePPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal
CDVSBasePPage::CDVSBasePPage(TCHAR* pName, LPUNKNOWN lpunk, int DialogId, int TitleId) :
CBasePropertyPage(pName, lpunk, DialogId, TitleId),
m_bIsInitialized(FALSE),
- m_fAttached(false),
- m_fDisableInstantUpdate(false)
+ m_fAttached(false),
+ m_fDisableInstantUpdate(false)
{
}
@@ -125,52 +121,52 @@ INT_PTR CDVSBasePPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- if(m_bIsInitialized)
+ case WM_COMMAND:
{
- m_bDirty = TRUE;
- if(m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
-
- switch(HIWORD(wParam))
- {
- case BN_CLICKED:
- case CBN_SELCHANGE:
- case EN_CHANGE:
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- if(!m_fDisableInstantUpdate
- && !(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_INSTANTUPDATE)
- && !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1))
- OnApplyChanges();
- }
- }
- }
- }
- break;
-
- case WM_NCDESTROY:
- DetachControls();
- break;
- }
-
- return OnMessage(uMsg, wParam, lParam)
- ? 0
- : CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam);
+ if(m_bIsInitialized)
+ {
+ m_bDirty = TRUE;
+ if(m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
+
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ case CBN_SELCHANGE:
+ case EN_CHANGE:
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(!m_fDisableInstantUpdate
+ && !(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_INSTANTUPDATE)
+ && !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1))
+ OnApplyChanges();
+ }
+ }
+ }
+ }
+ break;
+
+ case WM_NCDESTROY:
+ DetachControls();
+ break;
+ }
+
+ return OnMessage(uMsg, wParam, lParam)
+ ? 0
+ : CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam);
}
HRESULT CDVSBasePPage::OnConnect(IUnknown* pUnknown)
{
if(!(m_pDirectVobSub = pUnknown)) return E_NOINTERFACE;
- m_pDirectVobSub->LockSubtitleReloader(true); // *
+ m_pDirectVobSub->LockSubtitleReloader(true); // *
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- UpdateObjectData(false);
+ UpdateObjectData(false);
- m_bIsInitialized = FALSE;
+ m_bIsInitialized = FALSE;
return NOERROR;
}
@@ -179,39 +175,39 @@ HRESULT CDVSBasePPage::OnDisconnect()
{
if(m_pDirectVobSub == NULL) return E_UNEXPECTED;
- m_pDirectVobSub->LockSubtitleReloader(false); // *
+ m_pDirectVobSub->LockSubtitleReloader(false); // *
- // for some reason OnDisconnect() will be called twice, that's why we
- // need to release m_pDirectVobSub manually on the first call to avoid
- // a second "m_pDirectVobSub->LockSubtitleReloader(false);"
+ // for some reason OnDisconnect() will be called twice, that's why we
+ // need to release m_pDirectVobSub manually on the first call to avoid
+ // a second "m_pDirectVobSub->LockSubtitleReloader(false);"
- m_pDirectVobSub.Release();
+ m_pDirectVobSub.Release();
- return NOERROR;
+ return NOERROR;
}
HRESULT CDVSBasePPage::OnActivate()
{
- ASSERT(m_pDirectVobSub);
+ ASSERT(m_pDirectVobSub);
- AttachControls();
+ AttachControls();
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- UpdateControlData(false);
+ UpdateControlData(false);
- m_bIsInitialized = TRUE;
+ m_bIsInitialized = TRUE;
return NOERROR;
}
HRESULT CDVSBasePPage::OnDeactivate()
{
- ASSERT(m_pDirectVobSub);
+ ASSERT(m_pDirectVobSub);
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- UpdateControlData(true);
+ UpdateControlData(true);
m_bIsInitialized = FALSE;
@@ -222,249 +218,249 @@ HRESULT CDVSBasePPage::OnApplyChanges()
{
ASSERT(m_pDirectVobSub);
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(m_bIsInitialized)
- {
- OnDeactivate();
+ if(m_bIsInitialized)
+ {
+ OnDeactivate();
UpdateObjectData(true);
- m_pDirectVobSub->UpdateRegistry(); // *
- OnActivate();
- }
+ m_pDirectVobSub->UpdateRegistry(); // *
+ OnActivate();
+ }
return NOERROR;
}
void CDVSBasePPage::AttachControls()
{
- DetachControls();
-
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- POSITION pos = m_controls.GetStartPosition();
- while(pos)
- {
- UINT id;
- CWnd* pControl;
- m_controls.GetNextAssoc(pos, id, pControl);
- if(pControl)
- {
- BOOL fRet = pControl->Attach(GetDlgItem(m_Dlg, id));
- ASSERT(fRet);
- }
- }
-
- m_fAttached = true;
+ DetachControls();
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ POSITION pos = m_controls.GetStartPosition();
+ while(pos)
+ {
+ UINT id;
+ CWnd* pControl;
+ m_controls.GetNextAssoc(pos, id, pControl);
+ if(pControl)
+ {
+ BOOL fRet = pControl->Attach(GetDlgItem(m_Dlg, id));
+ ASSERT(fRet);
+ }
+ }
+
+ m_fAttached = true;
}
void CDVSBasePPage::DetachControls()
{
- if(!m_fAttached) return;
+ if(!m_fAttached) return;
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- POSITION pos = m_controls.GetStartPosition();
- while(pos)
- {
- UINT id;
- CWnd* pControl;
- m_controls.GetNextAssoc(pos, id, pControl);
- if(pControl) pControl->Detach();
- }
+ POSITION pos = m_controls.GetStartPosition();
+ while(pos)
+ {
+ UINT id;
+ CWnd* pControl;
+ m_controls.GetNextAssoc(pos, id, pControl);
+ if(pControl) pControl->Detach();
+ }
- m_fAttached = false;
+ m_fAttached = false;
}
void CDVSBasePPage::BindControl(UINT id, CWnd& control)
{
- m_controls[id] = &control;
+ m_controls[id] = &control;
}
/* CDVSMainPPage */
CDVSMainPPage::CDVSMainPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Property Page (main)"), pUnk, IDD_DVSMAINPAGE, IDD_DVSMAINPAGE),
- m_nLangs(0),
- m_ppLangs(NULL)
+ m_nLangs(0),
+ m_ppLangs(NULL)
{
- BindControl(IDC_FILENAME, m_fnedit);
- BindControl(IDC_LANGCOMBO, m_langs);
- BindControl(IDC_OVERRIDEPLACEMENT, m_oplacement);
- BindControl(IDC_SPIN1, m_subposx);
- BindControl(IDC_SPIN2, m_subposy);
- BindControl(IDC_FONT, m_font);
- BindControl(IDC_ONLYSHOWFORCEDSUBS, m_forcedsubs);
- BindControl(IDC_PARCOMBO, m_PARCombo);
+ BindControl(IDC_FILENAME, m_fnedit);
+ BindControl(IDC_LANGCOMBO, m_langs);
+ BindControl(IDC_OVERRIDEPLACEMENT, m_oplacement);
+ BindControl(IDC_SPIN1, m_subposx);
+ BindControl(IDC_SPIN2, m_subposy);
+ BindControl(IDC_FONT, m_font);
+ BindControl(IDC_ONLYSHOWFORCEDSUBS, m_forcedsubs);
+ BindControl(IDC_PARCOMBO, m_PARCombo);
}
CDVSMainPPage::~CDVSMainPPage()
{
- FreeLangs();
+ FreeLangs();
}
void CDVSMainPPage::FreeLangs()
{
- if(m_nLangs > 0 && m_ppLangs)
- {
- for(ptrdiff_t i = 0; i < m_nLangs; i++) CoTaskMemFree(m_ppLangs[i]);
- CoTaskMemFree(m_ppLangs);
- m_nLangs = 0;
- m_ppLangs = NULL;
- }
+ if(m_nLangs > 0 && m_ppLangs)
+ {
+ for(ptrdiff_t i = 0; i < m_nLangs; i++) CoTaskMemFree(m_ppLangs[i]);
+ CoTaskMemFree(m_ppLangs);
+ m_nLangs = 0;
+ m_ppLangs = NULL;
+ }
}
void CDVSMainPPage::AllocLangs(int nLangs)
{
- m_ppLangs = (WCHAR**)CoTaskMemRealloc(m_ppLangs, sizeof(WCHAR*) * nLangs);
- m_nLangs = nLangs;
+ m_ppLangs = (WCHAR**)CoTaskMemRealloc(m_ppLangs, sizeof(WCHAR*)*nLangs);
+ m_nLangs = nLangs;
}
bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
- {
- case BN_CLICKED:
+ case WM_COMMAND:
{
- if(LOWORD(wParam) == IDC_OPEN)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CFileDialog fd(TRUE, NULL, NULL,
- OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
- _T(".idx .smi .sub .srt .psb .ssa .ass .usf .ssf|*.idx;*.smi;*.sub;*.srt;*.psb;*.ssa;*.ass;*.usf;*.ssf|")
- _T("All files (*.*)|*.*||"),
- CDialog::FromHandle(m_Dlg), 0);
-
- if(fd.DoModal() == IDOK)
- {
- m_fnedit.SetWindowText(fd.GetPathName());
- }
-
- return(true);
- }
- else if(LOWORD(wParam) == IDC_FONT)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CStyleEditorDialog dlg(_T("Default"), &m_defStyle, CWnd::FromHandle(m_hwnd));
-
- if(dlg.DoModal() == IDOK)
- {
- m_defStyle = dlg.m_stss;
- CString str = m_defStyle.fontName;
- if(str.GetLength() > 18) str = str.Left(16).TrimRight() + _T("...");
- m_font.SetWindowText(str);
- }
-
- return(true);
- }
- }
- break;
- }
- }
- break;
- }
-
- return(false);
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_OPEN)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CFileDialog fd(TRUE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST,
+ _T(".idx .smi .sub .srt .psb .ssa .ass .usf .ssf|*.idx;*.smi;*.sub;*.srt;*.psb;*.ssa;*.ass;*.usf;*.ssf|")
+ _T("All files (*.*)|*.*||"),
+ CDialog::FromHandle(m_Dlg), 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ m_fnedit.SetWindowText(fd.GetPathName());
+ }
+
+ return(true);
+ }
+ else if(LOWORD(wParam) == IDC_FONT)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CStyleEditorDialog dlg(_T("Default"), &m_defStyle, CWnd::FromHandle(m_hwnd));
+
+ if(dlg.DoModal() == IDOK)
+ {
+ m_defStyle = dlg.m_stss;
+ CString str = m_defStyle.fontName;
+ if(str.GetLength() > 18) str = str.Left(16).TrimRight() + _T("...");
+ m_font.SetWindowText(str);
+ }
+
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
}
void CDVSMainPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- if(m_pDirectVobSub->put_FileName(m_fn) == S_OK)
- {
- int nLangs;
- m_pDirectVobSub->get_LanguageCount(&nLangs);
- AllocLangs(nLangs);
- for(ptrdiff_t i = 0; i < m_nLangs; i++) m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
- m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
- }
-
- m_pDirectVobSub->put_SelectedLanguage(m_iSelectedLanguage);
- m_pDirectVobSub->put_Placement(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc);
- m_pDirectVobSub->put_VobSubSettings(true, m_fOnlyShowForcedVobSubs, false);
- m_pDirectVobSub->put_TextSettings(&m_defStyle);
- m_pDirectVobSub->put_AspectRatioSettings(&m_ePARCompensationType);
- }
- else
- {
- m_pDirectVobSub->get_FileName(m_fn);
- int nLangs;
- m_pDirectVobSub->get_LanguageCount(&nLangs);
- AllocLangs(nLangs);
- for(ptrdiff_t i = 0; i < m_nLangs; i++) m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
- m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
- m_pDirectVobSub->get_Placement(&m_fOverridePlacement, &m_PlacementXperc, &m_PlacementYperc);
- m_pDirectVobSub->get_VobSubSettings(NULL, &m_fOnlyShowForcedVobSubs, NULL);
- m_pDirectVobSub->get_TextSettings(&m_defStyle);
- m_pDirectVobSub->get_AspectRatioSettings(&m_ePARCompensationType);
- }
+ if(fSave)
+ {
+ if(m_pDirectVobSub->put_FileName(m_fn) == S_OK)
+ {
+ int nLangs;
+ m_pDirectVobSub->get_LanguageCount(&nLangs);
+ AllocLangs(nLangs);
+ for(ptrdiff_t i = 0; i < m_nLangs; i++) m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
+ m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
+ }
+
+ m_pDirectVobSub->put_SelectedLanguage(m_iSelectedLanguage);
+ m_pDirectVobSub->put_Placement(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc);
+ m_pDirectVobSub->put_VobSubSettings(true, m_fOnlyShowForcedVobSubs, false);
+ m_pDirectVobSub->put_TextSettings(&m_defStyle);
+ m_pDirectVobSub->put_AspectRatioSettings(&m_ePARCompensationType);
+ }
+ else
+ {
+ m_pDirectVobSub->get_FileName(m_fn);
+ int nLangs;
+ m_pDirectVobSub->get_LanguageCount(&nLangs);
+ AllocLangs(nLangs);
+ for(ptrdiff_t i = 0; i < m_nLangs; i++) m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
+ m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
+ m_pDirectVobSub->get_Placement(&m_fOverridePlacement, &m_PlacementXperc, &m_PlacementYperc);
+ m_pDirectVobSub->get_VobSubSettings(NULL, &m_fOnlyShowForcedVobSubs, NULL);
+ m_pDirectVobSub->get_TextSettings(&m_defStyle);
+ m_pDirectVobSub->get_AspectRatioSettings(&m_ePARCompensationType);
+ }
}
void CDVSMainPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- CString fn;
- m_fnedit.GetWindowText(fn);
+ if(fSave)
+ {
+ CString fn;
+ m_fnedit.GetWindowText(fn);
#ifdef UNICODE
- wcscpy(m_fn, fn);
+ wcscpy(m_fn, fn);
#else
- mbstowcs(m_fn, fn, fn.GetLength() + 1);
+ mbstowcs(m_fn, fn, fn.GetLength()+1);
#endif
- m_iSelectedLanguage = m_langs.GetCurSel();
- m_fOverridePlacement = !!m_oplacement.GetCheck();
- m_PlacementXperc = m_subposx.GetPos();
- m_PlacementYperc = m_subposy.GetPos();
- m_fOnlyShowForcedVobSubs = !!m_forcedsubs.GetCheck();
- if(m_PARCombo.GetCurSel() != CB_ERR)
- m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(m_PARCombo.GetItemData(m_PARCombo.GetCurSel()));
- else
- m_ePARCompensationType = CSimpleTextSubtitle::EPCTDisabled;
- }
- else
- {
- m_fnedit.SetWindowText(CString(m_fn));
- m_oplacement.SetCheck(m_fOverridePlacement);
- m_subposx.SetRange(-20, 120);
- m_subposx.SetPos(m_PlacementXperc);
- m_subposx.EnableWindow(m_fOverridePlacement);
- m_subposy.SetRange(-20, 120);
- m_subposy.SetPos(m_PlacementYperc);
- m_subposy.EnableWindow(m_fOverridePlacement);
- m_font.SetWindowText(m_defStyle.fontName);
- m_forcedsubs.SetCheck(m_fOnlyShowForcedVobSubs);
- m_langs.ResetContent();
- m_langs.EnableWindow(m_nLangs > 0);
- for(ptrdiff_t i = 0; i < m_nLangs; i++) m_langs.AddString(CString(m_ppLangs[i]));
- m_langs.SetCurSel(m_iSelectedLanguage);
-
- m_PARCombo.ResetContent();
- m_PARCombo.InsertString(0, ResStr(IDS_RT_PAR_DISABLED));
- m_PARCombo.SetItemData(0, CSimpleTextSubtitle::EPCTDisabled);
- if(m_ePARCompensationType == CSimpleTextSubtitle::EPCTDisabled)
- m_PARCombo.SetCurSel(0);
-
- m_PARCombo.InsertString(1, ResStr(IDS_RT_PAR_DOWNSCALE));
- m_PARCombo.SetItemData(1, CSimpleTextSubtitle::EPCTDownscale);
- if(m_ePARCompensationType == CSimpleTextSubtitle::EPCTDownscale)
- m_PARCombo.SetCurSel(1);
-
- m_PARCombo.InsertString(2, ResStr(IDS_RT_PAR_UPSCALE));
- m_PARCombo.SetItemData(2, CSimpleTextSubtitle::EPCTUpscale);
- if(m_ePARCompensationType == CSimpleTextSubtitle::EPCTUpscale)
- m_PARCombo.SetCurSel(2);
-
- m_PARCombo.InsertString(3, ResStr(IDS_RT_PAR_ACCURATE_SIZE));
- m_PARCombo.SetItemData(3, CSimpleTextSubtitle::EPCTAccurateSize);
- if(m_ePARCompensationType == CSimpleTextSubtitle::EPCTAccurateSize)
- m_PARCombo.SetCurSel(3);
- }
+ m_iSelectedLanguage = m_langs.GetCurSel();
+ m_fOverridePlacement = !!m_oplacement.GetCheck();
+ m_PlacementXperc = m_subposx.GetPos();
+ m_PlacementYperc = m_subposy.GetPos();
+ m_fOnlyShowForcedVobSubs = !!m_forcedsubs.GetCheck();
+ if (m_PARCombo.GetCurSel() != CB_ERR)
+ m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(m_PARCombo.GetItemData(m_PARCombo.GetCurSel()));
+ else
+ m_ePARCompensationType = CSimpleTextSubtitle::EPCTDisabled;
+ }
+ else
+ {
+ m_fnedit.SetWindowText(CString(m_fn));
+ m_oplacement.SetCheck(m_fOverridePlacement);
+ m_subposx.SetRange(-20, 120);
+ m_subposx.SetPos(m_PlacementXperc);
+ m_subposx.EnableWindow(m_fOverridePlacement);
+ m_subposy.SetRange(-20, 120);
+ m_subposy.SetPos(m_PlacementYperc);
+ m_subposy.EnableWindow(m_fOverridePlacement);
+ m_font.SetWindowText(m_defStyle.fontName);
+ m_forcedsubs.SetCheck(m_fOnlyShowForcedVobSubs);
+ m_langs.ResetContent();
+ m_langs.EnableWindow(m_nLangs > 0);
+ for(ptrdiff_t i = 0; i < m_nLangs; i++) m_langs.AddString(CString(m_ppLangs[i]));
+ m_langs.SetCurSel(m_iSelectedLanguage);
+
+ m_PARCombo.ResetContent();
+ m_PARCombo.InsertString(0, ResStr(IDS_RT_PAR_DISABLED));
+ m_PARCombo.SetItemData(0, CSimpleTextSubtitle::EPCTDisabled);
+ if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTDisabled)
+ m_PARCombo.SetCurSel(0);
+
+ m_PARCombo.InsertString(1, ResStr(IDS_RT_PAR_DOWNSCALE));
+ m_PARCombo.SetItemData(1, CSimpleTextSubtitle::EPCTDownscale);
+ if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTDownscale)
+ m_PARCombo.SetCurSel(1);
+
+ m_PARCombo.InsertString(2, ResStr(IDS_RT_PAR_UPSCALE));
+ m_PARCombo.SetItemData(2, CSimpleTextSubtitle::EPCTUpscale);
+ if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTUpscale)
+ m_PARCombo.SetCurSel(2);
+
+ m_PARCombo.InsertString(3, ResStr(IDS_RT_PAR_ACCURATE_SIZE));
+ m_PARCombo.SetItemData(3, CSimpleTextSubtitle::EPCTAccurateSize);
+ if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTAccurateSize)
+ m_PARCombo.SetCurSel(3);
+ }
}
/* CDVSGeneralPPage */
@@ -472,128 +468,115 @@ void CDVSMainPPage::UpdateControlData(bool fSave)
CDVSGeneralPPage::CDVSGeneralPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Property Page (global settings)"), pUnk, IDD_DVSGENERALPAGE, IDD_DVSGENERALPAGE)
{
- BindControl(IDC_VEREXTCOMBO, m_verext);
- BindControl(IDC_MOD32FIX, m_mod32fix);
- BindControl(IDC_RESX2COMBO, m_resx2);
- BindControl(IDC_SPIN3, m_resx2w);
- BindControl(IDC_SPIN4, m_resx2h);
- BindControl(IDC_LOADCOMBO, m_load);
- BindControl(IDC_EXTLOAD, m_extload);
- BindControl(IDC_WEBLOAD, m_webload);
- BindControl(IDC_EMBLOAD, m_embload);
+ BindControl(IDC_VEREXTCOMBO, m_verext);
+ BindControl(IDC_MOD32FIX, m_mod32fix);
+ BindControl(IDC_RESX2COMBO, m_resx2);
+ BindControl(IDC_SPIN3, m_resx2w);
+ BindControl(IDC_SPIN4, m_resx2h);
+ BindControl(IDC_LOADCOMBO, m_load);
+ BindControl(IDC_EXTLOAD, m_extload);
+ BindControl(IDC_WEBLOAD, m_webload);
+ BindControl(IDC_EMBLOAD, m_embload);
}
bool CDVSGeneralPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
- {
- case CBN_SELCHANGE:
+ case WM_COMMAND:
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- if(LOWORD(wParam) == IDC_RESX2COMBO)
- {
- m_resx2w.EnableWindow(m_resx2.GetCurSel() == 2);
- m_resx2h.EnableWindow(m_resx2.GetCurSel() == 2);
- return(true);
- }
- else if(LOWORD(wParam) == IDC_LOADCOMBO)
- {
- m_extload.EnableWindow(m_load.GetCurSel() == 1);
- m_webload.EnableWindow(m_load.GetCurSel() == 1);
- m_embload.EnableWindow(m_load.GetCurSel() == 1);
- return(true);
- }
- }
- break;
- }
- }
- break;
- }
-
- return(false);
+ switch(HIWORD(wParam))
+ {
+ case CBN_SELCHANGE:
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(LOWORD(wParam) == IDC_RESX2COMBO)
+ {
+ m_resx2w.EnableWindow(m_resx2.GetCurSel() == 2);
+ m_resx2h.EnableWindow(m_resx2.GetCurSel() == 2);
+ return(true);
+ }
+ else if(LOWORD(wParam) == IDC_LOADCOMBO)
+ {
+ m_extload.EnableWindow(m_load.GetCurSel() == 1);
+ m_webload.EnableWindow(m_load.GetCurSel() == 1);
+ m_embload.EnableWindow(m_load.GetCurSel() == 1);
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
}
void CDVSGeneralPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- m_pDirectVobSub->put_ExtendPicture(m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh);
- m_pDirectVobSub->put_LoadSettings(m_LoadLevel, m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad);
- }
- else
- {
- m_pDirectVobSub->get_ExtendPicture(&m_HorExt, &m_VerExt, &m_ResX2, &m_ResX2minw, &m_ResX2minh);
- m_pDirectVobSub->get_LoadSettings(&m_LoadLevel, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
- }
+ if(fSave)
+ {
+ m_pDirectVobSub->put_ExtendPicture(m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh);
+ m_pDirectVobSub->put_LoadSettings(m_LoadLevel, m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad);
+ }
+ else
+ {
+ m_pDirectVobSub->get_ExtendPicture(&m_HorExt, &m_VerExt, &m_ResX2, &m_ResX2minw, &m_ResX2minh);
+ m_pDirectVobSub->get_LoadSettings(&m_LoadLevel, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
+ }
}
void CDVSGeneralPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- if(m_verext.GetCurSel() >= 0) m_VerExt = m_verext.GetItemData(m_verext.GetCurSel());
- m_HorExt = !!m_mod32fix.GetCheck();
- if(m_resx2.GetCurSel() >= 0) m_ResX2 = m_resx2.GetItemData(m_resx2.GetCurSel());
- m_ResX2minw = m_resx2w.GetPos();
- m_ResX2minh = m_resx2h.GetPos();
- if(m_load.GetCurSel() >= 0) m_LoadLevel = m_load.GetItemData(m_load.GetCurSel());
- m_fExternalLoad = !!m_extload.GetCheck();
- m_fWebLoad = !!m_webload.GetCheck();
- m_fEmbeddedLoad = !!m_embload.GetCheck();
- }
- else
- {
- m_verext.ResetContent();
- m_verext.AddString(ResStr(IDS_ORGHEIGHT));
- m_verext.SetItemData(0, 0);
- m_verext.AddString(ResStr(IDS_EXTTO169));
- m_verext.SetItemData(1, 1);
- m_verext.AddString(ResStr(IDS_EXTTO43));
- m_verext.SetItemData(2, 2);
- m_verext.AddString(ResStr(IDS_EXTTO480));
- m_verext.SetItemData(3, 3);
- m_verext.AddString(ResStr(IDS_EXTTO576));
- m_verext.SetItemData(4, 4);
- m_verext.AddString(ResStr(IDS_CROPTO169));
- m_verext.SetItemData(5, 0x81);
- m_verext.AddString(ResStr(IDS_CROPTO43));
- m_verext.SetItemData(6, 0x82);
- m_verext.SetCurSel((m_VerExt & 0x7f) + ((m_VerExt & 0x80) ? 4 : 0));
- m_mod32fix.SetCheck(m_HorExt & 1);
- m_resx2.ResetContent();
- m_resx2.AddString(ResStr(IDS_ORGRES));
- m_resx2.SetItemData(0, 0);
- m_resx2.AddString(ResStr(IDS_DBLRES));
- m_resx2.SetItemData(1, 1);
- m_resx2.AddString(ResStr(IDS_DBLRESIF));
- m_resx2.SetItemData(2, 2);
- m_resx2.SetCurSel(m_ResX2);
- m_resx2w.SetRange(0, 2048);
- m_resx2w.SetPos(m_ResX2minw);
- m_resx2w.EnableWindow(m_ResX2 == 2);
- m_resx2h.SetRange(0, 2048);
- m_resx2h.SetPos(m_ResX2minh);
- m_resx2h.EnableWindow(m_ResX2 == 2);
- m_load.ResetContent();
- m_load.AddString(ResStr(IDS_DONOTLOAD));
- m_load.SetItemData(0, 2);
- m_load.AddString(ResStr(IDS_LOADWHENNEEDED));
- m_load.SetItemData(1, 0);
- m_load.AddString(ResStr(IDS_ALWAYSLOAD));
- m_load.SetItemData(2, 1);
- m_load.SetCurSel(!m_LoadLevel ? 1 : m_LoadLevel == 1 ? 2 : 0);
- m_extload.SetCheck(m_fExternalLoad);
- m_webload.SetCheck(m_fWebLoad);
- m_embload.SetCheck(m_fEmbeddedLoad);
- m_extload.EnableWindow(m_load.GetCurSel() == 1);
- m_webload.EnableWindow(m_load.GetCurSel() == 1);
- m_embload.EnableWindow(m_load.GetCurSel() == 1);
- }
+ if(fSave)
+ {
+ if(m_verext.GetCurSel() >= 0) m_VerExt = m_verext.GetItemData(m_verext.GetCurSel());
+ m_HorExt = !!m_mod32fix.GetCheck();
+ if(m_resx2.GetCurSel() >= 0) m_ResX2 = m_resx2.GetItemData(m_resx2.GetCurSel());
+ m_ResX2minw = m_resx2w.GetPos();
+ m_ResX2minh = m_resx2h.GetPos();
+ if(m_load.GetCurSel() >= 0) m_LoadLevel = m_load.GetItemData(m_load.GetCurSel());
+ m_fExternalLoad = !!m_extload.GetCheck();
+ m_fWebLoad = !!m_webload.GetCheck();
+ m_fEmbeddedLoad = !!m_embload.GetCheck();
+ }
+ else
+ {
+ m_verext.ResetContent();
+ m_verext.AddString(ResStr(IDS_ORGHEIGHT)); m_verext.SetItemData(0, 0);
+ m_verext.AddString(ResStr(IDS_EXTTO169)); m_verext.SetItemData(1, 1);
+ m_verext.AddString(ResStr(IDS_EXTTO43)); m_verext.SetItemData(2, 2);
+ m_verext.AddString(ResStr(IDS_EXTTO480)); m_verext.SetItemData(3, 3);
+ m_verext.AddString(ResStr(IDS_EXTTO576)); m_verext.SetItemData(4, 4);
+ m_verext.AddString(ResStr(IDS_CROPTO169)); m_verext.SetItemData(5, 0x81);
+ m_verext.AddString(ResStr(IDS_CROPTO43)); m_verext.SetItemData(6, 0x82);
+ m_verext.SetCurSel((m_VerExt&0x7f) + ((m_VerExt&0x80)?4:0));
+ m_mod32fix.SetCheck(m_HorExt&1);
+ m_resx2.ResetContent();
+ m_resx2.AddString(ResStr(IDS_ORGRES)); m_resx2.SetItemData(0, 0);
+ m_resx2.AddString(ResStr(IDS_DBLRES)); m_resx2.SetItemData(1, 1);
+ m_resx2.AddString(ResStr(IDS_DBLRESIF)); m_resx2.SetItemData(2, 2);
+ m_resx2.SetCurSel(m_ResX2);
+ m_resx2w.SetRange(0, 2048);
+ m_resx2w.SetPos(m_ResX2minw);
+ m_resx2w.EnableWindow(m_ResX2 == 2);
+ m_resx2h.SetRange(0, 2048);
+ m_resx2h.SetPos(m_ResX2minh);
+ m_resx2h.EnableWindow(m_ResX2 == 2);
+ m_load.ResetContent();
+ m_load.AddString(ResStr(IDS_DONOTLOAD)); m_load.SetItemData(0, 2);
+ m_load.AddString(ResStr(IDS_LOADWHENNEEDED)); m_load.SetItemData(1, 0);
+ m_load.AddString(ResStr(IDS_ALWAYSLOAD)); m_load.SetItemData(2, 1);
+ m_load.SetCurSel(!m_LoadLevel?1:m_LoadLevel==1?2:0);
+ m_extload.SetCheck(m_fExternalLoad);
+ m_webload.SetCheck(m_fWebLoad);
+ m_embload.SetCheck(m_fEmbeddedLoad);
+ m_extload.EnableWindow(m_load.GetCurSel() == 1);
+ m_webload.EnableWindow(m_load.GetCurSel() == 1);
+ m_embload.EnableWindow(m_load.GetCurSel() == 1);
+ }
}
/* CDVSMiscPPage */
@@ -601,87 +584,87 @@ void CDVSGeneralPPage::UpdateControlData(bool fSave)
CDVSMiscPPage::CDVSMiscPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Property Page (misc settings)"), pUnk, IDD_DVSMISCPAGE, IDD_DVSMISCPAGE)
{
- BindControl(IDC_FLIP, m_flippic);
- BindControl(IDC_FLIPSUB, m_flipsub);
- BindControl(IDC_HIDE, m_hidesub);
- BindControl(IDC_SHOWOSDSTATS, m_showosd);
- BindControl(IDC_PREBUFFERING, m_prebuff);
- BindControl(IDC_AUTORELOAD, m_autoreload);
- BindControl(IDC_SAVEFULLPATH, m_savefullpath);
- BindControl(IDC_INSTANTUPDATE, m_instupd);
+ BindControl(IDC_FLIP, m_flippic);
+ BindControl(IDC_FLIPSUB, m_flipsub);
+ BindControl(IDC_HIDE, m_hidesub);
+ BindControl(IDC_SHOWOSDSTATS, m_showosd);
+ BindControl(IDC_PREBUFFERING, m_prebuff);
+ BindControl(IDC_AUTORELOAD, m_autoreload);
+ BindControl(IDC_SAVEFULLPATH, m_savefullpath);
+ BindControl(IDC_INSTANTUPDATE, m_instupd);
}
bool CDVSMiscPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
- {
- case BN_CLICKED:
+ case WM_COMMAND:
{
- if(LOWORD(wParam) == IDC_INSTANTUPDATE)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), !!m_instupd.GetCheck());
- return(true);
- }
- }
- break;
- }
- }
- break;
- }
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_INSTANTUPDATE)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), !!m_instupd.GetCheck());
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
return(false);
}
void CDVSMiscPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- m_pDirectVobSub->put_Flip(m_fFlipPicture, m_fFlipSubtitles);
- m_pDirectVobSub->put_HideSubtitles(m_fHideSubtitles);
- m_pDirectVobSub->put_OSD(m_fOSD);
- m_pDirectVobSub->put_PreBuffering(m_fDoPreBuffering);
- m_pDirectVobSub->put_SubtitleReloader(m_fReloaderDisabled);
- m_pDirectVobSub->put_SaveFullPath(m_fSaveFullPath);
- }
- else
- {
- m_pDirectVobSub->get_Flip(&m_fFlipPicture, &m_fFlipSubtitles);
- m_pDirectVobSub->get_HideSubtitles(&m_fHideSubtitles);
- m_pDirectVobSub->get_OSD(&m_fOSD);
- m_pDirectVobSub->get_PreBuffering(&m_fDoPreBuffering);
- m_pDirectVobSub->get_SubtitleReloader(&m_fReloaderDisabled);
- m_pDirectVobSub->get_SaveFullPath(&m_fSaveFullPath);
- }
+ if(fSave)
+ {
+ m_pDirectVobSub->put_Flip(m_fFlipPicture, m_fFlipSubtitles);
+ m_pDirectVobSub->put_HideSubtitles(m_fHideSubtitles);
+ m_pDirectVobSub->put_OSD(m_fOSD);
+ m_pDirectVobSub->put_PreBuffering(m_fDoPreBuffering);
+ m_pDirectVobSub->put_SubtitleReloader(m_fReloaderDisabled);
+ m_pDirectVobSub->put_SaveFullPath(m_fSaveFullPath);
+ }
+ else
+ {
+ m_pDirectVobSub->get_Flip(&m_fFlipPicture, &m_fFlipSubtitles);
+ m_pDirectVobSub->get_HideSubtitles(&m_fHideSubtitles);
+ m_pDirectVobSub->get_OSD(&m_fOSD);
+ m_pDirectVobSub->get_PreBuffering(&m_fDoPreBuffering);
+ m_pDirectVobSub->get_SubtitleReloader(&m_fReloaderDisabled);
+ m_pDirectVobSub->get_SaveFullPath(&m_fSaveFullPath);
+ }
}
void CDVSMiscPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- m_fFlipPicture = !!m_flippic.GetCheck();
- m_fFlipSubtitles = !!m_flipsub.GetCheck();
- m_fHideSubtitles = !!m_hidesub.GetCheck();
- m_fSaveFullPath = !!m_savefullpath.GetCheck();
- m_fDoPreBuffering = !!m_prebuff.GetCheck();
- m_fOSD = !!m_showosd.GetCheck();
- m_fReloaderDisabled = !m_autoreload.GetCheck();
- }
- else
- {
- m_flippic.SetCheck(m_fFlipPicture);
- m_flipsub.SetCheck(m_fFlipSubtitles);
- m_hidesub.SetCheck(m_fHideSubtitles);
- m_savefullpath.SetCheck(m_fSaveFullPath);
- m_prebuff.SetCheck(m_fDoPreBuffering);
- m_showosd.SetCheck(m_fOSD);
- m_autoreload.SetCheck(!m_fReloaderDisabled);
- m_instupd.SetCheck(!!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1));
- }
+ if(fSave)
+ {
+ m_fFlipPicture = !!m_flippic.GetCheck();
+ m_fFlipSubtitles = !!m_flipsub.GetCheck();
+ m_fHideSubtitles = !!m_hidesub.GetCheck();
+ m_fSaveFullPath = !!m_savefullpath.GetCheck();
+ m_fDoPreBuffering = !!m_prebuff.GetCheck();
+ m_fOSD = !!m_showosd.GetCheck();
+ m_fReloaderDisabled = !m_autoreload.GetCheck();
+ }
+ else
+ {
+ m_flippic.SetCheck(m_fFlipPicture);
+ m_flipsub.SetCheck(m_fFlipSubtitles);
+ m_hidesub.SetCheck(m_fHideSubtitles);
+ m_savefullpath.SetCheck(m_fSaveFullPath);
+ m_prebuff.SetCheck(m_fDoPreBuffering);
+ m_showosd.SetCheck(m_fOSD);
+ m_autoreload.SetCheck(!m_fReloaderDisabled);
+ m_instupd.SetCheck(!!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1));
+ }
}
/* CDVSTimingPPage */
@@ -689,98 +672,98 @@ void CDVSMiscPPage::UpdateControlData(bool fSave)
CDVSTimingPPage::CDVSTimingPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Timing Property Page"), pUnk, IDD_DVSTIMINGPAGE, IDD_DVSTIMINGPAGE)
{
- BindControl(IDC_MODFPS, m_modfps);
- BindControl(IDC_FPS, m_fps);
- BindControl(IDC_SPIN5, m_subdelay);
- BindControl(IDC_SPIN6, m_subspeedmul);
- BindControl(IDC_SPIN9, m_subspeeddiv);
+ BindControl(IDC_MODFPS, m_modfps);
+ BindControl(IDC_FPS, m_fps);
+ BindControl(IDC_SPIN5, m_subdelay);
+ BindControl(IDC_SPIN6, m_subspeedmul);
+ BindControl(IDC_SPIN9, m_subspeeddiv);
}
bool CDVSTimingPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
+ case WM_COMMAND:
{
- case BN_CLICKED:
- {
- if(LOWORD(wParam) == IDC_MODFPS)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- m_fps.EnableWindow(!!m_modfps.GetCheck());
- return(true);
- }
- }
- break;
- }
- }
- break;
- }
-
- return(false);
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_MODFPS)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ m_fps.EnableWindow(!!m_modfps.GetCheck());
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
}
void CDVSTimingPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- m_pDirectVobSub->put_SubtitleTiming(m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv);
- m_pDirectVobSub->put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
- }
- else
- {
- m_pDirectVobSub->get_SubtitleTiming(&m_SubtitleDelay, &m_SubtitleSpeedMul, &m_SubtitleSpeedDiv);
- m_pDirectVobSub->get_MediaFPS(&m_fMediaFPSEnabled, &m_MediaFPS);
- }
+ if(fSave)
+ {
+ m_pDirectVobSub->put_SubtitleTiming(m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv);
+ m_pDirectVobSub->put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
+ }
+ else
+ {
+ m_pDirectVobSub->get_SubtitleTiming(&m_SubtitleDelay, &m_SubtitleSpeedMul, &m_SubtitleSpeedDiv);
+ m_pDirectVobSub->get_MediaFPS(&m_fMediaFPSEnabled, &m_MediaFPS);
+ }
}
void CDVSTimingPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- m_fMediaFPSEnabled = !!m_modfps.GetCheck();
- CString fpsstr;
- m_fps.GetWindowText(fpsstr);
- float fps;
- if(_stscanf(fpsstr, _T("%f"), &fps) == 1) m_MediaFPS = fps;
+ if(fSave)
+ {
+ m_fMediaFPSEnabled = !!m_modfps.GetCheck();
+ CString fpsstr;
+ m_fps.GetWindowText(fpsstr);
+ float fps;
+ if(_stscanf(fpsstr, _T("%f"), &fps) == 1) m_MediaFPS = fps;
#if _MFC_VER >= 0x0700
- m_SubtitleDelay = m_subdelay.GetPos32();
- m_SubtitleSpeedMul = m_subspeedmul.GetPos32();
- m_SubtitleSpeedDiv = m_subspeeddiv.GetPos32();
+ m_SubtitleDelay = m_subdelay.GetPos32();
+ m_SubtitleSpeedMul = m_subspeedmul.GetPos32();
+ m_SubtitleSpeedDiv = m_subspeeddiv.GetPos32();
#else
- m_SubtitleDelay = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN5), UDM_GETPOS32, 0, 0);
- m_SubtitleSpeedMul = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN6), UDM_GETPOS32, 0, 0);
- m_SubtitleSpeedDiv = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN9), UDM_GETPOS32, 0, 0);
+ m_SubtitleDelay = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN5), UDM_GETPOS32, 0, 0);
+ m_SubtitleSpeedMul = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN6), UDM_GETPOS32, 0, 0);
+ m_SubtitleSpeedDiv = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN9), UDM_GETPOS32, 0, 0);
#endif
- }
- else
- {
- m_modfps.SetCheck(m_fMediaFPSEnabled);
- CString fpsstr;
- fpsstr.Format(_T("%.4f"), m_MediaFPS);
- m_fps.SetWindowText(fpsstr);
- m_fps.EnableWindow(m_fMediaFPSEnabled);
- m_subdelay.SetRange32(-180 * 60 * 1000, 180 * 60 * 1000);
- m_subspeedmul.SetRange32(0, 1000000);
- m_subspeeddiv.SetRange32(1, 1000000);
+ }
+ else
+ {
+ m_modfps.SetCheck(m_fMediaFPSEnabled);
+ CString fpsstr;
+ fpsstr.Format(_T("%.4f"), m_MediaFPS);
+ m_fps.SetWindowText(fpsstr);
+ m_fps.EnableWindow(m_fMediaFPSEnabled);
+ m_subdelay.SetRange32(-180*60*1000, 180*60*1000);
+ m_subspeedmul.SetRange32(0, 1000000);
+ m_subspeeddiv.SetRange32(1, 1000000);
#if _MFC_VER >= 0x0700
- m_subdelay.SetPos32(m_SubtitleDelay);
- m_subspeedmul.SetPos32(m_SubtitleSpeedMul);
- m_subspeeddiv.SetPos32(m_SubtitleSpeedDiv);
+ m_subdelay.SetPos32(m_SubtitleDelay);
+ m_subspeedmul.SetPos32(m_SubtitleSpeedMul);
+ m_subspeeddiv.SetPos32(m_SubtitleSpeedDiv);
#else
- SendMessage(GetDlgItem(m_Dlg, IDC_SPIN5), UDM_SETPOS32, 0, (LPARAM)m_SubtitleDelay);
- SendMessage(GetDlgItem(m_Dlg, IDC_SPIN6), UDM_SETPOS32, 0, (LPARAM)m_SubtitleSpeedMul);
- SendMessage(GetDlgItem(m_Dlg, IDC_SPIN9), UDM_SETPOS32, 0, (LPARAM)m_SubtitleSpeedDiv);
+ SendMessage(GetDlgItem(m_Dlg, IDC_SPIN5), UDM_SETPOS32, 0, (LPARAM)m_SubtitleDelay);
+ SendMessage(GetDlgItem(m_Dlg, IDC_SPIN6), UDM_SETPOS32, 0, (LPARAM)m_SubtitleSpeedMul);
+ SendMessage(GetDlgItem(m_Dlg, IDC_SPIN9), UDM_SETPOS32, 0, (LPARAM)m_SubtitleSpeedDiv);
#endif
- }
+ }
}
/* CDVSAboutPPage */
-CDVSAboutPPage::CDVSAboutPPage(LPUNKNOWN lpunk, HRESULT* phr) :
- CDVSBasePPage(NAME("About Property Page"), lpunk, IDD_DVSABOUTPAGE, IDD_DVSABOUTPAGE)
+CDVSAboutPPage::CDVSAboutPPage(LPUNKNOWN lpunk, HRESULT* phr) :
+ CDVSBasePPage(NAME("About Property Page"), lpunk, IDD_DVSABOUTPAGE, IDD_DVSABOUTPAGE)
{
}
@@ -789,30 +772,30 @@ bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
+ case WM_COMMAND:
{
- case BN_CLICKED:
- {
- if(LOWORD(wParam) == IDC_HOMEPAGEBTN)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_HOMEPAGE), NULL, NULL, SW_SHOWNORMAL);
- return(true);
- }
- else if(LOWORD(wParam) == IDC_BUGREPORTBTN)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_EMAIL), NULL, NULL, SW_SHOWNORMAL);
- return(true);
- }
- }
- break;
- }
- }
- break;
- }
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_HOMEPAGEBTN)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_HOMEPAGE), NULL, NULL, SW_SHOWNORMAL);
+ return(true);
+ }
+ else if(LOWORD(wParam) == IDC_BUGREPORTBTN)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_EMAIL), NULL, NULL, SW_SHOWNORMAL);
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
return(false);
}
@@ -822,73 +805,73 @@ bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
CDVSZoomPPage::CDVSZoomPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Zoom Property Page"), pUnk, IDD_DVSZOOMPAGE, IDD_DVSZOOMPAGE)
{
- BindControl(IDC_SPIN1, m_posx);
- BindControl(IDC_SPIN2, m_posy);
- BindControl(IDC_SPIN7, m_scalex);
- BindControl(IDC_SPIN8, m_scaley);
+ BindControl(IDC_SPIN1, m_posx);
+ BindControl(IDC_SPIN2, m_posy);
+ BindControl(IDC_SPIN7, m_scalex);
+ BindControl(IDC_SPIN8, m_scaley);
}
bool CDVSZoomPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
+ case WM_COMMAND:
{
- case EN_CHANGE:
- {
- if(LOWORD(wParam) == IDC_EDIT1 || LOWORD(wParam) == IDC_EDIT2
- || LOWORD(wParam) == IDC_EDIT7 || LOWORD(wParam) == IDC_EDIT8)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- UpdateControlData(true);
- UpdateObjectData(true);
- return(true);
- }
- }
-
- break;
- }
- }
- break;
- }
-
- return(false);
+ switch(HIWORD(wParam))
+ {
+ case EN_CHANGE:
+ {
+ if(LOWORD(wParam) == IDC_EDIT1 || LOWORD(wParam) == IDC_EDIT2
+ || LOWORD(wParam) == IDC_EDIT7 || LOWORD(wParam) == IDC_EDIT8)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ UpdateControlData(true);
+ UpdateObjectData(true);
+ return(true);
+ }
+ }
+
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
}
void CDVSZoomPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- m_rect.left = 1.0f * (short)m_posx.GetPos() / 100;
- m_rect.top = 1.0f * (short)m_posy.GetPos() / 100;
- m_rect.right = m_rect.left + 1.0f * (short)m_scalex.GetPos() / 100;
- m_rect.bottom = m_rect.top + 1.0f * (short)m_scaley.GetPos() / 100;
- }
- else
- {
- m_posx.SetRange(-100, 100);
- m_posx.SetPos((int)(m_rect.left * 100));
- m_posy.SetRange(-100, 100);
- m_posy.SetPos((int)(m_rect.top * 100));
- m_scalex.SetRange(-300, 300);
- m_scalex.SetPos((int)((m_rect.right - m_rect.left) * 100));
- m_scaley.SetRange(-300, 300);
- m_scaley.SetPos((int)((m_rect.bottom - m_rect.top) * 100));
- }
+ if(fSave)
+ {
+ m_rect.left = 1.0f * (short)m_posx.GetPos() / 100;
+ m_rect.top = 1.0f * (short)m_posy.GetPos() / 100;
+ m_rect.right = m_rect.left + 1.0f * (short)m_scalex.GetPos() / 100;
+ m_rect.bottom = m_rect.top + 1.0f * (short)m_scaley.GetPos() / 100;
+ }
+ else
+ {
+ m_posx.SetRange(-100, 100);
+ m_posx.SetPos((int)(m_rect.left*100));
+ m_posy.SetRange(-100, 100);
+ m_posy.SetPos((int)(m_rect.top*100));
+ m_scalex.SetRange(-300, 300);
+ m_scalex.SetPos((int)((m_rect.right-m_rect.left)*100));
+ m_scaley.SetRange(-300, 300);
+ m_scaley.SetPos((int)((m_rect.bottom-m_rect.top)*100));
+ }
}
void CDVSZoomPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- m_pDirectVobSub->put_ZoomRect(&m_rect);
- }
- else
- {
- m_pDirectVobSub->get_ZoomRect(&m_rect);
- }
+ if(fSave)
+ {
+ m_pDirectVobSub->put_ZoomRect(&m_rect);
+ }
+ else
+ {
+ m_pDirectVobSub->get_ZoomRect(&m_rect);
+ }
}
// TODO: Make CDVSColorPPage and CDVSPathsPPage use an interface on DirectVobSub instead of the registry to communicate
@@ -898,157 +881,157 @@ void CDVSZoomPPage::UpdateObjectData(bool fSave)
CDVSColorPPage::CDVSColorPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Color Property Page"), pUnk, IDD_DVSCOLORPAGE, IDD_DVSCOLORPAGE)
{
- BindControl(IDC_PREFLIST, m_preflist);
- BindControl(IDC_DYNCHGLIST, m_dynchglist);
- BindControl(IDC_FORCERGBCHK, m_forcergb);
+ BindControl(IDC_PREFLIST, m_preflist);
+ BindControl(IDC_DYNCHGLIST, m_dynchglist);
+ BindControl(IDC_FORCERGBCHK, m_forcergb);
- m_fDisableInstantUpdate = true;
+ m_fDisableInstantUpdate = true;
}
bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
+ case WM_COMMAND:
{
- case LBN_DBLCLK:
- if((HWND)lParam == m_dynchglist.m_hWnd)
- {
- int old = -1;
- m_pDirectVobSub->get_ColorFormat(&old);
- if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel())))
- m_dynchglist.SetCurSel(old);
-
- return(true);
- }
- break;
-
- case BN_CLICKED:
- {
- switch(LOWORD(wParam))
- {
- case IDC_COLORCHANGE:
- {
- int old = -1;
- m_pDirectVobSub->get_ColorFormat(&old);
- if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel())))
- m_dynchglist.SetCurSel(old);
-
- return(true);
- }
- case IDC_COLORUP:
- {
- int sel = m_preflist.GetCurSel();
- if(sel > 0)
- {
- CString str;
- m_preflist.GetText(sel, str);
- int iPos = (int)m_preflist.GetItemData(sel);
- m_preflist.DeleteString(sel);
- sel--;
- m_preflist.InsertString(sel, str);
- m_preflist.SetItemData(sel, iPos);
- m_preflist.SetCurSel(sel);
- }
-
- return(true);
- }
- case IDC_COLORDOWN:
- {
- int sel = m_preflist.GetCurSel();
- if(sel >= 0 && sel < m_preflist.GetCount() - 1)
- {
- CString str;
- m_preflist.GetText(sel, str);
- int iPos = (int)m_preflist.GetItemData(sel);
- m_preflist.DeleteString(sel);
- sel++;
- m_preflist.InsertString(sel, str);
- m_preflist.SetItemData(sel, iPos);
- m_preflist.SetCurSel(sel);
- }
-
- return(true);
- }
- }
- }
- break;
- }
- }
- break;
- }
+ switch(HIWORD(wParam))
+ {
+ case LBN_DBLCLK:
+ if((HWND)lParam == m_dynchglist.m_hWnd)
+ {
+ int old = -1;
+ m_pDirectVobSub->get_ColorFormat(&old);
+ if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel())))
+ m_dynchglist.SetCurSel(old);
+
+ return(true);
+ }
+ break;
+
+ case BN_CLICKED:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_COLORCHANGE:
+ {
+ int old = -1;
+ m_pDirectVobSub->get_ColorFormat(&old);
+ if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel())))
+ m_dynchglist.SetCurSel(old);
+
+ return(true);
+ }
+ case IDC_COLORUP:
+ {
+ int sel = m_preflist.GetCurSel();
+ if(sel > 0)
+ {
+ CString str;
+ m_preflist.GetText(sel, str);
+ int iPos = (int)m_preflist.GetItemData(sel);
+ m_preflist.DeleteString(sel);
+ sel--;
+ m_preflist.InsertString(sel, str);
+ m_preflist.SetItemData(sel, iPos);
+ m_preflist.SetCurSel(sel);
+ }
+
+ return(true);
+ }
+ case IDC_COLORDOWN:
+ {
+ int sel = m_preflist.GetCurSel();
+ if(sel >= 0 && sel < m_preflist.GetCount()-1)
+ {
+ CString str;
+ m_preflist.GetText(sel, str);
+ int iPos = (int)m_preflist.GetItemData(sel);
+ m_preflist.DeleteString(sel);
+ sel++;
+ m_preflist.InsertString(sel, str);
+ m_preflist.SetItemData(sel, iPos);
+ m_preflist.SetCurSel(sel);
+ }
+
+ return(true);
+ }
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
return(false);
}
void CDVSColorPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- }
- else
- {
- }
+ if(fSave)
+ {
+ }
+ else
+ {
+ }
}
void CDVSColorPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- if(m_preflist.GetCount() == VIHSIZE)
- {
- BYTE* pData = new BYTE[VIHSIZE];
-
- for(ptrdiff_t i = 0; i < m_preflist.GetCount(); i++)
- pData[i] = (BYTE)m_preflist.GetItemData(i);
-
- theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), pData, VIHSIZE);
-
- delete [] pData;
- }
- else ASSERT(0);
-
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), !!m_forcergb.GetCheck());
- }
- else
- {
- m_preflist.ResetContent();
- m_dynchglist.ResetContent();
-
- BYTE* pData = NULL;
- UINT nSize;
-
- if(!theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), &pData, &nSize)
- || !pData || nSize != VIHSIZE)
- {
- if(pData) delete [] pData, pData = NULL;
-
- nSize = VIHSIZE;
- pData = new BYTE[VIHSIZE];
- for(ptrdiff_t i = 0; i < VIHSIZE; i++) pData[i] = i;
- }
-
- if(pData)
- {
- for(ptrdiff_t i = 0; i < (int)nSize; i++)
- {
- m_dynchglist.AddString(VIH2String(pData[i]));
- m_dynchglist.SetItemData(i, pData[i]);
- m_preflist.AddString(VIH2String(pData[i]));
- m_preflist.SetItemData(i, pData[i]);
- }
-
- int iPosition = -1;
- m_pDirectVobSub->get_ColorFormat(&iPosition);
- m_dynchglist.SetCurSel(iPosition);
-
- delete [] pData;
- }
-
- m_forcergb.SetCheck(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), 0) ? BST_CHECKED : BST_UNCHECKED);
- }
+ if(fSave)
+ {
+ if(m_preflist.GetCount() == VIHSIZE)
+ {
+ BYTE* pData = new BYTE[VIHSIZE];
+
+ for(ptrdiff_t i = 0; i < m_preflist.GetCount(); i++)
+ pData[i] = (BYTE)m_preflist.GetItemData(i);
+
+ theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), pData, VIHSIZE);
+
+ delete [] pData;
+ }
+ else ASSERT(0);
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), !!m_forcergb.GetCheck());
+ }
+ else
+ {
+ m_preflist.ResetContent();
+ m_dynchglist.ResetContent();
+
+ BYTE* pData = NULL;
+ UINT nSize;
+
+ if(!theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), &pData, &nSize)
+ || !pData || nSize != VIHSIZE)
+ {
+ if(pData) delete [] pData, pData = NULL;
+
+ nSize = VIHSIZE;
+ pData = new BYTE[VIHSIZE];
+ for(ptrdiff_t i = 0; i < VIHSIZE; i++) pData[i] = i;
+ }
+
+ if(pData)
+ {
+ for(ptrdiff_t i = 0; i < (int)nSize; i++)
+ {
+ m_dynchglist.AddString(VIH2String(pData[i]));
+ m_dynchglist.SetItemData(i, pData[i]);
+ m_preflist.AddString(VIH2String(pData[i]));
+ m_preflist.SetItemData(i, pData[i]);
+ }
+
+ int iPosition = -1;
+ m_pDirectVobSub->get_ColorFormat(&iPosition);
+ m_dynchglist.SetCurSel(iPosition);
+
+ delete [] pData;
+ }
+
+ m_forcergb.SetCheck(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), 0)?BST_CHECKED:BST_UNCHECKED);
+ }
}
/* CDVSPathsPPage */
@@ -1056,167 +1039,167 @@ void CDVSColorPPage::UpdateControlData(bool fSave)
CDVSPathsPPage::CDVSPathsPPage(LPUNKNOWN pUnk, HRESULT* phr) :
CDVSBasePPage(NAME("DirectVobSub Paths Property Page"), pUnk, IDD_DVSPATHSPAGE, IDD_DVSPATHSPAGE)
{
- BindControl(IDC_PATHLIST, m_pathlist);
- BindControl(IDC_PATHEDIT, m_path);
- BindControl(IDC_BROWSE, m_browse);
- BindControl(IDC_REMOVE, m_remove);
- BindControl(IDC_ADD, m_add);
+ BindControl(IDC_PATHLIST, m_pathlist);
+ BindControl(IDC_PATHEDIT, m_path);
+ BindControl(IDC_BROWSE, m_browse);
+ BindControl(IDC_REMOVE, m_remove);
+ BindControl(IDC_ADD, m_add);
- m_fDisableInstantUpdate = true;
+ m_fDisableInstantUpdate = true;
}
bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
- case WM_COMMAND:
- {
- switch(HIWORD(wParam))
- {
- case LBN_SELCHANGE:
- if((HWND)lParam == m_pathlist.m_hWnd)
- {
- int i = m_pathlist.GetCurSel();
- m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
- if(i >= 0)
- {
- CString path;
- m_pathlist.GetText(i, path);
- m_path.SetWindowText(path);
- }
- return(true);
- }
- break;
-
- case LBN_SELCANCEL:
- if((HWND)lParam == m_pathlist.m_hWnd)
- {
- m_remove.EnableWindow(FALSE);
- return(true);
- }
- break;
-
- case BN_CLICKED:
+ case WM_COMMAND:
{
- switch(LOWORD(wParam))
- {
- case IDC_BROWSE:
- {
- TCHAR pathbuff[MAX_PATH];
-
- BROWSEINFO bi;
- bi.hwndOwner = m_Dlg;
- bi.pidlRoot = NULL;
- bi.pszDisplayName = pathbuff;
- bi.lpszTitle = _T("");
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_EDITBOX | BIF_VALIDATE | BIF_USENEWUI;
- bi.lpfn = NULL;
- bi.lParam = 0;
- bi.iImage = 0;
-
- LPITEMIDLIST iil;
- if(iil = SHBrowseForFolder(&bi))
- {
- SHGetPathFromIDList(iil, pathbuff);
- m_path.SetWindowText(pathbuff);
- }
-
- return(true);
- }
- break;
-
- case IDC_REMOVE:
- {
- int i = m_pathlist.GetCurSel();
- if(i >= 0)
- {
- m_pathlist.DeleteString(i);
- i = min(i, m_pathlist.GetCount() - 1);
- if(i >= 0 && m_pathlist.GetCount() > 0)
- {
- m_pathlist.SetCurSel(i);
- m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
- }
- }
-
- return(true);
- }
- break;
-
- case IDC_ADD:
- {
- CString path;
- m_path.GetWindowText(path);
- if(!path.IsEmpty() && m_pathlist.FindString(-1, path) < 0)
- m_pathlist.AddString(path);
-
- return(true);
- }
- break;
- }
- }
- break;
- }
- }
- break;
- }
+ switch(HIWORD(wParam))
+ {
+ case LBN_SELCHANGE:
+ if((HWND)lParam == m_pathlist.m_hWnd)
+ {
+ int i = m_pathlist.GetCurSel();
+ m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
+ if(i >= 0)
+ {
+ CString path;
+ m_pathlist.GetText(i, path);
+ m_path.SetWindowText(path);
+ }
+ return(true);
+ }
+ break;
+
+ case LBN_SELCANCEL:
+ if((HWND)lParam == m_pathlist.m_hWnd)
+ {
+ m_remove.EnableWindow(FALSE);
+ return(true);
+ }
+ break;
+
+ case BN_CLICKED:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_BROWSE:
+ {
+ TCHAR pathbuff[MAX_PATH];
+
+ BROWSEINFO bi;
+ bi.hwndOwner = m_Dlg;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = pathbuff;
+ bi.lpszTitle = _T("");
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_EDITBOX | BIF_VALIDATE | BIF_USENEWUI;
+ bi.lpfn = NULL;
+ bi.lParam = 0;
+ bi.iImage = 0;
+
+ LPITEMIDLIST iil;
+ if(iil = SHBrowseForFolder(&bi))
+ {
+ SHGetPathFromIDList(iil, pathbuff);
+ m_path.SetWindowText(pathbuff);
+ }
+
+ return(true);
+ }
+ break;
+
+ case IDC_REMOVE:
+ {
+ int i = m_pathlist.GetCurSel();
+ if(i >= 0)
+ {
+ m_pathlist.DeleteString(i);
+ i = min(i, m_pathlist.GetCount()-1);
+ if(i >= 0 && m_pathlist.GetCount() > 0)
+ {
+ m_pathlist.SetCurSel(i);
+ m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
+ }
+ }
+
+ return(true);
+ }
+ break;
+
+ case IDC_ADD:
+ {
+ CString path;
+ m_path.GetWindowText(path);
+ if(!path.IsEmpty() && m_pathlist.FindString(-1, path) < 0)
+ m_pathlist.AddString(path);
+
+ return(true);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
return(false);
}
void CDVSPathsPPage::UpdateObjectData(bool fSave)
{
- if(fSave)
- {
- CString chk(_T("123456789")), path, tmp;
- int i = 0;
- do
- {
- tmp.Format(ResStr(IDS_RP_PATH), i++);
- path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
- if(path != chk) theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, _T(""));
- }
- while(path != chk);
-
- for(i = 0; i < m_paths.GetSize(); i++)
- {
- tmp.Format(ResStr(IDS_RP_PATH), i);
- theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, m_paths[i]);
- }
- }
- else
- {
- CString chk(_T("123456789")), path, tmp;
- int i = 0;
- do
- {
- if(!path.IsEmpty()) m_paths.Add(path);
- tmp.Format(ResStr(IDS_RP_PATH), i++);
- path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
- }
- while(path != chk);
- }
+ if(fSave)
+ {
+ CString chk(_T("123456789")), path, tmp;
+ int i = 0;
+ do
+ {
+ tmp.Format(ResStr(IDS_RP_PATH), i++);
+ path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
+ if(path != chk) theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, _T(""));
+ }
+ while(path != chk);
+
+ for(i = 0; i < m_paths.GetSize(); i++)
+ {
+ tmp.Format(ResStr(IDS_RP_PATH), i);
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, m_paths[i]);
+ }
+ }
+ else
+ {
+ CString chk(_T("123456789")), path, tmp;
+ int i = 0;
+ do
+ {
+ if(!path.IsEmpty()) m_paths.Add(path);
+ tmp.Format(ResStr(IDS_RP_PATH), i++);
+ path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
+ }
+ while(path != chk);
+ }
}
void CDVSPathsPPage::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- m_paths.RemoveAll();
- for(ptrdiff_t i = 0; i < m_pathlist.GetCount(); i++)
- {
- CString path;
- m_pathlist.GetText(i, path);
- m_paths.Add(path);
- }
- }
- else
- {
- m_pathlist.ResetContent();
- for(ptrdiff_t i = 0; i < m_paths.GetSize(); i++)
- m_pathlist.AddString(m_paths[i]);
-
- m_remove.EnableWindow(FALSE);
- m_add.EnableWindow(TRUE);
- }
+ if(fSave)
+ {
+ m_paths.RemoveAll();
+ for(ptrdiff_t i = 0; i < m_pathlist.GetCount(); i++)
+ {
+ CString path;
+ m_pathlist.GetText(i, path);
+ m_paths.Add(path);
+ }
+ }
+ else
+ {
+ m_pathlist.ResetContent();
+ for(ptrdiff_t i = 0; i < m_paths.GetSize(); i++)
+ m_pathlist.AddString(m_paths[i]);
+
+ m_remove.EnableWindow(FALSE);
+ m_add.EnableWindow(TRUE);
+ }
}
diff --git a/src/filters/transform/vsfilter/DirectVobSubPropPage.h b/src/filters/transform/vsfilter/DirectVobSubPropPage.h
index 82fa3abf7..5e0d7fe07 100644
--- a/src/filters/transform/vsfilter/DirectVobSubPropPage.h
+++ b/src/filters/transform/vsfilter/DirectVobSubPropPage.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,91 +27,88 @@
class CDVSBasePPage : public CBasePropertyPage
{
public:
- // we have to override these to use external, resource-only dlls
- STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo);
- STDMETHODIMP Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal);
+ // we have to override these to use external, resource-only dlls
+ STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo);
+ STDMETHODIMP Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal);
protected:
- CComQIPtr<IDirectVobSub2> m_pDirectVobSub;
+ CComQIPtr<IDirectVobSub2> m_pDirectVobSub;
- virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- return(false);
- }
- virtual void UpdateObjectData(bool fSave) {}
- virtual void UpdateControlData(bool fSave) {}
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) {return(false);}
+ virtual void UpdateObjectData(bool fSave) {}
+ virtual void UpdateControlData(bool fSave) {}
protected:
CDVSBasePPage(TCHAR* pName, LPUNKNOWN lpunk, int DialogId, int TitleId);
- bool m_fDisableInstantUpdate;
+ bool m_fDisableInstantUpdate;
private:
BOOL m_bIsInitialized;
HRESULT OnConnect(IUnknown* pUnknown), OnDisconnect(), OnActivate(), OnDeactivate(), OnApplyChanges();
- INT_PTR OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ INT_PTR OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
- bool m_fAttached;
- void AttachControls(), DetachControls();
+ bool m_fAttached;
+ void AttachControls(), DetachControls();
- CMap<UINT, UINT&, CWnd*, CWnd*> m_controls;
+ CMap<UINT, UINT&, CWnd*, CWnd*> m_controls;
protected:
- void BindControl(UINT id, CWnd& control);
+ void BindControl(UINT id, CWnd& control);
};
[uuid("60765CF5-01C2-4ee7-A44B-C791CF25FEA0")]
class CDVSMainPPage : public CDVSBasePPage
{
- void FreeLangs(), AllocLangs(int nLangs);
-
- WCHAR m_fn[MAX_PATH];
- int m_iSelectedLanguage, m_nLangs;
- WCHAR** m_ppLangs;
- bool m_fOverridePlacement;
- int m_PlacementXperc, m_PlacementYperc;
- STSStyle m_defStyle;
- bool m_fOnlyShowForcedVobSubs;
- CSimpleTextSubtitle::EPARCompensationType m_ePARCompensationType;
-
- CEdit m_fnedit;
- CComboBox m_langs;
- CButton m_oplacement;
- CSpinButtonCtrl m_subposx, m_subposy;
- CButton m_font, m_forcedsubs;
- CButton m_AutoPARCompensation;
- CComboBox m_PARCombo;
+ void FreeLangs(), AllocLangs(int nLangs);
+
+ WCHAR m_fn[MAX_PATH];
+ int m_iSelectedLanguage, m_nLangs;
+ WCHAR** m_ppLangs;
+ bool m_fOverridePlacement;
+ int m_PlacementXperc, m_PlacementYperc;
+ STSStyle m_defStyle;
+ bool m_fOnlyShowForcedVobSubs;
+ CSimpleTextSubtitle::EPARCompensationType m_ePARCompensationType;
+
+ CEdit m_fnedit;
+ CComboBox m_langs;
+ CButton m_oplacement;
+ CSpinButtonCtrl m_subposx, m_subposy;
+ CButton m_font, m_forcedsubs;
+ CButton m_AutoPARCompensation;
+ CComboBox m_PARCombo;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSMainPPage(LPUNKNOWN lpunk, HRESULT* phr);
- virtual ~CDVSMainPPage();
+ virtual ~CDVSMainPPage();
};
[uuid("0180E49C-13BF-46db-9AFD-9F52292E1C22")]
class CDVSGeneralPPage : public CDVSBasePPage
{
- int m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh;
- int m_LoadLevel;
- bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
+ int m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh;
+ int m_LoadLevel;
+ bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
- CComboBox m_verext;
- CButton m_mod32fix;
- CComboBox m_resx2;
- CSpinButtonCtrl m_resx2w, m_resx2h;
- CComboBox m_load;
- CButton m_extload, m_webload, m_embload;
+ CComboBox m_verext;
+ CButton m_mod32fix;
+ CComboBox m_resx2;
+ CSpinButtonCtrl m_resx2w, m_resx2h;
+ CComboBox m_load;
+ CButton m_extload, m_webload, m_embload;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSGeneralPPage(LPUNKNOWN lpunk, HRESULT* phr);
@@ -120,14 +117,14 @@ public:
[uuid("A8B25C0E-0894-4531-B668-AB1599FAF7F6")]
class CDVSMiscPPage : public CDVSBasePPage
{
- bool m_fFlipPicture, m_fFlipSubtitles, m_fHideSubtitles, m_fOSD, m_fDoPreBuffering, m_fReloaderDisabled, m_fSaveFullPath;
+ bool m_fFlipPicture, m_fFlipSubtitles, m_fHideSubtitles, m_fOSD, m_fDoPreBuffering, m_fReloaderDisabled, m_fSaveFullPath;
- CButton m_flippic, m_flipsub, m_hidesub, m_showosd, m_prebuff, m_autoreload, m_savefullpath, m_instupd;
+ CButton m_flippic, m_flipsub, m_hidesub, m_showosd, m_prebuff, m_autoreload, m_savefullpath, m_instupd;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSMiscPPage(LPUNKNOWN lpunk, HRESULT* phr);
@@ -136,18 +133,18 @@ public:
[uuid("ACE4747B-35BD-4e97-9DD7-1D4245B0695C")]
class CDVSTimingPPage : public CDVSBasePPage
{
- int m_SubtitleSpeedMul, m_SubtitleSpeedDiv, m_SubtitleDelay;
- bool m_fMediaFPSEnabled;
- double m_MediaFPS;
+ int m_SubtitleSpeedMul, m_SubtitleSpeedDiv, m_SubtitleDelay;
+ bool m_fMediaFPSEnabled;
+ double m_MediaFPS;
- CButton m_modfps;
- CEdit m_fps;
- CSpinButtonCtrl m_subdelay, m_subspeedmul, m_subspeeddiv;
+ CButton m_modfps;
+ CEdit m_fps;
+ CSpinButtonCtrl m_subdelay, m_subspeedmul, m_subspeeddiv;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSTimingPPage(LPUNKNOWN lpunk, HRESULT* phr);
@@ -166,14 +163,14 @@ public:
[uuid("525F116F-04AD-40a2-AE2F-A0C4E1AFEF98")]
class CDVSZoomPPage : public CDVSBasePPage
{
- NORMALIZEDRECT m_rect;
+ NORMALIZEDRECT m_rect;
- CSpinButtonCtrl m_posx, m_posy, m_scalex, m_scaley;
+ CSpinButtonCtrl m_posx, m_posy, m_scalex, m_scaley;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSZoomPPage(LPUNKNOWN lpunk, HRESULT* phr);
@@ -182,13 +179,13 @@ public:
[uuid("C2D6D98F-09CA-4524-AF64-1049B5665C9C")]
class CDVSColorPPage : public CDVSBasePPage
{
- CListBox m_preflist, m_dynchglist;
- CButton m_forcergb;
+ CListBox m_preflist, m_dynchglist;
+ CButton m_forcergb;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSColorPPage(LPUNKNOWN lpunk, HRESULT* phr);
@@ -197,16 +194,16 @@ public:
[uuid("CE77C59C-CFD2-429f-868C-8B04D23F94CA")]
class CDVSPathsPPage : public CDVSBasePPage
{
- CStringArray m_paths;
+ CStringArray m_paths;
- CListBox m_pathlist;
- CEdit m_path;
- CButton m_browse, m_remove, m_add;
+ CListBox m_pathlist;
+ CEdit m_path;
+ CButton m_browse, m_remove, m_add;
protected:
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual void UpdateControlData(bool fSave);
- virtual void UpdateObjectData(bool fSave);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
public:
CDVSPathsPPage(LPUNKNOWN lpunk, HRESULT* phr);
diff --git a/src/filters/transform/vsfilter/IDirectVobSub.h b/src/filters/transform/vsfilter/IDirectVobSub.h
index 4ade294d6..a789c5a66 100644
--- a/src/filters/transform/vsfilter/IDirectVobSub.h
+++ b/src/filters/transform/vsfilter/IDirectVobSub.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -28,274 +28,270 @@ extern "C" {
#endif
[uuid("EBE1FB08-3957-47ca-AF13-5827E5442E56")]
-interface IDirectVobSub :
- public IUnknown
+ interface IDirectVobSub : public IUnknown
{
- STDMETHOD(get_FileName)(THIS_
- WCHAR* fn // fn should point to a buffer allocated to at least the length of MAX_PATH (=260)
- ) PURE;
-
- STDMETHOD(put_FileName)(THIS_
- WCHAR* fn
- ) PURE;
-
- STDMETHOD(get_LanguageCount)(THIS_
- int* nLangs
- ) PURE;
-
- STDMETHOD(get_LanguageName)(THIS_
- int iLanguage,
- WCHAR** ppName // the returned *ppName is allocated with CoTaskMemAlloc
- ) PURE;
-
- STDMETHOD(get_SelectedLanguage)(THIS_
- int* iSelected
- ) PURE;
-
- STDMETHOD(put_SelectedLanguage)(THIS_
- int iSelected
- ) PURE;
-
- STDMETHOD(get_HideSubtitles)(THIS_
- bool* fHideSubtitles
- ) PURE;
-
- STDMETHOD(put_HideSubtitles)(THIS_
- bool fHideSubtitles
- ) PURE;
-
- STDMETHOD(get_PreBuffering)(THIS_
- bool* fDoPreBuffering
- ) PURE;
-
- STDMETHOD(put_PreBuffering)(THIS_
- bool fDoPreBuffering
- ) PURE;
-
- STDMETHOD(get_Placement)(THIS_
- bool* fOverridePlacement,
- int* xperc,
- int* yperc
- ) PURE;
-
- STDMETHOD(put_Placement)(THIS_
- bool fOverridePlacement,
- int xperc,
- int yperc
- ) PURE;
-
- STDMETHOD(get_VobSubSettings)(THIS_
- bool* fBuffer,
- bool* fOnlyShowForcedSubs,
- bool* fPolygonize
- ) PURE;
-
- STDMETHOD(put_VobSubSettings)(THIS_
- bool fBuffer,
- bool fOnlyShowForcedSubs,
- bool fPolygonize
- ) PURE;
-
- STDMETHOD(get_TextSettings)(THIS_
- void* lf,
- int lflen, // depending on lflen, lf must point to LOGFONTA or LOGFONTW
- COLORREF* color,
- bool* fShadow,
- bool* fOutline,
- bool* fAdvancedRenderer
- ) PURE;
-
- STDMETHOD(put_TextSettings)(THIS_
- void* lf,
- int lflen,
- COLORREF color,
- bool fShadow,
- bool fOutline,
- bool fAdvancedRenderer
- ) PURE;
-
- STDMETHOD(get_Flip)(THIS_
- bool* fPicture,
- bool* fSubtitles
- ) PURE;
-
- STDMETHOD(put_Flip)(THIS_
- bool fPicture,
- bool fSubtitles
- ) PURE;
-
- STDMETHOD(get_OSD)(THIS_
- bool* fOSD
- ) PURE;
-
- STDMETHOD(put_OSD)(THIS_
- bool fOSD
- ) PURE;
-
- STDMETHOD(get_SaveFullPath)(THIS_
- bool* fSaveFullPath
- ) PURE;
-
- STDMETHOD(put_SaveFullPath)(THIS_
- bool fSaveFullPath
- ) PURE;
-
- STDMETHOD(get_SubtitleTiming)(THIS_
- int* delay,
- int* speedmul,
- int* speeddiv
- ) PURE;
-
- STDMETHOD(put_SubtitleTiming)(THIS_
- int delay,
- int speedmul,
- int speeddiv
- ) PURE;
-
- STDMETHOD(get_MediaFPS)(THIS_
- bool* fEnabled,
- double* fps
- ) PURE;
-
- STDMETHOD(put_MediaFPS)(THIS_
- bool fEnabled,
- double fps
- ) PURE;
-
- // no longer supported
-
- STDMETHOD(get_ColorFormat)(THIS_
- int* iPosition
- ) PURE;
-
- STDMETHOD(put_ColorFormat)(THIS_
- int iPosition
- ) PURE;
-
- //
-
- STDMETHOD(get_ZoomRect)(THIS_
- NORMALIZEDRECT* rect
- ) PURE;
-
- STDMETHOD(put_ZoomRect)(THIS_
- NORMALIZEDRECT* rect
- ) PURE;
-
- //
-
- STDMETHOD(UpdateRegistry)(THIS_
- ) PURE;
-
- //
-
- STDMETHOD(HasConfigDialog)(THIS_
- int iSelected
- ) PURE;
-
- STDMETHOD(ShowConfigDialog)(THIS_ // if available, this will popup a child dialog allowing the user to edit the style options
- int iSelected,
- HWND hWndParent
- ) PURE;
-
- //
-
- STDMETHOD(IsSubtitleReloaderLocked)(THIS_
- bool* fLocked
- ) PURE;
-
- STDMETHOD(LockSubtitleReloader)(THIS_
- bool fLock
- ) PURE;
-
- STDMETHOD(get_SubtitleReloader)(THIS_
- bool* fDisabled
- ) PURE;
-
- STDMETHOD(put_SubtitleReloader)(THIS_
- bool fDisable
- ) PURE;
-
- //
-
- STDMETHOD(get_ExtendPicture)(THIS_
- int* horizontal, // 0 - disabled, 1 - mod32 extension (width = (width+31)&~31)
- int* vertical, // 0 - disabled, 1 - 16:9, 2 - 4:3, 0x80 - crop (use crop together with 16:9 or 4:3, eg 0x81 will crop to 16:9 if the picture was taller)
- int* resx2, // 0 - disabled, 1 - enabled, 2 - depends on the original resolution
- int* resx2minw, // resolution doubler will be used if width*height <= resx2minw*resx2minh (resx2minw*resx2minh equals to 384*288 by default)
- int* resx2minh
- ) PURE;
-
- STDMETHOD(put_ExtendPicture)(THIS_
- int horizontal,
- int vertical,
- int resx2,
- int resx2minw,
- int resx2minh
- ) PURE;
-
- STDMETHOD(get_LoadSettings)(THIS_
- int* level, // 0 - when needed, 1 - always, 2 - disabled
- bool* fExternalLoad,
- bool* fWebLoad,
- bool* fEmbeddedLoad
- ) PURE;
-
- STDMETHOD(put_LoadSettings)(THIS_
- int level,
- bool fExternalLoad,
- bool fWebLoad,
- bool fEmbeddedLoad
- ) PURE;
- };
+ STDMETHOD(get_FileName) (THIS_
+ WCHAR* fn // fn should point to a buffer allocated to at least the length of MAX_PATH (=260)
+ ) PURE;
+
+ STDMETHOD(put_FileName) (THIS_
+ WCHAR* fn
+ ) PURE;
+
+ STDMETHOD(get_LanguageCount) (THIS_
+ int* nLangs
+ ) PURE;
+
+ STDMETHOD(get_LanguageName) (THIS_
+ int iLanguage,
+ WCHAR** ppName // the returned *ppName is allocated with CoTaskMemAlloc
+ ) PURE;
+
+ STDMETHOD(get_SelectedLanguage) (THIS_
+ int* iSelected
+ ) PURE;
+
+ STDMETHOD(put_SelectedLanguage) (THIS_
+ int iSelected
+ ) PURE;
+
+ STDMETHOD(get_HideSubtitles) (THIS_
+ bool* fHideSubtitles
+ ) PURE;
+
+ STDMETHOD(put_HideSubtitles) (THIS_
+ bool fHideSubtitles
+ ) PURE;
+
+ STDMETHOD(get_PreBuffering) (THIS_
+ bool* fDoPreBuffering
+ ) PURE;
+
+ STDMETHOD(put_PreBuffering) (THIS_
+ bool fDoPreBuffering
+ ) PURE;
+
+ STDMETHOD(get_Placement) (THIS_
+ bool* fOverridePlacement,
+ int* xperc,
+ int* yperc
+ ) PURE;
+
+ STDMETHOD(put_Placement) (THIS_
+ bool fOverridePlacement,
+ int xperc,
+ int yperc
+ ) PURE;
+
+ STDMETHOD(get_VobSubSettings) (THIS_
+ bool* fBuffer,
+ bool* fOnlyShowForcedSubs,
+ bool* fPolygonize
+ ) PURE;
+
+ STDMETHOD(put_VobSubSettings) (THIS_
+ bool fBuffer,
+ bool fOnlyShowForcedSubs,
+ bool fPolygonize
+ ) PURE;
+
+ STDMETHOD(get_TextSettings) (THIS_
+ void* lf,
+ int lflen, // depending on lflen, lf must point to LOGFONTA or LOGFONTW
+ COLORREF* color,
+ bool* fShadow,
+ bool* fOutline,
+ bool* fAdvancedRenderer
+ ) PURE;
+
+ STDMETHOD(put_TextSettings) (THIS_
+ void* lf,
+ int lflen,
+ COLORREF color,
+ bool fShadow,
+ bool fOutline,
+ bool fAdvancedRenderer
+ ) PURE;
+
+ STDMETHOD(get_Flip) (THIS_
+ bool* fPicture,
+ bool* fSubtitles
+ ) PURE;
+
+ STDMETHOD(put_Flip) (THIS_
+ bool fPicture,
+ bool fSubtitles
+ ) PURE;
+
+ STDMETHOD(get_OSD) (THIS_
+ bool* fOSD
+ ) PURE;
+
+ STDMETHOD(put_OSD) (THIS_
+ bool fOSD
+ ) PURE;
+
+ STDMETHOD(get_SaveFullPath) (THIS_
+ bool* fSaveFullPath
+ ) PURE;
+
+ STDMETHOD(put_SaveFullPath) (THIS_
+ bool fSaveFullPath
+ ) PURE;
+
+ STDMETHOD(get_SubtitleTiming) (THIS_
+ int* delay,
+ int* speedmul,
+ int* speeddiv
+ ) PURE;
+
+ STDMETHOD(put_SubtitleTiming) (THIS_
+ int delay,
+ int speedmul,
+ int speeddiv
+ ) PURE;
+
+ STDMETHOD(get_MediaFPS) (THIS_
+ bool* fEnabled,
+ double* fps
+ ) PURE;
+
+ STDMETHOD(put_MediaFPS) (THIS_
+ bool fEnabled,
+ double fps
+ ) PURE;
+
+ // no longer supported
+
+ STDMETHOD(get_ColorFormat) (THIS_
+ int* iPosition
+ ) PURE;
+
+ STDMETHOD(put_ColorFormat) (THIS_
+ int iPosition
+ ) PURE;
+
+ //
+
+ STDMETHOD(get_ZoomRect) (THIS_
+ NORMALIZEDRECT* rect
+ ) PURE;
+
+ STDMETHOD(put_ZoomRect) (THIS_
+ NORMALIZEDRECT* rect
+ ) PURE;
+
+ //
+
+ STDMETHOD(UpdateRegistry) (THIS_
+ ) PURE;
+
+ //
+
+ STDMETHOD(HasConfigDialog) (THIS_
+ int iSelected
+ ) PURE;
+
+ STDMETHOD(ShowConfigDialog) (THIS_ // if available, this will popup a child dialog allowing the user to edit the style options
+ int iSelected,
+ HWND hWndParent
+ ) PURE;
+
+ //
+
+ STDMETHOD(IsSubtitleReloaderLocked) (THIS_
+ bool* fLocked
+ ) PURE;
+
+ STDMETHOD(LockSubtitleReloader) (THIS_
+ bool fLock
+ ) PURE;
+
+ STDMETHOD(get_SubtitleReloader) (THIS_
+ bool* fDisabled
+ ) PURE;
+
+ STDMETHOD(put_SubtitleReloader) (THIS_
+ bool fDisable
+ ) PURE;
+
+ //
+
+ STDMETHOD(get_ExtendPicture) (THIS_
+ int* horizontal, // 0 - disabled, 1 - mod32 extension (width = (width+31)&~31)
+ int* vertical, // 0 - disabled, 1 - 16:9, 2 - 4:3, 0x80 - crop (use crop together with 16:9 or 4:3, eg 0x81 will crop to 16:9 if the picture was taller)
+ int* resx2, // 0 - disabled, 1 - enabled, 2 - depends on the original resolution
+ int* resx2minw, // resolution doubler will be used if width*height <= resx2minw*resx2minh (resx2minw*resx2minh equals to 384*288 by default)
+ int* resx2minh
+ ) PURE;
+
+ STDMETHOD(put_ExtendPicture) (THIS_
+ int horizontal,
+ int vertical,
+ int resx2,
+ int resx2minw,
+ int resx2minh
+ ) PURE;
+
+ STDMETHOD(get_LoadSettings) (THIS_
+ int* level, // 0 - when needed, 1 - always, 2 - disabled
+ bool* fExternalLoad,
+ bool* fWebLoad,
+ bool* fEmbeddedLoad
+ ) PURE;
+
+ STDMETHOD(put_LoadSettings) (THIS_
+ int level,
+ bool fExternalLoad,
+ bool fWebLoad,
+ bool fEmbeddedLoad
+ ) PURE;
+ };
[uuid("FE6EC6A0-21CA-4970-9EF0-B296F7F38AF0")]
-interface ISubClock :
- public IUnknown
- {
+ interface ISubClock : public IUnknown
+ {
STDMETHOD(SetTime)(REFERENCE_TIME rt) PURE;
STDMETHOD_(REFERENCE_TIME, GetTime)() PURE;
- };
+ };
[uuid("0665B760-FBC1-46C3-A35F-E471527C96A4")]
-interface ISubClock2 :
- public ISubClock
- {
+ interface ISubClock2 : public ISubClock
+ {
STDMETHOD(SetAvgTimePerFrame)(REFERENCE_TIME rt) PURE;
STDMETHOD(GetAvgTimePerFrame)(REFERENCE_TIME* prt) PURE; // return S_OK only if *prt was set and is valid
- };
+ };
[uuid("AB52FC9C-2415-4dca-BC1C-8DCC2EAE8150")]
-interface IDirectVobSub2 :
- public IDirectVobSub
- {
- STDMETHOD(AdviseSubClock)(THIS_
- ISubClock* pSubClock
- ) PURE;
-
- STDMETHOD_(bool, get_Forced)(THIS_
- ) PURE;
-
- STDMETHOD(put_Forced)(THIS_
- bool fForced
- ) PURE;
-
- STDMETHOD(get_TextSettings)(THIS_
- STSStyle* pDefStyle
- ) PURE;
-
- STDMETHOD(put_TextSettings)(THIS_
- STSStyle* pDefStyle
- ) PURE;
-
- STDMETHOD(get_AspectRatioSettings)(THIS_
- CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType
- ) PURE;
-
- STDMETHOD(put_AspectRatioSettings)(THIS_
- CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType
- ) PURE;
- };
+ interface IDirectVobSub2 : public IDirectVobSub
+ {
+ STDMETHOD(AdviseSubClock) (THIS_
+ ISubClock* pSubClock
+ ) PURE;
+
+ STDMETHOD_(bool, get_Forced) (THIS_
+ ) PURE;
+
+ STDMETHOD(put_Forced) (THIS_
+ bool fForced
+ ) PURE;
+
+ STDMETHOD(get_TextSettings) (THIS_
+ STSStyle* pDefStyle
+ ) PURE;
+
+ STDMETHOD(put_TextSettings) (THIS_
+ STSStyle* pDefStyle
+ ) PURE;
+
+ STDMETHOD(get_AspectRatioSettings) (THIS_
+ CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType
+ ) PURE;
+
+ STDMETHOD(put_AspectRatioSettings) (THIS_
+ CSimpleTextSubtitle::EPARCompensationType* ePARCompensationType
+ ) PURE;
+ };
#ifdef __cplusplus
diff --git a/src/filters/transform/vsfilter/StyleEditorDialog.cpp b/src/filters/transform/vsfilter/StyleEditorDialog.cpp
index 38da374a5..d7edcbc33 100644
--- a/src/filters/transform/vsfilter/StyleEditorDialog.cpp
+++ b/src/filters/transform/vsfilter/StyleEditorDialog.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -37,21 +37,21 @@ END_MESSAGE_MAP()
IMPLEMENT_DYNAMIC(CStyleEditorDialog, CDialog)
CStyleEditorDialog::CStyleEditorDialog(CString title, STSStyle* pstss, CWnd* pParent /*=NULL*/)
- : CDialog(CStyleEditorDialog::IDD, pParent)
- , m_title(title)
- , m_stss(*pstss)
- , m_pParent(pParent)
- , m_iCharset(0)
- , m_spacing(0)
- , m_angle(0)
- , m_scalex(0)
- , m_scaley(0)
- , m_borderstyle(0)
- , m_borderwidth(0)
- , m_shadowdepth(0)
- , m_screenalignment(0)
- , m_margin(0, 0, 0, 0)
- , m_linkalphasliders(FALSE)
+ : CDialog(CStyleEditorDialog::IDD, pParent)
+ , m_title(title)
+ , m_stss(*pstss)
+ , m_pParent(pParent)
+ , m_iCharset(0)
+ , m_spacing(0)
+ , m_angle(0)
+ , m_scalex(0)
+ , m_scaley(0)
+ , m_borderstyle(0)
+ , m_borderwidth(0)
+ , m_shadowdepth(0)
+ , m_screenalignment(0)
+ , m_margin(0,0,0,0)
+ , m_linkalphasliders(FALSE)
{
}
@@ -61,136 +61,136 @@ CStyleEditorDialog::~CStyleEditorDialog()
void CStyleEditorDialog::DoDataExchange(CDataExchange* pDX)
{
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_BUTTON1, m_font);
- DDX_CBIndex(pDX, IDC_COMBO1, m_iCharset);
- DDX_Control(pDX, IDC_COMBO1, m_charset);
- DDX_Text(pDX, IDC_EDIT3, m_spacing);
- DDX_Control(pDX, IDC_SPIN3, m_spacingspin);
- DDX_Text(pDX, IDC_EDIT11, m_angle);
- DDX_Control(pDX, IDC_SPIN10, m_anglespin);
- DDX_Text(pDX, IDC_EDIT5, m_scalex);
- DDX_Control(pDX, IDC_SPIN4, m_scalexspin);
- DDX_Text(pDX, IDC_EDIT6, m_scaley);
- DDX_Control(pDX, IDC_SPIN5, m_scaleyspin);
- DDX_Radio(pDX, IDC_RADIO1, m_borderstyle);
- DDX_Text(pDX, IDC_EDIT1, m_borderwidth);
- DDX_Control(pDX, IDC_SPIN1, m_borderwidthspin);
- DDX_Text(pDX, IDC_EDIT2, m_shadowdepth);
- DDX_Control(pDX, IDC_SPIN2, m_shadowdepthspin);
- DDX_Radio(pDX, IDC_RADIO3, m_screenalignment);
- DDX_Text(pDX, IDC_EDIT7, m_margin.left);
- DDX_Control(pDX, IDC_SPIN6, m_marginleftspin);
- DDX_Text(pDX, IDC_EDIT8, m_margin.right);
- DDX_Control(pDX, IDC_SPIN7, m_marginrightspin);
- DDX_Text(pDX, IDC_EDIT9, m_margin.top);
- DDX_Control(pDX, IDC_SPIN8, m_margintopspin);
- DDX_Text(pDX, IDC_EDIT10, m_margin.bottom);
- DDX_Control(pDX, IDC_SPIN9, m_marginbottomspin);
- DDX_Control(pDX, IDC_COLORPRI, m_color[0]);
- DDX_Control(pDX, IDC_COLORSEC, m_color[1]);
- DDX_Control(pDX, IDC_COLOROUTL, m_color[2]);
- DDX_Control(pDX, IDC_COLORSHAD, m_color[3]);
- DDX_Slider(pDX, IDC_SLIDER2, m_alpha[0]);
- DDX_Slider(pDX, IDC_SLIDER3, m_alpha[1]);
- DDX_Slider(pDX, IDC_SLIDER5, m_alpha[2]);
- DDX_Slider(pDX, IDC_SLIDER6, m_alpha[3]);
- DDX_Control(pDX, IDC_SLIDER2, m_alphasliders[0]);
- DDX_Control(pDX, IDC_SLIDER3, m_alphasliders[1]);
- DDX_Control(pDX, IDC_SLIDER5, m_alphasliders[2]);
- DDX_Control(pDX, IDC_SLIDER6, m_alphasliders[3]);
- DDX_Check(pDX, IDC_CHECK1, m_linkalphasliders);
+ CDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_BUTTON1, m_font);
+ DDX_CBIndex(pDX, IDC_COMBO1, m_iCharset);
+ DDX_Control(pDX, IDC_COMBO1, m_charset);
+ DDX_Text(pDX, IDC_EDIT3, m_spacing);
+ DDX_Control(pDX, IDC_SPIN3, m_spacingspin);
+ DDX_Text(pDX, IDC_EDIT11, m_angle);
+ DDX_Control(pDX, IDC_SPIN10, m_anglespin);
+ DDX_Text(pDX, IDC_EDIT5, m_scalex);
+ DDX_Control(pDX, IDC_SPIN4, m_scalexspin);
+ DDX_Text(pDX, IDC_EDIT6, m_scaley);
+ DDX_Control(pDX, IDC_SPIN5, m_scaleyspin);
+ DDX_Radio(pDX, IDC_RADIO1, m_borderstyle);
+ DDX_Text(pDX, IDC_EDIT1, m_borderwidth);
+ DDX_Control(pDX, IDC_SPIN1, m_borderwidthspin);
+ DDX_Text(pDX, IDC_EDIT2, m_shadowdepth);
+ DDX_Control(pDX, IDC_SPIN2, m_shadowdepthspin);
+ DDX_Radio(pDX, IDC_RADIO3, m_screenalignment);
+ DDX_Text(pDX, IDC_EDIT7, m_margin.left);
+ DDX_Control(pDX, IDC_SPIN6, m_marginleftspin);
+ DDX_Text(pDX, IDC_EDIT8, m_margin.right);
+ DDX_Control(pDX, IDC_SPIN7, m_marginrightspin);
+ DDX_Text(pDX, IDC_EDIT9, m_margin.top);
+ DDX_Control(pDX, IDC_SPIN8, m_margintopspin);
+ DDX_Text(pDX, IDC_EDIT10, m_margin.bottom);
+ DDX_Control(pDX, IDC_SPIN9, m_marginbottomspin);
+ DDX_Control(pDX, IDC_COLORPRI, m_color[0]);
+ DDX_Control(pDX, IDC_COLORSEC, m_color[1]);
+ DDX_Control(pDX, IDC_COLOROUTL, m_color[2]);
+ DDX_Control(pDX, IDC_COLORSHAD, m_color[3]);
+ DDX_Slider(pDX, IDC_SLIDER2, m_alpha[0]);
+ DDX_Slider(pDX, IDC_SLIDER3, m_alpha[1]);
+ DDX_Slider(pDX, IDC_SLIDER5, m_alpha[2]);
+ DDX_Slider(pDX, IDC_SLIDER6, m_alpha[3]);
+ DDX_Control(pDX, IDC_SLIDER2, m_alphasliders[0]);
+ DDX_Control(pDX, IDC_SLIDER3, m_alphasliders[1]);
+ DDX_Control(pDX, IDC_SLIDER5, m_alphasliders[2]);
+ DDX_Control(pDX, IDC_SLIDER6, m_alphasliders[3]);
+ DDX_Check(pDX, IDC_CHECK1, m_linkalphasliders);
}
void CStyleEditorDialog::UpdateControlData(bool fSave)
{
- if(fSave)
- {
- UpdateData();
-
- if(m_iCharset >= 0) m_stss.charSet = m_charset.GetItemData(m_iCharset);
- m_stss.fontSpacing = m_spacing;
- m_stss.fontAngleZ = m_angle;
- m_stss.fontScaleX = m_scalex;
- m_stss.fontScaleY = m_scaley;
-
- m_stss.borderStyle = m_borderstyle;
- m_stss.outlineWidthX = m_stss.outlineWidthY = m_borderwidth;
- m_stss.shadowDepthX = m_stss.shadowDepthY = m_shadowdepth;
-
- m_stss.scrAlignment = m_screenalignment + 1;
- m_stss.marginRect = m_margin;
-
- for(ptrdiff_t i = 0; i < 4; i++) m_stss.alpha[i] = 255 - m_alpha[i];
- }
- else
- {
- m_font.SetWindowText(m_stss.fontName);
- m_iCharset = -1;
- for(ptrdiff_t i = 0; i < CharSetLen; i++)
- {
- CString str;
- str.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
- m_charset.AddString(str);
- m_charset.SetItemData(i, CharSetList[i]);
- if(m_stss.charSet == CharSetList[i]) m_iCharset = i;
- }
- // TODO: allow floats in these edit boxes
- m_spacing = m_stss.fontSpacing;
- m_spacingspin.SetRange32(-10000, 10000);
- while(m_stss.fontAngleZ < 0) m_stss.fontAngleZ += 360;
- m_angle = fmod(m_stss.fontAngleZ, 360);
- m_anglespin.SetRange32(0, 359);
- m_scalex = m_stss.fontScaleX;
- m_scalexspin.SetRange32(-10000, 10000);
- m_scaley = m_stss.fontScaleY;
- m_scaleyspin.SetRange32(-10000, 10000);
-
- m_borderstyle = m_stss.borderStyle;
- m_borderwidth = min(m_stss.outlineWidthX, m_stss.outlineWidthY);
- m_borderwidthspin.SetRange32(0, 10000);
- m_shadowdepth = min(m_stss.shadowDepthX, m_stss.shadowDepthY);
- m_shadowdepthspin.SetRange32(0, 10000);
-
- m_screenalignment = m_stss.scrAlignment - 1;
- m_margin = m_stss.marginRect;
- m_marginleftspin.SetRange32(-10000, 10000);
- m_marginrightspin.SetRange32(-10000, 10000);
- m_margintopspin.SetRange32(-10000, 10000);
- m_marginbottomspin.SetRange32(-10000, 10000);
-
- for(ptrdiff_t i = 0; i < 4; i++)
- {
- m_color[i].SetColorPtr(&m_stss.colors[i]);
- m_alpha[i] = 255 - m_stss.alpha[i];
- m_alphasliders[i].SetRange(0, 255);
- }
-
- m_linkalphasliders = FALSE;
-
- UpdateData(FALSE);
- }
+ if(fSave)
+ {
+ UpdateData();
+
+ if(m_iCharset >= 0) m_stss.charSet = m_charset.GetItemData(m_iCharset);
+ m_stss.fontSpacing = m_spacing;
+ m_stss.fontAngleZ = m_angle;
+ m_stss.fontScaleX = m_scalex;
+ m_stss.fontScaleY = m_scaley;
+
+ m_stss.borderStyle = m_borderstyle;
+ m_stss.outlineWidthX = m_stss.outlineWidthY = m_borderwidth;
+ m_stss.shadowDepthX = m_stss.shadowDepthY = m_shadowdepth;
+
+ m_stss.scrAlignment = m_screenalignment+1;
+ m_stss.marginRect = m_margin;
+
+ for(ptrdiff_t i = 0; i < 4; i++) m_stss.alpha[i] = 255-m_alpha[i];
+ }
+ else
+ {
+ m_font.SetWindowText(m_stss.fontName);
+ m_iCharset = -1;
+ for(ptrdiff_t i = 0; i < CharSetLen; i++)
+ {
+ CString str;
+ str.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
+ m_charset.AddString(str);
+ m_charset.SetItemData(i, CharSetList[i]);
+ if(m_stss.charSet == CharSetList[i]) m_iCharset = i;
+ }
+ // TODO: allow floats in these edit boxes
+ m_spacing = m_stss.fontSpacing;
+ m_spacingspin.SetRange32(-10000, 10000);
+ while(m_stss.fontAngleZ < 0) m_stss.fontAngleZ += 360;
+ m_angle = fmod(m_stss.fontAngleZ, 360);
+ m_anglespin.SetRange32(0, 359);
+ m_scalex = m_stss.fontScaleX;
+ m_scalexspin.SetRange32(-10000, 10000);
+ m_scaley = m_stss.fontScaleY;
+ m_scaleyspin.SetRange32(-10000, 10000);
+
+ m_borderstyle = m_stss.borderStyle;
+ m_borderwidth = min(m_stss.outlineWidthX, m_stss.outlineWidthY);
+ m_borderwidthspin.SetRange32(0, 10000);
+ m_shadowdepth = min(m_stss.shadowDepthX, m_stss.shadowDepthY);
+ m_shadowdepthspin.SetRange32(0, 10000);
+
+ m_screenalignment = m_stss.scrAlignment-1;
+ m_margin = m_stss.marginRect;
+ m_marginleftspin.SetRange32(-10000, 10000);
+ m_marginrightspin.SetRange32(-10000, 10000);
+ m_margintopspin.SetRange32(-10000, 10000);
+ m_marginbottomspin.SetRange32(-10000, 10000);
+
+ for(ptrdiff_t i = 0; i < 4; i++)
+ {
+ m_color[i].SetColorPtr(&m_stss.colors[i]);
+ m_alpha[i] = 255-m_stss.alpha[i];
+ m_alphasliders[i].SetRange(0, 255);
+ }
+
+ m_linkalphasliders = FALSE;
+
+ UpdateData(FALSE);
+ }
}
void CStyleEditorDialog::AskColor(int i)
{
- CColorDialog dlg(m_stss.colors[i]);
- dlg.m_cc.Flags |= CC_FULLOPEN;
- if(dlg.DoModal() == IDOK)
- {
- m_stss.colors[i] = dlg.m_cc.rgbResult;
- m_color[i].Invalidate();
- }
+ CColorDialog dlg(m_stss.colors[i]);
+ dlg.m_cc.Flags |= CC_FULLOPEN;
+ if(dlg.DoModal() == IDOK)
+ {
+ m_stss.colors[i] = dlg.m_cc.rgbResult;
+ m_color[i].Invalidate();
+ }
}
BEGIN_MESSAGE_MAP(CStyleEditorDialog, CDialog)
- ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
- ON_STN_CLICKED(IDC_COLORPRI, OnStnClickedColorpri)
- ON_STN_CLICKED(IDC_COLORSEC, OnStnClickedColorsec)
- ON_STN_CLICKED(IDC_COLOROUTL, OnStnClickedColoroutl)
- ON_STN_CLICKED(IDC_COLORSHAD, OnStnClickedColorshad)
- ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
- ON_WM_HSCROLL()
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_STN_CLICKED(IDC_COLORPRI, OnStnClickedColorpri)
+ ON_STN_CLICKED(IDC_COLORSEC, OnStnClickedColorsec)
+ ON_STN_CLICKED(IDC_COLOROUTL, OnStnClickedColoroutl)
+ ON_STN_CLICKED(IDC_COLORSHAD, OnStnClickedColorshad)
+ ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
+ ON_WM_HSCROLL()
END_MESSAGE_MAP()
@@ -198,85 +198,85 @@ END_MESSAGE_MAP()
BOOL CStyleEditorDialog::OnInitDialog()
{
- CDialog::OnInitDialog();
+ CDialog::OnInitDialog();
- SetWindowText(_T("Style Editor - \"") + m_title + _T("\""));
+ SetWindowText(_T("Style Editor - \"") + m_title + _T("\""));
- UpdateControlData(false);
+ UpdateControlData(false);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
}
void CStyleEditorDialog::OnOK()
{
- UpdateControlData(true);
+ UpdateControlData(true);
- CDialog::OnOK();
+ CDialog::OnOK();
}
void CStyleEditorDialog::OnBnClickedButton1()
{
- LOGFONT lf;
- lf <<= m_stss;
-
- CFontDialog dlg(&lf, CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_FORCEFONTEXIST | CF_SCALABLEONLY | CF_EFFECTS);
- if(dlg.DoModal() == IDOK)
- {
- CString str(lf.lfFaceName);
- if(str.GetLength() > 16) str = str.Left(14) + _T("...");
- m_font.SetWindowText(str);
-
- for(ptrdiff_t i = 0, j = m_charset.GetCount(); i < j; i++)
- {
- if(m_charset.GetItemData(i) == lf.lfCharSet)
- {
- m_charset.SetCurSel(i);
- break;
- }
- }
-
- m_stss = lf;
- }
+ LOGFONT lf;
+ lf <<= m_stss;
+
+ CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|CF_SCALABLEONLY|CF_EFFECTS);
+ if(dlg.DoModal() == IDOK)
+ {
+ CString str(lf.lfFaceName);
+ if(str.GetLength() > 16) str = str.Left(14) + _T("...");
+ m_font.SetWindowText(str);
+
+ for(ptrdiff_t i = 0, j = m_charset.GetCount(); i < j; i++)
+ {
+ if(m_charset.GetItemData(i) == lf.lfCharSet)
+ {
+ m_charset.SetCurSel(i);
+ break;
+ }
+ }
+
+ m_stss = lf;
+ }
}
void CStyleEditorDialog::OnStnClickedColorpri()
{
- AskColor(0);
+ AskColor(0);
}
void CStyleEditorDialog::OnStnClickedColorsec()
{
- AskColor(1);
+ AskColor(1);
}
void CStyleEditorDialog::OnStnClickedColoroutl()
{
- AskColor(2);
+ AskColor(2);
}
void CStyleEditorDialog::OnStnClickedColorshad()
{
- AskColor(3);
+ AskColor(3);
}
void CStyleEditorDialog::OnBnClickedCheck1()
{
- UpdateData();
+ UpdateData();
- int avg = 0;
- for(ptrdiff_t i = 0; i < 4; i++) avg += m_alphasliders[i].GetPos();
- avg /= 4;
- for(ptrdiff_t i = 0; i < 4; i++) m_alphasliders[i].SetPos(avg);
+ int avg = 0;
+ for(ptrdiff_t i = 0; i < 4; i++) avg += m_alphasliders[i].GetPos();
+ avg /= 4;
+ for(ptrdiff_t i = 0; i < 4; i++) m_alphasliders[i].SetPos(avg);
}
void CStyleEditorDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
- if(m_linkalphasliders && pScrollBar)
- {
- int pos = ((CSliderCtrl*)pScrollBar)->GetPos();
- for(ptrdiff_t i = 0; i < 4; i++) m_alphasliders[i].SetPos(pos);
- }
+ if(m_linkalphasliders && pScrollBar)
+ {
+ int pos = ((CSliderCtrl*)pScrollBar)->GetPos();
+ for(ptrdiff_t i = 0; i < 4; i++) m_alphasliders[i].SetPos(pos);
+ }
- CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
+ CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
diff --git a/src/filters/transform/vsfilter/StyleEditorDialog.h b/src/filters/transform/vsfilter/StyleEditorDialog.h
index 0c1f03bef..1d74eb757 100644
--- a/src/filters/transform/vsfilter/StyleEditorDialog.h
+++ b/src/filters/transform/vsfilter/StyleEditorDialog.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,91 +29,88 @@
class CColorStatic : public CStatic
{
- DECLARE_DYNAMIC(CColorStatic)
+ DECLARE_DYNAMIC(CColorStatic)
- COLORREF* m_pColor;
+ COLORREF* m_pColor;
public:
- CColorStatic(CWnd* pParent = NULL) : m_pColor(NULL) {}
- virtual ~CColorStatic() {}
+ CColorStatic(CWnd* pParent = NULL) : m_pColor(NULL) {}
+ virtual ~CColorStatic() {}
- void SetColorPtr(COLORREF* pColor)
- {
- m_pColor = pColor;
- }
+ void SetColorPtr(COLORREF* pColor) {m_pColor = pColor;}
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
protected:
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
- {
- CRect r;
- GetClientRect(r);
- CDC::FromHandle(lpDrawItemStruct->hDC)->FillSolidRect(r, m_pColor ? *m_pColor : ::GetSysColor(COLOR_BTNFACE));
- }
+ virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
+ {
+ CRect r;
+ GetClientRect(r);
+ CDC::FromHandle(lpDrawItemStruct->hDC)->FillSolidRect(r, m_pColor ? *m_pColor : ::GetSysColor(COLOR_BTNFACE));
+ }
};
// CStyleEditorDialog dialog
class CStyleEditorDialog : public CDialog
{
- DECLARE_DYNAMIC(CStyleEditorDialog)
+ DECLARE_DYNAMIC(CStyleEditorDialog)
- CString m_title;
- CWnd* m_pParent;
+ CString m_title;
+ CWnd* m_pParent;
- void UpdateControlData(bool fSave);
- void AskColor(int i);
+ void UpdateControlData(bool fSave);
+ void AskColor(int i);
public:
- CStyleEditorDialog(CString title, STSStyle* pstss, CWnd* pParent = NULL); // standard constructor
- virtual ~CStyleEditorDialog();
+ CStyleEditorDialog(CString title, STSStyle* pstss, CWnd* pParent = NULL); // standard constructor
+ virtual ~CStyleEditorDialog();
// Dialog Data
- enum { IDD = IDD_STYLEDIALOG };
+ enum { IDD = IDD_STYLEDIALOG };
- STSStyle m_stss;
+ STSStyle m_stss;
protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- virtual BOOL OnInitDialog();
- virtual void OnOK();
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
public:
- CButton m_font;
- int m_iCharset;
- CComboBox m_charset;
- int m_spacing;
- CSpinButtonCtrl m_spacingspin;
- int m_angle;
- CSpinButtonCtrl m_anglespin;
- int m_scalex;
- CSpinButtonCtrl m_scalexspin;
- int m_scaley;
- CSpinButtonCtrl m_scaleyspin;
- int m_borderstyle;
- int m_borderwidth;
- CSpinButtonCtrl m_borderwidthspin;
- int m_shadowdepth;
- CSpinButtonCtrl m_shadowdepthspin;
- int m_screenalignment;
- CRect m_margin;
- CSpinButtonCtrl m_marginleftspin;
- CSpinButtonCtrl m_marginrightspin;
- CSpinButtonCtrl m_margintopspin;
- CSpinButtonCtrl m_marginbottomspin;
- CColorStatic m_color[4];
- int m_alpha[4];
- CSliderCtrl m_alphasliders[4];
- BOOL m_linkalphasliders;
-
- afx_msg void OnBnClickedButton1();
- afx_msg void OnStnClickedColorpri();
- afx_msg void OnStnClickedColorsec();
- afx_msg void OnStnClickedColoroutl();
- afx_msg void OnStnClickedColorshad();
- afx_msg void OnBnClickedCheck1();
- afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ CButton m_font;
+ int m_iCharset;
+ CComboBox m_charset;
+ int m_spacing;
+ CSpinButtonCtrl m_spacingspin;
+ int m_angle;
+ CSpinButtonCtrl m_anglespin;
+ int m_scalex;
+ CSpinButtonCtrl m_scalexspin;
+ int m_scaley;
+ CSpinButtonCtrl m_scaleyspin;
+ int m_borderstyle;
+ int m_borderwidth;
+ CSpinButtonCtrl m_borderwidthspin;
+ int m_shadowdepth;
+ CSpinButtonCtrl m_shadowdepthspin;
+ int m_screenalignment;
+ CRect m_margin;
+ CSpinButtonCtrl m_marginleftspin;
+ CSpinButtonCtrl m_marginrightspin;
+ CSpinButtonCtrl m_margintopspin;
+ CSpinButtonCtrl m_marginbottomspin;
+ CColorStatic m_color[4];
+ int m_alpha[4];
+ CSliderCtrl m_alphasliders[4];
+ BOOL m_linkalphasliders;
+
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnStnClickedColorpri();
+ afx_msg void OnStnClickedColorsec();
+ afx_msg void OnStnClickedColoroutl();
+ afx_msg void OnStnClickedColorshad();
+ afx_msg void OnBnClickedCheck1();
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
};
diff --git a/src/filters/transform/vsfilter/Systray.cpp b/src/filters/transform/vsfilter/Systray.cpp
index 7f9693c36..00a25bf33 100644
--- a/src/filters/transform/vsfilter/Systray.cpp
+++ b/src/filters/transform/vsfilter/Systray.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -39,364 +39,334 @@ static UINT WM_NOTIFYICON = RegisterWindowMessage(TEXT("MYWM_NOTIFYICON"));
LRESULT CALLBACK HookProc(UINT code, WPARAM wParam, LPARAM lParam)
{
- MSG* msg = (MSG*)lParam;
-
- if(msg->message == WM_KEYDOWN)
- {
- switch(msg->wParam)
- {
- case VK_F13:
- PostMessage(HWND_BROADCAST, WM_DVSPREVSUB, 0, 0);
- break;
- case VK_F14:
- PostMessage(HWND_BROADCAST, WM_DVSNEXTSUB, 0, 0);
- break;
- case VK_F15:
- PostMessage(HWND_BROADCAST, WM_DVSHIDESUB, 0, 0);
- break;
- case VK_F16:
- PostMessage(HWND_BROADCAST, WM_DVSSHOWSUB, 0, 0);
- break;
- case VK_F17:
- PostMessage(HWND_BROADCAST, WM_DVSSHOWHIDESUB, 0, 0);
- break;
- default:
- break;
- }
- }
-
- // Always call next hook in chain
- return CallNextHookEx(g_hHook, code, wParam, lParam);
-}
+ MSG* msg = (MSG*)lParam;
+
+ if(msg->message == WM_KEYDOWN)
+ {
+ switch(msg->wParam)
+ {
+ case VK_F13: PostMessage(HWND_BROADCAST, WM_DVSPREVSUB, 0, 0); break;
+ case VK_F14: PostMessage(HWND_BROADCAST, WM_DVSNEXTSUB, 0, 0); break;
+ case VK_F15: PostMessage(HWND_BROADCAST, WM_DVSHIDESUB, 0, 0); break;
+ case VK_F16: PostMessage(HWND_BROADCAST, WM_DVSSHOWSUB, 0, 0); break;
+ case VK_F17: PostMessage(HWND_BROADCAST, WM_DVSSHOWHIDESUB, 0, 0); break;
+ default: break;
+ }
+ }
+
+ // Always call next hook in chain
+ return CallNextHookEx(g_hHook, code, wParam, lParam);
+}
class CSystrayWindow : public CWnd
{
- SystrayIconData* m_tbid;
-
- void StepSub(int dir)
- {
- int iSelected, nLangs;
- if(FAILED(m_tbid->dvs->get_LanguageCount(&nLangs))) return;
- if(FAILED(m_tbid->dvs->get_SelectedLanguage(&iSelected))) return;
- if(nLangs > 0) m_tbid->dvs->put_SelectedLanguage((iSelected + dir + nLangs) % nLangs);
- }
-
- void ShowSub(bool fShow)
- {
- m_tbid->dvs->put_HideSubtitles(!fShow);
- }
-
- void ToggleSub()
- {
- bool fShow;
- if(FAILED(m_tbid->dvs->get_HideSubtitles(&fShow))) return;
- m_tbid->dvs->put_HideSubtitles(!fShow);
- }
+ SystrayIconData* m_tbid;
+
+ void StepSub(int dir)
+ {
+ int iSelected, nLangs;
+ if(FAILED(m_tbid->dvs->get_LanguageCount(&nLangs))) return;
+ if(FAILED(m_tbid->dvs->get_SelectedLanguage(&iSelected))) return;
+ if(nLangs > 0) m_tbid->dvs->put_SelectedLanguage((iSelected+dir+nLangs)%nLangs);
+ }
+
+ void ShowSub(bool fShow)
+ {
+ m_tbid->dvs->put_HideSubtitles(!fShow);
+ }
+
+ void ToggleSub()
+ {
+ bool fShow;
+ if(FAILED(m_tbid->dvs->get_HideSubtitles(&fShow))) return;
+ m_tbid->dvs->put_HideSubtitles(!fShow);
+ }
public:
- CSystrayWindow(SystrayIconData* tbid) : m_tbid(tbid) {}
+ CSystrayWindow(SystrayIconData* tbid) : m_tbid(tbid) {}
protected:
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
public:
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnClose();
- afx_msg void OnDestroy();
- afx_msg void OnTimer(UINT_PTR nIDEvent);
- afx_msg LRESULT OnDVSPrevSub(WPARAM, LPARAM);
- afx_msg LRESULT OnDVSNextSub(WPARAM, LPARAM);
- afx_msg LRESULT OnDVSHideSub(WPARAM, LPARAM);
- afx_msg LRESULT OnDVSShowSub(WPARAM, LPARAM);
- afx_msg LRESULT OnDVSShowHideSub(WPARAM, LPARAM);
- afx_msg LRESULT OnTaskBarRestart(WPARAM, LPARAM);
- afx_msg LRESULT OnNotifyIcon(WPARAM, LPARAM);
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnClose();
+ afx_msg void OnDestroy();
+ afx_msg void OnTimer(UINT_PTR nIDEvent);
+ afx_msg LRESULT OnDVSPrevSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSNextSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSHideSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSShowSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSShowHideSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnTaskBarRestart(WPARAM, LPARAM);
+ afx_msg LRESULT OnNotifyIcon(WPARAM, LPARAM);
};
BEGIN_MESSAGE_MAP(CSystrayWindow, CWnd)
- ON_WM_CREATE()
- ON_WM_CLOSE()
- ON_WM_DESTROY()
- ON_WM_TIMER()
- ON_REGISTERED_MESSAGE(WM_DVSPREVSUB, OnDVSPrevSub)
- ON_REGISTERED_MESSAGE(WM_DVSNEXTSUB, OnDVSNextSub)
- ON_REGISTERED_MESSAGE(WM_DVSHIDESUB, OnDVSHideSub)
- ON_REGISTERED_MESSAGE(WM_DVSSHOWSUB, OnDVSShowSub)
- ON_REGISTERED_MESSAGE(WM_DVSSHOWHIDESUB, OnDVSShowHideSub)
- ON_REGISTERED_MESSAGE(s_uTaskbarRestart, OnTaskBarRestart)
- ON_REGISTERED_MESSAGE(WM_NOTIFYICON, OnNotifyIcon)
+ ON_WM_CREATE()
+ ON_WM_CLOSE()
+ ON_WM_DESTROY()
+ ON_WM_TIMER()
+ ON_REGISTERED_MESSAGE(WM_DVSPREVSUB, OnDVSPrevSub)
+ ON_REGISTERED_MESSAGE(WM_DVSNEXTSUB, OnDVSNextSub)
+ ON_REGISTERED_MESSAGE(WM_DVSHIDESUB, OnDVSHideSub)
+ ON_REGISTERED_MESSAGE(WM_DVSSHOWSUB, OnDVSShowSub)
+ ON_REGISTERED_MESSAGE(WM_DVSSHOWHIDESUB, OnDVSShowHideSub)
+ ON_REGISTERED_MESSAGE(s_uTaskbarRestart, OnTaskBarRestart)
+ ON_REGISTERED_MESSAGE(WM_NOTIFYICON, OnNotifyIcon)
END_MESSAGE_MAP()
int CSystrayWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
- if(CWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
+ if(CWnd::OnCreate(lpCreateStruct) == -1)
+ return -1;
- if(g_hHook == INVALID_HANDLE_VALUE)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ if(g_hHook == INVALID_HANDLE_VALUE)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
// g_hHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, AfxGetInstanceHandle(), 0);
- }
+ }
- SetTimer(1, 5000, NULL);
+ SetTimer(1, 5000, NULL);
- PostMessage(s_uTaskbarRestart);
+ PostMessage(s_uTaskbarRestart);
- return 0;
+ return 0;
}
void CSystrayWindow::OnClose()
{
- DestroyWindow();
+ DestroyWindow();
}
void CSystrayWindow::OnDestroy()
{
- NOTIFYICONDATA tnid;
- tnid.cbSize = sizeof(NOTIFYICONDATA);
- tnid.hWnd = m_hWnd;
- tnid.uID = IDI_ICON1;
- Shell_NotifyIcon(NIM_DELETE, &tnid);
-
- if(g_hHook != INVALID_HANDLE_VALUE)
- {
- UnhookWindowsHookEx(g_hHook);
- g_hHook = (HHOOK)INVALID_HANDLE_VALUE;
- }
-
- PostQuitMessage(0);
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDI_ICON1;
+ Shell_NotifyIcon(NIM_DELETE, &tnid);
+
+ if(g_hHook != INVALID_HANDLE_VALUE)
+ {
+ UnhookWindowsHookEx(g_hHook);
+ g_hHook = (HHOOK)INVALID_HANDLE_VALUE;
+ }
+
+ PostQuitMessage(0);
}
void CSystrayWindow::OnTimer(UINT_PTR nIDEvent)
{
- if(nIDEvent == 1)
- {
- UINT fScreenSaver = 0;
- if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fScreenSaver, 0))
- {
- SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
- SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fScreenSaver, 0, SPIF_SENDWININICHANGE);
- }
- }
-
- CWnd::OnTimer(nIDEvent);
+ if(nIDEvent == 1)
+ {
+ UINT fScreenSaver = 0;
+ if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fScreenSaver, 0))
+ {
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fScreenSaver, 0, SPIF_SENDWININICHANGE);
+ }
+ }
+
+ CWnd::OnTimer(nIDEvent);
}
LRESULT CSystrayWindow::OnDVSPrevSub(WPARAM, LPARAM)
-{
- StepSub(-1);
- return 0;
-}
+ {StepSub(-1); return 0;}
LRESULT CSystrayWindow::OnDVSNextSub(WPARAM, LPARAM)
-{
- StepSub(+1);
- return 0;
-}
+ {StepSub(+1); return 0;}
LRESULT CSystrayWindow::OnDVSHideSub(WPARAM, LPARAM)
-{
- ShowSub(false);
- return 0;
-}
+ {ShowSub(false); return 0;}
LRESULT CSystrayWindow::OnDVSShowSub(WPARAM, LPARAM)
-{
- ShowSub(true);
- return 0;
-}
+ {ShowSub(true); return 0;}
LRESULT CSystrayWindow::OnDVSShowHideSub(WPARAM, LPARAM)
-{
- ToggleSub();
- return 0;
-}
+ {ToggleSub(); return 0;}
LRESULT CSystrayWindow::OnTaskBarRestart(WPARAM, LPARAM)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- if(m_tbid->fShowIcon)
- {
- NOTIFYICONDATA tnid;
- tnid.cbSize = sizeof(NOTIFYICONDATA);
- tnid.hWnd = m_hWnd;
- tnid.uID = IDI_ICON1;
- tnid.hIcon = (HICON)LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON1));
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(m_tbid->fShowIcon)
+ {
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDI_ICON1;
+ tnid.hIcon = (HICON)LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON1));
// tnid.hIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT);
- tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
- tnid.uCallbackMessage = WM_NOTIFYICON;
- lstrcpyn(tnid.szTip, TEXT("DirectVobSub"), sizeof(tnid.szTip));
+ tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+ tnid.uCallbackMessage = WM_NOTIFYICON;
+ lstrcpyn(tnid.szTip, TEXT("DirectVobSub"), sizeof(tnid.szTip));
- BOOL res = Shell_NotifyIcon(NIM_ADD, &tnid);
+ BOOL res = Shell_NotifyIcon(NIM_ADD, &tnid);
- if(tnid.hIcon) DestroyIcon(tnid.hIcon);
+ if(tnid.hIcon) DestroyIcon(tnid.hIcon);
- return res ? 0 : -1;
- }
+ return res?0:-1;
+ }
- return 0;
+ return 0;
}
LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
{
if((UINT)wParam != IDI_ICON1)
- return -1;
-
- HWND hWnd = m_hWnd;
-
- switch((UINT)lParam)
- {
- case WM_LBUTTONDBLCLK:
- {
- // IMPORTANT: we must not hold the graph at the same time as showing the property page
- // or else when closing the app the graph doesn't get released and dvobsub's JoinFilterGraph
- // is never called to close us down.
-
- CComPtr<IBaseFilter> pBF2;
-
- BeginEnumFilters(m_tbid->graph, pEF, pBF)
- {
- if(!CComQIPtr<IDirectVobSub>(pBF))
- continue;
-
- if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph)
- {
- HWND hwnd;
- if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
- || SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd)))
- hWnd = hwnd;
- }
-
- pBF2 = pBF;
-
- break;
- }
- EndEnumFilters
-
- if(pBF2)
- ShowPPage(pBF2, hWnd);
- }
- break;
-
- case WM_RBUTTONDOWN:
- {
- POINT p;
- GetCursorPos(&p);
-
- CInterfaceArray<IAMStreamSelect> pStreams;
- CStringArray names;
-
- BeginEnumFilters(m_tbid->graph, pEF, pBF)
- {
- CString name = GetFilterName(pBF);
- if(name.IsEmpty()) continue;
-
- if(CComQIPtr<IAMStreamSelect> pSS = pBF)
- {
- pStreams.Add(pSS);
- names.Add(name);
- }
- }
- EndEnumFilters
-
- CMenu popup;
- popup.CreatePopupMenu();
-
- for(ptrdiff_t j = 0; j < pStreams.GetCount(); j++)
- {
- bool fMMSwitcher = !names[j].Compare(_T("Morgan Stream Switcher"));
-
- DWORD cStreams = 0;
- pStreams[j]->Count(&cStreams);
-
- DWORD flags, group, prevgroup = -1;
-
- for(UINT i = 0; i < cStreams; i++)
- {
- WCHAR* pName = NULL;
-
- if(S_OK == pStreams[j]->Info(i, 0, &flags, 0, &group, &pName, 0, 0))
- {
- if(prevgroup != group && i > 1)
- {
- if(fMMSwitcher)
- {
- cStreams = i;
- break;
- }
- popup.AppendMenu(MF_SEPARATOR);
- }
- prevgroup = group;
-
- if(pName)
- {
- popup.AppendMenu(MF_ENABLED | MF_STRING | (flags ? MF_CHECKED : MF_UNCHECKED), (1 << 15) | (j << 8) | (i), CString(pName));
- CoTaskMemFree(pName);
- }
- }
- }
-
- if(cStreams > 0) popup.AppendMenu(MF_SEPARATOR);
- }
-
- int i;
-
- TCHAR* str;
- for(i = 0; str = CallPPage(m_tbid->graph, i, (HWND)INVALID_HANDLE_VALUE); i++)
- {
- if(_tcsncmp(str, _T("DivX MPEG"), 9) || m_tbid->fRunOnce) // divx3's ppage will crash if the graph hasn't been run at least once yet
- popup.AppendMenu(MF_ENABLED | MF_STRING | MF_UNCHECKED, (1 << 14) | (i), str);
-
- delete [] str;
- }
-
- SetForegroundWindow();
- UINT id = popup.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, CWnd::FromHandle(hWnd), 0);
- PostMessage(WM_NULL);
-
- if(id & (1 << 15))
- {
- pStreams[(id>>8)&0x3f]->Enable(id & 0xff, AMSTREAMSELECTENABLE_ENABLE);
- }
- else if(id & (1 << 14))
- {
- if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph)
- {
- HWND hwnd;
- if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
- || SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd)))
- hWnd = hwnd;
- }
-
- CallPPage(m_tbid->graph, id & 0xff, hWnd);
- }
- }
- break;
-
- default:
- break;
- }
-
- return 0;
+ return -1;
+
+ HWND hWnd = m_hWnd;
+
+ switch((UINT)lParam)
+ {
+ case WM_LBUTTONDBLCLK:
+ {
+ // IMPORTANT: we must not hold the graph at the same time as showing the property page
+ // or else when closing the app the graph doesn't get released and dvobsub's JoinFilterGraph
+ // is never called to close us down.
+
+ CComPtr<IBaseFilter> pBF2;
+
+ BeginEnumFilters(m_tbid->graph, pEF, pBF)
+ {
+ if(!CComQIPtr<IDirectVobSub>(pBF))
+ continue;
+
+ if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph)
+ {
+ HWND hwnd;
+ if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
+ || SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd)))
+ hWnd = hwnd;
+ }
+
+ pBF2 = pBF;
+
+ break;
+ }
+ EndEnumFilters
+
+ if(pBF2)
+ ShowPPage(pBF2, hWnd);
+ }
+ break;
+
+ case WM_RBUTTONDOWN:
+ {
+ POINT p;
+ GetCursorPos(&p);
+
+ CInterfaceArray<IAMStreamSelect> pStreams;
+ CStringArray names;
+
+ BeginEnumFilters(m_tbid->graph, pEF, pBF)
+ {
+ CString name = GetFilterName(pBF);
+ if(name.IsEmpty()) continue;
+
+ if(CComQIPtr<IAMStreamSelect> pSS = pBF)
+ {
+ pStreams.Add(pSS);
+ names.Add(name);
+ }
+ }
+ EndEnumFilters
+
+ CMenu popup;
+ popup.CreatePopupMenu();
+
+ for(ptrdiff_t j = 0; j < pStreams.GetCount(); j++)
+ {
+ bool fMMSwitcher = !names[j].Compare(_T("Morgan Stream Switcher"));
+
+ DWORD cStreams = 0;
+ pStreams[j]->Count(&cStreams);
+
+ DWORD flags, group, prevgroup = -1;
+
+ for(UINT i = 0; i < cStreams; i++)
+ {
+ WCHAR* pName = NULL;
+
+ if(S_OK == pStreams[j]->Info(i, 0, &flags, 0, &group, &pName, 0, 0))
+ {
+ if(prevgroup != group && i > 1)
+ {
+ if(fMMSwitcher) {cStreams = i; break;}
+ popup.AppendMenu(MF_SEPARATOR);
+ }
+ prevgroup = group;
+
+ if(pName)
+ {
+ popup.AppendMenu(MF_ENABLED|MF_STRING|(flags?MF_CHECKED:MF_UNCHECKED), (1<<15)|(j<<8)|(i), CString(pName));
+ CoTaskMemFree(pName);
+ }
+ }
+ }
+
+ if(cStreams > 0) popup.AppendMenu(MF_SEPARATOR);
+ }
+
+ int i;
+
+ TCHAR* str;
+ for(i = 0; str = CallPPage(m_tbid->graph, i, (HWND)INVALID_HANDLE_VALUE); i++)
+ {
+ if(_tcsncmp(str, _T("DivX MPEG"), 9) || m_tbid->fRunOnce) // divx3's ppage will crash if the graph hasn't been run at least once yet
+ popup.AppendMenu(MF_ENABLED|MF_STRING|MF_UNCHECKED, (1<<14)|(i), str);
+
+ delete [] str;
+ }
+
+ SetForegroundWindow();
+ UINT id = popup.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, CWnd::FromHandle(hWnd), 0);
+ PostMessage(WM_NULL);
+
+ if(id & (1<<15))
+ {
+ pStreams[(id>>8)&0x3f]->Enable(id&0xff, AMSTREAMSELECTENABLE_ENABLE);
+ }
+ else if(id & (1<<14))
+ {
+ if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph)
+ {
+ HWND hwnd;
+ if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
+ || SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd)))
+ hWnd = hwnd;
+ }
+
+ CallPPage(m_tbid->graph, id&0xff, hWnd);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
}
//
DWORD CALLBACK SystrayThreadProc(void* pParam)
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- CSystrayWindow wnd((SystrayIconData*)pParam);
- if(!wnd.CreateEx(0, AfxRegisterWndClass(0), _T("DVSWND"), WS_OVERLAPPED, CRect(0, 0, 0, 0), NULL, 0, NULL))
- return -1;
+ CSystrayWindow wnd((SystrayIconData*)pParam);
+ if(!wnd.CreateEx(0, AfxRegisterWndClass(0), _T("DVSWND"), WS_OVERLAPPED, CRect(0, 0, 0, 0), NULL, 0, NULL))
+ return -1;
- ((SystrayIconData*)pParam)->hSystrayWnd = wnd.m_hWnd;
+ ((SystrayIconData*)pParam)->hSystrayWnd = wnd.m_hWnd;
- MSG msg;
- while(GetMessage(&msg, NULL/*wnd.m_hWnd*/, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ MSG msg;
+ while(GetMessage(&msg, NULL/*wnd.m_hWnd*/, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
- return 0;
+ return 0;
}
// TODO: replace this function
@@ -404,48 +374,48 @@ DWORD CALLBACK SystrayThreadProc(void* pParam)
// hWnd == INVALID_HANDLE_VALUE - get name, hWnd != INVALID_HANDLE_VALUE - show ppage
static TCHAR* CallPPage(IFilterGraph* pGraph, int idx, HWND hWnd)
{
- int i = 0;
- bool fFound = false;
-
- WCHAR* wstr = NULL;
- CComPtr<IBaseFilter> pFilter;
- CAUUID caGUID;
- caGUID.pElems = NULL;
-
- BeginEnumFilters(pGraph, pEF, pBF)
- {
- CComQIPtr<ISpecifyPropertyPages> pSPS = pBF;
- if(!pSPS) continue;
-
- if(i == idx)
- {
- pFilter = pBF;
- pSPS->GetPages(&caGUID);
- wstr = _wcsdup(CStringW(GetFilterName(pBF))); // double char-wchar conversion happens in the non-unicode build, but anyway... :)
- break;
- }
-
- i++;
- }
- EndEnumFilters
-
- TCHAR* ret = NULL;
-
- if(pFilter)
- {
- if(hWnd != INVALID_HANDLE_VALUE)
- {
- ShowPPage(pFilter, hWnd);
- }
- else
- {
- if(ret = new TCHAR[wcslen(wstr)+1])
- _tcscpy(ret, CString(wstr));
- }
- }
-
- if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
- if(wstr) free(wstr);
-
- return(ret);
+ int i = 0;
+ bool fFound = false;
+
+ WCHAR* wstr = NULL;
+ CComPtr<IBaseFilter> pFilter;
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ CComQIPtr<ISpecifyPropertyPages> pSPS = pBF;
+ if(!pSPS) continue;
+
+ if(i == idx)
+ {
+ pFilter = pBF;
+ pSPS->GetPages(&caGUID);
+ wstr = _wcsdup(CStringW(GetFilterName(pBF))); // double char-wchar conversion happens in the non-unicode build, but anyway... :)
+ break;
+ }
+
+ i++;
+ }
+ EndEnumFilters
+
+ TCHAR* ret = NULL;
+
+ if(pFilter)
+ {
+ if(hWnd != INVALID_HANDLE_VALUE)
+ {
+ ShowPPage(pFilter, hWnd);
+ }
+ else
+ {
+ if(ret = new TCHAR[wcslen(wstr)+1])
+ _tcscpy(ret, CString(wstr));
+ }
+ }
+
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ if(wstr) free(wstr);
+
+ return(ret);
}
diff --git a/src/filters/transform/vsfilter/Systray.h b/src/filters/transform/vsfilter/Systray.h
index 6d4ac3b76..0e41e4835 100644
--- a/src/filters/transform/vsfilter/Systray.h
+++ b/src/filters/transform/vsfilter/Systray.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/vsfilter/TextInputPin.cpp b/src/filters/transform/vsfilter/TextInputPin.cpp
index b3c76b06a..9935f6a13 100644
--- a/src/filters/transform/vsfilter/TextInputPin.cpp
+++ b/src/filters/transform/vsfilter/TextInputPin.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -25,22 +25,22 @@
#include "../../../DSUtil/DSUtil.h"
CTextInputPin::CTextInputPin(CDirectVobSubFilter* pFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr)
- : CSubtitleInputPin(pFilter, pLock, pSubLock, phr)
- , m_pDVS(pFilter)
+ : CSubtitleInputPin(pFilter, pLock, pSubLock, phr)
+ , m_pDVS(pFilter)
{
}
void CTextInputPin::AddSubStream(ISubStream* pSubStream)
{
- m_pDVS->AddSubStream(pSubStream);
+ m_pDVS->AddSubStream(pSubStream);
}
void CTextInputPin::RemoveSubStream(ISubStream* pSubStream)
{
- m_pDVS->RemoveSubStream(pSubStream);
+ m_pDVS->RemoveSubStream(pSubStream);
}
void CTextInputPin::InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream)
{
- m_pDVS->InvalidateSubtitle(rtStart, (DWORD_PTR)(ISubStream*)pSubStream);
+ m_pDVS->InvalidateSubtitle(rtStart, (DWORD_PTR)(ISubStream*)pSubStream);
}
diff --git a/src/filters/transform/vsfilter/TextInputPin.h b/src/filters/transform/vsfilter/TextInputPin.h
index 0fa7f8854..b28f71890 100644
--- a/src/filters/transform/vsfilter/TextInputPin.h
+++ b/src/filters/transform/vsfilter/TextInputPin.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -30,9 +30,9 @@ class CTextInputPin : public CSubtitleInputPin
CDirectVobSubFilter* m_pDVS;
protected:
- void AddSubStream(ISubStream* pSubStream);
- void RemoveSubStream(ISubStream* pSubStream);
- void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream);
+ void AddSubStream(ISubStream* pSubStream);
+ void RemoveSubStream(ISubStream* pSubStream);
+ void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream);
public:
CTextInputPin(CDirectVobSubFilter* pFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr);
diff --git a/src/filters/transform/vsfilter/VSFilter.cpp b/src/filters/transform/vsfilter/VSFilter.cpp
index 7158d4600..f772cc5cf 100644
--- a/src/filters/transform/vsfilter/VSFilter.cpp
+++ b/src/filters/transform/vsfilter/VSFilter.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -29,7 +29,7 @@
#include <moreuuids.h>
/////////////////////////////////////////////////////////////////////////////
-// CVSFilterApp
+// CVSFilterApp
BEGIN_MESSAGE_MAP(CVSFilterApp, CWinApp)
END_MESSAGE_MAP()
@@ -42,38 +42,38 @@ extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL CVSFilterApp::InitInstance()
{
- if(!CWinApp::InitInstance())
- return FALSE;
+ if(!CWinApp::InitInstance())
+ return FALSE;
- SetRegistryKey(_T("Gabest"));
+ SetRegistryKey(_T("Gabest"));
- DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0); // "DllMain" of the dshow baseclasses
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0); // "DllMain" of the dshow baseclasses
- STARTUPINFO si;
- GetStartupInfo(&si);
- m_AppName = CString(si.lpTitle);
- m_AppName.Replace('\\', '/');
- m_AppName = m_AppName.Mid(m_AppName.ReverseFind('/') + 1);
- m_AppName.MakeLower();
+ STARTUPINFO si;
+ GetStartupInfo(&si);
+ m_AppName = CString(si.lpTitle);
+ m_AppName.Replace('\\', '/');
+ m_AppName = m_AppName.Mid(m_AppName.ReverseFind('/')+1);
+ m_AppName.MakeLower();
- return TRUE;
+ return TRUE;
}
int CVSFilterApp::ExitInstance()
{
- DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0); // "DllMain" of the dshow baseclasses
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0); // "DllMain" of the dshow baseclasses
- return CWinApp::ExitInstance();
+ return CWinApp::ExitInstance();
}
HINSTANCE CVSFilterApp::LoadAppLangResourceDLL()
{
- CString fn;
- fn.ReleaseBufferSetLength(::GetModuleFileName(m_hInstance, fn.GetBuffer(MAX_PATH), MAX_PATH));
- fn = fn.Mid(fn.ReverseFind('\\') + 1);
- fn = fn.Left(fn.ReverseFind('.') + 1);
- fn = fn + _T("lang");
- return ::LoadLibrary(fn);
+ CString fn;
+ fn.ReleaseBufferSetLength(::GetModuleFileName(m_hInstance, fn.GetBuffer(MAX_PATH), MAX_PATH));
+ fn = fn.Mid(fn.ReverseFind('\\')+1);
+ fn = fn.Left(fn.ReverseFind('.')+1);
+ fn = fn + _T("lang");
+ return ::LoadLibrary(fn);
}
CVSFilterApp theApp;
@@ -82,25 +82,25 @@ CVSFilterApp theApp;
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
{
- {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_YV12},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_I420},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB565},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB555},
- {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB24},
+ {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YV12},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_I420},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB565},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB555},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB24},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
{
- {&MEDIATYPE_Text, &MEDIASUBTYPE_None},
+ {&MEDIATYPE_Text, &MEDIASUBTYPE_None},
};
const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
{
- {&MEDIATYPE_Video, &MEDIASUBTYPE_None},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_None},
};
const AMOVIESETUP_PIN sudpPins[] =
@@ -110,25 +110,24 @@ const AMOVIESETUP_PIN sudpPins[] =
{L"Input2", TRUE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, countof(sudPinTypesIn2), sudPinTypesIn2}
};
-/*const*/
-AMOVIESETUP_FILTER sudFilter[] =
+/*const*/ AMOVIESETUP_FILTER sudFilter[] =
{
- {&__uuidof(CDirectVobSubFilter), L"DirectVobSub", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
- {&__uuidof(CDirectVobSubFilter2), L"DirectVobSub (auto-loading version)", MERIT_PREFERRED + 2, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CDirectVobSubFilter), L"DirectVobSub", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
+ {&__uuidof(CDirectVobSubFilter2), L"DirectVobSub (auto-loading version)", MERIT_PREFERRED+2, countof(sudpPins), sudpPins, CLSID_LegacyAmFilterCategory},
};
CFactoryTemplate g_Templates[] =
{
- {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDirectVobSubFilter>, NULL, &sudFilter[0]},
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDirectVobSubFilter>, NULL, &sudFilter[0]},
{sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDirectVobSubFilter2>, NULL, &sudFilter[1]},
{L"DVSMainPPage", &__uuidof(CDVSMainPPage), CreateInstance<CDVSMainPPage>},
{L"DVSGeneralPPage", &__uuidof(CDVSGeneralPPage), CreateInstance<CDVSGeneralPPage>},
{L"DVSMiscPPage", &__uuidof(CDVSMiscPPage), CreateInstance<CDVSMiscPPage>},
{L"DVSTimingPPage", &__uuidof(CDVSTimingPPage), CreateInstance<CDVSTimingPPage>},
- {L"DVSZoomPPage", &__uuidof(CDVSZoomPPage), CreateInstance<CDVSZoomPPage>},
+ {L"DVSZoomPPage", &__uuidof(CDVSZoomPPage), CreateInstance<CDVSZoomPPage>},
{L"DVSColorPPage", &__uuidof(CDVSColorPPage), CreateInstance<CDVSColorPPage>},
{L"DVSPathsPPage", &__uuidof(CDVSPathsPPage), CreateInstance<CDVSPathsPPage>},
- {L"DVSAboutPPage", &__uuidof(CDVSAboutPPage), CreateInstance<CDVSAboutPPage>},
+ {L"DVSAboutPPage", &__uuidof(CDVSAboutPPage), CreateInstance<CDVSAboutPPage>},
};
int g_cTemplates = countof(g_Templates);
@@ -139,41 +138,41 @@ extern void JajDeGonoszVagyok();
STDAPI DllRegisterServer()
{
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
- if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1)
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0);
+ if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1)
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0);
- if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1)
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), 0);
+ if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1)
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), 0);
- if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1)
- theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0);
+ if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1)
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0);
- /*removeme*/
- JajDeGonoszVagyok();
+ /*removeme*/
+ JajDeGonoszVagyok();
- return AMovieDllRegisterServer2(TRUE);
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
// DVS_WriteProfileInt2(IDS_R_GENERAL, IDS_RG_SEENDIVXWARNING, 0);
- return AMovieDllRegisterServer2(FALSE);
+ return AMovieDllRegisterServer2(FALSE);
}
void CALLBACK DirectVobSub(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{
- if(FAILED(::CoInitialize(0))) return;
+ if(FAILED(::CoInitialize(0))) return;
CComPtr<IBaseFilter> pFilter;
- CComQIPtr<ISpecifyPropertyPages> pSpecify;
+ CComQIPtr<ISpecifyPropertyPages> pSpecify;
- if(SUCCEEDED(pFilter.CoCreateInstance(__uuidof(CDirectVobSubFilter))) && (pSpecify = pFilter))
- {
- ShowPPage(pFilter, hwnd);
- }
+ if(SUCCEEDED(pFilter.CoCreateInstance(__uuidof(CDirectVobSubFilter))) && (pSpecify = pFilter))
+ {
+ ShowPPage(pFilter, hwnd);
+ }
- ::CoUninitialize();
+ ::CoUninitialize();
}
diff --git a/src/filters/transform/vsfilter/VSFilter.h b/src/filters/transform/vsfilter/VSFilter.h
index 1bbf6b494..1fafb0c2d 100644
--- a/src/filters/transform/vsfilter/VSFilter.h
+++ b/src/filters/transform/vsfilter/VSFilter.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -26,18 +26,18 @@
class CVSFilterApp : public CWinApp
{
public:
- CVSFilterApp();
+ CVSFilterApp();
- CString m_AppName;
+ CString m_AppName;
protected:
- HINSTANCE LoadAppLangResourceDLL();
+ HINSTANCE LoadAppLangResourceDLL();
public:
- BOOL InitInstance();
- BOOL ExitInstance();
+ BOOL InitInstance();
+ BOOL ExitInstance();
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
};
extern CVSFilterApp theApp;
diff --git a/src/filters/transform/vsfilter/csri.h b/src/filters/transform/vsfilter/csri.h
index 80b5ccdea..6f2dcfb1a 100644
--- a/src/filters/transform/vsfilter/csri.h
+++ b/src/filters/transform/vsfilter/csri.h
@@ -3,11 +3,11 @@
*****************************************************************************
* Copyright (C) 2007 David Lamparter
* All rights reserved.
- *
+ *
* 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
@@ -15,7 +15,7 @@
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
@@ -43,39 +43,39 @@ extern "C" {
#endif
#ifndef CSRIAPI
- /** CSRI API attributes.
- * defaults to \c extern.
- */
+/** CSRI API attributes.
+ * defaults to \c extern.
+ */
#define CSRIAPI extern
#endif
- /** \defgroup base CSRI base API. */
- /*@{*/
-
- /** pixel format specification for frames */
- enum csri_pixfmt {
- CSRI_F_RGBA = 0,
- CSRI_F_ARGB,
- CSRI_F_BGRA,
- CSRI_F_ABGR,
+/** \defgroup base CSRI base API. */
+/*@{*/
- CSRI_F_RGB_ = 0x100,
- CSRI_F__RGB,
- CSRI_F_BGR_, /**< Windows "RGB32" */
- CSRI_F__BGR,
+/** pixel format specification for frames */
+enum csri_pixfmt {
+ CSRI_F_RGBA = 0,
+ CSRI_F_ARGB,
+ CSRI_F_BGRA,
+ CSRI_F_ABGR,
- CSRI_F_RGB = 0x200,
- CSRI_F_BGR, /**< Windows "RGB24" */
+ CSRI_F_RGB_ = 0x100,
+ CSRI_F__RGB,
+ CSRI_F_BGR_, /**< Windows "RGB32" */
+ CSRI_F__BGR,
- CSRI_F_AYUV = 0x1000,
- CSRI_F_YUVA,
- CSRI_F_YVUA,
+ CSRI_F_RGB = 0x200,
+ CSRI_F_BGR, /**< Windows "RGB24" */
- CSRI_F_YUY2 = 0x1100,
+ CSRI_F_AYUV = 0x1000,
+ CSRI_F_YUVA,
+ CSRI_F_YVUA,
+
+ CSRI_F_YUY2 = 0x1100,
- CSRI_F_YV12A = 0x2011, /**< planar YUV 2x2 + alpha plane */
- CSRI_F_YV12 = 0x2111 /**< planar YUV 2x2 */
- };
+ CSRI_F_YV12A = 0x2011, /**< planar YUV 2x2 + alpha plane */
+ CSRI_F_YV12 = 0x2111 /**< planar YUV 2x2 */
+};
#define csri_is_rgb(x) ((x) < 0x1000)
#define csri_is_yuv(x) ((x) >= 0x1000)
@@ -85,266 +85,261 @@ extern "C" {
#define csri_is_yuv_packed(x) ((x) >= 0x1000 && (x) < 0x2000)
#define csri_has_alpha(x) (((x) & 0xfff) < 0x100)
- /** frame/image format specification pre-fed to the renderer */
- struct csri_fmt
- {
- /** format to be used */
- enum csri_pixfmt pixfmt;
- /** image width, full frame.
- *
- * This should specify the full size of the frame.
- * Specifying the video sub-size (in case of added black
- * borders) is left to an extension.
- */
- unsigned width;
- /** image height */
- unsigned height;
- };
-
- /** single frame to be fed to the renderer. */
- struct csri_frame
- {
- /** frame format.
- * It is an application bug if this differs from the one
- * passed in struct #csri_fmt to csri_query_fmt()
- */
- enum csri_pixfmt pixfmt;
- /** the frame's data.
- * Packed formats only use planes[0]; planar formats
- * have the data ordered as Y, U, V[, A].
- *
- * Also note that the topmost line always comes first.
- * The Windows biHeight strange-ity is \a NOT duplicated.
- */
- unsigned char *planes[4];
- /** strides for the individual planes.
- * Stride means full byte offset, i.e. do \a not add
- * frame width
- */
- ptrdiff_t strides[4];
- };
+/** frame/image format specification pre-fed to the renderer */
+struct csri_fmt {
+ /** format to be used */
+ enum csri_pixfmt pixfmt;
+ /** image width, full frame.
+ *
+ * This should specify the full size of the frame.
+ * Specifying the video sub-size (in case of added black
+ * borders) is left to an extension.
+ */
+ unsigned width;
+ /** image height */
+ unsigned height;
+};
+
+/** single frame to be fed to the renderer. */
+struct csri_frame {
+ /** frame format.
+ * It is an application bug if this differs from the one
+ * passed in struct #csri_fmt to csri_query_fmt()
+ */
+ enum csri_pixfmt pixfmt;
+ /** the frame's data.
+ * Packed formats only use planes[0]; planar formats
+ * have the data ordered as Y, U, V[, A].
+ *
+ * Also note that the topmost line always comes first.
+ * The Windows biHeight strange-ity is \a NOT duplicated.
+ */
+ unsigned char *planes[4];
+ /** strides for the individual planes.
+ * Stride means full byte offset, i.e. do \a not add
+ * frame width
+ */
+ ptrdiff_t strides[4];
+};
#ifndef CSRI_OWN_HANDLES
- /** opaque renderer data */
- typedef void csri_rend;
- /** opaque instance data */
- typedef void csri_inst;
+/** opaque renderer data */
+typedef void csri_rend;
+/** opaque instance data */
+typedef void csri_inst;
#endif
#ifdef DOXYGEN
- /** disable the emission of the csri_rend and csri_inst typedefs.
- * define this if you are in a renderer and are typedef'ing
- * csri_rend and csri_inst to your own structs.
- */
+/** disable the emission of the csri_rend and csri_inst typedefs.
+ * define this if you are in a renderer and are typedef'ing
+ * csri_rend and csri_inst to your own structs.
+ */
#define CSRI_OWN_HANDLES
#endif
- /** renderer description.
- * \ingroup loader
- */
- struct csri_info
- {
- /** an identifier for the renderer.
- * - MUST match the regular expression
- * \code ^[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])? \endcode
- * i.e. consists only of letters, numbers and underscores;
- * must start with a letter and doesnt have an underscore
- * as the last character.
- */
- const char *name;
- /** an identifier to the exact version of the renderer.
- * most likely a version number or revision identifier.
- *
- * The helper library does a strcmp over this field in order
- * to order multiple instances of the same renderer. Use
- * higher-byte-value strings for newer renderers.
- */
- const char *specific;
-
- /** a nice name to be presented to the user */
- const char *longname;
- /** the renderer's author */
- const char *author;
- /** a copyright string. Copyright (c) 2042 by Mr. Nice Guy */
- const char *copyright;
- };
-
- /** data of extension-dependent type.
- * The field to be used MUST be specified in the extension where it is used.
- */
- union csri_vardata
- {
- long lval;
- double dval;
- const char *utf8val;
- void *otherval;
- };
-
- /** extension identifier.
- * This follows reverse DNS syntax, i.e.:
- * \code root.branch.leaf \endcode
- * you can either reverse a registered domain name, e.g.
- * \code com.microsoft.csri.usegdiplus \endcode
- * or ask the CSRI maintainers to assign a namespace to you.
- *
- * currently registered namespaces are:
- *
- * \code
- * csri.* - official extensions
- * asa.* - custom extensions of the asa renderer
- * \endcode
- */
- typedef const char *csri_ext_id;
-
- /** script loading parameters.
- * each flag MUST have an associated extension, which can be queried
- * with csri_query_ext(). If the open flag constitutes an extension on its
- * sole own, csri_query_ext() can return a meaningless non-NULL value for
- * it.
- *
- * The data field used must be specified.
- *
- * An extension can have multiple flags. In that case, the flags should have
- * the extension name as common prefix, separated with a dot.
- *
- * A renderer MUST ignore unknown open flags. It MUST NOT return an error
- * just because it does not support a particular flag.
- */
- struct csri_openflag
- {
- /** flag name */
- csri_ext_id name;
- /** flag data argument */
- union csri_vardata data;
- /** link to next flag */
- struct csri_openflag *next;
- };
-
- /** load a script from a file.
- * \param renderer the handle to the renderer
- * \param filename the path to the file to be loaded. \n
- * The filename should be encoded as UTF-8. Windows renderers are
- * expected to convert it to UTF-16 and use the Unicode Windows API
- * functions.
- * \param flags a linked list of open flags. \n
- * The caller manages memory allocation, i.e. static allocation is OK.
- * \return the renderer instance handle, or NULL on error.
- */
- CSRIAPI csri_inst *csri_open_file(csri_rend *renderer,
- const char *filename, struct csri_openflag *flags);
-
- /** load a script from memory.
- * \param renderer the handle to the renderer
- * \param data pointer to the first data byte. \n
- * The caller manages memory allocation and should free the data after
- * calling csri_open_mem(). If the renderer needs to keep the data, it
- * must copy it. \n
- * The renderer is not allowed to write to the data.
- * \param length length, in bytes, of the data
- * \param flags see csri_open_file()
- * \return the render instance handle, or NULL on error.
- */
-
- CSRIAPI csri_inst *csri_open_mem(csri_rend *renderer,
- const void *data, size_t length, struct csri_openflag *flags);
-
- /** close a renderer instance.
- * \param inst the instance handle.
- */
- CSRIAPI void csri_close(csri_inst *inst);
-
-
- /** query / set the image format and size.
- * \param inst the renderer instance handle
- * \param fmt the format and image size to be used
- * \return 0 if the format was successfully set,
- * any other value in case of error.
- */
- CSRIAPI int csri_request_fmt(csri_inst *inst, const struct csri_fmt *fmt);
-
- /** render a single frame
- * \param inst the renderer instance handle
- * \param frame frame data to render to
- * \param time associated timestamp of the frame
- */
- CSRIAPI void csri_render(csri_inst *inst, struct csri_frame *frame,
- double time);
-
-
- /** query for an extension.
- * \param rend the renderer handle
- * \param extname the extension's identifier
- * \return NULL if the extension is not supported,
- * a pointer to extension-specific data otherwise
- *
- * The data pointed to by the return value does not neccessarily need to
- * have any meaning; An extension that does not need to return data
- * can return a pointer to whatever it wants, as long as that pointer is
- * not NULL.
- *
- * In the usual case, the pointer is supposed to point to a struct with
- * function pointers and other information as needed.
- */
- CSRIAPI void *csri_query_ext(csri_rend *rend, csri_ext_id extname);
-
- /*@}*/
-
- /** \defgroup loader CSRI loader API.
- *
- * These functions locate renderers based on given parameters.
- *
- * <b>Renderers must implement these functions as well.</b>
- *
- * They are used by the library to grab renderer information
- * from a shared object; and also this way a single renderer
- * can be linked directly into an appliaction.
- */
- /*@{*/
-
- /** get renderer information
- * \param rend the renderer handle
- * \return information about the renderer, or NULL in case the renderer
- * encountered an internal error.
- */
- CSRIAPI struct csri_info *csri_renderer_info(csri_rend *rend);
-
- /** try to load a given renderer
- * \param name the name of the renderer, as in csri_info.name
- * \param specific the specific version of the renderer,
- * as in csri_info.specific;\n
- * alternatively NULL if any version of the renderer is ok.
- * \return a handle to the renderer if it was successfully loaded,
- * NULL otherwise.
- */
- CSRIAPI csri_rend *csri_renderer_byname(const char *name,
- const char *specific);
-
- /** try to find an implementation of the given extensions.
- * \param next number of extensions pointed to by ext
- * \param ext array of extensions to search for
- * \return a handle to a renderer supporting ALL of the
- * extensions, NULL if none was found.
- */
- CSRIAPI csri_rend *csri_renderer_byext(unsigned n_ext, csri_ext_id *ext);
-
- /** get the default (highest priority) renderer
- * \return a handle to the default renderer, or NULL if
- * no renderer is installed.
- *
- * Together with csri_renderer_next(), this can be used
- * to enumerate all installed renderers.
- */
- CSRIAPI csri_rend *csri_renderer_default();
-
- /** get the next lower priority renderer
- * \param prev the current renderer
- * \return the renderer with the next lower priority than
- * the one named in prev, or NULL if prev is the last
- * renderer installed.
- */
- CSRIAPI csri_rend *csri_renderer_next(csri_rend *prev);
-
- /*@}*/
+/** renderer description.
+ * \ingroup loader
+ */
+struct csri_info {
+ /** an identifier for the renderer.
+ * - MUST match the regular expression
+ * \code ^[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])? \endcode
+ * i.e. consists only of letters, numbers and underscores;
+ * must start with a letter and doesnt have an underscore
+ * as the last character.
+ */
+ const char *name;
+ /** an identifier to the exact version of the renderer.
+ * most likely a version number or revision identifier.
+ *
+ * The helper library does a strcmp over this field in order
+ * to order multiple instances of the same renderer. Use
+ * higher-byte-value strings for newer renderers.
+ */
+ const char *specific;
+
+ /** a nice name to be presented to the user */
+ const char *longname;
+ /** the renderer's author */
+ const char *author;
+ /** a copyright string. Copyright (c) 2042 by Mr. Nice Guy */
+ const char *copyright;
+};
+
+/** data of extension-dependent type.
+ * The field to be used MUST be specified in the extension where it is used.
+ */
+union csri_vardata {
+ long lval;
+ double dval;
+ const char *utf8val;
+ void *otherval;
+};
+
+/** extension identifier.
+ * This follows reverse DNS syntax, i.e.:
+ * \code root.branch.leaf \endcode
+ * you can either reverse a registered domain name, e.g.
+ * \code com.microsoft.csri.usegdiplus \endcode
+ * or ask the CSRI maintainers to assign a namespace to you.
+ *
+ * currently registered namespaces are:
+ *
+ * \code
+ * csri.* - official extensions
+ * asa.* - custom extensions of the asa renderer
+ * \endcode
+ */
+typedef const char *csri_ext_id;
+
+/** script loading parameters.
+ * each flag MUST have an associated extension, which can be queried
+ * with csri_query_ext(). If the open flag constitutes an extension on its
+ * sole own, csri_query_ext() can return a meaningless non-NULL value for
+ * it.
+ *
+ * The data field used must be specified.
+ *
+ * An extension can have multiple flags. In that case, the flags should have
+ * the extension name as common prefix, separated with a dot.
+ *
+ * A renderer MUST ignore unknown open flags. It MUST NOT return an error
+ * just because it does not support a particular flag.
+ */
+struct csri_openflag {
+ /** flag name */
+ csri_ext_id name;
+ /** flag data argument */
+ union csri_vardata data;
+ /** link to next flag */
+ struct csri_openflag *next;
+};
+
+/** load a script from a file.
+ * \param renderer the handle to the renderer
+ * \param filename the path to the file to be loaded. \n
+ * The filename should be encoded as UTF-8. Windows renderers are
+ * expected to convert it to UTF-16 and use the Unicode Windows API
+ * functions.
+ * \param flags a linked list of open flags. \n
+ * The caller manages memory allocation, i.e. static allocation is OK.
+ * \return the renderer instance handle, or NULL on error.
+ */
+CSRIAPI csri_inst *csri_open_file(csri_rend *renderer,
+ const char *filename, struct csri_openflag *flags);
+
+/** load a script from memory.
+ * \param renderer the handle to the renderer
+ * \param data pointer to the first data byte. \n
+ * The caller manages memory allocation and should free the data after
+ * calling csri_open_mem(). If the renderer needs to keep the data, it
+ * must copy it. \n
+ * The renderer is not allowed to write to the data.
+ * \param length length, in bytes, of the data
+ * \param flags see csri_open_file()
+ * \return the render instance handle, or NULL on error.
+ */
+
+CSRIAPI csri_inst *csri_open_mem(csri_rend *renderer,
+ const void *data, size_t length, struct csri_openflag *flags);
+
+/** close a renderer instance.
+ * \param inst the instance handle.
+ */
+CSRIAPI void csri_close(csri_inst *inst);
+
+
+/** query / set the image format and size.
+ * \param inst the renderer instance handle
+ * \param fmt the format and image size to be used
+ * \return 0 if the format was successfully set,
+ * any other value in case of error.
+ */
+CSRIAPI int csri_request_fmt(csri_inst *inst, const struct csri_fmt *fmt);
+
+/** render a single frame
+ * \param inst the renderer instance handle
+ * \param frame frame data to render to
+ * \param time associated timestamp of the frame
+ */
+CSRIAPI void csri_render(csri_inst *inst, struct csri_frame *frame,
+ double time);
+
+
+/** query for an extension.
+ * \param rend the renderer handle
+ * \param extname the extension's identifier
+ * \return NULL if the extension is not supported,
+ * a pointer to extension-specific data otherwise
+ *
+ * The data pointed to by the return value does not neccessarily need to
+ * have any meaning; An extension that does not need to return data
+ * can return a pointer to whatever it wants, as long as that pointer is
+ * not NULL.
+ *
+ * In the usual case, the pointer is supposed to point to a struct with
+ * function pointers and other information as needed.
+ */
+CSRIAPI void *csri_query_ext(csri_rend *rend, csri_ext_id extname);
+
+/*@}*/
+
+/** \defgroup loader CSRI loader API.
+ *
+ * These functions locate renderers based on given parameters.
+ *
+ * <b>Renderers must implement these functions as well.</b>
+ *
+ * They are used by the library to grab renderer information
+ * from a shared object; and also this way a single renderer
+ * can be linked directly into an appliaction.
+ */
+/*@{*/
+
+/** get renderer information
+ * \param rend the renderer handle
+ * \return information about the renderer, or NULL in case the renderer
+ * encountered an internal error.
+ */
+CSRIAPI struct csri_info *csri_renderer_info(csri_rend *rend);
+
+/** try to load a given renderer
+ * \param name the name of the renderer, as in csri_info.name
+ * \param specific the specific version of the renderer,
+ * as in csri_info.specific;\n
+ * alternatively NULL if any version of the renderer is ok.
+ * \return a handle to the renderer if it was successfully loaded,
+ * NULL otherwise.
+ */
+CSRIAPI csri_rend *csri_renderer_byname(const char *name,
+ const char *specific);
+
+/** try to find an implementation of the given extensions.
+ * \param next number of extensions pointed to by ext
+ * \param ext array of extensions to search for
+ * \return a handle to a renderer supporting ALL of the
+ * extensions, NULL if none was found.
+ */
+CSRIAPI csri_rend *csri_renderer_byext(unsigned n_ext, csri_ext_id *ext);
+
+/** get the default (highest priority) renderer
+ * \return a handle to the default renderer, or NULL if
+ * no renderer is installed.
+ *
+ * Together with csri_renderer_next(), this can be used
+ * to enumerate all installed renderers.
+ */
+CSRIAPI csri_rend *csri_renderer_default();
+
+/** get the next lower priority renderer
+ * \param prev the current renderer
+ * \return the renderer with the next lower priority than
+ * the one named in prev, or NULL if prev is the last
+ * renderer installed.
+ */
+CSRIAPI csri_rend *csri_renderer_next(csri_rend *prev);
+
+/*@}*/
#ifdef __cplusplus
}
diff --git a/src/filters/transform/vsfilter/csriapi.cpp b/src/filters/transform/vsfilter/csriapi.cpp
index 93c75c2bb..c10bd9b19 100644
--- a/src/filters/transform/vsfilter/csriapi.cpp
+++ b/src/filters/transform/vsfilter/csriapi.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2007 Niels Martin Hansen
* http://aegisub.net/
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -31,15 +31,14 @@
#define CSRIAPI extern "C" __declspec(dllexport)
#define CSRI_OWN_HANDLES
typedef const char *csri_rend;
-extern "C" struct csri_vsfilter_inst
-{
- CRenderedTextSubtitle *rts;
- CCritSec *cs;
- CSize script_res;
- CSize screen_res;
- CRect video_rect;
- enum csri_pixfmt pixfmt;
- size_t readorder;
+extern "C" struct csri_vsfilter_inst {
+ CRenderedTextSubtitle *rts;
+ CCritSec *cs;
+ CSize script_res;
+ CSize screen_res;
+ CRect video_rect;
+ enum csri_pixfmt pixfmt;
+ size_t readorder;
};
typedef struct csri_vsfilter_inst csri_inst;
#include "csri.h"
@@ -51,202 +50,193 @@ static csri_rend csri_vsfilter = "vsfilter";
CSRIAPI csri_inst *csri_open_file(csri_rend *renderer, const char *filename, struct csri_openflag *flags)
{
- int namesize;
- wchar_t *namebuf;
-
- namesize = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
- if(!namesize)
- return 0;
- namesize++;
- namebuf = new wchar_t[namesize];
- MultiByteToWideChar(CP_UTF8, 0, filename, -1, namebuf, namesize);
-
- csri_inst *inst = new csri_inst();
- inst->cs = new CCritSec();
- inst->rts = new CRenderedTextSubtitle(inst->cs);
- if(inst->rts->Open(CString(namebuf), DEFAULT_CHARSET))
- {
- delete[] namebuf;
- inst->readorder = 0;
- return inst;
- }
- else
- {
- delete[] namebuf;
- delete inst->rts;
- delete inst->cs;
- delete inst;
- return 0;
- }
+ int namesize;
+ wchar_t *namebuf;
+
+ namesize = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
+ if (!namesize)
+ return 0;
+ namesize++;
+ namebuf = new wchar_t[namesize];
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, namebuf, namesize);
+
+ csri_inst *inst = new csri_inst();
+ inst->cs = new CCritSec();
+ inst->rts = new CRenderedTextSubtitle(inst->cs);
+ if (inst->rts->Open(CString(namebuf), DEFAULT_CHARSET)) {
+ delete[] namebuf;
+ inst->readorder = 0;
+ return inst;
+ } else {
+ delete[] namebuf;
+ delete inst->rts;
+ delete inst->cs;
+ delete inst;
+ return 0;
+ }
}
CSRIAPI csri_inst *csri_open_mem(csri_rend *renderer, const void *data, size_t length, struct csri_openflag *flags)
{
- // This is actually less effecient than opening a file, since this first writes the memory data to a temp file,
- // then opens that file and parses from that.
- csri_inst *inst = new csri_inst();
- inst->cs = new CCritSec();
- inst->rts = new CRenderedTextSubtitle(inst->cs);
- if(inst->rts->Open((BYTE*)data, (int)length, DEFAULT_CHARSET, _T("CSRI memory subtitles")))
- {
- inst->readorder = 0;
- return inst;
- }
- else
- {
- delete inst->rts;
- delete inst->cs;
- delete inst;
- return 0;
- }
+ // This is actually less effecient than opening a file, since this first writes the memory data to a temp file,
+ // then opens that file and parses from that.
+ csri_inst *inst = new csri_inst();
+ inst->cs = new CCritSec();
+ inst->rts = new CRenderedTextSubtitle(inst->cs);
+ if (inst->rts->Open((BYTE*)data, (int)length, DEFAULT_CHARSET, _T("CSRI memory subtitles"))) {
+ inst->readorder = 0;
+ return inst;
+ } else {
+ delete inst->rts;
+ delete inst->cs;
+ delete inst;
+ return 0;
+ }
}
CSRIAPI void csri_close(csri_inst *inst)
{
- if(!inst) return;
+ if (!inst) return;
- delete inst->rts;
- delete inst->cs;
- delete inst;
+ delete inst->rts;
+ delete inst->cs;
+ delete inst;
}
CSRIAPI int csri_request_fmt(csri_inst *inst, const struct csri_fmt *fmt)
{
- if(!inst) return -1;
-
- if(!fmt->width || !fmt->height)
- return -1;
-
- // Check if pixel format is supported
- switch(fmt->pixfmt)
- {
- case CSRI_F_BGR_:
- case CSRI_F_BGR:
- case CSRI_F_YUY2:
- case CSRI_F_YV12:
- inst->pixfmt = fmt->pixfmt;
- break;
-
- default:
- return -1;
- }
- inst->screen_res = CSize(fmt->width, fmt->height);
- inst->video_rect = CRect(0, 0, fmt->width, fmt->height);
- return 0;
+ if (!inst) return -1;
+
+ if (!fmt->width || !fmt->height)
+ return -1;
+
+ // Check if pixel format is supported
+ switch (fmt->pixfmt) {
+ case CSRI_F_BGR_:
+ case CSRI_F_BGR:
+ case CSRI_F_YUY2:
+ case CSRI_F_YV12:
+ inst->pixfmt = fmt->pixfmt;
+ break;
+
+ default:
+ return -1;
+ }
+ inst->screen_res = CSize(fmt->width, fmt->height);
+ inst->video_rect = CRect(0, 0, fmt->width, fmt->height);
+ return 0;
}
CSRIAPI void csri_render(csri_inst *inst, struct csri_frame *frame, double time)
{
- const double arbitrary_framerate = 25.0;
- SubPicDesc spd;
- spd.w = inst->screen_res.cx;
- spd.h = inst->screen_res.cy;
- switch(inst->pixfmt)
- {
- case CSRI_F_BGR_:
- spd.type = MSP_RGB32;
- spd.bpp = 32;
- spd.bits = frame->planes[0];
- spd.pitch = frame->strides[0];
- break;
-
- case CSRI_F_BGR:
- spd.type = MSP_RGB24;
- spd.bpp = 24;
- spd.bits = frame->planes[0];
- spd.pitch = frame->strides[0];
- break;
-
- case CSRI_F_YUY2:
- spd.type = MSP_YUY2;
- spd.bpp = 16;
- spd.bits = frame->planes[0];
- spd.pitch = frame->strides[0];
- break;
-
- case CSRI_F_YV12:
- spd.type = MSP_YV12;
- spd.bpp = 12;
- spd.bits = frame->planes[0];
- spd.bitsU = frame->planes[1];
- spd.bitsV = frame->planes[2];
- spd.pitch = frame->strides[0];
- spd.pitchUV = frame->strides[1];
- break;
-
- default:
- // eh?
- return;
- }
- spd.vidrect = inst->video_rect;
-
- inst->rts->Render(spd, (REFERENCE_TIME)(time * 10000000), arbitrary_framerate, inst->video_rect);
+ const double arbitrary_framerate = 25.0;
+ SubPicDesc spd;
+ spd.w = inst->screen_res.cx;
+ spd.h = inst->screen_res.cy;
+ switch (inst->pixfmt) {
+ case CSRI_F_BGR_:
+ spd.type = MSP_RGB32;
+ spd.bpp = 32;
+ spd.bits = frame->planes[0];
+ spd.pitch = frame->strides[0];
+ break;
+
+ case CSRI_F_BGR:
+ spd.type = MSP_RGB24;
+ spd.bpp = 24;
+ spd.bits = frame->planes[0];
+ spd.pitch = frame->strides[0];
+ break;
+
+ case CSRI_F_YUY2:
+ spd.type = MSP_YUY2;
+ spd.bpp = 16;
+ spd.bits = frame->planes[0];
+ spd.pitch = frame->strides[0];
+ break;
+
+ case CSRI_F_YV12:
+ spd.type = MSP_YV12;
+ spd.bpp = 12;
+ spd.bits = frame->planes[0];
+ spd.bitsU = frame->planes[1];
+ spd.bitsV = frame->planes[2];
+ spd.pitch = frame->strides[0];
+ spd.pitchUV = frame->strides[1];
+ break;
+
+ default:
+ // eh?
+ return;
+ }
+ spd.vidrect = inst->video_rect;
+
+ inst->rts->Render(spd, (REFERENCE_TIME)(time*10000000), arbitrary_framerate, inst->video_rect);
}
// No extensions supported
CSRIAPI void *csri_query_ext(csri_rend *rend, csri_ext_id extname)
{
- return 0;
+ return 0;
}
// Get info for renderer
-static struct csri_info csri_vsfilter_info =
-{
+static struct csri_info csri_vsfilter_info = {
#ifdef _DEBUG
-#ifdef _VSMOD
- "vsfiltermod_textsub_debug", // name
+ #ifdef _VSMOD
+ "vsfiltermod_textsub_debug", // name
+ #else
+ "vsfilter_textsub_debug", // name
+ #endif
+ "2.39", // version (assumed version number, svn revision, patchlevel)
#else
- "vsfilter_textsub_debug", // name
-#endif
- "2.39", // version (assumed version number, svn revision, patchlevel)
-#else
-#ifdef _VSMOD
- "vsfiltermod_textsub", // name
-#else
- "vsfilter_textsub", // name
-#endif
- "2.39", // version (assumed version number, svn revision, patchlevel)
+ #ifdef _VSMOD
+ "vsfiltermod_textsub", // name
+ #else
+ "vsfilter_textsub", // name
+ #endif
+ "2.39", // version (assumed version number, svn revision, patchlevel)
#endif
- // 2.38-0611 is base svn 611
- // 2.38-0611-1 is with clipfix and fax/fay patch
- // 2.38-0611-2 adds CSRI
- // 2.38-0611-3 fixes a bug in CSRI and adds fontcrash-fix and float-pos
- // 2.38-0611-4 fixes be1-dots and ugly-fade bugs and adds xbord/ybord/xshad/yshad/blur tags and extends be
- // 2.39 merges with guliverkli2 fork
+ // 2.38-0611 is base svn 611
+ // 2.38-0611-1 is with clipfix and fax/fay patch
+ // 2.38-0611-2 adds CSRI
+ // 2.38-0611-3 fixes a bug in CSRI and adds fontcrash-fix and float-pos
+ // 2.38-0611-4 fixes be1-dots and ugly-fade bugs and adds xbord/ybord/xshad/yshad/blur tags and extends be
+ // 2.39 merges with guliverkli2 fork
#ifdef _VSMOD
- "VSFilterMod/TextSub (guliverkli2)", // longname
+ "VSFilterMod/TextSub (guliverkli2)", // longname
#else
- "VSFilter/TextSub (guliverkli2)", // longname
+ "VSFilter/TextSub (guliverkli2)", // longname
#endif
- "Gabest", // author
- "Copyright (c) 2003-2008 by Gabest and others" // copyright
+ "Gabest", // author
+ "Copyright (c) 2003-2008 by Gabest and others" // copyright
};
CSRIAPI struct csri_info *csri_renderer_info(csri_rend *rend)
{
- return &csri_vsfilter_info;
+ return &csri_vsfilter_info;
}
// Only one supported, obviously
CSRIAPI csri_rend *csri_renderer_byname(const char *name, const char *specific)
{
- if(strcmp(name, csri_vsfilter_info.name))
- return 0;
- if(specific && strcmp(specific, csri_vsfilter_info.specific))
- return 0;
- return &csri_vsfilter;
+ if (strcmp(name, csri_vsfilter_info.name))
+ return 0;
+ if (specific && strcmp(specific, csri_vsfilter_info.specific))
+ return 0;
+ return &csri_vsfilter;
}
// Still just one
CSRIAPI csri_rend *csri_renderer_default()
{
- return &csri_vsfilter;
+ return &csri_vsfilter;
}
// And no further
CSRIAPI csri_rend *csri_renderer_next(csri_rend *prev)
{
- return 0;
+ return 0;
}
diff --git a/src/filters/transform/vsfilter/plugins.cpp b/src/filters/transform/vsfilter/plugins.cpp
index e77b9ed9f..b62c67d7b 100644
--- a/src/filters/transform/vsfilter/plugins.cpp
+++ b/src/filters/transform/vsfilter/plugins.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
@@ -27,7 +27,7 @@
#include "../../../subtitles/RTS.h"
#include "../../../subtitles/SSF.h"
#include "../../../SubPic/MemSubPic.h"
-#include "vfr.h"
+#include "vfr.h"
//
// Generic interface
@@ -39,217 +39,200 @@ namespace Plugin
class CFilter : public CAMThread, public CCritSec
{
private:
- CString m_fn;
+ CString m_fn;
protected:
- float m_fps;
- CCritSec m_csSubLock;
- CComPtr<ISubPicQueue> m_pSubPicQueue;
- CComPtr<ISubPicProvider> m_pSubPicProvider;
- DWORD_PTR m_SubPicProviderId;
+ float m_fps;
+ CCritSec m_csSubLock;
+ CComPtr<ISubPicQueue> m_pSubPicQueue;
+ CComPtr<ISubPicProvider> m_pSubPicProvider;
+ DWORD_PTR m_SubPicProviderId;
public:
- CFilter() : m_fps(-1), m_SubPicProviderId(0)
- {
- CAMThread::Create();
- }
- virtual ~CFilter()
- {
- CAMThread::CallWorker(0);
- }
-
- CString GetFileName()
- {
- CAutoLock cAutoLock(this);
- return m_fn;
- }
- void SetFileName(CString fn)
- {
- CAutoLock cAutoLock(this);
- m_fn = fn;
- }
-
- bool Render(SubPicDesc& dst, REFERENCE_TIME rt, float fps)
- {
- if(!m_pSubPicProvider)
- return(false);
-
- CSize size(dst.w, dst.h);
-
- if(!m_pSubPicQueue)
- {
- CComPtr<ISubPicAllocator> pAllocator = new CMemSubPicAllocator(dst.type, size);
-
- HRESULT hr;
- if(!(m_pSubPicQueue = new CSubPicQueueNoThread(pAllocator, &hr)) || FAILED(hr))
- {
- m_pSubPicQueue = NULL;
- return(false);
- }
- }
-
- if(m_SubPicProviderId != (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider)
- {
- m_pSubPicQueue->SetSubPicProvider(m_pSubPicProvider);
- m_SubPicProviderId = (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider;
- }
-
- CComPtr<ISubPic> pSubPic;
- if(!m_pSubPicQueue->LookupSubPic(rt, pSubPic))
- return(false);
-
- CRect r;
- pSubPic->GetDirtyRect(r);
-
- if(dst.type == MSP_RGB32 || dst.type == MSP_RGB24 || dst.type == MSP_RGB16 || dst.type == MSP_RGB15)
- dst.h = -dst.h;
-
- pSubPic->AlphaBlt(r, r, &dst);
-
- return(true);
- }
-
- DWORD ThreadProc()
- {
- SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST);
-
- CAtlArray<HANDLE> handles;
- handles.Add(GetRequestHandle());
-
- CString fn = GetFileName();
- CFileStatus fs;
- fs.m_mtime = 0;
- CFileGetStatus(fn, fs);
-
- while(1)
- {
- DWORD i = WaitForMultipleObjects(handles.GetCount(), handles.GetData(), FALSE, 1000);
-
- if(WAIT_OBJECT_0 == i)
- {
- Reply(S_OK);
- break;
- }
- else if(WAIT_OBJECT_0 + 1 >= i && i <= WAIT_OBJECT_0 + handles.GetCount())
- {
- if(FindNextChangeNotification(handles[i - WAIT_OBJECT_0]))
- {
- CFileStatus fs2;
- fs2.m_mtime = 0;
- CFileGetStatus(fn, fs2);
-
- if(fs.m_mtime < fs2.m_mtime)
- {
- fs.m_mtime = fs2.m_mtime;
-
- if(CComQIPtr<ISubStream> pSubStream = m_pSubPicProvider)
- {
- CAutoLock cAutoLock(&m_csSubLock);
- pSubStream->Reload();
- }
- }
- }
- }
- else if(WAIT_TIMEOUT == i)
- {
- CString fn2 = GetFileName();
-
- if(fn != fn2)
- {
- CPath p(fn2);
- p.RemoveFileSpec();
- HANDLE h = FindFirstChangeNotification(p, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
- if(h != INVALID_HANDLE_VALUE)
- {
- fn = fn2;
- handles.SetCount(1);
- handles.Add(h);
- }
- }
- }
- else // if(WAIT_ABANDONED_0 == i || WAIT_FAILED == i)
- {
- break;
- }
- }
-
- m_hThread = 0;
-
- for(ptrdiff_t i = 1; i < handles.GetCount(); i++)
- FindCloseChangeNotification(handles[i]);
-
- return 0;
- }
+ CFilter() : m_fps(-1), m_SubPicProviderId(0) {CAMThread::Create();}
+ virtual ~CFilter() {CAMThread::CallWorker(0);}
+
+ CString GetFileName() {CAutoLock cAutoLock(this); return m_fn;}
+ void SetFileName(CString fn) {CAutoLock cAutoLock(this); m_fn = fn;}
+
+ bool Render(SubPicDesc& dst, REFERENCE_TIME rt, float fps)
+ {
+ if(!m_pSubPicProvider)
+ return(false);
+
+ CSize size(dst.w, dst.h);
+
+ if(!m_pSubPicQueue)
+ {
+ CComPtr<ISubPicAllocator> pAllocator = new CMemSubPicAllocator(dst.type, size);
+
+ HRESULT hr;
+ if(!(m_pSubPicQueue = new CSubPicQueueNoThread(pAllocator, &hr)) || FAILED(hr))
+ {
+ m_pSubPicQueue = NULL;
+ return(false);
+ }
+ }
+
+ if(m_SubPicProviderId != (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider)
+ {
+ m_pSubPicQueue->SetSubPicProvider(m_pSubPicProvider);
+ m_SubPicProviderId = (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider;
+ }
+
+ CComPtr<ISubPic> pSubPic;
+ if(!m_pSubPicQueue->LookupSubPic(rt, pSubPic))
+ return(false);
+
+ CRect r;
+ pSubPic->GetDirtyRect(r);
+
+ if(dst.type == MSP_RGB32 || dst.type == MSP_RGB24 || dst.type == MSP_RGB16 || dst.type == MSP_RGB15)
+ dst.h = -dst.h;
+
+ pSubPic->AlphaBlt(r, r, &dst);
+
+ return(true);
+ }
+
+ DWORD ThreadProc()
+ {
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST);
+
+ CAtlArray<HANDLE> handles;
+ handles.Add(GetRequestHandle());
+
+ CString fn = GetFileName();
+ CFileStatus fs;
+ fs.m_mtime = 0;
+ CFileGetStatus(fn, fs);
+
+ while(1)
+ {
+ DWORD i = WaitForMultipleObjects(handles.GetCount(), handles.GetData(), FALSE, 1000);
+
+ if(WAIT_OBJECT_0 == i)
+ {
+ Reply(S_OK);
+ break;
+ }
+ else if(WAIT_OBJECT_0 + 1 >= i && i <= WAIT_OBJECT_0 + handles.GetCount())
+ {
+ if(FindNextChangeNotification(handles[i - WAIT_OBJECT_0]))
+ {
+ CFileStatus fs2;
+ fs2.m_mtime = 0;
+ CFileGetStatus(fn, fs2);
+
+ if(fs.m_mtime < fs2.m_mtime)
+ {
+ fs.m_mtime = fs2.m_mtime;
+
+ if(CComQIPtr<ISubStream> pSubStream = m_pSubPicProvider)
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pSubStream->Reload();
+ }
+ }
+ }
+ }
+ else if(WAIT_TIMEOUT == i)
+ {
+ CString fn2 = GetFileName();
+
+ if(fn != fn2)
+ {
+ CPath p(fn2);
+ p.RemoveFileSpec();
+ HANDLE h = FindFirstChangeNotification(p, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ fn = fn2;
+ handles.SetCount(1);
+ handles.Add(h);
+ }
+ }
+ }
+ else // if(WAIT_ABANDONED_0 == i || WAIT_FAILED == i)
+ {
+ break;
+ }
+ }
+
+ m_hThread = 0;
+
+ for(ptrdiff_t i = 1; i < handles.GetCount(); i++)
+ FindCloseChangeNotification(handles[i]);
+
+ return 0;
+ }
};
class CVobSubFilter : virtual public CFilter
{
public:
- CVobSubFilter(CString fn = _T(""))
- {
- if(!fn.IsEmpty()) Open(fn);
- }
-
- bool Open(CString fn)
- {
- SetFileName(_T(""));
- m_pSubPicProvider = NULL;
-
- if(CVobSubFile* vsf = new CVobSubFile(&m_csSubLock))
- {
- m_pSubPicProvider = (ISubPicProvider*)vsf;
- if(vsf->Open(CString(fn))) SetFileName(fn);
- else m_pSubPicProvider = NULL;
- }
-
- return !!m_pSubPicProvider;
- }
+ CVobSubFilter(CString fn = _T(""))
+ {
+ if(!fn.IsEmpty()) Open(fn);
+ }
+
+ bool Open(CString fn)
+ {
+ SetFileName(_T(""));
+ m_pSubPicProvider = NULL;
+
+ if(CVobSubFile* vsf = new CVobSubFile(&m_csSubLock))
+ {
+ m_pSubPicProvider = (ISubPicProvider*)vsf;
+ if(vsf->Open(CString(fn))) SetFileName(fn);
+ else m_pSubPicProvider = NULL;
+ }
+
+ return !!m_pSubPicProvider;
+ }
};
class CTextSubFilter : virtual public CFilter
{
- int m_CharSet;
+ int m_CharSet;
public:
- CTextSubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET, float fps = -1)
- : m_CharSet(CharSet)
- {
- m_fps = fps;
- if(!fn.IsEmpty()) Open(fn, CharSet);
- }
-
- int GetCharSet()
- {
- return(m_CharSet);
- }
-
- bool Open(CString fn, int CharSet = DEFAULT_CHARSET)
- {
- SetFileName(_T(""));
- m_pSubPicProvider = NULL;
-
- if(!m_pSubPicProvider)
- {
- if(ssf::CRenderer* ssf = new ssf::CRenderer(&m_csSubLock))
- {
- m_pSubPicProvider = (ISubPicProvider*)ssf;
- if(ssf->Open(CString(fn))) SetFileName(fn);
- else m_pSubPicProvider = NULL;
- }
- }
-
- if(!m_pSubPicProvider)
- {
- if(CRenderedTextSubtitle* rts = new CRenderedTextSubtitle(&m_csSubLock))
- {
- m_pSubPicProvider = (ISubPicProvider*)rts;
- if(rts->Open(CString(fn), CharSet)) SetFileName(fn);
- else m_pSubPicProvider = NULL;
- }
- }
-
- return !!m_pSubPicProvider;
- }
+ CTextSubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET, float fps = -1)
+ : m_CharSet(CharSet)
+ {
+ m_fps = fps;
+ if(!fn.IsEmpty()) Open(fn, CharSet);
+ }
+
+ int GetCharSet() {return(m_CharSet);}
+
+ bool Open(CString fn, int CharSet = DEFAULT_CHARSET)
+ {
+ SetFileName(_T(""));
+ m_pSubPicProvider = NULL;
+
+ if(!m_pSubPicProvider)
+ {
+ if(ssf::CRenderer* ssf = new ssf::CRenderer(&m_csSubLock))
+ {
+ m_pSubPicProvider = (ISubPicProvider*)ssf;
+ if(ssf->Open(CString(fn))) SetFileName(fn);
+ else m_pSubPicProvider = NULL;
+ }
+ }
+
+ if(!m_pSubPicProvider)
+ {
+ if(CRenderedTextSubtitle* rts = new CRenderedTextSubtitle(&m_csSubLock))
+ {
+ m_pSubPicProvider = (ISubPicProvider*)rts;
+ if(rts->Open(CString(fn), CharSet)) SetFileName(fn);
+ else m_pSubPicProvider = NULL;
+ }
+ }
+
+ return !!m_pSubPicProvider;
+ }
};
#ifndef WIN64
@@ -259,268 +242,264 @@ public:
namespace VirtualDub
{
-//#include <VirtualDub\VirtualDub.h>
-//#include <vd2/OldFilterSDK/VirtualDub.h>
-#include <vd2/extras/FilterSDK/VirtualDub.h>
-
-class CVirtualDubFilter : virtual public CFilter
-{
-public:
- CVirtualDubFilter() {}
- virtual ~CVirtualDubFilter() {}
-
- virtual int RunProc(const FilterActivation* fa, const FilterFunctions* ff)
- {
- SubPicDesc dst;
- dst.type = MSP_RGB32;
- dst.w = fa->src.w;
- dst.h = fa->src.h;
- dst.bpp = 32;
- dst.pitch = fa->src.pitch;
- dst.bits = (LPVOID)fa->src.data;
-
- Render(dst, 10000i64 * fa->pfsi->lSourceFrameMS, (float)1000 / fa->pfsi->lMicrosecsPerFrame);
-
- return 0;
- }
-
- virtual long ParamProc(FilterActivation* fa, const FilterFunctions* ff)
- {
- fa->dst.offset = fa->src.offset;
- fa->dst.modulo = fa->src.modulo;
- fa->dst.pitch = fa->src.pitch;
-
- return 0;
- }
-
- virtual int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd) = 0;
- virtual void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str) = 0;
- virtual bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen) = 0;
-};
-
-class CVobSubVirtualDubFilter : public CVobSubFilter, public CVirtualDubFilter
-{
-public:
- CVobSubVirtualDubFilter(CString fn = _T(""))
- : CVobSubFilter(fn) {}
-
- int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY,
- _T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle(hwnd), 0);
-
- if(fd.DoModal() != IDOK) return 1;
-
- return Open(fd.GetPathName()) ? 0 : 1;
- }
-
- void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
- {
- sprintf(str, " (%s)", !GetFileName().IsEmpty() ? CStringA(GetFileName()) : " (empty)");
- }
-
- bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
- {
- CStringA fn(GetFileName());
- fn.Replace("\\", "\\\\");
- _snprintf(buf, buflen, "Config(\"%s\")", fn);
- return(true);
- }
-};
-
-class CTextSubVirtualDubFilter : public CTextSubFilter, public CVirtualDubFilter
-{
-public:
- CTextSubVirtualDubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET)
- : CTextSubFilter(fn, CharSet) {}
-
- int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
- CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK,
- formats, CWnd::FromHandle(hwnd), sizeof(OPENFILENAME));
- //OPENFILENAME_SIZE_VERSION_400 /*0* /);
- UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
-
- fd.m_pOFN->hInstance = AfxGetResourceHandle();
- fd.m_pOFN->lpTemplateName = MAKEINTRESOURCE(IDD_TEXTSUBOPENTEMPLATE);
- fd.m_pOFN->lpfnHook = (LPOFNHOOKPROC)OpenHookProc;
- fd.m_pOFN->lCustData = (LPARAM)DEFAULT_CHARSET;
-
- if(fd.DoModal() != IDOK) return 1;
-
- return Open(fd.GetPathName(), fd.m_pOFN->lCustData) ? 0 : 1;
- }
-
- void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
- {
- if(!GetFileName().IsEmpty()) sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
- else sprintf(str, " (empty)");
- }
-
- bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
- {
- CStringA fn(GetFileName());
- fn.Replace("\\", "\\\\");
- _snprintf(buf, buflen, "Config(\"%s\", %d)", fn, GetCharSet());
- return(true);
- }
-};
-
-int vobsubInitProc(FilterActivation* fa, const FilterFunctions* ff)
-{
- return !(*(CVirtualDubFilter**)fa->filter_data = new CVobSubVirtualDubFilter());
-}
-
-int textsubInitProc(FilterActivation* fa, const FilterFunctions* ff)
-{
- return !(*(CVirtualDubFilter**)fa->filter_data = new CTextSubVirtualDubFilter());
-}
-
-void baseDeinitProc(FilterActivation* fa, const FilterFunctions* ff)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) delete f, f = NULL;
-}
-
-int baseRunProc(const FilterActivation* fa, const FilterFunctions* ff)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->RunProc(fa, ff) : 1;
-}
-
-long baseParamProc(FilterActivation* fa, const FilterFunctions* ff)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->ParamProc(fa, ff) : 1;
-}
-
-int baseConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->ConfigProc(fa, ff, hwnd) : 1;
-}
-
-void baseStringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) f->StringProc(fa, ff, str);
-}
-
-bool baseFssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->FssProc(fa, ff, buf, buflen) : false;
-}
-
-void vobsubScriptConfig(IScriptInterpreter* isi, void* lpVoid, CScriptValue* argv, int argc)
-{
- FilterActivation* fa = (FilterActivation*)lpVoid;
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) delete f;
- f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
- *(CVirtualDubFilter**)fa->filter_data = f;
-}
-
-void textsubScriptConfig(IScriptInterpreter* isi, void* lpVoid, CScriptValue* argv, int argc)
-{
- FilterActivation* fa = (FilterActivation*)lpVoid;
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) delete f;
- f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
- *(CVirtualDubFilter**)fa->filter_data = f;
-}
-
-ScriptFunctionDef vobsub_func_defs[] =
-{
- { (ScriptFunctionPtr)vobsubScriptConfig, "Config", "0s" },
- { NULL },
-};
-
-CScriptObject vobsub_obj =
-{
- NULL, vobsub_func_defs
-};
-
-struct FilterDefinition filterDef_vobsub =
-{
- NULL, NULL, NULL, // next, prev, module
- "VobSub", // name
- "Adds subtitles from a vob sequence.", // desc
- "Gabest", // maker
- NULL, // private_data
- sizeof(CVirtualDubFilter**), // inst_data_size
- vobsubInitProc, // initProc
- baseDeinitProc, // deinitProc
- baseRunProc, // runProc
- baseParamProc, // paramProc
- baseConfigProc, // configProc
- baseStringProc, // stringProc
- NULL, // startProc
- NULL, // endProc
- &vobsub_obj, // script_obj
- baseFssProc, // fssProc
-};
-
-ScriptFunctionDef textsub_func_defs[] =
-{
- { (ScriptFunctionPtr)textsubScriptConfig, "Config", "0si" },
- { NULL },
-};
-
-CScriptObject textsub_obj =
-{
- NULL, textsub_func_defs
-};
-
-struct FilterDefinition filterDef_textsub =
-{
- NULL, NULL, NULL, // next, prev, module
+ //#include <VirtualDub\VirtualDub.h>
+ //#include <vd2/OldFilterSDK/VirtualDub.h>
+ #include <vd2/extras/FilterSDK/VirtualDub.h>
+
+ class CVirtualDubFilter : virtual public CFilter
+ {
+ public:
+ CVirtualDubFilter() {}
+ virtual ~CVirtualDubFilter() {}
+
+ virtual int RunProc(const FilterActivation* fa, const FilterFunctions* ff)
+ {
+ SubPicDesc dst;
+ dst.type = MSP_RGB32;
+ dst.w = fa->src.w;
+ dst.h = fa->src.h;
+ dst.bpp = 32;
+ dst.pitch = fa->src.pitch;
+ dst.bits = (LPVOID)fa->src.data;
+
+ Render(dst, 10000i64*fa->pfsi->lSourceFrameMS, (float)1000 / fa->pfsi->lMicrosecsPerFrame);
+
+ return 0;
+ }
+
+ virtual long ParamProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ fa->dst.offset = fa->src.offset;
+ fa->dst.modulo = fa->src.modulo;
+ fa->dst.pitch = fa->src.pitch;
+
+ return 0;
+ }
+
+ virtual int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd) = 0;
+ virtual void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str) = 0;
+ virtual bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen) = 0;
+ };
+
+ class CVobSubVirtualDubFilter : public CVobSubFilter, public CVirtualDubFilter
+ {
+ public:
+ CVobSubVirtualDubFilter(CString fn = _T(""))
+ : CVobSubFilter(fn) {}
+
+ int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ _T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle(hwnd), 0);
+
+ if(fd.DoModal() != IDOK) return 1;
+
+ return Open(fd.GetPathName()) ? 0 : 1;
+ }
+
+ void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
+ {
+ sprintf(str, " (%s)", !GetFileName().IsEmpty() ? CStringA(GetFileName()) : " (empty)");
+ }
+
+ bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
+ {
+ CStringA fn(GetFileName());
+ fn.Replace("\\", "\\\\");
+ _snprintf(buf, buflen, "Config(\"%s\")", fn);
+ return(true);
+ }
+ };
+
+ class CTextSubVirtualDubFilter : public CTextSubFilter, public CVirtualDubFilter
+ {
+ public:
+ CTextSubVirtualDubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET)
+ : CTextSubFilter(fn, CharSet) {}
+
+ int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK,
+ formats, CWnd::FromHandle(hwnd), sizeof(OPENFILENAME));
+ //OPENFILENAME_SIZE_VERSION_400 /*0* /);
+ UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+
+ fd.m_pOFN->hInstance = AfxGetResourceHandle();
+ fd.m_pOFN->lpTemplateName = MAKEINTRESOURCE(IDD_TEXTSUBOPENTEMPLATE);
+ fd.m_pOFN->lpfnHook = (LPOFNHOOKPROC)OpenHookProc;
+ fd.m_pOFN->lCustData = (LPARAM)DEFAULT_CHARSET;
+
+ if(fd.DoModal() != IDOK) return 1;
+
+ return Open(fd.GetPathName(), fd.m_pOFN->lCustData) ? 0 : 1;
+ }
+
+ void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
+ {
+ if(!GetFileName().IsEmpty()) sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
+ else sprintf(str, " (empty)");
+ }
+
+ bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
+ {
+ CStringA fn(GetFileName());
+ fn.Replace("\\", "\\\\");
+ _snprintf(buf, buflen, "Config(\"%s\", %d)", fn, GetCharSet());
+ return(true);
+ }
+ };
+
+ int vobsubInitProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ return !(*(CVirtualDubFilter**)fa->filter_data = new CVobSubVirtualDubFilter());
+ }
+
+ int textsubInitProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ return !(*(CVirtualDubFilter**)fa->filter_data = new CTextSubVirtualDubFilter());
+ }
+
+ void baseDeinitProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f, f = NULL;
+ }
+
+ int baseRunProc(const FilterActivation* fa, const FilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->RunProc(fa, ff) : 1;
+ }
+
+ long baseParamProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->ParamProc(fa, ff) : 1;
+ }
+
+ int baseConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->ConfigProc(fa, ff, hwnd) : 1;
+ }
+
+ void baseStringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) f->StringProc(fa, ff, str);
+ }
+
+ bool baseFssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->FssProc(fa, ff, buf, buflen) : false;
+ }
+
+ void vobsubScriptConfig(IScriptInterpreter* isi, void* lpVoid, CScriptValue* argv, int argc)
+ {
+ FilterActivation* fa = (FilterActivation*)lpVoid;
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f;
+ f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
+ *(CVirtualDubFilter**)fa->filter_data = f;
+ }
+
+ void textsubScriptConfig(IScriptInterpreter* isi, void* lpVoid, CScriptValue* argv, int argc)
+ {
+ FilterActivation* fa = (FilterActivation*)lpVoid;
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f;
+ f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
+ *(CVirtualDubFilter**)fa->filter_data = f;
+ }
+
+ ScriptFunctionDef vobsub_func_defs[]={
+ { (ScriptFunctionPtr)vobsubScriptConfig, "Config", "0s" },
+ { NULL },
+ };
+
+ CScriptObject vobsub_obj={
+ NULL, vobsub_func_defs
+ };
+
+ struct FilterDefinition filterDef_vobsub =
+ {
+ NULL, NULL, NULL, // next, prev, module
+ "VobSub", // name
+ "Adds subtitles from a vob sequence.", // desc
+ "Gabest", // maker
+ NULL, // private_data
+ sizeof(CVirtualDubFilter**), // inst_data_size
+ vobsubInitProc, // initProc
+ baseDeinitProc, // deinitProc
+ baseRunProc, // runProc
+ baseParamProc, // paramProc
+ baseConfigProc, // configProc
+ baseStringProc, // stringProc
+ NULL, // startProc
+ NULL, // endProc
+ &vobsub_obj, // script_obj
+ baseFssProc, // fssProc
+ };
+
+ ScriptFunctionDef textsub_func_defs[]={
+ { (ScriptFunctionPtr)textsubScriptConfig, "Config", "0si" },
+ { NULL },
+ };
+
+ CScriptObject textsub_obj={
+ NULL, textsub_func_defs
+ };
+
+ struct FilterDefinition filterDef_textsub =
+ {
+ NULL, NULL, NULL, // next, prev, module
#ifdef _VSMOD
- "TextSubMod", // name
+ "TextSubMod", // name
#else
- "TextSub", // name
+ "TextSub", // name
#endif
- "Adds subtitles from srt, sub, psb, smi, ssa, ass file formats.", // desc
- "Gabest", // maker
- NULL, // private_data
- sizeof(CVirtualDubFilter**), // inst_data_size
- textsubInitProc, // initProc
- baseDeinitProc, // deinitProc
- baseRunProc, // runProc
- baseParamProc, // paramProc
- baseConfigProc, // configProc
- baseStringProc, // stringProc
- NULL, // startProc
- NULL, // endProc
- &textsub_obj, // script_obj
- baseFssProc, // fssProc
-};
-
-static FilterDefinition* fd_vobsub;
-static FilterDefinition* fd_textsub;
-
-extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
-{
- if(!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(FilterDefinition)))
- || !(fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(FilterDefinition))))
- return 1;
-
- vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION;
- vdfd_compat = VIRTUALDUB_FILTERDEF_COMPATIBLE;
-
- return 0;
-}
-
-extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(FilterModule *fm, const FilterFunctions *ff)
-{
- ff->removeFilter(fd_textsub);
- ff->removeFilter(fd_vobsub);
-}
+ "Adds subtitles from srt, sub, psb, smi, ssa, ass file formats.", // desc
+ "Gabest", // maker
+ NULL, // private_data
+ sizeof(CVirtualDubFilter**), // inst_data_size
+ textsubInitProc, // initProc
+ baseDeinitProc, // deinitProc
+ baseRunProc, // runProc
+ baseParamProc, // paramProc
+ baseConfigProc, // configProc
+ baseStringProc, // stringProc
+ NULL, // startProc
+ NULL, // endProc
+ &textsub_obj, // script_obj
+ baseFssProc, // fssProc
+ };
+
+ static FilterDefinition* fd_vobsub;
+ static FilterDefinition* fd_textsub;
+
+ extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
+ {
+ if(!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(FilterDefinition)))
+ || !(fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(FilterDefinition))))
+ return 1;
+
+ vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION;
+ vdfd_compat = VIRTUALDUB_FILTERDEF_COMPATIBLE;
+
+ return 0;
+ }
+
+ extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(FilterModule *fm, const FilterFunctions *ff)
+ {
+ ff->removeFilter(fd_textsub);
+ ff->removeFilter(fd_vobsub);
+ }
}/**/
#else
@@ -529,273 +508,269 @@ extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(Filte
//
namespace VirtualDubNew
{
-#include <vd2/plugin/vdplugin.h>
-#include <vd2/plugin/vdvideofilt.h>
-
-class CVirtualDubFilter : virtual public CFilter
-{
-public:
- CVirtualDubFilter() {}
- virtual ~CVirtualDubFilter() {}
-
- virtual int RunProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff)
- {
- SubPicDesc dst;
- dst.type = MSP_RGB32;
- dst.w = fa->src.w;
- dst.h = fa->src.h;
- dst.bpp = 32;
- dst.pitch = fa->src.pitch;
- dst.bits = (LPVOID)fa->src.data;
-
- Render(dst, 10000i64 * fa->pfsi->lSourceFrameMS, (float)1000 / fa->pfsi->lMicrosecsPerFrame);
-
- return 0;
- }
-
- virtual long ParamProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
- {
- fa->dst.offset = fa->src.offset;
- fa->dst.modulo = fa->src.modulo;
- fa->dst.pitch = fa->src.pitch;
-
- return 0;
- }
-
- virtual int ConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd) = 0;
- virtual void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str) = 0;
- virtual bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen) = 0;
-};
-
-class CVobSubVirtualDubFilter : public CVobSubFilter, public CVirtualDubFilter
-{
-public:
- CVobSubVirtualDubFilter(CString fn = _T(""))
- : CVobSubFilter(fn) {}
-
- int ConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY,
- _T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle((HWND)hwnd), 0);
-
- if(fd.DoModal() != IDOK) return 1;
-
- return Open(fd.GetPathName()) ? 0 : 1;
- }
-
- void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
- {
- sprintf(str, " (%s)", !GetFileName().IsEmpty() ? CStringA(GetFileName()) : " (empty)");
- }
-
- bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen)
- {
- CStringA fn(GetFileName());
- fn.Replace("\\", "\\\\");
- _snprintf(buf, buflen, "Config(\"%s\")", fn);
- return(true);
- }
-};
-
-class CTextSubVirtualDubFilter : public CTextSubFilter, public CVirtualDubFilter
-{
-public:
- CTextSubVirtualDubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET)
- : CTextSubFilter(fn, CharSet) {}
-
- int ConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- /* off encoding changing */
+ #include <vd2/plugin/vdplugin.h>
+ #include <vd2/plugin/vdvideofilt.h>
+
+ class CVirtualDubFilter : virtual public CFilter
+ {
+ public:
+ CVirtualDubFilter() {}
+ virtual ~CVirtualDubFilter() {}
+
+ virtual int RunProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ SubPicDesc dst;
+ dst.type = MSP_RGB32;
+ dst.w = fa->src.w;
+ dst.h = fa->src.h;
+ dst.bpp = 32;
+ dst.pitch = fa->src.pitch;
+ dst.bits = (LPVOID)fa->src.data;
+
+ Render(dst, 10000i64*fa->pfsi->lSourceFrameMS, (float)1000 / fa->pfsi->lMicrosecsPerFrame);
+
+ return 0;
+ }
+
+ virtual long ParamProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ fa->dst.offset = fa->src.offset;
+ fa->dst.modulo = fa->src.modulo;
+ fa->dst.pitch = fa->src.pitch;
+
+ return 0;
+ }
+
+ virtual int ConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd) = 0;
+ virtual void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str) = 0;
+ virtual bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen) = 0;
+ };
+
+ class CVobSubVirtualDubFilter : public CVobSubFilter, public CVirtualDubFilter
+ {
+ public:
+ CVobSubVirtualDubFilter(CString fn = _T(""))
+ : CVobSubFilter(fn) {}
+
+ int ConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ _T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle((HWND)hwnd), 0);
+
+ if(fd.DoModal() != IDOK) return 1;
+
+ return Open(fd.GetPathName()) ? 0 : 1;
+ }
+
+ void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
+ {
+ sprintf(str, " (%s)", !GetFileName().IsEmpty() ? CStringA(GetFileName()) : " (empty)");
+ }
+
+ bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen)
+ {
+ CStringA fn(GetFileName());
+ fn.Replace("\\", "\\\\");
+ _snprintf(buf, buflen, "Config(\"%s\")", fn);
+ return(true);
+ }
+ };
+
+ class CTextSubVirtualDubFilter : public CTextSubFilter, public CVirtualDubFilter
+ {
+ public:
+ CTextSubVirtualDubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET)
+ : CTextSubFilter(fn, CharSet) {}
+
+ int ConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ /* off encoding changing */
#ifndef _DEBUG
- const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
- CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK,
- formats, CWnd::FromHandle((HWND)hwnd), sizeof(OPENFILENAME));
- //OPENFILENAME_SIZE_VERSION_400 /*0*/);
- UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
-
- fd.m_pOFN->hInstance = AfxGetResourceHandle();
- fd.m_pOFN->lpTemplateName = MAKEINTRESOURCE(IDD_TEXTSUBOPENTEMPLATE);
- fd.m_pOFN->lpfnHook = (LPOFNHOOKPROC)OpenHookProc;
- fd.m_pOFN->lCustData = (LPARAM)DEFAULT_CHARSET;
+ const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK,
+ formats, CWnd::FromHandle((HWND)hwnd), sizeof(OPENFILENAME));
+ //OPENFILENAME_SIZE_VERSION_400 /*0*/);
+ UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+
+ fd.m_pOFN->hInstance = AfxGetResourceHandle();
+ fd.m_pOFN->lpTemplateName = MAKEINTRESOURCE(IDD_TEXTSUBOPENTEMPLATE);
+ fd.m_pOFN->lpfnHook = (LPOFNHOOKPROC)OpenHookProc;
+ fd.m_pOFN->lCustData = (LPARAM)DEFAULT_CHARSET;
#else
-const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
-CFileDialog fd(TRUE, NULL, GetFileName(), OFN_ENABLESIZING | OFN_HIDEREADONLY,
- formats, CWnd::FromHandle((HWND)hwnd), sizeof(OPENFILENAME));
+ const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ formats, CWnd::FromHandle((HWND)hwnd), sizeof(OPENFILENAME));
#endif
- if(fd.DoModal() != IDOK) return 1;
-
- return Open(fd.GetPathName(), fd.m_pOFN->lCustData) ? 0 : 1;
- }
-
- void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
- {
- if(!GetFileName().IsEmpty()) sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
- else sprintf(str, " (empty)");
- }
-
- bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen)
- {
- CStringA fn(GetFileName());
- fn.Replace("\\", "\\\\");
- _snprintf(buf, buflen, "Config(\"%s\", %d)", fn, GetCharSet());
- return(true);
- }
-};
-
-int vobsubInitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
-{
- return !(*(CVirtualDubFilter**)fa->filter_data = new CVobSubVirtualDubFilter());
-}
-
-int textsubInitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
-{
- return !(*(CVirtualDubFilter**)fa->filter_data = new CTextSubVirtualDubFilter());
-}
-
-void baseDeinitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) delete f, f = NULL;
-}
-
-int baseRunProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->RunProc(fa, ff) : 1;
-}
-
-long baseParamProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->ParamProc(fa, ff) : 1;
-}
-
-int baseConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->ConfigProc(fa, ff, hwnd) : 1;
-}
-
-void baseStringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) f->StringProc(fa, ff, str);
-}
-
-bool baseFssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen)
-{
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- return f ? f->FssProc(fa, ff, buf, buflen) : false;
-}
-
-void vobsubScriptConfig(IVDXScriptInterpreter* isi, void* lpVoid, VDXScriptValue* argv, int argc)
-{
- VDXFilterActivation* fa = (VDXFilterActivation*)lpVoid;
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) delete f;
- f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
- *(CVirtualDubFilter**)fa->filter_data = f;
-}
-
-void textsubScriptConfig(IVDXScriptInterpreter* isi, void* lpVoid, VDXScriptValue* argv, int argc)
-{
- VDXFilterActivation* fa = (VDXFilterActivation*)lpVoid;
- CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
- if(f) delete f;
- f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
- *(CVirtualDubFilter**)fa->filter_data = f;
-}
-
-VDXScriptFunctionDef vobsub_func_defs[] =
-{
- { (VDXScriptFunctionPtr)vobsubScriptConfig, "Config", "0s" },
- { NULL },
-};
-
-VDXScriptObject vobsub_obj =
-{
- NULL, vobsub_func_defs
-};
-
-struct VDXFilterDefinition filterDef_vobsub =
-{
- NULL, NULL, NULL, // next, prev, module
- "VobSub", // name
- "Adds subtitles from a vob sequence.", // desc
- "Gabest", // maker
- NULL, // private_data
- sizeof(CVirtualDubFilter**), // inst_data_size
- vobsubInitProc, // initProc
- baseDeinitProc, // deinitProc
- baseRunProc, // runProc
- baseParamProc, // paramProc
- baseConfigProc, // configProc
- baseStringProc, // stringProc
- NULL, // startProc
- NULL, // endProc
- &vobsub_obj, // script_obj
- baseFssProc, // fssProc
-};
-
-VDXScriptFunctionDef textsub_func_defs[] =
-{
- { (VDXScriptFunctionPtr)textsubScriptConfig, "Config", "0si" },
- { NULL },
-};
-
-VDXScriptObject textsub_obj =
-{
- NULL, textsub_func_defs
-};
-
-struct VDXFilterDefinition filterDef_textsub =
-{
- NULL, NULL, NULL, // next, prev, module
+ if(fd.DoModal() != IDOK) return 1;
+
+ return Open(fd.GetPathName(), fd.m_pOFN->lCustData) ? 0 : 1;
+ }
+
+ void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
+ {
+ if(!GetFileName().IsEmpty()) sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
+ else sprintf(str, " (empty)");
+ }
+
+ bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen)
+ {
+ CStringA fn(GetFileName());
+ fn.Replace("\\", "\\\\");
+ _snprintf(buf, buflen, "Config(\"%s\", %d)", fn, GetCharSet());
+ return(true);
+ }
+ };
+
+ int vobsubInitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ return !(*(CVirtualDubFilter**)fa->filter_data = new CVobSubVirtualDubFilter());
+ }
+
+ int textsubInitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ return !(*(CVirtualDubFilter**)fa->filter_data = new CTextSubVirtualDubFilter());
+ }
+
+ void baseDeinitProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f, f = NULL;
+ }
+
+ int baseRunProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->RunProc(fa, ff) : 1;
+ }
+
+ long baseParamProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->ParamProc(fa, ff) : 1;
+ }
+
+ int baseConfigProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, VDXHWND hwnd)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->ConfigProc(fa, ff, hwnd) : 1;
+ }
+
+ void baseStringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) f->StringProc(fa, ff, str);
+ }
+
+ bool baseFssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->FssProc(fa, ff, buf, buflen) : false;
+ }
+
+ void vobsubScriptConfig(IVDXScriptInterpreter* isi, void* lpVoid, VDXScriptValue* argv, int argc)
+ {
+ VDXFilterActivation* fa = (VDXFilterActivation*)lpVoid;
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f;
+ f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
+ *(CVirtualDubFilter**)fa->filter_data = f;
+ }
+
+ void textsubScriptConfig(IVDXScriptInterpreter* isi, void* lpVoid, VDXScriptValue* argv, int argc)
+ {
+ VDXFilterActivation* fa = (VDXFilterActivation*)lpVoid;
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f;
+ f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
+ *(CVirtualDubFilter**)fa->filter_data = f;
+ }
+
+ VDXScriptFunctionDef vobsub_func_defs[]={
+ { (VDXScriptFunctionPtr)vobsubScriptConfig, "Config", "0s" },
+ { NULL },
+ };
+
+ VDXScriptObject vobsub_obj={
+ NULL, vobsub_func_defs
+ };
+
+ struct VDXFilterDefinition filterDef_vobsub =
+ {
+ NULL, NULL, NULL, // next, prev, module
+ "VobSub", // name
+ "Adds subtitles from a vob sequence.", // desc
+ "Gabest", // maker
+ NULL, // private_data
+ sizeof(CVirtualDubFilter**), // inst_data_size
+ vobsubInitProc, // initProc
+ baseDeinitProc, // deinitProc
+ baseRunProc, // runProc
+ baseParamProc, // paramProc
+ baseConfigProc, // configProc
+ baseStringProc, // stringProc
+ NULL, // startProc
+ NULL, // endProc
+ &vobsub_obj, // script_obj
+ baseFssProc, // fssProc
+ };
+
+ VDXScriptFunctionDef textsub_func_defs[]={
+ { (VDXScriptFunctionPtr)textsubScriptConfig, "Config", "0si" },
+ { NULL },
+ };
+
+ VDXScriptObject textsub_obj={
+ NULL, textsub_func_defs
+ };
+
+ struct VDXFilterDefinition filterDef_textsub =
+ {
+ NULL, NULL, NULL, // next, prev, module
#ifdef _VSMOD
- "TextSubMod", // name
+ "TextSubMod", // name
#else
-"TextSub", // name
+ "TextSub", // name
#endif
- "Adds subtitles from srt, sub, psb, smi, ssa, ass file formats.", // desc
- "Gabest", // maker
- NULL, // private_data
- sizeof(CVirtualDubFilter**), // inst_data_size
- textsubInitProc, // initProc
- baseDeinitProc, // deinitProc
- baseRunProc, // runProc
- baseParamProc, // paramProc
- baseConfigProc, // configProc
- baseStringProc, // stringProc
- NULL, // startProc
- NULL, // endProc
- &textsub_obj, // script_obj
- baseFssProc, // fssProc
-};
-
-static VDXFilterDefinition* fd_vobsub;
-static VDXFilterDefinition* fd_textsub;
-
-extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(VDXFilterModule *fm, const VDXFilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
-{
- if(!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(VDXFilterDefinition)))
- || !(fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(VDXFilterDefinition))))
- return 1;
-
- vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION;
- vdfd_compat = VIRTUALDUB_FILTERDEF_COMPATIBLE;
-
- return 0;
-}
-
-extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(VDXFilterModule *fm, const VDXFilterFunctions *ff)
-{
- ff->removeFilter(fd_textsub);
- ff->removeFilter(fd_vobsub);
-}
+ "Adds subtitles from srt, sub, psb, smi, ssa, ass file formats.", // desc
+ "Gabest", // maker
+ NULL, // private_data
+ sizeof(CVirtualDubFilter**), // inst_data_size
+ textsubInitProc, // initProc
+ baseDeinitProc, // deinitProc
+ baseRunProc, // runProc
+ baseParamProc, // paramProc
+ baseConfigProc, // configProc
+ baseStringProc, // stringProc
+ NULL, // startProc
+ NULL, // endProc
+ &textsub_obj, // script_obj
+ baseFssProc, // fssProc
+ };
+
+ static VDXFilterDefinition* fd_vobsub;
+ static VDXFilterDefinition* fd_textsub;
+
+ extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(VDXFilterModule *fm, const VDXFilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
+ {
+ if(!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(VDXFilterDefinition)))
+ || !(fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(VDXFilterDefinition))))
+ return 1;
+
+ vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION;
+ vdfd_compat = VIRTUALDUB_FILTERDEF_COMPATIBLE;
+
+ return 0;
+ }
+
+ extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(VDXFilterModule *fm, const VDXFilterFunctions *ff)
+ {
+ ff->removeFilter(fd_textsub);
+ ff->removeFilter(fd_vobsub);
+ }
}
#endif
//
@@ -804,349 +779,345 @@ extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(VDXFi
namespace AviSynth1
{
-#include <avisynth\avisynth1.h>
-
-class CAvisynthFilter : public GenericVideoFilter, virtual public CFilter
-{
-public:
- CAvisynthFilter(PClip c, IScriptEnvironment* env) : GenericVideoFilter(c) {}
-
- PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
- {
- PVideoFrame frame = child->GetFrame(n, env);
-
- env->MakeWritable(&frame);
-
- SubPicDesc dst;
- dst.w = vi.width;
- dst.h = vi.height;
- dst.pitch = frame->GetPitch();
- dst.bits = (void**)frame->GetWritePtr();
- dst.bpp = vi.BitsPerPixel();
- dst.type =
- vi.IsRGB32() ? (env->GetVar("RGBA").AsBool() ? MSP_RGBA : MSP_RGB32) :
- vi.IsRGB24() ? MSP_RGB24 :
- vi.IsYUY2() ? MSP_YUY2 :
- -1;
-
- float fps = m_fps > 0 ? m_fps : (float)vi.fps_numerator / vi.fps_denominator;
-
- Render(dst, (REFERENCE_TIME)(10000000i64 * n / fps), fps);
-
- return(frame);
- }
-};
-
-class CVobSubAvisynthFilter : public CVobSubFilter, public CAvisynthFilter
-{
-public:
- CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
- : CVobSubFilter(CString(fn))
- , CAvisynthFilter(c, env)
- {
- if(!m_pSubPicProvider)
- env->ThrowError("VobSub: Can't open \"%s\"", fn);
- }
-};
-
-AVSValue __cdecl VobSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- return(new CVobSubAvisynthFilter(args[0].AsClip(), args[1].AsString(), env));
-}
-
-class CTextSubAvisynthFilter : public CTextSubFilter, public CAvisynthFilter
-{
-public:
- CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1)
- : CTextSubFilter(CString(fn), CharSet, fps)
- , CAvisynthFilter(c, env)
- {
- if(!m_pSubPicProvider)
+ #include <avisynth\avisynth1.h>
+
+ class CAvisynthFilter : public GenericVideoFilter, virtual public CFilter
+ {
+ public:
+ CAvisynthFilter(PClip c, IScriptEnvironment* env) : GenericVideoFilter(c) {}
+
+ PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
+ {
+ PVideoFrame frame = child->GetFrame(n, env);
+
+ env->MakeWritable(&frame);
+
+ SubPicDesc dst;
+ dst.w = vi.width;
+ dst.h = vi.height;
+ dst.pitch = frame->GetPitch();
+ dst.bits = (void**)frame->GetWritePtr();
+ dst.bpp = vi.BitsPerPixel();
+ dst.type =
+ vi.IsRGB32() ? ( env->GetVar("RGBA").AsBool() ? MSP_RGBA :MSP_RGB32) :
+ vi.IsRGB24() ? MSP_RGB24 :
+ vi.IsYUY2() ? MSP_YUY2 :
+ -1;
+
+ float fps = m_fps > 0 ? m_fps : (float)vi.fps_numerator / vi.fps_denominator;
+
+ Render(dst, (REFERENCE_TIME)(10000000i64 * n / fps), fps);
+
+ return(frame);
+ }
+ };
+
+ class CVobSubAvisynthFilter : public CVobSubFilter, public CAvisynthFilter
+ {
+ public:
+ CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
+ : CVobSubFilter(CString(fn))
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
+ env->ThrowError("VobSub: Can't open \"%s\"", fn);
+ }
+ };
+
+ AVSValue __cdecl VobSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CVobSubAvisynthFilter(args[0].AsClip(), args[1].AsString(), env));
+ }
+
+ class CTextSubAvisynthFilter : public CTextSubFilter, public CAvisynthFilter
+ {
+ public:
+ CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1)
+ : CTextSubFilter(CString(fn), CharSet, fps)
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
#ifdef _VSMOD
- env->ThrowError("TextSubMod: Can't open \"%s\"", fn);
+ env->ThrowError("TextSubMod: Can't open \"%s\"", fn);
#else
- env->ThrowError("TextSub: Can't open \"%s\"", fn);
+ env->ThrowError("TextSub: Can't open \"%s\"", fn);
#endif
- }
-};
-
-AVSValue __cdecl TextSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString()));
-}
-
-AVSValue __cdecl TextSubCreateSI(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt()));
-}
-
-AVSValue __cdecl TextSubCreateSIF(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt(), args[3].AsFloat()));
-}
-
-AVSValue __cdecl MaskSubCreateSIIFI(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- AVSValue rgb32("RGB32");
- AVSValue tab[5] =
- {
- args[1],
- args[2],
- args[3],
- args[4],
- rgb32
- };
- AVSValue value(tab, 5);
- const char * nom[5] =
- {
- "width",
- "height",
- "fps",
- "length",
- "pixel_type"
- };
- AVSValue clip(env->Invoke("Blackness", value, nom));
- env->SetVar(env->SaveString("RGBA"), true);
- return(new CTextSubAvisynthFilter(clip.AsClip(), env, args[0].AsString()));
-}
-
-extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit(IScriptEnvironment* env)
-{
- env->AddFunction("VobSub", "cs", VobSubCreateS, 0);
+ }
+ };
+
+ AVSValue __cdecl TextSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString()));
+ }
+
+ AVSValue __cdecl TextSubCreateSI(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt()));
+ }
+
+ AVSValue __cdecl TextSubCreateSIF(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt(), args[3].AsFloat()));
+ }
+
+ AVSValue __cdecl MaskSubCreateSIIFI(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ AVSValue rgb32("RGB32");
+ AVSValue tab[5] = {
+ args[1],
+ args[2],
+ args[3],
+ args[4],
+ rgb32
+ };
+ AVSValue value(tab,5);
+ const char * nom[5]={
+ "width",
+ "height",
+ "fps",
+ "length",
+ "pixel_type"
+ };
+ AVSValue clip(env->Invoke("Blackness",value,nom));
+ env->SetVar(env->SaveString("RGBA"),true);
+ return(new CTextSubAvisynthFilter(clip.AsClip(), env, args[0].AsString()));
+ }
+
+ extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit(IScriptEnvironment* env)
+ {
+ env->AddFunction("VobSub", "cs", VobSubCreateS, 0);
#ifdef _VSMOD
- env->AddFunction("TextSubMod", "cs", TextSubCreateS, 0);
- env->AddFunction("TextSubMod", "csi", TextSubCreateSI, 0);
- env->AddFunction("TextSubMod", "csif", TextSubCreateSIF, 0);
- env->AddFunction("MaskSubMod", "siifi", MaskSubCreateSIIFI, 0);
+ env->AddFunction("TextSubMod", "cs", TextSubCreateS, 0);
+ env->AddFunction("TextSubMod", "csi", TextSubCreateSI, 0);
+ env->AddFunction("TextSubMod", "csif", TextSubCreateSIF, 0);
+ env->AddFunction("MaskSubMod", "siifi", MaskSubCreateSIIFI, 0);
#else
- env->AddFunction("TextSub", "cs", TextSubCreateS, 0);
- env->AddFunction("TextSub", "csi", TextSubCreateSI, 0);
- env->AddFunction("TextSub", "csif", TextSubCreateSIF, 0);
- env->AddFunction("MaskSub", "siifi", MaskSubCreateSIIFI, 0);
+ env->AddFunction("TextSub", "cs", TextSubCreateS, 0);
+ env->AddFunction("TextSub", "csi", TextSubCreateSI, 0);
+ env->AddFunction("TextSub", "csif", TextSubCreateSIF, 0);
+ env->AddFunction("MaskSub", "siifi", MaskSubCreateSIIFI, 0);
#endif
- env->SetVar(env->SaveString("RGBA"), false);
- return(NULL);
-}
+ env->SetVar(env->SaveString("RGBA"),false);
+ return(NULL);
+ }
}
namespace AviSynth25
{
-#include <avisynth\avisynth25.h>
-
-static bool s_fSwapUV = false;
-
-class CAvisynthFilter : public GenericVideoFilter, virtual public CFilter
-{
-public:
- VFRTranslator *vfr;
-
- CAvisynthFilter(PClip c, IScriptEnvironment* env, VFRTranslator *_vfr = 0) : GenericVideoFilter(c), vfr(_vfr) {}
-
- PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
- {
- PVideoFrame frame = child->GetFrame(n, env);
-
- env->MakeWritable(&frame);
-
- SubPicDesc dst;
- dst.w = vi.width;
- dst.h = vi.height;
- dst.pitch = frame->GetPitch();
- dst.pitchUV = frame->GetPitch(PLANAR_U);
- dst.bits = (void**)frame->GetWritePtr();
- dst.bitsU = frame->GetWritePtr(PLANAR_U);
- dst.bitsV = frame->GetWritePtr(PLANAR_V);
- dst.bpp = dst.pitch / dst.w * 8; //vi.BitsPerPixel();
- dst.type =
- vi.IsRGB32() ? (env->GetVar("RGBA").AsBool() ? MSP_RGBA : MSP_RGB32) :
- vi.IsRGB24() ? MSP_RGB24 :
- vi.IsYUY2() ? MSP_YUY2 :
- /*vi.IsYV12()*/ vi.pixel_type == VideoInfo::CS_YV12 ? (s_fSwapUV ? MSP_IYUV : MSP_YV12) :
- /*vi.IsIYUV()*/ vi.pixel_type == VideoInfo::CS_IYUV ? (s_fSwapUV ? MSP_YV12 : MSP_IYUV) :
- -1;
-
- float fps = m_fps > 0 ? m_fps : (float)vi.fps_numerator / vi.fps_denominator;
-
- REFERENCE_TIME timestamp;
-
- if(!vfr)
- timestamp = (REFERENCE_TIME)(10000000i64 * n / fps);
- else
- timestamp = (REFERENCE_TIME)(10000000 * vfr->TimeStampFromFrameNumber(n));
-
- Render(dst, timestamp, fps);
-
- return(frame);
- }
-};
-
-class CVobSubAvisynthFilter : public CVobSubFilter, public CAvisynthFilter
-{
-public:
- CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
- : CVobSubFilter(CString(fn))
- , CAvisynthFilter(c, env)
- {
- if(!m_pSubPicProvider)
- env->ThrowError("VobSub: Can't open \"%s\"", fn);
- }
-};
-
-AVSValue __cdecl VobSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- return(new CVobSubAvisynthFilter(args[0].AsClip(), args[1].AsString(), env));
-}
-
-class CTextSubAvisynthFilter : public CTextSubFilter, public CAvisynthFilter
-{
-public:
- CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1, VFRTranslator *vfr = 0) //vfr patch
- : CTextSubFilter(CString(fn), CharSet, fps)
- , CAvisynthFilter(c, env, vfr)
- {
- if(!m_pSubPicProvider)
+ #include <avisynth\avisynth25.h>
+
+ static bool s_fSwapUV = false;
+
+ class CAvisynthFilter : public GenericVideoFilter, virtual public CFilter
+ {
+ public:
+ VFRTranslator *vfr;
+
+ CAvisynthFilter(PClip c, IScriptEnvironment* env, VFRTranslator *_vfr=0) : GenericVideoFilter(c), vfr(_vfr) {}
+
+ PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
+ {
+ PVideoFrame frame = child->GetFrame(n, env);
+
+ env->MakeWritable(&frame);
+
+ SubPicDesc dst;
+ dst.w = vi.width;
+ dst.h = vi.height;
+ dst.pitch = frame->GetPitch();
+ dst.pitchUV = frame->GetPitch(PLANAR_U);
+ dst.bits = (void**)frame->GetWritePtr();
+ dst.bitsU = frame->GetWritePtr(PLANAR_U);
+ dst.bitsV = frame->GetWritePtr(PLANAR_V);
+ dst.bpp = dst.pitch/dst.w*8; //vi.BitsPerPixel();
+ dst.type =
+ vi.IsRGB32() ?( env->GetVar("RGBA").AsBool() ? MSP_RGBA : MSP_RGB32) :
+ vi.IsRGB24() ? MSP_RGB24 :
+ vi.IsYUY2() ? MSP_YUY2 :
+ /*vi.IsYV12()*/ vi.pixel_type == VideoInfo::CS_YV12 ? (s_fSwapUV?MSP_IYUV:MSP_YV12) :
+ /*vi.IsIYUV()*/ vi.pixel_type == VideoInfo::CS_IYUV ? (s_fSwapUV?MSP_YV12:MSP_IYUV) :
+ -1;
+
+ float fps = m_fps > 0 ? m_fps : (float)vi.fps_numerator / vi.fps_denominator;
+
+ REFERENCE_TIME timestamp;
+
+ if (!vfr)
+ timestamp = (REFERENCE_TIME)(10000000i64 * n / fps);
+ else
+ timestamp = (REFERENCE_TIME)(10000000 * vfr->TimeStampFromFrameNumber(n));
+
+ Render(dst, timestamp, fps);
+
+ return(frame);
+ }
+ };
+
+ class CVobSubAvisynthFilter : public CVobSubFilter, public CAvisynthFilter
+ {
+ public:
+ CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
+ : CVobSubFilter(CString(fn))
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
+ env->ThrowError("VobSub: Can't open \"%s\"", fn);
+ }
+ };
+
+ AVSValue __cdecl VobSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CVobSubAvisynthFilter(args[0].AsClip(), args[1].AsString(), env));
+ }
+
+ class CTextSubAvisynthFilter : public CTextSubFilter, public CAvisynthFilter
+ {
+ public:
+ CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1, VFRTranslator *vfr = 0) //vfr patch
+ : CTextSubFilter(CString(fn), CharSet, fps)
+ , CAvisynthFilter(c, env, vfr)
+ {
+ if(!m_pSubPicProvider)
#ifdef _VSMOD
- env->ThrowError("TextSubMod: Can't open \"%s\"", fn);
+ env->ThrowError("TextSubMod: Can't open \"%s\"", fn);
#else
- env->ThrowError("TextSub: Can't open \"%s\"", fn);
+ env->ThrowError("TextSub: Can't open \"%s\"", fn);
#endif
- }
-};
+ }
+ };
-AVSValue __cdecl TextSubCreateGeneral(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- if(!args[1].Defined())
+ AVSValue __cdecl TextSubCreateGeneral(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ if (!args[1].Defined())
#ifdef _VSMOD
- env->ThrowError("TextSubMod: You must specify a subtitle file to use");
+ env->ThrowError("TextSubMod: You must specify a subtitle file to use");
#else
- env->ThrowError("TextSub: You must specify a subtitle file to use");
+ env->ThrowError("TextSub: You must specify a subtitle file to use");
#endif
- VFRTranslator *vfr = 0;
- if(args[4].Defined())
- vfr = GetVFRTranslator(args[4].AsString());
-
- return(new CTextSubAvisynthFilter(
- args[0].AsClip(),
- env,
- args[1].AsString(),
- args[2].AsInt(DEFAULT_CHARSET),
- args[3].AsFloat(-1),
- vfr));
-}
-
-AVSValue __cdecl TextSubSwapUV(AVSValue args, void* user_data, IScriptEnvironment* env)
-{
- s_fSwapUV = args[0].AsBool(false);
- return(AVSValue());
-}
-
-AVSValue __cdecl MaskSubCreate(AVSValue args, void* user_data, IScriptEnvironment* env)/*SIIFI*/
-{
- if(!args[0].Defined())
+ VFRTranslator *vfr = 0;
+ if (args[4].Defined())
+ vfr = GetVFRTranslator(args[4].AsString());
+
+ return(new CTextSubAvisynthFilter(
+ args[0].AsClip(),
+ env,
+ args[1].AsString(),
+ args[2].AsInt(DEFAULT_CHARSET),
+ args[3].AsFloat(-1),
+ vfr));
+ }
+
+ AVSValue __cdecl TextSubSwapUV(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ s_fSwapUV = args[0].AsBool(false);
+ return(AVSValue());
+ }
+
+ AVSValue __cdecl MaskSubCreate(AVSValue args, void* user_data, IScriptEnvironment* env)/*SIIFI*/
+ {
+ if (!args[0].Defined())
#ifdef _VSMOD
- env->ThrowError("MaskSubMod: You must specify a subtitle file to use");
+ env->ThrowError("MaskSubMod: You must specify a subtitle file to use");
#else
- env->ThrowError("MaskSub: You must specify a subtitle file to use");
-#endif
- if(!args[3].Defined() && !args[6].Defined())
+ env->ThrowError("MaskSub: You must specify a subtitle file to use");
+#endif
+ if (!args[3].Defined() && !args[6].Defined())
#ifdef _VSMOD
- env->ThrowError("MaskSubMod: You must specify either FPS or a VFR timecodes file");
+ env->ThrowError("MaskSubMod: You must specify either FPS or a VFR timecodes file");
#else
- env->ThrowError("MaskSub: You must specify either FPS or a VFR timecodes file");
+ env->ThrowError("MaskSub: You must specify either FPS or a VFR timecodes file");
#endif
- VFRTranslator *vfr = 0;
- if(args[6].Defined())
- vfr = GetVFRTranslator(args[6].AsString());
-
- AVSValue rgb32("RGB32");
- AVSValue fps(args[3].AsFloat(25));
- AVSValue tab[6] =
- {
- args[1],
- args[2],
- args[3],
- args[4],
- rgb32
- };
- AVSValue value(tab, 5);
- const char * nom[5] =
- {
- "width",
- "height",
- "fps",
- "length",
- "pixel_type"
- };
- AVSValue clip(env->Invoke("Blackness", value, nom));
- env->SetVar(env->SaveString("RGBA"), true);
- //return(new CTextSubAvisynthFilter(clip.AsClip(), env, args[0].AsString()));
- return(new CTextSubAvisynthFilter(
- clip.AsClip(),
- env,
- args[0].AsString(),
- args[5].AsInt(DEFAULT_CHARSET),
- args[3].AsFloat(-1),
- vfr));
-}
-
-extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env)
-{
- env->AddFunction("VobSub", "cs", VobSubCreateS, 0);
+ VFRTranslator *vfr = 0;
+ if (args[6].Defined())
+ vfr = GetVFRTranslator(args[6].AsString());
+
+ AVSValue rgb32("RGB32");
+ AVSValue fps(args[3].AsFloat(25));
+ AVSValue tab[6] = {
+ args[1],
+ args[2],
+ args[3],
+ args[4],
+ rgb32
+ };
+ AVSValue value(tab,5);
+ const char * nom[5]={
+ "width",
+ "height",
+ "fps",
+ "length",
+ "pixel_type"
+ };
+ AVSValue clip(env->Invoke("Blackness",value,nom));
+ env->SetVar(env->SaveString("RGBA"),true);
+ //return(new CTextSubAvisynthFilter(clip.AsClip(), env, args[0].AsString()));
+ return(new CTextSubAvisynthFilter(
+ clip.AsClip(),
+ env,
+ args[0].AsString(),
+ args[5].AsInt(DEFAULT_CHARSET),
+ args[3].AsFloat(-1),
+ vfr));
+ }
+
+ extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env)
+ {
+ env->AddFunction("VobSub", "cs", VobSubCreateS, 0);
#ifdef _VSMOD
- env->AddFunction("TextSubMod", "c[file]s[charset]i[fps]f[vfr]s", TextSubCreateGeneral, 0);
- env->AddFunction("TextSubModSwapUV", "b", TextSubSwapUV, 0);
- env->AddFunction("MaskSubMod", "[file]s[width]i[height]i[fps]f[length]i[charset]i[vfr]s", MaskSubCreate, 0);
+ env->AddFunction("TextSubMod", "c[file]s[charset]i[fps]f[vfr]s", TextSubCreateGeneral, 0);
+ env->AddFunction("TextSubModSwapUV", "b", TextSubSwapUV, 0);
+ env->AddFunction("MaskSubMod", "[file]s[width]i[height]i[fps]f[length]i[charset]i[vfr]s", MaskSubCreate, 0);
#else
- env->AddFunction("TextSub", "c[file]s[charset]i[fps]f[vfr]s", TextSubCreateGeneral, 0);
- env->AddFunction("TextSubSwapUV", "b", TextSubSwapUV, 0);
- env->AddFunction("MaskSub", "[file]s[width]i[height]i[fps]f[length]i[charset]i[vfr]s", MaskSubCreate, 0);
+ env->AddFunction("TextSub", "c[file]s[charset]i[fps]f[vfr]s", TextSubCreateGeneral, 0);
+ env->AddFunction("TextSubSwapUV", "b", TextSubSwapUV, 0);
+ env->AddFunction("MaskSub", "[file]s[width]i[height]i[fps]f[length]i[charset]i[vfr]s", MaskSubCreate, 0);
#endif
- env->SetVar(env->SaveString("RGBA"), false);
- return(NULL);
-}
+ env->SetVar(env->SaveString("RGBA"),false);
+ return(NULL);
+ }
}
}
UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uiMsg)
- {
- case WM_NOTIFY:
- {
- OPENFILENAME* ofn = ((OFNOTIFY *)lParam)->lpOFN;
-
- if(((NMHDR *)lParam)->code == CDN_FILEOK)
- {
- ofn->lCustData = (LPARAM)CharSetList[SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_GETCURSEL, 0, 0)];
- }
-
- break;
- }
-
- case WM_INITDIALOG:
- {
-#ifdef WIN64
- SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
-#else
- SetWindowLongPtr(hDlg, GWL_USERDATA, lParam);
-#endif
+ switch(uiMsg)
+ {
+ case WM_NOTIFY:
+ {
+ OPENFILENAME* ofn = ((OFNOTIFY *)lParam)->lpOFN;
- for(ptrdiff_t i = 0; i < CharSetLen; i++)
- {
- CString s;
- s.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
- SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_ADDSTRING, 0, (LONG)(LPCTSTR)s);
- if(CharSetList[i] == (int)((OPENFILENAME*)lParam)->lCustData)
- SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_SETCURSEL, i, 0);
- }
+ if(((NMHDR *)lParam)->code == CDN_FILEOK)
+ {
+ ofn->lCustData = (LPARAM)CharSetList[SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_GETCURSEL, 0, 0)];
+ }
- break;
- }
+ break;
+ }
- default:
- break;
- }
+ case WM_INITDIALOG:
+ {
+#ifdef WIN64
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
+#else
+ SetWindowLongPtr(hDlg, GWL_USERDATA, lParam);
+#endif
- return FALSE;
+ for(ptrdiff_t i = 0; i < CharSetLen; i++)
+ {
+ CString s;
+ s.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
+ SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_ADDSTRING, 0, (LONG)(LPCTSTR)s);
+ if(CharSetList[i] == (int)((OPENFILENAME*)lParam)->lCustData)
+ SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_SETCURSEL, i, 0);
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return FALSE;
}
diff --git a/src/filters/transform/vsfilter/resource.h b/src/filters/transform/vsfilter/resource.h
index 923c9efbd..a6441541b 100644
--- a/src/filters/transform/vsfilter/resource.h
+++ b/src/filters/transform/vsfilter/resource.h
@@ -178,7 +178,7 @@
#define IDC_COLORSHAD 1066
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 231
diff --git a/src/filters/transform/vsfilter/stdafx.cpp b/src/filters/transform/vsfilter/stdafx.cpp
index 774edf250..502682104 100644
--- a/src/filters/transform/vsfilter/stdafx.cpp
+++ b/src/filters/transform/vsfilter/stdafx.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/vsfilter/stdafx.h b/src/filters/transform/vsfilter/stdafx.h
index 7e9b4029f..3c6c2a063 100644
--- a/src/filters/transform/vsfilter/stdafx.h
+++ b/src/filters/transform/vsfilter/stdafx.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,15 +6,15 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
diff --git a/src/filters/transform/vsfilter/valami.cpp b/src/filters/transform/vsfilter/valami.cpp
index 3452e4f8d..660feaff0 100644
--- a/src/filters/transform/vsfilter/valami.cpp
+++ b/src/filters/transform/vsfilter/valami.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003-2006 Gabest
* http://www.gabest.org
*
@@ -6,114 +6,114 @@
* 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 GNU Make; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "../../../DSUtil/DSUtil.h"
-static TCHAR str1[][256] =
- /*
- {
- _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9D2935C7-3D8B-4EF6-B0D1-C14064698794}"), // divxg400
- _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{8CE3343E-2289-4BAE-AE57-5106A40AF552}"), // divxg400force
- _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{00A95963-3BE5-48C0-AD9F-3356D67EA09D}"), // ogg sub mixer
- _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{70E102B0-5556-11CE-97C0-00AA0055595A}"), // video renderer (old)
- _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{6BC1CFFA-8FC1-4261-AC22-CFB4CC38DB50}"), // video renderer (vmr)
- };
- */
+static TCHAR str1[][256] =
+/*
{
- {
- 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
- 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
- 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
- 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
- 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
- 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
- 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2b,
- 0x56, 0x20, 0x2b, 0x21, 0x27, 0x51, 0x25, 0x3f,
- 0x21, 0x56, 0x2a, 0x50, 0x3f, 0x26, 0x57, 0x54,
- 0x24, 0x3f, 0x50, 0x22, 0x56, 0x23, 0x3f, 0x51,
- 0x23, 0x26, 0x22, 0x24, 0x26, 0x24, 0x2b, 0x2a,
- 0x25, 0x2b, 0x26, 0x6f, 0x12
- },
- {
- 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
- 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
- 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
- 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
- 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
- 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
- 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2a,
- 0x51, 0x57, 0x21, 0x21, 0x26, 0x21, 0x57, 0x3f,
- 0x20, 0x20, 0x2a, 0x2b, 0x3f, 0x26, 0x50, 0x53,
- 0x57, 0x3f, 0x53, 0x57, 0x27, 0x25, 0x3f, 0x27,
- 0x23, 0x22, 0x24, 0x53, 0x26, 0x22, 0x53, 0x54,
- 0x27, 0x27, 0x20, 0x6f, 0x12
- },
- {
- 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
- 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
- 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
- 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
- 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
- 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
- 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x22,
- 0x22, 0x53, 0x2b, 0x27, 0x2b, 0x24, 0x21, 0x3f,
- 0x21, 0x50, 0x57, 0x27, 0x3f, 0x26, 0x2a, 0x51,
- 0x22, 0x3f, 0x53, 0x56, 0x2b, 0x54, 0x3f, 0x21,
- 0x21, 0x27, 0x24, 0x56, 0x24, 0x25, 0x57, 0x53,
- 0x22, 0x2b, 0x56, 0x6f, 0x12
- },
- {
- 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
- 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
- 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
- 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
- 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
- 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
- 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x25,
- 0x22, 0x57, 0x23, 0x22, 0x20, 0x50, 0x22, 0x3f,
- 0x27, 0x27, 0x27, 0x24, 0x3f, 0x23, 0x23, 0x51,
- 0x57, 0x3f, 0x2b, 0x25, 0x51, 0x22, 0x3f, 0x22,
- 0x22, 0x53, 0x53, 0x22, 0x22, 0x27, 0x27, 0x27,
- 0x2b, 0x27, 0x53, 0x6f, 0x12
- },
- {
- 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
- 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
- 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
- 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
- 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
- 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
- 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x24,
- 0x50, 0x51, 0x23, 0x51, 0x54, 0x54, 0x53, 0x3f,
- 0x2a, 0x54, 0x51, 0x23, 0x3f, 0x26, 0x20, 0x24,
- 0x23, 0x3f, 0x53, 0x51, 0x20, 0x20, 0x3f, 0x51,
- 0x54, 0x50, 0x26, 0x51, 0x51, 0x21, 0x2a, 0x56,
- 0x50, 0x27, 0x22, 0x6f, 0x12
- },
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9D2935C7-3D8B-4EF6-B0D1-C14064698794}"), // divxg400
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{8CE3343E-2289-4BAE-AE57-5106A40AF552}"), // divxg400force
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{00A95963-3BE5-48C0-AD9F-3356D67EA09D}"), // ogg sub mixer
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{70E102B0-5556-11CE-97C0-00AA0055595A}"), // video renderer (old)
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{6BC1CFFA-8FC1-4261-AC22-CFB4CC38DB50}"), // video renderer (vmr)
+};
+*/
+{
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2b,
+ 0x56, 0x20, 0x2b, 0x21, 0x27, 0x51, 0x25, 0x3f,
+ 0x21, 0x56, 0x2a, 0x50, 0x3f, 0x26, 0x57, 0x54,
+ 0x24, 0x3f, 0x50, 0x22, 0x56, 0x23, 0x3f, 0x51,
+ 0x23, 0x26, 0x22, 0x24, 0x26, 0x24, 0x2b, 0x2a,
+ 0x25, 0x2b, 0x26, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2a,
+ 0x51, 0x57, 0x21, 0x21, 0x26, 0x21, 0x57, 0x3f,
+ 0x20, 0x20, 0x2a, 0x2b, 0x3f, 0x26, 0x50, 0x53,
+ 0x57, 0x3f, 0x53, 0x57, 0x27, 0x25, 0x3f, 0x27,
+ 0x23, 0x22, 0x24, 0x53, 0x26, 0x22, 0x53, 0x54,
+ 0x27, 0x27, 0x20, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x22,
+ 0x22, 0x53, 0x2b, 0x27, 0x2b, 0x24, 0x21, 0x3f,
+ 0x21, 0x50, 0x57, 0x27, 0x3f, 0x26, 0x2a, 0x51,
+ 0x22, 0x3f, 0x53, 0x56, 0x2b, 0x54, 0x3f, 0x21,
+ 0x21, 0x27, 0x24, 0x56, 0x24, 0x25, 0x57, 0x53,
+ 0x22, 0x2b, 0x56, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x25,
+ 0x22, 0x57, 0x23, 0x22, 0x20, 0x50, 0x22, 0x3f,
+ 0x27, 0x27, 0x27, 0x24, 0x3f, 0x23, 0x23, 0x51,
+ 0x57, 0x3f, 0x2b, 0x25, 0x51, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x53, 0x22, 0x22, 0x27, 0x27, 0x27,
+ 0x2b, 0x27, 0x53, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x24,
+ 0x50, 0x51, 0x23, 0x51, 0x54, 0x54, 0x53, 0x3f,
+ 0x2a, 0x54, 0x51, 0x23, 0x3f, 0x26, 0x20, 0x24,
+ 0x23, 0x3f, 0x53, 0x51, 0x20, 0x20, 0x3f, 0x51,
+ 0x54, 0x50, 0x26, 0x51, 0x51, 0x21, 0x2a, 0x56,
+ 0x50, 0x27, 0x22, 0x6f, 0x12
+ },
};
static TCHAR str2[] = // _T("FilterData");
{
- 0x72, 0x5d, 0x58, 0x40, 0x51, 0x46, 0x70, 0x55,
- 0x40, 0x55, 0x34,
+ 0x72, 0x5d, 0x58, 0x40, 0x51, 0x46, 0x70, 0x55,
+ 0x40, 0x55, 0x34,
};
static TCHAR str3[] = // _T("FriendlyName");
{
- 0x10, 0x24, 0x3f, 0x33, 0x38, 0x32, 0x3a, 0x2f,
- 0x18, 0x37, 0x3b, 0x33, 0x56,
+ 0x10, 0x24, 0x3f, 0x33, 0x38, 0x32, 0x3a, 0x2f,
+ 0x18, 0x37, 0x3b, 0x33, 0x56,
};
@@ -124,139 +124,139 @@ static TCHAR str3[] = // _T("FriendlyName");
static void dencode()
{
- int i, j;
- for(i = 0; i < LEN1; i++) for(j = 0; j < LEN11; j++) str1[i][j] ^= 0x12;
- for(i = 0; i < LEN2; i++) str2[i] ^= 0x34;
- for(i = 0; i < LEN3; i++) str3[i] ^= 0x56;
+ int i, j;
+ for(i = 0; i < LEN1; i++) for(j = 0; j < LEN11; j++) str1[i][j] ^= 0x12;
+ for(i = 0; i < LEN2; i++) str2[i] ^= 0x34;
+ for(i = 0; i < LEN3; i++) str3[i] ^= 0x56;
}
extern /*const*/ AMOVIESETUP_FILTER sudFilter[2];
void JajDeGonoszVagyok()
{
- dencode();
-
- DWORD mymerit = sudFilter[1].dwMerit;
-
- for(ptrdiff_t i = 0; i < LEN1; i++)
- {
- HKEY hKey;
+ dencode();
- if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
- {
- BYTE* pData = NULL;
- DWORD size = 0;
+ DWORD mymerit = sudFilter[1].dwMerit;
- if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
- {
- pData = new BYTE[size];
+ for(ptrdiff_t i = 0; i < LEN1; i++)
+ {
+ HKEY hKey;
- if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
- {
- DWORD merit = *((DWORD*)(pData + 4));
+ if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ BYTE* pData = NULL;
+ DWORD size = 0;
- if(merit < size_t(-1)) merit++;
+ if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
+ {
+ pData = new BYTE[size];
- if(mymerit < merit)
- mymerit = merit;
- }
+ if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
+ {
+ DWORD merit = *((DWORD*)(pData+4));
- if(pData) delete [] pData;
- }
+ if(merit < size_t(-1)) merit++;
- RegCloseKey(hKey);
- }
- }
+ if(mymerit < merit)
+ mymerit = merit;
+ }
+
+ if(pData) delete [] pData;
+ }
- if(mymerit > sudFilter[1].dwMerit)
- {
- /*
- CString myguid = _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9852A670-F845-491b-9BE6-EBD841B8A613}");
+ RegCloseKey(hKey);
+ }
+ }
- HKEY hKey;
-
- if(RegOpenKeyEx(HKEY_CLASSES_ROOT, myguid, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
- {
- BYTE* pData = NULL;
- DWORD size = 0;
-
- if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
- {
- pData = new BYTE[size];
-
- if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
- {
- *((DWORD*)(pData+4)) = mymerit;
- if(RegSetValueEx(hKey, str2, 0, REG_BINARY, pData, size) != ERROR_SUCCESS)
- {
- int i = 0;
- }
- }
-
- if(pData) delete [] pData;
- }
-
- RegCloseKey(hKey);
- }
- */
- sudFilter[1].dwMerit = mymerit;
- }
-
- dencode();
+ if(mymerit > sudFilter[1].dwMerit)
+ {
+/*
+ CString myguid = _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9852A670-F845-491b-9BE6-EBD841B8A613}");
+
+ HKEY hKey;
+
+ if(RegOpenKeyEx(HKEY_CLASSES_ROOT, myguid, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
+ {
+ BYTE* pData = NULL;
+ DWORD size = 0;
+
+ if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
+ {
+ pData = new BYTE[size];
+
+ if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
+ {
+ *((DWORD*)(pData+4)) = mymerit;
+ if(RegSetValueEx(hKey, str2, 0, REG_BINARY, pData, size) != ERROR_SUCCESS)
+ {
+ int i = 0;
+ }
+ }
+
+ if(pData) delete [] pData;
+ }
+
+ RegCloseKey(hKey);
+ }
+*/
+ sudFilter[1].dwMerit = mymerit;
+ }
+
+ dencode();
}
bool HmGyanusVagyTeNekem(IPin* pPin)
{
- dencode();
-
- pPin->AddRef();
-
- bool fFail = false;
-
- for(ptrdiff_t i = 0; i < 3 && !fFail; i++)
- {
- BYTE* pData = NULL;
- DWORD size = 0;
-
- HKEY hKey;
-
- if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
- {
- if(RegQueryValueEx(hKey, str3, 0, NULL, NULL, &size) == ERROR_SUCCESS)
- {
- pData = new BYTE[size];
-
- if(pData)
- {
- if(RegQueryValueEx(hKey, str3, 0, NULL, pData, &size) != ERROR_SUCCESS)
- {
- delete [] pData;
- pData = NULL;
- }
- }
- }
-
- RegCloseKey(hKey);
- }
-
- if(pData)
- {
- CPinInfo pi;
- if(SUCCEEDED(pPin->QueryPinInfo(&pi)) && pi.pFilter)
- {
- CFilterInfo fi;
- if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
- && !wcsncmp((WCHAR*)pData, fi.achName, wcslen((WCHAR*)pData)))
- fFail = true;
- }
-
- delete [] pData;
- }
- }
-
- pPin->Release();
-
- dencode();
-
- return(fFail);
+ dencode();
+
+ pPin->AddRef();
+
+ bool fFail = false;
+
+ for(ptrdiff_t i = 0; i < 3 && !fFail; i++)
+ {
+ BYTE* pData = NULL;
+ DWORD size = 0;
+
+ HKEY hKey;
+
+ if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ if(RegQueryValueEx(hKey, str3, 0, NULL, NULL, &size) == ERROR_SUCCESS)
+ {
+ pData = new BYTE[size];
+
+ if(pData)
+ {
+ if(RegQueryValueEx(hKey, str3, 0, NULL, pData, &size) != ERROR_SUCCESS)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+ }
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ if(pData)
+ {
+ CPinInfo pi;
+ if(SUCCEEDED(pPin->QueryPinInfo(&pi)) && pi.pFilter)
+ {
+ CFilterInfo fi;
+ if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
+ && !wcsncmp((WCHAR*)pData, fi.achName, wcslen((WCHAR*)pData)))
+ fFail = true;
+ }
+
+ delete [] pData;
+ }
+ }
+
+ pPin->Release();
+
+ dencode();
+
+ return(fFail);
} \ No newline at end of file
diff --git a/src/filters/transform/vsfilter/vfr.cpp b/src/filters/transform/vsfilter/vfr.cpp
index 3978c2578..667351eb9 100644
--- a/src/filters/transform/vsfilter/vfr.cpp
+++ b/src/filters/transform/vsfilter/vfr.cpp
@@ -30,167 +30,152 @@
// Work with seconds per frame (spf) here instead of fps since that's more natural for the translation we're doing
-class TimecodesV1 : public VFRTranslator
-{
+class TimecodesV1 : public VFRTranslator {
private:
- // Used when sections run out
- double default_spf;
- double first_non_section_timestamp;
- int first_non_section_frame;
-
- // Also generate sections for unspecified ones
- // (use the default framerate then)
- struct FrameRateSection
- {
- double start_time;
- double spf;
- int start_frame;
- int end_frame;
- };
- std::vector<FrameRateSection> sections;
+ // Used when sections run out
+ double default_spf;
+ double first_non_section_timestamp;
+ int first_non_section_frame;
+
+ // Also generate sections for unspecified ones
+ // (use the default framerate then)
+ struct FrameRateSection {
+ double start_time;
+ double spf;
+ int start_frame;
+ int end_frame;
+ };
+ std::vector<FrameRateSection> sections;
public:
- virtual double TimeStampFromFrameNumber(int n)
- {
- // Find correct section
- for(size_t i = 0; i < sections.size(); i++)
- {
- FrameRateSection &sect = sections[i];
- if(n >= sect.start_frame && n <= sect.end_frame)
- {
- return sect.start_time + (n - sect.start_frame) * sect.spf;
- }
- }
- // Not in a section
- if(n < 0) return 0.0;
- return first_non_section_timestamp + (n - first_non_section_frame) * default_spf;
- }
-
- TimecodesV1(FILE *vfrfile)
- {
- char buf[100];
-
- default_spf = -1;
- double cur_time = 0.0;
-
- FrameRateSection temp_section;
- temp_section.start_time = 0.0;
- temp_section.spf = -1;
- temp_section.start_frame = 0;
- temp_section.end_frame = 0;
-
- while(fgets(buf, 100, vfrfile))
- {
- // Comment?
- if(buf[0] == '#') continue;
-
- if(_strnicmp(buf, "Assume ", 7) == 0 && default_spf < 0)
- {
- char *num = buf + 7;
- default_spf = atof(num);
- if(default_spf > 0)
- default_spf = 1 / default_spf;
- else
- default_spf = -1;
- temp_section.spf = default_spf;
- continue;
- }
-
- int start_frame, end_frame;
- float fps;
- if(sscanf(buf, "%d,%d,%f", &start_frame, &end_frame, &fps) == 3)
- {
- // Finish the current temp section
- temp_section.end_frame = start_frame - 1;
- if(temp_section.end_frame >= temp_section.start_frame)
- {
- cur_time += (temp_section.end_frame - temp_section.start_frame + 1) * temp_section.spf;
- sections.push_back(temp_section);
- }
- // Insert the section corresponding to this line
- temp_section.spf = 1 / fps;
- temp_section.start_frame = start_frame;
- temp_section.end_frame = end_frame;
- temp_section.start_time = cur_time;
- cur_time += (end_frame - start_frame + 1) / fps;
- sections.push_back(temp_section);
- // Begin new temp section
- temp_section.spf = default_spf;
- temp_section.start_frame = end_frame + 1;
- temp_section.end_frame = end_frame; // yes, negative duration
- temp_section.start_time = cur_time;
- }
- }
-
- first_non_section_timestamp = cur_time;
- first_non_section_frame = temp_section.start_frame;
- }
+ virtual double TimeStampFromFrameNumber(int n)
+ {
+ // Find correct section
+ for (size_t i = 0; i < sections.size(); i++) {
+ FrameRateSection &sect = sections[i];
+ if (n >= sect.start_frame && n <= sect.end_frame) {
+ return sect.start_time + (n - sect.start_frame) * sect.spf;
+ }
+ }
+ // Not in a section
+ if (n < 0) return 0.0;
+ return first_non_section_timestamp + (n - first_non_section_frame) * default_spf;
+ }
+
+ TimecodesV1(FILE *vfrfile)
+ {
+ char buf[100];
+
+ default_spf = -1;
+ double cur_time = 0.0;
+
+ FrameRateSection temp_section;
+ temp_section.start_time = 0.0;
+ temp_section.spf = -1;
+ temp_section.start_frame = 0;
+ temp_section.end_frame = 0;
+
+ while (fgets(buf, 100, vfrfile)) {
+ // Comment?
+ if (buf[0] == '#') continue;
+
+ if (_strnicmp(buf, "Assume ", 7) == 0 && default_spf < 0) {
+ char *num = buf+7;
+ default_spf = atof(num);
+ if (default_spf > 0)
+ default_spf = 1 / default_spf;
+ else
+ default_spf = -1;
+ temp_section.spf = default_spf;
+ continue;
+ }
+
+ int start_frame, end_frame;
+ float fps;
+ if (sscanf(buf, "%d,%d,%f", &start_frame, &end_frame, &fps) == 3) {
+ // Finish the current temp section
+ temp_section.end_frame = start_frame - 1;
+ if (temp_section.end_frame >= temp_section.start_frame) {
+ cur_time += (temp_section.end_frame - temp_section.start_frame + 1) * temp_section.spf;
+ sections.push_back(temp_section);
+ }
+ // Insert the section corresponding to this line
+ temp_section.spf = 1/fps;
+ temp_section.start_frame = start_frame;
+ temp_section.end_frame = end_frame;
+ temp_section.start_time = cur_time;
+ cur_time += (end_frame - start_frame + 1) / fps;
+ sections.push_back(temp_section);
+ // Begin new temp section
+ temp_section.spf = default_spf;
+ temp_section.start_frame = end_frame + 1;
+ temp_section.end_frame = end_frame; // yes, negative duration
+ temp_section.start_time = cur_time;
+ }
+ }
+
+ first_non_section_timestamp = cur_time;
+ first_non_section_frame = temp_section.start_frame;
+ }
};
-class TimecodesV2 : public VFRTranslator
-{
+class TimecodesV2 : public VFRTranslator {
private:
- // Main data
- std::vector<double> timestamps;
- // For when data are exhausted (well, they shouldn't, then the vfr file is bad)
- int last_known_frame;
- double last_known_timestamp;
- double assumed_spf;
+ // Main data
+ std::vector<double> timestamps;
+ // For when data are exhausted (well, they shouldn't, then the vfr file is bad)
+ int last_known_frame;
+ double last_known_timestamp;
+ double assumed_spf;
public:
- virtual double TimeStampFromFrameNumber(int n)
- {
- if(n < (int)timestamps.size() && n >= 0)
- {
- return timestamps[n];
- }
- if(n < 0) return 0.0;
- return last_known_timestamp + (n - last_known_frame) * assumed_spf;
- }
-
- TimecodesV2(FILE *vfrfile)
- {
- char buf[50];
-
- timestamps.reserve(8192); // should be enough for most cases
-
- while(fgets(buf, 50, vfrfile))
- {
- // Comment?
- if(buf[0] == '#') continue;
- // Otherwise assume it's a good timestamp
- timestamps.push_back(atof(buf) / 1000);
- }
-
- last_known_frame = (int)timestamps.size() - 1;
- last_known_timestamp = timestamps[last_known_frame];
- assumed_spf = last_known_timestamp - timestamps[last_known_frame - 1];
- }
+ virtual double TimeStampFromFrameNumber(int n)
+ {
+ if (n < (int)timestamps.size() && n >= 0) {
+ return timestamps[n];
+ }
+ if (n < 0) return 0.0;
+ return last_known_timestamp + (n - last_known_frame) * assumed_spf;
+ }
+
+ TimecodesV2(FILE *vfrfile)
+ {
+ char buf[50];
+
+ timestamps.reserve(8192); // should be enough for most cases
+
+ while (fgets(buf, 50, vfrfile)) {
+ // Comment?
+ if (buf[0] == '#') continue;
+ // Otherwise assume it's a good timestamp
+ timestamps.push_back(atof(buf)/1000);
+ }
+
+ last_known_frame = (int)timestamps.size()-1;
+ last_known_timestamp = timestamps[last_known_frame];
+ assumed_spf = last_known_timestamp - timestamps[last_known_frame - 1];
+ }
};
VFRTranslator *GetVFRTranslator(const char *vfrfile)
{
- char buf[32];
- buf[19] = 0; // In "# timecode format v1" the version number is character index 19
- FILE *f = fopen(vfrfile, "r");
- VFRTranslator *res = 0;
- if(fgets(buf, 32, f) && buf[0] == '#')
- {
- // So do some really shoddy parsing here, assume the file is good
- if(buf[19] == '1')
- {
- res = new TimecodesV1(f);
- }
- else if(buf[19] == '2')
- {
- res = new TimecodesV2(f);
- }
- }
- fclose(f);
- return res;
+ char buf[32];
+ buf[19] = 0; // In "# timecode format v1" the version number is character index 19
+ FILE *f = fopen(vfrfile, "r");
+ VFRTranslator *res = 0;
+ if (fgets(buf, 32, f) && buf[0] == '#') {
+ // So do some really shoddy parsing here, assume the file is good
+ if (buf[19] == '1') {
+ res = new TimecodesV1(f);
+ } else if (buf[19] == '2') {
+ res = new TimecodesV2(f);
+ }
+ }
+ fclose(f);
+ return res;
}
diff --git a/src/filters/transform/vsfilter/vfr.h b/src/filters/transform/vsfilter/vfr.h
index 3e12347b3..61cb52546 100644
--- a/src/filters/transform/vsfilter/vfr.h
+++ b/src/filters/transform/vsfilter/vfr.h
@@ -24,10 +24,9 @@
#ifndef VFR_H
#define VFR_H
-class VFRTranslator
-{
+class VFRTranslator {
public:
- virtual double TimeStampFromFrameNumber(int n) = 0;
+ virtual double TimeStampFromFrameNumber(int n) = 0;
};
VFRTranslator *GetVFRTranslator(const char *vfrfile);